@treasuredata/tdx 0.1.8 → 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 (81) hide show
  1. package/README.md +82 -1
  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.d.ts +36 -1
  40. package/dist/proxy/anthropic-adapter.d.ts.map +1 -1
  41. package/dist/proxy/anthropic-adapter.js +1 -1
  42. package/dist/proxy/anthropic-adapter.js.map +1 -1
  43. package/dist/proxy/server.d.ts.map +1 -1
  44. package/dist/proxy/server.js +1 -1
  45. package/dist/proxy/server.js.map +1 -1
  46. package/dist/sdk/api.js +1 -1
  47. package/dist/sdk/database.js +1 -1
  48. package/dist/sdk/errors.d.ts +2 -0
  49. package/dist/sdk/errors.d.ts.map +1 -1
  50. package/dist/sdk/errors.js +1 -1
  51. package/dist/sdk/errors.js.map +1 -1
  52. package/dist/sdk/index.js +1 -1
  53. package/dist/sdk/llm.js +1 -1
  54. package/dist/sdk/query.js +1 -1
  55. package/dist/sdk/segment.js +1 -1
  56. package/dist/sdk/table.js +1 -1
  57. package/dist/sdk/workflow.js +1 -1
  58. package/dist/types/endpoints.js +1 -1
  59. package/dist/types/index.js +1 -1
  60. package/dist/utils/agent-ref-parser.js +1 -1
  61. package/dist/utils/chat-cache.js +1 -1
  62. package/dist/utils/colors.js +1 -1
  63. package/dist/utils/command-output.js +1 -1
  64. package/dist/utils/file-permissions.js +1 -1
  65. package/dist/utils/format-detector.js +1 -1
  66. package/dist/utils/formatters.js +1 -1
  67. package/dist/utils/model-aliases.js +1 -1
  68. package/dist/utils/option-validation.js +1 -1
  69. package/dist/utils/port.d.ts +18 -0
  70. package/dist/utils/port.d.ts.map +1 -0
  71. package/dist/utils/port.js +1 -0
  72. package/dist/utils/port.js.map +1 -0
  73. package/dist/utils/process.js +1 -1
  74. package/dist/utils/segment-ref-parser.js +1 -1
  75. package/dist/utils/spinner.js +1 -1
  76. package/dist/utils/sql-parser.js +1 -1
  77. package/dist/utils/sse-parser.js +1 -1
  78. package/dist/utils/string-utils.js +1 -1
  79. package/dist/utils/table-ref-parser.js +1 -1
  80. package/dist/utils/workflow-utils.js +1 -1
  81. package/package.json +1 -1
