@treasuredata/tdx 0.6.0 → 0.7.1

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 (144) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.d.ts +1 -1
  4. package/dist/cli-categories.js +1 -1
  5. package/dist/cli-categories.js.map +1 -1
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +1 -1
  8. package/dist/cli.js.map +1 -1
  9. package/dist/client/cdp-api-client.d.ts +8 -1
  10. package/dist/client/cdp-api-client.d.ts.map +1 -1
  11. package/dist/client/cdp-api-client.js +1 -1
  12. package/dist/client/cdp-api-client.js.map +1 -1
  13. package/dist/client/engage-api-client.js +1 -1
  14. package/dist/client/http-client.d.ts +4 -0
  15. package/dist/client/http-client.d.ts.map +1 -1
  16. package/dist/client/http-client.js +1 -1
  17. package/dist/client/http-client.js.map +1 -1
  18. package/dist/client/llm-api-client.js +1 -1
  19. package/dist/client/rate-limiter.js +1 -1
  20. package/dist/client/td-api-client.js +1 -1
  21. package/dist/client/trino-api-client.js +1 -1
  22. package/dist/client/workflow-client.js +1 -1
  23. package/dist/commands/activations.js +1 -1
  24. package/dist/commands/api-command.js +1 -1
  25. package/dist/commands/auth-command.js +1 -1
  26. package/dist/commands/chat-command.js +1 -1
  27. package/dist/commands/claude-command.js +1 -1
  28. package/dist/commands/claude-statusline-command.js +1 -1
  29. package/dist/commands/claude-usage-command.js +1 -1
  30. package/dist/commands/command.js +1 -1
  31. package/dist/commands/context-command.js +1 -1
  32. package/dist/commands/databases.js +1 -1
  33. package/dist/commands/describe.js +1 -1
  34. package/dist/commands/engage-command.js +1 -1
  35. package/dist/commands/job-command.js +1 -1
  36. package/dist/commands/llm-command.js +1 -1
  37. package/dist/commands/llm-proxy.js +1 -1
  38. package/dist/commands/parent-segment-command.d.ts +149 -4
  39. package/dist/commands/parent-segment-command.d.ts.map +1 -1
  40. package/dist/commands/parent-segment-command.js +1 -1
  41. package/dist/commands/parent-segment-command.js.map +1 -1
  42. package/dist/commands/profiles-command.js +1 -1
  43. package/dist/commands/query-command.js +1 -1
  44. package/dist/commands/segment-command.d.ts +24 -0
  45. package/dist/commands/segment-command.d.ts.map +1 -1
  46. package/dist/commands/segment-command.js +1 -1
  47. package/dist/commands/segment-command.js.map +1 -1
  48. package/dist/commands/segment-create-command.js +1 -1
  49. package/dist/commands/segment-fields-command.d.ts.map +1 -1
  50. package/dist/commands/segment-fields-command.js +1 -1
  51. package/dist/commands/segment-fields-command.js.map +1 -1
  52. package/dist/commands/segment-pwd-command.js +1 -1
  53. package/dist/commands/segment-update-command.js +1 -1
  54. package/dist/commands/segment-use-command.js +1 -1
  55. package/dist/commands/segments.js +1 -1
  56. package/dist/commands/show.js +1 -1
  57. package/dist/commands/tables.js +1 -1
  58. package/dist/commands/use-command.js +1 -1
  59. package/dist/commands/workflow-command.js +1 -1
  60. package/dist/core/auth.js +1 -1
  61. package/dist/core/config.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/profile.js +1 -1
  66. package/dist/core/project-config.js +1 -1
  67. package/dist/core/session.js +1 -1
  68. package/dist/index.js +1 -1
  69. package/dist/proxy/anthropic-adapter.js +1 -1
  70. package/dist/proxy/claude-usage-tracker.js +1 -1
  71. package/dist/proxy/context-signature.js +1 -1
  72. package/dist/proxy/conversation-utils.js +1 -1
  73. package/dist/proxy/server.js +1 -1
  74. package/dist/proxy/session-cache.js +1 -1
  75. package/dist/sdk/api.js +1 -1
  76. package/dist/sdk/engage.js +1 -1
  77. package/dist/sdk/errors.js +1 -1
  78. package/dist/sdk/index.d.ts +1 -0
  79. package/dist/sdk/index.d.ts.map +1 -1
  80. package/dist/sdk/index.js +1 -1
  81. package/dist/sdk/index.js.map +1 -1
  82. package/dist/sdk/job.js +1 -1
  83. package/dist/sdk/llm.js +1 -1
  84. package/dist/sdk/query.js +1 -1
  85. package/dist/sdk/segment/parent-segment-preview.d.ts +187 -0
  86. package/dist/sdk/segment/parent-segment-preview.d.ts.map +1 -0
  87. package/dist/sdk/segment/parent-segment-preview.js +1 -0
  88. package/dist/sdk/segment/parent-segment-preview.js.map +1 -0
  89. package/dist/sdk/segment/parent-segment-yaml.d.ts +246 -0
  90. package/dist/sdk/segment/parent-segment-yaml.d.ts.map +1 -0
  91. package/dist/sdk/segment/parent-segment-yaml.js +1 -0
  92. package/dist/sdk/segment/parent-segment-yaml.js.map +1 -0
  93. package/dist/sdk/segment.d.ts +98 -1
  94. package/dist/sdk/segment.d.ts.map +1 -1
  95. package/dist/sdk/segment.js +1 -1
  96. package/dist/sdk/segment.js.map +1 -1
  97. package/dist/sdk/workflow.d.ts.map +1 -1
  98. package/dist/sdk/workflow.js +1 -1
  99. package/dist/sdk/workflow.js.map +1 -1
  100. package/dist/types/cdp.d.ts +21 -0
  101. package/dist/types/cdp.d.ts.map +1 -1
  102. package/dist/types/endpoints.js +1 -1
  103. package/dist/types/index.d.ts +1 -1
  104. package/dist/types/index.d.ts.map +1 -1
  105. package/dist/types/index.js +1 -1
  106. package/dist/utils/agent-ref-parser.js +1 -1
  107. package/dist/utils/chat-cache.js +1 -1
  108. package/dist/utils/colors.js +1 -1
  109. package/dist/utils/command-output.js +1 -1
  110. package/dist/utils/constants.js +1 -1
  111. package/dist/utils/diff.d.ts +26 -0
  112. package/dist/utils/diff.d.ts.map +1 -0
  113. package/dist/utils/diff.js +1 -0
  114. package/dist/utils/diff.js.map +1 -0
  115. package/dist/utils/fields-display.d.ts +31 -0
  116. package/dist/utils/fields-display.d.ts.map +1 -0
  117. package/dist/utils/fields-display.js +1 -0
  118. package/dist/utils/fields-display.js.map +1 -0
  119. package/dist/utils/file-permissions.js +1 -1
  120. package/dist/utils/format-detector.js +1 -1
  121. package/dist/utils/formatters.js +1 -1
  122. package/dist/utils/json-loader.js +1 -1
  123. package/dist/utils/llm-backup-utils.js +1 -1
  124. package/dist/utils/model-aliases.js +1 -1
  125. package/dist/utils/model-factors.js +1 -1
  126. package/dist/utils/option-validation.js +1 -1
  127. package/dist/utils/port.js +1 -1
  128. package/dist/utils/process.js +1 -1
  129. package/dist/utils/prompt.d.ts +9 -1
  130. package/dist/utils/prompt.d.ts.map +1 -1
  131. package/dist/utils/prompt.js +1 -1
  132. package/dist/utils/prompt.js.map +1 -1
  133. package/dist/utils/segment-path-parser.js +1 -1
  134. package/dist/utils/segment-ref-parser.js +1 -1
  135. package/dist/utils/spinner.js +1 -1
  136. package/dist/utils/sql-parser.js +1 -1
  137. package/dist/utils/sse-parser.js +1 -1
  138. package/dist/utils/string-utils.js +1 -1
  139. package/dist/utils/table-ref-parser.js +1 -1
  140. package/dist/utils/tdx-logger.js +1 -1
  141. package/dist/utils/tree-formatter.js +1 -1
  142. package/dist/utils/version-check.js +1 -1
  143. package/dist/utils/workflow-utils.js +1 -1
  144. package/package.json +4 -2
