@treasuredata/tdx 0.8.2 → 0.8.3

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 (115) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/client/cdp-api-client.js +1 -1
  6. package/dist/client/engage-api-client.js +1 -1
  7. package/dist/client/http-client.js +1 -1
  8. package/dist/client/llm-api-client.js +1 -1
  9. package/dist/client/rate-limiter.js +1 -1
  10. package/dist/client/td-api-client.js +1 -1
  11. package/dist/client/trino-api-client.js +1 -1
  12. package/dist/client/workflow-client.js +1 -1
  13. package/dist/commands/activations.js +1 -1
  14. package/dist/commands/api-command.js +1 -1
  15. package/dist/commands/auth-command.js +1 -1
  16. package/dist/commands/chat-command.js +1 -1
  17. package/dist/commands/claude-command.js +1 -1
  18. package/dist/commands/claude-statusline-command.js +1 -1
  19. package/dist/commands/claude-usage-command.js +1 -1
  20. package/dist/commands/command.js +1 -1
  21. package/dist/commands/connection-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.js +1 -1
  28. package/dist/commands/llm-proxy.js +1 -1
  29. package/dist/commands/parent-segment-command.js +1 -1
  30. package/dist/commands/profiles-command.js +1 -1
  31. package/dist/commands/query-command.js +1 -1
  32. package/dist/commands/segment-command.js +1 -1
  33. package/dist/commands/segment-create-command.js +1 -1
  34. package/dist/commands/segment-fields-command.js +1 -1
  35. package/dist/commands/segment-pull-command.js +1 -1
  36. package/dist/commands/segment-push-command.js +1 -1
  37. package/dist/commands/segment-update-command.js +1 -1
  38. package/dist/commands/segment-use-command.js +1 -1
  39. package/dist/commands/segments.js +1 -1
  40. package/dist/commands/show.js +1 -1
  41. package/dist/commands/tables.js +1 -1
  42. package/dist/commands/use-command.js +1 -1
  43. package/dist/commands/user-command.js +1 -1
  44. package/dist/commands/workflow-command.js +1 -1
  45. package/dist/core/auth.js +1 -1
  46. package/dist/core/config.js +1 -1
  47. package/dist/core/connection-cache.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/core/user-cache.js +1 -1
  55. package/dist/index.js +1 -1
  56. package/dist/proxy/anthropic-adapter.d.ts +11 -19
  57. package/dist/proxy/anthropic-adapter.d.ts.map +1 -1
  58. package/dist/proxy/anthropic-adapter.js +1 -1
  59. package/dist/proxy/anthropic-adapter.js.map +1 -1
  60. package/dist/proxy/claude-usage-tracker.js +1 -1
  61. package/dist/proxy/context-signature.js +1 -1
  62. package/dist/proxy/conversation-utils.js +1 -1
  63. package/dist/proxy/conversation-utils.js.map +1 -1
  64. package/dist/proxy/server.d.ts.map +1 -1
  65. package/dist/proxy/server.js +1 -1
  66. package/dist/proxy/server.js.map +1 -1
  67. package/dist/proxy/session-cache.js +1 -1
  68. package/dist/sdk/api.js +1 -1
  69. package/dist/sdk/connection.js +1 -1
  70. package/dist/sdk/engage.js +1 -1
  71. package/dist/sdk/errors.js +1 -1
  72. package/dist/sdk/index.js +1 -1
  73. package/dist/sdk/job.js +1 -1
  74. package/dist/sdk/llm.js +1 -1
  75. package/dist/sdk/query.js +1 -1
  76. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  77. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  78. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  79. package/dist/sdk/segment.js +1 -1
  80. package/dist/sdk/user.js +1 -1
  81. package/dist/sdk/workflow.js +1 -1
  82. package/dist/types/endpoints.js +1 -1
  83. package/dist/types/index.js +1 -1
  84. package/dist/utils/agent-ref-parser.js +1 -1
  85. package/dist/utils/async.js +1 -1
  86. package/dist/utils/chat-cache.js +1 -1
  87. package/dist/utils/colors.js +1 -1
  88. package/dist/utils/command-output.js +1 -1
  89. package/dist/utils/constants.js +1 -1
  90. package/dist/utils/diff.js +1 -1
  91. package/dist/utils/fields-display.js +1 -1
  92. package/dist/utils/file-permissions.js +1 -1
  93. package/dist/utils/format-detector.js +1 -1
  94. package/dist/utils/formatters.js +1 -1
  95. package/dist/utils/json-loader.js +1 -1
  96. package/dist/utils/llm-backup-utils.js +1 -1
  97. package/dist/utils/model-aliases.js +1 -1
  98. package/dist/utils/model-factors.js +1 -1
  99. package/dist/utils/option-validation.js +1 -1
  100. package/dist/utils/port.js +1 -1
  101. package/dist/utils/process.js +1 -1
  102. package/dist/utils/prompt.js +1 -1
  103. package/dist/utils/segment-path-parser.js +1 -1
  104. package/dist/utils/segment-ref-parser.js +1 -1
  105. package/dist/utils/spinner.js +1 -1
  106. package/dist/utils/sql-parser.js +1 -1
  107. package/dist/utils/sse-parser.js +1 -1
  108. package/dist/utils/string-utils.js +1 -1
  109. package/dist/utils/table-ref-parser.js +1 -1
  110. package/dist/utils/tdx-config.js +1 -1
  111. package/dist/utils/tdx-logger.js +1 -1
  112. package/dist/utils/tree-formatter.js +1 -1
  113. package/dist/utils/version-check.js +1 -1
  114. package/dist/utils/workflow-utils.js +1 -1
  115. package/package.json +1 -1
