@treasuredata/tdx 0.4.5 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/build-info.json +2 -2
  2. package/dist/cli.js +1 -1
  3. package/dist/cli.js.map +1 -1
  4. package/dist/client/cdp-api-client.js +1 -1
  5. package/dist/client/engage-api-client.js +1 -1
  6. package/dist/client/http-client.js +1 -1
  7. package/dist/client/llm-api-client.js +1 -1
  8. package/dist/client/rate-limiter.js +1 -1
  9. package/dist/client/td-api-client.js +1 -1
  10. package/dist/client/trino-api-client.js +1 -1
  11. package/dist/client/workflow-client.js +1 -1
  12. package/dist/commands/activations.js +1 -1
  13. package/dist/commands/api-command.js +1 -1
  14. package/dist/commands/auth-command.js +1 -1
  15. package/dist/commands/chat-command.js +1 -1
  16. package/dist/commands/claude-command.js +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/context-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-command.js +1 -1
  22. package/dist/commands/job-command.js +1 -1
  23. package/dist/commands/llm-command.js +1 -1
  24. package/dist/commands/llm-proxy.js +1 -1
  25. package/dist/commands/parent-segment-command.js +1 -1
  26. package/dist/commands/profiles-command.js +1 -1
  27. package/dist/commands/query-command.js +1 -1
  28. package/dist/commands/segment-command.js +1 -1
  29. package/dist/commands/segment-create-command.js +1 -1
  30. package/dist/commands/segment-fields-command.js +1 -1
  31. package/dist/commands/segment-pwd-command.js +1 -1
  32. package/dist/commands/segment-update-command.js +1 -1
  33. package/dist/commands/segment-use-command.js +1 -1
  34. package/dist/commands/segments.js +1 -1
  35. package/dist/commands/show.js +1 -1
  36. package/dist/commands/tables.js +1 -1
  37. package/dist/commands/use-command.js +1 -1
  38. package/dist/commands/workflow-command.js +1 -1
  39. package/dist/core/auth.js +1 -1
  40. package/dist/core/config.js +1 -1
  41. package/dist/core/credential-cache.js +1 -1
  42. package/dist/core/global-context.js +1 -1
  43. package/dist/core/keychain.js +1 -1
  44. package/dist/core/profile.js +1 -1
  45. package/dist/core/project-config.js +1 -1
  46. package/dist/core/session.js +1 -1
  47. package/dist/index.js +1 -1
  48. package/dist/proxy/anthropic-adapter.js +1 -1
  49. package/dist/proxy/server.js +1 -1
  50. package/dist/proxy/session-cache.js +1 -1
  51. package/dist/sdk/api.js +1 -1
  52. package/dist/sdk/engage.js +1 -1
  53. package/dist/sdk/errors.js +1 -1
  54. package/dist/sdk/index.js +1 -1
  55. package/dist/sdk/job.js +1 -1
  56. package/dist/sdk/llm.js +1 -1
  57. package/dist/sdk/query.js +1 -1
  58. package/dist/sdk/segment.js +1 -1
  59. package/dist/sdk/workflow.js +1 -1
  60. package/dist/types/endpoints.js +1 -1
  61. package/dist/types/index.js +1 -1
  62. package/dist/utils/agent-ref-parser.js +1 -1
  63. package/dist/utils/chat-cache.js +1 -1
  64. package/dist/utils/colors.js +1 -1
  65. package/dist/utils/command-output.js +1 -1
  66. package/dist/utils/constants.js +1 -1
  67. package/dist/utils/file-permissions.js +1 -1
  68. package/dist/utils/format-detector.js +1 -1
  69. package/dist/utils/formatters.js +1 -1
  70. package/dist/utils/json-loader.js +1 -1
  71. package/dist/utils/llm-backup-utils.js +1 -1
  72. package/dist/utils/model-aliases.js +1 -1
  73. package/dist/utils/option-validation.js +1 -1
  74. package/dist/utils/port.js +1 -1
  75. package/dist/utils/process.js +1 -1
  76. package/dist/utils/prompt.js +1 -1
  77. package/dist/utils/segment-path-parser.js +1 -1
  78. package/dist/utils/segment-ref-parser.js +1 -1
  79. package/dist/utils/spinner.js +1 -1
  80. package/dist/utils/sql-parser.js +1 -1
  81. package/dist/utils/sse-parser.js +1 -1
  82. package/dist/utils/string-utils.js +1 -1
  83. package/dist/utils/table-ref-parser.js +1 -1
  84. package/dist/utils/tdx-logger.js +1 -1
  85. package/dist/utils/tree-formatter.js +1 -1
  86. package/dist/utils/version-check.js +1 -1
  87. package/dist/utils/workflow-utils.js +1 -1
  88. package/package.json +1 -1