@@ -1 +1 @@
1
- const a39_0x1cfa1b=a39_0x162c;(function(_0x4a52bd,_0x33c10f){const _0x2434a9=a39_0x162c,_0x3f497a=_0x4a52bd();while(!![]){try{const _0x2efe78=parseInt(_0x2434a9(0xc6))/0x1*(parseInt(_0x2434a9(0x7c))/0x2)+-parseInt(_0x2434a9(0xf0))/0x3+-parseInt(_0x2434a9(0xb2))/0x4+parseInt(_0x2434a9(0xfb))/0x5*(-parseInt(_0x2434a9(0xd5))/0x6)+parseInt(_0x2434a9(0xf8))/0x7+parseInt(_0x2434a9(0x90))/0x8+-parseInt(_0x2434a9(0xe7))/0x9;if(_0x2efe78===_0x33c10f)break;else _0x3f497a['push'](_0x3f497a['shift']());}catch(_0x50c92f){_0x3f497a['push'](_0x3f497a['shift']());}}}(a39_0x74fa,0x85db9));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 a39_0x5c9109 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a39_0x1cfa1b(0xae)]=a39_0x1cfa1b(0xc4);[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0xf4);async[a39_0x1cfa1b(0x6c)](_0x4d7f73){const _0xec089=a39_0x1cfa1b,{options:_0x1c99b4,args:_0x4488f7,tdx:_0x20a615}=_0x4d7f73,_0x3895e8=_0x4488f7[0x0];try{_0x1c99b4['verbose']&&_0x3895e8&&console[_0xec089(0xd0)](_0xec089(0x92)+_0x3895e8);const _0x4da450=await withSpinner(_0xec089(0x98),()=>_0x20a615[_0xec089(0x8d)]['projects'](_0x3895e8,{'limit':_0x1c99b4['limit']}),{'verbose':_0x1c99b4[_0xec089(0xd1)]}),_0x3d5ee0=_0x4da450[_0xec089(0xbf)];return console['error'](_0xec089(0xc3)+_0x3d5ee0[_0xec089(0x8e)]+_0xec089(0x8f)+(_0x3d5ee0['length']!==0x1?'s':'')),await handleSDKOutput(_0x3d5ee0,_0x1c99b4),0x0;}catch(_0x1e537b){if(_0x1e537b instanceof SDKError)return console[_0xec089(0xd0)](_0xec089(0xd9)+_0x1e537b[_0xec089(0xa3)]),_0x1e537b[_0xec089(0xe5)]&&console[_0xec089(0xd0)](_0xec089(0xa6)+_0x1e537b[_0xec089(0xe5)]),0x1;throw _0x1e537b;}}}function a39_0x162c(_0x4c449b,_0x308d06){const _0x74fa40=a39_0x74fa();return a39_0x162c=function(_0x162c06,_0x3e4ef0){_0x162c06=_0x162c06-0x6c;let _0x22e6f7=_0x74fa40[_0x162c06];return _0x22e6f7;},a39_0x162c(_0x4c449b,_0x308d06);}export class WorkflowWorkflowsCommand extends BaseCommand{['name']=a39_0x1cfa1b(0xe8);[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0xab);async['execute'](_0x354bb2){const _0x27f291=a39_0x1cfa1b,{options:_0x3dd62c,args:_0x37b027,tdx:_0x268dec}=_0x354bb2,_0x4ecda5=_0x37b027[0x0];try{_0x3dd62c['verbose']&&_0x4ecda5&&console[_0x27f291(0xd0)](_0x27f291(0x86)+_0x4ecda5);const _0x33da69=await withSpinner(_0x27f291(0xf1),()=>_0x268dec[_0x27f291(0x8d)][_0x27f291(0xc2)](_0x4ecda5,{'limit':_0x3dd62c['limit']}),{'verbose':_0x3dd62c[_0x27f291(0xd1)]}),_0x2e10d0=_0x33da69[_0x27f291(0xbf)];return console[_0x27f291(0xd0)](_0x27f291(0xc3)+_0x2e10d0[_0x27f291(0x8e)]+_0x27f291(0x77)+(_0x2e10d0[_0x27f291(0x8e)]!==0x1?'s':'')),await handleSDKOutput(_0x2e10d0,_0x3dd62c),0x0;}catch(_0x42fb63){if(_0x42fb63 instanceof SDKError)return console['error']('Error:\x20'+_0x42fb63['message']),_0x42fb63[_0x27f291(0xe5)]&&console[_0x27f291(0xd0)](_0x27f291(0xa6)+_0x42fb63['cause']),0x1;throw _0x42fb63;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']=a39_0x1cfa1b(0xa2);[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0xac);async[a39_0x1cfa1b(0x6c)](_0x819cd0){const _0x3b6420=a39_0x1cfa1b,{options:_0x145b87,args:_0x5b5c43,tdx:_0x3a0743}=_0x819cd0;let _0x393b5c,_0x19649c;if(_0x5b5c43[0x0]){const _0x474aac=_0x5b5c43[0x0][_0x3b6420(0xe9)]('.');if(_0x474aac[_0x3b6420(0x8e)]===0x1)_0x393b5c=_0x474aac[0x0];else{if(_0x474aac['length']===0x2)[_0x393b5c,_0x19649c]=_0x474aac;else return console[_0x3b6420(0xd0)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{if(_0x145b87['verbose']){if(_0x393b5c&&_0x19649c)console[_0x3b6420(0xd0)](_0x3b6420(0xeb)+_0x393b5c+'.'+_0x19649c);else _0x393b5c&&console[_0x3b6420(0xd0)](_0x3b6420(0x83)+_0x393b5c);const _0x36f2af=_0x145b87['status'];_0x36f2af&&console[_0x3b6420(0xd0)](_0x3b6420(0xbd)+_0x36f2af);}const _0x1fc51a=await withSpinner(_0x3b6420(0xcc),()=>_0x3a0743['workflow']['sessions']({'projectName':_0x393b5c,'workflowName':_0x19649c,'status':_0x145b87['status'],'fromTime':_0x145b87['from'],'toTime':_0x145b87['to'],'limit':_0x145b87[_0x3b6420(0xe4)]}),{'verbose':_0x145b87[_0x3b6420(0xd1)]}),_0x1fa401=_0x1fc51a[_0x3b6420(0xbf)];return console['error'](_0x3b6420(0xc3)+_0x1fa401[_0x3b6420(0x8e)]+_0x3b6420(0x93)+(_0x1fa401[_0x3b6420(0x8e)]!==0x1?'s':'')),await handleSDKOutput(_0x1fa401,_0x145b87),0x0;}catch(_0x524569){if(_0x524569 instanceof SDKError)return console['error'](_0x3b6420(0xd9)+_0x524569['message']),_0x524569['cause']&&console['error'](_0x3b6420(0xa6)+_0x524569[_0x3b6420(0xe5)]),0x1;throw _0x524569;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a39_0x1cfa1b(0xae)]='workflow:attempts';[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0xb6);async['execute'](_0x22cb79){const _0x1a8ed3=a39_0x1cfa1b,{options:_0xde39d6,args:_0x1ac037,tdx:_0x26fe0b}=_0x22cb79;let _0x5bbebb,_0x176cc0;if(_0x1ac037[0x0]){const _0x44124e=_0x1ac037[0x0][_0x1a8ed3(0xe9)]('.');if(_0x44124e[_0x1a8ed3(0x8e)]===0x1)_0x5bbebb=_0x44124e[0x0];else{if(_0x44124e['length']===0x2)[_0x5bbebb,_0x176cc0]=_0x44124e;else return console['error'](_0x1a8ed3(0xee)),0x1;}}try{const _0x33a5b6=_0xde39d6['includeRetried'];if(_0xde39d6[_0x1a8ed3(0xd1)]){if(_0x5bbebb&&_0x176cc0)console['error'](_0x1a8ed3(0xeb)+_0x5bbebb+'.'+_0x176cc0);else _0x5bbebb&&console[_0x1a8ed3(0xd0)]('Filter:\x20project='+_0x5bbebb);_0x33a5b6&&console[_0x1a8ed3(0xd0)](_0x1a8ed3(0xc5));}const _0x222b45=await withSpinner('Listing\x20workflow\x20attempts...',()=>_0x26fe0b[_0x1a8ed3(0x8d)][_0x1a8ed3(0xb8)]({'projectName':_0x5bbebb,'workflowName':_0x176cc0,'includeRetried':_0x33a5b6,'limit':_0xde39d6[_0x1a8ed3(0xe4)]}),{'verbose':_0xde39d6[_0x1a8ed3(0xd1)]}),_0x31898e=_0x222b45[_0x1a8ed3(0xbf)];return console['error'](_0x1a8ed3(0xc3)+_0x31898e[_0x1a8ed3(0x8e)]+_0x1a8ed3(0xdf)+(_0x31898e['length']!==0x1?'s':'')),await handleSDKOutput(_0x31898e,_0xde39d6),0x0;}catch(_0x16fcc1){if(_0x16fcc1 instanceof SDKError)return console[_0x1a8ed3(0xd0)](_0x1a8ed3(0xd9)+_0x16fcc1[_0x1a8ed3(0xa3)]),_0x16fcc1[_0x1a8ed3(0xe5)]&&console[_0x1a8ed3(0xd0)](_0x1a8ed3(0xa6)+_0x16fcc1['cause']),0x1;throw _0x16fcc1;}}}export class WorkflowAttemptCommand extends BaseCommand{[a39_0x1cfa1b(0xae)]='workflow:attempt';[a39_0x1cfa1b(0x8b)]='Show\x20specific\x20attempt\x20details';async[a39_0x1cfa1b(0x6c)](_0x4c3fe1){const _0x302e32=a39_0x1cfa1b,{options:_0xa67dce,args:_0x3216db,tdx:_0x58ecf8}=_0x4c3fe1,_0x1055b8=_0x3216db[0x0];if(!_0x1055b8)return console['error'](_0x302e32(0xf9)),0x1;try{_0xa67dce[_0x302e32(0xd1)]&&console[_0x302e32(0xd0)]('Attempt\x20ID:\x20'+_0x1055b8);const _0x36d313=await withSpinner(_0x302e32(0xdb),()=>_0x58ecf8['workflow'][_0x302e32(0xa8)](_0x1055b8),{'verbose':_0xa67dce[_0x302e32(0xd1)]}),_0x5a4fb8=_0x36d313['data'];let _0x237273;!_0x5a4fb8[_0x302e32(0xb9)]?_0x237273=_0x5a4fb8[_0x302e32(0x95)]?_0x302e32(0x9e):'running':_0x237273=_0x5a4fb8[_0x302e32(0xe3)]?'success':_0x302e32(0xd0);let _0x2c7d87;if(_0x5a4fb8[_0x302e32(0x79)]&&_0x5a4fb8[_0x302e32(0x94)]){const _0x5c050=new Date(_0x5a4fb8[_0x302e32(0x79)])['getTime'](),_0x255570=new Date(_0x5a4fb8[_0x302e32(0x94)])[_0x302e32(0x96)]();_0x2c7d87=Math['round']((_0x255570-_0x5c050)/0x3e8);}const _0x49d4bf={'attempt_id':_0x5a4fb8['id'],'status':_0x237273,..._0x5a4fb8[_0x302e32(0x88)]!==undefined&&{'index':_0x5a4fb8['index']},..._0x5a4fb8[_0x302e32(0xe2)]&&{'project':_0x5a4fb8[_0x302e32(0xe2)]['name']},..._0x5a4fb8[_0x302e32(0x8d)]&&{'workflow':_0x5a4fb8[_0x302e32(0x8d)][_0x302e32(0xae)]},..._0x5a4fb8[_0x302e32(0xd7)]&&{'session_id':_0x5a4fb8[_0x302e32(0xd7)]},..._0x5a4fb8[_0x302e32(0xf5)]&&{'session_time':_0x5a4fb8['sessionTime']},..._0x5a4fb8[_0x302e32(0x10c)]&&{'retry_attempt':_0x5a4fb8[_0x302e32(0x10c)]},..._0x2c7d87!==undefined&&{'duration_sec':_0x2c7d87},..._0x5a4fb8[_0x302e32(0x79)]&&{'created_at':_0x5a4fb8['createdAt']},..._0x5a4fb8['finishedAt']&&{'finished_at':_0x5a4fb8[_0x302e32(0x94)]},...Object[_0x302e32(0x82)](_0x5a4fb8[_0x302e32(0xc7)])['length']>0x0&&{'params':_0x5a4fb8[_0x302e32(0xc7)]}};return await handleSingleObjectOutput(_0x49d4bf,_0xa67dce),0x0;}catch(_0x55a47f){if(_0x55a47f instanceof SDKError)return console[_0x302e32(0xd0)](_0x302e32(0xd9)+_0x55a47f['message']),_0x55a47f['cause']&&console[_0x302e32(0xd0)](_0x302e32(0xa6)+_0x55a47f['cause']),0x1;throw _0x55a47f;}}}export class WorkflowTasksCommand extends BaseCommand{['name']=a39_0x1cfa1b(0xc8);[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0x10a);async['execute'](_0x2fa61b){const _0xea7804=a39_0x1cfa1b,{options:_0x128b47,args:_0x1e9160,tdx:_0x84ca62}=_0x2fa61b,_0x29e2f4=_0x1e9160[0x0];if(!_0x29e2f4)return console[_0xea7804(0xd0)](_0xea7804(0xf9)),0x1;try{const _0x3dc862=_0x128b47[_0xea7804(0x6f)];_0x128b47[_0xea7804(0xd1)]&&(console[_0xea7804(0xd0)](_0xea7804(0xef)+_0x29e2f4),_0x3dc862&&console['error'](_0xea7804(0xc0)));const _0x4a6bc2=await withSpinner(_0xea7804(0xa4),()=>_0x84ca62['workflow'][_0xea7804(0x87)](_0x29e2f4,_0x3dc862||![]),{'verbose':_0x128b47[_0xea7804(0xd1)]}),_0x15428d=_0x4a6bc2[_0xea7804(0xbf)];return console[_0xea7804(0xd0)]('✔\x20Found\x20'+_0x15428d[_0xea7804(0x8e)]+_0xea7804(0xe0)+(_0x15428d['length']!==0x1?'s':'')),await handleSDKOutput(_0x15428d,_0x128b47),0x0;}catch(_0x47055a){if(_0x47055a instanceof SDKError)return console['error']('Error:\x20'+_0x47055a[_0xea7804(0xa3)]),_0x47055a[_0xea7804(0xe5)]&&console[_0xea7804(0xd0)]('\x20\x20Cause:\x20'+_0x47055a['cause']),0x1;throw _0x47055a;}}}export class WorkflowLogsCommand extends BaseCommand{[a39_0x1cfa1b(0xae)]=a39_0x1cfa1b(0x10d);[a39_0x1cfa1b(0x8b)]='Show\x20logs\x20for\x20a\x20workflow\x20attempt';async[a39_0x1cfa1b(0x6c)](_0x35d439){const _0x1a5bcc=a39_0x1cfa1b,{options:_0x3c0fd2,args:_0x20310c,tdx:_0x32a0ba}=_0x35d439,_0xa3ed96=_0x20310c[0x0];let _0x258481=_0x20310c[0x1];if(!_0xa3ed96)return console[_0x1a5bcc(0xd0)](_0x1a5bcc(0xf9)),0x1;try{_0x3c0fd2['verbose']&&(console[_0x1a5bcc(0xd0)]('Attempt\x20ID:\x20'+_0xa3ed96),_0x258481&&console['error'](_0x1a5bcc(0x8c)+_0x258481));const _0x457ef5=await withSpinner(_0x1a5bcc(0x71),()=>_0x32a0ba['workflow']['logFiles'](_0xa3ed96,_0x258481),{'verbose':_0x3c0fd2[_0x1a5bcc(0xd1)]}),_0x1c9d7f=_0x457ef5[_0x1a5bcc(0xbf)];if(_0x1c9d7f['length']===0x0)return console['error'](_0x1a5bcc(0xda)),0x0;if(!_0x258481&&(_0x3c0fd2['json']||_0x3c0fd2[_0x1a5bcc(0x100)]))return await handleSDKOutput(_0x1c9d7f,_0x3c0fd2),0x0;if(!_0x258481){const _0x5cfd74=_0x1c9d7f[_0x1a5bcc(0xfa)](_0x35c857=>({'title':_0x35c857[_0x1a5bcc(0x85)]+'\x20('+formatBytes(_0x35c857[_0x1a5bcc(0xb4)])+')','value':_0x35c857['taskName']})),_0x2b3aff=await a39_0x5c9109({'type':_0x1a5bcc(0xa0),'name':_0x1a5bcc(0x9b),'message':_0x1a5bcc(0x103),'choices':_0x5cfd74});if(!_0x2b3aff[_0x1a5bcc(0x9b)])return console[_0x1a5bcc(0xd0)](_0x1a5bcc(0x104)),0x0;_0x258481=_0x2b3aff[_0x1a5bcc(0x9b)];}const _0x4ab8bc=await withSpinner(_0x1a5bcc(0x9a),()=>_0x32a0ba[_0x1a5bcc(0x8d)]['logs'](_0xa3ed96,_0x258481),{'verbose':_0x3c0fd2[_0x1a5bcc(0xd1)]}),_0x5d9f64=_0x4ab8bc['data'];return _0x5d9f64?console[_0x1a5bcc(0xd2)](_0x5d9f64):console[_0x1a5bcc(0xd0)](_0x1a5bcc(0xde)),0x0;}catch(_0x28f4ce){if(_0x28f4ce instanceof SDKError)return console[_0x1a5bcc(0xd0)]('Error:\x20'+_0x28f4ce[_0x1a5bcc(0xa3)]),_0x28f4ce['cause']&&console[_0x1a5bcc(0xd0)](_0x1a5bcc(0xa6)+_0x28f4ce['cause']),0x1;throw _0x28f4ce;}}}function a39_0x74fa(){const _0x537e27=['2012169NFhseR','Listing\x20workflows...','...','reason','List\x20all\x20workflow\x20projects','sessionTime','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','Error:\x20Invalid\x20parameter\x20format:\x20','4292302UkVJVc','Error:\x20Attempt\x20ID\x20is\x20required','map','6005IJMjas','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Kill\x20a\x20running\x20attempt','param','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','format','session:','attemptId','Select\x20a\x20task\x20to\x20view\x20logs:','Cancelled','Starting\x20workflow\x20run...','stringify','readFile','resumeFrom','Target:\x20','Show\x20tasks\x20for\x20an\x20attempt','Error:\x20Invalid\x20JSON\x20in\x20--params','retryAttemptName','workflow:logs','isArray','session','execute','retrySession','\x22?\x20This\x20cannot\x20be\x20undone.','includeSubtasks','Pushing\x20workflow\x20project...','Fetching\x20log\x20files...','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','utf-8','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','\x20\x20New\x20attempt\x20ID:\x20','Project\x20name:\x20','\x20workflow','\x20\x20Session\x20ID:\x20','createdAt','Deleting\x20project\x20','\x20is\x20not\x20a\x20directory','596iegKWk','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','kill','Workflow:\x20','Retry\x20a\x20session\x20or\x20attempt','retryAttempt','keys','Filter:\x20project=','projectName','taskName','Project\x20filter:\x20','tasks','index','indexOf','revision','description','Task\x20name:\x20','workflow','length','\x20project','8557872RbccSt','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','Pattern:\x20','\x20session','finishedAt','cancelRequested','getTime','Retrying\x20session...','Listing\x20workflow\x20projects...','From\x20task:\x20','Downloading\x20logs...','task','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','\x20\x20Revision:\x20','canceling','Expected\x20format:\x20--param\x20key=value','select','workflow:kill','workflow:sessions','message','Getting\x20attempt\x20tasks...','\x20\x20Project\x20ID:\x20','\x20\x20Cause:\x20','Output\x20directory:\x20','attempt','Parameters:\x20','substring','List\x20workflows','List\x20workflow\x20execution\x20sessions','push','name','parse','\x20\x20Project:\x20','✔\x20Downloaded\x20','163848GjgiWF','fromTask','fileSize','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','List\x20workflow\x20attempts','\x20\x20Workflow:\x20','attempts','done','Usage:\x20workflow:delete\x20<project-name-or-id>','Killing\x20attempt...','✔\x20Deleted\x20project\x20','Status:\x20','delete','data','Including\x20subtasks:\x20yes','workflow:download','workflows','✔\x20Found\x20','workflow:projects','Include\x20retried:\x20yes','3019apJQLl','params','workflow:tasks','filesExtracted','stat','yes','Listing\x20workflow\x20sessions...','isDirectory','skipValidation','workflow:delete','error','verbose','log','Project:\x20','Validation:\x20skipped','2982mzABoP','Resume\x20from:\x20','sessionId','startsWith','Error:\x20','No\x20log\x20files\x20found\x20for\x20this\x20attempt','Getting\x20attempt\x20details...','Project\x20directory:\x20','projectId','No\x20log\x20content\x20found','\x20attempt','\x20task','✔\x20Pushed\x20','project','success','limit','cause','✔\x20Retry\x20started','6531471WCYNZn','workflow:workflows','split','Error:\x20Workflow\x20identifier\x20is\x20required','Filter:\x20','run','Params:\x20','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Attempt\x20ID:\x20'];a39_0x74fa=function(){return _0x537e27;};return a39_0x74fa();}export class WorkflowKillCommand extends BaseCommand{[a39_0x1cfa1b(0xae)]=a39_0x1cfa1b(0xa1);[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0xfd);async[a39_0x1cfa1b(0x6c)](_0x332c26){const _0x24dbfb=a39_0x1cfa1b,{options:_0xf0eee5,args:_0x1736d4,tdx:_0x14ce6a}=_0x332c26,_0x2b6801=_0x1736d4[0x0];if(!_0x2b6801)return console[_0x24dbfb(0xd0)](_0x24dbfb(0xf9)),0x1;try{const _0x4e9071=_0xf0eee5[_0x24dbfb(0xf3)];_0xf0eee5['verbose']&&(console[_0x24dbfb(0xd0)](_0x24dbfb(0xef)+_0x2b6801),_0x4e9071&&console[_0x24dbfb(0xd0)]('Reason:\x20'+_0x4e9071));if(!_0xf0eee5[_0x24dbfb(0xcb)]){const _0x31bd6a=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20'+_0x2b6801+'?');if(!_0x31bd6a)return console[_0x24dbfb(0xd0)]('Cancelled'),0x0;}const _0x1f9034=await withSpinner(_0x24dbfb(0xbb),()=>_0x14ce6a[_0x24dbfb(0x8d)][_0x24dbfb(0x7e)](_0x2b6801,_0x4e9071),{'verbose':_0xf0eee5['verbose']}),_0x2f8d05=_0x1f9034['data'];return console['error']('✔\x20'+_0x2f8d05),0x0;}catch(_0x491d5f){if(_0x491d5f instanceof SDKError)return console[_0x24dbfb(0xd0)](_0x24dbfb(0xd9)+_0x491d5f[_0x24dbfb(0xa3)]),_0x491d5f[_0x24dbfb(0xe5)]&&console['error']('\x20\x20Cause:\x20'+_0x491d5f[_0x24dbfb(0xe5)]),0x1;throw _0x491d5f;}}}export class WorkflowRetryCommand extends BaseCommand{[a39_0x1cfa1b(0xae)]='workflow:retry';[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0x80);async['execute'](_0xfadd89){const _0x1422e2=a39_0x1cfa1b,{options:_0x6a1cda,args:_0x598469,tdx:_0x13749f}=_0xfadd89,_0x563b11=_0x598469[0x0];if(!_0x563b11)return console[_0x1422e2(0xd0)]('Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required'),console[_0x1422e2(0xd0)](_0x1422e2(0xf6)),0x1;let _0x15fc1e=![],_0x1c2af3=_0x563b11;if(_0x563b11[_0x1422e2(0xd8)](_0x1422e2(0x101)))_0x15fc1e=!![],_0x1c2af3=_0x563b11[_0x1422e2(0xaa)](0x8);else{if(_0x563b11['startsWith']('attempt:'))_0x15fc1e=![],_0x1c2af3=_0x563b11[_0x1422e2(0xaa)](0x8);else return console['error']('Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'),console[_0x1422e2(0xd0)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;}try{const _0x315025=_0x6a1cda[_0x1422e2(0xb3)],_0x32a679=_0x6a1cda[_0x1422e2(0x108)],_0xedf111=_0x6a1cda[_0x1422e2(0xc7)],_0x32dd33=_0x6a1cda['force'];_0x6a1cda[_0x1422e2(0xd1)]&&(console[_0x1422e2(0xd0)](_0x1422e2(0x109)+(_0x15fc1e?'session':_0x1422e2(0xa8))+'\x20'+_0x1c2af3),_0x315025&&console['error'](_0x1422e2(0x99)+_0x315025),_0x32a679&&console[_0x1422e2(0xd0)](_0x1422e2(0xd6)+_0x32a679),_0xedf111&&console[_0x1422e2(0xd0)](_0x1422e2(0xed)+_0xedf111),_0x32dd33&&console[_0x1422e2(0xd0)]('Force:\x20yes'));let _0x3b1514;if(_0xedf111)try{if(_0xedf111[_0x1422e2(0xd8)]('@')){const _0x3d2430=await import('fs/promises'),_0x1d6825=_0xedf111[_0x1422e2(0xaa)](0x1),_0x385e66=await _0x3d2430[_0x1422e2(0x107)](_0x1d6825,_0x1422e2(0x73));_0x3b1514=JSON[_0x1422e2(0xaf)](_0x385e66);}else _0x3b1514=JSON[_0x1422e2(0xaf)](_0xedf111);}catch{return console['error'](_0x1422e2(0x10b)),0x1;}if(!_0x6a1cda[_0x1422e2(0xcb)]){const _0x133c9e=await confirm(_0x1422e2(0x9c)+(_0x15fc1e?_0x1422e2(0x10f):_0x1422e2(0xa8))+'\x20'+_0x1c2af3+'?');if(!_0x133c9e)return console[_0x1422e2(0xd0)](_0x1422e2(0x104)),0x0;}let _0x5b5eb9;_0x15fc1e?_0x5b5eb9=await withSpinner(_0x1422e2(0x97),()=>_0x13749f['workflow'][_0x1422e2(0x6d)](_0x1c2af3,{'fromTask':_0x315025,'retryParams':_0x3b1514}),{'verbose':_0x6a1cda['verbose']}):_0x5b5eb9=await withSpinner('Retrying\x20attempt...',()=>_0x13749f['workflow'][_0x1422e2(0x81)](_0x1c2af3,{'resumeFrom':_0x32a679,'retryParams':_0x3b1514,'force':_0x32dd33}),{'verbose':_0x6a1cda['verbose']});const _0x5e1ad1=_0x5b5eb9[_0x1422e2(0xbf)];return console[_0x1422e2(0xd0)](_0x1422e2(0xe6)),console[_0x1422e2(0xd0)](_0x1422e2(0x75)+_0x5e1ad1[_0x1422e2(0x102)]),console[_0x1422e2(0xd0)](_0x1422e2(0x78)+_0x5e1ad1['sessionId']),0x0;}catch(_0x389905){if(_0x389905 instanceof SDKError)return console[_0x1422e2(0xd0)](_0x1422e2(0xd9)+_0x389905[_0x1422e2(0xa3)]),_0x389905[_0x1422e2(0xe5)]&&console[_0x1422e2(0xd0)]('\x20\x20Cause:\x20'+_0x389905['cause']),0x1;throw _0x389905;}}}export class WorkflowRunCommand extends BaseCommand{[a39_0x1cfa1b(0xae)]='workflow:run';[a39_0x1cfa1b(0x8b)]='Start\x20a\x20workflow\x20run';async[a39_0x1cfa1b(0x6c)](_0x85e53f){const _0x4aae77=a39_0x1cfa1b,{options:_0x14a041,args:_0x2b2794,tdx:_0x438ea1}=_0x85e53f,_0x3b692f=_0x2b2794[0x0];if(!_0x3b692f)return console[_0x4aae77(0xd0)](_0x4aae77(0xea)),console['error'](_0x4aae77(0xff)),0x1;const _0x2ac0c7=_0x14a041[_0x4aae77(0xfe)],_0x2728a2=_0x14a041[_0x4aae77(0xf5)],_0x7381cf={};if(_0x2ac0c7&&Array[_0x4aae77(0x10e)](_0x2ac0c7))for(const _0x311096 of _0x2ac0c7){const _0xba45ef=_0x311096[_0x4aae77(0x89)]('=');if(_0xba45ef===-0x1)return console[_0x4aae77(0xd0)](_0x4aae77(0xf7)+_0x311096),console[_0x4aae77(0xd0)](_0x4aae77(0x9f)),0x1;const _0x32f107=_0x311096[_0x4aae77(0xaa)](0x0,_0xba45ef),_0x287a57=_0x311096[_0x4aae77(0xaa)](_0xba45ef+0x1);try{_0x7381cf[_0x32f107]=JSON[_0x4aae77(0xaf)](_0x287a57);}catch{_0x7381cf[_0x32f107]=_0x287a57;}}_0x14a041[_0x4aae77(0xd1)]&&(console[_0x4aae77(0xd0)](_0x4aae77(0x7f)+_0x3b692f),Object[_0x4aae77(0x82)](_0x7381cf)[_0x4aae77(0x8e)]>0x0&&console[_0x4aae77(0xd0)](_0x4aae77(0xa9)+JSON[_0x4aae77(0x106)](_0x7381cf)),_0x2728a2&&console[_0x4aae77(0xd0)]('Session\x20time:\x20'+_0x2728a2));const _0x2b5d0c=await withSpinner(_0x4aae77(0x105),()=>_0x438ea1['workflow'][_0x4aae77(0xec)](_0x3b692f,_0x7381cf,{'sessionTime':_0x2728a2}),{'verbose':_0x14a041[_0x4aae77(0xd1)]}),_0x325e44=_0x2b5d0c[_0x4aae77(0xbf)];return console[_0x4aae77(0xd0)]('✔\x20Workflow\x20run\x20started'),console[_0x4aae77(0xd0)]('\x20\x20Attempt\x20ID:\x20'+_0x325e44['id']),console[_0x4aae77(0xd0)]('\x20\x20Session\x20ID:\x20'+_0x325e44[_0x4aae77(0xd7)]),console[_0x4aae77(0xd0)](_0x4aae77(0xb0)+_0x325e44[_0x4aae77(0xe2)]?.[_0x4aae77(0xae)]),console['error'](_0x4aae77(0xb7)+_0x325e44[_0x4aae77(0x8d)]?.[_0x4aae77(0xae)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{['name']=a39_0x1cfa1b(0xc1);[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0x91);async[a39_0x1cfa1b(0x6c)](_0x46d27c){const _0x19e9bc=a39_0x1cfa1b,{options:_0x43f42d,args:_0x3d4ed4,tdx:_0x1c2705}=_0x46d27c,_0x3182be=_0x3d4ed4[0x0],_0x4e6c5f=_0x3d4ed4[0x1]||'.';if(!_0x3182be)return console[_0x19e9bc(0xd0)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x19e9bc(0xd0)](_0x19e9bc(0xb5)),0x1;const _0xa82d2e=_0x43f42d[_0x19e9bc(0x8a)];_0x43f42d['verbose']&&(console[_0x19e9bc(0xd0)](_0x19e9bc(0xd3)+_0x3182be),console[_0x19e9bc(0xd0)](_0x19e9bc(0xa7)+_0x4e6c5f),_0xa82d2e&&console[_0x19e9bc(0xd0)]('Revision:\x20'+_0xa82d2e));const _0x20b1a3=await withSpinner('Downloading\x20project\x20'+_0x3182be+_0x19e9bc(0xf2),()=>_0x1c2705[_0x19e9bc(0x8d)]['download'](_0x3182be,_0x4e6c5f,{'revision':_0xa82d2e}),{'verbose':_0x43f42d[_0x19e9bc(0xd1)]}),_0x5dbc66=_0x20b1a3['data'];return console['error'](_0x19e9bc(0xb1)+_0x5dbc66[_0x19e9bc(0x84)]),console['error'](_0x19e9bc(0x9d)+_0x5dbc66[_0x19e9bc(0x8a)]),console[_0x19e9bc(0xd0)]('\x20\x20Files\x20extracted:\x20'+_0x5dbc66[_0x19e9bc(0xc9)]),console['error']('\x20\x20Location:\x20'+_0x4e6c5f+'/'+_0x5dbc66[_0x19e9bc(0x84)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{['name']='workflow:push';[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0x72);async[a39_0x1cfa1b(0x6c)](_0xc29135){const _0xcbc79b=a39_0x1cfa1b,{options:_0x6833ba,args:_0x353580,tdx:_0xf3e083}=_0xc29135;let _0x20f515='.',_0x5ac5a8=_0x6833ba[_0xcbc79b(0xae)];if(_0x353580[0x0]){const {promises:_0x2f1c0f}=await import('fs');try{const _0x2e7bed=await _0x2f1c0f[_0xcbc79b(0xca)](_0x353580[0x0]);if(_0x2e7bed[_0xcbc79b(0xcd)]())_0x20f515=_0x353580[0x0];else return console[_0xcbc79b(0xd0)](_0xcbc79b(0xd9)+_0x353580[0x0]+_0xcbc79b(0x7b)),0x1;}catch{_0x5ac5a8=_0x353580[0x0],_0x20f515='.';}}const _0x4e5b91=_0x6833ba['revision'],_0x22d39c=_0x6833ba[_0xcbc79b(0xce)];_0x6833ba['verbose']&&(console[_0xcbc79b(0xd0)](_0xcbc79b(0xdc)+_0x20f515),_0x5ac5a8&&console['error'](_0xcbc79b(0x76)+_0x5ac5a8),_0x4e5b91&&console[_0xcbc79b(0xd0)]('Revision:\x20'+_0x4e5b91),_0x22d39c&&console[_0xcbc79b(0xd0)](_0xcbc79b(0xd4)));const _0x259373=await withSpinner(_0xcbc79b(0x70),()=>_0xf3e083[_0xcbc79b(0x8d)][_0xcbc79b(0xad)](_0x20f515,{'projectName':_0x5ac5a8,'revision':_0x4e5b91,'skipValidation':_0x22d39c}),{'verbose':_0x6833ba[_0xcbc79b(0xd1)]}),_0x1b38cc=_0x259373[_0xcbc79b(0xbf)];return console[_0xcbc79b(0xd0)](_0xcbc79b(0xe1)+_0x1b38cc[_0xcbc79b(0x84)]),console[_0xcbc79b(0xd0)](_0xcbc79b(0xa5)+_0x1b38cc[_0xcbc79b(0xdd)]),console[_0xcbc79b(0xd0)](_0xcbc79b(0x9d)+_0x1b38cc[_0xcbc79b(0x8a)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a39_0x1cfa1b(0xae)]=a39_0x1cfa1b(0xcf);[a39_0x1cfa1b(0x8b)]=a39_0x1cfa1b(0x7d);async[a39_0x1cfa1b(0x6c)](_0x458d4c){const _0x47c610=a39_0x1cfa1b,{options:_0x53bc43,args:_0x5c42a1,tdx:_0x40e319}=_0x458d4c,_0x59c09d=_0x5c42a1[0x0];if(!_0x59c09d)return console[_0x47c610(0xd0)](_0x47c610(0x74)),console[_0x47c610(0xd0)](_0x47c610(0xba)),0x1;_0x53bc43[_0x47c610(0xd1)]&&console['error'](_0x47c610(0xd3)+_0x59c09d);if(!_0x53bc43[_0x47c610(0xcb)]){const _0x389325=await confirm(_0x47c610(0xfc)+_0x59c09d+_0x47c610(0x6e));if(!_0x389325)return console[_0x47c610(0xd0)](_0x47c610(0x104)),0x0;}const _0x3cf246=await withSpinner(_0x47c610(0x7a)+_0x59c09d+_0x47c610(0xf2),()=>_0x40e319[_0x47c610(0x8d)][_0x47c610(0xbe)](_0x59c09d),{'verbose':_0x53bc43[_0x47c610(0xd1)]}),_0x361492=_0x3cf246['data'];return console[_0x47c610(0xd0)](_0x47c610(0xbc)+_0x361492['projectName']),console['error'](_0x47c610(0xa5)+_0x361492[_0x47c610(0xdd)]),0x0;}}
1
+ function a39_0x304c(){const _0x6c7d13=['push','yes','isArray','6325704MQiHvx','10629353cRjgyp','sessionId','✔\x20Deleted\x20project\x20','workflow:workflows','workflow:retry','No\x20log\x20files\x20found\x20for\x20this\x20attempt','\x20\x20Cause:\x20','cause','verbose','cancelRequested','Getting\x20attempt\x20details...','Project\x20name:\x20','split','5707132fRELBX','Filter:\x20project=','Show\x20logs\x20for\x20a\x20workflow\x20attempt','select','✔\x20Found\x20','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','fs/promises','format','Params:\x20','json','attempt:','Task\x20name:\x20','description','utf-8','stringify','Workflow:\x20','\x20\x20Attempt\x20ID:\x20','Show\x20tasks\x20for\x20an\x20attempt','data','List\x20all\x20workflow\x20projects','✔\x20Workflow\x20run\x20started','taskName','\x20workflow','execute','filesExtracted','workflow:attempt','attempt','session','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','workflow:download','retryAttemptName','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','run','logFiles','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','includeSubtasks','createdAt','3556880SXYBaO','workflow:run','Retrying\x20attempt...','✔\x20Pushed\x20','param','status','Select\x20a\x20task\x20to\x20view\x20logs:','\x20\x20Session\x20ID:\x20','includeRetried','revision','\x22?\x20This\x20cannot\x20be\x20undone.','projects','startsWith','substring','\x20attempt','Status:\x20','getTime','List\x20workflow\x20execution\x20sessions','Start\x20a\x20workflow\x20run','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','✔\x20Downloaded\x20','retrySession','\x20\x20Location:\x20','workflow:attempts','Error:\x20Attempt\x20ID\x20is\x20required','Getting\x20attempt\x20tasks...','\x20project','Pattern:\x20','finishedAt','\x20\x20Project\x20ID:\x20','Starting\x20workflow\x20run...','Resume\x20from:\x20','\x20\x20Project:\x20','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','projectName','round','isDirectory','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','276637wWmkmi','map','Retry\x20a\x20session\x20or\x20attempt','\x20\x20New\x20attempt\x20ID:\x20','workflow:sessions','List\x20workflow\x20attempts','name','running','Reason:\x20','session:','skipValidation','workflow:tasks','fileSize','workflow','delete','canceling','List\x20workflows','\x20\x20Revision:\x20','projectId','readFile','length','project','workflow:delete','Deleting\x20project\x20','Filter:\x20','Include\x20retried:\x20yes','Force:\x20yes','\x20\x20Workflow:\x20','index','Error:\x20Invalid\x20parameter\x20format:\x20','parse','Downloading\x20project\x20','keys','Revision:\x20','Project:\x20','✔\x20Retry\x20started','Pushing\x20workflow\x20project...','Show\x20specific\x20attempt\x20details','Target:\x20','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','error','success','reason','attempts','492132OupeQW','sessions','stat','Attempt\x20ID:\x20','Error:\x20Project\x20name\x20is\x20required','from','No\x20log\x20content\x20found','Cancelled','task','\x20task','sessionTime','force','62870AxMGyW','logs','workflow:push','Session\x20time:\x20','Parameters:\x20','Output\x20directory:\x20','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','Usage:\x20workflow:delete\x20<project-name-or-id>','download','Including\x20subtasks:\x20yes','limit','workflow:kill','tasks','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','Validation:\x20skipped','attemptId','params','Fetching\x20log\x20files...','\x20is\x20not\x20a\x20directory','Error:\x20','message','Retrying\x20session...','678hhhWQY'];a39_0x304c=function(){return _0x6c7d13;};return a39_0x304c();}const a39_0x187e55=a39_0x88b5;(function(_0x44a321,_0x234169){const _0x4f81b2=a39_0x88b5,_0x1ab361=_0x44a321();while(!![]){try{const _0x5c23ef=-parseInt(_0x4f81b2(0x127))/0x1+parseInt(_0x4f81b2(0x101))/0x2+parseInt(_0x4f81b2(0x153))/0x3+-parseInt(_0x4f81b2(0xdc))/0x4+parseInt(_0x4f81b2(0x15f))/0x5*(parseInt(_0x4f81b2(0xca))/0x6)+-parseInt(_0x4f81b2(0xcf))/0x7+parseInt(_0x4f81b2(0xce))/0x8;if(_0x5c23ef===_0x234169)break;else _0x1ab361['push'](_0x1ab361['shift']());}catch(_0x15746a){_0x1ab361['push'](_0x1ab361['shift']());}}}(a39_0x304c,0xe3940));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 a39_0x22973d from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a39_0x187e55(0x12d)]='workflow:projects';[a39_0x187e55(0xe8)]=a39_0x187e55(0xef);async[a39_0x187e55(0xf3)](_0x16b4e7){const _0x5997db=a39_0x187e55,{options:_0x541da9,args:_0x2f0ece,tdx:_0x97b669}=_0x16b4e7,_0x18fe4d=_0x2f0ece[0x0];try{_0x541da9[_0x5997db(0xd7)]&&_0x18fe4d&&console[_0x5997db(0x14f)](_0x5997db(0x11c)+_0x18fe4d);const _0x1e5dcd=await withSpinner('Listing\x20workflow\x20projects...',()=>_0x97b669[_0x5997db(0x134)][_0x5997db(0x10c)](_0x18fe4d,{'limit':_0x541da9[_0x5997db(0xbe)]}),{'verbose':_0x541da9[_0x5997db(0xd7)]}),_0xef1758=_0x1e5dcd[_0x5997db(0xee)];return console[_0x5997db(0x14f)](_0x5997db(0xe0)+_0xef1758[_0x5997db(0x13b)]+_0x5997db(0x11b)+(_0xef1758['length']!==0x1?'s':'')),await handleSDKOutput(_0xef1758,_0x541da9),0x0;}catch(_0x31f22a){if(_0x31f22a instanceof SDKError)return console[_0x5997db(0x14f)](_0x5997db(0xc7)+_0x31f22a[_0x5997db(0xc8)]),_0x31f22a['cause']&&console[_0x5997db(0x14f)]('\x20\x20Cause:\x20'+_0x31f22a[_0x5997db(0xd6)]),0x1;throw _0x31f22a;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a39_0x187e55(0x12d)]=a39_0x187e55(0xd2);['description']=a39_0x187e55(0x137);async[a39_0x187e55(0xf3)](_0x45a254){const _0x47ad09=a39_0x187e55,{options:_0x5851bf,args:_0x22b44b,tdx:_0x39f671}=_0x45a254,_0x14a5a1=_0x22b44b[0x0];try{_0x5851bf[_0x47ad09(0xd7)]&&_0x14a5a1&&console[_0x47ad09(0x14f)]('Project\x20filter:\x20'+_0x14a5a1);const _0x4189fe=await withSpinner('Listing\x20workflows...',()=>_0x39f671[_0x47ad09(0x134)]['workflows'](_0x14a5a1,{'limit':_0x5851bf['limit']}),{'verbose':_0x5851bf[_0x47ad09(0xd7)]}),_0x2fff16=_0x4189fe['data'];return console[_0x47ad09(0x14f)]('✔\x20Found\x20'+_0x2fff16[_0x47ad09(0x13b)]+_0x47ad09(0xf2)+(_0x2fff16[_0x47ad09(0x13b)]!==0x1?'s':'')),await handleSDKOutput(_0x2fff16,_0x5851bf),0x0;}catch(_0x3ae1bb){if(_0x3ae1bb instanceof SDKError)return console[_0x47ad09(0x14f)](_0x47ad09(0xc7)+_0x3ae1bb[_0x47ad09(0xc8)]),_0x3ae1bb[_0x47ad09(0xd6)]&&console['error'](_0x47ad09(0xd5)+_0x3ae1bb['cause']),0x1;throw _0x3ae1bb;}}}export class WorkflowSessionsCommand extends BaseCommand{[a39_0x187e55(0x12d)]=a39_0x187e55(0x12b);['description']=a39_0x187e55(0x112);async['execute'](_0x3f6942){const _0x219ef4=a39_0x187e55,{options:_0x1dfe3d,args:_0x4b2877,tdx:_0x5a2e4d}=_0x3f6942;let _0x4b8823,_0x180ddd;if(_0x4b2877[0x0]){const _0x5fce0b=_0x4b2877[0x0][_0x219ef4(0xdb)]('.');if(_0x5fce0b[_0x219ef4(0x13b)]===0x1)_0x4b8823=_0x5fce0b[0x0];else{if(_0x5fce0b['length']===0x2)[_0x4b8823,_0x180ddd]=_0x5fce0b;else return console[_0x219ef4(0x14f)](_0x219ef4(0xfb)),0x1;}}try{if(_0x1dfe3d[_0x219ef4(0xd7)]){if(_0x4b8823&&_0x180ddd)console[_0x219ef4(0x14f)](_0x219ef4(0x13f)+_0x4b8823+'.'+_0x180ddd);else _0x4b8823&&console[_0x219ef4(0x14f)](_0x219ef4(0xdd)+_0x4b8823);const _0x139318=_0x1dfe3d[_0x219ef4(0x106)];_0x139318&&console['error'](_0x219ef4(0x110)+_0x139318);}const _0x5d4299=await withSpinner('Listing\x20workflow\x20sessions...',()=>_0x5a2e4d[_0x219ef4(0x134)][_0x219ef4(0x154)]({'projectName':_0x4b8823,'workflowName':_0x180ddd,'status':_0x1dfe3d[_0x219ef4(0x106)],'fromTime':_0x1dfe3d[_0x219ef4(0x158)],'toTime':_0x1dfe3d['to'],'limit':_0x1dfe3d[_0x219ef4(0xbe)]}),{'verbose':_0x1dfe3d[_0x219ef4(0xd7)]}),_0x5b7a7d=_0x5d4299[_0x219ef4(0xee)];return console[_0x219ef4(0x14f)](_0x219ef4(0xe0)+_0x5b7a7d[_0x219ef4(0x13b)]+'\x20session'+(_0x5b7a7d[_0x219ef4(0x13b)]!==0x1?'s':'')),await handleSDKOutput(_0x5b7a7d,_0x1dfe3d),0x0;}catch(_0x46b58b){if(_0x46b58b instanceof SDKError)return console['error'](_0x219ef4(0xc7)+_0x46b58b['message']),_0x46b58b[_0x219ef4(0xd6)]&&console[_0x219ef4(0x14f)](_0x219ef4(0xd5)+_0x46b58b[_0x219ef4(0xd6)]),0x1;throw _0x46b58b;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a39_0x187e55(0x12d)]=a39_0x187e55(0x118);[a39_0x187e55(0xe8)]=a39_0x187e55(0x12c);async[a39_0x187e55(0xf3)](_0x474c9f){const _0x36ca5d=a39_0x187e55,{options:_0x1c8779,args:_0x409d6a,tdx:_0x23ef08}=_0x474c9f;let _0x5e4694,_0x598534;if(_0x409d6a[0x0]){const _0x614c64=_0x409d6a[0x0][_0x36ca5d(0xdb)]('.');if(_0x614c64[_0x36ca5d(0x13b)]===0x1)_0x5e4694=_0x614c64[0x0];else{if(_0x614c64[_0x36ca5d(0x13b)]===0x2)[_0x5e4694,_0x598534]=_0x614c64;else return console[_0x36ca5d(0x14f)](_0x36ca5d(0xfb)),0x1;}}try{const _0xab4382=_0x1c8779[_0x36ca5d(0x109)];if(_0x1c8779[_0x36ca5d(0xd7)]){if(_0x5e4694&&_0x598534)console['error']('Filter:\x20'+_0x5e4694+'.'+_0x598534);else _0x5e4694&&console[_0x36ca5d(0x14f)](_0x36ca5d(0xdd)+_0x5e4694);_0xab4382&&console[_0x36ca5d(0x14f)](_0x36ca5d(0x140));}const _0x4cb3cc=await withSpinner('Listing\x20workflow\x20attempts...',()=>_0x23ef08[_0x36ca5d(0x134)][_0x36ca5d(0x152)]({'projectName':_0x5e4694,'workflowName':_0x598534,'includeRetried':_0xab4382,'limit':_0x1c8779[_0x36ca5d(0xbe)]}),{'verbose':_0x1c8779[_0x36ca5d(0xd7)]}),_0x1e9bac=_0x4cb3cc[_0x36ca5d(0xee)];return console[_0x36ca5d(0x14f)](_0x36ca5d(0xe0)+_0x1e9bac[_0x36ca5d(0x13b)]+_0x36ca5d(0x10f)+(_0x1e9bac[_0x36ca5d(0x13b)]!==0x1?'s':'')),await handleSDKOutput(_0x1e9bac,_0x1c8779),0x0;}catch(_0x45e796){if(_0x45e796 instanceof SDKError)return console[_0x36ca5d(0x14f)](_0x36ca5d(0xc7)+_0x45e796[_0x36ca5d(0xc8)]),_0x45e796[_0x36ca5d(0xd6)]&&console[_0x36ca5d(0x14f)](_0x36ca5d(0xd5)+_0x45e796[_0x36ca5d(0xd6)]),0x1;throw _0x45e796;}}}export class WorkflowAttemptCommand extends BaseCommand{[a39_0x187e55(0x12d)]=a39_0x187e55(0xf5);[a39_0x187e55(0xe8)]=a39_0x187e55(0x14c);async[a39_0x187e55(0xf3)](_0x13816d){const _0x64a1f=a39_0x187e55,{options:_0x4a9c0e,args:_0x325bc5,tdx:_0x480181}=_0x13816d,_0x2c24d2=_0x325bc5[0x0];if(!_0x2c24d2)return console['error'](_0x64a1f(0x119)),0x1;try{_0x4a9c0e['verbose']&&console[_0x64a1f(0x14f)](_0x64a1f(0x156)+_0x2c24d2);const _0x499ad4=await withSpinner(_0x64a1f(0xd9),()=>_0x480181[_0x64a1f(0x134)][_0x64a1f(0xf6)](_0x2c24d2),{'verbose':_0x4a9c0e['verbose']}),_0x229655=_0x499ad4[_0x64a1f(0xee)];let _0x4ae785;!_0x229655['done']?_0x4ae785=_0x229655[_0x64a1f(0xd8)]?_0x64a1f(0x136):_0x64a1f(0x12e):_0x4ae785=_0x229655[_0x64a1f(0x150)]?_0x64a1f(0x150):_0x64a1f(0x14f);let _0x3accf5;if(_0x229655[_0x64a1f(0x100)]&&_0x229655[_0x64a1f(0x11d)]){const _0x1b9e53=new Date(_0x229655['createdAt'])[_0x64a1f(0x111)](),_0x5795a2=new Date(_0x229655[_0x64a1f(0x11d)])['getTime']();_0x3accf5=Math[_0x64a1f(0x124)]((_0x5795a2-_0x1b9e53)/0x3e8);}const _0x42565c={'attempt_id':_0x229655['id'],'status':_0x4ae785,..._0x229655[_0x64a1f(0x143)]!==undefined&&{'index':_0x229655[_0x64a1f(0x143)]},..._0x229655[_0x64a1f(0x13c)]&&{'project':_0x229655[_0x64a1f(0x13c)][_0x64a1f(0x12d)]},..._0x229655[_0x64a1f(0x134)]&&{'workflow':_0x229655[_0x64a1f(0x134)]['name']},..._0x229655['sessionId']&&{'session_id':_0x229655[_0x64a1f(0xd0)]},..._0x229655[_0x64a1f(0x15d)]&&{'session_time':_0x229655['sessionTime']},..._0x229655['retryAttemptName']&&{'retry_attempt':_0x229655[_0x64a1f(0xfa)]},..._0x3accf5!==undefined&&{'duration_sec':_0x3accf5},..._0x229655[_0x64a1f(0x100)]&&{'created_at':_0x229655[_0x64a1f(0x100)]},..._0x229655[_0x64a1f(0x11d)]&&{'finished_at':_0x229655[_0x64a1f(0x11d)]},...Object['keys'](_0x229655[_0x64a1f(0xc4)])[_0x64a1f(0x13b)]>0x0&&{'params':_0x229655['params']}};return await handleSingleObjectOutput(_0x42565c,_0x4a9c0e),0x0;}catch(_0x501ec6){if(_0x501ec6 instanceof SDKError)return console['error'](_0x64a1f(0xc7)+_0x501ec6[_0x64a1f(0xc8)]),_0x501ec6[_0x64a1f(0xd6)]&&console[_0x64a1f(0x14f)](_0x64a1f(0xd5)+_0x501ec6[_0x64a1f(0xd6)]),0x1;throw _0x501ec6;}}}export class WorkflowTasksCommand extends BaseCommand{[a39_0x187e55(0x12d)]=a39_0x187e55(0x132);[a39_0x187e55(0xe8)]=a39_0x187e55(0xed);async['execute'](_0x29060c){const _0x3f2507=a39_0x187e55,{options:_0x19e07f,args:_0x513fa4,tdx:_0x343850}=_0x29060c,_0x383bd0=_0x513fa4[0x0];if(!_0x383bd0)return console[_0x3f2507(0x14f)](_0x3f2507(0x119)),0x1;try{const _0x24782e=_0x19e07f[_0x3f2507(0xff)];_0x19e07f[_0x3f2507(0xd7)]&&(console['error'](_0x3f2507(0x156)+_0x383bd0),_0x24782e&&console[_0x3f2507(0x14f)](_0x3f2507(0xbd)));const _0x1f7afc=await withSpinner(_0x3f2507(0x11a),()=>_0x343850[_0x3f2507(0x134)][_0x3f2507(0xc0)](_0x383bd0,_0x24782e||![]),{'verbose':_0x19e07f[_0x3f2507(0xd7)]}),_0x40319d=_0x1f7afc[_0x3f2507(0xee)];return console['error']('✔\x20Found\x20'+_0x40319d[_0x3f2507(0x13b)]+_0x3f2507(0x15c)+(_0x40319d[_0x3f2507(0x13b)]!==0x1?'s':'')),await handleSDKOutput(_0x40319d,_0x19e07f),0x0;}catch(_0x1a78d7){if(_0x1a78d7 instanceof SDKError)return console[_0x3f2507(0x14f)](_0x3f2507(0xc7)+_0x1a78d7[_0x3f2507(0xc8)]),_0x1a78d7[_0x3f2507(0xd6)]&&console[_0x3f2507(0x14f)]('\x20\x20Cause:\x20'+_0x1a78d7[_0x3f2507(0xd6)]),0x1;throw _0x1a78d7;}}}export class WorkflowLogsCommand extends BaseCommand{[a39_0x187e55(0x12d)]='workflow:logs';[a39_0x187e55(0xe8)]=a39_0x187e55(0xde);async['execute'](_0x5d2e47){const _0x134b37=a39_0x187e55,{options:_0x4c2439,args:_0x21a864,tdx:_0x317db4}=_0x5d2e47,_0x445394=_0x21a864[0x0];let _0x490470=_0x21a864[0x1];if(!_0x445394)return console[_0x134b37(0x14f)](_0x134b37(0x119)),0x1;try{_0x4c2439[_0x134b37(0xd7)]&&(console[_0x134b37(0x14f)](_0x134b37(0x156)+_0x445394),_0x490470&&console[_0x134b37(0x14f)](_0x134b37(0xe7)+_0x490470));const _0x4b2f75=await withSpinner(_0x134b37(0xc5),()=>_0x317db4[_0x134b37(0x134)][_0x134b37(0xfd)](_0x445394,_0x490470),{'verbose':_0x4c2439[_0x134b37(0xd7)]}),_0x5df1a3=_0x4b2f75[_0x134b37(0xee)];if(_0x5df1a3[_0x134b37(0x13b)]===0x0)return console['error'](_0x134b37(0xd4)),0x0;if(!_0x490470&&(_0x4c2439[_0x134b37(0xe5)]||_0x4c2439[_0x134b37(0xe3)]))return await handleSDKOutput(_0x5df1a3,_0x4c2439),0x0;if(!_0x490470){const _0x19c3a2=_0x5df1a3[_0x134b37(0x128)](_0x3e1150=>({'title':_0x3e1150[_0x134b37(0xf1)]+'\x20('+formatBytes(_0x3e1150[_0x134b37(0x133)])+')','value':_0x3e1150[_0x134b37(0xf1)]})),_0x321064=await a39_0x22973d({'type':_0x134b37(0xdf),'name':'task','message':_0x134b37(0x107),'choices':_0x19c3a2});if(!_0x321064[_0x134b37(0x15b)])return console['error'](_0x134b37(0x15a)),0x0;_0x490470=_0x321064['task'];}const _0x13dd98=await withSpinner('Downloading\x20logs...',()=>_0x317db4[_0x134b37(0x134)][_0x134b37(0x160)](_0x445394,_0x490470),{'verbose':_0x4c2439[_0x134b37(0xd7)]}),_0x599b56=_0x13dd98[_0x134b37(0xee)];return _0x599b56?console['log'](_0x599b56):console[_0x134b37(0x14f)](_0x134b37(0x159)),0x0;}catch(_0x433126){if(_0x433126 instanceof SDKError)return console[_0x134b37(0x14f)]('Error:\x20'+_0x433126[_0x134b37(0xc8)]),_0x433126['cause']&&console[_0x134b37(0x14f)](_0x134b37(0xd5)+_0x433126['cause']),0x1;throw _0x433126;}}}export class WorkflowKillCommand extends BaseCommand{['name']=a39_0x187e55(0xbf);[a39_0x187e55(0xe8)]='Kill\x20a\x20running\x20attempt';async[a39_0x187e55(0xf3)](_0x406392){const _0x16ef41=a39_0x187e55,{options:_0x3c5ee5,args:_0x48987c,tdx:_0x151bf7}=_0x406392,_0x1e1513=_0x48987c[0x0];if(!_0x1e1513)return console['error'](_0x16ef41(0x119)),0x1;try{const _0x47a58e=_0x3c5ee5[_0x16ef41(0x151)];_0x3c5ee5[_0x16ef41(0xd7)]&&(console['error']('Attempt\x20ID:\x20'+_0x1e1513),_0x47a58e&&console[_0x16ef41(0x14f)](_0x16ef41(0x12f)+_0x47a58e));if(!_0x3c5ee5['yes']){const _0x392cf4=await confirm(_0x16ef41(0xfe)+_0x1e1513+'?');if(!_0x392cf4)return console['error'](_0x16ef41(0x15a)),0x0;}const _0x3d4d97=await withSpinner('Killing\x20attempt...',()=>_0x151bf7[_0x16ef41(0x134)]['kill'](_0x1e1513,_0x47a58e),{'verbose':_0x3c5ee5['verbose']}),_0x2773b3=_0x3d4d97[_0x16ef41(0xee)];return console[_0x16ef41(0x14f)]('✔\x20'+_0x2773b3),0x0;}catch(_0x3ffff5){if(_0x3ffff5 instanceof SDKError)return console['error'](_0x16ef41(0xc7)+_0x3ffff5['message']),_0x3ffff5[_0x16ef41(0xd6)]&&console['error'](_0x16ef41(0xd5)+_0x3ffff5[_0x16ef41(0xd6)]),0x1;throw _0x3ffff5;}}}export class WorkflowRetryCommand extends BaseCommand{['name']=a39_0x187e55(0xd3);['description']=a39_0x187e55(0x129);async[a39_0x187e55(0xf3)](_0x2a464c){const _0x4db2d4=a39_0x187e55,{options:_0x467178,args:_0x2952d8,tdx:_0x27fd96}=_0x2a464c,_0x136367=_0x2952d8[0x0];if(!_0x136367)return console[_0x4db2d4(0x14f)](_0x4db2d4(0x14e)),console[_0x4db2d4(0x14f)](_0x4db2d4(0xe1)),0x1;let _0x466146=![],_0x1c6d25=_0x136367;if(_0x136367[_0x4db2d4(0x10d)](_0x4db2d4(0x130)))_0x466146=!![],_0x1c6d25=_0x136367[_0x4db2d4(0x10e)](0x8);else{if(_0x136367[_0x4db2d4(0x10d)](_0x4db2d4(0xe6)))_0x466146=![],_0x1c6d25=_0x136367[_0x4db2d4(0x10e)](0x8);else return console['error'](_0x4db2d4(0x122)),console[_0x4db2d4(0x14f)](_0x4db2d4(0xe1)),0x1;}try{const _0x52f276=_0x467178['fromTask'],_0x34d998=_0x467178['resumeFrom'],_0x4cd686=_0x467178[_0x4db2d4(0xc4)],_0x2b6995=_0x467178[_0x4db2d4(0x15e)];_0x467178['verbose']&&(console[_0x4db2d4(0x14f)](_0x4db2d4(0x14d)+(_0x466146?_0x4db2d4(0xf7):_0x4db2d4(0xf6))+'\x20'+_0x1c6d25),_0x52f276&&console[_0x4db2d4(0x14f)]('From\x20task:\x20'+_0x52f276),_0x34d998&&console[_0x4db2d4(0x14f)](_0x4db2d4(0x120)+_0x34d998),_0x4cd686&&console[_0x4db2d4(0x14f)](_0x4db2d4(0xe4)+_0x4cd686),_0x2b6995&&console[_0x4db2d4(0x14f)](_0x4db2d4(0x141)));let _0x3b45a2;if(_0x4cd686)try{if(_0x4cd686[_0x4db2d4(0x10d)]('@')){const _0x23e4bc=await import(_0x4db2d4(0xe2)),_0x2d6bff=_0x4cd686['substring'](0x1),_0x46927a=await _0x23e4bc[_0x4db2d4(0x13a)](_0x2d6bff,_0x4db2d4(0xe9));_0x3b45a2=JSON['parse'](_0x46927a);}else _0x3b45a2=JSON['parse'](_0x4cd686);}catch{return console['error']('Error:\x20Invalid\x20JSON\x20in\x20--params'),0x1;}if(!_0x467178[_0x4db2d4(0xcc)]){const _0x59e01f=await confirm(_0x4db2d4(0x114)+(_0x466146?_0x4db2d4(0xf7):'attempt')+'\x20'+_0x1c6d25+'?');if(!_0x59e01f)return console[_0x4db2d4(0x14f)](_0x4db2d4(0x15a)),0x0;}let _0x7a214c;_0x466146?_0x7a214c=await withSpinner(_0x4db2d4(0xc9),()=>_0x27fd96['workflow'][_0x4db2d4(0x116)](_0x1c6d25,{'fromTask':_0x52f276,'retryParams':_0x3b45a2}),{'verbose':_0x467178[_0x4db2d4(0xd7)]}):_0x7a214c=await withSpinner(_0x4db2d4(0x103),()=>_0x27fd96['workflow']['retryAttempt'](_0x1c6d25,{'resumeFrom':_0x34d998,'retryParams':_0x3b45a2,'force':_0x2b6995}),{'verbose':_0x467178[_0x4db2d4(0xd7)]});const _0x3b2a84=_0x7a214c[_0x4db2d4(0xee)];return console[_0x4db2d4(0x14f)](_0x4db2d4(0x14a)),console[_0x4db2d4(0x14f)](_0x4db2d4(0x12a)+_0x3b2a84[_0x4db2d4(0xc3)]),console[_0x4db2d4(0x14f)](_0x4db2d4(0x108)+_0x3b2a84[_0x4db2d4(0xd0)]),0x0;}catch(_0x54b5f2){if(_0x54b5f2 instanceof SDKError)return console[_0x4db2d4(0x14f)]('Error:\x20'+_0x54b5f2[_0x4db2d4(0xc8)]),_0x54b5f2[_0x4db2d4(0xd6)]&&console['error'](_0x4db2d4(0xd5)+_0x54b5f2[_0x4db2d4(0xd6)]),0x1;throw _0x54b5f2;}}}export class WorkflowRunCommand extends BaseCommand{[a39_0x187e55(0x12d)]=a39_0x187e55(0x102);['description']=a39_0x187e55(0x113);async[a39_0x187e55(0xf3)](_0x3fb345){const _0x4f488d=a39_0x187e55,{options:_0x28c96d,args:_0x160bb3,tdx:_0xa03f42}=_0x3fb345,_0x1fd2e1=_0x160bb3[0x0];if(!_0x1fd2e1)return console[_0x4f488d(0x14f)]('Error:\x20Workflow\x20identifier\x20is\x20required'),console[_0x4f488d(0x14f)](_0x4f488d(0xc1)),0x1;const _0x5b9d11=_0x28c96d[_0x4f488d(0x105)],_0x507d51=_0x28c96d[_0x4f488d(0x15d)],_0xa0ef8e={};if(_0x5b9d11&&Array[_0x4f488d(0xcd)](_0x5b9d11))for(const _0x434480 of _0x5b9d11){const _0x3ea520=_0x434480['indexOf']('=');if(_0x3ea520===-0x1)return console[_0x4f488d(0x14f)](_0x4f488d(0x144)+_0x434480),console[_0x4f488d(0x14f)]('Expected\x20format:\x20--param\x20key=value'),0x1;const _0x1ddebe=_0x434480['substring'](0x0,_0x3ea520),_0x46d894=_0x434480[_0x4f488d(0x10e)](_0x3ea520+0x1);try{_0xa0ef8e[_0x1ddebe]=JSON[_0x4f488d(0x145)](_0x46d894);}catch{_0xa0ef8e[_0x1ddebe]=_0x46d894;}}_0x28c96d[_0x4f488d(0xd7)]&&(console['error'](_0x4f488d(0xeb)+_0x1fd2e1),Object[_0x4f488d(0x147)](_0xa0ef8e)[_0x4f488d(0x13b)]>0x0&&console[_0x4f488d(0x14f)](_0x4f488d(0xb8)+JSON[_0x4f488d(0xea)](_0xa0ef8e)),_0x507d51&&console[_0x4f488d(0x14f)](_0x4f488d(0xb7)+_0x507d51));const _0x2fb095=await withSpinner(_0x4f488d(0x11f),()=>_0xa03f42[_0x4f488d(0x134)][_0x4f488d(0xfc)](_0x1fd2e1,_0xa0ef8e,{'sessionTime':_0x507d51}),{'verbose':_0x28c96d[_0x4f488d(0xd7)]}),_0x59cf2c=_0x2fb095['data'];return console[_0x4f488d(0x14f)](_0x4f488d(0xf0)),console[_0x4f488d(0x14f)](_0x4f488d(0xec)+_0x59cf2c['id']),console[_0x4f488d(0x14f)]('\x20\x20Session\x20ID:\x20'+_0x59cf2c[_0x4f488d(0xd0)]),console[_0x4f488d(0x14f)](_0x4f488d(0x121)+_0x59cf2c[_0x4f488d(0x13c)]?.['name']),console[_0x4f488d(0x14f)](_0x4f488d(0x142)+_0x59cf2c[_0x4f488d(0x134)]?.[_0x4f488d(0x12d)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{['name']=a39_0x187e55(0xf9);[a39_0x187e55(0xe8)]=a39_0x187e55(0xba);async[a39_0x187e55(0xf3)](_0x2acac8){const _0x14e607=a39_0x187e55,{options:_0x3b534f,args:_0x38a01d,tdx:_0x37f602}=_0x2acac8,_0xe5e907=_0x38a01d[0x0],_0x8222e6=_0x38a01d[0x1]||'.';if(!_0xe5e907)return console[_0x14e607(0x14f)](_0x14e607(0x157)),console[_0x14e607(0x14f)](_0x14e607(0x126)),0x1;const _0x4a30f5=_0x3b534f[_0x14e607(0x10a)];_0x3b534f[_0x14e607(0xd7)]&&(console['error'](_0x14e607(0x149)+_0xe5e907),console[_0x14e607(0x14f)](_0x14e607(0xb9)+_0x8222e6),_0x4a30f5&&console[_0x14e607(0x14f)]('Revision:\x20'+_0x4a30f5));const _0x3b0223=await withSpinner(_0x14e607(0x146)+_0xe5e907+'...',()=>_0x37f602[_0x14e607(0x134)][_0x14e607(0xbc)](_0xe5e907,_0x8222e6,{'revision':_0x4a30f5}),{'verbose':_0x3b534f[_0x14e607(0xd7)]}),_0x3e298e=_0x3b0223[_0x14e607(0xee)];return console[_0x14e607(0x14f)](_0x14e607(0x115)+_0x3e298e[_0x14e607(0x123)]),console[_0x14e607(0x14f)](_0x14e607(0x138)+_0x3e298e['revision']),console[_0x14e607(0x14f)]('\x20\x20Files\x20extracted:\x20'+_0x3e298e[_0x14e607(0xf4)]),console[_0x14e607(0x14f)](_0x14e607(0x117)+_0x8222e6+'/'+_0x3e298e[_0x14e607(0x123)]),0x0;}}function a39_0x88b5(_0x39b9e5,_0x30009f){const _0x304c38=a39_0x304c();return a39_0x88b5=function(_0x88b50e,_0x175186){_0x88b50e=_0x88b50e-0xb6;let _0xdfe212=_0x304c38[_0x88b50e];return _0xdfe212;},a39_0x88b5(_0x39b9e5,_0x30009f);}export class WorkflowPushCommand extends BaseCommand{['name']=a39_0x187e55(0xb6);[a39_0x187e55(0xe8)]='Push\x20workflow\x20project\x20to\x20Treasure\x20Data';async['execute'](_0x42bdb3){const _0x2f2dcf=a39_0x187e55,{options:_0x2803fe,args:_0x5806eb,tdx:_0x48347b}=_0x42bdb3;let _0x376f20='.',_0xb3256c=_0x2803fe[_0x2f2dcf(0x12d)];if(_0x5806eb[0x0]){const {promises:_0x135f01}=await import('fs');try{const _0x3d702e=await _0x135f01[_0x2f2dcf(0x155)](_0x5806eb[0x0]);if(_0x3d702e[_0x2f2dcf(0x125)]())_0x376f20=_0x5806eb[0x0];else return console[_0x2f2dcf(0x14f)](_0x2f2dcf(0xc7)+_0x5806eb[0x0]+_0x2f2dcf(0xc6)),0x1;}catch{_0xb3256c=_0x5806eb[0x0],_0x376f20='.';}}const _0x255e42=_0x2803fe[_0x2f2dcf(0x10a)],_0xde8c=_0x2803fe[_0x2f2dcf(0x131)];_0x2803fe[_0x2f2dcf(0xd7)]&&(console[_0x2f2dcf(0x14f)]('Project\x20directory:\x20'+_0x376f20),_0xb3256c&&console[_0x2f2dcf(0x14f)](_0x2f2dcf(0xda)+_0xb3256c),_0x255e42&&console[_0x2f2dcf(0x14f)](_0x2f2dcf(0x148)+_0x255e42),_0xde8c&&console['error'](_0x2f2dcf(0xc2)));const _0x54b48d=await withSpinner(_0x2f2dcf(0x14b),()=>_0x48347b[_0x2f2dcf(0x134)][_0x2f2dcf(0xcb)](_0x376f20,{'projectName':_0xb3256c,'revision':_0x255e42,'skipValidation':_0xde8c}),{'verbose':_0x2803fe[_0x2f2dcf(0xd7)]}),_0x140c7f=_0x54b48d[_0x2f2dcf(0xee)];return console['error'](_0x2f2dcf(0x104)+_0x140c7f[_0x2f2dcf(0x123)]),console[_0x2f2dcf(0x14f)](_0x2f2dcf(0x11e)+_0x140c7f[_0x2f2dcf(0x139)]),console[_0x2f2dcf(0x14f)](_0x2f2dcf(0x138)+_0x140c7f['revision']),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a39_0x187e55(0x12d)]=a39_0x187e55(0x13d);[a39_0x187e55(0xe8)]='Delete\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a39_0x187e55(0xf3)](_0x4979e4){const _0x18b525=a39_0x187e55,{options:_0x32eaba,args:_0x4d65bb,tdx:_0x4c70bd}=_0x4979e4,_0x47cf40=_0x4d65bb[0x0];if(!_0x47cf40)return console['error']('Error:\x20Project\x20name\x20or\x20ID\x20is\x20required'),console['error'](_0x18b525(0xbb)),0x1;_0x32eaba[_0x18b525(0xd7)]&&console['error'](_0x18b525(0x149)+_0x47cf40);if(!_0x32eaba[_0x18b525(0xcc)]){const _0x713b56=await confirm(_0x18b525(0xf8)+_0x47cf40+_0x18b525(0x10b));if(!_0x713b56)return console['error'](_0x18b525(0x15a)),0x0;}const _0x3e1698=await withSpinner(_0x18b525(0x13e)+_0x47cf40+'...',()=>_0x4c70bd[_0x18b525(0x134)][_0x18b525(0x135)](_0x47cf40),{'verbose':_0x32eaba[_0x18b525(0xd7)]}),_0x26853d=_0x3e1698[_0x18b525(0xee)];return console['error'](_0x18b525(0xd1)+_0x26853d['projectName']),console[_0x18b525(0x14f)]('\x20\x20Project\x20ID:\x20'+_0x26853d[_0x18b525(0x139)]),0x0;}}
package/dist/core/auth.js CHANGED
@@ -1 +1 @@
1
- (function(_0x559715,_0x1bf261){const _0x3fa2ef=a40_0x4559,_0x84b949=_0x559715();while(!![]){try{const _0x30f975=-parseInt(_0x3fa2ef(0x73))/0x1*(-parseInt(_0x3fa2ef(0x7b))/0x2)+parseInt(_0x3fa2ef(0x85))/0x3+-parseInt(_0x3fa2ef(0x88))/0x4+-parseInt(_0x3fa2ef(0x86))/0x5*(-parseInt(_0x3fa2ef(0x70))/0x6)+-parseInt(_0x3fa2ef(0x83))/0x7*(-parseInt(_0x3fa2ef(0x71))/0x8)+-parseInt(_0x3fa2ef(0x82))/0x9*(parseInt(_0x3fa2ef(0x7c))/0xa)+parseInt(_0x3fa2ef(0x78))/0xb*(-parseInt(_0x3fa2ef(0x81))/0xc);if(_0x30f975===_0x1bf261)break;else _0x84b949['push'](_0x84b949['shift']());}catch(_0x19cb70){_0x84b949['push'](_0x84b949['shift']());}}}(a40_0x2e1f,0x2d11e));import{platform}from'os';import{readFileSync}from'fs';function a40_0x4559(_0x2679d8,_0x27ed72){const _0x2e1f28=a40_0x2e1f();return a40_0x4559=function(_0x455926,_0x435463){_0x455926=_0x455926-0x70;let _0x393a1e=_0x2e1f28[_0x455926];return _0x393a1e;},a40_0x4559(_0x2679d8,_0x27ed72);}import{fileURLToPath}from'url';import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0xb273bb=a40_0x4559;try{const _0x110a84=fileURLToPath(import.meta[_0xb273bb(0x89)]),_0x1925ca=dirname(_0x110a84),_0x4c495b=join(_0x1925ca,_0xb273bb(0x7d)),_0xcd34df=JSON[_0xb273bb(0x75)](readFileSync(_0x4c495b,_0xb273bb(0x7f)));return _0xcd34df['version'];}catch{return _0xb273bb(0x8a);}}function a40_0x2e1f(){const _0x594c4a=['tdx','2101LqdWnZ','tdx/','version','58myNmTA','10sCBrAK','../../package.json','TD1\x20','utf-8','entries','9096lbmTqr','3024711kjzDFn','224yByrZS','Authorization','786993CrATav','5inqUEB',';\x20node/','544700qaSYMf','url','0.0.0','1392618vtUPvZ','34664XcsLoP','replace','5812GfWiuf','X-Trino-User','parse','length'];a40_0x2e1f=function(){return _0x594c4a;};return a40_0x2e1f();}export function getUserAgent(){const _0x5d9123=a40_0x4559,_0x33837c=getVersion(),_0x46a8e5=platform(),_0x517852=process[_0x5d9123(0x7a)][_0x5d9123(0x72)]('v','');return _0x5d9123(0x79)+_0x33837c+'\x20('+_0x46a8e5+_0x5d9123(0x87)+_0x517852+')';}export function getAuthHeaders(_0x4caa32,_0x5573d0){const _0x28eeb8=a40_0x4559,_0x59361d=getVersion(),_0x252f29={'User-Agent':getUserAgent(),'X-TD-Client':_0x28eeb8(0x77),'X-TD-Client-Version':_0x59361d};return _0x5573d0&&(_0x252f29[_0x28eeb8(0x84)]=_0x28eeb8(0x7e)+_0x5573d0),_0x252f29;}export function toHeaderRecord(_0x163286){const _0x13fa97=a40_0x4559,_0x3d6856={};for(const [_0x1008e2,_0x2830d]of Object[_0x13fa97(0x80)](_0x163286)){_0x2830d!==undefined&&(_0x3d6856[_0x1008e2]=_0x2830d);}return _0x3d6856;}export function getTrinoHeaders(_0x3a5e21,_0x266092){const _0x482886=a40_0x4559,_0x372f6c=getAuthHeaders(_0x3a5e21,_0x266092),_0x112b21=toHeaderRecord(_0x372f6c);return delete _0x112b21[_0x482886(0x84)],_0x266092&&(_0x112b21[_0x482886(0x74)]=_0x266092),_0x112b21;}export function hasAPIKey(_0xb6e8ba){const _0x3ce3e4=a40_0x4559,_0x1f7b81=getAPIKey(_0xb6e8ba);return _0x1f7b81!==undefined&&_0x1f7b81[_0x3ce3e4(0x76)]>0x0;}
1
+ (function(_0x594da3,_0x245817){const _0x2d746=a40_0x29ea,_0x3a1f6f=_0x594da3();while(!![]){try{const _0x5c9dcb=parseInt(_0x2d746(0x111))/0x1+-parseInt(_0x2d746(0x109))/0x2*(-parseInt(_0x2d746(0xff))/0x3)+-parseInt(_0x2d746(0x106))/0x4*(parseInt(_0x2d746(0x10d))/0x5)+parseInt(_0x2d746(0x110))/0x6*(-parseInt(_0x2d746(0x113))/0x7)+parseInt(_0x2d746(0x101))/0x8+parseInt(_0x2d746(0x102))/0x9+parseInt(_0x2d746(0x112))/0xa;if(_0x5c9dcb===_0x245817)break;else _0x3a1f6f['push'](_0x3a1f6f['shift']());}catch(_0x3dda15){_0x3a1f6f['push'](_0x3a1f6f['shift']());}}}(a40_0x5e8a,0x8fa9b));import{platform}from'os';function a40_0x5e8a(){const _0x357811=['141692dtpMsT','url','utf-8','2234RHrFmW','TD1\x20','replace','../../package.json','135IRvgtI','tdx','tdx/','6RTsxpE','743390nHeYdS','801880JrPfWT','7881937ncPvUZ',';\x20node/','2307UTAjqa','length','1296896LxfcID','7435728SRQCeY','entries','parse','Authorization'];a40_0x5e8a=function(){return _0x357811;};return a40_0x5e8a();}import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x4d6d99=a40_0x29ea;try{const _0x5d41b6=fileURLToPath(import.meta[_0x4d6d99(0x107)]),_0x12b1ee=dirname(_0x5d41b6),_0x4dcc12=join(_0x12b1ee,_0x4d6d99(0x10c)),_0x229d19=JSON[_0x4d6d99(0x104)](readFileSync(_0x4dcc12,_0x4d6d99(0x108)));return _0x229d19['version'];}catch{return'0.0.0';}}export function getUserAgent(){const _0x1993a6=a40_0x29ea,_0xd47f1f=getVersion(),_0x36d8ed=platform(),_0x2c6504=process['version'][_0x1993a6(0x10b)]('v','');return _0x1993a6(0x10f)+_0xd47f1f+'\x20('+_0x36d8ed+_0x1993a6(0xfe)+_0x2c6504+')';}export function getAuthHeaders(_0x5b295c,_0x4b8cb6){const _0x15983f=a40_0x29ea,_0x198619=getVersion(),_0x213e2d={'User-Agent':getUserAgent(),'X-TD-Client':_0x15983f(0x10e),'X-TD-Client-Version':_0x198619};return _0x4b8cb6&&(_0x213e2d[_0x15983f(0x105)]=_0x15983f(0x10a)+_0x4b8cb6),_0x213e2d;}export function toHeaderRecord(_0x3e2cea){const _0x107814=a40_0x29ea,_0x4dbc91={};for(const [_0x298b01,_0x51e343]of Object[_0x107814(0x103)](_0x3e2cea)){_0x51e343!==undefined&&(_0x4dbc91[_0x298b01]=_0x51e343);}return _0x4dbc91;}function a40_0x29ea(_0x3227f2,_0x2ba6bb){const _0x5e8a35=a40_0x5e8a();return a40_0x29ea=function(_0x29ea39,_0x13d8aa){_0x29ea39=_0x29ea39-0xfe;let _0x2751dc=_0x5e8a35[_0x29ea39];return _0x2751dc;},a40_0x29ea(_0x3227f2,_0x2ba6bb);}export function getTrinoHeaders(_0x10a155,_0x27e920){const _0x2f039c=a40_0x29ea,_0x365267=getAuthHeaders(_0x10a155,_0x27e920),_0x3e8c7e=toHeaderRecord(_0x365267);return delete _0x3e8c7e[_0x2f039c(0x105)],_0x27e920&&(_0x3e8c7e['X-Trino-User']=_0x27e920),_0x3e8c7e;}export function hasAPIKey(_0x2a200a){const _0x3705fc=a40_0x29ea,_0x5d578b=getAPIKey(_0x2a200a);return _0x5d578b!==undefined&&_0x5d578b[_0x3705fc(0x100)]>0x0;}
@@ -1 +1 @@
1
- (function(_0x23a133,_0x21b2b5){const _0x46e482=a41_0x5a32,_0x446bd2=_0x23a133();while(!![]){try{const _0x437a82=parseInt(_0x46e482(0x14a))/0x1+-parseInt(_0x46e482(0x183))/0x2+-parseInt(_0x46e482(0x144))/0x3*(-parseInt(_0x46e482(0x187))/0x4)+-parseInt(_0x46e482(0x185))/0x5*(parseInt(_0x46e482(0x147))/0x6)+-parseInt(_0x46e482(0x186))/0x7+-parseInt(_0x46e482(0x15a))/0x8+parseInt(_0x46e482(0x150))/0x9;if(_0x437a82===_0x21b2b5)break;else _0x446bd2['push'](_0x446bd2['shift']());}catch(_0x49e25f){_0x446bd2['push'](_0x446bd2['shift']());}}}(a41_0x47aa,0xee646));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a41_0x1ee9a2 from'node:fs';import*as a41_0x730837 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 a41_0x47aa(){const _0x6b63d6=['605195xjDQAr','some','warn','readFileSync','string','dev-us01','12451176asFWkb','.env','yellow','TDX_API_KEY_','profile','TD_API_KEY_','toUpperCase','dev-eu01','llm_default_project.','TDX_API_KEY','1911400DJNebn','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','legacy\x20.env\x20file\x20(profile:\x20','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','match','llm_default_project','apiKey','eu01','Warning:\x20Failed\x20to\x20read\x20','\x27,\x20defaulting\x20to\x20us01','env','TD_API_KEY','TDX_CACHE_DIR','name','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','map','Warning:\x20Failed\x20to\x20load\x20','legacy\x20.env\x20file','keychain\x20(profile:\x20','jp01','includes','ap02','split','parse','stringify','us01','.cache','slice','endsWith','filter','TDX_CONFIG_DIR','source','TDX_API_KEY_<PROFILE>','profiles','isDeprecated','keychain','stg-us01','ap03','stg-jp01','join','replace','1311524TLgbIK','apiKeys','3921185VJavef','5393759ezOAYS','1437256lUHFZw','tdx','existsSync','entries','TDX_API_KEY\x20env\x20var','startsWith','.env.','12BnJDMi','trim','utf-8','6KdQTZE','.config','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'];a41_0x47aa=function(){return _0x6b63d6;};return a41_0x47aa();}import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a41_0x2af68b from'chalk';export function getConfigDir(){const _0x4ed10e=a41_0x5a32;return process['env'][_0x4ed10e(0x178)]||join(homedir(),_0x4ed10e(0x148),_0x4ed10e(0x188));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x52aeea){const _0x324c53=a41_0x5a32,_0xcaaf84=getConfigDir();return _0x52aeea?a41_0x730837[_0x324c53(0x181)](_0xcaaf84,_0x324c53(0x143)+_0x52aeea):getConfigFile();}export function getCacheDir(){const _0x534cc3=a41_0x5a32;return process[_0x534cc3(0x164)][_0x534cc3(0x166)]||join(homedir(),_0x534cc3(0x174),_0x534cc3(0x188));}export function getLLMProjectCacheFile(_0x3098d8){const _0x139d82=a41_0x5a32,_0x1c842e=_0x3098d8?_0x139d82(0x158)+_0x3098d8:_0x139d82(0x15f);return join(getCacheDir(),_0x1c842e);}export function readCachedLLMProject(_0x42f970){const _0x1aa5b1=a41_0x5a32;try{const _0x545c19=getLLMProjectCacheFile(_0x42f970);if(!existsSync(_0x545c19))return null;const _0xad4a0a=readFileSync(_0x545c19,_0x1aa5b1(0x146))[_0x1aa5b1(0x145)]();try{const _0xea156a=JSON['parse'](_0xad4a0a);if(_0xea156a&&typeof _0xea156a['id']===_0x1aa5b1(0x14e)&&typeof _0xea156a[_0x1aa5b1(0x167)]==='string')return _0xea156a;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x67f3e,_0xbf0994,_0x5262c6){const _0x203338=a41_0x5a32;try{const _0x5b7ce9=getCacheDir(),_0x46b517=getLLMProjectCacheFile(_0x5262c6);!existsSync(_0x5b7ce9)&&mkdirSync(_0x5b7ce9,{'recursive':!![]});const _0x9a41ce={'name':_0x67f3e,'id':_0xbf0994};writeFileSync(_0x46b517,JSON[_0x203338(0x172)](_0x9a41ce),_0x203338(0x146));}catch{}}export function parseEnvFile(_0x2d874a){const _0x343ab3=a41_0x5a32,_0x1e5556={};for(const _0x48eec6 of _0x2d874a[_0x343ab3(0x170)]('\x0a')){const _0x27392d=_0x48eec6[_0x343ab3(0x145)]();if(!_0x27392d||_0x27392d[_0x343ab3(0x142)]('#'))continue;const _0x1b1e05=_0x27392d[_0x343ab3(0x15e)](/^([^=]+)=(.*)$/);if(_0x1b1e05){const _0xa889fd=_0x1b1e05[0x1][_0x343ab3(0x145)]();let _0x2eb753=_0x1b1e05[0x2][_0x343ab3(0x145)]();(_0x2eb753['startsWith']('\x22')&&_0x2eb753[_0x343ab3(0x176)]('\x22')||_0x2eb753[_0x343ab3(0x142)]('\x27')&&_0x2eb753[_0x343ab3(0x176)]('\x27'))&&(_0x2eb753=_0x2eb753[_0x343ab3(0x175)](0x1,-0x1)),_0x1e5556[_0xa889fd]=_0x2eb753;}}return _0x1e5556;}export function readUserConfig(){const _0x506271=a41_0x5a32,_0x366766=getConfigFile();if(!existsSync(_0x366766))return{};try{const _0x193aea=readFileSync(_0x366766,_0x506271(0x146));return parseEnvFile(_0x193aea);}catch(_0x1276b0){return console[_0x506271(0x14c)]('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x366766+':',_0x1276b0),{};}}function a41_0x5a32(_0x2d1835,_0x34dfab){const _0x47aac8=a41_0x47aa();return a41_0x5a32=function(_0x5a32d3,_0x3cde39){_0x5a32d3=_0x5a32d3-0x141;let _0x4ac2f4=_0x47aac8[_0x5a32d3];return _0x4ac2f4;},a41_0x5a32(_0x2d1835,_0x34dfab);}export function resolveSite(_0x18169d){const _0x1175f3=a41_0x5a32,_0x4aafbd=[_0x1175f3(0x173),_0x1175f3(0x16d),_0x1175f3(0x161),_0x1175f3(0x16f),_0x1175f3(0x17f),_0x1175f3(0x14f),'dev-eu01',_0x1175f3(0x17e),_0x1175f3(0x180),'stg-ap03'];if(_0x4aafbd[_0x1175f3(0x16e)](_0x18169d))return _0x18169d;if(_0x18169d in SITE_ALIASES)return SITE_ALIASES[_0x18169d];return console[_0x1175f3(0x14c)]('Warning:\x20Unknown\x20site\x20\x27'+_0x18169d+_0x1175f3(0x163)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x1bf059,_0x52c44c){const _0x316392=a41_0x5a32,_0x4e1de2=_0x52c44c||getActiveProfileName();if(_0x4e1de2){const _0x43f06b=_0x316392(0x153)+normalizeProfileForEnvVar(_0x4e1de2);if(process['env'][_0x43f06b])return process[_0x316392(0x164)][_0x43f06b];}if(process['env'][_0x316392(0x159)])return process[_0x316392(0x164)]['TDX_API_KEY'];if(process[_0x316392(0x164)]['TD_API_KEY'])return process['env'][_0x316392(0x165)];const _0x401cbc=_0x1bf059[_0x316392(0x156)]()[_0x316392(0x182)](/-/g,'_'),_0x479911=_0x316392(0x155)+_0x401cbc;if(_0x4e1de2){const _0x2eb9f0=loadProfileEnv(_0x4e1de2);if(_0x2eb9f0){if(_0x2eb9f0[_0x479911])return _0x2eb9f0[_0x479911];if(_0x2eb9f0[_0x316392(0x165)])return _0x2eb9f0[_0x316392(0x165)];}}const _0x5e34c9=loadUserConfigOnce();if(_0x5e34c9[_0x479911])return _0x5e34c9[_0x479911];if(_0x5e34c9[_0x316392(0x165)])return _0x5e34c9[_0x316392(0x165)];return undefined;}export function normalizeProfileForEnvVar(_0x403003){return _0x403003['toUpperCase']()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x58edd5,_0x1f130d){const _0x3a9a27=a41_0x5a32,_0x506a64=_0x1f130d||getActiveProfileName()||undefined;if(_0x506a64){const _0xfb12be=_0x3a9a27(0x153)+normalizeProfileForEnvVar(_0x506a64);if(process[_0x3a9a27(0x164)][_0xfb12be])return{'apiKey':process[_0x3a9a27(0x164)][_0xfb12be],'source':_0xfb12be+'\x20env\x20var','isDeprecated':![]};const _0x5aa2fb=getCachedCredential(_0x58edd5,_0x506a64);if(_0x5aa2fb)return{'apiKey':_0x5aa2fb,'source':_0x3a9a27(0x16c)+_0x506a64+')','isDeprecated':![]};const _0x344c40=await getKeychainAPIKey(_0x506a64);if(_0x344c40)return setCachedCredential(_0x344c40,_0x58edd5,_0x506a64),{'apiKey':_0x344c40,'source':'keychain\x20(profile:\x20'+_0x506a64+')','isDeprecated':![]};}if(process[_0x3a9a27(0x164)][_0x3a9a27(0x159)])return{'apiKey':process[_0x3a9a27(0x164)][_0x3a9a27(0x159)],'source':_0x3a9a27(0x141),'isDeprecated':![]};if(!_0x506a64){const _0x4970b0=getCachedCredential(_0x58edd5,undefined);if(_0x4970b0)return{'apiKey':_0x4970b0,'source':_0x3a9a27(0x17d),'isDeprecated':![]};const _0xb93fe5=await getKeychainAPIKey(undefined);if(_0xb93fe5)return setCachedCredential(_0xb93fe5,_0x58edd5,undefined),{'apiKey':_0xb93fe5,'source':_0x3a9a27(0x17d),'isDeprecated':![]};}if(process[_0x3a9a27(0x164)][_0x3a9a27(0x165)])return{'apiKey':process[_0x3a9a27(0x164)]['TD_API_KEY'],'source':'TD_API_KEY\x20env\x20var\x20(deprecated)','isDeprecated':!![]};const _0x55f7d5=getLegacyEnvAPIKey(_0x58edd5,_0x506a64);if(_0x55f7d5){const _0x51f920=await isKeychainAvailable();if(_0x51f920)try{await saveKeychainAPIKey(_0x55f7d5,_0x506a64),setCachedCredential(_0x55f7d5,_0x58edd5,_0x506a64);const _0x15a5a7=getConfigFilePath(_0x506a64);cleanupLegacyEnvFile(_0x15a5a7)&&console[_0x3a9a27(0x14c)](a41_0x2af68b[_0x3a9a27(0x152)](_0x3a9a27(0x15b)));}catch(_0x2d3d86){console[_0x3a9a27(0x14c)](a41_0x2af68b['yellow'](_0x3a9a27(0x15d)+_0x2d3d86));}const _0x58b097=_0x506a64?_0x3a9a27(0x15c)+_0x506a64+')':_0x3a9a27(0x16b);return{'apiKey':_0x55f7d5,'source':_0x58b097,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x1a54a0,_0x4c7f88,_0x31545b=!![]){const _0x58f087=a41_0x5a32,_0x52a1d9=await resolveAPIKeyAsync(_0x1a54a0,_0x4c7f88);if(!_0x52a1d9)return undefined;if(_0x31545b&&_0x52a1d9[_0x58f087(0x17c)]&&_0x52a1d9[_0x58f087(0x179)]['includes'](_0x58f087(0x165))){const _0x482f88=_0x4c7f88||getActiveProfileName()||undefined,_0x49436b=_0x482f88?_0x58f087(0x153)+normalizeProfileForEnvVar(_0x482f88):_0x58f087(0x17a);console[_0x58f087(0x14c)](a41_0x2af68b['yellow'](_0x58f087(0x168)+('\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20'+_0x49436b+').')));}return _0x52a1d9[_0x58f087(0x160)];}function getLegacyEnvAPIKey(_0x515c85,_0x4e3661){const _0xb89dce=a41_0x5a32,_0x3229e9=_0x515c85['toUpperCase']()['replace'](/-/g,'_'),_0x4bddf6='TD_API_KEY_'+_0x3229e9;if(_0x4e3661){const _0x2d03ac=loadProfileEnv(_0x4e3661);if(_0x2d03ac){if(_0x2d03ac[_0x4bddf6])return _0x2d03ac[_0x4bddf6];if(_0x2d03ac[_0xb89dce(0x165)])return _0x2d03ac[_0xb89dce(0x165)];}}const _0x175d6a=loadUserConfigOnce();if(_0x175d6a[_0x4bddf6])return _0x175d6a[_0x4bddf6];if(_0x175d6a[_0xb89dce(0x165)])return _0x175d6a[_0xb89dce(0x165)];return undefined;}function cleanupLegacyEnvFile(_0x3a2fad){const _0x144ea4=a41_0x5a32;if(!existsSync(_0x3a2fad))return![];try{const _0x528233=readFileSync(_0x3a2fad,_0x144ea4(0x146)),_0x338b0e=_0x528233['split']('\x0a'),_0x4dd6a7=_0x338b0e[_0x144ea4(0x177)](_0x1b4b72=>{const _0xf1e175=_0x144ea4,_0x45b8bc=_0x1b4b72[_0xf1e175(0x145)]();if(!_0x45b8bc||_0x45b8bc[_0xf1e175(0x142)]('#'))return!![];const [_0x4dab8f]=_0x45b8bc['split']('=');return!_0x4dab8f[_0xf1e175(0x142)](_0xf1e175(0x165));}),_0x5cc054=_0x4dd6a7[_0x144ea4(0x14b)](_0x4c0076=>{const _0x94763c=_0x144ea4,_0x3ee666=_0x4c0076['trim']();return _0x3ee666&&!_0x3ee666[_0x94763c(0x142)]('#');});if(!_0x5cc054)return unlinkSync(_0x3a2fad),!![];return writeFileSync(_0x3a2fad,_0x4dd6a7[_0x144ea4(0x181)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x3635f9){const _0xa78284=a41_0x5a32,_0x435b7c=a41_0x730837[_0xa78284(0x181)](getConfigDir(),_0xa78284(0x143)+_0x3635f9);if(a41_0x1ee9a2[_0xa78284(0x189)](_0x435b7c)){validateSecureFilePermissions(_0x435b7c);try{const _0xbe9555=a41_0x1ee9a2[_0xa78284(0x14d)](_0x435b7c,_0xa78284(0x146));return parseEnvFile(_0xbe9555);}catch(_0x30f405){console['warn'](_0xa78284(0x16a)+_0x435b7c+':\x20'+_0x30f405);}}const _0x424822=a41_0x730837[_0xa78284(0x181)](getConfigDir(),_0xa78284(0x17b),_0x3635f9,_0xa78284(0x151));if(a41_0x1ee9a2[_0xa78284(0x189)](_0x424822)){validateSecureFilePermissions(_0x424822);try{const _0x42da41=a41_0x1ee9a2[_0xa78284(0x14d)](_0x424822,'utf-8');return parseEnvFile(_0x42da41);}catch(_0xe9c11e){return console[_0xa78284(0x14c)](_0xa78284(0x16a)+_0x424822+':\x20'+_0xe9c11e),null;}}return null;}function getActiveProfileName(){const _0x4e9e38=a41_0x5a32,_0x13b64d=a41_0x730837[_0x4e9e38(0x181)](getConfigDir(),'tdx.json');if(!a41_0x1ee9a2[_0x4e9e38(0x189)](_0x13b64d))return null;try{const _0x171788=a41_0x1ee9a2[_0x4e9e38(0x14d)](_0x13b64d,_0x4e9e38(0x146)),_0x1df888=JSON[_0x4e9e38(0x171)](_0x171788);return _0x1df888[_0x4e9e38(0x154)]||null;}catch{return null;}}export function saveAPIKey(_0x147e9c,_0x225ba9,_0x140c8a){const _0x4ed5d9=a41_0x5a32,_0x29f74c=getConfigDir(),_0x1db1fb=getConfigFilePath(_0x140c8a);!existsSync(_0x29f74c)&&mkdirSync(_0x29f74c,{'recursive':!![],'mode':0x1c0});let _0x4a9518={};if(existsSync(_0x1db1fb))try{const _0xfc0a0=readFileSync(_0x1db1fb,_0x4ed5d9(0x146));_0x4a9518=parseEnvFile(_0xfc0a0);}catch(_0x2516b1){console[_0x4ed5d9(0x14c)](_0x4ed5d9(0x162)+_0x1db1fb+':',_0x2516b1);}const _0x15f6aa=_0x147e9c[_0x4ed5d9(0x156)]()[_0x4ed5d9(0x182)](/-/g,'_');_0x4a9518['TD_API_KEY_'+_0x15f6aa]=_0x225ba9;const _0x44aeec=Object[_0x4ed5d9(0x18a)](_0x4a9518)[_0x4ed5d9(0x169)](([_0x48d25a,_0x302174])=>_0x48d25a+'='+_0x302174);writeFileSync(_0x1db1fb,_0x44aeec[_0x4ed5d9(0x181)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x5789b7,_0x52e7bf,_0x3e06be){const _0x437942=a41_0x5a32;await saveKeychainAPIKey(_0x5789b7,_0x3e06be),setCachedCredential(_0x5789b7,_0x52e7bf,_0x3e06be);const _0x58a175=getConfigFilePath(_0x3e06be);cleanupLegacyEnvFile(_0x58a175)&&console['warn'](a41_0x2af68b['yellow'](_0x437942(0x149)));}export function loadConfig(){const _0x86dcd5=a41_0x5a32,_0x5e2679={'apiKeys':{},'defaultSite':'us01'},_0x227ca9=['us01',_0x86dcd5(0x16d),_0x86dcd5(0x161),_0x86dcd5(0x16f),'ap03',_0x86dcd5(0x14f),_0x86dcd5(0x157),'stg-us01',_0x86dcd5(0x180),'stg-ap03'];for(const _0x22b69f of _0x227ca9){const _0xce1f19=getAPIKey(_0x22b69f);_0xce1f19&&(_0x5e2679[_0x86dcd5(0x184)][_0x22b69f]=_0xce1f19);}return _0x5e2679;}
1
+ (function(_0x53f680,_0x4ccb06){const _0x473554=a41_0x326e,_0x149932=_0x53f680();while(!![]){try{const _0x12e199=parseInt(_0x473554(0x10b))/0x1+-parseInt(_0x473554(0x13d))/0x2*(parseInt(_0x473554(0x14e))/0x3)+-parseInt(_0x473554(0x14b))/0x4+parseInt(_0x473554(0x11f))/0x5+-parseInt(_0x473554(0x143))/0x6*(-parseInt(_0x473554(0x122))/0x7)+parseInt(_0x473554(0x130))/0x8+parseInt(_0x473554(0x133))/0x9*(-parseInt(_0x473554(0x13b))/0xa);if(_0x12e199===_0x4ccb06)break;else _0x149932['push'](_0x149932['shift']());}catch(_0xb058c7){_0x149932['push'](_0x149932['shift']());}}}(a41_0xba00,0x3d15b));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a41_0x2c83f0 from'node:fs';import*as a41_0xd5b29e from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a41_0x12b6e4 from'chalk';export function getConfigDir(){const _0x2238b5=a41_0x326e;return process['env']['TDX_CONFIG_DIR']||join(homedir(),_0x2238b5(0x11b),_0x2238b5(0x11d));}function a41_0xba00(){const _0x3456f7=['join','includes','readFileSync','.env.','entries','split','keychain','354944tBOWyy','stg-us01','match','1278705nmnRlO','warn','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','profiles','493864yMbdFR','toUpperCase','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','utf-8','us01','jp01','some','TD_API_KEY_','existsSync','yellow','string','replace','trim','stg-jp01','endsWith','dev-eu01','.config','source','tdx','\x20env\x20var','2404645unePTJ','ap02','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','1275477pbHKoz','map','ap03','eu01','env','TDX_API_KEY','TDX_CACHE_DIR','.env','startsWith','slice','legacy\x20.env\x20file\x20(profile:\x20','profile','tdx.json','Warning:\x20Unknown\x20site\x20\x27','3611864YMycow','parse','isDeprecated','200646dVdkJZ','keychain\x20(profile:\x20','TDX_API_KEY_','.cache','Warning:\x20Failed\x20to\x20load\x20','llm_default_project.','TDX_API_KEY_<PROFILE>','TDX_API_KEY\x20env\x20var','460TgCMar','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','2hHbcki','name','stg-ap03','Warning:\x20Failed\x20to\x20read\x20','filter','TD_API_KEY','12HGTflU'];a41_0xba00=function(){return _0x3456f7;};return a41_0xba00();}export function getConfigFile(){const _0x5ab437=a41_0x326e;return join(getConfigDir(),_0x5ab437(0x129));}export function getConfigFilePath(_0xc302e1){const _0x3940ea=a41_0x326e,_0x3a0920=getConfigDir();return _0xc302e1?a41_0xd5b29e[_0x3940ea(0x144)](_0x3a0920,'.env.'+_0xc302e1):getConfigFile();}export function getCacheDir(){const _0x433df8=a41_0x326e;return process[_0x433df8(0x126)][_0x433df8(0x128)]||join(homedir(),_0x433df8(0x136),_0x433df8(0x11d));}export function getLLMProjectCacheFile(_0x31d57c){const _0x369c46=a41_0x326e,_0x549ac4=_0x31d57c?_0x369c46(0x138)+_0x31d57c:'llm_default_project';return join(getCacheDir(),_0x549ac4);}export function readCachedLLMProject(_0xff0e70){const _0x2bb5ec=a41_0x326e;try{const _0xd9c1b4=getLLMProjectCacheFile(_0xff0e70);if(!existsSync(_0xd9c1b4))return null;const _0x449ab2=readFileSync(_0xd9c1b4,_0x2bb5ec(0x10e))[_0x2bb5ec(0x117)]();try{const _0x5cd033=JSON[_0x2bb5ec(0x131)](_0x449ab2);if(_0x5cd033&&typeof _0x5cd033['id']===_0x2bb5ec(0x115)&&typeof _0x5cd033[_0x2bb5ec(0x13e)]===_0x2bb5ec(0x115))return _0x5cd033;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x2e1c81,_0x2eaafa,_0x32fdd9){const _0x4d7c68=a41_0x326e;try{const _0x4a309b=getCacheDir(),_0x3ef088=getLLMProjectCacheFile(_0x32fdd9);!existsSync(_0x4a309b)&&mkdirSync(_0x4a309b,{'recursive':!![]});const _0x322b8b={'name':_0x2e1c81,'id':_0x2eaafa};writeFileSync(_0x3ef088,JSON['stringify'](_0x322b8b),_0x4d7c68(0x10e));}catch{}}export function parseEnvFile(_0x576166){const _0xf7fd64=a41_0x326e,_0x5e699a={};for(const _0x596bba of _0x576166[_0xf7fd64(0x149)]('\x0a')){const _0x4c46ae=_0x596bba[_0xf7fd64(0x117)]();if(!_0x4c46ae||_0x4c46ae[_0xf7fd64(0x12a)]('#'))continue;const _0x5539d5=_0x4c46ae[_0xf7fd64(0x14d)](/^([^=]+)=(.*)$/);if(_0x5539d5){const _0x3daff4=_0x5539d5[0x1][_0xf7fd64(0x117)]();let _0xc362f7=_0x5539d5[0x2]['trim']();(_0xc362f7[_0xf7fd64(0x12a)]('\x22')&&_0xc362f7[_0xf7fd64(0x119)]('\x22')||_0xc362f7[_0xf7fd64(0x12a)]('\x27')&&_0xc362f7[_0xf7fd64(0x119)]('\x27'))&&(_0xc362f7=_0xc362f7[_0xf7fd64(0x12b)](0x1,-0x1)),_0x5e699a[_0x3daff4]=_0xc362f7;}}return _0x5e699a;}export function readUserConfig(){const _0x4ae25f=a41_0x326e,_0x6fdf84=getConfigFile();if(!existsSync(_0x6fdf84))return{};try{const _0x3fe926=readFileSync(_0x6fdf84,_0x4ae25f(0x10e));return parseEnvFile(_0x3fe926);}catch(_0x3e1252){return console['warn'](_0x4ae25f(0x109)+_0x6fdf84+':',_0x3e1252),{};}}export function resolveSite(_0x174b97){const _0x60b93b=a41_0x326e,_0x1b8759=[_0x60b93b(0x10f),'jp01',_0x60b93b(0x125),_0x60b93b(0x120),_0x60b93b(0x124),'dev-us01',_0x60b93b(0x11a),_0x60b93b(0x14c),_0x60b93b(0x118),_0x60b93b(0x13f)];if(_0x1b8759[_0x60b93b(0x145)](_0x174b97))return _0x174b97;if(_0x174b97 in SITE_ALIASES)return SITE_ALIASES[_0x174b97];return console[_0x60b93b(0x14f)](_0x60b93b(0x12f)+_0x174b97+'\x27,\x20defaulting\x20to\x20us01'),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x5d3480,_0x4f1567){const _0xa26832=a41_0x326e,_0x126d21=_0x4f1567||getActiveProfileName();if(_0x126d21){const _0x575801=_0xa26832(0x135)+normalizeProfileForEnvVar(_0x126d21);if(process[_0xa26832(0x126)][_0x575801])return process[_0xa26832(0x126)][_0x575801];}if(process[_0xa26832(0x126)][_0xa26832(0x127)])return process[_0xa26832(0x126)][_0xa26832(0x127)];if(process['env'][_0xa26832(0x142)])return process['env']['TD_API_KEY'];const _0xdf00be=_0x5d3480[_0xa26832(0x10c)]()[_0xa26832(0x116)](/-/g,'_'),_0x2a0468=_0xa26832(0x112)+_0xdf00be;if(_0x126d21){const _0x334e13=loadProfileEnv(_0x126d21);if(_0x334e13){if(_0x334e13[_0x2a0468])return _0x334e13[_0x2a0468];if(_0x334e13[_0xa26832(0x142)])return _0x334e13[_0xa26832(0x142)];}}const _0x1a43ef=loadUserConfigOnce();if(_0x1a43ef[_0x2a0468])return _0x1a43ef[_0x2a0468];if(_0x1a43ef[_0xa26832(0x142)])return _0x1a43ef[_0xa26832(0x142)];return undefined;}export function normalizeProfileForEnvVar(_0x4ba555){const _0x59e78e=a41_0x326e;return _0x4ba555[_0x59e78e(0x10c)]()['replace'](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x3f8ff0,_0x148c4c){const _0x5aaed4=a41_0x326e,_0x1004e2=_0x148c4c||getActiveProfileName()||undefined;if(_0x1004e2){const _0x193ff2=_0x5aaed4(0x135)+normalizeProfileForEnvVar(_0x1004e2);if(process[_0x5aaed4(0x126)][_0x193ff2])return{'apiKey':process['env'][_0x193ff2],'source':_0x193ff2+_0x5aaed4(0x11e),'isDeprecated':![]};const _0x4e416c=getCachedCredential(_0x3f8ff0,_0x1004e2);if(_0x4e416c)return{'apiKey':_0x4e416c,'source':_0x5aaed4(0x134)+_0x1004e2+')','isDeprecated':![]};const _0x5d91f5=await getKeychainAPIKey(_0x1004e2);if(_0x5d91f5)return setCachedCredential(_0x5d91f5,_0x3f8ff0,_0x1004e2),{'apiKey':_0x5d91f5,'source':'keychain\x20(profile:\x20'+_0x1004e2+')','isDeprecated':![]};}if(process[_0x5aaed4(0x126)]['TDX_API_KEY'])return{'apiKey':process[_0x5aaed4(0x126)][_0x5aaed4(0x127)],'source':_0x5aaed4(0x13a),'isDeprecated':![]};if(!_0x1004e2){const _0x505aa9=getCachedCredential(_0x3f8ff0,undefined);if(_0x505aa9)return{'apiKey':_0x505aa9,'source':_0x5aaed4(0x14a),'isDeprecated':![]};const _0x3fa551=await getKeychainAPIKey(undefined);if(_0x3fa551)return setCachedCredential(_0x3fa551,_0x3f8ff0,undefined),{'apiKey':_0x3fa551,'source':_0x5aaed4(0x14a),'isDeprecated':![]};}if(process[_0x5aaed4(0x126)][_0x5aaed4(0x142)])return{'apiKey':process[_0x5aaed4(0x126)]['TD_API_KEY'],'source':'TD_API_KEY\x20env\x20var\x20(deprecated)','isDeprecated':!![]};const _0x35a65e=getLegacyEnvAPIKey(_0x3f8ff0,_0x1004e2);if(_0x35a65e){const _0x1b1192=await isKeychainAvailable();if(_0x1b1192)try{await saveKeychainAPIKey(_0x35a65e,_0x1004e2),setCachedCredential(_0x35a65e,_0x3f8ff0,_0x1004e2);const _0x3905d9=getConfigFilePath(_0x1004e2);cleanupLegacyEnvFile(_0x3905d9)&&console[_0x5aaed4(0x14f)](a41_0x12b6e4[_0x5aaed4(0x114)](_0x5aaed4(0x10d)));}catch(_0x531222){console[_0x5aaed4(0x14f)](a41_0x12b6e4[_0x5aaed4(0x114)]('⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20'+_0x531222));}const _0x37580d=_0x1004e2?_0x5aaed4(0x12c)+_0x1004e2+')':'legacy\x20.env\x20file';return{'apiKey':_0x35a65e,'source':_0x37580d,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x23d775,_0x49bf1d,_0x4c2062=!![]){const _0x3ffe1d=a41_0x326e,_0x2f4e59=await resolveAPIKeyAsync(_0x23d775,_0x49bf1d);if(!_0x2f4e59)return undefined;if(_0x4c2062&&_0x2f4e59[_0x3ffe1d(0x132)]&&_0x2f4e59[_0x3ffe1d(0x11c)][_0x3ffe1d(0x145)](_0x3ffe1d(0x142))){const _0x5a1a9a=_0x49bf1d||getActiveProfileName()||undefined,_0x1ef869=_0x5a1a9a?_0x3ffe1d(0x135)+normalizeProfileForEnvVar(_0x5a1a9a):_0x3ffe1d(0x139);console[_0x3ffe1d(0x14f)](a41_0x12b6e4[_0x3ffe1d(0x114)]('Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a'+(_0x3ffe1d(0x13c)+_0x1ef869+').')));}return _0x2f4e59['apiKey'];}function getLegacyEnvAPIKey(_0x500b5a,_0x496e0a){const _0x248e00=a41_0x326e,_0x564c56=_0x500b5a['toUpperCase']()[_0x248e00(0x116)](/-/g,'_'),_0x3ce839=_0x248e00(0x112)+_0x564c56;if(_0x496e0a){const _0x5a3243=loadProfileEnv(_0x496e0a);if(_0x5a3243){if(_0x5a3243[_0x3ce839])return _0x5a3243[_0x3ce839];if(_0x5a3243['TD_API_KEY'])return _0x5a3243['TD_API_KEY'];}}const _0x4f478f=loadUserConfigOnce();if(_0x4f478f[_0x3ce839])return _0x4f478f[_0x3ce839];if(_0x4f478f[_0x248e00(0x142)])return _0x4f478f[_0x248e00(0x142)];return undefined;}function cleanupLegacyEnvFile(_0x5e02f4){const _0x36fa36=a41_0x326e;if(!existsSync(_0x5e02f4))return![];try{const _0x251229=readFileSync(_0x5e02f4,_0x36fa36(0x10e)),_0x4b611a=_0x251229[_0x36fa36(0x149)]('\x0a'),_0x4ce4be=_0x4b611a[_0x36fa36(0x141)](_0x4d8843=>{const _0x345183=_0x36fa36,_0x1e97e6=_0x4d8843[_0x345183(0x117)]();if(!_0x1e97e6||_0x1e97e6[_0x345183(0x12a)]('#'))return!![];const [_0x2f99c4]=_0x1e97e6['split']('=');return!_0x2f99c4[_0x345183(0x12a)]('TD_API_KEY');}),_0x820665=_0x4ce4be[_0x36fa36(0x111)](_0x39dc1d=>{const _0xad6604=_0x36fa36,_0x15922f=_0x39dc1d[_0xad6604(0x117)]();return _0x15922f&&!_0x15922f[_0xad6604(0x12a)]('#');});if(!_0x820665)return unlinkSync(_0x5e02f4),!![];return writeFileSync(_0x5e02f4,_0x4ce4be['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function a41_0x326e(_0x1ed9ab,_0x558672){const _0xba0034=a41_0xba00();return a41_0x326e=function(_0x326ea3,_0x221986){_0x326ea3=_0x326ea3-0x109;let _0x13a643=_0xba0034[_0x326ea3];return _0x13a643;},a41_0x326e(_0x1ed9ab,_0x558672);}function loadProfileEnv(_0xbcd298){const _0x4039c1=a41_0x326e,_0x4f0f12=a41_0xd5b29e[_0x4039c1(0x144)](getConfigDir(),_0x4039c1(0x147)+_0xbcd298);if(a41_0x2c83f0[_0x4039c1(0x113)](_0x4f0f12)){validateSecureFilePermissions(_0x4f0f12);try{const _0x3a4760=a41_0x2c83f0[_0x4039c1(0x146)](_0x4f0f12,'utf-8');return parseEnvFile(_0x3a4760);}catch(_0x5e18b3){console['warn'](_0x4039c1(0x137)+_0x4f0f12+':\x20'+_0x5e18b3);}}const _0x33c174=a41_0xd5b29e[_0x4039c1(0x144)](getConfigDir(),_0x4039c1(0x10a),_0xbcd298,_0x4039c1(0x129));if(a41_0x2c83f0[_0x4039c1(0x113)](_0x33c174)){validateSecureFilePermissions(_0x33c174);try{const _0x3f9668=a41_0x2c83f0[_0x4039c1(0x146)](_0x33c174,_0x4039c1(0x10e));return parseEnvFile(_0x3f9668);}catch(_0x3d7f21){return console['warn'](_0x4039c1(0x137)+_0x33c174+':\x20'+_0x3d7f21),null;}}return null;}function getActiveProfileName(){const _0x40668b=a41_0x326e,_0x3b7db1=a41_0xd5b29e['join'](getConfigDir(),_0x40668b(0x12e));if(!a41_0x2c83f0[_0x40668b(0x113)](_0x3b7db1))return null;try{const _0x38b7f4=a41_0x2c83f0[_0x40668b(0x146)](_0x3b7db1,_0x40668b(0x10e)),_0x2f1c00=JSON[_0x40668b(0x131)](_0x38b7f4);return _0x2f1c00[_0x40668b(0x12d)]||null;}catch{return null;}}export function saveAPIKey(_0x194ea6,_0x30d7b4,_0xa0a66c){const _0x29b0e2=a41_0x326e,_0x39e68b=getConfigDir(),_0x321fc6=getConfigFilePath(_0xa0a66c);!existsSync(_0x39e68b)&&mkdirSync(_0x39e68b,{'recursive':!![],'mode':0x1c0});let _0x12782e={};if(existsSync(_0x321fc6))try{const _0x50f0b9=readFileSync(_0x321fc6,_0x29b0e2(0x10e));_0x12782e=parseEnvFile(_0x50f0b9);}catch(_0xa6bcb4){console[_0x29b0e2(0x14f)](_0x29b0e2(0x140)+_0x321fc6+':',_0xa6bcb4);}const _0xc1cce9=_0x194ea6[_0x29b0e2(0x10c)]()[_0x29b0e2(0x116)](/-/g,'_');_0x12782e[_0x29b0e2(0x112)+_0xc1cce9]=_0x30d7b4;const _0x2e1a8e=Object[_0x29b0e2(0x148)](_0x12782e)[_0x29b0e2(0x123)](([_0x282417,_0x177e01])=>_0x282417+'='+_0x177e01);writeFileSync(_0x321fc6,_0x2e1a8e[_0x29b0e2(0x144)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x432f8e,_0x446030,_0x5ab93d){const _0x415835=a41_0x326e;await saveKeychainAPIKey(_0x432f8e,_0x5ab93d),setCachedCredential(_0x432f8e,_0x446030,_0x5ab93d);const _0x18edcc=getConfigFilePath(_0x5ab93d);cleanupLegacyEnvFile(_0x18edcc)&&console['warn'](a41_0x12b6e4['yellow'](_0x415835(0x121)));}export function loadConfig(){const _0x2a0952=a41_0x326e,_0x326178={'apiKeys':{},'defaultSite':_0x2a0952(0x10f)},_0x321e37=[_0x2a0952(0x10f),_0x2a0952(0x110),_0x2a0952(0x125),_0x2a0952(0x120),_0x2a0952(0x124),'dev-us01',_0x2a0952(0x11a),_0x2a0952(0x14c),'stg-jp01','stg-ap03'];for(const _0x4e6fda of _0x321e37){const _0x28c839=getAPIKey(_0x4e6fda);_0x28c839&&(_0x326178['apiKeys'][_0x4e6fda]=_0x28c839);}return _0x326178;}
@@ -1 +1 @@
1
- function a42_0x5d2b(){const _0x9472bd=['146590SmSLSs','782352pUUjJb','1654710QEbgiW','loadedAt','delete','9dfZVnK','2894872hhcKQK','164153AemOfu','get','42sbbjhx','set','apiKey','now','92031yKDlsV','clear','331933aPdpuz','44TwAyBH','__default_site__'];a42_0x5d2b=function(){return _0x9472bd;};return a42_0x5d2b();}(function(_0x259779,_0x21bb98){const _0x245846=a42_0x5017,_0x5c6d02=_0x259779();while(!![]){try{const _0x2f0253=parseInt(_0x245846(0x83))/0x1+parseInt(_0x245846(0x7d))/0x2+-parseInt(_0x245846(0x89))/0x3*(parseInt(_0x245846(0x7a))/0x4)+-parseInt(_0x245846(0x7c))/0x5*(-parseInt(_0x245846(0x85))/0x6)+parseInt(_0x245846(0x79))/0x7+parseInt(_0x245846(0x82))/0x8*(-parseInt(_0x245846(0x81))/0x9)+parseInt(_0x245846(0x7e))/0xa;if(_0x2f0253===_0x21bb98)break;else _0x5c6d02['push'](_0x5c6d02['shift']());}catch(_0x584bf7){_0x5c6d02['push'](_0x5c6d02['shift']());}}}(a42_0x5d2b,0x42edb));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x5cd213,_0x3e1c7c){const _0x126020=a42_0x5017,_0x1082f5=_0x5cd213||_0x126020(0x7b),_0x27b3ad=_0x3e1c7c||'__default_profile__';return _0x1082f5+':'+_0x27b3ad;}export function getCachedCredential(_0x4a40d2,_0x1bd522){const _0x421d70=a42_0x5017,_0x135e32=getCacheKey(_0x4a40d2,_0x1bd522),_0x1b3afd=cache[_0x421d70(0x84)](_0x135e32);if(!_0x1b3afd)return null;if(Date[_0x421d70(0x88)]()-_0x1b3afd[_0x421d70(0x7f)]>CACHE_TTL_MS)return cache['delete'](_0x135e32),null;return _0x1b3afd[_0x421d70(0x87)];}function a42_0x5017(_0x2993d4,_0x527f8f){const _0x5d2b87=a42_0x5d2b();return a42_0x5017=function(_0x50173e,_0x58155c){_0x50173e=_0x50173e-0x79;let _0x1cbbf5=_0x5d2b87[_0x50173e];return _0x1cbbf5;},a42_0x5017(_0x2993d4,_0x527f8f);}export function setCachedCredential(_0x4d5ff3,_0x4bb5e3,_0x39c412){const _0x5312a8=a42_0x5017,_0x28b89e=getCacheKey(_0x4bb5e3,_0x39c412);cache[_0x5312a8(0x86)](_0x28b89e,{'apiKey':_0x4d5ff3,'loadedAt':Date['now']()});}export function clearCredentialCache(){const _0x54e3e9=a42_0x5017;cache[_0x54e3e9(0x8a)]();}export function clearCachedCredential(_0x23da55,_0x1885d6){const _0x97ee62=a42_0x5017,_0x4f220d=getCacheKey(_0x23da55,_0x1885d6);cache[_0x97ee62(0x80)](_0x4f220d);}
1
+ (function(_0x63226a,_0x44d572){const _0x5adfda=a42_0x2aee,_0x1382e3=_0x63226a();while(!![]){try{const _0x1398cc=-parseInt(_0x5adfda(0x15d))/0x1+parseInt(_0x5adfda(0x169))/0x2*(parseInt(_0x5adfda(0x15c))/0x3)+-parseInt(_0x5adfda(0x167))/0x4+parseInt(_0x5adfda(0x166))/0x5*(-parseInt(_0x5adfda(0x164))/0x6)+-parseInt(_0x5adfda(0x162))/0x7*(-parseInt(_0x5adfda(0x163))/0x8)+-parseInt(_0x5adfda(0x15e))/0x9+-parseInt(_0x5adfda(0x168))/0xa*(-parseInt(_0x5adfda(0x15f))/0xb);if(_0x1398cc===_0x44d572)break;else _0x1382e3['push'](_0x1382e3['shift']());}catch(_0x22756e){_0x1382e3['push'](_0x1382e3['shift']());}}}(a42_0xaeae,0xd3b04));function a42_0x2aee(_0x5b6688,_0x208253){const _0xaeae18=a42_0xaeae();return a42_0x2aee=function(_0x2aeeb9,_0x307d09){_0x2aeeb9=_0x2aeeb9-0x158;let _0x5d71e9=_0xaeae18[_0x2aeeb9];return _0x5d71e9;},a42_0x2aee(_0x5b6688,_0x208253);}function a42_0xaeae(){const _0x913f30=['7071588kNjftU','9757XZImlV','now','__default_profile__','286559kZzWuy','296sEppET','6IXRgtu','apiKey','4062505wgMuyd','4061112EXOpfZ','11570qOnhuP','5514QwOXws','clear','__default_site__','get','delete','1854ssuVXw','764167baQOXW'];a42_0xaeae=function(){return _0x913f30;};return a42_0xaeae();}const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x261b37,_0x57ceab){const _0x17b17a=a42_0x2aee,_0x232a7a=_0x261b37||_0x17b17a(0x159),_0x191c72=_0x57ceab||_0x17b17a(0x161);return _0x232a7a+':'+_0x191c72;}export function getCachedCredential(_0x201a25,_0x5564f7){const _0x42000b=a42_0x2aee,_0x1895f6=getCacheKey(_0x201a25,_0x5564f7),_0x2bba91=cache[_0x42000b(0x15a)](_0x1895f6);if(!_0x2bba91)return null;if(Date[_0x42000b(0x160)]()-_0x2bba91['loadedAt']>CACHE_TTL_MS)return cache[_0x42000b(0x15b)](_0x1895f6),null;return _0x2bba91[_0x42000b(0x165)];}export function setCachedCredential(_0xcea1f,_0x5aa818,_0x18be4f){const _0xc75558=a42_0x2aee,_0xbce4=getCacheKey(_0x5aa818,_0x18be4f);cache['set'](_0xbce4,{'apiKey':_0xcea1f,'loadedAt':Date[_0xc75558(0x160)]()});}export function clearCredentialCache(){const _0x2245ce=a42_0x2aee;cache[_0x2245ce(0x158)]();}export function clearCachedCredential(_0x142982,_0x15f680){const _0x76ce8d=a42_0x2aee,_0x9d1e34=getCacheKey(_0x142982,_0x15f680);cache[_0x76ce8d(0x15b)](_0x9d1e34);}
@@ -1 +1 @@
1
- function a43_0x2504(_0x4c0a75,_0x3ac50c){const _0x2d7823=a43_0x2d78();return a43_0x2504=function(_0x2504ba,_0x1c28d7){_0x2504ba=_0x2504ba-0x72;let _0x224061=_0x2d7823[_0x2504ba];return _0x224061;},a43_0x2504(_0x4c0a75,_0x3ac50c);}const a43_0x4a9171=a43_0x2504;(function(_0x2785cb,_0x4b3ef5){const _0x410979=a43_0x2504,_0x1908db=_0x2785cb();while(!![]){try{const _0x224be3=parseInt(_0x410979(0x76))/0x1*(parseInt(_0x410979(0x98))/0x2)+-parseInt(_0x410979(0xac))/0x3*(parseInt(_0x410979(0x9e))/0x4)+parseInt(_0x410979(0xad))/0x5+-parseInt(_0x410979(0xb3))/0x6+parseInt(_0x410979(0x81))/0x7+parseInt(_0x410979(0x82))/0x8*(-parseInt(_0x410979(0x75))/0x9)+parseInt(_0x410979(0x99))/0xa*(parseInt(_0x410979(0x95))/0xb);if(_0x224be3===_0x4b3ef5)break;else _0x1908db['push'](_0x1908db['shift']());}catch(_0x49c42a){_0x1908db['push'](_0x1908db['shift']());}}}(a43_0x2d78,0xb94d7));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';function a43_0x2d78(){const _0x198ea0=['1598745uqOFup','createAsync','parent_segment','display','project','getSource','4568832jgFFGS','resolveAPIKeyAsync','llm_project','getParameters','utf-8','18NYxBvK','46UQzBWv','site','global',':\x20none\x20(using\x20session:\x20','tdx.json','injectIntoOptions','profiles','segmentPath','Global','parentSegment','toString','7221277jXylin','5943992vLFQDM','us01','[context]','INFO','profile:\x20','string','apiKey','existsSync','Global\x20Credentials','activeProfile','database','CLI\x20flag:\x20--','.env','config','verbose','\x0a[configuration\x20files]','loadGlobalConfig','Session','logLevel','132TIDSVE','sessionId','layers','12634BKrnRL','2250170xMlOoi','configFiles','Profile\x20Credentials','Project','join','4oXbrAp','segment_path','.json','llmProject','log','(session:\x20','session','profileCredentials','globalCredentials','cliFlags','entries','default','replace','profile','4007031XkNKUq'];a43_0x2d78=function(){return _0x198ea0;};return a43_0x2d78();}import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a43_0x5523e5 from'node:fs';import*as a43_0x455d29 from'node:path';export class GlobalContext{[a43_0x4a9171(0x77)];[a43_0x4a9171(0x8c)];[a43_0x4a9171(0xaf)];[a43_0x4a9171(0x9f)];['llm_project'];['apiKey'];[a43_0x4a9171(0x90)];[a43_0x4a9171(0x94)];['profile'];[a43_0x4a9171(0x97)];[a43_0x4a9171(0x8b)];[a43_0x4a9171(0x96)];[a43_0x4a9171(0x9a)];constructor(_0x227bc9){const _0x176e27=a43_0x4a9171;this[_0x176e27(0x96)]=_0x227bc9['session']||getCurrentSessionPID()[_0x176e27(0x80)]();const _0x4101ce=loadSessionContext(_0x227bc9[_0x176e27(0xa4)]),_0x47f683=loadProjectConfig(),_0x135e98=this[_0x176e27(0x92)]();this[_0x176e27(0x8b)]=_0x227bc9[_0x176e27(0xab)]||_0x4101ce?.['profile']||_0x135e98[_0x176e27(0xab)]||getActiveProfile();const _0x26a97b=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x2e6a73=_0x36c124=>{const _0x10713c=_0x176e27;if(!_0x36c124)return{};const _0x551392=_0x36c124,_0x548a19={};for(const [_0x3eee19,_0x44c990]of Object[_0x10713c(0xa8)](_0x551392)){typeof _0x44c990===_0x10713c(0x87)&&(_0x548a19[_0x3eee19]=_0x44c990);}return _0x548a19;},_0x47f94d={};if(_0x227bc9[_0x176e27(0x77)]&&_0x227bc9[_0x176e27(0x77)]!==_0x176e27(0x83))_0x47f94d[_0x176e27(0x77)]=_0x227bc9[_0x176e27(0x77)];const _0x59afe2=_0x4101ce?.[_0x176e27(0x8c)],_0x4340e5=_0x47f683?.[_0x176e27(0x8c)],_0x21a28c=_0x26a97b?.[_0x176e27(0x8f)]?.['database'],_0x3f3828=_0x135e98[_0x176e27(0x8c)];_0x227bc9[_0x176e27(0x8c)]&&(_0x227bc9[_0x176e27(0x8c)]!==_0x59afe2&&_0x227bc9[_0x176e27(0x8c)]!==_0x4340e5&&_0x227bc9[_0x176e27(0x8c)]!==_0x21a28c&&_0x227bc9['database']!==_0x3f3828)&&(_0x47f94d[_0x176e27(0x8c)]=_0x227bc9[_0x176e27(0x8c)]);if(_0x227bc9[_0x176e27(0x7f)])_0x47f94d[_0x176e27(0xaf)]=_0x227bc9['parentSegment'];if(_0x227bc9[_0x176e27(0xa1)])_0x47f94d[_0x176e27(0x72)]=_0x227bc9['llmProject'];if(_0x227bc9[_0x176e27(0xab)])_0x47f94d['profile']=_0x227bc9['profile'];this[_0x176e27(0x97)]={'cliFlags':_0x47f94d,'session':_0x2e6a73(_0x4101ce),'project':_0x2e6a73(_0x47f683),'profile':_0x2e6a73(_0x26a97b?.[_0x176e27(0x8f)]),'global':_0x2e6a73(_0x135e98)};const _0x5b3060={...this['layers'][_0x176e27(0x78)],...this[_0x176e27(0x97)][_0x176e27(0xab)],...this[_0x176e27(0x97)]['project'],...this[_0x176e27(0x97)][_0x176e27(0xa4)],...this[_0x176e27(0x97)][_0x176e27(0xa7)]},_0x45315b=_0x5b3060[_0x176e27(0x77)]||_0x176e27(0x83);this['site']=resolveSite(_0x45315b),this[_0x176e27(0x8c)]=_0x5b3060[_0x176e27(0x8c)],this[_0x176e27(0xaf)]=_0x5b3060[_0x176e27(0xaf)],this[_0x176e27(0x9f)]=_0x5b3060[_0x176e27(0x9f)],this[_0x176e27(0x72)]=_0x5b3060[_0x176e27(0x72)],this[_0x176e27(0x90)]=_0x227bc9[_0x176e27(0x90)]||![],this['logLevel']=_0x227bc9['logLevel']??LogLevel[_0x176e27(0x85)],this['profile']=this[_0x176e27(0x8b)]||undefined,this[_0x176e27(0x88)]=getAPIKey(this[_0x176e27(0x77)],this[_0x176e27(0x8b)]||undefined);const _0xbef527=getConfigDir(),_0x38e635=a43_0x455d29[_0x176e27(0x9d)](_0xbef527,'sessions',this[_0x176e27(0x96)]+_0x176e27(0xa0)),_0x15f3ea=findProjectConfigPath(),_0x4282d4=a43_0x455d29['join'](_0xbef527,_0x176e27(0x7a)),_0x35e5b5=a43_0x455d29['join'](_0xbef527,'.env');let _0x43f0ec=null,_0x226ba6=null;this[_0x176e27(0x8b)]&&(_0x43f0ec=a43_0x455d29[_0x176e27(0x9d)](_0xbef527,_0x176e27(0x7c),this['activeProfile'],_0x176e27(0x7a)),_0x226ba6=a43_0x455d29[_0x176e27(0x9d)](_0xbef527,_0x176e27(0x7c),this[_0x176e27(0x8b)],_0x176e27(0x8e))),this['configFiles']={'session':a43_0x5523e5['existsSync'](_0x38e635)?_0x38e635:null,'project':_0x15f3ea,'profile':_0x43f0ec&&a43_0x5523e5[_0x176e27(0x89)](_0x43f0ec)?_0x43f0ec:null,'profileCredentials':_0x226ba6&&a43_0x5523e5[_0x176e27(0x89)](_0x226ba6)?_0x226ba6:null,'global':a43_0x5523e5[_0x176e27(0x89)](_0x4282d4)?_0x4282d4:null,'globalCredentials':a43_0x5523e5[_0x176e27(0x89)](_0x35e5b5)?_0x35e5b5:null};}['getSource'](_0xcbb58b,_0x475b98){const _0x4b5ffc=a43_0x4a9171;if(!_0x475b98)return'not\x20set';const _0x2162dc=_0x475b98;if(this['layers'][_0x4b5ffc(0xa7)][_0xcbb58b]===_0x2162dc){if(_0xcbb58b==='site'&&_0x2162dc===_0x4b5ffc(0x83)&&!this['layers'][_0x4b5ffc(0xa4)][_0x4b5ffc(0x77)]&&!this[_0x4b5ffc(0x97)]['project'][_0x4b5ffc(0x77)]&&!this[_0x4b5ffc(0x97)]['profile']['site']&&!this[_0x4b5ffc(0x97)][_0x4b5ffc(0x78)][_0x4b5ffc(0x77)])return _0x4b5ffc(0xa9);return _0x4b5ffc(0x8d)+_0xcbb58b[_0x4b5ffc(0xaa)](/_/g,'-');}if(this[_0x4b5ffc(0x97)][_0x4b5ffc(0xa4)][_0xcbb58b]===_0x2162dc)return _0x4b5ffc(0xa4);if(this[_0x4b5ffc(0x97)][_0x4b5ffc(0xb1)][_0xcbb58b]===_0x2162dc)return _0x4b5ffc(0xb1);if(this['layers']['profile'][_0xcbb58b]===_0x2162dc)return _0x4b5ffc(0x86)+this[_0x4b5ffc(0x8b)];if(this[_0x4b5ffc(0x97)][_0x4b5ffc(0x78)][_0xcbb58b]===_0x2162dc)return _0x4b5ffc(0x78);return _0x4b5ffc(0xa9);}['loadGlobalConfig'](){const _0x3d4d49=a43_0x4a9171,_0x519f78=a43_0x455d29[_0x3d4d49(0x9d)](getConfigDir(),_0x3d4d49(0x7a));if(!a43_0x5523e5[_0x3d4d49(0x89)](_0x519f78))return{};try{const _0xbc8bf=a43_0x5523e5['readFileSync'](_0x519f78,_0x3d4d49(0x74));return JSON['parse'](_0xbc8bf);}catch{return{};}}[a43_0x4a9171(0x7b)](_0xd77f96){const _0x168daa=a43_0x4a9171;_0xd77f96['site']=this['site'],!_0xd77f96['database']&&this[_0x168daa(0x8c)]&&(_0xd77f96['database']=this[_0x168daa(0x8c)]),!_0xd77f96[_0x168daa(0x7f)]&&this[_0x168daa(0xaf)]&&(_0xd77f96[_0x168daa(0x7f)]=this['parent_segment']),!_0xd77f96[_0x168daa(0x7d)]&&this[_0x168daa(0x9f)]&&(_0xd77f96[_0x168daa(0x7d)]=this[_0x168daa(0x9f)]),!_0xd77f96[_0x168daa(0xa1)]&&this['llm_project']&&(_0xd77f96[_0x168daa(0xa1)]=this[_0x168daa(0x72)]);}[a43_0x4a9171(0x73)](){const _0x56b53a=a43_0x4a9171;return[{'key':'site','value':this[_0x56b53a(0x77)]},{'key':'database','value':this[_0x56b53a(0x8c)]},{'key':_0x56b53a(0xaf),'value':this[_0x56b53a(0xaf)]},{'key':_0x56b53a(0x9f),'value':this['segment_path']},{'key':_0x56b53a(0x72),'value':this[_0x56b53a(0x72)]},{'key':_0x56b53a(0xab),'value':this['activeProfile']||undefined}];}[a43_0x4a9171(0xb0)](){const _0xd21d68=a43_0x4a9171;console[_0xd21d68(0xa2)](_0xd21d68(0x84));for(const {key:_0x3698c1,value:_0x2d15a4}of this[_0xd21d68(0x73)]()){_0x2d15a4&&console['log'](_0x3698c1+':\x20'+_0x2d15a4);}}['displayWithSources'](){const _0x3a3709=a43_0x4a9171;console['log'](_0x3a3709(0x84));for(const {key:_0x4282be,value:_0x3ad3a9}of this['getParameters']()){if(_0x3ad3a9){const _0x4423d5=_0x4282be===_0x3a3709(0xab)?'(active)':'('+this[_0x3a3709(0xb2)](_0x4282be,_0x3ad3a9)+')';console[_0x3a3709(0xa2)](_0x4282be+':\x20'+_0x3ad3a9+'\x20'+_0x4423d5);}}console['log'](_0x3a3709(0x91));const _0x43fbcc=[{'label':_0x3a3709(0x93),'path':this[_0x3a3709(0x9a)]['session'],'extra':_0x3a3709(0xa3)+this[_0x3a3709(0x96)]+')'},{'label':_0x3a3709(0x9c),'path':this[_0x3a3709(0x9a)][_0x3a3709(0xb1)]},{'label':'Profile','path':this[_0x3a3709(0x9a)][_0x3a3709(0xab)]},{'label':_0x3a3709(0x9b),'path':this['configFiles'][_0x3a3709(0xa5)]},{'label':_0x3a3709(0x7e),'path':this[_0x3a3709(0x9a)][_0x3a3709(0x78)]},{'label':_0x3a3709(0x8a),'path':this['configFiles'][_0x3a3709(0xa6)]}];for(const {label:_0x44713b,path:_0x4aed59,extra:_0x12e8d3}of _0x43fbcc){if(_0x4aed59)console[_0x3a3709(0xa2)](_0x44713b+':\x20'+_0x4aed59+'\x20✓'+(_0x12e8d3?'\x20'+_0x12e8d3:''));else{if(_0x44713b==='Session')console[_0x3a3709(0xa2)](_0x44713b+_0x3a3709(0x79)+this[_0x3a3709(0x96)]+')');else(_0x44713b===_0x3a3709(0x9c)||_0x44713b===_0x3a3709(0x7e))&&console[_0x3a3709(0xa2)](_0x44713b+':\x20none');}}}async[a43_0x4a9171(0xb4)](){const _0x5c819d=a43_0x4a9171;return this['apiKey']=await getAPIKeyAsync(this[_0x5c819d(0x77)],this[_0x5c819d(0x8b)]||undefined),this[_0x5c819d(0x88)];}static async[a43_0x4a9171(0xae)](_0x3d890f){const _0x1c1db8=a43_0x4a9171,_0xf779b5=new GlobalContext(_0x3d890f);return await _0xf779b5[_0x1c1db8(0xb4)](),_0xf779b5;}}
1
+ const a43_0x411c6a=a43_0x1bad;(function(_0x171897,_0x2953d1){const _0xc4a310=a43_0x1bad,_0x4082e3=_0x171897();while(!![]){try{const _0x302b5f=parseInt(_0xc4a310(0x1be))/0x1+-parseInt(_0xc4a310(0x1e5))/0x2*(-parseInt(_0xc4a310(0x1c4))/0x3)+-parseInt(_0xc4a310(0x1b9))/0x4+-parseInt(_0xc4a310(0x1de))/0x5+parseInt(_0xc4a310(0x1e8))/0x6+parseInt(_0xc4a310(0x1c6))/0x7+parseInt(_0xc4a310(0x1f5))/0x8*(-parseInt(_0xc4a310(0x1bc))/0x9);if(_0x302b5f===_0x2953d1)break;else _0x4082e3['push'](_0x4082e3['shift']());}catch(_0x304300){_0x4082e3['push'](_0x4082e3['shift']());}}}(a43_0x4434,0xcc121));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';function a43_0x4434(){const _0x205540=['parse','Profile\x20Credentials','string','INFO','sessions','llmProject','5228730drJyjA','apiKey','Global','site','activeProfile','layers','injectIntoOptions','2302MwHwes','utf-8','profile:\x20','9485292XalTTR','log','Profile','join','configFiles','parentSegment','us01','.env','global','globalCredentials','parent_segment',':\x20none\x20(using\x20session:\x20','[context]','32jGnzOx','resolveAPIKeyAsync','displayWithSources','logLevel','segment_path','5105304QNcVcj','\x0a[configuration\x20files]','tdx.json','604161qfjopt','verbose','366189TDVOIZ','default','getParameters','sessionId','CLI\x20flag:\x20--','cliFlags','3435EpbxCS','database','1130465wiTGYZ','segmentPath','display','Global\x20Credentials','Project','session',':\x20none','llm_project','not\x20set','.json','profile','existsSync','profiles','Session','config','getSource','project','loadGlobalConfig'];a43_0x4434=function(){return _0x205540;};return a43_0x4434();}import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a43_0x2607e3 from'node:fs';import*as a43_0x11240b from'node:path';function a43_0x1bad(_0x5eaa15,_0x3412bb){const _0x4434bb=a43_0x4434();return a43_0x1bad=function(_0x1bad4c,_0x40682d){_0x1bad4c=_0x1bad4c-0x1b7;let _0x433b72=_0x4434bb[_0x1bad4c];return _0x433b72;},a43_0x1bad(_0x5eaa15,_0x3412bb);}export class GlobalContext{[a43_0x411c6a(0x1e1)];[a43_0x411c6a(0x1c5)];[a43_0x411c6a(0x1f2)];[a43_0x411c6a(0x1b8)];[a43_0x411c6a(0x1cd)];['apiKey'];['verbose'];['logLevel'];['profile'];['layers'];['activeProfile'];[a43_0x411c6a(0x1c1)];[a43_0x411c6a(0x1ec)];constructor(_0x6d8463){const _0x76e227=a43_0x411c6a;this[_0x76e227(0x1c1)]=_0x6d8463['session']||getCurrentSessionPID()['toString']();const _0x318d75=loadSessionContext(_0x6d8463[_0x76e227(0x1cb)]),_0x10906e=loadProjectConfig(),_0xa9b2a9=this[_0x76e227(0x1d7)]();this[_0x76e227(0x1e2)]=_0x6d8463['profile']||_0x318d75?.[_0x76e227(0x1d0)]||_0xa9b2a9['profile']||getActiveProfile();const _0x442420=this['activeProfile']?loadProfile(this['activeProfile']):null,_0x1961f9=_0x5bc80d=>{const _0x58991e=_0x76e227;if(!_0x5bc80d)return{};const _0x176fb6=_0x5bc80d,_0x42ad5b={};for(const [_0x1cce24,_0x241583]of Object['entries'](_0x176fb6)){typeof _0x241583===_0x58991e(0x1da)&&(_0x42ad5b[_0x1cce24]=_0x241583);}return _0x42ad5b;},_0x26b7a9={};if(_0x6d8463['site']&&_0x6d8463[_0x76e227(0x1e1)]!==_0x76e227(0x1ee))_0x26b7a9[_0x76e227(0x1e1)]=_0x6d8463[_0x76e227(0x1e1)];const _0x2c94b5=_0x318d75?.[_0x76e227(0x1c5)],_0x47e8cf=_0x10906e?.[_0x76e227(0x1c5)],_0x48945a=_0x442420?.['config']?.[_0x76e227(0x1c5)],_0x31284a=_0xa9b2a9[_0x76e227(0x1c5)];_0x6d8463['database']&&(_0x6d8463[_0x76e227(0x1c5)]!==_0x2c94b5&&_0x6d8463['database']!==_0x47e8cf&&_0x6d8463[_0x76e227(0x1c5)]!==_0x48945a&&_0x6d8463[_0x76e227(0x1c5)]!==_0x31284a)&&(_0x26b7a9[_0x76e227(0x1c5)]=_0x6d8463[_0x76e227(0x1c5)]);if(_0x6d8463[_0x76e227(0x1ed)])_0x26b7a9[_0x76e227(0x1f2)]=_0x6d8463[_0x76e227(0x1ed)];if(_0x6d8463['llmProject'])_0x26b7a9[_0x76e227(0x1cd)]=_0x6d8463[_0x76e227(0x1dd)];if(_0x6d8463[_0x76e227(0x1d0)])_0x26b7a9['profile']=_0x6d8463[_0x76e227(0x1d0)];this[_0x76e227(0x1e3)]={'cliFlags':_0x26b7a9,'session':_0x1961f9(_0x318d75),'project':_0x1961f9(_0x10906e),'profile':_0x1961f9(_0x442420?.[_0x76e227(0x1d4)]),'global':_0x1961f9(_0xa9b2a9)};const _0x48488b={...this[_0x76e227(0x1e3)][_0x76e227(0x1f0)],...this[_0x76e227(0x1e3)][_0x76e227(0x1d0)],...this[_0x76e227(0x1e3)]['project'],...this['layers'][_0x76e227(0x1cb)],...this['layers']['cliFlags']},_0x1848c5=_0x48488b['site']||_0x76e227(0x1ee);this['site']=resolveSite(_0x1848c5),this[_0x76e227(0x1c5)]=_0x48488b['database'],this[_0x76e227(0x1f2)]=_0x48488b[_0x76e227(0x1f2)],this[_0x76e227(0x1b8)]=_0x48488b['segment_path'],this[_0x76e227(0x1cd)]=_0x48488b[_0x76e227(0x1cd)],this[_0x76e227(0x1bd)]=_0x6d8463['verbose']||![],this[_0x76e227(0x1b7)]=_0x6d8463[_0x76e227(0x1b7)]??LogLevel[_0x76e227(0x1db)],this[_0x76e227(0x1d0)]=this[_0x76e227(0x1e2)]||undefined,this[_0x76e227(0x1df)]=getAPIKey(this[_0x76e227(0x1e1)],this[_0x76e227(0x1e2)]||undefined);const _0x29353d=getConfigDir(),_0x390e9c=a43_0x11240b[_0x76e227(0x1eb)](_0x29353d,_0x76e227(0x1dc),this[_0x76e227(0x1c1)]+_0x76e227(0x1cf)),_0x11f829=findProjectConfigPath(),_0x17563f=a43_0x11240b[_0x76e227(0x1eb)](_0x29353d,_0x76e227(0x1bb)),_0x2a3a45=a43_0x11240b[_0x76e227(0x1eb)](_0x29353d,_0x76e227(0x1ef));let _0x453b80=null,_0xa76b9=null;this['activeProfile']&&(_0x453b80=a43_0x11240b[_0x76e227(0x1eb)](_0x29353d,_0x76e227(0x1d2),this[_0x76e227(0x1e2)],'tdx.json'),_0xa76b9=a43_0x11240b['join'](_0x29353d,_0x76e227(0x1d2),this[_0x76e227(0x1e2)],_0x76e227(0x1ef))),this[_0x76e227(0x1ec)]={'session':a43_0x2607e3[_0x76e227(0x1d1)](_0x390e9c)?_0x390e9c:null,'project':_0x11f829,'profile':_0x453b80&&a43_0x2607e3[_0x76e227(0x1d1)](_0x453b80)?_0x453b80:null,'profileCredentials':_0xa76b9&&a43_0x2607e3[_0x76e227(0x1d1)](_0xa76b9)?_0xa76b9:null,'global':a43_0x2607e3['existsSync'](_0x17563f)?_0x17563f:null,'globalCredentials':a43_0x2607e3[_0x76e227(0x1d1)](_0x2a3a45)?_0x2a3a45:null};}[a43_0x411c6a(0x1d5)](_0x396ffb,_0x4e7781){const _0x205e3a=a43_0x411c6a;if(!_0x4e7781)return _0x205e3a(0x1ce);const _0x330278=_0x4e7781;if(this[_0x205e3a(0x1e3)][_0x205e3a(0x1c3)][_0x396ffb]===_0x330278){if(_0x396ffb===_0x205e3a(0x1e1)&&_0x330278===_0x205e3a(0x1ee)&&!this[_0x205e3a(0x1e3)][_0x205e3a(0x1cb)][_0x205e3a(0x1e1)]&&!this[_0x205e3a(0x1e3)][_0x205e3a(0x1d6)][_0x205e3a(0x1e1)]&&!this[_0x205e3a(0x1e3)]['profile'][_0x205e3a(0x1e1)]&&!this[_0x205e3a(0x1e3)][_0x205e3a(0x1f0)][_0x205e3a(0x1e1)])return _0x205e3a(0x1bf);return _0x205e3a(0x1c2)+_0x396ffb['replace'](/_/g,'-');}if(this[_0x205e3a(0x1e3)][_0x205e3a(0x1cb)][_0x396ffb]===_0x330278)return _0x205e3a(0x1cb);if(this['layers'][_0x205e3a(0x1d6)][_0x396ffb]===_0x330278)return _0x205e3a(0x1d6);if(this[_0x205e3a(0x1e3)][_0x205e3a(0x1d0)][_0x396ffb]===_0x330278)return _0x205e3a(0x1e7)+this[_0x205e3a(0x1e2)];if(this['layers']['global'][_0x396ffb]===_0x330278)return _0x205e3a(0x1f0);return _0x205e3a(0x1bf);}[a43_0x411c6a(0x1d7)](){const _0x5f5101=a43_0x411c6a,_0x594a36=a43_0x11240b[_0x5f5101(0x1eb)](getConfigDir(),_0x5f5101(0x1bb));if(!a43_0x2607e3[_0x5f5101(0x1d1)](_0x594a36))return{};try{const _0x463707=a43_0x2607e3['readFileSync'](_0x594a36,_0x5f5101(0x1e6));return JSON[_0x5f5101(0x1d8)](_0x463707);}catch{return{};}}[a43_0x411c6a(0x1e4)](_0x46ee1e){const _0x419983=a43_0x411c6a;_0x46ee1e['site']=this[_0x419983(0x1e1)],!_0x46ee1e[_0x419983(0x1c5)]&&this['database']&&(_0x46ee1e[_0x419983(0x1c5)]=this[_0x419983(0x1c5)]),!_0x46ee1e[_0x419983(0x1ed)]&&this[_0x419983(0x1f2)]&&(_0x46ee1e[_0x419983(0x1ed)]=this['parent_segment']),!_0x46ee1e[_0x419983(0x1c7)]&&this[_0x419983(0x1b8)]&&(_0x46ee1e[_0x419983(0x1c7)]=this[_0x419983(0x1b8)]),!_0x46ee1e[_0x419983(0x1dd)]&&this[_0x419983(0x1cd)]&&(_0x46ee1e['llmProject']=this[_0x419983(0x1cd)]);}[a43_0x411c6a(0x1c0)](){const _0x10e6fd=a43_0x411c6a;return[{'key':_0x10e6fd(0x1e1),'value':this['site']},{'key':_0x10e6fd(0x1c5),'value':this[_0x10e6fd(0x1c5)]},{'key':'parent_segment','value':this[_0x10e6fd(0x1f2)]},{'key':'segment_path','value':this['segment_path']},{'key':_0x10e6fd(0x1cd),'value':this[_0x10e6fd(0x1cd)]},{'key':_0x10e6fd(0x1d0),'value':this[_0x10e6fd(0x1e2)]||undefined}];}[a43_0x411c6a(0x1c8)](){const _0x4a21f5=a43_0x411c6a;console[_0x4a21f5(0x1e9)]('[context]');for(const {key:_0x2f17a3,value:_0x35c336}of this[_0x4a21f5(0x1c0)]()){_0x35c336&&console['log'](_0x2f17a3+':\x20'+_0x35c336);}}[a43_0x411c6a(0x1f7)](){const _0x57ae04=a43_0x411c6a;console[_0x57ae04(0x1e9)](_0x57ae04(0x1f4));for(const {key:_0x2e25d5,value:_0xef4994}of this[_0x57ae04(0x1c0)]()){if(_0xef4994){const _0x2f4450=_0x2e25d5==='profile'?'(active)':'('+this['getSource'](_0x2e25d5,_0xef4994)+')';console[_0x57ae04(0x1e9)](_0x2e25d5+':\x20'+_0xef4994+'\x20'+_0x2f4450);}}console[_0x57ae04(0x1e9)](_0x57ae04(0x1ba));const _0x5658bf=[{'label':'Session','path':this[_0x57ae04(0x1ec)][_0x57ae04(0x1cb)],'extra':'(session:\x20'+this[_0x57ae04(0x1c1)]+')'},{'label':'Project','path':this[_0x57ae04(0x1ec)][_0x57ae04(0x1d6)]},{'label':_0x57ae04(0x1ea),'path':this[_0x57ae04(0x1ec)][_0x57ae04(0x1d0)]},{'label':_0x57ae04(0x1d9),'path':this['configFiles']['profileCredentials']},{'label':_0x57ae04(0x1e0),'path':this[_0x57ae04(0x1ec)]['global']},{'label':_0x57ae04(0x1c9),'path':this[_0x57ae04(0x1ec)][_0x57ae04(0x1f1)]}];for(const {label:_0x2a8807,path:_0x3cbf57,extra:_0x5e859c}of _0x5658bf){if(_0x3cbf57)console[_0x57ae04(0x1e9)](_0x2a8807+':\x20'+_0x3cbf57+'\x20✓'+(_0x5e859c?'\x20'+_0x5e859c:''));else{if(_0x2a8807===_0x57ae04(0x1d3))console[_0x57ae04(0x1e9)](_0x2a8807+_0x57ae04(0x1f3)+this[_0x57ae04(0x1c1)]+')');else(_0x2a8807===_0x57ae04(0x1ca)||_0x2a8807===_0x57ae04(0x1e0))&&console[_0x57ae04(0x1e9)](_0x2a8807+_0x57ae04(0x1cc));}}}async['resolveAPIKeyAsync'](){const _0x4dd2bc=a43_0x411c6a;return this[_0x4dd2bc(0x1df)]=await getAPIKeyAsync(this[_0x4dd2bc(0x1e1)],this[_0x4dd2bc(0x1e2)]||undefined),this[_0x4dd2bc(0x1df)];}static async['createAsync'](_0x52ade5){const _0x10a939=a43_0x411c6a,_0x29da27=new GlobalContext(_0x52ade5);return await _0x29da27[_0x10a939(0x1f6)](),_0x29da27;}}
@@ -1 +1 @@
1
- const a44_0x53c353=a44_0x5678;(function(_0xd61a4e,_0x13891a){const _0x5c39b5=a44_0x5678,_0x950016=_0xd61a4e();while(!![]){try{const _0x245adf=-parseInt(_0x5c39b5(0x11a))/0x1*(parseInt(_0x5c39b5(0x11c))/0x2)+parseInt(_0x5c39b5(0x129))/0x3*(-parseInt(_0x5c39b5(0x132))/0x4)+-parseInt(_0x5c39b5(0x118))/0x5*(parseInt(_0x5c39b5(0x130))/0x6)+-parseInt(_0x5c39b5(0x11b))/0x7*(-parseInt(_0x5c39b5(0x116))/0x8)+-parseInt(_0x5c39b5(0x133))/0x9*(-parseInt(_0x5c39b5(0x131))/0xa)+parseInt(_0x5c39b5(0x10d))/0xb*(parseInt(_0x5c39b5(0x134))/0xc)+parseInt(_0x5c39b5(0x114))/0xd*(parseInt(_0x5c39b5(0x12e))/0xe);if(_0x245adf===_0x13891a)break;else _0x950016['push'](_0x950016['shift']());}catch(_0x176739){_0x950016['push'](_0x950016['shift']());}}}(a44_0x28ad,0xa34c2));const SERVICE_NAME=a44_0x53c353(0x12b);let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0xffcc13=a44_0x53c353;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x487dd5=await import(_0xffcc13(0x11d));return keyringModule=_0x487dd5[_0xffcc13(0x122)],keyringModule;}catch(_0x417b78){return keyringLoadError=_0x417b78 instanceof Error?_0x417b78:new Error(String(_0x417b78)),null;}}function getAccountName(_0x4c04ce){const _0x4977b8=_0x4c04ce||'';return'profile:'+_0x4977b8+':api_key';}function a44_0x28ad(){const _0x530982=['access_denied','deletePassword','access','not\x20supported','-25300','12528126qjytlF','__keychain_test__','7011464qWnheY','reason','5598260bHsyeI','toLowerCase','1nSdnfu','7LQPaTO','1130334MYKuIp','@zowe/secrets-for-zowe-sdk','not\x20available','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.','getPassword','System\x20keychain\x20is\x20not\x20available','keyring','could\x20not\x20be\x20found','not_found','unavailable','message','includes','Warning:\x20','38427LZIYqu','cannot\x20find','tdx','setPassword','value','14VfHzkd','-25293','6YchmtZ','2412310RtbiAr','116wHrlTQ','9IkHlMl','240CJGBlI','354079oHcokm','success'];a44_0x28ad=function(){return _0x530982;};return a44_0x28ad();}export async function getKeychainAPIKey(_0x2c9afa){const _0x587db0=a44_0x53c353,_0x3ade9e=await getKeychainAPIKeyWithStatus(_0x2c9afa);if(_0x3ade9e[_0x587db0(0x10e)])return _0x3ade9e[_0x587db0(0x12d)];return _0x3ade9e[_0x587db0(0x117)]==='access_denied'&&console['error'](_0x587db0(0x128)+_0x3ade9e[_0x587db0(0x126)]),null;}export async function getKeychainAPIKeyWithStatus(_0x7dcbd2){const _0x354eaf=a44_0x53c353;try{const _0x307ca1=await getKeyring();if(!_0x307ca1)return{'success':![],'reason':'unavailable'};const _0x199d68=getAccountName(_0x7dcbd2),_0x2e501c=await _0x307ca1[_0x354eaf(0x120)](SERVICE_NAME,_0x199d68);if(_0x2e501c)return{'success':!![],'value':_0x2e501c};return{'success':![],'reason':'not_found'};}catch(_0x1f0c79){const _0xbd8d75=_0x1f0c79 instanceof Error?_0x1f0c79[_0x354eaf(0x126)]:String(_0x1f0c79);if(_0xbd8d75[_0x354eaf(0x127)](_0x354eaf(0x113))||_0xbd8d75[_0x354eaf(0x119)]()[_0x354eaf(0x127)](_0x354eaf(0x123))||_0xbd8d75[_0x354eaf(0x119)]()[_0x354eaf(0x127)]('not\x20found'))return{'success':![],'reason':_0x354eaf(0x124)};if(_0xbd8d75[_0x354eaf(0x127)](_0x354eaf(0x12f))||_0xbd8d75['toLowerCase']()[_0x354eaf(0x127)]('restricted')||_0xbd8d75['toLowerCase']()[_0x354eaf(0x127)](_0x354eaf(0x111)))return{'success':![],'reason':_0x354eaf(0x10f),'message':_0x354eaf(0x11f)};return{'success':![],'reason':_0x354eaf(0x125),'message':_0xbd8d75};}}function a44_0x5678(_0x538cb8,_0x3c9243){const _0x28ad08=a44_0x28ad();return a44_0x5678=function(_0x5678bb,_0x5ec8e9){_0x5678bb=_0x5678bb-0x10d;let _0x2aeb4a=_0x28ad08[_0x5678bb];return _0x2aeb4a;},a44_0x5678(_0x538cb8,_0x3c9243);}export async function saveKeychainAPIKey(_0x124a4f,_0x44d1e5){const _0xe33a76=a44_0x53c353,_0x48eecf=await getKeyring();if(!_0x48eecf)throw new Error(_0xe33a76(0x121));const _0x1a140a=getAccountName(_0x44d1e5);await _0x48eecf[_0xe33a76(0x12c)](SERVICE_NAME,_0x1a140a,_0x124a4f);}export async function deleteKeychainAPIKey(_0xb42c3c){const _0x333105=a44_0x53c353;try{const _0x568c50=await getKeyring();if(!_0x568c50)return![];const _0x13515d=getAccountName(_0xb42c3c);return await _0x568c50[_0x333105(0x110)](SERVICE_NAME,_0x13515d);}catch{return![];}}export async function isKeychainAvailable(){const _0x22ecc3=a44_0x53c353;try{const _0x31b582=await getKeyring();if(!_0x31b582)return![];return await _0x31b582[_0x22ecc3(0x120)](SERVICE_NAME,_0x22ecc3(0x115)),!![];}catch(_0x139d56){const _0x13688e=_0x139d56 instanceof Error?_0x139d56[_0x22ecc3(0x126)]['toLowerCase']():'';if(_0x13688e[_0x22ecc3(0x127)](_0x22ecc3(0x11e))||_0x13688e[_0x22ecc3(0x127)](_0x22ecc3(0x112))||_0x13688e[_0x22ecc3(0x127)](_0x22ecc3(0x12a)))return![];return!![];}}
1
+ const a44_0x48a6f0=a44_0x22cc;(function(_0x372ebf,_0x533f0b){const _0x94796a=a44_0x22cc,_0x1fdfc0=_0x372ebf();while(!![]){try{const _0x3158e6=-parseInt(_0x94796a(0x20a))/0x1*(parseInt(_0x94796a(0x1f6))/0x2)+-parseInt(_0x94796a(0x215))/0x3*(-parseInt(_0x94796a(0x1f8))/0x4)+-parseInt(_0x94796a(0x1fc))/0x5+-parseInt(_0x94796a(0x204))/0x6*(-parseInt(_0x94796a(0x20f))/0x7)+parseInt(_0x94796a(0x1fd))/0x8*(parseInt(_0x94796a(0x1f7))/0x9)+-parseInt(_0x94796a(0x1f4))/0xa+-parseInt(_0x94796a(0x200))/0xb*(-parseInt(_0x94796a(0x211))/0xc);if(_0x3158e6===_0x533f0b)break;else _0x1fdfc0['push'](_0x1fdfc0['shift']());}catch(_0x21f5ee){_0x1fdfc0['push'](_0x1fdfc0['shift']());}}}(a44_0x5804,0x300e6));function a44_0x22cc(_0x8dfb7c,_0x57f98d){const _0x5804d4=a44_0x5804();return a44_0x22cc=function(_0x22cccb,_0x5e9151){_0x22cccb=_0x22cccb-0x1f4;let _0x561a38=_0x5804d4[_0x22cccb];return _0x561a38;},a44_0x22cc(_0x8dfb7c,_0x57f98d);}function a44_0x5804(){const _0x8b619f=['restricted','value','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.','269673GSdszT','error','@zowe/secrets-for-zowe-sdk','962380AqUxCO','not\x20available','2lyLZiz','342gWFpxp','8OKglXD','-25300','deletePassword','not_found','1684100EPqWie','59176XrbYWz','keyring','access','1397Vnmyuz','getPassword','toLowerCase','includes','15516DJmHhh','success','not\x20found','cannot\x20find','Warning:\x20','setPassword','194273NVtaCV','tdx','profile:','message','access_denied','882jyNNxc',':api_key','3540VxIcrX'];a44_0x5804=function(){return _0x8b619f;};return a44_0x5804();}const SERVICE_NAME=a44_0x48a6f0(0x20b);let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x4284fa=a44_0x48a6f0;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x329f39=await import(_0x4284fa(0x217));return keyringModule=_0x329f39[_0x4284fa(0x1fe)],keyringModule;}catch(_0x36cf21){return keyringLoadError=_0x36cf21 instanceof Error?_0x36cf21:new Error(String(_0x36cf21)),null;}}function getAccountName(_0x1f4674){const _0x5c25c8=a44_0x48a6f0,_0x3031cd=_0x1f4674||'';return _0x5c25c8(0x20c)+_0x3031cd+_0x5c25c8(0x210);}export async function getKeychainAPIKey(_0x5549b9){const _0x300f8e=a44_0x48a6f0,_0x284c10=await getKeychainAPIKeyWithStatus(_0x5549b9);if(_0x284c10[_0x300f8e(0x205)])return _0x284c10[_0x300f8e(0x213)];return _0x284c10['reason']===_0x300f8e(0x20e)&&console[_0x300f8e(0x216)](_0x300f8e(0x208)+_0x284c10[_0x300f8e(0x20d)]),null;}export async function getKeychainAPIKeyWithStatus(_0x2621b9){const _0x13d28f=a44_0x48a6f0;try{const _0x36fe5d=await getKeyring();if(!_0x36fe5d)return{'success':![],'reason':'unavailable'};const _0x58c703=getAccountName(_0x2621b9),_0x234800=await _0x36fe5d[_0x13d28f(0x201)](SERVICE_NAME,_0x58c703);if(_0x234800)return{'success':!![],'value':_0x234800};return{'success':![],'reason':_0x13d28f(0x1fb)};}catch(_0x235e05){const _0x2ef12d=_0x235e05 instanceof Error?_0x235e05[_0x13d28f(0x20d)]:String(_0x235e05);if(_0x2ef12d[_0x13d28f(0x203)](_0x13d28f(0x1f9))||_0x2ef12d['toLowerCase']()[_0x13d28f(0x203)]('could\x20not\x20be\x20found')||_0x2ef12d[_0x13d28f(0x202)]()[_0x13d28f(0x203)](_0x13d28f(0x206)))return{'success':![],'reason':_0x13d28f(0x1fb)};if(_0x2ef12d[_0x13d28f(0x203)]('-25293')||_0x2ef12d['toLowerCase']()['includes'](_0x13d28f(0x212))||_0x2ef12d['toLowerCase']()[_0x13d28f(0x203)](_0x13d28f(0x1ff)))return{'success':![],'reason':_0x13d28f(0x20e),'message':_0x13d28f(0x214)};return{'success':![],'reason':'unavailable','message':_0x2ef12d};}}export async function saveKeychainAPIKey(_0x393245,_0x203ff4){const _0x37d325=a44_0x48a6f0,_0x1c414f=await getKeyring();if(!_0x1c414f)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x3881a1=getAccountName(_0x203ff4);await _0x1c414f[_0x37d325(0x209)](SERVICE_NAME,_0x3881a1,_0x393245);}export async function deleteKeychainAPIKey(_0x1d72bb){const _0x4f2a0f=a44_0x48a6f0;try{const _0x3e0d20=await getKeyring();if(!_0x3e0d20)return![];const _0x2a14f3=getAccountName(_0x1d72bb);return await _0x3e0d20[_0x4f2a0f(0x1fa)](SERVICE_NAME,_0x2a14f3);}catch{return![];}}export async function isKeychainAvailable(){const _0x1b7dad=a44_0x48a6f0;try{const _0x4230d0=await getKeyring();if(!_0x4230d0)return![];return await _0x4230d0[_0x1b7dad(0x201)](SERVICE_NAME,'__keychain_test__'),!![];}catch(_0x4fc3ce){const _0x2ddba8=_0x4fc3ce instanceof Error?_0x4fc3ce[_0x1b7dad(0x20d)][_0x1b7dad(0x202)]():'';if(_0x2ddba8['includes'](_0x1b7dad(0x1f5))||_0x2ddba8[_0x1b7dad(0x203)]('not\x20supported')||_0x2ddba8[_0x1b7dad(0x203)](_0x1b7dad(0x207)))return![];return!![];}}
@@ -1 +1 @@
1
- (function(_0x5bd1d3,_0x2ef869){const _0x1298fe=a45_0x5821,_0x1ee5ae=_0x5bd1d3();while(!![]){try{const _0x4c5725=-parseInt(_0x1298fe(0x17b))/0x1*(parseInt(_0x1298fe(0x19d))/0x2)+-parseInt(_0x1298fe(0x1a3))/0x3*(-parseInt(_0x1298fe(0x18c))/0x4)+-parseInt(_0x1298fe(0x184))/0x5+-parseInt(_0x1298fe(0x175))/0x6*(-parseInt(_0x1298fe(0x1b5))/0x7)+parseInt(_0x1298fe(0x196))/0x8*(-parseInt(_0x1298fe(0x17a))/0x9)+-parseInt(_0x1298fe(0x1b7))/0xa*(-parseInt(_0x1298fe(0x178))/0xb)+parseInt(_0x1298fe(0x1b6))/0xc;if(_0x4c5725===_0x2ef869)break;else _0x1ee5ae['push'](_0x1ee5ae['shift']());}catch(_0x278e0b){_0x1ee5ae['push'](_0x1ee5ae['shift']());}}}(a45_0x3713,0x1e989));function a45_0x3713(){const _0x18a6ed=['.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','some',',\x20creating\x20new\x20file','Error:\x20','map','join','llm_agent','Warning:\x20Profile\x20\x27','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','site','.env','419370FtjCip','isDirectory','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','33vsDmVM','string','579015QmCUax','43456iVzspY','Profile\x20\x27','\x20\x20mv\x20\x22','local','from','stringify','object','\x22\x20\x22','parse','1191930ylyvNb','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','user','llm_project','find','description','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','entries','320QQkIsX','push','test','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x20does\x20not\x20exist','tdx.json','readdirSync','filter','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Failed\x20to\x20parse\x20','16sQDHFF','localeCompare','toISOString','parent_segment','profiles','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','warn','10bczOOI','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','Invalid\x20profile\x20name:\x20','database','length','existsSync','546RVdwhJ','.env.','set','includes','readFileSync','keys','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:',':\x20Invalid\x20JSON\x20syntax','Warning:\x20Failed\x20to\x20parse\x20','name','message','Profile\x20','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','utf-8','\x27:\x20unknown\x20config\x20key\x20\x27','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','sort','\x20already\x20exists','21YbbJAy','3072312DbWiQI','764620UKViHp','profile'];a45_0x3713=function(){return _0x18a6ed;};return a45_0x3713();}import*as a45_0x1ba69a from'node:fs';import*as a45_0x3ed62b from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export function getProfileParams(_0x365ba9){const _0x29b75d=a45_0x5821,_0x25d786={};if(!_0x365ba9)return _0x25d786;for(const [_0x134612,_0x3123a8]of Object[_0x29b75d(0x18b)](_0x365ba9)){_0x134612!==_0x29b75d(0x189)&&_0x3123a8!==undefined&&(_0x25d786[_0x134612]=_0x3123a8);}return _0x25d786;}export function getProfilesDir(){const _0x5783c5=a45_0x5821;return a45_0x3ed62b[_0x5783c5(0x1be)](getConfigDir(),_0x5783c5(0x19a));}function getProfileDir(_0x279e9c){const _0x290ebe=a45_0x5821;return a45_0x3ed62b[_0x290ebe(0x1be)](getProfilesDir(),_0x279e9c);}function getProfileConfigPath(_0xed2dd3){const _0x19c7d1=a45_0x5821;return a45_0x3ed62b[_0x19c7d1(0x1be)](getProfileDir(_0xed2dd3),_0x19c7d1(0x191));}function getProfileEnvPath(_0x3f0822){const _0xead6dc=a45_0x5821;return a45_0x3ed62b[_0xead6dc(0x1be)](getProfileDir(_0x3f0822),_0xead6dc(0x174));}function a45_0x5821(_0x1662cf,_0x3c5849){const _0x371325=a45_0x3713();return a45_0x5821=function(_0x5821c8,_0x105803){_0x5821c8=_0x5821c8-0x170;let _0x36949b=_0x371325[_0x5821c8];return _0x36949b;},a45_0x5821(_0x1662cf,_0x3c5849);}function getGlobalConfigPath(){const _0x130d96=a45_0x5821;return a45_0x3ed62b[_0x130d96(0x1be)](getConfigDir(),'tdx.json');}function validateProfileName(_0x1ab5a2){const _0x1a9380=a45_0x5821;if(!/^[a-zA-Z0-9_-]+$/[_0x1a9380(0x18e)](_0x1ab5a2))throw new Error(_0x1a9380(0x19f)+_0x1ab5a2+_0x1a9380(0x1b9));}function validateProfileConfig(_0x5b3a12,_0x3aa6dc){const _0x2361da=a45_0x5821;if(typeof _0x5b3a12!==_0x2361da(0x181)||_0x5b3a12===null)throw new Error('Profile\x20\x27'+_0x3aa6dc+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x21b6b1=['description','site','database',_0x2361da(0x199),_0x2361da(0x187),_0x2361da(0x170)],_0x10f7c6=_0x5b3a12;for(const _0x18b03e of Object[_0x2361da(0x1a8)](_0x10f7c6)){!_0x21b6b1[_0x2361da(0x1a6)](_0x18b03e)&&console['warn'](_0x2361da(0x171)+_0x3aa6dc+_0x2361da(0x1b1)+_0x18b03e+'\x27\x20will\x20be\x20ignored');}if(_0x10f7c6[_0x2361da(0x189)]!==undefined&&typeof _0x10f7c6['description']!==_0x2361da(0x179))throw new Error(_0x2361da(0x17c)+_0x3aa6dc+_0x2361da(0x185));if(_0x10f7c6[_0x2361da(0x173)]!==undefined&&typeof _0x10f7c6[_0x2361da(0x173)]!=='string')throw new Error('Profile\x20\x27'+_0x3aa6dc+_0x2361da(0x172));if(_0x10f7c6[_0x2361da(0x1a0)]!==undefined&&typeof _0x10f7c6[_0x2361da(0x1a0)]!==_0x2361da(0x179))throw new Error(_0x2361da(0x17c)+_0x3aa6dc+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x10f7c6[_0x2361da(0x199)]!==undefined&&typeof _0x10f7c6['parent_segment']!=='string')throw new Error(_0x2361da(0x17c)+_0x3aa6dc+_0x2361da(0x194));if(_0x10f7c6['llm_project']!==undefined&&typeof _0x10f7c6[_0x2361da(0x187)]!==_0x2361da(0x179))throw new Error(_0x2361da(0x17c)+_0x3aa6dc+_0x2361da(0x19e));if(_0x10f7c6[_0x2361da(0x170)]!==undefined&&typeof _0x10f7c6[_0x2361da(0x170)]!==_0x2361da(0x179))throw new Error(_0x2361da(0x17c)+_0x3aa6dc+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x2dc6c4,_0x3cf89f){const _0x525d86=a45_0x5821;if(!a45_0x1ba69a[_0x525d86(0x1a2)](_0x2dc6c4))return[];try{const _0x14627c=a45_0x1ba69a['readFileSync'](_0x2dc6c4,_0x525d86(0x1b0)),_0x58f97f=JSON['parse'](_0x14627c);if(!_0x58f97f[_0x525d86(0x19a)]||typeof _0x58f97f['profiles']!=='object')return[];const _0x58c078=[];for(const [_0x2cbead,_0x385d37]of Object[_0x525d86(0x18b)](_0x58f97f['profiles'])){try{validateProfileConfig(_0x385d37,_0x2cbead);const _0x3f9518=getNewCredentialPath(_0x2cbead),_0x286439=getOldCredentialPath(_0x2cbead),_0x44ff7e=a45_0x1ba69a[_0x525d86(0x1a2)](_0x3f9518)||a45_0x1ba69a[_0x525d86(0x1a2)](_0x286439);_0x58c078[_0x525d86(0x18d)]({'name':_0x2cbead,'config':_0x385d37,'metadata':{'name':_0x2cbead,'createdAt':new Date()[_0x525d86(0x198)]()},'hasCredentials':_0x44ff7e,'scope':_0x3cf89f});}catch(_0x178aa9){_0x178aa9 instanceof Error&&(console[_0x525d86(0x19c)](_0x525d86(0x18a)+_0x2dc6c4+':'),console['warn']('\x20\x20'+_0x178aa9[_0x525d86(0x1ad)]+'\x0a'));}}return _0x58c078;}catch(_0x367ead){return _0x367ead instanceof SyntaxError?(console[_0x525d86(0x19c)](_0x525d86(0x195)+_0x2dc6c4+_0x525d86(0x1aa)),console[_0x525d86(0x19c)](_0x525d86(0x1bc)+_0x367ead[_0x525d86(0x1ad)]+'\x0a')):console['warn'](_0x525d86(0x177)+_0x2dc6c4+':\x20'+_0x367ead+'\x0a'),[];}}export function getNewCredentialPath(_0x5868d2){const _0x1a9e7f=a45_0x5821;return a45_0x3ed62b[_0x1a9e7f(0x1be)](getConfigDir(),_0x1a9e7f(0x1a4)+_0x5868d2);}function getOldCredentialPath(_0x329d3a){const _0x4ca7f4=a45_0x5821;return a45_0x3ed62b['join'](getProfilesDir(),_0x329d3a,_0x4ca7f4(0x174));}function loadProfilesFromTdxJsonFiles(){const _0x35dc9=a45_0x5821,_0x28d64f=[],_0x4ce7d4=findProjectConfigPath();_0x4ce7d4&&_0x28d64f[_0x35dc9(0x18d)](...loadProfilesFromTdxJson(_0x4ce7d4,_0x35dc9(0x17e)));const _0x5556f0=a45_0x3ed62b[_0x35dc9(0x1be)](getConfigDir(),'tdx.json');return _0x28d64f[_0x35dc9(0x18d)](...loadProfilesFromTdxJson(_0x5556f0,_0x35dc9(0x186))),_0x28d64f;}function loadProfilesFromDirectories(){const _0x20c168=a45_0x5821,_0x12cb06=getProfilesDir();if(!a45_0x1ba69a[_0x20c168(0x1a2)](_0x12cb06))return[];try{return a45_0x1ba69a[_0x20c168(0x192)](_0x12cb06,{'withFileTypes':!![]})[_0x20c168(0x193)](_0x204297=>_0x204297[_0x20c168(0x176)]())[_0x20c168(0x1bd)](_0x31fcf6=>_0x31fcf6[_0x20c168(0x1ac)])[_0x20c168(0x193)](_0x41a9b6=>{const _0x19e1ba=_0x20c168,_0x49cda0=getProfileConfigPath(_0x41a9b6),_0x39f21a=getProfileEnvPath(_0x41a9b6);return a45_0x1ba69a['existsSync'](_0x49cda0)||a45_0x1ba69a[_0x19e1ba(0x1a2)](_0x39f21a);})[_0x20c168(0x1bd)](_0x4a9c6d=>{const _0x3f292b=loadProfileFromDirectory(_0x4a9c6d);if(_0x3f292b)return{..._0x3f292b,'scope':'directory'};return null;})['filter'](_0x498699=>_0x498699!==null);}catch{return[];}}function loadProfileFromDirectory(_0x2c3cc6){const _0x5a6c92=a45_0x5821,_0x33bf64=getProfileConfigPath(_0x2c3cc6),_0x3e2a99=getOldCredentialPath(_0x2c3cc6);if(!a45_0x1ba69a[_0x5a6c92(0x1a2)](_0x33bf64)&&!a45_0x1ba69a[_0x5a6c92(0x1a2)](_0x3e2a99))return null;let _0x5adce9={},_0x4a42b8={'name':_0x2c3cc6,'createdAt':new Date()[_0x5a6c92(0x198)]()};if(a45_0x1ba69a['existsSync'](_0x33bf64))try{const _0x2e0a7f=a45_0x1ba69a[_0x5a6c92(0x1a7)](_0x33bf64,_0x5a6c92(0x1b0)),_0x6178bb=JSON[_0x5a6c92(0x183)](_0x2e0a7f),{metadata:_0x5ca74c,..._0x514e3c}=_0x6178bb;_0x5adce9=_0x514e3c,_0x5ca74c&&(_0x4a42b8=_0x5ca74c);}catch{}return{'name':_0x2c3cc6,'config':_0x5adce9,'metadata':_0x4a42b8,'hasCredentials':a45_0x1ba69a['existsSync'](_0x3e2a99),'scope':'directory'};}export function listProfiles(){const _0x10aa1f=a45_0x5821,_0x41a446=loadProfilesFromTdxJsonFiles(),_0xa41919=loadProfilesFromDirectories();if(_0xa41919[_0x10aa1f(0x1a1)]>0x0){const _0x5b1a3a=_0xa41919['map'](_0x1b0318=>_0x1b0318[_0x10aa1f(0x1ac)])[_0x10aa1f(0x1be)](',\x20'),_0x5844fb=getConfigDir();console[_0x10aa1f(0x19c)](_0x10aa1f(0x1b2)+_0x5b1a3a),console[_0x10aa1f(0x19c)](_0x10aa1f(0x1a9)),console[_0x10aa1f(0x19c)]('\x20\x201.\x20Edit:\x20'+a45_0x3ed62b[_0x10aa1f(0x1be)](_0x5844fb,_0x10aa1f(0x191))),console['warn'](_0x10aa1f(0x1af)),console[_0x10aa1f(0x19c)](_0x10aa1f(0x19b));}const _0x1ea649=[..._0x41a446,..._0xa41919],_0x53231a=new Map();for(const _0x54a209 of _0x1ea649){!_0x53231a['has'](_0x54a209[_0x10aa1f(0x1ac)])&&_0x53231a[_0x10aa1f(0x1a5)](_0x54a209[_0x10aa1f(0x1ac)],_0x54a209);}return Array[_0x10aa1f(0x17f)](_0x53231a['values']())[_0x10aa1f(0x1b3)]((_0x573ace,_0x13fabc)=>_0x573ace['name'][_0x10aa1f(0x197)](_0x13fabc[_0x10aa1f(0x1ac)]));}export function profileExists(_0x330de9){const _0x5dc700=a45_0x5821,_0x171122=listProfiles();return _0x171122[_0x5dc700(0x1ba)](_0x49f898=>_0x49f898[_0x5dc700(0x1ac)]===_0x330de9);}export function loadProfile(_0x1ddcac){const _0x359dc8=a45_0x5821;validateProfileName(_0x1ddcac);const _0x335923=listProfiles(),_0x19bef8=_0x335923[_0x359dc8(0x188)](_0x5bf56e=>_0x5bf56e[_0x359dc8(0x1ac)]===_0x1ddcac);return _0x19bef8||null;}export function saveProfile(_0x31ddad,_0x3bef50,_0x233ae1=![]){saveProfileToUserConfig(_0x31ddad,_0x3bef50);}export function deleteProfile(_0x2fb975){const _0x488cf4=a45_0x5821;validateProfileName(_0x2fb975);const _0x4fa2ed=getProfileDir(_0x2fb975);if(!a45_0x1ba69a[_0x488cf4(0x1a2)](_0x4fa2ed))throw new Error(_0x488cf4(0x1ae)+_0x2fb975+_0x488cf4(0x190));a45_0x1ba69a['rmSync'](_0x4fa2ed,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x3ed96f,_0x4cbab4){const _0x1d73a2=a45_0x5821;validateProfileName(_0x3ed96f);const _0xc6f87e=getGlobalConfigPath(),_0x89f11e=getConfigDir();!a45_0x1ba69a[_0x1d73a2(0x1a2)](_0x89f11e)&&createSecureDirectory(_0x89f11e);let _0x22adc2={};if(a45_0x1ba69a['existsSync'](_0xc6f87e))try{const _0x252da0=a45_0x1ba69a[_0x1d73a2(0x1a7)](_0xc6f87e,_0x1d73a2(0x1b0));_0x22adc2=JSON[_0x1d73a2(0x183)](_0x252da0);}catch{console[_0x1d73a2(0x19c)](_0x1d73a2(0x1ab)+_0xc6f87e+_0x1d73a2(0x1bb));}!_0x22adc2['profiles']&&(_0x22adc2['profiles']={}),_0x22adc2[_0x1d73a2(0x19a)][_0x3ed96f]=_0x4cbab4,writeSecureFile(_0xc6f87e,JSON[_0x1d73a2(0x180)](_0x22adc2,null,0x2));}export function getActiveProfile(){const _0x42f5eb=a45_0x5821,_0x51fa11=loadSessionContext();if(_0x51fa11?.['profile'])return _0x51fa11[_0x42f5eb(0x1b8)];const _0x1f104a=getGlobalConfigPath();if(!a45_0x1ba69a[_0x42f5eb(0x1a2)](_0x1f104a))return null;try{const _0x45d903=a45_0x1ba69a[_0x42f5eb(0x1a7)](_0x1f104a,_0x42f5eb(0x1b0)),_0x19788c=JSON[_0x42f5eb(0x183)](_0x45d903);return _0x19788c[_0x42f5eb(0x1b8)]||null;}catch{return null;}}export function createProfile(_0x402418,_0x12de3e){const _0x784863=a45_0x5821;validateProfileName(_0x402418);if(profileExists(_0x402418))throw new Error(_0x784863(0x1ae)+_0x402418+_0x784863(0x1b4));saveProfile(_0x402418,_0x12de3e);}export function saveProfileCredentials(_0x25a869,_0x12261c){const _0xbe74f1=a45_0x5821;validateProfileName(_0x25a869);if(!profileExists(_0x25a869))throw new Error(_0xbe74f1(0x1ae)+_0x25a869+_0xbe74f1(0x190));const _0x449d56=getNewCredentialPath(_0x25a869);writeSecureFile(_0x449d56,_0x12261c);}export function loadProfileCredentials(_0x282c8d){const _0x51ecff=a45_0x5821;validateProfileName(_0x282c8d);const _0x52e388=getNewCredentialPath(_0x282c8d);if(a45_0x1ba69a[_0x51ecff(0x1a2)](_0x52e388))try{return a45_0x1ba69a[_0x51ecff(0x1a7)](_0x52e388,_0x51ecff(0x1b0));}catch{}const _0x3d6369=getOldCredentialPath(_0x282c8d);if(a45_0x1ba69a[_0x51ecff(0x1a2)](_0x3d6369)){console[_0x51ecff(0x19c)](_0x51ecff(0x18f)+_0x282c8d+'\x27'),console[_0x51ecff(0x19c)]('To\x20migrate:'),console['warn'](_0x51ecff(0x17d)+_0x3d6369+_0x51ecff(0x182)+_0x52e388+'\x22'),console[_0x51ecff(0x19c)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a45_0x1ba69a['readFileSync'](_0x3d6369,_0x51ecff(0x1b0));}catch{return null;}}return null;}
1
+ (function(_0x5608b9,_0x3ee7b8){const _0x352c77=a45_0x8328,_0x16b7b9=_0x5608b9();while(!![]){try{const _0x5a8f38=-parseInt(_0x352c77(0xbe))/0x1*(parseInt(_0x352c77(0xbc))/0x2)+-parseInt(_0x352c77(0xe0))/0x3+parseInt(_0x352c77(0xb1))/0x4*(parseInt(_0x352c77(0xa6))/0x5)+parseInt(_0x352c77(0xd8))/0x6+-parseInt(_0x352c77(0xce))/0x7*(parseInt(_0x352c77(0xad))/0x8)+-parseInt(_0x352c77(0xb5))/0x9+-parseInt(_0x352c77(0xaf))/0xa*(-parseInt(_0x352c77(0xc3))/0xb);if(_0x5a8f38===_0x3ee7b8)break;else _0x16b7b9['push'](_0x16b7b9['shift']());}catch(_0x29f068){_0x16b7b9['push'](_0x16b7b9['shift']());}}}(a45_0x5aea,0x28069));import*as a45_0x4b30ac from'node:fs';import*as a45_0x5a6d28 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';function a45_0x8328(_0x21dbbf,_0x7cd7aa){const _0x5aea3f=a45_0x5aea();return a45_0x8328=function(_0x83281e,_0x18334d){_0x83281e=_0x83281e-0xa6;let _0x2e2a9a=_0x5aea3f[_0x83281e];return _0x2e2a9a;},a45_0x8328(_0x21dbbf,_0x7cd7aa);}import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export function getProfileParams(_0x949562){const _0x28e370=a45_0x8328,_0x2f6419={};if(!_0x949562)return _0x2f6419;for(const [_0xaf191a,_0x5479e9]of Object[_0x28e370(0xae)](_0x949562)){_0xaf191a!=='description'&&_0x5479e9!==undefined&&(_0x2f6419[_0xaf191a]=_0x5479e9);}return _0x2f6419;}export function getProfilesDir(){const _0x1973a8=a45_0x8328;return a45_0x5a6d28[_0x1973a8(0xd1)](getConfigDir(),_0x1973a8(0xe8));}function getProfileDir(_0x13a99f){const _0x5c769e=a45_0x8328;return a45_0x5a6d28[_0x5c769e(0xd1)](getProfilesDir(),_0x13a99f);}function getProfileConfigPath(_0x471467){const _0x17b9a5=a45_0x8328;return a45_0x5a6d28['join'](getProfileDir(_0x471467),_0x17b9a5(0xcf));}function getProfileEnvPath(_0x52e690){const _0x5c3dc7=a45_0x8328;return a45_0x5a6d28[_0x5c3dc7(0xd1)](getProfileDir(_0x52e690),_0x5c3dc7(0xab));}function getGlobalConfigPath(){const _0x4c505e=a45_0x8328;return a45_0x5a6d28['join'](getConfigDir(),_0x4c505e(0xcf));}function validateProfileName(_0x1bd230){const _0x160da5=a45_0x8328;if(!/^[a-zA-Z0-9_-]+$/[_0x160da5(0xec)](_0x1bd230))throw new Error('Invalid\x20profile\x20name:\x20'+_0x1bd230+_0x160da5(0xe7));}function validateProfileConfig(_0x44cbfb,_0x165e7c){const _0x33e12c=a45_0x8328;if(typeof _0x44cbfb!==_0x33e12c(0xa9)||_0x44cbfb===null)throw new Error(_0x33e12c(0xbd)+_0x165e7c+_0x33e12c(0xb4));const _0x2fb859=['description',_0x33e12c(0xe2),'database',_0x33e12c(0xd4),_0x33e12c(0xee),_0x33e12c(0xb3)],_0x33dc84=_0x44cbfb;for(const _0x229d06 of Object[_0x33e12c(0xb7)](_0x33dc84)){!_0x2fb859['includes'](_0x229d06)&&console[_0x33e12c(0xcc)](_0x33e12c(0xc7)+_0x165e7c+_0x33e12c(0xb6)+_0x229d06+'\x27\x20will\x20be\x20ignored');}if(_0x33dc84[_0x33e12c(0xd6)]!==undefined&&typeof _0x33dc84[_0x33e12c(0xd6)]!=='string')throw new Error(_0x33e12c(0xbd)+_0x165e7c+_0x33e12c(0xea));if(_0x33dc84['site']!==undefined&&typeof _0x33dc84[_0x33e12c(0xe2)]!==_0x33e12c(0xd3))throw new Error(_0x33e12c(0xbd)+_0x165e7c+_0x33e12c(0xef));if(_0x33dc84[_0x33e12c(0xe1)]!==undefined&&typeof _0x33dc84[_0x33e12c(0xe1)]!=='string')throw new Error(_0x33e12c(0xbd)+_0x165e7c+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x33dc84[_0x33e12c(0xd4)]!==undefined&&typeof _0x33dc84[_0x33e12c(0xd4)]!==_0x33e12c(0xd3))throw new Error(_0x33e12c(0xbd)+_0x165e7c+_0x33e12c(0xbb));if(_0x33dc84[_0x33e12c(0xee)]!==undefined&&typeof _0x33dc84[_0x33e12c(0xee)]!=='string')throw new Error(_0x33e12c(0xbd)+_0x165e7c+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x33dc84[_0x33e12c(0xb3)]!==undefined&&typeof _0x33dc84[_0x33e12c(0xb3)]!==_0x33e12c(0xd3))throw new Error('Profile\x20\x27'+_0x165e7c+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x1b405e,_0x2879dc){const _0x43449a=a45_0x8328;if(!a45_0x4b30ac[_0x43449a(0xd0)](_0x1b405e))return[];try{const _0x50c677=a45_0x4b30ac[_0x43449a(0xc9)](_0x1b405e,_0x43449a(0xac)),_0xdd4862=JSON['parse'](_0x50c677);if(!_0xdd4862[_0x43449a(0xe8)]||typeof _0xdd4862['profiles']!==_0x43449a(0xa9))return[];const _0xa868f4=[];for(const [_0x3ac324,_0x1e6e25]of Object[_0x43449a(0xae)](_0xdd4862['profiles'])){try{validateProfileConfig(_0x1e6e25,_0x3ac324);const _0xf99518=getNewCredentialPath(_0x3ac324),_0xdd0611=getOldCredentialPath(_0x3ac324),_0x41a31c=a45_0x4b30ac[_0x43449a(0xd0)](_0xf99518)||a45_0x4b30ac[_0x43449a(0xd0)](_0xdd0611);_0xa868f4[_0x43449a(0xcb)]({'name':_0x3ac324,'config':_0x1e6e25,'metadata':{'name':_0x3ac324,'createdAt':new Date()[_0x43449a(0xde)]()},'hasCredentials':_0x41a31c,'scope':_0x2879dc});}catch(_0x84ab94){_0x84ab94 instanceof Error&&(console[_0x43449a(0xcc)](_0x43449a(0xdc)+_0x1b405e+':'),console[_0x43449a(0xcc)]('\x20\x20'+_0x84ab94[_0x43449a(0xdb)]+'\x0a'));}}return _0xa868f4;}catch(_0x137da5){return _0x137da5 instanceof SyntaxError?(console[_0x43449a(0xcc)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x1b405e+':\x20Invalid\x20JSON\x20syntax'),console[_0x43449a(0xcc)](_0x43449a(0xaa)+_0x137da5[_0x43449a(0xdb)]+'\x0a')):console[_0x43449a(0xcc)](_0x43449a(0xc8)+_0x1b405e+':\x20'+_0x137da5+'\x0a'),[];}}export function getNewCredentialPath(_0x3106a0){const _0x389ff6=a45_0x8328;return a45_0x5a6d28['join'](getConfigDir(),_0x389ff6(0xbf)+_0x3106a0);}function getOldCredentialPath(_0x155506){const _0xb9ac2b=a45_0x8328;return a45_0x5a6d28[_0xb9ac2b(0xd1)](getProfilesDir(),_0x155506,_0xb9ac2b(0xab));}function loadProfilesFromTdxJsonFiles(){const _0x13df82=a45_0x8328,_0x262820=[],_0x4334a9=findProjectConfigPath();_0x4334a9&&_0x262820['push'](...loadProfilesFromTdxJson(_0x4334a9,_0x13df82(0xc4)));const _0x2abb9b=a45_0x5a6d28[_0x13df82(0xd1)](getConfigDir(),_0x13df82(0xcf));return _0x262820[_0x13df82(0xcb)](...loadProfilesFromTdxJson(_0x2abb9b,_0x13df82(0xe3))),_0x262820;}function loadProfilesFromDirectories(){const _0x350e3f=a45_0x8328,_0x3e58ec=getProfilesDir();if(!a45_0x4b30ac['existsSync'](_0x3e58ec))return[];try{return a45_0x4b30ac[_0x350e3f(0xba)](_0x3e58ec,{'withFileTypes':!![]})['filter'](_0x52f1c7=>_0x52f1c7[_0x350e3f(0xa7)]())[_0x350e3f(0xe9)](_0x8edc3=>_0x8edc3[_0x350e3f(0xb9)])[_0x350e3f(0xed)](_0x5b9a9e=>{const _0x2ed0d8=_0x350e3f,_0x5f028e=getProfileConfigPath(_0x5b9a9e),_0x33c77d=getProfileEnvPath(_0x5b9a9e);return a45_0x4b30ac[_0x2ed0d8(0xd0)](_0x5f028e)||a45_0x4b30ac['existsSync'](_0x33c77d);})[_0x350e3f(0xe9)](_0xec5c03=>{const _0x1fabca=_0x350e3f,_0x1d2e19=loadProfileFromDirectory(_0xec5c03);if(_0x1d2e19)return{..._0x1d2e19,'scope':_0x1fabca(0xc5)};return null;})[_0x350e3f(0xed)](_0x23887c=>_0x23887c!==null);}catch{return[];}}function loadProfileFromDirectory(_0x1ed1d3){const _0x571135=a45_0x8328,_0x3d6023=getProfileConfigPath(_0x1ed1d3),_0x4fd914=getOldCredentialPath(_0x1ed1d3);if(!a45_0x4b30ac[_0x571135(0xd0)](_0x3d6023)&&!a45_0x4b30ac[_0x571135(0xd0)](_0x4fd914))return null;let _0x48e128={},_0x33a874={'name':_0x1ed1d3,'createdAt':new Date()['toISOString']()};if(a45_0x4b30ac[_0x571135(0xd0)](_0x3d6023))try{const _0x130c44=a45_0x4b30ac[_0x571135(0xc9)](_0x3d6023,_0x571135(0xac)),_0x193b1c=JSON[_0x571135(0xc0)](_0x130c44),{metadata:_0x21756d,..._0x336585}=_0x193b1c;_0x48e128=_0x336585,_0x21756d&&(_0x33a874=_0x21756d);}catch{}return{'name':_0x1ed1d3,'config':_0x48e128,'metadata':_0x33a874,'hasCredentials':a45_0x4b30ac['existsSync'](_0x4fd914),'scope':'directory'};}export function listProfiles(){const _0x4a7af5=a45_0x8328,_0x59abdf=loadProfilesFromTdxJsonFiles(),_0x5295d5=loadProfilesFromDirectories();if(_0x5295d5[_0x4a7af5(0xc1)]>0x0){const _0x42f72e=_0x5295d5[_0x4a7af5(0xe9)](_0x2cd7f1=>_0x2cd7f1['name'])[_0x4a7af5(0xd1)](',\x20'),_0x5a2f37=getConfigDir();console[_0x4a7af5(0xcc)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x42f72e),console[_0x4a7af5(0xcc)](_0x4a7af5(0xe6)),console[_0x4a7af5(0xcc)](_0x4a7af5(0xc6)+a45_0x5a6d28[_0x4a7af5(0xd1)](_0x5a2f37,_0x4a7af5(0xcf))),console[_0x4a7af5(0xcc)](_0x4a7af5(0xdd)),console[_0x4a7af5(0xcc)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x7a1a99=[..._0x59abdf,..._0x5295d5],_0x32c23e=new Map();for(const _0x5414b9 of _0x7a1a99){!_0x32c23e[_0x4a7af5(0xd7)](_0x5414b9[_0x4a7af5(0xb9)])&&_0x32c23e[_0x4a7af5(0xd2)](_0x5414b9[_0x4a7af5(0xb9)],_0x5414b9);}return Array['from'](_0x32c23e[_0x4a7af5(0xd9)]())['sort']((_0x807ca2,_0x11080a)=>_0x807ca2[_0x4a7af5(0xb9)][_0x4a7af5(0xdf)](_0x11080a[_0x4a7af5(0xb9)]));}export function profileExists(_0x5bc862){const _0x557576=a45_0x8328,_0x2dde5d=listProfiles();return _0x2dde5d[_0x557576(0xa8)](_0x50d1ba=>_0x50d1ba[_0x557576(0xb9)]===_0x5bc862);}export function loadProfile(_0x4753c8){const _0x40f599=a45_0x8328;validateProfileName(_0x4753c8);const _0xf82cad=listProfiles(),_0x4c8ac0=_0xf82cad[_0x40f599(0xd5)](_0x5da69c=>_0x5da69c['name']===_0x4753c8);return _0x4c8ac0||null;}export function saveProfile(_0x2398d0,_0x109c9c,_0x1c1b37=![]){saveProfileToUserConfig(_0x2398d0,_0x109c9c);}export function deleteProfile(_0xbf5120){const _0x587e1a=a45_0x8328;validateProfileName(_0xbf5120);const _0xf59109=getProfileDir(_0xbf5120);if(!a45_0x4b30ac['existsSync'](_0xf59109))throw new Error(_0x587e1a(0xe4)+_0xbf5120+_0x587e1a(0xb2));a45_0x4b30ac['rmSync'](_0xf59109,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x39f9e8,_0x27662b){const _0x512171=a45_0x8328;validateProfileName(_0x39f9e8);const _0x32661a=getGlobalConfigPath(),_0x5cefe6=getConfigDir();!a45_0x4b30ac[_0x512171(0xd0)](_0x5cefe6)&&createSecureDirectory(_0x5cefe6);let _0x144741={};if(a45_0x4b30ac[_0x512171(0xd0)](_0x32661a))try{const _0x6b22a7=a45_0x4b30ac['readFileSync'](_0x32661a,_0x512171(0xac));_0x144741=JSON['parse'](_0x6b22a7);}catch{console['warn']('Warning:\x20Failed\x20to\x20parse\x20'+_0x32661a+_0x512171(0xb8));}!_0x144741[_0x512171(0xe8)]&&(_0x144741[_0x512171(0xe8)]={}),_0x144741['profiles'][_0x39f9e8]=_0x27662b,writeSecureFile(_0x32661a,JSON[_0x512171(0xda)](_0x144741,null,0x2));}export function getActiveProfile(){const _0x26936f=a45_0x8328,_0x35f5ba=loadSessionContext();if(_0x35f5ba?.['profile'])return _0x35f5ba['profile'];const _0x96b51a=getGlobalConfigPath();if(!a45_0x4b30ac[_0x26936f(0xd0)](_0x96b51a))return null;try{const _0x245ed4=a45_0x4b30ac['readFileSync'](_0x96b51a,_0x26936f(0xac)),_0x42b4e2=JSON[_0x26936f(0xc0)](_0x245ed4);return _0x42b4e2[_0x26936f(0xca)]||null;}catch{return null;}}export function createProfile(_0x547ccb,_0x250524){const _0x134733=a45_0x8328;validateProfileName(_0x547ccb);if(profileExists(_0x547ccb))throw new Error(_0x134733(0xe4)+_0x547ccb+_0x134733(0xb0));saveProfile(_0x547ccb,_0x250524);}function a45_0x5aea(){const _0x4f75a4=['\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','33140mOtSYE','isDirectory','some','object','Error:\x20','.env','utf-8','688starus','entries','60130kBEpCs','\x20already\x20exists','16CmdhcI','\x20does\x20not\x20exist','llm_agent','\x27:\x20config\x20must\x20be\x20an\x20object','659943tDddNI','\x27:\x20unknown\x20config\x20key\x20\x27','keys',',\x20creating\x20new\x20file','name','readdirSync','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','2GoUfyR','Profile\x20\x27','144322reDIWJ','.env.','parse','length','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','1375sxWHnE','local','directory','\x20\x201.\x20Edit:\x20','Warning:\x20Profile\x20\x27','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','readFileSync','profile','push','warn','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','24633DSAPnO','tdx.json','existsSync','join','set','string','parent_segment','find','description','has','625452afKkbJ','values','stringify','message','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','toISOString','localeCompare','594453iIdLeT','database','site','user','Profile\x20','\x22\x20\x22','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','profiles','map','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','\x20\x20mv\x20\x22','test','filter','llm_project'];a45_0x5aea=function(){return _0x4f75a4;};return a45_0x5aea();}export function saveProfileCredentials(_0x9ab8d,_0x618341){validateProfileName(_0x9ab8d);if(!profileExists(_0x9ab8d))throw new Error('Profile\x20'+_0x9ab8d+'\x20does\x20not\x20exist');const _0x470ace=getNewCredentialPath(_0x9ab8d);writeSecureFile(_0x470ace,_0x618341);}export function loadProfileCredentials(_0x343857){const _0xe89108=a45_0x8328;validateProfileName(_0x343857);const _0xcd975=getNewCredentialPath(_0x343857);if(a45_0x4b30ac[_0xe89108(0xd0)](_0xcd975))try{return a45_0x4b30ac[_0xe89108(0xc9)](_0xcd975,_0xe89108(0xac));}catch{}const _0x24a8dd=getOldCredentialPath(_0x343857);if(a45_0x4b30ac[_0xe89108(0xd0)](_0x24a8dd)){console['warn'](_0xe89108(0xc2)+_0x343857+'\x27'),console['warn']('To\x20migrate:'),console[_0xe89108(0xcc)](_0xe89108(0xeb)+_0x24a8dd+_0xe89108(0xe5)+_0xcd975+'\x22'),console[_0xe89108(0xcc)](_0xe89108(0xcd));try{return a45_0x4b30ac[_0xe89108(0xc9)](_0x24a8dd,_0xe89108(0xac));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- (function(_0x2020d0,_0x44a542){const _0x917f24=a46_0x584c,_0x2cd166=_0x2020d0();while(!![]){try{const _0x3f909e=parseInt(_0x917f24(0x73))/0x1+-parseInt(_0x917f24(0x78))/0x2*(parseInt(_0x917f24(0x8f))/0x3)+parseInt(_0x917f24(0x85))/0x4+-parseInt(_0x917f24(0x8c))/0x5*(-parseInt(_0x917f24(0x71))/0x6)+parseInt(_0x917f24(0x81))/0x7*(parseInt(_0x917f24(0x7d))/0x8)+-parseInt(_0x917f24(0x86))/0x9+parseInt(_0x917f24(0x7c))/0xa*(-parseInt(_0x917f24(0x77))/0xb);if(_0x3f909e===_0x44a542)break;else _0x2cd166['push'](_0x2cd166['shift']());}catch(_0x366346){_0x2cd166['push'](_0x2cd166['shift']());}}}(a46_0x2466,0x388a7));function a46_0x584c(_0x3b957c,_0x4b6823){const _0x24666d=a46_0x2466();return a46_0x584c=function(_0x584ce9,_0x17f576){_0x584ce9=_0x584ce9-0x70;let _0x1f03ee=_0x24666d[_0x584ce9];return _0x1f03ee;},a46_0x584c(_0x3b957c,_0x4b6823);}import*as a46_0x1d9a42 from'node:fs';import*as a46_0x280111 from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x3273b6){const _0x279f0f=a46_0x584c;let _0x47df39=_0x3273b6||process[_0x279f0f(0x79)]();while(!![]){const _0x72721a=a46_0x280111['join'](_0x47df39,PROJECT_CONFIG_FILENAME);if(a46_0x1d9a42[_0x279f0f(0x7f)](_0x72721a))return _0x72721a;const _0x2a1a45=a46_0x280111[_0x279f0f(0x7a)](_0x47df39);if(_0x2a1a45===_0x47df39)return null;_0x47df39=_0x2a1a45;}}export function loadProjectConfig(_0x20e454){const _0x4e8f0b=a46_0x584c,_0xae7439=findProjectConfigPath(_0x20e454);if(!_0xae7439)return null;try{const _0x1a4c21=a46_0x1d9a42[_0x4e8f0b(0x8e)](_0xae7439,_0x4e8f0b(0x83)),_0x1be3f7=JSON['parse'](_0x1a4c21),_0x1855a9=JSON[_0x4e8f0b(0x76)](_0x1be3f7);if(_0x1855a9[_0x4e8f0b(0x70)](_0x4e8f0b(0x74))||_0x1855a9['includes']('apiKey')||_0x1855a9[_0x4e8f0b(0x70)]('api_key'))throw new Error(_0x4e8f0b(0x7b)+_0xae7439+_0x4e8f0b(0x90)+_0x4e8f0b(0x88));const {metadata:_0x53294e,profile:_0x575a5e,..._0x40ebae}=_0x1be3f7;return _0x575a5e&&console[_0x4e8f0b(0x8a)](_0x4e8f0b(0x80)+_0xae7439+_0x4e8f0b(0x84)+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x40ebae;}catch(_0x40939a){if(_0x40939a instanceof Error&&_0x4e8f0b(0x82)in _0x40939a&&_0x40939a[_0x4e8f0b(0x82)]===_0x4e8f0b(0x87))return null;throw new Error(_0x4e8f0b(0x7e)+_0xae7439+':\x20'+_0x40939a);}}export function saveProjectConfig(_0x54ef00,_0x312259){const _0x1de6ce=a46_0x584c,_0x3c18d5=_0x312259||process[_0x1de6ce(0x79)](),_0x128375=a46_0x280111[_0x1de6ce(0x72)](_0x3c18d5,PROJECT_CONFIG_FILENAME),_0x4191a2=JSON['stringify'](_0x54ef00);if(_0x4191a2['includes'](_0x1de6ce(0x74))||_0x4191a2['includes'](_0x1de6ce(0x89))||_0x4191a2['includes']('api_key'))throw new Error(_0x1de6ce(0x8b));if('profile'in _0x54ef00)throw new Error(_0x1de6ce(0x75));a46_0x1d9a42[_0x1de6ce(0x8d)](_0x128375,JSON[_0x1de6ce(0x76)](_0x54ef00,null,0x2));}export function hasProjectConfig(_0x811b9d){return findProjectConfigPath(_0x811b9d)!==null;}function a46_0x2466(){const _0x5c713f=['apiKey','warn','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','122035gkrvLf','writeFileSync','readFileSync','3tCNDPc',').\x20','includes','90ediWbg','join','287115tgoCbX','TD_API_KEY','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','stringify','456313Pdmhik','603298KMeXhF','cwd','dirname','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','160BwxROs','128kwlNJy','Failed\x20to\x20load\x20project\x20config\x20from\x20','existsSync','Warning:\x20\x27profile\x27\x20field\x20in\x20','125699ZKSLTy','code','utf-8','\x20is\x20ignored.\x20','1093188pyemhu','151749UgjNvl','ENOENT','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.'];a46_0x2466=function(){return _0x5c713f;};return a46_0x2466();}export function getProjectRoot(_0x5ba0aa){const _0x1f1e96=a46_0x584c,_0x138124=findProjectConfigPath(_0x5ba0aa);return _0x138124?a46_0x280111[_0x1f1e96(0x7a)](_0x138124):null;}
1
+ const a46_0x3d3695=a46_0x47e0;(function(_0x22d19f,_0x59cde5){const _0x338736=a46_0x47e0,_0x1192da=_0x22d19f();while(!![]){try{const _0x21f10a=-parseInt(_0x338736(0x16b))/0x1+parseInt(_0x338736(0x17b))/0x2*(parseInt(_0x338736(0x17e))/0x3)+-parseInt(_0x338736(0x17d))/0x4+-parseInt(_0x338736(0x177))/0x5+-parseInt(_0x338736(0x16a))/0x6*(-parseInt(_0x338736(0x179))/0x7)+-parseInt(_0x338736(0x169))/0x8+parseInt(_0x338736(0x181))/0x9;if(_0x21f10a===_0x59cde5)break;else _0x1192da['push'](_0x1192da['shift']());}catch(_0x3e6097){_0x1192da['push'](_0x1192da['shift']());}}}(a46_0x4498,0xa8cf2));import*as a46_0xb837bf from'node:fs';import*as a46_0x21e73a from'node:path';const PROJECT_CONFIG_FILENAME=a46_0x3d3695(0x16e);export function findProjectConfigPath(_0x3050c0){const _0x15c66b=a46_0x3d3695;let _0x45a5b3=_0x3050c0||process[_0x15c66b(0x173)]();while(!![]){const _0x4b2e52=a46_0x21e73a[_0x15c66b(0x16c)](_0x45a5b3,PROJECT_CONFIG_FILENAME);if(a46_0xb837bf['existsSync'](_0x4b2e52))return _0x4b2e52;const _0x536c17=a46_0x21e73a['dirname'](_0x45a5b3);if(_0x536c17===_0x45a5b3)return null;_0x45a5b3=_0x536c17;}}export function loadProjectConfig(_0x50cac1){const _0x1cf3ba=a46_0x3d3695,_0x2b322b=findProjectConfigPath(_0x50cac1);if(!_0x2b322b)return null;try{const _0x391a13=a46_0xb837bf[_0x1cf3ba(0x165)](_0x2b322b,_0x1cf3ba(0x166)),_0x390ffa=JSON[_0x1cf3ba(0x167)](_0x391a13),_0x187443=JSON[_0x1cf3ba(0x176)](_0x390ffa);if(_0x187443['includes'](_0x1cf3ba(0x168))||_0x187443[_0x1cf3ba(0x182)]('apiKey')||_0x187443[_0x1cf3ba(0x182)](_0x1cf3ba(0x172)))throw new Error(_0x1cf3ba(0x170)+_0x2b322b+_0x1cf3ba(0x16d)+_0x1cf3ba(0x178));const {metadata:_0x3b2f26,profile:_0x3aac54,..._0x3ee2bb}=_0x390ffa;return _0x3aac54&&console[_0x1cf3ba(0x171)](_0x1cf3ba(0x16f)+_0x2b322b+_0x1cf3ba(0x175)+_0x1cf3ba(0x183)),_0x3ee2bb;}catch(_0x5e3789){if(_0x5e3789 instanceof Error&&_0x1cf3ba(0x17f)in _0x5e3789&&_0x5e3789[_0x1cf3ba(0x17f)]===_0x1cf3ba(0x174))return null;throw new Error(_0x1cf3ba(0x184)+_0x2b322b+':\x20'+_0x5e3789);}}export function saveProjectConfig(_0x36ab70,_0x4fab19){const _0x3143e9=a46_0x3d3695,_0x228c93=_0x4fab19||process[_0x3143e9(0x173)](),_0x54ccd9=a46_0x21e73a[_0x3143e9(0x16c)](_0x228c93,PROJECT_CONFIG_FILENAME),_0xa48977=JSON[_0x3143e9(0x176)](_0x36ab70);if(_0xa48977[_0x3143e9(0x182)]('TD_API_KEY')||_0xa48977['includes'](_0x3143e9(0x17a))||_0xa48977['includes'](_0x3143e9(0x172)))throw new Error(_0x3143e9(0x17c));if('profile'in _0x36ab70)throw new Error(_0x3143e9(0x180));a46_0xb837bf['writeFileSync'](_0x54ccd9,JSON['stringify'](_0x36ab70,null,0x2));}function a46_0x4498(){const _0x4f5cdc=['tdx.json','Warning:\x20\x27profile\x27\x20field\x20in\x20','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','warn','api_key','cwd','ENOENT','\x20is\x20ignored.\x20','stringify','3973720QQofxm','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','7gSYMjf','apiKey','87238nstCdr','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','1466336psVHlZ','12OZIBve','code','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','6975009xdTGCX','includes','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','Failed\x20to\x20load\x20project\x20config\x20from\x20','dirname','readFileSync','utf-8','parse','TD_API_KEY','893728lFsISb','7996452vWBFMB','317733pHohgF','join',').\x20'];a46_0x4498=function(){return _0x4f5cdc;};return a46_0x4498();}export function hasProjectConfig(_0x568ed7){return findProjectConfigPath(_0x568ed7)!==null;}function a46_0x47e0(_0xe30cc,_0x49fd77){const _0x449870=a46_0x4498();return a46_0x47e0=function(_0x47e05c,_0x4bb435){_0x47e05c=_0x47e05c-0x165;let _0x3805f0=_0x449870[_0x47e05c];return _0x3805f0;},a46_0x47e0(_0xe30cc,_0x49fd77);}export function getProjectRoot(_0x23ec5f){const _0x4ac7e1=a46_0x3d3695,_0x45c7af=findProjectConfigPath(_0x23ec5f);return _0x45c7af?a46_0x21e73a[_0x4ac7e1(0x185)](_0x45c7af):null;}
@@ -1 +1 @@
1
- (function(_0x476dd2,_0x5f4fcc){const _0x406673=a47_0x3e06,_0x4cdf22=_0x476dd2();while(!![]){try{const _0x4214c4=parseInt(_0x406673(0x115))/0x1*(-parseInt(_0x406673(0x114))/0x2)+-parseInt(_0x406673(0x12d))/0x3*(parseInt(_0x406673(0x130))/0x4)+-parseInt(_0x406673(0x127))/0x5*(parseInt(_0x406673(0x117))/0x6)+-parseInt(_0x406673(0x109))/0x7+-parseInt(_0x406673(0x10d))/0x8*(parseInt(_0x406673(0x11b))/0x9)+parseInt(_0x406673(0x129))/0xa+-parseInt(_0x406673(0x128))/0xb*(-parseInt(_0x406673(0x125))/0xc);if(_0x4214c4===_0x5f4fcc)break;else _0x4cdf22['push'](_0x4cdf22['shift']());}catch(_0x517b77){_0x4cdf22['push'](_0x4cdf22['shift']());}}}(a47_0x22c2,0xc5d1e));function a47_0x3e06(_0x180a88,_0x13ec07){const _0x22c2af=a47_0x22c2();return a47_0x3e06=function(_0x3e0650,_0x47ff64){_0x3e0650=_0x3e0650-0x108;let _0x26179b=_0x22c2af[_0x3e0650];return _0x26179b;},a47_0x3e06(_0x180a88,_0x13ec07);}import*as a47_0x45969f from'node:fs';import*as a47_0x1e5cd2 from'node:path';import*as a47_0x142f31 from'node:os';function a47_0x22c2(){const _0x37c80b=['getTime','readFileSync','replace','4ChswJy','468808BDJplA','stringify','282DwnWMO','.\x20This\x20is\x20insecure.\x20Removing\x20session.','warn','parse','9CFRZBa','unlinkSync','utf-8','join','apiKey','writeFileSync','.config','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','now','readdirSync','228XhAOZG','TD_API_KEY','121960pOwGhk','2501125qjJwFZ','13919060qAWDnJ','includes','existsSync','env','184677tOXMVu','sessions','.json','48sYJfxF','push','createdAt','toISOString','tdx','TDX_CONFIG_DIR','8093540ORtbiI','sort','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','homedir','7382344mbTVmE','test','api_key','toString'];a47_0x22c2=function(){return _0x37c80b;};return a47_0x22c2();}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 _0x545010=a47_0x3e06,_0x56838d=process[_0x545010(0x12c)][_0x545010(0x108)]||a47_0x1e5cd2['join'](a47_0x142f31[_0x545010(0x10c)](),_0x545010(0x121),_0x545010(0x134));return a47_0x1e5cd2[_0x545010(0x11e)](_0x56838d,_0x545010(0x12e));}function getSessionPath(_0x5dc097){const _0x2c93f8=a47_0x3e06;return a47_0x1e5cd2[_0x2c93f8(0x11e)](getSessionsDir(),_0x5dc097+_0x2c93f8(0x12f));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x537a83){const _0xa5e044=a47_0x3e06;if(_0x537a83)return _0x537a83;return getCurrentSessionPID()[_0xa5e044(0x110)]();}export function loadSessionContext(_0x5c5af8){const _0x42add4=a47_0x3e06,_0x113445=_0x5c5af8||getCurrentSessionPID()[_0x42add4(0x110)](),_0x145bf4=/^\d+$/['test'](_0x113445)?parseInt(_0x113445,0xa):null;return _0x145bf4!==null?loadSessionContextByPID(_0x145bf4):loadSessionContextByString(_0x113445);}export function loadSessionContextByPID(_0x92e223){const _0x1b888e=a47_0x3e06,_0x38e981=getSessionPath(_0x92e223);if(!a47_0x45969f[_0x1b888e(0x12b)](_0x38e981))return null;try{const _0x2e5105=a47_0x45969f[_0x1b888e(0x112)](_0x38e981,_0x1b888e(0x11d)),_0x4c2605=JSON[_0x1b888e(0x11a)](_0x2e5105),_0x136d73=new Date(_0x4c2605[_0x1b888e(0x132)])[_0x1b888e(0x111)](),_0x39a758=Date[_0x1b888e(0x123)]();if(_0x39a758-_0x136d73>SESSION_EXPIRATION_MS)return a47_0x45969f['unlinkSync'](_0x38e981),null;const _0x37b27a=JSON[_0x1b888e(0x116)](_0x4c2605);if(_0x37b27a[_0x1b888e(0x12a)](_0x1b888e(0x126))||_0x37b27a[_0x1b888e(0x12a)](_0x1b888e(0x11f))||_0x37b27a[_0x1b888e(0x12a)]('api_key'))return console[_0x1b888e(0x119)](_0x1b888e(0x122)+_0x38e981+_0x1b888e(0x118)),a47_0x45969f['unlinkSync'](_0x38e981),null;return _0x4c2605;}catch{try{a47_0x45969f['unlinkSync'](_0x38e981);}catch{}return null;}}function loadSessionContextByString(_0x256f57){const _0x5a060f=a47_0x3e06,_0x2edd65=a47_0x1e5cd2[_0x5a060f(0x11e)](getSessionsDir(),_0x256f57+_0x5a060f(0x12f));if(!a47_0x45969f[_0x5a060f(0x12b)](_0x2edd65))return null;try{const _0x343bfc=a47_0x45969f[_0x5a060f(0x112)](_0x2edd65,_0x5a060f(0x11d)),_0xd5b16b=JSON[_0x5a060f(0x11a)](_0x343bfc),_0x5e7bf3=new Date(_0xd5b16b[_0x5a060f(0x132)])[_0x5a060f(0x111)](),_0x243066=Date[_0x5a060f(0x123)]();if(_0x243066-_0x5e7bf3>SESSION_EXPIRATION_MS)return a47_0x45969f['unlinkSync'](_0x2edd65),null;const _0x2fb270=JSON['stringify'](_0xd5b16b);if(_0x2fb270[_0x5a060f(0x12a)](_0x5a060f(0x126))||_0x2fb270[_0x5a060f(0x12a)](_0x5a060f(0x11f))||_0x2fb270[_0x5a060f(0x12a)](_0x5a060f(0x10f)))return console['warn']('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x2edd65+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a47_0x45969f['unlinkSync'](_0x2edd65),null;return _0xd5b16b;}catch{try{a47_0x45969f[_0x5a060f(0x11c)](_0x2edd65);}catch{}return null;}}export function saveSessionContext(_0x3496f9,_0x3606a7){const _0x35b000=a47_0x3e06,_0x3bf9ba=_0x3606a7||getCurrentSessionPID()['toString'](),_0x1e8ace=/^\d+$/['test'](_0x3bf9ba)?parseInt(_0x3bf9ba,0xa):getCurrentSessionPID(),_0x20bac5=a47_0x1e5cd2[_0x35b000(0x11e)](getSessionsDir(),_0x3bf9ba+'.json'),_0x5a1e1a=getSessionsDir();createSecureDirectory(_0x5a1e1a);const _0x3f6751=JSON[_0x35b000(0x116)](_0x3496f9);if(_0x3f6751[_0x35b000(0x12a)]('TD_API_KEY')||_0x3f6751[_0x35b000(0x12a)]('apiKey')||_0x3f6751['includes']('api_key'))throw new Error(_0x35b000(0x10b));let _0x30e0fa;const _0x8d4a6c=/^\d+$/[_0x35b000(0x10e)](_0x3bf9ba)?loadSessionContextByPID(parseInt(_0x3bf9ba,0xa)):loadSessionContextByString(_0x3bf9ba);_0x8d4a6c?_0x30e0fa={..._0x8d4a6c,..._0x3496f9,'pid':_0x1e8ace,'sessionId':_0x3bf9ba!==_0x1e8ace[_0x35b000(0x110)]()?_0x3bf9ba:undefined,'updatedAt':new Date()[_0x35b000(0x133)]()}:_0x30e0fa={'pid':_0x1e8ace,'sessionId':_0x3bf9ba!==_0x1e8ace[_0x35b000(0x110)]()?_0x3bf9ba:undefined,..._0x3496f9,'createdAt':new Date()[_0x35b000(0x133)](),'updatedAt':new Date()[_0x35b000(0x133)]()},a47_0x45969f[_0x35b000(0x120)](_0x20bac5,JSON[_0x35b000(0x116)](_0x30e0fa,null,0x2));}export function clearSessionContext(_0x6b25b5){const _0xf85b52=a47_0x3e06,_0x37ecc3=_0x6b25b5||getCurrentSessionPID()[_0xf85b52(0x110)](),_0x120baf=a47_0x1e5cd2[_0xf85b52(0x11e)](getSessionsDir(),_0x37ecc3+'.json');a47_0x45969f[_0xf85b52(0x12b)](_0x120baf)&&a47_0x45969f['unlinkSync'](_0x120baf);}export function cleanExpiredSessions(){const _0x368ab6=a47_0x3e06,_0x5691cd=getSessionsDir();if(!a47_0x45969f[_0x368ab6(0x12b)](_0x5691cd))return 0x0;let _0x1d68b0=0x0;const _0x21f013=Date[_0x368ab6(0x123)]();try{const _0x267334=a47_0x45969f[_0x368ab6(0x124)](_0x5691cd);for(const _0x5dcede of _0x267334){if(!_0x5dcede['endsWith'](_0x368ab6(0x12f)))continue;const _0x57f5f7=a47_0x1e5cd2[_0x368ab6(0x11e)](_0x5691cd,_0x5dcede),_0x1c54da=_0x5dcede[_0x368ab6(0x113)]('.json',''),_0x2c1b3b=parseInt(_0x1c54da,0xa),_0x45600c=!isNaN(_0x2c1b3b);if(_0x45600c){if(!isProcessRunning(_0x2c1b3b)){a47_0x45969f[_0x368ab6(0x11c)](_0x57f5f7),_0x1d68b0++;continue;}}try{const _0xadc4cf=a47_0x45969f['readFileSync'](_0x57f5f7,'utf-8'),_0x4688ab=JSON['parse'](_0xadc4cf),_0xf8cad9=new Date(_0x4688ab[_0x368ab6(0x132)])[_0x368ab6(0x111)]();_0x21f013-_0xf8cad9>SESSION_EXPIRATION_MS&&(a47_0x45969f[_0x368ab6(0x11c)](_0x57f5f7),_0x1d68b0++);}catch{a47_0x45969f['unlinkSync'](_0x57f5f7),_0x1d68b0++;}}}catch{}return _0x1d68b0;}export function listActiveSessions(){const _0x3e0217=a47_0x3e06,_0xa99634=getSessionsDir();if(!a47_0x45969f[_0x3e0217(0x12b)](_0xa99634))return[];try{const _0x12794e=a47_0x45969f['readdirSync'](_0xa99634),_0x483474=[];for(const _0x54e2ee of _0x12794e){if(!_0x54e2ee['endsWith'](_0x3e0217(0x12f)))continue;const _0xe8d14=_0x54e2ee[_0x3e0217(0x113)](_0x3e0217(0x12f),''),_0x434edd=parseInt(_0xe8d14,0xa);!isNaN(_0x434edd)&&isProcessRunning(_0x434edd)&&_0x483474[_0x3e0217(0x131)](_0x434edd);}return _0x483474[_0x3e0217(0x10a)]((_0x80ebd0,_0x18a3ad)=>_0x80ebd0-_0x18a3ad);}catch{return[];}}
1
+ (function(_0x432349,_0x1cbf75){const _0x541c9b=a47_0x2cca,_0x501322=_0x432349();while(!![]){try{const _0x55242a=parseInt(_0x541c9b(0x1f7))/0x1*(-parseInt(_0x541c9b(0x1e1))/0x2)+parseInt(_0x541c9b(0x1e2))/0x3+parseInt(_0x541c9b(0x1f8))/0x4+parseInt(_0x541c9b(0x1e4))/0x5+-parseInt(_0x541c9b(0x1ee))/0x6+parseInt(_0x541c9b(0x1fb))/0x7+-parseInt(_0x541c9b(0x1e3))/0x8;if(_0x55242a===_0x1cbf75)break;else _0x501322['push'](_0x501322['shift']());}catch(_0x23f55f){_0x501322['push'](_0x501322['shift']());}}}(a47_0x1abd,0x1adff));import*as a47_0x4f5092 from'node:fs';import*as a47_0x29774e from'node:path';import*as a47_0x16ab78 from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';import{createSecureDirectory}from'../utils/file-permissions.js';function a47_0x1abd(){const _0x4b6c03=['239FZwIPg','95252akxwdL','env','tdx','1334767uUwMQW','.config','replace','homedir','join','api_key','utf-8','parse','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','push','existsSync','endsWith','readdirSync','TD_API_KEY','476CsAraY','455586DNCEmp','483200OkKuce','341440QffyhM','createdAt','getTime','includes','unlinkSync','apiKey','toISOString','toString','readFileSync','stringify','1243698Cbicwk','writeFileSync','.\x20This\x20is\x20insecure.\x20Removing\x20session.','.json','sessions','test','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','sort','now'];a47_0x1abd=function(){return _0x4b6c03;};return a47_0x1abd();}const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x1a9425=a47_0x2cca,_0x403f1e=process[_0x1a9425(0x1f9)]['TDX_CONFIG_DIR']||a47_0x29774e[_0x1a9425(0x1d7)](a47_0x16ab78[_0x1a9425(0x1d6)](),_0x1a9425(0x1fc),_0x1a9425(0x1fa));return a47_0x29774e['join'](_0x403f1e,_0x1a9425(0x1f2));}function getSessionPath(_0x26b338){const _0x2e9ccc=a47_0x2cca;return a47_0x29774e[_0x2e9ccc(0x1d7)](getSessionsDir(),_0x26b338+'.json');}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x226c3d){const _0x156c6f=a47_0x2cca;if(_0x226c3d)return _0x226c3d;return getCurrentSessionPID()[_0x156c6f(0x1eb)]();}export function loadSessionContext(_0x333a5b){const _0x7d1eb9=a47_0x2cca,_0x4796aa=_0x333a5b||getCurrentSessionPID()[_0x7d1eb9(0x1eb)](),_0x354e63=/^\d+$/[_0x7d1eb9(0x1f3)](_0x4796aa)?parseInt(_0x4796aa,0xa):null;return _0x354e63!==null?loadSessionContextByPID(_0x354e63):loadSessionContextByString(_0x4796aa);}export function loadSessionContextByPID(_0x2d3c12){const _0x279a79=a47_0x2cca,_0x3377fe=getSessionPath(_0x2d3c12);if(!a47_0x4f5092[_0x279a79(0x1dd)](_0x3377fe))return null;try{const _0x3458c6=a47_0x4f5092[_0x279a79(0x1ec)](_0x3377fe,_0x279a79(0x1d9)),_0x3cf40a=JSON[_0x279a79(0x1da)](_0x3458c6),_0x4e3a3d=new Date(_0x3cf40a[_0x279a79(0x1e5)])[_0x279a79(0x1e6)](),_0x575ae4=Date[_0x279a79(0x1f6)]();if(_0x575ae4-_0x4e3a3d>SESSION_EXPIRATION_MS)return a47_0x4f5092[_0x279a79(0x1e8)](_0x3377fe),null;const _0x4ba941=JSON['stringify'](_0x3cf40a);if(_0x4ba941[_0x279a79(0x1e7)](_0x279a79(0x1e0))||_0x4ba941[_0x279a79(0x1e7)](_0x279a79(0x1e9))||_0x4ba941[_0x279a79(0x1e7)]('api_key'))return console['warn'](_0x279a79(0x1f4)+_0x3377fe+_0x279a79(0x1f0)),a47_0x4f5092[_0x279a79(0x1e8)](_0x3377fe),null;return _0x3cf40a;}catch{try{a47_0x4f5092[_0x279a79(0x1e8)](_0x3377fe);}catch{}return null;}}function loadSessionContextByString(_0x36ae6e){const _0x25c2d7=a47_0x2cca,_0x2bb9c6=a47_0x29774e[_0x25c2d7(0x1d7)](getSessionsDir(),_0x36ae6e+_0x25c2d7(0x1f1));if(!a47_0x4f5092[_0x25c2d7(0x1dd)](_0x2bb9c6))return null;try{const _0x5ac556=a47_0x4f5092['readFileSync'](_0x2bb9c6,'utf-8'),_0x5181cf=JSON['parse'](_0x5ac556),_0x53b474=new Date(_0x5181cf[_0x25c2d7(0x1e5)])[_0x25c2d7(0x1e6)](),_0x2a4dc0=Date[_0x25c2d7(0x1f6)]();if(_0x2a4dc0-_0x53b474>SESSION_EXPIRATION_MS)return a47_0x4f5092['unlinkSync'](_0x2bb9c6),null;const _0x54bcae=JSON[_0x25c2d7(0x1ed)](_0x5181cf);if(_0x54bcae['includes']('TD_API_KEY')||_0x54bcae[_0x25c2d7(0x1e7)]('apiKey')||_0x54bcae[_0x25c2d7(0x1e7)](_0x25c2d7(0x1d8)))return console['warn']('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x2bb9c6+_0x25c2d7(0x1f0)),a47_0x4f5092[_0x25c2d7(0x1e8)](_0x2bb9c6),null;return _0x5181cf;}catch{try{a47_0x4f5092[_0x25c2d7(0x1e8)](_0x2bb9c6);}catch{}return null;}}export function saveSessionContext(_0x225d36,_0x4e96ba){const _0x16f703=a47_0x2cca,_0x3105b2=_0x4e96ba||getCurrentSessionPID()[_0x16f703(0x1eb)](),_0x2066eb=/^\d+$/[_0x16f703(0x1f3)](_0x3105b2)?parseInt(_0x3105b2,0xa):getCurrentSessionPID(),_0x10519e=a47_0x29774e[_0x16f703(0x1d7)](getSessionsDir(),_0x3105b2+_0x16f703(0x1f1)),_0x1746ff=getSessionsDir();createSecureDirectory(_0x1746ff);const _0x2fc3b9=JSON['stringify'](_0x225d36);if(_0x2fc3b9[_0x16f703(0x1e7)](_0x16f703(0x1e0))||_0x2fc3b9['includes'](_0x16f703(0x1e9))||_0x2fc3b9[_0x16f703(0x1e7)](_0x16f703(0x1d8)))throw new Error(_0x16f703(0x1db));let _0x17c7cb;const _0x4593aa=/^\d+$/[_0x16f703(0x1f3)](_0x3105b2)?loadSessionContextByPID(parseInt(_0x3105b2,0xa)):loadSessionContextByString(_0x3105b2);_0x4593aa?_0x17c7cb={..._0x4593aa,..._0x225d36,'pid':_0x2066eb,'sessionId':_0x3105b2!==_0x2066eb[_0x16f703(0x1eb)]()?_0x3105b2:undefined,'updatedAt':new Date()[_0x16f703(0x1ea)]()}:_0x17c7cb={'pid':_0x2066eb,'sessionId':_0x3105b2!==_0x2066eb[_0x16f703(0x1eb)]()?_0x3105b2:undefined,..._0x225d36,'createdAt':new Date()[_0x16f703(0x1ea)](),'updatedAt':new Date()[_0x16f703(0x1ea)]()},a47_0x4f5092[_0x16f703(0x1ef)](_0x10519e,JSON[_0x16f703(0x1ed)](_0x17c7cb,null,0x2));}function a47_0x2cca(_0x1846b4,_0x4f94a0){const _0x1abd1c=a47_0x1abd();return a47_0x2cca=function(_0x2cca48,_0x57aa29){_0x2cca48=_0x2cca48-0x1d5;let _0x4bcc5e=_0x1abd1c[_0x2cca48];return _0x4bcc5e;},a47_0x2cca(_0x1846b4,_0x4f94a0);}export function clearSessionContext(_0x5c5b80){const _0x170fb8=a47_0x2cca,_0x4f2ec5=_0x5c5b80||getCurrentSessionPID()[_0x170fb8(0x1eb)](),_0xb16579=a47_0x29774e['join'](getSessionsDir(),_0x4f2ec5+_0x170fb8(0x1f1));a47_0x4f5092['existsSync'](_0xb16579)&&a47_0x4f5092[_0x170fb8(0x1e8)](_0xb16579);}export function cleanExpiredSessions(){const _0x360fce=a47_0x2cca,_0xb5d457=getSessionsDir();if(!a47_0x4f5092['existsSync'](_0xb5d457))return 0x0;let _0x3267e9=0x0;const _0x518c8f=Date[_0x360fce(0x1f6)]();try{const _0x25beac=a47_0x4f5092[_0x360fce(0x1df)](_0xb5d457);for(const _0x477b52 of _0x25beac){if(!_0x477b52[_0x360fce(0x1de)](_0x360fce(0x1f1)))continue;const _0x4305e9=a47_0x29774e['join'](_0xb5d457,_0x477b52),_0x8c0d3b=_0x477b52[_0x360fce(0x1d5)](_0x360fce(0x1f1),''),_0x5f25b4=parseInt(_0x8c0d3b,0xa),_0x500ba2=!isNaN(_0x5f25b4);if(_0x500ba2){if(!isProcessRunning(_0x5f25b4)){a47_0x4f5092[_0x360fce(0x1e8)](_0x4305e9),_0x3267e9++;continue;}}try{const _0x47ad24=a47_0x4f5092[_0x360fce(0x1ec)](_0x4305e9,_0x360fce(0x1d9)),_0x35f49c=JSON[_0x360fce(0x1da)](_0x47ad24),_0x37a4ec=new Date(_0x35f49c[_0x360fce(0x1e5)])[_0x360fce(0x1e6)]();_0x518c8f-_0x37a4ec>SESSION_EXPIRATION_MS&&(a47_0x4f5092[_0x360fce(0x1e8)](_0x4305e9),_0x3267e9++);}catch{a47_0x4f5092['unlinkSync'](_0x4305e9),_0x3267e9++;}}}catch{}return _0x3267e9;}export function listActiveSessions(){const _0x1cf1b8=a47_0x2cca,_0x35f5b4=getSessionsDir();if(!a47_0x4f5092['existsSync'](_0x35f5b4))return[];try{const _0x181baf=a47_0x4f5092['readdirSync'](_0x35f5b4),_0x59b641=[];for(const _0x4d921c of _0x181baf){if(!_0x4d921c['endsWith'](_0x1cf1b8(0x1f1)))continue;const _0x1601ac=_0x4d921c[_0x1cf1b8(0x1d5)](_0x1cf1b8(0x1f1),''),_0x14877c=parseInt(_0x1601ac,0xa);!isNaN(_0x14877c)&&isProcessRunning(_0x14877c)&&_0x59b641[_0x1cf1b8(0x1dc)](_0x14877c);}return _0x59b641[_0x1cf1b8(0x1f5)]((_0x105933,_0x43f0e1)=>_0x105933-_0x43f0e1);}catch{return[];}}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0x3a8712,_0x549eeb){var _0xdc300a=a48_0x2085,_0xdcc234=_0x3a8712();while(!![]){try{var _0x42f15e=-parseInt(_0xdc300a(0x1b0))/0x1+parseInt(_0xdc300a(0x1b4))/0x2*(parseInt(_0xdc300a(0x1b1))/0x3)+parseInt(_0xdc300a(0x1ac))/0x4*(-parseInt(_0xdc300a(0x1b3))/0x5)+-parseInt(_0xdc300a(0x1b2))/0x6+parseInt(_0xdc300a(0x1b5))/0x7+parseInt(_0xdc300a(0x1af))/0x8*(-parseInt(_0xdc300a(0x1ab))/0x9)+-parseInt(_0xdc300a(0x1ae))/0xa*(-parseInt(_0xdc300a(0x1ad))/0xb);if(_0x42f15e===_0x549eeb)break;else _0xdcc234['push'](_0xdcc234['shift']());}catch(_0x55e92b){_0xdcc234['push'](_0xdcc234['shift']());}}}(a48_0x59b4,0x889ea));function a48_0x59b4(){var _0x247df9=['464823zVOcwk','5780556QEEAHv','2116535dRKeMn','6HMbocO','4952955iuhJjQ','99MqDkYV','4wRWyAF','9257413viwrUa','20nkfnQz','85288YoTfFE','791956TKdfnQ'];a48_0x59b4=function(){return _0x247df9;};return a48_0x59b4();}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';function a48_0x2085(_0x316b12,_0x1694b1){var _0x59b477=a48_0x59b4();return a48_0x2085=function(_0x2085aa,_0x2837ff){_0x2085aa=_0x2085aa-0x1ab;var _0x110315=_0x59b477[_0x2085aa];return _0x110315;},a48_0x2085(_0x316b12,_0x1694b1);}export*from'./types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
1
+ (function(_0x5b9192,_0x3bcc5e){var _0x1fe559=a48_0x7e07,_0x34eb5d=_0x5b9192();while(!![]){try{var _0x1bded1=parseInt(_0x1fe559(0x1f2))/0x1*(parseInt(_0x1fe559(0x1ef))/0x2)+parseInt(_0x1fe559(0x1ee))/0x3+-parseInt(_0x1fe559(0x1f0))/0x4*(parseInt(_0x1fe559(0x1f3))/0x5)+-parseInt(_0x1fe559(0x1f4))/0x6*(parseInt(_0x1fe559(0x1f5))/0x7)+-parseInt(_0x1fe559(0x1f1))/0x8*(-parseInt(_0x1fe559(0x1f7))/0x9)+-parseInt(_0x1fe559(0x1ed))/0xa*(-parseInt(_0x1fe559(0x1f8))/0xb)+-parseInt(_0x1fe559(0x1f6))/0xc;if(_0x1bded1===_0x3bcc5e)break;else _0x34eb5d['push'](_0x34eb5d['shift']());}catch(_0x413460){_0x34eb5d['push'](_0x34eb5d['shift']());}}}(a48_0x26d6,0x1c52c));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';export*from'./commands/segments.js';export*from'./commands/activations.js';function a48_0x7e07(_0x23bfa9,_0x256a6c){var _0x26d6c1=a48_0x26d6();return a48_0x7e07=function(_0x7e074,_0xe1620b){_0x7e074=_0x7e074-0x1ed;var _0x40917f=_0x26d6c1[_0x7e074];return _0x40917f;},a48_0x7e07(_0x23bfa9,_0x256a6c);}function a48_0x26d6(){var _0x299dd0=['115HGiHoS','42PTrTTa','97181DJiIUa','4309104oxuCBK','11367cBAEzx','33ZvDBAB','699690kKODqt','379419JTzhJg','418522FkZxsn','14476AthTyD','696qWJtHR','1yaQQrp'];a48_0x26d6=function(){return _0x299dd0;};return a48_0x26d6();}export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';