@@ -1 +1 @@
1
- function a41_0x350a(_0x99d23d,_0x5a80c2){_0x99d23d=_0x99d23d-0x174;const _0x57bb3d=a41_0x57bb();let _0x350a1c=_0x57bb3d[_0x99d23d];return _0x350a1c;}const a41_0x599ba9=a41_0x350a;(function(_0x2d7de4,_0x3e828c){const _0xba9dd3=a41_0x350a,_0x19582c=_0x2d7de4();while(!![]){try{const _0x574fdb=-parseInt(_0xba9dd3(0x18c))/0x1*(parseInt(_0xba9dd3(0x188))/0x2)+-parseInt(_0xba9dd3(0x184))/0x3+-parseInt(_0xba9dd3(0x176))/0x4*(-parseInt(_0xba9dd3(0x17f))/0x5)+parseInt(_0xba9dd3(0x177))/0x6*(-parseInt(_0xba9dd3(0x180))/0x7)+-parseInt(_0xba9dd3(0x18e))/0x8*(parseInt(_0xba9dd3(0x179))/0x9)+-parseInt(_0xba9dd3(0x182))/0xa*(-parseInt(_0xba9dd3(0x181))/0xb)+parseInt(_0xba9dd3(0x186))/0xc;if(_0x574fdb===_0x3e828c)break;else _0x19582c['push'](_0x19582c['shift']());}catch(_0x4d8387){_0x19582c['push'](_0x19582c['shift']());}}}(a41_0x57bb,0x5e940));function a41_0x57bb(){const _0x12b877=['data','error','\x20\x20Cause:\x20','Fetching\x20user\x20info...','3025485REGLnN','443401RHzBdU','11Mzcrrg','5988830jroBuc','length','1802856bhYPHw','cause','15662916AQNMmM','Listing\x20users...','1414hvkUDE','name','verbose','user','917wxIbna','getCurrent','5460248oefZex','\x20user','✔\x20Found\x20','message','execute','description','4MXbZEr','18hXWvai','List\x20all\x20users\x20in\x20the\x20account','9RJLify','Error:\x20'];a41_0x57bb=function(){return _0x12b877;};return a41_0x57bb();}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';export class UserCommand extends BaseCommand{['name']='user';[a41_0x599ba9(0x175)]='Show\x20current\x20user\x20information';async[a41_0x599ba9(0x174)](_0x256a1c){const _0x3a330b=a41_0x599ba9,{options:_0x48bbd4,tdx:_0x4161dd}=_0x256a1c;try{const _0x342db5=await withSpinner(_0x3a330b(0x17e),()=>_0x4161dd[_0x3a330b(0x18b)][_0x3a330b(0x18d)](),{'verbose':_0x48bbd4[_0x3a330b(0x18a)]}),_0x35dc5a=_0x342db5['data'];return await handleSingleObjectOutput(_0x35dc5a,_0x48bbd4),0x0;}catch(_0x176ed1){if(_0x176ed1 instanceof SDKError)return console['error'](_0x3a330b(0x17a)+_0x176ed1[_0x3a330b(0x191)]),_0x176ed1['cause']&&console[_0x3a330b(0x17c)](_0x3a330b(0x17d)+_0x176ed1[_0x3a330b(0x185)]),0x1;throw _0x176ed1;}}}export class UserListCommand extends BaseCommand{[a41_0x599ba9(0x189)]='user\x20list';[a41_0x599ba9(0x175)]=a41_0x599ba9(0x178);async[a41_0x599ba9(0x174)](_0x32bbce){const _0x4cb8b4=a41_0x599ba9,{options:_0x2b3fb1,tdx:_0x22262d}=_0x32bbce;try{const _0x1cd67c=await withSpinner(_0x4cb8b4(0x187),()=>_0x22262d[_0x4cb8b4(0x18b)]['list'](),{'verbose':_0x2b3fb1[_0x4cb8b4(0x18a)]}),_0x5b4ce5=_0x1cd67c[_0x4cb8b4(0x17b)];return console[_0x4cb8b4(0x17c)](_0x4cb8b4(0x190)+_0x5b4ce5['length']+_0x4cb8b4(0x18f)+(_0x5b4ce5[_0x4cb8b4(0x183)]!==0x1?'s':'')),await handleSDKOutput(_0x5b4ce5,_0x2b3fb1),0x0;}catch(_0x5d6612){if(_0x5d6612 instanceof SDKError)return console[_0x4cb8b4(0x17c)](_0x4cb8b4(0x17a)+_0x5d6612[_0x4cb8b4(0x191)]),_0x5d6612[_0x4cb8b4(0x185)]&&console['error'](_0x4cb8b4(0x17d)+_0x5d6612['cause']),0x1;throw _0x5d6612;}}}
1
+ function a41_0x5b13(_0x30a5cd,_0x4e04d7){_0x30a5cd=_0x30a5cd-0x1cf;const _0x75744b=a41_0x7574();let _0x5b13c2=_0x75744b[_0x30a5cd];return _0x5b13c2;}const a41_0x19672e=a41_0x5b13;(function(_0x2e1527,_0x15447b){const _0x3cf085=a41_0x5b13,_0x57aa13=_0x2e1527();while(!![]){try{const _0xadcb06=-parseInt(_0x3cf085(0x1dd))/0x1+parseInt(_0x3cf085(0x1d9))/0x2*(-parseInt(_0x3cf085(0x1eb))/0x3)+parseInt(_0x3cf085(0x1db))/0x4*(parseInt(_0x3cf085(0x1d4))/0x5)+parseInt(_0x3cf085(0x1d0))/0x6*(-parseInt(_0x3cf085(0x1e8))/0x7)+parseInt(_0x3cf085(0x1e5))/0x8+parseInt(_0x3cf085(0x1e9))/0x9*(-parseInt(_0x3cf085(0x1e2))/0xa)+parseInt(_0x3cf085(0x1da))/0xb;if(_0xadcb06===_0x15447b)break;else _0x57aa13['push'](_0x57aa13['shift']());}catch(_0x7b1a61){_0x57aa13['push'](_0x57aa13['shift']());}}}(a41_0x7574,0x3cfbf));import{BaseCommand}from'./command.js';function a41_0x7574(){const _0x50a628=['657507ROaiIU','message','data','24774iBXimK','Error:\x20','\x20\x20Cause:\x20','error','1735nuVHTJ','verbose','✔\x20Found\x20','user','Listing\x20users...','2GYHwcB','9238438pzexME','3304WoeNWW','user\x20list','298652PlJMFy','length','Fetching\x20user\x20info...','name','cause','10rJmNhe','getCurrent','\x20user','537184uVaWQM','list','execute','49dSCDCW','3574017sLeCFy','Show\x20current\x20user\x20information'];a41_0x7574=function(){return _0x50a628;};return a41_0x7574();}import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';export class UserCommand extends BaseCommand{['name']=a41_0x19672e(0x1d7);['description']=a41_0x19672e(0x1ea);async[a41_0x19672e(0x1e7)](_0x43c0b6){const _0x5c30d0=a41_0x19672e,{options:_0x193f1,tdx:_0x56ac86}=_0x43c0b6;try{const _0xe4a35c=await withSpinner(_0x5c30d0(0x1df),()=>_0x56ac86[_0x5c30d0(0x1d7)][_0x5c30d0(0x1e3)](),{'verbose':_0x193f1['verbose']}),_0x32c8f3=_0xe4a35c[_0x5c30d0(0x1cf)];return await handleSingleObjectOutput(_0x32c8f3,_0x193f1),0x0;}catch(_0x281a74){if(_0x281a74 instanceof SDKError)return console[_0x5c30d0(0x1d3)](_0x5c30d0(0x1d1)+_0x281a74[_0x5c30d0(0x1ec)]),_0x281a74[_0x5c30d0(0x1e1)]&&console[_0x5c30d0(0x1d3)]('\x20\x20Cause:\x20'+_0x281a74[_0x5c30d0(0x1e1)]),0x1;throw _0x281a74;}}}export class UserListCommand extends BaseCommand{[a41_0x19672e(0x1e0)]=a41_0x19672e(0x1dc);['description']='List\x20all\x20users\x20in\x20the\x20account';async[a41_0x19672e(0x1e7)](_0x4e7d3b){const _0x39f8ac=a41_0x19672e,{options:_0x26b311,tdx:_0x2136e1}=_0x4e7d3b;try{const _0x206234=await withSpinner(_0x39f8ac(0x1d8),()=>_0x2136e1['user'][_0x39f8ac(0x1e6)](),{'verbose':_0x26b311[_0x39f8ac(0x1d5)]}),_0x3d6e60=_0x206234['data'];return console[_0x39f8ac(0x1d3)](_0x39f8ac(0x1d6)+_0x3d6e60[_0x39f8ac(0x1de)]+_0x39f8ac(0x1e4)+(_0x3d6e60[_0x39f8ac(0x1de)]!==0x1?'s':'')),await handleSDKOutput(_0x3d6e60,_0x26b311),0x0;}catch(_0x4b0cf4){if(_0x4b0cf4 instanceof SDKError)return console['error'](_0x39f8ac(0x1d1)+_0x4b0cf4[_0x39f8ac(0x1ec)]),_0x4b0cf4[_0x39f8ac(0x1e1)]&&console[_0x39f8ac(0x1d3)](_0x39f8ac(0x1d2)+_0x4b0cf4[_0x39f8ac(0x1e1)]),0x1;throw _0x4b0cf4;}}}
@@ -1 +1 @@
1
- const a42_0x156904=a42_0x1e46;(function(_0xe7ed5b,_0xf6eb17){const _0x5b8b08=a42_0x1e46,_0x3b0b7e=_0xe7ed5b();while(!![]){try{const _0x1136be=parseInt(_0x5b8b08(0x10c))/0x1+-parseInt(_0x5b8b08(0x144))/0x2*(-parseInt(_0x5b8b08(0x11a))/0x3)+-parseInt(_0x5b8b08(0x164))/0x4+-parseInt(_0x5b8b08(0x141))/0x5*(parseInt(_0x5b8b08(0x114))/0x6)+parseInt(_0x5b8b08(0x159))/0x7*(parseInt(_0x5b8b08(0x11c))/0x8)+-parseInt(_0x5b8b08(0x11f))/0x9*(-parseInt(_0x5b8b08(0x130))/0xa)+-parseInt(_0x5b8b08(0x146))/0xb;if(_0x1136be===_0xf6eb17)break;else _0x3b0b7e['push'](_0x3b0b7e['shift']());}catch(_0x507c9f){_0x3b0b7e['push'](_0x3b0b7e['shift']());}}}(a42_0x21bc,0x1c78b));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 a42_0x4a61c9 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a42_0x156904(0x16e)]='workflow:projects';[a42_0x156904(0xe6)]='List\x20all\x20workflow\x20projects';async[a42_0x156904(0xee)](_0x57aff0){const _0x5093ec=a42_0x156904,{options:_0x3ac4ee,args:_0x324958,tdx:_0x215dac}=_0x57aff0,_0x1a7ce6=_0x324958[0x0];try{_0x3ac4ee[_0x5093ec(0x142)]&&_0x1a7ce6&&console[_0x5093ec(0x115)](_0x5093ec(0x12f)+_0x1a7ce6);const _0x4a4ad7=await withSpinner('Listing\x20workflow\x20projects...',()=>_0x215dac[_0x5093ec(0xd7)][_0x5093ec(0x112)](_0x1a7ce6,{'limit':_0x3ac4ee[_0x5093ec(0x16b)]}),{'verbose':_0x3ac4ee['verbose']}),_0x35a3e5=_0x4a4ad7[_0x5093ec(0x17c)];return console[_0x5093ec(0x115)]('✔\x20Found\x20'+_0x35a3e5[_0x5093ec(0x178)]+_0x5093ec(0x17b)+(_0x35a3e5[_0x5093ec(0x178)]!==0x1?'s':'')),await handleSDKOutput(_0x35a3e5,_0x3ac4ee),0x0;}catch(_0x51edb2){if(_0x51edb2 instanceof SDKError)return console[_0x5093ec(0x115)](_0x5093ec(0xef)+_0x51edb2[_0x5093ec(0x172)]),_0x51edb2[_0x5093ec(0x167)]&&console[_0x5093ec(0x115)](_0x5093ec(0xeb)+_0x51edb2[_0x5093ec(0x167)]),0x1;throw _0x51edb2;}}}function a42_0x1e46(_0x32830b,_0x4576d4){_0x32830b=_0x32830b-0xd7;const _0x21bc15=a42_0x21bc();let _0x1e466a=_0x21bc15[_0x32830b];return _0x1e466a;}export class WorkflowWorkflowsCommand extends BaseCommand{[a42_0x156904(0x16e)]='workflow:workflows';['description']=a42_0x156904(0x162);async[a42_0x156904(0xee)](_0x263b44){const _0x4da715=a42_0x156904,{options:_0x3fae1d,args:_0x2d4cf7,tdx:_0x3c3056}=_0x263b44,_0x2df236=_0x2d4cf7[0x0];try{_0x3fae1d['verbose']&&_0x2df236&&console[_0x4da715(0x115)](_0x4da715(0xe3)+_0x2df236);const _0xfcd6e5=await withSpinner('Listing\x20workflows...',()=>_0x3c3056[_0x4da715(0xd7)]['workflows'](_0x2df236,{'limit':_0x3fae1d['limit']}),{'verbose':_0x3fae1d[_0x4da715(0x142)]}),_0x5ef791=_0xfcd6e5['data'];return console['error'](_0x4da715(0xfa)+_0x5ef791['length']+_0x4da715(0x125)+(_0x5ef791[_0x4da715(0x178)]!==0x1?'s':'')),await handleSDKOutput(_0x5ef791,_0x3fae1d),0x0;}catch(_0x18ff41){if(_0x18ff41 instanceof SDKError)return console[_0x4da715(0x115)](_0x4da715(0xef)+_0x18ff41[_0x4da715(0x172)]),_0x18ff41[_0x4da715(0x167)]&&console['error'](_0x4da715(0xeb)+_0x18ff41[_0x4da715(0x167)]),0x1;throw _0x18ff41;}}}export class WorkflowSessionsCommand extends BaseCommand{[a42_0x156904(0x16e)]=a42_0x156904(0x135);['description']='List\x20workflow\x20execution\x20sessions';async[a42_0x156904(0xee)](_0x4aecbf){const _0x4d2a07=a42_0x156904,{options:_0x5f5635,args:_0x5d7021,tdx:_0x1f97fa}=_0x4aecbf;let _0x23670b,_0x165d1b;if(_0x5d7021[0x0]){const _0x4639b7=_0x5d7021[0x0][_0x4d2a07(0xf1)]('.');if(_0x4639b7[_0x4d2a07(0x178)]===0x1)_0x23670b=_0x4639b7[0x0];else{if(_0x4639b7[_0x4d2a07(0x178)]===0x2)[_0x23670b,_0x165d1b]=_0x4639b7;else return console[_0x4d2a07(0x115)](_0x4d2a07(0x15b)),0x1;}}try{if(_0x5f5635[_0x4d2a07(0x142)]){if(_0x23670b&&_0x165d1b)console[_0x4d2a07(0x115)](_0x4d2a07(0xec)+_0x23670b+'.'+_0x165d1b);else _0x23670b&&console['error'](_0x4d2a07(0x10a)+_0x23670b);const _0x3184b0=_0x5f5635[_0x4d2a07(0x15d)];_0x3184b0&&console[_0x4d2a07(0x115)](_0x4d2a07(0x111)+_0x3184b0);}const _0x2993d7=await withSpinner('Listing\x20workflow\x20sessions...',()=>_0x1f97fa[_0x4d2a07(0xd7)][_0x4d2a07(0x15e)]({'projectName':_0x23670b,'workflowName':_0x165d1b,'status':_0x5f5635[_0x4d2a07(0x15d)],'fromTime':_0x5f5635['from'],'toTime':_0x5f5635['to'],'limit':_0x5f5635[_0x4d2a07(0x16b)]}),{'verbose':_0x5f5635[_0x4d2a07(0x142)]}),_0x5df41f=_0x2993d7['data'];return console['error'](_0x4d2a07(0xfa)+_0x5df41f['length']+_0x4d2a07(0xda)+(_0x5df41f['length']!==0x1?'s':'')),await handleSDKOutput(_0x5df41f,_0x5f5635),0x0;}catch(_0x3a0b72){if(_0x3a0b72 instanceof SDKError)return console[_0x4d2a07(0x115)]('Error:\x20'+_0x3a0b72['message']),_0x3a0b72['cause']&&console[_0x4d2a07(0x115)](_0x4d2a07(0xeb)+_0x3a0b72[_0x4d2a07(0x167)]),0x1;throw _0x3a0b72;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a42_0x156904(0x16e)]='workflow:attempts';['description']='List\x20workflow\x20attempts';async[a42_0x156904(0xee)](_0x4a50ce){const _0x20fdeb=a42_0x156904,{options:_0x355961,args:_0x42f742,tdx:_0x16bda7}=_0x4a50ce;let _0x3baae9,_0xed6e13;if(_0x42f742[0x0]){const _0x2ce0bb=_0x42f742[0x0]['split']('.');if(_0x2ce0bb[_0x20fdeb(0x178)]===0x1)_0x3baae9=_0x2ce0bb[0x0];else{if(_0x2ce0bb[_0x20fdeb(0x178)]===0x2)[_0x3baae9,_0xed6e13]=_0x2ce0bb;else return console[_0x20fdeb(0x115)](_0x20fdeb(0x15b)),0x1;}}try{const _0x1d1f75=_0x355961[_0x20fdeb(0x145)];if(_0x355961[_0x20fdeb(0x142)]){if(_0x3baae9&&_0xed6e13)console[_0x20fdeb(0x115)](_0x20fdeb(0xec)+_0x3baae9+'.'+_0xed6e13);else _0x3baae9&&console['error']('Filter:\x20project='+_0x3baae9);_0x1d1f75&&console[_0x20fdeb(0x115)](_0x20fdeb(0x166));}const _0x4c76a5=await withSpinner('Listing\x20workflow\x20attempts...',()=>_0x16bda7['workflow'][_0x20fdeb(0xfd)]({'projectName':_0x3baae9,'workflowName':_0xed6e13,'includeRetried':_0x1d1f75,'limit':_0x355961[_0x20fdeb(0x16b)]}),{'verbose':_0x355961['verbose']}),_0x3bb4e8=_0x4c76a5[_0x20fdeb(0x17c)];return console[_0x20fdeb(0x115)](_0x20fdeb(0xfa)+_0x3bb4e8[_0x20fdeb(0x178)]+_0x20fdeb(0x156)+(_0x3bb4e8[_0x20fdeb(0x178)]!==0x1?'s':'')),await handleSDKOutput(_0x3bb4e8,_0x355961),0x0;}catch(_0x4c50a7){if(_0x4c50a7 instanceof SDKError)return console[_0x20fdeb(0x115)](_0x20fdeb(0xef)+_0x4c50a7[_0x20fdeb(0x172)]),_0x4c50a7[_0x20fdeb(0x167)]&&console[_0x20fdeb(0x115)](_0x20fdeb(0xeb)+_0x4c50a7[_0x20fdeb(0x167)]),0x1;throw _0x4c50a7;}}}export class WorkflowAttemptCommand extends BaseCommand{['name']=a42_0x156904(0x132);[a42_0x156904(0xe6)]=a42_0x156904(0x13e);async[a42_0x156904(0xee)](_0x4727df){const _0x5c8c46=a42_0x156904,{options:_0x39bc3a,args:_0x2b3be0,tdx:_0x2efed2}=_0x4727df,_0x83b2a8=_0x2b3be0[0x0];if(!_0x83b2a8)return console[_0x5c8c46(0x115)](_0x5c8c46(0x10f)),0x1;try{_0x39bc3a[_0x5c8c46(0x142)]&&console[_0x5c8c46(0x115)](_0x5c8c46(0x173)+_0x83b2a8);const _0x15bcfc=await withSpinner(_0x5c8c46(0x109),()=>_0x2efed2['workflow'][_0x5c8c46(0xf4)](_0x83b2a8),{'verbose':_0x39bc3a[_0x5c8c46(0x142)]}),_0x31dfbc=_0x15bcfc[_0x5c8c46(0x17c)];let _0x41109d;!_0x31dfbc[_0x5c8c46(0x151)]?_0x41109d=_0x31dfbc[_0x5c8c46(0xed)]?_0x5c8c46(0x119):_0x5c8c46(0x17a):_0x41109d=_0x31dfbc[_0x5c8c46(0x14a)]?_0x5c8c46(0x14a):_0x5c8c46(0x115);let _0x4af5cd;if(_0x31dfbc[_0x5c8c46(0x11b)]&&_0x31dfbc[_0x5c8c46(0x129)]){const _0x51053b=new Date(_0x31dfbc[_0x5c8c46(0x11b)])['getTime'](),_0x3f7539=new Date(_0x31dfbc['finishedAt'])[_0x5c8c46(0x137)]();_0x4af5cd=Math[_0x5c8c46(0x16f)]((_0x3f7539-_0x51053b)/0x3e8);}const _0x116645={'attempt_id':_0x31dfbc['id'],'status':_0x41109d,..._0x31dfbc[_0x5c8c46(0x12c)]!==undefined&&{'index':_0x31dfbc['index']},..._0x31dfbc[_0x5c8c46(0x100)]&&{'project':_0x31dfbc[_0x5c8c46(0x100)][_0x5c8c46(0x16e)]},..._0x31dfbc['workflow']&&{'workflow':_0x31dfbc['workflow'][_0x5c8c46(0x16e)]},..._0x31dfbc['sessionId']&&{'session_id':_0x31dfbc[_0x5c8c46(0x179)]},..._0x31dfbc['sessionTime']&&{'session_time':_0x31dfbc[_0x5c8c46(0xe5)]},..._0x31dfbc[_0x5c8c46(0xfc)]&&{'retry_attempt':_0x31dfbc[_0x5c8c46(0xfc)]},..._0x4af5cd!==undefined&&{'duration_sec':_0x4af5cd},..._0x31dfbc[_0x5c8c46(0x11b)]&&{'created_at':_0x31dfbc[_0x5c8c46(0x11b)]},..._0x31dfbc[_0x5c8c46(0x129)]&&{'finished_at':_0x31dfbc[_0x5c8c46(0x129)]},...Object[_0x5c8c46(0x148)](_0x31dfbc[_0x5c8c46(0x150)])[_0x5c8c46(0x178)]>0x0&&{'params':_0x31dfbc['params']}};return await handleSingleObjectOutput(_0x116645,_0x39bc3a),0x0;}catch(_0x3014cb){if(_0x3014cb instanceof SDKError)return console['error'](_0x5c8c46(0xef)+_0x3014cb[_0x5c8c46(0x172)]),_0x3014cb['cause']&&console[_0x5c8c46(0x115)](_0x5c8c46(0xeb)+_0x3014cb[_0x5c8c46(0x167)]),0x1;throw _0x3014cb;}}}export class WorkflowTasksCommand extends BaseCommand{['name']='workflow:tasks';[a42_0x156904(0xe6)]=a42_0x156904(0x128);async[a42_0x156904(0xee)](_0x525465){const _0xc1c97e=a42_0x156904,{options:_0x514b3b,args:_0x14ec59,tdx:_0x4bc769}=_0x525465,_0x2e2f74=_0x14ec59[0x0];if(!_0x2e2f74)return console[_0xc1c97e(0x115)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x7805c6=_0x514b3b[_0xc1c97e(0xf0)];_0x514b3b[_0xc1c97e(0x142)]&&(console[_0xc1c97e(0x115)](_0xc1c97e(0x173)+_0x2e2f74),_0x7805c6&&console[_0xc1c97e(0x115)]('Including\x20subtasks:\x20yes'));const _0x4e6227=await withSpinner(_0xc1c97e(0x176),()=>_0x4bc769[_0xc1c97e(0xd7)][_0xc1c97e(0x113)](_0x2e2f74,_0x7805c6||![]),{'verbose':_0x514b3b[_0xc1c97e(0x142)]}),_0x29b7b7=_0x4e6227[_0xc1c97e(0x17c)];return console[_0xc1c97e(0x115)](_0xc1c97e(0xfa)+_0x29b7b7[_0xc1c97e(0x178)]+_0xc1c97e(0xff)+(_0x29b7b7[_0xc1c97e(0x178)]!==0x1?'s':'')),await handleSDKOutput(_0x29b7b7,_0x514b3b),0x0;}catch(_0x6d3d5f){if(_0x6d3d5f instanceof SDKError)return console[_0xc1c97e(0x115)]('Error:\x20'+_0x6d3d5f['message']),_0x6d3d5f[_0xc1c97e(0x167)]&&console['error'](_0xc1c97e(0xeb)+_0x6d3d5f[_0xc1c97e(0x167)]),0x1;throw _0x6d3d5f;}}}export class WorkflowLogsCommand extends BaseCommand{[a42_0x156904(0x16e)]=a42_0x156904(0x157);[a42_0x156904(0xe6)]=a42_0x156904(0x160);async[a42_0x156904(0xee)](_0x489160){const _0x38ab2e=a42_0x156904,{options:_0x5b486f,args:_0x11f0f9,tdx:_0x4fd6e6}=_0x489160,_0x37d896=_0x11f0f9[0x0];let _0xc2f30b=_0x11f0f9[0x1];if(!_0x37d896)return console[_0x38ab2e(0x115)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x5b486f[_0x38ab2e(0x142)]&&(console['error']('Attempt\x20ID:\x20'+_0x37d896),_0xc2f30b&&console[_0x38ab2e(0x115)](_0x38ab2e(0x118)+_0xc2f30b));const _0x338697=await withSpinner(_0x38ab2e(0x131),()=>_0x4fd6e6['workflow'][_0x38ab2e(0x121)](_0x37d896,_0xc2f30b),{'verbose':_0x5b486f[_0x38ab2e(0x142)]}),_0x5cfaac=_0x338697[_0x38ab2e(0x17c)];if(_0x5cfaac[_0x38ab2e(0x178)]===0x0)return console[_0x38ab2e(0x115)]('No\x20log\x20files\x20found\x20for\x20this\x20attempt'),0x0;if(!_0xc2f30b&&(_0x5b486f[_0x38ab2e(0x16d)]||_0x5b486f[_0x38ab2e(0xd8)]))return await handleSDKOutput(_0x5cfaac,_0x5b486f),0x0;if(!_0xc2f30b){const _0x5cd6dd=_0x5cfaac[_0x38ab2e(0x120)](_0x741ee3=>({'title':_0x741ee3['taskName']+'\x20('+formatBytes(_0x741ee3[_0x38ab2e(0x104)])+')','value':_0x741ee3['taskName']})),_0x4de044=await a42_0x4a61c9({'type':_0x38ab2e(0xde),'name':_0x38ab2e(0x14e),'message':_0x38ab2e(0x13c),'choices':_0x5cd6dd});if(!_0x4de044['task'])return console['error'](_0x38ab2e(0x14f)),0x0;_0xc2f30b=_0x4de044[_0x38ab2e(0x14e)];}const _0x2f58e5=await withSpinner(_0x38ab2e(0x165),()=>_0x4fd6e6[_0x38ab2e(0xd7)][_0x38ab2e(0xf7)](_0x37d896,_0xc2f30b),{'verbose':_0x5b486f[_0x38ab2e(0x142)]}),_0x3a963=_0x2f58e5[_0x38ab2e(0x17c)];return _0x3a963?console[_0x38ab2e(0xf2)](_0x3a963):console[_0x38ab2e(0x115)](_0x38ab2e(0x101)),0x0;}catch(_0x4a6364){if(_0x4a6364 instanceof SDKError)return console[_0x38ab2e(0x115)](_0x38ab2e(0xef)+_0x4a6364[_0x38ab2e(0x172)]),_0x4a6364[_0x38ab2e(0x167)]&&console[_0x38ab2e(0x115)]('\x20\x20Cause:\x20'+_0x4a6364['cause']),0x1;throw _0x4a6364;}}}export class WorkflowKillCommand extends BaseCommand{[a42_0x156904(0x16e)]=a42_0x156904(0x10b);[a42_0x156904(0xe6)]='Kill\x20a\x20running\x20attempt';async['execute'](_0x5c1a78){const _0x6912b2=a42_0x156904,{options:_0x273d83,args:_0x4251f8,tdx:_0x58af14}=_0x5c1a78,_0x35f8ea=_0x4251f8[0x0];if(!_0x35f8ea)return console[_0x6912b2(0x115)](_0x6912b2(0x10f)),0x1;try{const _0x397b1d=_0x273d83[_0x6912b2(0x171)];_0x273d83[_0x6912b2(0x142)]&&(console[_0x6912b2(0x115)](_0x6912b2(0x173)+_0x35f8ea),_0x397b1d&&console[_0x6912b2(0x115)](_0x6912b2(0x16c)+_0x397b1d));if(!_0x273d83['yes']){const _0x1c6437=await confirm(_0x6912b2(0x12a)+_0x35f8ea+'?');if(!_0x1c6437)return console[_0x6912b2(0x115)](_0x6912b2(0x14f)),0x0;}const _0x3b46c6=await withSpinner(_0x6912b2(0x134),()=>_0x58af14[_0x6912b2(0xd7)][_0x6912b2(0x14b)](_0x35f8ea,_0x397b1d),{'verbose':_0x273d83[_0x6912b2(0x142)]}),_0x386ab2=_0x3b46c6['data'];return console[_0x6912b2(0x115)]('✔\x20'+_0x386ab2),0x0;}catch(_0x12bfcd){if(_0x12bfcd instanceof SDKError)return console['error']('Error:\x20'+_0x12bfcd[_0x6912b2(0x172)]),_0x12bfcd[_0x6912b2(0x167)]&&console[_0x6912b2(0x115)]('\x20\x20Cause:\x20'+_0x12bfcd[_0x6912b2(0x167)]),0x1;throw _0x12bfcd;}}}export class WorkflowRetryCommand extends BaseCommand{[a42_0x156904(0x16e)]=a42_0x156904(0x14c);['description']=a42_0x156904(0x12e);async['execute'](_0xc9f372){const _0x2820b7=a42_0x156904,{options:_0xc4beed,args:_0x328950,tdx:_0x5cd5c9}=_0xc9f372,_0x2980da=_0x328950[0x0];if(!_0x2980da)return console[_0x2820b7(0x115)]('Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required'),console[_0x2820b7(0x115)](_0x2820b7(0x158)),0x1;let _0xad8040=![],_0x186bf1=_0x2980da;if(_0x2980da['startsWith'](_0x2820b7(0x124)))_0xad8040=!![],_0x186bf1=_0x2980da[_0x2820b7(0x13a)](0x8);else{if(_0x2980da[_0x2820b7(0x10d)](_0x2820b7(0xe1)))_0xad8040=![],_0x186bf1=_0x2980da[_0x2820b7(0x13a)](0x8);else return console[_0x2820b7(0x115)](_0x2820b7(0x12b)),console['error'](_0x2820b7(0x158)),0x1;}try{const _0x5138e0=_0xc4beed[_0x2820b7(0x14d)],_0x5f395d=_0xc4beed[_0x2820b7(0x15c)],_0x40c359=_0xc4beed[_0x2820b7(0x150)],_0x7658bb=_0xc4beed[_0x2820b7(0x11e)];_0xc4beed[_0x2820b7(0x142)]&&(console[_0x2820b7(0x115)](_0x2820b7(0x138)+(_0xad8040?'session':_0x2820b7(0xf4))+'\x20'+_0x186bf1),_0x5138e0&&console[_0x2820b7(0x115)]('From\x20task:\x20'+_0x5138e0),_0x5f395d&&console[_0x2820b7(0x115)](_0x2820b7(0x10e)+_0x5f395d),_0x40c359&&console[_0x2820b7(0x115)](_0x2820b7(0xe9)+_0x40c359),_0x7658bb&&console[_0x2820b7(0x115)](_0x2820b7(0x147)));let _0x3a6298;if(_0x40c359)try{if(_0x40c359[_0x2820b7(0x10d)]('@')){const _0x5ef934=await import(_0x2820b7(0x13f)),_0x2b4052=_0x40c359[_0x2820b7(0x13a)](0x1),_0x16db2e=await _0x5ef934[_0x2820b7(0x123)](_0x2b4052,_0x2820b7(0xe0));_0x3a6298=JSON[_0x2820b7(0x13b)](_0x16db2e);}else _0x3a6298=JSON['parse'](_0x40c359);}catch{return console[_0x2820b7(0x115)](_0x2820b7(0x126)),0x1;}if(!_0xc4beed[_0x2820b7(0x122)]){const _0x1de667=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20'+(_0xad8040?_0x2820b7(0x174):'attempt')+'\x20'+_0x186bf1+'?');if(!_0x1de667)return console['error'](_0x2820b7(0x14f)),0x0;}let _0x190d93;_0xad8040?_0x190d93=await withSpinner('Retrying\x20session...',()=>_0x5cd5c9['workflow'][_0x2820b7(0x106)](_0x186bf1,{'fromTask':_0x5138e0,'retryParams':_0x3a6298}),{'verbose':_0xc4beed[_0x2820b7(0x142)]}):_0x190d93=await withSpinner('Retrying\x20attempt...',()=>_0x5cd5c9[_0x2820b7(0xd7)]['retryAttempt'](_0x186bf1,{'resumeFrom':_0x5f395d,'retryParams':_0x3a6298,'force':_0x7658bb}),{'verbose':_0xc4beed[_0x2820b7(0x142)]});const _0x58af0f=_0x190d93[_0x2820b7(0x17c)];return console['error'](_0x2820b7(0x175)),console[_0x2820b7(0x115)]('\x20\x20New\x20attempt\x20ID:\x20'+_0x58af0f[_0x2820b7(0x110)]),console[_0x2820b7(0x115)]('\x20\x20Session\x20ID:\x20'+_0x58af0f['sessionId']),0x0;}catch(_0x3310d5){if(_0x3310d5 instanceof SDKError)return console[_0x2820b7(0x115)](_0x2820b7(0xef)+_0x3310d5[_0x2820b7(0x172)]),_0x3310d5[_0x2820b7(0x167)]&&console[_0x2820b7(0x115)](_0x2820b7(0xeb)+_0x3310d5[_0x2820b7(0x167)]),0x1;throw _0x3310d5;}}}export class WorkflowRunCommand extends BaseCommand{['name']=a42_0x156904(0x136);[a42_0x156904(0xe6)]='Start\x20a\x20workflow\x20run';async[a42_0x156904(0xee)](_0x4ed008){const _0x1a03c0=a42_0x156904,{options:_0x2b0e11,args:_0x5b5d69,tdx:_0x5c88f0}=_0x4ed008,_0x4b803a=_0x5b5d69[0x0];if(!_0x4b803a)return console[_0x1a03c0(0x115)](_0x1a03c0(0xfe)),console[_0x1a03c0(0x115)]('Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]'),0x1;const _0x3564d4=_0x2b0e11[_0x1a03c0(0xfb)],_0x5a3c41=_0x2b0e11[_0x1a03c0(0xe5)],_0x4a36f0={};if(_0x3564d4&&Array[_0x1a03c0(0x102)](_0x3564d4))for(const _0x512f0f of _0x3564d4){const _0x2e2c76=_0x512f0f[_0x1a03c0(0xe4)]('=');if(_0x2e2c76===-0x1)return console['error'](_0x1a03c0(0x13d)+_0x512f0f),console['error'](_0x1a03c0(0xd9)),0x1;const _0x550674=_0x512f0f[_0x1a03c0(0x13a)](0x0,_0x2e2c76),_0x14465f=_0x512f0f[_0x1a03c0(0x13a)](_0x2e2c76+0x1);try{_0x4a36f0[_0x550674]=JSON['parse'](_0x14465f);}catch{_0x4a36f0[_0x550674]=_0x14465f;}}_0x2b0e11[_0x1a03c0(0x142)]&&(console[_0x1a03c0(0x115)](_0x1a03c0(0xf9)+_0x4b803a),Object[_0x1a03c0(0x148)](_0x4a36f0)[_0x1a03c0(0x178)]>0x0&&console[_0x1a03c0(0x115)]('Parameters:\x20'+JSON[_0x1a03c0(0x133)](_0x4a36f0)),_0x5a3c41&&console[_0x1a03c0(0x115)]('Session\x20time:\x20'+_0x5a3c41));const _0x466e32=await withSpinner(_0x1a03c0(0x15f),()=>_0x5c88f0['workflow'][_0x1a03c0(0xf8)](_0x4b803a,_0x4a36f0,{'sessionTime':_0x5a3c41}),{'verbose':_0x2b0e11['verbose']}),_0x497e55=_0x466e32['data'];return console[_0x1a03c0(0x115)]('✔\x20Workflow\x20run\x20started'),console[_0x1a03c0(0x115)](_0x1a03c0(0x169)+_0x497e55['id']),console[_0x1a03c0(0x115)](_0x1a03c0(0x105)+_0x497e55[_0x1a03c0(0x179)]),console[_0x1a03c0(0x115)](_0x1a03c0(0x127)+_0x497e55['project']?.[_0x1a03c0(0x16e)]),console[_0x1a03c0(0x115)]('\x20\x20Workflow:\x20'+_0x497e55[_0x1a03c0(0xd7)]?.[_0x1a03c0(0x16e)]),0x0;}}function a42_0x21bc(){const _0x46a2e4=['workflow:kill','131258iARuOx','startsWith','Resume\x20from:\x20','Error:\x20Attempt\x20ID\x20is\x20required','attemptId','Status:\x20','projects','tasks','6mSruOA','error','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','\x20\x20Revision:\x20','Task\x20name:\x20','canceling','133674nGoqNF','createdAt','664ZFCEZF','Usage:\x20workflow:delete\x20<project-name-or-id>','force','378vKATZq','map','logFiles','yes','readFile','session:','\x20workflow','Error:\x20Invalid\x20JSON\x20in\x20--params','\x20\x20Project:\x20','Show\x20tasks\x20for\x20an\x20attempt','finishedAt','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','index','skipValidation','Retry\x20a\x20session\x20or\x20attempt','Pattern:\x20','43990nxhdfw','Fetching\x20log\x20files...','workflow:attempt','stringify','Killing\x20attempt...','workflow:sessions','workflow:run','getTime','Target:\x20','projectName','substring','parse','Select\x20a\x20task\x20to\x20view\x20logs:','Error:\x20Invalid\x20parameter\x20format:\x20','Show\x20specific\x20attempt\x20details','fs/promises','✔\x20Pushed\x20','1068265XVXdcy','verbose','revision','4kgneVh','includeRetried','1194402KEFcqh','Force:\x20yes','keys','workflow:push','success','kill','workflow:retry','fromTask','task','Cancelled','params','done','Pushing\x20workflow\x20project...','filesExtracted','Revision:\x20','projectId','\x20attempt','workflow:logs','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','10073jonwfj','Output\x20directory:\x20','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','resumeFrom','status','sessions','Starting\x20workflow\x20run...','Show\x20logs\x20for\x20a\x20workflow\x20attempt','isDirectory','List\x20workflows','✔\x20Downloaded\x20','342860yPZloA','Downloading\x20logs...','Include\x20retried:\x20yes','cause','Validation:\x20skipped','\x20\x20Attempt\x20ID:\x20','✔\x20Deleted\x20project\x20','limit','Reason:\x20','json','name','round','workflow:download','reason','message','Attempt\x20ID:\x20','session','✔\x20Retry\x20started','Getting\x20attempt\x20tasks...','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','length','sessionId','running','\x20project','data','workflow','format','Expected\x20format:\x20--param\x20key=value','\x20session','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','Project\x20name:\x20','select','\x20\x20Project\x20ID:\x20','utf-8','attempt:','\x22?\x20This\x20cannot\x20be\x20undone.','Project\x20filter:\x20','indexOf','sessionTime','description','workflow:delete','delete','Params:\x20','Error:\x20Project\x20name\x20is\x20required','\x20\x20Cause:\x20','Filter:\x20','cancelRequested','execute','Error:\x20','includeSubtasks','split','log','stat','attempt','Project:\x20','\x20\x20Location:\x20','logs','run','Workflow:\x20','✔\x20Found\x20','param','retryAttemptName','attempts','Error:\x20Workflow\x20identifier\x20is\x20required','\x20task','project','No\x20log\x20content\x20found','isArray','Project\x20directory:\x20','fileSize','\x20\x20Session\x20ID:\x20','retrySession','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','Downloading\x20project\x20','Getting\x20attempt\x20details...','Filter:\x20project='];a42_0x21bc=function(){return _0x46a2e4;};return a42_0x21bc();}export class WorkflowDownloadCommand extends BaseCommand{['name']=a42_0x156904(0x170);[a42_0x156904(0xe6)]=a42_0x156904(0x177);async['execute'](_0x186bb6){const _0x458228=a42_0x156904,{options:_0x217e57,args:_0x1131e3,tdx:_0x26bb66}=_0x186bb6,_0x3345bf=_0x1131e3[0x0],_0x357208=_0x1131e3[0x1]||'.';if(!_0x3345bf)return console[_0x458228(0x115)](_0x458228(0xea)),console[_0x458228(0x115)](_0x458228(0xdb)),0x1;const _0x4fdc9f=_0x217e57[_0x458228(0x143)];_0x217e57[_0x458228(0x142)]&&(console[_0x458228(0x115)](_0x458228(0xf5)+_0x3345bf),console['error'](_0x458228(0x15a)+_0x357208),_0x4fdc9f&&console['error'](_0x458228(0x154)+_0x4fdc9f));const _0x452d24=await withSpinner(_0x458228(0x108)+_0x3345bf+'...',()=>_0x26bb66[_0x458228(0xd7)]['download'](_0x3345bf,_0x357208,{'revision':_0x4fdc9f}),{'verbose':_0x217e57[_0x458228(0x142)]}),_0x17c1c4=_0x452d24[_0x458228(0x17c)];return console[_0x458228(0x115)](_0x458228(0x163)+_0x17c1c4[_0x458228(0x139)]),console[_0x458228(0x115)](_0x458228(0x117)+_0x17c1c4[_0x458228(0x143)]),console[_0x458228(0x115)]('\x20\x20Files\x20extracted:\x20'+_0x17c1c4[_0x458228(0x153)]),console[_0x458228(0x115)](_0x458228(0xf6)+_0x357208+'/'+_0x17c1c4[_0x458228(0x139)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{['name']=a42_0x156904(0x149);[a42_0x156904(0xe6)]=a42_0x156904(0x116);async[a42_0x156904(0xee)](_0x1731d7){const _0xc77304=a42_0x156904,{options:_0x48223d,args:_0x2ac8d7,tdx:_0x440153}=_0x1731d7;let _0x28a560='.',_0x2792d8=_0x48223d[_0xc77304(0x16e)];if(_0x2ac8d7[0x0]){const {promises:_0x1e2150}=await import('fs');try{const _0x48cfa4=await _0x1e2150[_0xc77304(0xf3)](_0x2ac8d7[0x0]);if(_0x48cfa4[_0xc77304(0x161)]())_0x28a560=_0x2ac8d7[0x0];else return console['error'](_0xc77304(0xef)+_0x2ac8d7[0x0]+'\x20is\x20not\x20a\x20directory'),0x1;}catch{_0x2792d8=_0x2ac8d7[0x0],_0x28a560='.';}}const _0x39798a=_0x48223d[_0xc77304(0x143)],_0x51d6b6=_0x48223d[_0xc77304(0x12d)];_0x48223d[_0xc77304(0x142)]&&(console[_0xc77304(0x115)](_0xc77304(0x103)+_0x28a560),_0x2792d8&&console[_0xc77304(0x115)](_0xc77304(0xdd)+_0x2792d8),_0x39798a&&console[_0xc77304(0x115)]('Revision:\x20'+_0x39798a),_0x51d6b6&&console[_0xc77304(0x115)](_0xc77304(0x168)));const _0x2185dc=await withSpinner(_0xc77304(0x152),()=>_0x440153[_0xc77304(0xd7)]['push'](_0x28a560,{'projectName':_0x2792d8,'revision':_0x39798a,'skipValidation':_0x51d6b6}),{'verbose':_0x48223d[_0xc77304(0x142)]}),_0x308212=_0x2185dc[_0xc77304(0x17c)];return console[_0xc77304(0x115)](_0xc77304(0x140)+_0x308212[_0xc77304(0x139)]),console['error'](_0xc77304(0xdf)+_0x308212['projectId']),console[_0xc77304(0x115)](_0xc77304(0x117)+_0x308212[_0xc77304(0x143)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a42_0x156904(0x16e)]=a42_0x156904(0xe7);[a42_0x156904(0xe6)]=a42_0x156904(0x107);async[a42_0x156904(0xee)](_0x5d2ca3){const _0x4e969b=a42_0x156904,{options:_0x44270d,args:_0x47bca9,tdx:_0x11e1f3}=_0x5d2ca3,_0x279ee3=_0x47bca9[0x0];if(!_0x279ee3)return console[_0x4e969b(0x115)](_0x4e969b(0xdc)),console[_0x4e969b(0x115)](_0x4e969b(0x11d)),0x1;_0x44270d[_0x4e969b(0x142)]&&console[_0x4e969b(0x115)]('Project:\x20'+_0x279ee3);if(!_0x44270d[_0x4e969b(0x122)]){const _0xf69cab=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22'+_0x279ee3+_0x4e969b(0xe2));if(!_0xf69cab)return console['error'](_0x4e969b(0x14f)),0x0;}const _0x2051e1=await withSpinner('Deleting\x20project\x20'+_0x279ee3+'...',()=>_0x11e1f3[_0x4e969b(0xd7)][_0x4e969b(0xe8)](_0x279ee3),{'verbose':_0x44270d[_0x4e969b(0x142)]}),_0x213d5f=_0x2051e1[_0x4e969b(0x17c)];return console[_0x4e969b(0x115)](_0x4e969b(0x16a)+_0x213d5f[_0x4e969b(0x139)]),console['error'](_0x4e969b(0xdf)+_0x213d5f[_0x4e969b(0x155)]),0x0;}}
1
+ const a42_0x1c8bd5=a42_0x2a1e;(function(_0x2d8028,_0xe06ef1){const _0xa697a4=a42_0x2a1e,_0x1d6525=_0x2d8028();while(!![]){try{const _0x1701b2=parseInt(_0xa697a4(0xa9))/0x1*(parseInt(_0xa697a4(0xeb))/0x2)+parseInt(_0xa697a4(0xfc))/0x3*(parseInt(_0xa697a4(0x109))/0x4)+parseInt(_0xa697a4(0xd8))/0x5*(parseInt(_0xa697a4(0xb4))/0x6)+-parseInt(_0xa697a4(0x92))/0x7+parseInt(_0xa697a4(0x85))/0x8+parseInt(_0xa697a4(0xfd))/0x9*(-parseInt(_0xa697a4(0xb6))/0xa)+-parseInt(_0xa697a4(0xaf))/0xb*(parseInt(_0xa697a4(0x75))/0xc);if(_0x1701b2===_0xe06ef1)break;else _0x1d6525['push'](_0x1d6525['shift']());}catch(_0x114766){_0x1d6525['push'](_0x1d6525['shift']());}}}(a42_0x2f56,0xba624));function a42_0x2f56(){const _0x5c1cbb=['\x20\x20Project\x20ID:\x20','\x20\x20Session\x20ID:\x20','workflow:retry','workflow:attempt','workflow:download','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','Show\x20logs\x20for\x20a\x20workflow\x20attempt','retryAttempt','1705235gFtcaa','substring','\x20attempt','download','attempts','Including\x20subtasks:\x20yes','List\x20workflow\x20execution\x20sessions','\x20\x20Attempt\x20ID:\x20','\x20is\x20not\x20a\x20directory','select','startsWith','Retry\x20a\x20session\x20or\x20attempt','Retrying\x20session...','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','Kill\x20a\x20running\x20attempt','cause','Pushing\x20workflow\x20project...','data','workflow:logs','Resume\x20from:\x20','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','workflow:kill','workflow:push','59064ksqrle','Getting\x20attempt\x20tasks...','attemptId','List\x20workflows','Listing\x20workflow\x20sessions...','Listing\x20workflows...','121ntznZF','Pattern:\x20','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','projectName','Getting\x20attempt\x20details...','2817102mjCtzr','taskName','10ZzqGpT','fromTask','attempt:','format','Listing\x20workflow\x20projects...','Downloading\x20project\x20','log','Error:\x20Attempt\x20ID\x20is\x20required','List\x20workflow\x20attempts','delete','✔\x20Retry\x20started','readFile','\x20\x20New\x20attempt\x20ID:\x20','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','Start\x20a\x20workflow\x20run','workflow','Session\x20time:\x20','\x20workflow','skipValidation','\x20\x20Project:\x20','No\x20log\x20files\x20found\x20for\x20this\x20attempt','fileSize','Attempt\x20ID:\x20','...','Error:\x20','\x20\x20Cause:\x20','Killing\x20attempt...','Parameters:\x20','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Workflow:\x20','projectId','workflows','revision','getTime','5RlQtmQ','Reason:\x20','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','Fetching\x20log\x20files...','resumeFrom','Deleting\x20project\x20','Starting\x20workflow\x20run...','Error:\x20Invalid\x20parameter\x20format:\x20','✔\x20Found\x20','utf-8','includeRetried','\x20\x20Workflow:\x20','task','index','kill','createdAt','Project\x20filter:\x20','isDirectory','workflow:sessions','18xHDFjL','message','\x20\x20Location:\x20','List\x20all\x20workflow\x20projects','includeSubtasks','split','\x22?\x20This\x20cannot\x20be\x20undone.','execute','round','workflow:attempts','force','Params:\x20','Filter:\x20project=','sessionId','project','tasks','logFiles','5793hEeqqI','11035431WZbCPJ','keys','stringify','error','Revision:\x20','parse','attempt','Project:\x20','From\x20task:\x20','verbose','yes','length','1032EZqzGH','Select\x20a\x20task\x20to\x20view\x20logs:','No\x20log\x20content\x20found','Task\x20name:\x20','projects','workflow:delete','retryAttemptName','limit','session','retrySession','stat','workflow:tasks','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','Project\x20name:\x20','name','filesExtracted','fs/promises','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','workflow:run','Expected\x20format:\x20--param\x20key=value','workflow:projects','Error:\x20Project\x20name\x20is\x20required','706956tuSfum','Cancelled','description','\x20project','Filter:\x20','done','indexOf','sessions','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','✔\x20Workflow\x20run\x20started','\x20\x20Revision:\x20','finishedAt','params','Force:\x20yes','status','logs','11055552xyLTfM','Validation:\x20skipped','Listing\x20workflow\x20attempts...','push','sessionTime'];a42_0x2f56=function(){return _0x5c1cbb;};return a42_0x2f56();}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 a42_0x5da6d2 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a42_0x1c8bd5(0x117)]=a42_0x1c8bd5(0x73);[a42_0x1c8bd5(0x77)]=a42_0x1c8bd5(0xee);async[a42_0x1c8bd5(0xf2)](_0x53422b){const _0x25e4b8=a42_0x1c8bd5,{options:_0x5ea0bd,args:_0x25b0d2,tdx:_0x31711f}=_0x53422b,_0x30210e=_0x25b0d2[0x0];try{_0x5ea0bd[_0x25e4b8(0x106)]&&_0x30210e&&console[_0x25e4b8(0x100)](_0x25e4b8(0xb0)+_0x30210e);const _0x94f6db=await withSpinner(_0x25e4b8(0xba),()=>_0x31711f[_0x25e4b8(0xc5)][_0x25e4b8(0x10d)](_0x30210e,{'limit':_0x5ea0bd[_0x25e4b8(0x110)]}),{'verbose':_0x5ea0bd[_0x25e4b8(0x106)]}),_0x3d9a60=_0x94f6db['data'];return console[_0x25e4b8(0x100)](_0x25e4b8(0xe0)+_0x3d9a60['length']+_0x25e4b8(0x78)+(_0x3d9a60[_0x25e4b8(0x108)]!==0x1?'s':'')),await handleSDKOutput(_0x3d9a60,_0x5ea0bd),0x0;}catch(_0x3d573a){if(_0x3d573a instanceof SDKError)return console[_0x25e4b8(0x100)](_0x25e4b8(0xce)+_0x3d573a[_0x25e4b8(0xec)]),_0x3d573a[_0x25e4b8(0xa1)]&&console[_0x25e4b8(0x100)](_0x25e4b8(0xcf)+_0x3d573a[_0x25e4b8(0xa1)]),0x1;throw _0x3d573a;}}}function a42_0x2a1e(_0x2b21ff,_0x46b24c){_0x2b21ff=_0x2b21ff-0x6e;const _0x2f5618=a42_0x2f56();let _0x2a1e68=_0x2f5618[_0x2b21ff];return _0x2a1e68;}export class WorkflowWorkflowsCommand extends BaseCommand{[a42_0x1c8bd5(0x117)]='workflow:workflows';['description']=a42_0x1c8bd5(0xac);async[a42_0x1c8bd5(0xf2)](_0x53b0db){const _0x56b76d=a42_0x1c8bd5,{options:_0x55d7cc,args:_0x3cf8a0,tdx:_0x4b0294}=_0x53b0db,_0x54c00e=_0x3cf8a0[0x0];try{_0x55d7cc[_0x56b76d(0x106)]&&_0x54c00e&&console['error'](_0x56b76d(0xe8)+_0x54c00e);const _0x4c8c4b=await withSpinner(_0x56b76d(0xae),()=>_0x4b0294[_0x56b76d(0xc5)][_0x56b76d(0xd5)](_0x54c00e,{'limit':_0x55d7cc[_0x56b76d(0x110)]}),{'verbose':_0x55d7cc[_0x56b76d(0x106)]}),_0x5ef5b5=_0x4c8c4b['data'];return console[_0x56b76d(0x100)](_0x56b76d(0xe0)+_0x5ef5b5[_0x56b76d(0x108)]+_0x56b76d(0xc7)+(_0x5ef5b5[_0x56b76d(0x108)]!==0x1?'s':'')),await handleSDKOutput(_0x5ef5b5,_0x55d7cc),0x0;}catch(_0x1520b6){if(_0x1520b6 instanceof SDKError)return console[_0x56b76d(0x100)](_0x56b76d(0xce)+_0x1520b6['message']),_0x1520b6['cause']&&console['error'](_0x56b76d(0xcf)+_0x1520b6[_0x56b76d(0xa1)]),0x1;throw _0x1520b6;}}}export class WorkflowSessionsCommand extends BaseCommand{[a42_0x1c8bd5(0x117)]=a42_0x1c8bd5(0xea);[a42_0x1c8bd5(0x77)]=a42_0x1c8bd5(0x98);async['execute'](_0x491616){const _0x51f63e=a42_0x1c8bd5,{options:_0x3f384b,args:_0x5711ad,tdx:_0x2a6315}=_0x491616;let _0x5bf1cc,_0x1ee94e;if(_0x5711ad[0x0]){const _0x2558dc=_0x5711ad[0x0]['split']('.');if(_0x2558dc[_0x51f63e(0x108)]===0x1)_0x5bf1cc=_0x2558dc[0x0];else{if(_0x2558dc[_0x51f63e(0x108)]===0x2)[_0x5bf1cc,_0x1ee94e]=_0x2558dc;else return console[_0x51f63e(0x100)](_0x51f63e(0xd2)),0x1;}}try{if(_0x3f384b[_0x51f63e(0x106)]){if(_0x5bf1cc&&_0x1ee94e)console[_0x51f63e(0x100)](_0x51f63e(0x79)+_0x5bf1cc+'.'+_0x1ee94e);else _0x5bf1cc&&console[_0x51f63e(0x100)](_0x51f63e(0xf7)+_0x5bf1cc);const _0xd49ade=_0x3f384b[_0x51f63e(0x83)];_0xd49ade&&console[_0x51f63e(0x100)]('Status:\x20'+_0xd49ade);}const _0x3bc212=await withSpinner(_0x51f63e(0xad),()=>_0x2a6315[_0x51f63e(0xc5)][_0x51f63e(0x7c)]({'projectName':_0x5bf1cc,'workflowName':_0x1ee94e,'status':_0x3f384b[_0x51f63e(0x83)],'fromTime':_0x3f384b['from'],'toTime':_0x3f384b['to'],'limit':_0x3f384b[_0x51f63e(0x110)]}),{'verbose':_0x3f384b[_0x51f63e(0x106)]}),_0x14da97=_0x3bc212['data'];return console[_0x51f63e(0x100)]('✔\x20Found\x20'+_0x14da97[_0x51f63e(0x108)]+'\x20session'+(_0x14da97['length']!==0x1?'s':'')),await handleSDKOutput(_0x14da97,_0x3f384b),0x0;}catch(_0x47426b){if(_0x47426b instanceof SDKError)return console[_0x51f63e(0x100)](_0x51f63e(0xce)+_0x47426b[_0x51f63e(0xec)]),_0x47426b['cause']&&console['error'](_0x51f63e(0xcf)+_0x47426b['cause']),0x1;throw _0x47426b;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a42_0x1c8bd5(0x117)]=a42_0x1c8bd5(0xf4);[a42_0x1c8bd5(0x77)]=a42_0x1c8bd5(0xbe);async[a42_0x1c8bd5(0xf2)](_0x5618ed){const _0x2ec2e7=a42_0x1c8bd5,{options:_0x47ed37,args:_0x1c16bf,tdx:_0x2ce1eb}=_0x5618ed;let _0x27ff34,_0x51d26f;if(_0x1c16bf[0x0]){const _0x1d0703=_0x1c16bf[0x0][_0x2ec2e7(0xf0)]('.');if(_0x1d0703[_0x2ec2e7(0x108)]===0x1)_0x27ff34=_0x1d0703[0x0];else{if(_0x1d0703[_0x2ec2e7(0x108)]===0x2)[_0x27ff34,_0x51d26f]=_0x1d0703;else return console[_0x2ec2e7(0x100)](_0x2ec2e7(0xd2)),0x1;}}try{const _0x363607=_0x47ed37[_0x2ec2e7(0xe2)];if(_0x47ed37[_0x2ec2e7(0x106)]){if(_0x27ff34&&_0x51d26f)console[_0x2ec2e7(0x100)](_0x2ec2e7(0x79)+_0x27ff34+'.'+_0x51d26f);else _0x27ff34&&console[_0x2ec2e7(0x100)](_0x2ec2e7(0xf7)+_0x27ff34);_0x363607&&console[_0x2ec2e7(0x100)]('Include\x20retried:\x20yes');}const _0x2d3c9f=await withSpinner(_0x2ec2e7(0x87),()=>_0x2ce1eb['workflow'][_0x2ec2e7(0x96)]({'projectName':_0x27ff34,'workflowName':_0x51d26f,'includeRetried':_0x363607,'limit':_0x47ed37['limit']}),{'verbose':_0x47ed37[_0x2ec2e7(0x106)]}),_0x322c4c=_0x2d3c9f['data'];return console['error'](_0x2ec2e7(0xe0)+_0x322c4c['length']+_0x2ec2e7(0x94)+(_0x322c4c[_0x2ec2e7(0x108)]!==0x1?'s':'')),await handleSDKOutput(_0x322c4c,_0x47ed37),0x0;}catch(_0x255910){if(_0x255910 instanceof SDKError)return console[_0x2ec2e7(0x100)](_0x2ec2e7(0xce)+_0x255910[_0x2ec2e7(0xec)]),_0x255910[_0x2ec2e7(0xa1)]&&console[_0x2ec2e7(0x100)](_0x2ec2e7(0xcf)+_0x255910['cause']),0x1;throw _0x255910;}}}export class WorkflowAttemptCommand extends BaseCommand{[a42_0x1c8bd5(0x117)]=a42_0x1c8bd5(0x8d);['description']='Show\x20specific\x20attempt\x20details';async[a42_0x1c8bd5(0xf2)](_0x15f695){const _0x337767=a42_0x1c8bd5,{options:_0x535038,args:_0x15db23,tdx:_0x257ad7}=_0x15f695,_0xef929a=_0x15db23[0x0];if(!_0xef929a)return console[_0x337767(0x100)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x535038[_0x337767(0x106)]&&console[_0x337767(0x100)](_0x337767(0xcc)+_0xef929a);const _0x126822=await withSpinner(_0x337767(0xb3),()=>_0x257ad7[_0x337767(0xc5)][_0x337767(0x103)](_0xef929a),{'verbose':_0x535038[_0x337767(0x106)]}),_0x1eb8fc=_0x126822[_0x337767(0xa3)];let _0x1f110f;!_0x1eb8fc[_0x337767(0x7a)]?_0x1f110f=_0x1eb8fc['cancelRequested']?'canceling':'running':_0x1f110f=_0x1eb8fc['success']?'success':_0x337767(0x100);let _0x241293;if(_0x1eb8fc[_0x337767(0xe7)]&&_0x1eb8fc[_0x337767(0x80)]){const _0x20ff4f=new Date(_0x1eb8fc['createdAt'])[_0x337767(0xd7)](),_0x12b061=new Date(_0x1eb8fc[_0x337767(0x80)])['getTime']();_0x241293=Math[_0x337767(0xf3)]((_0x12b061-_0x20ff4f)/0x3e8);}const _0x14822b={'attempt_id':_0x1eb8fc['id'],'status':_0x1f110f,..._0x1eb8fc[_0x337767(0xe5)]!==undefined&&{'index':_0x1eb8fc[_0x337767(0xe5)]},..._0x1eb8fc['project']&&{'project':_0x1eb8fc[_0x337767(0xf9)][_0x337767(0x117)]},..._0x1eb8fc[_0x337767(0xc5)]&&{'workflow':_0x1eb8fc[_0x337767(0xc5)]['name']},..._0x1eb8fc['sessionId']&&{'session_id':_0x1eb8fc[_0x337767(0xf8)]},..._0x1eb8fc[_0x337767(0x89)]&&{'session_time':_0x1eb8fc['sessionTime']},..._0x1eb8fc[_0x337767(0x10f)]&&{'retry_attempt':_0x1eb8fc['retryAttemptName']},..._0x241293!==undefined&&{'duration_sec':_0x241293},..._0x1eb8fc[_0x337767(0xe7)]&&{'created_at':_0x1eb8fc[_0x337767(0xe7)]},..._0x1eb8fc[_0x337767(0x80)]&&{'finished_at':_0x1eb8fc[_0x337767(0x80)]},...Object[_0x337767(0xfe)](_0x1eb8fc[_0x337767(0x81)])[_0x337767(0x108)]>0x0&&{'params':_0x1eb8fc[_0x337767(0x81)]}};return await handleSingleObjectOutput(_0x14822b,_0x535038),0x0;}catch(_0x3272ac){if(_0x3272ac instanceof SDKError)return console[_0x337767(0x100)](_0x337767(0xce)+_0x3272ac[_0x337767(0xec)]),_0x3272ac[_0x337767(0xa1)]&&console[_0x337767(0x100)](_0x337767(0xcf)+_0x3272ac[_0x337767(0xa1)]),0x1;throw _0x3272ac;}}}export class WorkflowTasksCommand extends BaseCommand{[a42_0x1c8bd5(0x117)]=a42_0x1c8bd5(0x114);[a42_0x1c8bd5(0x77)]='Show\x20tasks\x20for\x20an\x20attempt';async[a42_0x1c8bd5(0xf2)](_0x1dec3e){const _0x1ff6d0=a42_0x1c8bd5,{options:_0x2424fd,args:_0x46c12e,tdx:_0x1e4b03}=_0x1dec3e,_0x209d80=_0x46c12e[0x0];if(!_0x209d80)return console[_0x1ff6d0(0x100)](_0x1ff6d0(0xbd)),0x1;try{const _0x1eb8a8=_0x2424fd[_0x1ff6d0(0xef)];_0x2424fd[_0x1ff6d0(0x106)]&&(console[_0x1ff6d0(0x100)](_0x1ff6d0(0xcc)+_0x209d80),_0x1eb8a8&&console[_0x1ff6d0(0x100)](_0x1ff6d0(0x97)));const _0x402638=await withSpinner(_0x1ff6d0(0xaa),()=>_0x1e4b03[_0x1ff6d0(0xc5)][_0x1ff6d0(0xfa)](_0x209d80,_0x1eb8a8||![]),{'verbose':_0x2424fd[_0x1ff6d0(0x106)]}),_0x52473f=_0x402638[_0x1ff6d0(0xa3)];return console[_0x1ff6d0(0x100)]('✔\x20Found\x20'+_0x52473f['length']+'\x20task'+(_0x52473f['length']!==0x1?'s':'')),await handleSDKOutput(_0x52473f,_0x2424fd),0x0;}catch(_0x22a790){if(_0x22a790 instanceof SDKError)return console[_0x1ff6d0(0x100)]('Error:\x20'+_0x22a790['message']),_0x22a790[_0x1ff6d0(0xa1)]&&console[_0x1ff6d0(0x100)]('\x20\x20Cause:\x20'+_0x22a790[_0x1ff6d0(0xa1)]),0x1;throw _0x22a790;}}}export class WorkflowLogsCommand extends BaseCommand{[a42_0x1c8bd5(0x117)]=a42_0x1c8bd5(0xa4);[a42_0x1c8bd5(0x77)]=a42_0x1c8bd5(0x90);async[a42_0x1c8bd5(0xf2)](_0x3a06b1){const _0x47069b=a42_0x1c8bd5,{options:_0x5f2197,args:_0x161ff5,tdx:_0x589d1b}=_0x3a06b1,_0x1551ee=_0x161ff5[0x0];let _0x504c04=_0x161ff5[0x1];if(!_0x1551ee)return console[_0x47069b(0x100)](_0x47069b(0xbd)),0x1;try{_0x5f2197['verbose']&&(console[_0x47069b(0x100)](_0x47069b(0xcc)+_0x1551ee),_0x504c04&&console[_0x47069b(0x100)](_0x47069b(0x10c)+_0x504c04));const _0x1b1150=await withSpinner(_0x47069b(0xdb),()=>_0x589d1b[_0x47069b(0xc5)][_0x47069b(0xfb)](_0x1551ee,_0x504c04),{'verbose':_0x5f2197[_0x47069b(0x106)]}),_0x295424=_0x1b1150['data'];if(_0x295424[_0x47069b(0x108)]===0x0)return console[_0x47069b(0x100)](_0x47069b(0xca)),0x0;if(!_0x504c04&&(_0x5f2197['json']||_0x5f2197[_0x47069b(0xb9)]))return await handleSDKOutput(_0x295424,_0x5f2197),0x0;if(!_0x504c04){const _0x5d96fb=_0x295424['map'](_0x1d2ec1=>({'title':_0x1d2ec1[_0x47069b(0xb5)]+'\x20('+formatBytes(_0x1d2ec1[_0x47069b(0xcb)])+')','value':_0x1d2ec1[_0x47069b(0xb5)]})),_0x25bb7a=await a42_0x5da6d2({'type':_0x47069b(0x9b),'name':'task','message':_0x47069b(0x10a),'choices':_0x5d96fb});if(!_0x25bb7a['task'])return console[_0x47069b(0x100)](_0x47069b(0x76)),0x0;_0x504c04=_0x25bb7a[_0x47069b(0xe4)];}const _0x761230=await withSpinner('Downloading\x20logs...',()=>_0x589d1b[_0x47069b(0xc5)][_0x47069b(0x84)](_0x1551ee,_0x504c04),{'verbose':_0x5f2197[_0x47069b(0x106)]}),_0x378960=_0x761230[_0x47069b(0xa3)];return _0x378960?console[_0x47069b(0xbc)](_0x378960):console['error'](_0x47069b(0x10b)),0x0;}catch(_0x1a0b85){if(_0x1a0b85 instanceof SDKError)return console['error']('Error:\x20'+_0x1a0b85['message']),_0x1a0b85[_0x47069b(0xa1)]&&console[_0x47069b(0x100)](_0x47069b(0xcf)+_0x1a0b85['cause']),0x1;throw _0x1a0b85;}}}export class WorkflowKillCommand extends BaseCommand{[a42_0x1c8bd5(0x117)]=a42_0x1c8bd5(0xa7);['description']=a42_0x1c8bd5(0xa0);async[a42_0x1c8bd5(0xf2)](_0x106b79){const _0x21d41e=a42_0x1c8bd5,{options:_0x572f13,args:_0x5f1920,tdx:_0x3df405}=_0x106b79,_0x24f392=_0x5f1920[0x0];if(!_0x24f392)return console[_0x21d41e(0x100)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x32b6ec=_0x572f13['reason'];_0x572f13['verbose']&&(console[_0x21d41e(0x100)](_0x21d41e(0xcc)+_0x24f392),_0x32b6ec&&console[_0x21d41e(0x100)](_0x21d41e(0xd9)+_0x32b6ec));if(!_0x572f13[_0x21d41e(0x107)]){const _0x469502=await confirm(_0x21d41e(0x7d)+_0x24f392+'?');if(!_0x469502)return console[_0x21d41e(0x100)](_0x21d41e(0x76)),0x0;}const _0x31a7f6=await withSpinner(_0x21d41e(0xd0),()=>_0x3df405[_0x21d41e(0xc5)][_0x21d41e(0xe6)](_0x24f392,_0x32b6ec),{'verbose':_0x572f13[_0x21d41e(0x106)]}),_0x2eb568=_0x31a7f6[_0x21d41e(0xa3)];return console['error']('✔\x20'+_0x2eb568),0x0;}catch(_0x46358c){if(_0x46358c instanceof SDKError)return console['error']('Error:\x20'+_0x46358c[_0x21d41e(0xec)]),_0x46358c[_0x21d41e(0xa1)]&&console['error'](_0x21d41e(0xcf)+_0x46358c[_0x21d41e(0xa1)]),0x1;throw _0x46358c;}}}export class WorkflowRetryCommand extends BaseCommand{[a42_0x1c8bd5(0x117)]=a42_0x1c8bd5(0x8c);[a42_0x1c8bd5(0x77)]=a42_0x1c8bd5(0x9d);async['execute'](_0x3de1ae){const _0x8043df=a42_0x1c8bd5,{options:_0x26588c,args:_0x2c4448,tdx:_0x35d1c2}=_0x3de1ae,_0x15ec8f=_0x2c4448[0x0];if(!_0x15ec8f)return console[_0x8043df(0x100)]('Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required'),console[_0x8043df(0x100)](_0x8043df(0xda)),0x1;let _0x24561d=![],_0x5ca0fb=_0x15ec8f;if(_0x15ec8f['startsWith']('session:'))_0x24561d=!![],_0x5ca0fb=_0x15ec8f['substring'](0x8);else{if(_0x15ec8f[_0x8043df(0x9c)](_0x8043df(0xb8)))_0x24561d=![],_0x5ca0fb=_0x15ec8f['substring'](0x8);else return console[_0x8043df(0x100)](_0x8043df(0x115)),console['error'](_0x8043df(0xda)),0x1;}try{const _0x1f6fb7=_0x26588c[_0x8043df(0xb7)],_0x52e634=_0x26588c[_0x8043df(0xdc)],_0x476ae7=_0x26588c['params'],_0x472322=_0x26588c[_0x8043df(0xf5)];_0x26588c['verbose']&&(console[_0x8043df(0x100)]('Target:\x20'+(_0x24561d?_0x8043df(0x111):'attempt')+'\x20'+_0x5ca0fb),_0x1f6fb7&&console[_0x8043df(0x100)](_0x8043df(0x105)+_0x1f6fb7),_0x52e634&&console[_0x8043df(0x100)](_0x8043df(0xa5)+_0x52e634),_0x476ae7&&console[_0x8043df(0x100)](_0x8043df(0xf6)+_0x476ae7),_0x472322&&console[_0x8043df(0x100)](_0x8043df(0x82)));let _0x46dd4d;if(_0x476ae7)try{if(_0x476ae7[_0x8043df(0x9c)]('@')){const _0x4be510=await import(_0x8043df(0x6f)),_0x109809=_0x476ae7['substring'](0x1),_0x3a169f=await _0x4be510[_0x8043df(0xc1)](_0x109809,_0x8043df(0xe1));_0x46dd4d=JSON[_0x8043df(0x102)](_0x3a169f);}else _0x46dd4d=JSON[_0x8043df(0x102)](_0x476ae7);}catch{return console['error']('Error:\x20Invalid\x20JSON\x20in\x20--params'),0x1;}if(!_0x26588c['yes']){const _0x6e7f33=await confirm(_0x8043df(0x9f)+(_0x24561d?'session':'attempt')+'\x20'+_0x5ca0fb+'?');if(!_0x6e7f33)return console[_0x8043df(0x100)](_0x8043df(0x76)),0x0;}let _0x16574a;_0x24561d?_0x16574a=await withSpinner(_0x8043df(0x9e),()=>_0x35d1c2[_0x8043df(0xc5)][_0x8043df(0x112)](_0x5ca0fb,{'fromTask':_0x1f6fb7,'retryParams':_0x46dd4d}),{'verbose':_0x26588c[_0x8043df(0x106)]}):_0x16574a=await withSpinner('Retrying\x20attempt...',()=>_0x35d1c2[_0x8043df(0xc5)][_0x8043df(0x91)](_0x5ca0fb,{'resumeFrom':_0x52e634,'retryParams':_0x46dd4d,'force':_0x472322}),{'verbose':_0x26588c[_0x8043df(0x106)]});const _0x2267d2=_0x16574a['data'];return console[_0x8043df(0x100)](_0x8043df(0xc0)),console[_0x8043df(0x100)](_0x8043df(0xc2)+_0x2267d2[_0x8043df(0xab)]),console['error'](_0x8043df(0x8b)+_0x2267d2[_0x8043df(0xf8)]),0x0;}catch(_0x44d8eb){if(_0x44d8eb instanceof SDKError)return console['error'](_0x8043df(0xce)+_0x44d8eb['message']),_0x44d8eb[_0x8043df(0xa1)]&&console[_0x8043df(0x100)](_0x8043df(0xcf)+_0x44d8eb[_0x8043df(0xa1)]),0x1;throw _0x44d8eb;}}}export class WorkflowRunCommand extends BaseCommand{[a42_0x1c8bd5(0x117)]=a42_0x1c8bd5(0x71);[a42_0x1c8bd5(0x77)]=a42_0x1c8bd5(0xc4);async[a42_0x1c8bd5(0xf2)](_0x59eea0){const _0x3c55a0=a42_0x1c8bd5,{options:_0x1a39bd,args:_0x85ec4b,tdx:_0x259236}=_0x59eea0,_0x3db4fb=_0x85ec4b[0x0];if(!_0x3db4fb)return console[_0x3c55a0(0x100)]('Error:\x20Workflow\x20identifier\x20is\x20required'),console[_0x3c55a0(0x100)](_0x3c55a0(0xa6)),0x1;const _0x4e1beb=_0x1a39bd['param'],_0x844889=_0x1a39bd['sessionTime'],_0x4f140a={};if(_0x4e1beb&&Array['isArray'](_0x4e1beb))for(const _0x4a3d4e of _0x4e1beb){const _0x3feb3a=_0x4a3d4e[_0x3c55a0(0x7b)]('=');if(_0x3feb3a===-0x1)return console[_0x3c55a0(0x100)](_0x3c55a0(0xdf)+_0x4a3d4e),console[_0x3c55a0(0x100)](_0x3c55a0(0x72)),0x1;const _0x71df3b=_0x4a3d4e[_0x3c55a0(0x93)](0x0,_0x3feb3a),_0x3478d5=_0x4a3d4e[_0x3c55a0(0x93)](_0x3feb3a+0x1);try{_0x4f140a[_0x71df3b]=JSON[_0x3c55a0(0x102)](_0x3478d5);}catch{_0x4f140a[_0x71df3b]=_0x3478d5;}}_0x1a39bd[_0x3c55a0(0x106)]&&(console[_0x3c55a0(0x100)](_0x3c55a0(0xd3)+_0x3db4fb),Object[_0x3c55a0(0xfe)](_0x4f140a)[_0x3c55a0(0x108)]>0x0&&console[_0x3c55a0(0x100)](_0x3c55a0(0xd1)+JSON[_0x3c55a0(0xff)](_0x4f140a)),_0x844889&&console['error'](_0x3c55a0(0xc6)+_0x844889));const _0x2847e3=await withSpinner(_0x3c55a0(0xde),()=>_0x259236[_0x3c55a0(0xc5)]['run'](_0x3db4fb,_0x4f140a,{'sessionTime':_0x844889}),{'verbose':_0x1a39bd[_0x3c55a0(0x106)]}),_0x4a2c03=_0x2847e3[_0x3c55a0(0xa3)];return console[_0x3c55a0(0x100)](_0x3c55a0(0x7e)),console[_0x3c55a0(0x100)](_0x3c55a0(0x99)+_0x4a2c03['id']),console['error']('\x20\x20Session\x20ID:\x20'+_0x4a2c03[_0x3c55a0(0xf8)]),console[_0x3c55a0(0x100)](_0x3c55a0(0xc9)+_0x4a2c03[_0x3c55a0(0xf9)]?.['name']),console[_0x3c55a0(0x100)](_0x3c55a0(0xe3)+_0x4a2c03[_0x3c55a0(0xc5)]?.['name']),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{['name']=a42_0x1c8bd5(0x8e);[a42_0x1c8bd5(0x77)]='Download\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a42_0x1c8bd5(0xf2)](_0x44f645){const _0x550997=a42_0x1c8bd5,{options:_0x5b0329,args:_0x430b48,tdx:_0x40be36}=_0x44f645,_0xd17509=_0x430b48[0x0],_0x233159=_0x430b48[0x1]||'.';if(!_0xd17509)return console[_0x550997(0x100)](_0x550997(0x74)),console['error'](_0x550997(0xc3)),0x1;const _0x1ede09=_0x5b0329[_0x550997(0xd6)];_0x5b0329['verbose']&&(console[_0x550997(0x100)](_0x550997(0x104)+_0xd17509),console[_0x550997(0x100)]('Output\x20directory:\x20'+_0x233159),_0x1ede09&&console[_0x550997(0x100)](_0x550997(0x101)+_0x1ede09));const _0x3e8931=await withSpinner(_0x550997(0xbb)+_0xd17509+_0x550997(0xcd),()=>_0x40be36['workflow'][_0x550997(0x95)](_0xd17509,_0x233159,{'revision':_0x1ede09}),{'verbose':_0x5b0329['verbose']}),_0x352b10=_0x3e8931[_0x550997(0xa3)];return console['error']('✔\x20Downloaded\x20'+_0x352b10[_0x550997(0xb2)]),console[_0x550997(0x100)]('\x20\x20Revision:\x20'+_0x352b10[_0x550997(0xd6)]),console['error']('\x20\x20Files\x20extracted:\x20'+_0x352b10[_0x550997(0x6e)]),console[_0x550997(0x100)](_0x550997(0xed)+_0x233159+'/'+_0x352b10['projectName']),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a42_0x1c8bd5(0x117)]=a42_0x1c8bd5(0xa8);[a42_0x1c8bd5(0x77)]=a42_0x1c8bd5(0xb1);async['execute'](_0x5b5986){const _0x3a4b95=a42_0x1c8bd5,{options:_0x2c87ba,args:_0x1fd114,tdx:_0x19558c}=_0x5b5986;let _0xf83cc7='.',_0x3f32df=_0x2c87ba[_0x3a4b95(0x117)];if(_0x1fd114[0x0]){const {promises:_0x3de70e}=await import('fs');try{const _0x4e9a24=await _0x3de70e[_0x3a4b95(0x113)](_0x1fd114[0x0]);if(_0x4e9a24[_0x3a4b95(0xe9)]())_0xf83cc7=_0x1fd114[0x0];else return console[_0x3a4b95(0x100)](_0x3a4b95(0xce)+_0x1fd114[0x0]+_0x3a4b95(0x9a)),0x1;}catch{_0x3f32df=_0x1fd114[0x0],_0xf83cc7='.';}}const _0x3b52a8=_0x2c87ba[_0x3a4b95(0xd6)],_0x4be117=_0x2c87ba[_0x3a4b95(0xc8)];_0x2c87ba[_0x3a4b95(0x106)]&&(console[_0x3a4b95(0x100)]('Project\x20directory:\x20'+_0xf83cc7),_0x3f32df&&console[_0x3a4b95(0x100)](_0x3a4b95(0x116)+_0x3f32df),_0x3b52a8&&console[_0x3a4b95(0x100)](_0x3a4b95(0x101)+_0x3b52a8),_0x4be117&&console['error'](_0x3a4b95(0x86)));const _0x12f6fc=await withSpinner(_0x3a4b95(0xa2),()=>_0x19558c['workflow'][_0x3a4b95(0x88)](_0xf83cc7,{'projectName':_0x3f32df,'revision':_0x3b52a8,'skipValidation':_0x4be117}),{'verbose':_0x2c87ba[_0x3a4b95(0x106)]}),_0x1430b5=_0x12f6fc['data'];return console[_0x3a4b95(0x100)]('✔\x20Pushed\x20'+_0x1430b5['projectName']),console[_0x3a4b95(0x100)](_0x3a4b95(0x8a)+_0x1430b5[_0x3a4b95(0xd4)]),console[_0x3a4b95(0x100)](_0x3a4b95(0x7f)+_0x1430b5[_0x3a4b95(0xd6)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{['name']=a42_0x1c8bd5(0x10e);[a42_0x1c8bd5(0x77)]=a42_0x1c8bd5(0x8f);async[a42_0x1c8bd5(0xf2)](_0x31c104){const _0x427ea0=a42_0x1c8bd5,{options:_0xf36126,args:_0x25bf31,tdx:_0x5b4a26}=_0x31c104,_0x25741e=_0x25bf31[0x0];if(!_0x25741e)return console['error']('Error:\x20Project\x20name\x20or\x20ID\x20is\x20required'),console[_0x427ea0(0x100)]('Usage:\x20workflow:delete\x20<project-name-or-id>'),0x1;_0xf36126[_0x427ea0(0x106)]&&console[_0x427ea0(0x100)](_0x427ea0(0x104)+_0x25741e);if(!_0xf36126['yes']){const _0x1f7585=await confirm(_0x427ea0(0x70)+_0x25741e+_0x427ea0(0xf1));if(!_0x1f7585)return console[_0x427ea0(0x100)](_0x427ea0(0x76)),0x0;}const _0x2449c5=await withSpinner(_0x427ea0(0xdd)+_0x25741e+_0x427ea0(0xcd),()=>_0x5b4a26[_0x427ea0(0xc5)][_0x427ea0(0xbf)](_0x25741e),{'verbose':_0xf36126[_0x427ea0(0x106)]}),_0x5e5d33=_0x2449c5[_0x427ea0(0xa3)];return console['error']('✔\x20Deleted\x20project\x20'+_0x5e5d33['projectName']),console[_0x427ea0(0x100)](_0x427ea0(0x8a)+_0x5e5d33['projectId']),0x0;}}
package/dist/core/auth.js CHANGED
@@ -1 +1 @@
1
- (function(_0x1ab9d4,_0x2b4812){const _0x10f8c4=a43_0x3427,_0x4fad36=_0x1ab9d4();while(!![]){try{const _0x1634f7=parseInt(_0x10f8c4(0x14a))/0x1+parseInt(_0x10f8c4(0x151))/0x2+parseInt(_0x10f8c4(0x153))/0x3*(parseInt(_0x10f8c4(0x14c))/0x4)+parseInt(_0x10f8c4(0x14d))/0x5*(parseInt(_0x10f8c4(0x158))/0x6)+parseInt(_0x10f8c4(0x157))/0x7*(-parseInt(_0x10f8c4(0x156))/0x8)+parseInt(_0x10f8c4(0x146))/0x9*(-parseInt(_0x10f8c4(0x14f))/0xa)+-parseInt(_0x10f8c4(0x144))/0xb*(-parseInt(_0x10f8c4(0x154))/0xc);if(_0x1634f7===_0x2b4812)break;else _0x4fad36['push'](_0x4fad36['shift']());}catch(_0x389f81){_0x4fad36['push'](_0x4fad36['shift']());}}}(a43_0x40ad,0x9d51f));import{platform}from'os';function a43_0x3427(_0x1f8df5,_0x23ba69){_0x1f8df5=_0x1f8df5-0x144;const _0x40ad40=a43_0x40ad();let _0x342704=_0x40ad40[_0x1f8df5];return _0x342704;}import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x4cf2e1=a43_0x3427;try{const _0x5fe0b1=fileURLToPath(import.meta.url),_0x96f38=dirname(_0x5fe0b1),_0x2d49dd=join(_0x96f38,_0x4cf2e1(0x159)),_0x404471=JSON[_0x4cf2e1(0x147)](readFileSync(_0x2d49dd,_0x4cf2e1(0x148)));return _0x404471[_0x4cf2e1(0x152)];}catch{return'0.0.0';}}export function getUserAgent(){const _0x37f526=a43_0x3427,_0x376d2f=getVersion(),_0x5f0f10=platform(),_0x2cbf0f=process[_0x37f526(0x152)][_0x37f526(0x14e)]('v','');return _0x37f526(0x149)+_0x376d2f+'\x20('+_0x5f0f10+_0x37f526(0x150)+_0x2cbf0f+')';}function a43_0x40ad(){const _0x108ded=['1125685MezWFE','entries','3028IwgPzF','1503195jBcsUp','replace','4670OkEaIq',';\x20node/','334064DTMOaN','version','1011KgzWcN','14604iaaRNl','X-Trino-User','4913464OiXeKM','7aDCoFO','6wdGpcC','../../package.json','length','2629eNIAmb','Authorization','16974RmytTD','parse','utf-8','tdx/'];a43_0x40ad=function(){return _0x108ded;};return a43_0x40ad();}export function getAuthHeaders(_0x2111a4,_0x19b8c7){const _0x5e3332=a43_0x3427,_0x2af36e=getVersion(),_0xb28cfa={'User-Agent':getUserAgent(),'X-TD-Client':'tdx','X-TD-Client-Version':_0x2af36e};return _0x19b8c7&&(_0xb28cfa[_0x5e3332(0x145)]='TD1\x20'+_0x19b8c7),_0xb28cfa;}export function toHeaderRecord(_0x22cc17){const _0x22931e=a43_0x3427,_0x3bb9c5={};for(const [_0x4c61cf,_0x29ee5c]of Object[_0x22931e(0x14b)](_0x22cc17)){_0x29ee5c!==undefined&&(_0x3bb9c5[_0x4c61cf]=_0x29ee5c);}return _0x3bb9c5;}export function getTrinoHeaders(_0x53ca7a,_0x1dc4d0){const _0x1aabcf=a43_0x3427,_0x1f4e0f=getAuthHeaders(_0x53ca7a,_0x1dc4d0),_0x2e5216=toHeaderRecord(_0x1f4e0f);return delete _0x2e5216[_0x1aabcf(0x145)],_0x1dc4d0&&(_0x2e5216[_0x1aabcf(0x155)]=_0x1dc4d0),_0x2e5216;}export function hasAPIKey(_0x46d44f){const _0x115a1d=a43_0x3427,_0x131c15=getAPIKey(_0x46d44f);return _0x131c15!==undefined&&_0x131c15[_0x115a1d(0x15a)]>0x0;}
1
+ (function(_0xe20d83,_0x5b023e){const _0x4fe4e3=a43_0x3a3f,_0xe5b726=_0xe20d83();while(!![]){try{const _0x184e0d=-parseInt(_0x4fe4e3(0x142))/0x1*(-parseInt(_0x4fe4e3(0x141))/0x2)+-parseInt(_0x4fe4e3(0x13d))/0x3+parseInt(_0x4fe4e3(0x13a))/0x4+parseInt(_0x4fe4e3(0x13e))/0x5+-parseInt(_0x4fe4e3(0x133))/0x6+parseInt(_0x4fe4e3(0x140))/0x7*(parseInt(_0x4fe4e3(0x136))/0x8)+-parseInt(_0x4fe4e3(0x135))/0x9*(parseInt(_0x4fe4e3(0x143))/0xa);if(_0x184e0d===_0x5b023e)break;else _0xe5b726['push'](_0xe5b726['shift']());}catch(_0x410384){_0xe5b726['push'](_0xe5b726['shift']());}}}(a43_0x56a0,0x5c0f0));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';import{getAPIKey}from'./config.js';function a43_0x3a3f(_0x50cdf7,_0x5404e2){_0x50cdf7=_0x50cdf7-0x132;const _0x56a0b2=a43_0x56a0();let _0x3a3fd4=_0x56a0b2[_0x50cdf7];return _0x3a3fd4;}export function getVersion(){const _0x46ec09=a43_0x3a3f;try{const _0x5314fa=fileURLToPath(import.meta.url),_0x9376a0=dirname(_0x5314fa),_0x181ea8=join(_0x9376a0,_0x46ec09(0x13c)),_0x7223f8=JSON[_0x46ec09(0x134)](readFileSync(_0x181ea8,_0x46ec09(0x13f)));return _0x7223f8['version'];}catch{return _0x46ec09(0x132);}}export function getUserAgent(){const _0x370290=a43_0x3a3f,_0x35ff91=getVersion(),_0x120c10=platform(),_0x290cb4=process[_0x370290(0x139)]['replace']('v','');return'tdx/'+_0x35ff91+'\x20('+_0x120c10+';\x20node/'+_0x290cb4+')';}export function getAuthHeaders(_0x3a5cc1,_0xa0b6ac){const _0x173903=a43_0x3a3f,_0x400b6e=getVersion(),_0x34c19d={'User-Agent':getUserAgent(),'X-TD-Client':_0x173903(0x144),'X-TD-Client-Version':_0x400b6e};return _0xa0b6ac&&(_0x34c19d['Authorization']=_0x173903(0x137)+_0xa0b6ac),_0x34c19d;}function a43_0x56a0(){const _0x402b77=['350413aZPWCo','14adopvH','79055yyxCxt','113590iAEIhy','tdx','X-Trino-User','0.0.0','730002ctIlnE','parse','909VNJkCp','120fswlGu','TD1\x20','length','version','831500nWnOLN','entries','../../package.json','832635cQdDEZ','2056990KiIJZW','utf-8'];a43_0x56a0=function(){return _0x402b77;};return a43_0x56a0();}export function toHeaderRecord(_0xd3f3fd){const _0xbb2a7c=a43_0x3a3f,_0x45401a={};for(const [_0x2117d6,_0x2d13a2]of Object[_0xbb2a7c(0x13b)](_0xd3f3fd)){_0x2d13a2!==undefined&&(_0x45401a[_0x2117d6]=_0x2d13a2);}return _0x45401a;}export function getTrinoHeaders(_0x552b18,_0x46d6f3){const _0x2825a5=a43_0x3a3f,_0x3b8a38=getAuthHeaders(_0x552b18,_0x46d6f3),_0x31507f=toHeaderRecord(_0x3b8a38);return delete _0x31507f['Authorization'],_0x46d6f3&&(_0x31507f[_0x2825a5(0x145)]=_0x46d6f3),_0x31507f;}export function hasAPIKey(_0x1037db){const _0x2ffa55=a43_0x3a3f,_0x5cb6d2=getAPIKey(_0x1037db);return _0x5cb6d2!==undefined&&_0x5cb6d2[_0x2ffa55(0x138)]>0x0;}
@@ -1 +1 @@
1
- (function(_0x212435,_0x3a6a4a){const _0x262874=a44_0x5c04,_0x1b1541=_0x212435();while(!![]){try{const _0x2b6091=-parseInt(_0x262874(0x133))/0x1*(-parseInt(_0x262874(0x150))/0x2)+-parseInt(_0x262874(0x13e))/0x3+parseInt(_0x262874(0x10e))/0x4*(-parseInt(_0x262874(0x112))/0x5)+parseInt(_0x262874(0x149))/0x6+parseInt(_0x262874(0x14a))/0x7+-parseInt(_0x262874(0x129))/0x8*(parseInt(_0x262874(0x144))/0x9)+-parseInt(_0x262874(0x115))/0xa;if(_0x2b6091===_0x3a6a4a)break;else _0x1b1541['push'](_0x1b1541['shift']());}catch(_0x35b532){_0x1b1541['push'](_0x1b1541['shift']());}}}(a44_0x360e,0x303ff));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a44_0x22665a from'node:fs';import*as a44_0x4a9945 from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a44_0x73ef6f from'chalk';export function getConfigDir(){const _0x59a4c0=a44_0x5c04;return process['env'][_0x59a4c0(0x14c)]||join(homedir(),'.config',_0x59a4c0(0x146));}function a44_0x5c04(_0x58a07e,_0x3733c9){_0x58a07e=_0x58a07e-0x10a;const _0x360ea7=a44_0x360e();let _0x5c048f=_0x360ea7[_0x58a07e];return _0x5c048f;}export function getConfigFile(){const _0x446b4b=a44_0x5c04;return join(getConfigDir(),_0x446b4b(0x14e));}export function getConfigFilePath(_0x1b28ad){const _0x131826=getConfigDir();return _0x1b28ad?a44_0x4a9945['join'](_0x131826,'.env.'+_0x1b28ad):getConfigFile();}export function getCacheDir(){const _0x3ff32f=a44_0x5c04;return process[_0x3ff32f(0x145)]['TDX_CACHE_DIR']||join(homedir(),_0x3ff32f(0x116),_0x3ff32f(0x146));}export function getLLMProjectCacheFile(_0x22bd7e){const _0x2a1da3=a44_0x5c04,_0x1f6859=_0x22bd7e?_0x2a1da3(0x111)+_0x22bd7e:_0x2a1da3(0x138);return join(getCacheDir(),_0x1f6859);}export function readCachedLLMProject(_0x59d84e){const _0x5ab48b=a44_0x5c04;try{const _0x3885d1=getLLMProjectCacheFile(_0x59d84e);if(!existsSync(_0x3885d1))return null;const _0x27e772=readFileSync(_0x3885d1,_0x5ab48b(0x139))['trim']();try{const _0x20faed=JSON[_0x5ab48b(0x126)](_0x27e772);if(_0x20faed&&typeof _0x20faed['id']===_0x5ab48b(0x13b)&&typeof _0x20faed['name']===_0x5ab48b(0x13b))return _0x20faed;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x4faa55,_0x2ab7b8,_0x39849c){const _0x52cfda=a44_0x5c04;try{const _0xbac300=getCacheDir(),_0x22ce46=getLLMProjectCacheFile(_0x39849c);!existsSync(_0xbac300)&&mkdirSync(_0xbac300,{'recursive':!![]});const _0x2a1297={'name':_0x4faa55,'id':_0x2ab7b8};writeFileSync(_0x22ce46,JSON[_0x52cfda(0x10b)](_0x2a1297),'utf-8');}catch{}}export function getAccountInfoCacheFile(_0x19a775){const _0x4a6f64=a44_0x5c04,_0x1ca38f=_0x19a775?_0x4a6f64(0x12e)+_0x19a775+'.json':_0x4a6f64(0x121);return join(getCacheDir(),_0x1ca38f);}export function readCachedAccountInfo(_0x1e0aa2){const _0x13349e=a44_0x5c04;try{const _0x32abf7=getAccountInfoCacheFile(_0x1e0aa2);if(!existsSync(_0x32abf7))return null;const _0x121956=readFileSync(_0x32abf7,_0x13349e(0x139))[_0x13349e(0x117)](),_0x14121c=JSON['parse'](_0x121956);if(_0x14121c&&typeof _0x14121c[_0x13349e(0x114)]==='string'&&typeof _0x14121c[_0x13349e(0x122)]===_0x13349e(0x152))return _0x14121c;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x1da3a7,_0x48b8b0,_0x32db6d){const _0x3bdb29=a44_0x5c04;try{const _0x20ee96=getCacheDir(),_0x331ecf=getAccountInfoCacheFile(_0x32db6d);!existsSync(_0x20ee96)&&mkdirSync(_0x20ee96,{'recursive':!![]});const _0x58943f={'site':_0x1da3a7,'accountId':_0x48b8b0,'cachedAt':new Date()[_0x3bdb29(0x11c)]()};writeFileSync(_0x331ecf,JSON['stringify'](_0x58943f),_0x3bdb29(0x139));}catch{}}export function parseEnvFile(_0x5ad1f9){const _0x483f98=a44_0x5c04,_0x4ee6b1={};for(const _0x335211 of _0x5ad1f9[_0x483f98(0x14d)]('\x0a')){const _0x814cae=_0x335211[_0x483f98(0x117)]();if(!_0x814cae||_0x814cae[_0x483f98(0x13a)]('#'))continue;const _0x3fa316=_0x814cae[_0x483f98(0x11a)](/^([^=]+)=(.*)$/);if(_0x3fa316){const _0x22f9ee=_0x3fa316[0x1][_0x483f98(0x117)]();let _0xd95fcc=_0x3fa316[0x2][_0x483f98(0x117)]();(_0xd95fcc['startsWith']('\x22')&&_0xd95fcc['endsWith']('\x22')||_0xd95fcc[_0x483f98(0x13a)]('\x27')&&_0xd95fcc[_0x483f98(0x13f)]('\x27'))&&(_0xd95fcc=_0xd95fcc['slice'](0x1,-0x1)),_0x4ee6b1[_0x22f9ee]=_0xd95fcc;}}return _0x4ee6b1;}export function readUserConfig(){const _0x157de3=a44_0x5c04,_0x3ad9a9=getConfigFile();if(!existsSync(_0x3ad9a9))return{};try{const _0x5a90b5=readFileSync(_0x3ad9a9,_0x157de3(0x139));return parseEnvFile(_0x5a90b5);}catch(_0xef6218){return console[_0x157de3(0x10a)]('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x3ad9a9+':',_0xef6218),{};}}export function resolveSite(_0x39b4a0){const _0x539ec7=a44_0x5c04,_0x424196=[_0x539ec7(0x110),_0x539ec7(0x10d),_0x539ec7(0x125),_0x539ec7(0x142),_0x539ec7(0x12b),'dev-us01','dev-eu01',_0x539ec7(0x124),'stg-jp01','stg-ap03'];if(_0x424196[_0x539ec7(0x151)](_0x39b4a0))return _0x39b4a0;if(_0x39b4a0 in SITE_ALIASES)return SITE_ALIASES[_0x39b4a0];return console[_0x539ec7(0x10a)](_0x539ec7(0x13d)+_0x39b4a0+'\x27,\x20defaulting\x20to\x20us01'),_0x539ec7(0x110);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x59b5be,_0x395827){const _0x593ad3=a44_0x5c04,_0x53ce23=_0x395827||getActiveProfileName();if(_0x53ce23){const _0x35f512=_0x593ad3(0x119)+normalizeProfileForEnvVar(_0x53ce23);if(process[_0x593ad3(0x145)][_0x35f512])return process[_0x593ad3(0x145)][_0x35f512];}if(process[_0x593ad3(0x145)][_0x593ad3(0x11d)])return process[_0x593ad3(0x145)][_0x593ad3(0x11d)];if(process[_0x593ad3(0x145)][_0x593ad3(0x113)])return process['env']['TD_API_KEY'];const _0x43b1f6=_0x59b5be[_0x593ad3(0x137)]()[_0x593ad3(0x12f)](/-/g,'_'),_0x175777='TD_API_KEY_'+_0x43b1f6;if(_0x53ce23){const _0x501163=loadProfileEnv(_0x53ce23);if(_0x501163){if(_0x501163[_0x175777])return _0x501163[_0x175777];if(_0x501163[_0x593ad3(0x113)])return _0x501163[_0x593ad3(0x113)];}}const _0x5e68d6=loadUserConfigOnce();if(_0x5e68d6[_0x175777])return _0x5e68d6[_0x175777];if(_0x5e68d6[_0x593ad3(0x113)])return _0x5e68d6['TD_API_KEY'];return undefined;}export function normalizeProfileForEnvVar(_0x4e306c){const _0x456167=a44_0x5c04;return _0x4e306c[_0x456167(0x137)]()[_0x456167(0x12f)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x31a9e3,_0x92b62c){const _0x17d2ff=a44_0x5c04,_0x28c3ae=_0x92b62c||getActiveProfileName()||undefined;if(_0x28c3ae){const _0x12c143=_0x17d2ff(0x119)+normalizeProfileForEnvVar(_0x28c3ae);if(process[_0x17d2ff(0x145)][_0x12c143])return{'apiKey':process[_0x17d2ff(0x145)][_0x12c143],'source':_0x12c143+_0x17d2ff(0x147),'isDeprecated':![]};const _0x2d18a4=getCachedCredential(_0x31a9e3,_0x28c3ae);if(_0x2d18a4)return{'apiKey':_0x2d18a4,'source':_0x17d2ff(0x11f)+_0x28c3ae+')','isDeprecated':![]};const _0x51fcd2=await getKeychainAPIKey(_0x28c3ae);if(_0x51fcd2)return setCachedCredential(_0x51fcd2,_0x31a9e3,_0x28c3ae),{'apiKey':_0x51fcd2,'source':_0x17d2ff(0x11f)+_0x28c3ae+')','isDeprecated':![]};}if(process['env'][_0x17d2ff(0x11d)])return{'apiKey':process[_0x17d2ff(0x145)][_0x17d2ff(0x11d)],'source':'TDX_API_KEY\x20env\x20var','isDeprecated':![]};if(!_0x28c3ae){const _0x4f7dc6=getCachedCredential(_0x31a9e3,undefined);if(_0x4f7dc6)return{'apiKey':_0x4f7dc6,'source':_0x17d2ff(0x12a),'isDeprecated':![]};const _0x18bed5=await getKeychainAPIKey(undefined);if(_0x18bed5)return setCachedCredential(_0x18bed5,_0x31a9e3,undefined),{'apiKey':_0x18bed5,'source':_0x17d2ff(0x12a),'isDeprecated':![]};}if(process[_0x17d2ff(0x145)][_0x17d2ff(0x113)])return{'apiKey':process[_0x17d2ff(0x145)]['TD_API_KEY'],'source':_0x17d2ff(0x12d),'isDeprecated':!![]};const _0x373cd2=getLegacyEnvAPIKey(_0x31a9e3,_0x28c3ae);if(_0x373cd2){const _0x595a37=await isKeychainAvailable();if(_0x595a37)try{await saveKeychainAPIKey(_0x373cd2,_0x28c3ae),setCachedCredential(_0x373cd2,_0x31a9e3,_0x28c3ae);const _0x4debcf=getConfigFilePath(_0x28c3ae);cleanupLegacyEnvFile(_0x4debcf)&&console[_0x17d2ff(0x10a)](a44_0x73ef6f[_0x17d2ff(0x140)](_0x17d2ff(0x10c)));}catch(_0x3f240e){console[_0x17d2ff(0x10a)](a44_0x73ef6f['yellow']('⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20'+_0x3f240e));}const _0x11e73f=_0x28c3ae?_0x17d2ff(0x130)+_0x28c3ae+')':_0x17d2ff(0x123);return{'apiKey':_0x373cd2,'source':_0x11e73f,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x28c9eb,_0x5418cd,_0xbae211=!![]){const _0x4c2ad1=a44_0x5c04,_0x52cd31=await resolveAPIKeyAsync(_0x28c9eb,_0x5418cd);if(!_0x52cd31)return undefined;if(_0xbae211&&_0x52cd31[_0x4c2ad1(0x14b)]&&_0x52cd31['source']['includes'](_0x4c2ad1(0x113))){const _0x43303e=_0x5418cd||getActiveProfileName()||undefined,_0x41e42e=_0x43303e?_0x4c2ad1(0x119)+normalizeProfileForEnvVar(_0x43303e):_0x4c2ad1(0x12c);console[_0x4c2ad1(0x10a)](a44_0x73ef6f[_0x4c2ad1(0x140)](_0x4c2ad1(0x148)+('\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20'+_0x41e42e+').')));}return _0x52cd31[_0x4c2ad1(0x135)];}function getLegacyEnvAPIKey(_0x25fdfc,_0x41f8f9){const _0x50552c=a44_0x5c04,_0x410991=_0x25fdfc[_0x50552c(0x137)]()['replace'](/-/g,'_'),_0x227dea=_0x50552c(0x136)+_0x410991;if(_0x41f8f9){const _0x5107da=loadProfileEnv(_0x41f8f9);if(_0x5107da){if(_0x5107da[_0x227dea])return _0x5107da[_0x227dea];if(_0x5107da[_0x50552c(0x113)])return _0x5107da[_0x50552c(0x113)];}}const _0x19b04e=loadUserConfigOnce();if(_0x19b04e[_0x227dea])return _0x19b04e[_0x227dea];if(_0x19b04e['TD_API_KEY'])return _0x19b04e['TD_API_KEY'];return undefined;}function cleanupLegacyEnvFile(_0x366408){const _0x105885=a44_0x5c04;if(!existsSync(_0x366408))return![];try{const _0x4fc30b=readFileSync(_0x366408,'utf-8'),_0x549b3d=_0x4fc30b['split']('\x0a'),_0x2180a1=_0x549b3d['filter'](_0x487757=>{const _0x5e31a5=a44_0x5c04,_0x53a5e0=_0x487757[_0x5e31a5(0x117)]();if(!_0x53a5e0||_0x53a5e0['startsWith']('#'))return!![];const [_0x94a9ba]=_0x53a5e0['split']('=');return!_0x94a9ba[_0x5e31a5(0x13a)](_0x5e31a5(0x113));}),_0x13343d=_0x2180a1[_0x105885(0x143)](_0x1acaae=>{const _0x42889a=_0x105885,_0x4d7e25=_0x1acaae[_0x42889a(0x117)]();return _0x4d7e25&&!_0x4d7e25['startsWith']('#');});if(!_0x13343d)return unlinkSync(_0x366408),!![];return writeFileSync(_0x366408,_0x2180a1[_0x105885(0x128)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function a44_0x360e(){const _0x1c6cb9=['TD_API_KEY','site','264240UyKlMq','.cache','trim','existsSync','TDX_API_KEY_','match','map','toISOString','TDX_API_KEY','dev-eu01','keychain\x20(profile:\x20','Warning:\x20Failed\x20to\x20load\x20','account_info.json','accountId','legacy\x20.env\x20file','stg-us01','eu01','parse','tdx.json','join','25768TqxFiH','keychain','ap03','TDX_API_KEY_<PROFILE>','TD_API_KEY\x20env\x20var\x20(deprecated)','account_info.','replace','legacy\x20.env\x20file\x20(profile:\x20','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','profiles','2HvHcYL','profile','apiKey','TD_API_KEY_','toUpperCase','llm_default_project','utf-8','startsWith','string','apiKeys','Warning:\x20Unknown\x20site\x20\x27','686403djQBCI','endsWith','yellow','readFileSync','ap02','some','198FTvJJp','env','tdx','\x20env\x20var','Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a','1764336xVwmOD','2062620hHLVwp','isDeprecated','TDX_CONFIG_DIR','split','.env','.env.','135242zhlgPG','includes','number','warn','stringify','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','jp01','40048uCIHIw','entries','us01','llm_default_project.','100xzifKC'];a44_0x360e=function(){return _0x1c6cb9;};return a44_0x360e();}function loadProfileEnv(_0x1bd0a7){const _0x4558ea=a44_0x5c04,_0x34b099=a44_0x4a9945[_0x4558ea(0x128)](getConfigDir(),_0x4558ea(0x14f)+_0x1bd0a7);if(a44_0x22665a['existsSync'](_0x34b099)){validateSecureFilePermissions(_0x34b099);try{const _0xf8117a=a44_0x22665a[_0x4558ea(0x141)](_0x34b099,_0x4558ea(0x139));return parseEnvFile(_0xf8117a);}catch(_0x4d696c){console['warn'](_0x4558ea(0x120)+_0x34b099+':\x20'+_0x4d696c);}}const _0x37463a=a44_0x4a9945['join'](getConfigDir(),_0x4558ea(0x132),_0x1bd0a7,_0x4558ea(0x14e));if(a44_0x22665a[_0x4558ea(0x118)](_0x37463a)){validateSecureFilePermissions(_0x37463a);try{const _0x35e17f=a44_0x22665a[_0x4558ea(0x141)](_0x37463a,_0x4558ea(0x139));return parseEnvFile(_0x35e17f);}catch(_0x54c061){return console['warn'](_0x4558ea(0x120)+_0x37463a+':\x20'+_0x54c061),null;}}return null;}function getActiveProfileName(){const _0x359101=a44_0x5c04,_0x5974dd=a44_0x4a9945[_0x359101(0x128)](getConfigDir(),_0x359101(0x127));if(!a44_0x22665a[_0x359101(0x118)](_0x5974dd))return null;try{const _0x221742=a44_0x22665a[_0x359101(0x141)](_0x5974dd,_0x359101(0x139)),_0x5ba67b=JSON['parse'](_0x221742);return _0x5ba67b[_0x359101(0x134)]||null;}catch{return null;}}export function saveAPIKey(_0x2f590b,_0x58b6ca,_0x207b3d){const _0x349ca3=a44_0x5c04,_0xfa70d0=getConfigDir(),_0x2ddf15=getConfigFilePath(_0x207b3d);!existsSync(_0xfa70d0)&&mkdirSync(_0xfa70d0,{'recursive':!![],'mode':0x1c0});let _0x1c0b03={};if(existsSync(_0x2ddf15))try{const _0x2df91c=readFileSync(_0x2ddf15,_0x349ca3(0x139));_0x1c0b03=parseEnvFile(_0x2df91c);}catch(_0xe91c9a){console['warn']('Warning:\x20Failed\x20to\x20read\x20'+_0x2ddf15+':',_0xe91c9a);}const _0x3fc4d4=_0x2f590b[_0x349ca3(0x137)]()[_0x349ca3(0x12f)](/-/g,'_');_0x1c0b03[_0x349ca3(0x136)+_0x3fc4d4]=_0x58b6ca;const _0x4bc6ba=Object[_0x349ca3(0x10f)](_0x1c0b03)[_0x349ca3(0x11b)](([_0xc95e83,_0x34001a])=>_0xc95e83+'='+_0x34001a);writeFileSync(_0x2ddf15,_0x4bc6ba[_0x349ca3(0x128)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x15cfe5,_0x2a83af,_0x3c7a8d){const _0x492c4c=a44_0x5c04;await saveKeychainAPIKey(_0x15cfe5,_0x3c7a8d),setCachedCredential(_0x15cfe5,_0x2a83af,_0x3c7a8d);const _0x296d11=getConfigFilePath(_0x3c7a8d);cleanupLegacyEnvFile(_0x296d11)&&console[_0x492c4c(0x10a)](a44_0x73ef6f[_0x492c4c(0x140)](_0x492c4c(0x131)));}export function loadConfig(){const _0x2366cd=a44_0x5c04,_0x2be9e4={'apiKeys':{},'defaultSite':_0x2366cd(0x110)},_0x5171f0=[_0x2366cd(0x110),'jp01',_0x2366cd(0x125),_0x2366cd(0x142),'ap03','dev-us01',_0x2366cd(0x11e),_0x2366cd(0x124),'stg-jp01','stg-ap03'];for(const _0x289a44 of _0x5171f0){const _0x2b4555=getAPIKey(_0x289a44);_0x2b4555&&(_0x2be9e4[_0x2366cd(0x13c)][_0x289a44]=_0x2b4555);}return _0x2be9e4;}
1
+ (function(_0x31271e,_0x4d2082){const _0x30c5ee=a44_0x1b84,_0x2532d1=_0x31271e();while(!![]){try{const _0x5ea704=parseInt(_0x30c5ee(0x144))/0x1*(parseInt(_0x30c5ee(0x150))/0x2)+-parseInt(_0x30c5ee(0x15e))/0x3*(parseInt(_0x30c5ee(0x13b))/0x4)+parseInt(_0x30c5ee(0x159))/0x5+parseInt(_0x30c5ee(0x128))/0x6+-parseInt(_0x30c5ee(0x160))/0x7+parseInt(_0x30c5ee(0x12e))/0x8+-parseInt(_0x30c5ee(0x16a))/0x9;if(_0x5ea704===_0x4d2082)break;else _0x2532d1['push'](_0x2532d1['shift']());}catch(_0x2edd07){_0x2532d1['push'](_0x2532d1['shift']());}}}(a44_0xc586,0x98d5c));function a44_0xc586(){const _0x30303d=['startsWith','3185184OswShP','Warning:\x20Failed\x20to\x20load\x20','entries','TDX_API_KEY','dev-us01','llm_default_project','isDeprecated','existsSync','.json','us01','number','tdx.json','eu01','1614876IBYCHW','apiKeys','env','\x20\x20For\x20profile-specific\x20keys,\x20use\x20TDX_API_KEY_<PROFILE>\x20(e.g.,\x20','apiKey','name','TDX_API_KEY_<PROFILE>','tdx','accountId','16143rgXuMu','includes','trim','account_info.','keychain','some','jp01','slice','string','site','warn','.env.','82WQtdsf','readFileSync','endsWith','keychain\x20(profile:\x20','profiles','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','account_info.json','\x20env\x20var','map','4309780oZRlaJ','.env','dev-eu01','TD_API_KEY_','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','3nzSHCQ','split','8270920NVhtXA','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','Warning:\x20Failed\x20to\x20read\x20','source','ap03','join','replace','legacy\x20.env\x20file\x20(profile:\x20','toUpperCase','stringify','8539200tSxICj','toISOString','parse','legacy\x20.env\x20file','TD_API_KEY','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','ap02','llm_default_project.','stg-jp01','TD_API_KEY\x20env\x20var\x20(deprecated)','7428744yOLBLU','utf-8','match','yellow','stg-us01'];a44_0xc586=function(){return _0x30303d;};return a44_0xc586();}import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a44_0x28f01c from'node:fs';import*as a44_0x3e21ee from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a44_0x28a917 from'chalk';export function getConfigDir(){const _0x41a994=a44_0x1b84;return process[_0x41a994(0x13d)]['TDX_CONFIG_DIR']||join(homedir(),'.config',_0x41a994(0x142));}export function getConfigFile(){const _0x38e9a5=a44_0x1b84;return join(getConfigDir(),_0x38e9a5(0x15a));}export function getConfigFilePath(_0x283766){const _0x233c37=a44_0x1b84,_0x25734b=getConfigDir();return _0x283766?a44_0x3e21ee[_0x233c37(0x165)](_0x25734b,'.env.'+_0x283766):getConfigFile();}export function getCacheDir(){const _0x42e7ee=a44_0x1b84;return process[_0x42e7ee(0x13d)]['TDX_CACHE_DIR']||join(homedir(),'.cache',_0x42e7ee(0x142));}export function getLLMProjectCacheFile(_0x136148){const _0xa36a0d=a44_0x1b84,_0x166701=_0x136148?_0xa36a0d(0x171)+_0x136148:_0xa36a0d(0x133);return join(getCacheDir(),_0x166701);}export function readCachedLLMProject(_0x3cd37b){const _0x15efd7=a44_0x1b84;try{const _0x39711b=getLLMProjectCacheFile(_0x3cd37b);if(!existsSync(_0x39711b))return null;const _0x529848=readFileSync(_0x39711b,_0x15efd7(0x129))[_0x15efd7(0x146)]();try{const _0x422ca8=JSON['parse'](_0x529848);if(_0x422ca8&&typeof _0x422ca8['id']===_0x15efd7(0x14c)&&typeof _0x422ca8[_0x15efd7(0x140)]===_0x15efd7(0x14c))return _0x422ca8;}catch{}return null;}catch{return null;}}export function writeCachedLLMProject(_0x562278,_0x510e9a,_0x42425e){const _0x10569c=a44_0x1b84;try{const _0x258db5=getCacheDir(),_0x1e8101=getLLMProjectCacheFile(_0x42425e);!existsSync(_0x258db5)&&mkdirSync(_0x258db5,{'recursive':!![]});const _0x4af50a={'name':_0x562278,'id':_0x510e9a};writeFileSync(_0x1e8101,JSON[_0x10569c(0x169)](_0x4af50a),_0x10569c(0x129));}catch{}}export function getAccountInfoCacheFile(_0x544451){const _0xaca0d9=a44_0x1b84,_0x1ded94=_0x544451?_0xaca0d9(0x147)+_0x544451+_0xaca0d9(0x136):_0xaca0d9(0x156);return join(getCacheDir(),_0x1ded94);}export function readCachedAccountInfo(_0x18b1fc){const _0x215d4a=a44_0x1b84;try{const _0x9ce861=getAccountInfoCacheFile(_0x18b1fc);if(!existsSync(_0x9ce861))return null;const _0x7bf470=readFileSync(_0x9ce861,_0x215d4a(0x129))[_0x215d4a(0x146)](),_0x19a7d6=JSON[_0x215d4a(0x16c)](_0x7bf470);if(_0x19a7d6&&typeof _0x19a7d6[_0x215d4a(0x14d)]===_0x215d4a(0x14c)&&typeof _0x19a7d6[_0x215d4a(0x143)]===_0x215d4a(0x138))return _0x19a7d6;return null;}catch{return null;}}export function writeCachedAccountInfo(_0x1564b7,_0x5a5198,_0x2fd474){const _0x5b13eb=a44_0x1b84;try{const _0x5ead36=getCacheDir(),_0x152ef1=getAccountInfoCacheFile(_0x2fd474);!existsSync(_0x5ead36)&&mkdirSync(_0x5ead36,{'recursive':!![]});const _0x1c5c78={'site':_0x1564b7,'accountId':_0x5a5198,'cachedAt':new Date()[_0x5b13eb(0x16b)]()};writeFileSync(_0x152ef1,JSON[_0x5b13eb(0x169)](_0x1c5c78),'utf-8');}catch{}}export function parseEnvFile(_0x14c9aa){const _0x43b41a=a44_0x1b84,_0x4f492b={};for(const _0x5b4712 of _0x14c9aa[_0x43b41a(0x15f)]('\x0a')){const _0x3ddbeb=_0x5b4712[_0x43b41a(0x146)]();if(!_0x3ddbeb||_0x3ddbeb[_0x43b41a(0x12d)]('#'))continue;const _0x12299a=_0x3ddbeb[_0x43b41a(0x12a)](/^([^=]+)=(.*)$/);if(_0x12299a){const _0x42286c=_0x12299a[0x1][_0x43b41a(0x146)]();let _0x165dce=_0x12299a[0x2]['trim']();(_0x165dce[_0x43b41a(0x12d)]('\x22')&&_0x165dce[_0x43b41a(0x152)]('\x22')||_0x165dce[_0x43b41a(0x12d)]('\x27')&&_0x165dce[_0x43b41a(0x152)]('\x27'))&&(_0x165dce=_0x165dce[_0x43b41a(0x14b)](0x1,-0x1)),_0x4f492b[_0x42286c]=_0x165dce;}}return _0x4f492b;}export function readUserConfig(){const _0x46f285=a44_0x1b84,_0x49baf9=getConfigFile();if(!existsSync(_0x49baf9))return{};try{const _0x32900f=readFileSync(_0x49baf9,_0x46f285(0x129));return parseEnvFile(_0x32900f);}catch(_0x5eb03e){return console[_0x46f285(0x14e)](_0x46f285(0x155)+_0x49baf9+':',_0x5eb03e),{};}}export function resolveSite(_0x3964a3){const _0x399b07=a44_0x1b84,_0x10504a=[_0x399b07(0x137),'jp01',_0x399b07(0x13a),_0x399b07(0x170),'ap03',_0x399b07(0x132),_0x399b07(0x15b),_0x399b07(0x12c),_0x399b07(0x126),'stg-ap03'];if(_0x10504a['includes'](_0x3964a3))return _0x3964a3;if(_0x3964a3 in SITE_ALIASES)return SITE_ALIASES[_0x3964a3];return console[_0x399b07(0x14e)]('Warning:\x20Unknown\x20site\x20\x27'+_0x3964a3+'\x27,\x20defaulting\x20to\x20us01'),_0x399b07(0x137);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x33bbb3,_0xdb0a1d){const _0x4fcfac=a44_0x1b84,_0x129814=_0xdb0a1d||getActiveProfileName();if(_0x129814){const _0x31bab2='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x129814);if(process[_0x4fcfac(0x13d)][_0x31bab2])return process[_0x4fcfac(0x13d)][_0x31bab2];}if(process[_0x4fcfac(0x13d)][_0x4fcfac(0x131)])return process['env'][_0x4fcfac(0x131)];if(process[_0x4fcfac(0x13d)][_0x4fcfac(0x16e)])return process[_0x4fcfac(0x13d)][_0x4fcfac(0x16e)];const _0x215660=_0x33bbb3[_0x4fcfac(0x168)]()[_0x4fcfac(0x166)](/-/g,'_'),_0x316229=_0x4fcfac(0x15c)+_0x215660;if(_0x129814){const _0x1012e5=loadProfileEnv(_0x129814);if(_0x1012e5){if(_0x1012e5[_0x316229])return _0x1012e5[_0x316229];if(_0x1012e5[_0x4fcfac(0x16e)])return _0x1012e5[_0x4fcfac(0x16e)];}}const _0x118e24=loadUserConfigOnce();if(_0x118e24[_0x316229])return _0x118e24[_0x316229];if(_0x118e24['TD_API_KEY'])return _0x118e24[_0x4fcfac(0x16e)];return undefined;}function a44_0x1b84(_0x579bfb,_0x367f9a){_0x579bfb=_0x579bfb-0x126;const _0xc586f7=a44_0xc586();let _0x1b8457=_0xc586f7[_0x579bfb];return _0x1b8457;}export function normalizeProfileForEnvVar(_0x4adacd){const _0x5b9951=a44_0x1b84;return _0x4adacd[_0x5b9951(0x168)]()[_0x5b9951(0x166)](/[^A-Z0-9]/g,'_');}export async function resolveAPIKeyAsync(_0x1dac87,_0x5a8ac4){const _0x386810=a44_0x1b84,_0x279b51=_0x5a8ac4||getActiveProfileName()||undefined;if(_0x279b51){const _0x211abc='TDX_API_KEY_'+normalizeProfileForEnvVar(_0x279b51);if(process[_0x386810(0x13d)][_0x211abc])return{'apiKey':process[_0x386810(0x13d)][_0x211abc],'source':_0x211abc+_0x386810(0x157),'isDeprecated':![]};const _0x5d9f78=getCachedCredential(_0x1dac87,_0x279b51);if(_0x5d9f78)return{'apiKey':_0x5d9f78,'source':'keychain\x20(profile:\x20'+_0x279b51+')','isDeprecated':![]};const _0x12c214=await getKeychainAPIKey(_0x279b51);if(_0x12c214)return setCachedCredential(_0x12c214,_0x1dac87,_0x279b51),{'apiKey':_0x12c214,'source':_0x386810(0x153)+_0x279b51+')','isDeprecated':![]};}if(process[_0x386810(0x13d)][_0x386810(0x131)])return{'apiKey':process[_0x386810(0x13d)]['TDX_API_KEY'],'source':'TDX_API_KEY\x20env\x20var','isDeprecated':![]};if(!_0x279b51){const _0x5426a9=getCachedCredential(_0x1dac87,undefined);if(_0x5426a9)return{'apiKey':_0x5426a9,'source':_0x386810(0x148),'isDeprecated':![]};const _0x1230c7=await getKeychainAPIKey(undefined);if(_0x1230c7)return setCachedCredential(_0x1230c7,_0x1dac87,undefined),{'apiKey':_0x1230c7,'source':'keychain','isDeprecated':![]};}if(process[_0x386810(0x13d)][_0x386810(0x16e)])return{'apiKey':process['env'][_0x386810(0x16e)],'source':_0x386810(0x127),'isDeprecated':!![]};const _0x41f58c=getLegacyEnvAPIKey(_0x1dac87,_0x279b51);if(_0x41f58c){const _0x258d94=await isKeychainAvailable();if(_0x258d94)try{await saveKeychainAPIKey(_0x41f58c,_0x279b51),setCachedCredential(_0x41f58c,_0x1dac87,_0x279b51);const _0x1a605f=getConfigFilePath(_0x279b51);cleanupLegacyEnvFile(_0x1a605f)&&console[_0x386810(0x14e)](a44_0x28a917[_0x386810(0x12b)](_0x386810(0x16f)));}catch(_0x50162e){console['warn'](a44_0x28a917[_0x386810(0x12b)](_0x386810(0x15d)+_0x50162e));}const _0x1dfcd3=_0x279b51?_0x386810(0x167)+_0x279b51+')':_0x386810(0x16d);return{'apiKey':_0x41f58c,'source':_0x1dfcd3,'isDeprecated':!![]};}return null;}export async function getAPIKeyAsync(_0x2f697c,_0x1f1a16,_0x3e12a1=!![]){const _0x52997c=a44_0x1b84,_0x273ec1=await resolveAPIKeyAsync(_0x2f697c,_0x1f1a16);if(!_0x273ec1)return undefined;if(_0x3e12a1&&_0x273ec1[_0x52997c(0x134)]&&_0x273ec1[_0x52997c(0x163)][_0x52997c(0x145)](_0x52997c(0x16e))){const _0x37be22=_0x1f1a16||getActiveProfileName()||undefined,_0x1cbdf5=_0x37be22?'TDX_API_KEY_'+normalizeProfileForEnvVar(_0x37be22):_0x52997c(0x141);console[_0x52997c(0x14e)](a44_0x28a917[_0x52997c(0x12b)]('Warning:\x20Using\x20TD_API_KEY\x20is\x20deprecated.\x20Please\x20use\x20TDX_API_KEY\x20instead.\x0a'+(_0x52997c(0x13e)+_0x1cbdf5+').')));}return _0x273ec1[_0x52997c(0x13f)];}function getLegacyEnvAPIKey(_0x3affee,_0x58832e){const _0x5e4b7b=a44_0x1b84,_0x5b2404=_0x3affee[_0x5e4b7b(0x168)]()[_0x5e4b7b(0x166)](/-/g,'_'),_0xbba3b3='TD_API_KEY_'+_0x5b2404;if(_0x58832e){const _0x456d73=loadProfileEnv(_0x58832e);if(_0x456d73){if(_0x456d73[_0xbba3b3])return _0x456d73[_0xbba3b3];if(_0x456d73[_0x5e4b7b(0x16e)])return _0x456d73['TD_API_KEY'];}}const _0x58690b=loadUserConfigOnce();if(_0x58690b[_0xbba3b3])return _0x58690b[_0xbba3b3];if(_0x58690b[_0x5e4b7b(0x16e)])return _0x58690b[_0x5e4b7b(0x16e)];return undefined;}function cleanupLegacyEnvFile(_0x46f3a2){const _0x439e4a=a44_0x1b84;if(!existsSync(_0x46f3a2))return![];try{const _0x3d82d5=readFileSync(_0x46f3a2,_0x439e4a(0x129)),_0x32ba9b=_0x3d82d5[_0x439e4a(0x15f)]('\x0a'),_0x226bd3=_0x32ba9b['filter'](_0x46a821=>{const _0x2f5647=_0x439e4a,_0x4c2219=_0x46a821[_0x2f5647(0x146)]();if(!_0x4c2219||_0x4c2219['startsWith']('#'))return!![];const [_0x2ad1dc]=_0x4c2219[_0x2f5647(0x15f)]('=');return!_0x2ad1dc[_0x2f5647(0x12d)]('TD_API_KEY');}),_0x59f355=_0x226bd3[_0x439e4a(0x149)](_0x3c8b76=>{const _0x24f8eb=_0x439e4a,_0xb1deed=_0x3c8b76['trim']();return _0xb1deed&&!_0xb1deed[_0x24f8eb(0x12d)]('#');});if(!_0x59f355)return unlinkSync(_0x46f3a2),!![];return writeFileSync(_0x46f3a2,_0x226bd3['join']('\x0a'),{'mode':0x180}),!![];}catch{return![];}}function loadProfileEnv(_0x5853c8){const _0xf9b379=a44_0x1b84,_0x34cec5=a44_0x3e21ee[_0xf9b379(0x165)](getConfigDir(),_0xf9b379(0x14f)+_0x5853c8);if(a44_0x28f01c[_0xf9b379(0x135)](_0x34cec5)){validateSecureFilePermissions(_0x34cec5);try{const _0x148b0c=a44_0x28f01c['readFileSync'](_0x34cec5,'utf-8');return parseEnvFile(_0x148b0c);}catch(_0x10b597){console[_0xf9b379(0x14e)](_0xf9b379(0x12f)+_0x34cec5+':\x20'+_0x10b597);}}const _0x1c2505=a44_0x3e21ee[_0xf9b379(0x165)](getConfigDir(),_0xf9b379(0x154),_0x5853c8,_0xf9b379(0x15a));if(a44_0x28f01c[_0xf9b379(0x135)](_0x1c2505)){validateSecureFilePermissions(_0x1c2505);try{const _0x504e89=a44_0x28f01c[_0xf9b379(0x151)](_0x1c2505,_0xf9b379(0x129));return parseEnvFile(_0x504e89);}catch(_0x12bbc3){return console[_0xf9b379(0x14e)](_0xf9b379(0x12f)+_0x1c2505+':\x20'+_0x12bbc3),null;}}return null;}function getActiveProfileName(){const _0x776f1c=a44_0x1b84,_0x3e31cc=a44_0x3e21ee[_0x776f1c(0x165)](getConfigDir(),_0x776f1c(0x139));if(!a44_0x28f01c[_0x776f1c(0x135)](_0x3e31cc))return null;try{const _0x46281a=a44_0x28f01c[_0x776f1c(0x151)](_0x3e31cc,_0x776f1c(0x129)),_0x258b0a=JSON[_0x776f1c(0x16c)](_0x46281a);return _0x258b0a['profile']||null;}catch{return null;}}export function saveAPIKey(_0x30ccb5,_0x4bc1b1,_0x3a549c){const _0x2232ab=a44_0x1b84,_0x1bbd9e=getConfigDir(),_0xfb82d=getConfigFilePath(_0x3a549c);!existsSync(_0x1bbd9e)&&mkdirSync(_0x1bbd9e,{'recursive':!![],'mode':0x1c0});let _0x71120c={};if(existsSync(_0xfb82d))try{const _0x7c3b20=readFileSync(_0xfb82d,_0x2232ab(0x129));_0x71120c=parseEnvFile(_0x7c3b20);}catch(_0x48f9af){console[_0x2232ab(0x14e)](_0x2232ab(0x162)+_0xfb82d+':',_0x48f9af);}const _0x385a79=_0x30ccb5[_0x2232ab(0x168)]()['replace'](/-/g,'_');_0x71120c[_0x2232ab(0x15c)+_0x385a79]=_0x4bc1b1;const _0x389e76=Object[_0x2232ab(0x130)](_0x71120c)[_0x2232ab(0x158)](([_0x28a072,_0x5a8575])=>_0x28a072+'='+_0x5a8575);writeFileSync(_0xfb82d,_0x389e76['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x196c37,_0x5ab195,_0x23bc78){const _0x353adc=a44_0x1b84;await saveKeychainAPIKey(_0x196c37,_0x23bc78),setCachedCredential(_0x196c37,_0x5ab195,_0x23bc78);const _0x241716=getConfigFilePath(_0x23bc78);cleanupLegacyEnvFile(_0x241716)&&console['warn'](a44_0x28a917[_0x353adc(0x12b)](_0x353adc(0x161)));}export function loadConfig(){const _0x2deb72=a44_0x1b84,_0x5d35e9={'apiKeys':{},'defaultSite':'us01'},_0x49ec50=[_0x2deb72(0x137),_0x2deb72(0x14a),'eu01',_0x2deb72(0x170),_0x2deb72(0x164),'dev-us01','dev-eu01',_0x2deb72(0x12c),_0x2deb72(0x126),'stg-ap03'];for(const _0xa9b475 of _0x49ec50){const _0x2a233b=getAPIKey(_0xa9b475);_0x2a233b&&(_0x5d35e9[_0x2deb72(0x13c)][_0xa9b475]=_0x2a233b);}return _0x5d35e9;}
@@ -1 +1 @@
1
- (function(_0x1def00,_0x34a79d){const _0x28a525=a45_0x13aa,_0x2afebc=_0x1def00();while(!![]){try{const _0x40cd47=-parseInt(_0x28a525(0x1e8))/0x1+parseInt(_0x28a525(0x1f1))/0x2+parseInt(_0x28a525(0x1e7))/0x3*(-parseInt(_0x28a525(0x1ec))/0x4)+parseInt(_0x28a525(0x1e2))/0x5*(-parseInt(_0x28a525(0x1ee))/0x6)+parseInt(_0x28a525(0x1e3))/0x7+-parseInt(_0x28a525(0x1e4))/0x8+parseInt(_0x28a525(0x1e6))/0x9;if(_0x40cd47===_0x34a79d)break;else _0x2afebc['push'](_0x2afebc['shift']());}catch(_0x349079){_0x2afebc['push'](_0x2afebc['shift']());}}}(a45_0x2484,0x39689));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';function a45_0x2484(){const _0x3ee367=['10exfipG','597975IQgEDC','611760sqFHZz','utf-8','12663018bgCjbq','2004FeAxoW','413512NRcCHf','now','stringify','connections-','2800uANQKA','connections','1104114ahoVof','parse','.json','136676FnaIjO'];a45_0x2484=function(){return _0x3ee367;};return a45_0x2484();}import{getCacheDir}from'./config.js';function getCacheFilePath(_0xfcbef1){const _0x302e1f=a45_0x13aa,_0x37e911=_0xfcbef1||'default';return join(getCacheDir(),_0x302e1f(0x1eb)+_0x37e911+_0x302e1f(0x1f0));}export function loadCachedConnections(_0x9ea7f0){const _0x277502=a45_0x13aa,_0x2675e1=getCacheFilePath(_0x9ea7f0);if(!existsSync(_0x2675e1))return null;try{const _0x25418b=readFileSync(_0x2675e1,_0x277502(0x1e5)),_0x5ef95f=JSON[_0x277502(0x1ef)](_0x25418b);return _0x5ef95f[_0x277502(0x1ed)];}catch{return null;}}export function saveCachedConnections(_0x4e8706,_0x239eed){const _0x112e09=a45_0x13aa,_0x54a145=getCacheDir();!existsSync(_0x54a145)&&mkdirSync(_0x54a145,{'recursive':!![]});const _0x52e36b=getCacheFilePath(_0x4e8706),_0x2f3cfb={'connections':_0x239eed,'cachedAt':Date[_0x112e09(0x1e9)]()};writeFileSync(_0x52e36b,JSON[_0x112e09(0x1ea)](_0x2f3cfb,null,0x2),_0x112e09(0x1e5));}function a45_0x13aa(_0x19ae77,_0x400e4e){_0x19ae77=_0x19ae77-0x1e2;const _0x248438=a45_0x2484();let _0x13aaed=_0x248438[_0x19ae77];return _0x13aaed;}export function clearConnectionCache(_0xb49644){const _0x56c0ee=getCacheFilePath(_0xb49644);if(existsSync(_0x56c0ee))try{unlinkSync(_0x56c0ee);}catch{}}
1
+ function a45_0x3d18(_0x5ef428,_0x358b05){_0x5ef428=_0x5ef428-0xeb;const _0x5b99d9=a45_0x5b99();let _0x3d1883=_0x5b99d9[_0x5ef428];return _0x3d1883;}(function(_0x5eb756,_0x3d3201){const _0x4174b5=a45_0x3d18,_0x4a980c=_0x5eb756();while(!![]){try{const _0x408869=parseInt(_0x4174b5(0xf4))/0x1*(-parseInt(_0x4174b5(0xed))/0x2)+parseInt(_0x4174b5(0xf0))/0x3+parseInt(_0x4174b5(0xef))/0x4*(-parseInt(_0x4174b5(0xf1))/0x5)+parseInt(_0x4174b5(0xfb))/0x6+parseInt(_0x4174b5(0xec))/0x7+parseInt(_0x4174b5(0xf9))/0x8*(parseInt(_0x4174b5(0xfa))/0x9)+parseInt(_0x4174b5(0xeb))/0xa*(-parseInt(_0x4174b5(0xf3))/0xb);if(_0x408869===_0x3d3201)break;else _0x4a980c['push'](_0x4a980c['shift']());}catch(_0x1b817c){_0x4a980c['push'](_0x4a980c['shift']());}}}(a45_0x5b99,0xd962d));import{existsSync,mkdirSync,readFileSync,writeFileSync,unlinkSync}from'fs';import{join}from'path';import{getCacheDir}from'./config.js';function getCacheFilePath(_0xa8df0){const _0x4e97b2=a45_0x3d18,_0x2fd262=_0xa8df0||_0x4e97b2(0xf8);return join(getCacheDir(),_0x4e97b2(0xf5)+_0x2fd262+_0x4e97b2(0xf2));}function a45_0x5b99(){const _0x2a45c8=['510oAGfrD','8752205nnHNsB','897210EfGzBu','stringify','4LxEHAo','5147964vvNbtt','308015HwWZln','.json','677809WzKFSY','2rgUiJw','connections-','utf-8','connections','default','10328YQBtiB','10485csagND','3128862ZkvcTV'];a45_0x5b99=function(){return _0x2a45c8;};return a45_0x5b99();}export function loadCachedConnections(_0x4980e6){const _0x29c283=a45_0x3d18,_0x48767e=getCacheFilePath(_0x4980e6);if(!existsSync(_0x48767e))return null;try{const _0x5e4f8f=readFileSync(_0x48767e,'utf-8'),_0x543a81=JSON['parse'](_0x5e4f8f);return _0x543a81[_0x29c283(0xf7)];}catch{return null;}}export function saveCachedConnections(_0x3a020f,_0x56a3cb){const _0x201bb4=a45_0x3d18,_0x1f03cf=getCacheDir();!existsSync(_0x1f03cf)&&mkdirSync(_0x1f03cf,{'recursive':!![]});const _0xc3530e=getCacheFilePath(_0x3a020f),_0x5be2cd={'connections':_0x56a3cb,'cachedAt':Date['now']()};writeFileSync(_0xc3530e,JSON[_0x201bb4(0xee)](_0x5be2cd,null,0x2),_0x201bb4(0xf6));}export function clearConnectionCache(_0x50fcd6){const _0x82df9c=getCacheFilePath(_0x50fcd6);if(existsSync(_0x82df9c))try{unlinkSync(_0x82df9c);}catch{}}
@@ -1 +1 @@
1
- (function(_0x1c1974,_0x1cdb1d){const _0x140d32=a46_0xfbf5,_0x13f39b=_0x1c1974();while(!![]){try{const _0x183e73=parseInt(_0x140d32(0x1db))/0x1*(-parseInt(_0x140d32(0x1ce))/0x2)+-parseInt(_0x140d32(0x1d0))/0x3+-parseInt(_0x140d32(0x1d9))/0x4*(parseInt(_0x140d32(0x1d8))/0x5)+parseInt(_0x140d32(0x1dd))/0x6+parseInt(_0x140d32(0x1cc))/0x7*(-parseInt(_0x140d32(0x1da))/0x8)+parseInt(_0x140d32(0x1de))/0x9+-parseInt(_0x140d32(0x1cf))/0xa*(-parseInt(_0x140d32(0x1dc))/0xb);if(_0x183e73===_0x1cdb1d)break;else _0x13f39b['push'](_0x13f39b['shift']());}catch(_0x2ce83){_0x13f39b['push'](_0x13f39b['shift']());}}}(a46_0x5cfd,0x88b4f));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function a46_0xfbf5(_0x310d3b,_0x5bc320){_0x310d3b=_0x310d3b-0x1cc;const _0x5cfd1a=a46_0x5cfd();let _0xfbf5a6=_0x5cfd1a[_0x310d3b];return _0xfbf5a6;}function getCacheKey(_0x57f6fe,_0x60f720){const _0x5491d7=a46_0xfbf5,_0x3f8d8a=_0x57f6fe||_0x5491d7(0x1d6),_0x5519bf=_0x60f720||_0x5491d7(0x1d3);return _0x3f8d8a+':'+_0x5519bf;}export function getCachedCredential(_0x62260b,_0x4f6de4){const _0x18f81e=a46_0xfbf5,_0x4c3f3f=getCacheKey(_0x62260b,_0x4f6de4),_0x24e5f0=cache['get'](_0x4c3f3f);if(!_0x24e5f0)return null;if(Date[_0x18f81e(0x1d7)]()-_0x24e5f0[_0x18f81e(0x1d2)]>CACHE_TTL_MS)return cache[_0x18f81e(0x1cd)](_0x4c3f3f),null;return _0x24e5f0[_0x18f81e(0x1d4)];}export function setCachedCredential(_0x55185a,_0x10cfb9,_0x2ac16e){const _0x57aa37=a46_0xfbf5,_0x3333ca=getCacheKey(_0x10cfb9,_0x2ac16e);cache[_0x57aa37(0x1d1)](_0x3333ca,{'apiKey':_0x55185a,'loadedAt':Date[_0x57aa37(0x1d7)]()});}export function clearCredentialCache(){const _0x7d862d=a46_0xfbf5;cache[_0x7d862d(0x1d5)]();}function a46_0x5cfd(){const _0x180317=['31715BJNypX','668CPMUBN','7134024IUeOCE','103654gLTAvI','21317461WiIgAE','6417066eHhLyk','6896250ONHahT','7gxNQlW','delete','4hLrNwu','10RdZHUK','3166257kWDren','set','loadedAt','__default_profile__','apiKey','clear','__default_site__','now'];a46_0x5cfd=function(){return _0x180317;};return a46_0x5cfd();}export function clearCachedCredential(_0x419a27,_0x5f4c7e){const _0xf49479=a46_0xfbf5,_0x2e4659=getCacheKey(_0x419a27,_0x5f4c7e);cache[_0xf49479(0x1cd)](_0x2e4659);}
1
+ (function(_0x2fc377,_0x3b4994){const _0x4edb8a=a46_0x2070,_0x286f52=_0x2fc377();while(!![]){try{const _0x3f48e1=parseInt(_0x4edb8a(0xae))/0x1*(parseInt(_0x4edb8a(0xac))/0x2)+parseInt(_0x4edb8a(0xa6))/0x3*(parseInt(_0x4edb8a(0xa2))/0x4)+parseInt(_0x4edb8a(0xaa))/0x5*(-parseInt(_0x4edb8a(0xa0))/0x6)+-parseInt(_0x4edb8a(0xa8))/0x7*(parseInt(_0x4edb8a(0xa9))/0x8)+-parseInt(_0x4edb8a(0xab))/0x9*(parseInt(_0x4edb8a(0xa7))/0xa)+parseInt(_0x4edb8a(0xa4))/0xb+parseInt(_0x4edb8a(0xa1))/0xc*(parseInt(_0x4edb8a(0xb0))/0xd);if(_0x3f48e1===_0x3b4994)break;else _0x286f52['push'](_0x286f52['shift']());}catch(_0x390233){_0x286f52['push'](_0x286f52['shift']());}}}(a46_0x1929,0xb19ff));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0xa0a85d,_0x4bdd9e){const _0x260c77=a46_0x2070,_0x159ff2=_0xa0a85d||_0x260c77(0xb1),_0x33d068=_0x4bdd9e||'__default_profile__';return _0x159ff2+':'+_0x33d068;}export function getCachedCredential(_0x1547cd,_0x10d4cb){const _0x3d5bc6=a46_0x2070,_0x3235fc=getCacheKey(_0x1547cd,_0x10d4cb),_0x845520=cache[_0x3d5bc6(0xaf)](_0x3235fc);if(!_0x845520)return null;if(Date[_0x3d5bc6(0xa3)]()-_0x845520[_0x3d5bc6(0xad)]>CACHE_TTL_MS)return cache[_0x3d5bc6(0xb2)](_0x3235fc),null;return _0x845520['apiKey'];}function a46_0x2070(_0xa0bd1,_0x476d19){_0xa0bd1=_0xa0bd1-0xa0;const _0x19297e=a46_0x1929();let _0x2070d6=_0x19297e[_0xa0bd1];return _0x2070d6;}export function setCachedCredential(_0x2facdb,_0x46653c,_0x377e50){const _0x156acc=a46_0x2070,_0x5d2c95=getCacheKey(_0x46653c,_0x377e50);cache[_0x156acc(0xa5)](_0x5d2c95,{'apiKey':_0x2facdb,'loadedAt':Date[_0x156acc(0xa3)]()});}function a46_0x1929(){const _0x275937=['get','2509wpdbOM','__default_site__','delete','732MjTvvx','16140sAVdgw','1568052cOrGWX','now','11002002YACRIO','set','9soShYW','210aiLnOL','2919feqqAS','7640ogswTG','56565CEJmkh','380367NixeCd','2VOikGm','loadedAt','957689sxVXtE'];a46_0x1929=function(){return _0x275937;};return a46_0x1929();}export function clearCredentialCache(){cache['clear']();}export function clearCachedCredential(_0x37e675,_0x3c3c05){const _0x4c201e=a46_0x2070,_0x1e6757=getCacheKey(_0x37e675,_0x3c3c05);cache[_0x4c201e(0xb2)](_0x1e6757);}
@@ -1 +1 @@
1
- const a47_0x5a1520=a47_0x356e;(function(_0x59a241,_0x419120){const _0x5c2359=a47_0x356e,_0x2d3348=_0x59a241();while(!![]){try{const _0x4e4990=parseInt(_0x5c2359(0x16a))/0x1+parseInt(_0x5c2359(0x140))/0x2+-parseInt(_0x5c2359(0x15b))/0x3+parseInt(_0x5c2359(0x160))/0x4+parseInt(_0x5c2359(0x169))/0x5*(parseInt(_0x5c2359(0x13e))/0x6)+-parseInt(_0x5c2359(0x14c))/0x7+parseInt(_0x5c2359(0x16d))/0x8;if(_0x4e4990===_0x419120)break;else _0x2d3348['push'](_0x2d3348['shift']());}catch(_0x401397){_0x2d3348['push'](_0x2d3348['shift']());}}}(a47_0x2b46,0x28240));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a47_0x1377ce from'node:fs';function a47_0x356e(_0x63b287,_0x4d971c){_0x63b287=_0x63b287-0x135;const _0x2b4673=a47_0x2b46();let _0x356ed5=_0x2b4673[_0x63b287];return _0x356ed5;}function a47_0x2b46(){const _0x31aefc=['us01','1018824DzlBlQ','join','profile','getParameters','replace','activeProfile','CLI\x20flag:\x20--','existsSync','apiKey','entries','toString','displayWithSources','project','segmentPath','Global','Profile\x20Credentials','global','24xkvvra','sessions','48524IOZVDU','logLevel','INFO','display','not\x20set','configFiles','sessionId','verbose','.env','getSource','profile:\x20','default','2034270QneVlA','session','segment_path','(session:\x20',':\x20none','llmProject','utf-8','log','layers','cliFlags','loadGlobalConfig','database','readFileSync','string','parse','666303uHdhxN','parent_segment',':\x20none\x20(using\x20session:\x20','resolveAPIKeyAsync','Profile','960460ejFjmg','globalCredentials','tdx.json','Session','profiles','site','\x0a[configuration\x20files]','(active)','parentSegment','125445oaPAeh','185041IfpJda','llm_project'];a47_0x2b46=function(){return _0x31aefc;};return a47_0x2b46();}import*as a47_0x59f632 from'node:path';export class GlobalContext{['site'];[a47_0x5a1520(0x157)];[a47_0x5a1520(0x15c)];[a47_0x5a1520(0x14e)];[a47_0x5a1520(0x16b)];[a47_0x5a1520(0x135)];['verbose'];[a47_0x5a1520(0x141)];[a47_0x5a1520(0x16f)];['layers'];['activeProfile'];['sessionId'];['configFiles'];constructor(_0x24ab02){const _0x4f0158=a47_0x5a1520;this[_0x4f0158(0x146)]=_0x24ab02[_0x4f0158(0x14d)]||getCurrentSessionPID()[_0x4f0158(0x137)]();const _0x3eba9f=loadSessionContext(_0x24ab02[_0x4f0158(0x14d)]),_0x422504=loadProjectConfig(),_0x32a6e3=this[_0x4f0158(0x156)]();this['activeProfile']=_0x24ab02[_0x4f0158(0x16f)]||_0x3eba9f?.['profile']||_0x32a6e3['profile']||getActiveProfile();const _0x16d404=this['activeProfile']?loadProfile(this[_0x4f0158(0x172)]):null,_0x20e042=_0x496d7a=>{const _0x468e56=_0x4f0158;if(!_0x496d7a)return{};const _0xbc251d=_0x496d7a,_0x3c8f74={};for(const [_0xc095ce,_0x13741f]of Object[_0x468e56(0x136)](_0xbc251d)){typeof _0x13741f===_0x468e56(0x159)&&(_0x3c8f74[_0xc095ce]=_0x13741f);}return _0x3c8f74;},_0x37676d={};if(_0x24ab02['site']&&_0x24ab02['site']!==_0x4f0158(0x16c))_0x37676d[_0x4f0158(0x165)]=_0x24ab02[_0x4f0158(0x165)];const _0x534f5f=_0x3eba9f?.[_0x4f0158(0x157)],_0x5db9a7=_0x422504?.[_0x4f0158(0x157)],_0x183cee=_0x16d404?.['config']?.[_0x4f0158(0x157)],_0xee4b9d=_0x32a6e3[_0x4f0158(0x157)];_0x24ab02[_0x4f0158(0x157)]&&(_0x24ab02[_0x4f0158(0x157)]!==_0x534f5f&&_0x24ab02['database']!==_0x5db9a7&&_0x24ab02['database']!==_0x183cee&&_0x24ab02[_0x4f0158(0x157)]!==_0xee4b9d)&&(_0x37676d['database']=_0x24ab02['database']);if(_0x24ab02[_0x4f0158(0x168)])_0x37676d[_0x4f0158(0x15c)]=_0x24ab02[_0x4f0158(0x168)];if(_0x24ab02['llmProject'])_0x37676d[_0x4f0158(0x16b)]=_0x24ab02['llmProject'];if(_0x24ab02['profile'])_0x37676d[_0x4f0158(0x16f)]=_0x24ab02['profile'];this[_0x4f0158(0x154)]={'cliFlags':_0x37676d,'session':_0x20e042(_0x3eba9f),'project':_0x20e042(_0x422504),'profile':_0x20e042(_0x16d404?.['config']),'global':_0x20e042(_0x32a6e3)};const _0x2b93af={...this[_0x4f0158(0x154)][_0x4f0158(0x13d)],...this[_0x4f0158(0x154)][_0x4f0158(0x16f)],...this[_0x4f0158(0x154)]['project'],...this[_0x4f0158(0x154)]['session'],...this[_0x4f0158(0x154)]['cliFlags']},_0x2471e0=_0x2b93af[_0x4f0158(0x165)]||_0x4f0158(0x16c);this[_0x4f0158(0x165)]=resolveSite(_0x2471e0),this[_0x4f0158(0x157)]=_0x2b93af[_0x4f0158(0x157)],this[_0x4f0158(0x15c)]=_0x2b93af[_0x4f0158(0x15c)],this[_0x4f0158(0x14e)]=_0x2b93af[_0x4f0158(0x14e)],this[_0x4f0158(0x16b)]=_0x2b93af[_0x4f0158(0x16b)],this[_0x4f0158(0x147)]=_0x24ab02['verbose']||![],this[_0x4f0158(0x141)]=_0x24ab02[_0x4f0158(0x141)]??LogLevel[_0x4f0158(0x142)],this[_0x4f0158(0x16f)]=this[_0x4f0158(0x172)]||undefined,this[_0x4f0158(0x135)]=getAPIKey(this[_0x4f0158(0x165)],this[_0x4f0158(0x172)]||undefined);const _0x14e2b0=getConfigDir(),_0x18379f=a47_0x59f632[_0x4f0158(0x16e)](_0x14e2b0,_0x4f0158(0x13f),this['sessionId']+'.json'),_0xa6a430=findProjectConfigPath(),_0x387d7b=a47_0x59f632[_0x4f0158(0x16e)](_0x14e2b0,_0x4f0158(0x162)),_0xa28297=a47_0x59f632[_0x4f0158(0x16e)](_0x14e2b0,_0x4f0158(0x148));let _0x34b2f1=null,_0x336300=null;this['activeProfile']&&(_0x34b2f1=a47_0x59f632[_0x4f0158(0x16e)](_0x14e2b0,_0x4f0158(0x164),this[_0x4f0158(0x172)],_0x4f0158(0x162)),_0x336300=a47_0x59f632[_0x4f0158(0x16e)](_0x14e2b0,_0x4f0158(0x164),this[_0x4f0158(0x172)],_0x4f0158(0x148))),this['configFiles']={'session':a47_0x1377ce[_0x4f0158(0x174)](_0x18379f)?_0x18379f:null,'project':_0xa6a430,'profile':_0x34b2f1&&a47_0x1377ce[_0x4f0158(0x174)](_0x34b2f1)?_0x34b2f1:null,'profileCredentials':_0x336300&&a47_0x1377ce[_0x4f0158(0x174)](_0x336300)?_0x336300:null,'global':a47_0x1377ce[_0x4f0158(0x174)](_0x387d7b)?_0x387d7b:null,'globalCredentials':a47_0x1377ce[_0x4f0158(0x174)](_0xa28297)?_0xa28297:null};}['getSource'](_0x4a9766,_0x4c233a){const _0x2bdeea=a47_0x5a1520;if(!_0x4c233a)return _0x2bdeea(0x144);const _0x370203=_0x4c233a;if(this[_0x2bdeea(0x154)][_0x2bdeea(0x155)][_0x4a9766]===_0x370203){if(_0x4a9766===_0x2bdeea(0x165)&&_0x370203===_0x2bdeea(0x16c)&&!this[_0x2bdeea(0x154)][_0x2bdeea(0x14d)][_0x2bdeea(0x165)]&&!this[_0x2bdeea(0x154)]['project'][_0x2bdeea(0x165)]&&!this['layers'][_0x2bdeea(0x16f)][_0x2bdeea(0x165)]&&!this['layers']['global']['site'])return _0x2bdeea(0x14b);return _0x2bdeea(0x173)+_0x4a9766[_0x2bdeea(0x171)](/_/g,'-');}if(this[_0x2bdeea(0x154)][_0x2bdeea(0x14d)][_0x4a9766]===_0x370203)return _0x2bdeea(0x14d);if(this[_0x2bdeea(0x154)]['project'][_0x4a9766]===_0x370203)return'project';if(this['layers'][_0x2bdeea(0x16f)][_0x4a9766]===_0x370203)return _0x2bdeea(0x14a)+this[_0x2bdeea(0x172)];if(this[_0x2bdeea(0x154)]['global'][_0x4a9766]===_0x370203)return _0x2bdeea(0x13d);return _0x2bdeea(0x14b);}[a47_0x5a1520(0x156)](){const _0x2f7d6c=a47_0x5a1520,_0x14ecb5=a47_0x59f632[_0x2f7d6c(0x16e)](getConfigDir(),_0x2f7d6c(0x162));if(!a47_0x1377ce[_0x2f7d6c(0x174)](_0x14ecb5))return{};try{const _0x278a07=a47_0x1377ce[_0x2f7d6c(0x158)](_0x14ecb5,_0x2f7d6c(0x152));return JSON[_0x2f7d6c(0x15a)](_0x278a07);}catch{return{};}}['injectIntoOptions'](_0x27df46){const _0x30d3ab=a47_0x5a1520;_0x27df46[_0x30d3ab(0x165)]=this[_0x30d3ab(0x165)],!_0x27df46[_0x30d3ab(0x157)]&&this[_0x30d3ab(0x157)]&&(_0x27df46[_0x30d3ab(0x157)]=this[_0x30d3ab(0x157)]),!_0x27df46[_0x30d3ab(0x168)]&&this[_0x30d3ab(0x15c)]&&(_0x27df46[_0x30d3ab(0x168)]=this[_0x30d3ab(0x15c)]),!_0x27df46[_0x30d3ab(0x13a)]&&this[_0x30d3ab(0x14e)]&&(_0x27df46[_0x30d3ab(0x13a)]=this[_0x30d3ab(0x14e)]),!_0x27df46['llmProject']&&this[_0x30d3ab(0x16b)]&&(_0x27df46[_0x30d3ab(0x151)]=this[_0x30d3ab(0x16b)]);}['getParameters'](){const _0x5dc2ca=a47_0x5a1520;return[{'key':_0x5dc2ca(0x165),'value':this[_0x5dc2ca(0x165)]},{'key':'database','value':this[_0x5dc2ca(0x157)]},{'key':'parent_segment','value':this['parent_segment']},{'key':'segment_path','value':this[_0x5dc2ca(0x14e)]},{'key':_0x5dc2ca(0x16b),'value':this[_0x5dc2ca(0x16b)]},{'key':_0x5dc2ca(0x16f),'value':this[_0x5dc2ca(0x172)]||undefined}];}[a47_0x5a1520(0x143)](){const _0x3b0d44=a47_0x5a1520;console['log']('[context]');for(const {key:_0x373262,value:_0x459d8a}of this[_0x3b0d44(0x170)]()){_0x459d8a&&console['log'](_0x373262+':\x20'+_0x459d8a);}}[a47_0x5a1520(0x138)](){const _0x105071=a47_0x5a1520;console[_0x105071(0x153)]('[context]');for(const {key:_0x355776,value:_0x4927e8}of this[_0x105071(0x170)]()){if(_0x4927e8){const _0x476dc9=_0x355776===_0x105071(0x16f)?_0x105071(0x167):'('+this[_0x105071(0x149)](_0x355776,_0x4927e8)+')';console[_0x105071(0x153)](_0x355776+':\x20'+_0x4927e8+'\x20'+_0x476dc9);}}console['log'](_0x105071(0x166));const _0x5520fc=[{'label':_0x105071(0x163),'path':this['configFiles'][_0x105071(0x14d)],'extra':_0x105071(0x14f)+this['sessionId']+')'},{'label':'Project','path':this[_0x105071(0x145)][_0x105071(0x139)]},{'label':_0x105071(0x15f),'path':this[_0x105071(0x145)][_0x105071(0x16f)]},{'label':_0x105071(0x13c),'path':this[_0x105071(0x145)]['profileCredentials']},{'label':_0x105071(0x13b),'path':this['configFiles'][_0x105071(0x13d)]},{'label':'Global\x20Credentials','path':this[_0x105071(0x145)][_0x105071(0x161)]}];for(const {label:_0x3c1f1e,path:_0x4e216a,extra:_0x866383}of _0x5520fc){if(_0x4e216a)console[_0x105071(0x153)](_0x3c1f1e+':\x20'+_0x4e216a+'\x20✓'+(_0x866383?'\x20'+_0x866383:''));else{if(_0x3c1f1e===_0x105071(0x163))console[_0x105071(0x153)](_0x3c1f1e+_0x105071(0x15d)+this[_0x105071(0x146)]+')');else(_0x3c1f1e==='Project'||_0x3c1f1e===_0x105071(0x13b))&&console[_0x105071(0x153)](_0x3c1f1e+_0x105071(0x150));}}}async['resolveAPIKeyAsync'](){const _0x52be6b=a47_0x5a1520;return this['apiKey']=await getAPIKeyAsync(this['site'],this[_0x52be6b(0x172)]||undefined),this[_0x52be6b(0x135)];}static async['createAsync'](_0x2d8fab){const _0x4f2cd6=a47_0x5a1520,_0x23a813=new GlobalContext(_0x2d8fab);return await _0x23a813[_0x4f2cd6(0x15e)](),_0x23a813;}}
1
+ const a47_0x55e2a4=a47_0x6865;(function(_0x53244e,_0x2dec07){const _0x115406=a47_0x6865,_0x472f3a=_0x53244e();while(!![]){try{const _0x45aee5=-parseInt(_0x115406(0x18e))/0x1*(parseInt(_0x115406(0x1ac))/0x2)+parseInt(_0x115406(0x1bc))/0x3+-parseInt(_0x115406(0x195))/0x4*(-parseInt(_0x115406(0x1ba))/0x5)+-parseInt(_0x115406(0x1a3))/0x6+-parseInt(_0x115406(0x1a4))/0x7+parseInt(_0x115406(0x19f))/0x8+parseInt(_0x115406(0x197))/0x9;if(_0x45aee5===_0x2dec07)break;else _0x472f3a['push'](_0x472f3a['shift']());}catch(_0x330405){_0x472f3a['push'](_0x472f3a['shift']());}}}(a47_0x4617,0xeaef2));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';function a47_0x6865(_0x5574ce,_0x4b3943){_0x5574ce=_0x5574ce-0x18e;const _0x4617fc=a47_0x4617();let _0x6865e4=_0x4617fc[_0x5574ce];return _0x6865e4;}import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import{LogLevel}from'../utils/tdx-logger.js';import*as a47_0x38344d from'node:fs';function a47_0x4617(){const _0x266e45=['138378dEVwjJ','Profile\x20Credentials','apiKey','parentSegment','activeProfile','site','log','parse','CLI\x20flag:\x20--','layers','us01','cliFlags','config','createAsync','configFiles','existsSync','sessionId',':\x20none','1138531fFRAwq','Global','segment_path','string','profileCredentials','project','join','12jsxZtI','INFO','21941037YRRiEx','global','llm_project','database','profile:\x20','replace','default','display','9237344yTUOFh','getSource','toString','injectIntoOptions','11310036huPXBf','510797VqalRN',':\x20none\x20(using\x20session:\x20','logLevel','profile','Profile','session','loadGlobalConfig','getParameters','2DTkXjR','.json','(active)','Session','llmProject','.env','Project','verbose','resolveAPIKeyAsync','(session:\x20','tdx.json','\x0a[configuration\x20files]','segmentPath','Global\x20Credentials','700185QCfJnk','parent_segment'];a47_0x4617=function(){return _0x266e45;};return a47_0x4617();}import*as a47_0x391f8e from'node:path';export class GlobalContext{['site'];['database'];['parent_segment'];[a47_0x55e2a4(0x190)];['llm_project'];[a47_0x55e2a4(0x1be)];[a47_0x55e2a4(0x1b3)];[a47_0x55e2a4(0x1a6)];['profile'];['layers'];[a47_0x55e2a4(0x1c0)];[a47_0x55e2a4(0x1cc)];[a47_0x55e2a4(0x1ca)];constructor(_0x2dab81){const _0x5e61d9=a47_0x55e2a4;this[_0x5e61d9(0x1cc)]=_0x2dab81[_0x5e61d9(0x1a9)]||getCurrentSessionPID()[_0x5e61d9(0x1a1)]();const _0x55f0bd=loadSessionContext(_0x2dab81['session']),_0x5a9591=loadProjectConfig(),_0x2a3b46=this[_0x5e61d9(0x1aa)]();this['activeProfile']=_0x2dab81[_0x5e61d9(0x1a7)]||_0x55f0bd?.['profile']||_0x2a3b46['profile']||getActiveProfile();const _0x41d9c2=this[_0x5e61d9(0x1c0)]?loadProfile(this[_0x5e61d9(0x1c0)]):null,_0x57a821=_0x58fe98=>{const _0x5e6898=_0x5e61d9;if(!_0x58fe98)return{};const _0x53ee60=_0x58fe98,_0x183f08={};for(const [_0x4c5c17,_0x1d7b15]of Object['entries'](_0x53ee60)){typeof _0x1d7b15===_0x5e6898(0x191)&&(_0x183f08[_0x4c5c17]=_0x1d7b15);}return _0x183f08;},_0x28f2bc={};if(_0x2dab81[_0x5e61d9(0x1c1)]&&_0x2dab81['site']!==_0x5e61d9(0x1c6))_0x28f2bc[_0x5e61d9(0x1c1)]=_0x2dab81[_0x5e61d9(0x1c1)];const _0x2ee1bd=_0x55f0bd?.[_0x5e61d9(0x19a)],_0x141ffe=_0x5a9591?.[_0x5e61d9(0x19a)],_0x494b32=_0x41d9c2?.[_0x5e61d9(0x1c8)]?.[_0x5e61d9(0x19a)],_0x589571=_0x2a3b46['database'];_0x2dab81[_0x5e61d9(0x19a)]&&(_0x2dab81['database']!==_0x2ee1bd&&_0x2dab81[_0x5e61d9(0x19a)]!==_0x141ffe&&_0x2dab81[_0x5e61d9(0x19a)]!==_0x494b32&&_0x2dab81[_0x5e61d9(0x19a)]!==_0x589571)&&(_0x28f2bc[_0x5e61d9(0x19a)]=_0x2dab81['database']);if(_0x2dab81[_0x5e61d9(0x1bf)])_0x28f2bc[_0x5e61d9(0x1bb)]=_0x2dab81[_0x5e61d9(0x1bf)];if(_0x2dab81[_0x5e61d9(0x1b0)])_0x28f2bc['llm_project']=_0x2dab81[_0x5e61d9(0x1b0)];if(_0x2dab81['profile'])_0x28f2bc[_0x5e61d9(0x1a7)]=_0x2dab81['profile'];this['layers']={'cliFlags':_0x28f2bc,'session':_0x57a821(_0x55f0bd),'project':_0x57a821(_0x5a9591),'profile':_0x57a821(_0x41d9c2?.[_0x5e61d9(0x1c8)]),'global':_0x57a821(_0x2a3b46)};const _0x1132c9={...this[_0x5e61d9(0x1c5)][_0x5e61d9(0x198)],...this[_0x5e61d9(0x1c5)][_0x5e61d9(0x1a7)],...this[_0x5e61d9(0x1c5)][_0x5e61d9(0x193)],...this[_0x5e61d9(0x1c5)]['session'],...this[_0x5e61d9(0x1c5)][_0x5e61d9(0x1c7)]},_0x31a3cd=_0x1132c9[_0x5e61d9(0x1c1)]||_0x5e61d9(0x1c6);this[_0x5e61d9(0x1c1)]=resolveSite(_0x31a3cd),this['database']=_0x1132c9['database'],this[_0x5e61d9(0x1bb)]=_0x1132c9[_0x5e61d9(0x1bb)],this[_0x5e61d9(0x190)]=_0x1132c9['segment_path'],this[_0x5e61d9(0x199)]=_0x1132c9['llm_project'],this[_0x5e61d9(0x1b3)]=_0x2dab81[_0x5e61d9(0x1b3)]||![],this['logLevel']=_0x2dab81[_0x5e61d9(0x1a6)]??LogLevel[_0x5e61d9(0x196)],this[_0x5e61d9(0x1a7)]=this[_0x5e61d9(0x1c0)]||undefined,this[_0x5e61d9(0x1be)]=getAPIKey(this[_0x5e61d9(0x1c1)],this[_0x5e61d9(0x1c0)]||undefined);const _0x441c7a=getConfigDir(),_0x3a75ed=a47_0x391f8e[_0x5e61d9(0x194)](_0x441c7a,'sessions',this[_0x5e61d9(0x1cc)]+_0x5e61d9(0x1ad)),_0x2ad364=findProjectConfigPath(),_0x2bf741=a47_0x391f8e[_0x5e61d9(0x194)](_0x441c7a,_0x5e61d9(0x1b6)),_0x3b3e89=a47_0x391f8e[_0x5e61d9(0x194)](_0x441c7a,_0x5e61d9(0x1b1));let _0x4e4fba=null,_0xc997cb=null;this[_0x5e61d9(0x1c0)]&&(_0x4e4fba=a47_0x391f8e[_0x5e61d9(0x194)](_0x441c7a,'profiles',this[_0x5e61d9(0x1c0)],_0x5e61d9(0x1b6)),_0xc997cb=a47_0x391f8e['join'](_0x441c7a,'profiles',this['activeProfile'],'.env')),this[_0x5e61d9(0x1ca)]={'session':a47_0x38344d[_0x5e61d9(0x1cb)](_0x3a75ed)?_0x3a75ed:null,'project':_0x2ad364,'profile':_0x4e4fba&&a47_0x38344d['existsSync'](_0x4e4fba)?_0x4e4fba:null,'profileCredentials':_0xc997cb&&a47_0x38344d[_0x5e61d9(0x1cb)](_0xc997cb)?_0xc997cb:null,'global':a47_0x38344d[_0x5e61d9(0x1cb)](_0x2bf741)?_0x2bf741:null,'globalCredentials':a47_0x38344d['existsSync'](_0x3b3e89)?_0x3b3e89:null};}[a47_0x55e2a4(0x1a0)](_0x4cab88,_0x3c441a){const _0x38d610=a47_0x55e2a4;if(!_0x3c441a)return'not\x20set';const _0x12c336=_0x3c441a;if(this[_0x38d610(0x1c5)][_0x38d610(0x1c7)][_0x4cab88]===_0x12c336){if(_0x4cab88===_0x38d610(0x1c1)&&_0x12c336===_0x38d610(0x1c6)&&!this[_0x38d610(0x1c5)][_0x38d610(0x1a9)][_0x38d610(0x1c1)]&&!this[_0x38d610(0x1c5)][_0x38d610(0x193)][_0x38d610(0x1c1)]&&!this['layers'][_0x38d610(0x1a7)][_0x38d610(0x1c1)]&&!this[_0x38d610(0x1c5)][_0x38d610(0x198)][_0x38d610(0x1c1)])return _0x38d610(0x19d);return _0x38d610(0x1c4)+_0x4cab88[_0x38d610(0x19c)](/_/g,'-');}if(this[_0x38d610(0x1c5)][_0x38d610(0x1a9)][_0x4cab88]===_0x12c336)return _0x38d610(0x1a9);if(this[_0x38d610(0x1c5)][_0x38d610(0x193)][_0x4cab88]===_0x12c336)return _0x38d610(0x193);if(this[_0x38d610(0x1c5)]['profile'][_0x4cab88]===_0x12c336)return _0x38d610(0x19b)+this[_0x38d610(0x1c0)];if(this[_0x38d610(0x1c5)][_0x38d610(0x198)][_0x4cab88]===_0x12c336)return _0x38d610(0x198);return _0x38d610(0x19d);}[a47_0x55e2a4(0x1aa)](){const _0xc910ee=a47_0x55e2a4,_0x5d6611=a47_0x391f8e[_0xc910ee(0x194)](getConfigDir(),'tdx.json');if(!a47_0x38344d[_0xc910ee(0x1cb)](_0x5d6611))return{};try{const _0x134098=a47_0x38344d['readFileSync'](_0x5d6611,'utf-8');return JSON[_0xc910ee(0x1c3)](_0x134098);}catch{return{};}}[a47_0x55e2a4(0x1a2)](_0x527a7d){const _0x3dbdb9=a47_0x55e2a4;_0x527a7d['site']=this[_0x3dbdb9(0x1c1)],!_0x527a7d[_0x3dbdb9(0x19a)]&&this[_0x3dbdb9(0x19a)]&&(_0x527a7d[_0x3dbdb9(0x19a)]=this[_0x3dbdb9(0x19a)]),!_0x527a7d[_0x3dbdb9(0x1bf)]&&this[_0x3dbdb9(0x1bb)]&&(_0x527a7d[_0x3dbdb9(0x1bf)]=this[_0x3dbdb9(0x1bb)]),!_0x527a7d[_0x3dbdb9(0x1b8)]&&this[_0x3dbdb9(0x190)]&&(_0x527a7d[_0x3dbdb9(0x1b8)]=this[_0x3dbdb9(0x190)]),!_0x527a7d['llmProject']&&this['llm_project']&&(_0x527a7d[_0x3dbdb9(0x1b0)]=this[_0x3dbdb9(0x199)]);}[a47_0x55e2a4(0x1ab)](){const _0x1c5b14=a47_0x55e2a4;return[{'key':'site','value':this['site']},{'key':_0x1c5b14(0x19a),'value':this[_0x1c5b14(0x19a)]},{'key':_0x1c5b14(0x1bb),'value':this['parent_segment']},{'key':_0x1c5b14(0x190),'value':this[_0x1c5b14(0x190)]},{'key':_0x1c5b14(0x199),'value':this[_0x1c5b14(0x199)]},{'key':_0x1c5b14(0x1a7),'value':this[_0x1c5b14(0x1c0)]||undefined}];}[a47_0x55e2a4(0x19e)](){const _0x43f3c8=a47_0x55e2a4;console[_0x43f3c8(0x1c2)]('[context]');for(const {key:_0x3424d1,value:_0x4ff2da}of this[_0x43f3c8(0x1ab)]()){_0x4ff2da&&console['log'](_0x3424d1+':\x20'+_0x4ff2da);}}['displayWithSources'](){const _0x1aae10=a47_0x55e2a4;console[_0x1aae10(0x1c2)]('[context]');for(const {key:_0x5d8a4f,value:_0x256f67}of this['getParameters']()){if(_0x256f67){const _0x3e9688=_0x5d8a4f===_0x1aae10(0x1a7)?_0x1aae10(0x1ae):'('+this[_0x1aae10(0x1a0)](_0x5d8a4f,_0x256f67)+')';console[_0x1aae10(0x1c2)](_0x5d8a4f+':\x20'+_0x256f67+'\x20'+_0x3e9688);}}console[_0x1aae10(0x1c2)](_0x1aae10(0x1b7));const _0x11726a=[{'label':'Session','path':this[_0x1aae10(0x1ca)][_0x1aae10(0x1a9)],'extra':_0x1aae10(0x1b5)+this['sessionId']+')'},{'label':_0x1aae10(0x1b2),'path':this[_0x1aae10(0x1ca)][_0x1aae10(0x193)]},{'label':_0x1aae10(0x1a8),'path':this[_0x1aae10(0x1ca)][_0x1aae10(0x1a7)]},{'label':_0x1aae10(0x1bd),'path':this['configFiles'][_0x1aae10(0x192)]},{'label':'Global','path':this[_0x1aae10(0x1ca)][_0x1aae10(0x198)]},{'label':_0x1aae10(0x1b9),'path':this['configFiles']['globalCredentials']}];for(const {label:_0x3fe0e7,path:_0x2d2c36,extra:_0x5971aa}of _0x11726a){if(_0x2d2c36)console['log'](_0x3fe0e7+':\x20'+_0x2d2c36+'\x20✓'+(_0x5971aa?'\x20'+_0x5971aa:''));else{if(_0x3fe0e7===_0x1aae10(0x1af))console['log'](_0x3fe0e7+_0x1aae10(0x1a5)+this[_0x1aae10(0x1cc)]+')');else(_0x3fe0e7==='Project'||_0x3fe0e7===_0x1aae10(0x18f))&&console[_0x1aae10(0x1c2)](_0x3fe0e7+_0x1aae10(0x1cd));}}}async['resolveAPIKeyAsync'](){const _0x2c0ffa=a47_0x55e2a4;return this[_0x2c0ffa(0x1be)]=await getAPIKeyAsync(this[_0x2c0ffa(0x1c1)],this['activeProfile']||undefined),this['apiKey'];}static async[a47_0x55e2a4(0x1c9)](_0x1876ea){const _0x3da1a5=a47_0x55e2a4,_0x5944d5=new GlobalContext(_0x1876ea);return await _0x5944d5[_0x3da1a5(0x1b4)](),_0x5944d5;}}
@@ -1 +1 @@
1
- const a48_0x5d6fc9=a48_0x5d3f;function a48_0x5d3f(_0x2871af,_0x55db21){_0x2871af=_0x2871af-0x68;const _0x424d93=a48_0x424d();let _0x5d3fdb=_0x424d93[_0x2871af];return _0x5d3fdb;}(function(_0x4d09e0,_0x4fe412){const _0x5161e=a48_0x5d3f,_0x2914e2=_0x4d09e0();while(!![]){try{const _0x1ef7ea=-parseInt(_0x5161e(0x73))/0x1+-parseInt(_0x5161e(0x6f))/0x2+parseInt(_0x5161e(0x77))/0x3+-parseInt(_0x5161e(0x6c))/0x4+-parseInt(_0x5161e(0x88))/0x5*(-parseInt(_0x5161e(0x78))/0x6)+-parseInt(_0x5161e(0x81))/0x7*(-parseInt(_0x5161e(0x82))/0x8)+parseInt(_0x5161e(0x68))/0x9*(parseInt(_0x5161e(0x6d))/0xa);if(_0x1ef7ea===_0x4fe412)break;else _0x2914e2['push'](_0x2914e2['shift']());}catch(_0x5ce023){_0x2914e2['push'](_0x2914e2['shift']());}}}(a48_0x424d,0xb3f6c));function a48_0x424d(){const _0x2e6e82=['not\x20supported','access','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.','3317461YiTcZd','8voHqRa','error','cannot\x20find','not\x20found','not\x20available',':api_key','25GckiRs','-25293','7706583JbmejS','restricted','could\x20not\x20be\x20found','includes','4185484blJLjY','10wTBvEx','__keychain_test__','2070566sUdZqS','message','-25300','setPassword','566480amDWEb','System\x20keychain\x20is\x20not\x20available','tdx','deletePassword','3940713pZcLiR','889782ADAUWb','unavailable','access_denied','getPassword','reason','toLowerCase'];a48_0x424d=function(){return _0x2e6e82;};return a48_0x424d();}const SERVICE_NAME=a48_0x5d6fc9(0x75);let keyringModule=null,keyringLoadError=null;async function getKeyring(){if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x4f33bb=await import('@zowe/secrets-for-zowe-sdk');return keyringModule=_0x4f33bb['keyring'],keyringModule;}catch(_0x373a4e){return keyringLoadError=_0x373a4e instanceof Error?_0x373a4e:new Error(String(_0x373a4e)),null;}}function getAccountName(_0x7c504a){const _0x49a16c=a48_0x5d6fc9,_0x548a68=_0x7c504a||'';return'profile:'+_0x548a68+_0x49a16c(0x87);}export async function getKeychainAPIKey(_0xf4f1bd){const _0x1d7943=a48_0x5d6fc9,_0x2b8c31=await getKeychainAPIKeyWithStatus(_0xf4f1bd);if(_0x2b8c31['success'])return _0x2b8c31['value'];return _0x2b8c31[_0x1d7943(0x7c)]===_0x1d7943(0x7a)&&console[_0x1d7943(0x83)]('Warning:\x20'+_0x2b8c31[_0x1d7943(0x70)]),null;}export async function getKeychainAPIKeyWithStatus(_0x803b94){const _0x16614d=a48_0x5d6fc9;try{const _0x2266a0=await getKeyring();if(!_0x2266a0)return{'success':![],'reason':'unavailable'};const _0x572ca8=getAccountName(_0x803b94),_0x39cc65=await _0x2266a0[_0x16614d(0x7b)](SERVICE_NAME,_0x572ca8);if(_0x39cc65)return{'success':!![],'value':_0x39cc65};return{'success':![],'reason':'not_found'};}catch(_0x4ba4cf){const _0x3599ec=_0x4ba4cf instanceof Error?_0x4ba4cf[_0x16614d(0x70)]:String(_0x4ba4cf);if(_0x3599ec[_0x16614d(0x6b)](_0x16614d(0x71))||_0x3599ec['toLowerCase']()['includes'](_0x16614d(0x6a))||_0x3599ec[_0x16614d(0x7d)]()[_0x16614d(0x6b)](_0x16614d(0x85)))return{'success':![],'reason':'not_found'};if(_0x3599ec['includes'](_0x16614d(0x89))||_0x3599ec[_0x16614d(0x7d)]()[_0x16614d(0x6b)](_0x16614d(0x69))||_0x3599ec[_0x16614d(0x7d)]()['includes'](_0x16614d(0x7f)))return{'success':![],'reason':_0x16614d(0x7a),'message':_0x16614d(0x80)};return{'success':![],'reason':_0x16614d(0x79),'message':_0x3599ec};}}export async function saveKeychainAPIKey(_0x31a725,_0xf5a247){const _0x126419=a48_0x5d6fc9,_0x404933=await getKeyring();if(!_0x404933)throw new Error(_0x126419(0x74));const _0x3b917c=getAccountName(_0xf5a247);await _0x404933[_0x126419(0x72)](SERVICE_NAME,_0x3b917c,_0x31a725);}export async function deleteKeychainAPIKey(_0x3742bf){const _0x4be0b5=a48_0x5d6fc9;try{const _0x18d22c=await getKeyring();if(!_0x18d22c)return![];const _0x384c04=getAccountName(_0x3742bf);return await _0x18d22c[_0x4be0b5(0x76)](SERVICE_NAME,_0x384c04);}catch{return![];}}export async function isKeychainAvailable(){const _0x289c8c=a48_0x5d6fc9;try{const _0x2e1ad2=await getKeyring();if(!_0x2e1ad2)return![];return await _0x2e1ad2['getPassword'](SERVICE_NAME,_0x289c8c(0x6e)),!![];}catch(_0xa4e025){const _0x248013=_0xa4e025 instanceof Error?_0xa4e025[_0x289c8c(0x70)][_0x289c8c(0x7d)]():'';if(_0x248013[_0x289c8c(0x6b)](_0x289c8c(0x86))||_0x248013['includes'](_0x289c8c(0x7e))||_0x248013[_0x289c8c(0x6b)](_0x289c8c(0x84)))return![];return!![];}}
1
+ (function(_0x3b4413,_0x292036){const _0x561a67=a48_0x3c35,_0xf1b971=_0x3b4413();while(!![]){try{const _0x5a9406=parseInt(_0x561a67(0xd6))/0x1+parseInt(_0x561a67(0xed))/0x2*(parseInt(_0x561a67(0xdc))/0x3)+-parseInt(_0x561a67(0xe6))/0x4+parseInt(_0x561a67(0xcf))/0x5+-parseInt(_0x561a67(0xec))/0x6+-parseInt(_0x561a67(0xd7))/0x7*(-parseInt(_0x561a67(0xe3))/0x8)+parseInt(_0x561a67(0xd8))/0x9*(-parseInt(_0x561a67(0xe9))/0xa);if(_0x5a9406===_0x292036)break;else _0xf1b971['push'](_0xf1b971['shift']());}catch(_0x26a0ec){_0xf1b971['push'](_0xf1b971['shift']());}}}(a48_0x4c6a,0x38d52));const SERVICE_NAME='tdx';function a48_0x3c35(_0x485416,_0x2a14c4){_0x485416=_0x485416-0xcf;const _0x4c6a86=a48_0x4c6a();let _0x3c355e=_0x4c6a86[_0x485416];return _0x3c355e;}let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x24aff1=a48_0x3c35;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x3da19a=await import('@zowe/secrets-for-zowe-sdk');return keyringModule=_0x3da19a[_0x24aff1(0xd3)],keyringModule;}catch(_0x1862d8){return keyringLoadError=_0x1862d8 instanceof Error?_0x1862d8:new Error(String(_0x1862d8)),null;}}function getAccountName(_0x1f36b3){const _0x4b3543=a48_0x3c35,_0x2cf3bc=_0x1f36b3||'';return'profile:'+_0x2cf3bc+_0x4b3543(0xdd);}function a48_0x4c6a(){const _0x538605=['89929PgMgMz','4863033gXGZZI','-25300','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.','not_found','678567aaPRmX',':api_key','success','not\x20available','setPassword','Warning:\x20','value','216kfOuCT','access_denied','includes','512288IENzjX','restricted','cannot\x20find','10VPXsBs','could\x20not\x20be\x20found','getPassword','1916940IQmPNT','2WdRBQx','access','message','not\x20supported','2296660bQWrKF','System\x20keychain\x20is\x20not\x20available','toLowerCase','reason','keyring','unavailable','__keychain_test__','188295mIQGyA'];a48_0x4c6a=function(){return _0x538605;};return a48_0x4c6a();}export async function getKeychainAPIKey(_0xd9ae19){const _0x2d31f5=a48_0x3c35,_0x5223a8=await getKeychainAPIKeyWithStatus(_0xd9ae19);if(_0x5223a8[_0x2d31f5(0xde)])return _0x5223a8[_0x2d31f5(0xe2)];return _0x5223a8[_0x2d31f5(0xd2)]===_0x2d31f5(0xe4)&&console['error'](_0x2d31f5(0xe1)+_0x5223a8[_0x2d31f5(0xef)]),null;}export async function getKeychainAPIKeyWithStatus(_0x19bab8){const _0xfff67e=a48_0x3c35;try{const _0xe8f56a=await getKeyring();if(!_0xe8f56a)return{'success':![],'reason':_0xfff67e(0xd4)};const _0x4990fc=getAccountName(_0x19bab8),_0x1e5f74=await _0xe8f56a[_0xfff67e(0xeb)](SERVICE_NAME,_0x4990fc);if(_0x1e5f74)return{'success':!![],'value':_0x1e5f74};return{'success':![],'reason':_0xfff67e(0xdb)};}catch(_0x55c263){const _0xa43db=_0x55c263 instanceof Error?_0x55c263[_0xfff67e(0xef)]:String(_0x55c263);if(_0xa43db[_0xfff67e(0xe5)](_0xfff67e(0xd9))||_0xa43db[_0xfff67e(0xd1)]()[_0xfff67e(0xe5)](_0xfff67e(0xea))||_0xa43db[_0xfff67e(0xd1)]()[_0xfff67e(0xe5)]('not\x20found'))return{'success':![],'reason':_0xfff67e(0xdb)};if(_0xa43db['includes']('-25293')||_0xa43db[_0xfff67e(0xd1)]()[_0xfff67e(0xe5)](_0xfff67e(0xe7))||_0xa43db[_0xfff67e(0xd1)]()[_0xfff67e(0xe5)](_0xfff67e(0xee)))return{'success':![],'reason':_0xfff67e(0xe4),'message':_0xfff67e(0xda)};return{'success':![],'reason':_0xfff67e(0xd4),'message':_0xa43db};}}export async function saveKeychainAPIKey(_0x4532b7,_0x190de7){const _0x2ac6c3=a48_0x3c35,_0x370774=await getKeyring();if(!_0x370774)throw new Error(_0x2ac6c3(0xd0));const _0x5b5873=getAccountName(_0x190de7);await _0x370774[_0x2ac6c3(0xe0)](SERVICE_NAME,_0x5b5873,_0x4532b7);}export async function deleteKeychainAPIKey(_0x345306){try{const _0x394703=await getKeyring();if(!_0x394703)return![];const _0x59d9b6=getAccountName(_0x345306);return await _0x394703['deletePassword'](SERVICE_NAME,_0x59d9b6);}catch{return![];}}export async function isKeychainAvailable(){const _0x56daff=a48_0x3c35;try{const _0x247325=await getKeyring();if(!_0x247325)return![];return await _0x247325['getPassword'](SERVICE_NAME,_0x56daff(0xd5)),!![];}catch(_0x58a2e0){const _0x46311e=_0x58a2e0 instanceof Error?_0x58a2e0[_0x56daff(0xef)][_0x56daff(0xd1)]():'';if(_0x46311e[_0x56daff(0xe5)](_0x56daff(0xdf))||_0x46311e[_0x56daff(0xe5)](_0x56daff(0xf0))||_0x46311e[_0x56daff(0xe5)](_0x56daff(0xe8)))return![];return!![];}}
@@ -1 +1 @@
1
- (function(_0x14edcc,_0x79d69f){const _0x1d7080=a49_0x550d,_0x676650=_0x14edcc();while(!![]){try{const _0x5bd332=parseInt(_0x1d7080(0x16b))/0x1+-parseInt(_0x1d7080(0x165))/0x2+parseInt(_0x1d7080(0x19c))/0x3+parseInt(_0x1d7080(0x182))/0x4*(parseInt(_0x1d7080(0x184))/0x5)+-parseInt(_0x1d7080(0x19f))/0x6*(parseInt(_0x1d7080(0x17f))/0x7)+-parseInt(_0x1d7080(0x179))/0x8+-parseInt(_0x1d7080(0x161))/0x9*(-parseInt(_0x1d7080(0x1a9))/0xa);if(_0x5bd332===_0x79d69f)break;else _0x676650['push'](_0x676650['shift']());}catch(_0x51f7c6){_0x676650['push'](_0x676650['shift']());}}}(a49_0x23d9,0x1a864));import*as a49_0x22f3ce from'node:fs';import*as a49_0x36a497 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';export function getProfileParams(_0xc383a2){const _0x9fc9c6=a49_0x550d,_0x24d528={};if(!_0xc383a2)return _0x24d528;for(const [_0x3498e6,_0x223faf]of Object[_0x9fc9c6(0x176)](_0xc383a2)){_0x3498e6!==_0x9fc9c6(0x194)&&_0x223faf!==undefined&&(_0x24d528[_0x3498e6]=_0x223faf);}return _0x24d528;}export function getProfilesDir(){const _0x5d0cb9=a49_0x550d;return a49_0x36a497[_0x5d0cb9(0x1ac)](getConfigDir(),'profiles');}function getProfileDir(_0x54fc2f){return a49_0x36a497['join'](getProfilesDir(),_0x54fc2f);}function getProfileConfigPath(_0x3d349f){const _0x551229=a49_0x550d;return a49_0x36a497['join'](getProfileDir(_0x3d349f),_0x551229(0x185));}function a49_0x550d(_0x35b655,_0x2afbc5){_0x35b655=_0x35b655-0x161;const _0x23d98f=a49_0x23d9();let _0x550d3e=_0x23d98f[_0x35b655];return _0x550d3e;}function getProfileEnvPath(_0x5ea058){const _0x59f1fa=a49_0x550d;return a49_0x36a497[_0x59f1fa(0x1ac)](getProfileDir(_0x5ea058),_0x59f1fa(0x166));}function getGlobalConfigPath(){const _0x9c5ac=a49_0x550d;return a49_0x36a497[_0x9c5ac(0x1ac)](getConfigDir(),_0x9c5ac(0x185));}function validateProfileName(_0x332825){const _0x3ac29c=a49_0x550d;if(!/^[a-zA-Z0-9_-]+$/[_0x3ac29c(0x1a8)](_0x332825))throw new Error(_0x3ac29c(0x16e)+_0x332825+_0x3ac29c(0x18b));}function validateProfileConfig(_0x5e2aa3,_0x19bdc8){const _0x5661af=a49_0x550d;if(typeof _0x5e2aa3!==_0x5661af(0x199)||_0x5e2aa3===null)throw new Error(_0x5661af(0x181)+_0x19bdc8+_0x5661af(0x162));const _0x4e89f=['description','site',_0x5661af(0x169),_0x5661af(0x1a7),_0x5661af(0x16a),'llm_agent'],_0xe1653e=_0x5e2aa3;for(const _0x9931e9 of Object[_0x5661af(0x168)](_0xe1653e)){!_0x4e89f[_0x5661af(0x192)](_0x9931e9)&&console[_0x5661af(0x19b)](_0x5661af(0x1a6)+_0x19bdc8+_0x5661af(0x171)+_0x9931e9+'\x27\x20will\x20be\x20ignored');}if(_0xe1653e[_0x5661af(0x194)]!==undefined&&typeof _0xe1653e[_0x5661af(0x194)]!==_0x5661af(0x19e))throw new Error(_0x5661af(0x181)+_0x19bdc8+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0xe1653e[_0x5661af(0x189)]!==undefined&&typeof _0xe1653e[_0x5661af(0x189)]!=='string')throw new Error(_0x5661af(0x181)+_0x19bdc8+_0x5661af(0x172));if(_0xe1653e[_0x5661af(0x169)]!==undefined&&typeof _0xe1653e[_0x5661af(0x169)]!==_0x5661af(0x19e))throw new Error(_0x5661af(0x181)+_0x19bdc8+_0x5661af(0x19a));if(_0xe1653e[_0x5661af(0x1a7)]!==undefined&&typeof _0xe1653e[_0x5661af(0x1a7)]!==_0x5661af(0x19e))throw new Error(_0x5661af(0x181)+_0x19bdc8+'\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string');if(_0xe1653e[_0x5661af(0x16a)]!==undefined&&typeof _0xe1653e['llm_project']!==_0x5661af(0x19e))throw new Error('Profile\x20\x27'+_0x19bdc8+_0x5661af(0x177));if(_0xe1653e[_0x5661af(0x1aa)]!==undefined&&typeof _0xe1653e[_0x5661af(0x1aa)]!==_0x5661af(0x19e))throw new Error(_0x5661af(0x181)+_0x19bdc8+_0x5661af(0x17a));return!![];}function loadProfilesFromTdxJson(_0x2573d,_0x2e68d3){const _0x2ea34f=a49_0x550d;if(!a49_0x22f3ce[_0x2ea34f(0x197)](_0x2573d))return[];try{const _0x5a3da5=a49_0x22f3ce['readFileSync'](_0x2573d,_0x2ea34f(0x1a0)),_0xd3f6bd=JSON['parse'](_0x5a3da5);if(!_0xd3f6bd['profiles']||typeof _0xd3f6bd['profiles']!=='object')return[];const _0x2a363b=[];for(const [_0x4bde6b,_0x258d89]of Object[_0x2ea34f(0x176)](_0xd3f6bd['profiles'])){try{validateProfileConfig(_0x258d89,_0x4bde6b);const _0x16e16c=getNewCredentialPath(_0x4bde6b),_0x366b04=getOldCredentialPath(_0x4bde6b),_0x56396d=a49_0x22f3ce[_0x2ea34f(0x197)](_0x16e16c)||a49_0x22f3ce[_0x2ea34f(0x197)](_0x366b04);_0x2a363b[_0x2ea34f(0x187)]({'name':_0x4bde6b,'config':_0x258d89,'metadata':{'name':_0x4bde6b,'createdAt':new Date()[_0x2ea34f(0x164)]()},'hasCredentials':_0x56396d,'scope':_0x2e68d3});}catch(_0x5624b1){_0x5624b1 instanceof Error&&(console['warn'](_0x2ea34f(0x174)+_0x2573d+':'),console[_0x2ea34f(0x19b)]('\x20\x20'+_0x5624b1[_0x2ea34f(0x188)]+'\x0a'));}}return _0x2a363b;}catch(_0x166af5){return _0x166af5 instanceof SyntaxError?(console[_0x2ea34f(0x19b)](_0x2ea34f(0x170)+_0x2573d+_0x2ea34f(0x186)),console[_0x2ea34f(0x19b)](_0x2ea34f(0x17d)+_0x166af5[_0x2ea34f(0x188)]+'\x0a')):console[_0x2ea34f(0x19b)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x2573d+':\x20'+_0x166af5+'\x0a'),[];}}export function getNewCredentialPath(_0x576753){const _0x348de=a49_0x550d;return a49_0x36a497[_0x348de(0x1ac)](getConfigDir(),_0x348de(0x1a4)+_0x576753);}function getOldCredentialPath(_0x42d984){const _0x52890c=a49_0x550d;return a49_0x36a497[_0x52890c(0x1ac)](getProfilesDir(),_0x42d984,_0x52890c(0x166));}function loadProfilesFromTdxJsonFiles(){const _0x2db0f6=a49_0x550d,_0x3c7a40=[],_0x382dd6=findProjectConfigPath();_0x382dd6&&_0x3c7a40[_0x2db0f6(0x187)](...loadProfilesFromTdxJson(_0x382dd6,_0x2db0f6(0x196)));const _0x294602=a49_0x36a497[_0x2db0f6(0x1ac)](getConfigDir(),_0x2db0f6(0x185));return _0x3c7a40[_0x2db0f6(0x187)](...loadProfilesFromTdxJson(_0x294602,'user')),_0x3c7a40;}function loadProfilesFromDirectories(){const _0x439708=a49_0x550d,_0x516dcf=getProfilesDir();if(!a49_0x22f3ce[_0x439708(0x197)](_0x516dcf))return[];try{return a49_0x22f3ce[_0x439708(0x16c)](_0x516dcf,{'withFileTypes':!![]})[_0x439708(0x1a3)](_0x3c240a=>_0x3c240a[_0x439708(0x190)]())[_0x439708(0x19d)](_0x582b83=>_0x582b83[_0x439708(0x16f)])[_0x439708(0x1a3)](_0x5526d8=>{const _0x5e25db=getProfileConfigPath(_0x5526d8),_0xdef307=getProfileEnvPath(_0x5526d8);return a49_0x22f3ce['existsSync'](_0x5e25db)||a49_0x22f3ce['existsSync'](_0xdef307);})[_0x439708(0x19d)](_0x342002=>{const _0x15d53d=_0x439708,_0x3b8cc2=loadProfileFromDirectory(_0x342002);if(_0x3b8cc2)return{..._0x3b8cc2,'scope':_0x15d53d(0x1ab)};return null;})[_0x439708(0x1a3)](_0x9445d4=>_0x9445d4!==null);}catch{return[];}}function loadProfileFromDirectory(_0x552c99){const _0x505173=a49_0x550d,_0x2a1fef=getProfileConfigPath(_0x552c99),_0x286e1f=getOldCredentialPath(_0x552c99);if(!a49_0x22f3ce[_0x505173(0x197)](_0x2a1fef)&&!a49_0x22f3ce[_0x505173(0x197)](_0x286e1f))return null;let _0x3e018f={},_0x2c6d69={'name':_0x552c99,'createdAt':new Date()['toISOString']()};if(a49_0x22f3ce[_0x505173(0x197)](_0x2a1fef))try{const _0x4d0014=a49_0x22f3ce[_0x505173(0x18f)](_0x2a1fef,_0x505173(0x1a0)),_0x958f4b=JSON[_0x505173(0x191)](_0x4d0014),{metadata:_0x203d81,..._0x578ccc}=_0x958f4b;_0x3e018f=_0x578ccc,_0x203d81&&(_0x2c6d69=_0x203d81);}catch{}return{'name':_0x552c99,'config':_0x3e018f,'metadata':_0x2c6d69,'hasCredentials':a49_0x22f3ce[_0x505173(0x197)](_0x286e1f),'scope':'directory'};}export function listProfiles(){const _0x2c0e67=a49_0x550d,_0x50611c=loadProfilesFromTdxJsonFiles(),_0x3118fd=loadProfilesFromDirectories();if(_0x3118fd[_0x2c0e67(0x183)]>0x0){const _0x2de443=_0x3118fd[_0x2c0e67(0x19d)](_0x42b2e7=>_0x42b2e7[_0x2c0e67(0x16f)])[_0x2c0e67(0x1ac)](',\x20'),_0x36b230=getConfigDir();console[_0x2c0e67(0x19b)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0x2de443),console[_0x2c0e67(0x19b)](_0x2c0e67(0x1a5)),console[_0x2c0e67(0x19b)](_0x2c0e67(0x173)+a49_0x36a497[_0x2c0e67(0x1ac)](_0x36b230,_0x2c0e67(0x185))),console[_0x2c0e67(0x19b)](_0x2c0e67(0x198)),console[_0x2c0e67(0x19b)](_0x2c0e67(0x18d));}const _0x531969=[..._0x50611c,..._0x3118fd],_0x4fbd50=new Map();for(const _0x5732b0 of _0x531969){!_0x4fbd50['has'](_0x5732b0['name'])&&_0x4fbd50[_0x2c0e67(0x1a1)](_0x5732b0[_0x2c0e67(0x16f)],_0x5732b0);}return Array['from'](_0x4fbd50[_0x2c0e67(0x167)]())[_0x2c0e67(0x17e)]((_0x4c201c,_0x2ef7e7)=>_0x4c201c[_0x2c0e67(0x16f)][_0x2c0e67(0x180)](_0x2ef7e7[_0x2c0e67(0x16f)]));}export function profileExists(_0x21bb50){const _0x5edc9a=listProfiles();return _0x5edc9a['some'](_0x4a64e3=>_0x4a64e3['name']===_0x21bb50);}export function loadProfile(_0x381ed9){validateProfileName(_0x381ed9);const _0x133803=listProfiles(),_0x3f851f=_0x133803['find'](_0x3bef5e=>_0x3bef5e['name']===_0x381ed9);return _0x3f851f||null;}export function saveProfile(_0x26cb0e,_0x46e0d0,_0x231ffd=![]){saveProfileToUserConfig(_0x26cb0e,_0x46e0d0);}export function deleteProfile(_0xf7635c){const _0x18980c=a49_0x550d;validateProfileName(_0xf7635c);const _0x45ec73=getProfileDir(_0xf7635c);if(!a49_0x22f3ce[_0x18980c(0x197)](_0x45ec73))throw new Error(_0x18980c(0x18a)+_0xf7635c+_0x18980c(0x178));a49_0x22f3ce[_0x18980c(0x18e)](_0x45ec73,{'recursive':!![],'force':!![]});}function a49_0x23d9(){const _0x299d3c=['Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','Warning:\x20Profile\x20\x27','parent_segment','test','122590qYszSq','llm_agent','directory','join','243CkEtSN','\x27:\x20config\x20must\x20be\x20an\x20object','stringify','toISOString','420700mfKSFs','.env','values','keys','database','llm_project','75569kUDBpH','readdirSync','profiles','Invalid\x20profile\x20name:\x20','name','\x0aWarning:\x20Failed\x20to\x20parse\x20','\x27:\x20unknown\x20config\x20key\x20\x27','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','\x20\x201.\x20Edit:\x20','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','entries','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','\x20does\x20not\x20exist','1535752kuLLjJ','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string',',\x20creating\x20new\x20file','profile','Error:\x20','sort','1421pOXzGF','localeCompare','Profile\x20\x27','5788Cedrvv','length','450qmhbwc','tdx.json',':\x20Invalid\x20JSON\x20syntax','push','message','site','Profile\x20','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','\x20\x20mv\x20\x22','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','rmSync','readFileSync','isDirectory','parse','includes','\x20already\x20exists','description','Warning:\x20Failed\x20to\x20parse\x20','local','existsSync','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','object','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','warn','225186nDxLZH','map','string','2982WeddUx','utf-8','set','To\x20migrate:','filter','.env.'];a49_0x23d9=function(){return _0x299d3c;};return a49_0x23d9();}export function saveProfileToUserConfig(_0x4208d1,_0x32d18a){const _0x42e8b6=a49_0x550d;validateProfileName(_0x4208d1);const _0x15fd6c=getGlobalConfigPath(),_0x4f1178=getConfigDir();!a49_0x22f3ce['existsSync'](_0x4f1178)&&createSecureDirectory(_0x4f1178);let _0xa5dc29={};if(a49_0x22f3ce['existsSync'](_0x15fd6c))try{const _0xeafb03=a49_0x22f3ce[_0x42e8b6(0x18f)](_0x15fd6c,_0x42e8b6(0x1a0));_0xa5dc29=JSON['parse'](_0xeafb03);}catch{console[_0x42e8b6(0x19b)](_0x42e8b6(0x195)+_0x15fd6c+_0x42e8b6(0x17b));}!_0xa5dc29[_0x42e8b6(0x16d)]&&(_0xa5dc29[_0x42e8b6(0x16d)]={}),_0xa5dc29[_0x42e8b6(0x16d)][_0x4208d1]=_0x32d18a,writeSecureFile(_0x15fd6c,JSON[_0x42e8b6(0x163)](_0xa5dc29,null,0x2));}export function getActiveProfile(){const _0x183679=a49_0x550d,_0x5dc2a3=loadSessionContext();if(_0x5dc2a3?.[_0x183679(0x17c)])return _0x5dc2a3['profile'];const _0x3c7ee0=getGlobalConfigPath();if(!a49_0x22f3ce[_0x183679(0x197)](_0x3c7ee0))return null;try{const _0x5530e3=a49_0x22f3ce['readFileSync'](_0x3c7ee0,_0x183679(0x1a0)),_0x143148=JSON[_0x183679(0x191)](_0x5530e3);return _0x143148['profile']||null;}catch{return null;}}export function createProfile(_0x998d5f,_0x47a901){const _0x4255ad=a49_0x550d;validateProfileName(_0x998d5f);if(profileExists(_0x998d5f))throw new Error('Profile\x20'+_0x998d5f+_0x4255ad(0x193));saveProfile(_0x998d5f,_0x47a901);}export function saveProfileCredentials(_0x28ab2e,_0x3c3792){const _0x5cac81=a49_0x550d;validateProfileName(_0x28ab2e);if(!profileExists(_0x28ab2e))throw new Error(_0x5cac81(0x18a)+_0x28ab2e+_0x5cac81(0x178));const _0x46779b=getNewCredentialPath(_0x28ab2e);writeSecureFile(_0x46779b,_0x3c3792);}export function loadProfileCredentials(_0x2c9918){const _0x12e4e5=a49_0x550d;validateProfileName(_0x2c9918);const _0x1a5a5f=getNewCredentialPath(_0x2c9918);if(a49_0x22f3ce[_0x12e4e5(0x197)](_0x1a5a5f))try{return a49_0x22f3ce[_0x12e4e5(0x18f)](_0x1a5a5f,_0x12e4e5(0x1a0));}catch{}const _0x3a1254=getOldCredentialPath(_0x2c9918);if(a49_0x22f3ce[_0x12e4e5(0x197)](_0x3a1254)){console[_0x12e4e5(0x19b)](_0x12e4e5(0x175)+_0x2c9918+'\x27'),console[_0x12e4e5(0x19b)](_0x12e4e5(0x1a2)),console[_0x12e4e5(0x19b)](_0x12e4e5(0x18c)+_0x3a1254+'\x22\x20\x22'+_0x1a5a5f+'\x22'),console[_0x12e4e5(0x19b)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a49_0x22f3ce[_0x12e4e5(0x18f)](_0x3a1254,_0x12e4e5(0x1a0));}catch{return null;}}return null;}
1
+ (function(_0x30172e,_0x182618){const _0x1418b4=a49_0x357e,_0x1bd83f=_0x30172e();while(!![]){try{const _0x32aaab=parseInt(_0x1418b4(0xe0))/0x1*(parseInt(_0x1418b4(0xc1))/0x2)+-parseInt(_0x1418b4(0xd8))/0x3+parseInt(_0x1418b4(0xf6))/0x4+parseInt(_0x1418b4(0xd9))/0x5+parseInt(_0x1418b4(0xdb))/0x6+parseInt(_0x1418b4(0xfb))/0x7+parseInt(_0x1418b4(0xf8))/0x8*(-parseInt(_0x1418b4(0xde))/0x9);if(_0x32aaab===_0x182618)break;else _0x1bd83f['push'](_0x1bd83f['shift']());}catch(_0x548882){_0x1bd83f['push'](_0x1bd83f['shift']());}}}(a49_0x531c,0xd5296));import*as a49_0xe2638a from'node:fs';import*as a49_0x2921d2 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';import{loadSessionContext}from'./session.js';function a49_0x357e(_0x19360b,_0x1ac940){_0x19360b=_0x19360b-0xbe;const _0x531c50=a49_0x531c();let _0x357e8a=_0x531c50[_0x19360b];return _0x357e8a;}function a49_0x531c(){const _0xb9e4bc=['263205uoATAK','rmSync','14887XhujqS','has','object','keys','isDirectory','description','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','local','\x0aWarning:\x20Failed\x20to\x20parse\x20','\x27\x20will\x20be\x20ignored','profile','profiles','values','To\x20migrate:','Warning:\x20Profile\x20\x27','\x20does\x20not\x20exist','\x22\x20\x22','includes','parent_segment','warn','llm_project','string','303680OaKtCB','localeCompare','816JvzAJd','Profile\x20\x27','toISOString','11889024ePALVm','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','readFileSync','name','.env','message','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','join','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','parse','\x20\x20mv\x20\x22','.env.','162ZPqLLK','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','length','test','push','\x20already\x20exists','existsSync','utf-8','filter','llm_agent',':\x20Invalid\x20JSON\x20syntax','Error:\x20','readdirSync','directory','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','\x20\x201.\x20Edit:\x20','tdx.json','Warning:\x20Failed\x20to\x20parse\x20','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','map','site','Profile\x20','some','1043379syzmLE','859685TabwWO','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','6310542TpQJnF','database','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'];a49_0x531c=function(){return _0xb9e4bc;};return a49_0x531c();}export function getProfileParams(_0x1412cc){const _0x4fef68=a49_0x357e,_0x470e37={};if(!_0x1412cc)return _0x470e37;for(const [_0x21a2db,_0x4c295a]of Object['entries'](_0x1412cc)){_0x21a2db!==_0x4fef68(0xe5)&&_0x4c295a!==undefined&&(_0x470e37[_0x21a2db]=_0x4c295a);}return _0x470e37;}export function getProfilesDir(){const _0x56250a=a49_0x357e;return a49_0x2921d2[_0x56250a(0x102)](getConfigDir(),_0x56250a(0xeb));}function getProfileDir(_0x35e749){const _0x237a39=a49_0x357e;return a49_0x2921d2[_0x237a39(0x102)](getProfilesDir(),_0x35e749);}function getProfileConfigPath(_0x1eff48){return a49_0x2921d2['join'](getProfileDir(_0x1eff48),'tdx.json');}function getProfileEnvPath(_0x1b378a){const _0x2a1556=a49_0x357e;return a49_0x2921d2[_0x2a1556(0x102)](getProfileDir(_0x1b378a),_0x2a1556(0xff));}function getGlobalConfigPath(){const _0x21c2ef=a49_0x357e;return a49_0x2921d2['join'](getConfigDir(),_0x21c2ef(0xd1));}function validateProfileName(_0x3afe24){const _0x52db7c=a49_0x357e;if(!/^[a-zA-Z0-9_-]+$/[_0x52db7c(0xc4)](_0x3afe24))throw new Error('Invalid\x20profile\x20name:\x20'+_0x3afe24+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.');}function validateProfileConfig(_0x1a0e06,_0x20c5aa){const _0x59527c=a49_0x357e;if(typeof _0x1a0e06!=='object'||_0x1a0e06===null)throw new Error(_0x59527c(0xf9)+_0x20c5aa+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x4413cc=[_0x59527c(0xe5),_0x59527c(0xd5),'database',_0x59527c(0xf2),'llm_project',_0x59527c(0xca)],_0x414c0d=_0x1a0e06;for(const _0x4ad424 of Object[_0x59527c(0xe3)](_0x414c0d)){!_0x4413cc[_0x59527c(0xf1)](_0x4ad424)&&console[_0x59527c(0xf3)](_0x59527c(0xee)+_0x20c5aa+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x4ad424+_0x59527c(0xe9));}if(_0x414c0d['description']!==undefined&&typeof _0x414c0d[_0x59527c(0xe5)]!=='string')throw new Error(_0x59527c(0xf9)+_0x20c5aa+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x414c0d[_0x59527c(0xd5)]!==undefined&&typeof _0x414c0d['site']!=='string')throw new Error(_0x59527c(0xf9)+_0x20c5aa+_0x59527c(0x103));if(_0x414c0d[_0x59527c(0xdc)]!==undefined&&typeof _0x414c0d[_0x59527c(0xdc)]!==_0x59527c(0xf5))throw new Error(_0x59527c(0xf9)+_0x20c5aa+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x414c0d[_0x59527c(0xf2)]!==undefined&&typeof _0x414c0d['parent_segment']!==_0x59527c(0xf5))throw new Error('Profile\x20\x27'+_0x20c5aa+_0x59527c(0xc2));if(_0x414c0d[_0x59527c(0xf4)]!==undefined&&typeof _0x414c0d['llm_project']!==_0x59527c(0xf5))throw new Error('Profile\x20\x27'+_0x20c5aa+_0x59527c(0xd3));if(_0x414c0d[_0x59527c(0xca)]!==undefined&&typeof _0x414c0d['llm_agent']!==_0x59527c(0xf5))throw new Error(_0x59527c(0xf9)+_0x20c5aa+_0x59527c(0x101));return!![];}function loadProfilesFromTdxJson(_0x1eb54a,_0x5b443f){const _0xbc4242=a49_0x357e;if(!a49_0xe2638a[_0xbc4242(0xc7)](_0x1eb54a))return[];try{const _0x4b01c7=a49_0xe2638a[_0xbc4242(0xfd)](_0x1eb54a,_0xbc4242(0xc8)),_0x52c268=JSON[_0xbc4242(0xbe)](_0x4b01c7);if(!_0x52c268[_0xbc4242(0xeb)]||typeof _0x52c268[_0xbc4242(0xeb)]!==_0xbc4242(0xe2))return[];const _0x38880f=[];for(const [_0x4f972e,_0x46b7ba]of Object['entries'](_0x52c268['profiles'])){try{validateProfileConfig(_0x46b7ba,_0x4f972e);const _0x597854=getNewCredentialPath(_0x4f972e),_0x6b33c9=getOldCredentialPath(_0x4f972e),_0x3a92e0=a49_0xe2638a['existsSync'](_0x597854)||a49_0xe2638a[_0xbc4242(0xc7)](_0x6b33c9);_0x38880f[_0xbc4242(0xc5)]({'name':_0x4f972e,'config':_0x46b7ba,'metadata':{'name':_0x4f972e,'createdAt':new Date()[_0xbc4242(0xfa)]()},'hasCredentials':_0x3a92e0,'scope':_0x5b443f});}catch(_0x27fb18){_0x27fb18 instanceof Error&&(console[_0xbc4242(0xf3)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x1eb54a+':'),console[_0xbc4242(0xf3)]('\x20\x20'+_0x27fb18[_0xbc4242(0x100)]+'\x0a'));}}return _0x38880f;}catch(_0x114dd4){return _0x114dd4 instanceof SyntaxError?(console['warn'](_0xbc4242(0xe8)+_0x1eb54a+_0xbc4242(0xcb)),console[_0xbc4242(0xf3)](_0xbc4242(0xcc)+_0x114dd4[_0xbc4242(0x100)]+'\x0a')):console['warn'](_0xbc4242(0xe6)+_0x1eb54a+':\x20'+_0x114dd4+'\x0a'),[];}}export function getNewCredentialPath(_0x2c334a){const _0x2a3465=a49_0x357e;return a49_0x2921d2[_0x2a3465(0x102)](getConfigDir(),_0x2a3465(0xc0)+_0x2c334a);}function getOldCredentialPath(_0x25a69d){const _0x22caf5=a49_0x357e;return a49_0x2921d2[_0x22caf5(0x102)](getProfilesDir(),_0x25a69d,_0x22caf5(0xff));}function loadProfilesFromTdxJsonFiles(){const _0x353a98=a49_0x357e,_0xa37e39=[],_0x1d943a=findProjectConfigPath();_0x1d943a&&_0xa37e39[_0x353a98(0xc5)](...loadProfilesFromTdxJson(_0x1d943a,_0x353a98(0xe7)));const _0x112d5=a49_0x2921d2[_0x353a98(0x102)](getConfigDir(),_0x353a98(0xd1));return _0xa37e39[_0x353a98(0xc5)](...loadProfilesFromTdxJson(_0x112d5,'user')),_0xa37e39;}function loadProfilesFromDirectories(){const _0x376a61=a49_0x357e,_0x117916=getProfilesDir();if(!a49_0xe2638a[_0x376a61(0xc7)](_0x117916))return[];try{return a49_0xe2638a[_0x376a61(0xcd)](_0x117916,{'withFileTypes':!![]})[_0x376a61(0xc9)](_0x450d29=>_0x450d29[_0x376a61(0xe4)]())[_0x376a61(0xd4)](_0xdcb1dc=>_0xdcb1dc[_0x376a61(0xfe)])[_0x376a61(0xc9)](_0x5ce62f=>{const _0x317d7a=_0x376a61,_0x2acc5c=getProfileConfigPath(_0x5ce62f),_0x5f4317=getProfileEnvPath(_0x5ce62f);return a49_0xe2638a[_0x317d7a(0xc7)](_0x2acc5c)||a49_0xe2638a[_0x317d7a(0xc7)](_0x5f4317);})['map'](_0x5d73e7=>{const _0x565989=_0x376a61,_0x1973d1=loadProfileFromDirectory(_0x5d73e7);if(_0x1973d1)return{..._0x1973d1,'scope':_0x565989(0xce)};return null;})[_0x376a61(0xc9)](_0x2c83d3=>_0x2c83d3!==null);}catch{return[];}}function loadProfileFromDirectory(_0x5cca35){const _0x4eadaf=a49_0x357e,_0x138e61=getProfileConfigPath(_0x5cca35),_0x129ea8=getOldCredentialPath(_0x5cca35);if(!a49_0xe2638a[_0x4eadaf(0xc7)](_0x138e61)&&!a49_0xe2638a[_0x4eadaf(0xc7)](_0x129ea8))return null;let _0x1b4ec0={},_0xffe6eb={'name':_0x5cca35,'createdAt':new Date()[_0x4eadaf(0xfa)]()};if(a49_0xe2638a[_0x4eadaf(0xc7)](_0x138e61))try{const _0x5e82d1=a49_0xe2638a[_0x4eadaf(0xfd)](_0x138e61,_0x4eadaf(0xc8)),_0x9b2c2f=JSON[_0x4eadaf(0xbe)](_0x5e82d1),{metadata:_0x3d88d5,..._0x1047c5}=_0x9b2c2f;_0x1b4ec0=_0x1047c5,_0x3d88d5&&(_0xffe6eb=_0x3d88d5);}catch{}return{'name':_0x5cca35,'config':_0x1b4ec0,'metadata':_0xffe6eb,'hasCredentials':a49_0xe2638a[_0x4eadaf(0xc7)](_0x129ea8),'scope':'directory'};}export function listProfiles(){const _0x8d99e1=a49_0x357e,_0x2ef5a4=loadProfilesFromTdxJsonFiles(),_0xa6e2ac=loadProfilesFromDirectories();if(_0xa6e2ac[_0x8d99e1(0xc3)]>0x0){const _0x38d1c2=_0xa6e2ac[_0x8d99e1(0xd4)](_0x13628d=>_0x13628d[_0x8d99e1(0xfe)])['join'](',\x20'),_0x96e046=getConfigDir();console[_0x8d99e1(0xf3)](_0x8d99e1(0xcf)+_0x38d1c2),console[_0x8d99e1(0xf3)]('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x8d99e1(0xf3)](_0x8d99e1(0xd0)+a49_0x2921d2[_0x8d99e1(0x102)](_0x96e046,_0x8d99e1(0xd1))),console[_0x8d99e1(0xf3)](_0x8d99e1(0xdd)),console[_0x8d99e1(0xf3)](_0x8d99e1(0xda));}const _0x5781fe=[..._0x2ef5a4,..._0xa6e2ac],_0x255f27=new Map();for(const _0xb64519 of _0x5781fe){!_0x255f27[_0x8d99e1(0xe1)](_0xb64519[_0x8d99e1(0xfe)])&&_0x255f27['set'](_0xb64519[_0x8d99e1(0xfe)],_0xb64519);}return Array['from'](_0x255f27[_0x8d99e1(0xec)]())['sort']((_0x5b6eff,_0x4be777)=>_0x5b6eff[_0x8d99e1(0xfe)][_0x8d99e1(0xf7)](_0x4be777[_0x8d99e1(0xfe)]));}export function profileExists(_0x703be0){const _0x563da7=a49_0x357e,_0x271a3f=listProfiles();return _0x271a3f[_0x563da7(0xd7)](_0x38078a=>_0x38078a[_0x563da7(0xfe)]===_0x703be0);}export function loadProfile(_0x65c43e){const _0x553f4f=a49_0x357e;validateProfileName(_0x65c43e);const _0x3bd7ce=listProfiles(),_0x5c8f34=_0x3bd7ce['find'](_0x33426a=>_0x33426a[_0x553f4f(0xfe)]===_0x65c43e);return _0x5c8f34||null;}export function saveProfile(_0x22edde,_0x3f7656,_0x9970a=![]){saveProfileToUserConfig(_0x22edde,_0x3f7656);}export function deleteProfile(_0x156e85){const _0x483f6b=a49_0x357e;validateProfileName(_0x156e85);const _0x20da41=getProfileDir(_0x156e85);if(!a49_0xe2638a['existsSync'](_0x20da41))throw new Error(_0x483f6b(0xd6)+_0x156e85+_0x483f6b(0xef));a49_0xe2638a[_0x483f6b(0xdf)](_0x20da41,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x31ec21,_0x57803c){const _0x7c5a56=a49_0x357e;validateProfileName(_0x31ec21);const _0x8cf8c6=getGlobalConfigPath(),_0x35fc73=getConfigDir();!a49_0xe2638a[_0x7c5a56(0xc7)](_0x35fc73)&&createSecureDirectory(_0x35fc73);let _0x3b6b59={};if(a49_0xe2638a[_0x7c5a56(0xc7)](_0x8cf8c6))try{const _0x3a1f43=a49_0xe2638a[_0x7c5a56(0xfd)](_0x8cf8c6,_0x7c5a56(0xc8));_0x3b6b59=JSON[_0x7c5a56(0xbe)](_0x3a1f43);}catch{console['warn'](_0x7c5a56(0xd2)+_0x8cf8c6+',\x20creating\x20new\x20file');}!_0x3b6b59[_0x7c5a56(0xeb)]&&(_0x3b6b59[_0x7c5a56(0xeb)]={}),_0x3b6b59[_0x7c5a56(0xeb)][_0x31ec21]=_0x57803c,writeSecureFile(_0x8cf8c6,JSON['stringify'](_0x3b6b59,null,0x2));}export function getActiveProfile(){const _0x5076bf=a49_0x357e,_0x2626ca=loadSessionContext();if(_0x2626ca?.['profile'])return _0x2626ca[_0x5076bf(0xea)];const _0x2444a6=getGlobalConfigPath();if(!a49_0xe2638a[_0x5076bf(0xc7)](_0x2444a6))return null;try{const _0xc6fe64=a49_0xe2638a[_0x5076bf(0xfd)](_0x2444a6,_0x5076bf(0xc8)),_0x4f87d9=JSON[_0x5076bf(0xbe)](_0xc6fe64);return _0x4f87d9[_0x5076bf(0xea)]||null;}catch{return null;}}export function createProfile(_0x4fdd12,_0x19d1cc){const _0xb4216c=a49_0x357e;validateProfileName(_0x4fdd12);if(profileExists(_0x4fdd12))throw new Error(_0xb4216c(0xd6)+_0x4fdd12+_0xb4216c(0xc6));saveProfile(_0x4fdd12,_0x19d1cc);}export function saveProfileCredentials(_0x58a355,_0x58d9ce){const _0x5947b0=a49_0x357e;validateProfileName(_0x58a355);if(!profileExists(_0x58a355))throw new Error(_0x5947b0(0xd6)+_0x58a355+'\x20does\x20not\x20exist');const _0x3cdeb2=getNewCredentialPath(_0x58a355);writeSecureFile(_0x3cdeb2,_0x58d9ce);}export function loadProfileCredentials(_0x1be04d){const _0x438b3d=a49_0x357e;validateProfileName(_0x1be04d);const _0x2c08ed=getNewCredentialPath(_0x1be04d);if(a49_0xe2638a[_0x438b3d(0xc7)](_0x2c08ed))try{return a49_0xe2638a[_0x438b3d(0xfd)](_0x2c08ed,_0x438b3d(0xc8));}catch{}const _0xe58d5c=getOldCredentialPath(_0x1be04d);if(a49_0xe2638a[_0x438b3d(0xc7)](_0xe58d5c)){console[_0x438b3d(0xf3)](_0x438b3d(0xfc)+_0x1be04d+'\x27'),console[_0x438b3d(0xf3)](_0x438b3d(0xed)),console[_0x438b3d(0xf3)](_0x438b3d(0xbf)+_0xe58d5c+_0x438b3d(0xf0)+_0x2c08ed+'\x22'),console[_0x438b3d(0xf3)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a49_0xe2638a[_0x438b3d(0xfd)](_0xe58d5c,_0x438b3d(0xc8));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- const a50_0x117126=a50_0x5a7c;(function(_0x58349f,_0x18ea5f){const _0x37c259=a50_0x5a7c,_0x4a824b=_0x58349f();while(!![]){try{const _0x51607e=parseInt(_0x37c259(0xb7))/0x1*(parseInt(_0x37c259(0xa6))/0x2)+-parseInt(_0x37c259(0xa5))/0x3+-parseInt(_0x37c259(0xaf))/0x4+parseInt(_0x37c259(0xb2))/0x5+parseInt(_0x37c259(0xb9))/0x6*(parseInt(_0x37c259(0xa0))/0x7)+-parseInt(_0x37c259(0xac))/0x8+parseInt(_0x37c259(0xad))/0x9;if(_0x51607e===_0x18ea5f)break;else _0x4a824b['push'](_0x4a824b['shift']());}catch(_0x4014a9){_0x4a824b['push'](_0x4a824b['shift']());}}}(a50_0x3b6a,0x900de));import*as a50_0x41e4e8 from'node:fs';function a50_0x3b6a(){const _0xbc7f5a=[').\x20','dirname','cwd','utf-8','6868736owkyBa','19592595DjUavS','existsSync','2883344OXPaMW','apiKey','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','3411350rvLEYc','profile','tdx.json','Failed\x20to\x20load\x20project\x20config\x20from\x20','stringify','2uGcnkL','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','6LjBbgD','warn','readFileSync','1259671cRVhDb','api_key','join','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','TD_API_KEY','3141924xEpMed','177604kpucCN','includes'];a50_0x3b6a=function(){return _0xbc7f5a;};return a50_0x3b6a();}function a50_0x5a7c(_0x54c53c,_0x128561){_0x54c53c=_0x54c53c-0x9e;const _0x3b6a08=a50_0x3b6a();let _0x5a7cbd=_0x3b6a08[_0x54c53c];return _0x5a7cbd;}import*as a50_0x53d2a3 from'node:path';const PROJECT_CONFIG_FILENAME=a50_0x117126(0xb4);export function findProjectConfigPath(_0x2cedec){const _0x38ba50=a50_0x117126;let _0x503cca=_0x2cedec||process[_0x38ba50(0xaa)]();while(!![]){const _0x3fe52c=a50_0x53d2a3['join'](_0x503cca,PROJECT_CONFIG_FILENAME);if(a50_0x41e4e8[_0x38ba50(0xae)](_0x3fe52c))return _0x3fe52c;const _0x55fdd8=a50_0x53d2a3[_0x38ba50(0xa9)](_0x503cca);if(_0x55fdd8===_0x503cca)return null;_0x503cca=_0x55fdd8;}}export function loadProjectConfig(_0x5b5f7e){const _0x3b0bbd=a50_0x117126,_0x4a0469=findProjectConfigPath(_0x5b5f7e);if(!_0x4a0469)return null;try{const _0x396ce6=a50_0x41e4e8[_0x3b0bbd(0x9f)](_0x4a0469,_0x3b0bbd(0xab)),_0x256c6b=JSON['parse'](_0x396ce6),_0x3fd1ba=JSON['stringify'](_0x256c6b);if(_0x3fd1ba[_0x3b0bbd(0xa7)](_0x3b0bbd(0xa4))||_0x3fd1ba[_0x3b0bbd(0xa7)]('apiKey')||_0x3fd1ba[_0x3b0bbd(0xa7)](_0x3b0bbd(0xa1)))throw new Error(_0x3b0bbd(0xa3)+_0x4a0469+_0x3b0bbd(0xa8)+_0x3b0bbd(0xb1));const {metadata:_0x4e8752,profile:_0x255590,..._0x131e17}=_0x256c6b;return _0x255590&&console[_0x3b0bbd(0x9e)]('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x4a0469+'\x20is\x20ignored.\x20'+_0x3b0bbd(0xb8)),_0x131e17;}catch(_0x495c7d){if(_0x495c7d instanceof Error&&'code'in _0x495c7d&&_0x495c7d['code']==='ENOENT')return null;throw new Error(_0x3b0bbd(0xb5)+_0x4a0469+':\x20'+_0x495c7d);}}export function saveProjectConfig(_0x3e93dc,_0x22c784){const _0x52b9d3=a50_0x117126,_0x4f6d9a=_0x22c784||process[_0x52b9d3(0xaa)](),_0xe78f91=a50_0x53d2a3[_0x52b9d3(0xa2)](_0x4f6d9a,PROJECT_CONFIG_FILENAME),_0x427746=JSON[_0x52b9d3(0xb6)](_0x3e93dc);if(_0x427746['includes'](_0x52b9d3(0xa4))||_0x427746['includes'](_0x52b9d3(0xb0))||_0x427746['includes'](_0x52b9d3(0xa1)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x52b9d3(0xb3)in _0x3e93dc)throw new Error('\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.');a50_0x41e4e8['writeFileSync'](_0xe78f91,JSON[_0x52b9d3(0xb6)](_0x3e93dc,null,0x2));}export function hasProjectConfig(_0x67c06){return findProjectConfigPath(_0x67c06)!==null;}export function getProjectRoot(_0x3f423f){const _0x258b6c=a50_0x117126,_0x2e1597=findProjectConfigPath(_0x3f423f);return _0x2e1597?a50_0x53d2a3[_0x258b6c(0xa9)](_0x2e1597):null;}
1
+ const a50_0x46fd55=a50_0x4573;(function(_0x2528b6,_0x4f47c7){const _0x33d55a=a50_0x4573,_0x2fddc9=_0x2528b6();while(!![]){try{const _0x29a326=-parseInt(_0x33d55a(0xd5))/0x1+parseInt(_0x33d55a(0xe2))/0x2*(-parseInt(_0x33d55a(0xe3))/0x3)+parseInt(_0x33d55a(0xd2))/0x4+-parseInt(_0x33d55a(0xda))/0x5+parseInt(_0x33d55a(0xd7))/0x6*(-parseInt(_0x33d55a(0xde))/0x7)+-parseInt(_0x33d55a(0xe6))/0x8*(parseInt(_0x33d55a(0xdf))/0x9)+parseInt(_0x33d55a(0xed))/0xa;if(_0x29a326===_0x4f47c7)break;else _0x2fddc9['push'](_0x2fddc9['shift']());}catch(_0x2457b4){_0x2fddc9['push'](_0x2fddc9['shift']());}}}(a50_0x4992,0x45fc4));import*as a50_0x3d6b14 from'node:fs';import*as a50_0x5a5b01 from'node:path';const PROJECT_CONFIG_FILENAME=a50_0x46fd55(0xdb);export function findProjectConfigPath(_0x4a2ed4){const _0x2fb740=a50_0x46fd55;let _0x102648=_0x4a2ed4||process[_0x2fb740(0xe8)]();while(!![]){const _0x5a151a=a50_0x5a5b01['join'](_0x102648,PROJECT_CONFIG_FILENAME);if(a50_0x3d6b14['existsSync'](_0x5a151a))return _0x5a151a;const _0x224adf=a50_0x5a5b01['dirname'](_0x102648);if(_0x224adf===_0x102648)return null;_0x102648=_0x224adf;}}function a50_0x4573(_0x2e614e,_0x5a843f){_0x2e614e=_0x2e614e-0xcf;const _0x4992ab=a50_0x4992();let _0x457324=_0x4992ab[_0x2e614e];return _0x457324;}export function loadProjectConfig(_0x1eb3ad){const _0x43d906=a50_0x46fd55,_0x5ac10d=findProjectConfigPath(_0x1eb3ad);if(!_0x5ac10d)return null;try{const _0x129b24=a50_0x3d6b14['readFileSync'](_0x5ac10d,_0x43d906(0xd1)),_0x27909a=JSON[_0x43d906(0xee)](_0x129b24),_0x234dc1=JSON['stringify'](_0x27909a);if(_0x234dc1['includes'](_0x43d906(0xd0))||_0x234dc1['includes'](_0x43d906(0xec))||_0x234dc1[_0x43d906(0xcf)](_0x43d906(0xd9)))throw new Error(_0x43d906(0xe0)+_0x5ac10d+').\x20'+_0x43d906(0xe9));const {metadata:_0x520b43,profile:_0x3ef58d,..._0x3ed7c8}=_0x27909a;return _0x3ef58d&&console[_0x43d906(0xe4)](_0x43d906(0xe5)+_0x5ac10d+_0x43d906(0xd6)+_0x43d906(0xeb)),_0x3ed7c8;}catch(_0x3c2475){if(_0x3c2475 instanceof Error&&_0x43d906(0xe7)in _0x3c2475&&_0x3c2475[_0x43d906(0xe7)]===_0x43d906(0xd3))return null;throw new Error(_0x43d906(0xd4)+_0x5ac10d+':\x20'+_0x3c2475);}}export function saveProjectConfig(_0x41f75e,_0x3d419a){const _0x223bb5=a50_0x46fd55,_0x5d15cb=_0x3d419a||process[_0x223bb5(0xe8)](),_0x4406f9=a50_0x5a5b01['join'](_0x5d15cb,PROJECT_CONFIG_FILENAME),_0x2417f7=JSON[_0x223bb5(0xdd)](_0x41f75e);if(_0x2417f7[_0x223bb5(0xcf)](_0x223bb5(0xd0))||_0x2417f7['includes'](_0x223bb5(0xec))||_0x2417f7[_0x223bb5(0xcf)](_0x223bb5(0xd9)))throw new Error(_0x223bb5(0xdc));if(_0x223bb5(0xd8)in _0x41f75e)throw new Error(_0x223bb5(0xe1));a50_0x3d6b14[_0x223bb5(0xea)](_0x4406f9,JSON[_0x223bb5(0xdd)](_0x41f75e,null,0x2));}export function hasProjectConfig(_0x1dfa7b){return findProjectConfigPath(_0x1dfa7b)!==null;}function a50_0x4992(){const _0x2587a2=['utf-8','317668IyMLTk','ENOENT','Failed\x20to\x20load\x20project\x20config\x20from\x20','242826NYqlag','\x20is\x20ignored.\x20','146502acBUOf','profile','api_key','2327300VAdHjD','tdx.json','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','stringify','91JUjVys','9hzvzdA','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','62yLKknS','31953vrfmVU','warn','Warning:\x20\x27profile\x27\x20field\x20in\x20','755176vnydSQ','code','cwd','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','writeFileSync','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','apiKey','16575280DKvDls','parse','includes','TD_API_KEY'];a50_0x4992=function(){return _0x2587a2;};return a50_0x4992();}export function getProjectRoot(_0x1edd95){const _0x343913=findProjectConfigPath(_0x1edd95);return _0x343913?a50_0x5a5b01['dirname'](_0x343913):null;}