@treasuredata/tdx 0.5.0 → 0.5.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 (102) hide show
  1. package/dist/build-info.json +2 -2
  2. package/dist/cli.js +1 -1
  3. package/dist/cli.js.map +1 -1
  4. package/dist/client/cdp-api-client.js +1 -1
  5. package/dist/client/engage-api-client.js +1 -1
  6. package/dist/client/http-client.js +1 -1
  7. package/dist/client/llm-api-client.js +1 -1
  8. package/dist/client/rate-limiter.js +1 -1
  9. package/dist/client/td-api-client.js +1 -1
  10. package/dist/client/trino-api-client.js +1 -1
  11. package/dist/client/workflow-client.js +1 -1
  12. package/dist/commands/activations.js +1 -1
  13. package/dist/commands/api-command.js +1 -1
  14. package/dist/commands/auth-command.js +1 -1
  15. package/dist/commands/chat-command.js +1 -1
  16. package/dist/commands/claude-command.d.ts.map +1 -1
  17. package/dist/commands/claude-command.js +1 -1
  18. package/dist/commands/claude-command.js.map +1 -1
  19. package/dist/commands/claude-statusline-command.js +1 -1
  20. package/dist/commands/claude-usage-command.js +1 -1
  21. package/dist/commands/command.js +1 -1
  22. package/dist/commands/context-command.js +1 -1
  23. package/dist/commands/databases.js +1 -1
  24. package/dist/commands/describe.js +1 -1
  25. package/dist/commands/engage-command.js +1 -1
  26. package/dist/commands/job-command.js +1 -1
  27. package/dist/commands/llm-command.d.ts +9 -0
  28. package/dist/commands/llm-command.d.ts.map +1 -1
  29. package/dist/commands/llm-command.js +1 -1
  30. package/dist/commands/llm-command.js.map +1 -1
  31. package/dist/commands/llm-proxy.js +1 -1
  32. package/dist/commands/parent-segment-command.js +1 -1
  33. package/dist/commands/profiles-command.js +1 -1
  34. package/dist/commands/query-command.js +1 -1
  35. package/dist/commands/segment-command.js +1 -1
  36. package/dist/commands/segment-create-command.js +1 -1
  37. package/dist/commands/segment-fields-command.js +1 -1
  38. package/dist/commands/segment-pwd-command.js +1 -1
  39. package/dist/commands/segment-update-command.js +1 -1
  40. package/dist/commands/segment-use-command.js +1 -1
  41. package/dist/commands/segments.js +1 -1
  42. package/dist/commands/show.js +1 -1
  43. package/dist/commands/tables.js +1 -1
  44. package/dist/commands/use-command.js +1 -1
  45. package/dist/commands/workflow-command.js +1 -1
  46. package/dist/core/auth.js +1 -1
  47. package/dist/core/config.js +1 -1
  48. package/dist/core/credential-cache.js +1 -1
  49. package/dist/core/global-context.js +1 -1
  50. package/dist/core/keychain.js +1 -1
  51. package/dist/core/profile.js +1 -1
  52. package/dist/core/project-config.js +1 -1
  53. package/dist/core/session.js +1 -1
  54. package/dist/index.js +1 -1
  55. package/dist/proxy/anthropic-adapter.js +1 -1
  56. package/dist/proxy/server.d.ts.map +1 -1
  57. package/dist/proxy/server.js +1 -1
  58. package/dist/proxy/server.js.map +1 -1
  59. package/dist/proxy/session-cache.js +1 -1
  60. package/dist/sdk/api.js +1 -1
  61. package/dist/sdk/engage.js +1 -1
  62. package/dist/sdk/errors.js +1 -1
  63. package/dist/sdk/index.js +1 -1
  64. package/dist/sdk/job.js +1 -1
  65. package/dist/sdk/llm.js +1 -1
  66. package/dist/sdk/query.js +1 -1
  67. package/dist/sdk/segment.js +1 -1
  68. package/dist/sdk/workflow.js +1 -1
  69. package/dist/types/endpoints.js +1 -1
  70. package/dist/types/index.js +1 -1
  71. package/dist/utils/agent-ref-parser.js +1 -1
  72. package/dist/utils/chat-cache.js +1 -1
  73. package/dist/utils/claude-usage-tracker.d.ts +1 -0
  74. package/dist/utils/claude-usage-tracker.d.ts.map +1 -1
  75. package/dist/utils/claude-usage-tracker.js +1 -1
  76. package/dist/utils/claude-usage-tracker.js.map +1 -1
  77. package/dist/utils/colors.js +1 -1
  78. package/dist/utils/command-output.js +1 -1
  79. package/dist/utils/constants.js +1 -1
  80. package/dist/utils/file-permissions.js +1 -1
  81. package/dist/utils/format-detector.js +1 -1
  82. package/dist/utils/formatters.js +1 -1
  83. package/dist/utils/json-loader.js +1 -1
  84. package/dist/utils/llm-backup-utils.js +1 -1
  85. package/dist/utils/model-aliases.js +1 -1
  86. package/dist/utils/model-factors.js +1 -1
  87. package/dist/utils/option-validation.js +1 -1
  88. package/dist/utils/port.js +1 -1
  89. package/dist/utils/process.js +1 -1
  90. package/dist/utils/prompt.js +1 -1
  91. package/dist/utils/segment-path-parser.js +1 -1
  92. package/dist/utils/segment-ref-parser.js +1 -1
  93. package/dist/utils/spinner.js +1 -1
  94. package/dist/utils/sql-parser.js +1 -1
  95. package/dist/utils/sse-parser.js +1 -1
  96. package/dist/utils/string-utils.js +1 -1
  97. package/dist/utils/table-ref-parser.js +1 -1
  98. package/dist/utils/tdx-logger.js +1 -1
  99. package/dist/utils/tree-formatter.js +1 -1
  100. package/dist/utils/version-check.js +1 -1
  101. package/dist/utils/workflow-utils.js +1 -1
  102. package/package.json +1 -1
