@treasuredata/tdx 0.7.0 → 0.7.2

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.
Files changed (104) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/client/cdp-api-client.js +1 -1
  6. package/dist/client/engage-api-client.js +1 -1
  7. package/dist/client/http-client.js +1 -1
  8. package/dist/client/llm-api-client.js +1 -1
  9. package/dist/client/rate-limiter.js +1 -1
  10. package/dist/client/td-api-client.js +1 -1
  11. package/dist/client/trino-api-client.js +1 -1
  12. package/dist/client/workflow-client.js +1 -1
  13. package/dist/commands/activations.js +1 -1
  14. package/dist/commands/api-command.js +1 -1
  15. package/dist/commands/auth-command.js +1 -1
  16. package/dist/commands/chat-command.js +1 -1
  17. package/dist/commands/claude-command.js +1 -1
  18. package/dist/commands/claude-statusline-command.js +1 -1
  19. package/dist/commands/claude-usage-command.js +1 -1
  20. package/dist/commands/command.js +1 -1
  21. package/dist/commands/context-command.js +1 -1
  22. package/dist/commands/databases.js +1 -1
  23. package/dist/commands/describe.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/job-command.js +1 -1
  26. package/dist/commands/llm-command.js +1 -1
  27. package/dist/commands/llm-proxy.js +1 -1
  28. package/dist/commands/parent-segment-command.d.ts.map +1 -1
  29. package/dist/commands/parent-segment-command.js +1 -1
  30. package/dist/commands/parent-segment-command.js.map +1 -1
  31. package/dist/commands/profiles-command.js +1 -1
  32. package/dist/commands/query-command.js +1 -1
  33. package/dist/commands/segment-command.js +1 -1
  34. package/dist/commands/segment-create-command.js +1 -1
  35. package/dist/commands/segment-fields-command.js +1 -1
  36. package/dist/commands/segment-pwd-command.js +1 -1
  37. package/dist/commands/segment-update-command.js +1 -1
  38. package/dist/commands/segment-use-command.js +1 -1
  39. package/dist/commands/segments.js +1 -1
  40. package/dist/commands/show.js +1 -1
  41. package/dist/commands/tables.js +1 -1
  42. package/dist/commands/use-command.js +1 -1
  43. package/dist/commands/workflow-command.js +1 -1
  44. package/dist/core/auth.js +1 -1
  45. package/dist/core/config.js +1 -1
  46. package/dist/core/credential-cache.js +1 -1
  47. package/dist/core/global-context.js +1 -1
  48. package/dist/core/keychain.js +1 -1
  49. package/dist/core/profile.js +1 -1
  50. package/dist/core/project-config.js +1 -1
  51. package/dist/core/session.js +1 -1
  52. package/dist/index.js +1 -1
  53. package/dist/proxy/anthropic-adapter.js +1 -1
  54. package/dist/proxy/claude-usage-tracker.js +1 -1
  55. package/dist/proxy/context-signature.js +1 -1
  56. package/dist/proxy/conversation-utils.js +1 -1
  57. package/dist/proxy/server.js +1 -1
  58. package/dist/proxy/session-cache.js +1 -1
  59. package/dist/sdk/api.js +1 -1
  60. package/dist/sdk/engage.js +1 -1
  61. package/dist/sdk/errors.js +1 -1
  62. package/dist/sdk/index.js +1 -1
  63. package/dist/sdk/job.js +1 -1
  64. package/dist/sdk/llm.js +1 -1
  65. package/dist/sdk/query.js +1 -1
  66. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  67. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  68. package/dist/sdk/segment.js +1 -1
  69. package/dist/sdk/workflow.js +1 -1
  70. package/dist/types/endpoints.d.ts +12 -0
  71. package/dist/types/endpoints.d.ts.map +1 -1
  72. package/dist/types/endpoints.js +1 -1
  73. package/dist/types/endpoints.js.map +1 -1
  74. package/dist/types/index.js +1 -1
  75. package/dist/utils/agent-ref-parser.js +1 -1
  76. package/dist/utils/chat-cache.js +1 -1
  77. package/dist/utils/colors.js +1 -1
  78. package/dist/utils/command-output.js +1 -1
  79. package/dist/utils/constants.js +1 -1
  80. package/dist/utils/diff.js +1 -1
  81. package/dist/utils/fields-display.js +1 -1
  82. package/dist/utils/file-permissions.js +1 -1
  83. package/dist/utils/format-detector.js +1 -1
  84. package/dist/utils/formatters.js +1 -1
  85. package/dist/utils/json-loader.js +1 -1
  86. package/dist/utils/llm-backup-utils.js +1 -1
  87. package/dist/utils/model-aliases.js +1 -1
  88. package/dist/utils/model-factors.js +1 -1
  89. package/dist/utils/option-validation.js +1 -1
  90. package/dist/utils/port.js +1 -1
  91. package/dist/utils/process.js +1 -1
  92. package/dist/utils/prompt.js +1 -1
  93. package/dist/utils/segment-path-parser.js +1 -1
  94. package/dist/utils/segment-ref-parser.js +1 -1
  95. package/dist/utils/spinner.js +1 -1
  96. package/dist/utils/sql-parser.js +1 -1
  97. package/dist/utils/sse-parser.js +1 -1
  98. package/dist/utils/string-utils.js +1 -1
  99. package/dist/utils/table-ref-parser.js +1 -1
  100. package/dist/utils/tdx-logger.js +1 -1
  101. package/dist/utils/tree-formatter.js +1 -1
  102. package/dist/utils/version-check.js +1 -1
  103. package/dist/utils/workflow-utils.js +1 -1
  104. package/package.json +4 -2