@@ -1 +1 @@
1
- const a35_0x20fa8f=a35_0x595c;(function(_0x454bec,_0x5bf8f0){const _0x1f263e=a35_0x595c,_0x1744ef=_0x454bec();while(!![]){try{const _0xb662c1=-parseInt(_0x1f263e(0x105))/0x1+parseInt(_0x1f263e(0x158))/0x2+parseInt(_0x1f263e(0x103))/0x3+-parseInt(_0x1f263e(0x113))/0x4+-parseInt(_0x1f263e(0x162))/0x5*(parseInt(_0x1f263e(0x123))/0x6)+parseInt(_0x1f263e(0x11f))/0x7*(parseInt(_0x1f263e(0x146))/0x8)+parseInt(_0x1f263e(0x17c))/0x9;if(_0xb662c1===_0x5bf8f0)break;else _0x1744ef['push'](_0x1744ef['shift']());}catch(_0xeca878){_0x1744ef['push'](_0x1744ef['shift']());}}}(a35_0x422a,0x72cbb));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';function a35_0x595c(_0x52c162,_0x26491c){const _0x422a2c=a35_0x422a();return a35_0x595c=function(_0x595ccc,_0x1eea62){_0x595ccc=_0x595ccc-0xef;let _0xaa68d4=_0x422a2c[_0x595ccc];return _0xaa68d4;},a35_0x595c(_0x52c162,_0x26491c);}import{formatBytes}from'../utils/formatters.js';import a35_0x1cc267 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{['name']=a35_0x20fa8f(0x166);[a35_0x20fa8f(0x10a)]='List\x20all\x20workflow\x20projects';async[a35_0x20fa8f(0x149)](_0xef4e9e){const _0x4cbdd4=a35_0x20fa8f,{options:_0x161f09,args:_0x5f54ae,tdx:_0x2b9452}=_0xef4e9e,_0x420064=_0x5f54ae[0x0];try{_0x161f09['verbose']&&_0x420064&&console[_0x4cbdd4(0x130)]('Pattern:\x20'+_0x420064);const _0x5865b7=await withSpinner(_0x4cbdd4(0x120),()=>_0x2b9452[_0x4cbdd4(0x100)][_0x4cbdd4(0x15e)](_0x420064,{'limit':_0x161f09[_0x4cbdd4(0xfe)]}),{'verbose':_0x161f09[_0x4cbdd4(0x12b)]}),_0x16bc88=_0x5865b7[_0x4cbdd4(0x14f)];return console[_0x4cbdd4(0x130)](_0x4cbdd4(0x110)+_0x16bc88['length']+_0x4cbdd4(0x16f)+(_0x16bc88['length']!==0x1?'s':'')),await handleSDKOutput(_0x16bc88,_0x161f09),0x0;}catch(_0x3abb76){if(_0x3abb76 instanceof SDKError)return console[_0x4cbdd4(0x130)](_0x4cbdd4(0x12f)+_0x3abb76[_0x4cbdd4(0x102)]),_0x3abb76[_0x4cbdd4(0x173)]&&console[_0x4cbdd4(0x130)](_0x4cbdd4(0x107)+_0x3abb76['cause']),0x1;throw _0x3abb76;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x127);['description']=a35_0x20fa8f(0x154);async[a35_0x20fa8f(0x149)](_0x13d607){const _0x502803=a35_0x20fa8f,{options:_0x56d3a7,args:_0x385089,tdx:_0x25df7b}=_0x13d607,_0x18a1ec=_0x385089[0x0];try{_0x56d3a7[_0x502803(0x12b)]&&_0x18a1ec&&console[_0x502803(0x130)]('Project\x20filter:\x20'+_0x18a1ec);const _0xc866b=await withSpinner(_0x502803(0x18a),()=>_0x25df7b[_0x502803(0x100)]['workflows'](_0x18a1ec,{'limit':_0x56d3a7['limit']}),{'verbose':_0x56d3a7[_0x502803(0x12b)]}),_0x57c373=_0xc866b[_0x502803(0x14f)];return console[_0x502803(0x130)](_0x502803(0x110)+_0x57c373[_0x502803(0x14c)]+_0x502803(0x187)+(_0x57c373[_0x502803(0x14c)]!==0x1?'s':'')),await handleSDKOutput(_0x57c373,_0x56d3a7),0x0;}catch(_0x15333c){if(_0x15333c instanceof SDKError)return console[_0x502803(0x130)](_0x502803(0x12f)+_0x15333c[_0x502803(0x102)]),_0x15333c[_0x502803(0x173)]&&console['error']('\x20\x20Cause:\x20'+_0x15333c[_0x502803(0x173)]),0x1;throw _0x15333c;}}}export class WorkflowSessionsCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x14a);[a35_0x20fa8f(0x10a)]=a35_0x20fa8f(0x10d);async[a35_0x20fa8f(0x149)](_0x5e6d13){const _0x1cf963=a35_0x20fa8f,{options:_0x2a877b,args:_0x113fba,tdx:_0xc0b026}=_0x5e6d13;let _0x721d0f,_0x2bc1ec;if(_0x113fba[0x0]){const _0x512a57=_0x113fba[0x0][_0x1cf963(0x182)]('.');if(_0x512a57['length']===0x1)_0x721d0f=_0x512a57[0x0];else{if(_0x512a57[_0x1cf963(0x14c)]===0x2)[_0x721d0f,_0x2bc1ec]=_0x512a57;else return console[_0x1cf963(0x130)](_0x1cf963(0x159)),0x1;}}try{if(_0x2a877b[_0x1cf963(0x12b)]){if(_0x721d0f&&_0x2bc1ec)console['error']('Filter:\x20'+_0x721d0f+'.'+_0x2bc1ec);else _0x721d0f&&console[_0x1cf963(0x130)](_0x1cf963(0x138)+_0x721d0f);const _0x4f2b38=_0x2a877b[_0x1cf963(0x18e)];_0x4f2b38&&console['error'](_0x1cf963(0x137)+_0x4f2b38);}const _0x4d1f1c=await withSpinner(_0x1cf963(0x14b),()=>_0xc0b026[_0x1cf963(0x100)][_0x1cf963(0xf7)]({'projectName':_0x721d0f,'workflowName':_0x2bc1ec,'status':_0x2a877b['status'],'fromTime':_0x2a877b[_0x1cf963(0x183)],'toTime':_0x2a877b['to'],'limit':_0x2a877b[_0x1cf963(0xfe)]}),{'verbose':_0x2a877b[_0x1cf963(0x12b)]}),_0x26fc98=_0x4d1f1c[_0x1cf963(0x14f)];return console['error'](_0x1cf963(0x110)+_0x26fc98[_0x1cf963(0x14c)]+_0x1cf963(0x16e)+(_0x26fc98[_0x1cf963(0x14c)]!==0x1?'s':'')),await handleSDKOutput(_0x26fc98,_0x2a877b),0x0;}catch(_0x1f5f68){if(_0x1f5f68 instanceof SDKError)return console['error'](_0x1cf963(0x12f)+_0x1f5f68['message']),_0x1f5f68['cause']&&console['error'](_0x1cf963(0x107)+_0x1f5f68['cause']),0x1;throw _0x1f5f68;}}}export class WorkflowAttemptsCommand extends BaseCommand{['name']=a35_0x20fa8f(0x126);['description']=a35_0x20fa8f(0x16d);async[a35_0x20fa8f(0x149)](_0x1feacf){const _0x18d9b7=a35_0x20fa8f,{options:_0x5c80aa,args:_0x66aef0,tdx:_0x37ec34}=_0x1feacf;let _0x3c18c5,_0x3b6929;if(_0x66aef0[0x0]){const _0x5045ac=_0x66aef0[0x0]['split']('.');if(_0x5045ac[_0x18d9b7(0x14c)]===0x1)_0x3c18c5=_0x5045ac[0x0];else{if(_0x5045ac['length']===0x2)[_0x3c18c5,_0x3b6929]=_0x5045ac;else return console[_0x18d9b7(0x130)](_0x18d9b7(0x159)),0x1;}}try{const _0x35c840=_0x5c80aa[_0x18d9b7(0x109)];if(_0x5c80aa[_0x18d9b7(0x12b)]){if(_0x3c18c5&&_0x3b6929)console[_0x18d9b7(0x130)](_0x18d9b7(0x18c)+_0x3c18c5+'.'+_0x3b6929);else _0x3c18c5&&console[_0x18d9b7(0x130)](_0x18d9b7(0x138)+_0x3c18c5);_0x35c840&&console[_0x18d9b7(0x130)](_0x18d9b7(0x106));}const _0x3e9c91=await withSpinner(_0x18d9b7(0x176),()=>_0x37ec34[_0x18d9b7(0x100)][_0x18d9b7(0x11d)]({'projectName':_0x3c18c5,'workflowName':_0x3b6929,'includeRetried':_0x35c840,'limit':_0x5c80aa[_0x18d9b7(0xfe)]}),{'verbose':_0x5c80aa[_0x18d9b7(0x12b)]}),_0x1bcb22=_0x3e9c91[_0x18d9b7(0x14f)];return console['error']('✔\x20Found\x20'+_0x1bcb22['length']+'\x20attempt'+(_0x1bcb22[_0x18d9b7(0x14c)]!==0x1?'s':'')),await handleSDKOutput(_0x1bcb22,_0x5c80aa),0x0;}catch(_0x2a5d01){if(_0x2a5d01 instanceof SDKError)return console[_0x18d9b7(0x130)](_0x18d9b7(0x12f)+_0x2a5d01[_0x18d9b7(0x102)]),_0x2a5d01[_0x18d9b7(0x173)]&&console[_0x18d9b7(0x130)](_0x18d9b7(0x107)+_0x2a5d01['cause']),0x1;throw _0x2a5d01;}}}export class WorkflowAttemptCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x129);['description']='Show\x20specific\x20attempt\x20details';async[a35_0x20fa8f(0x149)](_0x3a9f63){const _0x44de79=a35_0x20fa8f,{options:_0x27796b,args:_0x566ffe,tdx:_0x342703}=_0x3a9f63,_0x488c42=_0x566ffe[0x0];if(!_0x488c42)return console['error'](_0x44de79(0x170)),0x1;try{_0x27796b[_0x44de79(0x12b)]&&console[_0x44de79(0x130)]('Attempt\x20ID:\x20'+_0x488c42);const _0x7b99d8=await withSpinner(_0x44de79(0x163),()=>_0x342703[_0x44de79(0x100)][_0x44de79(0x114)](_0x488c42),{'verbose':_0x27796b[_0x44de79(0x12b)]}),_0x4ba5f9=_0x7b99d8['data'];let _0x176099;!_0x4ba5f9['done']?_0x176099=_0x4ba5f9[_0x44de79(0xf9)]?_0x44de79(0x17b):_0x44de79(0x11c):_0x176099=_0x4ba5f9[_0x44de79(0x140)]?_0x44de79(0x140):'error';let _0x514fa3;if(_0x4ba5f9[_0x44de79(0x147)]&&_0x4ba5f9[_0x44de79(0x153)]){const _0x17fa75=new Date(_0x4ba5f9[_0x44de79(0x147)])[_0x44de79(0x189)](),_0x59cdc4=new Date(_0x4ba5f9[_0x44de79(0x153)])['getTime']();_0x514fa3=Math[_0x44de79(0xef)]((_0x59cdc4-_0x17fa75)/0x3e8);}const _0x47026e={'attempt_id':_0x4ba5f9['id'],'status':_0x176099,..._0x4ba5f9['index']!==undefined&&{'index':_0x4ba5f9['index']},..._0x4ba5f9[_0x44de79(0xf4)]&&{'project':_0x4ba5f9['project']['name']},..._0x4ba5f9[_0x44de79(0x100)]&&{'workflow':_0x4ba5f9[_0x44de79(0x100)][_0x44de79(0x124)]},..._0x4ba5f9['sessionId']&&{'session_id':_0x4ba5f9[_0x44de79(0xff)]},..._0x4ba5f9[_0x44de79(0x155)]&&{'session_time':_0x4ba5f9[_0x44de79(0x155)]},..._0x4ba5f9[_0x44de79(0x139)]&&{'retry_attempt':_0x4ba5f9['retryAttemptName']},..._0x514fa3!==undefined&&{'duration_sec':_0x514fa3},..._0x4ba5f9[_0x44de79(0x147)]&&{'created_at':_0x4ba5f9['createdAt']},..._0x4ba5f9[_0x44de79(0x153)]&&{'finished_at':_0x4ba5f9[_0x44de79(0x153)]},...Object['keys'](_0x4ba5f9[_0x44de79(0x132)])['length']>0x0&&{'params':_0x4ba5f9['params']}};return await handleSingleObjectOutput(_0x47026e,_0x27796b),0x0;}catch(_0x13fc60){if(_0x13fc60 instanceof SDKError)return console['error'](_0x44de79(0x12f)+_0x13fc60['message']),_0x13fc60['cause']&&console[_0x44de79(0x130)](_0x44de79(0x107)+_0x13fc60[_0x44de79(0x173)]),0x1;throw _0x13fc60;}}}export class WorkflowTasksCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x190);[a35_0x20fa8f(0x10a)]='Show\x20tasks\x20for\x20an\x20attempt';async[a35_0x20fa8f(0x149)](_0x291a3c){const _0x222236=a35_0x20fa8f,{options:_0x3a06ca,args:_0x2474c1,tdx:_0x2a7f88}=_0x291a3c,_0x5c8c97=_0x2474c1[0x0];if(!_0x5c8c97)return console[_0x222236(0x130)](_0x222236(0x170)),0x1;try{const _0x4c4f18=_0x3a06ca[_0x222236(0xf0)];_0x3a06ca['verbose']&&(console[_0x222236(0x130)]('Attempt\x20ID:\x20'+_0x5c8c97),_0x4c4f18&&console[_0x222236(0x130)](_0x222236(0x141)));const _0x7e02fa=await withSpinner(_0x222236(0xf5),()=>_0x2a7f88[_0x222236(0x100)][_0x222236(0x15b)](_0x5c8c97,_0x4c4f18||![]),{'verbose':_0x3a06ca[_0x222236(0x12b)]}),_0x1520d7=_0x7e02fa[_0x222236(0x14f)];return console[_0x222236(0x130)]('✔\x20Found\x20'+_0x1520d7[_0x222236(0x14c)]+_0x222236(0x117)+(_0x1520d7['length']!==0x1?'s':'')),await handleSDKOutput(_0x1520d7,_0x3a06ca),0x0;}catch(_0x1c373a){if(_0x1c373a instanceof SDKError)return console[_0x222236(0x130)](_0x222236(0x12f)+_0x1c373a['message']),_0x1c373a[_0x222236(0x173)]&&console['error'](_0x222236(0x107)+_0x1c373a[_0x222236(0x173)]),0x1;throw _0x1c373a;}}}export class WorkflowLogsCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x112);[a35_0x20fa8f(0x10a)]=a35_0x20fa8f(0x172);async[a35_0x20fa8f(0x149)](_0x3c800e){const _0x4bb1ac=a35_0x20fa8f,{options:_0x70159b,args:_0x1e62ea,tdx:_0x2df84d}=_0x3c800e,_0x2174a2=_0x1e62ea[0x0];let _0x3de448=_0x1e62ea[0x1];if(!_0x2174a2)return console[_0x4bb1ac(0x130)](_0x4bb1ac(0x170)),0x1;try{_0x70159b['verbose']&&(console[_0x4bb1ac(0x130)]('Attempt\x20ID:\x20'+_0x2174a2),_0x3de448&&console[_0x4bb1ac(0x130)]('Task\x20name:\x20'+_0x3de448));const _0xcba0dd=await withSpinner(_0x4bb1ac(0x171),()=>_0x2df84d['workflow'][_0x4bb1ac(0x134)](_0x2174a2,_0x3de448),{'verbose':_0x70159b[_0x4bb1ac(0x12b)]}),_0x54930d=_0xcba0dd[_0x4bb1ac(0x14f)];if(_0x54930d['length']===0x0)return console[_0x4bb1ac(0x130)](_0x4bb1ac(0x118)),0x0;if(!_0x3de448&&(_0x70159b[_0x4bb1ac(0x151)]||_0x70159b[_0x4bb1ac(0x108)]))return await handleSDKOutput(_0x54930d,_0x70159b),0x0;if(!_0x3de448){const _0x342d71=_0x54930d['map'](_0x345d5b=>({'title':_0x345d5b[_0x4bb1ac(0x148)]+'\x20('+formatBytes(_0x345d5b['fileSize'])+')','value':_0x345d5b['taskName']})),_0xc1a6e6=await a35_0x1cc267({'type':_0x4bb1ac(0x133),'name':_0x4bb1ac(0x10f),'message':_0x4bb1ac(0x16b),'choices':_0x342d71});if(!_0xc1a6e6[_0x4bb1ac(0x10f)])return console['error'](_0x4bb1ac(0xfa)),0x0;_0x3de448=_0xc1a6e6[_0x4bb1ac(0x10f)];}const _0x37acf0=await withSpinner('Downloading\x20logs...',()=>_0x2df84d['workflow'][_0x4bb1ac(0x180)](_0x2174a2,_0x3de448),{'verbose':_0x70159b[_0x4bb1ac(0x12b)]}),_0x5d66c1=_0x37acf0[_0x4bb1ac(0x14f)];return _0x5d66c1?console[_0x4bb1ac(0x17e)](_0x5d66c1):console[_0x4bb1ac(0x130)]('No\x20log\x20content\x20found'),0x0;}catch(_0x17b0c6){if(_0x17b0c6 instanceof SDKError)return console['error'](_0x4bb1ac(0x12f)+_0x17b0c6[_0x4bb1ac(0x102)]),_0x17b0c6[_0x4bb1ac(0x173)]&&console[_0x4bb1ac(0x130)]('\x20\x20Cause:\x20'+_0x17b0c6['cause']),0x1;throw _0x17b0c6;}}}export class WorkflowKillCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x17d);[a35_0x20fa8f(0x10a)]=a35_0x20fa8f(0x122);async[a35_0x20fa8f(0x149)](_0x394737){const _0x5ce714=a35_0x20fa8f,{options:_0x36991d,args:_0x2c6107,tdx:_0x3550df}=_0x394737,_0x3a08b2=_0x2c6107[0x0];if(!_0x3a08b2)return console[_0x5ce714(0x130)](_0x5ce714(0x170)),0x1;try{const _0xcc36fd=_0x36991d[_0x5ce714(0x116)];_0x36991d['verbose']&&(console[_0x5ce714(0x130)](_0x5ce714(0x174)+_0x3a08b2),_0xcc36fd&&console[_0x5ce714(0x130)]('Reason:\x20'+_0xcc36fd));if(!_0x36991d[_0x5ce714(0x175)]){const _0x54ea9c=await confirm(_0x5ce714(0xf1)+_0x3a08b2+'?');if(!_0x54ea9c)return console[_0x5ce714(0x130)](_0x5ce714(0xfa)),0x0;}const _0xf8e25=await withSpinner('Killing\x20attempt...',()=>_0x3550df['workflow'][_0x5ce714(0x10e)](_0x3a08b2,_0xcc36fd),{'verbose':_0x36991d[_0x5ce714(0x12b)]}),_0x5f1fb9=_0xf8e25[_0x5ce714(0x14f)];return console[_0x5ce714(0x130)]('✔\x20'+_0x5f1fb9),0x0;}catch(_0x26af0){if(_0x26af0 instanceof SDKError)return console[_0x5ce714(0x130)](_0x5ce714(0x12f)+_0x26af0[_0x5ce714(0x102)]),_0x26af0['cause']&&console[_0x5ce714(0x130)]('\x20\x20Cause:\x20'+_0x26af0['cause']),0x1;throw _0x26af0;}}}export class WorkflowRetryCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x104);[a35_0x20fa8f(0x10a)]='Retry\x20a\x20session\x20or\x20attempt';async['execute'](_0x1a6e34){const _0x357ce3=a35_0x20fa8f,{options:_0x12abf2,args:_0x369856,tdx:_0x3a2f53}=_0x1a6e34,_0x5e1891=_0x369856[0x0];if(!_0x5e1891)return console[_0x357ce3(0x130)](_0x357ce3(0x131)),console[_0x357ce3(0x130)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x504143=![],_0x572ea3=_0x5e1891;if(_0x5e1891[_0x357ce3(0x13b)](_0x357ce3(0x144)))_0x504143=!![],_0x572ea3=_0x5e1891['substring'](0x8);else{if(_0x5e1891[_0x357ce3(0x13b)](_0x357ce3(0x150)))_0x504143=![],_0x572ea3=_0x5e1891['substring'](0x8);else return console['error']('Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'),console[_0x357ce3(0x130)](_0x357ce3(0x136)),0x1;}try{const _0x4babee=_0x12abf2[_0x357ce3(0x14e)],_0x52777e=_0x12abf2[_0x357ce3(0x15a)],_0x25d7df=_0x12abf2[_0x357ce3(0x132)],_0x7cf3ed=_0x12abf2[_0x357ce3(0xf6)];_0x12abf2['verbose']&&(console[_0x357ce3(0x130)]('Target:\x20'+(_0x504143?'session':_0x357ce3(0x114))+'\x20'+_0x572ea3),_0x4babee&&console[_0x357ce3(0x130)](_0x357ce3(0x142)+_0x4babee),_0x52777e&&console[_0x357ce3(0x130)](_0x357ce3(0x145)+_0x52777e),_0x25d7df&&console['error'](_0x357ce3(0x178)+_0x25d7df),_0x7cf3ed&&console[_0x357ce3(0x130)](_0x357ce3(0x167)));let _0x374ffc;if(_0x25d7df)try{if(_0x25d7df[_0x357ce3(0x13b)]('@')){const _0x1da13a=await import(_0x357ce3(0xfc)),_0x256088=_0x25d7df['substring'](0x1),_0x93b6f=await _0x1da13a[_0x357ce3(0x160)](_0x256088,_0x357ce3(0x12a));_0x374ffc=JSON['parse'](_0x93b6f);}else _0x374ffc=JSON[_0x357ce3(0x16a)](_0x25d7df);}catch{return console[_0x357ce3(0x130)](_0x357ce3(0x10b)),0x1;}if(!_0x12abf2[_0x357ce3(0x175)]){const _0x4c2e99=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20'+(_0x504143?_0x357ce3(0xfd):'attempt')+'\x20'+_0x572ea3+'?');if(!_0x4c2e99)return console[_0x357ce3(0x130)]('Cancelled'),0x0;}let _0x3c9b87;_0x504143?_0x3c9b87=await withSpinner(_0x357ce3(0x14d),()=>_0x3a2f53[_0x357ce3(0x100)]['retrySession'](_0x572ea3,{'fromTask':_0x4babee,'retryParams':_0x374ffc}),{'verbose':_0x12abf2[_0x357ce3(0x12b)]}):_0x3c9b87=await withSpinner('Retrying\x20attempt...',()=>_0x3a2f53[_0x357ce3(0x100)][_0x357ce3(0x125)](_0x572ea3,{'resumeFrom':_0x52777e,'retryParams':_0x374ffc,'force':_0x7cf3ed}),{'verbose':_0x12abf2[_0x357ce3(0x12b)]});const _0x1ff7b8=_0x3c9b87[_0x357ce3(0x14f)];return console['error'](_0x357ce3(0x179)),console['error'](_0x357ce3(0xf2)+_0x1ff7b8[_0x357ce3(0x121)]),console[_0x357ce3(0x130)](_0x357ce3(0xf8)+_0x1ff7b8[_0x357ce3(0xff)]),0x0;}catch(_0x2e0d54){if(_0x2e0d54 instanceof SDKError)return console[_0x357ce3(0x130)](_0x357ce3(0x12f)+_0x2e0d54[_0x357ce3(0x102)]),_0x2e0d54[_0x357ce3(0x173)]&&console[_0x357ce3(0x130)](_0x357ce3(0x107)+_0x2e0d54[_0x357ce3(0x173)]),0x1;throw _0x2e0d54;}}}export class WorkflowRunCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x12e);[a35_0x20fa8f(0x10a)]=a35_0x20fa8f(0x10c);async['execute'](_0x4f864b){const _0x57e63d=a35_0x20fa8f,{options:_0x3053ab,args:_0x576dae,tdx:_0x24e398}=_0x4f864b,_0xcb3923=_0x576dae[0x0];if(!_0xcb3923)return console['error']('Error:\x20Workflow\x20identifier\x20is\x20required'),console[_0x57e63d(0x130)](_0x57e63d(0x165)),0x1;const _0x484f5f=_0x3053ab[_0x57e63d(0x111)],_0x410158=_0x3053ab[_0x57e63d(0x155)],_0x148de9={};if(_0x484f5f&&Array[_0x57e63d(0x169)](_0x484f5f))for(const _0x3fa521 of _0x484f5f){const _0x33f4fd=_0x3fa521[_0x57e63d(0x13a)]('=');if(_0x33f4fd===-0x1)return console[_0x57e63d(0x130)](_0x57e63d(0x11e)+_0x3fa521),console[_0x57e63d(0x130)]('Expected\x20format:\x20--param\x20key=value'),0x1;const _0x51eda9=_0x3fa521[_0x57e63d(0x152)](0x0,_0x33f4fd),_0x1f0cab=_0x3fa521[_0x57e63d(0x152)](_0x33f4fd+0x1);try{_0x148de9[_0x51eda9]=JSON[_0x57e63d(0x16a)](_0x1f0cab);}catch{_0x148de9[_0x51eda9]=_0x1f0cab;}}_0x3053ab[_0x57e63d(0x12b)]&&(console['error'](_0x57e63d(0x101)+_0xcb3923),Object['keys'](_0x148de9)['length']>0x0&&console[_0x57e63d(0x130)](_0x57e63d(0x13d)+JSON[_0x57e63d(0x13f)](_0x148de9)),_0x410158&&console[_0x57e63d(0x130)](_0x57e63d(0x13c)+_0x410158));const _0x3a3154=await withSpinner('Starting\x20workflow\x20run...',()=>_0x24e398['workflow']['run'](_0xcb3923,_0x148de9,{'sessionTime':_0x410158}),{'verbose':_0x3053ab[_0x57e63d(0x12b)]}),_0x289cb6=_0x3a3154['data'];return console[_0x57e63d(0x130)](_0x57e63d(0x11b)),console[_0x57e63d(0x130)](_0x57e63d(0x17f)+_0x289cb6['id']),console[_0x57e63d(0x130)](_0x57e63d(0xf8)+_0x289cb6[_0x57e63d(0xff)]),console[_0x57e63d(0x130)]('\x20\x20Project:\x20'+_0x289cb6[_0x57e63d(0xf4)]?.['name']),console[_0x57e63d(0x130)](_0x57e63d(0x186)+_0x289cb6[_0x57e63d(0x100)]?.[_0x57e63d(0x124)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x168);[a35_0x20fa8f(0x10a)]='Download\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a35_0x20fa8f(0x149)](_0x16529f){const _0x1d64cf=a35_0x20fa8f,{options:_0x8a19ae,args:_0x49c41,tdx:_0x34db01}=_0x16529f,_0x32013d=_0x49c41[0x0],_0x5cdd4b=_0x49c41[0x1]||'.';if(!_0x32013d)return console[_0x1d64cf(0x130)](_0x1d64cf(0x164)),console[_0x1d64cf(0x130)](_0x1d64cf(0x185)),0x1;const _0x4c05c4=_0x8a19ae['revision'];_0x8a19ae['verbose']&&(console['error']('Project:\x20'+_0x32013d),console[_0x1d64cf(0x130)](_0x1d64cf(0x15c)+_0x5cdd4b),_0x4c05c4&&console[_0x1d64cf(0x130)](_0x1d64cf(0x115)+_0x4c05c4));const _0x3d489b=await withSpinner(_0x1d64cf(0x188)+_0x32013d+_0x1d64cf(0x12d),()=>_0x34db01[_0x1d64cf(0x100)]['download'](_0x32013d,_0x5cdd4b,{'revision':_0x4c05c4}),{'verbose':_0x8a19ae['verbose']}),_0x6ac38=_0x3d489b['data'];return console[_0x1d64cf(0x130)]('✔\x20Downloaded\x20'+_0x6ac38[_0x1d64cf(0x156)]),console['error'](_0x1d64cf(0x143)+_0x6ac38['revision']),console[_0x1d64cf(0x130)](_0x1d64cf(0x18b)+_0x6ac38[_0x1d64cf(0x12c)]),console[_0x1d64cf(0x130)]('\x20\x20Location:\x20'+_0x5cdd4b+'/'+_0x6ac38[_0x1d64cf(0x156)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a35_0x20fa8f(0x124)]='workflow:push';[a35_0x20fa8f(0x10a)]=a35_0x20fa8f(0x16c);async[a35_0x20fa8f(0x149)](_0x5baf3f){const _0x1a567c=a35_0x20fa8f,{options:_0x1d7d22,args:_0x1277c7,tdx:_0x381082}=_0x5baf3f;let _0x33af7c='.',_0x2a3331=_0x1d7d22['name'];if(_0x1277c7[0x0]){const {promises:_0x3b1cdc}=await import('fs');try{const _0x593245=await _0x3b1cdc['stat'](_0x1277c7[0x0]);if(_0x593245[_0x1a567c(0x181)]())_0x33af7c=_0x1277c7[0x0];else return console[_0x1a567c(0x130)](_0x1a567c(0x12f)+_0x1277c7[0x0]+_0x1a567c(0x17a)),0x1;}catch{_0x2a3331=_0x1277c7[0x0],_0x33af7c='.';}}const _0x4faf46=_0x1d7d22[_0x1a567c(0x15f)],_0xf0b255=_0x1d7d22[_0x1a567c(0x18d)];_0x1d7d22[_0x1a567c(0x12b)]&&(console[_0x1a567c(0x130)](_0x1a567c(0x177)+_0x33af7c),_0x2a3331&&console[_0x1a567c(0x130)](_0x1a567c(0x135)+_0x2a3331),_0x4faf46&&console[_0x1a567c(0x130)](_0x1a567c(0x115)+_0x4faf46),_0xf0b255&&console['error']('Validation:\x20skipped'));const _0x1a03fb=await withSpinner(_0x1a567c(0x161),()=>_0x381082[_0x1a567c(0x100)]['push'](_0x33af7c,{'projectName':_0x2a3331,'revision':_0x4faf46,'skipValidation':_0xf0b255}),{'verbose':_0x1d7d22[_0x1a567c(0x12b)]}),_0x20a674=_0x1a03fb[_0x1a567c(0x14f)];return console[_0x1a567c(0x130)](_0x1a567c(0x119)+_0x20a674[_0x1a567c(0x156)]),console[_0x1a567c(0x130)](_0x1a567c(0x128)+_0x20a674[_0x1a567c(0x11a)]),console['error'](_0x1a567c(0x143)+_0x20a674[_0x1a567c(0x15f)]),0x0;}}function a35_0x422a(){const _0x2f3d3a=['yes','Listing\x20workflow\x20attempts...','Project\x20directory:\x20','Params:\x20','✔\x20Retry\x20started','\x20is\x20not\x20a\x20directory','canceling','4643802OVRjJC','workflow:kill','log','\x20\x20Attempt\x20ID:\x20','logs','isDirectory','split','from','workflow:delete','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','\x20\x20Workflow:\x20','\x20workflow','Downloading\x20project\x20','getTime','Listing\x20workflows...','\x20\x20Files\x20extracted:\x20','Filter:\x20','skipValidation','status','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','workflow:tasks','round','includeSubtasks','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','\x20\x20New\x20attempt\x20ID:\x20','Deleting\x20project\x20','project','Getting\x20attempt\x20tasks...','force','sessions','\x20\x20Session\x20ID:\x20','cancelRequested','Cancelled','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','fs/promises','session','limit','sessionId','workflow','Workflow:\x20','message','2371977kClBjs','workflow:retry','633313psHziX','Include\x20retried:\x20yes','\x20\x20Cause:\x20','format','includeRetried','description','Error:\x20Invalid\x20JSON\x20in\x20--params','Start\x20a\x20workflow\x20run','List\x20workflow\x20execution\x20sessions','kill','task','✔\x20Found\x20','param','workflow:logs','3334296DQaous','attempt','Revision:\x20','reason','\x20task','No\x20log\x20files\x20found\x20for\x20this\x20attempt','✔\x20Pushed\x20','projectId','✔\x20Workflow\x20run\x20started','running','attempts','Error:\x20Invalid\x20parameter\x20format:\x20','7uYLnUl','Listing\x20workflow\x20projects...','attemptId','Kill\x20a\x20running\x20attempt','23118jyxlaC','name','retryAttempt','workflow:attempts','workflow:workflows','\x20\x20Project\x20ID:\x20','workflow:attempt','utf-8','verbose','filesExtracted','...','workflow:run','Error:\x20','error','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','params','select','logFiles','Project\x20name:\x20','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','Status:\x20','Filter:\x20project=','retryAttemptName','indexOf','startsWith','Session\x20time:\x20','Parameters:\x20','Usage:\x20workflow:delete\x20<project-name-or-id>','stringify','success','Including\x20subtasks:\x20yes','From\x20task:\x20','\x20\x20Revision:\x20','session:','Resume\x20from:\x20','6861112fZbVsP','createdAt','taskName','execute','workflow:sessions','Listing\x20workflow\x20sessions...','length','Retrying\x20session...','fromTask','data','attempt:','json','substring','finishedAt','List\x20workflows','sessionTime','projectName','Project:\x20','801706hsiHCZ','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','resumeFrom','tasks','Output\x20directory:\x20','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','projects','revision','readFile','Pushing\x20workflow\x20project...','815bGiifj','Getting\x20attempt\x20details...','Error:\x20Project\x20name\x20is\x20required','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','workflow:projects','Force:\x20yes','workflow:download','isArray','parse','Select\x20a\x20task\x20to\x20view\x20logs:','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','List\x20workflow\x20attempts','\x20session','\x20project','Error:\x20Attempt\x20ID\x20is\x20required','Fetching\x20log\x20files...','Show\x20logs\x20for\x20a\x20workflow\x20attempt','cause','Attempt\x20ID:\x20'];a35_0x422a=function(){return _0x2f3d3a;};return a35_0x422a();}export class WorkflowDeleteCommand extends BaseCommand{['name']=a35_0x20fa8f(0x184);[a35_0x20fa8f(0x10a)]=a35_0x20fa8f(0x15d);async[a35_0x20fa8f(0x149)](_0x2eae91){const _0x38c91b=a35_0x20fa8f,{options:_0x1a089c,args:_0x5e27bc,tdx:_0x47d377}=_0x2eae91,_0x49d2be=_0x5e27bc[0x0];if(!_0x49d2be)return console[_0x38c91b(0x130)](_0x38c91b(0xfb)),console[_0x38c91b(0x130)](_0x38c91b(0x13e)),0x1;_0x1a089c[_0x38c91b(0x12b)]&&console[_0x38c91b(0x130)](_0x38c91b(0x157)+_0x49d2be);if(!_0x1a089c[_0x38c91b(0x175)]){const _0x4373d8=await confirm(_0x38c91b(0x18f)+_0x49d2be+'\x22?\x20This\x20cannot\x20be\x20undone.');if(!_0x4373d8)return console[_0x38c91b(0x130)](_0x38c91b(0xfa)),0x0;}const _0x3e26fa=await withSpinner(_0x38c91b(0xf3)+_0x49d2be+_0x38c91b(0x12d),()=>_0x47d377[_0x38c91b(0x100)]['delete'](_0x49d2be),{'verbose':_0x1a089c[_0x38c91b(0x12b)]}),_0x368584=_0x3e26fa['data'];return console[_0x38c91b(0x130)]('✔\x20Deleted\x20project\x20'+_0x368584[_0x38c91b(0x156)]),console[_0x38c91b(0x130)](_0x38c91b(0x128)+_0x368584[_0x38c91b(0x11a)]),0x0;}}
1
+ const a35_0x254837=a35_0x4aad;function a35_0x4aad(_0xa72fa5,_0x5485d8){const _0x4dce67=a35_0x4dce();return a35_0x4aad=function(_0x4aad6e,_0x3fffce){_0x4aad6e=_0x4aad6e-0x17e;let _0x224aca=_0x4dce67[_0x4aad6e];return _0x224aca;},a35_0x4aad(_0xa72fa5,_0x5485d8);}(function(_0x51ebdb,_0x3d6d5b){const _0x1f38be=a35_0x4aad,_0x4d40e9=_0x51ebdb();while(!![]){try{const _0x49981e=-parseInt(_0x1f38be(0x19c))/0x1*(-parseInt(_0x1f38be(0x199))/0x2)+parseInt(_0x1f38be(0x214))/0x3+parseInt(_0x1f38be(0x1b5))/0x4*(parseInt(_0x1f38be(0x1e8))/0x5)+parseInt(_0x1f38be(0x209))/0x6*(-parseInt(_0x1f38be(0x21e))/0x7)+-parseInt(_0x1f38be(0x1a4))/0x8*(-parseInt(_0x1f38be(0x1f3))/0x9)+-parseInt(_0x1f38be(0x1f5))/0xa+parseInt(_0x1f38be(0x1ad))/0xb*(parseInt(_0x1f38be(0x1f9))/0xc);if(_0x49981e===_0x3d6d5b)break;else _0x4d40e9['push'](_0x4d40e9['shift']());}catch(_0x1837ff){_0x4d40e9['push'](_0x4d40e9['shift']());}}}(a35_0x4dce,0x96771));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{formatBytes}from'../utils/formatters.js';import a35_0x32181b from'prompts';function a35_0x4dce(){const _0x180e04=['Project\x20directory:\x20','\x22?\x20This\x20cannot\x20be\x20undone.','stat','error','✔\x20Found\x20','fileSize','stringify','workflow:projects','map','List\x20all\x20workflow\x20projects','\x20attempt','startsWith','Kill\x20a\x20running\x20attempt','round','data','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','\x20project','Error:\x20Project\x20name\x20is\x20required','workflow:workflows','json','session:','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','logFiles','Show\x20logs\x20for\x20a\x20workflow\x20attempt','Listing\x20workflow\x20attempts...','✔\x20Pushed\x20','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','workflow:logs','isArray','format','Retrying\x20session...','901245LuHuft','Start\x20a\x20workflow\x20run','Including\x20subtasks:\x20yes','Project\x20name:\x20','verbose','workflows','reason','canceling','createdAt','push','workflow','216819reImFA','tasks','12243600tzIMYS','Getting\x20attempt\x20details...','Status:\x20','readFile','60KrcMmr','workflow:delete','\x20\x20Attempt\x20ID:\x20','Error:\x20Invalid\x20JSON\x20in\x20--params','filesExtracted','Target:\x20','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','sessionTime','No\x20log\x20files\x20found\x20for\x20this\x20attempt','\x20\x20Project\x20ID:\x20','\x20session','getTime','\x20\x20Files\x20extracted:\x20','Pushing\x20workflow\x20project...','Filter:\x20project=','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','438AaXHDS','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','download','Session\x20time:\x20','✔\x20Retry\x20started','limit','\x20\x20Project:\x20','Project:\x20','split','\x20\x20Cause:\x20','keys','1142202oCFxqb','includeRetried','...','attemptId','Error:\x20Attempt\x20ID\x20is\x20required','fromTask','substring','Cancelled','session','resumeFrom','115976poOhBJ','Include\x20retried:\x20yes','description','\x20\x20Session\x20ID:\x20','Listing\x20workflow\x20projects...','Params:\x20','status','select','project','execute','\x20\x20Location:\x20','attempt:','from','includeSubtasks','\x20\x20New\x20attempt\x20ID:\x20','utf-8','Revision:\x20','Error:\x20','running','workflow:attempt','skipValidation','taskName','log','Starting\x20workflow\x20run...','Listing\x20workflows...','force','workflow:download','Validation:\x20skipped','workflow:kill','projectId','\x20task','Deleting\x20project\x20','Expected\x20format:\x20--param\x20key=value','workflow:sessions','16958zMZCtM','Killing\x20attempt...','task','36CkVQGZ','params','message','cause','retrySession','success','Error:\x20Workflow\x20identifier\x20is\x20required','finishedAt','296dcmwEj','✔\x20Downloaded\x20','Retrying\x20attempt...','Force:\x20yes','Resume\x20from:\x20','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','projects','List\x20workflow\x20attempts','Task\x20name:\x20','2843577zzABJj','retryAttemptName','Parameters:\x20','param','workflow:attempts','revision','parse','projectName','4cCpHrX','delete','attempt','Listing\x20workflow\x20sessions...','Pattern:\x20','Getting\x20attempt\x20tasks...','sessionId','Usage:\x20workflow:delete\x20<project-name-or-id>','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','name','done','\x20\x20Revision:\x20','yes','List\x20workflows','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','kill','workflow:retry','length','Attempt\x20ID:\x20','sessions'];a35_0x4dce=function(){return _0x180e04;};return a35_0x4dce();}export class WorkflowProjectsCommand extends BaseCommand{[a35_0x254837(0x1be)]=a35_0x254837(0x1d0);[a35_0x254837(0x220)]=a35_0x254837(0x1d2);async[a35_0x254837(0x180)](_0x5ff385){const _0x48fcdb=a35_0x254837,{options:_0x19f2f5,args:_0x114943,tdx:_0x386b00}=_0x5ff385,_0x25c07b=_0x114943[0x0];try{_0x19f2f5[_0x48fcdb(0x1ec)]&&_0x25c07b&&console[_0x48fcdb(0x1cc)](_0x48fcdb(0x1b9)+_0x25c07b);const _0x1f1105=await withSpinner(_0x48fcdb(0x222),()=>_0x386b00[_0x48fcdb(0x1f2)][_0x48fcdb(0x1aa)](_0x25c07b,{'limit':_0x19f2f5['limit']}),{'verbose':_0x19f2f5[_0x48fcdb(0x1ec)]}),_0x503483=_0x1f1105[_0x48fcdb(0x1d7)];return console['error'](_0x48fcdb(0x1cd)+_0x503483[_0x48fcdb(0x1c6)]+_0x48fcdb(0x1d9)+(_0x503483[_0x48fcdb(0x1c6)]!==0x1?'s':'')),await handleSDKOutput(_0x503483,_0x19f2f5),0x0;}catch(_0x519a2e){if(_0x519a2e instanceof SDKError)return console['error'](_0x48fcdb(0x188)+_0x519a2e[_0x48fcdb(0x19e)]),_0x519a2e[_0x48fcdb(0x19f)]&&console[_0x48fcdb(0x1cc)](_0x48fcdb(0x212)+_0x519a2e[_0x48fcdb(0x19f)]),0x1;throw _0x519a2e;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a35_0x254837(0x1be)]=a35_0x254837(0x1db);[a35_0x254837(0x220)]=a35_0x254837(0x1c2);async[a35_0x254837(0x180)](_0x204b2e){const _0x25f62c=a35_0x254837,{options:_0x55bb8c,args:_0x147c56,tdx:_0x5ebf68}=_0x204b2e,_0x3f5538=_0x147c56[0x0];try{_0x55bb8c[_0x25f62c(0x1ec)]&&_0x3f5538&&console[_0x25f62c(0x1cc)]('Project\x20filter:\x20'+_0x3f5538);const _0x6a9705=await withSpinner(_0x25f62c(0x18f),()=>_0x5ebf68[_0x25f62c(0x1f2)][_0x25f62c(0x1ed)](_0x3f5538,{'limit':_0x55bb8c[_0x25f62c(0x20e)]}),{'verbose':_0x55bb8c['verbose']}),_0x5808c1=_0x6a9705[_0x25f62c(0x1d7)];return console['error'](_0x25f62c(0x1cd)+_0x5808c1[_0x25f62c(0x1c6)]+'\x20workflow'+(_0x5808c1['length']!==0x1?'s':'')),await handleSDKOutput(_0x5808c1,_0x55bb8c),0x0;}catch(_0x3c8c37){if(_0x3c8c37 instanceof SDKError)return console['error'](_0x25f62c(0x188)+_0x3c8c37[_0x25f62c(0x19e)]),_0x3c8c37['cause']&&console[_0x25f62c(0x1cc)]('\x20\x20Cause:\x20'+_0x3c8c37[_0x25f62c(0x19f)]),0x1;throw _0x3c8c37;}}}export class WorkflowSessionsCommand extends BaseCommand{[a35_0x254837(0x1be)]=a35_0x254837(0x198);['description']='List\x20workflow\x20execution\x20sessions';async[a35_0x254837(0x180)](_0x29ac63){const _0x1300c2=a35_0x254837,{options:_0x9b7fc0,args:_0x40dc35,tdx:_0x5e661b}=_0x29ac63;let _0x47f05a,_0x401375;if(_0x40dc35[0x0]){const _0x1849bf=_0x40dc35[0x0]['split']('.');if(_0x1849bf[_0x1300c2(0x1c6)]===0x1)_0x47f05a=_0x1849bf[0x0];else{if(_0x1849bf['length']===0x2)[_0x47f05a,_0x401375]=_0x1849bf;else return console[_0x1300c2(0x1cc)](_0x1300c2(0x1a9)),0x1;}}try{if(_0x9b7fc0['verbose']){if(_0x47f05a&&_0x401375)console['error']('Filter:\x20'+_0x47f05a+'.'+_0x401375);else _0x47f05a&&console[_0x1300c2(0x1cc)](_0x1300c2(0x207)+_0x47f05a);const _0x59cb81=_0x9b7fc0[_0x1300c2(0x224)];_0x59cb81&&console[_0x1300c2(0x1cc)](_0x1300c2(0x1f7)+_0x59cb81);}const _0x5791c0=await withSpinner(_0x1300c2(0x1b8),()=>_0x5e661b[_0x1300c2(0x1f2)][_0x1300c2(0x1c8)]({'projectName':_0x47f05a,'workflowName':_0x401375,'status':_0x9b7fc0[_0x1300c2(0x224)],'fromTime':_0x9b7fc0[_0x1300c2(0x183)],'toTime':_0x9b7fc0['to'],'limit':_0x9b7fc0[_0x1300c2(0x20e)]}),{'verbose':_0x9b7fc0[_0x1300c2(0x1ec)]}),_0x37354e=_0x5791c0[_0x1300c2(0x1d7)];return console[_0x1300c2(0x1cc)](_0x1300c2(0x1cd)+_0x37354e[_0x1300c2(0x1c6)]+_0x1300c2(0x203)+(_0x37354e['length']!==0x1?'s':'')),await handleSDKOutput(_0x37354e,_0x9b7fc0),0x0;}catch(_0x4bc068){if(_0x4bc068 instanceof SDKError)return console[_0x1300c2(0x1cc)](_0x1300c2(0x188)+_0x4bc068['message']),_0x4bc068['cause']&&console[_0x1300c2(0x1cc)]('\x20\x20Cause:\x20'+_0x4bc068[_0x1300c2(0x19f)]),0x1;throw _0x4bc068;}}}export class WorkflowAttemptsCommand extends BaseCommand{['name']=a35_0x254837(0x1b1);['description']=a35_0x254837(0x1ab);async['execute'](_0x2f12b6){const _0x4962d4=a35_0x254837,{options:_0x55f6e5,args:_0x4afd5c,tdx:_0x58fb81}=_0x2f12b6;let _0x2a6143,_0x43f0f8;if(_0x4afd5c[0x0]){const _0x225886=_0x4afd5c[0x0][_0x4962d4(0x211)]('.');if(_0x225886[_0x4962d4(0x1c6)]===0x1)_0x2a6143=_0x225886[0x0];else{if(_0x225886['length']===0x2)[_0x2a6143,_0x43f0f8]=_0x225886;else return console[_0x4962d4(0x1cc)](_0x4962d4(0x1a9)),0x1;}}try{const _0x22fced=_0x55f6e5[_0x4962d4(0x215)];if(_0x55f6e5[_0x4962d4(0x1ec)]){if(_0x2a6143&&_0x43f0f8)console[_0x4962d4(0x1cc)]('Filter:\x20'+_0x2a6143+'.'+_0x43f0f8);else _0x2a6143&&console['error'](_0x4962d4(0x207)+_0x2a6143);_0x22fced&&console['error'](_0x4962d4(0x21f));}const _0x1a3cfb=await withSpinner(_0x4962d4(0x1e1),()=>_0x58fb81[_0x4962d4(0x1f2)]['attempts']({'projectName':_0x2a6143,'workflowName':_0x43f0f8,'includeRetried':_0x22fced,'limit':_0x55f6e5[_0x4962d4(0x20e)]}),{'verbose':_0x55f6e5[_0x4962d4(0x1ec)]}),_0x3d6ddd=_0x1a3cfb[_0x4962d4(0x1d7)];return console[_0x4962d4(0x1cc)]('✔\x20Found\x20'+_0x3d6ddd[_0x4962d4(0x1c6)]+_0x4962d4(0x1d3)+(_0x3d6ddd[_0x4962d4(0x1c6)]!==0x1?'s':'')),await handleSDKOutput(_0x3d6ddd,_0x55f6e5),0x0;}catch(_0x553288){if(_0x553288 instanceof SDKError)return console[_0x4962d4(0x1cc)]('Error:\x20'+_0x553288['message']),_0x553288[_0x4962d4(0x19f)]&&console[_0x4962d4(0x1cc)](_0x4962d4(0x212)+_0x553288[_0x4962d4(0x19f)]),0x1;throw _0x553288;}}}export class WorkflowAttemptCommand extends BaseCommand{[a35_0x254837(0x1be)]=a35_0x254837(0x18a);['description']='Show\x20specific\x20attempt\x20details';async[a35_0x254837(0x180)](_0x1adbb8){const _0x5f9fe=a35_0x254837,{options:_0x2dbbda,args:_0x103d14,tdx:_0x55d624}=_0x1adbb8,_0x341980=_0x103d14[0x0];if(!_0x341980)return console[_0x5f9fe(0x1cc)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x2dbbda[_0x5f9fe(0x1ec)]&&console['error']('Attempt\x20ID:\x20'+_0x341980);const _0x560984=await withSpinner(_0x5f9fe(0x1f6),()=>_0x55d624[_0x5f9fe(0x1f2)][_0x5f9fe(0x1b7)](_0x341980),{'verbose':_0x2dbbda[_0x5f9fe(0x1ec)]}),_0x1a1587=_0x560984[_0x5f9fe(0x1d7)];let _0x4cc04c;!_0x1a1587[_0x5f9fe(0x1bf)]?_0x4cc04c=_0x1a1587['cancelRequested']?_0x5f9fe(0x1ef):_0x5f9fe(0x189):_0x4cc04c=_0x1a1587[_0x5f9fe(0x1a1)]?'success':'error';let _0x31f172;if(_0x1a1587[_0x5f9fe(0x1f0)]&&_0x1a1587[_0x5f9fe(0x1a3)]){const _0x5dbbe8=new Date(_0x1a1587[_0x5f9fe(0x1f0)])['getTime'](),_0x102d6c=new Date(_0x1a1587[_0x5f9fe(0x1a3)])[_0x5f9fe(0x204)]();_0x31f172=Math[_0x5f9fe(0x1d6)]((_0x102d6c-_0x5dbbe8)/0x3e8);}const _0x46587a={'attempt_id':_0x1a1587['id'],'status':_0x4cc04c,..._0x1a1587['index']!==undefined&&{'index':_0x1a1587['index']},..._0x1a1587['project']&&{'project':_0x1a1587[_0x5f9fe(0x17f)][_0x5f9fe(0x1be)]},..._0x1a1587[_0x5f9fe(0x1f2)]&&{'workflow':_0x1a1587[_0x5f9fe(0x1f2)][_0x5f9fe(0x1be)]},..._0x1a1587[_0x5f9fe(0x1bb)]&&{'session_id':_0x1a1587[_0x5f9fe(0x1bb)]},..._0x1a1587[_0x5f9fe(0x200)]&&{'session_time':_0x1a1587[_0x5f9fe(0x200)]},..._0x1a1587[_0x5f9fe(0x1ae)]&&{'retry_attempt':_0x1a1587[_0x5f9fe(0x1ae)]},..._0x31f172!==undefined&&{'duration_sec':_0x31f172},..._0x1a1587['createdAt']&&{'created_at':_0x1a1587[_0x5f9fe(0x1f0)]},..._0x1a1587['finishedAt']&&{'finished_at':_0x1a1587[_0x5f9fe(0x1a3)]},...Object[_0x5f9fe(0x213)](_0x1a1587[_0x5f9fe(0x19d)])['length']>0x0&&{'params':_0x1a1587[_0x5f9fe(0x19d)]}};return await handleSingleObjectOutput(_0x46587a,_0x2dbbda),0x0;}catch(_0x46494c){if(_0x46494c instanceof SDKError)return console[_0x5f9fe(0x1cc)](_0x5f9fe(0x188)+_0x46494c[_0x5f9fe(0x19e)]),_0x46494c[_0x5f9fe(0x19f)]&&console[_0x5f9fe(0x1cc)]('\x20\x20Cause:\x20'+_0x46494c['cause']),0x1;throw _0x46494c;}}}export class WorkflowTasksCommand extends BaseCommand{[a35_0x254837(0x1be)]='workflow:tasks';['description']='Show\x20tasks\x20for\x20an\x20attempt';async[a35_0x254837(0x180)](_0x5c8c01){const _0xdf8ea2=a35_0x254837,{options:_0x2afe7d,args:_0x64a30f,tdx:_0x488659}=_0x5c8c01,_0x5abd91=_0x64a30f[0x0];if(!_0x5abd91)return console['error'](_0xdf8ea2(0x218)),0x1;try{const _0x2f0aea=_0x2afe7d[_0xdf8ea2(0x184)];_0x2afe7d[_0xdf8ea2(0x1ec)]&&(console['error'](_0xdf8ea2(0x1c7)+_0x5abd91),_0x2f0aea&&console[_0xdf8ea2(0x1cc)](_0xdf8ea2(0x1ea)));const _0x2d8f65=await withSpinner(_0xdf8ea2(0x1ba),()=>_0x488659[_0xdf8ea2(0x1f2)][_0xdf8ea2(0x1f4)](_0x5abd91,_0x2f0aea||![]),{'verbose':_0x2afe7d[_0xdf8ea2(0x1ec)]}),_0x51dbea=_0x2d8f65[_0xdf8ea2(0x1d7)];return console[_0xdf8ea2(0x1cc)](_0xdf8ea2(0x1cd)+_0x51dbea[_0xdf8ea2(0x1c6)]+_0xdf8ea2(0x195)+(_0x51dbea[_0xdf8ea2(0x1c6)]!==0x1?'s':'')),await handleSDKOutput(_0x51dbea,_0x2afe7d),0x0;}catch(_0x383b42){if(_0x383b42 instanceof SDKError)return console['error'](_0xdf8ea2(0x188)+_0x383b42['message']),_0x383b42['cause']&&console[_0xdf8ea2(0x1cc)](_0xdf8ea2(0x212)+_0x383b42[_0xdf8ea2(0x19f)]),0x1;throw _0x383b42;}}}export class WorkflowLogsCommand extends BaseCommand{['name']=a35_0x254837(0x1e4);[a35_0x254837(0x220)]=a35_0x254837(0x1e0);async[a35_0x254837(0x180)](_0x285548){const _0x5a31a2=a35_0x254837,{options:_0x17a17d,args:_0x270444,tdx:_0x1d9b59}=_0x285548,_0x4bb2d9=_0x270444[0x0];let _0x38d346=_0x270444[0x1];if(!_0x4bb2d9)return console[_0x5a31a2(0x1cc)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x17a17d[_0x5a31a2(0x1ec)]&&(console[_0x5a31a2(0x1cc)](_0x5a31a2(0x1c7)+_0x4bb2d9),_0x38d346&&console['error'](_0x5a31a2(0x1ac)+_0x38d346));const _0x4f94f9=await withSpinner('Fetching\x20log\x20files...',()=>_0x1d9b59[_0x5a31a2(0x1f2)][_0x5a31a2(0x1df)](_0x4bb2d9,_0x38d346),{'verbose':_0x17a17d[_0x5a31a2(0x1ec)]}),_0xef2837=_0x4f94f9['data'];if(_0xef2837[_0x5a31a2(0x1c6)]===0x0)return console[_0x5a31a2(0x1cc)](_0x5a31a2(0x201)),0x0;if(!_0x38d346&&(_0x17a17d[_0x5a31a2(0x1dc)]||_0x17a17d[_0x5a31a2(0x1e6)]))return await handleSDKOutput(_0xef2837,_0x17a17d),0x0;if(!_0x38d346){const _0x525373=_0xef2837[_0x5a31a2(0x1d1)](_0x21d1af=>({'title':_0x21d1af[_0x5a31a2(0x18c)]+'\x20('+formatBytes(_0x21d1af[_0x5a31a2(0x1ce)])+')','value':_0x21d1af['taskName']})),_0x3b110b=await a35_0x32181b({'type':_0x5a31a2(0x17e),'name':_0x5a31a2(0x19b),'message':'Select\x20a\x20task\x20to\x20view\x20logs:','choices':_0x525373});if(!_0x3b110b['task'])return console[_0x5a31a2(0x1cc)](_0x5a31a2(0x21b)),0x0;_0x38d346=_0x3b110b[_0x5a31a2(0x19b)];}const _0x5b72db=await withSpinner('Downloading\x20logs...',()=>_0x1d9b59[_0x5a31a2(0x1f2)]['logs'](_0x4bb2d9,_0x38d346),{'verbose':_0x17a17d[_0x5a31a2(0x1ec)]}),_0x438a4d=_0x5b72db['data'];return _0x438a4d?console[_0x5a31a2(0x18d)](_0x438a4d):console['error']('No\x20log\x20content\x20found'),0x0;}catch(_0x579df7){if(_0x579df7 instanceof SDKError)return console[_0x5a31a2(0x1cc)](_0x5a31a2(0x188)+_0x579df7[_0x5a31a2(0x19e)]),_0x579df7[_0x5a31a2(0x19f)]&&console['error'](_0x5a31a2(0x212)+_0x579df7[_0x5a31a2(0x19f)]),0x1;throw _0x579df7;}}}export class WorkflowKillCommand extends BaseCommand{[a35_0x254837(0x1be)]=a35_0x254837(0x193);[a35_0x254837(0x220)]=a35_0x254837(0x1d5);async[a35_0x254837(0x180)](_0x5dea77){const _0xdff6fb=a35_0x254837,{options:_0x1edc88,args:_0x3b8f41,tdx:_0x349d12}=_0x5dea77,_0x1696b0=_0x3b8f41[0x0];if(!_0x1696b0)return console[_0xdff6fb(0x1cc)](_0xdff6fb(0x218)),0x1;try{const _0x4d6d70=_0x1edc88[_0xdff6fb(0x1ee)];_0x1edc88[_0xdff6fb(0x1ec)]&&(console['error']('Attempt\x20ID:\x20'+_0x1696b0),_0x4d6d70&&console['error']('Reason:\x20'+_0x4d6d70));if(!_0x1edc88[_0xdff6fb(0x1c1)]){const _0x4db6ca=await confirm(_0xdff6fb(0x1bd)+_0x1696b0+'?');if(!_0x4db6ca)return console[_0xdff6fb(0x1cc)](_0xdff6fb(0x21b)),0x0;}const _0x14c41b=await withSpinner(_0xdff6fb(0x19a),()=>_0x349d12[_0xdff6fb(0x1f2)][_0xdff6fb(0x1c4)](_0x1696b0,_0x4d6d70),{'verbose':_0x1edc88[_0xdff6fb(0x1ec)]}),_0x4342d6=_0x14c41b['data'];return console[_0xdff6fb(0x1cc)]('✔\x20'+_0x4342d6),0x0;}catch(_0x54fb36){if(_0x54fb36 instanceof SDKError)return console[_0xdff6fb(0x1cc)](_0xdff6fb(0x188)+_0x54fb36[_0xdff6fb(0x19e)]),_0x54fb36['cause']&&console[_0xdff6fb(0x1cc)](_0xdff6fb(0x212)+_0x54fb36[_0xdff6fb(0x19f)]),0x1;throw _0x54fb36;}}}export class WorkflowRetryCommand extends BaseCommand{[a35_0x254837(0x1be)]=a35_0x254837(0x1c5);['description']='Retry\x20a\x20session\x20or\x20attempt';async[a35_0x254837(0x180)](_0x26816c){const _0x2f5dd2=a35_0x254837,{options:_0x131be2,args:_0x73cc77,tdx:_0x3794f0}=_0x26816c,_0xb470b9=_0x73cc77[0x0];if(!_0xb470b9)return console[_0x2f5dd2(0x1cc)](_0x2f5dd2(0x1ff)),console[_0x2f5dd2(0x1cc)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x4cf609=![],_0x2485a9=_0xb470b9;if(_0xb470b9[_0x2f5dd2(0x1d4)](_0x2f5dd2(0x1dd)))_0x4cf609=!![],_0x2485a9=_0xb470b9['substring'](0x8);else{if(_0xb470b9[_0x2f5dd2(0x1d4)](_0x2f5dd2(0x182)))_0x4cf609=![],_0x2485a9=_0xb470b9[_0x2f5dd2(0x21a)](0x8);else return console['error']('Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'),console[_0x2f5dd2(0x1cc)](_0x2f5dd2(0x1e3)),0x1;}try{const _0x3f7c26=_0x131be2[_0x2f5dd2(0x219)],_0x171dde=_0x131be2[_0x2f5dd2(0x21d)],_0x4fc5f4=_0x131be2[_0x2f5dd2(0x19d)],_0x438d04=_0x131be2[_0x2f5dd2(0x190)];_0x131be2[_0x2f5dd2(0x1ec)]&&(console['error'](_0x2f5dd2(0x1fe)+(_0x4cf609?'session':_0x2f5dd2(0x1b7))+'\x20'+_0x2485a9),_0x3f7c26&&console[_0x2f5dd2(0x1cc)]('From\x20task:\x20'+_0x3f7c26),_0x171dde&&console[_0x2f5dd2(0x1cc)](_0x2f5dd2(0x1a8)+_0x171dde),_0x4fc5f4&&console[_0x2f5dd2(0x1cc)](_0x2f5dd2(0x223)+_0x4fc5f4),_0x438d04&&console[_0x2f5dd2(0x1cc)](_0x2f5dd2(0x1a7)));let _0x2efbf0;if(_0x4fc5f4)try{if(_0x4fc5f4[_0x2f5dd2(0x1d4)]('@')){const _0x331bf4=await import('fs/promises'),_0x320151=_0x4fc5f4[_0x2f5dd2(0x21a)](0x1),_0x124bbb=await _0x331bf4[_0x2f5dd2(0x1f8)](_0x320151,_0x2f5dd2(0x186));_0x2efbf0=JSON[_0x2f5dd2(0x1b3)](_0x124bbb);}else _0x2efbf0=JSON[_0x2f5dd2(0x1b3)](_0x4fc5f4);}catch{return console[_0x2f5dd2(0x1cc)](_0x2f5dd2(0x1fc)),0x1;}if(!_0x131be2[_0x2f5dd2(0x1c1)]){const _0x16f37d=await confirm(_0x2f5dd2(0x208)+(_0x4cf609?_0x2f5dd2(0x21c):_0x2f5dd2(0x1b7))+'\x20'+_0x2485a9+'?');if(!_0x16f37d)return console[_0x2f5dd2(0x1cc)](_0x2f5dd2(0x21b)),0x0;}let _0x3771fd;_0x4cf609?_0x3771fd=await withSpinner(_0x2f5dd2(0x1e7),()=>_0x3794f0[_0x2f5dd2(0x1f2)][_0x2f5dd2(0x1a0)](_0x2485a9,{'fromTask':_0x3f7c26,'retryParams':_0x2efbf0}),{'verbose':_0x131be2[_0x2f5dd2(0x1ec)]}):_0x3771fd=await withSpinner(_0x2f5dd2(0x1a6),()=>_0x3794f0[_0x2f5dd2(0x1f2)]['retryAttempt'](_0x2485a9,{'resumeFrom':_0x171dde,'retryParams':_0x2efbf0,'force':_0x438d04}),{'verbose':_0x131be2[_0x2f5dd2(0x1ec)]});const _0xa8ec85=_0x3771fd[_0x2f5dd2(0x1d7)];return console['error'](_0x2f5dd2(0x20d)),console[_0x2f5dd2(0x1cc)](_0x2f5dd2(0x185)+_0xa8ec85[_0x2f5dd2(0x217)]),console[_0x2f5dd2(0x1cc)](_0x2f5dd2(0x221)+_0xa8ec85[_0x2f5dd2(0x1bb)]),0x0;}catch(_0xd2e690){if(_0xd2e690 instanceof SDKError)return console['error'](_0x2f5dd2(0x188)+_0xd2e690['message']),_0xd2e690[_0x2f5dd2(0x19f)]&&console[_0x2f5dd2(0x1cc)](_0x2f5dd2(0x212)+_0xd2e690['cause']),0x1;throw _0xd2e690;}}}export class WorkflowRunCommand extends BaseCommand{['name']='workflow:run';[a35_0x254837(0x220)]=a35_0x254837(0x1e9);async[a35_0x254837(0x180)](_0x2071ff){const _0x436073=a35_0x254837,{options:_0x1f8f33,args:_0x3c06ab,tdx:_0x28c72d}=_0x2071ff,_0xca1b62=_0x3c06ab[0x0];if(!_0xca1b62)return console[_0x436073(0x1cc)](_0x436073(0x1a2)),console[_0x436073(0x1cc)](_0x436073(0x1c3)),0x1;const _0x280074=_0x1f8f33[_0x436073(0x1b0)],_0xd83aab=_0x1f8f33[_0x436073(0x200)],_0x568e3d={};if(_0x280074&&Array[_0x436073(0x1e5)](_0x280074))for(const _0x8194c7 of _0x280074){const _0x450991=_0x8194c7['indexOf']('=');if(_0x450991===-0x1)return console[_0x436073(0x1cc)]('Error:\x20Invalid\x20parameter\x20format:\x20'+_0x8194c7),console['error'](_0x436073(0x197)),0x1;const _0x295cf2=_0x8194c7[_0x436073(0x21a)](0x0,_0x450991),_0x3db56e=_0x8194c7['substring'](_0x450991+0x1);try{_0x568e3d[_0x295cf2]=JSON[_0x436073(0x1b3)](_0x3db56e);}catch{_0x568e3d[_0x295cf2]=_0x3db56e;}}_0x1f8f33[_0x436073(0x1ec)]&&(console[_0x436073(0x1cc)]('Workflow:\x20'+_0xca1b62),Object['keys'](_0x568e3d)[_0x436073(0x1c6)]>0x0&&console['error'](_0x436073(0x1af)+JSON[_0x436073(0x1cf)](_0x568e3d)),_0xd83aab&&console[_0x436073(0x1cc)](_0x436073(0x20c)+_0xd83aab));const _0x672b76=await withSpinner(_0x436073(0x18e),()=>_0x28c72d[_0x436073(0x1f2)]['run'](_0xca1b62,_0x568e3d,{'sessionTime':_0xd83aab}),{'verbose':_0x1f8f33['verbose']}),_0x4c51e6=_0x672b76[_0x436073(0x1d7)];return console[_0x436073(0x1cc)]('✔\x20Workflow\x20run\x20started'),console[_0x436073(0x1cc)](_0x436073(0x1fb)+_0x4c51e6['id']),console[_0x436073(0x1cc)](_0x436073(0x221)+_0x4c51e6[_0x436073(0x1bb)]),console['error'](_0x436073(0x20f)+_0x4c51e6[_0x436073(0x17f)]?.['name']),console[_0x436073(0x1cc)]('\x20\x20Workflow:\x20'+_0x4c51e6[_0x436073(0x1f2)]?.[_0x436073(0x1be)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a35_0x254837(0x1be)]=a35_0x254837(0x191);['description']=a35_0x254837(0x20a);async[a35_0x254837(0x180)](_0x229248){const _0x192db6=a35_0x254837,{options:_0x2789c8,args:_0x398319,tdx:_0x5eb52e}=_0x229248,_0x52094a=_0x398319[0x0],_0x306ea4=_0x398319[0x1]||'.';if(!_0x52094a)return console[_0x192db6(0x1cc)](_0x192db6(0x1da)),console['error']('Usage:\x20workflow:download\x20<project-name>\x20[output-dir]'),0x1;const _0x5c1177=_0x2789c8[_0x192db6(0x1b2)];_0x2789c8[_0x192db6(0x1ec)]&&(console[_0x192db6(0x1cc)]('Project:\x20'+_0x52094a),console[_0x192db6(0x1cc)]('Output\x20directory:\x20'+_0x306ea4),_0x5c1177&&console[_0x192db6(0x1cc)](_0x192db6(0x187)+_0x5c1177));const _0x1339b8=await withSpinner('Downloading\x20project\x20'+_0x52094a+_0x192db6(0x216),()=>_0x5eb52e['workflow'][_0x192db6(0x20b)](_0x52094a,_0x306ea4,{'revision':_0x5c1177}),{'verbose':_0x2789c8['verbose']}),_0x1188ca=_0x1339b8[_0x192db6(0x1d7)];return console[_0x192db6(0x1cc)](_0x192db6(0x1a5)+_0x1188ca['projectName']),console[_0x192db6(0x1cc)](_0x192db6(0x1c0)+_0x1188ca[_0x192db6(0x1b2)]),console[_0x192db6(0x1cc)](_0x192db6(0x205)+_0x1188ca[_0x192db6(0x1fd)]),console[_0x192db6(0x1cc)](_0x192db6(0x181)+_0x306ea4+'/'+_0x1188ca[_0x192db6(0x1b4)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a35_0x254837(0x1be)]='workflow:push';['description']=a35_0x254837(0x1d8);async[a35_0x254837(0x180)](_0x528b90){const _0x2e42f4=a35_0x254837,{options:_0x15769b,args:_0xb795c2,tdx:_0x2e5a79}=_0x528b90;let _0x4cfaa8='.',_0x16f059=_0x15769b[_0x2e42f4(0x1be)];if(_0xb795c2[0x0]){const {promises:_0x3f7f1e}=await import('fs');try{const _0x19638d=await _0x3f7f1e[_0x2e42f4(0x1cb)](_0xb795c2[0x0]);if(_0x19638d['isDirectory']())_0x4cfaa8=_0xb795c2[0x0];else return console['error'](_0x2e42f4(0x188)+_0xb795c2[0x0]+'\x20is\x20not\x20a\x20directory'),0x1;}catch{_0x16f059=_0xb795c2[0x0],_0x4cfaa8='.';}}const _0x30da61=_0x15769b[_0x2e42f4(0x1b2)],_0x14a7b4=_0x15769b[_0x2e42f4(0x18b)];_0x15769b[_0x2e42f4(0x1ec)]&&(console[_0x2e42f4(0x1cc)](_0x2e42f4(0x1c9)+_0x4cfaa8),_0x16f059&&console[_0x2e42f4(0x1cc)](_0x2e42f4(0x1eb)+_0x16f059),_0x30da61&&console['error']('Revision:\x20'+_0x30da61),_0x14a7b4&&console[_0x2e42f4(0x1cc)](_0x2e42f4(0x192)));const _0x5dd65a=await withSpinner(_0x2e42f4(0x206),()=>_0x2e5a79[_0x2e42f4(0x1f2)][_0x2e42f4(0x1f1)](_0x4cfaa8,{'projectName':_0x16f059,'revision':_0x30da61,'skipValidation':_0x14a7b4}),{'verbose':_0x15769b[_0x2e42f4(0x1ec)]}),_0x797ca0=_0x5dd65a[_0x2e42f4(0x1d7)];return console[_0x2e42f4(0x1cc)](_0x2e42f4(0x1e2)+_0x797ca0[_0x2e42f4(0x1b4)]),console[_0x2e42f4(0x1cc)](_0x2e42f4(0x202)+_0x797ca0['projectId']),console['error'](_0x2e42f4(0x1c0)+_0x797ca0['revision']),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a35_0x254837(0x1be)]=a35_0x254837(0x1fa);[a35_0x254837(0x220)]=a35_0x254837(0x1de);async[a35_0x254837(0x180)](_0x43ec05){const _0x55a3a9=a35_0x254837,{options:_0x4676f3,args:_0x4cb46c,tdx:_0x3eb0fb}=_0x43ec05,_0x3e4df5=_0x4cb46c[0x0];if(!_0x3e4df5)return console[_0x55a3a9(0x1cc)]('Error:\x20Project\x20name\x20or\x20ID\x20is\x20required'),console[_0x55a3a9(0x1cc)](_0x55a3a9(0x1bc)),0x1;_0x4676f3['verbose']&&console[_0x55a3a9(0x1cc)](_0x55a3a9(0x210)+_0x3e4df5);if(!_0x4676f3['yes']){const _0x24d22a=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22'+_0x3e4df5+_0x55a3a9(0x1ca));if(!_0x24d22a)return console[_0x55a3a9(0x1cc)]('Cancelled'),0x0;}const _0x57ddff=await withSpinner(_0x55a3a9(0x196)+_0x3e4df5+_0x55a3a9(0x216),()=>_0x3eb0fb[_0x55a3a9(0x1f2)][_0x55a3a9(0x1b6)](_0x3e4df5),{'verbose':_0x4676f3[_0x55a3a9(0x1ec)]}),_0x39a0e0=_0x57ddff[_0x55a3a9(0x1d7)];return console[_0x55a3a9(0x1cc)]('✔\x20Deleted\x20project\x20'+_0x39a0e0[_0x55a3a9(0x1b4)]),console['error'](_0x55a3a9(0x202)+_0x39a0e0[_0x55a3a9(0x194)]),0x0;}}
package/dist/core/auth.js CHANGED
@@ -1 +1 @@
1
- (function(_0x5d1725,_0x2deedd){const _0x557e46=a36_0x4605,_0x31221b=_0x5d1725();while(!![]){try{const _0x4fb2c7=parseInt(_0x557e46(0xa1))/0x1*(parseInt(_0x557e46(0x9d))/0x2)+-parseInt(_0x557e46(0x92))/0x3+-parseInt(_0x557e46(0xa0))/0x4*(parseInt(_0x557e46(0x8a))/0x5)+-parseInt(_0x557e46(0x8b))/0x6*(-parseInt(_0x557e46(0x8d))/0x7)+parseInt(_0x557e46(0x93))/0x8+parseInt(_0x557e46(0x9a))/0x9*(-parseInt(_0x557e46(0x91))/0xa)+parseInt(_0x557e46(0x97))/0xb*(parseInt(_0x557e46(0x9f))/0xc);if(_0x4fb2c7===_0x2deedd)break;else _0x31221b['push'](_0x31221b['shift']());}catch(_0x45b0b4){_0x31221b['push'](_0x31221b['shift']());}}}(a36_0x264c,0xd2643));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x42323a=a36_0x4605;try{const _0x23c785=fileURLToPath(import.meta[_0x42323a(0x9c)]),_0x35577d=dirname(_0x23c785),_0xf49962=join(_0x35577d,_0x42323a(0x8e)),_0x505ef5=JSON[_0x42323a(0x8c)](readFileSync(_0xf49962,_0x42323a(0x90)));return _0x505ef5[_0x42323a(0x94)];}catch{return _0x42323a(0x8f);}}export function getUserAgent(){const _0x3132e1=a36_0x4605,_0x118ad1=getVersion(),_0x18e943=platform(),_0x283f5b=process['version'][_0x3132e1(0x95)]('v','');return'tdx/'+_0x118ad1+'\x20('+_0x18e943+_0x3132e1(0x96)+_0x283f5b+')';}function a36_0x4605(_0x1ea302,_0x36263f){const _0x264c96=a36_0x264c();return a36_0x4605=function(_0x460573,_0x24c699){_0x460573=_0x460573-0x8a;let _0x47b31b=_0x264c96[_0x460573];return _0x47b31b;},a36_0x4605(_0x1ea302,_0x36263f);}export function getAuthHeaders(_0x4453a2,_0xeb4db9){const _0x1f3c58=a36_0x4605,_0xab07db=getVersion(),_0x3feccd={'User-Agent':getUserAgent(),'X-TD-Client':_0x1f3c58(0xa2),'X-TD-Client-Version':_0xab07db};return _0xeb4db9&&(_0x3feccd[_0x1f3c58(0x99)]=_0x1f3c58(0x9e)+_0xeb4db9),_0x3feccd;}export function toHeaderRecord(_0x411e72){const _0x3293ef=a36_0x4605,_0x5e5f2a={};for(const [_0x349c7c,_0x5abf41]of Object[_0x3293ef(0x9b)](_0x411e72)){_0x5abf41!==undefined&&(_0x5e5f2a[_0x349c7c]=_0x5abf41);}return _0x5e5f2a;}function a36_0x264c(){const _0x4ef541=['276532PZgVWu','1267835nqhwbo','tdx','65wsGDWD','13854bpWohm','parse','1015UiOCWw','../../package.json','0.0.0','utf-8','1423700zjHrPg','3359220eCCqnF','200464JjUUqt','version','replace',';\x20node/','2992yTOSzJ','length','Authorization','45yzDYya','entries','url','2fzVvsv','TD1\x20','86664ryFKxI'];a36_0x264c=function(){return _0x4ef541;};return a36_0x264c();}export function getTrinoHeaders(_0x4c62fe,_0x2b8ae9){const _0x3a6421=a36_0x4605,_0x5938f7=getAuthHeaders(_0x4c62fe,_0x2b8ae9),_0x1c567a=toHeaderRecord(_0x5938f7);return delete _0x1c567a[_0x3a6421(0x99)],_0x2b8ae9&&(_0x1c567a['X-Trino-User']=_0x2b8ae9),_0x1c567a;}export function hasAPIKey(_0x59d55f){const _0x360b27=a36_0x4605,_0x2bec5e=getAPIKey(_0x59d55f);return _0x2bec5e!==undefined&&_0x2bec5e[_0x360b27(0x98)]>0x0;}
1
+ (function(_0xb550ff,_0x156bc9){const _0x4b8d3e=a36_0x1804,_0x4e6c08=_0xb550ff();while(!![]){try{const _0x1eef34=-parseInt(_0x4b8d3e(0xdf))/0x1*(parseInt(_0x4b8d3e(0xef))/0x2)+-parseInt(_0x4b8d3e(0xf3))/0x3*(-parseInt(_0x4b8d3e(0xea))/0x4)+-parseInt(_0x4b8d3e(0xe6))/0x5+-parseInt(_0x4b8d3e(0xe4))/0x6*(-parseInt(_0x4b8d3e(0xde))/0x7)+-parseInt(_0x4b8d3e(0xf1))/0x8+-parseInt(_0x4b8d3e(0xe0))/0x9+parseInt(_0x4b8d3e(0xe8))/0xa*(parseInt(_0x4b8d3e(0xf0))/0xb);if(_0x1eef34===_0x156bc9)break;else _0x4e6c08['push'](_0x4e6c08['shift']());}catch(_0x2b60ae){_0x4e6c08['push'](_0x4e6c08['shift']());}}}(a36_0x1b63,0xbc279));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';function a36_0x1804(_0x4e583,_0x2b8f08){const _0x1b6338=a36_0x1b63();return a36_0x1804=function(_0x180424,_0x16b7a1){_0x180424=_0x180424-0xdc;let _0x308e7e=_0x1b6338[_0x180424];return _0x308e7e;},a36_0x1804(_0x4e583,_0x2b8f08);}import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x311d43=a36_0x1804;try{const _0x238509=fileURLToPath(import.meta[_0x311d43(0xe3)]),_0x146577=dirname(_0x238509),_0x5f1e07=join(_0x146577,_0x311d43(0xec)),_0x7eba9f=JSON[_0x311d43(0xe1)](readFileSync(_0x5f1e07,_0x311d43(0xdd)));return _0x7eba9f[_0x311d43(0xed)];}catch{return _0x311d43(0xe7);}}export function getUserAgent(){const _0x2592b2=a36_0x1804,_0x1ec14a=getVersion(),_0x286b18=platform(),_0x23d8e1=process['version']['replace']('v','');return _0x2592b2(0xe2)+_0x1ec14a+'\x20('+_0x286b18+_0x2592b2(0xeb)+_0x23d8e1+')';}export function getAuthHeaders(_0x37abfd,_0x47a671){const _0x5a6e96=a36_0x1804,_0x24dd2c=getVersion(),_0x1aabfc={'User-Agent':getUserAgent(),'X-TD-Client':'tdx','X-TD-Client-Version':_0x24dd2c};return _0x47a671&&(_0x1aabfc[_0x5a6e96(0xee)]=_0x5a6e96(0xe9)+_0x47a671),_0x1aabfc;}export function toHeaderRecord(_0x3e6843){const _0x37635d=a36_0x1804,_0x2fd1ae={};for(const [_0x25b032,_0x4c670e]of Object[_0x37635d(0xdc)](_0x3e6843)){_0x4c670e!==undefined&&(_0x2fd1ae[_0x25b032]=_0x4c670e);}return _0x2fd1ae;}export function getTrinoHeaders(_0x5d6202,_0x3ed3da){const _0x16f7bf=a36_0x1804,_0x5149ba=getAuthHeaders(_0x5d6202,_0x3ed3da),_0x39ae1e=toHeaderRecord(_0x5149ba);return delete _0x39ae1e[_0x16f7bf(0xee)],_0x3ed3da&&(_0x39ae1e[_0x16f7bf(0xf2)]=_0x3ed3da),_0x39ae1e;}export function hasAPIKey(_0x5de1b7){const _0x474c5e=a36_0x1804,_0x5330d9=getAPIKey(_0x5de1b7);return _0x5330d9!==undefined&&_0x5330d9[_0x474c5e(0xe5)]>0x0;}function a36_0x1b63(){const _0x573de4=['TD1\x20','16AQDmie',';\x20node/','../../package.json','version','Authorization','92802XYfiIh','3452196deSbjI','5997008tRchRN','X-Trino-User','127761JBnSfd','entries','utf-8','290269HkBLMr','3hyRDWt','12452562uFfYoP','parse','tdx/','url','30pWCatK','length','3933755nbnxVO','0.0.0','110dcEGEW'];a36_0x1b63=function(){return _0x573de4;};return a36_0x1b63();}
@@ -1 +1 @@
1
- (function(_0x390a99,_0x333ec8){const _0x1465ac=a37_0x2176,_0x1bb99b=_0x390a99();while(!![]){try{const _0x5263fc=-parseInt(_0x1465ac(0x1e9))/0x1+-parseInt(_0x1465ac(0x203))/0x2+parseInt(_0x1465ac(0x1fe))/0x3*(parseInt(_0x1465ac(0x1e8))/0x4)+-parseInt(_0x1465ac(0x1f9))/0x5*(-parseInt(_0x1465ac(0x211))/0x6)+parseInt(_0x1465ac(0x214))/0x7*(-parseInt(_0x1465ac(0x1f7))/0x8)+parseInt(_0x1465ac(0x1ef))/0x9+parseInt(_0x1465ac(0x209))/0xa;if(_0x5263fc===_0x333ec8)break;else _0x1bb99b['push'](_0x1bb99b['shift']());}catch(_0x257e6a){_0x1bb99b['push'](_0x1bb99b['shift']());}}}(a37_0x1bc6,0x8219c));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a37_0x1aefaf from'node:fs';import*as a37_0x2bcb39 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 a37_0x711bed from'chalk';export function getConfigDir(){const _0x14bb6e=a37_0x2176;return process[_0x14bb6e(0x205)]['TDX_CONFIG_DIR']||join(homedir(),_0x14bb6e(0x20e),_0x14bb6e(0x215));}export function getConfigFile(){const _0x34d773=a37_0x2176;return join(getConfigDir(),_0x34d773(0x20f));}export function getConfigFilePath(_0x4fd3ab){const _0x5de132=a37_0x2176,_0x963b1b=getConfigDir();return _0x4fd3ab?a37_0x2bcb39[_0x5de132(0x1e2)](_0x963b1b,_0x5de132(0x218)+_0x4fd3ab):getConfigFile();}export function getCacheDir(){const _0x3d021a=a37_0x2176;return process[_0x3d021a(0x205)][_0x3d021a(0x21b)]||join(homedir(),_0x3d021a(0x1e0),'tdx');}export function getLLMProjectCacheFile(){const _0x53b21a=a37_0x2176;return join(getCacheDir(),_0x53b21a(0x1e1));}function a37_0x2176(_0x5c19c6,_0x149573){const _0x1bc631=a37_0x1bc6();return a37_0x2176=function(_0x2176a4,_0x349374){_0x2176a4=_0x2176a4-0x1dd;let _0xb8c2=_0x1bc631[_0x2176a4];return _0xb8c2;},a37_0x2176(_0x5c19c6,_0x149573);}export function readCachedLLMProject(){try{const _0x2aa976=getLLMProjectCacheFile();if(!existsSync(_0x2aa976))return null;return readFileSync(_0x2aa976,'utf-8')['trim']();}catch{return null;}}export function writeCachedLLMProject(_0x525296){const _0x11fdc0=a37_0x2176;try{const _0x3f907a=getCacheDir(),_0x530fd4=getLLMProjectCacheFile();!existsSync(_0x3f907a)&&mkdirSync(_0x3f907a,{'recursive':!![]}),writeFileSync(_0x530fd4,_0x525296,'utf-8');}catch(_0x2cca6e){console[_0x11fdc0(0x217)](_0x11fdc0(0x20b),_0x2cca6e);}}export function parseEnvFile(_0x578395){const _0x2bc33b=a37_0x2176,_0x1ce44c={};for(const _0x428a89 of _0x578395[_0x2bc33b(0x1ff)]('\x0a')){const _0x2d3fa5=_0x428a89[_0x2bc33b(0x1f2)]();if(!_0x2d3fa5||_0x2d3fa5[_0x2bc33b(0x1df)]('#'))continue;const _0xfe6048=_0x2d3fa5[_0x2bc33b(0x1f5)](/^([^=]+)=(.*)$/);if(_0xfe6048){const _0x5deb55=_0xfe6048[0x1][_0x2bc33b(0x1f2)]();let _0x31b628=_0xfe6048[0x2][_0x2bc33b(0x1f2)]();(_0x31b628[_0x2bc33b(0x1df)]('\x22')&&_0x31b628[_0x2bc33b(0x1ea)]('\x22')||_0x31b628[_0x2bc33b(0x1df)]('\x27')&&_0x31b628[_0x2bc33b(0x1ea)]('\x27'))&&(_0x31b628=_0x31b628[_0x2bc33b(0x1e4)](0x1,-0x1)),_0x1ce44c[_0x5deb55]=_0x31b628;}}return _0x1ce44c;}function a37_0x1bc6(){const _0x2ea597=['12906nlJiSr','env:\x20','warn','trim','includes','existsSync','match','dev-eu01','8hmjjgH','utf-8','4543745FPrfRj','env:\x20TD_API_KEY','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','TD_API_KEY','tdx.json','1068213lqbNlw','split','\x27,\x20defaulting\x20to\x20us01','eu01','apiKeys','772494bvwVLP','stg-ap03','env','entries','dev-us01','toUpperCase','4412120CvDgQH','replace','Warning:\x20Failed\x20to\x20cache\x20LLM\x20project\x20name:','ap02','\x20(TD_API_KEY)','.config','.env','stg-jp01','6SSSOdR','stg-us01','ap03','3811451UTxZun','tdx','profile','error','.env.','profiles','yellow','TDX_CACHE_DIR','readFileSync','global:\x20','startsWith','.cache','llm_default_project','join','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','slice','TD_API_KEY_','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','Warning:\x20Failed\x20to\x20load\x20','4DVnBFg','243834YFIXyV','endsWith','jp01','profile:\x20','us01','parse'];a37_0x1bc6=function(){return _0x2ea597;};return a37_0x1bc6();}export function readUserConfig(){const _0x5cbbb5=a37_0x2176,_0x5ee16f=getConfigFile();if(!existsSync(_0x5ee16f))return{};try{const _0x316b9a=readFileSync(_0x5ee16f,_0x5cbbb5(0x1f8));return parseEnvFile(_0x316b9a);}catch(_0x24f4c6){return console['warn'](_0x5cbbb5(0x1e3)+_0x5ee16f+':',_0x24f4c6),{};}}export function resolveSite(_0xcff8bf){const _0x573c6c=a37_0x2176,_0x1047ec=[_0x573c6c(0x1ed),_0x573c6c(0x1eb),'eu01',_0x573c6c(0x20c),'ap03',_0x573c6c(0x207),_0x573c6c(0x1f6),_0x573c6c(0x212),_0x573c6c(0x210),_0x573c6c(0x204)];if(_0x1047ec[_0x573c6c(0x1f3)](_0xcff8bf))return _0xcff8bf;if(_0xcff8bf in SITE_ALIASES)return SITE_ALIASES[_0xcff8bf];return console[_0x573c6c(0x1f1)]('Warning:\x20Unknown\x20site\x20\x27'+_0xcff8bf+_0x573c6c(0x200)),_0x573c6c(0x1ed);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x18f9b4,_0x428b08){const _0xd11f90=a37_0x2176,_0x1bd0d4=_0x18f9b4['toUpperCase']()[_0xd11f90(0x20a)](/-/g,'_'),_0x499eed=_0xd11f90(0x1e5)+_0x1bd0d4;if(process[_0xd11f90(0x205)][_0x499eed])return process[_0xd11f90(0x205)][_0x499eed];if(process['env']['TD_API_KEY'])return process[_0xd11f90(0x205)][_0xd11f90(0x1fc)];const _0x3e9d60=_0x428b08||getActiveProfileName();if(_0x3e9d60){const _0x42081d=loadProfileEnv(_0x3e9d60);if(_0x42081d){if(_0x42081d[_0x499eed])return _0x42081d[_0x499eed];if(_0x42081d[_0xd11f90(0x1fc)])return _0x42081d[_0xd11f90(0x1fc)];}}const _0x3474f9=loadUserConfigOnce();if(_0x3474f9[_0x499eed])return _0x3474f9[_0x499eed];if(_0x3474f9[_0xd11f90(0x1fc)])return _0x3474f9['TD_API_KEY'];return undefined;}export async function getAPIKeyAsync(_0x36f91f,_0x1caf14){const _0x170912=a37_0x2176,_0x33c8eb=_0x36f91f[_0x170912(0x208)]()[_0x170912(0x20a)](/-/g,'_'),_0x3969f7=_0x170912(0x1e5)+_0x33c8eb;if(process[_0x170912(0x205)][_0x3969f7])return process[_0x170912(0x205)][_0x3969f7];if(process[_0x170912(0x205)][_0x170912(0x1fc)])return process[_0x170912(0x205)][_0x170912(0x1fc)];const _0x5cea8b=_0x1caf14||getActiveProfileName()||undefined,_0x46fe6e=getCachedCredential(_0x36f91f,_0x5cea8b);if(_0x46fe6e)return _0x46fe6e;const _0x10b833=await getKeychainAPIKey(_0x5cea8b);if(_0x10b833)return setCachedCredential(_0x10b833,_0x36f91f,_0x5cea8b),_0x10b833;const _0x4540cb=getLegacyEnvAPIKey(_0x36f91f,_0x5cea8b);if(_0x4540cb){const _0x3f639d=await isKeychainAvailable();if(_0x3f639d)try{await saveKeychainAPIKey(_0x4540cb,_0x5cea8b),setCachedCredential(_0x4540cb,_0x36f91f,_0x5cea8b);const _0x438521=getConfigFilePath(_0x5cea8b);cleanupLegacyEnvFile(_0x438521)&&console[_0x170912(0x1f1)](a37_0x711bed[_0x170912(0x21a)]('⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage'));}catch(_0x2523a2){console[_0x170912(0x1f1)](a37_0x711bed['yellow'](_0x170912(0x1fb)+_0x2523a2));}return _0x4540cb;}return undefined;}function getLegacyEnvAPIKey(_0x461b30,_0x1ecb1e){const _0x46a99c=a37_0x2176,_0x2ff4af=_0x461b30[_0x46a99c(0x208)]()[_0x46a99c(0x20a)](/-/g,'_'),_0x581068='TD_API_KEY_'+_0x2ff4af;if(_0x1ecb1e){const _0x464c0e=loadProfileEnv(_0x1ecb1e);if(_0x464c0e){if(_0x464c0e[_0x581068])return _0x464c0e[_0x581068];if(_0x464c0e[_0x46a99c(0x1fc)])return _0x464c0e[_0x46a99c(0x1fc)];}}const _0x2560fb=loadUserConfigOnce();if(_0x2560fb[_0x581068])return _0x2560fb[_0x581068];if(_0x2560fb[_0x46a99c(0x1fc)])return _0x2560fb[_0x46a99c(0x1fc)];return undefined;}function cleanupLegacyEnvFile(_0xfc990c){const _0x42c3cc=a37_0x2176;if(!existsSync(_0xfc990c))return![];try{const _0x508a17=readFileSync(_0xfc990c,_0x42c3cc(0x1f8)),_0x4578ef=_0x508a17['split']('\x0a'),_0x2771df=_0x4578ef['filter'](_0x2ad63a=>{const _0x12b3d0=_0x42c3cc,_0x5462cd=_0x2ad63a[_0x12b3d0(0x1f2)]();if(!_0x5462cd||_0x5462cd[_0x12b3d0(0x1df)]('#'))return!![];const [_0x1d50a7]=_0x5462cd[_0x12b3d0(0x1ff)]('=');return!_0x1d50a7[_0x12b3d0(0x1df)](_0x12b3d0(0x1fc));}),_0x1cc0d5=_0x2771df['some'](_0x58af2f=>{const _0x2f6cbe=_0x42c3cc,_0x102dfd=_0x58af2f[_0x2f6cbe(0x1f2)]();return _0x102dfd&&!_0x102dfd['startsWith']('#');});if(!_0x1cc0d5)return unlinkSync(_0xfc990c),!![];return writeFileSync(_0xfc990c,_0x2771df[_0x42c3cc(0x1e2)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}export function getAPIKeySource(_0x5a07f0,_0x43f76b){const _0x4c0939=a37_0x2176,_0x4872bf=_0x4c0939(0x1e5)+_0x5a07f0[_0x4c0939(0x208)]()[_0x4c0939(0x20a)](/-/g,'_');if(process[_0x4c0939(0x205)][_0x4872bf])return _0x4c0939(0x1f0)+_0x4872bf;if(process['env'][_0x4c0939(0x1fc)])return _0x4c0939(0x1fa);const _0x139689=_0x43f76b||getActiveProfileName();if(_0x139689){const _0x11a576=loadProfileEnv(_0x139689);if(_0x11a576){if(_0x11a576[_0x4872bf])return _0x4c0939(0x1ec)+_0x139689+'\x20('+_0x4872bf+')';if(_0x11a576[_0x4c0939(0x1fc)])return _0x4c0939(0x1ec)+_0x139689+_0x4c0939(0x20d);}}const _0x6ac8ca=loadUserConfigOnce(),_0x37d3ac=getConfigFile();if(_0x6ac8ca[_0x4872bf])return _0x4c0939(0x1de)+_0x37d3ac+'\x20('+_0x4872bf+')';if(_0x6ac8ca[_0x4c0939(0x1fc)])return'global:\x20'+_0x37d3ac+_0x4c0939(0x20d);return null;}function loadProfileEnv(_0x3420c0){const _0xf8977e=a37_0x2176,_0xd1b32=a37_0x2bcb39[_0xf8977e(0x1e2)](getConfigDir(),_0xf8977e(0x218)+_0x3420c0);if(a37_0x1aefaf[_0xf8977e(0x1f4)](_0xd1b32)){validateSecureFilePermissions(_0xd1b32);try{const _0x348dc1=a37_0x1aefaf[_0xf8977e(0x1dd)](_0xd1b32,'utf-8');return parseEnvFile(_0x348dc1);}catch(_0x57eae5){console['warn'](_0xf8977e(0x1e7)+_0xd1b32+':\x20'+_0x57eae5);}}const _0x52ad0b=a37_0x2bcb39[_0xf8977e(0x1e2)](getConfigDir(),_0xf8977e(0x219),_0x3420c0,_0xf8977e(0x20f));if(a37_0x1aefaf[_0xf8977e(0x1f4)](_0x52ad0b)){validateSecureFilePermissions(_0x52ad0b);try{const _0x323621=a37_0x1aefaf[_0xf8977e(0x1dd)](_0x52ad0b,'utf-8');return parseEnvFile(_0x323621);}catch(_0x3e0e9f){return console[_0xf8977e(0x1f1)](_0xf8977e(0x1e7)+_0x52ad0b+':\x20'+_0x3e0e9f),null;}}return null;}function getActiveProfileName(){const _0x4b28fe=a37_0x2176,_0x5b07df=a37_0x2bcb39[_0x4b28fe(0x1e2)](getConfigDir(),_0x4b28fe(0x1fd));if(!a37_0x1aefaf['existsSync'](_0x5b07df))return null;try{const _0x13adb2=a37_0x1aefaf[_0x4b28fe(0x1dd)](_0x5b07df,_0x4b28fe(0x1f8)),_0x323fac=JSON[_0x4b28fe(0x1ee)](_0x13adb2);return _0x323fac[_0x4b28fe(0x216)]||null;}catch{return null;}}export function saveAPIKey(_0x16fcff,_0x78511a,_0x520934){const _0x922356=a37_0x2176,_0x25656f=getConfigDir(),_0xe9c339=getConfigFilePath(_0x520934);!existsSync(_0x25656f)&&mkdirSync(_0x25656f,{'recursive':!![],'mode':0x1c0});let _0x32cdd9={};if(existsSync(_0xe9c339))try{const _0x1cef2e=readFileSync(_0xe9c339,_0x922356(0x1f8));_0x32cdd9=parseEnvFile(_0x1cef2e);}catch(_0x3bd700){console[_0x922356(0x1f1)]('Warning:\x20Failed\x20to\x20read\x20'+_0xe9c339+':',_0x3bd700);}const _0x2dd255=_0x16fcff[_0x922356(0x208)]()[_0x922356(0x20a)](/-/g,'_');_0x32cdd9[_0x922356(0x1e5)+_0x2dd255]=_0x78511a;const _0x2c8e06=Object[_0x922356(0x206)](_0x32cdd9)['map'](([_0x4544d2,_0x1dbe00])=>_0x4544d2+'='+_0x1dbe00);writeFileSync(_0xe9c339,_0x2c8e06[_0x922356(0x1e2)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x190acb,_0x1645ea,_0x17dc41){const _0x4ac0f9=a37_0x2176;await saveKeychainAPIKey(_0x190acb,_0x17dc41),setCachedCredential(_0x190acb,_0x1645ea,_0x17dc41);const _0x2f445b=getConfigFilePath(_0x17dc41);cleanupLegacyEnvFile(_0x2f445b)&&console[_0x4ac0f9(0x1f1)](a37_0x711bed[_0x4ac0f9(0x21a)](_0x4ac0f9(0x1e6)));}export function loadConfig(){const _0x2ecba9=a37_0x2176,_0x4c0f71={'apiKeys':{},'defaultSite':_0x2ecba9(0x1ed)},_0x1b8588=['us01',_0x2ecba9(0x1eb),_0x2ecba9(0x201),_0x2ecba9(0x20c),_0x2ecba9(0x213),_0x2ecba9(0x207),_0x2ecba9(0x1f6),'stg-us01',_0x2ecba9(0x210),_0x2ecba9(0x204)];for(const _0x181055 of _0x1b8588){const _0x360998=getAPIKey(_0x181055);_0x360998&&(_0x4c0f71[_0x2ecba9(0x202)][_0x181055]=_0x360998);}return _0x4c0f71;}
1
+ (function(_0xe3308f,_0x34f7af){const _0x4235e0=a37_0x5ec0,_0x397029=_0xe3308f();while(!![]){try{const _0x4f21a4=parseInt(_0x4235e0(0xcc))/0x1+parseInt(_0x4235e0(0xb7))/0x2*(parseInt(_0x4235e0(0xb0))/0x3)+-parseInt(_0x4235e0(0xcd))/0x4+-parseInt(_0x4235e0(0xb4))/0x5*(-parseInt(_0x4235e0(0xc4))/0x6)+-parseInt(_0x4235e0(0xa5))/0x7+parseInt(_0x4235e0(0xbb))/0x8+parseInt(_0x4235e0(0xaa))/0x9*(-parseInt(_0x4235e0(0xa6))/0xa);if(_0x4f21a4===_0x34f7af)break;else _0x397029['push'](_0x397029['shift']());}catch(_0x4d6959){_0x397029['push'](_0x397029['shift']());}}}(a37_0x371e,0x38584));import{homedir}from'os';function a37_0x371e(){const _0x1746a2=['split','ap03','toUpperCase','existsSync','tdx','.cache','startsWith','entries','TD_API_KEY_','join','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','error','3226734TEzNEm','8890HFvVYz','ap02','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','llm_default_project','3906UUTDNA','trim','\x20(TD_API_KEY)','parse','jp01','us01','103470xNtiBA','profile','env','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','4145MpADND','utf-8','TDX_CACHE_DIR','18AgWqBm','map','includes','stg-ap03','2406872jELcEp','.env.','.config','yellow','stg-jp01','replace','stg-us01','Warning:\x20Failed\x20to\x20read\x20','.env','1524fuHTtt','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','tdx.json','Warning:\x20Failed\x20to\x20load\x20','match','TD_API_KEY','eu01','apiKeys','440563tAXasp','739288oSKqeS','profiles','Warning:\x20Failed\x20to\x20cache\x20LLM\x20project\x20name:','global:\x20','\x27,\x20defaulting\x20to\x20us01','readFileSync','dev-eu01','warn','slice'];a37_0x371e=function(){return _0x1746a2;};return a37_0x371e();}import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a37_0x328f52 from'node:fs';import*as a37_0x4a6338 from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';function a37_0x5ec0(_0x82cceb,_0x2a9b5a){const _0x371efc=a37_0x371e();return a37_0x5ec0=function(_0x5ec0b5,_0x237f4c){_0x5ec0b5=_0x5ec0b5-0x9b;let _0x1c9522=_0x371efc[_0x5ec0b5];return _0x1c9522;},a37_0x5ec0(_0x82cceb,_0x2a9b5a);}import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a37_0x3cb57c from'chalk';export function getConfigDir(){const _0x281eb5=a37_0x5ec0;return process[_0x281eb5(0xb2)]['TDX_CONFIG_DIR']||join(homedir(),_0x281eb5(0xbd),'tdx');}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x580da6){const _0xce3052=a37_0x5ec0,_0x7089aa=getConfigDir();return _0x580da6?a37_0x4a6338[_0xce3052(0xa2)](_0x7089aa,_0xce3052(0xbc)+_0x580da6):getConfigFile();}export function getCacheDir(){const _0xe4d130=a37_0x5ec0;return process['env'][_0xe4d130(0xb6)]||join(homedir(),_0xe4d130(0x9e),_0xe4d130(0x9d));}export function getLLMProjectCacheFile(){const _0x578d30=a37_0x5ec0;return join(getCacheDir(),_0x578d30(0xa9));}export function readCachedLLMProject(){const _0x1c1b0d=a37_0x5ec0;try{const _0x992422=getLLMProjectCacheFile();if(!existsSync(_0x992422))return null;return readFileSync(_0x992422,_0x1c1b0d(0xb5))[_0x1c1b0d(0xab)]();}catch{return null;}}export function writeCachedLLMProject(_0x5a1960){const _0x1c6ba2=a37_0x5ec0;try{const _0x18cdaa=getCacheDir(),_0x3e35dc=getLLMProjectCacheFile();!existsSync(_0x18cdaa)&&mkdirSync(_0x18cdaa,{'recursive':!![]}),writeFileSync(_0x3e35dc,_0x5a1960,_0x1c6ba2(0xb5));}catch(_0x1c2831){console[_0x1c6ba2(0xa4)](_0x1c6ba2(0xcf),_0x1c2831);}}export function parseEnvFile(_0x2b5674){const _0x42334e=a37_0x5ec0,_0x388322={};for(const _0x2a1412 of _0x2b5674[_0x42334e(0xd6)]('\x0a')){const _0x44a531=_0x2a1412['trim']();if(!_0x44a531||_0x44a531['startsWith']('#'))continue;const _0x15e8da=_0x44a531[_0x42334e(0xc8)](/^([^=]+)=(.*)$/);if(_0x15e8da){const _0x2f8bfc=_0x15e8da[0x1][_0x42334e(0xab)]();let _0x46fc64=_0x15e8da[0x2][_0x42334e(0xab)]();(_0x46fc64['startsWith']('\x22')&&_0x46fc64['endsWith']('\x22')||_0x46fc64['startsWith']('\x27')&&_0x46fc64['endsWith']('\x27'))&&(_0x46fc64=_0x46fc64[_0x42334e(0xd5)](0x1,-0x1)),_0x388322[_0x2f8bfc]=_0x46fc64;}}return _0x388322;}export function readUserConfig(){const _0x2c820a=a37_0x5ec0,_0xaa6e94=getConfigFile();if(!existsSync(_0xaa6e94))return{};try{const _0x3db294=readFileSync(_0xaa6e94,_0x2c820a(0xb5));return parseEnvFile(_0x3db294);}catch(_0x3aa655){return console[_0x2c820a(0xd4)](_0x2c820a(0xa8)+_0xaa6e94+':',_0x3aa655),{};}}export function resolveSite(_0x53890c){const _0x187b0f=a37_0x5ec0,_0x3d0067=[_0x187b0f(0xaf),_0x187b0f(0xae),_0x187b0f(0xca),_0x187b0f(0xa7),_0x187b0f(0xd7),'dev-us01',_0x187b0f(0xd3),_0x187b0f(0xc1),_0x187b0f(0xbf),_0x187b0f(0xba)];if(_0x3d0067[_0x187b0f(0xb9)](_0x53890c))return _0x53890c;if(_0x53890c in SITE_ALIASES)return SITE_ALIASES[_0x53890c];return console['warn']('Warning:\x20Unknown\x20site\x20\x27'+_0x53890c+_0x187b0f(0xd1)),_0x187b0f(0xaf);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x3afb4a,_0x1e1175){const _0x8c5483=a37_0x5ec0,_0x19975e=_0x3afb4a[_0x8c5483(0x9b)]()[_0x8c5483(0xc0)](/-/g,'_'),_0x352e7c='TD_API_KEY_'+_0x19975e;if(process[_0x8c5483(0xb2)][_0x352e7c])return process[_0x8c5483(0xb2)][_0x352e7c];if(process['env'][_0x8c5483(0xc9)])return process[_0x8c5483(0xb2)][_0x8c5483(0xc9)];const _0x1e67cd=_0x1e1175||getActiveProfileName();if(_0x1e67cd){const _0x426dbc=loadProfileEnv(_0x1e67cd);if(_0x426dbc){if(_0x426dbc[_0x352e7c])return _0x426dbc[_0x352e7c];if(_0x426dbc['TD_API_KEY'])return _0x426dbc[_0x8c5483(0xc9)];}}const _0x4965d2=loadUserConfigOnce();if(_0x4965d2[_0x352e7c])return _0x4965d2[_0x352e7c];if(_0x4965d2['TD_API_KEY'])return _0x4965d2[_0x8c5483(0xc9)];return undefined;}export async function getAPIKeyAsync(_0x5d8d8f,_0x59eb09){const _0x3658e9=a37_0x5ec0,_0x24d48c=_0x5d8d8f[_0x3658e9(0x9b)]()[_0x3658e9(0xc0)](/-/g,'_'),_0xb35e02='TD_API_KEY_'+_0x24d48c;if(process[_0x3658e9(0xb2)][_0xb35e02])return process[_0x3658e9(0xb2)][_0xb35e02];if(process[_0x3658e9(0xb2)][_0x3658e9(0xc9)])return process['env'][_0x3658e9(0xc9)];const _0x256364=_0x59eb09||getActiveProfileName()||undefined,_0x1da34b=getCachedCredential(_0x5d8d8f,_0x256364);if(_0x1da34b)return _0x1da34b;const _0x33b958=await getKeychainAPIKey(_0x256364);if(_0x33b958)return setCachedCredential(_0x33b958,_0x5d8d8f,_0x256364),_0x33b958;const _0x5ef4fc=getLegacyEnvAPIKey(_0x5d8d8f,_0x256364);if(_0x5ef4fc){const _0x21c76c=await isKeychainAvailable();if(_0x21c76c)try{await saveKeychainAPIKey(_0x5ef4fc,_0x256364),setCachedCredential(_0x5ef4fc,_0x5d8d8f,_0x256364);const _0x4dbc73=getConfigFilePath(_0x256364);cleanupLegacyEnvFile(_0x4dbc73)&&console[_0x3658e9(0xd4)](a37_0x3cb57c[_0x3658e9(0xbe)](_0x3658e9(0xc5)));}catch(_0x193888){console[_0x3658e9(0xd4)](a37_0x3cb57c[_0x3658e9(0xbe)](_0x3658e9(0xb3)+_0x193888));}return _0x5ef4fc;}return undefined;}function getLegacyEnvAPIKey(_0x117ea3,_0x3988e3){const _0x34b30d=a37_0x5ec0,_0x53bce4=_0x117ea3['toUpperCase']()['replace'](/-/g,'_'),_0x2825fd='TD_API_KEY_'+_0x53bce4;if(_0x3988e3){const _0x28752b=loadProfileEnv(_0x3988e3);if(_0x28752b){if(_0x28752b[_0x2825fd])return _0x28752b[_0x2825fd];if(_0x28752b[_0x34b30d(0xc9)])return _0x28752b['TD_API_KEY'];}}const _0x25c763=loadUserConfigOnce();if(_0x25c763[_0x2825fd])return _0x25c763[_0x2825fd];if(_0x25c763['TD_API_KEY'])return _0x25c763[_0x34b30d(0xc9)];return undefined;}function cleanupLegacyEnvFile(_0x1aa593){const _0x159960=a37_0x5ec0;if(!existsSync(_0x1aa593))return![];try{const _0x4ef93e=readFileSync(_0x1aa593,_0x159960(0xb5)),_0x41d8db=_0x4ef93e[_0x159960(0xd6)]('\x0a'),_0xc7513e=_0x41d8db['filter'](_0x1eb3ea=>{const _0x3b15d2=_0x159960,_0x6033a=_0x1eb3ea[_0x3b15d2(0xab)]();if(!_0x6033a||_0x6033a[_0x3b15d2(0x9f)]('#'))return!![];const [_0x1161bd]=_0x6033a[_0x3b15d2(0xd6)]('=');return!_0x1161bd['startsWith']('TD_API_KEY');}),_0x21cdb4=_0xc7513e['some'](_0x3b786e=>{const _0x3c3011=_0x159960,_0x5afbc5=_0x3b786e[_0x3c3011(0xab)]();return _0x5afbc5&&!_0x5afbc5[_0x3c3011(0x9f)]('#');});if(!_0x21cdb4)return unlinkSync(_0x1aa593),!![];return writeFileSync(_0x1aa593,_0xc7513e['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}export function getAPIKeySource(_0x1e31c4,_0x440a72){const _0x521a52=a37_0x5ec0,_0x55f58c=_0x521a52(0xa1)+_0x1e31c4[_0x521a52(0x9b)]()[_0x521a52(0xc0)](/-/g,'_');if(process[_0x521a52(0xb2)][_0x55f58c])return'env:\x20'+_0x55f58c;if(process[_0x521a52(0xb2)][_0x521a52(0xc9)])return'env:\x20TD_API_KEY';const _0x48e0d9=_0x440a72||getActiveProfileName();if(_0x48e0d9){const _0x4502cc=loadProfileEnv(_0x48e0d9);if(_0x4502cc){if(_0x4502cc[_0x55f58c])return'profile:\x20'+_0x48e0d9+'\x20('+_0x55f58c+')';if(_0x4502cc['TD_API_KEY'])return'profile:\x20'+_0x48e0d9+_0x521a52(0xac);}}const _0x46700c=loadUserConfigOnce(),_0x39f933=getConfigFile();if(_0x46700c[_0x55f58c])return _0x521a52(0xd0)+_0x39f933+'\x20('+_0x55f58c+')';if(_0x46700c[_0x521a52(0xc9)])return _0x521a52(0xd0)+_0x39f933+'\x20(TD_API_KEY)';return null;}function loadProfileEnv(_0x18fe10){const _0x313020=a37_0x5ec0,_0x356e2e=a37_0x4a6338[_0x313020(0xa2)](getConfigDir(),_0x313020(0xbc)+_0x18fe10);if(a37_0x328f52[_0x313020(0x9c)](_0x356e2e)){validateSecureFilePermissions(_0x356e2e);try{const _0x31d398=a37_0x328f52[_0x313020(0xd2)](_0x356e2e,_0x313020(0xb5));return parseEnvFile(_0x31d398);}catch(_0x177c1d){console['warn'](_0x313020(0xc7)+_0x356e2e+':\x20'+_0x177c1d);}}const _0x49fc37=a37_0x4a6338['join'](getConfigDir(),_0x313020(0xce),_0x18fe10,_0x313020(0xc3));if(a37_0x328f52[_0x313020(0x9c)](_0x49fc37)){validateSecureFilePermissions(_0x49fc37);try{const _0x14a343=a37_0x328f52[_0x313020(0xd2)](_0x49fc37,_0x313020(0xb5));return parseEnvFile(_0x14a343);}catch(_0x1b2c8c){return console[_0x313020(0xd4)](_0x313020(0xc7)+_0x49fc37+':\x20'+_0x1b2c8c),null;}}return null;}function getActiveProfileName(){const _0x38bad4=a37_0x5ec0,_0x4ac43f=a37_0x4a6338[_0x38bad4(0xa2)](getConfigDir(),_0x38bad4(0xc6));if(!a37_0x328f52[_0x38bad4(0x9c)](_0x4ac43f))return null;try{const _0x1ad77a=a37_0x328f52[_0x38bad4(0xd2)](_0x4ac43f,'utf-8'),_0x24f500=JSON[_0x38bad4(0xad)](_0x1ad77a);return _0x24f500[_0x38bad4(0xb1)]||null;}catch{return null;}}export function saveAPIKey(_0x219a05,_0x5e3e16,_0x471db8){const _0x5b7e43=a37_0x5ec0,_0x34c355=getConfigDir(),_0x450b01=getConfigFilePath(_0x471db8);!existsSync(_0x34c355)&&mkdirSync(_0x34c355,{'recursive':!![],'mode':0x1c0});let _0x14cc28={};if(existsSync(_0x450b01))try{const _0x4206d5=readFileSync(_0x450b01,_0x5b7e43(0xb5));_0x14cc28=parseEnvFile(_0x4206d5);}catch(_0x8a3845){console[_0x5b7e43(0xd4)](_0x5b7e43(0xc2)+_0x450b01+':',_0x8a3845);}const _0x369259=_0x219a05[_0x5b7e43(0x9b)]()[_0x5b7e43(0xc0)](/-/g,'_');_0x14cc28['TD_API_KEY_'+_0x369259]=_0x5e3e16;const _0x47f9d9=Object[_0x5b7e43(0xa0)](_0x14cc28)[_0x5b7e43(0xb8)](([_0x264c3b,_0x51e2dd])=>_0x264c3b+'='+_0x51e2dd);writeFileSync(_0x450b01,_0x47f9d9['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x33bc99,_0x32049f,_0x395e0f){const _0x4ed20a=a37_0x5ec0;await saveKeychainAPIKey(_0x33bc99,_0x395e0f),setCachedCredential(_0x33bc99,_0x32049f,_0x395e0f);const _0x214a21=getConfigFilePath(_0x395e0f);cleanupLegacyEnvFile(_0x214a21)&&console[_0x4ed20a(0xd4)](a37_0x3cb57c[_0x4ed20a(0xbe)](_0x4ed20a(0xa3)));}export function loadConfig(){const _0x15d7f6=a37_0x5ec0,_0x5c9fe6={'apiKeys':{},'defaultSite':_0x15d7f6(0xaf)},_0x116270=[_0x15d7f6(0xaf),_0x15d7f6(0xae),_0x15d7f6(0xca),_0x15d7f6(0xa7),_0x15d7f6(0xd7),'dev-us01',_0x15d7f6(0xd3),_0x15d7f6(0xc1),_0x15d7f6(0xbf),_0x15d7f6(0xba)];for(const _0x15979b of _0x116270){const _0x238129=getAPIKey(_0x15979b);_0x238129&&(_0x5c9fe6[_0x15d7f6(0xcb)][_0x15979b]=_0x238129);}return _0x5c9fe6;}
@@ -1 +1 @@
1
- (function(_0x152cd5,_0x2064ef){const _0x31f6cc=a38_0x6ae2,_0x2a5f7d=_0x152cd5();while(!![]){try{const _0x32074a=-parseInt(_0x31f6cc(0x95))/0x1*(-parseInt(_0x31f6cc(0x9d))/0x2)+-parseInt(_0x31f6cc(0xa4))/0x3*(-parseInt(_0x31f6cc(0xa0))/0x4)+parseInt(_0x31f6cc(0xa3))/0x5+-parseInt(_0x31f6cc(0x9b))/0x6*(-parseInt(_0x31f6cc(0x9e))/0x7)+parseInt(_0x31f6cc(0xa2))/0x8+parseInt(_0x31f6cc(0xa1))/0x9+-parseInt(_0x31f6cc(0x9f))/0xa;if(_0x32074a===_0x2064ef)break;else _0x2a5f7d['push'](_0x2a5f7d['shift']());}catch(_0x186f79){_0x2a5f7d['push'](_0x2a5f7d['shift']());}}}(a38_0x2aeb,0x97380));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x5568ff,_0x1c4023){const _0x56850e=a38_0x6ae2,_0x4c2e1f=_0x5568ff||_0x56850e(0xa5),_0x2f57aa=_0x1c4023||_0x56850e(0x96);return _0x4c2e1f+':'+_0x2f57aa;}export function getCachedCredential(_0x44103f,_0x165b00){const _0x51507f=a38_0x6ae2,_0x20f823=getCacheKey(_0x44103f,_0x165b00),_0x359f5b=cache[_0x51507f(0xa7)](_0x20f823);if(!_0x359f5b)return null;if(Date[_0x51507f(0x97)]()-_0x359f5b[_0x51507f(0x98)]>CACHE_TTL_MS)return cache['delete'](_0x20f823),null;return _0x359f5b[_0x51507f(0x9a)];}function a38_0x6ae2(_0x1b9b80,_0x559ac2){const _0x2aebdc=a38_0x2aeb();return a38_0x6ae2=function(_0x6ae291,_0xa919e){_0x6ae291=_0x6ae291-0x95;let _0x5baaf4=_0x2aebdc[_0x6ae291];return _0x5baaf4;},a38_0x6ae2(_0x1b9b80,_0x559ac2);}export function setCachedCredential(_0x6ce78a,_0x5834f6,_0x166c23){const _0xc5f93f=a38_0x6ae2,_0x5f03ec=getCacheKey(_0x5834f6,_0x166c23);cache[_0xc5f93f(0x99)](_0x5f03ec,{'apiKey':_0x6ce78a,'loadedAt':Date['now']()});}export function clearCredentialCache(){const _0x2fdee7=a38_0x6ae2;cache[_0x2fdee7(0x9c)]();}export function clearCachedCredential(_0x4373e2,_0x5bb5ca){const _0x450d29=a38_0x6ae2,_0x44088c=getCacheKey(_0x4373e2,_0x5bb5ca);cache[_0x450d29(0xa6)](_0x44088c);}function a38_0x2aeb(){const _0x178cd8=['loadedAt','set','apiKey','10926RXLgKL','clear','115274NauVUT','3759zwQAdg','39291430ZgYnek','1095220PSsoWc','4642731JHsXwr','6462464iRnsaK','859710jjEYYK','12ZOEcaN','__default_site__','delete','get','17cMrDmV','__default_profile__','now'];a38_0x2aeb=function(){return _0x178cd8;};return a38_0x2aeb();}
1
+ (function(_0x3cc236,_0x2592b9){const _0x236db1=a38_0x292f,_0x13f368=_0x3cc236();while(!![]){try{const _0x422a18=-parseInt(_0x236db1(0xb6))/0x1*(parseInt(_0x236db1(0xb7))/0x2)+-parseInt(_0x236db1(0xbf))/0x3*(-parseInt(_0x236db1(0xbb))/0x4)+parseInt(_0x236db1(0xbc))/0x5+-parseInt(_0x236db1(0xb3))/0x6*(-parseInt(_0x236db1(0xb5))/0x7)+-parseInt(_0x236db1(0xb9))/0x8+parseInt(_0x236db1(0xc0))/0x9+-parseInt(_0x236db1(0xb2))/0xa;if(_0x422a18===_0x2592b9)break;else _0x13f368['push'](_0x13f368['shift']());}catch(_0x13ee1a){_0x13f368['push'](_0x13f368['shift']());}}}(a38_0xa8d7,0x2efcc));function a38_0xa8d7(){const _0x4dcdd3=['clear','12OXDoQg','2840931rXVZpU','5735770ZxkoYy','807102frHVgp','now','14UClWNo','1wzVeyW','341344bqSQFN','delete','1386080OBHCyy','loadedAt','179572sLeTlY','1728520lOHXIY','__default_profile__'];a38_0xa8d7=function(){return _0x4dcdd3;};return a38_0xa8d7();}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x1fa8e5,_0x3636de){const _0x58196a=a38_0x292f,_0x4b25c5=_0x1fa8e5||'__default_site__',_0x337a08=_0x3636de||_0x58196a(0xbd);return _0x4b25c5+':'+_0x337a08;}function a38_0x292f(_0x4398bd,_0x11e5f3){const _0xa8d787=a38_0xa8d7();return a38_0x292f=function(_0x292f99,_0x44144f){_0x292f99=_0x292f99-0xb2;let _0x3dcc13=_0xa8d787[_0x292f99];return _0x3dcc13;},a38_0x292f(_0x4398bd,_0x11e5f3);}export function getCachedCredential(_0x581ea6,_0x37f479){const _0xad968a=a38_0x292f,_0x4650cc=getCacheKey(_0x581ea6,_0x37f479),_0x5818c7=cache['get'](_0x4650cc);if(!_0x5818c7)return null;if(Date[_0xad968a(0xb4)]()-_0x5818c7[_0xad968a(0xba)]>CACHE_TTL_MS)return cache[_0xad968a(0xb8)](_0x4650cc),null;return _0x5818c7['apiKey'];}export function setCachedCredential(_0x59185a,_0x2aba41,_0x597508){const _0x969e64=a38_0x292f,_0x1503d2=getCacheKey(_0x2aba41,_0x597508);cache['set'](_0x1503d2,{'apiKey':_0x59185a,'loadedAt':Date[_0x969e64(0xb4)]()});}export function clearCredentialCache(){const _0x58f227=a38_0x292f;cache[_0x58f227(0xbe)]();}export function clearCachedCredential(_0x28b5d1,_0x446371){const _0x367ad9=a38_0x292f,_0x5d6375=getCacheKey(_0x28b5d1,_0x446371);cache[_0x367ad9(0xb8)](_0x5d6375);}
@@ -1 +1 @@
1
- const a39_0x146272=a39_0x5519;(function(_0x507626,_0x459846){const _0x434da1=a39_0x5519,_0x23d865=_0x507626();while(!![]){try{const _0x39f842=-parseInt(_0x434da1(0x206))/0x1+-parseInt(_0x434da1(0x212))/0x2+-parseInt(_0x434da1(0x202))/0x3*(parseInt(_0x434da1(0x21a))/0x4)+-parseInt(_0x434da1(0x1fd))/0x5+-parseInt(_0x434da1(0x1f8))/0x6*(-parseInt(_0x434da1(0x1f4))/0x7)+parseInt(_0x434da1(0x1f0))/0x8+-parseInt(_0x434da1(0x217))/0x9*(-parseInt(_0x434da1(0x200))/0xa);if(_0x39f842===_0x459846)break;else _0x23d865['push'](_0x23d865['shift']());}catch(_0x58fc96){_0x23d865['push'](_0x23d865['shift']());}}}(a39_0x5c04,0xcf810));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';function a39_0x5519(_0x4f1033,_0x4b4090){const _0x5c04be=a39_0x5c04();return a39_0x5519=function(_0x5519f0,_0xf6785e){_0x5519f0=_0x5519f0-0x1de;let _0x9b65d6=_0x5c04be[_0x5519f0];return _0x9b65d6;},a39_0x5519(_0x4f1033,_0x4b4090);}import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';function a39_0x5c04(){const _0x13453f=['config','readFileSync','display','5121370gFZqLZ','existsSync','Profile','35320620jRKbej','llmProject','62556HTpuMM','Profile\x20Credentials','getParameters','displayWithSources','796278jkSMom','(session:\x20','llm_project','getSource','global','cliFlags','CLI\x20flag:\x20--','sessions','[context]',':\x20none\x20(using\x20session:\x20','profile','profiles','3149152kGoopV','loadGlobalConfig','segmentPath','profileCredentials','us01','9ksLAzQ','session','Project','316LmFdCM','tdx.json','log','activeProfile','verbose','site','layers','sessionId','Global','parse','segment_path','database','apiKey','Session','resolveAPIKeyAsync',':\x20none','parentSegment','parent_segment','configFiles','utf-8','default','project','not\x20set','.env','8306896Liceoq','logLevel','createAsync','.json','644BWbtHc','Global\x20Credentials','join','globalCredentials','86214ddSWZB','toString'];a39_0x5c04=function(){return _0x13453f;};return a39_0x5c04();}import{LogLevel}from'../utils/tdx-logger.js';import*as a39_0x14af5d from'node:fs';import*as a39_0x45cf38 from'node:path';export class GlobalContext{[a39_0x146272(0x21f)];[a39_0x146272(0x1e3)];[a39_0x146272(0x1e9)];[a39_0x146272(0x1e2)];['llm_project'];[a39_0x146272(0x1e4)];[a39_0x146272(0x21e)];[a39_0x146272(0x1f1)];[a39_0x146272(0x1de)];['activeProfile'];[a39_0x146272(0x1df)];[a39_0x146272(0x1ea)];constructor(_0x461908){const _0x2f298c=a39_0x146272;this[_0x2f298c(0x1df)]=_0x461908[_0x2f298c(0x218)]||getCurrentSessionPID()[_0x2f298c(0x1f9)]();const _0x42d688=loadSessionContext(_0x461908['session']),_0x5eb6f6=loadProjectConfig(),_0x91aa60=this[_0x2f298c(0x213)]();this['activeProfile']=_0x461908[_0x2f298c(0x210)]||_0x42d688?.[_0x2f298c(0x210)]||_0x91aa60[_0x2f298c(0x210)]||getActiveProfile();const _0x585d3a=this[_0x2f298c(0x21d)]?loadProfile(this[_0x2f298c(0x21d)]):null,_0x1a21f7=_0x5cc563=>{if(!_0x5cc563)return{};const _0xc5f687=_0x5cc563,_0x528c00={};for(const [_0x22906e,_0x4f7aa3]of Object['entries'](_0xc5f687)){typeof _0x4f7aa3==='string'&&(_0x528c00[_0x22906e]=_0x4f7aa3);}return _0x528c00;},_0x42c548={};if(_0x461908[_0x2f298c(0x21f)]&&_0x461908[_0x2f298c(0x21f)]!==_0x2f298c(0x216))_0x42c548[_0x2f298c(0x21f)]=_0x461908[_0x2f298c(0x21f)];const _0x56befc=_0x42d688?.[_0x2f298c(0x1e3)],_0x867091=_0x5eb6f6?.[_0x2f298c(0x1e3)],_0x330f65=_0x585d3a?.['config']?.['database'],_0x40b4fd=_0x91aa60[_0x2f298c(0x1e3)];_0x461908['database']&&(_0x461908['database']!==_0x56befc&&_0x461908['database']!==_0x867091&&_0x461908[_0x2f298c(0x1e3)]!==_0x330f65&&_0x461908[_0x2f298c(0x1e3)]!==_0x40b4fd)&&(_0x42c548[_0x2f298c(0x1e3)]=_0x461908['database']);if(_0x461908[_0x2f298c(0x1e8)])_0x42c548['parent_segment']=_0x461908['parentSegment'];if(_0x461908[_0x2f298c(0x201)])_0x42c548[_0x2f298c(0x208)]=_0x461908[_0x2f298c(0x201)];if(_0x461908[_0x2f298c(0x210)])_0x42c548[_0x2f298c(0x210)]=_0x461908['profile'];this[_0x2f298c(0x1de)]={'cliFlags':_0x42c548,'session':_0x1a21f7(_0x42d688),'project':_0x1a21f7(_0x5eb6f6),'profile':_0x1a21f7(_0x585d3a?.[_0x2f298c(0x1fa)]),'global':_0x1a21f7(_0x91aa60)};const _0x85a48f={...this[_0x2f298c(0x1de)][_0x2f298c(0x20a)],...this['layers'][_0x2f298c(0x210)],...this[_0x2f298c(0x1de)][_0x2f298c(0x1ed)],...this[_0x2f298c(0x1de)]['session'],...this[_0x2f298c(0x1de)][_0x2f298c(0x20b)]},_0xe3161=_0x85a48f['site']||_0x2f298c(0x216);this[_0x2f298c(0x21f)]=resolveSite(_0xe3161),this['database']=_0x85a48f[_0x2f298c(0x1e3)],this[_0x2f298c(0x1e9)]=_0x85a48f[_0x2f298c(0x1e9)],this[_0x2f298c(0x1e2)]=_0x85a48f[_0x2f298c(0x1e2)],this[_0x2f298c(0x208)]=_0x85a48f['llm_project'],this[_0x2f298c(0x21e)]=_0x461908['verbose']||![],this[_0x2f298c(0x1f1)]=_0x461908['logLevel']??LogLevel['INFO'],this['apiKey']=getAPIKey(this[_0x2f298c(0x21f)],this[_0x2f298c(0x21d)]||undefined);const _0x14520a=getConfigDir(),_0x222c92=a39_0x45cf38[_0x2f298c(0x1f6)](_0x14520a,_0x2f298c(0x20d),this[_0x2f298c(0x1df)]+_0x2f298c(0x1f3)),_0x8804cb=findProjectConfigPath(),_0x2cfa67=a39_0x45cf38[_0x2f298c(0x1f6)](_0x14520a,'tdx.json'),_0x56bda8=a39_0x45cf38[_0x2f298c(0x1f6)](_0x14520a,_0x2f298c(0x1ef));let _0x183410=null,_0x2b1b76=null;this[_0x2f298c(0x21d)]&&(_0x183410=a39_0x45cf38[_0x2f298c(0x1f6)](_0x14520a,_0x2f298c(0x211),this['activeProfile'],_0x2f298c(0x21b)),_0x2b1b76=a39_0x45cf38['join'](_0x14520a,_0x2f298c(0x211),this[_0x2f298c(0x21d)],_0x2f298c(0x1ef))),this['configFiles']={'session':a39_0x14af5d[_0x2f298c(0x1fe)](_0x222c92)?_0x222c92:null,'project':_0x8804cb,'profile':_0x183410&&a39_0x14af5d['existsSync'](_0x183410)?_0x183410:null,'profileCredentials':_0x2b1b76&&a39_0x14af5d[_0x2f298c(0x1fe)](_0x2b1b76)?_0x2b1b76:null,'global':a39_0x14af5d['existsSync'](_0x2cfa67)?_0x2cfa67:null,'globalCredentials':a39_0x14af5d[_0x2f298c(0x1fe)](_0x56bda8)?_0x56bda8:null};}[a39_0x146272(0x209)](_0x4e8703,_0x468f45){const _0x289844=a39_0x146272;if(!_0x468f45)return _0x289844(0x1ee);const _0x56f8ee=_0x468f45;if(this[_0x289844(0x1de)]['cliFlags'][_0x4e8703]===_0x56f8ee){if(_0x4e8703===_0x289844(0x21f)&&_0x56f8ee===_0x289844(0x216)&&!this[_0x289844(0x1de)][_0x289844(0x218)][_0x289844(0x21f)]&&!this['layers'][_0x289844(0x1ed)][_0x289844(0x21f)]&&!this['layers'][_0x289844(0x210)][_0x289844(0x21f)]&&!this[_0x289844(0x1de)][_0x289844(0x20a)]['site'])return _0x289844(0x1ec);return _0x289844(0x20c)+_0x4e8703['replace'](/_/g,'-');}if(this[_0x289844(0x1de)][_0x289844(0x218)][_0x4e8703]===_0x56f8ee)return _0x289844(0x218);if(this['layers'][_0x289844(0x1ed)][_0x4e8703]===_0x56f8ee)return'project';if(this[_0x289844(0x1de)][_0x289844(0x210)][_0x4e8703]===_0x56f8ee)return'profile:\x20'+this[_0x289844(0x21d)];if(this[_0x289844(0x1de)][_0x289844(0x20a)][_0x4e8703]===_0x56f8ee)return _0x289844(0x20a);return _0x289844(0x1ec);}[a39_0x146272(0x213)](){const _0xd6dea5=a39_0x146272,_0x3a645c=a39_0x45cf38[_0xd6dea5(0x1f6)](getConfigDir(),_0xd6dea5(0x21b));if(!a39_0x14af5d[_0xd6dea5(0x1fe)](_0x3a645c))return{};try{const _0x4c51c9=a39_0x14af5d[_0xd6dea5(0x1fb)](_0x3a645c,_0xd6dea5(0x1eb));return JSON[_0xd6dea5(0x1e1)](_0x4c51c9);}catch{return{};}}['injectIntoOptions'](_0x4d6271){const _0x5bf5f7=a39_0x146272;_0x4d6271[_0x5bf5f7(0x21f)]=this[_0x5bf5f7(0x21f)],!_0x4d6271['database']&&this[_0x5bf5f7(0x1e3)]&&(_0x4d6271['database']=this[_0x5bf5f7(0x1e3)]),!_0x4d6271[_0x5bf5f7(0x1e8)]&&this[_0x5bf5f7(0x1e9)]&&(_0x4d6271[_0x5bf5f7(0x1e8)]=this[_0x5bf5f7(0x1e9)]),!_0x4d6271[_0x5bf5f7(0x214)]&&this[_0x5bf5f7(0x1e2)]&&(_0x4d6271[_0x5bf5f7(0x214)]=this['segment_path']),!_0x4d6271['llmProject']&&this[_0x5bf5f7(0x208)]&&(_0x4d6271[_0x5bf5f7(0x201)]=this[_0x5bf5f7(0x208)]);}['getParameters'](){const _0x2b2c45=a39_0x146272;return[{'key':_0x2b2c45(0x21f),'value':this['site']},{'key':_0x2b2c45(0x1e3),'value':this[_0x2b2c45(0x1e3)]},{'key':_0x2b2c45(0x1e9),'value':this[_0x2b2c45(0x1e9)]},{'key':_0x2b2c45(0x1e2),'value':this[_0x2b2c45(0x1e2)]},{'key':'llm_project','value':this[_0x2b2c45(0x208)]},{'key':_0x2b2c45(0x210),'value':this[_0x2b2c45(0x21d)]||undefined}];}[a39_0x146272(0x1fc)](){const _0x914f87=a39_0x146272;console[_0x914f87(0x21c)]('[context]');for(const {key:_0x2233ae,value:_0xc8704e}of this[_0x914f87(0x204)]()){_0xc8704e&&console[_0x914f87(0x21c)](_0x2233ae+':\x20'+_0xc8704e);}}[a39_0x146272(0x205)](){const _0x1ab8b5=a39_0x146272;console['log'](_0x1ab8b5(0x20e));for(const {key:_0x3a99fc,value:_0x21b55c}of this[_0x1ab8b5(0x204)]()){if(_0x21b55c){const _0x581ed=_0x3a99fc===_0x1ab8b5(0x210)?'(active)':'('+this['getSource'](_0x3a99fc,_0x21b55c)+')';console[_0x1ab8b5(0x21c)](_0x3a99fc+':\x20'+_0x21b55c+'\x20'+_0x581ed);}}console[_0x1ab8b5(0x21c)]('\x0a[configuration\x20files]');const _0x293fd7=[{'label':_0x1ab8b5(0x1e5),'path':this['configFiles'][_0x1ab8b5(0x218)],'extra':_0x1ab8b5(0x207)+this[_0x1ab8b5(0x1df)]+')'},{'label':'Project','path':this[_0x1ab8b5(0x1ea)][_0x1ab8b5(0x1ed)]},{'label':_0x1ab8b5(0x1ff),'path':this[_0x1ab8b5(0x1ea)][_0x1ab8b5(0x210)]},{'label':_0x1ab8b5(0x203),'path':this['configFiles'][_0x1ab8b5(0x215)]},{'label':_0x1ab8b5(0x1e0),'path':this[_0x1ab8b5(0x1ea)][_0x1ab8b5(0x20a)]},{'label':_0x1ab8b5(0x1f5),'path':this[_0x1ab8b5(0x1ea)][_0x1ab8b5(0x1f7)]}];for(const {label:_0x5c3d29,path:_0x3c661c,extra:_0x4491cd}of _0x293fd7){if(_0x3c661c)console[_0x1ab8b5(0x21c)](_0x5c3d29+':\x20'+_0x3c661c+'\x20✓'+(_0x4491cd?'\x20'+_0x4491cd:''));else{if(_0x5c3d29===_0x1ab8b5(0x1e5))console[_0x1ab8b5(0x21c)](_0x5c3d29+_0x1ab8b5(0x20f)+this[_0x1ab8b5(0x1df)]+')');else(_0x5c3d29===_0x1ab8b5(0x219)||_0x5c3d29===_0x1ab8b5(0x1e0))&&console[_0x1ab8b5(0x21c)](_0x5c3d29+_0x1ab8b5(0x1e7));}}}async[a39_0x146272(0x1e6)](){const _0x10690f=a39_0x146272;return this[_0x10690f(0x1e4)]=await getAPIKeyAsync(this[_0x10690f(0x21f)],this['activeProfile']||undefined),this['apiKey'];}static async[a39_0x146272(0x1f2)](_0x1a9d60){const _0x1f511e=new GlobalContext(_0x1a9d60);return await _0x1f511e['resolveAPIKeyAsync'](),_0x1f511e;}}
1
+ const a39_0x2ebea7=a39_0x68d0;(function(_0x3d9ccd,_0x29bfe0){const _0x14ea8a=a39_0x68d0,_0x45829e=_0x3d9ccd();while(!![]){try{const _0x374f19=parseInt(_0x14ea8a(0xac))/0x1*(-parseInt(_0x14ea8a(0x80))/0x2)+parseInt(_0x14ea8a(0xab))/0x3+-parseInt(_0x14ea8a(0x9b))/0x4*(parseInt(_0x14ea8a(0x7f))/0x5)+-parseInt(_0x14ea8a(0xba))/0x6+parseInt(_0x14ea8a(0x98))/0x7+parseInt(_0x14ea8a(0x7e))/0x8+-parseInt(_0x14ea8a(0x91))/0x9;if(_0x374f19===_0x29bfe0)break;else _0x45829e['push'](_0x45829e['shift']());}catch(_0x2558c6){_0x45829e['push'](_0x45829e['shift']());}}}(a39_0x3010,0xbe8ec));function a39_0x68d0(_0x10d61,_0x39c891){const _0x3010a8=a39_0x3010();return a39_0x68d0=function(_0x68d043,_0x20f592){_0x68d043=_0x68d043-0x7c;let _0x500235=_0x3010a8[_0x68d043];return _0x500235;},a39_0x68d0(_0x10d61,_0x39c891);}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';function a39_0x3010(){const _0x215a80=['configFiles','config','replace','apiKey','log','12176952UmDpJp','2850VqeJlm','1398AWvRwj','llm_project','default','(active)','Project','segment_path','profiles','sessionId','Profile','displayWithSources','createAsync','profileCredentials','getSource','Session','activeProfile','global','parentSegment','552636posScF','session','layers','existsSync','getParameters','Global','sessions','5643134XRMklc','profile:\x20','Global\x20Credentials','9444BIdGQT','INFO','us01','parent_segment','\x0a[configuration\x20files]','(session:\x20','globalCredentials','.env','site','.json','profile','parse','[context]','database','logLevel','string','1681767vqyrbw','936huEklN','tdx.json','utf-8','CLI\x20flag:\x20--','loadGlobalConfig','join','llmProject','Profile\x20Credentials',':\x20none','display','resolveAPIKeyAsync','verbose','project','entries','281448YAXmKk','cliFlags','injectIntoOptions'];a39_0x3010=function(){return _0x215a80;};return a39_0x3010();}import{LogLevel}from'../utils/tdx-logger.js';import*as a39_0x3157e1 from'node:fs';import*as a39_0x51daee from'node:path';export class GlobalContext{[a39_0x2ebea7(0xa3)];[a39_0x2ebea7(0xa8)];[a39_0x2ebea7(0x9e)];[a39_0x2ebea7(0x85)];[a39_0x2ebea7(0x81)];[a39_0x2ebea7(0x7c)];[a39_0x2ebea7(0xb7)];[a39_0x2ebea7(0xa9)];['layers'];[a39_0x2ebea7(0x8e)];[a39_0x2ebea7(0x87)];[a39_0x2ebea7(0xbd)];constructor(_0x174305){const _0x13eb0=a39_0x2ebea7;this[_0x13eb0(0x87)]=_0x174305['session']||getCurrentSessionPID()['toString']();const _0x46bce2=loadSessionContext(_0x174305[_0x13eb0(0x92)]),_0x1e17cb=loadProjectConfig(),_0x589e0d=this[_0x13eb0(0xb0)]();this['activeProfile']=_0x174305['profile']||_0x46bce2?.[_0x13eb0(0xa5)]||_0x589e0d[_0x13eb0(0xa5)]||getActiveProfile();const _0x3f242b=this['activeProfile']?loadProfile(this[_0x13eb0(0x8e)]):null,_0x2518c7=_0x284872=>{const _0x326249=_0x13eb0;if(!_0x284872)return{};const _0xf13d12=_0x284872,_0x549797={};for(const [_0x97c790,_0x5c4d65]of Object[_0x326249(0xb9)](_0xf13d12)){typeof _0x5c4d65===_0x326249(0xaa)&&(_0x549797[_0x97c790]=_0x5c4d65);}return _0x549797;},_0x563723={};if(_0x174305['site']&&_0x174305[_0x13eb0(0xa3)]!==_0x13eb0(0x9d))_0x563723[_0x13eb0(0xa3)]=_0x174305[_0x13eb0(0xa3)];const _0x5cd4f4=_0x46bce2?.[_0x13eb0(0xa8)],_0x2b5631=_0x1e17cb?.[_0x13eb0(0xa8)],_0x166ef2=_0x3f242b?.[_0x13eb0(0xbe)]?.[_0x13eb0(0xa8)],_0x22f1a3=_0x589e0d[_0x13eb0(0xa8)];_0x174305[_0x13eb0(0xa8)]&&(_0x174305[_0x13eb0(0xa8)]!==_0x5cd4f4&&_0x174305[_0x13eb0(0xa8)]!==_0x2b5631&&_0x174305[_0x13eb0(0xa8)]!==_0x166ef2&&_0x174305['database']!==_0x22f1a3)&&(_0x563723[_0x13eb0(0xa8)]=_0x174305[_0x13eb0(0xa8)]);if(_0x174305['parentSegment'])_0x563723[_0x13eb0(0x9e)]=_0x174305[_0x13eb0(0x90)];if(_0x174305[_0x13eb0(0xb2)])_0x563723[_0x13eb0(0x81)]=_0x174305[_0x13eb0(0xb2)];if(_0x174305['profile'])_0x563723[_0x13eb0(0xa5)]=_0x174305['profile'];this[_0x13eb0(0x93)]={'cliFlags':_0x563723,'session':_0x2518c7(_0x46bce2),'project':_0x2518c7(_0x1e17cb),'profile':_0x2518c7(_0x3f242b?.[_0x13eb0(0xbe)]),'global':_0x2518c7(_0x589e0d)};const _0x588c41={...this[_0x13eb0(0x93)][_0x13eb0(0x8f)],...this[_0x13eb0(0x93)]['profile'],...this[_0x13eb0(0x93)][_0x13eb0(0xb8)],...this['layers'][_0x13eb0(0x92)],...this[_0x13eb0(0x93)][_0x13eb0(0xbb)]},_0x50a339=_0x588c41['site']||_0x13eb0(0x9d);this['site']=resolveSite(_0x50a339),this[_0x13eb0(0xa8)]=_0x588c41[_0x13eb0(0xa8)],this['parent_segment']=_0x588c41['parent_segment'],this[_0x13eb0(0x85)]=_0x588c41['segment_path'],this[_0x13eb0(0x81)]=_0x588c41[_0x13eb0(0x81)],this['verbose']=_0x174305[_0x13eb0(0xb7)]||![],this[_0x13eb0(0xa9)]=_0x174305[_0x13eb0(0xa9)]??LogLevel[_0x13eb0(0x9c)],this[_0x13eb0(0x7c)]=getAPIKey(this[_0x13eb0(0xa3)],this[_0x13eb0(0x8e)]||undefined);const _0x3280c8=getConfigDir(),_0x15e5dc=a39_0x51daee[_0x13eb0(0xb1)](_0x3280c8,_0x13eb0(0x97),this['sessionId']+_0x13eb0(0xa4)),_0x13f34d=findProjectConfigPath(),_0x10c17c=a39_0x51daee[_0x13eb0(0xb1)](_0x3280c8,'tdx.json'),_0x85ae92=a39_0x51daee[_0x13eb0(0xb1)](_0x3280c8,_0x13eb0(0xa2));let _0x59ade5=null,_0x326217=null;this[_0x13eb0(0x8e)]&&(_0x59ade5=a39_0x51daee[_0x13eb0(0xb1)](_0x3280c8,_0x13eb0(0x86),this[_0x13eb0(0x8e)],_0x13eb0(0xad)),_0x326217=a39_0x51daee[_0x13eb0(0xb1)](_0x3280c8,_0x13eb0(0x86),this[_0x13eb0(0x8e)],_0x13eb0(0xa2))),this[_0x13eb0(0xbd)]={'session':a39_0x3157e1[_0x13eb0(0x94)](_0x15e5dc)?_0x15e5dc:null,'project':_0x13f34d,'profile':_0x59ade5&&a39_0x3157e1[_0x13eb0(0x94)](_0x59ade5)?_0x59ade5:null,'profileCredentials':_0x326217&&a39_0x3157e1[_0x13eb0(0x94)](_0x326217)?_0x326217:null,'global':a39_0x3157e1[_0x13eb0(0x94)](_0x10c17c)?_0x10c17c:null,'globalCredentials':a39_0x3157e1[_0x13eb0(0x94)](_0x85ae92)?_0x85ae92:null};}['getSource'](_0x3ca614,_0x2061aa){const _0x344ba4=a39_0x2ebea7;if(!_0x2061aa)return'not\x20set';const _0x378ef4=_0x2061aa;if(this['layers'][_0x344ba4(0xbb)][_0x3ca614]===_0x378ef4){if(_0x3ca614===_0x344ba4(0xa3)&&_0x378ef4===_0x344ba4(0x9d)&&!this[_0x344ba4(0x93)]['session'][_0x344ba4(0xa3)]&&!this[_0x344ba4(0x93)][_0x344ba4(0xb8)][_0x344ba4(0xa3)]&&!this['layers'][_0x344ba4(0xa5)]['site']&&!this[_0x344ba4(0x93)][_0x344ba4(0x8f)][_0x344ba4(0xa3)])return _0x344ba4(0x82);return _0x344ba4(0xaf)+_0x3ca614[_0x344ba4(0xbf)](/_/g,'-');}if(this[_0x344ba4(0x93)][_0x344ba4(0x92)][_0x3ca614]===_0x378ef4)return _0x344ba4(0x92);if(this['layers'][_0x344ba4(0xb8)][_0x3ca614]===_0x378ef4)return _0x344ba4(0xb8);if(this[_0x344ba4(0x93)][_0x344ba4(0xa5)][_0x3ca614]===_0x378ef4)return _0x344ba4(0x99)+this['activeProfile'];if(this['layers'][_0x344ba4(0x8f)][_0x3ca614]===_0x378ef4)return'global';return'default';}[a39_0x2ebea7(0xb0)](){const _0x49d23d=a39_0x2ebea7,_0x4e6799=a39_0x51daee[_0x49d23d(0xb1)](getConfigDir(),_0x49d23d(0xad));if(!a39_0x3157e1[_0x49d23d(0x94)](_0x4e6799))return{};try{const _0x2f45b0=a39_0x3157e1['readFileSync'](_0x4e6799,_0x49d23d(0xae));return JSON[_0x49d23d(0xa6)](_0x2f45b0);}catch{return{};}}[a39_0x2ebea7(0xbc)](_0x4e6be3){const _0xabc497=a39_0x2ebea7;_0x4e6be3[_0xabc497(0xa3)]=this[_0xabc497(0xa3)],!_0x4e6be3[_0xabc497(0xa8)]&&this['database']&&(_0x4e6be3['database']=this[_0xabc497(0xa8)]),!_0x4e6be3[_0xabc497(0x90)]&&this['parent_segment']&&(_0x4e6be3['parentSegment']=this['parent_segment']),!_0x4e6be3['segmentPath']&&this[_0xabc497(0x85)]&&(_0x4e6be3['segmentPath']=this[_0xabc497(0x85)]),!_0x4e6be3['llmProject']&&this[_0xabc497(0x81)]&&(_0x4e6be3[_0xabc497(0xb2)]=this[_0xabc497(0x81)]);}[a39_0x2ebea7(0x95)](){const _0x5db549=a39_0x2ebea7;return[{'key':_0x5db549(0xa3),'value':this['site']},{'key':_0x5db549(0xa8),'value':this['database']},{'key':_0x5db549(0x9e),'value':this[_0x5db549(0x9e)]},{'key':_0x5db549(0x85),'value':this[_0x5db549(0x85)]},{'key':_0x5db549(0x81),'value':this['llm_project']},{'key':_0x5db549(0xa5),'value':this[_0x5db549(0x8e)]||undefined}];}[a39_0x2ebea7(0xb5)](){const _0x3f3ad2=a39_0x2ebea7;console['log'](_0x3f3ad2(0xa7));for(const {key:_0x476748,value:_0xb436cb}of this[_0x3f3ad2(0x95)]()){_0xb436cb&&console[_0x3f3ad2(0x7d)](_0x476748+':\x20'+_0xb436cb);}}[a39_0x2ebea7(0x89)](){const _0x27139f=a39_0x2ebea7;console[_0x27139f(0x7d)](_0x27139f(0xa7));for(const {key:_0x639bf1,value:_0x5f5cf9}of this[_0x27139f(0x95)]()){if(_0x5f5cf9){const _0x527f6b=_0x639bf1==='profile'?_0x27139f(0x83):'('+this[_0x27139f(0x8c)](_0x639bf1,_0x5f5cf9)+')';console[_0x27139f(0x7d)](_0x639bf1+':\x20'+_0x5f5cf9+'\x20'+_0x527f6b);}}console['log'](_0x27139f(0x9f));const _0x32c956=[{'label':_0x27139f(0x8d),'path':this[_0x27139f(0xbd)]['session'],'extra':_0x27139f(0xa0)+this[_0x27139f(0x87)]+')'},{'label':'Project','path':this[_0x27139f(0xbd)][_0x27139f(0xb8)]},{'label':_0x27139f(0x88),'path':this[_0x27139f(0xbd)][_0x27139f(0xa5)]},{'label':_0x27139f(0xb3),'path':this[_0x27139f(0xbd)][_0x27139f(0x8b)]},{'label':_0x27139f(0x96),'path':this['configFiles'][_0x27139f(0x8f)]},{'label':_0x27139f(0x9a),'path':this[_0x27139f(0xbd)][_0x27139f(0xa1)]}];for(const {label:_0x3858a6,path:_0x2c1c16,extra:_0x20a535}of _0x32c956){if(_0x2c1c16)console[_0x27139f(0x7d)](_0x3858a6+':\x20'+_0x2c1c16+'\x20✓'+(_0x20a535?'\x20'+_0x20a535:''));else{if(_0x3858a6===_0x27139f(0x8d))console['log'](_0x3858a6+':\x20none\x20(using\x20session:\x20'+this['sessionId']+')');else(_0x3858a6===_0x27139f(0x84)||_0x3858a6===_0x27139f(0x96))&&console['log'](_0x3858a6+_0x27139f(0xb4));}}}async['resolveAPIKeyAsync'](){const _0x3f83aa=a39_0x2ebea7;return this[_0x3f83aa(0x7c)]=await getAPIKeyAsync(this[_0x3f83aa(0xa3)],this[_0x3f83aa(0x8e)]||undefined),this['apiKey'];}static async[a39_0x2ebea7(0x8a)](_0x28d8c8){const _0xa400a7=a39_0x2ebea7,_0x128132=new GlobalContext(_0x28d8c8);return await _0x128132[_0xa400a7(0xb6)](),_0x128132;}}
@@ -1 +1 @@
1
- (function(_0x36dcc8,_0xf61cd6){const _0x51fc8b=a40_0x4136,_0x20a2e0=_0x36dcc8();while(!![]){try{const _0x4883e5=parseInt(_0x51fc8b(0x1eb))/0x1+parseInt(_0x51fc8b(0x1f5))/0x2+-parseInt(_0x51fc8b(0x1f1))/0x3*(-parseInt(_0x51fc8b(0x1ea))/0x4)+-parseInt(_0x51fc8b(0x1f3))/0x5*(parseInt(_0x51fc8b(0x1e2))/0x6)+parseInt(_0x51fc8b(0x1fc))/0x7+parseInt(_0x51fc8b(0x1f9))/0x8*(-parseInt(_0x51fc8b(0x1da))/0x9)+-parseInt(_0x51fc8b(0x1ef))/0xa;if(_0x4883e5===_0xf61cd6)break;else _0x20a2e0['push'](_0x20a2e0['shift']());}catch(_0x350e9b){_0x20a2e0['push'](_0x20a2e0['shift']());}}}(a40_0x3a73,0x21cd9));const SERVICE_NAME='tdx';let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x16439e=a40_0x4136;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x1bcf41=await import(_0x16439e(0x1ee));return keyringModule=_0x1bcf41['keyring'],keyringModule;}catch(_0x228d8a){return keyringLoadError=_0x228d8a instanceof Error?_0x228d8a:new Error(String(_0x228d8a)),null;}}function a40_0x4136(_0x329a78,_0x5d343d){const _0x3a73ac=a40_0x3a73();return a40_0x4136=function(_0x41363b,_0xa36cec){_0x41363b=_0x41363b-0x1da;let _0x168a69=_0x3a73ac[_0x41363b];return _0x168a69;},a40_0x4136(_0x329a78,_0x5d343d);}function getAccountName(_0x4c7850){const _0x44c1ae=a40_0x4136,_0x2c1cc3=_0x4c7850||'';return'profile:'+_0x2c1cc3+_0x44c1ae(0x1db);}export async function getKeychainAPIKey(_0xa637a4){const _0x587d4b=a40_0x4136,_0x150512=await getKeychainAPIKeyWithStatus(_0xa637a4);if(_0x150512[_0x587d4b(0x1f8)])return _0x150512['value'];return _0x150512[_0x587d4b(0x1f7)]===_0x587d4b(0x1e0)&&console[_0x587d4b(0x1e4)](_0x587d4b(0x1e5)+_0x150512['message']),null;}export async function getKeychainAPIKeyWithStatus(_0x15a8e9){const _0xcf5958=a40_0x4136;try{const _0x47a48a=await getKeyring();if(!_0x47a48a)return{'success':![],'reason':_0xcf5958(0x1e8)};const _0x4228af=getAccountName(_0x15a8e9),_0x458191=await _0x47a48a[_0xcf5958(0x1fa)](SERVICE_NAME,_0x4228af);if(_0x458191)return{'success':!![],'value':_0x458191};return{'success':![],'reason':_0xcf5958(0x1dd)};}catch(_0x2400ca){const _0x43e203=_0x2400ca instanceof Error?_0x2400ca[_0xcf5958(0x1ec)]:String(_0x2400ca);if(_0x43e203['includes'](_0xcf5958(0x1df))||_0x43e203[_0xcf5958(0x1f2)]()[_0xcf5958(0x1fd)](_0xcf5958(0x1f6))||_0x43e203[_0xcf5958(0x1f2)]()[_0xcf5958(0x1fd)](_0xcf5958(0x1e1)))return{'success':![],'reason':_0xcf5958(0x1dd)};if(_0x43e203[_0xcf5958(0x1fd)](_0xcf5958(0x1f0))||_0x43e203['toLowerCase']()[_0xcf5958(0x1fd)](_0xcf5958(0x1fb))||_0x43e203['toLowerCase']()[_0xcf5958(0x1fd)](_0xcf5958(0x1e7)))return{'success':![],'reason':_0xcf5958(0x1e0),'message':_0xcf5958(0x1f4)};return{'success':![],'reason':_0xcf5958(0x1e8),'message':_0x43e203};}}function a40_0x3a73(){const _0x2377ae=['deletePassword','348CmJLXU','3990pNmPij','message','cannot\x20find','@zowe/secrets-for-zowe-sdk','2057740QPsPPp','-25293','9249TxpNOY','toLowerCase','27605EhUHZt','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.','145150ADcswI','could\x20not\x20be\x20found','reason','success','899040CefddA','getPassword','restricted','1748950zRDIyj','includes','9DkLYjM',':api_key','System\x20keychain\x20is\x20not\x20available','not_found','setPassword','-25300','access_denied','not\x20found','150ENQKBC','__keychain_test__','error','Warning:\x20','not\x20supported','access','unavailable'];a40_0x3a73=function(){return _0x2377ae;};return a40_0x3a73();}export async function saveKeychainAPIKey(_0xdee6ea,_0x16016e){const _0xddda5b=a40_0x4136,_0x34aaab=await getKeyring();if(!_0x34aaab)throw new Error(_0xddda5b(0x1dc));const _0x3af86b=getAccountName(_0x16016e);await _0x34aaab[_0xddda5b(0x1de)](SERVICE_NAME,_0x3af86b,_0xdee6ea);}export async function deleteKeychainAPIKey(_0x5d861c){const _0x397ccb=a40_0x4136;try{const _0x4c103a=await getKeyring();if(!_0x4c103a)return![];const _0x44660d=getAccountName(_0x5d861c);return await _0x4c103a[_0x397ccb(0x1e9)](SERVICE_NAME,_0x44660d);}catch{return![];}}export async function isKeychainAvailable(){const _0x182ce8=a40_0x4136;try{const _0x2b7451=await getKeyring();if(!_0x2b7451)return![];return await _0x2b7451[_0x182ce8(0x1fa)](SERVICE_NAME,_0x182ce8(0x1e3)),!![];}catch(_0x2a338f){const _0x4b8186=_0x2a338f instanceof Error?_0x2a338f['message'][_0x182ce8(0x1f2)]():'';if(_0x4b8186[_0x182ce8(0x1fd)]('not\x20available')||_0x4b8186[_0x182ce8(0x1fd)](_0x182ce8(0x1e6))||_0x4b8186[_0x182ce8(0x1fd)](_0x182ce8(0x1ed)))return![];return!![];}}
1
+ (function(_0x1d7614,_0x2ae9f7){const _0x559739=a40_0x3e44,_0x4d47f7=_0x1d7614();while(!![]){try{const _0x1eefae=-parseInt(_0x559739(0xa0))/0x1*(parseInt(_0x559739(0x93))/0x2)+-parseInt(_0x559739(0x8a))/0x3*(-parseInt(_0x559739(0x96))/0x4)+-parseInt(_0x559739(0x99))/0x5*(-parseInt(_0x559739(0xa5))/0x6)+parseInt(_0x559739(0x8c))/0x7*(-parseInt(_0x559739(0x95))/0x8)+parseInt(_0x559739(0x8b))/0x9*(-parseInt(_0x559739(0x9b))/0xa)+parseInt(_0x559739(0x84))/0xb*(-parseInt(_0x559739(0x85))/0xc)+parseInt(_0x559739(0x9a))/0xd;if(_0x1eefae===_0x2ae9f7)break;else _0x4d47f7['push'](_0x4d47f7['shift']());}catch(_0x1eb5c4){_0x4d47f7['push'](_0x4d47f7['shift']());}}}(a40_0x31d0,0xe2634));const SERVICE_NAME='tdx';let keyringModule=null,keyringLoadError=null;function a40_0x31d0(){const _0x143a44=['includes','not\x20found','deletePassword','1595764YdSpLH','not_found','16VEETUe','113996dnHzcl','success','could\x20not\x20be\x20found','5HHrTCo','34203377hJezcc','1370NPlghk','Warning:\x20','getPassword','System\x20keychain\x20is\x20not\x20available','@zowe/secrets-for-zowe-sdk','1qImzBp','message','keyring','toLowerCase','reason','4462422mAIzBi','setPassword','9683531mcBEmW','12LqSHRU','error','restricted','unavailable','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.','87EMDEXC','65268IzfXXZ','2107791BnQXZf','access','not\x20available','-25293'];a40_0x31d0=function(){return _0x143a44;};return a40_0x31d0();}async function getKeyring(){const _0x473165=a40_0x3e44;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x7eee19=await import(_0x473165(0x9f));return keyringModule=_0x7eee19[_0x473165(0xa2)],keyringModule;}catch(_0x5306a4){return keyringLoadError=_0x5306a4 instanceof Error?_0x5306a4:new Error(String(_0x5306a4)),null;}}function getAccountName(_0x123bdd){const _0x1e05e0=_0x123bdd||'';return'profile:'+_0x1e05e0+':api_key';}export async function getKeychainAPIKey(_0x49c59a){const _0x50f9b7=a40_0x3e44,_0x37a7a5=await getKeychainAPIKeyWithStatus(_0x49c59a);if(_0x37a7a5[_0x50f9b7(0x97)])return _0x37a7a5['value'];return _0x37a7a5[_0x50f9b7(0xa4)]==='access_denied'&&console[_0x50f9b7(0x86)](_0x50f9b7(0x9c)+_0x37a7a5['message']),null;}export async function getKeychainAPIKeyWithStatus(_0x4e45aa){const _0x23efa3=a40_0x3e44;try{const _0x4af308=await getKeyring();if(!_0x4af308)return{'success':![],'reason':_0x23efa3(0x88)};const _0x2959d3=getAccountName(_0x4e45aa),_0x40ee0f=await _0x4af308[_0x23efa3(0x9d)](SERVICE_NAME,_0x2959d3);if(_0x40ee0f)return{'success':!![],'value':_0x40ee0f};return{'success':![],'reason':'not_found'};}catch(_0x566abb){const _0x53eed7=_0x566abb instanceof Error?_0x566abb[_0x23efa3(0xa1)]:String(_0x566abb);if(_0x53eed7[_0x23efa3(0x90)]('-25300')||_0x53eed7[_0x23efa3(0xa3)]()[_0x23efa3(0x90)](_0x23efa3(0x98))||_0x53eed7['toLowerCase']()[_0x23efa3(0x90)](_0x23efa3(0x91)))return{'success':![],'reason':_0x23efa3(0x94)};if(_0x53eed7[_0x23efa3(0x90)](_0x23efa3(0x8f))||_0x53eed7[_0x23efa3(0xa3)]()[_0x23efa3(0x90)](_0x23efa3(0x87))||_0x53eed7[_0x23efa3(0xa3)]()['includes'](_0x23efa3(0x8d)))return{'success':![],'reason':'access_denied','message':_0x23efa3(0x89)};return{'success':![],'reason':_0x23efa3(0x88),'message':_0x53eed7};}}export async function saveKeychainAPIKey(_0x5a758b,_0x186d89){const _0x159ae2=a40_0x3e44,_0x36b22f=await getKeyring();if(!_0x36b22f)throw new Error(_0x159ae2(0x9e));const _0x519042=getAccountName(_0x186d89);await _0x36b22f[_0x159ae2(0x83)](SERVICE_NAME,_0x519042,_0x5a758b);}export async function deleteKeychainAPIKey(_0x3dc48e){const _0x487522=a40_0x3e44;try{const _0x3c6bb8=await getKeyring();if(!_0x3c6bb8)return![];const _0x819db5=getAccountName(_0x3dc48e);return await _0x3c6bb8[_0x487522(0x92)](SERVICE_NAME,_0x819db5);}catch{return![];}}function a40_0x3e44(_0x3ad081,_0xfdac84){const _0x31d04c=a40_0x31d0();return a40_0x3e44=function(_0x3e4498,_0x25943b){_0x3e4498=_0x3e4498-0x83;let _0x3e070e=_0x31d04c[_0x3e4498];return _0x3e070e;},a40_0x3e44(_0x3ad081,_0xfdac84);}export async function isKeychainAvailable(){const _0x12e111=a40_0x3e44;try{const _0x2a06d7=await getKeyring();if(!_0x2a06d7)return![];return await _0x2a06d7[_0x12e111(0x9d)](SERVICE_NAME,'__keychain_test__'),!![];}catch(_0x3fd950){const _0x1850fa=_0x3fd950 instanceof Error?_0x3fd950[_0x12e111(0xa1)]['toLowerCase']():'';if(_0x1850fa[_0x12e111(0x90)](_0x12e111(0x8e))||_0x1850fa[_0x12e111(0x90)]('not\x20supported')||_0x1850fa[_0x12e111(0x90)]('cannot\x20find'))return![];return!![];}}
@@ -1 +1 @@
1
- (function(_0x57fb18,_0x25f1a5){const _0x3f8831=a41_0xedb7,_0x589303=_0x57fb18();while(!![]){try{const _0x281b5b=-parseInt(_0x3f8831(0x178))/0x1+parseInt(_0x3f8831(0x18c))/0x2*(-parseInt(_0x3f8831(0x181))/0x3)+-parseInt(_0x3f8831(0x187))/0x4*(-parseInt(_0x3f8831(0x189))/0x5)+-parseInt(_0x3f8831(0x18f))/0x6+parseInt(_0x3f8831(0x14e))/0x7*(parseInt(_0x3f8831(0x166))/0x8)+parseInt(_0x3f8831(0x16f))/0x9+parseInt(_0x3f8831(0x17d))/0xa;if(_0x281b5b===_0x25f1a5)break;else _0x589303['push'](_0x589303['shift']());}catch(_0x499b6b){_0x589303['push'](_0x589303['shift']());}}}(a41_0x4df9,0x86028));import*as a41_0x337097 from'node:fs';import*as a41_0x20d1e7 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';export function getProfileParams(_0x4a4c40){const _0x643f92=a41_0xedb7,_0x4308d2={};if(!_0x4a4c40)return _0x4308d2;for(const [_0x5631d0,_0x31380f]of Object[_0x643f92(0x151)](_0x4a4c40)){_0x5631d0!==_0x643f92(0x165)&&_0x31380f!==undefined&&(_0x4308d2[_0x5631d0]=_0x31380f);}return _0x4308d2;}export function getProfilesDir(){const _0x3bbf76=a41_0xedb7;return a41_0x20d1e7[_0x3bbf76(0x167)](getConfigDir(),_0x3bbf76(0x18e));}function getProfileDir(_0x780944){return a41_0x20d1e7['join'](getProfilesDir(),_0x780944);}function getProfileConfigPath(_0x3ff1a5){const _0x30e54d=a41_0xedb7;return a41_0x20d1e7[_0x30e54d(0x167)](getProfileDir(_0x3ff1a5),_0x30e54d(0x14d));}function getProfileEnvPath(_0x1f68fa){return a41_0x20d1e7['join'](getProfileDir(_0x1f68fa),'.env');}function a41_0xedb7(_0x20ab63,_0x3da38c){const _0x4df99a=a41_0x4df9();return a41_0xedb7=function(_0xedb7a,_0x2fa30e){_0xedb7a=_0xedb7a-0x14c;let _0x5f42fc=_0x4df99a[_0xedb7a];return _0x5f42fc;},a41_0xedb7(_0x20ab63,_0x3da38c);}function getGlobalConfigPath(){const _0x5fb77c=a41_0xedb7;return a41_0x20d1e7[_0x5fb77c(0x167)](getConfigDir(),'tdx.json');}function validateProfileName(_0x573523){const _0x5a46a9=a41_0xedb7;if(!/^[a-zA-Z0-9_-]+$/[_0x5a46a9(0x15b)](_0x573523))throw new Error(_0x5a46a9(0x153)+_0x573523+_0x5a46a9(0x16a));}function validateProfileConfig(_0x488316,_0x7f91ed){const _0x4e6e6f=a41_0xedb7;if(typeof _0x488316!==_0x4e6e6f(0x188)||_0x488316===null)throw new Error(_0x4e6e6f(0x157)+_0x7f91ed+_0x4e6e6f(0x186));const _0x5c5b5e=['description',_0x4e6e6f(0x150),_0x4e6e6f(0x16b),_0x4e6e6f(0x168),_0x4e6e6f(0x192),'llm_agent'],_0x2572d5=_0x488316;for(const _0x2fb67f of Object[_0x4e6e6f(0x14c)](_0x2572d5)){!_0x5c5b5e[_0x4e6e6f(0x17f)](_0x2fb67f)&&console[_0x4e6e6f(0x17b)](_0x4e6e6f(0x15d)+_0x7f91ed+_0x4e6e6f(0x176)+_0x2fb67f+'\x27\x20will\x20be\x20ignored');}if(_0x2572d5[_0x4e6e6f(0x165)]!==undefined&&typeof _0x2572d5[_0x4e6e6f(0x165)]!==_0x4e6e6f(0x159))throw new Error(_0x4e6e6f(0x157)+_0x7f91ed+_0x4e6e6f(0x16d));if(_0x2572d5[_0x4e6e6f(0x150)]!==undefined&&typeof _0x2572d5['site']!=='string')throw new Error(_0x4e6e6f(0x157)+_0x7f91ed+_0x4e6e6f(0x15f));if(_0x2572d5[_0x4e6e6f(0x16b)]!==undefined&&typeof _0x2572d5[_0x4e6e6f(0x16b)]!==_0x4e6e6f(0x159))throw new Error(_0x4e6e6f(0x157)+_0x7f91ed+_0x4e6e6f(0x170));if(_0x2572d5[_0x4e6e6f(0x168)]!==undefined&&typeof _0x2572d5[_0x4e6e6f(0x168)]!=='string')throw new Error(_0x4e6e6f(0x157)+_0x7f91ed+_0x4e6e6f(0x15c));if(_0x2572d5[_0x4e6e6f(0x192)]!==undefined&&typeof _0x2572d5[_0x4e6e6f(0x192)]!==_0x4e6e6f(0x159))throw new Error('Profile\x20\x27'+_0x7f91ed+_0x4e6e6f(0x158));if(_0x2572d5[_0x4e6e6f(0x18d)]!==undefined&&typeof _0x2572d5['llm_agent']!==_0x4e6e6f(0x159))throw new Error(_0x4e6e6f(0x157)+_0x7f91ed+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x7b63d2,_0x452d3b){const _0x425b22=a41_0xedb7;if(!a41_0x337097['existsSync'](_0x7b63d2))return[];try{const _0x4d3432=a41_0x337097[_0x425b22(0x164)](_0x7b63d2,'utf-8'),_0xb13111=JSON[_0x425b22(0x154)](_0x4d3432);if(!_0xb13111[_0x425b22(0x18e)]||typeof _0xb13111['profiles']!=='object')return[];const _0x44c210=[];for(const [_0x1e1f66,_0x320c50]of Object['entries'](_0xb13111[_0x425b22(0x18e)])){try{validateProfileConfig(_0x320c50,_0x1e1f66);const _0x38964d=getNewCredentialPath(_0x1e1f66),_0x146260=getOldCredentialPath(_0x1e1f66),_0x1b59d0=a41_0x337097[_0x425b22(0x177)](_0x38964d)||a41_0x337097[_0x425b22(0x177)](_0x146260);_0x44c210[_0x425b22(0x156)]({'name':_0x1e1f66,'config':_0x320c50,'metadata':{'name':_0x1e1f66,'createdAt':new Date()[_0x425b22(0x175)]()},'hasCredentials':_0x1b59d0,'scope':_0x452d3b});}catch(_0xebf037){_0xebf037 instanceof Error&&(console[_0x425b22(0x17b)](_0x425b22(0x193)+_0x7b63d2+':'),console[_0x425b22(0x17b)]('\x20\x20'+_0xebf037[_0x425b22(0x17c)]+'\x0a'));}}return _0x44c210;}catch(_0x2f787e){return _0x2f787e instanceof SyntaxError?(console['warn'](_0x425b22(0x18a)+_0x7b63d2+_0x425b22(0x184)),console[_0x425b22(0x17b)]('Error:\x20'+_0x2f787e['message']+'\x0a')):console[_0x425b22(0x17b)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x7b63d2+':\x20'+_0x2f787e+'\x0a'),[];}}function a41_0x4df9(){const _0x44deb9=['warn','message','16354950LQXaAU','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','includes','profile','1988586UpesxK','user','from',':\x20Invalid\x20JSON\x20syntax','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','\x27:\x20config\x20must\x20be\x20an\x20object','893732hyqoRv','object','5SrdOHO','\x0aWarning:\x20Failed\x20to\x20parse\x20','To\x20migrate:','2VeYYsV','llm_agent','profiles','3109476kbIUQd','directory','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','llm_project','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','name','keys','tdx.json','727405xJmIrW','.env.','site','entries','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','Invalid\x20profile\x20name:\x20','parse','\x20does\x20not\x20exist','push','Profile\x20\x27','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','string','\x20\x20mv\x20\x22','test','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','Warning:\x20Profile\x20\x27','local','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','sort','Warning:\x20Failed\x20to\x20parse\x20','has','map','readFileSync','description','24PmKChi','join','parent_segment','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','database','utf-8','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','find','3190662asnqzV','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string',',\x20creating\x20new\x20file','filter','Profile\x20','localeCompare','toISOString','\x27:\x20unknown\x20config\x20key\x20\x27','existsSync','795179IAumPd','.env','readdirSync'];a41_0x4df9=function(){return _0x44deb9;};return a41_0x4df9();}export function getNewCredentialPath(_0x4073fb){const _0x34dac8=a41_0xedb7;return a41_0x20d1e7['join'](getConfigDir(),_0x34dac8(0x14f)+_0x4073fb);}function getOldCredentialPath(_0x47a031){const _0x4ccad6=a41_0xedb7;return a41_0x20d1e7[_0x4ccad6(0x167)](getProfilesDir(),_0x47a031,_0x4ccad6(0x179));}function loadProfilesFromTdxJsonFiles(){const _0x2f427a=a41_0xedb7,_0xf5632a=[],_0x49c6eb=findProjectConfigPath();_0x49c6eb&&_0xf5632a[_0x2f427a(0x156)](...loadProfilesFromTdxJson(_0x49c6eb,_0x2f427a(0x15e)));const _0x55b073=a41_0x20d1e7[_0x2f427a(0x167)](getConfigDir(),_0x2f427a(0x14d));return _0xf5632a[_0x2f427a(0x156)](...loadProfilesFromTdxJson(_0x55b073,_0x2f427a(0x182))),_0xf5632a;}function loadProfilesFromDirectories(){const _0x55eb23=a41_0xedb7,_0x40c4f3=getProfilesDir();if(!a41_0x337097[_0x55eb23(0x177)](_0x40c4f3))return[];try{return a41_0x337097[_0x55eb23(0x17a)](_0x40c4f3,{'withFileTypes':!![]})['filter'](_0x2fcd86=>_0x2fcd86['isDirectory']())['map'](_0x497cef=>_0x497cef['name'])[_0x55eb23(0x172)](_0x1a0568=>{const _0x63fc05=_0x55eb23,_0x510ee0=getProfileConfigPath(_0x1a0568),_0x1158fc=getProfileEnvPath(_0x1a0568);return a41_0x337097[_0x63fc05(0x177)](_0x510ee0)||a41_0x337097[_0x63fc05(0x177)](_0x1158fc);})[_0x55eb23(0x163)](_0x478a17=>{const _0x1685ef=_0x55eb23,_0x5aa671=loadProfileFromDirectory(_0x478a17);if(_0x5aa671)return{..._0x5aa671,'scope':_0x1685ef(0x190)};return null;})[_0x55eb23(0x172)](_0x3fe645=>_0x3fe645!==null);}catch{return[];}}function loadProfileFromDirectory(_0x267747){const _0x42bbc5=a41_0xedb7,_0x43dbf4=getProfileConfigPath(_0x267747),_0xd64880=getOldCredentialPath(_0x267747);if(!a41_0x337097[_0x42bbc5(0x177)](_0x43dbf4)&&!a41_0x337097['existsSync'](_0xd64880))return null;let _0x458f49={},_0x5975e2={'name':_0x267747,'createdAt':new Date()['toISOString']()};if(a41_0x337097[_0x42bbc5(0x177)](_0x43dbf4))try{const _0x3c63c3=a41_0x337097[_0x42bbc5(0x164)](_0x43dbf4,_0x42bbc5(0x16c)),_0x24c61d=JSON[_0x42bbc5(0x154)](_0x3c63c3),{metadata:_0x183ff6,..._0x429eb6}=_0x24c61d;_0x458f49=_0x429eb6,_0x183ff6&&(_0x5975e2=_0x183ff6);}catch{}return{'name':_0x267747,'config':_0x458f49,'metadata':_0x5975e2,'hasCredentials':a41_0x337097[_0x42bbc5(0x177)](_0xd64880),'scope':_0x42bbc5(0x190)};}export function listProfiles(){const _0x10939c=a41_0xedb7,_0x12fe1e=loadProfilesFromTdxJsonFiles(),_0x51744b=loadProfilesFromDirectories();if(_0x51744b['length']>0x0){const _0xfc7da6=_0x51744b['map'](_0x1da39e=>_0x1da39e[_0x10939c(0x194)])[_0x10939c(0x167)](',\x20'),_0x14ccb0=getConfigDir();console[_0x10939c(0x17b)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0xfc7da6),console['warn'](_0x10939c(0x185)),console[_0x10939c(0x17b)]('\x20\x201.\x20Edit:\x20'+a41_0x20d1e7[_0x10939c(0x167)](_0x14ccb0,_0x10939c(0x14d))),console[_0x10939c(0x17b)](_0x10939c(0x152)),console[_0x10939c(0x17b)](_0x10939c(0x17e));}const _0x3b9e55=[..._0x12fe1e,..._0x51744b],_0x53220d=new Map();for(const _0x44934b of _0x3b9e55){!_0x53220d[_0x10939c(0x162)](_0x44934b[_0x10939c(0x194)])&&_0x53220d['set'](_0x44934b[_0x10939c(0x194)],_0x44934b);}return Array[_0x10939c(0x183)](_0x53220d['values']())[_0x10939c(0x160)]((_0x2f2e0f,_0x59c67b)=>_0x2f2e0f[_0x10939c(0x194)][_0x10939c(0x174)](_0x59c67b[_0x10939c(0x194)]));}export function profileExists(_0x1317b5){const _0x4fa704=listProfiles();return _0x4fa704['some'](_0x59e6bb=>_0x59e6bb['name']===_0x1317b5);}export function loadProfile(_0x26ece9){const _0x11cdeb=a41_0xedb7;validateProfileName(_0x26ece9);const _0x4c4be2=listProfiles(),_0x3e8602=_0x4c4be2[_0x11cdeb(0x16e)](_0x52d723=>_0x52d723[_0x11cdeb(0x194)]===_0x26ece9);return _0x3e8602||null;}export function saveProfile(_0x2a453c,_0xa5e674,_0x42197f=![]){saveProfileToUserConfig(_0x2a453c,_0xa5e674);}export function deleteProfile(_0x28d91b){const _0x46b8b7=a41_0xedb7;validateProfileName(_0x28d91b);const _0x2b6d87=getProfileDir(_0x28d91b);if(!a41_0x337097[_0x46b8b7(0x177)](_0x2b6d87))throw new Error(_0x46b8b7(0x173)+_0x28d91b+'\x20does\x20not\x20exist');a41_0x337097['rmSync'](_0x2b6d87,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x355085,_0x5180cf){const _0x109140=a41_0xedb7;validateProfileName(_0x355085);const _0x330a76=getGlobalConfigPath(),_0x3ee763=getConfigDir();!a41_0x337097[_0x109140(0x177)](_0x3ee763)&&createSecureDirectory(_0x3ee763);let _0x3d633b={};if(a41_0x337097[_0x109140(0x177)](_0x330a76))try{const _0x3657e5=a41_0x337097['readFileSync'](_0x330a76,_0x109140(0x16c));_0x3d633b=JSON[_0x109140(0x154)](_0x3657e5);}catch{console[_0x109140(0x17b)](_0x109140(0x161)+_0x330a76+_0x109140(0x171));}!_0x3d633b[_0x109140(0x18e)]&&(_0x3d633b[_0x109140(0x18e)]={}),_0x3d633b[_0x109140(0x18e)][_0x355085]=_0x5180cf,writeSecureFile(_0x330a76,JSON['stringify'](_0x3d633b,null,0x2));}export function getActiveProfile(){const _0x1391eb=a41_0xedb7,_0x235ec6=getGlobalConfigPath();if(!a41_0x337097['existsSync'](_0x235ec6))return null;try{const _0x3cdc11=a41_0x337097[_0x1391eb(0x164)](_0x235ec6,'utf-8'),_0xc62f47=JSON[_0x1391eb(0x154)](_0x3cdc11);return _0xc62f47[_0x1391eb(0x180)]||null;}catch{return null;}}export function createProfile(_0x18a0a2,_0x339b67){const _0x457968=a41_0xedb7;validateProfileName(_0x18a0a2);if(profileExists(_0x18a0a2))throw new Error(_0x457968(0x173)+_0x18a0a2+'\x20already\x20exists');saveProfile(_0x18a0a2,_0x339b67);}export function saveProfileCredentials(_0x4fe3a6,_0x1e20a2){const _0x1a9161=a41_0xedb7;validateProfileName(_0x4fe3a6);if(!profileExists(_0x4fe3a6))throw new Error('Profile\x20'+_0x4fe3a6+_0x1a9161(0x155));const _0x3eb17e=getNewCredentialPath(_0x4fe3a6);writeSecureFile(_0x3eb17e,_0x1e20a2);}export function loadProfileCredentials(_0x312ef8){const _0x230046=a41_0xedb7;validateProfileName(_0x312ef8);const _0x569d41=getNewCredentialPath(_0x312ef8);if(a41_0x337097['existsSync'](_0x569d41))try{return a41_0x337097['readFileSync'](_0x569d41,_0x230046(0x16c));}catch{}const _0xa0dd59=getOldCredentialPath(_0x312ef8);if(a41_0x337097[_0x230046(0x177)](_0xa0dd59)){console[_0x230046(0x17b)](_0x230046(0x169)+_0x312ef8+'\x27'),console['warn'](_0x230046(0x18b)),console[_0x230046(0x17b)](_0x230046(0x15a)+_0xa0dd59+'\x22\x20\x22'+_0x569d41+'\x22'),console[_0x230046(0x17b)](_0x230046(0x191));try{return a41_0x337097[_0x230046(0x164)](_0xa0dd59,_0x230046(0x16c));}catch{return null;}}return null;}
1
+ (function(_0x84a4e7,_0x547dd6){const _0x38eff3=a41_0x1ae3,_0xf65d2b=_0x84a4e7();while(!![]){try{const _0x27edf3=-parseInt(_0x38eff3(0x180))/0x1*(-parseInt(_0x38eff3(0x196))/0x2)+parseInt(_0x38eff3(0x186))/0x3+parseInt(_0x38eff3(0x194))/0x4*(-parseInt(_0x38eff3(0x177))/0x5)+-parseInt(_0x38eff3(0x176))/0x6+parseInt(_0x38eff3(0x172))/0x7+-parseInt(_0x38eff3(0x190))/0x8*(parseInt(_0x38eff3(0x18b))/0x9)+-parseInt(_0x38eff3(0x17a))/0xa*(-parseInt(_0x38eff3(0x18f))/0xb);if(_0x27edf3===_0x547dd6)break;else _0xf65d2b['push'](_0xf65d2b['shift']());}catch(_0x52cf45){_0xf65d2b['push'](_0xf65d2b['shift']());}}}(a41_0x17b7,0x4219a));import*as a41_0x4190b6 from'node:fs';import*as a41_0x419479 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';export function getProfileParams(_0x2674aa){const _0x4167e8=a41_0x1ae3,_0x8e8d47={};if(!_0x2674aa)return _0x8e8d47;for(const [_0x5e6138,_0x440bab]of Object[_0x4167e8(0x18c)](_0x2674aa)){_0x5e6138!==_0x4167e8(0x1a8)&&_0x440bab!==undefined&&(_0x8e8d47[_0x5e6138]=_0x440bab);}return _0x8e8d47;}export function getProfilesDir(){const _0x24d00d=a41_0x1ae3;return a41_0x419479[_0x24d00d(0x1a0)](getConfigDir(),_0x24d00d(0x1a3));}function getProfileDir(_0x1433c9){const _0x16f59c=a41_0x1ae3;return a41_0x419479[_0x16f59c(0x1a0)](getProfilesDir(),_0x1433c9);}function getProfileConfigPath(_0x51f3c6){const _0x269d55=a41_0x1ae3;return a41_0x419479[_0x269d55(0x1a0)](getProfileDir(_0x51f3c6),'tdx.json');}function getProfileEnvPath(_0x56991){const _0x39110b=a41_0x1ae3;return a41_0x419479['join'](getProfileDir(_0x56991),_0x39110b(0x15d));}function getGlobalConfigPath(){const _0x6bc1d2=a41_0x1ae3;return a41_0x419479[_0x6bc1d2(0x1a0)](getConfigDir(),_0x6bc1d2(0x18e));}function validateProfileName(_0x15421){const _0x52f187=a41_0x1ae3;if(!/^[a-zA-Z0-9_-]+$/[_0x52f187(0x170)](_0x15421))throw new Error(_0x52f187(0x19f)+_0x15421+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.');}function validateProfileConfig(_0x2f6795,_0xaf3156){const _0x59a5b2=a41_0x1ae3;if(typeof _0x2f6795!==_0x59a5b2(0x168)||_0x2f6795===null)throw new Error(_0x59a5b2(0x18d)+_0xaf3156+_0x59a5b2(0x16d));const _0x1a5e48=[_0x59a5b2(0x1a8),_0x59a5b2(0x178),_0x59a5b2(0x184),_0x59a5b2(0x182),_0x59a5b2(0x165),_0x59a5b2(0x19c)],_0x1d599f=_0x2f6795;for(const _0x18a2b9 of Object['keys'](_0x1d599f)){!_0x1a5e48[_0x59a5b2(0x187)](_0x18a2b9)&&console[_0x59a5b2(0x1aa)]('Warning:\x20Profile\x20\x27'+_0xaf3156+_0x59a5b2(0x17b)+_0x18a2b9+_0x59a5b2(0x174));}if(_0x1d599f[_0x59a5b2(0x1a8)]!==undefined&&typeof _0x1d599f['description']!==_0x59a5b2(0x17c))throw new Error(_0x59a5b2(0x18d)+_0xaf3156+_0x59a5b2(0x160));if(_0x1d599f[_0x59a5b2(0x178)]!==undefined&&typeof _0x1d599f['site']!=='string')throw new Error('Profile\x20\x27'+_0xaf3156+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x1d599f[_0x59a5b2(0x184)]!==undefined&&typeof _0x1d599f[_0x59a5b2(0x184)]!==_0x59a5b2(0x17c))throw new Error('Profile\x20\x27'+_0xaf3156+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x1d599f[_0x59a5b2(0x182)]!==undefined&&typeof _0x1d599f[_0x59a5b2(0x182)]!==_0x59a5b2(0x17c))throw new Error(_0x59a5b2(0x18d)+_0xaf3156+_0x59a5b2(0x15e));if(_0x1d599f['llm_project']!==undefined&&typeof _0x1d599f[_0x59a5b2(0x165)]!==_0x59a5b2(0x17c))throw new Error(_0x59a5b2(0x18d)+_0xaf3156+_0x59a5b2(0x15c));if(_0x1d599f[_0x59a5b2(0x19c)]!==undefined&&typeof _0x1d599f[_0x59a5b2(0x19c)]!==_0x59a5b2(0x17c))throw new Error('Profile\x20\x27'+_0xaf3156+_0x59a5b2(0x17f));return!![];}function loadProfilesFromTdxJson(_0x1f5827,_0x21fdd6){const _0x1e939e=a41_0x1ae3;if(!a41_0x4190b6[_0x1e939e(0x1a1)](_0x1f5827))return[];try{const _0x381889=a41_0x4190b6[_0x1e939e(0x19e)](_0x1f5827,_0x1e939e(0x17e)),_0x151e48=JSON['parse'](_0x381889);if(!_0x151e48[_0x1e939e(0x1a3)]||typeof _0x151e48['profiles']!==_0x1e939e(0x168))return[];const _0x51f7b0=[];for(const [_0x34bf8a,_0x1e9d69]of Object[_0x1e939e(0x18c)](_0x151e48[_0x1e939e(0x1a3)])){try{validateProfileConfig(_0x1e9d69,_0x34bf8a);const _0x1ad693=getNewCredentialPath(_0x34bf8a),_0x15466f=getOldCredentialPath(_0x34bf8a),_0x27d7ef=a41_0x4190b6[_0x1e939e(0x1a1)](_0x1ad693)||a41_0x4190b6[_0x1e939e(0x1a1)](_0x15466f);_0x51f7b0[_0x1e939e(0x18a)]({'name':_0x34bf8a,'config':_0x1e9d69,'metadata':{'name':_0x34bf8a,'createdAt':new Date()[_0x1e939e(0x169)]()},'hasCredentials':_0x27d7ef,'scope':_0x21fdd6});}catch(_0x1698e4){_0x1698e4 instanceof Error&&(console[_0x1e939e(0x1aa)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x1f5827+':'),console[_0x1e939e(0x1aa)]('\x20\x20'+_0x1698e4[_0x1e939e(0x179)]+'\x0a'));}}return _0x51f7b0;}catch(_0x87af66){return _0x87af66 instanceof SyntaxError?(console[_0x1e939e(0x1aa)](_0x1e939e(0x1a7)+_0x1f5827+_0x1e939e(0x199)),console[_0x1e939e(0x1aa)](_0x1e939e(0x197)+_0x87af66[_0x1e939e(0x179)]+'\x0a')):console['warn'](_0x1e939e(0x17d)+_0x1f5827+':\x20'+_0x87af66+'\x0a'),[];}}export function getNewCredentialPath(_0x265dc6){const _0x233414=a41_0x1ae3;return a41_0x419479[_0x233414(0x1a0)](getConfigDir(),_0x233414(0x181)+_0x265dc6);}function getOldCredentialPath(_0x549eb5){const _0x4c0ba9=a41_0x1ae3;return a41_0x419479[_0x4c0ba9(0x1a0)](getProfilesDir(),_0x549eb5,_0x4c0ba9(0x15d));}function loadProfilesFromTdxJsonFiles(){const _0x37ba8c=a41_0x1ae3,_0x1b8124=[],_0x33d864=findProjectConfigPath();_0x33d864&&_0x1b8124['push'](...loadProfilesFromTdxJson(_0x33d864,_0x37ba8c(0x166)));const _0x187dec=a41_0x419479['join'](getConfigDir(),_0x37ba8c(0x18e));return _0x1b8124[_0x37ba8c(0x18a)](...loadProfilesFromTdxJson(_0x187dec,_0x37ba8c(0x16f))),_0x1b8124;}function loadProfilesFromDirectories(){const _0x56d3d5=a41_0x1ae3,_0x2e7495=getProfilesDir();if(!a41_0x4190b6[_0x56d3d5(0x1a1)](_0x2e7495))return[];try{return a41_0x4190b6[_0x56d3d5(0x191)](_0x2e7495,{'withFileTypes':!![]})['filter'](_0x428142=>_0x428142['isDirectory']())[_0x56d3d5(0x171)](_0x1de160=>_0x1de160[_0x56d3d5(0x193)])[_0x56d3d5(0x164)](_0x4d7828=>{const _0x59ad6b=_0x56d3d5,_0x1ded6c=getProfileConfigPath(_0x4d7828),_0x46d0f4=getProfileEnvPath(_0x4d7828);return a41_0x4190b6[_0x59ad6b(0x1a1)](_0x1ded6c)||a41_0x4190b6[_0x59ad6b(0x1a1)](_0x46d0f4);})[_0x56d3d5(0x171)](_0x597e38=>{const _0x522683=_0x56d3d5,_0x376588=loadProfileFromDirectory(_0x597e38);if(_0x376588)return{..._0x376588,'scope':_0x522683(0x19a)};return null;})[_0x56d3d5(0x164)](_0x306982=>_0x306982!==null);}catch{return[];}}function loadProfileFromDirectory(_0x27efa2){const _0x5bded2=a41_0x1ae3,_0x5bd7b7=getProfileConfigPath(_0x27efa2),_0x37f9a3=getOldCredentialPath(_0x27efa2);if(!a41_0x4190b6[_0x5bded2(0x1a1)](_0x5bd7b7)&&!a41_0x4190b6['existsSync'](_0x37f9a3))return null;let _0x29cece={},_0x394d2b={'name':_0x27efa2,'createdAt':new Date()[_0x5bded2(0x169)]()};if(a41_0x4190b6[_0x5bded2(0x1a1)](_0x5bd7b7))try{const _0x39ff81=a41_0x4190b6['readFileSync'](_0x5bd7b7,_0x5bded2(0x17e)),_0x5e5ec4=JSON[_0x5bded2(0x16a)](_0x39ff81),{metadata:_0x4c4a40,..._0x230311}=_0x5e5ec4;_0x29cece=_0x230311,_0x4c4a40&&(_0x394d2b=_0x4c4a40);}catch{}return{'name':_0x27efa2,'config':_0x29cece,'metadata':_0x394d2b,'hasCredentials':a41_0x4190b6[_0x5bded2(0x1a1)](_0x37f9a3),'scope':_0x5bded2(0x19a)};}function a41_0x1ae3(_0x52fd06,_0x3c351b){const _0x17b7f4=a41_0x17b7();return a41_0x1ae3=function(_0x1ae3e9,_0x3e003e){_0x1ae3e9=_0x1ae3e9-0x15c;let _0x447ed1=_0x17b7f4[_0x1ae3e9];return _0x447ed1;},a41_0x1ae3(_0x52fd06,_0x3c351b);}export function listProfiles(){const _0x2414ae=a41_0x1ae3,_0x50e15e=loadProfilesFromTdxJsonFiles(),_0xb77831=loadProfilesFromDirectories();if(_0xb77831[_0x2414ae(0x1a4)]>0x0){const _0x27a91f=_0xb77831[_0x2414ae(0x171)](_0x116a5f=>_0x116a5f[_0x2414ae(0x193)])['join'](',\x20'),_0x1b4c7f=getConfigDir();console[_0x2414ae(0x1aa)](_0x2414ae(0x16c)+_0x27a91f),console['warn'](_0x2414ae(0x19b)),console['warn'](_0x2414ae(0x192)+a41_0x419479[_0x2414ae(0x1a0)](_0x1b4c7f,_0x2414ae(0x18e))),console['warn'](_0x2414ae(0x175)),console[_0x2414ae(0x1aa)](_0x2414ae(0x1ab));}const _0x51c091=[..._0x50e15e,..._0xb77831],_0x1b2127=new Map();for(const _0x8eadae of _0x51c091){!_0x1b2127[_0x2414ae(0x15f)](_0x8eadae['name'])&&_0x1b2127[_0x2414ae(0x183)](_0x8eadae[_0x2414ae(0x193)],_0x8eadae);}return Array[_0x2414ae(0x1a9)](_0x1b2127[_0x2414ae(0x163)]())[_0x2414ae(0x195)]((_0x191837,_0x174755)=>_0x191837['name'][_0x2414ae(0x16e)](_0x174755[_0x2414ae(0x193)]));}export function profileExists(_0x140b8b){const _0x2622a2=a41_0x1ae3,_0x507d8c=listProfiles();return _0x507d8c[_0x2622a2(0x16b)](_0x4b8c64=>_0x4b8c64[_0x2622a2(0x193)]===_0x140b8b);}export function loadProfile(_0x2407e0){const _0x32abca=a41_0x1ae3;validateProfileName(_0x2407e0);const _0x2780c2=listProfiles(),_0x5f269d=_0x2780c2[_0x32abca(0x162)](_0x1196b6=>_0x1196b6[_0x32abca(0x193)]===_0x2407e0);return _0x5f269d||null;}export function saveProfile(_0x147fc9,_0x920c6c,_0x5389d4=![]){saveProfileToUserConfig(_0x147fc9,_0x920c6c);}export function deleteProfile(_0x38c099){const _0x5a5f65=a41_0x1ae3;validateProfileName(_0x38c099);const _0x5b0e23=getProfileDir(_0x38c099);if(!a41_0x4190b6[_0x5a5f65(0x1a1)](_0x5b0e23))throw new Error(_0x5a5f65(0x185)+_0x38c099+_0x5a5f65(0x198));a41_0x4190b6[_0x5a5f65(0x19d)](_0x5b0e23,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x743b73,_0x20c33b){const _0x14905f=a41_0x1ae3;validateProfileName(_0x743b73);const _0x205d92=getGlobalConfigPath(),_0x3fd0b0=getConfigDir();!a41_0x4190b6['existsSync'](_0x3fd0b0)&&createSecureDirectory(_0x3fd0b0);let _0x58ad4d={};if(a41_0x4190b6[_0x14905f(0x1a1)](_0x205d92))try{const _0x520ff1=a41_0x4190b6['readFileSync'](_0x205d92,'utf-8');_0x58ad4d=JSON['parse'](_0x520ff1);}catch{console[_0x14905f(0x1aa)](_0x14905f(0x1a5)+_0x205d92+_0x14905f(0x173));}!_0x58ad4d[_0x14905f(0x1a3)]&&(_0x58ad4d[_0x14905f(0x1a3)]={}),_0x58ad4d[_0x14905f(0x1a3)][_0x743b73]=_0x20c33b,writeSecureFile(_0x205d92,JSON[_0x14905f(0x161)](_0x58ad4d,null,0x2));}function a41_0x17b7(){const _0x4e7978=['Invalid\x20profile\x20name:\x20','join','existsSync','\x22\x20\x22','profiles','length','Warning:\x20Failed\x20to\x20parse\x20','profile','\x0aWarning:\x20Failed\x20to\x20parse\x20','description','from','warn','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','.env','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','has','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','stringify','find','values','filter','llm_project','local','To\x20migrate:','object','toISOString','parse','some','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','\x27:\x20config\x20must\x20be\x20an\x20object','localeCompare','user','test','map','1445899ZtnfXb',',\x20creating\x20new\x20file','\x27\x20will\x20be\x20ignored','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','643326TaSBvd','59835DmlEbM','site','message','2007370dYnGoJ','\x27:\x20unknown\x20config\x20key\x20\x27','string','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','utf-8','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','9OZdIBf','.env.','parent_segment','set','database','Profile\x20','823173vTKISi','includes','\x20\x20mv\x20\x22','\x20already\x20exists','push','18hCuwnk','entries','Profile\x20\x27','tdx.json','11ppEjET','995176WKYDYq','readdirSync','\x20\x201.\x20Edit:\x20','name','100HPOXXL','sort','54278bomnbx','Error:\x20','\x20does\x20not\x20exist',':\x20Invalid\x20JSON\x20syntax','directory','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','llm_agent','rmSync','readFileSync'];a41_0x17b7=function(){return _0x4e7978;};return a41_0x17b7();}export function getActiveProfile(){const _0x4161bc=a41_0x1ae3,_0xef754c=getGlobalConfigPath();if(!a41_0x4190b6[_0x4161bc(0x1a1)](_0xef754c))return null;try{const _0x4aa40c=a41_0x4190b6[_0x4161bc(0x19e)](_0xef754c,'utf-8'),_0x51e403=JSON['parse'](_0x4aa40c);return _0x51e403[_0x4161bc(0x1a6)]||null;}catch{return null;}}export function createProfile(_0x4ebd67,_0x1f7b5e){const _0x313d2b=a41_0x1ae3;validateProfileName(_0x4ebd67);if(profileExists(_0x4ebd67))throw new Error('Profile\x20'+_0x4ebd67+_0x313d2b(0x189));saveProfile(_0x4ebd67,_0x1f7b5e);}export function saveProfileCredentials(_0x475c45,_0x439615){const _0x564b1e=a41_0x1ae3;validateProfileName(_0x475c45);if(!profileExists(_0x475c45))throw new Error(_0x564b1e(0x185)+_0x475c45+_0x564b1e(0x198));const _0x5e0a57=getNewCredentialPath(_0x475c45);writeSecureFile(_0x5e0a57,_0x439615);}export function loadProfileCredentials(_0x2ee6dc){const _0x2e04f7=a41_0x1ae3;validateProfileName(_0x2ee6dc);const _0x448238=getNewCredentialPath(_0x2ee6dc);if(a41_0x4190b6[_0x2e04f7(0x1a1)](_0x448238))try{return a41_0x4190b6[_0x2e04f7(0x19e)](_0x448238,_0x2e04f7(0x17e));}catch{}const _0x43e293=getOldCredentialPath(_0x2ee6dc);if(a41_0x4190b6[_0x2e04f7(0x1a1)](_0x43e293)){console[_0x2e04f7(0x1aa)]('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x2ee6dc+'\x27'),console[_0x2e04f7(0x1aa)](_0x2e04f7(0x167)),console[_0x2e04f7(0x1aa)](_0x2e04f7(0x188)+_0x43e293+_0x2e04f7(0x1a2)+_0x448238+'\x22'),console[_0x2e04f7(0x1aa)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a41_0x4190b6['readFileSync'](_0x43e293,_0x2e04f7(0x17e));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- const a42_0x396be5=a42_0x3fdf;(function(_0x5d44fa,_0x2f2d6f){const _0x54a1e7=a42_0x3fdf,_0x4fa316=_0x5d44fa();while(!![]){try{const _0xfb3c92=-parseInt(_0x54a1e7(0x1a6))/0x1+-parseInt(_0x54a1e7(0x1a3))/0x2*(-parseInt(_0x54a1e7(0x1a7))/0x3)+parseInt(_0x54a1e7(0x1a1))/0x4+parseInt(_0x54a1e7(0x1a9))/0x5+parseInt(_0x54a1e7(0x19f))/0x6+-parseInt(_0x54a1e7(0x19d))/0x7+-parseInt(_0x54a1e7(0x197))/0x8*(parseInt(_0x54a1e7(0x18e))/0x9);if(_0xfb3c92===_0x2f2d6f)break;else _0x4fa316['push'](_0x4fa316['shift']());}catch(_0x4887ef){_0x4fa316['push'](_0x4fa316['shift']());}}}(a42_0x251e,0xe0a19));function a42_0x3fdf(_0x57870f,_0x42c866){const _0x251e89=a42_0x251e();return a42_0x3fdf=function(_0x3fdfd4,_0x219d87){_0x3fdfd4=_0x3fdfd4-0x18d;let _0x3fa79a=_0x251e89[_0x3fdfd4];return _0x3fa79a;},a42_0x3fdf(_0x57870f,_0x42c866);}import*as a42_0x2f5274 from'node:fs';import*as a42_0x20e804 from'node:path';const PROJECT_CONFIG_FILENAME=a42_0x396be5(0x1a0);function a42_0x251e(){const _0x499eb7=['1350843fYIBrW','18NqJZUI','TD_API_KEY','4049150nbBgEC','\x20is\x20ignored.\x20','join','7331031eAbDjS','cwd','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','readFileSync','dirname','includes','apiKey','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','24vjKcmR','warn','ENOENT','writeFileSync','profile','api_key','2321732Rfhmiz','stringify','7397676rVyqVo','tdx.json','7224188CbbcNJ','utf-8','399154owdukT','code','Failed\x20to\x20load\x20project\x20config\x20from\x20'];a42_0x251e=function(){return _0x499eb7;};return a42_0x251e();}export function findProjectConfigPath(_0x16c501){const _0x59df6c=a42_0x396be5;let _0x30d0dd=_0x16c501||process[_0x59df6c(0x18f)]();while(!![]){const _0xa776f5=a42_0x20e804[_0x59df6c(0x18d)](_0x30d0dd,PROJECT_CONFIG_FILENAME);if(a42_0x2f5274['existsSync'](_0xa776f5))return _0xa776f5;const _0x485038=a42_0x20e804[_0x59df6c(0x193)](_0x30d0dd);if(_0x485038===_0x30d0dd)return null;_0x30d0dd=_0x485038;}}export function loadProjectConfig(_0x3250f0){const _0xac18bc=a42_0x396be5,_0x373f5a=findProjectConfigPath(_0x3250f0);if(!_0x373f5a)return null;try{const _0x28df44=a42_0x2f5274[_0xac18bc(0x192)](_0x373f5a,_0xac18bc(0x1a2)),_0x360227=JSON['parse'](_0x28df44),_0x31c535=JSON[_0xac18bc(0x19e)](_0x360227);if(_0x31c535[_0xac18bc(0x194)](_0xac18bc(0x1a8))||_0x31c535[_0xac18bc(0x194)](_0xac18bc(0x195))||_0x31c535[_0xac18bc(0x194)]('api_key'))throw new Error(_0xac18bc(0x190)+_0x373f5a+').\x20'+_0xac18bc(0x196));const {metadata:_0x7375c9,profile:_0x2d7c46,..._0x5a85cf}=_0x360227;return _0x2d7c46&&console[_0xac18bc(0x198)]('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x373f5a+_0xac18bc(0x1aa)+_0xac18bc(0x191)),_0x5a85cf;}catch(_0x541b00){if(_0x541b00 instanceof Error&&_0xac18bc(0x1a4)in _0x541b00&&_0x541b00[_0xac18bc(0x1a4)]===_0xac18bc(0x199))return null;throw new Error(_0xac18bc(0x1a5)+_0x373f5a+':\x20'+_0x541b00);}}export function saveProjectConfig(_0x30e5ca,_0x1baae2){const _0x4f7dd3=a42_0x396be5,_0xbac6c4=_0x1baae2||process[_0x4f7dd3(0x18f)](),_0x345b32=a42_0x20e804[_0x4f7dd3(0x18d)](_0xbac6c4,PROJECT_CONFIG_FILENAME),_0x136342=JSON['stringify'](_0x30e5ca);if(_0x136342[_0x4f7dd3(0x194)](_0x4f7dd3(0x1a8))||_0x136342[_0x4f7dd3(0x194)]('apiKey')||_0x136342[_0x4f7dd3(0x194)](_0x4f7dd3(0x19c)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x4f7dd3(0x19b)in _0x30e5ca)throw new Error('\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.');a42_0x2f5274[_0x4f7dd3(0x19a)](_0x345b32,JSON['stringify'](_0x30e5ca,null,0x2));}export function hasProjectConfig(_0x369b15){return findProjectConfigPath(_0x369b15)!==null;}export function getProjectRoot(_0x1e6dc6){const _0x3aa078=findProjectConfigPath(_0x1e6dc6);return _0x3aa078?a42_0x20e804['dirname'](_0x3aa078):null;}
1
+ const a42_0x5e03d7=a42_0x464d;(function(_0x326ab4,_0x203a17){const _0x2acc2d=a42_0x464d,_0x39059c=_0x326ab4();while(!![]){try{const _0x5f3809=parseInt(_0x2acc2d(0xc3))/0x1+parseInt(_0x2acc2d(0xce))/0x2*(parseInt(_0x2acc2d(0xb8))/0x3)+parseInt(_0x2acc2d(0xc2))/0x4*(-parseInt(_0x2acc2d(0xc1))/0x5)+-parseInt(_0x2acc2d(0xb3))/0x6+-parseInt(_0x2acc2d(0xc9))/0x7+-parseInt(_0x2acc2d(0xc0))/0x8+parseInt(_0x2acc2d(0xbe))/0x9;if(_0x5f3809===_0x203a17)break;else _0x39059c['push'](_0x39059c['shift']());}catch(_0x44ace5){_0x39059c['push'](_0x39059c['shift']());}}}(a42_0x299a,0xbf75a));import*as a42_0x207c0a from'node:fs';function a42_0x299a(){const _0x10b883=['10hpqfAn','apiKey','parse','dirname','tdx.json','readFileSync','7440402CimhpU','code','warn','TD_API_KEY','includes','355587aZYFHw','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','ENOENT','existsSync','join','Failed\x20to\x20load\x20project\x20config\x20from\x20','34245900lqRVNH','cwd','831680hbCoVJ','50juVGPI','559484ogdTtC','268897rivmnn','profile','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','utf-8','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','7977809OrwrAf','Warning:\x20\x27profile\x27\x20field\x20in\x20',').\x20','api_key','stringify'];a42_0x299a=function(){return _0x10b883;};return a42_0x299a();}import*as a42_0xf14b8a from'node:path';const PROJECT_CONFIG_FILENAME=a42_0x5e03d7(0xd2);export function findProjectConfigPath(_0x57586e){const _0x514292=a42_0x5e03d7;let _0x4dac74=_0x57586e||process[_0x514292(0xbf)]();while(!![]){const _0x3dde83=a42_0xf14b8a['join'](_0x4dac74,PROJECT_CONFIG_FILENAME);if(a42_0x207c0a[_0x514292(0xbb)](_0x3dde83))return _0x3dde83;const _0x2a167a=a42_0xf14b8a[_0x514292(0xd1)](_0x4dac74);if(_0x2a167a===_0x4dac74)return null;_0x4dac74=_0x2a167a;}}export function loadProjectConfig(_0x4d8dac){const _0x57945b=a42_0x5e03d7,_0xc072ea=findProjectConfigPath(_0x4d8dac);if(!_0xc072ea)return null;try{const _0x2e4c85=a42_0x207c0a[_0x57945b(0xd3)](_0xc072ea,_0x57945b(0xc7)),_0x3d2c6a=JSON[_0x57945b(0xd0)](_0x2e4c85),_0x2b7a0b=JSON['stringify'](_0x3d2c6a);if(_0x2b7a0b[_0x57945b(0xb7)](_0x57945b(0xb6))||_0x2b7a0b['includes'](_0x57945b(0xcf))||_0x2b7a0b['includes'](_0x57945b(0xcc)))throw new Error(_0x57945b(0xc8)+_0xc072ea+_0x57945b(0xcb)+_0x57945b(0xc5));const {metadata:_0x55294a,profile:_0x6dfc7,..._0x41612a}=_0x3d2c6a;return _0x6dfc7&&console[_0x57945b(0xb5)](_0x57945b(0xca)+_0xc072ea+'\x20is\x20ignored.\x20'+_0x57945b(0xb9)),_0x41612a;}catch(_0x42e925){if(_0x42e925 instanceof Error&&_0x57945b(0xb4)in _0x42e925&&_0x42e925[_0x57945b(0xb4)]===_0x57945b(0xba))return null;throw new Error(_0x57945b(0xbd)+_0xc072ea+':\x20'+_0x42e925);}}export function saveProjectConfig(_0x1aacb2,_0x435abc){const _0x4d892f=a42_0x5e03d7,_0x352f27=_0x435abc||process[_0x4d892f(0xbf)](),_0x58ea3e=a42_0xf14b8a[_0x4d892f(0xbc)](_0x352f27,PROJECT_CONFIG_FILENAME),_0x3d3976=JSON['stringify'](_0x1aacb2);if(_0x3d3976[_0x4d892f(0xb7)](_0x4d892f(0xb6))||_0x3d3976[_0x4d892f(0xb7)](_0x4d892f(0xcf))||_0x3d3976[_0x4d892f(0xb7)](_0x4d892f(0xcc)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x4d892f(0xc4)in _0x1aacb2)throw new Error(_0x4d892f(0xc6));a42_0x207c0a['writeFileSync'](_0x58ea3e,JSON[_0x4d892f(0xcd)](_0x1aacb2,null,0x2));}function a42_0x464d(_0x2d76b4,_0x52cfff){const _0x299a43=a42_0x299a();return a42_0x464d=function(_0x464d58,_0x58d83c){_0x464d58=_0x464d58-0xb3;let _0x29cbf2=_0x299a43[_0x464d58];return _0x29cbf2;},a42_0x464d(_0x2d76b4,_0x52cfff);}export function hasProjectConfig(_0x477ce6){return findProjectConfigPath(_0x477ce6)!==null;}export function getProjectRoot(_0x51e1de){const _0x548bfa=findProjectConfigPath(_0x51e1de);return _0x548bfa?a42_0xf14b8a['dirname'](_0x548bfa):null;}
@@ -1 +1 @@
1
- (function(_0x19f971,_0x45e833){const _0x422c63=a43_0x449f,_0x5f43e5=_0x19f971();while(!![]){try{const _0x3dc354=parseInt(_0x422c63(0x108))/0x1*(parseInt(_0x422c63(0x101))/0x2)+-parseInt(_0x422c63(0xf8))/0x3*(parseInt(_0x422c63(0x10e))/0x4)+-parseInt(_0x422c63(0x117))/0x5*(-parseInt(_0x422c63(0x118))/0x6)+parseInt(_0x422c63(0x10f))/0x7*(-parseInt(_0x422c63(0x10d))/0x8)+-parseInt(_0x422c63(0x109))/0x9*(parseInt(_0x422c63(0x116))/0xa)+-parseInt(_0x422c63(0x110))/0xb+parseInt(_0x422c63(0x11d))/0xc*(parseInt(_0x422c63(0xfb))/0xd);if(_0x3dc354===_0x45e833)break;else _0x5f43e5['push'](_0x5f43e5['shift']());}catch(_0x9917de){_0x5f43e5['push'](_0x5f43e5['shift']());}}}(a43_0x41e7,0x8444c));import*as a43_0x488bf8 from'node:fs';import*as a43_0x4a0ac3 from'node:path';import*as a43_0x576f46 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 _0x33caac=a43_0x449f,_0x4e6fc8=process[_0x33caac(0x105)]['TDX_CONFIG_DIR']||a43_0x4a0ac3[_0x33caac(0x10a)](a43_0x576f46['homedir'](),_0x33caac(0x114),_0x33caac(0x111));return a43_0x4a0ac3[_0x33caac(0x10a)](_0x4e6fc8,_0x33caac(0x107));}function getSessionPath(_0xf5044a){const _0x113542=a43_0x449f;return a43_0x4a0ac3[_0x113542(0x10a)](getSessionsDir(),_0xf5044a+_0x113542(0x103));}function a43_0x41e7(){const _0x27aea4=['.\x20This\x20is\x20insecure.\x20Removing\x20session.','.config','utf-8','10nhwAgt','5iAiujv','6123858VNhdZF','apiKey','parse','warn','api_key','5943108NVLFpr','unlinkSync','includes','toString','createdAt','getTime','88887xXPnqj','test','now','52wuDZUi','readFileSync','stringify','existsSync','sort','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','1587022UfJSoL','readdirSync','.json','toISOString','env','TD_API_KEY','sessions','1IdHzHe','9147609HdFPAm','join','replace','writeFileSync','40btyTXF','108fJWZsE','750050dgtzaI','9914124ZhnlVB','tdx','endsWith'];a43_0x41e7=function(){return _0x27aea4;};return a43_0x41e7();}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0xa1ac32){if(_0xa1ac32)return _0xa1ac32;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x5d57a6){const _0x1aa68c=a43_0x449f,_0x2b9062=_0x5d57a6||getCurrentSessionPID()[_0x1aa68c(0xf5)](),_0x54a17a=/^\d+$/[_0x1aa68c(0xf9)](_0x2b9062)?parseInt(_0x2b9062,0xa):null;return _0x54a17a!==null?loadSessionContextByPID(_0x54a17a):loadSessionContextByString(_0x2b9062);}export function loadSessionContextByPID(_0x472af4){const _0x311714=a43_0x449f,_0x484d6d=getSessionPath(_0x472af4);if(!a43_0x488bf8[_0x311714(0xfe)](_0x484d6d))return null;try{const _0x4bb4e0=a43_0x488bf8[_0x311714(0xfc)](_0x484d6d,'utf-8'),_0x341d60=JSON[_0x311714(0x11a)](_0x4bb4e0),_0x5cac4d=new Date(_0x341d60['createdAt'])[_0x311714(0xf7)](),_0x238f22=Date['now']();if(_0x238f22-_0x5cac4d>SESSION_EXPIRATION_MS)return a43_0x488bf8[_0x311714(0x11e)](_0x484d6d),null;const _0x4ac39d=JSON[_0x311714(0xfd)](_0x341d60);if(_0x4ac39d[_0x311714(0x11f)]('TD_API_KEY')||_0x4ac39d[_0x311714(0x11f)](_0x311714(0x119))||_0x4ac39d[_0x311714(0x11f)](_0x311714(0x11c)))return console[_0x311714(0x11b)](_0x311714(0x100)+_0x484d6d+_0x311714(0x113)),a43_0x488bf8[_0x311714(0x11e)](_0x484d6d),null;return _0x341d60;}catch{try{a43_0x488bf8[_0x311714(0x11e)](_0x484d6d);}catch{}return null;}}function loadSessionContextByString(_0x1118d4){const _0x3d9bd5=a43_0x449f,_0x2ee544=a43_0x4a0ac3[_0x3d9bd5(0x10a)](getSessionsDir(),_0x1118d4+_0x3d9bd5(0x103));if(!a43_0x488bf8['existsSync'](_0x2ee544))return null;try{const _0x467e67=a43_0x488bf8[_0x3d9bd5(0xfc)](_0x2ee544,'utf-8'),_0x5f086b=JSON[_0x3d9bd5(0x11a)](_0x467e67),_0x2068d1=new Date(_0x5f086b[_0x3d9bd5(0xf6)])[_0x3d9bd5(0xf7)](),_0xa0123b=Date['now']();if(_0xa0123b-_0x2068d1>SESSION_EXPIRATION_MS)return a43_0x488bf8[_0x3d9bd5(0x11e)](_0x2ee544),null;const _0x1d4e32=JSON[_0x3d9bd5(0xfd)](_0x5f086b);if(_0x1d4e32['includes'](_0x3d9bd5(0x106))||_0x1d4e32['includes'](_0x3d9bd5(0x119))||_0x1d4e32[_0x3d9bd5(0x11f)]('api_key'))return console[_0x3d9bd5(0x11b)](_0x3d9bd5(0x100)+_0x2ee544+_0x3d9bd5(0x113)),a43_0x488bf8[_0x3d9bd5(0x11e)](_0x2ee544),null;return _0x5f086b;}catch{try{a43_0x488bf8['unlinkSync'](_0x2ee544);}catch{}return null;}}function a43_0x449f(_0x2d6f50,_0xf3c952){const _0x41e7d6=a43_0x41e7();return a43_0x449f=function(_0x449f0c,_0x53c415){_0x449f0c=_0x449f0c-0xf5;let _0x3114ee=_0x41e7d6[_0x449f0c];return _0x3114ee;},a43_0x449f(_0x2d6f50,_0xf3c952);}export function saveSessionContext(_0x250feb,_0x593850){const _0x3022e4=a43_0x449f,_0x4e027b=_0x593850||getCurrentSessionPID()['toString'](),_0x17bc42=/^\d+$/[_0x3022e4(0xf9)](_0x4e027b)?parseInt(_0x4e027b,0xa):getCurrentSessionPID(),_0x732007=a43_0x4a0ac3[_0x3022e4(0x10a)](getSessionsDir(),_0x4e027b+_0x3022e4(0x103)),_0x2ab5de=getSessionsDir();createSecureDirectory(_0x2ab5de);const _0x17dbce=JSON[_0x3022e4(0xfd)](_0x250feb);if(_0x17dbce[_0x3022e4(0x11f)](_0x3022e4(0x106))||_0x17dbce[_0x3022e4(0x11f)]('apiKey')||_0x17dbce['includes'](_0x3022e4(0x11c)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x13d2d9;const _0x2fe5e7=/^\d+$/[_0x3022e4(0xf9)](_0x4e027b)?loadSessionContextByPID(parseInt(_0x4e027b,0xa)):loadSessionContextByString(_0x4e027b);_0x2fe5e7?_0x13d2d9={..._0x2fe5e7,..._0x250feb,'pid':_0x17bc42,'sessionId':_0x4e027b!==_0x17bc42['toString']()?_0x4e027b:undefined,'updatedAt':new Date()[_0x3022e4(0x104)]()}:_0x13d2d9={'pid':_0x17bc42,'sessionId':_0x4e027b!==_0x17bc42['toString']()?_0x4e027b:undefined,..._0x250feb,'createdAt':new Date()[_0x3022e4(0x104)](),'updatedAt':new Date()['toISOString']()},a43_0x488bf8[_0x3022e4(0x10c)](_0x732007,JSON[_0x3022e4(0xfd)](_0x13d2d9,null,0x2));}export function clearSessionContext(_0x345aea){const _0x5d09b7=a43_0x449f,_0x54d306=_0x345aea||getCurrentSessionPID()['toString'](),_0x4ae375=a43_0x4a0ac3[_0x5d09b7(0x10a)](getSessionsDir(),_0x54d306+'.json');a43_0x488bf8[_0x5d09b7(0xfe)](_0x4ae375)&&a43_0x488bf8[_0x5d09b7(0x11e)](_0x4ae375);}export function cleanExpiredSessions(){const _0x2c865f=a43_0x449f,_0x44962c=getSessionsDir();if(!a43_0x488bf8[_0x2c865f(0xfe)](_0x44962c))return 0x0;let _0x2709f5=0x0;const _0x4ed7e8=Date[_0x2c865f(0xfa)]();try{const _0x126dae=a43_0x488bf8['readdirSync'](_0x44962c);for(const _0x4c660f of _0x126dae){if(!_0x4c660f['endsWith'](_0x2c865f(0x103)))continue;const _0xf67b3c=a43_0x4a0ac3['join'](_0x44962c,_0x4c660f),_0x3cfee0=_0x4c660f[_0x2c865f(0x10b)](_0x2c865f(0x103),''),_0x439492=parseInt(_0x3cfee0,0xa),_0x4cafe2=!isNaN(_0x439492);if(_0x4cafe2){if(!isProcessRunning(_0x439492)){a43_0x488bf8[_0x2c865f(0x11e)](_0xf67b3c),_0x2709f5++;continue;}}try{const _0x8c2eaf=a43_0x488bf8['readFileSync'](_0xf67b3c,_0x2c865f(0x115)),_0xabb8e=JSON['parse'](_0x8c2eaf),_0x59e844=new Date(_0xabb8e[_0x2c865f(0xf6)])[_0x2c865f(0xf7)]();_0x4ed7e8-_0x59e844>SESSION_EXPIRATION_MS&&(a43_0x488bf8[_0x2c865f(0x11e)](_0xf67b3c),_0x2709f5++);}catch{a43_0x488bf8['unlinkSync'](_0xf67b3c),_0x2709f5++;}}}catch{}return _0x2709f5;}export function listActiveSessions(){const _0xf9a0db=a43_0x449f,_0x2189ac=getSessionsDir();if(!a43_0x488bf8[_0xf9a0db(0xfe)](_0x2189ac))return[];try{const _0x5246b6=a43_0x488bf8[_0xf9a0db(0x102)](_0x2189ac),_0x5141d5=[];for(const _0x36d036 of _0x5246b6){if(!_0x36d036[_0xf9a0db(0x112)](_0xf9a0db(0x103)))continue;const _0x4a4f45=_0x36d036[_0xf9a0db(0x10b)](_0xf9a0db(0x103),''),_0x58a19e=parseInt(_0x4a4f45,0xa);!isNaN(_0x58a19e)&&isProcessRunning(_0x58a19e)&&_0x5141d5['push'](_0x58a19e);}return _0x5141d5[_0xf9a0db(0xff)]((_0x5161db,_0x3b7c3d)=>_0x5161db-_0x3b7c3d);}catch{return[];}}
1
+ function a43_0x1399(){const _0x381381=['homedir','endsWith','test','replace','readFileSync','TDX_CONFIG_DIR','now','apiKey','toString','sort','1409359LxsRrn','join','api_key','18uHkYyq','.\x20This\x20is\x20insecure.\x20Removing\x20session.','includes','.json','toISOString','getTime','9YOOiIo','warn','291268RHVqCu','5309070tpBmVR','.config','396656PBLNbp','readdirSync','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','3ahJgDF','unlinkSync','createdAt','76740SwqFQo','stringify','63270WXgPwS','env','existsSync','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','writeFileSync','1034pjASJH','tdx','parse','utf-8','TD_API_KEY','1446575ShsBQJ','6IRRTxa'];a43_0x1399=function(){return _0x381381;};return a43_0x1399();}function a43_0x1e54(_0xf73c7,_0x2c3a43){const _0x13998e=a43_0x1399();return a43_0x1e54=function(_0x1e5442,_0xb97703){_0x1e5442=_0x1e5442-0xba;let _0x5617b6=_0x13998e[_0x1e5442];return _0x5617b6;},a43_0x1e54(_0xf73c7,_0x2c3a43);}(function(_0x362e4c,_0x4f98ed){const _0x1ac5d8=a43_0x1e54,_0x55830f=_0x362e4c();while(!![]){try{const _0x2a5b4f=parseInt(_0x1ac5d8(0xd6))/0x1*(parseInt(_0x1ac5d8(0xdb))/0x2)+parseInt(_0x1ac5d8(0xc8))/0x3*(-parseInt(_0x1ac5d8(0xd0))/0x4)+parseInt(_0x1ac5d8(0xe5))/0x5+parseInt(_0x1ac5d8(0xba))/0x6*(parseInt(_0x1ac5d8(0xc5))/0x7)+parseInt(_0x1ac5d8(0xd3))/0x8+parseInt(_0x1ac5d8(0xce))/0x9*(-parseInt(_0x1ac5d8(0xd1))/0xa)+-parseInt(_0x1ac5d8(0xe0))/0xb*(-parseInt(_0x1ac5d8(0xd9))/0xc);if(_0x2a5b4f===_0x4f98ed)break;else _0x55830f['push'](_0x55830f['shift']());}catch(_0x3c6b39){_0x55830f['push'](_0x55830f['shift']());}}}(a43_0x1399,0x418ac));import*as a43_0x3ca806 from'node:fs';import*as a43_0x46fb47 from'node:path';import*as a43_0x5ed400 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 _0x4e6503=a43_0x1e54,_0x4efae0=process[_0x4e6503(0xdc)][_0x4e6503(0xc0)]||a43_0x46fb47[_0x4e6503(0xc6)](a43_0x5ed400[_0x4e6503(0xbb)](),_0x4e6503(0xd2),_0x4e6503(0xe1));return a43_0x46fb47[_0x4e6503(0xc6)](_0x4efae0,'sessions');}function getSessionPath(_0x25ff5d){const _0x25cb7c=a43_0x1e54;return a43_0x46fb47[_0x25cb7c(0xc6)](getSessionsDir(),_0x25ff5d+_0x25cb7c(0xcb));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x2ebdee){const _0x3b3509=a43_0x1e54;if(_0x2ebdee)return _0x2ebdee;return getCurrentSessionPID()[_0x3b3509(0xc3)]();}export function loadSessionContext(_0x4bffd5){const _0xca0492=a43_0x1e54,_0x3e715b=_0x4bffd5||getCurrentSessionPID()['toString'](),_0x8a21bd=/^\d+$/[_0xca0492(0xbd)](_0x3e715b)?parseInt(_0x3e715b,0xa):null;return _0x8a21bd!==null?loadSessionContextByPID(_0x8a21bd):loadSessionContextByString(_0x3e715b);}export function loadSessionContextByPID(_0x34ddeb){const _0x51a563=a43_0x1e54,_0x5ed666=getSessionPath(_0x34ddeb);if(!a43_0x3ca806['existsSync'](_0x5ed666))return null;try{const _0x43cb39=a43_0x3ca806[_0x51a563(0xbf)](_0x5ed666,'utf-8'),_0xd8a36c=JSON['parse'](_0x43cb39),_0x2f1a37=new Date(_0xd8a36c[_0x51a563(0xd8)])[_0x51a563(0xcd)](),_0x38bf23=Date['now']();if(_0x38bf23-_0x2f1a37>SESSION_EXPIRATION_MS)return a43_0x3ca806[_0x51a563(0xd7)](_0x5ed666),null;const _0x19b435=JSON[_0x51a563(0xda)](_0xd8a36c);if(_0x19b435[_0x51a563(0xca)]('TD_API_KEY')||_0x19b435[_0x51a563(0xca)](_0x51a563(0xc2))||_0x19b435[_0x51a563(0xca)]('api_key'))return console[_0x51a563(0xcf)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x5ed666+_0x51a563(0xc9)),a43_0x3ca806[_0x51a563(0xd7)](_0x5ed666),null;return _0xd8a36c;}catch{try{a43_0x3ca806['unlinkSync'](_0x5ed666);}catch{}return null;}}function loadSessionContextByString(_0x4a0225){const _0x848f8f=a43_0x1e54,_0xdaf80=a43_0x46fb47['join'](getSessionsDir(),_0x4a0225+_0x848f8f(0xcb));if(!a43_0x3ca806['existsSync'](_0xdaf80))return null;try{const _0x7f4667=a43_0x3ca806[_0x848f8f(0xbf)](_0xdaf80,_0x848f8f(0xe3)),_0x2c98c6=JSON[_0x848f8f(0xe2)](_0x7f4667),_0xb9fe1=new Date(_0x2c98c6[_0x848f8f(0xd8)])[_0x848f8f(0xcd)](),_0x432c3b=Date[_0x848f8f(0xc1)]();if(_0x432c3b-_0xb9fe1>SESSION_EXPIRATION_MS)return a43_0x3ca806[_0x848f8f(0xd7)](_0xdaf80),null;const _0x50b655=JSON['stringify'](_0x2c98c6);if(_0x50b655['includes'](_0x848f8f(0xe4))||_0x50b655[_0x848f8f(0xca)](_0x848f8f(0xc2))||_0x50b655[_0x848f8f(0xca)](_0x848f8f(0xc7)))return console[_0x848f8f(0xcf)](_0x848f8f(0xde)+_0xdaf80+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a43_0x3ca806[_0x848f8f(0xd7)](_0xdaf80),null;return _0x2c98c6;}catch{try{a43_0x3ca806[_0x848f8f(0xd7)](_0xdaf80);}catch{}return null;}}export function saveSessionContext(_0x589fb0,_0x315e68){const _0x55aeed=a43_0x1e54,_0x5aa278=_0x315e68||getCurrentSessionPID()[_0x55aeed(0xc3)](),_0x2113b3=/^\d+$/[_0x55aeed(0xbd)](_0x5aa278)?parseInt(_0x5aa278,0xa):getCurrentSessionPID(),_0x16680c=a43_0x46fb47[_0x55aeed(0xc6)](getSessionsDir(),_0x5aa278+_0x55aeed(0xcb)),_0x49bdfa=getSessionsDir();createSecureDirectory(_0x49bdfa);const _0x18c0fc=JSON[_0x55aeed(0xda)](_0x589fb0);if(_0x18c0fc[_0x55aeed(0xca)](_0x55aeed(0xe4))||_0x18c0fc['includes'](_0x55aeed(0xc2))||_0x18c0fc[_0x55aeed(0xca)](_0x55aeed(0xc7)))throw new Error(_0x55aeed(0xd5));let _0x115401;const _0x39d7b3=/^\d+$/[_0x55aeed(0xbd)](_0x5aa278)?loadSessionContextByPID(parseInt(_0x5aa278,0xa)):loadSessionContextByString(_0x5aa278);_0x39d7b3?_0x115401={..._0x39d7b3,..._0x589fb0,'pid':_0x2113b3,'sessionId':_0x5aa278!==_0x2113b3[_0x55aeed(0xc3)]()?_0x5aa278:undefined,'updatedAt':new Date()['toISOString']()}:_0x115401={'pid':_0x2113b3,'sessionId':_0x5aa278!==_0x2113b3['toString']()?_0x5aa278:undefined,..._0x589fb0,'createdAt':new Date()[_0x55aeed(0xcc)](),'updatedAt':new Date()[_0x55aeed(0xcc)]()},a43_0x3ca806[_0x55aeed(0xdf)](_0x16680c,JSON[_0x55aeed(0xda)](_0x115401,null,0x2));}export function clearSessionContext(_0x265fc6){const _0x25dd77=a43_0x1e54,_0xe7c4e2=_0x265fc6||getCurrentSessionPID()['toString'](),_0x59bd17=a43_0x46fb47[_0x25dd77(0xc6)](getSessionsDir(),_0xe7c4e2+'.json');a43_0x3ca806['existsSync'](_0x59bd17)&&a43_0x3ca806['unlinkSync'](_0x59bd17);}export function cleanExpiredSessions(){const _0x335c79=a43_0x1e54,_0x361df0=getSessionsDir();if(!a43_0x3ca806['existsSync'](_0x361df0))return 0x0;let _0x4a9347=0x0;const _0x14ceda=Date[_0x335c79(0xc1)]();try{const _0x5ace50=a43_0x3ca806[_0x335c79(0xd4)](_0x361df0);for(const _0xd29b49 of _0x5ace50){if(!_0xd29b49['endsWith']('.json'))continue;const _0x52e883=a43_0x46fb47[_0x335c79(0xc6)](_0x361df0,_0xd29b49),_0x50f94f=_0xd29b49[_0x335c79(0xbe)](_0x335c79(0xcb),''),_0x4cbffb=parseInt(_0x50f94f,0xa),_0x532802=!isNaN(_0x4cbffb);if(_0x532802){if(!isProcessRunning(_0x4cbffb)){a43_0x3ca806[_0x335c79(0xd7)](_0x52e883),_0x4a9347++;continue;}}try{const _0x1c3975=a43_0x3ca806[_0x335c79(0xbf)](_0x52e883,_0x335c79(0xe3)),_0x14bce7=JSON[_0x335c79(0xe2)](_0x1c3975),_0x137c93=new Date(_0x14bce7[_0x335c79(0xd8)])[_0x335c79(0xcd)]();_0x14ceda-_0x137c93>SESSION_EXPIRATION_MS&&(a43_0x3ca806['unlinkSync'](_0x52e883),_0x4a9347++);}catch{a43_0x3ca806['unlinkSync'](_0x52e883),_0x4a9347++;}}}catch{}return _0x4a9347;}export function listActiveSessions(){const _0x3af34b=a43_0x1e54,_0x4da8f4=getSessionsDir();if(!a43_0x3ca806[_0x3af34b(0xdd)](_0x4da8f4))return[];try{const _0x3d1104=a43_0x3ca806[_0x3af34b(0xd4)](_0x4da8f4),_0x267a2c=[];for(const _0x56b091 of _0x3d1104){if(!_0x56b091[_0x3af34b(0xbc)](_0x3af34b(0xcb)))continue;const _0x5e1565=_0x56b091[_0x3af34b(0xbe)]('.json',''),_0x11447b=parseInt(_0x5e1565,0xa);!isNaN(_0x11447b)&&isProcessRunning(_0x11447b)&&_0x267a2c['push'](_0x11447b);}return _0x267a2c[_0x3af34b(0xc4)]((_0x5f5c79,_0x462e68)=>_0x5f5c79-_0x462e68);}catch{return[];}}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0x1b3413,_0x2160e0){var _0xaf4af8=a44_0x396a,_0x3ccc25=_0x1b3413();while(!![]){try{var _0x386081=-parseInt(_0xaf4af8(0xa2))/0x1*(parseInt(_0xaf4af8(0xa0))/0x2)+parseInt(_0xaf4af8(0xa1))/0x3*(-parseInt(_0xaf4af8(0xa4))/0x4)+parseInt(_0xaf4af8(0x9f))/0x5*(parseInt(_0xaf4af8(0x9e))/0x6)+-parseInt(_0xaf4af8(0xa6))/0x7+parseInt(_0xaf4af8(0xa5))/0x8+parseInt(_0xaf4af8(0xa3))/0x9+parseInt(_0xaf4af8(0x9d))/0xa*(parseInt(_0xaf4af8(0x9c))/0xb);if(_0x386081===_0x2160e0)break;else _0x3ccc25['push'](_0x3ccc25['shift']());}catch(_0x1f4809){_0x3ccc25['push'](_0x3ccc25['shift']());}}}(a44_0x5f1e,0xe3851));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';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';function a44_0x396a(_0x354846,_0x483048){var _0x5f1eec=a44_0x5f1e();return a44_0x396a=function(_0x396a88,_0x401871){_0x396a88=_0x396a88-0x9c;var _0x4d4ef8=_0x5f1eec[_0x396a88];return _0x4d4ef8;},a44_0x396a(_0x354846,_0x483048);}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';function a44_0x5f1e(){var _0xff057b=['45DsBrfC','4108hEUWzN','6742170IakHZJ','33188nOdvUP','11787056TBJeJe','5012777SzPinX','7840987XIgEjo','10pwGkIF','204harqJB','102055sndlkS','904oRpMqW'];a44_0x5f1e=function(){return _0xff057b;};return a44_0x5f1e();}
1
+ (function(_0x3a6e97,_0x314dfa){var _0x166a28=a44_0x3c5b,_0x140a0a=_0x3a6e97();while(!![]){try{var _0x482e71=parseInt(_0x166a28(0x1fb))/0x1*(parseInt(_0x166a28(0x1f4))/0x2)+parseInt(_0x166a28(0x1f2))/0x3*(-parseInt(_0x166a28(0x1fa))/0x4)+parseInt(_0x166a28(0x1f6))/0x5+-parseInt(_0x166a28(0x1f5))/0x6*(parseInt(_0x166a28(0x1f8))/0x7)+-parseInt(_0x166a28(0x1f7))/0x8+-parseInt(_0x166a28(0x1fc))/0x9+parseInt(_0x166a28(0x1f3))/0xa*(parseInt(_0x166a28(0x1f9))/0xb);if(_0x482e71===_0x314dfa)break;else _0x140a0a['push'](_0x140a0a['shift']());}catch(_0x2bfef7){_0x140a0a['push'](_0x140a0a['shift']());}}}(a44_0x4781,0x50dd8));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 a44_0x3c5b(_0x3de64e,_0x1f4635){var _0x47818d=a44_0x4781();return a44_0x3c5b=function(_0x3c5bf7,_0x3abd18){_0x3c5bf7=_0x3c5bf7-0x1f2;var _0x571a62=_0x47818d[_0x3c5bf7];return _0x571a62;},a44_0x3c5b(_0x3de64e,_0x1f4635);}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';function a44_0x4781(){var _0x3c5ee1=['33ZPZZKm','4GfFlwD','859gGHqQM','315117pTPyvU','1291098BVZoWV','1674220CVAuVF','82yjwSqu','6jIUvyr','2253635ZQhrYL','902768FbqLor','551341VfEjxn'];a44_0x4781=function(){return _0x3c5ee1;};return a44_0x4781();}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';