@treasuredata/tdx 0.8.6 → 0.8.7
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.js +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.d.ts.map +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/process.js.map +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_0x3f75b2=a41_0x5520;(function(_0x47a6ef,_0x5037e6){const _0x9f3781=a41_0x5520,_0x2e5c56=_0x47a6ef();while(!![]){try{const _0x3cb308=-parseInt(_0x9f3781(0x7e))/0x1+-parseInt(_0x9f3781(0x93))/0x2+-parseInt(_0x9f3781(0x90))/0x3*(-parseInt(_0x9f3781(0xaa))/0x4)+parseInt(_0x9f3781(0xa9))/0x5*(parseInt(_0x9f3781(0x96))/0x6)+parseInt(_0x9f3781(0x9f))/0x7*(parseInt(_0x9f3781(0x9c))/0x8)+-parseInt(_0x9f3781(0x8a))/0x9*(parseInt(_0x9f3781(0x99))/0xa)+parseInt(_0x9f3781(0x81))/0xb*(parseInt(_0x9f3781(0x8d))/0xc);if(_0x3cb308===_0x5037e6)break;else _0x2e5c56['push'](_0x2e5c56['shift']());}catch(_0x55e4a2){_0x2e5c56['push'](_0x2e5c56['shift']());}}}(a41_0x3428,0x9bd07));import{BaseCommand}from'./command.js';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions,clearSessionContext}from'../core/session.js';function a41_0x5520(_0x357bdb,_0x16d6ed){_0x357bdb=_0x357bdb-0x7c;const _0x34287e=a41_0x3428();let _0x55203b=_0x34287e[_0x357bdb];return _0x55203b;}function a41_0x3428(){const _0x1a5190=['Session\x20database\x20set\x20to:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20use\x20--clear\x20\x20\x20\x20\x20\x20#\x20Clear\x20session\x20context\x0a','profile','1231107VCjOqV','length','toString','437591qPhBNC','\x0aSet\x20context:\x20tdx\x20use\x20<resource>\x20<value>','Resources:\x20database,\x20parent_segment,\x20llm_project,\x20profile,\x20engage_workspace','use','Session\x20llm_project\x20set\x20to:\x20','message','validate','Invalid\x20resource:\x20','parent_segment','9rCvEvP','error','includes','300FueSxs','Set\x20session-level\x20context','dim','1431qOiJaA','displayWithSources','(session:\x20','2370402uKzIZf','Usage:\x20tdx\x20use\x20<resource>\x20<value>\x0a','engage_workspace','30sZSMeu','debug','session','2814610TgVejg','cleared','execute','8672536UGKmNa','green','display','7gyxIIj','Error:\x20','Error:\x20Profile\x20\x27','name','.\x20Must\x20be\x20one\x20of:\x20','\x0aUse\x20\x27tdx\x20profiles\x27\x20to\x20see\x20available\x20profiles','llm_project','Session\x20profile\x20set\x20to:\x20','log','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','722675crvIbN','4484nABrsQ','Session\x20engage_workspace\x20set\x20to:\x20','Session\x20context\x20','database','\x0aResources:\x20database,\x20parent_segment,\x20llm_project,\x20profile,\x20engage_workspace\x0a'];a41_0x3428=function(){return _0x1a5190;};return a41_0x3428();}import{profileExists}from'../core/profile.js';import{GlobalContext}from'../core/global-context.js';import a41_0x44e6f6 from'chalk';export class UseCommand extends BaseCommand{[a41_0x3f75b2(0xa2)]=a41_0x3f75b2(0x84);['description']=a41_0x3f75b2(0x8e);[a41_0x3f75b2(0x87)](_0x4e4d79){const _0x3a037a=a41_0x3f75b2,{args:_0x5e9546}=_0x4e4d79;if(_0x5e9546[_0x3a037a(0x7f)]===0x0)return undefined;if(_0x5e9546['length']===0x1)return _0x3a037a(0x94)+'\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'+_0x3a037a(0x7c)+_0x3a037a(0xae)+'\x0aRun\x20\x27tdx\x20use\x20--help\x27\x20for\x20more\x20options';const _0x2dd4a5=_0x5e9546[0x0],_0x5397a8=[_0x3a037a(0xad),_0x3a037a(0x89),'llm_project',_0x3a037a(0x7d),_0x3a037a(0x95)];if(!_0x5397a8[_0x3a037a(0x8c)](_0x2dd4a5))return _0x3a037a(0x88)+_0x2dd4a5+_0x3a037a(0xa3)+_0x5397a8['join'](',\x20');return undefined;}async[a41_0x3f75b2(0x9b)](_0x33b125){const _0x56c6b2=a41_0x3f75b2,{args:_0x2cfb18,options:_0x442db9}=_0x33b125,_0x33c2b6=_0x442db9[_0x56c6b2(0x97)],_0x44c36a=_0x442db9['clear'];cleanExpiredSessions();try{if(_0x44c36a){clearSessionContext(_0x442db9[_0x56c6b2(0x98)]);const _0x2358b=_0x442db9[_0x56c6b2(0x98)]||getCurrentSessionPID()[_0x56c6b2(0x80)]();return console[_0x56c6b2(0xa7)](_0x56c6b2(0xac)+a41_0x44e6f6[_0x56c6b2(0x9d)](_0x56c6b2(0x9a))+'\x20'+a41_0x44e6f6[_0x56c6b2(0x8f)](_0x56c6b2(0x92)+_0x2358b+')')),0x0;}if(_0x2cfb18[_0x56c6b2(0x7f)]===0x0){const _0x5886db=new GlobalContext(_0x442db9);return _0x33c2b6?_0x5886db[_0x56c6b2(0x91)]():_0x5886db[_0x56c6b2(0x9e)](),console[_0x56c6b2(0xa7)](a41_0x44e6f6[_0x56c6b2(0x8f)](_0x56c6b2(0x82))),console[_0x56c6b2(0xa7)](a41_0x44e6f6[_0x56c6b2(0x8f)](_0x56c6b2(0x83))),0x0;}const _0x5e1da7=_0x2cfb18[0x0],_0xb6c0ac=_0x2cfb18[0x1];if(_0x5e1da7===_0x56c6b2(0x7d)){if(!profileExists(_0xb6c0ac))return console[_0x56c6b2(0x8b)](_0x56c6b2(0xa1)+_0xb6c0ac+'\x27\x20does\x20not\x20exist'),console[_0x56c6b2(0x8b)](_0x56c6b2(0xa4)),0x1;const _0x8967e4=_0x442db9[_0x56c6b2(0x98)]||getCurrentSessionPID()['toString']();return saveSessionContext({'profile':_0xb6c0ac},_0x442db9['session']),console[_0x56c6b2(0xa7)](_0x56c6b2(0xa6)+a41_0x44e6f6[_0x56c6b2(0x9d)](_0xb6c0ac)+'\x20'+a41_0x44e6f6['dim'](_0x56c6b2(0x92)+_0x8967e4+')')),console[_0x56c6b2(0xa7)](a41_0x44e6f6['dim'](_0x56c6b2(0xa8))),0x0;}const _0x43c8e5={},_0x44e44f=_0x442db9['session']||getCurrentSessionPID()[_0x56c6b2(0x80)]();switch(_0x5e1da7){case _0x56c6b2(0xad):_0x43c8e5[_0x56c6b2(0xad)]=_0xb6c0ac,console[_0x56c6b2(0xa7)](_0x56c6b2(0xaf)+a41_0x44e6f6['green'](_0xb6c0ac)+'\x20'+a41_0x44e6f6[_0x56c6b2(0x8f)](_0x56c6b2(0x92)+_0x44e44f+')'));break;case _0x56c6b2(0x89):_0x43c8e5['parent_segment']=_0xb6c0ac,console[_0x56c6b2(0xa7)]('Session\x20parent_segment\x20set\x20to:\x20'+a41_0x44e6f6['green'](_0xb6c0ac)+'\x20'+a41_0x44e6f6[_0x56c6b2(0x8f)]('(session:\x20'+_0x44e44f+')'));break;case'llm_project':_0x43c8e5[_0x56c6b2(0xa5)]=_0xb6c0ac,console[_0x56c6b2(0xa7)](_0x56c6b2(0x85)+a41_0x44e6f6[_0x56c6b2(0x9d)](_0xb6c0ac)+'\x20'+a41_0x44e6f6[_0x56c6b2(0x8f)](_0x56c6b2(0x92)+_0x44e44f+')'));break;case _0x56c6b2(0x95):_0x43c8e5[_0x56c6b2(0x95)]=_0xb6c0ac,console['log'](_0x56c6b2(0xab)+a41_0x44e6f6[_0x56c6b2(0x9d)](_0xb6c0ac)+'\x20'+a41_0x44e6f6[_0x56c6b2(0x8f)](_0x56c6b2(0x92)+_0x44e44f+')'));break;}return saveSessionContext(_0x43c8e5,_0x442db9[_0x56c6b2(0x98)]),console[_0x56c6b2(0xa7)](a41_0x44e6f6[_0x56c6b2(0x8f)](_0x56c6b2(0xa8))),0x0;}catch(_0x5f1f14){return _0x5f1f14 instanceof Error&&console[_0x56c6b2(0x8b)](_0x56c6b2(0xa0)+_0x5f1f14[_0x56c6b2(0x86)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0x39142f=a42_0x58bd;function a42_0x4372(){const _0x207d00=['list','510636LlqhQC','getCurrent','2498172meVMLv','143DEpVnA','List\x20all\x20users\x20in\x20the\x20account','Error:\x20','\x20\x20Cause:\x20','2cwKMhv','258724wAGoca','user','cause','7UOubXd','error','execute','description','8iYAXMJ','name','Show\x20current\x20user\x20information','291758wZfjFa','141190JRQRvf','Listing\x20users...','verbose','9HMgIZW','1131610LGOGZF','length','✔\x20Found\x20','data','1158426sIGGJU'];a42_0x4372=function(){return _0x207d00;};return a42_0x4372();}(function(_0xfcd5fb,_0x326ab6){const _0x3be9f3=a42_0x58bd,_0x2ff111=_0xfcd5fb();while(!![]){try{const _0x3d5dba=-parseInt(_0x3be9f3(0x119))/0x1*(parseInt(_0x3be9f3(0x10e))/0x2)+-parseInt(_0x3be9f3(0x11d))/0x3*(-parseInt(_0x3be9f3(0x10f))/0x4)+parseInt(_0x3be9f3(0x11e))/0x5+parseInt(_0x3be9f3(0x124))/0x6*(-parseInt(_0x3be9f3(0x112))/0x7)+parseInt(_0x3be9f3(0x116))/0x8*(parseInt(_0x3be9f3(0x122))/0x9)+-parseInt(_0x3be9f3(0x11a))/0xa*(-parseInt(_0x3be9f3(0x127))/0xb)+-parseInt(_0x3be9f3(0x126))/0xc;if(_0x3d5dba===_0x326ab6)break;else _0x2ff111['push'](_0x2ff111['shift']());}catch(_0x24e6f8){_0x2ff111['push'](_0x2ff111['shift']());}}}(a42_0x4372,0x2407d));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{[a42_0x39142f(0x117)]=a42_0x39142f(0x110);['description']=a42_0x39142f(0x118);async[a42_0x39142f(0x114)](_0x2a6c34){const _0x127853=a42_0x39142f,{options:_0x2b40af,tdx:_0x54d789}=_0x2a6c34;try{const _0x911fb=await withSpinner('Fetching\x20user\x20info...',()=>_0x54d789[_0x127853(0x110)][_0x127853(0x125)](),{'verbose':_0x2b40af['verbose']}),_0x2c3756=_0x911fb[_0x127853(0x121)];return await handleSingleObjectOutput(_0x2c3756,_0x2b40af),0x0;}catch(_0x2e009b){if(_0x2e009b instanceof SDKError)return console['error'](_0x127853(0x129)+_0x2e009b['message']),_0x2e009b[_0x127853(0x111)]&&console[_0x127853(0x113)]('\x20\x20Cause:\x20'+_0x2e009b[_0x127853(0x111)]),0x1;throw _0x2e009b;}}}function a42_0x58bd(_0xaccb02,_0x23f96a){_0xaccb02=_0xaccb02-0x10d;const _0x437245=a42_0x4372();let _0x58bd73=_0x437245[_0xaccb02];return _0x58bd73;}export class UserListCommand extends BaseCommand{['name']='user\x20list';[a42_0x39142f(0x115)]=a42_0x39142f(0x128);async[a42_0x39142f(0x114)](_0x352506){const _0x512dff=a42_0x39142f,{options:_0x19e85f,tdx:_0x2c51d7}=_0x352506;try{const _0x531075=await withSpinner(_0x512dff(0x11b),()=>_0x2c51d7[_0x512dff(0x110)][_0x512dff(0x123)](),{'verbose':_0x19e85f[_0x512dff(0x11c)]}),_0x2da7ae=_0x531075[_0x512dff(0x121)];return console[_0x512dff(0x113)](_0x512dff(0x120)+_0x2da7ae[_0x512dff(0x11f)]+'\x20user'+(_0x2da7ae[_0x512dff(0x11f)]!==0x1?'s':'')),await handleSDKOutput(_0x2da7ae,_0x19e85f),0x0;}catch(_0x280a8d){if(_0x280a8d instanceof SDKError)return console[_0x512dff(0x113)]('Error:\x20'+_0x280a8d['message']),_0x280a8d['cause']&&console[_0x512dff(0x113)](_0x512dff(0x10d)+_0x280a8d[_0x512dff(0x111)]),0x1;throw _0x280a8d;}}}
|
|
@@ -1 +1 @@
|
|
|
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;}}
|
|
1
|
+
const a43_0x20f80e=a43_0x4cb6;function a43_0x23f9(){const _0x1dcc6e=['\x22?\x20This\x20cannot\x20be\x20undone.','Error:\x20Invalid\x20JSON\x20in\x20--params','Include\x20retried:\x20yes','projects','status','Listing\x20workflow\x20attempts...','\x20\x20Project:\x20','force','Cancelled','download','54GOWYuM','workflow:workflows','\x20\x20Files\x20extracted:\x20','1179564YHzTkK','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','createdAt','List\x20all\x20workflow\x20projects','3100518OwdNzH','Pattern:\x20','map','execute','split','workflow','params','Project\x20filter:\x20','Getting\x20attempt\x20tasks...','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Killing\x20attempt...','push','from','Revision:\x20','\x20\x20Session\x20ID:\x20','\x20\x20Cause:\x20','includeSubtasks','resumeFrom','projectId','sessionTime','skipValidation','workflow:push','reason','10EMjTPA','✔\x20Pushed\x20','Project:\x20','indexOf','limit','\x20\x20Revision:\x20','Project\x20directory:\x20','\x20\x20New\x20attempt\x20ID:\x20','name','substring','\x20attempt','getTime','List\x20workflow\x20execution\x20sessions','Fetching\x20log\x20files...','parse','Attempt\x20ID:\x20','\x20\x20Workflow:\x20','✔\x20Deleted\x20project\x20','Task\x20name:\x20','retryAttempt','tasks','logFiles','workflow:retry','length','Retry\x20a\x20session\x20or\x20attempt','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Including\x20subtasks:\x20yes','workflow:logs','fileSize','Error:\x20Attempt\x20ID\x20is\x20required','workflow:projects','Usage:\x20workflow:delete\x20<project-name-or-id>','Reason:\x20','cause','Resume\x20from:\x20','...','Listing\x20workflow\x20sessions...','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','\x20\x20Attempt\x20ID:\x20','workflow:download','workflow:delete','attempt:','\x20is\x20not\x20a\x20directory','logs','Project\x20name:\x20','Output\x20directory:\x20','Error:\x20Invalid\x20parameter\x20format:\x20','\x20workflow','fromTask','Show\x20specific\x20attempt\x20details','success','json','round','param','Select\x20a\x20task\x20to\x20view\x20logs:','✔\x20Found\x20','Show\x20logs\x20for\x20a\x20workflow\x20attempt','Filter:\x20','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','attempts','Target:\x20','description','project','53228JBWlih','Downloading\x20logs...','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','\x20\x20Project\x20ID:\x20','error','No\x20log\x20content\x20found','workflow:attempts','List\x20workflow\x20attempts','Session\x20time:\x20','\x20task','projectName','Error:\x20Workflow\x20identifier\x20is\x20required','Deleting\x20project\x20','workflow:attempt','retryAttemptName','Filter:\x20project=','attempt','Workflow:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','workflow:tasks','message','561eykgdR','sessions','cancelRequested','Start\x20a\x20workflow\x20run','Error:\x20Project\x20name\x20is\x20required','yes','stat','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','sessionId','session:','workflow:kill','Listing\x20workflows...','Getting\x20attempt\x20details...','✔\x20Workflow\x20run\x20started','Validation:\x20skipped','verbose','Starting\x20workflow\x20run...','Listing\x20workflow\x20projects...','Error:\x20','isDirectory','task','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','format','run','Show\x20tasks\x20for\x20an\x20attempt','Downloading\x20project\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','session','From\x20task:\x20','data','delete','1149407hLupaA','finishedAt','startsWith','keys','No\x20log\x20files\x20found\x20for\x20this\x20attempt','revision','Expected\x20format:\x20--param\x20key=value','Kill\x20a\x20running\x20attempt','List\x20workflows','47925IofYaU','taskName','workflow:sessions','1742672xjArQa','index','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','retrySession'];a43_0x23f9=function(){return _0x1dcc6e;};return a43_0x23f9();}(function(_0x2cf9e6,_0x7ba50a){const _0x53c400=a43_0x4cb6,_0x2eea7b=_0x2cf9e6();while(!![]){try{const _0x5ac4d0=parseInt(_0x53c400(0x1f0))/0x1*(parseInt(_0x53c400(0x229))/0x2)+-parseInt(_0x53c400(0x218))/0x3+parseInt(_0x53c400(0x1db))/0x4*(parseInt(_0x53c400(0x19c))/0x5)+-parseInt(_0x53c400(0x22c))/0x6+parseInt(_0x53c400(0x20f))/0x7+-parseInt(_0x53c400(0x21b))/0x8+parseInt(_0x53c400(0x230))/0x9;if(_0x5ac4d0===_0x7ba50a)break;else _0x2eea7b['push'](_0x2eea7b['shift']());}catch(_0x54a176){_0x2eea7b['push'](_0x2eea7b['shift']());}}}(a43_0x23f9,0x1d4fd));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_0x1a105c from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1ba);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x22f);async['execute'](_0x2997a4){const _0x3da6c1=a43_0x20f80e,{options:_0x17521d,args:_0x4dbdff,tdx:_0x2334c2}=_0x2997a4,_0x8ac48e=_0x4dbdff[0x0];try{_0x17521d['verbose']&&_0x8ac48e&&console['error'](_0x3da6c1(0x231)+_0x8ac48e);const _0x51ce37=await withSpinner(_0x3da6c1(0x201),()=>_0x2334c2['workflow'][_0x3da6c1(0x222)](_0x8ac48e,{'limit':_0x17521d['limit']}),{'verbose':_0x17521d[_0x3da6c1(0x1ff)]}),_0x5832ad=_0x51ce37['data'];return console[_0x3da6c1(0x1df)]('✔\x20Found\x20'+_0x5832ad['length']+'\x20project'+(_0x5832ad[_0x3da6c1(0x1b3)]!==0x1?'s':'')),await handleSDKOutput(_0x5832ad,_0x17521d),0x0;}catch(_0x4f9232){if(_0x4f9232 instanceof SDKError)return console[_0x3da6c1(0x1df)](_0x3da6c1(0x202)+_0x4f9232[_0x3da6c1(0x1ef)]),_0x4f9232[_0x3da6c1(0x1bd)]&&console[_0x3da6c1(0x1df)](_0x3da6c1(0x23f)+_0x4f9232[_0x3da6c1(0x1bd)]),0x1;throw _0x4f9232;}}}export class WorkflowWorkflowsCommand extends BaseCommand{['name']=a43_0x20f80e(0x22a);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x217);async[a43_0x20f80e(0x233)](_0x5e6e71){const _0x20145f=a43_0x20f80e,{options:_0x496ae5,args:_0x531edb,tdx:_0xc6c6b1}=_0x5e6e71,_0x517b1a=_0x531edb[0x0];try{_0x496ae5['verbose']&&_0x517b1a&&console['error'](_0x20145f(0x237)+_0x517b1a);const _0x5f2b0a=await withSpinner(_0x20145f(0x1fb),()=>_0xc6c6b1[_0x20145f(0x235)]['workflows'](_0x517b1a,{'limit':_0x496ae5[_0x20145f(0x1a0)]}),{'verbose':_0x496ae5[_0x20145f(0x1ff)]}),_0x54cc61=_0x5f2b0a[_0x20145f(0x20d)];return console[_0x20145f(0x1df)](_0x20145f(0x1d3)+_0x54cc61[_0x20145f(0x1b3)]+_0x20145f(0x1cb)+(_0x54cc61[_0x20145f(0x1b3)]!==0x1?'s':'')),await handleSDKOutput(_0x54cc61,_0x496ae5),0x0;}catch(_0x9be6c6){if(_0x9be6c6 instanceof SDKError)return console[_0x20145f(0x1df)]('Error:\x20'+_0x9be6c6[_0x20145f(0x1ef)]),_0x9be6c6['cause']&&console['error'](_0x20145f(0x23f)+_0x9be6c6[_0x20145f(0x1bd)]),0x1;throw _0x9be6c6;}}}export class WorkflowSessionsCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x21a);['description']=a43_0x20f80e(0x1a8);async['execute'](_0x61fc30){const _0x31a9c7=a43_0x20f80e,{options:_0x4369e8,args:_0x1fa680,tdx:_0x684902}=_0x61fc30;let _0x5ad637,_0xf96651;if(_0x1fa680[0x0]){const _0x5c7b52=_0x1fa680[0x0][_0x31a9c7(0x234)]('.');if(_0x5c7b52[_0x31a9c7(0x1b3)]===0x1)_0x5ad637=_0x5c7b52[0x0];else{if(_0x5c7b52[_0x31a9c7(0x1b3)]===0x2)[_0x5ad637,_0xf96651]=_0x5c7b52;else return console[_0x31a9c7(0x1df)](_0x31a9c7(0x239)),0x1;}}try{if(_0x4369e8[_0x31a9c7(0x1ff)]){if(_0x5ad637&&_0xf96651)console[_0x31a9c7(0x1df)](_0x31a9c7(0x1d5)+_0x5ad637+'.'+_0xf96651);else _0x5ad637&&console['error'](_0x31a9c7(0x1ea)+_0x5ad637);const _0x25417f=_0x4369e8[_0x31a9c7(0x223)];_0x25417f&&console[_0x31a9c7(0x1df)]('Status:\x20'+_0x25417f);}const _0x5b1347=await withSpinner(_0x31a9c7(0x1c0),()=>_0x684902[_0x31a9c7(0x235)][_0x31a9c7(0x1f1)]({'projectName':_0x5ad637,'workflowName':_0xf96651,'status':_0x4369e8[_0x31a9c7(0x223)],'fromTime':_0x4369e8[_0x31a9c7(0x23c)],'toTime':_0x4369e8['to'],'limit':_0x4369e8[_0x31a9c7(0x1a0)]}),{'verbose':_0x4369e8[_0x31a9c7(0x1ff)]}),_0x591dc5=_0x5b1347['data'];return console[_0x31a9c7(0x1df)](_0x31a9c7(0x1d3)+_0x591dc5[_0x31a9c7(0x1b3)]+'\x20session'+(_0x591dc5[_0x31a9c7(0x1b3)]!==0x1?'s':'')),await handleSDKOutput(_0x591dc5,_0x4369e8),0x0;}catch(_0x1bbfd2){if(_0x1bbfd2 instanceof SDKError)return console[_0x31a9c7(0x1df)](_0x31a9c7(0x202)+_0x1bbfd2[_0x31a9c7(0x1ef)]),_0x1bbfd2['cause']&&console[_0x31a9c7(0x1df)](_0x31a9c7(0x23f)+_0x1bbfd2['cause']),0x1;throw _0x1bbfd2;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1e1);['description']=a43_0x20f80e(0x1e2);async['execute'](_0x4728e8){const _0x23d2e9=a43_0x20f80e,{options:_0x3aace3,args:_0x413eaf,tdx:_0x13bc3c}=_0x4728e8;let _0x34106b,_0x39f95a;if(_0x413eaf[0x0]){const _0x346053=_0x413eaf[0x0]['split']('.');if(_0x346053['length']===0x1)_0x34106b=_0x346053[0x0];else{if(_0x346053['length']===0x2)[_0x34106b,_0x39f95a]=_0x346053;else return console[_0x23d2e9(0x1df)](_0x23d2e9(0x239)),0x1;}}try{const _0x4d5d21=_0x3aace3['includeRetried'];if(_0x3aace3[_0x23d2e9(0x1ff)]){if(_0x34106b&&_0x39f95a)console[_0x23d2e9(0x1df)](_0x23d2e9(0x1d5)+_0x34106b+'.'+_0x39f95a);else _0x34106b&&console[_0x23d2e9(0x1df)]('Filter:\x20project='+_0x34106b);_0x4d5d21&&console[_0x23d2e9(0x1df)](_0x23d2e9(0x221));}const _0x1d2def=await withSpinner(_0x23d2e9(0x224),()=>_0x13bc3c[_0x23d2e9(0x235)][_0x23d2e9(0x1d7)]({'projectName':_0x34106b,'workflowName':_0x39f95a,'includeRetried':_0x4d5d21,'limit':_0x3aace3[_0x23d2e9(0x1a0)]}),{'verbose':_0x3aace3['verbose']}),_0x336de2=_0x1d2def[_0x23d2e9(0x20d)];return console[_0x23d2e9(0x1df)](_0x23d2e9(0x1d3)+_0x336de2[_0x23d2e9(0x1b3)]+_0x23d2e9(0x1a6)+(_0x336de2[_0x23d2e9(0x1b3)]!==0x1?'s':'')),await handleSDKOutput(_0x336de2,_0x3aace3),0x0;}catch(_0x242364){if(_0x242364 instanceof SDKError)return console[_0x23d2e9(0x1df)](_0x23d2e9(0x202)+_0x242364[_0x23d2e9(0x1ef)]),_0x242364[_0x23d2e9(0x1bd)]&&console[_0x23d2e9(0x1df)](_0x23d2e9(0x23f)+_0x242364['cause']),0x1;throw _0x242364;}}}export class WorkflowAttemptCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1e8);['description']=a43_0x20f80e(0x1cd);async[a43_0x20f80e(0x233)](_0x260540){const _0x411b54=a43_0x20f80e,{options:_0x30c776,args:_0x510a48,tdx:_0x294071}=_0x260540,_0x2c1289=_0x510a48[0x0];if(!_0x2c1289)return console[_0x411b54(0x1df)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x30c776[_0x411b54(0x1ff)]&&console[_0x411b54(0x1df)](_0x411b54(0x1ab)+_0x2c1289);const _0x568e48=await withSpinner(_0x411b54(0x1fc),()=>_0x294071[_0x411b54(0x235)][_0x411b54(0x1eb)](_0x2c1289),{'verbose':_0x30c776['verbose']}),_0x3c2742=_0x568e48[_0x411b54(0x20d)];let _0x162fdc;!_0x3c2742['done']?_0x162fdc=_0x3c2742[_0x411b54(0x1f2)]?'canceling':'running':_0x162fdc=_0x3c2742['success']?_0x411b54(0x1ce):_0x411b54(0x1df);let _0x1371f6;if(_0x3c2742[_0x411b54(0x22e)]&&_0x3c2742[_0x411b54(0x210)]){const _0x13da13=new Date(_0x3c2742[_0x411b54(0x22e)])[_0x411b54(0x1a7)](),_0x5dd25c=new Date(_0x3c2742[_0x411b54(0x210)])['getTime']();_0x1371f6=Math[_0x411b54(0x1d0)]((_0x5dd25c-_0x13da13)/0x3e8);}const _0xaf2aff={'attempt_id':_0x3c2742['id'],'status':_0x162fdc,..._0x3c2742[_0x411b54(0x21c)]!==undefined&&{'index':_0x3c2742[_0x411b54(0x21c)]},..._0x3c2742[_0x411b54(0x1da)]&&{'project':_0x3c2742[_0x411b54(0x1da)][_0x411b54(0x1a4)]},..._0x3c2742[_0x411b54(0x235)]&&{'workflow':_0x3c2742[_0x411b54(0x235)][_0x411b54(0x1a4)]},..._0x3c2742[_0x411b54(0x1f8)]&&{'session_id':_0x3c2742[_0x411b54(0x1f8)]},..._0x3c2742[_0x411b54(0x243)]&&{'session_time':_0x3c2742[_0x411b54(0x243)]},..._0x3c2742[_0x411b54(0x1e9)]&&{'retry_attempt':_0x3c2742['retryAttemptName']},..._0x1371f6!==undefined&&{'duration_sec':_0x1371f6},..._0x3c2742[_0x411b54(0x22e)]&&{'created_at':_0x3c2742[_0x411b54(0x22e)]},..._0x3c2742[_0x411b54(0x210)]&&{'finished_at':_0x3c2742[_0x411b54(0x210)]},...Object[_0x411b54(0x212)](_0x3c2742[_0x411b54(0x236)])[_0x411b54(0x1b3)]>0x0&&{'params':_0x3c2742['params']}};return await handleSingleObjectOutput(_0xaf2aff,_0x30c776),0x0;}catch(_0x7fd602){if(_0x7fd602 instanceof SDKError)return console[_0x411b54(0x1df)](_0x411b54(0x202)+_0x7fd602[_0x411b54(0x1ef)]),_0x7fd602['cause']&&console[_0x411b54(0x1df)](_0x411b54(0x23f)+_0x7fd602[_0x411b54(0x1bd)]),0x1;throw _0x7fd602;}}}export class WorkflowTasksCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1ee);['description']=a43_0x20f80e(0x208);async[a43_0x20f80e(0x233)](_0x3475bb){const _0x41f306=a43_0x20f80e,{options:_0x19e1ba,args:_0x2d10b7,tdx:_0x587dfb}=_0x3475bb,_0x36b97e=_0x2d10b7[0x0];if(!_0x36b97e)return console[_0x41f306(0x1df)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x347cb6=_0x19e1ba[_0x41f306(0x240)];_0x19e1ba[_0x41f306(0x1ff)]&&(console[_0x41f306(0x1df)]('Attempt\x20ID:\x20'+_0x36b97e),_0x347cb6&&console[_0x41f306(0x1df)](_0x41f306(0x1b6)));const _0x3d7dab=await withSpinner(_0x41f306(0x238),()=>_0x587dfb[_0x41f306(0x235)][_0x41f306(0x1b0)](_0x36b97e,_0x347cb6||![]),{'verbose':_0x19e1ba[_0x41f306(0x1ff)]}),_0x4029ab=_0x3d7dab[_0x41f306(0x20d)];return console['error']('✔\x20Found\x20'+_0x4029ab[_0x41f306(0x1b3)]+_0x41f306(0x1e4)+(_0x4029ab[_0x41f306(0x1b3)]!==0x1?'s':'')),await handleSDKOutput(_0x4029ab,_0x19e1ba),0x0;}catch(_0x5537f7){if(_0x5537f7 instanceof SDKError)return console['error'](_0x41f306(0x202)+_0x5537f7[_0x41f306(0x1ef)]),_0x5537f7[_0x41f306(0x1bd)]&&console[_0x41f306(0x1df)](_0x41f306(0x23f)+_0x5537f7[_0x41f306(0x1bd)]),0x1;throw _0x5537f7;}}}export class WorkflowLogsCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1b7);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x1d4);async[a43_0x20f80e(0x233)](_0x14a1f0){const _0x4e69a7=a43_0x20f80e,{options:_0x1f2c37,args:_0x52e89b,tdx:_0x1f3711}=_0x14a1f0,_0x42c398=_0x52e89b[0x0];let _0xd8ffbd=_0x52e89b[0x1];if(!_0x42c398)return console[_0x4e69a7(0x1df)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x1f2c37[_0x4e69a7(0x1ff)]&&(console['error']('Attempt\x20ID:\x20'+_0x42c398),_0xd8ffbd&&console[_0x4e69a7(0x1df)](_0x4e69a7(0x1ae)+_0xd8ffbd));const _0x3f40bb=await withSpinner(_0x4e69a7(0x1a9),()=>_0x1f3711['workflow'][_0x4e69a7(0x1b1)](_0x42c398,_0xd8ffbd),{'verbose':_0x1f2c37[_0x4e69a7(0x1ff)]}),_0x295b1a=_0x3f40bb[_0x4e69a7(0x20d)];if(_0x295b1a['length']===0x0)return console['error'](_0x4e69a7(0x213)),0x0;if(!_0xd8ffbd&&(_0x1f2c37[_0x4e69a7(0x1cf)]||_0x1f2c37[_0x4e69a7(0x206)]))return await handleSDKOutput(_0x295b1a,_0x1f2c37),0x0;if(!_0xd8ffbd){const _0x490a7b=_0x295b1a[_0x4e69a7(0x232)](_0x13690f=>({'title':_0x13690f[_0x4e69a7(0x219)]+'\x20('+formatBytes(_0x13690f[_0x4e69a7(0x1b8)])+')','value':_0x13690f[_0x4e69a7(0x219)]})),_0x37c28e=await a43_0x1a105c({'type':'select','name':'task','message':_0x4e69a7(0x1d2),'choices':_0x490a7b});if(!_0x37c28e[_0x4e69a7(0x204)])return console['error'](_0x4e69a7(0x227)),0x0;_0xd8ffbd=_0x37c28e['task'];}const _0x5b8dbf=await withSpinner(_0x4e69a7(0x1dc),()=>_0x1f3711[_0x4e69a7(0x235)][_0x4e69a7(0x1c7)](_0x42c398,_0xd8ffbd),{'verbose':_0x1f2c37[_0x4e69a7(0x1ff)]}),_0x130617=_0x5b8dbf['data'];return _0x130617?console['log'](_0x130617):console['error'](_0x4e69a7(0x1e0)),0x0;}catch(_0x4a19a4){if(_0x4a19a4 instanceof SDKError)return console[_0x4e69a7(0x1df)]('Error:\x20'+_0x4a19a4['message']),_0x4a19a4[_0x4e69a7(0x1bd)]&&console['error'](_0x4e69a7(0x23f)+_0x4a19a4['cause']),0x1;throw _0x4a19a4;}}}export class WorkflowKillCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1fa);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x216);async[a43_0x20f80e(0x233)](_0x457880){const _0x5c6b39=a43_0x20f80e,{options:_0x435dfa,args:_0x41fc9e,tdx:_0x2576cb}=_0x457880,_0x1cd459=_0x41fc9e[0x0];if(!_0x1cd459)return console[_0x5c6b39(0x1df)](_0x5c6b39(0x1b9)),0x1;try{const _0x58d155=_0x435dfa[_0x5c6b39(0x19b)];_0x435dfa['verbose']&&(console[_0x5c6b39(0x1df)](_0x5c6b39(0x1ab)+_0x1cd459),_0x58d155&&console[_0x5c6b39(0x1df)](_0x5c6b39(0x1bc)+_0x58d155));if(!_0x435dfa[_0x5c6b39(0x1f5)]){const _0x40f8be=await confirm(_0x5c6b39(0x1ed)+_0x1cd459+'?');if(!_0x40f8be)return console[_0x5c6b39(0x1df)]('Cancelled'),0x0;}const _0x4fb8e8=await withSpinner(_0x5c6b39(0x23a),()=>_0x2576cb[_0x5c6b39(0x235)]['kill'](_0x1cd459,_0x58d155),{'verbose':_0x435dfa[_0x5c6b39(0x1ff)]}),_0x35d0c7=_0x4fb8e8['data'];return console['error']('✔\x20'+_0x35d0c7),0x0;}catch(_0x377903){if(_0x377903 instanceof SDKError)return console['error'](_0x5c6b39(0x202)+_0x377903['message']),_0x377903[_0x5c6b39(0x1bd)]&&console['error']('\x20\x20Cause:\x20'+_0x377903[_0x5c6b39(0x1bd)]),0x1;throw _0x377903;}}}export class WorkflowRetryCommand extends BaseCommand{['name']=a43_0x20f80e(0x1b2);['description']=a43_0x20f80e(0x1b4);async[a43_0x20f80e(0x233)](_0x207780){const _0x3f6532=a43_0x20f80e,{options:_0xf6c02,args:_0x6809ef,tdx:_0x185422}=_0x207780,_0x4b068e=_0x6809ef[0x0];if(!_0x4b068e)return console[_0x3f6532(0x1df)](_0x3f6532(0x205)),console[_0x3f6532(0x1df)](_0x3f6532(0x1d6)),0x1;let _0x1a39d4=![],_0x179134=_0x4b068e;if(_0x4b068e['startsWith'](_0x3f6532(0x1f9)))_0x1a39d4=!![],_0x179134=_0x4b068e[_0x3f6532(0x1a5)](0x8);else{if(_0x4b068e[_0x3f6532(0x211)](_0x3f6532(0x1c5)))_0x1a39d4=![],_0x179134=_0x4b068e[_0x3f6532(0x1a5)](0x8);else return console['error']('Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'),console[_0x3f6532(0x1df)](_0x3f6532(0x1d6)),0x1;}try{const _0x23ee62=_0xf6c02[_0x3f6532(0x1cc)],_0x1a61c1=_0xf6c02[_0x3f6532(0x241)],_0x914f86=_0xf6c02['params'],_0x3bea8d=_0xf6c02[_0x3f6532(0x226)];_0xf6c02[_0x3f6532(0x1ff)]&&(console[_0x3f6532(0x1df)](_0x3f6532(0x1d8)+(_0x1a39d4?_0x3f6532(0x20b):_0x3f6532(0x1eb))+'\x20'+_0x179134),_0x23ee62&&console[_0x3f6532(0x1df)](_0x3f6532(0x20c)+_0x23ee62),_0x1a61c1&&console[_0x3f6532(0x1df)](_0x3f6532(0x1be)+_0x1a61c1),_0x914f86&&console['error']('Params:\x20'+_0x914f86),_0x3bea8d&&console[_0x3f6532(0x1df)]('Force:\x20yes'));let _0x1d70f9;if(_0x914f86)try{if(_0x914f86[_0x3f6532(0x211)]('@')){const _0x38ddeb=await import('fs/promises'),_0x4cf646=_0x914f86['substring'](0x1),_0x500373=await _0x38ddeb['readFile'](_0x4cf646,'utf-8');_0x1d70f9=JSON[_0x3f6532(0x1aa)](_0x500373);}else _0x1d70f9=JSON['parse'](_0x914f86);}catch{return console[_0x3f6532(0x1df)](_0x3f6532(0x220)),0x1;}if(!_0xf6c02[_0x3f6532(0x1f5)]){const _0x3e11d0=await confirm(_0x3f6532(0x20a)+(_0x1a39d4?_0x3f6532(0x20b):_0x3f6532(0x1eb))+'\x20'+_0x179134+'?');if(!_0x3e11d0)return console[_0x3f6532(0x1df)](_0x3f6532(0x227)),0x0;}let _0x2356ff;_0x1a39d4?_0x2356ff=await withSpinner('Retrying\x20session...',()=>_0x185422[_0x3f6532(0x235)][_0x3f6532(0x21e)](_0x179134,{'fromTask':_0x23ee62,'retryParams':_0x1d70f9}),{'verbose':_0xf6c02['verbose']}):_0x2356ff=await withSpinner('Retrying\x20attempt...',()=>_0x185422['workflow'][_0x3f6532(0x1af)](_0x179134,{'resumeFrom':_0x1a61c1,'retryParams':_0x1d70f9,'force':_0x3bea8d}),{'verbose':_0xf6c02[_0x3f6532(0x1ff)]});const _0x4fe6f9=_0x2356ff['data'];return console[_0x3f6532(0x1df)]('✔\x20Retry\x20started'),console['error'](_0x3f6532(0x1a3)+_0x4fe6f9['attemptId']),console[_0x3f6532(0x1df)](_0x3f6532(0x23e)+_0x4fe6f9['sessionId']),0x0;}catch(_0x1bac21){if(_0x1bac21 instanceof SDKError)return console[_0x3f6532(0x1df)](_0x3f6532(0x202)+_0x1bac21[_0x3f6532(0x1ef)]),_0x1bac21[_0x3f6532(0x1bd)]&&console['error'](_0x3f6532(0x23f)+_0x1bac21[_0x3f6532(0x1bd)]),0x1;throw _0x1bac21;}}}export class WorkflowRunCommand extends BaseCommand{['name']='workflow:run';[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x1f3);async[a43_0x20f80e(0x233)](_0x319b02){const _0x340caf=a43_0x20f80e,{options:_0x544144,args:_0x30e394,tdx:_0xbb002b}=_0x319b02,_0x73a0a7=_0x30e394[0x0];if(!_0x73a0a7)return console['error'](_0x340caf(0x1e6)),console[_0x340caf(0x1df)](_0x340caf(0x1c1)),0x1;const _0x123b3e=_0x544144[_0x340caf(0x1d1)],_0x542330=_0x544144[_0x340caf(0x243)],_0x3f6df9={};if(_0x123b3e&&Array['isArray'](_0x123b3e))for(const _0x1c834e of _0x123b3e){const _0x574599=_0x1c834e[_0x340caf(0x19f)]('=');if(_0x574599===-0x1)return console[_0x340caf(0x1df)](_0x340caf(0x1ca)+_0x1c834e),console[_0x340caf(0x1df)](_0x340caf(0x215)),0x1;const _0x5128ac=_0x1c834e['substring'](0x0,_0x574599),_0x29917d=_0x1c834e[_0x340caf(0x1a5)](_0x574599+0x1);try{_0x3f6df9[_0x5128ac]=JSON[_0x340caf(0x1aa)](_0x29917d);}catch{_0x3f6df9[_0x5128ac]=_0x29917d;}}_0x544144[_0x340caf(0x1ff)]&&(console[_0x340caf(0x1df)](_0x340caf(0x1ec)+_0x73a0a7),Object[_0x340caf(0x212)](_0x3f6df9)[_0x340caf(0x1b3)]>0x0&&console['error']('Parameters:\x20'+JSON['stringify'](_0x3f6df9)),_0x542330&&console[_0x340caf(0x1df)](_0x340caf(0x1e3)+_0x542330));const _0x4430ad=await withSpinner(_0x340caf(0x200),()=>_0xbb002b[_0x340caf(0x235)][_0x340caf(0x207)](_0x73a0a7,_0x3f6df9,{'sessionTime':_0x542330}),{'verbose':_0x544144['verbose']}),_0x38a755=_0x4430ad['data'];return console['error'](_0x340caf(0x1fd)),console[_0x340caf(0x1df)](_0x340caf(0x1c2)+_0x38a755['id']),console[_0x340caf(0x1df)]('\x20\x20Session\x20ID:\x20'+_0x38a755[_0x340caf(0x1f8)]),console[_0x340caf(0x1df)](_0x340caf(0x225)+_0x38a755[_0x340caf(0x1da)]?.['name']),console[_0x340caf(0x1df)](_0x340caf(0x1ac)+_0x38a755[_0x340caf(0x235)]?.[_0x340caf(0x1a4)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1c3);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x21d);async['execute'](_0x5bc304){const _0x133aa0=a43_0x20f80e,{options:_0x304b00,args:_0x295766,tdx:_0x2a6288}=_0x5bc304,_0x50b63b=_0x295766[0x0],_0x51ec7e=_0x295766[0x1]||'.';if(!_0x50b63b)return console[_0x133aa0(0x1df)](_0x133aa0(0x1f4)),console[_0x133aa0(0x1df)](_0x133aa0(0x1dd)),0x1;const _0x543ebe=_0x304b00[_0x133aa0(0x214)];_0x304b00[_0x133aa0(0x1ff)]&&(console['error'](_0x133aa0(0x19e)+_0x50b63b),console['error'](_0x133aa0(0x1c9)+_0x51ec7e),_0x543ebe&&console['error'](_0x133aa0(0x23d)+_0x543ebe));const _0x49f35d=await withSpinner(_0x133aa0(0x209)+_0x50b63b+_0x133aa0(0x1bf),()=>_0x2a6288[_0x133aa0(0x235)][_0x133aa0(0x228)](_0x50b63b,_0x51ec7e,{'revision':_0x543ebe}),{'verbose':_0x304b00[_0x133aa0(0x1ff)]}),_0x59324f=_0x49f35d[_0x133aa0(0x20d)];return console['error']('✔\x20Downloaded\x20'+_0x59324f[_0x133aa0(0x1e5)]),console[_0x133aa0(0x1df)](_0x133aa0(0x1a1)+_0x59324f[_0x133aa0(0x214)]),console['error'](_0x133aa0(0x22b)+_0x59324f['filesExtracted']),console[_0x133aa0(0x1df)]('\x20\x20Location:\x20'+_0x51ec7e+'/'+_0x59324f['projectName']),0x0;}}function a43_0x4cb6(_0x49c0e2,_0x50d60c){_0x49c0e2=_0x49c0e2-0x199;const _0x23f913=a43_0x23f9();let _0x4cb649=_0x23f913[_0x49c0e2];return _0x4cb649;}export class WorkflowPushCommand extends BaseCommand{['name']=a43_0x20f80e(0x19a);['description']='Push\x20workflow\x20project\x20to\x20Treasure\x20Data';async[a43_0x20f80e(0x233)](_0x1c1e27){const _0x1630b2=a43_0x20f80e,{options:_0x3ddd85,args:_0x5be7fa,tdx:_0x4825fc}=_0x1c1e27;let _0x416104='.',_0x27edef=_0x3ddd85['name'];if(_0x5be7fa[0x0]){const {promises:_0x380e47}=await import('fs');try{const _0x139d23=await _0x380e47[_0x1630b2(0x1f6)](_0x5be7fa[0x0]);if(_0x139d23[_0x1630b2(0x203)]())_0x416104=_0x5be7fa[0x0];else return console[_0x1630b2(0x1df)](_0x1630b2(0x202)+_0x5be7fa[0x0]+_0x1630b2(0x1c6)),0x1;}catch{_0x27edef=_0x5be7fa[0x0],_0x416104='.';}}const _0x25a250=_0x3ddd85[_0x1630b2(0x214)],_0x99d55a=_0x3ddd85[_0x1630b2(0x199)];_0x3ddd85[_0x1630b2(0x1ff)]&&(console[_0x1630b2(0x1df)](_0x1630b2(0x1a2)+_0x416104),_0x27edef&&console[_0x1630b2(0x1df)](_0x1630b2(0x1c8)+_0x27edef),_0x25a250&&console['error'](_0x1630b2(0x23d)+_0x25a250),_0x99d55a&&console[_0x1630b2(0x1df)](_0x1630b2(0x1fe)));const _0x80cf32=await withSpinner('Pushing\x20workflow\x20project...',()=>_0x4825fc[_0x1630b2(0x235)][_0x1630b2(0x23b)](_0x416104,{'projectName':_0x27edef,'revision':_0x25a250,'skipValidation':_0x99d55a}),{'verbose':_0x3ddd85[_0x1630b2(0x1ff)]}),_0x2b3e11=_0x80cf32[_0x1630b2(0x20d)];return console[_0x1630b2(0x1df)](_0x1630b2(0x19d)+_0x2b3e11[_0x1630b2(0x1e5)]),console[_0x1630b2(0x1df)](_0x1630b2(0x1de)+_0x2b3e11[_0x1630b2(0x242)]),console[_0x1630b2(0x1df)](_0x1630b2(0x1a1)+_0x2b3e11[_0x1630b2(0x214)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{['name']=a43_0x20f80e(0x1c4);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x22d);async['execute'](_0x3ec2a6){const _0x4ba6d6=a43_0x20f80e,{options:_0x3e7db1,args:_0x1f8ec3,tdx:_0xbc4735}=_0x3ec2a6,_0x45fdc7=_0x1f8ec3[0x0];if(!_0x45fdc7)return console[_0x4ba6d6(0x1df)](_0x4ba6d6(0x1f7)),console[_0x4ba6d6(0x1df)](_0x4ba6d6(0x1bb)),0x1;_0x3e7db1[_0x4ba6d6(0x1ff)]&&console[_0x4ba6d6(0x1df)]('Project:\x20'+_0x45fdc7);if(!_0x3e7db1[_0x4ba6d6(0x1f5)]){const _0x5d96d3=await confirm(_0x4ba6d6(0x1b5)+_0x45fdc7+_0x4ba6d6(0x21f));if(!_0x5d96d3)return console[_0x4ba6d6(0x1df)]('Cancelled'),0x0;}const _0x27f1d3=await withSpinner(_0x4ba6d6(0x1e7)+_0x45fdc7+_0x4ba6d6(0x1bf),()=>_0xbc4735['workflow'][_0x4ba6d6(0x20e)](_0x45fdc7),{'verbose':_0x3e7db1[_0x4ba6d6(0x1ff)]}),_0x397a19=_0x27f1d3[_0x4ba6d6(0x20d)];return console[_0x4ba6d6(0x1df)](_0x4ba6d6(0x1ad)+_0x397a19[_0x4ba6d6(0x1e5)]),console['error'](_0x4ba6d6(0x1de)+_0x397a19['projectId']),0x0;}}
|
package/dist/core/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x4c87b4,_0x55df91){const _0x5cd7bc=a44_0x254e,_0xe247b6=_0x4c87b4();while(!![]){try{const _0x228126=parseInt(_0x5cd7bc(0x18c))/0x1*(parseInt(_0x5cd7bc(0x18a))/0x2)+-parseInt(_0x5cd7bc(0x19a))/0x3*(parseInt(_0x5cd7bc(0x192))/0x4)+-parseInt(_0x5cd7bc(0x19d))/0x5*(parseInt(_0x5cd7bc(0x195))/0x6)+-parseInt(_0x5cd7bc(0x194))/0x7*(parseInt(_0x5cd7bc(0x196))/0x8)+-parseInt(_0x5cd7bc(0x197))/0x9+parseInt(_0x5cd7bc(0x19c))/0xa+parseInt(_0x5cd7bc(0x190))/0xb;if(_0x228126===_0x55df91)break;else _0xe247b6['push'](_0xe247b6['shift']());}catch(_0x9c2ae8){_0xe247b6['push'](_0xe247b6['shift']());}}}(a44_0x3295,0x9e6ec));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';function a44_0x3295(){const _0xcfc69e=['4635Lobpfg','35052MIzVdx','../../package.json','58ftjWjN','TD1\x20','0.0.0','utf-8','9623042bdMujh','parse','8WinWFQ','Authorization','191695AqyLNO','2406mmEPzB','56XqRAEQ','6027282weMVlP','length','tdx/','1257642sALJOB','replace','8291580caesqS'];a44_0x3295=function(){return _0xcfc69e;};return a44_0x3295();}import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x5752ee=a44_0x254e;try{const _0x1d4523=fileURLToPath(import.meta.url),_0x14a2f3=dirname(_0x1d4523),_0x1999f9=join(_0x14a2f3,_0x5752ee(0x18b)),_0x4e3640=JSON[_0x5752ee(0x191)](readFileSync(_0x1999f9,_0x5752ee(0x18f)));return _0x4e3640['version'];}catch{return _0x5752ee(0x18e);}}export function getUserAgent(){const _0x15c467=a44_0x254e,_0x2adc02=getVersion(),_0x2ebada=platform(),_0x39fb6=process['version'][_0x15c467(0x19b)]('v','');return _0x15c467(0x199)+_0x2adc02+'\x20('+_0x2ebada+';\x20node/'+_0x39fb6+')';}export function getAuthHeaders(_0xcec792,_0x48cd19){const _0x28afb9=a44_0x254e,_0x2b4f33=getVersion(),_0x3662b7={'User-Agent':getUserAgent(),'X-TD-Client':'tdx','X-TD-Client-Version':_0x2b4f33};return _0x48cd19&&(_0x3662b7[_0x28afb9(0x193)]=_0x28afb9(0x18d)+_0x48cd19),_0x3662b7;}export function toHeaderRecord(_0x2af8e9){const _0x4105ac={};for(const [_0x2baca1,_0x39d51f]of Object['entries'](_0x2af8e9)){_0x39d51f!==undefined&&(_0x4105ac[_0x2baca1]=_0x39d51f);}return _0x4105ac;}function a44_0x254e(_0x349831,_0x16f69c){_0x349831=_0x349831-0x18a;const _0x329561=a44_0x3295();let _0x254e9c=_0x329561[_0x349831];return _0x254e9c;}export function getTrinoHeaders(_0x3ee3bf,_0x3a40f3){const _0x1c0d7b=a44_0x254e,_0x5862ee=getAuthHeaders(_0x3ee3bf,_0x3a40f3),_0xdcf6ff=toHeaderRecord(_0x5862ee);return delete _0xdcf6ff[_0x1c0d7b(0x193)],_0x3a40f3&&(_0xdcf6ff['X-Trino-User']=_0x3a40f3),_0xdcf6ff;}export function hasAPIKey(_0x597730){const _0x33b5b1=a44_0x254e,_0x337b3a=getAPIKey(_0x597730);return _0x337b3a!==undefined&&_0x337b3a[_0x33b5b1(0x198)]>0x0;}
|
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
+
(function(_0x51e490,_0x17c6b5){const _0x20884e=a45_0x1f34,_0xef1e82=_0x51e490();while(!![]){try{const _0x4d1cda=parseInt(_0x20884e(0x1c4))/0x1+parseInt(_0x20884e(0x1e2))/0x2*(parseInt(_0x20884e(0x1d3))/0x3)+parseInt(_0x20884e(0x1bd))/0x4*(parseInt(_0x20884e(0x1ee))/0x5)+-parseInt(_0x20884e(0x1bf))/0x6+parseInt(_0x20884e(0x1e4))/0x7+parseInt(_0x20884e(0x1ef))/0x8+parseInt(_0x20884e(0x1e7))/0x9*(-parseInt(_0x20884e(0x1e3))/0xa);if(_0x4d1cda===_0x17c6b5)break;else _0xef1e82['push'](_0xef1e82['shift']());}catch(_0x5a70ad){_0xef1e82['push'](_0xef1e82['shift']());}}}(a45_0x4fa2,0x7d4d9));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x49d92d from'node:fs';import*as a45_0x11fc62 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_0x4ee97d from'chalk';export function getConfigDir(){const _0x2f5341=a45_0x1f34;return process[_0x2f5341(0x1ea)][_0x2f5341(0x1df)]||join(homedir(),'.config',_0x2f5341(0x1c7));}export function getConfigFile(){const _0x9d9642=a45_0x1f34;return join(getConfigDir(),_0x9d9642(0x1f0));}export function getConfigFilePath(_0x22b434){const _0x2804d2=a45_0x1f34,_0x54859f=getConfigDir();return _0x22b434?a45_0x11fc62[_0x2804d2(0x1ab)](_0x54859f,'.env.'+_0x22b434):getConfigFile();}export function getCacheDir(){const _0x4b940b=a45_0x1f34;return process[_0x4b940b(0x1ea)][_0x4b940b(0x1da)]||join(homedir(),'.cache',_0x4b940b(0x1c7));}export function getLLMProjectCacheFile(_0x11aff1){const _0x5effa9=a45_0x1f34,_0x4db092=_0x11aff1?_0x5effa9(0x1b2)+_0x11aff1:_0x5effa9(0x1db);return join(getCacheDir(),_0x4db092);}export function readCachedLLMProject(_0x4fa5a6){const _0x5a9e5a=a45_0x1f34;try{const _0x4d7a00=getLLMProjectCacheFile(_0x4fa5a6);if(!existsSync(_0x4d7a00))return null;const _0x2fdc85=readFileSync(_0x4d7a00,_0x5a9e5a(0x1b8))[_0x5a9e5a(0x1cd)]();try{const _0x4e4d51=JSON['parse'](_0x2fdc85);if(_0x4e4d51&&typeof _0x4e4d51['id']===_0x5a9e5a(0x1f2)&&typeof _0x4e4d51[_0x5a9e5a(0x1bc)]===_0x5a9e5a(0x1f2))return _0x4e4d51;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x198589,_0x1e13ee,_0x424cdd){const _0x32fe6d=a45_0x1f34;try{const _0x353783=getCacheDir(),_0x26a34b=getLLMProjectCacheFile(_0x424cdd);!existsSync(_0x353783)&&mkdirSync(_0x353783,{'recursive':!![]});const _0x3658c3={'name':_0x198589,'id':_0x1e13ee};writeFileSync(_0x26a34b,JSON[_0x32fe6d(0x1ba)](_0x3658c3),'utf-8');}catch{}}export function getAccountInfoCacheFile(_0xa46a85){const _0x260086=a45_0x1f34,_0x20015d=_0xa46a85?_0x260086(0x1cb)+_0xa46a85+_0x260086(0x1d7):'account_info.json';return join(getCacheDir(),_0x20015d);}export function readCachedAccountInfo(_0x530d71){const _0xb2df2e=a45_0x1f34;try{const _0x4a461e=getAccountInfoCacheFile(_0x530d71);if(!existsSync(_0x4a461e))return null;const _0x4e9ddf=readFileSync(_0x4a461e,_0xb2df2e(0x1b8))['trim'](),_0x4d84e0=JSON['parse'](_0x4e9ddf);if(_0x4d84e0&&typeof _0x4d84e0[_0xb2df2e(0x1b7)]===_0xb2df2e(0x1f2)&&typeof _0x4d84e0[_0xb2df2e(0x1c0)]===_0xb2df2e(0x1c1))return _0x4d84e0;return null;}catch{return null;}}function a45_0x1f34(_0x534290,_0x3fb1bb){_0x534290=_0x534290-0x1a8;const _0x4fa28d=a45_0x4fa2();let _0x1f34fa=_0x4fa28d[_0x534290];return _0x1f34fa;}export function writeCachedAccountInfo(_0x18bf1d,_0x134224,_0x422fac){const _0xe8a8d3=a45_0x1f34;try{const _0x5e5b67=getCacheDir(),_0x2e9cb2=getAccountInfoCacheFile(_0x422fac);!existsSync(_0x5e5b67)&&mkdirSync(_0x5e5b67,{'recursive':!![]});const _0x1e548f={'site':_0x18bf1d,'accountId':_0x134224,'cachedAt':new Date()['toISOString']()};writeFileSync(_0x2e9cb2,JSON[_0xe8a8d3(0x1ba)](_0x1e548f),'utf-8');}catch{}}export function parseEnvFile(_0xaab290){const _0x1d038a=a45_0x1f34,_0x4b32ca={};for(const _0xb84c9 of _0xaab290[_0x1d038a(0x1cc)]('\x0a')){const _0x1edae1=_0xb84c9[_0x1d038a(0x1cd)]();if(!_0x1edae1||_0x1edae1[_0x1d038a(0x1c9)]('#'))continue;const _0x22ca70=_0x1edae1[_0x1d038a(0x1e6)](/^([^=]+)=(.*)$/);if(_0x22ca70){const _0x4467a4=_0x22ca70[0x1][_0x1d038a(0x1cd)]();let _0x4dda58=_0x22ca70[0x2][_0x1d038a(0x1cd)]();(_0x4dda58[_0x1d038a(0x1c9)]('\x22')&&_0x4dda58[_0x1d038a(0x1b0)]('\x22')||_0x4dda58[_0x1d038a(0x1c9)]('\x27')&&_0x4dda58['endsWith']('\x27'))&&(_0x4dda58=_0x4dda58['slice'](0x1,-0x1)),_0x4b32ca[_0x4467a4]=_0x4dda58;}}return _0x4b32ca;}export function readUserConfig(){const _0x3da065=a45_0x1f34,_0x15e7f6=getConfigFile();if(!existsSync(_0x15e7f6))return{};try{const _0x5d0cb2=readFileSync(_0x15e7f6,_0x3da065(0x1b8));return parseEnvFile(_0x5d0cb2);}catch(_0x25f0e8){return console[_0x3da065(0x1c2)](_0x3da065(0x1d8)+_0x15e7f6+':',_0x25f0e8),{};}}export function resolveSite(_0x307440){const _0x29a2aa=a45_0x1f34,_0x2ce2b3=[_0x29a2aa(0x1e8),_0x29a2aa(0x1d0),_0x29a2aa(0x1ae),_0x29a2aa(0x1e0),_0x29a2aa(0x1de),_0x29a2aa(0x1d9),_0x29a2aa(0x1e9),_0x29a2aa(0x1b4),_0x29a2aa(0x1ac),_0x29a2aa(0x1c6)];if(_0x2ce2b3[_0x29a2aa(0x1d1)](_0x307440))return _0x307440;if(_0x307440 in SITE_ALIASES)return SITE_ALIASES[_0x307440];return console['warn'](_0x29a2aa(0x1a8)+_0x307440+'\x27,\x20defaulting\x20to\x20us01'),_0x29a2aa(0x1e8);}function a45_0x4fa2(){const _0x280955=['apiKeys','readFileSync','parse','.json','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','dev-us01','TDX_CACHE_DIR','llm_default_project','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','legacy\x20.env\x20file','ap03','TDX_CONFIG_DIR','ap02','TD_API_KEY\x20env\x20var\x20(deprecated)','550574qXqetm','230sWifUy','315532xKYtGW','isDeprecated','match','622341TVGWxB','us01','dev-eu01','env','toUpperCase','profile','keychain\x20(profile:\x20','210iAdptE','8208072bCRHuI','.env','source','string','TDX_API_KEY_','apiKey','Warning:\x20Unknown\x20site\x20\x27','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','TDX_API_KEY\x20env\x20var','join','stg-jp01','\x20env\x20var','eu01','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','endsWith','Warning:\x20Failed\x20to\x20read\x20','llm_default_project.','map','stg-us01','.env.','profiles','site','utf-8','TDX_API_KEY','stringify','TD_API_KEY','name','78152jhkSSl','filter','2116962AJUYwy','accountId','number','warn','Warning:\x20Failed\x20to\x20load\x20','289527qBTjtC','replace','stg-ap03','tdx','keychain','startsWith','TD_API_KEY_','account_info.','split','trim','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','existsSync','jp01','includes','yellow','3mDMOoz'];a45_0x4fa2=function(){return _0x280955;};return a45_0x4fa2();}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0xe14ec8,_0x4a5f15){const _0x2fec50=a45_0x1f34,_0x41370b=_0x4a5f15||getActiveProfileName();if(_0x41370b){const _0x5381a3=_0x2fec50(0x1f3)+normalizeProfileForEnvVar(_0x41370b);if(process[_0x2fec50(0x1ea)][_0x5381a3])return process[_0x2fec50(0x1ea)][_0x5381a3];}if(process[_0x2fec50(0x1ea)][_0x2fec50(0x1b9)])return process['env'][_0x2fec50(0x1b9)];if(process[_0x2fec50(0x1ea)][_0x2fec50(0x1bb)])return process['env'][_0x2fec50(0x1bb)];const _0x5be3d9=_0xe14ec8['toUpperCase']()[_0x2fec50(0x1c5)](/-/g,'_'),_0x172028=_0x2fec50(0x1ca)+_0x5be3d9;if(_0x41370b){const _0x1c2b79=loadProfileEnv(_0x41370b);if(_0x1c2b79){if(_0x1c2b79[_0x172028])return _0x1c2b79[_0x172028];if(_0x1c2b79[_0x2fec50(0x1bb)])return _0x1c2b79[_0x2fec50(0x1bb)];}}const _0x56eb5c=loadUserConfigOnce();if(_0x56eb5c[_0x172028])return _0x56eb5c[_0x172028];if(_0x56eb5c[_0x2fec50(0x1bb)])return _0x56eb5c['TD_API_KEY'];return undefined;}export function normalizeProfileForEnvVar(_0x10e7ba){const _0x22f2a6=a45_0x1f34;return _0x10e7ba[_0x22f2a6(0x1eb)]()[_0x22f2a6(0x1c5)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x294827,_0x3c6609){const _0x2fc4a5=a45_0x1f34,_0xfbe8f6=_0x3c6609||getActiveProfileName()||undefined;if(_0xfbe8f6){const _0x1e0940=_0x2fc4a5(0x1f3)+normalizeProfileForEnvVar(_0xfbe8f6);if(process[_0x2fc4a5(0x1ea)][_0x1e0940])return{'apiKey':process['env'][_0x1e0940],'source':_0x1e0940+_0x2fc4a5(0x1ad),'isDeprecated':![]};const _0xb20394=getCachedCredential(_0x294827,_0xfbe8f6);if(_0xb20394)return{'apiKey':_0xb20394,'source':_0x2fc4a5(0x1ed)+_0xfbe8f6+')','isDeprecated':![]};const _0x15fb85=await getKeychainAPIKey(_0xfbe8f6);if(_0x15fb85)return setCachedCredential(_0x15fb85,_0x294827,_0xfbe8f6),{'apiKey':_0x15fb85,'source':_0x2fc4a5(0x1ed)+_0xfbe8f6+')','isDeprecated':![]};}if(process[_0x2fc4a5(0x1ea)][_0x2fc4a5(0x1b9)])return{'apiKey':process['env'][_0x2fc4a5(0x1b9)],'source':_0x2fc4a5(0x1aa),'isDeprecated':![]};if(!_0xfbe8f6){const _0x2fdea7=getCachedCredential(_0x294827,undefined);if(_0x2fdea7)return{'apiKey':_0x2fdea7,'source':_0x2fc4a5(0x1c8),'isDeprecated':![]};const _0x4499c7=await getKeychainAPIKey(undefined);if(_0x4499c7)return setCachedCredential(_0x4499c7,_0x294827,undefined),{'apiKey':_0x4499c7,'source':_0x2fc4a5(0x1c8),'isDeprecated':![]};}if(process['env'][_0x2fc4a5(0x1bb)])return{'apiKey':process[_0x2fc4a5(0x1ea)][_0x2fc4a5(0x1bb)],'source':_0x2fc4a5(0x1e1),'isDeprecated':!![]};const _0x2d26c3=getLegacyEnvAPIKey(_0x294827,_0xfbe8f6);if(_0x2d26c3){const _0x387d23=await isKeychainAvailable();if(_0x387d23)try{await saveKeychainAPIKey(_0x2d26c3,_0xfbe8f6),setCachedCredential(_0x2d26c3,_0x294827,_0xfbe8f6);const _0x2da237=getConfigFilePath(_0xfbe8f6);cleanupLegacyEnvFile(_0x2da237)&&console[_0x2fc4a5(0x1c2)](a45_0x4ee97d[_0x2fc4a5(0x1d2)](_0x2fc4a5(0x1a9)));}catch(_0x6daa89){console[_0x2fc4a5(0x1c2)](a45_0x4ee97d['yellow'](_0x2fc4a5(0x1ce)+_0x6daa89));}const _0x34ad63=_0xfbe8f6?'legacy\x20.env\x20file\x20(profile:\x20'+_0xfbe8f6+')':_0x2fc4a5(0x1dd);return{'apiKey':_0x2d26c3,'source':_0x34ad63,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x4021aa,_0x82409a,_0x227a4f=!![]){const _0x446122=a45_0x1f34,_0x19ae52=await resolveAPIKeyAsync(_0x4021aa,_0x82409a);if(!_0x19ae52)return undefined;if(_0x227a4f&&_0x19ae52[_0x446122(0x1e5)]&&_0x19ae52[_0x446122(0x1f1)][_0x446122(0x1d1)]('TD_API_KEY')){const _0x41fe8f=_0x82409a||getActiveProfileName()||undefined,_0x2eff4f=_0x41fe8f?_0x446122(0x1f3)+normalizeProfileForEnvVar(_0x41fe8f):'TDX_API_KEY_<PROFILE>';console[_0x446122(0x1c2)](a45_0x4ee97d[_0x446122(0x1d2)](_0x446122(0x1af)+('\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20'+_0x2eff4f+').')));}return _0x19ae52[_0x446122(0x1f4)];}function getLegacyEnvAPIKey(_0x274489,_0x1b1dd8){const _0x58f1c8=a45_0x1f34,_0xeb406d=_0x274489[_0x58f1c8(0x1eb)]()[_0x58f1c8(0x1c5)](/-/g,'_'),_0x4448ae=_0x58f1c8(0x1ca)+_0xeb406d;if(_0x1b1dd8){const _0x27991d=loadProfileEnv(_0x1b1dd8);if(_0x27991d){if(_0x27991d[_0x4448ae])return _0x27991d[_0x4448ae];if(_0x27991d['TD_API_KEY'])return _0x27991d[_0x58f1c8(0x1bb)];}}const _0x14d913=loadUserConfigOnce();if(_0x14d913[_0x4448ae])return _0x14d913[_0x4448ae];if(_0x14d913[_0x58f1c8(0x1bb)])return _0x14d913['TD_API_KEY'];return undefined;}function cleanupLegacyEnvFile(_0x54e39a){const _0x23b302=a45_0x1f34;if(!existsSync(_0x54e39a))return![];try{const _0x24a336=readFileSync(_0x54e39a,_0x23b302(0x1b8)),_0xfebbb9=_0x24a336[_0x23b302(0x1cc)]('\x0a'),_0x23d575=_0xfebbb9[_0x23b302(0x1be)](_0x3d142f=>{const _0x1cb9d3=_0x23b302,_0xa5dd97=_0x3d142f[_0x1cb9d3(0x1cd)]();if(!_0xa5dd97||_0xa5dd97['startsWith']('#'))return!![];const [_0x190437]=_0xa5dd97[_0x1cb9d3(0x1cc)]('=');return!_0x190437['startsWith'](_0x1cb9d3(0x1bb));}),_0x18d612=_0x23d575['some'](_0x5253d5=>{const _0x505d29=_0x23b302,_0x526770=_0x5253d5[_0x505d29(0x1cd)]();return _0x526770&&!_0x526770[_0x505d29(0x1c9)]('#');});if(!_0x18d612)return unlinkSync(_0x54e39a),!![];return writeFileSync(_0x54e39a,_0x23d575['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x481988){const _0x46cc63=a45_0x1f34,_0x39bdc1=a45_0x11fc62[_0x46cc63(0x1ab)](getConfigDir(),_0x46cc63(0x1b5)+_0x481988);if(a45_0x49d92d[_0x46cc63(0x1cf)](_0x39bdc1)){validateSecureFilePermissions(_0x39bdc1);try{const _0x5e962a=a45_0x49d92d[_0x46cc63(0x1d5)](_0x39bdc1,_0x46cc63(0x1b8));return parseEnvFile(_0x5e962a);}catch(_0x201f38){console[_0x46cc63(0x1c2)](_0x46cc63(0x1c3)+_0x39bdc1+':\x20'+_0x201f38);}}const _0x4b09f0=a45_0x11fc62[_0x46cc63(0x1ab)](getConfigDir(),_0x46cc63(0x1b6),_0x481988,_0x46cc63(0x1f0));if(a45_0x49d92d[_0x46cc63(0x1cf)](_0x4b09f0)){validateSecureFilePermissions(_0x4b09f0);try{const _0x57e847=a45_0x49d92d['readFileSync'](_0x4b09f0,_0x46cc63(0x1b8));return parseEnvFile(_0x57e847);}catch(_0x8ced35){return console[_0x46cc63(0x1c2)](_0x46cc63(0x1c3)+_0x4b09f0+':\x20'+_0x8ced35),null;}}return null;}function getActiveProfileName(){const _0x8d57d1=a45_0x1f34,_0x142a79=a45_0x11fc62[_0x8d57d1(0x1ab)](getConfigDir(),'tdx.json');if(!a45_0x49d92d[_0x8d57d1(0x1cf)](_0x142a79))return null;try{const _0x2af00d=a45_0x49d92d['readFileSync'](_0x142a79,_0x8d57d1(0x1b8)),_0x524289=JSON[_0x8d57d1(0x1d6)](_0x2af00d);return _0x524289[_0x8d57d1(0x1ec)]||null;}catch{return null;}}export function saveAPIKey(_0x5ed1cd,_0x871a99,_0x22a0df){const _0x12a2a1=a45_0x1f34,_0x440bd0=getConfigDir(),_0x156768=getConfigFilePath(_0x22a0df);!existsSync(_0x440bd0)&&mkdirSync(_0x440bd0,{'recursive':!![],'mode':0x1c0});let _0xea6f04={};if(existsSync(_0x156768))try{const _0x215d74=readFileSync(_0x156768,_0x12a2a1(0x1b8));_0xea6f04=parseEnvFile(_0x215d74);}catch(_0x58e2a5){console[_0x12a2a1(0x1c2)](_0x12a2a1(0x1b1)+_0x156768+':',_0x58e2a5);}const _0x457885=_0x5ed1cd[_0x12a2a1(0x1eb)]()[_0x12a2a1(0x1c5)](/-/g,'_');_0xea6f04[_0x12a2a1(0x1ca)+_0x457885]=_0x871a99;const _0x80477e=Object['entries'](_0xea6f04)[_0x12a2a1(0x1b3)](([_0x2a619a,_0x5ec6fe])=>_0x2a619a+'='+_0x5ec6fe);writeFileSync(_0x156768,_0x80477e['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x103c92,_0x50e65c,_0x5ec87d){const _0x3740a0=a45_0x1f34;await saveKeychainAPIKey(_0x103c92,_0x5ec87d),setCachedCredential(_0x103c92,_0x50e65c,_0x5ec87d);const _0x4fdc1e=getConfigFilePath(_0x5ec87d);cleanupLegacyEnvFile(_0x4fdc1e)&&console[_0x3740a0(0x1c2)](a45_0x4ee97d['yellow'](_0x3740a0(0x1dc)));}export function loadConfig(){const _0x4cdbdc=a45_0x1f34,_0x48e3dc={'apiKeys':{},'defaultSite':_0x4cdbdc(0x1e8)},_0x33fb42=[_0x4cdbdc(0x1e8),_0x4cdbdc(0x1d0),_0x4cdbdc(0x1ae),_0x4cdbdc(0x1e0),_0x4cdbdc(0x1de),_0x4cdbdc(0x1d9),_0x4cdbdc(0x1e9),_0x4cdbdc(0x1b4),'stg-jp01',_0x4cdbdc(0x1c6)];for(const _0x171040 of _0x33fb42){const _0x5a7757=getAPIKey(_0x171040);_0x5a7757&&(_0x48e3dc[_0x4cdbdc(0x1d4)][_0x171040]=_0x5a7757);}return _0x48e3dc;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x15f068,_0x46212c){const _0x4b496e=a46_0x2c70,_0x315cb8=_0x15f068();while(!![]){try{const _0x613937=-parseInt(_0x4b496e(0x1b9))/0x1*(parseInt(_0x4b496e(0x1aa))/0x2)+parseInt(_0x4b496e(0x1b2))/0x3+-parseInt(_0x4b496e(0x1b1))/0x4*(parseInt(_0x4b496e(0x1b7))/0x5)+parseInt(_0x4b496e(0x1b8))/0x6*(-parseInt(_0x4b496e(0x1ad))/0x7)+parseInt(_0x4b496e(0x1ac))/0x8*(parseInt(_0x4b496e(0x1bb))/0x9)+-parseInt(_0x4b496e(0x1b3))/0xa+parseInt(_0x4b496e(0x1ae))/0xb*(parseInt(_0x4b496e(0x1b5))/0xc);if(_0x613937===_0x46212c)break;else _0x315cb8['push'](_0x315cb8['shift']());}catch(_0x20a44c){_0x315cb8['push'](_0x315cb8['shift']());}}}(a46_0x4f8b,0x2d85c));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';import{getCacheDir}from'./config.js';function getCacheFilePath(_0x5a8ce1){const _0x3893b8=a46_0x2c70,_0x3c10b0=_0x5a8ce1||_0x3893b8(0x1b0);return join(getCacheDir(),_0x3893b8(0x1af)+_0x3c10b0+_0x3893b8(0x1ab));}function a46_0x4f8b(){const _0x5debce=['55465cblYHp','1386036IcfqDZ','61154spzsUV','utf-8','42021hNnjOq','12uHSDBU','.json','632vHVWky','7Iaxpsh','670901OJcVbG','connections-','default','28RLDvSC','897426lCGXXF','1109070oPPToJ','now','60wzSgUd','parse'];a46_0x4f8b=function(){return _0x5debce;};return a46_0x4f8b();}function a46_0x2c70(_0x3d368c,_0x1a6e05){_0x3d368c=_0x3d368c-0x1aa;const _0x4f8b6b=a46_0x4f8b();let _0x2c705d=_0x4f8b6b[_0x3d368c];return _0x2c705d;}export function loadCachedConnections(_0x127c25){const _0x1c3807=a46_0x2c70,_0x27822f=getCacheFilePath(_0x127c25);if(!existsSync(_0x27822f))return null;try{const _0x24dd35=readFileSync(_0x27822f,_0x1c3807(0x1ba)),_0x1a3e57=JSON[_0x1c3807(0x1b6)](_0x24dd35);return _0x1a3e57['connections'];}catch{return null;}}export function saveCachedConnections(_0x1754d1,_0x4572f7){const _0x26080d=a46_0x2c70,_0x170731=getCacheDir();!existsSync(_0x170731)&&mkdirSync(_0x170731,{'recursive':!![]});const _0x2bd07d=getCacheFilePath(_0x1754d1),_0x24d02d={'connections':_0x4572f7,'cachedAt':Date[_0x26080d(0x1b4)]()};writeFileSync(_0x2bd07d,JSON['stringify'](_0x24d02d,null,0x2),_0x26080d(0x1ba));}export function clearConnectionCache(_0x47c0c3){const _0xbbeecc=getCacheFilePath(_0x47c0c3);if(existsSync(_0xbbeecc))try{unlinkSync(_0xbbeecc);}catch{}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x171c83,_0x2ba1e0){const _0x3558b0=a47_0x2e00,_0x32aa81=_0x171c83();while(!![]){try{const _0x1e2416=parseInt(_0x3558b0(0x11f))/0x1*(-parseInt(_0x3558b0(0x12b))/0x2)+-parseInt(_0x3558b0(0x125))/0x3*(parseInt(_0x3558b0(0x129))/0x4)+-parseInt(_0x3558b0(0x12d))/0x5*(-parseInt(_0x3558b0(0x127))/0x6)+-parseInt(_0x3558b0(0x12f))/0x7+-parseInt(_0x3558b0(0x126))/0x8*(-parseInt(_0x3558b0(0x120))/0x9)+-parseInt(_0x3558b0(0x11e))/0xa*(parseInt(_0x3558b0(0x124))/0xb)+parseInt(_0x3558b0(0x130))/0xc;if(_0x1e2416===_0x2ba1e0)break;else _0x32aa81['push'](_0x32aa81['shift']());}catch(_0x282c94){_0x32aa81['push'](_0x32aa81['shift']());}}}(a47_0x47fa,0xedb18));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a47_0x47fa(){const _0x2dbd60=['74IncFue','__default_profile__','320665TFggxG','get','7129325kJfPKE','34052484lRvIfV','now','33280cfQBmO','43401PHdcEq','411183XeyFUB','apiKey','__default_site__','loadedAt','1430hndslq','597cJYuaA','72mUODkk','150PTgMSL','clear','16516wgwEsV','set'];a47_0x47fa=function(){return _0x2dbd60;};return a47_0x47fa();}function a47_0x2e00(_0x39f77f,_0x33ef2f){_0x39f77f=_0x39f77f-0x11d;const _0x47fa0a=a47_0x47fa();let _0x2e00e8=_0x47fa0a[_0x39f77f];return _0x2e00e8;}function getCacheKey(_0x322b44,_0x31b134){const _0xeec19d=a47_0x2e00,_0x276727=_0x322b44||_0xeec19d(0x122),_0x25e3f3=_0x31b134||_0xeec19d(0x12c);return _0x276727+':'+_0x25e3f3;}export function getCachedCredential(_0x1b2e73,_0x1007bc){const _0x5b65ef=a47_0x2e00,_0x42bff7=getCacheKey(_0x1b2e73,_0x1007bc),_0x56ba21=cache[_0x5b65ef(0x12e)](_0x42bff7);if(!_0x56ba21)return null;if(Date[_0x5b65ef(0x11d)]()-_0x56ba21[_0x5b65ef(0x123)]>CACHE_TTL_MS)return cache['delete'](_0x42bff7),null;return _0x56ba21[_0x5b65ef(0x121)];}export function setCachedCredential(_0x3ed76e,_0x53f8dc,_0x3104c8){const _0x23f2e4=a47_0x2e00,_0x582379=getCacheKey(_0x53f8dc,_0x3104c8);cache[_0x23f2e4(0x12a)](_0x582379,{'apiKey':_0x3ed76e,'loadedAt':Date['now']()});}export function clearCredentialCache(){const _0x4328fd=a47_0x2e00;cache[_0x4328fd(0x128)]();}export function clearCachedCredential(_0x4cf2bf,_0x1212de){const _0x3b9d7d=getCacheKey(_0x4cf2bf,_0x1212de);cache['delete'](_0x3b9d7d);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a48_0x484209=a48_0x1f73;(function(_0xd41a63,_0x5071fb){const _0x4e6590=a48_0x1f73,_0x119131=_0xd41a63();while(!![]){try{const _0x2ee89b=-parseInt(_0x4e6590(0x9c))/0x1*(-parseInt(_0x4e6590(0xb1))/0x2)+parseInt(_0x4e6590(0xb3))/0x3*(parseInt(_0x4e6590(0xbd))/0x4)+-parseInt(_0x4e6590(0xd7))/0x5+parseInt(_0x4e6590(0xc7))/0x6*(parseInt(_0x4e6590(0xa9))/0x7)+-parseInt(_0x4e6590(0xd4))/0x8*(-parseInt(_0x4e6590(0xc5))/0x9)+parseInt(_0x4e6590(0xc2))/0xa*(parseInt(_0x4e6590(0xc0))/0xb)+parseInt(_0x4e6590(0xc4))/0xc*(-parseInt(_0x4e6590(0x9b))/0xd);if(_0x2ee89b===_0x5071fb)break;else _0x119131['push'](_0x119131['shift']());}catch(_0x29042e){_0x119131['push'](_0x119131['shift']());}}}(a48_0x24f4,0xf1c89));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';function a48_0x1f73(_0x5b3a1b,_0x4437b1){_0x5b3a1b=_0x5b3a1b-0x97;const _0x24f4f3=a48_0x24f4();let _0x1f7335=_0x24f4f3[_0x5b3a1b];return _0x1f7335;}import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a48_0x486440 from'node:fs';import*as a48_0x18a53d from'node:path';export class GlobalContext{[a48_0x484209(0xc1)];['database'];['parent_segment'];[a48_0x484209(0xa7)];[a48_0x484209(0xa8)];[a48_0x484209(0xb0)];[a48_0x484209(0xcb)];['logLevel'];[a48_0x484209(0x97)];[a48_0x484209(0xc8)];[a48_0x484209(0xa3)];['sessionId'];[a48_0x484209(0xc3)];constructor(_0x1d2583){const _0x206cae=a48_0x484209;this['sessionId']=_0x1d2583[_0x206cae(0xaf)]||getCurrentSessionPID()[_0x206cae(0xb9)]();const _0x48ef76=loadSessionContext(_0x1d2583[_0x206cae(0xaf)]),_0x2f0967=loadProjectConfig(),_0x305b5b=this['loadGlobalConfig']();this[_0x206cae(0xa3)]=_0x1d2583[_0x206cae(0x97)]||_0x48ef76?.[_0x206cae(0x97)]||_0x305b5b[_0x206cae(0x97)]||getActiveProfile();const _0xfa7a62=this[_0x206cae(0xa3)]?loadProfile(this[_0x206cae(0xa3)]):null,_0x2e7d02=_0x5bd17a=>{if(!_0x5bd17a)return{};const _0x3a9a7a=_0x5bd17a,_0xeba581={};for(const [_0x246985,_0x198a87]of Object['entries'](_0x3a9a7a)){typeof _0x198a87==='string'&&(_0xeba581[_0x246985]=_0x198a87);}return _0xeba581;},_0x289566={};if(_0x1d2583[_0x206cae(0xc1)]&&_0x1d2583[_0x206cae(0xc1)]!=='us01')_0x289566[_0x206cae(0xc1)]=_0x1d2583[_0x206cae(0xc1)];const _0x2ca162=_0x48ef76?.[_0x206cae(0x9a)],_0x3f3f26=_0x2f0967?.[_0x206cae(0x9a)],_0x299d88=_0xfa7a62?.[_0x206cae(0xd8)]?.[_0x206cae(0x9a)],_0x1d43fa=_0x305b5b[_0x206cae(0x9a)];_0x1d2583[_0x206cae(0x9a)]&&(_0x1d2583[_0x206cae(0x9a)]!==_0x2ca162&&_0x1d2583[_0x206cae(0x9a)]!==_0x3f3f26&&_0x1d2583[_0x206cae(0x9a)]!==_0x299d88&&_0x1d2583[_0x206cae(0x9a)]!==_0x1d43fa)&&(_0x289566[_0x206cae(0x9a)]=_0x1d2583[_0x206cae(0x9a)]);if(_0x1d2583[_0x206cae(0xbe)])_0x289566[_0x206cae(0xb2)]=_0x1d2583['parentSegment'];if(_0x1d2583[_0x206cae(0x9d)])_0x289566[_0x206cae(0xa8)]=_0x1d2583[_0x206cae(0x9d)];if(_0x1d2583[_0x206cae(0x97)])_0x289566[_0x206cae(0x97)]=_0x1d2583['profile'];this['layers']={'cliFlags':_0x289566,'session':_0x2e7d02(_0x48ef76),'project':_0x2e7d02(_0x2f0967),'profile':_0x2e7d02(_0xfa7a62?.['config']),'global':_0x2e7d02(_0x305b5b)};const _0x1d16c0={...this[_0x206cae(0xc8)][_0x206cae(0xd1)],...this[_0x206cae(0xc8)][_0x206cae(0x97)],...this[_0x206cae(0xc8)]['project'],...this[_0x206cae(0xc8)][_0x206cae(0xaf)],...this[_0x206cae(0xc8)][_0x206cae(0xcc)]},_0x154196=_0x1d16c0[_0x206cae(0xc1)]||'us01';this[_0x206cae(0xc1)]=resolveSite(_0x154196),this['database']=_0x1d16c0[_0x206cae(0x9a)],this[_0x206cae(0xb2)]=_0x1d16c0[_0x206cae(0xb2)],this[_0x206cae(0xa7)]=_0x1d16c0[_0x206cae(0xa7)],this[_0x206cae(0xa8)]=_0x1d16c0[_0x206cae(0xa8)],this[_0x206cae(0xcb)]=_0x1d2583[_0x206cae(0xcb)]||![],this[_0x206cae(0x99)]=_0x1d2583['logLevel']??LogLevel[_0x206cae(0xc6)],this['profile']=this[_0x206cae(0xa3)]||undefined,this['apiKey']=getAPIKey(this[_0x206cae(0xc1)],this[_0x206cae(0xa3)]||undefined);const _0x4f93e0=getConfigDir(),_0x414112=a48_0x18a53d['join'](_0x4f93e0,_0x206cae(0xa4),this[_0x206cae(0xb4)]+'.json'),_0x5c0b5b=findProjectConfigPath(),_0xb0ec43=a48_0x18a53d[_0x206cae(0xd5)](_0x4f93e0,_0x206cae(0xcd)),_0xa32285=a48_0x18a53d[_0x206cae(0xd5)](_0x4f93e0,_0x206cae(0xd3));let _0x4e5c5c=null,_0xfb6771=null;this[_0x206cae(0xa3)]&&(_0x4e5c5c=a48_0x18a53d['join'](_0x4f93e0,_0x206cae(0xb8),this['activeProfile'],_0x206cae(0xcd)),_0xfb6771=a48_0x18a53d[_0x206cae(0xd5)](_0x4f93e0,_0x206cae(0xb8),this['activeProfile'],'.env')),this[_0x206cae(0xc3)]={'session':a48_0x486440['existsSync'](_0x414112)?_0x414112:null,'project':_0x5c0b5b,'profile':_0x4e5c5c&&a48_0x486440[_0x206cae(0xd6)](_0x4e5c5c)?_0x4e5c5c:null,'profileCredentials':_0xfb6771&&a48_0x486440['existsSync'](_0xfb6771)?_0xfb6771:null,'global':a48_0x486440['existsSync'](_0xb0ec43)?_0xb0ec43:null,'globalCredentials':a48_0x486440[_0x206cae(0xd6)](_0xa32285)?_0xa32285:null};}['getSource'](_0xe7910,_0x435a0e){const _0x41103d=a48_0x484209;if(!_0x435a0e)return _0x41103d(0xca);const _0x5f08f5=_0x435a0e;if(this[_0x41103d(0xc8)][_0x41103d(0xcc)][_0xe7910]===_0x5f08f5){if(_0xe7910===_0x41103d(0xc1)&&_0x5f08f5===_0x41103d(0xa2)&&!this[_0x41103d(0xc8)][_0x41103d(0xaf)][_0x41103d(0xc1)]&&!this[_0x41103d(0xc8)][_0x41103d(0xab)][_0x41103d(0xc1)]&&!this[_0x41103d(0xc8)][_0x41103d(0x97)][_0x41103d(0xc1)]&&!this['layers']['global'][_0x41103d(0xc1)])return _0x41103d(0xba);return'CLI\x20flag:\x20--'+_0xe7910[_0x41103d(0xbb)](/_/g,'-');}if(this[_0x41103d(0xc8)]['session'][_0xe7910]===_0x5f08f5)return _0x41103d(0xaf);if(this[_0x41103d(0xc8)]['project'][_0xe7910]===_0x5f08f5)return _0x41103d(0xab);if(this[_0x41103d(0xc8)][_0x41103d(0x97)][_0xe7910]===_0x5f08f5)return _0x41103d(0x98)+this[_0x41103d(0xa3)];if(this[_0x41103d(0xc8)][_0x41103d(0xd1)][_0xe7910]===_0x5f08f5)return _0x41103d(0xd1);return _0x41103d(0xba);}['loadGlobalConfig'](){const _0x3a1735=a48_0x484209,_0x589d4e=a48_0x18a53d[_0x3a1735(0xd5)](getConfigDir(),_0x3a1735(0xcd));if(!a48_0x486440[_0x3a1735(0xd6)](_0x589d4e))return{};try{const _0x3d6587=a48_0x486440[_0x3a1735(0xb6)](_0x589d4e,_0x3a1735(0xac));return JSON[_0x3a1735(0xa0)](_0x3d6587);}catch{return{};}}[a48_0x484209(0xa5)](_0x2eb532){const _0x23b8a1=a48_0x484209;_0x2eb532[_0x23b8a1(0xc1)]=this[_0x23b8a1(0xc1)],!_0x2eb532[_0x23b8a1(0x9a)]&&this['database']&&(_0x2eb532[_0x23b8a1(0x9a)]=this[_0x23b8a1(0x9a)]),!_0x2eb532['parentSegment']&&this['parent_segment']&&(_0x2eb532['parentSegment']=this[_0x23b8a1(0xb2)]),!_0x2eb532[_0x23b8a1(0xad)]&&this[_0x23b8a1(0xa7)]&&(_0x2eb532[_0x23b8a1(0xad)]=this[_0x23b8a1(0xa7)]),!_0x2eb532[_0x23b8a1(0x9d)]&&this['llm_project']&&(_0x2eb532[_0x23b8a1(0x9d)]=this[_0x23b8a1(0xa8)]);}['getParameters'](){const _0x30bdb8=a48_0x484209;return[{'key':_0x30bdb8(0xc1),'value':this['site']},{'key':'database','value':this[_0x30bdb8(0x9a)]},{'key':_0x30bdb8(0xb2),'value':this[_0x30bdb8(0xb2)]},{'key':'segment_path','value':this[_0x30bdb8(0xa7)]},{'key':_0x30bdb8(0xa8),'value':this['llm_project']},{'key':'profile','value':this['activeProfile']||undefined}];}[a48_0x484209(0x9e)](){console['log']('[context]');for(const {key:_0x347995,value:_0x1d5a0d}of this['getParameters']()){_0x1d5a0d&&console['log'](_0x347995+':\x20'+_0x1d5a0d);}}[a48_0x484209(0xd2)](){const _0x157180=a48_0x484209;console[_0x157180(0xc9)]('[context]');for(const {key:_0x351633,value:_0xb5147f}of this[_0x157180(0xaa)]()){if(_0xb5147f){const _0x406b01=_0x351633===_0x157180(0x97)?_0x157180(0xbc):'('+this['getSource'](_0x351633,_0xb5147f)+')';console[_0x157180(0xc9)](_0x351633+':\x20'+_0xb5147f+'\x20'+_0x406b01);}}console[_0x157180(0xc9)](_0x157180(0xda));const _0x6d4203=[{'label':_0x157180(0xb7),'path':this[_0x157180(0xc3)][_0x157180(0xaf)],'extra':_0x157180(0xae)+this['sessionId']+')'},{'label':_0x157180(0xbf),'path':this[_0x157180(0xc3)][_0x157180(0xab)]},{'label':_0x157180(0xa6),'path':this[_0x157180(0xc3)][_0x157180(0x97)]},{'label':'Profile\x20Credentials','path':this[_0x157180(0xc3)][_0x157180(0xa1)]},{'label':_0x157180(0xcf),'path':this[_0x157180(0xc3)][_0x157180(0xd1)]},{'label':_0x157180(0x9f),'path':this['configFiles'][_0x157180(0xb5)]}];for(const {label:_0x25688d,path:_0x2276e8,extra:_0x18f8b6}of _0x6d4203){if(_0x2276e8)console[_0x157180(0xc9)](_0x25688d+':\x20'+_0x2276e8+'\x20✓'+(_0x18f8b6?'\x20'+_0x18f8b6:''));else{if(_0x25688d===_0x157180(0xb7))console[_0x157180(0xc9)](_0x25688d+_0x157180(0xce)+this['sessionId']+')');else(_0x25688d===_0x157180(0xbf)||_0x25688d===_0x157180(0xcf))&&console[_0x157180(0xc9)](_0x25688d+':\x20none');}}}async[a48_0x484209(0xd0)](){const _0x43e535=a48_0x484209;return this[_0x43e535(0xb0)]=await getAPIKeyAsync(this[_0x43e535(0xc1)],this[_0x43e535(0xa3)]||undefined),this['apiKey'];}static async[a48_0x484209(0xd9)](_0x8de290){const _0x312d09=a48_0x484209,_0x469076=new GlobalContext(_0x8de290);return await _0x469076[_0x312d09(0xd0)](),_0x469076;}}function a48_0x24f4(){const _0x58237e=['segmentPath','(session:\x20','session','apiKey','10214aOhELI','parent_segment','15ogiwYK','sessionId','globalCredentials','readFileSync','Session','profiles','toString','default','replace','(active)','934652nOHnQT','parentSegment','Project','1386imkPCX','site','118280XtNldK','configFiles','8163516wdDIgb','158742ANHydX','INFO','2169222xDxEWv','layers','log','not\x20set','verbose','cliFlags','tdx.json',':\x20none\x20(using\x20session:\x20','Global','resolveAPIKeyAsync','global','displayWithSources','.env','368nwsEqJ','join','existsSync','5618855DMKvGN','config','createAsync','\x0a[configuration\x20files]','profile','profile:\x20','logLevel','database','91vKdKmg','313EvSNxC','llmProject','display','Global\x20Credentials','parse','profileCredentials','us01','activeProfile','sessions','injectIntoOptions','Profile','segment_path','llm_project','35xSFoDH','getParameters','project','utf-8'];a48_0x24f4=function(){return _0x58237e;};return a48_0x24f4();}
|
package/dist/core/keychain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x52a7ba,_0x44512e){const _0x370b99=a49_0x1ccf,_0x5d387a=_0x52a7ba();while(!![]){try{const _0x466101=-parseInt(_0x370b99(0xc3))/0x1+-parseInt(_0x370b99(0xc5))/0x2*(-parseInt(_0x370b99(0xb9))/0x3)+-parseInt(_0x370b99(0xbb))/0x4+-parseInt(_0x370b99(0xbf))/0x5+-parseInt(_0x370b99(0xca))/0x6*(-parseInt(_0x370b99(0xc0))/0x7)+parseInt(_0x370b99(0xad))/0x8*(parseInt(_0x370b99(0xaf))/0x9)+parseInt(_0x370b99(0xba))/0xa*(-parseInt(_0x370b99(0xbd))/0xb);if(_0x466101===_0x44512e)break;else _0x5d387a['push'](_0x5d387a['shift']());}catch(_0xd6ed87){_0x5d387a['push'](_0x5d387a['shift']());}}}(a49_0x149e,0x1ade6));const SERVICE_NAME='tdx';let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x573808=a49_0x1ccf;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x3752fb=await import('@zowe/secrets-for-zowe-sdk');return keyringModule=_0x3752fb[_0x573808(0xb7)],keyringModule;}catch(_0xe63402){return keyringLoadError=_0xe63402 instanceof Error?_0xe63402:new Error(String(_0xe63402)),null;}}function getAccountName(_0x4fdb51){const _0x3bac0a=a49_0x1ccf,_0xe54fc7=_0x4fdb51||'';return _0x3bac0a(0xaa)+_0xe54fc7+_0x3bac0a(0xac);}function a49_0x149e(){const _0x177b91=['includes','-25293','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.','keyring','message','3jILvIC','145930vxgVGK','276580SxMtuW','System\x20keychain\x20is\x20not\x20available','99cNHXRz','unavailable','809920JiQDgR','266qBZzAU','__keychain_test__','toLowerCase','14232gPkNxz','Warning:\x20','391726opEixH','-25300','restricted','not\x20supported','success','20064pFlsBE','error','setPassword','profile:','value',':api_key','12248bAPLkX','cannot\x20find','963kZBRDI','getPassword','access_denied','not_found','access'];a49_0x149e=function(){return _0x177b91;};return a49_0x149e();}export async function getKeychainAPIKey(_0x137d91){const _0x487e87=a49_0x1ccf,_0x3f505f=await getKeychainAPIKeyWithStatus(_0x137d91);if(_0x3f505f[_0x487e87(0xc9)])return _0x3f505f[_0x487e87(0xab)];return _0x3f505f['reason']===_0x487e87(0xb1)&&console[_0x487e87(0xa8)](_0x487e87(0xc4)+_0x3f505f['message']),null;}export async function getKeychainAPIKeyWithStatus(_0x438e94){const _0x2a5d11=a49_0x1ccf;try{const _0x3f6744=await getKeyring();if(!_0x3f6744)return{'success':![],'reason':'unavailable'};const _0x41adbc=getAccountName(_0x438e94),_0x518678=await _0x3f6744['getPassword'](SERVICE_NAME,_0x41adbc);if(_0x518678)return{'success':!![],'value':_0x518678};return{'success':![],'reason':'not_found'};}catch(_0x152651){const _0x29f2fb=_0x152651 instanceof Error?_0x152651[_0x2a5d11(0xb8)]:String(_0x152651);if(_0x29f2fb[_0x2a5d11(0xb4)](_0x2a5d11(0xc6))||_0x29f2fb['toLowerCase']()[_0x2a5d11(0xb4)]('could\x20not\x20be\x20found')||_0x29f2fb['toLowerCase']()[_0x2a5d11(0xb4)]('not\x20found'))return{'success':![],'reason':_0x2a5d11(0xb2)};if(_0x29f2fb[_0x2a5d11(0xb4)](_0x2a5d11(0xb5))||_0x29f2fb[_0x2a5d11(0xc2)]()[_0x2a5d11(0xb4)](_0x2a5d11(0xc7))||_0x29f2fb['toLowerCase']()[_0x2a5d11(0xb4)](_0x2a5d11(0xb3)))return{'success':![],'reason':_0x2a5d11(0xb1),'message':_0x2a5d11(0xb6)};return{'success':![],'reason':_0x2a5d11(0xbe),'message':_0x29f2fb};}}function a49_0x1ccf(_0x2602d5,_0x24cef1){_0x2602d5=_0x2602d5-0xa8;const _0x149e3f=a49_0x149e();let _0x1ccf43=_0x149e3f[_0x2602d5];return _0x1ccf43;}export async function saveKeychainAPIKey(_0x505ad0,_0x36a77a){const _0x14466c=a49_0x1ccf,_0x314a18=await getKeyring();if(!_0x314a18)throw new Error(_0x14466c(0xbc));const _0x4c3cb4=getAccountName(_0x36a77a);await _0x314a18[_0x14466c(0xa9)](SERVICE_NAME,_0x4c3cb4,_0x505ad0);}export async function deleteKeychainAPIKey(_0x16d837){try{const _0x15be4d=await getKeyring();if(!_0x15be4d)return![];const _0x1e1a7b=getAccountName(_0x16d837);return await _0x15be4d['deletePassword'](SERVICE_NAME,_0x1e1a7b);}catch{return![];}}export async function isKeychainAvailable(){const _0x22ebd6=a49_0x1ccf;try{const _0x4c1605=await getKeyring();if(!_0x4c1605)return![];return await _0x4c1605[_0x22ebd6(0xb0)](SERVICE_NAME,_0x22ebd6(0xc1)),!![];}catch(_0x35c3b9){const _0x4a9d73=_0x35c3b9 instanceof Error?_0x35c3b9['message']['toLowerCase']():'';if(_0x4a9d73[_0x22ebd6(0xb4)]('not\x20available')||_0x4a9d73[_0x22ebd6(0xb4)](_0x22ebd6(0xc8))||_0x4a9d73[_0x22ebd6(0xb4)](_0x22ebd6(0xae)))return![];return!![];}}
|
package/dist/core/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
+
(function(_0x1e3d9e,_0x58b868){const _0x2ca7f9=a50_0x2179,_0x30beec=_0x1e3d9e();while(!![]){try{const _0xab16f8=parseInt(_0x2ca7f9(0x1ef))/0x1*(-parseInt(_0x2ca7f9(0x1cc))/0x2)+parseInt(_0x2ca7f9(0x1b7))/0x3*(parseInt(_0x2ca7f9(0x1b6))/0x4)+-parseInt(_0x2ca7f9(0x1e3))/0x5*(-parseInt(_0x2ca7f9(0x1c0))/0x6)+parseInt(_0x2ca7f9(0x1bf))/0x7*(-parseInt(_0x2ca7f9(0x1ba))/0x8)+-parseInt(_0x2ca7f9(0x1b5))/0x9*(-parseInt(_0x2ca7f9(0x1e4))/0xa)+-parseInt(_0x2ca7f9(0x1c1))/0xb+-parseInt(_0x2ca7f9(0x1d2))/0xc;if(_0xab16f8===_0x58b868)break;else _0x30beec['push'](_0x30beec['shift']());}catch(_0x1d2a0e){_0x30beec['push'](_0x30beec['shift']());}}}(a50_0x49ba,0xe4f79));import*as a50_0x1912d6 from'node:fs';import*as a50_0x2f9734 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(_0x45538e){const _0x167219=a50_0x2179,_0x2994ac={};if(!_0x45538e)return _0x2994ac;for(const [_0x15fe4a,_0x23676b]of Object[_0x167219(0x1b0)](_0x45538e)){_0x15fe4a!==_0x167219(0x1bd)&&_0x23676b!==undefined&&(_0x2994ac[_0x15fe4a]=_0x23676b);}return _0x2994ac;}export function getProfilesDir(){return a50_0x2f9734['join'](getConfigDir(),'profiles');}function getProfileDir(_0x3eb532){const _0x3a9e97=a50_0x2179;return a50_0x2f9734[_0x3a9e97(0x1e7)](getProfilesDir(),_0x3eb532);}function a50_0x2179(_0x5b2b8f,_0x39ef99){_0x5b2b8f=_0x5b2b8f-0x1ad;const _0x49bae4=a50_0x49ba();let _0x217983=_0x49bae4[_0x5b2b8f];return _0x217983;}function getProfileConfigPath(_0x464056){const _0x61b2b=a50_0x2179;return a50_0x2f9734['join'](getProfileDir(_0x464056),_0x61b2b(0x1c4));}function getProfileEnvPath(_0x5e4a36){const _0x5c19fb=a50_0x2179;return a50_0x2f9734[_0x5c19fb(0x1e7)](getProfileDir(_0x5e4a36),_0x5c19fb(0x1be));}function getGlobalConfigPath(){const _0x5e98ab=a50_0x2179;return a50_0x2f9734[_0x5e98ab(0x1e7)](getConfigDir(),_0x5e98ab(0x1c4));}function validateProfileName(_0x5e3512){const _0x5f338b=a50_0x2179;if(!/^[a-zA-Z0-9_-]+$/['test'](_0x5e3512))throw new Error(_0x5f338b(0x1e9)+_0x5e3512+_0x5f338b(0x1c5));}function validateProfileConfig(_0x20cc27,_0x5aaf86){const _0x4af726=a50_0x2179;if(typeof _0x20cc27!==_0x4af726(0x1d7)||_0x20cc27===null)throw new Error(_0x4af726(0x1df)+_0x5aaf86+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x3bf38a=[_0x4af726(0x1bd),_0x4af726(0x1d9),'database',_0x4af726(0x1e0),'llm_project',_0x4af726(0x1bc)],_0x7089f4=_0x20cc27;for(const _0x2034d5 of Object[_0x4af726(0x1e5)](_0x7089f4)){!_0x3bf38a[_0x4af726(0x1c7)](_0x2034d5)&&console[_0x4af726(0x1ea)](_0x4af726(0x1c6)+_0x5aaf86+_0x4af726(0x1b9)+_0x2034d5+_0x4af726(0x1d8));}if(_0x7089f4[_0x4af726(0x1bd)]!==undefined&&typeof _0x7089f4[_0x4af726(0x1bd)]!==_0x4af726(0x1db))throw new Error(_0x4af726(0x1df)+_0x5aaf86+_0x4af726(0x1af));if(_0x7089f4[_0x4af726(0x1d9)]!==undefined&&typeof _0x7089f4[_0x4af726(0x1d9)]!==_0x4af726(0x1db))throw new Error(_0x4af726(0x1df)+_0x5aaf86+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x7089f4['database']!==undefined&&typeof _0x7089f4[_0x4af726(0x1f6)]!==_0x4af726(0x1db))throw new Error(_0x4af726(0x1df)+_0x5aaf86+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x7089f4[_0x4af726(0x1e0)]!==undefined&&typeof _0x7089f4['parent_segment']!==_0x4af726(0x1db))throw new Error('Profile\x20\x27'+_0x5aaf86+_0x4af726(0x1bb));if(_0x7089f4[_0x4af726(0x1f4)]!==undefined&&typeof _0x7089f4[_0x4af726(0x1f4)]!==_0x4af726(0x1db))throw new Error('Profile\x20\x27'+_0x5aaf86+_0x4af726(0x1f9));if(_0x7089f4[_0x4af726(0x1bc)]!==undefined&&typeof _0x7089f4[_0x4af726(0x1bc)]!==_0x4af726(0x1db))throw new Error(_0x4af726(0x1df)+_0x5aaf86+_0x4af726(0x1b3));return!![];}function loadProfilesFromTdxJson(_0x342fc5,_0x25aa4f){const _0xf63e5c=a50_0x2179;if(!a50_0x1912d6[_0xf63e5c(0x1ee)](_0x342fc5))return[];try{const _0x291de0=a50_0x1912d6['readFileSync'](_0x342fc5,'utf-8'),_0x35e8d1=JSON[_0xf63e5c(0x1c8)](_0x291de0);if(!_0x35e8d1[_0xf63e5c(0x1de)]||typeof _0x35e8d1[_0xf63e5c(0x1de)]!==_0xf63e5c(0x1d7))return[];const _0x2f023f=[];for(const [_0x481b2f,_0x52d989]of Object['entries'](_0x35e8d1['profiles'])){try{validateProfileConfig(_0x52d989,_0x481b2f);const _0x2ff52b=getNewCredentialPath(_0x481b2f),_0x2b798a=getOldCredentialPath(_0x481b2f),_0x1338c0=a50_0x1912d6[_0xf63e5c(0x1ee)](_0x2ff52b)||a50_0x1912d6['existsSync'](_0x2b798a);_0x2f023f[_0xf63e5c(0x1b8)]({'name':_0x481b2f,'config':_0x52d989,'metadata':{'name':_0x481b2f,'createdAt':new Date()[_0xf63e5c(0x1ca)]()},'hasCredentials':_0x1338c0,'scope':_0x25aa4f});}catch(_0x10c1ab){_0x10c1ab instanceof Error&&(console['warn'](_0xf63e5c(0x1c9)+_0x342fc5+':'),console[_0xf63e5c(0x1ea)]('\x20\x20'+_0x10c1ab[_0xf63e5c(0x1f1)]+'\x0a'));}}return _0x2f023f;}catch(_0x5587e5){return _0x5587e5 instanceof SyntaxError?(console[_0xf63e5c(0x1ea)](_0xf63e5c(0x1f5)+_0x342fc5+_0xf63e5c(0x1f2)),console[_0xf63e5c(0x1ea)](_0xf63e5c(0x1ec)+_0x5587e5['message']+'\x0a')):console['warn'](_0xf63e5c(0x1cd)+_0x342fc5+':\x20'+_0x5587e5+'\x0a'),[];}}export function getNewCredentialPath(_0x15a6de){const _0x18ca90=a50_0x2179;return a50_0x2f9734[_0x18ca90(0x1e7)](getConfigDir(),_0x18ca90(0x1d1)+_0x15a6de);}function getOldCredentialPath(_0x3a084f){const _0x1f7e35=a50_0x2179;return a50_0x2f9734[_0x1f7e35(0x1e7)](getProfilesDir(),_0x3a084f,_0x1f7e35(0x1be));}function loadProfilesFromTdxJsonFiles(){const _0x1f1896=a50_0x2179,_0x75dacd=[],_0x4d4337=findProjectConfigPath();_0x4d4337&&_0x75dacd[_0x1f1896(0x1b8)](...loadProfilesFromTdxJson(_0x4d4337,_0x1f1896(0x1b4)));const _0x57f582=a50_0x2f9734[_0x1f1896(0x1e7)](getConfigDir(),_0x1f1896(0x1c4));return _0x75dacd[_0x1f1896(0x1b8)](...loadProfilesFromTdxJson(_0x57f582,_0x1f1896(0x1e6))),_0x75dacd;}function loadProfilesFromDirectories(){const _0x29f580=a50_0x2179,_0x1a5a96=getProfilesDir();if(!a50_0x1912d6[_0x29f580(0x1ee)](_0x1a5a96))return[];try{return a50_0x1912d6[_0x29f580(0x1e2)](_0x1a5a96,{'withFileTypes':!![]})[_0x29f580(0x1ae)](_0xfe15a6=>_0xfe15a6[_0x29f580(0x1ce)]())[_0x29f580(0x1dc)](_0x3f588a=>_0x3f588a[_0x29f580(0x1f7)])['filter'](_0x2a5b6c=>{const _0x385dcc=_0x29f580,_0x531f95=getProfileConfigPath(_0x2a5b6c),_0x247f81=getProfileEnvPath(_0x2a5b6c);return a50_0x1912d6[_0x385dcc(0x1ee)](_0x531f95)||a50_0x1912d6['existsSync'](_0x247f81);})[_0x29f580(0x1dc)](_0x2b4362=>{const _0x49993e=loadProfileFromDirectory(_0x2b4362);if(_0x49993e)return{..._0x49993e,'scope':'directory'};return null;})[_0x29f580(0x1ae)](_0x18e628=>_0x18e628!==null);}catch{return[];}}function loadProfileFromDirectory(_0x53dd85){const _0x5783af=a50_0x2179,_0x4e6b27=getProfileConfigPath(_0x53dd85),_0x1eceb1=getOldCredentialPath(_0x53dd85);if(!a50_0x1912d6[_0x5783af(0x1ee)](_0x4e6b27)&&!a50_0x1912d6['existsSync'](_0x1eceb1))return null;let _0x32e993={},_0x1dca10={'name':_0x53dd85,'createdAt':new Date()[_0x5783af(0x1ca)]()};if(a50_0x1912d6['existsSync'](_0x4e6b27))try{const _0x320791=a50_0x1912d6[_0x5783af(0x1eb)](_0x4e6b27,_0x5783af(0x1ad)),_0x1873e3=JSON[_0x5783af(0x1c8)](_0x320791),{metadata:_0x38e7ea,..._0x4e7ad4}=_0x1873e3;_0x32e993=_0x4e7ad4,_0x38e7ea&&(_0x1dca10=_0x38e7ea);}catch{}return{'name':_0x53dd85,'config':_0x32e993,'metadata':_0x1dca10,'hasCredentials':a50_0x1912d6[_0x5783af(0x1ee)](_0x1eceb1),'scope':'directory'};}export function listProfiles(){const _0x432331=a50_0x2179,_0x34009e=loadProfilesFromTdxJsonFiles(),_0x472379=loadProfilesFromDirectories();if(_0x472379['length']>0x0){const _0x59b3a9=_0x472379[_0x432331(0x1dc)](_0x5e2bfd=>_0x5e2bfd[_0x432331(0x1f7)])[_0x432331(0x1e7)](',\x20'),_0x1def17=getConfigDir();console[_0x432331(0x1ea)](_0x432331(0x1d0)+_0x59b3a9),console[_0x432331(0x1ea)](_0x432331(0x1e1)),console[_0x432331(0x1ea)](_0x432331(0x1f8)+a50_0x2f9734[_0x432331(0x1e7)](_0x1def17,_0x432331(0x1c4))),console[_0x432331(0x1ea)](_0x432331(0x1f3)),console[_0x432331(0x1ea)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x5558b1=[..._0x34009e,..._0x472379],_0xce3fcb=new Map();for(const _0x1c3026 of _0x5558b1){!_0xce3fcb['has'](_0x1c3026[_0x432331(0x1f7)])&&_0xce3fcb[_0x432331(0x1ed)](_0x1c3026['name'],_0x1c3026);}return Array[_0x432331(0x1c2)](_0xce3fcb[_0x432331(0x1b2)]())[_0x432331(0x1d3)]((_0x4ceb66,_0x3be45b)=>_0x4ceb66[_0x432331(0x1f7)][_0x432331(0x1cf)](_0x3be45b[_0x432331(0x1f7)]));}export function profileExists(_0x2d723f){const _0x3cba78=a50_0x2179,_0x1cd1a1=listProfiles();return _0x1cd1a1[_0x3cba78(0x1d6)](_0x5c3a4c=>_0x5c3a4c['name']===_0x2d723f);}export function loadProfile(_0x32422a){const _0x8a3d93=a50_0x2179;validateProfileName(_0x32422a);const _0x2f66ca=listProfiles(),_0x177ecb=_0x2f66ca['find'](_0x560e64=>_0x560e64[_0x8a3d93(0x1f7)]===_0x32422a);return _0x177ecb||null;}export function saveProfile(_0x354818,_0x26576f,_0x5f1cf8=![]){saveProfileToUserConfig(_0x354818,_0x26576f);}export function deleteProfile(_0x234b17){const _0x553217=a50_0x2179;validateProfileName(_0x234b17);const _0x4cd90b=getProfileDir(_0x234b17);if(!a50_0x1912d6[_0x553217(0x1ee)](_0x4cd90b))throw new Error('Profile\x20'+_0x234b17+_0x553217(0x1e8));a50_0x1912d6[_0x553217(0x1d5)](_0x4cd90b,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x13433f,_0x448214){const _0x197471=a50_0x2179;validateProfileName(_0x13433f);const _0x4a2133=getGlobalConfigPath(),_0x49bf7b=getConfigDir();!a50_0x1912d6['existsSync'](_0x49bf7b)&&createSecureDirectory(_0x49bf7b);let _0x2dd056={};if(a50_0x1912d6[_0x197471(0x1ee)](_0x4a2133))try{const _0x268550=a50_0x1912d6[_0x197471(0x1eb)](_0x4a2133,'utf-8');_0x2dd056=JSON[_0x197471(0x1c8)](_0x268550);}catch{console[_0x197471(0x1ea)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x4a2133+_0x197471(0x1f0));}!_0x2dd056[_0x197471(0x1de)]&&(_0x2dd056['profiles']={}),_0x2dd056[_0x197471(0x1de)][_0x13433f]=_0x448214,writeSecureFile(_0x4a2133,JSON[_0x197471(0x1da)](_0x2dd056,null,0x2));}export function getActiveProfile(){const _0x2917fe=a50_0x2179,_0x5a13c9=loadSessionContext();if(_0x5a13c9?.[_0x2917fe(0x1cb)])return _0x5a13c9[_0x2917fe(0x1cb)];const _0x150b70=getGlobalConfigPath();if(!a50_0x1912d6[_0x2917fe(0x1ee)](_0x150b70))return null;try{const _0x21a183=a50_0x1912d6[_0x2917fe(0x1eb)](_0x150b70,_0x2917fe(0x1ad)),_0x4d6b43=JSON['parse'](_0x21a183);return _0x4d6b43['profile']||null;}catch{return null;}}export function createProfile(_0x2244ed,_0x35cdf1){const _0x3f449d=a50_0x2179;validateProfileName(_0x2244ed);if(profileExists(_0x2244ed))throw new Error(_0x3f449d(0x1c3)+_0x2244ed+_0x3f449d(0x1dd));saveProfile(_0x2244ed,_0x35cdf1);}function a50_0x49ba(){const _0x4a98e3=['66DmyRep','4199690KzARqx','from','Profile\x20','tdx.json','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','Warning:\x20Profile\x20\x27','includes','parse','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','toISOString','profile','166GrXENC','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','isDirectory','localeCompare','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','.env.','789456cDyqwX','sort','\x22\x20\x22','rmSync','some','object','\x27\x20will\x20be\x20ignored','site','stringify','string','map','\x20already\x20exists','profiles','Profile\x20\x27','parent_segment','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','readdirSync','835035guiVDh','4698370dNWqLY','keys','user','join','\x20does\x20not\x20exist','Invalid\x20profile\x20name:\x20','warn','readFileSync','Error:\x20','set','existsSync','10522SEKROp',',\x20creating\x20new\x20file','message',':\x20Invalid\x20JSON\x20syntax','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','llm_project','\x0aWarning:\x20Failed\x20to\x20parse\x20','database','name','\x20\x201.\x20Edit:\x20','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','utf-8','filter','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','entries','To\x20migrate:','values','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','local','9YHQoxK','188844rWQaFm','51pCMaMc','push','\x27:\x20unknown\x20config\x20key\x20\x27','6805984AWbpzO','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','llm_agent','description','.env','7GfcMTH'];a50_0x49ba=function(){return _0x4a98e3;};return a50_0x49ba();}export function saveProfileCredentials(_0x5a0ad6,_0x2943f6){const _0x2d56ae=a50_0x2179;validateProfileName(_0x5a0ad6);if(!profileExists(_0x5a0ad6))throw new Error(_0x2d56ae(0x1c3)+_0x5a0ad6+_0x2d56ae(0x1e8));const _0x27607e=getNewCredentialPath(_0x5a0ad6);writeSecureFile(_0x27607e,_0x2943f6);}export function loadProfileCredentials(_0x46f0bc){const _0x37b720=a50_0x2179;validateProfileName(_0x46f0bc);const _0x42b4d7=getNewCredentialPath(_0x46f0bc);if(a50_0x1912d6[_0x37b720(0x1ee)](_0x42b4d7))try{return a50_0x1912d6['readFileSync'](_0x42b4d7,_0x37b720(0x1ad));}catch{}const _0x482a42=getOldCredentialPath(_0x46f0bc);if(a50_0x1912d6['existsSync'](_0x482a42)){console['warn']('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x46f0bc+'\x27'),console[_0x37b720(0x1ea)](_0x37b720(0x1b1)),console[_0x37b720(0x1ea)]('\x20\x20mv\x20\x22'+_0x482a42+_0x37b720(0x1d4)+_0x42b4d7+'\x22'),console[_0x37b720(0x1ea)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a50_0x1912d6['readFileSync'](_0x482a42,_0x37b720(0x1ad));}catch{return null;}}return null;}
|