@treasuredata/tdx 0.1.9 → 0.1.10

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 (76) hide show
  1. package/README.md +68 -0
  2. package/dist/cli.js +1 -1
  3. package/dist/cli.js.map +1 -1
  4. package/dist/client/cdp-client.js +1 -1
  5. package/dist/client/http-client.js +1 -1
  6. package/dist/client/llm-client.js +1 -1
  7. package/dist/client/rate-limiter.js +1 -1
  8. package/dist/client/td-client.js +1 -1
  9. package/dist/client/trino-client.js +1 -1
  10. package/dist/client/workflow-client.js +1 -1
  11. package/dist/commands/activations.js +1 -1
  12. package/dist/commands/api-command.js +1 -1
  13. package/dist/commands/chat-command.js +1 -1
  14. package/dist/commands/claude-command.d.ts +20 -0
  15. package/dist/commands/claude-command.d.ts.map +1 -0
  16. package/dist/commands/claude-command.js +1 -0
  17. package/dist/commands/claude-command.js.map +1 -0
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/context-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/describe.js +1 -1
  22. package/dist/commands/llm-command.js +1 -1
  23. package/dist/commands/llm-proxy.js +1 -1
  24. package/dist/commands/profiles-command.js +1 -1
  25. package/dist/commands/query-command.js +1 -1
  26. package/dist/commands/segment-command.js +1 -1
  27. package/dist/commands/segments.js +1 -1
  28. package/dist/commands/show.js +1 -1
  29. package/dist/commands/tables.js +1 -1
  30. package/dist/commands/use-command.js +1 -1
  31. package/dist/commands/workflow-command.js +1 -1
  32. package/dist/core/auth.js +1 -1
  33. package/dist/core/config.js +1 -1
  34. package/dist/core/global-context.js +1 -1
  35. package/dist/core/profile.js +1 -1
  36. package/dist/core/project-config.js +1 -1
  37. package/dist/core/session.js +1 -1
  38. package/dist/index.js +1 -1
  39. package/dist/proxy/anthropic-adapter.js +1 -1
  40. package/dist/proxy/server.js +1 -1
  41. package/dist/sdk/api.js +1 -1
  42. package/dist/sdk/database.js +1 -1
  43. package/dist/sdk/errors.d.ts +2 -0
  44. package/dist/sdk/errors.d.ts.map +1 -1
  45. package/dist/sdk/errors.js +1 -1
  46. package/dist/sdk/errors.js.map +1 -1
  47. package/dist/sdk/index.js +1 -1
  48. package/dist/sdk/llm.js +1 -1
  49. package/dist/sdk/query.js +1 -1
  50. package/dist/sdk/segment.js +1 -1
  51. package/dist/sdk/table.js +1 -1
  52. package/dist/sdk/workflow.js +1 -1
  53. package/dist/types/endpoints.js +1 -1
  54. package/dist/types/index.js +1 -1
  55. package/dist/utils/agent-ref-parser.js +1 -1
  56. package/dist/utils/chat-cache.js +1 -1
  57. package/dist/utils/colors.js +1 -1
  58. package/dist/utils/command-output.js +1 -1
  59. package/dist/utils/file-permissions.js +1 -1
  60. package/dist/utils/format-detector.js +1 -1
  61. package/dist/utils/formatters.js +1 -1
  62. package/dist/utils/model-aliases.js +1 -1
  63. package/dist/utils/option-validation.js +1 -1
  64. package/dist/utils/port.d.ts +18 -0
  65. package/dist/utils/port.d.ts.map +1 -0
  66. package/dist/utils/port.js +1 -0
  67. package/dist/utils/port.js.map +1 -0
  68. package/dist/utils/process.js +1 -1
  69. package/dist/utils/segment-ref-parser.js +1 -1
  70. package/dist/utils/spinner.js +1 -1
  71. package/dist/utils/sql-parser.js +1 -1
  72. package/dist/utils/sse-parser.js +1 -1
  73. package/dist/utils/string-utils.js +1 -1
  74. package/dist/utils/table-ref-parser.js +1 -1
  75. package/dist/utils/workflow-utils.js +1 -1
  76. package/package.json +1 -1
