@treasuredata/tdx 0.8.5 → 0.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +2 -2
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/engage-api-client.js +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.d.ts +1 -0
- package/dist/commands/claude-command.d.ts.map +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-command.js.map +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/context-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/chat-cache.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/command-output.js +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/fields-display.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/llm-backup-utils.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/model-factors.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.d.ts.map +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/process.js.map +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-config.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a41_0x3f75b2=a41_0x5520;(function(_0x47a6ef,_0x5037e6){const _0x9f3781=a41_0x5520,_0x2e5c56=_0x47a6ef();while(!![]){try{const _0x3cb308=-parseInt(_0x9f3781(0x7e))/0x1+-parseInt(_0x9f3781(0x93))/0x2+-parseInt(_0x9f3781(0x90))/0x3*(-parseInt(_0x9f3781(0xaa))/0x4)+parseInt(_0x9f3781(0xa9))/0x5*(parseInt(_0x9f3781(0x96))/0x6)+parseInt(_0x9f3781(0x9f))/0x7*(parseInt(_0x9f3781(0x9c))/0x8)+-parseInt(_0x9f3781(0x8a))/0x9*(parseInt(_0x9f3781(0x99))/0xa)+parseInt(_0x9f3781(0x81))/0xb*(parseInt(_0x9f3781(0x8d))/0xc);if(_0x3cb308===_0x5037e6)break;else _0x2e5c56['push'](_0x2e5c56['shift']());}catch(_0x55e4a2){_0x2e5c56['push'](_0x2e5c56['shift']());}}}(a41_0x3428,0x9bd07));import{BaseCommand}from'./command.js';import{saveSessionContext,getCurrentSessionPID,cleanExpiredSessions,clearSessionContext}from'../core/session.js';function a41_0x5520(_0x357bdb,_0x16d6ed){_0x357bdb=_0x357bdb-0x7c;const _0x34287e=a41_0x3428();let _0x55203b=_0x34287e[_0x357bdb];return _0x55203b;}function a41_0x3428(){const _0x1a5190=['Session\x20database\x20set\x20to:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20use\x20--clear\x20\x20\x20\x20\x20\x20#\x20Clear\x20session\x20context\x0a','profile','1231107VCjOqV','length','toString','437591qPhBNC','\x0aSet\x20context:\x20tdx\x20use\x20<resource>\x20<value>','Resources:\x20database,\x20parent_segment,\x20llm_project,\x20profile,\x20engage_workspace','use','Session\x20llm_project\x20set\x20to:\x20','message','validate','Invalid\x20resource:\x20','parent_segment','9rCvEvP','error','includes','300FueSxs','Set\x20session-level\x20context','dim','1431qOiJaA','displayWithSources','(session:\x20','2370402uKzIZf','Usage:\x20tdx\x20use\x20<resource>\x20<value>\x0a','engage_workspace','30sZSMeu','debug','session','2814610TgVejg','cleared','execute','8672536UGKmNa','green','display','7gyxIIj','Error:\x20','Error:\x20Profile\x20\x27','name','.\x20Must\x20be\x20one\x20of:\x20','\x0aUse\x20\x27tdx\x20profiles\x27\x20to\x20see\x20available\x20profiles','llm_project','Session\x20profile\x20set\x20to:\x20','log','\x0aTip:\x20Use\x20\x27tdx\x20use\x20--clear\x27\x20to\x20clear\x20session\x20overrides','722675crvIbN','4484nABrsQ','Session\x20engage_workspace\x20set\x20to:\x20','Session\x20context\x20','database','\x0aResources:\x20database,\x20parent_segment,\x20llm_project,\x20profile,\x20engage_workspace\x0a'];a41_0x3428=function(){return _0x1a5190;};return a41_0x3428();}import{profileExists}from'../core/profile.js';import{GlobalContext}from'../core/global-context.js';import a41_0x44e6f6 from'chalk';export class UseCommand extends BaseCommand{[a41_0x3f75b2(0xa2)]=a41_0x3f75b2(0x84);['description']=a41_0x3f75b2(0x8e);[a41_0x3f75b2(0x87)](_0x4e4d79){const _0x3a037a=a41_0x3f75b2,{args:_0x5e9546}=_0x4e4d79;if(_0x5e9546[_0x3a037a(0x7f)]===0x0)return undefined;if(_0x5e9546['length']===0x1)return _0x3a037a(0x94)+'\x20\x20\x20\x20\x20\x20\x20tdx\x20use\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Show\x20current\x20context\x0a'+_0x3a037a(0x7c)+_0x3a037a(0xae)+'\x0aRun\x20\x27tdx\x20use\x20--help\x27\x20for\x20more\x20options';const _0x2dd4a5=_0x5e9546[0x0],_0x5397a8=[_0x3a037a(0xad),_0x3a037a(0x89),'llm_project',_0x3a037a(0x7d),_0x3a037a(0x95)];if(!_0x5397a8[_0x3a037a(0x8c)](_0x2dd4a5))return _0x3a037a(0x88)+_0x2dd4a5+_0x3a037a(0xa3)+_0x5397a8['join'](',\x20');return undefined;}async[a41_0x3f75b2(0x9b)](_0x33b125){const _0x56c6b2=a41_0x3f75b2,{args:_0x2cfb18,options:_0x442db9}=_0x33b125,_0x33c2b6=_0x442db9[_0x56c6b2(0x97)],_0x44c36a=_0x442db9['clear'];cleanExpiredSessions();try{if(_0x44c36a){clearSessionContext(_0x442db9[_0x56c6b2(0x98)]);const _0x2358b=_0x442db9[_0x56c6b2(0x98)]||getCurrentSessionPID()[_0x56c6b2(0x80)]();return console[_0x56c6b2(0xa7)](_0x56c6b2(0xac)+a41_0x44e6f6[_0x56c6b2(0x9d)](_0x56c6b2(0x9a))+'\x20'+a41_0x44e6f6[_0x56c6b2(0x8f)](_0x56c6b2(0x92)+_0x2358b+')')),0x0;}if(_0x2cfb18[_0x56c6b2(0x7f)]===0x0){const _0x5886db=new GlobalContext(_0x442db9);return _0x33c2b6?_0x5886db[_0x56c6b2(0x91)]():_0x5886db[_0x56c6b2(0x9e)](),console[_0x56c6b2(0xa7)](a41_0x44e6f6[_0x56c6b2(0x8f)](_0x56c6b2(0x82))),console[_0x56c6b2(0xa7)](a41_0x44e6f6[_0x56c6b2(0x8f)](_0x56c6b2(0x83))),0x0;}const _0x5e1da7=_0x2cfb18[0x0],_0xb6c0ac=_0x2cfb18[0x1];if(_0x5e1da7===_0x56c6b2(0x7d)){if(!profileExists(_0xb6c0ac))return console[_0x56c6b2(0x8b)](_0x56c6b2(0xa1)+_0xb6c0ac+'\x27\x20does\x20not\x20exist'),console[_0x56c6b2(0x8b)](_0x56c6b2(0xa4)),0x1;const _0x8967e4=_0x442db9[_0x56c6b2(0x98)]||getCurrentSessionPID()['toString']();return saveSessionContext({'profile':_0xb6c0ac},_0x442db9['session']),console[_0x56c6b2(0xa7)](_0x56c6b2(0xa6)+a41_0x44e6f6[_0x56c6b2(0x9d)](_0xb6c0ac)+'\x20'+a41_0x44e6f6['dim'](_0x56c6b2(0x92)+_0x8967e4+')')),console[_0x56c6b2(0xa7)](a41_0x44e6f6['dim'](_0x56c6b2(0xa8))),0x0;}const _0x43c8e5={},_0x44e44f=_0x442db9['session']||getCurrentSessionPID()[_0x56c6b2(0x80)]();switch(_0x5e1da7){case _0x56c6b2(0xad):_0x43c8e5[_0x56c6b2(0xad)]=_0xb6c0ac,console[_0x56c6b2(0xa7)](_0x56c6b2(0xaf)+a41_0x44e6f6['green'](_0xb6c0ac)+'\x20'+a41_0x44e6f6[_0x56c6b2(0x8f)](_0x56c6b2(0x92)+_0x44e44f+')'));break;case _0x56c6b2(0x89):_0x43c8e5['parent_segment']=_0xb6c0ac,console[_0x56c6b2(0xa7)]('Session\x20parent_segment\x20set\x20to:\x20'+a41_0x44e6f6['green'](_0xb6c0ac)+'\x20'+a41_0x44e6f6[_0x56c6b2(0x8f)]('(session:\x20'+_0x44e44f+')'));break;case'llm_project':_0x43c8e5[_0x56c6b2(0xa5)]=_0xb6c0ac,console[_0x56c6b2(0xa7)](_0x56c6b2(0x85)+a41_0x44e6f6[_0x56c6b2(0x9d)](_0xb6c0ac)+'\x20'+a41_0x44e6f6[_0x56c6b2(0x8f)](_0x56c6b2(0x92)+_0x44e44f+')'));break;case _0x56c6b2(0x95):_0x43c8e5[_0x56c6b2(0x95)]=_0xb6c0ac,console['log'](_0x56c6b2(0xab)+a41_0x44e6f6[_0x56c6b2(0x9d)](_0xb6c0ac)+'\x20'+a41_0x44e6f6[_0x56c6b2(0x8f)](_0x56c6b2(0x92)+_0x44e44f+')'));break;}return saveSessionContext(_0x43c8e5,_0x442db9[_0x56c6b2(0x98)]),console[_0x56c6b2(0xa7)](a41_0x44e6f6[_0x56c6b2(0x8f)](_0x56c6b2(0xa8))),0x0;}catch(_0x5f1f14){return _0x5f1f14 instanceof Error&&console[_0x56c6b2(0x8b)](_0x56c6b2(0xa0)+_0x5f1f14[_0x56c6b2(0x86)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a42_0x39142f=a42_0x58bd;function a42_0x4372(){const _0x207d00=['list','510636LlqhQC','getCurrent','2498172meVMLv','143DEpVnA','List\x20all\x20users\x20in\x20the\x20account','Error:\x20','\x20\x20Cause:\x20','2cwKMhv','258724wAGoca','user','cause','7UOubXd','error','execute','description','8iYAXMJ','name','Show\x20current\x20user\x20information','291758wZfjFa','141190JRQRvf','Listing\x20users...','verbose','9HMgIZW','1131610LGOGZF','length','✔\x20Found\x20','data','1158426sIGGJU'];a42_0x4372=function(){return _0x207d00;};return a42_0x4372();}(function(_0xfcd5fb,_0x326ab6){const _0x3be9f3=a42_0x58bd,_0x2ff111=_0xfcd5fb();while(!![]){try{const _0x3d5dba=-parseInt(_0x3be9f3(0x119))/0x1*(parseInt(_0x3be9f3(0x10e))/0x2)+-parseInt(_0x3be9f3(0x11d))/0x3*(-parseInt(_0x3be9f3(0x10f))/0x4)+parseInt(_0x3be9f3(0x11e))/0x5+parseInt(_0x3be9f3(0x124))/0x6*(-parseInt(_0x3be9f3(0x112))/0x7)+parseInt(_0x3be9f3(0x116))/0x8*(parseInt(_0x3be9f3(0x122))/0x9)+-parseInt(_0x3be9f3(0x11a))/0xa*(-parseInt(_0x3be9f3(0x127))/0xb)+-parseInt(_0x3be9f3(0x126))/0xc;if(_0x3d5dba===_0x326ab6)break;else _0x2ff111['push'](_0x2ff111['shift']());}catch(_0x24e6f8){_0x2ff111['push'](_0x2ff111['shift']());}}}(a42_0x4372,0x2407d));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';export class UserCommand extends BaseCommand{[a42_0x39142f(0x117)]=a42_0x39142f(0x110);['description']=a42_0x39142f(0x118);async[a42_0x39142f(0x114)](_0x2a6c34){const _0x127853=a42_0x39142f,{options:_0x2b40af,tdx:_0x54d789}=_0x2a6c34;try{const _0x911fb=await withSpinner('Fetching\x20user\x20info...',()=>_0x54d789[_0x127853(0x110)][_0x127853(0x125)](),{'verbose':_0x2b40af['verbose']}),_0x2c3756=_0x911fb[_0x127853(0x121)];return await handleSingleObjectOutput(_0x2c3756,_0x2b40af),0x0;}catch(_0x2e009b){if(_0x2e009b instanceof SDKError)return console['error'](_0x127853(0x129)+_0x2e009b['message']),_0x2e009b[_0x127853(0x111)]&&console[_0x127853(0x113)]('\x20\x20Cause:\x20'+_0x2e009b[_0x127853(0x111)]),0x1;throw _0x2e009b;}}}function a42_0x58bd(_0xaccb02,_0x23f96a){_0xaccb02=_0xaccb02-0x10d;const _0x437245=a42_0x4372();let _0x58bd73=_0x437245[_0xaccb02];return _0x58bd73;}export class UserListCommand extends BaseCommand{['name']='user\x20list';[a42_0x39142f(0x115)]=a42_0x39142f(0x128);async[a42_0x39142f(0x114)](_0x352506){const _0x512dff=a42_0x39142f,{options:_0x19e85f,tdx:_0x2c51d7}=_0x352506;try{const _0x531075=await withSpinner(_0x512dff(0x11b),()=>_0x2c51d7[_0x512dff(0x110)][_0x512dff(0x123)](),{'verbose':_0x19e85f[_0x512dff(0x11c)]}),_0x2da7ae=_0x531075[_0x512dff(0x121)];return console[_0x512dff(0x113)](_0x512dff(0x120)+_0x2da7ae[_0x512dff(0x11f)]+'\x20user'+(_0x2da7ae[_0x512dff(0x11f)]!==0x1?'s':'')),await handleSDKOutput(_0x2da7ae,_0x19e85f),0x0;}catch(_0x280a8d){if(_0x280a8d instanceof SDKError)return console[_0x512dff(0x113)]('Error:\x20'+_0x280a8d['message']),_0x280a8d['cause']&&console[_0x512dff(0x113)](_0x512dff(0x10d)+_0x280a8d[_0x512dff(0x111)]),0x1;throw _0x280a8d;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0xd64fae=a43_0x3052;function a43_0x53f8(){const _0x18181d=['Killing\x20attempt...','Workflow:\x20','No\x20log\x20files\x20found\x20for\x20this\x20attempt','Error:\x20','Kill\x20a\x20running\x20attempt','workflow:logs','resumeFrom','filesExtracted','Parameters:\x20','Pushing\x20workflow\x20project...','attempt','\x20\x20Revision:\x20','...','Retry\x20a\x20session\x20or\x20attempt','Listing\x20workflow\x20attempts...','fileSize','success','yes','workflow:projects','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','retrySession','9KzkSKf','Params:\x20','revision','Listing\x20workflow\x20projects...','params','startsWith','taskName','limit','done','error','cause','Error:\x20Workflow\x20identifier\x20is\x20required','\x20\x20Project:\x20','Listing\x20workflow\x20sessions...','keys','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','index','✔\x20Retry\x20started','✔\x20Workflow\x20run\x20started','\x22?\x20This\x20cannot\x20be\x20undone.','322557SyVkKL','\x20\x20Attempt\x20ID:\x20','1668768vrNPzX','tasks','542472LvcGvP','Revision:\x20','Task\x20name:\x20','Show\x20specific\x20attempt\x20details','Start\x20a\x20workflow\x20run','indexOf','round','workflow:retry','run','Project:\x20','From\x20task:\x20','✔\x20Found\x20','description','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','workflow','attempts','stat','format','reason','Error:\x20Invalid\x20parameter\x20format:\x20','retryAttempt','length','\x20\x20Files\x20extracted:\x20','Getting\x20attempt\x20details...','split','execute','finishedAt','\x20is\x20not\x20a\x20directory','select','Project\x20filter:\x20','project','cancelRequested','2JlLWsQ','kill','Downloading\x20project\x20','Show\x20tasks\x20for\x20an\x20attempt','Include\x20retried:\x20yes','isArray','Select\x20a\x20task\x20to\x20view\x20logs:','Target:\x20','1566080GFAbae','utf-8','workflow:attempt','json','Filter:\x20project=','Downloading\x20logs...','List\x20workflows','projectId','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','Resume\x20from:\x20','\x20session','\x20\x20Project\x20ID:\x20','\x20\x20Session\x20ID:\x20','projectName','substring','name','Error:\x20Attempt\x20ID\x20is\x20required','\x20task','\x20\x20Cause:\x20','fs/promises','Pattern:\x20','status','download','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','task','\x20attempt','workflow:sessions','Fetching\x20log\x20files...','stringify','Expected\x20format:\x20--param\x20key=value','readFile','List\x20workflow\x20execution\x20sessions','createdAt','Status:\x20','Show\x20logs\x20for\x20a\x20workflow\x20attempt','sessions','Deleting\x20project\x20','sessionId','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','from','158818PdkPyU','map','message','Error:\x20Invalid\x20JSON\x20in\x20--params','canceling','sessionTime','Attempt\x20ID:\x20','Filter:\x20','Including\x20subtasks:\x20yes','log','Validation:\x20skipped','delete','Retrying\x20attempt...','includeSubtasks','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','✔\x20Downloaded\x20','running','537535OCwWOc','Starting\x20workflow\x20run...','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Cancelled','1757525BOFqbr','skipValidation','Session\x20time:\x20','force','fromTask','data','verbose','attemptId','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','Project\x20name:\x20','\x20project','getTime','includeRetried','isDirectory','session','12aEuDDS','\x20workflow','Getting\x20attempt\x20tasks...','List\x20all\x20workflow\x20projects','session:','parse','retryAttemptName','✔\x20Pushed\x20','param'];a43_0x53f8=function(){return _0x18181d;};return a43_0x53f8();}(function(_0x165675,_0x2b91d7){const _0x544bc1=a43_0x3052,_0x35ae02=_0x165675();while(!![]){try{const _0x56b93a=-parseInt(_0x544bc1(0x185))/0x1*(-parseInt(_0x544bc1(0x1ff))/0x2)+-parseInt(_0x544bc1(0x1db))/0x3+parseInt(_0x544bc1(0x1df))/0x4+-parseInt(_0x544bc1(0x196))/0x5*(-parseInt(_0x544bc1(0x1a9))/0x6)+-parseInt(_0x544bc1(0x19a))/0x7+parseInt(_0x544bc1(0x1dd))/0x8*(parseInt(_0x544bc1(0x1c7))/0x9)+-parseInt(_0x544bc1(0x15c))/0xa;if(_0x56b93a===_0x2b91d7)break;else _0x35ae02['push'](_0x35ae02['shift']());}catch(_0x422474){_0x35ae02['push'](_0x35ae02['shift']());}}}(a43_0x53f8,0x3185c));import{BaseCommand}from'./command.js';function a43_0x3052(_0x1b44d4,_0x12748e){_0x1b44d4=_0x1b44d4-0x15c;const _0x53f8a0=a43_0x53f8();let _0x305222=_0x53f8a0[_0x1b44d4];return _0x305222;}import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{formatBytes}from'../utils/formatters.js';import a43_0x2cbd65 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a43_0xd64fae(0x16b)]=a43_0xd64fae(0x1c4);[a43_0xd64fae(0x1eb)]=a43_0xd64fae(0x1ac);async['execute'](_0x1dc9c2){const _0x3acd1f=a43_0xd64fae,{options:_0x160a70,args:_0x1df96b,tdx:_0x447555}=_0x1dc9c2,_0x339f75=_0x1df96b[0x0];try{_0x160a70[_0x3acd1f(0x1a0)]&&_0x339f75&&console['error'](_0x3acd1f(0x170)+_0x339f75);const _0x210820=await withSpinner(_0x3acd1f(0x1ca),()=>_0x447555[_0x3acd1f(0x1ed)]['projects'](_0x339f75,{'limit':_0x160a70['limit']}),{'verbose':_0x160a70[_0x3acd1f(0x1a0)]}),_0x32645e=_0x210820[_0x3acd1f(0x19f)];return console[_0x3acd1f(0x1d0)](_0x3acd1f(0x1ea)+_0x32645e['length']+_0x3acd1f(0x1a4)+(_0x32645e['length']!==0x1?'s':'')),await handleSDKOutput(_0x32645e,_0x160a70),0x0;}catch(_0x5dee9f){if(_0x5dee9f instanceof SDKError)return console[_0x3acd1f(0x1d0)]('Error:\x20'+_0x5dee9f[_0x3acd1f(0x187)]),_0x5dee9f[_0x3acd1f(0x1d1)]&&console[_0x3acd1f(0x1d0)](_0x3acd1f(0x16e)+_0x5dee9f[_0x3acd1f(0x1d1)]),0x1;throw _0x5dee9f;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a43_0xd64fae(0x16b)]='workflow:workflows';['description']=a43_0xd64fae(0x162);async[a43_0xd64fae(0x1f8)](_0x303795){const _0x509e44=a43_0xd64fae,{options:_0x4ae4da,args:_0x2b0e82,tdx:_0x504142}=_0x303795,_0x3914e5=_0x2b0e82[0x0];try{_0x4ae4da[_0x509e44(0x1a0)]&&_0x3914e5&&console[_0x509e44(0x1d0)](_0x509e44(0x1fc)+_0x3914e5);const _0x586837=await withSpinner('Listing\x20workflows...',()=>_0x504142['workflow']['workflows'](_0x3914e5,{'limit':_0x4ae4da[_0x509e44(0x1ce)]}),{'verbose':_0x4ae4da[_0x509e44(0x1a0)]}),_0x5d8eb9=_0x586837[_0x509e44(0x19f)];return console[_0x509e44(0x1d0)](_0x509e44(0x1ea)+_0x5d8eb9[_0x509e44(0x1f4)]+_0x509e44(0x1aa)+(_0x5d8eb9[_0x509e44(0x1f4)]!==0x1?'s':'')),await handleSDKOutput(_0x5d8eb9,_0x4ae4da),0x0;}catch(_0x4d0e72){if(_0x4d0e72 instanceof SDKError)return console[_0x509e44(0x1d0)](_0x509e44(0x1b5)+_0x4d0e72[_0x509e44(0x187)]),_0x4d0e72['cause']&&console['error']('\x20\x20Cause:\x20'+_0x4d0e72['cause']),0x1;throw _0x4d0e72;}}}export class WorkflowSessionsCommand extends BaseCommand{[a43_0xd64fae(0x16b)]=a43_0xd64fae(0x177);['description']=a43_0xd64fae(0x17c);async[a43_0xd64fae(0x1f8)](_0x2eaa5d){const _0x193798=a43_0xd64fae,{options:_0x6e467c,args:_0x4cb7af,tdx:_0xab4a33}=_0x2eaa5d;let _0xbe4238,_0x20df6e;if(_0x4cb7af[0x0]){const _0x365e14=_0x4cb7af[0x0]['split']('.');if(_0x365e14['length']===0x1)_0xbe4238=_0x365e14[0x0];else{if(_0x365e14[_0x193798(0x1f4)]===0x2)[_0xbe4238,_0x20df6e]=_0x365e14;else return console[_0x193798(0x1d0)](_0x193798(0x198)),0x1;}}try{if(_0x6e467c[_0x193798(0x1a0)]){if(_0xbe4238&&_0x20df6e)console['error'](_0x193798(0x18c)+_0xbe4238+'.'+_0x20df6e);else _0xbe4238&&console[_0x193798(0x1d0)](_0x193798(0x160)+_0xbe4238);const _0x52afef=_0x6e467c[_0x193798(0x171)];_0x52afef&&console['error'](_0x193798(0x17e)+_0x52afef);}const _0x260b31=await withSpinner(_0x193798(0x1d4),()=>_0xab4a33[_0x193798(0x1ed)][_0x193798(0x180)]({'projectName':_0xbe4238,'workflowName':_0x20df6e,'status':_0x6e467c[_0x193798(0x171)],'fromTime':_0x6e467c[_0x193798(0x184)],'toTime':_0x6e467c['to'],'limit':_0x6e467c[_0x193798(0x1ce)]}),{'verbose':_0x6e467c[_0x193798(0x1a0)]}),_0x557eb6=_0x260b31[_0x193798(0x19f)];return console[_0x193798(0x1d0)]('✔\x20Found\x20'+_0x557eb6['length']+_0x193798(0x166)+(_0x557eb6[_0x193798(0x1f4)]!==0x1?'s':'')),await handleSDKOutput(_0x557eb6,_0x6e467c),0x0;}catch(_0x4938ff){if(_0x4938ff instanceof SDKError)return console[_0x193798(0x1d0)](_0x193798(0x1b5)+_0x4938ff[_0x193798(0x187)]),_0x4938ff['cause']&&console[_0x193798(0x1d0)](_0x193798(0x16e)+_0x4938ff[_0x193798(0x1d1)]),0x1;throw _0x4938ff;}}}export class WorkflowAttemptsCommand extends BaseCommand{['name']='workflow:attempts';['description']='List\x20workflow\x20attempts';async[a43_0xd64fae(0x1f8)](_0x214c91){const _0x452ea1=a43_0xd64fae,{options:_0x5c3bd0,args:_0x4fd0e8,tdx:_0x1eedfa}=_0x214c91;let _0x32e0b2,_0x39a1fb;if(_0x4fd0e8[0x0]){const _0x2b9436=_0x4fd0e8[0x0][_0x452ea1(0x1f7)]('.');if(_0x2b9436[_0x452ea1(0x1f4)]===0x1)_0x32e0b2=_0x2b9436[0x0];else{if(_0x2b9436['length']===0x2)[_0x32e0b2,_0x39a1fb]=_0x2b9436;else return console[_0x452ea1(0x1d0)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{const _0x589933=_0x5c3bd0[_0x452ea1(0x1a6)];if(_0x5c3bd0[_0x452ea1(0x1a0)]){if(_0x32e0b2&&_0x39a1fb)console[_0x452ea1(0x1d0)](_0x452ea1(0x18c)+_0x32e0b2+'.'+_0x39a1fb);else _0x32e0b2&&console[_0x452ea1(0x1d0)](_0x452ea1(0x160)+_0x32e0b2);_0x589933&&console[_0x452ea1(0x1d0)](_0x452ea1(0x203));}const _0xb7200b=await withSpinner(_0x452ea1(0x1c0),()=>_0x1eedfa[_0x452ea1(0x1ed)][_0x452ea1(0x1ee)]({'projectName':_0x32e0b2,'workflowName':_0x39a1fb,'includeRetried':_0x589933,'limit':_0x5c3bd0[_0x452ea1(0x1ce)]}),{'verbose':_0x5c3bd0[_0x452ea1(0x1a0)]}),_0xdce5e9=_0xb7200b['data'];return console[_0x452ea1(0x1d0)](_0x452ea1(0x1ea)+_0xdce5e9[_0x452ea1(0x1f4)]+_0x452ea1(0x176)+(_0xdce5e9['length']!==0x1?'s':'')),await handleSDKOutput(_0xdce5e9,_0x5c3bd0),0x0;}catch(_0x63d3aa){if(_0x63d3aa instanceof SDKError)return console[_0x452ea1(0x1d0)](_0x452ea1(0x1b5)+_0x63d3aa[_0x452ea1(0x187)]),_0x63d3aa[_0x452ea1(0x1d1)]&&console[_0x452ea1(0x1d0)](_0x452ea1(0x16e)+_0x63d3aa['cause']),0x1;throw _0x63d3aa;}}}export class WorkflowAttemptCommand extends BaseCommand{[a43_0xd64fae(0x16b)]=a43_0xd64fae(0x15e);[a43_0xd64fae(0x1eb)]=a43_0xd64fae(0x1e2);async[a43_0xd64fae(0x1f8)](_0x1a37f9){const _0x5654a5=a43_0xd64fae,{options:_0x216eda,args:_0xfb19bb,tdx:_0x1ca673}=_0x1a37f9,_0x587640=_0xfb19bb[0x0];if(!_0x587640)return console[_0x5654a5(0x1d0)](_0x5654a5(0x16c)),0x1;try{_0x216eda[_0x5654a5(0x1a0)]&&console[_0x5654a5(0x1d0)]('Attempt\x20ID:\x20'+_0x587640);const _0x142d6d=await withSpinner(_0x5654a5(0x1f6),()=>_0x1ca673['workflow'][_0x5654a5(0x1bc)](_0x587640),{'verbose':_0x216eda[_0x5654a5(0x1a0)]}),_0x5227a4=_0x142d6d['data'];let _0xc8fb96;!_0x5227a4[_0x5654a5(0x1cf)]?_0xc8fb96=_0x5227a4[_0x5654a5(0x1fe)]?_0x5654a5(0x189):_0x5654a5(0x195):_0xc8fb96=_0x5227a4[_0x5654a5(0x1c2)]?_0x5654a5(0x1c2):_0x5654a5(0x1d0);let _0x3d31c1;if(_0x5227a4['createdAt']&&_0x5227a4[_0x5654a5(0x1f9)]){const _0x32fcc5=new Date(_0x5227a4[_0x5654a5(0x17d)])['getTime'](),_0x243c51=new Date(_0x5227a4[_0x5654a5(0x1f9)])[_0x5654a5(0x1a5)]();_0x3d31c1=Math[_0x5654a5(0x1e5)]((_0x243c51-_0x32fcc5)/0x3e8);}const _0x39ab84={'attempt_id':_0x5227a4['id'],'status':_0xc8fb96,..._0x5227a4[_0x5654a5(0x1d7)]!==undefined&&{'index':_0x5227a4[_0x5654a5(0x1d7)]},..._0x5227a4[_0x5654a5(0x1fd)]&&{'project':_0x5227a4[_0x5654a5(0x1fd)][_0x5654a5(0x16b)]},..._0x5227a4[_0x5654a5(0x1ed)]&&{'workflow':_0x5227a4['workflow'][_0x5654a5(0x16b)]},..._0x5227a4[_0x5654a5(0x182)]&&{'session_id':_0x5227a4[_0x5654a5(0x182)]},..._0x5227a4[_0x5654a5(0x18a)]&&{'session_time':_0x5227a4['sessionTime']},..._0x5227a4[_0x5654a5(0x1af)]&&{'retry_attempt':_0x5227a4['retryAttemptName']},..._0x3d31c1!==undefined&&{'duration_sec':_0x3d31c1},..._0x5227a4[_0x5654a5(0x17d)]&&{'created_at':_0x5227a4['createdAt']},..._0x5227a4[_0x5654a5(0x1f9)]&&{'finished_at':_0x5227a4[_0x5654a5(0x1f9)]},...Object[_0x5654a5(0x1d5)](_0x5227a4[_0x5654a5(0x1cb)])[_0x5654a5(0x1f4)]>0x0&&{'params':_0x5227a4['params']}};return await handleSingleObjectOutput(_0x39ab84,_0x216eda),0x0;}catch(_0x5e1e56){if(_0x5e1e56 instanceof SDKError)return console[_0x5654a5(0x1d0)](_0x5654a5(0x1b5)+_0x5e1e56['message']),_0x5e1e56['cause']&&console['error']('\x20\x20Cause:\x20'+_0x5e1e56[_0x5654a5(0x1d1)]),0x1;throw _0x5e1e56;}}}export class WorkflowTasksCommand extends BaseCommand{[a43_0xd64fae(0x16b)]='workflow:tasks';[a43_0xd64fae(0x1eb)]=a43_0xd64fae(0x202);async[a43_0xd64fae(0x1f8)](_0x3b5d04){const _0x123879=a43_0xd64fae,{options:_0x115359,args:_0x2e52b2,tdx:_0x523af4}=_0x3b5d04,_0x569e29=_0x2e52b2[0x0];if(!_0x569e29)return console[_0x123879(0x1d0)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x36c046=_0x115359[_0x123879(0x192)];_0x115359['verbose']&&(console[_0x123879(0x1d0)](_0x123879(0x18b)+_0x569e29),_0x36c046&&console[_0x123879(0x1d0)](_0x123879(0x18d)));const _0x128c92=await withSpinner(_0x123879(0x1ab),()=>_0x523af4[_0x123879(0x1ed)][_0x123879(0x1de)](_0x569e29,_0x36c046||![]),{'verbose':_0x115359['verbose']}),_0x285d1c=_0x128c92[_0x123879(0x19f)];return console['error'](_0x123879(0x1ea)+_0x285d1c[_0x123879(0x1f4)]+_0x123879(0x16d)+(_0x285d1c[_0x123879(0x1f4)]!==0x1?'s':'')),await handleSDKOutput(_0x285d1c,_0x115359),0x0;}catch(_0x294505){if(_0x294505 instanceof SDKError)return console[_0x123879(0x1d0)](_0x123879(0x1b5)+_0x294505['message']),_0x294505[_0x123879(0x1d1)]&&console['error'](_0x123879(0x16e)+_0x294505[_0x123879(0x1d1)]),0x1;throw _0x294505;}}}export class WorkflowLogsCommand extends BaseCommand{['name']=a43_0xd64fae(0x1b7);[a43_0xd64fae(0x1eb)]=a43_0xd64fae(0x17f);async[a43_0xd64fae(0x1f8)](_0x50ada3){const _0xe7c4c6=a43_0xd64fae,{options:_0x5a764a,args:_0x138b67,tdx:_0x38b848}=_0x50ada3,_0x27c3f9=_0x138b67[0x0];let _0x240de2=_0x138b67[0x1];if(!_0x27c3f9)return console[_0xe7c4c6(0x1d0)](_0xe7c4c6(0x16c)),0x1;try{_0x5a764a['verbose']&&(console[_0xe7c4c6(0x1d0)](_0xe7c4c6(0x18b)+_0x27c3f9),_0x240de2&&console['error'](_0xe7c4c6(0x1e1)+_0x240de2));const _0x59598f=await withSpinner(_0xe7c4c6(0x178),()=>_0x38b848['workflow']['logFiles'](_0x27c3f9,_0x240de2),{'verbose':_0x5a764a['verbose']}),_0x4a37d3=_0x59598f['data'];if(_0x4a37d3[_0xe7c4c6(0x1f4)]===0x0)return console[_0xe7c4c6(0x1d0)](_0xe7c4c6(0x1b4)),0x0;if(!_0x240de2&&(_0x5a764a[_0xe7c4c6(0x15f)]||_0x5a764a[_0xe7c4c6(0x1f0)]))return await handleSDKOutput(_0x4a37d3,_0x5a764a),0x0;if(!_0x240de2){const _0x554d2f=_0x4a37d3[_0xe7c4c6(0x186)](_0x348039=>({'title':_0x348039[_0xe7c4c6(0x1cd)]+'\x20('+formatBytes(_0x348039[_0xe7c4c6(0x1c1)])+')','value':_0x348039[_0xe7c4c6(0x1cd)]})),_0x59da31=await a43_0x2cbd65({'type':_0xe7c4c6(0x1fb),'name':_0xe7c4c6(0x175),'message':_0xe7c4c6(0x205),'choices':_0x554d2f});if(!_0x59da31[_0xe7c4c6(0x175)])return console[_0xe7c4c6(0x1d0)](_0xe7c4c6(0x199)),0x0;_0x240de2=_0x59da31['task'];}const _0x33ceae=await withSpinner(_0xe7c4c6(0x161),()=>_0x38b848[_0xe7c4c6(0x1ed)]['logs'](_0x27c3f9,_0x240de2),{'verbose':_0x5a764a['verbose']}),_0x15a671=_0x33ceae['data'];return _0x15a671?console[_0xe7c4c6(0x18e)](_0x15a671):console['error']('No\x20log\x20content\x20found'),0x0;}catch(_0x323840){if(_0x323840 instanceof SDKError)return console[_0xe7c4c6(0x1d0)]('Error:\x20'+_0x323840[_0xe7c4c6(0x187)]),_0x323840[_0xe7c4c6(0x1d1)]&&console[_0xe7c4c6(0x1d0)](_0xe7c4c6(0x16e)+_0x323840[_0xe7c4c6(0x1d1)]),0x1;throw _0x323840;}}}export class WorkflowKillCommand extends BaseCommand{[a43_0xd64fae(0x16b)]='workflow:kill';['description']=a43_0xd64fae(0x1b6);async[a43_0xd64fae(0x1f8)](_0x57438a){const _0x35e83d=a43_0xd64fae,{options:_0x3005ac,args:_0x41cf55,tdx:_0x4d38ed}=_0x57438a,_0x1da7fc=_0x41cf55[0x0];if(!_0x1da7fc)return console[_0x35e83d(0x1d0)](_0x35e83d(0x16c)),0x1;try{const _0x1e9356=_0x3005ac[_0x35e83d(0x1f1)];_0x3005ac['verbose']&&(console[_0x35e83d(0x1d0)](_0x35e83d(0x18b)+_0x1da7fc),_0x1e9356&&console[_0x35e83d(0x1d0)]('Reason:\x20'+_0x1e9356));if(!_0x3005ac['yes']){const _0x21ec8b=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20'+_0x1da7fc+'?');if(!_0x21ec8b)return console[_0x35e83d(0x1d0)]('Cancelled'),0x0;}const _0x5ab083=await withSpinner(_0x35e83d(0x1b2),()=>_0x4d38ed[_0x35e83d(0x1ed)][_0x35e83d(0x200)](_0x1da7fc,_0x1e9356),{'verbose':_0x3005ac[_0x35e83d(0x1a0)]}),_0x593a69=_0x5ab083['data'];return console[_0x35e83d(0x1d0)]('✔\x20'+_0x593a69),0x0;}catch(_0x12999b){if(_0x12999b instanceof SDKError)return console[_0x35e83d(0x1d0)](_0x35e83d(0x1b5)+_0x12999b[_0x35e83d(0x187)]),_0x12999b['cause']&&console[_0x35e83d(0x1d0)]('\x20\x20Cause:\x20'+_0x12999b[_0x35e83d(0x1d1)]),0x1;throw _0x12999b;}}}export class WorkflowRetryCommand extends BaseCommand{[a43_0xd64fae(0x16b)]=a43_0xd64fae(0x1e6);['description']=a43_0xd64fae(0x1bf);async[a43_0xd64fae(0x1f8)](_0x294b3a){const _0x2d5d8b=a43_0xd64fae,{options:_0x335b19,args:_0x337aa4,tdx:_0x12f073}=_0x294b3a,_0x322cbf=_0x337aa4[0x0];if(!_0x322cbf)return console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x164)),console[_0x2d5d8b(0x1d0)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x4487a8=![],_0x22295a=_0x322cbf;if(_0x322cbf[_0x2d5d8b(0x1cc)](_0x2d5d8b(0x1ad)))_0x4487a8=!![],_0x22295a=_0x322cbf['substring'](0x8);else{if(_0x322cbf['startsWith']('attempt:'))_0x4487a8=![],_0x22295a=_0x322cbf[_0x2d5d8b(0x16a)](0x8);else return console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x1c5)),console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x174)),0x1;}try{const _0xe35922=_0x335b19[_0x2d5d8b(0x19e)],_0x2d110c=_0x335b19[_0x2d5d8b(0x1b8)],_0x3fc46e=_0x335b19[_0x2d5d8b(0x1cb)],_0x4f6fd4=_0x335b19[_0x2d5d8b(0x19d)];_0x335b19[_0x2d5d8b(0x1a0)]&&(console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x206)+(_0x4487a8?_0x2d5d8b(0x1a8):_0x2d5d8b(0x1bc))+'\x20'+_0x22295a),_0xe35922&&console['error'](_0x2d5d8b(0x1e9)+_0xe35922),_0x2d110c&&console['error'](_0x2d5d8b(0x165)+_0x2d110c),_0x3fc46e&&console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x1c8)+_0x3fc46e),_0x4f6fd4&&console[_0x2d5d8b(0x1d0)]('Force:\x20yes'));let _0x626d20;if(_0x3fc46e)try{if(_0x3fc46e[_0x2d5d8b(0x1cc)]('@')){const _0x48f119=await import(_0x2d5d8b(0x16f)),_0x11d956=_0x3fc46e[_0x2d5d8b(0x16a)](0x1),_0x1a3fa3=await _0x48f119[_0x2d5d8b(0x17b)](_0x11d956,_0x2d5d8b(0x15d));_0x626d20=JSON[_0x2d5d8b(0x1ae)](_0x1a3fa3);}else _0x626d20=JSON[_0x2d5d8b(0x1ae)](_0x3fc46e);}catch{return console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x188)),0x1;}if(!_0x335b19['yes']){const _0x343e3b=await confirm(_0x2d5d8b(0x1a2)+(_0x4487a8?_0x2d5d8b(0x1a8):_0x2d5d8b(0x1bc))+'\x20'+_0x22295a+'?');if(!_0x343e3b)return console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x199)),0x0;}let _0x5e32b1;_0x4487a8?_0x5e32b1=await withSpinner('Retrying\x20session...',()=>_0x12f073['workflow'][_0x2d5d8b(0x1c6)](_0x22295a,{'fromTask':_0xe35922,'retryParams':_0x626d20}),{'verbose':_0x335b19['verbose']}):_0x5e32b1=await withSpinner(_0x2d5d8b(0x191),()=>_0x12f073['workflow'][_0x2d5d8b(0x1f3)](_0x22295a,{'resumeFrom':_0x2d110c,'retryParams':_0x626d20,'force':_0x4f6fd4}),{'verbose':_0x335b19[_0x2d5d8b(0x1a0)]});const _0x59e021=_0x5e32b1[_0x2d5d8b(0x19f)];return console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x1d8)),console['error']('\x20\x20New\x20attempt\x20ID:\x20'+_0x59e021[_0x2d5d8b(0x1a1)]),console['error'](_0x2d5d8b(0x168)+_0x59e021[_0x2d5d8b(0x182)]),0x0;}catch(_0x15b5d1){if(_0x15b5d1 instanceof SDKError)return console[_0x2d5d8b(0x1d0)](_0x2d5d8b(0x1b5)+_0x15b5d1['message']),_0x15b5d1[_0x2d5d8b(0x1d1)]&&console[_0x2d5d8b(0x1d0)]('\x20\x20Cause:\x20'+_0x15b5d1['cause']),0x1;throw _0x15b5d1;}}}export class WorkflowRunCommand extends BaseCommand{[a43_0xd64fae(0x16b)]='workflow:run';[a43_0xd64fae(0x1eb)]=a43_0xd64fae(0x1e3);async[a43_0xd64fae(0x1f8)](_0x122447){const _0x50404a=a43_0xd64fae,{options:_0x28ee8b,args:_0x468570,tdx:_0x224599}=_0x122447,_0xc3e227=_0x468570[0x0];if(!_0xc3e227)return console[_0x50404a(0x1d0)](_0x50404a(0x1d2)),console[_0x50404a(0x1d0)](_0x50404a(0x1d6)),0x1;const _0x37e3d7=_0x28ee8b[_0x50404a(0x1b1)],_0x2a77c6=_0x28ee8b[_0x50404a(0x18a)],_0x392620={};if(_0x37e3d7&&Array[_0x50404a(0x204)](_0x37e3d7))for(const _0x461237 of _0x37e3d7){const _0x1e4db1=_0x461237[_0x50404a(0x1e4)]('=');if(_0x1e4db1===-0x1)return console['error'](_0x50404a(0x1f2)+_0x461237),console[_0x50404a(0x1d0)](_0x50404a(0x17a)),0x1;const _0x23d32a=_0x461237[_0x50404a(0x16a)](0x0,_0x1e4db1),_0x379461=_0x461237[_0x50404a(0x16a)](_0x1e4db1+0x1);try{_0x392620[_0x23d32a]=JSON[_0x50404a(0x1ae)](_0x379461);}catch{_0x392620[_0x23d32a]=_0x379461;}}_0x28ee8b[_0x50404a(0x1a0)]&&(console[_0x50404a(0x1d0)](_0x50404a(0x1b3)+_0xc3e227),Object[_0x50404a(0x1d5)](_0x392620)['length']>0x0&&console[_0x50404a(0x1d0)](_0x50404a(0x1ba)+JSON[_0x50404a(0x179)](_0x392620)),_0x2a77c6&&console[_0x50404a(0x1d0)](_0x50404a(0x19c)+_0x2a77c6));const _0x95ec09=await withSpinner(_0x50404a(0x197),()=>_0x224599[_0x50404a(0x1ed)][_0x50404a(0x1e7)](_0xc3e227,_0x392620,{'sessionTime':_0x2a77c6}),{'verbose':_0x28ee8b[_0x50404a(0x1a0)]}),_0x56802b=_0x95ec09[_0x50404a(0x19f)];return console[_0x50404a(0x1d0)](_0x50404a(0x1d9)),console[_0x50404a(0x1d0)](_0x50404a(0x1dc)+_0x56802b['id']),console[_0x50404a(0x1d0)](_0x50404a(0x168)+_0x56802b['sessionId']),console[_0x50404a(0x1d0)](_0x50404a(0x1d3)+_0x56802b[_0x50404a(0x1fd)]?.[_0x50404a(0x16b)]),console['error']('\x20\x20Workflow:\x20'+_0x56802b[_0x50404a(0x1ed)]?.[_0x50404a(0x16b)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a43_0xd64fae(0x16b)]='workflow:download';['description']=a43_0xd64fae(0x1ec);async['execute'](_0x1d97df){const _0x4878a7=a43_0xd64fae,{options:_0x3371e1,args:_0x4c101f,tdx:_0x5595c6}=_0x1d97df,_0xa237d4=_0x4c101f[0x0],_0x4e4d0d=_0x4c101f[0x1]||'.';if(!_0xa237d4)return console[_0x4878a7(0x1d0)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x4878a7(0x1d0)]('Usage:\x20workflow:download\x20<project-name>\x20[output-dir]'),0x1;const _0x4eea74=_0x3371e1[_0x4878a7(0x1c9)];_0x3371e1[_0x4878a7(0x1a0)]&&(console[_0x4878a7(0x1d0)]('Project:\x20'+_0xa237d4),console[_0x4878a7(0x1d0)]('Output\x20directory:\x20'+_0x4e4d0d),_0x4eea74&&console[_0x4878a7(0x1d0)](_0x4878a7(0x1e0)+_0x4eea74));const _0x50e9c2=await withSpinner(_0x4878a7(0x201)+_0xa237d4+'...',()=>_0x5595c6['workflow'][_0x4878a7(0x172)](_0xa237d4,_0x4e4d0d,{'revision':_0x4eea74}),{'verbose':_0x3371e1['verbose']}),_0x3d5707=_0x50e9c2[_0x4878a7(0x19f)];return console[_0x4878a7(0x1d0)](_0x4878a7(0x194)+_0x3d5707['projectName']),console['error'](_0x4878a7(0x1bd)+_0x3d5707[_0x4878a7(0x1c9)]),console[_0x4878a7(0x1d0)](_0x4878a7(0x1f5)+_0x3d5707[_0x4878a7(0x1b9)]),console[_0x4878a7(0x1d0)]('\x20\x20Location:\x20'+_0x4e4d0d+'/'+_0x3d5707[_0x4878a7(0x169)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{['name']='workflow:push';[a43_0xd64fae(0x1eb)]=a43_0xd64fae(0x183);async[a43_0xd64fae(0x1f8)](_0x1a15d6){const _0x500f0a=a43_0xd64fae,{options:_0x17e89f,args:_0x522136,tdx:_0xb84679}=_0x1a15d6;let _0x42e7b2='.',_0x38fafa=_0x17e89f[_0x500f0a(0x16b)];if(_0x522136[0x0]){const {promises:_0x4a26b0}=await import('fs');try{const _0x5e1d92=await _0x4a26b0[_0x500f0a(0x1ef)](_0x522136[0x0]);if(_0x5e1d92[_0x500f0a(0x1a7)]())_0x42e7b2=_0x522136[0x0];else return console[_0x500f0a(0x1d0)](_0x500f0a(0x1b5)+_0x522136[0x0]+_0x500f0a(0x1fa)),0x1;}catch{_0x38fafa=_0x522136[0x0],_0x42e7b2='.';}}const _0x2b7f11=_0x17e89f[_0x500f0a(0x1c9)],_0x5a8107=_0x17e89f[_0x500f0a(0x19b)];_0x17e89f[_0x500f0a(0x1a0)]&&(console['error']('Project\x20directory:\x20'+_0x42e7b2),_0x38fafa&&console[_0x500f0a(0x1d0)](_0x500f0a(0x1a3)+_0x38fafa),_0x2b7f11&&console['error']('Revision:\x20'+_0x2b7f11),_0x5a8107&&console['error'](_0x500f0a(0x18f)));const _0x46152a=await withSpinner(_0x500f0a(0x1bb),()=>_0xb84679[_0x500f0a(0x1ed)]['push'](_0x42e7b2,{'projectName':_0x38fafa,'revision':_0x2b7f11,'skipValidation':_0x5a8107}),{'verbose':_0x17e89f['verbose']}),_0x2e7d2e=_0x46152a['data'];return console[_0x500f0a(0x1d0)](_0x500f0a(0x1b0)+_0x2e7d2e[_0x500f0a(0x169)]),console[_0x500f0a(0x1d0)]('\x20\x20Project\x20ID:\x20'+_0x2e7d2e[_0x500f0a(0x163)]),console[_0x500f0a(0x1d0)](_0x500f0a(0x1bd)+_0x2e7d2e['revision']),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{['name']='workflow:delete';[a43_0xd64fae(0x1eb)]='Delete\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a43_0xd64fae(0x1f8)](_0x3ad4b4){const _0x57a78f=a43_0xd64fae,{options:_0x576f9a,args:_0x5a22a6,tdx:_0x3beb06}=_0x3ad4b4,_0xaf1f3c=_0x5a22a6[0x0];if(!_0xaf1f3c)return console[_0x57a78f(0x1d0)](_0x57a78f(0x193)),console[_0x57a78f(0x1d0)]('Usage:\x20workflow:delete\x20<project-name-or-id>'),0x1;_0x576f9a[_0x57a78f(0x1a0)]&&console[_0x57a78f(0x1d0)](_0x57a78f(0x1e8)+_0xaf1f3c);if(!_0x576f9a[_0x57a78f(0x1c3)]){const _0x197b47=await confirm(_0x57a78f(0x173)+_0xaf1f3c+_0x57a78f(0x1da));if(!_0x197b47)return console[_0x57a78f(0x1d0)](_0x57a78f(0x199)),0x0;}const _0x312001=await withSpinner(_0x57a78f(0x181)+_0xaf1f3c+_0x57a78f(0x1be),()=>_0x3beb06['workflow'][_0x57a78f(0x190)](_0xaf1f3c),{'verbose':_0x576f9a[_0x57a78f(0x1a0)]}),_0x2e3f4b=_0x312001['data'];return console[_0x57a78f(0x1d0)]('✔\x20Deleted\x20project\x20'+_0x2e3f4b[_0x57a78f(0x169)]),console[_0x57a78f(0x1d0)](_0x57a78f(0x167)+_0x2e3f4b[_0x57a78f(0x163)]),0x0;}}
|
|
1
|
+
const a43_0x20f80e=a43_0x4cb6;function a43_0x23f9(){const _0x1dcc6e=['\x22?\x20This\x20cannot\x20be\x20undone.','Error:\x20Invalid\x20JSON\x20in\x20--params','Include\x20retried:\x20yes','projects','status','Listing\x20workflow\x20attempts...','\x20\x20Project:\x20','force','Cancelled','download','54GOWYuM','workflow:workflows','\x20\x20Files\x20extracted:\x20','1179564YHzTkK','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','createdAt','List\x20all\x20workflow\x20projects','3100518OwdNzH','Pattern:\x20','map','execute','split','workflow','params','Project\x20filter:\x20','Getting\x20attempt\x20tasks...','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Killing\x20attempt...','push','from','Revision:\x20','\x20\x20Session\x20ID:\x20','\x20\x20Cause:\x20','includeSubtasks','resumeFrom','projectId','sessionTime','skipValidation','workflow:push','reason','10EMjTPA','✔\x20Pushed\x20','Project:\x20','indexOf','limit','\x20\x20Revision:\x20','Project\x20directory:\x20','\x20\x20New\x20attempt\x20ID:\x20','name','substring','\x20attempt','getTime','List\x20workflow\x20execution\x20sessions','Fetching\x20log\x20files...','parse','Attempt\x20ID:\x20','\x20\x20Workflow:\x20','✔\x20Deleted\x20project\x20','Task\x20name:\x20','retryAttempt','tasks','logFiles','workflow:retry','length','Retry\x20a\x20session\x20or\x20attempt','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Including\x20subtasks:\x20yes','workflow:logs','fileSize','Error:\x20Attempt\x20ID\x20is\x20required','workflow:projects','Usage:\x20workflow:delete\x20<project-name-or-id>','Reason:\x20','cause','Resume\x20from:\x20','...','Listing\x20workflow\x20sessions...','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','\x20\x20Attempt\x20ID:\x20','workflow:download','workflow:delete','attempt:','\x20is\x20not\x20a\x20directory','logs','Project\x20name:\x20','Output\x20directory:\x20','Error:\x20Invalid\x20parameter\x20format:\x20','\x20workflow','fromTask','Show\x20specific\x20attempt\x20details','success','json','round','param','Select\x20a\x20task\x20to\x20view\x20logs:','✔\x20Found\x20','Show\x20logs\x20for\x20a\x20workflow\x20attempt','Filter:\x20','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','attempts','Target:\x20','description','project','53228JBWlih','Downloading\x20logs...','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','\x20\x20Project\x20ID:\x20','error','No\x20log\x20content\x20found','workflow:attempts','List\x20workflow\x20attempts','Session\x20time:\x20','\x20task','projectName','Error:\x20Workflow\x20identifier\x20is\x20required','Deleting\x20project\x20','workflow:attempt','retryAttemptName','Filter:\x20project=','attempt','Workflow:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','workflow:tasks','message','561eykgdR','sessions','cancelRequested','Start\x20a\x20workflow\x20run','Error:\x20Project\x20name\x20is\x20required','yes','stat','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','sessionId','session:','workflow:kill','Listing\x20workflows...','Getting\x20attempt\x20details...','✔\x20Workflow\x20run\x20started','Validation:\x20skipped','verbose','Starting\x20workflow\x20run...','Listing\x20workflow\x20projects...','Error:\x20','isDirectory','task','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','format','run','Show\x20tasks\x20for\x20an\x20attempt','Downloading\x20project\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','session','From\x20task:\x20','data','delete','1149407hLupaA','finishedAt','startsWith','keys','No\x20log\x20files\x20found\x20for\x20this\x20attempt','revision','Expected\x20format:\x20--param\x20key=value','Kill\x20a\x20running\x20attempt','List\x20workflows','47925IofYaU','taskName','workflow:sessions','1742672xjArQa','index','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','retrySession'];a43_0x23f9=function(){return _0x1dcc6e;};return a43_0x23f9();}(function(_0x2cf9e6,_0x7ba50a){const _0x53c400=a43_0x4cb6,_0x2eea7b=_0x2cf9e6();while(!![]){try{const _0x5ac4d0=parseInt(_0x53c400(0x1f0))/0x1*(parseInt(_0x53c400(0x229))/0x2)+-parseInt(_0x53c400(0x218))/0x3+parseInt(_0x53c400(0x1db))/0x4*(parseInt(_0x53c400(0x19c))/0x5)+-parseInt(_0x53c400(0x22c))/0x6+parseInt(_0x53c400(0x20f))/0x7+-parseInt(_0x53c400(0x21b))/0x8+parseInt(_0x53c400(0x230))/0x9;if(_0x5ac4d0===_0x7ba50a)break;else _0x2eea7b['push'](_0x2eea7b['shift']());}catch(_0x54a176){_0x2eea7b['push'](_0x2eea7b['shift']());}}}(a43_0x23f9,0x1d4fd));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{formatBytes}from'../utils/formatters.js';import a43_0x1a105c from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1ba);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x22f);async['execute'](_0x2997a4){const _0x3da6c1=a43_0x20f80e,{options:_0x17521d,args:_0x4dbdff,tdx:_0x2334c2}=_0x2997a4,_0x8ac48e=_0x4dbdff[0x0];try{_0x17521d['verbose']&&_0x8ac48e&&console['error'](_0x3da6c1(0x231)+_0x8ac48e);const _0x51ce37=await withSpinner(_0x3da6c1(0x201),()=>_0x2334c2['workflow'][_0x3da6c1(0x222)](_0x8ac48e,{'limit':_0x17521d['limit']}),{'verbose':_0x17521d[_0x3da6c1(0x1ff)]}),_0x5832ad=_0x51ce37['data'];return console[_0x3da6c1(0x1df)]('✔\x20Found\x20'+_0x5832ad['length']+'\x20project'+(_0x5832ad[_0x3da6c1(0x1b3)]!==0x1?'s':'')),await handleSDKOutput(_0x5832ad,_0x17521d),0x0;}catch(_0x4f9232){if(_0x4f9232 instanceof SDKError)return console[_0x3da6c1(0x1df)](_0x3da6c1(0x202)+_0x4f9232[_0x3da6c1(0x1ef)]),_0x4f9232[_0x3da6c1(0x1bd)]&&console[_0x3da6c1(0x1df)](_0x3da6c1(0x23f)+_0x4f9232[_0x3da6c1(0x1bd)]),0x1;throw _0x4f9232;}}}export class WorkflowWorkflowsCommand extends BaseCommand{['name']=a43_0x20f80e(0x22a);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x217);async[a43_0x20f80e(0x233)](_0x5e6e71){const _0x20145f=a43_0x20f80e,{options:_0x496ae5,args:_0x531edb,tdx:_0xc6c6b1}=_0x5e6e71,_0x517b1a=_0x531edb[0x0];try{_0x496ae5['verbose']&&_0x517b1a&&console['error'](_0x20145f(0x237)+_0x517b1a);const _0x5f2b0a=await withSpinner(_0x20145f(0x1fb),()=>_0xc6c6b1[_0x20145f(0x235)]['workflows'](_0x517b1a,{'limit':_0x496ae5[_0x20145f(0x1a0)]}),{'verbose':_0x496ae5[_0x20145f(0x1ff)]}),_0x54cc61=_0x5f2b0a[_0x20145f(0x20d)];return console[_0x20145f(0x1df)](_0x20145f(0x1d3)+_0x54cc61[_0x20145f(0x1b3)]+_0x20145f(0x1cb)+(_0x54cc61[_0x20145f(0x1b3)]!==0x1?'s':'')),await handleSDKOutput(_0x54cc61,_0x496ae5),0x0;}catch(_0x9be6c6){if(_0x9be6c6 instanceof SDKError)return console[_0x20145f(0x1df)]('Error:\x20'+_0x9be6c6[_0x20145f(0x1ef)]),_0x9be6c6['cause']&&console['error'](_0x20145f(0x23f)+_0x9be6c6[_0x20145f(0x1bd)]),0x1;throw _0x9be6c6;}}}export class WorkflowSessionsCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x21a);['description']=a43_0x20f80e(0x1a8);async['execute'](_0x61fc30){const _0x31a9c7=a43_0x20f80e,{options:_0x4369e8,args:_0x1fa680,tdx:_0x684902}=_0x61fc30;let _0x5ad637,_0xf96651;if(_0x1fa680[0x0]){const _0x5c7b52=_0x1fa680[0x0][_0x31a9c7(0x234)]('.');if(_0x5c7b52[_0x31a9c7(0x1b3)]===0x1)_0x5ad637=_0x5c7b52[0x0];else{if(_0x5c7b52[_0x31a9c7(0x1b3)]===0x2)[_0x5ad637,_0xf96651]=_0x5c7b52;else return console[_0x31a9c7(0x1df)](_0x31a9c7(0x239)),0x1;}}try{if(_0x4369e8[_0x31a9c7(0x1ff)]){if(_0x5ad637&&_0xf96651)console[_0x31a9c7(0x1df)](_0x31a9c7(0x1d5)+_0x5ad637+'.'+_0xf96651);else _0x5ad637&&console['error'](_0x31a9c7(0x1ea)+_0x5ad637);const _0x25417f=_0x4369e8[_0x31a9c7(0x223)];_0x25417f&&console[_0x31a9c7(0x1df)]('Status:\x20'+_0x25417f);}const _0x5b1347=await withSpinner(_0x31a9c7(0x1c0),()=>_0x684902[_0x31a9c7(0x235)][_0x31a9c7(0x1f1)]({'projectName':_0x5ad637,'workflowName':_0xf96651,'status':_0x4369e8[_0x31a9c7(0x223)],'fromTime':_0x4369e8[_0x31a9c7(0x23c)],'toTime':_0x4369e8['to'],'limit':_0x4369e8[_0x31a9c7(0x1a0)]}),{'verbose':_0x4369e8[_0x31a9c7(0x1ff)]}),_0x591dc5=_0x5b1347['data'];return console[_0x31a9c7(0x1df)](_0x31a9c7(0x1d3)+_0x591dc5[_0x31a9c7(0x1b3)]+'\x20session'+(_0x591dc5[_0x31a9c7(0x1b3)]!==0x1?'s':'')),await handleSDKOutput(_0x591dc5,_0x4369e8),0x0;}catch(_0x1bbfd2){if(_0x1bbfd2 instanceof SDKError)return console[_0x31a9c7(0x1df)](_0x31a9c7(0x202)+_0x1bbfd2[_0x31a9c7(0x1ef)]),_0x1bbfd2['cause']&&console[_0x31a9c7(0x1df)](_0x31a9c7(0x23f)+_0x1bbfd2['cause']),0x1;throw _0x1bbfd2;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1e1);['description']=a43_0x20f80e(0x1e2);async['execute'](_0x4728e8){const _0x23d2e9=a43_0x20f80e,{options:_0x3aace3,args:_0x413eaf,tdx:_0x13bc3c}=_0x4728e8;let _0x34106b,_0x39f95a;if(_0x413eaf[0x0]){const _0x346053=_0x413eaf[0x0]['split']('.');if(_0x346053['length']===0x1)_0x34106b=_0x346053[0x0];else{if(_0x346053['length']===0x2)[_0x34106b,_0x39f95a]=_0x346053;else return console[_0x23d2e9(0x1df)](_0x23d2e9(0x239)),0x1;}}try{const _0x4d5d21=_0x3aace3['includeRetried'];if(_0x3aace3[_0x23d2e9(0x1ff)]){if(_0x34106b&&_0x39f95a)console[_0x23d2e9(0x1df)](_0x23d2e9(0x1d5)+_0x34106b+'.'+_0x39f95a);else _0x34106b&&console[_0x23d2e9(0x1df)]('Filter:\x20project='+_0x34106b);_0x4d5d21&&console[_0x23d2e9(0x1df)](_0x23d2e9(0x221));}const _0x1d2def=await withSpinner(_0x23d2e9(0x224),()=>_0x13bc3c[_0x23d2e9(0x235)][_0x23d2e9(0x1d7)]({'projectName':_0x34106b,'workflowName':_0x39f95a,'includeRetried':_0x4d5d21,'limit':_0x3aace3[_0x23d2e9(0x1a0)]}),{'verbose':_0x3aace3['verbose']}),_0x336de2=_0x1d2def[_0x23d2e9(0x20d)];return console[_0x23d2e9(0x1df)](_0x23d2e9(0x1d3)+_0x336de2[_0x23d2e9(0x1b3)]+_0x23d2e9(0x1a6)+(_0x336de2[_0x23d2e9(0x1b3)]!==0x1?'s':'')),await handleSDKOutput(_0x336de2,_0x3aace3),0x0;}catch(_0x242364){if(_0x242364 instanceof SDKError)return console[_0x23d2e9(0x1df)](_0x23d2e9(0x202)+_0x242364[_0x23d2e9(0x1ef)]),_0x242364[_0x23d2e9(0x1bd)]&&console[_0x23d2e9(0x1df)](_0x23d2e9(0x23f)+_0x242364['cause']),0x1;throw _0x242364;}}}export class WorkflowAttemptCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1e8);['description']=a43_0x20f80e(0x1cd);async[a43_0x20f80e(0x233)](_0x260540){const _0x411b54=a43_0x20f80e,{options:_0x30c776,args:_0x510a48,tdx:_0x294071}=_0x260540,_0x2c1289=_0x510a48[0x0];if(!_0x2c1289)return console[_0x411b54(0x1df)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x30c776[_0x411b54(0x1ff)]&&console[_0x411b54(0x1df)](_0x411b54(0x1ab)+_0x2c1289);const _0x568e48=await withSpinner(_0x411b54(0x1fc),()=>_0x294071[_0x411b54(0x235)][_0x411b54(0x1eb)](_0x2c1289),{'verbose':_0x30c776['verbose']}),_0x3c2742=_0x568e48[_0x411b54(0x20d)];let _0x162fdc;!_0x3c2742['done']?_0x162fdc=_0x3c2742[_0x411b54(0x1f2)]?'canceling':'running':_0x162fdc=_0x3c2742['success']?_0x411b54(0x1ce):_0x411b54(0x1df);let _0x1371f6;if(_0x3c2742[_0x411b54(0x22e)]&&_0x3c2742[_0x411b54(0x210)]){const _0x13da13=new Date(_0x3c2742[_0x411b54(0x22e)])[_0x411b54(0x1a7)](),_0x5dd25c=new Date(_0x3c2742[_0x411b54(0x210)])['getTime']();_0x1371f6=Math[_0x411b54(0x1d0)]((_0x5dd25c-_0x13da13)/0x3e8);}const _0xaf2aff={'attempt_id':_0x3c2742['id'],'status':_0x162fdc,..._0x3c2742[_0x411b54(0x21c)]!==undefined&&{'index':_0x3c2742[_0x411b54(0x21c)]},..._0x3c2742[_0x411b54(0x1da)]&&{'project':_0x3c2742[_0x411b54(0x1da)][_0x411b54(0x1a4)]},..._0x3c2742[_0x411b54(0x235)]&&{'workflow':_0x3c2742[_0x411b54(0x235)][_0x411b54(0x1a4)]},..._0x3c2742[_0x411b54(0x1f8)]&&{'session_id':_0x3c2742[_0x411b54(0x1f8)]},..._0x3c2742[_0x411b54(0x243)]&&{'session_time':_0x3c2742[_0x411b54(0x243)]},..._0x3c2742[_0x411b54(0x1e9)]&&{'retry_attempt':_0x3c2742['retryAttemptName']},..._0x1371f6!==undefined&&{'duration_sec':_0x1371f6},..._0x3c2742[_0x411b54(0x22e)]&&{'created_at':_0x3c2742[_0x411b54(0x22e)]},..._0x3c2742[_0x411b54(0x210)]&&{'finished_at':_0x3c2742[_0x411b54(0x210)]},...Object[_0x411b54(0x212)](_0x3c2742[_0x411b54(0x236)])[_0x411b54(0x1b3)]>0x0&&{'params':_0x3c2742['params']}};return await handleSingleObjectOutput(_0xaf2aff,_0x30c776),0x0;}catch(_0x7fd602){if(_0x7fd602 instanceof SDKError)return console[_0x411b54(0x1df)](_0x411b54(0x202)+_0x7fd602[_0x411b54(0x1ef)]),_0x7fd602['cause']&&console[_0x411b54(0x1df)](_0x411b54(0x23f)+_0x7fd602[_0x411b54(0x1bd)]),0x1;throw _0x7fd602;}}}export class WorkflowTasksCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1ee);['description']=a43_0x20f80e(0x208);async[a43_0x20f80e(0x233)](_0x3475bb){const _0x41f306=a43_0x20f80e,{options:_0x19e1ba,args:_0x2d10b7,tdx:_0x587dfb}=_0x3475bb,_0x36b97e=_0x2d10b7[0x0];if(!_0x36b97e)return console[_0x41f306(0x1df)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x347cb6=_0x19e1ba[_0x41f306(0x240)];_0x19e1ba[_0x41f306(0x1ff)]&&(console[_0x41f306(0x1df)]('Attempt\x20ID:\x20'+_0x36b97e),_0x347cb6&&console[_0x41f306(0x1df)](_0x41f306(0x1b6)));const _0x3d7dab=await withSpinner(_0x41f306(0x238),()=>_0x587dfb[_0x41f306(0x235)][_0x41f306(0x1b0)](_0x36b97e,_0x347cb6||![]),{'verbose':_0x19e1ba[_0x41f306(0x1ff)]}),_0x4029ab=_0x3d7dab[_0x41f306(0x20d)];return console['error']('✔\x20Found\x20'+_0x4029ab[_0x41f306(0x1b3)]+_0x41f306(0x1e4)+(_0x4029ab[_0x41f306(0x1b3)]!==0x1?'s':'')),await handleSDKOutput(_0x4029ab,_0x19e1ba),0x0;}catch(_0x5537f7){if(_0x5537f7 instanceof SDKError)return console['error'](_0x41f306(0x202)+_0x5537f7[_0x41f306(0x1ef)]),_0x5537f7[_0x41f306(0x1bd)]&&console[_0x41f306(0x1df)](_0x41f306(0x23f)+_0x5537f7[_0x41f306(0x1bd)]),0x1;throw _0x5537f7;}}}export class WorkflowLogsCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1b7);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x1d4);async[a43_0x20f80e(0x233)](_0x14a1f0){const _0x4e69a7=a43_0x20f80e,{options:_0x1f2c37,args:_0x52e89b,tdx:_0x1f3711}=_0x14a1f0,_0x42c398=_0x52e89b[0x0];let _0xd8ffbd=_0x52e89b[0x1];if(!_0x42c398)return console[_0x4e69a7(0x1df)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x1f2c37[_0x4e69a7(0x1ff)]&&(console['error']('Attempt\x20ID:\x20'+_0x42c398),_0xd8ffbd&&console[_0x4e69a7(0x1df)](_0x4e69a7(0x1ae)+_0xd8ffbd));const _0x3f40bb=await withSpinner(_0x4e69a7(0x1a9),()=>_0x1f3711['workflow'][_0x4e69a7(0x1b1)](_0x42c398,_0xd8ffbd),{'verbose':_0x1f2c37[_0x4e69a7(0x1ff)]}),_0x295b1a=_0x3f40bb[_0x4e69a7(0x20d)];if(_0x295b1a['length']===0x0)return console['error'](_0x4e69a7(0x213)),0x0;if(!_0xd8ffbd&&(_0x1f2c37[_0x4e69a7(0x1cf)]||_0x1f2c37[_0x4e69a7(0x206)]))return await handleSDKOutput(_0x295b1a,_0x1f2c37),0x0;if(!_0xd8ffbd){const _0x490a7b=_0x295b1a[_0x4e69a7(0x232)](_0x13690f=>({'title':_0x13690f[_0x4e69a7(0x219)]+'\x20('+formatBytes(_0x13690f[_0x4e69a7(0x1b8)])+')','value':_0x13690f[_0x4e69a7(0x219)]})),_0x37c28e=await a43_0x1a105c({'type':'select','name':'task','message':_0x4e69a7(0x1d2),'choices':_0x490a7b});if(!_0x37c28e[_0x4e69a7(0x204)])return console['error'](_0x4e69a7(0x227)),0x0;_0xd8ffbd=_0x37c28e['task'];}const _0x5b8dbf=await withSpinner(_0x4e69a7(0x1dc),()=>_0x1f3711[_0x4e69a7(0x235)][_0x4e69a7(0x1c7)](_0x42c398,_0xd8ffbd),{'verbose':_0x1f2c37[_0x4e69a7(0x1ff)]}),_0x130617=_0x5b8dbf['data'];return _0x130617?console['log'](_0x130617):console['error'](_0x4e69a7(0x1e0)),0x0;}catch(_0x4a19a4){if(_0x4a19a4 instanceof SDKError)return console[_0x4e69a7(0x1df)]('Error:\x20'+_0x4a19a4['message']),_0x4a19a4[_0x4e69a7(0x1bd)]&&console['error'](_0x4e69a7(0x23f)+_0x4a19a4['cause']),0x1;throw _0x4a19a4;}}}export class WorkflowKillCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1fa);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x216);async[a43_0x20f80e(0x233)](_0x457880){const _0x5c6b39=a43_0x20f80e,{options:_0x435dfa,args:_0x41fc9e,tdx:_0x2576cb}=_0x457880,_0x1cd459=_0x41fc9e[0x0];if(!_0x1cd459)return console[_0x5c6b39(0x1df)](_0x5c6b39(0x1b9)),0x1;try{const _0x58d155=_0x435dfa[_0x5c6b39(0x19b)];_0x435dfa['verbose']&&(console[_0x5c6b39(0x1df)](_0x5c6b39(0x1ab)+_0x1cd459),_0x58d155&&console[_0x5c6b39(0x1df)](_0x5c6b39(0x1bc)+_0x58d155));if(!_0x435dfa[_0x5c6b39(0x1f5)]){const _0x40f8be=await confirm(_0x5c6b39(0x1ed)+_0x1cd459+'?');if(!_0x40f8be)return console[_0x5c6b39(0x1df)]('Cancelled'),0x0;}const _0x4fb8e8=await withSpinner(_0x5c6b39(0x23a),()=>_0x2576cb[_0x5c6b39(0x235)]['kill'](_0x1cd459,_0x58d155),{'verbose':_0x435dfa[_0x5c6b39(0x1ff)]}),_0x35d0c7=_0x4fb8e8['data'];return console['error']('✔\x20'+_0x35d0c7),0x0;}catch(_0x377903){if(_0x377903 instanceof SDKError)return console['error'](_0x5c6b39(0x202)+_0x377903['message']),_0x377903[_0x5c6b39(0x1bd)]&&console['error']('\x20\x20Cause:\x20'+_0x377903[_0x5c6b39(0x1bd)]),0x1;throw _0x377903;}}}export class WorkflowRetryCommand extends BaseCommand{['name']=a43_0x20f80e(0x1b2);['description']=a43_0x20f80e(0x1b4);async[a43_0x20f80e(0x233)](_0x207780){const _0x3f6532=a43_0x20f80e,{options:_0xf6c02,args:_0x6809ef,tdx:_0x185422}=_0x207780,_0x4b068e=_0x6809ef[0x0];if(!_0x4b068e)return console[_0x3f6532(0x1df)](_0x3f6532(0x205)),console[_0x3f6532(0x1df)](_0x3f6532(0x1d6)),0x1;let _0x1a39d4=![],_0x179134=_0x4b068e;if(_0x4b068e['startsWith'](_0x3f6532(0x1f9)))_0x1a39d4=!![],_0x179134=_0x4b068e[_0x3f6532(0x1a5)](0x8);else{if(_0x4b068e[_0x3f6532(0x211)](_0x3f6532(0x1c5)))_0x1a39d4=![],_0x179134=_0x4b068e[_0x3f6532(0x1a5)](0x8);else return console['error']('Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'),console[_0x3f6532(0x1df)](_0x3f6532(0x1d6)),0x1;}try{const _0x23ee62=_0xf6c02[_0x3f6532(0x1cc)],_0x1a61c1=_0xf6c02[_0x3f6532(0x241)],_0x914f86=_0xf6c02['params'],_0x3bea8d=_0xf6c02[_0x3f6532(0x226)];_0xf6c02[_0x3f6532(0x1ff)]&&(console[_0x3f6532(0x1df)](_0x3f6532(0x1d8)+(_0x1a39d4?_0x3f6532(0x20b):_0x3f6532(0x1eb))+'\x20'+_0x179134),_0x23ee62&&console[_0x3f6532(0x1df)](_0x3f6532(0x20c)+_0x23ee62),_0x1a61c1&&console[_0x3f6532(0x1df)](_0x3f6532(0x1be)+_0x1a61c1),_0x914f86&&console['error']('Params:\x20'+_0x914f86),_0x3bea8d&&console[_0x3f6532(0x1df)]('Force:\x20yes'));let _0x1d70f9;if(_0x914f86)try{if(_0x914f86[_0x3f6532(0x211)]('@')){const _0x38ddeb=await import('fs/promises'),_0x4cf646=_0x914f86['substring'](0x1),_0x500373=await _0x38ddeb['readFile'](_0x4cf646,'utf-8');_0x1d70f9=JSON[_0x3f6532(0x1aa)](_0x500373);}else _0x1d70f9=JSON['parse'](_0x914f86);}catch{return console[_0x3f6532(0x1df)](_0x3f6532(0x220)),0x1;}if(!_0xf6c02[_0x3f6532(0x1f5)]){const _0x3e11d0=await confirm(_0x3f6532(0x20a)+(_0x1a39d4?_0x3f6532(0x20b):_0x3f6532(0x1eb))+'\x20'+_0x179134+'?');if(!_0x3e11d0)return console[_0x3f6532(0x1df)](_0x3f6532(0x227)),0x0;}let _0x2356ff;_0x1a39d4?_0x2356ff=await withSpinner('Retrying\x20session...',()=>_0x185422[_0x3f6532(0x235)][_0x3f6532(0x21e)](_0x179134,{'fromTask':_0x23ee62,'retryParams':_0x1d70f9}),{'verbose':_0xf6c02['verbose']}):_0x2356ff=await withSpinner('Retrying\x20attempt...',()=>_0x185422['workflow'][_0x3f6532(0x1af)](_0x179134,{'resumeFrom':_0x1a61c1,'retryParams':_0x1d70f9,'force':_0x3bea8d}),{'verbose':_0xf6c02[_0x3f6532(0x1ff)]});const _0x4fe6f9=_0x2356ff['data'];return console[_0x3f6532(0x1df)]('✔\x20Retry\x20started'),console['error'](_0x3f6532(0x1a3)+_0x4fe6f9['attemptId']),console[_0x3f6532(0x1df)](_0x3f6532(0x23e)+_0x4fe6f9['sessionId']),0x0;}catch(_0x1bac21){if(_0x1bac21 instanceof SDKError)return console[_0x3f6532(0x1df)](_0x3f6532(0x202)+_0x1bac21[_0x3f6532(0x1ef)]),_0x1bac21[_0x3f6532(0x1bd)]&&console['error'](_0x3f6532(0x23f)+_0x1bac21[_0x3f6532(0x1bd)]),0x1;throw _0x1bac21;}}}export class WorkflowRunCommand extends BaseCommand{['name']='workflow:run';[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x1f3);async[a43_0x20f80e(0x233)](_0x319b02){const _0x340caf=a43_0x20f80e,{options:_0x544144,args:_0x30e394,tdx:_0xbb002b}=_0x319b02,_0x73a0a7=_0x30e394[0x0];if(!_0x73a0a7)return console['error'](_0x340caf(0x1e6)),console[_0x340caf(0x1df)](_0x340caf(0x1c1)),0x1;const _0x123b3e=_0x544144[_0x340caf(0x1d1)],_0x542330=_0x544144[_0x340caf(0x243)],_0x3f6df9={};if(_0x123b3e&&Array['isArray'](_0x123b3e))for(const _0x1c834e of _0x123b3e){const _0x574599=_0x1c834e[_0x340caf(0x19f)]('=');if(_0x574599===-0x1)return console[_0x340caf(0x1df)](_0x340caf(0x1ca)+_0x1c834e),console[_0x340caf(0x1df)](_0x340caf(0x215)),0x1;const _0x5128ac=_0x1c834e['substring'](0x0,_0x574599),_0x29917d=_0x1c834e[_0x340caf(0x1a5)](_0x574599+0x1);try{_0x3f6df9[_0x5128ac]=JSON[_0x340caf(0x1aa)](_0x29917d);}catch{_0x3f6df9[_0x5128ac]=_0x29917d;}}_0x544144[_0x340caf(0x1ff)]&&(console[_0x340caf(0x1df)](_0x340caf(0x1ec)+_0x73a0a7),Object[_0x340caf(0x212)](_0x3f6df9)[_0x340caf(0x1b3)]>0x0&&console['error']('Parameters:\x20'+JSON['stringify'](_0x3f6df9)),_0x542330&&console[_0x340caf(0x1df)](_0x340caf(0x1e3)+_0x542330));const _0x4430ad=await withSpinner(_0x340caf(0x200),()=>_0xbb002b[_0x340caf(0x235)][_0x340caf(0x207)](_0x73a0a7,_0x3f6df9,{'sessionTime':_0x542330}),{'verbose':_0x544144['verbose']}),_0x38a755=_0x4430ad['data'];return console['error'](_0x340caf(0x1fd)),console[_0x340caf(0x1df)](_0x340caf(0x1c2)+_0x38a755['id']),console[_0x340caf(0x1df)]('\x20\x20Session\x20ID:\x20'+_0x38a755[_0x340caf(0x1f8)]),console[_0x340caf(0x1df)](_0x340caf(0x225)+_0x38a755[_0x340caf(0x1da)]?.['name']),console[_0x340caf(0x1df)](_0x340caf(0x1ac)+_0x38a755[_0x340caf(0x235)]?.[_0x340caf(0x1a4)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a43_0x20f80e(0x1a4)]=a43_0x20f80e(0x1c3);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x21d);async['execute'](_0x5bc304){const _0x133aa0=a43_0x20f80e,{options:_0x304b00,args:_0x295766,tdx:_0x2a6288}=_0x5bc304,_0x50b63b=_0x295766[0x0],_0x51ec7e=_0x295766[0x1]||'.';if(!_0x50b63b)return console[_0x133aa0(0x1df)](_0x133aa0(0x1f4)),console[_0x133aa0(0x1df)](_0x133aa0(0x1dd)),0x1;const _0x543ebe=_0x304b00[_0x133aa0(0x214)];_0x304b00[_0x133aa0(0x1ff)]&&(console['error'](_0x133aa0(0x19e)+_0x50b63b),console['error'](_0x133aa0(0x1c9)+_0x51ec7e),_0x543ebe&&console['error'](_0x133aa0(0x23d)+_0x543ebe));const _0x49f35d=await withSpinner(_0x133aa0(0x209)+_0x50b63b+_0x133aa0(0x1bf),()=>_0x2a6288[_0x133aa0(0x235)][_0x133aa0(0x228)](_0x50b63b,_0x51ec7e,{'revision':_0x543ebe}),{'verbose':_0x304b00[_0x133aa0(0x1ff)]}),_0x59324f=_0x49f35d[_0x133aa0(0x20d)];return console['error']('✔\x20Downloaded\x20'+_0x59324f[_0x133aa0(0x1e5)]),console[_0x133aa0(0x1df)](_0x133aa0(0x1a1)+_0x59324f[_0x133aa0(0x214)]),console['error'](_0x133aa0(0x22b)+_0x59324f['filesExtracted']),console[_0x133aa0(0x1df)]('\x20\x20Location:\x20'+_0x51ec7e+'/'+_0x59324f['projectName']),0x0;}}function a43_0x4cb6(_0x49c0e2,_0x50d60c){_0x49c0e2=_0x49c0e2-0x199;const _0x23f913=a43_0x23f9();let _0x4cb649=_0x23f913[_0x49c0e2];return _0x4cb649;}export class WorkflowPushCommand extends BaseCommand{['name']=a43_0x20f80e(0x19a);['description']='Push\x20workflow\x20project\x20to\x20Treasure\x20Data';async[a43_0x20f80e(0x233)](_0x1c1e27){const _0x1630b2=a43_0x20f80e,{options:_0x3ddd85,args:_0x5be7fa,tdx:_0x4825fc}=_0x1c1e27;let _0x416104='.',_0x27edef=_0x3ddd85['name'];if(_0x5be7fa[0x0]){const {promises:_0x380e47}=await import('fs');try{const _0x139d23=await _0x380e47[_0x1630b2(0x1f6)](_0x5be7fa[0x0]);if(_0x139d23[_0x1630b2(0x203)]())_0x416104=_0x5be7fa[0x0];else return console[_0x1630b2(0x1df)](_0x1630b2(0x202)+_0x5be7fa[0x0]+_0x1630b2(0x1c6)),0x1;}catch{_0x27edef=_0x5be7fa[0x0],_0x416104='.';}}const _0x25a250=_0x3ddd85[_0x1630b2(0x214)],_0x99d55a=_0x3ddd85[_0x1630b2(0x199)];_0x3ddd85[_0x1630b2(0x1ff)]&&(console[_0x1630b2(0x1df)](_0x1630b2(0x1a2)+_0x416104),_0x27edef&&console[_0x1630b2(0x1df)](_0x1630b2(0x1c8)+_0x27edef),_0x25a250&&console['error'](_0x1630b2(0x23d)+_0x25a250),_0x99d55a&&console[_0x1630b2(0x1df)](_0x1630b2(0x1fe)));const _0x80cf32=await withSpinner('Pushing\x20workflow\x20project...',()=>_0x4825fc[_0x1630b2(0x235)][_0x1630b2(0x23b)](_0x416104,{'projectName':_0x27edef,'revision':_0x25a250,'skipValidation':_0x99d55a}),{'verbose':_0x3ddd85[_0x1630b2(0x1ff)]}),_0x2b3e11=_0x80cf32[_0x1630b2(0x20d)];return console[_0x1630b2(0x1df)](_0x1630b2(0x19d)+_0x2b3e11[_0x1630b2(0x1e5)]),console[_0x1630b2(0x1df)](_0x1630b2(0x1de)+_0x2b3e11[_0x1630b2(0x242)]),console[_0x1630b2(0x1df)](_0x1630b2(0x1a1)+_0x2b3e11[_0x1630b2(0x214)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{['name']=a43_0x20f80e(0x1c4);[a43_0x20f80e(0x1d9)]=a43_0x20f80e(0x22d);async['execute'](_0x3ec2a6){const _0x4ba6d6=a43_0x20f80e,{options:_0x3e7db1,args:_0x1f8ec3,tdx:_0xbc4735}=_0x3ec2a6,_0x45fdc7=_0x1f8ec3[0x0];if(!_0x45fdc7)return console[_0x4ba6d6(0x1df)](_0x4ba6d6(0x1f7)),console[_0x4ba6d6(0x1df)](_0x4ba6d6(0x1bb)),0x1;_0x3e7db1[_0x4ba6d6(0x1ff)]&&console[_0x4ba6d6(0x1df)]('Project:\x20'+_0x45fdc7);if(!_0x3e7db1[_0x4ba6d6(0x1f5)]){const _0x5d96d3=await confirm(_0x4ba6d6(0x1b5)+_0x45fdc7+_0x4ba6d6(0x21f));if(!_0x5d96d3)return console[_0x4ba6d6(0x1df)]('Cancelled'),0x0;}const _0x27f1d3=await withSpinner(_0x4ba6d6(0x1e7)+_0x45fdc7+_0x4ba6d6(0x1bf),()=>_0xbc4735['workflow'][_0x4ba6d6(0x20e)](_0x45fdc7),{'verbose':_0x3e7db1[_0x4ba6d6(0x1ff)]}),_0x397a19=_0x27f1d3[_0x4ba6d6(0x20d)];return console[_0x4ba6d6(0x1df)](_0x4ba6d6(0x1ad)+_0x397a19[_0x4ba6d6(0x1e5)]),console['error'](_0x4ba6d6(0x1de)+_0x397a19['projectId']),0x0;}}
|
package/dist/core/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4c87b4,_0x55df91){const _0x5cd7bc=a44_0x254e,_0xe247b6=_0x4c87b4();while(!![]){try{const _0x228126=parseInt(_0x5cd7bc(0x18c))/0x1*(parseInt(_0x5cd7bc(0x18a))/0x2)+-parseInt(_0x5cd7bc(0x19a))/0x3*(parseInt(_0x5cd7bc(0x192))/0x4)+-parseInt(_0x5cd7bc(0x19d))/0x5*(parseInt(_0x5cd7bc(0x195))/0x6)+-parseInt(_0x5cd7bc(0x194))/0x7*(parseInt(_0x5cd7bc(0x196))/0x8)+-parseInt(_0x5cd7bc(0x197))/0x9+parseInt(_0x5cd7bc(0x19c))/0xa+parseInt(_0x5cd7bc(0x190))/0xb;if(_0x228126===_0x55df91)break;else _0xe247b6['push'](_0xe247b6['shift']());}catch(_0x9c2ae8){_0xe247b6['push'](_0xe247b6['shift']());}}}(a44_0x3295,0x9e6ec));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';function a44_0x3295(){const _0xcfc69e=['4635Lobpfg','35052MIzVdx','../../package.json','58ftjWjN','TD1\x20','0.0.0','utf-8','9623042bdMujh','parse','8WinWFQ','Authorization','191695AqyLNO','2406mmEPzB','56XqRAEQ','6027282weMVlP','length','tdx/','1257642sALJOB','replace','8291580caesqS'];a44_0x3295=function(){return _0xcfc69e;};return a44_0x3295();}import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x5752ee=a44_0x254e;try{const _0x1d4523=fileURLToPath(import.meta.url),_0x14a2f3=dirname(_0x1d4523),_0x1999f9=join(_0x14a2f3,_0x5752ee(0x18b)),_0x4e3640=JSON[_0x5752ee(0x191)](readFileSync(_0x1999f9,_0x5752ee(0x18f)));return _0x4e3640['version'];}catch{return _0x5752ee(0x18e);}}export function getUserAgent(){const _0x15c467=a44_0x254e,_0x2adc02=getVersion(),_0x2ebada=platform(),_0x39fb6=process['version'][_0x15c467(0x19b)]('v','');return _0x15c467(0x199)+_0x2adc02+'\x20('+_0x2ebada+';\x20node/'+_0x39fb6+')';}export function getAuthHeaders(_0xcec792,_0x48cd19){const _0x28afb9=a44_0x254e,_0x2b4f33=getVersion(),_0x3662b7={'User-Agent':getUserAgent(),'X-TD-Client':'tdx','X-TD-Client-Version':_0x2b4f33};return _0x48cd19&&(_0x3662b7[_0x28afb9(0x193)]=_0x28afb9(0x18d)+_0x48cd19),_0x3662b7;}export function toHeaderRecord(_0x2af8e9){const _0x4105ac={};for(const [_0x2baca1,_0x39d51f]of Object['entries'](_0x2af8e9)){_0x39d51f!==undefined&&(_0x4105ac[_0x2baca1]=_0x39d51f);}return _0x4105ac;}function a44_0x254e(_0x349831,_0x16f69c){_0x349831=_0x349831-0x18a;const _0x329561=a44_0x3295();let _0x254e9c=_0x329561[_0x349831];return _0x254e9c;}export function getTrinoHeaders(_0x3ee3bf,_0x3a40f3){const _0x1c0d7b=a44_0x254e,_0x5862ee=getAuthHeaders(_0x3ee3bf,_0x3a40f3),_0xdcf6ff=toHeaderRecord(_0x5862ee);return delete _0xdcf6ff[_0x1c0d7b(0x193)],_0x3a40f3&&(_0xdcf6ff['X-Trino-User']=_0x3a40f3),_0xdcf6ff;}export function hasAPIKey(_0x597730){const _0x33b5b1=a44_0x254e,_0x337b3a=getAPIKey(_0x597730);return _0x337b3a!==undefined&&_0x337b3a[_0x33b5b1(0x198)]>0x0;}
|
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a45_0x23e9(_0x4f1577,_0x360e7f){_0x4f1577=_0x4f1577-0x100;const _0x7a7cec=a45_0x7a7c();let _0x23e9e0=_0x7a7cec[_0x4f1577];return _0x23e9e0;}(function(_0x36fc22,_0x5105d1){const _0x4bee3f=a45_0x23e9,_0x24043b=_0x36fc22();while(!![]){try{const _0x17c8c6=-parseInt(_0x4bee3f(0x110))/0x1*(parseInt(_0x4bee3f(0x10d))/0x2)+parseInt(_0x4bee3f(0x116))/0x3*(-parseInt(_0x4bee3f(0x139))/0x4)+parseInt(_0x4bee3f(0x148))/0x5*(-parseInt(_0x4bee3f(0x13f))/0x6)+-parseInt(_0x4bee3f(0x124))/0x7*(-parseInt(_0x4bee3f(0x119))/0x8)+parseInt(_0x4bee3f(0x14a))/0x9+parseInt(_0x4bee3f(0x115))/0xa*(parseInt(_0x4bee3f(0x118))/0xb)+parseInt(_0x4bee3f(0x103))/0xc;if(_0x17c8c6===_0x5105d1)break;else _0x24043b['push'](_0x24043b['shift']());}catch(_0x5c034a){_0x24043b['push'](_0x24043b['shift']());}}}(a45_0x7a7c,0x3be69));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x41352d from'node:fs';import*as a45_0x3ff37b from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';function a45_0x7a7c(){const _0x5eaa72=['.env','accountId','Warning:\x20Unknown\x20site\x20\x27','154148bbwDxK','entries','stg-us01','\x20env\x20var','split','isDeprecated','404724vyzTxk','stg-ap03','Warning:\x20Failed\x20to\x20read\x20','toUpperCase','TDX_API_KEY','trim','account_info.','TDX_API_KEY\x20env\x20var','tdx','10yjDCuJ','keychain','3892239ZVgGUY','stringify','eu01','existsSync','map','match','\x27,\x20defaulting\x20to\x20us01','jp01','slice','profiles','2623644sEQLmm','replace','includes','source','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','readFileSync','us01','TD_API_KEY\x20env\x20var\x20(deprecated)','number','TDX_CACHE_DIR','105970TReRdW','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','dev-eu01','6dZDwNQ','llm_default_project.','.env.','endsWith','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','20jrEUBX','6uNlyWK','keychain\x20(profile:\x20','165275mNvsBJ','752696PfELCx','parse','startsWith','yellow','site','env','llm_default_project','TD_API_KEY','.json','ap03','string','7YiQeXa','TD_API_KEY_','join','account_info.json','stg-jp01','filter','.cache','TDX_CONFIG_DIR','Warning:\x20Failed\x20to\x20load\x20','dev-us01','warn','tdx.json','profile','apiKeys','apiKey','name','TDX_API_KEY_','utf-8'];a45_0x7a7c=function(){return _0x5eaa72;};return a45_0x7a7c();}import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x21338d from'chalk';export function getConfigDir(){const _0x3d9f79=a45_0x23e9;return process[_0x3d9f79(0x11e)][_0x3d9f79(0x12b)]||join(homedir(),'.config',_0x3d9f79(0x147));}export function getConfigFile(){const _0x55fda8=a45_0x23e9;return join(getConfigDir(),_0x55fda8(0x136));}export function getConfigFilePath(_0x43e571){const _0x2c6f5b=a45_0x23e9,_0x433bd2=getConfigDir();return _0x43e571?a45_0x3ff37b[_0x2c6f5b(0x126)](_0x433bd2,_0x2c6f5b(0x112)+_0x43e571):getConfigFile();}export function getCacheDir(){const _0x438a0b=a45_0x23e9;return process[_0x438a0b(0x11e)][_0x438a0b(0x10c)]||join(homedir(),_0x438a0b(0x12a),_0x438a0b(0x147));}export function getLLMProjectCacheFile(_0x4eb1d7){const _0x35912f=a45_0x23e9,_0x16cafa=_0x4eb1d7?_0x35912f(0x111)+_0x4eb1d7:_0x35912f(0x11f);return join(getCacheDir(),_0x16cafa);}export function readCachedLLMProject(_0x3c6d04){const _0x4d2226=a45_0x23e9;try{const _0x4f66be=getLLMProjectCacheFile(_0x3c6d04);if(!existsSync(_0x4f66be))return null;const _0x4a9c04=readFileSync(_0x4f66be,_0x4d2226(0x135))[_0x4d2226(0x144)]();try{const _0x10ab29=JSON[_0x4d2226(0x11a)](_0x4a9c04);if(_0x10ab29&&typeof _0x10ab29['id']===_0x4d2226(0x123)&&typeof _0x10ab29[_0x4d2226(0x133)]===_0x4d2226(0x123))return _0x10ab29;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x4a60b0,_0x515bc7,_0x6d4775){const _0x3e5878=a45_0x23e9;try{const _0x59fcfb=getCacheDir(),_0x3cf91f=getLLMProjectCacheFile(_0x6d4775);!existsSync(_0x59fcfb)&&mkdirSync(_0x59fcfb,{'recursive':!![]});const _0x381666={'name':_0x4a60b0,'id':_0x515bc7};writeFileSync(_0x3cf91f,JSON[_0x3e5878(0x14b)](_0x381666),_0x3e5878(0x135));}catch{}}export function getAccountInfoCacheFile(_0x4b5606){const _0x4f81d2=a45_0x23e9,_0x92e0a3=_0x4b5606?_0x4f81d2(0x145)+_0x4b5606+_0x4f81d2(0x121):_0x4f81d2(0x127);return join(getCacheDir(),_0x92e0a3);}export function readCachedAccountInfo(_0x433f29){const _0x351e5e=a45_0x23e9;try{const _0x6db284=getAccountInfoCacheFile(_0x433f29);if(!existsSync(_0x6db284))return null;const _0xc6bdb6=readFileSync(_0x6db284,'utf-8')['trim'](),_0xd156=JSON[_0x351e5e(0x11a)](_0xc6bdb6);if(_0xd156&&typeof _0xd156[_0x351e5e(0x11d)]==='string'&&typeof _0xd156[_0x351e5e(0x137)]===_0x351e5e(0x10b))return _0xd156;return null;}catch{return null;}}export function writeCachedAccountInfo(_0xf501f8,_0x4dc62e,_0x4b12cf){const _0xd9d38c=a45_0x23e9;try{const _0x21dd5e=getCacheDir(),_0x5a329d=getAccountInfoCacheFile(_0x4b12cf);!existsSync(_0x21dd5e)&&mkdirSync(_0x21dd5e,{'recursive':!![]});const _0x10d8c4={'site':_0xf501f8,'accountId':_0x4dc62e,'cachedAt':new Date()['toISOString']()};writeFileSync(_0x5a329d,JSON[_0xd9d38c(0x14b)](_0x10d8c4),_0xd9d38c(0x135));}catch{}}export function parseEnvFile(_0x2b67a7){const _0xa81bbf=a45_0x23e9,_0x4121b0={};for(const _0x3eb2fa of _0x2b67a7['split']('\x0a')){const _0x357c83=_0x3eb2fa[_0xa81bbf(0x144)]();if(!_0x357c83||_0x357c83['startsWith']('#'))continue;const _0xa2dd92=_0x357c83[_0xa81bbf(0x14f)](/^([^=]+)=(.*)$/);if(_0xa2dd92){const _0x33284d=_0xa2dd92[0x1][_0xa81bbf(0x144)]();let _0x2dfb91=_0xa2dd92[0x2][_0xa81bbf(0x144)]();(_0x2dfb91[_0xa81bbf(0x11b)]('\x22')&&_0x2dfb91[_0xa81bbf(0x113)]('\x22')||_0x2dfb91[_0xa81bbf(0x11b)]('\x27')&&_0x2dfb91['endsWith']('\x27'))&&(_0x2dfb91=_0x2dfb91[_0xa81bbf(0x101)](0x1,-0x1)),_0x4121b0[_0x33284d]=_0x2dfb91;}}return _0x4121b0;}export function readUserConfig(){const _0x5def9d=getConfigFile();if(!existsSync(_0x5def9d))return{};try{const _0x10c260=readFileSync(_0x5def9d,'utf-8');return parseEnvFile(_0x10c260);}catch(_0x5cd3a8){return console['warn']('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x5def9d+':',_0x5cd3a8),{};}}export function resolveSite(_0x233f2b){const _0x14ab52=a45_0x23e9,_0x131784=[_0x14ab52(0x109),_0x14ab52(0x100),_0x14ab52(0x14c),'ap02','ap03',_0x14ab52(0x12d),_0x14ab52(0x10f),_0x14ab52(0x13b),_0x14ab52(0x128),'stg-ap03'];if(_0x131784['includes'](_0x233f2b))return _0x233f2b;if(_0x233f2b in SITE_ALIASES)return SITE_ALIASES[_0x233f2b];return console[_0x14ab52(0x12e)](_0x14ab52(0x138)+_0x233f2b+_0x14ab52(0x150)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x5812f6,_0xf9ea6a){const _0x5eda20=a45_0x23e9,_0x28af3b=_0xf9ea6a||getActiveProfileName();if(_0x28af3b){const _0x518022='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x28af3b);if(process[_0x5eda20(0x11e)][_0x518022])return process[_0x5eda20(0x11e)][_0x518022];}if(process[_0x5eda20(0x11e)][_0x5eda20(0x143)])return process[_0x5eda20(0x11e)][_0x5eda20(0x143)];if(process['env'][_0x5eda20(0x120)])return process[_0x5eda20(0x11e)]['TD_API_KEY'];const _0x3b8ff4=_0x5812f6['toUpperCase']()[_0x5eda20(0x104)](/-/g,'_'),_0xfe2d95=_0x5eda20(0x125)+_0x3b8ff4;if(_0x28af3b){const _0xb02988=loadProfileEnv(_0x28af3b);if(_0xb02988){if(_0xb02988[_0xfe2d95])return _0xb02988[_0xfe2d95];if(_0xb02988['TD_API_KEY'])return _0xb02988[_0x5eda20(0x120)];}}const _0x1db109=loadUserConfigOnce();if(_0x1db109[_0xfe2d95])return _0x1db109[_0xfe2d95];if(_0x1db109['TD_API_KEY'])return _0x1db109[_0x5eda20(0x120)];return undefined;}export function normalizeProfileForEnvVar(_0x4afeb3){return _0x4afeb3['toUpperCase']()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x176c89,_0x2327d6){const _0x526437=a45_0x23e9,_0x136962=_0x2327d6||getActiveProfileName()||undefined;if(_0x136962){const _0x55f84e=_0x526437(0x134)+normalizeProfileForEnvVar(_0x136962);if(process[_0x526437(0x11e)][_0x55f84e])return{'apiKey':process[_0x526437(0x11e)][_0x55f84e],'source':_0x55f84e+_0x526437(0x13c),'isDeprecated':![]};const _0x19de51=getCachedCredential(_0x176c89,_0x136962);if(_0x19de51)return{'apiKey':_0x19de51,'source':_0x526437(0x117)+_0x136962+')','isDeprecated':![]};const _0x129fa3=await getKeychainAPIKey(_0x136962);if(_0x129fa3)return setCachedCredential(_0x129fa3,_0x176c89,_0x136962),{'apiKey':_0x129fa3,'source':_0x526437(0x117)+_0x136962+')','isDeprecated':![]};}if(process[_0x526437(0x11e)][_0x526437(0x143)])return{'apiKey':process[_0x526437(0x11e)][_0x526437(0x143)],'source':_0x526437(0x146),'isDeprecated':![]};if(!_0x136962){const _0xc3bd=getCachedCredential(_0x176c89,undefined);if(_0xc3bd)return{'apiKey':_0xc3bd,'source':_0x526437(0x149),'isDeprecated':![]};const _0x384328=await getKeychainAPIKey(undefined);if(_0x384328)return setCachedCredential(_0x384328,_0x176c89,undefined),{'apiKey':_0x384328,'source':_0x526437(0x149),'isDeprecated':![]};}if(process[_0x526437(0x11e)][_0x526437(0x120)])return{'apiKey':process[_0x526437(0x11e)]['TD_API_KEY'],'source':_0x526437(0x10a),'isDeprecated':!![]};const _0x144579=getLegacyEnvAPIKey(_0x176c89,_0x136962);if(_0x144579){const _0x535191=await isKeychainAvailable();if(_0x535191)try{await saveKeychainAPIKey(_0x144579,_0x136962),setCachedCredential(_0x144579,_0x176c89,_0x136962);const _0x10473e=getConfigFilePath(_0x136962);cleanupLegacyEnvFile(_0x10473e)&&console[_0x526437(0x12e)](a45_0x21338d[_0x526437(0x11c)]('⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage'));}catch(_0x7cface){console['warn'](a45_0x21338d['yellow']('⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20'+_0x7cface));}const _0x35490a=_0x136962?'legacy\x20.env\x20file\x20(profile:\x20'+_0x136962+')':'legacy\x20.env\x20file';return{'apiKey':_0x144579,'source':_0x35490a,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x2ec4a2,_0x537318,_0x5a1744=!![]){const _0xb2c290=a45_0x23e9,_0x1bb94a=await resolveAPIKeyAsync(_0x2ec4a2,_0x537318);if(!_0x1bb94a)return undefined;if(_0x5a1744&&_0x1bb94a[_0xb2c290(0x13e)]&&_0x1bb94a[_0xb2c290(0x106)][_0xb2c290(0x105)](_0xb2c290(0x120))){const _0x5e8f33=_0x537318||getActiveProfileName()||undefined,_0x3b4fd6=_0x5e8f33?_0xb2c290(0x134)+normalizeProfileForEnvVar(_0x5e8f33):'TDX_API_KEY_<PROFILE>';console['warn'](a45_0x21338d['yellow'](_0xb2c290(0x10e)+(_0xb2c290(0x114)+_0x3b4fd6+').')));}return _0x1bb94a[_0xb2c290(0x132)];}function getLegacyEnvAPIKey(_0x37a5df,_0x2bb346){const _0xaffbb2=a45_0x23e9,_0x545436=_0x37a5df[_0xaffbb2(0x142)]()[_0xaffbb2(0x104)](/-/g,'_'),_0x4923a6='TD_API_KEY_'+_0x545436;if(_0x2bb346){const _0x165276=loadProfileEnv(_0x2bb346);if(_0x165276){if(_0x165276[_0x4923a6])return _0x165276[_0x4923a6];if(_0x165276[_0xaffbb2(0x120)])return _0x165276[_0xaffbb2(0x120)];}}const _0x5e9b6b=loadUserConfigOnce();if(_0x5e9b6b[_0x4923a6])return _0x5e9b6b[_0x4923a6];if(_0x5e9b6b['TD_API_KEY'])return _0x5e9b6b['TD_API_KEY'];return undefined;}function cleanupLegacyEnvFile(_0xce3389){const _0x11f0de=a45_0x23e9;if(!existsSync(_0xce3389))return![];try{const _0x447589=readFileSync(_0xce3389,_0x11f0de(0x135)),_0x3da74d=_0x447589[_0x11f0de(0x13d)]('\x0a'),_0x292327=_0x3da74d[_0x11f0de(0x129)](_0x2770b0=>{const _0x1b50c0=_0x11f0de,_0x2309b3=_0x2770b0['trim']();if(!_0x2309b3||_0x2309b3['startsWith']('#'))return!![];const [_0x512993]=_0x2309b3[_0x1b50c0(0x13d)]('=');return!_0x512993[_0x1b50c0(0x11b)](_0x1b50c0(0x120));}),_0x172e2d=_0x292327['some'](_0x431960=>{const _0x3c2ef1=_0x11f0de,_0x332651=_0x431960[_0x3c2ef1(0x144)]();return _0x332651&&!_0x332651[_0x3c2ef1(0x11b)]('#');});if(!_0x172e2d)return unlinkSync(_0xce3389),!![];return writeFileSync(_0xce3389,_0x292327[_0x11f0de(0x126)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x45d3e3){const _0x30eb51=a45_0x23e9,_0x338a6f=a45_0x3ff37b[_0x30eb51(0x126)](getConfigDir(),_0x30eb51(0x112)+_0x45d3e3);if(a45_0x41352d['existsSync'](_0x338a6f)){validateSecureFilePermissions(_0x338a6f);try{const _0x12514e=a45_0x41352d['readFileSync'](_0x338a6f,'utf-8');return parseEnvFile(_0x12514e);}catch(_0x28cf5a){console[_0x30eb51(0x12e)](_0x30eb51(0x12c)+_0x338a6f+':\x20'+_0x28cf5a);}}const _0x29da5e=a45_0x3ff37b['join'](getConfigDir(),_0x30eb51(0x102),_0x45d3e3,_0x30eb51(0x136));if(a45_0x41352d[_0x30eb51(0x14d)](_0x29da5e)){validateSecureFilePermissions(_0x29da5e);try{const _0x1cd4f5=a45_0x41352d[_0x30eb51(0x108)](_0x29da5e,_0x30eb51(0x135));return parseEnvFile(_0x1cd4f5);}catch(_0x53b97e){return console['warn']('Warning:\x20Failed\x20to\x20load\x20'+_0x29da5e+':\x20'+_0x53b97e),null;}}return null;}function getActiveProfileName(){const _0x249448=a45_0x23e9,_0x3aa0a8=a45_0x3ff37b['join'](getConfigDir(),_0x249448(0x12f));if(!a45_0x41352d[_0x249448(0x14d)](_0x3aa0a8))return null;try{const _0x51c6eb=a45_0x41352d[_0x249448(0x108)](_0x3aa0a8,'utf-8'),_0x2d14a5=JSON['parse'](_0x51c6eb);return _0x2d14a5[_0x249448(0x130)]||null;}catch{return null;}}export function saveAPIKey(_0x5a1f24,_0x46c0a1,_0x218b6d){const _0x252f4a=a45_0x23e9,_0x2f3e09=getConfigDir(),_0x1db9aa=getConfigFilePath(_0x218b6d);!existsSync(_0x2f3e09)&&mkdirSync(_0x2f3e09,{'recursive':!![],'mode':0x1c0});let _0x3bc73d={};if(existsSync(_0x1db9aa))try{const _0x51cc74=readFileSync(_0x1db9aa,_0x252f4a(0x135));_0x3bc73d=parseEnvFile(_0x51cc74);}catch(_0x1e15c3){console['warn'](_0x252f4a(0x141)+_0x1db9aa+':',_0x1e15c3);}const _0xd6a6c8=_0x5a1f24[_0x252f4a(0x142)]()[_0x252f4a(0x104)](/-/g,'_');_0x3bc73d[_0x252f4a(0x125)+_0xd6a6c8]=_0x46c0a1;const _0x137cd0=Object[_0x252f4a(0x13a)](_0x3bc73d)[_0x252f4a(0x14e)](([_0x39b4bc,_0xb3f427])=>_0x39b4bc+'='+_0xb3f427);writeFileSync(_0x1db9aa,_0x137cd0[_0x252f4a(0x126)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x171cf2,_0x224fc3,_0x111f82){const _0x410838=a45_0x23e9;await saveKeychainAPIKey(_0x171cf2,_0x111f82),setCachedCredential(_0x171cf2,_0x224fc3,_0x111f82);const _0x17d848=getConfigFilePath(_0x111f82);cleanupLegacyEnvFile(_0x17d848)&&console[_0x410838(0x12e)](a45_0x21338d[_0x410838(0x11c)](_0x410838(0x107)));}export function loadConfig(){const _0x566d56=a45_0x23e9,_0x381476={'apiKeys':{},'defaultSite':'us01'},_0x44ce35=['us01','jp01',_0x566d56(0x14c),'ap02',_0x566d56(0x122),'dev-us01','dev-eu01',_0x566d56(0x13b),_0x566d56(0x128),_0x566d56(0x140)];for(const _0x24698f of _0x44ce35){const _0x3862bb=getAPIKey(_0x24698f);_0x3862bb&&(_0x381476[_0x566d56(0x131)][_0x24698f]=_0x3862bb);}return _0x381476;}
|
|
1
|
+
(function(_0x51e490,_0x17c6b5){const _0x20884e=a45_0x1f34,_0xef1e82=_0x51e490();while(!![]){try{const _0x4d1cda=parseInt(_0x20884e(0x1c4))/0x1+parseInt(_0x20884e(0x1e2))/0x2*(parseInt(_0x20884e(0x1d3))/0x3)+parseInt(_0x20884e(0x1bd))/0x4*(parseInt(_0x20884e(0x1ee))/0x5)+-parseInt(_0x20884e(0x1bf))/0x6+parseInt(_0x20884e(0x1e4))/0x7+parseInt(_0x20884e(0x1ef))/0x8+parseInt(_0x20884e(0x1e7))/0x9*(-parseInt(_0x20884e(0x1e3))/0xa);if(_0x4d1cda===_0x17c6b5)break;else _0xef1e82['push'](_0xef1e82['shift']());}catch(_0x5a70ad){_0xef1e82['push'](_0xef1e82['shift']());}}}(a45_0x4fa2,0x7d4d9));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a45_0x49d92d from'node:fs';import*as a45_0x11fc62 from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a45_0x4ee97d from'chalk';export function getConfigDir(){const _0x2f5341=a45_0x1f34;return process[_0x2f5341(0x1ea)][_0x2f5341(0x1df)]||join(homedir(),'.config',_0x2f5341(0x1c7));}export function getConfigFile(){const _0x9d9642=a45_0x1f34;return join(getConfigDir(),_0x9d9642(0x1f0));}export function getConfigFilePath(_0x22b434){const _0x2804d2=a45_0x1f34,_0x54859f=getConfigDir();return _0x22b434?a45_0x11fc62[_0x2804d2(0x1ab)](_0x54859f,'.env.'+_0x22b434):getConfigFile();}export function getCacheDir(){const _0x4b940b=a45_0x1f34;return process[_0x4b940b(0x1ea)][_0x4b940b(0x1da)]||join(homedir(),'.cache',_0x4b940b(0x1c7));}export function getLLMProjectCacheFile(_0x11aff1){const _0x5effa9=a45_0x1f34,_0x4db092=_0x11aff1?_0x5effa9(0x1b2)+_0x11aff1:_0x5effa9(0x1db);return join(getCacheDir(),_0x4db092);}export function readCachedLLMProject(_0x4fa5a6){const _0x5a9e5a=a45_0x1f34;try{const _0x4d7a00=getLLMProjectCacheFile(_0x4fa5a6);if(!existsSync(_0x4d7a00))return null;const _0x2fdc85=readFileSync(_0x4d7a00,_0x5a9e5a(0x1b8))[_0x5a9e5a(0x1cd)]();try{const _0x4e4d51=JSON['parse'](_0x2fdc85);if(_0x4e4d51&&typeof _0x4e4d51['id']===_0x5a9e5a(0x1f2)&&typeof _0x4e4d51[_0x5a9e5a(0x1bc)]===_0x5a9e5a(0x1f2))return _0x4e4d51;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x198589,_0x1e13ee,_0x424cdd){const _0x32fe6d=a45_0x1f34;try{const _0x353783=getCacheDir(),_0x26a34b=getLLMProjectCacheFile(_0x424cdd);!existsSync(_0x353783)&&mkdirSync(_0x353783,{'recursive':!![]});const _0x3658c3={'name':_0x198589,'id':_0x1e13ee};writeFileSync(_0x26a34b,JSON[_0x32fe6d(0x1ba)](_0x3658c3),'utf-8');}catch{}}export function getAccountInfoCacheFile(_0xa46a85){const _0x260086=a45_0x1f34,_0x20015d=_0xa46a85?_0x260086(0x1cb)+_0xa46a85+_0x260086(0x1d7):'account_info.json';return join(getCacheDir(),_0x20015d);}export function readCachedAccountInfo(_0x530d71){const _0xb2df2e=a45_0x1f34;try{const _0x4a461e=getAccountInfoCacheFile(_0x530d71);if(!existsSync(_0x4a461e))return null;const _0x4e9ddf=readFileSync(_0x4a461e,_0xb2df2e(0x1b8))['trim'](),_0x4d84e0=JSON['parse'](_0x4e9ddf);if(_0x4d84e0&&typeof _0x4d84e0[_0xb2df2e(0x1b7)]===_0xb2df2e(0x1f2)&&typeof _0x4d84e0[_0xb2df2e(0x1c0)]===_0xb2df2e(0x1c1))return _0x4d84e0;return null;}catch{return null;}}function a45_0x1f34(_0x534290,_0x3fb1bb){_0x534290=_0x534290-0x1a8;const _0x4fa28d=a45_0x4fa2();let _0x1f34fa=_0x4fa28d[_0x534290];return _0x1f34fa;}export function writeCachedAccountInfo(_0x18bf1d,_0x134224,_0x422fac){const _0xe8a8d3=a45_0x1f34;try{const _0x5e5b67=getCacheDir(),_0x2e9cb2=getAccountInfoCacheFile(_0x422fac);!existsSync(_0x5e5b67)&&mkdirSync(_0x5e5b67,{'recursive':!![]});const _0x1e548f={'site':_0x18bf1d,'accountId':_0x134224,'cachedAt':new Date()['toISOString']()};writeFileSync(_0x2e9cb2,JSON[_0xe8a8d3(0x1ba)](_0x1e548f),'utf-8');}catch{}}export function parseEnvFile(_0xaab290){const _0x1d038a=a45_0x1f34,_0x4b32ca={};for(const _0xb84c9 of _0xaab290[_0x1d038a(0x1cc)]('\x0a')){const _0x1edae1=_0xb84c9[_0x1d038a(0x1cd)]();if(!_0x1edae1||_0x1edae1[_0x1d038a(0x1c9)]('#'))continue;const _0x22ca70=_0x1edae1[_0x1d038a(0x1e6)](/^([^=]+)=(.*)$/);if(_0x22ca70){const _0x4467a4=_0x22ca70[0x1][_0x1d038a(0x1cd)]();let _0x4dda58=_0x22ca70[0x2][_0x1d038a(0x1cd)]();(_0x4dda58[_0x1d038a(0x1c9)]('\x22')&&_0x4dda58[_0x1d038a(0x1b0)]('\x22')||_0x4dda58[_0x1d038a(0x1c9)]('\x27')&&_0x4dda58['endsWith']('\x27'))&&(_0x4dda58=_0x4dda58['slice'](0x1,-0x1)),_0x4b32ca[_0x4467a4]=_0x4dda58;}}return _0x4b32ca;}export function readUserConfig(){const _0x3da065=a45_0x1f34,_0x15e7f6=getConfigFile();if(!existsSync(_0x15e7f6))return{};try{const _0x5d0cb2=readFileSync(_0x15e7f6,_0x3da065(0x1b8));return parseEnvFile(_0x5d0cb2);}catch(_0x25f0e8){return console[_0x3da065(0x1c2)](_0x3da065(0x1d8)+_0x15e7f6+':',_0x25f0e8),{};}}export function resolveSite(_0x307440){const _0x29a2aa=a45_0x1f34,_0x2ce2b3=[_0x29a2aa(0x1e8),_0x29a2aa(0x1d0),_0x29a2aa(0x1ae),_0x29a2aa(0x1e0),_0x29a2aa(0x1de),_0x29a2aa(0x1d9),_0x29a2aa(0x1e9),_0x29a2aa(0x1b4),_0x29a2aa(0x1ac),_0x29a2aa(0x1c6)];if(_0x2ce2b3[_0x29a2aa(0x1d1)](_0x307440))return _0x307440;if(_0x307440 in SITE_ALIASES)return SITE_ALIASES[_0x307440];return console['warn'](_0x29a2aa(0x1a8)+_0x307440+'\x27,\x20defaulting\x20to\x20us01'),_0x29a2aa(0x1e8);}function a45_0x4fa2(){const _0x280955=['apiKeys','readFileSync','parse','.json','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','dev-us01','TDX_CACHE_DIR','llm_default_project','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','legacy\x20.env\x20file','ap03','TDX_CONFIG_DIR','ap02','TD_API_KEY\x20env\x20var\x20(deprecated)','550574qXqetm','230sWifUy','315532xKYtGW','isDeprecated','match','622341TVGWxB','us01','dev-eu01','env','toUpperCase','profile','keychain\x20(profile:\x20','210iAdptE','8208072bCRHuI','.env','source','string','TDX_API_KEY_','apiKey','Warning:\x20Unknown\x20site\x20\x27','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','TDX_API_KEY\x20env\x20var','join','stg-jp01','\x20env\x20var','eu01','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','endsWith','Warning:\x20Failed\x20to\x20read\x20','llm_default_project.','map','stg-us01','.env.','profiles','site','utf-8','TDX_API_KEY','stringify','TD_API_KEY','name','78152jhkSSl','filter','2116962AJUYwy','accountId','number','warn','Warning:\x20Failed\x20to\x20load\x20','289527qBTjtC','replace','stg-ap03','tdx','keychain','startsWith','TD_API_KEY_','account_info.','split','trim','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','existsSync','jp01','includes','yellow','3mDMOoz'];a45_0x4fa2=function(){return _0x280955;};return a45_0x4fa2();}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0xe14ec8,_0x4a5f15){const _0x2fec50=a45_0x1f34,_0x41370b=_0x4a5f15||getActiveProfileName();if(_0x41370b){const _0x5381a3=_0x2fec50(0x1f3)+normalizeProfileForEnvVar(_0x41370b);if(process[_0x2fec50(0x1ea)][_0x5381a3])return process[_0x2fec50(0x1ea)][_0x5381a3];}if(process[_0x2fec50(0x1ea)][_0x2fec50(0x1b9)])return process['env'][_0x2fec50(0x1b9)];if(process[_0x2fec50(0x1ea)][_0x2fec50(0x1bb)])return process['env'][_0x2fec50(0x1bb)];const _0x5be3d9=_0xe14ec8['toUpperCase']()[_0x2fec50(0x1c5)](/-/g,'_'),_0x172028=_0x2fec50(0x1ca)+_0x5be3d9;if(_0x41370b){const _0x1c2b79=loadProfileEnv(_0x41370b);if(_0x1c2b79){if(_0x1c2b79[_0x172028])return _0x1c2b79[_0x172028];if(_0x1c2b79[_0x2fec50(0x1bb)])return _0x1c2b79[_0x2fec50(0x1bb)];}}const _0x56eb5c=loadUserConfigOnce();if(_0x56eb5c[_0x172028])return _0x56eb5c[_0x172028];if(_0x56eb5c[_0x2fec50(0x1bb)])return _0x56eb5c['TD_API_KEY'];return undefined;}export function normalizeProfileForEnvVar(_0x10e7ba){const _0x22f2a6=a45_0x1f34;return _0x10e7ba[_0x22f2a6(0x1eb)]()[_0x22f2a6(0x1c5)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x294827,_0x3c6609){const _0x2fc4a5=a45_0x1f34,_0xfbe8f6=_0x3c6609||getActiveProfileName()||undefined;if(_0xfbe8f6){const _0x1e0940=_0x2fc4a5(0x1f3)+normalizeProfileForEnvVar(_0xfbe8f6);if(process[_0x2fc4a5(0x1ea)][_0x1e0940])return{'apiKey':process['env'][_0x1e0940],'source':_0x1e0940+_0x2fc4a5(0x1ad),'isDeprecated':![]};const _0xb20394=getCachedCredential(_0x294827,_0xfbe8f6);if(_0xb20394)return{'apiKey':_0xb20394,'source':_0x2fc4a5(0x1ed)+_0xfbe8f6+')','isDeprecated':![]};const _0x15fb85=await getKeychainAPIKey(_0xfbe8f6);if(_0x15fb85)return setCachedCredential(_0x15fb85,_0x294827,_0xfbe8f6),{'apiKey':_0x15fb85,'source':_0x2fc4a5(0x1ed)+_0xfbe8f6+')','isDeprecated':![]};}if(process[_0x2fc4a5(0x1ea)][_0x2fc4a5(0x1b9)])return{'apiKey':process['env'][_0x2fc4a5(0x1b9)],'source':_0x2fc4a5(0x1aa),'isDeprecated':![]};if(!_0xfbe8f6){const _0x2fdea7=getCachedCredential(_0x294827,undefined);if(_0x2fdea7)return{'apiKey':_0x2fdea7,'source':_0x2fc4a5(0x1c8),'isDeprecated':![]};const _0x4499c7=await getKeychainAPIKey(undefined);if(_0x4499c7)return setCachedCredential(_0x4499c7,_0x294827,undefined),{'apiKey':_0x4499c7,'source':_0x2fc4a5(0x1c8),'isDeprecated':![]};}if(process['env'][_0x2fc4a5(0x1bb)])return{'apiKey':process[_0x2fc4a5(0x1ea)][_0x2fc4a5(0x1bb)],'source':_0x2fc4a5(0x1e1),'isDeprecated':!![]};const _0x2d26c3=getLegacyEnvAPIKey(_0x294827,_0xfbe8f6);if(_0x2d26c3){const _0x387d23=await isKeychainAvailable();if(_0x387d23)try{await saveKeychainAPIKey(_0x2d26c3,_0xfbe8f6),setCachedCredential(_0x2d26c3,_0x294827,_0xfbe8f6);const _0x2da237=getConfigFilePath(_0xfbe8f6);cleanupLegacyEnvFile(_0x2da237)&&console[_0x2fc4a5(0x1c2)](a45_0x4ee97d[_0x2fc4a5(0x1d2)](_0x2fc4a5(0x1a9)));}catch(_0x6daa89){console[_0x2fc4a5(0x1c2)](a45_0x4ee97d['yellow'](_0x2fc4a5(0x1ce)+_0x6daa89));}const _0x34ad63=_0xfbe8f6?'legacy\x20.env\x20file\x20(profile:\x20'+_0xfbe8f6+')':_0x2fc4a5(0x1dd);return{'apiKey':_0x2d26c3,'source':_0x34ad63,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x4021aa,_0x82409a,_0x227a4f=!![]){const _0x446122=a45_0x1f34,_0x19ae52=await resolveAPIKeyAsync(_0x4021aa,_0x82409a);if(!_0x19ae52)return undefined;if(_0x227a4f&&_0x19ae52[_0x446122(0x1e5)]&&_0x19ae52[_0x446122(0x1f1)][_0x446122(0x1d1)]('TD_API_KEY')){const _0x41fe8f=_0x82409a||getActiveProfileName()||undefined,_0x2eff4f=_0x41fe8f?_0x446122(0x1f3)+normalizeProfileForEnvVar(_0x41fe8f):'TDX_API_KEY_<PROFILE>';console[_0x446122(0x1c2)](a45_0x4ee97d[_0x446122(0x1d2)](_0x446122(0x1af)+('\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20'+_0x2eff4f+').')));}return _0x19ae52[_0x446122(0x1f4)];}function getLegacyEnvAPIKey(_0x274489,_0x1b1dd8){const _0x58f1c8=a45_0x1f34,_0xeb406d=_0x274489[_0x58f1c8(0x1eb)]()[_0x58f1c8(0x1c5)](/-/g,'_'),_0x4448ae=_0x58f1c8(0x1ca)+_0xeb406d;if(_0x1b1dd8){const _0x27991d=loadProfileEnv(_0x1b1dd8);if(_0x27991d){if(_0x27991d[_0x4448ae])return _0x27991d[_0x4448ae];if(_0x27991d['TD_API_KEY'])return _0x27991d[_0x58f1c8(0x1bb)];}}const _0x14d913=loadUserConfigOnce();if(_0x14d913[_0x4448ae])return _0x14d913[_0x4448ae];if(_0x14d913[_0x58f1c8(0x1bb)])return _0x14d913['TD_API_KEY'];return undefined;}function cleanupLegacyEnvFile(_0x54e39a){const _0x23b302=a45_0x1f34;if(!existsSync(_0x54e39a))return![];try{const _0x24a336=readFileSync(_0x54e39a,_0x23b302(0x1b8)),_0xfebbb9=_0x24a336[_0x23b302(0x1cc)]('\x0a'),_0x23d575=_0xfebbb9[_0x23b302(0x1be)](_0x3d142f=>{const _0x1cb9d3=_0x23b302,_0xa5dd97=_0x3d142f[_0x1cb9d3(0x1cd)]();if(!_0xa5dd97||_0xa5dd97['startsWith']('#'))return!![];const [_0x190437]=_0xa5dd97[_0x1cb9d3(0x1cc)]('=');return!_0x190437['startsWith'](_0x1cb9d3(0x1bb));}),_0x18d612=_0x23d575['some'](_0x5253d5=>{const _0x505d29=_0x23b302,_0x526770=_0x5253d5[_0x505d29(0x1cd)]();return _0x526770&&!_0x526770[_0x505d29(0x1c9)]('#');});if(!_0x18d612)return unlinkSync(_0x54e39a),!![];return writeFileSync(_0x54e39a,_0x23d575['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x481988){const _0x46cc63=a45_0x1f34,_0x39bdc1=a45_0x11fc62[_0x46cc63(0x1ab)](getConfigDir(),_0x46cc63(0x1b5)+_0x481988);if(a45_0x49d92d[_0x46cc63(0x1cf)](_0x39bdc1)){validateSecureFilePermissions(_0x39bdc1);try{const _0x5e962a=a45_0x49d92d[_0x46cc63(0x1d5)](_0x39bdc1,_0x46cc63(0x1b8));return parseEnvFile(_0x5e962a);}catch(_0x201f38){console[_0x46cc63(0x1c2)](_0x46cc63(0x1c3)+_0x39bdc1+':\x20'+_0x201f38);}}const _0x4b09f0=a45_0x11fc62[_0x46cc63(0x1ab)](getConfigDir(),_0x46cc63(0x1b6),_0x481988,_0x46cc63(0x1f0));if(a45_0x49d92d[_0x46cc63(0x1cf)](_0x4b09f0)){validateSecureFilePermissions(_0x4b09f0);try{const _0x57e847=a45_0x49d92d['readFileSync'](_0x4b09f0,_0x46cc63(0x1b8));return parseEnvFile(_0x57e847);}catch(_0x8ced35){return console[_0x46cc63(0x1c2)](_0x46cc63(0x1c3)+_0x4b09f0+':\x20'+_0x8ced35),null;}}return null;}function getActiveProfileName(){const _0x8d57d1=a45_0x1f34,_0x142a79=a45_0x11fc62[_0x8d57d1(0x1ab)](getConfigDir(),'tdx.json');if(!a45_0x49d92d[_0x8d57d1(0x1cf)](_0x142a79))return null;try{const _0x2af00d=a45_0x49d92d['readFileSync'](_0x142a79,_0x8d57d1(0x1b8)),_0x524289=JSON[_0x8d57d1(0x1d6)](_0x2af00d);return _0x524289[_0x8d57d1(0x1ec)]||null;}catch{return null;}}export function saveAPIKey(_0x5ed1cd,_0x871a99,_0x22a0df){const _0x12a2a1=a45_0x1f34,_0x440bd0=getConfigDir(),_0x156768=getConfigFilePath(_0x22a0df);!existsSync(_0x440bd0)&&mkdirSync(_0x440bd0,{'recursive':!![],'mode':0x1c0});let _0xea6f04={};if(existsSync(_0x156768))try{const _0x215d74=readFileSync(_0x156768,_0x12a2a1(0x1b8));_0xea6f04=parseEnvFile(_0x215d74);}catch(_0x58e2a5){console[_0x12a2a1(0x1c2)](_0x12a2a1(0x1b1)+_0x156768+':',_0x58e2a5);}const _0x457885=_0x5ed1cd[_0x12a2a1(0x1eb)]()[_0x12a2a1(0x1c5)](/-/g,'_');_0xea6f04[_0x12a2a1(0x1ca)+_0x457885]=_0x871a99;const _0x80477e=Object['entries'](_0xea6f04)[_0x12a2a1(0x1b3)](([_0x2a619a,_0x5ec6fe])=>_0x2a619a+'='+_0x5ec6fe);writeFileSync(_0x156768,_0x80477e['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x103c92,_0x50e65c,_0x5ec87d){const _0x3740a0=a45_0x1f34;await saveKeychainAPIKey(_0x103c92,_0x5ec87d),setCachedCredential(_0x103c92,_0x50e65c,_0x5ec87d);const _0x4fdc1e=getConfigFilePath(_0x5ec87d);cleanupLegacyEnvFile(_0x4fdc1e)&&console[_0x3740a0(0x1c2)](a45_0x4ee97d['yellow'](_0x3740a0(0x1dc)));}export function loadConfig(){const _0x4cdbdc=a45_0x1f34,_0x48e3dc={'apiKeys':{},'defaultSite':_0x4cdbdc(0x1e8)},_0x33fb42=[_0x4cdbdc(0x1e8),_0x4cdbdc(0x1d0),_0x4cdbdc(0x1ae),_0x4cdbdc(0x1e0),_0x4cdbdc(0x1de),_0x4cdbdc(0x1d9),_0x4cdbdc(0x1e9),_0x4cdbdc(0x1b4),'stg-jp01',_0x4cdbdc(0x1c6)];for(const _0x171040 of _0x33fb42){const _0x5a7757=getAPIKey(_0x171040);_0x5a7757&&(_0x48e3dc[_0x4cdbdc(0x1d4)][_0x171040]=_0x5a7757);}return _0x48e3dc;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x15f068,_0x46212c){const _0x4b496e=a46_0x2c70,_0x315cb8=_0x15f068();while(!![]){try{const _0x613937=-parseInt(_0x4b496e(0x1b9))/0x1*(parseInt(_0x4b496e(0x1aa))/0x2)+parseInt(_0x4b496e(0x1b2))/0x3+-parseInt(_0x4b496e(0x1b1))/0x4*(parseInt(_0x4b496e(0x1b7))/0x5)+parseInt(_0x4b496e(0x1b8))/0x6*(-parseInt(_0x4b496e(0x1ad))/0x7)+parseInt(_0x4b496e(0x1ac))/0x8*(parseInt(_0x4b496e(0x1bb))/0x9)+-parseInt(_0x4b496e(0x1b3))/0xa+parseInt(_0x4b496e(0x1ae))/0xb*(parseInt(_0x4b496e(0x1b5))/0xc);if(_0x613937===_0x46212c)break;else _0x315cb8['push'](_0x315cb8['shift']());}catch(_0x20a44c){_0x315cb8['push'](_0x315cb8['shift']());}}}(a46_0x4f8b,0x2d85c));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';import{getCacheDir}from'./config.js';function getCacheFilePath(_0x5a8ce1){const _0x3893b8=a46_0x2c70,_0x3c10b0=_0x5a8ce1||_0x3893b8(0x1b0);return join(getCacheDir(),_0x3893b8(0x1af)+_0x3c10b0+_0x3893b8(0x1ab));}function a46_0x4f8b(){const _0x5debce=['55465cblYHp','1386036IcfqDZ','61154spzsUV','utf-8','42021hNnjOq','12uHSDBU','.json','632vHVWky','7Iaxpsh','670901OJcVbG','connections-','default','28RLDvSC','897426lCGXXF','1109070oPPToJ','now','60wzSgUd','parse'];a46_0x4f8b=function(){return _0x5debce;};return a46_0x4f8b();}function a46_0x2c70(_0x3d368c,_0x1a6e05){_0x3d368c=_0x3d368c-0x1aa;const _0x4f8b6b=a46_0x4f8b();let _0x2c705d=_0x4f8b6b[_0x3d368c];return _0x2c705d;}export function loadCachedConnections(_0x127c25){const _0x1c3807=a46_0x2c70,_0x27822f=getCacheFilePath(_0x127c25);if(!existsSync(_0x27822f))return null;try{const _0x24dd35=readFileSync(_0x27822f,_0x1c3807(0x1ba)),_0x1a3e57=JSON[_0x1c3807(0x1b6)](_0x24dd35);return _0x1a3e57['connections'];}catch{return null;}}export function saveCachedConnections(_0x1754d1,_0x4572f7){const _0x26080d=a46_0x2c70,_0x170731=getCacheDir();!existsSync(_0x170731)&&mkdirSync(_0x170731,{'recursive':!![]});const _0x2bd07d=getCacheFilePath(_0x1754d1),_0x24d02d={'connections':_0x4572f7,'cachedAt':Date[_0x26080d(0x1b4)]()};writeFileSync(_0x2bd07d,JSON['stringify'](_0x24d02d,null,0x2),_0x26080d(0x1ba));}export function clearConnectionCache(_0x47c0c3){const _0xbbeecc=getCacheFilePath(_0x47c0c3);if(existsSync(_0xbbeecc))try{unlinkSync(_0xbbeecc);}catch{}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x171c83,_0x2ba1e0){const _0x3558b0=a47_0x2e00,_0x32aa81=_0x171c83();while(!![]){try{const _0x1e2416=parseInt(_0x3558b0(0x11f))/0x1*(-parseInt(_0x3558b0(0x12b))/0x2)+-parseInt(_0x3558b0(0x125))/0x3*(parseInt(_0x3558b0(0x129))/0x4)+-parseInt(_0x3558b0(0x12d))/0x5*(-parseInt(_0x3558b0(0x127))/0x6)+-parseInt(_0x3558b0(0x12f))/0x7+-parseInt(_0x3558b0(0x126))/0x8*(-parseInt(_0x3558b0(0x120))/0x9)+-parseInt(_0x3558b0(0x11e))/0xa*(parseInt(_0x3558b0(0x124))/0xb)+parseInt(_0x3558b0(0x130))/0xc;if(_0x1e2416===_0x2ba1e0)break;else _0x32aa81['push'](_0x32aa81['shift']());}catch(_0x282c94){_0x32aa81['push'](_0x32aa81['shift']());}}}(a47_0x47fa,0xedb18));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a47_0x47fa(){const _0x2dbd60=['74IncFue','__default_profile__','320665TFggxG','get','7129325kJfPKE','34052484lRvIfV','now','33280cfQBmO','43401PHdcEq','411183XeyFUB','apiKey','__default_site__','loadedAt','1430hndslq','597cJYuaA','72mUODkk','150PTgMSL','clear','16516wgwEsV','set'];a47_0x47fa=function(){return _0x2dbd60;};return a47_0x47fa();}function a47_0x2e00(_0x39f77f,_0x33ef2f){_0x39f77f=_0x39f77f-0x11d;const _0x47fa0a=a47_0x47fa();let _0x2e00e8=_0x47fa0a[_0x39f77f];return _0x2e00e8;}function getCacheKey(_0x322b44,_0x31b134){const _0xeec19d=a47_0x2e00,_0x276727=_0x322b44||_0xeec19d(0x122),_0x25e3f3=_0x31b134||_0xeec19d(0x12c);return _0x276727+':'+_0x25e3f3;}export function getCachedCredential(_0x1b2e73,_0x1007bc){const _0x5b65ef=a47_0x2e00,_0x42bff7=getCacheKey(_0x1b2e73,_0x1007bc),_0x56ba21=cache[_0x5b65ef(0x12e)](_0x42bff7);if(!_0x56ba21)return null;if(Date[_0x5b65ef(0x11d)]()-_0x56ba21[_0x5b65ef(0x123)]>CACHE_TTL_MS)return cache['delete'](_0x42bff7),null;return _0x56ba21[_0x5b65ef(0x121)];}export function setCachedCredential(_0x3ed76e,_0x53f8dc,_0x3104c8){const _0x23f2e4=a47_0x2e00,_0x582379=getCacheKey(_0x53f8dc,_0x3104c8);cache[_0x23f2e4(0x12a)](_0x582379,{'apiKey':_0x3ed76e,'loadedAt':Date['now']()});}export function clearCredentialCache(){const _0x4328fd=a47_0x2e00;cache[_0x4328fd(0x128)]();}export function clearCachedCredential(_0x4cf2bf,_0x1212de){const _0x3b9d7d=getCacheKey(_0x4cf2bf,_0x1212de);cache['delete'](_0x3b9d7d);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a48_0x4ddee2=a48_0x5ab2;(function(_0xd0d511,_0x10d77f){const _0x4017fe=a48_0x5ab2,_0x128b92=_0xd0d511();while(!![]){try{const _0x4a0cd8=-parseInt(_0x4017fe(0x1f5))/0x1*(-parseInt(_0x4017fe(0x20d))/0x2)+parseInt(_0x4017fe(0x201))/0x3*(parseInt(_0x4017fe(0x1f1))/0x4)+-parseInt(_0x4017fe(0x204))/0x5+parseInt(_0x4017fe(0x1e2))/0x6+-parseInt(_0x4017fe(0x200))/0x7*(-parseInt(_0x4017fe(0x208))/0x8)+-parseInt(_0x4017fe(0x1f7))/0x9*(parseInt(_0x4017fe(0x1fb))/0xa)+-parseInt(_0x4017fe(0x1e7))/0xb;if(_0x4a0cd8===_0x10d77f)break;else _0x128b92['push'](_0x128b92['shift']());}catch(_0x58abec){_0x128b92['push'](_0x128b92['shift']());}}}(a48_0x56ea,0x22a4a));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';function a48_0x5ab2(_0x16491e,_0x2f7819){_0x16491e=_0x16491e-0x1c9;const _0x56eafe=a48_0x56ea();let _0x5ab23e=_0x56eafe[_0x16491e];return _0x5ab23e;}import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a48_0x2482a2 from'node:fs';import*as a48_0xb8d889 from'node:path';function a48_0x56ea(){const _0x413c0d=['join','replace','2907245CbpMCe','segment_path','tdx.json','global','CLI\x20flag:\x20--','profile','profileCredentials','verbose','database','activeProfile','4pVVbzr','apiKey','resolveAPIKeyAsync',':\x20none\x20(using\x20session:\x20','1802yVVcAB','(active)','252657WfkiTt','loadGlobalConfig','displayWithSources','parent_segment','30FoNvMw','profile:\x20','cliFlags','llm_project','(session:\x20','1242374fxSKdf','608088BlNdxb','config','profiles','1263125dGWzPL','llmProject','Project','default','8uKAlfc','us01','Global','Global\x20Credentials','[context]','114RKJqed','parentSegment','Profile','INFO','not\x20set','logLevel','session','sessions','entries','sessionId','.json','configFiles','layers','utf-8','getParameters','Profile\x20Credentials','\x0a[configuration\x20files]','globalCredentials',':\x20none','injectIntoOptions','Session','getSource','display','project','.env','site','parse','1560870oJONJj','existsSync','log'];a48_0x56ea=function(){return _0x413c0d;};return a48_0x56ea();}export class GlobalContext{[a48_0x4ddee2(0x1e0)];['database'];[a48_0x4ddee2(0x1fa)];['segment_path'];[a48_0x4ddee2(0x1fe)];[a48_0x4ddee2(0x1f2)];[a48_0x4ddee2(0x1ee)];[a48_0x4ddee2(0x1cc)];[a48_0x4ddee2(0x1ec)];[a48_0x4ddee2(0x1d3)];[a48_0x4ddee2(0x1f0)];[a48_0x4ddee2(0x1d0)];['configFiles'];constructor(_0x7d5c94){const _0x4d4570=a48_0x4ddee2;this['sessionId']=_0x7d5c94[_0x4d4570(0x1cd)]||getCurrentSessionPID()['toString']();const _0x26b4f6=loadSessionContext(_0x7d5c94['session']),_0x14cfa6=loadProjectConfig(),_0x3803cf=this['loadGlobalConfig']();this['activeProfile']=_0x7d5c94[_0x4d4570(0x1ec)]||_0x26b4f6?.[_0x4d4570(0x1ec)]||_0x3803cf['profile']||getActiveProfile();const _0x14d7b4=this[_0x4d4570(0x1f0)]?loadProfile(this[_0x4d4570(0x1f0)]):null,_0x496ec1=_0x4413be=>{const _0x2dd627=_0x4d4570;if(!_0x4413be)return{};const _0x50b029=_0x4413be,_0x295ceb={};for(const [_0x42d4ac,_0x3a390a]of Object[_0x2dd627(0x1cf)](_0x50b029)){typeof _0x3a390a==='string'&&(_0x295ceb[_0x42d4ac]=_0x3a390a);}return _0x295ceb;},_0x2274f6={};if(_0x7d5c94[_0x4d4570(0x1e0)]&&_0x7d5c94[_0x4d4570(0x1e0)]!==_0x4d4570(0x209))_0x2274f6['site']=_0x7d5c94[_0x4d4570(0x1e0)];const _0xa1d10a=_0x26b4f6?.[_0x4d4570(0x1ef)],_0x1df961=_0x14cfa6?.[_0x4d4570(0x1ef)],_0xf015=_0x14d7b4?.[_0x4d4570(0x202)]?.[_0x4d4570(0x1ef)],_0x374fa0=_0x3803cf[_0x4d4570(0x1ef)];_0x7d5c94[_0x4d4570(0x1ef)]&&(_0x7d5c94['database']!==_0xa1d10a&&_0x7d5c94['database']!==_0x1df961&&_0x7d5c94[_0x4d4570(0x1ef)]!==_0xf015&&_0x7d5c94[_0x4d4570(0x1ef)]!==_0x374fa0)&&(_0x2274f6[_0x4d4570(0x1ef)]=_0x7d5c94[_0x4d4570(0x1ef)]);if(_0x7d5c94['parentSegment'])_0x2274f6[_0x4d4570(0x1fa)]=_0x7d5c94[_0x4d4570(0x20e)];if(_0x7d5c94[_0x4d4570(0x205)])_0x2274f6['llm_project']=_0x7d5c94[_0x4d4570(0x205)];if(_0x7d5c94[_0x4d4570(0x1ec)])_0x2274f6['profile']=_0x7d5c94[_0x4d4570(0x1ec)];this[_0x4d4570(0x1d3)]={'cliFlags':_0x2274f6,'session':_0x496ec1(_0x26b4f6),'project':_0x496ec1(_0x14cfa6),'profile':_0x496ec1(_0x14d7b4?.['config']),'global':_0x496ec1(_0x3803cf)};const _0x42d807={...this['layers']['global'],...this['layers'][_0x4d4570(0x1ec)],...this[_0x4d4570(0x1d3)][_0x4d4570(0x1de)],...this['layers'][_0x4d4570(0x1cd)],...this['layers']['cliFlags']},_0x48d4d9=_0x42d807[_0x4d4570(0x1e0)]||'us01';this[_0x4d4570(0x1e0)]=resolveSite(_0x48d4d9),this[_0x4d4570(0x1ef)]=_0x42d807[_0x4d4570(0x1ef)],this[_0x4d4570(0x1fa)]=_0x42d807['parent_segment'],this[_0x4d4570(0x1e8)]=_0x42d807['segment_path'],this[_0x4d4570(0x1fe)]=_0x42d807[_0x4d4570(0x1fe)],this['verbose']=_0x7d5c94[_0x4d4570(0x1ee)]||![],this[_0x4d4570(0x1cc)]=_0x7d5c94[_0x4d4570(0x1cc)]??LogLevel[_0x4d4570(0x1ca)],this[_0x4d4570(0x1ec)]=this[_0x4d4570(0x1f0)]||undefined,this[_0x4d4570(0x1f2)]=getAPIKey(this[_0x4d4570(0x1e0)],this[_0x4d4570(0x1f0)]||undefined);const _0x4071bd=getConfigDir(),_0x24449e=a48_0xb8d889['join'](_0x4071bd,_0x4d4570(0x1ce),this['sessionId']+_0x4d4570(0x1d1)),_0x46e70c=findProjectConfigPath(),_0x7028fe=a48_0xb8d889[_0x4d4570(0x1e5)](_0x4071bd,'tdx.json'),_0x3d789f=a48_0xb8d889[_0x4d4570(0x1e5)](_0x4071bd,_0x4d4570(0x1df));let _0x589b42=null,_0x2f85d6=null;this[_0x4d4570(0x1f0)]&&(_0x589b42=a48_0xb8d889[_0x4d4570(0x1e5)](_0x4071bd,_0x4d4570(0x203),this[_0x4d4570(0x1f0)],'tdx.json'),_0x2f85d6=a48_0xb8d889[_0x4d4570(0x1e5)](_0x4071bd,_0x4d4570(0x203),this[_0x4d4570(0x1f0)],_0x4d4570(0x1df))),this[_0x4d4570(0x1d2)]={'session':a48_0x2482a2[_0x4d4570(0x1e3)](_0x24449e)?_0x24449e:null,'project':_0x46e70c,'profile':_0x589b42&&a48_0x2482a2[_0x4d4570(0x1e3)](_0x589b42)?_0x589b42:null,'profileCredentials':_0x2f85d6&&a48_0x2482a2[_0x4d4570(0x1e3)](_0x2f85d6)?_0x2f85d6:null,'global':a48_0x2482a2[_0x4d4570(0x1e3)](_0x7028fe)?_0x7028fe:null,'globalCredentials':a48_0x2482a2[_0x4d4570(0x1e3)](_0x3d789f)?_0x3d789f:null};}[a48_0x4ddee2(0x1dc)](_0x14c147,_0x30dd0f){const _0x5d6f2d=a48_0x4ddee2;if(!_0x30dd0f)return _0x5d6f2d(0x1cb);const _0x407d8e=_0x30dd0f;if(this['layers'][_0x5d6f2d(0x1fd)][_0x14c147]===_0x407d8e){if(_0x14c147==='site'&&_0x407d8e===_0x5d6f2d(0x209)&&!this[_0x5d6f2d(0x1d3)]['session'][_0x5d6f2d(0x1e0)]&&!this[_0x5d6f2d(0x1d3)][_0x5d6f2d(0x1de)][_0x5d6f2d(0x1e0)]&&!this[_0x5d6f2d(0x1d3)][_0x5d6f2d(0x1ec)][_0x5d6f2d(0x1e0)]&&!this[_0x5d6f2d(0x1d3)][_0x5d6f2d(0x1ea)][_0x5d6f2d(0x1e0)])return _0x5d6f2d(0x207);return _0x5d6f2d(0x1eb)+_0x14c147[_0x5d6f2d(0x1e6)](/_/g,'-');}if(this[_0x5d6f2d(0x1d3)][_0x5d6f2d(0x1cd)][_0x14c147]===_0x407d8e)return _0x5d6f2d(0x1cd);if(this['layers']['project'][_0x14c147]===_0x407d8e)return _0x5d6f2d(0x1de);if(this[_0x5d6f2d(0x1d3)][_0x5d6f2d(0x1ec)][_0x14c147]===_0x407d8e)return _0x5d6f2d(0x1fc)+this[_0x5d6f2d(0x1f0)];if(this[_0x5d6f2d(0x1d3)][_0x5d6f2d(0x1ea)][_0x14c147]===_0x407d8e)return'global';return _0x5d6f2d(0x207);}[a48_0x4ddee2(0x1f8)](){const _0x3a4a21=a48_0x4ddee2,_0x1c1ec1=a48_0xb8d889['join'](getConfigDir(),_0x3a4a21(0x1e9));if(!a48_0x2482a2['existsSync'](_0x1c1ec1))return{};try{const _0x1d429d=a48_0x2482a2['readFileSync'](_0x1c1ec1,_0x3a4a21(0x1d4));return JSON[_0x3a4a21(0x1e1)](_0x1d429d);}catch{return{};}}[a48_0x4ddee2(0x1da)](_0x2332ff){const _0x88ad41=a48_0x4ddee2;_0x2332ff[_0x88ad41(0x1e0)]=this[_0x88ad41(0x1e0)],!_0x2332ff['database']&&this['database']&&(_0x2332ff[_0x88ad41(0x1ef)]=this[_0x88ad41(0x1ef)]),!_0x2332ff[_0x88ad41(0x20e)]&&this[_0x88ad41(0x1fa)]&&(_0x2332ff[_0x88ad41(0x20e)]=this['parent_segment']),!_0x2332ff['segmentPath']&&this['segment_path']&&(_0x2332ff['segmentPath']=this['segment_path']),!_0x2332ff[_0x88ad41(0x205)]&&this['llm_project']&&(_0x2332ff[_0x88ad41(0x205)]=this['llm_project']);}[a48_0x4ddee2(0x1d5)](){const _0x28f384=a48_0x4ddee2;return[{'key':_0x28f384(0x1e0),'value':this['site']},{'key':_0x28f384(0x1ef),'value':this[_0x28f384(0x1ef)]},{'key':_0x28f384(0x1fa),'value':this[_0x28f384(0x1fa)]},{'key':_0x28f384(0x1e8),'value':this[_0x28f384(0x1e8)]},{'key':_0x28f384(0x1fe),'value':this[_0x28f384(0x1fe)]},{'key':_0x28f384(0x1ec),'value':this[_0x28f384(0x1f0)]||undefined}];}[a48_0x4ddee2(0x1dd)](){const _0x1bf7e4=a48_0x4ddee2;console[_0x1bf7e4(0x1e4)](_0x1bf7e4(0x20c));for(const {key:_0x281ece,value:_0x542093}of this[_0x1bf7e4(0x1d5)]()){_0x542093&&console[_0x1bf7e4(0x1e4)](_0x281ece+':\x20'+_0x542093);}}[a48_0x4ddee2(0x1f9)](){const _0x572d53=a48_0x4ddee2;console[_0x572d53(0x1e4)](_0x572d53(0x20c));for(const {key:_0x26539b,value:_0x3dad46}of this[_0x572d53(0x1d5)]()){if(_0x3dad46){const _0x9e66db=_0x26539b===_0x572d53(0x1ec)?_0x572d53(0x1f6):'('+this[_0x572d53(0x1dc)](_0x26539b,_0x3dad46)+')';console['log'](_0x26539b+':\x20'+_0x3dad46+'\x20'+_0x9e66db);}}console['log'](_0x572d53(0x1d7));const _0x1bcd78=[{'label':_0x572d53(0x1db),'path':this[_0x572d53(0x1d2)][_0x572d53(0x1cd)],'extra':_0x572d53(0x1ff)+this['sessionId']+')'},{'label':_0x572d53(0x206),'path':this[_0x572d53(0x1d2)]['project']},{'label':_0x572d53(0x1c9),'path':this[_0x572d53(0x1d2)][_0x572d53(0x1ec)]},{'label':_0x572d53(0x1d6),'path':this[_0x572d53(0x1d2)][_0x572d53(0x1ed)]},{'label':_0x572d53(0x20a),'path':this[_0x572d53(0x1d2)][_0x572d53(0x1ea)]},{'label':_0x572d53(0x20b),'path':this[_0x572d53(0x1d2)][_0x572d53(0x1d8)]}];for(const {label:_0x4a195e,path:_0x347c9d,extra:_0x3f08ee}of _0x1bcd78){if(_0x347c9d)console[_0x572d53(0x1e4)](_0x4a195e+':\x20'+_0x347c9d+'\x20✓'+(_0x3f08ee?'\x20'+_0x3f08ee:''));else{if(_0x4a195e===_0x572d53(0x1db))console[_0x572d53(0x1e4)](_0x4a195e+_0x572d53(0x1f4)+this['sessionId']+')');else(_0x4a195e===_0x572d53(0x206)||_0x4a195e===_0x572d53(0x20a))&&console['log'](_0x4a195e+_0x572d53(0x1d9));}}}async['resolveAPIKeyAsync'](){const _0x38b5e5=a48_0x4ddee2;return this[_0x38b5e5(0x1f2)]=await getAPIKeyAsync(this[_0x38b5e5(0x1e0)],this[_0x38b5e5(0x1f0)]||undefined),this[_0x38b5e5(0x1f2)];}static async['createAsync'](_0x1b4208){const _0xc0d530=a48_0x4ddee2,_0xc10278=new GlobalContext(_0x1b4208);return await _0xc10278[_0xc0d530(0x1f3)](),_0xc10278;}}
|
|
1
|
+
const a48_0x484209=a48_0x1f73;(function(_0xd41a63,_0x5071fb){const _0x4e6590=a48_0x1f73,_0x119131=_0xd41a63();while(!![]){try{const _0x2ee89b=-parseInt(_0x4e6590(0x9c))/0x1*(-parseInt(_0x4e6590(0xb1))/0x2)+parseInt(_0x4e6590(0xb3))/0x3*(parseInt(_0x4e6590(0xbd))/0x4)+-parseInt(_0x4e6590(0xd7))/0x5+parseInt(_0x4e6590(0xc7))/0x6*(parseInt(_0x4e6590(0xa9))/0x7)+-parseInt(_0x4e6590(0xd4))/0x8*(-parseInt(_0x4e6590(0xc5))/0x9)+parseInt(_0x4e6590(0xc2))/0xa*(parseInt(_0x4e6590(0xc0))/0xb)+parseInt(_0x4e6590(0xc4))/0xc*(-parseInt(_0x4e6590(0x9b))/0xd);if(_0x2ee89b===_0x5071fb)break;else _0x119131['push'](_0x119131['shift']());}catch(_0x29042e){_0x119131['push'](_0x119131['shift']());}}}(a48_0x24f4,0xf1c89));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';function a48_0x1f73(_0x5b3a1b,_0x4437b1){_0x5b3a1b=_0x5b3a1b-0x97;const _0x24f4f3=a48_0x24f4();let _0x1f7335=_0x24f4f3[_0x5b3a1b];return _0x1f7335;}import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a48_0x486440 from'node:fs';import*as a48_0x18a53d from'node:path';export class GlobalContext{[a48_0x484209(0xc1)];['database'];['parent_segment'];[a48_0x484209(0xa7)];[a48_0x484209(0xa8)];[a48_0x484209(0xb0)];[a48_0x484209(0xcb)];['logLevel'];[a48_0x484209(0x97)];[a48_0x484209(0xc8)];[a48_0x484209(0xa3)];['sessionId'];[a48_0x484209(0xc3)];constructor(_0x1d2583){const _0x206cae=a48_0x484209;this['sessionId']=_0x1d2583[_0x206cae(0xaf)]||getCurrentSessionPID()[_0x206cae(0xb9)]();const _0x48ef76=loadSessionContext(_0x1d2583[_0x206cae(0xaf)]),_0x2f0967=loadProjectConfig(),_0x305b5b=this['loadGlobalConfig']();this[_0x206cae(0xa3)]=_0x1d2583[_0x206cae(0x97)]||_0x48ef76?.[_0x206cae(0x97)]||_0x305b5b[_0x206cae(0x97)]||getActiveProfile();const _0xfa7a62=this[_0x206cae(0xa3)]?loadProfile(this[_0x206cae(0xa3)]):null,_0x2e7d02=_0x5bd17a=>{if(!_0x5bd17a)return{};const _0x3a9a7a=_0x5bd17a,_0xeba581={};for(const [_0x246985,_0x198a87]of Object['entries'](_0x3a9a7a)){typeof _0x198a87==='string'&&(_0xeba581[_0x246985]=_0x198a87);}return _0xeba581;},_0x289566={};if(_0x1d2583[_0x206cae(0xc1)]&&_0x1d2583[_0x206cae(0xc1)]!=='us01')_0x289566[_0x206cae(0xc1)]=_0x1d2583[_0x206cae(0xc1)];const _0x2ca162=_0x48ef76?.[_0x206cae(0x9a)],_0x3f3f26=_0x2f0967?.[_0x206cae(0x9a)],_0x299d88=_0xfa7a62?.[_0x206cae(0xd8)]?.[_0x206cae(0x9a)],_0x1d43fa=_0x305b5b[_0x206cae(0x9a)];_0x1d2583[_0x206cae(0x9a)]&&(_0x1d2583[_0x206cae(0x9a)]!==_0x2ca162&&_0x1d2583[_0x206cae(0x9a)]!==_0x3f3f26&&_0x1d2583[_0x206cae(0x9a)]!==_0x299d88&&_0x1d2583[_0x206cae(0x9a)]!==_0x1d43fa)&&(_0x289566[_0x206cae(0x9a)]=_0x1d2583[_0x206cae(0x9a)]);if(_0x1d2583[_0x206cae(0xbe)])_0x289566[_0x206cae(0xb2)]=_0x1d2583['parentSegment'];if(_0x1d2583[_0x206cae(0x9d)])_0x289566[_0x206cae(0xa8)]=_0x1d2583[_0x206cae(0x9d)];if(_0x1d2583[_0x206cae(0x97)])_0x289566[_0x206cae(0x97)]=_0x1d2583['profile'];this['layers']={'cliFlags':_0x289566,'session':_0x2e7d02(_0x48ef76),'project':_0x2e7d02(_0x2f0967),'profile':_0x2e7d02(_0xfa7a62?.['config']),'global':_0x2e7d02(_0x305b5b)};const _0x1d16c0={...this[_0x206cae(0xc8)][_0x206cae(0xd1)],...this[_0x206cae(0xc8)][_0x206cae(0x97)],...this[_0x206cae(0xc8)]['project'],...this[_0x206cae(0xc8)][_0x206cae(0xaf)],...this[_0x206cae(0xc8)][_0x206cae(0xcc)]},_0x154196=_0x1d16c0[_0x206cae(0xc1)]||'us01';this[_0x206cae(0xc1)]=resolveSite(_0x154196),this['database']=_0x1d16c0[_0x206cae(0x9a)],this[_0x206cae(0xb2)]=_0x1d16c0[_0x206cae(0xb2)],this[_0x206cae(0xa7)]=_0x1d16c0[_0x206cae(0xa7)],this[_0x206cae(0xa8)]=_0x1d16c0[_0x206cae(0xa8)],this[_0x206cae(0xcb)]=_0x1d2583[_0x206cae(0xcb)]||![],this[_0x206cae(0x99)]=_0x1d2583['logLevel']??LogLevel[_0x206cae(0xc6)],this['profile']=this[_0x206cae(0xa3)]||undefined,this['apiKey']=getAPIKey(this[_0x206cae(0xc1)],this[_0x206cae(0xa3)]||undefined);const _0x4f93e0=getConfigDir(),_0x414112=a48_0x18a53d['join'](_0x4f93e0,_0x206cae(0xa4),this[_0x206cae(0xb4)]+'.json'),_0x5c0b5b=findProjectConfigPath(),_0xb0ec43=a48_0x18a53d[_0x206cae(0xd5)](_0x4f93e0,_0x206cae(0xcd)),_0xa32285=a48_0x18a53d[_0x206cae(0xd5)](_0x4f93e0,_0x206cae(0xd3));let _0x4e5c5c=null,_0xfb6771=null;this[_0x206cae(0xa3)]&&(_0x4e5c5c=a48_0x18a53d['join'](_0x4f93e0,_0x206cae(0xb8),this['activeProfile'],_0x206cae(0xcd)),_0xfb6771=a48_0x18a53d[_0x206cae(0xd5)](_0x4f93e0,_0x206cae(0xb8),this['activeProfile'],'.env')),this[_0x206cae(0xc3)]={'session':a48_0x486440['existsSync'](_0x414112)?_0x414112:null,'project':_0x5c0b5b,'profile':_0x4e5c5c&&a48_0x486440[_0x206cae(0xd6)](_0x4e5c5c)?_0x4e5c5c:null,'profileCredentials':_0xfb6771&&a48_0x486440['existsSync'](_0xfb6771)?_0xfb6771:null,'global':a48_0x486440['existsSync'](_0xb0ec43)?_0xb0ec43:null,'globalCredentials':a48_0x486440[_0x206cae(0xd6)](_0xa32285)?_0xa32285:null};}['getSource'](_0xe7910,_0x435a0e){const _0x41103d=a48_0x484209;if(!_0x435a0e)return _0x41103d(0xca);const _0x5f08f5=_0x435a0e;if(this[_0x41103d(0xc8)][_0x41103d(0xcc)][_0xe7910]===_0x5f08f5){if(_0xe7910===_0x41103d(0xc1)&&_0x5f08f5===_0x41103d(0xa2)&&!this[_0x41103d(0xc8)][_0x41103d(0xaf)][_0x41103d(0xc1)]&&!this[_0x41103d(0xc8)][_0x41103d(0xab)][_0x41103d(0xc1)]&&!this[_0x41103d(0xc8)][_0x41103d(0x97)][_0x41103d(0xc1)]&&!this['layers']['global'][_0x41103d(0xc1)])return _0x41103d(0xba);return'CLI\x20flag:\x20--'+_0xe7910[_0x41103d(0xbb)](/_/g,'-');}if(this[_0x41103d(0xc8)]['session'][_0xe7910]===_0x5f08f5)return _0x41103d(0xaf);if(this[_0x41103d(0xc8)]['project'][_0xe7910]===_0x5f08f5)return _0x41103d(0xab);if(this[_0x41103d(0xc8)][_0x41103d(0x97)][_0xe7910]===_0x5f08f5)return _0x41103d(0x98)+this[_0x41103d(0xa3)];if(this[_0x41103d(0xc8)][_0x41103d(0xd1)][_0xe7910]===_0x5f08f5)return _0x41103d(0xd1);return _0x41103d(0xba);}['loadGlobalConfig'](){const _0x3a1735=a48_0x484209,_0x589d4e=a48_0x18a53d[_0x3a1735(0xd5)](getConfigDir(),_0x3a1735(0xcd));if(!a48_0x486440[_0x3a1735(0xd6)](_0x589d4e))return{};try{const _0x3d6587=a48_0x486440[_0x3a1735(0xb6)](_0x589d4e,_0x3a1735(0xac));return JSON[_0x3a1735(0xa0)](_0x3d6587);}catch{return{};}}[a48_0x484209(0xa5)](_0x2eb532){const _0x23b8a1=a48_0x484209;_0x2eb532[_0x23b8a1(0xc1)]=this[_0x23b8a1(0xc1)],!_0x2eb532[_0x23b8a1(0x9a)]&&this['database']&&(_0x2eb532[_0x23b8a1(0x9a)]=this[_0x23b8a1(0x9a)]),!_0x2eb532['parentSegment']&&this['parent_segment']&&(_0x2eb532['parentSegment']=this[_0x23b8a1(0xb2)]),!_0x2eb532[_0x23b8a1(0xad)]&&this[_0x23b8a1(0xa7)]&&(_0x2eb532[_0x23b8a1(0xad)]=this[_0x23b8a1(0xa7)]),!_0x2eb532[_0x23b8a1(0x9d)]&&this['llm_project']&&(_0x2eb532[_0x23b8a1(0x9d)]=this[_0x23b8a1(0xa8)]);}['getParameters'](){const _0x30bdb8=a48_0x484209;return[{'key':_0x30bdb8(0xc1),'value':this['site']},{'key':'database','value':this[_0x30bdb8(0x9a)]},{'key':_0x30bdb8(0xb2),'value':this[_0x30bdb8(0xb2)]},{'key':'segment_path','value':this[_0x30bdb8(0xa7)]},{'key':_0x30bdb8(0xa8),'value':this['llm_project']},{'key':'profile','value':this['activeProfile']||undefined}];}[a48_0x484209(0x9e)](){console['log']('[context]');for(const {key:_0x347995,value:_0x1d5a0d}of this['getParameters']()){_0x1d5a0d&&console['log'](_0x347995+':\x20'+_0x1d5a0d);}}[a48_0x484209(0xd2)](){const _0x157180=a48_0x484209;console[_0x157180(0xc9)]('[context]');for(const {key:_0x351633,value:_0xb5147f}of this[_0x157180(0xaa)]()){if(_0xb5147f){const _0x406b01=_0x351633===_0x157180(0x97)?_0x157180(0xbc):'('+this['getSource'](_0x351633,_0xb5147f)+')';console[_0x157180(0xc9)](_0x351633+':\x20'+_0xb5147f+'\x20'+_0x406b01);}}console[_0x157180(0xc9)](_0x157180(0xda));const _0x6d4203=[{'label':_0x157180(0xb7),'path':this[_0x157180(0xc3)][_0x157180(0xaf)],'extra':_0x157180(0xae)+this['sessionId']+')'},{'label':_0x157180(0xbf),'path':this[_0x157180(0xc3)][_0x157180(0xab)]},{'label':_0x157180(0xa6),'path':this[_0x157180(0xc3)][_0x157180(0x97)]},{'label':'Profile\x20Credentials','path':this[_0x157180(0xc3)][_0x157180(0xa1)]},{'label':_0x157180(0xcf),'path':this[_0x157180(0xc3)][_0x157180(0xd1)]},{'label':_0x157180(0x9f),'path':this['configFiles'][_0x157180(0xb5)]}];for(const {label:_0x25688d,path:_0x2276e8,extra:_0x18f8b6}of _0x6d4203){if(_0x2276e8)console[_0x157180(0xc9)](_0x25688d+':\x20'+_0x2276e8+'\x20✓'+(_0x18f8b6?'\x20'+_0x18f8b6:''));else{if(_0x25688d===_0x157180(0xb7))console[_0x157180(0xc9)](_0x25688d+_0x157180(0xce)+this['sessionId']+')');else(_0x25688d===_0x157180(0xbf)||_0x25688d===_0x157180(0xcf))&&console[_0x157180(0xc9)](_0x25688d+':\x20none');}}}async[a48_0x484209(0xd0)](){const _0x43e535=a48_0x484209;return this[_0x43e535(0xb0)]=await getAPIKeyAsync(this[_0x43e535(0xc1)],this[_0x43e535(0xa3)]||undefined),this['apiKey'];}static async[a48_0x484209(0xd9)](_0x8de290){const _0x312d09=a48_0x484209,_0x469076=new GlobalContext(_0x8de290);return await _0x469076[_0x312d09(0xd0)](),_0x469076;}}function a48_0x24f4(){const _0x58237e=['segmentPath','(session:\x20','session','apiKey','10214aOhELI','parent_segment','15ogiwYK','sessionId','globalCredentials','readFileSync','Session','profiles','toString','default','replace','(active)','934652nOHnQT','parentSegment','Project','1386imkPCX','site','118280XtNldK','configFiles','8163516wdDIgb','158742ANHydX','INFO','2169222xDxEWv','layers','log','not\x20set','verbose','cliFlags','tdx.json',':\x20none\x20(using\x20session:\x20','Global','resolveAPIKeyAsync','global','displayWithSources','.env','368nwsEqJ','join','existsSync','5618855DMKvGN','config','createAsync','\x0a[configuration\x20files]','profile','profile:\x20','logLevel','database','91vKdKmg','313EvSNxC','llmProject','display','Global\x20Credentials','parse','profileCredentials','us01','activeProfile','sessions','injectIntoOptions','Profile','segment_path','llm_project','35xSFoDH','getParameters','project','utf-8'];a48_0x24f4=function(){return _0x58237e;};return a48_0x24f4();}
|
package/dist/core/keychain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x52a7ba,_0x44512e){const _0x370b99=a49_0x1ccf,_0x5d387a=_0x52a7ba();while(!![]){try{const _0x466101=-parseInt(_0x370b99(0xc3))/0x1+-parseInt(_0x370b99(0xc5))/0x2*(-parseInt(_0x370b99(0xb9))/0x3)+-parseInt(_0x370b99(0xbb))/0x4+-parseInt(_0x370b99(0xbf))/0x5+-parseInt(_0x370b99(0xca))/0x6*(-parseInt(_0x370b99(0xc0))/0x7)+parseInt(_0x370b99(0xad))/0x8*(parseInt(_0x370b99(0xaf))/0x9)+parseInt(_0x370b99(0xba))/0xa*(-parseInt(_0x370b99(0xbd))/0xb);if(_0x466101===_0x44512e)break;else _0x5d387a['push'](_0x5d387a['shift']());}catch(_0xd6ed87){_0x5d387a['push'](_0x5d387a['shift']());}}}(a49_0x149e,0x1ade6));const SERVICE_NAME='tdx';let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x573808=a49_0x1ccf;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x3752fb=await import('@zowe/secrets-for-zowe-sdk');return keyringModule=_0x3752fb[_0x573808(0xb7)],keyringModule;}catch(_0xe63402){return keyringLoadError=_0xe63402 instanceof Error?_0xe63402:new Error(String(_0xe63402)),null;}}function getAccountName(_0x4fdb51){const _0x3bac0a=a49_0x1ccf,_0xe54fc7=_0x4fdb51||'';return _0x3bac0a(0xaa)+_0xe54fc7+_0x3bac0a(0xac);}function a49_0x149e(){const _0x177b91=['includes','-25293','Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.','keyring','message','3jILvIC','145930vxgVGK','276580SxMtuW','System\x20keychain\x20is\x20not\x20available','99cNHXRz','unavailable','809920JiQDgR','266qBZzAU','__keychain_test__','toLowerCase','14232gPkNxz','Warning:\x20','391726opEixH','-25300','restricted','not\x20supported','success','20064pFlsBE','error','setPassword','profile:','value',':api_key','12248bAPLkX','cannot\x20find','963kZBRDI','getPassword','access_denied','not_found','access'];a49_0x149e=function(){return _0x177b91;};return a49_0x149e();}export async function getKeychainAPIKey(_0x137d91){const _0x487e87=a49_0x1ccf,_0x3f505f=await getKeychainAPIKeyWithStatus(_0x137d91);if(_0x3f505f[_0x487e87(0xc9)])return _0x3f505f[_0x487e87(0xab)];return _0x3f505f['reason']===_0x487e87(0xb1)&&console[_0x487e87(0xa8)](_0x487e87(0xc4)+_0x3f505f['message']),null;}export async function getKeychainAPIKeyWithStatus(_0x438e94){const _0x2a5d11=a49_0x1ccf;try{const _0x3f6744=await getKeyring();if(!_0x3f6744)return{'success':![],'reason':'unavailable'};const _0x41adbc=getAccountName(_0x438e94),_0x518678=await _0x3f6744['getPassword'](SERVICE_NAME,_0x41adbc);if(_0x518678)return{'success':!![],'value':_0x518678};return{'success':![],'reason':'not_found'};}catch(_0x152651){const _0x29f2fb=_0x152651 instanceof Error?_0x152651[_0x2a5d11(0xb8)]:String(_0x152651);if(_0x29f2fb[_0x2a5d11(0xb4)](_0x2a5d11(0xc6))||_0x29f2fb['toLowerCase']()[_0x2a5d11(0xb4)]('could\x20not\x20be\x20found')||_0x29f2fb['toLowerCase']()[_0x2a5d11(0xb4)]('not\x20found'))return{'success':![],'reason':_0x2a5d11(0xb2)};if(_0x29f2fb[_0x2a5d11(0xb4)](_0x2a5d11(0xb5))||_0x29f2fb[_0x2a5d11(0xc2)]()[_0x2a5d11(0xb4)](_0x2a5d11(0xc7))||_0x29f2fb['toLowerCase']()[_0x2a5d11(0xb4)](_0x2a5d11(0xb3)))return{'success':![],'reason':_0x2a5d11(0xb1),'message':_0x2a5d11(0xb6)};return{'success':![],'reason':_0x2a5d11(0xbe),'message':_0x29f2fb};}}function a49_0x1ccf(_0x2602d5,_0x24cef1){_0x2602d5=_0x2602d5-0xa8;const _0x149e3f=a49_0x149e();let _0x1ccf43=_0x149e3f[_0x2602d5];return _0x1ccf43;}export async function saveKeychainAPIKey(_0x505ad0,_0x36a77a){const _0x14466c=a49_0x1ccf,_0x314a18=await getKeyring();if(!_0x314a18)throw new Error(_0x14466c(0xbc));const _0x4c3cb4=getAccountName(_0x36a77a);await _0x314a18[_0x14466c(0xa9)](SERVICE_NAME,_0x4c3cb4,_0x505ad0);}export async function deleteKeychainAPIKey(_0x16d837){try{const _0x15be4d=await getKeyring();if(!_0x15be4d)return![];const _0x1e1a7b=getAccountName(_0x16d837);return await _0x15be4d['deletePassword'](SERVICE_NAME,_0x1e1a7b);}catch{return![];}}export async function isKeychainAvailable(){const _0x22ebd6=a49_0x1ccf;try{const _0x4c1605=await getKeyring();if(!_0x4c1605)return![];return await _0x4c1605[_0x22ebd6(0xb0)](SERVICE_NAME,_0x22ebd6(0xc1)),!![];}catch(_0x35c3b9){const _0x4a9d73=_0x35c3b9 instanceof Error?_0x35c3b9['message']['toLowerCase']():'';if(_0x4a9d73[_0x22ebd6(0xb4)]('not\x20available')||_0x4a9d73[_0x22ebd6(0xb4)](_0x22ebd6(0xc8))||_0x4a9d73[_0x22ebd6(0xb4)](_0x22ebd6(0xae)))return![];return!![];}}
|
package/dist/core/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x2c1d56,_0x5f218c){const _0x22fe05=a50_0x297c,_0x5e8120=_0x2c1d56();while(!![]){try{const _0x12b943=-parseInt(_0x22fe05(0xd8))/0x1+-parseInt(_0x22fe05(0xd0))/0x2+parseInt(_0x22fe05(0xdc))/0x3+parseInt(_0x22fe05(0xaa))/0x4*(parseInt(_0x22fe05(0xbb))/0x5)+parseInt(_0x22fe05(0xd5))/0x6*(-parseInt(_0x22fe05(0xcb))/0x7)+-parseInt(_0x22fe05(0xc1))/0x8+parseInt(_0x22fe05(0xb2))/0x9;if(_0x12b943===_0x5f218c)break;else _0x5e8120['push'](_0x5e8120['shift']());}catch(_0x5021fe){_0x5e8120['push'](_0x5e8120['shift']());}}}(a50_0x30f1,0xf0b6a));import*as a50_0xa7ad29 from'node:fs';import*as a50_0x44d796 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export function getProfileParams(_0x179b19){const _0x188278=a50_0x297c,_0x2d41ad={};if(!_0x179b19)return _0x2d41ad;for(const [_0x44dd6a,_0x2a621a]of Object[_0x188278(0xdb)](_0x179b19)){_0x44dd6a!==_0x188278(0xac)&&_0x2a621a!==undefined&&(_0x2d41ad[_0x44dd6a]=_0x2a621a);}return _0x2d41ad;}export function getProfilesDir(){const _0x259344=a50_0x297c;return a50_0x44d796[_0x259344(0xb7)](getConfigDir(),_0x259344(0xda));}function getProfileDir(_0x547b07){const _0x37b8ec=a50_0x297c;return a50_0x44d796[_0x37b8ec(0xb7)](getProfilesDir(),_0x547b07);}function getProfileConfigPath(_0x1da61f){const _0x5aa99f=a50_0x297c;return a50_0x44d796[_0x5aa99f(0xb7)](getProfileDir(_0x1da61f),'tdx.json');}function getProfileEnvPath(_0x236133){const _0x197d6e=a50_0x297c;return a50_0x44d796[_0x197d6e(0xb7)](getProfileDir(_0x236133),'.env');}function getGlobalConfigPath(){const _0x6e459b=a50_0x297c;return a50_0x44d796[_0x6e459b(0xb7)](getConfigDir(),_0x6e459b(0xce));}function validateProfileName(_0x57a0a8){const _0x30d76f=a50_0x297c;if(!/^[a-zA-Z0-9_-]+$/[_0x30d76f(0xae)](_0x57a0a8))throw new Error('Invalid\x20profile\x20name:\x20'+_0x57a0a8+_0x30d76f(0xe8));}function validateProfileConfig(_0xd41815,_0x404c3f){const _0x187118=a50_0x297c;if(typeof _0xd41815!==_0x187118(0xde)||_0xd41815===null)throw new Error('Profile\x20\x27'+_0x404c3f+_0x187118(0xc5));const _0x3a18de=['description',_0x187118(0xe1),'database',_0x187118(0xdf),_0x187118(0xd7),'llm_agent'],_0x36da1d=_0xd41815;for(const _0x2bef52 of Object[_0x187118(0xbf)](_0x36da1d)){!_0x3a18de[_0x187118(0xaf)](_0x2bef52)&&console[_0x187118(0xec)]('Warning:\x20Profile\x20\x27'+_0x404c3f+_0x187118(0xcf)+_0x2bef52+'\x27\x20will\x20be\x20ignored');}if(_0x36da1d['description']!==undefined&&typeof _0x36da1d[_0x187118(0xac)]!==_0x187118(0xcd))throw new Error(_0x187118(0xab)+_0x404c3f+_0x187118(0xc6));if(_0x36da1d[_0x187118(0xe1)]!==undefined&&typeof _0x36da1d[_0x187118(0xe1)]!==_0x187118(0xcd))throw new Error('Profile\x20\x27'+_0x404c3f+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x36da1d['database']!==undefined&&typeof _0x36da1d[_0x187118(0xd1)]!==_0x187118(0xcd))throw new Error(_0x187118(0xab)+_0x404c3f+_0x187118(0xc9));if(_0x36da1d[_0x187118(0xdf)]!==undefined&&typeof _0x36da1d['parent_segment']!=='string')throw new Error(_0x187118(0xab)+_0x404c3f+'\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string');if(_0x36da1d[_0x187118(0xd7)]!==undefined&&typeof _0x36da1d[_0x187118(0xd7)]!=='string')throw new Error(_0x187118(0xab)+_0x404c3f+_0x187118(0xa6));if(_0x36da1d[_0x187118(0xca)]!==undefined&&typeof _0x36da1d[_0x187118(0xca)]!=='string')throw new Error('Profile\x20\x27'+_0x404c3f+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x58e62f,_0x565571){const _0x5c28e5=a50_0x297c;if(!a50_0xa7ad29[_0x5c28e5(0xe0)](_0x58e62f))return[];try{const _0x3748ba=a50_0xa7ad29[_0x5c28e5(0xb6)](_0x58e62f,_0x5c28e5(0xa8)),_0x111bdf=JSON[_0x5c28e5(0xe3)](_0x3748ba);if(!_0x111bdf[_0x5c28e5(0xda)]||typeof _0x111bdf[_0x5c28e5(0xda)]!=='object')return[];const _0x5076c7=[];for(const [_0x528052,_0x2d6724]of Object[_0x5c28e5(0xdb)](_0x111bdf['profiles'])){try{validateProfileConfig(_0x2d6724,_0x528052);const _0x288d98=getNewCredentialPath(_0x528052),_0x1c7540=getOldCredentialPath(_0x528052),_0xa50422=a50_0xa7ad29[_0x5c28e5(0xe0)](_0x288d98)||a50_0xa7ad29[_0x5c28e5(0xe0)](_0x1c7540);_0x5076c7[_0x5c28e5(0xe6)]({'name':_0x528052,'config':_0x2d6724,'metadata':{'name':_0x528052,'createdAt':new Date()[_0x5c28e5(0xdd)]()},'hasCredentials':_0xa50422,'scope':_0x565571});}catch(_0x2eb0bd){_0x2eb0bd instanceof Error&&(console[_0x5c28e5(0xec)](_0x5c28e5(0xc2)+_0x58e62f+':'),console[_0x5c28e5(0xec)]('\x20\x20'+_0x2eb0bd[_0x5c28e5(0xbc)]+'\x0a'));}}return _0x5076c7;}catch(_0x4970a6){return _0x4970a6 instanceof SyntaxError?(console[_0x5c28e5(0xec)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x58e62f+_0x5c28e5(0xad)),console[_0x5c28e5(0xec)]('Error:\x20'+_0x4970a6['message']+'\x0a')):console[_0x5c28e5(0xec)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x58e62f+':\x20'+_0x4970a6+'\x0a'),[];}}export function getNewCredentialPath(_0x538e0f){const _0x24a616=a50_0x297c;return a50_0x44d796[_0x24a616(0xb7)](getConfigDir(),'.env.'+_0x538e0f);}function getOldCredentialPath(_0x17eec7){const _0x25602a=a50_0x297c;return a50_0x44d796[_0x25602a(0xb7)](getProfilesDir(),_0x17eec7,_0x25602a(0xe7));}function loadProfilesFromTdxJsonFiles(){const _0x12b634=a50_0x297c,_0x5a1b87=[],_0x265cee=findProjectConfigPath();_0x265cee&&_0x5a1b87[_0x12b634(0xe6)](...loadProfilesFromTdxJson(_0x265cee,_0x12b634(0xe5)));const _0x356bd6=a50_0x44d796[_0x12b634(0xb7)](getConfigDir(),_0x12b634(0xce));return _0x5a1b87['push'](...loadProfilesFromTdxJson(_0x356bd6,_0x12b634(0xd9))),_0x5a1b87;}function loadProfilesFromDirectories(){const _0x33c311=a50_0x297c,_0x40c052=getProfilesDir();if(!a50_0xa7ad29['existsSync'](_0x40c052))return[];try{return a50_0xa7ad29[_0x33c311(0xba)](_0x40c052,{'withFileTypes':!![]})[_0x33c311(0xb4)](_0x5ba36f=>_0x5ba36f['isDirectory']())[_0x33c311(0xa7)](_0x48e005=>_0x48e005[_0x33c311(0xd2)])[_0x33c311(0xb4)](_0x3a9336=>{const _0xb7a069=_0x33c311,_0x277b81=getProfileConfigPath(_0x3a9336),_0x32bf66=getProfileEnvPath(_0x3a9336);return a50_0xa7ad29['existsSync'](_0x277b81)||a50_0xa7ad29[_0xb7a069(0xe0)](_0x32bf66);})[_0x33c311(0xa7)](_0x41c946=>{const _0x170322=_0x33c311,_0x55eb01=loadProfileFromDirectory(_0x41c946);if(_0x55eb01)return{..._0x55eb01,'scope':_0x170322(0xb3)};return null;})[_0x33c311(0xb4)](_0x3e6464=>_0x3e6464!==null);}catch{return[];}}function loadProfileFromDirectory(_0x10b109){const _0x145533=a50_0x297c,_0x2933bf=getProfileConfigPath(_0x10b109),_0x42ffae=getOldCredentialPath(_0x10b109);if(!a50_0xa7ad29[_0x145533(0xe0)](_0x2933bf)&&!a50_0xa7ad29[_0x145533(0xe0)](_0x42ffae))return null;let _0x20ae1d={},_0xc5536e={'name':_0x10b109,'createdAt':new Date()[_0x145533(0xdd)]()};if(a50_0xa7ad29[_0x145533(0xe0)](_0x2933bf))try{const _0x5ebe4c=a50_0xa7ad29[_0x145533(0xb6)](_0x2933bf,_0x145533(0xa8)),_0x3c9b55=JSON[_0x145533(0xe3)](_0x5ebe4c),{metadata:_0x561a4c,..._0x37617c}=_0x3c9b55;_0x20ae1d=_0x37617c,_0x561a4c&&(_0xc5536e=_0x561a4c);}catch{}return{'name':_0x10b109,'config':_0x20ae1d,'metadata':_0xc5536e,'hasCredentials':a50_0xa7ad29[_0x145533(0xe0)](_0x42ffae),'scope':_0x145533(0xb3)};}function a50_0x297c(_0x346cdb,_0x496f09){_0x346cdb=_0x346cdb-0xa5;const _0x30f1d4=a50_0x30f1();let _0x297cef=_0x30f1d4[_0x346cdb];return _0x297cef;}export function listProfiles(){const _0x17b360=a50_0x297c,_0x113cec=loadProfilesFromTdxJsonFiles(),_0x1d358b=loadProfilesFromDirectories();if(_0x1d358b['length']>0x0){const _0x9a16bd=_0x1d358b['map'](_0x88e037=>_0x88e037[_0x17b360(0xd2)])[_0x17b360(0xb7)](',\x20'),_0x1bc3b8=getConfigDir();console['warn'](_0x17b360(0xa9)+_0x9a16bd),console['warn'](_0x17b360(0xa5)),console['warn'](_0x17b360(0xc4)+a50_0x44d796['join'](_0x1bc3b8,_0x17b360(0xce))),console[_0x17b360(0xec)](_0x17b360(0xcc)),console[_0x17b360(0xec)](_0x17b360(0xc7));}const _0x33c822=[..._0x113cec,..._0x1d358b],_0x5190da=new Map();for(const _0x2b4c10 of _0x33c822){!_0x5190da[_0x17b360(0xb9)](_0x2b4c10[_0x17b360(0xd2)])&&_0x5190da[_0x17b360(0xe9)](_0x2b4c10[_0x17b360(0xd2)],_0x2b4c10);}return Array[_0x17b360(0xd3)](_0x5190da[_0x17b360(0xb0)]())[_0x17b360(0xbe)]((_0x2fc43e,_0x57dbb4)=>_0x2fc43e[_0x17b360(0xd2)]['localeCompare'](_0x57dbb4[_0x17b360(0xd2)]));}export function profileExists(_0x18e40e){const _0x541bd5=a50_0x297c,_0x553f5b=listProfiles();return _0x553f5b[_0x541bd5(0xc3)](_0x3ff45e=>_0x3ff45e[_0x541bd5(0xd2)]===_0x18e40e);}export function loadProfile(_0x37a785){const _0x100cc8=a50_0x297c;validateProfileName(_0x37a785);const _0x55c3e8=listProfiles(),_0x4527f2=_0x55c3e8[_0x100cc8(0xd4)](_0x7f4d5=>_0x7f4d5[_0x100cc8(0xd2)]===_0x37a785);return _0x4527f2||null;}export function saveProfile(_0x4e7ba0,_0x3ac1d5,_0x1d7a93=![]){saveProfileToUserConfig(_0x4e7ba0,_0x3ac1d5);}export function deleteProfile(_0x1c8d26){const _0x4ab1fb=a50_0x297c;validateProfileName(_0x1c8d26);const _0x295355=getProfileDir(_0x1c8d26);if(!a50_0xa7ad29['existsSync'](_0x295355))throw new Error('Profile\x20'+_0x1c8d26+'\x20does\x20not\x20exist');a50_0xa7ad29[_0x4ab1fb(0xea)](_0x295355,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x4de8ff,_0x18950c){const _0x3b2f0e=a50_0x297c;validateProfileName(_0x4de8ff);const _0x21ad9c=getGlobalConfigPath(),_0x33bc44=getConfigDir();!a50_0xa7ad29['existsSync'](_0x33bc44)&&createSecureDirectory(_0x33bc44);let _0x185bb9={};if(a50_0xa7ad29[_0x3b2f0e(0xe0)](_0x21ad9c))try{const _0x44aa76=a50_0xa7ad29[_0x3b2f0e(0xb6)](_0x21ad9c,_0x3b2f0e(0xa8));_0x185bb9=JSON[_0x3b2f0e(0xe3)](_0x44aa76);}catch{console['warn'](_0x3b2f0e(0xe2)+_0x21ad9c+',\x20creating\x20new\x20file');}!_0x185bb9['profiles']&&(_0x185bb9[_0x3b2f0e(0xda)]={}),_0x185bb9[_0x3b2f0e(0xda)][_0x4de8ff]=_0x18950c,writeSecureFile(_0x21ad9c,JSON[_0x3b2f0e(0xc0)](_0x185bb9,null,0x2));}function a50_0x30f1(){const _0x25f707=['llm_project','1176107WIPhqr','user','profiles','entries','1536477NXcrYG','toISOString','object','parent_segment','existsSync','site','Warning:\x20Failed\x20to\x20parse\x20','parse','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','local','push','.env','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','set','rmSync','\x20already\x20exists','warn','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','map','utf-8','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','4VQdJZl','Profile\x20\x27','description',':\x20Invalid\x20JSON\x20syntax','test','includes','values','profile','35964000ZwOebG','directory','filter','\x20\x20mv\x20\x22','readFileSync','join','Profile\x20','has','readdirSync','4083245ISGCSI','message','\x20does\x20not\x20exist','sort','keys','stringify','7561080GbLynW','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','some','\x20\x201.\x20Edit:\x20','\x27:\x20config\x20must\x20be\x20an\x20object','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','llm_agent','11903507AWvivY','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','string','tdx.json','\x27:\x20unknown\x20config\x20key\x20\x27','1034206gfGJfQ','database','name','from','find','6EIWVqY','To\x20migrate:'];a50_0x30f1=function(){return _0x25f707;};return a50_0x30f1();}export function getActiveProfile(){const _0x46a6fe=a50_0x297c,_0x20b3e8=loadSessionContext();if(_0x20b3e8?.[_0x46a6fe(0xb1)])return _0x20b3e8[_0x46a6fe(0xb1)];const _0x20a87f=getGlobalConfigPath();if(!a50_0xa7ad29['existsSync'](_0x20a87f))return null;try{const _0x440176=a50_0xa7ad29[_0x46a6fe(0xb6)](_0x20a87f,_0x46a6fe(0xa8)),_0x5546b8=JSON[_0x46a6fe(0xe3)](_0x440176);return _0x5546b8[_0x46a6fe(0xb1)]||null;}catch{return null;}}export function createProfile(_0x21d621,_0x4f709b){const _0x1cbadb=a50_0x297c;validateProfileName(_0x21d621);if(profileExists(_0x21d621))throw new Error(_0x1cbadb(0xb8)+_0x21d621+_0x1cbadb(0xeb));saveProfile(_0x21d621,_0x4f709b);}export function saveProfileCredentials(_0x20ef0a,_0x1edf3d){const _0x428b99=a50_0x297c;validateProfileName(_0x20ef0a);if(!profileExists(_0x20ef0a))throw new Error(_0x428b99(0xb8)+_0x20ef0a+_0x428b99(0xbd));const _0x29f207=getNewCredentialPath(_0x20ef0a);writeSecureFile(_0x29f207,_0x1edf3d);}export function loadProfileCredentials(_0x59938c){const _0x27027a=a50_0x297c;validateProfileName(_0x59938c);const _0x321fa0=getNewCredentialPath(_0x59938c);if(a50_0xa7ad29[_0x27027a(0xe0)](_0x321fa0))try{return a50_0xa7ad29[_0x27027a(0xb6)](_0x321fa0,'utf-8');}catch{}const _0x4c5755=getOldCredentialPath(_0x59938c);if(a50_0xa7ad29[_0x27027a(0xe0)](_0x4c5755)){console[_0x27027a(0xec)](_0x27027a(0xc8)+_0x59938c+'\x27'),console[_0x27027a(0xec)](_0x27027a(0xd6)),console[_0x27027a(0xec)](_0x27027a(0xb5)+_0x4c5755+'\x22\x20\x22'+_0x321fa0+'\x22'),console[_0x27027a(0xec)](_0x27027a(0xe4));try{return a50_0xa7ad29['readFileSync'](_0x4c5755,_0x27027a(0xa8));}catch{return null;}}return null;}
|
|
1
|
+
(function(_0x1e3d9e,_0x58b868){const _0x2ca7f9=a50_0x2179,_0x30beec=_0x1e3d9e();while(!![]){try{const _0xab16f8=parseInt(_0x2ca7f9(0x1ef))/0x1*(-parseInt(_0x2ca7f9(0x1cc))/0x2)+parseInt(_0x2ca7f9(0x1b7))/0x3*(parseInt(_0x2ca7f9(0x1b6))/0x4)+-parseInt(_0x2ca7f9(0x1e3))/0x5*(-parseInt(_0x2ca7f9(0x1c0))/0x6)+parseInt(_0x2ca7f9(0x1bf))/0x7*(-parseInt(_0x2ca7f9(0x1ba))/0x8)+-parseInt(_0x2ca7f9(0x1b5))/0x9*(-parseInt(_0x2ca7f9(0x1e4))/0xa)+-parseInt(_0x2ca7f9(0x1c1))/0xb+-parseInt(_0x2ca7f9(0x1d2))/0xc;if(_0xab16f8===_0x58b868)break;else _0x30beec['push'](_0x30beec['shift']());}catch(_0x1d2a0e){_0x30beec['push'](_0x30beec['shift']());}}}(a50_0x49ba,0xe4f79));import*as a50_0x1912d6 from'node:fs';import*as a50_0x2f9734 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export function getProfileParams(_0x45538e){const _0x167219=a50_0x2179,_0x2994ac={};if(!_0x45538e)return _0x2994ac;for(const [_0x15fe4a,_0x23676b]of Object[_0x167219(0x1b0)](_0x45538e)){_0x15fe4a!==_0x167219(0x1bd)&&_0x23676b!==undefined&&(_0x2994ac[_0x15fe4a]=_0x23676b);}return _0x2994ac;}export function getProfilesDir(){return a50_0x2f9734['join'](getConfigDir(),'profiles');}function getProfileDir(_0x3eb532){const _0x3a9e97=a50_0x2179;return a50_0x2f9734[_0x3a9e97(0x1e7)](getProfilesDir(),_0x3eb532);}function a50_0x2179(_0x5b2b8f,_0x39ef99){_0x5b2b8f=_0x5b2b8f-0x1ad;const _0x49bae4=a50_0x49ba();let _0x217983=_0x49bae4[_0x5b2b8f];return _0x217983;}function getProfileConfigPath(_0x464056){const _0x61b2b=a50_0x2179;return a50_0x2f9734['join'](getProfileDir(_0x464056),_0x61b2b(0x1c4));}function getProfileEnvPath(_0x5e4a36){const _0x5c19fb=a50_0x2179;return a50_0x2f9734[_0x5c19fb(0x1e7)](getProfileDir(_0x5e4a36),_0x5c19fb(0x1be));}function getGlobalConfigPath(){const _0x5e98ab=a50_0x2179;return a50_0x2f9734[_0x5e98ab(0x1e7)](getConfigDir(),_0x5e98ab(0x1c4));}function validateProfileName(_0x5e3512){const _0x5f338b=a50_0x2179;if(!/^[a-zA-Z0-9_-]+$/['test'](_0x5e3512))throw new Error(_0x5f338b(0x1e9)+_0x5e3512+_0x5f338b(0x1c5));}function validateProfileConfig(_0x20cc27,_0x5aaf86){const _0x4af726=a50_0x2179;if(typeof _0x20cc27!==_0x4af726(0x1d7)||_0x20cc27===null)throw new Error(_0x4af726(0x1df)+_0x5aaf86+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x3bf38a=[_0x4af726(0x1bd),_0x4af726(0x1d9),'database',_0x4af726(0x1e0),'llm_project',_0x4af726(0x1bc)],_0x7089f4=_0x20cc27;for(const _0x2034d5 of Object[_0x4af726(0x1e5)](_0x7089f4)){!_0x3bf38a[_0x4af726(0x1c7)](_0x2034d5)&&console[_0x4af726(0x1ea)](_0x4af726(0x1c6)+_0x5aaf86+_0x4af726(0x1b9)+_0x2034d5+_0x4af726(0x1d8));}if(_0x7089f4[_0x4af726(0x1bd)]!==undefined&&typeof _0x7089f4[_0x4af726(0x1bd)]!==_0x4af726(0x1db))throw new Error(_0x4af726(0x1df)+_0x5aaf86+_0x4af726(0x1af));if(_0x7089f4[_0x4af726(0x1d9)]!==undefined&&typeof _0x7089f4[_0x4af726(0x1d9)]!==_0x4af726(0x1db))throw new Error(_0x4af726(0x1df)+_0x5aaf86+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x7089f4['database']!==undefined&&typeof _0x7089f4[_0x4af726(0x1f6)]!==_0x4af726(0x1db))throw new Error(_0x4af726(0x1df)+_0x5aaf86+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x7089f4[_0x4af726(0x1e0)]!==undefined&&typeof _0x7089f4['parent_segment']!==_0x4af726(0x1db))throw new Error('Profile\x20\x27'+_0x5aaf86+_0x4af726(0x1bb));if(_0x7089f4[_0x4af726(0x1f4)]!==undefined&&typeof _0x7089f4[_0x4af726(0x1f4)]!==_0x4af726(0x1db))throw new Error('Profile\x20\x27'+_0x5aaf86+_0x4af726(0x1f9));if(_0x7089f4[_0x4af726(0x1bc)]!==undefined&&typeof _0x7089f4[_0x4af726(0x1bc)]!==_0x4af726(0x1db))throw new Error(_0x4af726(0x1df)+_0x5aaf86+_0x4af726(0x1b3));return!![];}function loadProfilesFromTdxJson(_0x342fc5,_0x25aa4f){const _0xf63e5c=a50_0x2179;if(!a50_0x1912d6[_0xf63e5c(0x1ee)](_0x342fc5))return[];try{const _0x291de0=a50_0x1912d6['readFileSync'](_0x342fc5,'utf-8'),_0x35e8d1=JSON[_0xf63e5c(0x1c8)](_0x291de0);if(!_0x35e8d1[_0xf63e5c(0x1de)]||typeof _0x35e8d1[_0xf63e5c(0x1de)]!==_0xf63e5c(0x1d7))return[];const _0x2f023f=[];for(const [_0x481b2f,_0x52d989]of Object['entries'](_0x35e8d1['profiles'])){try{validateProfileConfig(_0x52d989,_0x481b2f);const _0x2ff52b=getNewCredentialPath(_0x481b2f),_0x2b798a=getOldCredentialPath(_0x481b2f),_0x1338c0=a50_0x1912d6[_0xf63e5c(0x1ee)](_0x2ff52b)||a50_0x1912d6['existsSync'](_0x2b798a);_0x2f023f[_0xf63e5c(0x1b8)]({'name':_0x481b2f,'config':_0x52d989,'metadata':{'name':_0x481b2f,'createdAt':new Date()[_0xf63e5c(0x1ca)]()},'hasCredentials':_0x1338c0,'scope':_0x25aa4f});}catch(_0x10c1ab){_0x10c1ab instanceof Error&&(console['warn'](_0xf63e5c(0x1c9)+_0x342fc5+':'),console[_0xf63e5c(0x1ea)]('\x20\x20'+_0x10c1ab[_0xf63e5c(0x1f1)]+'\x0a'));}}return _0x2f023f;}catch(_0x5587e5){return _0x5587e5 instanceof SyntaxError?(console[_0xf63e5c(0x1ea)](_0xf63e5c(0x1f5)+_0x342fc5+_0xf63e5c(0x1f2)),console[_0xf63e5c(0x1ea)](_0xf63e5c(0x1ec)+_0x5587e5['message']+'\x0a')):console['warn'](_0xf63e5c(0x1cd)+_0x342fc5+':\x20'+_0x5587e5+'\x0a'),[];}}export function getNewCredentialPath(_0x15a6de){const _0x18ca90=a50_0x2179;return a50_0x2f9734[_0x18ca90(0x1e7)](getConfigDir(),_0x18ca90(0x1d1)+_0x15a6de);}function getOldCredentialPath(_0x3a084f){const _0x1f7e35=a50_0x2179;return a50_0x2f9734[_0x1f7e35(0x1e7)](getProfilesDir(),_0x3a084f,_0x1f7e35(0x1be));}function loadProfilesFromTdxJsonFiles(){const _0x1f1896=a50_0x2179,_0x75dacd=[],_0x4d4337=findProjectConfigPath();_0x4d4337&&_0x75dacd[_0x1f1896(0x1b8)](...loadProfilesFromTdxJson(_0x4d4337,_0x1f1896(0x1b4)));const _0x57f582=a50_0x2f9734[_0x1f1896(0x1e7)](getConfigDir(),_0x1f1896(0x1c4));return _0x75dacd[_0x1f1896(0x1b8)](...loadProfilesFromTdxJson(_0x57f582,_0x1f1896(0x1e6))),_0x75dacd;}function loadProfilesFromDirectories(){const _0x29f580=a50_0x2179,_0x1a5a96=getProfilesDir();if(!a50_0x1912d6[_0x29f580(0x1ee)](_0x1a5a96))return[];try{return a50_0x1912d6[_0x29f580(0x1e2)](_0x1a5a96,{'withFileTypes':!![]})[_0x29f580(0x1ae)](_0xfe15a6=>_0xfe15a6[_0x29f580(0x1ce)]())[_0x29f580(0x1dc)](_0x3f588a=>_0x3f588a[_0x29f580(0x1f7)])['filter'](_0x2a5b6c=>{const _0x385dcc=_0x29f580,_0x531f95=getProfileConfigPath(_0x2a5b6c),_0x247f81=getProfileEnvPath(_0x2a5b6c);return a50_0x1912d6[_0x385dcc(0x1ee)](_0x531f95)||a50_0x1912d6['existsSync'](_0x247f81);})[_0x29f580(0x1dc)](_0x2b4362=>{const _0x49993e=loadProfileFromDirectory(_0x2b4362);if(_0x49993e)return{..._0x49993e,'scope':'directory'};return null;})[_0x29f580(0x1ae)](_0x18e628=>_0x18e628!==null);}catch{return[];}}function loadProfileFromDirectory(_0x53dd85){const _0x5783af=a50_0x2179,_0x4e6b27=getProfileConfigPath(_0x53dd85),_0x1eceb1=getOldCredentialPath(_0x53dd85);if(!a50_0x1912d6[_0x5783af(0x1ee)](_0x4e6b27)&&!a50_0x1912d6['existsSync'](_0x1eceb1))return null;let _0x32e993={},_0x1dca10={'name':_0x53dd85,'createdAt':new Date()[_0x5783af(0x1ca)]()};if(a50_0x1912d6['existsSync'](_0x4e6b27))try{const _0x320791=a50_0x1912d6[_0x5783af(0x1eb)](_0x4e6b27,_0x5783af(0x1ad)),_0x1873e3=JSON[_0x5783af(0x1c8)](_0x320791),{metadata:_0x38e7ea,..._0x4e7ad4}=_0x1873e3;_0x32e993=_0x4e7ad4,_0x38e7ea&&(_0x1dca10=_0x38e7ea);}catch{}return{'name':_0x53dd85,'config':_0x32e993,'metadata':_0x1dca10,'hasCredentials':a50_0x1912d6[_0x5783af(0x1ee)](_0x1eceb1),'scope':'directory'};}export function listProfiles(){const _0x432331=a50_0x2179,_0x34009e=loadProfilesFromTdxJsonFiles(),_0x472379=loadProfilesFromDirectories();if(_0x472379['length']>0x0){const _0x59b3a9=_0x472379[_0x432331(0x1dc)](_0x5e2bfd=>_0x5e2bfd[_0x432331(0x1f7)])[_0x432331(0x1e7)](',\x20'),_0x1def17=getConfigDir();console[_0x432331(0x1ea)](_0x432331(0x1d0)+_0x59b3a9),console[_0x432331(0x1ea)](_0x432331(0x1e1)),console[_0x432331(0x1ea)](_0x432331(0x1f8)+a50_0x2f9734[_0x432331(0x1e7)](_0x1def17,_0x432331(0x1c4))),console[_0x432331(0x1ea)](_0x432331(0x1f3)),console[_0x432331(0x1ea)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x5558b1=[..._0x34009e,..._0x472379],_0xce3fcb=new Map();for(const _0x1c3026 of _0x5558b1){!_0xce3fcb['has'](_0x1c3026[_0x432331(0x1f7)])&&_0xce3fcb[_0x432331(0x1ed)](_0x1c3026['name'],_0x1c3026);}return Array[_0x432331(0x1c2)](_0xce3fcb[_0x432331(0x1b2)]())[_0x432331(0x1d3)]((_0x4ceb66,_0x3be45b)=>_0x4ceb66[_0x432331(0x1f7)][_0x432331(0x1cf)](_0x3be45b[_0x432331(0x1f7)]));}export function profileExists(_0x2d723f){const _0x3cba78=a50_0x2179,_0x1cd1a1=listProfiles();return _0x1cd1a1[_0x3cba78(0x1d6)](_0x5c3a4c=>_0x5c3a4c['name']===_0x2d723f);}export function loadProfile(_0x32422a){const _0x8a3d93=a50_0x2179;validateProfileName(_0x32422a);const _0x2f66ca=listProfiles(),_0x177ecb=_0x2f66ca['find'](_0x560e64=>_0x560e64[_0x8a3d93(0x1f7)]===_0x32422a);return _0x177ecb||null;}export function saveProfile(_0x354818,_0x26576f,_0x5f1cf8=![]){saveProfileToUserConfig(_0x354818,_0x26576f);}export function deleteProfile(_0x234b17){const _0x553217=a50_0x2179;validateProfileName(_0x234b17);const _0x4cd90b=getProfileDir(_0x234b17);if(!a50_0x1912d6[_0x553217(0x1ee)](_0x4cd90b))throw new Error('Profile\x20'+_0x234b17+_0x553217(0x1e8));a50_0x1912d6[_0x553217(0x1d5)](_0x4cd90b,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x13433f,_0x448214){const _0x197471=a50_0x2179;validateProfileName(_0x13433f);const _0x4a2133=getGlobalConfigPath(),_0x49bf7b=getConfigDir();!a50_0x1912d6['existsSync'](_0x49bf7b)&&createSecureDirectory(_0x49bf7b);let _0x2dd056={};if(a50_0x1912d6[_0x197471(0x1ee)](_0x4a2133))try{const _0x268550=a50_0x1912d6[_0x197471(0x1eb)](_0x4a2133,'utf-8');_0x2dd056=JSON[_0x197471(0x1c8)](_0x268550);}catch{console[_0x197471(0x1ea)]('Warning:\x20Failed\x20to\x20parse\x20'+_0x4a2133+_0x197471(0x1f0));}!_0x2dd056[_0x197471(0x1de)]&&(_0x2dd056['profiles']={}),_0x2dd056[_0x197471(0x1de)][_0x13433f]=_0x448214,writeSecureFile(_0x4a2133,JSON[_0x197471(0x1da)](_0x2dd056,null,0x2));}export function getActiveProfile(){const _0x2917fe=a50_0x2179,_0x5a13c9=loadSessionContext();if(_0x5a13c9?.[_0x2917fe(0x1cb)])return _0x5a13c9[_0x2917fe(0x1cb)];const _0x150b70=getGlobalConfigPath();if(!a50_0x1912d6[_0x2917fe(0x1ee)](_0x150b70))return null;try{const _0x21a183=a50_0x1912d6[_0x2917fe(0x1eb)](_0x150b70,_0x2917fe(0x1ad)),_0x4d6b43=JSON['parse'](_0x21a183);return _0x4d6b43['profile']||null;}catch{return null;}}export function createProfile(_0x2244ed,_0x35cdf1){const _0x3f449d=a50_0x2179;validateProfileName(_0x2244ed);if(profileExists(_0x2244ed))throw new Error(_0x3f449d(0x1c3)+_0x2244ed+_0x3f449d(0x1dd));saveProfile(_0x2244ed,_0x35cdf1);}function a50_0x49ba(){const _0x4a98e3=['66DmyRep','4199690KzARqx','from','Profile\x20','tdx.json','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','Warning:\x20Profile\x20\x27','includes','parse','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','toISOString','profile','166GrXENC','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','isDirectory','localeCompare','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','.env.','789456cDyqwX','sort','\x22\x20\x22','rmSync','some','object','\x27\x20will\x20be\x20ignored','site','stringify','string','map','\x20already\x20exists','profiles','Profile\x20\x27','parent_segment','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','readdirSync','835035guiVDh','4698370dNWqLY','keys','user','join','\x20does\x20not\x20exist','Invalid\x20profile\x20name:\x20','warn','readFileSync','Error:\x20','set','existsSync','10522SEKROp',',\x20creating\x20new\x20file','message',':\x20Invalid\x20JSON\x20syntax','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','llm_project','\x0aWarning:\x20Failed\x20to\x20parse\x20','database','name','\x20\x201.\x20Edit:\x20','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','utf-8','filter','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','entries','To\x20migrate:','values','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','local','9YHQoxK','188844rWQaFm','51pCMaMc','push','\x27:\x20unknown\x20config\x20key\x20\x27','6805984AWbpzO','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','llm_agent','description','.env','7GfcMTH'];a50_0x49ba=function(){return _0x4a98e3;};return a50_0x49ba();}export function saveProfileCredentials(_0x5a0ad6,_0x2943f6){const _0x2d56ae=a50_0x2179;validateProfileName(_0x5a0ad6);if(!profileExists(_0x5a0ad6))throw new Error(_0x2d56ae(0x1c3)+_0x5a0ad6+_0x2d56ae(0x1e8));const _0x27607e=getNewCredentialPath(_0x5a0ad6);writeSecureFile(_0x27607e,_0x2943f6);}export function loadProfileCredentials(_0x46f0bc){const _0x37b720=a50_0x2179;validateProfileName(_0x46f0bc);const _0x42b4d7=getNewCredentialPath(_0x46f0bc);if(a50_0x1912d6[_0x37b720(0x1ee)](_0x42b4d7))try{return a50_0x1912d6['readFileSync'](_0x42b4d7,_0x37b720(0x1ad));}catch{}const _0x482a42=getOldCredentialPath(_0x46f0bc);if(a50_0x1912d6['existsSync'](_0x482a42)){console['warn']('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x46f0bc+'\x27'),console[_0x37b720(0x1ea)](_0x37b720(0x1b1)),console[_0x37b720(0x1ea)]('\x20\x20mv\x20\x22'+_0x482a42+_0x37b720(0x1d4)+_0x42b4d7+'\x22'),console[_0x37b720(0x1ea)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a50_0x1912d6['readFileSync'](_0x482a42,_0x37b720(0x1ad));}catch{return null;}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x5ad8a1,_0x303255){const _0x5ceceb=a51_0x3bf5,_0x16a579=_0x5ad8a1();while(!![]){try{const _0x49c31a=parseInt(_0x5ceceb(0xb7))/0x1*(parseInt(_0x5ceceb(0xcb))/0x2)+-parseInt(_0x5ceceb(0xc9))/0x3*(parseInt(_0x5ceceb(0xc7))/0x4)+parseInt(_0x5ceceb(0xb3))/0x5*(-parseInt(_0x5ceceb(0xc2))/0x6)+parseInt(_0x5ceceb(0xb1))/0x7*(parseInt(_0x5ceceb(0xc1))/0x8)+-parseInt(_0x5ceceb(0xc3))/0x9+-parseInt(_0x5ceceb(0xca))/0xa*(parseInt(_0x5ceceb(0xbb))/0xb)+parseInt(_0x5ceceb(0xb0))/0xc;if(_0x49c31a===_0x303255)break;else _0x16a579['push'](_0x16a579['shift']());}catch(_0x2a4cfd){_0x16a579['push'](_0x16a579['shift']());}}}(a51_0x385d,0x9059a));import*as a51_0x33192c from'node:fs';import*as a51_0x3fd859 from'node:path';function a51_0x385d(){const _0x3cba60=['8rJWlOL','18MZxXYp','6116796YYYwJf','ENOENT','join','\x20is\x20ignored.\x20','192iZbbCq','api_key','528yqkbqa','9218490pLSjPd','7820RMrKLc','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','includes',').\x20','warn','profile','existsSync','cwd','writeFileSync','10028688kEMQoc','7786128nXIaMh','dirname','249265XxccNc','code','readFileSync','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','103ScQqCP','stringify','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','utf-8','11fUInXl','Warning:\x20\x27profile\x27\x20field\x20in\x20','parse','TD_API_KEY','apiKey','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.'];a51_0x385d=function(){return _0x3cba60;};return a51_0x385d();}const PROJECT_CONFIG_FILENAME='tdx.json';function a51_0x3bf5(_0x3265a2,_0x565dbf){_0x3265a2=_0x3265a2-0xb0;const _0x385dc3=a51_0x385d();let _0x3bf593=_0x385dc3[_0x3265a2];return _0x3bf593;}export function findProjectConfigPath(_0x1b4a9c){const _0x5336e8=a51_0x3bf5;let _0x41b1a0=_0x1b4a9c||process['cwd']();while(!![]){const _0x465438=a51_0x3fd859[_0x5336e8(0xc5)](_0x41b1a0,PROJECT_CONFIG_FILENAME);if(a51_0x33192c[_0x5336e8(0xd1)](_0x465438))return _0x465438;const _0x18fc67=a51_0x3fd859[_0x5336e8(0xb2)](_0x41b1a0);if(_0x18fc67===_0x41b1a0)return null;_0x41b1a0=_0x18fc67;}}export function loadProjectConfig(_0x508757){const _0x310cf6=a51_0x3bf5,_0xaf4e7=findProjectConfigPath(_0x508757);if(!_0xaf4e7)return null;try{const _0x5167ec=a51_0x33192c[_0x310cf6(0xb5)](_0xaf4e7,_0x310cf6(0xba)),_0x2a3127=JSON[_0x310cf6(0xbd)](_0x5167ec),_0x19978b=JSON[_0x310cf6(0xb8)](_0x2a3127);if(_0x19978b['includes'](_0x310cf6(0xbe))||_0x19978b['includes'](_0x310cf6(0xbf))||_0x19978b[_0x310cf6(0xcd)](_0x310cf6(0xc8)))throw new Error(_0x310cf6(0xb9)+_0xaf4e7+_0x310cf6(0xce)+_0x310cf6(0xc0));const {metadata:_0x2d0f20,profile:_0x4b6796,..._0x4cc0de}=_0x2a3127;return _0x4b6796&&console[_0x310cf6(0xcf)](_0x310cf6(0xbc)+_0xaf4e7+_0x310cf6(0xc6)+_0x310cf6(0xcc)),_0x4cc0de;}catch(_0x49a703){if(_0x49a703 instanceof Error&&_0x310cf6(0xb4)in _0x49a703&&_0x49a703['code']===_0x310cf6(0xc4))return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0xaf4e7+':\x20'+_0x49a703);}}export function saveProjectConfig(_0x4bdb53,_0x544690){const _0x3bacb8=a51_0x3bf5,_0x64f963=_0x544690||process[_0x3bacb8(0xd2)](),_0x5b2deb=a51_0x3fd859[_0x3bacb8(0xc5)](_0x64f963,PROJECT_CONFIG_FILENAME),_0x534ef2=JSON['stringify'](_0x4bdb53);if(_0x534ef2[_0x3bacb8(0xcd)](_0x3bacb8(0xbe))||_0x534ef2[_0x3bacb8(0xcd)](_0x3bacb8(0xbf))||_0x534ef2[_0x3bacb8(0xcd)](_0x3bacb8(0xc8)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x3bacb8(0xd0)in _0x4bdb53)throw new Error(_0x3bacb8(0xb6));a51_0x33192c[_0x3bacb8(0xd3)](_0x5b2deb,JSON[_0x3bacb8(0xb8)](_0x4bdb53,null,0x2));}export function hasProjectConfig(_0x7a5fc7){return findProjectConfigPath(_0x7a5fc7)!==null;}export function getProjectRoot(_0x19bb0f){const _0x1b8163=a51_0x3bf5,_0x376dda=findProjectConfigPath(_0x19bb0f);return _0x376dda?a51_0x3fd859[_0x1b8163(0xb2)](_0x376dda):null;}
|