@@ -1 +1 @@
1
- const a39_0x538516=a39_0x5249;(function(_0x2f062b,_0x4c8a7e){const _0x44a421=a39_0x5249,_0xf9cab5=_0x2f062b();while(!![]){try{const _0x55093b=parseInt(_0x44a421(0x17b))/0x1+-parseInt(_0x44a421(0x1c8))/0x2+-parseInt(_0x44a421(0x1de))/0x3*(parseInt(_0x44a421(0x176))/0x4)+parseInt(_0x44a421(0x1d4))/0x5+-parseInt(_0x44a421(0x1a0))/0x6*(parseInt(_0x44a421(0x1b9))/0x7)+parseInt(_0x44a421(0x1e0))/0x8*(-parseInt(_0x44a421(0x155))/0x9)+-parseInt(_0x44a421(0x16f))/0xa*(-parseInt(_0x44a421(0x1ae))/0xb);if(_0x55093b===_0x4c8a7e)break;else _0xf9cab5['push'](_0xf9cab5['shift']());}catch(_0x114b81){_0xf9cab5['push'](_0xf9cab5['shift']());}}}(a39_0x50ba,0x4c5ce));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';function a39_0x5249(_0x53d0f4,_0x187c0b){const _0x50ba1f=a39_0x50ba();return a39_0x5249=function(_0x52496c,_0x5972b3){_0x52496c=_0x52496c-0x14f;let _0x3b1c45=_0x50ba1f[_0x52496c];return _0x3b1c45;},a39_0x5249(_0x53d0f4,_0x187c0b);}import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';function a39_0x50ba(){const _0x3e4fac=['keys','Fetching\x20log\x20files...','session:','kill','params','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','Error:\x20Attempt\x20ID\x20is\x20required','List\x20workflow\x20attempts','Filter:\x20project=','workflow:kill','\x20\x20Session\x20ID:\x20','format','running','getTime','indexOf','...','Session\x20time:\x20','includeSubtasks','No\x20log\x20files\x20found\x20for\x20this\x20attempt','Expected\x20format:\x20--param\x20key=value','workflow','10QxSasy','canceling','push','length','Error:\x20Invalid\x20JSON\x20in\x20--params','Revision:\x20','Start\x20a\x20workflow\x20run','4AOaxnL','sessionId','\x20\x20New\x20attempt\x20ID:\x20','workflow:workflows','workflow:delete','91584zppEhd','\x22?\x20This\x20cannot\x20be\x20undone.','project','retryAttemptName','projectName','List\x20all\x20workflow\x20projects','Output\x20directory:\x20','Project\x20directory:\x20','Show\x20logs\x20for\x20a\x20workflow\x20attempt','Filter:\x20','sessionTime','param','workflow:tasks','resumeFrom','message','\x20attempt','Resume\x20from:\x20','stringify','createdAt','\x20\x20Cause:\x20','workflows','limit','Including\x20subtasks:\x20yes','retrySession','Project\x20name:\x20','filesExtracted','done','delete','Pushing\x20workflow\x20project...','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','substring','Killing\x20attempt...','startsWith','Listing\x20workflow\x20projects...','logFiles','success','fromTask','696XIANsS','isArray','status','Project\x20filter:\x20','Show\x20specific\x20attempt\x20details','execute','Show\x20tasks\x20for\x20an\x20attempt','data','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','workflow:logs','Retrying\x20session...','workflow:download','\x20\x20Project\x20ID:\x20','projects','9849543Edsgmm','workflow:projects','run','Kill\x20a\x20running\x20attempt','Attempt\x20ID:\x20','cause','workflow:run','force','task','\x20\x20Location:\x20','\x20project','19341KHZbPS','skipValidation','Parameters:\x20','Target:\x20','✔\x20Found\x20','download','projectId','workflow:attempts','Getting\x20attempt\x20tasks...','error','\x20is\x20not\x20a\x20directory','index','fs/promises','description','\x20\x20Files\x20extracted:\x20','91888xINelX','parse','taskName','Force:\x20yes','✔\x20Deleted\x20project\x20','workflow:sessions','Status:\x20','session','isDirectory','stat','\x20\x20Revision:\x20','cancelRequested','2093565eCQpaq','name','logs','fileSize','select','attemptId','json','Deleting\x20project\x20','tasks','revision','1682139kKNlrl','workflow:push','102008mHpXPj','Cancelled','Task\x20name:\x20','attempt','yes','readFile','Listing\x20workflow\x20sessions...','Project:\x20','Params:\x20','verbose','Starting\x20workflow\x20run...','✔\x20Retry\x20started','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','List\x20workflows','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','attempts','includeRetried','split','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','Error:\x20','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Downloading\x20project\x20','Error:\x20Workflow\x20identifier\x20is\x20required','finishedAt','utf-8','workflow:attempt','Listing\x20workflows...','117WPcewr','Error:\x20Invalid\x20parameter\x20format:\x20','Usage:\x20workflow:delete\x20<project-name-or-id>','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Retry\x20a\x20session\x20or\x20attempt'];a39_0x50ba=function(){return _0x3e4fac;};return a39_0x50ba();}import{formatBytes}from'../utils/formatters.js';import a39_0x25e3c6 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a39_0x538516(0x1d5)]=a39_0x538516(0x1af);[a39_0x538516(0x1c6)]=a39_0x538516(0x180);async[a39_0x538516(0x1a5)](_0x278940){const _0x31b258=a39_0x538516,{options:_0x529fc3,args:_0x4e3e9c,tdx:_0x3c310b}=_0x278940,_0x7f1a89=_0x4e3e9c[0x0];try{_0x529fc3[_0x31b258(0x1e9)]&&_0x7f1a89&&console[_0x31b258(0x1c2)]('Pattern:\x20'+_0x7f1a89);const _0x1123e4=await withSpinner(_0x31b258(0x19c),()=>_0x3c310b['workflow'][_0x31b258(0x1ad)](_0x7f1a89,{'limit':_0x529fc3['limit']}),{'verbose':_0x529fc3[_0x31b258(0x1e9)]}),_0x3c6c60=_0x1123e4[_0x31b258(0x1a7)];return console[_0x31b258(0x1c2)](_0x31b258(0x1bd)+_0x3c6c60[_0x31b258(0x172)]+_0x31b258(0x1b8)+(_0x3c6c60[_0x31b258(0x172)]!==0x1?'s':'')),await handleSDKOutput(_0x3c6c60,_0x529fc3),0x0;}catch(_0x1c80b5){if(_0x1c80b5 instanceof SDKError)return console[_0x31b258(0x1c2)]('Error:\x20'+_0x1c80b5[_0x31b258(0x189)]),_0x1c80b5[_0x31b258(0x1b3)]&&console[_0x31b258(0x1c2)](_0x31b258(0x18e)+_0x1c80b5[_0x31b258(0x1b3)]),0x1;throw _0x1c80b5;}}}export class WorkflowWorkflowsCommand extends BaseCommand{['name']=a39_0x538516(0x179);[a39_0x538516(0x1c6)]=a39_0x538516(0x1ed);async[a39_0x538516(0x1a5)](_0x553249){const _0x1e78fa=a39_0x538516,{options:_0x199020,args:_0x10826a,tdx:_0x127870}=_0x553249,_0x5dbbe4=_0x10826a[0x0];try{_0x199020[_0x1e78fa(0x1e9)]&&_0x5dbbe4&&console[_0x1e78fa(0x1c2)](_0x1e78fa(0x1a3)+_0x5dbbe4);const _0x104f19=await withSpinner(_0x1e78fa(0x154),()=>_0x127870[_0x1e78fa(0x16e)][_0x1e78fa(0x18f)](_0x5dbbe4,{'limit':_0x199020[_0x1e78fa(0x190)]}),{'verbose':_0x199020[_0x1e78fa(0x1e9)]}),_0x3bfc8b=_0x104f19[_0x1e78fa(0x1a7)];return console[_0x1e78fa(0x1c2)](_0x1e78fa(0x1bd)+_0x3bfc8b[_0x1e78fa(0x172)]+'\x20workflow'+(_0x3bfc8b[_0x1e78fa(0x172)]!==0x1?'s':'')),await handleSDKOutput(_0x3bfc8b,_0x199020),0x0;}catch(_0x142212){if(_0x142212 instanceof SDKError)return console[_0x1e78fa(0x1c2)](_0x1e78fa(0x1f3)+_0x142212['message']),_0x142212['cause']&&console[_0x1e78fa(0x1c2)](_0x1e78fa(0x18e)+_0x142212[_0x1e78fa(0x1b3)]),0x1;throw _0x142212;}}}export class WorkflowSessionsCommand extends BaseCommand{[a39_0x538516(0x1d5)]=a39_0x538516(0x1cd);[a39_0x538516(0x1c6)]='List\x20workflow\x20execution\x20sessions';async['execute'](_0x2c2cc5){const _0x22f99e=a39_0x538516,{options:_0x29f818,args:_0x307a51,tdx:_0x3bb705}=_0x2c2cc5;let _0x1adfc1,_0x482741;if(_0x307a51[0x0]){const _0x5d530b=_0x307a51[0x0][_0x22f99e(0x1f1)]('.');if(_0x5d530b[_0x22f99e(0x172)]===0x1)_0x1adfc1=_0x5d530b[0x0];else{if(_0x5d530b[_0x22f99e(0x172)]===0x2)[_0x1adfc1,_0x482741]=_0x5d530b;else return console[_0x22f99e(0x1c2)](_0x22f99e(0x1f4)),0x1;}}try{if(_0x29f818[_0x22f99e(0x1e9)]){if(_0x1adfc1&&_0x482741)console[_0x22f99e(0x1c2)](_0x22f99e(0x184)+_0x1adfc1+'.'+_0x482741);else _0x1adfc1&&console['error'](_0x22f99e(0x162)+_0x1adfc1);const _0x2a2741=_0x29f818[_0x22f99e(0x1a2)];_0x2a2741&&console[_0x22f99e(0x1c2)](_0x22f99e(0x1ce)+_0x2a2741);}const _0xd8c412=await withSpinner(_0x22f99e(0x1e6),()=>_0x3bb705[_0x22f99e(0x16e)]['sessions']({'projectName':_0x1adfc1,'workflowName':_0x482741,'status':_0x29f818[_0x22f99e(0x1a2)],'fromTime':_0x29f818['from'],'toTime':_0x29f818['to'],'limit':_0x29f818['limit']}),{'verbose':_0x29f818['verbose']}),_0x19f426=_0xd8c412[_0x22f99e(0x1a7)];return console[_0x22f99e(0x1c2)](_0x22f99e(0x1bd)+_0x19f426['length']+'\x20session'+(_0x19f426[_0x22f99e(0x172)]!==0x1?'s':'')),await handleSDKOutput(_0x19f426,_0x29f818),0x0;}catch(_0xbac069){if(_0xbac069 instanceof SDKError)return console[_0x22f99e(0x1c2)]('Error:\x20'+_0xbac069['message']),_0xbac069[_0x22f99e(0x1b3)]&&console[_0x22f99e(0x1c2)](_0x22f99e(0x18e)+_0xbac069['cause']),0x1;throw _0xbac069;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a39_0x538516(0x1d5)]=a39_0x538516(0x1c0);['description']=a39_0x538516(0x161);async['execute'](_0x41897c){const _0x373855=a39_0x538516,{options:_0xd62223,args:_0x1d27c9,tdx:_0x1adcd2}=_0x41897c;let _0x50c410,_0x4c3fd1;if(_0x1d27c9[0x0]){const _0x2803ce=_0x1d27c9[0x0][_0x373855(0x1f1)]('.');if(_0x2803ce['length']===0x1)_0x50c410=_0x2803ce[0x0];else{if(_0x2803ce['length']===0x2)[_0x50c410,_0x4c3fd1]=_0x2803ce;else return console[_0x373855(0x1c2)](_0x373855(0x1f4)),0x1;}}try{const _0x4db326=_0xd62223[_0x373855(0x1f0)];if(_0xd62223[_0x373855(0x1e9)]){if(_0x50c410&&_0x4c3fd1)console[_0x373855(0x1c2)](_0x373855(0x184)+_0x50c410+'.'+_0x4c3fd1);else _0x50c410&&console['error']('Filter:\x20project='+_0x50c410);_0x4db326&&console['error']('Include\x20retried:\x20yes');}const _0x480620=await withSpinner('Listing\x20workflow\x20attempts...',()=>_0x1adcd2[_0x373855(0x16e)][_0x373855(0x1ef)]({'projectName':_0x50c410,'workflowName':_0x4c3fd1,'includeRetried':_0x4db326,'limit':_0xd62223['limit']}),{'verbose':_0xd62223[_0x373855(0x1e9)]}),_0x53f0a0=_0x480620[_0x373855(0x1a7)];return console['error'](_0x373855(0x1bd)+_0x53f0a0[_0x373855(0x172)]+_0x373855(0x18a)+(_0x53f0a0[_0x373855(0x172)]!==0x1?'s':'')),await handleSDKOutput(_0x53f0a0,_0xd62223),0x0;}catch(_0x25d6fb){if(_0x25d6fb instanceof SDKError)return console[_0x373855(0x1c2)]('Error:\x20'+_0x25d6fb[_0x373855(0x189)]),_0x25d6fb[_0x373855(0x1b3)]&&console[_0x373855(0x1c2)](_0x373855(0x18e)+_0x25d6fb[_0x373855(0x1b3)]),0x1;throw _0x25d6fb;}}}export class WorkflowAttemptCommand extends BaseCommand{['name']=a39_0x538516(0x153);[a39_0x538516(0x1c6)]=a39_0x538516(0x1a4);async[a39_0x538516(0x1a5)](_0x4cf634){const _0x1ad952=a39_0x538516,{options:_0x33e1fa,args:_0xb22cf1,tdx:_0x541dd1}=_0x4cf634,_0x48cc92=_0xb22cf1[0x0];if(!_0x48cc92)return console['error'](_0x1ad952(0x160)),0x1;try{_0x33e1fa['verbose']&&console[_0x1ad952(0x1c2)](_0x1ad952(0x1b2)+_0x48cc92);const _0x45fb89=await withSpinner('Getting\x20attempt\x20details...',()=>_0x541dd1[_0x1ad952(0x16e)][_0x1ad952(0x1e3)](_0x48cc92),{'verbose':_0x33e1fa[_0x1ad952(0x1e9)]}),_0x32240f=_0x45fb89[_0x1ad952(0x1a7)];let _0x586158;!_0x32240f[_0x1ad952(0x195)]?_0x586158=_0x32240f[_0x1ad952(0x1d3)]?_0x1ad952(0x170):_0x1ad952(0x166):_0x586158=_0x32240f[_0x1ad952(0x19e)]?_0x1ad952(0x19e):_0x1ad952(0x1c2);let _0x2dd59a;if(_0x32240f[_0x1ad952(0x18d)]&&_0x32240f[_0x1ad952(0x151)]){const _0x56bbe6=new Date(_0x32240f[_0x1ad952(0x18d)])[_0x1ad952(0x167)](),_0x1fb837=new Date(_0x32240f['finishedAt'])['getTime']();_0x2dd59a=Math['round']((_0x1fb837-_0x56bbe6)/0x3e8);}const _0x1d2dd5={'attempt_id':_0x32240f['id'],'status':_0x586158,..._0x32240f[_0x1ad952(0x1c4)]!==undefined&&{'index':_0x32240f[_0x1ad952(0x1c4)]},..._0x32240f[_0x1ad952(0x17d)]&&{'project':_0x32240f[_0x1ad952(0x17d)][_0x1ad952(0x1d5)]},..._0x32240f[_0x1ad952(0x16e)]&&{'workflow':_0x32240f[_0x1ad952(0x16e)]['name']},..._0x32240f['sessionId']&&{'session_id':_0x32240f[_0x1ad952(0x177)]},..._0x32240f[_0x1ad952(0x185)]&&{'session_time':_0x32240f[_0x1ad952(0x185)]},..._0x32240f['retryAttemptName']&&{'retry_attempt':_0x32240f[_0x1ad952(0x17e)]},..._0x2dd59a!==undefined&&{'duration_sec':_0x2dd59a},..._0x32240f[_0x1ad952(0x18d)]&&{'created_at':_0x32240f[_0x1ad952(0x18d)]},..._0x32240f[_0x1ad952(0x151)]&&{'finished_at':_0x32240f[_0x1ad952(0x151)]},...Object[_0x1ad952(0x15a)](_0x32240f[_0x1ad952(0x15e)])[_0x1ad952(0x172)]>0x0&&{'params':_0x32240f['params']}};return await handleSingleObjectOutput(_0x1d2dd5,_0x33e1fa),0x0;}catch(_0x46b175){if(_0x46b175 instanceof SDKError)return console['error'](_0x1ad952(0x1f3)+_0x46b175[_0x1ad952(0x189)]),_0x46b175[_0x1ad952(0x1b3)]&&console[_0x1ad952(0x1c2)](_0x1ad952(0x18e)+_0x46b175[_0x1ad952(0x1b3)]),0x1;throw _0x46b175;}}}export class WorkflowTasksCommand extends BaseCommand{[a39_0x538516(0x1d5)]=a39_0x538516(0x187);[a39_0x538516(0x1c6)]=a39_0x538516(0x1a6);async[a39_0x538516(0x1a5)](_0x5abca8){const _0x135a4d=a39_0x538516,{options:_0x1c9796,args:_0x53141c,tdx:_0x32c7d5}=_0x5abca8,_0x272898=_0x53141c[0x0];if(!_0x272898)return console[_0x135a4d(0x1c2)](_0x135a4d(0x160)),0x1;try{const _0x403903=_0x1c9796[_0x135a4d(0x16b)];_0x1c9796[_0x135a4d(0x1e9)]&&(console['error'](_0x135a4d(0x1b2)+_0x272898),_0x403903&&console[_0x135a4d(0x1c2)](_0x135a4d(0x191)));const _0x3149b1=await withSpinner(_0x135a4d(0x1c1),()=>_0x32c7d5['workflow'][_0x135a4d(0x1dc)](_0x272898,_0x403903||![]),{'verbose':_0x1c9796[_0x135a4d(0x1e9)]}),_0x290714=_0x3149b1[_0x135a4d(0x1a7)];return console[_0x135a4d(0x1c2)](_0x135a4d(0x1bd)+_0x290714[_0x135a4d(0x172)]+'\x20task'+(_0x290714[_0x135a4d(0x172)]!==0x1?'s':'')),await handleSDKOutput(_0x290714,_0x1c9796),0x0;}catch(_0x381827){if(_0x381827 instanceof SDKError)return console[_0x135a4d(0x1c2)](_0x135a4d(0x1f3)+_0x381827['message']),_0x381827[_0x135a4d(0x1b3)]&&console[_0x135a4d(0x1c2)]('\x20\x20Cause:\x20'+_0x381827[_0x135a4d(0x1b3)]),0x1;throw _0x381827;}}}export class WorkflowLogsCommand extends BaseCommand{[a39_0x538516(0x1d5)]=a39_0x538516(0x1a9);[a39_0x538516(0x1c6)]=a39_0x538516(0x183);async[a39_0x538516(0x1a5)](_0x147d72){const _0x533273=a39_0x538516,{options:_0x195adf,args:_0x3d0782,tdx:_0x478a98}=_0x147d72,_0xc6a36e=_0x3d0782[0x0];let _0x4a2679=_0x3d0782[0x1];if(!_0xc6a36e)return console[_0x533273(0x1c2)](_0x533273(0x160)),0x1;try{_0x195adf[_0x533273(0x1e9)]&&(console[_0x533273(0x1c2)](_0x533273(0x1b2)+_0xc6a36e),_0x4a2679&&console[_0x533273(0x1c2)](_0x533273(0x1e2)+_0x4a2679));const _0xb011fc=await withSpinner(_0x533273(0x15b),()=>_0x478a98[_0x533273(0x16e)][_0x533273(0x19d)](_0xc6a36e,_0x4a2679),{'verbose':_0x195adf[_0x533273(0x1e9)]}),_0x1fa1e5=_0xb011fc[_0x533273(0x1a7)];if(_0x1fa1e5[_0x533273(0x172)]===0x0)return console[_0x533273(0x1c2)](_0x533273(0x16c)),0x0;if(!_0x4a2679&&(_0x195adf[_0x533273(0x1da)]||_0x195adf[_0x533273(0x165)]))return await handleSDKOutput(_0x1fa1e5,_0x195adf),0x0;if(!_0x4a2679){const _0x29ea35=_0x1fa1e5['map'](_0x594603=>({'title':_0x594603['taskName']+'\x20('+formatBytes(_0x594603[_0x533273(0x1d7)])+')','value':_0x594603[_0x533273(0x1ca)]})),_0xbf106c=await a39_0x25e3c6({'type':_0x533273(0x1d8),'name':_0x533273(0x1b6),'message':'Select\x20a\x20task\x20to\x20view\x20logs:','choices':_0x29ea35});if(!_0xbf106c[_0x533273(0x1b6)])return console[_0x533273(0x1c2)](_0x533273(0x1e1)),0x0;_0x4a2679=_0xbf106c['task'];}const _0x43bc31=await withSpinner('Downloading\x20logs...',()=>_0x478a98['workflow'][_0x533273(0x1d6)](_0xc6a36e,_0x4a2679),{'verbose':_0x195adf[_0x533273(0x1e9)]}),_0x4e90e7=_0x43bc31[_0x533273(0x1a7)];return _0x4e90e7?console['log'](_0x4e90e7):console[_0x533273(0x1c2)]('No\x20log\x20content\x20found'),0x0;}catch(_0x1523b5){if(_0x1523b5 instanceof SDKError)return console[_0x533273(0x1c2)]('Error:\x20'+_0x1523b5[_0x533273(0x189)]),_0x1523b5[_0x533273(0x1b3)]&&console['error']('\x20\x20Cause:\x20'+_0x1523b5[_0x533273(0x1b3)]),0x1;throw _0x1523b5;}}}export class WorkflowKillCommand extends BaseCommand{['name']=a39_0x538516(0x163);['description']=a39_0x538516(0x1b1);async[a39_0x538516(0x1a5)](_0x182956){const _0x14db4d=a39_0x538516,{options:_0x4d7aee,args:_0xcae1b4,tdx:_0x2475af}=_0x182956,_0x55ada8=_0xcae1b4[0x0];if(!_0x55ada8)return console[_0x14db4d(0x1c2)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x41bfe2=_0x4d7aee['reason'];_0x4d7aee[_0x14db4d(0x1e9)]&&(console[_0x14db4d(0x1c2)](_0x14db4d(0x1b2)+_0x55ada8),_0x41bfe2&&console[_0x14db4d(0x1c2)]('Reason:\x20'+_0x41bfe2));if(!_0x4d7aee[_0x14db4d(0x1e4)]){const _0xed0dd6=await confirm(_0x14db4d(0x1f2)+_0x55ada8+'?');if(!_0xed0dd6)return console[_0x14db4d(0x1c2)]('Cancelled'),0x0;}const _0x6a7a7f=await withSpinner(_0x14db4d(0x19a),()=>_0x2475af[_0x14db4d(0x16e)][_0x14db4d(0x15d)](_0x55ada8,_0x41bfe2),{'verbose':_0x4d7aee['verbose']}),_0x283835=_0x6a7a7f[_0x14db4d(0x1a7)];return console[_0x14db4d(0x1c2)]('✔\x20'+_0x283835),0x0;}catch(_0x42531d){if(_0x42531d instanceof SDKError)return console[_0x14db4d(0x1c2)]('Error:\x20'+_0x42531d[_0x14db4d(0x189)]),_0x42531d[_0x14db4d(0x1b3)]&&console['error'](_0x14db4d(0x18e)+_0x42531d[_0x14db4d(0x1b3)]),0x1;throw _0x42531d;}}}export class WorkflowRetryCommand extends BaseCommand{['name']='workflow:retry';[a39_0x538516(0x1c6)]=a39_0x538516(0x159);async[a39_0x538516(0x1a5)](_0x4a02ad){const _0xd164e3=a39_0x538516,{options:_0x2acc5b,args:_0x5dfe03,tdx:_0x256fec}=_0x4a02ad,_0x3bb55a=_0x5dfe03[0x0];if(!_0x3bb55a)return console[_0xd164e3(0x1c2)](_0xd164e3(0x1ec)),console[_0xd164e3(0x1c2)](_0xd164e3(0x1a8)),0x1;let _0x1ca7ce=![],_0x3fc516=_0x3bb55a;if(_0x3bb55a[_0xd164e3(0x19b)](_0xd164e3(0x15c)))_0x1ca7ce=!![],_0x3fc516=_0x3bb55a['substring'](0x8);else{if(_0x3bb55a[_0xd164e3(0x19b)]('attempt:'))_0x1ca7ce=![],_0x3fc516=_0x3bb55a[_0xd164e3(0x199)](0x8);else return console['error'](_0xd164e3(0x1ee)),console[_0xd164e3(0x1c2)](_0xd164e3(0x1a8)),0x1;}try{const _0x18d762=_0x2acc5b[_0xd164e3(0x19f)],_0x2f6020=_0x2acc5b[_0xd164e3(0x188)],_0x417393=_0x2acc5b[_0xd164e3(0x15e)],_0x39dae5=_0x2acc5b[_0xd164e3(0x1b5)];_0x2acc5b[_0xd164e3(0x1e9)]&&(console[_0xd164e3(0x1c2)](_0xd164e3(0x1bc)+(_0x1ca7ce?_0xd164e3(0x1cf):_0xd164e3(0x1e3))+'\x20'+_0x3fc516),_0x18d762&&console[_0xd164e3(0x1c2)]('From\x20task:\x20'+_0x18d762),_0x2f6020&&console[_0xd164e3(0x1c2)](_0xd164e3(0x18b)+_0x2f6020),_0x417393&&console[_0xd164e3(0x1c2)](_0xd164e3(0x1e8)+_0x417393),_0x39dae5&&console[_0xd164e3(0x1c2)](_0xd164e3(0x1cb)));let _0x208fbd;if(_0x417393)try{if(_0x417393[_0xd164e3(0x19b)]('@')){const _0x5e38b2=await import(_0xd164e3(0x1c5)),_0x541296=_0x417393[_0xd164e3(0x199)](0x1),_0x3b5aa7=await _0x5e38b2[_0xd164e3(0x1e5)](_0x541296,_0xd164e3(0x152));_0x208fbd=JSON[_0xd164e3(0x1c9)](_0x3b5aa7);}else _0x208fbd=JSON[_0xd164e3(0x1c9)](_0x417393);}catch{return console[_0xd164e3(0x1c2)](_0xd164e3(0x173)),0x1;}if(!_0x2acc5b[_0xd164e3(0x1e4)]){const _0x4a0a9a=await confirm(_0xd164e3(0x15f)+(_0x1ca7ce?'session':'attempt')+'\x20'+_0x3fc516+'?');if(!_0x4a0a9a)return console[_0xd164e3(0x1c2)](_0xd164e3(0x1e1)),0x0;}let _0x43d683;_0x1ca7ce?_0x43d683=await withSpinner(_0xd164e3(0x1aa),()=>_0x256fec[_0xd164e3(0x16e)][_0xd164e3(0x192)](_0x3fc516,{'fromTask':_0x18d762,'retryParams':_0x208fbd}),{'verbose':_0x2acc5b[_0xd164e3(0x1e9)]}):_0x43d683=await withSpinner('Retrying\x20attempt...',()=>_0x256fec[_0xd164e3(0x16e)]['retryAttempt'](_0x3fc516,{'resumeFrom':_0x2f6020,'retryParams':_0x208fbd,'force':_0x39dae5}),{'verbose':_0x2acc5b[_0xd164e3(0x1e9)]});const _0x4bc95d=_0x43d683[_0xd164e3(0x1a7)];return console[_0xd164e3(0x1c2)](_0xd164e3(0x1eb)),console[_0xd164e3(0x1c2)](_0xd164e3(0x178)+_0x4bc95d[_0xd164e3(0x1d9)]),console[_0xd164e3(0x1c2)]('\x20\x20Session\x20ID:\x20'+_0x4bc95d['sessionId']),0x0;}catch(_0x1411c8){if(_0x1411c8 instanceof SDKError)return console[_0xd164e3(0x1c2)](_0xd164e3(0x1f3)+_0x1411c8['message']),_0x1411c8[_0xd164e3(0x1b3)]&&console[_0xd164e3(0x1c2)]('\x20\x20Cause:\x20'+_0x1411c8[_0xd164e3(0x1b3)]),0x1;throw _0x1411c8;}}}export class WorkflowRunCommand extends BaseCommand{['name']=a39_0x538516(0x1b4);[a39_0x538516(0x1c6)]=a39_0x538516(0x175);async[a39_0x538516(0x1a5)](_0x4f31cb){const _0x5f046b=a39_0x538516,{options:_0x4c1fb1,args:_0x3cbe3c,tdx:_0x58ad47}=_0x4f31cb,_0x4ff70e=_0x3cbe3c[0x0];if(!_0x4ff70e)return console[_0x5f046b(0x1c2)](_0x5f046b(0x150)),console[_0x5f046b(0x1c2)]('Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]'),0x1;const _0x5b253=_0x4c1fb1[_0x5f046b(0x186)],_0x44bbfe=_0x4c1fb1[_0x5f046b(0x185)],_0x2c9bf3={};if(_0x5b253&&Array[_0x5f046b(0x1a1)](_0x5b253))for(const _0x386d35 of _0x5b253){const _0x508079=_0x386d35[_0x5f046b(0x168)]('=');if(_0x508079===-0x1)return console['error'](_0x5f046b(0x156)+_0x386d35),console['error'](_0x5f046b(0x16d)),0x1;const _0x209b48=_0x386d35[_0x5f046b(0x199)](0x0,_0x508079),_0x498664=_0x386d35[_0x5f046b(0x199)](_0x508079+0x1);try{_0x2c9bf3[_0x209b48]=JSON['parse'](_0x498664);}catch{_0x2c9bf3[_0x209b48]=_0x498664;}}_0x4c1fb1['verbose']&&(console[_0x5f046b(0x1c2)]('Workflow:\x20'+_0x4ff70e),Object['keys'](_0x2c9bf3)[_0x5f046b(0x172)]>0x0&&console[_0x5f046b(0x1c2)](_0x5f046b(0x1bb)+JSON[_0x5f046b(0x18c)](_0x2c9bf3)),_0x44bbfe&&console[_0x5f046b(0x1c2)](_0x5f046b(0x16a)+_0x44bbfe));const _0x33de97=await withSpinner(_0x5f046b(0x1ea),()=>_0x58ad47[_0x5f046b(0x16e)][_0x5f046b(0x1b0)](_0x4ff70e,_0x2c9bf3,{'sessionTime':_0x44bbfe}),{'verbose':_0x4c1fb1['verbose']}),_0x137259=_0x33de97['data'];return console[_0x5f046b(0x1c2)]('✔\x20Workflow\x20run\x20started'),console[_0x5f046b(0x1c2)]('\x20\x20Attempt\x20ID:\x20'+_0x137259['id']),console['error'](_0x5f046b(0x164)+_0x137259['sessionId']),console[_0x5f046b(0x1c2)]('\x20\x20Project:\x20'+_0x137259[_0x5f046b(0x17d)]?.[_0x5f046b(0x1d5)]),console[_0x5f046b(0x1c2)]('\x20\x20Workflow:\x20'+_0x137259['workflow']?.[_0x5f046b(0x1d5)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a39_0x538516(0x1d5)]=a39_0x538516(0x1ab);['description']='Download\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a39_0x538516(0x1a5)](_0x40dddb){const _0x24595c=a39_0x538516,{options:_0x161cee,args:_0x3d0e83,tdx:_0x200736}=_0x40dddb,_0xe1935c=_0x3d0e83[0x0],_0x15ae94=_0x3d0e83[0x1]||'.';if(!_0xe1935c)return console['error']('Error:\x20Project\x20name\x20is\x20required'),console['error'](_0x24595c(0x198)),0x1;const _0x38e468=_0x161cee[_0x24595c(0x1dd)];_0x161cee[_0x24595c(0x1e9)]&&(console[_0x24595c(0x1c2)]('Project:\x20'+_0xe1935c),console[_0x24595c(0x1c2)](_0x24595c(0x181)+_0x15ae94),_0x38e468&&console[_0x24595c(0x1c2)](_0x24595c(0x174)+_0x38e468));const _0x4a1879=await withSpinner(_0x24595c(0x14f)+_0xe1935c+_0x24595c(0x169),()=>_0x200736[_0x24595c(0x16e)][_0x24595c(0x1be)](_0xe1935c,_0x15ae94,{'revision':_0x38e468}),{'verbose':_0x161cee[_0x24595c(0x1e9)]}),_0x472c48=_0x4a1879[_0x24595c(0x1a7)];return console[_0x24595c(0x1c2)]('✔\x20Downloaded\x20'+_0x472c48[_0x24595c(0x17f)]),console[_0x24595c(0x1c2)](_0x24595c(0x1d2)+_0x472c48[_0x24595c(0x1dd)]),console[_0x24595c(0x1c2)](_0x24595c(0x1c7)+_0x472c48[_0x24595c(0x194)]),console[_0x24595c(0x1c2)](_0x24595c(0x1b7)+_0x15ae94+'/'+_0x472c48[_0x24595c(0x17f)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a39_0x538516(0x1d5)]=a39_0x538516(0x1df);[a39_0x538516(0x1c6)]='Push\x20workflow\x20project\x20to\x20Treasure\x20Data';async[a39_0x538516(0x1a5)](_0x41615f){const _0x2952ef=a39_0x538516,{options:_0x1452e2,args:_0x1ce44f,tdx:_0x3778ee}=_0x41615f;let _0x3ac488='.',_0x48da12=_0x1452e2['name'];if(_0x1ce44f[0x0]){const {promises:_0x86ca03}=await import('fs');try{const _0x98919b=await _0x86ca03[_0x2952ef(0x1d1)](_0x1ce44f[0x0]);if(_0x98919b[_0x2952ef(0x1d0)]())_0x3ac488=_0x1ce44f[0x0];else return console[_0x2952ef(0x1c2)]('Error:\x20'+_0x1ce44f[0x0]+_0x2952ef(0x1c3)),0x1;}catch{_0x48da12=_0x1ce44f[0x0],_0x3ac488='.';}}const _0x4b9f51=_0x1452e2['revision'],_0x333a97=_0x1452e2[_0x2952ef(0x1ba)];_0x1452e2[_0x2952ef(0x1e9)]&&(console[_0x2952ef(0x1c2)](_0x2952ef(0x182)+_0x3ac488),_0x48da12&&console[_0x2952ef(0x1c2)](_0x2952ef(0x193)+_0x48da12),_0x4b9f51&&console['error'](_0x2952ef(0x174)+_0x4b9f51),_0x333a97&&console[_0x2952ef(0x1c2)]('Validation:\x20skipped'));const _0xd2c8c7=await withSpinner(_0x2952ef(0x197),()=>_0x3778ee[_0x2952ef(0x16e)][_0x2952ef(0x171)](_0x3ac488,{'projectName':_0x48da12,'revision':_0x4b9f51,'skipValidation':_0x333a97}),{'verbose':_0x1452e2[_0x2952ef(0x1e9)]}),_0x141ee6=_0xd2c8c7[_0x2952ef(0x1a7)];return console[_0x2952ef(0x1c2)]('✔\x20Pushed\x20'+_0x141ee6['projectName']),console['error'](_0x2952ef(0x1ac)+_0x141ee6[_0x2952ef(0x1bf)]),console['error']('\x20\x20Revision:\x20'+_0x141ee6[_0x2952ef(0x1dd)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{['name']=a39_0x538516(0x17a);['description']='Delete\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a39_0x538516(0x1a5)](_0x5747a1){const _0x527ce3=a39_0x538516,{options:_0x563b16,args:_0x213a1b,tdx:_0x48ad9f}=_0x5747a1,_0xccb6ad=_0x213a1b[0x0];if(!_0xccb6ad)return console['error']('Error:\x20Project\x20name\x20or\x20ID\x20is\x20required'),console[_0x527ce3(0x1c2)](_0x527ce3(0x157)),0x1;_0x563b16[_0x527ce3(0x1e9)]&&console['error'](_0x527ce3(0x1e7)+_0xccb6ad);if(!_0x563b16['yes']){const _0x422cae=await confirm(_0x527ce3(0x158)+_0xccb6ad+_0x527ce3(0x17c));if(!_0x422cae)return console['error']('Cancelled'),0x0;}const _0x400552=await withSpinner(_0x527ce3(0x1db)+_0xccb6ad+'...',()=>_0x48ad9f['workflow'][_0x527ce3(0x196)](_0xccb6ad),{'verbose':_0x563b16['verbose']}),_0x2d8803=_0x400552[_0x527ce3(0x1a7)];return console[_0x527ce3(0x1c2)](_0x527ce3(0x1cc)+_0x2d8803[_0x527ce3(0x17f)]),console[_0x527ce3(0x1c2)](_0x527ce3(0x1ac)+_0x2d8803[_0x527ce3(0x1bf)]),0x0;}}
1
+ const a39_0x495444=a39_0x19fb;function a39_0x1e3f(){const _0x1f127a=['List\x20workflows','done','cause','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','delete','isDirectory','Retry\x20a\x20session\x20or\x20attempt','Resume\x20from:\x20','workflow:retry','Error:\x20Attempt\x20ID\x20is\x20required','6810Pntacd','Project\x20filter:\x20','Error:\x20','\x20\x20Attempt\x20ID:\x20','\x20\x20Location:\x20','session:','fileSize','from','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','Show\x20specific\x20attempt\x20details','\x20\x20Project\x20ID:\x20','\x22?\x20This\x20cannot\x20be\x20undone.','success','error','keys','Status:\x20','tasks','Error:\x20Invalid\x20JSON\x20in\x20--params','\x20\x20Cause:\x20','includeSubtasks','Project\x20directory:\x20','Select\x20a\x20task\x20to\x20view\x20logs:','12035647FqQjgF','295FwGXxC','\x20attempt','split','workflow','format','attemptId','12FMINEs','\x20\x20Project:\x20','param','force','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','workflow:push','fs/promises','Starting\x20workflow\x20run...','Revision:\x20','logFiles','✔\x20Found\x20','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','Validation:\x20skipped','320698sRNamn','\x20session','select','limit','stat','round','status','length','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Listing\x20workflows...','3022632MPdWak','1870wSYoBU','From\x20task:\x20','workflow:attempt','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','...','params','Listing\x20workflow\x20attempts...','Retrying\x20attempt...','Fetching\x20log\x20files...','Start\x20a\x20workflow\x20run','\x20\x20Revision:\x20','data','\x20\x20Files\x20extracted:\x20','Params:\x20','projects','List\x20workflow\x20attempts','List\x20all\x20workflow\x20projects','workflow:run','createdAt','session','Parameters:\x20','attempt','canceling','yes','✔\x20Deleted\x20project\x20','indexOf','download','sessionTime','execute','finishedAt','Reason:\x20','No\x20log\x20content\x20found','Target:\x20','Filter:\x20','6960384PlrFEf','\x20is\x20not\x20a\x20directory','filesExtracted','workflow:logs','No\x20log\x20files\x20found\x20for\x20this\x20attempt','Downloading\x20logs...','retryAttemptName','description','index','Force:\x20yes','Workflow:\x20','Pattern:\x20','Getting\x20attempt\x20tasks...','18AKGUNT','\x20task','Killing\x20attempt...','Including\x20subtasks:\x20yes','List\x20workflow\x20execution\x20sessions','Kill\x20a\x20running\x20attempt','verbose','Filter:\x20project=','✔\x20Pushed\x20','\x20workflow','Downloading\x20project\x20','\x20\x20Session\x20ID:\x20','Cancelled','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','attempt:','Show\x20tasks\x20for\x20an\x20attempt','attempts','workflow:kill','isArray','workflow:download','Usage:\x20workflow:delete\x20<project-name-or-id>','kill','taskName','projectName','Pushing\x20workflow\x20project...','✔\x20Retry\x20started','push','getTime','Task\x20name:\x20','14YCvFrJ','Project:\x20','task','5870XBFGqI','2SXwWKT','Error:\x20Invalid\x20parameter\x20format:\x20','workflow:attempts','startsWith','includeRetried','substring','Attempt\x20ID:\x20','Output\x20directory:\x20','sessionId','157900UwfcSX','name','logs','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','sessions','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','revision','message','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','project','retryAttempt','Deleting\x20project\x20','workflow:projects','cancelRequested','json','retrySession','map','workflow:sessions','\x20\x20Workflow:\x20','Include\x20retried:\x20yes','parse','\x20\x20New\x20attempt\x20ID:\x20','skipValidation','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]'];a39_0x1e3f=function(){return _0x1f127a;};return a39_0x1e3f();}(function(_0x55893f,_0x15f270){const _0x44af56=a39_0x19fb,_0x19989a=_0x55893f();while(!![]){try{const _0x2ced2f=-parseInt(_0x44af56(0x1a4))/0x1*(-parseInt(_0x44af56(0x14f))/0x2)+-parseInt(_0x44af56(0x12e))/0x3*(parseInt(_0x44af56(0x158))/0x4)+-parseInt(_0x44af56(0x191))/0x5*(parseInt(_0x44af56(0x17a))/0x6)+parseInt(_0x44af56(0x14b))/0x7*(parseInt(_0x44af56(0x1ae))/0x8)+parseInt(_0x44af56(0x121))/0x9+parseInt(_0x44af56(0x14e))/0xa*(parseInt(_0x44af56(0x1af))/0xb)+parseInt(_0x44af56(0x197))/0xc*(-parseInt(_0x44af56(0x190))/0xd);if(_0x2ced2f===_0x15f270)break;else _0x19989a['push'](_0x19989a['shift']());}catch(_0x2e8032){_0x19989a['push'](_0x19989a['shift']());}}}(a39_0x1e3f,0xafc10));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';function a39_0x19fb(_0x2130b4,_0x2f832){const _0x1e3ff1=a39_0x1e3f();return a39_0x19fb=function(_0x19fb4d,_0x964387){_0x19fb4d=_0x19fb4d-0x106;let _0x28c373=_0x1e3ff1[_0x19fb4d];return _0x28c373;},a39_0x19fb(_0x2130b4,_0x2f832);}import a39_0x48f917 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{['name']=a39_0x495444(0x164);[a39_0x495444(0x128)]=a39_0x495444(0x10f);async[a39_0x495444(0x11b)](_0x4334d3){const _0x2ae912=a39_0x495444,{options:_0xa627ae,args:_0x5df83e,tdx:_0x2a07b9}=_0x4334d3,_0x4f3b6e=_0x5df83e[0x0];try{_0xa627ae[_0x2ae912(0x134)]&&_0x4f3b6e&&console[_0x2ae912(0x187)](_0x2ae912(0x12c)+_0x4f3b6e);const _0xc4e210=await withSpinner('Listing\x20workflow\x20projects...',()=>_0x2a07b9[_0x2ae912(0x194)][_0x2ae912(0x10d)](_0x4f3b6e,{'limit':_0xa627ae[_0x2ae912(0x1a7)]}),{'verbose':_0xa627ae[_0x2ae912(0x134)]}),_0x2cb39a=_0xc4e210[_0x2ae912(0x10a)];return console[_0x2ae912(0x187)](_0x2ae912(0x1a1)+_0x2cb39a['length']+'\x20project'+(_0x2cb39a['length']!==0x1?'s':'')),await handleSDKOutput(_0x2cb39a,_0xa627ae),0x0;}catch(_0x5a9846){if(_0x5a9846 instanceof SDKError)return console[_0x2ae912(0x187)](_0x2ae912(0x17c)+_0x5a9846[_0x2ae912(0x15f)]),_0x5a9846['cause']&&console[_0x2ae912(0x187)](_0x2ae912(0x18c)+_0x5a9846[_0x2ae912(0x172)]),0x1;throw _0x5a9846;}}}export class WorkflowWorkflowsCommand extends BaseCommand{['name']='workflow:workflows';[a39_0x495444(0x128)]=a39_0x495444(0x170);async[a39_0x495444(0x11b)](_0x570fb0){const _0x36eb8a=a39_0x495444,{options:_0x411b2f,args:_0x14be65,tdx:_0x21dd43}=_0x570fb0,_0x16e23e=_0x14be65[0x0];try{_0x411b2f[_0x36eb8a(0x134)]&&_0x16e23e&&console[_0x36eb8a(0x187)](_0x36eb8a(0x17b)+_0x16e23e);const _0x312c1a=await withSpinner(_0x36eb8a(0x1ad),()=>_0x21dd43['workflow']['workflows'](_0x16e23e,{'limit':_0x411b2f[_0x36eb8a(0x1a7)]}),{'verbose':_0x411b2f[_0x36eb8a(0x134)]}),_0x466f66=_0x312c1a[_0x36eb8a(0x10a)];return console[_0x36eb8a(0x187)](_0x36eb8a(0x1a1)+_0x466f66[_0x36eb8a(0x1ab)]+_0x36eb8a(0x137)+(_0x466f66[_0x36eb8a(0x1ab)]!==0x1?'s':'')),await handleSDKOutput(_0x466f66,_0x411b2f),0x0;}catch(_0x488026){if(_0x488026 instanceof SDKError)return console['error'](_0x36eb8a(0x17c)+_0x488026['message']),_0x488026['cause']&&console[_0x36eb8a(0x187)](_0x36eb8a(0x18c)+_0x488026[_0x36eb8a(0x172)]),0x1;throw _0x488026;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']=a39_0x495444(0x169);[a39_0x495444(0x128)]=a39_0x495444(0x132);async['execute'](_0x3abce5){const _0x53cb17=a39_0x495444,{options:_0x4856e2,args:_0x224ddb,tdx:_0x48e1ce}=_0x3abce5;let _0xae9683,_0x16c0dd;if(_0x224ddb[0x0]){const _0x586a15=_0x224ddb[0x0]['split']('.');if(_0x586a15[_0x53cb17(0x1ab)]===0x1)_0xae9683=_0x586a15[0x0];else{if(_0x586a15['length']===0x2)[_0xae9683,_0x16c0dd]=_0x586a15;else return console[_0x53cb17(0x187)](_0x53cb17(0x19b)),0x1;}}try{if(_0x4856e2[_0x53cb17(0x134)]){if(_0xae9683&&_0x16c0dd)console[_0x53cb17(0x187)](_0x53cb17(0x120)+_0xae9683+'.'+_0x16c0dd);else _0xae9683&&console[_0x53cb17(0x187)](_0x53cb17(0x135)+_0xae9683);const _0x473008=_0x4856e2['status'];_0x473008&&console[_0x53cb17(0x187)](_0x53cb17(0x189)+_0x473008);}const _0x2ca966=await withSpinner('Listing\x20workflow\x20sessions...',()=>_0x48e1ce['workflow'][_0x53cb17(0x15c)]({'projectName':_0xae9683,'workflowName':_0x16c0dd,'status':_0x4856e2[_0x53cb17(0x1aa)],'fromTime':_0x4856e2[_0x53cb17(0x181)],'toTime':_0x4856e2['to'],'limit':_0x4856e2['limit']}),{'verbose':_0x4856e2['verbose']}),_0x20db0b=_0x2ca966[_0x53cb17(0x10a)];return console[_0x53cb17(0x187)](_0x53cb17(0x1a1)+_0x20db0b[_0x53cb17(0x1ab)]+_0x53cb17(0x1a5)+(_0x20db0b[_0x53cb17(0x1ab)]!==0x1?'s':'')),await handleSDKOutput(_0x20db0b,_0x4856e2),0x0;}catch(_0x514111){if(_0x514111 instanceof SDKError)return console[_0x53cb17(0x187)](_0x53cb17(0x17c)+_0x514111['message']),_0x514111['cause']&&console[_0x53cb17(0x187)](_0x53cb17(0x18c)+_0x514111[_0x53cb17(0x172)]),0x1;throw _0x514111;}}}export class WorkflowAttemptsCommand extends BaseCommand{['name']=a39_0x495444(0x151);['description']=a39_0x495444(0x10e);async[a39_0x495444(0x11b)](_0xaaa802){const _0x5a2fa1=a39_0x495444,{options:_0x3bc8be,args:_0x4d2d8c,tdx:_0xc9ee8}=_0xaaa802;let _0x2d58d0,_0x705b3e;if(_0x4d2d8c[0x0]){const _0x5e9322=_0x4d2d8c[0x0][_0x5a2fa1(0x193)]('.');if(_0x5e9322[_0x5a2fa1(0x1ab)]===0x1)_0x2d58d0=_0x5e9322[0x0];else{if(_0x5e9322['length']===0x2)[_0x2d58d0,_0x705b3e]=_0x5e9322;else return console['error'](_0x5a2fa1(0x19b)),0x1;}}try{const _0x39213=_0x3bc8be[_0x5a2fa1(0x153)];if(_0x3bc8be['verbose']){if(_0x2d58d0&&_0x705b3e)console[_0x5a2fa1(0x187)](_0x5a2fa1(0x120)+_0x2d58d0+'.'+_0x705b3e);else _0x2d58d0&&console[_0x5a2fa1(0x187)](_0x5a2fa1(0x135)+_0x2d58d0);_0x39213&&console['error'](_0x5a2fa1(0x16b));}const _0x3f86b9=await withSpinner(_0x5a2fa1(0x1b5),()=>_0xc9ee8[_0x5a2fa1(0x194)][_0x5a2fa1(0x13e)]({'projectName':_0x2d58d0,'workflowName':_0x705b3e,'includeRetried':_0x39213,'limit':_0x3bc8be[_0x5a2fa1(0x1a7)]}),{'verbose':_0x3bc8be[_0x5a2fa1(0x134)]}),_0xa9155=_0x3f86b9[_0x5a2fa1(0x10a)];return console[_0x5a2fa1(0x187)]('✔\x20Found\x20'+_0xa9155[_0x5a2fa1(0x1ab)]+_0x5a2fa1(0x192)+(_0xa9155[_0x5a2fa1(0x1ab)]!==0x1?'s':'')),await handleSDKOutput(_0xa9155,_0x3bc8be),0x0;}catch(_0x3e138e){if(_0x3e138e instanceof SDKError)return console[_0x5a2fa1(0x187)](_0x5a2fa1(0x17c)+_0x3e138e[_0x5a2fa1(0x15f)]),_0x3e138e[_0x5a2fa1(0x172)]&&console[_0x5a2fa1(0x187)](_0x5a2fa1(0x18c)+_0x3e138e[_0x5a2fa1(0x172)]),0x1;throw _0x3e138e;}}}export class WorkflowAttemptCommand extends BaseCommand{[a39_0x495444(0x159)]=a39_0x495444(0x1b1);[a39_0x495444(0x128)]=a39_0x495444(0x183);async[a39_0x495444(0x11b)](_0x247a79){const _0x3de7d4=a39_0x495444,{options:_0x42042d,args:_0x4b81c1,tdx:_0x51c19e}=_0x247a79,_0x3c9064=_0x4b81c1[0x0];if(!_0x3c9064)return console[_0x3de7d4(0x187)](_0x3de7d4(0x179)),0x1;try{_0x42042d[_0x3de7d4(0x134)]&&console[_0x3de7d4(0x187)]('Attempt\x20ID:\x20'+_0x3c9064);const _0x557778=await withSpinner('Getting\x20attempt\x20details...',()=>_0x51c19e['workflow'][_0x3de7d4(0x114)](_0x3c9064),{'verbose':_0x42042d[_0x3de7d4(0x134)]}),_0x4b6497=_0x557778['data'];let _0x30d747;!_0x4b6497[_0x3de7d4(0x171)]?_0x30d747=_0x4b6497[_0x3de7d4(0x165)]?_0x3de7d4(0x115):'running':_0x30d747=_0x4b6497[_0x3de7d4(0x186)]?_0x3de7d4(0x186):_0x3de7d4(0x187);let _0xeda6e6;if(_0x4b6497['createdAt']&&_0x4b6497['finishedAt']){const _0x4f15de=new Date(_0x4b6497[_0x3de7d4(0x111)])['getTime'](),_0x3eb38c=new Date(_0x4b6497[_0x3de7d4(0x11c)])[_0x3de7d4(0x149)]();_0xeda6e6=Math[_0x3de7d4(0x1a9)]((_0x3eb38c-_0x4f15de)/0x3e8);}const _0x2e5eff={'attempt_id':_0x4b6497['id'],'status':_0x30d747,..._0x4b6497[_0x3de7d4(0x129)]!==undefined&&{'index':_0x4b6497[_0x3de7d4(0x129)]},..._0x4b6497[_0x3de7d4(0x161)]&&{'project':_0x4b6497['project'][_0x3de7d4(0x159)]},..._0x4b6497[_0x3de7d4(0x194)]&&{'workflow':_0x4b6497[_0x3de7d4(0x194)][_0x3de7d4(0x159)]},..._0x4b6497['sessionId']&&{'session_id':_0x4b6497[_0x3de7d4(0x157)]},..._0x4b6497[_0x3de7d4(0x11a)]&&{'session_time':_0x4b6497[_0x3de7d4(0x11a)]},..._0x4b6497[_0x3de7d4(0x127)]&&{'retry_attempt':_0x4b6497[_0x3de7d4(0x127)]},..._0xeda6e6!==undefined&&{'duration_sec':_0xeda6e6},..._0x4b6497['createdAt']&&{'created_at':_0x4b6497['createdAt']},..._0x4b6497[_0x3de7d4(0x11c)]&&{'finished_at':_0x4b6497[_0x3de7d4(0x11c)]},...Object['keys'](_0x4b6497[_0x3de7d4(0x1b4)])[_0x3de7d4(0x1ab)]>0x0&&{'params':_0x4b6497[_0x3de7d4(0x1b4)]}};return await handleSingleObjectOutput(_0x2e5eff,_0x42042d),0x0;}catch(_0x30ef18){if(_0x30ef18 instanceof SDKError)return console[_0x3de7d4(0x187)]('Error:\x20'+_0x30ef18[_0x3de7d4(0x15f)]),_0x30ef18[_0x3de7d4(0x172)]&&console[_0x3de7d4(0x187)](_0x3de7d4(0x18c)+_0x30ef18[_0x3de7d4(0x172)]),0x1;throw _0x30ef18;}}}export class WorkflowTasksCommand extends BaseCommand{['name']='workflow:tasks';[a39_0x495444(0x128)]=a39_0x495444(0x13d);async[a39_0x495444(0x11b)](_0x373ca2){const _0x40091d=a39_0x495444,{options:_0x38a65c,args:_0x514865,tdx:_0x571867}=_0x373ca2,_0x25c613=_0x514865[0x0];if(!_0x25c613)return console['error'](_0x40091d(0x179)),0x1;try{const _0x313cd5=_0x38a65c[_0x40091d(0x18d)];_0x38a65c[_0x40091d(0x134)]&&(console[_0x40091d(0x187)](_0x40091d(0x155)+_0x25c613),_0x313cd5&&console['error'](_0x40091d(0x131)));const _0x3da60a=await withSpinner(_0x40091d(0x12d),()=>_0x571867[_0x40091d(0x194)][_0x40091d(0x18a)](_0x25c613,_0x313cd5||![]),{'verbose':_0x38a65c[_0x40091d(0x134)]}),_0x4660a6=_0x3da60a[_0x40091d(0x10a)];return console[_0x40091d(0x187)]('✔\x20Found\x20'+_0x4660a6[_0x40091d(0x1ab)]+_0x40091d(0x12f)+(_0x4660a6[_0x40091d(0x1ab)]!==0x1?'s':'')),await handleSDKOutput(_0x4660a6,_0x38a65c),0x0;}catch(_0x169586){if(_0x169586 instanceof SDKError)return console[_0x40091d(0x187)](_0x40091d(0x17c)+_0x169586['message']),_0x169586[_0x40091d(0x172)]&&console[_0x40091d(0x187)]('\x20\x20Cause:\x20'+_0x169586[_0x40091d(0x172)]),0x1;throw _0x169586;}}}export class WorkflowLogsCommand extends BaseCommand{[a39_0x495444(0x159)]=a39_0x495444(0x124);[a39_0x495444(0x128)]='Show\x20logs\x20for\x20a\x20workflow\x20attempt';async[a39_0x495444(0x11b)](_0x536d79){const _0x1b1692=a39_0x495444,{options:_0x30d966,args:_0xa256ae,tdx:_0x4dcb5b}=_0x536d79,_0x5a620d=_0xa256ae[0x0];let _0x1d5405=_0xa256ae[0x1];if(!_0x5a620d)return console[_0x1b1692(0x187)](_0x1b1692(0x179)),0x1;try{_0x30d966[_0x1b1692(0x134)]&&(console[_0x1b1692(0x187)](_0x1b1692(0x155)+_0x5a620d),_0x1d5405&&console[_0x1b1692(0x187)](_0x1b1692(0x14a)+_0x1d5405));const _0x5605ec=await withSpinner(_0x1b1692(0x107),()=>_0x4dcb5b['workflow'][_0x1b1692(0x1a0)](_0x5a620d,_0x1d5405),{'verbose':_0x30d966[_0x1b1692(0x134)]}),_0x19e187=_0x5605ec['data'];if(_0x19e187[_0x1b1692(0x1ab)]===0x0)return console[_0x1b1692(0x187)](_0x1b1692(0x125)),0x0;if(!_0x1d5405&&(_0x30d966[_0x1b1692(0x166)]||_0x30d966[_0x1b1692(0x195)]))return await handleSDKOutput(_0x19e187,_0x30d966),0x0;if(!_0x1d5405){const _0x1d81c3=_0x19e187[_0x1b1692(0x168)](_0x2ca0c8=>({'title':_0x2ca0c8[_0x1b1692(0x144)]+'\x20('+formatBytes(_0x2ca0c8[_0x1b1692(0x180)])+')','value':_0x2ca0c8[_0x1b1692(0x144)]})),_0x369248=await a39_0x48f917({'type':_0x1b1692(0x1a6),'name':_0x1b1692(0x14d),'message':_0x1b1692(0x18f),'choices':_0x1d81c3});if(!_0x369248['task'])return console[_0x1b1692(0x187)](_0x1b1692(0x13a)),0x0;_0x1d5405=_0x369248[_0x1b1692(0x14d)];}const _0x3d3bef=await withSpinner(_0x1b1692(0x126),()=>_0x4dcb5b[_0x1b1692(0x194)][_0x1b1692(0x15a)](_0x5a620d,_0x1d5405),{'verbose':_0x30d966[_0x1b1692(0x134)]}),_0x3a34cc=_0x3d3bef[_0x1b1692(0x10a)];return _0x3a34cc?console['log'](_0x3a34cc):console['error'](_0x1b1692(0x11e)),0x0;}catch(_0x34220b){if(_0x34220b instanceof SDKError)return console[_0x1b1692(0x187)](_0x1b1692(0x17c)+_0x34220b['message']),_0x34220b[_0x1b1692(0x172)]&&console['error'](_0x1b1692(0x18c)+_0x34220b[_0x1b1692(0x172)]),0x1;throw _0x34220b;}}}export class WorkflowKillCommand extends BaseCommand{[a39_0x495444(0x159)]=a39_0x495444(0x13f);['description']=a39_0x495444(0x133);async[a39_0x495444(0x11b)](_0x5efa1e){const _0x532bc7=a39_0x495444,{options:_0xb956fc,args:_0x350b50,tdx:_0x2f457e}=_0x5efa1e,_0x4814c9=_0x350b50[0x0];if(!_0x4814c9)return console[_0x532bc7(0x187)](_0x532bc7(0x179)),0x1;try{const _0x196a7a=_0xb956fc['reason'];_0xb956fc['verbose']&&(console[_0x532bc7(0x187)](_0x532bc7(0x155)+_0x4814c9),_0x196a7a&&console[_0x532bc7(0x187)](_0x532bc7(0x11d)+_0x196a7a));if(!_0xb956fc[_0x532bc7(0x116)]){const _0x26e06c=await confirm(_0x532bc7(0x173)+_0x4814c9+'?');if(!_0x26e06c)return console['error']('Cancelled'),0x0;}const _0xd59c0c=await withSpinner(_0x532bc7(0x130),()=>_0x2f457e['workflow'][_0x532bc7(0x143)](_0x4814c9,_0x196a7a),{'verbose':_0xb956fc['verbose']}),_0x115b28=_0xd59c0c[_0x532bc7(0x10a)];return console[_0x532bc7(0x187)]('✔\x20'+_0x115b28),0x0;}catch(_0x3b7b2b){if(_0x3b7b2b instanceof SDKError)return console[_0x532bc7(0x187)](_0x532bc7(0x17c)+_0x3b7b2b[_0x532bc7(0x15f)]),_0x3b7b2b[_0x532bc7(0x172)]&&console[_0x532bc7(0x187)]('\x20\x20Cause:\x20'+_0x3b7b2b[_0x532bc7(0x172)]),0x1;throw _0x3b7b2b;}}}export class WorkflowRetryCommand extends BaseCommand{[a39_0x495444(0x159)]=a39_0x495444(0x178);[a39_0x495444(0x128)]=a39_0x495444(0x176);async[a39_0x495444(0x11b)](_0x1e8ca4){const _0x38d13b=a39_0x495444,{options:_0x17c2c0,args:_0x331d2d,tdx:_0x5de683}=_0x1e8ca4,_0x2f03bf=_0x331d2d[0x0];if(!_0x2f03bf)return console[_0x38d13b(0x187)]('Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required'),console[_0x38d13b(0x187)](_0x38d13b(0x1a2)),0x1;let _0x33f8ae=![],_0x2b250c=_0x2f03bf;if(_0x2f03bf['startsWith'](_0x38d13b(0x17f)))_0x33f8ae=!![],_0x2b250c=_0x2f03bf[_0x38d13b(0x154)](0x8);else{if(_0x2f03bf[_0x38d13b(0x152)](_0x38d13b(0x13c)))_0x33f8ae=![],_0x2b250c=_0x2f03bf[_0x38d13b(0x154)](0x8);else return console[_0x38d13b(0x187)](_0x38d13b(0x182)),console['error'](_0x38d13b(0x1a2)),0x1;}try{const _0x140ea2=_0x17c2c0['fromTask'],_0x226090=_0x17c2c0['resumeFrom'],_0x22267e=_0x17c2c0[_0x38d13b(0x1b4)],_0xf37dac=_0x17c2c0[_0x38d13b(0x19a)];_0x17c2c0['verbose']&&(console['error'](_0x38d13b(0x11f)+(_0x33f8ae?_0x38d13b(0x112):_0x38d13b(0x114))+'\x20'+_0x2b250c),_0x140ea2&&console[_0x38d13b(0x187)](_0x38d13b(0x1b0)+_0x140ea2),_0x226090&&console[_0x38d13b(0x187)](_0x38d13b(0x177)+_0x226090),_0x22267e&&console[_0x38d13b(0x187)](_0x38d13b(0x10c)+_0x22267e),_0xf37dac&&console[_0x38d13b(0x187)](_0x38d13b(0x12a)));let _0x178731;if(_0x22267e)try{if(_0x22267e[_0x38d13b(0x152)]('@')){const _0x4eaa13=await import(_0x38d13b(0x19d)),_0x28e8c1=_0x22267e['substring'](0x1),_0x3c3fc6=await _0x4eaa13['readFile'](_0x28e8c1,'utf-8');_0x178731=JSON[_0x38d13b(0x16c)](_0x3c3fc6);}else _0x178731=JSON[_0x38d13b(0x16c)](_0x22267e);}catch{return console[_0x38d13b(0x187)](_0x38d13b(0x18b)),0x1;}if(!_0x17c2c0[_0x38d13b(0x116)]){const _0x4ef34c=await confirm(_0x38d13b(0x160)+(_0x33f8ae?_0x38d13b(0x112):_0x38d13b(0x114))+'\x20'+_0x2b250c+'?');if(!_0x4ef34c)return console[_0x38d13b(0x187)](_0x38d13b(0x13a)),0x0;}let _0x51fda8;_0x33f8ae?_0x51fda8=await withSpinner('Retrying\x20session...',()=>_0x5de683[_0x38d13b(0x194)][_0x38d13b(0x167)](_0x2b250c,{'fromTask':_0x140ea2,'retryParams':_0x178731}),{'verbose':_0x17c2c0[_0x38d13b(0x134)]}):_0x51fda8=await withSpinner(_0x38d13b(0x106),()=>_0x5de683['workflow'][_0x38d13b(0x162)](_0x2b250c,{'resumeFrom':_0x226090,'retryParams':_0x178731,'force':_0xf37dac}),{'verbose':_0x17c2c0[_0x38d13b(0x134)]});const _0x126a3e=_0x51fda8[_0x38d13b(0x10a)];return console['error'](_0x38d13b(0x147)),console['error'](_0x38d13b(0x16d)+_0x126a3e[_0x38d13b(0x196)]),console[_0x38d13b(0x187)](_0x38d13b(0x139)+_0x126a3e[_0x38d13b(0x157)]),0x0;}catch(_0x39f6af){if(_0x39f6af instanceof SDKError)return console[_0x38d13b(0x187)](_0x38d13b(0x17c)+_0x39f6af[_0x38d13b(0x15f)]),_0x39f6af[_0x38d13b(0x172)]&&console[_0x38d13b(0x187)]('\x20\x20Cause:\x20'+_0x39f6af[_0x38d13b(0x172)]),0x1;throw _0x39f6af;}}}export class WorkflowRunCommand extends BaseCommand{['name']=a39_0x495444(0x110);[a39_0x495444(0x128)]=a39_0x495444(0x108);async[a39_0x495444(0x11b)](_0x5a5072){const _0x1d8ac0=a39_0x495444,{options:_0x3b1d14,args:_0x3c4dc2,tdx:_0x47b09e}=_0x5a5072,_0x26bcc8=_0x3c4dc2[0x0];if(!_0x26bcc8)return console[_0x1d8ac0(0x187)]('Error:\x20Workflow\x20identifier\x20is\x20required'),console[_0x1d8ac0(0x187)]('Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]'),0x1;const _0x302e80=_0x3b1d14[_0x1d8ac0(0x199)],_0xf9f836=_0x3b1d14['sessionTime'],_0x4ce36e={};if(_0x302e80&&Array[_0x1d8ac0(0x140)](_0x302e80))for(const _0xdaeac3 of _0x302e80){const _0xd3fc1=_0xdaeac3[_0x1d8ac0(0x118)]('=');if(_0xd3fc1===-0x1)return console[_0x1d8ac0(0x187)](_0x1d8ac0(0x150)+_0xdaeac3),console[_0x1d8ac0(0x187)]('Expected\x20format:\x20--param\x20key=value'),0x1;const _0x64d7b1=_0xdaeac3[_0x1d8ac0(0x154)](0x0,_0xd3fc1),_0x553dc8=_0xdaeac3[_0x1d8ac0(0x154)](_0xd3fc1+0x1);try{_0x4ce36e[_0x64d7b1]=JSON[_0x1d8ac0(0x16c)](_0x553dc8);}catch{_0x4ce36e[_0x64d7b1]=_0x553dc8;}}_0x3b1d14[_0x1d8ac0(0x134)]&&(console['error'](_0x1d8ac0(0x12b)+_0x26bcc8),Object[_0x1d8ac0(0x188)](_0x4ce36e)[_0x1d8ac0(0x1ab)]>0x0&&console[_0x1d8ac0(0x187)](_0x1d8ac0(0x113)+JSON['stringify'](_0x4ce36e)),_0xf9f836&&console[_0x1d8ac0(0x187)]('Session\x20time:\x20'+_0xf9f836));const _0x2a12b3=await withSpinner(_0x1d8ac0(0x19e),()=>_0x47b09e[_0x1d8ac0(0x194)]['run'](_0x26bcc8,_0x4ce36e,{'sessionTime':_0xf9f836}),{'verbose':_0x3b1d14['verbose']}),_0x20a187=_0x2a12b3['data'];return console[_0x1d8ac0(0x187)]('✔\x20Workflow\x20run\x20started'),console[_0x1d8ac0(0x187)](_0x1d8ac0(0x17d)+_0x20a187['id']),console[_0x1d8ac0(0x187)](_0x1d8ac0(0x139)+_0x20a187[_0x1d8ac0(0x157)]),console['error'](_0x1d8ac0(0x198)+_0x20a187[_0x1d8ac0(0x161)]?.['name']),console[_0x1d8ac0(0x187)](_0x1d8ac0(0x16a)+_0x20a187['workflow']?.[_0x1d8ac0(0x159)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a39_0x495444(0x159)]=a39_0x495444(0x141);[a39_0x495444(0x128)]=a39_0x495444(0x1b2);async[a39_0x495444(0x11b)](_0x318beb){const _0x5aa383=a39_0x495444,{options:_0x430ec9,args:_0x1408de,tdx:_0x59dda5}=_0x318beb,_0x399201=_0x1408de[0x0],_0x58192d=_0x1408de[0x1]||'.';if(!_0x399201)return console[_0x5aa383(0x187)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x5aa383(0x187)](_0x5aa383(0x16f)),0x1;const _0x495592=_0x430ec9[_0x5aa383(0x15e)];_0x430ec9[_0x5aa383(0x134)]&&(console[_0x5aa383(0x187)](_0x5aa383(0x14c)+_0x399201),console['error'](_0x5aa383(0x156)+_0x58192d),_0x495592&&console[_0x5aa383(0x187)](_0x5aa383(0x19f)+_0x495592));const _0xa6dfde=await withSpinner(_0x5aa383(0x138)+_0x399201+_0x5aa383(0x1b3),()=>_0x59dda5[_0x5aa383(0x194)][_0x5aa383(0x119)](_0x399201,_0x58192d,{'revision':_0x495592}),{'verbose':_0x430ec9[_0x5aa383(0x134)]}),_0x5d94b9=_0xa6dfde['data'];return console[_0x5aa383(0x187)]('✔\x20Downloaded\x20'+_0x5d94b9[_0x5aa383(0x145)]),console[_0x5aa383(0x187)](_0x5aa383(0x109)+_0x5d94b9[_0x5aa383(0x15e)]),console[_0x5aa383(0x187)](_0x5aa383(0x10b)+_0x5d94b9[_0x5aa383(0x123)]),console[_0x5aa383(0x187)](_0x5aa383(0x17e)+_0x58192d+'/'+_0x5d94b9[_0x5aa383(0x145)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a39_0x495444(0x159)]=a39_0x495444(0x19c);[a39_0x495444(0x128)]=a39_0x495444(0x15b);async['execute'](_0x296c5f){const _0x304fdc=a39_0x495444,{options:_0x2b23f5,args:_0x259217,tdx:_0x5774ac}=_0x296c5f;let _0xa1ed3f='.',_0x544498=_0x2b23f5[_0x304fdc(0x159)];if(_0x259217[0x0]){const {promises:_0x1814b9}=await import('fs');try{const _0x8f6c3d=await _0x1814b9[_0x304fdc(0x1a8)](_0x259217[0x0]);if(_0x8f6c3d[_0x304fdc(0x175)]())_0xa1ed3f=_0x259217[0x0];else return console[_0x304fdc(0x187)]('Error:\x20'+_0x259217[0x0]+_0x304fdc(0x122)),0x1;}catch{_0x544498=_0x259217[0x0],_0xa1ed3f='.';}}const _0x44dfaa=_0x2b23f5[_0x304fdc(0x15e)],_0x3b34fd=_0x2b23f5[_0x304fdc(0x16e)];_0x2b23f5[_0x304fdc(0x134)]&&(console[_0x304fdc(0x187)](_0x304fdc(0x18e)+_0xa1ed3f),_0x544498&&console[_0x304fdc(0x187)]('Project\x20name:\x20'+_0x544498),_0x44dfaa&&console[_0x304fdc(0x187)](_0x304fdc(0x19f)+_0x44dfaa),_0x3b34fd&&console[_0x304fdc(0x187)](_0x304fdc(0x1a3)));const _0x237171=await withSpinner(_0x304fdc(0x146),()=>_0x5774ac['workflow'][_0x304fdc(0x148)](_0xa1ed3f,{'projectName':_0x544498,'revision':_0x44dfaa,'skipValidation':_0x3b34fd}),{'verbose':_0x2b23f5[_0x304fdc(0x134)]}),_0x501725=_0x237171[_0x304fdc(0x10a)];return console['error'](_0x304fdc(0x136)+_0x501725[_0x304fdc(0x145)]),console[_0x304fdc(0x187)](_0x304fdc(0x184)+_0x501725['projectId']),console[_0x304fdc(0x187)]('\x20\x20Revision:\x20'+_0x501725[_0x304fdc(0x15e)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a39_0x495444(0x159)]='workflow:delete';['description']=a39_0x495444(0x13b);async[a39_0x495444(0x11b)](_0x13c274){const _0x387f47=a39_0x495444,{options:_0x2b8cc2,args:_0x146990,tdx:_0x53aba9}=_0x13c274,_0x7f33dc=_0x146990[0x0];if(!_0x7f33dc)return console[_0x387f47(0x187)](_0x387f47(0x15d)),console[_0x387f47(0x187)](_0x387f47(0x142)),0x1;_0x2b8cc2[_0x387f47(0x134)]&&console[_0x387f47(0x187)](_0x387f47(0x14c)+_0x7f33dc);if(!_0x2b8cc2[_0x387f47(0x116)]){const _0x3ff1ec=await confirm(_0x387f47(0x1ac)+_0x7f33dc+_0x387f47(0x185));if(!_0x3ff1ec)return console['error'](_0x387f47(0x13a)),0x0;}const _0x4c3d4b=await withSpinner(_0x387f47(0x163)+_0x7f33dc+_0x387f47(0x1b3),()=>_0x53aba9[_0x387f47(0x194)][_0x387f47(0x174)](_0x7f33dc),{'verbose':_0x2b8cc2['verbose']}),_0x395671=_0x4c3d4b[_0x387f47(0x10a)];return console['error'](_0x387f47(0x117)+_0x395671[_0x387f47(0x145)]),console[_0x387f47(0x187)](_0x387f47(0x184)+_0x395671['projectId']),0x0;}}
package/dist/core/auth.js CHANGED
@@ -1 +1 @@
1
- function a40_0x2e11(_0xaf98f4,_0x5b5d8d){const _0x599458=a40_0x5994();return a40_0x2e11=function(_0x2e1159,_0x4b21df){_0x2e1159=_0x2e1159-0xfc;let _0x1dc9a9=_0x599458[_0x2e1159];return _0x1dc9a9;},a40_0x2e11(_0xaf98f4,_0x5b5d8d);}(function(_0x467cfd,_0x4ef269){const _0x4f31d9=a40_0x2e11,_0x2b722d=_0x467cfd();while(!![]){try{const _0x195307=-parseInt(_0x4f31d9(0x10f))/0x1+-parseInt(_0x4f31d9(0x100))/0x2*(-parseInt(_0x4f31d9(0x108))/0x3)+parseInt(_0x4f31d9(0xfd))/0x4+parseInt(_0x4f31d9(0x112))/0x5*(parseInt(_0x4f31d9(0x110))/0x6)+parseInt(_0x4f31d9(0x111))/0x7*(-parseInt(_0x4f31d9(0x113))/0x8)+-parseInt(_0x4f31d9(0xfc))/0x9+parseInt(_0x4f31d9(0x103))/0xa*(-parseInt(_0x4f31d9(0x101))/0xb);if(_0x195307===_0x4ef269)break;else _0x2b722d['push'](_0x2b722d['shift']());}catch(_0x272b1d){_0x2b722d['push'](_0x2b722d['shift']());}}}(a40_0x5994,0x4a613));import{platform}from'os';function a40_0x5994(){const _0x9dd563=['TD1\x20','8087izvYtH','1394478bhIiFp','56joXRFN','10IcVoKT','434528XkzxEw','1922697QDDvBq','1806640NOfAjq','tdx/','version','194926AjobuW','22LPQOct','url','265210WoEetK','parse','length','X-Trino-User','entries','3AMwISh','utf-8','tdx','Authorization','0.0.0','../../package.json'];a40_0x5994=function(){return _0x9dd563;};return a40_0x5994();}import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x520cd1=a40_0x2e11;try{const _0x54cffe=fileURLToPath(import.meta[_0x520cd1(0x102)]),_0x24cae4=dirname(_0x54cffe),_0x106fce=join(_0x24cae4,_0x520cd1(0x10d)),_0x1b0c3a=JSON[_0x520cd1(0x104)](readFileSync(_0x106fce,_0x520cd1(0x109)));return _0x1b0c3a[_0x520cd1(0xff)];}catch{return _0x520cd1(0x10c);}}export function getUserAgent(){const _0x13723c=a40_0x2e11,_0x1bfa95=getVersion(),_0x5052f1=platform(),_0x2457bf=process[_0x13723c(0xff)]['replace']('v','');return _0x13723c(0xfe)+_0x1bfa95+'\x20('+_0x5052f1+';\x20node/'+_0x2457bf+')';}export function getAuthHeaders(_0x22829b,_0x42c24b){const _0xe985ac=a40_0x2e11,_0x5454ef=getVersion(),_0xd335d={'User-Agent':getUserAgent(),'X-TD-Client':_0xe985ac(0x10a),'X-TD-Client-Version':_0x5454ef};return _0x42c24b&&(_0xd335d[_0xe985ac(0x10b)]=_0xe985ac(0x10e)+_0x42c24b),_0xd335d;}export function toHeaderRecord(_0x5f423b){const _0x9c0826=a40_0x2e11,_0x2c3164={};for(const [_0x5a092b,_0x54beab]of Object[_0x9c0826(0x107)](_0x5f423b)){_0x54beab!==undefined&&(_0x2c3164[_0x5a092b]=_0x54beab);}return _0x2c3164;}export function getTrinoHeaders(_0x1026d3,_0x8846ce){const _0x33f01c=a40_0x2e11,_0x257439=getAuthHeaders(_0x1026d3,_0x8846ce),_0x3cad81=toHeaderRecord(_0x257439);return delete _0x3cad81[_0x33f01c(0x10b)],_0x8846ce&&(_0x3cad81[_0x33f01c(0x106)]=_0x8846ce),_0x3cad81;}export function hasAPIKey(_0x4aa1d1){const _0x2aeabf=a40_0x2e11,_0x1f7d8c=getAPIKey(_0x4aa1d1);return _0x1f7d8c!==undefined&&_0x1f7d8c[_0x2aeabf(0x105)]>0x0;}
1
+ (function(_0x5f1c02,_0x4db5ff){const _0xe75d86=a40_0x225d,_0x330b93=_0x5f1c02();while(!![]){try{const _0xb10d1a=-parseInt(_0xe75d86(0x1e8))/0x1*(-parseInt(_0xe75d86(0x1e1))/0x2)+-parseInt(_0xe75d86(0x1d7))/0x3*(-parseInt(_0xe75d86(0x1e7))/0x4)+-parseInt(_0xe75d86(0x1e2))/0x5+parseInt(_0xe75d86(0x1d6))/0x6*(parseInt(_0xe75d86(0x1da))/0x7)+parseInt(_0xe75d86(0x1df))/0x8+parseInt(_0xe75d86(0x1de))/0x9*(-parseInt(_0xe75d86(0x1d8))/0xa)+parseInt(_0xe75d86(0x1e3))/0xb;if(_0xb10d1a===_0x4db5ff)break;else _0x330b93['push'](_0x330b93['shift']());}catch(_0x1b7d7b){_0x330b93['push'](_0x330b93['shift']());}}}(a40_0x3999,0xeb783));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a40_0x3999(){const _0x3e35da=['891284khVIcx','1303669RQWxaL','entries','version','utf-8','TD1\x20','4795338RRnUVm','3EbMqtb','1860okkTec','tdx','7jrCTwi','url','parse','X-Trino-User','80451KxklNe','873832mfmMnw','tdx/','2qFwRVH','8086350dxHpQT','19904115AcfrDC','0.0.0','Authorization','length'];a40_0x3999=function(){return _0x3e35da;};return a40_0x3999();}function a40_0x225d(_0x4394f7,_0x4bf0b6){const _0x399963=a40_0x3999();return a40_0x225d=function(_0x225d64,_0x55e74e){_0x225d64=_0x225d64-0x1d4;let _0x3473f6=_0x399963[_0x225d64];return _0x3473f6;},a40_0x225d(_0x4394f7,_0x4bf0b6);}import{getAPIKey}from'./config.js';export function getVersion(){const _0x3eae75=a40_0x225d;try{const _0x36daba=fileURLToPath(import.meta[_0x3eae75(0x1db)]),_0x1bad25=dirname(_0x36daba),_0x4b0f14=join(_0x1bad25,'../../package.json'),_0x2fd6fb=JSON[_0x3eae75(0x1dc)](readFileSync(_0x4b0f14,_0x3eae75(0x1d4)));return _0x2fd6fb['version'];}catch{return _0x3eae75(0x1e4);}}export function getUserAgent(){const _0x2b4f00=a40_0x225d,_0x16f12c=getVersion(),_0x388d88=platform(),_0x268acd=process[_0x2b4f00(0x1ea)]['replace']('v','');return _0x2b4f00(0x1e0)+_0x16f12c+'\x20('+_0x388d88+';\x20node/'+_0x268acd+')';}export function getAuthHeaders(_0x18793b,_0x5c1f86){const _0x454614=a40_0x225d,_0x1dab17=getVersion(),_0x44c687={'User-Agent':getUserAgent(),'X-TD-Client':_0x454614(0x1d9),'X-TD-Client-Version':_0x1dab17};return _0x5c1f86&&(_0x44c687['Authorization']=_0x454614(0x1d5)+_0x5c1f86),_0x44c687;}export function toHeaderRecord(_0x3d10f3){const _0x202eda=a40_0x225d,_0x502982={};for(const [_0x511f1c,_0x3aa3d2]of Object[_0x202eda(0x1e9)](_0x3d10f3)){_0x3aa3d2!==undefined&&(_0x502982[_0x511f1c]=_0x3aa3d2);}return _0x502982;}export function getTrinoHeaders(_0x3e10cf,_0x118a02){const _0x363d25=a40_0x225d,_0x5db555=getAuthHeaders(_0x3e10cf,_0x118a02),_0x6c9857=toHeaderRecord(_0x5db555);return delete _0x6c9857[_0x363d25(0x1e5)],_0x118a02&&(_0x6c9857[_0x363d25(0x1dd)]=_0x118a02),_0x6c9857;}export function hasAPIKey(_0x2ab51a){const _0x163ad7=a40_0x225d,_0x35940d=getAPIKey(_0x2ab51a);return _0x35940d!==undefined&&_0x35940d[_0x163ad7(0x1e6)]>0x0;}
@@ -1 +1 @@
1
- (function(_0x2bfcbd,_0x4d28db){const _0x35d0b7=a41_0x47a9,_0x26fc57=_0x2bfcbd();while(!![]){try{const _0x47f09d=parseInt(_0x35d0b7(0xba))/0x1*(parseInt(_0x35d0b7(0xa6))/0x2)+parseInt(_0x35d0b7(0x6f))/0x3+parseInt(_0x35d0b7(0x82))/0x4*(-parseInt(_0x35d0b7(0x83))/0x5)+parseInt(_0x35d0b7(0xb2))/0x6*(-parseInt(_0x35d0b7(0x8a))/0x7)+parseInt(_0x35d0b7(0x9f))/0x8*(parseInt(_0x35d0b7(0x7e))/0x9)+parseInt(_0x35d0b7(0xa7))/0xa+-parseInt(_0x35d0b7(0x7c))/0xb*(parseInt(_0x35d0b7(0x97))/0xc);if(_0x47f09d===_0x4d28db)break;else _0x26fc57['push'](_0x26fc57['shift']());}catch(_0x1a1130){_0x26fc57['push'](_0x26fc57['shift']());}}}(a41_0x1c74,0x536a5));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a41_0xf5646e from'node:fs';import*as a41_0x4b0c97 from'node:path';function a41_0x1c74(){const _0x78989e=['profiles','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','tdx.json','20916OtyNZW','keychain\x20(profile:\x20','stg-jp01','profile','startsWith','stg-ap03','dev-eu01','slice','224hUDTkq','dev-us01','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','us01','map','Warning:\x20Unknown\x20site\x20\x27','join','4mvlDDw','1393950TpZFNt','trim','TD_API_KEY\x20env\x20var\x20(deprecated)','name','TDX_API_KEY_<PROFILE>','source','llm_default_project.','string','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','TD_API_KEY','.config','1880322rEQNlc','TDX_CONFIG_DIR','toUpperCase','tdx','TDX_API_KEY_','keychain','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','eu01','326726PawTjG','TDX_API_KEY\x20env\x20var','1916217ZMkXiZ','replace','TDX_CACHE_DIR','utf-8','\x27,\x20defaulting\x20to\x20us01','readFileSync','apiKey','legacy\x20.env\x20file\x20(profile:\x20','split','stringify','match','ap03','ap02','5797cbsIZc','TD_API_KEY_','199152Ylxghi','warn','env','Warning:\x20Failed\x20to\x20load\x20','4LgbTCe','2387765tlkkGq','TDX_API_KEY','existsSync','legacy\x20.env\x20file','endsWith','stg-us01','yellow','7OxQNVJ','jp01','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','\x20env\x20var','.cache','includes','.env.','.env','some','parse'];a41_0x1c74=function(){return _0x78989e;};return a41_0x1c74();}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 a41_0x2c3cae from'chalk';export function getConfigDir(){const _0x225b55=a41_0x47a9;return process[_0x225b55(0x80)][_0x225b55(0xb3)]||join(homedir(),_0x225b55(0xb1),_0x225b55(0xb5));}export function getConfigFile(){const _0x2f9f94=a41_0x47a9;return join(getConfigDir(),_0x2f9f94(0x91));}function a41_0x47a9(_0x5f51b8,_0xbb8312){const _0x1c74e3=a41_0x1c74();return a41_0x47a9=function(_0x47a953,_0x22b274){_0x47a953=_0x47a953-0x6f;let _0x2fcc8e=_0x1c74e3[_0x47a953];return _0x2fcc8e;},a41_0x47a9(_0x5f51b8,_0xbb8312);}export function getConfigFilePath(_0x43f0fe){const _0x585647=a41_0x47a9,_0x148779=getConfigDir();return _0x43f0fe?a41_0x4b0c97[_0x585647(0xa5)](_0x148779,_0x585647(0x90)+_0x43f0fe):getConfigFile();}export function getCacheDir(){const _0x2b63a4=a41_0x47a9;return process[_0x2b63a4(0x80)][_0x2b63a4(0x71)]||join(homedir(),_0x2b63a4(0x8e),'tdx');}export function getLLMProjectCacheFile(_0x440016){const _0x38d98f=a41_0x47a9,_0x3b6be6=_0x440016?_0x38d98f(0xad)+_0x440016:'llm_default_project';return join(getCacheDir(),_0x3b6be6);}export function readCachedLLMProject(_0x47e913){const _0x515a5b=a41_0x47a9;try{const _0x36adf0=getLLMProjectCacheFile(_0x47e913);if(!existsSync(_0x36adf0))return null;const _0x4c2f56=readFileSync(_0x36adf0,_0x515a5b(0x72))[_0x515a5b(0xa8)]();try{const _0x470927=JSON[_0x515a5b(0x93)](_0x4c2f56);if(_0x470927&&typeof _0x470927['id']===_0x515a5b(0xae)&&typeof _0x470927[_0x515a5b(0xaa)]==='string')return _0x470927;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x1621e1,_0x1eaee6,_0x2697ab){const _0x5da09e=a41_0x47a9;try{const _0x341d98=getCacheDir(),_0x30f38e=getLLMProjectCacheFile(_0x2697ab);!existsSync(_0x341d98)&&mkdirSync(_0x341d98,{'recursive':!![]});const _0x4834b5={'name':_0x1621e1,'id':_0x1eaee6};writeFileSync(_0x30f38e,JSON[_0x5da09e(0x78)](_0x4834b5),_0x5da09e(0x72));}catch{}}export function parseEnvFile(_0x41fec6){const _0x535e47=a41_0x47a9,_0x5768f0={};for(const _0x22704a of _0x41fec6[_0x535e47(0x77)]('\x0a')){const _0x59bacc=_0x22704a['trim']();if(!_0x59bacc||_0x59bacc['startsWith']('#'))continue;const _0x3094a8=_0x59bacc[_0x535e47(0x79)](/^([^=]+)=(.*)$/);if(_0x3094a8){const _0x91385=_0x3094a8[0x1][_0x535e47(0xa8)]();let _0x75c532=_0x3094a8[0x2]['trim']();(_0x75c532[_0x535e47(0x9b)]('\x22')&&_0x75c532[_0x535e47(0x87)]('\x22')||_0x75c532[_0x535e47(0x9b)]('\x27')&&_0x75c532[_0x535e47(0x87)]('\x27'))&&(_0x75c532=_0x75c532[_0x535e47(0x9e)](0x1,-0x1)),_0x5768f0[_0x91385]=_0x75c532;}}return _0x5768f0;}export function readUserConfig(){const _0x3ea3c1=a41_0x47a9,_0x334775=getConfigFile();if(!existsSync(_0x334775))return{};try{const _0x4f18cd=readFileSync(_0x334775,'utf-8');return parseEnvFile(_0x4f18cd);}catch(_0x382720){return console['warn'](_0x3ea3c1(0xa1)+_0x334775+':',_0x382720),{};}}export function resolveSite(_0x2b56fa){const _0x474a10=a41_0x47a9,_0x6edf3=[_0x474a10(0xa2),_0x474a10(0x8b),_0x474a10(0xb9),_0x474a10(0x7b),'ap03','dev-us01',_0x474a10(0x9d),'stg-us01',_0x474a10(0x99),'stg-ap03'];if(_0x6edf3[_0x474a10(0x8f)](_0x2b56fa))return _0x2b56fa;if(_0x2b56fa in SITE_ALIASES)return SITE_ALIASES[_0x2b56fa];return console['warn'](_0x474a10(0xa4)+_0x2b56fa+_0x474a10(0x73)),_0x474a10(0xa2);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0xbb49e0,_0x55ec41){const _0x9b1842=a41_0x47a9,_0x256d77=_0x55ec41||getActiveProfileName();if(_0x256d77){const _0x21005c=_0x9b1842(0xb6)+normalizeProfileForEnvVar(_0x256d77);if(process[_0x9b1842(0x80)][_0x21005c])return process[_0x9b1842(0x80)][_0x21005c];}if(process['env'][_0x9b1842(0x84)])return process[_0x9b1842(0x80)]['TDX_API_KEY'];if(process[_0x9b1842(0x80)][_0x9b1842(0xb0)])return process['env']['TD_API_KEY'];const _0x311bed=_0xbb49e0['toUpperCase']()['replace'](/-/g,'_'),_0x19d156=_0x9b1842(0x7d)+_0x311bed;if(_0x256d77){const _0x49fad8=loadProfileEnv(_0x256d77);if(_0x49fad8){if(_0x49fad8[_0x19d156])return _0x49fad8[_0x19d156];if(_0x49fad8[_0x9b1842(0xb0)])return _0x49fad8[_0x9b1842(0xb0)];}}const _0x57623f=loadUserConfigOnce();if(_0x57623f[_0x19d156])return _0x57623f[_0x19d156];if(_0x57623f['TD_API_KEY'])return _0x57623f[_0x9b1842(0xb0)];return undefined;}export function normalizeProfileForEnvVar(_0x2c7bae){const _0x2285d8=a41_0x47a9;return _0x2c7bae[_0x2285d8(0xb4)]()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x296286,_0x537bbe){const _0x246283=a41_0x47a9,_0x40795c=_0x537bbe||getActiveProfileName()||undefined;if(_0x40795c){const _0x34cae4='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x40795c);if(process[_0x246283(0x80)][_0x34cae4])return{'apiKey':process['env'][_0x34cae4],'source':_0x34cae4+_0x246283(0x8d),'isDeprecated':![]};const _0x3699b4=getCachedCredential(_0x296286,_0x40795c);if(_0x3699b4)return{'apiKey':_0x3699b4,'source':'keychain\x20(profile:\x20'+_0x40795c+')','isDeprecated':![]};const _0x3bf0a3=await getKeychainAPIKey(_0x40795c);if(_0x3bf0a3)return setCachedCredential(_0x3bf0a3,_0x296286,_0x40795c),{'apiKey':_0x3bf0a3,'source':_0x246283(0x98)+_0x40795c+')','isDeprecated':![]};}if(process[_0x246283(0x80)][_0x246283(0x84)])return{'apiKey':process[_0x246283(0x80)][_0x246283(0x84)],'source':_0x246283(0xbb),'isDeprecated':![]};if(!_0x40795c){const _0x2fbd9d=getCachedCredential(_0x296286,undefined);if(_0x2fbd9d)return{'apiKey':_0x2fbd9d,'source':_0x246283(0xb7),'isDeprecated':![]};const _0x3be3a4=await getKeychainAPIKey(undefined);if(_0x3be3a4)return setCachedCredential(_0x3be3a4,_0x296286,undefined),{'apiKey':_0x3be3a4,'source':_0x246283(0xb7),'isDeprecated':![]};}if(process[_0x246283(0x80)][_0x246283(0xb0)])return{'apiKey':process['env'][_0x246283(0xb0)],'source':_0x246283(0xa9),'isDeprecated':!![]};const _0x1bc149=getLegacyEnvAPIKey(_0x296286,_0x40795c);if(_0x1bc149){const _0x4e8a8e=await isKeychainAvailable();if(_0x4e8a8e)try{await saveKeychainAPIKey(_0x1bc149,_0x40795c),setCachedCredential(_0x1bc149,_0x296286,_0x40795c);const _0x5a3461=getConfigFilePath(_0x40795c);cleanupLegacyEnvFile(_0x5a3461)&&console[_0x246283(0x7f)](a41_0x2c3cae[_0x246283(0x89)](_0x246283(0x95)));}catch(_0x1b8f7e){console[_0x246283(0x7f)](a41_0x2c3cae[_0x246283(0x89)](_0x246283(0xb8)+_0x1b8f7e));}const _0x5bb90c=_0x40795c?_0x246283(0x76)+_0x40795c+')':_0x246283(0x86);return{'apiKey':_0x1bc149,'source':_0x5bb90c,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x2f743e,_0x5354b8,_0x36efb5=!![]){const _0x3f03b5=a41_0x47a9,_0x4fbfbc=await resolveAPIKeyAsync(_0x2f743e,_0x5354b8);if(!_0x4fbfbc)return undefined;if(_0x36efb5&&_0x4fbfbc['isDeprecated']&&_0x4fbfbc[_0x3f03b5(0xac)][_0x3f03b5(0x8f)](_0x3f03b5(0xb0))){const _0x341b1c=_0x5354b8||getActiveProfileName()||undefined,_0x4278b5=_0x341b1c?'TDX_API_KEY_'+normalizeProfileForEnvVar(_0x341b1c):_0x3f03b5(0xab);console[_0x3f03b5(0x7f)](a41_0x2c3cae['yellow'](_0x3f03b5(0xaf)+(_0x3f03b5(0x8c)+_0x4278b5+').')));}return _0x4fbfbc[_0x3f03b5(0x75)];}function getLegacyEnvAPIKey(_0x48beab,_0x55f275){const _0x44e02e=a41_0x47a9,_0x3f79cf=_0x48beab[_0x44e02e(0xb4)]()[_0x44e02e(0x70)](/-/g,'_'),_0x429e27=_0x44e02e(0x7d)+_0x3f79cf;if(_0x55f275){const _0x5aac65=loadProfileEnv(_0x55f275);if(_0x5aac65){if(_0x5aac65[_0x429e27])return _0x5aac65[_0x429e27];if(_0x5aac65[_0x44e02e(0xb0)])return _0x5aac65[_0x44e02e(0xb0)];}}const _0x5dde3b=loadUserConfigOnce();if(_0x5dde3b[_0x429e27])return _0x5dde3b[_0x429e27];if(_0x5dde3b[_0x44e02e(0xb0)])return _0x5dde3b[_0x44e02e(0xb0)];return undefined;}function cleanupLegacyEnvFile(_0x54daec){const _0x1a9d37=a41_0x47a9;if(!existsSync(_0x54daec))return![];try{const _0x228a01=readFileSync(_0x54daec,_0x1a9d37(0x72)),_0x58f353=_0x228a01[_0x1a9d37(0x77)]('\x0a'),_0x381f94=_0x58f353['filter'](_0x51c04e=>{const _0x3cb5e2=_0x1a9d37,_0x41bd3f=_0x51c04e[_0x3cb5e2(0xa8)]();if(!_0x41bd3f||_0x41bd3f[_0x3cb5e2(0x9b)]('#'))return!![];const [_0x54a24f]=_0x41bd3f[_0x3cb5e2(0x77)]('=');return!_0x54a24f[_0x3cb5e2(0x9b)](_0x3cb5e2(0xb0));}),_0x377851=_0x381f94[_0x1a9d37(0x92)](_0x545b30=>{const _0x347c12=_0x1a9d37,_0x1e13c1=_0x545b30['trim']();return _0x1e13c1&&!_0x1e13c1[_0x347c12(0x9b)]('#');});if(!_0x377851)return unlinkSync(_0x54daec),!![];return writeFileSync(_0x54daec,_0x381f94['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x5d3c41){const _0x372624=a41_0x47a9,_0x4c5a9f=a41_0x4b0c97[_0x372624(0xa5)](getConfigDir(),'.env.'+_0x5d3c41);if(a41_0xf5646e[_0x372624(0x85)](_0x4c5a9f)){validateSecureFilePermissions(_0x4c5a9f);try{const _0x32150a=a41_0xf5646e[_0x372624(0x74)](_0x4c5a9f,_0x372624(0x72));return parseEnvFile(_0x32150a);}catch(_0x55bdd7){console['warn'](_0x372624(0x81)+_0x4c5a9f+':\x20'+_0x55bdd7);}}const _0x3dcc60=a41_0x4b0c97[_0x372624(0xa5)](getConfigDir(),_0x372624(0x94),_0x5d3c41,_0x372624(0x91));if(a41_0xf5646e[_0x372624(0x85)](_0x3dcc60)){validateSecureFilePermissions(_0x3dcc60);try{const _0x185045=a41_0xf5646e['readFileSync'](_0x3dcc60,_0x372624(0x72));return parseEnvFile(_0x185045);}catch(_0x13c154){return console[_0x372624(0x7f)](_0x372624(0x81)+_0x3dcc60+':\x20'+_0x13c154),null;}}return null;}function getActiveProfileName(){const _0x402edd=a41_0x47a9,_0x27f85b=a41_0x4b0c97[_0x402edd(0xa5)](getConfigDir(),_0x402edd(0x96));if(!a41_0xf5646e[_0x402edd(0x85)](_0x27f85b))return null;try{const _0x419738=a41_0xf5646e[_0x402edd(0x74)](_0x27f85b,_0x402edd(0x72)),_0x9afbbb=JSON[_0x402edd(0x93)](_0x419738);return _0x9afbbb[_0x402edd(0x9a)]||null;}catch{return null;}}export function saveAPIKey(_0x2f8cf2,_0x5ee389,_0x4143ea){const _0x1f64ac=a41_0x47a9,_0x390182=getConfigDir(),_0x84d306=getConfigFilePath(_0x4143ea);!existsSync(_0x390182)&&mkdirSync(_0x390182,{'recursive':!![],'mode':0x1c0});let _0x1d7284={};if(existsSync(_0x84d306))try{const _0x1f2faf=readFileSync(_0x84d306,'utf-8');_0x1d7284=parseEnvFile(_0x1f2faf);}catch(_0x280a37){console[_0x1f64ac(0x7f)]('Warning:\x20Failed\x20to\x20read\x20'+_0x84d306+':',_0x280a37);}const _0x1cafc4=_0x2f8cf2[_0x1f64ac(0xb4)]()[_0x1f64ac(0x70)](/-/g,'_');_0x1d7284[_0x1f64ac(0x7d)+_0x1cafc4]=_0x5ee389;const _0x353a1e=Object['entries'](_0x1d7284)[_0x1f64ac(0xa3)](([_0x3d9e47,_0x320eef])=>_0x3d9e47+'='+_0x320eef);writeFileSync(_0x84d306,_0x353a1e[_0x1f64ac(0xa5)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x5bb353,_0x2959ea,_0x6a7ede){const _0x355bc8=a41_0x47a9;await saveKeychainAPIKey(_0x5bb353,_0x6a7ede),setCachedCredential(_0x5bb353,_0x2959ea,_0x6a7ede);const _0x30556f=getConfigFilePath(_0x6a7ede);cleanupLegacyEnvFile(_0x30556f)&&console[_0x355bc8(0x7f)](a41_0x2c3cae[_0x355bc8(0x89)]('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0x1eb887=a41_0x47a9,_0x5a320d={'apiKeys':{},'defaultSite':_0x1eb887(0xa2)},_0x100679=['us01',_0x1eb887(0x8b),_0x1eb887(0xb9),_0x1eb887(0x7b),_0x1eb887(0x7a),_0x1eb887(0xa0),_0x1eb887(0x9d),_0x1eb887(0x88),_0x1eb887(0x99),_0x1eb887(0x9c)];for(const _0x5af6f3 of _0x100679){const _0x1d0a21=getAPIKey(_0x5af6f3);_0x1d0a21&&(_0x5a320d['apiKeys'][_0x5af6f3]=_0x1d0a21);}return _0x5a320d;}
1
+ (function(_0x54ed9f,_0x1a7c88){const _0x42b903=a41_0x833a,_0x1a8387=_0x54ed9f();while(!![]){try{const _0x3333c9=parseInt(_0x42b903(0xe2))/0x1+parseInt(_0x42b903(0xe1))/0x2+parseInt(_0x42b903(0xd8))/0x3+-parseInt(_0x42b903(0xe7))/0x4+-parseInt(_0x42b903(0xfd))/0x5+parseInt(_0x42b903(0x109))/0x6+-parseInt(_0x42b903(0xeb))/0x7;if(_0x3333c9===_0x1a7c88)break;else _0x1a8387['push'](_0x1a8387['shift']());}catch(_0x22c090){_0x1a8387['push'](_0x1a8387['shift']());}}}(a41_0x3883,0x1e1c5));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a41_0x203c3e from'node:fs';import*as a41_0x5bfa4e 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 a41_0x400bbb from'chalk';export function getConfigDir(){const _0xa56b6d=a41_0x833a;return process[_0xa56b6d(0x118)][_0xa56b6d(0xf9)]||join(homedir(),_0xa56b6d(0xf2),_0xa56b6d(0xe8));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x48b245){const _0x58ad22=a41_0x833a,_0x553bea=getConfigDir();return _0x48b245?a41_0x5bfa4e[_0x58ad22(0xf8)](_0x553bea,_0x58ad22(0x110)+_0x48b245):getConfigFile();}export function getCacheDir(){const _0x7d2f7d=a41_0x833a;return process[_0x7d2f7d(0x118)][_0x7d2f7d(0x10f)]||join(homedir(),_0x7d2f7d(0xe4),_0x7d2f7d(0xe8));}export function getLLMProjectCacheFile(_0x535758){const _0x3cb794=a41_0x833a,_0x96ee97=_0x535758?_0x3cb794(0xde)+_0x535758:_0x3cb794(0xe9);return join(getCacheDir(),_0x96ee97);}export function readCachedLLMProject(_0x2a31ab){const _0x539f8c=a41_0x833a;try{const _0x4f3cf5=getLLMProjectCacheFile(_0x2a31ab);if(!existsSync(_0x4f3cf5))return null;const _0x50221b=readFileSync(_0x4f3cf5,_0x539f8c(0x116))[_0x539f8c(0xf4)]();try{const _0x2c6e43=JSON[_0x539f8c(0xdc)](_0x50221b);if(_0x2c6e43&&typeof _0x2c6e43['id']===_0x539f8c(0xef)&&typeof _0x2c6e43['name']===_0x539f8c(0xef))return _0x2c6e43;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x4931d0,_0x279047,_0x56ed59){const _0x5af5e6=a41_0x833a;try{const _0x549eb9=getCacheDir(),_0x276fb9=getLLMProjectCacheFile(_0x56ed59);!existsSync(_0x549eb9)&&mkdirSync(_0x549eb9,{'recursive':!![]});const _0x2f9a67={'name':_0x4931d0,'id':_0x279047};writeFileSync(_0x276fb9,JSON['stringify'](_0x2f9a67),_0x5af5e6(0x116));}catch{}}function a41_0x833a(_0x42da7e,_0x3188dc){const _0x3883ec=a41_0x3883();return a41_0x833a=function(_0x833a1e,_0x80b4e2){_0x833a1e=_0x833a1e-0xd7;let _0x136f3d=_0x3883ec[_0x833a1e];return _0x136f3d;},a41_0x833a(_0x42da7e,_0x3188dc);}export function parseEnvFile(_0x217744){const _0x2c1ec6=a41_0x833a,_0x393c8a={};for(const _0x5c3af6 of _0x217744[_0x2c1ec6(0x100)]('\x0a')){const _0x4e19e7=_0x5c3af6[_0x2c1ec6(0xf4)]();if(!_0x4e19e7||_0x4e19e7['startsWith']('#'))continue;const _0x3e877c=_0x4e19e7['match'](/^([^=]+)=(.*)$/);if(_0x3e877c){const _0x30e303=_0x3e877c[0x1][_0x2c1ec6(0xf4)]();let _0x3373e7=_0x3e877c[0x2][_0x2c1ec6(0xf4)]();(_0x3373e7[_0x2c1ec6(0x10c)]('\x22')&&_0x3373e7[_0x2c1ec6(0x101)]('\x22')||_0x3373e7['startsWith']('\x27')&&_0x3373e7[_0x2c1ec6(0x101)]('\x27'))&&(_0x3373e7=_0x3373e7[_0x2c1ec6(0x102)](0x1,-0x1)),_0x393c8a[_0x30e303]=_0x3373e7;}}return _0x393c8a;}export function readUserConfig(){const _0x171903=a41_0x833a,_0x1030aa=getConfigFile();if(!existsSync(_0x1030aa))return{};try{const _0x2aaf21=readFileSync(_0x1030aa,_0x171903(0x116));return parseEnvFile(_0x2aaf21);}catch(_0x1198ea){return console[_0x171903(0x107)](_0x171903(0xe5)+_0x1030aa+':',_0x1198ea),{};}}export function resolveSite(_0x57ecf0){const _0xbcd862=a41_0x833a,_0x3c218f=[_0xbcd862(0x111),'jp01','eu01',_0xbcd862(0xee),_0xbcd862(0xd7),_0xbcd862(0xea),_0xbcd862(0xfe),'stg-us01',_0xbcd862(0xf1),_0xbcd862(0xf6)];if(_0x3c218f['includes'](_0x57ecf0))return _0x57ecf0;if(_0x57ecf0 in SITE_ALIASES)return SITE_ALIASES[_0x57ecf0];return console[_0xbcd862(0x107)]('Warning:\x20Unknown\x20site\x20\x27'+_0x57ecf0+_0xbcd862(0x112)),_0xbcd862(0x111);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x12bf30,_0x232627){const _0x198e2d=a41_0x833a,_0x4629ab=_0x232627||getActiveProfileName();if(_0x4629ab){const _0x16d445='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x4629ab);if(process['env'][_0x16d445])return process[_0x198e2d(0x118)][_0x16d445];}if(process[_0x198e2d(0x118)][_0x198e2d(0x10d)])return process[_0x198e2d(0x118)][_0x198e2d(0x10d)];if(process[_0x198e2d(0x118)][_0x198e2d(0x119)])return process['env'][_0x198e2d(0x119)];const _0x595e6d=_0x12bf30[_0x198e2d(0xe6)]()['replace'](/-/g,'_'),_0x4d285f=_0x198e2d(0x103)+_0x595e6d;if(_0x4629ab){const _0xf57b66=loadProfileEnv(_0x4629ab);if(_0xf57b66){if(_0xf57b66[_0x4d285f])return _0xf57b66[_0x4d285f];if(_0xf57b66[_0x198e2d(0x119)])return _0xf57b66['TD_API_KEY'];}}const _0x4fe018=loadUserConfigOnce();if(_0x4fe018[_0x4d285f])return _0x4fe018[_0x4d285f];if(_0x4fe018[_0x198e2d(0x119)])return _0x4fe018[_0x198e2d(0x119)];return undefined;}export function normalizeProfileForEnvVar(_0x42c519){const _0x3d691f=a41_0x833a;return _0x42c519['toUpperCase']()[_0x3d691f(0xd9)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x43f8d9,_0x482fd1){const _0x8968e=a41_0x833a,_0x40bd8b=_0x482fd1||getActiveProfileName()||undefined;if(_0x40bd8b){const _0xf8c8af=_0x8968e(0xf3)+normalizeProfileForEnvVar(_0x40bd8b);if(process['env'][_0xf8c8af])return{'apiKey':process[_0x8968e(0x118)][_0xf8c8af],'source':_0xf8c8af+_0x8968e(0xf5),'isDeprecated':![]};const _0x369fa5=getCachedCredential(_0x43f8d9,_0x40bd8b);if(_0x369fa5)return{'apiKey':_0x369fa5,'source':'keychain\x20(profile:\x20'+_0x40bd8b+')','isDeprecated':![]};const _0x27a858=await getKeychainAPIKey(_0x40bd8b);if(_0x27a858)return setCachedCredential(_0x27a858,_0x43f8d9,_0x40bd8b),{'apiKey':_0x27a858,'source':_0x8968e(0x117)+_0x40bd8b+')','isDeprecated':![]};}if(process[_0x8968e(0x118)]['TDX_API_KEY'])return{'apiKey':process[_0x8968e(0x118)]['TDX_API_KEY'],'source':_0x8968e(0x104),'isDeprecated':![]};if(!_0x40bd8b){const _0x4ab35c=getCachedCredential(_0x43f8d9,undefined);if(_0x4ab35c)return{'apiKey':_0x4ab35c,'source':_0x8968e(0xf0),'isDeprecated':![]};const _0x22bf36=await getKeychainAPIKey(undefined);if(_0x22bf36)return setCachedCredential(_0x22bf36,_0x43f8d9,undefined),{'apiKey':_0x22bf36,'source':'keychain','isDeprecated':![]};}if(process['env'][_0x8968e(0x119)])return{'apiKey':process[_0x8968e(0x118)][_0x8968e(0x119)],'source':_0x8968e(0xdf),'isDeprecated':!![]};const _0x5d5714=getLegacyEnvAPIKey(_0x43f8d9,_0x40bd8b);if(_0x5d5714){const _0x3ea1d7=await isKeychainAvailable();if(_0x3ea1d7)try{await saveKeychainAPIKey(_0x5d5714,_0x40bd8b),setCachedCredential(_0x5d5714,_0x43f8d9,_0x40bd8b);const _0x5e7955=getConfigFilePath(_0x40bd8b);cleanupLegacyEnvFile(_0x5e7955)&&console[_0x8968e(0x107)](a41_0x400bbb[_0x8968e(0x114)](_0x8968e(0xe0)));}catch(_0x9d5035){console['warn'](a41_0x400bbb[_0x8968e(0x114)](_0x8968e(0x113)+_0x9d5035));}const _0x977d25=_0x40bd8b?_0x8968e(0xdd)+_0x40bd8b+')':'legacy\x20.env\x20file';return{'apiKey':_0x5d5714,'source':_0x977d25,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x5dea54,_0x485f6d,_0x4da6ea=!![]){const _0x269adf=a41_0x833a,_0x743aa6=await resolveAPIKeyAsync(_0x5dea54,_0x485f6d);if(!_0x743aa6)return undefined;if(_0x4da6ea&&_0x743aa6['isDeprecated']&&_0x743aa6[_0x269adf(0xfb)]['includes'](_0x269adf(0x119))){const _0xef2ef7=_0x485f6d||getActiveProfileName()||undefined,_0x55cdbe=_0xef2ef7?_0x269adf(0xf3)+normalizeProfileForEnvVar(_0xef2ef7):_0x269adf(0xf7);console[_0x269adf(0x107)](a41_0x400bbb[_0x269adf(0x114)]('Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a'+(_0x269adf(0xda)+_0x55cdbe+').')));}return _0x743aa6[_0x269adf(0x10a)];}function getLegacyEnvAPIKey(_0x5c6a24,_0x288296){const _0xfe9b61=a41_0x833a,_0x1ad602=_0x5c6a24['toUpperCase']()[_0xfe9b61(0xd9)](/-/g,'_'),_0x2865aa=_0xfe9b61(0x103)+_0x1ad602;if(_0x288296){const _0x351f9b=loadProfileEnv(_0x288296);if(_0x351f9b){if(_0x351f9b[_0x2865aa])return _0x351f9b[_0x2865aa];if(_0x351f9b[_0xfe9b61(0x119)])return _0x351f9b[_0xfe9b61(0x119)];}}const _0x4b1778=loadUserConfigOnce();if(_0x4b1778[_0x2865aa])return _0x4b1778[_0x2865aa];if(_0x4b1778[_0xfe9b61(0x119)])return _0x4b1778[_0xfe9b61(0x119)];return undefined;}function cleanupLegacyEnvFile(_0x3ac9ca){const _0x320573=a41_0x833a;if(!existsSync(_0x3ac9ca))return![];try{const _0xe9a0e7=readFileSync(_0x3ac9ca,_0x320573(0x116)),_0x1d3602=_0xe9a0e7['split']('\x0a'),_0x200e96=_0x1d3602['filter'](_0x32a585=>{const _0x2526a4=_0x320573,_0xc9f365=_0x32a585[_0x2526a4(0xf4)]();if(!_0xc9f365||_0xc9f365[_0x2526a4(0x10c)]('#'))return!![];const [_0x5c37db]=_0xc9f365[_0x2526a4(0x100)]('=');return!_0x5c37db[_0x2526a4(0x10c)](_0x2526a4(0x119));}),_0x5d8a8e=_0x200e96['some'](_0x6e1be7=>{const _0x22bfdb=_0x320573,_0x163495=_0x6e1be7[_0x22bfdb(0xf4)]();return _0x163495&&!_0x163495['startsWith']('#');});if(!_0x5d8a8e)return unlinkSync(_0x3ac9ca),!![];return writeFileSync(_0x3ac9ca,_0x200e96[_0x320573(0xf8)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function a41_0x3883(){const _0x20e7c4=['utf-8','keychain\x20(profile:\x20','env','TD_API_KEY','ap03','160212YUkcUF','replace','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','profile','parse','legacy\x20.env\x20file\x20(profile:\x20','llm_default_project.','TD_API_KEY\x20env\x20var\x20(deprecated)','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','184748qmnrrL','207095YiWXPA','entries','.cache','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','toUpperCase','248112PuhDDG','tdx','llm_default_project','dev-us01','1292172jDJHZb','Warning:\x20Failed\x20to\x20load\x20','.env','ap02','string','keychain','stg-jp01','.config','TDX_API_KEY_','trim','\x20env\x20var','stg-ap03','TDX_API_KEY_<PROFILE>','join','TDX_CONFIG_DIR','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','source','Warning:\x20Failed\x20to\x20read\x20','901520IxnrRR','dev-eu01','jp01','split','endsWith','slice','TD_API_KEY_','TDX_API_KEY\x20env\x20var','tdx.json','apiKeys','warn','readFileSync','1184328kPXerD','apiKey','existsSync','startsWith','TDX_API_KEY','eu01','TDX_CACHE_DIR','.env.','us01','\x27,\x20defaulting\x20to\x20us01','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','yellow','map'];a41_0x3883=function(){return _0x20e7c4;};return a41_0x3883();}function loadProfileEnv(_0x1dde30){const _0x2686b8=a41_0x833a,_0x26e18d=a41_0x5bfa4e['join'](getConfigDir(),_0x2686b8(0x110)+_0x1dde30);if(a41_0x203c3e[_0x2686b8(0x10b)](_0x26e18d)){validateSecureFilePermissions(_0x26e18d);try{const _0x1ce63f=a41_0x203c3e[_0x2686b8(0x108)](_0x26e18d,_0x2686b8(0x116));return parseEnvFile(_0x1ce63f);}catch(_0x22427e){console[_0x2686b8(0x107)](_0x2686b8(0xec)+_0x26e18d+':\x20'+_0x22427e);}}const _0x496fbf=a41_0x5bfa4e[_0x2686b8(0xf8)](getConfigDir(),'profiles',_0x1dde30,_0x2686b8(0xed));if(a41_0x203c3e['existsSync'](_0x496fbf)){validateSecureFilePermissions(_0x496fbf);try{const _0x558916=a41_0x203c3e['readFileSync'](_0x496fbf,_0x2686b8(0x116));return parseEnvFile(_0x558916);}catch(_0x9d157f){return console[_0x2686b8(0x107)]('Warning:\x20Failed\x20to\x20load\x20'+_0x496fbf+':\x20'+_0x9d157f),null;}}return null;}function getActiveProfileName(){const _0x2e87bc=a41_0x833a,_0x4fcd61=a41_0x5bfa4e['join'](getConfigDir(),_0x2e87bc(0x105));if(!a41_0x203c3e[_0x2e87bc(0x10b)](_0x4fcd61))return null;try{const _0x3e97c5=a41_0x203c3e[_0x2e87bc(0x108)](_0x4fcd61,_0x2e87bc(0x116)),_0x1f461f=JSON[_0x2e87bc(0xdc)](_0x3e97c5);return _0x1f461f[_0x2e87bc(0xdb)]||null;}catch{return null;}}export function saveAPIKey(_0x109c98,_0x1198a0,_0x226ade){const _0x15bca9=a41_0x833a,_0x260e14=getConfigDir(),_0x2e7fc3=getConfigFilePath(_0x226ade);!existsSync(_0x260e14)&&mkdirSync(_0x260e14,{'recursive':!![],'mode':0x1c0});let _0x38f6c6={};if(existsSync(_0x2e7fc3))try{const _0x222bb3=readFileSync(_0x2e7fc3,_0x15bca9(0x116));_0x38f6c6=parseEnvFile(_0x222bb3);}catch(_0x20e0c5){console[_0x15bca9(0x107)](_0x15bca9(0xfc)+_0x2e7fc3+':',_0x20e0c5);}const _0x484959=_0x109c98[_0x15bca9(0xe6)]()[_0x15bca9(0xd9)](/-/g,'_');_0x38f6c6['TD_API_KEY_'+_0x484959]=_0x1198a0;const _0x2e7cd5=Object[_0x15bca9(0xe3)](_0x38f6c6)[_0x15bca9(0x115)](([_0x574118,_0x10d285])=>_0x574118+'='+_0x10d285);writeFileSync(_0x2e7fc3,_0x2e7cd5[_0x15bca9(0xf8)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x581870,_0x1f034d,_0x5702a7){const _0x2a39f9=a41_0x833a;await saveKeychainAPIKey(_0x581870,_0x5702a7),setCachedCredential(_0x581870,_0x1f034d,_0x5702a7);const _0x109bd4=getConfigFilePath(_0x5702a7);cleanupLegacyEnvFile(_0x109bd4)&&console[_0x2a39f9(0x107)](a41_0x400bbb[_0x2a39f9(0x114)](_0x2a39f9(0xfa)));}export function loadConfig(){const _0x532b28=a41_0x833a,_0x14f4b8={'apiKeys':{},'defaultSite':_0x532b28(0x111)},_0x1895a6=['us01',_0x532b28(0xff),_0x532b28(0x10e),_0x532b28(0xee),_0x532b28(0xd7),'dev-us01','dev-eu01','stg-us01','stg-jp01',_0x532b28(0xf6)];for(const _0xdb83c6 of _0x1895a6){const _0x5a1ad6=getAPIKey(_0xdb83c6);_0x5a1ad6&&(_0x14f4b8[_0x532b28(0x106)][_0xdb83c6]=_0x5a1ad6);}return _0x14f4b8;}
@@ -1 +1 @@
1
- function a42_0x48b1(){const _0x46e260=['__default_profile__','loadedAt','270MpMlaX','clear','now','2311820xgTqKL','5733870ztWJzF','685986qOnqHd','get','8gKQISZ','set','550808WymUZl','apiKey','delete','65906UlqMpL','2XPHmIC','5709663TKRCbU','39365uUjUQa'];a42_0x48b1=function(){return _0x46e260;};return a42_0x48b1();}(function(_0x5dd49c,_0x140560){const _0x1dbb30=a42_0xc878,_0x44a84c=_0x5dd49c();while(!![]){try{const _0x5cf285=-parseInt(_0x1dbb30(0x93))/0x1*(-parseInt(_0x1dbb30(0x94))/0x2)+parseInt(_0x1dbb30(0x9e))/0x3+parseInt(_0x1dbb30(0x90))/0x4+-parseInt(_0x1dbb30(0x96))/0x5*(parseInt(_0x1dbb30(0x99))/0x6)+parseInt(_0x1dbb30(0x9c))/0x7+-parseInt(_0x1dbb30(0xa0))/0x8*(parseInt(_0x1dbb30(0x95))/0x9)+parseInt(_0x1dbb30(0x9d))/0xa;if(_0x5cf285===_0x140560)break;else _0x44a84c['push'](_0x44a84c['shift']());}catch(_0x5ebc46){_0x44a84c['push'](_0x44a84c['shift']());}}}(a42_0x48b1,0x54c59));function a42_0xc878(_0x422824,_0x14fc96){const _0x48b1fb=a42_0x48b1();return a42_0xc878=function(_0xc8786d,_0x40d1d6){_0xc8786d=_0xc8786d-0x90;let _0x143d30=_0x48b1fb[_0xc8786d];return _0x143d30;},a42_0xc878(_0x422824,_0x14fc96);}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x5a4a15,_0x27c80d){const _0x40ef14=a42_0xc878,_0x2d97be=_0x5a4a15||'__default_site__',_0x5410db=_0x27c80d||_0x40ef14(0x97);return _0x2d97be+':'+_0x5410db;}export function getCachedCredential(_0x1c46a1,_0x7c24ce){const _0x1dce90=a42_0xc878,_0x513370=getCacheKey(_0x1c46a1,_0x7c24ce),_0x428b03=cache[_0x1dce90(0x9f)](_0x513370);if(!_0x428b03)return null;if(Date[_0x1dce90(0x9b)]()-_0x428b03[_0x1dce90(0x98)]>CACHE_TTL_MS)return cache[_0x1dce90(0x92)](_0x513370),null;return _0x428b03[_0x1dce90(0x91)];}export function setCachedCredential(_0x4b424a,_0x56fba2,_0x1f4d6f){const _0x24bbae=a42_0xc878,_0x4b6cc4=getCacheKey(_0x56fba2,_0x1f4d6f);cache[_0x24bbae(0xa1)](_0x4b6cc4,{'apiKey':_0x4b424a,'loadedAt':Date[_0x24bbae(0x9b)]()});}export function clearCredentialCache(){const _0x17edd7=a42_0xc878;cache[_0x17edd7(0x9a)]();}export function clearCachedCredential(_0x3cb46b,_0x15fd4a){const _0x2c147b=getCacheKey(_0x3cb46b,_0x15fd4a);cache['delete'](_0x2c147b);}
1
+ (function(_0x18dbb0,_0x1a4dd8){const _0x5aa6f0=a42_0x549c,_0x1335ac=_0x18dbb0();while(!![]){try{const _0x11a846=-parseInt(_0x5aa6f0(0xa6))/0x1*(-parseInt(_0x5aa6f0(0xad))/0x2)+-parseInt(_0x5aa6f0(0x9d))/0x3*(-parseInt(_0x5aa6f0(0xaf))/0x4)+-parseInt(_0x5aa6f0(0xac))/0x5*(-parseInt(_0x5aa6f0(0xa3))/0x6)+-parseInt(_0x5aa6f0(0x9e))/0x7*(parseInt(_0x5aa6f0(0xa1))/0x8)+parseInt(_0x5aa6f0(0xaa))/0x9*(-parseInt(_0x5aa6f0(0x9f))/0xa)+-parseInt(_0x5aa6f0(0xa2))/0xb*(parseInt(_0x5aa6f0(0xa7))/0xc)+parseInt(_0x5aa6f0(0xae))/0xd;if(_0x11a846===_0x1a4dd8)break;else _0x1335ac['push'](_0x1335ac['shift']());}catch(_0x3c22c9){_0x1335ac['push'](_0x1335ac['shift']());}}}(a42_0x5adb,0x5233d));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a42_0x549c(_0x462cc7,_0x5ea253){const _0x5adbe2=a42_0x5adb();return a42_0x549c=function(_0x549cdb,_0x1cad96){_0x549cdb=_0x549cdb-0x9d;let _0x555b66=_0x5adbe2[_0x549cdb];return _0x555b66;},a42_0x549c(_0x462cc7,_0x5ea253);}function getCacheKey(_0x315d48,_0x1997d6){const _0x177390=a42_0x549c,_0x8b9893=_0x315d48||_0x177390(0xa5),_0x3b6e66=_0x1997d6||'__default_profile__';return _0x8b9893+':'+_0x3b6e66;}function a42_0x5adb(){const _0x277a2f=['set','__default_site__','2tVMeGf','192000qTjaJi','delete','clear','198981WaXmkS','now','40aRvWoB','95908eSGvey','17288141fZBctc','776996XTozvq','apiKey','3WPCIgx','5628MrcPEd','250yXWlDP','loadedAt','3112KDjnGV','440KRYCWV','166626jOttoE'];a42_0x5adb=function(){return _0x277a2f;};return a42_0x5adb();}export function getCachedCredential(_0x9c4eed,_0x1e264a){const _0x1a6184=a42_0x549c,_0x4046db=getCacheKey(_0x9c4eed,_0x1e264a),_0x33e511=cache['get'](_0x4046db);if(!_0x33e511)return null;if(Date['now']()-_0x33e511[_0x1a6184(0xa0)]>CACHE_TTL_MS)return cache[_0x1a6184(0xa8)](_0x4046db),null;return _0x33e511[_0x1a6184(0xb0)];}export function setCachedCredential(_0x1b7a24,_0x3d228b,_0x479cea){const _0x570565=a42_0x549c,_0x319047=getCacheKey(_0x3d228b,_0x479cea);cache[_0x570565(0xa4)](_0x319047,{'apiKey':_0x1b7a24,'loadedAt':Date[_0x570565(0xab)]()});}export function clearCredentialCache(){const _0x38af3c=a42_0x549c;cache[_0x38af3c(0xa9)]();}export function clearCachedCredential(_0x157b23,_0x26012d){const _0x451bac=getCacheKey(_0x157b23,_0x26012d);cache['delete'](_0x451bac);}
@@ -1 +1 @@
1
- const a43_0x35e183=a43_0x4502;(function(_0xb67bd6,_0x187351){const _0x1a55b4=a43_0x4502,_0x36e592=_0xb67bd6();while(!![]){try{const _0x429e39=-parseInt(_0x1a55b4(0x152))/0x1+-parseInt(_0x1a55b4(0x15d))/0x2*(-parseInt(_0x1a55b4(0x140))/0x3)+-parseInt(_0x1a55b4(0x157))/0x4*(-parseInt(_0x1a55b4(0x147))/0x5)+parseInt(_0x1a55b4(0x158))/0x6+parseInt(_0x1a55b4(0x13a))/0x7*(-parseInt(_0x1a55b4(0x13f))/0x8)+parseInt(_0x1a55b4(0x14f))/0x9+parseInt(_0x1a55b4(0x137))/0xa*(parseInt(_0x1a55b4(0x151))/0xb);if(_0x429e39===_0x187351)break;else _0x36e592['push'](_0x36e592['shift']());}catch(_0x4f2c0e){_0x36e592['push'](_0x36e592['shift']());}}}(a43_0x383b,0x4790e));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a43_0x21bd06 from'node:fs';function a43_0x4502(_0x2ef1a4,_0x4ab257){const _0x383bcb=a43_0x383b();return a43_0x4502=function(_0x45024b,_0x51a963){_0x45024b=_0x45024b-0x137;let _0x15c3ce=_0x383bcb[_0x45024b];return _0x15c3ce;},a43_0x4502(_0x2ef1a4,_0x4ab257);}import*as a43_0x1425b0 from'node:path';function a43_0x383b(){const _0x58c71e=['logLevel','21450HFIIPT','llmProject','activeProfile','21GwyIwx','toString','(active)','.json','global','469624SdhYvV','276qohYQN','log','createAsync','segmentPath','config','[context]','CLI\x20flag:\x20--','305IiAFGi','INFO','resolveAPIKeyAsync','profile:\x20','verbose','Project','loadGlobalConfig','entries','94662mvEjRI','llm_project','1529HPRIld','540588MYREpc','string','Session','tdx.json','apiKey','13732VQSmWR','2216862giWDUc','parentSegment','sessionId','Profile','existsSync','2658hqcoUF','session','project',':\x20none','.env','injectIntoOptions','displayWithSources','cliFlags','utf-8','profile','Global\x20Credentials','configFiles','parent_segment','default','not\x20set','layers','join','profiles','site','Global','segment_path','Profile\x20Credentials','sessions','getParameters','database'];a43_0x383b=function(){return _0x58c71e;};return a43_0x383b();}export class GlobalContext{[a43_0x35e183(0x16f)];[a43_0x35e183(0x175)];[a43_0x35e183(0x169)];[a43_0x35e183(0x171)];['llm_project'];[a43_0x35e183(0x156)];[a43_0x35e183(0x14b)];[a43_0x35e183(0x176)];['profile'];['layers'];[a43_0x35e183(0x139)];[a43_0x35e183(0x15a)];[a43_0x35e183(0x168)];constructor(_0x2f4b0c){const _0x5f29cc=a43_0x35e183;this[_0x5f29cc(0x15a)]=_0x2f4b0c[_0x5f29cc(0x15e)]||getCurrentSessionPID()[_0x5f29cc(0x13b)]();const _0x3d6148=loadSessionContext(_0x2f4b0c[_0x5f29cc(0x15e)]),_0x186d72=loadProjectConfig(),_0x10ef9c=this[_0x5f29cc(0x14d)]();this['activeProfile']=_0x2f4b0c[_0x5f29cc(0x166)]||_0x3d6148?.[_0x5f29cc(0x166)]||_0x10ef9c[_0x5f29cc(0x166)]||getActiveProfile();const _0x3f6b97=this[_0x5f29cc(0x139)]?loadProfile(this[_0x5f29cc(0x139)]):null,_0x565912=_0x1fc425=>{const _0x39c14b=_0x5f29cc;if(!_0x1fc425)return{};const _0x5c3837=_0x1fc425,_0x3bf2f0={};for(const [_0x5d34d7,_0x33d592]of Object[_0x39c14b(0x14e)](_0x5c3837)){typeof _0x33d592===_0x39c14b(0x153)&&(_0x3bf2f0[_0x5d34d7]=_0x33d592);}return _0x3bf2f0;},_0x214e10={};if(_0x2f4b0c[_0x5f29cc(0x16f)]&&_0x2f4b0c['site']!=='us01')_0x214e10[_0x5f29cc(0x16f)]=_0x2f4b0c['site'];const _0x381a1d=_0x3d6148?.[_0x5f29cc(0x175)],_0x92bd28=_0x186d72?.[_0x5f29cc(0x175)],_0x27978c=_0x3f6b97?.['config']?.[_0x5f29cc(0x175)],_0x39a670=_0x10ef9c[_0x5f29cc(0x175)];_0x2f4b0c['database']&&(_0x2f4b0c['database']!==_0x381a1d&&_0x2f4b0c['database']!==_0x92bd28&&_0x2f4b0c[_0x5f29cc(0x175)]!==_0x27978c&&_0x2f4b0c[_0x5f29cc(0x175)]!==_0x39a670)&&(_0x214e10[_0x5f29cc(0x175)]=_0x2f4b0c['database']);if(_0x2f4b0c['parentSegment'])_0x214e10['parent_segment']=_0x2f4b0c[_0x5f29cc(0x159)];if(_0x2f4b0c[_0x5f29cc(0x138)])_0x214e10[_0x5f29cc(0x150)]=_0x2f4b0c[_0x5f29cc(0x138)];if(_0x2f4b0c[_0x5f29cc(0x166)])_0x214e10[_0x5f29cc(0x166)]=_0x2f4b0c[_0x5f29cc(0x166)];this['layers']={'cliFlags':_0x214e10,'session':_0x565912(_0x3d6148),'project':_0x565912(_0x186d72),'profile':_0x565912(_0x3f6b97?.[_0x5f29cc(0x144)]),'global':_0x565912(_0x10ef9c)};const _0x3c5bc0={...this[_0x5f29cc(0x16c)][_0x5f29cc(0x13e)],...this['layers'][_0x5f29cc(0x166)],...this['layers'][_0x5f29cc(0x15f)],...this[_0x5f29cc(0x16c)][_0x5f29cc(0x15e)],...this['layers'][_0x5f29cc(0x164)]},_0x19042a=_0x3c5bc0['site']||'us01';this['site']=resolveSite(_0x19042a),this[_0x5f29cc(0x175)]=_0x3c5bc0['database'],this['parent_segment']=_0x3c5bc0[_0x5f29cc(0x169)],this[_0x5f29cc(0x171)]=_0x3c5bc0['segment_path'],this['llm_project']=_0x3c5bc0[_0x5f29cc(0x150)],this[_0x5f29cc(0x14b)]=_0x2f4b0c[_0x5f29cc(0x14b)]||![],this[_0x5f29cc(0x176)]=_0x2f4b0c[_0x5f29cc(0x176)]??LogLevel[_0x5f29cc(0x148)],this[_0x5f29cc(0x166)]=this['activeProfile']||undefined,this['apiKey']=getAPIKey(this[_0x5f29cc(0x16f)],this[_0x5f29cc(0x139)]||undefined);const _0x1bb8e2=getConfigDir(),_0x59ed0c=a43_0x1425b0[_0x5f29cc(0x16d)](_0x1bb8e2,_0x5f29cc(0x173),this[_0x5f29cc(0x15a)]+_0x5f29cc(0x13d)),_0x46adfc=findProjectConfigPath(),_0x31f70c=a43_0x1425b0[_0x5f29cc(0x16d)](_0x1bb8e2,'tdx.json'),_0x562252=a43_0x1425b0['join'](_0x1bb8e2,_0x5f29cc(0x161));let _0x261d68=null,_0xa24258=null;this['activeProfile']&&(_0x261d68=a43_0x1425b0[_0x5f29cc(0x16d)](_0x1bb8e2,_0x5f29cc(0x16e),this[_0x5f29cc(0x139)],'tdx.json'),_0xa24258=a43_0x1425b0[_0x5f29cc(0x16d)](_0x1bb8e2,_0x5f29cc(0x16e),this[_0x5f29cc(0x139)],_0x5f29cc(0x161))),this[_0x5f29cc(0x168)]={'session':a43_0x21bd06[_0x5f29cc(0x15c)](_0x59ed0c)?_0x59ed0c:null,'project':_0x46adfc,'profile':_0x261d68&&a43_0x21bd06['existsSync'](_0x261d68)?_0x261d68:null,'profileCredentials':_0xa24258&&a43_0x21bd06[_0x5f29cc(0x15c)](_0xa24258)?_0xa24258:null,'global':a43_0x21bd06[_0x5f29cc(0x15c)](_0x31f70c)?_0x31f70c:null,'globalCredentials':a43_0x21bd06[_0x5f29cc(0x15c)](_0x562252)?_0x562252:null};}['getSource'](_0x581eae,_0x44babd){const _0x5b4610=a43_0x35e183;if(!_0x44babd)return _0x5b4610(0x16b);const _0x2a609e=_0x44babd;if(this['layers'][_0x5b4610(0x164)][_0x581eae]===_0x2a609e){if(_0x581eae===_0x5b4610(0x16f)&&_0x2a609e==='us01'&&!this[_0x5b4610(0x16c)][_0x5b4610(0x15e)][_0x5b4610(0x16f)]&&!this[_0x5b4610(0x16c)][_0x5b4610(0x15f)][_0x5b4610(0x16f)]&&!this[_0x5b4610(0x16c)][_0x5b4610(0x166)]['site']&&!this[_0x5b4610(0x16c)][_0x5b4610(0x13e)]['site'])return _0x5b4610(0x16a);return _0x5b4610(0x146)+_0x581eae['replace'](/_/g,'-');}if(this['layers'][_0x5b4610(0x15e)][_0x581eae]===_0x2a609e)return _0x5b4610(0x15e);if(this['layers'][_0x5b4610(0x15f)][_0x581eae]===_0x2a609e)return'project';if(this['layers'][_0x5b4610(0x166)][_0x581eae]===_0x2a609e)return _0x5b4610(0x14a)+this[_0x5b4610(0x139)];if(this['layers'][_0x5b4610(0x13e)][_0x581eae]===_0x2a609e)return _0x5b4610(0x13e);return _0x5b4610(0x16a);}[a43_0x35e183(0x14d)](){const _0x3bf12e=a43_0x35e183,_0x2ff4cc=a43_0x1425b0[_0x3bf12e(0x16d)](getConfigDir(),_0x3bf12e(0x155));if(!a43_0x21bd06[_0x3bf12e(0x15c)](_0x2ff4cc))return{};try{const _0x5d2190=a43_0x21bd06['readFileSync'](_0x2ff4cc,_0x3bf12e(0x165));return JSON['parse'](_0x5d2190);}catch{return{};}}[a43_0x35e183(0x162)](_0x48ee1a){const _0x45b153=a43_0x35e183;_0x48ee1a[_0x45b153(0x16f)]=this['site'],!_0x48ee1a[_0x45b153(0x175)]&&this[_0x45b153(0x175)]&&(_0x48ee1a[_0x45b153(0x175)]=this[_0x45b153(0x175)]),!_0x48ee1a[_0x45b153(0x159)]&&this[_0x45b153(0x169)]&&(_0x48ee1a[_0x45b153(0x159)]=this[_0x45b153(0x169)]),!_0x48ee1a[_0x45b153(0x143)]&&this[_0x45b153(0x171)]&&(_0x48ee1a[_0x45b153(0x143)]=this[_0x45b153(0x171)]),!_0x48ee1a[_0x45b153(0x138)]&&this[_0x45b153(0x150)]&&(_0x48ee1a[_0x45b153(0x138)]=this[_0x45b153(0x150)]);}[a43_0x35e183(0x174)](){const _0x4f4f89=a43_0x35e183;return[{'key':_0x4f4f89(0x16f),'value':this['site']},{'key':_0x4f4f89(0x175),'value':this[_0x4f4f89(0x175)]},{'key':_0x4f4f89(0x169),'value':this[_0x4f4f89(0x169)]},{'key':_0x4f4f89(0x171),'value':this[_0x4f4f89(0x171)]},{'key':_0x4f4f89(0x150),'value':this[_0x4f4f89(0x150)]},{'key':_0x4f4f89(0x166),'value':this['activeProfile']||undefined}];}['display'](){const _0x940f74=a43_0x35e183;console[_0x940f74(0x141)](_0x940f74(0x145));for(const {key:_0x193c60,value:_0x208c85}of this[_0x940f74(0x174)]()){_0x208c85&&console['log'](_0x193c60+':\x20'+_0x208c85);}}[a43_0x35e183(0x163)](){const _0x2fd288=a43_0x35e183;console[_0x2fd288(0x141)](_0x2fd288(0x145));for(const {key:_0x5575a9,value:_0x1e5042}of this[_0x2fd288(0x174)]()){if(_0x1e5042){const _0x4eb325=_0x5575a9===_0x2fd288(0x166)?_0x2fd288(0x13c):'('+this['getSource'](_0x5575a9,_0x1e5042)+')';console['log'](_0x5575a9+':\x20'+_0x1e5042+'\x20'+_0x4eb325);}}console[_0x2fd288(0x141)]('\x0a[configuration\x20files]');const _0x3cff14=[{'label':'Session','path':this[_0x2fd288(0x168)][_0x2fd288(0x15e)],'extra':'(session:\x20'+this[_0x2fd288(0x15a)]+')'},{'label':'Project','path':this[_0x2fd288(0x168)][_0x2fd288(0x15f)]},{'label':_0x2fd288(0x15b),'path':this[_0x2fd288(0x168)][_0x2fd288(0x166)]},{'label':_0x2fd288(0x172),'path':this['configFiles']['profileCredentials']},{'label':_0x2fd288(0x170),'path':this[_0x2fd288(0x168)]['global']},{'label':_0x2fd288(0x167),'path':this[_0x2fd288(0x168)]['globalCredentials']}];for(const {label:_0x5bc025,path:_0x5f0039,extra:_0x2f41f3}of _0x3cff14){if(_0x5f0039)console[_0x2fd288(0x141)](_0x5bc025+':\x20'+_0x5f0039+'\x20✓'+(_0x2f41f3?'\x20'+_0x2f41f3:''));else{if(_0x5bc025===_0x2fd288(0x154))console[_0x2fd288(0x141)](_0x5bc025+':\x20none\x20(using\x20session:\x20'+this[_0x2fd288(0x15a)]+')');else(_0x5bc025===_0x2fd288(0x14c)||_0x5bc025==='Global')&&console['log'](_0x5bc025+_0x2fd288(0x160));}}}async[a43_0x35e183(0x149)](){const _0x4b16ba=a43_0x35e183;return this[_0x4b16ba(0x156)]=await getAPIKeyAsync(this[_0x4b16ba(0x16f)],this['activeProfile']||undefined),this[_0x4b16ba(0x156)];}static async[a43_0x35e183(0x142)](_0xc45d30){const _0x2d716e=a43_0x35e183,_0x182ecf=new GlobalContext(_0xc45d30);return await _0x182ecf[_0x2d716e(0x149)](),_0x182ecf;}}
1
+ function a43_0x4110(){const _0x394592=['parse','getSource','58670zYJBPJ','getParameters','project','tdx.json','728TxWRBh',':\x20none\x20(using\x20session:\x20','configFiles','6430176cpqsZj','layers','resolveAPIKeyAsync','(session:\x20','existsSync','globalCredentials','llm_project','INFO','default','log','Profile','loadGlobalConfig','profileCredentials','\x0a[configuration\x20files]','entries','4781RXIRfM','profile:\x20','global','Global\x20Credentials','parentSegment','.json','[context]','7047PjJTOK','cliFlags','config','injectIntoOptions','(active)','397426vGDRFf','174lQDfRt','882288fKEsQx','parent_segment','not\x20set','sessionId','join','25083230TgFBEz','readFileSync','.env','profiles','llmProject','replace','site','segment_path','logLevel','activeProfile','profile','Profile\x20Credentials','apiKey','session','us01','segmentPath','display','236FIfrtD','database','string','Session','Global','verbose','Project'];a43_0x4110=function(){return _0x394592;};return a43_0x4110();}const a43_0x6a9d13=a43_0x43c1;(function(_0x22f43e,_0x18327f){const _0xebfd00=a43_0x43c1,_0x350cf0=_0x22f43e();while(!![]){try{const _0xf8fa50=-parseInt(_0xebfd00(0x1f4))/0x1+-parseInt(_0xebfd00(0x1f5))/0x2*(parseInt(_0xebfd00(0x1ef))/0x3)+-parseInt(_0xebfd00(0x1c9))/0x4*(parseInt(_0xebfd00(0x1d2))/0x5)+-parseInt(_0xebfd00(0x1f6))/0x6+parseInt(_0xebfd00(0x1e8))/0x7*(parseInt(_0xebfd00(0x1d6))/0x8)+-parseInt(_0xebfd00(0x1d9))/0x9+parseInt(_0xebfd00(0x1b8))/0xa;if(_0xf8fa50===_0x18327f)break;else _0x350cf0['push'](_0x350cf0['shift']());}catch(_0x7b4ade){_0x350cf0['push'](_0x350cf0['shift']());}}}(a43_0x4110,0x65495));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';function a43_0x43c1(_0x982a51,_0x319e23){const _0x4110cf=a43_0x4110();return a43_0x43c1=function(_0x43c1fd,_0x2095b5){_0x43c1fd=_0x43c1fd-0x1b5;let _0x3a6641=_0x4110cf[_0x43c1fd];return _0x3a6641;},a43_0x43c1(_0x982a51,_0x319e23);}import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a43_0x27884a from'node:fs';import*as a43_0x451732 from'node:path';export class GlobalContext{[a43_0x6a9d13(0x1be)];['database'];[a43_0x6a9d13(0x1f7)];[a43_0x6a9d13(0x1bf)];[a43_0x6a9d13(0x1df)];['apiKey'];[a43_0x6a9d13(0x1ce)];[a43_0x6a9d13(0x1c0)];['profile'];[a43_0x6a9d13(0x1da)];[a43_0x6a9d13(0x1c1)];[a43_0x6a9d13(0x1b6)];[a43_0x6a9d13(0x1d8)];constructor(_0x1e1309){const _0x402661=a43_0x6a9d13;this[_0x402661(0x1b6)]=_0x1e1309['session']||getCurrentSessionPID()['toString']();const _0x1bba40=loadSessionContext(_0x1e1309[_0x402661(0x1c5)]),_0x4aadbd=loadProjectConfig(),_0x4bfbbc=this[_0x402661(0x1e4)]();this[_0x402661(0x1c1)]=_0x1e1309[_0x402661(0x1c2)]||_0x1bba40?.[_0x402661(0x1c2)]||_0x4bfbbc[_0x402661(0x1c2)]||getActiveProfile();const _0x47cdce=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x22ca1e=_0x57cd28=>{const _0x331ce2=_0x402661;if(!_0x57cd28)return{};const _0x1afbf8=_0x57cd28,_0x40fdcc={};for(const [_0x586d2d,_0x1321f1]of Object[_0x331ce2(0x1e7)](_0x1afbf8)){typeof _0x1321f1===_0x331ce2(0x1cb)&&(_0x40fdcc[_0x586d2d]=_0x1321f1);}return _0x40fdcc;},_0x5e3c4a={};if(_0x1e1309[_0x402661(0x1be)]&&_0x1e1309[_0x402661(0x1be)]!==_0x402661(0x1c6))_0x5e3c4a[_0x402661(0x1be)]=_0x1e1309['site'];const _0x45c406=_0x1bba40?.[_0x402661(0x1ca)],_0x17a19d=_0x4aadbd?.[_0x402661(0x1ca)],_0x31b3c4=_0x47cdce?.['config']?.[_0x402661(0x1ca)],_0x449116=_0x4bfbbc[_0x402661(0x1ca)];_0x1e1309[_0x402661(0x1ca)]&&(_0x1e1309[_0x402661(0x1ca)]!==_0x45c406&&_0x1e1309['database']!==_0x17a19d&&_0x1e1309[_0x402661(0x1ca)]!==_0x31b3c4&&_0x1e1309[_0x402661(0x1ca)]!==_0x449116)&&(_0x5e3c4a[_0x402661(0x1ca)]=_0x1e1309[_0x402661(0x1ca)]);if(_0x1e1309['parentSegment'])_0x5e3c4a['parent_segment']=_0x1e1309[_0x402661(0x1ec)];if(_0x1e1309[_0x402661(0x1bc)])_0x5e3c4a['llm_project']=_0x1e1309['llmProject'];if(_0x1e1309[_0x402661(0x1c2)])_0x5e3c4a[_0x402661(0x1c2)]=_0x1e1309['profile'];this[_0x402661(0x1da)]={'cliFlags':_0x5e3c4a,'session':_0x22ca1e(_0x1bba40),'project':_0x22ca1e(_0x4aadbd),'profile':_0x22ca1e(_0x47cdce?.[_0x402661(0x1f1)]),'global':_0x22ca1e(_0x4bfbbc)};const _0x30abd3={...this[_0x402661(0x1da)][_0x402661(0x1ea)],...this[_0x402661(0x1da)]['profile'],...this[_0x402661(0x1da)][_0x402661(0x1d4)],...this[_0x402661(0x1da)][_0x402661(0x1c5)],...this[_0x402661(0x1da)][_0x402661(0x1f0)]},_0x4867e9=_0x30abd3[_0x402661(0x1be)]||_0x402661(0x1c6);this[_0x402661(0x1be)]=resolveSite(_0x4867e9),this[_0x402661(0x1ca)]=_0x30abd3[_0x402661(0x1ca)],this['parent_segment']=_0x30abd3[_0x402661(0x1f7)],this[_0x402661(0x1bf)]=_0x30abd3[_0x402661(0x1bf)],this[_0x402661(0x1df)]=_0x30abd3[_0x402661(0x1df)],this['verbose']=_0x1e1309[_0x402661(0x1ce)]||![],this[_0x402661(0x1c0)]=_0x1e1309['logLevel']??LogLevel[_0x402661(0x1e0)],this[_0x402661(0x1c2)]=this[_0x402661(0x1c1)]||undefined,this[_0x402661(0x1c4)]=getAPIKey(this[_0x402661(0x1be)],this[_0x402661(0x1c1)]||undefined);const _0x2009b3=getConfigDir(),_0x107407=a43_0x451732[_0x402661(0x1b7)](_0x2009b3,'sessions',this['sessionId']+_0x402661(0x1ed)),_0x2a089e=findProjectConfigPath(),_0x2955da=a43_0x451732['join'](_0x2009b3,_0x402661(0x1d5)),_0xe244d2=a43_0x451732[_0x402661(0x1b7)](_0x2009b3,_0x402661(0x1ba));let _0x2b4c99=null,_0x2360d0=null;this[_0x402661(0x1c1)]&&(_0x2b4c99=a43_0x451732[_0x402661(0x1b7)](_0x2009b3,_0x402661(0x1bb),this[_0x402661(0x1c1)],_0x402661(0x1d5)),_0x2360d0=a43_0x451732[_0x402661(0x1b7)](_0x2009b3,'profiles',this[_0x402661(0x1c1)],_0x402661(0x1ba))),this[_0x402661(0x1d8)]={'session':a43_0x27884a['existsSync'](_0x107407)?_0x107407:null,'project':_0x2a089e,'profile':_0x2b4c99&&a43_0x27884a[_0x402661(0x1dd)](_0x2b4c99)?_0x2b4c99:null,'profileCredentials':_0x2360d0&&a43_0x27884a[_0x402661(0x1dd)](_0x2360d0)?_0x2360d0:null,'global':a43_0x27884a[_0x402661(0x1dd)](_0x2955da)?_0x2955da:null,'globalCredentials':a43_0x27884a[_0x402661(0x1dd)](_0xe244d2)?_0xe244d2:null};}[a43_0x6a9d13(0x1d1)](_0x40a14c,_0x3f1519){const _0x29c543=a43_0x6a9d13;if(!_0x3f1519)return _0x29c543(0x1b5);const _0x3b9f2c=_0x3f1519;if(this[_0x29c543(0x1da)][_0x29c543(0x1f0)][_0x40a14c]===_0x3b9f2c){if(_0x40a14c==='site'&&_0x3b9f2c===_0x29c543(0x1c6)&&!this[_0x29c543(0x1da)][_0x29c543(0x1c5)]['site']&&!this[_0x29c543(0x1da)][_0x29c543(0x1d4)]['site']&&!this[_0x29c543(0x1da)][_0x29c543(0x1c2)]['site']&&!this[_0x29c543(0x1da)][_0x29c543(0x1ea)][_0x29c543(0x1be)])return _0x29c543(0x1e1);return'CLI\x20flag:\x20--'+_0x40a14c[_0x29c543(0x1bd)](/_/g,'-');}if(this['layers'][_0x29c543(0x1c5)][_0x40a14c]===_0x3b9f2c)return _0x29c543(0x1c5);if(this[_0x29c543(0x1da)]['project'][_0x40a14c]===_0x3b9f2c)return _0x29c543(0x1d4);if(this[_0x29c543(0x1da)][_0x29c543(0x1c2)][_0x40a14c]===_0x3b9f2c)return _0x29c543(0x1e9)+this[_0x29c543(0x1c1)];if(this[_0x29c543(0x1da)]['global'][_0x40a14c]===_0x3b9f2c)return _0x29c543(0x1ea);return _0x29c543(0x1e1);}[a43_0x6a9d13(0x1e4)](){const _0x238856=a43_0x6a9d13,_0x43d2b2=a43_0x451732[_0x238856(0x1b7)](getConfigDir(),_0x238856(0x1d5));if(!a43_0x27884a[_0x238856(0x1dd)](_0x43d2b2))return{};try{const _0x512de0=a43_0x27884a[_0x238856(0x1b9)](_0x43d2b2,'utf-8');return JSON[_0x238856(0x1d0)](_0x512de0);}catch{return{};}}[a43_0x6a9d13(0x1f2)](_0x4e3cbf){const _0x4a34fb=a43_0x6a9d13;_0x4e3cbf['site']=this[_0x4a34fb(0x1be)],!_0x4e3cbf['database']&&this[_0x4a34fb(0x1ca)]&&(_0x4e3cbf[_0x4a34fb(0x1ca)]=this[_0x4a34fb(0x1ca)]),!_0x4e3cbf['parentSegment']&&this[_0x4a34fb(0x1f7)]&&(_0x4e3cbf[_0x4a34fb(0x1ec)]=this[_0x4a34fb(0x1f7)]),!_0x4e3cbf[_0x4a34fb(0x1c7)]&&this[_0x4a34fb(0x1bf)]&&(_0x4e3cbf['segmentPath']=this[_0x4a34fb(0x1bf)]),!_0x4e3cbf[_0x4a34fb(0x1bc)]&&this[_0x4a34fb(0x1df)]&&(_0x4e3cbf[_0x4a34fb(0x1bc)]=this[_0x4a34fb(0x1df)]);}[a43_0x6a9d13(0x1d3)](){const _0xdc7488=a43_0x6a9d13;return[{'key':_0xdc7488(0x1be),'value':this['site']},{'key':_0xdc7488(0x1ca),'value':this[_0xdc7488(0x1ca)]},{'key':_0xdc7488(0x1f7),'value':this[_0xdc7488(0x1f7)]},{'key':_0xdc7488(0x1bf),'value':this['segment_path']},{'key':_0xdc7488(0x1df),'value':this[_0xdc7488(0x1df)]},{'key':'profile','value':this[_0xdc7488(0x1c1)]||undefined}];}[a43_0x6a9d13(0x1c8)](){const _0x567905=a43_0x6a9d13;console['log'](_0x567905(0x1ee));for(const {key:_0x40f4dd,value:_0xe296f0}of this[_0x567905(0x1d3)]()){_0xe296f0&&console[_0x567905(0x1e2)](_0x40f4dd+':\x20'+_0xe296f0);}}['displayWithSources'](){const _0x2cf765=a43_0x6a9d13;console['log']('[context]');for(const {key:_0x72c70a,value:_0xf4b04f}of this[_0x2cf765(0x1d3)]()){if(_0xf4b04f){const _0x13f98c=_0x72c70a===_0x2cf765(0x1c2)?_0x2cf765(0x1f3):'('+this[_0x2cf765(0x1d1)](_0x72c70a,_0xf4b04f)+')';console[_0x2cf765(0x1e2)](_0x72c70a+':\x20'+_0xf4b04f+'\x20'+_0x13f98c);}}console[_0x2cf765(0x1e2)](_0x2cf765(0x1e6));const _0x44e29f=[{'label':'Session','path':this[_0x2cf765(0x1d8)][_0x2cf765(0x1c5)],'extra':_0x2cf765(0x1dc)+this['sessionId']+')'},{'label':_0x2cf765(0x1cf),'path':this['configFiles'][_0x2cf765(0x1d4)]},{'label':_0x2cf765(0x1e3),'path':this['configFiles'][_0x2cf765(0x1c2)]},{'label':_0x2cf765(0x1c3),'path':this[_0x2cf765(0x1d8)][_0x2cf765(0x1e5)]},{'label':_0x2cf765(0x1cd),'path':this[_0x2cf765(0x1d8)][_0x2cf765(0x1ea)]},{'label':_0x2cf765(0x1eb),'path':this[_0x2cf765(0x1d8)][_0x2cf765(0x1de)]}];for(const {label:_0x55bd08,path:_0x2da4f8,extra:_0x52c35}of _0x44e29f){if(_0x2da4f8)console[_0x2cf765(0x1e2)](_0x55bd08+':\x20'+_0x2da4f8+'\x20✓'+(_0x52c35?'\x20'+_0x52c35:''));else{if(_0x55bd08===_0x2cf765(0x1cc))console[_0x2cf765(0x1e2)](_0x55bd08+_0x2cf765(0x1d7)+this[_0x2cf765(0x1b6)]+')');else(_0x55bd08===_0x2cf765(0x1cf)||_0x55bd08==='Global')&&console['log'](_0x55bd08+':\x20none');}}}async['resolveAPIKeyAsync'](){const _0x1ae939=a43_0x6a9d13;return this[_0x1ae939(0x1c4)]=await getAPIKeyAsync(this['site'],this[_0x1ae939(0x1c1)]||undefined),this['apiKey'];}static async['createAsync'](_0xc333b8){const _0x3c18cd=a43_0x6a9d13,_0xfbaa45=new GlobalContext(_0xc333b8);return await _0xfbaa45[_0x3c18cd(0x1db)](),_0xfbaa45;}}
@@ -1 +1 @@
1
- const a44_0x5ec3b1=a44_0x5f16;(function(_0x448942,_0x1ff78c){const _0x153795=a44_0x5f16,_0x5b0227=_0x448942();while(!![]){try{const _0x28c676=-parseInt(_0x153795(0x131))/0x1*(parseInt(_0x153795(0x130))/0x2)+parseInt(_0x153795(0x12e))/0x3+parseInt(_0x153795(0x12f))/0x4*(parseInt(_0x153795(0x127))/0x5)+parseInt(_0x153795(0x11f))/0x6*(-parseInt(_0x153795(0x13d))/0x7)+-parseInt(_0x153795(0x129))/0x8*(parseInt(_0x153795(0x122))/0x9)+parseInt(_0x153795(0x12a))/0xa+-parseInt(_0x153795(0x124))/0xb*(-parseInt(_0x153795(0x135))/0xc);if(_0x28c676===_0x1ff78c)break;else _0x5b0227['push'](_0x5b0227['shift']());}catch(_0xd49f6d){_0x5b0227['push'](_0x5b0227['shift']());}}}(a44_0x3cc1,0xe6ae9));const SERVICE_NAME=a44_0x5ec3b1(0x133);function a44_0x5f16(_0x25c075,_0x4b3889){const _0x3cc12a=a44_0x3cc1();return a44_0x5f16=function(_0x5f1688,_0x3f7bd1){_0x5f1688=_0x5f1688-0x11f;let _0x49e6aa=_0x3cc12a[_0x5f1688];return _0x49e6aa;},a44_0x5f16(_0x25c075,_0x4b3889);}let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x3ab657=a44_0x5ec3b1;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x2276a8=await import(_0x3ab657(0x121));return keyringModule=_0x2276a8['keyring'],keyringModule;}catch(_0x458eba){return keyringLoadError=_0x458eba instanceof Error?_0x458eba:new Error(String(_0x458eba)),null;}}function getAccountName(_0xaaefc){const _0xc1be86=a44_0x5ec3b1,_0x4f7ad7=_0xaaefc||'';return _0xc1be86(0x136)+_0x4f7ad7+':api_key';}function a44_0x3cc1(){const _0x4e0440=['425208qovbUh','12eWjqCf','158714tsCSXZ','17VqqQUk','success','tdx','not\x20found','348iKefQs','profile:','toLowerCase','-25300','cannot\x20find','deletePassword','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.','includes','7VXltvj','message','-25293','setPassword','4050672Irnagc','unavailable','@zowe/secrets-for-zowe-sdk','289908aBicUY','System\x20keychain\x20is\x20not\x20available','1127544vVOVwY','reason','not_found','253480MWfmmS','Warning:\x20','208ajpzGr','5401260BBVbHS','access','getPassword','not\x20supported'];a44_0x3cc1=function(){return _0x4e0440;};return a44_0x3cc1();}export async function getKeychainAPIKey(_0x1a95e6){const _0x45b52f=a44_0x5ec3b1,_0x1411b5=await getKeychainAPIKeyWithStatus(_0x1a95e6);if(_0x1411b5[_0x45b52f(0x132)])return _0x1411b5['value'];return _0x1411b5[_0x45b52f(0x125)]==='access_denied'&&console['error'](_0x45b52f(0x128)+_0x1411b5[_0x45b52f(0x13e)]),null;}export async function getKeychainAPIKeyWithStatus(_0x4b6bfa){const _0x1e6925=a44_0x5ec3b1;try{const _0x3bcf1a=await getKeyring();if(!_0x3bcf1a)return{'success':![],'reason':_0x1e6925(0x120)};const _0x49833a=getAccountName(_0x4b6bfa),_0x4234e1=await _0x3bcf1a[_0x1e6925(0x12c)](SERVICE_NAME,_0x49833a);if(_0x4234e1)return{'success':!![],'value':_0x4234e1};return{'success':![],'reason':'not_found'};}catch(_0x334997){const _0x253275=_0x334997 instanceof Error?_0x334997[_0x1e6925(0x13e)]:String(_0x334997);if(_0x253275[_0x1e6925(0x13c)](_0x1e6925(0x138))||_0x253275[_0x1e6925(0x137)]()['includes']('could\x20not\x20be\x20found')||_0x253275[_0x1e6925(0x137)]()[_0x1e6925(0x13c)](_0x1e6925(0x134)))return{'success':![],'reason':_0x1e6925(0x126)};if(_0x253275[_0x1e6925(0x13c)](_0x1e6925(0x13f))||_0x253275[_0x1e6925(0x137)]()[_0x1e6925(0x13c)]('restricted')||_0x253275[_0x1e6925(0x137)]()[_0x1e6925(0x13c)](_0x1e6925(0x12b)))return{'success':![],'reason':'access_denied','message':_0x1e6925(0x13b)};return{'success':![],'reason':'unavailable','message':_0x253275};}}export async function saveKeychainAPIKey(_0x181566,_0x19636c){const _0x3fa973=a44_0x5ec3b1,_0x38ff89=await getKeyring();if(!_0x38ff89)throw new Error(_0x3fa973(0x123));const _0x18830c=getAccountName(_0x19636c);await _0x38ff89[_0x3fa973(0x140)](SERVICE_NAME,_0x18830c,_0x181566);}export async function deleteKeychainAPIKey(_0xf8d4f0){const _0x133a06=a44_0x5ec3b1;try{const _0x11f108=await getKeyring();if(!_0x11f108)return![];const _0x36d1d9=getAccountName(_0xf8d4f0);return await _0x11f108[_0x133a06(0x13a)](SERVICE_NAME,_0x36d1d9);}catch{return![];}}export async function isKeychainAvailable(){const _0xfdd3c1=a44_0x5ec3b1;try{const _0x392bc6=await getKeyring();if(!_0x392bc6)return![];return await _0x392bc6['getPassword'](SERVICE_NAME,'__keychain_test__'),!![];}catch(_0x3bf822){const _0x41e550=_0x3bf822 instanceof Error?_0x3bf822[_0xfdd3c1(0x13e)][_0xfdd3c1(0x137)]():'';if(_0x41e550[_0xfdd3c1(0x13c)]('not\x20available')||_0x41e550[_0xfdd3c1(0x13c)](_0xfdd3c1(0x12d))||_0x41e550[_0xfdd3c1(0x13c)](_0xfdd3c1(0x139)))return![];return!![];}}
1
+ const a44_0x2d88bd=a44_0x2b9b;(function(_0x3a3e77,_0x1757db){const _0x32aa0f=a44_0x2b9b,_0x5101f5=_0x3a3e77();while(!![]){try{const _0x35a414=-parseInt(_0x32aa0f(0x97))/0x1*(-parseInt(_0x32aa0f(0xa8))/0x2)+parseInt(_0x32aa0f(0x9a))/0x3*(parseInt(_0x32aa0f(0x8e))/0x4)+parseInt(_0x32aa0f(0x94))/0x5*(-parseInt(_0x32aa0f(0xa1))/0x6)+parseInt(_0x32aa0f(0xa2))/0x7*(parseInt(_0x32aa0f(0x92))/0x8)+-parseInt(_0x32aa0f(0x87))/0x9*(parseInt(_0x32aa0f(0x99))/0xa)+parseInt(_0x32aa0f(0x89))/0xb+-parseInt(_0x32aa0f(0x9e))/0xc*(-parseInt(_0x32aa0f(0x90))/0xd);if(_0x35a414===_0x1757db)break;else _0x5101f5['push'](_0x5101f5['shift']());}catch(_0x11a71a){_0x5101f5['push'](_0x5101f5['shift']());}}}(a44_0x3c52,0x1cf47));const SERVICE_NAME=a44_0x2d88bd(0xa4);let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x35b9d1=a44_0x2d88bd;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x575506=await import(_0x35b9d1(0x9b));return keyringModule=_0x575506[_0x35b9d1(0x8f)],keyringModule;}catch(_0x2c56b7){return keyringLoadError=_0x2c56b7 instanceof Error?_0x2c56b7:new Error(String(_0x2c56b7)),null;}}function getAccountName(_0x5dda63){const _0x2f17ed=a44_0x2d88bd,_0x7a7a9e=_0x5dda63||'';return _0x2f17ed(0xa0)+_0x7a7a9e+_0x2f17ed(0xa3);}function a44_0x3c52(){const _0x2a88f5=['unavailable','38249zStVBp','includes','130oaUGvd','3xvtkQe','@zowe/secrets-for-zowe-sdk','not\x20supported','Warning:\x20','3996rKcHqX','toLowerCase','profile:','366LRzarB','14vtLofc',':api_key','tdx','deletePassword','setPassword','message','6VlfDah','value','restricted','could\x20not\x20be\x20found','108873EnWbrA','cannot\x20find','872069wHaJDj','error','getPassword','success','access_denied','642244laLFFx','keyring','1950PeocoP','System\x20keychain\x20is\x20not\x20available','202408JkVFTb','-25300','14695xhEBND','access'];a44_0x3c52=function(){return _0x2a88f5;};return a44_0x3c52();}export async function getKeychainAPIKey(_0x5da976){const _0x156a8d=a44_0x2d88bd,_0x51cbec=await getKeychainAPIKeyWithStatus(_0x5da976);if(_0x51cbec[_0x156a8d(0x8c)])return _0x51cbec[_0x156a8d(0xa9)];return _0x51cbec['reason']===_0x156a8d(0x8d)&&console[_0x156a8d(0x8a)](_0x156a8d(0x9d)+_0x51cbec[_0x156a8d(0xa7)]),null;}export async function getKeychainAPIKeyWithStatus(_0x3f1aaf){const _0x404aea=a44_0x2d88bd;try{const _0x195454=await getKeyring();if(!_0x195454)return{'success':![],'reason':_0x404aea(0x96)};const _0x38d523=getAccountName(_0x3f1aaf),_0x45c358=await _0x195454[_0x404aea(0x8b)](SERVICE_NAME,_0x38d523);if(_0x45c358)return{'success':!![],'value':_0x45c358};return{'success':![],'reason':'not_found'};}catch(_0x487df2){const _0xbd6164=_0x487df2 instanceof Error?_0x487df2[_0x404aea(0xa7)]:String(_0x487df2);if(_0xbd6164[_0x404aea(0x98)](_0x404aea(0x93))||_0xbd6164[_0x404aea(0x9f)]()['includes'](_0x404aea(0x86))||_0xbd6164[_0x404aea(0x9f)]()[_0x404aea(0x98)]('not\x20found'))return{'success':![],'reason':'not_found'};if(_0xbd6164[_0x404aea(0x98)]('-25293')||_0xbd6164[_0x404aea(0x9f)]()[_0x404aea(0x98)](_0x404aea(0x85))||_0xbd6164[_0x404aea(0x9f)]()['includes'](_0x404aea(0x95)))return{'success':![],'reason':_0x404aea(0x8d),'message':'Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.'};return{'success':![],'reason':_0x404aea(0x96),'message':_0xbd6164};}}export async function saveKeychainAPIKey(_0xbc1e35,_0x5baf39){const _0x47fba7=a44_0x2d88bd,_0x409147=await getKeyring();if(!_0x409147)throw new Error(_0x47fba7(0x91));const _0x24e322=getAccountName(_0x5baf39);await _0x409147[_0x47fba7(0xa6)](SERVICE_NAME,_0x24e322,_0xbc1e35);}export async function deleteKeychainAPIKey(_0x3047ab){const _0x4627f4=a44_0x2d88bd;try{const _0x4ae2c7=await getKeyring();if(!_0x4ae2c7)return![];const _0x1d416a=getAccountName(_0x3047ab);return await _0x4ae2c7[_0x4627f4(0xa5)](SERVICE_NAME,_0x1d416a);}catch{return![];}}function a44_0x2b9b(_0x38bea0,_0x27b65b){const _0x3c52c3=a44_0x3c52();return a44_0x2b9b=function(_0x2b9b9f,_0x2bd699){_0x2b9b9f=_0x2b9b9f-0x85;let _0x41d950=_0x3c52c3[_0x2b9b9f];return _0x41d950;},a44_0x2b9b(_0x38bea0,_0x27b65b);}export async function isKeychainAvailable(){const _0x394302=a44_0x2d88bd;try{const _0x540d5c=await getKeyring();if(!_0x540d5c)return![];return await _0x540d5c[_0x394302(0x8b)](SERVICE_NAME,'__keychain_test__'),!![];}catch(_0x109758){const _0xca3e5=_0x109758 instanceof Error?_0x109758[_0x394302(0xa7)][_0x394302(0x9f)]():'';if(_0xca3e5[_0x394302(0x98)]('not\x20available')||_0xca3e5[_0x394302(0x98)](_0x394302(0x9c))||_0xca3e5['includes'](_0x394302(0x88)))return![];return!![];}}
@@ -1 +1 @@
1
- (function(_0x4dee6a,_0xcbf1dd){const _0x1acead=a45_0x1e45,_0x3a1c11=_0x4dee6a();while(!![]){try{const _0x44e62e=parseInt(_0x1acead(0x1cb))/0x1*(parseInt(_0x1acead(0x1c8))/0x2)+-parseInt(_0x1acead(0x1db))/0x3+parseInt(_0x1acead(0x1e8))/0x4+parseInt(_0x1acead(0x1df))/0x5*(-parseInt(_0x1acead(0x1cc))/0x6)+parseInt(_0x1acead(0x1aa))/0x7+-parseInt(_0x1acead(0x1d7))/0x8+parseInt(_0x1acead(0x1de))/0x9;if(_0x44e62e===_0xcbf1dd)break;else _0x3a1c11['push'](_0x3a1c11['shift']());}catch(_0x3140ca){_0x3a1c11['push'](_0x3a1c11['shift']());}}}(a45_0x5de1,0xcfd87));import*as a45_0x545922 from'node:fs';import*as a45_0x525f79 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';function a45_0x1e45(_0x4ab8c9,_0x6e7716){const _0x5de197=a45_0x5de1();return a45_0x1e45=function(_0x1e4536,_0x120ccf){_0x1e4536=_0x1e4536-0x19b;let _0x3c6c97=_0x5de197[_0x1e4536];return _0x3c6c97;},a45_0x1e45(_0x4ab8c9,_0x6e7716);}export function getProfileParams(_0xc308f1){const _0x220654=a45_0x1e45,_0x2ebc34={};if(!_0xc308f1)return _0x2ebc34;for(const [_0x110739,_0x422157]of Object['entries'](_0xc308f1)){_0x110739!==_0x220654(0x1c5)&&_0x422157!==undefined&&(_0x2ebc34[_0x110739]=_0x422157);}return _0x2ebc34;}function a45_0x5de1(){const _0x4954c0=['some','from','\x20\x20mv\x20\x22','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','localeCompare','Warning:\x20Profile\x20\x27','readdirSync','description','warn','test','2IQAlYT','parent_segment','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','574423SbvYyY','1374pUQjHa','user','Profile\x20','length','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','string','\x20already\x20exists','existsSync','set','map','.env.','13192792rHXZVM','database','site','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','3199848htUToo','\x27:\x20unknown\x20config\x20key\x20\x27','llm_project','14425434NRBAlz','29875GnRtAn','directory','.env','local','join','toISOString','tdx.json','entries','message','5496308bLxLXI','rmSync','parse','\x0aWarning:\x20Failed\x20to\x20parse\x20','\x27:\x20config\x20must\x20be\x20an\x20object','find','keys','stringify','llm_agent','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','Profile\x20\x27','profiles','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','\x20\x201.\x20Edit:\x20','push','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','9687993XCcXfr','profile','Error:\x20','To\x20migrate:','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','readFileSync','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','\x20does\x20not\x20exist','includes','values','\x27\x20will\x20be\x20ignored','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','Warning:\x20Failed\x20to\x20parse\x20','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','Invalid\x20profile\x20name:\x20','name','utf-8','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','filter'];a45_0x5de1=function(){return _0x4954c0;};return a45_0x5de1();}export function getProfilesDir(){const _0x48f9bd=a45_0x1e45;return a45_0x525f79[_0x48f9bd(0x1e3)](getConfigDir(),_0x48f9bd(0x1a5));}function getProfileDir(_0x21c92c){const _0x5bafb0=a45_0x1e45;return a45_0x525f79[_0x5bafb0(0x1e3)](getProfilesDir(),_0x21c92c);}function getProfileConfigPath(_0x179924){const _0x437b94=a45_0x1e45;return a45_0x525f79[_0x437b94(0x1e3)](getProfileDir(_0x179924),_0x437b94(0x1e5));}function getProfileEnvPath(_0x1d9877){const _0x5217d4=a45_0x1e45;return a45_0x525f79[_0x5217d4(0x1e3)](getProfileDir(_0x1d9877),_0x5217d4(0x1e1));}function getGlobalConfigPath(){const _0x1d38c2=a45_0x1e45;return a45_0x525f79[_0x1d38c2(0x1e3)](getConfigDir(),_0x1d38c2(0x1e5));}function validateProfileName(_0x35746b){const _0x128691=a45_0x1e45;if(!/^[a-zA-Z0-9_-]+$/[_0x128691(0x1c7)](_0x35746b))throw new Error(_0x128691(0x1b9)+_0x35746b+_0x128691(0x1da));}function validateProfileConfig(_0xac7825,_0x257ece){const _0x284040=a45_0x1e45;if(typeof _0xac7825!=='object'||_0xac7825===null)throw new Error(_0x284040(0x1a4)+_0x257ece+_0x284040(0x19e));const _0x32024d=[_0x284040(0x1c5),'site',_0x284040(0x1d8),_0x284040(0x1c9),_0x284040(0x1dd),'llm_agent'],_0x406729=_0xac7825;for(const _0xa3caae of Object[_0x284040(0x1a0)](_0x406729)){!_0x32024d[_0x284040(0x1b2)](_0xa3caae)&&console[_0x284040(0x1c6)](_0x284040(0x1c3)+_0x257ece+_0x284040(0x1dc)+_0xa3caae+_0x284040(0x1b4));}if(_0x406729['description']!==undefined&&typeof _0x406729[_0x284040(0x1c5)]!==_0x284040(0x1d1))throw new Error(_0x284040(0x1a4)+_0x257ece+_0x284040(0x1a3));if(_0x406729[_0x284040(0x1d9)]!==undefined&&typeof _0x406729[_0x284040(0x1d9)]!==_0x284040(0x1d1))throw new Error(_0x284040(0x1a4)+_0x257ece+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x406729['database']!==undefined&&typeof _0x406729[_0x284040(0x1d8)]!==_0x284040(0x1d1))throw new Error(_0x284040(0x1a4)+_0x257ece+_0x284040(0x1b5));if(_0x406729['parent_segment']!==undefined&&typeof _0x406729[_0x284040(0x1c9)]!=='string')throw new Error(_0x284040(0x1a4)+_0x257ece+_0x284040(0x1ae));if(_0x406729['llm_project']!==undefined&&typeof _0x406729[_0x284040(0x1dd)]!==_0x284040(0x1d1))throw new Error(_0x284040(0x1a4)+_0x257ece+_0x284040(0x1d0));if(_0x406729[_0x284040(0x1a2)]!==undefined&&typeof _0x406729[_0x284040(0x1a2)]!==_0x284040(0x1d1))throw new Error(_0x284040(0x1a4)+_0x257ece+_0x284040(0x1bc));return!![];}function loadProfilesFromTdxJson(_0x5cab48,_0x856291){const _0x477676=a45_0x1e45;if(!a45_0x545922[_0x477676(0x1d3)](_0x5cab48))return[];try{const _0x1f2af8=a45_0x545922[_0x477676(0x1af)](_0x5cab48,_0x477676(0x1bb)),_0x24ad8f=JSON['parse'](_0x1f2af8);if(!_0x24ad8f[_0x477676(0x1a5)]||typeof _0x24ad8f[_0x477676(0x1a5)]!=='object')return[];const _0x2e5881=[];for(const [_0x13a9ff,_0x53c745]of Object[_0x477676(0x1e6)](_0x24ad8f['profiles'])){try{validateProfileConfig(_0x53c745,_0x13a9ff);const _0x22c6a1=getNewCredentialPath(_0x13a9ff),_0x30df9a=getOldCredentialPath(_0x13a9ff),_0x3a2e51=a45_0x545922[_0x477676(0x1d3)](_0x22c6a1)||a45_0x545922[_0x477676(0x1d3)](_0x30df9a);_0x2e5881[_0x477676(0x1a8)]({'name':_0x13a9ff,'config':_0x53c745,'metadata':{'name':_0x13a9ff,'createdAt':new Date()[_0x477676(0x1e4)]()},'hasCredentials':_0x3a2e51,'scope':_0x856291});}catch(_0x142032){_0x142032 instanceof Error&&(console[_0x477676(0x1c6)](_0x477676(0x1b0)+_0x5cab48+':'),console[_0x477676(0x1c6)]('\x20\x20'+_0x142032[_0x477676(0x1e7)]+'\x0a'));}}return _0x2e5881;}catch(_0x45840b){return _0x45840b instanceof SyntaxError?(console[_0x477676(0x1c6)](_0x477676(0x19d)+_0x5cab48+':\x20Invalid\x20JSON\x20syntax'),console[_0x477676(0x1c6)](_0x477676(0x1ac)+_0x45840b[_0x477676(0x1e7)]+'\x0a')):console[_0x477676(0x1c6)](_0x477676(0x1a9)+_0x5cab48+':\x20'+_0x45840b+'\x0a'),[];}}export function getNewCredentialPath(_0x146a41){const _0x47b199=a45_0x1e45;return a45_0x525f79[_0x47b199(0x1e3)](getConfigDir(),_0x47b199(0x1d6)+_0x146a41);}function getOldCredentialPath(_0x3090f9){const _0xfda1b5=a45_0x1e45;return a45_0x525f79['join'](getProfilesDir(),_0x3090f9,_0xfda1b5(0x1e1));}function loadProfilesFromTdxJsonFiles(){const _0xa4cde9=a45_0x1e45,_0x3bdff0=[],_0x5af367=findProjectConfigPath();_0x5af367&&_0x3bdff0[_0xa4cde9(0x1a8)](...loadProfilesFromTdxJson(_0x5af367,_0xa4cde9(0x1e2)));const _0x18e7f4=a45_0x525f79[_0xa4cde9(0x1e3)](getConfigDir(),_0xa4cde9(0x1e5));return _0x3bdff0['push'](...loadProfilesFromTdxJson(_0x18e7f4,_0xa4cde9(0x1cd))),_0x3bdff0;}function loadProfilesFromDirectories(){const _0x390c9c=a45_0x1e45,_0x16b7cb=getProfilesDir();if(!a45_0x545922['existsSync'](_0x16b7cb))return[];try{return a45_0x545922[_0x390c9c(0x1c4)](_0x16b7cb,{'withFileTypes':!![]})['filter'](_0x5ecc38=>_0x5ecc38['isDirectory']())[_0x390c9c(0x1d5)](_0x1d2f6f=>_0x1d2f6f['name'])[_0x390c9c(0x1bd)](_0x2a0592=>{const _0x5d2050=_0x390c9c,_0x1a3e2e=getProfileConfigPath(_0x2a0592),_0x19c3a9=getProfileEnvPath(_0x2a0592);return a45_0x545922['existsSync'](_0x1a3e2e)||a45_0x545922[_0x5d2050(0x1d3)](_0x19c3a9);})[_0x390c9c(0x1d5)](_0x370090=>{const _0x33b7d5=loadProfileFromDirectory(_0x370090);if(_0x33b7d5)return{..._0x33b7d5,'scope':'directory'};return null;})['filter'](_0x428809=>_0x428809!==null);}catch{return[];}}function loadProfileFromDirectory(_0x107bb3){const _0x4a77d7=a45_0x1e45,_0x2b4cb4=getProfileConfigPath(_0x107bb3),_0x2191aa=getOldCredentialPath(_0x107bb3);if(!a45_0x545922[_0x4a77d7(0x1d3)](_0x2b4cb4)&&!a45_0x545922[_0x4a77d7(0x1d3)](_0x2191aa))return null;let _0xcf798={},_0x3fbf5c={'name':_0x107bb3,'createdAt':new Date()[_0x4a77d7(0x1e4)]()};if(a45_0x545922[_0x4a77d7(0x1d3)](_0x2b4cb4))try{const _0x56fb3a=a45_0x545922[_0x4a77d7(0x1af)](_0x2b4cb4,'utf-8'),_0x3f0a00=JSON[_0x4a77d7(0x19c)](_0x56fb3a),{metadata:_0x532f1a,..._0x163a6a}=_0x3f0a00;_0xcf798=_0x163a6a,_0x532f1a&&(_0x3fbf5c=_0x532f1a);}catch{}return{'name':_0x107bb3,'config':_0xcf798,'metadata':_0x3fbf5c,'hasCredentials':a45_0x545922[_0x4a77d7(0x1d3)](_0x2191aa),'scope':_0x4a77d7(0x1e0)};}export function listProfiles(){const _0x3ae13d=a45_0x1e45,_0x548b9c=loadProfilesFromTdxJsonFiles(),_0x54b7e0=loadProfilesFromDirectories();if(_0x54b7e0[_0x3ae13d(0x1cf)]>0x0){const _0x51c954=_0x54b7e0[_0x3ae13d(0x1d5)](_0x2f8885=>_0x2f8885['name'])[_0x3ae13d(0x1e3)](',\x20'),_0x40e947=getConfigDir();console[_0x3ae13d(0x1c6)](_0x3ae13d(0x1b7)+_0x51c954),console[_0x3ae13d(0x1c6)]('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x3ae13d(0x1c6)](_0x3ae13d(0x1a7)+a45_0x525f79[_0x3ae13d(0x1e3)](_0x40e947,_0x3ae13d(0x1e5))),console[_0x3ae13d(0x1c6)](_0x3ae13d(0x1c1)),console[_0x3ae13d(0x1c6)](_0x3ae13d(0x1a6));}const _0x5cdbbc=[..._0x548b9c,..._0x54b7e0],_0xaa2b06=new Map();for(const _0x5f032c of _0x5cdbbc){!_0xaa2b06['has'](_0x5f032c[_0x3ae13d(0x1ba)])&&_0xaa2b06[_0x3ae13d(0x1d4)](_0x5f032c[_0x3ae13d(0x1ba)],_0x5f032c);}return Array[_0x3ae13d(0x1bf)](_0xaa2b06[_0x3ae13d(0x1b3)]())['sort']((_0xd9cb93,_0xa302fa)=>_0xd9cb93[_0x3ae13d(0x1ba)][_0x3ae13d(0x1c2)](_0xa302fa[_0x3ae13d(0x1ba)]));}export function profileExists(_0x4bd45d){const _0x169442=a45_0x1e45,_0x3df0b5=listProfiles();return _0x3df0b5[_0x169442(0x1be)](_0x17204b=>_0x17204b[_0x169442(0x1ba)]===_0x4bd45d);}export function loadProfile(_0x1e6ab1){const _0x5b1111=a45_0x1e45;validateProfileName(_0x1e6ab1);const _0x44eab2=listProfiles(),_0x50d4e0=_0x44eab2[_0x5b1111(0x19f)](_0xe66009=>_0xe66009[_0x5b1111(0x1ba)]===_0x1e6ab1);return _0x50d4e0||null;}export function saveProfile(_0x42e48f,_0x2e4245,_0x8c869=![]){saveProfileToUserConfig(_0x42e48f,_0x2e4245);}export function deleteProfile(_0x531e74){const _0xb7b1a1=a45_0x1e45;validateProfileName(_0x531e74);const _0x38a9f6=getProfileDir(_0x531e74);if(!a45_0x545922[_0xb7b1a1(0x1d3)](_0x38a9f6))throw new Error('Profile\x20'+_0x531e74+_0xb7b1a1(0x1b1));a45_0x545922[_0xb7b1a1(0x19b)](_0x38a9f6,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x26d71b,_0x52db55){const _0x28f1a6=a45_0x1e45;validateProfileName(_0x26d71b);const _0x480c81=getGlobalConfigPath(),_0xf461db=getConfigDir();!a45_0x545922['existsSync'](_0xf461db)&&createSecureDirectory(_0xf461db);let _0x5c348e={};if(a45_0x545922[_0x28f1a6(0x1d3)](_0x480c81))try{const _0x24f564=a45_0x545922[_0x28f1a6(0x1af)](_0x480c81,_0x28f1a6(0x1bb));_0x5c348e=JSON[_0x28f1a6(0x19c)](_0x24f564);}catch{console[_0x28f1a6(0x1c6)](_0x28f1a6(0x1b6)+_0x480c81+',\x20creating\x20new\x20file');}!_0x5c348e['profiles']&&(_0x5c348e[_0x28f1a6(0x1a5)]={}),_0x5c348e['profiles'][_0x26d71b]=_0x52db55,writeSecureFile(_0x480c81,JSON[_0x28f1a6(0x1a1)](_0x5c348e,null,0x2));}export function getActiveProfile(){const _0xc6e4c9=a45_0x1e45,_0x29cddd=loadSessionContext();if(_0x29cddd?.['profile'])return _0x29cddd[_0xc6e4c9(0x1ab)];const _0x522841=getGlobalConfigPath();if(!a45_0x545922['existsSync'](_0x522841))return null;try{const _0x518187=a45_0x545922['readFileSync'](_0x522841,_0xc6e4c9(0x1bb)),_0x405116=JSON[_0xc6e4c9(0x19c)](_0x518187);return _0x405116[_0xc6e4c9(0x1ab)]||null;}catch{return null;}}export function createProfile(_0x50f7bb,_0x4b348c){const _0x4251c5=a45_0x1e45;validateProfileName(_0x50f7bb);if(profileExists(_0x50f7bb))throw new Error('Profile\x20'+_0x50f7bb+_0x4251c5(0x1d2));saveProfile(_0x50f7bb,_0x4b348c);}export function saveProfileCredentials(_0x288c0e,_0x551d0f){const _0x501e0b=a45_0x1e45;validateProfileName(_0x288c0e);if(!profileExists(_0x288c0e))throw new Error(_0x501e0b(0x1ce)+_0x288c0e+_0x501e0b(0x1b1));const _0x4f5fc7=getNewCredentialPath(_0x288c0e);writeSecureFile(_0x4f5fc7,_0x551d0f);}export function loadProfileCredentials(_0x42a84c){const _0x19bdca=a45_0x1e45;validateProfileName(_0x42a84c);const _0x3b6606=getNewCredentialPath(_0x42a84c);if(a45_0x545922[_0x19bdca(0x1d3)](_0x3b6606))try{return a45_0x545922['readFileSync'](_0x3b6606,_0x19bdca(0x1bb));}catch{}const _0x5c29bd=getOldCredentialPath(_0x42a84c);if(a45_0x545922['existsSync'](_0x5c29bd)){console[_0x19bdca(0x1c6)](_0x19bdca(0x1ca)+_0x42a84c+'\x27'),console[_0x19bdca(0x1c6)](_0x19bdca(0x1ad)),console[_0x19bdca(0x1c6)](_0x19bdca(0x1c0)+_0x5c29bd+'\x22\x20\x22'+_0x3b6606+'\x22'),console['warn'](_0x19bdca(0x1b8));try{return a45_0x545922['readFileSync'](_0x5c29bd,'utf-8');}catch{return null;}}return null;}
1
+ (function(_0x116b99,_0xb06e0c){const _0x1c8086=a45_0x5f24,_0x301124=_0x116b99();while(!![]){try{const _0x162777=-parseInt(_0x1c8086(0x1e1))/0x1+parseInt(_0x1c8086(0x1eb))/0x2*(-parseInt(_0x1c8086(0x1b7))/0x3)+-parseInt(_0x1c8086(0x1c9))/0x4*(parseInt(_0x1c8086(0x1c0))/0x5)+parseInt(_0x1c8086(0x1ed))/0x6*(parseInt(_0x1c8086(0x1f2))/0x7)+-parseInt(_0x1c8086(0x1cb))/0x8*(parseInt(_0x1c8086(0x1e6))/0x9)+-parseInt(_0x1c8086(0x1b4))/0xa+-parseInt(_0x1c8086(0x1b0))/0xb*(-parseInt(_0x1c8086(0x1e8))/0xc);if(_0x162777===_0xb06e0c)break;else _0x301124['push'](_0x301124['shift']());}catch(_0x3fe496){_0x301124['push'](_0x301124['shift']());}}}(a45_0x64b0,0xb408e));import*as a45_0x1266c2 from'node:fs';function a45_0x64b0(){const _0x1ba61a=['\x27:\x20unknown\x20config\x20key\x20\x27','local','612jgksgj','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','24bOgVUr','description','\x20already\x20exists','9780COrlaS','some','5793576dYLdQg','readdirSync','parent_segment','includes','\x22\x20\x22','7bPfdOV','keys','.env.','Invalid\x20profile\x20name:\x20','warn','length','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','llm_agent','profile','test','tdx.json','isDirectory','18278942NDEmwl','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','map','site','4621360qrYlFV','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','filter','237sEnjNh','\x20does\x20not\x20exist','user','join','has','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','Profile\x20','Profile\x20\x27','To\x20migrate:','466285imLKDJ','message','\x0aWarning:\x20Failed\x20to\x20parse\x20','values','\x20\x201.\x20Edit:\x20','push','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','object','60cWrzzd','toISOString','41368FGRzzX','string','entries','parse','profiles','directory','from','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','utf-8','name','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','\x27:\x20config\x20must\x20be\x20an\x20object','existsSync','Warning:\x20Failed\x20to\x20parse\x20','llm_project','sort','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','rmSync','find','readFileSync','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','952689lCJPRZ','database','localeCompare'];a45_0x64b0=function(){return _0x1ba61a;};return a45_0x64b0();}import*as a45_0x310dde 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(_0x431aab){const _0x3bc243=a45_0x5f24,_0x5a4dc9={};if(!_0x431aab)return _0x5a4dc9;for(const [_0x139641,_0x4275b7]of Object[_0x3bc243(0x1cd)](_0x431aab)){_0x139641!==_0x3bc243(0x1e9)&&_0x4275b7!==undefined&&(_0x5a4dc9[_0x139641]=_0x4275b7);}return _0x5a4dc9;}export function getProfilesDir(){const _0x431460=a45_0x5f24;return a45_0x310dde['join'](getConfigDir(),_0x431460(0x1cf));}function getProfileDir(_0x3b2bb1){const _0xe8cfbf=a45_0x5f24;return a45_0x310dde[_0xe8cfbf(0x1ba)](getProfilesDir(),_0x3b2bb1);}function getProfileConfigPath(_0x320aa7){const _0x4da96d=a45_0x5f24;return a45_0x310dde[_0x4da96d(0x1ba)](getProfileDir(_0x320aa7),_0x4da96d(0x1ae));}function getProfileEnvPath(_0x13c553){return a45_0x310dde['join'](getProfileDir(_0x13c553),'.env');}function getGlobalConfigPath(){return a45_0x310dde['join'](getConfigDir(),'tdx.json');}function validateProfileName(_0x450251){const _0x2b949c=a45_0x5f24;if(!/^[a-zA-Z0-9_-]+$/[_0x2b949c(0x1ad)](_0x450251))throw new Error(_0x2b949c(0x1f5)+_0x450251+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.');}function validateProfileConfig(_0x5db447,_0x3cb0e0){const _0x502ec7=a45_0x5f24;if(typeof _0x5db447!==_0x502ec7(0x1c8)||_0x5db447===null)throw new Error(_0x502ec7(0x1be)+_0x3cb0e0+_0x502ec7(0x1d6));const _0x1c8667=[_0x502ec7(0x1e9),_0x502ec7(0x1b3),'database',_0x502ec7(0x1ef),_0x502ec7(0x1d9),_0x502ec7(0x1ab)],_0x5e91c0=_0x5db447;for(const _0x1fb3f5 of Object[_0x502ec7(0x1f3)](_0x5e91c0)){!_0x1c8667[_0x502ec7(0x1f0)](_0x1fb3f5)&&console[_0x502ec7(0x1f6)]('Warning:\x20Profile\x20\x27'+_0x3cb0e0+_0x502ec7(0x1e4)+_0x1fb3f5+'\x27\x20will\x20be\x20ignored');}if(_0x5e91c0[_0x502ec7(0x1e9)]!==undefined&&typeof _0x5e91c0[_0x502ec7(0x1e9)]!==_0x502ec7(0x1cc))throw new Error(_0x502ec7(0x1be)+_0x3cb0e0+_0x502ec7(0x1d2));if(_0x5e91c0[_0x502ec7(0x1b3)]!==undefined&&typeof _0x5e91c0['site']!==_0x502ec7(0x1cc))throw new Error(_0x502ec7(0x1be)+_0x3cb0e0+_0x502ec7(0x1c7));if(_0x5e91c0[_0x502ec7(0x1e2)]!==undefined&&typeof _0x5e91c0[_0x502ec7(0x1e2)]!==_0x502ec7(0x1cc))throw new Error(_0x502ec7(0x1be)+_0x3cb0e0+_0x502ec7(0x1b1));if(_0x5e91c0[_0x502ec7(0x1ef)]!==undefined&&typeof _0x5e91c0[_0x502ec7(0x1ef)]!==_0x502ec7(0x1cc))throw new Error('Profile\x20\x27'+_0x3cb0e0+_0x502ec7(0x1e0));if(_0x5e91c0[_0x502ec7(0x1d9)]!==undefined&&typeof _0x5e91c0[_0x502ec7(0x1d9)]!==_0x502ec7(0x1cc))throw new Error(_0x502ec7(0x1be)+_0x3cb0e0+_0x502ec7(0x1c6));if(_0x5e91c0[_0x502ec7(0x1ab)]!==undefined&&typeof _0x5e91c0[_0x502ec7(0x1ab)]!=='string')throw new Error(_0x502ec7(0x1be)+_0x3cb0e0+_0x502ec7(0x1df));return!![];}function loadProfilesFromTdxJson(_0x54fa2a,_0x5d7079){const _0x3bf992=a45_0x5f24;if(!a45_0x1266c2[_0x3bf992(0x1d7)](_0x54fa2a))return[];try{const _0x17eaed=a45_0x1266c2[_0x3bf992(0x1de)](_0x54fa2a,_0x3bf992(0x1d3)),_0x30f2d0=JSON['parse'](_0x17eaed);if(!_0x30f2d0[_0x3bf992(0x1cf)]||typeof _0x30f2d0[_0x3bf992(0x1cf)]!=='object')return[];const _0x2f5ad0=[];for(const [_0x38df84,_0x2ad4e3]of Object[_0x3bf992(0x1cd)](_0x30f2d0[_0x3bf992(0x1cf)])){try{validateProfileConfig(_0x2ad4e3,_0x38df84);const _0x1500e5=getNewCredentialPath(_0x38df84),_0x45614c=getOldCredentialPath(_0x38df84),_0x57642c=a45_0x1266c2['existsSync'](_0x1500e5)||a45_0x1266c2['existsSync'](_0x45614c);_0x2f5ad0[_0x3bf992(0x1c5)]({'name':_0x38df84,'config':_0x2ad4e3,'metadata':{'name':_0x38df84,'createdAt':new Date()[_0x3bf992(0x1ca)]()},'hasCredentials':_0x57642c,'scope':_0x5d7079});}catch(_0x3669f6){_0x3669f6 instanceof Error&&(console[_0x3bf992(0x1f6)](_0x3bf992(0x1e7)+_0x54fa2a+':'),console[_0x3bf992(0x1f6)]('\x20\x20'+_0x3669f6[_0x3bf992(0x1c1)]+'\x0a'));}}return _0x2f5ad0;}catch(_0x364cd0){return _0x364cd0 instanceof SyntaxError?(console[_0x3bf992(0x1f6)](_0x3bf992(0x1c2)+_0x54fa2a+':\x20Invalid\x20JSON\x20syntax'),console[_0x3bf992(0x1f6)]('Error:\x20'+_0x364cd0['message']+'\x0a')):console[_0x3bf992(0x1f6)](_0x3bf992(0x1b5)+_0x54fa2a+':\x20'+_0x364cd0+'\x0a'),[];}}export function getNewCredentialPath(_0x4d1c79){const _0x232667=a45_0x5f24;return a45_0x310dde[_0x232667(0x1ba)](getConfigDir(),_0x232667(0x1f4)+_0x4d1c79);}function getOldCredentialPath(_0x233a22){return a45_0x310dde['join'](getProfilesDir(),_0x233a22,'.env');}function loadProfilesFromTdxJsonFiles(){const _0xc3bc75=a45_0x5f24,_0x5f03c8=[],_0x391e58=findProjectConfigPath();_0x391e58&&_0x5f03c8['push'](...loadProfilesFromTdxJson(_0x391e58,_0xc3bc75(0x1e5)));const _0x464e4c=a45_0x310dde['join'](getConfigDir(),_0xc3bc75(0x1ae));return _0x5f03c8[_0xc3bc75(0x1c5)](...loadProfilesFromTdxJson(_0x464e4c,_0xc3bc75(0x1b9))),_0x5f03c8;}function loadProfilesFromDirectories(){const _0x2bc44f=a45_0x5f24,_0x1b8702=getProfilesDir();if(!a45_0x1266c2[_0x2bc44f(0x1d7)](_0x1b8702))return[];try{return a45_0x1266c2[_0x2bc44f(0x1ee)](_0x1b8702,{'withFileTypes':!![]})[_0x2bc44f(0x1b6)](_0x17008d=>_0x17008d[_0x2bc44f(0x1af)]())[_0x2bc44f(0x1b2)](_0x110492=>_0x110492[_0x2bc44f(0x1d4)])[_0x2bc44f(0x1b6)](_0x2c17cf=>{const _0x3b117f=_0x2bc44f,_0x30c27c=getProfileConfigPath(_0x2c17cf),_0x374b4e=getProfileEnvPath(_0x2c17cf);return a45_0x1266c2[_0x3b117f(0x1d7)](_0x30c27c)||a45_0x1266c2['existsSync'](_0x374b4e);})[_0x2bc44f(0x1b2)](_0x1cc44c=>{const _0x4a55f4=_0x2bc44f,_0x4cd028=loadProfileFromDirectory(_0x1cc44c);if(_0x4cd028)return{..._0x4cd028,'scope':_0x4a55f4(0x1d0)};return null;})[_0x2bc44f(0x1b6)](_0x249fea=>_0x249fea!==null);}catch{return[];}}function loadProfileFromDirectory(_0x4c263e){const _0x31ba60=a45_0x5f24,_0x52364b=getProfileConfigPath(_0x4c263e),_0x3e004e=getOldCredentialPath(_0x4c263e);if(!a45_0x1266c2[_0x31ba60(0x1d7)](_0x52364b)&&!a45_0x1266c2['existsSync'](_0x3e004e))return null;let _0x5ae9f7={},_0x402b7f={'name':_0x4c263e,'createdAt':new Date()[_0x31ba60(0x1ca)]()};if(a45_0x1266c2[_0x31ba60(0x1d7)](_0x52364b))try{const _0x307d53=a45_0x1266c2['readFileSync'](_0x52364b,_0x31ba60(0x1d3)),_0x240052=JSON[_0x31ba60(0x1ce)](_0x307d53),{metadata:_0x68d40b,..._0x18f0e2}=_0x240052;_0x5ae9f7=_0x18f0e2,_0x68d40b&&(_0x402b7f=_0x68d40b);}catch{}return{'name':_0x4c263e,'config':_0x5ae9f7,'metadata':_0x402b7f,'hasCredentials':a45_0x1266c2[_0x31ba60(0x1d7)](_0x3e004e),'scope':_0x31ba60(0x1d0)};}export function listProfiles(){const _0x3b5fa3=a45_0x5f24,_0x42aef7=loadProfilesFromTdxJsonFiles(),_0x3d2dd0=loadProfilesFromDirectories();if(_0x3d2dd0[_0x3b5fa3(0x1a9)]>0x0){const _0x525bf4=_0x3d2dd0[_0x3b5fa3(0x1b2)](_0x41ac81=>_0x41ac81[_0x3b5fa3(0x1d4)])[_0x3b5fa3(0x1ba)](',\x20'),_0x2e9285=getConfigDir();console[_0x3b5fa3(0x1f6)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x525bf4),console[_0x3b5fa3(0x1f6)]('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x3b5fa3(0x1f6)](_0x3b5fa3(0x1c4)+a45_0x310dde[_0x3b5fa3(0x1ba)](_0x2e9285,'tdx.json')),console[_0x3b5fa3(0x1f6)](_0x3b5fa3(0x1aa)),console['warn'](_0x3b5fa3(0x1db));}const _0x151d25=[..._0x42aef7,..._0x3d2dd0],_0x447850=new Map();for(const _0x33a5b4 of _0x151d25){!_0x447850[_0x3b5fa3(0x1bb)](_0x33a5b4['name'])&&_0x447850['set'](_0x33a5b4[_0x3b5fa3(0x1d4)],_0x33a5b4);}return Array[_0x3b5fa3(0x1d1)](_0x447850[_0x3b5fa3(0x1c3)]())[_0x3b5fa3(0x1da)]((_0xf17b16,_0x1eaae5)=>_0xf17b16[_0x3b5fa3(0x1d4)][_0x3b5fa3(0x1e3)](_0x1eaae5[_0x3b5fa3(0x1d4)]));}function a45_0x5f24(_0xe24dcd,_0x1ae726){const _0x64b0ca=a45_0x64b0();return a45_0x5f24=function(_0x5f249b,_0xcc54e3){_0x5f249b=_0x5f249b-0x1a9;let _0x3bb208=_0x64b0ca[_0x5f249b];return _0x3bb208;},a45_0x5f24(_0xe24dcd,_0x1ae726);}export function profileExists(_0x7f417a){const _0xd6b29b=a45_0x5f24,_0x233132=listProfiles();return _0x233132[_0xd6b29b(0x1ec)](_0x380afa=>_0x380afa[_0xd6b29b(0x1d4)]===_0x7f417a);}export function loadProfile(_0x13f5e9){const _0x18bd2d=a45_0x5f24;validateProfileName(_0x13f5e9);const _0x39e8e4=listProfiles(),_0x3ef7c8=_0x39e8e4[_0x18bd2d(0x1dd)](_0x1b79fa=>_0x1b79fa[_0x18bd2d(0x1d4)]===_0x13f5e9);return _0x3ef7c8||null;}export function saveProfile(_0x45c31d,_0x5a2c1a,_0xe05c1f=![]){saveProfileToUserConfig(_0x45c31d,_0x5a2c1a);}export function deleteProfile(_0x593805){const _0x59c577=a45_0x5f24;validateProfileName(_0x593805);const _0x54da83=getProfileDir(_0x593805);if(!a45_0x1266c2[_0x59c577(0x1d7)](_0x54da83))throw new Error(_0x59c577(0x1bd)+_0x593805+_0x59c577(0x1b8));a45_0x1266c2[_0x59c577(0x1dc)](_0x54da83,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0xccfd53,_0x51f90d){const _0x184183=a45_0x5f24;validateProfileName(_0xccfd53);const _0x2b6cda=getGlobalConfigPath(),_0x1441f8=getConfigDir();!a45_0x1266c2[_0x184183(0x1d7)](_0x1441f8)&&createSecureDirectory(_0x1441f8);let _0x5cfd6={};if(a45_0x1266c2['existsSync'](_0x2b6cda))try{const _0x3850c3=a45_0x1266c2[_0x184183(0x1de)](_0x2b6cda,'utf-8');_0x5cfd6=JSON['parse'](_0x3850c3);}catch{console['warn'](_0x184183(0x1d8)+_0x2b6cda+',\x20creating\x20new\x20file');}!_0x5cfd6[_0x184183(0x1cf)]&&(_0x5cfd6[_0x184183(0x1cf)]={}),_0x5cfd6[_0x184183(0x1cf)][_0xccfd53]=_0x51f90d,writeSecureFile(_0x2b6cda,JSON['stringify'](_0x5cfd6,null,0x2));}export function getActiveProfile(){const _0x5da870=a45_0x5f24,_0x154854=loadSessionContext();if(_0x154854?.['profile'])return _0x154854[_0x5da870(0x1ac)];const _0x50ac27=getGlobalConfigPath();if(!a45_0x1266c2['existsSync'](_0x50ac27))return null;try{const _0x5c62e4=a45_0x1266c2['readFileSync'](_0x50ac27,'utf-8'),_0x24ebcd=JSON[_0x5da870(0x1ce)](_0x5c62e4);return _0x24ebcd[_0x5da870(0x1ac)]||null;}catch{return null;}}export function createProfile(_0x1ec7f0,_0x2f330f){const _0x26129a=a45_0x5f24;validateProfileName(_0x1ec7f0);if(profileExists(_0x1ec7f0))throw new Error(_0x26129a(0x1bd)+_0x1ec7f0+_0x26129a(0x1ea));saveProfile(_0x1ec7f0,_0x2f330f);}export function saveProfileCredentials(_0x2805c0,_0x4f627d){const _0x3d9f55=a45_0x5f24;validateProfileName(_0x2805c0);if(!profileExists(_0x2805c0))throw new Error(_0x3d9f55(0x1bd)+_0x2805c0+_0x3d9f55(0x1b8));const _0x49ab94=getNewCredentialPath(_0x2805c0);writeSecureFile(_0x49ab94,_0x4f627d);}export function loadProfileCredentials(_0x471f63){const _0x3e8a3b=a45_0x5f24;validateProfileName(_0x471f63);const _0x52b729=getNewCredentialPath(_0x471f63);if(a45_0x1266c2[_0x3e8a3b(0x1d7)](_0x52b729))try{return a45_0x1266c2[_0x3e8a3b(0x1de)](_0x52b729,_0x3e8a3b(0x1d3));}catch{}const _0x1fd382=getOldCredentialPath(_0x471f63);if(a45_0x1266c2['existsSync'](_0x1fd382)){console[_0x3e8a3b(0x1f6)](_0x3e8a3b(0x1bc)+_0x471f63+'\x27'),console[_0x3e8a3b(0x1f6)](_0x3e8a3b(0x1bf)),console[_0x3e8a3b(0x1f6)]('\x20\x20mv\x20\x22'+_0x1fd382+_0x3e8a3b(0x1f1)+_0x52b729+'\x22'),console[_0x3e8a3b(0x1f6)](_0x3e8a3b(0x1d5));try{return a45_0x1266c2[_0x3e8a3b(0x1de)](_0x1fd382,_0x3e8a3b(0x1d3));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- function a46_0x1dcd(){const _0x3e28e4=['4987436ksxSaJ','Warning:\x20\x27profile\x27\x20field\x20in\x20','TD_API_KEY','api_key','3331071pGFwzb','2355510cyqPap',').\x20','join','includes','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','cwd','492865rKoRkm','stringify','430086HbFhsG','2fLmDwA','\x20is\x20ignored.\x20','tdx.json','parse','writeFileSync','Failed\x20to\x20load\x20project\x20config\x20from\x20','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','dirname','apiKey','profile','5070400XGwGcp','code','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','utf-8','224PqkLYZ','19080LZynwI','35StHjFn','readFileSync','warn','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'];a46_0x1dcd=function(){return _0x3e28e4;};return a46_0x1dcd();}const a46_0x924d9c=a46_0x115f;(function(_0x430779,_0x596e12){const _0x5ac1ab=a46_0x115f,_0x2bdb9b=_0x430779();while(!![]){try{const _0x115cc7=-parseInt(_0x5ac1ab(0xb0))/0x1*(-parseInt(_0x5ac1ab(0xb3))/0x2)+parseInt(_0x5ac1ab(0xa9))/0x3+-parseInt(_0x5ac1ab(0xa5))/0x4+parseInt(_0x5ac1ab(0xbd))/0x5+parseInt(_0x5ac1ab(0xb2))/0x6*(-parseInt(_0x5ac1ab(0xa1))/0x7)+-parseInt(_0x5ac1ab(0xc1))/0x8*(parseInt(_0x5ac1ab(0xc2))/0x9)+-parseInt(_0x5ac1ab(0xaa))/0xa;if(_0x115cc7===_0x596e12)break;else _0x2bdb9b['push'](_0x2bdb9b['shift']());}catch(_0x30ab4e){_0x2bdb9b['push'](_0x2bdb9b['shift']());}}}(a46_0x1dcd,0xaf147));import*as a46_0x4374f1 from'node:fs';function a46_0x115f(_0x5473e6,_0xd69f63){const _0x1dcdcb=a46_0x1dcd();return a46_0x115f=function(_0x115f9c,_0x3735a3){_0x115f9c=_0x115f9c-0xa1;let _0x3eacbd=_0x1dcdcb[_0x115f9c];return _0x3eacbd;},a46_0x115f(_0x5473e6,_0xd69f63);}import*as a46_0x1b9fcc from'node:path';const PROJECT_CONFIG_FILENAME=a46_0x924d9c(0xb5);export function findProjectConfigPath(_0x3d7a20){const _0x52f9b5=a46_0x924d9c;let _0x15ce7d=_0x3d7a20||process[_0x52f9b5(0xaf)]();while(!![]){const _0x27e7a8=a46_0x1b9fcc[_0x52f9b5(0xac)](_0x15ce7d,PROJECT_CONFIG_FILENAME);if(a46_0x4374f1['existsSync'](_0x27e7a8))return _0x27e7a8;const _0x49831b=a46_0x1b9fcc[_0x52f9b5(0xba)](_0x15ce7d);if(_0x49831b===_0x15ce7d)return null;_0x15ce7d=_0x49831b;}}export function loadProjectConfig(_0x14ba9f){const _0x58ac35=a46_0x924d9c,_0x48a83a=findProjectConfigPath(_0x14ba9f);if(!_0x48a83a)return null;try{const _0x314a87=a46_0x4374f1[_0x58ac35(0xa2)](_0x48a83a,_0x58ac35(0xc0)),_0xe0a38f=JSON[_0x58ac35(0xb6)](_0x314a87),_0x4df231=JSON['stringify'](_0xe0a38f);if(_0x4df231[_0x58ac35(0xad)](_0x58ac35(0xa7))||_0x4df231['includes'](_0x58ac35(0xbb))||_0x4df231[_0x58ac35(0xad)](_0x58ac35(0xa8)))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x48a83a+_0x58ac35(0xab)+_0x58ac35(0xbf));const {metadata:_0x3d798e,profile:_0x59bc05,..._0x104fe5}=_0xe0a38f;return _0x59bc05&&console[_0x58ac35(0xa3)](_0x58ac35(0xa6)+_0x48a83a+_0x58ac35(0xb4)+_0x58ac35(0xa4)),_0x104fe5;}catch(_0x4bb0a8){if(_0x4bb0a8 instanceof Error&&_0x58ac35(0xbe)in _0x4bb0a8&&_0x4bb0a8['code']==='ENOENT')return null;throw new Error(_0x58ac35(0xb8)+_0x48a83a+':\x20'+_0x4bb0a8);}}export function saveProjectConfig(_0x5d1c36,_0xbc3b3c){const _0x146d99=a46_0x924d9c,_0x4a4db0=_0xbc3b3c||process['cwd'](),_0x4f6714=a46_0x1b9fcc[_0x146d99(0xac)](_0x4a4db0,PROJECT_CONFIG_FILENAME),_0x5d4a54=JSON[_0x146d99(0xb1)](_0x5d1c36);if(_0x5d4a54[_0x146d99(0xad)](_0x146d99(0xa7))||_0x5d4a54[_0x146d99(0xad)]('apiKey')||_0x5d4a54[_0x146d99(0xad)](_0x146d99(0xa8)))throw new Error(_0x146d99(0xb9));if(_0x146d99(0xbc)in _0x5d1c36)throw new Error(_0x146d99(0xae));a46_0x4374f1[_0x146d99(0xb7)](_0x4f6714,JSON[_0x146d99(0xb1)](_0x5d1c36,null,0x2));}export function hasProjectConfig(_0x120143){return findProjectConfigPath(_0x120143)!==null;}export function getProjectRoot(_0x57d3c0){const _0x25d1e9=a46_0x924d9c,_0x199ef6=findProjectConfigPath(_0x57d3c0);return _0x199ef6?a46_0x1b9fcc[_0x25d1e9(0xba)](_0x199ef6):null;}
1
+ function a46_0x4bc4(_0x19a3da,_0x222b1d){const _0x47f9d8=a46_0x47f9();return a46_0x4bc4=function(_0x4bc452,_0x182020){_0x4bc452=_0x4bc452-0xc5;let _0x26c82d=_0x47f9d8[_0x4bc452];return _0x26c82d;},a46_0x4bc4(_0x19a3da,_0x222b1d);}(function(_0x210d1e,_0x4e8cf9){const _0x5a0333=a46_0x4bc4,_0x1954cc=_0x210d1e();while(!![]){try{const _0x97668e=parseInt(_0x5a0333(0xc9))/0x1*(parseInt(_0x5a0333(0xdd))/0x2)+parseInt(_0x5a0333(0xdf))/0x3*(parseInt(_0x5a0333(0xce))/0x4)+parseInt(_0x5a0333(0xcd))/0x5+-parseInt(_0x5a0333(0xc6))/0x6+-parseInt(_0x5a0333(0xd7))/0x7+-parseInt(_0x5a0333(0xe2))/0x8*(parseInt(_0x5a0333(0xd3))/0x9)+parseInt(_0x5a0333(0xcb))/0xa;if(_0x97668e===_0x4e8cf9)break;else _0x1954cc['push'](_0x1954cc['shift']());}catch(_0x13e2e1){_0x1954cc['push'](_0x1954cc['shift']());}}}(a46_0x47f9,0x63e76));import*as a46_0x24272f from'node:fs';import*as a46_0x5bfd82 from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x564371){const _0x3ea3f8=a46_0x4bc4;let _0x1a5c5d=_0x564371||process[_0x3ea3f8(0xc7)]();while(!![]){const _0x385970=a46_0x5bfd82[_0x3ea3f8(0xd9)](_0x1a5c5d,PROJECT_CONFIG_FILENAME);if(a46_0x24272f[_0x3ea3f8(0xc8)](_0x385970))return _0x385970;const _0x5144b9=a46_0x5bfd82['dirname'](_0x1a5c5d);if(_0x5144b9===_0x1a5c5d)return null;_0x1a5c5d=_0x5144b9;}}export function loadProjectConfig(_0x154dcf){const _0x24d2ab=a46_0x4bc4,_0x38eddd=findProjectConfigPath(_0x154dcf);if(!_0x38eddd)return null;try{const _0x33ae1e=a46_0x24272f[_0x24d2ab(0xdb)](_0x38eddd,_0x24d2ab(0xd1)),_0xc6367d=JSON[_0x24d2ab(0xdc)](_0x33ae1e),_0xeddab9=JSON[_0x24d2ab(0xc5)](_0xc6367d);if(_0xeddab9['includes']('TD_API_KEY')||_0xeddab9[_0x24d2ab(0xd2)](_0x24d2ab(0xe3))||_0xeddab9[_0x24d2ab(0xd2)]('api_key'))throw new Error(_0x24d2ab(0xd4)+_0x38eddd+_0x24d2ab(0xd5)+_0x24d2ab(0xe0));const {metadata:_0x57bfac,profile:_0x5d02b1,..._0x1f9550}=_0xc6367d;return _0x5d02b1&&console[_0x24d2ab(0xd8)](_0x24d2ab(0xd0)+_0x38eddd+'\x20is\x20ignored.\x20'+_0x24d2ab(0xe4)),_0x1f9550;}catch(_0x52547a){if(_0x52547a instanceof Error&&'code'in _0x52547a&&_0x52547a['code']===_0x24d2ab(0xe1))return null;throw new Error('Failed\x20to\x20load\x20project\x20config\x20from\x20'+_0x38eddd+':\x20'+_0x52547a);}}function a46_0x47f9(){const _0x3cdaf1=['utf-8','includes','18pKhFFj','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(',').\x20','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','3098081swICRN','warn','join','dirname','readFileSync','parse','54206scIGdS','api_key','3iQJtjr','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','ENOENT','3185144IDmJeO','apiKey','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','stringify','3738018zcaMom','cwd','existsSync','1cMrwti','writeFileSync','10631160agwACL','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','3339630JycUCr','2051732xyemmi','profile','Warning:\x20\x27profile\x27\x20field\x20in\x20'];a46_0x47f9=function(){return _0x3cdaf1;};return a46_0x47f9();}export function saveProjectConfig(_0x501dd7,_0x50db9e){const _0x37a004=a46_0x4bc4,_0x4d6f87=_0x50db9e||process['cwd'](),_0x12d702=a46_0x5bfd82[_0x37a004(0xd9)](_0x4d6f87,PROJECT_CONFIG_FILENAME),_0x53ee58=JSON[_0x37a004(0xc5)](_0x501dd7);if(_0x53ee58[_0x37a004(0xd2)]('TD_API_KEY')||_0x53ee58['includes'](_0x37a004(0xe3))||_0x53ee58[_0x37a004(0xd2)](_0x37a004(0xde)))throw new Error(_0x37a004(0xd6));if(_0x37a004(0xcf)in _0x501dd7)throw new Error(_0x37a004(0xcc));a46_0x24272f[_0x37a004(0xca)](_0x12d702,JSON[_0x37a004(0xc5)](_0x501dd7,null,0x2));}export function hasProjectConfig(_0xe1076a){return findProjectConfigPath(_0xe1076a)!==null;}export function getProjectRoot(_0x2ebc71){const _0x204ebe=a46_0x4bc4,_0x31ea71=findProjectConfigPath(_0x2ebc71);return _0x31ea71?a46_0x5bfd82[_0x204ebe(0xda)](_0x31ea71):null;}
@@ -1 +1 @@
1
- (function(_0x51d9f6,_0x6a77cf){const _0x39e3a6=a47_0x4c01,_0x186d3d=_0x51d9f6();while(!![]){try{const _0x445e6a=parseInt(_0x39e3a6(0x207))/0x1+parseInt(_0x39e3a6(0x1e9))/0x2+-parseInt(_0x39e3a6(0x1fc))/0x3*(-parseInt(_0x39e3a6(0x1f0))/0x4)+parseInt(_0x39e3a6(0x1f4))/0x5*(parseInt(_0x39e3a6(0x203))/0x6)+-parseInt(_0x39e3a6(0x1f6))/0x7+parseInt(_0x39e3a6(0x1fb))/0x8*(parseInt(_0x39e3a6(0x1f2))/0x9)+-parseInt(_0x39e3a6(0x206))/0xa*(parseInt(_0x39e3a6(0x1f7))/0xb);if(_0x445e6a===_0x6a77cf)break;else _0x186d3d['push'](_0x186d3d['shift']());}catch(_0x4034ea){_0x186d3d['push'](_0x186d3d['shift']());}}}(a47_0x1b51,0x3b15c));import*as a47_0x237723 from'node:fs';import*as a47_0x59feeb from'node:path';import*as a47_0x85e1bc from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x5b05ec=a47_0x4c01,_0x476b5b=process['env'][_0x5b05ec(0x205)]||a47_0x59feeb[_0x5b05ec(0x1ef)](a47_0x85e1bc[_0x5b05ec(0x1ea)](),_0x5b05ec(0x20a),_0x5b05ec(0x1fd));return a47_0x59feeb['join'](_0x476b5b,_0x5b05ec(0x204));}function getSessionPath(_0x3a41f0){const _0x4c593d=a47_0x4c01;return a47_0x59feeb[_0x4c593d(0x1ef)](getSessionsDir(),_0x3a41f0+'.json');}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x575d22){if(_0x575d22)return _0x575d22;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x1e041e){const _0x15d3d3=a47_0x4c01,_0x24be93=_0x1e041e||getCurrentSessionPID()[_0x15d3d3(0x1fa)](),_0x4a9c68=/^\d+$/[_0x15d3d3(0x209)](_0x24be93)?parseInt(_0x24be93,0xa):null;return _0x4a9c68!==null?loadSessionContextByPID(_0x4a9c68):loadSessionContextByString(_0x24be93);}function a47_0x4c01(_0x381224,_0x41a9a4){const _0x1b514a=a47_0x1b51();return a47_0x4c01=function(_0x4c013f,_0x173ae0){_0x4c013f=_0x4c013f-0x1e4;let _0x40e3ef=_0x1b514a[_0x4c013f];return _0x40e3ef;},a47_0x4c01(_0x381224,_0x41a9a4);}function a47_0x1b51(){const _0x449098=['TD_API_KEY','564284ezfBLG','5170jcvOxK','unlinkSync','createdAt','toString','904xqXQwN','12PaWVrI','tdx','replace','warn','apiKey','readdirSync','endsWith','162hQPzbd','sessions','TDX_CONFIG_DIR','18060fuSRqU','188961IdETLr','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','test','.config','includes','sort','api_key','.\x20This\x20is\x20insecure.\x20Removing\x20session.','parse','toISOString','readFileSync','622266otRkIY','homedir','existsSync','getTime','utf-8','.json','join','448664proKmv','stringify','17235SxhJeA','now','1165jFskMj'];a47_0x1b51=function(){return _0x449098;};return a47_0x1b51();}export function loadSessionContextByPID(_0x1eecbc){const _0x1f0092=a47_0x4c01,_0x5bf975=getSessionPath(_0x1eecbc);if(!a47_0x237723[_0x1f0092(0x1eb)](_0x5bf975))return null;try{const _0x3c9180=a47_0x237723[_0x1f0092(0x1e8)](_0x5bf975,_0x1f0092(0x1ed)),_0x433633=JSON[_0x1f0092(0x1e6)](_0x3c9180),_0x4f7fb6=new Date(_0x433633[_0x1f0092(0x1f9)])[_0x1f0092(0x1ec)](),_0x238587=Date[_0x1f0092(0x1f3)]();if(_0x238587-_0x4f7fb6>SESSION_EXPIRATION_MS)return a47_0x237723[_0x1f0092(0x1f8)](_0x5bf975),null;const _0x368541=JSON[_0x1f0092(0x1f1)](_0x433633);if(_0x368541[_0x1f0092(0x20b)](_0x1f0092(0x1f5))||_0x368541[_0x1f0092(0x20b)](_0x1f0092(0x200))||_0x368541[_0x1f0092(0x20b)]('api_key'))return console['warn'](_0x1f0092(0x208)+_0x5bf975+_0x1f0092(0x1e5)),a47_0x237723[_0x1f0092(0x1f8)](_0x5bf975),null;return _0x433633;}catch{try{a47_0x237723[_0x1f0092(0x1f8)](_0x5bf975);}catch{}return null;}}function loadSessionContextByString(_0x2e9131){const _0x5b023e=a47_0x4c01,_0x41633e=a47_0x59feeb['join'](getSessionsDir(),_0x2e9131+_0x5b023e(0x1ee));if(!a47_0x237723['existsSync'](_0x41633e))return null;try{const _0x1ff8a9=a47_0x237723[_0x5b023e(0x1e8)](_0x41633e,_0x5b023e(0x1ed)),_0x49c4cb=JSON[_0x5b023e(0x1e6)](_0x1ff8a9),_0x56d547=new Date(_0x49c4cb['createdAt'])[_0x5b023e(0x1ec)](),_0x39a1d0=Date[_0x5b023e(0x1f3)]();if(_0x39a1d0-_0x56d547>SESSION_EXPIRATION_MS)return a47_0x237723[_0x5b023e(0x1f8)](_0x41633e),null;const _0x42856a=JSON[_0x5b023e(0x1f1)](_0x49c4cb);if(_0x42856a['includes'](_0x5b023e(0x1f5))||_0x42856a[_0x5b023e(0x20b)](_0x5b023e(0x200))||_0x42856a[_0x5b023e(0x20b)](_0x5b023e(0x1e4)))return console[_0x5b023e(0x1ff)](_0x5b023e(0x208)+_0x41633e+_0x5b023e(0x1e5)),a47_0x237723['unlinkSync'](_0x41633e),null;return _0x49c4cb;}catch{try{a47_0x237723[_0x5b023e(0x1f8)](_0x41633e);}catch{}return null;}}export function saveSessionContext(_0x5f0608,_0xc4053){const _0x3c7073=a47_0x4c01,_0xb5dd8=_0xc4053||getCurrentSessionPID()[_0x3c7073(0x1fa)](),_0x1d78dc=/^\d+$/[_0x3c7073(0x209)](_0xb5dd8)?parseInt(_0xb5dd8,0xa):getCurrentSessionPID(),_0x35942a=a47_0x59feeb[_0x3c7073(0x1ef)](getSessionsDir(),_0xb5dd8+_0x3c7073(0x1ee)),_0x16f847=getSessionsDir();createSecureDirectory(_0x16f847);const _0x890a2e=JSON['stringify'](_0x5f0608);if(_0x890a2e[_0x3c7073(0x20b)](_0x3c7073(0x1f5))||_0x890a2e[_0x3c7073(0x20b)](_0x3c7073(0x200))||_0x890a2e[_0x3c7073(0x20b)](_0x3c7073(0x1e4)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x15b679;const _0xdb4ad1=/^\d+$/[_0x3c7073(0x209)](_0xb5dd8)?loadSessionContextByPID(parseInt(_0xb5dd8,0xa)):loadSessionContextByString(_0xb5dd8);_0xdb4ad1?_0x15b679={..._0xdb4ad1,..._0x5f0608,'pid':_0x1d78dc,'sessionId':_0xb5dd8!==_0x1d78dc[_0x3c7073(0x1fa)]()?_0xb5dd8:undefined,'updatedAt':new Date()['toISOString']()}:_0x15b679={'pid':_0x1d78dc,'sessionId':_0xb5dd8!==_0x1d78dc['toString']()?_0xb5dd8:undefined,..._0x5f0608,'createdAt':new Date()[_0x3c7073(0x1e7)](),'updatedAt':new Date()[_0x3c7073(0x1e7)]()},a47_0x237723['writeFileSync'](_0x35942a,JSON['stringify'](_0x15b679,null,0x2));}export function clearSessionContext(_0x293e9d){const _0x50ad6a=a47_0x4c01,_0x28bf3c=_0x293e9d||getCurrentSessionPID()[_0x50ad6a(0x1fa)](),_0x51f373=a47_0x59feeb['join'](getSessionsDir(),_0x28bf3c+_0x50ad6a(0x1ee));a47_0x237723[_0x50ad6a(0x1eb)](_0x51f373)&&a47_0x237723[_0x50ad6a(0x1f8)](_0x51f373);}export function cleanExpiredSessions(){const _0x53408f=a47_0x4c01,_0x48d63d=getSessionsDir();if(!a47_0x237723['existsSync'](_0x48d63d))return 0x0;let _0x943183=0x0;const _0x2f25ac=Date[_0x53408f(0x1f3)]();try{const _0x3b818b=a47_0x237723[_0x53408f(0x201)](_0x48d63d);for(const _0x240216 of _0x3b818b){if(!_0x240216[_0x53408f(0x202)](_0x53408f(0x1ee)))continue;const _0x2893e7=a47_0x59feeb[_0x53408f(0x1ef)](_0x48d63d,_0x240216),_0x2097d8=_0x240216[_0x53408f(0x1fe)]('.json',''),_0x37991c=parseInt(_0x2097d8,0xa),_0x215b26=!isNaN(_0x37991c);if(_0x215b26){if(!isProcessRunning(_0x37991c)){a47_0x237723[_0x53408f(0x1f8)](_0x2893e7),_0x943183++;continue;}}try{const _0x50dde1=a47_0x237723['readFileSync'](_0x2893e7,_0x53408f(0x1ed)),_0x3ea124=JSON[_0x53408f(0x1e6)](_0x50dde1),_0x4eef7f=new Date(_0x3ea124[_0x53408f(0x1f9)])[_0x53408f(0x1ec)]();_0x2f25ac-_0x4eef7f>SESSION_EXPIRATION_MS&&(a47_0x237723[_0x53408f(0x1f8)](_0x2893e7),_0x943183++);}catch{a47_0x237723[_0x53408f(0x1f8)](_0x2893e7),_0x943183++;}}}catch{}return _0x943183;}export function listActiveSessions(){const _0x8b243e=a47_0x4c01,_0x428c58=getSessionsDir();if(!a47_0x237723[_0x8b243e(0x1eb)](_0x428c58))return[];try{const _0x52d795=a47_0x237723[_0x8b243e(0x201)](_0x428c58),_0x23d731=[];for(const _0x53481d of _0x52d795){if(!_0x53481d['endsWith'](_0x8b243e(0x1ee)))continue;const _0x59d61c=_0x53481d['replace'](_0x8b243e(0x1ee),''),_0x476a5e=parseInt(_0x59d61c,0xa);!isNaN(_0x476a5e)&&isProcessRunning(_0x476a5e)&&_0x23d731['push'](_0x476a5e);}return _0x23d731[_0x8b243e(0x20c)]((_0x1d2388,_0x12edad)=>_0x1d2388-_0x12edad);}catch{return[];}}
1
+ (function(_0x1e9ffd,_0x3ebab3){const _0x1091e0=a47_0x2e65,_0x1208b5=_0x1e9ffd();while(!![]){try{const _0x446e1c=-parseInt(_0x1091e0(0xbf))/0x1*(parseInt(_0x1091e0(0xcd))/0x2)+-parseInt(_0x1091e0(0xbd))/0x3*(parseInt(_0x1091e0(0xd9))/0x4)+parseInt(_0x1091e0(0xd6))/0x5*(parseInt(_0x1091e0(0xde))/0x6)+parseInt(_0x1091e0(0xc4))/0x7*(parseInt(_0x1091e0(0xb9))/0x8)+parseInt(_0x1091e0(0xc6))/0x9+parseInt(_0x1091e0(0xcc))/0xa+parseInt(_0x1091e0(0xcf))/0xb;if(_0x446e1c===_0x3ebab3)break;else _0x1208b5['push'](_0x1208b5['shift']());}catch(_0x2aabc8){_0x1208b5['push'](_0x1208b5['shift']());}}}(a47_0xbed6,0x97072));import*as a47_0x182350 from'node:fs';import*as a47_0x124b9f from'node:path';import*as a47_0x2edbf1 from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x28a192=a47_0x2e65,_0x43dfca=process[_0x28a192(0xbe)][_0x28a192(0xce)]||a47_0x124b9f['join'](a47_0x2edbf1[_0x28a192(0xe1)](),_0x28a192(0xdc),_0x28a192(0xc3));return a47_0x124b9f['join'](_0x43dfca,_0x28a192(0xd5));}function a47_0x2e65(_0x56eac7,_0x4ff2e2){const _0xbed633=a47_0xbed6();return a47_0x2e65=function(_0x2e659a,_0x2dfa13){_0x2e659a=_0x2e659a-0xb9;let _0x3cf2dc=_0xbed633[_0x2e659a];return _0x3cf2dc;},a47_0x2e65(_0x56eac7,_0x4ff2e2);}function getSessionPath(_0x1c82d7){const _0x231c03=a47_0x2e65;return a47_0x124b9f['join'](getSessionsDir(),_0x1c82d7+_0x231c03(0xd8));}export function getCurrentSessionPID(){return getPPID();}function a47_0xbed6(){const _0x35258a=['join','api_key','.\x20This\x20is\x20insecure.\x20Removing\x20session.','toString','now','sessions','5lnwMaw','getTime','.json','2948agHpcE','readdirSync','unlinkSync','.config','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','1985052OTNPJT','replace','createdAt','homedir','sort','8MhWtgu','apiKey','includes','writeFileSync','4470ErfZhz','env','1jyMrxG','toISOString','readFileSync','warn','tdx','1918539ebXyII','push','3630276snpeYG','stringify','test','parse','utf-8','existsSync','11093310atiIkO','1049186rPqmDQ','TDX_CONFIG_DIR','1360909FYHyEy'];a47_0xbed6=function(){return _0x35258a;};return a47_0xbed6();}export function getSessionID(_0x962d25){if(_0x962d25)return _0x962d25;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x19331a){const _0x396357=a47_0x2e65,_0x43baff=_0x19331a||getCurrentSessionPID()[_0x396357(0xd3)](),_0x5bad5a=/^\d+$/[_0x396357(0xc8)](_0x43baff)?parseInt(_0x43baff,0xa):null;return _0x5bad5a!==null?loadSessionContextByPID(_0x5bad5a):loadSessionContextByString(_0x43baff);}export function loadSessionContextByPID(_0x3fd59d){const _0x2334f8=a47_0x2e65,_0x53dab5=getSessionPath(_0x3fd59d);if(!a47_0x182350[_0x2334f8(0xcb)](_0x53dab5))return null;try{const _0x2d3938=a47_0x182350[_0x2334f8(0xc1)](_0x53dab5,_0x2334f8(0xca)),_0x38daf8=JSON[_0x2334f8(0xc9)](_0x2d3938),_0x1b9983=new Date(_0x38daf8[_0x2334f8(0xe0)])[_0x2334f8(0xd7)](),_0x5d866c=Date[_0x2334f8(0xd4)]();if(_0x5d866c-_0x1b9983>SESSION_EXPIRATION_MS)return a47_0x182350[_0x2334f8(0xdb)](_0x53dab5),null;const _0x51afdb=JSON[_0x2334f8(0xc7)](_0x38daf8);if(_0x51afdb[_0x2334f8(0xbb)]('TD_API_KEY')||_0x51afdb[_0x2334f8(0xbb)](_0x2334f8(0xba))||_0x51afdb[_0x2334f8(0xbb)](_0x2334f8(0xd1)))return console['warn'](_0x2334f8(0xdd)+_0x53dab5+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a47_0x182350[_0x2334f8(0xdb)](_0x53dab5),null;return _0x38daf8;}catch{try{a47_0x182350[_0x2334f8(0xdb)](_0x53dab5);}catch{}return null;}}function loadSessionContextByString(_0x65ea66){const _0x2839fe=a47_0x2e65,_0x257e73=a47_0x124b9f[_0x2839fe(0xd0)](getSessionsDir(),_0x65ea66+'.json');if(!a47_0x182350[_0x2839fe(0xcb)](_0x257e73))return null;try{const _0x1cceae=a47_0x182350[_0x2839fe(0xc1)](_0x257e73,_0x2839fe(0xca)),_0x2d556f=JSON[_0x2839fe(0xc9)](_0x1cceae),_0x365503=new Date(_0x2d556f[_0x2839fe(0xe0)])[_0x2839fe(0xd7)](),_0x19f785=Date[_0x2839fe(0xd4)]();if(_0x19f785-_0x365503>SESSION_EXPIRATION_MS)return a47_0x182350[_0x2839fe(0xdb)](_0x257e73),null;const _0x453553=JSON[_0x2839fe(0xc7)](_0x2d556f);if(_0x453553[_0x2839fe(0xbb)]('TD_API_KEY')||_0x453553['includes']('apiKey')||_0x453553[_0x2839fe(0xbb)](_0x2839fe(0xd1)))return console[_0x2839fe(0xc2)](_0x2839fe(0xdd)+_0x257e73+_0x2839fe(0xd2)),a47_0x182350[_0x2839fe(0xdb)](_0x257e73),null;return _0x2d556f;}catch{try{a47_0x182350[_0x2839fe(0xdb)](_0x257e73);}catch{}return null;}}export function saveSessionContext(_0x424332,_0x5c7e27){const _0x4c6b08=a47_0x2e65,_0x48d0f2=_0x5c7e27||getCurrentSessionPID()['toString'](),_0x42b312=/^\d+$/[_0x4c6b08(0xc8)](_0x48d0f2)?parseInt(_0x48d0f2,0xa):getCurrentSessionPID(),_0xf15978=a47_0x124b9f['join'](getSessionsDir(),_0x48d0f2+_0x4c6b08(0xd8)),_0x529d2f=getSessionsDir();createSecureDirectory(_0x529d2f);const _0x69b0df=JSON[_0x4c6b08(0xc7)](_0x424332);if(_0x69b0df[_0x4c6b08(0xbb)]('TD_API_KEY')||_0x69b0df[_0x4c6b08(0xbb)]('apiKey')||_0x69b0df[_0x4c6b08(0xbb)](_0x4c6b08(0xd1)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x392d48;const _0x28baae=/^\d+$/[_0x4c6b08(0xc8)](_0x48d0f2)?loadSessionContextByPID(parseInt(_0x48d0f2,0xa)):loadSessionContextByString(_0x48d0f2);_0x28baae?_0x392d48={..._0x28baae,..._0x424332,'pid':_0x42b312,'sessionId':_0x48d0f2!==_0x42b312[_0x4c6b08(0xd3)]()?_0x48d0f2:undefined,'updatedAt':new Date()[_0x4c6b08(0xc0)]()}:_0x392d48={'pid':_0x42b312,'sessionId':_0x48d0f2!==_0x42b312['toString']()?_0x48d0f2:undefined,..._0x424332,'createdAt':new Date()[_0x4c6b08(0xc0)](),'updatedAt':new Date()[_0x4c6b08(0xc0)]()},a47_0x182350[_0x4c6b08(0xbc)](_0xf15978,JSON[_0x4c6b08(0xc7)](_0x392d48,null,0x2));}export function clearSessionContext(_0x26fb02){const _0x221b3a=a47_0x2e65,_0x54481f=_0x26fb02||getCurrentSessionPID()[_0x221b3a(0xd3)](),_0xfa1766=a47_0x124b9f[_0x221b3a(0xd0)](getSessionsDir(),_0x54481f+_0x221b3a(0xd8));a47_0x182350[_0x221b3a(0xcb)](_0xfa1766)&&a47_0x182350['unlinkSync'](_0xfa1766);}export function cleanExpiredSessions(){const _0x261a46=a47_0x2e65,_0x12f26a=getSessionsDir();if(!a47_0x182350[_0x261a46(0xcb)](_0x12f26a))return 0x0;let _0x2f9868=0x0;const _0x5a5d50=Date[_0x261a46(0xd4)]();try{const _0x5c8e16=a47_0x182350['readdirSync'](_0x12f26a);for(const _0x396d14 of _0x5c8e16){if(!_0x396d14['endsWith']('.json'))continue;const _0x35b079=a47_0x124b9f[_0x261a46(0xd0)](_0x12f26a,_0x396d14),_0x50e8d2=_0x396d14[_0x261a46(0xdf)](_0x261a46(0xd8),''),_0x774ef=parseInt(_0x50e8d2,0xa),_0x538161=!isNaN(_0x774ef);if(_0x538161){if(!isProcessRunning(_0x774ef)){a47_0x182350[_0x261a46(0xdb)](_0x35b079),_0x2f9868++;continue;}}try{const _0x3127c4=a47_0x182350[_0x261a46(0xc1)](_0x35b079,'utf-8'),_0x1c0fe7=JSON['parse'](_0x3127c4),_0x301104=new Date(_0x1c0fe7[_0x261a46(0xe0)])[_0x261a46(0xd7)]();_0x5a5d50-_0x301104>SESSION_EXPIRATION_MS&&(a47_0x182350[_0x261a46(0xdb)](_0x35b079),_0x2f9868++);}catch{a47_0x182350[_0x261a46(0xdb)](_0x35b079),_0x2f9868++;}}}catch{}return _0x2f9868;}export function listActiveSessions(){const _0x2d5a3b=a47_0x2e65,_0xb5637e=getSessionsDir();if(!a47_0x182350[_0x2d5a3b(0xcb)](_0xb5637e))return[];try{const _0x16f8f5=a47_0x182350[_0x2d5a3b(0xda)](_0xb5637e),_0x215578=[];for(const _0x5ead24 of _0x16f8f5){if(!_0x5ead24['endsWith'](_0x2d5a3b(0xd8)))continue;const _0x288638=_0x5ead24[_0x2d5a3b(0xdf)]('.json',''),_0xf64c48=parseInt(_0x288638,0xa);!isNaN(_0xf64c48)&&isProcessRunning(_0xf64c48)&&_0x215578[_0x2d5a3b(0xc5)](_0xf64c48);}return _0x215578[_0x2d5a3b(0xe2)]((_0x44f600,_0xdea836)=>_0x44f600-_0xdea836);}catch{return[];}}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0x1f0dee,_0x15c831){var _0x42c18b=a48_0x3915,_0x21a2a4=_0x1f0dee();while(!![]){try{var _0x4c4aeb=-parseInt(_0x42c18b(0x1d5))/0x1*(-parseInt(_0x42c18b(0x1da))/0x2)+parseInt(_0x42c18b(0x1d6))/0x3+-parseInt(_0x42c18b(0x1d8))/0x4+-parseInt(_0x42c18b(0x1d4))/0x5*(parseInt(_0x42c18b(0x1d9))/0x6)+parseInt(_0x42c18b(0x1d7))/0x7*(-parseInt(_0x42c18b(0x1db))/0x8)+parseInt(_0x42c18b(0x1dd))/0x9+-parseInt(_0x42c18b(0x1dc))/0xa*(parseInt(_0x42c18b(0x1de))/0xb);if(_0x4c4aeb===_0x15c831)break;else _0x21a2a4['push'](_0x21a2a4['shift']());}catch(_0x3d429b){_0x21a2a4['push'](_0x21a2a4['shift']());}}}(a48_0x2661,0x4ee9d));export*from'./types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./client/http-client.js';export*from'./client/td-api-client.js';export{TrinoApiClient}from'./client/trino-api-client.js';function a48_0x3915(_0x2509cb,_0x5a4e32){var _0x2661a4=a48_0x2661();return a48_0x3915=function(_0x39157c,_0x74bdbc){_0x39157c=_0x39157c-0x1d4;var _0x37615f=_0x2661a4[_0x39157c];return _0x37615f;},a48_0x3915(_0x2509cb,_0x5a4e32);}function a48_0x2661(){var _0x242731=['2GJWAeQ','8QfEhYl','3039570FCwOiA','801846zwXHHx','11KDTtmF','10qDINZW','625377rGBpTE','480468rkNzkJ','311633PGuAVA','461736ZdwFaN','262464QwQYAQ'];a48_0x2661=function(){return _0x242731;};return a48_0x2661();}export*from'./client/rate-limiter.js';export*from'./types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
1
+ (function(_0x43c4e1,_0x31323b){var _0xcffeca=a48_0x4c84,_0x4a811b=_0x43c4e1();while(!![]){try{var _0x4d80ec=-parseInt(_0xcffeca(0xca))/0x1*(parseInt(_0xcffeca(0xcf))/0x2)+parseInt(_0xcffeca(0xce))/0x3*(parseInt(_0xcffeca(0xcb))/0x4)+-parseInt(_0xcffeca(0xc6))/0x5+parseInt(_0xcffeca(0xcc))/0x6*(parseInt(_0xcffeca(0xc9))/0x7)+parseInt(_0xcffeca(0xc5))/0x8*(parseInt(_0xcffeca(0xcd))/0x9)+-parseInt(_0xcffeca(0xc4))/0xa*(parseInt(_0xcffeca(0xc8))/0xb)+-parseInt(_0xcffeca(0xd0))/0xc*(-parseInt(_0xcffeca(0xc7))/0xd);if(_0x4d80ec===_0x31323b)break;else _0x4a811b['push'](_0x4a811b['shift']());}catch(_0x1efe1f){_0x4a811b['push'](_0x4a811b['shift']());}}}(a48_0x3864,0x6fb36));export*from'./types/index.js';export*from'./core/config.js';function a48_0x3864(){var _0xce1b27=['1901695heMbEG','91jWSVxf','4385920oJZBgC','227122JgUnAC','9nQHyZw','52Joqbyh','66hsxpLW','18AuQsLt','115722eVDWzS','186374kgHKIn','1680072SWhOtL','10yXdHSB','947432tchlsi'];a48_0x3864=function(){return _0xce1b27;};return a48_0x3864();}export*from'./core/auth.js';function a48_0x4c84(_0x534aa6,_0x20ea06){var _0x38640b=a48_0x3864();return a48_0x4c84=function(_0x4c849b,_0x3ecec5){_0x4c849b=_0x4c849b-0xc4;var _0x376ec8=_0x38640b[_0x4c849b];return _0x376ec8;},a48_0x4c84(_0x534aa6,_0x20ea06);}export*from'./client/http-client.js';export*from'./client/td-api-client.js';export{TrinoApiClient}from'./client/trino-api-client.js';export*from'./client/rate-limiter.js';export*from'./types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';