@@ -1 +1 @@
1
- const a24_0x24a0f9=a24_0x5602;(function(_0xdac27,_0x4f8679){const _0x41ca4d=a24_0x5602,_0x26378c=_0xdac27();while(!![]){try{const _0x1f805c=-parseInt(_0x41ca4d(0x139))/0x1*(-parseInt(_0x41ca4d(0x14b))/0x2)+-parseInt(_0x41ca4d(0x17e))/0x3+parseInt(_0x41ca4d(0x155))/0x4+-parseInt(_0x41ca4d(0x12c))/0x5+parseInt(_0x41ca4d(0x11c))/0x6+-parseInt(_0x41ca4d(0x191))/0x7+parseInt(_0x41ca4d(0x126))/0x8*(-parseInt(_0x41ca4d(0x149))/0x9);if(_0x1f805c===_0x4f8679)break;else _0x26378c['push'](_0x26378c['shift']());}catch(_0x54c691){_0x26378c['push'](_0x26378c['shift']());}}}(a24_0x4827,0x5a02c));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_0x2332bc from'readline';function a24_0x4827(){const _0x2c29a4=['\x20\x20Files\x20extracted:\x20','Retrying\x20session...','workflow:workflows','Task\x20name:\x20','Filter:\x20','Error:\x20Project\x20name\x20is\x20required','tasks','retrySession','Show\x20logs\x20for\x20a\x20specific\x20task','\x20log\x20entr','workflow:download','workflow:sessions','revision','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','resumeFrom','workflow:kill','status','Killing\x20attempt...','Project\x20filter:\x20','attempts','1560147eEvXEY','name','description','message','Pattern:\x20','session','Listing\x20workflow\x20attempts...','Error:\x20Attempt\x20ID\x20is\x20required','Project:\x20','Including\x20subtasks:\x20yes','\x20\x20Revision:\x20','\x20workflow','Filter:\x20project=','workflow:retry','readFile','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','parse','projectId','Listing\x20workflow\x20projects...','477442agfVvQ','Target:\x20','\x20\x20Cause:\x20','workflows','Validation:\x20skipped','error','toLowerCase','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','verbose','projects','workflow:logs','Retrying\x20attempt...','✔\x20Found\x20','attempt:','includeRetried','3831684uCDszR','workflow:projects','...','limit','Retry\x20a\x20session\x20or\x20attempt','params','length','\x22?\x20This\x20cannot\x20be\x20undone.','List\x20workflows','offset','2851488nNrBHf','Usage:\x20workflow:delete\x20<project-name-or-id>','sessions','force','Show\x20specific\x20attempt\x20details','Listing\x20workflows...','746435TADVjp','✔\x20Pushed\x20','attempt','download','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','\x20task','\x20(y/N):\x20','workflow:attempts','reason','Getting\x20attempt\x20tasks...','Attempt\x20ID:\x20','Getting\x20task\x20logs...','attemptId','139rQcPJU','✔\x20Deleted\x20project\x20','question','Downloading\x20project\x20','Resume\x20from:\x20','substring','Include\x20retried:\x20yes','retryAttempt','workflow','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','includeSubtasks','yes','cause','Status:\x20','filesExtracted','\x20\x20Location:\x20','9lahWTg','utf-8','7754QFCxWC','\x20\x20Project\x20ID:\x20','Reason:\x20','Cancelled','\x20is\x20not\x20a\x20directory','Error:\x20Invalid\x20JSON\x20in\x20--params','\x20attempt','From\x20task:\x20','Error:\x20','\x20project','1140580yvjHZG','Output\x20directory:\x20','Show\x20tasks\x20for\x20an\x20attempt','Revision:\x20','stat','workflow:tasks','kill','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','Pushing\x20workflow\x20project...','data','workflow:push','stdin','workflow:delete','projectName','execute','Listing\x20workflow\x20sessions...','skipValidation','startsWith','Project\x20name:\x20','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]'];a24_0x4827=function(){return _0x2c29a4;};return a24_0x4827();}async function confirm(_0xc25e3c){const _0xc39c8c=a24_0x5602,_0x210aaf=a24_0x2332bc['createInterface']({'input':process[_0xc39c8c(0x160)],'output':process['stdout']});return new Promise(_0x5b3023=>{const _0x110e69=_0xc39c8c;_0x210aaf[_0x110e69(0x13b)](_0xc25e3c+_0x110e69(0x132),_0x43c2bd=>{const _0x3926e2=_0x110e69;_0x210aaf['close'](),_0x5b3023(_0x43c2bd[_0x3926e2(0x197)]()==='y'||_0x43c2bd[_0x3926e2(0x197)]()==='yes');});});}function a24_0x5602(_0x5eb21b,_0x1dda6a){const _0x4827f0=a24_0x4827();return a24_0x5602=function(_0x56024a,_0x1e2efd){_0x56024a=_0x56024a-0x11c;let _0x1b3f52=_0x4827f0[_0x56024a];return _0x1b3f52;},a24_0x5602(_0x5eb21b,_0x1dda6a);}export class WorkflowProjectsCommand extends BaseCommand{[a24_0x24a0f9(0x17f)]=a24_0x24a0f9(0x11d);[a24_0x24a0f9(0x180)]='List\x20all\x20workflow\x20projects';async[a24_0x24a0f9(0x163)](_0x461833){const _0xd4281c=a24_0x24a0f9,{options:_0x5b9e8d,args:_0x51ffb9,tdx:_0x512fc6}=_0x461833,_0x4d25e4=_0x51ffb9[0x0];try{_0x5b9e8d[_0xd4281c(0x199)]&&_0x4d25e4&&console[_0xd4281c(0x196)](_0xd4281c(0x182)+_0x4d25e4);const _0x9c621c=await withSpinner(_0xd4281c(0x190),()=>_0x512fc6[_0xd4281c(0x141)][_0xd4281c(0x19a)](_0x4d25e4,{'limit':_0x5b9e8d[_0xd4281c(0x11f)]}),{'verbose':_0x5b9e8d['verbose']}),_0x4df308=_0x9c621c['data'];return console['error'](_0xd4281c(0x19d)+_0x4df308['length']+_0xd4281c(0x154)+(_0x4df308[_0xd4281c(0x122)]!==0x1?'s':'')),await handleSDKOutput(_0x4df308,_0x5b9e8d),0x0;}catch(_0x5dc385){if(_0x5dc385 instanceof SDKError)return console[_0xd4281c(0x196)](_0xd4281c(0x153)+_0x5dc385[_0xd4281c(0x181)]),_0x5dc385[_0xd4281c(0x145)]&&console[_0xd4281c(0x196)]('\x20\x20Cause:\x20'+_0x5dc385['cause']),0x1;throw _0x5dc385;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a24_0x24a0f9(0x17f)]=a24_0x24a0f9(0x16c);[a24_0x24a0f9(0x180)]=a24_0x24a0f9(0x124);async[a24_0x24a0f9(0x163)](_0x3e1f85){const _0x4fe565=a24_0x24a0f9,{options:_0xca1a19,args:_0x1df400,tdx:_0x12b919}=_0x3e1f85,_0x3eaf19=_0x1df400[0x0];try{_0xca1a19[_0x4fe565(0x199)]&&_0x3eaf19&&console[_0x4fe565(0x196)](_0x4fe565(0x17c)+_0x3eaf19);const _0x41b7d0=await withSpinner(_0x4fe565(0x12b),()=>_0x12b919[_0x4fe565(0x141)][_0x4fe565(0x194)](_0x3eaf19,{'limit':_0xca1a19['limit']}),{'verbose':_0xca1a19[_0x4fe565(0x199)]}),_0x269a37=_0x41b7d0[_0x4fe565(0x15e)];return console[_0x4fe565(0x196)](_0x4fe565(0x19d)+_0x269a37[_0x4fe565(0x122)]+_0x4fe565(0x189)+(_0x269a37['length']!==0x1?'s':'')),await handleSDKOutput(_0x269a37,_0xca1a19),0x0;}catch(_0x746262){if(_0x746262 instanceof SDKError)return console[_0x4fe565(0x196)](_0x4fe565(0x153)+_0x746262[_0x4fe565(0x181)]),_0x746262['cause']&&console[_0x4fe565(0x196)](_0x4fe565(0x193)+_0x746262[_0x4fe565(0x145)]),0x1;throw _0x746262;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']=a24_0x24a0f9(0x175);[a24_0x24a0f9(0x180)]='List\x20workflow\x20execution\x20sessions';async[a24_0x24a0f9(0x163)](_0x2cfcbc){const _0x2e098c=a24_0x24a0f9,{options:_0x42356d,args:_0x3494a3,tdx:_0x1084db}=_0x2cfcbc;let _0x5873b7,_0x475baf;if(_0x3494a3[0x0]){const _0x5e9838=_0x3494a3[0x0]['split']('.');if(_0x5e9838[_0x2e098c(0x122)]===0x1)_0x5873b7=_0x5e9838[0x0];else{if(_0x5e9838[_0x2e098c(0x122)]===0x2)[_0x5873b7,_0x475baf]=_0x5e9838;else return console[_0x2e098c(0x196)](_0x2e098c(0x177)),0x1;}}try{if(_0x42356d[_0x2e098c(0x199)]){if(_0x5873b7&&_0x475baf)console[_0x2e098c(0x196)](_0x2e098c(0x16e)+_0x5873b7+'.'+_0x475baf);else _0x5873b7&&console['error'](_0x2e098c(0x18a)+_0x5873b7);const _0x1fd0c4=_0x42356d[_0x2e098c(0x17a)];_0x1fd0c4&&console[_0x2e098c(0x196)](_0x2e098c(0x146)+_0x1fd0c4);}const _0x1cb815=await withSpinner(_0x2e098c(0x164),()=>_0x1084db[_0x2e098c(0x141)][_0x2e098c(0x128)]({'projectName':_0x5873b7,'workflowName':_0x475baf,'status':_0x42356d['status'],'fromTime':_0x42356d['from'],'toTime':_0x42356d['to'],'limit':_0x42356d['limit']}),{'verbose':_0x42356d[_0x2e098c(0x199)]}),_0x3e5f64=_0x1cb815[_0x2e098c(0x15e)];return console[_0x2e098c(0x196)](_0x2e098c(0x19d)+_0x3e5f64[_0x2e098c(0x122)]+'\x20session'+(_0x3e5f64['length']!==0x1?'s':'')),await handleSDKOutput(_0x3e5f64,_0x42356d),0x0;}catch(_0x109a6d){if(_0x109a6d instanceof SDKError)return console['error']('Error:\x20'+_0x109a6d[_0x2e098c(0x181)]),_0x109a6d['cause']&&console['error'](_0x2e098c(0x193)+_0x109a6d[_0x2e098c(0x145)]),0x1;throw _0x109a6d;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a24_0x24a0f9(0x17f)]=a24_0x24a0f9(0x133);[a24_0x24a0f9(0x180)]='List\x20workflow\x20attempts';async[a24_0x24a0f9(0x163)](_0x42e5d2){const _0x2d43cd=a24_0x24a0f9,{options:_0x9e3d4,args:_0x1c9c03,tdx:_0x58b47b}=_0x42e5d2;let _0x369dea,_0x530573;if(_0x1c9c03[0x0]){const _0x1f0485=_0x1c9c03[0x0]['split']('.');if(_0x1f0485[_0x2d43cd(0x122)]===0x1)_0x369dea=_0x1f0485[0x0];else{if(_0x1f0485[_0x2d43cd(0x122)]===0x2)[_0x369dea,_0x530573]=_0x1f0485;else return console['error']('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{const _0x2ed0b0=_0x9e3d4[_0x2d43cd(0x19f)];if(_0x9e3d4[_0x2d43cd(0x199)]){if(_0x369dea&&_0x530573)console['error'](_0x2d43cd(0x16e)+_0x369dea+'.'+_0x530573);else _0x369dea&&console[_0x2d43cd(0x196)](_0x2d43cd(0x18a)+_0x369dea);_0x2ed0b0&&console['error'](_0x2d43cd(0x13f));}const _0x5b919c=await withSpinner(_0x2d43cd(0x184),()=>_0x58b47b[_0x2d43cd(0x141)][_0x2d43cd(0x17d)]({'projectName':_0x369dea,'workflowName':_0x530573,'includeRetried':_0x2ed0b0,'limit':_0x9e3d4[_0x2d43cd(0x11f)]}),{'verbose':_0x9e3d4[_0x2d43cd(0x199)]}),_0x38a79c=_0x5b919c[_0x2d43cd(0x15e)];return console['error'](_0x2d43cd(0x19d)+_0x38a79c[_0x2d43cd(0x122)]+_0x2d43cd(0x151)+(_0x38a79c['length']!==0x1?'s':'')),await handleSDKOutput(_0x38a79c,_0x9e3d4),0x0;}catch(_0x5b0aa9){if(_0x5b0aa9 instanceof SDKError)return console[_0x2d43cd(0x196)](_0x2d43cd(0x153)+_0x5b0aa9[_0x2d43cd(0x181)]),_0x5b0aa9['cause']&&console[_0x2d43cd(0x196)](_0x2d43cd(0x193)+_0x5b0aa9[_0x2d43cd(0x145)]),0x1;throw _0x5b0aa9;}}}export class WorkflowAttemptCommand extends BaseCommand{[a24_0x24a0f9(0x17f)]='workflow:attempt';[a24_0x24a0f9(0x180)]=a24_0x24a0f9(0x12a);async['execute'](_0x467a8c){const _0x2f1598=a24_0x24a0f9,{options:_0x4e669b,args:_0x33a3cf,tdx:_0x265e36}=_0x467a8c,_0x387204=_0x33a3cf[0x0];if(!_0x387204)return console['error'](_0x2f1598(0x185)),0x1;try{_0x4e669b[_0x2f1598(0x199)]&&console[_0x2f1598(0x196)](_0x2f1598(0x136)+_0x387204);const _0xa2b518=await withSpinner('Getting\x20attempt\x20details...',()=>_0x265e36[_0x2f1598(0x141)][_0x2f1598(0x12e)](_0x387204),{'verbose':_0x4e669b[_0x2f1598(0x199)]}),_0x49073b=_0xa2b518['data'];return await handleSDKOutput([_0x49073b],_0x4e669b),0x0;}catch(_0x441606){if(_0x441606 instanceof SDKError)return console[_0x2f1598(0x196)](_0x2f1598(0x153)+_0x441606[_0x2f1598(0x181)]),_0x441606[_0x2f1598(0x145)]&&console[_0x2f1598(0x196)](_0x2f1598(0x193)+_0x441606['cause']),0x1;throw _0x441606;}}}export class WorkflowTasksCommand extends BaseCommand{['name']=a24_0x24a0f9(0x15a);[a24_0x24a0f9(0x180)]=a24_0x24a0f9(0x157);async[a24_0x24a0f9(0x163)](_0x2a34fa){const _0x2deeaa=a24_0x24a0f9,{options:_0x44d7fd,args:_0x580302,tdx:_0x153b9f}=_0x2a34fa,_0x13f7f2=_0x580302[0x0];if(!_0x13f7f2)return console['error'](_0x2deeaa(0x185)),0x1;try{const _0x5b57cf=_0x44d7fd[_0x2deeaa(0x143)];_0x44d7fd[_0x2deeaa(0x199)]&&(console[_0x2deeaa(0x196)](_0x2deeaa(0x136)+_0x13f7f2),_0x5b57cf&&console['error'](_0x2deeaa(0x187)));const _0x5797a6=await withSpinner(_0x2deeaa(0x135),()=>_0x153b9f[_0x2deeaa(0x141)][_0x2deeaa(0x170)](_0x13f7f2,_0x5b57cf||![]),{'verbose':_0x44d7fd['verbose']}),_0x11afbc=_0x5797a6[_0x2deeaa(0x15e)];return console[_0x2deeaa(0x196)](_0x2deeaa(0x19d)+_0x11afbc[_0x2deeaa(0x122)]+_0x2deeaa(0x131)+(_0x11afbc[_0x2deeaa(0x122)]!==0x1?'s':'')),await handleSDKOutput(_0x11afbc,_0x44d7fd),0x0;}catch(_0x47f2c3){if(_0x47f2c3 instanceof SDKError)return console['error'](_0x2deeaa(0x153)+_0x47f2c3[_0x2deeaa(0x181)]),_0x47f2c3[_0x2deeaa(0x145)]&&console[_0x2deeaa(0x196)](_0x2deeaa(0x193)+_0x47f2c3['cause']),0x1;throw _0x47f2c3;}}}export class WorkflowLogsCommand extends BaseCommand{['name']=a24_0x24a0f9(0x19b);['description']=a24_0x24a0f9(0x172);async['execute'](_0x409b49){const _0x3772ab=a24_0x24a0f9,{options:_0x54126b,args:_0x3cdf0e,tdx:_0x4d6eac}=_0x409b49,_0x3bbb0b=_0x3cdf0e[0x0],_0x1339b2=_0x3cdf0e[0x1];if(!_0x3bbb0b||!_0x1339b2)return console[_0x3772ab(0x196)]('Error:\x20Attempt\x20ID\x20and\x20task\x20name\x20are\x20required'),0x1;try{_0x54126b[_0x3772ab(0x199)]&&(console[_0x3772ab(0x196)](_0x3772ab(0x136)+_0x3bbb0b),console[_0x3772ab(0x196)](_0x3772ab(0x16d)+_0x1339b2));const _0x2e94fe=_0x54126b[_0x3772ab(0x125)],_0x411c1c=await withSpinner(_0x3772ab(0x137),()=>_0x4d6eac[_0x3772ab(0x141)]['logs'](_0x3bbb0b,_0x1339b2,{'offset':_0x2e94fe,'limit':_0x54126b['limit']}),{'verbose':_0x54126b[_0x3772ab(0x199)]}),_0x3ad167=_0x411c1c[_0x3772ab(0x15e)];return console[_0x3772ab(0x196)](_0x3772ab(0x19d)+_0x3ad167[_0x3772ab(0x122)]+_0x3772ab(0x173)+(_0x3ad167[_0x3772ab(0x122)]!==0x1?'ies':'y')),await handleSDKOutput(_0x3ad167,_0x54126b),0x0;}catch(_0x42efc1){if(_0x42efc1 instanceof SDKError)return console[_0x3772ab(0x196)](_0x3772ab(0x153)+_0x42efc1[_0x3772ab(0x181)]),_0x42efc1[_0x3772ab(0x145)]&&console['error']('\x20\x20Cause:\x20'+_0x42efc1[_0x3772ab(0x145)]),0x1;throw _0x42efc1;}}}export class WorkflowKillCommand extends BaseCommand{[a24_0x24a0f9(0x17f)]=a24_0x24a0f9(0x179);['description']='Kill\x20a\x20running\x20attempt';async[a24_0x24a0f9(0x163)](_0x2ccb32){const _0x53b334=a24_0x24a0f9,{options:_0x428148,args:_0x1f185a,tdx:_0x45d14f}=_0x2ccb32,_0x444237=_0x1f185a[0x0];if(!_0x444237)return console[_0x53b334(0x196)](_0x53b334(0x185)),0x1;try{const _0x262d5c=_0x428148[_0x53b334(0x134)];_0x428148[_0x53b334(0x199)]&&(console[_0x53b334(0x196)](_0x53b334(0x136)+_0x444237),_0x262d5c&&console['error'](_0x53b334(0x14d)+_0x262d5c));if(!_0x428148[_0x53b334(0x144)]){const _0x537265=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20'+_0x444237+'?');if(!_0x537265)return console[_0x53b334(0x196)](_0x53b334(0x14e)),0x0;}const _0x578279=await withSpinner(_0x53b334(0x17b),()=>_0x45d14f[_0x53b334(0x141)][_0x53b334(0x15b)](_0x444237,_0x262d5c),{'verbose':_0x428148[_0x53b334(0x199)]}),_0x5158bd=_0x578279[_0x53b334(0x15e)];return console['error']('✔\x20'+_0x5158bd),0x0;}catch(_0x3d7770){if(_0x3d7770 instanceof SDKError)return console[_0x53b334(0x196)]('Error:\x20'+_0x3d7770[_0x53b334(0x181)]),_0x3d7770[_0x53b334(0x145)]&&console[_0x53b334(0x196)](_0x53b334(0x193)+_0x3d7770['cause']),0x1;throw _0x3d7770;}}}export class WorkflowRetryCommand extends BaseCommand{[a24_0x24a0f9(0x17f)]=a24_0x24a0f9(0x18b);[a24_0x24a0f9(0x180)]=a24_0x24a0f9(0x120);async[a24_0x24a0f9(0x163)](_0x19b7f1){const _0xb68380=a24_0x24a0f9,{options:_0x5c12f0,args:_0x54e50d,tdx:_0x3aad0b}=_0x19b7f1,_0x9eea50=_0x54e50d[0x0];if(!_0x9eea50)return console[_0xb68380(0x196)]('Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required'),console[_0xb68380(0x196)](_0xb68380(0x198)),0x1;let _0x109d62=![],_0x489b66=_0x9eea50;if(_0x9eea50[_0xb68380(0x166)]('session:'))_0x109d62=!![],_0x489b66=_0x9eea50[_0xb68380(0x13e)](0x8);else{if(_0x9eea50['startsWith'](_0xb68380(0x19e)))_0x109d62=![],_0x489b66=_0x9eea50[_0xb68380(0x13e)](0x8);else return console[_0xb68380(0x196)](_0xb68380(0x168)),console[_0xb68380(0x196)](_0xb68380(0x198)),0x1;}try{const _0x457758=_0x5c12f0['fromTask'],_0x28d8e4=_0x5c12f0[_0xb68380(0x178)],_0x97d52d=_0x5c12f0[_0xb68380(0x121)],_0x5e3df7=_0x5c12f0[_0xb68380(0x129)];_0x5c12f0[_0xb68380(0x199)]&&(console[_0xb68380(0x196)](_0xb68380(0x192)+(_0x109d62?_0xb68380(0x183):_0xb68380(0x12e))+'\x20'+_0x489b66),_0x457758&&console[_0xb68380(0x196)](_0xb68380(0x152)+_0x457758),_0x28d8e4&&console[_0xb68380(0x196)](_0xb68380(0x13d)+_0x28d8e4),_0x97d52d&&console['error']('Params:\x20'+_0x97d52d),_0x5e3df7&&console[_0xb68380(0x196)]('Force:\x20yes'));let _0x1de53b;if(_0x97d52d)try{if(_0x97d52d[_0xb68380(0x166)]('@')){const _0x4b9ee0=await import('fs/promises'),_0x71a3e5=_0x97d52d[_0xb68380(0x13e)](0x1),_0x2b0071=await _0x4b9ee0[_0xb68380(0x18c)](_0x71a3e5,_0xb68380(0x14a));_0x1de53b=JSON[_0xb68380(0x18e)](_0x2b0071);}else _0x1de53b=JSON['parse'](_0x97d52d);}catch{return console[_0xb68380(0x196)](_0xb68380(0x150)),0x1;}if(!_0x5c12f0[_0xb68380(0x144)]){const _0x2a8b0b=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20'+(_0x109d62?'session':'attempt')+'\x20'+_0x489b66+'?');if(!_0x2a8b0b)return console[_0xb68380(0x196)](_0xb68380(0x14e)),0x0;}let _0x19ac2e;_0x109d62?_0x19ac2e=await withSpinner(_0xb68380(0x16b),()=>_0x3aad0b[_0xb68380(0x141)][_0xb68380(0x171)](_0x489b66,{'fromTask':_0x457758,'retryParams':_0x1de53b}),{'verbose':_0x5c12f0[_0xb68380(0x199)]}):_0x19ac2e=await withSpinner(_0xb68380(0x19c),()=>_0x3aad0b[_0xb68380(0x141)][_0xb68380(0x140)](_0x489b66,{'resumeFrom':_0x28d8e4,'retryParams':_0x1de53b,'force':_0x5e3df7}),{'verbose':_0x5c12f0[_0xb68380(0x199)]});const _0x3e1eec=_0x19ac2e['data'];return console[_0xb68380(0x196)]('✔\x20Retry\x20started'),console[_0xb68380(0x196)]('\x20\x20New\x20attempt\x20ID:\x20'+_0x3e1eec[_0xb68380(0x138)]),console[_0xb68380(0x196)]('\x20\x20Session\x20ID:\x20'+_0x3e1eec['sessionId']),0x0;}catch(_0x440f6c){if(_0x440f6c instanceof SDKError)return console['error'](_0xb68380(0x153)+_0x440f6c[_0xb68380(0x181)]),_0x440f6c[_0xb68380(0x145)]&&console[_0xb68380(0x196)](_0xb68380(0x193)+_0x440f6c[_0xb68380(0x145)]),0x1;throw _0x440f6c;}}}export class WorkflowDownloadCommand extends BaseCommand{[a24_0x24a0f9(0x17f)]=a24_0x24a0f9(0x174);[a24_0x24a0f9(0x180)]='Download\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a24_0x24a0f9(0x163)](_0x2ee5d9){const _0x130f5b=a24_0x24a0f9,{options:_0x5f4eb1,args:_0x9f8fbd,tdx:_0x3e8f0e}=_0x2ee5d9,_0x311daf=_0x9f8fbd[0x0],_0x2e84c0=_0x9f8fbd[0x1]||'.';if(!_0x311daf)return console[_0x130f5b(0x196)](_0x130f5b(0x16f)),console['error'](_0x130f5b(0x169)),0x1;const _0x4d686b=_0x5f4eb1[_0x130f5b(0x176)];_0x5f4eb1[_0x130f5b(0x199)]&&(console[_0x130f5b(0x196)](_0x130f5b(0x186)+_0x311daf),console['error'](_0x130f5b(0x156)+_0x2e84c0),_0x4d686b&&console[_0x130f5b(0x196)](_0x130f5b(0x158)+_0x4d686b));const _0x36e725=await withSpinner(_0x130f5b(0x13c)+_0x311daf+_0x130f5b(0x11e),()=>_0x3e8f0e[_0x130f5b(0x141)][_0x130f5b(0x12f)](_0x311daf,_0x2e84c0,{'revision':_0x4d686b}),{'verbose':_0x5f4eb1['verbose']}),_0x4a21fd=_0x36e725[_0x130f5b(0x15e)];return console[_0x130f5b(0x196)]('✔\x20Downloaded\x20'+_0x4a21fd[_0x130f5b(0x162)]),console[_0x130f5b(0x196)](_0x130f5b(0x188)+_0x4a21fd[_0x130f5b(0x176)]),console[_0x130f5b(0x196)](_0x130f5b(0x16a)+_0x4a21fd[_0x130f5b(0x147)]),console[_0x130f5b(0x196)](_0x130f5b(0x148)+_0x2e84c0+'/'+_0x4a21fd[_0x130f5b(0x162)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a24_0x24a0f9(0x17f)]=a24_0x24a0f9(0x15f);[a24_0x24a0f9(0x180)]=a24_0x24a0f9(0x15c);async[a24_0x24a0f9(0x163)](_0x243356){const _0x171b1d=a24_0x24a0f9,{options:_0x499c3d,args:_0x29917a,tdx:_0x5dd7e1}=_0x243356;let _0x4d5081='.',_0x2f406a=_0x499c3d[_0x171b1d(0x17f)];if(_0x29917a[0x0]){const {promises:_0x50f6f5}=await import('fs');try{const _0x4a9268=await _0x50f6f5[_0x171b1d(0x159)](_0x29917a[0x0]);if(_0x4a9268['isDirectory']())_0x4d5081=_0x29917a[0x0];else return console[_0x171b1d(0x196)](_0x171b1d(0x153)+_0x29917a[0x0]+_0x171b1d(0x14f)),0x1;}catch{_0x2f406a=_0x29917a[0x0],_0x4d5081='.';}}const _0x4c78d0=_0x499c3d[_0x171b1d(0x176)],_0x24f8ca=_0x499c3d[_0x171b1d(0x165)];_0x499c3d[_0x171b1d(0x199)]&&(console[_0x171b1d(0x196)]('Project\x20directory:\x20'+_0x4d5081),_0x2f406a&&console[_0x171b1d(0x196)](_0x171b1d(0x167)+_0x2f406a),_0x4c78d0&&console[_0x171b1d(0x196)]('Revision:\x20'+_0x4c78d0),_0x24f8ca&&console[_0x171b1d(0x196)](_0x171b1d(0x195)));const _0x386cde=await withSpinner(_0x171b1d(0x15d),()=>_0x5dd7e1[_0x171b1d(0x141)]['push'](_0x4d5081,{'projectName':_0x2f406a,'revision':_0x4c78d0,'skipValidation':_0x24f8ca}),{'verbose':_0x499c3d['verbose']}),_0x60b838=_0x386cde[_0x171b1d(0x15e)];return console['error'](_0x171b1d(0x12d)+_0x60b838[_0x171b1d(0x162)]),console[_0x171b1d(0x196)](_0x171b1d(0x14c)+_0x60b838[_0x171b1d(0x18f)]),console[_0x171b1d(0x196)](_0x171b1d(0x188)+_0x60b838[_0x171b1d(0x176)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a24_0x24a0f9(0x17f)]=a24_0x24a0f9(0x161);[a24_0x24a0f9(0x180)]=a24_0x24a0f9(0x130);async[a24_0x24a0f9(0x163)](_0x170509){const _0x5b5d48=a24_0x24a0f9,{options:_0x3f6fde,args:_0x172ab1,tdx:_0x1c5514}=_0x170509,_0x229b05=_0x172ab1[0x0];if(!_0x229b05)return console[_0x5b5d48(0x196)](_0x5b5d48(0x142)),console['error'](_0x5b5d48(0x127)),0x1;_0x3f6fde[_0x5b5d48(0x199)]&&console['error'](_0x5b5d48(0x186)+_0x229b05);if(!_0x3f6fde[_0x5b5d48(0x144)]){const _0x12f7a0=await confirm(_0x5b5d48(0x18d)+_0x229b05+_0x5b5d48(0x123));if(!_0x12f7a0)return console['error']('Cancelled'),0x0;}const _0x58f217=await withSpinner('Deleting\x20project\x20'+_0x229b05+_0x5b5d48(0x11e),()=>_0x1c5514['workflow']['delete'](_0x229b05),{'verbose':_0x3f6fde[_0x5b5d48(0x199)]}),_0x352d14=_0x58f217[_0x5b5d48(0x15e)];return console[_0x5b5d48(0x196)](_0x5b5d48(0x13a)+_0x352d14[_0x5b5d48(0x162)]),console['error'](_0x5b5d48(0x14c)+_0x352d14[_0x5b5d48(0x18f)]),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(_0x3bf54d,_0xa0cba4){const _0x588c9f=a25_0x8406,_0x2e5a6d=_0x3bf54d();while(!![]){try{const _0x35747e=parseInt(_0x588c9f(0x18c))/0x1+-parseInt(_0x588c9f(0x183))/0x2+-parseInt(_0x588c9f(0x173))/0x3*(-parseInt(_0x588c9f(0x17e))/0x4)+parseInt(_0x588c9f(0x17a))/0x5*(-parseInt(_0x588c9f(0x17d))/0x6)+-parseInt(_0x588c9f(0x188))/0x7*(-parseInt(_0x588c9f(0x178))/0x8)+parseInt(_0x588c9f(0x17f))/0x9+parseInt(_0x588c9f(0x185))/0xa*(-parseInt(_0x588c9f(0x18a))/0xb);if(_0x35747e===_0xa0cba4)break;else _0x2e5a6d['push'](_0x2e5a6d['shift']());}catch(_0x26929f){_0x2e5a6d['push'](_0x2e5a6d['shift']());}}}(a25_0x6de5,0x3042b));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';function a25_0x8406(_0x34552c,_0x244c39){const _0x6de589=a25_0x6de5();return a25_0x8406=function(_0x8406ea,_0x436036){_0x8406ea=_0x8406ea-0x173;let _0x59e9df=_0x6de589[_0x8406ea];return _0x59e9df;},a25_0x8406(_0x34552c,_0x244c39);}import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x3aedeb=a25_0x8406;try{const _0x1ee9eb=fileURLToPath(import.meta[_0x3aedeb(0x18b)]),_0x3904c3=dirname(_0x1ee9eb),_0x1c05dd=join(_0x3904c3,_0x3aedeb(0x175)),_0x2d2587=JSON[_0x3aedeb(0x186)](readFileSync(_0x1c05dd,_0x3aedeb(0x184)));return _0x2d2587[_0x3aedeb(0x176)];}catch{return _0x3aedeb(0x177);}}export function getUserAgent(){const _0x5532a=a25_0x8406,_0x254ac2=getVersion(),_0x3953f9=platform(),_0x37299f=process[_0x5532a(0x176)][_0x5532a(0x174)]('v','');return _0x5532a(0x181)+_0x254ac2+'\x20('+_0x3953f9+_0x5532a(0x17c)+_0x37299f+')';}export function getAuthHeaders(_0x23c9c6,_0x5d1b7b){const _0x230960=a25_0x8406,_0x52af05=getVersion(),_0x5dbba0={'User-Agent':getUserAgent(),'X-TD-Client':'tdx','X-TD-Client-Version':_0x52af05};return _0x5d1b7b&&(_0x5dbba0['Authorization']=_0x230960(0x17b)+_0x5d1b7b),_0x5dbba0;}export function toHeaderRecord(_0x55609b){const _0x359805=a25_0x8406,_0x31d1aa={};for(const [_0x473006,_0x2640e1]of Object[_0x359805(0x179)](_0x55609b)){_0x2640e1!==undefined&&(_0x31d1aa[_0x473006]=_0x2640e1);}return _0x31d1aa;}function a25_0x6de5(){const _0x5b05a3=['parse','X-Trino-User','21mjoBBX','includes','253BEzANN','url','96175jMWRxT','6186btewXm','replace','../../package.json','version','0.0.0','705056YCuTfr','entries','20kTyFXl','TD1\x20',';\x20node/','268206caWiMK','20pffRPt','3058722ljIAvR','split','tdx/','Authorization','445098DrFylK','utf-8','48570kwXLET'];a25_0x6de5=function(){return _0x5b05a3;};return a25_0x6de5();}export function getTrinoHeaders(_0x1b6a50,_0x3deeb7){const _0xae2495=a25_0x8406,_0x74140a=getAuthHeaders(_0x1b6a50,_0x3deeb7),_0x5b36dc=toHeaderRecord(_0x74140a);return delete _0x5b36dc[_0xae2495(0x182)],_0x3deeb7&&(_0x5b36dc[_0xae2495(0x187)]=_0x3deeb7),_0x5b36dc;}export function validateAPIKey(_0x4e10ef){const _0x993d12=a25_0x8406;return _0x4e10ef[_0x993d12(0x189)]('/')&&_0x4e10ef[_0x993d12(0x180)]('/')['length']===0x2;}export function hasAPIKey(_0x912abe){const _0x3478f2=getAPIKey(_0x912abe);return _0x3478f2!==undefined&&validateAPIKey(_0x3478f2);}
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 a26_0x2f4c(){const _0x123a5f=['entries','1172798oXazBm','endsWith','startsWith','us01','136542ZUCjXp','TD_API_KEY_','jp01','env:\x20TD_API_KEY','.env','stg-jp01','TD_API_KEY','8pzwgQb','existsSync','9135792mmsheF','40RCEvNx','50bmSbWn','toUpperCase','utf-8','warn','.config','replace','245CxYfMy','.env.','61293NFJLtX','TDX_CACHE_DIR','dev-us01','47207CAeNaz','profile:\x20','map','env','trim','Warning:\x20Unknown\x20site\x20\x27','profile','tdx','216ubIOng','parse','split','29175036RJmpbV','includes','ap02','dev-eu01','\x20(TD_API_KEY)','eu01','stg-ap03','\x27,\x20defaulting\x20to\x20us01','ap03','llm_default_project','readFileSync','join','.cache','8542821FDdZll','TDX_CONFIG_DIR','Warning:\x20Failed\x20to\x20load\x20','stg-us01'];a26_0x2f4c=function(){return _0x123a5f;};return a26_0x2f4c();}(function(_0x2d4307,_0x4d30b0){const _0x527758=a26_0x2346,_0x1401f5=_0x2d4307();while(!![]){try{const _0x14558b=-parseInt(_0x527758(0x1bc))/0x1*(parseInt(_0x527758(0x1b1))/0x2)+parseInt(_0x527758(0x1b9))/0x3*(-parseInt(_0x527758(0x1c4))/0x4)+-parseInt(_0x527758(0x1b7))/0x5*(-parseInt(_0x527758(0x1dd))/0x6)+-parseInt(_0x527758(0x1d4))/0x7+-parseInt(_0x527758(0x1ad))/0x8*(-parseInt(_0x527758(0x1af))/0x9)+parseInt(_0x527758(0x1b0))/0xa*(-parseInt(_0x527758(0x1d9))/0xb)+parseInt(_0x527758(0x1c7))/0xc;if(_0x14558b===_0x4d30b0)break;else _0x1401f5['push'](_0x1401f5['shift']());}catch(_0x26c28c){_0x1401f5['push'](_0x1401f5['shift']());}}}(a26_0x2f4c,0x9a146));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync}from'fs';import*as a26_0x423809 from'node:fs';import*as a26_0x217cec from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';export function getConfigDir(){const _0x52b3af=a26_0x2346;return process[_0x52b3af(0x1bf)][_0x52b3af(0x1d5)]||join(homedir(),_0x52b3af(0x1b5),_0x52b3af(0x1c3));}export function getConfigFile(){const _0x44978a=a26_0x2346;return join(getConfigDir(),_0x44978a(0x1e1));}export function getCacheDir(){const _0xeafa6d=a26_0x2346;return process[_0xeafa6d(0x1bf)][_0xeafa6d(0x1ba)]||join(homedir(),_0xeafa6d(0x1d3),_0xeafa6d(0x1c3));}export function getLLMProjectCacheFile(){const _0x4f34bb=a26_0x2346;return join(getCacheDir(),_0x4f34bb(0x1d0));}export function readCachedLLMProject(){const _0xaf229=a26_0x2346;try{const _0x5ecc64=getLLMProjectCacheFile();if(!existsSync(_0x5ecc64))return null;return readFileSync(_0x5ecc64,_0xaf229(0x1b3))[_0xaf229(0x1c0)]();}catch{return null;}}export function writeCachedLLMProject(_0x34c478){const _0x22167a=a26_0x2346;try{const _0x2252cd=getCacheDir(),_0x482c52=getLLMProjectCacheFile();!existsSync(_0x2252cd)&&mkdirSync(_0x2252cd,{'recursive':!![]}),writeFileSync(_0x482c52,_0x34c478,_0x22167a(0x1b3));}catch(_0x23a4cc){console['error']('Warning:\x20Failed\x20to\x20cache\x20LLM\x20project\x20name:',_0x23a4cc);}}export function parseEnvFile(_0x537fe0){const _0x19d684=a26_0x2346,_0x21961c={};for(const _0x149fb9 of _0x537fe0[_0x19d684(0x1c6)]('\x0a')){const _0x3697a0=_0x149fb9[_0x19d684(0x1c0)]();if(!_0x3697a0||_0x3697a0[_0x19d684(0x1db)]('#'))continue;const _0x18b3f7=_0x3697a0['match'](/^([^=]+)=(.*)$/);if(_0x18b3f7){const _0x349f23=_0x18b3f7[0x1]['trim']();let _0x3f0d70=_0x18b3f7[0x2][_0x19d684(0x1c0)]();(_0x3f0d70[_0x19d684(0x1db)]('\x22')&&_0x3f0d70[_0x19d684(0x1da)]('\x22')||_0x3f0d70['startsWith']('\x27')&&_0x3f0d70[_0x19d684(0x1da)]('\x27'))&&(_0x3f0d70=_0x3f0d70['slice'](0x1,-0x1)),_0x21961c[_0x349f23]=_0x3f0d70;}}return _0x21961c;}export function readUserConfig(){const _0x3cfc34=a26_0x2346,_0x38ee6b=getConfigFile();if(!existsSync(_0x38ee6b))return{};try{const _0x29e6a8=readFileSync(_0x38ee6b,_0x3cfc34(0x1b3));return parseEnvFile(_0x29e6a8);}catch(_0x53005a){return console[_0x3cfc34(0x1b4)]('Warning:\x20Failed\x20to\x20read\x20config\x20file\x20'+_0x38ee6b+':',_0x53005a),{};}}export function resolveSite(_0x1a800c){const _0x3386eb=a26_0x2346,_0x395397=[_0x3386eb(0x1dc),'jp01','eu01',_0x3386eb(0x1c9),_0x3386eb(0x1cf),_0x3386eb(0x1bb),_0x3386eb(0x1ca),_0x3386eb(0x1d7),_0x3386eb(0x1e2),_0x3386eb(0x1cd)];if(_0x395397[_0x3386eb(0x1c8)](_0x1a800c))return _0x1a800c;if(_0x1a800c in SITE_ALIASES)return SITE_ALIASES[_0x1a800c];return console[_0x3386eb(0x1b4)](_0x3386eb(0x1c1)+_0x1a800c+_0x3386eb(0x1ce)),_0x3386eb(0x1dc);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x4f93b6,_0x5bb7b3){const _0x21d34e=a26_0x2346,_0x4c107e=_0x4f93b6[_0x21d34e(0x1b2)]()[_0x21d34e(0x1b6)](/-/g,'_'),_0x3ca974=_0x21d34e(0x1de)+_0x4c107e;if(process[_0x21d34e(0x1bf)][_0x3ca974])return process[_0x21d34e(0x1bf)][_0x3ca974];if(process['env']['TD_API_KEY'])return process[_0x21d34e(0x1bf)][_0x21d34e(0x1ac)];const _0x20b0a1=_0x5bb7b3||getActiveProfileName();if(_0x20b0a1){const _0x2d812d=loadProfileEnv(_0x20b0a1);if(_0x2d812d){if(_0x2d812d[_0x3ca974])return _0x2d812d[_0x3ca974];if(_0x2d812d[_0x21d34e(0x1ac)])return _0x2d812d[_0x21d34e(0x1ac)];}}const _0x47c3da=loadUserConfigOnce();if(_0x47c3da[_0x3ca974])return _0x47c3da[_0x3ca974];if(_0x47c3da[_0x21d34e(0x1ac)])return _0x47c3da[_0x21d34e(0x1ac)];return undefined;}export function getAPIKeySource(_0x3558c3,_0x22d199){const _0x4a34a0=a26_0x2346,_0x10f97f='TD_API_KEY_'+_0x3558c3['toUpperCase']()[_0x4a34a0(0x1b6)](/-/g,'_');if(process['env'][_0x10f97f])return'env:\x20'+_0x10f97f;if(process[_0x4a34a0(0x1bf)]['TD_API_KEY'])return _0x4a34a0(0x1e0);const _0x7ee734=_0x22d199||getActiveProfileName();if(_0x7ee734){const _0x2ab6ac=loadProfileEnv(_0x7ee734);if(_0x2ab6ac){if(_0x2ab6ac[_0x10f97f])return _0x4a34a0(0x1bd)+_0x7ee734+'\x20('+_0x10f97f+')';if(_0x2ab6ac['TD_API_KEY'])return _0x4a34a0(0x1bd)+_0x7ee734+'\x20(TD_API_KEY)';}}const _0xc7760c=loadUserConfigOnce(),_0x29e11b=getConfigFile();if(_0xc7760c[_0x10f97f])return'global:\x20'+_0x29e11b+'\x20('+_0x10f97f+')';if(_0xc7760c[_0x4a34a0(0x1ac)])return'global:\x20'+_0x29e11b+_0x4a34a0(0x1cb);return null;}function a26_0x2346(_0x45de1e,_0x35e911){const _0x2f4cda=a26_0x2f4c();return a26_0x2346=function(_0x234689,_0x5e882f){_0x234689=_0x234689-0x1ac;let _0x231c94=_0x2f4cda[_0x234689];return _0x231c94;},a26_0x2346(_0x45de1e,_0x35e911);}function loadProfileEnv(_0x5e5e02){const _0x31f094=a26_0x2346,_0xd0a2c0=a26_0x217cec[_0x31f094(0x1d2)](getConfigDir(),_0x31f094(0x1b8)+_0x5e5e02);if(a26_0x423809[_0x31f094(0x1ae)](_0xd0a2c0)){validateSecureFilePermissions(_0xd0a2c0);try{const _0x2ba1c0=a26_0x423809[_0x31f094(0x1d1)](_0xd0a2c0,'utf-8');return parseEnvFile(_0x2ba1c0);}catch(_0xb13a22){console[_0x31f094(0x1b4)](_0x31f094(0x1d6)+_0xd0a2c0+':\x20'+_0xb13a22);}}const _0x587166=a26_0x217cec['join'](getConfigDir(),'profiles',_0x5e5e02,_0x31f094(0x1e1));if(a26_0x423809[_0x31f094(0x1ae)](_0x587166)){validateSecureFilePermissions(_0x587166);try{const _0x186a4e=a26_0x423809[_0x31f094(0x1d1)](_0x587166,_0x31f094(0x1b3));return parseEnvFile(_0x186a4e);}catch(_0x15f367){return console[_0x31f094(0x1b4)]('Warning:\x20Failed\x20to\x20load\x20'+_0x587166+':\x20'+_0x15f367),null;}}return null;}function getActiveProfileName(){const _0x3b789d=a26_0x2346,_0x8af6b2=a26_0x217cec[_0x3b789d(0x1d2)](getConfigDir(),'tdx.json');if(!a26_0x423809[_0x3b789d(0x1ae)](_0x8af6b2))return null;try{const _0xdf47ce=a26_0x423809[_0x3b789d(0x1d1)](_0x8af6b2,_0x3b789d(0x1b3)),_0x37c057=JSON[_0x3b789d(0x1c5)](_0xdf47ce);return _0x37c057[_0x3b789d(0x1c2)]||null;}catch{return null;}}export function saveAPIKey(_0x564937,_0x10fc93){const _0x47007e=a26_0x2346,_0x3eb7c6=getConfigDir(),_0x2aaf20=getConfigFile();!existsSync(_0x3eb7c6)&&mkdirSync(_0x3eb7c6,{'recursive':!![],'mode':0x1c0});const _0x4dd37e=readUserConfig(),_0x4d3e96=_0x564937[_0x47007e(0x1b2)]()[_0x47007e(0x1b6)](/-/g,'_');_0x4dd37e[_0x47007e(0x1de)+_0x4d3e96]=_0x10fc93;const _0x56b3a9=Object[_0x47007e(0x1d8)](_0x4dd37e)[_0x47007e(0x1be)](([_0x3ddff3,_0xef81bb])=>_0x3ddff3+'='+_0xef81bb);writeFileSync(_0x2aaf20,_0x56b3a9[_0x47007e(0x1d2)]('\x0a')+'\x0a',{'mode':0x180});}export function loadConfig(){const _0x1685f6=a26_0x2346,_0x1269e8={'apiKeys':{},'defaultSite':_0x1685f6(0x1dc)},_0x1119a4=['us01',_0x1685f6(0x1df),_0x1685f6(0x1cc),'ap02','ap03',_0x1685f6(0x1bb),_0x1685f6(0x1ca),_0x1685f6(0x1d7),_0x1685f6(0x1e2),_0x1685f6(0x1cd)];for(const _0x5010f2 of _0x1119a4){const _0x2311d6=getAPIKey(_0x5010f2);_0x2311d6&&(_0x1269e8['apiKeys'][_0x5010f2]=_0x2311d6);}return _0x1269e8;}
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_0x1cb474=a27_0x2a8e;function a27_0x2a8e(_0x3f706b,_0xed8ffb){const _0x46a216=a27_0x46a2();return a27_0x2a8e=function(_0x2a8e3e,_0x24f794){_0x2a8e3e=_0x2a8e3e-0x119;let _0x1838c0=_0x46a216[_0x2a8e3e];return _0x1838c0;},a27_0x2a8e(_0x3f706b,_0xed8ffb);}(function(_0x3c6f9e,_0x2f4c8d){const _0x258216=a27_0x2a8e,_0x367d81=_0x3c6f9e();while(!![]){try{const _0x52476a=parseInt(_0x258216(0x14d))/0x1+-parseInt(_0x258216(0x13d))/0x2*(-parseInt(_0x258216(0x138))/0x3)+-parseInt(_0x258216(0x14e))/0x4*(parseInt(_0x258216(0x11b))/0x5)+parseInt(_0x258216(0x12c))/0x6*(parseInt(_0x258216(0x14c))/0x7)+parseInt(_0x258216(0x140))/0x8*(-parseInt(_0x258216(0x11a))/0x9)+-parseInt(_0x258216(0x141))/0xa*(parseInt(_0x258216(0x133))/0xb)+parseInt(_0x258216(0x159))/0xc;if(_0x52476a===_0x2f4c8d)break;else _0x367d81['push'](_0x367d81['shift']());}catch(_0x2d4d7b){_0x367d81['push'](_0x367d81['shift']());}}}(a27_0x46a2,0x87d08));function a27_0x46a2(){const _0x4b44bc=['.json','llmProject','Profile\x20Credentials','72453RyTTfz','toString','Session','llm_project','cliFlags','90TItYcP','not\x20set','us01','552sJHYkd','30eCGWLb','[context]','readFileSync','getSource',':\x20none','activeProfile','config','parse','sessionId','layers','Global\x20Credentials','2829785DeDGPt','612028AZYMIL','2055260sbGtnt','globalCredentials','tdx.json','getParameters','Global','Project','default','injectIntoOptions','site','CLI\x20flag:\x20--','existsSync','5419896jKFIef','profiles','profile','loadGlobalConfig','85572wSSiyO','5TlnFHE','(session:\x20','database','global','profileCredentials','apiKey','utf-8','.env','displayWithSources',':\x20none\x20(using\x20session:\x20','\x0a[configuration\x20files]','string','parentSegment','(active)','session','configFiles','join','6CQfgLR','Profile','log','ppid','profile:\x20','parent_segment','project','3038101FVQcoV','verbose'];a27_0x46a2=function(){return _0x4b44bc;};return a27_0x46a2();}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';import*as a27_0xcebb68 from'node:fs';import*as a27_0x3e5d5a from'node:path';export class GlobalContext{[a27_0x1cb474(0x156)];[a27_0x1cb474(0x11d)];[a27_0x1cb474(0x131)];[a27_0x1cb474(0x13b)];[a27_0x1cb474(0x120)];[a27_0x1cb474(0x134)];[a27_0x1cb474(0x14a)];[a27_0x1cb474(0x146)];[a27_0x1cb474(0x149)];['configFiles'];constructor(_0x8f64d1){const _0x181cc5=a27_0x1cb474;this['sessionId']=_0x8f64d1['session']||process[_0x181cc5(0x12f)][_0x181cc5(0x139)]();const _0x4301eb=loadSessionContext(_0x8f64d1[_0x181cc5(0x129)]),_0x1d9051=loadProjectConfig(),_0x2fca77=this[_0x181cc5(0x119)]();this[_0x181cc5(0x146)]=_0x8f64d1['profile']||_0x4301eb?.[_0x181cc5(0x15b)]||_0x2fca77[_0x181cc5(0x15b)]||getActiveProfile();const _0x27eeba=this['activeProfile']?loadProfile(this[_0x181cc5(0x146)]):null,_0x2ff81d=_0x126d1d=>{const _0x255566=_0x181cc5;if(!_0x126d1d)return{};const _0x41c6e9=_0x126d1d,_0xd50bc8={};for(const [_0x3cee11,_0x2dc2cc]of Object['entries'](_0x41c6e9)){typeof _0x2dc2cc===_0x255566(0x126)&&(_0xd50bc8[_0x3cee11]=_0x2dc2cc);}return _0xd50bc8;},_0x1fae4c={};if(_0x8f64d1[_0x181cc5(0x156)]&&_0x8f64d1[_0x181cc5(0x156)]!==_0x181cc5(0x13f))_0x1fae4c['site']=_0x8f64d1[_0x181cc5(0x156)];const _0x101a14=_0x4301eb?.[_0x181cc5(0x11d)],_0x3438d3=_0x1d9051?.[_0x181cc5(0x11d)],_0x28ba6b=_0x27eeba?.[_0x181cc5(0x147)]?.[_0x181cc5(0x11d)],_0x365d27=_0x2fca77['database'];_0x8f64d1['database']&&(_0x8f64d1['database']!==_0x101a14&&_0x8f64d1['database']!==_0x3438d3&&_0x8f64d1['database']!==_0x28ba6b&&_0x8f64d1['database']!==_0x365d27)&&(_0x1fae4c[_0x181cc5(0x11d)]=_0x8f64d1[_0x181cc5(0x11d)]);if(_0x8f64d1['parentSegment'])_0x1fae4c['parent_segment']=_0x8f64d1[_0x181cc5(0x127)];if(_0x8f64d1['llmProject'])_0x1fae4c[_0x181cc5(0x13b)]=_0x8f64d1[_0x181cc5(0x136)];if(_0x8f64d1[_0x181cc5(0x15b)])_0x1fae4c[_0x181cc5(0x15b)]=_0x8f64d1[_0x181cc5(0x15b)];this[_0x181cc5(0x14a)]={'cliFlags':_0x1fae4c,'session':_0x2ff81d(_0x4301eb),'project':_0x2ff81d(_0x1d9051),'profile':_0x2ff81d(_0x27eeba?.['config']),'global':_0x2ff81d(_0x2fca77)};const _0xcd55ab={...this[_0x181cc5(0x14a)]['global'],...this[_0x181cc5(0x14a)][_0x181cc5(0x15b)],...this[_0x181cc5(0x14a)][_0x181cc5(0x132)],...this[_0x181cc5(0x14a)][_0x181cc5(0x129)],...this['layers']['cliFlags']},_0x59c435=_0xcd55ab[_0x181cc5(0x156)]||_0x181cc5(0x13f);this[_0x181cc5(0x156)]=resolveSite(_0x59c435),this[_0x181cc5(0x11d)]=_0xcd55ab[_0x181cc5(0x11d)],this[_0x181cc5(0x131)]=_0xcd55ab[_0x181cc5(0x131)],this[_0x181cc5(0x13b)]=_0xcd55ab['llm_project'],this[_0x181cc5(0x134)]=_0x8f64d1[_0x181cc5(0x134)]||![],this['apiKey']=getAPIKey(this['site'],this[_0x181cc5(0x146)]||undefined);const _0x4109a2=getConfigDir(),_0x4b8c0c=a27_0x3e5d5a[_0x181cc5(0x12b)](_0x4109a2,'sessions',this[_0x181cc5(0x149)]+_0x181cc5(0x135)),_0x1375a2=findProjectConfigPath(),_0x38bf7f=a27_0x3e5d5a[_0x181cc5(0x12b)](_0x4109a2,'tdx.json'),_0x16b7a2=a27_0x3e5d5a[_0x181cc5(0x12b)](_0x4109a2,'.env');let _0x4213ea=null,_0x2a4441=null;this[_0x181cc5(0x146)]&&(_0x4213ea=a27_0x3e5d5a[_0x181cc5(0x12b)](_0x4109a2,_0x181cc5(0x15a),this[_0x181cc5(0x146)],'tdx.json'),_0x2a4441=a27_0x3e5d5a[_0x181cc5(0x12b)](_0x4109a2,_0x181cc5(0x15a),this[_0x181cc5(0x146)],_0x181cc5(0x122))),this[_0x181cc5(0x12a)]={'session':a27_0xcebb68[_0x181cc5(0x158)](_0x4b8c0c)?_0x4b8c0c:null,'project':_0x1375a2,'profile':_0x4213ea&&a27_0xcebb68[_0x181cc5(0x158)](_0x4213ea)?_0x4213ea:null,'profileCredentials':_0x2a4441&&a27_0xcebb68[_0x181cc5(0x158)](_0x2a4441)?_0x2a4441:null,'global':a27_0xcebb68[_0x181cc5(0x158)](_0x38bf7f)?_0x38bf7f:null,'globalCredentials':a27_0xcebb68['existsSync'](_0x16b7a2)?_0x16b7a2:null};}['getSource'](_0x5cc739,_0x405655){const _0x368594=a27_0x1cb474;if(!_0x405655)return _0x368594(0x13e);const _0x40f828=_0x405655;if(this['layers'][_0x368594(0x13c)][_0x5cc739]===_0x40f828){if(_0x5cc739===_0x368594(0x156)&&_0x40f828===_0x368594(0x13f)&&!this[_0x368594(0x14a)]['session']['site']&&!this[_0x368594(0x14a)][_0x368594(0x132)]['site']&&!this[_0x368594(0x14a)][_0x368594(0x15b)][_0x368594(0x156)]&&!this[_0x368594(0x14a)][_0x368594(0x11e)][_0x368594(0x156)])return _0x368594(0x154);return _0x368594(0x157)+_0x5cc739['replace'](/_/g,'-');}if(this[_0x368594(0x14a)][_0x368594(0x129)][_0x5cc739]===_0x40f828)return'session';if(this[_0x368594(0x14a)]['project'][_0x5cc739]===_0x40f828)return _0x368594(0x132);if(this[_0x368594(0x14a)][_0x368594(0x15b)][_0x5cc739]===_0x40f828)return _0x368594(0x130)+this[_0x368594(0x146)];if(this[_0x368594(0x14a)]['global'][_0x5cc739]===_0x40f828)return _0x368594(0x11e);return _0x368594(0x154);}['loadGlobalConfig'](){const _0xf1c417=a27_0x1cb474,_0x3f6aa2=a27_0x3e5d5a[_0xf1c417(0x12b)](getConfigDir(),_0xf1c417(0x150));if(!a27_0xcebb68[_0xf1c417(0x158)](_0x3f6aa2))return{};try{const _0x22d96c=a27_0xcebb68[_0xf1c417(0x143)](_0x3f6aa2,_0xf1c417(0x121));return JSON[_0xf1c417(0x148)](_0x22d96c);}catch{return{};}}[a27_0x1cb474(0x155)](_0x5adb76){const _0x4eb514=a27_0x1cb474;_0x5adb76[_0x4eb514(0x156)]=this['site'],!_0x5adb76[_0x4eb514(0x11d)]&&this['database']&&(_0x5adb76[_0x4eb514(0x11d)]=this[_0x4eb514(0x11d)]),!_0x5adb76['parentSegment']&&this[_0x4eb514(0x131)]&&(_0x5adb76[_0x4eb514(0x127)]=this[_0x4eb514(0x131)]),!_0x5adb76[_0x4eb514(0x136)]&&this[_0x4eb514(0x13b)]&&(_0x5adb76['llmProject']=this['llm_project']);}[a27_0x1cb474(0x151)](){const _0x486ace=a27_0x1cb474;return[{'key':_0x486ace(0x156),'value':this[_0x486ace(0x156)]},{'key':_0x486ace(0x11d),'value':this['database']},{'key':_0x486ace(0x131),'value':this[_0x486ace(0x131)]},{'key':_0x486ace(0x13b),'value':this[_0x486ace(0x13b)]},{'key':_0x486ace(0x15b),'value':this['activeProfile']||undefined}];}['display'](){const _0x41f445=a27_0x1cb474;console[_0x41f445(0x12e)]('[context]');for(const {key:_0x3a408e,value:_0x47b64f}of this[_0x41f445(0x151)]()){_0x47b64f&&console['log'](_0x3a408e+':\x20'+_0x47b64f);}}[a27_0x1cb474(0x123)](){const _0x39f5e0=a27_0x1cb474;console[_0x39f5e0(0x12e)](_0x39f5e0(0x142));for(const {key:_0x40492a,value:_0x16aaad}of this[_0x39f5e0(0x151)]()){if(_0x16aaad){const _0x404724=_0x40492a===_0x39f5e0(0x15b)?_0x39f5e0(0x128):'('+this[_0x39f5e0(0x144)](_0x40492a,_0x16aaad)+')';console['log'](_0x40492a+':\x20'+_0x16aaad+'\x20'+_0x404724);}}console[_0x39f5e0(0x12e)](_0x39f5e0(0x125));const _0x12f931=[{'label':_0x39f5e0(0x13a),'path':this[_0x39f5e0(0x12a)][_0x39f5e0(0x129)],'extra':_0x39f5e0(0x11c)+this[_0x39f5e0(0x149)]+')'},{'label':_0x39f5e0(0x153),'path':this['configFiles'][_0x39f5e0(0x132)]},{'label':_0x39f5e0(0x12d),'path':this[_0x39f5e0(0x12a)][_0x39f5e0(0x15b)]},{'label':_0x39f5e0(0x137),'path':this[_0x39f5e0(0x12a)][_0x39f5e0(0x11f)]},{'label':_0x39f5e0(0x152),'path':this['configFiles'][_0x39f5e0(0x11e)]},{'label':_0x39f5e0(0x14b),'path':this[_0x39f5e0(0x12a)][_0x39f5e0(0x14f)]}];for(const {label:_0x1816ae,path:_0x5c61f5,extra:_0x52dedf}of _0x12f931){if(_0x5c61f5)console[_0x39f5e0(0x12e)](_0x1816ae+':\x20'+_0x5c61f5+'\x20✓'+(_0x52dedf?'\x20'+_0x52dedf:''));else{if(_0x1816ae==='Session')console[_0x39f5e0(0x12e)](_0x1816ae+_0x39f5e0(0x124)+this[_0x39f5e0(0x149)]+')');else(_0x1816ae==='Project'||_0x1816ae===_0x39f5e0(0x152))&&console[_0x39f5e0(0x12e)](_0x1816ae+_0x39f5e0(0x145));}}}}
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_0x3dea(_0x3c04c0,_0xaf6fcb){const _0x4baf86=a28_0x4baf();return a28_0x3dea=function(_0x3deac4,_0x50a602){_0x3deac4=_0x3deac4-0xde;let _0x3fb5c0=_0x4baf86[_0x3deac4];return _0x3fb5c0;},a28_0x3dea(_0x3c04c0,_0xaf6fcb);}(function(_0x3356b1,_0x171c3c){const _0x2597d9=a28_0x3dea,_0x2fb39c=_0x3356b1();while(!![]){try{const _0x678f39=-parseInt(_0x2597d9(0x126))/0x1+parseInt(_0x2597d9(0x102))/0x2*(-parseInt(_0x2597d9(0xe5))/0x3)+parseInt(_0x2597d9(0x119))/0x4*(-parseInt(_0x2597d9(0xec))/0x5)+-parseInt(_0x2597d9(0x11b))/0x6+parseInt(_0x2597d9(0xe2))/0x7*(-parseInt(_0x2597d9(0xe0))/0x8)+parseInt(_0x2597d9(0xe7))/0x9+parseInt(_0x2597d9(0xf5))/0xa;if(_0x678f39===_0x171c3c)break;else _0x2fb39c['push'](_0x2fb39c['shift']());}catch(_0x971c0f){_0x2fb39c['push'](_0x2fb39c['shift']());}}}(a28_0x4baf,0xcdb5c));import*as a28_0x312f39 from'node:fs';function a28_0x4baf(){const _0x31800b=['apiKey','5947872ZownqV','To\x20migrate:','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','name','push','utf-8','Warning:\x20Profile\x20\x27','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','\x20does\x20not\x20exist','has','values','840638yFxtQG','profile','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','isDirectory','llm_agent','directory','sort','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','entries','join','2168JYjyaj','\x22\x20\x22','41216aVSXsK','writeFileSync',':\x20Invalid\x20JSON\x20syntax','3amfQLF','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','7479450fcECQv','local','parse','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20profile\x20configuration.\x20Use\x20.env\x20file\x20instead.','30vlPCov','\x27:\x20unknown\x20config\x20key\x20\x27','profiles','set','filter','length','\x20\x201.\x20Edit:\x20','keys','.env','49104310bGDafS','toISOString','llm_project','.env.','map','some','user','site','description','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','TD_API_KEY','tdx.json','warn','289258MCqfoR','message','api_key','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','\x20\x20mv\x20\x22','rmSync','from','includes','readdirSync','parent_segment','existsSync','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','string','readFileSync','\x27:\x20config\x20must\x20be\x20an\x20object','find','Profile\x20','stringify','\x20already\x20exists','database','Invalid\x20profile\x20name:\x20','Profile\x20\x27','object','884444SqTHeU'];a28_0x4baf=function(){return _0x31800b;};return a28_0x4baf();}import*as a28_0x425696 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(_0x1ffbea){const _0x1e7819=a28_0x3dea,_0xcc58c8={};if(!_0x1ffbea)return _0xcc58c8;for(const [_0x47de9e,_0x2364b6]of Object['entries'](_0x1ffbea)){_0x47de9e!==_0x1e7819(0xfd)&&_0x2364b6!==undefined&&(_0xcc58c8[_0x47de9e]=_0x2364b6);}return _0xcc58c8;}export function getProfilesDir(){const _0x35b8f2=a28_0x3dea;return a28_0x425696[_0x35b8f2(0xdf)](getConfigDir(),_0x35b8f2(0xee));}function getProfileDir(_0x1e8299){const _0xe0eace=a28_0x3dea;return a28_0x425696[_0xe0eace(0xdf)](getProfilesDir(),_0x1e8299);}function getProfileConfigPath(_0xd4da16){const _0x1b86dd=a28_0x3dea;return a28_0x425696[_0x1b86dd(0xdf)](getProfileDir(_0xd4da16),_0x1b86dd(0x100));}function getProfileEnvPath(_0x2e6b3f){const _0x34550a=a28_0x3dea;return a28_0x425696['join'](getProfileDir(_0x2e6b3f),_0x34550a(0xf4));}function getGlobalConfigPath(){const _0x4b2724=a28_0x3dea;return a28_0x425696[_0x4b2724(0xdf)](getConfigDir(),'tdx.json');}function validateProfileName(_0x4ce8ad){const _0x1041a5=a28_0x3dea;if(!/^[a-zA-Z0-9_-]+$/['test'](_0x4ce8ad))throw new Error(_0x1041a5(0x116)+_0x4ce8ad+_0x1041a5(0x11d));}function validateProfileConfig(_0x12eb25,_0x2c7ab5){const _0xc480ec=a28_0x3dea;if(typeof _0x12eb25!==_0xc480ec(0x118)||_0x12eb25===null)throw new Error(_0xc480ec(0x117)+_0x2c7ab5+_0xc480ec(0x110));const _0x163942=[_0xc480ec(0xfd),'site',_0xc480ec(0x115),_0xc480ec(0x10b),_0xc480ec(0xf7),_0xc480ec(0x12a)],_0x49eb64=_0x12eb25;for(const _0x168989 of Object[_0xc480ec(0xf3)](_0x49eb64)){!_0x163942[_0xc480ec(0x109)](_0x168989)&&console[_0xc480ec(0x101)](_0xc480ec(0x121)+_0x2c7ab5+_0xc480ec(0xed)+_0x168989+'\x27\x20will\x20be\x20ignored');}if(_0x49eb64[_0xc480ec(0xfd)]!==undefined&&typeof _0x49eb64[_0xc480ec(0xfd)]!==_0xc480ec(0x10e))throw new Error('Profile\x20\x27'+_0x2c7ab5+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x49eb64[_0xc480ec(0xfc)]!==undefined&&typeof _0x49eb64[_0xc480ec(0xfc)]!==_0xc480ec(0x10e))throw new Error(_0xc480ec(0x117)+_0x2c7ab5+_0xc480ec(0x122));if(_0x49eb64[_0xc480ec(0x115)]!==undefined&&typeof _0x49eb64[_0xc480ec(0x115)]!==_0xc480ec(0x10e))throw new Error(_0xc480ec(0x117)+_0x2c7ab5+_0xc480ec(0x105));if(_0x49eb64[_0xc480ec(0x10b)]!==undefined&&typeof _0x49eb64[_0xc480ec(0x10b)]!==_0xc480ec(0x10e))throw new Error(_0xc480ec(0x117)+_0x2c7ab5+_0xc480ec(0x128));if(_0x49eb64['llm_project']!==undefined&&typeof _0x49eb64['llm_project']!==_0xc480ec(0x10e))throw new Error(_0xc480ec(0x117)+_0x2c7ab5+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x49eb64[_0xc480ec(0x12a)]!==undefined&&typeof _0x49eb64[_0xc480ec(0x12a)]!==_0xc480ec(0x10e))throw new Error('Profile\x20\x27'+_0x2c7ab5+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x8b0293,_0x489869){const _0x5c208d=a28_0x3dea;if(!a28_0x312f39[_0x5c208d(0x10c)](_0x8b0293))return[];try{const _0x19184b=a28_0x312f39[_0x5c208d(0x10f)](_0x8b0293,_0x5c208d(0x120)),_0xa30c77=JSON['parse'](_0x19184b);if(!_0xa30c77[_0x5c208d(0xee)]||typeof _0xa30c77[_0x5c208d(0xee)]!==_0x5c208d(0x118))return[];const _0x5eed6a=[];for(const [_0x5f00ba,_0x476b5b]of Object[_0x5c208d(0xde)](_0xa30c77[_0x5c208d(0xee)])){try{validateProfileConfig(_0x476b5b,_0x5f00ba);const _0x443d7c=getNewCredentialPath(_0x5f00ba),_0x17f5b1=getOldCredentialPath(_0x5f00ba),_0x5db585=a28_0x312f39['existsSync'](_0x443d7c)||a28_0x312f39[_0x5c208d(0x10c)](_0x17f5b1);_0x5eed6a[_0x5c208d(0x11f)]({'name':_0x5f00ba,'config':_0x476b5b,'metadata':{'name':_0x5f00ba,'createdAt':new Date()['toISOString']()},'hasCredentials':_0x5db585,'scope':_0x489869});}catch(_0x541c04){_0x541c04 instanceof Error&&(console[_0x5c208d(0x101)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x8b0293+':'),console[_0x5c208d(0x101)]('\x20\x20'+_0x541c04[_0x5c208d(0x103)]+'\x0a'));}}return _0x5eed6a;}catch(_0x419a10){return _0x419a10 instanceof SyntaxError?(console[_0x5c208d(0x101)]('\x0aWarning:\x20Failed\x20to\x20parse\x20'+_0x8b0293+_0x5c208d(0xe4)),console['warn']('Error:\x20'+_0x419a10[_0x5c208d(0x103)]+'\x0a')):console[_0x5c208d(0x101)](_0x5c208d(0xfe)+_0x8b0293+':\x20'+_0x419a10+'\x0a'),[];}}export function getNewCredentialPath(_0x557e57){const _0x78ef0b=a28_0x3dea;return a28_0x425696[_0x78ef0b(0xdf)](getConfigDir(),_0x78ef0b(0xf8)+_0x557e57);}function getOldCredentialPath(_0x287c83){const _0x4898a7=a28_0x3dea;return a28_0x425696['join'](getProfilesDir(),_0x287c83,_0x4898a7(0xf4));}function loadProfilesFromTdxJsonFiles(){const _0x280cad=a28_0x3dea,_0x570f70=[],_0x247ea4=findProjectConfigPath();_0x247ea4&&_0x570f70[_0x280cad(0x11f)](...loadProfilesFromTdxJson(_0x247ea4,_0x280cad(0xe8)));const _0x2cdb97=a28_0x425696['join'](getConfigDir(),_0x280cad(0x100));return _0x570f70[_0x280cad(0x11f)](...loadProfilesFromTdxJson(_0x2cdb97,_0x280cad(0xfb))),_0x570f70;}function loadProfilesFromDirectories(){const _0x110f9f=a28_0x3dea,_0x1d04be=getProfilesDir();if(!a28_0x312f39[_0x110f9f(0x10c)](_0x1d04be))return[];try{return a28_0x312f39[_0x110f9f(0x10a)](_0x1d04be,{'withFileTypes':!![]})['filter'](_0x3702bf=>_0x3702bf[_0x110f9f(0x129)]())['map'](_0x45c91f=>_0x45c91f['name'])[_0x110f9f(0xf0)](_0x3c24c8=>{const _0xc62b76=_0x110f9f,_0x367a21=getProfileConfigPath(_0x3c24c8),_0x4facc0=getProfileEnvPath(_0x3c24c8);return a28_0x312f39[_0xc62b76(0x10c)](_0x367a21)||a28_0x312f39[_0xc62b76(0x10c)](_0x4facc0);})['map'](_0x3d35e6=>{const _0x3e3e91=_0x110f9f,_0x43bd50=loadProfileFromDirectory(_0x3d35e6);if(_0x43bd50)return{..._0x43bd50,'scope':_0x3e3e91(0x12b)};return null;})[_0x110f9f(0xf0)](_0x531f40=>_0x531f40!==null);}catch{return[];}}function loadProfileFromDirectory(_0x5defe4){const _0x31b470=a28_0x3dea,_0x391b00=getProfileConfigPath(_0x5defe4),_0x29624a=getOldCredentialPath(_0x5defe4);if(!a28_0x312f39[_0x31b470(0x10c)](_0x391b00)&&!a28_0x312f39[_0x31b470(0x10c)](_0x29624a))return null;let _0x2200d4={},_0x42d307={'name':_0x5defe4,'createdAt':new Date()[_0x31b470(0xf6)]()};if(a28_0x312f39[_0x31b470(0x10c)](_0x391b00))try{const _0x39a5e4=a28_0x312f39[_0x31b470(0x10f)](_0x391b00,_0x31b470(0x120)),_0x5c98de=JSON[_0x31b470(0xe9)](_0x39a5e4),{metadata:_0x16871a,..._0x1329ea}=_0x5c98de;_0x2200d4=_0x1329ea,_0x16871a&&(_0x42d307=_0x16871a);}catch{}return{'name':_0x5defe4,'config':_0x2200d4,'metadata':_0x42d307,'hasCredentials':a28_0x312f39[_0x31b470(0x10c)](_0x29624a),'scope':'directory'};}export function listProfiles(){const _0x3cb34f=a28_0x3dea,_0x1ad189=loadProfilesFromTdxJsonFiles(),_0x4ab6a5=loadProfilesFromDirectories();if(_0x4ab6a5[_0x3cb34f(0xf1)]>0x0){const _0x592cbb=_0x4ab6a5[_0x3cb34f(0xf9)](_0x7ca788=>_0x7ca788[_0x3cb34f(0x11e)])['join'](',\x20'),_0x276c1b=getConfigDir();console[_0x3cb34f(0x101)](_0x3cb34f(0xe6)+_0x592cbb),console[_0x3cb34f(0x101)](_0x3cb34f(0x10d)),console[_0x3cb34f(0x101)](_0x3cb34f(0xf2)+a28_0x425696['join'](_0x276c1b,_0x3cb34f(0x100))),console[_0x3cb34f(0x101)](_0x3cb34f(0xea)),console[_0x3cb34f(0x101)]('\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a');}const _0x213533=[..._0x1ad189,..._0x4ab6a5],_0x54c970=new Map();for(const _0x31e440 of _0x213533){!_0x54c970[_0x3cb34f(0x124)](_0x31e440[_0x3cb34f(0x11e)])&&_0x54c970[_0x3cb34f(0xef)](_0x31e440[_0x3cb34f(0x11e)],_0x31e440);}return Array[_0x3cb34f(0x108)](_0x54c970[_0x3cb34f(0x125)]())[_0x3cb34f(0x12c)]((_0x23a78a,_0x924e0f)=>_0x23a78a[_0x3cb34f(0x11e)]['localeCompare'](_0x924e0f[_0x3cb34f(0x11e)]));}export function profileExists(_0xaa50f7){const _0x20d966=a28_0x3dea,_0x48c562=listProfiles();return _0x48c562[_0x20d966(0xfa)](_0x38f10d=>_0x38f10d[_0x20d966(0x11e)]===_0xaa50f7);}export function loadProfile(_0x577cf3){const _0x112015=a28_0x3dea;validateProfileName(_0x577cf3);const _0x154b0b=listProfiles(),_0x418805=_0x154b0b[_0x112015(0x111)](_0x1e366c=>_0x1e366c['name']===_0x577cf3);return _0x418805||null;}export function saveProfile(_0x10660c,_0x2f3876,_0x36ca16=![]){const _0x2e793f=a28_0x3dea;validateProfileName(_0x10660c);const _0x4b6b0a=getProfileDir(_0x10660c),_0x7875ff=getProfileConfigPath(_0x10660c);createSecureDirectory(_0x4b6b0a);let _0x3335bd;const _0x47a457=loadProfile(_0x10660c);_0x47a457?(_0x3335bd=_0x47a457['metadata'],_0x36ca16&&(_0x3335bd['lastUsed']=new Date()['toISOString']())):_0x3335bd={'name':_0x10660c,'createdAt':new Date()['toISOString']()};const _0x27ec97=JSON[_0x2e793f(0x113)](_0x2f3876);if(_0x27ec97['includes'](_0x2e793f(0xff))||_0x27ec97[_0x2e793f(0x109)](_0x2e793f(0x11a))||_0x27ec97[_0x2e793f(0x109)](_0x2e793f(0x104)))throw new Error(_0x2e793f(0xeb));const _0x3a128b={..._0x2f3876,'metadata':_0x3335bd};a28_0x312f39[_0x2e793f(0xe3)](_0x7875ff,JSON[_0x2e793f(0x113)](_0x3a128b,null,0x2));}export function deleteProfile(_0x4ff3f6){const _0x1bb800=a28_0x3dea;validateProfileName(_0x4ff3f6);const _0x2b395b=getProfileDir(_0x4ff3f6);if(!a28_0x312f39['existsSync'](_0x2b395b))throw new Error(_0x1bb800(0x112)+_0x4ff3f6+_0x1bb800(0x123));a28_0x312f39[_0x1bb800(0x107)](_0x2b395b,{'recursive':!![],'force':!![]});}export function getActiveProfile(){const _0x301c19=a28_0x3dea,_0x372041=getGlobalConfigPath();if(!a28_0x312f39[_0x301c19(0x10c)](_0x372041))return null;try{const _0xdf9b05=a28_0x312f39['readFileSync'](_0x372041,_0x301c19(0x120)),_0x45fff9=JSON['parse'](_0xdf9b05);return _0x45fff9[_0x301c19(0x127)]||null;}catch{return null;}}export function createProfile(_0x415621,_0x180731){const _0x4bf7e5=a28_0x3dea;validateProfileName(_0x415621);if(profileExists(_0x415621))throw new Error('Profile\x20'+_0x415621+_0x4bf7e5(0x114));saveProfile(_0x415621,_0x180731);}export function saveProfileCredentials(_0x323d6d,_0x161bd1){const _0x31f412=a28_0x3dea;validateProfileName(_0x323d6d);if(!profileExists(_0x323d6d))throw new Error(_0x31f412(0x112)+_0x323d6d+_0x31f412(0x123));const _0x4a52cb=getNewCredentialPath(_0x323d6d);writeSecureFile(_0x4a52cb,_0x161bd1);}export function loadProfileCredentials(_0xce4656){const _0x1afa43=a28_0x3dea;validateProfileName(_0xce4656);const _0x21fbd9=getNewCredentialPath(_0xce4656);if(a28_0x312f39[_0x1afa43(0x10c)](_0x21fbd9))try{return a28_0x312f39[_0x1afa43(0x10f)](_0x21fbd9,_0x1afa43(0x120));}catch{}const _0x233549=getOldCredentialPath(_0xce4656);if(a28_0x312f39['existsSync'](_0x233549)){console[_0x1afa43(0x101)]('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0xce4656+'\x27'),console[_0x1afa43(0x101)](_0x1afa43(0x11c)),console['warn'](_0x1afa43(0x106)+_0x233549+_0x1afa43(0xe1)+_0x21fbd9+'\x22'),console['warn'](_0x1afa43(0x12d));try{return a28_0x312f39['readFileSync'](_0x233549,_0x1afa43(0x120));}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_0x2438f8=a29_0x3019;function a29_0x3019(_0x1a71ae,_0x34ddcf){const _0x355463=a29_0x3554();return a29_0x3019=function(_0x3019d1,_0x292931){_0x3019d1=_0x3019d1-0x1ed;let _0x2c6900=_0x355463[_0x3019d1];return _0x2c6900;},a29_0x3019(_0x1a71ae,_0x34ddcf);}(function(_0x52a508,_0x5d1482){const _0x42a5ee=a29_0x3019,_0x29a692=_0x52a508();while(!![]){try{const _0x456772=parseInt(_0x42a5ee(0x208))/0x1+parseInt(_0x42a5ee(0x1ff))/0x2*(-parseInt(_0x42a5ee(0x206))/0x3)+-parseInt(_0x42a5ee(0x203))/0x4*(-parseInt(_0x42a5ee(0x1f1))/0x5)+parseInt(_0x42a5ee(0x1ee))/0x6*(parseInt(_0x42a5ee(0x20b))/0x7)+-parseInt(_0x42a5ee(0x20e))/0x8+-parseInt(_0x42a5ee(0x1fc))/0x9*(parseInt(_0x42a5ee(0x1fe))/0xa)+-parseInt(_0x42a5ee(0x204))/0xb;if(_0x456772===_0x5d1482)break;else _0x29a692['push'](_0x29a692['shift']());}catch(_0x2ddc3d){_0x29a692['push'](_0x29a692['shift']());}}}(a29_0x3554,0x3deb9));import*as a29_0x184b91 from'node:fs';function a29_0x3554(){const _0x143325=['9RjPDRr','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','1397610YmsMLI','2786OpPRkB','warn','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json',').\x20','4KKmQBw','178728vTAJUw','writeFileSync','81yvFCYe','readFileSync','199692XlvDPY','existsSync','includes','1150093PekOxJ','stringify','Failed\x20to\x20load\x20project\x20config\x20from\x20','996576lYiUAR','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','profile','6tHsddw','TD_API_KEY','cwd','1039130AKpCBx','dirname','join','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','utf-8','apiKey','api_key','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','ENOENT','parse','tdx.json'];a29_0x3554=function(){return _0x143325;};return a29_0x3554();}import*as a29_0x244f53 from'node:path';const PROJECT_CONFIG_FILENAME=a29_0x2438f8(0x1fb);export function findProjectConfigPath(_0x524a74){const _0x545afb=a29_0x2438f8;let _0x1b1e0e=_0x524a74||process[_0x545afb(0x1f0)]();while(!![]){const _0x7d0b26=a29_0x244f53[_0x545afb(0x1f3)](_0x1b1e0e,PROJECT_CONFIG_FILENAME);if(a29_0x184b91[_0x545afb(0x209)](_0x7d0b26))return _0x7d0b26;const _0x1f7dce=a29_0x244f53[_0x545afb(0x1f2)](_0x1b1e0e);if(_0x1f7dce===_0x1b1e0e)return null;_0x1b1e0e=_0x1f7dce;}}export function loadProjectConfig(_0xf701ae){const _0x42bb46=a29_0x2438f8,_0x2063e2=findProjectConfigPath(_0xf701ae);if(!_0x2063e2)return null;try{const _0x1eea51=a29_0x184b91[_0x42bb46(0x207)](_0x2063e2,_0x42bb46(0x1f5)),_0x509ddf=JSON[_0x42bb46(0x1fa)](_0x1eea51),_0x51bb93=JSON['stringify'](_0x509ddf);if(_0x51bb93[_0x42bb46(0x20a)]('TD_API_KEY')||_0x51bb93[_0x42bb46(0x20a)](_0x42bb46(0x1f6))||_0x51bb93[_0x42bb46(0x20a)]('api_key'))throw new Error(_0x42bb46(0x1fd)+_0x2063e2+_0x42bb46(0x202)+_0x42bb46(0x1f8));const {metadata:_0x11477e,profile:_0x851544,..._0x50f2f7}=_0x509ddf;return _0x851544&&console[_0x42bb46(0x200)]('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x2063e2+'\x20is\x20ignored.\x20'+_0x42bb46(0x201)),_0x50f2f7;}catch(_0xc5cec2){if(_0xc5cec2 instanceof Error&&'code'in _0xc5cec2&&_0xc5cec2['code']===_0x42bb46(0x1f9))return null;throw new Error(_0x42bb46(0x20d)+_0x2063e2+':\x20'+_0xc5cec2);}}export function saveProjectConfig(_0x3bdf4e,_0x2fce33){const _0x507bad=a29_0x2438f8,_0x660875=_0x2fce33||process['cwd'](),_0x4956fb=a29_0x244f53[_0x507bad(0x1f3)](_0x660875,PROJECT_CONFIG_FILENAME),_0x3d4c72=JSON[_0x507bad(0x20c)](_0x3bdf4e);if(_0x3d4c72['includes'](_0x507bad(0x1ef))||_0x3d4c72[_0x507bad(0x20a)](_0x507bad(0x1f6))||_0x3d4c72[_0x507bad(0x20a)](_0x507bad(0x1f7)))throw new Error(_0x507bad(0x1f4));if(_0x507bad(0x1ed)in _0x3bdf4e)throw new Error(_0x507bad(0x20f));a29_0x184b91[_0x507bad(0x205)](_0x4956fb,JSON[_0x507bad(0x20c)](_0x3bdf4e,null,0x2));}export function hasProjectConfig(_0x49ccf9){return findProjectConfigPath(_0x49ccf9)!==null;}export function getProjectRoot(_0x4ff41b){const _0x586438=findProjectConfigPath(_0x4ff41b);return _0x586438?a29_0x244f53['dirname'](_0x586438):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(_0x5e2139,_0x259895){const _0x3a3c93=a30_0x44a0,_0x236403=_0x5e2139();while(!![]){try{const _0x283531=-parseInt(_0x3a3c93(0xdc))/0x1+parseInt(_0x3a3c93(0xbe))/0x2+-parseInt(_0x3a3c93(0xc8))/0x3*(parseInt(_0x3a3c93(0xd5))/0x4)+-parseInt(_0x3a3c93(0xba))/0x5*(parseInt(_0x3a3c93(0xd9))/0x6)+-parseInt(_0x3a3c93(0xc2))/0x7+parseInt(_0x3a3c93(0xcb))/0x8*(parseInt(_0x3a3c93(0xd7))/0x9)+-parseInt(_0x3a3c93(0xe3))/0xa*(-parseInt(_0x3a3c93(0xd6))/0xb);if(_0x283531===_0x259895)break;else _0x236403['push'](_0x236403['shift']());}catch(_0x4909c6){_0x236403['push'](_0x236403['shift']());}}}(a30_0x76fb,0x89c78));function a30_0x76fb(){const _0x2ecc22=['797556aYPDQk','308dCxoOP','1097892xXLTko','apiKey','5390646GmIxbR','readFileSync','api_key','41645btyjnF','env','.config','includes','test','homedir','tdx','635530XIYWAr','5NaJQII','sort','now','stringify','667212Ydgqzz','writeFileSync','push','warn','5426645qtMsTr','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','.json','join','getTime','3xLQKLs','createdAt','replace','24CWIHCu','endsWith','TD_API_KEY','existsSync','parse','toString','.\x20This\x20is\x20insecure.\x20Removing\x20session.','unlinkSync','utf-8','toISOString'];a30_0x76fb=function(){return _0x2ecc22;};return a30_0x76fb();}import*as a30_0x2d3075 from'node:fs';import*as a30_0x1bf5c1 from'node:path';import*as a30_0x5690cb 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 _0x397b91=a30_0x44a0,_0xefeedb=process[_0x397b91(0xdd)]['TDX_CONFIG_DIR']||a30_0x1bf5c1[_0x397b91(0xc6)](a30_0x5690cb[_0x397b91(0xe1)](),_0x397b91(0xde),_0x397b91(0xe2));return a30_0x1bf5c1[_0x397b91(0xc6)](_0xefeedb,'sessions');}function getSessionPath(_0x56cc0a){const _0x5d33c9=a30_0x44a0;return a30_0x1bf5c1[_0x5d33c9(0xc6)](getSessionsDir(),_0x56cc0a+_0x5d33c9(0xc5));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x5d5123){if(_0x5d5123)return _0x5d5123;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x345fe2){const _0x5b4730=a30_0x44a0,_0x436683=_0x345fe2||getCurrentSessionPID()[_0x5b4730(0xd0)](),_0x75224b=/^\d+$/[_0x5b4730(0xe0)](_0x436683)?parseInt(_0x436683,0xa):null;return _0x75224b!==null?loadSessionContextByPID(_0x75224b):loadSessionContextByString(_0x436683);}export function loadSessionContextByPID(_0x193af7){const _0x2ab7f9=a30_0x44a0,_0x5609c6=getSessionPath(_0x193af7);if(!a30_0x2d3075[_0x2ab7f9(0xce)](_0x5609c6))return null;try{const _0x391282=a30_0x2d3075[_0x2ab7f9(0xda)](_0x5609c6,_0x2ab7f9(0xd3)),_0x249296=JSON[_0x2ab7f9(0xcf)](_0x391282),_0x3cdadf=new Date(_0x249296['createdAt'])['getTime'](),_0x4be839=Date[_0x2ab7f9(0xbc)]();if(_0x4be839-_0x3cdadf>SESSION_EXPIRATION_MS)return a30_0x2d3075[_0x2ab7f9(0xd2)](_0x5609c6),null;const _0x254878=JSON[_0x2ab7f9(0xbd)](_0x249296);if(_0x254878[_0x2ab7f9(0xdf)](_0x2ab7f9(0xcd))||_0x254878[_0x2ab7f9(0xdf)](_0x2ab7f9(0xd8))||_0x254878[_0x2ab7f9(0xdf)](_0x2ab7f9(0xdb)))return console['warn'](_0x2ab7f9(0xc3)+_0x5609c6+_0x2ab7f9(0xd1)),a30_0x2d3075[_0x2ab7f9(0xd2)](_0x5609c6),null;return _0x249296;}catch{try{a30_0x2d3075[_0x2ab7f9(0xd2)](_0x5609c6);}catch{}return null;}}function loadSessionContextByString(_0x328be0){const _0x19a555=a30_0x44a0,_0x126700=a30_0x1bf5c1['join'](getSessionsDir(),_0x328be0+_0x19a555(0xc5));if(!a30_0x2d3075[_0x19a555(0xce)](_0x126700))return null;try{const _0x3064dd=a30_0x2d3075[_0x19a555(0xda)](_0x126700,_0x19a555(0xd3)),_0x229a6f=JSON['parse'](_0x3064dd),_0xf23fc6=new Date(_0x229a6f[_0x19a555(0xc9)])[_0x19a555(0xc7)](),_0x4554d6=Date['now']();if(_0x4554d6-_0xf23fc6>SESSION_EXPIRATION_MS)return a30_0x2d3075[_0x19a555(0xd2)](_0x126700),null;const _0x24f917=JSON[_0x19a555(0xbd)](_0x229a6f);if(_0x24f917['includes'](_0x19a555(0xcd))||_0x24f917[_0x19a555(0xdf)](_0x19a555(0xd8))||_0x24f917[_0x19a555(0xdf)](_0x19a555(0xdb)))return console[_0x19a555(0xc1)](_0x19a555(0xc3)+_0x126700+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a30_0x2d3075[_0x19a555(0xd2)](_0x126700),null;return _0x229a6f;}catch{try{a30_0x2d3075[_0x19a555(0xd2)](_0x126700);}catch{}return null;}}export function saveSessionContext(_0x39bb98,_0x2a08d3){const _0x531d22=a30_0x44a0,_0x23809e=_0x2a08d3||getCurrentSessionPID()[_0x531d22(0xd0)](),_0x5ddcbb=/^\d+$/[_0x531d22(0xe0)](_0x23809e)?parseInt(_0x23809e,0xa):getCurrentSessionPID(),_0x5422a4=a30_0x1bf5c1[_0x531d22(0xc6)](getSessionsDir(),_0x23809e+'.json'),_0x27e091=getSessionsDir();createSecureDirectory(_0x27e091);const _0x2e240e=JSON[_0x531d22(0xbd)](_0x39bb98);if(_0x2e240e[_0x531d22(0xdf)](_0x531d22(0xcd))||_0x2e240e['includes'](_0x531d22(0xd8))||_0x2e240e[_0x531d22(0xdf)]('api_key'))throw new Error(_0x531d22(0xc4));let _0x5b7417;const _0x73d08a=/^\d+$/['test'](_0x23809e)?loadSessionContextByPID(parseInt(_0x23809e,0xa)):loadSessionContextByString(_0x23809e);_0x73d08a?_0x5b7417={..._0x73d08a,..._0x39bb98,'pid':_0x5ddcbb,'sessionId':_0x23809e!==_0x5ddcbb[_0x531d22(0xd0)]()?_0x23809e:undefined,'updatedAt':new Date()[_0x531d22(0xd4)]()}:_0x5b7417={'pid':_0x5ddcbb,'sessionId':_0x23809e!==_0x5ddcbb[_0x531d22(0xd0)]()?_0x23809e:undefined,..._0x39bb98,'createdAt':new Date()[_0x531d22(0xd4)](),'updatedAt':new Date()[_0x531d22(0xd4)]()},a30_0x2d3075[_0x531d22(0xbf)](_0x5422a4,JSON[_0x531d22(0xbd)](_0x5b7417,null,0x2));}function a30_0x44a0(_0x5b7593,_0x219b2b){const _0x76fbce=a30_0x76fb();return a30_0x44a0=function(_0x44a0d0,_0x11e1d3){_0x44a0d0=_0x44a0d0-0xba;let _0xe4777d=_0x76fbce[_0x44a0d0];return _0xe4777d;},a30_0x44a0(_0x5b7593,_0x219b2b);}export function clearSessionContext(_0x3a4307){const _0x39c99e=a30_0x44a0,_0x306e0c=_0x3a4307||getCurrentSessionPID()[_0x39c99e(0xd0)](),_0x102ba5=a30_0x1bf5c1[_0x39c99e(0xc6)](getSessionsDir(),_0x306e0c+'.json');a30_0x2d3075[_0x39c99e(0xce)](_0x102ba5)&&a30_0x2d3075[_0x39c99e(0xd2)](_0x102ba5);}export function cleanExpiredSessions(){const _0x31b0a5=a30_0x44a0,_0x271559=getSessionsDir();if(!a30_0x2d3075[_0x31b0a5(0xce)](_0x271559))return 0x0;let _0x153748=0x0;const _0xa96bf=Date[_0x31b0a5(0xbc)]();try{const _0xc7fd63=a30_0x2d3075['readdirSync'](_0x271559);for(const _0xfa8337 of _0xc7fd63){if(!_0xfa8337['endsWith'](_0x31b0a5(0xc5)))continue;const _0x1a1c68=a30_0x1bf5c1['join'](_0x271559,_0xfa8337),_0x217722=_0xfa8337[_0x31b0a5(0xca)](_0x31b0a5(0xc5),''),_0x417307=parseInt(_0x217722,0xa),_0x2055e7=!isNaN(_0x417307);if(_0x2055e7){if(!isProcessRunning(_0x417307)){a30_0x2d3075[_0x31b0a5(0xd2)](_0x1a1c68),_0x153748++;continue;}}try{const _0x487964=a30_0x2d3075[_0x31b0a5(0xda)](_0x1a1c68,_0x31b0a5(0xd3)),_0x4fc99=JSON['parse'](_0x487964),_0x33b39c=new Date(_0x4fc99[_0x31b0a5(0xc9)])[_0x31b0a5(0xc7)]();_0xa96bf-_0x33b39c>SESSION_EXPIRATION_MS&&(a30_0x2d3075[_0x31b0a5(0xd2)](_0x1a1c68),_0x153748++);}catch{a30_0x2d3075[_0x31b0a5(0xd2)](_0x1a1c68),_0x153748++;}}}catch{}return _0x153748;}export function listActiveSessions(){const _0xe62bd2=a30_0x44a0,_0x334686=getSessionsDir();if(!a30_0x2d3075['existsSync'](_0x334686))return[];try{const _0x4587ea=a30_0x2d3075['readdirSync'](_0x334686),_0x667283=[];for(const _0x24ccf8 of _0x4587ea){if(!_0x24ccf8[_0xe62bd2(0xcc)]('.json'))continue;const _0x1543c8=_0x24ccf8[_0xe62bd2(0xca)](_0xe62bd2(0xc5),''),_0x18d4d2=parseInt(_0x1543c8,0xa);!isNaN(_0x18d4d2)&&isProcessRunning(_0x18d4d2)&&_0x667283[_0xe62bd2(0xc0)](_0x18d4d2);}return _0x667283[_0xe62bd2(0xbb)]((_0x3914e5,_0x37598d)=>_0x3914e5-_0x37598d);}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(_0x118847,_0x41a479){var _0x2b032d=a31_0x38ff,_0x50b1ce=_0x118847();while(!![]){try{var _0x39787b=parseInt(_0x2b032d(0x1ba))/0x1+-parseInt(_0x2b032d(0x1bc))/0x2*(-parseInt(_0x2b032d(0x1bf))/0x3)+-parseInt(_0x2b032d(0x1be))/0x4+parseInt(_0x2b032d(0x1c1))/0x5+parseInt(_0x2b032d(0x1bd))/0x6+-parseInt(_0x2b032d(0x1bb))/0x7+-parseInt(_0x2b032d(0x1c0))/0x8;if(_0x39787b===_0x41a479)break;else _0x50b1ce['push'](_0x50b1ce['shift']());}catch(_0x2350c4){_0x50b1ce['push'](_0x50b1ce['shift']());}}}(a31_0x1c74,0x5a8f4));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';function a31_0x1c74(){var _0x2ad571=['3339258TATwWZ','706996OzNCpW','4227YNiehz','4721752FwyUZn','1052680ifKOXi','213182ISWwYe','2979809bReJpc','828vqDaJC'];a31_0x1c74=function(){return _0x2ad571;};return a31_0x1c74();}export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';function a31_0x38ff(_0x24772a,_0x1a80cf){var _0x1c7495=a31_0x1c74();return a31_0x38ff=function(_0x38ff49,_0x4d2a78){_0x38ff49=_0x38ff49-0x1ba;var _0x4012ed=_0x1c7495[_0x38ff49];return _0x4012ed;},a31_0x38ff(_0x24772a,_0x1a80cf);}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,7 +1,7 @@
1
1
  /**
2
2
  * API translation layer for converting between Anthropic Messages API and TD LLM API formats
3
3
  */
4
- import type { AnthropicMessage, AnthropicMessagesRequest, AnthropicStreamEvent } from '../types/anthropic.js';
4
+ import type { AnthropicMessage, AnthropicMessagesRequest, AnthropicStreamEvent, AnthropicTool } from '../types/anthropic.js';
5
5
  import type { SSEEvent } from '../types/index.js';
6
6
  /**
7
7
  * Generate a unique message ID (simulating Anthropic's format)
@@ -40,5 +40,40 @@ export declare function formatAnthropicSSE(event: AnthropicStreamEvent): string;
40
40
  * Supports common Anthropic model aliases
41
41
  */
42
42
  export declare function mapAnthropicModelToTD(anthropicModel: string): string;
43
+ /**
44
+ * Generate tool instruction prompt from Anthropic tool definitions
45
+ * This prompt instructs the LLM to output tool calls as JSON
46
+ */
47
+ export declare function generateToolPrompt(tools: AnthropicTool[]): string;
48
+ /**
49
+ * Extract tool results from Anthropic messages and format for TD API
50
+ * Converts tool_result content blocks into continuation prompt
51
+ */
52
+ export declare function extractToolResults(messages: AnthropicMessage[]): string;
53
+ /**
54
+ * Parse tool call JSON from text content
55
+ * Returns parsed tool call with start/end indices, or null if not found
56
+ */
57
+ export declare function parseToolCallFromText(text: string): {
58
+ id: string;
59
+ name: string;
60
+ input: Record<string, unknown>;
61
+ startIndex: number;
62
+ endIndex: number;
63
+ } | null;
64
+ /**
65
+ * Generate Anthropic SSE events for a tool call
66
+ * Returns array of events: start → input deltas → stop → message_delta → message_stop
67
+ */
68
+ export declare function generateToolCallEvents(toolCall: {
69
+ id: string;
70
+ name: string;
71
+ input: Record<string, unknown>;
72
+ }, contentIndex: number): Generator<AnthropicStreamEvent, void, unknown>;
73
+ /**
74
+ * Process TD stream and detect tool calls in text content
75
+ * Buffers text to detect JSON patterns and emits appropriate events
76
+ */
77
+ export declare function transformTDStreamWithToolDetection(tdStream: AsyncGenerator<SSEEvent, void, unknown>, messageId: string, model: string, debug?: boolean): AsyncGenerator<AnthropicStreamEvent, void, unknown>;
43
78
  export { generateMessageId };
44
79
  //# sourceMappingURL=anthropic-adapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"anthropic-adapter.d.ts","sourceRoot":"","sources":["../../src/proxy/anthropic-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EAOrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAoD,MAAM,mBAAmB,CAAC;AAEpG;;GAEG;AACH,iBAAS,iBAAiB,IAAI,MAAM,CAEnC;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAUjF;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,gBAAgB,EAAE,EACnC,gBAAgB,EAAE,gBAAgB,EAAE,GACnC,gBAAgB,EAAE,CAYpB;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,wBAAwB,EACjC,gBAAgB,EAAE,gBAAgB,EAAE,GACnC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAgB5D;AAED;;;GAGG;AACH,wBAAuB,4BAA4B,CACjD,QAAQ,EAAE,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,EACjD,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,cAAc,CAAC,oBAAoB,EAAE,IAAI,EAAE,OAAO,CAAC,CAwGrD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAEtE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAiBpE;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"anthropic-adapter.d.ts","sourceRoot":"","sources":["../../src/proxy/anthropic-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EAOpB,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAoD,MAAM,mBAAmB,CAAC;AAEpG;;GAEG;AACH,iBAAS,iBAAiB,IAAI,MAAM,CAEnC;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAUjF;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,gBAAgB,EAAE,EACnC,gBAAgB,EAAE,gBAAgB,EAAE,GACnC,gBAAgB,EAAE,CAYpB;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,wBAAwB,EACjC,gBAAgB,EAAE,gBAAgB,EAAE,GACnC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAgB5D;AAED;;;GAGG;AACH,wBAAuB,4BAA4B,CACjD,QAAQ,EAAE,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,EACjD,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,cAAc,CAAC,oBAAoB,EAAE,IAAI,EAAE,OAAO,CAAC,CAwGrD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,oBAAoB,GAAG,MAAM,CAEtE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAiBpE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,CA2CjE;AAcD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAmCvE;AA6CD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CAmCP;AAED;;;GAGG;AACH,wBAAiB,sBAAsB,CACrC,QAAQ,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,EACtE,YAAY,EAAE,MAAM,GACnB,SAAS,CAAC,oBAAoB,EAAE,IAAI,EAAE,OAAO,CAAC,CAoDhD;AAED;;;GAGG;AACH,wBAAuB,kCAAkC,CACvD,QAAQ,EAAE,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,EACjD,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,KAAK,UAAQ,GACZ,cAAc,CAAC,oBAAoB,EAAE,IAAI,EAAE,OAAO,CAAC,CAoPrD;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}