@treasuredata/tdx 0.9.5 → 0.9.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/agent-command.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.d.ts.map +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/connection-command.js.map +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.d.ts.map +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-command.js.map +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.d.ts +6 -0
- package/dist/commands/segment-pull-command.d.ts.map +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-pull-command.js.map +1 -1
- package/dist/commands/segment-push-command.d.ts.map +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-push-command.js.map +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/agent/agent-yaml.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/connection-validator.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.d.ts +113 -1
- package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
- package/dist/sdk/segment/journey-yaml.d.ts +18 -12
- package/dist/sdk/segment/journey-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.js.map +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/cdp.d.ts +2 -1
- package/dist/types/cdp.d.ts.map +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/agent-config.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/journey-utils.d.ts +30 -0
- package/dist/utils/journey-utils.d.ts.map +1 -1
- package/dist/utils/journey-utils.js +1 -1
- package/dist/utils/journey-utils.js.map +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-config.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0x4b1e76=a42_0x1584;(function(_0x430c88,_0x528117){const _0x2ac4df=a42_0x1584,_0x18e5b5=_0x430c88();while(!![]){try{const _0x2d716c=parseInt(_0x2ac4df(0xc7))/0x1*(parseInt(_0x2ac4df(0xcd))/0x2)+-parseInt(_0x2ac4df(0xc8))/0x3+parseInt(_0x2ac4df(0xce))/0x4+parseInt(_0x2ac4df(0xc1))/0x5*(-parseInt(_0x2ac4df(0xbe))/0x6)+parseInt(_0x2ac4df(0xca))/0x7+-parseInt(_0x2ac4df(0xa7))/0x8+-parseInt(_0x2ac4df(0xaa))/0x9*(parseInt(_0x2ac4df(0xba))/0xa);if(_0x2d716c===_0x528117)break;else _0x18e5b5['push'](_0x18e5b5['shift']());}catch(_0x1bd0cc){_0x18e5b5['push'](_0x18e5b5['shift']());}}}(a42_0x4308,0xa4968));import{BaseCommand}from'./command.js';function a42_0x4308(){const _0x2955f9=['execute','Session\x20agent\x20set\x20to:\x20','cleared','session','5348504XKLpDk','\x27\x20does\x20not\x20exist','Session\x20context\x20','9rlHNzw','green','\x0aSet\x20context:\x20tdx\x20use\x20<resource>\x20<value>','parent_segment','\x20\x20\x20\x20\x20\x20\x20tdx\x20use\x20--clear\x20\x20\x20\x20\x20\x20#\x20Clear\x20session\x20context\x0a','Session\x20profile\x20set\x20to:\x20','engage_workspace','Error:\x20','Error:\x20Profile\x20\x27','log','profile','clear','llm_agent','error','includes','Invalid\x20resource:\x20','1501370SERkZG','message','toString','use','1824puXxxW','(session:\x20','description','13175cMEqhh','Session\x20database\x20set\x20to:\x20','Session\x20llm_project\x20set\x20to:\x20','displayWithSources','\x0aRun\x20\x27tdx\x20use\x20--help\x27\x20for\x20more\x20options','join','70PTulTP','901191kEUeRb','agent','8149827CQmJHt','llm_project','\x0aUse\x20\x27tdx\x20profiles\x27\x20to\x20see\x20available\x20profiles','4656isuLMC','5068272apuLTf','database','dim','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','name','debug','Session\x20engage_workspace\x20set\x20to:\x20','Usage:\x20tdx\x20use\x20<resource>\x20<value>\x0a','display','validate','length','Resources:\x20database,\x20parent_segment,\x20llm_project,\x20agent,\x20profile,\x20engage_workspace','Set\x20session-level\x20context'];a42_0x4308=function(){return _0x2955f9;};return a42_0x4308();}import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions,clearSessionContext}from'../core/session.js';import{profileExists}from'../core/profile.js';function a42_0x1584(_0x383eb7,_0x334664){_0x383eb7=_0x383eb7-0x9c;const _0x4308c5=a42_0x4308();let _0x158411=_0x4308c5[_0x383eb7];return _0x158411;}import{GlobalContext}from'../core/global-context.js';import{parseAgentRef}from'../utils/agent-ref-parser.js';import a42_0x429805 from'chalk';export class UseCommand extends BaseCommand{[a42_0x4b1e76(0xd2)]=a42_0x4b1e76(0xbd);[a42_0x4b1e76(0xc0)]=a42_0x4b1e76(0xa2);[a42_0x4b1e76(0x9f)](_0x338898){const _0x29628c=a42_0x4b1e76,{args:_0x30e00e}=_0x338898;if(_0x30e00e[_0x29628c(0xa0)]===0x0)return undefined;if(_0x30e00e[_0x29628c(0xa0)]===0x1)return _0x29628c(0x9d)+'\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'+_0x29628c(0xae)+'\x0aResources:\x20database,\x20parent_segment,\x20llm_project,\x20agent,\x20profile,\x20engage_workspace\x0a'+_0x29628c(0xc5);const _0x2180f4=_0x30e00e[0x0],_0x10b4d9=[_0x29628c(0xcf),_0x29628c(0xad),'llm_project',_0x29628c(0xc9),_0x29628c(0xb4),_0x29628c(0xb0)];if(!_0x10b4d9[_0x29628c(0xb8)](_0x2180f4))return _0x29628c(0xb9)+_0x2180f4+'.\x20Must\x20be\x20one\x20of:\x20'+_0x10b4d9[_0x29628c(0xc6)](',\x20');return undefined;}async[a42_0x4b1e76(0xa3)](_0x5c10a1){const _0x1721c1=a42_0x4b1e76,{args:_0x2cd918,options:_0x5d8323}=_0x5c10a1,_0x32cde9=_0x5d8323[_0x1721c1(0xd3)],_0x265ad5=_0x5d8323[_0x1721c1(0xb5)];cleanExpiredSessions();try{if(_0x265ad5){clearSessionContext(_0x5d8323['session']);const _0x3e4207=_0x5d8323[_0x1721c1(0xa6)]||getCurrentSessionPID()[_0x1721c1(0xbc)]();return console['log'](_0x1721c1(0xa9)+a42_0x429805[_0x1721c1(0xab)](_0x1721c1(0xa5))+'\x20'+a42_0x429805[_0x1721c1(0xd0)](_0x1721c1(0xbf)+_0x3e4207+')')),0x0;}if(_0x2cd918['length']===0x0){const _0x1b7749=new GlobalContext(_0x5d8323);return _0x32cde9?_0x1b7749[_0x1721c1(0xc4)]():_0x1b7749[_0x1721c1(0x9e)](),console[_0x1721c1(0xb3)](a42_0x429805['dim'](_0x1721c1(0xac))),console[_0x1721c1(0xb3)](a42_0x429805[_0x1721c1(0xd0)](_0x1721c1(0xa1))),0x0;}const _0x11d510=_0x2cd918[0x0],_0x387071=_0x2cd918[0x1];if(_0x11d510==='profile'){if(!profileExists(_0x387071))return console[_0x1721c1(0xb7)](_0x1721c1(0xb2)+_0x387071+_0x1721c1(0xa8)),console['error'](_0x1721c1(0xcc)),0x1;const _0x332dd5=_0x5d8323[_0x1721c1(0xa6)]||getCurrentSessionPID()[_0x1721c1(0xbc)]();return saveSessionContext({'profile':_0x387071},_0x5d8323['session']),console['log'](_0x1721c1(0xaf)+a42_0x429805['green'](_0x387071)+'\x20'+a42_0x429805[_0x1721c1(0xd0)](_0x1721c1(0xbf)+_0x332dd5+')')),console[_0x1721c1(0xb3)](a42_0x429805[_0x1721c1(0xd0)]('\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides')),0x0;}const _0x10d3f6={},_0x469000=_0x5d8323[_0x1721c1(0xa6)]||getCurrentSessionPID()[_0x1721c1(0xbc)]();switch(_0x11d510){case _0x1721c1(0xcf):_0x10d3f6['database']=_0x387071,console['log'](_0x1721c1(0xc2)+a42_0x429805[_0x1721c1(0xab)](_0x387071)+'\x20'+a42_0x429805['dim'](_0x1721c1(0xbf)+_0x469000+')'));break;case _0x1721c1(0xad):_0x10d3f6[_0x1721c1(0xad)]=_0x387071,console[_0x1721c1(0xb3)]('Session\x20parent_segment\x20set\x20to:\x20'+a42_0x429805[_0x1721c1(0xab)](_0x387071)+'\x20'+a42_0x429805[_0x1721c1(0xd0)](_0x1721c1(0xbf)+_0x469000+')'));break;case _0x1721c1(0xcb):_0x10d3f6[_0x1721c1(0xcb)]=_0x387071,console[_0x1721c1(0xb3)](_0x1721c1(0xc3)+a42_0x429805[_0x1721c1(0xab)](_0x387071)+'\x20'+a42_0x429805[_0x1721c1(0xd0)](_0x1721c1(0xbf)+_0x469000+')'));break;case _0x1721c1(0xc9):{const {projectName:_0x7b5ff7,agentName:_0x430ddd}=parseAgentRef(_0x387071);_0x430ddd?(_0x10d3f6[_0x1721c1(0xcb)]=_0x7b5ff7,_0x10d3f6[_0x1721c1(0xb6)]=_0x430ddd,console['log'](_0x1721c1(0xc3)+a42_0x429805[_0x1721c1(0xab)](_0x7b5ff7)+'\x20'+a42_0x429805[_0x1721c1(0xd0)]('(session:\x20'+_0x469000+')')),console['log'](_0x1721c1(0xa4)+a42_0x429805[_0x1721c1(0xab)](_0x430ddd)+'\x20'+a42_0x429805[_0x1721c1(0xd0)](_0x1721c1(0xbf)+_0x469000+')'))):(_0x10d3f6['llm_agent']=_0x387071,console['log'](_0x1721c1(0xa4)+a42_0x429805[_0x1721c1(0xab)](_0x387071)+'\x20'+a42_0x429805[_0x1721c1(0xd0)](_0x1721c1(0xbf)+_0x469000+')')));break;}case _0x1721c1(0xb0):_0x10d3f6[_0x1721c1(0xb0)]=_0x387071,console[_0x1721c1(0xb3)](_0x1721c1(0x9c)+a42_0x429805[_0x1721c1(0xab)](_0x387071)+'\x20'+a42_0x429805['dim']('(session:\x20'+_0x469000+')'));break;}return saveSessionContext(_0x10d3f6,_0x5d8323['session']),console[_0x1721c1(0xb3)](a42_0x429805[_0x1721c1(0xd0)](_0x1721c1(0xd1))),0x0;}catch(_0x151de6){return _0x151de6 instanceof Error&&console[_0x1721c1(0xb7)](_0x1721c1(0xb1)+_0x151de6[_0x1721c1(0xbb)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a43_0x2bb8(){const _0x2a9839=['length','user','description','7MBNiDf','Error:\x20','verbose','1581584xnoFUS','name','302246esWgJT','cause','\x20user','execute','\x20\x20Cause:\x20','data','1732444hQILkv','6obbjsO','22563540TktOuz','Show\x20current\x20user\x20information','message','list','✔\x20Found\x20','error','Listing\x20users...','228118tVZoww','user\x20list','List\x20all\x20users\x20in\x20the\x20account','2154365iwmWap','5703588xNJJNR'];a43_0x2bb8=function(){return _0x2a9839;};return a43_0x2bb8();}const a43_0x21b9ee=a43_0x42a3;(function(_0x3c12d4,_0x63c830){const _0x472349=a43_0x42a3,_0x383eef=_0x3c12d4();while(!![]){try{const _0x96ae46=-parseInt(_0x472349(0x1fb))/0x1+-parseInt(_0x472349(0x1ec))/0x2*(-parseInt(_0x472349(0x1f3))/0x3)+-parseInt(_0x472349(0x1f2))/0x4+-parseInt(_0x472349(0x1e2))/0x5+-parseInt(_0x472349(0x1e3))/0x6+parseInt(_0x472349(0x1e7))/0x7*(-parseInt(_0x472349(0x1ea))/0x8)+parseInt(_0x472349(0x1f4))/0x9;if(_0x96ae46===_0x63c830)break;else _0x383eef['push'](_0x383eef['shift']());}catch(_0x59bd58){_0x383eef['push'](_0x383eef['shift']());}}}(a43_0x2bb8,0x8ae4c));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';function a43_0x42a3(_0x568a10,_0x3be3cf){_0x568a10=_0x568a10-0x1e1;const _0x2bb8ec=a43_0x2bb8();let _0x42a3db=_0x2bb8ec[_0x568a10];return _0x42a3db;}import{withSpinner}from'../utils/spinner.js';export class UserCommand extends BaseCommand{[a43_0x21b9ee(0x1eb)]=a43_0x21b9ee(0x1e5);[a43_0x21b9ee(0x1e6)]=a43_0x21b9ee(0x1f5);async[a43_0x21b9ee(0x1ef)](_0x6b75f2){const _0x2dceb1=a43_0x21b9ee,{options:_0x2203e7,tdx:_0x125ddb}=_0x6b75f2;try{const _0x3b2c98=await withSpinner('Fetching\x20user\x20info...',()=>_0x125ddb[_0x2dceb1(0x1e5)]['getCurrent'](),{'verbose':_0x2203e7[_0x2dceb1(0x1e9)]}),_0x46f9f4=_0x3b2c98[_0x2dceb1(0x1f1)];return await handleSingleObjectOutput(_0x46f9f4,_0x2203e7),0x0;}catch(_0x1fa4c1){if(_0x1fa4c1 instanceof SDKError)return console[_0x2dceb1(0x1f9)]('Error:\x20'+_0x1fa4c1[_0x2dceb1(0x1f6)]),_0x1fa4c1['cause']&&console[_0x2dceb1(0x1f9)]('\x20\x20Cause:\x20'+_0x1fa4c1[_0x2dceb1(0x1ed)]),0x1;throw _0x1fa4c1;}}}export class UserListCommand extends BaseCommand{[a43_0x21b9ee(0x1eb)]=a43_0x21b9ee(0x1fc);[a43_0x21b9ee(0x1e6)]=a43_0x21b9ee(0x1e1);async[a43_0x21b9ee(0x1ef)](_0x12735c){const _0x67751a=a43_0x21b9ee,{options:_0x388084,tdx:_0x86f310}=_0x12735c;try{const _0x3261dc=await withSpinner(_0x67751a(0x1fa),()=>_0x86f310['user'][_0x67751a(0x1f7)](),{'verbose':_0x388084['verbose']}),_0xb43f6e=_0x3261dc[_0x67751a(0x1f1)];return console[_0x67751a(0x1f9)](_0x67751a(0x1f8)+_0xb43f6e[_0x67751a(0x1e4)]+_0x67751a(0x1ee)+(_0xb43f6e[_0x67751a(0x1e4)]!==0x1?'s':'')),await handleSDKOutput(_0xb43f6e,_0x388084),0x0;}catch(_0xbd7ee1){if(_0xbd7ee1 instanceof SDKError)return console['error'](_0x67751a(0x1e8)+_0xbd7ee1[_0x67751a(0x1f6)]),_0xbd7ee1[_0x67751a(0x1ed)]&&console[_0x67751a(0x1f9)](_0x67751a(0x1f0)+_0xbd7ee1[_0x67751a(0x1ed)]),0x1;throw _0xbd7ee1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a44_0x322c85=a44_0x3098;(function(_0x556959,_0xadb28d){const _0x4a74a0=a44_0x3098,_0x56f2d1=_0x556959();while(!![]){try{const _0x1f4704=-parseInt(_0x4a74a0(0x9a))/0x1*(-parseInt(_0x4a74a0(0xaf))/0x2)+-parseInt(_0x4a74a0(0xf4))/0x3+-parseInt(_0x4a74a0(0xfe))/0x4+parseInt(_0x4a74a0(0x125))/0x5*(-parseInt(_0x4a74a0(0x9e))/0x6)+parseInt(_0x4a74a0(0xbf))/0x7+-parseInt(_0x4a74a0(0x12c))/0x8*(-parseInt(_0x4a74a0(0xdb))/0x9)+parseInt(_0x4a74a0(0xc5))/0xa;if(_0x1f4704===_0xadb28d)break;else _0x56f2d1['push'](_0x56f2d1['shift']());}catch(_0x20fe76){_0x56f2d1['push'](_0x56f2d1['shift']());}}}(a44_0x20af,0x2b536));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 a44_0x526862 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0xe3);[a44_0x322c85(0xe7)]=a44_0x322c85(0x95);async[a44_0x322c85(0x11d)](_0x101ddf){const _0x461ffb=a44_0x322c85,{options:_0x325c77,args:_0x24a728,tdx:_0x1f7e47}=_0x101ddf,_0x27eab3=_0x24a728[0x0];try{_0x325c77[_0x461ffb(0x118)]&&_0x27eab3&&console['error'](_0x461ffb(0xdd)+_0x27eab3);const _0x357447=await withSpinner(_0x461ffb(0x131),()=>_0x1f7e47['workflow'][_0x461ffb(0xae)](_0x27eab3,{'limit':_0x325c77[_0x461ffb(0x138)]}),{'verbose':_0x325c77[_0x461ffb(0x118)]}),_0x49b584=_0x357447['data'];return console[_0x461ffb(0xe8)](_0x461ffb(0xd4)+_0x49b584[_0x461ffb(0xb0)]+_0x461ffb(0xb3)+(_0x49b584[_0x461ffb(0xb0)]!==0x1?'s':'')),await handleSDKOutput(_0x49b584,_0x325c77),0x0;}catch(_0x120564){if(_0x120564 instanceof SDKError)return console[_0x461ffb(0xe8)](_0x461ffb(0x10f)+_0x120564[_0x461ffb(0xaa)]),_0x120564['cause']&&console[_0x461ffb(0xe8)](_0x461ffb(0x108)+_0x120564['cause']),0x1;throw _0x120564;}}}export class WorkflowWorkflowsCommand extends BaseCommand{['name']=a44_0x322c85(0x129);[a44_0x322c85(0xe7)]=a44_0x322c85(0x132);async[a44_0x322c85(0x11d)](_0x14f317){const _0x36ef3f=a44_0x322c85,{options:_0x537c18,args:_0x2042d1,tdx:_0x444e25}=_0x14f317,_0x237536=_0x2042d1[0x0];try{_0x537c18[_0x36ef3f(0x118)]&&_0x237536&&console[_0x36ef3f(0xe8)](_0x36ef3f(0x121)+_0x237536);const _0x6ddcdd=await withSpinner(_0x36ef3f(0xbe),()=>_0x444e25['workflow'][_0x36ef3f(0x9d)](_0x237536,{'limit':_0x537c18[_0x36ef3f(0x138)]}),{'verbose':_0x537c18[_0x36ef3f(0x118)]}),_0x230099=_0x6ddcdd['data'];return console[_0x36ef3f(0xe8)](_0x36ef3f(0xd4)+_0x230099['length']+_0x36ef3f(0xa8)+(_0x230099['length']!==0x1?'s':'')),await handleSDKOutput(_0x230099,_0x537c18),0x0;}catch(_0x4d9262){if(_0x4d9262 instanceof SDKError)return console[_0x36ef3f(0xe8)](_0x36ef3f(0x10f)+_0x4d9262[_0x36ef3f(0xaa)]),_0x4d9262[_0x36ef3f(0xd8)]&&console[_0x36ef3f(0xe8)](_0x36ef3f(0x108)+_0x4d9262[_0x36ef3f(0xd8)]),0x1;throw _0x4d9262;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']='workflow:sessions';[a44_0x322c85(0xe7)]='List\x20workflow\x20execution\x20sessions';async['execute'](_0x1c00bc){const _0x184b34=a44_0x322c85,{options:_0x43c984,args:_0x2ef045,tdx:_0x52816d}=_0x1c00bc;let _0x585f6d,_0xc2ad6c;if(_0x2ef045[0x0]){const _0x57eabb=_0x2ef045[0x0]['split']('.');if(_0x57eabb[_0x184b34(0xb0)]===0x1)_0x585f6d=_0x57eabb[0x0];else{if(_0x57eabb['length']===0x2)[_0x585f6d,_0xc2ad6c]=_0x57eabb;else return console[_0x184b34(0xe8)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{if(_0x43c984[_0x184b34(0x118)]){if(_0x585f6d&&_0xc2ad6c)console['error'](_0x184b34(0x133)+_0x585f6d+'.'+_0xc2ad6c);else _0x585f6d&&console[_0x184b34(0xe8)](_0x184b34(0x11e)+_0x585f6d);const _0x17aa1d=_0x43c984[_0x184b34(0x106)];_0x17aa1d&&console[_0x184b34(0xe8)]('Status:\x20'+_0x17aa1d);}const _0x2d0a99=await withSpinner(_0x184b34(0xb1),()=>_0x52816d[_0x184b34(0x117)][_0x184b34(0xcb)]({'projectName':_0x585f6d,'workflowName':_0xc2ad6c,'status':_0x43c984[_0x184b34(0x106)],'fromTime':_0x43c984[_0x184b34(0xde)],'toTime':_0x43c984['to'],'limit':_0x43c984[_0x184b34(0x138)]}),{'verbose':_0x43c984[_0x184b34(0x118)]}),_0x2f2a32=_0x2d0a99[_0x184b34(0xfc)];return console[_0x184b34(0xe8)](_0x184b34(0xd4)+_0x2f2a32[_0x184b34(0xb0)]+_0x184b34(0x123)+(_0x2f2a32[_0x184b34(0xb0)]!==0x1?'s':'')),await handleSDKOutput(_0x2f2a32,_0x43c984),0x0;}catch(_0x3bcf11){if(_0x3bcf11 instanceof SDKError)return console['error'](_0x184b34(0x10f)+_0x3bcf11[_0x184b34(0xaa)]),_0x3bcf11[_0x184b34(0xd8)]&&console['error']('\x20\x20Cause:\x20'+_0x3bcf11[_0x184b34(0xd8)]),0x1;throw _0x3bcf11;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a44_0x322c85(0x10a)]='workflow:attempts';[a44_0x322c85(0xe7)]=a44_0x322c85(0xa5);async[a44_0x322c85(0x11d)](_0x300acc){const _0x4aefbf=a44_0x322c85,{options:_0x179489,args:_0x82f917,tdx:_0x3d1dbc}=_0x300acc;let _0x2df8b1,_0x2c5c5f;if(_0x82f917[0x0]){const _0x5081de=_0x82f917[0x0][_0x4aefbf(0xcd)]('.');if(_0x5081de[_0x4aefbf(0xb0)]===0x1)_0x2df8b1=_0x5081de[0x0];else{if(_0x5081de[_0x4aefbf(0xb0)]===0x2)[_0x2df8b1,_0x2c5c5f]=_0x5081de;else return console[_0x4aefbf(0xe8)](_0x4aefbf(0xe5)),0x1;}}try{const _0x4a5626=_0x179489[_0x4aefbf(0xce)];if(_0x179489[_0x4aefbf(0x118)]){if(_0x2df8b1&&_0x2c5c5f)console[_0x4aefbf(0xe8)](_0x4aefbf(0x133)+_0x2df8b1+'.'+_0x2c5c5f);else _0x2df8b1&&console[_0x4aefbf(0xe8)](_0x4aefbf(0x11e)+_0x2df8b1);_0x4a5626&&console[_0x4aefbf(0xe8)]('Include\x20retried:\x20yes');}const _0x2abc97=await withSpinner(_0x4aefbf(0xd6),()=>_0x3d1dbc[_0x4aefbf(0x117)][_0x4aefbf(0x98)]({'projectName':_0x2df8b1,'workflowName':_0x2c5c5f,'includeRetried':_0x4a5626,'limit':_0x179489[_0x4aefbf(0x138)]}),{'verbose':_0x179489[_0x4aefbf(0x118)]}),_0x36b502=_0x2abc97[_0x4aefbf(0xfc)];return console['error'](_0x4aefbf(0xd4)+_0x36b502['length']+'\x20attempt'+(_0x36b502[_0x4aefbf(0xb0)]!==0x1?'s':'')),await handleSDKOutput(_0x36b502,_0x179489),0x0;}catch(_0x3291b0){if(_0x3291b0 instanceof SDKError)return console[_0x4aefbf(0xe8)](_0x4aefbf(0x10f)+_0x3291b0[_0x4aefbf(0xaa)]),_0x3291b0['cause']&&console[_0x4aefbf(0xe8)](_0x4aefbf(0x108)+_0x3291b0[_0x4aefbf(0xd8)]),0x1;throw _0x3291b0;}}}export class WorkflowAttemptCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0xf2);[a44_0x322c85(0xe7)]=a44_0x322c85(0x97);async['execute'](_0x5ad75c){const _0x153e5f=a44_0x322c85,{options:_0x2803e0,args:_0x84ccc0,tdx:_0x26fa71}=_0x5ad75c,_0x4179e9=_0x84ccc0[0x0];if(!_0x4179e9)return console[_0x153e5f(0xe8)](_0x153e5f(0xa0)),0x1;try{_0x2803e0[_0x153e5f(0x118)]&&console[_0x153e5f(0xe8)](_0x153e5f(0x10c)+_0x4179e9);const _0x175ca2=await withSpinner(_0x153e5f(0xf0),()=>_0x26fa71['workflow'][_0x153e5f(0x126)](_0x4179e9),{'verbose':_0x2803e0[_0x153e5f(0x118)]}),_0x1dd592=_0x175ca2[_0x153e5f(0xfc)];let _0x2c9a73;!_0x1dd592[_0x153e5f(0xd1)]?_0x2c9a73=_0x1dd592[_0x153e5f(0xe4)]?_0x153e5f(0xdf):_0x153e5f(0xf5):_0x2c9a73=_0x1dd592['success']?_0x153e5f(0xe1):_0x153e5f(0xe8);let _0x2fdafe;if(_0x1dd592[_0x153e5f(0xda)]&&_0x1dd592[_0x153e5f(0xd0)]){const _0x9c306e=new Date(_0x1dd592[_0x153e5f(0xda)])[_0x153e5f(0x128)](),_0x186a37=new Date(_0x1dd592[_0x153e5f(0xd0)])['getTime']();_0x2fdafe=Math[_0x153e5f(0xb2)]((_0x186a37-_0x9c306e)/0x3e8);}const _0x2a6a2f={'attempt_id':_0x1dd592['id'],'status':_0x2c9a73,..._0x1dd592[_0x153e5f(0x107)]!==undefined&&{'index':_0x1dd592[_0x153e5f(0x107)]},..._0x1dd592[_0x153e5f(0xab)]&&{'project':_0x1dd592[_0x153e5f(0xab)][_0x153e5f(0x10a)]},..._0x1dd592[_0x153e5f(0x117)]&&{'workflow':_0x1dd592['workflow']['name']},..._0x1dd592[_0x153e5f(0x100)]&&{'session_id':_0x1dd592[_0x153e5f(0x100)]},..._0x1dd592['sessionTime']&&{'session_time':_0x1dd592[_0x153e5f(0xa1)]},..._0x1dd592[_0x153e5f(0xc1)]&&{'retry_attempt':_0x1dd592[_0x153e5f(0xc1)]},..._0x2fdafe!==undefined&&{'duration_sec':_0x2fdafe},..._0x1dd592['createdAt']&&{'created_at':_0x1dd592[_0x153e5f(0xda)]},..._0x1dd592[_0x153e5f(0xd0)]&&{'finished_at':_0x1dd592['finishedAt']},...Object[_0x153e5f(0xd7)](_0x1dd592[_0x153e5f(0x12d)])[_0x153e5f(0xb0)]>0x0&&{'params':_0x1dd592[_0x153e5f(0x12d)]}};return await handleSingleObjectOutput(_0x2a6a2f,_0x2803e0),0x0;}catch(_0x681004){if(_0x681004 instanceof SDKError)return console[_0x153e5f(0xe8)]('Error:\x20'+_0x681004[_0x153e5f(0xaa)]),_0x681004[_0x153e5f(0xd8)]&&console[_0x153e5f(0xe8)]('\x20\x20Cause:\x20'+_0x681004[_0x153e5f(0xd8)]),0x1;throw _0x681004;}}}export class WorkflowTasksCommand extends BaseCommand{[a44_0x322c85(0x10a)]='workflow:tasks';[a44_0x322c85(0xe7)]=a44_0x322c85(0x130);async['execute'](_0x5a52a7){const _0x16e03d=a44_0x322c85,{options:_0x33be0a,args:_0x259ba7,tdx:_0x3654a6}=_0x5a52a7,_0x14615e=_0x259ba7[0x0];if(!_0x14615e)return console[_0x16e03d(0xe8)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x232c1b=_0x33be0a[_0x16e03d(0x120)];_0x33be0a[_0x16e03d(0x118)]&&(console[_0x16e03d(0xe8)](_0x16e03d(0x10c)+_0x14615e),_0x232c1b&&console[_0x16e03d(0xe8)](_0x16e03d(0xd5)));const _0x11b4f8=await withSpinner(_0x16e03d(0xa9),()=>_0x3654a6[_0x16e03d(0x117)][_0x16e03d(0xbb)](_0x14615e,_0x232c1b||![]),{'verbose':_0x33be0a[_0x16e03d(0x118)]}),_0x5f2fdd=_0x11b4f8[_0x16e03d(0xfc)];return console[_0x16e03d(0xe8)](_0x16e03d(0xd4)+_0x5f2fdd[_0x16e03d(0xb0)]+_0x16e03d(0x124)+(_0x5f2fdd[_0x16e03d(0xb0)]!==0x1?'s':'')),await handleSDKOutput(_0x5f2fdd,_0x33be0a),0x0;}catch(_0x1fd0ef){if(_0x1fd0ef instanceof SDKError)return console['error'](_0x16e03d(0x10f)+_0x1fd0ef['message']),_0x1fd0ef['cause']&&console['error'](_0x16e03d(0x108)+_0x1fd0ef[_0x16e03d(0xd8)]),0x1;throw _0x1fd0ef;}}}function a44_0x3098(_0x3ada99,_0x34981c){_0x3ada99=_0x3ada99-0x95;const _0x20af1b=a44_0x20af();let _0x309897=_0x20af1b[_0x3ada99];return _0x309897;}export class WorkflowLogsCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0xeb);[a44_0x322c85(0xe7)]=a44_0x322c85(0xe9);async[a44_0x322c85(0x11d)](_0x3f5b25){const _0x2c31ce=a44_0x322c85,{options:_0x4957fb,args:_0x27ce6a,tdx:_0x132cfe}=_0x3f5b25,_0x1e3372=_0x27ce6a[0x0];let _0x5edf9d=_0x27ce6a[0x1];if(!_0x1e3372)return console[_0x2c31ce(0xe8)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x4957fb[_0x2c31ce(0x118)]&&(console['error'](_0x2c31ce(0x10c)+_0x1e3372),_0x5edf9d&&console[_0x2c31ce(0xe8)](_0x2c31ce(0xd3)+_0x5edf9d));const _0x418ed2=await withSpinner(_0x2c31ce(0x134),()=>_0x132cfe[_0x2c31ce(0x117)][_0x2c31ce(0xe0)](_0x1e3372,_0x5edf9d),{'verbose':_0x4957fb['verbose']}),_0x3eeb6d=_0x418ed2[_0x2c31ce(0xfc)];if(_0x3eeb6d[_0x2c31ce(0xb0)]===0x0)return console['error'](_0x2c31ce(0x96)),0x0;if(!_0x5edf9d&&(_0x4957fb[_0x2c31ce(0xc3)]||_0x4957fb[_0x2c31ce(0xbc)]))return await handleSDKOutput(_0x3eeb6d,_0x4957fb),0x0;if(!_0x5edf9d){const _0x108185=_0x3eeb6d['map'](_0x3dc1c5=>({'title':_0x3dc1c5[_0x2c31ce(0xcc)]+'\x20('+formatBytes(_0x3dc1c5[_0x2c31ce(0xb7)])+')','value':_0x3dc1c5[_0x2c31ce(0xcc)]})),_0x3cfec8=await a44_0x526862({'type':_0x2c31ce(0x113),'name':_0x2c31ce(0xb8),'message':_0x2c31ce(0x115),'choices':_0x108185});if(!_0x3cfec8[_0x2c31ce(0xb8)])return console[_0x2c31ce(0xe8)]('Cancelled'),0x0;_0x5edf9d=_0x3cfec8[_0x2c31ce(0xb8)];}const _0x212a08=await withSpinner(_0x2c31ce(0xc9),()=>_0x132cfe[_0x2c31ce(0x117)][_0x2c31ce(0x109)](_0x1e3372,_0x5edf9d),{'verbose':_0x4957fb[_0x2c31ce(0x118)]}),_0x17134c=_0x212a08[_0x2c31ce(0xfc)];return _0x17134c?console['log'](_0x17134c):console[_0x2c31ce(0xe8)](_0x2c31ce(0xc4)),0x0;}catch(_0x52f283){if(_0x52f283 instanceof SDKError)return console[_0x2c31ce(0xe8)](_0x2c31ce(0x10f)+_0x52f283[_0x2c31ce(0xaa)]),_0x52f283['cause']&&console[_0x2c31ce(0xe8)](_0x2c31ce(0x108)+_0x52f283['cause']),0x1;throw _0x52f283;}}}export class WorkflowKillCommand extends BaseCommand{['name']=a44_0x322c85(0xd2);[a44_0x322c85(0xe7)]=a44_0x322c85(0xff);async[a44_0x322c85(0x11d)](_0x231979){const _0xc045d7=a44_0x322c85,{options:_0x404499,args:_0x217c1a,tdx:_0x333992}=_0x231979,_0x587d4c=_0x217c1a[0x0];if(!_0x587d4c)return console[_0xc045d7(0xe8)](_0xc045d7(0xa0)),0x1;try{const _0x37bf66=_0x404499[_0xc045d7(0xe2)];_0x404499[_0xc045d7(0x118)]&&(console[_0xc045d7(0xe8)](_0xc045d7(0x10c)+_0x587d4c),_0x37bf66&&console[_0xc045d7(0xe8)]('Reason:\x20'+_0x37bf66));if(!_0x404499[_0xc045d7(0x127)]){const _0x3c7dd3=await confirm(_0xc045d7(0xca)+_0x587d4c+'?');if(!_0x3c7dd3)return console[_0xc045d7(0xe8)]('Cancelled'),0x0;}const _0x53d07a=await withSpinner(_0xc045d7(0xc0),()=>_0x333992[_0xc045d7(0x117)][_0xc045d7(0x101)](_0x587d4c,_0x37bf66),{'verbose':_0x404499[_0xc045d7(0x118)]}),_0x5bee9e=_0x53d07a['data'];return console[_0xc045d7(0xe8)]('✔\x20'+_0x5bee9e),0x0;}catch(_0x2dc934){if(_0x2dc934 instanceof SDKError)return console[_0xc045d7(0xe8)](_0xc045d7(0x10f)+_0x2dc934[_0xc045d7(0xaa)]),_0x2dc934[_0xc045d7(0xd8)]&&console[_0xc045d7(0xe8)](_0xc045d7(0x108)+_0x2dc934[_0xc045d7(0xd8)]),0x1;throw _0x2dc934;}}}export class WorkflowRetryCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0xfb);[a44_0x322c85(0xe7)]=a44_0x322c85(0x99);async[a44_0x322c85(0x11d)](_0x185ee8){const _0x903c12=a44_0x322c85,{options:_0x2c61c9,args:_0x6c9d3b,tdx:_0x558ccd}=_0x185ee8,_0x49d1c1=_0x6c9d3b[0x0];if(!_0x49d1c1)return console[_0x903c12(0xe8)]('Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required'),console['error']('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x2ba413=![],_0x1a5b34=_0x49d1c1;if(_0x49d1c1['startsWith']('session:'))_0x2ba413=!![],_0x1a5b34=_0x49d1c1[_0x903c12(0xcf)](0x8);else{if(_0x49d1c1['startsWith']('attempt:'))_0x2ba413=![],_0x1a5b34=_0x49d1c1['substring'](0x8);else return console[_0x903c12(0xe8)](_0x903c12(0xdc)),console['error'](_0x903c12(0x10e)),0x1;}try{const _0x2bc132=_0x2c61c9[_0x903c12(0x9f)],_0x2e5815=_0x2c61c9[_0x903c12(0x11a)],_0x22cb7a=_0x2c61c9['params'],_0x11bd5b=_0x2c61c9['force'];_0x2c61c9[_0x903c12(0x118)]&&(console['error'](_0x903c12(0x13a)+(_0x2ba413?_0x903c12(0x135):_0x903c12(0x126))+'\x20'+_0x1a5b34),_0x2bc132&&console['error'](_0x903c12(0xc6)+_0x2bc132),_0x2e5815&&console[_0x903c12(0xe8)](_0x903c12(0x12e)+_0x2e5815),_0x22cb7a&&console[_0x903c12(0xe8)](_0x903c12(0x112)+_0x22cb7a),_0x11bd5b&&console[_0x903c12(0xe8)](_0x903c12(0x12b)));let _0x264f25;if(_0x22cb7a)try{if(_0x22cb7a['startsWith']('@')){const _0x21ac58=await import(_0x903c12(0xe6)),_0x424261=_0x22cb7a[_0x903c12(0xcf)](0x1),_0x4e3753=await _0x21ac58['readFile'](_0x424261,_0x903c12(0xb4));_0x264f25=JSON[_0x903c12(0xfd)](_0x4e3753);}else _0x264f25=JSON[_0x903c12(0xfd)](_0x22cb7a);}catch{return console[_0x903c12(0xe8)](_0x903c12(0xf1)),0x1;}if(!_0x2c61c9['yes']){const _0x3d8e29=await confirm(_0x903c12(0xa2)+(_0x2ba413?_0x903c12(0x135):_0x903c12(0x126))+'\x20'+_0x1a5b34+'?');if(!_0x3d8e29)return console[_0x903c12(0xe8)](_0x903c12(0xa4)),0x0;}let _0x329cec;_0x2ba413?_0x329cec=await withSpinner(_0x903c12(0x116),()=>_0x558ccd[_0x903c12(0x117)][_0x903c12(0xac)](_0x1a5b34,{'fromTask':_0x2bc132,'retryParams':_0x264f25}),{'verbose':_0x2c61c9[_0x903c12(0x118)]}):_0x329cec=await withSpinner(_0x903c12(0x105),()=>_0x558ccd[_0x903c12(0x117)][_0x903c12(0xed)](_0x1a5b34,{'resumeFrom':_0x2e5815,'retryParams':_0x264f25,'force':_0x11bd5b}),{'verbose':_0x2c61c9[_0x903c12(0x118)]});const _0x2df30c=_0x329cec[_0x903c12(0xfc)];return console[_0x903c12(0xe8)](_0x903c12(0x122)),console[_0x903c12(0xe8)]('\x20\x20New\x20attempt\x20ID:\x20'+_0x2df30c[_0x903c12(0xad)]),console[_0x903c12(0xe8)](_0x903c12(0xb5)+_0x2df30c[_0x903c12(0x100)]),0x0;}catch(_0x35f295){if(_0x35f295 instanceof SDKError)return console[_0x903c12(0xe8)](_0x903c12(0x10f)+_0x35f295[_0x903c12(0xaa)]),_0x35f295[_0x903c12(0xd8)]&&console[_0x903c12(0xe8)](_0x903c12(0x108)+_0x35f295[_0x903c12(0xd8)]),0x1;throw _0x35f295;}}}export class WorkflowRunCommand extends BaseCommand{[a44_0x322c85(0x10a)]='workflow:run';[a44_0x322c85(0xe7)]='Start\x20a\x20workflow\x20run';async[a44_0x322c85(0x11d)](_0x26512c){const _0xfe3a0d=a44_0x322c85,{options:_0x3f9a61,args:_0x384cde,tdx:_0x4b2b75}=_0x26512c,_0x3a2683=_0x384cde[0x0];if(!_0x3a2683)return console['error']('Error:\x20Workflow\x20identifier\x20is\x20required'),console['error'](_0xfe3a0d(0xee)),0x1;const _0x2664e9=_0x3f9a61['param'],_0x35a6ce=_0x3f9a61[_0xfe3a0d(0xa1)],_0x3b4771={};if(_0x2664e9&&Array[_0xfe3a0d(0xb6)](_0x2664e9))for(const _0x421c61 of _0x2664e9){const _0x34fb75=_0x421c61[_0xfe3a0d(0xf8)]('=');if(_0x34fb75===-0x1)return console[_0xfe3a0d(0xe8)](_0xfe3a0d(0xfa)+_0x421c61),console[_0xfe3a0d(0xe8)](_0xfe3a0d(0xc2)),0x1;const _0x3b4896=_0x421c61['substring'](0x0,_0x34fb75),_0x232e27=_0x421c61[_0xfe3a0d(0xcf)](_0x34fb75+0x1);try{_0x3b4771[_0x3b4896]=JSON[_0xfe3a0d(0xfd)](_0x232e27);}catch{_0x3b4771[_0x3b4896]=_0x232e27;}}_0x3f9a61['verbose']&&(console['error'](_0xfe3a0d(0xbd)+_0x3a2683),Object[_0xfe3a0d(0xd7)](_0x3b4771)[_0xfe3a0d(0xb0)]>0x0&&console[_0xfe3a0d(0xe8)](_0xfe3a0d(0xb9)+JSON[_0xfe3a0d(0xba)](_0x3b4771)),_0x35a6ce&&console[_0xfe3a0d(0xe8)](_0xfe3a0d(0x137)+_0x35a6ce));const _0x4c08b9=await withSpinner(_0xfe3a0d(0x111),()=>_0x4b2b75[_0xfe3a0d(0x117)][_0xfe3a0d(0x119)](_0x3a2683,_0x3b4771,{'sessionTime':_0x35a6ce}),{'verbose':_0x3f9a61[_0xfe3a0d(0x118)]}),_0x333b1d=_0x4c08b9['data'];return console[_0xfe3a0d(0xe8)](_0xfe3a0d(0x12f)),console['error'](_0xfe3a0d(0xea)+_0x333b1d['id']),console[_0xfe3a0d(0xe8)]('\x20\x20Session\x20ID:\x20'+_0x333b1d[_0xfe3a0d(0x100)]),console[_0xfe3a0d(0xe8)]('\x20\x20Project:\x20'+_0x333b1d['project']?.[_0xfe3a0d(0x10a)]),console[_0xfe3a0d(0xe8)]('\x20\x20Workflow:\x20'+_0x333b1d[_0xfe3a0d(0x117)]?.[_0xfe3a0d(0x10a)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a44_0x322c85(0x10a)]='workflow:download';[a44_0x322c85(0xe7)]=a44_0x322c85(0x104);async[a44_0x322c85(0x11d)](_0x2aa2f2){const _0x972b89=a44_0x322c85,{options:_0x3c7a5a,args:_0xaaf384,tdx:_0x2883ff}=_0x2aa2f2,_0x180de5=_0xaaf384[0x0],_0x4e61fe=_0xaaf384[0x1]||'.';if(!_0x180de5)return console[_0x972b89(0xe8)](_0x972b89(0x136)),console[_0x972b89(0xe8)](_0x972b89(0x10b)),0x1;const _0x52358b=_0x3c7a5a['revision'];_0x3c7a5a[_0x972b89(0x118)]&&(console['error']('Project:\x20'+_0x180de5),console[_0x972b89(0xe8)](_0x972b89(0xd9)+_0x4e61fe),_0x52358b&&console[_0x972b89(0xe8)]('Revision:\x20'+_0x52358b));const _0x16a408=await withSpinner('Downloading\x20project\x20'+_0x180de5+_0x972b89(0x10d),()=>_0x2883ff[_0x972b89(0x117)][_0x972b89(0xf7)](_0x180de5,_0x4e61fe,{'revision':_0x52358b}),{'verbose':_0x3c7a5a['verbose']}),_0x450824=_0x16a408[_0x972b89(0xfc)];return console[_0x972b89(0xe8)](_0x972b89(0xec)+_0x450824[_0x972b89(0xa6)]),console['error'](_0x972b89(0x12a)+_0x450824[_0x972b89(0x11f)]),console[_0x972b89(0xe8)](_0x972b89(0xc8)+_0x450824['filesExtracted']),console['error'](_0x972b89(0x9b)+_0x4e61fe+'/'+_0x450824[_0x972b89(0xa6)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0x114);[a44_0x322c85(0xe7)]=a44_0x322c85(0xc7);async['execute'](_0x1d2097){const _0x4195d2=a44_0x322c85,{options:_0x49cfc4,args:_0x8d9631,tdx:_0x426e9d}=_0x1d2097;let _0x422ddc='.',_0x566694=_0x49cfc4[_0x4195d2(0x10a)];if(_0x8d9631[0x0]){const {promises:_0x4c3917}=await import('fs');try{const _0x19fd3e=await _0x4c3917[_0x4195d2(0xa3)](_0x8d9631[0x0]);if(_0x19fd3e['isDirectory']())_0x422ddc=_0x8d9631[0x0];else return console['error'](_0x4195d2(0x10f)+_0x8d9631[0x0]+_0x4195d2(0x11b)),0x1;}catch{_0x566694=_0x8d9631[0x0],_0x422ddc='.';}}const _0x3da80a=_0x49cfc4[_0x4195d2(0x11f)],_0x16a957=_0x49cfc4[_0x4195d2(0x9c)];_0x49cfc4[_0x4195d2(0x118)]&&(console[_0x4195d2(0xe8)](_0x4195d2(0xf6)+_0x422ddc),_0x566694&&console[_0x4195d2(0xe8)]('Project\x20name:\x20'+_0x566694),_0x3da80a&&console[_0x4195d2(0xe8)](_0x4195d2(0xef)+_0x3da80a),_0x16a957&&console[_0x4195d2(0xe8)](_0x4195d2(0x11c)));const _0x295aca=await withSpinner('Pushing\x20workflow\x20project...',()=>_0x426e9d[_0x4195d2(0x117)]['push'](_0x422ddc,{'projectName':_0x566694,'revision':_0x3da80a,'skipValidation':_0x16a957}),{'verbose':_0x49cfc4[_0x4195d2(0x118)]}),_0xd291f9=_0x295aca['data'];return console[_0x4195d2(0xe8)](_0x4195d2(0xf9)+_0xd291f9[_0x4195d2(0xa6)]),console[_0x4195d2(0xe8)](_0x4195d2(0x102)+_0xd291f9['projectId']),console[_0x4195d2(0xe8)](_0x4195d2(0x12a)+_0xd291f9[_0x4195d2(0x11f)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a44_0x322c85(0x10a)]=a44_0x322c85(0x110);[a44_0x322c85(0xe7)]=a44_0x322c85(0x103);async[a44_0x322c85(0x11d)](_0x35030d){const _0x35bc39=a44_0x322c85,{options:_0x3f1ecd,args:_0x45069a,tdx:_0x5c8b85}=_0x35030d,_0x109f09=_0x45069a[0x0];if(!_0x109f09)return console[_0x35bc39(0xe8)]('Error:\x20Project\x20name\x20or\x20ID\x20is\x20required'),console['error']('Usage:\x20workflow:delete\x20<project-name-or-id>'),0x1;_0x3f1ecd[_0x35bc39(0x118)]&&console[_0x35bc39(0xe8)]('Project:\x20'+_0x109f09);if(!_0x3f1ecd[_0x35bc39(0x127)]){const _0x3ce086=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22'+_0x109f09+_0x35bc39(0xa7));if(!_0x3ce086)return console['error'](_0x35bc39(0xa4)),0x0;}const _0x496bf6=await withSpinner(_0x35bc39(0x139)+_0x109f09+_0x35bc39(0x10d),()=>_0x5c8b85[_0x35bc39(0x117)]['delete'](_0x109f09),{'verbose':_0x3f1ecd[_0x35bc39(0x118)]}),_0x4581bf=_0x496bf6[_0x35bc39(0xfc)];return console[_0x35bc39(0xe8)](_0x35bc39(0xf3)+_0x4581bf['projectName']),console[_0x35bc39(0xe8)](_0x35bc39(0x102)+_0x4581bf[_0x35bc39(0x13b)]),0x0;}}function a44_0x20af(){const _0x65cdc0=['Resume\x20from:\x20','✔\x20Workflow\x20run\x20started','Show\x20tasks\x20for\x20an\x20attempt','Listing\x20workflow\x20projects...','List\x20workflows','Filter:\x20','Fetching\x20log\x20files...','session','Error:\x20Project\x20name\x20is\x20required','Session\x20time:\x20','limit','Deleting\x20project\x20','Target:\x20','projectId','List\x20all\x20workflow\x20projects','No\x20log\x20files\x20found\x20for\x20this\x20attempt','Show\x20specific\x20attempt\x20details','attempts','Retry\x20a\x20session\x20or\x20attempt','94ZuzSpP','\x20\x20Location:\x20','skipValidation','workflows','72ziCedG','fromTask','Error:\x20Attempt\x20ID\x20is\x20required','sessionTime','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','stat','Cancelled','List\x20workflow\x20attempts','projectName','\x22?\x20This\x20cannot\x20be\x20undone.','\x20workflow','Getting\x20attempt\x20tasks...','message','project','retrySession','attemptId','projects','2424dyHITP','length','Listing\x20workflow\x20sessions...','round','\x20project','utf-8','\x20\x20Session\x20ID:\x20','isArray','fileSize','task','Parameters:\x20','stringify','tasks','format','Workflow:\x20','Listing\x20workflows...','1304534KaDlvR','Killing\x20attempt...','retryAttemptName','Expected\x20format:\x20--param\x20key=value','json','No\x20log\x20content\x20found','1575130pajnpP','From\x20task:\x20','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','\x20\x20Files\x20extracted:\x20','Downloading\x20logs...','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','sessions','taskName','split','includeRetried','substring','finishedAt','done','workflow:kill','Task\x20name:\x20','✔\x20Found\x20','Including\x20subtasks:\x20yes','Listing\x20workflow\x20attempts...','keys','cause','Output\x20directory:\x20','createdAt','12051ikCVBY','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','Pattern:\x20','from','canceling','logFiles','success','reason','workflow:projects','cancelRequested','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','fs/promises','description','error','Show\x20logs\x20for\x20a\x20workflow\x20attempt','\x20\x20Attempt\x20ID:\x20','workflow:logs','✔\x20Downloaded\x20','retryAttempt','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','Revision:\x20','Getting\x20attempt\x20details...','Error:\x20Invalid\x20JSON\x20in\x20--params','workflow:attempt','✔\x20Deleted\x20project\x20','539211QnyscT','running','Project\x20directory:\x20','download','indexOf','✔\x20Pushed\x20','Error:\x20Invalid\x20parameter\x20format:\x20','workflow:retry','data','parse','1070292ltzxbY','Kill\x20a\x20running\x20attempt','sessionId','kill','\x20\x20Project\x20ID:\x20','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','Retrying\x20attempt...','status','index','\x20\x20Cause:\x20','logs','name','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','Attempt\x20ID:\x20','...','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','Error:\x20','workflow:delete','Starting\x20workflow\x20run...','Params:\x20','select','workflow:push','Select\x20a\x20task\x20to\x20view\x20logs:','Retrying\x20session...','workflow','verbose','run','resumeFrom','\x20is\x20not\x20a\x20directory','Validation:\x20skipped','execute','Filter:\x20project=','revision','includeSubtasks','Project\x20filter:\x20','✔\x20Retry\x20started','\x20session','\x20task','1285BwyGhy','attempt','yes','getTime','workflow:workflows','\x20\x20Revision:\x20','Force:\x20yes','1016RlixoF','params'];a44_0x20af=function(){return _0x65cdc0;};return a44_0x20af();}
|
|
1
|
+
const a44_0x2ab1ae=a44_0x3516;(function(_0x1fc2ec,_0x690f93){const _0x2624c0=a44_0x3516,_0x56788a=_0x1fc2ec();while(!![]){try{const _0x4162a4=-parseInt(_0x2624c0(0x174))/0x1*(parseInt(_0x2624c0(0x166))/0x2)+parseInt(_0x2624c0(0x13a))/0x3+-parseInt(_0x2624c0(0x18b))/0x4+parseInt(_0x2624c0(0x175))/0x5+parseInt(_0x2624c0(0x193))/0x6+parseInt(_0x2624c0(0x17d))/0x7+-parseInt(_0x2624c0(0x179))/0x8*(parseInt(_0x2624c0(0x15d))/0x9);if(_0x4162a4===_0x690f93)break;else _0x56788a['push'](_0x56788a['shift']());}catch(_0x14d475){_0x56788a['push'](_0x56788a['shift']());}}}(a44_0x4ac8,0x30878));import{BaseCommand}from'./command.js';function a44_0x3516(_0x1b7ca6,_0x118802){_0x1b7ca6=_0x1b7ca6-0x11c;const _0x4ac853=a44_0x4ac8();let _0x3516fd=_0x4ac853[_0x1b7ca6];return _0x3516fd;}function a44_0x4ac8(){const _0x24a2b4=['Including\x20subtasks:\x20yes','workflow:kill','No\x20log\x20content\x20found','Downloading\x20logs...','Listing\x20workflow\x20sessions...','Project\x20filter:\x20','projects','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','✔\x20Downloaded\x20','✔\x20Found\x20','Pattern:\x20','List\x20workflow\x20execution\x20sessions','filesExtracted','Downloading\x20project\x20','from','\x22?\x20This\x20cannot\x20be\x20undone.','Getting\x20attempt\x20details...','running','\x20\x20Attempt\x20ID:\x20','yes','\x20\x20Project:\x20','Parameters:\x20','execute','workflow:push','startsWith','Error:\x20Workflow\x20identifier\x20is\x20required','finishedAt','fromTask','Retrying\x20session...','workflow:tasks','data','retrySession','length','sessionId','467988AavrpG','workflow:run','format','workflow:download','session:','Error:\x20Invalid\x20parameter\x20format:\x20','Deleting\x20project\x20','parse','logs','status','Validation:\x20skipped','Usage:\x20workflow:delete\x20<project-name-or-id>','attempt','Cancelled','description','List\x20workflows','Reason:\x20','attempts','\x20\x20Cause:\x20','Filter:\x20','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','✔\x20Deleted\x20project\x20','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','error','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','push','revision','...','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','\x20\x20Revision:\x20','workflow:workflows','workflow','utf-8','fs/promises','Error:\x20Attempt\x20ID\x20is\x20required','791415DTVsiz','From\x20task:\x20','\x20\x20Location:\x20','success','Attempt\x20ID:\x20','\x20\x20New\x20attempt\x20ID:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','workflow:retry','659508QFrPKS','projectName','\x20attempt','Session\x20time:\x20','params','getTime','Error:\x20Project\x20name\x20is\x20required','name','sessionTime','Getting\x20attempt\x20tasks...','List\x20all\x20workflow\x20projects','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','isArray','\x20project','1SvVxvC','284435VKdbCM','Output\x20directory:\x20','includeRetried','Project:\x20','8gkPbkn','Include\x20retried:\x20yes','workflow:projects','taskName','2465960NWcJqz','\x20task','Starting\x20workflow\x20run...','Retrying\x20attempt...','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','Filter:\x20project=','reason','workflow:attempt','resumeFrom','force','createdAt','projectId','includeSubtasks','project','955624apPWDH','session','Listing\x20workflows...','Error:\x20','Pushing\x20workflow\x20project...','\x20session','param','✔\x20Workflow\x20run\x20started','1741248iArzYA','limit','Expected\x20format:\x20--param\x20key=value','retryAttemptName','cause','\x20\x20Project\x20ID:\x20','Show\x20logs\x20for\x20a\x20workflow\x20attempt','skipValidation','round','workflow:logs','canceling','kill','done','\x20\x20Files\x20extracted:\x20','Project\x20name:\x20','No\x20log\x20files\x20found\x20for\x20this\x20attempt','Force:\x20yes','Select\x20a\x20task\x20to\x20view\x20logs:','Revision:\x20','Retry\x20a\x20session\x20or\x20attempt','\x20\x20Session\x20ID:\x20','task','message','select','split','\x20is\x20not\x20a\x20directory','✔\x20Pushed\x20','index','keys','Killing\x20attempt...','workflow:sessions','Resume\x20from:\x20','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Fetching\x20log\x20files...','workflow:attempts','sessions','workflow:delete','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','readFile','Listing\x20workflow\x20attempts...','delete','verbose','List\x20workflow\x20attempts','Task\x20name:\x20','Show\x20tasks\x20for\x20an\x20attempt','tasks','Project\x20directory:\x20','substring','retryAttempt','attempt:','Show\x20specific\x20attempt\x20details'];a44_0x4ac8=function(){return _0x24a2b4;};return a44_0x4ac8();}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 a44_0xeea67 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a44_0x2ab1ae(0x16d)]=a44_0x2ab1ae(0x17b);['description']=a44_0x2ab1ae(0x170);async[a44_0x2ab1ae(0x12e)](_0x30f97c){const _0x310ff6=a44_0x2ab1ae,{options:_0x1d0be8,args:_0x3638df,tdx:_0x1b0d2a}=_0x30f97c,_0x562c24=_0x3638df[0x0];try{_0x1d0be8[_0x310ff6(0x1bc)]&&_0x562c24&&console['error'](_0x310ff6(0x122)+_0x562c24);const _0x490e8d=await withSpinner('Listing\x20workflow\x20projects...',()=>_0x1b0d2a[_0x310ff6(0x159)][_0x310ff6(0x11e)](_0x562c24,{'limit':_0x1d0be8[_0x310ff6(0x194)]}),{'verbose':_0x1d0be8[_0x310ff6(0x1bc)]}),_0xa3a4e3=_0x490e8d['data'];return console[_0x310ff6(0x151)]('✔\x20Found\x20'+_0xa3a4e3[_0x310ff6(0x138)]+_0x310ff6(0x173)+(_0xa3a4e3[_0x310ff6(0x138)]!==0x1?'s':'')),await handleSDKOutput(_0xa3a4e3,_0x1d0be8),0x0;}catch(_0x259721){if(_0x259721 instanceof SDKError)return console['error']('Error:\x20'+_0x259721[_0x310ff6(0x1a9)]),_0x259721[_0x310ff6(0x197)]&&console[_0x310ff6(0x151)](_0x310ff6(0x14c)+_0x259721[_0x310ff6(0x197)]),0x1;throw _0x259721;}}}export class WorkflowWorkflowsCommand extends BaseCommand{['name']=a44_0x2ab1ae(0x158);[a44_0x2ab1ae(0x148)]=a44_0x2ab1ae(0x149);async[a44_0x2ab1ae(0x12e)](_0x25468f){const _0x28b7cf=a44_0x2ab1ae,{options:_0x1b990c,args:_0x1daa6e,tdx:_0x423551}=_0x25468f,_0x30d7f6=_0x1daa6e[0x0];try{_0x1b990c['verbose']&&_0x30d7f6&&console[_0x28b7cf(0x151)](_0x28b7cf(0x11d)+_0x30d7f6);const _0x5b5138=await withSpinner(_0x28b7cf(0x18d),()=>_0x423551[_0x28b7cf(0x159)]['workflows'](_0x30d7f6,{'limit':_0x1b990c[_0x28b7cf(0x194)]}),{'verbose':_0x1b990c['verbose']}),_0x1e85e9=_0x5b5138['data'];return console[_0x28b7cf(0x151)](_0x28b7cf(0x121)+_0x1e85e9[_0x28b7cf(0x138)]+'\x20workflow'+(_0x1e85e9[_0x28b7cf(0x138)]!==0x1?'s':'')),await handleSDKOutput(_0x1e85e9,_0x1b990c),0x0;}catch(_0x5b42dd){if(_0x5b42dd instanceof SDKError)return console[_0x28b7cf(0x151)](_0x28b7cf(0x18e)+_0x5b42dd[_0x28b7cf(0x1a9)]),_0x5b42dd[_0x28b7cf(0x197)]&&console[_0x28b7cf(0x151)](_0x28b7cf(0x14c)+_0x5b42dd['cause']),0x1;throw _0x5b42dd;}}}export class WorkflowSessionsCommand extends BaseCommand{[a44_0x2ab1ae(0x16d)]=a44_0x2ab1ae(0x1b1);['description']=a44_0x2ab1ae(0x123);async['execute'](_0x484eb3){const _0x14a3a7=a44_0x2ab1ae,{options:_0x57b6de,args:_0x2b3195,tdx:_0x7fdc8a}=_0x484eb3;let _0x8806a3,_0x10ff5a;if(_0x2b3195[0x0]){const _0xe450e5=_0x2b3195[0x0][_0x14a3a7(0x1ab)]('.');if(_0xe450e5['length']===0x1)_0x8806a3=_0xe450e5[0x0];else{if(_0xe450e5[_0x14a3a7(0x138)]===0x2)[_0x8806a3,_0x10ff5a]=_0xe450e5;else return console[_0x14a3a7(0x151)](_0x14a3a7(0x1b3)),0x1;}}try{if(_0x57b6de[_0x14a3a7(0x1bc)]){if(_0x8806a3&&_0x10ff5a)console[_0x14a3a7(0x151)](_0x14a3a7(0x14d)+_0x8806a3+'.'+_0x10ff5a);else _0x8806a3&&console[_0x14a3a7(0x151)](_0x14a3a7(0x182)+_0x8806a3);const _0x46920e=_0x57b6de[_0x14a3a7(0x143)];_0x46920e&&console[_0x14a3a7(0x151)]('Status:\x20'+_0x46920e);}const _0x491444=await withSpinner(_0x14a3a7(0x11c),()=>_0x7fdc8a[_0x14a3a7(0x159)][_0x14a3a7(0x1b6)]({'projectName':_0x8806a3,'workflowName':_0x10ff5a,'status':_0x57b6de['status'],'fromTime':_0x57b6de[_0x14a3a7(0x126)],'toTime':_0x57b6de['to'],'limit':_0x57b6de['limit']}),{'verbose':_0x57b6de[_0x14a3a7(0x1bc)]}),_0x33e6da=_0x491444[_0x14a3a7(0x136)];return console[_0x14a3a7(0x151)](_0x14a3a7(0x121)+_0x33e6da[_0x14a3a7(0x138)]+_0x14a3a7(0x190)+(_0x33e6da[_0x14a3a7(0x138)]!==0x1?'s':'')),await handleSDKOutput(_0x33e6da,_0x57b6de),0x0;}catch(_0x4ae915){if(_0x4ae915 instanceof SDKError)return console[_0x14a3a7(0x151)]('Error:\x20'+_0x4ae915['message']),_0x4ae915['cause']&&console[_0x14a3a7(0x151)](_0x14a3a7(0x14c)+_0x4ae915['cause']),0x1;throw _0x4ae915;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a44_0x2ab1ae(0x16d)]=a44_0x2ab1ae(0x1b5);[a44_0x2ab1ae(0x148)]=a44_0x2ab1ae(0x1bd);async[a44_0x2ab1ae(0x12e)](_0x37c91a){const _0x195303=a44_0x2ab1ae,{options:_0x5704fd,args:_0x3abfe7,tdx:_0x24c051}=_0x37c91a;let _0x3ab56e,_0x36b276;if(_0x3abfe7[0x0]){const _0x50e9f7=_0x3abfe7[0x0][_0x195303(0x1ab)]('.');if(_0x50e9f7[_0x195303(0x138)]===0x1)_0x3ab56e=_0x50e9f7[0x0];else{if(_0x50e9f7[_0x195303(0x138)]===0x2)[_0x3ab56e,_0x36b276]=_0x50e9f7;else return console[_0x195303(0x151)](_0x195303(0x1b3)),0x1;}}try{const _0x236054=_0x5704fd[_0x195303(0x177)];if(_0x5704fd[_0x195303(0x1bc)]){if(_0x3ab56e&&_0x36b276)console[_0x195303(0x151)](_0x195303(0x14d)+_0x3ab56e+'.'+_0x36b276);else _0x3ab56e&&console[_0x195303(0x151)](_0x195303(0x182)+_0x3ab56e);_0x236054&&console[_0x195303(0x151)](_0x195303(0x17a));}const _0x42131a=await withSpinner(_0x195303(0x1ba),()=>_0x24c051[_0x195303(0x159)][_0x195303(0x14b)]({'projectName':_0x3ab56e,'workflowName':_0x36b276,'includeRetried':_0x236054,'limit':_0x5704fd[_0x195303(0x194)]}),{'verbose':_0x5704fd[_0x195303(0x1bc)]}),_0x3dd4db=_0x42131a[_0x195303(0x136)];return console[_0x195303(0x151)](_0x195303(0x121)+_0x3dd4db[_0x195303(0x138)]+_0x195303(0x168)+(_0x3dd4db[_0x195303(0x138)]!==0x1?'s':'')),await handleSDKOutput(_0x3dd4db,_0x5704fd),0x0;}catch(_0x3a17d5){if(_0x3a17d5 instanceof SDKError)return console[_0x195303(0x151)](_0x195303(0x18e)+_0x3a17d5[_0x195303(0x1a9)]),_0x3a17d5['cause']&&console[_0x195303(0x151)](_0x195303(0x14c)+_0x3a17d5[_0x195303(0x197)]),0x1;throw _0x3a17d5;}}}export class WorkflowAttemptCommand extends BaseCommand{['name']=a44_0x2ab1ae(0x184);[a44_0x2ab1ae(0x148)]=a44_0x2ab1ae(0x1c5);async['execute'](_0xc6bb9f){const _0x8e0426=a44_0x2ab1ae,{options:_0x1e67a9,args:_0x272994,tdx:_0x4a0245}=_0xc6bb9f,_0x5b3456=_0x272994[0x0];if(!_0x5b3456)return console['error'](_0x8e0426(0x15c)),0x1;try{_0x1e67a9[_0x8e0426(0x1bc)]&&console[_0x8e0426(0x151)](_0x8e0426(0x161)+_0x5b3456);const _0x129e16=await withSpinner(_0x8e0426(0x128),()=>_0x4a0245[_0x8e0426(0x159)][_0x8e0426(0x146)](_0x5b3456),{'verbose':_0x1e67a9[_0x8e0426(0x1bc)]}),_0x237c22=_0x129e16['data'];let _0x1a7369;!_0x237c22[_0x8e0426(0x19f)]?_0x1a7369=_0x237c22['cancelRequested']?_0x8e0426(0x19d):_0x8e0426(0x129):_0x1a7369=_0x237c22[_0x8e0426(0x160)]?'success':_0x8e0426(0x151);let _0x89b54c;if(_0x237c22[_0x8e0426(0x187)]&&_0x237c22[_0x8e0426(0x132)]){const _0x4306ad=new Date(_0x237c22[_0x8e0426(0x187)])[_0x8e0426(0x16b)](),_0x12f78f=new Date(_0x237c22['finishedAt'])[_0x8e0426(0x16b)]();_0x89b54c=Math[_0x8e0426(0x19b)]((_0x12f78f-_0x4306ad)/0x3e8);}const _0x5270b6={'attempt_id':_0x237c22['id'],'status':_0x1a7369,..._0x237c22[_0x8e0426(0x1ae)]!==undefined&&{'index':_0x237c22[_0x8e0426(0x1ae)]},..._0x237c22[_0x8e0426(0x18a)]&&{'project':_0x237c22[_0x8e0426(0x18a)][_0x8e0426(0x16d)]},..._0x237c22[_0x8e0426(0x159)]&&{'workflow':_0x237c22[_0x8e0426(0x159)][_0x8e0426(0x16d)]},..._0x237c22[_0x8e0426(0x139)]&&{'session_id':_0x237c22[_0x8e0426(0x139)]},..._0x237c22[_0x8e0426(0x16e)]&&{'session_time':_0x237c22['sessionTime']},..._0x237c22[_0x8e0426(0x196)]&&{'retry_attempt':_0x237c22[_0x8e0426(0x196)]},..._0x89b54c!==undefined&&{'duration_sec':_0x89b54c},..._0x237c22['createdAt']&&{'created_at':_0x237c22[_0x8e0426(0x187)]},..._0x237c22[_0x8e0426(0x132)]&&{'finished_at':_0x237c22['finishedAt']},...Object[_0x8e0426(0x1af)](_0x237c22[_0x8e0426(0x16a)])[_0x8e0426(0x138)]>0x0&&{'params':_0x237c22[_0x8e0426(0x16a)]}};return await handleSingleObjectOutput(_0x5270b6,_0x1e67a9),0x0;}catch(_0x3da21d){if(_0x3da21d instanceof SDKError)return console[_0x8e0426(0x151)]('Error:\x20'+_0x3da21d[_0x8e0426(0x1a9)]),_0x3da21d[_0x8e0426(0x197)]&&console['error'](_0x8e0426(0x14c)+_0x3da21d[_0x8e0426(0x197)]),0x1;throw _0x3da21d;}}}export class WorkflowTasksCommand extends BaseCommand{[a44_0x2ab1ae(0x16d)]=a44_0x2ab1ae(0x135);[a44_0x2ab1ae(0x148)]=a44_0x2ab1ae(0x1bf);async[a44_0x2ab1ae(0x12e)](_0x3dec6d){const _0x540137=a44_0x2ab1ae,{options:_0x12b8c7,args:_0x4e5223,tdx:_0x38e412}=_0x3dec6d,_0x5a0d41=_0x4e5223[0x0];if(!_0x5a0d41)return console['error'](_0x540137(0x15c)),0x1;try{const _0x4f3c32=_0x12b8c7[_0x540137(0x189)];_0x12b8c7[_0x540137(0x1bc)]&&(console[_0x540137(0x151)](_0x540137(0x161)+_0x5a0d41),_0x4f3c32&&console[_0x540137(0x151)](_0x540137(0x1c6)));const _0x1473ba=await withSpinner(_0x540137(0x16f),()=>_0x38e412[_0x540137(0x159)][_0x540137(0x1c0)](_0x5a0d41,_0x4f3c32||![]),{'verbose':_0x12b8c7['verbose']}),_0x5b14c3=_0x1473ba[_0x540137(0x136)];return console[_0x540137(0x151)](_0x540137(0x121)+_0x5b14c3['length']+_0x540137(0x17e)+(_0x5b14c3['length']!==0x1?'s':'')),await handleSDKOutput(_0x5b14c3,_0x12b8c7),0x0;}catch(_0x4738b8){if(_0x4738b8 instanceof SDKError)return console[_0x540137(0x151)](_0x540137(0x18e)+_0x4738b8['message']),_0x4738b8[_0x540137(0x197)]&&console['error'](_0x540137(0x14c)+_0x4738b8[_0x540137(0x197)]),0x1;throw _0x4738b8;}}}export class WorkflowLogsCommand extends BaseCommand{['name']=a44_0x2ab1ae(0x19c);['description']=a44_0x2ab1ae(0x199);async[a44_0x2ab1ae(0x12e)](_0x4b653f){const _0x4ecce8=a44_0x2ab1ae,{options:_0x16c200,args:_0x460246,tdx:_0x3aade7}=_0x4b653f,_0x150c39=_0x460246[0x0];let _0x414784=_0x460246[0x1];if(!_0x150c39)return console[_0x4ecce8(0x151)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x16c200[_0x4ecce8(0x1bc)]&&(console['error'](_0x4ecce8(0x161)+_0x150c39),_0x414784&&console[_0x4ecce8(0x151)](_0x4ecce8(0x1be)+_0x414784));const _0x3bd020=await withSpinner(_0x4ecce8(0x1b4),()=>_0x3aade7[_0x4ecce8(0x159)]['logFiles'](_0x150c39,_0x414784),{'verbose':_0x16c200['verbose']}),_0x81c0b6=_0x3bd020['data'];if(_0x81c0b6['length']===0x0)return console['error'](_0x4ecce8(0x1a2)),0x0;if(!_0x414784&&(_0x16c200['json']||_0x16c200[_0x4ecce8(0x13c)]))return await handleSDKOutput(_0x81c0b6,_0x16c200),0x0;if(!_0x414784){const _0x57f6fd=_0x81c0b6['map'](_0x3fadae=>({'title':_0x3fadae['taskName']+'\x20('+formatBytes(_0x3fadae['fileSize'])+')','value':_0x3fadae[_0x4ecce8(0x17c)]})),_0x34d446=await a44_0xeea67({'type':_0x4ecce8(0x1aa),'name':'task','message':_0x4ecce8(0x1a4),'choices':_0x57f6fd});if(!_0x34d446[_0x4ecce8(0x1a8)])return console[_0x4ecce8(0x151)](_0x4ecce8(0x147)),0x0;_0x414784=_0x34d446['task'];}const _0x4417fe=await withSpinner(_0x4ecce8(0x1c9),()=>_0x3aade7[_0x4ecce8(0x159)][_0x4ecce8(0x142)](_0x150c39,_0x414784),{'verbose':_0x16c200['verbose']}),_0x5026cb=_0x4417fe[_0x4ecce8(0x136)];return _0x5026cb?console['log'](_0x5026cb):console['error'](_0x4ecce8(0x1c8)),0x0;}catch(_0x189dbd){if(_0x189dbd instanceof SDKError)return console['error']('Error:\x20'+_0x189dbd[_0x4ecce8(0x1a9)]),_0x189dbd[_0x4ecce8(0x197)]&&console[_0x4ecce8(0x151)](_0x4ecce8(0x14c)+_0x189dbd[_0x4ecce8(0x197)]),0x1;throw _0x189dbd;}}}export class WorkflowKillCommand extends BaseCommand{[a44_0x2ab1ae(0x16d)]=a44_0x2ab1ae(0x1c7);[a44_0x2ab1ae(0x148)]='Kill\x20a\x20running\x20attempt';async[a44_0x2ab1ae(0x12e)](_0x39e9be){const _0x19f669=a44_0x2ab1ae,{options:_0x4844b9,args:_0x5891db,tdx:_0x59de16}=_0x39e9be,_0x56c1f3=_0x5891db[0x0];if(!_0x56c1f3)return console[_0x19f669(0x151)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x671e2d=_0x4844b9[_0x19f669(0x183)];_0x4844b9[_0x19f669(0x1bc)]&&(console[_0x19f669(0x151)](_0x19f669(0x161)+_0x56c1f3),_0x671e2d&&console[_0x19f669(0x151)](_0x19f669(0x14a)+_0x671e2d));if(!_0x4844b9[_0x19f669(0x12b)]){const _0x422d68=await confirm(_0x19f669(0x163)+_0x56c1f3+'?');if(!_0x422d68)return console[_0x19f669(0x151)](_0x19f669(0x147)),0x0;}const _0x3564c6=await withSpinner(_0x19f669(0x1b0),()=>_0x59de16[_0x19f669(0x159)][_0x19f669(0x19e)](_0x56c1f3,_0x671e2d),{'verbose':_0x4844b9[_0x19f669(0x1bc)]}),_0x22eb25=_0x3564c6[_0x19f669(0x136)];return console[_0x19f669(0x151)]('✔\x20'+_0x22eb25),0x0;}catch(_0x39ffc2){if(_0x39ffc2 instanceof SDKError)return console[_0x19f669(0x151)](_0x19f669(0x18e)+_0x39ffc2[_0x19f669(0x1a9)]),_0x39ffc2[_0x19f669(0x197)]&&console['error'](_0x19f669(0x14c)+_0x39ffc2[_0x19f669(0x197)]),0x1;throw _0x39ffc2;}}}export class WorkflowRetryCommand extends BaseCommand{['name']=a44_0x2ab1ae(0x165);['description']=a44_0x2ab1ae(0x1a6);async[a44_0x2ab1ae(0x12e)](_0x3bb769){const _0x46c804=a44_0x2ab1ae,{options:_0x194f65,args:_0x1d05ef,tdx:_0x316aaa}=_0x3bb769,_0x31d4df=_0x1d05ef[0x0];if(!_0x31d4df)return console['error'](_0x46c804(0x14e)),console[_0x46c804(0x151)](_0x46c804(0x164)),0x1;let _0x3a766f=![],_0x39a2d6=_0x31d4df;if(_0x31d4df[_0x46c804(0x130)](_0x46c804(0x13e)))_0x3a766f=!![],_0x39a2d6=_0x31d4df[_0x46c804(0x1c2)](0x8);else{if(_0x31d4df[_0x46c804(0x130)](_0x46c804(0x1c4)))_0x3a766f=![],_0x39a2d6=_0x31d4df[_0x46c804(0x1c2)](0x8);else return console[_0x46c804(0x151)]('Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'),console[_0x46c804(0x151)](_0x46c804(0x164)),0x1;}try{const _0x52e10c=_0x194f65[_0x46c804(0x133)],_0x5affdb=_0x194f65[_0x46c804(0x185)],_0xeeb183=_0x194f65[_0x46c804(0x16a)],_0x2316dc=_0x194f65[_0x46c804(0x186)];_0x194f65[_0x46c804(0x1bc)]&&(console[_0x46c804(0x151)]('Target:\x20'+(_0x3a766f?_0x46c804(0x18c):_0x46c804(0x146))+'\x20'+_0x39a2d6),_0x52e10c&&console[_0x46c804(0x151)](_0x46c804(0x15e)+_0x52e10c),_0x5affdb&&console[_0x46c804(0x151)](_0x46c804(0x1b2)+_0x5affdb),_0xeeb183&&console[_0x46c804(0x151)]('Params:\x20'+_0xeeb183),_0x2316dc&&console[_0x46c804(0x151)](_0x46c804(0x1a3)));let _0xc48a8b;if(_0xeeb183)try{if(_0xeeb183['startsWith']('@')){const _0x40048e=await import(_0x46c804(0x15b)),_0x5a9a8d=_0xeeb183[_0x46c804(0x1c2)](0x1),_0x1a70dd=await _0x40048e[_0x46c804(0x1b9)](_0x5a9a8d,_0x46c804(0x15a));_0xc48a8b=JSON[_0x46c804(0x141)](_0x1a70dd);}else _0xc48a8b=JSON['parse'](_0xeeb183);}catch{return console[_0x46c804(0x151)]('Error:\x20Invalid\x20JSON\x20in\x20--params'),0x1;}if(!_0x194f65['yes']){const _0x12a0ad=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20'+(_0x3a766f?_0x46c804(0x18c):'attempt')+'\x20'+_0x39a2d6+'?');if(!_0x12a0ad)return console[_0x46c804(0x151)](_0x46c804(0x147)),0x0;}let _0x4fb2a4;_0x3a766f?_0x4fb2a4=await withSpinner(_0x46c804(0x134),()=>_0x316aaa[_0x46c804(0x159)][_0x46c804(0x137)](_0x39a2d6,{'fromTask':_0x52e10c,'retryParams':_0xc48a8b}),{'verbose':_0x194f65[_0x46c804(0x1bc)]}):_0x4fb2a4=await withSpinner(_0x46c804(0x180),()=>_0x316aaa[_0x46c804(0x159)][_0x46c804(0x1c3)](_0x39a2d6,{'resumeFrom':_0x5affdb,'retryParams':_0xc48a8b,'force':_0x2316dc}),{'verbose':_0x194f65[_0x46c804(0x1bc)]});const _0xbc70c3=_0x4fb2a4['data'];return console[_0x46c804(0x151)]('✔\x20Retry\x20started'),console[_0x46c804(0x151)](_0x46c804(0x162)+_0xbc70c3['attemptId']),console[_0x46c804(0x151)](_0x46c804(0x1a7)+_0xbc70c3[_0x46c804(0x139)]),0x0;}catch(_0x4ea67d){if(_0x4ea67d instanceof SDKError)return console[_0x46c804(0x151)](_0x46c804(0x18e)+_0x4ea67d[_0x46c804(0x1a9)]),_0x4ea67d['cause']&&console[_0x46c804(0x151)]('\x20\x20Cause:\x20'+_0x4ea67d['cause']),0x1;throw _0x4ea67d;}}}export class WorkflowRunCommand extends BaseCommand{[a44_0x2ab1ae(0x16d)]=a44_0x2ab1ae(0x13b);[a44_0x2ab1ae(0x148)]='Start\x20a\x20workflow\x20run';async['execute'](_0x346990){const _0x508c4f=a44_0x2ab1ae,{options:_0x37a518,args:_0x11d33a,tdx:_0x31255b}=_0x346990,_0x1bf92a=_0x11d33a[0x0];if(!_0x1bf92a)return console[_0x508c4f(0x151)](_0x508c4f(0x131)),console['error'](_0x508c4f(0x152)),0x1;const _0x557e0e=_0x37a518[_0x508c4f(0x191)],_0xa0af02=_0x37a518[_0x508c4f(0x16e)],_0x5ad862={};if(_0x557e0e&&Array[_0x508c4f(0x172)](_0x557e0e))for(const _0x14d6a8 of _0x557e0e){const _0x2e08b8=_0x14d6a8['indexOf']('=');if(_0x2e08b8===-0x1)return console['error'](_0x508c4f(0x13f)+_0x14d6a8),console[_0x508c4f(0x151)](_0x508c4f(0x195)),0x1;const _0x598da0=_0x14d6a8[_0x508c4f(0x1c2)](0x0,_0x2e08b8),_0x143708=_0x14d6a8['substring'](_0x2e08b8+0x1);try{_0x5ad862[_0x598da0]=JSON[_0x508c4f(0x141)](_0x143708);}catch{_0x5ad862[_0x598da0]=_0x143708;}}_0x37a518[_0x508c4f(0x1bc)]&&(console['error']('Workflow:\x20'+_0x1bf92a),Object[_0x508c4f(0x1af)](_0x5ad862)[_0x508c4f(0x138)]>0x0&&console[_0x508c4f(0x151)](_0x508c4f(0x12d)+JSON['stringify'](_0x5ad862)),_0xa0af02&&console[_0x508c4f(0x151)](_0x508c4f(0x169)+_0xa0af02));const _0x4d80bf=await withSpinner(_0x508c4f(0x17f),()=>_0x31255b[_0x508c4f(0x159)]['run'](_0x1bf92a,_0x5ad862,{'sessionTime':_0xa0af02}),{'verbose':_0x37a518['verbose']}),_0x561e92=_0x4d80bf['data'];return console['error'](_0x508c4f(0x192)),console[_0x508c4f(0x151)](_0x508c4f(0x12a)+_0x561e92['id']),console[_0x508c4f(0x151)](_0x508c4f(0x1a7)+_0x561e92[_0x508c4f(0x139)]),console[_0x508c4f(0x151)](_0x508c4f(0x12c)+_0x561e92[_0x508c4f(0x18a)]?.['name']),console[_0x508c4f(0x151)]('\x20\x20Workflow:\x20'+_0x561e92[_0x508c4f(0x159)]?.[_0x508c4f(0x16d)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a44_0x2ab1ae(0x16d)]=a44_0x2ab1ae(0x13d);['description']=a44_0x2ab1ae(0x1b8);async['execute'](_0x509cf0){const _0x5d3bcb=a44_0x2ab1ae,{options:_0x4ffad1,args:_0x448938,tdx:_0x2c9d97}=_0x509cf0,_0x1078e3=_0x448938[0x0],_0x37a246=_0x448938[0x1]||'.';if(!_0x1078e3)return console['error'](_0x5d3bcb(0x16c)),console[_0x5d3bcb(0x151)](_0x5d3bcb(0x11f)),0x1;const _0x11c3dd=_0x4ffad1[_0x5d3bcb(0x154)];_0x4ffad1['verbose']&&(console['error'](_0x5d3bcb(0x178)+_0x1078e3),console[_0x5d3bcb(0x151)](_0x5d3bcb(0x176)+_0x37a246),_0x11c3dd&&console[_0x5d3bcb(0x151)](_0x5d3bcb(0x1a5)+_0x11c3dd));const _0x3ded45=await withSpinner(_0x5d3bcb(0x125)+_0x1078e3+_0x5d3bcb(0x155),()=>_0x2c9d97[_0x5d3bcb(0x159)]['download'](_0x1078e3,_0x37a246,{'revision':_0x11c3dd}),{'verbose':_0x4ffad1[_0x5d3bcb(0x1bc)]}),_0x4d2afd=_0x3ded45[_0x5d3bcb(0x136)];return console[_0x5d3bcb(0x151)](_0x5d3bcb(0x120)+_0x4d2afd[_0x5d3bcb(0x167)]),console['error'](_0x5d3bcb(0x157)+_0x4d2afd[_0x5d3bcb(0x154)]),console[_0x5d3bcb(0x151)](_0x5d3bcb(0x1a0)+_0x4d2afd[_0x5d3bcb(0x124)]),console[_0x5d3bcb(0x151)](_0x5d3bcb(0x15f)+_0x37a246+'/'+_0x4d2afd[_0x5d3bcb(0x167)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{['name']=a44_0x2ab1ae(0x12f);[a44_0x2ab1ae(0x148)]=a44_0x2ab1ae(0x181);async[a44_0x2ab1ae(0x12e)](_0x42475c){const _0x1346a4=a44_0x2ab1ae,{options:_0x5c442c,args:_0x194676,tdx:_0x7e397e}=_0x42475c;let _0x1d5a0d='.',_0x316e6e=_0x5c442c[_0x1346a4(0x16d)];if(_0x194676[0x0]){const {promises:_0x13b6cd}=await import('fs');try{const _0x263067=await _0x13b6cd['stat'](_0x194676[0x0]);if(_0x263067['isDirectory']())_0x1d5a0d=_0x194676[0x0];else return console[_0x1346a4(0x151)]('Error:\x20'+_0x194676[0x0]+_0x1346a4(0x1ac)),0x1;}catch{_0x316e6e=_0x194676[0x0],_0x1d5a0d='.';}}const _0x11dbf6=_0x5c442c[_0x1346a4(0x154)],_0x236e8d=_0x5c442c[_0x1346a4(0x19a)];_0x5c442c[_0x1346a4(0x1bc)]&&(console[_0x1346a4(0x151)](_0x1346a4(0x1c1)+_0x1d5a0d),_0x316e6e&&console['error'](_0x1346a4(0x1a1)+_0x316e6e),_0x11dbf6&&console['error'](_0x1346a4(0x1a5)+_0x11dbf6),_0x236e8d&&console[_0x1346a4(0x151)](_0x1346a4(0x144)));const _0x390bfd=await withSpinner(_0x1346a4(0x18f),()=>_0x7e397e[_0x1346a4(0x159)][_0x1346a4(0x153)](_0x1d5a0d,{'projectName':_0x316e6e,'revision':_0x11dbf6,'skipValidation':_0x236e8d}),{'verbose':_0x5c442c[_0x1346a4(0x1bc)]}),_0x4669fb=_0x390bfd['data'];return console[_0x1346a4(0x151)](_0x1346a4(0x1ad)+_0x4669fb[_0x1346a4(0x167)]),console['error'](_0x1346a4(0x198)+_0x4669fb[_0x1346a4(0x188)]),console[_0x1346a4(0x151)]('\x20\x20Revision:\x20'+_0x4669fb[_0x1346a4(0x154)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a44_0x2ab1ae(0x16d)]=a44_0x2ab1ae(0x1b7);[a44_0x2ab1ae(0x148)]=a44_0x2ab1ae(0x150);async[a44_0x2ab1ae(0x12e)](_0x5dc34a){const _0x2e487d=a44_0x2ab1ae,{options:_0x48f66d,args:_0x15edaf,tdx:_0x5764fd}=_0x5dc34a,_0x321922=_0x15edaf[0x0];if(!_0x321922)return console[_0x2e487d(0x151)](_0x2e487d(0x171)),console[_0x2e487d(0x151)](_0x2e487d(0x145)),0x1;_0x48f66d[_0x2e487d(0x1bc)]&&console[_0x2e487d(0x151)]('Project:\x20'+_0x321922);if(!_0x48f66d['yes']){const _0x7021b6=await confirm(_0x2e487d(0x156)+_0x321922+_0x2e487d(0x127));if(!_0x7021b6)return console[_0x2e487d(0x151)](_0x2e487d(0x147)),0x0;}const _0x79b57e=await withSpinner(_0x2e487d(0x140)+_0x321922+_0x2e487d(0x155),()=>_0x5764fd[_0x2e487d(0x159)][_0x2e487d(0x1bb)](_0x321922),{'verbose':_0x48f66d[_0x2e487d(0x1bc)]}),_0x41ce5c=_0x79b57e[_0x2e487d(0x136)];return console[_0x2e487d(0x151)](_0x2e487d(0x14f)+_0x41ce5c[_0x2e487d(0x167)]),console[_0x2e487d(0x151)](_0x2e487d(0x198)+_0x41ce5c[_0x2e487d(0x188)]),0x0;}}
|
package/dist/core/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x2a839f,_0x38e3ef){const _0x239d7b=a45_0x27de,_0x292497=_0x2a839f();while(!![]){try{const _0x338bb4=-parseInt(_0x239d7b(0xc6))/0x1+-parseInt(_0x239d7b(0xc0))/0x2*(-parseInt(_0x239d7b(0xc1))/0x3)+parseInt(_0x239d7b(0xb7))/0x4+-parseInt(_0x239d7b(0xc7))/0x5*(parseInt(_0x239d7b(0xb8))/0x6)+-parseInt(_0x239d7b(0xc2))/0x7+-parseInt(_0x239d7b(0xc3))/0x8*(parseInt(_0x239d7b(0xbb))/0x9)+parseInt(_0x239d7b(0xb5))/0xa*(parseInt(_0x239d7b(0xbc))/0xb);if(_0x338bb4===_0x38e3ef)break;else _0x292497['push'](_0x292497['shift']());}catch(_0x102c23){_0x292497['push'](_0x292497['shift']());}}}(a45_0x17b2,0x6620f));function a45_0x17b2(){const _0x4929b4=['entries','832204dqEJKC','24WLIZew','replace','version','5918949xSsRAD','352mQqlFL','0.0.0','parse','Authorization','6neoUtV','836409mLDRJC','3287788PRODaT','8DEVTWN','utf-8','../../package.json','521200dHZBST','903635dTSHAg','tdx','545410MqCJHs'];a45_0x17b2=function(){return _0x4929b4;};return a45_0x17b2();}import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x3b0326=a45_0x27de;try{const _0x1faff4=fileURLToPath(import.meta.url),_0x589ac8=dirname(_0x1faff4),_0x3a7b64=join(_0x589ac8,_0x3b0326(0xc5)),_0x517b6f=JSON[_0x3b0326(0xbe)](readFileSync(_0x3a7b64,_0x3b0326(0xc4)));return _0x517b6f['version'];}catch{return _0x3b0326(0xbd);}}export function getUserAgent(){const _0x206b92=a45_0x27de,_0x406ae0=getVersion(),_0xf9ccc7=platform(),_0x3e3f68=process[_0x206b92(0xba)][_0x206b92(0xb9)]('v','');return'tdx/'+_0x406ae0+'\x20('+_0xf9ccc7+';\x20node/'+_0x3e3f68+')';}export function getAuthHeaders(_0x70552b,_0x21eb73){const _0x136f53=a45_0x27de,_0x16ae2c=getVersion(),_0x4e3309={'User-Agent':getUserAgent(),'X-TD-Client':_0x136f53(0xc8),'X-TD-Client-Version':_0x16ae2c};return _0x21eb73&&(_0x4e3309['Authorization']='TD1\x20'+_0x21eb73),_0x4e3309;}export function toHeaderRecord(_0x283069){const _0x3170f0=a45_0x27de,_0x4cbea4={};for(const [_0x113038,_0x384c77]of Object[_0x3170f0(0xb6)](_0x283069)){_0x384c77!==undefined&&(_0x4cbea4[_0x113038]=_0x384c77);}return _0x4cbea4;}export function getTrinoHeaders(_0x16b55d,_0x28df50){const _0x12d46a=a45_0x27de,_0x587279=getAuthHeaders(_0x16b55d,_0x28df50),_0xc4e70=toHeaderRecord(_0x587279);return delete _0xc4e70[_0x12d46a(0xbf)],_0x28df50&&(_0xc4e70['X-Trino-User']=_0x28df50),_0xc4e70;}function a45_0x27de(_0x330506,_0x5b933a){_0x330506=_0x330506-0xb5;const _0x17b2d6=a45_0x17b2();let _0x27def5=_0x17b2d6[_0x330506];return _0x27def5;}export function hasAPIKey(_0x41219c){const _0x1fb709=getAPIKey(_0x41219c);return _0x1fb709!==undefined&&_0x1fb709['length']>0x0;}
|
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x24938e,_0x6434b2){const _0x216a23=a46_0xab65,_0x31ea4d=_0x24938e();while(!![]){try{const _0x49af49=-parseInt(_0x216a23(0xea))/0x1+-parseInt(_0x216a23(0xf6))/0x2*(parseInt(_0x216a23(0x107))/0x3)+-parseInt(_0x216a23(0xc9))/0x4+-parseInt(_0x216a23(0xc5))/0x5+-parseInt(_0x216a23(0xfc))/0x6+parseInt(_0x216a23(0xca))/0x7*(parseInt(_0x216a23(0xfb))/0x8)+-parseInt(_0x216a23(0xe9))/0x9*(-parseInt(_0x216a23(0xc4))/0xa);if(_0x49af49===_0x6434b2)break;else _0x31ea4d['push'](_0x31ea4d['shift']());}catch(_0x4545ac){_0x31ea4d['push'](_0x31ea4d['shift']());}}}(a46_0x5c57,0xe8cf6));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a46_0x43163b from'node:fs';import*as a46_0x36b25d from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';function a46_0x5c57(){const _0x569fb4=['env','account_info.json','some','trim','replace','28085830pCexMa','2867670bGCVgL','ap02','readFileSync','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','2877836CFHmXq','10563QAbAns','split','TD_API_KEY_','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','legacy\x20.env\x20file\x20(profile:\x20','keychain\x20(profile:\x20','keychain','toISOString','warn','toUpperCase','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','filter','entries','parse','account_info.','apiKey','join','.env','site','profiles','eu01','dev-us01','.env.','yellow','match','\x20env\x20var','slice','map','llm_default_project.','Warning:\x20Failed\x20to\x20load\x20','profile','9iAVoqS','1009189AIHsRq','llm_default_agent','us01','TDX_API_KEY','stg-jp01','startsWith','jp01','includes','ap03','TDX_CONFIG_DIR','projectId','Warning:\x20Unknown\x20site\x20\x27','1250xKkbPw','tdx','llm_default_project','stg-ap03','stringify','7808buJMHi','2354820xFoDjC','.cache','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','source','Warning:\x20Failed\x20to\x20read\x20','stg-us01','endsWith','TD_API_KEY','tdx.json','TDX_API_KEY_','utf-8','3039IuJbYp','llm_default_agent.','\x27,\x20defaulting\x20to\x20us01','string','existsSync','legacy\x20.env\x20file','isDeprecated','.json','number'];a46_0x5c57=function(){return _0x569fb4;};return a46_0x5c57();}import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a46_0x517804 from'chalk';export function getConfigDir(){const _0x98f778=a46_0xab65;return process[_0x98f778(0xbf)][_0x98f778(0xf3)]||join(homedir(),'.config','tdx');}export function getConfigFile(){const _0x53c0dc=a46_0xab65;return join(getConfigDir(),_0x53c0dc(0xdb));}export function getConfigFilePath(_0x5b5ec3){const _0x304b65=a46_0xab65,_0x5cc7f5=getConfigDir();return _0x5b5ec3?a46_0x36b25d[_0x304b65(0xda)](_0x5cc7f5,_0x304b65(0xe0)+_0x5b5ec3):getConfigFile();}export function getCacheDir(){const _0x3eb4ca=a46_0xab65;return process['env']['TDX_CACHE_DIR']||join(homedir(),_0x3eb4ca(0xfd),_0x3eb4ca(0xf7));}export function getLLMProjectCacheFile(_0x1ea230){const _0x2beae2=a46_0xab65,_0x550a0b=_0x1ea230?_0x2beae2(0xe6)+_0x1ea230:_0x2beae2(0xf8);return join(getCacheDir(),_0x550a0b);}export function readCachedLLMProject(_0x2346f6){const _0x23b47d=a46_0xab65;try{const _0x56ec6c=getLLMProjectCacheFile(_0x2346f6);if(!existsSync(_0x56ec6c))return null;const _0x3b2833=readFileSync(_0x56ec6c,'utf-8')['trim']();try{const _0x48bb49=JSON['parse'](_0x3b2833);if(_0x48bb49&&typeof _0x48bb49['id']===_0x23b47d(0x10a)&&typeof _0x48bb49['name']==='string')return _0x48bb49;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x596c10,_0x514dd0,_0x52a4ff){const _0x22a743=a46_0xab65;try{const _0x4e986c=getCacheDir(),_0x2e3893=getLLMProjectCacheFile(_0x52a4ff);!existsSync(_0x4e986c)&&mkdirSync(_0x4e986c,{'recursive':!![]});const _0x5d9d82={'name':_0x596c10,'id':_0x514dd0};writeFileSync(_0x2e3893,JSON[_0x22a743(0xfa)](_0x5d9d82),_0x22a743(0x106));}catch{}}export function getLLMAgentCacheFile(_0x3e2065){const _0x23736b=a46_0xab65,_0xa024b2=_0x3e2065?_0x23736b(0x108)+_0x3e2065:_0x23736b(0xeb);return join(getCacheDir(),_0xa024b2);}export function readCachedLLMAgent(_0x55cf1f){const _0x4164f8=a46_0xab65;try{const _0x260d23=getLLMAgentCacheFile(_0x55cf1f);if(!existsSync(_0x260d23))return null;const _0x2a5ec1=readFileSync(_0x260d23,'utf-8')[_0x4164f8(0xc2)]();try{const _0x2b8205=JSON[_0x4164f8(0xd7)](_0x2a5ec1);if(_0x2b8205&&typeof _0x2b8205['id']==='string'&&typeof _0x2b8205['name']===_0x4164f8(0x10a)&&typeof _0x2b8205[_0x4164f8(0xf4)]===_0x4164f8(0x10a))return _0x2b8205;}catch{}return null;}catch{return null;}}export function writeCachedLLMAgent(_0x4de545,_0x21c4f6,_0x5eb5a8,_0x14fa85){const _0x152e78=a46_0xab65;try{const _0x1057c4=getCacheDir(),_0x4ce514=getLLMAgentCacheFile(_0x14fa85);!existsSync(_0x1057c4)&&mkdirSync(_0x1057c4,{'recursive':!![]});const _0xa40750={'name':_0x4de545,'id':_0x21c4f6,'projectId':_0x5eb5a8};writeFileSync(_0x4ce514,JSON['stringify'](_0xa40750),_0x152e78(0x106));}catch{}}export function clearCachedLLMAgent(_0x5c8d55){try{const _0x1c7a8e=getLLMAgentCacheFile(_0x5c8d55);existsSync(_0x1c7a8e)&&unlinkSync(_0x1c7a8e);}catch{}}export function getAccountInfoCacheFile(_0x405ae9){const _0xb5a210=a46_0xab65,_0x52baa8=_0x405ae9?_0xb5a210(0xd8)+_0x405ae9+_0xb5a210(0x10e):_0xb5a210(0xc0);return join(getCacheDir(),_0x52baa8);}export function readCachedAccountInfo(_0x73c302){const _0x2109ee=a46_0xab65;try{const _0xc26e2d=getAccountInfoCacheFile(_0x73c302);if(!existsSync(_0xc26e2d))return null;const _0x511712=readFileSync(_0xc26e2d,'utf-8')[_0x2109ee(0xc2)](),_0x5b866a=JSON[_0x2109ee(0xd7)](_0x511712);if(_0x5b866a&&typeof _0x5b866a[_0x2109ee(0xdc)]===_0x2109ee(0x10a)&&typeof _0x5b866a['accountId']===_0x2109ee(0x10f))return _0x5b866a;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x3e4de5,_0x254cd3,_0x4bf2d5){const _0x4c413f=a46_0xab65;try{const _0x59e5b9=getCacheDir(),_0x25e1b8=getAccountInfoCacheFile(_0x4bf2d5);!existsSync(_0x59e5b9)&&mkdirSync(_0x59e5b9,{'recursive':!![]});const _0xfdbc1a={'site':_0x3e4de5,'accountId':_0x254cd3,'cachedAt':new Date()[_0x4c413f(0xd1)]()};writeFileSync(_0x25e1b8,JSON[_0x4c413f(0xfa)](_0xfdbc1a),'utf-8');}catch{}}export function parseEnvFile(_0x5dfdf8){const _0x44654d=a46_0xab65,_0x1da87f={};for(const _0x22efb8 of _0x5dfdf8['split']('\x0a')){const _0x3e3828=_0x22efb8[_0x44654d(0xc2)]();if(!_0x3e3828||_0x3e3828['startsWith']('#'))continue;const _0x62d246=_0x3e3828[_0x44654d(0xe2)](/^([^=]+)=(.*)$/);if(_0x62d246){const _0x3c1563=_0x62d246[0x1][_0x44654d(0xc2)]();let _0x3a8af4=_0x62d246[0x2]['trim']();(_0x3a8af4[_0x44654d(0xef)]('\x22')&&_0x3a8af4['endsWith']('\x22')||_0x3a8af4['startsWith']('\x27')&&_0x3a8af4[_0x44654d(0x102)]('\x27'))&&(_0x3a8af4=_0x3a8af4[_0x44654d(0xe4)](0x1,-0x1)),_0x1da87f[_0x3c1563]=_0x3a8af4;}}return _0x1da87f;}export function readUserConfig(){const _0x1f3d04=a46_0xab65,_0x459fff=getConfigFile();if(!existsSync(_0x459fff))return{};try{const _0x361799=readFileSync(_0x459fff,'utf-8');return parseEnvFile(_0x361799);}catch(_0x52a46d){return console[_0x1f3d04(0xd2)](_0x1f3d04(0xc8)+_0x459fff+':',_0x52a46d),{};}}export function resolveSite(_0x585389){const _0x34ff85=a46_0xab65,_0x58a309=[_0x34ff85(0xec),_0x34ff85(0xf0),_0x34ff85(0xde),_0x34ff85(0xc6),_0x34ff85(0xf2),_0x34ff85(0xdf),'dev-eu01',_0x34ff85(0x101),_0x34ff85(0xee),'stg-ap03'];if(_0x58a309[_0x34ff85(0xf1)](_0x585389))return _0x585389;if(_0x585389 in SITE_ALIASES)return SITE_ALIASES[_0x585389];return console[_0x34ff85(0xd2)](_0x34ff85(0xf5)+_0x585389+_0x34ff85(0x109)),_0x34ff85(0xec);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x2f83e8,_0x4ba6a5){const _0x248dcb=a46_0xab65,_0x20d45e=_0x4ba6a5||getActiveProfileName();if(_0x20d45e){const _0x15338b='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x20d45e);if(process['env'][_0x15338b])return process[_0x248dcb(0xbf)][_0x15338b];}if(process[_0x248dcb(0xbf)][_0x248dcb(0xed)])return process['env'][_0x248dcb(0xed)];if(process[_0x248dcb(0xbf)][_0x248dcb(0x103)])return process[_0x248dcb(0xbf)][_0x248dcb(0x103)];const _0x4b2326=_0x2f83e8[_0x248dcb(0xd3)]()[_0x248dcb(0xc3)](/-/g,'_'),_0x498f97=_0x248dcb(0xcc)+_0x4b2326;if(_0x20d45e){const _0x2fc2d8=loadProfileEnv(_0x20d45e);if(_0x2fc2d8){if(_0x2fc2d8[_0x498f97])return _0x2fc2d8[_0x498f97];if(_0x2fc2d8[_0x248dcb(0x103)])return _0x2fc2d8['TD_API_KEY'];}}const _0x437d32=loadUserConfigOnce();if(_0x437d32[_0x498f97])return _0x437d32[_0x498f97];if(_0x437d32[_0x248dcb(0x103)])return _0x437d32[_0x248dcb(0x103)];return undefined;}export function normalizeProfileForEnvVar(_0x23f7c0){const _0x4e1cd8=a46_0xab65;return _0x23f7c0['toUpperCase']()[_0x4e1cd8(0xc3)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x4460a0,_0x49b95d){const _0x449ee7=a46_0xab65,_0x29ccf5=_0x49b95d||getActiveProfileName()||undefined;if(_0x29ccf5){const _0x550816=_0x449ee7(0x105)+normalizeProfileForEnvVar(_0x29ccf5);if(process[_0x449ee7(0xbf)][_0x550816])return{'apiKey':process[_0x449ee7(0xbf)][_0x550816],'source':_0x550816+_0x449ee7(0xe3),'isDeprecated':![]};const _0x346294=getCachedCredential(_0x4460a0,_0x29ccf5);if(_0x346294)return{'apiKey':_0x346294,'source':_0x449ee7(0xcf)+_0x29ccf5+')','isDeprecated':![]};const _0x2bdb4d=await getKeychainAPIKey(_0x29ccf5);if(_0x2bdb4d)return setCachedCredential(_0x2bdb4d,_0x4460a0,_0x29ccf5),{'apiKey':_0x2bdb4d,'source':_0x449ee7(0xcf)+_0x29ccf5+')','isDeprecated':![]};}if(process[_0x449ee7(0xbf)][_0x449ee7(0xed)])return{'apiKey':process[_0x449ee7(0xbf)][_0x449ee7(0xed)],'source':'TDX_API_KEY\x20env\x20var','isDeprecated':![]};if(!_0x29ccf5){const _0x381523=getCachedCredential(_0x4460a0,undefined);if(_0x381523)return{'apiKey':_0x381523,'source':_0x449ee7(0xd0),'isDeprecated':![]};const _0x393cd3=await getKeychainAPIKey(undefined);if(_0x393cd3)return setCachedCredential(_0x393cd3,_0x4460a0,undefined),{'apiKey':_0x393cd3,'source':_0x449ee7(0xd0),'isDeprecated':![]};}if(process[_0x449ee7(0xbf)]['TD_API_KEY'])return{'apiKey':process[_0x449ee7(0xbf)][_0x449ee7(0x103)],'source':'TD_API_KEY\x20env\x20var\x20(deprecated)','isDeprecated':!![]};const _0x35013c=getLegacyEnvAPIKey(_0x4460a0,_0x29ccf5);if(_0x35013c){const _0xe5274e=await isKeychainAvailable();if(_0xe5274e)try{await saveKeychainAPIKey(_0x35013c,_0x29ccf5),setCachedCredential(_0x35013c,_0x4460a0,_0x29ccf5);const _0x57253f=getConfigFilePath(_0x29ccf5);cleanupLegacyEnvFile(_0x57253f)&&console[_0x449ee7(0xd2)](a46_0x517804[_0x449ee7(0xe1)]('⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage'));}catch(_0x5dd7db){console[_0x449ee7(0xd2)](a46_0x517804[_0x449ee7(0xe1)](_0x449ee7(0xcd)+_0x5dd7db));}const _0x402f2a=_0x29ccf5?_0x449ee7(0xce)+_0x29ccf5+')':_0x449ee7(0x10c);return{'apiKey':_0x35013c,'source':_0x402f2a,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x558591,_0x1313ab,_0x48a576=!![]){const _0x3e6448=a46_0xab65,_0x43cde9=await resolveAPIKeyAsync(_0x558591,_0x1313ab);if(!_0x43cde9)return undefined;if(_0x48a576&&_0x43cde9[_0x3e6448(0x10d)]&&_0x43cde9[_0x3e6448(0xff)][_0x3e6448(0xf1)]('TD_API_KEY')){const _0x3862ec=_0x1313ab||getActiveProfileName()||undefined,_0x54647b=_0x3862ec?_0x3e6448(0x105)+normalizeProfileForEnvVar(_0x3862ec):'TDX_API_KEY_<PROFILE>';console[_0x3e6448(0xd2)](a46_0x517804[_0x3e6448(0xe1)](_0x3e6448(0xfe)+('\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20'+_0x54647b+').')));}return _0x43cde9[_0x3e6448(0xd9)];}function getLegacyEnvAPIKey(_0x4ca193,_0x4a122e){const _0x435f3a=a46_0xab65,_0x3d211c=_0x4ca193['toUpperCase']()[_0x435f3a(0xc3)](/-/g,'_'),_0xffe9e0='TD_API_KEY_'+_0x3d211c;if(_0x4a122e){const _0x387814=loadProfileEnv(_0x4a122e);if(_0x387814){if(_0x387814[_0xffe9e0])return _0x387814[_0xffe9e0];if(_0x387814['TD_API_KEY'])return _0x387814['TD_API_KEY'];}}const _0x3eebd3=loadUserConfigOnce();if(_0x3eebd3[_0xffe9e0])return _0x3eebd3[_0xffe9e0];if(_0x3eebd3[_0x435f3a(0x103)])return _0x3eebd3[_0x435f3a(0x103)];return undefined;}function cleanupLegacyEnvFile(_0x570d13){const _0x2f2b2f=a46_0xab65;if(!existsSync(_0x570d13))return![];try{const _0x31b443=readFileSync(_0x570d13,_0x2f2b2f(0x106)),_0x470d3f=_0x31b443[_0x2f2b2f(0xcb)]('\x0a'),_0x263b1d=_0x470d3f[_0x2f2b2f(0xd5)](_0x54abf9=>{const _0x1004e3=_0x2f2b2f,_0x12ba3e=_0x54abf9['trim']();if(!_0x12ba3e||_0x12ba3e[_0x1004e3(0xef)]('#'))return!![];const [_0x113a0c]=_0x12ba3e[_0x1004e3(0xcb)]('=');return!_0x113a0c['startsWith'](_0x1004e3(0x103));}),_0x315d2d=_0x263b1d[_0x2f2b2f(0xc1)](_0x258de2=>{const _0x2e80f1=_0x2f2b2f,_0x55eb4f=_0x258de2[_0x2e80f1(0xc2)]();return _0x55eb4f&&!_0x55eb4f['startsWith']('#');});if(!_0x315d2d)return unlinkSync(_0x570d13),!![];return writeFileSync(_0x570d13,_0x263b1d['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x503e9b){const _0xa25bbd=a46_0xab65,_0x5790f1=a46_0x36b25d[_0xa25bbd(0xda)](getConfigDir(),_0xa25bbd(0xe0)+_0x503e9b);if(a46_0x43163b['existsSync'](_0x5790f1)){validateSecureFilePermissions(_0x5790f1);try{const _0x18198d=a46_0x43163b[_0xa25bbd(0xc7)](_0x5790f1,_0xa25bbd(0x106));return parseEnvFile(_0x18198d);}catch(_0x20323e){console['warn'](_0xa25bbd(0xe7)+_0x5790f1+':\x20'+_0x20323e);}}const _0x276b71=a46_0x36b25d[_0xa25bbd(0xda)](getConfigDir(),_0xa25bbd(0xdd),_0x503e9b,_0xa25bbd(0xdb));if(a46_0x43163b[_0xa25bbd(0x10b)](_0x276b71)){validateSecureFilePermissions(_0x276b71);try{const _0x3d6018=a46_0x43163b['readFileSync'](_0x276b71,_0xa25bbd(0x106));return parseEnvFile(_0x3d6018);}catch(_0x147fde){return console[_0xa25bbd(0xd2)](_0xa25bbd(0xe7)+_0x276b71+':\x20'+_0x147fde),null;}}return null;}function getActiveProfileName(){const _0x3e0582=a46_0xab65,_0x4c79fa=a46_0x36b25d[_0x3e0582(0xda)](getConfigDir(),_0x3e0582(0x104));if(!a46_0x43163b['existsSync'](_0x4c79fa))return null;try{const _0x23466f=a46_0x43163b['readFileSync'](_0x4c79fa,_0x3e0582(0x106)),_0x5bf7bd=JSON[_0x3e0582(0xd7)](_0x23466f);return _0x5bf7bd[_0x3e0582(0xe8)]||null;}catch{return null;}}export function saveAPIKey(_0x4dcb,_0xe90d77,_0x340d8e){const _0x14ca68=a46_0xab65,_0x30498c=getConfigDir(),_0x1b4db5=getConfigFilePath(_0x340d8e);!existsSync(_0x30498c)&&mkdirSync(_0x30498c,{'recursive':!![],'mode':0x1c0});let _0x3c9605={};if(existsSync(_0x1b4db5))try{const _0x6186e7=readFileSync(_0x1b4db5,'utf-8');_0x3c9605=parseEnvFile(_0x6186e7);}catch(_0xf93c81){console[_0x14ca68(0xd2)](_0x14ca68(0x100)+_0x1b4db5+':',_0xf93c81);}const _0xa53132=_0x4dcb[_0x14ca68(0xd3)]()[_0x14ca68(0xc3)](/-/g,'_');_0x3c9605[_0x14ca68(0xcc)+_0xa53132]=_0xe90d77;const _0x1bca46=Object[_0x14ca68(0xd6)](_0x3c9605)[_0x14ca68(0xe5)](([_0x77cad8,_0x3fa959])=>_0x77cad8+'='+_0x3fa959);writeFileSync(_0x1b4db5,_0x1bca46['join']('\x0a')+'\x0a',{'mode':0x180});}function a46_0xab65(_0x5b18c5,_0x59b94b){_0x5b18c5=_0x5b18c5-0xbf;const _0x5c57bb=a46_0x5c57();let _0xab6555=_0x5c57bb[_0x5b18c5];return _0xab6555;}export async function saveAPIKeyAsync(_0x7631a1,_0x29b015,_0x5edf98){const _0x3dcd4b=a46_0xab65;await saveKeychainAPIKey(_0x7631a1,_0x5edf98),setCachedCredential(_0x7631a1,_0x29b015,_0x5edf98);const _0x16bd0b=getConfigFilePath(_0x5edf98);cleanupLegacyEnvFile(_0x16bd0b)&&console[_0x3dcd4b(0xd2)](a46_0x517804[_0x3dcd4b(0xe1)](_0x3dcd4b(0xd4)));}export function loadConfig(){const _0x5f08f2=a46_0xab65,_0x257491={'apiKeys':{},'defaultSite':_0x5f08f2(0xec)},_0x58a731=[_0x5f08f2(0xec),_0x5f08f2(0xf0),_0x5f08f2(0xde),_0x5f08f2(0xc6),'ap03',_0x5f08f2(0xdf),'dev-eu01',_0x5f08f2(0x101),_0x5f08f2(0xee),_0x5f08f2(0xf9)];for(const _0x43df5e of _0x58a731){const _0x17c652=getAPIKey(_0x43df5e);_0x17c652&&(_0x257491['apiKeys'][_0x43df5e]=_0x17c652);}return _0x257491;}
|
|
1
|
+
(function(_0x2a4c93,_0x19bc72){const _0x472cbd=a46_0x5cf5,_0x4f88b0=_0x2a4c93();while(!![]){try{const _0xd2bd86=-parseInt(_0x472cbd(0x1bb))/0x1*(-parseInt(_0x472cbd(0x18c))/0x2)+parseInt(_0x472cbd(0x1b5))/0x3+-parseInt(_0x472cbd(0x187))/0x4*(parseInt(_0x472cbd(0x1ad))/0x5)+-parseInt(_0x472cbd(0x179))/0x6*(parseInt(_0x472cbd(0x197))/0x7)+parseInt(_0x472cbd(0x199))/0x8+parseInt(_0x472cbd(0x1a0))/0x9+parseInt(_0x472cbd(0x1a4))/0xa;if(_0xd2bd86===_0x19bc72)break;else _0x4f88b0['push'](_0x4f88b0['shift']());}catch(_0x27143d){_0x4f88b0['push'](_0x4f88b0['shift']());}}}(a46_0x4ac6,0xb430d));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a46_0x321104 from'node:fs';import*as a46_0x1e6474 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 a46_0x35519b from'chalk';export function getConfigDir(){const _0x3d5a77=a46_0x5cf5;return process[_0x3d5a77(0x193)][_0x3d5a77(0x196)]||join(homedir(),_0x3d5a77(0x1a8),_0x3d5a77(0x1bd));}function a46_0x5cf5(_0x9c15c3,_0xf0e446){_0x9c15c3=_0x9c15c3-0x177;const _0x4ac68c=a46_0x4ac6();let _0x5cf571=_0x4ac68c[_0x9c15c3];return _0x5cf571;}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x3f378){const _0x247388=a46_0x5cf5,_0x1186b2=getConfigDir();return _0x3f378?a46_0x1e6474[_0x247388(0x19b)](_0x1186b2,_0x247388(0x1bc)+_0x3f378):getConfigFile();}export function getCacheDir(){const _0x8cfea8=a46_0x5cf5;return process[_0x8cfea8(0x193)][_0x8cfea8(0x198)]||join(homedir(),_0x8cfea8(0x1ae),_0x8cfea8(0x1bd));}export function getLLMProjectCacheFile(_0x137afb){const _0x2b15ef=a46_0x5cf5,_0x36593f=_0x137afb?_0x2b15ef(0x1a7)+_0x137afb:_0x2b15ef(0x1c4);return join(getCacheDir(),_0x36593f);}export function readCachedLLMProject(_0x2ef94c){const _0x1bde23=a46_0x5cf5;try{const _0x2bf43f=getLLMProjectCacheFile(_0x2ef94c);if(!existsSync(_0x2bf43f))return null;const _0x402733=readFileSync(_0x2bf43f,_0x1bde23(0x1aa))[_0x1bde23(0x1c2)]();try{const _0x309c75=JSON[_0x1bde23(0x19f)](_0x402733);if(_0x309c75&&typeof _0x309c75['id']===_0x1bde23(0x1b6)&&typeof _0x309c75['name']===_0x1bde23(0x1b6))return _0x309c75;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x33218d,_0x4ac3da,_0x247386){try{const _0x29842a=getCacheDir(),_0x39a9aa=getLLMProjectCacheFile(_0x247386);!existsSync(_0x29842a)&&mkdirSync(_0x29842a,{'recursive':!![]});const _0x15979f={'name':_0x33218d,'id':_0x4ac3da};writeFileSync(_0x39a9aa,JSON['stringify'](_0x15979f),'utf-8');}catch{}}export function getLLMAgentCacheFile(_0x2c25fe){const _0x1345b8=a46_0x5cf5,_0x516e30=_0x2c25fe?_0x1345b8(0x19d)+_0x2c25fe:_0x1345b8(0x1ca);return join(getCacheDir(),_0x516e30);}export function readCachedLLMAgent(_0x268567){const _0x5d02d9=a46_0x5cf5;try{const _0x239bde=getLLMAgentCacheFile(_0x268567);if(!existsSync(_0x239bde))return null;const _0x1d71e7=readFileSync(_0x239bde,_0x5d02d9(0x1aa))['trim']();try{const _0x1bfea9=JSON[_0x5d02d9(0x19f)](_0x1d71e7);if(_0x1bfea9&&typeof _0x1bfea9['id']==='string'&&typeof _0x1bfea9[_0x5d02d9(0x184)]===_0x5d02d9(0x1b6)&&typeof _0x1bfea9[_0x5d02d9(0x1c7)]===_0x5d02d9(0x1b6))return _0x1bfea9;}catch{}return null;}catch{return null;}}export function writeCachedLLMAgent(_0x5ab531,_0xbc4ad2,_0x5f6d41,_0xbbb95e){const _0x14d79e=a46_0x5cf5;try{const _0x6a414d=getCacheDir(),_0x2db06b=getLLMAgentCacheFile(_0xbbb95e);!existsSync(_0x6a414d)&&mkdirSync(_0x6a414d,{'recursive':!![]});const _0x5a9411={'name':_0x5ab531,'id':_0xbc4ad2,'projectId':_0x5f6d41};writeFileSync(_0x2db06b,JSON[_0x14d79e(0x183)](_0x5a9411),_0x14d79e(0x1aa));}catch{}}export function clearCachedLLMAgent(_0x306952){try{const _0x1cb98b=getLLMAgentCacheFile(_0x306952);existsSync(_0x1cb98b)&&unlinkSync(_0x1cb98b);}catch{}}export function getAccountInfoCacheFile(_0x45f74e){const _0x33622f=a46_0x5cf5,_0x22ee6f=_0x45f74e?'account_info.'+_0x45f74e+_0x33622f(0x18d):_0x33622f(0x1b7);return join(getCacheDir(),_0x22ee6f);}export function readCachedAccountInfo(_0x4cea12){const _0x1e7cff=a46_0x5cf5;try{const _0xc64c3c=getAccountInfoCacheFile(_0x4cea12);if(!existsSync(_0xc64c3c))return null;const _0x641220=readFileSync(_0xc64c3c,_0x1e7cff(0x1aa))[_0x1e7cff(0x1c2)](),_0x315a37=JSON['parse'](_0x641220);if(_0x315a37&&typeof _0x315a37['site']===_0x1e7cff(0x1b6)&&typeof _0x315a37[_0x1e7cff(0x19c)]===_0x1e7cff(0x1c9))return _0x315a37;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x276dad,_0x352078,_0x328eae){const _0x34b703=a46_0x5cf5;try{const _0x4f5eff=getCacheDir(),_0x335b6a=getAccountInfoCacheFile(_0x328eae);!existsSync(_0x4f5eff)&&mkdirSync(_0x4f5eff,{'recursive':!![]});const _0x142dd1={'site':_0x276dad,'accountId':_0x352078,'cachedAt':new Date()[_0x34b703(0x1b8)]()};writeFileSync(_0x335b6a,JSON[_0x34b703(0x183)](_0x142dd1),_0x34b703(0x1aa));}catch{}}export function parseEnvFile(_0x355eee){const _0x353899=a46_0x5cf5,_0x54e2af={};for(const _0x68138a of _0x355eee[_0x353899(0x1c3)]('\x0a')){const _0x484c26=_0x68138a[_0x353899(0x1c2)]();if(!_0x484c26||_0x484c26[_0x353899(0x18f)]('#'))continue;const _0x5ea039=_0x484c26[_0x353899(0x194)](/^([^=]+)=(.*)$/);if(_0x5ea039){const _0x3e6b02=_0x5ea039[0x1][_0x353899(0x1c2)]();let _0x5c3b9b=_0x5ea039[0x2][_0x353899(0x1c2)]();(_0x5c3b9b['startsWith']('\x22')&&_0x5c3b9b[_0x353899(0x189)]('\x22')||_0x5c3b9b[_0x353899(0x18f)]('\x27')&&_0x5c3b9b[_0x353899(0x189)]('\x27'))&&(_0x5c3b9b=_0x5c3b9b[_0x353899(0x1b0)](0x1,-0x1)),_0x54e2af[_0x3e6b02]=_0x5c3b9b;}}return _0x54e2af;}export function readUserConfig(){const _0x537ec7=a46_0x5cf5,_0x1c83cb=getConfigFile();if(!existsSync(_0x1c83cb))return{};try{const _0x451b11=readFileSync(_0x1c83cb,_0x537ec7(0x1aa));return parseEnvFile(_0x451b11);}catch(_0x5da043){return console['warn'](_0x537ec7(0x192)+_0x1c83cb+':',_0x5da043),{};}}export function resolveSite(_0x35bba3){const _0xf3669b=a46_0x5cf5,_0x2b1738=['us01',_0xf3669b(0x1a3),'eu01',_0xf3669b(0x1a9),'ap03',_0xf3669b(0x18b),_0xf3669b(0x1af),_0xf3669b(0x177),_0xf3669b(0x180),_0xf3669b(0x1bf)];if(_0x2b1738[_0xf3669b(0x17e)](_0x35bba3))return _0x35bba3;if(_0x35bba3 in SITE_ALIASES)return SITE_ALIASES[_0x35bba3];return console['warn'](_0xf3669b(0x17b)+_0x35bba3+_0xf3669b(0x1c6)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}function a46_0x4ac6(){const _0x1ae610=['some','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','env','match','replace','TDX_CONFIG_DIR','119IbEqBU','TDX_CACHE_DIR','9105560WNvOQI','eu01','join','accountId','llm_default_agent.','profiles','parse','427347fqQhiO','.env','toUpperCase','jp01','7438040mjEaOM','TD_API_KEY\x20env\x20var\x20(deprecated)','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','llm_default_project.','.config','ap02','utf-8','TD_API_KEY','keychain','5VMncuS','.cache','dev-eu01','slice','existsSync','TD_API_KEY_','yellow','profile','1891068SCdMoc','string','account_info.json','toISOString','TDX_API_KEY\x20env\x20var','apiKey','33SShGna','.env.','tdx','readFileSync','stg-ap03','legacy\x20.env\x20file','map','trim','split','llm_default_project','keychain\x20(profile:\x20','\x27,\x20defaulting\x20to\x20us01','projectId','TDX_API_KEY_<PROFILE>','number','llm_default_agent','stg-us01','TDX_API_KEY','365268IaslBL','source','Warning:\x20Unknown\x20site\x20\x27','entries','legacy\x20.env\x20file\x20(profile:\x20','includes','us01','stg-jp01','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','isDeprecated','stringify','name','ap03','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','3164696fjgNxd','Warning:\x20Failed\x20to\x20load\x20','endsWith','warn','dev-us01','262NkcpoH','.json','TDX_API_KEY_','startsWith'];a46_0x4ac6=function(){return _0x1ae610;};return a46_0x4ac6();}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x1007bb,_0x1279d3){const _0x262ed7=a46_0x5cf5,_0x41f053=_0x1279d3||getActiveProfileName();if(_0x41f053){const _0x167ad0=_0x262ed7(0x18e)+normalizeProfileForEnvVar(_0x41f053);if(process[_0x262ed7(0x193)][_0x167ad0])return process['env'][_0x167ad0];}if(process[_0x262ed7(0x193)][_0x262ed7(0x178)])return process['env'][_0x262ed7(0x178)];if(process[_0x262ed7(0x193)][_0x262ed7(0x1ab)])return process[_0x262ed7(0x193)]['TD_API_KEY'];const _0x35788e=_0x1007bb[_0x262ed7(0x1a2)]()[_0x262ed7(0x195)](/-/g,'_'),_0x38e1a8=_0x262ed7(0x1b2)+_0x35788e;if(_0x41f053){const _0x10970c=loadProfileEnv(_0x41f053);if(_0x10970c){if(_0x10970c[_0x38e1a8])return _0x10970c[_0x38e1a8];if(_0x10970c[_0x262ed7(0x1ab)])return _0x10970c[_0x262ed7(0x1ab)];}}const _0x1899eb=loadUserConfigOnce();if(_0x1899eb[_0x38e1a8])return _0x1899eb[_0x38e1a8];if(_0x1899eb['TD_API_KEY'])return _0x1899eb['TD_API_KEY'];return undefined;}export function normalizeProfileForEnvVar(_0x168c96){const _0x954f02=a46_0x5cf5;return _0x168c96[_0x954f02(0x1a2)]()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x56514c,_0x51d597){const _0x447ae3=a46_0x5cf5,_0x58a4eb=_0x51d597||getActiveProfileName()||undefined;if(_0x58a4eb){const _0x2e2871=_0x447ae3(0x18e)+normalizeProfileForEnvVar(_0x58a4eb);if(process[_0x447ae3(0x193)][_0x2e2871])return{'apiKey':process[_0x447ae3(0x193)][_0x2e2871],'source':_0x2e2871+'\x20env\x20var','isDeprecated':![]};const _0x26a3ac=getCachedCredential(_0x56514c,_0x58a4eb);if(_0x26a3ac)return{'apiKey':_0x26a3ac,'source':_0x447ae3(0x1c5)+_0x58a4eb+')','isDeprecated':![]};const _0x1afefa=await getKeychainAPIKey(_0x58a4eb);if(_0x1afefa)return setCachedCredential(_0x1afefa,_0x56514c,_0x58a4eb),{'apiKey':_0x1afefa,'source':_0x447ae3(0x1c5)+_0x58a4eb+')','isDeprecated':![]};}if(process[_0x447ae3(0x193)][_0x447ae3(0x178)])return{'apiKey':process['env'][_0x447ae3(0x178)],'source':_0x447ae3(0x1b9),'isDeprecated':![]};if(!_0x58a4eb){const _0x4436ab=getCachedCredential(_0x56514c,undefined);if(_0x4436ab)return{'apiKey':_0x4436ab,'source':_0x447ae3(0x1ac),'isDeprecated':![]};const _0x28e192=await getKeychainAPIKey(undefined);if(_0x28e192)return setCachedCredential(_0x28e192,_0x56514c,undefined),{'apiKey':_0x28e192,'source':_0x447ae3(0x1ac),'isDeprecated':![]};}if(process[_0x447ae3(0x193)][_0x447ae3(0x1ab)])return{'apiKey':process[_0x447ae3(0x193)][_0x447ae3(0x1ab)],'source':_0x447ae3(0x1a5),'isDeprecated':!![]};const _0xeba120=getLegacyEnvAPIKey(_0x56514c,_0x58a4eb);if(_0xeba120){const _0x1b8cd3=await isKeychainAvailable();if(_0x1b8cd3)try{await saveKeychainAPIKey(_0xeba120,_0x58a4eb),setCachedCredential(_0xeba120,_0x56514c,_0x58a4eb);const _0xc4085b=getConfigFilePath(_0x58a4eb);cleanupLegacyEnvFile(_0xc4085b)&&console[_0x447ae3(0x18a)](a46_0x35519b[_0x447ae3(0x1b3)]('⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage'));}catch(_0x296e24){console['warn'](a46_0x35519b[_0x447ae3(0x1b3)](_0x447ae3(0x181)+_0x296e24));}const _0x594bbf=_0x58a4eb?_0x447ae3(0x17d)+_0x58a4eb+')':_0x447ae3(0x1c0);return{'apiKey':_0xeba120,'source':_0x594bbf,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x17a37c,_0x116d6c,_0x5b097e=!![]){const _0x3e78ec=a46_0x5cf5,_0x532034=await resolveAPIKeyAsync(_0x17a37c,_0x116d6c);if(!_0x532034)return undefined;if(_0x5b097e&&_0x532034[_0x3e78ec(0x182)]&&_0x532034[_0x3e78ec(0x17a)][_0x3e78ec(0x17e)]('TD_API_KEY')){const _0x3f8161=_0x116d6c||getActiveProfileName()||undefined,_0x2b1e87=_0x3f8161?'TDX_API_KEY_'+normalizeProfileForEnvVar(_0x3f8161):_0x3e78ec(0x1c8);console['warn'](a46_0x35519b['yellow'](_0x3e78ec(0x186)+(_0x3e78ec(0x1a6)+_0x2b1e87+').')));}return _0x532034[_0x3e78ec(0x1ba)];}function getLegacyEnvAPIKey(_0x443819,_0x4360d6){const _0x240406=a46_0x5cf5,_0x5974df=_0x443819['toUpperCase']()['replace'](/-/g,'_'),_0x3a0fe6='TD_API_KEY_'+_0x5974df;if(_0x4360d6){const _0xda49f6=loadProfileEnv(_0x4360d6);if(_0xda49f6){if(_0xda49f6[_0x3a0fe6])return _0xda49f6[_0x3a0fe6];if(_0xda49f6['TD_API_KEY'])return _0xda49f6[_0x240406(0x1ab)];}}const _0x16b3ed=loadUserConfigOnce();if(_0x16b3ed[_0x3a0fe6])return _0x16b3ed[_0x3a0fe6];if(_0x16b3ed[_0x240406(0x1ab)])return _0x16b3ed['TD_API_KEY'];return undefined;}function cleanupLegacyEnvFile(_0x19d60d){const _0x2fb4b3=a46_0x5cf5;if(!existsSync(_0x19d60d))return![];try{const _0x411c13=readFileSync(_0x19d60d,_0x2fb4b3(0x1aa)),_0x3f2209=_0x411c13['split']('\x0a'),_0x4ced75=_0x3f2209['filter'](_0x367652=>{const _0x403f30=_0x2fb4b3,_0x5ea60c=_0x367652[_0x403f30(0x1c2)]();if(!_0x5ea60c||_0x5ea60c[_0x403f30(0x18f)]('#'))return!![];const [_0x338a9b]=_0x5ea60c[_0x403f30(0x1c3)]('=');return!_0x338a9b[_0x403f30(0x18f)]('TD_API_KEY');}),_0x4588ac=_0x4ced75[_0x2fb4b3(0x190)](_0xbfe7c=>{const _0x23c002=_0x2fb4b3,_0x167716=_0xbfe7c[_0x23c002(0x1c2)]();return _0x167716&&!_0x167716['startsWith']('#');});if(!_0x4588ac)return unlinkSync(_0x19d60d),!![];return writeFileSync(_0x19d60d,_0x4ced75['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x5231ce){const _0x5f4fb1=a46_0x5cf5,_0x5dbdd5=a46_0x1e6474[_0x5f4fb1(0x19b)](getConfigDir(),_0x5f4fb1(0x1bc)+_0x5231ce);if(a46_0x321104[_0x5f4fb1(0x1b1)](_0x5dbdd5)){validateSecureFilePermissions(_0x5dbdd5);try{const _0x34b8f0=a46_0x321104[_0x5f4fb1(0x1be)](_0x5dbdd5,_0x5f4fb1(0x1aa));return parseEnvFile(_0x34b8f0);}catch(_0x461d0d){console[_0x5f4fb1(0x18a)](_0x5f4fb1(0x188)+_0x5dbdd5+':\x20'+_0x461d0d);}}const _0x46a339=a46_0x1e6474['join'](getConfigDir(),_0x5f4fb1(0x19e),_0x5231ce,_0x5f4fb1(0x1a1));if(a46_0x321104['existsSync'](_0x46a339)){validateSecureFilePermissions(_0x46a339);try{const _0x583ea9=a46_0x321104[_0x5f4fb1(0x1be)](_0x46a339,_0x5f4fb1(0x1aa));return parseEnvFile(_0x583ea9);}catch(_0x30849e){return console[_0x5f4fb1(0x18a)](_0x5f4fb1(0x188)+_0x46a339+':\x20'+_0x30849e),null;}}return null;}function getActiveProfileName(){const _0x2229d9=a46_0x5cf5,_0x28a787=a46_0x1e6474[_0x2229d9(0x19b)](getConfigDir(),'tdx.json');if(!a46_0x321104[_0x2229d9(0x1b1)](_0x28a787))return null;try{const _0x2f7b1d=a46_0x321104[_0x2229d9(0x1be)](_0x28a787,'utf-8'),_0x2d0bec=JSON[_0x2229d9(0x19f)](_0x2f7b1d);return _0x2d0bec[_0x2229d9(0x1b4)]||null;}catch{return null;}}export function saveAPIKey(_0x1372a2,_0x44b077,_0x1303a7){const _0x40ee12=a46_0x5cf5,_0x3291f0=getConfigDir(),_0x14f903=getConfigFilePath(_0x1303a7);!existsSync(_0x3291f0)&&mkdirSync(_0x3291f0,{'recursive':!![],'mode':0x1c0});let _0xcf04ad={};if(existsSync(_0x14f903))try{const _0x157755=readFileSync(_0x14f903,_0x40ee12(0x1aa));_0xcf04ad=parseEnvFile(_0x157755);}catch(_0x36011c){console['warn']('Warning:\x20Failed\x20to\x20read\x20'+_0x14f903+':',_0x36011c);}const _0x2dd336=_0x1372a2[_0x40ee12(0x1a2)]()[_0x40ee12(0x195)](/-/g,'_');_0xcf04ad[_0x40ee12(0x1b2)+_0x2dd336]=_0x44b077;const _0x3d6a29=Object[_0x40ee12(0x17c)](_0xcf04ad)[_0x40ee12(0x1c1)](([_0x54701b,_0x58c698])=>_0x54701b+'='+_0x58c698);writeFileSync(_0x14f903,_0x3d6a29['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x49df56,_0x496603,_0x1e0387){const _0x22c142=a46_0x5cf5;await saveKeychainAPIKey(_0x49df56,_0x1e0387),setCachedCredential(_0x49df56,_0x496603,_0x1e0387);const _0x3a51b8=getConfigFilePath(_0x1e0387);cleanupLegacyEnvFile(_0x3a51b8)&&console[_0x22c142(0x18a)](a46_0x35519b[_0x22c142(0x1b3)](_0x22c142(0x191)));}export function loadConfig(){const _0x402814=a46_0x5cf5,_0x4ce591={'apiKeys':{},'defaultSite':'us01'},_0x26b94f=[_0x402814(0x17f),_0x402814(0x1a3),_0x402814(0x19a),_0x402814(0x1a9),_0x402814(0x185),'dev-us01',_0x402814(0x1af),'stg-us01',_0x402814(0x180),'stg-ap03'];for(const _0x10734b of _0x26b94f){const _0x48ecf3=getAPIKey(_0x10734b);_0x48ecf3&&(_0x4ce591['apiKeys'][_0x10734b]=_0x48ecf3);}return _0x4ce591;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x555d5d,_0x113ba9){const _0x16fba6=a47_0x1d0c,_0x42eee9=_0x555d5d();while(!![]){try{const _0x38b19f=parseInt(_0x16fba6(0x1cf))/0x1+parseInt(_0x16fba6(0x1d5))/0x2+parseInt(_0x16fba6(0x1d7))/0x3+parseInt(_0x16fba6(0x1ce))/0x4+-parseInt(_0x16fba6(0x1d0))/0x5+parseInt(_0x16fba6(0x1d8))/0x6+-parseInt(_0x16fba6(0x1d3))/0x7;if(_0x38b19f===_0x113ba9)break;else _0x42eee9['push'](_0x42eee9['shift']());}catch(_0x1d5492){_0x42eee9['push'](_0x42eee9['shift']());}}}(a47_0x3d84,0xb145c));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';import{getCacheDir}from'./config.js';function getCacheFilePath(_0x3e9d31){const _0x48ff0e=a47_0x1d0c,_0x3e407b=_0x3e9d31||'default';return join(getCacheDir(),_0x48ff0e(0x1d6)+_0x3e407b+_0x48ff0e(0x1d1));}function a47_0x1d0c(_0x2ee19f,_0x4cc1eb){_0x2ee19f=_0x2ee19f-0x1cd;const _0x3d8427=a47_0x3d84();let _0x1d0cdc=_0x3d8427[_0x2ee19f];return _0x1d0cdc;}export function loadCachedConnections(_0x5b13f5){const _0x8596da=getCacheFilePath(_0x5b13f5);if(!existsSync(_0x8596da))return null;try{const _0x540232=readFileSync(_0x8596da,'utf-8'),_0x73431d=JSON['parse'](_0x540232);return _0x73431d['connections'];}catch{return null;}}function a47_0x3d84(){const _0x2332ee=['stringify','2936024HJoNnF','179143GWNqsJ','5022690xnjJmX','.json','utf-8','14209993Bqrevm','now','2774918YmckNJ','connections-','2717895JDoKvW','3324432PKipMn'];a47_0x3d84=function(){return _0x2332ee;};return a47_0x3d84();}export function saveCachedConnections(_0x53cb63,_0x176678){const _0x16dedf=a47_0x1d0c,_0x333351=getCacheDir();!existsSync(_0x333351)&&mkdirSync(_0x333351,{'recursive':!![]});const _0xcb80d=getCacheFilePath(_0x53cb63),_0x243359={'connections':_0x176678,'cachedAt':Date[_0x16dedf(0x1d4)]()};writeFileSync(_0xcb80d,JSON[_0x16dedf(0x1cd)](_0x243359,null,0x2),_0x16dedf(0x1d2));}export function clearConnectionCache(_0x3fa2b6){const _0x10e599=getCacheFilePath(_0x3fa2b6);if(existsSync(_0x10e599))try{unlinkSync(_0x10e599);}catch{}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x8ccb09,_0x32a1d3){const _0x31e116=a48_0x3297,_0x46ecae=_0x8ccb09();while(!![]){try{const _0x54bf83=parseInt(_0x31e116(0x7e))/0x1*(parseInt(_0x31e116(0x73))/0x2)+-parseInt(_0x31e116(0x74))/0x3*(-parseInt(_0x31e116(0x7f))/0x4)+parseInt(_0x31e116(0x71))/0x5*(-parseInt(_0x31e116(0x79))/0x6)+parseInt(_0x31e116(0x77))/0x7+-parseInt(_0x31e116(0x75))/0x8+parseInt(_0x31e116(0x76))/0x9*(parseInt(_0x31e116(0x7d))/0xa)+-parseInt(_0x31e116(0x7c))/0xb*(parseInt(_0x31e116(0x7b))/0xc);if(_0x54bf83===_0x32a1d3)break;else _0x46ecae['push'](_0x46ecae['shift']());}catch(_0xff30cd){_0x46ecae['push'](_0x46ecae['shift']());}}}(a48_0x2c1d,0x1a569));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0xe1cd9a,_0x5dbdc7){const _0x433d72=a48_0x3297,_0x45233f=_0xe1cd9a||_0x433d72(0x80),_0x14b5a2=_0x5dbdc7||'__default_profile__';return _0x45233f+':'+_0x14b5a2;}export function getCachedCredential(_0x20238d,_0x25486d){const _0x34a9d3=a48_0x3297,_0x3e24a9=getCacheKey(_0x20238d,_0x25486d),_0x47577a=cache['get'](_0x3e24a9);if(!_0x47577a)return null;if(Date[_0x34a9d3(0x70)]()-_0x47577a[_0x34a9d3(0x7a)]>CACHE_TTL_MS)return cache['delete'](_0x3e24a9),null;return _0x47577a['apiKey'];}function a48_0x2c1d(){const _0x47fc6c=['30foZYVF','loadedAt','12VgHxEV','2272501oKYQMO','27250vRRmIs','75269uguQZB','28VRNRCW','__default_site__','now','16495xUtTng','clear','4rAGOKp','309lXMVCs','864008RptCYz','639XviAMt','659638BfpKfX','set'];a48_0x2c1d=function(){return _0x47fc6c;};return a48_0x2c1d();}function a48_0x3297(_0x3302a8,_0xe27591){_0x3302a8=_0x3302a8-0x70;const _0x2c1db8=a48_0x2c1d();let _0x3297e3=_0x2c1db8[_0x3302a8];return _0x3297e3;}export function setCachedCredential(_0x2c8860,_0x5bd66c,_0x423af5){const _0x198119=a48_0x3297,_0x2da88a=getCacheKey(_0x5bd66c,_0x423af5);cache[_0x198119(0x78)](_0x2da88a,{'apiKey':_0x2c8860,'loadedAt':Date[_0x198119(0x70)]()});}export function clearCredentialCache(){const _0x259ab0=a48_0x3297;cache[_0x259ab0(0x72)]();}export function clearCachedCredential(_0x1abc23,_0x27a1c6){const _0x604758=getCacheKey(_0x1abc23,_0x27a1c6);cache['delete'](_0x604758);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a49_0x964417=a49_0x1e4e;function a49_0x28b8(){const _0x3c5a9b=['llmProject','llm_project','llm_agent','\x0a[configuration\x20files]','config','loadGlobalConfig',':\x20none','injectIntoOptions','1640949JlduPj','entries','apiKey','log','(active)','35248oPHBrk','not\x20set','parentSegment','3015uhUtsL','3047655KRMfRV','displayWithSources','Session','createAsync','display','globalCredentials','verbose','parse','1576468aFHfSR','.env','database','440610EsyWMQ','join','project','.json','activeProfile','4307898wpyiHV','session','getSource','readFileSync','tdx.json','resolveAPIKeyAsync','[context]','11083QxKYOl','replace','Global\x20Credentials','parent_segment','Project','existsSync','toString','Profile\x20Credentials','profileCredentials','utf-8','layers','(session:\x20','site','default','profile','2RVfSEi','segment_path','us01','logLevel','INFO','profile:\x20','global','cliFlags','profiles','Global',':\x20none\x20(using\x20session:\x20','configFiles','sessionId','llmAgent','getParameters'];a49_0x28b8=function(){return _0x3c5a9b;};return a49_0x28b8();}(function(_0x735d77,_0x4b6dbd){const _0x2f46d0=a49_0x1e4e,_0x43f4e5=_0x735d77();while(!![]){try{const _0x1fc7c4=parseInt(_0x2f46d0(0x142))/0x1+parseInt(_0x2f46d0(0x10b))/0x2*(parseInt(_0x2f46d0(0x122))/0x3)+-parseInt(_0x2f46d0(0x133))/0x4+-parseInt(_0x2f46d0(0x12b))/0x5+-parseInt(_0x2f46d0(0x136))/0x6+-parseInt(_0x2f46d0(0x13b))/0x7+-parseInt(_0x2f46d0(0x127))/0x8*(-parseInt(_0x2f46d0(0x12a))/0x9);if(_0x1fc7c4===_0x4b6dbd)break;else _0x43f4e5['push'](_0x43f4e5['shift']());}catch(_0x175db5){_0x43f4e5['push'](_0x43f4e5['shift']());}}}(a49_0x28b8,0x5364b));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a49_0x1ce6a7 from'node:fs';function a49_0x1e4e(_0x3d4c35,_0x393e66){_0x3d4c35=_0x3d4c35-0x101;const _0x28b8a5=a49_0x28b8();let _0x1e4e59=_0x28b8a5[_0x3d4c35];return _0x1e4e59;}import*as a49_0x377a3d from'node:path';export class GlobalContext{[a49_0x964417(0x108)];['database'];[a49_0x964417(0x145)];[a49_0x964417(0x10c)];['llm_project'];['llm_agent'];['apiKey'];[a49_0x964417(0x131)];[a49_0x964417(0x10e)];[a49_0x964417(0x10a)];[a49_0x964417(0x106)];[a49_0x964417(0x13a)];[a49_0x964417(0x117)];[a49_0x964417(0x116)];constructor(_0x47e438){const _0x425500=a49_0x964417;this[_0x425500(0x117)]=_0x47e438[_0x425500(0x13c)]||getCurrentSessionPID()[_0x425500(0x102)]();const _0x141fec=loadSessionContext(_0x47e438[_0x425500(0x13c)]),_0x3db8e7=loadProjectConfig(),_0x5e5d7c=this[_0x425500(0x11f)]();this[_0x425500(0x13a)]=_0x47e438['profile']||_0x141fec?.['profile']||_0x5e5d7c[_0x425500(0x10a)]||getActiveProfile();const _0x44da8a=this['activeProfile']?loadProfile(this[_0x425500(0x13a)]):null,_0x3f5803=_0x255327=>{const _0x26c6eb=_0x425500;if(!_0x255327)return{};const _0x4074f0=_0x255327,_0x1c71c0={};for(const [_0x432ea6,_0x24c4e2]of Object[_0x26c6eb(0x123)](_0x4074f0)){typeof _0x24c4e2==='string'&&(_0x1c71c0[_0x432ea6]=_0x24c4e2);}return _0x1c71c0;},_0x1f26fb={};if(_0x47e438[_0x425500(0x108)]&&_0x47e438[_0x425500(0x108)]!==_0x425500(0x10d))_0x1f26fb[_0x425500(0x108)]=_0x47e438['site'];const _0x1abc06=_0x141fec?.['database'],_0x5785ad=_0x3db8e7?.[_0x425500(0x135)],_0x5486c9=_0x44da8a?.[_0x425500(0x11e)]?.[_0x425500(0x135)],_0x74b1ce=_0x5e5d7c[_0x425500(0x135)];_0x47e438[_0x425500(0x135)]&&(_0x47e438['database']!==_0x1abc06&&_0x47e438[_0x425500(0x135)]!==_0x5785ad&&_0x47e438[_0x425500(0x135)]!==_0x5486c9&&_0x47e438['database']!==_0x74b1ce)&&(_0x1f26fb[_0x425500(0x135)]=_0x47e438[_0x425500(0x135)]);if(_0x47e438['parentSegment'])_0x1f26fb['parent_segment']=_0x47e438['parentSegment'];if(_0x47e438[_0x425500(0x11a)])_0x1f26fb[_0x425500(0x11b)]=_0x47e438[_0x425500(0x11a)];if(_0x47e438['llmAgent'])_0x1f26fb[_0x425500(0x11c)]=_0x47e438['llmAgent'];if(_0x47e438[_0x425500(0x10a)])_0x1f26fb[_0x425500(0x10a)]=_0x47e438['profile'];this[_0x425500(0x106)]={'cliFlags':_0x1f26fb,'session':_0x3f5803(_0x141fec),'project':_0x3f5803(_0x3db8e7),'profile':_0x3f5803(_0x44da8a?.[_0x425500(0x11e)]),'global':_0x3f5803(_0x5e5d7c)};const _0xd83663={...this['layers']['global'],...this[_0x425500(0x106)][_0x425500(0x10a)],...this[_0x425500(0x106)][_0x425500(0x138)],...this['layers'][_0x425500(0x13c)],...this[_0x425500(0x106)][_0x425500(0x112)]},_0x1c7513=_0xd83663[_0x425500(0x108)]||_0x425500(0x10d);this['site']=resolveSite(_0x1c7513),this[_0x425500(0x135)]=_0xd83663[_0x425500(0x135)],this[_0x425500(0x145)]=_0xd83663[_0x425500(0x145)],this[_0x425500(0x10c)]=_0xd83663[_0x425500(0x10c)],this[_0x425500(0x11b)]=_0xd83663['llm_project'],this['llm_agent']=_0xd83663['llm_agent'],this[_0x425500(0x131)]=_0x47e438[_0x425500(0x131)]||![],this[_0x425500(0x10e)]=_0x47e438[_0x425500(0x10e)]??LogLevel[_0x425500(0x10f)],this[_0x425500(0x10a)]=this[_0x425500(0x13a)]||undefined,this[_0x425500(0x124)]=getAPIKey(this[_0x425500(0x108)],this[_0x425500(0x13a)]||undefined);const _0x93c0f7=getConfigDir(),_0xe0e42=a49_0x377a3d['join'](_0x93c0f7,'sessions',this[_0x425500(0x117)]+_0x425500(0x139)),_0x44a3cc=findProjectConfigPath(),_0x5da1fd=a49_0x377a3d[_0x425500(0x137)](_0x93c0f7,_0x425500(0x13f)),_0x377626=a49_0x377a3d[_0x425500(0x137)](_0x93c0f7,_0x425500(0x134));let _0x3b50d8=null,_0x506683=null;this[_0x425500(0x13a)]&&(_0x3b50d8=a49_0x377a3d[_0x425500(0x137)](_0x93c0f7,_0x425500(0x113),this[_0x425500(0x13a)],_0x425500(0x13f)),_0x506683=a49_0x377a3d['join'](_0x93c0f7,'profiles',this[_0x425500(0x13a)],_0x425500(0x134))),this[_0x425500(0x116)]={'session':a49_0x1ce6a7[_0x425500(0x101)](_0xe0e42)?_0xe0e42:null,'project':_0x44a3cc,'profile':_0x3b50d8&&a49_0x1ce6a7['existsSync'](_0x3b50d8)?_0x3b50d8:null,'profileCredentials':_0x506683&&a49_0x1ce6a7['existsSync'](_0x506683)?_0x506683:null,'global':a49_0x1ce6a7['existsSync'](_0x5da1fd)?_0x5da1fd:null,'globalCredentials':a49_0x1ce6a7[_0x425500(0x101)](_0x377626)?_0x377626:null};}[a49_0x964417(0x13d)](_0xaa3b78,_0x5460e5){const _0x281b64=a49_0x964417;if(!_0x5460e5)return _0x281b64(0x128);const _0x4642c9=_0x5460e5;if(this[_0x281b64(0x106)]['cliFlags'][_0xaa3b78]===_0x4642c9){if(_0xaa3b78===_0x281b64(0x108)&&_0x4642c9==='us01'&&!this[_0x281b64(0x106)]['session'][_0x281b64(0x108)]&&!this['layers'][_0x281b64(0x138)][_0x281b64(0x108)]&&!this[_0x281b64(0x106)][_0x281b64(0x10a)][_0x281b64(0x108)]&&!this[_0x281b64(0x106)][_0x281b64(0x111)]['site'])return'default';return'CLI\x20flag:\x20--'+_0xaa3b78[_0x281b64(0x143)](/_/g,'-');}if(this['layers'][_0x281b64(0x13c)][_0xaa3b78]===_0x4642c9)return _0x281b64(0x13c);if(this[_0x281b64(0x106)][_0x281b64(0x138)][_0xaa3b78]===_0x4642c9)return _0x281b64(0x138);if(this['layers'][_0x281b64(0x10a)][_0xaa3b78]===_0x4642c9)return _0x281b64(0x110)+this['activeProfile'];if(this[_0x281b64(0x106)]['global'][_0xaa3b78]===_0x4642c9)return _0x281b64(0x111);return _0x281b64(0x109);}['loadGlobalConfig'](){const _0x2d2a16=a49_0x964417,_0x4fc9bd=a49_0x377a3d[_0x2d2a16(0x137)](getConfigDir(),_0x2d2a16(0x13f));if(!a49_0x1ce6a7[_0x2d2a16(0x101)](_0x4fc9bd))return{};try{const _0x11a2df=a49_0x1ce6a7[_0x2d2a16(0x13e)](_0x4fc9bd,_0x2d2a16(0x105));return JSON[_0x2d2a16(0x132)](_0x11a2df);}catch{return{};}}[a49_0x964417(0x121)](_0xa1245b){const _0x149553=a49_0x964417;_0xa1245b['site']=this[_0x149553(0x108)],!_0xa1245b[_0x149553(0x135)]&&this[_0x149553(0x135)]&&(_0xa1245b['database']=this[_0x149553(0x135)]),!_0xa1245b[_0x149553(0x129)]&&this[_0x149553(0x145)]&&(_0xa1245b[_0x149553(0x129)]=this[_0x149553(0x145)]),!_0xa1245b['segmentPath']&&this[_0x149553(0x10c)]&&(_0xa1245b['segmentPath']=this[_0x149553(0x10c)]),!_0xa1245b[_0x149553(0x11a)]&&this[_0x149553(0x11b)]&&(_0xa1245b[_0x149553(0x11a)]=this[_0x149553(0x11b)]),!_0xa1245b[_0x149553(0x118)]&&this[_0x149553(0x11c)]&&(_0xa1245b[_0x149553(0x118)]=this[_0x149553(0x11c)]);}[a49_0x964417(0x119)](){const _0x596509=a49_0x964417;return[{'key':_0x596509(0x108),'value':this['site']},{'key':_0x596509(0x135),'value':this[_0x596509(0x135)]},{'key':_0x596509(0x145),'value':this[_0x596509(0x145)]},{'key':_0x596509(0x10c),'value':this['segment_path']},{'key':_0x596509(0x11b),'value':this[_0x596509(0x11b)]},{'key':_0x596509(0x11c),'value':this[_0x596509(0x11c)]},{'key':_0x596509(0x10a),'value':this['activeProfile']||undefined}];}[a49_0x964417(0x12f)](){const _0x29c776=a49_0x964417;console[_0x29c776(0x125)](_0x29c776(0x141));for(const {key:_0x4f6ec7,value:_0x88a193}of this['getParameters']()){_0x88a193&&console[_0x29c776(0x125)](_0x4f6ec7+':\x20'+_0x88a193);}}[a49_0x964417(0x12c)](){const _0x7c6ef8=a49_0x964417;console[_0x7c6ef8(0x125)](_0x7c6ef8(0x141));for(const {key:_0x24b562,value:_0x5daac1}of this[_0x7c6ef8(0x119)]()){if(_0x5daac1){const _0x5b42cc=_0x24b562===_0x7c6ef8(0x10a)?_0x7c6ef8(0x126):'('+this[_0x7c6ef8(0x13d)](_0x24b562,_0x5daac1)+')';console[_0x7c6ef8(0x125)](_0x24b562+':\x20'+_0x5daac1+'\x20'+_0x5b42cc);}}console[_0x7c6ef8(0x125)](_0x7c6ef8(0x11d));const _0x1688f8=[{'label':_0x7c6ef8(0x12d),'path':this[_0x7c6ef8(0x116)]['session'],'extra':_0x7c6ef8(0x107)+this[_0x7c6ef8(0x117)]+')'},{'label':_0x7c6ef8(0x146),'path':this[_0x7c6ef8(0x116)]['project']},{'label':'Profile','path':this['configFiles']['profile']},{'label':_0x7c6ef8(0x103),'path':this['configFiles'][_0x7c6ef8(0x104)]},{'label':_0x7c6ef8(0x114),'path':this[_0x7c6ef8(0x116)][_0x7c6ef8(0x111)]},{'label':_0x7c6ef8(0x144),'path':this['configFiles'][_0x7c6ef8(0x130)]}];for(const {label:_0x96bccf,path:_0x4ddfa0,extra:_0x8fc033}of _0x1688f8){if(_0x4ddfa0)console[_0x7c6ef8(0x125)](_0x96bccf+':\x20'+_0x4ddfa0+'\x20✓'+(_0x8fc033?'\x20'+_0x8fc033:''));else{if(_0x96bccf===_0x7c6ef8(0x12d))console['log'](_0x96bccf+_0x7c6ef8(0x115)+this[_0x7c6ef8(0x117)]+')');else(_0x96bccf===_0x7c6ef8(0x146)||_0x96bccf===_0x7c6ef8(0x114))&&console[_0x7c6ef8(0x125)](_0x96bccf+_0x7c6ef8(0x120));}}}async[a49_0x964417(0x140)](){const _0x17573f=a49_0x964417;return this[_0x17573f(0x124)]=await getAPIKeyAsync(this[_0x17573f(0x108)],this[_0x17573f(0x13a)]||undefined),this[_0x17573f(0x124)];}static async[a49_0x964417(0x12e)](_0x13212e){const _0x16a883=a49_0x964417,_0x26e8bf=new GlobalContext(_0x13212e);return await _0x26e8bf[_0x16a883(0x140)](),_0x26e8bf;}}
|
|
1
|
+
const a49_0x1335b9=a49_0x3385;(function(_0x2334b6,_0x5a59ef){const _0x77c2cf=a49_0x3385,_0x4e5179=_0x2334b6();while(!![]){try{const _0x1603c8=parseInt(_0x77c2cf(0xed))/0x1*(parseInt(_0x77c2cf(0xfe))/0x2)+-parseInt(_0x77c2cf(0x102))/0x3+parseInt(_0x77c2cf(0xf9))/0x4*(parseInt(_0x77c2cf(0xd2))/0x5)+parseInt(_0x77c2cf(0x100))/0x6*(parseInt(_0x77c2cf(0xf5))/0x7)+-parseInt(_0x77c2cf(0xf6))/0x8*(parseInt(_0x77c2cf(0xf7))/0x9)+parseInt(_0x77c2cf(0xee))/0xa+parseInt(_0x77c2cf(0xe3))/0xb;if(_0x1603c8===_0x5a59ef)break;else _0x4e5179['push'](_0x4e5179['shift']());}catch(_0xd6538d){_0x4e5179['push'](_0x4e5179['shift']());}}}(a49_0x277f,0xa3191));function a49_0x277f(){const _0x592057=['verbose','segmentPath','\x0a[configuration\x20files]','sessionId','Profile\x20Credentials','site','display','resolveAPIKeyAsync','configFiles','INFO','llm_agent','displayWithSources','join','parse','layers','[context]','segment_path','llmAgent','llm_project','project','130vgLcRY','Session','activeProfile','(session:\x20','global','profile:\x20','sessions','existsSync','replace','globalCredentials','Global\x20Credentials',':\x20none\x20(using\x20session:\x20','injectIntoOptions','Profile','utf-8','not\x20set',':\x20none','895268JFEJqb','default','us01','config','CLI\x20flag:\x20--','getParameters','tdx.json','string','profiles','database','18820gWFszR','1534490jHzdlQ','Project','parent_segment','logLevel','.env','cliFlags','getSource','7urkBus','88ykYYJC','1077912BmhKQt','llmProject','9824NwCpFr','apiKey','parentSegment','Global','log','86HBqqNS','session','6031344aMBKkv','profileCredentials','383040TyoGBf','profile'];a49_0x277f=function(){return _0x592057;};return a49_0x277f();}import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a49_0x1c352a from'node:fs';import*as a49_0xd64eee from'node:path';function a49_0x3385(_0x428c82,_0x222817){_0x428c82=_0x428c82-0xbf;const _0x277f66=a49_0x277f();let _0x33859a=_0x277f66[_0x428c82];return _0x33859a;}export class GlobalContext{['site'];[a49_0x1335b9(0xec)];[a49_0x1335b9(0xf0)];[a49_0x1335b9(0xce)];[a49_0x1335b9(0xd0)];[a49_0x1335b9(0xc8)];[a49_0x1335b9(0xfa)];[a49_0x1335b9(0x104)];[a49_0x1335b9(0xf1)];[a49_0x1335b9(0x103)];[a49_0x1335b9(0xcc)];[a49_0x1335b9(0xd4)];['sessionId'];[a49_0x1335b9(0xc6)];constructor(_0x4b1eb7){const _0x383f67=a49_0x1335b9;this[_0x383f67(0xc1)]=_0x4b1eb7[_0x383f67(0xff)]||getCurrentSessionPID()['toString']();const _0x78554a=loadSessionContext(_0x4b1eb7['session']),_0x1eccdf=loadProjectConfig(),_0xf83c17=this['loadGlobalConfig']();this[_0x383f67(0xd4)]=_0x4b1eb7[_0x383f67(0x103)]||_0x78554a?.['profile']||_0xf83c17[_0x383f67(0x103)]||getActiveProfile();const _0x35e1cc=this[_0x383f67(0xd4)]?loadProfile(this[_0x383f67(0xd4)]):null,_0x51b2bf=_0x2cc360=>{const _0x112530=_0x383f67;if(!_0x2cc360)return{};const _0x31db8d=_0x2cc360,_0x545f49={};for(const [_0x34778b,_0x50d0e1]of Object['entries'](_0x31db8d)){typeof _0x50d0e1===_0x112530(0xea)&&(_0x545f49[_0x34778b]=_0x50d0e1);}return _0x545f49;},_0x4c0aff={};if(_0x4b1eb7[_0x383f67(0xc3)]&&_0x4b1eb7['site']!==_0x383f67(0xe5))_0x4c0aff['site']=_0x4b1eb7['site'];const _0x3ab7e9=_0x78554a?.['database'],_0x467e67=_0x1eccdf?.[_0x383f67(0xec)],_0x5b9aa8=_0x35e1cc?.[_0x383f67(0xe6)]?.[_0x383f67(0xec)],_0x241ed2=_0xf83c17[_0x383f67(0xec)];_0x4b1eb7[_0x383f67(0xec)]&&(_0x4b1eb7['database']!==_0x3ab7e9&&_0x4b1eb7[_0x383f67(0xec)]!==_0x467e67&&_0x4b1eb7[_0x383f67(0xec)]!==_0x5b9aa8&&_0x4b1eb7['database']!==_0x241ed2)&&(_0x4c0aff['database']=_0x4b1eb7[_0x383f67(0xec)]);if(_0x4b1eb7[_0x383f67(0xfb)])_0x4c0aff['parent_segment']=_0x4b1eb7[_0x383f67(0xfb)];if(_0x4b1eb7[_0x383f67(0xf8)])_0x4c0aff[_0x383f67(0xd0)]=_0x4b1eb7[_0x383f67(0xf8)];if(_0x4b1eb7[_0x383f67(0xcf)])_0x4c0aff['llm_agent']=_0x4b1eb7['llmAgent'];if(_0x4b1eb7[_0x383f67(0x103)])_0x4c0aff['profile']=_0x4b1eb7[_0x383f67(0x103)];this[_0x383f67(0xcc)]={'cliFlags':_0x4c0aff,'session':_0x51b2bf(_0x78554a),'project':_0x51b2bf(_0x1eccdf),'profile':_0x51b2bf(_0x35e1cc?.[_0x383f67(0xe6)]),'global':_0x51b2bf(_0xf83c17)};const _0x2db3eb={...this[_0x383f67(0xcc)][_0x383f67(0xd6)],...this[_0x383f67(0xcc)]['profile'],...this[_0x383f67(0xcc)]['project'],...this[_0x383f67(0xcc)][_0x383f67(0xff)],...this['layers'][_0x383f67(0xf3)]},_0x3d9955=_0x2db3eb[_0x383f67(0xc3)]||_0x383f67(0xe5);this['site']=resolveSite(_0x3d9955),this[_0x383f67(0xec)]=_0x2db3eb[_0x383f67(0xec)],this[_0x383f67(0xf0)]=_0x2db3eb[_0x383f67(0xf0)],this[_0x383f67(0xce)]=_0x2db3eb[_0x383f67(0xce)],this[_0x383f67(0xd0)]=_0x2db3eb['llm_project'],this[_0x383f67(0xc8)]=_0x2db3eb[_0x383f67(0xc8)],this[_0x383f67(0x104)]=_0x4b1eb7['verbose']||![],this[_0x383f67(0xf1)]=_0x4b1eb7[_0x383f67(0xf1)]??LogLevel[_0x383f67(0xc7)],this[_0x383f67(0x103)]=this[_0x383f67(0xd4)]||undefined,this[_0x383f67(0xfa)]=getAPIKey(this['site'],this['activeProfile']||undefined);const _0x225c7e=getConfigDir(),_0x4e56e6=a49_0xd64eee[_0x383f67(0xca)](_0x225c7e,_0x383f67(0xd8),this[_0x383f67(0xc1)]+'.json'),_0x5b5386=findProjectConfigPath(),_0x2a7177=a49_0xd64eee['join'](_0x225c7e,_0x383f67(0xe9)),_0x17d855=a49_0xd64eee[_0x383f67(0xca)](_0x225c7e,_0x383f67(0xf2));let _0x4405d3=null,_0x4e86f9=null;this[_0x383f67(0xd4)]&&(_0x4405d3=a49_0xd64eee[_0x383f67(0xca)](_0x225c7e,_0x383f67(0xeb),this[_0x383f67(0xd4)],'tdx.json'),_0x4e86f9=a49_0xd64eee[_0x383f67(0xca)](_0x225c7e,_0x383f67(0xeb),this[_0x383f67(0xd4)],_0x383f67(0xf2))),this[_0x383f67(0xc6)]={'session':a49_0x1c352a['existsSync'](_0x4e56e6)?_0x4e56e6:null,'project':_0x5b5386,'profile':_0x4405d3&&a49_0x1c352a[_0x383f67(0xd9)](_0x4405d3)?_0x4405d3:null,'profileCredentials':_0x4e86f9&&a49_0x1c352a[_0x383f67(0xd9)](_0x4e86f9)?_0x4e86f9:null,'global':a49_0x1c352a['existsSync'](_0x2a7177)?_0x2a7177:null,'globalCredentials':a49_0x1c352a[_0x383f67(0xd9)](_0x17d855)?_0x17d855:null};}[a49_0x1335b9(0xf4)](_0x34943a,_0x18cdb4){const _0x4553e0=a49_0x1335b9;if(!_0x18cdb4)return _0x4553e0(0xe1);const _0x22cab6=_0x18cdb4;if(this[_0x4553e0(0xcc)][_0x4553e0(0xf3)][_0x34943a]===_0x22cab6){if(_0x34943a===_0x4553e0(0xc3)&&_0x22cab6===_0x4553e0(0xe5)&&!this[_0x4553e0(0xcc)][_0x4553e0(0xff)]['site']&&!this[_0x4553e0(0xcc)][_0x4553e0(0xd1)]['site']&&!this[_0x4553e0(0xcc)][_0x4553e0(0x103)][_0x4553e0(0xc3)]&&!this['layers'][_0x4553e0(0xd6)][_0x4553e0(0xc3)])return _0x4553e0(0xe4);return _0x4553e0(0xe7)+_0x34943a[_0x4553e0(0xda)](/_/g,'-');}if(this[_0x4553e0(0xcc)][_0x4553e0(0xff)][_0x34943a]===_0x22cab6)return _0x4553e0(0xff);if(this[_0x4553e0(0xcc)]['project'][_0x34943a]===_0x22cab6)return _0x4553e0(0xd1);if(this[_0x4553e0(0xcc)][_0x4553e0(0x103)][_0x34943a]===_0x22cab6)return _0x4553e0(0xd7)+this['activeProfile'];if(this[_0x4553e0(0xcc)][_0x4553e0(0xd6)][_0x34943a]===_0x22cab6)return _0x4553e0(0xd6);return _0x4553e0(0xe4);}['loadGlobalConfig'](){const _0x43468b=a49_0x1335b9,_0x196189=a49_0xd64eee['join'](getConfigDir(),_0x43468b(0xe9));if(!a49_0x1c352a['existsSync'](_0x196189))return{};try{const _0xcdd815=a49_0x1c352a['readFileSync'](_0x196189,_0x43468b(0xe0));return JSON[_0x43468b(0xcb)](_0xcdd815);}catch{return{};}}[a49_0x1335b9(0xde)](_0x1502e9){const _0x5bb38e=a49_0x1335b9;_0x1502e9[_0x5bb38e(0xc3)]=this[_0x5bb38e(0xc3)],!_0x1502e9[_0x5bb38e(0xec)]&&this[_0x5bb38e(0xec)]&&(_0x1502e9[_0x5bb38e(0xec)]=this[_0x5bb38e(0xec)]),!_0x1502e9[_0x5bb38e(0xfb)]&&this[_0x5bb38e(0xf0)]&&(_0x1502e9['parentSegment']=this['parent_segment']),!_0x1502e9[_0x5bb38e(0xbf)]&&this[_0x5bb38e(0xce)]&&(_0x1502e9[_0x5bb38e(0xbf)]=this[_0x5bb38e(0xce)]),!_0x1502e9[_0x5bb38e(0xf8)]&&this[_0x5bb38e(0xd0)]&&(_0x1502e9[_0x5bb38e(0xf8)]=this[_0x5bb38e(0xd0)]),!_0x1502e9[_0x5bb38e(0xcf)]&&this[_0x5bb38e(0xc8)]&&(_0x1502e9[_0x5bb38e(0xcf)]=this['llm_agent']);}[a49_0x1335b9(0xe8)](){const _0x34ca1d=a49_0x1335b9;return[{'key':_0x34ca1d(0xc3),'value':this['site']},{'key':_0x34ca1d(0xec),'value':this['database']},{'key':_0x34ca1d(0xf0),'value':this[_0x34ca1d(0xf0)]},{'key':_0x34ca1d(0xce),'value':this[_0x34ca1d(0xce)]},{'key':_0x34ca1d(0xd0),'value':this[_0x34ca1d(0xd0)]},{'key':'llm_agent','value':this[_0x34ca1d(0xc8)]},{'key':'profile','value':this[_0x34ca1d(0xd4)]||undefined}];}[a49_0x1335b9(0xc4)](){const _0x18ecb6=a49_0x1335b9;console[_0x18ecb6(0xfd)](_0x18ecb6(0xcd));for(const {key:_0x1ca4d0,value:_0x49e9af}of this['getParameters']()){_0x49e9af&&console[_0x18ecb6(0xfd)](_0x1ca4d0+':\x20'+_0x49e9af);}}[a49_0x1335b9(0xc9)](){const _0x32ab82=a49_0x1335b9;console['log']('[context]');for(const {key:_0x8fa924,value:_0x32bdfa}of this[_0x32ab82(0xe8)]()){if(_0x32bdfa){const _0x2b29e7=_0x8fa924===_0x32ab82(0x103)?'(active)':'('+this[_0x32ab82(0xf4)](_0x8fa924,_0x32bdfa)+')';console[_0x32ab82(0xfd)](_0x8fa924+':\x20'+_0x32bdfa+'\x20'+_0x2b29e7);}}console['log'](_0x32ab82(0xc0));const _0x2be389=[{'label':_0x32ab82(0xd3),'path':this[_0x32ab82(0xc6)][_0x32ab82(0xff)],'extra':_0x32ab82(0xd5)+this['sessionId']+')'},{'label':_0x32ab82(0xef),'path':this['configFiles']['project']},{'label':_0x32ab82(0xdf),'path':this[_0x32ab82(0xc6)][_0x32ab82(0x103)]},{'label':_0x32ab82(0xc2),'path':this[_0x32ab82(0xc6)][_0x32ab82(0x101)]},{'label':_0x32ab82(0xfc),'path':this['configFiles'][_0x32ab82(0xd6)]},{'label':_0x32ab82(0xdc),'path':this[_0x32ab82(0xc6)][_0x32ab82(0xdb)]}];for(const {label:_0x5b01d5,path:_0x3a52ea,extra:_0x237894}of _0x2be389){if(_0x3a52ea)console[_0x32ab82(0xfd)](_0x5b01d5+':\x20'+_0x3a52ea+'\x20✓'+(_0x237894?'\x20'+_0x237894:''));else{if(_0x5b01d5===_0x32ab82(0xd3))console[_0x32ab82(0xfd)](_0x5b01d5+_0x32ab82(0xdd)+this[_0x32ab82(0xc1)]+')');else(_0x5b01d5===_0x32ab82(0xef)||_0x5b01d5===_0x32ab82(0xfc))&&console['log'](_0x5b01d5+_0x32ab82(0xe2));}}}async[a49_0x1335b9(0xc5)](){const _0x5e0661=a49_0x1335b9;return this['apiKey']=await getAPIKeyAsync(this[_0x5e0661(0xc3)],this[_0x5e0661(0xd4)]||undefined),this[_0x5e0661(0xfa)];}static async['createAsync'](_0x1543a9){const _0x30d465=a49_0x1335b9,_0x265cee=new GlobalContext(_0x1543a9);return await _0x265cee[_0x30d465(0xc5)](),_0x265cee;}}
|
package/dist/core/keychain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a50_0x2e9ea4=a50_0x4d76;(function(_0xed1e82,_0x4fed72){const _0x2b2c77=a50_0x4d76,_0x535ff6=_0xed1e82();while(!![]){try{const _0xd16eaf=-parseInt(_0x2b2c77(0x15b))/0x1+-parseInt(_0x2b2c77(0x147))/0x2+parseInt(_0x2b2c77(0x143))/0x3*(parseInt(_0x2b2c77(0x14d))/0x4)+-parseInt(_0x2b2c77(0x142))/0x5+parseInt(_0x2b2c77(0x156))/0x6*(parseInt(_0x2b2c77(0x141))/0x7)+parseInt(_0x2b2c77(0x14b))/0x8*(-parseInt(_0x2b2c77(0x140))/0x9)+parseInt(_0x2b2c77(0x151))/0xa*(parseInt(_0x2b2c77(0x15f))/0xb);if(_0xd16eaf===_0x4fed72)break;else _0x535ff6['push'](_0x535ff6['shift']());}catch(_0x16ba39){_0x535ff6['push'](_0x535ff6['shift']());}}}(a50_0x49e3,0x25238));function a50_0x49e3(){const _0x27cb69=['__keychain_test__','2632NQpVPh','not\x20available','215296xUehHY','@zowe/secrets-for-zowe-sdk','message','unavailable','422780svzupb','reason','value','not\x20supported',':api_key','106914oEOmbj','Warning:\x20','access_denied','-25300','toLowerCase','291294sOgglL','profile:','tdx','includes','121vehMXt','630Bpjkqx','42JTCUHh','856350PXnuWy','15WzJcLH','keyring','setPassword','-25293','406756yWpOnB','getPassword','restricted'];a50_0x49e3=function(){return _0x27cb69;};return a50_0x49e3();}const SERVICE_NAME=a50_0x2e9ea4(0x15d);let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0xee5279=a50_0x2e9ea4;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x268c27=await import(_0xee5279(0x14e));return keyringModule=_0x268c27[_0xee5279(0x144)],keyringModule;}catch(_0x574d3f){return keyringLoadError=_0x574d3f instanceof Error?_0x574d3f:new Error(String(_0x574d3f)),null;}}function getAccountName(_0x229647){const _0x49eb9b=a50_0x2e9ea4,_0x393202=_0x229647||'';return _0x49eb9b(0x15c)+_0x393202+_0x49eb9b(0x155);}function a50_0x4d76(_0x5453ff,_0xcb0833){_0x5453ff=_0x5453ff-0x140;const _0x49e368=a50_0x49e3();let _0x4d7637=_0x49e368[_0x5453ff];return _0x4d7637;}export async function getKeychainAPIKey(_0x2c5879){const _0x3edb29=a50_0x2e9ea4,_0x7aae4f=await getKeychainAPIKeyWithStatus(_0x2c5879);if(_0x7aae4f['success'])return _0x7aae4f[_0x3edb29(0x153)];return _0x7aae4f[_0x3edb29(0x152)]==='access_denied'&&console['error'](_0x3edb29(0x157)+_0x7aae4f[_0x3edb29(0x14f)]),null;}export async function getKeychainAPIKeyWithStatus(_0x54c189){const _0x4d7f6d=a50_0x2e9ea4;try{const _0x51a747=await getKeyring();if(!_0x51a747)return{'success':![],'reason':_0x4d7f6d(0x150)};const _0x2c6047=getAccountName(_0x54c189),_0x24db92=await _0x51a747[_0x4d7f6d(0x148)](SERVICE_NAME,_0x2c6047);if(_0x24db92)return{'success':!![],'value':_0x24db92};return{'success':![],'reason':'not_found'};}catch(_0x418044){const _0x499faf=_0x418044 instanceof Error?_0x418044['message']:String(_0x418044);if(_0x499faf['includes'](_0x4d7f6d(0x159))||_0x499faf['toLowerCase']()['includes']('could\x20not\x20be\x20found')||_0x499faf[_0x4d7f6d(0x15a)]()[_0x4d7f6d(0x15e)]('not\x20found'))return{'success':![],'reason':'not_found'};if(_0x499faf[_0x4d7f6d(0x15e)](_0x4d7f6d(0x146))||_0x499faf[_0x4d7f6d(0x15a)]()[_0x4d7f6d(0x15e)](_0x4d7f6d(0x149))||_0x499faf[_0x4d7f6d(0x15a)]()[_0x4d7f6d(0x15e)]('access'))return{'success':![],'reason':_0x4d7f6d(0x158),'message':'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.'};return{'success':![],'reason':_0x4d7f6d(0x150),'message':_0x499faf};}}export async function saveKeychainAPIKey(_0x29e2ae,_0x307616){const _0x2d1997=a50_0x2e9ea4,_0x5e64dc=await getKeyring();if(!_0x5e64dc)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x5222d3=getAccountName(_0x307616);await _0x5e64dc[_0x2d1997(0x145)](SERVICE_NAME,_0x5222d3,_0x29e2ae);}export async function deleteKeychainAPIKey(_0x377a29){try{const _0x427c7d=await getKeyring();if(!_0x427c7d)return![];const _0x5e42b0=getAccountName(_0x377a29);return await _0x427c7d['deletePassword'](SERVICE_NAME,_0x5e42b0);}catch{return![];}}export async function isKeychainAvailable(){const _0x4c630f=a50_0x2e9ea4;try{const _0x4be874=await getKeyring();if(!_0x4be874)return![];return await _0x4be874[_0x4c630f(0x148)](SERVICE_NAME,_0x4c630f(0x14a)),!![];}catch(_0x2a940f){const _0x5de846=_0x2a940f instanceof Error?_0x2a940f[_0x4c630f(0x14f)][_0x4c630f(0x15a)]():'';if(_0x5de846[_0x4c630f(0x15e)](_0x4c630f(0x14c))||_0x5de846[_0x4c630f(0x15e)](_0x4c630f(0x154))||_0x5de846[_0x4c630f(0x15e)]('cannot\x20find'))return![];return!![];}}
|
package/dist/core/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x1e49a4,_0x26a21e){const _0xb6230f=a51_0x706e,_0x29ed23=_0x1e49a4();while(!![]){try{const _0xc91a1a=-parseInt(_0xb6230f(0x173))/0x1+parseInt(_0xb6230f(0x189))/0x2+parseInt(_0xb6230f(0x18a))/0x3+-parseInt(_0xb6230f(0x174))/0x4+parseInt(_0xb6230f(0x167))/0x5*(parseInt(_0xb6230f(0x164))/0x6)+-parseInt(_0xb6230f(0x169))/0x7*(parseInt(_0xb6230f(0x15d))/0x8)+parseInt(_0xb6230f(0x19d))/0x9;if(_0xc91a1a===_0x26a21e)break;else _0x29ed23['push'](_0x29ed23['shift']());}catch(_0x34ba67){_0x29ed23['push'](_0x29ed23['shift']());}}}(a51_0x5028,0x8099c));import*as a51_0x14df1a from'node:fs';import*as a51_0x268f27 from'node:path';import{getConfigDir}from'./config.js';function a51_0x706e(_0x2671fb,_0x14862d){_0x2671fb=_0x2671fb-0x156;const _0x50282c=a51_0x5028();let _0x706e9c=_0x50282c[_0x2671fb];return _0x706e9c;}import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export function getProfileParams(_0x131742){const _0x4c1bd5=a51_0x706e,_0x39550c={};if(!_0x131742)return _0x39550c;for(const [_0xeda854,_0x240f09]of Object[_0x4c1bd5(0x197)](_0x131742)){_0xeda854!==_0x4c1bd5(0x172)&&_0x240f09!==undefined&&(_0x39550c[_0xeda854]=_0x240f09);}return _0x39550c;}export function getProfilesDir(){const _0x2275fb=a51_0x706e;return a51_0x268f27['join'](getConfigDir(),_0x2275fb(0x15a));}function getProfileDir(_0x50e213){return a51_0x268f27['join'](getProfilesDir(),_0x50e213);}function getProfileConfigPath(_0x4a6974){const _0x3bad2c=a51_0x706e;return a51_0x268f27[_0x3bad2c(0x176)](getProfileDir(_0x4a6974),_0x3bad2c(0x178));}function getProfileEnvPath(_0x425249){const _0x2390de=a51_0x706e;return a51_0x268f27[_0x2390de(0x176)](getProfileDir(_0x425249),_0x2390de(0x198));}function getGlobalConfigPath(){const _0xc5b422=a51_0x706e;return a51_0x268f27[_0xc5b422(0x176)](getConfigDir(),_0xc5b422(0x178));}function validateProfileName(_0x1bd8b3){const _0x10831b=a51_0x706e;if(!/^[a-zA-Z0-9_-]+$/['test'](_0x1bd8b3))throw new Error(_0x10831b(0x17b)+_0x1bd8b3+_0x10831b(0x156));}function validateProfileConfig(_0x3de453,_0x578ec2){const _0x22cd50=a51_0x706e;if(typeof _0x3de453!==_0x22cd50(0x192)||_0x3de453===null)throw new Error('Profile\x20\x27'+_0x578ec2+_0x22cd50(0x16b));const _0x22f1b2=[_0x22cd50(0x172),_0x22cd50(0x186),_0x22cd50(0x15c),_0x22cd50(0x17c),_0x22cd50(0x17f),'llm_agent'],_0x434295=_0x3de453;for(const _0xfed396 of Object[_0x22cd50(0x158)](_0x434295)){!_0x22f1b2[_0x22cd50(0x180)](_0xfed396)&&console[_0x22cd50(0x171)](_0x22cd50(0x170)+_0x578ec2+_0x22cd50(0x19a)+_0xfed396+'\x27\x20will\x20be\x20ignored');}if(_0x434295[_0x22cd50(0x172)]!==undefined&&typeof _0x434295[_0x22cd50(0x172)]!=='string')throw new Error(_0x22cd50(0x16a)+_0x578ec2+_0x22cd50(0x194));if(_0x434295[_0x22cd50(0x186)]!==undefined&&typeof _0x434295['site']!==_0x22cd50(0x199))throw new Error(_0x22cd50(0x16a)+_0x578ec2+_0x22cd50(0x181));if(_0x434295['database']!==undefined&&typeof _0x434295[_0x22cd50(0x15c)]!=='string')throw new Error(_0x22cd50(0x16a)+_0x578ec2+_0x22cd50(0x15b));if(_0x434295[_0x22cd50(0x17c)]!==undefined&&typeof _0x434295[_0x22cd50(0x17c)]!==_0x22cd50(0x199))throw new Error('Profile\x20\x27'+_0x578ec2+_0x22cd50(0x160));if(_0x434295['llm_project']!==undefined&&typeof _0x434295[_0x22cd50(0x17f)]!==_0x22cd50(0x199))throw new Error(_0x22cd50(0x16a)+_0x578ec2+_0x22cd50(0x19c));if(_0x434295[_0x22cd50(0x157)]!==undefined&&typeof _0x434295[_0x22cd50(0x157)]!==_0x22cd50(0x199))throw new Error(_0x22cd50(0x16a)+_0x578ec2+_0x22cd50(0x185));return!![];}function loadProfilesFromTdxJson(_0x4614b7,_0x13f6df){const _0x290279=a51_0x706e;if(!a51_0x14df1a['existsSync'](_0x4614b7))return[];try{const _0x3b2dfe=a51_0x14df1a['readFileSync'](_0x4614b7,_0x290279(0x17d)),_0x22544c=JSON[_0x290279(0x18e)](_0x3b2dfe);if(!_0x22544c[_0x290279(0x15a)]||typeof _0x22544c[_0x290279(0x15a)]!==_0x290279(0x192))return[];const _0x48354f=[];for(const [_0x5a0a1c,_0x3795e3]of Object[_0x290279(0x197)](_0x22544c[_0x290279(0x15a)])){try{validateProfileConfig(_0x3795e3,_0x5a0a1c);const _0x1e30df=getNewCredentialPath(_0x5a0a1c),_0x212359=getOldCredentialPath(_0x5a0a1c),_0x52c17e=a51_0x14df1a[_0x290279(0x175)](_0x1e30df)||a51_0x14df1a[_0x290279(0x175)](_0x212359);_0x48354f[_0x290279(0x179)]({'name':_0x5a0a1c,'config':_0x3795e3,'metadata':{'name':_0x5a0a1c,'createdAt':new Date()[_0x290279(0x17a)]()},'hasCredentials':_0x52c17e,'scope':_0x13f6df});}catch(_0x20ac00){_0x20ac00 instanceof Error&&(console['warn'](_0x290279(0x19b)+_0x4614b7+':'),console[_0x290279(0x171)]('\x20\x20'+_0x20ac00['message']+'\x0a'));}}return _0x48354f;}catch(_0x182139){return _0x182139 instanceof SyntaxError?(console[_0x290279(0x171)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x4614b7+_0x290279(0x16d)),console[_0x290279(0x171)](_0x290279(0x18d)+_0x182139[_0x290279(0x165)]+'\x0a')):console[_0x290279(0x171)](_0x290279(0x196)+_0x4614b7+':\x20'+_0x182139+'\x0a'),[];}}export function getNewCredentialPath(_0x3d6d66){const _0x518fa5=a51_0x706e;return a51_0x268f27[_0x518fa5(0x176)](getConfigDir(),'.env.'+_0x3d6d66);}function getOldCredentialPath(_0x557ba9){const _0x3e7869=a51_0x706e;return a51_0x268f27[_0x3e7869(0x176)](getProfilesDir(),_0x557ba9,_0x3e7869(0x198));}function a51_0x5028(){const _0x4dea8d=['set','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','entries','.env','string','\x27:\x20unknown\x20config\x20key\x20\x27','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','13798296yNavTZ','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','llm_agent','keys','stringify','profiles','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','database','8zyxvvT','length','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','some','\x20does\x20not\x20exist','name','6RiNqTu','message','from','1530040Vzeipe','\x20\x201.\x20Edit:\x20','4275663TZYXJL','Profile\x20\x27','\x27:\x20config\x20must\x20be\x20an\x20object','find',':\x20Invalid\x20JSON\x20syntax','Profile\x20','isDirectory','Warning:\x20Profile\x20\x27','warn','description','826063ZDrhjL','3565164ceCYzJ','existsSync','join','readFileSync','tdx.json','push','toISOString','Invalid\x20profile\x20name:\x20','parent_segment','utf-8','values','llm_project','includes','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','Warning:\x20Failed\x20to\x20parse\x20','directory','filter','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','site','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','profile','1666736gQYuHU','547173aTIoTh','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','map','Error:\x20','parse','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','localeCompare','\x20\x20mv\x20\x22','object',',\x20creating\x20new\x20file','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string'];a51_0x5028=function(){return _0x4dea8d;};return a51_0x5028();}function loadProfilesFromTdxJsonFiles(){const _0x496ea8=a51_0x706e,_0x41ea2b=[],_0x3c04fd=findProjectConfigPath();_0x3c04fd&&_0x41ea2b[_0x496ea8(0x179)](...loadProfilesFromTdxJson(_0x3c04fd,'local'));const _0x5c30fa=a51_0x268f27[_0x496ea8(0x176)](getConfigDir(),_0x496ea8(0x178));return _0x41ea2b[_0x496ea8(0x179)](...loadProfilesFromTdxJson(_0x5c30fa,'user')),_0x41ea2b;}function loadProfilesFromDirectories(){const _0x4afdfe=a51_0x706e,_0xef0494=getProfilesDir();if(!a51_0x14df1a['existsSync'](_0xef0494))return[];try{return a51_0x14df1a['readdirSync'](_0xef0494,{'withFileTypes':!![]})[_0x4afdfe(0x184)](_0x44e5e3=>_0x44e5e3[_0x4afdfe(0x16f)]())[_0x4afdfe(0x18c)](_0x5cae48=>_0x5cae48['name'])['filter'](_0x2505d4=>{const _0xefe896=_0x4afdfe,_0x45c2c8=getProfileConfigPath(_0x2505d4),_0x596fce=getProfileEnvPath(_0x2505d4);return a51_0x14df1a[_0xefe896(0x175)](_0x45c2c8)||a51_0x14df1a[_0xefe896(0x175)](_0x596fce);})[_0x4afdfe(0x18c)](_0xb1a361=>{const _0x2f7532=_0x4afdfe,_0x36f762=loadProfileFromDirectory(_0xb1a361);if(_0x36f762)return{..._0x36f762,'scope':_0x2f7532(0x183)};return null;})['filter'](_0x5c260d=>_0x5c260d!==null);}catch{return[];}}function loadProfileFromDirectory(_0x56454c){const _0x3c798f=a51_0x706e,_0x577cc2=getProfileConfigPath(_0x56454c),_0x3a6268=getOldCredentialPath(_0x56454c);if(!a51_0x14df1a[_0x3c798f(0x175)](_0x577cc2)&&!a51_0x14df1a[_0x3c798f(0x175)](_0x3a6268))return null;let _0x3038d0={},_0x3babd7={'name':_0x56454c,'createdAt':new Date()[_0x3c798f(0x17a)]()};if(a51_0x14df1a[_0x3c798f(0x175)](_0x577cc2))try{const _0x22061b=a51_0x14df1a[_0x3c798f(0x177)](_0x577cc2,_0x3c798f(0x17d)),_0x2d7850=JSON[_0x3c798f(0x18e)](_0x22061b),{metadata:_0x10ec9b,..._0x2c88f1}=_0x2d7850;_0x3038d0=_0x2c88f1,_0x10ec9b&&(_0x3babd7=_0x10ec9b);}catch{}return{'name':_0x56454c,'config':_0x3038d0,'metadata':_0x3babd7,'hasCredentials':a51_0x14df1a['existsSync'](_0x3a6268),'scope':_0x3c798f(0x183)};}export function listProfiles(){const _0x19c023=a51_0x706e,_0x2c1ffd=loadProfilesFromTdxJsonFiles(),_0x9478bf=loadProfilesFromDirectories();if(_0x9478bf[_0x19c023(0x15e)]>0x0){const _0x1df6bd=_0x9478bf[_0x19c023(0x18c)](_0x5f001a=>_0x5f001a[_0x19c023(0x163)])['join'](',\x20'),_0xaf7c40=getConfigDir();console[_0x19c023(0x171)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x1df6bd),console['warn']('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x19c023(0x171)](_0x19c023(0x168)+a51_0x268f27[_0x19c023(0x176)](_0xaf7c40,_0x19c023(0x178))),console[_0x19c023(0x171)](_0x19c023(0x18f)),console[_0x19c023(0x171)](_0x19c023(0x187));}const _0x853066=[..._0x2c1ffd,..._0x9478bf],_0x1fa03f=new Map();for(const _0xc439b2 of _0x853066){!_0x1fa03f['has'](_0xc439b2[_0x19c023(0x163)])&&_0x1fa03f[_0x19c023(0x195)](_0xc439b2[_0x19c023(0x163)],_0xc439b2);}return Array[_0x19c023(0x166)](_0x1fa03f[_0x19c023(0x17e)]())['sort']((_0x5e4281,_0x37443b)=>_0x5e4281[_0x19c023(0x163)][_0x19c023(0x190)](_0x37443b[_0x19c023(0x163)]));}export function profileExists(_0x40dbab){const _0x1640ec=a51_0x706e,_0x194cea=listProfiles();return _0x194cea[_0x1640ec(0x161)](_0x5a94dc=>_0x5a94dc[_0x1640ec(0x163)]===_0x40dbab);}export function loadProfile(_0x57d39c){const _0x12358b=a51_0x706e;validateProfileName(_0x57d39c);const _0x139d76=listProfiles(),_0x43b28e=_0x139d76[_0x12358b(0x16c)](_0x214710=>_0x214710[_0x12358b(0x163)]===_0x57d39c);return _0x43b28e||null;}export function saveProfile(_0x5a64f7,_0x1dcea7,_0x31ba3c=![]){saveProfileToUserConfig(_0x5a64f7,_0x1dcea7);}export function deleteProfile(_0x749683){const _0x2e83a7=a51_0x706e;validateProfileName(_0x749683);const _0x3333af=getProfileDir(_0x749683);if(!a51_0x14df1a['existsSync'](_0x3333af))throw new Error(_0x2e83a7(0x16e)+_0x749683+_0x2e83a7(0x162));a51_0x14df1a['rmSync'](_0x3333af,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x3fa8a8,_0x876f86){const _0x281ba3=a51_0x706e;validateProfileName(_0x3fa8a8);const _0x1fdcb2=getGlobalConfigPath(),_0x54f9fc=getConfigDir();!a51_0x14df1a[_0x281ba3(0x175)](_0x54f9fc)&&createSecureDirectory(_0x54f9fc);let _0x483a24={};if(a51_0x14df1a['existsSync'](_0x1fdcb2))try{const _0x1f9a77=a51_0x14df1a[_0x281ba3(0x177)](_0x1fdcb2,_0x281ba3(0x17d));_0x483a24=JSON[_0x281ba3(0x18e)](_0x1f9a77);}catch{console[_0x281ba3(0x171)](_0x281ba3(0x182)+_0x1fdcb2+_0x281ba3(0x193));}!_0x483a24[_0x281ba3(0x15a)]&&(_0x483a24['profiles']={}),_0x483a24['profiles'][_0x3fa8a8]=_0x876f86,writeSecureFile(_0x1fdcb2,JSON[_0x281ba3(0x159)](_0x483a24,null,0x2));}export function getActiveProfile(){const _0x99ae80=a51_0x706e,_0x5365a3=loadSessionContext();if(_0x5365a3?.[_0x99ae80(0x188)])return _0x5365a3['profile'];const _0x496311=getGlobalConfigPath();if(!a51_0x14df1a[_0x99ae80(0x175)](_0x496311))return null;try{const _0x723492=a51_0x14df1a['readFileSync'](_0x496311,_0x99ae80(0x17d)),_0x24691c=JSON[_0x99ae80(0x18e)](_0x723492);return _0x24691c[_0x99ae80(0x188)]||null;}catch{return null;}}export function createProfile(_0x113834,_0x1886c5){const _0x123d03=a51_0x706e;validateProfileName(_0x113834);if(profileExists(_0x113834))throw new Error(_0x123d03(0x16e)+_0x113834+'\x20already\x20exists');saveProfile(_0x113834,_0x1886c5);}export function saveProfileCredentials(_0x59a5a1,_0x3a54e3){const _0x432ca8=a51_0x706e;validateProfileName(_0x59a5a1);if(!profileExists(_0x59a5a1))throw new Error(_0x432ca8(0x16e)+_0x59a5a1+_0x432ca8(0x162));const _0x45af11=getNewCredentialPath(_0x59a5a1);writeSecureFile(_0x45af11,_0x3a54e3);}export function loadProfileCredentials(_0x355336){const _0x30be96=a51_0x706e;validateProfileName(_0x355336);const _0x10845f=getNewCredentialPath(_0x355336);if(a51_0x14df1a[_0x30be96(0x175)](_0x10845f))try{return a51_0x14df1a[_0x30be96(0x177)](_0x10845f,_0x30be96(0x17d));}catch{}const _0x5bb120=getOldCredentialPath(_0x355336);if(a51_0x14df1a['existsSync'](_0x5bb120)){console[_0x30be96(0x171)](_0x30be96(0x15f)+_0x355336+'\x27'),console[_0x30be96(0x171)]('To\x20migrate:'),console['warn'](_0x30be96(0x191)+_0x5bb120+'\x22\x20\x22'+_0x10845f+'\x22'),console['warn'](_0x30be96(0x18b));try{return a51_0x14df1a[_0x30be96(0x177)](_0x5bb120,_0x30be96(0x17d));}catch{return null;}}return null;}
|
|
1
|
+
(function(_0x254608,_0x249a51){const _0x490ff7=a51_0x496a,_0x1e20c4=_0x254608();while(!![]){try{const _0x253d35=-parseInt(_0x490ff7(0x21b))/0x1*(parseInt(_0x490ff7(0x1fb))/0x2)+parseInt(_0x490ff7(0x1d9))/0x3*(parseInt(_0x490ff7(0x202))/0x4)+-parseInt(_0x490ff7(0x216))/0x5*(parseInt(_0x490ff7(0x1e0))/0x6)+-parseInt(_0x490ff7(0x21a))/0x7*(-parseInt(_0x490ff7(0x1fd))/0x8)+parseInt(_0x490ff7(0x210))/0x9*(-parseInt(_0x490ff7(0x206))/0xa)+-parseInt(_0x490ff7(0x1e9))/0xb+-parseInt(_0x490ff7(0x1f8))/0xc*(-parseInt(_0x490ff7(0x1dd))/0xd);if(_0x253d35===_0x249a51)break;else _0x1e20c4['push'](_0x1e20c4['shift']());}catch(_0x53df57){_0x1e20c4['push'](_0x1e20c4['shift']());}}}(a51_0x1d45,0x8c43a));import*as a51_0x2f4cf9 from'node:fs';import*as a51_0x1e16bd from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';function a51_0x1d45(){const _0x27ef90=['rmSync','Profile\x20\x27','1790OYuEtl','readdirSync','object','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','push','readFileSync','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','find','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','35487ieYyjV','map','.env.','utf-8','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','Profile\x20','4385LfECGZ','\x20does\x20not\x20exist','\x0aWarning:\x20Failed\x20to\x20parse\x20','llm_project','14YRhhsO','8ZKytqz','database','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','parse','toISOString','profile','join','set','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','parent_segment','9627bHxRPQ','sort','stringify','site','17535557cZzzBt','includes','Error:\x20','4242STzsPs','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','llm_agent','localeCompare','warn','string','To\x20migrate:','profiles','user','7970644GWpaUn','\x20\x201.\x20Edit:\x20','description','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','entries','keys','\x22\x20\x22','message','\x27\x20will\x20be\x20ignored','name','\x27:\x20config\x20must\x20be\x20an\x20object','Warning:\x20Profile\x20\x27','from','test','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','12xyhvFI','\x20\x20mv\x20\x22','existsSync','57688MIewfr','tdx.json','2394712DniKCy','some','filter','isDirectory',',\x20creating\x20new\x20file','1132lSexbf','\x20already\x20exists'];a51_0x1d45=function(){return _0x27ef90;};return a51_0x1d45();}import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export function getProfileParams(_0x21d38e){const _0x25ccda=a51_0x496a,_0x52620f={};if(!_0x21d38e)return _0x52620f;for(const [_0x36f4ce,_0x1aa944]of Object[_0x25ccda(0x1ed)](_0x21d38e)){_0x36f4ce!=='description'&&_0x1aa944!==undefined&&(_0x52620f[_0x36f4ce]=_0x1aa944);}return _0x52620f;}export function getProfilesDir(){const _0xd50ac1=a51_0x496a;return a51_0x1e16bd['join'](getConfigDir(),_0xd50ac1(0x1e7));}function getProfileDir(_0x3f412c){const _0x3f663c=a51_0x496a;return a51_0x1e16bd[_0x3f663c(0x1d5)](getProfilesDir(),_0x3f412c);}function getProfileConfigPath(_0x383183){const _0x4421a1=a51_0x496a;return a51_0x1e16bd[_0x4421a1(0x1d5)](getProfileDir(_0x383183),_0x4421a1(0x1fc));}function getProfileEnvPath(_0x2e7eb7){const _0x51495d=a51_0x496a;return a51_0x1e16bd[_0x51495d(0x1d5)](getProfileDir(_0x2e7eb7),'.env');}function getGlobalConfigPath(){const _0x309838=a51_0x496a;return a51_0x1e16bd[_0x309838(0x1d5)](getConfigDir(),_0x309838(0x1fc));}function validateProfileName(_0x5d2dd3){const _0x1b4b62=a51_0x496a;if(!/^[a-zA-Z0-9_-]+$/[_0x1b4b62(0x1f6)](_0x5d2dd3))throw new Error('Invalid\x20profile\x20name:\x20'+_0x5d2dd3+_0x1b4b62(0x20f));}function validateProfileConfig(_0x10f61d,_0x42c0ad){const _0x146141=a51_0x496a;if(typeof _0x10f61d!=='object'||_0x10f61d===null)throw new Error(_0x146141(0x205)+_0x42c0ad+_0x146141(0x1f3));const _0x53c7d=[_0x146141(0x1eb),_0x146141(0x1dc),_0x146141(0x21c),_0x146141(0x1d8),_0x146141(0x219),_0x146141(0x1e2)],_0x1a3366=_0x10f61d;for(const _0x31c9a9 of Object[_0x146141(0x1ee)](_0x1a3366)){!_0x53c7d[_0x146141(0x1de)](_0x31c9a9)&&console[_0x146141(0x1e4)](_0x146141(0x1f4)+_0x42c0ad+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x31c9a9+_0x146141(0x1f1));}if(_0x1a3366['description']!==undefined&&typeof _0x1a3366[_0x146141(0x1eb)]!==_0x146141(0x1e5))throw new Error('Profile\x20\x27'+_0x42c0ad+_0x146141(0x1ec));if(_0x1a3366[_0x146141(0x1dc)]!==undefined&&typeof _0x1a3366[_0x146141(0x1dc)]!==_0x146141(0x1e5))throw new Error(_0x146141(0x205)+_0x42c0ad+_0x146141(0x1e1));if(_0x1a3366[_0x146141(0x21c)]!==undefined&&typeof _0x1a3366['database']!==_0x146141(0x1e5))throw new Error('Profile\x20\x27'+_0x42c0ad+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x1a3366[_0x146141(0x1d8)]!==undefined&&typeof _0x1a3366[_0x146141(0x1d8)]!==_0x146141(0x1e5))throw new Error(_0x146141(0x205)+_0x42c0ad+'\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string');if(_0x1a3366[_0x146141(0x219)]!==undefined&&typeof _0x1a3366[_0x146141(0x219)]!==_0x146141(0x1e5))throw new Error(_0x146141(0x205)+_0x42c0ad+_0x146141(0x209));if(_0x1a3366[_0x146141(0x1e2)]!==undefined&&typeof _0x1a3366[_0x146141(0x1e2)]!==_0x146141(0x1e5))throw new Error('Profile\x20\x27'+_0x42c0ad+_0x146141(0x21d));return!![];}function loadProfilesFromTdxJson(_0x1806bd,_0x4a0e50){const _0x1793db=a51_0x496a;if(!a51_0x2f4cf9[_0x1793db(0x1fa)](_0x1806bd))return[];try{const _0x3ca6d6=a51_0x2f4cf9['readFileSync'](_0x1806bd,'utf-8'),_0x31515e=JSON[_0x1793db(0x21e)](_0x3ca6d6);if(!_0x31515e['profiles']||typeof _0x31515e[_0x1793db(0x1e7)]!==_0x1793db(0x208))return[];const _0x525c03=[];for(const [_0x713c3d,_0xdb8dbb]of Object[_0x1793db(0x1ed)](_0x31515e[_0x1793db(0x1e7)])){try{validateProfileConfig(_0xdb8dbb,_0x713c3d);const _0x4fbecf=getNewCredentialPath(_0x713c3d),_0x167400=getOldCredentialPath(_0x713c3d),_0x226069=a51_0x2f4cf9[_0x1793db(0x1fa)](_0x4fbecf)||a51_0x2f4cf9[_0x1793db(0x1fa)](_0x167400);_0x525c03[_0x1793db(0x20a)]({'name':_0x713c3d,'config':_0xdb8dbb,'metadata':{'name':_0x713c3d,'createdAt':new Date()[_0x1793db(0x21f)]()},'hasCredentials':_0x226069,'scope':_0x4a0e50});}catch(_0x13d0ab){_0x13d0ab instanceof Error&&(console[_0x1793db(0x1e4)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x1806bd+':'),console[_0x1793db(0x1e4)]('\x20\x20'+_0x13d0ab[_0x1793db(0x1f0)]+'\x0a'));}}return _0x525c03;}catch(_0x5efb55){return _0x5efb55 instanceof SyntaxError?(console[_0x1793db(0x1e4)](_0x1793db(0x218)+_0x1806bd+':\x20Invalid\x20JSON\x20syntax'),console[_0x1793db(0x1e4)](_0x1793db(0x1df)+_0x5efb55[_0x1793db(0x1f0)]+'\x0a')):console[_0x1793db(0x1e4)](_0x1793db(0x20d)+_0x1806bd+':\x20'+_0x5efb55+'\x0a'),[];}}export function getNewCredentialPath(_0x1ea215){const _0x3b21e1=a51_0x496a;return a51_0x1e16bd[_0x3b21e1(0x1d5)](getConfigDir(),_0x3b21e1(0x212)+_0x1ea215);}function getOldCredentialPath(_0x17b34c){const _0x272629=a51_0x496a;return a51_0x1e16bd[_0x272629(0x1d5)](getProfilesDir(),_0x17b34c,'.env');}function loadProfilesFromTdxJsonFiles(){const _0x662621=a51_0x496a,_0x49bd03=[],_0x1ff805=findProjectConfigPath();_0x1ff805&&_0x49bd03['push'](...loadProfilesFromTdxJson(_0x1ff805,'local'));const _0x5b41b8=a51_0x1e16bd[_0x662621(0x1d5)](getConfigDir(),'tdx.json');return _0x49bd03[_0x662621(0x20a)](...loadProfilesFromTdxJson(_0x5b41b8,_0x662621(0x1e8))),_0x49bd03;}function loadProfilesFromDirectories(){const _0x465b84=a51_0x496a,_0x58449f=getProfilesDir();if(!a51_0x2f4cf9['existsSync'](_0x58449f))return[];try{return a51_0x2f4cf9[_0x465b84(0x207)](_0x58449f,{'withFileTypes':!![]})[_0x465b84(0x1ff)](_0x4c6674=>_0x4c6674[_0x465b84(0x200)]())[_0x465b84(0x211)](_0x5260ab=>_0x5260ab[_0x465b84(0x1f2)])['filter'](_0x44afcc=>{const _0x2610cf=_0x465b84,_0x496cbc=getProfileConfigPath(_0x44afcc),_0x1e5a06=getProfileEnvPath(_0x44afcc);return a51_0x2f4cf9[_0x2610cf(0x1fa)](_0x496cbc)||a51_0x2f4cf9['existsSync'](_0x1e5a06);})[_0x465b84(0x211)](_0x26a484=>{const _0x41709f=loadProfileFromDirectory(_0x26a484);if(_0x41709f)return{..._0x41709f,'scope':'directory'};return null;})[_0x465b84(0x1ff)](_0x16245a=>_0x16245a!==null);}catch{return[];}}function loadProfileFromDirectory(_0x369f30){const _0x3d0a97=a51_0x496a,_0x5dcc36=getProfileConfigPath(_0x369f30),_0x239ff9=getOldCredentialPath(_0x369f30);if(!a51_0x2f4cf9[_0x3d0a97(0x1fa)](_0x5dcc36)&&!a51_0x2f4cf9[_0x3d0a97(0x1fa)](_0x239ff9))return null;let _0x3e56a2={},_0x10fe62={'name':_0x369f30,'createdAt':new Date()['toISOString']()};if(a51_0x2f4cf9[_0x3d0a97(0x1fa)](_0x5dcc36))try{const _0x2e5edb=a51_0x2f4cf9[_0x3d0a97(0x20b)](_0x5dcc36,_0x3d0a97(0x213)),_0x3f3339=JSON[_0x3d0a97(0x21e)](_0x2e5edb),{metadata:_0x8ce199,..._0x385e32}=_0x3f3339;_0x3e56a2=_0x385e32,_0x8ce199&&(_0x10fe62=_0x8ce199);}catch{}return{'name':_0x369f30,'config':_0x3e56a2,'metadata':_0x10fe62,'hasCredentials':a51_0x2f4cf9['existsSync'](_0x239ff9),'scope':'directory'};}export function listProfiles(){const _0x5cec19=a51_0x496a,_0x485e91=loadProfilesFromTdxJsonFiles(),_0x47af24=loadProfilesFromDirectories();if(_0x47af24['length']>0x0){const _0x24b282=_0x47af24[_0x5cec19(0x211)](_0x149d39=>_0x149d39[_0x5cec19(0x1f2)])[_0x5cec19(0x1d5)](',\x20'),_0x4e0f88=getConfigDir();console[_0x5cec19(0x1e4)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x24b282),console[_0x5cec19(0x1e4)]('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x5cec19(0x1e4)](_0x5cec19(0x1ea)+a51_0x1e16bd[_0x5cec19(0x1d5)](_0x4e0f88,_0x5cec19(0x1fc))),console[_0x5cec19(0x1e4)](_0x5cec19(0x1d7)),console[_0x5cec19(0x1e4)](_0x5cec19(0x1f7));}const _0x5802f2=[..._0x485e91,..._0x47af24],_0x505241=new Map();for(const _0x401174 of _0x5802f2){!_0x505241['has'](_0x401174[_0x5cec19(0x1f2)])&&_0x505241[_0x5cec19(0x1d6)](_0x401174['name'],_0x401174);}return Array[_0x5cec19(0x1f5)](_0x505241['values']())[_0x5cec19(0x1da)]((_0x6641ea,_0x3338fe)=>_0x6641ea[_0x5cec19(0x1f2)][_0x5cec19(0x1e3)](_0x3338fe['name']));}export function profileExists(_0x2a5888){const _0x565dd9=a51_0x496a,_0x1e3ab1=listProfiles();return _0x1e3ab1[_0x565dd9(0x1fe)](_0x130ff0=>_0x130ff0[_0x565dd9(0x1f2)]===_0x2a5888);}export function loadProfile(_0x39bc08){const _0x41c266=a51_0x496a;validateProfileName(_0x39bc08);const _0x1d89cb=listProfiles(),_0x4c1b6a=_0x1d89cb[_0x41c266(0x20e)](_0xe00aa0=>_0xe00aa0[_0x41c266(0x1f2)]===_0x39bc08);return _0x4c1b6a||null;}export function saveProfile(_0x3eb63d,_0x40e2ab,_0x2ba95e=![]){saveProfileToUserConfig(_0x3eb63d,_0x40e2ab);}export function deleteProfile(_0x409087){const _0x168ee2=a51_0x496a;validateProfileName(_0x409087);const _0x5835ff=getProfileDir(_0x409087);if(!a51_0x2f4cf9[_0x168ee2(0x1fa)](_0x5835ff))throw new Error('Profile\x20'+_0x409087+_0x168ee2(0x217));a51_0x2f4cf9[_0x168ee2(0x204)](_0x5835ff,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x277558,_0x3e99bb){const _0x10f560=a51_0x496a;validateProfileName(_0x277558);const _0x4f6b51=getGlobalConfigPath(),_0x3179b7=getConfigDir();!a51_0x2f4cf9['existsSync'](_0x3179b7)&&createSecureDirectory(_0x3179b7);let _0x37a74b={};if(a51_0x2f4cf9[_0x10f560(0x1fa)](_0x4f6b51))try{const _0x3efd12=a51_0x2f4cf9[_0x10f560(0x20b)](_0x4f6b51,'utf-8');_0x37a74b=JSON['parse'](_0x3efd12);}catch{console[_0x10f560(0x1e4)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x4f6b51+_0x10f560(0x201));}!_0x37a74b[_0x10f560(0x1e7)]&&(_0x37a74b[_0x10f560(0x1e7)]={}),_0x37a74b[_0x10f560(0x1e7)][_0x277558]=_0x3e99bb,writeSecureFile(_0x4f6b51,JSON[_0x10f560(0x1db)](_0x37a74b,null,0x2));}function a51_0x496a(_0x9f85df,_0x342e90){_0x9f85df=_0x9f85df-0x1d5;const _0x1d4586=a51_0x1d45();let _0x496aa1=_0x1d4586[_0x9f85df];return _0x496aa1;}export function getActiveProfile(){const _0x3ad851=a51_0x496a,_0x591775=loadSessionContext();if(_0x591775?.['profile'])return _0x591775[_0x3ad851(0x220)];const _0x29f585=getGlobalConfigPath();if(!a51_0x2f4cf9[_0x3ad851(0x1fa)](_0x29f585))return null;try{const _0x4567b5=a51_0x2f4cf9[_0x3ad851(0x20b)](_0x29f585,_0x3ad851(0x213)),_0x3c2528=JSON['parse'](_0x4567b5);return _0x3c2528[_0x3ad851(0x220)]||null;}catch{return null;}}export function createProfile(_0x49af3f,_0x54b5cc){const _0x15b2ae=a51_0x496a;validateProfileName(_0x49af3f);if(profileExists(_0x49af3f))throw new Error(_0x15b2ae(0x215)+_0x49af3f+_0x15b2ae(0x203));saveProfile(_0x49af3f,_0x54b5cc);}export function saveProfileCredentials(_0x383c14,_0xa70f19){const _0x9e519c=a51_0x496a;validateProfileName(_0x383c14);if(!profileExists(_0x383c14))throw new Error(_0x9e519c(0x215)+_0x383c14+_0x9e519c(0x217));const _0x244776=getNewCredentialPath(_0x383c14);writeSecureFile(_0x244776,_0xa70f19);}export function loadProfileCredentials(_0x1e63eb){const _0x1e07a3=a51_0x496a;validateProfileName(_0x1e63eb);const _0x1b862c=getNewCredentialPath(_0x1e63eb);if(a51_0x2f4cf9[_0x1e07a3(0x1fa)](_0x1b862c))try{return a51_0x2f4cf9[_0x1e07a3(0x20b)](_0x1b862c,_0x1e07a3(0x213));}catch{}const _0x381f36=getOldCredentialPath(_0x1e63eb);if(a51_0x2f4cf9[_0x1e07a3(0x1fa)](_0x381f36)){console[_0x1e07a3(0x1e4)](_0x1e07a3(0x214)+_0x1e63eb+'\x27'),console[_0x1e07a3(0x1e4)](_0x1e07a3(0x1e6)),console[_0x1e07a3(0x1e4)](_0x1e07a3(0x1f9)+_0x381f36+_0x1e07a3(0x1ef)+_0x1b862c+'\x22'),console['warn'](_0x1e07a3(0x20c));try{return a51_0x2f4cf9[_0x1e07a3(0x20b)](_0x381f36,_0x1e07a3(0x213));}catch{return null;}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a52_0x4b8a36=a52_0x49ad;(function(_0x510d75,_0x31a672){const _0x33eae3=a52_0x49ad,_0xb641a7=_0x510d75();while(!![]){try{const _0x55340=parseInt(_0x33eae3(0x1b8))/0x1+parseInt(_0x33eae3(0x1b6))/0x2+-parseInt(_0x33eae3(0x1ac))/0x3*(parseInt(_0x33eae3(0x1b7))/0x4)+-parseInt(_0x33eae3(0x1ae))/0x5*(parseInt(_0x33eae3(0x1af))/0x6)+-parseInt(_0x33eae3(0x1a4))/0x7+-parseInt(_0x33eae3(0x1ad))/0x8*(parseInt(_0x33eae3(0x1b4))/0x9)+parseInt(_0x33eae3(0x1bd))/0xa;if(_0x55340===_0x31a672)break;else _0xb641a7['push'](_0xb641a7['shift']());}catch(_0x2b169a){_0xb641a7['push'](_0xb641a7['shift']());}}}(a52_0x4429,0x679df));import*as a52_0x4e3088 from'node:fs';import*as a52_0x56db74 from'node:path';const PROJECT_CONFIG_FILENAME=a52_0x4b8a36(0x1b1);export function findProjectConfigPath(_0xa002a0){const _0x21ba1a=a52_0x4b8a36;let _0x45f64e=_0xa002a0||process['cwd']();while(!![]){const _0x26d735=a52_0x56db74[_0x21ba1a(0x1a3)](_0x45f64e,PROJECT_CONFIG_FILENAME);if(a52_0x4e3088[_0x21ba1a(0x1b2)](_0x26d735))return _0x26d735;const _0x445116=a52_0x56db74[_0x21ba1a(0x1bc)](_0x45f64e);if(_0x445116===_0x45f64e)return null;_0x45f64e=_0x445116;}}export function loadProjectConfig(_0x4b5475){const _0xe0a8d7=a52_0x4b8a36,_0x4ac0d9=findProjectConfigPath(_0x4b5475);if(!_0x4ac0d9)return null;try{const _0xc2c1f0=a52_0x4e3088[_0xe0a8d7(0x1aa)](_0x4ac0d9,'utf-8'),_0xbe4cd0=JSON['parse'](_0xc2c1f0),_0x1d3af0=JSON['stringify'](_0xbe4cd0);if(_0x1d3af0[_0xe0a8d7(0x1a6)](_0xe0a8d7(0x1a9))||_0x1d3af0[_0xe0a8d7(0x1a6)](_0xe0a8d7(0x1ba))||_0x1d3af0[_0xe0a8d7(0x1a6)](_0xe0a8d7(0x1bb)))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x4ac0d9+_0xe0a8d7(0x1b9)+_0xe0a8d7(0x1a5));const {metadata:_0x24165c,profile:_0x27ab0d,..._0x104b0f}=_0xbe4cd0;return _0x27ab0d&&console['warn']('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x4ac0d9+'\x20is\x20ignored.\x20'+_0xe0a8d7(0x1b0)),_0x104b0f;}catch(_0x378a08){if(_0x378a08 instanceof Error&&_0xe0a8d7(0x1b3)in _0x378a08&&_0x378a08[_0xe0a8d7(0x1b3)]==='ENOENT')return null;throw new Error(_0xe0a8d7(0x1a8)+_0x4ac0d9+':\x20'+_0x378a08);}}export function saveProjectConfig(_0x5d9289,_0x2d1ae5){const _0x704cd3=a52_0x4b8a36,_0x20dba1=_0x2d1ae5||process['cwd'](),_0xe073b7=a52_0x56db74['join'](_0x20dba1,PROJECT_CONFIG_FILENAME),_0x427b94=JSON[_0x704cd3(0x1b5)](_0x5d9289);if(_0x427b94[_0x704cd3(0x1a6)](_0x704cd3(0x1a9))||_0x427b94[_0x704cd3(0x1a6)]('apiKey')||_0x427b94[_0x704cd3(0x1a6)]('api_key'))throw new Error(_0x704cd3(0x1a2));if('profile'in _0x5d9289)throw new Error(_0x704cd3(0x1ab));a52_0x4e3088[_0x704cd3(0x1a7)](_0xe073b7,JSON[_0x704cd3(0x1b5)](_0x5d9289,null,0x2));}export function hasProjectConfig(_0x29d00a){return findProjectConfigPath(_0x29d00a)!==null;}function a52_0x49ad(_0xdec328,_0xae0fe6){_0xdec328=_0xdec328-0x1a2;const _0x44290d=a52_0x4429();let _0x49ad71=_0x44290d[_0xdec328];return _0x49ad71;}export function getProjectRoot(_0x24f7bd){const _0x3adb0d=a52_0x4b8a36,_0x36def7=findProjectConfigPath(_0x24f7bd);return _0x36def7?a52_0x56db74[_0x3adb0d(0x1bc)](_0x36def7):null;}function a52_0x4429(){const _0x3071d8=['API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','join','706622aRDOKP','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','includes','writeFileSync','Failed\x20to\x20load\x20project\x20config\x20from\x20','TD_API_KEY','readFileSync','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','330207ZASlXR','40LxLpxX','29030zYvcxp','720DeNzLE','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','tdx.json','existsSync','code','112851EmZXoB','stringify','627342whVTdm','12vBXCex','391214GeeVSR',').\x20','apiKey','api_key','dirname','9100980TYRCXt'];a52_0x4429=function(){return _0x3071d8;};return a52_0x4429();}
|