@@ -1 +1 @@
1
- const a24_0xbb13ff=a24_0x3903;(function(_0x4a6012,_0x3671db){const _0x45e3e7=a24_0x3903,_0x3f086d=_0x4a6012();while(!![]){try{const _0x155dcf=parseInt(_0x45e3e7(0x116))/0x1*(-parseInt(_0x45e3e7(0x12a))/0x2)+-parseInt(_0x45e3e7(0x15f))/0x3+-parseInt(_0x45e3e7(0x11c))/0x4*(-parseInt(_0x45e3e7(0x130))/0x5)+-parseInt(_0x45e3e7(0x13d))/0x6+parseInt(_0x45e3e7(0x149))/0x7+-parseInt(_0x45e3e7(0x141))/0x8+-parseInt(_0x45e3e7(0x15d))/0x9*(-parseInt(_0x45e3e7(0x121))/0xa);if(_0x155dcf===_0x3671db)break;else _0x3f086d['push'](_0x3f086d['shift']());}catch(_0x3020c3){_0x3f086d['push'](_0x3f086d['shift']());}}}(a24_0x5703,0x9f958));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import*as a24_0xbefb4a from'readline';async function confirm(_0x6c66c1){const _0x226d1f=a24_0x3903,_0x56d898=a24_0xbefb4a[_0x226d1f(0x153)]({'input':process[_0x226d1f(0x12e)],'output':process[_0x226d1f(0x16e)]});return new Promise(_0x45d48b=>{const _0x32cc74=_0x226d1f;_0x56d898[_0x32cc74(0x13e)](_0x6c66c1+'\x20(y/N):\x20',_0x14be9c=>{const _0x5540b9=_0x32cc74;_0x56d898[_0x5540b9(0x165)](),_0x45d48b(_0x14be9c[_0x5540b9(0x167)]()==='y'||_0x14be9c[_0x5540b9(0x167)]()===_0x5540b9(0x13c));});});}export class WorkflowProjectsCommand extends BaseCommand{[a24_0xbb13ff(0x100)]='workflow:projects';[a24_0xbb13ff(0x103)]=a24_0xbb13ff(0x15b);async['execute'](_0x724ef9){const _0x24d074=a24_0xbb13ff,{options:_0x4bb825,args:_0x483f1f,tdx:_0xd3cc5a}=_0x724ef9,_0x2ed0e2=_0x483f1f[0x0];try{_0x4bb825[_0x24d074(0x14e)]&&_0x2ed0e2&&console['error'](_0x24d074(0x109)+_0x2ed0e2);const _0x23aee6=await withSpinner('Listing\x20workflow\x20projects...',()=>_0xd3cc5a['workflow'][_0x24d074(0x173)](_0x2ed0e2,{'limit':_0x4bb825['limit']}),{'verbose':_0x4bb825['verbose']}),_0x119128=_0x23aee6['data'];return console['error'](_0x24d074(0x10c)+_0x119128[_0x24d074(0x120)]+_0x24d074(0x177)+(_0x119128[_0x24d074(0x120)]!==0x1?'s':'')),await handleSDKOutput(_0x119128,_0x4bb825),0x0;}catch(_0x45ed83){if(_0x45ed83 instanceof SDKError)return console['error'](_0x24d074(0x145)+_0x45ed83[_0x24d074(0x174)]),_0x45ed83[_0x24d074(0x11e)]&&console[_0x24d074(0x10d)](_0x24d074(0x136)+_0x45ed83[_0x24d074(0x11e)]),0x1;throw _0x45ed83;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a24_0xbb13ff(0x100)]=a24_0xbb13ff(0x164);['description']=a24_0xbb13ff(0x12d);async[a24_0xbb13ff(0x10e)](_0x272cdf){const _0x3053f7=a24_0xbb13ff,{options:_0xa7f249,args:_0x4c1dab,tdx:_0x1290b2}=_0x272cdf,_0x4f2bc1=_0x4c1dab[0x0];try{_0xa7f249[_0x3053f7(0x14e)]&&_0x4f2bc1&&console[_0x3053f7(0x10d)](_0x3053f7(0x163)+_0x4f2bc1);const _0x47e69b=await withSpinner(_0x3053f7(0x158),()=>_0x1290b2['workflow'][_0x3053f7(0x10f)](_0x4f2bc1,{'limit':_0xa7f249['limit']}),{'verbose':_0xa7f249[_0x3053f7(0x14e)]}),_0x34d34b=_0x47e69b['data'];return console['error'](_0x3053f7(0x10c)+_0x34d34b[_0x3053f7(0x120)]+_0x3053f7(0x13f)+(_0x34d34b[_0x3053f7(0x120)]!==0x1?'s':'')),await handleSDKOutput(_0x34d34b,_0xa7f249),0x0;}catch(_0x172309){if(_0x172309 instanceof SDKError)return console[_0x3053f7(0x10d)](_0x3053f7(0x145)+_0x172309[_0x3053f7(0x174)]),_0x172309['cause']&&console[_0x3053f7(0x10d)](_0x3053f7(0x136)+_0x172309[_0x3053f7(0x11e)]),0x1;throw _0x172309;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']='workflow:sessions';['description']=a24_0xbb13ff(0x17c);async[a24_0xbb13ff(0x10e)](_0x3e2628){const _0x569af2=a24_0xbb13ff,{options:_0x28515b,args:_0x5ba3d,tdx:_0x1482a4}=_0x3e2628;let _0x41a3a4,_0x146be3;if(_0x5ba3d[0x0]){const _0x4ede05=_0x5ba3d[0x0][_0x569af2(0x101)]('.');if(_0x4ede05[_0x569af2(0x120)]===0x1)_0x41a3a4=_0x4ede05[0x0];else{if(_0x4ede05['length']===0x2)[_0x41a3a4,_0x146be3]=_0x4ede05;else return console[_0x569af2(0x10d)](_0x569af2(0x171)),0x1;}}try{if(_0x28515b[_0x569af2(0x14e)]){if(_0x41a3a4&&_0x146be3)console[_0x569af2(0x10d)](_0x569af2(0x178)+_0x41a3a4+'.'+_0x146be3);else _0x41a3a4&&console[_0x569af2(0x10d)](_0x569af2(0x112)+_0x41a3a4);const _0x281bfb=_0x28515b[_0x569af2(0x14b)];_0x281bfb&&console[_0x569af2(0x10d)]('Status:\x20'+_0x281bfb);}const _0x1b5c28=await withSpinner(_0x569af2(0x131),()=>_0x1482a4[_0x569af2(0x14d)]['sessions']({'projectName':_0x41a3a4,'workflowName':_0x146be3,'status':_0x28515b['status'],'fromTime':_0x28515b[_0x569af2(0x105)],'toTime':_0x28515b['to'],'limit':_0x28515b['limit']}),{'verbose':_0x28515b[_0x569af2(0x14e)]}),_0x261673=_0x1b5c28[_0x569af2(0x15c)];return console[_0x569af2(0x10d)](_0x569af2(0x10c)+_0x261673[_0x569af2(0x120)]+_0x569af2(0x129)+(_0x261673[_0x569af2(0x120)]!==0x1?'s':'')),await handleSDKOutput(_0x261673,_0x28515b),0x0;}catch(_0x49bfc5){if(_0x49bfc5 instanceof SDKError)return console['error'](_0x569af2(0x145)+_0x49bfc5[_0x569af2(0x174)]),_0x49bfc5['cause']&&console[_0x569af2(0x10d)](_0x569af2(0x136)+_0x49bfc5[_0x569af2(0x11e)]),0x1;throw _0x49bfc5;}}}export class WorkflowAttemptsCommand extends BaseCommand{['name']=a24_0xbb13ff(0xfc);[a24_0xbb13ff(0x103)]='List\x20workflow\x20attempts';async[a24_0xbb13ff(0x10e)](_0xcb8078){const _0x253156=a24_0xbb13ff,{options:_0x531818,args:_0x2ac4e4,tdx:_0x2e3d4f}=_0xcb8078;let _0x4c3123,_0x2ce65a;if(_0x2ac4e4[0x0]){const _0x153aa4=_0x2ac4e4[0x0][_0x253156(0x101)]('.');if(_0x153aa4[_0x253156(0x120)]===0x1)_0x4c3123=_0x153aa4[0x0];else{if(_0x153aa4[_0x253156(0x120)]===0x2)[_0x4c3123,_0x2ce65a]=_0x153aa4;else return console[_0x253156(0x10d)](_0x253156(0x171)),0x1;}}try{const _0x504d15=_0x531818[_0x253156(0x114)];if(_0x531818[_0x253156(0x14e)]){if(_0x4c3123&&_0x2ce65a)console[_0x253156(0x10d)](_0x253156(0x178)+_0x4c3123+'.'+_0x2ce65a);else _0x4c3123&&console[_0x253156(0x10d)]('Filter:\x20project='+_0x4c3123);_0x504d15&&console[_0x253156(0x10d)](_0x253156(0x155));}const _0x53ee12=await withSpinner('Listing\x20workflow\x20attempts...',()=>_0x2e3d4f[_0x253156(0x14d)][_0x253156(0x104)]({'projectName':_0x4c3123,'workflowName':_0x2ce65a,'includeRetried':_0x504d15,'limit':_0x531818[_0x253156(0x11b)]}),{'verbose':_0x531818['verbose']}),_0x5aa78d=_0x53ee12['data'];return console[_0x253156(0x10d)](_0x253156(0x10c)+_0x5aa78d[_0x253156(0x120)]+_0x253156(0x12c)+(_0x5aa78d[_0x253156(0x120)]!==0x1?'s':'')),await handleSDKOutput(_0x5aa78d,_0x531818),0x0;}catch(_0xe0bce9){if(_0xe0bce9 instanceof SDKError)return console['error'](_0x253156(0x145)+_0xe0bce9[_0x253156(0x174)]),_0xe0bce9[_0x253156(0x11e)]&&console[_0x253156(0x10d)](_0x253156(0x136)+_0xe0bce9[_0x253156(0x11e)]),0x1;throw _0xe0bce9;}}}export class WorkflowAttemptCommand extends BaseCommand{[a24_0xbb13ff(0x100)]=a24_0xbb13ff(0x140);[a24_0xbb13ff(0x103)]=a24_0xbb13ff(0x172);async[a24_0xbb13ff(0x10e)](_0x5de7b9){const _0x3a24fe=a24_0xbb13ff,{options:_0x191d71,args:_0x3874ad,tdx:_0x23fa47}=_0x5de7b9,_0x412f23=_0x3874ad[0x0];if(!_0x412f23)return console[_0x3a24fe(0x10d)](_0x3a24fe(0x127)),0x1;try{_0x191d71[_0x3a24fe(0x14e)]&&console[_0x3a24fe(0x10d)](_0x3a24fe(0x176)+_0x412f23);const _0x209650=await withSpinner('Getting\x20attempt\x20details...',()=>_0x23fa47[_0x3a24fe(0x14d)][_0x3a24fe(0x160)](_0x412f23),{'verbose':_0x191d71[_0x3a24fe(0x14e)]}),_0x51a861=_0x209650[_0x3a24fe(0x15c)];return await handleSDKOutput([_0x51a861],_0x191d71),0x0;}catch(_0x111955){if(_0x111955 instanceof SDKError)return console['error'](_0x3a24fe(0x145)+_0x111955[_0x3a24fe(0x174)]),_0x111955['cause']&&console['error'](_0x3a24fe(0x136)+_0x111955['cause']),0x1;throw _0x111955;}}}export class WorkflowTasksCommand extends BaseCommand{[a24_0xbb13ff(0x100)]='workflow:tasks';[a24_0xbb13ff(0x103)]=a24_0xbb13ff(0x170);async[a24_0xbb13ff(0x10e)](_0x7d9ffb){const _0x568f3b=a24_0xbb13ff,{options:_0x557b85,args:_0x305509,tdx:_0x1255bd}=_0x7d9ffb,_0xa581e6=_0x305509[0x0];if(!_0xa581e6)return console[_0x568f3b(0x10d)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x147052=_0x557b85[_0x568f3b(0x157)];_0x557b85[_0x568f3b(0x14e)]&&(console[_0x568f3b(0x10d)](_0x568f3b(0x176)+_0xa581e6),_0x147052&&console[_0x568f3b(0x10d)](_0x568f3b(0x181)));const _0x52ed2b=await withSpinner(_0x568f3b(0x133),()=>_0x1255bd[_0x568f3b(0x14d)]['tasks'](_0xa581e6,_0x147052||![]),{'verbose':_0x557b85[_0x568f3b(0x14e)]}),_0x348997=_0x52ed2b[_0x568f3b(0x15c)];return console[_0x568f3b(0x10d)](_0x568f3b(0x10c)+_0x348997['length']+_0x568f3b(0x15e)+(_0x348997[_0x568f3b(0x120)]!==0x1?'s':'')),await handleSDKOutput(_0x348997,_0x557b85),0x0;}catch(_0x30b273){if(_0x30b273 instanceof SDKError)return console[_0x568f3b(0x10d)](_0x568f3b(0x145)+_0x30b273[_0x568f3b(0x174)]),_0x30b273[_0x568f3b(0x11e)]&&console['error'](_0x568f3b(0x136)+_0x30b273[_0x568f3b(0x11e)]),0x1;throw _0x30b273;}}}function a24_0x3903(_0x12f4d4,_0x481055){const _0x5703f2=a24_0x5703();return a24_0x3903=function(_0x390352,_0x35f513){_0x390352=_0x390352-0xfc;let _0xea08c3=_0x5703f2[_0x390352];return _0xea08c3;},a24_0x3903(_0x12f4d4,_0x481055);}export class WorkflowLogsCommand extends BaseCommand{[a24_0xbb13ff(0x100)]=a24_0xbb13ff(0x15a);[a24_0xbb13ff(0x103)]=a24_0xbb13ff(0x166);async['execute'](_0x229cc4){const _0xe0bd56=a24_0xbb13ff,{options:_0x3a5d33,args:_0x1fa17b,tdx:_0x781212}=_0x229cc4,_0x2f0f3c=_0x1fa17b[0x0],_0x3feba1=_0x1fa17b[0x1];if(!_0x2f0f3c||!_0x3feba1)return console[_0xe0bd56(0x10d)](_0xe0bd56(0x151)),0x1;try{_0x3a5d33[_0xe0bd56(0x14e)]&&(console[_0xe0bd56(0x10d)]('Attempt\x20ID:\x20'+_0x2f0f3c),console[_0xe0bd56(0x10d)](_0xe0bd56(0x148)+_0x3feba1));const _0x1cf878=_0x3a5d33[_0xe0bd56(0x119)],_0x52e450=await withSpinner('Getting\x20task\x20logs...',()=>_0x781212['workflow'][_0xe0bd56(0x137)](_0x2f0f3c,_0x3feba1,{'offset':_0x1cf878,'limit':_0x3a5d33['limit']}),{'verbose':_0x3a5d33[_0xe0bd56(0x14e)]}),_0xffc504=_0x52e450[_0xe0bd56(0x15c)];return console['error'](_0xe0bd56(0x10c)+_0xffc504[_0xe0bd56(0x120)]+'\x20log\x20entr'+(_0xffc504[_0xe0bd56(0x120)]!==0x1?_0xe0bd56(0x111):'y')),await handleSDKOutput(_0xffc504,_0x3a5d33),0x0;}catch(_0x5ad06c){if(_0x5ad06c instanceof SDKError)return console[_0xe0bd56(0x10d)](_0xe0bd56(0x145)+_0x5ad06c['message']),_0x5ad06c[_0xe0bd56(0x11e)]&&console[_0xe0bd56(0x10d)]('\x20\x20Cause:\x20'+_0x5ad06c[_0xe0bd56(0x11e)]),0x1;throw _0x5ad06c;}}}export class WorkflowKillCommand extends BaseCommand{[a24_0xbb13ff(0x100)]='workflow:kill';['description']=a24_0xbb13ff(0x11d);async[a24_0xbb13ff(0x10e)](_0x39074c){const _0x4a5fff=a24_0xbb13ff,{options:_0x5e00a2,args:_0x1f952f,tdx:_0x148949}=_0x39074c,_0x1fb66b=_0x1f952f[0x0];if(!_0x1fb66b)return console[_0x4a5fff(0x10d)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x2a81dd=_0x5e00a2[_0x4a5fff(0x14a)];_0x5e00a2[_0x4a5fff(0x14e)]&&(console[_0x4a5fff(0x10d)](_0x4a5fff(0x176)+_0x1fb66b),_0x2a81dd&&console[_0x4a5fff(0x10d)](_0x4a5fff(0x138)+_0x2a81dd));if(!_0x5e00a2[_0x4a5fff(0x13c)]){const _0x541189=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20'+_0x1fb66b+'?');if(!_0x541189)return console['error'](_0x4a5fff(0x17f)),0x0;}const _0x3fd6e5=await withSpinner(_0x4a5fff(0x124),()=>_0x148949['workflow'][_0x4a5fff(0x150)](_0x1fb66b,_0x2a81dd),{'verbose':_0x5e00a2['verbose']}),_0x5e60e9=_0x3fd6e5[_0x4a5fff(0x15c)];return console['error']('✔\x20'+_0x5e60e9),0x0;}catch(_0x53b884){if(_0x53b884 instanceof SDKError)return console[_0x4a5fff(0x10d)](_0x4a5fff(0x145)+_0x53b884[_0x4a5fff(0x174)]),_0x53b884['cause']&&console[_0x4a5fff(0x10d)]('\x20\x20Cause:\x20'+_0x53b884[_0x4a5fff(0x11e)]),0x1;throw _0x53b884;}}}export class WorkflowRetryCommand extends BaseCommand{['name']=a24_0xbb13ff(0xfe);[a24_0xbb13ff(0x103)]=a24_0xbb13ff(0x13b);async[a24_0xbb13ff(0x10e)](_0x1140c7){const _0x3bbd55=a24_0xbb13ff,{options:_0x4847ad,args:_0x381d77,tdx:_0x15bfe7}=_0x1140c7,_0x4618bb=_0x381d77[0x0];if(!_0x4618bb)return console[_0x3bbd55(0x10d)](_0x3bbd55(0x17e)),console[_0x3bbd55(0x10d)](_0x3bbd55(0x122)),0x1;let _0x38249d=![],_0xc1d20a=_0x4618bb;if(_0x4618bb[_0x3bbd55(0x143)](_0x3bbd55(0x16c)))_0x38249d=!![],_0xc1d20a=_0x4618bb[_0x3bbd55(0x11f)](0x8);else{if(_0x4618bb['startsWith']('attempt:'))_0x38249d=![],_0xc1d20a=_0x4618bb['substring'](0x8);else return console[_0x3bbd55(0x10d)](_0x3bbd55(0x142)),console[_0x3bbd55(0x10d)](_0x3bbd55(0x122)),0x1;}try{const _0x2eef93=_0x4847ad['fromTask'],_0xded081=_0x4847ad[_0x3bbd55(0x17a)],_0x4be5ce=_0x4847ad[_0x3bbd55(0x175)],_0x574acf=_0x4847ad[_0x3bbd55(0x156)];_0x4847ad[_0x3bbd55(0x14e)]&&(console[_0x3bbd55(0x10d)](_0x3bbd55(0x132)+(_0x38249d?_0x3bbd55(0x106):_0x3bbd55(0x160))+'\x20'+_0xc1d20a),_0x2eef93&&console[_0x3bbd55(0x10d)](_0x3bbd55(0x12f)+_0x2eef93),_0xded081&&console['error']('Resume\x20from:\x20'+_0xded081),_0x4be5ce&&console['error'](_0x3bbd55(0x134)+_0x4be5ce),_0x574acf&&console[_0x3bbd55(0x10d)](_0x3bbd55(0x10b)));let _0xe56496;if(_0x4be5ce)try{if(_0x4be5ce[_0x3bbd55(0x143)]('@')){const _0x3826ed=await import('fs/promises'),_0x54ce51=_0x4be5ce[_0x3bbd55(0x11f)](0x1),_0x466f19=await _0x3826ed['readFile'](_0x54ce51,'utf-8');_0xe56496=JSON[_0x3bbd55(0x135)](_0x466f19);}else _0xe56496=JSON[_0x3bbd55(0x135)](_0x4be5ce);}catch{return console['error'](_0x3bbd55(0x179)),0x1;}if(!_0x4847ad[_0x3bbd55(0x13c)]){const _0x2fd55f=await confirm(_0x3bbd55(0x16d)+(_0x38249d?'session':_0x3bbd55(0x160))+'\x20'+_0xc1d20a+'?');if(!_0x2fd55f)return console['error']('Cancelled'),0x0;}let _0xbb748b;_0x38249d?_0xbb748b=await withSpinner('Retrying\x20session...',()=>_0x15bfe7[_0x3bbd55(0x14d)]['retrySession'](_0xc1d20a,{'fromTask':_0x2eef93,'retryParams':_0xe56496}),{'verbose':_0x4847ad[_0x3bbd55(0x14e)]}):_0xbb748b=await withSpinner(_0x3bbd55(0x107),()=>_0x15bfe7[_0x3bbd55(0x14d)][_0x3bbd55(0x14c)](_0xc1d20a,{'resumeFrom':_0xded081,'retryParams':_0xe56496,'force':_0x574acf}),{'verbose':_0x4847ad['verbose']});const _0x143d02=_0xbb748b[_0x3bbd55(0x15c)];return console['error']('✔\x20Retry\x20started'),console[_0x3bbd55(0x10d)]('\x20\x20New\x20attempt\x20ID:\x20'+_0x143d02[_0x3bbd55(0x17d)]),console[_0x3bbd55(0x10d)](_0x3bbd55(0x159)+_0x143d02[_0x3bbd55(0x14f)]),0x0;}catch(_0x40b818){if(_0x40b818 instanceof SDKError)return console[_0x3bbd55(0x10d)](_0x3bbd55(0x145)+_0x40b818[_0x3bbd55(0x174)]),_0x40b818[_0x3bbd55(0x11e)]&&console[_0x3bbd55(0x10d)]('\x20\x20Cause:\x20'+_0x40b818[_0x3bbd55(0x11e)]),0x1;throw _0x40b818;}}}export class WorkflowDownloadCommand extends BaseCommand{['name']=a24_0xbb13ff(0x161);[a24_0xbb13ff(0x103)]='Download\x20workflow\x20project\x20from\x20Treasure\x20Data';async['execute'](_0x23b4d6){const _0xbe670d=a24_0xbb13ff,{options:_0x29a493,args:_0x203970,tdx:_0x437ab2}=_0x23b4d6,_0x1ea345=_0x203970[0x0],_0x5a5caa=_0x203970[0x1]||'.';if(!_0x1ea345)return console['error'](_0xbe670d(0x11a)),console[_0xbe670d(0x10d)]('Usage:\x20workflow:download\x20<project-name>\x20[output-dir]'),0x1;const _0x44749e=_0x29a493[_0xbe670d(0x146)];_0x29a493['verbose']&&(console[_0xbe670d(0x10d)](_0xbe670d(0x126)+_0x1ea345),console[_0xbe670d(0x10d)](_0xbe670d(0x17b)+_0x5a5caa),_0x44749e&&console['error'](_0xbe670d(0x168)+_0x44749e));const _0x38f8e7=await withSpinner(_0xbe670d(0x115)+_0x1ea345+_0xbe670d(0x180),()=>_0x437ab2[_0xbe670d(0x14d)][_0xbe670d(0x113)](_0x1ea345,_0x5a5caa,{'revision':_0x44749e}),{'verbose':_0x29a493['verbose']}),_0x1a691a=_0x38f8e7[_0xbe670d(0x15c)];return console[_0xbe670d(0x10d)](_0xbe670d(0x108)+_0x1a691a['projectName']),console[_0xbe670d(0x10d)](_0xbe670d(0x10a)+_0x1a691a['revision']),console[_0xbe670d(0x10d)](_0xbe670d(0xfd)+_0x1a691a[_0xbe670d(0x117)]),console['error']('\x20\x20Location:\x20'+_0x5a5caa+'/'+_0x1a691a[_0xbe670d(0x169)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{['name']=a24_0xbb13ff(0x123);['description']='Push\x20workflow\x20project\x20to\x20Treasure\x20Data';async[a24_0xbb13ff(0x10e)](_0x565709){const _0x224bee=a24_0xbb13ff,{options:_0x1db893,args:_0x1a086f,tdx:_0x300c34}=_0x565709;let _0x373368='.',_0x58faf1=_0x1db893[_0x224bee(0x100)];if(_0x1a086f[0x0]){const {promises:_0x6752e4}=await import('fs');try{const _0x41e734=await _0x6752e4[_0x224bee(0x147)](_0x1a086f[0x0]);if(_0x41e734[_0x224bee(0x16a)]())_0x373368=_0x1a086f[0x0];else return console[_0x224bee(0x10d)](_0x224bee(0x145)+_0x1a086f[0x0]+_0x224bee(0xff)),0x1;}catch{_0x58faf1=_0x1a086f[0x0],_0x373368='.';}}const _0x22875f=_0x1db893['revision'],_0x398344=_0x1db893[_0x224bee(0x139)];_0x1db893[_0x224bee(0x14e)]&&(console[_0x224bee(0x10d)]('Project\x20directory:\x20'+_0x373368),_0x58faf1&&console[_0x224bee(0x10d)](_0x224bee(0x125)+_0x58faf1),_0x22875f&&console[_0x224bee(0x10d)](_0x224bee(0x168)+_0x22875f),_0x398344&&console[_0x224bee(0x10d)](_0x224bee(0x102)));const _0x23d36c=await withSpinner(_0x224bee(0x110),()=>_0x300c34[_0x224bee(0x14d)]['push'](_0x373368,{'projectName':_0x58faf1,'revision':_0x22875f,'skipValidation':_0x398344}),{'verbose':_0x1db893[_0x224bee(0x14e)]}),_0x4dda50=_0x23d36c[_0x224bee(0x15c)];return console[_0x224bee(0x10d)](_0x224bee(0x118)+_0x4dda50['projectName']),console[_0x224bee(0x10d)](_0x224bee(0x154)+_0x4dda50['projectId']),console['error'](_0x224bee(0x10a)+_0x4dda50[_0x224bee(0x146)]),0x0;}}function a24_0x5703(){const _0x5cd825=['offset','Error:\x20Project\x20name\x20is\x20required','limit','161156rrTgMo','Kill\x20a\x20running\x20attempt','cause','substring','length','10wKpeRG','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','workflow:push','Killing\x20attempt...','Project\x20name:\x20','Project:\x20','Error:\x20Attempt\x20ID\x20is\x20required','delete','\x20session','2vBkXsf','projectId','\x20attempt','List\x20workflows','stdin','From\x20task:\x20','10tTwOhS','Listing\x20workflow\x20sessions...','Target:\x20','Getting\x20attempt\x20tasks...','Params:\x20','parse','\x20\x20Cause:\x20','logs','Reason:\x20','skipValidation','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','Retry\x20a\x20session\x20or\x20attempt','yes','7435254Lyjigl','question','\x20workflow','workflow:attempt','4409512InfSZz','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','startsWith','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','Error:\x20','revision','stat','Task\x20name:\x20','8157702ymseOm','reason','status','retryAttempt','workflow','verbose','sessionId','kill','Error:\x20Attempt\x20ID\x20and\x20task\x20name\x20are\x20required','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','createInterface','\x20\x20Project\x20ID:\x20','Include\x20retried:\x20yes','force','includeSubtasks','Listing\x20workflows...','\x20\x20Session\x20ID:\x20','workflow:logs','List\x20all\x20workflow\x20projects','data','21103299ogjwRK','\x20task','1965096PyAcLi','attempt','workflow:download','workflow:delete','Project\x20filter:\x20','workflow:workflows','close','Show\x20logs\x20for\x20a\x20specific\x20task','toLowerCase','Revision:\x20','projectName','isDirectory','\x22?\x20This\x20cannot\x20be\x20undone.','session:','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','stdout','Deleting\x20project\x20','Show\x20tasks\x20for\x20an\x20attempt','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Show\x20specific\x20attempt\x20details','projects','message','params','Attempt\x20ID:\x20','\x20project','Filter:\x20','Error:\x20Invalid\x20JSON\x20in\x20--params','resumeFrom','Output\x20directory:\x20','List\x20workflow\x20execution\x20sessions','attemptId','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','Cancelled','...','Including\x20subtasks:\x20yes','workflow:attempts','\x20\x20Files\x20extracted:\x20','workflow:retry','\x20is\x20not\x20a\x20directory','name','split','Validation:\x20skipped','description','attempts','from','session','Retrying\x20attempt...','✔\x20Downloaded\x20','Pattern:\x20','\x20\x20Revision:\x20','Force:\x20yes','✔\x20Found\x20','error','execute','workflows','Pushing\x20workflow\x20project...','ies','Filter:\x20project=','download','includeRetried','Downloading\x20project\x20','491689jLgPPl','filesExtracted','✔\x20Pushed\x20'];a24_0x5703=function(){return _0x5cd825;};return a24_0x5703();}export class WorkflowDeleteCommand extends BaseCommand{[a24_0xbb13ff(0x100)]=a24_0xbb13ff(0x162);[a24_0xbb13ff(0x103)]=a24_0xbb13ff(0x13a);async[a24_0xbb13ff(0x10e)](_0x2ff935){const _0x48c137=a24_0xbb13ff,{options:_0x3ca140,args:_0x3b7c0a,tdx:_0x31cbb9}=_0x2ff935,_0x179c9c=_0x3b7c0a[0x0];if(!_0x179c9c)return console[_0x48c137(0x10d)](_0x48c137(0x144)),console[_0x48c137(0x10d)]('Usage:\x20workflow:delete\x20<project-name-or-id>'),0x1;_0x3ca140[_0x48c137(0x14e)]&&console[_0x48c137(0x10d)]('Project:\x20'+_0x179c9c);if(!_0x3ca140[_0x48c137(0x13c)]){const _0x9e8eb0=await confirm(_0x48c137(0x152)+_0x179c9c+_0x48c137(0x16b));if(!_0x9e8eb0)return console[_0x48c137(0x10d)](_0x48c137(0x17f)),0x0;}const _0x66b5eb=await withSpinner(_0x48c137(0x16f)+_0x179c9c+_0x48c137(0x180),()=>_0x31cbb9['workflow'][_0x48c137(0x128)](_0x179c9c),{'verbose':_0x3ca140[_0x48c137(0x14e)]}),_0x5ef519=_0x66b5eb['data'];return console[_0x48c137(0x10d)]('✔\x20Deleted\x20project\x20'+_0x5ef519[_0x48c137(0x169)]),console[_0x48c137(0x10d)](_0x48c137(0x154)+_0x5ef519[_0x48c137(0x12b)]),0x0;}}
1
+ const a25_0x3b2214=a25_0x13d4;(function(_0xfa3d05,_0x464914){const _0x57fcd4=a25_0x13d4,_0x3da891=_0xfa3d05();while(!![]){try{const _0x1cc2ed=parseInt(_0x57fcd4(0x16b))/0x1*(-parseInt(_0x57fcd4(0x1bc))/0x2)+parseInt(_0x57fcd4(0x1b3))/0x3*(-parseInt(_0x57fcd4(0x1bf))/0x4)+-parseInt(_0x57fcd4(0x1c2))/0x5*(-parseInt(_0x57fcd4(0x1c0))/0x6)+-parseInt(_0x57fcd4(0x183))/0x7*(-parseInt(_0x57fcd4(0x187))/0x8)+-parseInt(_0x57fcd4(0x149))/0x9*(-parseInt(_0x57fcd4(0x1a8))/0xa)+-parseInt(_0x57fcd4(0x185))/0xb+-parseInt(_0x57fcd4(0x18a))/0xc;if(_0x1cc2ed===_0x464914)break;else _0x3da891['push'](_0x3da891['shift']());}catch(_0x139d05){_0x3da891['push'](_0x3da891['shift']());}}}(a25_0x3d52,0x58df2));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a25_0x13d4(_0x58a4e8,_0x59f357){const _0x3d525a=a25_0x3d52();return a25_0x13d4=function(_0x13d4bd,_0x5689ee){_0x13d4bd=_0x13d4bd-0x145;let _0x2ef5fa=_0x3d525a[_0x13d4bd];return _0x2ef5fa;},a25_0x13d4(_0x58a4e8,_0x59f357);}import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import*as a25_0x5d22c2 from'readline';async function confirm(_0x5f9931){const _0x4d53a1=a25_0x13d4,_0x332f9b=a25_0x5d22c2[_0x4d53a1(0x16a)]({'input':process[_0x4d53a1(0x1b4)],'output':process[_0x4d53a1(0x1a5)]});return new Promise(_0x3609ab=>{const _0x449ad2=_0x4d53a1;_0x332f9b[_0x449ad2(0x1b8)](_0x5f9931+_0x449ad2(0x15a),_0x7e13df=>{const _0x57937b=_0x449ad2;_0x332f9b['close'](),_0x3609ab(_0x7e13df[_0x57937b(0x181)]()==='y'||_0x7e13df[_0x57937b(0x181)]()==='yes');});});}export class WorkflowProjectsCommand extends BaseCommand{[a25_0x3b2214(0x17d)]=a25_0x3b2214(0x195);['description']=a25_0x3b2214(0x166);async[a25_0x3b2214(0x152)](_0x4f7ed1){const _0x5cb74e=a25_0x3b2214,{options:_0x1296bd,args:_0x28271a,tdx:_0x4c776c}=_0x4f7ed1,_0x37c0ed=_0x28271a[0x0];try{_0x1296bd[_0x5cb74e(0x1ae)]&&_0x37c0ed&&console['error']('Pattern:\x20'+_0x37c0ed);const _0x3e2cb8=await withSpinner(_0x5cb74e(0x19a),()=>_0x4c776c['workflow'][_0x5cb74e(0x18b)](_0x37c0ed,{'limit':_0x1296bd['limit']}),{'verbose':_0x1296bd['verbose']}),_0x503876=_0x3e2cb8[_0x5cb74e(0x1ba)];return console['error'](_0x5cb74e(0x196)+_0x503876[_0x5cb74e(0x19e)]+_0x5cb74e(0x18d)+(_0x503876[_0x5cb74e(0x19e)]!==0x1?'s':'')),await handleSDKOutput(_0x503876,_0x1296bd),0x0;}catch(_0x28638e){if(_0x28638e instanceof SDKError)return console[_0x5cb74e(0x170)](_0x5cb74e(0x17a)+_0x28638e['message']),_0x28638e[_0x5cb74e(0x16c)]&&console[_0x5cb74e(0x170)](_0x5cb74e(0x186)+_0x28638e['cause']),0x1;throw _0x28638e;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a25_0x3b2214(0x17d)]=a25_0x3b2214(0x1b7);[a25_0x3b2214(0x178)]='List\x20workflows';async[a25_0x3b2214(0x152)](_0x14abd3){const _0x10d236=a25_0x3b2214,{options:_0x2ce531,args:_0x379a95,tdx:_0x1ea230}=_0x14abd3,_0x4c759d=_0x379a95[0x0];try{_0x2ce531['verbose']&&_0x4c759d&&console['error'](_0x10d236(0x199)+_0x4c759d);const _0x567036=await withSpinner('Listing\x20workflows...',()=>_0x1ea230[_0x10d236(0x162)][_0x10d236(0x14d)](_0x4c759d,{'limit':_0x2ce531['limit']}),{'verbose':_0x2ce531[_0x10d236(0x1ae)]}),_0x5429db=_0x567036[_0x10d236(0x1ba)];return console[_0x10d236(0x170)]('✔\x20Found\x20'+_0x5429db['length']+'\x20workflow'+(_0x5429db[_0x10d236(0x19e)]!==0x1?'s':'')),await handleSDKOutput(_0x5429db,_0x2ce531),0x0;}catch(_0x223207){if(_0x223207 instanceof SDKError)return console['error'](_0x10d236(0x17a)+_0x223207[_0x10d236(0x175)]),_0x223207[_0x10d236(0x16c)]&&console[_0x10d236(0x170)]('\x20\x20Cause:\x20'+_0x223207[_0x10d236(0x16c)]),0x1;throw _0x223207;}}}export class WorkflowSessionsCommand extends BaseCommand{[a25_0x3b2214(0x17d)]=a25_0x3b2214(0x1bd);[a25_0x3b2214(0x178)]=a25_0x3b2214(0x180);async['execute'](_0x1ed03a){const _0x5c2e66=a25_0x3b2214,{options:_0x23560f,args:_0x51a20d,tdx:_0x34a2ed}=_0x1ed03a;let _0x42f301,_0x3991d0;if(_0x51a20d[0x0]){const _0x18cb0b=_0x51a20d[0x0][_0x5c2e66(0x179)]('.');if(_0x18cb0b[_0x5c2e66(0x19e)]===0x1)_0x42f301=_0x18cb0b[0x0];else{if(_0x18cb0b[_0x5c2e66(0x19e)]===0x2)[_0x42f301,_0x3991d0]=_0x18cb0b;else return console[_0x5c2e66(0x170)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{if(_0x23560f[_0x5c2e66(0x1ae)]){if(_0x42f301&&_0x3991d0)console['error']('Filter:\x20'+_0x42f301+'.'+_0x3991d0);else _0x42f301&&console[_0x5c2e66(0x170)](_0x5c2e66(0x1ac)+_0x42f301);const _0x424a31=_0x23560f['status'];_0x424a31&&console['error'](_0x5c2e66(0x192)+_0x424a31);}const _0x50b482=await withSpinner(_0x5c2e66(0x158),()=>_0x34a2ed[_0x5c2e66(0x162)][_0x5c2e66(0x1b6)]({'projectName':_0x42f301,'workflowName':_0x3991d0,'status':_0x23560f[_0x5c2e66(0x164)],'fromTime':_0x23560f[_0x5c2e66(0x15f)],'toTime':_0x23560f['to'],'limit':_0x23560f[_0x5c2e66(0x1c3)]}),{'verbose':_0x23560f['verbose']}),_0x26de8b=_0x50b482[_0x5c2e66(0x1ba)];return console[_0x5c2e66(0x170)]('✔\x20Found\x20'+_0x26de8b[_0x5c2e66(0x19e)]+'\x20session'+(_0x26de8b[_0x5c2e66(0x19e)]!==0x1?'s':'')),await handleSDKOutput(_0x26de8b,_0x23560f),0x0;}catch(_0x83d751){if(_0x83d751 instanceof SDKError)return console[_0x5c2e66(0x170)](_0x5c2e66(0x17a)+_0x83d751[_0x5c2e66(0x175)]),_0x83d751[_0x5c2e66(0x16c)]&&console[_0x5c2e66(0x170)](_0x5c2e66(0x186)+_0x83d751[_0x5c2e66(0x16c)]),0x1;throw _0x83d751;}}}export class WorkflowAttemptsCommand extends BaseCommand{['name']=a25_0x3b2214(0x16e);['description']=a25_0x3b2214(0x19b);async['execute'](_0x49c1c4){const _0x23e339=a25_0x3b2214,{options:_0x3ae211,args:_0x483254,tdx:_0x1312af}=_0x49c1c4;let _0x4bd11e,_0x5c01f0;if(_0x483254[0x0]){const _0x339800=_0x483254[0x0][_0x23e339(0x179)]('.');if(_0x339800['length']===0x1)_0x4bd11e=_0x339800[0x0];else{if(_0x339800[_0x23e339(0x19e)]===0x2)[_0x4bd11e,_0x5c01f0]=_0x339800;else return console[_0x23e339(0x170)](_0x23e339(0x171)),0x1;}}try{const _0x12a736=_0x3ae211[_0x23e339(0x1c8)];if(_0x3ae211['verbose']){if(_0x4bd11e&&_0x5c01f0)console['error'](_0x23e339(0x194)+_0x4bd11e+'.'+_0x5c01f0);else _0x4bd11e&&console[_0x23e339(0x170)](_0x23e339(0x1ac)+_0x4bd11e);_0x12a736&&console[_0x23e339(0x170)](_0x23e339(0x168));}const _0x596ee0=await withSpinner('Listing\x20workflow\x20attempts...',()=>_0x1312af[_0x23e339(0x162)][_0x23e339(0x1c7)]({'projectName':_0x4bd11e,'workflowName':_0x5c01f0,'includeRetried':_0x12a736,'limit':_0x3ae211[_0x23e339(0x1c3)]}),{'verbose':_0x3ae211[_0x23e339(0x1ae)]}),_0x45cc1a=_0x596ee0['data'];return console[_0x23e339(0x170)](_0x23e339(0x196)+_0x45cc1a[_0x23e339(0x19e)]+'\x20attempt'+(_0x45cc1a[_0x23e339(0x19e)]!==0x1?'s':'')),await handleSDKOutput(_0x45cc1a,_0x3ae211),0x0;}catch(_0x12c366){if(_0x12c366 instanceof SDKError)return console[_0x23e339(0x170)](_0x23e339(0x17a)+_0x12c366[_0x23e339(0x175)]),_0x12c366['cause']&&console[_0x23e339(0x170)]('\x20\x20Cause:\x20'+_0x12c366[_0x23e339(0x16c)]),0x1;throw _0x12c366;}}}export class WorkflowAttemptCommand extends BaseCommand{[a25_0x3b2214(0x17d)]=a25_0x3b2214(0x169);[a25_0x3b2214(0x178)]='Show\x20specific\x20attempt\x20details';async['execute'](_0x42395e){const _0x5322a2=a25_0x3b2214,{options:_0x3cc791,args:_0x1f6ec8,tdx:_0x21eb2b}=_0x42395e,_0x28aebf=_0x1f6ec8[0x0];if(!_0x28aebf)return console[_0x5322a2(0x170)](_0x5322a2(0x1a9)),0x1;try{_0x3cc791['verbose']&&console[_0x5322a2(0x170)]('Attempt\x20ID:\x20'+_0x28aebf);const _0x2eeede=await withSpinner(_0x5322a2(0x14e),()=>_0x21eb2b['workflow'][_0x5322a2(0x172)](_0x28aebf),{'verbose':_0x3cc791[_0x5322a2(0x1ae)]}),_0x4804f6=_0x2eeede['data'];return await handleSDKOutput([_0x4804f6],_0x3cc791),0x0;}catch(_0x429353){if(_0x429353 instanceof SDKError)return console[_0x5322a2(0x170)](_0x5322a2(0x17a)+_0x429353[_0x5322a2(0x175)]),_0x429353[_0x5322a2(0x16c)]&&console[_0x5322a2(0x170)](_0x5322a2(0x186)+_0x429353[_0x5322a2(0x16c)]),0x1;throw _0x429353;}}}export class WorkflowTasksCommand extends BaseCommand{[a25_0x3b2214(0x17d)]=a25_0x3b2214(0x16d);[a25_0x3b2214(0x178)]=a25_0x3b2214(0x14c);async[a25_0x3b2214(0x152)](_0x24013b){const _0xe36c0b=a25_0x3b2214,{options:_0x368064,args:_0x34fa31,tdx:_0xdaa90a}=_0x24013b,_0x98efe7=_0x34fa31[0x0];if(!_0x98efe7)return console[_0xe36c0b(0x170)](_0xe36c0b(0x1a9)),0x1;try{const _0x35ce39=_0x368064[_0xe36c0b(0x19f)];_0x368064[_0xe36c0b(0x1ae)]&&(console[_0xe36c0b(0x170)]('Attempt\x20ID:\x20'+_0x98efe7),_0x35ce39&&console[_0xe36c0b(0x170)](_0xe36c0b(0x1b1)));const _0x25beb5=await withSpinner(_0xe36c0b(0x157),()=>_0xdaa90a['workflow'][_0xe36c0b(0x1a2)](_0x98efe7,_0x35ce39||![]),{'verbose':_0x368064[_0xe36c0b(0x1ae)]}),_0x2fc138=_0x25beb5[_0xe36c0b(0x1ba)];return console[_0xe36c0b(0x170)]('✔\x20Found\x20'+_0x2fc138[_0xe36c0b(0x19e)]+_0xe36c0b(0x197)+(_0x2fc138[_0xe36c0b(0x19e)]!==0x1?'s':'')),await handleSDKOutput(_0x2fc138,_0x368064),0x0;}catch(_0x37f29e){if(_0x37f29e instanceof SDKError)return console[_0xe36c0b(0x170)](_0xe36c0b(0x17a)+_0x37f29e[_0xe36c0b(0x175)]),_0x37f29e[_0xe36c0b(0x16c)]&&console[_0xe36c0b(0x170)]('\x20\x20Cause:\x20'+_0x37f29e['cause']),0x1;throw _0x37f29e;}}}export class WorkflowLogsCommand extends BaseCommand{[a25_0x3b2214(0x17d)]=a25_0x3b2214(0x1a3);['description']=a25_0x3b2214(0x14f);async[a25_0x3b2214(0x152)](_0x355fd0){const _0x32de2d=a25_0x3b2214,{options:_0xe2fbe5,args:_0x28a376,tdx:_0xfa4569}=_0x355fd0,_0x38e0bc=_0x28a376[0x0],_0x29fdec=_0x28a376[0x1];if(!_0x38e0bc||!_0x29fdec)return console[_0x32de2d(0x170)](_0x32de2d(0x167)),0x1;try{_0xe2fbe5[_0x32de2d(0x1ae)]&&(console[_0x32de2d(0x170)]('Attempt\x20ID:\x20'+_0x38e0bc),console[_0x32de2d(0x170)](_0x32de2d(0x1be)+_0x29fdec));const _0x5b51b7=_0xe2fbe5['offset'],_0x1036ff=await withSpinner(_0x32de2d(0x182),()=>_0xfa4569['workflow']['logs'](_0x38e0bc,_0x29fdec,{'offset':_0x5b51b7,'limit':_0xe2fbe5[_0x32de2d(0x1c3)]}),{'verbose':_0xe2fbe5[_0x32de2d(0x1ae)]}),_0x223cba=_0x1036ff[_0x32de2d(0x1ba)];return console[_0x32de2d(0x170)](_0x32de2d(0x196)+_0x223cba[_0x32de2d(0x19e)]+'\x20log\x20entr'+(_0x223cba[_0x32de2d(0x19e)]!==0x1?_0x32de2d(0x176):'y')),await handleSDKOutput(_0x223cba,_0xe2fbe5),0x0;}catch(_0x1ea3c3){if(_0x1ea3c3 instanceof SDKError)return console[_0x32de2d(0x170)](_0x32de2d(0x17a)+_0x1ea3c3[_0x32de2d(0x175)]),_0x1ea3c3[_0x32de2d(0x16c)]&&console[_0x32de2d(0x170)](_0x32de2d(0x186)+_0x1ea3c3['cause']),0x1;throw _0x1ea3c3;}}}export class WorkflowKillCommand extends BaseCommand{[a25_0x3b2214(0x17d)]=a25_0x3b2214(0x159);['description']='Kill\x20a\x20running\x20attempt';async[a25_0x3b2214(0x152)](_0xe02bbc){const _0x272e00=a25_0x3b2214,{options:_0x580223,args:_0x3607da,tdx:_0x2ea1dc}=_0xe02bbc,_0x4f5737=_0x3607da[0x0];if(!_0x4f5737)return console[_0x272e00(0x170)](_0x272e00(0x1a9)),0x1;try{const _0x1d4c47=_0x580223['reason'];_0x580223[_0x272e00(0x1ae)]&&(console[_0x272e00(0x170)](_0x272e00(0x177)+_0x4f5737),_0x1d4c47&&console[_0x272e00(0x170)](_0x272e00(0x1ad)+_0x1d4c47));if(!_0x580223[_0x272e00(0x193)]){const _0xf7a55d=await confirm(_0x272e00(0x18f)+_0x4f5737+'?');if(!_0xf7a55d)return console[_0x272e00(0x170)](_0x272e00(0x1aa)),0x0;}const _0xcc8ad7=await withSpinner('Killing\x20attempt...',()=>_0x2ea1dc[_0x272e00(0x162)][_0x272e00(0x190)](_0x4f5737,_0x1d4c47),{'verbose':_0x580223[_0x272e00(0x1ae)]}),_0xea2a19=_0xcc8ad7[_0x272e00(0x1ba)];return console[_0x272e00(0x170)]('✔\x20'+_0xea2a19),0x0;}catch(_0x4e6e2a){if(_0x4e6e2a instanceof SDKError)return console[_0x272e00(0x170)](_0x272e00(0x17a)+_0x4e6e2a[_0x272e00(0x175)]),_0x4e6e2a['cause']&&console['error'](_0x272e00(0x186)+_0x4e6e2a[_0x272e00(0x16c)]),0x1;throw _0x4e6e2a;}}}function a25_0x3d52(){const _0xe571fd=['question','workflow:download','data','✔\x20Downloaded\x20','86lcZsSL','workflow:sessions','Task\x20name:\x20','512uRlvGO','78PUSdsx','Target:\x20','268115avNzod','limit','attemptId','Resume\x20from:\x20','force','attempts','includeRetried','projectName','session','push','params','\x20\x20New\x20attempt\x20ID:\x20','4066992kbipdQ','\x20\x20Revision:\x20','session:','Show\x20tasks\x20for\x20an\x20attempt','workflows','Getting\x20attempt\x20details...','Show\x20logs\x20for\x20a\x20specific\x20task','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','✔\x20Deleted\x20project\x20','execute','\x20\x20Session\x20ID:\x20','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','substring','Getting\x20attempt\x20tasks...','Listing\x20workflow\x20sessions...','workflow:kill','\x20(y/N):\x20','✔\x20Retry\x20started','Validation:\x20skipped','Project\x20directory:\x20','From\x20task:\x20','from','isDirectory','parse','workflow','...','status','download','List\x20all\x20workflow\x20projects','Error:\x20Attempt\x20ID\x20and\x20task\x20name\x20are\x20required','Include\x20retried:\x20yes','workflow:attempt','createInterface','7903GNesIi','cause','workflow:tasks','workflow:attempts','startsWith','error','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','attempt','\x22?\x20This\x20cannot\x20be\x20undone.','revision','message','ies','Attempt\x20ID:\x20','description','split','Error:\x20','readFile','\x20is\x20not\x20a\x20directory','name','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','List\x20workflow\x20execution\x20sessions','toLowerCase','Getting\x20task\x20logs...','7ogGDDq','Error:\x20Project\x20name\x20is\x20required','7826764eJOSKm','\x20\x20Cause:\x20','4449144KIiXSO','Error:\x20Invalid\x20JSON\x20in\x20--params','workflow:push','2626164HoxdcL','projects','\x20\x20Location:\x20','\x20project','Deleting\x20project\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','kill','utf-8','Status:\x20','yes','Filter:\x20','workflow:projects','✔\x20Found\x20','\x20task','stat','Project\x20filter:\x20','Listing\x20workflow\x20projects...','List\x20workflow\x20attempts','✔\x20Pushed\x20','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','length','includeSubtasks','resumeFrom','Usage:\x20workflow:delete\x20<project-name-or-id>','tasks','workflow:logs','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','stdout','Retrying\x20attempt...','\x20\x20Files\x20extracted:\x20','10XRLnMc','Error:\x20Attempt\x20ID\x20is\x20required','Cancelled','Downloading\x20project\x20','Filter:\x20project=','Reason:\x20','verbose','Output\x20directory:\x20','skipValidation','Including\x20subtasks:\x20yes','Project:\x20','1662lllIDn','stdin','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','sessions','workflow:workflows'];a25_0x3d52=function(){return _0xe571fd;};return a25_0x3d52();}export class WorkflowRetryCommand extends BaseCommand{[a25_0x3b2214(0x17d)]='workflow:retry';['description']='Retry\x20a\x20session\x20or\x20attempt';async[a25_0x3b2214(0x152)](_0x1e6981){const _0x33832a=a25_0x3b2214,{options:_0x50ef7c,args:_0x18c337,tdx:_0x1a9887}=_0x1e6981,_0x73883e=_0x18c337[0x0];if(!_0x73883e)return console[_0x33832a(0x170)](_0x33832a(0x154)),console['error']('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x365f3f=![],_0x18e4fd=_0x73883e;if(_0x73883e[_0x33832a(0x16f)](_0x33832a(0x14b)))_0x365f3f=!![],_0x18e4fd=_0x73883e['substring'](0x8);else{if(_0x73883e[_0x33832a(0x16f)]('attempt:'))_0x365f3f=![],_0x18e4fd=_0x73883e[_0x33832a(0x156)](0x8);else return console[_0x33832a(0x170)]('Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'),console[_0x33832a(0x170)](_0x33832a(0x17e)),0x1;}try{const _0xf03e3=_0x50ef7c['fromTask'],_0x9b2edc=_0x50ef7c[_0x33832a(0x1a0)],_0x48a3d0=_0x50ef7c[_0x33832a(0x147)],_0x3f14b0=_0x50ef7c[_0x33832a(0x1c6)];_0x50ef7c[_0x33832a(0x1ae)]&&(console[_0x33832a(0x170)](_0x33832a(0x1c1)+(_0x365f3f?_0x33832a(0x145):_0x33832a(0x172))+'\x20'+_0x18e4fd),_0xf03e3&&console['error'](_0x33832a(0x15e)+_0xf03e3),_0x9b2edc&&console[_0x33832a(0x170)](_0x33832a(0x1c5)+_0x9b2edc),_0x48a3d0&&console['error']('Params:\x20'+_0x48a3d0),_0x3f14b0&&console[_0x33832a(0x170)]('Force:\x20yes'));let _0x8f2dc5;if(_0x48a3d0)try{if(_0x48a3d0[_0x33832a(0x16f)]('@')){const _0x2ed77e=await import('fs/promises'),_0x16d2fc=_0x48a3d0[_0x33832a(0x156)](0x1),_0x53a560=await _0x2ed77e[_0x33832a(0x17b)](_0x16d2fc,_0x33832a(0x191));_0x8f2dc5=JSON[_0x33832a(0x161)](_0x53a560);}else _0x8f2dc5=JSON[_0x33832a(0x161)](_0x48a3d0);}catch{return console['error'](_0x33832a(0x188)),0x1;}if(!_0x50ef7c[_0x33832a(0x193)]){const _0x7cabe7=await confirm(_0x33832a(0x1b5)+(_0x365f3f?_0x33832a(0x145):_0x33832a(0x172))+'\x20'+_0x18e4fd+'?');if(!_0x7cabe7)return console[_0x33832a(0x170)](_0x33832a(0x1aa)),0x0;}let _0x3ca8ce;_0x365f3f?_0x3ca8ce=await withSpinner('Retrying\x20session...',()=>_0x1a9887[_0x33832a(0x162)]['retrySession'](_0x18e4fd,{'fromTask':_0xf03e3,'retryParams':_0x8f2dc5}),{'verbose':_0x50ef7c[_0x33832a(0x1ae)]}):_0x3ca8ce=await withSpinner(_0x33832a(0x1a6),()=>_0x1a9887[_0x33832a(0x162)]['retryAttempt'](_0x18e4fd,{'resumeFrom':_0x9b2edc,'retryParams':_0x8f2dc5,'force':_0x3f14b0}),{'verbose':_0x50ef7c['verbose']});const _0x22733a=_0x3ca8ce['data'];return console[_0x33832a(0x170)](_0x33832a(0x15b)),console[_0x33832a(0x170)](_0x33832a(0x148)+_0x22733a[_0x33832a(0x1c4)]),console[_0x33832a(0x170)](_0x33832a(0x153)+_0x22733a['sessionId']),0x0;}catch(_0x39c8a9){if(_0x39c8a9 instanceof SDKError)return console[_0x33832a(0x170)](_0x33832a(0x17a)+_0x39c8a9[_0x33832a(0x175)]),_0x39c8a9[_0x33832a(0x16c)]&&console[_0x33832a(0x170)](_0x33832a(0x186)+_0x39c8a9[_0x33832a(0x16c)]),0x1;throw _0x39c8a9;}}}export class WorkflowDownloadCommand extends BaseCommand{[a25_0x3b2214(0x17d)]=a25_0x3b2214(0x1b9);['description']=a25_0x3b2214(0x17f);async['execute'](_0x352665){const _0x206282=a25_0x3b2214,{options:_0x541655,args:_0x2ffef2,tdx:_0x150bf1}=_0x352665,_0x497986=_0x2ffef2[0x0],_0x1c47ed=_0x2ffef2[0x1]||'.';if(!_0x497986)return console[_0x206282(0x170)](_0x206282(0x184)),console[_0x206282(0x170)](_0x206282(0x1a4)),0x1;const _0x3b2c7c=_0x541655[_0x206282(0x174)];_0x541655[_0x206282(0x1ae)]&&(console[_0x206282(0x170)](_0x206282(0x1b2)+_0x497986),console['error'](_0x206282(0x1af)+_0x1c47ed),_0x3b2c7c&&console[_0x206282(0x170)]('Revision:\x20'+_0x3b2c7c));const _0x507b44=await withSpinner(_0x206282(0x1ab)+_0x497986+_0x206282(0x163),()=>_0x150bf1[_0x206282(0x162)][_0x206282(0x165)](_0x497986,_0x1c47ed,{'revision':_0x3b2c7c}),{'verbose':_0x541655[_0x206282(0x1ae)]}),_0x3e23c5=_0x507b44[_0x206282(0x1ba)];return console[_0x206282(0x170)](_0x206282(0x1bb)+_0x3e23c5[_0x206282(0x1c9)]),console['error'](_0x206282(0x14a)+_0x3e23c5[_0x206282(0x174)]),console[_0x206282(0x170)](_0x206282(0x1a7)+_0x3e23c5['filesExtracted']),console[_0x206282(0x170)](_0x206282(0x18c)+_0x1c47ed+'/'+_0x3e23c5[_0x206282(0x1c9)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a25_0x3b2214(0x17d)]=a25_0x3b2214(0x189);[a25_0x3b2214(0x178)]='Push\x20workflow\x20project\x20to\x20Treasure\x20Data';async[a25_0x3b2214(0x152)](_0x365182){const _0x5652d0=a25_0x3b2214,{options:_0x4cfe02,args:_0x860e03,tdx:_0x57649d}=_0x365182;let _0x6ee7f='.',_0x4aa314=_0x4cfe02[_0x5652d0(0x17d)];if(_0x860e03[0x0]){const {promises:_0x5114a4}=await import('fs');try{const _0x138984=await _0x5114a4[_0x5652d0(0x198)](_0x860e03[0x0]);if(_0x138984[_0x5652d0(0x160)]())_0x6ee7f=_0x860e03[0x0];else return console['error'](_0x5652d0(0x17a)+_0x860e03[0x0]+_0x5652d0(0x17c)),0x1;}catch{_0x4aa314=_0x860e03[0x0],_0x6ee7f='.';}}const _0x42fee4=_0x4cfe02[_0x5652d0(0x174)],_0x244782=_0x4cfe02[_0x5652d0(0x1b0)];_0x4cfe02['verbose']&&(console[_0x5652d0(0x170)](_0x5652d0(0x15d)+_0x6ee7f),_0x4aa314&&console['error']('Project\x20name:\x20'+_0x4aa314),_0x42fee4&&console[_0x5652d0(0x170)]('Revision:\x20'+_0x42fee4),_0x244782&&console['error'](_0x5652d0(0x15c)));const _0x4e0143=await withSpinner('Pushing\x20workflow\x20project...',()=>_0x57649d[_0x5652d0(0x162)][_0x5652d0(0x146)](_0x6ee7f,{'projectName':_0x4aa314,'revision':_0x42fee4,'skipValidation':_0x244782}),{'verbose':_0x4cfe02[_0x5652d0(0x1ae)]}),_0x4e49db=_0x4e0143[_0x5652d0(0x1ba)];return console['error'](_0x5652d0(0x19c)+_0x4e49db['projectName']),console[_0x5652d0(0x170)]('\x20\x20Project\x20ID:\x20'+_0x4e49db['projectId']),console[_0x5652d0(0x170)](_0x5652d0(0x14a)+_0x4e49db[_0x5652d0(0x174)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a25_0x3b2214(0x17d)]='workflow:delete';[a25_0x3b2214(0x178)]=a25_0x3b2214(0x155);async[a25_0x3b2214(0x152)](_0xb73721){const _0x26b554=a25_0x3b2214,{options:_0x275f1c,args:_0xe43f67,tdx:_0x3e7ed7}=_0xb73721,_0x4257e6=_0xe43f67[0x0];if(!_0x4257e6)return console[_0x26b554(0x170)](_0x26b554(0x19d)),console[_0x26b554(0x170)](_0x26b554(0x1a1)),0x1;_0x275f1c['verbose']&&console[_0x26b554(0x170)](_0x26b554(0x1b2)+_0x4257e6);if(!_0x275f1c[_0x26b554(0x193)]){const _0x49c222=await confirm(_0x26b554(0x150)+_0x4257e6+_0x26b554(0x173));if(!_0x49c222)return console[_0x26b554(0x170)](_0x26b554(0x1aa)),0x0;}const _0x25b861=await withSpinner(_0x26b554(0x18e)+_0x4257e6+'...',()=>_0x3e7ed7[_0x26b554(0x162)]['delete'](_0x4257e6),{'verbose':_0x275f1c[_0x26b554(0x1ae)]}),_0x212286=_0x25b861[_0x26b554(0x1ba)];return console['error'](_0x26b554(0x151)+_0x212286[_0x26b554(0x1c9)]),console[_0x26b554(0x170)]('\x20\x20Project\x20ID:\x20'+_0x212286['projectId']),0x0;}}
package/dist/core/auth.js CHANGED
@@ -1 +1 @@
1
- (function(_0x428819,_0x110f99){const _0x5ecca4=a25_0x98c0,_0x2efdf0=_0x428819();while(!![]){try{const _0x3c5d9a=-parseInt(_0x5ecca4(0x116))/0x1+-parseInt(_0x5ecca4(0x113))/0x2+-parseInt(_0x5ecca4(0x11b))/0x3*(parseInt(_0x5ecca4(0x10d))/0x4)+-parseInt(_0x5ecca4(0x110))/0x5+parseInt(_0x5ecca4(0x118))/0x6*(parseInt(_0x5ecca4(0x10e))/0x7)+-parseInt(_0x5ecca4(0x11a))/0x8+parseInt(_0x5ecca4(0x124))/0x9;if(_0x3c5d9a===_0x110f99)break;else _0x2efdf0['push'](_0x2efdf0['shift']());}catch(_0x594024){_0x2efdf0['push'](_0x2efdf0['shift']());}}}(a25_0x338d,0x9133d));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';function a25_0x98c0(_0x360eeb,_0x17a8bd){const _0x338d46=a25_0x338d();return a25_0x98c0=function(_0x98c0a5,_0x56405d){_0x98c0a5=_0x98c0a5-0x10d;let _0x1dc53a=_0x338d46[_0x98c0a5];return _0x1dc53a;},a25_0x98c0(_0x360eeb,_0x17a8bd);}import{getAPIKey}from'./config.js';export function getVersion(){const _0x51b171=a25_0x98c0;try{const _0x4d23b9=fileURLToPath(import.meta[_0x51b171(0x11f)]),_0x3b55bd=dirname(_0x4d23b9),_0x12825c=join(_0x3b55bd,'../../package.json'),_0x222860=JSON[_0x51b171(0x122)](readFileSync(_0x12825c,_0x51b171(0x117)));return _0x222860[_0x51b171(0x11e)];}catch{return _0x51b171(0x114);}}export function getUserAgent(){const _0x186453=a25_0x98c0,_0x54cd5f=getVersion(),_0x341436=platform(),_0x5133b4=process[_0x186453(0x11e)][_0x186453(0x10f)]('v','');return _0x186453(0x115)+_0x54cd5f+'\x20('+_0x341436+_0x186453(0x111)+_0x5133b4+')';}export function getAuthHeaders(_0x460da9,_0x3f4634){const _0x18221a=a25_0x98c0,_0x38b43b=getVersion(),_0x4aa968={'User-Agent':getUserAgent(),'X-TD-Client':_0x18221a(0x119),'X-TD-Client-Version':_0x38b43b};return _0x3f4634&&(_0x4aa968[_0x18221a(0x123)]=_0x18221a(0x121)+_0x3f4634),_0x4aa968;}export function toHeaderRecord(_0x3e5810){const _0x44f358=a25_0x98c0,_0xf60fd0={};for(const [_0x15a21c,_0x10aeb4]of Object[_0x44f358(0x120)](_0x3e5810)){_0x10aeb4!==undefined&&(_0xf60fd0[_0x15a21c]=_0x10aeb4);}return _0xf60fd0;}export function getTrinoHeaders(_0x5e4835,_0x5dea84){const _0x382fd7=a25_0x98c0,_0x35848b=getAuthHeaders(_0x5e4835,_0x5dea84),_0x17a504=toHeaderRecord(_0x35848b);return delete _0x17a504[_0x382fd7(0x123)],_0x5dea84&&(_0x17a504[_0x382fd7(0x11d)]=_0x5dea84),_0x17a504;}export function validateAPIKey(_0x50215d){const _0x502a17=a25_0x98c0;return _0x50215d[_0x502a17(0x11c)]('/')&&_0x50215d[_0x502a17(0x112)]('/')['length']===0x2;}export function hasAPIKey(_0x4677a2){const _0x5923d9=getAPIKey(_0x4677a2);return _0x5923d9!==undefined&&validateAPIKey(_0x5923d9);}function a25_0x338d(){const _0x2f4e9b=['7kbQdPa','replace','2283985zvmkBO',';\x20node/','split','1913344CkjXQj','0.0.0','tdx/','669467mInUSZ','utf-8','1996614KjRVug','tdx','4209968KjIByy','214437VxLcfT','includes','X-Trino-User','version','url','entries','TD1\x20','parse','Authorization','30986946yWhBUh','32SNEcpU'];a25_0x338d=function(){return _0x2f4e9b;};return a25_0x338d();}
1
+ (function(_0x5d5114,_0x13b528){const _0x2b4154=a26_0x7bf1,_0x3e4dec=_0x5d5114();while(!![]){try{const _0x5d2303=-parseInt(_0x2b4154(0xe3))/0x1+-parseInt(_0x2b4154(0xd4))/0x2+-parseInt(_0x2b4154(0xe6))/0x3*(parseInt(_0x2b4154(0xe1))/0x4)+parseInt(_0x2b4154(0xdd))/0x5*(parseInt(_0x2b4154(0xd7))/0x6)+-parseInt(_0x2b4154(0xda))/0x7*(parseInt(_0x2b4154(0xd6))/0x8)+-parseInt(_0x2b4154(0xd5))/0x9+parseInt(_0x2b4154(0xea))/0xa*(parseInt(_0x2b4154(0xd8))/0xb);if(_0x5d2303===_0x13b528)break;else _0x3e4dec['push'](_0x3e4dec['shift']());}catch(_0xc9bcf5){_0x3e4dec['push'](_0x3e4dec['shift']());}}}(a26_0x418f,0x5ae7c));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0xd600a2=a26_0x7bf1;try{const _0x3e448c=fileURLToPath(import.meta[_0xd600a2(0xdb)]),_0x56be90=dirname(_0x3e448c),_0xe8fb4=join(_0x56be90,_0xd600a2(0xe4)),_0x256961=JSON[_0xd600a2(0xe2)](readFileSync(_0xe8fb4,'utf-8'));return _0x256961[_0xd600a2(0xd9)];}catch{return _0xd600a2(0xe8);}}function a26_0x7bf1(_0x246375,_0x121778){const _0x418fa4=a26_0x418f();return a26_0x7bf1=function(_0x7bf109,_0x55401c){_0x7bf109=_0x7bf109-0xd4;let _0x2ad6ec=_0x418fa4[_0x7bf109];return _0x2ad6ec;},a26_0x7bf1(_0x246375,_0x121778);}export function getUserAgent(){const _0x5c8163=a26_0x7bf1,_0xa2c158=getVersion(),_0x549df3=platform(),_0x295174=process[_0x5c8163(0xd9)][_0x5c8163(0xde)]('v','');return _0x5c8163(0xe0)+_0xa2c158+'\x20('+_0x549df3+_0x5c8163(0xe5)+_0x295174+')';}export function getAuthHeaders(_0x3f5038,_0x23d867){const _0x36c347=a26_0x7bf1,_0x4383a6=getVersion(),_0x4cd628={'User-Agent':getUserAgent(),'X-TD-Client':_0x36c347(0xdc),'X-TD-Client-Version':_0x4383a6};return _0x23d867&&(_0x4cd628[_0x36c347(0xeb)]='TD1\x20'+_0x23d867),_0x4cd628;}export function toHeaderRecord(_0x148432){const _0x129d2b={};for(const [_0xd1ccfb,_0x507386]of Object['entries'](_0x148432)){_0x507386!==undefined&&(_0x129d2b[_0xd1ccfb]=_0x507386);}return _0x129d2b;}function a26_0x418f(){const _0x20f536=['../../package.json',';\x20node/','1194FXozQG','includes','0.0.0','X-Trino-User','7646890MZouor','Authorization','371016VXTlJK','3204603LBPaey','168TIHWNi','6mLyIZX','22DuuGDh','version','8253AqyUsY','url','tdx','2638705wwfkfl','replace','length','tdx/','6400hBgvWC','parse','481637LjtLaZ'];a26_0x418f=function(){return _0x20f536;};return a26_0x418f();}export function getTrinoHeaders(_0x1eec39,_0x14e1b2){const _0x1c84f3=a26_0x7bf1,_0x17c20f=getAuthHeaders(_0x1eec39,_0x14e1b2),_0x3ebc1c=toHeaderRecord(_0x17c20f);return delete _0x3ebc1c[_0x1c84f3(0xeb)],_0x14e1b2&&(_0x3ebc1c[_0x1c84f3(0xe9)]=_0x14e1b2),_0x3ebc1c;}export function validateAPIKey(_0x5f1c57){const _0x2ce4b5=a26_0x7bf1;return _0x5f1c57[_0x2ce4b5(0xe7)]('/')&&_0x5f1c57['split']('/')[_0x2ce4b5(0xdf)]===0x2;}export function hasAPIKey(_0x1a7029){const _0x2c0bbd=getAPIKey(_0x1a7029);return _0x2c0bbd!==undefined&&validateAPIKey(_0x2c0bbd);}
@@ -1 +1 @@
1
- (function(_0x1e6771,_0x46245c){const _0x3f6d69=a26_0x1073,_0x759829=_0x1e6771();while(!![]){try{const _0x4730b7=parseInt(_0x3f6d69(0x1b6))/0x1*(-parseInt(_0x3f6d69(0x1d9))/0x2)+parseInt(_0x3f6d69(0x1e4))/0x3+parseInt(_0x3f6d69(0x1c3))/0x4+parseInt(_0x3f6d69(0x1df))/0x5+-parseInt(_0x3f6d69(0x1d2))/0x6*(parseInt(_0x3f6d69(0x1ca))/0x7)+-parseInt(_0x3f6d69(0x1c9))/0x8*(-parseInt(_0x3f6d69(0x1de))/0x9)+parseInt(_0x3f6d69(0x1e6))/0xa*(parseInt(_0x3f6d69(0x1d0))/0xb);if(_0x4730b7===_0x46245c)break;else _0x759829['push'](_0x759829['shift']());}catch(_0x5804de){_0x759829['push'](_0x759829['shift']());}}}(a26_0x3480,0x48860));import{homedir}from'os';function a26_0x3480(){const _0x9d81f5=['TD_API_KEY_','parse','105052SOndEe','TD_API_KEY','.env.','ap03','replace','us01','1418840CuPmdN','7945JVHOav','profile:\x20','jp01','eu01','tdx','stg-us01','33oRsXdB','map','2712YwMzFj','env:\x20TD_API_KEY','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','.env','global:\x20','.config','Warning:\x20Unknown\x20site\x20\x27','464336OtvUHu','TDX_CACHE_DIR','TDX_CONFIG_DIR','env','match','18TimhRK','1039235rHIlek','env:\x20','toUpperCase','stg-jp01','join','1201368vqziIB','stg-ap03','176560JawmIg','error','.cache','apiKeys','existsSync','llm_default_project','\x27,\x20defaulting\x20to\x20us01','startsWith','dev-us01','1uYbBPn','dev-eu01','profile','readFileSync','ap02','endsWith','utf-8','profiles','warn','trim','\x20(TD_API_KEY)'];a26_0x3480=function(){return _0x9d81f5;};return a26_0x3480();}import{join}from'path';function a26_0x1073(_0x3c38cd,_0x57a213){const _0x348067=a26_0x3480();return a26_0x1073=function(_0x10730e,_0x278aeb){_0x10730e=_0x10730e-0x1af;let _0x222cc8=_0x348067[_0x10730e];return _0x222cc8;},a26_0x1073(_0x3c38cd,_0x57a213);}import{existsSync,readFileSync,writeFileSync,mkdirSync}from'fs';import*as a26_0x4a96fb from'node:fs';import*as a26_0x6eb913 from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';export function getConfigDir(){const _0x3dfd13=a26_0x1073;return process[_0x3dfd13(0x1dc)][_0x3dfd13(0x1db)]||join(homedir(),_0x3dfd13(0x1d7),_0x3dfd13(0x1ce));}export function getConfigFile(){const _0x1ae4fb=a26_0x1073;return join(getConfigDir(),_0x1ae4fb(0x1d5));}export function getCacheDir(){const _0x2326ba=a26_0x1073;return process[_0x2326ba(0x1dc)][_0x2326ba(0x1da)]||join(homedir(),_0x2326ba(0x1af),_0x2326ba(0x1ce));}export function getLLMProjectCacheFile(){const _0x4c369a=a26_0x1073;return join(getCacheDir(),_0x4c369a(0x1b2));}export function readCachedLLMProject(){const _0x376d1d=a26_0x1073;try{const _0x1b8709=getLLMProjectCacheFile();if(!existsSync(_0x1b8709))return null;return readFileSync(_0x1b8709,_0x376d1d(0x1bc))[_0x376d1d(0x1bf)]();}catch{return null;}}export function writeCachedLLMProject(_0x4da0b3){const _0x3ea5df=a26_0x1073;try{const _0x5dc76d=getCacheDir(),_0x3aeb8b=getLLMProjectCacheFile();!existsSync(_0x5dc76d)&&mkdirSync(_0x5dc76d,{'recursive':!![]}),writeFileSync(_0x3aeb8b,_0x4da0b3,'utf-8');}catch(_0x2fb5d6){console[_0x3ea5df(0x1e7)]('Warning:\x20Failed\x20to\x20cache\x20LLM\x20project\x20name:',_0x2fb5d6);}}export function parseEnvFile(_0x28e194){const _0x3ae25c=a26_0x1073,_0x2577a1={};for(const _0xf54b38 of _0x28e194['split']('\x0a')){const _0x335a71=_0xf54b38['trim']();if(!_0x335a71||_0x335a71[_0x3ae25c(0x1b4)]('#'))continue;const _0x4f7241=_0x335a71[_0x3ae25c(0x1dd)](/^([^=]+)=(.*)$/);if(_0x4f7241){const _0x3e09ac=_0x4f7241[0x1][_0x3ae25c(0x1bf)]();let _0x5a50c2=_0x4f7241[0x2][_0x3ae25c(0x1bf)]();(_0x5a50c2[_0x3ae25c(0x1b4)]('\x22')&&_0x5a50c2[_0x3ae25c(0x1bb)]('\x22')||_0x5a50c2['startsWith']('\x27')&&_0x5a50c2[_0x3ae25c(0x1bb)]('\x27'))&&(_0x5a50c2=_0x5a50c2['slice'](0x1,-0x1)),_0x2577a1[_0x3e09ac]=_0x5a50c2;}}return _0x2577a1;}export function readUserConfig(){const _0x3bb311=a26_0x1073,_0x107119=getConfigFile();if(!existsSync(_0x107119))return{};try{const _0x11ebce=readFileSync(_0x107119,'utf-8');return parseEnvFile(_0x11ebce);}catch(_0x42898b){return console[_0x3bb311(0x1be)](_0x3bb311(0x1d4)+_0x107119+':',_0x42898b),{};}}export function resolveSite(_0x28d49d){const _0x2336e3=a26_0x1073,_0x5c10df=[_0x2336e3(0x1c8),_0x2336e3(0x1cc),'eu01',_0x2336e3(0x1ba),_0x2336e3(0x1c6),_0x2336e3(0x1b5),_0x2336e3(0x1b7),'stg-us01',_0x2336e3(0x1e2),_0x2336e3(0x1e5)];if(_0x5c10df['includes'](_0x28d49d))return _0x28d49d;if(_0x28d49d in SITE_ALIASES)return SITE_ALIASES[_0x28d49d];return console['warn'](_0x2336e3(0x1d8)+_0x28d49d+_0x2336e3(0x1b3)),_0x2336e3(0x1c8);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0xa4d073,_0x185f76){const _0x45c526=a26_0x1073,_0x5918fe=_0xa4d073[_0x45c526(0x1e1)]()[_0x45c526(0x1c7)](/-/g,'_'),_0x16e13e=_0x45c526(0x1c1)+_0x5918fe;if(process[_0x45c526(0x1dc)][_0x16e13e])return process[_0x45c526(0x1dc)][_0x16e13e];if(process[_0x45c526(0x1dc)][_0x45c526(0x1c4)])return process['env'][_0x45c526(0x1c4)];const _0x52283d=_0x185f76||getActiveProfileName();if(_0x52283d){const _0x451cb5=loadProfileEnv(_0x52283d);if(_0x451cb5){if(_0x451cb5[_0x16e13e])return _0x451cb5[_0x16e13e];if(_0x451cb5['TD_API_KEY'])return _0x451cb5[_0x45c526(0x1c4)];}}const _0x469004=loadUserConfigOnce();if(_0x469004[_0x16e13e])return _0x469004[_0x16e13e];if(_0x469004[_0x45c526(0x1c4)])return _0x469004[_0x45c526(0x1c4)];return undefined;}export function getAPIKeySource(_0x588d1b,_0x3ef725){const _0x4b13af=a26_0x1073,_0x1e1eb0=_0x4b13af(0x1c1)+_0x588d1b[_0x4b13af(0x1e1)]()[_0x4b13af(0x1c7)](/-/g,'_');if(process[_0x4b13af(0x1dc)][_0x1e1eb0])return _0x4b13af(0x1e0)+_0x1e1eb0;if(process[_0x4b13af(0x1dc)]['TD_API_KEY'])return _0x4b13af(0x1d3);const _0x4eb4c3=_0x3ef725||getActiveProfileName();if(_0x4eb4c3){const _0x386ad1=loadProfileEnv(_0x4eb4c3);if(_0x386ad1){if(_0x386ad1[_0x1e1eb0])return _0x4b13af(0x1cb)+_0x4eb4c3+'\x20('+_0x1e1eb0+')';if(_0x386ad1[_0x4b13af(0x1c4)])return _0x4b13af(0x1cb)+_0x4eb4c3+_0x4b13af(0x1c0);}}const _0x35f5fc=loadUserConfigOnce(),_0x353e42=getConfigFile();if(_0x35f5fc[_0x1e1eb0])return _0x4b13af(0x1d6)+_0x353e42+'\x20('+_0x1e1eb0+')';if(_0x35f5fc['TD_API_KEY'])return _0x4b13af(0x1d6)+_0x353e42+_0x4b13af(0x1c0);return null;}function loadProfileEnv(_0x4bade5){const _0x56a38a=a26_0x1073,_0x220470=a26_0x6eb913['join'](getConfigDir(),_0x56a38a(0x1c5)+_0x4bade5);if(a26_0x4a96fb['existsSync'](_0x220470)){validateSecureFilePermissions(_0x220470);try{const _0xcf850a=a26_0x4a96fb[_0x56a38a(0x1b9)](_0x220470,_0x56a38a(0x1bc));return parseEnvFile(_0xcf850a);}catch(_0x577d82){console[_0x56a38a(0x1be)]('Warning:\x20Failed\x20to\x20load\x20'+_0x220470+':\x20'+_0x577d82);}}const _0x39eb86=a26_0x6eb913[_0x56a38a(0x1e3)](getConfigDir(),_0x56a38a(0x1bd),_0x4bade5,_0x56a38a(0x1d5));if(a26_0x4a96fb[_0x56a38a(0x1b1)](_0x39eb86)){validateSecureFilePermissions(_0x39eb86);try{const _0x1b7cbc=a26_0x4a96fb['readFileSync'](_0x39eb86,_0x56a38a(0x1bc));return parseEnvFile(_0x1b7cbc);}catch(_0x2b0eaf){return console['warn']('Warning:\x20Failed\x20to\x20load\x20'+_0x39eb86+':\x20'+_0x2b0eaf),null;}}return null;}function getActiveProfileName(){const _0x312191=a26_0x1073,_0x20c8a9=a26_0x6eb913[_0x312191(0x1e3)](getConfigDir(),'tdx.json');if(!a26_0x4a96fb[_0x312191(0x1b1)](_0x20c8a9))return null;try{const _0x1b6c46=a26_0x4a96fb[_0x312191(0x1b9)](_0x20c8a9,_0x312191(0x1bc)),_0x10c26c=JSON[_0x312191(0x1c2)](_0x1b6c46);return _0x10c26c[_0x312191(0x1b8)]||null;}catch{return null;}}export function saveAPIKey(_0x336380,_0x11c63e){const _0x1f5517=a26_0x1073,_0x45d2f4=getConfigDir(),_0x223c72=getConfigFile();!existsSync(_0x45d2f4)&&mkdirSync(_0x45d2f4,{'recursive':!![],'mode':0x1c0});const _0x4129c6=readUserConfig(),_0x54730f=_0x336380[_0x1f5517(0x1e1)]()['replace'](/-/g,'_');_0x4129c6['TD_API_KEY_'+_0x54730f]=_0x11c63e;const _0x338d68=Object['entries'](_0x4129c6)[_0x1f5517(0x1d1)](([_0x8a2427,_0x37c569])=>_0x8a2427+'='+_0x37c569);writeFileSync(_0x223c72,_0x338d68[_0x1f5517(0x1e3)]('\x0a')+'\x0a',{'mode':0x180});}export function loadConfig(){const _0x281b58=a26_0x1073,_0x17c8ea={'apiKeys':{},'defaultSite':_0x281b58(0x1c8)},_0x3e7316=[_0x281b58(0x1c8),_0x281b58(0x1cc),_0x281b58(0x1cd),_0x281b58(0x1ba),'ap03',_0x281b58(0x1b5),_0x281b58(0x1b7),_0x281b58(0x1cf),_0x281b58(0x1e2),_0x281b58(0x1e5)];for(const _0x52d49a of _0x3e7316){const _0x144d4d=getAPIKey(_0x52d49a);_0x144d4d&&(_0x17c8ea[_0x281b58(0x1b0)][_0x52d49a]=_0x144d4d);}return _0x17c8ea;}
1
+ function a27_0x18ba(_0x55f876,_0x3cd731){const _0x1d938c=a27_0x1d93();return a27_0x18ba=function(_0x18ba7a,_0x5923d5){_0x18ba7a=_0x18ba7a-0x199;let _0x4e9644=_0x1d938c[_0x18ba7a];return _0x4e9644;},a27_0x18ba(_0x55f876,_0x3cd731);}(function(_0x2beab3,_0x5d8ca0){const _0x475036=a27_0x18ba,_0x844d81=_0x2beab3();while(!![]){try{const _0x46bd31=parseInt(_0x475036(0x1b3))/0x1*(parseInt(_0x475036(0x1c8))/0x2)+parseInt(_0x475036(0x1ca))/0x3*(-parseInt(_0x475036(0x1c0))/0x4)+parseInt(_0x475036(0x1bb))/0x5+parseInt(_0x475036(0x1c5))/0x6+-parseInt(_0x475036(0x1a5))/0x7+-parseInt(_0x475036(0x1b7))/0x8+-parseInt(_0x475036(0x1af))/0x9;if(_0x46bd31===_0x5d8ca0)break;else _0x844d81['push'](_0x844d81['shift']());}catch(_0x55628c){_0x844d81['push'](_0x844d81['shift']());}}}(a27_0x1d93,0x195e8));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync}from'fs';import*as a27_0x3218f2 from'node:fs';import*as a27_0x280c28 from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';export function getConfigDir(){const _0x27c10b=a27_0x18ba;return process[_0x27c10b(0x1bf)][_0x27c10b(0x1b0)]||join(homedir(),_0x27c10b(0x1cc),_0x27c10b(0x19d));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getCacheDir(){const _0x3b7add=a27_0x18ba;return process[_0x3b7add(0x1bf)]['TDX_CACHE_DIR']||join(homedir(),'.cache',_0x3b7add(0x19d));}export function getLLMProjectCacheFile(){const _0x418daf=a27_0x18ba;return join(getCacheDir(),_0x418daf(0x1c2));}function a27_0x1d93(){const _0x5fbc5=['join','replace','1011690paNbkf','split','startsWith','2FonZQf','parse','555123QqMMfj','\x27,\x20defaulting\x20to\x20us01','.config','TD_API_KEY_','Warning:\x20Failed\x20to\x20load\x20','stg-us01','existsSync','tdx','Warning:\x20Unknown\x20site\x20\x27','entries','.env','readFileSync','TD_API_KEY','toUpperCase','apiKeys','874132mtFYYg','env:\x20TD_API_KEY','error','endsWith','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','ap02','warn','dev-us01','profile:\x20','trim','214137TlNPgV','TDX_CONFIG_DIR','stg-jp01','dev-eu01','188359TPgzMM','utf-8','global:\x20','us01','558768AJUpre','env:\x20','stg-ap03','\x20(TD_API_KEY)','752470QZwLSU','eu01','jp01','ap03','env','4hdbAgO','Warning:\x20Failed\x20to\x20cache\x20LLM\x20project\x20name:','llm_default_project'];a27_0x1d93=function(){return _0x5fbc5;};return a27_0x1d93();}export function readCachedLLMProject(){const _0x55dc71=a27_0x18ba;try{const _0x245ff4=getLLMProjectCacheFile();if(!existsSync(_0x245ff4))return null;return readFileSync(_0x245ff4,_0x55dc71(0x1b4))[_0x55dc71(0x1ae)]();}catch{return null;}}export function writeCachedLLMProject(_0x2b01b7){const _0x1cc955=a27_0x18ba;try{const _0x1bd2da=getCacheDir(),_0x4cfbea=getLLMProjectCacheFile();!existsSync(_0x1bd2da)&&mkdirSync(_0x1bd2da,{'recursive':!![]}),writeFileSync(_0x4cfbea,_0x2b01b7,'utf-8');}catch(_0x47afe1){console[_0x1cc955(0x1a7)](_0x1cc955(0x1c1),_0x47afe1);}}export function parseEnvFile(_0x240644){const _0x32b24a=a27_0x18ba,_0x1e19cf={};for(const _0x9ac038 of _0x240644[_0x32b24a(0x1c6)]('\x0a')){const _0x3e93b9=_0x9ac038[_0x32b24a(0x1ae)]();if(!_0x3e93b9||_0x3e93b9[_0x32b24a(0x1c7)]('#'))continue;const _0x37774c=_0x3e93b9['match'](/^([^=]+)=(.*)$/);if(_0x37774c){const _0x21be3e=_0x37774c[0x1][_0x32b24a(0x1ae)]();let _0x53b398=_0x37774c[0x2][_0x32b24a(0x1ae)]();(_0x53b398['startsWith']('\x22')&&_0x53b398['endsWith']('\x22')||_0x53b398[_0x32b24a(0x1c7)]('\x27')&&_0x53b398[_0x32b24a(0x1a8)]('\x27'))&&(_0x53b398=_0x53b398['slice'](0x1,-0x1)),_0x1e19cf[_0x21be3e]=_0x53b398;}}return _0x1e19cf;}export function readUserConfig(){const _0x2edfb5=a27_0x18ba,_0x5b2970=getConfigFile();if(!existsSync(_0x5b2970))return{};try{const _0x11594b=readFileSync(_0x5b2970,_0x2edfb5(0x1b4));return parseEnvFile(_0x11594b);}catch(_0x3d01ef){return console[_0x2edfb5(0x1ab)](_0x2edfb5(0x1a9)+_0x5b2970+':',_0x3d01ef),{};}}export function resolveSite(_0x154289){const _0x110555=a27_0x18ba,_0x588323=[_0x110555(0x1b6),'jp01',_0x110555(0x1bc),_0x110555(0x1aa),_0x110555(0x1be),_0x110555(0x1ac),'dev-eu01',_0x110555(0x19b),_0x110555(0x1b1),_0x110555(0x1b9)];if(_0x588323['includes'](_0x154289))return _0x154289;if(_0x154289 in SITE_ALIASES)return SITE_ALIASES[_0x154289];return console[_0x110555(0x1ab)](_0x110555(0x19e)+_0x154289+_0x110555(0x1cb)),_0x110555(0x1b6);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x1543d3,_0x512def){const _0x4609fd=a27_0x18ba,_0x710831=_0x1543d3['toUpperCase']()['replace'](/-/g,'_'),_0x2675cb='TD_API_KEY_'+_0x710831;if(process[_0x4609fd(0x1bf)][_0x2675cb])return process['env'][_0x2675cb];if(process['env'][_0x4609fd(0x1a2)])return process[_0x4609fd(0x1bf)][_0x4609fd(0x1a2)];const _0x51b9c3=_0x512def||getActiveProfileName();if(_0x51b9c3){const _0x1d9a25=loadProfileEnv(_0x51b9c3);if(_0x1d9a25){if(_0x1d9a25[_0x2675cb])return _0x1d9a25[_0x2675cb];if(_0x1d9a25[_0x4609fd(0x1a2)])return _0x1d9a25['TD_API_KEY'];}}const _0xf544a=loadUserConfigOnce();if(_0xf544a[_0x2675cb])return _0xf544a[_0x2675cb];if(_0xf544a['TD_API_KEY'])return _0xf544a['TD_API_KEY'];return undefined;}export function getAPIKeySource(_0xb4244c,_0x1886a0){const _0x3de6ae=a27_0x18ba,_0x1885d6=_0x3de6ae(0x199)+_0xb4244c[_0x3de6ae(0x1a3)]()[_0x3de6ae(0x1c4)](/-/g,'_');if(process[_0x3de6ae(0x1bf)][_0x1885d6])return _0x3de6ae(0x1b8)+_0x1885d6;if(process['env'][_0x3de6ae(0x1a2)])return _0x3de6ae(0x1a6);const _0x4f5f71=_0x1886a0||getActiveProfileName();if(_0x4f5f71){const _0x470001=loadProfileEnv(_0x4f5f71);if(_0x470001){if(_0x470001[_0x1885d6])return _0x3de6ae(0x1ad)+_0x4f5f71+'\x20('+_0x1885d6+')';if(_0x470001[_0x3de6ae(0x1a2)])return _0x3de6ae(0x1ad)+_0x4f5f71+'\x20(TD_API_KEY)';}}const _0x2d84db=loadUserConfigOnce(),_0x53bbde=getConfigFile();if(_0x2d84db[_0x1885d6])return _0x3de6ae(0x1b5)+_0x53bbde+'\x20('+_0x1885d6+')';if(_0x2d84db[_0x3de6ae(0x1a2)])return _0x3de6ae(0x1b5)+_0x53bbde+_0x3de6ae(0x1ba);return null;}function loadProfileEnv(_0xbd011b){const _0x8011fb=a27_0x18ba,_0x1fe01f=a27_0x280c28[_0x8011fb(0x1c3)](getConfigDir(),'.env.'+_0xbd011b);if(a27_0x3218f2[_0x8011fb(0x19c)](_0x1fe01f)){validateSecureFilePermissions(_0x1fe01f);try{const _0x5c2d9d=a27_0x3218f2[_0x8011fb(0x1a1)](_0x1fe01f,_0x8011fb(0x1b4));return parseEnvFile(_0x5c2d9d);}catch(_0x174b97){console[_0x8011fb(0x1ab)](_0x8011fb(0x19a)+_0x1fe01f+':\x20'+_0x174b97);}}const _0x488210=a27_0x280c28[_0x8011fb(0x1c3)](getConfigDir(),'profiles',_0xbd011b,_0x8011fb(0x1a0));if(a27_0x3218f2['existsSync'](_0x488210)){validateSecureFilePermissions(_0x488210);try{const _0xae9d9c=a27_0x3218f2[_0x8011fb(0x1a1)](_0x488210,_0x8011fb(0x1b4));return parseEnvFile(_0xae9d9c);}catch(_0x2077cf){return console[_0x8011fb(0x1ab)](_0x8011fb(0x19a)+_0x488210+':\x20'+_0x2077cf),null;}}return null;}function getActiveProfileName(){const _0x288f52=a27_0x18ba,_0x33bd4c=a27_0x280c28['join'](getConfigDir(),'tdx.json');if(!a27_0x3218f2['existsSync'](_0x33bd4c))return null;try{const _0x14fc72=a27_0x3218f2['readFileSync'](_0x33bd4c,'utf-8'),_0x25ed74=JSON[_0x288f52(0x1c9)](_0x14fc72);return _0x25ed74['profile']||null;}catch{return null;}}export function saveAPIKey(_0x163843,_0x57425c){const _0x418d87=a27_0x18ba,_0x26537d=getConfigDir(),_0x300083=getConfigFile();!existsSync(_0x26537d)&&mkdirSync(_0x26537d,{'recursive':!![],'mode':0x1c0});const _0x153052=readUserConfig(),_0x9a7138=_0x163843[_0x418d87(0x1a3)]()[_0x418d87(0x1c4)](/-/g,'_');_0x153052['TD_API_KEY_'+_0x9a7138]=_0x57425c;const _0x2430f0=Object[_0x418d87(0x19f)](_0x153052)['map'](([_0x5bdc96,_0x3d8460])=>_0x5bdc96+'='+_0x3d8460);writeFileSync(_0x300083,_0x2430f0[_0x418d87(0x1c3)]('\x0a')+'\x0a',{'mode':0x180});}export function loadConfig(){const _0x1ec4c9=a27_0x18ba,_0x4ec23f={'apiKeys':{},'defaultSite':'us01'},_0x4e25f7=['us01',_0x1ec4c9(0x1bd),_0x1ec4c9(0x1bc),_0x1ec4c9(0x1aa),_0x1ec4c9(0x1be),_0x1ec4c9(0x1ac),_0x1ec4c9(0x1b2),'stg-us01',_0x1ec4c9(0x1b1),_0x1ec4c9(0x1b9)];for(const _0x565778 of _0x4e25f7){const _0x1e7add=getAPIKey(_0x565778);_0x1e7add&&(_0x4ec23f[_0x1ec4c9(0x1a4)][_0x565778]=_0x1e7add);}return _0x4ec23f;}
@@ -1 +1 @@
1
- const a27_0x3d7e13=a27_0x4ff8;function a27_0x4ff8(_0x42dcca,_0x59bb36){const _0x197d9f=a27_0x197d();return a27_0x4ff8=function(_0x4ff8a6,_0x5b3f7f){_0x4ff8a6=_0x4ff8a6-0x1c1;let _0x5b5f06=_0x197d9f[_0x4ff8a6];return _0x5b5f06;},a27_0x4ff8(_0x42dcca,_0x59bb36);}(function(_0x1e79f1,_0x151667){const _0x34673b=a27_0x4ff8,_0x3aef81=_0x1e79f1();while(!![]){try{const _0x998962=-parseInt(_0x34673b(0x1f1))/0x1+-parseInt(_0x34673b(0x1fd))/0x2*(-parseInt(_0x34673b(0x1c8))/0x3)+-parseInt(_0x34673b(0x1ee))/0x4*(parseInt(_0x34673b(0x1c6))/0x5)+parseInt(_0x34673b(0x1fc))/0x6+parseInt(_0x34673b(0x1d0))/0x7*(-parseInt(_0x34673b(0x1f4))/0x8)+-parseInt(_0x34673b(0x1c2))/0x9+parseInt(_0x34673b(0x1da))/0xa;if(_0x998962===_0x151667)break;else _0x3aef81['push'](_0x3aef81['shift']());}catch(_0x21ca2c){_0x3aef81['push'](_0x3aef81['shift']());}}}(a27_0x197d,0x89cee));import{resolveSite,getAPIKey,getConfigDir}from'./config.js';import{loadSessionContext}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';function a27_0x197d(){const _0x4db6da=['CLI\x20flag:\x20--','profile:\x20','14wwWMYb','injectIntoOptions','log','entries','(active)','Session','join','project','.json','displayWithSources','21742300RSXNBR','getSource',':\x20none','tdx.json','layers','cliFlags','Project','llm_project','session','us01','loadGlobalConfig','verbose','database',':\x20none\x20(using\x20session:\x20','globalCredentials','existsSync','profileCredentials','config','\x0a[configuration\x20files]','sessions','4agJOPs','parent_segment','parentSegment','650687kMVUOI','string','ppid','3012848HwrvCe','toString','configFiles','parse','global','[context]','not\x20set','Global','1619892SbXEhj','74PwJkfm','llmProject','sessionId','Profile','549297WdaBRn','apiKey','profiles','profile','2534555oMolfk','default','7467qCpLky','getParameters','.env','replace','site','activeProfile'];a27_0x197d=function(){return _0x4db6da;};return a27_0x197d();}import*as a27_0x2bdb72 from'node:fs';import*as a27_0x51964d from'node:path';export class GlobalContext{[a27_0x3d7e13(0x1cc)];[a27_0x3d7e13(0x1e6)];[a27_0x3d7e13(0x1ef)];[a27_0x3d7e13(0x1e1)];[a27_0x3d7e13(0x1c3)];['verbose'];[a27_0x3d7e13(0x1de)];['activeProfile'];[a27_0x3d7e13(0x1ff)];[a27_0x3d7e13(0x1f6)];constructor(_0x4a21fe){const _0x456b52=a27_0x3d7e13;this['sessionId']=_0x4a21fe[_0x456b52(0x1e2)]||process[_0x456b52(0x1f3)][_0x456b52(0x1f5)]();const _0x2b0b9d=loadSessionContext(_0x4a21fe['session']),_0x16a173=loadProjectConfig(),_0x9cc3ad=this[_0x456b52(0x1e4)]();this['activeProfile']=_0x4a21fe['profile']||_0x2b0b9d?.['profile']||_0x9cc3ad[_0x456b52(0x1c5)]||getActiveProfile();const _0x3ea2ed=this[_0x456b52(0x1cd)]?loadProfile(this[_0x456b52(0x1cd)]):null,_0x144075=_0x5e0c31=>{const _0x5b18e7=_0x456b52;if(!_0x5e0c31)return{};const _0x352e2b=_0x5e0c31,_0x3410f3={};for(const [_0x82e445,_0x127fe6]of Object[_0x5b18e7(0x1d3)](_0x352e2b)){typeof _0x127fe6===_0x5b18e7(0x1f2)&&(_0x3410f3[_0x82e445]=_0x127fe6);}return _0x3410f3;},_0x36362a={};if(_0x4a21fe[_0x456b52(0x1cc)]&&_0x4a21fe[_0x456b52(0x1cc)]!==_0x456b52(0x1e3))_0x36362a[_0x456b52(0x1cc)]=_0x4a21fe['site'];const _0x4487c9=_0x2b0b9d?.[_0x456b52(0x1e6)],_0x5d6bbc=_0x16a173?.[_0x456b52(0x1e6)],_0x42a0c9=_0x3ea2ed?.[_0x456b52(0x1eb)]?.[_0x456b52(0x1e6)],_0x18bdc5=_0x9cc3ad[_0x456b52(0x1e6)];_0x4a21fe[_0x456b52(0x1e6)]&&(_0x4a21fe[_0x456b52(0x1e6)]!==_0x4487c9&&_0x4a21fe[_0x456b52(0x1e6)]!==_0x5d6bbc&&_0x4a21fe[_0x456b52(0x1e6)]!==_0x42a0c9&&_0x4a21fe[_0x456b52(0x1e6)]!==_0x18bdc5)&&(_0x36362a[_0x456b52(0x1e6)]=_0x4a21fe[_0x456b52(0x1e6)]);if(_0x4a21fe[_0x456b52(0x1f0)])_0x36362a[_0x456b52(0x1ef)]=_0x4a21fe[_0x456b52(0x1f0)];if(_0x4a21fe['llmProject'])_0x36362a['llm_project']=_0x4a21fe[_0x456b52(0x1fe)];if(_0x4a21fe[_0x456b52(0x1c5)])_0x36362a[_0x456b52(0x1c5)]=_0x4a21fe[_0x456b52(0x1c5)];this[_0x456b52(0x1de)]={'cliFlags':_0x36362a,'session':_0x144075(_0x2b0b9d),'project':_0x144075(_0x16a173),'profile':_0x144075(_0x3ea2ed?.['config']),'global':_0x144075(_0x9cc3ad)};const _0x279ab5={...this[_0x456b52(0x1de)]['global'],...this[_0x456b52(0x1de)][_0x456b52(0x1c5)],...this['layers'][_0x456b52(0x1d7)],...this[_0x456b52(0x1de)][_0x456b52(0x1e2)],...this[_0x456b52(0x1de)][_0x456b52(0x1df)]},_0xa8faaf=_0x279ab5[_0x456b52(0x1cc)]||_0x456b52(0x1e3);this[_0x456b52(0x1cc)]=resolveSite(_0xa8faaf),this[_0x456b52(0x1e6)]=_0x279ab5[_0x456b52(0x1e6)],this[_0x456b52(0x1ef)]=_0x279ab5[_0x456b52(0x1ef)],this[_0x456b52(0x1e1)]=_0x279ab5[_0x456b52(0x1e1)],this[_0x456b52(0x1e5)]=_0x4a21fe['verbose']||![],this[_0x456b52(0x1c3)]=getAPIKey(this[_0x456b52(0x1cc)],this[_0x456b52(0x1cd)]||undefined);const _0x3b9b48=getConfigDir(),_0x71da54=a27_0x51964d[_0x456b52(0x1d6)](_0x3b9b48,_0x456b52(0x1ed),this[_0x456b52(0x1ff)]+_0x456b52(0x1d8)),_0x18b146=findProjectConfigPath(),_0x2c7df1=a27_0x51964d[_0x456b52(0x1d6)](_0x3b9b48,_0x456b52(0x1dd)),_0x1b1c60=a27_0x51964d[_0x456b52(0x1d6)](_0x3b9b48,_0x456b52(0x1ca));let _0x40a6e1=null,_0x377349=null;this['activeProfile']&&(_0x40a6e1=a27_0x51964d['join'](_0x3b9b48,_0x456b52(0x1c4),this[_0x456b52(0x1cd)],_0x456b52(0x1dd)),_0x377349=a27_0x51964d['join'](_0x3b9b48,_0x456b52(0x1c4),this[_0x456b52(0x1cd)],_0x456b52(0x1ca))),this[_0x456b52(0x1f6)]={'session':a27_0x2bdb72[_0x456b52(0x1e9)](_0x71da54)?_0x71da54:null,'project':_0x18b146,'profile':_0x40a6e1&&a27_0x2bdb72[_0x456b52(0x1e9)](_0x40a6e1)?_0x40a6e1:null,'profileCredentials':_0x377349&&a27_0x2bdb72[_0x456b52(0x1e9)](_0x377349)?_0x377349:null,'global':a27_0x2bdb72[_0x456b52(0x1e9)](_0x2c7df1)?_0x2c7df1:null,'globalCredentials':a27_0x2bdb72[_0x456b52(0x1e9)](_0x1b1c60)?_0x1b1c60:null};}[a27_0x3d7e13(0x1db)](_0x23eb1c,_0x15bcac){const _0x369d85=a27_0x3d7e13;if(!_0x15bcac)return _0x369d85(0x1fa);const _0x45fd0a=_0x15bcac;if(this[_0x369d85(0x1de)][_0x369d85(0x1df)][_0x23eb1c]===_0x45fd0a){if(_0x23eb1c===_0x369d85(0x1cc)&&_0x45fd0a==='us01'&&!this[_0x369d85(0x1de)][_0x369d85(0x1e2)][_0x369d85(0x1cc)]&&!this[_0x369d85(0x1de)][_0x369d85(0x1d7)][_0x369d85(0x1cc)]&&!this[_0x369d85(0x1de)][_0x369d85(0x1c5)][_0x369d85(0x1cc)]&&!this[_0x369d85(0x1de)][_0x369d85(0x1f8)][_0x369d85(0x1cc)])return _0x369d85(0x1c7);return _0x369d85(0x1ce)+_0x23eb1c[_0x369d85(0x1cb)](/_/g,'-');}if(this[_0x369d85(0x1de)][_0x369d85(0x1e2)][_0x23eb1c]===_0x45fd0a)return _0x369d85(0x1e2);if(this[_0x369d85(0x1de)][_0x369d85(0x1d7)][_0x23eb1c]===_0x45fd0a)return _0x369d85(0x1d7);if(this[_0x369d85(0x1de)][_0x369d85(0x1c5)][_0x23eb1c]===_0x45fd0a)return _0x369d85(0x1cf)+this[_0x369d85(0x1cd)];if(this[_0x369d85(0x1de)]['global'][_0x23eb1c]===_0x45fd0a)return _0x369d85(0x1f8);return'default';}[a27_0x3d7e13(0x1e4)](){const _0x38a14d=a27_0x3d7e13,_0x1a4659=a27_0x51964d[_0x38a14d(0x1d6)](getConfigDir(),'tdx.json');if(!a27_0x2bdb72[_0x38a14d(0x1e9)](_0x1a4659))return{};try{const _0x4ebd2a=a27_0x2bdb72['readFileSync'](_0x1a4659,'utf-8');return JSON[_0x38a14d(0x1f7)](_0x4ebd2a);}catch{return{};}}[a27_0x3d7e13(0x1d1)](_0x18651b){const _0x43ae16=a27_0x3d7e13;_0x18651b['site']=this[_0x43ae16(0x1cc)],!_0x18651b['database']&&this[_0x43ae16(0x1e6)]&&(_0x18651b[_0x43ae16(0x1e6)]=this[_0x43ae16(0x1e6)]),!_0x18651b['parentSegment']&&this['parent_segment']&&(_0x18651b[_0x43ae16(0x1f0)]=this[_0x43ae16(0x1ef)]),!_0x18651b[_0x43ae16(0x1fe)]&&this[_0x43ae16(0x1e1)]&&(_0x18651b[_0x43ae16(0x1fe)]=this[_0x43ae16(0x1e1)]);}[a27_0x3d7e13(0x1c9)](){const _0x2524fa=a27_0x3d7e13;return[{'key':_0x2524fa(0x1cc),'value':this['site']},{'key':_0x2524fa(0x1e6),'value':this['database']},{'key':_0x2524fa(0x1ef),'value':this['parent_segment']},{'key':_0x2524fa(0x1e1),'value':this[_0x2524fa(0x1e1)]},{'key':_0x2524fa(0x1c5),'value':this['activeProfile']||undefined}];}['display'](){const _0x5991e7=a27_0x3d7e13;console[_0x5991e7(0x1d2)](_0x5991e7(0x1f9));for(const {key:_0x5b8ecf,value:_0x246e00}of this[_0x5991e7(0x1c9)]()){_0x246e00&&console[_0x5991e7(0x1d2)](_0x5b8ecf+':\x20'+_0x246e00);}}[a27_0x3d7e13(0x1d9)](){const _0x4bc1cf=a27_0x3d7e13;console[_0x4bc1cf(0x1d2)]('[context]');for(const {key:_0x2553e2,value:_0x571b02}of this[_0x4bc1cf(0x1c9)]()){if(_0x571b02){const _0x22eedd=_0x2553e2==='profile'?_0x4bc1cf(0x1d4):'('+this['getSource'](_0x2553e2,_0x571b02)+')';console[_0x4bc1cf(0x1d2)](_0x2553e2+':\x20'+_0x571b02+'\x20'+_0x22eedd);}}console[_0x4bc1cf(0x1d2)](_0x4bc1cf(0x1ec));const _0x1b11dc=[{'label':_0x4bc1cf(0x1d5),'path':this[_0x4bc1cf(0x1f6)][_0x4bc1cf(0x1e2)],'extra':'(session:\x20'+this[_0x4bc1cf(0x1ff)]+')'},{'label':_0x4bc1cf(0x1e0),'path':this[_0x4bc1cf(0x1f6)][_0x4bc1cf(0x1d7)]},{'label':_0x4bc1cf(0x1c1),'path':this[_0x4bc1cf(0x1f6)][_0x4bc1cf(0x1c5)]},{'label':'Profile\x20Credentials','path':this['configFiles'][_0x4bc1cf(0x1ea)]},{'label':_0x4bc1cf(0x1fb),'path':this['configFiles']['global']},{'label':'Global\x20Credentials','path':this['configFiles'][_0x4bc1cf(0x1e8)]}];for(const {label:_0x5105e3,path:_0x8d7db3,extra:_0x3b8224}of _0x1b11dc){if(_0x8d7db3)console[_0x4bc1cf(0x1d2)](_0x5105e3+':\x20'+_0x8d7db3+'\x20✓'+(_0x3b8224?'\x20'+_0x3b8224:''));else{if(_0x5105e3===_0x4bc1cf(0x1d5))console['log'](_0x5105e3+_0x4bc1cf(0x1e7)+this[_0x4bc1cf(0x1ff)]+')');else(_0x5105e3===_0x4bc1cf(0x1e0)||_0x5105e3===_0x4bc1cf(0x1fb))&&console[_0x4bc1cf(0x1d2)](_0x5105e3+_0x4bc1cf(0x1dc));}}}}
1
+ function a28_0x311a(_0x28da32,_0x3c1343){const _0x4a87e5=a28_0x4a87();return a28_0x311a=function(_0x311a85,_0x19905a){_0x311a85=_0x311a85-0x1e2;let _0x24d12f=_0x4a87e5[_0x311a85];return _0x24d12f;},a28_0x311a(_0x28da32,_0x3c1343);}const a28_0x31bd09=a28_0x311a;(function(_0x1e0bbd,_0x33c4e2){const _0x29db48=a28_0x311a,_0x536381=_0x1e0bbd();while(!![]){try{const _0x5ea53d=parseInt(_0x29db48(0x20e))/0x1*(parseInt(_0x29db48(0x1e4))/0x2)+parseInt(_0x29db48(0x202))/0x3*(-parseInt(_0x29db48(0x1ea))/0x4)+-parseInt(_0x29db48(0x1ec))/0x5*(-parseInt(_0x29db48(0x220))/0x6)+-parseInt(_0x29db48(0x20a))/0x7*(-parseInt(_0x29db48(0x1e7))/0x8)+parseInt(_0x29db48(0x1f7))/0x9+-parseInt(_0x29db48(0x1f8))/0xa*(-parseInt(_0x29db48(0x218))/0xb)+parseInt(_0x29db48(0x1f5))/0xc*(-parseInt(_0x29db48(0x1e6))/0xd);if(_0x5ea53d===_0x33c4e2)break;else _0x536381['push'](_0x536381['shift']());}catch(_0x444739){_0x536381['push'](_0x536381['shift']());}}}(a28_0x4a87,0x89baf));import{resolveSite,getAPIKey,getConfigDir}from'./config.js';function a28_0x4a87(){const _0x6a439b=['Project','existsSync','3653174oRRwXq','llmProject','[context]','string','1gSBqWc','session','CLI\x20flag:\x20--',':\x20none\x20(using\x20session:\x20','Session','cliFlags','project','getSource','default','.json','187eedtPW','join','apiKey','profiles','parentSegment',':\x20none','ppid','layers','54VcpjNp','parent_segment','display','activeProfile','site','verbose','(session:\x20','29894PFnEXC','config','353171sLmlRW','8ooLSxW','Profile','us01','92xTofZb','tdx.json','275635HyEiIT','llm_project','database','entries','loadGlobalConfig','profileCredentials','parse','\x0a[configuration\x20files]','(active)','288IVDJXJ','log','4045311nUMknp','468290lDXgPe','toString','sessionId','globalCredentials','profile','replace','Global\x20Credentials','configFiles','injectIntoOptions','.env','138573pyZXoN','getParameters','sessions','Profile\x20Credentials','global','Global'];a28_0x4a87=function(){return _0x6a439b;};return a28_0x4a87();}import{loadSessionContext}from'./session.js';import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';import*as a28_0x1df6f2 from'node:fs';import*as a28_0x38883f from'node:path';export class GlobalContext{['site'];[a28_0x31bd09(0x1ee)];['parent_segment'];['llm_project'];[a28_0x31bd09(0x21a)];[a28_0x31bd09(0x1e2)];['layers'];[a28_0x31bd09(0x223)];[a28_0x31bd09(0x1fa)];[a28_0x31bd09(0x1ff)];constructor(_0x54032d){const _0x44426a=a28_0x31bd09;this[_0x44426a(0x1fa)]=_0x54032d[_0x44426a(0x20f)]||process[_0x44426a(0x21e)][_0x44426a(0x1f9)]();const _0x17370c=loadSessionContext(_0x54032d[_0x44426a(0x20f)]),_0x3efb7b=loadProjectConfig(),_0x39d2f0=this[_0x44426a(0x1f0)]();this[_0x44426a(0x223)]=_0x54032d[_0x44426a(0x1fc)]||_0x17370c?.[_0x44426a(0x1fc)]||_0x39d2f0[_0x44426a(0x1fc)]||getActiveProfile();const _0x337ca4=this[_0x44426a(0x223)]?loadProfile(this[_0x44426a(0x223)]):null,_0x497bc0=_0x412003=>{const _0x8dd5f4=_0x44426a;if(!_0x412003)return{};const _0x3a9f7a=_0x412003,_0x2c9589={};for(const [_0x6fbad0,_0x11cede]of Object[_0x8dd5f4(0x1ef)](_0x3a9f7a)){typeof _0x11cede===_0x8dd5f4(0x20d)&&(_0x2c9589[_0x6fbad0]=_0x11cede);}return _0x2c9589;},_0x3afb30={};if(_0x54032d[_0x44426a(0x224)]&&_0x54032d[_0x44426a(0x224)]!==_0x44426a(0x1e9))_0x3afb30[_0x44426a(0x224)]=_0x54032d[_0x44426a(0x224)];const _0x1348cf=_0x17370c?.[_0x44426a(0x1ee)],_0x2b9c13=_0x3efb7b?.[_0x44426a(0x1ee)],_0x43e1c3=_0x337ca4?.[_0x44426a(0x1e5)]?.['database'],_0x5b88fa=_0x39d2f0[_0x44426a(0x1ee)];_0x54032d[_0x44426a(0x1ee)]&&(_0x54032d[_0x44426a(0x1ee)]!==_0x1348cf&&_0x54032d['database']!==_0x2b9c13&&_0x54032d[_0x44426a(0x1ee)]!==_0x43e1c3&&_0x54032d[_0x44426a(0x1ee)]!==_0x5b88fa)&&(_0x3afb30[_0x44426a(0x1ee)]=_0x54032d['database']);if(_0x54032d[_0x44426a(0x21c)])_0x3afb30[_0x44426a(0x221)]=_0x54032d[_0x44426a(0x21c)];if(_0x54032d[_0x44426a(0x20b)])_0x3afb30[_0x44426a(0x1ed)]=_0x54032d[_0x44426a(0x20b)];if(_0x54032d[_0x44426a(0x1fc)])_0x3afb30[_0x44426a(0x1fc)]=_0x54032d['profile'];this['layers']={'cliFlags':_0x3afb30,'session':_0x497bc0(_0x17370c),'project':_0x497bc0(_0x3efb7b),'profile':_0x497bc0(_0x337ca4?.['config']),'global':_0x497bc0(_0x39d2f0)};const _0x34c52c={...this[_0x44426a(0x21f)]['global'],...this[_0x44426a(0x21f)]['profile'],...this['layers'][_0x44426a(0x214)],...this['layers'][_0x44426a(0x20f)],...this[_0x44426a(0x21f)][_0x44426a(0x213)]},_0x1114dd=_0x34c52c['site']||_0x44426a(0x1e9);this[_0x44426a(0x224)]=resolveSite(_0x1114dd),this[_0x44426a(0x1ee)]=_0x34c52c[_0x44426a(0x1ee)],this[_0x44426a(0x221)]=_0x34c52c[_0x44426a(0x221)],this[_0x44426a(0x1ed)]=_0x34c52c[_0x44426a(0x1ed)],this['verbose']=_0x54032d['verbose']||![],this[_0x44426a(0x21a)]=getAPIKey(this[_0x44426a(0x224)],this[_0x44426a(0x223)]||undefined);const _0x3d021e=getConfigDir(),_0x5b5ad6=a28_0x38883f['join'](_0x3d021e,_0x44426a(0x204),this[_0x44426a(0x1fa)]+_0x44426a(0x217)),_0x2c7105=findProjectConfigPath(),_0xc3ee2e=a28_0x38883f[_0x44426a(0x219)](_0x3d021e,_0x44426a(0x1eb)),_0x242652=a28_0x38883f[_0x44426a(0x219)](_0x3d021e,_0x44426a(0x201));let _0x533238=null,_0x209027=null;this['activeProfile']&&(_0x533238=a28_0x38883f['join'](_0x3d021e,_0x44426a(0x21b),this[_0x44426a(0x223)],'tdx.json'),_0x209027=a28_0x38883f[_0x44426a(0x219)](_0x3d021e,_0x44426a(0x21b),this[_0x44426a(0x223)],_0x44426a(0x201))),this[_0x44426a(0x1ff)]={'session':a28_0x1df6f2[_0x44426a(0x209)](_0x5b5ad6)?_0x5b5ad6:null,'project':_0x2c7105,'profile':_0x533238&&a28_0x1df6f2[_0x44426a(0x209)](_0x533238)?_0x533238:null,'profileCredentials':_0x209027&&a28_0x1df6f2['existsSync'](_0x209027)?_0x209027:null,'global':a28_0x1df6f2[_0x44426a(0x209)](_0xc3ee2e)?_0xc3ee2e:null,'globalCredentials':a28_0x1df6f2[_0x44426a(0x209)](_0x242652)?_0x242652:null};}[a28_0x31bd09(0x215)](_0x42a712,_0x2c606a){const _0x4affa3=a28_0x31bd09;if(!_0x2c606a)return'not\x20set';const _0x8464e0=_0x2c606a;if(this['layers'][_0x4affa3(0x213)][_0x42a712]===_0x8464e0){if(_0x42a712===_0x4affa3(0x224)&&_0x8464e0===_0x4affa3(0x1e9)&&!this['layers'][_0x4affa3(0x20f)][_0x4affa3(0x224)]&&!this[_0x4affa3(0x21f)][_0x4affa3(0x214)][_0x4affa3(0x224)]&&!this['layers'][_0x4affa3(0x1fc)][_0x4affa3(0x224)]&&!this[_0x4affa3(0x21f)][_0x4affa3(0x206)][_0x4affa3(0x224)])return _0x4affa3(0x216);return _0x4affa3(0x210)+_0x42a712[_0x4affa3(0x1fd)](/_/g,'-');}if(this[_0x4affa3(0x21f)][_0x4affa3(0x20f)][_0x42a712]===_0x8464e0)return _0x4affa3(0x20f);if(this[_0x4affa3(0x21f)][_0x4affa3(0x214)][_0x42a712]===_0x8464e0)return _0x4affa3(0x214);if(this[_0x4affa3(0x21f)][_0x4affa3(0x1fc)][_0x42a712]===_0x8464e0)return'profile:\x20'+this[_0x4affa3(0x223)];if(this[_0x4affa3(0x21f)]['global'][_0x42a712]===_0x8464e0)return _0x4affa3(0x206);return _0x4affa3(0x216);}[a28_0x31bd09(0x1f0)](){const _0x4b44a8=a28_0x31bd09,_0x2d368b=a28_0x38883f[_0x4b44a8(0x219)](getConfigDir(),_0x4b44a8(0x1eb));if(!a28_0x1df6f2[_0x4b44a8(0x209)](_0x2d368b))return{};try{const _0x2a8ee3=a28_0x1df6f2['readFileSync'](_0x2d368b,'utf-8');return JSON[_0x4b44a8(0x1f2)](_0x2a8ee3);}catch{return{};}}[a28_0x31bd09(0x200)](_0x4e0b8e){const _0x22d702=a28_0x31bd09;_0x4e0b8e[_0x22d702(0x224)]=this['site'],!_0x4e0b8e[_0x22d702(0x1ee)]&&this[_0x22d702(0x1ee)]&&(_0x4e0b8e['database']=this[_0x22d702(0x1ee)]),!_0x4e0b8e[_0x22d702(0x21c)]&&this['parent_segment']&&(_0x4e0b8e[_0x22d702(0x21c)]=this['parent_segment']),!_0x4e0b8e[_0x22d702(0x20b)]&&this[_0x22d702(0x1ed)]&&(_0x4e0b8e[_0x22d702(0x20b)]=this[_0x22d702(0x1ed)]);}[a28_0x31bd09(0x203)](){const _0x3aeab1=a28_0x31bd09;return[{'key':_0x3aeab1(0x224),'value':this[_0x3aeab1(0x224)]},{'key':_0x3aeab1(0x1ee),'value':this[_0x3aeab1(0x1ee)]},{'key':_0x3aeab1(0x221),'value':this[_0x3aeab1(0x221)]},{'key':'llm_project','value':this[_0x3aeab1(0x1ed)]},{'key':_0x3aeab1(0x1fc),'value':this[_0x3aeab1(0x223)]||undefined}];}[a28_0x31bd09(0x222)](){const _0x5b33d6=a28_0x31bd09;console[_0x5b33d6(0x1f6)](_0x5b33d6(0x20c));for(const {key:_0x2e0a38,value:_0x2d5a0f}of this['getParameters']()){_0x2d5a0f&&console[_0x5b33d6(0x1f6)](_0x2e0a38+':\x20'+_0x2d5a0f);}}['displayWithSources'](){const _0x4351b8=a28_0x31bd09;console[_0x4351b8(0x1f6)](_0x4351b8(0x20c));for(const {key:_0xff8abe,value:_0x427da0}of this[_0x4351b8(0x203)]()){if(_0x427da0){const _0x5d9e7d=_0xff8abe===_0x4351b8(0x1fc)?_0x4351b8(0x1f4):'('+this[_0x4351b8(0x215)](_0xff8abe,_0x427da0)+')';console['log'](_0xff8abe+':\x20'+_0x427da0+'\x20'+_0x5d9e7d);}}console[_0x4351b8(0x1f6)](_0x4351b8(0x1f3));const _0x7b673a=[{'label':_0x4351b8(0x212),'path':this[_0x4351b8(0x1ff)][_0x4351b8(0x20f)],'extra':_0x4351b8(0x1e3)+this[_0x4351b8(0x1fa)]+')'},{'label':_0x4351b8(0x208),'path':this[_0x4351b8(0x1ff)]['project']},{'label':_0x4351b8(0x1e8),'path':this[_0x4351b8(0x1ff)][_0x4351b8(0x1fc)]},{'label':_0x4351b8(0x205),'path':this['configFiles'][_0x4351b8(0x1f1)]},{'label':_0x4351b8(0x207),'path':this[_0x4351b8(0x1ff)][_0x4351b8(0x206)]},{'label':_0x4351b8(0x1fe),'path':this[_0x4351b8(0x1ff)][_0x4351b8(0x1fb)]}];for(const {label:_0x4f43c3,path:_0x1d6442,extra:_0x30d6d5}of _0x7b673a){if(_0x1d6442)console[_0x4351b8(0x1f6)](_0x4f43c3+':\x20'+_0x1d6442+'\x20✓'+(_0x30d6d5?'\x20'+_0x30d6d5:''));else{if(_0x4f43c3===_0x4351b8(0x212))console[_0x4351b8(0x1f6)](_0x4f43c3+_0x4351b8(0x211)+this['sessionId']+')');else(_0x4f43c3==='Project'||_0x4f43c3===_0x4351b8(0x207))&&console[_0x4351b8(0x1f6)](_0x4f43c3+_0x4351b8(0x21d));}}}}
@@ -1 +1 @@
1
- function a28_0x5a1c(){const _0x38c395=['set','filter','696072yPfCmH','parse','Profile\x20','map','\x27:\x20unknown\x20config\x20key\x20\x27','llm_agent','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','\x27:\x20config\x20must\x20be\x20an\x20object','\x27\x20will\x20be\x20ignored','2LxhOTz','values','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','Warning:\x20Profile\x20\x27','parent_segment','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','site','readFileSync','\x20does\x20not\x20exist','\x22\x20\x22','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','description','\x20already\x20exists','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','13692EFFiMp','string','969157reSbex','entries','profile',':\x20Invalid\x20JSON\x20syntax','Profile\x20\x27','1127276msggnL','warn','push','1990MFchjR','.env','name','test','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20profile\x20configuration.\x20Use\x20.env\x20file\x20instead.','message','some','profiles','Invalid\x20profile\x20name:\x20','toISOString','sort','lastUsed','keys','Error:\x20','find','2711870nxXYhN','llm_project','writeFileSync','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','isDirectory','utf-8','localeCompare','user','rmSync','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','stringify','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','120kqDFXd','object','To\x20migrate:','includes','api_key','metadata','9ALnbuu','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','local','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','database','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','\x0aWarning:\x20Failed\x20to\x20parse\x20','\x20\x201.\x20Edit:\x20','from','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','215937YlpgMB','join','242gjddew','length','6970782AtDqkO','existsSync','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','tdx.json','directory'];a28_0x5a1c=function(){return _0x38c395;};return a28_0x5a1c();}(function(_0x89e2d5,_0x4c5df6){const _0x330335=a28_0x23c6,_0x1044d9=_0x89e2d5();while(!![]){try{const _0x585895=parseInt(_0x330335(0x10e))/0x1*(parseInt(_0x330335(0xfe))/0x2)+-parseInt(_0x330335(0x137))/0x3*(-parseInt(_0x330335(0x113))/0x4)+-parseInt(_0x330335(0x116))/0x5*(parseInt(_0x330335(0x10c))/0x6)+parseInt(_0x330335(0xee))/0x7+-parseInt(_0x330335(0x131))/0x8*(parseInt(_0x330335(0xea))/0x9)+parseInt(_0x330335(0x125))/0xa+-parseInt(_0x330335(0xec))/0xb*(parseInt(_0x330335(0xf5))/0xc);if(_0x585895===_0x4c5df6)break;else _0x1044d9['push'](_0x1044d9['shift']());}catch(_0x54c077){_0x1044d9['push'](_0x1044d9['shift']());}}}(a28_0x5a1c,0x83314));import*as a28_0x4abcfe from'node:fs';import*as a28_0x3e7f36 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';function a28_0x23c6(_0x57ac34,_0x5ceda1){const _0x5a1c8e=a28_0x5a1c();return a28_0x23c6=function(_0x23c692,_0x482d7a){_0x23c692=_0x23c692-0xe5;let _0x284c8b=_0x5a1c8e[_0x23c692];return _0x284c8b;},a28_0x23c6(_0x57ac34,_0x5ceda1);}export function getProfileParams(_0x46c07a){const _0x1c82d7=a28_0x23c6,_0x1f5503={};if(!_0x46c07a)return _0x1f5503;for(const [_0x4074af,_0x91bcef]of Object[_0x1c82d7(0x10f)](_0x46c07a)){_0x4074af!==_0x1c82d7(0x109)&&_0x91bcef!==undefined&&(_0x1f5503[_0x4074af]=_0x91bcef);}return _0x1f5503;}export function getProfilesDir(){const _0x2cb065=a28_0x23c6;return a28_0x3e7f36[_0x2cb065(0xeb)](getConfigDir(),_0x2cb065(0x11d));}function getProfileDir(_0x591f45){const _0xe0999b=a28_0x23c6;return a28_0x3e7f36[_0xe0999b(0xeb)](getProfilesDir(),_0x591f45);}function getProfileConfigPath(_0xe041f2){const _0x3b068d=a28_0x23c6;return a28_0x3e7f36[_0x3b068d(0xeb)](getProfileDir(_0xe041f2),_0x3b068d(0xf1));}function getProfileEnvPath(_0x4b70f7){const _0x51353f=a28_0x23c6;return a28_0x3e7f36['join'](getProfileDir(_0x4b70f7),_0x51353f(0x117));}function getGlobalConfigPath(){const _0x48a14c=a28_0x23c6;return a28_0x3e7f36[_0x48a14c(0xeb)](getConfigDir(),_0x48a14c(0xf1));}function validateProfileName(_0x15bf77){const _0x49d86f=a28_0x23c6;if(!/^[a-zA-Z0-9_-]+$/[_0x49d86f(0x119)](_0x15bf77))throw new Error(_0x49d86f(0x11e)+_0x15bf77+_0x49d86f(0x108));}function validateProfileConfig(_0x212b36,_0x9a56aa){const _0x3686a9=a28_0x23c6;if(typeof _0x212b36!==_0x3686a9(0x132)||_0x212b36===null)throw new Error(_0x3686a9(0x112)+_0x9a56aa+_0x3686a9(0xfc));const _0x26741e=[_0x3686a9(0x109),'site','database',_0x3686a9(0x102),_0x3686a9(0x126),_0x3686a9(0xfa)],_0xf1d548=_0x212b36;for(const _0xa90e02 of Object[_0x3686a9(0x122)](_0xf1d548)){!_0x26741e['includes'](_0xa90e02)&&console[_0x3686a9(0x114)](_0x3686a9(0x101)+_0x9a56aa+_0x3686a9(0xf9)+_0xa90e02+_0x3686a9(0xfd));}if(_0xf1d548[_0x3686a9(0x109)]!==undefined&&typeof _0xf1d548['description']!==_0x3686a9(0x10d))throw new Error(_0x3686a9(0x112)+_0x9a56aa+_0x3686a9(0x12e));if(_0xf1d548[_0x3686a9(0x104)]!==undefined&&typeof _0xf1d548[_0x3686a9(0x104)]!==_0x3686a9(0x10d))throw new Error(_0x3686a9(0x112)+_0x9a56aa+_0x3686a9(0xe5));if(_0xf1d548['database']!==undefined&&typeof _0xf1d548[_0x3686a9(0x13b)]!=='string')throw new Error(_0x3686a9(0x112)+_0x9a56aa+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0xf1d548[_0x3686a9(0x102)]!==undefined&&typeof _0xf1d548[_0x3686a9(0x102)]!==_0x3686a9(0x10d))throw new Error(_0x3686a9(0x112)+_0x9a56aa+'\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string');if(_0xf1d548[_0x3686a9(0x126)]!==undefined&&typeof _0xf1d548[_0x3686a9(0x126)]!==_0x3686a9(0x10d))throw new Error('Profile\x20\x27'+_0x9a56aa+_0x3686a9(0xfb));if(_0xf1d548[_0x3686a9(0xfa)]!==undefined&&typeof _0xf1d548['llm_agent']!==_0x3686a9(0x10d))throw new Error('Profile\x20\x27'+_0x9a56aa+_0x3686a9(0x103));return!![];}function loadProfilesFromTdxJson(_0x3d4285,_0x586fb8){const _0x1a10b1=a28_0x23c6;if(!a28_0x4abcfe[_0x1a10b1(0xef)](_0x3d4285))return[];try{const _0x2c60e0=a28_0x4abcfe['readFileSync'](_0x3d4285,'utf-8'),_0x1d664f=JSON[_0x1a10b1(0xf6)](_0x2c60e0);if(!_0x1d664f[_0x1a10b1(0x11d)]||typeof _0x1d664f[_0x1a10b1(0x11d)]!=='object')return[];const _0x5b5fd5=[];for(const [_0x16b632,_0x477c06]of Object['entries'](_0x1d664f[_0x1a10b1(0x11d)])){try{validateProfileConfig(_0x477c06,_0x16b632);const _0x2fcbea=getNewCredentialPath(_0x16b632),_0x40e574=getOldCredentialPath(_0x16b632),_0x5d5200=a28_0x4abcfe[_0x1a10b1(0xef)](_0x2fcbea)||a28_0x4abcfe[_0x1a10b1(0xef)](_0x40e574);_0x5b5fd5['push']({'name':_0x16b632,'config':_0x477c06,'metadata':{'name':_0x16b632,'createdAt':new Date()[_0x1a10b1(0x11f)]()},'hasCredentials':_0x5d5200,'scope':_0x586fb8});}catch(_0x261958){_0x261958 instanceof Error&&(console[_0x1a10b1(0x114)](_0x1a10b1(0x128)+_0x3d4285+':'),console[_0x1a10b1(0x114)]('\x20\x20'+_0x261958[_0x1a10b1(0x11b)]+'\x0a'));}}return _0x5b5fd5;}catch(_0x7bcd9a){return _0x7bcd9a instanceof SyntaxError?(console[_0x1a10b1(0x114)](_0x1a10b1(0xe6)+_0x3d4285+_0x1a10b1(0x111)),console[_0x1a10b1(0x114)](_0x1a10b1(0x123)+_0x7bcd9a[_0x1a10b1(0x11b)]+'\x0a')):console[_0x1a10b1(0x114)](_0x1a10b1(0xe9)+_0x3d4285+':\x20'+_0x7bcd9a+'\x0a'),[];}}export function getNewCredentialPath(_0x1b50d5){return a28_0x3e7f36['join'](getConfigDir(),'.env.'+_0x1b50d5);}function getOldCredentialPath(_0x5bd157){const _0xcf85eb=a28_0x23c6;return a28_0x3e7f36[_0xcf85eb(0xeb)](getProfilesDir(),_0x5bd157,_0xcf85eb(0x117));}function loadProfilesFromTdxJsonFiles(){const _0x4b694d=a28_0x23c6,_0x510d45=[],_0xa2af1a=findProjectConfigPath();_0xa2af1a&&_0x510d45['push'](...loadProfilesFromTdxJson(_0xa2af1a,_0x4b694d(0x139)));const _0x2959a4=a28_0x3e7f36['join'](getConfigDir(),_0x4b694d(0xf1));return _0x510d45[_0x4b694d(0x115)](...loadProfilesFromTdxJson(_0x2959a4,_0x4b694d(0x12c))),_0x510d45;}function loadProfilesFromDirectories(){const _0x39622c=a28_0x23c6,_0x53a713=getProfilesDir();if(!a28_0x4abcfe['existsSync'](_0x53a713))return[];try{return a28_0x4abcfe['readdirSync'](_0x53a713,{'withFileTypes':!![]})[_0x39622c(0xf4)](_0x520006=>_0x520006[_0x39622c(0x129)]())[_0x39622c(0xf8)](_0x5344b6=>_0x5344b6[_0x39622c(0x118)])[_0x39622c(0xf4)](_0x395955=>{const _0x133049=_0x39622c,_0x12ca51=getProfileConfigPath(_0x395955),_0x1f2d1e=getProfileEnvPath(_0x395955);return a28_0x4abcfe[_0x133049(0xef)](_0x12ca51)||a28_0x4abcfe[_0x133049(0xef)](_0x1f2d1e);})[_0x39622c(0xf8)](_0x6306e=>{const _0x42ce56=_0x39622c,_0x4ba969=loadProfileFromDirectory(_0x6306e);if(_0x4ba969)return{..._0x4ba969,'scope':_0x42ce56(0xf2)};return null;})[_0x39622c(0xf4)](_0x42ab2a=>_0x42ab2a!==null);}catch{return[];}}function loadProfileFromDirectory(_0xc37db3){const _0x404c42=a28_0x23c6,_0x478857=getProfileConfigPath(_0xc37db3),_0x306da2=getOldCredentialPath(_0xc37db3);if(!a28_0x4abcfe['existsSync'](_0x478857)&&!a28_0x4abcfe[_0x404c42(0xef)](_0x306da2))return null;let _0x2f68f8={},_0xcc5ee3={'name':_0xc37db3,'createdAt':new Date()[_0x404c42(0x11f)]()};if(a28_0x4abcfe[_0x404c42(0xef)](_0x478857))try{const _0x314db0=a28_0x4abcfe['readFileSync'](_0x478857,'utf-8'),_0x535627=JSON[_0x404c42(0xf6)](_0x314db0),{metadata:_0x4707d2,..._0x276181}=_0x535627;_0x2f68f8=_0x276181,_0x4707d2&&(_0xcc5ee3=_0x4707d2);}catch{}return{'name':_0xc37db3,'config':_0x2f68f8,'metadata':_0xcc5ee3,'hasCredentials':a28_0x4abcfe[_0x404c42(0xef)](_0x306da2),'scope':_0x404c42(0xf2)};}export function listProfiles(){const _0x208f78=a28_0x23c6,_0x552545=loadProfilesFromTdxJsonFiles(),_0x2fb2f5=loadProfilesFromDirectories();if(_0x2fb2f5[_0x208f78(0xed)]>0x0){const _0x3b767a=_0x2fb2f5[_0x208f78(0xf8)](_0x510fcd=>_0x510fcd[_0x208f78(0x118)])['join'](',\x20'),_0x5ccc65=getConfigDir();console['warn'](_0x208f78(0x100)+_0x3b767a),console[_0x208f78(0x114)](_0x208f78(0x10b)),console[_0x208f78(0x114)](_0x208f78(0xe7)+a28_0x3e7f36[_0x208f78(0xeb)](_0x5ccc65,_0x208f78(0xf1))),console[_0x208f78(0x114)](_0x208f78(0x130)),console[_0x208f78(0x114)](_0x208f78(0x13a));}const _0x559e36=[..._0x552545,..._0x2fb2f5],_0x3b684e=new Map();for(const _0x5768fb of _0x559e36){!_0x3b684e['has'](_0x5768fb[_0x208f78(0x118)])&&_0x3b684e[_0x208f78(0xf3)](_0x5768fb[_0x208f78(0x118)],_0x5768fb);}return Array[_0x208f78(0xe8)](_0x3b684e[_0x208f78(0xff)]())[_0x208f78(0x120)]((_0x13100e,_0x108d31)=>_0x13100e[_0x208f78(0x118)][_0x208f78(0x12b)](_0x108d31['name']));}export function profileExists(_0x479f42){const _0x1f8d3a=a28_0x23c6,_0xba3d7b=listProfiles();return _0xba3d7b[_0x1f8d3a(0x11c)](_0x42415f=>_0x42415f[_0x1f8d3a(0x118)]===_0x479f42);}export function loadProfile(_0x3a5dab){const _0x3a7cd4=a28_0x23c6;validateProfileName(_0x3a5dab);const _0x6ba2c3=listProfiles(),_0x3bfc45=_0x6ba2c3[_0x3a7cd4(0x124)](_0x39129e=>_0x39129e['name']===_0x3a5dab);return _0x3bfc45||null;}export function saveProfile(_0x22e170,_0x49fee3,_0xb2d2a1=![]){const _0x20ec72=a28_0x23c6;validateProfileName(_0x22e170);const _0x2d29e9=getProfileDir(_0x22e170),_0x5d03ba=getProfileConfigPath(_0x22e170);createSecureDirectory(_0x2d29e9);let _0x17a462;const _0x39a1b8=loadProfile(_0x22e170);_0x39a1b8?(_0x17a462=_0x39a1b8[_0x20ec72(0x136)],_0xb2d2a1&&(_0x17a462[_0x20ec72(0x121)]=new Date()['toISOString']())):_0x17a462={'name':_0x22e170,'createdAt':new Date()[_0x20ec72(0x11f)]()};const _0xd02b2c=JSON[_0x20ec72(0x12f)](_0x49fee3);if(_0xd02b2c['includes']('TD_API_KEY')||_0xd02b2c[_0x20ec72(0x134)]('apiKey')||_0xd02b2c['includes'](_0x20ec72(0x135)))throw new Error(_0x20ec72(0x11a));const _0x171743={..._0x49fee3,'metadata':_0x17a462};a28_0x4abcfe[_0x20ec72(0x127)](_0x5d03ba,JSON[_0x20ec72(0x12f)](_0x171743,null,0x2));}export function deleteProfile(_0x2c1543){const _0x184755=a28_0x23c6;validateProfileName(_0x2c1543);const _0x457995=getProfileDir(_0x2c1543);if(!a28_0x4abcfe['existsSync'](_0x457995))throw new Error(_0x184755(0xf7)+_0x2c1543+'\x20does\x20not\x20exist');a28_0x4abcfe[_0x184755(0x12d)](_0x457995,{'recursive':!![],'force':!![]});}export function getActiveProfile(){const _0x8742e5=a28_0x23c6,_0x18068e=getGlobalConfigPath();if(!a28_0x4abcfe[_0x8742e5(0xef)](_0x18068e))return null;try{const _0x48dfe3=a28_0x4abcfe[_0x8742e5(0x105)](_0x18068e,'utf-8'),_0x430144=JSON['parse'](_0x48dfe3);return _0x430144[_0x8742e5(0x110)]||null;}catch{return null;}}export function createProfile(_0x34a7b0,_0x37a7c4){const _0x210dca=a28_0x23c6;validateProfileName(_0x34a7b0);if(profileExists(_0x34a7b0))throw new Error(_0x210dca(0xf7)+_0x34a7b0+_0x210dca(0x10a));saveProfile(_0x34a7b0,_0x37a7c4);}export function saveProfileCredentials(_0x40bd9f,_0x3f189e){const _0x5dac3c=a28_0x23c6;validateProfileName(_0x40bd9f);if(!profileExists(_0x40bd9f))throw new Error('Profile\x20'+_0x40bd9f+_0x5dac3c(0x106));const _0x1efda3=getNewCredentialPath(_0x40bd9f);writeSecureFile(_0x1efda3,_0x3f189e);}export function loadProfileCredentials(_0x3344ad){const _0x141aa3=a28_0x23c6;validateProfileName(_0x3344ad);const _0xd9324c=getNewCredentialPath(_0x3344ad);if(a28_0x4abcfe['existsSync'](_0xd9324c))try{return a28_0x4abcfe[_0x141aa3(0x105)](_0xd9324c,_0x141aa3(0x12a));}catch{}const _0xd31474=getOldCredentialPath(_0x3344ad);if(a28_0x4abcfe['existsSync'](_0xd31474)){console[_0x141aa3(0x114)](_0x141aa3(0x138)+_0x3344ad+'\x27'),console[_0x141aa3(0x114)](_0x141aa3(0x133)),console[_0x141aa3(0x114)]('\x20\x20mv\x20\x22'+_0xd31474+_0x141aa3(0x107)+_0xd9324c+'\x22'),console[_0x141aa3(0x114)](_0x141aa3(0xf0));try{return a28_0x4abcfe[_0x141aa3(0x105)](_0xd31474,_0x141aa3(0x12a));}catch{return null;}}return null;}
1
+ (function(_0x34f8c6,_0x1dd2da){const _0x137749=a29_0x1094,_0x56fc2c=_0x34f8c6();while(!![]){try{const _0x210235=-parseInt(_0x137749(0x7a))/0x1+parseInt(_0x137749(0x83))/0x2*(-parseInt(_0x137749(0xb2))/0x3)+parseInt(_0x137749(0x88))/0x4+parseInt(_0x137749(0x8c))/0x5*(parseInt(_0x137749(0xbc))/0x6)+parseInt(_0x137749(0xb3))/0x7*(-parseInt(_0x137749(0x84))/0x8)+parseInt(_0x137749(0x75))/0x9+-parseInt(_0x137749(0x7e))/0xa;if(_0x210235===_0x1dd2da)break;else _0x56fc2c['push'](_0x56fc2c['shift']());}catch(_0x260c8a){_0x56fc2c['push'](_0x56fc2c['shift']());}}}(a29_0x18ef,0xd50db));import*as a29_0x7d1ca5 from'node:fs';import*as a29_0x20d995 from'node:path';import{getConfigDir}from'./config.js';import{createSecureDirectory,writeSecureFile}from'../utils/file-permissions.js';import{findProjectConfigPath}from'./project-config.js';export function getProfileParams(_0x347309){const _0xd5689=a29_0x1094,_0x112021={};if(!_0x347309)return _0x112021;for(const [_0x39b093,_0x24dec0]of Object['entries'](_0x347309)){_0x39b093!==_0xd5689(0x7c)&&_0x24dec0!==undefined&&(_0x112021[_0x39b093]=_0x24dec0);}return _0x112021;}export function getProfilesDir(){const _0xf75b07=a29_0x1094;return a29_0x20d995[_0xf75b07(0xa0)](getConfigDir(),_0xf75b07(0xb8));}function getProfileDir(_0x2b0576){return a29_0x20d995['join'](getProfilesDir(),_0x2b0576);}function getProfileConfigPath(_0x3a04e3){const _0x4e4fc3=a29_0x1094;return a29_0x20d995['join'](getProfileDir(_0x3a04e3),_0x4e4fc3(0x87));}function getProfileEnvPath(_0x9fe322){const _0x1a031f=a29_0x1094;return a29_0x20d995[_0x1a031f(0xa0)](getProfileDir(_0x9fe322),_0x1a031f(0xbb));}function getGlobalConfigPath(){const _0x2e0cdb=a29_0x1094;return a29_0x20d995['join'](getConfigDir(),_0x2e0cdb(0x87));}function validateProfileName(_0x28a17e){const _0x22b39b=a29_0x1094;if(!/^[a-zA-Z0-9_-]+$/[_0x22b39b(0x8e)](_0x28a17e))throw new Error(_0x22b39b(0xa9)+_0x28a17e+_0x22b39b(0x89));}function a29_0x18ef(){const _0x92ae99=['Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','13858002BGZmtB','llm_project','sort','TD_API_KEY','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','93189FjywnM','parse','description','Warning:\x20Profile\x20\x27','11695320KETnov','entries','has','Profile\x20','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','18LhJKKQ','8HRhQGV','\x27\x20will\x20be\x20ignored','profile','tdx.json','6506144gRNUDD','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','llm_agent','parent_segment','40iavdAh','user','test','toISOString','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','local','apiKey','isDirectory','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','keys','readdirSync','some','filter','\x0aWarning:\x20Failed\x20to\x20parse\x20','api_key','stringify','Error:\x20','localeCompare','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','\x22\x20\x22','join','warn','object','\x20\x20mv\x20\x22','push','string','find','message','map','Invalid\x20profile\x20name:\x20','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','site','existsSync','includes','readFileSync','To\x20migrate:','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','\x20does\x20not\x20exist','40647fLFdAb','11961383JFcQvG','\x27:\x20unknown\x20config\x20key\x20\x27','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','database','writeFileSync','profiles','utf-8','lastUsed','.env','599838BgzAoB','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','directory','.env.','name','Profile\x20\x27'];a29_0x18ef=function(){return _0x92ae99;};return a29_0x18ef();}function validateProfileConfig(_0xad8bc4,_0x57ee4e){const _0x4e1be3=a29_0x1094;if(typeof _0xad8bc4!==_0x4e1be3(0xa2)||_0xad8bc4===null)throw new Error(_0x4e1be3(0x73)+_0x57ee4e+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x310c31=['description','site',_0x4e1be3(0xb6),'parent_segment',_0x4e1be3(0x76),_0x4e1be3(0x8a)],_0x5b5220=_0xad8bc4;for(const _0x58226b of Object[_0x4e1be3(0x95)](_0x5b5220)){!_0x310c31[_0x4e1be3(0xad)](_0x58226b)&&console[_0x4e1be3(0xa1)](_0x4e1be3(0x7d)+_0x57ee4e+_0x4e1be3(0xb4)+_0x58226b+_0x4e1be3(0x85));}if(_0x5b5220[_0x4e1be3(0x7c)]!==undefined&&typeof _0x5b5220['description']!==_0x4e1be3(0xa5))throw new Error(_0x4e1be3(0x73)+_0x57ee4e+_0x4e1be3(0x94));if(_0x5b5220[_0x4e1be3(0xab)]!==undefined&&typeof _0x5b5220[_0x4e1be3(0xab)]!=='string')throw new Error('Profile\x20\x27'+_0x57ee4e+_0x4e1be3(0xaa));if(_0x5b5220['database']!==undefined&&typeof _0x5b5220[_0x4e1be3(0xb6)]!==_0x4e1be3(0xa5))throw new Error(_0x4e1be3(0x73)+_0x57ee4e+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x5b5220['parent_segment']!==undefined&&typeof _0x5b5220[_0x4e1be3(0x8b)]!==_0x4e1be3(0xa5))throw new Error('Profile\x20\x27'+_0x57ee4e+_0x4e1be3(0x90));if(_0x5b5220[_0x4e1be3(0x76)]!==undefined&&typeof _0x5b5220['llm_project']!==_0x4e1be3(0xa5))throw new Error(_0x4e1be3(0x73)+_0x57ee4e+_0x4e1be3(0x79));if(_0x5b5220[_0x4e1be3(0x8a)]!==undefined&&typeof _0x5b5220[_0x4e1be3(0x8a)]!==_0x4e1be3(0xa5))throw new Error(_0x4e1be3(0x73)+_0x57ee4e+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x54589f,_0x3ac282){const _0x5e928c=a29_0x1094;if(!a29_0x7d1ca5[_0x5e928c(0xac)](_0x54589f))return[];try{const _0x2a3284=a29_0x7d1ca5[_0x5e928c(0xae)](_0x54589f,_0x5e928c(0xb9)),_0x25b279=JSON[_0x5e928c(0x7b)](_0x2a3284);if(!_0x25b279[_0x5e928c(0xb8)]||typeof _0x25b279[_0x5e928c(0xb8)]!==_0x5e928c(0xa2))return[];const _0x3666ee=[];for(const [_0x563240,_0x2ae0a1]of Object[_0x5e928c(0x7f)](_0x25b279[_0x5e928c(0xb8)])){try{validateProfileConfig(_0x2ae0a1,_0x563240);const _0x47fb4b=getNewCredentialPath(_0x563240),_0x34cb30=getOldCredentialPath(_0x563240),_0x4ef623=a29_0x7d1ca5['existsSync'](_0x47fb4b)||a29_0x7d1ca5[_0x5e928c(0xac)](_0x34cb30);_0x3666ee[_0x5e928c(0xa4)]({'name':_0x563240,'config':_0x2ae0a1,'metadata':{'name':_0x563240,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x4ef623,'scope':_0x3ac282});}catch(_0x426d3f){_0x426d3f instanceof Error&&(console[_0x5e928c(0xa1)](_0x5e928c(0xb5)+_0x54589f+':'),console['warn']('\x20\x20'+_0x426d3f[_0x5e928c(0xa7)]+'\x0a'));}}return _0x3666ee;}catch(_0x300709){return _0x300709 instanceof SyntaxError?(console[_0x5e928c(0xa1)](_0x5e928c(0x99)+_0x54589f+':\x20Invalid\x20JSON\x20syntax'),console['warn'](_0x5e928c(0x9c)+_0x300709[_0x5e928c(0xa7)]+'\x0a')):console['warn'](_0x5e928c(0x9e)+_0x54589f+':\x20'+_0x300709+'\x0a'),[];}}function a29_0x1094(_0xdd3a7,_0x4766ba){const _0x18ef04=a29_0x18ef();return a29_0x1094=function(_0x109446,_0x55b287){_0x109446=_0x109446-0x73;let _0xd15baf=_0x18ef04[_0x109446];return _0xd15baf;},a29_0x1094(_0xdd3a7,_0x4766ba);}export function getNewCredentialPath(_0x352e7c){const _0x45537f=a29_0x1094;return a29_0x20d995['join'](getConfigDir(),_0x45537f(0xbf)+_0x352e7c);}function getOldCredentialPath(_0x374bbf){const _0x4af4cd=a29_0x1094;return a29_0x20d995[_0x4af4cd(0xa0)](getProfilesDir(),_0x374bbf,'.env');}function loadProfilesFromTdxJsonFiles(){const _0x80d1ad=a29_0x1094,_0xe34d65=[],_0x5d5b71=findProjectConfigPath();_0x5d5b71&&_0xe34d65[_0x80d1ad(0xa4)](...loadProfilesFromTdxJson(_0x5d5b71,_0x80d1ad(0x91)));const _0x4779fa=a29_0x20d995[_0x80d1ad(0xa0)](getConfigDir(),_0x80d1ad(0x87));return _0xe34d65['push'](...loadProfilesFromTdxJson(_0x4779fa,_0x80d1ad(0x8d))),_0xe34d65;}function loadProfilesFromDirectories(){const _0x17c411=a29_0x1094,_0xe1d055=getProfilesDir();if(!a29_0x7d1ca5[_0x17c411(0xac)](_0xe1d055))return[];try{return a29_0x7d1ca5[_0x17c411(0x96)](_0xe1d055,{'withFileTypes':!![]})[_0x17c411(0x98)](_0x43546f=>_0x43546f[_0x17c411(0x93)]())[_0x17c411(0xa8)](_0x8a6a94=>_0x8a6a94[_0x17c411(0xc0)])[_0x17c411(0x98)](_0x2e2e50=>{const _0x59ae03=_0x17c411,_0x48006a=getProfileConfigPath(_0x2e2e50),_0x156a7e=getProfileEnvPath(_0x2e2e50);return a29_0x7d1ca5[_0x59ae03(0xac)](_0x48006a)||a29_0x7d1ca5['existsSync'](_0x156a7e);})[_0x17c411(0xa8)](_0x332c98=>{const _0x182b2f=loadProfileFromDirectory(_0x332c98);if(_0x182b2f)return{..._0x182b2f,'scope':'directory'};return null;})[_0x17c411(0x98)](_0x552690=>_0x552690!==null);}catch{return[];}}function loadProfileFromDirectory(_0x34ac17){const _0x171e39=a29_0x1094,_0x2168f5=getProfileConfigPath(_0x34ac17),_0x183032=getOldCredentialPath(_0x34ac17);if(!a29_0x7d1ca5[_0x171e39(0xac)](_0x2168f5)&&!a29_0x7d1ca5[_0x171e39(0xac)](_0x183032))return null;let _0x4cda55={},_0x776df9={'name':_0x34ac17,'createdAt':new Date()[_0x171e39(0x8f)]()};if(a29_0x7d1ca5[_0x171e39(0xac)](_0x2168f5))try{const _0x273219=a29_0x7d1ca5[_0x171e39(0xae)](_0x2168f5,'utf-8'),_0x1e42df=JSON['parse'](_0x273219),{metadata:_0x554f76,..._0x52ee54}=_0x1e42df;_0x4cda55=_0x52ee54,_0x554f76&&(_0x776df9=_0x554f76);}catch{}return{'name':_0x34ac17,'config':_0x4cda55,'metadata':_0x776df9,'hasCredentials':a29_0x7d1ca5[_0x171e39(0xac)](_0x183032),'scope':_0x171e39(0xbe)};}export function listProfiles(){const _0x18498e=a29_0x1094,_0x5b28bb=loadProfilesFromTdxJsonFiles(),_0x44ae27=loadProfilesFromDirectories();if(_0x44ae27['length']>0x0){const _0x5203f9=_0x44ae27[_0x18498e(0xa8)](_0x299e14=>_0x299e14[_0x18498e(0xc0)])[_0x18498e(0xa0)](',\x20'),_0x3baa2d=getConfigDir();console['warn'](_0x18498e(0x82)+_0x5203f9),console[_0x18498e(0xa1)]('Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:'),console[_0x18498e(0xa1)]('\x20\x201.\x20Edit:\x20'+a29_0x20d995[_0x18498e(0xa0)](_0x3baa2d,_0x18498e(0x87))),console[_0x18498e(0xa1)]('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console[_0x18498e(0xa1)](_0x18498e(0xb0));}const _0x35f27d=[..._0x5b28bb,..._0x44ae27],_0x50948b=new Map();for(const _0x5eb43f of _0x35f27d){!_0x50948b[_0x18498e(0x80)](_0x5eb43f[_0x18498e(0xc0)])&&_0x50948b['set'](_0x5eb43f[_0x18498e(0xc0)],_0x5eb43f);}return Array['from'](_0x50948b['values']())[_0x18498e(0x77)]((_0x94723d,_0x52ba0d)=>_0x94723d[_0x18498e(0xc0)][_0x18498e(0x9d)](_0x52ba0d[_0x18498e(0xc0)]));}export function profileExists(_0x4a0e34){const _0x3bc1eb=a29_0x1094,_0x5acdbf=listProfiles();return _0x5acdbf[_0x3bc1eb(0x97)](_0x105be0=>_0x105be0[_0x3bc1eb(0xc0)]===_0x4a0e34);}export function loadProfile(_0x11c00b){const _0x40dad6=a29_0x1094;validateProfileName(_0x11c00b);const _0x1870c2=listProfiles(),_0x93fdd0=_0x1870c2[_0x40dad6(0xa6)](_0x39ba51=>_0x39ba51[_0x40dad6(0xc0)]===_0x11c00b);return _0x93fdd0||null;}export function saveProfile(_0xbf85db,_0x43ce6d,_0x50e097=![]){const _0x24e311=a29_0x1094;validateProfileName(_0xbf85db);const _0x4dafc9=getProfileDir(_0xbf85db),_0x102021=getProfileConfigPath(_0xbf85db);createSecureDirectory(_0x4dafc9);let _0x1c5299;const _0x1750fc=loadProfile(_0xbf85db);_0x1750fc?(_0x1c5299=_0x1750fc['metadata'],_0x50e097&&(_0x1c5299[_0x24e311(0xba)]=new Date()['toISOString']())):_0x1c5299={'name':_0xbf85db,'createdAt':new Date()['toISOString']()};const _0x4c0e5a=JSON[_0x24e311(0x9b)](_0x43ce6d);if(_0x4c0e5a[_0x24e311(0xad)](_0x24e311(0x78))||_0x4c0e5a[_0x24e311(0xad)](_0x24e311(0x92))||_0x4c0e5a[_0x24e311(0xad)](_0x24e311(0x9a)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20profile\x20configuration.\x20Use\x20.env\x20file\x20instead.');const _0x243e78={..._0x43ce6d,'metadata':_0x1c5299};a29_0x7d1ca5[_0x24e311(0xb7)](_0x102021,JSON['stringify'](_0x243e78,null,0x2));}export function deleteProfile(_0x499cb7){const _0xb8405a=a29_0x1094;validateProfileName(_0x499cb7);const _0x294412=getProfileDir(_0x499cb7);if(!a29_0x7d1ca5['existsSync'](_0x294412))throw new Error(_0xb8405a(0x81)+_0x499cb7+'\x20does\x20not\x20exist');a29_0x7d1ca5['rmSync'](_0x294412,{'recursive':!![],'force':!![]});}export function getActiveProfile(){const _0x5b3eed=a29_0x1094,_0x1edaf0=getGlobalConfigPath();if(!a29_0x7d1ca5[_0x5b3eed(0xac)](_0x1edaf0))return null;try{const _0x8f8505=a29_0x7d1ca5['readFileSync'](_0x1edaf0,_0x5b3eed(0xb9)),_0x1db168=JSON[_0x5b3eed(0x7b)](_0x8f8505);return _0x1db168[_0x5b3eed(0x86)]||null;}catch{return null;}}export function createProfile(_0x4872b3,_0x3f4583){const _0x1c9517=a29_0x1094;validateProfileName(_0x4872b3);if(profileExists(_0x4872b3))throw new Error(_0x1c9517(0x81)+_0x4872b3+'\x20already\x20exists');saveProfile(_0x4872b3,_0x3f4583);}export function saveProfileCredentials(_0x519d21,_0x47b793){const _0x5cca47=a29_0x1094;validateProfileName(_0x519d21);if(!profileExists(_0x519d21))throw new Error('Profile\x20'+_0x519d21+_0x5cca47(0xb1));const _0xa14fad=getNewCredentialPath(_0x519d21);writeSecureFile(_0xa14fad,_0x47b793);}export function loadProfileCredentials(_0xa4431a){const _0x25488b=a29_0x1094;validateProfileName(_0xa4431a);const _0x951ac6=getNewCredentialPath(_0xa4431a);if(a29_0x7d1ca5[_0x25488b(0xac)](_0x951ac6))try{return a29_0x7d1ca5[_0x25488b(0xae)](_0x951ac6,_0x25488b(0xb9));}catch{}const _0xed7cff=getOldCredentialPath(_0xa4431a);if(a29_0x7d1ca5['existsSync'](_0xed7cff)){console['warn'](_0x25488b(0xbd)+_0xa4431a+'\x27'),console[_0x25488b(0xa1)](_0x25488b(0xaf)),console[_0x25488b(0xa1)](_0x25488b(0xa3)+_0xed7cff+_0x25488b(0x9f)+_0x951ac6+'\x22'),console[_0x25488b(0xa1)](_0x25488b(0x74));try{return a29_0x7d1ca5[_0x25488b(0xae)](_0xed7cff,_0x25488b(0xb9));}catch{return null;}}return null;}
@@ -1 +1 @@
1
- const a29_0x551ca1=a29_0x2162;(function(_0x41cf74,_0x3b9d10){const _0x39e036=a29_0x2162,_0x40bbac=_0x41cf74();while(!![]){try{const _0x7be06e=parseInt(_0x39e036(0x1b3))/0x1+-parseInt(_0x39e036(0x1c2))/0x2+-parseInt(_0x39e036(0x1b1))/0x3+parseInt(_0x39e036(0x1c7))/0x4*(parseInt(_0x39e036(0x1ae))/0x5)+-parseInt(_0x39e036(0x1b5))/0x6*(-parseInt(_0x39e036(0x1bb))/0x7)+-parseInt(_0x39e036(0x1b4))/0x8+parseInt(_0x39e036(0x1b8))/0x9;if(_0x7be06e===_0x3b9d10)break;else _0x40bbac['push'](_0x40bbac['shift']());}catch(_0x13bfd4){_0x40bbac['push'](_0x40bbac['shift']());}}}(a29_0x1bce,0x9031f));import*as a29_0x56b0ec from'node:fs';import*as a29_0x48b0c5 from'node:path';function a29_0x2162(_0x312410,_0x26e52b){const _0x1bce7f=a29_0x1bce();return a29_0x2162=function(_0x2162ce,_0x243f0b){_0x2162ce=_0x2162ce-0x1ab;let _0x1c3c12=_0x1bce7f[_0x2162ce];return _0x1c3c12;},a29_0x2162(_0x312410,_0x26e52b);}const PROJECT_CONFIG_FILENAME=a29_0x551ca1(0x1c8);export function findProjectConfigPath(_0x1cd67e){const _0x43c6ba=a29_0x551ca1;let _0x4e58ac=_0x1cd67e||process['cwd']();while(!![]){const _0x5a8d30=a29_0x48b0c5[_0x43c6ba(0x1b2)](_0x4e58ac,PROJECT_CONFIG_FILENAME);if(a29_0x56b0ec[_0x43c6ba(0x1c3)](_0x5a8d30))return _0x5a8d30;const _0x4d0c10=a29_0x48b0c5[_0x43c6ba(0x1ad)](_0x4e58ac);if(_0x4d0c10===_0x4e58ac)return null;_0x4e58ac=_0x4d0c10;}}export function loadProjectConfig(_0x12a43c){const _0x2cefb4=a29_0x551ca1,_0x89cc84=findProjectConfigPath(_0x12a43c);if(!_0x89cc84)return null;try{const _0x4c4c0f=a29_0x56b0ec[_0x2cefb4(0x1c0)](_0x89cc84,'utf-8'),_0x50a3f7=JSON[_0x2cefb4(0x1af)](_0x4c4c0f),_0x4995ce=JSON[_0x2cefb4(0x1c9)](_0x50a3f7);if(_0x4995ce[_0x2cefb4(0x1be)]('TD_API_KEY')||_0x4995ce[_0x2cefb4(0x1be)](_0x2cefb4(0x1b0))||_0x4995ce['includes'](_0x2cefb4(0x1c5)))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x89cc84+_0x2cefb4(0x1b6)+_0x2cefb4(0x1bd));const {metadata:_0x425ce2,profile:_0x3337ca,..._0x4c19ca}=_0x50a3f7;return _0x3337ca&&console[_0x2cefb4(0x1bc)]('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x89cc84+'\x20is\x20ignored.\x20'+'Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json'),_0x4c19ca;}catch(_0x3bf7c5){if(_0x3bf7c5 instanceof Error&&_0x2cefb4(0x1b9)in _0x3bf7c5&&_0x3bf7c5[_0x2cefb4(0x1b9)]===_0x2cefb4(0x1c1))return null;throw new Error(_0x2cefb4(0x1b7)+_0x89cc84+':\x20'+_0x3bf7c5);}}export function saveProjectConfig(_0x4c6c59,_0x122f40){const _0x27f6a5=a29_0x551ca1,_0x3915b6=_0x122f40||process[_0x27f6a5(0x1bf)](),_0x5c2ea8=a29_0x48b0c5[_0x27f6a5(0x1b2)](_0x3915b6,PROJECT_CONFIG_FILENAME),_0x1471b4=JSON[_0x27f6a5(0x1c9)](_0x4c6c59);if(_0x1471b4[_0x27f6a5(0x1be)](_0x27f6a5(0x1ba))||_0x1471b4['includes'](_0x27f6a5(0x1b0))||_0x1471b4['includes'](_0x27f6a5(0x1c5)))throw new Error(_0x27f6a5(0x1ab));if(_0x27f6a5(0x1c6)in _0x4c6c59)throw new Error(_0x27f6a5(0x1c4));a29_0x56b0ec[_0x27f6a5(0x1ac)](_0x5c2ea8,JSON[_0x27f6a5(0x1c9)](_0x4c6c59,null,0x2));}function a29_0x1bce(){const _0x5dd2c8=['600448kRZOQM','5324768ZEXXSy','198DxIVBr',').\x20','Failed\x20to\x20load\x20project\x20config\x20from\x20','12977280PRgGoQ','code','TD_API_KEY','117957BRhnen','warn','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','includes','cwd','readFileSync','ENOENT','1494360AFtEex','existsSync','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','api_key','profile','2332972axspNp','tdx.json','stringify','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','writeFileSync','dirname','5zPNrYX','parse','apiKey','3534885EhlqvP','join'];a29_0x1bce=function(){return _0x5dd2c8;};return a29_0x1bce();}export function hasProjectConfig(_0xf2e6b6){return findProjectConfigPath(_0xf2e6b6)!==null;}export function getProjectRoot(_0x427399){const _0x54829b=a29_0x551ca1,_0x45ad44=findProjectConfigPath(_0x427399);return _0x45ad44?a29_0x48b0c5[_0x54829b(0x1ad)](_0x45ad44):null;}
1
+ (function(_0xa45d83,_0x2e15e2){const _0x13f813=a30_0xa690,_0x2809d0=_0xa45d83();while(!![]){try{const _0x3bd5df=-parseInt(_0x13f813(0x1ba))/0x1*(-parseInt(_0x13f813(0x1b8))/0x2)+-parseInt(_0x13f813(0x1b9))/0x3*(-parseInt(_0x13f813(0x1a7))/0x4)+-parseInt(_0x13f813(0x1bb))/0x5+-parseInt(_0x13f813(0x1bf))/0x6+parseInt(_0x13f813(0x1ac))/0x7+-parseInt(_0x13f813(0x1b5))/0x8+parseInt(_0x13f813(0x1b4))/0x9;if(_0x3bd5df===_0x2e15e2)break;else _0x2809d0['push'](_0x2809d0['shift']());}catch(_0x9881fc){_0x2809d0['push'](_0x2809d0['shift']());}}}(a30_0x26dc,0x62bc8));import*as a30_0x16d76d from'node:fs';import*as a30_0x5b3ad3 from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x49b6bd){const _0x1af2aa=a30_0xa690;let _0x24e00c=_0x49b6bd||process[_0x1af2aa(0x1b0)]();while(!![]){const _0x92ded4=a30_0x5b3ad3[_0x1af2aa(0x1b1)](_0x24e00c,PROJECT_CONFIG_FILENAME);if(a30_0x16d76d[_0x1af2aa(0x1aa)](_0x92ded4))return _0x92ded4;const _0x3983=a30_0x5b3ad3['dirname'](_0x24e00c);if(_0x3983===_0x24e00c)return null;_0x24e00c=_0x3983;}}function a30_0x26dc(){const _0x294ff7=['28IAaTfA','24678rIXryN','4822rHuQcm','3494390XtoWmM','ENOENT','readFileSync','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','419166YhPqkZ','TD_API_KEY','dirname','Warning:\x20\x27profile\x27\x20field\x20in\x20','parse','stringify','api_key','\x20is\x20ignored.\x20','156JMslWR','apiKey','includes','existsSync','profile','636986XuLRgh','utf-8','warn','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','cwd','join','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','7657092vyHozp','1255560fNxwcr','code','Failed\x20to\x20load\x20project\x20config\x20from\x20'];a30_0x26dc=function(){return _0x294ff7;};return a30_0x26dc();}function a30_0xa690(_0x8c20c9,_0xc397ea){const _0x26dcde=a30_0x26dc();return a30_0xa690=function(_0xa690da,_0x3e5c6a){_0xa690da=_0xa690da-0x1a6;let _0x13fe80=_0x26dcde[_0xa690da];return _0x13fe80;},a30_0xa690(_0x8c20c9,_0xc397ea);}export function loadProjectConfig(_0x2647c1){const _0x4ffec4=a30_0xa690,_0x592292=findProjectConfigPath(_0x2647c1);if(!_0x592292)return null;try{const _0x2d4c9c=a30_0x16d76d[_0x4ffec4(0x1bd)](_0x592292,_0x4ffec4(0x1ad)),_0x268686=JSON[_0x4ffec4(0x1c3)](_0x2d4c9c),_0x444598=JSON[_0x4ffec4(0x1c4)](_0x268686);if(_0x444598[_0x4ffec4(0x1a9)](_0x4ffec4(0x1c0))||_0x444598['includes'](_0x4ffec4(0x1a8))||_0x444598[_0x4ffec4(0x1a9)]('api_key'))throw new Error('Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20('+_0x592292+').\x20'+_0x4ffec4(0x1af));const {metadata:_0x34b541,profile:_0x2bb388,..._0x395f48}=_0x268686;return _0x2bb388&&console[_0x4ffec4(0x1ae)](_0x4ffec4(0x1c2)+_0x592292+_0x4ffec4(0x1a6)+_0x4ffec4(0x1b3)),_0x395f48;}catch(_0x389872){if(_0x389872 instanceof Error&&_0x4ffec4(0x1b6)in _0x389872&&_0x389872['code']===_0x4ffec4(0x1bc))return null;throw new Error(_0x4ffec4(0x1b7)+_0x592292+':\x20'+_0x389872);}}export function saveProjectConfig(_0x55a8ca,_0x451295){const _0x563226=a30_0xa690,_0x23e57c=_0x451295||process[_0x563226(0x1b0)](),_0x2af428=a30_0x5b3ad3['join'](_0x23e57c,PROJECT_CONFIG_FILENAME),_0x2af442=JSON['stringify'](_0x55a8ca);if(_0x2af442[_0x563226(0x1a9)](_0x563226(0x1c0))||_0x2af442['includes'](_0x563226(0x1a8))||_0x2af442['includes'](_0x563226(0x1c5)))throw new Error(_0x563226(0x1be));if(_0x563226(0x1ab)in _0x55a8ca)throw new Error(_0x563226(0x1b2));a30_0x16d76d['writeFileSync'](_0x2af428,JSON[_0x563226(0x1c4)](_0x55a8ca,null,0x2));}export function hasProjectConfig(_0x6baf5a){return findProjectConfigPath(_0x6baf5a)!==null;}export function getProjectRoot(_0x180d12){const _0x3e30ca=a30_0xa690,_0x435ea0=findProjectConfigPath(_0x180d12);return _0x435ea0?a30_0x5b3ad3[_0x3e30ca(0x1c1)](_0x435ea0):null;}
@@ -1 +1 @@
1
- (function(_0x3086fd,_0x314beb){const _0x388b4e=a30_0x3641,_0x4f6f81=_0x3086fd();while(!![]){try{const _0xc6f0de=-parseInt(_0x388b4e(0x1cb))/0x1+-parseInt(_0x388b4e(0x1a9))/0x2+-parseInt(_0x388b4e(0x1a7))/0x3*(parseInt(_0x388b4e(0x1b5))/0x4)+-parseInt(_0x388b4e(0x1a8))/0x5+-parseInt(_0x388b4e(0x1a6))/0x6*(-parseInt(_0x388b4e(0x1ce))/0x7)+-parseInt(_0x388b4e(0x1b9))/0x8+parseInt(_0x388b4e(0x1ad))/0x9;if(_0xc6f0de===_0x314beb)break;else _0x4f6f81['push'](_0x4f6f81['shift']());}catch(_0x87eeb3){_0x4f6f81['push'](_0x4f6f81['shift']());}}}(a30_0x3bc7,0xebc7a));import*as a30_0x5a32fa from'node:fs';import*as a30_0x722665 from'node:path';import*as a30_0x373acb from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function a30_0x3641(_0x6ef845,_0x3a0da8){const _0x3bc7cf=a30_0x3bc7();return a30_0x3641=function(_0x3641b3,_0x1d9bd6){_0x3641b3=_0x3641b3-0x1a5;let _0x546d9f=_0x3bc7cf[_0x3641b3];return _0x546d9f;},a30_0x3641(_0x6ef845,_0x3a0da8);}function getSessionsDir(){const _0xde851f=a30_0x3641,_0x359d8d=process[_0xde851f(0x1aa)][_0xde851f(0x1cf)]||a30_0x722665[_0xde851f(0x1b1)](a30_0x373acb[_0xde851f(0x1b4)](),_0xde851f(0x1c1),_0xde851f(0x1c7));return a30_0x722665[_0xde851f(0x1b1)](_0x359d8d,_0xde851f(0x1c3));}function getSessionPath(_0x408c6d){const _0x3a2fa4=a30_0x3641;return a30_0x722665[_0x3a2fa4(0x1b1)](getSessionsDir(),_0x408c6d+'.json');}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x3f678b){const _0xc6f3cc=a30_0x3641;if(_0x3f678b)return _0x3f678b;return getCurrentSessionPID()[_0xc6f3cc(0x1b2)]();}function a30_0x3bc7(){const _0x3dc24c=['writeFileSync','sessions','api_key','stringify','endsWith','tdx','parse','utf-8','apiKey','910690ISmUfH','createdAt','push','4688838vaDFDp','TDX_CONFIG_DIR','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','12IjpIiP','3ujllSl','3289130IRRJuE','3096212oasunC','env','warn','replace','45971091JRSPvG','.json','includes','now','join','toString','TD_API_KEY','homedir','5875572GtpKnT','readFileSync','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','toISOString','7170384WaTPeh','unlinkSync','readdirSync','existsSync','.\x20This\x20is\x20insecure.\x20Removing\x20session.','test','getTime','sort','.config'];a30_0x3bc7=function(){return _0x3dc24c;};return a30_0x3bc7();}export function loadSessionContext(_0x53f4cb){const _0x1f1d82=a30_0x3641,_0x47e5d3=_0x53f4cb||getCurrentSessionPID()[_0x1f1d82(0x1b2)](),_0x1fb9aa=/^\d+$/[_0x1f1d82(0x1be)](_0x47e5d3)?parseInt(_0x47e5d3,0xa):null;return _0x1fb9aa!==null?loadSessionContextByPID(_0x1fb9aa):loadSessionContextByString(_0x47e5d3);}export function loadSessionContextByPID(_0x542e3e){const _0x43e28c=a30_0x3641,_0x299ec9=getSessionPath(_0x542e3e);if(!a30_0x5a32fa['existsSync'](_0x299ec9))return null;try{const _0x28dfe4=a30_0x5a32fa[_0x43e28c(0x1b6)](_0x299ec9,_0x43e28c(0x1c9)),_0x2968dd=JSON[_0x43e28c(0x1c8)](_0x28dfe4),_0x4ff37c=new Date(_0x2968dd[_0x43e28c(0x1cc)])['getTime'](),_0x3d45e1=Date[_0x43e28c(0x1b0)]();if(_0x3d45e1-_0x4ff37c>SESSION_EXPIRATION_MS)return a30_0x5a32fa[_0x43e28c(0x1ba)](_0x299ec9),null;const _0x338d61=JSON['stringify'](_0x2968dd);if(_0x338d61[_0x43e28c(0x1af)]('TD_API_KEY')||_0x338d61['includes'](_0x43e28c(0x1ca))||_0x338d61[_0x43e28c(0x1af)](_0x43e28c(0x1c4)))return console[_0x43e28c(0x1ab)](_0x43e28c(0x1a5)+_0x299ec9+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a30_0x5a32fa[_0x43e28c(0x1ba)](_0x299ec9),null;return _0x2968dd;}catch{try{a30_0x5a32fa[_0x43e28c(0x1ba)](_0x299ec9);}catch{}return null;}}function loadSessionContextByString(_0x39fb4e){const _0x5da6f0=a30_0x3641,_0x1bfb8c=a30_0x722665['join'](getSessionsDir(),_0x39fb4e+'.json');if(!a30_0x5a32fa[_0x5da6f0(0x1bc)](_0x1bfb8c))return null;try{const _0x2767a5=a30_0x5a32fa[_0x5da6f0(0x1b6)](_0x1bfb8c,_0x5da6f0(0x1c9)),_0x18dcf6=JSON['parse'](_0x2767a5),_0x2d1c98=new Date(_0x18dcf6[_0x5da6f0(0x1cc)])[_0x5da6f0(0x1bf)](),_0x4c01d2=Date[_0x5da6f0(0x1b0)]();if(_0x4c01d2-_0x2d1c98>SESSION_EXPIRATION_MS)return a30_0x5a32fa[_0x5da6f0(0x1ba)](_0x1bfb8c),null;const _0xc5dfd5=JSON['stringify'](_0x18dcf6);if(_0xc5dfd5[_0x5da6f0(0x1af)](_0x5da6f0(0x1b3))||_0xc5dfd5[_0x5da6f0(0x1af)](_0x5da6f0(0x1ca))||_0xc5dfd5[_0x5da6f0(0x1af)](_0x5da6f0(0x1c4)))return console[_0x5da6f0(0x1ab)](_0x5da6f0(0x1a5)+_0x1bfb8c+_0x5da6f0(0x1bd)),a30_0x5a32fa[_0x5da6f0(0x1ba)](_0x1bfb8c),null;return _0x18dcf6;}catch{try{a30_0x5a32fa[_0x5da6f0(0x1ba)](_0x1bfb8c);}catch{}return null;}}export function saveSessionContext(_0x2f6782,_0x391091){const _0x5694ef=a30_0x3641,_0x1a7434=_0x391091||getCurrentSessionPID()[_0x5694ef(0x1b2)](),_0x21d8c8=/^\d+$/[_0x5694ef(0x1be)](_0x1a7434)?parseInt(_0x1a7434,0xa):getCurrentSessionPID(),_0x1ba8bf=a30_0x722665[_0x5694ef(0x1b1)](getSessionsDir(),_0x1a7434+_0x5694ef(0x1ae)),_0x42b99c=getSessionsDir();createSecureDirectory(_0x42b99c);const _0x4eba8e=JSON[_0x5694ef(0x1c5)](_0x2f6782);if(_0x4eba8e[_0x5694ef(0x1af)](_0x5694ef(0x1b3))||_0x4eba8e[_0x5694ef(0x1af)](_0x5694ef(0x1ca))||_0x4eba8e[_0x5694ef(0x1af)]('api_key'))throw new Error(_0x5694ef(0x1b7));let _0x4aecc7;const _0x246a84=/^\d+$/[_0x5694ef(0x1be)](_0x1a7434)?loadSessionContextByPID(parseInt(_0x1a7434,0xa)):loadSessionContextByString(_0x1a7434);_0x246a84?_0x4aecc7={..._0x246a84,..._0x2f6782,'pid':_0x21d8c8,'sessionId':_0x1a7434!==_0x21d8c8[_0x5694ef(0x1b2)]()?_0x1a7434:undefined,'updatedAt':new Date()[_0x5694ef(0x1b8)]()}:_0x4aecc7={'pid':_0x21d8c8,'sessionId':_0x1a7434!==_0x21d8c8['toString']()?_0x1a7434:undefined,..._0x2f6782,'createdAt':new Date()[_0x5694ef(0x1b8)](),'updatedAt':new Date()['toISOString']()},a30_0x5a32fa[_0x5694ef(0x1c2)](_0x1ba8bf,JSON[_0x5694ef(0x1c5)](_0x4aecc7,null,0x2));}export function clearSessionContext(_0x53587e){const _0xf55945=a30_0x3641,_0x53acaa=_0x53587e||getCurrentSessionPID()[_0xf55945(0x1b2)](),_0x1e103b=a30_0x722665[_0xf55945(0x1b1)](getSessionsDir(),_0x53acaa+'.json');a30_0x5a32fa['existsSync'](_0x1e103b)&&a30_0x5a32fa[_0xf55945(0x1ba)](_0x1e103b);}export function cleanExpiredSessions(){const _0xe579a0=a30_0x3641,_0x178a2d=getSessionsDir();if(!a30_0x5a32fa[_0xe579a0(0x1bc)](_0x178a2d))return 0x0;let _0x4fa830=0x0;const _0xeb6d71=Date['now']();try{const _0x357b04=a30_0x5a32fa['readdirSync'](_0x178a2d);for(const _0x1f3e45 of _0x357b04){if(!_0x1f3e45['endsWith']('.json'))continue;const _0x90f421=a30_0x722665['join'](_0x178a2d,_0x1f3e45),_0x4f81f7=_0x1f3e45[_0xe579a0(0x1ac)](_0xe579a0(0x1ae),''),_0x3aa11e=parseInt(_0x4f81f7,0xa),_0x31b94d=!isNaN(_0x3aa11e);if(_0x31b94d){if(!isProcessRunning(_0x3aa11e)){a30_0x5a32fa[_0xe579a0(0x1ba)](_0x90f421),_0x4fa830++;continue;}}try{const _0x14962f=a30_0x5a32fa[_0xe579a0(0x1b6)](_0x90f421,_0xe579a0(0x1c9)),_0x5843b5=JSON['parse'](_0x14962f),_0x5a7ef4=new Date(_0x5843b5[_0xe579a0(0x1cc)])[_0xe579a0(0x1bf)]();_0xeb6d71-_0x5a7ef4>SESSION_EXPIRATION_MS&&(a30_0x5a32fa[_0xe579a0(0x1ba)](_0x90f421),_0x4fa830++);}catch{a30_0x5a32fa[_0xe579a0(0x1ba)](_0x90f421),_0x4fa830++;}}}catch{}return _0x4fa830;}export function listActiveSessions(){const _0x1dd4b9=a30_0x3641,_0x1660b8=getSessionsDir();if(!a30_0x5a32fa[_0x1dd4b9(0x1bc)](_0x1660b8))return[];try{const _0x3d22a9=a30_0x5a32fa[_0x1dd4b9(0x1bb)](_0x1660b8),_0x36588f=[];for(const _0x44d8a9 of _0x3d22a9){if(!_0x44d8a9[_0x1dd4b9(0x1c6)](_0x1dd4b9(0x1ae)))continue;const _0x311280=_0x44d8a9['replace'](_0x1dd4b9(0x1ae),''),_0x5c06f4=parseInt(_0x311280,0xa);!isNaN(_0x5c06f4)&&isProcessRunning(_0x5c06f4)&&_0x36588f[_0x1dd4b9(0x1cd)](_0x5c06f4);}return _0x36588f[_0x1dd4b9(0x1c0)]((_0x5cf6a9,_0x587b3a)=>_0x5cf6a9-_0x587b3a);}catch{return[];}}
1
+ (function(_0x37bf25,_0x1faf55){const _0x2759ff=a31_0x122c,_0x3067b3=_0x37bf25();while(!![]){try{const _0x125d22=parseInt(_0x2759ff(0x92))/0x1*(-parseInt(_0x2759ff(0xb0))/0x2)+parseInt(_0x2759ff(0x8a))/0x3*(-parseInt(_0x2759ff(0xa7))/0x4)+-parseInt(_0x2759ff(0xaf))/0x5*(parseInt(_0x2759ff(0x9f))/0x6)+parseInt(_0x2759ff(0xa4))/0x7*(-parseInt(_0x2759ff(0xaa))/0x8)+-parseInt(_0x2759ff(0x8d))/0x9*(parseInt(_0x2759ff(0xa8))/0xa)+parseInt(_0x2759ff(0xa1))/0xb+parseInt(_0x2759ff(0x90))/0xc*(parseInt(_0x2759ff(0xb2))/0xd);if(_0x125d22===_0x1faf55)break;else _0x3067b3['push'](_0x3067b3['shift']());}catch(_0x4c59c6){_0x3067b3['push'](_0x3067b3['shift']());}}}(a31_0x3254,0xc1a61));import*as a31_0xb70081 from'node:fs';import*as a31_0x5061b1 from'node:path';function a31_0x122c(_0x5d1b99,_0x12079e){const _0x325429=a31_0x3254();return a31_0x122c=function(_0x122ca6,_0x5beb93){_0x122ca6=_0x122ca6-0x87;let _0x56a023=_0x325429[_0x122ca6];return _0x56a023;},a31_0x122c(_0x5d1b99,_0x12079e);}import*as a31_0x7d134e from'node:os';import{getPPID,isProcessRunning}from'../utils/process.js';import{createSecureDirectory}from'../utils/file-permissions.js';const SESSION_EXPIRATION_MS=0x18*0x3c*0x3c*0x3e8;function getSessionsDir(){const _0x56e5cc=a31_0x122c,_0x52ad25=process['env'][_0x56e5cc(0xa5)]||a31_0x5061b1['join'](a31_0x7d134e[_0x56e5cc(0x9a)](),_0x56e5cc(0x8f),_0x56e5cc(0x96));return a31_0x5061b1[_0x56e5cc(0xac)](_0x52ad25,_0x56e5cc(0xae));}function getSessionPath(_0x232532){const _0x265956=a31_0x122c;return a31_0x5061b1[_0x265956(0xac)](getSessionsDir(),_0x232532+_0x265956(0x9b));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x37d16a){const _0x367e27=a31_0x122c;if(_0x37d16a)return _0x37d16a;return getCurrentSessionPID()[_0x367e27(0xb1)]();}export function loadSessionContext(_0x573968){const _0x36f25b=a31_0x122c,_0xea934f=_0x573968||getCurrentSessionPID()[_0x36f25b(0xb1)](),_0x283cd5=/^\d+$/['test'](_0xea934f)?parseInt(_0xea934f,0xa):null;return _0x283cd5!==null?loadSessionContextByPID(_0x283cd5):loadSessionContextByString(_0xea934f);}export function loadSessionContextByPID(_0x4221e7){const _0x454426=a31_0x122c,_0x521a11=getSessionPath(_0x4221e7);if(!a31_0xb70081[_0x454426(0x8c)](_0x521a11))return null;try{const _0x2a4719=a31_0xb70081[_0x454426(0x9c)](_0x521a11,_0x454426(0xa3)),_0x43f7c9=JSON[_0x454426(0x99)](_0x2a4719),_0x3193b8=new Date(_0x43f7c9['createdAt'])[_0x454426(0xa2)](),_0x442172=Date['now']();if(_0x442172-_0x3193b8>SESSION_EXPIRATION_MS)return a31_0xb70081[_0x454426(0x8e)](_0x521a11),null;const _0x1371a2=JSON['stringify'](_0x43f7c9);if(_0x1371a2['includes']('TD_API_KEY')||_0x1371a2[_0x454426(0x9d)](_0x454426(0x94))||_0x1371a2[_0x454426(0x9d)]('api_key'))return console[_0x454426(0x9e)](_0x454426(0xa0)+_0x521a11+_0x454426(0x91)),a31_0xb70081[_0x454426(0x8e)](_0x521a11),null;return _0x43f7c9;}catch{try{a31_0xb70081[_0x454426(0x8e)](_0x521a11);}catch{}return null;}}function loadSessionContextByString(_0x50c13f){const _0x57e628=a31_0x122c,_0x39d1d7=a31_0x5061b1[_0x57e628(0xac)](getSessionsDir(),_0x50c13f+_0x57e628(0x9b));if(!a31_0xb70081['existsSync'](_0x39d1d7))return null;try{const _0x31f269=a31_0xb70081[_0x57e628(0x9c)](_0x39d1d7,_0x57e628(0xa3)),_0xc4a1c4=JSON[_0x57e628(0x99)](_0x31f269),_0x16dd1a=new Date(_0xc4a1c4[_0x57e628(0x88)])['getTime'](),_0x2b01c5=Date[_0x57e628(0x8b)]();if(_0x2b01c5-_0x16dd1a>SESSION_EXPIRATION_MS)return a31_0xb70081[_0x57e628(0x8e)](_0x39d1d7),null;const _0x56e2ed=JSON['stringify'](_0xc4a1c4);if(_0x56e2ed[_0x57e628(0x9d)](_0x57e628(0x97))||_0x56e2ed[_0x57e628(0x9d)](_0x57e628(0x94))||_0x56e2ed[_0x57e628(0x9d)](_0x57e628(0xa6)))return console[_0x57e628(0x9e)](_0x57e628(0xa0)+_0x39d1d7+_0x57e628(0x91)),a31_0xb70081['unlinkSync'](_0x39d1d7),null;return _0xc4a1c4;}catch{try{a31_0xb70081[_0x57e628(0x8e)](_0x39d1d7);}catch{}return null;}}function a31_0x3254(){const _0x1ce8da=['50212UIOWwk','475630HBKMyu','readdirSync','1850352pQALxf','toISOString','join','stringify','sessions','10VKRSak','1906vPeKSL','toString','559XrKFRR','writeFileSync','createdAt','test','291CRnRit','now','existsSync','171YgpFrG','unlinkSync','.config','1505892oFYAgy','.\x20This\x20is\x20insecure.\x20Removing\x20session.','1229nzHyib','sort','apiKey','replace','tdx','TD_API_KEY','push','parse','homedir','.json','readFileSync','includes','warn','2722854mIxiBJ','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','658383CtuPzU','getTime','utf-8','14rSNAwX','TDX_CONFIG_DIR','api_key'];a31_0x3254=function(){return _0x1ce8da;};return a31_0x3254();}export function saveSessionContext(_0x211d89,_0x39af20){const _0x18b3b0=a31_0x122c,_0x138850=_0x39af20||getCurrentSessionPID()[_0x18b3b0(0xb1)](),_0x5aed2c=/^\d+$/['test'](_0x138850)?parseInt(_0x138850,0xa):getCurrentSessionPID(),_0x35a50e=a31_0x5061b1[_0x18b3b0(0xac)](getSessionsDir(),_0x138850+'.json'),_0x5854da=getSessionsDir();createSecureDirectory(_0x5854da);const _0x3396bb=JSON[_0x18b3b0(0xad)](_0x211d89);if(_0x3396bb[_0x18b3b0(0x9d)](_0x18b3b0(0x97))||_0x3396bb['includes'](_0x18b3b0(0x94))||_0x3396bb[_0x18b3b0(0x9d)](_0x18b3b0(0xa6)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.');let _0x1b6d9f;const _0x4ccdf5=/^\d+$/[_0x18b3b0(0x89)](_0x138850)?loadSessionContextByPID(parseInt(_0x138850,0xa)):loadSessionContextByString(_0x138850);_0x4ccdf5?_0x1b6d9f={..._0x4ccdf5,..._0x211d89,'pid':_0x5aed2c,'sessionId':_0x138850!==_0x5aed2c['toString']()?_0x138850:undefined,'updatedAt':new Date()[_0x18b3b0(0xab)]()}:_0x1b6d9f={'pid':_0x5aed2c,'sessionId':_0x138850!==_0x5aed2c[_0x18b3b0(0xb1)]()?_0x138850:undefined,..._0x211d89,'createdAt':new Date()[_0x18b3b0(0xab)](),'updatedAt':new Date()['toISOString']()},a31_0xb70081[_0x18b3b0(0x87)](_0x35a50e,JSON[_0x18b3b0(0xad)](_0x1b6d9f,null,0x2));}export function clearSessionContext(_0x31b2df){const _0x28f506=a31_0x122c,_0x5f539d=_0x31b2df||getCurrentSessionPID()[_0x28f506(0xb1)](),_0x3d8f9e=a31_0x5061b1[_0x28f506(0xac)](getSessionsDir(),_0x5f539d+_0x28f506(0x9b));a31_0xb70081[_0x28f506(0x8c)](_0x3d8f9e)&&a31_0xb70081[_0x28f506(0x8e)](_0x3d8f9e);}export function cleanExpiredSessions(){const _0x297df4=a31_0x122c,_0x3fcb43=getSessionsDir();if(!a31_0xb70081[_0x297df4(0x8c)](_0x3fcb43))return 0x0;let _0x59b8f1=0x0;const _0x4be83c=Date[_0x297df4(0x8b)]();try{const _0x3a24e=a31_0xb70081['readdirSync'](_0x3fcb43);for(const _0x185dba of _0x3a24e){if(!_0x185dba['endsWith']('.json'))continue;const _0x4826fa=a31_0x5061b1[_0x297df4(0xac)](_0x3fcb43,_0x185dba),_0x5290a2=_0x185dba[_0x297df4(0x95)]('.json',''),_0x1819ae=parseInt(_0x5290a2,0xa),_0x1975c9=!isNaN(_0x1819ae);if(_0x1975c9){if(!isProcessRunning(_0x1819ae)){a31_0xb70081[_0x297df4(0x8e)](_0x4826fa),_0x59b8f1++;continue;}}try{const _0x233984=a31_0xb70081[_0x297df4(0x9c)](_0x4826fa,_0x297df4(0xa3)),_0x543ae7=JSON[_0x297df4(0x99)](_0x233984),_0x230dcd=new Date(_0x543ae7[_0x297df4(0x88)])[_0x297df4(0xa2)]();_0x4be83c-_0x230dcd>SESSION_EXPIRATION_MS&&(a31_0xb70081[_0x297df4(0x8e)](_0x4826fa),_0x59b8f1++);}catch{a31_0xb70081[_0x297df4(0x8e)](_0x4826fa),_0x59b8f1++;}}}catch{}return _0x59b8f1;}export function listActiveSessions(){const _0x14e9d1=a31_0x122c,_0x41ad67=getSessionsDir();if(!a31_0xb70081[_0x14e9d1(0x8c)](_0x41ad67))return[];try{const _0x3e834f=a31_0xb70081[_0x14e9d1(0xa9)](_0x41ad67),_0x4a9fde=[];for(const _0xbda6b6 of _0x3e834f){if(!_0xbda6b6['endsWith'](_0x14e9d1(0x9b)))continue;const _0x530e52=_0xbda6b6[_0x14e9d1(0x95)](_0x14e9d1(0x9b),''),_0x517228=parseInt(_0x530e52,0xa);!isNaN(_0x517228)&&isProcessRunning(_0x517228)&&_0x4a9fde[_0x14e9d1(0x98)](_0x517228);}return _0x4a9fde[_0x14e9d1(0x93)]((_0x44c60b,_0x4f7339)=>_0x44c60b-_0x4f7339);}catch{return[];}}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- (function(_0x2faf8e,_0x36aa61){var _0x4e0e6a=a31_0x1e9f,_0x525d21=_0x2faf8e();while(!![]){try{var _0x3de76a=parseInt(_0x4e0e6a(0x156))/0x1+-parseInt(_0x4e0e6a(0x157))/0x2+-parseInt(_0x4e0e6a(0x15b))/0x3+-parseInt(_0x4e0e6a(0x15a))/0x4+parseInt(_0x4e0e6a(0x159))/0x5*(parseInt(_0x4e0e6a(0x158))/0x6)+parseInt(_0x4e0e6a(0x15c))/0x7+parseInt(_0x4e0e6a(0x155))/0x8*(parseInt(_0x4e0e6a(0x154))/0x9);if(_0x3de76a===_0x36aa61)break;else _0x525d21['push'](_0x525d21['shift']());}catch(_0x467010){_0x525d21['push'](_0x525d21['shift']());}}}(a31_0x2627,0x8f8ef));export*from'./types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./client/http-client.js';export*from'./client/td-client.js';export{TrinoClient}from'./client/trino-client.js';export*from'./client/rate-limiter.js';export*from'./types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';function a31_0x1e9f(_0x3c4456,_0x58d52f){var _0x2627d9=a31_0x2627();return a31_0x1e9f=function(_0x1e9f42,_0x233c41){_0x1e9f42=_0x1e9f42-0x154;var _0x167ccc=_0x2627d9[_0x1e9f42];return _0x167ccc;},a31_0x1e9f(_0x3c4456,_0x58d52f);}export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';function a31_0x2627(){var _0x177193=['948QFgfWB','25195flLptU','3368288xttKSe','1136655jfmHbM','1274497IfdtnS','400167ZvoBSS','136HmlCNk','142863Mffthy','135990TiquZh'];a31_0x2627=function(){return _0x177193;};return a31_0x2627();}export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
1
+ (function(_0x3442b0,_0x4cf5e1){var _0x5406ba=a32_0x1a16,_0x571a73=_0x3442b0();while(!![]){try{var _0x1dfc15=-parseInt(_0x5406ba(0x144))/0x1+parseInt(_0x5406ba(0x147))/0x2*(-parseInt(_0x5406ba(0x14d))/0x3)+parseInt(_0x5406ba(0x14c))/0x4*(-parseInt(_0x5406ba(0x148))/0x5)+parseInt(_0x5406ba(0x145))/0x6*(-parseInt(_0x5406ba(0x14b))/0x7)+parseInt(_0x5406ba(0x14e))/0x8+parseInt(_0x5406ba(0x14f))/0x9*(-parseInt(_0x5406ba(0x14a))/0xa)+parseInt(_0x5406ba(0x146))/0xb*(parseInt(_0x5406ba(0x149))/0xc);if(_0x1dfc15===_0x4cf5e1)break;else _0x571a73['push'](_0x571a73['shift']());}catch(_0x418819){_0x571a73['push'](_0x571a73['shift']());}}}(a32_0x2e0a,0x904a5));export*from'./types/index.js';export*from'./core/config.js';export*from'./core/auth.js';export*from'./client/http-client.js';function a32_0x2e0a(){var _0x301087=['1737weaSNT','1012089SZnLja','966MAIDBU','1166tEPhbl','378980uAgeUu','5OKAfCr','363480WuFiNJ','1220OQTMDw','21994bPANOT','2755592pYKGFu','12mKMQff','2949024kWBPFf'];a32_0x2e0a=function(){return _0x301087;};return a32_0x2e0a();}export*from'./client/td-client.js';export{TrinoClient}from'./client/trino-client.js';export*from'./client/rate-limiter.js';export*from'./types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';function a32_0x1a16(_0x4948a0,_0x451b3f){var _0x2e0ae8=a32_0x2e0a();return a32_0x1a16=function(_0x1a164e,_0x42f748){_0x1a164e=_0x1a164e-0x144;var _0x13cc42=_0x2e0ae8[_0x1a164e];return _0x13cc42;},a32_0x1a16(_0x4948a0,_0x451b3f);}export*from'./commands/describe.js';export*from'./sdk/index.js';
@@ -1 +1 @@
1
- (function(_0xcaad48,_0x4f5e4c){const _0x525732=a32_0x4ce8,_0x5e2599=_0xcaad48();while(!![]){try{const _0x33da04=-parseInt(_0x525732(0x11a))/0x1*(parseInt(_0x525732(0x12a))/0x2)+parseInt(_0x525732(0x15f))/0x3*(-parseInt(_0x525732(0x121))/0x4)+-parseInt(_0x525732(0x145))/0x5*(parseInt(_0x525732(0x13e))/0x6)+parseInt(_0x525732(0x13d))/0x7+parseInt(_0x525732(0x13c))/0x8+-parseInt(_0x525732(0x11b))/0x9*(-parseInt(_0x525732(0x12d))/0xa)+parseInt(_0x525732(0x14a))/0xb;if(_0x33da04===_0x4f5e4c)break;else _0x5e2599['push'](_0x5e2599['shift']());}catch(_0x25d076){_0x5e2599['push'](_0x5e2599['shift']());}}}(a32_0x3303,0xed1e1));function generateMessageId(){const _0x1a4314=a32_0x4ce8;return _0x1a4314(0x137)+Math[_0x1a4314(0x155)]()[_0x1a4314(0x156)](0x24)[_0x1a4314(0x11c)](0x2,0xf)+Math['random']()[_0x1a4314(0x156)](0x24)['substring'](0x2,0xf);}export function extractTextFromAnthropicMessage(_0x198fe3){const _0x133e7f=a32_0x4ce8;if(typeof _0x198fe3[_0x133e7f(0x15d)]===_0x133e7f(0x164))return _0x198fe3[_0x133e7f(0x15d)];return _0x198fe3[_0x133e7f(0x15d)][_0x133e7f(0x13f)](_0x394466=>_0x394466[_0x133e7f(0x147)]===_0x133e7f(0x123)&&_0x394466[_0x133e7f(0x123)])['map'](_0x3ecea2=>_0x3ecea2[_0x133e7f(0x123)])[_0x133e7f(0x14b)]('\x0a');}export function calculateConversationDelta(_0x218bc6,_0x26c28c){const _0x77b663=a32_0x4ce8;if(_0x26c28c[_0x77b663(0x128)]===0x0)return _0x218bc6;const _0x49b21a=_0x26c28c['length'];return _0x218bc6[_0x77b663(0x150)](_0x49b21a);}export function transformAnthropicRequestToTD(_0x2cf423,_0x2273b1){const _0x5817e1=a32_0x4ce8,_0x95d829=calculateConversationDelta(_0x2cf423[_0x5817e1(0x138)],_0x2273b1),_0x31b745=_0x95d829[_0x5817e1(0x13f)](_0xa22983=>_0xa22983['role']===_0x5817e1(0x140))[_0x5817e1(0x157)]();if(!_0x31b745)throw new Error(_0x5817e1(0x124));const _0x41b90c=extractTextFromAnthropicMessage(_0x31b745);return{'userMessage':_0x41b90c,'deltaMessages':_0x95d829};}export async function*transformTDStreamToAnthropic(_0x2d0bac,_0x483b44,_0x1e87b1){const _0x3d9797=a32_0x4ce8;let _0xb0d707=0x0,_0x1a3a1c=0x0,_0x34b86b=0x0,_0x46258b=![];const _0x541f26={'type':_0x3d9797(0x15a),'message':{'id':_0x483b44,'type':_0x3d9797(0x13a),'role':_0x3d9797(0x142),'content':[],'model':_0x1e87b1,'stop_reason':null,'stop_sequence':null,'usage':{'input_tokens':_0xb0d707,'output_tokens':0x0}}};yield _0x541f26;for await(const _0x28e3a8 of _0x2d0bac){if(_0x3d9797(0x15d)in _0x28e3a8){const _0x33c57a=_0x28e3a8;if(!_0x46258b){const _0x52f463={'type':'content_block_start','index':_0x34b86b,'content_block':{'type':_0x3d9797(0x123),'text':''}};yield _0x52f463,_0x46258b=!![];}const _0x592723={'type':_0x3d9797(0x139),'index':_0x34b86b,'delta':{'type':_0x3d9797(0x165),'text':_0x33c57a[_0x3d9797(0x15d)]}};yield _0x592723,_0x1a3a1c+=Math[_0x3d9797(0x122)](_0x33c57a['content'][_0x3d9797(0x128)]/0x4);}else{if('tool_call'in _0x28e3a8){const _0x58a466=_0x28e3a8;console[_0x3d9797(0x12f)](_0x3d9797(0x14d),_0x58a466);}else{if('error'in _0x28e3a8){const _0x182f50=_0x28e3a8;yield{'type':_0x3d9797(0x167),'error':{'type':_0x3d9797(0x16a),'message':_0x182f50[_0x3d9797(0x167)]}};return;}}}}if(_0x46258b){const _0x57f058={'type':_0x3d9797(0x146),'index':_0x34b86b};yield _0x57f058;}const _0x3e9df7={'type':_0x3d9797(0x161),'delta':{'stop_reason':'end_turn','stop_sequence':null},'usage':{'output_tokens':_0x1a3a1c}};yield _0x3e9df7;const _0x424e19={'type':_0x3d9797(0x14c)};yield _0x424e19;}export function formatAnthropicSSE(_0x1c723a){const _0x534089=a32_0x4ce8;return'event:\x20'+_0x1c723a[_0x534089(0x147)]+_0x534089(0x151)+JSON[_0x534089(0x14f)](_0x1c723a)+'\x0a\x0a';}export function mapAnthropicModelToTD(_0x264811){const _0x473496=a32_0x4ce8,_0x38f856={'sonnet':_0x473496(0x120),'claude-sonnet':_0x473496(0x120),'claude-3-5-sonnet':_0x473496(0x120),'claude-3-sonnet':'sonnet','haiku':_0x473496(0x11e),'claude-haiku':'haiku','claude-3-5-haiku':_0x473496(0x11e),'claude-3-haiku':'haiku','opus':'opus','claude-opus':_0x473496(0x154),'claude-3-opus':_0x473496(0x154)},_0x2e5b3a=_0x264811[_0x473496(0x168)]();return _0x38f856[_0x2e5b3a]||_0x473496(0x120);}export function generateToolPrompt(_0x576242){const _0x1d10e7=a32_0x4ce8;if(!_0x576242||_0x576242[_0x1d10e7(0x128)]===0x0)return'';const _0x4c7980=_0x576242['map'](_0x1e3b28=>{const _0x4f3872=_0x1d10e7,_0xb80d4f=_0x1e3b28[_0x4f3872(0x152)][_0x4f3872(0x143)]?Object[_0x4f3872(0x134)](_0x1e3b28['input_schema'][_0x4f3872(0x143)])[_0x4f3872(0x130)](([_0x14e982,_0x3d89ac])=>{const _0x276d08=_0x4f3872,_0x460ecb=_0x1e3b28['input_schema']['required']?.[_0x276d08(0x148)](_0x14e982)?_0x276d08(0x144):'',_0x41622f=_0x3d89ac,_0x41db35=_0x41622f['description']?':\x20'+_0x41622f[_0x276d08(0x136)]:'';return'\x20\x20\x20\x20-\x20'+_0x14e982+_0x460ecb+_0x41db35;})[_0x4f3872(0x14b)]('\x0a'):_0x4f3872(0x11f);return'-\x20'+_0x1e3b28['name']+':\x20'+(_0x1e3b28[_0x4f3872(0x136)]||'No\x20description')+_0x4f3872(0x11d)+_0xb80d4f;})[_0x1d10e7(0x14b)]('\x0a\x0a');return _0x1d10e7(0x159)+_0x4c7980+_0x1d10e7(0x163);}function escapeXml(_0xf7c79a){const _0x50688b=a32_0x4ce8;return _0xf7c79a[_0x50688b(0x169)](/&/g,'&amp;')[_0x50688b(0x169)](/</g,_0x50688b(0x125))[_0x50688b(0x169)](/>/g,_0x50688b(0x135))[_0x50688b(0x169)](/"/g,_0x50688b(0x14e))[_0x50688b(0x169)](/'/g,_0x50688b(0x13b));}export function extractToolResults(_0x5bcdb0){const _0x18d6a5=a32_0x4ce8,_0x33893f=[];for(const _0x11e7f9 of _0x5bcdb0){if(_0x11e7f9[_0x18d6a5(0x12c)]===_0x18d6a5(0x140)&&typeof _0x11e7f9[_0x18d6a5(0x15d)]!==_0x18d6a5(0x164))for(const _0x4fa84d of _0x11e7f9[_0x18d6a5(0x15d)]){if(_0x4fa84d['type']===_0x18d6a5(0x149)&&_0x4fa84d[_0x18d6a5(0x15c)]){let _0x18b476='';if(typeof _0x4fa84d[_0x18d6a5(0x15d)]===_0x18d6a5(0x164))_0x18b476=_0x4fa84d[_0x18d6a5(0x15d)];else Array['isArray'](_0x4fa84d[_0x18d6a5(0x15d)])&&(_0x18b476=_0x4fa84d['content'][_0x18d6a5(0x13f)](_0x4bc0e5=>_0x4bc0e5['type']===_0x18d6a5(0x123)&&_0x4bc0e5[_0x18d6a5(0x123)])[_0x18d6a5(0x130)](_0x1d0170=>_0x1d0170['text'])[_0x18d6a5(0x14b)]('\x0a'));const _0x4b3b67=escapeXml(_0x4fa84d[_0x18d6a5(0x15c)]),_0x346f88=escapeXml(_0x18b476),_0xc62cbc=_0x4fa84d['is_error']?_0x18d6a5(0x141):'';_0x33893f[_0x18d6a5(0x133)](_0x18d6a5(0x15b)+_0x4b3b67+'\x22'+_0xc62cbc+'>\x0a'+_0x346f88+_0x18d6a5(0x166));}}}if(_0x33893f[_0x18d6a5(0x128)]===0x0)return'';return _0x33893f[_0x18d6a5(0x14b)]('\x0a\x0a')+_0x18d6a5(0x158);}function findJsonEndIndex(_0x1ab96c,_0x136055){const _0x3b931e=a32_0x4ce8;let _0x57b5a4=0x0,_0x11b8fa=![],_0xa7222f=![];for(let _0x4e5bce=_0x136055;_0x4e5bce<_0x1ab96c[_0x3b931e(0x128)];_0x4e5bce++){const _0x740e40=_0x1ab96c[_0x4e5bce];if(_0xa7222f){_0xa7222f=![];continue;}if(_0x740e40==='\x5c'){_0xa7222f=!![];continue;}if(_0x740e40==='\x22'){_0x11b8fa=!_0x11b8fa;continue;}if(!_0x11b8fa){if(_0x740e40==='{')_0x57b5a4++;else{if(_0x740e40==='}'){_0x57b5a4--;if(_0x57b5a4===0x0)return _0x4e5bce+0x1;}}}}return-0x1;}function a32_0x4ce8(_0x23bc38,_0x358e38){const _0x3303f5=a32_0x3303();return a32_0x4ce8=function(_0x4ce852,_0x58cbec){_0x4ce852=_0x4ce852-0x11a;let _0x10ce13=_0x3303f5[_0x4ce852];return _0x10ce13;},a32_0x4ce8(_0x23bc38,_0x358e38);}function a32_0x3303(){const _0x56dbd0=['1btgcdN','4705902oUFiyl','substring','\x0a\x20\x20Parameters:\x0a','haiku','\x20\x20\x20\x20(no\x20parameters)','sonnet','761952XlWIYL','ceil','text','No\x20user\x20message\x20found\x20in\x20request\x20delta','&lt;','content_block_start','indexOf','length','end_turn','2076422NSRzpY','input','role','10rOtGyb','exec','warn','map','output_tokens','[DEBUG]\x20Tool\x20call\x20detected:','push','entries','&gt;','description','msg_','messages','content_block_delta','message','&apos;','14645576sJDnZA','9438905TWJWao','106980olpOJa','filter','user','\x20error=\x22true\x22','assistant','properties','\x20(required)','260jdXTNY','content_block_stop','type','includes','tool_result','6248330dWQlpJ','join','message_stop','Tool\x20calls\x20not\x20yet\x20supported\x20in\x20proxy:','&quot;','stringify','slice','\x0adata:\x20','input_schema','parse','opus','random','toString','pop','\x0a\x0aPlease\x20continue\x20your\x20response\x20based\x20on\x20the\x20tool\x20results\x20above.\x0a\x0a','<tools>\x0aYou\x20have\x20access\x20to\x20the\x20following\x20tools:\x0a\x0a','message_start','<tool_result\x20tool_use_id=\x22','tool_use_id','content','input_json_delta','21tHlDSx','tool_use','message_delta','name','\x0a\x0aTo\x20use\x20a\x20tool,\x20you\x20MUST\x20output\x20EXACTLY\x20this\x20JSON\x20format\x20on\x20its\x20own\x20line:\x0a{\x22tool_use\x22:{\x22id\x22:\x22toolu_<random>\x22,\x22name\x22:\x22<tool_name>\x22,\x22input\x22:{<parameters>}}}\x0a\x0aImportant:\x0a-\x20The\x20JSON\x20must\x20be\x20valid\x20and\x20on\x20a\x20single\x20line\x0a-\x20Generate\x20a\x20unique\x20random\x20ID\x20starting\x20with\x20\x22toolu_\x22\x0a-\x20Do\x20NOT\x20include\x20any\x20other\x20text\x20on\x20the\x20line\x20with\x20the\x20JSON\x0a-\x20After\x20outputting\x20the\x20tool\x20use\x20JSON,\x20stop\x20and\x20wait\x20for\x20the\x20tool\x20result\x0a-\x20Once\x20you\x20receive\x20a\x20tool\x20result,\x20continue\x20your\x20response\x20naturally\x0a\x0aExample:\x0aUser:\x20\x22What\x27s\x2025\x20*\x204?\x22\x0aAssistant:\x20I\x27ll\x20calculate\x20that\x20for\x20you.\x0a{\x22tool_use\x22:{\x22id\x22:\x22toolu_abc123\x22,\x22name\x22:\x22calculator\x22,\x22input\x22:{\x22expression\x22:\x2225\x20*\x204\x22}}}\x0a\x0a</tools>\x0a\x0a','string','text_delta','\x0a</tool_result>','error','toLowerCase','replace','api_error'];a32_0x3303=function(){return _0x56dbd0;};return a32_0x3303();}export function parseToolCallFromText(_0x17c7b3){const _0x14c11b=a32_0x4ce8,_0x5d1008=/\{"tool_use":/g,_0x10e08d=_0x5d1008[_0x14c11b(0x12e)](_0x17c7b3);if(!_0x10e08d)return null;const _0x47a500=_0x10e08d['index'],_0x27b996=findJsonEndIndex(_0x17c7b3,_0x47a500);if(_0x27b996===-0x1)return null;const _0x515c7f=_0x17c7b3[_0x14c11b(0x11c)](_0x47a500,_0x27b996);try{const _0x10511a=JSON[_0x14c11b(0x153)](_0x515c7f);if(_0x10511a[_0x14c11b(0x160)]&&_0x10511a[_0x14c11b(0x160)]['id']&&_0x10511a[_0x14c11b(0x160)][_0x14c11b(0x162)])return{'id':_0x10511a[_0x14c11b(0x160)]['id'],'name':_0x10511a[_0x14c11b(0x160)][_0x14c11b(0x162)],'input':_0x10511a['tool_use'][_0x14c11b(0x12b)]||{},'startIndex':_0x47a500,'endIndex':_0x27b996};}catch{return null;}return null;}export function*generateToolCallEvents(_0x40bebd,_0x5d9bbb){const _0x38c0c0=a32_0x4ce8,_0x4a29f3={'type':'content_block_start','index':_0x5d9bbb,'content_block':{'type':_0x38c0c0(0x160),'id':_0x40bebd['id'],'name':_0x40bebd[_0x38c0c0(0x162)],'input':{}}};yield _0x4a29f3;const _0x25523b=JSON[_0x38c0c0(0x14f)](_0x40bebd[_0x38c0c0(0x12b)]),_0x106e17={'type':'content_block_delta','index':_0x5d9bbb,'delta':{'type':_0x38c0c0(0x15e),'partial_json':_0x25523b}};yield _0x106e17;const _0x144210={'type':_0x38c0c0(0x146),'index':_0x5d9bbb};yield _0x144210;const _0x148c29={'type':'message_delta','delta':{'stop_reason':_0x38c0c0(0x160),'stop_sequence':null},'usage':{'output_tokens':0x0}};yield _0x148c29;const _0xcfabd9={'type':'message_stop'};yield _0xcfabd9;}export async function*transformTDStreamWithToolDetection(_0x377832,_0x322185,_0x1bc34d,_0x157545=![]){const _0x123266=a32_0x4ce8;let _0x4eb8a6=0x0,_0x3b00d6=0x0,_0xc018ad=0x0,_0x102544=![],_0x177f72='',_0x5e62f6=0x0,_0x5ac1b3=![];const _0x235494=0xc8,_0x405aa4={'type':_0x123266(0x15a),'message':{'id':_0x322185,'type':_0x123266(0x13a),'role':_0x123266(0x142),'content':[],'model':_0x1bc34d,'stop_reason':null,'stop_sequence':null,'usage':{'input_tokens':_0x4eb8a6,'output_tokens':0x0}}};yield _0x405aa4;for await(const _0x47647c of _0x377832){if(_0x123266(0x15d)in _0x47647c){const _0x2400d1=_0x47647c;_0x177f72+=_0x2400d1['content'];const _0x54f643=_0x177f72[_0x123266(0x127)]('{\x22tool_use\x22:');if(_0x54f643!==-0x1){const _0x446882=parseToolCallFromText(_0x177f72);if(_0x446882){_0x5ac1b3=!![];_0x157545&&(console[_0x123266(0x167)](_0x123266(0x132),_0x446882[_0x123266(0x162)]),console[_0x123266(0x167)](''));const _0x44d643=_0x177f72[_0x123266(0x11c)](_0x5e62f6,_0x446882['startIndex'])['trim']();if(_0x44d643){if(!_0x102544){const _0xfef8d={'type':_0x123266(0x126),'index':_0xc018ad,'content_block':{'type':_0x123266(0x123),'text':''}};yield _0xfef8d,_0x102544=!![];}const _0x49f451={'type':_0x123266(0x139),'index':_0xc018ad,'delta':{'type':_0x123266(0x165),'text':_0x44d643}};yield _0x49f451,_0x3b00d6+=Math['ceil'](_0x44d643[_0x123266(0x128)]/0x4);}if(_0x102544){const _0x491d5e={'type':'content_block_stop','index':_0xc018ad};yield _0x491d5e,_0xc018ad++;}for(const _0x3374db of generateToolCallEvents(_0x446882,_0xc018ad)){_0x3374db['type']===_0x123266(0x161)&&(_0x3374db['usage'][_0x123266(0x131)]=_0x3b00d6),yield _0x3374db;}return;}const _0x55848a=_0x177f72['substring'](_0x5e62f6,_0x54f643);if(_0x55848a){if(!_0x102544){const _0x4deba1={'type':_0x123266(0x126),'index':_0xc018ad,'content_block':{'type':_0x123266(0x123),'text':''}};yield _0x4deba1,_0x102544=!![];}const _0xfa969={'type':_0x123266(0x139),'index':_0xc018ad,'delta':{'type':_0x123266(0x165),'text':_0x55848a}};yield _0xfa969,_0x3b00d6+=Math[_0x123266(0x122)](_0x55848a['length']/0x4),_0x5e62f6=_0x54f643;}continue;}const _0x3b835f=_0x177f72['length']-_0x235494;if(_0x3b835f>_0x5e62f6){const _0x5df794=_0x177f72[_0x123266(0x11c)](_0x5e62f6,_0x3b835f);if(_0x5df794){if(!_0x102544){const _0x56037c={'type':_0x123266(0x126),'index':_0xc018ad,'content_block':{'type':_0x123266(0x123),'text':''}};yield _0x56037c,_0x102544=!![];}const _0x3ad37a={'type':_0x123266(0x139),'index':_0xc018ad,'delta':{'type':_0x123266(0x165),'text':_0x5df794}};yield _0x3ad37a,_0x3b00d6+=Math[_0x123266(0x122)](_0x5df794[_0x123266(0x128)]/0x4),_0x5e62f6=_0x3b835f;}}}else{if(_0x123266(0x167)in _0x47647c){const _0x1b3ef4=_0x47647c;yield{'type':_0x123266(0x167),'error':{'type':_0x123266(0x16a),'message':_0x1b3ef4[_0x123266(0x167)]}};return;}}}if(!_0x5ac1b3){const _0x1132a4=_0x177f72[_0x123266(0x11c)](_0x5e62f6);if(_0x1132a4){if(!_0x102544){const _0x4d05e9={'type':_0x123266(0x126),'index':_0xc018ad,'content_block':{'type':'text','text':''}};yield _0x4d05e9,_0x102544=!![];}const _0x1b20a8={'type':'content_block_delta','index':_0xc018ad,'delta':{'type':_0x123266(0x165),'text':_0x1132a4}};yield _0x1b20a8,_0x3b00d6+=Math[_0x123266(0x122)](_0x1132a4[_0x123266(0x128)]/0x4);}if(_0x102544){const _0x4ce30={'type':_0x123266(0x146),'index':_0xc018ad};yield _0x4ce30;}const _0x55aed5={'type':_0x123266(0x161),'delta':{'stop_reason':_0x123266(0x129),'stop_sequence':null},'usage':{'output_tokens':_0x3b00d6}};yield _0x55aed5;const _0x19e6a4={'type':'message_stop'};yield _0x19e6a4;}}export{generateMessageId};
1
+ (function(_0x3e5d24,_0x5a44e6){const _0x449f1a=a33_0x5cad,_0x32360f=_0x3e5d24();while(!![]){try{const _0xf8c6e3=-parseInt(_0x449f1a(0x210))/0x1+-parseInt(_0x449f1a(0x1d9))/0x2*(parseInt(_0x449f1a(0x1dd))/0x3)+parseInt(_0x449f1a(0x20c))/0x4+parseInt(_0x449f1a(0x1d3))/0x5+parseInt(_0x449f1a(0x212))/0x6+-parseInt(_0x449f1a(0x1ea))/0x7+parseInt(_0x449f1a(0x1e1))/0x8;if(_0xf8c6e3===_0x5a44e6)break;else _0x32360f['push'](_0x32360f['shift']());}catch(_0x89c7c4){_0x32360f['push'](_0x32360f['shift']());}}}(a33_0x343e,0x88f52));function generateMessageId(){const _0x5f231b=a33_0x5cad;return'msg_'+Math[_0x5f231b(0x1cd)]()[_0x5f231b(0x1fa)](0x24)[_0x5f231b(0x1f0)](0x2,0xf)+Math[_0x5f231b(0x1cd)]()[_0x5f231b(0x1fa)](0x24)[_0x5f231b(0x1f0)](0x2,0xf);}export function extractTextFromAnthropicMessage(_0x290e6e){const _0x84409e=a33_0x5cad;if(typeof _0x290e6e[_0x84409e(0x1f7)]===_0x84409e(0x1e7))return _0x290e6e[_0x84409e(0x1f7)];return _0x290e6e[_0x84409e(0x1f7)][_0x84409e(0x1d1)](_0xc0c42c=>_0xc0c42c[_0x84409e(0x1fe)]===_0x84409e(0x1cf)&&_0xc0c42c[_0x84409e(0x1cf)])[_0x84409e(0x1fd)](_0x2830cb=>_0x2830cb[_0x84409e(0x1cf)])['join']('\x0a');}export function calculateConversationDelta(_0xa2f417,_0x5f46e6){const _0x1af5ef=a33_0x5cad;if(_0x5f46e6['length']===0x0)return _0xa2f417;const _0x4f498c=_0x5f46e6[_0x1af5ef(0x218)];return _0xa2f417[_0x1af5ef(0x1eb)](_0x4f498c);}export function transformAnthropicRequestToTD(_0xe4df90,_0x1b70d0){const _0x36cb84=a33_0x5cad,_0x90e125=calculateConversationDelta(_0xe4df90[_0x36cb84(0x1ca)],_0x1b70d0),_0x336e35=_0x90e125[_0x36cb84(0x1d1)](_0x306101=>_0x306101[_0x36cb84(0x1f6)]===_0x36cb84(0x217))[_0x36cb84(0x1e2)]();if(!_0x336e35)throw new Error(_0x36cb84(0x1e5));const _0x30d757=extractTextFromAnthropicMessage(_0x336e35);return{'userMessage':_0x30d757,'deltaMessages':_0x90e125};}export async function*transformTDStreamToAnthropic(_0x528b1a,_0x19f1dd,_0x1c510d){const _0x2c0c56=a33_0x5cad;let _0x2e6cea=0x0,_0xb6fe0f=0x0,_0x26ca92=0x0,_0x2fbe7a=![];const _0x9f8bc6={'type':_0x2c0c56(0x1d0),'message':{'id':_0x19f1dd,'type':_0x2c0c56(0x201),'role':_0x2c0c56(0x1e0),'content':[],'model':_0x1c510d,'stop_reason':null,'stop_sequence':null,'usage':{'input_tokens':_0x2e6cea,'output_tokens':0x0}}};yield _0x9f8bc6;for await(const _0x106334 of _0x528b1a){if(_0x2c0c56(0x1f7)in _0x106334){const _0x264d93=_0x106334;if(!_0x2fbe7a){const _0x396617={'type':_0x2c0c56(0x1f1),'index':_0x26ca92,'content_block':{'type':_0x2c0c56(0x1cf),'text':''}};yield _0x396617,_0x2fbe7a=!![];}const _0x318942={'type':'content_block_delta','index':_0x26ca92,'delta':{'type':_0x2c0c56(0x20e),'text':_0x264d93[_0x2c0c56(0x1f7)]}};yield _0x318942,_0xb6fe0f+=Math[_0x2c0c56(0x1d8)](_0x264d93['content']['length']/0x4);}else{if(_0x2c0c56(0x1f9)in _0x106334){const _0x4a8d4e=_0x106334;console[_0x2c0c56(0x20b)](_0x2c0c56(0x1e9),_0x4a8d4e);}else{if(_0x2c0c56(0x209)in _0x106334){const _0x236710=_0x106334;yield{'type':'error','error':{'type':'api_error','message':_0x236710[_0x2c0c56(0x209)]}};return;}}}}if(_0x2fbe7a){const _0x17b5be={'type':_0x2c0c56(0x1fb),'index':_0x26ca92};yield _0x17b5be;}const _0x4a1cae={'type':'message_delta','delta':{'stop_reason':_0x2c0c56(0x1f2),'stop_sequence':null},'usage':{'output_tokens':_0xb6fe0f}};yield _0x4a1cae;const _0xb27ad={'type':_0x2c0c56(0x1d2)};yield _0xb27ad;}export function formatAnthropicSSE(_0x59879c){const _0xbaf0b1=a33_0x5cad;return _0xbaf0b1(0x20a)+_0x59879c[_0xbaf0b1(0x1fe)]+'\x0adata:\x20'+JSON[_0xbaf0b1(0x1c9)](_0x59879c)+'\x0a\x0a';}export function mapAnthropicModelToTD(_0x4aa659){const _0xfc0d20=a33_0x5cad,_0x1c5c6e={'sonnet':_0xfc0d20(0x1ff),'claude-sonnet':'sonnet','claude-3-5-sonnet':_0xfc0d20(0x1ff),'claude-3-sonnet':'sonnet','haiku':_0xfc0d20(0x1cc),'claude-haiku':_0xfc0d20(0x1cc),'claude-3-5-haiku':_0xfc0d20(0x1cc),'claude-3-haiku':_0xfc0d20(0x1cc),'opus':_0xfc0d20(0x1f4),'claude-opus':_0xfc0d20(0x1f4),'claude-3-opus':_0xfc0d20(0x1f4)},_0x45c088=_0x4aa659[_0xfc0d20(0x1ce)]();return _0x1c5c6e[_0x45c088]||_0xfc0d20(0x1ff);}export function generateToolPrompt(_0x2933d8){const _0x486784=a33_0x5cad;if(!_0x2933d8||_0x2933d8[_0x486784(0x218)]===0x0)return'';const _0x5e0108=_0x2933d8['map'](_0x1ca2a4=>{const _0x52f2c2=_0x486784,_0x4b4ff6=_0x1ca2a4['input_schema'][_0x52f2c2(0x1ed)]?Object[_0x52f2c2(0x204)](_0x1ca2a4[_0x52f2c2(0x1dc)][_0x52f2c2(0x1ed)])[_0x52f2c2(0x1fd)](([_0xd93a65,_0x35cefd])=>{const _0x48bede=_0x52f2c2,_0x1db3d1=_0x1ca2a4[_0x48bede(0x1dc)]['required']?.[_0x48bede(0x1d6)](_0xd93a65)?_0x48bede(0x1df):'',_0x5845b3=_0x35cefd,_0x49f214=_0x5845b3['description']?':\x20'+_0x5845b3[_0x48bede(0x219)]:'';return _0x48bede(0x205)+_0xd93a65+_0x1db3d1+_0x49f214;})[_0x52f2c2(0x216)]('\x0a'):_0x52f2c2(0x207);return'-\x20'+_0x1ca2a4['name']+':\x20'+(_0x1ca2a4[_0x52f2c2(0x219)]||'No\x20description')+'\x0a\x20\x20Parameters:\x0a'+_0x4b4ff6;})[_0x486784(0x216)]('\x0a\x0a');return _0x486784(0x1de)+_0x5e0108+_0x486784(0x214);}function escapeXml(_0x2b13e4){const _0x533e4d=a33_0x5cad;return _0x2b13e4[_0x533e4d(0x20f)](/&/g,_0x533e4d(0x213))[_0x533e4d(0x20f)](/</g,_0x533e4d(0x20d))[_0x533e4d(0x20f)](/>/g,'&gt;')['replace'](/"/g,_0x533e4d(0x1f5))[_0x533e4d(0x20f)](/'/g,'&apos;');}export function extractToolResults(_0x3130f1){const _0x378928=a33_0x5cad,_0x39db17=[];for(const _0x4b3531 of _0x3130f1){if(_0x4b3531[_0x378928(0x1f6)]==='user'&&typeof _0x4b3531['content']!==_0x378928(0x1e7))for(const _0x46cdbc of _0x4b3531[_0x378928(0x1f7)]){if(_0x46cdbc[_0x378928(0x1fe)]===_0x378928(0x200)&&_0x46cdbc[_0x378928(0x1e6)]){let _0xeb3ea1='';if(typeof _0x46cdbc['content']===_0x378928(0x1e7))_0xeb3ea1=_0x46cdbc[_0x378928(0x1f7)];else Array['isArray'](_0x46cdbc['content'])&&(_0xeb3ea1=_0x46cdbc['content'][_0x378928(0x1d1)](_0x2c528e=>_0x2c528e['type']===_0x378928(0x1cf)&&_0x2c528e[_0x378928(0x1cf)])['map'](_0x4e78e3=>_0x4e78e3['text'])[_0x378928(0x216)]('\x0a'));const _0x2e3d0a=escapeXml(_0x46cdbc[_0x378928(0x1e6)]),_0x8e102e=escapeXml(_0xeb3ea1),_0x248a2e=_0x46cdbc[_0x378928(0x1e3)]?_0x378928(0x1f8):'';_0x39db17[_0x378928(0x1c8)](_0x378928(0x1db)+_0x2e3d0a+'\x22'+_0x248a2e+'>\x0a'+_0x8e102e+_0x378928(0x1d4));}}}if(_0x39db17[_0x378928(0x218)]===0x0)return'';return _0x39db17['join']('\x0a\x0a')+_0x378928(0x1e8);}function a33_0x5cad(_0x492b42,_0xcfb10f){const _0x343e78=a33_0x343e();return a33_0x5cad=function(_0x5cad07,_0x1d882b){_0x5cad07=_0x5cad07-0x1c8;let _0x12a31d=_0x343e78[_0x5cad07];return _0x12a31d;},a33_0x5cad(_0x492b42,_0xcfb10f);}function findJsonEndIndex(_0x4aa806,_0x1d8929){const _0x117df5=a33_0x5cad;let _0x50e022=0x0,_0x1a9c3b=![],_0x5db0b4=![];for(let _0x6f6a88=_0x1d8929;_0x6f6a88<_0x4aa806[_0x117df5(0x218)];_0x6f6a88++){const _0xd59e6e=_0x4aa806[_0x6f6a88];if(_0x5db0b4){_0x5db0b4=![];continue;}if(_0xd59e6e==='\x5c'){_0x5db0b4=!![];continue;}if(_0xd59e6e==='\x22'){_0x1a9c3b=!_0x1a9c3b;continue;}if(!_0x1a9c3b){if(_0xd59e6e==='{')_0x50e022++;else{if(_0xd59e6e==='}'){_0x50e022--;if(_0x50e022===0x0)return _0x6f6a88+0x1;}}}}return-0x1;}export function parseToolCallFromText(_0x157736){const _0x4c6908=a33_0x5cad,_0xa72109=/\{"tool_use":/g,_0x27b088=_0xa72109['exec'](_0x157736);if(!_0x27b088)return null;const _0x5c06e5=_0x27b088[_0x4c6908(0x202)],_0x173dbe=findJsonEndIndex(_0x157736,_0x5c06e5);if(_0x173dbe===-0x1)return null;const _0x21cd49=_0x157736[_0x4c6908(0x1f0)](_0x5c06e5,_0x173dbe);try{const _0x235d2b=JSON[_0x4c6908(0x1cb)](_0x21cd49);if(_0x235d2b[_0x4c6908(0x203)]&&_0x235d2b[_0x4c6908(0x203)]['id']&&_0x235d2b[_0x4c6908(0x203)]['name'])return{'id':_0x235d2b['tool_use']['id'],'name':_0x235d2b[_0x4c6908(0x203)][_0x4c6908(0x1da)],'input':_0x235d2b['tool_use'][_0x4c6908(0x1ee)]||{},'startIndex':_0x5c06e5,'endIndex':_0x173dbe};}catch{return null;}return null;}export function*generateToolCallEvents(_0x2aebdc,_0x516354){const _0x49bbf5=a33_0x5cad,_0x455932={'type':_0x49bbf5(0x1f1),'index':_0x516354,'content_block':{'type':_0x49bbf5(0x203),'id':_0x2aebdc['id'],'name':_0x2aebdc[_0x49bbf5(0x1da)],'input':{}}};yield _0x455932;const _0x465177=JSON[_0x49bbf5(0x1c9)](_0x2aebdc[_0x49bbf5(0x1ee)]),_0x3ed318={'type':'content_block_delta','index':_0x516354,'delta':{'type':_0x49bbf5(0x1f3),'partial_json':_0x465177}};yield _0x3ed318;const _0x48dc09={'type':_0x49bbf5(0x1fb),'index':_0x516354};yield _0x48dc09;const _0x28a914={'type':_0x49bbf5(0x206),'delta':{'stop_reason':_0x49bbf5(0x203),'stop_sequence':null},'usage':{'output_tokens':0x0}};yield _0x28a914;const _0x132570={'type':_0x49bbf5(0x1d2)};yield _0x132570;}export async function*transformTDStreamWithToolDetection(_0x212b9c,_0xf01e18,_0x2a4bb7,_0x2d9653=![]){const _0x582d26=a33_0x5cad;let _0x159bc2=0x0,_0x234f89=0x0,_0x4a2ce1=0x0,_0xec3dc1=![],_0x1050c6='',_0x2804b5=0x0,_0x12e460=![];const _0x223d07=0xc8,_0xfa0d8b={'type':'message_start','message':{'id':_0xf01e18,'type':_0x582d26(0x201),'role':_0x582d26(0x1e0),'content':[],'model':_0x2a4bb7,'stop_reason':null,'stop_sequence':null,'usage':{'input_tokens':_0x159bc2,'output_tokens':0x0}}};yield _0xfa0d8b;for await(const _0x39913f of _0x212b9c){if(_0x582d26(0x1f7)in _0x39913f){const _0xc014b1=_0x39913f;_0x1050c6+=_0xc014b1[_0x582d26(0x1f7)];const _0x44e812=_0x1050c6[_0x582d26(0x1ef)](_0x582d26(0x1d7));if(_0x44e812!==-0x1){const _0xc91aca=parseToolCallFromText(_0x1050c6);if(_0xc91aca){_0x12e460=!![];_0x2d9653&&(console[_0x582d26(0x209)](_0x582d26(0x1d5),_0xc91aca[_0x582d26(0x1da)]),console[_0x582d26(0x209)](''));const _0x2d228b=_0x1050c6[_0x582d26(0x1f0)](_0x2804b5,_0xc91aca[_0x582d26(0x1e4)])[_0x582d26(0x208)]();if(_0x2d228b){if(!_0xec3dc1){const _0x4bbffc={'type':_0x582d26(0x1f1),'index':_0x4a2ce1,'content_block':{'type':_0x582d26(0x1cf),'text':''}};yield _0x4bbffc,_0xec3dc1=!![];}const _0x1f9eb9={'type':_0x582d26(0x211),'index':_0x4a2ce1,'delta':{'type':_0x582d26(0x20e),'text':_0x2d228b}};yield _0x1f9eb9,_0x234f89+=Math[_0x582d26(0x1d8)](_0x2d228b[_0x582d26(0x218)]/0x4);}if(_0xec3dc1){const _0x2ab5={'type':'content_block_stop','index':_0x4a2ce1};yield _0x2ab5,_0x4a2ce1++;}for(const _0x148c5e of generateToolCallEvents(_0xc91aca,_0x4a2ce1)){_0x148c5e['type']===_0x582d26(0x206)&&(_0x148c5e[_0x582d26(0x215)][_0x582d26(0x1ec)]=_0x234f89),yield _0x148c5e;}return;}const _0x1cc717=_0x1050c6[_0x582d26(0x1f0)](_0x2804b5,_0x44e812);if(_0x1cc717){if(!_0xec3dc1){const _0x5194a0={'type':_0x582d26(0x1f1),'index':_0x4a2ce1,'content_block':{'type':'text','text':''}};yield _0x5194a0,_0xec3dc1=!![];}const _0x312ce1={'type':'content_block_delta','index':_0x4a2ce1,'delta':{'type':'text_delta','text':_0x1cc717}};yield _0x312ce1,_0x234f89+=Math['ceil'](_0x1cc717['length']/0x4),_0x2804b5=_0x44e812;}continue;}const _0x59dfcd=_0x1050c6[_0x582d26(0x218)]-_0x223d07;if(_0x59dfcd>_0x2804b5){const _0x53dfd0=_0x1050c6[_0x582d26(0x1f0)](_0x2804b5,_0x59dfcd);if(_0x53dfd0){if(!_0xec3dc1){const _0x4b18ea={'type':'content_block_start','index':_0x4a2ce1,'content_block':{'type':_0x582d26(0x1cf),'text':''}};yield _0x4b18ea,_0xec3dc1=!![];}const _0x540a74={'type':_0x582d26(0x211),'index':_0x4a2ce1,'delta':{'type':_0x582d26(0x20e),'text':_0x53dfd0}};yield _0x540a74,_0x234f89+=Math[_0x582d26(0x1d8)](_0x53dfd0[_0x582d26(0x218)]/0x4),_0x2804b5=_0x59dfcd;}}}else{if(_0x582d26(0x209)in _0x39913f){const _0x1de4cb=_0x39913f;yield{'type':_0x582d26(0x209),'error':{'type':_0x582d26(0x1fc),'message':_0x1de4cb[_0x582d26(0x209)]}};return;}}}if(!_0x12e460){const _0x56d5b1=_0x1050c6[_0x582d26(0x1f0)](_0x2804b5);if(_0x56d5b1){if(!_0xec3dc1){const _0x51e37e={'type':_0x582d26(0x1f1),'index':_0x4a2ce1,'content_block':{'type':_0x582d26(0x1cf),'text':''}};yield _0x51e37e,_0xec3dc1=!![];}const _0x363f61={'type':_0x582d26(0x211),'index':_0x4a2ce1,'delta':{'type':'text_delta','text':_0x56d5b1}};yield _0x363f61,_0x234f89+=Math[_0x582d26(0x1d8)](_0x56d5b1[_0x582d26(0x218)]/0x4);}if(_0xec3dc1){const _0x1fdca6={'type':_0x582d26(0x1fb),'index':_0x4a2ce1};yield _0x1fdca6;}const _0x4c6f0e={'type':_0x582d26(0x206),'delta':{'stop_reason':'end_turn','stop_sequence':null},'usage':{'output_tokens':_0x234f89}};yield _0x4c6f0e;const _0x319e9f={'type':_0x582d26(0x1d2)};yield _0x319e9f;}}export{generateMessageId};function a33_0x343e(){const _0x15c8f4=['user','length','description','push','stringify','messages','parse','haiku','random','toLowerCase','text','message_start','filter','message_stop','5047505YDZrhA','\x0a</tool_result>','[DEBUG]\x20Tool\x20call\x20detected:','includes','{\x22tool_use\x22:','ceil','37834KjzxSK','name','<tool_result\x20tool_use_id=\x22','input_schema','15HZxcTM','<tools>\x0aYou\x20have\x20access\x20to\x20the\x20following\x20tools:\x0a\x0a','\x20(required)','assistant','684808FjQOwY','pop','is_error','startIndex','No\x20user\x20message\x20found\x20in\x20request\x20delta','tool_use_id','string','\x0a\x0aPlease\x20continue\x20your\x20response\x20based\x20on\x20the\x20tool\x20results\x20above.\x0a\x0a','Tool\x20calls\x20not\x20yet\x20supported\x20in\x20proxy:','5886111jdlWGU','slice','output_tokens','properties','input','indexOf','substring','content_block_start','end_turn','input_json_delta','opus','&quot;','role','content','\x20error=\x22true\x22','tool_call','toString','content_block_stop','api_error','map','type','sonnet','tool_result','message','index','tool_use','entries','\x20\x20\x20\x20-\x20','message_delta','\x20\x20\x20\x20(no\x20parameters)','trim','error','event:\x20','warn','1784924jVitmr','&lt;','text_delta','replace','700897qjkQTo','content_block_delta','3936000omrING','&amp;','\x0a\x0aTo\x20use\x20a\x20tool,\x20you\x20MUST\x20output\x20EXACTLY\x20this\x20JSON\x20format\x20on\x20its\x20own\x20line:\x0a{\x22tool_use\x22:{\x22id\x22:\x22toolu_<random>\x22,\x22name\x22:\x22<tool_name>\x22,\x22input\x22:{<parameters>}}}\x0a\x0aImportant:\x0a-\x20The\x20JSON\x20must\x20be\x20valid\x20and\x20on\x20a\x20single\x20line\x0a-\x20Generate\x20a\x20unique\x20random\x20ID\x20starting\x20with\x20\x22toolu_\x22\x0a-\x20Do\x20NOT\x20include\x20any\x20other\x20text\x20on\x20the\x20line\x20with\x20the\x20JSON\x0a-\x20After\x20outputting\x20the\x20tool\x20use\x20JSON,\x20stop\x20and\x20wait\x20for\x20the\x20tool\x20result\x0a-\x20Once\x20you\x20receive\x20a\x20tool\x20result,\x20continue\x20your\x20response\x20naturally\x0a\x0aExample:\x0aUser:\x20\x22What\x27s\x2025\x20*\x204?\x22\x0aAssistant:\x20I\x27ll\x20calculate\x20that\x20for\x20you.\x0a{\x22tool_use\x22:{\x22id\x22:\x22toolu_abc123\x22,\x22name\x22:\x22calculator\x22,\x22input\x22:{\x22expression\x22:\x2225\x20*\x204\x22}}}\x0a\x0a</tools>\x0a\x0a','usage','join'];a33_0x343e=function(){return _0x15c8f4;};return a33_0x343e();}