@@ -1 +1 @@
1
- const a37_0x4af247=a37_0x50b4;(function(_0x59b00b,_0xc54ef){const _0x360ea6=a37_0x50b4,_0x4697e8=_0x59b00b();while(!![]){try{const _0x4a9b74=parseInt(_0x360ea6(0xbc))/0x1*(-parseInt(_0x360ea6(0xa4))/0x2)+parseInt(_0x360ea6(0x8e))/0x3+parseInt(_0x360ea6(0x11f))/0x4+-parseInt(_0x360ea6(0xca))/0x5*(parseInt(_0x360ea6(0x117))/0x6)+parseInt(_0x360ea6(0xa6))/0x7*(-parseInt(_0x360ea6(0xef))/0x8)+-parseInt(_0x360ea6(0xd9))/0x9+parseInt(_0x360ea6(0xac))/0xa*(parseInt(_0x360ea6(0xc6))/0xb);if(_0x4a9b74===_0xc54ef)break;else _0x4697e8['push'](_0x4697e8['shift']());}catch(_0x3907c2){_0x4697e8['push'](_0x4697e8['shift']());}}}(a37_0x1436,0x96894));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 a37_0x12b109 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a37_0x4af247(0xfa)]=a37_0x4af247(0xf4);[a37_0x4af247(0xea)]=a37_0x4af247(0xd7);async[a37_0x4af247(0x118)](_0x4420b3){const _0x161d8c=a37_0x4af247,{options:_0x43cfa9,args:_0xb9506f,tdx:_0x4fc3f8}=_0x4420b3,_0x2a5040=_0xb9506f[0x0];try{_0x43cfa9[_0x161d8c(0xa2)]&&_0x2a5040&&console[_0x161d8c(0x10a)]('Pattern:\x20'+_0x2a5040);const _0xc4e598=await withSpinner(_0x161d8c(0x11c),()=>_0x4fc3f8[_0x161d8c(0xb8)][_0x161d8c(0x85)](_0x2a5040,{'limit':_0x43cfa9[_0x161d8c(0x8d)]}),{'verbose':_0x43cfa9['verbose']}),_0x51389a=_0xc4e598['data'];return console[_0x161d8c(0x10a)](_0x161d8c(0x102)+_0x51389a[_0x161d8c(0xdc)]+_0x161d8c(0xe4)+(_0x51389a['length']!==0x1?'s':'')),await handleSDKOutput(_0x51389a,_0x43cfa9),0x0;}catch(_0x50a6a7){if(_0x50a6a7 instanceof SDKError)return console['error'](_0x161d8c(0x11d)+_0x50a6a7['message']),_0x50a6a7[_0x161d8c(0x101)]&&console[_0x161d8c(0x10a)](_0x161d8c(0xb3)+_0x50a6a7[_0x161d8c(0x101)]),0x1;throw _0x50a6a7;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a37_0x4af247(0xfa)]=a37_0x4af247(0xdd);[a37_0x4af247(0xea)]='List\x20workflows';async[a37_0x4af247(0x118)](_0x169585){const _0x33cb4b=a37_0x4af247,{options:_0x14100d,args:_0x3c9bac,tdx:_0x2cc69a}=_0x169585,_0x440381=_0x3c9bac[0x0];try{_0x14100d['verbose']&&_0x440381&&console['error'](_0x33cb4b(0xa5)+_0x440381);const _0x22cb54=await withSpinner(_0x33cb4b(0x96),()=>_0x2cc69a[_0x33cb4b(0xb8)]['workflows'](_0x440381,{'limit':_0x14100d['limit']}),{'verbose':_0x14100d[_0x33cb4b(0xa2)]}),_0xe3ca21=_0x22cb54[_0x33cb4b(0xf9)];return console[_0x33cb4b(0x10a)]('✔\x20Found\x20'+_0xe3ca21[_0x33cb4b(0xdc)]+_0x33cb4b(0xe5)+(_0xe3ca21[_0x33cb4b(0xdc)]!==0x1?'s':'')),await handleSDKOutput(_0xe3ca21,_0x14100d),0x0;}catch(_0x311ff0){if(_0x311ff0 instanceof SDKError)return console[_0x33cb4b(0x10a)](_0x33cb4b(0x11d)+_0x311ff0[_0x33cb4b(0xbe)]),_0x311ff0['cause']&&console[_0x33cb4b(0x10a)](_0x33cb4b(0xb3)+_0x311ff0[_0x33cb4b(0x101)]),0x1;throw _0x311ff0;}}}export class WorkflowSessionsCommand extends BaseCommand{[a37_0x4af247(0xfa)]=a37_0x4af247(0x97);[a37_0x4af247(0xea)]=a37_0x4af247(0x105);async[a37_0x4af247(0x118)](_0x4a0514){const _0x1ea6f1=a37_0x4af247,{options:_0x5bcf5e,args:_0x185593,tdx:_0x41c9c5}=_0x4a0514;let _0x2ab7b5,_0x2c64e3;if(_0x185593[0x0]){const _0x42d423=_0x185593[0x0][_0x1ea6f1(0xc8)]('.');if(_0x42d423[_0x1ea6f1(0xdc)]===0x1)_0x2ab7b5=_0x42d423[0x0];else{if(_0x42d423[_0x1ea6f1(0xdc)]===0x2)[_0x2ab7b5,_0x2c64e3]=_0x42d423;else return console[_0x1ea6f1(0x10a)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{if(_0x5bcf5e[_0x1ea6f1(0xa2)]){if(_0x2ab7b5&&_0x2c64e3)console['error'](_0x1ea6f1(0x89)+_0x2ab7b5+'.'+_0x2c64e3);else _0x2ab7b5&&console[_0x1ea6f1(0x10a)](_0x1ea6f1(0xf5)+_0x2ab7b5);const _0x5dff8a=_0x5bcf5e['status'];_0x5dff8a&&console[_0x1ea6f1(0x10a)](_0x1ea6f1(0xdb)+_0x5dff8a);}const _0x222aa6=await withSpinner(_0x1ea6f1(0x9d),()=>_0x41c9c5[_0x1ea6f1(0xb8)][_0x1ea6f1(0xf3)]({'projectName':_0x2ab7b5,'workflowName':_0x2c64e3,'status':_0x5bcf5e['status'],'fromTime':_0x5bcf5e[_0x1ea6f1(0x9a)],'toTime':_0x5bcf5e['to'],'limit':_0x5bcf5e['limit']}),{'verbose':_0x5bcf5e[_0x1ea6f1(0xa2)]}),_0x26712a=_0x222aa6[_0x1ea6f1(0xf9)];return console[_0x1ea6f1(0x10a)](_0x1ea6f1(0x102)+_0x26712a[_0x1ea6f1(0xdc)]+_0x1ea6f1(0x93)+(_0x26712a[_0x1ea6f1(0xdc)]!==0x1?'s':'')),await handleSDKOutput(_0x26712a,_0x5bcf5e),0x0;}catch(_0x55440b){if(_0x55440b instanceof SDKError)return console[_0x1ea6f1(0x10a)](_0x1ea6f1(0x11d)+_0x55440b['message']),_0x55440b['cause']&&console[_0x1ea6f1(0x10a)](_0x1ea6f1(0xb3)+_0x55440b['cause']),0x1;throw _0x55440b;}}}export class WorkflowAttemptsCommand extends BaseCommand{['name']=a37_0x4af247(0x8c);[a37_0x4af247(0xea)]='List\x20workflow\x20attempts';async[a37_0x4af247(0x118)](_0x136926){const _0x2f09ff=a37_0x4af247,{options:_0x1b5cf0,args:_0x32360f,tdx:_0x1ea2a4}=_0x136926;let _0x5a23d5,_0xd48ae8;if(_0x32360f[0x0]){const _0x89e91b=_0x32360f[0x0][_0x2f09ff(0xc8)]('.');if(_0x89e91b[_0x2f09ff(0xdc)]===0x1)_0x5a23d5=_0x89e91b[0x0];else{if(_0x89e91b[_0x2f09ff(0xdc)]===0x2)[_0x5a23d5,_0xd48ae8]=_0x89e91b;else return console[_0x2f09ff(0x10a)](_0x2f09ff(0xeb)),0x1;}}try{const _0x38ae33=_0x1b5cf0[_0x2f09ff(0xae)];if(_0x1b5cf0[_0x2f09ff(0xa2)]){if(_0x5a23d5&&_0xd48ae8)console[_0x2f09ff(0x10a)](_0x2f09ff(0x89)+_0x5a23d5+'.'+_0xd48ae8);else _0x5a23d5&&console[_0x2f09ff(0x10a)](_0x2f09ff(0xf5)+_0x5a23d5);_0x38ae33&&console[_0x2f09ff(0x10a)](_0x2f09ff(0x9c));}const _0xfe62b9=await withSpinner(_0x2f09ff(0x109),()=>_0x1ea2a4[_0x2f09ff(0xb8)][_0x2f09ff(0x108)]({'projectName':_0x5a23d5,'workflowName':_0xd48ae8,'includeRetried':_0x38ae33,'limit':_0x1b5cf0['limit']}),{'verbose':_0x1b5cf0[_0x2f09ff(0xa2)]}),_0x34a2c1=_0xfe62b9[_0x2f09ff(0xf9)];return console['error'](_0x2f09ff(0x102)+_0x34a2c1['length']+'\x20attempt'+(_0x34a2c1['length']!==0x1?'s':'')),await handleSDKOutput(_0x34a2c1,_0x1b5cf0),0x0;}catch(_0x4aa527){if(_0x4aa527 instanceof SDKError)return console[_0x2f09ff(0x10a)](_0x2f09ff(0x11d)+_0x4aa527[_0x2f09ff(0xbe)]),_0x4aa527[_0x2f09ff(0x101)]&&console[_0x2f09ff(0x10a)](_0x2f09ff(0xb3)+_0x4aa527[_0x2f09ff(0x101)]),0x1;throw _0x4aa527;}}}function a37_0x50b4(_0x7436a7,_0x318a2f){const _0x1436a2=a37_0x1436();return a37_0x50b4=function(_0x50b439,_0x4323b8){_0x50b439=_0x50b439-0x7c;let _0x13d544=_0x1436a2[_0x50b439];return _0x13d544;},a37_0x50b4(_0x7436a7,_0x318a2f);}export class WorkflowAttemptCommand extends BaseCommand{['name']=a37_0x4af247(0xba);['description']=a37_0x4af247(0x8f);async[a37_0x4af247(0x118)](_0x428190){const _0xa0368b=a37_0x4af247,{options:_0x3dc3ea,args:_0x324178,tdx:_0x346b39}=_0x428190,_0x4ebc85=_0x324178[0x0];if(!_0x4ebc85)return console['error']('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x3dc3ea['verbose']&&console[_0xa0368b(0x10a)]('Attempt\x20ID:\x20'+_0x4ebc85);const _0x392374=await withSpinner('Getting\x20attempt\x20details...',()=>_0x346b39[_0xa0368b(0xb8)][_0xa0368b(0xbb)](_0x4ebc85),{'verbose':_0x3dc3ea[_0xa0368b(0xa2)]}),_0x3d12dd=_0x392374[_0xa0368b(0xf9)];let _0x4241d1;!_0x3d12dd[_0xa0368b(0x110)]?_0x4241d1=_0x3d12dd[_0xa0368b(0x11b)]?_0xa0368b(0xb0):_0xa0368b(0x120):_0x4241d1=_0x3d12dd[_0xa0368b(0xd3)]?_0xa0368b(0xd3):_0xa0368b(0x10a);let _0x585926;if(_0x3d12dd[_0xa0368b(0xd6)]&&_0x3d12dd[_0xa0368b(0xf7)]){const _0x363f66=new Date(_0x3d12dd[_0xa0368b(0xd6)])[_0xa0368b(0x111)](),_0x2bbe3f=new Date(_0x3d12dd[_0xa0368b(0xf7)])['getTime']();_0x585926=Math[_0xa0368b(0xbd)]((_0x2bbe3f-_0x363f66)/0x3e8);}const _0x13a9dc={'attempt_id':_0x3d12dd['id'],'status':_0x4241d1,..._0x3d12dd[_0xa0368b(0xb5)]!==undefined&&{'index':_0x3d12dd['index']},..._0x3d12dd[_0xa0368b(0x11a)]&&{'project':_0x3d12dd['project'][_0xa0368b(0xfa)]},..._0x3d12dd['workflow']&&{'workflow':_0x3d12dd[_0xa0368b(0xb8)]['name']},..._0x3d12dd['sessionId']&&{'session_id':_0x3d12dd[_0xa0368b(0x80)]},..._0x3d12dd[_0xa0368b(0x8b)]&&{'session_time':_0x3d12dd[_0xa0368b(0x8b)]},..._0x3d12dd[_0xa0368b(0xee)]&&{'retry_attempt':_0x3d12dd[_0xa0368b(0xee)]},..._0x585926!==undefined&&{'duration_sec':_0x585926},..._0x3d12dd[_0xa0368b(0xd6)]&&{'created_at':_0x3d12dd['createdAt']},..._0x3d12dd[_0xa0368b(0xf7)]&&{'finished_at':_0x3d12dd[_0xa0368b(0xf7)]},...Object[_0xa0368b(0xe2)](_0x3d12dd['params'])['length']>0x0&&{'params':_0x3d12dd[_0xa0368b(0x91)]}};return await handleSingleObjectOutput(_0x13a9dc,_0x3dc3ea),0x0;}catch(_0x2c1c8d){if(_0x2c1c8d instanceof SDKError)return console['error'](_0xa0368b(0x11d)+_0x2c1c8d[_0xa0368b(0xbe)]),_0x2c1c8d[_0xa0368b(0x101)]&&console[_0xa0368b(0x10a)](_0xa0368b(0xb3)+_0x2c1c8d[_0xa0368b(0x101)]),0x1;throw _0x2c1c8d;}}}export class WorkflowTasksCommand extends BaseCommand{[a37_0x4af247(0xfa)]=a37_0x4af247(0xc7);[a37_0x4af247(0xea)]=a37_0x4af247(0xd1);async[a37_0x4af247(0x118)](_0x4789dc){const _0x56003e=a37_0x4af247,{options:_0x34ec2d,args:_0x18261e,tdx:_0x698a9e}=_0x4789dc,_0x424451=_0x18261e[0x0];if(!_0x424451)return console[_0x56003e(0x10a)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x49d02c=_0x34ec2d[_0x56003e(0xc4)];_0x34ec2d[_0x56003e(0xa2)]&&(console[_0x56003e(0x10a)](_0x56003e(0xb1)+_0x424451),_0x49d02c&&console[_0x56003e(0x10a)](_0x56003e(0xf1)));const _0x2eff4e=await withSpinner(_0x56003e(0xb9),()=>_0x698a9e['workflow'][_0x56003e(0x90)](_0x424451,_0x49d02c||![]),{'verbose':_0x34ec2d[_0x56003e(0xa2)]}),_0x1fd013=_0x2eff4e[_0x56003e(0xf9)];return console[_0x56003e(0x10a)]('✔\x20Found\x20'+_0x1fd013[_0x56003e(0xdc)]+_0x56003e(0x116)+(_0x1fd013[_0x56003e(0xdc)]!==0x1?'s':'')),await handleSDKOutput(_0x1fd013,_0x34ec2d),0x0;}catch(_0x475021){if(_0x475021 instanceof SDKError)return console[_0x56003e(0x10a)]('Error:\x20'+_0x475021[_0x56003e(0xbe)]),_0x475021['cause']&&console['error'](_0x56003e(0xb3)+_0x475021[_0x56003e(0x101)]),0x1;throw _0x475021;}}}function a37_0x1436(){const _0x2117c0=['Listing\x20workflow\x20sessions...','✔\x20Workflow\x20run\x20started','Error:\x20Project\x20name\x20is\x20required','\x20\x20Attempt\x20ID:\x20','param','verbose','filesExtracted','1156DhwtSj','Project\x20filter:\x20','2359406XjrFuX','readFile','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','\x22?\x20This\x20cannot\x20be\x20undone.','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','Kill\x20a\x20running\x20attempt','9707930FYLGkg','workflow:push','includeRetried','Usage:\x20workflow:delete\x20<project-name-or-id>','canceling','Attempt\x20ID:\x20','Session\x20time:\x20','\x20\x20Cause:\x20','utf-8','index','Error:\x20Invalid\x20JSON\x20in\x20--params','format','workflow','Getting\x20attempt\x20tasks...','workflow:attempt','attempt','631sDfrQh','round','message','Expected\x20format:\x20--param\x20key=value','delete','projectName','stringify','\x20\x20New\x20attempt\x20ID:\x20','includeSubtasks','parse','22uNHQcw','workflow:tasks','split','Retry\x20a\x20session\x20or\x20attempt','1305rLVWAy','\x20is\x20not\x20a\x20directory','\x20\x20Project:\x20','Start\x20a\x20workflow\x20run','...','Retrying\x20attempt...','stat','Show\x20tasks\x20for\x20an\x20attempt','fileSize','success','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','✔\x20Deleted\x20project\x20','createdAt','List\x20all\x20workflow\x20projects','workflow:run','10141506roSNnw','resumeFrom','Status:\x20','length','workflow:workflows','\x20\x20Workflow:\x20','Output\x20directory:\x20','✔\x20Downloaded\x20','map','keys','retrySession','\x20project','\x20workflow','retryAttempt','push','session:','Project\x20directory:\x20','description','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','run','No\x20log\x20files\x20found\x20for\x20this\x20attempt','retryAttemptName','16MrLFqT','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','Including\x20subtasks:\x20yes','Revision:\x20','sessions','workflow:projects','Filter:\x20project=','workflow:kill','finishedAt','substring','data','name','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','✔\x20Retry\x20started','Reason:\x20','json','Validation:\x20skipped','Downloading\x20logs...','cause','✔\x20Found\x20','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','task','List\x20workflow\x20execution\x20sessions','Workflow:\x20','kill','attempts','Listing\x20workflow\x20attempts...','error','Resume\x20from:\x20','Fetching\x20log\x20files...','Parameters:\x20','startsWith','\x20\x20Session\x20ID:\x20','done','getTime','Pushing\x20workflow\x20project...','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','Error:\x20Invalid\x20parameter\x20format:\x20','\x20task','27954oGDqlV','execute','From\x20task:\x20','project','cancelRequested','Listing\x20workflow\x20projects...','Error:\x20','fromTask','4640928iCCjFm','running','\x20\x20Location:\x20','workflow:delete','Starting\x20workflow\x20run...','attemptId','Cancelled','Downloading\x20project\x20','attempt:','sessionId','session','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','Project:\x20','select','projects','✔\x20Pushed\x20','download','Retrying\x20session...','Filter:\x20','Error:\x20Attempt\x20ID\x20is\x20required','sessionTime','workflow:attempts','limit','2689335USTwmu','Show\x20specific\x20attempt\x20details','tasks','params','workflow:download','\x20session','yes','projectId','Listing\x20workflows...','workflow:sessions','revision','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','from','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','Include\x20retried:\x20yes'];a37_0x1436=function(){return _0x2117c0;};return a37_0x1436();}export class WorkflowLogsCommand extends BaseCommand{[a37_0x4af247(0xfa)]='workflow:logs';[a37_0x4af247(0xea)]='Show\x20logs\x20for\x20a\x20workflow\x20attempt';async[a37_0x4af247(0x118)](_0x48178d){const _0xfed8dd=a37_0x4af247,{options:_0x1c6a47,args:_0x55c4cf,tdx:_0x576386}=_0x48178d,_0x5d78f0=_0x55c4cf[0x0];let _0x844715=_0x55c4cf[0x1];if(!_0x5d78f0)return console['error'](_0xfed8dd(0x8a)),0x1;try{_0x1c6a47[_0xfed8dd(0xa2)]&&(console[_0xfed8dd(0x10a)]('Attempt\x20ID:\x20'+_0x5d78f0),_0x844715&&console[_0xfed8dd(0x10a)]('Task\x20name:\x20'+_0x844715));const _0x5b35a9=await withSpinner(_0xfed8dd(0x10c),()=>_0x576386[_0xfed8dd(0xb8)]['logFiles'](_0x5d78f0,_0x844715),{'verbose':_0x1c6a47[_0xfed8dd(0xa2)]}),_0x4ab443=_0x5b35a9[_0xfed8dd(0xf9)];if(_0x4ab443[_0xfed8dd(0xdc)]===0x0)return console[_0xfed8dd(0x10a)](_0xfed8dd(0xed)),0x0;if(!_0x844715&&(_0x1c6a47[_0xfed8dd(0xfe)]||_0x1c6a47[_0xfed8dd(0xb7)]))return await handleSDKOutput(_0x4ab443,_0x1c6a47),0x0;if(!_0x844715){const _0x10482d=_0x4ab443[_0xfed8dd(0xe1)](_0x5ddecc=>({'title':_0x5ddecc['taskName']+'\x20('+formatBytes(_0x5ddecc[_0xfed8dd(0xd2)])+')','value':_0x5ddecc['taskName']})),_0x26a48c=await a37_0x12b109({'type':_0xfed8dd(0x84),'name':'task','message':'Select\x20a\x20task\x20to\x20view\x20logs:','choices':_0x10482d});if(!_0x26a48c[_0xfed8dd(0x104)])return console[_0xfed8dd(0x10a)](_0xfed8dd(0x7d)),0x0;_0x844715=_0x26a48c[_0xfed8dd(0x104)];}const _0x34e0fb=await withSpinner(_0xfed8dd(0x100),()=>_0x576386[_0xfed8dd(0xb8)]['logs'](_0x5d78f0,_0x844715),{'verbose':_0x1c6a47[_0xfed8dd(0xa2)]}),_0x42f898=_0x34e0fb[_0xfed8dd(0xf9)];return _0x42f898?console['log'](_0x42f898):console['error']('No\x20log\x20content\x20found'),0x0;}catch(_0xda3f5a){if(_0xda3f5a instanceof SDKError)return console[_0xfed8dd(0x10a)]('Error:\x20'+_0xda3f5a[_0xfed8dd(0xbe)]),_0xda3f5a['cause']&&console[_0xfed8dd(0x10a)](_0xfed8dd(0xb3)+_0xda3f5a['cause']),0x1;throw _0xda3f5a;}}}export class WorkflowKillCommand extends BaseCommand{[a37_0x4af247(0xfa)]=a37_0x4af247(0xf6);['description']=a37_0x4af247(0xab);async[a37_0x4af247(0x118)](_0x508807){const _0x47cdc5=a37_0x4af247,{options:_0x4b9617,args:_0x437cbb,tdx:_0x379550}=_0x508807,_0x265d01=_0x437cbb[0x0];if(!_0x265d01)return console[_0x47cdc5(0x10a)](_0x47cdc5(0x8a)),0x1;try{const _0x577f37=_0x4b9617['reason'];_0x4b9617['verbose']&&(console['error'](_0x47cdc5(0xb1)+_0x265d01),_0x577f37&&console[_0x47cdc5(0x10a)](_0x47cdc5(0xfd)+_0x577f37));if(!_0x4b9617[_0x47cdc5(0x94)]){const _0x126075=await confirm(_0x47cdc5(0x114)+_0x265d01+'?');if(!_0x126075)return console[_0x47cdc5(0x10a)]('Cancelled'),0x0;}const _0x257c88=await withSpinner('Killing\x20attempt...',()=>_0x379550[_0x47cdc5(0xb8)][_0x47cdc5(0x107)](_0x265d01,_0x577f37),{'verbose':_0x4b9617[_0x47cdc5(0xa2)]}),_0xa4a8a1=_0x257c88[_0x47cdc5(0xf9)];return console[_0x47cdc5(0x10a)]('✔\x20'+_0xa4a8a1),0x0;}catch(_0x3dde78){if(_0x3dde78 instanceof SDKError)return console[_0x47cdc5(0x10a)](_0x47cdc5(0x11d)+_0x3dde78[_0x47cdc5(0xbe)]),_0x3dde78['cause']&&console[_0x47cdc5(0x10a)](_0x47cdc5(0xb3)+_0x3dde78[_0x47cdc5(0x101)]),0x1;throw _0x3dde78;}}}export class WorkflowRetryCommand extends BaseCommand{[a37_0x4af247(0xfa)]='workflow:retry';[a37_0x4af247(0xea)]=a37_0x4af247(0xc9);async[a37_0x4af247(0x118)](_0x2fd264){const _0x5162a1=a37_0x4af247,{options:_0x4167cf,args:_0x3884eb,tdx:_0xed22a2}=_0x2fd264,_0x2ebf4a=_0x3884eb[0x0];if(!_0x2ebf4a)return console[_0x5162a1(0x10a)](_0x5162a1(0x113)),console[_0x5162a1(0x10a)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x3b457c=![],_0x3f519a=_0x2ebf4a;if(_0x2ebf4a[_0x5162a1(0x10e)](_0x5162a1(0xe8)))_0x3b457c=!![],_0x3f519a=_0x2ebf4a[_0x5162a1(0xf8)](0x8);else{if(_0x2ebf4a['startsWith'](_0x5162a1(0x7f)))_0x3b457c=![],_0x3f519a=_0x2ebf4a[_0x5162a1(0xf8)](0x8);else return console[_0x5162a1(0x10a)](_0x5162a1(0x9b)),console[_0x5162a1(0x10a)](_0x5162a1(0xfb)),0x1;}try{const _0x487d6e=_0x4167cf[_0x5162a1(0x11e)],_0x37df90=_0x4167cf[_0x5162a1(0xda)],_0x535594=_0x4167cf[_0x5162a1(0x91)],_0x5aede9=_0x4167cf['force'];_0x4167cf[_0x5162a1(0xa2)]&&(console[_0x5162a1(0x10a)]('Target:\x20'+(_0x3b457c?_0x5162a1(0x81):_0x5162a1(0xbb))+'\x20'+_0x3f519a),_0x487d6e&&console[_0x5162a1(0x10a)](_0x5162a1(0x119)+_0x487d6e),_0x37df90&&console['error'](_0x5162a1(0x10b)+_0x37df90),_0x535594&&console[_0x5162a1(0x10a)]('Params:\x20'+_0x535594),_0x5aede9&&console[_0x5162a1(0x10a)]('Force:\x20yes'));let _0x14a71e;if(_0x535594)try{if(_0x535594[_0x5162a1(0x10e)]('@')){const _0x1a141a=await import('fs/promises'),_0x25c510=_0x535594['substring'](0x1),_0x5ddc7=await _0x1a141a[_0x5162a1(0xa7)](_0x25c510,_0x5162a1(0xb4));_0x14a71e=JSON[_0x5162a1(0xc5)](_0x5ddc7);}else _0x14a71e=JSON[_0x5162a1(0xc5)](_0x535594);}catch{return console[_0x5162a1(0x10a)](_0x5162a1(0xb6)),0x1;}if(!_0x4167cf[_0x5162a1(0x94)]){const _0x4f7fad=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20'+(_0x3b457c?_0x5162a1(0x81):_0x5162a1(0xbb))+'\x20'+_0x3f519a+'?');if(!_0x4f7fad)return console[_0x5162a1(0x10a)](_0x5162a1(0x7d)),0x0;}let _0x460d60;_0x3b457c?_0x460d60=await withSpinner(_0x5162a1(0x88),()=>_0xed22a2[_0x5162a1(0xb8)][_0x5162a1(0xe3)](_0x3f519a,{'fromTask':_0x487d6e,'retryParams':_0x14a71e}),{'verbose':_0x4167cf[_0x5162a1(0xa2)]}):_0x460d60=await withSpinner(_0x5162a1(0xcf),()=>_0xed22a2[_0x5162a1(0xb8)][_0x5162a1(0xe6)](_0x3f519a,{'resumeFrom':_0x37df90,'retryParams':_0x14a71e,'force':_0x5aede9}),{'verbose':_0x4167cf[_0x5162a1(0xa2)]});const _0x5ac7ae=_0x460d60['data'];return console[_0x5162a1(0x10a)](_0x5162a1(0xfc)),console[_0x5162a1(0x10a)](_0x5162a1(0xc3)+_0x5ac7ae[_0x5162a1(0x7c)]),console[_0x5162a1(0x10a)](_0x5162a1(0x10f)+_0x5ac7ae[_0x5162a1(0x80)]),0x0;}catch(_0x3146ae){if(_0x3146ae instanceof SDKError)return console[_0x5162a1(0x10a)](_0x5162a1(0x11d)+_0x3146ae['message']),_0x3146ae['cause']&&console['error'](_0x5162a1(0xb3)+_0x3146ae[_0x5162a1(0x101)]),0x1;throw _0x3146ae;}}}export class WorkflowRunCommand extends BaseCommand{[a37_0x4af247(0xfa)]=a37_0x4af247(0xd8);[a37_0x4af247(0xea)]=a37_0x4af247(0xcd);async[a37_0x4af247(0x118)](_0x4bcc53){const _0x1d3862=a37_0x4af247,{options:_0x3df5b5,args:_0x1616b3,tdx:_0x340dc9}=_0x4bcc53,_0x403c4a=_0x1616b3[0x0];if(!_0x403c4a)return console['error']('Error:\x20Workflow\x20identifier\x20is\x20required'),console[_0x1d3862(0x10a)](_0x1d3862(0x103)),0x1;const _0x5ad0bf=_0x3df5b5[_0x1d3862(0xa1)],_0x40e8da=_0x3df5b5[_0x1d3862(0x8b)],_0x5c312d={};if(_0x5ad0bf&&Array['isArray'](_0x5ad0bf))for(const _0x506210 of _0x5ad0bf){const _0x42bba8=_0x506210['indexOf']('=');if(_0x42bba8===-0x1)return console[_0x1d3862(0x10a)](_0x1d3862(0x115)+_0x506210),console[_0x1d3862(0x10a)](_0x1d3862(0xbf)),0x1;const _0x26157d=_0x506210[_0x1d3862(0xf8)](0x0,_0x42bba8),_0x5824f1=_0x506210[_0x1d3862(0xf8)](_0x42bba8+0x1);try{_0x5c312d[_0x26157d]=JSON['parse'](_0x5824f1);}catch{_0x5c312d[_0x26157d]=_0x5824f1;}}_0x3df5b5[_0x1d3862(0xa2)]&&(console[_0x1d3862(0x10a)](_0x1d3862(0x106)+_0x403c4a),Object[_0x1d3862(0xe2)](_0x5c312d)[_0x1d3862(0xdc)]>0x0&&console[_0x1d3862(0x10a)](_0x1d3862(0x10d)+JSON[_0x1d3862(0xc2)](_0x5c312d)),_0x40e8da&&console['error'](_0x1d3862(0xb2)+_0x40e8da));const _0x57e50a=await withSpinner(_0x1d3862(0x123),()=>_0x340dc9[_0x1d3862(0xb8)][_0x1d3862(0xec)](_0x403c4a,_0x5c312d,{'sessionTime':_0x40e8da}),{'verbose':_0x3df5b5[_0x1d3862(0xa2)]}),_0xbe16ed=_0x57e50a[_0x1d3862(0xf9)];return console[_0x1d3862(0x10a)](_0x1d3862(0x9e)),console[_0x1d3862(0x10a)](_0x1d3862(0xa0)+_0xbe16ed['id']),console[_0x1d3862(0x10a)](_0x1d3862(0x10f)+_0xbe16ed['sessionId']),console[_0x1d3862(0x10a)](_0x1d3862(0xcc)+_0xbe16ed[_0x1d3862(0x11a)]?.[_0x1d3862(0xfa)]),console[_0x1d3862(0x10a)](_0x1d3862(0xde)+_0xbe16ed[_0x1d3862(0xb8)]?.[_0x1d3862(0xfa)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{['name']=a37_0x4af247(0x92);[a37_0x4af247(0xea)]=a37_0x4af247(0xa8);async['execute'](_0x356606){const _0x1133ff=a37_0x4af247,{options:_0x540f71,args:_0x735013,tdx:_0x244064}=_0x356606,_0x29cd5a=_0x735013[0x0],_0x2db136=_0x735013[0x1]||'.';if(!_0x29cd5a)return console[_0x1133ff(0x10a)](_0x1133ff(0x9f)),console[_0x1133ff(0x10a)](_0x1133ff(0xaa)),0x1;const _0x8bd133=_0x540f71[_0x1133ff(0x98)];_0x540f71[_0x1133ff(0xa2)]&&(console[_0x1133ff(0x10a)](_0x1133ff(0x83)+_0x29cd5a),console['error'](_0x1133ff(0xdf)+_0x2db136),_0x8bd133&&console[_0x1133ff(0x10a)]('Revision:\x20'+_0x8bd133));const _0x25aaf5=await withSpinner(_0x1133ff(0x7e)+_0x29cd5a+_0x1133ff(0xce),()=>_0x244064[_0x1133ff(0xb8)][_0x1133ff(0x87)](_0x29cd5a,_0x2db136,{'revision':_0x8bd133}),{'verbose':_0x540f71[_0x1133ff(0xa2)]}),_0x4571ca=_0x25aaf5[_0x1133ff(0xf9)];return console['error'](_0x1133ff(0xe0)+_0x4571ca[_0x1133ff(0xc1)]),console['error']('\x20\x20Revision:\x20'+_0x4571ca[_0x1133ff(0x98)]),console[_0x1133ff(0x10a)]('\x20\x20Files\x20extracted:\x20'+_0x4571ca[_0x1133ff(0xa3)]),console[_0x1133ff(0x10a)](_0x1133ff(0x121)+_0x2db136+'/'+_0x4571ca[_0x1133ff(0xc1)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{['name']=a37_0x4af247(0xad);[a37_0x4af247(0xea)]=a37_0x4af247(0xf0);async[a37_0x4af247(0x118)](_0xc7c50e){const _0xd66c9e=a37_0x4af247,{options:_0x113f17,args:_0x30f5d5,tdx:_0xfc93e7}=_0xc7c50e;let _0x2397b6='.',_0x865781=_0x113f17[_0xd66c9e(0xfa)];if(_0x30f5d5[0x0]){const {promises:_0x583302}=await import('fs');try{const _0x45511a=await _0x583302[_0xd66c9e(0xd0)](_0x30f5d5[0x0]);if(_0x45511a['isDirectory']())_0x2397b6=_0x30f5d5[0x0];else return console[_0xd66c9e(0x10a)]('Error:\x20'+_0x30f5d5[0x0]+_0xd66c9e(0xcb)),0x1;}catch{_0x865781=_0x30f5d5[0x0],_0x2397b6='.';}}const _0x590287=_0x113f17[_0xd66c9e(0x98)],_0x5ecb45=_0x113f17['skipValidation'];_0x113f17[_0xd66c9e(0xa2)]&&(console[_0xd66c9e(0x10a)](_0xd66c9e(0xe9)+_0x2397b6),_0x865781&&console[_0xd66c9e(0x10a)]('Project\x20name:\x20'+_0x865781),_0x590287&&console['error'](_0xd66c9e(0xf2)+_0x590287),_0x5ecb45&&console['error'](_0xd66c9e(0xff)));const _0x20db9a=await withSpinner(_0xd66c9e(0x112),()=>_0xfc93e7[_0xd66c9e(0xb8)][_0xd66c9e(0xe7)](_0x2397b6,{'projectName':_0x865781,'revision':_0x590287,'skipValidation':_0x5ecb45}),{'verbose':_0x113f17[_0xd66c9e(0xa2)]}),_0x526b7d=_0x20db9a[_0xd66c9e(0xf9)];return console[_0xd66c9e(0x10a)](_0xd66c9e(0x86)+_0x526b7d[_0xd66c9e(0xc1)]),console[_0xd66c9e(0x10a)]('\x20\x20Project\x20ID:\x20'+_0x526b7d[_0xd66c9e(0x95)]),console['error']('\x20\x20Revision:\x20'+_0x526b7d[_0xd66c9e(0x98)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a37_0x4af247(0xfa)]=a37_0x4af247(0x122);[a37_0x4af247(0xea)]=a37_0x4af247(0xd4);async['execute'](_0x5479ec){const _0x5998a9=a37_0x4af247,{options:_0x3cbfd5,args:_0x1fb04f,tdx:_0x4e061b}=_0x5479ec,_0x2d965c=_0x1fb04f[0x0];if(!_0x2d965c)return console['error'](_0x5998a9(0x82)),console[_0x5998a9(0x10a)](_0x5998a9(0xaf)),0x1;_0x3cbfd5[_0x5998a9(0xa2)]&&console['error'](_0x5998a9(0x83)+_0x2d965c);if(!_0x3cbfd5['yes']){const _0x3869b8=await confirm(_0x5998a9(0x99)+_0x2d965c+_0x5998a9(0xa9));if(!_0x3869b8)return console[_0x5998a9(0x10a)](_0x5998a9(0x7d)),0x0;}const _0x5929cb=await withSpinner('Deleting\x20project\x20'+_0x2d965c+_0x5998a9(0xce),()=>_0x4e061b[_0x5998a9(0xb8)][_0x5998a9(0xc0)](_0x2d965c),{'verbose':_0x3cbfd5[_0x5998a9(0xa2)]}),_0x880fda=_0x5929cb[_0x5998a9(0xf9)];return console[_0x5998a9(0x10a)](_0x5998a9(0xd5)+_0x880fda[_0x5998a9(0xc1)]),console['error']('\x20\x20Project\x20ID:\x20'+_0x880fda[_0x5998a9(0x95)]),0x0;}}
1
+ const a37_0x3f2f69=a37_0x5c05;(function(_0x5a82eb,_0x41b169){const _0x358be4=a37_0x5c05,_0x1c9aad=_0x5a82eb();while(!![]){try{const _0x45cd2c=parseInt(_0x358be4(0x139))/0x1+-parseInt(_0x358be4(0x16c))/0x2*(parseInt(_0x358be4(0x10f))/0x3)+parseInt(_0x358be4(0x117))/0x4*(-parseInt(_0x358be4(0x106))/0x5)+parseInt(_0x358be4(0x17a))/0x6*(parseInt(_0x358be4(0x113))/0x7)+-parseInt(_0x358be4(0x115))/0x8+parseInt(_0x358be4(0x162))/0x9+-parseInt(_0x358be4(0x197))/0xa*(-parseInt(_0x358be4(0x177))/0xb);if(_0x45cd2c===_0x41b169)break;else _0x1c9aad['push'](_0x1c9aad['shift']());}catch(_0x5a4abe){_0x1c9aad['push'](_0x1c9aad['shift']());}}}(a37_0x2044,0x2f8ba));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';function a37_0x2044(){const _0x1ceddf=['...','workflow:workflows','data','Resume\x20from:\x20','Validation:\x20skipped','Kill\x20a\x20running\x20attempt','workflow:delete','\x20attempt','Task\x20name:\x20','yes','275130IjWFZK','✔\x20Found\x20','delete','List\x20all\x20workflow\x20projects','Workflow:\x20','Fetching\x20log\x20files...','\x20\x20Location:\x20','utf-8','fromTask','Usage:\x20workflow:delete\x20<project-name-or-id>','Show\x20tasks\x20for\x20an\x20attempt','reason','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','Listing\x20workflows...','Starting\x20workflow\x20run...','Cancelled','workflow:retry','limit','error','message','attemptId','sessions','select','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','push','Filter:\x20','✔\x20Deleted\x20project\x20','substring','Getting\x20attempt\x20tasks...','task','10iwbgPY','parse','Parameters:\x20','finishedAt','isArray','keys','params','name','workflow:kill','3hRTfTX','Force:\x20yes','✔\x20Retry\x20started','Pattern:\x20','7bhilfO','\x20\x20Cause:\x20','88024BcRSaD','\x20workflow','748088wPwjds','json','Error:\x20Project\x20name\x20is\x20required','Downloading\x20logs...','Status:\x20','done','workflow:tasks','No\x20log\x20content\x20found','split','Filter:\x20project=','revision','stat','Downloading\x20project\x20','workflow:push','Project\x20directory:\x20','Error:\x20Attempt\x20ID\x20is\x20required','Killing\x20attempt...','workflow:download','attempt:','workflow:projects','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','Listing\x20workflow\x20attempts...','Params:\x20','format','workflow:run','Including\x20subtasks:\x20yes','fs/promises','Error:\x20Invalid\x20parameter\x20format:\x20','getTime','workflows','run','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','projects','retryAttempt','310197EVktqO','Project\x20name:\x20','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','Reason:\x20','force','\x20session','tasks','isDirectory','workflow:attempts','✔\x20Workflow\x20run\x20started','stringify','status','description','sessionTime','includeRetried','logs','length','fileSize','\x20\x20Revision:\x20','logFiles','Retrying\x20attempt...','Retrying\x20session...','\x20\x20Workflow:\x20','startsWith','\x20is\x20not\x20a\x20directory','\x22?\x20This\x20cannot\x20be\x20undone.','project','success','session','✔\x20Pushed\x20','cause','execute','Error:\x20','\x20\x20Session\x20ID:\x20','workflow','\x20\x20Project:\x20','projectName','Project:\x20','\x20project','retryAttemptName','Revision:\x20','2129580EBiypO','param','index','verbose','Attempt\x20ID:\x20','\x20\x20Project\x20ID:\x20','readFile','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','List\x20workflows','filesExtracted','134348KjcnZg','Getting\x20attempt\x20details...','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','indexOf','round','log','resumeFrom','Select\x20a\x20task\x20to\x20view\x20logs:','from','Start\x20a\x20workflow\x20run','11rXmMiH','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','sessionId','435822oMIEIV','retrySession','createdAt','List\x20workflow\x20execution\x20sessions','\x20\x20New\x20attempt\x20ID:\x20','workflow:attempt','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','taskName','download','Output\x20directory:\x20','map','projectId','\x20\x20Files\x20extracted:\x20','Error:\x20Workflow\x20identifier\x20is\x20required','Target:\x20','From\x20task:\x20','\x20task','attempt','workflow:sessions'];a37_0x2044=function(){return _0x1ceddf;};return a37_0x2044();}import{withSpinner}from'../utils/spinner.js';function a37_0x5c05(_0x5d84ca,_0x3e9a91){const _0x204450=a37_0x2044();return a37_0x5c05=function(_0x5c0518,_0xdb1973){_0x5c0518=_0x5c0518-0x105;let _0x9c1e77=_0x204450[_0x5c0518];return _0x9c1e77;},a37_0x5c05(_0x5d84ca,_0x3e9a91);}import{confirm}from'../utils/prompt.js';import{formatBytes}from'../utils/formatters.js';import a37_0x5ef617 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a37_0x3f2f69(0x10d)]=a37_0x3f2f69(0x12a);[a37_0x3f2f69(0x145)]=a37_0x3f2f69(0x19a);async[a37_0x3f2f69(0x158)](_0x5b7ee8){const _0x3651dc=a37_0x3f2f69,{options:_0x326807,args:_0xb38d9a,tdx:_0x2ba8fd}=_0x5b7ee8,_0x158dfa=_0xb38d9a[0x0];try{_0x326807['verbose']&&_0x158dfa&&console[_0x3651dc(0x1a9)](_0x3651dc(0x112)+_0x158dfa);const _0x2d0b3e=await withSpinner('Listing\x20workflow\x20projects...',()=>_0x2ba8fd['workflow'][_0x3651dc(0x137)](_0x158dfa,{'limit':_0x326807[_0x3651dc(0x1a8)]}),{'verbose':_0x326807['verbose']}),_0x3db0e1=_0x2d0b3e[_0x3651dc(0x18f)];return console['error']('✔\x20Found\x20'+_0x3db0e1[_0x3651dc(0x149)]+_0x3651dc(0x15f)+(_0x3db0e1[_0x3651dc(0x149)]!==0x1?'s':'')),await handleSDKOutput(_0x3db0e1,_0x326807),0x0;}catch(_0x50a5a8){if(_0x50a5a8 instanceof SDKError)return console[_0x3651dc(0x1a9)](_0x3651dc(0x159)+_0x50a5a8[_0x3651dc(0x1aa)]),_0x50a5a8[_0x3651dc(0x157)]&&console[_0x3651dc(0x1a9)](_0x3651dc(0x114)+_0x50a5a8[_0x3651dc(0x157)]),0x1;throw _0x50a5a8;}}}export class WorkflowWorkflowsCommand extends BaseCommand{['name']=a37_0x3f2f69(0x18e);['description']=a37_0x3f2f69(0x16a);async[a37_0x3f2f69(0x158)](_0x1bf27a){const _0x20613c=a37_0x3f2f69,{options:_0x3c62b9,args:_0x5dc293,tdx:_0x4b47a0}=_0x1bf27a,_0x4f5c55=_0x5dc293[0x0];try{_0x3c62b9['verbose']&&_0x4f5c55&&console[_0x20613c(0x1a9)]('Project\x20filter:\x20'+_0x4f5c55);const _0x18f94c=await withSpinner(_0x20613c(0x1a4),()=>_0x4b47a0[_0x20613c(0x15b)][_0x20613c(0x134)](_0x4f5c55,{'limit':_0x3c62b9[_0x20613c(0x1a8)]}),{'verbose':_0x3c62b9[_0x20613c(0x165)]}),_0x195ecb=_0x18f94c[_0x20613c(0x18f)];return console[_0x20613c(0x1a9)](_0x20613c(0x198)+_0x195ecb['length']+_0x20613c(0x116)+(_0x195ecb[_0x20613c(0x149)]!==0x1?'s':'')),await handleSDKOutput(_0x195ecb,_0x3c62b9),0x0;}catch(_0x23105f){if(_0x23105f instanceof SDKError)return console[_0x20613c(0x1a9)](_0x20613c(0x159)+_0x23105f['message']),_0x23105f[_0x20613c(0x157)]&&console['error'](_0x20613c(0x114)+_0x23105f[_0x20613c(0x157)]),0x1;throw _0x23105f;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']=a37_0x3f2f69(0x18c);[a37_0x3f2f69(0x145)]=a37_0x3f2f69(0x17d);async['execute'](_0x2a7665){const _0xc8ef3f=a37_0x3f2f69,{options:_0x153f2a,args:_0x4619d9,tdx:_0x303ee2}=_0x2a7665;let _0x11b537,_0x58cec6;if(_0x4619d9[0x0]){const _0x46bc06=_0x4619d9[0x0]['split']('.');if(_0x46bc06[_0xc8ef3f(0x149)]===0x1)_0x11b537=_0x46bc06[0x0];else{if(_0x46bc06[_0xc8ef3f(0x149)]===0x2)[_0x11b537,_0x58cec6]=_0x46bc06;else return console[_0xc8ef3f(0x1a9)](_0xc8ef3f(0x16f)),0x1;}}try{if(_0x153f2a[_0xc8ef3f(0x165)]){if(_0x11b537&&_0x58cec6)console[_0xc8ef3f(0x1a9)]('Filter:\x20'+_0x11b537+'.'+_0x58cec6);else _0x11b537&&console[_0xc8ef3f(0x1a9)]('Filter:\x20project='+_0x11b537);const _0x32ecab=_0x153f2a[_0xc8ef3f(0x144)];_0x32ecab&&console[_0xc8ef3f(0x1a9)](_0xc8ef3f(0x11b)+_0x32ecab);}const _0x24aa88=await withSpinner('Listing\x20workflow\x20sessions...',()=>_0x303ee2[_0xc8ef3f(0x15b)][_0xc8ef3f(0x1ac)]({'projectName':_0x11b537,'workflowName':_0x58cec6,'status':_0x153f2a[_0xc8ef3f(0x144)],'fromTime':_0x153f2a[_0xc8ef3f(0x175)],'toTime':_0x153f2a['to'],'limit':_0x153f2a[_0xc8ef3f(0x1a8)]}),{'verbose':_0x153f2a[_0xc8ef3f(0x165)]}),_0x599342=_0x24aa88[_0xc8ef3f(0x18f)];return console[_0xc8ef3f(0x1a9)](_0xc8ef3f(0x198)+_0x599342['length']+_0xc8ef3f(0x13e)+(_0x599342['length']!==0x1?'s':'')),await handleSDKOutput(_0x599342,_0x153f2a),0x0;}catch(_0x1c7449){if(_0x1c7449 instanceof SDKError)return console[_0xc8ef3f(0x1a9)](_0xc8ef3f(0x159)+_0x1c7449[_0xc8ef3f(0x1aa)]),_0x1c7449[_0xc8ef3f(0x157)]&&console[_0xc8ef3f(0x1a9)]('\x20\x20Cause:\x20'+_0x1c7449[_0xc8ef3f(0x157)]),0x1;throw _0x1c7449;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a37_0x3f2f69(0x10d)]=a37_0x3f2f69(0x141);[a37_0x3f2f69(0x145)]='List\x20workflow\x20attempts';async[a37_0x3f2f69(0x158)](_0x45be87){const _0x39d27a=a37_0x3f2f69,{options:_0x3e88a9,args:_0x2d3961,tdx:_0x35ed18}=_0x45be87;let _0x1f3fb2,_0x22510c;if(_0x2d3961[0x0]){const _0x3e2624=_0x2d3961[0x0][_0x39d27a(0x11f)]('.');if(_0x3e2624['length']===0x1)_0x1f3fb2=_0x3e2624[0x0];else{if(_0x3e2624[_0x39d27a(0x149)]===0x2)[_0x1f3fb2,_0x22510c]=_0x3e2624;else return console['error'](_0x39d27a(0x16f)),0x1;}}try{const _0x135b56=_0x3e88a9[_0x39d27a(0x147)];if(_0x3e88a9['verbose']){if(_0x1f3fb2&&_0x22510c)console[_0x39d27a(0x1a9)](_0x39d27a(0x1b0)+_0x1f3fb2+'.'+_0x22510c);else _0x1f3fb2&&console[_0x39d27a(0x1a9)](_0x39d27a(0x120)+_0x1f3fb2);_0x135b56&&console[_0x39d27a(0x1a9)]('Include\x20retried:\x20yes');}const _0x4f3ddc=await withSpinner(_0x39d27a(0x12c),()=>_0x35ed18['workflow']['attempts']({'projectName':_0x1f3fb2,'workflowName':_0x22510c,'includeRetried':_0x135b56,'limit':_0x3e88a9['limit']}),{'verbose':_0x3e88a9[_0x39d27a(0x165)]}),_0x105312=_0x4f3ddc[_0x39d27a(0x18f)];return console[_0x39d27a(0x1a9)]('✔\x20Found\x20'+_0x105312[_0x39d27a(0x149)]+_0x39d27a(0x194)+(_0x105312['length']!==0x1?'s':'')),await handleSDKOutput(_0x105312,_0x3e88a9),0x0;}catch(_0x338b26){if(_0x338b26 instanceof SDKError)return console[_0x39d27a(0x1a9)](_0x39d27a(0x159)+_0x338b26[_0x39d27a(0x1aa)]),_0x338b26[_0x39d27a(0x157)]&&console[_0x39d27a(0x1a9)](_0x39d27a(0x114)+_0x338b26[_0x39d27a(0x157)]),0x1;throw _0x338b26;}}}export class WorkflowAttemptCommand extends BaseCommand{[a37_0x3f2f69(0x10d)]=a37_0x3f2f69(0x17f);['description']='Show\x20specific\x20attempt\x20details';async[a37_0x3f2f69(0x158)](_0x5b8688){const _0xc5a42b=a37_0x3f2f69,{options:_0x122bab,args:_0x239328,tdx:_0x3c91ad}=_0x5b8688,_0x827aa=_0x239328[0x0];if(!_0x827aa)return console[_0xc5a42b(0x1a9)](_0xc5a42b(0x126)),0x1;try{_0x122bab[_0xc5a42b(0x165)]&&console[_0xc5a42b(0x1a9)](_0xc5a42b(0x166)+_0x827aa);const _0x227a99=await withSpinner(_0xc5a42b(0x16d),()=>_0x3c91ad[_0xc5a42b(0x15b)][_0xc5a42b(0x18b)](_0x827aa),{'verbose':_0x122bab['verbose']}),_0x16b8e7=_0x227a99[_0xc5a42b(0x18f)];let _0x8a11fe;!_0x16b8e7[_0xc5a42b(0x11c)]?_0x8a11fe=_0x16b8e7['cancelRequested']?'canceling':'running':_0x8a11fe=_0x16b8e7[_0xc5a42b(0x154)]?'success':_0xc5a42b(0x1a9);let _0x31b04f;if(_0x16b8e7[_0xc5a42b(0x17c)]&&_0x16b8e7['finishedAt']){const _0x48de9d=new Date(_0x16b8e7[_0xc5a42b(0x17c)])[_0xc5a42b(0x133)](),_0x577fd3=new Date(_0x16b8e7['finishedAt'])[_0xc5a42b(0x133)]();_0x31b04f=Math[_0xc5a42b(0x171)]((_0x577fd3-_0x48de9d)/0x3e8);}const _0x4b08d6={'attempt_id':_0x16b8e7['id'],'status':_0x8a11fe,..._0x16b8e7[_0xc5a42b(0x164)]!==undefined&&{'index':_0x16b8e7[_0xc5a42b(0x164)]},..._0x16b8e7[_0xc5a42b(0x153)]&&{'project':_0x16b8e7['project']['name']},..._0x16b8e7[_0xc5a42b(0x15b)]&&{'workflow':_0x16b8e7[_0xc5a42b(0x15b)][_0xc5a42b(0x10d)]},..._0x16b8e7['sessionId']&&{'session_id':_0x16b8e7[_0xc5a42b(0x179)]},..._0x16b8e7[_0xc5a42b(0x146)]&&{'session_time':_0x16b8e7[_0xc5a42b(0x146)]},..._0x16b8e7[_0xc5a42b(0x160)]&&{'retry_attempt':_0x16b8e7[_0xc5a42b(0x160)]},..._0x31b04f!==undefined&&{'duration_sec':_0x31b04f},..._0x16b8e7[_0xc5a42b(0x17c)]&&{'created_at':_0x16b8e7[_0xc5a42b(0x17c)]},..._0x16b8e7['finishedAt']&&{'finished_at':_0x16b8e7[_0xc5a42b(0x109)]},...Object[_0xc5a42b(0x10b)](_0x16b8e7[_0xc5a42b(0x10c)])[_0xc5a42b(0x149)]>0x0&&{'params':_0x16b8e7[_0xc5a42b(0x10c)]}};return await handleSingleObjectOutput(_0x4b08d6,_0x122bab),0x0;}catch(_0x4d6e8a){if(_0x4d6e8a instanceof SDKError)return console['error']('Error:\x20'+_0x4d6e8a[_0xc5a42b(0x1aa)]),_0x4d6e8a[_0xc5a42b(0x157)]&&console[_0xc5a42b(0x1a9)](_0xc5a42b(0x114)+_0x4d6e8a[_0xc5a42b(0x157)]),0x1;throw _0x4d6e8a;}}}export class WorkflowTasksCommand extends BaseCommand{['name']=a37_0x3f2f69(0x11d);[a37_0x3f2f69(0x145)]=a37_0x3f2f69(0x1a1);async[a37_0x3f2f69(0x158)](_0x359e51){const _0x3ff631=a37_0x3f2f69,{options:_0x44d5a7,args:_0x412c91,tdx:_0x27e64f}=_0x359e51,_0x30c397=_0x412c91[0x0];if(!_0x30c397)return console[_0x3ff631(0x1a9)](_0x3ff631(0x126)),0x1;try{const _0x9daf94=_0x44d5a7['includeSubtasks'];_0x44d5a7[_0x3ff631(0x165)]&&(console['error'](_0x3ff631(0x166)+_0x30c397),_0x9daf94&&console[_0x3ff631(0x1a9)](_0x3ff631(0x130)));const _0x1e2743=await withSpinner(_0x3ff631(0x1b3),()=>_0x27e64f[_0x3ff631(0x15b)][_0x3ff631(0x13f)](_0x30c397,_0x9daf94||![]),{'verbose':_0x44d5a7[_0x3ff631(0x165)]}),_0x547227=_0x1e2743[_0x3ff631(0x18f)];return console[_0x3ff631(0x1a9)](_0x3ff631(0x198)+_0x547227[_0x3ff631(0x149)]+_0x3ff631(0x18a)+(_0x547227[_0x3ff631(0x149)]!==0x1?'s':'')),await handleSDKOutput(_0x547227,_0x44d5a7),0x0;}catch(_0x48dc4b){if(_0x48dc4b instanceof SDKError)return console['error'](_0x3ff631(0x159)+_0x48dc4b['message']),_0x48dc4b[_0x3ff631(0x157)]&&console['error'](_0x3ff631(0x114)+_0x48dc4b['cause']),0x1;throw _0x48dc4b;}}}export class WorkflowLogsCommand extends BaseCommand{[a37_0x3f2f69(0x10d)]='workflow:logs';[a37_0x3f2f69(0x145)]='Show\x20logs\x20for\x20a\x20workflow\x20attempt';async[a37_0x3f2f69(0x158)](_0x19c6e1){const _0x5d61b8=a37_0x3f2f69,{options:_0x42d644,args:_0x47d9b0,tdx:_0x4506c7}=_0x19c6e1,_0x4132c2=_0x47d9b0[0x0];let _0x3c7f23=_0x47d9b0[0x1];if(!_0x4132c2)return console[_0x5d61b8(0x1a9)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x42d644[_0x5d61b8(0x165)]&&(console[_0x5d61b8(0x1a9)](_0x5d61b8(0x166)+_0x4132c2),_0x3c7f23&&console[_0x5d61b8(0x1a9)](_0x5d61b8(0x195)+_0x3c7f23));const _0xa17928=await withSpinner(_0x5d61b8(0x19c),()=>_0x4506c7['workflow'][_0x5d61b8(0x14c)](_0x4132c2,_0x3c7f23),{'verbose':_0x42d644['verbose']}),_0x42c69c=_0xa17928['data'];if(_0x42c69c[_0x5d61b8(0x149)]===0x0)return console[_0x5d61b8(0x1a9)]('No\x20log\x20files\x20found\x20for\x20this\x20attempt'),0x0;if(!_0x3c7f23&&(_0x42d644[_0x5d61b8(0x118)]||_0x42d644[_0x5d61b8(0x12e)]))return await handleSDKOutput(_0x42c69c,_0x42d644),0x0;if(!_0x3c7f23){const _0x221c0b=_0x42c69c[_0x5d61b8(0x184)](_0x5c22ed=>({'title':_0x5c22ed['taskName']+'\x20('+formatBytes(_0x5c22ed[_0x5d61b8(0x14a)])+')','value':_0x5c22ed[_0x5d61b8(0x181)]})),_0x2dfc52=await a37_0x5ef617({'type':_0x5d61b8(0x1ad),'name':_0x5d61b8(0x105),'message':_0x5d61b8(0x174),'choices':_0x221c0b});if(!_0x2dfc52[_0x5d61b8(0x105)])return console[_0x5d61b8(0x1a9)]('Cancelled'),0x0;_0x3c7f23=_0x2dfc52[_0x5d61b8(0x105)];}const _0x1c29d9=await withSpinner(_0x5d61b8(0x11a),()=>_0x4506c7[_0x5d61b8(0x15b)][_0x5d61b8(0x148)](_0x4132c2,_0x3c7f23),{'verbose':_0x42d644[_0x5d61b8(0x165)]}),_0x251bb4=_0x1c29d9['data'];return _0x251bb4?console[_0x5d61b8(0x172)](_0x251bb4):console[_0x5d61b8(0x1a9)](_0x5d61b8(0x11e)),0x0;}catch(_0x4252e7){if(_0x4252e7 instanceof SDKError)return console[_0x5d61b8(0x1a9)]('Error:\x20'+_0x4252e7[_0x5d61b8(0x1aa)]),_0x4252e7['cause']&&console[_0x5d61b8(0x1a9)](_0x5d61b8(0x114)+_0x4252e7[_0x5d61b8(0x157)]),0x1;throw _0x4252e7;}}}export class WorkflowKillCommand extends BaseCommand{[a37_0x3f2f69(0x10d)]=a37_0x3f2f69(0x10e);[a37_0x3f2f69(0x145)]=a37_0x3f2f69(0x192);async['execute'](_0xd261d2){const _0x238884=a37_0x3f2f69,{options:_0x375d6c,args:_0x4a087c,tdx:_0x3eaf0c}=_0xd261d2,_0x56ab85=_0x4a087c[0x0];if(!_0x56ab85)return console[_0x238884(0x1a9)](_0x238884(0x126)),0x1;try{const _0x1fd4b9=_0x375d6c[_0x238884(0x1a2)];_0x375d6c[_0x238884(0x165)]&&(console['error'](_0x238884(0x166)+_0x56ab85),_0x1fd4b9&&console[_0x238884(0x1a9)](_0x238884(0x13c)+_0x1fd4b9));if(!_0x375d6c[_0x238884(0x196)]){const _0x3fb414=await confirm(_0x238884(0x16e)+_0x56ab85+'?');if(!_0x3fb414)return console[_0x238884(0x1a9)](_0x238884(0x1a6)),0x0;}const _0x30ea0c=await withSpinner(_0x238884(0x127),()=>_0x3eaf0c['workflow']['kill'](_0x56ab85,_0x1fd4b9),{'verbose':_0x375d6c[_0x238884(0x165)]}),_0x33d848=_0x30ea0c[_0x238884(0x18f)];return console[_0x238884(0x1a9)]('✔\x20'+_0x33d848),0x0;}catch(_0x27f895){if(_0x27f895 instanceof SDKError)return console[_0x238884(0x1a9)](_0x238884(0x159)+_0x27f895[_0x238884(0x1aa)]),_0x27f895[_0x238884(0x157)]&&console[_0x238884(0x1a9)](_0x238884(0x114)+_0x27f895[_0x238884(0x157)]),0x1;throw _0x27f895;}}}export class WorkflowRetryCommand extends BaseCommand{['name']=a37_0x3f2f69(0x1a7);['description']='Retry\x20a\x20session\x20or\x20attempt';async[a37_0x3f2f69(0x158)](_0x5799b2){const _0x19dc6b=a37_0x3f2f69,{options:_0x13c109,args:_0x3b9d05,tdx:_0x5b8d76}=_0x5799b2,_0x280e05=_0x3b9d05[0x0];if(!_0x280e05)return console[_0x19dc6b(0x1a9)]('Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required'),console[_0x19dc6b(0x1a9)](_0x19dc6b(0x13b)),0x1;let _0x5a2ae7=![],_0x334f4e=_0x280e05;if(_0x280e05['startsWith']('session:'))_0x5a2ae7=!![],_0x334f4e=_0x280e05['substring'](0x8);else{if(_0x280e05[_0x19dc6b(0x150)](_0x19dc6b(0x129)))_0x5a2ae7=![],_0x334f4e=_0x280e05[_0x19dc6b(0x1b2)](0x8);else return console[_0x19dc6b(0x1a9)]('Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'),console[_0x19dc6b(0x1a9)](_0x19dc6b(0x13b)),0x1;}try{const _0x1d563d=_0x13c109[_0x19dc6b(0x19f)],_0x121706=_0x13c109[_0x19dc6b(0x173)],_0x523936=_0x13c109['params'],_0x4513ac=_0x13c109[_0x19dc6b(0x13d)];_0x13c109[_0x19dc6b(0x165)]&&(console[_0x19dc6b(0x1a9)](_0x19dc6b(0x188)+(_0x5a2ae7?_0x19dc6b(0x155):_0x19dc6b(0x18b))+'\x20'+_0x334f4e),_0x1d563d&&console['error'](_0x19dc6b(0x189)+_0x1d563d),_0x121706&&console[_0x19dc6b(0x1a9)](_0x19dc6b(0x190)+_0x121706),_0x523936&&console[_0x19dc6b(0x1a9)](_0x19dc6b(0x12d)+_0x523936),_0x4513ac&&console[_0x19dc6b(0x1a9)](_0x19dc6b(0x110)));let _0x2d5f70;if(_0x523936)try{if(_0x523936[_0x19dc6b(0x150)]('@')){const _0x472da6=await import(_0x19dc6b(0x131)),_0xa0b209=_0x523936['substring'](0x1),_0x2f47a2=await _0x472da6[_0x19dc6b(0x168)](_0xa0b209,_0x19dc6b(0x19e));_0x2d5f70=JSON[_0x19dc6b(0x107)](_0x2f47a2);}else _0x2d5f70=JSON[_0x19dc6b(0x107)](_0x523936);}catch{return console[_0x19dc6b(0x1a9)]('Error:\x20Invalid\x20JSON\x20in\x20--params'),0x1;}if(!_0x13c109[_0x19dc6b(0x196)]){const _0x5f84a9=await confirm(_0x19dc6b(0x169)+(_0x5a2ae7?'session':_0x19dc6b(0x18b))+'\x20'+_0x334f4e+'?');if(!_0x5f84a9)return console[_0x19dc6b(0x1a9)](_0x19dc6b(0x1a6)),0x0;}let _0xe020b8;_0x5a2ae7?_0xe020b8=await withSpinner(_0x19dc6b(0x14e),()=>_0x5b8d76[_0x19dc6b(0x15b)][_0x19dc6b(0x17b)](_0x334f4e,{'fromTask':_0x1d563d,'retryParams':_0x2d5f70}),{'verbose':_0x13c109[_0x19dc6b(0x165)]}):_0xe020b8=await withSpinner(_0x19dc6b(0x14d),()=>_0x5b8d76[_0x19dc6b(0x15b)][_0x19dc6b(0x138)](_0x334f4e,{'resumeFrom':_0x121706,'retryParams':_0x2d5f70,'force':_0x4513ac}),{'verbose':_0x13c109[_0x19dc6b(0x165)]});const _0x580efe=_0xe020b8[_0x19dc6b(0x18f)];return console[_0x19dc6b(0x1a9)](_0x19dc6b(0x111)),console['error'](_0x19dc6b(0x17e)+_0x580efe[_0x19dc6b(0x1ab)]),console['error'](_0x19dc6b(0x15a)+_0x580efe[_0x19dc6b(0x179)]),0x0;}catch(_0x58793e){if(_0x58793e instanceof SDKError)return console[_0x19dc6b(0x1a9)](_0x19dc6b(0x159)+_0x58793e['message']),_0x58793e[_0x19dc6b(0x157)]&&console['error'](_0x19dc6b(0x114)+_0x58793e[_0x19dc6b(0x157)]),0x1;throw _0x58793e;}}}export class WorkflowRunCommand extends BaseCommand{[a37_0x3f2f69(0x10d)]=a37_0x3f2f69(0x12f);[a37_0x3f2f69(0x145)]=a37_0x3f2f69(0x176);async[a37_0x3f2f69(0x158)](_0x5d530b){const _0x6ea6d6=a37_0x3f2f69,{options:_0x2e7838,args:_0x1d4975,tdx:_0x5d5722}=_0x5d530b,_0x3c8693=_0x1d4975[0x0];if(!_0x3c8693)return console['error'](_0x6ea6d6(0x187)),console['error'](_0x6ea6d6(0x1a3)),0x1;const _0x86a0d=_0x2e7838[_0x6ea6d6(0x163)],_0x24288d=_0x2e7838[_0x6ea6d6(0x146)],_0x58d0c7={};if(_0x86a0d&&Array[_0x6ea6d6(0x10a)](_0x86a0d))for(const _0x1e0945 of _0x86a0d){const _0x24c333=_0x1e0945[_0x6ea6d6(0x170)]('=');if(_0x24c333===-0x1)return console[_0x6ea6d6(0x1a9)](_0x6ea6d6(0x132)+_0x1e0945),console[_0x6ea6d6(0x1a9)]('Expected\x20format:\x20--param\x20key=value'),0x1;const _0x49ea90=_0x1e0945[_0x6ea6d6(0x1b2)](0x0,_0x24c333),_0x2ac657=_0x1e0945['substring'](_0x24c333+0x1);try{_0x58d0c7[_0x49ea90]=JSON[_0x6ea6d6(0x107)](_0x2ac657);}catch{_0x58d0c7[_0x49ea90]=_0x2ac657;}}_0x2e7838[_0x6ea6d6(0x165)]&&(console['error'](_0x6ea6d6(0x19b)+_0x3c8693),Object[_0x6ea6d6(0x10b)](_0x58d0c7)[_0x6ea6d6(0x149)]>0x0&&console[_0x6ea6d6(0x1a9)](_0x6ea6d6(0x108)+JSON[_0x6ea6d6(0x143)](_0x58d0c7)),_0x24288d&&console[_0x6ea6d6(0x1a9)]('Session\x20time:\x20'+_0x24288d));const _0xfb2f4d=await withSpinner(_0x6ea6d6(0x1a5),()=>_0x5d5722[_0x6ea6d6(0x15b)][_0x6ea6d6(0x135)](_0x3c8693,_0x58d0c7,{'sessionTime':_0x24288d}),{'verbose':_0x2e7838[_0x6ea6d6(0x165)]}),_0x4c6ceb=_0xfb2f4d[_0x6ea6d6(0x18f)];return console[_0x6ea6d6(0x1a9)](_0x6ea6d6(0x142)),console[_0x6ea6d6(0x1a9)]('\x20\x20Attempt\x20ID:\x20'+_0x4c6ceb['id']),console[_0x6ea6d6(0x1a9)](_0x6ea6d6(0x15a)+_0x4c6ceb['sessionId']),console['error'](_0x6ea6d6(0x15c)+_0x4c6ceb[_0x6ea6d6(0x153)]?.['name']),console['error'](_0x6ea6d6(0x14f)+_0x4c6ceb[_0x6ea6d6(0x15b)]?.[_0x6ea6d6(0x10d)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{['name']=a37_0x3f2f69(0x128);[a37_0x3f2f69(0x145)]=a37_0x3f2f69(0x12b);async[a37_0x3f2f69(0x158)](_0x2e7fc0){const _0x64e267=a37_0x3f2f69,{options:_0x4767f8,args:_0x3aed3e,tdx:_0xf1e5da}=_0x2e7fc0,_0x4593f8=_0x3aed3e[0x0],_0x401ad9=_0x3aed3e[0x1]||'.';if(!_0x4593f8)return console['error'](_0x64e267(0x119)),console[_0x64e267(0x1a9)](_0x64e267(0x1ae)),0x1;const _0x9a7702=_0x4767f8['revision'];_0x4767f8[_0x64e267(0x165)]&&(console['error'](_0x64e267(0x15e)+_0x4593f8),console[_0x64e267(0x1a9)](_0x64e267(0x183)+_0x401ad9),_0x9a7702&&console[_0x64e267(0x1a9)](_0x64e267(0x161)+_0x9a7702));const _0x36a569=await withSpinner(_0x64e267(0x123)+_0x4593f8+_0x64e267(0x18d),()=>_0xf1e5da[_0x64e267(0x15b)][_0x64e267(0x182)](_0x4593f8,_0x401ad9,{'revision':_0x9a7702}),{'verbose':_0x4767f8[_0x64e267(0x165)]}),_0x4ef409=_0x36a569[_0x64e267(0x18f)];return console['error']('✔\x20Downloaded\x20'+_0x4ef409['projectName']),console[_0x64e267(0x1a9)](_0x64e267(0x14b)+_0x4ef409[_0x64e267(0x121)]),console[_0x64e267(0x1a9)](_0x64e267(0x186)+_0x4ef409[_0x64e267(0x16b)]),console[_0x64e267(0x1a9)](_0x64e267(0x19d)+_0x401ad9+'/'+_0x4ef409[_0x64e267(0x15d)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a37_0x3f2f69(0x10d)]=a37_0x3f2f69(0x124);['description']='Push\x20workflow\x20project\x20to\x20Treasure\x20Data';async[a37_0x3f2f69(0x158)](_0x1e1929){const _0x38f849=a37_0x3f2f69,{options:_0x41b0c1,args:_0x38e18e,tdx:_0x4a9079}=_0x1e1929;let _0x2a3f10='.',_0x2ff8ee=_0x41b0c1['name'];if(_0x38e18e[0x0]){const {promises:_0xd6b5a8}=await import('fs');try{const _0x703d7b=await _0xd6b5a8[_0x38f849(0x122)](_0x38e18e[0x0]);if(_0x703d7b[_0x38f849(0x140)]())_0x2a3f10=_0x38e18e[0x0];else return console['error'](_0x38f849(0x159)+_0x38e18e[0x0]+_0x38f849(0x151)),0x1;}catch{_0x2ff8ee=_0x38e18e[0x0],_0x2a3f10='.';}}const _0x375bc9=_0x41b0c1['revision'],_0x149ed6=_0x41b0c1['skipValidation'];_0x41b0c1['verbose']&&(console[_0x38f849(0x1a9)](_0x38f849(0x125)+_0x2a3f10),_0x2ff8ee&&console['error'](_0x38f849(0x13a)+_0x2ff8ee),_0x375bc9&&console[_0x38f849(0x1a9)]('Revision:\x20'+_0x375bc9),_0x149ed6&&console[_0x38f849(0x1a9)](_0x38f849(0x191)));const _0x2f1123=await withSpinner('Pushing\x20workflow\x20project...',()=>_0x4a9079[_0x38f849(0x15b)][_0x38f849(0x1af)](_0x2a3f10,{'projectName':_0x2ff8ee,'revision':_0x375bc9,'skipValidation':_0x149ed6}),{'verbose':_0x41b0c1['verbose']}),_0x3b7d36=_0x2f1123['data'];return console[_0x38f849(0x1a9)](_0x38f849(0x156)+_0x3b7d36[_0x38f849(0x15d)]),console[_0x38f849(0x1a9)](_0x38f849(0x167)+_0x3b7d36[_0x38f849(0x185)]),console[_0x38f849(0x1a9)](_0x38f849(0x14b)+_0x3b7d36[_0x38f849(0x121)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a37_0x3f2f69(0x10d)]=a37_0x3f2f69(0x193);[a37_0x3f2f69(0x145)]=a37_0x3f2f69(0x178);async[a37_0x3f2f69(0x158)](_0x622dcc){const _0x148c4f=a37_0x3f2f69,{options:_0xc70c2a,args:_0x3bf34f,tdx:_0x5abef0}=_0x622dcc,_0x3cdd64=_0x3bf34f[0x0];if(!_0x3cdd64)return console[_0x148c4f(0x1a9)](_0x148c4f(0x136)),console[_0x148c4f(0x1a9)](_0x148c4f(0x1a0)),0x1;_0xc70c2a[_0x148c4f(0x165)]&&console[_0x148c4f(0x1a9)](_0x148c4f(0x15e)+_0x3cdd64);if(!_0xc70c2a['yes']){const _0x299485=await confirm(_0x148c4f(0x180)+_0x3cdd64+_0x148c4f(0x152));if(!_0x299485)return console[_0x148c4f(0x1a9)](_0x148c4f(0x1a6)),0x0;}const _0x634e1c=await withSpinner('Deleting\x20project\x20'+_0x3cdd64+_0x148c4f(0x18d),()=>_0x5abef0[_0x148c4f(0x15b)][_0x148c4f(0x199)](_0x3cdd64),{'verbose':_0xc70c2a[_0x148c4f(0x165)]}),_0xbfb955=_0x634e1c[_0x148c4f(0x18f)];return console[_0x148c4f(0x1a9)](_0x148c4f(0x1b1)+_0xbfb955[_0x148c4f(0x15d)]),console['error']('\x20\x20Project\x20ID:\x20'+_0xbfb955[_0x148c4f(0x185)]),0x0;}}
package/dist/core/auth.js CHANGED
@@ -1 +1 @@
1
- (function(_0x536b17,_0x4217e1){const _0x36c143=a38_0x40fc,_0x26b741=_0x536b17();while(!![]){try{const _0x31a3e1=-parseInt(_0x36c143(0x180))/0x1*(parseInt(_0x36c143(0x17f))/0x2)+parseInt(_0x36c143(0x17d))/0x3+parseInt(_0x36c143(0x185))/0x4+parseInt(_0x36c143(0x186))/0x5*(-parseInt(_0x36c143(0x17e))/0x6)+-parseInt(_0x36c143(0x183))/0x7*(parseInt(_0x36c143(0x184))/0x8)+parseInt(_0x36c143(0x187))/0x9+-parseInt(_0x36c143(0x18f))/0xa;if(_0x31a3e1===_0x4217e1)break;else _0x26b741['push'](_0x26b741['shift']());}catch(_0x531e63){_0x26b741['push'](_0x26b741['shift']());}}}(a38_0x1f56,0xc3abc));import{platform}from'os';import{readFileSync}from'fs';function a38_0x1f56(){const _0x3e3b10=['248423aXLIrf','328ZSAXce','3890456rWrkLl','4020910LZeTEj','13583709IOPdrX','X-Trino-User','version','length','TD1\x20','0.0.0','Authorization','entries','4277460GABxOJ','3687228ABszBn','6fhmYxg','5116jDQntX','87Ssuklv','../../package.json','tdx/'];a38_0x1f56=function(){return _0x3e3b10;};return a38_0x1f56();}import{fileURLToPath}from'url';import{dirname,join}from'path';import{getAPIKey}from'./config.js';function a38_0x40fc(_0x4ef0fe,_0x24c49a){const _0x1f5632=a38_0x1f56();return a38_0x40fc=function(_0x40fcc0,_0x332e58){_0x40fcc0=_0x40fcc0-0x17d;let _0x3f968f=_0x1f5632[_0x40fcc0];return _0x3f968f;},a38_0x40fc(_0x4ef0fe,_0x24c49a);}export function getVersion(){const _0x54805d=a38_0x40fc;try{const _0x4c08f5=fileURLToPath(import.meta['url']),_0x5e615d=dirname(_0x4c08f5),_0x132a1f=join(_0x5e615d,_0x54805d(0x181)),_0x256481=JSON['parse'](readFileSync(_0x132a1f,'utf-8'));return _0x256481[_0x54805d(0x189)];}catch{return _0x54805d(0x18c);}}export function getUserAgent(){const _0x3cfd25=a38_0x40fc,_0x3862c7=getVersion(),_0x3d3b8b=platform(),_0x141f2a=process[_0x3cfd25(0x189)]['replace']('v','');return _0x3cfd25(0x182)+_0x3862c7+'\x20('+_0x3d3b8b+';\x20node/'+_0x141f2a+')';}export function getAuthHeaders(_0xe34992,_0x31efcb){const _0x148379=a38_0x40fc,_0x47ac4f=getVersion(),_0x169bc0={'User-Agent':getUserAgent(),'X-TD-Client':'tdx','X-TD-Client-Version':_0x47ac4f};return _0x31efcb&&(_0x169bc0[_0x148379(0x18d)]=_0x148379(0x18b)+_0x31efcb),_0x169bc0;}export function toHeaderRecord(_0x59b211){const _0x57b4fa=a38_0x40fc,_0x188b90={};for(const [_0xeb6e1d,_0x1fef40]of Object[_0x57b4fa(0x18e)](_0x59b211)){_0x1fef40!==undefined&&(_0x188b90[_0xeb6e1d]=_0x1fef40);}return _0x188b90;}export function getTrinoHeaders(_0x189f1d,_0x129636){const _0x529275=a38_0x40fc,_0x5fca3e=getAuthHeaders(_0x189f1d,_0x129636),_0x3a16bb=toHeaderRecord(_0x5fca3e);return delete _0x3a16bb[_0x529275(0x18d)],_0x129636&&(_0x3a16bb[_0x529275(0x188)]=_0x129636),_0x3a16bb;}export function hasAPIKey(_0x427eb5){const _0x331136=a38_0x40fc,_0x1443b2=getAPIKey(_0x427eb5);return _0x1443b2!==undefined&&_0x1443b2[_0x331136(0x18a)]>0x0;}
1
+ (function(_0x6ed7a0,_0x59dbe7){const _0x146f21=a38_0x2873,_0x4d8983=_0x6ed7a0();while(!![]){try{const _0x3e5720=parseInt(_0x146f21(0x16f))/0x1*(-parseInt(_0x146f21(0x165))/0x2)+-parseInt(_0x146f21(0x16e))/0x3+parseInt(_0x146f21(0x169))/0x4+-parseInt(_0x146f21(0x168))/0x5+-parseInt(_0x146f21(0x167))/0x6+parseInt(_0x146f21(0x171))/0x7*(-parseInt(_0x146f21(0x175))/0x8)+parseInt(_0x146f21(0x170))/0x9*(parseInt(_0x146f21(0x172))/0xa);if(_0x3e5720===_0x59dbe7)break;else _0x4d8983['push'](_0x4d8983['shift']());}catch(_0x2cbd69){_0x4d8983['push'](_0x4d8983['shift']());}}}(a38_0x1327,0xec4ea));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x59a08=a38_0x2873;try{const _0x3b0783=fileURLToPath(import.meta[_0x59a08(0x166)]),_0x23f7d6=dirname(_0x3b0783),_0x33ad18=join(_0x23f7d6,_0x59a08(0x16c)),_0x5e6893=JSON[_0x59a08(0x179)](readFileSync(_0x33ad18,'utf-8'));return _0x5e6893[_0x59a08(0x174)];}catch{return'0.0.0';}}function a38_0x2873(_0x4fc1e5,_0x2da38d){const _0x13273e=a38_0x1327();return a38_0x2873=function(_0x2873a0,_0x4f9636){_0x2873a0=_0x2873a0-0x165;let _0x360d75=_0x13273e[_0x2873a0];return _0x360d75;},a38_0x2873(_0x4fc1e5,_0x2da38d);}export function getUserAgent(){const _0x326540=a38_0x2873,_0x9a6ca2=getVersion(),_0x49daf9=platform(),_0x36b961=process[_0x326540(0x174)]['replace']('v','');return'tdx/'+_0x9a6ca2+'\x20('+_0x49daf9+_0x326540(0x16a)+_0x36b961+')';}function a38_0x1327(){const _0x2d938e=['1318219IGpRbV','282465tINZpb','7GKnmhx','1690bAykQX','length','version','10701504efccUL','TD1\x20','entries','tdx','parse','2xdDlvB','url','5423694FwkIxn','4693520oyUxjZ','1715180isZtdD',';\x20node/','Authorization','../../package.json','X-Trino-User','799158YEmwhR'];a38_0x1327=function(){return _0x2d938e;};return a38_0x1327();}export function getAuthHeaders(_0x8fd147,_0x77cc5a){const _0x3ae020=a38_0x2873,_0x221926=getVersion(),_0x421bba={'User-Agent':getUserAgent(),'X-TD-Client':_0x3ae020(0x178),'X-TD-Client-Version':_0x221926};return _0x77cc5a&&(_0x421bba[_0x3ae020(0x16b)]=_0x3ae020(0x176)+_0x77cc5a),_0x421bba;}export function toHeaderRecord(_0x34df39){const _0xa2f48=a38_0x2873,_0x50c247={};for(const [_0x3272c0,_0x128f35]of Object[_0xa2f48(0x177)](_0x34df39)){_0x128f35!==undefined&&(_0x50c247[_0x3272c0]=_0x128f35);}return _0x50c247;}export function getTrinoHeaders(_0x128972,_0x4aea8c){const _0x444ee4=a38_0x2873,_0x3db939=getAuthHeaders(_0x128972,_0x4aea8c),_0x55b287=toHeaderRecord(_0x3db939);return delete _0x55b287[_0x444ee4(0x16b)],_0x4aea8c&&(_0x55b287[_0x444ee4(0x16d)]=_0x4aea8c),_0x55b287;}export function hasAPIKey(_0x375c80){const _0x5434c3=a38_0x2873,_0x459aa1=getAPIKey(_0x375c80);return _0x459aa1!==undefined&&_0x459aa1[_0x5434c3(0x173)]>0x0;}
@@ -1 +1 @@
1
- (function(_0x48b1a5,_0x5f14c3){const _0x2c4c77=a39_0x48f5,_0x4f3f6b=_0x48b1a5();while(!![]){try{const _0x49bc3b=parseInt(_0x2c4c77(0x205))/0x1*(-parseInt(_0x2c4c77(0x1f6))/0x2)+parseInt(_0x2c4c77(0x1d4))/0x3*(parseInt(_0x2c4c77(0x1de))/0x4)+parseInt(_0x2c4c77(0x1e3))/0x5*(parseInt(_0x2c4c77(0x1d5))/0x6)+parseInt(_0x2c4c77(0x1f7))/0x7+-parseInt(_0x2c4c77(0x1f1))/0x8+-parseInt(_0x2c4c77(0x1d9))/0x9*(-parseInt(_0x2c4c77(0x1f4))/0xa)+-parseInt(_0x2c4c77(0x1e8))/0xb*(-parseInt(_0x2c4c77(0x1d1))/0xc);if(_0x49bc3b===_0x5f14c3)break;else _0x4f3f6b['push'](_0x4f3f6b['shift']());}catch(_0x37e87a){_0x4f3f6b['push'](_0x4f3f6b['shift']());}}}(a39_0x3101,0x90084));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a39_0x2617aa from'node:fs';import*as a39_0x28cafd from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';function a39_0x48f5(_0x3ff48b,_0x331733){const _0x3101b6=a39_0x3101();return a39_0x48f5=function(_0x48f503,_0x2345de){_0x48f503=_0x48f503-0x1cf;let _0x1144f0=_0x3101b6[_0x48f503];return _0x1144f0;},a39_0x48f5(_0x3ff48b,_0x331733);}import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a39_0x548bff from'chalk';export function getConfigDir(){const _0x4892a7=a39_0x48f5;return process[_0x4892a7(0x1fe)][_0x4892a7(0x1f9)]||join(homedir(),'.config',_0x4892a7(0x1e4));}export function getConfigFile(){const _0x5d37b6=a39_0x48f5;return join(getConfigDir(),_0x5d37b6(0x1fb));}export function getConfigFilePath(_0x2f7424){const _0x1699f9=getConfigDir();return _0x2f7424?a39_0x28cafd['join'](_0x1699f9,'.env.'+_0x2f7424):getConfigFile();}export function getCacheDir(){const _0x5ccc7d=a39_0x48f5;return process[_0x5ccc7d(0x1fe)][_0x5ccc7d(0x1f2)]||join(homedir(),_0x5ccc7d(0x1eb),_0x5ccc7d(0x1e4));}export function getLLMProjectCacheFile(){const _0x20ae27=a39_0x48f5;return join(getCacheDir(),_0x20ae27(0x201));}export function readCachedLLMProject(){const _0xc87b2f=a39_0x48f5;try{const _0x4878ca=getLLMProjectCacheFile();if(!existsSync(_0x4878ca))return null;return readFileSync(_0x4878ca,_0xc87b2f(0x1ee))[_0xc87b2f(0x1e1)]();}catch{return null;}}export function writeCachedLLMProject(_0x16a6de){const _0x38b240=a39_0x48f5;try{const _0x19fcea=getCacheDir(),_0x5de3d1=getLLMProjectCacheFile();!existsSync(_0x19fcea)&&mkdirSync(_0x19fcea,{'recursive':!![]}),writeFileSync(_0x5de3d1,_0x16a6de,_0x38b240(0x1ee));}catch(_0x28b8ad){console[_0x38b240(0x1dc)]('Warning:\x20Failed\x20to\x20cache\x20LLM\x20project\x20name:',_0x28b8ad);}}export function parseEnvFile(_0x29a1c4){const _0x1e9d47=a39_0x48f5,_0x55a58c={};for(const _0x40e3e of _0x29a1c4[_0x1e9d47(0x1e5)]('\x0a')){const _0x3e7701=_0x40e3e[_0x1e9d47(0x1e1)]();if(!_0x3e7701||_0x3e7701[_0x1e9d47(0x1da)]('#'))continue;const _0x57c2b5=_0x3e7701['match'](/^([^=]+)=(.*)$/);if(_0x57c2b5){const _0x391f7a=_0x57c2b5[0x1][_0x1e9d47(0x1e1)]();let _0x472d79=_0x57c2b5[0x2][_0x1e9d47(0x1e1)]();(_0x472d79[_0x1e9d47(0x1da)]('\x22')&&_0x472d79[_0x1e9d47(0x20d)]('\x22')||_0x472d79[_0x1e9d47(0x1da)]('\x27')&&_0x472d79[_0x1e9d47(0x20d)]('\x27'))&&(_0x472d79=_0x472d79['slice'](0x1,-0x1)),_0x55a58c[_0x391f7a]=_0x472d79;}}return _0x55a58c;}export function readUserConfig(){const _0x354ef8=a39_0x48f5,_0x58de93=getConfigFile();if(!existsSync(_0x58de93))return{};try{const _0x1e28a3=readFileSync(_0x58de93,_0x354ef8(0x1ee));return parseEnvFile(_0x1e28a3);}catch(_0xf925a1){return console[_0x354ef8(0x1d0)](_0x354ef8(0x1e7)+_0x58de93+':',_0xf925a1),{};}}export function resolveSite(_0x43bfc7){const _0x412bb1=a39_0x48f5,_0x3b6ccc=['us01',_0x412bb1(0x1fa),_0x412bb1(0x1f0),'ap02',_0x412bb1(0x208),_0x412bb1(0x1dd),_0x412bb1(0x202),'stg-us01',_0x412bb1(0x1fc),_0x412bb1(0x20f)];if(_0x3b6ccc[_0x412bb1(0x1d7)](_0x43bfc7))return _0x43bfc7;if(_0x43bfc7 in SITE_ALIASES)return SITE_ALIASES[_0x43bfc7];return console[_0x412bb1(0x1d0)](_0x412bb1(0x1ea)+_0x43bfc7+_0x412bb1(0x1f8)),'us01';}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x542a23,_0x2d49e1){const _0x5d607=a39_0x48f5,_0xca2a52=_0x542a23['toUpperCase']()[_0x5d607(0x1d2)](/-/g,'_'),_0x395cf1=_0x5d607(0x1df)+_0xca2a52;if(process[_0x5d607(0x1fe)][_0x395cf1])return process[_0x5d607(0x1fe)][_0x395cf1];if(process[_0x5d607(0x1fe)][_0x5d607(0x1cf)])return process[_0x5d607(0x1fe)][_0x5d607(0x1cf)];const _0x4de2b8=_0x2d49e1||getActiveProfileName();if(_0x4de2b8){const _0x240b88=loadProfileEnv(_0x4de2b8);if(_0x240b88){if(_0x240b88[_0x395cf1])return _0x240b88[_0x395cf1];if(_0x240b88[_0x5d607(0x1cf)])return _0x240b88[_0x5d607(0x1cf)];}}const _0x1fe5b1=loadUserConfigOnce();if(_0x1fe5b1[_0x395cf1])return _0x1fe5b1[_0x395cf1];if(_0x1fe5b1[_0x5d607(0x1cf)])return _0x1fe5b1[_0x5d607(0x1cf)];return undefined;}export async function getAPIKeyAsync(_0x430afe,_0x256461){const _0x1e22f7=a39_0x48f5,_0x408627=_0x430afe['toUpperCase']()[_0x1e22f7(0x1d2)](/-/g,'_'),_0x2f57e1=_0x1e22f7(0x1df)+_0x408627;if(process[_0x1e22f7(0x1fe)][_0x2f57e1])return process[_0x1e22f7(0x1fe)][_0x2f57e1];if(process[_0x1e22f7(0x1fe)][_0x1e22f7(0x1cf)])return process[_0x1e22f7(0x1fe)][_0x1e22f7(0x1cf)];const _0x3b1739=_0x256461||getActiveProfileName()||undefined,_0x16e7b8=getCachedCredential(_0x430afe,_0x3b1739);if(_0x16e7b8)return _0x16e7b8;const _0x47939c=await getKeychainAPIKey(_0x3b1739);if(_0x47939c)return setCachedCredential(_0x47939c,_0x430afe,_0x3b1739),_0x47939c;const _0x1e3718=getLegacyEnvAPIKey(_0x430afe,_0x3b1739);if(_0x1e3718){const _0x3aa87b=await isKeychainAvailable();if(_0x3aa87b)try{await saveKeychainAPIKey(_0x1e3718,_0x3b1739),setCachedCredential(_0x1e3718,_0x430afe,_0x3b1739);const _0x191145=getConfigFilePath(_0x3b1739);cleanupLegacyEnvFile(_0x191145)&&console[_0x1e22f7(0x1d0)](a39_0x548bff[_0x1e22f7(0x1fd)](_0x1e22f7(0x1db)));}catch(_0x3dc1ab){console[_0x1e22f7(0x1d0)](a39_0x548bff[_0x1e22f7(0x1fd)](_0x1e22f7(0x206)+_0x3dc1ab));}return _0x1e3718;}return undefined;}function getLegacyEnvAPIKey(_0x28c1e2,_0x3fa950){const _0x37e9e0=a39_0x48f5,_0x2dc9b5=_0x28c1e2[_0x37e9e0(0x1ec)]()['replace'](/-/g,'_'),_0x21d94e=_0x37e9e0(0x1df)+_0x2dc9b5;if(_0x3fa950){const _0x3f61db=loadProfileEnv(_0x3fa950);if(_0x3f61db){if(_0x3f61db[_0x21d94e])return _0x3f61db[_0x21d94e];if(_0x3f61db['TD_API_KEY'])return _0x3f61db[_0x37e9e0(0x1cf)];}}const _0x13c409=loadUserConfigOnce();if(_0x13c409[_0x21d94e])return _0x13c409[_0x21d94e];if(_0x13c409['TD_API_KEY'])return _0x13c409[_0x37e9e0(0x1cf)];return undefined;}function a39_0x3101(){const _0x184e44=['yellow','env','filter','stg-us01','llm_default_project','dev-eu01','profile:\x20','\x20(TD_API_KEY)','9557euRETB','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','ap02','ap03','global:\x20','profile','some','parse','endsWith','profiles','stg-ap03','TD_API_KEY','warn','12jsMHrA','replace','.env.','1135263jtNyfq','1812xbTFOT','existsSync','includes','Warning:\x20Failed\x20to\x20load\x20','585ozXdRf','startsWith','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','error','dev-us01','4dQcUOf','TD_API_KEY_','env:\x20TD_API_KEY','trim','map','2910FpsgHb','tdx','split','env:\x20','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','2047133WUunPi','join','Warning:\x20Unknown\x20site\x20\x27','.cache','toUpperCase','us01','utf-8','apiKeys','eu01','9099872RDNwnv','TDX_CACHE_DIR','readFileSync','62470fBfkLT','Warning:\x20Failed\x20to\x20read\x20','50iTWRxn','5740154jhsEoR','\x27,\x20defaulting\x20to\x20us01','TDX_CONFIG_DIR','jp01','.env','stg-jp01'];a39_0x3101=function(){return _0x184e44;};return a39_0x3101();}function cleanupLegacyEnvFile(_0x513ad9){const _0x59ed27=a39_0x48f5;if(!existsSync(_0x513ad9))return![];try{const _0x507be6=readFileSync(_0x513ad9,'utf-8'),_0x4ed6e6=_0x507be6['split']('\x0a'),_0x51d88b=_0x4ed6e6[_0x59ed27(0x1ff)](_0x2730b9=>{const _0x20932f=_0x59ed27,_0x11989b=_0x2730b9[_0x20932f(0x1e1)]();if(!_0x11989b||_0x11989b[_0x20932f(0x1da)]('#'))return!![];const [_0x51d141]=_0x11989b['split']('=');return!_0x51d141[_0x20932f(0x1da)]('TD_API_KEY');}),_0x2167f0=_0x51d88b[_0x59ed27(0x20b)](_0x3a98b5=>{const _0x37eefc=_0x59ed27,_0x57a6df=_0x3a98b5[_0x37eefc(0x1e1)]();return _0x57a6df&&!_0x57a6df[_0x37eefc(0x1da)]('#');});if(!_0x2167f0)return unlinkSync(_0x513ad9),!![];return writeFileSync(_0x513ad9,_0x51d88b[_0x59ed27(0x1e9)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}export function getAPIKeySource(_0x12e47a,_0x53830a){const _0x275d9b=a39_0x48f5,_0x5cfb9b='TD_API_KEY_'+_0x12e47a['toUpperCase']()[_0x275d9b(0x1d2)](/-/g,'_');if(process[_0x275d9b(0x1fe)][_0x5cfb9b])return _0x275d9b(0x1e6)+_0x5cfb9b;if(process[_0x275d9b(0x1fe)]['TD_API_KEY'])return _0x275d9b(0x1e0);const _0x5f370f=_0x53830a||getActiveProfileName();if(_0x5f370f){const _0x1cba31=loadProfileEnv(_0x5f370f);if(_0x1cba31){if(_0x1cba31[_0x5cfb9b])return _0x275d9b(0x203)+_0x5f370f+'\x20('+_0x5cfb9b+')';if(_0x1cba31[_0x275d9b(0x1cf)])return'profile:\x20'+_0x5f370f+_0x275d9b(0x204);}}const _0x472919=loadUserConfigOnce(),_0x57b758=getConfigFile();if(_0x472919[_0x5cfb9b])return _0x275d9b(0x209)+_0x57b758+'\x20('+_0x5cfb9b+')';if(_0x472919[_0x275d9b(0x1cf)])return _0x275d9b(0x209)+_0x57b758+_0x275d9b(0x204);return null;}function loadProfileEnv(_0x49137e){const _0x6ff2a9=a39_0x48f5,_0x27e4c0=a39_0x28cafd[_0x6ff2a9(0x1e9)](getConfigDir(),_0x6ff2a9(0x1d3)+_0x49137e);if(a39_0x2617aa['existsSync'](_0x27e4c0)){validateSecureFilePermissions(_0x27e4c0);try{const _0x1d7dd2=a39_0x2617aa[_0x6ff2a9(0x1f3)](_0x27e4c0,_0x6ff2a9(0x1ee));return parseEnvFile(_0x1d7dd2);}catch(_0x73caf){console[_0x6ff2a9(0x1d0)](_0x6ff2a9(0x1d8)+_0x27e4c0+':\x20'+_0x73caf);}}const _0x403dda=a39_0x28cafd[_0x6ff2a9(0x1e9)](getConfigDir(),_0x6ff2a9(0x20e),_0x49137e,_0x6ff2a9(0x1fb));if(a39_0x2617aa[_0x6ff2a9(0x1d6)](_0x403dda)){validateSecureFilePermissions(_0x403dda);try{const _0x5e7ac9=a39_0x2617aa[_0x6ff2a9(0x1f3)](_0x403dda,_0x6ff2a9(0x1ee));return parseEnvFile(_0x5e7ac9);}catch(_0x600311){return console[_0x6ff2a9(0x1d0)](_0x6ff2a9(0x1d8)+_0x403dda+':\x20'+_0x600311),null;}}return null;}function getActiveProfileName(){const _0x1e2671=a39_0x48f5,_0x4983a7=a39_0x28cafd[_0x1e2671(0x1e9)](getConfigDir(),'tdx.json');if(!a39_0x2617aa[_0x1e2671(0x1d6)](_0x4983a7))return null;try{const _0x323ec1=a39_0x2617aa[_0x1e2671(0x1f3)](_0x4983a7,_0x1e2671(0x1ee)),_0x4ce806=JSON[_0x1e2671(0x20c)](_0x323ec1);return _0x4ce806[_0x1e2671(0x20a)]||null;}catch{return null;}}export function saveAPIKey(_0x448d86,_0x2bd28a,_0x1e9701){const _0x4ac019=a39_0x48f5,_0x28e821=getConfigDir(),_0x5c3c78=getConfigFilePath(_0x1e9701);!existsSync(_0x28e821)&&mkdirSync(_0x28e821,{'recursive':!![],'mode':0x1c0});let _0x48550a={};if(existsSync(_0x5c3c78))try{const _0x9b791e=readFileSync(_0x5c3c78,_0x4ac019(0x1ee));_0x48550a=parseEnvFile(_0x9b791e);}catch(_0x5cd683){console['warn'](_0x4ac019(0x1f5)+_0x5c3c78+':',_0x5cd683);}const _0x24adba=_0x448d86[_0x4ac019(0x1ec)]()[_0x4ac019(0x1d2)](/-/g,'_');_0x48550a[_0x4ac019(0x1df)+_0x24adba]=_0x2bd28a;const _0x4803a1=Object['entries'](_0x48550a)[_0x4ac019(0x1e2)](([_0x276976,_0x536ea0])=>_0x276976+'='+_0x536ea0);writeFileSync(_0x5c3c78,_0x4803a1['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x4c60ad,_0x4f518e,_0x1ad57c){const _0x561bab=a39_0x48f5;await saveKeychainAPIKey(_0x4c60ad,_0x1ad57c),setCachedCredential(_0x4c60ad,_0x4f518e,_0x1ad57c);const _0x316b82=getConfigFilePath(_0x1ad57c);cleanupLegacyEnvFile(_0x316b82)&&console[_0x561bab(0x1d0)](a39_0x548bff['yellow']('⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file'));}export function loadConfig(){const _0x311c10=a39_0x48f5,_0x40983a={'apiKeys':{},'defaultSite':_0x311c10(0x1ed)},_0x46c83c=[_0x311c10(0x1ed),_0x311c10(0x1fa),_0x311c10(0x1f0),_0x311c10(0x207),_0x311c10(0x208),_0x311c10(0x1dd),'dev-eu01',_0x311c10(0x200),_0x311c10(0x1fc),_0x311c10(0x20f)];for(const _0x2f9d5c of _0x46c83c){const _0x89520c=getAPIKey(_0x2f9d5c);_0x89520c&&(_0x40983a[_0x311c10(0x1ef)][_0x2f9d5c]=_0x89520c);}return _0x40983a;}
1
+ (function(_0x49579c,_0x37f084){const _0x1a6e75=a39_0x22d7,_0x4d1ab8=_0x49579c();while(!![]){try{const _0x1abb03=-parseInt(_0x1a6e75(0xf8))/0x1*(parseInt(_0x1a6e75(0x10d))/0x2)+-parseInt(_0x1a6e75(0x100))/0x3+-parseInt(_0x1a6e75(0x127))/0x4*(-parseInt(_0x1a6e75(0x106))/0x5)+-parseInt(_0x1a6e75(0x119))/0x6+-parseInt(_0x1a6e75(0x121))/0x7+-parseInt(_0x1a6e75(0x12e))/0x8*(-parseInt(_0x1a6e75(0xf9))/0x9)+parseInt(_0x1a6e75(0x118))/0xa;if(_0x1abb03===_0x37f084)break;else _0x4d1ab8['push'](_0x4d1ab8['shift']());}catch(_0xb027da){_0x4d1ab8['push'](_0x4d1ab8['shift']());}}}(a39_0x16ca,0x552ff));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a39_0x524a80 from'node:fs';import*as a39_0x52045e 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 a39_0x22d7(_0x568439,_0x2cce7d){const _0x16caa4=a39_0x16ca();return a39_0x22d7=function(_0x22d7dd,_0x5e8629){_0x22d7dd=_0x22d7dd-0xf7;let _0x3e1ff3=_0x16caa4[_0x22d7dd];return _0x3e1ff3;},a39_0x22d7(_0x568439,_0x2cce7d);}import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a39_0x367df1 from'chalk';export function getConfigDir(){const _0x35a47f=a39_0x22d7;return process[_0x35a47f(0x135)][_0x35a47f(0x101)]||join(homedir(),'.config','tdx');}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getConfigFilePath(_0x1e20c9){const _0x46fde2=a39_0x22d7,_0x1e089b=getConfigDir();return _0x1e20c9?a39_0x52045e[_0x46fde2(0x103)](_0x1e089b,_0x46fde2(0xfe)+_0x1e20c9):getConfigFile();}export function getCacheDir(){const _0x42d0eb=a39_0x22d7;return process['env'][_0x42d0eb(0x12d)]||join(homedir(),_0x42d0eb(0xff),_0x42d0eb(0x113));}export function getLLMProjectCacheFile(){const _0x5e60ec=a39_0x22d7;return join(getCacheDir(),_0x5e60ec(0x123));}export function readCachedLLMProject(){const _0x2a6163=a39_0x22d7;try{const _0xb5b09d=getLLMProjectCacheFile();if(!existsSync(_0xb5b09d))return null;return readFileSync(_0xb5b09d,_0x2a6163(0x12f))[_0x2a6163(0xfd)]();}catch{return null;}}export function writeCachedLLMProject(_0x2e358b){const _0x4eda57=a39_0x22d7;try{const _0x558dc2=getCacheDir(),_0x207c4=getLLMProjectCacheFile();!existsSync(_0x558dc2)&&mkdirSync(_0x558dc2,{'recursive':!![]}),writeFileSync(_0x207c4,_0x2e358b,'utf-8');}catch(_0x5b49cf){console[_0x4eda57(0x133)]('Warning:\x20Failed\x20to\x20cache\x20LLM\x20project\x20name:',_0x5b49cf);}}export function parseEnvFile(_0x3ea1ce){const _0x3d0fd=a39_0x22d7,_0x58bb0f={};for(const _0x4e85de of _0x3ea1ce[_0x3d0fd(0x114)]('\x0a')){const _0x4b2d89=_0x4e85de[_0x3d0fd(0xfd)]();if(!_0x4b2d89||_0x4b2d89['startsWith']('#'))continue;const _0x30d698=_0x4b2d89[_0x3d0fd(0xfc)](/^([^=]+)=(.*)$/);if(_0x30d698){const _0x171558=_0x30d698[0x1][_0x3d0fd(0xfd)]();let _0x47b661=_0x30d698[0x2][_0x3d0fd(0xfd)]();(_0x47b661['startsWith']('\x22')&&_0x47b661['endsWith']('\x22')||_0x47b661[_0x3d0fd(0x126)]('\x27')&&_0x47b661[_0x3d0fd(0x11f)]('\x27'))&&(_0x47b661=_0x47b661[_0x3d0fd(0x104)](0x1,-0x1)),_0x58bb0f[_0x171558]=_0x47b661;}}return _0x58bb0f;}export function readUserConfig(){const _0x208a2d=a39_0x22d7,_0x26147c=getConfigFile();if(!existsSync(_0x26147c))return{};try{const _0xe0d487=readFileSync(_0x26147c,_0x208a2d(0x12f));return parseEnvFile(_0xe0d487);}catch(_0x3e155b){return console[_0x208a2d(0x124)](_0x208a2d(0x132)+_0x26147c+':',_0x3e155b),{};}}export function resolveSite(_0x521db2){const _0x560353=a39_0x22d7,_0x28137f=[_0x560353(0xf7),_0x560353(0x130),_0x560353(0x108),'ap02',_0x560353(0x10c),_0x560353(0x117),_0x560353(0x11d),_0x560353(0x122),_0x560353(0x11b),_0x560353(0x102)];if(_0x28137f[_0x560353(0x10f)](_0x521db2))return _0x521db2;if(_0x521db2 in SITE_ALIASES)return SITE_ALIASES[_0x521db2];return console[_0x560353(0x124)](_0x560353(0x11c)+_0x521db2+_0x560353(0x109)),_0x560353(0xf7);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x5ee099,_0x5e389c){const _0x550046=a39_0x22d7,_0x5a4249=_0x5ee099[_0x550046(0x112)]()[_0x550046(0x107)](/-/g,'_'),_0xf681aa=_0x550046(0x111)+_0x5a4249;if(process['env'][_0xf681aa])return process[_0x550046(0x135)][_0xf681aa];if(process[_0x550046(0x135)][_0x550046(0x12a)])return process[_0x550046(0x135)][_0x550046(0x12a)];const _0x2224d9=_0x5e389c||getActiveProfileName();if(_0x2224d9){const _0x38110f=loadProfileEnv(_0x2224d9);if(_0x38110f){if(_0x38110f[_0xf681aa])return _0x38110f[_0xf681aa];if(_0x38110f[_0x550046(0x12a)])return _0x38110f[_0x550046(0x12a)];}}const _0x4966ab=loadUserConfigOnce();if(_0x4966ab[_0xf681aa])return _0x4966ab[_0xf681aa];if(_0x4966ab[_0x550046(0x12a)])return _0x4966ab['TD_API_KEY'];return undefined;}export async function getAPIKeyAsync(_0x21413d,_0x4435ad){const _0x17e6c8=a39_0x22d7,_0x2fef33=_0x21413d[_0x17e6c8(0x112)]()[_0x17e6c8(0x107)](/-/g,'_'),_0x1f81a2=_0x17e6c8(0x111)+_0x2fef33;if(process['env'][_0x1f81a2])return process['env'][_0x1f81a2];if(process[_0x17e6c8(0x135)][_0x17e6c8(0x12a)])return process[_0x17e6c8(0x135)]['TD_API_KEY'];const _0x56df15=_0x4435ad||getActiveProfileName()||undefined,_0xe6a1e0=getCachedCredential(_0x21413d,_0x56df15);if(_0xe6a1e0)return _0xe6a1e0;const _0x1e984a=await getKeychainAPIKey(_0x56df15);if(_0x1e984a)return setCachedCredential(_0x1e984a,_0x21413d,_0x56df15),_0x1e984a;const _0x5cb4ea=getLegacyEnvAPIKey(_0x21413d,_0x56df15);if(_0x5cb4ea){const _0x388133=await isKeychainAvailable();if(_0x388133)try{await saveKeychainAPIKey(_0x5cb4ea,_0x56df15),setCachedCredential(_0x5cb4ea,_0x21413d,_0x56df15);const _0x566faf=getConfigFilePath(_0x56df15);cleanupLegacyEnvFile(_0x566faf)&&console['warn'](a39_0x367df1[_0x17e6c8(0x136)](_0x17e6c8(0x10e)));}catch(_0x5a30a4){console[_0x17e6c8(0x124)](a39_0x367df1[_0x17e6c8(0x136)](_0x17e6c8(0x125)+_0x5a30a4));}return _0x5cb4ea;}return undefined;}function getLegacyEnvAPIKey(_0xfb542c,_0x125640){const _0x3078f7=a39_0x22d7,_0x3cbc4c=_0xfb542c[_0x3078f7(0x112)]()[_0x3078f7(0x107)](/-/g,'_'),_0xccf33d=_0x3078f7(0x111)+_0x3cbc4c;if(_0x125640){const _0x167fa7=loadProfileEnv(_0x125640);if(_0x167fa7){if(_0x167fa7[_0xccf33d])return _0x167fa7[_0xccf33d];if(_0x167fa7[_0x3078f7(0x12a)])return _0x167fa7['TD_API_KEY'];}}const _0x401e85=loadUserConfigOnce();if(_0x401e85[_0xccf33d])return _0x401e85[_0xccf33d];if(_0x401e85[_0x3078f7(0x12a)])return _0x401e85['TD_API_KEY'];return undefined;}function a39_0x16ca(){const _0x192548=['3009090EeOFTD','filter','stg-jp01','Warning:\x20Unknown\x20site\x20\x27','dev-eu01','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','endsWith','existsSync','1219295vWRjhV','stg-us01','llm_default_project','warn','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','startsWith','61192Eumkvq','entries','Warning:\x20Failed\x20to\x20load\x20','TD_API_KEY','Warning:\x20Failed\x20to\x20read\x20','env:\x20TD_API_KEY','TDX_CACHE_DIR','63856LlStOO','utf-8','jp01','ap02','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','error','profile:\x20','env','yellow','us01','7TAbqUR','9FYGKvi','profile','tdx.json','match','trim','.env.','.cache','1982517vchaxY','TDX_CONFIG_DIR','stg-ap03','join','slice','\x20(TD_API_KEY)','90wkOJRL','replace','eu01','\x27,\x20defaulting\x20to\x20us01','some','global:\x20','ap03','181810zPtAHM','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','includes','parse','TD_API_KEY_','toUpperCase','tdx','split','readFileSync','map','dev-us01','20384550ENJkXp'];a39_0x16ca=function(){return _0x192548;};return a39_0x16ca();}function cleanupLegacyEnvFile(_0x54a077){const _0x3b2279=a39_0x22d7;if(!existsSync(_0x54a077))return![];try{const _0x4e0fda=readFileSync(_0x54a077,_0x3b2279(0x12f)),_0x13ed71=_0x4e0fda[_0x3b2279(0x114)]('\x0a'),_0x4dc614=_0x13ed71[_0x3b2279(0x11a)](_0x4855f7=>{const _0x8d27e4=_0x3b2279,_0x6bba0b=_0x4855f7['trim']();if(!_0x6bba0b||_0x6bba0b['startsWith']('#'))return!![];const [_0x52503f]=_0x6bba0b['split']('=');return!_0x52503f[_0x8d27e4(0x126)](_0x8d27e4(0x12a));}),_0x254ec1=_0x4dc614[_0x3b2279(0x10a)](_0x1c665a=>{const _0x5cb833=_0x3b2279,_0x456030=_0x1c665a[_0x5cb833(0xfd)]();return _0x456030&&!_0x456030[_0x5cb833(0x126)]('#');});if(!_0x254ec1)return unlinkSync(_0x54a077),!![];return writeFileSync(_0x54a077,_0x4dc614[_0x3b2279(0x103)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}export function getAPIKeySource(_0x3b6724,_0x2c9bbd){const _0x5c1ae5=a39_0x22d7,_0x4d95e5='TD_API_KEY_'+_0x3b6724[_0x5c1ae5(0x112)]()['replace'](/-/g,'_');if(process[_0x5c1ae5(0x135)][_0x4d95e5])return'env:\x20'+_0x4d95e5;if(process[_0x5c1ae5(0x135)][_0x5c1ae5(0x12a)])return _0x5c1ae5(0x12c);const _0xfed232=_0x2c9bbd||getActiveProfileName();if(_0xfed232){const _0x447346=loadProfileEnv(_0xfed232);if(_0x447346){if(_0x447346[_0x4d95e5])return'profile:\x20'+_0xfed232+'\x20('+_0x4d95e5+')';if(_0x447346[_0x5c1ae5(0x12a)])return _0x5c1ae5(0x134)+_0xfed232+_0x5c1ae5(0x105);}}const _0x1d136a=loadUserConfigOnce(),_0x21a289=getConfigFile();if(_0x1d136a[_0x4d95e5])return _0x5c1ae5(0x10b)+_0x21a289+'\x20('+_0x4d95e5+')';if(_0x1d136a['TD_API_KEY'])return _0x5c1ae5(0x10b)+_0x21a289+_0x5c1ae5(0x105);return null;}function loadProfileEnv(_0x1a50f4){const _0x585acb=a39_0x22d7,_0x3a2066=a39_0x52045e[_0x585acb(0x103)](getConfigDir(),_0x585acb(0xfe)+_0x1a50f4);if(a39_0x524a80[_0x585acb(0x120)](_0x3a2066)){validateSecureFilePermissions(_0x3a2066);try{const _0x591ed2=a39_0x524a80[_0x585acb(0x115)](_0x3a2066,_0x585acb(0x12f));return parseEnvFile(_0x591ed2);}catch(_0x9564ad){console['warn'](_0x585acb(0x129)+_0x3a2066+':\x20'+_0x9564ad);}}const _0x58a809=a39_0x52045e[_0x585acb(0x103)](getConfigDir(),'profiles',_0x1a50f4,'.env');if(a39_0x524a80[_0x585acb(0x120)](_0x58a809)){validateSecureFilePermissions(_0x58a809);try{const _0x1d9d17=a39_0x524a80['readFileSync'](_0x58a809,'utf-8');return parseEnvFile(_0x1d9d17);}catch(_0x4d572a){return console[_0x585acb(0x124)](_0x585acb(0x129)+_0x58a809+':\x20'+_0x4d572a),null;}}return null;}function getActiveProfileName(){const _0x218b4a=a39_0x22d7,_0x4d3094=a39_0x52045e['join'](getConfigDir(),_0x218b4a(0xfb));if(!a39_0x524a80[_0x218b4a(0x120)](_0x4d3094))return null;try{const _0x4d6665=a39_0x524a80[_0x218b4a(0x115)](_0x4d3094,_0x218b4a(0x12f)),_0x171e8f=JSON[_0x218b4a(0x110)](_0x4d6665);return _0x171e8f[_0x218b4a(0xfa)]||null;}catch{return null;}}export function saveAPIKey(_0x291c84,_0x67dbb2,_0xcdd966){const _0x85a90b=a39_0x22d7,_0x333e0d=getConfigDir(),_0xbbf209=getConfigFilePath(_0xcdd966);!existsSync(_0x333e0d)&&mkdirSync(_0x333e0d,{'recursive':!![],'mode':0x1c0});let _0x4aee0f={};if(existsSync(_0xbbf209))try{const _0x51e6f3=readFileSync(_0xbbf209,'utf-8');_0x4aee0f=parseEnvFile(_0x51e6f3);}catch(_0x1f9401){console['warn'](_0x85a90b(0x12b)+_0xbbf209+':',_0x1f9401);}const _0x51b3de=_0x291c84[_0x85a90b(0x112)]()['replace'](/-/g,'_');_0x4aee0f['TD_API_KEY_'+_0x51b3de]=_0x67dbb2;const _0x4d119f=Object[_0x85a90b(0x128)](_0x4aee0f)[_0x85a90b(0x116)](([_0x35ac3b,_0x4fc0f5])=>_0x35ac3b+'='+_0x4fc0f5);writeFileSync(_0xbbf209,_0x4d119f[_0x85a90b(0x103)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x2d76a3,_0x2e40e0,_0x508237){const _0x3e328f=a39_0x22d7;await saveKeychainAPIKey(_0x2d76a3,_0x508237),setCachedCredential(_0x2d76a3,_0x2e40e0,_0x508237);const _0x4caca1=getConfigFilePath(_0x508237);cleanupLegacyEnvFile(_0x4caca1)&&console[_0x3e328f(0x124)](a39_0x367df1['yellow'](_0x3e328f(0x11e)));}export function loadConfig(){const _0x4f824c=a39_0x22d7,_0x5b32a7={'apiKeys':{},'defaultSite':'us01'},_0x1e8daf=[_0x4f824c(0xf7),_0x4f824c(0x130),_0x4f824c(0x108),_0x4f824c(0x131),_0x4f824c(0x10c),_0x4f824c(0x117),_0x4f824c(0x11d),'stg-us01',_0x4f824c(0x11b),_0x4f824c(0x102)];for(const _0x4e1d9f of _0x1e8daf){const _0x1ef660=getAPIKey(_0x4e1d9f);_0x1ef660&&(_0x5b32a7['apiKeys'][_0x4e1d9f]=_0x1ef660);}return _0x5b32a7;}
@@ -1 +1 @@
1
- (function(_0x5aa8e8,_0x55f26a){const _0x13cf3a=a40_0x2276,_0x40706a=_0x5aa8e8();while(!![]){try{const _0x212bd9=-parseInt(_0x13cf3a(0x1ca))/0x1+parseInt(_0x13cf3a(0x1cf))/0x2*(-parseInt(_0x13cf3a(0x1cd))/0x3)+-parseInt(_0x13cf3a(0x1cc))/0x4*(parseInt(_0x13cf3a(0x1d3))/0x5)+parseInt(_0x13cf3a(0x1c7))/0x6*(parseInt(_0x13cf3a(0x1d0))/0x7)+-parseInt(_0x13cf3a(0x1c6))/0x8+parseInt(_0x13cf3a(0x1cb))/0x9*(parseInt(_0x13cf3a(0x1c5))/0xa)+-parseInt(_0x13cf3a(0x1d2))/0xb*(-parseInt(_0x13cf3a(0x1c9))/0xc);if(_0x212bd9===_0x55f26a)break;else _0x40706a['push'](_0x40706a['shift']());}catch(_0x358d8a){_0x40706a['push'](_0x40706a['shift']());}}}(a40_0x5e44,0x504c0));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x46303e,_0x49b518){const _0x28697d=a40_0x2276,_0x18d6e6=_0x46303e||_0x28697d(0x1c8),_0xaaa079=_0x49b518||_0x28697d(0x1ce);return _0x18d6e6+':'+_0xaaa079;}export function getCachedCredential(_0x31a525,_0x1e4bdb){const _0x1d3230=a40_0x2276,_0x4de19d=getCacheKey(_0x31a525,_0x1e4bdb),_0x339884=cache['get'](_0x4de19d);if(!_0x339884)return null;if(Date[_0x1d3230(0x1c3)]()-_0x339884[_0x1d3230(0x1c0)]>CACHE_TTL_MS)return cache[_0x1d3230(0x1c2)](_0x4de19d),null;return _0x339884[_0x1d3230(0x1c1)];}function a40_0x5e44(){const _0x57749f=['delete','now','clear','250XphKew','4872128nOunSZ','234NYfKSv','__default_site__','432jYGGBB','70026OBMFUt','53550sFkOpj','32rwkOig','687mchHSL','__default_profile__','1802wyOznJ','82397UsdzZX','set','286154XTjILZ','206285CKlQyH','loadedAt','apiKey'];a40_0x5e44=function(){return _0x57749f;};return a40_0x5e44();}export function setCachedCredential(_0x54acdd,_0x3e5874,_0x1371ed){const _0x4a57e1=a40_0x2276,_0x3fa427=getCacheKey(_0x3e5874,_0x1371ed);cache[_0x4a57e1(0x1d1)](_0x3fa427,{'apiKey':_0x54acdd,'loadedAt':Date[_0x4a57e1(0x1c3)]()});}export function clearCredentialCache(){const _0x2023a7=a40_0x2276;cache[_0x2023a7(0x1c4)]();}function a40_0x2276(_0x9d31b7,_0x4bb7e8){const _0x5e4472=a40_0x5e44();return a40_0x2276=function(_0x227664,_0x273a90){_0x227664=_0x227664-0x1c0;let _0x249d66=_0x5e4472[_0x227664];return _0x249d66;},a40_0x2276(_0x9d31b7,_0x4bb7e8);}export function clearCachedCredential(_0x2ba4fb,_0x350d58){const _0x5389b5=a40_0x2276,_0x1763ee=getCacheKey(_0x2ba4fb,_0x350d58);cache[_0x5389b5(0x1c2)](_0x1763ee);}
1
+ (function(_0xea7dda,_0x316fb4){const _0x198758=a40_0x3725,_0x5f59bb=_0xea7dda();while(!![]){try{const _0x33e0c2=-parseInt(_0x198758(0x1b5))/0x1*(-parseInt(_0x198758(0x1b7))/0x2)+parseInt(_0x198758(0x1ab))/0x3+-parseInt(_0x198758(0x1ad))/0x4+parseInt(_0x198758(0x1b0))/0x5*(-parseInt(_0x198758(0x1b3))/0x6)+-parseInt(_0x198758(0x1ac))/0x7+-parseInt(_0x198758(0x1b8))/0x8+parseInt(_0x198758(0x1af))/0x9;if(_0x33e0c2===_0x316fb4)break;else _0x5f59bb['push'](_0x5f59bb['shift']());}catch(_0x450cbd){_0x5f59bb['push'](_0x5f59bb['shift']());}}}(a40_0x52da,0x76621));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x16406d,_0x423e51){const _0x39cdb3=a40_0x3725,_0x4b2197=_0x16406d||_0x39cdb3(0x1b1),_0x3f8f5a=_0x423e51||_0x39cdb3(0x1b2);return _0x4b2197+':'+_0x3f8f5a;}export function getCachedCredential(_0x51135e,_0x292e8e){const _0x3b82a8=a40_0x3725,_0x50ce3c=getCacheKey(_0x51135e,_0x292e8e),_0x10b588=cache[_0x3b82a8(0x1ae)](_0x50ce3c);if(!_0x10b588)return null;if(Date[_0x3b82a8(0x1b6)]()-_0x10b588['loadedAt']>CACHE_TTL_MS)return cache['delete'](_0x50ce3c),null;return _0x10b588['apiKey'];}export function setCachedCredential(_0x5888ec,_0x49107d,_0x4f7a63){const _0x1cfefa=a40_0x3725,_0x6793de=getCacheKey(_0x49107d,_0x4f7a63);cache['set'](_0x6793de,{'apiKey':_0x5888ec,'loadedAt':Date[_0x1cfefa(0x1b6)]()});}export function clearCredentialCache(){const _0x15aee1=a40_0x3725;cache[_0x15aee1(0x1b4)]();}export function clearCachedCredential(_0x52864b,_0x51c8c0){const _0x50c0d6=getCacheKey(_0x52864b,_0x51c8c0);cache['delete'](_0x50c0d6);}function a40_0x3725(_0x265d37,_0x4e0105){const _0x52daff=a40_0x52da();return a40_0x3725=function(_0x3725e9,_0x44ba6c){_0x3725e9=_0x3725e9-0x1ab;let _0x3fdfa6=_0x52daff[_0x3725e9];return _0x3fdfa6;},a40_0x3725(_0x265d37,_0x4e0105);}function a40_0x52da(){const _0x1cbcbb=['11565opXqrI','6688157ueGXEg','3606424tCmpxO','get','32307327jTUani','323005tuuYOr','__default_site__','__default_profile__','48OCMYqt','clear','13NxbvLW','now','2918tfyYit','6030104ZSQIPy'];a40_0x52da=function(){return _0x1cbcbb;};return a40_0x52da();}
@@ -1 +1 @@
1
- const a41_0x48fc40=a41_0x96b7;(function(_0x5cd971,_0x5921b7){const _0x59915a=a41_0x96b7,_0x5a244b=_0x5cd971();while(!![]){try{const _0xe1bb04=parseInt(_0x59915a(0xda))/0x1+parseInt(_0x59915a(0xd0))/0x2+-parseInt(_0x59915a(0xd5))/0x3*(parseInt(_0x59915a(0xf2))/0x4)+-parseInt(_0x59915a(0xc6))/0x5*(-parseInt(_0x59915a(0xe9))/0x6)+-parseInt(_0x59915a(0xfd))/0x7+parseInt(_0x59915a(0xd2))/0x8*(parseInt(_0x59915a(0xef))/0x9)+parseInt(_0x59915a(0xff))/0xa;if(_0xe1bb04===_0x5921b7)break;else _0x5a244b['push'](_0x5a244b['shift']());}catch(_0x5deb67){_0x5a244b['push'](_0x5a244b['shift']());}}}(a41_0x3b5c,0x7aec2));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';function a41_0x96b7(_0x37c389,_0x3c96c3){const _0x3b5c93=a41_0x3b5c();return a41_0x96b7=function(_0x96b7b6,_0x46aeb9){_0x96b7b6=_0x96b7b6-0xc5;let _0x4020dd=_0x3b5c93[_0x96b7b6];return _0x4020dd;},a41_0x96b7(_0x37c389,_0x3c96c3);}import{LogLevel}from'../utils/tdx-logger.js';import*as a41_0x2d0e91 from'node:fs';import*as a41_0x3bcc5d from'node:path';export class GlobalContext{[a41_0x48fc40(0xf3)];[a41_0x48fc40(0xd9)];['parent_segment'];[a41_0x48fc40(0xde)];['llm_project'];['apiKey'];[a41_0x48fc40(0xfa)];[a41_0x48fc40(0xdb)];['profile'];[a41_0x48fc40(0xe8)];[a41_0x48fc40(0xe5)];[a41_0x48fc40(0x102)];['configFiles'];constructor(_0x3ce48b){const _0xa74793=a41_0x48fc40;this[_0xa74793(0x102)]=_0x3ce48b[_0xa74793(0xe7)]||getCurrentSessionPID()[_0xa74793(0xca)]();const _0x2c2974=loadSessionContext(_0x3ce48b[_0xa74793(0xe7)]),_0x5ce2f0=loadProjectConfig(),_0x4a9b0d=this['loadGlobalConfig']();this[_0xa74793(0xe5)]=_0x3ce48b[_0xa74793(0xcc)]||_0x2c2974?.['profile']||_0x4a9b0d['profile']||getActiveProfile();const _0x4d3e0d=this[_0xa74793(0xe5)]?loadProfile(this[_0xa74793(0xe5)]):null,_0x5be7f5=_0x5de3a3=>{const _0x4da506=_0xa74793;if(!_0x5de3a3)return{};const _0xd9f028=_0x5de3a3,_0x1df4d7={};for(const [_0x3b941f,_0x2e5ef3]of Object[_0x4da506(0xdc)](_0xd9f028)){typeof _0x2e5ef3==='string'&&(_0x1df4d7[_0x3b941f]=_0x2e5ef3);}return _0x1df4d7;},_0x35d49f={};if(_0x3ce48b[_0xa74793(0xf3)]&&_0x3ce48b[_0xa74793(0xf3)]!=='us01')_0x35d49f[_0xa74793(0xf3)]=_0x3ce48b[_0xa74793(0xf3)];const _0x38e2c6=_0x2c2974?.['database'],_0x206603=_0x5ce2f0?.[_0xa74793(0xd9)],_0x2de40f=_0x4d3e0d?.[_0xa74793(0xfb)]?.[_0xa74793(0xd9)],_0x3f2bd4=_0x4a9b0d[_0xa74793(0xd9)];_0x3ce48b['database']&&(_0x3ce48b[_0xa74793(0xd9)]!==_0x38e2c6&&_0x3ce48b[_0xa74793(0xd9)]!==_0x206603&&_0x3ce48b[_0xa74793(0xd9)]!==_0x2de40f&&_0x3ce48b['database']!==_0x3f2bd4)&&(_0x35d49f[_0xa74793(0xd9)]=_0x3ce48b[_0xa74793(0xd9)]);if(_0x3ce48b[_0xa74793(0xd8)])_0x35d49f['parent_segment']=_0x3ce48b[_0xa74793(0xd8)];if(_0x3ce48b['llmProject'])_0x35d49f['llm_project']=_0x3ce48b[_0xa74793(0xf0)];if(_0x3ce48b[_0xa74793(0xcc)])_0x35d49f[_0xa74793(0xcc)]=_0x3ce48b[_0xa74793(0xcc)];this['layers']={'cliFlags':_0x35d49f,'session':_0x5be7f5(_0x2c2974),'project':_0x5be7f5(_0x5ce2f0),'profile':_0x5be7f5(_0x4d3e0d?.['config']),'global':_0x5be7f5(_0x4a9b0d)};const _0x16e93a={...this['layers'][_0xa74793(0xe1)],...this[_0xa74793(0xe8)][_0xa74793(0xcc)],...this[_0xa74793(0xe8)][_0xa74793(0xe4)],...this[_0xa74793(0xe8)]['session'],...this[_0xa74793(0xe8)][_0xa74793(0xdf)]},_0x2cafe5=_0x16e93a['site']||'us01';this['site']=resolveSite(_0x2cafe5),this[_0xa74793(0xd9)]=_0x16e93a['database'],this[_0xa74793(0xfc)]=_0x16e93a[_0xa74793(0xfc)],this[_0xa74793(0xde)]=_0x16e93a[_0xa74793(0xde)],this[_0xa74793(0xec)]=_0x16e93a[_0xa74793(0xec)],this[_0xa74793(0xfa)]=_0x3ce48b[_0xa74793(0xfa)]||![],this[_0xa74793(0xdb)]=_0x3ce48b[_0xa74793(0xdb)]??LogLevel[_0xa74793(0xc5)],this['profile']=this[_0xa74793(0xe5)]||undefined,this[_0xa74793(0xed)]=getAPIKey(this['site'],this[_0xa74793(0xe5)]||undefined);const _0x37a3cd=getConfigDir(),_0x3e6d6b=a41_0x3bcc5d[_0xa74793(0xf1)](_0x37a3cd,_0xa74793(0xd1),this[_0xa74793(0x102)]+_0xa74793(0xe2)),_0x553414=findProjectConfigPath(),_0x340388=a41_0x3bcc5d[_0xa74793(0xf1)](_0x37a3cd,_0xa74793(0x101)),_0x277e17=a41_0x3bcc5d[_0xa74793(0xf1)](_0x37a3cd,'.env');let _0x545d87=null,_0x471bc1=null;this[_0xa74793(0xe5)]&&(_0x545d87=a41_0x3bcc5d[_0xa74793(0xf1)](_0x37a3cd,_0xa74793(0xf9),this['activeProfile'],_0xa74793(0x101)),_0x471bc1=a41_0x3bcc5d[_0xa74793(0xf1)](_0x37a3cd,_0xa74793(0xf9),this['activeProfile'],_0xa74793(0xeb))),this[_0xa74793(0xee)]={'session':a41_0x2d0e91['existsSync'](_0x3e6d6b)?_0x3e6d6b:null,'project':_0x553414,'profile':_0x545d87&&a41_0x2d0e91[_0xa74793(0x104)](_0x545d87)?_0x545d87:null,'profileCredentials':_0x471bc1&&a41_0x2d0e91[_0xa74793(0x104)](_0x471bc1)?_0x471bc1:null,'global':a41_0x2d0e91[_0xa74793(0x104)](_0x340388)?_0x340388:null,'globalCredentials':a41_0x2d0e91[_0xa74793(0x104)](_0x277e17)?_0x277e17:null};}[a41_0x48fc40(0xc9)](_0x4cf11b,_0x3a967d){const _0x24118e=a41_0x48fc40;if(!_0x3a967d)return'not\x20set';const _0x4d8d07=_0x3a967d;if(this[_0x24118e(0xe8)]['cliFlags'][_0x4cf11b]===_0x4d8d07){if(_0x4cf11b===_0x24118e(0xf3)&&_0x4d8d07===_0x24118e(0x105)&&!this[_0x24118e(0xe8)][_0x24118e(0xe7)][_0x24118e(0xf3)]&&!this[_0x24118e(0xe8)][_0x24118e(0xe4)][_0x24118e(0xf3)]&&!this['layers'][_0x24118e(0xcc)][_0x24118e(0xf3)]&&!this[_0x24118e(0xe8)][_0x24118e(0xe1)][_0x24118e(0xf3)])return _0x24118e(0xdd);return _0x24118e(0xd3)+_0x4cf11b[_0x24118e(0xe0)](/_/g,'-');}if(this[_0x24118e(0xe8)][_0x24118e(0xe7)][_0x4cf11b]===_0x4d8d07)return _0x24118e(0xe7);if(this['layers'][_0x24118e(0xe4)][_0x4cf11b]===_0x4d8d07)return'project';if(this[_0x24118e(0xe8)][_0x24118e(0xcc)][_0x4cf11b]===_0x4d8d07)return _0x24118e(0xf8)+this[_0x24118e(0xe5)];if(this[_0x24118e(0xe8)][_0x24118e(0xe1)][_0x4cf11b]===_0x4d8d07)return'global';return _0x24118e(0xdd);}['loadGlobalConfig'](){const _0x129955=a41_0x48fc40,_0xb600d2=a41_0x3bcc5d['join'](getConfigDir(),'tdx.json');if(!a41_0x2d0e91[_0x129955(0x104)](_0xb600d2))return{};try{const _0x14e238=a41_0x2d0e91['readFileSync'](_0xb600d2,_0x129955(0xd4));return JSON[_0x129955(0xd7)](_0x14e238);}catch{return{};}}[a41_0x48fc40(0xe3)](_0x458485){const _0x32690a=a41_0x48fc40;_0x458485['site']=this[_0x32690a(0xf3)],!_0x458485[_0x32690a(0xd9)]&&this['database']&&(_0x458485['database']=this[_0x32690a(0xd9)]),!_0x458485[_0x32690a(0xd8)]&&this[_0x32690a(0xfc)]&&(_0x458485[_0x32690a(0xd8)]=this['parent_segment']),!_0x458485['segmentPath']&&this[_0x32690a(0xde)]&&(_0x458485['segmentPath']=this[_0x32690a(0xde)]),!_0x458485['llmProject']&&this[_0x32690a(0xec)]&&(_0x458485['llmProject']=this['llm_project']);}['getParameters'](){const _0x325fdf=a41_0x48fc40;return[{'key':_0x325fdf(0xf3),'value':this[_0x325fdf(0xf3)]},{'key':_0x325fdf(0xd9),'value':this[_0x325fdf(0xd9)]},{'key':_0x325fdf(0xfc),'value':this['parent_segment']},{'key':_0x325fdf(0xde),'value':this[_0x325fdf(0xde)]},{'key':_0x325fdf(0xec),'value':this[_0x325fdf(0xec)]},{'key':_0x325fdf(0xcc),'value':this[_0x325fdf(0xe5)]||undefined}];}[a41_0x48fc40(0xcb)](){const _0x46d56f=a41_0x48fc40;console[_0x46d56f(0xea)](_0x46d56f(0xf6));for(const {key:_0x3acd29,value:_0x37504a}of this['getParameters']()){_0x37504a&&console[_0x46d56f(0xea)](_0x3acd29+':\x20'+_0x37504a);}}[a41_0x48fc40(0xf4)](){const _0x24654c=a41_0x48fc40;console[_0x24654c(0xea)]('[context]');for(const {key:_0x14d326,value:_0x19a886}of this[_0x24654c(0xd6)]()){if(_0x19a886){const _0x1d097f=_0x14d326===_0x24654c(0xcc)?'(active)':'('+this['getSource'](_0x14d326,_0x19a886)+')';console['log'](_0x14d326+':\x20'+_0x19a886+'\x20'+_0x1d097f);}}console[_0x24654c(0xea)](_0x24654c(0xf5));const _0x312e58=[{'label':_0x24654c(0xce),'path':this[_0x24654c(0xee)]['session'],'extra':_0x24654c(0x103)+this[_0x24654c(0x102)]+')'},{'label':'Project','path':this[_0x24654c(0xee)]['project']},{'label':_0x24654c(0x100),'path':this[_0x24654c(0xee)][_0x24654c(0xcc)]},{'label':'Profile\x20Credentials','path':this['configFiles'][_0x24654c(0xc8)]},{'label':_0x24654c(0xcd),'path':this[_0x24654c(0xee)]['global']},{'label':_0x24654c(0x106),'path':this['configFiles']['globalCredentials']}];for(const {label:_0x4c1126,path:_0xa229cf,extra:_0x5203c1}of _0x312e58){if(_0xa229cf)console[_0x24654c(0xea)](_0x4c1126+':\x20'+_0xa229cf+'\x20✓'+(_0x5203c1?'\x20'+_0x5203c1:''));else{if(_0x4c1126===_0x24654c(0xce))console['log'](_0x4c1126+_0x24654c(0xfe)+this[_0x24654c(0x102)]+')');else(_0x4c1126===_0x24654c(0xf7)||_0x4c1126===_0x24654c(0xcd))&&console['log'](_0x4c1126+_0x24654c(0xcf));}}}async['resolveAPIKeyAsync'](){const _0x1eac47=a41_0x48fc40;return this[_0x1eac47(0xed)]=await getAPIKeyAsync(this[_0x1eac47(0xf3)],this['activeProfile']||undefined),this['apiKey'];}static async[a41_0x48fc40(0xe6)](_0x58a2a3){const _0x5efe46=a41_0x48fc40,_0x27fe1c=new GlobalContext(_0x58a2a3);return await _0x27fe1c[_0x5efe46(0xc7)](),_0x27fe1c;}}function a41_0x3b5c(){const _0x2162ac=['Session',':\x20none','434828UkNfVV','sessions','1194440EeQRBE','CLI\x20flag:\x20--','utf-8','1719321vVDErU','getParameters','parse','parentSegment','database','568798PwdTZk','logLevel','entries','default','segment_path','cliFlags','replace','global','.json','injectIntoOptions','project','activeProfile','createAsync','session','layers','6ToROji','log','.env','llm_project','apiKey','configFiles','9ivSQyC','llmProject','join','4BsiICF','site','displayWithSources','\x0a[configuration\x20files]','[context]','Project','profile:\x20','profiles','verbose','config','parent_segment','3152611FqESew',':\x20none\x20(using\x20session:\x20','4419620wkNQRc','Profile','tdx.json','sessionId','(session:\x20','existsSync','us01','Global\x20Credentials','INFO','747455ummtet','resolveAPIKeyAsync','profileCredentials','getSource','toString','display','profile','Global'];a41_0x3b5c=function(){return _0x2162ac;};return a41_0x3b5c();}
1
+ const a41_0x164ba0=a41_0x3215;(function(_0x496c8c,_0x1a914c){const _0x48201a=a41_0x3215,_0x71ab46=_0x496c8c();while(!![]){try{const _0x32b167=parseInt(_0x48201a(0x85))/0x1+parseInt(_0x48201a(0x93))/0x2+parseInt(_0x48201a(0x8b))/0x3+parseInt(_0x48201a(0x9b))/0x4+-parseInt(_0x48201a(0x73))/0x5+parseInt(_0x48201a(0xa3))/0x6*(-parseInt(_0x48201a(0x91))/0x7)+-parseInt(_0x48201a(0x9f))/0x8*(parseInt(_0x48201a(0xad))/0x9);if(_0x32b167===_0x1a914c)break;else _0x71ab46['push'](_0x71ab46['shift']());}catch(_0x30e8ca){_0x71ab46['push'](_0x71ab46['shift']());}}}(a41_0x5e6c,0x86683));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';function a41_0x5e6c(){const _0x537c99=['displayWithSources','global','injectIntoOptions','48krnxXx','Global\x20Credentials','config','profiles','\x0a[configuration\x20files]','CLI\x20flag:\x20--','(session:\x20','us01','segment_path','profile:\x20','209295rfPkPf','layers','loadGlobalConfig','project','profileCredentials','default','llmProject','5126850RLNHWT','string','site','parent_segment','getParameters','replace','sessionId','sessions','(active)','verbose','display','activeProfile','join','getSource','toString','entries','Global','readFileSync','692785OrBtch','apiKey','.json','segmentPath','profile','Profile','1550130nUevtb','log','llm_project','database','Session','tdx.json','459102hkyydj','configFiles','1651472vtIQIi','Project','parentSegment','cliFlags','parse','globalCredentials','existsSync','session','3517132GfFBmr','resolveAPIKeyAsync','.env','not\x20set','280QcGuyK'];a41_0x5e6c=function(){return _0x537c99;};return a41_0x5e6c();}import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';function a41_0x3215(_0x250a9d,_0x2940dd){const _0x5e6cb8=a41_0x5e6c();return a41_0x3215=function(_0x3215dd,_0x1bc8c0){_0x3215dd=_0x3215dd-0x6f;let _0x86c059=_0x5e6cb8[_0x3215dd];return _0x86c059;},a41_0x3215(_0x250a9d,_0x2940dd);}import{LogLevel}from'../utils/tdx-logger.js';import*as a41_0x509df4 from'node:fs';import*as a41_0x531196 from'node:path';export class GlobalContext{[a41_0x164ba0(0x75)];['database'];[a41_0x164ba0(0x76)];['segment_path'];[a41_0x164ba0(0x8d)];[a41_0x164ba0(0x86)];[a41_0x164ba0(0x7c)];['logLevel'];[a41_0x164ba0(0x89)];[a41_0x164ba0(0xae)];[a41_0x164ba0(0x7e)];[a41_0x164ba0(0x79)];[a41_0x164ba0(0x92)];constructor(_0x4d3ade){const _0x544cf3=a41_0x164ba0;this[_0x544cf3(0x79)]=_0x4d3ade[_0x544cf3(0x9a)]||getCurrentSessionPID()[_0x544cf3(0x81)]();const _0x5e5b92=loadSessionContext(_0x4d3ade[_0x544cf3(0x9a)]),_0x4ee0f9=loadProjectConfig(),_0xbddc6d=this[_0x544cf3(0xaf)]();this['activeProfile']=_0x4d3ade[_0x544cf3(0x89)]||_0x5e5b92?.[_0x544cf3(0x89)]||_0xbddc6d['profile']||getActiveProfile();const _0x56c277=this[_0x544cf3(0x7e)]?loadProfile(this['activeProfile']):null,_0x562a3=_0xb00525=>{const _0x2bea76=_0x544cf3;if(!_0xb00525)return{};const _0x139adb=_0xb00525,_0x5760d0={};for(const [_0x227a1b,_0x10fac6]of Object[_0x2bea76(0x82)](_0x139adb)){typeof _0x10fac6===_0x2bea76(0x74)&&(_0x5760d0[_0x227a1b]=_0x10fac6);}return _0x5760d0;},_0x366197={};if(_0x4d3ade[_0x544cf3(0x75)]&&_0x4d3ade['site']!==_0x544cf3(0xaa))_0x366197[_0x544cf3(0x75)]=_0x4d3ade[_0x544cf3(0x75)];const _0x4372b5=_0x5e5b92?.[_0x544cf3(0x8e)],_0x25d8b9=_0x4ee0f9?.['database'],_0xefa99=_0x56c277?.[_0x544cf3(0xa5)]?.[_0x544cf3(0x8e)],_0x4eea97=_0xbddc6d[_0x544cf3(0x8e)];_0x4d3ade[_0x544cf3(0x8e)]&&(_0x4d3ade['database']!==_0x4372b5&&_0x4d3ade[_0x544cf3(0x8e)]!==_0x25d8b9&&_0x4d3ade['database']!==_0xefa99&&_0x4d3ade[_0x544cf3(0x8e)]!==_0x4eea97)&&(_0x366197[_0x544cf3(0x8e)]=_0x4d3ade['database']);if(_0x4d3ade[_0x544cf3(0x95)])_0x366197[_0x544cf3(0x76)]=_0x4d3ade[_0x544cf3(0x95)];if(_0x4d3ade['llmProject'])_0x366197[_0x544cf3(0x8d)]=_0x4d3ade['llmProject'];if(_0x4d3ade[_0x544cf3(0x89)])_0x366197[_0x544cf3(0x89)]=_0x4d3ade[_0x544cf3(0x89)];this[_0x544cf3(0xae)]={'cliFlags':_0x366197,'session':_0x562a3(_0x5e5b92),'project':_0x562a3(_0x4ee0f9),'profile':_0x562a3(_0x56c277?.[_0x544cf3(0xa5)]),'global':_0x562a3(_0xbddc6d)};const _0x19da28={...this['layers'][_0x544cf3(0xa1)],...this['layers'][_0x544cf3(0x89)],...this[_0x544cf3(0xae)]['project'],...this[_0x544cf3(0xae)]['session'],...this[_0x544cf3(0xae)]['cliFlags']},_0x1e81f1=_0x19da28[_0x544cf3(0x75)]||'us01';this[_0x544cf3(0x75)]=resolveSite(_0x1e81f1),this[_0x544cf3(0x8e)]=_0x19da28[_0x544cf3(0x8e)],this[_0x544cf3(0x76)]=_0x19da28[_0x544cf3(0x76)],this[_0x544cf3(0xab)]=_0x19da28[_0x544cf3(0xab)],this[_0x544cf3(0x8d)]=_0x19da28['llm_project'],this[_0x544cf3(0x7c)]=_0x4d3ade[_0x544cf3(0x7c)]||![],this['logLevel']=_0x4d3ade['logLevel']??LogLevel['INFO'],this[_0x544cf3(0x89)]=this['activeProfile']||undefined,this[_0x544cf3(0x86)]=getAPIKey(this[_0x544cf3(0x75)],this[_0x544cf3(0x7e)]||undefined);const _0xffce3b=getConfigDir(),_0x56718b=a41_0x531196['join'](_0xffce3b,_0x544cf3(0x7a),this[_0x544cf3(0x79)]+_0x544cf3(0x87)),_0x3a61cf=findProjectConfigPath(),_0xacfeac=a41_0x531196[_0x544cf3(0x7f)](_0xffce3b,_0x544cf3(0x90)),_0x4f9bfd=a41_0x531196[_0x544cf3(0x7f)](_0xffce3b,_0x544cf3(0x9d));let _0x35e7d9=null,_0x1315b5=null;this[_0x544cf3(0x7e)]&&(_0x35e7d9=a41_0x531196[_0x544cf3(0x7f)](_0xffce3b,'profiles',this[_0x544cf3(0x7e)],_0x544cf3(0x90)),_0x1315b5=a41_0x531196[_0x544cf3(0x7f)](_0xffce3b,_0x544cf3(0xa6),this[_0x544cf3(0x7e)],_0x544cf3(0x9d))),this[_0x544cf3(0x92)]={'session':a41_0x509df4[_0x544cf3(0x99)](_0x56718b)?_0x56718b:null,'project':_0x3a61cf,'profile':_0x35e7d9&&a41_0x509df4[_0x544cf3(0x99)](_0x35e7d9)?_0x35e7d9:null,'profileCredentials':_0x1315b5&&a41_0x509df4[_0x544cf3(0x99)](_0x1315b5)?_0x1315b5:null,'global':a41_0x509df4[_0x544cf3(0x99)](_0xacfeac)?_0xacfeac:null,'globalCredentials':a41_0x509df4[_0x544cf3(0x99)](_0x4f9bfd)?_0x4f9bfd:null};}[a41_0x164ba0(0x80)](_0x4ba403,_0x48fdf2){const _0x3a74fc=a41_0x164ba0;if(!_0x48fdf2)return _0x3a74fc(0x9e);const _0x668149=_0x48fdf2;if(this[_0x3a74fc(0xae)][_0x3a74fc(0x96)][_0x4ba403]===_0x668149){if(_0x4ba403===_0x3a74fc(0x75)&&_0x668149==='us01'&&!this[_0x3a74fc(0xae)]['session'][_0x3a74fc(0x75)]&&!this[_0x3a74fc(0xae)][_0x3a74fc(0x6f)]['site']&&!this[_0x3a74fc(0xae)][_0x3a74fc(0x89)][_0x3a74fc(0x75)]&&!this[_0x3a74fc(0xae)][_0x3a74fc(0xa1)][_0x3a74fc(0x75)])return _0x3a74fc(0x71);return _0x3a74fc(0xa8)+_0x4ba403[_0x3a74fc(0x78)](/_/g,'-');}if(this['layers'][_0x3a74fc(0x9a)][_0x4ba403]===_0x668149)return'session';if(this[_0x3a74fc(0xae)][_0x3a74fc(0x6f)][_0x4ba403]===_0x668149)return'project';if(this['layers'][_0x3a74fc(0x89)][_0x4ba403]===_0x668149)return _0x3a74fc(0xac)+this[_0x3a74fc(0x7e)];if(this[_0x3a74fc(0xae)][_0x3a74fc(0xa1)][_0x4ba403]===_0x668149)return _0x3a74fc(0xa1);return _0x3a74fc(0x71);}[a41_0x164ba0(0xaf)](){const _0x2f01c9=a41_0x164ba0,_0x52a429=a41_0x531196[_0x2f01c9(0x7f)](getConfigDir(),_0x2f01c9(0x90));if(!a41_0x509df4[_0x2f01c9(0x99)](_0x52a429))return{};try{const _0x38f73d=a41_0x509df4[_0x2f01c9(0x84)](_0x52a429,'utf-8');return JSON[_0x2f01c9(0x97)](_0x38f73d);}catch{return{};}}[a41_0x164ba0(0xa2)](_0x1e0ed){const _0x8e93f1=a41_0x164ba0;_0x1e0ed['site']=this[_0x8e93f1(0x75)],!_0x1e0ed[_0x8e93f1(0x8e)]&&this['database']&&(_0x1e0ed[_0x8e93f1(0x8e)]=this[_0x8e93f1(0x8e)]),!_0x1e0ed[_0x8e93f1(0x95)]&&this[_0x8e93f1(0x76)]&&(_0x1e0ed[_0x8e93f1(0x95)]=this[_0x8e93f1(0x76)]),!_0x1e0ed['segmentPath']&&this[_0x8e93f1(0xab)]&&(_0x1e0ed[_0x8e93f1(0x88)]=this[_0x8e93f1(0xab)]),!_0x1e0ed[_0x8e93f1(0x72)]&&this['llm_project']&&(_0x1e0ed[_0x8e93f1(0x72)]=this[_0x8e93f1(0x8d)]);}[a41_0x164ba0(0x77)](){const _0x41fdbb=a41_0x164ba0;return[{'key':_0x41fdbb(0x75),'value':this[_0x41fdbb(0x75)]},{'key':_0x41fdbb(0x8e),'value':this[_0x41fdbb(0x8e)]},{'key':_0x41fdbb(0x76),'value':this[_0x41fdbb(0x76)]},{'key':_0x41fdbb(0xab),'value':this[_0x41fdbb(0xab)]},{'key':_0x41fdbb(0x8d),'value':this[_0x41fdbb(0x8d)]},{'key':_0x41fdbb(0x89),'value':this[_0x41fdbb(0x7e)]||undefined}];}[a41_0x164ba0(0x7d)](){const _0x4f97ad=a41_0x164ba0;console[_0x4f97ad(0x8c)]('[context]');for(const {key:_0x245d32,value:_0x1c0e39}of this[_0x4f97ad(0x77)]()){_0x1c0e39&&console[_0x4f97ad(0x8c)](_0x245d32+':\x20'+_0x1c0e39);}}[a41_0x164ba0(0xa0)](){const _0x5644ad=a41_0x164ba0;console[_0x5644ad(0x8c)]('[context]');for(const {key:_0x22bddf,value:_0x348639}of this[_0x5644ad(0x77)]()){if(_0x348639){const _0x6fc12a=_0x22bddf==='profile'?_0x5644ad(0x7b):'('+this[_0x5644ad(0x80)](_0x22bddf,_0x348639)+')';console[_0x5644ad(0x8c)](_0x22bddf+':\x20'+_0x348639+'\x20'+_0x6fc12a);}}console['log'](_0x5644ad(0xa7));const _0x158f6a=[{'label':_0x5644ad(0x8f),'path':this[_0x5644ad(0x92)][_0x5644ad(0x9a)],'extra':_0x5644ad(0xa9)+this[_0x5644ad(0x79)]+')'},{'label':_0x5644ad(0x94),'path':this[_0x5644ad(0x92)]['project']},{'label':_0x5644ad(0x8a),'path':this[_0x5644ad(0x92)][_0x5644ad(0x89)]},{'label':'Profile\x20Credentials','path':this[_0x5644ad(0x92)][_0x5644ad(0x70)]},{'label':_0x5644ad(0x83),'path':this[_0x5644ad(0x92)][_0x5644ad(0xa1)]},{'label':_0x5644ad(0xa4),'path':this['configFiles'][_0x5644ad(0x98)]}];for(const {label:_0x1c6c0a,path:_0x837106,extra:_0x227cb4}of _0x158f6a){if(_0x837106)console['log'](_0x1c6c0a+':\x20'+_0x837106+'\x20✓'+(_0x227cb4?'\x20'+_0x227cb4:''));else{if(_0x1c6c0a===_0x5644ad(0x8f))console[_0x5644ad(0x8c)](_0x1c6c0a+':\x20none\x20(using\x20session:\x20'+this[_0x5644ad(0x79)]+')');else(_0x1c6c0a===_0x5644ad(0x94)||_0x1c6c0a===_0x5644ad(0x83))&&console['log'](_0x1c6c0a+':\x20none');}}}async[a41_0x164ba0(0x9c)](){const _0x337dd2=a41_0x164ba0;return this[_0x337dd2(0x86)]=await getAPIKeyAsync(this[_0x337dd2(0x75)],this[_0x337dd2(0x7e)]||undefined),this[_0x337dd2(0x86)];}static async['createAsync'](_0x1b1cf5){const _0x293d2b=new GlobalContext(_0x1b1cf5);return await _0x293d2b['resolveAPIKeyAsync'](),_0x293d2b;}}
@@ -1 +1 @@
1
- const a42_0x13c0f5=a42_0x53a1;(function(_0x5f07c4,_0x5f45e5){const _0x5dd522=a42_0x53a1,_0x4cc830=_0x5f07c4();while(!![]){try{const _0x2de1b6=parseInt(_0x5dd522(0x80))/0x1*(-parseInt(_0x5dd522(0x72))/0x2)+-parseInt(_0x5dd522(0x74))/0x3*(-parseInt(_0x5dd522(0x8f))/0x4)+-parseInt(_0x5dd522(0x76))/0x5+parseInt(_0x5dd522(0x8e))/0x6*(-parseInt(_0x5dd522(0x8c))/0x7)+-parseInt(_0x5dd522(0x82))/0x8*(parseInt(_0x5dd522(0x89))/0x9)+-parseInt(_0x5dd522(0x7b))/0xa+parseInt(_0x5dd522(0x75))/0xb;if(_0x2de1b6===_0x5f45e5)break;else _0x4cc830['push'](_0x4cc830['shift']());}catch(_0xce43d6){_0x4cc830['push'](_0x4cc830['shift']());}}}(a42_0x4c33,0x59875));const SERVICE_NAME=a42_0x13c0f5(0x90);let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0xb3d6a0=a42_0x13c0f5;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x8d1663=await import(_0xb3d6a0(0x73));return keyringModule=_0x8d1663[_0xb3d6a0(0x7e)],keyringModule;}catch(_0x184e1c){return keyringLoadError=_0x184e1c instanceof Error?_0x184e1c:new Error(String(_0x184e1c)),null;}}function getAccountName(_0x18af31){const _0x8b84c7=a42_0x13c0f5,_0x3cf10c=_0x18af31||'';return'profile:'+_0x3cf10c+_0x8b84c7(0x78);}export async function getKeychainAPIKey(_0xccea81){const _0x3caf8d=a42_0x13c0f5,_0x15f453=await getKeychainAPIKeyWithStatus(_0xccea81);if(_0x15f453['success'])return _0x15f453['value'];return _0x15f453[_0x3caf8d(0x81)]===_0x3caf8d(0x8b)&&console[_0x3caf8d(0x7a)](_0x3caf8d(0x71)+_0x15f453[_0x3caf8d(0x85)]),null;}export async function getKeychainAPIKeyWithStatus(_0x3de6a0){const _0x423ac0=a42_0x13c0f5;try{const _0x3690e9=await getKeyring();if(!_0x3690e9)return{'success':![],'reason':_0x423ac0(0x87)};const _0x2dc3fb=getAccountName(_0x3de6a0),_0x55569b=await _0x3690e9[_0x423ac0(0x7d)](SERVICE_NAME,_0x2dc3fb);if(_0x55569b)return{'success':!![],'value':_0x55569b};return{'success':![],'reason':_0x423ac0(0x7c)};}catch(_0x30f523){const _0x229241=_0x30f523 instanceof Error?_0x30f523[_0x423ac0(0x85)]:String(_0x30f523);if(_0x229241[_0x423ac0(0x79)](_0x423ac0(0x8d))||_0x229241[_0x423ac0(0x8a)]()[_0x423ac0(0x79)]('could\x20not\x20be\x20found')||_0x229241[_0x423ac0(0x8a)]()['includes'](_0x423ac0(0x91)))return{'success':![],'reason':_0x423ac0(0x7c)};if(_0x229241[_0x423ac0(0x79)]('-25293')||_0x229241['toLowerCase']()['includes'](_0x423ac0(0x88))||_0x229241['toLowerCase']()[_0x423ac0(0x79)](_0x423ac0(0x83)))return{'success':![],'reason':'access_denied','message':_0x423ac0(0x86)};return{'success':![],'reason':_0x423ac0(0x87),'message':_0x229241};}}function a42_0x4c33(){const _0x228f9a=['access','setPassword','message','Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.','unavailable','restricted','9wrEufu','toLowerCase','access_denied','7hUMkGr','-25300','3667542LlcPNR','12896CbeUQk','tdx','not\x20found','not\x20supported','__keychain_test__','Warning:\x20','330016izmZKP','@zowe/secrets-for-zowe-sdk','9QXgQPU','23304996KPZgpl','462860oUynbd','cannot\x20find',':api_key','includes','error','766230HOrwSJ','not_found','getPassword','keyring','deletePassword','2xLzImU','reason','5209048jSlUqc'];a42_0x4c33=function(){return _0x228f9a;};return a42_0x4c33();}function a42_0x53a1(_0x37125f,_0x3f8133){const _0x4c330f=a42_0x4c33();return a42_0x53a1=function(_0x53a1b9,_0x34d78f){_0x53a1b9=_0x53a1b9-0x70;let _0xbb8b05=_0x4c330f[_0x53a1b9];return _0xbb8b05;},a42_0x53a1(_0x37125f,_0x3f8133);}export async function saveKeychainAPIKey(_0x5b6a92,_0x4b77f3){const _0x350848=a42_0x13c0f5,_0x459d1b=await getKeyring();if(!_0x459d1b)throw new Error('System\x20keychain\x20is\x20not\x20available');const _0x30eb32=getAccountName(_0x4b77f3);await _0x459d1b[_0x350848(0x84)](SERVICE_NAME,_0x30eb32,_0x5b6a92);}export async function deleteKeychainAPIKey(_0x3ef3aa){const _0x9231bb=a42_0x13c0f5;try{const _0x2a3863=await getKeyring();if(!_0x2a3863)return![];const _0x4668ad=getAccountName(_0x3ef3aa);return await _0x2a3863[_0x9231bb(0x7f)](SERVICE_NAME,_0x4668ad);}catch{return![];}}export async function isKeychainAvailable(){const _0x30d8cd=a42_0x13c0f5;try{const _0x3c484c=await getKeyring();if(!_0x3c484c)return![];return await _0x3c484c[_0x30d8cd(0x7d)](SERVICE_NAME,_0x30d8cd(0x70)),!![];}catch(_0x2dd8c1){const _0x59ce8c=_0x2dd8c1 instanceof Error?_0x2dd8c1[_0x30d8cd(0x85)][_0x30d8cd(0x8a)]():'';if(_0x59ce8c[_0x30d8cd(0x79)]('not\x20available')||_0x59ce8c[_0x30d8cd(0x79)](_0x30d8cd(0x92))||_0x59ce8c[_0x30d8cd(0x79)](_0x30d8cd(0x77)))return![];return!![];}}
1
+ (function(_0x6b50b6,_0x20b850){const _0x24a098=a42_0x40e1,_0x4a1743=_0x6b50b6();while(!![]){try{const _0x5eb6a5=parseInt(_0x24a098(0x7e))/0x1*(-parseInt(_0x24a098(0x85))/0x2)+parseInt(_0x24a098(0x87))/0x3+-parseInt(_0x24a098(0x7a))/0x4+-parseInt(_0x24a098(0x8a))/0x5*(-parseInt(_0x24a098(0x88))/0x6)+-parseInt(_0x24a098(0x81))/0x7+parseInt(_0x24a098(0x7d))/0x8+parseInt(_0x24a098(0x7c))/0x9;if(_0x5eb6a5===_0x20b850)break;else _0x4a1743['push'](_0x4a1743['shift']());}catch(_0x20e383){_0x4a1743['push'](_0x4a1743['shift']());}}}(a42_0x1465,0x771d9));const SERVICE_NAME='tdx';let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0xc53268=a42_0x40e1;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x12ebba=await import(_0xc53268(0x76));return keyringModule=_0x12ebba[_0xc53268(0x8b)],keyringModule;}catch(_0x3d903e){return keyringLoadError=_0x3d903e instanceof Error?_0x3d903e:new Error(String(_0x3d903e)),null;}}function getAccountName(_0x325e1e){const _0x483dd5=a42_0x40e1,_0x489cb6=_0x325e1e||'';return _0x483dd5(0x7b)+_0x489cb6+':api_key';}export async function getKeychainAPIKey(_0x3b48f8){const _0x475a3e=a42_0x40e1,_0x1d9cd3=await getKeychainAPIKeyWithStatus(_0x3b48f8);if(_0x1d9cd3[_0x475a3e(0x82)])return _0x1d9cd3[_0x475a3e(0x78)];return _0x1d9cd3[_0x475a3e(0x83)]==='access_denied'&&console[_0x475a3e(0x72)](_0x475a3e(0x8e)+_0x1d9cd3[_0x475a3e(0x90)]),null;}export async function getKeychainAPIKeyWithStatus(_0x241322){const _0x326c95=a42_0x40e1;try{const _0x57685c=await getKeyring();if(!_0x57685c)return{'success':![],'reason':'unavailable'};const _0x431670=getAccountName(_0x241322),_0x190a15=await _0x57685c[_0x326c95(0x8c)](SERVICE_NAME,_0x431670);if(_0x190a15)return{'success':!![],'value':_0x190a15};return{'success':![],'reason':_0x326c95(0x8f)};}catch(_0x275ec1){const _0x379508=_0x275ec1 instanceof Error?_0x275ec1[_0x326c95(0x90)]:String(_0x275ec1);if(_0x379508[_0x326c95(0x89)](_0x326c95(0x84))||_0x379508[_0x326c95(0x71)]()[_0x326c95(0x89)]('could\x20not\x20be\x20found')||_0x379508[_0x326c95(0x71)]()[_0x326c95(0x89)]('not\x20found'))return{'success':![],'reason':_0x326c95(0x8f)};if(_0x379508[_0x326c95(0x89)]('-25293')||_0x379508['toLowerCase']()[_0x326c95(0x89)](_0x326c95(0x79))||_0x379508[_0x326c95(0x71)]()[_0x326c95(0x89)](_0x326c95(0x8d)))return{'success':![],'reason':_0x326c95(0x75),'message':'Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.'};return{'success':![],'reason':_0x326c95(0x77),'message':_0x379508};}}export async function saveKeychainAPIKey(_0x530823,_0x54aeec){const _0x50322d=a42_0x40e1,_0x4b3a0a=await getKeyring();if(!_0x4b3a0a)throw new Error(_0x50322d(0x80));const _0xce87ce=getAccountName(_0x54aeec);await _0x4b3a0a[_0x50322d(0x86)](SERVICE_NAME,_0xce87ce,_0x530823);}export async function deleteKeychainAPIKey(_0xc82289){try{const _0x2baf3d=await getKeyring();if(!_0x2baf3d)return![];const _0x527cd0=getAccountName(_0xc82289);return await _0x2baf3d['deletePassword'](SERVICE_NAME,_0x527cd0);}catch{return![];}}function a42_0x40e1(_0x5352a5,_0x451b27){const _0x146556=a42_0x1465();return a42_0x40e1=function(_0x40e1e4,_0x18b5fd){_0x40e1e4=_0x40e1e4-0x71;let _0x423035=_0x146556[_0x40e1e4];return _0x423035;},a42_0x40e1(_0x5352a5,_0x451b27);}export async function isKeychainAvailable(){const _0x476d93=a42_0x40e1;try{const _0x54d6aa=await getKeyring();if(!_0x54d6aa)return![];return await _0x54d6aa[_0x476d93(0x8c)](SERVICE_NAME,'__keychain_test__'),!![];}catch(_0x258d00){const _0x51c2d9=_0x258d00 instanceof Error?_0x258d00[_0x476d93(0x90)][_0x476d93(0x71)]():'';if(_0x51c2d9['includes'](_0x476d93(0x73))||_0x51c2d9[_0x476d93(0x89)](_0x476d93(0x74))||_0x51c2d9['includes'](_0x476d93(0x7f)))return![];return!![];}}function a42_0x1465(){const _0x2f66cb=['success','reason','-25300','1720174YJGIPa','setPassword','683709VAPUlj','120vyPNUT','includes','19965GGgKGZ','keyring','getPassword','access','Warning:\x20','not_found','message','toLowerCase','error','not\x20available','not\x20supported','access_denied','@zowe/secrets-for-zowe-sdk','unavailable','value','restricted','3715268VdTnyw','profile:','20877165erSEdk','2241528wEHOse','1TiifDb','cannot\x20find','System\x20keychain\x20is\x20not\x20available','4415866iyWKEf'];a42_0x1465=function(){return _0x2f66cb;};return a42_0x1465();}
@@ -1 +1 @@
1
- (function(_0x3baeca,_0x50e67e){const _0x80f38a=a43_0x17f8,_0x935378=_0x3baeca();while(!![]){try{const _0x3c10a9=parseInt(_0x80f38a(0x135))/0x1+-parseInt(_0x80f38a(0x141))/0x2*(-parseInt(_0x80f38a(0x15c))/0x3)+-parseInt(_0x80f38a(0x12c))/0x4*(-parseInt(_0x80f38a(0x13e))/0x5)+-parseInt(_0x80f38a(0x11b))/0x6+parseInt(_0x80f38a(0x115))/0x7*(parseInt(_0x80f38a(0x125))/0x8)+parseInt(_0x80f38a(0x136))/0x9+-parseInt(_0x80f38a(0x14f))/0xa;if(_0x3c10a9===_0x50e67e)break;else _0x935378['push'](_0x935378['shift']());}catch(_0x5428cc){_0x935378['push'](_0x935378['shift']());}}}(a43_0x3075,0xdd21c));import*as a43_0xc0621e from'node:fs';import*as a43_0x3f1a27 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';function a43_0x3075(){const _0x406ad7=['\x22\x20\x22','8364918lkySnW','llm_agent','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','find','existsSync','.env.','parent_segment','toISOString','readdirSync','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','456vZBNSn','site',':\x20Invalid\x20JSON\x20syntax','object','description','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','Profile\x20\x27','4768vaXakX','from','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','local','profiles','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','map','name','push','311386iQQHkT','8064630NqKxKY','tdx.json','Warning:\x20Profile\x20\x27','localeCompare','\x20already\x20exists','\x0aWarning:\x20Failed\x20to\x20parse\x20','\x20\x201.\x20Edit:\x20','readFileSync','10kMNJCe','rmSync','join','14xUoUJl','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','Error:\x20','\x27:\x20unknown\x20config\x20key\x20\x27','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','Profile\x20','To\x20migrate:','warn','\x27\x20will\x20be\x20ignored','has','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','some','message','entries','19627460XFhWZV','\x27:\x20config\x20must\x20be\x20an\x20object','llm_project','isDirectory','utf-8','sort','Invalid\x20profile\x20name:\x20','Warning:\x20Failed\x20to\x20parse\x20','length','.env','filter','string','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','727218jseQFG','directory','\x20\x20mv\x20\x22','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','166523mbWvvE',',\x20creating\x20new\x20file','parse','user','database'];a43_0x3075=function(){return _0x406ad7;};return a43_0x3075();}export function getProfileParams(_0x12b133){const _0x1b92bf=a43_0x17f8,_0x339083={};if(!_0x12b133)return _0x339083;for(const [_0x652185,_0x572009]of Object[_0x1b92bf(0x14e)](_0x12b133)){_0x652185!==_0x1b92bf(0x129)&&_0x572009!==undefined&&(_0x339083[_0x652185]=_0x572009);}return _0x339083;}export function getProfilesDir(){const _0x3774f7=a43_0x17f8;return a43_0x3f1a27[_0x3774f7(0x140)](getConfigDir(),_0x3774f7(0x130));}function getProfileDir(_0x57f7ed){return a43_0x3f1a27['join'](getProfilesDir(),_0x57f7ed);}function getProfileConfigPath(_0x3b0c81){const _0x30d44a=a43_0x17f8;return a43_0x3f1a27[_0x30d44a(0x140)](getProfileDir(_0x3b0c81),'tdx.json');}function getProfileEnvPath(_0x340d97){const _0x3e41de=a43_0x17f8;return a43_0x3f1a27['join'](getProfileDir(_0x340d97),_0x3e41de(0x158));}function getGlobalConfigPath(){const _0x14f300=a43_0x17f8;return a43_0x3f1a27[_0x14f300(0x140)](getConfigDir(),'tdx.json');}function validateProfileName(_0x5212b1){const _0x2217b6=a43_0x17f8;if(!/^[a-zA-Z0-9_-]+$/['test'](_0x5212b1))throw new Error(_0x2217b6(0x155)+_0x5212b1+_0x2217b6(0x142));}function validateProfileConfig(_0x379362,_0x422229){const _0x186724=a43_0x17f8;if(typeof _0x379362!==_0x186724(0x128)||_0x379362===null)throw new Error('Profile\x20\x27'+_0x422229+_0x186724(0x150));const _0x5e5fd0=[_0x186724(0x129),_0x186724(0x126),_0x186724(0x119),_0x186724(0x121),_0x186724(0x151),_0x186724(0x11c)],_0x361854=_0x379362;for(const _0x119303 of Object['keys'](_0x361854)){!_0x5e5fd0['includes'](_0x119303)&&console[_0x186724(0x148)](_0x186724(0x138)+_0x422229+_0x186724(0x144)+_0x119303+_0x186724(0x149));}if(_0x361854[_0x186724(0x129)]!==undefined&&typeof _0x361854[_0x186724(0x129)]!=='string')throw new Error(_0x186724(0x12b)+_0x422229+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x361854['site']!==undefined&&typeof _0x361854[_0x186724(0x126)]!==_0x186724(0x15a))throw new Error(_0x186724(0x12b)+_0x422229+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x361854['database']!==undefined&&typeof _0x361854[_0x186724(0x119)]!==_0x186724(0x15a))throw new Error('Profile\x20\x27'+_0x422229+_0x186724(0x145));if(_0x361854[_0x186724(0x121)]!==undefined&&typeof _0x361854[_0x186724(0x121)]!==_0x186724(0x15a))throw new Error(_0x186724(0x12b)+_0x422229+_0x186724(0x14b));if(_0x361854[_0x186724(0x151)]!==undefined&&typeof _0x361854[_0x186724(0x151)]!==_0x186724(0x15a))throw new Error(_0x186724(0x12b)+_0x422229+_0x186724(0x12a));if(_0x361854['llm_agent']!==undefined&&typeof _0x361854[_0x186724(0x11c)]!==_0x186724(0x15a))throw new Error(_0x186724(0x12b)+_0x422229+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x1f331a,_0x337425){const _0xd0de5b=a43_0x17f8;if(!a43_0xc0621e[_0xd0de5b(0x11f)](_0x1f331a))return[];try{const _0x4ef69c=a43_0xc0621e[_0xd0de5b(0x13d)](_0x1f331a,_0xd0de5b(0x153)),_0x6f7cf2=JSON[_0xd0de5b(0x117)](_0x4ef69c);if(!_0x6f7cf2[_0xd0de5b(0x130)]||typeof _0x6f7cf2['profiles']!=='object')return[];const _0xc9f2b6=[];for(const [_0xb2b223,_0x4ac3da]of Object[_0xd0de5b(0x14e)](_0x6f7cf2[_0xd0de5b(0x130)])){try{validateProfileConfig(_0x4ac3da,_0xb2b223);const _0x2a2e22=getNewCredentialPath(_0xb2b223),_0x41c9bf=getOldCredentialPath(_0xb2b223),_0x1e5791=a43_0xc0621e[_0xd0de5b(0x11f)](_0x2a2e22)||a43_0xc0621e[_0xd0de5b(0x11f)](_0x41c9bf);_0xc9f2b6[_0xd0de5b(0x134)]({'name':_0xb2b223,'config':_0x4ac3da,'metadata':{'name':_0xb2b223,'createdAt':new Date()[_0xd0de5b(0x122)]()},'hasCredentials':_0x1e5791,'scope':_0x337425});}catch(_0x7534d6){_0x7534d6 instanceof Error&&(console[_0xd0de5b(0x148)](_0xd0de5b(0x124)+_0x1f331a+':'),console[_0xd0de5b(0x148)]('\x20\x20'+_0x7534d6['message']+'\x0a'));}}return _0xc9f2b6;}catch(_0x123c85){return _0x123c85 instanceof SyntaxError?(console[_0xd0de5b(0x148)](_0xd0de5b(0x13b)+_0x1f331a+_0xd0de5b(0x127)),console['warn'](_0xd0de5b(0x143)+_0x123c85[_0xd0de5b(0x14d)]+'\x0a')):console[_0xd0de5b(0x148)](_0xd0de5b(0x131)+_0x1f331a+':\x20'+_0x123c85+'\x0a'),[];}}export function getNewCredentialPath(_0x2713fa){const _0xb89e09=a43_0x17f8;return a43_0x3f1a27[_0xb89e09(0x140)](getConfigDir(),_0xb89e09(0x120)+_0x2713fa);}function getOldCredentialPath(_0x410479){const _0x13ca59=a43_0x17f8;return a43_0x3f1a27[_0x13ca59(0x140)](getProfilesDir(),_0x410479,_0x13ca59(0x158));}function loadProfilesFromTdxJsonFiles(){const _0x336fba=a43_0x17f8,_0x4d4fe7=[],_0x2e2684=findProjectConfigPath();_0x2e2684&&_0x4d4fe7[_0x336fba(0x134)](...loadProfilesFromTdxJson(_0x2e2684,_0x336fba(0x12f)));const _0x5d4d6b=a43_0x3f1a27[_0x336fba(0x140)](getConfigDir(),_0x336fba(0x137));return _0x4d4fe7[_0x336fba(0x134)](...loadProfilesFromTdxJson(_0x5d4d6b,_0x336fba(0x118))),_0x4d4fe7;}function loadProfilesFromDirectories(){const _0x2848bc=a43_0x17f8,_0x1fadee=getProfilesDir();if(!a43_0xc0621e[_0x2848bc(0x11f)](_0x1fadee))return[];try{return a43_0xc0621e[_0x2848bc(0x123)](_0x1fadee,{'withFileTypes':!![]})[_0x2848bc(0x159)](_0x8e3062=>_0x8e3062[_0x2848bc(0x152)]())['map'](_0xca2cf9=>_0xca2cf9[_0x2848bc(0x133)])[_0x2848bc(0x159)](_0x3b7269=>{const _0x1848e3=_0x2848bc,_0x208e70=getProfileConfigPath(_0x3b7269),_0x1f44e4=getProfileEnvPath(_0x3b7269);return a43_0xc0621e[_0x1848e3(0x11f)](_0x208e70)||a43_0xc0621e['existsSync'](_0x1f44e4);})[_0x2848bc(0x132)](_0x28da3a=>{const _0x249984=_0x2848bc,_0x362e39=loadProfileFromDirectory(_0x28da3a);if(_0x362e39)return{..._0x362e39,'scope':_0x249984(0x112)};return null;})[_0x2848bc(0x159)](_0x13f764=>_0x13f764!==null);}catch{return[];}}function loadProfileFromDirectory(_0xf5b9df){const _0x320c0a=a43_0x17f8,_0xa7c90f=getProfileConfigPath(_0xf5b9df),_0x3a4ae0=getOldCredentialPath(_0xf5b9df);if(!a43_0xc0621e[_0x320c0a(0x11f)](_0xa7c90f)&&!a43_0xc0621e[_0x320c0a(0x11f)](_0x3a4ae0))return null;let _0x22af94={},_0x3993d4={'name':_0xf5b9df,'createdAt':new Date()[_0x320c0a(0x122)]()};if(a43_0xc0621e['existsSync'](_0xa7c90f))try{const _0x131d1a=a43_0xc0621e['readFileSync'](_0xa7c90f,'utf-8'),_0x3caef5=JSON[_0x320c0a(0x117)](_0x131d1a),{metadata:_0x4eca7c,..._0x45b046}=_0x3caef5;_0x22af94=_0x45b046,_0x4eca7c&&(_0x3993d4=_0x4eca7c);}catch{}return{'name':_0xf5b9df,'config':_0x22af94,'metadata':_0x3993d4,'hasCredentials':a43_0xc0621e[_0x320c0a(0x11f)](_0x3a4ae0),'scope':_0x320c0a(0x112)};}export function listProfiles(){const _0xa2daea=a43_0x17f8,_0x42b725=loadProfilesFromTdxJsonFiles(),_0x41fdb3=loadProfilesFromDirectories();if(_0x41fdb3[_0xa2daea(0x157)]>0x0){const _0x227950=_0x41fdb3['map'](_0x4c2f2e=>_0x4c2f2e[_0xa2daea(0x133)])[_0xa2daea(0x140)](',\x20'),_0x4714b0=getConfigDir();console[_0xa2daea(0x148)](_0xa2daea(0x12e)+_0x227950),console[_0xa2daea(0x148)](_0xa2daea(0x11d)),console['warn'](_0xa2daea(0x13c)+a43_0x3f1a27[_0xa2daea(0x140)](_0x4714b0,_0xa2daea(0x137))),console[_0xa2daea(0x148)](_0xa2daea(0x114)),console[_0xa2daea(0x148)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x2c8bc0=[..._0x42b725,..._0x41fdb3],_0x28cd10=new Map();for(const _0x5b834e of _0x2c8bc0){!_0x28cd10[_0xa2daea(0x14a)](_0x5b834e[_0xa2daea(0x133)])&&_0x28cd10['set'](_0x5b834e[_0xa2daea(0x133)],_0x5b834e);}return Array[_0xa2daea(0x12d)](_0x28cd10['values']())[_0xa2daea(0x154)]((_0x269e5b,_0x108046)=>_0x269e5b[_0xa2daea(0x133)][_0xa2daea(0x139)](_0x108046[_0xa2daea(0x133)]));}export function profileExists(_0x28eae5){const _0x4688ec=a43_0x17f8,_0x12432c=listProfiles();return _0x12432c[_0x4688ec(0x14c)](_0x4ab616=>_0x4ab616[_0x4688ec(0x133)]===_0x28eae5);}export function loadProfile(_0x3fd7c5){const _0x1929f8=a43_0x17f8;validateProfileName(_0x3fd7c5);const _0x1666f5=listProfiles(),_0xa976a2=_0x1666f5[_0x1929f8(0x11e)](_0x944306=>_0x944306['name']===_0x3fd7c5);return _0xa976a2||null;}export function saveProfile(_0x27b7e2,_0xfaed99,_0x503655=![]){saveProfileToUserConfig(_0x27b7e2,_0xfaed99);}export function deleteProfile(_0x60c7bc){const _0x462218=a43_0x17f8;validateProfileName(_0x60c7bc);const _0x4d2b31=getProfileDir(_0x60c7bc);if(!a43_0xc0621e[_0x462218(0x11f)](_0x4d2b31))throw new Error(_0x462218(0x146)+_0x60c7bc+'\x20does\x20not\x20exist');a43_0xc0621e[_0x462218(0x13f)](_0x4d2b31,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0xdb54cd,_0x31d36c){const _0x1b750a=a43_0x17f8;validateProfileName(_0xdb54cd);const _0x2e932e=getGlobalConfigPath(),_0x5e3713=getConfigDir();!a43_0xc0621e[_0x1b750a(0x11f)](_0x5e3713)&&createSecureDirectory(_0x5e3713);let _0xfa2b74={};if(a43_0xc0621e['existsSync'](_0x2e932e))try{const _0x2cd32e=a43_0xc0621e[_0x1b750a(0x13d)](_0x2e932e,'utf-8');_0xfa2b74=JSON[_0x1b750a(0x117)](_0x2cd32e);}catch{console['warn'](_0x1b750a(0x156)+_0x2e932e+_0x1b750a(0x116));}!_0xfa2b74[_0x1b750a(0x130)]&&(_0xfa2b74[_0x1b750a(0x130)]={}),_0xfa2b74['profiles'][_0xdb54cd]=_0x31d36c,writeSecureFile(_0x2e932e,JSON['stringify'](_0xfa2b74,null,0x2));}export function getActiveProfile(){const _0x9d5300=a43_0x17f8,_0x3c7a9d=getGlobalConfigPath();if(!a43_0xc0621e[_0x9d5300(0x11f)](_0x3c7a9d))return null;try{const _0x477920=a43_0xc0621e[_0x9d5300(0x13d)](_0x3c7a9d,_0x9d5300(0x153)),_0x40a060=JSON[_0x9d5300(0x117)](_0x477920);return _0x40a060['profile']||null;}catch{return null;}}export function createProfile(_0xe46241,_0x59d36d){const _0x591c7f=a43_0x17f8;validateProfileName(_0xe46241);if(profileExists(_0xe46241))throw new Error(_0x591c7f(0x146)+_0xe46241+_0x591c7f(0x13a));saveProfile(_0xe46241,_0x59d36d);}export function saveProfileCredentials(_0x303463,_0x5bcfdf){const _0x4afbaa=a43_0x17f8;validateProfileName(_0x303463);if(!profileExists(_0x303463))throw new Error(_0x4afbaa(0x146)+_0x303463+'\x20does\x20not\x20exist');const _0x5c9f04=getNewCredentialPath(_0x303463);writeSecureFile(_0x5c9f04,_0x5bcfdf);}function a43_0x17f8(_0x17ddac,_0x3ba26e){const _0x3075fe=a43_0x3075();return a43_0x17f8=function(_0x17f8aa,_0x5bed54){_0x17f8aa=_0x17f8aa-0x112;let _0x144aa4=_0x3075fe[_0x17f8aa];return _0x144aa4;},a43_0x17f8(_0x17ddac,_0x3ba26e);}export function loadProfileCredentials(_0x287567){const _0x2cc2d0=a43_0x17f8;validateProfileName(_0x287567);const _0x3a6733=getNewCredentialPath(_0x287567);if(a43_0xc0621e[_0x2cc2d0(0x11f)](_0x3a6733))try{return a43_0xc0621e[_0x2cc2d0(0x13d)](_0x3a6733,_0x2cc2d0(0x153));}catch{}const _0x8e3538=getOldCredentialPath(_0x287567);if(a43_0xc0621e[_0x2cc2d0(0x11f)](_0x8e3538)){console[_0x2cc2d0(0x148)]('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x287567+'\x27'),console[_0x2cc2d0(0x148)](_0x2cc2d0(0x147)),console[_0x2cc2d0(0x148)](_0x2cc2d0(0x113)+_0x8e3538+_0x2cc2d0(0x11a)+_0x3a6733+'\x22'),console[_0x2cc2d0(0x148)](_0x2cc2d0(0x15b));try{return a43_0xc0621e[_0x2cc2d0(0x13d)](_0x8e3538,_0x2cc2d0(0x153));}catch{return null;}}return null;}
1
+ (function(_0x5f5baa,_0x754733){const _0x71b526=a43_0x35e4,_0x3073ec=_0x5f5baa();while(!![]){try{const _0x128988=parseInt(_0x71b526(0x104))/0x1*(parseInt(_0x71b526(0xdc))/0x2)+parseInt(_0x71b526(0xd4))/0x3+parseInt(_0x71b526(0x112))/0x4*(parseInt(_0x71b526(0xf2))/0x5)+parseInt(_0x71b526(0x10a))/0x6*(parseInt(_0x71b526(0xc9))/0x7)+-parseInt(_0x71b526(0x10c))/0x8+-parseInt(_0x71b526(0x108))/0x9*(-parseInt(_0x71b526(0xdd))/0xa)+parseInt(_0x71b526(0xf4))/0xb*(-parseInt(_0x71b526(0xd8))/0xc);if(_0x128988===_0x754733)break;else _0x3073ec['push'](_0x3073ec['shift']());}catch(_0x345749){_0x3073ec['push'](_0x3073ec['shift']());}}}(a43_0x1921,0xa2d1a));import*as a43_0x5aee13 from'node:fs';import*as a43_0x4de5fb from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';export function getProfileParams(_0x4b9e50){const _0x1644ba=a43_0x35e4,_0x238b9b={};if(!_0x4b9e50)return _0x238b9b;for(const [_0x1dafa6,_0x2c9215]of Object[_0x1644ba(0x102)](_0x4b9e50)){_0x1dafa6!==_0x1644ba(0xdf)&&_0x2c9215!==undefined&&(_0x238b9b[_0x1dafa6]=_0x2c9215);}return _0x238b9b;}export function getProfilesDir(){return a43_0x4de5fb['join'](getConfigDir(),'profiles');}function getProfileDir(_0x21c153){const _0x2ec674=a43_0x35e4;return a43_0x4de5fb[_0x2ec674(0xc8)](getProfilesDir(),_0x21c153);}function getProfileConfigPath(_0x5c473d){const _0x4eeb68=a43_0x35e4;return a43_0x4de5fb[_0x4eeb68(0xc8)](getProfileDir(_0x5c473d),_0x4eeb68(0xea));}function getProfileEnvPath(_0x257b50){const _0x4673b8=a43_0x35e4;return a43_0x4de5fb[_0x4673b8(0xc8)](getProfileDir(_0x257b50),_0x4673b8(0xd3));}function getGlobalConfigPath(){const _0x20b2a6=a43_0x35e4;return a43_0x4de5fb[_0x20b2a6(0xc8)](getConfigDir(),_0x20b2a6(0xea));}function validateProfileName(_0x385b0d){const _0x59e3a0=a43_0x35e4;if(!/^[a-zA-Z0-9_-]+$/[_0x59e3a0(0xe2)](_0x385b0d))throw new Error('Invalid\x20profile\x20name:\x20'+_0x385b0d+_0x59e3a0(0x113));}function validateProfileConfig(_0x2d28d2,_0x1f4311){const _0x1a91db=a43_0x35e4;if(typeof _0x2d28d2!==_0x1a91db(0xd7)||_0x2d28d2===null)throw new Error(_0x1a91db(0xf3)+_0x1f4311+_0x1a91db(0xf8));const _0x1b7383=[_0x1a91db(0xdf),'site',_0x1a91db(0xfa),_0x1a91db(0xca),_0x1a91db(0xcb),_0x1a91db(0xcc)],_0x112713=_0x2d28d2;for(const _0x2549b5 of Object[_0x1a91db(0xe8)](_0x112713)){!_0x1b7383[_0x1a91db(0x103)](_0x2549b5)&&console['warn'](_0x1a91db(0xe5)+_0x1f4311+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x2549b5+'\x27\x20will\x20be\x20ignored');}if(_0x112713[_0x1a91db(0xdf)]!==undefined&&typeof _0x112713['description']!==_0x1a91db(0x111))throw new Error(_0x1a91db(0xf3)+_0x1f4311+_0x1a91db(0x107));if(_0x112713['site']!==undefined&&typeof _0x112713[_0x1a91db(0xfc)]!==_0x1a91db(0x111))throw new Error(_0x1a91db(0xf3)+_0x1f4311+_0x1a91db(0xef));if(_0x112713['database']!==undefined&&typeof _0x112713[_0x1a91db(0xfa)]!=='string')throw new Error('Profile\x20\x27'+_0x1f4311+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x112713[_0x1a91db(0xca)]!==undefined&&typeof _0x112713[_0x1a91db(0xca)]!=='string')throw new Error(_0x1a91db(0xf3)+_0x1f4311+_0x1a91db(0xdb));if(_0x112713['llm_project']!==undefined&&typeof _0x112713['llm_project']!==_0x1a91db(0x111))throw new Error(_0x1a91db(0xf3)+_0x1f4311+_0x1a91db(0xd6));if(_0x112713[_0x1a91db(0xcc)]!==undefined&&typeof _0x112713[_0x1a91db(0xcc)]!=='string')throw new Error(_0x1a91db(0xf3)+_0x1f4311+_0x1a91db(0xff));return!![];}function loadProfilesFromTdxJson(_0x335e47,_0x1f645a){const _0x4d627f=a43_0x35e4;if(!a43_0x5aee13[_0x4d627f(0xd9)](_0x335e47))return[];try{const _0x519723=a43_0x5aee13['readFileSync'](_0x335e47,_0x4d627f(0x10b)),_0x439450=JSON['parse'](_0x519723);if(!_0x439450[_0x4d627f(0xee)]||typeof _0x439450[_0x4d627f(0xee)]!==_0x4d627f(0xd7))return[];const _0x482178=[];for(const [_0x3c1edf,_0x308b25]of Object[_0x4d627f(0x102)](_0x439450[_0x4d627f(0xee)])){try{validateProfileConfig(_0x308b25,_0x3c1edf);const _0x4fae01=getNewCredentialPath(_0x3c1edf),_0x493461=getOldCredentialPath(_0x3c1edf),_0x5664fb=a43_0x5aee13[_0x4d627f(0xd9)](_0x4fae01)||a43_0x5aee13[_0x4d627f(0xd9)](_0x493461);_0x482178[_0x4d627f(0xe4)]({'name':_0x3c1edf,'config':_0x308b25,'metadata':{'name':_0x3c1edf,'createdAt':new Date()[_0x4d627f(0xfb)]()},'hasCredentials':_0x5664fb,'scope':_0x1f645a});}catch(_0x5ba741){_0x5ba741 instanceof Error&&(console[_0x4d627f(0x109)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x335e47+':'),console[_0x4d627f(0x109)]('\x20\x20'+_0x5ba741[_0x4d627f(0x110)]+'\x0a'));}}return _0x482178;}catch(_0x39dfb0){return _0x39dfb0 instanceof SyntaxError?(console[_0x4d627f(0x109)](_0x4d627f(0xf0)+_0x335e47+_0x4d627f(0x101)),console[_0x4d627f(0x109)](_0x4d627f(0x106)+_0x39dfb0['message']+'\x0a')):console[_0x4d627f(0x109)](_0x4d627f(0xda)+_0x335e47+':\x20'+_0x39dfb0+'\x0a'),[];}}export function getNewCredentialPath(_0x202a6a){const _0x18ecad=a43_0x35e4;return a43_0x4de5fb[_0x18ecad(0xc8)](getConfigDir(),_0x18ecad(0xf6)+_0x202a6a);}function getOldCredentialPath(_0x566470){return a43_0x4de5fb['join'](getProfilesDir(),_0x566470,'.env');}function loadProfilesFromTdxJsonFiles(){const _0x588a5f=a43_0x35e4,_0x57ad4a=[],_0x44d1f4=findProjectConfigPath();_0x44d1f4&&_0x57ad4a[_0x588a5f(0xe4)](...loadProfilesFromTdxJson(_0x44d1f4,_0x588a5f(0x105)));const _0x3f94ec=a43_0x4de5fb[_0x588a5f(0xc8)](getConfigDir(),_0x588a5f(0xea));return _0x57ad4a[_0x588a5f(0xe4)](...loadProfilesFromTdxJson(_0x3f94ec,_0x588a5f(0xce))),_0x57ad4a;}function loadProfilesFromDirectories(){const _0x4740ab=a43_0x35e4,_0x3857f6=getProfilesDir();if(!a43_0x5aee13[_0x4740ab(0xd9)](_0x3857f6))return[];try{return a43_0x5aee13[_0x4740ab(0xde)](_0x3857f6,{'withFileTypes':!![]})[_0x4740ab(0xf1)](_0x21870d=>_0x21870d[_0x4740ab(0xc7)]())[_0x4740ab(0xe3)](_0x3b7e0c=>_0x3b7e0c['name'])[_0x4740ab(0xf1)](_0x5d2b1c=>{const _0x25a7b4=_0x4740ab,_0xcc6048=getProfileConfigPath(_0x5d2b1c),_0x45575d=getProfileEnvPath(_0x5d2b1c);return a43_0x5aee13[_0x25a7b4(0xd9)](_0xcc6048)||a43_0x5aee13['existsSync'](_0x45575d);})[_0x4740ab(0xe3)](_0x1d6059=>{const _0x4b70bd=_0x4740ab,_0x270258=loadProfileFromDirectory(_0x1d6059);if(_0x270258)return{..._0x270258,'scope':_0x4b70bd(0xe7)};return null;})['filter'](_0xe1d5b2=>_0xe1d5b2!==null);}catch{return[];}}function a43_0x1921(){const _0x179347=['\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','values','isDirectory','join','7VmSwNs','parent_segment','llm_project','llm_agent','\x20\x20mv\x20\x22','user','Warning:\x20Failed\x20to\x20parse\x20','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','length','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','.env','3445641hJkKzl','\x20does\x20not\x20exist','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','object','12CFUphC','existsSync','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','2kpLyaZ','1930920mSOoed','readdirSync','description','\x20already\x20exists','name','test','map','push','Warning:\x20Profile\x20\x27','set','directory','keys','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','tdx.json','profile','has','Profile\x20','profiles','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Failed\x20to\x20parse\x20','filter','145480gOaOHD','Profile\x20\x27','23781373XcwQHG','readFileSync','.env.','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x27:\x20config\x20must\x20be\x20an\x20object','\x20\x201.\x20Edit:\x20','database','toISOString','site','from','some','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','find',':\x20Invalid\x20JSON\x20syntax','entries','includes','759051alvLEA','local','Error:\x20','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','27Wjhvyg','warn','3663978YhuRIe','utf-8','7503168McCkrp','parse','rmSync','\x22\x20\x22','message','string','92QCmrwk','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.'];a43_0x1921=function(){return _0x179347;};return a43_0x1921();}function a43_0x35e4(_0x469093,_0x479b58){const _0x192118=a43_0x1921();return a43_0x35e4=function(_0x35e466,_0xd83346){_0x35e466=_0x35e466-0xc6;let _0x24b079=_0x192118[_0x35e466];return _0x24b079;},a43_0x35e4(_0x469093,_0x479b58);}function loadProfileFromDirectory(_0x3112ae){const _0x21be8b=a43_0x35e4,_0xaab653=getProfileConfigPath(_0x3112ae),_0x10fe4e=getOldCredentialPath(_0x3112ae);if(!a43_0x5aee13[_0x21be8b(0xd9)](_0xaab653)&&!a43_0x5aee13[_0x21be8b(0xd9)](_0x10fe4e))return null;let _0x31d781={},_0x291599={'name':_0x3112ae,'createdAt':new Date()['toISOString']()};if(a43_0x5aee13[_0x21be8b(0xd9)](_0xaab653))try{const _0x4941f0=a43_0x5aee13[_0x21be8b(0xf5)](_0xaab653,'utf-8'),_0xcde0ba=JSON[_0x21be8b(0x10d)](_0x4941f0),{metadata:_0x5cfac9,..._0x49de63}=_0xcde0ba;_0x31d781=_0x49de63,_0x5cfac9&&(_0x291599=_0x5cfac9);}catch{}return{'name':_0x3112ae,'config':_0x31d781,'metadata':_0x291599,'hasCredentials':a43_0x5aee13[_0x21be8b(0xd9)](_0x10fe4e),'scope':_0x21be8b(0xe7)};}export function listProfiles(){const _0x42ee6c=a43_0x35e4,_0x215793=loadProfilesFromTdxJsonFiles(),_0x5c748c=loadProfilesFromDirectories();if(_0x5c748c[_0x42ee6c(0xd1)]>0x0){const _0x6d5d8a=_0x5c748c['map'](_0x4a2e8f=>_0x4a2e8f[_0x42ee6c(0xe1)])[_0x42ee6c(0xc8)](',\x20'),_0x4fa29c=getConfigDir();console['warn'](_0x42ee6c(0xd0)+_0x6d5d8a),console[_0x42ee6c(0x109)](_0x42ee6c(0xd2)),console[_0x42ee6c(0x109)](_0x42ee6c(0xf9)+a43_0x4de5fb[_0x42ee6c(0xc8)](_0x4fa29c,_0x42ee6c(0xea))),console['warn'](_0x42ee6c(0x114)),console[_0x42ee6c(0x109)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x3a4a43=[..._0x215793,..._0x5c748c],_0x927848=new Map();for(const _0x12c92b of _0x3a4a43){!_0x927848[_0x42ee6c(0xec)](_0x12c92b[_0x42ee6c(0xe1)])&&_0x927848[_0x42ee6c(0xe6)](_0x12c92b[_0x42ee6c(0xe1)],_0x12c92b);}return Array[_0x42ee6c(0xfd)](_0x927848[_0x42ee6c(0xc6)]())['sort']((_0x4c1113,_0x1f5018)=>_0x4c1113['name']['localeCompare'](_0x1f5018['name']));}export function profileExists(_0x33b928){const _0x204c9d=a43_0x35e4,_0x3deeda=listProfiles();return _0x3deeda[_0x204c9d(0xfe)](_0x425248=>_0x425248['name']===_0x33b928);}export function loadProfile(_0x1e5fe3){const _0x45eb64=a43_0x35e4;validateProfileName(_0x1e5fe3);const _0xd322d4=listProfiles(),_0x5933e2=_0xd322d4[_0x45eb64(0x100)](_0x5b6e44=>_0x5b6e44[_0x45eb64(0xe1)]===_0x1e5fe3);return _0x5933e2||null;}export function saveProfile(_0x342f30,_0x35c432,_0x542b65=![]){saveProfileToUserConfig(_0x342f30,_0x35c432);}export function deleteProfile(_0x81a362){const _0x3aa0bd=a43_0x35e4;validateProfileName(_0x81a362);const _0x41aff8=getProfileDir(_0x81a362);if(!a43_0x5aee13['existsSync'](_0x41aff8))throw new Error(_0x3aa0bd(0xed)+_0x81a362+_0x3aa0bd(0xd5));a43_0x5aee13[_0x3aa0bd(0x10e)](_0x41aff8,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x427dea,_0x4f86f7){const _0xc7d87e=a43_0x35e4;validateProfileName(_0x427dea);const _0x497042=getGlobalConfigPath(),_0x4950c4=getConfigDir();!a43_0x5aee13[_0xc7d87e(0xd9)](_0x4950c4)&&createSecureDirectory(_0x4950c4);let _0x5a1b92={};if(a43_0x5aee13[_0xc7d87e(0xd9)](_0x497042))try{const _0x324676=a43_0x5aee13[_0xc7d87e(0xf5)](_0x497042,'utf-8');_0x5a1b92=JSON['parse'](_0x324676);}catch{console['warn'](_0xc7d87e(0xcf)+_0x497042+',\x20creating\x20new\x20file');}!_0x5a1b92[_0xc7d87e(0xee)]&&(_0x5a1b92[_0xc7d87e(0xee)]={}),_0x5a1b92[_0xc7d87e(0xee)][_0x427dea]=_0x4f86f7,writeSecureFile(_0x497042,JSON['stringify'](_0x5a1b92,null,0x2));}export function getActiveProfile(){const _0x2a9937=a43_0x35e4,_0xc1a0a4=getGlobalConfigPath();if(!a43_0x5aee13[_0x2a9937(0xd9)](_0xc1a0a4))return null;try{const _0x4ca27f=a43_0x5aee13[_0x2a9937(0xf5)](_0xc1a0a4,'utf-8'),_0x202fe9=JSON[_0x2a9937(0x10d)](_0x4ca27f);return _0x202fe9[_0x2a9937(0xeb)]||null;}catch{return null;}}export function createProfile(_0x273703,_0x16a187){const _0x17fe43=a43_0x35e4;validateProfileName(_0x273703);if(profileExists(_0x273703))throw new Error(_0x17fe43(0xed)+_0x273703+_0x17fe43(0xe0));saveProfile(_0x273703,_0x16a187);}export function saveProfileCredentials(_0x3a0dba,_0x342d29){const _0x515178=a43_0x35e4;validateProfileName(_0x3a0dba);if(!profileExists(_0x3a0dba))throw new Error(_0x515178(0xed)+_0x3a0dba+'\x20does\x20not\x20exist');const _0x569d1b=getNewCredentialPath(_0x3a0dba);writeSecureFile(_0x569d1b,_0x342d29);}export function loadProfileCredentials(_0x373d17){const _0x3a4e1b=a43_0x35e4;validateProfileName(_0x373d17);const _0x54f20e=getNewCredentialPath(_0x373d17);if(a43_0x5aee13[_0x3a4e1b(0xd9)](_0x54f20e))try{return a43_0x5aee13['readFileSync'](_0x54f20e,'utf-8');}catch{}const _0x1e957f=getOldCredentialPath(_0x373d17);if(a43_0x5aee13['existsSync'](_0x1e957f)){console['warn'](_0x3a4e1b(0xf7)+_0x373d17+'\x27'),console[_0x3a4e1b(0x109)]('To\x20migrate:'),console[_0x3a4e1b(0x109)](_0x3a4e1b(0xcd)+_0x1e957f+_0x3a4e1b(0x10f)+_0x54f20e+'\x22'),console[_0x3a4e1b(0x109)](_0x3a4e1b(0xe9));try{return a43_0x5aee13[_0x3a4e1b(0xf5)](_0x1e957f,_0x3a4e1b(0x10b));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- function a44_0x31fa(_0x4d940e,_0xfc22fe){const _0x2c6531=a44_0x2c65();return a44_0x31fa=function(_0x31fa2d,_0x3ac7fa){_0x31fa2d=_0x31fa2d-0x197;let _0xa04eb8=_0x2c6531[_0x31fa2d];return _0xa04eb8;},a44_0x31fa(_0x4d940e,_0xfc22fe);}(function(_0x57128b,_0x1c18d4){const _0x1bd52e=a44_0x31fa,_0x2b0aea=_0x57128b();while(!![]){try{const _0x14c2c5=parseInt(_0x1bd52e(0x1ad))/0x1*(-parseInt(_0x1bd52e(0x1b0))/0x2)+parseInt(_0x1bd52e(0x19a))/0x3+parseInt(_0x1bd52e(0x1af))/0x4+parseInt(_0x1bd52e(0x1a7))/0x5+-parseInt(_0x1bd52e(0x1b2))/0x6+parseInt(_0x1bd52e(0x1a5))/0x7+-parseInt(_0x1bd52e(0x1aa))/0x8*(-parseInt(_0x1bd52e(0x1a4))/0x9);if(_0x14c2c5===_0x1c18d4)break;else _0x2b0aea['push'](_0x2b0aea['shift']());}catch(_0x30fa7d){_0x2b0aea['push'](_0x2b0aea['shift']());}}}(a44_0x2c65,0x3c8a4));import*as a44_0x1a6074 from'node:fs';import*as a44_0x9c0644 from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x36fe2b){const _0x3b2ff4=a44_0x31fa;let _0xff981a=_0x36fe2b||process[_0x3b2ff4(0x1a1)]();while(!![]){const _0x2344ee=a44_0x9c0644[_0x3b2ff4(0x19e)](_0xff981a,PROJECT_CONFIG_FILENAME);if(a44_0x1a6074['existsSync'](_0x2344ee))return _0x2344ee;const _0xce6bdd=a44_0x9c0644[_0x3b2ff4(0x198)](_0xff981a);if(_0xce6bdd===_0xff981a)return null;_0xff981a=_0xce6bdd;}}export function loadProjectConfig(_0x2db784){const _0x236542=a44_0x31fa,_0x30eb14=findProjectConfigPath(_0x2db784);if(!_0x30eb14)return null;try{const _0x30a5b2=a44_0x1a6074[_0x236542(0x1b4)](_0x30eb14,_0x236542(0x19f)),_0x41be09=JSON[_0x236542(0x197)](_0x30a5b2),_0x4ee49c=JSON[_0x236542(0x1ac)](_0x41be09);if(_0x4ee49c[_0x236542(0x1a3)](_0x236542(0x1ab))||_0x4ee49c[_0x236542(0x1a3)](_0x236542(0x19d))||_0x4ee49c[_0x236542(0x1a3)]('api_key'))throw new Error(_0x236542(0x1a0)+_0x30eb14+_0x236542(0x1b3)+_0x236542(0x1b1));const {metadata:_0xa94c69,profile:_0x1520f4,..._0x493af1}=_0x41be09;return _0x1520f4&&console[_0x236542(0x199)]('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x30eb14+_0x236542(0x19c)+_0x236542(0x19b)),_0x493af1;}catch(_0x416293){if(_0x416293 instanceof Error&&_0x236542(0x1ae)in _0x416293&&_0x416293[_0x236542(0x1ae)]==='ENOENT')return null;throw new Error(_0x236542(0x1a9)+_0x30eb14+':\x20'+_0x416293);}}export function saveProjectConfig(_0x31b992,_0x3574d4){const _0x1e5615=a44_0x31fa,_0x223393=_0x3574d4||process[_0x1e5615(0x1a1)](),_0x36bd22=a44_0x9c0644[_0x1e5615(0x19e)](_0x223393,PROJECT_CONFIG_FILENAME),_0x537ffd=JSON['stringify'](_0x31b992);if(_0x537ffd[_0x1e5615(0x1a3)](_0x1e5615(0x1ab))||_0x537ffd[_0x1e5615(0x1a3)](_0x1e5615(0x19d))||_0x537ffd[_0x1e5615(0x1a3)](_0x1e5615(0x1a8)))throw new Error(_0x1e5615(0x1a6));if('profile'in _0x31b992)throw new Error(_0x1e5615(0x1b5));a44_0x1a6074[_0x1e5615(0x1a2)](_0x36bd22,JSON[_0x1e5615(0x1ac)](_0x31b992,null,0x2));}function a44_0x2c65(){const _0x3c1af4=['43866vMvBff','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','\x20is\x20ignored.\x20','apiKey','join','utf-8','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','cwd','writeFileSync','includes','2237913bBwDrE','1232805DXOlgO','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','1468035OqsAno','api_key','Failed\x20to\x20load\x20project\x20config\x20from\x20','8Ydtdhc','TD_API_KEY','stringify','13NaVCAP','code','251468jHCyoD','13814soiedU','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','2748630RFYTxI',').\x20','readFileSync','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','parse','dirname','warn'];a44_0x2c65=function(){return _0x3c1af4;};return a44_0x2c65();}export function hasProjectConfig(_0x3900b7){return findProjectConfigPath(_0x3900b7)!==null;}export function getProjectRoot(_0xa66518){const _0x557f30=a44_0x31fa,_0x41adca=findProjectConfigPath(_0xa66518);return _0x41adca?a44_0x9c0644[_0x557f30(0x198)](_0x41adca):null;}
1
+ const a44_0xc2714d=a44_0x5869;(function(_0x226131,_0x4811c8){const _0xe6a9b8=a44_0x5869,_0x1e7af5=_0x226131();while(!![]){try{const _0x4ed438=parseInt(_0xe6a9b8(0x128))/0x1*(parseInt(_0xe6a9b8(0x11f))/0x2)+-parseInt(_0xe6a9b8(0x127))/0x3+parseInt(_0xe6a9b8(0x132))/0x4*(parseInt(_0xe6a9b8(0x133))/0x5)+parseInt(_0xe6a9b8(0x122))/0x6*(parseInt(_0xe6a9b8(0x130))/0x7)+-parseInt(_0xe6a9b8(0x13b))/0x8*(parseInt(_0xe6a9b8(0x11b))/0x9)+-parseInt(_0xe6a9b8(0x12f))/0xa*(-parseInt(_0xe6a9b8(0x131))/0xb)+-parseInt(_0xe6a9b8(0x138))/0xc*(parseInt(_0xe6a9b8(0x12d))/0xd);if(_0x4ed438===_0x4811c8)break;else _0x1e7af5['push'](_0x1e7af5['shift']());}catch(_0x597cf2){_0x1e7af5['push'](_0x1e7af5['shift']());}}}(a44_0x5c66,0x7fe17));import*as a44_0x3d77c5 from'node:fs';function a44_0x5869(_0x3ef1ed,_0x2e8523){const _0x5c6652=a44_0x5c66();return a44_0x5869=function(_0x586965,_0x416e64){_0x586965=_0x586965-0x11b;let _0x4c5c76=_0x5c6652[_0x586965];return _0x4c5c76;},a44_0x5869(_0x3ef1ed,_0x2e8523);}import*as a44_0x306ff7 from'node:path';const PROJECT_CONFIG_FILENAME=a44_0xc2714d(0x13c);export function findProjectConfigPath(_0xa68b31){const _0x430435=a44_0xc2714d;let _0x5a9e10=_0xa68b31||process[_0x430435(0x125)]();while(!![]){const _0x33e940=a44_0x306ff7[_0x430435(0x134)](_0x5a9e10,PROJECT_CONFIG_FILENAME);if(a44_0x3d77c5[_0x430435(0x123)](_0x33e940))return _0x33e940;const _0x230369=a44_0x306ff7['dirname'](_0x5a9e10);if(_0x230369===_0x5a9e10)return null;_0x5a9e10=_0x230369;}}export function loadProjectConfig(_0x1e6da6){const _0x3a7a5b=a44_0xc2714d,_0x3a34a4=findProjectConfigPath(_0x1e6da6);if(!_0x3a34a4)return null;try{const _0x5d03b9=a44_0x3d77c5[_0x3a7a5b(0x12c)](_0x3a34a4,_0x3a7a5b(0x13f)),_0x5a99f7=JSON[_0x3a7a5b(0x129)](_0x5d03b9),_0x3edc64=JSON[_0x3a7a5b(0x12e)](_0x5a99f7);if(_0x3edc64[_0x3a7a5b(0x126)](_0x3a7a5b(0x13a))||_0x3edc64[_0x3a7a5b(0x126)]('apiKey')||_0x3edc64[_0x3a7a5b(0x126)]('api_key'))throw new Error(_0x3a7a5b(0x13e)+_0x3a34a4+').\x20'+_0x3a7a5b(0x11c));const {metadata:_0x1ba09b,profile:_0x576a8f,..._0x361485}=_0x5a99f7;return _0x576a8f&&console[_0x3a7a5b(0x12b)](_0x3a7a5b(0x136)+_0x3a34a4+_0x3a7a5b(0x13d)+_0x3a7a5b(0x121)),_0x361485;}catch(_0x5e18c9){if(_0x5e18c9 instanceof Error&&_0x3a7a5b(0x12a)in _0x5e18c9&&_0x5e18c9['code']===_0x3a7a5b(0x120))return null;throw new Error(_0x3a7a5b(0x139)+_0x3a34a4+':\x20'+_0x5e18c9);}}function a44_0x5c66(){const _0xec0664=['dirname','279156dbLxpt','Failed\x20to\x20load\x20project\x20config\x20from\x20','TD_API_KEY','380248XQHgBq','tdx.json','\x20is\x20ignored.\x20','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','utf-8','144vFJdwr','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','writeFileSync','profile','155018RgROCg','ENOENT','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','1986612jlkMmw','existsSync','api_key','cwd','includes','1837791SifvMM','11DATaGj','parse','code','warn','readFileSync','286spoCPf','stringify','1190jOkMUw','7gmDtOj','41954jswQJq','280404tmyrca','55buCsOn','join','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','Warning:\x20\x27profile\x27\x20field\x20in\x20'];a44_0x5c66=function(){return _0xec0664;};return a44_0x5c66();}export function saveProjectConfig(_0x3f9709,_0x2d095d){const _0x20347d=a44_0xc2714d,_0x4c864e=_0x2d095d||process[_0x20347d(0x125)](),_0x34a6a1=a44_0x306ff7[_0x20347d(0x134)](_0x4c864e,PROJECT_CONFIG_FILENAME),_0x3c4345=JSON['stringify'](_0x3f9709);if(_0x3c4345[_0x20347d(0x126)]('TD_API_KEY')||_0x3c4345[_0x20347d(0x126)]('apiKey')||_0x3c4345[_0x20347d(0x126)](_0x20347d(0x124)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x20347d(0x11e)in _0x3f9709)throw new Error(_0x20347d(0x135));a44_0x3d77c5[_0x20347d(0x11d)](_0x34a6a1,JSON[_0x20347d(0x12e)](_0x3f9709,null,0x2));}export function hasProjectConfig(_0x495585){return findProjectConfigPath(_0x495585)!==null;}export function getProjectRoot(_0x2a73a3){const _0x1fc538=a44_0xc2714d,_0x167841=findProjectConfigPath(_0x2a73a3);return _0x167841?a44_0x306ff7[_0x1fc538(0x137)](_0x167841):null;}
@@ -1 +1 @@
1
- (function(_0x1eaa09,_0x122046){const _0x4af7b7=a45_0x141e,_0x2815cd=_0x1eaa09();while(!![]){try{const _0x1d3cde=parseInt(_0x4af7b7(0x1df))/0x1*(-parseInt(_0x4af7b7(0x1f4))/0x2)+parseInt(_0x4af7b7(0x1f5))/0x3+-parseInt(_0x4af7b7(0x1f9))/0x4*(-parseInt(_0x4af7b7(0x1e6))/0x5)+parseInt(_0x4af7b7(0x1e8))/0x6*(parseInt(_0x4af7b7(0x1e5))/0x7)+-parseInt(_0x4af7b7(0x1fe))/0x8+parseInt(_0x4af7b7(0x1f6))/0x9*(parseInt(_0x4af7b7(0x204))/0xa)+-parseInt(_0x4af7b7(0x202))/0xb;if(_0x1d3cde===_0x122046)break;else _0x2815cd['push'](_0x2815cd['shift']());}catch(_0x53725d){_0x2815cd['push'](_0x2815cd['shift']());}}}(a45_0x3a6f,0x47d6c));import*as a45_0x5a9b7c from'node:fs';import*as a45_0x53c0f7 from'node:path';import*as a45_0x12de29 from'node:os';function a45_0x3a6f(){const _0x2ad5f1=['push','toString','116cwWrYi','readFileSync','.config','now','tdx','3291760vUwQSf','TDX_CONFIG_DIR','writeFileSync','readdirSync','1610917NELWTZ','unlinkSync','24230mbfcim','includes','.\x20This\x20is\x20insecure.\x20Removing\x20session.','utf-8','toISOString','205OAEvJX','test','endsWith','warn','homedir','sort','620382BGElrE','85685fhEasP','getTime','6RylChT','existsSync','apiKey','env','replace','api_key','.json','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','join','sessions','TD_API_KEY','parse','942gibqhu','864036mOaSTq','279jsqgJC'];a45_0x3a6f=function(){return _0x2ad5f1;};return a45_0x3a6f();}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 _0x34cfa8=a45_0x141e,_0x36ad9a=process[_0x34cfa8(0x1eb)][_0x34cfa8(0x1ff)]||a45_0x53c0f7[_0x34cfa8(0x1f0)](a45_0x12de29[_0x34cfa8(0x1e3)](),_0x34cfa8(0x1fb),_0x34cfa8(0x1fd));return a45_0x53c0f7[_0x34cfa8(0x1f0)](_0x36ad9a,_0x34cfa8(0x1f1));}function getSessionPath(_0x48f015){const _0x3b7941=a45_0x141e;return a45_0x53c0f7['join'](getSessionsDir(),_0x48f015+_0x3b7941(0x1ee));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x2366c7){if(_0x2366c7)return _0x2366c7;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x5cb12f){const _0x322063=a45_0x141e,_0x122442=_0x5cb12f||getCurrentSessionPID()[_0x322063(0x1f8)](),_0x12d35d=/^\d+$/['test'](_0x122442)?parseInt(_0x122442,0xa):null;return _0x12d35d!==null?loadSessionContextByPID(_0x12d35d):loadSessionContextByString(_0x122442);}export function loadSessionContextByPID(_0x56e7a9){const _0x298256=a45_0x141e,_0x3c2884=getSessionPath(_0x56e7a9);if(!a45_0x5a9b7c[_0x298256(0x1e9)](_0x3c2884))return null;try{const _0x1b42a6=a45_0x5a9b7c['readFileSync'](_0x3c2884,_0x298256(0x1dd)),_0x20a890=JSON['parse'](_0x1b42a6),_0x164bbd=new Date(_0x20a890['createdAt'])[_0x298256(0x1e7)](),_0x1867fe=Date[_0x298256(0x1fc)]();if(_0x1867fe-_0x164bbd>SESSION_EXPIRATION_MS)return a45_0x5a9b7c[_0x298256(0x203)](_0x3c2884),null;const _0x5372f7=JSON['stringify'](_0x20a890);if(_0x5372f7[_0x298256(0x205)]('TD_API_KEY')||_0x5372f7[_0x298256(0x205)](_0x298256(0x1ea))||_0x5372f7[_0x298256(0x205)](_0x298256(0x1ed)))return console[_0x298256(0x1e2)](_0x298256(0x1ef)+_0x3c2884+_0x298256(0x1dc)),a45_0x5a9b7c[_0x298256(0x203)](_0x3c2884),null;return _0x20a890;}catch{try{a45_0x5a9b7c['unlinkSync'](_0x3c2884);}catch{}return null;}}function loadSessionContextByString(_0x159c6c){const _0x558801=a45_0x141e,_0x59ac59=a45_0x53c0f7[_0x558801(0x1f0)](getSessionsDir(),_0x159c6c+_0x558801(0x1ee));if(!a45_0x5a9b7c[_0x558801(0x1e9)](_0x59ac59))return null;try{const _0x10ecae=a45_0x5a9b7c[_0x558801(0x1fa)](_0x59ac59,_0x558801(0x1dd)),_0x484d7d=JSON[_0x558801(0x1f3)](_0x10ecae),_0x490432=new Date(_0x484d7d['createdAt'])['getTime'](),_0xd7c03c=Date[_0x558801(0x1fc)]();if(_0xd7c03c-_0x490432>SESSION_EXPIRATION_MS)return a45_0x5a9b7c[_0x558801(0x203)](_0x59ac59),null;const _0x3320d5=JSON['stringify'](_0x484d7d);if(_0x3320d5['includes'](_0x558801(0x1f2))||_0x3320d5[_0x558801(0x205)](_0x558801(0x1ea))||_0x3320d5[_0x558801(0x205)](_0x558801(0x1ed)))return console['warn'](_0x558801(0x1ef)+_0x59ac59+_0x558801(0x1dc)),a45_0x5a9b7c['unlinkSync'](_0x59ac59),null;return _0x484d7d;}catch{try{a45_0x5a9b7c[_0x558801(0x203)](_0x59ac59);}catch{}return null;}}function a45_0x141e(_0x407c4d,_0x417f31){const _0x3a6fd6=a45_0x3a6f();return a45_0x141e=function(_0x141e84,_0x3d290c){_0x141e84=_0x141e84-0x1dc;let _0xbb4ea1=_0x3a6fd6[_0x141e84];return _0xbb4ea1;},a45_0x141e(_0x407c4d,_0x417f31);}export function saveSessionContext(_0x4153ae,_0x47062a){const _0x32f4e7=a45_0x141e,_0x5834f4=_0x47062a||getCurrentSessionPID()[_0x32f4e7(0x1f8)](),_0x55a2b5=/^\d+$/[_0x32f4e7(0x1e0)](_0x5834f4)?parseInt(_0x5834f4,0xa):getCurrentSessionPID(),_0x19e9e0=a45_0x53c0f7['join'](getSessionsDir(),_0x5834f4+_0x32f4e7(0x1ee)),_0x51221c=getSessionsDir();createSecureDirectory(_0x51221c);const _0x47b798=JSON['stringify'](_0x4153ae);if(_0x47b798['includes'](_0x32f4e7(0x1f2))||_0x47b798[_0x32f4e7(0x205)](_0x32f4e7(0x1ea))||_0x47b798['includes']('api_key'))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x16b899;const _0x192038=/^\d+$/[_0x32f4e7(0x1e0)](_0x5834f4)?loadSessionContextByPID(parseInt(_0x5834f4,0xa)):loadSessionContextByString(_0x5834f4);_0x192038?_0x16b899={..._0x192038,..._0x4153ae,'pid':_0x55a2b5,'sessionId':_0x5834f4!==_0x55a2b5['toString']()?_0x5834f4:undefined,'updatedAt':new Date()[_0x32f4e7(0x1de)]()}:_0x16b899={'pid':_0x55a2b5,'sessionId':_0x5834f4!==_0x55a2b5[_0x32f4e7(0x1f8)]()?_0x5834f4:undefined,..._0x4153ae,'createdAt':new Date()[_0x32f4e7(0x1de)](),'updatedAt':new Date()['toISOString']()},a45_0x5a9b7c[_0x32f4e7(0x200)](_0x19e9e0,JSON['stringify'](_0x16b899,null,0x2));}export function clearSessionContext(_0x21cd6c){const _0x11f678=a45_0x141e,_0x194db4=_0x21cd6c||getCurrentSessionPID()[_0x11f678(0x1f8)](),_0x298975=a45_0x53c0f7[_0x11f678(0x1f0)](getSessionsDir(),_0x194db4+_0x11f678(0x1ee));a45_0x5a9b7c['existsSync'](_0x298975)&&a45_0x5a9b7c[_0x11f678(0x203)](_0x298975);}export function cleanExpiredSessions(){const _0x323f7e=a45_0x141e,_0x2b7a77=getSessionsDir();if(!a45_0x5a9b7c[_0x323f7e(0x1e9)](_0x2b7a77))return 0x0;let _0x5755bf=0x0;const _0x1cd189=Date[_0x323f7e(0x1fc)]();try{const _0x53e4d1=a45_0x5a9b7c[_0x323f7e(0x201)](_0x2b7a77);for(const _0xb22e70 of _0x53e4d1){if(!_0xb22e70[_0x323f7e(0x1e1)]('.json'))continue;const _0x5c87b2=a45_0x53c0f7[_0x323f7e(0x1f0)](_0x2b7a77,_0xb22e70),_0x900375=_0xb22e70[_0x323f7e(0x1ec)](_0x323f7e(0x1ee),''),_0x5e2d7d=parseInt(_0x900375,0xa),_0xc8ed90=!isNaN(_0x5e2d7d);if(_0xc8ed90){if(!isProcessRunning(_0x5e2d7d)){a45_0x5a9b7c[_0x323f7e(0x203)](_0x5c87b2),_0x5755bf++;continue;}}try{const _0x561153=a45_0x5a9b7c[_0x323f7e(0x1fa)](_0x5c87b2,_0x323f7e(0x1dd)),_0x123792=JSON[_0x323f7e(0x1f3)](_0x561153),_0x2c6b3a=new Date(_0x123792['createdAt'])[_0x323f7e(0x1e7)]();_0x1cd189-_0x2c6b3a>SESSION_EXPIRATION_MS&&(a45_0x5a9b7c[_0x323f7e(0x203)](_0x5c87b2),_0x5755bf++);}catch{a45_0x5a9b7c['unlinkSync'](_0x5c87b2),_0x5755bf++;}}}catch{}return _0x5755bf;}export function listActiveSessions(){const _0x336461=a45_0x141e,_0x117a92=getSessionsDir();if(!a45_0x5a9b7c[_0x336461(0x1e9)](_0x117a92))return[];try{const _0x5a0a9a=a45_0x5a9b7c[_0x336461(0x201)](_0x117a92),_0x5d222d=[];for(const _0x5ce8d0 of _0x5a0a9a){if(!_0x5ce8d0['endsWith']('.json'))continue;const _0x3a172e=_0x5ce8d0[_0x336461(0x1ec)](_0x336461(0x1ee),''),_0x25a199=parseInt(_0x3a172e,0xa);!isNaN(_0x25a199)&&isProcessRunning(_0x25a199)&&_0x5d222d[_0x336461(0x1f7)](_0x25a199);}return _0x5d222d[_0x336461(0x1e4)]((_0x1e45e0,_0x3d4c50)=>_0x1e45e0-_0x3d4c50);}catch{return[];}}
1
+ (function(_0x3b7435,_0x1c0ae1){const _0x4572cd=a45_0x48d5,_0x527d49=_0x3b7435();while(!![]){try{const _0x1a603b=-parseInt(_0x4572cd(0xdc))/0x1+parseInt(_0x4572cd(0xce))/0x2+-parseInt(_0x4572cd(0xb9))/0x3+parseInt(_0x4572cd(0xd8))/0x4+-parseInt(_0x4572cd(0xd2))/0x5+parseInt(_0x4572cd(0xc0))/0x6*(-parseInt(_0x4572cd(0xdb))/0x7)+-parseInt(_0x4572cd(0xcd))/0x8*(-parseInt(_0x4572cd(0xc6))/0x9);if(_0x1a603b===_0x1c0ae1)break;else _0x527d49['push'](_0x527d49['shift']());}catch(_0x213f0b){_0x527d49['push'](_0x527d49['shift']());}}}(a45_0x5692,0xefdb1));import*as a45_0x136682 from'node:fs';import*as a45_0x7a3742 from'node:path';import*as a45_0x2f9259 from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x362588=a45_0x48d5,_0x5ee59a=process[_0x362588(0xbb)][_0x362588(0xd7)]||a45_0x7a3742[_0x362588(0xbd)](a45_0x2f9259[_0x362588(0xc1)](),_0x362588(0xdd),_0x362588(0xd1));return a45_0x7a3742['join'](_0x5ee59a,_0x362588(0xda));}function getSessionPath(_0x5ee476){const _0x1ebd2f=a45_0x48d5;return a45_0x7a3742[_0x1ebd2f(0xbd)](getSessionsDir(),_0x5ee476+_0x1ebd2f(0xba));}export function getCurrentSessionPID(){return getPPID();}function a45_0x48d5(_0x273464,_0x3e7472){const _0x56921f=a45_0x5692();return a45_0x48d5=function(_0x48d5ed,_0x2800af){_0x48d5ed=_0x48d5ed-0xb6;let _0xf1b95a=_0x56921f[_0x48d5ed];return _0xf1b95a;},a45_0x48d5(_0x273464,_0x3e7472);}function a45_0x5692(){const _0x18819c=['API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','stringify','replace','warn','parse','existsSync','13965656FUzGfC','3161032pizZVi','endsWith','test','tdx','4309680giPGxY','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','sort','TD_API_KEY','includes','TDX_CONFIG_DIR','4564776caybwO','toString','sessions','1583211wccAWV','524302ZXxRxA','.config','api_key','now','toISOString','.\x20This\x20is\x20insecure.\x20Removing\x20session.','unlinkSync','5617671qfmhji','.json','env','push','join','apiKey','readFileSync','6JrIXjk','homedir','utf-8','getTime','createdAt','readdirSync','9MdnrFi'];a45_0x5692=function(){return _0x18819c;};return a45_0x5692();}export function getSessionID(_0x41550f){const _0x21ded4=a45_0x48d5;if(_0x41550f)return _0x41550f;return getCurrentSessionPID()[_0x21ded4(0xd9)]();}export function loadSessionContext(_0x29cf00){const _0x1e82da=a45_0x48d5,_0xd929d6=_0x29cf00||getCurrentSessionPID()['toString'](),_0x2cf9ae=/^\d+$/[_0x1e82da(0xd0)](_0xd929d6)?parseInt(_0xd929d6,0xa):null;return _0x2cf9ae!==null?loadSessionContextByPID(_0x2cf9ae):loadSessionContextByString(_0xd929d6);}export function loadSessionContextByPID(_0x2f5ad8){const _0x4856e6=a45_0x48d5,_0x5053ae=getSessionPath(_0x2f5ad8);if(!a45_0x136682['existsSync'](_0x5053ae))return null;try{const _0x2bf930=a45_0x136682[_0x4856e6(0xbf)](_0x5053ae,'utf-8'),_0x4742a4=JSON[_0x4856e6(0xcb)](_0x2bf930),_0x4c3914=new Date(_0x4742a4['createdAt'])[_0x4856e6(0xc3)](),_0x155e62=Date[_0x4856e6(0xdf)]();if(_0x155e62-_0x4c3914>SESSION_EXPIRATION_MS)return a45_0x136682[_0x4856e6(0xb8)](_0x5053ae),null;const _0x26c0a4=JSON[_0x4856e6(0xc8)](_0x4742a4);if(_0x26c0a4[_0x4856e6(0xd6)]('TD_API_KEY')||_0x26c0a4[_0x4856e6(0xd6)](_0x4856e6(0xbe))||_0x26c0a4[_0x4856e6(0xd6)](_0x4856e6(0xde)))return console[_0x4856e6(0xca)](_0x4856e6(0xd3)+_0x5053ae+_0x4856e6(0xb7)),a45_0x136682[_0x4856e6(0xb8)](_0x5053ae),null;return _0x4742a4;}catch{try{a45_0x136682[_0x4856e6(0xb8)](_0x5053ae);}catch{}return null;}}function loadSessionContextByString(_0x4054f4){const _0x4fe256=a45_0x48d5,_0x296859=a45_0x7a3742[_0x4fe256(0xbd)](getSessionsDir(),_0x4054f4+_0x4fe256(0xba));if(!a45_0x136682[_0x4fe256(0xcc)](_0x296859))return null;try{const _0x220980=a45_0x136682[_0x4fe256(0xbf)](_0x296859,'utf-8'),_0x5b3267=JSON[_0x4fe256(0xcb)](_0x220980),_0x4be52a=new Date(_0x5b3267[_0x4fe256(0xc4)])[_0x4fe256(0xc3)](),_0x364062=Date[_0x4fe256(0xdf)]();if(_0x364062-_0x4be52a>SESSION_EXPIRATION_MS)return a45_0x136682[_0x4fe256(0xb8)](_0x296859),null;const _0x5a9862=JSON[_0x4fe256(0xc8)](_0x5b3267);if(_0x5a9862[_0x4fe256(0xd6)](_0x4fe256(0xd5))||_0x5a9862[_0x4fe256(0xd6)](_0x4fe256(0xbe))||_0x5a9862[_0x4fe256(0xd6)](_0x4fe256(0xde)))return console[_0x4fe256(0xca)](_0x4fe256(0xd3)+_0x296859+_0x4fe256(0xb7)),a45_0x136682[_0x4fe256(0xb8)](_0x296859),null;return _0x5b3267;}catch{try{a45_0x136682[_0x4fe256(0xb8)](_0x296859);}catch{}return null;}}export function saveSessionContext(_0x4e47c5,_0x577705){const _0x133496=a45_0x48d5,_0x42e477=_0x577705||getCurrentSessionPID()[_0x133496(0xd9)](),_0x11beb3=/^\d+$/['test'](_0x42e477)?parseInt(_0x42e477,0xa):getCurrentSessionPID(),_0x134ae5=a45_0x7a3742[_0x133496(0xbd)](getSessionsDir(),_0x42e477+_0x133496(0xba)),_0x4f4a55=getSessionsDir();createSecureDirectory(_0x4f4a55);const _0xda2160=JSON[_0x133496(0xc8)](_0x4e47c5);if(_0xda2160[_0x133496(0xd6)](_0x133496(0xd5))||_0xda2160['includes']('apiKey')||_0xda2160[_0x133496(0xd6)](_0x133496(0xde)))throw new Error(_0x133496(0xc7));let _0x31147f;const _0x246012=/^\d+$/[_0x133496(0xd0)](_0x42e477)?loadSessionContextByPID(parseInt(_0x42e477,0xa)):loadSessionContextByString(_0x42e477);_0x246012?_0x31147f={..._0x246012,..._0x4e47c5,'pid':_0x11beb3,'sessionId':_0x42e477!==_0x11beb3[_0x133496(0xd9)]()?_0x42e477:undefined,'updatedAt':new Date()[_0x133496(0xb6)]()}:_0x31147f={'pid':_0x11beb3,'sessionId':_0x42e477!==_0x11beb3[_0x133496(0xd9)]()?_0x42e477:undefined,..._0x4e47c5,'createdAt':new Date()[_0x133496(0xb6)](),'updatedAt':new Date()[_0x133496(0xb6)]()},a45_0x136682['writeFileSync'](_0x134ae5,JSON[_0x133496(0xc8)](_0x31147f,null,0x2));}export function clearSessionContext(_0x12e497){const _0x9d6e97=a45_0x48d5,_0x224be7=_0x12e497||getCurrentSessionPID()['toString'](),_0x5025ab=a45_0x7a3742['join'](getSessionsDir(),_0x224be7+_0x9d6e97(0xba));a45_0x136682[_0x9d6e97(0xcc)](_0x5025ab)&&a45_0x136682[_0x9d6e97(0xb8)](_0x5025ab);}export function cleanExpiredSessions(){const _0x27b6d2=a45_0x48d5,_0x264a1a=getSessionsDir();if(!a45_0x136682[_0x27b6d2(0xcc)](_0x264a1a))return 0x0;let _0x4731ba=0x0;const _0x55ebb1=Date['now']();try{const _0x56947f=a45_0x136682[_0x27b6d2(0xc5)](_0x264a1a);for(const _0x5b3818 of _0x56947f){if(!_0x5b3818[_0x27b6d2(0xcf)](_0x27b6d2(0xba)))continue;const _0x145053=a45_0x7a3742['join'](_0x264a1a,_0x5b3818),_0x36784a=_0x5b3818[_0x27b6d2(0xc9)](_0x27b6d2(0xba),''),_0x558f60=parseInt(_0x36784a,0xa),_0x2beea7=!isNaN(_0x558f60);if(_0x2beea7){if(!isProcessRunning(_0x558f60)){a45_0x136682['unlinkSync'](_0x145053),_0x4731ba++;continue;}}try{const _0x487001=a45_0x136682[_0x27b6d2(0xbf)](_0x145053,_0x27b6d2(0xc2)),_0x322556=JSON[_0x27b6d2(0xcb)](_0x487001),_0x342b6c=new Date(_0x322556['createdAt'])[_0x27b6d2(0xc3)]();_0x55ebb1-_0x342b6c>SESSION_EXPIRATION_MS&&(a45_0x136682[_0x27b6d2(0xb8)](_0x145053),_0x4731ba++);}catch{a45_0x136682[_0x27b6d2(0xb8)](_0x145053),_0x4731ba++;}}}catch{}return _0x4731ba;}export function listActiveSessions(){const _0x3b21ca=a45_0x48d5,_0x48a103=getSessionsDir();if(!a45_0x136682[_0x3b21ca(0xcc)](_0x48a103))return[];try{const _0x48e0b7=a45_0x136682[_0x3b21ca(0xc5)](_0x48a103),_0x17390e=[];for(const _0x1263d2 of _0x48e0b7){if(!_0x1263d2['endsWith'](_0x3b21ca(0xba)))continue;const _0x4286ab=_0x1263d2[_0x3b21ca(0xc9)](_0x3b21ca(0xba),''),_0x13e621=parseInt(_0x4286ab,0xa);!isNaN(_0x13e621)&&isProcessRunning(_0x13e621)&&_0x17390e[_0x3b21ca(0xbc)](_0x13e621);}return _0x17390e[_0x3b21ca(0xd4)]((_0x348f36,_0x55763e)=>_0x348f36-_0x55763e);}catch{return[];}}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0xc66e4f,_0xbea878){var _0x3a1d51=a46_0x53e1,_0x12beb0=_0xc66e4f();while(!![]){try{var _0x20e116=parseInt(_0x3a1d51(0x1e5))/0x1*(parseInt(_0x3a1d51(0x1e4))/0x2)+-parseInt(_0x3a1d51(0x1e9))/0x3+parseInt(_0x3a1d51(0x1e6))/0x4*(parseInt(_0x3a1d51(0x1ed))/0x5)+-parseInt(_0x3a1d51(0x1eb))/0x6+-parseInt(_0x3a1d51(0x1e7))/0x7*(-parseInt(_0x3a1d51(0x1ec))/0x8)+-parseInt(_0x3a1d51(0x1e8))/0x9*(-parseInt(_0x3a1d51(0x1ea))/0xa)+-parseInt(_0x3a1d51(0x1ee))/0xb;if(_0x20e116===_0xbea878)break;else _0x12beb0['push'](_0x12beb0['shift']());}catch(_0x5780ab){_0x12beb0['push'](_0x12beb0['shift']());}}}(a46_0x206b,0x748e6));export*from'./types/index.js';export*from'./core/config.js';export*from'./core/auth.js';function a46_0x206b(){var _0x88f0e1=['56287FLSVNa','16difOMP','1876SLghwm','306vBmYMe','1731591RWwHkt','162460hjpNMR','3117264JqbrMx','7736ydTUcS','938380UQARbp','6679486KhKUcj','22IWBDAE'];a46_0x206b=function(){return _0x88f0e1;};return a46_0x206b();}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';function a46_0x53e1(_0xeb899f,_0x16d43f){var _0x206be8=a46_0x206b();return a46_0x53e1=function(_0x53e137,_0x97f4f9){_0x53e137=_0x53e137-0x1e4;var _0x268fcb=_0x206be8[_0x53e137];return _0x268fcb;},a46_0x53e1(_0xeb899f,_0x16d43f);}export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
1
+ (function(_0x2dbcfd,_0x5e30ed){var _0x3b333c=a46_0xe500,_0x4f0adf=_0x2dbcfd();while(!![]){try{var _0x376426=parseInt(_0x3b333c(0x9a))/0x1+-parseInt(_0x3b333c(0xa0))/0x2+-parseInt(_0x3b333c(0x9e))/0x3+-parseInt(_0x3b333c(0x99))/0x4+-parseInt(_0x3b333c(0x9c))/0x5*(parseInt(_0x3b333c(0x9b))/0x6)+parseInt(_0x3b333c(0x98))/0x7*(-parseInt(_0x3b333c(0x9f))/0x8)+parseInt(_0x3b333c(0xa1))/0x9*(parseInt(_0x3b333c(0x9d))/0xa);if(_0x376426===_0x5e30ed)break;else _0x4f0adf['push'](_0x4f0adf['shift']());}catch(_0x59bba5){_0x4f0adf['push'](_0x4f0adf['shift']());}}}(a46_0x53fa,0xcf846));function a46_0xe500(_0x1bd79f,_0x473f10){var _0x53faa8=a46_0x53fa();return a46_0xe500=function(_0xe500db,_0x22ba1e){_0xe500db=_0xe500db-0x98;var _0x2f3055=_0x53faa8[_0xe500db];return _0x2f3055;},a46_0xe500(_0x1bd79f,_0x473f10);}export*from'./types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./client/http-client.js';export*from'./client/td-api-client.js';export{TrinoApiClient}from'./client/trino-api-client.js';function a46_0x53fa(){var _0x517c17=['7vrxeMT','2552096WqVkvy','1388651zywscA','801588Falcdc','40XNHWiU','3522230DVfDOO','2040924pOsPzP','10308448GEmRas','2883776JcVeTg','117vmEtwL'];a46_0x53fa=function(){return _0x517c17;};return a46_0x53fa();}export*from'./client/rate-limiter.js';export*from'./types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';