@treasuredata/tdx 0.1.15 → 0.1.17
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.
- package/README.md +10 -0
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client/cdp-client.js +1 -1
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-client.js +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-client.js +1 -1
- package/dist/client/trino-client.js +1 -1
- package/dist/client/workflow-client.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-command.js.map +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/context-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/llm-proxy.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pwd-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy/anthropic-adapter.d.ts +21 -2
- package/dist/proxy/anthropic-adapter.d.ts.map +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/anthropic-adapter.js.map +1 -1
- package/dist/proxy/server.d.ts.map +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/server.js.map +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/database.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/llm.js +1 -1
- package/dist/sdk/query.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/table.js +1 -1
- package/dist/sdk/workflow.js +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/agent-ref-parser.js +1 -1
- package/dist/utils/chat-cache.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/command-output.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/format-detector.js +1 -1
- package/dist/utils/formatters.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/model-aliases.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/port.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/segment-path-parser.js +1 -1
- package/dist/utils/segment-ref-parser.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sql-parser.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a32_0x1beda1=a32_0x3086;(function(_0x2fd3cc,_0x526b3f){const _0x5ba895=a32_0x3086,_0x2f9f75=_0x2fd3cc();while(!![]){try{const _0x3eb4b4=parseInt(_0x5ba895(0xa5))/0x1+-parseInt(_0x5ba895(0x89))/0x2+parseInt(_0x5ba895(0xdd))/0x3+parseInt(_0x5ba895(0xfd))/0x4*(parseInt(_0x5ba895(0xb8))/0x5)+-parseInt(_0x5ba895(0xe9))/0x6+parseInt(_0x5ba895(0x97))/0x7*(-parseInt(_0x5ba895(0xe2))/0x8)+parseInt(_0x5ba895(0xf8))/0x9;if(_0x3eb4b4===_0x526b3f)break;else _0x2f9f75['push'](_0x2f9f75['shift']());}catch(_0x36aad4){_0x2f9f75['push'](_0x2f9f75['shift']());}}}(a32_0x1186,0x532d3));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{confirm}from'../utils/prompt.js';export class WorkflowProjectsCommand extends BaseCommand{[a32_0x1beda1(0x92)]='workflow:projects';['description']=a32_0x1beda1(0x8b);async['execute'](_0x1a95db){const _0x245293=a32_0x1beda1,{options:_0x5b7c39,args:_0x29b04a,tdx:_0x172190}=_0x1a95db,_0x10a886=_0x29b04a[0x0];try{_0x5b7c39[_0x245293(0xa2)]&&_0x10a886&&console[_0x245293(0xba)]('Pattern:\x20'+_0x10a886);const _0xa905f7=await withSpinner('Listing\x20workflow\x20projects...',()=>_0x172190[_0x245293(0xcc)]['projects'](_0x10a886,{'limit':_0x5b7c39[_0x245293(0xaa)]}),{'verbose':_0x5b7c39[_0x245293(0xa2)]}),_0x57fc43=_0xa905f7[_0x245293(0xdf)];return console[_0x245293(0xba)]('✔\x20Found\x20'+_0x57fc43['length']+'\x20project'+(_0x57fc43[_0x245293(0xa7)]!==0x1?'s':'')),await handleSDKOutput(_0x57fc43,_0x5b7c39),0x0;}catch(_0x32ef27){if(_0x32ef27 instanceof SDKError)return console[_0x245293(0xba)]('Error:\x20'+_0x32ef27[_0x245293(0xe0)]),_0x32ef27['cause']&&console[_0x245293(0xba)](_0x245293(0xaf)+_0x32ef27[_0x245293(0xd6)]),0x1;throw _0x32ef27;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a32_0x1beda1(0x92)]=a32_0x1beda1(0x96);['description']='List\x20workflows';async['execute'](_0x4cc66a){const _0x4a261b=a32_0x1beda1,{options:_0x15ac58,args:_0x88dab3,tdx:_0x51b37a}=_0x4cc66a,_0x1dd055=_0x88dab3[0x0];try{_0x15ac58['verbose']&&_0x1dd055&&console[_0x4a261b(0xba)]('Project\x20filter:\x20'+_0x1dd055);const _0xde1583=await withSpinner(_0x4a261b(0xd4),()=>_0x51b37a[_0x4a261b(0xcc)][_0x4a261b(0xe5)](_0x1dd055,{'limit':_0x15ac58[_0x4a261b(0xaa)]}),{'verbose':_0x15ac58[_0x4a261b(0xa2)]}),_0x390e68=_0xde1583['data'];return console[_0x4a261b(0xba)](_0x4a261b(0xde)+_0x390e68['length']+_0x4a261b(0xdc)+(_0x390e68[_0x4a261b(0xa7)]!==0x1?'s':'')),await handleSDKOutput(_0x390e68,_0x15ac58),0x0;}catch(_0x4f4078){if(_0x4f4078 instanceof SDKError)return console[_0x4a261b(0xba)](_0x4a261b(0xe8)+_0x4f4078[_0x4a261b(0xe0)]),_0x4f4078[_0x4a261b(0xd6)]&&console[_0x4a261b(0xba)](_0x4a261b(0xaf)+_0x4f4078[_0x4a261b(0xd6)]),0x1;throw _0x4f4078;}}}export class WorkflowSessionsCommand extends BaseCommand{[a32_0x1beda1(0x92)]='workflow:sessions';[a32_0x1beda1(0xff)]='List\x20workflow\x20execution\x20sessions';async[a32_0x1beda1(0x84)](_0x576087){const _0x2c4c9c=a32_0x1beda1,{options:_0x65c073,args:_0x204f70,tdx:_0x23144d}=_0x576087;let _0x4b10d6,_0x567f9a;if(_0x204f70[0x0]){const _0x5e5dcb=_0x204f70[0x0][_0x2c4c9c(0x94)]('.');if(_0x5e5dcb[_0x2c4c9c(0xa7)]===0x1)_0x4b10d6=_0x5e5dcb[0x0];else{if(_0x5e5dcb[_0x2c4c9c(0xa7)]===0x2)[_0x4b10d6,_0x567f9a]=_0x5e5dcb;else return console[_0x2c4c9c(0xba)](_0x2c4c9c(0xc4)),0x1;}}try{if(_0x65c073[_0x2c4c9c(0xa2)]){if(_0x4b10d6&&_0x567f9a)console[_0x2c4c9c(0xba)](_0x2c4c9c(0x90)+_0x4b10d6+'.'+_0x567f9a);else _0x4b10d6&&console[_0x2c4c9c(0xba)](_0x2c4c9c(0x87)+_0x4b10d6);const _0x3a0777=_0x65c073[_0x2c4c9c(0xc2)];_0x3a0777&&console[_0x2c4c9c(0xba)](_0x2c4c9c(0xf5)+_0x3a0777);}const _0x2d9dc9=await withSpinner('Listing\x20workflow\x20sessions...',()=>_0x23144d[_0x2c4c9c(0xcc)][_0x2c4c9c(0x8c)]({'projectName':_0x4b10d6,'workflowName':_0x567f9a,'status':_0x65c073[_0x2c4c9c(0xc2)],'fromTime':_0x65c073[_0x2c4c9c(0xb9)],'toTime':_0x65c073['to'],'limit':_0x65c073[_0x2c4c9c(0xaa)]}),{'verbose':_0x65c073[_0x2c4c9c(0xa2)]}),_0x14ea06=_0x2d9dc9['data'];return console[_0x2c4c9c(0xba)](_0x2c4c9c(0xde)+_0x14ea06[_0x2c4c9c(0xa7)]+_0x2c4c9c(0xd9)+(_0x14ea06['length']!==0x1?'s':'')),await handleSDKOutput(_0x14ea06,_0x65c073),0x0;}catch(_0x2cfd68){if(_0x2cfd68 instanceof SDKError)return console[_0x2c4c9c(0xba)]('Error:\x20'+_0x2cfd68['message']),_0x2cfd68[_0x2c4c9c(0xd6)]&&console['error']('\x20\x20Cause:\x20'+_0x2cfd68[_0x2c4c9c(0xd6)]),0x1;throw _0x2cfd68;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a32_0x1beda1(0x92)]=a32_0x1beda1(0xed);['description']=a32_0x1beda1(0xf0);async[a32_0x1beda1(0x84)](_0x1bffeb){const _0xb71afd=a32_0x1beda1,{options:_0x16a6d7,args:_0x5e5650,tdx:_0x96937a}=_0x1bffeb;let _0x2c2b19,_0x2da148;if(_0x5e5650[0x0]){const _0x169d45=_0x5e5650[0x0][_0xb71afd(0x94)]('.');if(_0x169d45[_0xb71afd(0xa7)]===0x1)_0x2c2b19=_0x169d45[0x0];else{if(_0x169d45[_0xb71afd(0xa7)]===0x2)[_0x2c2b19,_0x2da148]=_0x169d45;else return console[_0xb71afd(0xba)](_0xb71afd(0xc4)),0x1;}}try{const _0x372dd5=_0x16a6d7['includeRetried'];if(_0x16a6d7[_0xb71afd(0xa2)]){if(_0x2c2b19&&_0x2da148)console[_0xb71afd(0xba)](_0xb71afd(0x90)+_0x2c2b19+'.'+_0x2da148);else _0x2c2b19&&console[_0xb71afd(0xba)](_0xb71afd(0x87)+_0x2c2b19);_0x372dd5&&console[_0xb71afd(0xba)](_0xb71afd(0xc7));}const _0x2787a9=await withSpinner('Listing\x20workflow\x20attempts...',()=>_0x96937a[_0xb71afd(0xcc)]['attempts']({'projectName':_0x2c2b19,'workflowName':_0x2da148,'includeRetried':_0x372dd5,'limit':_0x16a6d7[_0xb71afd(0xaa)]}),{'verbose':_0x16a6d7[_0xb71afd(0xa2)]}),_0x55189c=_0x2787a9['data'];return console[_0xb71afd(0xba)](_0xb71afd(0xde)+_0x55189c[_0xb71afd(0xa7)]+'\x20attempt'+(_0x55189c['length']!==0x1?'s':'')),await handleSDKOutput(_0x55189c,_0x16a6d7),0x0;}catch(_0xedb67a){if(_0xedb67a instanceof SDKError)return console['error']('Error:\x20'+_0xedb67a[_0xb71afd(0xe0)]),_0xedb67a[_0xb71afd(0xd6)]&&console[_0xb71afd(0xba)](_0xb71afd(0xaf)+_0xedb67a[_0xb71afd(0xd6)]),0x1;throw _0xedb67a;}}}export class WorkflowAttemptCommand extends BaseCommand{['name']=a32_0x1beda1(0xea);[a32_0x1beda1(0xff)]='Show\x20specific\x20attempt\x20details';async[a32_0x1beda1(0x84)](_0x3930bd){const _0x59c8ef=a32_0x1beda1,{options:_0x4b3b41,args:_0x3aa951,tdx:_0x59837d}=_0x3930bd,_0x59e934=_0x3aa951[0x0];if(!_0x59e934)return console[_0x59c8ef(0xba)](_0x59c8ef(0x91)),0x1;try{_0x4b3b41[_0x59c8ef(0xa2)]&&console[_0x59c8ef(0xba)](_0x59c8ef(0xbe)+_0x59e934);const _0x2b1053=await withSpinner(_0x59c8ef(0xca),()=>_0x59837d['workflow']['attempt'](_0x59e934),{'verbose':_0x4b3b41[_0x59c8ef(0xa2)]}),_0x70bfa9=_0x2b1053[_0x59c8ef(0xdf)];return await handleSDKOutput([_0x70bfa9],_0x4b3b41),0x0;}catch(_0x1c572e){if(_0x1c572e instanceof SDKError)return console[_0x59c8ef(0xba)](_0x59c8ef(0xe8)+_0x1c572e[_0x59c8ef(0xe0)]),_0x1c572e['cause']&&console[_0x59c8ef(0xba)](_0x59c8ef(0xaf)+_0x1c572e[_0x59c8ef(0xd6)]),0x1;throw _0x1c572e;}}}export class WorkflowTasksCommand extends BaseCommand{['name']='workflow:tasks';[a32_0x1beda1(0xff)]=a32_0x1beda1(0x88);async['execute'](_0x2ee953){const _0x5ca35a=a32_0x1beda1,{options:_0x393601,args:_0x2e7d6f,tdx:_0x32d91d}=_0x2ee953,_0x49ca40=_0x2e7d6f[0x0];if(!_0x49ca40)return console[_0x5ca35a(0xba)](_0x5ca35a(0x91)),0x1;try{const _0x227e96=_0x393601[_0x5ca35a(0xfc)];_0x393601[_0x5ca35a(0xa2)]&&(console[_0x5ca35a(0xba)](_0x5ca35a(0xbe)+_0x49ca40),_0x227e96&&console[_0x5ca35a(0xba)](_0x5ca35a(0xa8)));const _0x5c0b18=await withSpinner('Getting\x20attempt\x20tasks...',()=>_0x32d91d[_0x5ca35a(0xcc)][_0x5ca35a(0x86)](_0x49ca40,_0x227e96||![]),{'verbose':_0x393601['verbose']}),_0x5b2c4c=_0x5c0b18[_0x5ca35a(0xdf)];return console[_0x5ca35a(0xba)](_0x5ca35a(0xde)+_0x5b2c4c[_0x5ca35a(0xa7)]+'\x20task'+(_0x5b2c4c[_0x5ca35a(0xa7)]!==0x1?'s':'')),await handleSDKOutput(_0x5b2c4c,_0x393601),0x0;}catch(_0x2db4b2){if(_0x2db4b2 instanceof SDKError)return console['error'](_0x5ca35a(0xe8)+_0x2db4b2[_0x5ca35a(0xe0)]),_0x2db4b2[_0x5ca35a(0xd6)]&&console[_0x5ca35a(0xba)]('\x20\x20Cause:\x20'+_0x2db4b2[_0x5ca35a(0xd6)]),0x1;throw _0x2db4b2;}}}function a32_0x3086(_0x841e55,_0x5dd4d2){const _0x118661=a32_0x1186();return a32_0x3086=function(_0x3086a0,_0x24863f){_0x3086a0=_0x3086a0-0x83;let _0x7268b2=_0x118661[_0x3086a0];return _0x7268b2;},a32_0x3086(_0x841e55,_0x5dd4d2);}export class WorkflowLogsCommand extends BaseCommand{[a32_0x1beda1(0x92)]='workflow:logs';[a32_0x1beda1(0xff)]=a32_0x1beda1(0xf3);async[a32_0x1beda1(0x84)](_0x4cb8b1){const _0x2e26c3=a32_0x1beda1,{options:_0x2e647e,args:_0x486f36,tdx:_0x57320f}=_0x4cb8b1,_0x3cc726=_0x486f36[0x0],_0x27b6a8=_0x486f36[0x1];if(!_0x3cc726||!_0x27b6a8)return console[_0x2e26c3(0xba)](_0x2e26c3(0xc8)),0x1;try{_0x2e647e[_0x2e26c3(0xa2)]&&(console[_0x2e26c3(0xba)](_0x2e26c3(0xbe)+_0x3cc726),console['error'](_0x2e26c3(0x99)+_0x27b6a8));const _0x3c6090=_0x2e647e[_0x2e26c3(0x98)],_0x4f5db2=await withSpinner(_0x2e26c3(0xac),()=>_0x57320f[_0x2e26c3(0xcc)][_0x2e26c3(0x95)](_0x3cc726,_0x27b6a8,{'offset':_0x3c6090,'limit':_0x2e647e[_0x2e26c3(0xaa)]}),{'verbose':_0x2e647e['verbose']}),_0x1bb2b6=_0x4f5db2[_0x2e26c3(0xdf)];return console[_0x2e26c3(0xba)](_0x2e26c3(0xde)+_0x1bb2b6[_0x2e26c3(0xa7)]+'\x20log\x20entr'+(_0x1bb2b6[_0x2e26c3(0xa7)]!==0x1?_0x2e26c3(0xce):'y')),await handleSDKOutput(_0x1bb2b6,_0x2e647e),0x0;}catch(_0x80c2ac){if(_0x80c2ac instanceof SDKError)return console['error']('Error:\x20'+_0x80c2ac[_0x2e26c3(0xe0)]),_0x80c2ac['cause']&&console[_0x2e26c3(0xba)](_0x2e26c3(0xaf)+_0x80c2ac[_0x2e26c3(0xd6)]),0x1;throw _0x80c2ac;}}}export class WorkflowKillCommand extends BaseCommand{[a32_0x1beda1(0x92)]=a32_0x1beda1(0xc0);[a32_0x1beda1(0xff)]=a32_0x1beda1(0x8a);async[a32_0x1beda1(0x84)](_0x3a7e7f){const _0x266adf=a32_0x1beda1,{options:_0x483c8d,args:_0x12dc95,tdx:_0x1cd750}=_0x3a7e7f,_0x538e1d=_0x12dc95[0x0];if(!_0x538e1d)return console[_0x266adf(0xba)](_0x266adf(0x91)),0x1;try{const _0x1a3c15=_0x483c8d[_0x266adf(0xb3)];_0x483c8d['verbose']&&(console[_0x266adf(0xba)](_0x266adf(0xbe)+_0x538e1d),_0x1a3c15&&console['error']('Reason:\x20'+_0x1a3c15));if(!_0x483c8d[_0x266adf(0xe6)]){const _0x307432=await confirm(_0x266adf(0xc3)+_0x538e1d+'?');if(!_0x307432)return console[_0x266adf(0xba)](_0x266adf(0xcf)),0x0;}const _0x2033dd=await withSpinner(_0x266adf(0xe7),()=>_0x1cd750[_0x266adf(0xcc)]['kill'](_0x538e1d,_0x1a3c15),{'verbose':_0x483c8d[_0x266adf(0xa2)]}),_0xcc4b81=_0x2033dd['data'];return console['error']('✔\x20'+_0xcc4b81),0x0;}catch(_0x1edf34){if(_0x1edf34 instanceof SDKError)return console[_0x266adf(0xba)](_0x266adf(0xe8)+_0x1edf34[_0x266adf(0xe0)]),_0x1edf34[_0x266adf(0xd6)]&&console[_0x266adf(0xba)]('\x20\x20Cause:\x20'+_0x1edf34['cause']),0x1;throw _0x1edf34;}}}export class WorkflowRetryCommand extends BaseCommand{[a32_0x1beda1(0x92)]=a32_0x1beda1(0xb7);[a32_0x1beda1(0xff)]=a32_0x1beda1(0xae);async['execute'](_0x128cd2){const _0x4a1b7a=a32_0x1beda1,{options:_0x5b58cd,args:_0x29bba2,tdx:_0x34d5e9}=_0x128cd2,_0x3cf964=_0x29bba2[0x0];if(!_0x3cf964)return console[_0x4a1b7a(0xba)](_0x4a1b7a(0xe4)),console[_0x4a1b7a(0xba)](_0x4a1b7a(0x8d)),0x1;let _0x1d7c29=![],_0x5273af=_0x3cf964;if(_0x3cf964['startsWith'](_0x4a1b7a(0xbc)))_0x1d7c29=!![],_0x5273af=_0x3cf964[_0x4a1b7a(0xa1)](0x8);else{if(_0x3cf964[_0x4a1b7a(0xd5)](_0x4a1b7a(0x85)))_0x1d7c29=![],_0x5273af=_0x3cf964[_0x4a1b7a(0xa1)](0x8);else return console['error']('Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'),console[_0x4a1b7a(0xba)](_0x4a1b7a(0x8d)),0x1;}try{const _0x325724=_0x5b58cd[_0x4a1b7a(0xdb)],_0xcf05bb=_0x5b58cd[_0x4a1b7a(0xc6)],_0x4a9b55=_0x5b58cd[_0x4a1b7a(0xef)],_0x37d19b=_0x5b58cd['force'];_0x5b58cd[_0x4a1b7a(0xa2)]&&(console[_0x4a1b7a(0xba)](_0x4a1b7a(0xa9)+(_0x1d7c29?_0x4a1b7a(0xb6):_0x4a1b7a(0x83))+'\x20'+_0x5273af),_0x325724&&console[_0x4a1b7a(0xba)](_0x4a1b7a(0xb5)+_0x325724),_0xcf05bb&&console[_0x4a1b7a(0xba)](_0x4a1b7a(0xa3)+_0xcf05bb),_0x4a9b55&&console['error']('Params:\x20'+_0x4a9b55),_0x37d19b&&console[_0x4a1b7a(0xba)](_0x4a1b7a(0xfa)));let _0x598591;if(_0x4a9b55)try{if(_0x4a9b55[_0x4a1b7a(0xd5)]('@')){const _0x2df587=await import(_0x4a1b7a(0xf6)),_0x41de86=_0x4a9b55['substring'](0x1),_0x217380=await _0x2df587[_0x4a1b7a(0x8f)](_0x41de86,_0x4a1b7a(0xbb));_0x598591=JSON[_0x4a1b7a(0xd0)](_0x217380);}else _0x598591=JSON['parse'](_0x4a9b55);}catch{return console[_0x4a1b7a(0xba)]('Error:\x20Invalid\x20JSON\x20in\x20--params'),0x1;}if(!_0x5b58cd[_0x4a1b7a(0xe6)]){const _0x476458=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20'+(_0x1d7c29?_0x4a1b7a(0xb6):'attempt')+'\x20'+_0x5273af+'?');if(!_0x476458)return console[_0x4a1b7a(0xba)](_0x4a1b7a(0xcf)),0x0;}let _0x268694;_0x1d7c29?_0x268694=await withSpinner(_0x4a1b7a(0x9f),()=>_0x34d5e9[_0x4a1b7a(0xcc)][_0x4a1b7a(0x93)](_0x5273af,{'fromTask':_0x325724,'retryParams':_0x598591}),{'verbose':_0x5b58cd[_0x4a1b7a(0xa2)]}):_0x268694=await withSpinner(_0x4a1b7a(0xda),()=>_0x34d5e9['workflow'][_0x4a1b7a(0x9c)](_0x5273af,{'resumeFrom':_0xcf05bb,'retryParams':_0x598591,'force':_0x37d19b}),{'verbose':_0x5b58cd['verbose']});const _0x2ed374=_0x268694[_0x4a1b7a(0xdf)];return console['error'](_0x4a1b7a(0xeb)),console[_0x4a1b7a(0xba)](_0x4a1b7a(0xfe)+_0x2ed374[_0x4a1b7a(0x9a)]),console['error'](_0x4a1b7a(0xb0)+_0x2ed374[_0x4a1b7a(0xd2)]),0x0;}catch(_0x201d86){if(_0x201d86 instanceof SDKError)return console[_0x4a1b7a(0xba)](_0x4a1b7a(0xe8)+_0x201d86[_0x4a1b7a(0xe0)]),_0x201d86['cause']&&console[_0x4a1b7a(0xba)](_0x4a1b7a(0xaf)+_0x201d86[_0x4a1b7a(0xd6)]),0x1;throw _0x201d86;}}}export class WorkflowDownloadCommand extends BaseCommand{[a32_0x1beda1(0x92)]=a32_0x1beda1(0xab);['description']='Download\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a32_0x1beda1(0x84)](_0x109b12){const _0x3b7288=a32_0x1beda1,{options:_0x3d4b5e,args:_0x43bc44,tdx:_0x44e541}=_0x109b12,_0x5653d8=_0x43bc44[0x0],_0x33f3d9=_0x43bc44[0x1]||'.';if(!_0x5653d8)return console['error'](_0x3b7288(0x9d)),console[_0x3b7288(0xba)]('Usage:\x20workflow:download\x20<project-name>\x20[output-dir]'),0x1;const _0x5d5442=_0x3d4b5e[_0x3b7288(0xf2)];_0x3d4b5e[_0x3b7288(0xa2)]&&(console[_0x3b7288(0xba)](_0x3b7288(0xad)+_0x5653d8),console['error'](_0x3b7288(0xb1)+_0x33f3d9),_0x5d5442&&console[_0x3b7288(0xba)](_0x3b7288(0xc5)+_0x5d5442));const _0x227799=await withSpinner(_0x3b7288(0xf4)+_0x5653d8+_0x3b7288(0xb4),()=>_0x44e541[_0x3b7288(0xcc)][_0x3b7288(0x9b)](_0x5653d8,_0x33f3d9,{'revision':_0x5d5442}),{'verbose':_0x3d4b5e['verbose']}),_0x51655b=_0x227799[_0x3b7288(0xdf)];return console['error'](_0x3b7288(0xd7)+_0x51655b[_0x3b7288(0xbf)]),console['error']('\x20\x20Revision:\x20'+_0x51655b[_0x3b7288(0xf2)]),console[_0x3b7288(0xba)](_0x3b7288(0xc9)+_0x51655b[_0x3b7288(0x8e)]),console[_0x3b7288(0xba)](_0x3b7288(0xee)+_0x33f3d9+'/'+_0x51655b[_0x3b7288(0xbf)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{['name']=a32_0x1beda1(0xf1);['description']=a32_0x1beda1(0xe3);async[a32_0x1beda1(0x84)](_0x526942){const _0x500ee8=a32_0x1beda1,{options:_0x144368,args:_0x338346,tdx:_0x913bd7}=_0x526942;let _0x2de593='.',_0x225409=_0x144368['name'];if(_0x338346[0x0]){const {promises:_0x20d5bd}=await import('fs');try{const _0x1c58a6=await _0x20d5bd[_0x500ee8(0xa4)](_0x338346[0x0]);if(_0x1c58a6[_0x500ee8(0xf9)]())_0x2de593=_0x338346[0x0];else return console[_0x500ee8(0xba)](_0x500ee8(0xe8)+_0x338346[0x0]+_0x500ee8(0xd8)),0x1;}catch{_0x225409=_0x338346[0x0],_0x2de593='.';}}const _0x5bc5fd=_0x144368[_0x500ee8(0xf2)],_0x2cfc1d=_0x144368[_0x500ee8(0xb2)];_0x144368[_0x500ee8(0xa2)]&&(console[_0x500ee8(0xba)]('Project\x20directory:\x20'+_0x2de593),_0x225409&&console['error']('Project\x20name:\x20'+_0x225409),_0x5bc5fd&&console[_0x500ee8(0xba)](_0x500ee8(0xc5)+_0x5bc5fd),_0x2cfc1d&&console[_0x500ee8(0xba)](_0x500ee8(0xa6)));const _0x9389da=await withSpinner(_0x500ee8(0xcb),()=>_0x913bd7[_0x500ee8(0xcc)][_0x500ee8(0xfb)](_0x2de593,{'projectName':_0x225409,'revision':_0x5bc5fd,'skipValidation':_0x2cfc1d}),{'verbose':_0x144368[_0x500ee8(0xa2)]}),_0x3e2393=_0x9389da['data'];return console[_0x500ee8(0xba)]('✔\x20Pushed\x20'+_0x3e2393[_0x500ee8(0xbf)]),console[_0x500ee8(0xba)](_0x500ee8(0xc1)+_0x3e2393[_0x500ee8(0xec)]),console[_0x500ee8(0xba)](_0x500ee8(0x9e)+_0x3e2393[_0x500ee8(0xf2)]),0x0;}}function a32_0x1186(){const _0x289ccc=['name','retrySession','split','logs','workflow:workflows','406tZGsib','offset','Task\x20name:\x20','attemptId','download','retryAttempt','Error:\x20Project\x20name\x20is\x20required','\x20\x20Revision:\x20','Retrying\x20session...','\x22?\x20This\x20cannot\x20be\x20undone.','substring','verbose','Resume\x20from:\x20','stat','637603pakcIg','Validation:\x20skipped','length','Including\x20subtasks:\x20yes','Target:\x20','limit','workflow:download','Getting\x20task\x20logs...','Project:\x20','Retry\x20a\x20session\x20or\x20attempt','\x20\x20Cause:\x20','\x20\x20Session\x20ID:\x20','Output\x20directory:\x20','skipValidation','reason','...','From\x20task:\x20','session','workflow:retry','5ZItKrn','from','error','utf-8','session:','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','Attempt\x20ID:\x20','projectName','workflow:kill','\x20\x20Project\x20ID:\x20','status','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Revision:\x20','resumeFrom','Include\x20retried:\x20yes','Error:\x20Attempt\x20ID\x20and\x20task\x20name\x20are\x20required','\x20\x20Files\x20extracted:\x20','Getting\x20attempt\x20details...','Pushing\x20workflow\x20project...','workflow','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','ies','Cancelled','parse','workflow:delete','sessionId','Usage:\x20workflow:delete\x20<project-name-or-id>','Listing\x20workflows...','startsWith','cause','✔\x20Downloaded\x20','\x20is\x20not\x20a\x20directory','\x20session','Retrying\x20attempt...','fromTask','\x20workflow','918945NGkHTe','✔\x20Found\x20','data','message','Deleting\x20project\x20','13880sYOwMq','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','workflows','yes','Killing\x20attempt...','Error:\x20','3988194kQXhjo','workflow:attempt','✔\x20Retry\x20started','projectId','workflow:attempts','\x20\x20Location:\x20','params','List\x20workflow\x20attempts','workflow:push','revision','Show\x20logs\x20for\x20a\x20specific\x20task','Downloading\x20project\x20','Status:\x20','fs/promises','✔\x20Deleted\x20project\x20','1060794LkPgOH','isDirectory','Force:\x20yes','push','includeSubtasks','1747304sOKdGK','\x20\x20New\x20attempt\x20ID:\x20','description','attempt','execute','attempt:','tasks','Filter:\x20project=','Show\x20tasks\x20for\x20an\x20attempt','785180wjkATu','Kill\x20a\x20running\x20attempt','List\x20all\x20workflow\x20projects','sessions','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','filesExtracted','readFile','Filter:\x20','Error:\x20Attempt\x20ID\x20is\x20required'];a32_0x1186=function(){return _0x289ccc;};return a32_0x1186();}export class WorkflowDeleteCommand extends BaseCommand{[a32_0x1beda1(0x92)]=a32_0x1beda1(0xd1);[a32_0x1beda1(0xff)]=a32_0x1beda1(0xbd);async[a32_0x1beda1(0x84)](_0x21bb06){const _0x10e76c=a32_0x1beda1,{options:_0x4a45e0,args:_0x52c63f,tdx:_0x10bbca}=_0x21bb06,_0x2b7082=_0x52c63f[0x0];if(!_0x2b7082)return console[_0x10e76c(0xba)](_0x10e76c(0xcd)),console[_0x10e76c(0xba)](_0x10e76c(0xd3)),0x1;_0x4a45e0[_0x10e76c(0xa2)]&&console[_0x10e76c(0xba)](_0x10e76c(0xad)+_0x2b7082);if(!_0x4a45e0[_0x10e76c(0xe6)]){const _0x500162=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22'+_0x2b7082+_0x10e76c(0xa0));if(!_0x500162)return console[_0x10e76c(0xba)]('Cancelled'),0x0;}const _0x1f7922=await withSpinner(_0x10e76c(0xe1)+_0x2b7082+_0x10e76c(0xb4),()=>_0x10bbca['workflow']['delete'](_0x2b7082),{'verbose':_0x4a45e0[_0x10e76c(0xa2)]}),_0x915d0d=_0x1f7922[_0x10e76c(0xdf)];return console[_0x10e76c(0xba)](_0x10e76c(0xf7)+_0x915d0d['projectName']),console[_0x10e76c(0xba)](_0x10e76c(0xc1)+_0x915d0d[_0x10e76c(0xec)]),0x0;}}
|
|
1
|
+
const a32_0x1d683a=a32_0x453f;function a32_0x453f(_0x2174ae,_0x53c72c){const _0x4c65dc=a32_0x4c65();return a32_0x453f=function(_0x453f3b,_0x3d2202){_0x453f3b=_0x453f3b-0x1d1;let _0x32ce42=_0x4c65dc[_0x453f3b];return _0x32ce42;},a32_0x453f(_0x2174ae,_0x53c72c);}(function(_0x4e4227,_0x41a6b5){const _0x17603f=a32_0x453f,_0x42aa87=_0x4e4227();while(!![]){try{const _0x3b3199=-parseInt(_0x17603f(0x20c))/0x1*(-parseInt(_0x17603f(0x1d1))/0x2)+parseInt(_0x17603f(0x243))/0x3+parseInt(_0x17603f(0x1f3))/0x4*(parseInt(_0x17603f(0x1d6))/0x5)+-parseInt(_0x17603f(0x21a))/0x6*(-parseInt(_0x17603f(0x1d5))/0x7)+-parseInt(_0x17603f(0x20d))/0x8*(-parseInt(_0x17603f(0x231))/0x9)+-parseInt(_0x17603f(0x235))/0xa+-parseInt(_0x17603f(0x203))/0xb*(parseInt(_0x17603f(0x1e4))/0xc);if(_0x3b3199===_0x41a6b5)break;else _0x42aa87['push'](_0x42aa87['shift']());}catch(_0x146f48){_0x42aa87['push'](_0x42aa87['shift']());}}}(a32_0x4c65,0x9ed01));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{confirm}from'../utils/prompt.js';export class WorkflowProjectsCommand extends BaseCommand{[a32_0x1d683a(0x242)]='workflow:projects';[a32_0x1d683a(0x244)]=a32_0x1d683a(0x1dd);async[a32_0x1d683a(0x23c)](_0xb295c7){const _0x2e921d=a32_0x1d683a,{options:_0x35b80b,args:_0x90cc5b,tdx:_0x2c40d}=_0xb295c7,_0x29de17=_0x90cc5b[0x0];try{_0x35b80b[_0x2e921d(0x1e3)]&&_0x29de17&&console[_0x2e921d(0x220)]('Pattern:\x20'+_0x29de17);const _0x2d0ffd=await withSpinner(_0x2e921d(0x1d7),()=>_0x2c40d[_0x2e921d(0x227)][_0x2e921d(0x216)](_0x29de17,{'limit':_0x35b80b[_0x2e921d(0x1f2)]}),{'verbose':_0x35b80b[_0x2e921d(0x1e3)]}),_0x21a2bc=_0x2d0ffd['data'];return console[_0x2e921d(0x220)]('✔\x20Found\x20'+_0x21a2bc[_0x2e921d(0x1e2)]+_0x2e921d(0x1f0)+(_0x21a2bc[_0x2e921d(0x1e2)]!==0x1?'s':'')),await handleSDKOutput(_0x21a2bc,_0x35b80b),0x0;}catch(_0x2eb68d){if(_0x2eb68d instanceof SDKError)return console[_0x2e921d(0x220)](_0x2e921d(0x20f)+_0x2eb68d[_0x2e921d(0x223)]),_0x2eb68d['cause']&&console['error'](_0x2e921d(0x1df)+_0x2eb68d['cause']),0x1;throw _0x2eb68d;}}}export class WorkflowWorkflowsCommand extends BaseCommand{['name']='workflow:workflows';[a32_0x1d683a(0x244)]='List\x20workflows';async[a32_0x1d683a(0x23c)](_0x7d1624){const _0x11c2b1=a32_0x1d683a,{options:_0x13811e,args:_0x5bcf1b,tdx:_0x3e079f}=_0x7d1624,_0x32193d=_0x5bcf1b[0x0];try{_0x13811e[_0x11c2b1(0x1e3)]&&_0x32193d&&console['error'](_0x11c2b1(0x1d3)+_0x32193d);const _0x177288=await withSpinner(_0x11c2b1(0x211),()=>_0x3e079f['workflow'][_0x11c2b1(0x236)](_0x32193d,{'limit':_0x13811e[_0x11c2b1(0x1f2)]}),{'verbose':_0x13811e[_0x11c2b1(0x1e3)]}),_0x5386dc=_0x177288[_0x11c2b1(0x1d9)];return console[_0x11c2b1(0x220)]('✔\x20Found\x20'+_0x5386dc[_0x11c2b1(0x1e2)]+_0x11c2b1(0x1ed)+(_0x5386dc['length']!==0x1?'s':'')),await handleSDKOutput(_0x5386dc,_0x13811e),0x0;}catch(_0x22f3fa){if(_0x22f3fa instanceof SDKError)return console[_0x11c2b1(0x220)]('Error:\x20'+_0x22f3fa[_0x11c2b1(0x223)]),_0x22f3fa[_0x11c2b1(0x1f6)]&&console[_0x11c2b1(0x220)](_0x11c2b1(0x1df)+_0x22f3fa[_0x11c2b1(0x1f6)]),0x1;throw _0x22f3fa;}}}export class WorkflowSessionsCommand extends BaseCommand{[a32_0x1d683a(0x242)]=a32_0x1d683a(0x217);[a32_0x1d683a(0x244)]='List\x20workflow\x20execution\x20sessions';async[a32_0x1d683a(0x23c)](_0x1d0991){const _0x20950c=a32_0x1d683a,{options:_0x562271,args:_0x7f8c92,tdx:_0x21ceb9}=_0x1d0991;let _0x4cd9a9,_0x56a864;if(_0x7f8c92[0x0]){const _0x29b09e=_0x7f8c92[0x0][_0x20950c(0x21c)]('.');if(_0x29b09e['length']===0x1)_0x4cd9a9=_0x29b09e[0x0];else{if(_0x29b09e[_0x20950c(0x1e2)]===0x2)[_0x4cd9a9,_0x56a864]=_0x29b09e;else return console['error'](_0x20950c(0x248)),0x1;}}try{if(_0x562271[_0x20950c(0x1e3)]){if(_0x4cd9a9&&_0x56a864)console[_0x20950c(0x220)](_0x20950c(0x23f)+_0x4cd9a9+'.'+_0x56a864);else _0x4cd9a9&&console[_0x20950c(0x220)](_0x20950c(0x224)+_0x4cd9a9);const _0x159c8a=_0x562271[_0x20950c(0x1f5)];_0x159c8a&&console[_0x20950c(0x220)](_0x20950c(0x21f)+_0x159c8a);}const _0x33d68d=await withSpinner(_0x20950c(0x249),()=>_0x21ceb9['workflow']['sessions']({'projectName':_0x4cd9a9,'workflowName':_0x56a864,'status':_0x562271['status'],'fromTime':_0x562271[_0x20950c(0x1f8)],'toTime':_0x562271['to'],'limit':_0x562271['limit']}),{'verbose':_0x562271['verbose']}),_0x311a02=_0x33d68d[_0x20950c(0x1d9)];return console[_0x20950c(0x220)](_0x20950c(0x1ec)+_0x311a02[_0x20950c(0x1e2)]+'\x20session'+(_0x311a02[_0x20950c(0x1e2)]!==0x1?'s':'')),await handleSDKOutput(_0x311a02,_0x562271),0x0;}catch(_0x4c8683){if(_0x4c8683 instanceof SDKError)return console[_0x20950c(0x220)](_0x20950c(0x20f)+_0x4c8683['message']),_0x4c8683['cause']&&console['error'](_0x20950c(0x1df)+_0x4c8683[_0x20950c(0x1f6)]),0x1;throw _0x4c8683;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a32_0x1d683a(0x242)]=a32_0x1d683a(0x22a);[a32_0x1d683a(0x244)]=a32_0x1d683a(0x201);async[a32_0x1d683a(0x23c)](_0x173491){const _0x571b8e=a32_0x1d683a,{options:_0x184af7,args:_0x50adf0,tdx:_0xb58681}=_0x173491;let _0x5680ea,_0xb1a261;if(_0x50adf0[0x0]){const _0x56d63a=_0x50adf0[0x0][_0x571b8e(0x21c)]('.');if(_0x56d63a[_0x571b8e(0x1e2)]===0x1)_0x5680ea=_0x56d63a[0x0];else{if(_0x56d63a['length']===0x2)[_0x5680ea,_0xb1a261]=_0x56d63a;else return console[_0x571b8e(0x220)](_0x571b8e(0x248)),0x1;}}try{const _0x3fc716=_0x184af7[_0x571b8e(0x1ff)];if(_0x184af7[_0x571b8e(0x1e3)]){if(_0x5680ea&&_0xb1a261)console[_0x571b8e(0x220)](_0x571b8e(0x23f)+_0x5680ea+'.'+_0xb1a261);else _0x5680ea&&console[_0x571b8e(0x220)](_0x571b8e(0x224)+_0x5680ea);_0x3fc716&&console[_0x571b8e(0x220)]('Include\x20retried:\x20yes');}const _0x119b12=await withSpinner(_0x571b8e(0x20e),()=>_0xb58681[_0x571b8e(0x227)][_0x571b8e(0x212)]({'projectName':_0x5680ea,'workflowName':_0xb1a261,'includeRetried':_0x3fc716,'limit':_0x184af7[_0x571b8e(0x1f2)]}),{'verbose':_0x184af7[_0x571b8e(0x1e3)]}),_0x3b6cf6=_0x119b12['data'];return console['error'](_0x571b8e(0x1ec)+_0x3b6cf6[_0x571b8e(0x1e2)]+_0x571b8e(0x1e6)+(_0x3b6cf6[_0x571b8e(0x1e2)]!==0x1?'s':'')),await handleSDKOutput(_0x3b6cf6,_0x184af7),0x0;}catch(_0x5f5682){if(_0x5f5682 instanceof SDKError)return console['error'](_0x571b8e(0x20f)+_0x5f5682['message']),_0x5f5682['cause']&&console['error'](_0x571b8e(0x1df)+_0x5f5682[_0x571b8e(0x1f6)]),0x1;throw _0x5f5682;}}}export class WorkflowAttemptCommand extends BaseCommand{[a32_0x1d683a(0x242)]='workflow:attempt';['description']=a32_0x1d683a(0x24d);async[a32_0x1d683a(0x23c)](_0x2c2147){const _0x40d79a=a32_0x1d683a,{options:_0x3a5ada,args:_0x17f60a,tdx:_0x1ffa2d}=_0x2c2147,_0x441e18=_0x17f60a[0x0];if(!_0x441e18)return console['error'](_0x40d79a(0x1e8)),0x1;try{_0x3a5ada['verbose']&&console['error'](_0x40d79a(0x241)+_0x441e18);const _0x1165e9=await withSpinner('Getting\x20attempt\x20details...',()=>_0x1ffa2d[_0x40d79a(0x227)][_0x40d79a(0x1d2)](_0x441e18),{'verbose':_0x3a5ada[_0x40d79a(0x1e3)]}),_0x5a3703=_0x1165e9[_0x40d79a(0x1d9)];return await handleSDKOutput([_0x5a3703],_0x3a5ada),0x0;}catch(_0x5c54d2){if(_0x5c54d2 instanceof SDKError)return console[_0x40d79a(0x220)](_0x40d79a(0x20f)+_0x5c54d2['message']),_0x5c54d2[_0x40d79a(0x1f6)]&&console[_0x40d79a(0x220)](_0x40d79a(0x1df)+_0x5c54d2[_0x40d79a(0x1f6)]),0x1;throw _0x5c54d2;}}}export class WorkflowTasksCommand extends BaseCommand{['name']=a32_0x1d683a(0x24c);[a32_0x1d683a(0x244)]=a32_0x1d683a(0x225);async[a32_0x1d683a(0x23c)](_0x42c0c6){const _0x23d57a=a32_0x1d683a,{options:_0x1673bc,args:_0x359baa,tdx:_0x1886d6}=_0x42c0c6,_0x9b5a70=_0x359baa[0x0];if(!_0x9b5a70)return console[_0x23d57a(0x220)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x383ca1=_0x1673bc[_0x23d57a(0x221)];_0x1673bc[_0x23d57a(0x1e3)]&&(console['error']('Attempt\x20ID:\x20'+_0x9b5a70),_0x383ca1&&console['error'](_0x23d57a(0x1e7)));const _0x13e538=await withSpinner(_0x23d57a(0x219),()=>_0x1886d6[_0x23d57a(0x227)]['tasks'](_0x9b5a70,_0x383ca1||![]),{'verbose':_0x1673bc['verbose']}),_0x1163e7=_0x13e538[_0x23d57a(0x1d9)];return console[_0x23d57a(0x220)](_0x23d57a(0x1ec)+_0x1163e7[_0x23d57a(0x1e2)]+'\x20task'+(_0x1163e7[_0x23d57a(0x1e2)]!==0x1?'s':'')),await handleSDKOutput(_0x1163e7,_0x1673bc),0x0;}catch(_0x2dd345){if(_0x2dd345 instanceof SDKError)return console[_0x23d57a(0x220)](_0x23d57a(0x20f)+_0x2dd345['message']),_0x2dd345[_0x23d57a(0x1f6)]&&console['error']('\x20\x20Cause:\x20'+_0x2dd345[_0x23d57a(0x1f6)]),0x1;throw _0x2dd345;}}}export class WorkflowLogsCommand extends BaseCommand{[a32_0x1d683a(0x242)]=a32_0x1d683a(0x232);[a32_0x1d683a(0x244)]='Show\x20logs\x20for\x20a\x20specific\x20task';async['execute'](_0x27ed65){const _0x3b8f46=a32_0x1d683a,{options:_0x2b7dfb,args:_0x287b26,tdx:_0x3dae73}=_0x27ed65,_0x464ec2=_0x287b26[0x0],_0x4106da=_0x287b26[0x1];if(!_0x464ec2||!_0x4106da)return console['error']('Error:\x20Attempt\x20ID\x20and\x20task\x20name\x20are\x20required'),0x1;try{_0x2b7dfb[_0x3b8f46(0x1e3)]&&(console[_0x3b8f46(0x220)]('Attempt\x20ID:\x20'+_0x464ec2),console['error'](_0x3b8f46(0x1ea)+_0x4106da));const _0x2a737c=_0x2b7dfb[_0x3b8f46(0x20b)],_0x286e39=await withSpinner('Getting\x20task\x20logs...',()=>_0x3dae73['workflow'][_0x3b8f46(0x208)](_0x464ec2,_0x4106da,{'offset':_0x2a737c,'limit':_0x2b7dfb[_0x3b8f46(0x1f2)]}),{'verbose':_0x2b7dfb['verbose']}),_0x1a192f=_0x286e39['data'];return console[_0x3b8f46(0x220)]('✔\x20Found\x20'+_0x1a192f[_0x3b8f46(0x1e2)]+_0x3b8f46(0x1e0)+(_0x1a192f['length']!==0x1?'ies':'y')),await handleSDKOutput(_0x1a192f,_0x2b7dfb),0x0;}catch(_0x290813){if(_0x290813 instanceof SDKError)return console['error'](_0x3b8f46(0x20f)+_0x290813[_0x3b8f46(0x223)]),_0x290813[_0x3b8f46(0x1f6)]&&console[_0x3b8f46(0x220)](_0x3b8f46(0x1df)+_0x290813['cause']),0x1;throw _0x290813;}}}export class WorkflowKillCommand extends BaseCommand{[a32_0x1d683a(0x242)]=a32_0x1d683a(0x23d);[a32_0x1d683a(0x244)]='Kill\x20a\x20running\x20attempt';async['execute'](_0x119564){const _0x265bdd=a32_0x1d683a,{options:_0xf59173,args:_0x57645c,tdx:_0x1ec766}=_0x119564,_0x3eaee6=_0x57645c[0x0];if(!_0x3eaee6)return console[_0x265bdd(0x220)](_0x265bdd(0x1e8)),0x1;try{const _0x27663f=_0xf59173[_0x265bdd(0x230)];_0xf59173[_0x265bdd(0x1e3)]&&(console[_0x265bdd(0x220)](_0x265bdd(0x241)+_0x3eaee6),_0x27663f&&console['error'](_0x265bdd(0x1d4)+_0x27663f));if(!_0xf59173['yes']){const _0x46b5fd=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20'+_0x3eaee6+'?');if(!_0x46b5fd)return console[_0x265bdd(0x220)](_0x265bdd(0x22c)),0x0;}const _0x19b415=await withSpinner('Killing\x20attempt...',()=>_0x1ec766[_0x265bdd(0x227)]['kill'](_0x3eaee6,_0x27663f),{'verbose':_0xf59173[_0x265bdd(0x1e3)]}),_0x5c245b=_0x19b415[_0x265bdd(0x1d9)];return console[_0x265bdd(0x220)]('✔\x20'+_0x5c245b),0x0;}catch(_0x54d4a5){if(_0x54d4a5 instanceof SDKError)return console['error'](_0x265bdd(0x20f)+_0x54d4a5[_0x265bdd(0x223)]),_0x54d4a5[_0x265bdd(0x1f6)]&&console[_0x265bdd(0x220)](_0x265bdd(0x1df)+_0x54d4a5[_0x265bdd(0x1f6)]),0x1;throw _0x54d4a5;}}}export class WorkflowRetryCommand extends BaseCommand{[a32_0x1d683a(0x242)]=a32_0x1d683a(0x210);['description']='Retry\x20a\x20session\x20or\x20attempt';async[a32_0x1d683a(0x23c)](_0x3d6476){const _0x535a9e=a32_0x1d683a,{options:_0x4bcf1a,args:_0x4e6285,tdx:_0x4ad7d4}=_0x3d6476,_0x3c8506=_0x4e6285[0x0];if(!_0x3c8506)return console['error'](_0x535a9e(0x218)),console[_0x535a9e(0x220)](_0x535a9e(0x246)),0x1;let _0x5d82b6=![],_0x12dd8f=_0x3c8506;if(_0x3c8506[_0x535a9e(0x22b)](_0x535a9e(0x1fb)))_0x5d82b6=!![],_0x12dd8f=_0x3c8506[_0x535a9e(0x1e5)](0x8);else{if(_0x3c8506[_0x535a9e(0x22b)](_0x535a9e(0x1fa)))_0x5d82b6=![],_0x12dd8f=_0x3c8506[_0x535a9e(0x1e5)](0x8);else return console[_0x535a9e(0x220)](_0x535a9e(0x240)),console['error'](_0x535a9e(0x246)),0x1;}try{const _0x39a0f9=_0x4bcf1a[_0x535a9e(0x1f4)],_0x58458d=_0x4bcf1a[_0x535a9e(0x239)],_0x5405e4=_0x4bcf1a[_0x535a9e(0x204)],_0x4fbbf9=_0x4bcf1a['force'];_0x4bcf1a[_0x535a9e(0x1e3)]&&(console[_0x535a9e(0x220)](_0x535a9e(0x1f7)+(_0x5d82b6?_0x535a9e(0x24b):_0x535a9e(0x1d2))+'\x20'+_0x12dd8f),_0x39a0f9&&console[_0x535a9e(0x220)]('From\x20task:\x20'+_0x39a0f9),_0x58458d&&console[_0x535a9e(0x220)](_0x535a9e(0x22e)+_0x58458d),_0x5405e4&&console[_0x535a9e(0x220)](_0x535a9e(0x21e)+_0x5405e4),_0x4fbbf9&&console[_0x535a9e(0x220)](_0x535a9e(0x213)));let _0x4a88d2;if(_0x5405e4)try{if(_0x5405e4[_0x535a9e(0x22b)]('@')){const _0x57ae48=await import(_0x535a9e(0x1da)),_0x5106c4=_0x5405e4[_0x535a9e(0x1e5)](0x1),_0x54938f=await _0x57ae48['readFile'](_0x5106c4,_0x535a9e(0x23e));_0x4a88d2=JSON[_0x535a9e(0x209)](_0x54938f);}else _0x4a88d2=JSON[_0x535a9e(0x209)](_0x5405e4);}catch{return console['error']('Error:\x20Invalid\x20JSON\x20in\x20--params'),0x1;}if(!_0x4bcf1a[_0x535a9e(0x233)]){const _0x5f52c5=await confirm(_0x535a9e(0x1db)+(_0x5d82b6?_0x535a9e(0x24b):_0x535a9e(0x1d2))+'\x20'+_0x12dd8f+'?');if(!_0x5f52c5)return console[_0x535a9e(0x220)](_0x535a9e(0x22c)),0x0;}let _0x233fbb;_0x5d82b6?_0x233fbb=await withSpinner(_0x535a9e(0x22d),()=>_0x4ad7d4[_0x535a9e(0x227)]['retrySession'](_0x12dd8f,{'fromTask':_0x39a0f9,'retryParams':_0x4a88d2}),{'verbose':_0x4bcf1a[_0x535a9e(0x1e3)]}):_0x233fbb=await withSpinner(_0x535a9e(0x21d),()=>_0x4ad7d4[_0x535a9e(0x227)]['retryAttempt'](_0x12dd8f,{'resumeFrom':_0x58458d,'retryParams':_0x4a88d2,'force':_0x4fbbf9}),{'verbose':_0x4bcf1a[_0x535a9e(0x1e3)]});const _0x10fa05=_0x233fbb[_0x535a9e(0x1d9)];return console[_0x535a9e(0x220)]('✔\x20Retry\x20started'),console[_0x535a9e(0x220)](_0x535a9e(0x228)+_0x10fa05[_0x535a9e(0x1fc)]),console[_0x535a9e(0x220)](_0x535a9e(0x23a)+_0x10fa05[_0x535a9e(0x24a)]),0x0;}catch(_0x37d845){if(_0x37d845 instanceof SDKError)return console[_0x535a9e(0x220)](_0x535a9e(0x20f)+_0x37d845[_0x535a9e(0x223)]),_0x37d845[_0x535a9e(0x1f6)]&&console['error']('\x20\x20Cause:\x20'+_0x37d845['cause']),0x1;throw _0x37d845;}}}export class WorkflowDownloadCommand extends BaseCommand{[a32_0x1d683a(0x242)]=a32_0x1d683a(0x222);[a32_0x1d683a(0x244)]=a32_0x1d683a(0x1e9);async[a32_0x1d683a(0x23c)](_0x52f8d7){const _0x10df88=a32_0x1d683a,{options:_0x153e50,args:_0x41cdda,tdx:_0x2876cc}=_0x52f8d7,_0x1d9670=_0x41cdda[0x0],_0x31fa59=_0x41cdda[0x1]||'.';if(!_0x1d9670)return console[_0x10df88(0x220)](_0x10df88(0x1fd)),console[_0x10df88(0x220)]('Usage:\x20workflow:download\x20<project-name>\x20[output-dir]'),0x1;const _0x4703fa=_0x153e50[_0x10df88(0x238)];_0x153e50[_0x10df88(0x1e3)]&&(console[_0x10df88(0x220)](_0x10df88(0x21b)+_0x1d9670),console[_0x10df88(0x220)]('Output\x20directory:\x20'+_0x31fa59),_0x4703fa&&console[_0x10df88(0x220)](_0x10df88(0x1dc)+_0x4703fa));const _0x44b089=await withSpinner(_0x10df88(0x205)+_0x1d9670+'...',()=>_0x2876cc['workflow'][_0x10df88(0x1eb)](_0x1d9670,_0x31fa59,{'revision':_0x4703fa}),{'verbose':_0x153e50[_0x10df88(0x1e3)]}),_0x9f34ca=_0x44b089[_0x10df88(0x1d9)];return console[_0x10df88(0x220)](_0x10df88(0x202)+_0x9f34ca[_0x10df88(0x229)]),console['error'](_0x10df88(0x226)+_0x9f34ca[_0x10df88(0x238)]),console[_0x10df88(0x220)](_0x10df88(0x1f9)+_0x9f34ca['filesExtracted']),console['error']('\x20\x20Location:\x20'+_0x31fa59+'/'+_0x9f34ca[_0x10df88(0x229)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a32_0x1d683a(0x242)]=a32_0x1d683a(0x207);[a32_0x1d683a(0x244)]=a32_0x1d683a(0x1ee);async[a32_0x1d683a(0x23c)](_0x56fe58){const _0x38c6ae=a32_0x1d683a,{options:_0x1276cb,args:_0x2d510c,tdx:_0x350bb9}=_0x56fe58;let _0x570b49='.',_0x25c4f1=_0x1276cb[_0x38c6ae(0x242)];if(_0x2d510c[0x0]){const {promises:_0xdf59b3}=await import('fs');try{const _0x25679d=await _0xdf59b3[_0x38c6ae(0x23b)](_0x2d510c[0x0]);if(_0x25679d[_0x38c6ae(0x214)]())_0x570b49=_0x2d510c[0x0];else return console[_0x38c6ae(0x220)](_0x38c6ae(0x20f)+_0x2d510c[0x0]+_0x38c6ae(0x1ef)),0x1;}catch{_0x25c4f1=_0x2d510c[0x0],_0x570b49='.';}}const _0x59d379=_0x1276cb[_0x38c6ae(0x238)],_0x3d3dcf=_0x1276cb['skipValidation'];_0x1276cb[_0x38c6ae(0x1e3)]&&(console[_0x38c6ae(0x220)]('Project\x20directory:\x20'+_0x570b49),_0x25c4f1&&console['error'](_0x38c6ae(0x200)+_0x25c4f1),_0x59d379&&console[_0x38c6ae(0x220)](_0x38c6ae(0x1dc)+_0x59d379),_0x3d3dcf&&console['error'](_0x38c6ae(0x22f)));const _0x1d23db=await withSpinner('Pushing\x20workflow\x20project...',()=>_0x350bb9[_0x38c6ae(0x227)][_0x38c6ae(0x1d8)](_0x570b49,{'projectName':_0x25c4f1,'revision':_0x59d379,'skipValidation':_0x3d3dcf}),{'verbose':_0x1276cb['verbose']}),_0x52c408=_0x1d23db['data'];return console[_0x38c6ae(0x220)](_0x38c6ae(0x245)+_0x52c408[_0x38c6ae(0x229)]),console[_0x38c6ae(0x220)]('\x20\x20Project\x20ID:\x20'+_0x52c408['projectId']),console[_0x38c6ae(0x220)](_0x38c6ae(0x226)+_0x52c408[_0x38c6ae(0x238)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{['name']=a32_0x1d683a(0x1fe);[a32_0x1d683a(0x244)]=a32_0x1d683a(0x247);async['execute'](_0x1ff859){const _0x49260e=a32_0x1d683a,{options:_0x31e053,args:_0x553c27,tdx:_0x13a715}=_0x1ff859,_0xf912c5=_0x553c27[0x0];if(!_0xf912c5)return console['error'](_0x49260e(0x1de)),console[_0x49260e(0x220)]('Usage:\x20workflow:delete\x20<project-name-or-id>'),0x1;_0x31e053[_0x49260e(0x1e3)]&&console[_0x49260e(0x220)](_0x49260e(0x21b)+_0xf912c5);if(!_0x31e053[_0x49260e(0x233)]){const _0x4ee724=await confirm(_0x49260e(0x234)+_0xf912c5+_0x49260e(0x20a));if(!_0x4ee724)return console[_0x49260e(0x220)](_0x49260e(0x22c)),0x0;}const _0x31476d=await withSpinner(_0x49260e(0x1e1)+_0xf912c5+_0x49260e(0x1f1),()=>_0x13a715[_0x49260e(0x227)][_0x49260e(0x215)](_0xf912c5),{'verbose':_0x31e053[_0x49260e(0x1e3)]}),_0x441dd7=_0x31476d[_0x49260e(0x1d9)];return console['error']('✔\x20Deleted\x20project\x20'+_0x441dd7[_0x49260e(0x229)]),console[_0x49260e(0x220)](_0x49260e(0x237)+_0x441dd7[_0x49260e(0x206)]),0x0;}}function a32_0x4c65(){const _0x5996fb=['Attempt\x20ID:\x20','name','649248AohEFb','description','✔\x20Pushed\x20','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Listing\x20workflow\x20sessions...','sessionId','session','workflow:tasks','Show\x20specific\x20attempt\x20details','837524YhOZrY','attempt','Project\x20filter:\x20','Reason:\x20','7CKyfZy','55qvYpOo','Listing\x20workflow\x20projects...','push','data','fs/promises','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','Revision:\x20','List\x20all\x20workflow\x20projects','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','\x20\x20Cause:\x20','\x20log\x20entr','Deleting\x20project\x20','length','verbose','2388OCOIjP','substring','\x20attempt','Including\x20subtasks:\x20yes','Error:\x20Attempt\x20ID\x20is\x20required','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','Task\x20name:\x20','download','✔\x20Found\x20','\x20workflow','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','\x20is\x20not\x20a\x20directory','\x20project','...','limit','328912LUouzU','fromTask','status','cause','Target:\x20','from','\x20\x20Files\x20extracted:\x20','attempt:','session:','attemptId','Error:\x20Project\x20name\x20is\x20required','workflow:delete','includeRetried','Project\x20name:\x20','List\x20workflow\x20attempts','✔\x20Downloaded\x20','126929vhbecz','params','Downloading\x20project\x20','projectId','workflow:push','logs','parse','\x22?\x20This\x20cannot\x20be\x20undone.','offset','1wXQoxw','3336280goCEfR','Listing\x20workflow\x20attempts...','Error:\x20','workflow:retry','Listing\x20workflows...','attempts','Force:\x20yes','isDirectory','delete','projects','workflow:sessions','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','Getting\x20attempt\x20tasks...','4508556CsDxaL','Project:\x20','split','Retrying\x20attempt...','Params:\x20','Status:\x20','error','includeSubtasks','workflow:download','message','Filter:\x20project=','Show\x20tasks\x20for\x20an\x20attempt','\x20\x20Revision:\x20','workflow','\x20\x20New\x20attempt\x20ID:\x20','projectName','workflow:attempts','startsWith','Cancelled','Retrying\x20session...','Resume\x20from:\x20','Validation:\x20skipped','reason','27HIRpqL','workflow:logs','yes','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','5954590moClOB','workflows','\x20\x20Project\x20ID:\x20','revision','resumeFrom','\x20\x20Session\x20ID:\x20','stat','execute','workflow:kill','utf-8','Filter:\x20','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'];a32_0x4c65=function(){return _0x5996fb;};return a32_0x4c65();}
|
package/dist/core/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x280620,_0x42820d){const _0x4992dd=a33_0x499c,_0x37b961=_0x280620();while(!![]){try{const _0x36c6b1=parseInt(_0x4992dd(0x16f))/0x1*(-parseInt(_0x4992dd(0x170))/0x2)+parseInt(_0x4992dd(0x177))/0x3*(-parseInt(_0x4992dd(0x169))/0x4)+-parseInt(_0x4992dd(0x175))/0x5*(parseInt(_0x4992dd(0x17f))/0x6)+-parseInt(_0x4992dd(0x17c))/0x7*(parseInt(_0x4992dd(0x17e))/0x8)+-parseInt(_0x4992dd(0x16d))/0x9+-parseInt(_0x4992dd(0x180))/0xa+-parseInt(_0x4992dd(0x16b))/0xb*(-parseInt(_0x4992dd(0x173))/0xc);if(_0x36c6b1===_0x42820d)break;else _0x37b961['push'](_0x37b961['shift']());}catch(_0x19c3f6){_0x37b961['push'](_0x37b961['shift']());}}}(a33_0x2efc,0x922f1));function a33_0x499c(_0x93dd61,_0x2359b1){const _0x2efc5d=a33_0x2efc();return a33_0x499c=function(_0x499c66,_0x4e2ca5){_0x499c66=_0x499c66-0x168;let _0x4d749e=_0x2efc5d[_0x499c66];return _0x4d749e;},a33_0x499c(_0x93dd61,_0x2359b1);}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 _0x5b52e3=a33_0x499c;try{const _0x4eba19=fileURLToPath(import.meta[_0x5b52e3(0x16c)]),_0x18bb53=dirname(_0x4eba19),_0x20bc1f=join(_0x18bb53,'../../package.json'),_0x2cd343=JSON[_0x5b52e3(0x17b)](readFileSync(_0x20bc1f,_0x5b52e3(0x172)));return _0x2cd343['version'];}catch{return'0.0.0';}}export function getUserAgent(){const _0x5d84f2=a33_0x499c,_0x18ace5=getVersion(),_0x51006e=platform(),_0x12c017=process[_0x5d84f2(0x179)][_0x5d84f2(0x17d)]('v','');return _0x5d84f2(0x171)+_0x18ace5+'\x20('+_0x51006e+_0x5d84f2(0x168)+_0x12c017+')';}export function getAuthHeaders(_0x5024c2,_0x245931){const _0x15e272=a33_0x499c,_0x14a841=getVersion(),_0x1ba3e3={'User-Agent':getUserAgent(),'X-TD-Client':_0x15e272(0x17a),'X-TD-Client-Version':_0x14a841};return _0x245931&&(_0x1ba3e3['Authorization']=_0x15e272(0x16a)+_0x245931),_0x1ba3e3;}function a33_0x2efc(){const _0x228a43=['82804IOgEpY','TD1\x20','628342lhWJlN','url','658089GJWosn','entries','39XGDdKz','52504gVtpbK','tdx/','utf-8','744jlenDz','length','20nNcxPe','X-Trino-User','57zeHySR','Authorization','version','tdx','parse','1777951WOMbFE','replace','24RBcrBc','204054uzyAED','5545120pacbwh',';\x20node/'];a33_0x2efc=function(){return _0x228a43;};return a33_0x2efc();}export function toHeaderRecord(_0x8db591){const _0x39e9c7=a33_0x499c,_0x90e32b={};for(const [_0x4b01a5,_0x25f822]of Object[_0x39e9c7(0x16e)](_0x8db591)){_0x25f822!==undefined&&(_0x90e32b[_0x4b01a5]=_0x25f822);}return _0x90e32b;}export function getTrinoHeaders(_0x14c2cd,_0x408741){const _0x7167aa=a33_0x499c,_0xfa2435=getAuthHeaders(_0x14c2cd,_0x408741),_0x516083=toHeaderRecord(_0xfa2435);return delete _0x516083[_0x7167aa(0x178)],_0x408741&&(_0x516083[_0x7167aa(0x176)]=_0x408741),_0x516083;}export function hasAPIKey(_0x68d8f3){const _0x49646f=a33_0x499c,_0x259909=getAPIKey(_0x68d8f3);return _0x259909!==undefined&&_0x259909[_0x49646f(0x174)]>0x0;}
|
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x23e5b1,_0x40c3e7){const _0x16f6a0=a34_0x1bcc,_0x536251=_0x23e5b1();while(!![]){try{const _0x35fa00=parseInt(_0x16f6a0(0x126))/0x1+-parseInt(_0x16f6a0(0x103))/0x2+-parseInt(_0x16f6a0(0x12f))/0x3+-parseInt(_0x16f6a0(0x122))/0x4*(parseInt(_0x16f6a0(0x129))/0x5)+-parseInt(_0x16f6a0(0x127))/0x6+-parseInt(_0x16f6a0(0x10e))/0x7*(parseInt(_0x16f6a0(0x106))/0x8)+parseInt(_0x16f6a0(0x10b))/0x9*(parseInt(_0x16f6a0(0x124))/0xa);if(_0x35fa00===_0x40c3e7)break;else _0x536251['push'](_0x536251['shift']());}catch(_0x46f54b){_0x536251['push'](_0x536251['shift']());}}}(a34_0x2a73,0xa9c89));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync}from'fs';import*as a34_0x5282d9 from'node:fs';import*as a34_0x5090dd from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';export function getConfigDir(){const _0x27c40b=a34_0x1bcc;return process[_0x27c40b(0x12e)][_0x27c40b(0x125)]||join(homedir(),_0x27c40b(0x115),_0x27c40b(0x10a));}export function getConfigFile(){const _0x407f18=a34_0x1bcc;return join(getConfigDir(),_0x407f18(0x108));}export function getCacheDir(){const _0x4cfb42=a34_0x1bcc;return process[_0x4cfb42(0x12e)]['TDX_CACHE_DIR']||join(homedir(),_0x4cfb42(0x12b),_0x4cfb42(0x10a));}export function getLLMProjectCacheFile(){const _0x2c8b48=a34_0x1bcc;return join(getCacheDir(),_0x2c8b48(0x132));}export function readCachedLLMProject(){const _0x88f579=a34_0x1bcc;try{const _0x55e839=getLLMProjectCacheFile();if(!existsSync(_0x55e839))return null;return readFileSync(_0x55e839,_0x88f579(0x121))['trim']();}catch{return null;}}export function writeCachedLLMProject(_0x39841d){const _0x2ee53e=a34_0x1bcc;try{const _0x278214=getCacheDir(),_0x18702e=getLLMProjectCacheFile();!existsSync(_0x278214)&&mkdirSync(_0x278214,{'recursive':!![]}),writeFileSync(_0x18702e,_0x39841d,'utf-8');}catch(_0x3b6691){console[_0x2ee53e(0x113)]('Warning:\x20Failed\x20to\x20cache\x20LLM\x20project\x20name:',_0x3b6691);}}export function parseEnvFile(_0x1dc166){const _0x2e8bde=a34_0x1bcc,_0x18f6a4={};for(const _0x50052e of _0x1dc166[_0x2e8bde(0x11a)]('\x0a')){const _0x8a9c26=_0x50052e['trim']();if(!_0x8a9c26||_0x8a9c26[_0x2e8bde(0x131)]('#'))continue;const _0x1e1555=_0x8a9c26['match'](/^([^=]+)=(.*)$/);if(_0x1e1555){const _0x13fdb7=_0x1e1555[0x1][_0x2e8bde(0x12d)]();let _0x3e1282=_0x1e1555[0x2][_0x2e8bde(0x12d)]();(_0x3e1282[_0x2e8bde(0x131)]('\x22')&&_0x3e1282[_0x2e8bde(0x120)]('\x22')||_0x3e1282[_0x2e8bde(0x131)]('\x27')&&_0x3e1282[_0x2e8bde(0x120)]('\x27'))&&(_0x3e1282=_0x3e1282[_0x2e8bde(0x102)](0x1,-0x1)),_0x18f6a4[_0x13fdb7]=_0x3e1282;}}return _0x18f6a4;}export function readUserConfig(){const _0x383f5f=a34_0x1bcc,_0x41376b=getConfigFile();if(!existsSync(_0x41376b))return{};try{const _0x1d8e14=readFileSync(_0x41376b,'utf-8');return parseEnvFile(_0x1d8e14);}catch(_0xc69d74){return console[_0x383f5f(0x107)](_0x383f5f(0x12c)+_0x41376b+':',_0xc69d74),{};}}function a34_0x2a73(){const _0x3f8ce6=['ap02','dev-us01','parse','profile:\x20','existsSync','env:\x20','map','slice','2432366DgzbHI','TD_API_KEY_','\x20(TD_API_KEY)','8GzuNHs','warn','.env','stg-ap03','tdx','19615563Zxtxjo','stg-us01','us01','622755MbTYWZ','readFileSync','entries','Warning:\x20Unknown\x20site\x20\x27','apiKeys','error','ap03','.config','\x27,\x20defaulting\x20to\x20us01','eu01','join','stg-jp01','split','Warning:\x20Failed\x20to\x20load\x20','replace','jp01','includes','dev-eu01','endsWith','utf-8','618200mJhuZJ','global:\x20','10joMnmQ','TDX_CONFIG_DIR','1323140oRqXxH','2917212ArDPDf','toUpperCase','5GoTMeH','TD_API_KEY','.cache','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','trim','env','2583942mYQFXK','profiles','startsWith','llm_default_project'];a34_0x2a73=function(){return _0x3f8ce6;};return a34_0x2a73();}export function resolveSite(_0x1f5482){const _0x5cf6e0=a34_0x1bcc,_0x538e23=[_0x5cf6e0(0x10d),_0x5cf6e0(0x11d),_0x5cf6e0(0x117),_0x5cf6e0(0xfb),_0x5cf6e0(0x114),_0x5cf6e0(0xfc),_0x5cf6e0(0x11f),'stg-us01',_0x5cf6e0(0x119),'stg-ap03'];if(_0x538e23[_0x5cf6e0(0x11e)](_0x1f5482))return _0x1f5482;if(_0x1f5482 in SITE_ALIASES)return SITE_ALIASES[_0x1f5482];return console[_0x5cf6e0(0x107)](_0x5cf6e0(0x111)+_0x1f5482+_0x5cf6e0(0x116)),_0x5cf6e0(0x10d);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x4b83a6,_0x98050c){const _0x3f32b8=a34_0x1bcc,_0x56fd17=_0x4b83a6[_0x3f32b8(0x128)]()[_0x3f32b8(0x11c)](/-/g,'_'),_0x46de1a=_0x3f32b8(0x104)+_0x56fd17;if(process[_0x3f32b8(0x12e)][_0x46de1a])return process[_0x3f32b8(0x12e)][_0x46de1a];if(process['env'][_0x3f32b8(0x12a)])return process['env'][_0x3f32b8(0x12a)];const _0x52c0a0=_0x98050c||getActiveProfileName();if(_0x52c0a0){const _0x4fda57=loadProfileEnv(_0x52c0a0);if(_0x4fda57){if(_0x4fda57[_0x46de1a])return _0x4fda57[_0x46de1a];if(_0x4fda57['TD_API_KEY'])return _0x4fda57[_0x3f32b8(0x12a)];}}const _0x2c57b1=loadUserConfigOnce();if(_0x2c57b1[_0x46de1a])return _0x2c57b1[_0x46de1a];if(_0x2c57b1[_0x3f32b8(0x12a)])return _0x2c57b1[_0x3f32b8(0x12a)];return undefined;}function a34_0x1bcc(_0x5bf21d,_0x2af37f){const _0x2a7335=a34_0x2a73();return a34_0x1bcc=function(_0x1bcca1,_0x5427e3){_0x1bcca1=_0x1bcca1-0xfb;let _0x20df3b=_0x2a7335[_0x1bcca1];return _0x20df3b;},a34_0x1bcc(_0x5bf21d,_0x2af37f);}export function getAPIKeySource(_0x409d2c,_0x34b8c9){const _0x44f9bf=a34_0x1bcc,_0x149ea6=_0x44f9bf(0x104)+_0x409d2c[_0x44f9bf(0x128)]()[_0x44f9bf(0x11c)](/-/g,'_');if(process[_0x44f9bf(0x12e)][_0x149ea6])return _0x44f9bf(0x100)+_0x149ea6;if(process[_0x44f9bf(0x12e)][_0x44f9bf(0x12a)])return'env:\x20TD_API_KEY';const _0x272193=_0x34b8c9||getActiveProfileName();if(_0x272193){const _0x5536b2=loadProfileEnv(_0x272193);if(_0x5536b2){if(_0x5536b2[_0x149ea6])return _0x44f9bf(0xfe)+_0x272193+'\x20('+_0x149ea6+')';if(_0x5536b2['TD_API_KEY'])return _0x44f9bf(0xfe)+_0x272193+_0x44f9bf(0x105);}}const _0xaa111a=loadUserConfigOnce(),_0x39c073=getConfigFile();if(_0xaa111a[_0x149ea6])return _0x44f9bf(0x123)+_0x39c073+'\x20('+_0x149ea6+')';if(_0xaa111a[_0x44f9bf(0x12a)])return'global:\x20'+_0x39c073+_0x44f9bf(0x105);return null;}function loadProfileEnv(_0x496bd6){const _0x48eaee=a34_0x1bcc,_0x2621b3=a34_0x5090dd['join'](getConfigDir(),'.env.'+_0x496bd6);if(a34_0x5282d9['existsSync'](_0x2621b3)){validateSecureFilePermissions(_0x2621b3);try{const _0x1141e3=a34_0x5282d9['readFileSync'](_0x2621b3,_0x48eaee(0x121));return parseEnvFile(_0x1141e3);}catch(_0x58b362){console[_0x48eaee(0x107)]('Warning:\x20Failed\x20to\x20load\x20'+_0x2621b3+':\x20'+_0x58b362);}}const _0x4f0e2b=a34_0x5090dd[_0x48eaee(0x118)](getConfigDir(),_0x48eaee(0x130),_0x496bd6,_0x48eaee(0x108));if(a34_0x5282d9[_0x48eaee(0xff)](_0x4f0e2b)){validateSecureFilePermissions(_0x4f0e2b);try{const _0x284c22=a34_0x5282d9[_0x48eaee(0x10f)](_0x4f0e2b,'utf-8');return parseEnvFile(_0x284c22);}catch(_0x52722c){return console['warn'](_0x48eaee(0x11b)+_0x4f0e2b+':\x20'+_0x52722c),null;}}return null;}function getActiveProfileName(){const _0x5a281a=a34_0x1bcc,_0x2fd4be=a34_0x5090dd['join'](getConfigDir(),'tdx.json');if(!a34_0x5282d9[_0x5a281a(0xff)](_0x2fd4be))return null;try{const _0x315078=a34_0x5282d9[_0x5a281a(0x10f)](_0x2fd4be,_0x5a281a(0x121)),_0x406315=JSON[_0x5a281a(0xfd)](_0x315078);return _0x406315['profile']||null;}catch{return null;}}export function saveAPIKey(_0x2ca070,_0x35cf41){const _0x26e813=a34_0x1bcc,_0x46f383=getConfigDir(),_0x12b496=getConfigFile();!existsSync(_0x46f383)&&mkdirSync(_0x46f383,{'recursive':!![],'mode':0x1c0});const _0x2b2d42=readUserConfig(),_0x3c0c50=_0x2ca070[_0x26e813(0x128)]()['replace'](/-/g,'_');_0x2b2d42[_0x26e813(0x104)+_0x3c0c50]=_0x35cf41;const _0x50ed43=Object[_0x26e813(0x110)](_0x2b2d42)[_0x26e813(0x101)](([_0x45c10e,_0x2bcc06])=>_0x45c10e+'='+_0x2bcc06);writeFileSync(_0x12b496,_0x50ed43[_0x26e813(0x118)]('\x0a')+'\x0a',{'mode':0x180});}export function loadConfig(){const _0x8ec9fe=a34_0x1bcc,_0x18cd6f={'apiKeys':{},'defaultSite':_0x8ec9fe(0x10d)},_0x4852b1=[_0x8ec9fe(0x10d),_0x8ec9fe(0x11d),_0x8ec9fe(0x117),_0x8ec9fe(0xfb),_0x8ec9fe(0x114),'dev-us01','dev-eu01',_0x8ec9fe(0x10c),_0x8ec9fe(0x119),_0x8ec9fe(0x109)];for(const _0x476d15 of _0x4852b1){const _0x3dd6e8=getAPIKey(_0x476d15);_0x3dd6e8&&(_0x18cd6f[_0x8ec9fe(0x112)][_0x476d15]=_0x3dd6e8);}return _0x18cd6f;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a35_0x29a16e=a35_0x191b;function a35_0x5368(){const _0x13ad62=['string','getParameters',':\x20none\x20(using\x20session:\x20','111PGwqEK','existsSync','profiles','6nBAUYy','32ndvpvn','join','globalCredentials','log','4938FdoRUE','activeProfile','4540851aPHwSl','database','.env','us01','displayWithSources','12rWhUtw','11cchvII','sessionId','display','configFiles','cliFlags','segmentPath','[context]','global','layers','profile',':\x20none','parentSegment','2251767ZOrLLK','Global','20HUkUiA','parent_segment','CLI\x20flag:\x20--','565112fJexIE','verbose','Profile','entries','llmProject','sessions','site','Session','ppid','.json','project','default','config','loadGlobalConfig','Project','segment_path','parse','not\x20set','replace','tdx.json','profile:\x20','(session:\x20','session','1355355CuIIwv','llm_project','injectIntoOptions','10611530lnEPdx','apiKey','7681167ODUQRn','getSource','Profile\x20Credentials','utf-8'];a35_0x5368=function(){return _0x13ad62;};return a35_0x5368();}(function(_0x4f2271,_0x4b8ab8){const _0x4b4ae5=a35_0x191b,_0x1adf20=_0x4f2271();while(!![]){try{const _0x4a7b5a=-parseInt(_0x4b4ae5(0x124))/0x1*(-parseInt(_0x4b4ae5(0x12c))/0x2)+-parseInt(_0x4b4ae5(0xfc))/0x3+parseInt(_0x4b4ae5(0x101))/0x4*(-parseInt(_0x4b4ae5(0xfe))/0x5)+-parseInt(_0x4b4ae5(0x127))/0x6*(-parseInt(_0x4b4ae5(0x12e))/0x7)+parseInt(_0x4b4ae5(0x128))/0x8*(parseInt(_0x4b4ae5(0x118))/0x9)+-parseInt(_0x4b4ae5(0x11b))/0xa*(-parseInt(_0x4b4ae5(0xf0))/0xb)+parseInt(_0x4b4ae5(0xef))/0xc*(-parseInt(_0x4b4ae5(0x11d))/0xd);if(_0x4a7b5a===_0x4b8ab8)break;else _0x1adf20['push'](_0x1adf20['shift']());}catch(_0x4b494f){_0x1adf20['push'](_0x1adf20['shift']());}}}(a35_0x5368,0xa5f2d));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 a35_0x28afff from'node:fs';function a35_0x191b(_0x40bc0f,_0xb23ba8){const _0x53686b=a35_0x5368();return a35_0x191b=function(_0x191b6,_0x3d5b5f){_0x191b6=_0x191b6-0xee;let _0x2c4190=_0x53686b[_0x191b6];return _0x2c4190;},a35_0x191b(_0x40bc0f,_0xb23ba8);}import*as a35_0x47ce12 from'node:path';export class GlobalContext{[a35_0x29a16e(0x107)];[a35_0x29a16e(0x12f)];[a35_0x29a16e(0xff)];[a35_0x29a16e(0x110)];[a35_0x29a16e(0x119)];[a35_0x29a16e(0x11c)];[a35_0x29a16e(0x102)];[a35_0x29a16e(0xf8)];[a35_0x29a16e(0x12d)];[a35_0x29a16e(0xf1)];[a35_0x29a16e(0xf3)];constructor(_0x238b74){const _0x94fe50=a35_0x29a16e;this[_0x94fe50(0xf1)]=_0x238b74[_0x94fe50(0x117)]||process[_0x94fe50(0x109)]['toString']();const _0x31baf5=loadSessionContext(_0x238b74['session']),_0x6b7ca7=loadProjectConfig(),_0x456cdb=this[_0x94fe50(0x10e)]();this['activeProfile']=_0x238b74['profile']||_0x31baf5?.['profile']||_0x456cdb[_0x94fe50(0xf9)]||getActiveProfile();const _0x18cbb8=this[_0x94fe50(0x12d)]?loadProfile(this['activeProfile']):null,_0x3ce77b=_0x3b803b=>{const _0x40f686=_0x94fe50;if(!_0x3b803b)return{};const _0xb75c00=_0x3b803b,_0x49f1c0={};for(const [_0x4ccaca,_0x51582b]of Object[_0x40f686(0x104)](_0xb75c00)){typeof _0x51582b===_0x40f686(0x121)&&(_0x49f1c0[_0x4ccaca]=_0x51582b);}return _0x49f1c0;},_0x374437={};if(_0x238b74[_0x94fe50(0x107)]&&_0x238b74[_0x94fe50(0x107)]!==_0x94fe50(0x131))_0x374437['site']=_0x238b74[_0x94fe50(0x107)];const _0x41bd2c=_0x31baf5?.['database'],_0x337553=_0x6b7ca7?.[_0x94fe50(0x12f)],_0x37493b=_0x18cbb8?.[_0x94fe50(0x10d)]?.[_0x94fe50(0x12f)],_0x1be197=_0x456cdb[_0x94fe50(0x12f)];_0x238b74['database']&&(_0x238b74[_0x94fe50(0x12f)]!==_0x41bd2c&&_0x238b74['database']!==_0x337553&&_0x238b74[_0x94fe50(0x12f)]!==_0x37493b&&_0x238b74[_0x94fe50(0x12f)]!==_0x1be197)&&(_0x374437[_0x94fe50(0x12f)]=_0x238b74[_0x94fe50(0x12f)]);if(_0x238b74['parentSegment'])_0x374437[_0x94fe50(0xff)]=_0x238b74['parentSegment'];if(_0x238b74[_0x94fe50(0x105)])_0x374437[_0x94fe50(0x119)]=_0x238b74[_0x94fe50(0x105)];if(_0x238b74[_0x94fe50(0xf9)])_0x374437[_0x94fe50(0xf9)]=_0x238b74[_0x94fe50(0xf9)];this[_0x94fe50(0xf8)]={'cliFlags':_0x374437,'session':_0x3ce77b(_0x31baf5),'project':_0x3ce77b(_0x6b7ca7),'profile':_0x3ce77b(_0x18cbb8?.[_0x94fe50(0x10d)]),'global':_0x3ce77b(_0x456cdb)};const _0x123f11={...this[_0x94fe50(0xf8)][_0x94fe50(0xf7)],...this[_0x94fe50(0xf8)][_0x94fe50(0xf9)],...this[_0x94fe50(0xf8)]['project'],...this[_0x94fe50(0xf8)][_0x94fe50(0x117)],...this['layers'][_0x94fe50(0xf4)]},_0xca071d=_0x123f11[_0x94fe50(0x107)]||_0x94fe50(0x131);this[_0x94fe50(0x107)]=resolveSite(_0xca071d),this[_0x94fe50(0x12f)]=_0x123f11[_0x94fe50(0x12f)],this[_0x94fe50(0xff)]=_0x123f11['parent_segment'],this[_0x94fe50(0x110)]=_0x123f11[_0x94fe50(0x110)],this[_0x94fe50(0x119)]=_0x123f11[_0x94fe50(0x119)],this['verbose']=_0x238b74[_0x94fe50(0x102)]||![],this['apiKey']=getAPIKey(this[_0x94fe50(0x107)],this['activeProfile']||undefined);const _0xde2d88=getConfigDir(),_0x3ab6ab=a35_0x47ce12['join'](_0xde2d88,_0x94fe50(0x106),this[_0x94fe50(0xf1)]+_0x94fe50(0x10a)),_0x2487ec=findProjectConfigPath(),_0x5acc3c=a35_0x47ce12[_0x94fe50(0x129)](_0xde2d88,_0x94fe50(0x114)),_0xaf0c0b=a35_0x47ce12[_0x94fe50(0x129)](_0xde2d88,_0x94fe50(0x130));let _0x3ee6b2=null,_0xc4d0e2=null;this['activeProfile']&&(_0x3ee6b2=a35_0x47ce12[_0x94fe50(0x129)](_0xde2d88,'profiles',this[_0x94fe50(0x12d)],_0x94fe50(0x114)),_0xc4d0e2=a35_0x47ce12['join'](_0xde2d88,_0x94fe50(0x126),this[_0x94fe50(0x12d)],_0x94fe50(0x130))),this[_0x94fe50(0xf3)]={'session':a35_0x28afff['existsSync'](_0x3ab6ab)?_0x3ab6ab:null,'project':_0x2487ec,'profile':_0x3ee6b2&&a35_0x28afff['existsSync'](_0x3ee6b2)?_0x3ee6b2:null,'profileCredentials':_0xc4d0e2&&a35_0x28afff['existsSync'](_0xc4d0e2)?_0xc4d0e2:null,'global':a35_0x28afff[_0x94fe50(0x125)](_0x5acc3c)?_0x5acc3c:null,'globalCredentials':a35_0x28afff[_0x94fe50(0x125)](_0xaf0c0b)?_0xaf0c0b:null};}[a35_0x29a16e(0x11e)](_0x8e0576,_0x42d0b2){const _0x2a86c6=a35_0x29a16e;if(!_0x42d0b2)return _0x2a86c6(0x112);const _0x31a716=_0x42d0b2;if(this[_0x2a86c6(0xf8)][_0x2a86c6(0xf4)][_0x8e0576]===_0x31a716){if(_0x8e0576===_0x2a86c6(0x107)&&_0x31a716===_0x2a86c6(0x131)&&!this[_0x2a86c6(0xf8)][_0x2a86c6(0x117)]['site']&&!this['layers'][_0x2a86c6(0x10b)]['site']&&!this['layers']['profile'][_0x2a86c6(0x107)]&&!this[_0x2a86c6(0xf8)][_0x2a86c6(0xf7)]['site'])return'default';return _0x2a86c6(0x100)+_0x8e0576[_0x2a86c6(0x113)](/_/g,'-');}if(this['layers']['session'][_0x8e0576]===_0x31a716)return _0x2a86c6(0x117);if(this[_0x2a86c6(0xf8)]['project'][_0x8e0576]===_0x31a716)return _0x2a86c6(0x10b);if(this['layers']['profile'][_0x8e0576]===_0x31a716)return _0x2a86c6(0x115)+this[_0x2a86c6(0x12d)];if(this[_0x2a86c6(0xf8)][_0x2a86c6(0xf7)][_0x8e0576]===_0x31a716)return _0x2a86c6(0xf7);return _0x2a86c6(0x10c);}[a35_0x29a16e(0x10e)](){const _0x44521c=a35_0x29a16e,_0x5a2026=a35_0x47ce12[_0x44521c(0x129)](getConfigDir(),_0x44521c(0x114));if(!a35_0x28afff['existsSync'](_0x5a2026))return{};try{const _0x357b0d=a35_0x28afff['readFileSync'](_0x5a2026,_0x44521c(0x120));return JSON[_0x44521c(0x111)](_0x357b0d);}catch{return{};}}[a35_0x29a16e(0x11a)](_0x26405f){const _0x185882=a35_0x29a16e;_0x26405f[_0x185882(0x107)]=this[_0x185882(0x107)],!_0x26405f[_0x185882(0x12f)]&&this['database']&&(_0x26405f['database']=this[_0x185882(0x12f)]),!_0x26405f[_0x185882(0xfb)]&&this[_0x185882(0xff)]&&(_0x26405f['parentSegment']=this[_0x185882(0xff)]),!_0x26405f[_0x185882(0xf5)]&&this[_0x185882(0x110)]&&(_0x26405f[_0x185882(0xf5)]=this[_0x185882(0x110)]),!_0x26405f[_0x185882(0x105)]&&this[_0x185882(0x119)]&&(_0x26405f[_0x185882(0x105)]=this[_0x185882(0x119)]);}[a35_0x29a16e(0x122)](){const _0x2de3f2=a35_0x29a16e;return[{'key':_0x2de3f2(0x107),'value':this[_0x2de3f2(0x107)]},{'key':_0x2de3f2(0x12f),'value':this['database']},{'key':'parent_segment','value':this['parent_segment']},{'key':'segment_path','value':this[_0x2de3f2(0x110)]},{'key':'llm_project','value':this[_0x2de3f2(0x119)]},{'key':_0x2de3f2(0xf9),'value':this[_0x2de3f2(0x12d)]||undefined}];}[a35_0x29a16e(0xf2)](){const _0x4bc0db=a35_0x29a16e;console[_0x4bc0db(0x12b)](_0x4bc0db(0xf6));for(const {key:_0x316ae3,value:_0x286d55}of this['getParameters']()){_0x286d55&&console[_0x4bc0db(0x12b)](_0x316ae3+':\x20'+_0x286d55);}}[a35_0x29a16e(0xee)](){const _0xe0f763=a35_0x29a16e;console['log'](_0xe0f763(0xf6));for(const {key:_0x2775fc,value:_0x310078}of this[_0xe0f763(0x122)]()){if(_0x310078){const _0xc4e20b=_0x2775fc===_0xe0f763(0xf9)?'(active)':'('+this[_0xe0f763(0x11e)](_0x2775fc,_0x310078)+')';console[_0xe0f763(0x12b)](_0x2775fc+':\x20'+_0x310078+'\x20'+_0xc4e20b);}}console[_0xe0f763(0x12b)]('\x0a[configuration\x20files]');const _0x37948c=[{'label':'Session','path':this[_0xe0f763(0xf3)][_0xe0f763(0x117)],'extra':_0xe0f763(0x116)+this['sessionId']+')'},{'label':_0xe0f763(0x10f),'path':this[_0xe0f763(0xf3)][_0xe0f763(0x10b)]},{'label':_0xe0f763(0x103),'path':this['configFiles'][_0xe0f763(0xf9)]},{'label':_0xe0f763(0x11f),'path':this[_0xe0f763(0xf3)]['profileCredentials']},{'label':_0xe0f763(0xfd),'path':this[_0xe0f763(0xf3)][_0xe0f763(0xf7)]},{'label':'Global\x20Credentials','path':this['configFiles'][_0xe0f763(0x12a)]}];for(const {label:_0x41b3d7,path:_0x135e07,extra:_0x351972}of _0x37948c){if(_0x135e07)console[_0xe0f763(0x12b)](_0x41b3d7+':\x20'+_0x135e07+'\x20✓'+(_0x351972?'\x20'+_0x351972:''));else{if(_0x41b3d7===_0xe0f763(0x108))console['log'](_0x41b3d7+_0xe0f763(0x123)+this['sessionId']+')');else(_0x41b3d7==='Project'||_0x41b3d7==='Global')&&console[_0xe0f763(0x12b)](_0x41b3d7+_0xe0f763(0xfa));}}}}
|
package/dist/core/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0xa63abf,_0x2e5b18){const _0xc32a61=a36_0x5e8a,_0x5633ac=_0xa63abf();while(!![]){try{const _0x45285c=parseInt(_0xc32a61(0x1ae))/0x1*(-parseInt(_0xc32a61(0x1a3))/0x2)+parseInt(_0xc32a61(0x1e7))/0x3+parseInt(_0xc32a61(0x1d1))/0x4+-parseInt(_0xc32a61(0x1d7))/0x5*(parseInt(_0xc32a61(0x1a2))/0x6)+-parseInt(_0xc32a61(0x1b9))/0x7*(parseInt(_0xc32a61(0x1c9))/0x8)+-parseInt(_0xc32a61(0x1c6))/0x9+parseInt(_0xc32a61(0x1c4))/0xa;if(_0x45285c===_0x2e5b18)break;else _0x5633ac['push'](_0x5633ac['shift']());}catch(_0x3f71d6){_0x5633ac['push'](_0x5633ac['shift']());}}}(a36_0x284a,0xa8010));import*as a36_0x42b385 from'node:fs';import*as a36_0x246f57 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(_0x54f78b){const _0x3a2bab=a36_0x5e8a,_0x25b416={};if(!_0x54f78b)return _0x25b416;for(const [_0x1be855,_0x3e42a3]of Object[_0x3a2bab(0x1a9)](_0x54f78b)){_0x1be855!==_0x3a2bab(0x1b0)&&_0x3e42a3!==undefined&&(_0x25b416[_0x1be855]=_0x3e42a3);}return _0x25b416;}export function getProfilesDir(){const _0x30ccae=a36_0x5e8a;return a36_0x246f57[_0x30ccae(0x19f)](getConfigDir(),_0x30ccae(0x1a0));}function getProfileDir(_0x5a624f){const _0xb754be=a36_0x5e8a;return a36_0x246f57[_0xb754be(0x19f)](getProfilesDir(),_0x5a624f);}function getProfileConfigPath(_0x5374de){return a36_0x246f57['join'](getProfileDir(_0x5374de),'tdx.json');}function getProfileEnvPath(_0x4dafd4){return a36_0x246f57['join'](getProfileDir(_0x4dafd4),'.env');}function getGlobalConfigPath(){const _0x341913=a36_0x5e8a;return a36_0x246f57['join'](getConfigDir(),_0x341913(0x1da));}function validateProfileName(_0x4319ce){const _0x48af9d=a36_0x5e8a;if(!/^[a-zA-Z0-9_-]+$/[_0x48af9d(0x1cb)](_0x4319ce))throw new Error(_0x48af9d(0x1a1)+_0x4319ce+_0x48af9d(0x1ca));}function validateProfileConfig(_0x16ae87,_0x4a179b){const _0x13bb07=a36_0x5e8a;if(typeof _0x16ae87!=='object'||_0x16ae87===null)throw new Error('Profile\x20\x27'+_0x4a179b+_0x13bb07(0x1bc));const _0x4763be=[_0x13bb07(0x1b0),_0x13bb07(0x1ec),'database',_0x13bb07(0x1dc),_0x13bb07(0x1d4),_0x13bb07(0x1d3)],_0x41f41b=_0x16ae87;for(const _0x150a59 of Object[_0x13bb07(0x1b6)](_0x41f41b)){!_0x4763be[_0x13bb07(0x1d9)](_0x150a59)&&console[_0x13bb07(0x1cf)](_0x13bb07(0x1cd)+_0x4a179b+_0x13bb07(0x1e1)+_0x150a59+_0x13bb07(0x1b8));}if(_0x41f41b[_0x13bb07(0x1b0)]!==undefined&&typeof _0x41f41b[_0x13bb07(0x1b0)]!=='string')throw new Error(_0x13bb07(0x1be)+_0x4a179b+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x41f41b['site']!==undefined&&typeof _0x41f41b['site']!==_0x13bb07(0x1bb))throw new Error(_0x13bb07(0x1be)+_0x4a179b+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x41f41b[_0x13bb07(0x1a4)]!==undefined&&typeof _0x41f41b[_0x13bb07(0x1a4)]!==_0x13bb07(0x1bb))throw new Error(_0x13bb07(0x1be)+_0x4a179b+_0x13bb07(0x19d));if(_0x41f41b[_0x13bb07(0x1dc)]!==undefined&&typeof _0x41f41b[_0x13bb07(0x1dc)]!==_0x13bb07(0x1bb))throw new Error(_0x13bb07(0x1be)+_0x4a179b+_0x13bb07(0x1ce));if(_0x41f41b[_0x13bb07(0x1d4)]!==undefined&&typeof _0x41f41b['llm_project']!==_0x13bb07(0x1bb))throw new Error(_0x13bb07(0x1be)+_0x4a179b+'\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string');if(_0x41f41b[_0x13bb07(0x1d3)]!==undefined&&typeof _0x41f41b[_0x13bb07(0x1d3)]!=='string')throw new Error(_0x13bb07(0x1be)+_0x4a179b+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x27592a,_0x5783f9){const _0x16578f=a36_0x5e8a;if(!a36_0x42b385[_0x16578f(0x1b4)](_0x27592a))return[];try{const _0x3ef8d5=a36_0x42b385['readFileSync'](_0x27592a,_0x16578f(0x1ac)),_0x321a5a=JSON['parse'](_0x3ef8d5);if(!_0x321a5a['profiles']||typeof _0x321a5a[_0x16578f(0x1a0)]!==_0x16578f(0x1d5))return[];const _0x1406e8=[];for(const [_0x307e60,_0x19e4e2]of Object[_0x16578f(0x1a9)](_0x321a5a['profiles'])){try{validateProfileConfig(_0x19e4e2,_0x307e60);const _0x14b50e=getNewCredentialPath(_0x307e60),_0x9b7176=getOldCredentialPath(_0x307e60),_0x4defad=a36_0x42b385[_0x16578f(0x1b4)](_0x14b50e)||a36_0x42b385[_0x16578f(0x1b4)](_0x9b7176);_0x1406e8[_0x16578f(0x1d0)]({'name':_0x307e60,'config':_0x19e4e2,'metadata':{'name':_0x307e60,'createdAt':new Date()[_0x16578f(0x1af)]()},'hasCredentials':_0x4defad,'scope':_0x5783f9});}catch(_0x1bf44b){_0x1bf44b instanceof Error&&(console[_0x16578f(0x1cf)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x27592a+':'),console[_0x16578f(0x1cf)]('\x20\x20'+_0x1bf44b[_0x16578f(0x1bf)]+'\x0a'));}}return _0x1406e8;}catch(_0x4d6106){return _0x4d6106 instanceof SyntaxError?(console[_0x16578f(0x1cf)](_0x16578f(0x1c7)+_0x27592a+_0x16578f(0x1e2)),console[_0x16578f(0x1cf)](_0x16578f(0x1a6)+_0x4d6106['message']+'\x0a')):console[_0x16578f(0x1cf)](_0x16578f(0x1ad)+_0x27592a+':\x20'+_0x4d6106+'\x0a'),[];}}export function getNewCredentialPath(_0x3ce38c){const _0x4dc38d=a36_0x5e8a;return a36_0x246f57[_0x4dc38d(0x19f)](getConfigDir(),_0x4dc38d(0x1e9)+_0x3ce38c);}function getOldCredentialPath(_0x22ce4e){const _0x6f6a0d=a36_0x5e8a;return a36_0x246f57[_0x6f6a0d(0x19f)](getProfilesDir(),_0x22ce4e,'.env');}function loadProfilesFromTdxJsonFiles(){const _0x36bac0=a36_0x5e8a,_0x1d7567=[],_0x1b7d7a=findProjectConfigPath();_0x1b7d7a&&_0x1d7567['push'](...loadProfilesFromTdxJson(_0x1b7d7a,_0x36bac0(0x1b1)));const _0x34e603=a36_0x246f57[_0x36bac0(0x19f)](getConfigDir(),_0x36bac0(0x1da));return _0x1d7567[_0x36bac0(0x1d0)](...loadProfilesFromTdxJson(_0x34e603,_0x36bac0(0x1e4))),_0x1d7567;}function loadProfilesFromDirectories(){const _0x2c4cb4=a36_0x5e8a,_0x4900e7=getProfilesDir();if(!a36_0x42b385['existsSync'](_0x4900e7))return[];try{return a36_0x42b385[_0x2c4cb4(0x1df)](_0x4900e7,{'withFileTypes':!![]})[_0x2c4cb4(0x1b2)](_0x188cfe=>_0x188cfe['isDirectory']())[_0x2c4cb4(0x1d6)](_0x43e8ab=>_0x43e8ab[_0x2c4cb4(0x1a5)])['filter'](_0x46527b=>{const _0x205a5d=_0x2c4cb4,_0x20ef9b=getProfileConfigPath(_0x46527b),_0x170249=getProfileEnvPath(_0x46527b);return a36_0x42b385['existsSync'](_0x20ef9b)||a36_0x42b385[_0x205a5d(0x1b4)](_0x170249);})[_0x2c4cb4(0x1d6)](_0xb683af=>{const _0x32e8e7=loadProfileFromDirectory(_0xb683af);if(_0x32e8e7)return{..._0x32e8e7,'scope':'directory'};return null;})[_0x2c4cb4(0x1b2)](_0x272053=>_0x272053!==null);}catch{return[];}}function loadProfileFromDirectory(_0x3c9147){const _0x1449ad=a36_0x5e8a,_0x136d44=getProfileConfigPath(_0x3c9147),_0x226fe5=getOldCredentialPath(_0x3c9147);if(!a36_0x42b385[_0x1449ad(0x1b4)](_0x136d44)&&!a36_0x42b385['existsSync'](_0x226fe5))return null;let _0x3d4a10={},_0x81de0b={'name':_0x3c9147,'createdAt':new Date()[_0x1449ad(0x1af)]()};if(a36_0x42b385['existsSync'](_0x136d44))try{const _0x21e418=a36_0x42b385[_0x1449ad(0x1e0)](_0x136d44,_0x1449ad(0x1ac)),_0x4eb82b=JSON[_0x1449ad(0x1eb)](_0x21e418),{metadata:_0x399791,..._0x3e0145}=_0x4eb82b;_0x3d4a10=_0x3e0145,_0x399791&&(_0x81de0b=_0x399791);}catch{}return{'name':_0x3c9147,'config':_0x3d4a10,'metadata':_0x81de0b,'hasCredentials':a36_0x42b385['existsSync'](_0x226fe5),'scope':_0x1449ad(0x1dd)};}export function listProfiles(){const _0x1d1297=a36_0x5e8a,_0x483089=loadProfilesFromTdxJsonFiles(),_0x1c781b=loadProfilesFromDirectories();if(_0x1c781b[_0x1d1297(0x1b5)]>0x0){const _0x206241=_0x1c781b['map'](_0x2ba67e=>_0x2ba67e['name'])['join'](',\x20'),_0x167a8f=getConfigDir();console[_0x1d1297(0x1cf)](_0x1d1297(0x1cc)+_0x206241),console[_0x1d1297(0x1cf)](_0x1d1297(0x1d2)),console[_0x1d1297(0x1cf)]('\x20\x201.\x20Edit:\x20'+a36_0x246f57[_0x1d1297(0x19f)](_0x167a8f,_0x1d1297(0x1da))),console[_0x1d1297(0x1cf)]('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console[_0x1d1297(0x1cf)](_0x1d1297(0x1c5));}const _0x355216=[..._0x483089,..._0x1c781b],_0x106ae2=new Map();for(const _0x1a469a of _0x355216){!_0x106ae2[_0x1d1297(0x1bd)](_0x1a469a[_0x1d1297(0x1a5)])&&_0x106ae2[_0x1d1297(0x19c)](_0x1a469a[_0x1d1297(0x1a5)],_0x1a469a);}return Array[_0x1d1297(0x1e3)](_0x106ae2[_0x1d1297(0x1ba)]())[_0x1d1297(0x1c8)]((_0x3c15f9,_0x3e374f)=>_0x3c15f9[_0x1d1297(0x1a5)][_0x1d1297(0x1ea)](_0x3e374f[_0x1d1297(0x1a5)]));}function a36_0x5e8a(_0x22fede,_0x16bddf){const _0x284a88=a36_0x284a();return a36_0x5e8a=function(_0x5e8a40,_0x2f8c89){_0x5e8a40=_0x5e8a40-0x19c;let _0x2bc3d7=_0x284a88[_0x5e8a40];return _0x2bc3d7;},a36_0x5e8a(_0x22fede,_0x16bddf);}export function profileExists(_0x512c03){const _0x303b69=a36_0x5e8a,_0x2ce8ef=listProfiles();return _0x2ce8ef[_0x303b69(0x1e6)](_0x2359a5=>_0x2359a5[_0x303b69(0x1a5)]===_0x512c03);}export function loadProfile(_0x2f54a8){const _0x589d4e=a36_0x5e8a;validateProfileName(_0x2f54a8);const _0x21eb00=listProfiles(),_0x453f59=_0x21eb00[_0x589d4e(0x1c0)](_0x16333e=>_0x16333e[_0x589d4e(0x1a5)]===_0x2f54a8);return _0x453f59||null;}function a36_0x284a(){const _0x41d5c0=['Profile\x20\x27','message','find','\x20already\x20exists','rmSync','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','20237640wITsjN','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','2977011qqJuGi','\x0aWarning:\x20Failed\x20to\x20parse\x20','sort','32wRSQnH','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','test','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','Warning:\x20Profile\x20\x27','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','warn','push','5309648UhcejF','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','llm_agent','llm_project','object','map','1465mqEytP','\x22\x20\x22','includes','tdx.json','stringify','parent_segment','directory','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','readdirSync','readFileSync','\x27:\x20unknown\x20config\x20key\x20\x27',':\x20Invalid\x20JSON\x20syntax','from','user','metadata','some','2207463BIGYBF','To\x20migrate:','.env.','localeCompare','parse','site','set','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20profile\x20configuration.\x20Use\x20.env\x20file\x20instead.','join','profiles','Invalid\x20profile\x20name:\x20','27366LqwWlS','2iZeazj','database','name','Error:\x20','apiKey','\x20\x20mv\x20\x22','entries','api_key','TD_API_KEY','utf-8','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','887033ybeNdR','toISOString','description','local','filter','lastUsed','existsSync','length','keys','Profile\x20','\x27\x20will\x20be\x20ignored','1478169JTwoHg','values','string','\x27:\x20config\x20must\x20be\x20an\x20object','has'];a36_0x284a=function(){return _0x41d5c0;};return a36_0x284a();}export function saveProfile(_0x40fecb,_0x5434ae,_0x2bc2bf=![]){const _0x45cfb3=a36_0x5e8a;validateProfileName(_0x40fecb);const _0x17eb14=getProfileDir(_0x40fecb),_0x2e06f7=getProfileConfigPath(_0x40fecb);createSecureDirectory(_0x17eb14);let _0x43ecc3;const _0x3bedd8=loadProfile(_0x40fecb);_0x3bedd8?(_0x43ecc3=_0x3bedd8[_0x45cfb3(0x1e5)],_0x2bc2bf&&(_0x43ecc3[_0x45cfb3(0x1b3)]=new Date()[_0x45cfb3(0x1af)]())):_0x43ecc3={'name':_0x40fecb,'createdAt':new Date()['toISOString']()};const _0x2767fa=JSON[_0x45cfb3(0x1db)](_0x5434ae);if(_0x2767fa[_0x45cfb3(0x1d9)](_0x45cfb3(0x1ab))||_0x2767fa[_0x45cfb3(0x1d9)](_0x45cfb3(0x1a7))||_0x2767fa[_0x45cfb3(0x1d9)](_0x45cfb3(0x1aa)))throw new Error(_0x45cfb3(0x19e));const _0x1cd747={..._0x5434ae,'metadata':_0x43ecc3};a36_0x42b385['writeFileSync'](_0x2e06f7,JSON[_0x45cfb3(0x1db)](_0x1cd747,null,0x2));}export function deleteProfile(_0x574e7d){const _0x17d28d=a36_0x5e8a;validateProfileName(_0x574e7d);const _0x1a3d0b=getProfileDir(_0x574e7d);if(!a36_0x42b385['existsSync'](_0x1a3d0b))throw new Error('Profile\x20'+_0x574e7d+'\x20does\x20not\x20exist');a36_0x42b385[_0x17d28d(0x1c2)](_0x1a3d0b,{'recursive':!![],'force':!![]});}export function getActiveProfile(){const _0x2671a4=a36_0x5e8a,_0x1fc03a=getGlobalConfigPath();if(!a36_0x42b385[_0x2671a4(0x1b4)](_0x1fc03a))return null;try{const _0x541bc6=a36_0x42b385[_0x2671a4(0x1e0)](_0x1fc03a,'utf-8'),_0x2d4650=JSON[_0x2671a4(0x1eb)](_0x541bc6);return _0x2d4650['profile']||null;}catch{return null;}}export function createProfile(_0x59fb5a,_0x173cfd){const _0x2a63f4=a36_0x5e8a;validateProfileName(_0x59fb5a);if(profileExists(_0x59fb5a))throw new Error(_0x2a63f4(0x1b7)+_0x59fb5a+_0x2a63f4(0x1c1));saveProfile(_0x59fb5a,_0x173cfd);}export function saveProfileCredentials(_0x1fe5a6,_0x1e59d3){const _0x535b49=a36_0x5e8a;validateProfileName(_0x1fe5a6);if(!profileExists(_0x1fe5a6))throw new Error(_0x535b49(0x1b7)+_0x1fe5a6+'\x20does\x20not\x20exist');const _0x22294b=getNewCredentialPath(_0x1fe5a6);writeSecureFile(_0x22294b,_0x1e59d3);}export function loadProfileCredentials(_0x632786){const _0x58a894=a36_0x5e8a;validateProfileName(_0x632786);const _0x2788c9=getNewCredentialPath(_0x632786);if(a36_0x42b385[_0x58a894(0x1b4)](_0x2788c9))try{return a36_0x42b385[_0x58a894(0x1e0)](_0x2788c9,_0x58a894(0x1ac));}catch{}const _0x25df6a=getOldCredentialPath(_0x632786);if(a36_0x42b385[_0x58a894(0x1b4)](_0x25df6a)){console['warn'](_0x58a894(0x1de)+_0x632786+'\x27'),console[_0x58a894(0x1cf)](_0x58a894(0x1e8)),console[_0x58a894(0x1cf)](_0x58a894(0x1a8)+_0x25df6a+_0x58a894(0x1d8)+_0x2788c9+'\x22'),console[_0x58a894(0x1cf)](_0x58a894(0x1c3));try{return a36_0x42b385[_0x58a894(0x1e0)](_0x25df6a,_0x58a894(0x1ac));}catch{return null;}}return null;}
|
|
1
|
+
(function(_0x285938,_0x365251){const _0x170986=a36_0x4313,_0x55452c=_0x285938();while(!![]){try{const _0x941da1=-parseInt(_0x170986(0xd7))/0x1+-parseInt(_0x170986(0xcb))/0x2+-parseInt(_0x170986(0x9d))/0x3+-parseInt(_0x170986(0xce))/0x4*(parseInt(_0x170986(0x98))/0x5)+parseInt(_0x170986(0xb8))/0x6+-parseInt(_0x170986(0xc4))/0x7+parseInt(_0x170986(0xb3))/0x8*(parseInt(_0x170986(0xca))/0x9);if(_0x941da1===_0x365251)break;else _0x55452c['push'](_0x55452c['shift']());}catch(_0x32dcb8){_0x55452c['push'](_0x55452c['shift']());}}}(a36_0x1951,0x770a2));import*as a36_0x3e6cb7 from'node:fs';import*as a36_0x2db0d7 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(_0x5ea232){const _0x1c4eee={};if(!_0x5ea232)return _0x1c4eee;for(const [_0x419cb2,_0x56dec5]of Object['entries'](_0x5ea232)){_0x419cb2!=='description'&&_0x56dec5!==undefined&&(_0x1c4eee[_0x419cb2]=_0x56dec5);}return _0x1c4eee;}export function getProfilesDir(){const _0x24eaad=a36_0x4313;return a36_0x2db0d7[_0x24eaad(0x9a)](getConfigDir(),_0x24eaad(0xa8));}function getProfileDir(_0x1b42bd){const _0x1f4b4e=a36_0x4313;return a36_0x2db0d7[_0x1f4b4e(0x9a)](getProfilesDir(),_0x1b42bd);}function getProfileConfigPath(_0x2f0b22){const _0x4cb190=a36_0x4313;return a36_0x2db0d7['join'](getProfileDir(_0x2f0b22),_0x4cb190(0xdb));}function getProfileEnvPath(_0x3f0888){const _0x51f735=a36_0x4313;return a36_0x2db0d7[_0x51f735(0x9a)](getProfileDir(_0x3f0888),_0x51f735(0xe2));}function getGlobalConfigPath(){return a36_0x2db0d7['join'](getConfigDir(),'tdx.json');}function validateProfileName(_0x3ee3c2){const _0x2ce566=a36_0x4313;if(!/^[a-zA-Z0-9_-]+$/[_0x2ce566(0xd1)](_0x3ee3c2))throw new Error('Invalid\x20profile\x20name:\x20'+_0x3ee3c2+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.');}function validateProfileConfig(_0x1cd1e8,_0x4d9760){const _0x40d26d=a36_0x4313;if(typeof _0x1cd1e8!==_0x40d26d(0xa7)||_0x1cd1e8===null)throw new Error('Profile\x20\x27'+_0x4d9760+_0x40d26d(0xc1));const _0x38c25d=['description',_0x40d26d(0xcd),_0x40d26d(0xd6),_0x40d26d(0xba),_0x40d26d(0xad),_0x40d26d(0xda)],_0x287b81=_0x1cd1e8;for(const _0x4ef549 of Object[_0x40d26d(0xb2)](_0x287b81)){!_0x38c25d[_0x40d26d(0xe3)](_0x4ef549)&&console[_0x40d26d(0xa1)]('Warning:\x20Profile\x20\x27'+_0x4d9760+_0x40d26d(0xa9)+_0x4ef549+_0x40d26d(0xb6));}if(_0x287b81[_0x40d26d(0xbc)]!==undefined&&typeof _0x287b81[_0x40d26d(0xbc)]!==_0x40d26d(0xde))throw new Error(_0x40d26d(0xc9)+_0x4d9760+_0x40d26d(0xb0));if(_0x287b81[_0x40d26d(0xcd)]!==undefined&&typeof _0x287b81[_0x40d26d(0xcd)]!==_0x40d26d(0xde))throw new Error(_0x40d26d(0xc9)+_0x4d9760+_0x40d26d(0xc6));if(_0x287b81[_0x40d26d(0xd6)]!==undefined&&typeof _0x287b81[_0x40d26d(0xd6)]!==_0x40d26d(0xde))throw new Error(_0x40d26d(0xc9)+_0x4d9760+_0x40d26d(0xd0));if(_0x287b81[_0x40d26d(0xba)]!==undefined&&typeof _0x287b81[_0x40d26d(0xba)]!=='string')throw new Error(_0x40d26d(0xc9)+_0x4d9760+'\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string');if(_0x287b81[_0x40d26d(0xad)]!==undefined&&typeof _0x287b81[_0x40d26d(0xad)]!=='string')throw new Error(_0x40d26d(0xc9)+_0x4d9760+_0x40d26d(0xcf));if(_0x287b81['llm_agent']!==undefined&&typeof _0x287b81[_0x40d26d(0xda)]!==_0x40d26d(0xde))throw new Error('Profile\x20\x27'+_0x4d9760+_0x40d26d(0x9c));return!![];}function loadProfilesFromTdxJson(_0xdc63c6,_0x1ad69e){const _0x3f68c6=a36_0x4313;if(!a36_0x3e6cb7[_0x3f68c6(0x9b)](_0xdc63c6))return[];try{const _0x748b87=a36_0x3e6cb7[_0x3f68c6(0xd8)](_0xdc63c6,_0x3f68c6(0xa6)),_0x90f745=JSON[_0x3f68c6(0xae)](_0x748b87);if(!_0x90f745[_0x3f68c6(0xa8)]||typeof _0x90f745['profiles']!==_0x3f68c6(0xa7))return[];const _0x24afee=[];for(const [_0x2a7bbe,_0x432d4d]of Object['entries'](_0x90f745[_0x3f68c6(0xa8)])){try{validateProfileConfig(_0x432d4d,_0x2a7bbe);const _0x2f24b4=getNewCredentialPath(_0x2a7bbe),_0x811535=getOldCredentialPath(_0x2a7bbe),_0x125269=a36_0x3e6cb7[_0x3f68c6(0x9b)](_0x2f24b4)||a36_0x3e6cb7[_0x3f68c6(0x9b)](_0x811535);_0x24afee[_0x3f68c6(0xd4)]({'name':_0x2a7bbe,'config':_0x432d4d,'metadata':{'name':_0x2a7bbe,'createdAt':new Date()[_0x3f68c6(0xa2)]()},'hasCredentials':_0x125269,'scope':_0x1ad69e});}catch(_0x486fb0){_0x486fb0 instanceof Error&&(console[_0x3f68c6(0xa1)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0xdc63c6+':'),console['warn']('\x20\x20'+_0x486fb0['message']+'\x0a'));}}return _0x24afee;}catch(_0x1f3e93){return _0x1f3e93 instanceof SyntaxError?(console[_0x3f68c6(0xa1)](_0x3f68c6(0xd3)+_0xdc63c6+_0x3f68c6(0xb7)),console[_0x3f68c6(0xa1)](_0x3f68c6(0xbb)+_0x1f3e93[_0x3f68c6(0xbd)]+'\x0a')):console[_0x3f68c6(0xa1)](_0x3f68c6(0xb9)+_0xdc63c6+':\x20'+_0x1f3e93+'\x0a'),[];}}function a36_0x4313(_0x4241b7,_0x156557){const _0x195140=a36_0x1951();return a36_0x4313=function(_0x43131d,_0x11fbe2){_0x43131d=_0x43131d-0x98;let _0x17c187=_0x195140[_0x43131d];return _0x17c187;},a36_0x4313(_0x4241b7,_0x156557);}export function getNewCredentialPath(_0x2ace4d){const _0x176ff0=a36_0x4313;return a36_0x2db0d7[_0x176ff0(0x9a)](getConfigDir(),_0x176ff0(0xc7)+_0x2ace4d);}function getOldCredentialPath(_0x32e9b7){const _0x16143d=a36_0x4313;return a36_0x2db0d7[_0x16143d(0x9a)](getProfilesDir(),_0x32e9b7,_0x16143d(0xe2));}function loadProfilesFromTdxJsonFiles(){const _0x50952f=a36_0x4313,_0x2f6a60=[],_0x2a3459=findProjectConfigPath();_0x2a3459&&_0x2f6a60[_0x50952f(0xd4)](...loadProfilesFromTdxJson(_0x2a3459,_0x50952f(0xe4)));const _0x59df24=a36_0x2db0d7['join'](getConfigDir(),_0x50952f(0xdb));return _0x2f6a60[_0x50952f(0xd4)](...loadProfilesFromTdxJson(_0x59df24,_0x50952f(0xb4))),_0x2f6a60;}function loadProfilesFromDirectories(){const _0x3ae9d6=a36_0x4313,_0x4adceb=getProfilesDir();if(!a36_0x3e6cb7[_0x3ae9d6(0x9b)](_0x4adceb))return[];try{return a36_0x3e6cb7[_0x3ae9d6(0xc8)](_0x4adceb,{'withFileTypes':!![]})[_0x3ae9d6(0xa5)](_0x44209d=>_0x44209d[_0x3ae9d6(0xc2)]())['map'](_0x30d09c=>_0x30d09c[_0x3ae9d6(0xdc)])[_0x3ae9d6(0xa5)](_0x157e46=>{const _0x2f583d=_0x3ae9d6,_0x26a4e3=getProfileConfigPath(_0x157e46),_0x27d98a=getProfileEnvPath(_0x157e46);return a36_0x3e6cb7['existsSync'](_0x26a4e3)||a36_0x3e6cb7[_0x2f583d(0x9b)](_0x27d98a);})[_0x3ae9d6(0xd9)](_0x4a5a1b=>{const _0x263dc5=_0x3ae9d6,_0xa53447=loadProfileFromDirectory(_0x4a5a1b);if(_0xa53447)return{..._0xa53447,'scope':_0x263dc5(0xbe)};return null;})[_0x3ae9d6(0xa5)](_0xc5efbd=>_0xc5efbd!==null);}catch{return[];}}function a36_0x1951(){const _0x529cb3=['readFileSync','map','llm_agent','tdx.json','name','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20profile\x20configuration.\x20Use\x20.env\x20file\x20instead.','string','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','\x20already\x20exists','lastUsed','.env','includes','local','5GRcben','To\x20migrate:','join','existsSync','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','2075487uJQyMf','profile','apiKey','sort','warn','toISOString','Profile\x20','length','filter','utf-8','object','profiles','\x27:\x20unknown\x20config\x20key\x20\x27','stringify','has','some','llm_project','parse','api_key','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','writeFileSync','keys','24doeHYc','user','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','\x27\x20will\x20be\x20ignored',':\x20Invalid\x20JSON\x20syntax','123744tFnRbd','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','parent_segment','Error:\x20','description','message','directory','find','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','\x27:\x20config\x20must\x20be\x20an\x20object','isDirectory','\x20\x201.\x20Edit:\x20','6430746lQIVHP','\x20\x20mv\x20\x22','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','.env.','readdirSync','Profile\x20\x27','8996229wDRXdF','317450HVicDe','\x20does\x20not\x20exist','site','257156VewnbY','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','test','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','\x0aWarning:\x20Failed\x20to\x20parse\x20','push','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','database','698260befgFM'];a36_0x1951=function(){return _0x529cb3;};return a36_0x1951();}function loadProfileFromDirectory(_0xb2ed4){const _0x2faf42=a36_0x4313,_0x3e14b6=getProfileConfigPath(_0xb2ed4),_0x4bfd3d=getOldCredentialPath(_0xb2ed4);if(!a36_0x3e6cb7[_0x2faf42(0x9b)](_0x3e14b6)&&!a36_0x3e6cb7[_0x2faf42(0x9b)](_0x4bfd3d))return null;let _0x1cd11f={},_0x260b85={'name':_0xb2ed4,'createdAt':new Date()[_0x2faf42(0xa2)]()};if(a36_0x3e6cb7[_0x2faf42(0x9b)](_0x3e14b6))try{const _0x582157=a36_0x3e6cb7[_0x2faf42(0xd8)](_0x3e14b6,_0x2faf42(0xa6)),_0x14ab6a=JSON[_0x2faf42(0xae)](_0x582157),{metadata:_0x1c8e93,..._0x1ce5a2}=_0x14ab6a;_0x1cd11f=_0x1ce5a2,_0x1c8e93&&(_0x260b85=_0x1c8e93);}catch{}return{'name':_0xb2ed4,'config':_0x1cd11f,'metadata':_0x260b85,'hasCredentials':a36_0x3e6cb7['existsSync'](_0x4bfd3d),'scope':_0x2faf42(0xbe)};}export function listProfiles(){const _0x53e563=a36_0x4313,_0x442320=loadProfilesFromTdxJsonFiles(),_0x114f81=loadProfilesFromDirectories();if(_0x114f81[_0x53e563(0xa4)]>0x0){const _0x2a7798=_0x114f81['map'](_0x29be0a=>_0x29be0a['name'])['join'](',\x20'),_0x41a822=getConfigDir();console[_0x53e563(0xa1)](_0x53e563(0xb5)+_0x2a7798),console[_0x53e563(0xa1)](_0x53e563(0xdf)),console[_0x53e563(0xa1)](_0x53e563(0xc3)+a36_0x2db0d7[_0x53e563(0x9a)](_0x41a822,_0x53e563(0xdb))),console['warn']('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console[_0x53e563(0xa1)](_0x53e563(0xc0));}const _0x139867=[..._0x442320,..._0x114f81],_0x2b0897=new Map();for(const _0x427ea4 of _0x139867){!_0x2b0897[_0x53e563(0xab)](_0x427ea4[_0x53e563(0xdc)])&&_0x2b0897['set'](_0x427ea4['name'],_0x427ea4);}return Array['from'](_0x2b0897['values']())[_0x53e563(0xa0)]((_0xe73813,_0x27d178)=>_0xe73813[_0x53e563(0xdc)]['localeCompare'](_0x27d178[_0x53e563(0xdc)]));}export function profileExists(_0x13fe6f){const _0x29a784=a36_0x4313,_0x35ac58=listProfiles();return _0x35ac58[_0x29a784(0xac)](_0x20e953=>_0x20e953[_0x29a784(0xdc)]===_0x13fe6f);}export function loadProfile(_0x5e2d87){const _0x2f0355=a36_0x4313;validateProfileName(_0x5e2d87);const _0x4f61da=listProfiles(),_0x45e6cb=_0x4f61da[_0x2f0355(0xbf)](_0x59f457=>_0x59f457[_0x2f0355(0xdc)]===_0x5e2d87);return _0x45e6cb||null;}export function saveProfile(_0x38433a,_0x5a32fc,_0x1cd75e=![]){const _0x4b061f=a36_0x4313;validateProfileName(_0x38433a);const _0x9c7711=getProfileDir(_0x38433a),_0x42504c=getProfileConfigPath(_0x38433a);createSecureDirectory(_0x9c7711);let _0x148bca;const _0x5e60fd=loadProfile(_0x38433a);_0x5e60fd?(_0x148bca=_0x5e60fd['metadata'],_0x1cd75e&&(_0x148bca[_0x4b061f(0xe1)]=new Date()[_0x4b061f(0xa2)]())):_0x148bca={'name':_0x38433a,'createdAt':new Date()[_0x4b061f(0xa2)]()};const _0x119c3f=JSON[_0x4b061f(0xaa)](_0x5a32fc);if(_0x119c3f[_0x4b061f(0xe3)]('TD_API_KEY')||_0x119c3f['includes'](_0x4b061f(0x9f))||_0x119c3f[_0x4b061f(0xe3)](_0x4b061f(0xaf)))throw new Error(_0x4b061f(0xdd));const _0x323d5b={..._0x5a32fc,'metadata':_0x148bca};a36_0x3e6cb7[_0x4b061f(0xb1)](_0x42504c,JSON[_0x4b061f(0xaa)](_0x323d5b,null,0x2));}export function deleteProfile(_0x393bcf){const _0x159f66=a36_0x4313;validateProfileName(_0x393bcf);const _0x5d5fdd=getProfileDir(_0x393bcf);if(!a36_0x3e6cb7['existsSync'](_0x5d5fdd))throw new Error(_0x159f66(0xa3)+_0x393bcf+_0x159f66(0xcc));a36_0x3e6cb7['rmSync'](_0x5d5fdd,{'recursive':!![],'force':!![]});}export function getActiveProfile(){const _0x142ce2=a36_0x4313,_0x48c486=getGlobalConfigPath();if(!a36_0x3e6cb7['existsSync'](_0x48c486))return null;try{const _0x344f6e=a36_0x3e6cb7['readFileSync'](_0x48c486,_0x142ce2(0xa6)),_0x5ad12e=JSON[_0x142ce2(0xae)](_0x344f6e);return _0x5ad12e[_0x142ce2(0x9e)]||null;}catch{return null;}}export function createProfile(_0x2cbc18,_0x2e2aec){const _0x41212b=a36_0x4313;validateProfileName(_0x2cbc18);if(profileExists(_0x2cbc18))throw new Error(_0x41212b(0xa3)+_0x2cbc18+_0x41212b(0xe0));saveProfile(_0x2cbc18,_0x2e2aec);}export function saveProfileCredentials(_0x5e30c2,_0x1650a2){const _0x4cae2d=a36_0x4313;validateProfileName(_0x5e30c2);if(!profileExists(_0x5e30c2))throw new Error(_0x4cae2d(0xa3)+_0x5e30c2+'\x20does\x20not\x20exist');const _0x44d257=getNewCredentialPath(_0x5e30c2);writeSecureFile(_0x44d257,_0x1650a2);}export function loadProfileCredentials(_0xf07f54){const _0x2e0fc1=a36_0x4313;validateProfileName(_0xf07f54);const _0xd0d153=getNewCredentialPath(_0xf07f54);if(a36_0x3e6cb7['existsSync'](_0xd0d153))try{return a36_0x3e6cb7['readFileSync'](_0xd0d153,_0x2e0fc1(0xa6));}catch{}const _0x1354dd=getOldCredentialPath(_0xf07f54);if(a36_0x3e6cb7[_0x2e0fc1(0x9b)](_0x1354dd)){console[_0x2e0fc1(0xa1)](_0x2e0fc1(0xd5)+_0xf07f54+'\x27'),console['warn'](_0x2e0fc1(0x99)),console[_0x2e0fc1(0xa1)](_0x2e0fc1(0xc5)+_0x1354dd+'\x22\x20\x22'+_0xd0d153+'\x22'),console[_0x2e0fc1(0xa1)](_0x2e0fc1(0xd2));try{return a36_0x3e6cb7[_0x2e0fc1(0xd8)](_0x1354dd,'utf-8');}catch{return null;}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x151f72,_0x182fdf){const _0x3ab9d8=a37_0x2bf1,_0x32b977=_0x151f72();while(!![]){try{const _0x51bec2=-parseInt(_0x3ab9d8(0x153))/0x1*(parseInt(_0x3ab9d8(0x164))/0x2)+parseInt(_0x3ab9d8(0x169))/0x3*(parseInt(_0x3ab9d8(0x16e))/0x4)+parseInt(_0x3ab9d8(0x161))/0x5+parseInt(_0x3ab9d8(0x16d))/0x6*(-parseInt(_0x3ab9d8(0x165))/0x7)+parseInt(_0x3ab9d8(0x15c))/0x8*(-parseInt(_0x3ab9d8(0x14f))/0x9)+-parseInt(_0x3ab9d8(0x166))/0xa*(-parseInt(_0x3ab9d8(0x16a))/0xb)+parseInt(_0x3ab9d8(0x15e))/0xc*(parseInt(_0x3ab9d8(0x162))/0xd);if(_0x51bec2===_0x182fdf)break;else _0x32b977['push'](_0x32b977['shift']());}catch(_0x1bc354){_0x32b977['push'](_0x32b977['shift']());}}}(a37_0xd06c,0x44ea0));import*as a37_0x2d4aba from'node:fs';function a37_0x2bf1(_0x21badc,_0x5c063d){const _0xd06c31=a37_0xd06c();return a37_0x2bf1=function(_0x2bf1aa,_0x33ab67){_0x2bf1aa=_0x2bf1aa-0x14e;let _0x55c4c5=_0xd06c31[_0x2bf1aa];return _0x55c4c5;},a37_0x2bf1(_0x21badc,_0x5c063d);}import*as a37_0x44650a from'node:path';const PROJECT_CONFIG_FILENAME='tdx.json';export function findProjectConfigPath(_0x2d0ffd){const _0x273aac=a37_0x2bf1;let _0x41aaec=_0x2d0ffd||process[_0x273aac(0x168)]();while(!![]){const _0x211ee9=a37_0x44650a[_0x273aac(0x16c)](_0x41aaec,PROJECT_CONFIG_FILENAME);if(a37_0x2d4aba[_0x273aac(0x154)](_0x211ee9))return _0x211ee9;const _0x34ed26=a37_0x44650a[_0x273aac(0x167)](_0x41aaec);if(_0x34ed26===_0x41aaec)return null;_0x41aaec=_0x34ed26;}}export function loadProjectConfig(_0x206505){const _0x147cef=a37_0x2bf1,_0x35a596=findProjectConfigPath(_0x206505);if(!_0x35a596)return null;try{const _0x5c5fca=a37_0x2d4aba[_0x147cef(0x15b)](_0x35a596,_0x147cef(0x158)),_0x3f599b=JSON[_0x147cef(0x16b)](_0x5c5fca),_0x1d3030=JSON[_0x147cef(0x163)](_0x3f599b);if(_0x1d3030['includes'](_0x147cef(0x155))||_0x1d3030['includes'](_0x147cef(0x15f))||_0x1d3030[_0x147cef(0x151)]('api_key'))throw new Error(_0x147cef(0x16f)+_0x35a596+').\x20'+_0x147cef(0x160));const {metadata:_0x20b260,profile:_0x7a31f4,..._0x11fdd9}=_0x3f599b;return _0x7a31f4&&console[_0x147cef(0x150)]('Warning:\x20\x27profile\x27\x20field\x20in\x20'+_0x35a596+_0x147cef(0x171)+_0x147cef(0x15d)),_0x11fdd9;}catch(_0x50b57c){if(_0x50b57c instanceof Error&&_0x147cef(0x170)in _0x50b57c&&_0x50b57c[_0x147cef(0x170)]===_0x147cef(0x14e))return null;throw new Error(_0x147cef(0x157)+_0x35a596+':\x20'+_0x50b57c);}}export function saveProjectConfig(_0x5b0891,_0x422bb6){const _0x4ba21a=a37_0x2bf1,_0x5008d4=_0x422bb6||process[_0x4ba21a(0x168)](),_0x5258a2=a37_0x44650a[_0x4ba21a(0x16c)](_0x5008d4,PROJECT_CONFIG_FILENAME),_0x77f951=JSON[_0x4ba21a(0x163)](_0x5b0891);if(_0x77f951[_0x4ba21a(0x151)](_0x4ba21a(0x155))||_0x77f951['includes'](_0x4ba21a(0x15f))||_0x77f951[_0x4ba21a(0x151)](_0x4ba21a(0x15a)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.');if(_0x4ba21a(0x152)in _0x5b0891)throw new Error(_0x4ba21a(0x156));a37_0x2d4aba[_0x4ba21a(0x159)](_0x5258a2,JSON['stringify'](_0x5b0891,null,0x2));}function a37_0xd06c(){const _0x4a05d8=['51108NAXEOd','existsSync','TD_API_KEY','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','Failed\x20to\x20load\x20project\x20config\x20from\x20','utf-8','writeFileSync','api_key','readFileSync','152YUROeV','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','261768rusJEn','apiKey','Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.','826200lJPSPb','221gARgEN','stringify','2TsQPpf','13853YFmwDy','10XNKAWo','dirname','cwd','27iHZnFh','5535915LeUBrr','parse','join','618byZIFk','6108MBUCuZ','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','code','\x20is\x20ignored.\x20','ENOENT','244359gKTbfx','warn','includes','profile'];a37_0xd06c=function(){return _0x4a05d8;};return a37_0xd06c();}export function hasProjectConfig(_0x1768e0){return findProjectConfigPath(_0x1768e0)!==null;}export function getProjectRoot(_0x1d0bc4){const _0x1d8643=a37_0x2bf1,_0x331cc3=findProjectConfigPath(_0x1d0bc4);return _0x331cc3?a37_0x44650a[_0x1d8643(0x167)](_0x331cc3):null;}
|
package/dist/core/session.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x493184,_0x34b322){const _0x2053be=a38_0x5966,_0x3721a7=_0x493184();while(!![]){try{const _0x5a4d31=parseInt(_0x2053be(0x12a))/0x1+-parseInt(_0x2053be(0x12e))/0x2+-parseInt(_0x2053be(0x13c))/0x3+parseInt(_0x2053be(0x138))/0x4*(-parseInt(_0x2053be(0x126))/0x5)+parseInt(_0x2053be(0x141))/0x6+-parseInt(_0x2053be(0x13d))/0x7*(parseInt(_0x2053be(0x139))/0x8)+parseInt(_0x2053be(0x14c))/0x9;if(_0x5a4d31===_0x34b322)break;else _0x3721a7['push'](_0x3721a7['shift']());}catch(_0xa866c2){_0x3721a7['push'](_0x3721a7['shift']());}}}(a38_0x7e9e,0xe51d3));function a38_0x7e9e(){const _0x330d71=['21599082guFrJE','env','endsWith','stringify','2976390EvwuHX','push','.json','TD_API_KEY','31423GwzazC','readdirSync','sessions','TDX_CONFIG_DIR','1823294mKDaJT','tdx','utf-8','warn','readFileSync','test','includes','replace','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','getTime','4BPvZVU','8296sCieHc','homedir','parse','124524upXOGo','6769sABwrG','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','createdAt','now','6350052FXJkcR','apiKey','unlinkSync','.\x20This\x20is\x20insecure.\x20Removing\x20session.','writeFileSync','toString','toISOString','join','api_key','sort','existsSync'];a38_0x7e9e=function(){return _0x330d71;};return a38_0x7e9e();}function a38_0x5966(_0x3b6171,_0x5e83ee){const _0x7e9e3b=a38_0x7e9e();return a38_0x5966=function(_0x5966df,_0x4e5f93){_0x5966df=_0x5966df-0x123;let _0x57569f=_0x7e9e3b[_0x5966df];return _0x57569f;},a38_0x5966(_0x3b6171,_0x5e83ee);}import*as a38_0x5cae22 from'node:fs';import*as a38_0x3f42d7 from'node:path';import*as a38_0x75de0e 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 _0x441d66=a38_0x5966,_0x14c4f5=process[_0x441d66(0x123)][_0x441d66(0x12d)]||a38_0x3f42d7[_0x441d66(0x148)](a38_0x75de0e[_0x441d66(0x13a)](),'.config',_0x441d66(0x12f));return a38_0x3f42d7[_0x441d66(0x148)](_0x14c4f5,_0x441d66(0x12c));}function getSessionPath(_0x4c5fe2){const _0x48a56c=a38_0x5966;return a38_0x3f42d7[_0x48a56c(0x148)](getSessionsDir(),_0x4c5fe2+_0x48a56c(0x128));}export function getCurrentSessionPID(){return getPPID();}export function getSessionID(_0x1ebccf){if(_0x1ebccf)return _0x1ebccf;return getCurrentSessionPID()['toString']();}export function loadSessionContext(_0x40c6fd){const _0x3be079=a38_0x5966,_0x24d9c8=_0x40c6fd||getCurrentSessionPID()[_0x3be079(0x146)](),_0x50165b=/^\d+$/[_0x3be079(0x133)](_0x24d9c8)?parseInt(_0x24d9c8,0xa):null;return _0x50165b!==null?loadSessionContextByPID(_0x50165b):loadSessionContextByString(_0x24d9c8);}export function loadSessionContextByPID(_0x3b5c32){const _0x339124=a38_0x5966,_0x1127c7=getSessionPath(_0x3b5c32);if(!a38_0x5cae22[_0x339124(0x14b)](_0x1127c7))return null;try{const _0x17699e=a38_0x5cae22[_0x339124(0x132)](_0x1127c7,_0x339124(0x130)),_0x441dd5=JSON['parse'](_0x17699e),_0x415fa7=new Date(_0x441dd5['createdAt'])[_0x339124(0x137)](),_0x3ae8a3=Date[_0x339124(0x140)]();if(_0x3ae8a3-_0x415fa7>SESSION_EXPIRATION_MS)return a38_0x5cae22[_0x339124(0x143)](_0x1127c7),null;const _0x638b52=JSON[_0x339124(0x125)](_0x441dd5);if(_0x638b52[_0x339124(0x134)](_0x339124(0x129))||_0x638b52[_0x339124(0x134)](_0x339124(0x142))||_0x638b52[_0x339124(0x134)](_0x339124(0x149)))return console[_0x339124(0x131)](_0x339124(0x136)+_0x1127c7+_0x339124(0x144)),a38_0x5cae22[_0x339124(0x143)](_0x1127c7),null;return _0x441dd5;}catch{try{a38_0x5cae22[_0x339124(0x143)](_0x1127c7);}catch{}return null;}}function loadSessionContextByString(_0x356728){const _0x2a5ac8=a38_0x5966,_0x627c0=a38_0x3f42d7['join'](getSessionsDir(),_0x356728+'.json');if(!a38_0x5cae22[_0x2a5ac8(0x14b)](_0x627c0))return null;try{const _0x3354d3=a38_0x5cae22[_0x2a5ac8(0x132)](_0x627c0,_0x2a5ac8(0x130)),_0x2b4017=JSON[_0x2a5ac8(0x13b)](_0x3354d3),_0xc2bb50=new Date(_0x2b4017[_0x2a5ac8(0x13f)])[_0x2a5ac8(0x137)](),_0x2f0451=Date['now']();if(_0x2f0451-_0xc2bb50>SESSION_EXPIRATION_MS)return a38_0x5cae22[_0x2a5ac8(0x143)](_0x627c0),null;const _0x5238f9=JSON[_0x2a5ac8(0x125)](_0x2b4017);if(_0x5238f9['includes'](_0x2a5ac8(0x129))||_0x5238f9[_0x2a5ac8(0x134)]('apiKey')||_0x5238f9[_0x2a5ac8(0x134)]('api_key'))return console['warn'](_0x2a5ac8(0x136)+_0x627c0+'.\x20This\x20is\x20insecure.\x20Removing\x20session.'),a38_0x5cae22[_0x2a5ac8(0x143)](_0x627c0),null;return _0x2b4017;}catch{try{a38_0x5cae22['unlinkSync'](_0x627c0);}catch{}return null;}}export function saveSessionContext(_0x5cd2c0,_0x121924){const _0x52fc6d=a38_0x5966,_0x2ae862=_0x121924||getCurrentSessionPID()[_0x52fc6d(0x146)](),_0xa9ab69=/^\d+$/['test'](_0x2ae862)?parseInt(_0x2ae862,0xa):getCurrentSessionPID(),_0x449d70=a38_0x3f42d7[_0x52fc6d(0x148)](getSessionsDir(),_0x2ae862+_0x52fc6d(0x128)),_0xa0d5d6=getSessionsDir();createSecureDirectory(_0xa0d5d6);const _0x2ae81c=JSON['stringify'](_0x5cd2c0);if(_0x2ae81c[_0x52fc6d(0x134)](_0x52fc6d(0x129))||_0x2ae81c[_0x52fc6d(0x134)](_0x52fc6d(0x142))||_0x2ae81c[_0x52fc6d(0x134)](_0x52fc6d(0x149)))throw new Error(_0x52fc6d(0x13e));let _0x4c619f;const _0x5db13d=/^\d+$/[_0x52fc6d(0x133)](_0x2ae862)?loadSessionContextByPID(parseInt(_0x2ae862,0xa)):loadSessionContextByString(_0x2ae862);_0x5db13d?_0x4c619f={..._0x5db13d,..._0x5cd2c0,'pid':_0xa9ab69,'sessionId':_0x2ae862!==_0xa9ab69['toString']()?_0x2ae862:undefined,'updatedAt':new Date()[_0x52fc6d(0x147)]()}:_0x4c619f={'pid':_0xa9ab69,'sessionId':_0x2ae862!==_0xa9ab69['toString']()?_0x2ae862:undefined,..._0x5cd2c0,'createdAt':new Date()[_0x52fc6d(0x147)](),'updatedAt':new Date()[_0x52fc6d(0x147)]()},a38_0x5cae22[_0x52fc6d(0x145)](_0x449d70,JSON[_0x52fc6d(0x125)](_0x4c619f,null,0x2));}export function clearSessionContext(_0x4d1373){const _0x51df3d=a38_0x5966,_0x3c1d94=_0x4d1373||getCurrentSessionPID()[_0x51df3d(0x146)](),_0x175261=a38_0x3f42d7[_0x51df3d(0x148)](getSessionsDir(),_0x3c1d94+_0x51df3d(0x128));a38_0x5cae22[_0x51df3d(0x14b)](_0x175261)&&a38_0x5cae22[_0x51df3d(0x143)](_0x175261);}export function cleanExpiredSessions(){const _0x3294f0=a38_0x5966,_0xeb32ef=getSessionsDir();if(!a38_0x5cae22[_0x3294f0(0x14b)](_0xeb32ef))return 0x0;let _0x4ad1fa=0x0;const _0x6ce796=Date[_0x3294f0(0x140)]();try{const _0x1195b9=a38_0x5cae22[_0x3294f0(0x12b)](_0xeb32ef);for(const _0x22c39b of _0x1195b9){if(!_0x22c39b[_0x3294f0(0x124)](_0x3294f0(0x128)))continue;const _0x290160=a38_0x3f42d7['join'](_0xeb32ef,_0x22c39b),_0x1068d9=_0x22c39b[_0x3294f0(0x135)](_0x3294f0(0x128),''),_0x215623=parseInt(_0x1068d9,0xa),_0x3b800c=!isNaN(_0x215623);if(_0x3b800c){if(!isProcessRunning(_0x215623)){a38_0x5cae22[_0x3294f0(0x143)](_0x290160),_0x4ad1fa++;continue;}}try{const _0x320290=a38_0x5cae22[_0x3294f0(0x132)](_0x290160,'utf-8'),_0x3257b2=JSON[_0x3294f0(0x13b)](_0x320290),_0x36fea5=new Date(_0x3257b2[_0x3294f0(0x13f)])[_0x3294f0(0x137)]();_0x6ce796-_0x36fea5>SESSION_EXPIRATION_MS&&(a38_0x5cae22[_0x3294f0(0x143)](_0x290160),_0x4ad1fa++);}catch{a38_0x5cae22[_0x3294f0(0x143)](_0x290160),_0x4ad1fa++;}}}catch{}return _0x4ad1fa;}export function listActiveSessions(){const _0x4ac97e=a38_0x5966,_0x453ee9=getSessionsDir();if(!a38_0x5cae22[_0x4ac97e(0x14b)](_0x453ee9))return[];try{const _0x1b8815=a38_0x5cae22[_0x4ac97e(0x12b)](_0x453ee9),_0x63c808=[];for(const _0x1db446 of _0x1b8815){if(!_0x1db446[_0x4ac97e(0x124)]('.json'))continue;const _0x59164a=_0x1db446[_0x4ac97e(0x135)](_0x4ac97e(0x128),''),_0x3c5c81=parseInt(_0x59164a,0xa);!isNaN(_0x3c5c81)&&isProcessRunning(_0x3c5c81)&&_0x63c808[_0x4ac97e(0x127)](_0x3c5c81);}return _0x63c808[_0x4ac97e(0x14a)]((_0x1ce065,_0x4b55c6)=>_0x1ce065-_0x4b55c6);}catch{return[];}}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x4d15c1,_0x562772){var _0x24d2dd=a39_0x4a5e,_0x452196=_0x4d15c1();while(!![]){try{var _0x141a26=-parseInt(_0x24d2dd(0x153))/0x1*(parseInt(_0x24d2dd(0x150))/0x2)+parseInt(_0x24d2dd(0x14e))/0x3*(-parseInt(_0x24d2dd(0x157))/0x4)+-parseInt(_0x24d2dd(0x154))/0x5*(-parseInt(_0x24d2dd(0x152))/0x6)+parseInt(_0x24d2dd(0x156))/0x7+parseInt(_0x24d2dd(0x151))/0x8+-parseInt(_0x24d2dd(0x158))/0x9*(parseInt(_0x24d2dd(0x155))/0xa)+parseInt(_0x24d2dd(0x159))/0xb*(parseInt(_0x24d2dd(0x14f))/0xc);if(_0x141a26===_0x562772)break;else _0x452196['push'](_0x452196['shift']());}catch(_0x1af662){_0x452196['push'](_0x452196['shift']());}}}(a39_0x9166,0x3f82a));export*from'./types/index.js';function a39_0x4a5e(_0x3e7a2e,_0xc93bd3){var _0x91665d=a39_0x9166();return a39_0x4a5e=function(_0x4a5ee5,_0xfd55e8){_0x4a5ee5=_0x4a5ee5-0x14e;var _0x2edccf=_0x91665d[_0x4a5ee5];return _0x2edccf;},a39_0x4a5e(_0x3e7a2e,_0xc93bd3);}export*from'./core/config.js';export*from'./core/auth.js';export*from'./client/http-client.js';export*from'./client/td-client.js';export{TrinoClient}from'./client/trino-client.js';export*from'./client/rate-limiter.js';export*from'./types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';function a39_0x9166(){var _0x51916a=['1812496hVUbBT','514968kFnpTp','234VlzLMQ','600820mOykkb','9CWrtWI','84EjioZp','2004FcnNAB','1049376JDkJZn','411210jZIval','78mrHOCz','10HCdvej','71150wLuRco'];a39_0x9166=function(){return _0x51916a;};return a39_0x9166();}export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* API translation layer for converting between Anthropic Messages API and TD LLM API formats
|
|
3
|
+
*
|
|
4
|
+
* Markdown Format Conventions:
|
|
5
|
+
*
|
|
6
|
+
* This module uses markdown code blocks instead of XML for all instruction formats
|
|
7
|
+
* to improve LLM parsing robustness and reduce special character escaping issues.
|
|
8
|
+
*
|
|
9
|
+
* Format Specifications:
|
|
10
|
+
* - Tool definitions: ```tools ... ``` (contains tool list and usage instructions)
|
|
11
|
+
* - Tool use (LLM output): ```tool_use\n{"tool_use":{"id":"...","name":"...","input":{...}}}\n```
|
|
12
|
+
* - Tool results: ```tool_result tool_use_id=xxx\n(result content)\n```
|
|
13
|
+
* - Error results: ```tool_result tool_use_id=xxx error=true\n(error content)\n```
|
|
14
|
+
*
|
|
15
|
+
* Escaping:
|
|
16
|
+
* - Triple backticks within content are escaped as \`\`\` to prevent breaking code blocks
|
|
17
|
+
* - No XML entity escaping needed (<, >, &, ", ' are preserved as-is)
|
|
3
18
|
*/
|
|
4
19
|
import type { AnthropicMessage, AnthropicMessagesRequest, AnthropicStreamEvent, AnthropicTool } from '../types/anthropic.js';
|
|
5
20
|
import type { SSEEvent } from '../types/index.js';
|
|
@@ -42,16 +57,20 @@ export declare function formatAnthropicSSE(event: AnthropicStreamEvent): string;
|
|
|
42
57
|
export declare function mapAnthropicModelToTD(anthropicModel: string): string;
|
|
43
58
|
/**
|
|
44
59
|
* Generate tool instruction prompt from Anthropic tool definitions
|
|
45
|
-
* This prompt instructs the LLM to output tool calls as JSON
|
|
60
|
+
* This prompt instructs the LLM to output tool calls as JSON in markdown format
|
|
46
61
|
*/
|
|
47
62
|
export declare function generateToolPrompt(tools: AnthropicTool[]): string;
|
|
48
63
|
/**
|
|
49
64
|
* Extract tool results from Anthropic messages and format for TD API
|
|
50
|
-
* Converts tool_result content blocks into continuation prompt
|
|
65
|
+
* Converts tool_result content blocks into continuation prompt using markdown format
|
|
51
66
|
*/
|
|
52
67
|
export declare function extractToolResults(messages: AnthropicMessage[]): string;
|
|
53
68
|
/**
|
|
54
69
|
* Parse tool call JSON from text content
|
|
70
|
+
* Supports both markdown code block format and raw JSON
|
|
71
|
+
* Supports multiple JSON formats:
|
|
72
|
+
* - Official: {"tool_use":{"id":"...","name":"...","input":{...}}}
|
|
73
|
+
* - Simplified: {"name":"...","arguments":{...}} or {"name":"...","input":{...}}
|
|
55
74
|
* Returns parsed tool call with start/end indices, or null if not found
|
|
56
75
|
*/
|
|
57
76
|
export declare function parseToolCallFromText(text: string): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic-adapter.d.ts","sourceRoot":"","sources":["../../src/proxy/anthropic-adapter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"anthropic-adapter.d.ts","sourceRoot":"","sources":["../../src/proxy/anthropic-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;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,CAuDjE;AAWD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAmCvE;AAoDD;;;;;;;GAOG;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,CAgFP;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,CAsSrD;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|