@treasuredata/tdx 0.1.16 → 0.1.18
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 +20 -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_0x36fa37=a32_0x3536;(function(_0x50f280,_0x15b4a9){const _0x51ce25=a32_0x3536,_0x5efccd=_0x50f280();while(!![]){try{const _0xe4469f=-parseInt(_0x51ce25(0x231))/0x1+-parseInt(_0x51ce25(0x227))/0x2*(parseInt(_0x51ce25(0x1fc))/0x3)+-parseInt(_0x51ce25(0x22d))/0x4+parseInt(_0x51ce25(0x258))/0x5+-parseInt(_0x51ce25(0x24b))/0x6*(parseInt(_0x51ce25(0x249))/0x7)+parseInt(_0x51ce25(0x24d))/0x8*(parseInt(_0x51ce25(0x253))/0x9)+parseInt(_0x51ce25(0x217))/0xa;if(_0xe4469f===_0x15b4a9)break;else _0x5efccd['push'](_0x5efccd['shift']());}catch(_0x45cb57){_0x5efccd['push'](_0x5efccd['shift']());}}}(a32_0x15ab,0x2a4bc));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';function a32_0x15ab(){const _0x14cd3f=['workflow:logs','kill','cause','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','error','\x20\x20Location:\x20','workflow:attempts','Validation:\x20skipped','Project\x20filter:\x20','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','Deleting\x20project\x20','28dBPtrj','✔\x20Found\x20','311874VOyhXd','Project:\x20','546528ukkGYP','isDirectory','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Filter:\x20project=','sessions','Error:\x20Attempt\x20ID\x20is\x20required','9lvrsPJ','session','Listing\x20workflow\x20sessions...','Listing\x20workflow\x20attempts...','\x20session','713600dxIKPT','\x22?\x20This\x20cannot\x20be\x20undone.','status','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','utf-8','✔\x20Downloaded\x20','Getting\x20attempt\x20tasks...','fromTask','Pattern:\x20','name','sessionId','Listing\x20workflows...','Project\x20directory:\x20','Kill\x20a\x20running\x20attempt','Reason:\x20','session:','List\x20workflows','workflow:push','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','message','\x20\x20Revision:\x20','filesExtracted','Listing\x20workflow\x20projects...','Attempt\x20ID:\x20','✔\x20Deleted\x20project\x20','\x20log\x20entr','Downloading\x20project\x20','offset','Revision:\x20','attempt:','Task\x20name:\x20','\x20\x20New\x20attempt\x20ID:\x20','push','List\x20workflow\x20execution\x20sessions','Show\x20logs\x20for\x20a\x20specific\x20task','workflow:delete','List\x20all\x20workflow\x20projects','Getting\x20attempt\x20details...','length','869502XYgWXt','revision','Params:\x20','Killing\x20attempt...','description','\x20\x20Cause:\x20','Usage:\x20workflow:delete\x20<project-name-or-id>','Show\x20tasks\x20for\x20an\x20attempt','workflow:retry','logs','data','includeRetried','...','Error:\x20Project\x20name\x20is\x20required','limit','attemptId','Error:\x20Invalid\x20JSON\x20in\x20--params','\x20project','resumeFrom','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','Force:\x20yes','from','workflows','workflow:tasks','From\x20task:\x20','split','verbose','8774700GutBQT','\x20\x20Project\x20ID:\x20','Retrying\x20session...','yes','workflow:kill','retryAttempt','workflow:projects','execute','force','reason','substring','projectName','workflow:sessions','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','parse','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','2NiyhDA','Show\x20specific\x20attempt\x20details','startsWith','Cancelled','\x20\x20Session\x20ID:\x20','Target:\x20','335296jzsKMQ','workflow','\x20task','fs/promises','333688FIESju','ies','Resume\x20from:\x20','workflow:download','Error:\x20','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','Output\x20directory:\x20','stat','params','\x20workflow','Filter:\x20','attempt'];a32_0x15ab=function(){return _0x14cd3f;};return a32_0x15ab();}import{confirm}from'../utils/prompt.js';export class WorkflowProjectsCommand extends BaseCommand{[a32_0x36fa37(0x1de)]=a32_0x36fa37(0x21d);[a32_0x36fa37(0x200)]=a32_0x36fa37(0x1f9);async['execute'](_0x58de6d){const _0x352807=a32_0x36fa37,{options:_0x58cef6,args:_0x163a65,tdx:_0x43e602}=_0x58de6d,_0x133a58=_0x163a65[0x0];try{_0x58cef6[_0x352807(0x216)]&&_0x133a58&&console['error'](_0x352807(0x1dd)+_0x133a58);const _0x598774=await withSpinner(_0x352807(0x1eb),()=>_0x43e602[_0x352807(0x22e)]['projects'](_0x133a58,{'limit':_0x58cef6[_0x352807(0x20a)]}),{'verbose':_0x58cef6[_0x352807(0x216)]}),_0x4e296c=_0x598774[_0x352807(0x206)];return console['error'](_0x352807(0x24a)+_0x4e296c[_0x352807(0x1fb)]+_0x352807(0x20d)+(_0x4e296c['length']!==0x1?'s':'')),await handleSDKOutput(_0x4e296c,_0x58cef6),0x0;}catch(_0x460aa7){if(_0x460aa7 instanceof SDKError)return console[_0x352807(0x242)]('Error:\x20'+_0x460aa7[_0x352807(0x1e8)]),_0x460aa7[_0x352807(0x23f)]&&console[_0x352807(0x242)](_0x352807(0x201)+_0x460aa7['cause']),0x1;throw _0x460aa7;}}}export class WorkflowWorkflowsCommand extends BaseCommand{['name']='workflow:workflows';[a32_0x36fa37(0x200)]=a32_0x36fa37(0x1e5);async['execute'](_0x363945){const _0x12f047=a32_0x36fa37,{options:_0x19f234,args:_0x56fbc7,tdx:_0x17140b}=_0x363945,_0x2363b7=_0x56fbc7[0x0];try{_0x19f234[_0x12f047(0x216)]&&_0x2363b7&&console[_0x12f047(0x242)](_0x12f047(0x246)+_0x2363b7);const _0x39248f=await withSpinner(_0x12f047(0x1e0),()=>_0x17140b[_0x12f047(0x22e)][_0x12f047(0x212)](_0x2363b7,{'limit':_0x19f234[_0x12f047(0x20a)]}),{'verbose':_0x19f234[_0x12f047(0x216)]}),_0x3b2906=_0x39248f[_0x12f047(0x206)];return console[_0x12f047(0x242)](_0x12f047(0x24a)+_0x3b2906['length']+_0x12f047(0x23a)+(_0x3b2906[_0x12f047(0x1fb)]!==0x1?'s':'')),await handleSDKOutput(_0x3b2906,_0x19f234),0x0;}catch(_0x27f0e9){if(_0x27f0e9 instanceof SDKError)return console[_0x12f047(0x242)](_0x12f047(0x235)+_0x27f0e9[_0x12f047(0x1e8)]),_0x27f0e9[_0x12f047(0x23f)]&&console[_0x12f047(0x242)]('\x20\x20Cause:\x20'+_0x27f0e9[_0x12f047(0x23f)]),0x1;throw _0x27f0e9;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']=a32_0x36fa37(0x223);[a32_0x36fa37(0x200)]=a32_0x36fa37(0x1f6);async[a32_0x36fa37(0x21e)](_0x544792){const _0x58972c=a32_0x36fa37,{options:_0x5beeb9,args:_0xdc7e7b,tdx:_0x36c980}=_0x544792;let _0x58dfb4,_0x3988b7;if(_0xdc7e7b[0x0]){const _0x2d256e=_0xdc7e7b[0x0]['split']('.');if(_0x2d256e[_0x58972c(0x1fb)]===0x1)_0x58dfb4=_0x2d256e[0x0];else{if(_0x2d256e['length']===0x2)[_0x58dfb4,_0x3988b7]=_0x2d256e;else return console['error'](_0x58972c(0x241)),0x1;}}try{if(_0x5beeb9['verbose']){if(_0x58dfb4&&_0x3988b7)console[_0x58972c(0x242)](_0x58972c(0x23b)+_0x58dfb4+'.'+_0x3988b7);else _0x58dfb4&&console['error'](_0x58972c(0x250)+_0x58dfb4);const _0x4a3d3e=_0x5beeb9[_0x58972c(0x1d7)];_0x4a3d3e&&console[_0x58972c(0x242)]('Status:\x20'+_0x4a3d3e);}const _0x118fa3=await withSpinner(_0x58972c(0x255),()=>_0x36c980[_0x58972c(0x22e)][_0x58972c(0x251)]({'projectName':_0x58dfb4,'workflowName':_0x3988b7,'status':_0x5beeb9[_0x58972c(0x1d7)],'fromTime':_0x5beeb9[_0x58972c(0x211)],'toTime':_0x5beeb9['to'],'limit':_0x5beeb9[_0x58972c(0x20a)]}),{'verbose':_0x5beeb9[_0x58972c(0x216)]}),_0x5cc460=_0x118fa3[_0x58972c(0x206)];return console[_0x58972c(0x242)](_0x58972c(0x24a)+_0x5cc460[_0x58972c(0x1fb)]+_0x58972c(0x257)+(_0x5cc460['length']!==0x1?'s':'')),await handleSDKOutput(_0x5cc460,_0x5beeb9),0x0;}catch(_0x5ae9aa){if(_0x5ae9aa instanceof SDKError)return console[_0x58972c(0x242)](_0x58972c(0x235)+_0x5ae9aa[_0x58972c(0x1e8)]),_0x5ae9aa[_0x58972c(0x23f)]&&console[_0x58972c(0x242)]('\x20\x20Cause:\x20'+_0x5ae9aa[_0x58972c(0x23f)]),0x1;throw _0x5ae9aa;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a32_0x36fa37(0x1de)]=a32_0x36fa37(0x244);['description']='List\x20workflow\x20attempts';async[a32_0x36fa37(0x21e)](_0x26c3b3){const _0x14750e=a32_0x36fa37,{options:_0xcdd28e,args:_0x5ad534,tdx:_0x70b5b7}=_0x26c3b3;let _0x490ea3,_0x509425;if(_0x5ad534[0x0]){const _0x255c24=_0x5ad534[0x0][_0x14750e(0x215)]('.');if(_0x255c24[_0x14750e(0x1fb)]===0x1)_0x490ea3=_0x255c24[0x0];else{if(_0x255c24[_0x14750e(0x1fb)]===0x2)[_0x490ea3,_0x509425]=_0x255c24;else return console[_0x14750e(0x242)](_0x14750e(0x241)),0x1;}}try{const _0x599a06=_0xcdd28e[_0x14750e(0x207)];if(_0xcdd28e[_0x14750e(0x216)]){if(_0x490ea3&&_0x509425)console[_0x14750e(0x242)](_0x14750e(0x23b)+_0x490ea3+'.'+_0x509425);else _0x490ea3&&console[_0x14750e(0x242)]('Filter:\x20project='+_0x490ea3);_0x599a06&&console[_0x14750e(0x242)]('Include\x20retried:\x20yes');}const _0x23f15f=await withSpinner(_0x14750e(0x256),()=>_0x70b5b7[_0x14750e(0x22e)]['attempts']({'projectName':_0x490ea3,'workflowName':_0x509425,'includeRetried':_0x599a06,'limit':_0xcdd28e[_0x14750e(0x20a)]}),{'verbose':_0xcdd28e[_0x14750e(0x216)]}),_0x3f412d=_0x23f15f['data'];return console['error']('✔\x20Found\x20'+_0x3f412d[_0x14750e(0x1fb)]+'\x20attempt'+(_0x3f412d[_0x14750e(0x1fb)]!==0x1?'s':'')),await handleSDKOutput(_0x3f412d,_0xcdd28e),0x0;}catch(_0x1c4302){if(_0x1c4302 instanceof SDKError)return console[_0x14750e(0x242)](_0x14750e(0x235)+_0x1c4302[_0x14750e(0x1e8)]),_0x1c4302[_0x14750e(0x23f)]&&console[_0x14750e(0x242)]('\x20\x20Cause:\x20'+_0x1c4302[_0x14750e(0x23f)]),0x1;throw _0x1c4302;}}}export class WorkflowAttemptCommand extends BaseCommand{[a32_0x36fa37(0x1de)]='workflow:attempt';[a32_0x36fa37(0x200)]=a32_0x36fa37(0x228);async['execute'](_0x4f80db){const _0x128103=a32_0x36fa37,{options:_0x93675f,args:_0x4123d5,tdx:_0x5f2a54}=_0x4f80db,_0x58f2f9=_0x4123d5[0x0];if(!_0x58f2f9)return console[_0x128103(0x242)](_0x128103(0x252)),0x1;try{_0x93675f['verbose']&&console['error']('Attempt\x20ID:\x20'+_0x58f2f9);const _0x3139ab=await withSpinner(_0x128103(0x1fa),()=>_0x5f2a54[_0x128103(0x22e)][_0x128103(0x23c)](_0x58f2f9),{'verbose':_0x93675f[_0x128103(0x216)]}),_0x403245=_0x3139ab[_0x128103(0x206)];return await handleSDKOutput([_0x403245],_0x93675f),0x0;}catch(_0x2b847d){if(_0x2b847d instanceof SDKError)return console[_0x128103(0x242)]('Error:\x20'+_0x2b847d['message']),_0x2b847d[_0x128103(0x23f)]&&console[_0x128103(0x242)](_0x128103(0x201)+_0x2b847d[_0x128103(0x23f)]),0x1;throw _0x2b847d;}}}function a32_0x3536(_0x5349d1,_0x310b30){const _0x15ab39=a32_0x15ab();return a32_0x3536=function(_0x35364f,_0x147f0c){_0x35364f=_0x35364f-0x1d6;let _0x437f85=_0x15ab39[_0x35364f];return _0x437f85;},a32_0x3536(_0x5349d1,_0x310b30);}export class WorkflowTasksCommand extends BaseCommand{[a32_0x36fa37(0x1de)]=a32_0x36fa37(0x213);['description']=a32_0x36fa37(0x203);async[a32_0x36fa37(0x21e)](_0x2113f9){const _0x1b32ee=a32_0x36fa37,{options:_0x1afcc2,args:_0x26c2d2,tdx:_0x42b38c}=_0x2113f9,_0x5d470e=_0x26c2d2[0x0];if(!_0x5d470e)return console[_0x1b32ee(0x242)](_0x1b32ee(0x252)),0x1;try{const _0x150f35=_0x1afcc2['includeSubtasks'];_0x1afcc2[_0x1b32ee(0x216)]&&(console[_0x1b32ee(0x242)](_0x1b32ee(0x1ec)+_0x5d470e),_0x150f35&&console[_0x1b32ee(0x242)]('Including\x20subtasks:\x20yes'));const _0x23b115=await withSpinner(_0x1b32ee(0x1db),()=>_0x42b38c[_0x1b32ee(0x22e)]['tasks'](_0x5d470e,_0x150f35||![]),{'verbose':_0x1afcc2[_0x1b32ee(0x216)]}),_0x522d0d=_0x23b115[_0x1b32ee(0x206)];return console[_0x1b32ee(0x242)]('✔\x20Found\x20'+_0x522d0d[_0x1b32ee(0x1fb)]+_0x1b32ee(0x22f)+(_0x522d0d[_0x1b32ee(0x1fb)]!==0x1?'s':'')),await handleSDKOutput(_0x522d0d,_0x1afcc2),0x0;}catch(_0x9b0242){if(_0x9b0242 instanceof SDKError)return console[_0x1b32ee(0x242)](_0x1b32ee(0x235)+_0x9b0242[_0x1b32ee(0x1e8)]),_0x9b0242[_0x1b32ee(0x23f)]&&console['error'](_0x1b32ee(0x201)+_0x9b0242[_0x1b32ee(0x23f)]),0x1;throw _0x9b0242;}}}export class WorkflowLogsCommand extends BaseCommand{[a32_0x36fa37(0x1de)]=a32_0x36fa37(0x23d);[a32_0x36fa37(0x200)]=a32_0x36fa37(0x1f7);async[a32_0x36fa37(0x21e)](_0x4bf76a){const _0xc36122=a32_0x36fa37,{options:_0x2cdbb3,args:_0x416c8b,tdx:_0x287bbf}=_0x4bf76a,_0xa4dcde=_0x416c8b[0x0],_0x1eaba2=_0x416c8b[0x1];if(!_0xa4dcde||!_0x1eaba2)return console[_0xc36122(0x242)]('Error:\x20Attempt\x20ID\x20and\x20task\x20name\x20are\x20required'),0x1;try{_0x2cdbb3[_0xc36122(0x216)]&&(console[_0xc36122(0x242)]('Attempt\x20ID:\x20'+_0xa4dcde),console[_0xc36122(0x242)](_0xc36122(0x1f3)+_0x1eaba2));const _0xe4fb38=_0x2cdbb3[_0xc36122(0x1f0)],_0x419753=await withSpinner('Getting\x20task\x20logs...',()=>_0x287bbf['workflow'][_0xc36122(0x205)](_0xa4dcde,_0x1eaba2,{'offset':_0xe4fb38,'limit':_0x2cdbb3[_0xc36122(0x20a)]}),{'verbose':_0x2cdbb3['verbose']}),_0x4d8c84=_0x419753[_0xc36122(0x206)];return console['error'](_0xc36122(0x24a)+_0x4d8c84[_0xc36122(0x1fb)]+_0xc36122(0x1ee)+(_0x4d8c84[_0xc36122(0x1fb)]!==0x1?_0xc36122(0x232):'y')),await handleSDKOutput(_0x4d8c84,_0x2cdbb3),0x0;}catch(_0x266399){if(_0x266399 instanceof SDKError)return console['error'](_0xc36122(0x235)+_0x266399['message']),_0x266399[_0xc36122(0x23f)]&&console[_0xc36122(0x242)](_0xc36122(0x201)+_0x266399[_0xc36122(0x23f)]),0x1;throw _0x266399;}}}export class WorkflowKillCommand extends BaseCommand{[a32_0x36fa37(0x1de)]=a32_0x36fa37(0x21b);[a32_0x36fa37(0x200)]=a32_0x36fa37(0x1e2);async['execute'](_0x5cd58e){const _0x57265f=a32_0x36fa37,{options:_0x23e819,args:_0x4678df,tdx:_0x477690}=_0x5cd58e,_0x2f829b=_0x4678df[0x0];if(!_0x2f829b)return console['error'](_0x57265f(0x252)),0x1;try{const _0x37e56=_0x23e819[_0x57265f(0x220)];_0x23e819[_0x57265f(0x216)]&&(console['error'](_0x57265f(0x1ec)+_0x2f829b),_0x37e56&&console[_0x57265f(0x242)](_0x57265f(0x1e3)+_0x37e56));if(!_0x23e819[_0x57265f(0x21a)]){const _0xc00208=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20'+_0x2f829b+'?');if(!_0xc00208)return console[_0x57265f(0x242)](_0x57265f(0x22a)),0x0;}const _0x90b140=await withSpinner(_0x57265f(0x1ff),()=>_0x477690[_0x57265f(0x22e)][_0x57265f(0x23e)](_0x2f829b,_0x37e56),{'verbose':_0x23e819[_0x57265f(0x216)]}),_0x58c252=_0x90b140[_0x57265f(0x206)];return console[_0x57265f(0x242)]('✔\x20'+_0x58c252),0x0;}catch(_0x3ec6c5){if(_0x3ec6c5 instanceof SDKError)return console[_0x57265f(0x242)](_0x57265f(0x235)+_0x3ec6c5['message']),_0x3ec6c5[_0x57265f(0x23f)]&&console[_0x57265f(0x242)](_0x57265f(0x201)+_0x3ec6c5['cause']),0x1;throw _0x3ec6c5;}}}export class WorkflowRetryCommand extends BaseCommand{[a32_0x36fa37(0x1de)]=a32_0x36fa37(0x204);[a32_0x36fa37(0x200)]='Retry\x20a\x20session\x20or\x20attempt';async[a32_0x36fa37(0x21e)](_0x16cde7){const _0xc481d5=a32_0x36fa37,{options:_0x70c818,args:_0x20a5f8,tdx:_0x3ec46e}=_0x16cde7,_0x33ec1d=_0x20a5f8[0x0];if(!_0x33ec1d)return console['error'](_0xc481d5(0x20f)),console[_0xc481d5(0x242)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x565141=![],_0x5952a9=_0x33ec1d;if(_0x33ec1d[_0xc481d5(0x229)](_0xc481d5(0x1e4)))_0x565141=!![],_0x5952a9=_0x33ec1d[_0xc481d5(0x221)](0x8);else{if(_0x33ec1d[_0xc481d5(0x229)](_0xc481d5(0x1f2)))_0x565141=![],_0x5952a9=_0x33ec1d[_0xc481d5(0x221)](0x8);else return console[_0xc481d5(0x242)](_0xc481d5(0x226)),console[_0xc481d5(0x242)](_0xc481d5(0x224)),0x1;}try{const _0x3bba61=_0x70c818[_0xc481d5(0x1dc)],_0x59ca0b=_0x70c818[_0xc481d5(0x20e)],_0x466eb3=_0x70c818[_0xc481d5(0x239)],_0x12e206=_0x70c818[_0xc481d5(0x21f)];_0x70c818['verbose']&&(console[_0xc481d5(0x242)](_0xc481d5(0x22c)+(_0x565141?_0xc481d5(0x254):_0xc481d5(0x23c))+'\x20'+_0x5952a9),_0x3bba61&&console['error'](_0xc481d5(0x214)+_0x3bba61),_0x59ca0b&&console[_0xc481d5(0x242)](_0xc481d5(0x233)+_0x59ca0b),_0x466eb3&&console[_0xc481d5(0x242)](_0xc481d5(0x1fe)+_0x466eb3),_0x12e206&&console[_0xc481d5(0x242)](_0xc481d5(0x210)));let _0x33f252;if(_0x466eb3)try{if(_0x466eb3[_0xc481d5(0x229)]('@')){const _0x4cf502=await import(_0xc481d5(0x230)),_0x3d6118=_0x466eb3['substring'](0x1),_0x1199dd=await _0x4cf502['readFile'](_0x3d6118,_0xc481d5(0x1d9));_0x33f252=JSON[_0xc481d5(0x225)](_0x1199dd);}else _0x33f252=JSON['parse'](_0x466eb3);}catch{return console[_0xc481d5(0x242)](_0xc481d5(0x20c)),0x1;}if(!_0x70c818['yes']){const _0x16e7ef=await confirm(_0xc481d5(0x240)+(_0x565141?'session':_0xc481d5(0x23c))+'\x20'+_0x5952a9+'?');if(!_0x16e7ef)return console[_0xc481d5(0x242)](_0xc481d5(0x22a)),0x0;}let _0x3a03c2;_0x565141?_0x3a03c2=await withSpinner(_0xc481d5(0x219),()=>_0x3ec46e['workflow']['retrySession'](_0x5952a9,{'fromTask':_0x3bba61,'retryParams':_0x33f252}),{'verbose':_0x70c818[_0xc481d5(0x216)]}):_0x3a03c2=await withSpinner('Retrying\x20attempt...',()=>_0x3ec46e['workflow'][_0xc481d5(0x21c)](_0x5952a9,{'resumeFrom':_0x59ca0b,'retryParams':_0x33f252,'force':_0x12e206}),{'verbose':_0x70c818[_0xc481d5(0x216)]});const _0x2e61ef=_0x3a03c2[_0xc481d5(0x206)];return console['error']('✔\x20Retry\x20started'),console[_0xc481d5(0x242)](_0xc481d5(0x1f4)+_0x2e61ef[_0xc481d5(0x20b)]),console[_0xc481d5(0x242)](_0xc481d5(0x22b)+_0x2e61ef[_0xc481d5(0x1df)]),0x0;}catch(_0x44c06a){if(_0x44c06a instanceof SDKError)return console[_0xc481d5(0x242)](_0xc481d5(0x235)+_0x44c06a[_0xc481d5(0x1e8)]),_0x44c06a[_0xc481d5(0x23f)]&&console[_0xc481d5(0x242)](_0xc481d5(0x201)+_0x44c06a['cause']),0x1;throw _0x44c06a;}}}export class WorkflowDownloadCommand extends BaseCommand{['name']=a32_0x36fa37(0x234);['description']='Download\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a32_0x36fa37(0x21e)](_0x20c7aa){const _0x366331=a32_0x36fa37,{options:_0x266831,args:_0x26f3c7,tdx:_0x4c8b0c}=_0x20c7aa,_0x137e0a=_0x26f3c7[0x0],_0x32b8db=_0x26f3c7[0x1]||'.';if(!_0x137e0a)return console[_0x366331(0x242)](_0x366331(0x209)),console[_0x366331(0x242)](_0x366331(0x236)),0x1;const _0x283ae3=_0x266831[_0x366331(0x1fd)];_0x266831[_0x366331(0x216)]&&(console[_0x366331(0x242)](_0x366331(0x24c)+_0x137e0a),console['error'](_0x366331(0x237)+_0x32b8db),_0x283ae3&&console[_0x366331(0x242)](_0x366331(0x1f1)+_0x283ae3));const _0x3b0d7b=await withSpinner(_0x366331(0x1ef)+_0x137e0a+_0x366331(0x208),()=>_0x4c8b0c[_0x366331(0x22e)]['download'](_0x137e0a,_0x32b8db,{'revision':_0x283ae3}),{'verbose':_0x266831[_0x366331(0x216)]}),_0x5dbb37=_0x3b0d7b['data'];return console[_0x366331(0x242)](_0x366331(0x1da)+_0x5dbb37[_0x366331(0x222)]),console[_0x366331(0x242)]('\x20\x20Revision:\x20'+_0x5dbb37[_0x366331(0x1fd)]),console[_0x366331(0x242)]('\x20\x20Files\x20extracted:\x20'+_0x5dbb37[_0x366331(0x1ea)]),console[_0x366331(0x242)](_0x366331(0x243)+_0x32b8db+'/'+_0x5dbb37[_0x366331(0x222)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a32_0x36fa37(0x1de)]=a32_0x36fa37(0x1e6);[a32_0x36fa37(0x200)]=a32_0x36fa37(0x1d8);async[a32_0x36fa37(0x21e)](_0x10c031){const _0x713543=a32_0x36fa37,{options:_0x201c86,args:_0x3d42e2,tdx:_0x51d5f4}=_0x10c031;let _0x742bdc='.',_0x143087=_0x201c86[_0x713543(0x1de)];if(_0x3d42e2[0x0]){const {promises:_0x1d2fdc}=await import('fs');try{const _0x517e9f=await _0x1d2fdc[_0x713543(0x238)](_0x3d42e2[0x0]);if(_0x517e9f[_0x713543(0x24e)]())_0x742bdc=_0x3d42e2[0x0];else return console[_0x713543(0x242)](_0x713543(0x235)+_0x3d42e2[0x0]+'\x20is\x20not\x20a\x20directory'),0x1;}catch{_0x143087=_0x3d42e2[0x0],_0x742bdc='.';}}const _0x226879=_0x201c86[_0x713543(0x1fd)],_0x159376=_0x201c86['skipValidation'];_0x201c86[_0x713543(0x216)]&&(console[_0x713543(0x242)](_0x713543(0x1e1)+_0x742bdc),_0x143087&&console[_0x713543(0x242)]('Project\x20name:\x20'+_0x143087),_0x226879&&console[_0x713543(0x242)](_0x713543(0x1f1)+_0x226879),_0x159376&&console['error'](_0x713543(0x245)));const _0x46b209=await withSpinner('Pushing\x20workflow\x20project...',()=>_0x51d5f4[_0x713543(0x22e)][_0x713543(0x1f5)](_0x742bdc,{'projectName':_0x143087,'revision':_0x226879,'skipValidation':_0x159376}),{'verbose':_0x201c86[_0x713543(0x216)]}),_0x3ddb69=_0x46b209[_0x713543(0x206)];return console[_0x713543(0x242)]('✔\x20Pushed\x20'+_0x3ddb69[_0x713543(0x222)]),console[_0x713543(0x242)](_0x713543(0x218)+_0x3ddb69['projectId']),console[_0x713543(0x242)](_0x713543(0x1e9)+_0x3ddb69[_0x713543(0x1fd)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a32_0x36fa37(0x1de)]=a32_0x36fa37(0x1f8);[a32_0x36fa37(0x200)]=a32_0x36fa37(0x247);async[a32_0x36fa37(0x21e)](_0x234ab7){const _0x4fddad=a32_0x36fa37,{options:_0xfe1ca3,args:_0x161a23,tdx:_0x5c3c14}=_0x234ab7,_0xa9ed53=_0x161a23[0x0];if(!_0xa9ed53)return console['error'](_0x4fddad(0x1e7)),console[_0x4fddad(0x242)](_0x4fddad(0x202)),0x1;_0xfe1ca3['verbose']&&console[_0x4fddad(0x242)](_0x4fddad(0x24c)+_0xa9ed53);if(!_0xfe1ca3[_0x4fddad(0x21a)]){const _0x335cb6=await confirm(_0x4fddad(0x24f)+_0xa9ed53+_0x4fddad(0x1d6));if(!_0x335cb6)return console[_0x4fddad(0x242)](_0x4fddad(0x22a)),0x0;}const _0x46902f=await withSpinner(_0x4fddad(0x248)+_0xa9ed53+_0x4fddad(0x208),()=>_0x5c3c14[_0x4fddad(0x22e)]['delete'](_0xa9ed53),{'verbose':_0xfe1ca3[_0x4fddad(0x216)]}),_0x12830c=_0x46902f[_0x4fddad(0x206)];return console[_0x4fddad(0x242)](_0x4fddad(0x1ed)+_0x12830c['projectName']),console[_0x4fddad(0x242)](_0x4fddad(0x218)+_0x12830c['projectId']),0x0;}}
|
|
1
|
+
const a32_0x5464de=a32_0x17ba;(function(_0x256e81,_0x2456ca){const _0x10b546=a32_0x17ba,_0x216856=_0x256e81();while(!![]){try{const _0x4669cd=parseInt(_0x10b546(0x19e))/0x1+-parseInt(_0x10b546(0x215))/0x2*(parseInt(_0x10b546(0x1d5))/0x3)+-parseInt(_0x10b546(0x1f6))/0x4*(parseInt(_0x10b546(0x1ba))/0x5)+parseInt(_0x10b546(0x1d6))/0x6+-parseInt(_0x10b546(0x1a6))/0x7+parseInt(_0x10b546(0x1de))/0x8+-parseInt(_0x10b546(0x1ff))/0x9;if(_0x4669cd===_0x2456ca)break;else _0x216856['push'](_0x216856['shift']());}catch(_0x1f9583){_0x216856['push'](_0x216856['shift']());}}}(a32_0x4c91,0xc43bd));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_0x5464de(0x1fb)]='workflow:projects';[a32_0x5464de(0x1a9)]='List\x20all\x20workflow\x20projects';async[a32_0x5464de(0x1d0)](_0x3b2b80){const _0x5be79e=a32_0x5464de,{options:_0x3b27bc,args:_0x463928,tdx:_0x48dcf8}=_0x3b2b80,_0x164548=_0x463928[0x0];try{_0x3b27bc[_0x5be79e(0x1b7)]&&_0x164548&&console['error']('Pattern:\x20'+_0x164548);const _0x1daf38=await withSpinner(_0x5be79e(0x218),()=>_0x48dcf8[_0x5be79e(0x1b9)][_0x5be79e(0x1ac)](_0x164548,{'limit':_0x3b27bc['limit']}),{'verbose':_0x3b27bc[_0x5be79e(0x1b7)]}),_0x4f5cb0=_0x1daf38[_0x5be79e(0x1d8)];return console['error']('✔\x20Found\x20'+_0x4f5cb0['length']+'\x20project'+(_0x4f5cb0['length']!==0x1?'s':'')),await handleSDKOutput(_0x4f5cb0,_0x3b27bc),0x0;}catch(_0x4759cf){if(_0x4759cf instanceof SDKError)return console[_0x5be79e(0x1a4)](_0x5be79e(0x1db)+_0x4759cf[_0x5be79e(0x1b1)]),_0x4759cf[_0x5be79e(0x1e6)]&&console[_0x5be79e(0x1a4)]('\x20\x20Cause:\x20'+_0x4759cf[_0x5be79e(0x1e6)]),0x1;throw _0x4759cf;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a32_0x5464de(0x1fb)]=a32_0x5464de(0x1c5);[a32_0x5464de(0x1a9)]=a32_0x5464de(0x217);async[a32_0x5464de(0x1d0)](_0x144c52){const _0x222a6e=a32_0x5464de,{options:_0x5682c9,args:_0x2e29ec,tdx:_0x51f1f5}=_0x144c52,_0x43d0d6=_0x2e29ec[0x0];try{_0x5682c9[_0x222a6e(0x1b7)]&&_0x43d0d6&&console[_0x222a6e(0x1a4)](_0x222a6e(0x1b3)+_0x43d0d6);const _0xbc5ce9=await withSpinner(_0x222a6e(0x1d3),()=>_0x51f1f5['workflow']['workflows'](_0x43d0d6,{'limit':_0x5682c9['limit']}),{'verbose':_0x5682c9['verbose']}),_0x2a8942=_0xbc5ce9[_0x222a6e(0x1d8)];return console['error'](_0x222a6e(0x1ae)+_0x2a8942[_0x222a6e(0x1ec)]+_0x222a6e(0x203)+(_0x2a8942[_0x222a6e(0x1ec)]!==0x1?'s':'')),await handleSDKOutput(_0x2a8942,_0x5682c9),0x0;}catch(_0x4a62e4){if(_0x4a62e4 instanceof SDKError)return console['error']('Error:\x20'+_0x4a62e4[_0x222a6e(0x1b1)]),_0x4a62e4[_0x222a6e(0x1e6)]&&console[_0x222a6e(0x1a4)](_0x222a6e(0x1aa)+_0x4a62e4['cause']),0x1;throw _0x4a62e4;}}}export class WorkflowSessionsCommand extends BaseCommand{[a32_0x5464de(0x1fb)]='workflow:sessions';['description']=a32_0x5464de(0x1ee);async[a32_0x5464de(0x1d0)](_0x4f05f7){const _0x3db96d=a32_0x5464de,{options:_0x5dcc20,args:_0x2ce3b9,tdx:_0xdae82c}=_0x4f05f7;let _0x35c3df,_0x3226ed;if(_0x2ce3b9[0x0]){const _0x569833=_0x2ce3b9[0x0][_0x3db96d(0x1df)]('.');if(_0x569833[_0x3db96d(0x1ec)]===0x1)_0x35c3df=_0x569833[0x0];else{if(_0x569833['length']===0x2)[_0x35c3df,_0x3226ed]=_0x569833;else return console[_0x3db96d(0x1a4)](_0x3db96d(0x214)),0x1;}}try{if(_0x5dcc20[_0x3db96d(0x1b7)]){if(_0x35c3df&&_0x3226ed)console[_0x3db96d(0x1a4)](_0x3db96d(0x1ca)+_0x35c3df+'.'+_0x3226ed);else _0x35c3df&&console[_0x3db96d(0x1a4)](_0x3db96d(0x1dc)+_0x35c3df);const _0x57baa1=_0x5dcc20[_0x3db96d(0x1d7)];_0x57baa1&&console[_0x3db96d(0x1a4)]('Status:\x20'+_0x57baa1);}const _0x555935=await withSpinner(_0x3db96d(0x1a7),()=>_0xdae82c[_0x3db96d(0x1b9)][_0x3db96d(0x1eb)]({'projectName':_0x35c3df,'workflowName':_0x3226ed,'status':_0x5dcc20['status'],'fromTime':_0x5dcc20['from'],'toTime':_0x5dcc20['to'],'limit':_0x5dcc20['limit']}),{'verbose':_0x5dcc20[_0x3db96d(0x1b7)]}),_0x51a58c=_0x555935['data'];return console[_0x3db96d(0x1a4)](_0x3db96d(0x1ae)+_0x51a58c[_0x3db96d(0x1ec)]+'\x20session'+(_0x51a58c[_0x3db96d(0x1ec)]!==0x1?'s':'')),await handleSDKOutput(_0x51a58c,_0x5dcc20),0x0;}catch(_0x4aeebb){if(_0x4aeebb instanceof SDKError)return console[_0x3db96d(0x1a4)]('Error:\x20'+_0x4aeebb[_0x3db96d(0x1b1)]),_0x4aeebb[_0x3db96d(0x1e6)]&&console['error'](_0x3db96d(0x1aa)+_0x4aeebb['cause']),0x1;throw _0x4aeebb;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a32_0x5464de(0x1fb)]=a32_0x5464de(0x212);[a32_0x5464de(0x1a9)]=a32_0x5464de(0x1cd);async[a32_0x5464de(0x1d0)](_0x1afe5c){const _0x303ed8=a32_0x5464de,{options:_0x21b9d3,args:_0x3684b9,tdx:_0x4755b7}=_0x1afe5c;let _0x777265,_0x1064bc;if(_0x3684b9[0x0]){const _0x540516=_0x3684b9[0x0][_0x303ed8(0x1df)]('.');if(_0x540516[_0x303ed8(0x1ec)]===0x1)_0x777265=_0x540516[0x0];else{if(_0x540516[_0x303ed8(0x1ec)]===0x2)[_0x777265,_0x1064bc]=_0x540516;else return console[_0x303ed8(0x1a4)]('Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow'),0x1;}}try{const _0x3dee6b=_0x21b9d3['includeRetried'];if(_0x21b9d3[_0x303ed8(0x1b7)]){if(_0x777265&&_0x1064bc)console[_0x303ed8(0x1a4)]('Filter:\x20'+_0x777265+'.'+_0x1064bc);else _0x777265&&console[_0x303ed8(0x1a4)](_0x303ed8(0x1dc)+_0x777265);_0x3dee6b&&console[_0x303ed8(0x1a4)](_0x303ed8(0x19f));}const _0x4dde43=await withSpinner(_0x303ed8(0x1bd),()=>_0x4755b7[_0x303ed8(0x1b9)][_0x303ed8(0x1d1)]({'projectName':_0x777265,'workflowName':_0x1064bc,'includeRetried':_0x3dee6b,'limit':_0x21b9d3[_0x303ed8(0x20e)]}),{'verbose':_0x21b9d3['verbose']}),_0x592031=_0x4dde43[_0x303ed8(0x1d8)];return console[_0x303ed8(0x1a4)]('✔\x20Found\x20'+_0x592031[_0x303ed8(0x1ec)]+_0x303ed8(0x1be)+(_0x592031[_0x303ed8(0x1ec)]!==0x1?'s':'')),await handleSDKOutput(_0x592031,_0x21b9d3),0x0;}catch(_0x12eefb){if(_0x12eefb instanceof SDKError)return console[_0x303ed8(0x1a4)](_0x303ed8(0x1db)+_0x12eefb[_0x303ed8(0x1b1)]),_0x12eefb[_0x303ed8(0x1e6)]&&console[_0x303ed8(0x1a4)](_0x303ed8(0x1aa)+_0x12eefb['cause']),0x1;throw _0x12eefb;}}}function a32_0x4c91(){const _0x37339a=['logs','479732ercJil','Include\x20retried:\x20yes','includeSubtasks','Reason:\x20','\x20log\x20entr','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','error','attempt','8354689PJngfA','Listing\x20workflow\x20sessions...','push','description','\x20\x20Cause:\x20','\x20task','projects','✔\x20Retry\x20started','✔\x20Found\x20','Getting\x20attempt\x20details...','Getting\x20task\x20logs...','message','workflow:kill','Project\x20filter:\x20','Download\x20workflow\x20project\x20from\x20Treasure\x20Data','offset','\x20\x20New\x20attempt\x20ID:\x20','verbose','session:','workflow','10225iEHqkR','Downloading\x20project\x20','workflow:retry','Listing\x20workflow\x20attempts...','\x20attempt','\x20\x20Location:\x20','kill','Error:\x20Invalid\x20JSON\x20in\x20--params','Show\x20logs\x20for\x20a\x20specific\x20task','Pushing\x20workflow\x20project...','\x20\x20Project\x20ID:\x20','workflow:workflows','Resume\x20from:\x20','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','workflow:delete','stat','Filter:\x20','revision','Attempt\x20ID:\x20','List\x20workflow\x20attempts','params','yes','execute','attempts','Retrying\x20session...','Listing\x20workflows...','fs/promises','503211lxMtMc','9014340dfHOBx','status','data','projectId','fromTask','Error:\x20','Filter:\x20project=','Output\x20directory:\x20','6313056cXDKgH','split','Cancelled','✔\x20Deleted\x20project\x20','Error:\x20Attempt\x20ID\x20and\x20task\x20name\x20are\x20required','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','Show\x20specific\x20attempt\x20details','Error:\x20Project\x20name\x20is\x20required','cause','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','\x20\x20Session\x20ID:\x20','Project:\x20','tasks','sessions','length','attemptId','List\x20workflow\x20execution\x20sessions','workflow:attempt','\x22?\x20This\x20cannot\x20be\x20undone.','delete','Force:\x20yes','parse','utf-8','...','340cewlbW','Usage:\x20workflow:delete\x20<project-name-or-id>','Error:\x20Attempt\x20ID\x20is\x20required','Task\x20name:\x20','✔\x20Pushed\x20','name','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','reason','Params:\x20','2381895tVUXPb','isDirectory','session','From\x20task:\x20','\x20workflow','\x20is\x20not\x20a\x20directory','workflow:logs','Revision:\x20','✔\x20Downloaded\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','force','substring','download','Validation:\x20skipped','Kill\x20a\x20running\x20attempt','limit','projectName','\x20\x20Revision:\x20','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','workflow:attempts','Deleting\x20project\x20','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','4mvYmtR','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','List\x20workflows','Listing\x20workflow\x20projects...','Killing\x20attempt...','startsWith'];a32_0x4c91=function(){return _0x37339a;};return a32_0x4c91();}export class WorkflowAttemptCommand extends BaseCommand{['name']=a32_0x5464de(0x1ef);[a32_0x5464de(0x1a9)]=a32_0x5464de(0x1e4);async[a32_0x5464de(0x1d0)](_0x5a98dd){const _0x52b81d=a32_0x5464de,{options:_0x16d4d2,args:_0x18849f,tdx:_0x3069c3}=_0x5a98dd,_0x5a9d7a=_0x18849f[0x0];if(!_0x5a9d7a)return console[_0x52b81d(0x1a4)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{_0x16d4d2['verbose']&&console['error'](_0x52b81d(0x1cc)+_0x5a9d7a);const _0x16b0a4=await withSpinner(_0x52b81d(0x1af),()=>_0x3069c3[_0x52b81d(0x1b9)][_0x52b81d(0x1a5)](_0x5a9d7a),{'verbose':_0x16d4d2[_0x52b81d(0x1b7)]}),_0x5b06cf=_0x16b0a4[_0x52b81d(0x1d8)];return await handleSDKOutput([_0x5b06cf],_0x16d4d2),0x0;}catch(_0x206b95){if(_0x206b95 instanceof SDKError)return console[_0x52b81d(0x1a4)](_0x52b81d(0x1db)+_0x206b95[_0x52b81d(0x1b1)]),_0x206b95[_0x52b81d(0x1e6)]&&console[_0x52b81d(0x1a4)](_0x52b81d(0x1aa)+_0x206b95['cause']),0x1;throw _0x206b95;}}}export class WorkflowTasksCommand extends BaseCommand{[a32_0x5464de(0x1fb)]='workflow:tasks';[a32_0x5464de(0x1a9)]='Show\x20tasks\x20for\x20an\x20attempt';async[a32_0x5464de(0x1d0)](_0x4fbd1b){const _0x5b834f=a32_0x5464de,{options:_0x59b5c3,args:_0x362a50,tdx:_0x4c5b77}=_0x4fbd1b,_0x33c411=_0x362a50[0x0];if(!_0x33c411)return console[_0x5b834f(0x1a4)](_0x5b834f(0x1f8)),0x1;try{const _0x5c97f0=_0x59b5c3[_0x5b834f(0x1a0)];_0x59b5c3['verbose']&&(console[_0x5b834f(0x1a4)](_0x5b834f(0x1cc)+_0x33c411),_0x5c97f0&&console[_0x5b834f(0x1a4)]('Including\x20subtasks:\x20yes'));const _0xffdbe0=await withSpinner('Getting\x20attempt\x20tasks...',()=>_0x4c5b77[_0x5b834f(0x1b9)][_0x5b834f(0x1ea)](_0x33c411,_0x5c97f0||![]),{'verbose':_0x59b5c3[_0x5b834f(0x1b7)]}),_0x49e35d=_0xffdbe0['data'];return console[_0x5b834f(0x1a4)](_0x5b834f(0x1ae)+_0x49e35d[_0x5b834f(0x1ec)]+_0x5b834f(0x1ab)+(_0x49e35d['length']!==0x1?'s':'')),await handleSDKOutput(_0x49e35d,_0x59b5c3),0x0;}catch(_0x3090ef){if(_0x3090ef instanceof SDKError)return console[_0x5b834f(0x1a4)](_0x5b834f(0x1db)+_0x3090ef[_0x5b834f(0x1b1)]),_0x3090ef[_0x5b834f(0x1e6)]&&console['error'](_0x5b834f(0x1aa)+_0x3090ef[_0x5b834f(0x1e6)]),0x1;throw _0x3090ef;}}}function a32_0x17ba(_0x47d5c2,_0x18a27a){const _0x4c910a=a32_0x4c91();return a32_0x17ba=function(_0x17ba6c,_0x313a98){_0x17ba6c=_0x17ba6c-0x19c;let _0xa50dc=_0x4c910a[_0x17ba6c];return _0xa50dc;},a32_0x17ba(_0x47d5c2,_0x18a27a);}export class WorkflowLogsCommand extends BaseCommand{[a32_0x5464de(0x1fb)]=a32_0x5464de(0x205);[a32_0x5464de(0x1a9)]=a32_0x5464de(0x1c2);async[a32_0x5464de(0x1d0)](_0x5ac784){const _0xb7f34a=a32_0x5464de,{options:_0x4c3587,args:_0x5b700f,tdx:_0x37327b}=_0x5ac784,_0x52576a=_0x5b700f[0x0],_0x1186a2=_0x5b700f[0x1];if(!_0x52576a||!_0x1186a2)return console[_0xb7f34a(0x1a4)](_0xb7f34a(0x1e2)),0x1;try{_0x4c3587[_0xb7f34a(0x1b7)]&&(console['error'](_0xb7f34a(0x1cc)+_0x52576a),console[_0xb7f34a(0x1a4)](_0xb7f34a(0x1f9)+_0x1186a2));const _0x3c86d6=_0x4c3587[_0xb7f34a(0x1b5)],_0x3e710a=await withSpinner(_0xb7f34a(0x1b0),()=>_0x37327b[_0xb7f34a(0x1b9)][_0xb7f34a(0x19d)](_0x52576a,_0x1186a2,{'offset':_0x3c86d6,'limit':_0x4c3587['limit']}),{'verbose':_0x4c3587[_0xb7f34a(0x1b7)]}),_0x295db0=_0x3e710a['data'];return console[_0xb7f34a(0x1a4)](_0xb7f34a(0x1ae)+_0x295db0[_0xb7f34a(0x1ec)]+_0xb7f34a(0x1a2)+(_0x295db0[_0xb7f34a(0x1ec)]!==0x1?'ies':'y')),await handleSDKOutput(_0x295db0,_0x4c3587),0x0;}catch(_0x2b3d70){if(_0x2b3d70 instanceof SDKError)return console[_0xb7f34a(0x1a4)]('Error:\x20'+_0x2b3d70[_0xb7f34a(0x1b1)]),_0x2b3d70[_0xb7f34a(0x1e6)]&&console[_0xb7f34a(0x1a4)](_0xb7f34a(0x1aa)+_0x2b3d70[_0xb7f34a(0x1e6)]),0x1;throw _0x2b3d70;}}}export class WorkflowKillCommand extends BaseCommand{['name']=a32_0x5464de(0x1b2);[a32_0x5464de(0x1a9)]=a32_0x5464de(0x20d);async['execute'](_0xec8d9b){const _0x28ccbb=a32_0x5464de,{options:_0x254112,args:_0x3b487f,tdx:_0x1cec77}=_0xec8d9b,_0x557b84=_0x3b487f[0x0];if(!_0x557b84)return console[_0x28ccbb(0x1a4)]('Error:\x20Attempt\x20ID\x20is\x20required'),0x1;try{const _0x1ea6f9=_0x254112[_0x28ccbb(0x1fd)];_0x254112[_0x28ccbb(0x1b7)]&&(console[_0x28ccbb(0x1a4)](_0x28ccbb(0x1cc)+_0x557b84),_0x1ea6f9&&console['error'](_0x28ccbb(0x1a1)+_0x1ea6f9));if(!_0x254112[_0x28ccbb(0x1cf)]){const _0x53a8d3=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20'+_0x557b84+'?');if(!_0x53a8d3)return console[_0x28ccbb(0x1a4)](_0x28ccbb(0x1e0)),0x0;}const _0x1d3c66=await withSpinner(_0x28ccbb(0x219),()=>_0x1cec77[_0x28ccbb(0x1b9)][_0x28ccbb(0x1c0)](_0x557b84,_0x1ea6f9),{'verbose':_0x254112[_0x28ccbb(0x1b7)]}),_0x97ec90=_0x1d3c66[_0x28ccbb(0x1d8)];return console[_0x28ccbb(0x1a4)]('✔\x20'+_0x97ec90),0x0;}catch(_0x8932cf){if(_0x8932cf instanceof SDKError)return console[_0x28ccbb(0x1a4)](_0x28ccbb(0x1db)+_0x8932cf[_0x28ccbb(0x1b1)]),_0x8932cf['cause']&&console[_0x28ccbb(0x1a4)](_0x28ccbb(0x1aa)+_0x8932cf['cause']),0x1;throw _0x8932cf;}}}export class WorkflowRetryCommand extends BaseCommand{['name']=a32_0x5464de(0x1bc);['description']='Retry\x20a\x20session\x20or\x20attempt';async[a32_0x5464de(0x1d0)](_0x3738fc){const _0x5f308a=a32_0x5464de,{options:_0x288fdb,args:_0x3ee2d3,tdx:_0x32fa20}=_0x3738fc,_0x55f241=_0x3ee2d3[0x0];if(!_0x55f241)return console[_0x5f308a(0x1a4)](_0x5f308a(0x1e3)),console[_0x5f308a(0x1a4)](_0x5f308a(0x1a3)),0x1;let _0x394b58=![],_0x56f804=_0x55f241;if(_0x55f241[_0x5f308a(0x19c)](_0x5f308a(0x1b8)))_0x394b58=!![],_0x56f804=_0x55f241[_0x5f308a(0x20a)](0x8);else{if(_0x55f241[_0x5f308a(0x19c)]('attempt:'))_0x394b58=![],_0x56f804=_0x55f241['substring'](0x8);else return console[_0x5f308a(0x1a4)](_0x5f308a(0x1e7)),console[_0x5f308a(0x1a4)](_0x5f308a(0x1a3)),0x1;}try{const _0x8a5ed4=_0x288fdb[_0x5f308a(0x1da)],_0x1e1a82=_0x288fdb['resumeFrom'],_0x2eaed1=_0x288fdb[_0x5f308a(0x1ce)],_0x2faf7a=_0x288fdb[_0x5f308a(0x209)];_0x288fdb[_0x5f308a(0x1b7)]&&(console[_0x5f308a(0x1a4)]('Target:\x20'+(_0x394b58?'session':'attempt')+'\x20'+_0x56f804),_0x8a5ed4&&console['error'](_0x5f308a(0x202)+_0x8a5ed4),_0x1e1a82&&console[_0x5f308a(0x1a4)](_0x5f308a(0x1c6)+_0x1e1a82),_0x2eaed1&&console[_0x5f308a(0x1a4)](_0x5f308a(0x1fe)+_0x2eaed1),_0x2faf7a&&console['error'](_0x5f308a(0x1f2)));let _0x1c0344;if(_0x2eaed1)try{if(_0x2eaed1[_0x5f308a(0x19c)]('@')){const _0x2edcdb=await import(_0x5f308a(0x1d4)),_0x10de58=_0x2eaed1[_0x5f308a(0x20a)](0x1),_0x30ffc2=await _0x2edcdb['readFile'](_0x10de58,_0x5f308a(0x1f4));_0x1c0344=JSON[_0x5f308a(0x1f3)](_0x30ffc2);}else _0x1c0344=JSON[_0x5f308a(0x1f3)](_0x2eaed1);}catch{return console[_0x5f308a(0x1a4)](_0x5f308a(0x1c1)),0x1;}if(!_0x288fdb['yes']){const _0x29f817=await confirm(_0x5f308a(0x208)+(_0x394b58?_0x5f308a(0x201):_0x5f308a(0x1a5))+'\x20'+_0x56f804+'?');if(!_0x29f817)return console[_0x5f308a(0x1a4)](_0x5f308a(0x1e0)),0x0;}let _0x5b5963;_0x394b58?_0x5b5963=await withSpinner(_0x5f308a(0x1d2),()=>_0x32fa20[_0x5f308a(0x1b9)]['retrySession'](_0x56f804,{'fromTask':_0x8a5ed4,'retryParams':_0x1c0344}),{'verbose':_0x288fdb[_0x5f308a(0x1b7)]}):_0x5b5963=await withSpinner('Retrying\x20attempt...',()=>_0x32fa20['workflow']['retryAttempt'](_0x56f804,{'resumeFrom':_0x1e1a82,'retryParams':_0x1c0344,'force':_0x2faf7a}),{'verbose':_0x288fdb[_0x5f308a(0x1b7)]});const _0x508f65=_0x5b5963['data'];return console[_0x5f308a(0x1a4)](_0x5f308a(0x1ad)),console[_0x5f308a(0x1a4)](_0x5f308a(0x1b6)+_0x508f65[_0x5f308a(0x1ed)]),console[_0x5f308a(0x1a4)](_0x5f308a(0x1e8)+_0x508f65['sessionId']),0x0;}catch(_0x251523){if(_0x251523 instanceof SDKError)return console[_0x5f308a(0x1a4)](_0x5f308a(0x1db)+_0x251523[_0x5f308a(0x1b1)]),_0x251523['cause']&&console[_0x5f308a(0x1a4)](_0x5f308a(0x1aa)+_0x251523[_0x5f308a(0x1e6)]),0x1;throw _0x251523;}}}export class WorkflowDownloadCommand extends BaseCommand{[a32_0x5464de(0x1fb)]='workflow:download';[a32_0x5464de(0x1a9)]=a32_0x5464de(0x1b4);async['execute'](_0xa1e2e0){const _0x315fbf=a32_0x5464de,{options:_0x34296f,args:_0x33618e,tdx:_0x2a86a5}=_0xa1e2e0,_0x3b3668=_0x33618e[0x0],_0x402c38=_0x33618e[0x1]||'.';if(!_0x3b3668)return console[_0x315fbf(0x1a4)](_0x315fbf(0x1e5)),console[_0x315fbf(0x1a4)](_0x315fbf(0x1fc)),0x1;const _0x34efaf=_0x34296f[_0x315fbf(0x1cb)];_0x34296f[_0x315fbf(0x1b7)]&&(console[_0x315fbf(0x1a4)](_0x315fbf(0x1e9)+_0x3b3668),console[_0x315fbf(0x1a4)](_0x315fbf(0x1dd)+_0x402c38),_0x34efaf&&console[_0x315fbf(0x1a4)](_0x315fbf(0x206)+_0x34efaf));const _0x31e668=await withSpinner(_0x315fbf(0x1bb)+_0x3b3668+'...',()=>_0x2a86a5[_0x315fbf(0x1b9)][_0x315fbf(0x20b)](_0x3b3668,_0x402c38,{'revision':_0x34efaf}),{'verbose':_0x34296f[_0x315fbf(0x1b7)]}),_0x2257b7=_0x31e668[_0x315fbf(0x1d8)];return console[_0x315fbf(0x1a4)](_0x315fbf(0x207)+_0x2257b7[_0x315fbf(0x20f)]),console['error'](_0x315fbf(0x210)+_0x2257b7[_0x315fbf(0x1cb)]),console[_0x315fbf(0x1a4)]('\x20\x20Files\x20extracted:\x20'+_0x2257b7['filesExtracted']),console['error'](_0x315fbf(0x1bf)+_0x402c38+'/'+_0x2257b7[_0x315fbf(0x20f)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{['name']='workflow:push';['description']='Push\x20workflow\x20project\x20to\x20Treasure\x20Data';async[a32_0x5464de(0x1d0)](_0x1e70ce){const _0x44219e=a32_0x5464de,{options:_0x476198,args:_0x2df4c2,tdx:_0x55b5d9}=_0x1e70ce;let _0xd6a6f5='.',_0x33091c=_0x476198[_0x44219e(0x1fb)];if(_0x2df4c2[0x0]){const {promises:_0x10871b}=await import('fs');try{const _0x14b7a8=await _0x10871b[_0x44219e(0x1c9)](_0x2df4c2[0x0]);if(_0x14b7a8[_0x44219e(0x200)]())_0xd6a6f5=_0x2df4c2[0x0];else return console[_0x44219e(0x1a4)](_0x44219e(0x1db)+_0x2df4c2[0x0]+_0x44219e(0x204)),0x1;}catch{_0x33091c=_0x2df4c2[0x0],_0xd6a6f5='.';}}const _0x13aa43=_0x476198[_0x44219e(0x1cb)],_0x2e2ab8=_0x476198['skipValidation'];_0x476198['verbose']&&(console[_0x44219e(0x1a4)]('Project\x20directory:\x20'+_0xd6a6f5),_0x33091c&&console[_0x44219e(0x1a4)]('Project\x20name:\x20'+_0x33091c),_0x13aa43&&console[_0x44219e(0x1a4)](_0x44219e(0x206)+_0x13aa43),_0x2e2ab8&&console[_0x44219e(0x1a4)](_0x44219e(0x20c)));const _0x2a3ae9=await withSpinner(_0x44219e(0x1c3),()=>_0x55b5d9[_0x44219e(0x1b9)][_0x44219e(0x1a8)](_0xd6a6f5,{'projectName':_0x33091c,'revision':_0x13aa43,'skipValidation':_0x2e2ab8}),{'verbose':_0x476198[_0x44219e(0x1b7)]}),_0x17c81a=_0x2a3ae9[_0x44219e(0x1d8)];return console[_0x44219e(0x1a4)](_0x44219e(0x1fa)+_0x17c81a['projectName']),console[_0x44219e(0x1a4)](_0x44219e(0x1c4)+_0x17c81a['projectId']),console[_0x44219e(0x1a4)]('\x20\x20Revision:\x20'+_0x17c81a[_0x44219e(0x1cb)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{[a32_0x5464de(0x1fb)]=a32_0x5464de(0x1c8);['description']=a32_0x5464de(0x1c7);async['execute'](_0x3c286f){const _0x42a1e3=a32_0x5464de,{options:_0x170a7b,args:_0x49d958,tdx:_0x23fee0}=_0x3c286f,_0x23d844=_0x49d958[0x0];if(!_0x23d844)return console[_0x42a1e3(0x1a4)](_0x42a1e3(0x211)),console['error'](_0x42a1e3(0x1f7)),0x1;_0x170a7b[_0x42a1e3(0x1b7)]&&console[_0x42a1e3(0x1a4)](_0x42a1e3(0x1e9)+_0x23d844);if(!_0x170a7b[_0x42a1e3(0x1cf)]){const _0x125200=await confirm(_0x42a1e3(0x216)+_0x23d844+_0x42a1e3(0x1f0));if(!_0x125200)return console[_0x42a1e3(0x1a4)](_0x42a1e3(0x1e0)),0x0;}const _0x5739c6=await withSpinner(_0x42a1e3(0x213)+_0x23d844+_0x42a1e3(0x1f5),()=>_0x23fee0['workflow'][_0x42a1e3(0x1f1)](_0x23d844),{'verbose':_0x170a7b[_0x42a1e3(0x1b7)]}),_0x155a56=_0x5739c6[_0x42a1e3(0x1d8)];return console['error'](_0x42a1e3(0x1e1)+_0x155a56[_0x42a1e3(0x20f)]),console[_0x42a1e3(0x1a4)](_0x42a1e3(0x1c4)+_0x155a56[_0x42a1e3(0x1d9)]),0x0;}}
|
package/dist/core/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2baf41,_0x5ec8fb){const _0x5169e1=a33_0x1a44,_0x5ef17e=_0x2baf41();while(!![]){try{const _0x5eeebb=parseInt(_0x5169e1(0xad))/0x1*(-parseInt(_0x5169e1(0xa6))/0x2)+parseInt(_0x5169e1(0xa5))/0x3+-parseInt(_0x5169e1(0xb1))/0x4*(-parseInt(_0x5169e1(0x9e))/0x5)+parseInt(_0x5169e1(0x9b))/0x6*(-parseInt(_0x5169e1(0xae))/0x7)+-parseInt(_0x5169e1(0xa8))/0x8*(parseInt(_0x5169e1(0x9c))/0x9)+-parseInt(_0x5169e1(0x9f))/0xa*(-parseInt(_0x5169e1(0xa9))/0xb)+-parseInt(_0x5169e1(0xb0))/0xc*(-parseInt(_0x5169e1(0xab))/0xd);if(_0x5eeebb===_0x5ec8fb)break;else _0x5ef17e['push'](_0x5ef17e['shift']());}catch(_0x2893d9){_0x5ef17e['push'](_0x5ef17e['shift']());}}}(a33_0x56a7,0xc3047));import{platform}from'os';import{readFileSync}from'fs';function a33_0x1a44(_0x11cb23,_0x152140){const _0x56a7c9=a33_0x56a7();return a33_0x1a44=function(_0x1a4497,_0x4695ed){_0x1a4497=_0x1a4497-0x9a;let _0x2a02a9=_0x56a7c9[_0x1a4497];return _0x2a02a9;},a33_0x1a44(_0x11cb23,_0x152140);}import{fileURLToPath}from'url';import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x2383cb=a33_0x1a44;try{const _0x52947d=fileURLToPath(import.meta[_0x2383cb(0xac)]),_0x190eed=dirname(_0x52947d),_0x2daffb=join(_0x190eed,_0x2383cb(0xa2)),_0x16e93f=JSON[_0x2383cb(0xaf)](readFileSync(_0x2daffb,_0x2383cb(0x9d)));return _0x16e93f[_0x2383cb(0xa3)];}catch{return'0.0.0';}}export function getUserAgent(){const _0x5a37dc=a33_0x1a44,_0x562b61=getVersion(),_0x50b3a9=platform(),_0x16c452=process[_0x5a37dc(0xa3)]['replace']('v','');return _0x5a37dc(0xa7)+_0x562b61+'\x20('+_0x50b3a9+_0x5a37dc(0x9a)+_0x16c452+')';}export function getAuthHeaders(_0x6b9785,_0x2e795f){const _0x964b2c=a33_0x1a44,_0x5bc459=getVersion(),_0x47b04c={'User-Agent':getUserAgent(),'X-TD-Client':_0x964b2c(0xa1),'X-TD-Client-Version':_0x5bc459};return _0x2e795f&&(_0x47b04c['Authorization']=_0x964b2c(0xaa)+_0x2e795f),_0x47b04c;}export function toHeaderRecord(_0x39318f){const _0x59b04d={};for(const [_0x23d16d,_0x7f4b75]of Object['entries'](_0x39318f)){_0x7f4b75!==undefined&&(_0x59b04d[_0x23d16d]=_0x7f4b75);}return _0x59b04d;}function a33_0x56a7(){const _0x5607bd=['104eukGQc','url','647559XArWMk','35uyPKsC','parse','304872vZBKoT','4fCKEfU',';\x20node/','1760370FnSlLG','225lIpENF','utf-8','6823330JpHdUU','1777210LesqkP','Authorization','tdx','../../package.json','version','length','4592217tAHiBt','2eDIyxy','tdx/','457400LihtYY','77UZLgLR','TD1\x20'];a33_0x56a7=function(){return _0x5607bd;};return a33_0x56a7();}export function getTrinoHeaders(_0x2cb3fb,_0x5292d6){const _0x348a6f=a33_0x1a44,_0xe5a9df=getAuthHeaders(_0x2cb3fb,_0x5292d6),_0x6b205d=toHeaderRecord(_0xe5a9df);return delete _0x6b205d[_0x348a6f(0xa0)],_0x5292d6&&(_0x6b205d['X-Trino-User']=_0x5292d6),_0x6b205d;}export function hasAPIKey(_0x476cb6){const _0x366cf7=a33_0x1a44,_0xd16b77=getAPIKey(_0x476cb6);return _0xd16b77!==undefined&&_0xd16b77[_0x366cf7(0xa4)]>0x0;}
|
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1a39b9,_0x3a85a9){const _0x55af88=a34_0x953f,_0x38370a=_0x1a39b9();while(!![]){try{const _0xc886b6=parseInt(_0x55af88(0x10f))/0x1+-parseInt(_0x55af88(0x106))/0x2+parseInt(_0x55af88(0x108))/0x3+parseInt(_0x55af88(0x12f))/0x4+parseInt(_0x55af88(0x11a))/0x5+-parseInt(_0x55af88(0x117))/0x6*(-parseInt(_0x55af88(0x12d))/0x7)+-parseInt(_0x55af88(0x12a))/0x8;if(_0xc886b6===_0x3a85a9)break;else _0x38370a['push'](_0x38370a['shift']());}catch(_0x1d0ca9){_0x38370a['push'](_0x38370a['shift']());}}}(a34_0x6ac8,0x9cd7b));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync}from'fs';import*as a34_0x5e00a2 from'node:fs';import*as a34_0x475eb8 from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';export function getConfigDir(){const _0x3f62fb=a34_0x953f;return process[_0x3f62fb(0x138)][_0x3f62fb(0x122)]||join(homedir(),_0x3f62fb(0x119),_0x3f62fb(0x136));}export function getConfigFile(){return join(getConfigDir(),'.env');}export function getCacheDir(){const _0x192bcb=a34_0x953f;return process[_0x192bcb(0x138)][_0x192bcb(0x10d)]||join(homedir(),_0x192bcb(0x12e),'tdx');}export function getLLMProjectCacheFile(){const _0x189ebe=a34_0x953f;return join(getCacheDir(),_0x189ebe(0x11c));}export function readCachedLLMProject(){const _0x44bbe2=a34_0x953f;try{const _0x28cfb7=getLLMProjectCacheFile();if(!existsSync(_0x28cfb7))return null;return readFileSync(_0x28cfb7,_0x44bbe2(0x109))[_0x44bbe2(0x114)]();}catch{return null;}}export function writeCachedLLMProject(_0x184554){const _0xf4d523=a34_0x953f;try{const _0x52e49d=getCacheDir(),_0x2cadab=getLLMProjectCacheFile();!existsSync(_0x52e49d)&&mkdirSync(_0x52e49d,{'recursive':!![]}),writeFileSync(_0x2cadab,_0x184554,_0xf4d523(0x109));}catch(_0x1bd78f){console[_0xf4d523(0x113)](_0xf4d523(0x123),_0x1bd78f);}}function a34_0x953f(_0x443e26,_0x47514b){const _0x6ac8d=a34_0x6ac8();return a34_0x953f=function(_0x953fc4,_0x9cd24f){_0x953fc4=_0x953fc4-0x105;let _0x227730=_0x6ac8d[_0x953fc4];return _0x227730;},a34_0x953f(_0x443e26,_0x47514b);}export function parseEnvFile(_0x458db4){const _0x10cd8c=a34_0x953f,_0x2531b1={};for(const _0x285cee of _0x458db4[_0x10cd8c(0x110)]('\x0a')){const _0x400afb=_0x285cee[_0x10cd8c(0x114)]();if(!_0x400afb||_0x400afb['startsWith']('#'))continue;const _0x22c2a7=_0x400afb[_0x10cd8c(0x11b)](/^([^=]+)=(.*)$/);if(_0x22c2a7){const _0x5162c2=_0x22c2a7[0x1][_0x10cd8c(0x114)]();let _0x54c988=_0x22c2a7[0x2][_0x10cd8c(0x114)]();(_0x54c988[_0x10cd8c(0x124)]('\x22')&&_0x54c988[_0x10cd8c(0x105)]('\x22')||_0x54c988[_0x10cd8c(0x124)]('\x27')&&_0x54c988[_0x10cd8c(0x105)]('\x27'))&&(_0x54c988=_0x54c988[_0x10cd8c(0x118)](0x1,-0x1)),_0x2531b1[_0x5162c2]=_0x54c988;}}return _0x2531b1;}export function readUserConfig(){const _0x41214c=a34_0x953f,_0xd2fbc4=getConfigFile();if(!existsSync(_0xd2fbc4))return{};try{const _0x24b7d9=readFileSync(_0xd2fbc4,'utf-8');return parseEnvFile(_0x24b7d9);}catch(_0x4c4bce){return console[_0x41214c(0x10a)](_0x41214c(0x134)+_0xd2fbc4+':',_0x4c4bce),{};}}export function resolveSite(_0x1f99bb){const _0x2ebfe0=a34_0x953f,_0x133c7a=[_0x2ebfe0(0x121),'jp01',_0x2ebfe0(0x139),'ap02',_0x2ebfe0(0x111),_0x2ebfe0(0x131),_0x2ebfe0(0x130),_0x2ebfe0(0x126),_0x2ebfe0(0x132),'stg-ap03'];if(_0x133c7a[_0x2ebfe0(0x10e)](_0x1f99bb))return _0x1f99bb;if(_0x1f99bb in SITE_ALIASES)return SITE_ALIASES[_0x1f99bb];return console[_0x2ebfe0(0x10a)](_0x2ebfe0(0x107)+_0x1f99bb+_0x2ebfe0(0x115)),_0x2ebfe0(0x121);}let cachedUserConfig=null;function a34_0x6ac8(){const _0x5771bf=['TDX_CONFIG_DIR','Warning:\x20Failed\x20to\x20cache\x20LLM\x20project\x20name:','startsWith','global:\x20','stg-us01','Warning:\x20Failed\x20to\x20load\x20','map','ap02','31703056xSjVtq','TD_API_KEY_','toUpperCase','36092mFFGIy','.cache','4176784jmDrNC','dev-eu01','dev-us01','stg-jp01','stg-ap03','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','apiKeys','tdx','env:\x20TD_API_KEY','env','eu01','TD_API_KEY','endsWith','338554FbIOmn','Warning:\x20Unknown\x20site\x20\x27','3597555zJDqeW','utf-8','warn','existsSync','readFileSync','TDX_CACHE_DIR','includes','138491FaVFUv','split','ap03','replace','error','trim','\x27,\x20defaulting\x20to\x20us01','\x20(TD_API_KEY)','1374yonhZD','slice','.config','6059950KPkWPB','match','llm_default_project','tdx.json','jp01','join','profile:\x20','us01'];a34_0x6ac8=function(){return _0x5771bf;};return a34_0x6ac8();}export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x2bd9e1,_0x3919c4){const _0x53641b=a34_0x953f,_0x122590=_0x2bd9e1[_0x53641b(0x12c)]()[_0x53641b(0x112)](/-/g,'_'),_0x14c034=_0x53641b(0x12b)+_0x122590;if(process['env'][_0x14c034])return process['env'][_0x14c034];if(process[_0x53641b(0x138)][_0x53641b(0x13a)])return process[_0x53641b(0x138)][_0x53641b(0x13a)];const _0x32a2b0=_0x3919c4||getActiveProfileName();if(_0x32a2b0){const _0x5e7ba6=loadProfileEnv(_0x32a2b0);if(_0x5e7ba6){if(_0x5e7ba6[_0x14c034])return _0x5e7ba6[_0x14c034];if(_0x5e7ba6[_0x53641b(0x13a)])return _0x5e7ba6[_0x53641b(0x13a)];}}const _0x3f499f=loadUserConfigOnce();if(_0x3f499f[_0x14c034])return _0x3f499f[_0x14c034];if(_0x3f499f[_0x53641b(0x13a)])return _0x3f499f[_0x53641b(0x13a)];return undefined;}export function getAPIKeySource(_0x19e522,_0x2793fd){const _0x333012=a34_0x953f,_0x568da1=_0x333012(0x12b)+_0x19e522['toUpperCase']()[_0x333012(0x112)](/-/g,'_');if(process['env'][_0x568da1])return'env:\x20'+_0x568da1;if(process[_0x333012(0x138)][_0x333012(0x13a)])return _0x333012(0x137);const _0x6bc6c4=_0x2793fd||getActiveProfileName();if(_0x6bc6c4){const _0x114fef=loadProfileEnv(_0x6bc6c4);if(_0x114fef){if(_0x114fef[_0x568da1])return _0x333012(0x120)+_0x6bc6c4+'\x20('+_0x568da1+')';if(_0x114fef['TD_API_KEY'])return _0x333012(0x120)+_0x6bc6c4+_0x333012(0x116);}}const _0x1b2879=loadUserConfigOnce(),_0x2cf826=getConfigFile();if(_0x1b2879[_0x568da1])return _0x333012(0x125)+_0x2cf826+'\x20('+_0x568da1+')';if(_0x1b2879['TD_API_KEY'])return _0x333012(0x125)+_0x2cf826+_0x333012(0x116);return null;}function loadProfileEnv(_0xd29de0){const _0x40edfc=a34_0x953f,_0x52360e=a34_0x475eb8[_0x40edfc(0x11f)](getConfigDir(),'.env.'+_0xd29de0);if(a34_0x5e00a2['existsSync'](_0x52360e)){validateSecureFilePermissions(_0x52360e);try{const _0x2b042a=a34_0x5e00a2[_0x40edfc(0x10c)](_0x52360e,'utf-8');return parseEnvFile(_0x2b042a);}catch(_0x148149){console[_0x40edfc(0x10a)](_0x40edfc(0x127)+_0x52360e+':\x20'+_0x148149);}}const _0x2c1fb7=a34_0x475eb8[_0x40edfc(0x11f)](getConfigDir(),'profiles',_0xd29de0,'.env');if(a34_0x5e00a2[_0x40edfc(0x10b)](_0x2c1fb7)){validateSecureFilePermissions(_0x2c1fb7);try{const _0x14447e=a34_0x5e00a2[_0x40edfc(0x10c)](_0x2c1fb7,'utf-8');return parseEnvFile(_0x14447e);}catch(_0x1fbe7e){return console['warn'](_0x40edfc(0x127)+_0x2c1fb7+':\x20'+_0x1fbe7e),null;}}return null;}function getActiveProfileName(){const _0x10f38d=a34_0x953f,_0x56b597=a34_0x475eb8[_0x10f38d(0x11f)](getConfigDir(),_0x10f38d(0x11d));if(!a34_0x5e00a2[_0x10f38d(0x10b)](_0x56b597))return null;try{const _0x208699=a34_0x5e00a2['readFileSync'](_0x56b597,_0x10f38d(0x109)),_0x26d7fd=JSON['parse'](_0x208699);return _0x26d7fd['profile']||null;}catch{return null;}}export function saveAPIKey(_0x37da66,_0x323d04){const _0x51fa4f=a34_0x953f,_0x1a8730=getConfigDir(),_0x4861aa=getConfigFile();!existsSync(_0x1a8730)&&mkdirSync(_0x1a8730,{'recursive':!![],'mode':0x1c0});const _0x508001=readUserConfig(),_0x3e857b=_0x37da66['toUpperCase']()[_0x51fa4f(0x112)](/-/g,'_');_0x508001[_0x51fa4f(0x12b)+_0x3e857b]=_0x323d04;const _0x3d3d5d=Object['entries'](_0x508001)[_0x51fa4f(0x128)](([_0x2e6af9,_0x370cc0])=>_0x2e6af9+'='+_0x370cc0);writeFileSync(_0x4861aa,_0x3d3d5d['join']('\x0a')+'\x0a',{'mode':0x180});}export function loadConfig(){const _0x251264=a34_0x953f,_0x129c4f={'apiKeys':{},'defaultSite':'us01'},_0x5ecb63=['us01',_0x251264(0x11e),_0x251264(0x139),_0x251264(0x129),_0x251264(0x111),_0x251264(0x131),_0x251264(0x130),_0x251264(0x126),_0x251264(0x132),_0x251264(0x133)];for(const _0x9108a7 of _0x5ecb63){const _0x3e13d0=getAPIKey(_0x9108a7);_0x3e13d0&&(_0x129c4f[_0x251264(0x135)][_0x9108a7]=_0x3e13d0);}return _0x129c4f;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a35_0x1c7d33=a35_0x11e1;function a35_0x11e1(_0x3469cf,_0x46c4a1){const _0x446b7d=a35_0x446b();return a35_0x11e1=function(_0x11e1fe,_0x23bd4b){_0x11e1fe=_0x11e1fe-0x79;let _0x3bba6d=_0x446b7d[_0x11e1fe];return _0x3bba6d;},a35_0x11e1(_0x3469cf,_0x46c4a1);}(function(_0x1cb943,_0x4d11b6){const _0x59a84c=a35_0x11e1,_0x4b686f=_0x1cb943();while(!![]){try{const _0x1b6fec=parseInt(_0x59a84c(0xb5))/0x1*(-parseInt(_0x59a84c(0x88))/0x2)+parseInt(_0x59a84c(0x7d))/0x3*(parseInt(_0x59a84c(0xaa))/0x4)+-parseInt(_0x59a84c(0x7f))/0x5*(parseInt(_0x59a84c(0xa5))/0x6)+parseInt(_0x59a84c(0xb4))/0x7+parseInt(_0x59a84c(0xab))/0x8*(-parseInt(_0x59a84c(0xb1))/0x9)+parseInt(_0x59a84c(0x8c))/0xa+parseInt(_0x59a84c(0xaf))/0xb;if(_0x1b6fec===_0x4d11b6)break;else _0x4b686f['push'](_0x4b686f['shift']());}catch(_0x135cdd){_0x4b686f['push'](_0x4b686f['shift']());}}}(a35_0x446b,0x5e141));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_0x58984e from'node:fs';import*as a35_0x22a422 from'node:path';export class GlobalContext{[a35_0x1c7d33(0x85)];['database'];[a35_0x1c7d33(0x91)];[a35_0x1c7d33(0xb9)];[a35_0x1c7d33(0x89)];[a35_0x1c7d33(0x9e)];['verbose'];[a35_0x1c7d33(0xa0)];[a35_0x1c7d33(0x80)];[a35_0x1c7d33(0x94)];[a35_0x1c7d33(0x95)];constructor(_0x4250fe){const _0x5f5c6d=a35_0x1c7d33;this[_0x5f5c6d(0x94)]=_0x4250fe[_0x5f5c6d(0x8d)]||process[_0x5f5c6d(0x9f)][_0x5f5c6d(0xa8)]();const _0x32896d=loadSessionContext(_0x4250fe['session']),_0x1cba4c=loadProjectConfig(),_0x7610a8=this[_0x5f5c6d(0xb2)]();this[_0x5f5c6d(0x80)]=_0x4250fe[_0x5f5c6d(0xb0)]||_0x32896d?.['profile']||_0x7610a8[_0x5f5c6d(0xb0)]||getActiveProfile();const _0x1eb2cc=this[_0x5f5c6d(0x80)]?loadProfile(this[_0x5f5c6d(0x80)]):null,_0x425724=_0x55943d=>{const _0x5cd137=_0x5f5c6d;if(!_0x55943d)return{};const _0xcc2de2=_0x55943d,_0x562256={};for(const [_0xaf34e,_0x2e4eaa]of Object[_0x5cd137(0x97)](_0xcc2de2)){typeof _0x2e4eaa===_0x5cd137(0xa9)&&(_0x562256[_0xaf34e]=_0x2e4eaa);}return _0x562256;},_0x23c2e9={};if(_0x4250fe[_0x5f5c6d(0x85)]&&_0x4250fe[_0x5f5c6d(0x85)]!=='us01')_0x23c2e9[_0x5f5c6d(0x85)]=_0x4250fe[_0x5f5c6d(0x85)];const _0x5e6aed=_0x32896d?.[_0x5f5c6d(0xa4)],_0x3f79b9=_0x1cba4c?.['database'],_0x5f588d=_0x1eb2cc?.[_0x5f5c6d(0xae)]?.[_0x5f5c6d(0xa4)],_0x2719c3=_0x7610a8['database'];_0x4250fe[_0x5f5c6d(0xa4)]&&(_0x4250fe[_0x5f5c6d(0xa4)]!==_0x5e6aed&&_0x4250fe['database']!==_0x3f79b9&&_0x4250fe[_0x5f5c6d(0xa4)]!==_0x5f588d&&_0x4250fe[_0x5f5c6d(0xa4)]!==_0x2719c3)&&(_0x23c2e9[_0x5f5c6d(0xa4)]=_0x4250fe[_0x5f5c6d(0xa4)]);if(_0x4250fe[_0x5f5c6d(0xb3)])_0x23c2e9[_0x5f5c6d(0x91)]=_0x4250fe['parentSegment'];if(_0x4250fe[_0x5f5c6d(0x8a)])_0x23c2e9[_0x5f5c6d(0x89)]=_0x4250fe['llmProject'];if(_0x4250fe[_0x5f5c6d(0xb0)])_0x23c2e9[_0x5f5c6d(0xb0)]=_0x4250fe[_0x5f5c6d(0xb0)];this[_0x5f5c6d(0xa0)]={'cliFlags':_0x23c2e9,'session':_0x425724(_0x32896d),'project':_0x425724(_0x1cba4c),'profile':_0x425724(_0x1eb2cc?.['config']),'global':_0x425724(_0x7610a8)};const _0x235fb9={...this[_0x5f5c6d(0xa0)][_0x5f5c6d(0xa1)],...this[_0x5f5c6d(0xa0)][_0x5f5c6d(0xb0)],...this[_0x5f5c6d(0xa0)][_0x5f5c6d(0x83)],...this[_0x5f5c6d(0xa0)]['session'],...this[_0x5f5c6d(0xa0)]['cliFlags']},_0x2ba0d0=_0x235fb9['site']||_0x5f5c6d(0x99);this['site']=resolveSite(_0x2ba0d0),this[_0x5f5c6d(0xa4)]=_0x235fb9[_0x5f5c6d(0xa4)],this[_0x5f5c6d(0x91)]=_0x235fb9[_0x5f5c6d(0x91)],this[_0x5f5c6d(0xb9)]=_0x235fb9[_0x5f5c6d(0xb9)],this['llm_project']=_0x235fb9[_0x5f5c6d(0x89)],this[_0x5f5c6d(0x84)]=_0x4250fe[_0x5f5c6d(0x84)]||![],this[_0x5f5c6d(0x9e)]=getAPIKey(this[_0x5f5c6d(0x85)],this[_0x5f5c6d(0x80)]||undefined);const _0x458b64=getConfigDir(),_0x17cf45=a35_0x22a422['join'](_0x458b64,_0x5f5c6d(0xba),this['sessionId']+_0x5f5c6d(0xb6)),_0x44442f=findProjectConfigPath(),_0x5184bd=a35_0x22a422['join'](_0x458b64,'tdx.json'),_0x26d07a=a35_0x22a422['join'](_0x458b64,_0x5f5c6d(0x81));let _0x5eb945=null,_0x3d9977=null;this[_0x5f5c6d(0x80)]&&(_0x5eb945=a35_0x22a422[_0x5f5c6d(0x7b)](_0x458b64,_0x5f5c6d(0xa3),this['activeProfile'],_0x5f5c6d(0x9c)),_0x3d9977=a35_0x22a422[_0x5f5c6d(0x7b)](_0x458b64,_0x5f5c6d(0xa3),this[_0x5f5c6d(0x80)],_0x5f5c6d(0x81))),this[_0x5f5c6d(0x95)]={'session':a35_0x58984e[_0x5f5c6d(0x7c)](_0x17cf45)?_0x17cf45:null,'project':_0x44442f,'profile':_0x5eb945&&a35_0x58984e['existsSync'](_0x5eb945)?_0x5eb945:null,'profileCredentials':_0x3d9977&&a35_0x58984e[_0x5f5c6d(0x7c)](_0x3d9977)?_0x3d9977:null,'global':a35_0x58984e[_0x5f5c6d(0x7c)](_0x5184bd)?_0x5184bd:null,'globalCredentials':a35_0x58984e[_0x5f5c6d(0x7c)](_0x26d07a)?_0x26d07a:null};}['getSource'](_0x2d9b8e,_0x335439){const _0x1c4bbd=a35_0x1c7d33;if(!_0x335439)return _0x1c4bbd(0x93);const _0x43ba4d=_0x335439;if(this[_0x1c4bbd(0xa0)][_0x1c4bbd(0x96)][_0x2d9b8e]===_0x43ba4d){if(_0x2d9b8e===_0x1c4bbd(0x85)&&_0x43ba4d===_0x1c4bbd(0x99)&&!this[_0x1c4bbd(0xa0)][_0x1c4bbd(0x8d)][_0x1c4bbd(0x85)]&&!this[_0x1c4bbd(0xa0)][_0x1c4bbd(0x83)][_0x1c4bbd(0x85)]&&!this['layers'][_0x1c4bbd(0xb0)][_0x1c4bbd(0x85)]&&!this['layers'][_0x1c4bbd(0xa1)][_0x1c4bbd(0x85)])return'default';return _0x1c4bbd(0xb8)+_0x2d9b8e[_0x1c4bbd(0x7e)](/_/g,'-');}if(this['layers'][_0x1c4bbd(0x8d)][_0x2d9b8e]===_0x43ba4d)return _0x1c4bbd(0x8d);if(this['layers'][_0x1c4bbd(0x83)][_0x2d9b8e]===_0x43ba4d)return'project';if(this[_0x1c4bbd(0xa0)]['profile'][_0x2d9b8e]===_0x43ba4d)return'profile:\x20'+this['activeProfile'];if(this[_0x1c4bbd(0xa0)][_0x1c4bbd(0xa1)][_0x2d9b8e]===_0x43ba4d)return _0x1c4bbd(0xa1);return'default';}['loadGlobalConfig'](){const _0xc01289=a35_0x1c7d33,_0x5ba792=a35_0x22a422[_0xc01289(0x7b)](getConfigDir(),'tdx.json');if(!a35_0x58984e[_0xc01289(0x7c)](_0x5ba792))return{};try{const _0x301679=a35_0x58984e[_0xc01289(0x8f)](_0x5ba792,'utf-8');return JSON['parse'](_0x301679);}catch{return{};}}[a35_0x1c7d33(0x98)](_0x3b4714){const _0x22b742=a35_0x1c7d33;_0x3b4714['site']=this[_0x22b742(0x85)],!_0x3b4714['database']&&this[_0x22b742(0xa4)]&&(_0x3b4714['database']=this[_0x22b742(0xa4)]),!_0x3b4714[_0x22b742(0xb3)]&&this[_0x22b742(0x91)]&&(_0x3b4714[_0x22b742(0xb3)]=this[_0x22b742(0x91)]),!_0x3b4714['segmentPath']&&this[_0x22b742(0xb9)]&&(_0x3b4714[_0x22b742(0x8e)]=this[_0x22b742(0xb9)]),!_0x3b4714[_0x22b742(0x8a)]&&this['llm_project']&&(_0x3b4714[_0x22b742(0x8a)]=this[_0x22b742(0x89)]);}[a35_0x1c7d33(0x7a)](){const _0x586101=a35_0x1c7d33;return[{'key':_0x586101(0x85),'value':this[_0x586101(0x85)]},{'key':_0x586101(0xa4),'value':this[_0x586101(0xa4)]},{'key':_0x586101(0x91),'value':this[_0x586101(0x91)]},{'key':'segment_path','value':this['segment_path']},{'key':_0x586101(0x89),'value':this['llm_project']},{'key':_0x586101(0xb0),'value':this[_0x586101(0x80)]||undefined}];}[a35_0x1c7d33(0x82)](){const _0x52856b=a35_0x1c7d33;console[_0x52856b(0x92)](_0x52856b(0x87));for(const {key:_0x42dc89,value:_0x4bc526}of this['getParameters']()){_0x4bc526&&console['log'](_0x42dc89+':\x20'+_0x4bc526);}}[a35_0x1c7d33(0xa7)](){const _0x58b0c2=a35_0x1c7d33;console[_0x58b0c2(0x92)](_0x58b0c2(0x87));for(const {key:_0x2d0775,value:_0x424ae4}of this[_0x58b0c2(0x7a)]()){if(_0x424ae4){const _0x532bbc=_0x2d0775===_0x58b0c2(0xb0)?_0x58b0c2(0xac):'('+this[_0x58b0c2(0xa6)](_0x2d0775,_0x424ae4)+')';console[_0x58b0c2(0x92)](_0x2d0775+':\x20'+_0x424ae4+'\x20'+_0x532bbc);}}console['log'](_0x58b0c2(0xad));const _0x7935e0=[{'label':'Session','path':this[_0x58b0c2(0x95)][_0x58b0c2(0x8d)],'extra':_0x58b0c2(0x8b)+this[_0x58b0c2(0x94)]+')'},{'label':_0x58b0c2(0x90),'path':this['configFiles']['project']},{'label':'Profile','path':this[_0x58b0c2(0x95)][_0x58b0c2(0xb0)]},{'label':_0x58b0c2(0x9a),'path':this[_0x58b0c2(0x95)][_0x58b0c2(0xa2)]},{'label':_0x58b0c2(0x86),'path':this['configFiles'][_0x58b0c2(0xa1)]},{'label':_0x58b0c2(0x9b),'path':this[_0x58b0c2(0x95)][_0x58b0c2(0x9d)]}];for(const {label:_0x3b49ba,path:_0x5d497,extra:_0x3fd530}of _0x7935e0){if(_0x5d497)console[_0x58b0c2(0x92)](_0x3b49ba+':\x20'+_0x5d497+'\x20✓'+(_0x3fd530?'\x20'+_0x3fd530:''));else{if(_0x3b49ba==='Session')console[_0x58b0c2(0x92)](_0x3b49ba+_0x58b0c2(0x79)+this[_0x58b0c2(0x94)]+')');else(_0x3b49ba===_0x58b0c2(0x90)||_0x3b49ba===_0x58b0c2(0x86))&&console[_0x58b0c2(0x92)](_0x3b49ba+_0x58b0c2(0xb7));}}}}function a35_0x446b(){const _0x3b6080=[':\x20none\x20(using\x20session:\x20','getParameters','join','existsSync','627QkzTZb','replace','15350bZlUuN','activeProfile','.env','display','project','verbose','site','Global','[context]','3966wBzqQJ','llm_project','llmProject','(session:\x20','2309860fUjLrS','session','segmentPath','readFileSync','Project','parent_segment','log','not\x20set','sessionId','configFiles','cliFlags','entries','injectIntoOptions','us01','Profile\x20Credentials','Global\x20Credentials','tdx.json','globalCredentials','apiKey','ppid','layers','global','profileCredentials','profiles','database','876DyeibC','getSource','displayWithSources','toString','string','10996eIicwY','104teQaSO','(active)','\x0a[configuration\x20files]','config','2926308wrakyy','profile','107271CIrWcY','loadGlobalConfig','parentSegment','3097164btUcmW','265ZFOODN','.json',':\x20none','CLI\x20flag:\x20--','segment_path','sessions'];a35_0x446b=function(){return _0x3b6080;};return a35_0x446b();}
|
package/dist/core/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a36_0x32c5(){const _0x3bd664=['5785wcPlql','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20profile\x20configuration.\x20Use\x20.env\x20file\x20instead.','message','utf-8','local','existsSync','find','To\x20migrate:','2346956fBVVTm','\x27:\x20unknown\x20config\x20key\x20\x27','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','\x20\x201.\x20Edit:\x20','\x20\x20mv\x20\x22','120566DjvSLA','description','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','push','readFileSync','1200111QMynts','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','\x22\x20\x22','\x20does\x20not\x20exist','profile','values','writeFileSync','directory','TD_API_KEY','apiKey','site','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','filter','1xVcYTW','database','parent_segment','metadata','tdx.json','Warning:\x20Profile\x20\x27','toISOString','map','parse','30OgAYut','warn','object','profiles','4888037zWhjSp','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','name','join','llm_agent','entries','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','.env.','stringify','llm_project','from','has','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','Profile\x20','\x20already\x20exists','set','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','.env','3084gyeoKd','\x0aWarning:\x20Failed\x20to\x20parse\x20','some','98829uVKdzo','Profile\x20\x27','rmSync','string','6023544xSXUPI','Error:\x20','includes','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','localeCompare'];a36_0x32c5=function(){return _0x3bd664;};return a36_0x32c5();}(function(_0x30d59b,_0x55b1c5){const _0x468681=a36_0x3b91,_0x278943=_0x30d59b();while(!![]){try{const _0x3ae9fa=-parseInt(_0x468681(0x20d))/0x1*(-parseInt(_0x468681(0x1fb))/0x2)+parseInt(_0x468681(0x200))/0x3+-parseInt(_0x468681(0x1f6))/0x4+-parseInt(_0x468681(0x1ee))/0x5*(-parseInt(_0x468681(0x22d))/0x6)+parseInt(_0x468681(0x21a))/0x7+-parseInt(_0x468681(0x1e9))/0x8+-parseInt(_0x468681(0x1e5))/0x9*(parseInt(_0x468681(0x216))/0xa);if(_0x3ae9fa===_0x55b1c5)break;else _0x278943['push'](_0x278943['shift']());}catch(_0x1410d4){_0x278943['push'](_0x278943['shift']());}}}(a36_0x32c5,0x5cf0c));import*as a36_0x5cfa13 from'node:fs';import*as a36_0x3e51a9 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(_0x4b102d){const _0x6bb8ca={};if(!_0x4b102d)return _0x6bb8ca;for(const [_0x4d8aba,_0x434952]of Object['entries'](_0x4b102d)){_0x4d8aba!=='description'&&_0x434952!==undefined&&(_0x6bb8ca[_0x4d8aba]=_0x434952);}return _0x6bb8ca;}export function getProfilesDir(){const _0x5c0153=a36_0x3b91;return a36_0x3e51a9['join'](getConfigDir(),_0x5c0153(0x219));}function getProfileDir(_0x551dde){const _0x5a1d77=a36_0x3b91;return a36_0x3e51a9[_0x5a1d77(0x21d)](getProfilesDir(),_0x551dde);}function getProfileConfigPath(_0x2d6fb8){const _0x11594a=a36_0x3b91;return a36_0x3e51a9[_0x11594a(0x21d)](getProfileDir(_0x2d6fb8),'tdx.json');}function getProfileEnvPath(_0x1595b1){const _0x552de2=a36_0x3b91;return a36_0x3e51a9[_0x552de2(0x21d)](getProfileDir(_0x1595b1),_0x552de2(0x22c));}function getGlobalConfigPath(){const _0x418ee6=a36_0x3b91;return a36_0x3e51a9[_0x418ee6(0x21d)](getConfigDir(),_0x418ee6(0x211));}function validateProfileName(_0x139a28){const _0xa37005=a36_0x3b91;if(!/^[a-zA-Z0-9_-]+$/['test'](_0x139a28))throw new Error('Invalid\x20profile\x20name:\x20'+_0x139a28+_0xa37005(0x20b));}function validateProfileConfig(_0x146554,_0x5c9357){const _0x4c185f=a36_0x3b91;if(typeof _0x146554!==_0x4c185f(0x218)||_0x146554===null)throw new Error(_0x4c185f(0x1e6)+_0x5c9357+'\x27:\x20config\x20must\x20be\x20an\x20object');const _0x4a9276=[_0x4c185f(0x1fc),_0x4c185f(0x20a),'database','parent_segment',_0x4c185f(0x224),_0x4c185f(0x21e)],_0x3ac473=_0x146554;for(const _0x2c2877 of Object['keys'](_0x3ac473)){!_0x4a9276[_0x4c185f(0x1eb)](_0x2c2877)&&console[_0x4c185f(0x217)](_0x4c185f(0x212)+_0x5c9357+_0x4c185f(0x1f7)+_0x2c2877+'\x27\x20will\x20be\x20ignored');}if(_0x3ac473[_0x4c185f(0x1fc)]!==undefined&&typeof _0x3ac473[_0x4c185f(0x1fc)]!==_0x4c185f(0x1e8))throw new Error(_0x4c185f(0x1e6)+_0x5c9357+_0x4c185f(0x1fd));if(_0x3ac473[_0x4c185f(0x20a)]!==undefined&&typeof _0x3ac473[_0x4c185f(0x20a)]!==_0x4c185f(0x1e8))throw new Error('Profile\x20\x27'+_0x5c9357+_0x4c185f(0x201));if(_0x3ac473[_0x4c185f(0x20e)]!==undefined&&typeof _0x3ac473['database']!==_0x4c185f(0x1e8))throw new Error(_0x4c185f(0x1e6)+_0x5c9357+_0x4c185f(0x220));if(_0x3ac473[_0x4c185f(0x20f)]!==undefined&&typeof _0x3ac473[_0x4c185f(0x20f)]!==_0x4c185f(0x1e8))throw new Error('Profile\x20\x27'+_0x5c9357+'\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string');if(_0x3ac473[_0x4c185f(0x224)]!==undefined&&typeof _0x3ac473[_0x4c185f(0x224)]!==_0x4c185f(0x1e8))throw new Error(_0x4c185f(0x1e6)+_0x5c9357+_0x4c185f(0x227));if(_0x3ac473[_0x4c185f(0x21e)]!==undefined&&typeof _0x3ac473[_0x4c185f(0x21e)]!==_0x4c185f(0x1e8))throw new Error(_0x4c185f(0x1e6)+_0x5c9357+_0x4c185f(0x221));return!![];}function loadProfilesFromTdxJson(_0x1288d5,_0x583420){const _0x1d162f=a36_0x3b91;if(!a36_0x5cfa13[_0x1d162f(0x1f3)](_0x1288d5))return[];try{const _0x52094a=a36_0x5cfa13[_0x1d162f(0x1ff)](_0x1288d5,_0x1d162f(0x1f1)),_0x2dc2f0=JSON[_0x1d162f(0x215)](_0x52094a);if(!_0x2dc2f0[_0x1d162f(0x219)]||typeof _0x2dc2f0[_0x1d162f(0x219)]!==_0x1d162f(0x218))return[];const _0x5695fa=[];for(const [_0x13f7c5,_0x3d5c4f]of Object[_0x1d162f(0x21f)](_0x2dc2f0[_0x1d162f(0x219)])){try{validateProfileConfig(_0x3d5c4f,_0x13f7c5);const _0x45039e=getNewCredentialPath(_0x13f7c5),_0x2c3711=getOldCredentialPath(_0x13f7c5),_0x178ee0=a36_0x5cfa13[_0x1d162f(0x1f3)](_0x45039e)||a36_0x5cfa13[_0x1d162f(0x1f3)](_0x2c3711);_0x5695fa['push']({'name':_0x13f7c5,'config':_0x3d5c4f,'metadata':{'name':_0x13f7c5,'createdAt':new Date()[_0x1d162f(0x213)]()},'hasCredentials':_0x178ee0,'scope':_0x583420});}catch(_0x42e831){_0x42e831 instanceof Error&&(console[_0x1d162f(0x217)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x1288d5+':'),console['warn']('\x20\x20'+_0x42e831[_0x1d162f(0x1f0)]+'\x0a'));}}return _0x5695fa;}catch(_0x16e736){return _0x16e736 instanceof SyntaxError?(console[_0x1d162f(0x217)](_0x1d162f(0x22e)+_0x1288d5+':\x20Invalid\x20JSON\x20syntax'),console[_0x1d162f(0x217)](_0x1d162f(0x1ea)+_0x16e736['message']+'\x0a')):console[_0x1d162f(0x217)](_0x1d162f(0x22b)+_0x1288d5+':\x20'+_0x16e736+'\x0a'),[];}}export function getNewCredentialPath(_0x3bf928){const _0x5aa91e=a36_0x3b91;return a36_0x3e51a9[_0x5aa91e(0x21d)](getConfigDir(),_0x5aa91e(0x222)+_0x3bf928);}function a36_0x3b91(_0x6b1028,_0x463c4c){const _0x32c50f=a36_0x32c5();return a36_0x3b91=function(_0x3b913f,_0xcbad89){_0x3b913f=_0x3b913f-0x1e5;let _0x47e627=_0x32c50f[_0x3b913f];return _0x47e627;},a36_0x3b91(_0x6b1028,_0x463c4c);}function getOldCredentialPath(_0x51f2e7){const _0x4707dd=a36_0x3b91;return a36_0x3e51a9[_0x4707dd(0x21d)](getProfilesDir(),_0x51f2e7,_0x4707dd(0x22c));}function loadProfilesFromTdxJsonFiles(){const _0x82738=a36_0x3b91,_0x5e03e3=[],_0x37974d=findProjectConfigPath();_0x37974d&&_0x5e03e3[_0x82738(0x1fe)](...loadProfilesFromTdxJson(_0x37974d,_0x82738(0x1f2)));const _0x3502b9=a36_0x3e51a9[_0x82738(0x21d)](getConfigDir(),_0x82738(0x211));return _0x5e03e3[_0x82738(0x1fe)](...loadProfilesFromTdxJson(_0x3502b9,'user')),_0x5e03e3;}function loadProfilesFromDirectories(){const _0xbd5d8b=a36_0x3b91,_0x579258=getProfilesDir();if(!a36_0x5cfa13[_0xbd5d8b(0x1f3)](_0x579258))return[];try{return a36_0x5cfa13['readdirSync'](_0x579258,{'withFileTypes':!![]})[_0xbd5d8b(0x20c)](_0x4217f4=>_0x4217f4['isDirectory']())['map'](_0x36f1f8=>_0x36f1f8[_0xbd5d8b(0x21c)])[_0xbd5d8b(0x20c)](_0x31f1a6=>{const _0x4854d8=_0xbd5d8b,_0x598a1b=getProfileConfigPath(_0x31f1a6),_0x1bb672=getProfileEnvPath(_0x31f1a6);return a36_0x5cfa13[_0x4854d8(0x1f3)](_0x598a1b)||a36_0x5cfa13['existsSync'](_0x1bb672);})[_0xbd5d8b(0x214)](_0x4cc5e5=>{const _0x518598=_0xbd5d8b,_0x1faa04=loadProfileFromDirectory(_0x4cc5e5);if(_0x1faa04)return{..._0x1faa04,'scope':_0x518598(0x207)};return null;})[_0xbd5d8b(0x20c)](_0x31ad09=>_0x31ad09!==null);}catch{return[];}}function loadProfileFromDirectory(_0x1ab1b8){const _0x2a683a=a36_0x3b91,_0xb1559=getProfileConfigPath(_0x1ab1b8),_0x466936=getOldCredentialPath(_0x1ab1b8);if(!a36_0x5cfa13[_0x2a683a(0x1f3)](_0xb1559)&&!a36_0x5cfa13['existsSync'](_0x466936))return null;let _0x12a763={},_0x1f2683={'name':_0x1ab1b8,'createdAt':new Date()[_0x2a683a(0x213)]()};if(a36_0x5cfa13[_0x2a683a(0x1f3)](_0xb1559))try{const _0x366ec2=a36_0x5cfa13[_0x2a683a(0x1ff)](_0xb1559,'utf-8'),_0x154ef5=JSON[_0x2a683a(0x215)](_0x366ec2),{metadata:_0xe1b472,..._0xa3600d}=_0x154ef5;_0x12a763=_0xa3600d,_0xe1b472&&(_0x1f2683=_0xe1b472);}catch{}return{'name':_0x1ab1b8,'config':_0x12a763,'metadata':_0x1f2683,'hasCredentials':a36_0x5cfa13[_0x2a683a(0x1f3)](_0x466936),'scope':_0x2a683a(0x207)};}export function listProfiles(){const _0x27410b=a36_0x3b91,_0x3eee44=loadProfilesFromTdxJsonFiles(),_0x183113=loadProfilesFromDirectories();if(_0x183113['length']>0x0){const _0x5cfd6f=_0x183113[_0x27410b(0x214)](_0x115ac8=>_0x115ac8['name'])['join'](',\x20'),_0x44e365=getConfigDir();console['warn'](_0x27410b(0x1f8)+_0x5cfd6f),console[_0x27410b(0x217)](_0x27410b(0x21b)),console[_0x27410b(0x217)](_0x27410b(0x1f9)+a36_0x3e51a9[_0x27410b(0x21d)](_0x44e365,_0x27410b(0x211))),console[_0x27410b(0x217)]('\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)'),console[_0x27410b(0x217)](_0x27410b(0x1ec));}const _0x2c172b=[..._0x3eee44,..._0x183113],_0x35c18d=new Map();for(const _0xa9a36a of _0x2c172b){!_0x35c18d[_0x27410b(0x226)](_0xa9a36a[_0x27410b(0x21c)])&&_0x35c18d[_0x27410b(0x22a)](_0xa9a36a[_0x27410b(0x21c)],_0xa9a36a);}return Array[_0x27410b(0x225)](_0x35c18d[_0x27410b(0x205)]())['sort']((_0xa9034e,_0x752f79)=>_0xa9034e[_0x27410b(0x21c)][_0x27410b(0x1ed)](_0x752f79[_0x27410b(0x21c)]));}export function profileExists(_0x5a2a29){const _0xca8c9b=a36_0x3b91,_0x562963=listProfiles();return _0x562963[_0xca8c9b(0x22f)](_0x2f25e3=>_0x2f25e3['name']===_0x5a2a29);}export function loadProfile(_0x427919){const _0x267b72=a36_0x3b91;validateProfileName(_0x427919);const _0x1ae9e3=listProfiles(),_0x48c317=_0x1ae9e3[_0x267b72(0x1f4)](_0x572c71=>_0x572c71[_0x267b72(0x21c)]===_0x427919);return _0x48c317||null;}export function saveProfile(_0x59a801,_0xf3031f,_0x7fa308=![]){const _0x53e52d=a36_0x3b91;validateProfileName(_0x59a801);const _0x13a5bd=getProfileDir(_0x59a801),_0xd333af=getProfileConfigPath(_0x59a801);createSecureDirectory(_0x13a5bd);let _0x4240fd;const _0x3b9756=loadProfile(_0x59a801);_0x3b9756?(_0x4240fd=_0x3b9756[_0x53e52d(0x210)],_0x7fa308&&(_0x4240fd['lastUsed']=new Date()['toISOString']())):_0x4240fd={'name':_0x59a801,'createdAt':new Date()[_0x53e52d(0x213)]()};const _0x4c3a76=JSON[_0x53e52d(0x223)](_0xf3031f);if(_0x4c3a76[_0x53e52d(0x1eb)](_0x53e52d(0x208))||_0x4c3a76[_0x53e52d(0x1eb)](_0x53e52d(0x209))||_0x4c3a76[_0x53e52d(0x1eb)]('api_key'))throw new Error(_0x53e52d(0x1ef));const _0x1fb4f8={..._0xf3031f,'metadata':_0x4240fd};a36_0x5cfa13[_0x53e52d(0x206)](_0xd333af,JSON[_0x53e52d(0x223)](_0x1fb4f8,null,0x2));}export function deleteProfile(_0x49de77){const _0x372319=a36_0x3b91;validateProfileName(_0x49de77);const _0x376adc=getProfileDir(_0x49de77);if(!a36_0x5cfa13[_0x372319(0x1f3)](_0x376adc))throw new Error(_0x372319(0x228)+_0x49de77+_0x372319(0x203));a36_0x5cfa13[_0x372319(0x1e7)](_0x376adc,{'recursive':!![],'force':!![]});}export function getActiveProfile(){const _0x1a1d8f=a36_0x3b91,_0x3af0b7=getGlobalConfigPath();if(!a36_0x5cfa13[_0x1a1d8f(0x1f3)](_0x3af0b7))return null;try{const _0x10badc=a36_0x5cfa13[_0x1a1d8f(0x1ff)](_0x3af0b7,_0x1a1d8f(0x1f1)),_0x329586=JSON[_0x1a1d8f(0x215)](_0x10badc);return _0x329586[_0x1a1d8f(0x204)]||null;}catch{return null;}}export function createProfile(_0x1323dd,_0x6c5247){const _0x11b10a=a36_0x3b91;validateProfileName(_0x1323dd);if(profileExists(_0x1323dd))throw new Error('Profile\x20'+_0x1323dd+_0x11b10a(0x229));saveProfile(_0x1323dd,_0x6c5247);}export function saveProfileCredentials(_0x383a4d,_0x24ce68){const _0x3bd80c=a36_0x3b91;validateProfileName(_0x383a4d);if(!profileExists(_0x383a4d))throw new Error(_0x3bd80c(0x228)+_0x383a4d+_0x3bd80c(0x203));const _0x4977a3=getNewCredentialPath(_0x383a4d);writeSecureFile(_0x4977a3,_0x24ce68);}export function loadProfileCredentials(_0x448f7c){const _0x32a715=a36_0x3b91;validateProfileName(_0x448f7c);const _0x458461=getNewCredentialPath(_0x448f7c);if(a36_0x5cfa13[_0x32a715(0x1f3)](_0x458461))try{return a36_0x5cfa13[_0x32a715(0x1ff)](_0x458461,_0x32a715(0x1f1));}catch{}const _0x24b081=getOldCredentialPath(_0x448f7c);if(a36_0x5cfa13[_0x32a715(0x1f3)](_0x24b081)){console[_0x32a715(0x217)]('\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27'+_0x448f7c+'\x27'),console[_0x32a715(0x217)](_0x32a715(0x1f5)),console[_0x32a715(0x217)](_0x32a715(0x1fa)+_0x24b081+_0x32a715(0x202)+_0x458461+'\x22'),console[_0x32a715(0x217)]('Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a');try{return a36_0x5cfa13[_0x32a715(0x1ff)](_0x24b081,_0x32a715(0x1f1));}catch{return null;}}return null;}
|
|
1
|
+
function a36_0x5f46(_0x292fd1,_0x41c207){const _0x3f9973=a36_0x3f99();return a36_0x5f46=function(_0x5f461a,_0x1871a6){_0x5f461a=_0x5f461a-0x1c8;let _0x1c532e=_0x3f9973[_0x5f461a];return _0x1c532e;},a36_0x5f46(_0x292fd1,_0x41c207);}(function(_0x476104,_0x27f9a8){const _0x51d8b0=a36_0x5f46,_0x2d1aaa=_0x476104();while(!![]){try{const _0x4077bd=parseInt(_0x51d8b0(0x219))/0x1*(parseInt(_0x51d8b0(0x216))/0x2)+-parseInt(_0x51d8b0(0x20a))/0x3+parseInt(_0x51d8b0(0x1fa))/0x4+-parseInt(_0x51d8b0(0x1f2))/0x5*(-parseInt(_0x51d8b0(0x210))/0x6)+parseInt(_0x51d8b0(0x1e4))/0x7+-parseInt(_0x51d8b0(0x1f9))/0x8+parseInt(_0x51d8b0(0x1db))/0x9*(parseInt(_0x51d8b0(0x1de))/0xa);if(_0x4077bd===_0x27f9a8)break;else _0x2d1aaa['push'](_0x2d1aaa['shift']());}catch(_0x4b20f0){_0x2d1aaa['push'](_0x2d1aaa['shift']());}}}(a36_0x3f99,0xe206e));function a36_0x3f99(){const _0xab73b0=['apiKey','string','description','\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','rmSync','message','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','78205DIwfpo','\x27:\x20unknown\x20config\x20key\x20\x27','metadata','has','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','database','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','1861464aKKRLc','512476KLCBtp','find','writeFileSync','warn','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20',':\x20Invalid\x20JSON\x20syntax','\x20\x20mv\x20\x22','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','readFileSync','from','keys','profile','Profile\x20','name','profiles','utf-8','5435382qYBlnl','sort','parse','localeCompare','set','filter','78BmJbIl','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string','join','tdx.json','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','\x22\x20\x22','272nGAJrz','site','\x27:\x20config\x20must\x20be\x20an\x20object','845BqdciS','Invalid\x20profile\x20name:\x20','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','api_key','lastUsed','object','push','\x20\x201.\x20Edit:\x20','\x20already\x20exists','test','toISOString','\x27\x20will\x20be\x20ignored','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','\x0aWarning:\x20Failed\x20to\x20parse\x20','values','llm_agent','some','llm_project','Profile\x20\x27','.env.','.env','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','37458LfmgZY','entries','parent_segment','4670qiByUN','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','directory','\x20does\x20not\x20exist','existsSync','local','4061799swiALZ','map','TD_API_KEY','stringify','includes','isDirectory'];a36_0x3f99=function(){return _0xab73b0;};return a36_0x3f99();}import*as a36_0x57ad84 from'node:fs';import*as a36_0xa91e8d 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(_0x54c217){const _0xe466e4=a36_0x5f46,_0x480567={};if(!_0x54c217)return _0x480567;for(const [_0x2ea070,_0x1b997d]of Object[_0xe466e4(0x1dc)](_0x54c217)){_0x2ea070!=='description'&&_0x1b997d!==undefined&&(_0x480567[_0x2ea070]=_0x1b997d);}return _0x480567;}export function getProfilesDir(){const _0xa95f8=a36_0x5f46;return a36_0xa91e8d[_0xa95f8(0x212)](getConfigDir(),'profiles');}function getProfileDir(_0x2293c2){const _0x5c3e49=a36_0x5f46;return a36_0xa91e8d[_0x5c3e49(0x212)](getProfilesDir(),_0x2293c2);}function getProfileConfigPath(_0x315dce){const _0x5f1e26=a36_0x5f46;return a36_0xa91e8d[_0x5f1e26(0x212)](getProfileDir(_0x315dce),_0x5f1e26(0x213));}function getProfileEnvPath(_0xc67b6a){const _0x4d4cde=a36_0x5f46;return a36_0xa91e8d[_0x4d4cde(0x212)](getProfileDir(_0xc67b6a),_0x4d4cde(0x1d9));}function getGlobalConfigPath(){const _0x5df6e9=a36_0x5f46;return a36_0xa91e8d[_0x5df6e9(0x212)](getConfigDir(),_0x5df6e9(0x213));}function validateProfileName(_0x307a81){const _0x430d71=a36_0x5f46;if(!/^[a-zA-Z0-9_-]+$/[_0x430d71(0x1ce)](_0x307a81))throw new Error(_0x430d71(0x21a)+_0x307a81+_0x430d71(0x1f8));}function validateProfileConfig(_0x4aa107,_0x266004){const _0x364a97=a36_0x5f46;if(typeof _0x4aa107!==_0x364a97(0x1ca)||_0x4aa107===null)throw new Error('Profile\x20\x27'+_0x266004+_0x364a97(0x218));const _0x21d699=['description',_0x364a97(0x217),_0x364a97(0x1f7),'parent_segment',_0x364a97(0x1d6),_0x364a97(0x1d4)],_0x5b14c3=_0x4aa107;for(const _0x3bc3cb of Object[_0x364a97(0x204)](_0x5b14c3)){!_0x21d699[_0x364a97(0x1e8)](_0x3bc3cb)&&console[_0x364a97(0x1fd)]('Warning:\x20Profile\x20\x27'+_0x266004+_0x364a97(0x1f3)+_0x3bc3cb+_0x364a97(0x1d0));}if(_0x5b14c3[_0x364a97(0x1ec)]!==undefined&&typeof _0x5b14c3['description']!==_0x364a97(0x1eb))throw new Error(_0x364a97(0x1d7)+_0x266004+_0x364a97(0x1f6));if(_0x5b14c3[_0x364a97(0x217)]!==undefined&&typeof _0x5b14c3[_0x364a97(0x217)]!==_0x364a97(0x1eb))throw new Error(_0x364a97(0x1d7)+_0x266004+'\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string');if(_0x5b14c3[_0x364a97(0x1f7)]!==undefined&&typeof _0x5b14c3[_0x364a97(0x1f7)]!==_0x364a97(0x1eb))throw new Error('Profile\x20\x27'+_0x266004+_0x364a97(0x211));if(_0x5b14c3[_0x364a97(0x1dd)]!==undefined&&typeof _0x5b14c3[_0x364a97(0x1dd)]!==_0x364a97(0x1eb))throw new Error(_0x364a97(0x1d7)+_0x266004+'\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string');if(_0x5b14c3[_0x364a97(0x1d6)]!==undefined&&typeof _0x5b14c3[_0x364a97(0x1d6)]!==_0x364a97(0x1eb))throw new Error(_0x364a97(0x1d7)+_0x266004+_0x364a97(0x21b));if(_0x5b14c3[_0x364a97(0x1d4)]!==undefined&&typeof _0x5b14c3[_0x364a97(0x1d4)]!==_0x364a97(0x1eb))throw new Error(_0x364a97(0x1d7)+_0x266004+_0x364a97(0x1ed));return!![];}function loadProfilesFromTdxJson(_0x6539eb,_0x57a323){const _0x2055d9=a36_0x5f46;if(!a36_0x57ad84[_0x2055d9(0x1e2)](_0x6539eb))return[];try{const _0x111502=a36_0x57ad84[_0x2055d9(0x202)](_0x6539eb,_0x2055d9(0x209)),_0x77a697=JSON[_0x2055d9(0x20c)](_0x111502);if(!_0x77a697[_0x2055d9(0x208)]||typeof _0x77a697[_0x2055d9(0x208)]!==_0x2055d9(0x1ca))return[];const _0x3ff35c=[];for(const [_0x31511b,_0x5db841]of Object[_0x2055d9(0x1dc)](_0x77a697[_0x2055d9(0x208)])){try{validateProfileConfig(_0x5db841,_0x31511b);const _0x220895=getNewCredentialPath(_0x31511b),_0x51e16f=getOldCredentialPath(_0x31511b),_0x296fc0=a36_0x57ad84['existsSync'](_0x220895)||a36_0x57ad84[_0x2055d9(0x1e2)](_0x51e16f);_0x3ff35c[_0x2055d9(0x1cb)]({'name':_0x31511b,'config':_0x5db841,'metadata':{'name':_0x31511b,'createdAt':new Date()[_0x2055d9(0x1cf)]()},'hasCredentials':_0x296fc0,'scope':_0x57a323});}catch(_0x100e75){_0x100e75 instanceof Error&&(console[_0x2055d9(0x1fd)](_0x2055d9(0x214)+_0x6539eb+':'),console[_0x2055d9(0x1fd)]('\x20\x20'+_0x100e75[_0x2055d9(0x1f0)]+'\x0a'));}}return _0x3ff35c;}catch(_0x32ee5c){return _0x32ee5c instanceof SyntaxError?(console[_0x2055d9(0x1fd)](_0x2055d9(0x1d2)+_0x6539eb+_0x2055d9(0x1ff)),console[_0x2055d9(0x1fd)]('Error:\x20'+_0x32ee5c[_0x2055d9(0x1f0)]+'\x0a')):console[_0x2055d9(0x1fd)](_0x2055d9(0x1fe)+_0x6539eb+':\x20'+_0x32ee5c+'\x0a'),[];}}export function getNewCredentialPath(_0x5e2654){const _0x2d241c=a36_0x5f46;return a36_0xa91e8d[_0x2d241c(0x212)](getConfigDir(),_0x2d241c(0x1d8)+_0x5e2654);}function getOldCredentialPath(_0x5d9cac){const _0x1f20f4=a36_0x5f46;return a36_0xa91e8d[_0x1f20f4(0x212)](getProfilesDir(),_0x5d9cac,_0x1f20f4(0x1d9));}function loadProfilesFromTdxJsonFiles(){const _0xb7fac8=a36_0x5f46,_0x4ef637=[],_0xeec73c=findProjectConfigPath();_0xeec73c&&_0x4ef637[_0xb7fac8(0x1cb)](...loadProfilesFromTdxJson(_0xeec73c,_0xb7fac8(0x1e3)));const _0x3b5981=a36_0xa91e8d['join'](getConfigDir(),_0xb7fac8(0x213));return _0x4ef637[_0xb7fac8(0x1cb)](...loadProfilesFromTdxJson(_0x3b5981,'user')),_0x4ef637;}function loadProfilesFromDirectories(){const _0xdc99b4=a36_0x5f46,_0x36418b=getProfilesDir();if(!a36_0x57ad84[_0xdc99b4(0x1e2)](_0x36418b))return[];try{return a36_0x57ad84['readdirSync'](_0x36418b,{'withFileTypes':!![]})[_0xdc99b4(0x20f)](_0xf380ff=>_0xf380ff[_0xdc99b4(0x1e9)]())[_0xdc99b4(0x1e5)](_0x2ad8c8=>_0x2ad8c8[_0xdc99b4(0x207)])[_0xdc99b4(0x20f)](_0xef329b=>{const _0x1fad5b=_0xdc99b4,_0x568794=getProfileConfigPath(_0xef329b),_0x13bb14=getProfileEnvPath(_0xef329b);return a36_0x57ad84[_0x1fad5b(0x1e2)](_0x568794)||a36_0x57ad84[_0x1fad5b(0x1e2)](_0x13bb14);})[_0xdc99b4(0x1e5)](_0x3f2a3b=>{const _0x50bd58=_0xdc99b4,_0x319ab0=loadProfileFromDirectory(_0x3f2a3b);if(_0x319ab0)return{..._0x319ab0,'scope':_0x50bd58(0x1e0)};return null;})[_0xdc99b4(0x20f)](_0x1d3192=>_0x1d3192!==null);}catch{return[];}}function loadProfileFromDirectory(_0x16e018){const _0x206511=a36_0x5f46,_0x2d725d=getProfileConfigPath(_0x16e018),_0x21f201=getOldCredentialPath(_0x16e018);if(!a36_0x57ad84['existsSync'](_0x2d725d)&&!a36_0x57ad84['existsSync'](_0x21f201))return null;let _0x54c653={},_0x1969cb={'name':_0x16e018,'createdAt':new Date()[_0x206511(0x1cf)]()};if(a36_0x57ad84[_0x206511(0x1e2)](_0x2d725d))try{const _0x56b89b=a36_0x57ad84[_0x206511(0x202)](_0x2d725d,'utf-8'),_0x32207a=JSON[_0x206511(0x20c)](_0x56b89b),{metadata:_0x5422c7,..._0x57b890}=_0x32207a;_0x54c653=_0x57b890,_0x5422c7&&(_0x1969cb=_0x5422c7);}catch{}return{'name':_0x16e018,'config':_0x54c653,'metadata':_0x1969cb,'hasCredentials':a36_0x57ad84['existsSync'](_0x21f201),'scope':_0x206511(0x1e0)};}export function listProfiles(){const _0x17f33c=a36_0x5f46,_0x23a8b6=loadProfilesFromTdxJsonFiles(),_0x432f4f=loadProfilesFromDirectories();if(_0x432f4f['length']>0x0){const _0x1eff95=_0x432f4f[_0x17f33c(0x1e5)](_0x50abbb=>_0x50abbb[_0x17f33c(0x207)])['join'](',\x20'),_0x56308b=getConfigDir();console[_0x17f33c(0x1fd)](_0x17f33c(0x1f1)+_0x1eff95),console[_0x17f33c(0x1fd)](_0x17f33c(0x1df)),console[_0x17f33c(0x1fd)](_0x17f33c(0x1cc)+a36_0xa91e8d[_0x17f33c(0x212)](_0x56308b,_0x17f33c(0x213))),console[_0x17f33c(0x1fd)](_0x17f33c(0x1ee)),console[_0x17f33c(0x1fd)](_0x17f33c(0x1da));}const _0xb41dc1=[..._0x23a8b6,..._0x432f4f],_0x5b71f4=new Map();for(const _0x4e5cf7 of _0xb41dc1){!_0x5b71f4[_0x17f33c(0x1f5)](_0x4e5cf7['name'])&&_0x5b71f4[_0x17f33c(0x20e)](_0x4e5cf7[_0x17f33c(0x207)],_0x4e5cf7);}return Array[_0x17f33c(0x203)](_0x5b71f4[_0x17f33c(0x1d3)]())[_0x17f33c(0x20b)]((_0x4726d6,_0x55a8ce)=>_0x4726d6[_0x17f33c(0x207)][_0x17f33c(0x20d)](_0x55a8ce[_0x17f33c(0x207)]));}export function profileExists(_0x5b0027){const _0x2410dc=a36_0x5f46,_0x33f9e7=listProfiles();return _0x33f9e7[_0x2410dc(0x1d5)](_0x532bab=>_0x532bab[_0x2410dc(0x207)]===_0x5b0027);}export function loadProfile(_0x3155cb){const _0x377dc6=a36_0x5f46;validateProfileName(_0x3155cb);const _0x559ecd=listProfiles(),_0x54bfa0=_0x559ecd[_0x377dc6(0x1fb)](_0x4d1483=>_0x4d1483['name']===_0x3155cb);return _0x54bfa0||null;}export function saveProfile(_0x233cc6,_0x5c3045,_0x58e733=![]){const _0xf30d96=a36_0x5f46;validateProfileName(_0x233cc6);const _0x333dfb=getProfileDir(_0x233cc6),_0x37fde0=getProfileConfigPath(_0x233cc6);createSecureDirectory(_0x333dfb);let _0x5ad8b2;const _0x38b95f=loadProfile(_0x233cc6);_0x38b95f?(_0x5ad8b2=_0x38b95f[_0xf30d96(0x1f4)],_0x58e733&&(_0x5ad8b2[_0xf30d96(0x1c9)]=new Date()['toISOString']())):_0x5ad8b2={'name':_0x233cc6,'createdAt':new Date()[_0xf30d96(0x1cf)]()};const _0x4ea94d=JSON['stringify'](_0x5c3045);if(_0x4ea94d[_0xf30d96(0x1e8)](_0xf30d96(0x1e6))||_0x4ea94d[_0xf30d96(0x1e8)](_0xf30d96(0x1ea))||_0x4ea94d[_0xf30d96(0x1e8)](_0xf30d96(0x1c8)))throw new Error('API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20profile\x20configuration.\x20Use\x20.env\x20file\x20instead.');const _0x498f9e={..._0x5c3045,'metadata':_0x5ad8b2};a36_0x57ad84[_0xf30d96(0x1fc)](_0x37fde0,JSON[_0xf30d96(0x1e7)](_0x498f9e,null,0x2));}export function deleteProfile(_0x3824b7){const _0x30c705=a36_0x5f46;validateProfileName(_0x3824b7);const _0x1e61a1=getProfileDir(_0x3824b7);if(!a36_0x57ad84[_0x30c705(0x1e2)](_0x1e61a1))throw new Error(_0x30c705(0x206)+_0x3824b7+_0x30c705(0x1e1));a36_0x57ad84[_0x30c705(0x1ef)](_0x1e61a1,{'recursive':!![],'force':!![]});}export function getActiveProfile(){const _0x4e856c=a36_0x5f46,_0x313382=getGlobalConfigPath();if(!a36_0x57ad84['existsSync'](_0x313382))return null;try{const _0x1c55bc=a36_0x57ad84[_0x4e856c(0x202)](_0x313382,_0x4e856c(0x209)),_0x399f4c=JSON[_0x4e856c(0x20c)](_0x1c55bc);return _0x399f4c[_0x4e856c(0x205)]||null;}catch{return null;}}export function createProfile(_0x5461a9,_0x6881a9){const _0x39f5c=a36_0x5f46;validateProfileName(_0x5461a9);if(profileExists(_0x5461a9))throw new Error(_0x39f5c(0x206)+_0x5461a9+_0x39f5c(0x1cd));saveProfile(_0x5461a9,_0x6881a9);}export function saveProfileCredentials(_0x2cf13d,_0x5b5b54){const _0x156aa9=a36_0x5f46;validateProfileName(_0x2cf13d);if(!profileExists(_0x2cf13d))throw new Error('Profile\x20'+_0x2cf13d+_0x156aa9(0x1e1));const _0x4ae924=getNewCredentialPath(_0x2cf13d);writeSecureFile(_0x4ae924,_0x5b5b54);}export function loadProfileCredentials(_0x1e06c3){const _0x18711d=a36_0x5f46;validateProfileName(_0x1e06c3);const _0x4bccc0=getNewCredentialPath(_0x1e06c3);if(a36_0x57ad84[_0x18711d(0x1e2)](_0x4bccc0))try{return a36_0x57ad84['readFileSync'](_0x4bccc0,_0x18711d(0x209));}catch{}const _0x2ce07d=getOldCredentialPath(_0x1e06c3);if(a36_0x57ad84['existsSync'](_0x2ce07d)){console[_0x18711d(0x1fd)](_0x18711d(0x1d1)+_0x1e06c3+'\x27'),console['warn']('To\x20migrate:'),console[_0x18711d(0x1fd)](_0x18711d(0x200)+_0x2ce07d+_0x18711d(0x215)+_0x4bccc0+'\x22'),console[_0x18711d(0x1fd)](_0x18711d(0x201));try{return a36_0x57ad84[_0x18711d(0x202)](_0x2ce07d,_0x18711d(0x209));}catch{return null;}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a37_0x46deb5=a37_0x4ef2;function a37_0x4ef2(_0x1fdeb9,_0x5d4119){const _0x234f44=a37_0x234f();return a37_0x4ef2=function(_0x4ef2f2,_0x594ad9){_0x4ef2f2=_0x4ef2f2-0x6c;let _0x594ab2=_0x234f44[_0x4ef2f2];return _0x594ab2;},a37_0x4ef2(_0x1fdeb9,_0x5d4119);}(function(_0x28d0c3,_0x2d4dbc){const _0x3abb29=a37_0x4ef2,_0x505951=_0x28d0c3();while(!![]){try{const _0x562447=-parseInt(_0x3abb29(0x7c))/0x1+-parseInt(_0x3abb29(0x7e))/0x2+parseInt(_0x3abb29(0x77))/0x3*(parseInt(_0x3abb29(0x86))/0x4)+parseInt(_0x3abb29(0x79))/0x5*(-parseInt(_0x3abb29(0x78))/0x6)+parseInt(_0x3abb29(0x89))/0x7*(parseInt(_0x3abb29(0x76))/0x8)+-parseInt(_0x3abb29(0x6f))/0x9+-parseInt(_0x3abb29(0x85))/0xa*(-parseInt(_0x3abb29(0x8a))/0xb);if(_0x562447===_0x2d4dbc)break;else _0x505951['push'](_0x505951['shift']());}catch(_0x477ea5){_0x505951['push'](_0x505951['shift']());}}}(a37_0x234f,0xbdee9));import*as a37_0x573aa6 from'node:fs';import*as a37_0x52854e from'node:path';function a37_0x234f(){const _0xb2dc6c=['parse','profile','cwd','warn','410XBiGdN','5386844ibyMnG','ENOENT','\x27profile\x27\x20should\x20not\x20be\x20set\x20in\x20project\x20config.\x20Use\x20\x27tdx\x20profile\x20use\x27\x20instead.','5616758JaAZIg','652146xjamUN','includes','utf-8','apiKey','Security\x20error:\x20API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20config\x20(','readFileSync','stringify','10891224FpzmKU','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20project\x20configuration.\x20Use\x20.env\x20files\x20instead.','Warning:\x20\x27profile\x27\x20field\x20in\x20','code','TD_API_KEY','Failed\x20to\x20load\x20project\x20config\x20from\x20','tdx.json','8nTLRiv','3xMIORy','8242062YSvurX','5nprSnw','Active\x20profile\x20is\x20set\x20in\x20~/.config/tdx/tdx.json','dirname','586885NkKepW','existsSync','1262344ygvgFY',').\x20','join'];a37_0x234f=function(){return _0xb2dc6c;};return a37_0x234f();}const PROJECT_CONFIG_FILENAME=a37_0x46deb5(0x75);export function findProjectConfigPath(_0x4d44a5){const _0x13006d=a37_0x46deb5;let _0x3281ea=_0x4d44a5||process[_0x13006d(0x83)]();while(!![]){const _0x491f43=a37_0x52854e['join'](_0x3281ea,PROJECT_CONFIG_FILENAME);if(a37_0x573aa6[_0x13006d(0x7d)](_0x491f43))return _0x491f43;const _0x1a4398=a37_0x52854e[_0x13006d(0x7b)](_0x3281ea);if(_0x1a4398===_0x3281ea)return null;_0x3281ea=_0x1a4398;}}export function loadProjectConfig(_0x539e3b){const _0x4d096c=a37_0x46deb5,_0x5caac8=findProjectConfigPath(_0x539e3b);if(!_0x5caac8)return null;try{const _0x2ba13f=a37_0x573aa6[_0x4d096c(0x6d)](_0x5caac8,_0x4d096c(0x8c)),_0x3663f4=JSON[_0x4d096c(0x81)](_0x2ba13f),_0x1c5e7f=JSON[_0x4d096c(0x6e)](_0x3663f4);if(_0x1c5e7f[_0x4d096c(0x8b)]('TD_API_KEY')||_0x1c5e7f[_0x4d096c(0x8b)](_0x4d096c(0x8d))||_0x1c5e7f[_0x4d096c(0x8b)]('api_key'))throw new Error(_0x4d096c(0x6c)+_0x5caac8+_0x4d096c(0x7f)+'Use\x20~/.config/tdx/.env\x20or\x20profile\x20.env\x20files\x20instead.');const {metadata:_0x3771f7,profile:_0x3b3319,..._0x4d4c96}=_0x3663f4;return _0x3b3319&&console[_0x4d096c(0x84)](_0x4d096c(0x71)+_0x5caac8+'\x20is\x20ignored.\x20'+_0x4d096c(0x7a)),_0x4d4c96;}catch(_0x597ed5){if(_0x597ed5 instanceof Error&&_0x4d096c(0x72)in _0x597ed5&&_0x597ed5[_0x4d096c(0x72)]===_0x4d096c(0x87))return null;throw new Error(_0x4d096c(0x74)+_0x5caac8+':\x20'+_0x597ed5);}}export function saveProjectConfig(_0x25234e,_0x523467){const _0x292758=a37_0x46deb5,_0x57eb61=_0x523467||process[_0x292758(0x83)](),_0x1b34d5=a37_0x52854e[_0x292758(0x80)](_0x57eb61,PROJECT_CONFIG_FILENAME),_0x1cfb86=JSON[_0x292758(0x6e)](_0x25234e);if(_0x1cfb86[_0x292758(0x8b)](_0x292758(0x73))||_0x1cfb86[_0x292758(0x8b)]('apiKey')||_0x1cfb86[_0x292758(0x8b)]('api_key'))throw new Error(_0x292758(0x70));if(_0x292758(0x82)in _0x25234e)throw new Error(_0x292758(0x88));a37_0x573aa6['writeFileSync'](_0x1b34d5,JSON[_0x292758(0x6e)](_0x25234e,null,0x2));}export function hasProjectConfig(_0x13751a){return findProjectConfigPath(_0x13751a)!==null;}export function getProjectRoot(_0x34394f){const _0x2ef6fc=a37_0x46deb5,_0x18774a=findProjectConfigPath(_0x34394f);return _0x18774a?a37_0x52854e[_0x2ef6fc(0x7b)](_0x18774a):null;}
|
package/dist/core/session.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x19c35a,_0xbe9a99){const _0x42159a=a38_0x4b02,_0x54f87c=_0x19c35a();while(!![]){try{const _0x52c2ad=-parseInt(_0x42159a(0x1f2))/0x1*(parseInt(_0x42159a(0x1fc))/0x2)+-parseInt(_0x42159a(0x204))/0x3+-parseInt(_0x42159a(0x1ee))/0x4+-parseInt(_0x42159a(0x1f3))/0x5+parseInt(_0x42159a(0x1fa))/0x6+parseInt(_0x42159a(0x1fe))/0x7+parseInt(_0x42159a(0x200))/0x8;if(_0x52c2ad===_0xbe9a99)break;else _0x54f87c['push'](_0x54f87c['shift']());}catch(_0x421c4d){_0x54f87c['push'](_0x54f87c['shift']());}}}(a38_0x22f8,0x8afab));import*as a38_0x5aa6e2 from'node:fs';import*as a38_0x2916d4 from'node:path';import*as a38_0x264614 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 _0x5d1332=a38_0x4b02,_0x1d97d7=process[_0x5d1332(0x1ef)][_0x5d1332(0x1fd)]||a38_0x2916d4['join'](a38_0x264614[_0x5d1332(0x206)](),'.config','tdx');return a38_0x2916d4[_0x5d1332(0x1ff)](_0x1d97d7,_0x5d1332(0x20e));}function getSessionPath(_0x2634d9){const _0x3f1f32=a38_0x4b02;return a38_0x2916d4[_0x3f1f32(0x1ff)](getSessionsDir(),_0x2634d9+_0x3f1f32(0x205));}export function getCurrentSessionPID(){return getPPID();}function a38_0x22f8(){const _0x1eda70=['unlinkSync','TD_API_KEY','1463004FUuwTX','.json','homedir','sort','parse','now','api_key','apiKey','stringify','API\x20keys\x20must\x20not\x20be\x20stored\x20in\x20session\x20context.\x20Use\x20.env\x20files\x20instead.','sessions','getTime','toString','createdAt','warn','Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20','test','replace','3042916rZXRUj','env','existsSync','writeFileSync','1nNnsGR','2232020TnvWAS','.\x20This\x20is\x20insecure.\x20Removing\x20session.','push','toISOString','includes','readFileSync','endsWith','2211180MvYEtk','readdirSync','697702Nhdofz','TDX_CONFIG_DIR','5107459usoibU','join','12117952RCptQK','utf-8'];a38_0x22f8=function(){return _0x1eda70;};return a38_0x22f8();}export function getSessionID(_0x5d900a){const _0x45c5e9=a38_0x4b02;if(_0x5d900a)return _0x5d900a;return getCurrentSessionPID()[_0x45c5e9(0x210)]();}function a38_0x4b02(_0x52b1e1,_0x331dbd){const _0x22f842=a38_0x22f8();return a38_0x4b02=function(_0x4b02ff,_0x2bde60){_0x4b02ff=_0x4b02ff-0x1ec;let _0x5aaf42=_0x22f842[_0x4b02ff];return _0x5aaf42;},a38_0x4b02(_0x52b1e1,_0x331dbd);}export function loadSessionContext(_0x19f55a){const _0x1e3229=a38_0x4b02,_0x1d17a9=_0x19f55a||getCurrentSessionPID()[_0x1e3229(0x210)](),_0x3cb101=/^\d+$/[_0x1e3229(0x1ec)](_0x1d17a9)?parseInt(_0x1d17a9,0xa):null;return _0x3cb101!==null?loadSessionContextByPID(_0x3cb101):loadSessionContextByString(_0x1d17a9);}export function loadSessionContextByPID(_0x4ae6d1){const _0x18d409=a38_0x4b02,_0x352b09=getSessionPath(_0x4ae6d1);if(!a38_0x5aa6e2[_0x18d409(0x1f0)](_0x352b09))return null;try{const _0x518c1c=a38_0x5aa6e2[_0x18d409(0x1f8)](_0x352b09,_0x18d409(0x201)),_0x36909a=JSON[_0x18d409(0x208)](_0x518c1c),_0x2215ad=new Date(_0x36909a[_0x18d409(0x211)])[_0x18d409(0x20f)](),_0x4bbe76=Date[_0x18d409(0x209)]();if(_0x4bbe76-_0x2215ad>SESSION_EXPIRATION_MS)return a38_0x5aa6e2[_0x18d409(0x202)](_0x352b09),null;const _0x27ff08=JSON[_0x18d409(0x20c)](_0x36909a);if(_0x27ff08[_0x18d409(0x1f7)]('TD_API_KEY')||_0x27ff08[_0x18d409(0x1f7)](_0x18d409(0x20b))||_0x27ff08['includes'](_0x18d409(0x20a)))return console[_0x18d409(0x212)]('Warning:\x20API\x20keys\x20found\x20in\x20session\x20file\x20'+_0x352b09+_0x18d409(0x1f4)),a38_0x5aa6e2['unlinkSync'](_0x352b09),null;return _0x36909a;}catch{try{a38_0x5aa6e2[_0x18d409(0x202)](_0x352b09);}catch{}return null;}}function loadSessionContextByString(_0x1bce98){const _0x5878d7=a38_0x4b02,_0x416fa6=a38_0x2916d4[_0x5878d7(0x1ff)](getSessionsDir(),_0x1bce98+_0x5878d7(0x205));if(!a38_0x5aa6e2['existsSync'](_0x416fa6))return null;try{const _0x16fb1a=a38_0x5aa6e2['readFileSync'](_0x416fa6,_0x5878d7(0x201)),_0x4997f2=JSON[_0x5878d7(0x208)](_0x16fb1a),_0x3094cd=new Date(_0x4997f2[_0x5878d7(0x211)])['getTime'](),_0x539c60=Date['now']();if(_0x539c60-_0x3094cd>SESSION_EXPIRATION_MS)return a38_0x5aa6e2[_0x5878d7(0x202)](_0x416fa6),null;const _0x1d6fd0=JSON[_0x5878d7(0x20c)](_0x4997f2);if(_0x1d6fd0[_0x5878d7(0x1f7)](_0x5878d7(0x203))||_0x1d6fd0['includes'](_0x5878d7(0x20b))||_0x1d6fd0[_0x5878d7(0x1f7)](_0x5878d7(0x20a)))return console[_0x5878d7(0x212)](_0x5878d7(0x213)+_0x416fa6+_0x5878d7(0x1f4)),a38_0x5aa6e2[_0x5878d7(0x202)](_0x416fa6),null;return _0x4997f2;}catch{try{a38_0x5aa6e2[_0x5878d7(0x202)](_0x416fa6);}catch{}return null;}}export function saveSessionContext(_0x128242,_0x4756ef){const _0xcca3c8=a38_0x4b02,_0x562f52=_0x4756ef||getCurrentSessionPID()['toString'](),_0xd967d6=/^\d+$/[_0xcca3c8(0x1ec)](_0x562f52)?parseInt(_0x562f52,0xa):getCurrentSessionPID(),_0x35e585=a38_0x2916d4[_0xcca3c8(0x1ff)](getSessionsDir(),_0x562f52+'.json'),_0x65d13f=getSessionsDir();createSecureDirectory(_0x65d13f);const _0x2a26e4=JSON[_0xcca3c8(0x20c)](_0x128242);if(_0x2a26e4[_0xcca3c8(0x1f7)]('TD_API_KEY')||_0x2a26e4[_0xcca3c8(0x1f7)](_0xcca3c8(0x20b))||_0x2a26e4[_0xcca3c8(0x1f7)](_0xcca3c8(0x20a)))throw new Error(_0xcca3c8(0x20d));let _0x154e7e;const _0x427d9d=/^\d+$/[_0xcca3c8(0x1ec)](_0x562f52)?loadSessionContextByPID(parseInt(_0x562f52,0xa)):loadSessionContextByString(_0x562f52);_0x427d9d?_0x154e7e={..._0x427d9d,..._0x128242,'pid':_0xd967d6,'sessionId':_0x562f52!==_0xd967d6['toString']()?_0x562f52:undefined,'updatedAt':new Date()[_0xcca3c8(0x1f6)]()}:_0x154e7e={'pid':_0xd967d6,'sessionId':_0x562f52!==_0xd967d6['toString']()?_0x562f52:undefined,..._0x128242,'createdAt':new Date()['toISOString'](),'updatedAt':new Date()[_0xcca3c8(0x1f6)]()},a38_0x5aa6e2[_0xcca3c8(0x1f1)](_0x35e585,JSON[_0xcca3c8(0x20c)](_0x154e7e,null,0x2));}export function clearSessionContext(_0x4bbe79){const _0x53c774=a38_0x4b02,_0x53e2ce=_0x4bbe79||getCurrentSessionPID()[_0x53c774(0x210)](),_0x3e065c=a38_0x2916d4[_0x53c774(0x1ff)](getSessionsDir(),_0x53e2ce+_0x53c774(0x205));a38_0x5aa6e2['existsSync'](_0x3e065c)&&a38_0x5aa6e2[_0x53c774(0x202)](_0x3e065c);}export function cleanExpiredSessions(){const _0x3bb0c0=a38_0x4b02,_0x4e0308=getSessionsDir();if(!a38_0x5aa6e2[_0x3bb0c0(0x1f0)](_0x4e0308))return 0x0;let _0x4570f1=0x0;const _0x44d807=Date[_0x3bb0c0(0x209)]();try{const _0x441e44=a38_0x5aa6e2[_0x3bb0c0(0x1fb)](_0x4e0308);for(const _0x3e92e9 of _0x441e44){if(!_0x3e92e9[_0x3bb0c0(0x1f9)](_0x3bb0c0(0x205)))continue;const _0x42a24c=a38_0x2916d4[_0x3bb0c0(0x1ff)](_0x4e0308,_0x3e92e9),_0x272670=_0x3e92e9[_0x3bb0c0(0x1ed)](_0x3bb0c0(0x205),''),_0x45b960=parseInt(_0x272670,0xa),_0x118cb9=!isNaN(_0x45b960);if(_0x118cb9){if(!isProcessRunning(_0x45b960)){a38_0x5aa6e2[_0x3bb0c0(0x202)](_0x42a24c),_0x4570f1++;continue;}}try{const _0x51a19a=a38_0x5aa6e2[_0x3bb0c0(0x1f8)](_0x42a24c,_0x3bb0c0(0x201)),_0x524e56=JSON[_0x3bb0c0(0x208)](_0x51a19a),_0x39b0e0=new Date(_0x524e56[_0x3bb0c0(0x211)])[_0x3bb0c0(0x20f)]();_0x44d807-_0x39b0e0>SESSION_EXPIRATION_MS&&(a38_0x5aa6e2['unlinkSync'](_0x42a24c),_0x4570f1++);}catch{a38_0x5aa6e2[_0x3bb0c0(0x202)](_0x42a24c),_0x4570f1++;}}}catch{}return _0x4570f1;}export function listActiveSessions(){const _0x3ee63=a38_0x4b02,_0x23b07f=getSessionsDir();if(!a38_0x5aa6e2['existsSync'](_0x23b07f))return[];try{const _0x2a46b5=a38_0x5aa6e2[_0x3ee63(0x1fb)](_0x23b07f),_0x993e7=[];for(const _0x554ab9 of _0x2a46b5){if(!_0x554ab9[_0x3ee63(0x1f9)]('.json'))continue;const _0x19639e=_0x554ab9[_0x3ee63(0x1ed)](_0x3ee63(0x205),''),_0x586a09=parseInt(_0x19639e,0xa);!isNaN(_0x586a09)&&isProcessRunning(_0x586a09)&&_0x993e7[_0x3ee63(0x1f5)](_0x586a09);}return _0x993e7[_0x3ee63(0x207)]((_0x23015b,_0x3b61c9)=>_0x23015b-_0x3b61c9);}catch{return[];}}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x40c198,_0x5c7bc4){var _0xd4cc0a=a39_0xfdf4,_0x2bb128=_0x40c198();while(!![]){try{var _0x3e4b31=-parseInt(_0xd4cc0a(0xc7))/0x1*(parseInt(_0xd4cc0a(0xbd))/0x2)+-parseInt(_0xd4cc0a(0xbe))/0x3*(parseInt(_0xd4cc0a(0xbf))/0x4)+parseInt(_0xd4cc0a(0xc6))/0x5+parseInt(_0xd4cc0a(0xc4))/0x6+parseInt(_0xd4cc0a(0xc5))/0x7+-parseInt(_0xd4cc0a(0xc1))/0x8*(parseInt(_0xd4cc0a(0xc3))/0x9)+-parseInt(_0xd4cc0a(0xc0))/0xa*(-parseInt(_0xd4cc0a(0xc2))/0xb);if(_0x3e4b31===_0x5c7bc4)break;else _0x2bb128['push'](_0x2bb128['shift']());}catch(_0x4ac3cc){_0x2bb128['push'](_0x2bb128['shift']());}}}(a39_0x4b36,0xb48f3));export*from'./types/index.js';export*from'./core/config.js';function a39_0x4b36(){var _0x31e8ba=['8LPstmf','1051380NFOXfU','19832YCcGzR','198GtkqEX','4671zoCKgH','3259188SJNeUn','9631461isvIMQ','1406640cSsKDm','1LMBeHF','1703038wAdRkd','1822863SoBbQS'];a39_0x4b36=function(){return _0x31e8ba;};return a39_0x4b36();}export*from'./core/auth.js';export*from'./client/http-client.js';export*from'./client/td-client.js';export{TrinoClient}from'./client/trino-client.js';function a39_0xfdf4(_0x2ec922,_0x55a6f1){var _0x4b367e=a39_0x4b36();return a39_0xfdf4=function(_0xfdf454,_0x107d67){_0xfdf454=_0xfdf454-0xbd;var _0x49e6de=_0x4b367e[_0xfdf454];return _0x49e6de;},a39_0xfdf4(_0x2ec922,_0x55a6f1);}export*from'./client/rate-limiter.js';export*from'./types/trino.js';export*from'./commands/command.js';export*from'./commands/query-command.js';export*from'./commands/databases.js';export*from'./commands/tables.js';export*from'./commands/segments.js';export*from'./commands/activations.js';export*from'./commands/show.js';export*from'./commands/describe.js';export*from'./sdk/index.js';
|
|
@@ -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,17 +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
|
|
55
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":{...}}
|
|
56
74
|
* Returns parsed tool call with start/end indices, or null if not found
|
|
57
75
|
*/
|
|
58
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"}
|