@treasuredata/tdx 0.4.3 → 0.4.5
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/dist/build-info.json +2 -2
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client/cdp-api-client.js +1 -1
- package/dist/client/engage-api-client.d.ts +135 -0
- package/dist/client/engage-api-client.d.ts.map +1 -0
- package/dist/client/engage-api-client.js +1 -0
- package/dist/client/engage-api-client.js.map +1 -0
- package/dist/client/http-client.js +1 -1
- package/dist/client/llm-api-client.js +1 -1
- package/dist/client/rate-limiter.js +1 -1
- package/dist/client/td-api-client.js +1 -1
- package/dist/client/trino-api-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/auth-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/command.d.ts.map +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/command.js.map +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/engage-command.d.ts +197 -0
- package/dist/commands/engage-command.d.ts.map +1 -0
- package/dist/commands/engage-command.js +1 -0
- package/dist/commands/engage-command.js.map +1 -0
- 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.d.ts +1 -0
- package/dist/commands/use-command.d.ts.map +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/use-command.js.map +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/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.d.ts +1 -0
- package/dist/core/session.d.ts.map +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/session.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy/anthropic-adapter.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/engage.d.ts +256 -0
- package/dist/sdk/engage.d.ts.map +1 -0
- package/dist/sdk/engage.js +1 -0
- package/dist/sdk/engage.js.map +1 -0
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.d.ts +7 -0
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/index.js.map +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/workflow.js +1 -1
- package/dist/types/endpoints.d.ts +4 -0
- package/dist/types/endpoints.d.ts.map +1 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/endpoints.js.map +1 -1
- package/dist/types/engage.d.ts +442 -0
- package/dist/types/engage.d.ts.map +1 -0
- package/dist/types/engage.js +1 -0
- package/dist/types/engage.js.map +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +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/constants.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/llm-backup-utils.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/tdx-logger.js +1 -1
- package/dist/utils/tree-formatter.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/dist/utils/workflow-utils.js +1 -1
- package/package.json +1 -1
package/dist/commands/tables.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a33_0x5ce0e7=a33_0x3834;(function(_0xb365a2,_0x355ec1){const _0x3bf592=a33_0x3834,_0x1630a1=_0xb365a2();while(!![]){try{const _0x7a709f=-parseInt(_0x3bf592(0x116))/0x1*(-parseInt(_0x3bf592(0x137))/0x2)+-parseInt(_0x3bf592(0x111))/0x3*(parseInt(_0x3bf592(0x126))/0x4)+-parseInt(_0x3bf592(0x112))/0x5*(-parseInt(_0x3bf592(0x115))/0x6)+parseInt(_0x3bf592(0x10f))/0x7*(-parseInt(_0x3bf592(0x134))/0x8)+-parseInt(_0x3bf592(0x12c))/0x9*(-parseInt(_0x3bf592(0x113))/0xa)+parseInt(_0x3bf592(0x13c))/0xb*(-parseInt(_0x3bf592(0x12b))/0xc)+parseInt(_0x3bf592(0x118))/0xd;if(_0x7a709f===_0x355ec1)break;else _0x1630a1['push'](_0x1630a1['shift']());}catch(_0x3912f2){_0x1630a1['push'](_0x1630a1['shift']());}}}(a33_0x4a95,0x72f99));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput}from'../utils/command-output.js';import{parseTableReference}from'../utils/table-ref-parser.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../utils/constants.js';function a33_0x4a95(){const _0x1afac9=['\x20table','List\x20tables\x20in\x20a\x20database','Note:\x20\x27','Database\x20pattern:\x20','1293492wJRMYK','Table\x20pattern:\x20','\x20\x20tdx\x20tables\x20\x22*.user*\x22\x20\x20\x20\x20\x20\x20\x20->\x20tables\x20matching\x20user*\x20across\x20databases','error','\x20\x20Or:\x20\x20tdx\x20tables\x20--database\x20','815304jvdydV','747450dCRjAs','includes','\x20\x20tdx\x20tables\x20users\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20->\x20table\x20\x22users\x22\x20across\x20all\x20databases','query','\x27\x20may\x20not\x20exist\x20or\x20contains\x20no\x20tables','cause','.*\x22','limit','24uRmYPv','Did\x20you\x20mean\x20to\x20list\x20all\x20tables\x20from\x20database\x20\x27','name','36AjbRSQ','Site:\x20','listTables','\x20\x20Use:\x20tdx\x20tables\x20\x22','\x20\x20tdx\x20tables\x20\x22mydb.*\x22\x20\x20\x20\x20\x20\x20\x20\x20->\x20all\x20tables\x20from\x20mydb','55CCVqmv','Error:\x20Too\x20many\x20arguments.\x20Use\x20single\x20argument:','✔\x20Found\x20','445403jchHRt','length','3GfZswQ','1180mlVGUp','50abjKAM','validate','11958psVgfe','14834bUBxeR','execute','2239861DMcmQr','\x20\x20Or:\x20\x20tdx\x20tables\x20--in\x20','table','\x27\x20is\x20ambiguous.','data','database','Error:\x20Pattern\x20\x27','message','Error:\x20','Database:\x20all'];a33_0x4a95=function(){return _0x1afac9;};return a33_0x4a95();}import{withSpinner}from'../utils/spinner.js';function a33_0x3834(_0x4cf22e,_0x76cabf){const _0x4a9591=a33_0x4a95();return a33_0x3834=function(_0x38342a,_0x4c2eb6){_0x38342a=_0x38342a-0x10f;let _0x2d2246=_0x4a9591[_0x38342a];return _0x2d2246;},a33_0x3834(_0x4cf22e,_0x76cabf);}export class TablesCommand extends BaseCommand{[a33_0x5ce0e7(0x136)]='tables';['description']=a33_0x5ce0e7(0x123);async[a33_0x5ce0e7(0x117)](_0x486628){const _0x4589e7=a33_0x5ce0e7,{options:_0x1a41dd,args:_0x33cb9b,tdx:_0x52c051}=_0x486628;let _0x2e29f2;if(_0x33cb9b[_0x4589e7(0x110)]===0x0)_0x2e29f2={'database':undefined,'table':undefined,'original':''};else{if(_0x33cb9b[_0x4589e7(0x110)]===0x1)try{_0x2e29f2=parseTableReference(_0x33cb9b[0x0]);if(_0x2e29f2[_0x4589e7(0x11a)]&&!_0x2e29f2['database']&&!_0x2e29f2[_0x4589e7(0x11a)][_0x4589e7(0x12d)]('*')&&!_0x2e29f2[_0x4589e7(0x11a)][_0x4589e7(0x12d)]('?'))return console[_0x4589e7(0x129)](_0x4589e7(0x11e)+_0x33cb9b[0x0]+_0x4589e7(0x11b)),console[_0x4589e7(0x129)](_0x4589e7(0x135)+_0x2e29f2[_0x4589e7(0x11a)]+'\x27?'),console[_0x4589e7(0x129)](_0x4589e7(0x13a)+_0x2e29f2[_0x4589e7(0x11a)]+_0x4589e7(0x132)),console['error'](_0x4589e7(0x119)+_0x2e29f2[_0x4589e7(0x11a)]),console[_0x4589e7(0x129)](_0x4589e7(0x12a)+_0x2e29f2['table']),console[_0x4589e7(0x129)](''),console[_0x4589e7(0x129)](_0x4589e7(0x124)+_0x33cb9b[0x0]+'\x27\x20without\x20wildcards\x20would\x20search\x20for\x20tables\x20named\x20\x27'+_0x2e29f2[_0x4589e7(0x11a)]+'\x27\x20across\x20all\x20databases.'),0x1;}catch(_0x3d735f){return console[_0x4589e7(0x129)](_0x4589e7(0x120)+_0x3d735f[_0x4589e7(0x11f)]),0x1;}else return console[_0x4589e7(0x129)](_0x4589e7(0x13d)),console['error'](_0x4589e7(0x12e)),console[_0x4589e7(0x129)](_0x4589e7(0x13b)),console[_0x4589e7(0x129)]('\x20\x20tdx\x20tables\x20\x22mydb.users\x22\x20\x20\x20\x20->\x20table\x20\x22users\x22\x20in\x20database\x20mydb'),console[_0x4589e7(0x129)](_0x4589e7(0x128)),console[_0x4589e7(0x129)]('Or\x20use\x20--in\x20flag:'),console[_0x4589e7(0x129)]('\x20\x20tdx\x20tables\x20--in\x20mydb\x20\x20\x20\x20\x20\x20\x20->\x20all\x20tables\x20from\x20mydb'),0x1;}const _0x32971e=_0x1a41dd['database'];!_0x2e29f2[_0x4589e7(0x11d)]&&_0x32971e&&(_0x2e29f2[_0x4589e7(0x11d)]=_0x32971e);try{const _0x437961=_0x310e71=>_0x310e71&&(_0x310e71['includes']('*')||_0x310e71['includes']('?')),_0x2204d2=_0x437961(_0x2e29f2[_0x4589e7(0x11d)]);_0x1a41dd['verbose']&&(console['error'](_0x4589e7(0x138)+_0x1a41dd['site']),_0x2e29f2[_0x4589e7(0x11d)]?_0x2204d2?console[_0x4589e7(0x129)](_0x4589e7(0x125)+_0x2e29f2[_0x4589e7(0x11d)]):console[_0x4589e7(0x129)]('Database:\x20'+_0x2e29f2[_0x4589e7(0x11d)]):console[_0x4589e7(0x129)](_0x4589e7(0x121)),_0x2e29f2[_0x4589e7(0x11a)]&&console[_0x4589e7(0x129)](_0x4589e7(0x127)+_0x2e29f2[_0x4589e7(0x11a)]));const _0x3df4a8=_0x2e29f2['database']&&!_0x2204d2?_0x2e29f2['database']:undefined,_0x7e88c7=_0x2204d2?_0x2e29f2[_0x4589e7(0x11d)]:undefined,_0xd35ece=_0x2e29f2[_0x4589e7(0x11a)],_0x1a76db=resolveLimit(_0x1a41dd[_0x4589e7(0x133)],DEFAULT_LISTING_LIMIT),_0x59d0eb=await withSpinner('Listing\x20tables...',()=>_0x52c051[_0x4589e7(0x12f)][_0x4589e7(0x139)](_0x3df4a8,_0xd35ece,_0x7e88c7,_0x1a76db),{'verbose':_0x1a41dd['verbose']}),_0x498739=_0x59d0eb[_0x4589e7(0x11c)];if(_0x498739[_0x4589e7(0x110)]===0x0&&_0x2e29f2[_0x4589e7(0x11d)]&&!_0x2204d2)return console[_0x4589e7(0x129)]('✖\x20No\x20tables\x20found'),console[_0x4589e7(0x129)]('Database\x20\x27'+_0x2e29f2[_0x4589e7(0x11d)]+_0x4589e7(0x130)),0x1;return console[_0x4589e7(0x129)](_0x4589e7(0x13e)+_0x498739[_0x4589e7(0x110)]+_0x4589e7(0x122)+(_0x498739[_0x4589e7(0x110)]!==0x1?'s':'')),await handleSDKOutput(_0x498739,{..._0x1a41dd,'limit':_0x1a76db}),0x0;}catch(_0x3dd599){if(_0x3dd599 instanceof SDKError)return console['error'](_0x4589e7(0x120)+_0x3dd599[_0x4589e7(0x11f)]),_0x3dd599[_0x4589e7(0x131)]&&console['error']('\x20\x20Cause:\x20'+_0x3dd599['cause']),0x1;throw _0x3dd599;}}[a33_0x5ce0e7(0x114)](_0xb7edf0){return undefined;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-command.d.ts","sourceRoot":"","sources":["../../src/commands/use-command.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"use-command.d.ts","sourceRoot":"","sources":["../../src/commands/use-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAIhE,qBAAa,UAAW,SAAQ,WAAW;IACzC,QAAQ,CAAC,IAAI,SAAS;IACtB,QAAQ,CAAC,WAAW,+BAA+B;IAEnD,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,GAAG,SAAS;IA6BzD,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CAiExD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a34_0x4a18(_0x272dbf,_0x3f6dc8){const _0x4290c0=a34_0x4290();return a34_0x4a18=function(_0x4a1823,_0x87e3a6){_0x4a1823=_0x4a1823-0xef;let _0x5411cc=_0x4290c0[_0x4a1823];return _0x5411cc;},a34_0x4a18(_0x272dbf,_0x3f6dc8);}const a34_0x113830=a34_0x4a18;function a34_0x4290(){const _0x59f721=['engage_workspace','use','Usage:\x20tdx\x20use\x20<resource>\x20<value>\x0a','606240xeemvC','\x0aTip:\x20Use\x20\x27tdx\x20context\x20--clear\x27\x20to\x20clear\x20session\x20overrides','388258jwhyQH','1cckcJo','Session\x20engage_workspace\x20set\x20to:\x20','416FoBjUF','message','\x0aRun\x20\x27tdx\x20use\x20--help\x27\x20for\x20more\x20options','join','llm_project','Session\x20llm_project\x20set\x20to:\x20','Error:\x20','Session\x20parent_segment\x20set\x20to:\x20','includes','Invalid\x20resource:\x20','log','description','273880rHZwHC','name','\x20(session:\x20','database','length','session','1391964zBItga','profile','Session\x20profile\x20set\x20to:\x20','Resources:\x20database,\x20parent_segment,\x20llm_project,\x20profile\x0a','Error:\x20Profile\x20\x27','612900bgMLbS','Set\x20session-level\x20context','6430rXDUxh','\x0aUse\x20\x27tdx\x20profiles\x27\x20to\x20see\x20available\x20profiles','166854QPZQlx','parent_segment','error','Or\x20use:\x20tdx\x20context\x20--clear\x20to\x20clear\x20session\x20context\x0a'];a34_0x4290=function(){return _0x59f721;};return a34_0x4290();}(function(_0xd4efb,_0xe2eeab){const _0x4389f6=a34_0x4a18,_0xb76948=_0xd4efb();while(!![]){try{const _0x230c89=parseInt(_0x4389f6(0xfc))/0x1*(parseInt(_0x4389f6(0xfb))/0x2)+parseInt(_0x4389f6(0xf2))/0x3+-parseInt(_0x4389f6(0xfe))/0x4*(parseInt(_0x4389f6(0xf0))/0x5)+-parseInt(_0x4389f6(0xf9))/0x6+parseInt(_0x4389f6(0x110))/0x7+-parseInt(_0x4389f6(0x10a))/0x8+-parseInt(_0x4389f6(0x115))/0x9;if(_0x230c89===_0xe2eeab)break;else _0xb76948['push'](_0xb76948['shift']());}catch(_0x204d62){_0xb76948['push'](_0xb76948['shift']());}}}(a34_0x4290,0x1b378));import{BaseCommand}from'./command.js';import{saveSessionContext,getCurrentSessionPID}from'../core/session.js';import{profileExists}from'../core/profile.js';export class UseCommand extends BaseCommand{[a34_0x113830(0x10b)]=a34_0x113830(0xf7);[a34_0x113830(0x109)]=a34_0x113830(0xef);['validate'](_0x310383){const _0x52be40=a34_0x113830,{args:_0x359a5c}=_0x310383;if(_0x359a5c[_0x52be40(0x10e)]<0x2)return _0x52be40(0xf8)+_0x52be40(0x113)+_0x52be40(0xf5)+_0x52be40(0x100);const _0xcdb549=_0x359a5c[0x0],_0x242ca6=[_0x52be40(0x10d),_0x52be40(0xf3),_0x52be40(0x102),'profile',_0x52be40(0xf6)];if(!_0x242ca6[_0x52be40(0x106)](_0xcdb549))return _0x52be40(0x107)+_0xcdb549+'.\x20Must\x20be\x20one\x20of:\x20'+_0x242ca6[_0x52be40(0x101)](',\x20');return undefined;}async['execute'](_0x27760d){const _0x5290b3=a34_0x113830,{args:_0x4819de,options:_0x5677dc}=_0x27760d;try{const _0xa62d5b=_0x4819de[0x0],_0x521477=_0x4819de[0x1];if(_0xa62d5b===_0x5290b3(0x111)){if(!profileExists(_0x521477))return console[_0x5290b3(0xf4)](_0x5290b3(0x114)+_0x521477+'\x27\x20does\x20not\x20exist'),console['error'](_0x5290b3(0xf1)),0x1;const _0x3bd5b5=_0x5677dc[_0x5290b3(0x10f)]||getCurrentSessionPID()['toString']();return saveSessionContext({'profile':_0x521477},_0x5677dc[_0x5290b3(0x10f)]),console[_0x5290b3(0x108)](_0x5290b3(0x112)+_0x521477+_0x5290b3(0x10c)+_0x3bd5b5+')'),console['log'](_0x5290b3(0xfa)),0x0;}const _0x4bf4a0={},_0x3b4243=_0x5677dc[_0x5290b3(0x10f)]||getCurrentSessionPID()['toString']();switch(_0xa62d5b){case _0x5290b3(0x10d):_0x4bf4a0['database']=_0x521477,console[_0x5290b3(0x108)]('Session\x20database\x20set\x20to:\x20'+_0x521477+_0x5290b3(0x10c)+_0x3b4243+')');break;case'parent_segment':_0x4bf4a0[_0x5290b3(0xf3)]=_0x521477,console[_0x5290b3(0x108)](_0x5290b3(0x105)+_0x521477+_0x5290b3(0x10c)+_0x3b4243+')');break;case _0x5290b3(0x102):_0x4bf4a0[_0x5290b3(0x102)]=_0x521477,console[_0x5290b3(0x108)](_0x5290b3(0x103)+_0x521477+_0x5290b3(0x10c)+_0x3b4243+')');break;case _0x5290b3(0xf6):_0x4bf4a0['engage_workspace']=_0x521477,console['log'](_0x5290b3(0xfd)+_0x521477+'\x20(session:\x20'+_0x3b4243+')');break;}return saveSessionContext(_0x4bf4a0,_0x5677dc[_0x5290b3(0x10f)]),console['log']('\x0aTip:\x20Use\x20\x27tdx\x20context\x20--clear\x27\x20to\x20clear\x20session\x20overrides'),0x0;}catch(_0x41ab0e){return _0x41ab0e instanceof Error&&console[_0x5290b3(0xf4)](_0x5290b3(0x104)+_0x41ab0e[_0x5290b3(0xff)]),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-command.js","sourceRoot":"","sources":["../../src/commands/use-command.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"use-command.js","sourceRoot":"","sources":["../../src/commands/use-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,WAAW,EAAuB,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,OAAO,UAAW,SAAQ,WAAW;IAChC,IAAI,GAAG,KAAK,CAAC;IACb,WAAW,GAAG,2BAA2B,CAAC;IAEzC,QAAQ,CAAC,OAAuB;QACxC,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;QAEzB,kCAAkC;QAClC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpB,OAAO,CACL,qCAAqC;gBACrC,6DAA6D;gBAC7D,wDAAwD;gBACxD,yCAAyC,CAC1C,CAAC;QACJ,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,cAAc,GAAG;YACrB,UAAU;YACV,gBAAgB;YAChB,aAAa;YACb,SAAS;YACT,kBAAkB;SACnB,CAAC;QAEF,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACvC,OAAO,qBAAqB,QAAQ,qBAAqB,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACvF,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAuB;QACnC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAElC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACzB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAEtB,oEAAoE;YACpE,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,0BAA0B;gBAC1B,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC1B,OAAO,CAAC,KAAK,CAAC,mBAAmB,KAAK,kBAAkB,CAAC,CAAC;oBAC1D,OAAO,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;oBAChE,OAAO,CAAC,CAAC;gBACX,CAAC;gBAED,8BAA8B;gBAC9B,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,IAAI,oBAAoB,EAAE,CAAC,QAAQ,EAAE,CAAC;gBACvE,kBAAkB,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;gBAExD,OAAO,CAAC,GAAG,CAAC,2BAA2B,KAAK,cAAc,SAAS,GAAG,CAAC,CAAC;gBACxE,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;gBAC3E,OAAO,CAAC,CAAC;YACX,CAAC;YAED,8CAA8C;YAC9C,MAAM,aAAa,GAA2B,EAAE,CAAC;YACjD,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,IAAI,oBAAoB,EAAE,CAAC,QAAQ,EAAE,CAAC;YAEvE,QAAQ,QAAQ,EAAE,CAAC;gBACjB,KAAK,UAAU;oBACb,aAAa,CAAC,QAAQ,GAAG,KAAK,CAAC;oBAC/B,OAAO,CAAC,GAAG,CAAC,4BAA4B,KAAK,cAAc,SAAS,GAAG,CAAC,CAAC;oBACzE,MAAM;gBAER,KAAK,gBAAgB;oBACnB,aAAa,CAAC,cAAc,GAAG,KAAK,CAAC;oBACrC,OAAO,CAAC,GAAG,CAAC,kCAAkC,KAAK,cAAc,SAAS,GAAG,CAAC,CAAC;oBAC/E,MAAM;gBAER,KAAK,aAAa;oBAChB,aAAa,CAAC,WAAW,GAAG,KAAK,CAAC;oBAClC,OAAO,CAAC,GAAG,CAAC,+BAA+B,KAAK,cAAc,SAAS,GAAG,CAAC,CAAC;oBAC5E,MAAM;gBAER,KAAK,kBAAkB;oBACrB,aAAa,CAAC,gBAAgB,GAAG,KAAK,CAAC;oBACvC,OAAO,CAAC,GAAG,CAAC,oCAAoC,KAAK,cAAc,SAAS,GAAG,CAAC,CAAC;oBACjF,MAAM;YACV,CAAC;YAED,kBAAkB;YAClB,kBAAkB,CAAC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YAEnD,0BAA0B;YAC1B,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;YAE3E,OAAO,CAAC,CAAC;QACX,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC3C,CAAC;YACD,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a33_0x48c3d9=a33_0x305a;(function(_0x3ee415,_0x248ee3){const _0x5aaee9=a33_0x305a,_0xb49bbc=_0x3ee415();while(!![]){try{const _0x202d61=parseInt(_0x5aaee9(0xc1))/0x1+-parseInt(_0x5aaee9(0x136))/0x2*(-parseInt(_0x5aaee9(0x103))/0x3)+parseInt(_0x5aaee9(0xb7))/0x4*(parseInt(_0x5aaee9(0xf1))/0x5)+-parseInt(_0x5aaee9(0x113))/0x6+-parseInt(_0x5aaee9(0xdd))/0x7+parseInt(_0x5aaee9(0xee))/0x8+parseInt(_0x5aaee9(0xa6))/0x9;if(_0x202d61===_0x248ee3)break;else _0xb49bbc['push'](_0xb49bbc['shift']());}catch(_0x12a791){_0xb49bbc['push'](_0xb49bbc['shift']());}}}(a33_0xfa05,0x93ec0));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';function a33_0xfa05(){const _0x1f1334=['Getting\x20attempt\x20details...','taskName','\x20\x20Cause:\x20','attempt:','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','stat','sessions','18868HJBGmt','Attempt\x20ID:\x20','Cancelled','✔\x20Found\x20','index','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','Kill\x20a\x20running\x20attempt','workflow:download','sessionTime','Output\x20directory:\x20','727911sbdRNO','isArray','Session\x20time:\x20','logs','workflow:retry','limit','logFiles','includeSubtasks','\x20\x20Project:\x20','Status:\x20','from','params','Project\x20directory:\x20','fromTask','workflow:logs','\x20\x20New\x20attempt\x20ID:\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','Error:\x20','name','keys','execute','select','filesExtracted','\x20\x20Files\x20extracted:\x20','Resume\x20from:\x20','✔\x20Retry\x20started','✔\x20Deleted\x20project\x20','retrySession','3062157CywKJA','workflow:sessions','Getting\x20attempt\x20tasks...','running','log','Start\x20a\x20workflow\x20run','\x20attempt','format','parse','List\x20workflow\x20attempts','\x20session','Select\x20a\x20task\x20to\x20view\x20logs:','utf-8','Filter:\x20project=','\x20\x20Attempt\x20ID:\x20','done','canceling','3853712BKBfoA','\x20\x20Location:\x20','Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22','40YSYpDw','Show\x20tasks\x20for\x20an\x20attempt','Pushing\x20workflow\x20project...','Parameters:\x20','task','List\x20all\x20workflow\x20projects','\x20project','revision','Error:\x20Invalid\x20JSON\x20in\x20--params','projectId','No\x20log\x20content\x20found','workflow','retryAttemptName','Usage:\x20workflow:delete\x20<project-name-or-id>','Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20','Retrying\x20session...','round','status','6EeNoDT','\x20is\x20not\x20a\x20directory','split','push','success','Pattern:\x20','✔\x20Workflow\x20run\x20started','projects','Listing\x20workflow\x20sessions...','workflow:push','session','workflow:attempts','param','run','workflow:run','readFile','5916684Lbtxgr','project','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','\x20\x20Session\x20ID:\x20','Revision:\x20','List\x20workflows','finishedAt','substring','Downloading\x20project\x20','sessionId','✔\x20Pushed\x20','Error:\x20Workflow\x20identifier\x20is\x20required','yes','Show\x20logs\x20for\x20a\x20workflow\x20attempt','length','cause','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','workflow:workflows','Including\x20subtasks:\x20yes','Error:\x20Attempt\x20ID\x20is\x20required','Deleting\x20project\x20','List\x20workflow\x20execution\x20sessions','Show\x20specific\x20attempt\x20details','verbose','message','Filter:\x20','Starting\x20workflow\x20run...','Expected\x20format:\x20--param\x20key=value','description','Task\x20name:\x20','Listing\x20workflow\x20projects...','error','Validation:\x20skipped','Reason:\x20','attempts','429874yJZJcz','isDirectory','data','Killing\x20attempt...','\x20\x20Revision:\x20','skipValidation','Listing\x20workflows...','No\x20log\x20files\x20found\x20for\x20this\x20attempt','Listing\x20workflow\x20attempts...','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','tasks','\x20workflow','getTime','startsWith','workflows','Retrying\x20attempt...','projectName','delete','json','attempt','workflow:delete','...','\x20\x20Project\x20ID:\x20','3169962JTttsj','kill','Project\x20filter:\x20','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','workflow:projects','Downloading\x20logs...','createdAt','fs/promises','resumeFrom','\x20\x20Workflow:\x20'];a33_0xfa05=function(){return _0x1f1334;};return a33_0xfa05();}import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';import{formatBytes}from'../utils/formatters.js';import a33_0x1168db from'prompts';export class WorkflowProjectsCommand extends BaseCommand{[a33_0x48c3d9(0xd3)]=a33_0x48c3d9(0xaa);[a33_0x48c3d9(0x12f)]=a33_0x48c3d9(0xf6);async[a33_0x48c3d9(0xd5)](_0x588de8){const _0x3620fc=a33_0x48c3d9,{options:_0x3549ef,args:_0x55beb5,tdx:_0x170dff}=_0x588de8,_0x5a12f9=_0x55beb5[0x0];try{_0x3549ef['verbose']&&_0x5a12f9&&console[_0x3620fc(0x132)](_0x3620fc(0x108)+_0x5a12f9);const _0x57b8a5=await withSpinner(_0x3620fc(0x131),()=>_0x170dff[_0x3620fc(0xfc)][_0x3620fc(0x10a)](_0x5a12f9,{'limit':_0x3549ef[_0x3620fc(0xc6)]}),{'verbose':_0x3549ef['verbose']}),_0x284b20=_0x57b8a5[_0x3620fc(0x138)];return console['error'](_0x3620fc(0xba)+_0x284b20['length']+_0x3620fc(0xf7)+(_0x284b20[_0x3620fc(0x121)]!==0x1?'s':'')),await handleSDKOutput(_0x284b20,_0x3549ef),0x0;}catch(_0x5dbd3d){if(_0x5dbd3d instanceof SDKError)return console[_0x3620fc(0x132)](_0x3620fc(0xd2)+_0x5dbd3d['message']),_0x5dbd3d[_0x3620fc(0x122)]&&console[_0x3620fc(0x132)](_0x3620fc(0xb2)+_0x5dbd3d[_0x3620fc(0x122)]),0x1;throw _0x5dbd3d;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a33_0x48c3d9(0xd3)]=a33_0x48c3d9(0x124);[a33_0x48c3d9(0x12f)]=a33_0x48c3d9(0x118);async[a33_0x48c3d9(0xd5)](_0x577329){const _0x433e26=a33_0x48c3d9,{options:_0x5b456a,args:_0x58e365,tdx:_0x35dd53}=_0x577329,_0x46a6d3=_0x58e365[0x0];try{_0x5b456a[_0x433e26(0x12a)]&&_0x46a6d3&&console[_0x433e26(0x132)](_0x433e26(0xa8)+_0x46a6d3);const _0x3d510f=await withSpinner(_0x433e26(0x13c),()=>_0x35dd53['workflow'][_0x433e26(0x144)](_0x46a6d3,{'limit':_0x5b456a[_0x433e26(0xc6)]}),{'verbose':_0x5b456a[_0x433e26(0x12a)]}),_0x5a92a6=_0x3d510f[_0x433e26(0x138)];return console[_0x433e26(0x132)]('✔\x20Found\x20'+_0x5a92a6[_0x433e26(0x121)]+_0x433e26(0x141)+(_0x5a92a6[_0x433e26(0x121)]!==0x1?'s':'')),await handleSDKOutput(_0x5a92a6,_0x5b456a),0x0;}catch(_0x5f033a){if(_0x5f033a instanceof SDKError)return console[_0x433e26(0x132)](_0x433e26(0xd2)+_0x5f033a[_0x433e26(0x12b)]),_0x5f033a[_0x433e26(0x122)]&&console['error'](_0x433e26(0xb2)+_0x5f033a[_0x433e26(0x122)]),0x1;throw _0x5f033a;}}}export class WorkflowSessionsCommand extends BaseCommand{['name']=a33_0x48c3d9(0xde);[a33_0x48c3d9(0x12f)]=a33_0x48c3d9(0x128);async[a33_0x48c3d9(0xd5)](_0x17a850){const _0x1e20dc=a33_0x48c3d9,{options:_0x5f1fbc,args:_0x190c3c,tdx:_0x3d3787}=_0x17a850;let _0x589c76,_0x567512;if(_0x190c3c[0x0]){const _0x3b203e=_0x190c3c[0x0][_0x1e20dc(0x105)]('.');if(_0x3b203e['length']===0x1)_0x589c76=_0x3b203e[0x0];else{if(_0x3b203e[_0x1e20dc(0x121)]===0x2)[_0x589c76,_0x567512]=_0x3b203e;else return console['error'](_0x1e20dc(0xbc)),0x1;}}try{if(_0x5f1fbc[_0x1e20dc(0x12a)]){if(_0x589c76&&_0x567512)console[_0x1e20dc(0x132)](_0x1e20dc(0x12c)+_0x589c76+'.'+_0x567512);else _0x589c76&&console['error'](_0x1e20dc(0xea)+_0x589c76);const _0x5e6066=_0x5f1fbc[_0x1e20dc(0x102)];_0x5e6066&&console['error'](_0x1e20dc(0xca)+_0x5e6066);}const _0x2020ab=await withSpinner(_0x1e20dc(0x10b),()=>_0x3d3787[_0x1e20dc(0xfc)][_0x1e20dc(0xb6)]({'projectName':_0x589c76,'workflowName':_0x567512,'status':_0x5f1fbc[_0x1e20dc(0x102)],'fromTime':_0x5f1fbc[_0x1e20dc(0xcb)],'toTime':_0x5f1fbc['to'],'limit':_0x5f1fbc[_0x1e20dc(0xc6)]}),{'verbose':_0x5f1fbc[_0x1e20dc(0x12a)]}),_0x5a4aeb=_0x2020ab['data'];return console[_0x1e20dc(0x132)](_0x1e20dc(0xba)+_0x5a4aeb['length']+_0x1e20dc(0xe7)+(_0x5a4aeb['length']!==0x1?'s':'')),await handleSDKOutput(_0x5a4aeb,_0x5f1fbc),0x0;}catch(_0x16e0bb){if(_0x16e0bb instanceof SDKError)return console[_0x1e20dc(0x132)](_0x1e20dc(0xd2)+_0x16e0bb['message']),_0x16e0bb[_0x1e20dc(0x122)]&&console[_0x1e20dc(0x132)](_0x1e20dc(0xb2)+_0x16e0bb[_0x1e20dc(0x122)]),0x1;throw _0x16e0bb;}}}export class WorkflowAttemptsCommand extends BaseCommand{[a33_0x48c3d9(0xd3)]=a33_0x48c3d9(0x10e);[a33_0x48c3d9(0x12f)]=a33_0x48c3d9(0xe6);async[a33_0x48c3d9(0xd5)](_0xed4504){const _0x5d0b64=a33_0x48c3d9,{options:_0x21cbdf,args:_0x484ba7,tdx:_0x14ea71}=_0xed4504;let _0x3b9699,_0x1a3204;if(_0x484ba7[0x0]){const _0x4dcac1=_0x484ba7[0x0]['split']('.');if(_0x4dcac1[_0x5d0b64(0x121)]===0x1)_0x3b9699=_0x4dcac1[0x0];else{if(_0x4dcac1[_0x5d0b64(0x121)]===0x2)[_0x3b9699,_0x1a3204]=_0x4dcac1;else return console[_0x5d0b64(0x132)](_0x5d0b64(0xbc)),0x1;}}try{const _0x382568=_0x21cbdf['includeRetried'];if(_0x21cbdf[_0x5d0b64(0x12a)]){if(_0x3b9699&&_0x1a3204)console[_0x5d0b64(0x132)](_0x5d0b64(0x12c)+_0x3b9699+'.'+_0x1a3204);else _0x3b9699&&console[_0x5d0b64(0x132)](_0x5d0b64(0xea)+_0x3b9699);_0x382568&&console[_0x5d0b64(0x132)]('Include\x20retried:\x20yes');}const _0x54575d=await withSpinner(_0x5d0b64(0x13e),()=>_0x14ea71[_0x5d0b64(0xfc)][_0x5d0b64(0x135)]({'projectName':_0x3b9699,'workflowName':_0x1a3204,'includeRetried':_0x382568,'limit':_0x21cbdf['limit']}),{'verbose':_0x21cbdf['verbose']}),_0x2804e7=_0x54575d[_0x5d0b64(0x138)];return console[_0x5d0b64(0x132)](_0x5d0b64(0xba)+_0x2804e7['length']+_0x5d0b64(0xe3)+(_0x2804e7['length']!==0x1?'s':'')),await handleSDKOutput(_0x2804e7,_0x21cbdf),0x0;}catch(_0x2801fc){if(_0x2801fc instanceof SDKError)return console[_0x5d0b64(0x132)](_0x5d0b64(0xd2)+_0x2801fc[_0x5d0b64(0x12b)]),_0x2801fc['cause']&&console[_0x5d0b64(0x132)](_0x5d0b64(0xb2)+_0x2801fc[_0x5d0b64(0x122)]),0x1;throw _0x2801fc;}}}export class WorkflowAttemptCommand extends BaseCommand{['name']='workflow:attempt';['description']=a33_0x48c3d9(0x129);async[a33_0x48c3d9(0xd5)](_0x1332aa){const _0x219213=a33_0x48c3d9,{options:_0x335465,args:_0x2679c0,tdx:_0x2a2bef}=_0x1332aa,_0x17973f=_0x2679c0[0x0];if(!_0x17973f)return console['error'](_0x219213(0x126)),0x1;try{_0x335465[_0x219213(0x12a)]&&console['error'](_0x219213(0xb8)+_0x17973f);const _0x77eae9=await withSpinner(_0x219213(0xb0),()=>_0x2a2bef[_0x219213(0xfc)][_0x219213(0xa2)](_0x17973f),{'verbose':_0x335465[_0x219213(0x12a)]}),_0x152a16=_0x77eae9[_0x219213(0x138)];let _0x206178;!_0x152a16[_0x219213(0xec)]?_0x206178=_0x152a16['cancelRequested']?_0x219213(0xed):_0x219213(0xe0):_0x206178=_0x152a16[_0x219213(0x107)]?'success':_0x219213(0x132);let _0x48f20a;if(_0x152a16[_0x219213(0xac)]&&_0x152a16[_0x219213(0x119)]){const _0x5a9c9f=new Date(_0x152a16[_0x219213(0xac)])['getTime'](),_0x3fd334=new Date(_0x152a16['finishedAt'])[_0x219213(0x142)]();_0x48f20a=Math[_0x219213(0x101)]((_0x3fd334-_0x5a9c9f)/0x3e8);}const _0xbc3869={'attempt_id':_0x152a16['id'],'status':_0x206178,..._0x152a16[_0x219213(0xbb)]!==undefined&&{'index':_0x152a16[_0x219213(0xbb)]},..._0x152a16['project']&&{'project':_0x152a16[_0x219213(0x114)]['name']},..._0x152a16['workflow']&&{'workflow':_0x152a16['workflow'][_0x219213(0xd3)]},..._0x152a16[_0x219213(0x11c)]&&{'session_id':_0x152a16[_0x219213(0x11c)]},..._0x152a16[_0x219213(0xbf)]&&{'session_time':_0x152a16[_0x219213(0xbf)]},..._0x152a16[_0x219213(0xfd)]&&{'retry_attempt':_0x152a16[_0x219213(0xfd)]},..._0x48f20a!==undefined&&{'duration_sec':_0x48f20a},..._0x152a16['createdAt']&&{'created_at':_0x152a16[_0x219213(0xac)]},..._0x152a16[_0x219213(0x119)]&&{'finished_at':_0x152a16[_0x219213(0x119)]},...Object[_0x219213(0xd4)](_0x152a16[_0x219213(0xcc)])[_0x219213(0x121)]>0x0&&{'params':_0x152a16[_0x219213(0xcc)]}};return await handleSingleObjectOutput(_0xbc3869,_0x335465),0x0;}catch(_0x47e241){if(_0x47e241 instanceof SDKError)return console[_0x219213(0x132)](_0x219213(0xd2)+_0x47e241[_0x219213(0x12b)]),_0x47e241['cause']&&console[_0x219213(0x132)](_0x219213(0xb2)+_0x47e241[_0x219213(0x122)]),0x1;throw _0x47e241;}}}export class WorkflowTasksCommand extends BaseCommand{[a33_0x48c3d9(0xd3)]='workflow:tasks';[a33_0x48c3d9(0x12f)]=a33_0x48c3d9(0xf2);async[a33_0x48c3d9(0xd5)](_0x1fadd5){const _0x57a1d5=a33_0x48c3d9,{options:_0x1aa160,args:_0x14ea4c,tdx:_0x3cf404}=_0x1fadd5,_0x218ec1=_0x14ea4c[0x0];if(!_0x218ec1)return console[_0x57a1d5(0x132)](_0x57a1d5(0x126)),0x1;try{const _0x265350=_0x1aa160[_0x57a1d5(0xc8)];_0x1aa160[_0x57a1d5(0x12a)]&&(console[_0x57a1d5(0x132)]('Attempt\x20ID:\x20'+_0x218ec1),_0x265350&&console['error'](_0x57a1d5(0x125)));const _0x275ab6=await withSpinner(_0x57a1d5(0xdf),()=>_0x3cf404[_0x57a1d5(0xfc)][_0x57a1d5(0x140)](_0x218ec1,_0x265350||![]),{'verbose':_0x1aa160[_0x57a1d5(0x12a)]}),_0x39ac4a=_0x275ab6[_0x57a1d5(0x138)];return console['error']('✔\x20Found\x20'+_0x39ac4a[_0x57a1d5(0x121)]+'\x20task'+(_0x39ac4a[_0x57a1d5(0x121)]!==0x1?'s':'')),await handleSDKOutput(_0x39ac4a,_0x1aa160),0x0;}catch(_0x2add6f){if(_0x2add6f instanceof SDKError)return console['error'](_0x57a1d5(0xd2)+_0x2add6f[_0x57a1d5(0x12b)]),_0x2add6f['cause']&&console['error'](_0x57a1d5(0xb2)+_0x2add6f['cause']),0x1;throw _0x2add6f;}}}export class WorkflowLogsCommand extends BaseCommand{[a33_0x48c3d9(0xd3)]=a33_0x48c3d9(0xcf);[a33_0x48c3d9(0x12f)]=a33_0x48c3d9(0x120);async[a33_0x48c3d9(0xd5)](_0x3a1c65){const _0x505d17=a33_0x48c3d9,{options:_0x12e3e3,args:_0x57f56e,tdx:_0x3a6022}=_0x3a1c65,_0x280573=_0x57f56e[0x0];let _0x279987=_0x57f56e[0x1];if(!_0x280573)return console[_0x505d17(0x132)](_0x505d17(0x126)),0x1;try{_0x12e3e3['verbose']&&(console[_0x505d17(0x132)]('Attempt\x20ID:\x20'+_0x280573),_0x279987&&console[_0x505d17(0x132)](_0x505d17(0x130)+_0x279987));const _0x49414b=await withSpinner('Fetching\x20log\x20files...',()=>_0x3a6022['workflow'][_0x505d17(0xc7)](_0x280573,_0x279987),{'verbose':_0x12e3e3[_0x505d17(0x12a)]}),_0x399b2a=_0x49414b[_0x505d17(0x138)];if(_0x399b2a['length']===0x0)return console[_0x505d17(0x132)](_0x505d17(0x13d)),0x0;if(!_0x279987&&(_0x12e3e3[_0x505d17(0xa1)]||_0x12e3e3[_0x505d17(0xe4)]))return await handleSDKOutput(_0x399b2a,_0x12e3e3),0x0;if(!_0x279987){const _0x8e0e04=_0x399b2a['map'](_0x547490=>({'title':_0x547490[_0x505d17(0xb1)]+'\x20('+formatBytes(_0x547490['fileSize'])+')','value':_0x547490[_0x505d17(0xb1)]})),_0x40db2d=await a33_0x1168db({'type':_0x505d17(0xd6),'name':_0x505d17(0xf5),'message':_0x505d17(0xe8),'choices':_0x8e0e04});if(!_0x40db2d[_0x505d17(0xf5)])return console[_0x505d17(0x132)](_0x505d17(0xb9)),0x0;_0x279987=_0x40db2d[_0x505d17(0xf5)];}const _0x44d221=await withSpinner(_0x505d17(0xab),()=>_0x3a6022[_0x505d17(0xfc)][_0x505d17(0xc4)](_0x280573,_0x279987),{'verbose':_0x12e3e3['verbose']}),_0x44ef3c=_0x44d221[_0x505d17(0x138)];return _0x44ef3c?console[_0x505d17(0xe1)](_0x44ef3c):console['error'](_0x505d17(0xfb)),0x0;}catch(_0x47f371){if(_0x47f371 instanceof SDKError)return console['error'](_0x505d17(0xd2)+_0x47f371[_0x505d17(0x12b)]),_0x47f371[_0x505d17(0x122)]&&console['error'](_0x505d17(0xb2)+_0x47f371['cause']),0x1;throw _0x47f371;}}}export class WorkflowKillCommand extends BaseCommand{[a33_0x48c3d9(0xd3)]='workflow:kill';[a33_0x48c3d9(0x12f)]=a33_0x48c3d9(0xbd);async[a33_0x48c3d9(0xd5)](_0x5b4ad9){const _0x52b8d2=a33_0x48c3d9,{options:_0xfa7999,args:_0x33f995,tdx:_0x1ab792}=_0x5b4ad9,_0x5bc8d3=_0x33f995[0x0];if(!_0x5bc8d3)return console[_0x52b8d2(0x132)](_0x52b8d2(0x126)),0x1;try{const _0x4be424=_0xfa7999['reason'];_0xfa7999[_0x52b8d2(0x12a)]&&(console[_0x52b8d2(0x132)](_0x52b8d2(0xb8)+_0x5bc8d3),_0x4be424&&console[_0x52b8d2(0x132)](_0x52b8d2(0x134)+_0x4be424));if(!_0xfa7999[_0x52b8d2(0x11f)]){const _0x1bebe7=await confirm(_0x52b8d2(0xb4)+_0x5bc8d3+'?');if(!_0x1bebe7)return console['error'](_0x52b8d2(0xb9)),0x0;}const _0x50ebf0=await withSpinner(_0x52b8d2(0x139),()=>_0x1ab792[_0x52b8d2(0xfc)][_0x52b8d2(0xa7)](_0x5bc8d3,_0x4be424),{'verbose':_0xfa7999[_0x52b8d2(0x12a)]}),_0x131291=_0x50ebf0['data'];return console[_0x52b8d2(0x132)]('✔\x20'+_0x131291),0x0;}catch(_0x101b89){if(_0x101b89 instanceof SDKError)return console['error'](_0x52b8d2(0xd2)+_0x101b89[_0x52b8d2(0x12b)]),_0x101b89[_0x52b8d2(0x122)]&&console[_0x52b8d2(0x132)](_0x52b8d2(0xb2)+_0x101b89[_0x52b8d2(0x122)]),0x1;throw _0x101b89;}}}export class WorkflowRetryCommand extends BaseCommand{[a33_0x48c3d9(0xd3)]=a33_0x48c3d9(0xc5);[a33_0x48c3d9(0x12f)]='Retry\x20a\x20session\x20or\x20attempt';async['execute'](_0x1ca467){const _0x5e6e09=a33_0x48c3d9,{options:_0x278a46,args:_0x3a8a69,tdx:_0x59ba07}=_0x1ca467,_0x620549=_0x3a8a69[0x0];if(!_0x620549)return console['error']('Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required'),console[_0x5e6e09(0x132)](_0x5e6e09(0x115)),0x1;let _0x5234f9=![],_0x21397a=_0x620549;if(_0x620549[_0x5e6e09(0x143)]('session:'))_0x5234f9=!![],_0x21397a=_0x620549['substring'](0x8);else{if(_0x620549[_0x5e6e09(0x143)](_0x5e6e09(0xb3)))_0x5234f9=![],_0x21397a=_0x620549[_0x5e6e09(0x11a)](0x8);else return console[_0x5e6e09(0x132)](_0x5e6e09(0xf0)),console[_0x5e6e09(0x132)](_0x5e6e09(0x115)),0x1;}try{const _0x287825=_0x278a46[_0x5e6e09(0xce)],_0x2b2980=_0x278a46[_0x5e6e09(0xae)],_0x21c983=_0x278a46[_0x5e6e09(0xcc)],_0x19f7e1=_0x278a46['force'];_0x278a46[_0x5e6e09(0x12a)]&&(console[_0x5e6e09(0x132)]('Target:\x20'+(_0x5234f9?_0x5e6e09(0x10d):_0x5e6e09(0xa2))+'\x20'+_0x21397a),_0x287825&&console['error']('From\x20task:\x20'+_0x287825),_0x2b2980&&console[_0x5e6e09(0x132)](_0x5e6e09(0xd9)+_0x2b2980),_0x21c983&&console['error']('Params:\x20'+_0x21c983),_0x19f7e1&&console[_0x5e6e09(0x132)]('Force:\x20yes'));let _0x517df1;if(_0x21c983)try{if(_0x21c983[_0x5e6e09(0x143)]('@')){const _0x33069a=await import(_0x5e6e09(0xad)),_0x39a851=_0x21c983[_0x5e6e09(0x11a)](0x1),_0x1aafe8=await _0x33069a[_0x5e6e09(0x112)](_0x39a851,_0x5e6e09(0xe9));_0x517df1=JSON[_0x5e6e09(0xe5)](_0x1aafe8);}else _0x517df1=JSON[_0x5e6e09(0xe5)](_0x21c983);}catch{return console[_0x5e6e09(0x132)](_0x5e6e09(0xf9)),0x1;}if(!_0x278a46[_0x5e6e09(0x11f)]){const _0x4e4750=await confirm(_0x5e6e09(0xff)+(_0x5234f9?_0x5e6e09(0x10d):'attempt')+'\x20'+_0x21397a+'?');if(!_0x4e4750)return console[_0x5e6e09(0x132)](_0x5e6e09(0xb9)),0x0;}let _0x5aba2e;_0x5234f9?_0x5aba2e=await withSpinner(_0x5e6e09(0x100),()=>_0x59ba07['workflow'][_0x5e6e09(0xdc)](_0x21397a,{'fromTask':_0x287825,'retryParams':_0x517df1}),{'verbose':_0x278a46['verbose']}):_0x5aba2e=await withSpinner(_0x5e6e09(0x9e),()=>_0x59ba07[_0x5e6e09(0xfc)]['retryAttempt'](_0x21397a,{'resumeFrom':_0x2b2980,'retryParams':_0x517df1,'force':_0x19f7e1}),{'verbose':_0x278a46['verbose']});const _0x5f4021=_0x5aba2e['data'];return console[_0x5e6e09(0x132)](_0x5e6e09(0xda)),console['error'](_0x5e6e09(0xd0)+_0x5f4021['attemptId']),console[_0x5e6e09(0x132)](_0x5e6e09(0x116)+_0x5f4021['sessionId']),0x0;}catch(_0x18e5ed){if(_0x18e5ed instanceof SDKError)return console[_0x5e6e09(0x132)](_0x5e6e09(0xd2)+_0x18e5ed[_0x5e6e09(0x12b)]),_0x18e5ed[_0x5e6e09(0x122)]&&console[_0x5e6e09(0x132)](_0x5e6e09(0xb2)+_0x18e5ed[_0x5e6e09(0x122)]),0x1;throw _0x18e5ed;}}}export class WorkflowRunCommand extends BaseCommand{[a33_0x48c3d9(0xd3)]=a33_0x48c3d9(0x111);[a33_0x48c3d9(0x12f)]=a33_0x48c3d9(0xe2);async[a33_0x48c3d9(0xd5)](_0x4dc74c){const _0x3050d6=a33_0x48c3d9,{options:_0x51f998,args:_0x1be16e,tdx:_0x29f903}=_0x4dc74c,_0x4127a3=_0x1be16e[0x0];if(!_0x4127a3)return console[_0x3050d6(0x132)](_0x3050d6(0x11e)),console['error']('Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]'),0x1;const _0xee8cde=_0x51f998[_0x3050d6(0x10f)],_0x3691e3=_0x51f998[_0x3050d6(0xbf)],_0x27142a={};if(_0xee8cde&&Array[_0x3050d6(0xc2)](_0xee8cde))for(const _0x5a61a7 of _0xee8cde){const _0x263c7b=_0x5a61a7['indexOf']('=');if(_0x263c7b===-0x1)return console[_0x3050d6(0x132)]('Error:\x20Invalid\x20parameter\x20format:\x20'+_0x5a61a7),console[_0x3050d6(0x132)](_0x3050d6(0x12e)),0x1;const _0x251000=_0x5a61a7[_0x3050d6(0x11a)](0x0,_0x263c7b),_0x166821=_0x5a61a7[_0x3050d6(0x11a)](_0x263c7b+0x1);try{_0x27142a[_0x251000]=JSON[_0x3050d6(0xe5)](_0x166821);}catch{_0x27142a[_0x251000]=_0x166821;}}_0x51f998['verbose']&&(console['error']('Workflow:\x20'+_0x4127a3),Object[_0x3050d6(0xd4)](_0x27142a)[_0x3050d6(0x121)]>0x0&&console['error'](_0x3050d6(0xf4)+JSON['stringify'](_0x27142a)),_0x3691e3&&console[_0x3050d6(0x132)](_0x3050d6(0xc3)+_0x3691e3));const _0x5725fc=await withSpinner(_0x3050d6(0x12d),()=>_0x29f903['workflow'][_0x3050d6(0x110)](_0x4127a3,_0x27142a,{'sessionTime':_0x3691e3}),{'verbose':_0x51f998[_0x3050d6(0x12a)]}),_0x15426b=_0x5725fc[_0x3050d6(0x138)];return console[_0x3050d6(0x132)](_0x3050d6(0x109)),console[_0x3050d6(0x132)](_0x3050d6(0xeb)+_0x15426b['id']),console[_0x3050d6(0x132)]('\x20\x20Session\x20ID:\x20'+_0x15426b['sessionId']),console[_0x3050d6(0x132)](_0x3050d6(0xc9)+_0x15426b[_0x3050d6(0x114)]?.['name']),console[_0x3050d6(0x132)](_0x3050d6(0xaf)+_0x15426b[_0x3050d6(0xfc)]?.[_0x3050d6(0xd3)]),0x0;}}function a33_0x305a(_0x3718da,_0x438f1c){const _0xfa050e=a33_0xfa05();return a33_0x305a=function(_0x305a52,_0xe83703){_0x305a52=_0x305a52-0x9e;let _0xc6fd85=_0xfa050e[_0x305a52];return _0xc6fd85;},a33_0x305a(_0x3718da,_0x438f1c);}export class WorkflowDownloadCommand extends BaseCommand{[a33_0x48c3d9(0xd3)]=a33_0x48c3d9(0xbe);['description']='Download\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a33_0x48c3d9(0xd5)](_0x597f83){const _0x5f4278=a33_0x48c3d9,{options:_0x470812,args:_0x95f041,tdx:_0x3e5880}=_0x597f83,_0x4b71bc=_0x95f041[0x0],_0x43c34a=_0x95f041[0x1]||'.';if(!_0x4b71bc)return console[_0x5f4278(0x132)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x5f4278(0x132)](_0x5f4278(0x123)),0x1;const _0x31be0a=_0x470812[_0x5f4278(0xf8)];_0x470812['verbose']&&(console[_0x5f4278(0x132)]('Project:\x20'+_0x4b71bc),console['error'](_0x5f4278(0xc0)+_0x43c34a),_0x31be0a&&console[_0x5f4278(0x132)](_0x5f4278(0x117)+_0x31be0a));const _0x438fb2=await withSpinner(_0x5f4278(0x11b)+_0x4b71bc+_0x5f4278(0xa4),()=>_0x3e5880['workflow']['download'](_0x4b71bc,_0x43c34a,{'revision':_0x31be0a}),{'verbose':_0x470812[_0x5f4278(0x12a)]}),_0x1fc01d=_0x438fb2['data'];return console[_0x5f4278(0x132)]('✔\x20Downloaded\x20'+_0x1fc01d[_0x5f4278(0x9f)]),console[_0x5f4278(0x132)](_0x5f4278(0x13a)+_0x1fc01d['revision']),console[_0x5f4278(0x132)](_0x5f4278(0xd8)+_0x1fc01d[_0x5f4278(0xd7)]),console['error'](_0x5f4278(0xef)+_0x43c34a+'/'+_0x1fc01d[_0x5f4278(0x9f)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a33_0x48c3d9(0xd3)]=a33_0x48c3d9(0x10c);[a33_0x48c3d9(0x12f)]='Push\x20workflow\x20project\x20to\x20Treasure\x20Data';async[a33_0x48c3d9(0xd5)](_0x31d51f){const _0x35fdb2=a33_0x48c3d9,{options:_0x5b78e7,args:_0x34c444,tdx:_0x4425ca}=_0x31d51f;let _0x66505='.',_0x47b163=_0x5b78e7['name'];if(_0x34c444[0x0]){const {promises:_0x7615f}=await import('fs');try{const _0x1c4743=await _0x7615f[_0x35fdb2(0xb5)](_0x34c444[0x0]);if(_0x1c4743[_0x35fdb2(0x137)]())_0x66505=_0x34c444[0x0];else return console['error'](_0x35fdb2(0xd2)+_0x34c444[0x0]+_0x35fdb2(0x104)),0x1;}catch{_0x47b163=_0x34c444[0x0],_0x66505='.';}}const _0x36bf69=_0x5b78e7[_0x35fdb2(0xf8)],_0x3ff6aa=_0x5b78e7[_0x35fdb2(0x13b)];_0x5b78e7[_0x35fdb2(0x12a)]&&(console['error'](_0x35fdb2(0xcd)+_0x66505),_0x47b163&&console[_0x35fdb2(0x132)]('Project\x20name:\x20'+_0x47b163),_0x36bf69&&console[_0x35fdb2(0x132)](_0x35fdb2(0x117)+_0x36bf69),_0x3ff6aa&&console['error'](_0x35fdb2(0x133)));const _0x3501b0=await withSpinner(_0x35fdb2(0xf3),()=>_0x4425ca[_0x35fdb2(0xfc)][_0x35fdb2(0x106)](_0x66505,{'projectName':_0x47b163,'revision':_0x36bf69,'skipValidation':_0x3ff6aa}),{'verbose':_0x5b78e7[_0x35fdb2(0x12a)]}),_0xc1b913=_0x3501b0['data'];return console[_0x35fdb2(0x132)](_0x35fdb2(0x11d)+_0xc1b913[_0x35fdb2(0x9f)]),console[_0x35fdb2(0x132)]('\x20\x20Project\x20ID:\x20'+_0xc1b913['projectId']),console[_0x35fdb2(0x132)](_0x35fdb2(0x13a)+_0xc1b913[_0x35fdb2(0xf8)]),0x0;}}export class WorkflowDeleteCommand extends BaseCommand{['name']=a33_0x48c3d9(0xa3);['description']=a33_0x48c3d9(0x13f);async[a33_0x48c3d9(0xd5)](_0x2906a6){const _0x251bb3=a33_0x48c3d9,{options:_0x486199,args:_0x3f7fa2,tdx:_0x4995d6}=_0x2906a6,_0x3f3c67=_0x3f7fa2[0x0];if(!_0x3f3c67)return console['error'](_0x251bb3(0xa9)),console['error'](_0x251bb3(0xfe)),0x1;_0x486199['verbose']&&console['error']('Project:\x20'+_0x3f3c67);if(!_0x486199[_0x251bb3(0x11f)]){const _0x1d35ab=await confirm(_0x251bb3(0xd1)+_0x3f3c67+'\x22?\x20This\x20cannot\x20be\x20undone.');if(!_0x1d35ab)return console[_0x251bb3(0x132)]('Cancelled'),0x0;}const _0xf68021=await withSpinner(_0x251bb3(0x127)+_0x3f3c67+_0x251bb3(0xa4),()=>_0x4995d6[_0x251bb3(0xfc)][_0x251bb3(0xa0)](_0x3f3c67),{'verbose':_0x486199[_0x251bb3(0x12a)]}),_0x512199=_0xf68021['data'];return console[_0x251bb3(0x132)](_0x251bb3(0xdb)+_0x512199[_0x251bb3(0x9f)]),console['error'](_0x251bb3(0xa5)+_0x512199[_0x251bb3(0xfa)]),0x0;}}
|
|
1
|
+
const a35_0x20fa8f=a35_0x595c;(function(_0x454bec,_0x5bf8f0){const _0x1f263e=a35_0x595c,_0x1744ef=_0x454bec();while(!![]){try{const _0xb662c1=-parseInt(_0x1f263e(0x105))/0x1+parseInt(_0x1f263e(0x158))/0x2+parseInt(_0x1f263e(0x103))/0x3+-parseInt(_0x1f263e(0x113))/0x4+-parseInt(_0x1f263e(0x162))/0x5*(parseInt(_0x1f263e(0x123))/0x6)+parseInt(_0x1f263e(0x11f))/0x7*(parseInt(_0x1f263e(0x146))/0x8)+parseInt(_0x1f263e(0x17c))/0x9;if(_0xb662c1===_0x5bf8f0)break;else _0x1744ef['push'](_0x1744ef['shift']());}catch(_0xeca878){_0x1744ef['push'](_0x1744ef['shift']());}}}(a35_0x422a,0x72cbb));import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../utils/command-output.js';import{withSpinner}from'../utils/spinner.js';import{confirm}from'../utils/prompt.js';function a35_0x595c(_0x52c162,_0x26491c){const _0x422a2c=a35_0x422a();return a35_0x595c=function(_0x595ccc,_0x1eea62){_0x595ccc=_0x595ccc-0xef;let _0xaa68d4=_0x422a2c[_0x595ccc];return _0xaa68d4;},a35_0x595c(_0x52c162,_0x26491c);}import{formatBytes}from'../utils/formatters.js';import a35_0x1cc267 from'prompts';export class WorkflowProjectsCommand extends BaseCommand{['name']=a35_0x20fa8f(0x166);[a35_0x20fa8f(0x10a)]='List\x20all\x20workflow\x20projects';async[a35_0x20fa8f(0x149)](_0xef4e9e){const _0x4cbdd4=a35_0x20fa8f,{options:_0x161f09,args:_0x5f54ae,tdx:_0x2b9452}=_0xef4e9e,_0x420064=_0x5f54ae[0x0];try{_0x161f09['verbose']&&_0x420064&&console[_0x4cbdd4(0x130)]('Pattern:\x20'+_0x420064);const _0x5865b7=await withSpinner(_0x4cbdd4(0x120),()=>_0x2b9452[_0x4cbdd4(0x100)][_0x4cbdd4(0x15e)](_0x420064,{'limit':_0x161f09[_0x4cbdd4(0xfe)]}),{'verbose':_0x161f09[_0x4cbdd4(0x12b)]}),_0x16bc88=_0x5865b7[_0x4cbdd4(0x14f)];return console[_0x4cbdd4(0x130)](_0x4cbdd4(0x110)+_0x16bc88['length']+_0x4cbdd4(0x16f)+(_0x16bc88['length']!==0x1?'s':'')),await handleSDKOutput(_0x16bc88,_0x161f09),0x0;}catch(_0x3abb76){if(_0x3abb76 instanceof SDKError)return console[_0x4cbdd4(0x130)](_0x4cbdd4(0x12f)+_0x3abb76[_0x4cbdd4(0x102)]),_0x3abb76[_0x4cbdd4(0x173)]&&console[_0x4cbdd4(0x130)](_0x4cbdd4(0x107)+_0x3abb76['cause']),0x1;throw _0x3abb76;}}}export class WorkflowWorkflowsCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x127);['description']=a35_0x20fa8f(0x154);async[a35_0x20fa8f(0x149)](_0x13d607){const _0x502803=a35_0x20fa8f,{options:_0x56d3a7,args:_0x385089,tdx:_0x25df7b}=_0x13d607,_0x18a1ec=_0x385089[0x0];try{_0x56d3a7[_0x502803(0x12b)]&&_0x18a1ec&&console[_0x502803(0x130)]('Project\x20filter:\x20'+_0x18a1ec);const _0xc866b=await withSpinner(_0x502803(0x18a),()=>_0x25df7b[_0x502803(0x100)]['workflows'](_0x18a1ec,{'limit':_0x56d3a7['limit']}),{'verbose':_0x56d3a7[_0x502803(0x12b)]}),_0x57c373=_0xc866b[_0x502803(0x14f)];return console[_0x502803(0x130)](_0x502803(0x110)+_0x57c373[_0x502803(0x14c)]+_0x502803(0x187)+(_0x57c373[_0x502803(0x14c)]!==0x1?'s':'')),await handleSDKOutput(_0x57c373,_0x56d3a7),0x0;}catch(_0x15333c){if(_0x15333c instanceof SDKError)return console[_0x502803(0x130)](_0x502803(0x12f)+_0x15333c[_0x502803(0x102)]),_0x15333c[_0x502803(0x173)]&&console['error']('\x20\x20Cause:\x20'+_0x15333c[_0x502803(0x173)]),0x1;throw _0x15333c;}}}export class WorkflowSessionsCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x14a);[a35_0x20fa8f(0x10a)]=a35_0x20fa8f(0x10d);async[a35_0x20fa8f(0x149)](_0x5e6d13){const _0x1cf963=a35_0x20fa8f,{options:_0x2a877b,args:_0x113fba,tdx:_0xc0b026}=_0x5e6d13;let _0x721d0f,_0x2bc1ec;if(_0x113fba[0x0]){const _0x512a57=_0x113fba[0x0][_0x1cf963(0x182)]('.');if(_0x512a57['length']===0x1)_0x721d0f=_0x512a57[0x0];else{if(_0x512a57[_0x1cf963(0x14c)]===0x2)[_0x721d0f,_0x2bc1ec]=_0x512a57;else return console[_0x1cf963(0x130)](_0x1cf963(0x159)),0x1;}}try{if(_0x2a877b[_0x1cf963(0x12b)]){if(_0x721d0f&&_0x2bc1ec)console['error']('Filter:\x20'+_0x721d0f+'.'+_0x2bc1ec);else _0x721d0f&&console[_0x1cf963(0x130)](_0x1cf963(0x138)+_0x721d0f);const _0x4f2b38=_0x2a877b[_0x1cf963(0x18e)];_0x4f2b38&&console['error'](_0x1cf963(0x137)+_0x4f2b38);}const _0x4d1f1c=await withSpinner(_0x1cf963(0x14b),()=>_0xc0b026[_0x1cf963(0x100)][_0x1cf963(0xf7)]({'projectName':_0x721d0f,'workflowName':_0x2bc1ec,'status':_0x2a877b['status'],'fromTime':_0x2a877b[_0x1cf963(0x183)],'toTime':_0x2a877b['to'],'limit':_0x2a877b[_0x1cf963(0xfe)]}),{'verbose':_0x2a877b[_0x1cf963(0x12b)]}),_0x26fc98=_0x4d1f1c[_0x1cf963(0x14f)];return console['error'](_0x1cf963(0x110)+_0x26fc98[_0x1cf963(0x14c)]+_0x1cf963(0x16e)+(_0x26fc98[_0x1cf963(0x14c)]!==0x1?'s':'')),await handleSDKOutput(_0x26fc98,_0x2a877b),0x0;}catch(_0x1f5f68){if(_0x1f5f68 instanceof SDKError)return console['error'](_0x1cf963(0x12f)+_0x1f5f68['message']),_0x1f5f68['cause']&&console['error'](_0x1cf963(0x107)+_0x1f5f68['cause']),0x1;throw _0x1f5f68;}}}export class WorkflowAttemptsCommand extends BaseCommand{['name']=a35_0x20fa8f(0x126);['description']=a35_0x20fa8f(0x16d);async[a35_0x20fa8f(0x149)](_0x1feacf){const _0x18d9b7=a35_0x20fa8f,{options:_0x5c80aa,args:_0x66aef0,tdx:_0x37ec34}=_0x1feacf;let _0x3c18c5,_0x3b6929;if(_0x66aef0[0x0]){const _0x5045ac=_0x66aef0[0x0]['split']('.');if(_0x5045ac[_0x18d9b7(0x14c)]===0x1)_0x3c18c5=_0x5045ac[0x0];else{if(_0x5045ac['length']===0x2)[_0x3c18c5,_0x3b6929]=_0x5045ac;else return console[_0x18d9b7(0x130)](_0x18d9b7(0x159)),0x1;}}try{const _0x35c840=_0x5c80aa[_0x18d9b7(0x109)];if(_0x5c80aa[_0x18d9b7(0x12b)]){if(_0x3c18c5&&_0x3b6929)console[_0x18d9b7(0x130)](_0x18d9b7(0x18c)+_0x3c18c5+'.'+_0x3b6929);else _0x3c18c5&&console[_0x18d9b7(0x130)](_0x18d9b7(0x138)+_0x3c18c5);_0x35c840&&console[_0x18d9b7(0x130)](_0x18d9b7(0x106));}const _0x3e9c91=await withSpinner(_0x18d9b7(0x176),()=>_0x37ec34[_0x18d9b7(0x100)][_0x18d9b7(0x11d)]({'projectName':_0x3c18c5,'workflowName':_0x3b6929,'includeRetried':_0x35c840,'limit':_0x5c80aa[_0x18d9b7(0xfe)]}),{'verbose':_0x5c80aa[_0x18d9b7(0x12b)]}),_0x1bcb22=_0x3e9c91[_0x18d9b7(0x14f)];return console['error']('✔\x20Found\x20'+_0x1bcb22['length']+'\x20attempt'+(_0x1bcb22[_0x18d9b7(0x14c)]!==0x1?'s':'')),await handleSDKOutput(_0x1bcb22,_0x5c80aa),0x0;}catch(_0x2a5d01){if(_0x2a5d01 instanceof SDKError)return console[_0x18d9b7(0x130)](_0x18d9b7(0x12f)+_0x2a5d01[_0x18d9b7(0x102)]),_0x2a5d01[_0x18d9b7(0x173)]&&console[_0x18d9b7(0x130)](_0x18d9b7(0x107)+_0x2a5d01['cause']),0x1;throw _0x2a5d01;}}}export class WorkflowAttemptCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x129);['description']='Show\x20specific\x20attempt\x20details';async[a35_0x20fa8f(0x149)](_0x3a9f63){const _0x44de79=a35_0x20fa8f,{options:_0x27796b,args:_0x566ffe,tdx:_0x342703}=_0x3a9f63,_0x488c42=_0x566ffe[0x0];if(!_0x488c42)return console['error'](_0x44de79(0x170)),0x1;try{_0x27796b[_0x44de79(0x12b)]&&console[_0x44de79(0x130)]('Attempt\x20ID:\x20'+_0x488c42);const _0x7b99d8=await withSpinner(_0x44de79(0x163),()=>_0x342703[_0x44de79(0x100)][_0x44de79(0x114)](_0x488c42),{'verbose':_0x27796b[_0x44de79(0x12b)]}),_0x4ba5f9=_0x7b99d8['data'];let _0x176099;!_0x4ba5f9['done']?_0x176099=_0x4ba5f9[_0x44de79(0xf9)]?_0x44de79(0x17b):_0x44de79(0x11c):_0x176099=_0x4ba5f9[_0x44de79(0x140)]?_0x44de79(0x140):'error';let _0x514fa3;if(_0x4ba5f9[_0x44de79(0x147)]&&_0x4ba5f9[_0x44de79(0x153)]){const _0x17fa75=new Date(_0x4ba5f9[_0x44de79(0x147)])[_0x44de79(0x189)](),_0x59cdc4=new Date(_0x4ba5f9[_0x44de79(0x153)])['getTime']();_0x514fa3=Math[_0x44de79(0xef)]((_0x59cdc4-_0x17fa75)/0x3e8);}const _0x47026e={'attempt_id':_0x4ba5f9['id'],'status':_0x176099,..._0x4ba5f9['index']!==undefined&&{'index':_0x4ba5f9['index']},..._0x4ba5f9[_0x44de79(0xf4)]&&{'project':_0x4ba5f9['project']['name']},..._0x4ba5f9[_0x44de79(0x100)]&&{'workflow':_0x4ba5f9[_0x44de79(0x100)][_0x44de79(0x124)]},..._0x4ba5f9['sessionId']&&{'session_id':_0x4ba5f9[_0x44de79(0xff)]},..._0x4ba5f9[_0x44de79(0x155)]&&{'session_time':_0x4ba5f9[_0x44de79(0x155)]},..._0x4ba5f9[_0x44de79(0x139)]&&{'retry_attempt':_0x4ba5f9['retryAttemptName']},..._0x514fa3!==undefined&&{'duration_sec':_0x514fa3},..._0x4ba5f9[_0x44de79(0x147)]&&{'created_at':_0x4ba5f9['createdAt']},..._0x4ba5f9[_0x44de79(0x153)]&&{'finished_at':_0x4ba5f9[_0x44de79(0x153)]},...Object['keys'](_0x4ba5f9[_0x44de79(0x132)])['length']>0x0&&{'params':_0x4ba5f9['params']}};return await handleSingleObjectOutput(_0x47026e,_0x27796b),0x0;}catch(_0x13fc60){if(_0x13fc60 instanceof SDKError)return console['error'](_0x44de79(0x12f)+_0x13fc60['message']),_0x13fc60['cause']&&console[_0x44de79(0x130)](_0x44de79(0x107)+_0x13fc60[_0x44de79(0x173)]),0x1;throw _0x13fc60;}}}export class WorkflowTasksCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x190);[a35_0x20fa8f(0x10a)]='Show\x20tasks\x20for\x20an\x20attempt';async[a35_0x20fa8f(0x149)](_0x291a3c){const _0x222236=a35_0x20fa8f,{options:_0x3a06ca,args:_0x2474c1,tdx:_0x2a7f88}=_0x291a3c,_0x5c8c97=_0x2474c1[0x0];if(!_0x5c8c97)return console[_0x222236(0x130)](_0x222236(0x170)),0x1;try{const _0x4c4f18=_0x3a06ca[_0x222236(0xf0)];_0x3a06ca['verbose']&&(console[_0x222236(0x130)]('Attempt\x20ID:\x20'+_0x5c8c97),_0x4c4f18&&console[_0x222236(0x130)](_0x222236(0x141)));const _0x7e02fa=await withSpinner(_0x222236(0xf5),()=>_0x2a7f88[_0x222236(0x100)][_0x222236(0x15b)](_0x5c8c97,_0x4c4f18||![]),{'verbose':_0x3a06ca[_0x222236(0x12b)]}),_0x1520d7=_0x7e02fa[_0x222236(0x14f)];return console[_0x222236(0x130)]('✔\x20Found\x20'+_0x1520d7[_0x222236(0x14c)]+_0x222236(0x117)+(_0x1520d7['length']!==0x1?'s':'')),await handleSDKOutput(_0x1520d7,_0x3a06ca),0x0;}catch(_0x1c373a){if(_0x1c373a instanceof SDKError)return console[_0x222236(0x130)](_0x222236(0x12f)+_0x1c373a['message']),_0x1c373a[_0x222236(0x173)]&&console['error'](_0x222236(0x107)+_0x1c373a[_0x222236(0x173)]),0x1;throw _0x1c373a;}}}export class WorkflowLogsCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x112);[a35_0x20fa8f(0x10a)]=a35_0x20fa8f(0x172);async[a35_0x20fa8f(0x149)](_0x3c800e){const _0x4bb1ac=a35_0x20fa8f,{options:_0x70159b,args:_0x1e62ea,tdx:_0x2df84d}=_0x3c800e,_0x2174a2=_0x1e62ea[0x0];let _0x3de448=_0x1e62ea[0x1];if(!_0x2174a2)return console[_0x4bb1ac(0x130)](_0x4bb1ac(0x170)),0x1;try{_0x70159b['verbose']&&(console[_0x4bb1ac(0x130)]('Attempt\x20ID:\x20'+_0x2174a2),_0x3de448&&console[_0x4bb1ac(0x130)]('Task\x20name:\x20'+_0x3de448));const _0xcba0dd=await withSpinner(_0x4bb1ac(0x171),()=>_0x2df84d['workflow'][_0x4bb1ac(0x134)](_0x2174a2,_0x3de448),{'verbose':_0x70159b[_0x4bb1ac(0x12b)]}),_0x54930d=_0xcba0dd[_0x4bb1ac(0x14f)];if(_0x54930d['length']===0x0)return console[_0x4bb1ac(0x130)](_0x4bb1ac(0x118)),0x0;if(!_0x3de448&&(_0x70159b[_0x4bb1ac(0x151)]||_0x70159b[_0x4bb1ac(0x108)]))return await handleSDKOutput(_0x54930d,_0x70159b),0x0;if(!_0x3de448){const _0x342d71=_0x54930d['map'](_0x345d5b=>({'title':_0x345d5b[_0x4bb1ac(0x148)]+'\x20('+formatBytes(_0x345d5b['fileSize'])+')','value':_0x345d5b['taskName']})),_0xc1a6e6=await a35_0x1cc267({'type':_0x4bb1ac(0x133),'name':_0x4bb1ac(0x10f),'message':_0x4bb1ac(0x16b),'choices':_0x342d71});if(!_0xc1a6e6[_0x4bb1ac(0x10f)])return console['error'](_0x4bb1ac(0xfa)),0x0;_0x3de448=_0xc1a6e6[_0x4bb1ac(0x10f)];}const _0x37acf0=await withSpinner('Downloading\x20logs...',()=>_0x2df84d['workflow'][_0x4bb1ac(0x180)](_0x2174a2,_0x3de448),{'verbose':_0x70159b[_0x4bb1ac(0x12b)]}),_0x5d66c1=_0x37acf0[_0x4bb1ac(0x14f)];return _0x5d66c1?console[_0x4bb1ac(0x17e)](_0x5d66c1):console[_0x4bb1ac(0x130)]('No\x20log\x20content\x20found'),0x0;}catch(_0x17b0c6){if(_0x17b0c6 instanceof SDKError)return console['error'](_0x4bb1ac(0x12f)+_0x17b0c6[_0x4bb1ac(0x102)]),_0x17b0c6[_0x4bb1ac(0x173)]&&console[_0x4bb1ac(0x130)]('\x20\x20Cause:\x20'+_0x17b0c6['cause']),0x1;throw _0x17b0c6;}}}export class WorkflowKillCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x17d);[a35_0x20fa8f(0x10a)]=a35_0x20fa8f(0x122);async[a35_0x20fa8f(0x149)](_0x394737){const _0x5ce714=a35_0x20fa8f,{options:_0x36991d,args:_0x2c6107,tdx:_0x3550df}=_0x394737,_0x3a08b2=_0x2c6107[0x0];if(!_0x3a08b2)return console[_0x5ce714(0x130)](_0x5ce714(0x170)),0x1;try{const _0xcc36fd=_0x36991d[_0x5ce714(0x116)];_0x36991d['verbose']&&(console[_0x5ce714(0x130)](_0x5ce714(0x174)+_0x3a08b2),_0xcc36fd&&console[_0x5ce714(0x130)]('Reason:\x20'+_0xcc36fd));if(!_0x36991d[_0x5ce714(0x175)]){const _0x54ea9c=await confirm(_0x5ce714(0xf1)+_0x3a08b2+'?');if(!_0x54ea9c)return console[_0x5ce714(0x130)](_0x5ce714(0xfa)),0x0;}const _0xf8e25=await withSpinner('Killing\x20attempt...',()=>_0x3550df['workflow'][_0x5ce714(0x10e)](_0x3a08b2,_0xcc36fd),{'verbose':_0x36991d[_0x5ce714(0x12b)]}),_0x5f1fb9=_0xf8e25[_0x5ce714(0x14f)];return console[_0x5ce714(0x130)]('✔\x20'+_0x5f1fb9),0x0;}catch(_0x26af0){if(_0x26af0 instanceof SDKError)return console[_0x5ce714(0x130)](_0x5ce714(0x12f)+_0x26af0[_0x5ce714(0x102)]),_0x26af0['cause']&&console[_0x5ce714(0x130)]('\x20\x20Cause:\x20'+_0x26af0['cause']),0x1;throw _0x26af0;}}}export class WorkflowRetryCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x104);[a35_0x20fa8f(0x10a)]='Retry\x20a\x20session\x20or\x20attempt';async['execute'](_0x1a6e34){const _0x357ce3=a35_0x20fa8f,{options:_0x12abf2,args:_0x369856,tdx:_0x3a2f53}=_0x1a6e34,_0x5e1891=_0x369856[0x0];if(!_0x5e1891)return console[_0x357ce3(0x130)](_0x357ce3(0x131)),console[_0x357ce3(0x130)]('Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>'),0x1;let _0x504143=![],_0x572ea3=_0x5e1891;if(_0x5e1891[_0x357ce3(0x13b)](_0x357ce3(0x144)))_0x504143=!![],_0x572ea3=_0x5e1891['substring'](0x8);else{if(_0x5e1891[_0x357ce3(0x13b)](_0x357ce3(0x150)))_0x504143=![],_0x572ea3=_0x5e1891['substring'](0x8);else return console['error']('Error:\x20Target\x20must\x20be\x20prefixed\x20with\x20\x22session:\x22\x20or\x20\x22attempt:\x22'),console[_0x357ce3(0x130)](_0x357ce3(0x136)),0x1;}try{const _0x4babee=_0x12abf2[_0x357ce3(0x14e)],_0x52777e=_0x12abf2[_0x357ce3(0x15a)],_0x25d7df=_0x12abf2[_0x357ce3(0x132)],_0x7cf3ed=_0x12abf2[_0x357ce3(0xf6)];_0x12abf2['verbose']&&(console[_0x357ce3(0x130)]('Target:\x20'+(_0x504143?'session':_0x357ce3(0x114))+'\x20'+_0x572ea3),_0x4babee&&console[_0x357ce3(0x130)](_0x357ce3(0x142)+_0x4babee),_0x52777e&&console[_0x357ce3(0x130)](_0x357ce3(0x145)+_0x52777e),_0x25d7df&&console['error'](_0x357ce3(0x178)+_0x25d7df),_0x7cf3ed&&console[_0x357ce3(0x130)](_0x357ce3(0x167)));let _0x374ffc;if(_0x25d7df)try{if(_0x25d7df[_0x357ce3(0x13b)]('@')){const _0x1da13a=await import(_0x357ce3(0xfc)),_0x256088=_0x25d7df['substring'](0x1),_0x93b6f=await _0x1da13a[_0x357ce3(0x160)](_0x256088,_0x357ce3(0x12a));_0x374ffc=JSON['parse'](_0x93b6f);}else _0x374ffc=JSON[_0x357ce3(0x16a)](_0x25d7df);}catch{return console[_0x357ce3(0x130)](_0x357ce3(0x10b)),0x1;}if(!_0x12abf2[_0x357ce3(0x175)]){const _0x4c2e99=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20retry\x20'+(_0x504143?_0x357ce3(0xfd):'attempt')+'\x20'+_0x572ea3+'?');if(!_0x4c2e99)return console[_0x357ce3(0x130)]('Cancelled'),0x0;}let _0x3c9b87;_0x504143?_0x3c9b87=await withSpinner(_0x357ce3(0x14d),()=>_0x3a2f53[_0x357ce3(0x100)]['retrySession'](_0x572ea3,{'fromTask':_0x4babee,'retryParams':_0x374ffc}),{'verbose':_0x12abf2[_0x357ce3(0x12b)]}):_0x3c9b87=await withSpinner('Retrying\x20attempt...',()=>_0x3a2f53[_0x357ce3(0x100)][_0x357ce3(0x125)](_0x572ea3,{'resumeFrom':_0x52777e,'retryParams':_0x374ffc,'force':_0x7cf3ed}),{'verbose':_0x12abf2[_0x357ce3(0x12b)]});const _0x1ff7b8=_0x3c9b87[_0x357ce3(0x14f)];return console['error'](_0x357ce3(0x179)),console['error'](_0x357ce3(0xf2)+_0x1ff7b8[_0x357ce3(0x121)]),console[_0x357ce3(0x130)](_0x357ce3(0xf8)+_0x1ff7b8[_0x357ce3(0xff)]),0x0;}catch(_0x2e0d54){if(_0x2e0d54 instanceof SDKError)return console[_0x357ce3(0x130)](_0x357ce3(0x12f)+_0x2e0d54[_0x357ce3(0x102)]),_0x2e0d54[_0x357ce3(0x173)]&&console[_0x357ce3(0x130)](_0x357ce3(0x107)+_0x2e0d54[_0x357ce3(0x173)]),0x1;throw _0x2e0d54;}}}export class WorkflowRunCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x12e);[a35_0x20fa8f(0x10a)]=a35_0x20fa8f(0x10c);async['execute'](_0x4f864b){const _0x57e63d=a35_0x20fa8f,{options:_0x3053ab,args:_0x576dae,tdx:_0x24e398}=_0x4f864b,_0xcb3923=_0x576dae[0x0];if(!_0xcb3923)return console['error']('Error:\x20Workflow\x20identifier\x20is\x20required'),console[_0x57e63d(0x130)](_0x57e63d(0x165)),0x1;const _0x484f5f=_0x3053ab[_0x57e63d(0x111)],_0x410158=_0x3053ab[_0x57e63d(0x155)],_0x148de9={};if(_0x484f5f&&Array[_0x57e63d(0x169)](_0x484f5f))for(const _0x3fa521 of _0x484f5f){const _0x33f4fd=_0x3fa521[_0x57e63d(0x13a)]('=');if(_0x33f4fd===-0x1)return console[_0x57e63d(0x130)](_0x57e63d(0x11e)+_0x3fa521),console[_0x57e63d(0x130)]('Expected\x20format:\x20--param\x20key=value'),0x1;const _0x51eda9=_0x3fa521[_0x57e63d(0x152)](0x0,_0x33f4fd),_0x1f0cab=_0x3fa521[_0x57e63d(0x152)](_0x33f4fd+0x1);try{_0x148de9[_0x51eda9]=JSON[_0x57e63d(0x16a)](_0x1f0cab);}catch{_0x148de9[_0x51eda9]=_0x1f0cab;}}_0x3053ab[_0x57e63d(0x12b)]&&(console['error'](_0x57e63d(0x101)+_0xcb3923),Object['keys'](_0x148de9)['length']>0x0&&console[_0x57e63d(0x130)](_0x57e63d(0x13d)+JSON[_0x57e63d(0x13f)](_0x148de9)),_0x410158&&console[_0x57e63d(0x130)](_0x57e63d(0x13c)+_0x410158));const _0x3a3154=await withSpinner('Starting\x20workflow\x20run...',()=>_0x24e398['workflow']['run'](_0xcb3923,_0x148de9,{'sessionTime':_0x410158}),{'verbose':_0x3053ab[_0x57e63d(0x12b)]}),_0x289cb6=_0x3a3154['data'];return console[_0x57e63d(0x130)](_0x57e63d(0x11b)),console[_0x57e63d(0x130)](_0x57e63d(0x17f)+_0x289cb6['id']),console[_0x57e63d(0x130)](_0x57e63d(0xf8)+_0x289cb6[_0x57e63d(0xff)]),console[_0x57e63d(0x130)]('\x20\x20Project:\x20'+_0x289cb6[_0x57e63d(0xf4)]?.['name']),console[_0x57e63d(0x130)](_0x57e63d(0x186)+_0x289cb6[_0x57e63d(0x100)]?.[_0x57e63d(0x124)]),0x0;}}export class WorkflowDownloadCommand extends BaseCommand{[a35_0x20fa8f(0x124)]=a35_0x20fa8f(0x168);[a35_0x20fa8f(0x10a)]='Download\x20workflow\x20project\x20from\x20Treasure\x20Data';async[a35_0x20fa8f(0x149)](_0x16529f){const _0x1d64cf=a35_0x20fa8f,{options:_0x8a19ae,args:_0x49c41,tdx:_0x34db01}=_0x16529f,_0x32013d=_0x49c41[0x0],_0x5cdd4b=_0x49c41[0x1]||'.';if(!_0x32013d)return console[_0x1d64cf(0x130)](_0x1d64cf(0x164)),console[_0x1d64cf(0x130)](_0x1d64cf(0x185)),0x1;const _0x4c05c4=_0x8a19ae['revision'];_0x8a19ae['verbose']&&(console['error']('Project:\x20'+_0x32013d),console[_0x1d64cf(0x130)](_0x1d64cf(0x15c)+_0x5cdd4b),_0x4c05c4&&console[_0x1d64cf(0x130)](_0x1d64cf(0x115)+_0x4c05c4));const _0x3d489b=await withSpinner(_0x1d64cf(0x188)+_0x32013d+_0x1d64cf(0x12d),()=>_0x34db01[_0x1d64cf(0x100)]['download'](_0x32013d,_0x5cdd4b,{'revision':_0x4c05c4}),{'verbose':_0x8a19ae['verbose']}),_0x6ac38=_0x3d489b['data'];return console[_0x1d64cf(0x130)]('✔\x20Downloaded\x20'+_0x6ac38[_0x1d64cf(0x156)]),console['error'](_0x1d64cf(0x143)+_0x6ac38['revision']),console[_0x1d64cf(0x130)](_0x1d64cf(0x18b)+_0x6ac38[_0x1d64cf(0x12c)]),console[_0x1d64cf(0x130)]('\x20\x20Location:\x20'+_0x5cdd4b+'/'+_0x6ac38[_0x1d64cf(0x156)]),0x0;}}export class WorkflowPushCommand extends BaseCommand{[a35_0x20fa8f(0x124)]='workflow:push';[a35_0x20fa8f(0x10a)]=a35_0x20fa8f(0x16c);async[a35_0x20fa8f(0x149)](_0x5baf3f){const _0x1a567c=a35_0x20fa8f,{options:_0x1d7d22,args:_0x1277c7,tdx:_0x381082}=_0x5baf3f;let _0x33af7c='.',_0x2a3331=_0x1d7d22['name'];if(_0x1277c7[0x0]){const {promises:_0x3b1cdc}=await import('fs');try{const _0x593245=await _0x3b1cdc['stat'](_0x1277c7[0x0]);if(_0x593245[_0x1a567c(0x181)]())_0x33af7c=_0x1277c7[0x0];else return console[_0x1a567c(0x130)](_0x1a567c(0x12f)+_0x1277c7[0x0]+_0x1a567c(0x17a)),0x1;}catch{_0x2a3331=_0x1277c7[0x0],_0x33af7c='.';}}const _0x4faf46=_0x1d7d22[_0x1a567c(0x15f)],_0xf0b255=_0x1d7d22[_0x1a567c(0x18d)];_0x1d7d22[_0x1a567c(0x12b)]&&(console[_0x1a567c(0x130)](_0x1a567c(0x177)+_0x33af7c),_0x2a3331&&console[_0x1a567c(0x130)](_0x1a567c(0x135)+_0x2a3331),_0x4faf46&&console[_0x1a567c(0x130)](_0x1a567c(0x115)+_0x4faf46),_0xf0b255&&console['error']('Validation:\x20skipped'));const _0x1a03fb=await withSpinner(_0x1a567c(0x161),()=>_0x381082[_0x1a567c(0x100)]['push'](_0x33af7c,{'projectName':_0x2a3331,'revision':_0x4faf46,'skipValidation':_0xf0b255}),{'verbose':_0x1d7d22[_0x1a567c(0x12b)]}),_0x20a674=_0x1a03fb[_0x1a567c(0x14f)];return console[_0x1a567c(0x130)](_0x1a567c(0x119)+_0x20a674[_0x1a567c(0x156)]),console[_0x1a567c(0x130)](_0x1a567c(0x128)+_0x20a674[_0x1a567c(0x11a)]),console['error'](_0x1a567c(0x143)+_0x20a674[_0x1a567c(0x15f)]),0x0;}}function a35_0x422a(){const _0x2f3d3a=['yes','Listing\x20workflow\x20attempts...','Project\x20directory:\x20','Params:\x20','✔\x20Retry\x20started','\x20is\x20not\x20a\x20directory','canceling','4643802OVRjJC','workflow:kill','log','\x20\x20Attempt\x20ID:\x20','logs','isDirectory','split','from','workflow:delete','Usage:\x20workflow:download\x20<project-name>\x20[output-dir]','\x20\x20Workflow:\x20','\x20workflow','Downloading\x20project\x20','getTime','Listing\x20workflows...','\x20\x20Files\x20extracted:\x20','Filter:\x20','skipValidation','status','Are\x20you\x20sure\x20you\x20want\x20to\x20delete\x20project\x20\x22','workflow:tasks','round','includeSubtasks','Are\x20you\x20sure\x20you\x20want\x20to\x20kill\x20attempt\x20','\x20\x20New\x20attempt\x20ID:\x20','Deleting\x20project\x20','project','Getting\x20attempt\x20tasks...','force','sessions','\x20\x20Session\x20ID:\x20','cancelRequested','Cancelled','Error:\x20Project\x20name\x20or\x20ID\x20is\x20required','fs/promises','session','limit','sessionId','workflow','Workflow:\x20','message','2371977kClBjs','workflow:retry','633313psHziX','Include\x20retried:\x20yes','\x20\x20Cause:\x20','format','includeRetried','description','Error:\x20Invalid\x20JSON\x20in\x20--params','Start\x20a\x20workflow\x20run','List\x20workflow\x20execution\x20sessions','kill','task','✔\x20Found\x20','param','workflow:logs','3334296DQaous','attempt','Revision:\x20','reason','\x20task','No\x20log\x20files\x20found\x20for\x20this\x20attempt','✔\x20Pushed\x20','projectId','✔\x20Workflow\x20run\x20started','running','attempts','Error:\x20Invalid\x20parameter\x20format:\x20','7uYLnUl','Listing\x20workflow\x20projects...','attemptId','Kill\x20a\x20running\x20attempt','23118jyxlaC','name','retryAttempt','workflow:attempts','workflow:workflows','\x20\x20Project\x20ID:\x20','workflow:attempt','utf-8','verbose','filesExtracted','...','workflow:run','Error:\x20','error','Error:\x20Session\x20ID\x20or\x20attempt\x20ID\x20is\x20required','params','select','logFiles','Project\x20name:\x20','Usage:\x20workflow\x20retry\x20session:<id>\x20or\x20workflow\x20retry\x20attempt:<id>','Status:\x20','Filter:\x20project=','retryAttemptName','indexOf','startsWith','Session\x20time:\x20','Parameters:\x20','Usage:\x20workflow:delete\x20<project-name-or-id>','stringify','success','Including\x20subtasks:\x20yes','From\x20task:\x20','\x20\x20Revision:\x20','session:','Resume\x20from:\x20','6861112fZbVsP','createdAt','taskName','execute','workflow:sessions','Listing\x20workflow\x20sessions...','length','Retrying\x20session...','fromTask','data','attempt:','json','substring','finishedAt','List\x20workflows','sessionTime','projectName','Project:\x20','801706hsiHCZ','Error:\x20Invalid\x20pattern.\x20Use\x20format:\x20project\x20or\x20project.workflow','resumeFrom','tasks','Output\x20directory:\x20','Delete\x20workflow\x20project\x20from\x20Treasure\x20Data','projects','revision','readFile','Pushing\x20workflow\x20project...','815bGiifj','Getting\x20attempt\x20details...','Error:\x20Project\x20name\x20is\x20required','Usage:\x20workflow\x20run\x20<project.workflow>\x20[options]','workflow:projects','Force:\x20yes','workflow:download','isArray','parse','Select\x20a\x20task\x20to\x20view\x20logs:','Push\x20workflow\x20project\x20to\x20Treasure\x20Data','List\x20workflow\x20attempts','\x20session','\x20project','Error:\x20Attempt\x20ID\x20is\x20required','Fetching\x20log\x20files...','Show\x20logs\x20for\x20a\x20workflow\x20attempt','cause','Attempt\x20ID:\x20'];a35_0x422a=function(){return _0x2f3d3a;};return a35_0x422a();}export class WorkflowDeleteCommand extends BaseCommand{['name']=a35_0x20fa8f(0x184);[a35_0x20fa8f(0x10a)]=a35_0x20fa8f(0x15d);async[a35_0x20fa8f(0x149)](_0x2eae91){const _0x38c91b=a35_0x20fa8f,{options:_0x1a089c,args:_0x5e27bc,tdx:_0x47d377}=_0x2eae91,_0x49d2be=_0x5e27bc[0x0];if(!_0x49d2be)return console[_0x38c91b(0x130)](_0x38c91b(0xfb)),console[_0x38c91b(0x130)](_0x38c91b(0x13e)),0x1;_0x1a089c[_0x38c91b(0x12b)]&&console[_0x38c91b(0x130)](_0x38c91b(0x157)+_0x49d2be);if(!_0x1a089c[_0x38c91b(0x175)]){const _0x4373d8=await confirm(_0x38c91b(0x18f)+_0x49d2be+'\x22?\x20This\x20cannot\x20be\x20undone.');if(!_0x4373d8)return console[_0x38c91b(0x130)](_0x38c91b(0xfa)),0x0;}const _0x3e26fa=await withSpinner(_0x38c91b(0xf3)+_0x49d2be+_0x38c91b(0x12d),()=>_0x47d377[_0x38c91b(0x100)]['delete'](_0x49d2be),{'verbose':_0x1a089c[_0x38c91b(0x12b)]}),_0x368584=_0x3e26fa['data'];return console[_0x38c91b(0x130)]('✔\x20Deleted\x20project\x20'+_0x368584[_0x38c91b(0x156)]),console[_0x38c91b(0x130)](_0x38c91b(0x128)+_0x368584[_0x38c91b(0x11a)]),0x0;}}
|
package/dist/core/auth.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5d1725,_0x2deedd){const _0x557e46=a36_0x4605,_0x31221b=_0x5d1725();while(!![]){try{const _0x4fb2c7=parseInt(_0x557e46(0xa1))/0x1*(parseInt(_0x557e46(0x9d))/0x2)+-parseInt(_0x557e46(0x92))/0x3+-parseInt(_0x557e46(0xa0))/0x4*(parseInt(_0x557e46(0x8a))/0x5)+-parseInt(_0x557e46(0x8b))/0x6*(-parseInt(_0x557e46(0x8d))/0x7)+parseInt(_0x557e46(0x93))/0x8+parseInt(_0x557e46(0x9a))/0x9*(-parseInt(_0x557e46(0x91))/0xa)+parseInt(_0x557e46(0x97))/0xb*(parseInt(_0x557e46(0x9f))/0xc);if(_0x4fb2c7===_0x2deedd)break;else _0x31221b['push'](_0x31221b['shift']());}catch(_0x45b0b4){_0x31221b['push'](_0x31221b['shift']());}}}(a36_0x264c,0xd2643));import{platform}from'os';import{readFileSync}from'fs';import{fileURLToPath}from'url';import{dirname,join}from'path';import{getAPIKey}from'./config.js';export function getVersion(){const _0x42323a=a36_0x4605;try{const _0x23c785=fileURLToPath(import.meta[_0x42323a(0x9c)]),_0x35577d=dirname(_0x23c785),_0xf49962=join(_0x35577d,_0x42323a(0x8e)),_0x505ef5=JSON[_0x42323a(0x8c)](readFileSync(_0xf49962,_0x42323a(0x90)));return _0x505ef5[_0x42323a(0x94)];}catch{return _0x42323a(0x8f);}}export function getUserAgent(){const _0x3132e1=a36_0x4605,_0x118ad1=getVersion(),_0x18e943=platform(),_0x283f5b=process['version'][_0x3132e1(0x95)]('v','');return'tdx/'+_0x118ad1+'\x20('+_0x18e943+_0x3132e1(0x96)+_0x283f5b+')';}function a36_0x4605(_0x1ea302,_0x36263f){const _0x264c96=a36_0x264c();return a36_0x4605=function(_0x460573,_0x24c699){_0x460573=_0x460573-0x8a;let _0x47b31b=_0x264c96[_0x460573];return _0x47b31b;},a36_0x4605(_0x1ea302,_0x36263f);}export function getAuthHeaders(_0x4453a2,_0xeb4db9){const _0x1f3c58=a36_0x4605,_0xab07db=getVersion(),_0x3feccd={'User-Agent':getUserAgent(),'X-TD-Client':_0x1f3c58(0xa2),'X-TD-Client-Version':_0xab07db};return _0xeb4db9&&(_0x3feccd[_0x1f3c58(0x99)]=_0x1f3c58(0x9e)+_0xeb4db9),_0x3feccd;}export function toHeaderRecord(_0x411e72){const _0x3293ef=a36_0x4605,_0x5e5f2a={};for(const [_0x349c7c,_0x5abf41]of Object[_0x3293ef(0x9b)](_0x411e72)){_0x5abf41!==undefined&&(_0x5e5f2a[_0x349c7c]=_0x5abf41);}return _0x5e5f2a;}function a36_0x264c(){const _0x4ef541=['276532PZgVWu','1267835nqhwbo','tdx','65wsGDWD','13854bpWohm','parse','1015UiOCWw','../../package.json','0.0.0','utf-8','1423700zjHrPg','3359220eCCqnF','200464JjUUqt','version','replace',';\x20node/','2992yTOSzJ','length','Authorization','45yzDYya','entries','url','2fzVvsv','TD1\x20','86664ryFKxI'];a36_0x264c=function(){return _0x4ef541;};return a36_0x264c();}export function getTrinoHeaders(_0x4c62fe,_0x2b8ae9){const _0x3a6421=a36_0x4605,_0x5938f7=getAuthHeaders(_0x4c62fe,_0x2b8ae9),_0x1c567a=toHeaderRecord(_0x5938f7);return delete _0x1c567a[_0x3a6421(0x99)],_0x2b8ae9&&(_0x1c567a['X-Trino-User']=_0x2b8ae9),_0x1c567a;}export function hasAPIKey(_0x59d55f){const _0x360b27=a36_0x4605,_0x2bec5e=getAPIKey(_0x59d55f);return _0x2bec5e!==undefined&&_0x2bec5e[_0x360b27(0x98)]>0x0;}
|
package/dist/core/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x5615d7,_0xd79c9d){const _0x15195a=a35_0x1449,_0x41b542=_0x5615d7();while(!![]){try{const _0x25c14e=parseInt(_0x15195a(0x190))/0x1+parseInt(_0x15195a(0x1a1))/0x2+-parseInt(_0x15195a(0x16a))/0x3*(-parseInt(_0x15195a(0x177))/0x4)+parseInt(_0x15195a(0x19f))/0x5+parseInt(_0x15195a(0x197))/0x6*(-parseInt(_0x15195a(0x188))/0x7)+-parseInt(_0x15195a(0x16b))/0x8*(parseInt(_0x15195a(0x194))/0x9)+-parseInt(_0x15195a(0x16c))/0xa;if(_0x25c14e===_0xd79c9d)break;else _0x41b542['push'](_0x41b542['shift']());}catch(_0x3fc5ba){_0x41b542['push'](_0x41b542['shift']());}}}(a35_0x60ab,0x743a0));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a35_0x49734b from'node:fs';import*as a35_0x54bfb3 from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a35_0x171a70 from'chalk';export function getConfigDir(){const _0x8190d2=a35_0x1449;return process[_0x8190d2(0x1a2)][_0x8190d2(0x178)]||join(homedir(),'.config',_0x8190d2(0x1a4));}export function getConfigFile(){const _0x23f04a=a35_0x1449;return join(getConfigDir(),_0x23f04a(0x198));}export function getConfigFilePath(_0x4517e3){const _0x464f7d=a35_0x1449,_0x16cc29=getConfigDir();return _0x4517e3?a35_0x54bfb3['join'](_0x16cc29,_0x464f7d(0x192)+_0x4517e3):getConfigFile();}export function getCacheDir(){const _0x3c1544=a35_0x1449;return process[_0x3c1544(0x1a2)][_0x3c1544(0x1a5)]||join(homedir(),_0x3c1544(0x193),_0x3c1544(0x1a4));}export function getLLMProjectCacheFile(){return join(getCacheDir(),'llm_default_project');}export function readCachedLLMProject(){const _0x3e53b4=a35_0x1449;try{const _0x7a4fbc=getLLMProjectCacheFile();if(!existsSync(_0x7a4fbc))return null;return readFileSync(_0x7a4fbc,_0x3e53b4(0x167))[_0x3e53b4(0x184)]();}catch{return null;}}export function writeCachedLLMProject(_0x1e350f){const _0x4d5bd3=a35_0x1449;try{const _0x17fa18=getCacheDir(),_0x3f6330=getLLMProjectCacheFile();!existsSync(_0x17fa18)&&mkdirSync(_0x17fa18,{'recursive':!![]}),writeFileSync(_0x3f6330,_0x1e350f,'utf-8');}catch(_0x125d72){console[_0x4d5bd3(0x179)](_0x4d5bd3(0x189),_0x125d72);}}export function parseEnvFile(_0x586511){const _0x1ea985=a35_0x1449,_0x260c94={};for(const _0xa635bc of _0x586511['split']('\x0a')){const _0x1e0bec=_0xa635bc[_0x1ea985(0x184)]();if(!_0x1e0bec||_0x1e0bec[_0x1ea985(0x18e)]('#'))continue;const _0x1ab98a=_0x1e0bec['match'](/^([^=]+)=(.*)$/);if(_0x1ab98a){const _0x2c9742=_0x1ab98a[0x1][_0x1ea985(0x184)]();let _0x303718=_0x1ab98a[0x2][_0x1ea985(0x184)]();(_0x303718[_0x1ea985(0x18e)]('\x22')&&_0x303718[_0x1ea985(0x18f)]('\x22')||_0x303718[_0x1ea985(0x18e)]('\x27')&&_0x303718[_0x1ea985(0x18f)]('\x27'))&&(_0x303718=_0x303718['slice'](0x1,-0x1)),_0x260c94[_0x2c9742]=_0x303718;}}return _0x260c94;}export function readUserConfig(){const _0x487874=a35_0x1449,_0xed822a=getConfigFile();if(!existsSync(_0xed822a))return{};try{const _0xded79a=readFileSync(_0xed822a,'utf-8');return parseEnvFile(_0xded79a);}catch(_0x4d5157){return console[_0x487874(0x18c)](_0x487874(0x186)+_0xed822a+':',_0x4d5157),{};}}export function resolveSite(_0x398778){const _0x4e1a44=a35_0x1449,_0xd01ac2=[_0x4e1a44(0x169),'jp01',_0x4e1a44(0x19e),'ap02',_0x4e1a44(0x172),_0x4e1a44(0x16e),_0x4e1a44(0x18b),_0x4e1a44(0x19a),_0x4e1a44(0x185),_0x4e1a44(0x168)];if(_0xd01ac2[_0x4e1a44(0x19c)](_0x398778))return _0x398778;if(_0x398778 in SITE_ALIASES)return SITE_ALIASES[_0x398778];return console[_0x4e1a44(0x18c)](_0x4e1a44(0x171)+_0x398778+_0x4e1a44(0x16d)),_0x4e1a44(0x169);}let cachedUserConfig=null;function a35_0x60ab(){const _0x5658d1=['toUpperCase','.env.','.cache','693nwXDop','profile:\x20','existsSync','6kRRgGV','.env','yellow','stg-us01','\x20(TD_API_KEY)','includes','replace','eu01','4736490muJuOW','join','1538064XoYWnP','env','filter','tdx','TDX_CACHE_DIR','TD_API_KEY','utf-8','stg-ap03','us01','5058cbKZHP','96464uenWMJ','12360740PRUApU','\x27,\x20defaulting\x20to\x20us01','dev-us01','Warning:\x20Failed\x20to\x20read\x20','ap02','Warning:\x20Unknown\x20site\x20\x27','ap03','split','⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage','global:\x20','jp01','1816eeYtNM','TDX_CONFIG_DIR','error','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','env:\x20','Warning:\x20Failed\x20to\x20load\x20','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','map','profiles','env:\x20TD_API_KEY','profile','apiKeys','some','trim','stg-jp01','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','readFileSync','4287710OhpByc','Warning:\x20Failed\x20to\x20cache\x20LLM\x20project\x20name:','TD_API_KEY_','dev-eu01','warn','entries','startsWith','endsWith','771360YLQWCs'];a35_0x60ab=function(){return _0x5658d1;};return a35_0x60ab();}export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x5a6213,_0x53a75e){const _0x15456a=a35_0x1449,_0x1d9fc3=_0x5a6213[_0x15456a(0x191)]()[_0x15456a(0x19d)](/-/g,'_'),_0x53b878=_0x15456a(0x18a)+_0x1d9fc3;if(process[_0x15456a(0x1a2)][_0x53b878])return process[_0x15456a(0x1a2)][_0x53b878];if(process[_0x15456a(0x1a2)][_0x15456a(0x1a6)])return process[_0x15456a(0x1a2)][_0x15456a(0x1a6)];const _0x24ec87=_0x53a75e||getActiveProfileName();if(_0x24ec87){const _0x1ab4d=loadProfileEnv(_0x24ec87);if(_0x1ab4d){if(_0x1ab4d[_0x53b878])return _0x1ab4d[_0x53b878];if(_0x1ab4d[_0x15456a(0x1a6)])return _0x1ab4d['TD_API_KEY'];}}const _0x76bae6=loadUserConfigOnce();if(_0x76bae6[_0x53b878])return _0x76bae6[_0x53b878];if(_0x76bae6[_0x15456a(0x1a6)])return _0x76bae6[_0x15456a(0x1a6)];return undefined;}export async function getAPIKeyAsync(_0x397817,_0x2cf431){const _0x122ac3=a35_0x1449,_0x3afead=_0x397817[_0x122ac3(0x191)]()['replace'](/-/g,'_'),_0x126544=_0x122ac3(0x18a)+_0x3afead;if(process[_0x122ac3(0x1a2)][_0x126544])return process['env'][_0x126544];if(process[_0x122ac3(0x1a2)]['TD_API_KEY'])return process[_0x122ac3(0x1a2)][_0x122ac3(0x1a6)];const _0x4075e6=_0x2cf431||getActiveProfileName()||undefined,_0x5c1e9e=getCachedCredential(_0x397817,_0x4075e6);if(_0x5c1e9e)return _0x5c1e9e;const _0x466f0c=await getKeychainAPIKey(_0x4075e6);if(_0x466f0c)return setCachedCredential(_0x466f0c,_0x397817,_0x4075e6),_0x466f0c;const _0x26cc30=getLegacyEnvAPIKey(_0x397817,_0x4075e6);if(_0x26cc30){const _0x4c29da=await isKeychainAvailable();if(_0x4c29da)try{await saveKeychainAPIKey(_0x26cc30,_0x4075e6),setCachedCredential(_0x26cc30,_0x397817,_0x4075e6);const _0x33b5a1=getConfigFilePath(_0x4075e6);cleanupLegacyEnvFile(_0x33b5a1)&&console[_0x122ac3(0x18c)](a35_0x171a70[_0x122ac3(0x199)](_0x122ac3(0x174)));}catch(_0x3e0ad0){console[_0x122ac3(0x18c)](a35_0x171a70['yellow'](_0x122ac3(0x17d)+_0x3e0ad0));}return _0x26cc30;}return undefined;}function getLegacyEnvAPIKey(_0x58a166,_0x5b2eb3){const _0x494851=a35_0x1449,_0x5d6906=_0x58a166[_0x494851(0x191)]()[_0x494851(0x19d)](/-/g,'_'),_0x3efc7a='TD_API_KEY_'+_0x5d6906;if(_0x5b2eb3){const _0x5e1538=loadProfileEnv(_0x5b2eb3);if(_0x5e1538){if(_0x5e1538[_0x3efc7a])return _0x5e1538[_0x3efc7a];if(_0x5e1538[_0x494851(0x1a6)])return _0x5e1538[_0x494851(0x1a6)];}}const _0x25420c=loadUserConfigOnce();if(_0x25420c[_0x3efc7a])return _0x25420c[_0x3efc7a];if(_0x25420c[_0x494851(0x1a6)])return _0x25420c[_0x494851(0x1a6)];return undefined;}function a35_0x1449(_0x6e8452,_0x1458ae){const _0x60ab45=a35_0x60ab();return a35_0x1449=function(_0x144930,_0x1989c8){_0x144930=_0x144930-0x167;let _0x33240c=_0x60ab45[_0x144930];return _0x33240c;},a35_0x1449(_0x6e8452,_0x1458ae);}function cleanupLegacyEnvFile(_0x47274e){const _0x41e92e=a35_0x1449;if(!existsSync(_0x47274e))return![];try{const _0x457e54=readFileSync(_0x47274e,_0x41e92e(0x167)),_0x471b61=_0x457e54[_0x41e92e(0x173)]('\x0a'),_0x8585ea=_0x471b61[_0x41e92e(0x1a3)](_0x17707c=>{const _0x2bda13=_0x41e92e,_0x2ef4b2=_0x17707c['trim']();if(!_0x2ef4b2||_0x2ef4b2['startsWith']('#'))return!![];const [_0x1f839a]=_0x2ef4b2[_0x2bda13(0x173)]('=');return!_0x1f839a[_0x2bda13(0x18e)](_0x2bda13(0x1a6));}),_0x301e88=_0x8585ea[_0x41e92e(0x183)](_0x4e470b=>{const _0x200d0f=_0x41e92e,_0x12aad8=_0x4e470b[_0x200d0f(0x184)]();return _0x12aad8&&!_0x12aad8[_0x200d0f(0x18e)]('#');});if(!_0x301e88)return unlinkSync(_0x47274e),!![];return writeFileSync(_0x47274e,_0x8585ea[_0x41e92e(0x1a0)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}export function getAPIKeySource(_0x2ff2ef,_0x32ed73){const _0x156384=a35_0x1449,_0x1f0a2f=_0x156384(0x18a)+_0x2ff2ef['toUpperCase']()[_0x156384(0x19d)](/-/g,'_');if(process[_0x156384(0x1a2)][_0x1f0a2f])return _0x156384(0x17b)+_0x1f0a2f;if(process[_0x156384(0x1a2)][_0x156384(0x1a6)])return _0x156384(0x180);const _0x25a2f7=_0x32ed73||getActiveProfileName();if(_0x25a2f7){const _0x287876=loadProfileEnv(_0x25a2f7);if(_0x287876){if(_0x287876[_0x1f0a2f])return _0x156384(0x195)+_0x25a2f7+'\x20('+_0x1f0a2f+')';if(_0x287876[_0x156384(0x1a6)])return'profile:\x20'+_0x25a2f7+_0x156384(0x19b);}}const _0x2f459b=loadUserConfigOnce(),_0x561da9=getConfigFile();if(_0x2f459b[_0x1f0a2f])return _0x156384(0x175)+_0x561da9+'\x20('+_0x1f0a2f+')';if(_0x2f459b['TD_API_KEY'])return _0x156384(0x175)+_0x561da9+_0x156384(0x19b);return null;}function loadProfileEnv(_0x5050a2){const _0x5a23e6=a35_0x1449,_0xa3364a=a35_0x54bfb3['join'](getConfigDir(),_0x5a23e6(0x192)+_0x5050a2);if(a35_0x49734b['existsSync'](_0xa3364a)){validateSecureFilePermissions(_0xa3364a);try{const _0x47300b=a35_0x49734b[_0x5a23e6(0x187)](_0xa3364a,_0x5a23e6(0x167));return parseEnvFile(_0x47300b);}catch(_0x15786f){console['warn'](_0x5a23e6(0x17c)+_0xa3364a+':\x20'+_0x15786f);}}const _0x4a79c7=a35_0x54bfb3[_0x5a23e6(0x1a0)](getConfigDir(),_0x5a23e6(0x17f),_0x5050a2,_0x5a23e6(0x198));if(a35_0x49734b[_0x5a23e6(0x196)](_0x4a79c7)){validateSecureFilePermissions(_0x4a79c7);try{const _0x179e42=a35_0x49734b[_0x5a23e6(0x187)](_0x4a79c7,_0x5a23e6(0x167));return parseEnvFile(_0x179e42);}catch(_0x26eb34){return console[_0x5a23e6(0x18c)]('Warning:\x20Failed\x20to\x20load\x20'+_0x4a79c7+':\x20'+_0x26eb34),null;}}return null;}function getActiveProfileName(){const _0x2ccaa5=a35_0x1449,_0x4fd05c=a35_0x54bfb3[_0x2ccaa5(0x1a0)](getConfigDir(),'tdx.json');if(!a35_0x49734b[_0x2ccaa5(0x196)](_0x4fd05c))return null;try{const _0x270a93=a35_0x49734b[_0x2ccaa5(0x187)](_0x4fd05c,_0x2ccaa5(0x167)),_0x37c170=JSON['parse'](_0x270a93);return _0x37c170[_0x2ccaa5(0x181)]||null;}catch{return null;}}export function saveAPIKey(_0xf2a6c2,_0x4a05d4,_0x5b6e78){const _0x563ff0=a35_0x1449,_0x5e6593=getConfigDir(),_0x17efdd=getConfigFilePath(_0x5b6e78);!existsSync(_0x5e6593)&&mkdirSync(_0x5e6593,{'recursive':!![],'mode':0x1c0});let _0x30c510={};if(existsSync(_0x17efdd))try{const _0x383d6c=readFileSync(_0x17efdd,_0x563ff0(0x167));_0x30c510=parseEnvFile(_0x383d6c);}catch(_0xe95289){console[_0x563ff0(0x18c)](_0x563ff0(0x16f)+_0x17efdd+':',_0xe95289);}const _0x15a376=_0xf2a6c2[_0x563ff0(0x191)]()[_0x563ff0(0x19d)](/-/g,'_');_0x30c510[_0x563ff0(0x18a)+_0x15a376]=_0x4a05d4;const _0x35d762=Object[_0x563ff0(0x18d)](_0x30c510)[_0x563ff0(0x17e)](([_0xd74214,_0x2e1725])=>_0xd74214+'='+_0x2e1725);writeFileSync(_0x17efdd,_0x35d762['join']('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x47a14f,_0x55d434,_0x5a7826){const _0x4aa043=a35_0x1449;await saveKeychainAPIKey(_0x47a14f,_0x5a7826),setCachedCredential(_0x47a14f,_0x55d434,_0x5a7826);const _0x2ec649=getConfigFilePath(_0x5a7826);cleanupLegacyEnvFile(_0x2ec649)&&console['warn'](a35_0x171a70['yellow'](_0x4aa043(0x17a)));}export function loadConfig(){const _0x41ddb7=a35_0x1449,_0x2e30cc={'apiKeys':{},'defaultSite':_0x41ddb7(0x169)},_0x1dfef4=[_0x41ddb7(0x169),_0x41ddb7(0x176),'eu01',_0x41ddb7(0x170),_0x41ddb7(0x172),_0x41ddb7(0x16e),_0x41ddb7(0x18b),'stg-us01','stg-jp01',_0x41ddb7(0x168)];for(const _0x5413db of _0x1dfef4){const _0x47796b=getAPIKey(_0x5413db);_0x47796b&&(_0x2e30cc[_0x41ddb7(0x182)][_0x5413db]=_0x47796b);}return _0x2e30cc;}
|
|
1
|
+
(function(_0x390a99,_0x333ec8){const _0x1465ac=a37_0x2176,_0x1bb99b=_0x390a99();while(!![]){try{const _0x5263fc=-parseInt(_0x1465ac(0x1e9))/0x1+-parseInt(_0x1465ac(0x203))/0x2+parseInt(_0x1465ac(0x1fe))/0x3*(parseInt(_0x1465ac(0x1e8))/0x4)+-parseInt(_0x1465ac(0x1f9))/0x5*(-parseInt(_0x1465ac(0x211))/0x6)+parseInt(_0x1465ac(0x214))/0x7*(-parseInt(_0x1465ac(0x1f7))/0x8)+parseInt(_0x1465ac(0x1ef))/0x9+parseInt(_0x1465ac(0x209))/0xa;if(_0x5263fc===_0x333ec8)break;else _0x1bb99b['push'](_0x1bb99b['shift']());}catch(_0x257e6a){_0x1bb99b['push'](_0x1bb99b['shift']());}}}(a37_0x1bc6,0x8219c));import{homedir}from'os';import{join}from'path';import{existsSync,readFileSync,writeFileSync,mkdirSync,unlinkSync}from'fs';import*as a37_0x1aefaf from'node:fs';import*as a37_0x2bcb39 from'node:path';import{SITE_ALIASES}from'../types/index.js';import{validateSecureFilePermissions}from'../utils/file-permissions.js';import{getKeychainAPIKey,saveKeychainAPIKey,isKeychainAvailable}from'./keychain.js';import{getCachedCredential,setCachedCredential}from'./credential-cache.js';import a37_0x711bed from'chalk';export function getConfigDir(){const _0x14bb6e=a37_0x2176;return process[_0x14bb6e(0x205)]['TDX_CONFIG_DIR']||join(homedir(),_0x14bb6e(0x20e),_0x14bb6e(0x215));}export function getConfigFile(){const _0x34d773=a37_0x2176;return join(getConfigDir(),_0x34d773(0x20f));}export function getConfigFilePath(_0x4fd3ab){const _0x5de132=a37_0x2176,_0x963b1b=getConfigDir();return _0x4fd3ab?a37_0x2bcb39[_0x5de132(0x1e2)](_0x963b1b,_0x5de132(0x218)+_0x4fd3ab):getConfigFile();}export function getCacheDir(){const _0x3d021a=a37_0x2176;return process[_0x3d021a(0x205)][_0x3d021a(0x21b)]||join(homedir(),_0x3d021a(0x1e0),'tdx');}export function getLLMProjectCacheFile(){const _0x53b21a=a37_0x2176;return join(getCacheDir(),_0x53b21a(0x1e1));}function a37_0x2176(_0x5c19c6,_0x149573){const _0x1bc631=a37_0x1bc6();return a37_0x2176=function(_0x2176a4,_0x349374){_0x2176a4=_0x2176a4-0x1dd;let _0xb8c2=_0x1bc631[_0x2176a4];return _0xb8c2;},a37_0x2176(_0x5c19c6,_0x149573);}export function readCachedLLMProject(){try{const _0x2aa976=getLLMProjectCacheFile();if(!existsSync(_0x2aa976))return null;return readFileSync(_0x2aa976,'utf-8')['trim']();}catch{return null;}}export function writeCachedLLMProject(_0x525296){const _0x11fdc0=a37_0x2176;try{const _0x3f907a=getCacheDir(),_0x530fd4=getLLMProjectCacheFile();!existsSync(_0x3f907a)&&mkdirSync(_0x3f907a,{'recursive':!![]}),writeFileSync(_0x530fd4,_0x525296,'utf-8');}catch(_0x2cca6e){console[_0x11fdc0(0x217)](_0x11fdc0(0x20b),_0x2cca6e);}}export function parseEnvFile(_0x578395){const _0x2bc33b=a37_0x2176,_0x1ce44c={};for(const _0x428a89 of _0x578395[_0x2bc33b(0x1ff)]('\x0a')){const _0x2d3fa5=_0x428a89[_0x2bc33b(0x1f2)]();if(!_0x2d3fa5||_0x2d3fa5[_0x2bc33b(0x1df)]('#'))continue;const _0xfe6048=_0x2d3fa5[_0x2bc33b(0x1f5)](/^([^=]+)=(.*)$/);if(_0xfe6048){const _0x5deb55=_0xfe6048[0x1][_0x2bc33b(0x1f2)]();let _0x31b628=_0xfe6048[0x2][_0x2bc33b(0x1f2)]();(_0x31b628[_0x2bc33b(0x1df)]('\x22')&&_0x31b628[_0x2bc33b(0x1ea)]('\x22')||_0x31b628[_0x2bc33b(0x1df)]('\x27')&&_0x31b628[_0x2bc33b(0x1ea)]('\x27'))&&(_0x31b628=_0x31b628[_0x2bc33b(0x1e4)](0x1,-0x1)),_0x1ce44c[_0x5deb55]=_0x31b628;}}return _0x1ce44c;}function a37_0x1bc6(){const _0x2ea597=['12906nlJiSr','env:\x20','warn','trim','includes','existsSync','match','dev-eu01','8hmjjgH','utf-8','4543745FPrfRj','env:\x20TD_API_KEY','⚠\x20Failed\x20to\x20migrate\x20API\x20key\x20to\x20keychain:\x20','TD_API_KEY','tdx.json','1068213lqbNlw','split','\x27,\x20defaulting\x20to\x20us01','eu01','apiKeys','772494bvwVLP','stg-ap03','env','entries','dev-us01','toUpperCase','4412120CvDgQH','replace','Warning:\x20Failed\x20to\x20cache\x20LLM\x20project\x20name:','ap02','\x20(TD_API_KEY)','.config','.env','stg-jp01','6SSSOdR','stg-us01','ap03','3811451UTxZun','tdx','profile','error','.env.','profiles','yellow','TDX_CACHE_DIR','readFileSync','global:\x20','startsWith','.cache','llm_default_project','join','Warning:\x20Failed\x20to\x20read\x20config\x20file\x20','slice','TD_API_KEY_','⚠\x20Cleaned\x20up\x20API\x20keys\x20from\x20legacy\x20.env\x20file','Warning:\x20Failed\x20to\x20load\x20','4DVnBFg','243834YFIXyV','endsWith','jp01','profile:\x20','us01','parse'];a37_0x1bc6=function(){return _0x2ea597;};return a37_0x1bc6();}export function readUserConfig(){const _0x5cbbb5=a37_0x2176,_0x5ee16f=getConfigFile();if(!existsSync(_0x5ee16f))return{};try{const _0x316b9a=readFileSync(_0x5ee16f,_0x5cbbb5(0x1f8));return parseEnvFile(_0x316b9a);}catch(_0x24f4c6){return console['warn'](_0x5cbbb5(0x1e3)+_0x5ee16f+':',_0x24f4c6),{};}}export function resolveSite(_0xcff8bf){const _0x573c6c=a37_0x2176,_0x1047ec=[_0x573c6c(0x1ed),_0x573c6c(0x1eb),'eu01',_0x573c6c(0x20c),'ap03',_0x573c6c(0x207),_0x573c6c(0x1f6),_0x573c6c(0x212),_0x573c6c(0x210),_0x573c6c(0x204)];if(_0x1047ec[_0x573c6c(0x1f3)](_0xcff8bf))return _0xcff8bf;if(_0xcff8bf in SITE_ALIASES)return SITE_ALIASES[_0xcff8bf];return console[_0x573c6c(0x1f1)]('Warning:\x20Unknown\x20site\x20\x27'+_0xcff8bf+_0x573c6c(0x200)),_0x573c6c(0x1ed);}let cachedUserConfig=null;export function loadUserConfigOnce(){return cachedUserConfig===null&&(cachedUserConfig=readUserConfig()),cachedUserConfig;}export function clearConfigCache(){cachedUserConfig=null;}export function getAPIKey(_0x18f9b4,_0x428b08){const _0xd11f90=a37_0x2176,_0x1bd0d4=_0x18f9b4['toUpperCase']()[_0xd11f90(0x20a)](/-/g,'_'),_0x499eed=_0xd11f90(0x1e5)+_0x1bd0d4;if(process[_0xd11f90(0x205)][_0x499eed])return process[_0xd11f90(0x205)][_0x499eed];if(process['env']['TD_API_KEY'])return process[_0xd11f90(0x205)][_0xd11f90(0x1fc)];const _0x3e9d60=_0x428b08||getActiveProfileName();if(_0x3e9d60){const _0x42081d=loadProfileEnv(_0x3e9d60);if(_0x42081d){if(_0x42081d[_0x499eed])return _0x42081d[_0x499eed];if(_0x42081d[_0xd11f90(0x1fc)])return _0x42081d[_0xd11f90(0x1fc)];}}const _0x3474f9=loadUserConfigOnce();if(_0x3474f9[_0x499eed])return _0x3474f9[_0x499eed];if(_0x3474f9[_0xd11f90(0x1fc)])return _0x3474f9['TD_API_KEY'];return undefined;}export async function getAPIKeyAsync(_0x36f91f,_0x1caf14){const _0x170912=a37_0x2176,_0x33c8eb=_0x36f91f[_0x170912(0x208)]()[_0x170912(0x20a)](/-/g,'_'),_0x3969f7=_0x170912(0x1e5)+_0x33c8eb;if(process[_0x170912(0x205)][_0x3969f7])return process[_0x170912(0x205)][_0x3969f7];if(process[_0x170912(0x205)][_0x170912(0x1fc)])return process[_0x170912(0x205)][_0x170912(0x1fc)];const _0x5cea8b=_0x1caf14||getActiveProfileName()||undefined,_0x46fe6e=getCachedCredential(_0x36f91f,_0x5cea8b);if(_0x46fe6e)return _0x46fe6e;const _0x10b833=await getKeychainAPIKey(_0x5cea8b);if(_0x10b833)return setCachedCredential(_0x10b833,_0x36f91f,_0x5cea8b),_0x10b833;const _0x4540cb=getLegacyEnvAPIKey(_0x36f91f,_0x5cea8b);if(_0x4540cb){const _0x3f639d=await isKeychainAvailable();if(_0x3f639d)try{await saveKeychainAPIKey(_0x4540cb,_0x5cea8b),setCachedCredential(_0x4540cb,_0x36f91f,_0x5cea8b);const _0x438521=getConfigFilePath(_0x5cea8b);cleanupLegacyEnvFile(_0x438521)&&console[_0x170912(0x1f1)](a37_0x711bed[_0x170912(0x21a)]('⚠\x20Migrated\x20API\x20key\x20from\x20.env\x20to\x20secure\x20keychain\x20storage'));}catch(_0x2523a2){console[_0x170912(0x1f1)](a37_0x711bed['yellow'](_0x170912(0x1fb)+_0x2523a2));}return _0x4540cb;}return undefined;}function getLegacyEnvAPIKey(_0x461b30,_0x1ecb1e){const _0x46a99c=a37_0x2176,_0x2ff4af=_0x461b30[_0x46a99c(0x208)]()[_0x46a99c(0x20a)](/-/g,'_'),_0x581068='TD_API_KEY_'+_0x2ff4af;if(_0x1ecb1e){const _0x464c0e=loadProfileEnv(_0x1ecb1e);if(_0x464c0e){if(_0x464c0e[_0x581068])return _0x464c0e[_0x581068];if(_0x464c0e[_0x46a99c(0x1fc)])return _0x464c0e[_0x46a99c(0x1fc)];}}const _0x2560fb=loadUserConfigOnce();if(_0x2560fb[_0x581068])return _0x2560fb[_0x581068];if(_0x2560fb[_0x46a99c(0x1fc)])return _0x2560fb[_0x46a99c(0x1fc)];return undefined;}function cleanupLegacyEnvFile(_0xfc990c){const _0x42c3cc=a37_0x2176;if(!existsSync(_0xfc990c))return![];try{const _0x508a17=readFileSync(_0xfc990c,_0x42c3cc(0x1f8)),_0x4578ef=_0x508a17['split']('\x0a'),_0x2771df=_0x4578ef['filter'](_0x2ad63a=>{const _0x12b3d0=_0x42c3cc,_0x5462cd=_0x2ad63a[_0x12b3d0(0x1f2)]();if(!_0x5462cd||_0x5462cd[_0x12b3d0(0x1df)]('#'))return!![];const [_0x1d50a7]=_0x5462cd[_0x12b3d0(0x1ff)]('=');return!_0x1d50a7[_0x12b3d0(0x1df)](_0x12b3d0(0x1fc));}),_0x1cc0d5=_0x2771df['some'](_0x58af2f=>{const _0x2f6cbe=_0x42c3cc,_0x102dfd=_0x58af2f[_0x2f6cbe(0x1f2)]();return _0x102dfd&&!_0x102dfd['startsWith']('#');});if(!_0x1cc0d5)return unlinkSync(_0xfc990c),!![];return writeFileSync(_0xfc990c,_0x2771df[_0x42c3cc(0x1e2)]('\x0a'),{'mode':0x180}),!![];}catch{return![];}}export function getAPIKeySource(_0x5a07f0,_0x43f76b){const _0x4c0939=a37_0x2176,_0x4872bf=_0x4c0939(0x1e5)+_0x5a07f0[_0x4c0939(0x208)]()[_0x4c0939(0x20a)](/-/g,'_');if(process[_0x4c0939(0x205)][_0x4872bf])return _0x4c0939(0x1f0)+_0x4872bf;if(process['env'][_0x4c0939(0x1fc)])return _0x4c0939(0x1fa);const _0x139689=_0x43f76b||getActiveProfileName();if(_0x139689){const _0x11a576=loadProfileEnv(_0x139689);if(_0x11a576){if(_0x11a576[_0x4872bf])return _0x4c0939(0x1ec)+_0x139689+'\x20('+_0x4872bf+')';if(_0x11a576[_0x4c0939(0x1fc)])return _0x4c0939(0x1ec)+_0x139689+_0x4c0939(0x20d);}}const _0x6ac8ca=loadUserConfigOnce(),_0x37d3ac=getConfigFile();if(_0x6ac8ca[_0x4872bf])return _0x4c0939(0x1de)+_0x37d3ac+'\x20('+_0x4872bf+')';if(_0x6ac8ca[_0x4c0939(0x1fc)])return'global:\x20'+_0x37d3ac+_0x4c0939(0x20d);return null;}function loadProfileEnv(_0x3420c0){const _0xf8977e=a37_0x2176,_0xd1b32=a37_0x2bcb39[_0xf8977e(0x1e2)](getConfigDir(),_0xf8977e(0x218)+_0x3420c0);if(a37_0x1aefaf[_0xf8977e(0x1f4)](_0xd1b32)){validateSecureFilePermissions(_0xd1b32);try{const _0x348dc1=a37_0x1aefaf[_0xf8977e(0x1dd)](_0xd1b32,'utf-8');return parseEnvFile(_0x348dc1);}catch(_0x57eae5){console['warn'](_0xf8977e(0x1e7)+_0xd1b32+':\x20'+_0x57eae5);}}const _0x52ad0b=a37_0x2bcb39[_0xf8977e(0x1e2)](getConfigDir(),_0xf8977e(0x219),_0x3420c0,_0xf8977e(0x20f));if(a37_0x1aefaf[_0xf8977e(0x1f4)](_0x52ad0b)){validateSecureFilePermissions(_0x52ad0b);try{const _0x323621=a37_0x1aefaf[_0xf8977e(0x1dd)](_0x52ad0b,'utf-8');return parseEnvFile(_0x323621);}catch(_0x3e0e9f){return console[_0xf8977e(0x1f1)](_0xf8977e(0x1e7)+_0x52ad0b+':\x20'+_0x3e0e9f),null;}}return null;}function getActiveProfileName(){const _0x4b28fe=a37_0x2176,_0x5b07df=a37_0x2bcb39[_0x4b28fe(0x1e2)](getConfigDir(),_0x4b28fe(0x1fd));if(!a37_0x1aefaf['existsSync'](_0x5b07df))return null;try{const _0x13adb2=a37_0x1aefaf[_0x4b28fe(0x1dd)](_0x5b07df,_0x4b28fe(0x1f8)),_0x323fac=JSON[_0x4b28fe(0x1ee)](_0x13adb2);return _0x323fac[_0x4b28fe(0x216)]||null;}catch{return null;}}export function saveAPIKey(_0x16fcff,_0x78511a,_0x520934){const _0x922356=a37_0x2176,_0x25656f=getConfigDir(),_0xe9c339=getConfigFilePath(_0x520934);!existsSync(_0x25656f)&&mkdirSync(_0x25656f,{'recursive':!![],'mode':0x1c0});let _0x32cdd9={};if(existsSync(_0xe9c339))try{const _0x1cef2e=readFileSync(_0xe9c339,_0x922356(0x1f8));_0x32cdd9=parseEnvFile(_0x1cef2e);}catch(_0x3bd700){console[_0x922356(0x1f1)]('Warning:\x20Failed\x20to\x20read\x20'+_0xe9c339+':',_0x3bd700);}const _0x2dd255=_0x16fcff[_0x922356(0x208)]()[_0x922356(0x20a)](/-/g,'_');_0x32cdd9[_0x922356(0x1e5)+_0x2dd255]=_0x78511a;const _0x2c8e06=Object[_0x922356(0x206)](_0x32cdd9)['map'](([_0x4544d2,_0x1dbe00])=>_0x4544d2+'='+_0x1dbe00);writeFileSync(_0xe9c339,_0x2c8e06[_0x922356(0x1e2)]('\x0a')+'\x0a',{'mode':0x180});}export async function saveAPIKeyAsync(_0x190acb,_0x1645ea,_0x17dc41){const _0x4ac0f9=a37_0x2176;await saveKeychainAPIKey(_0x190acb,_0x17dc41),setCachedCredential(_0x190acb,_0x1645ea,_0x17dc41);const _0x2f445b=getConfigFilePath(_0x17dc41);cleanupLegacyEnvFile(_0x2f445b)&&console[_0x4ac0f9(0x1f1)](a37_0x711bed[_0x4ac0f9(0x21a)](_0x4ac0f9(0x1e6)));}export function loadConfig(){const _0x2ecba9=a37_0x2176,_0x4c0f71={'apiKeys':{},'defaultSite':_0x2ecba9(0x1ed)},_0x1b8588=['us01',_0x2ecba9(0x1eb),_0x2ecba9(0x201),_0x2ecba9(0x20c),_0x2ecba9(0x213),_0x2ecba9(0x207),_0x2ecba9(0x1f6),'stg-us01',_0x2ecba9(0x210),_0x2ecba9(0x204)];for(const _0x181055 of _0x1b8588){const _0x360998=getAPIKey(_0x181055);_0x360998&&(_0x4c0f71[_0x2ecba9(0x202)][_0x181055]=_0x360998);}return _0x4c0f71;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x152cd5,_0x2064ef){const _0x31f6cc=a38_0x6ae2,_0x2a5f7d=_0x152cd5();while(!![]){try{const _0x32074a=-parseInt(_0x31f6cc(0x95))/0x1*(-parseInt(_0x31f6cc(0x9d))/0x2)+-parseInt(_0x31f6cc(0xa4))/0x3*(-parseInt(_0x31f6cc(0xa0))/0x4)+parseInt(_0x31f6cc(0xa3))/0x5+-parseInt(_0x31f6cc(0x9b))/0x6*(-parseInt(_0x31f6cc(0x9e))/0x7)+parseInt(_0x31f6cc(0xa2))/0x8+parseInt(_0x31f6cc(0xa1))/0x9+-parseInt(_0x31f6cc(0x9f))/0xa;if(_0x32074a===_0x2064ef)break;else _0x2a5f7d['push'](_0x2a5f7d['shift']());}catch(_0x186f79){_0x2a5f7d['push'](_0x2a5f7d['shift']());}}}(a38_0x2aeb,0x97380));const cache=new Map(),CACHE_TTL_MS=0x5*0x3c*0x3e8;function getCacheKey(_0x5568ff,_0x1c4023){const _0x56850e=a38_0x6ae2,_0x4c2e1f=_0x5568ff||_0x56850e(0xa5),_0x2f57aa=_0x1c4023||_0x56850e(0x96);return _0x4c2e1f+':'+_0x2f57aa;}export function getCachedCredential(_0x44103f,_0x165b00){const _0x51507f=a38_0x6ae2,_0x20f823=getCacheKey(_0x44103f,_0x165b00),_0x359f5b=cache[_0x51507f(0xa7)](_0x20f823);if(!_0x359f5b)return null;if(Date[_0x51507f(0x97)]()-_0x359f5b[_0x51507f(0x98)]>CACHE_TTL_MS)return cache['delete'](_0x20f823),null;return _0x359f5b[_0x51507f(0x9a)];}function a38_0x6ae2(_0x1b9b80,_0x559ac2){const _0x2aebdc=a38_0x2aeb();return a38_0x6ae2=function(_0x6ae291,_0xa919e){_0x6ae291=_0x6ae291-0x95;let _0x5baaf4=_0x2aebdc[_0x6ae291];return _0x5baaf4;},a38_0x6ae2(_0x1b9b80,_0x559ac2);}export function setCachedCredential(_0x6ce78a,_0x5834f6,_0x166c23){const _0xc5f93f=a38_0x6ae2,_0x5f03ec=getCacheKey(_0x5834f6,_0x166c23);cache[_0xc5f93f(0x99)](_0x5f03ec,{'apiKey':_0x6ce78a,'loadedAt':Date['now']()});}export function clearCredentialCache(){const _0x2fdee7=a38_0x6ae2;cache[_0x2fdee7(0x9c)]();}export function clearCachedCredential(_0x4373e2,_0x5bb5ca){const _0x450d29=a38_0x6ae2,_0x44088c=getCacheKey(_0x4373e2,_0x5bb5ca);cache[_0x450d29(0xa6)](_0x44088c);}function a38_0x2aeb(){const _0x178cd8=['loadedAt','set','apiKey','10926RXLgKL','clear','115274NauVUT','3759zwQAdg','39291430ZgYnek','1095220PSsoWc','4642731JHsXwr','6462464iRnsaK','859710jjEYYK','12ZOEcaN','__default_site__','delete','get','17cMrDmV','__default_profile__','now'];a38_0x2aeb=function(){return _0x178cd8;};return a38_0x2aeb();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a39_0x146272=a39_0x5519;(function(_0x507626,_0x459846){const _0x434da1=a39_0x5519,_0x23d865=_0x507626();while(!![]){try{const _0x39f842=-parseInt(_0x434da1(0x206))/0x1+-parseInt(_0x434da1(0x212))/0x2+-parseInt(_0x434da1(0x202))/0x3*(parseInt(_0x434da1(0x21a))/0x4)+-parseInt(_0x434da1(0x1fd))/0x5+-parseInt(_0x434da1(0x1f8))/0x6*(-parseInt(_0x434da1(0x1f4))/0x7)+parseInt(_0x434da1(0x1f0))/0x8+-parseInt(_0x434da1(0x217))/0x9*(-parseInt(_0x434da1(0x200))/0xa);if(_0x39f842===_0x459846)break;else _0x23d865['push'](_0x23d865['shift']());}catch(_0x58fc96){_0x23d865['push'](_0x23d865['shift']());}}}(a39_0x5c04,0xcf810));import{resolveSite,getAPIKey,getAPIKeyAsync,getConfigDir}from'./config.js';import{loadSessionContext,getCurrentSessionPID}from'./session.js';function a39_0x5519(_0x4f1033,_0x4b4090){const _0x5c04be=a39_0x5c04();return a39_0x5519=function(_0x5519f0,_0xf6785e){_0x5519f0=_0x5519f0-0x1de;let _0x9b65d6=_0x5c04be[_0x5519f0];return _0x9b65d6;},a39_0x5519(_0x4f1033,_0x4b4090);}import{loadProjectConfig,findProjectConfigPath}from'./project-config.js';import{getActiveProfile,loadProfile}from'./profile.js';function a39_0x5c04(){const _0x13453f=['config','readFileSync','display','5121370gFZqLZ','existsSync','Profile','35320620jRKbej','llmProject','62556HTpuMM','Profile\x20Credentials','getParameters','displayWithSources','796278jkSMom','(session:\x20','llm_project','getSource','global','cliFlags','CLI\x20flag:\x20--','sessions','[context]',':\x20none\x20(using\x20session:\x20','profile','profiles','3149152kGoopV','loadGlobalConfig','segmentPath','profileCredentials','us01','9ksLAzQ','session','Project','316LmFdCM','tdx.json','log','activeProfile','verbose','site','layers','sessionId','Global','parse','segment_path','database','apiKey','Session','resolveAPIKeyAsync',':\x20none','parentSegment','parent_segment','configFiles','utf-8','default','project','not\x20set','.env','8306896Liceoq','logLevel','createAsync','.json','644BWbtHc','Global\x20Credentials','join','globalCredentials','86214ddSWZB','toString'];a39_0x5c04=function(){return _0x13453f;};return a39_0x5c04();}import{LogLevel}from'../utils/tdx-logger.js';import*as a39_0x14af5d from'node:fs';import*as a39_0x45cf38 from'node:path';export class GlobalContext{[a39_0x146272(0x21f)];[a39_0x146272(0x1e3)];[a39_0x146272(0x1e9)];[a39_0x146272(0x1e2)];['llm_project'];[a39_0x146272(0x1e4)];[a39_0x146272(0x21e)];[a39_0x146272(0x1f1)];[a39_0x146272(0x1de)];['activeProfile'];[a39_0x146272(0x1df)];[a39_0x146272(0x1ea)];constructor(_0x461908){const _0x2f298c=a39_0x146272;this[_0x2f298c(0x1df)]=_0x461908[_0x2f298c(0x218)]||getCurrentSessionPID()[_0x2f298c(0x1f9)]();const _0x42d688=loadSessionContext(_0x461908['session']),_0x5eb6f6=loadProjectConfig(),_0x91aa60=this[_0x2f298c(0x213)]();this['activeProfile']=_0x461908[_0x2f298c(0x210)]||_0x42d688?.[_0x2f298c(0x210)]||_0x91aa60[_0x2f298c(0x210)]||getActiveProfile();const _0x585d3a=this[_0x2f298c(0x21d)]?loadProfile(this[_0x2f298c(0x21d)]):null,_0x1a21f7=_0x5cc563=>{if(!_0x5cc563)return{};const _0xc5f687=_0x5cc563,_0x528c00={};for(const [_0x22906e,_0x4f7aa3]of Object['entries'](_0xc5f687)){typeof _0x4f7aa3==='string'&&(_0x528c00[_0x22906e]=_0x4f7aa3);}return _0x528c00;},_0x42c548={};if(_0x461908[_0x2f298c(0x21f)]&&_0x461908[_0x2f298c(0x21f)]!==_0x2f298c(0x216))_0x42c548[_0x2f298c(0x21f)]=_0x461908[_0x2f298c(0x21f)];const _0x56befc=_0x42d688?.[_0x2f298c(0x1e3)],_0x867091=_0x5eb6f6?.[_0x2f298c(0x1e3)],_0x330f65=_0x585d3a?.['config']?.['database'],_0x40b4fd=_0x91aa60[_0x2f298c(0x1e3)];_0x461908['database']&&(_0x461908['database']!==_0x56befc&&_0x461908['database']!==_0x867091&&_0x461908[_0x2f298c(0x1e3)]!==_0x330f65&&_0x461908[_0x2f298c(0x1e3)]!==_0x40b4fd)&&(_0x42c548[_0x2f298c(0x1e3)]=_0x461908['database']);if(_0x461908[_0x2f298c(0x1e8)])_0x42c548['parent_segment']=_0x461908['parentSegment'];if(_0x461908[_0x2f298c(0x201)])_0x42c548[_0x2f298c(0x208)]=_0x461908[_0x2f298c(0x201)];if(_0x461908[_0x2f298c(0x210)])_0x42c548[_0x2f298c(0x210)]=_0x461908['profile'];this[_0x2f298c(0x1de)]={'cliFlags':_0x42c548,'session':_0x1a21f7(_0x42d688),'project':_0x1a21f7(_0x5eb6f6),'profile':_0x1a21f7(_0x585d3a?.[_0x2f298c(0x1fa)]),'global':_0x1a21f7(_0x91aa60)};const _0x85a48f={...this[_0x2f298c(0x1de)][_0x2f298c(0x20a)],...this['layers'][_0x2f298c(0x210)],...this[_0x2f298c(0x1de)][_0x2f298c(0x1ed)],...this[_0x2f298c(0x1de)]['session'],...this[_0x2f298c(0x1de)][_0x2f298c(0x20b)]},_0xe3161=_0x85a48f['site']||_0x2f298c(0x216);this[_0x2f298c(0x21f)]=resolveSite(_0xe3161),this['database']=_0x85a48f[_0x2f298c(0x1e3)],this[_0x2f298c(0x1e9)]=_0x85a48f[_0x2f298c(0x1e9)],this[_0x2f298c(0x1e2)]=_0x85a48f[_0x2f298c(0x1e2)],this[_0x2f298c(0x208)]=_0x85a48f['llm_project'],this[_0x2f298c(0x21e)]=_0x461908['verbose']||![],this[_0x2f298c(0x1f1)]=_0x461908['logLevel']??LogLevel['INFO'],this['apiKey']=getAPIKey(this[_0x2f298c(0x21f)],this[_0x2f298c(0x21d)]||undefined);const _0x14520a=getConfigDir(),_0x222c92=a39_0x45cf38[_0x2f298c(0x1f6)](_0x14520a,_0x2f298c(0x20d),this[_0x2f298c(0x1df)]+_0x2f298c(0x1f3)),_0x8804cb=findProjectConfigPath(),_0x2cfa67=a39_0x45cf38[_0x2f298c(0x1f6)](_0x14520a,'tdx.json'),_0x56bda8=a39_0x45cf38[_0x2f298c(0x1f6)](_0x14520a,_0x2f298c(0x1ef));let _0x183410=null,_0x2b1b76=null;this[_0x2f298c(0x21d)]&&(_0x183410=a39_0x45cf38[_0x2f298c(0x1f6)](_0x14520a,_0x2f298c(0x211),this['activeProfile'],_0x2f298c(0x21b)),_0x2b1b76=a39_0x45cf38['join'](_0x14520a,_0x2f298c(0x211),this[_0x2f298c(0x21d)],_0x2f298c(0x1ef))),this['configFiles']={'session':a39_0x14af5d[_0x2f298c(0x1fe)](_0x222c92)?_0x222c92:null,'project':_0x8804cb,'profile':_0x183410&&a39_0x14af5d['existsSync'](_0x183410)?_0x183410:null,'profileCredentials':_0x2b1b76&&a39_0x14af5d[_0x2f298c(0x1fe)](_0x2b1b76)?_0x2b1b76:null,'global':a39_0x14af5d['existsSync'](_0x2cfa67)?_0x2cfa67:null,'globalCredentials':a39_0x14af5d[_0x2f298c(0x1fe)](_0x56bda8)?_0x56bda8:null};}[a39_0x146272(0x209)](_0x4e8703,_0x468f45){const _0x289844=a39_0x146272;if(!_0x468f45)return _0x289844(0x1ee);const _0x56f8ee=_0x468f45;if(this[_0x289844(0x1de)]['cliFlags'][_0x4e8703]===_0x56f8ee){if(_0x4e8703===_0x289844(0x21f)&&_0x56f8ee===_0x289844(0x216)&&!this[_0x289844(0x1de)][_0x289844(0x218)][_0x289844(0x21f)]&&!this['layers'][_0x289844(0x1ed)][_0x289844(0x21f)]&&!this['layers'][_0x289844(0x210)][_0x289844(0x21f)]&&!this[_0x289844(0x1de)][_0x289844(0x20a)]['site'])return _0x289844(0x1ec);return _0x289844(0x20c)+_0x4e8703['replace'](/_/g,'-');}if(this[_0x289844(0x1de)][_0x289844(0x218)][_0x4e8703]===_0x56f8ee)return _0x289844(0x218);if(this['layers'][_0x289844(0x1ed)][_0x4e8703]===_0x56f8ee)return'project';if(this[_0x289844(0x1de)][_0x289844(0x210)][_0x4e8703]===_0x56f8ee)return'profile:\x20'+this[_0x289844(0x21d)];if(this[_0x289844(0x1de)][_0x289844(0x20a)][_0x4e8703]===_0x56f8ee)return _0x289844(0x20a);return _0x289844(0x1ec);}[a39_0x146272(0x213)](){const _0xd6dea5=a39_0x146272,_0x3a645c=a39_0x45cf38[_0xd6dea5(0x1f6)](getConfigDir(),_0xd6dea5(0x21b));if(!a39_0x14af5d[_0xd6dea5(0x1fe)](_0x3a645c))return{};try{const _0x4c51c9=a39_0x14af5d[_0xd6dea5(0x1fb)](_0x3a645c,_0xd6dea5(0x1eb));return JSON[_0xd6dea5(0x1e1)](_0x4c51c9);}catch{return{};}}['injectIntoOptions'](_0x4d6271){const _0x5bf5f7=a39_0x146272;_0x4d6271[_0x5bf5f7(0x21f)]=this[_0x5bf5f7(0x21f)],!_0x4d6271['database']&&this[_0x5bf5f7(0x1e3)]&&(_0x4d6271['database']=this[_0x5bf5f7(0x1e3)]),!_0x4d6271[_0x5bf5f7(0x1e8)]&&this[_0x5bf5f7(0x1e9)]&&(_0x4d6271[_0x5bf5f7(0x1e8)]=this[_0x5bf5f7(0x1e9)]),!_0x4d6271[_0x5bf5f7(0x214)]&&this[_0x5bf5f7(0x1e2)]&&(_0x4d6271[_0x5bf5f7(0x214)]=this['segment_path']),!_0x4d6271['llmProject']&&this[_0x5bf5f7(0x208)]&&(_0x4d6271[_0x5bf5f7(0x201)]=this[_0x5bf5f7(0x208)]);}['getParameters'](){const _0x2b2c45=a39_0x146272;return[{'key':_0x2b2c45(0x21f),'value':this['site']},{'key':_0x2b2c45(0x1e3),'value':this[_0x2b2c45(0x1e3)]},{'key':_0x2b2c45(0x1e9),'value':this[_0x2b2c45(0x1e9)]},{'key':_0x2b2c45(0x1e2),'value':this[_0x2b2c45(0x1e2)]},{'key':'llm_project','value':this[_0x2b2c45(0x208)]},{'key':_0x2b2c45(0x210),'value':this[_0x2b2c45(0x21d)]||undefined}];}[a39_0x146272(0x1fc)](){const _0x914f87=a39_0x146272;console[_0x914f87(0x21c)]('[context]');for(const {key:_0x2233ae,value:_0xc8704e}of this[_0x914f87(0x204)]()){_0xc8704e&&console[_0x914f87(0x21c)](_0x2233ae+':\x20'+_0xc8704e);}}[a39_0x146272(0x205)](){const _0x1ab8b5=a39_0x146272;console['log'](_0x1ab8b5(0x20e));for(const {key:_0x3a99fc,value:_0x21b55c}of this[_0x1ab8b5(0x204)]()){if(_0x21b55c){const _0x581ed=_0x3a99fc===_0x1ab8b5(0x210)?'(active)':'('+this['getSource'](_0x3a99fc,_0x21b55c)+')';console[_0x1ab8b5(0x21c)](_0x3a99fc+':\x20'+_0x21b55c+'\x20'+_0x581ed);}}console[_0x1ab8b5(0x21c)]('\x0a[configuration\x20files]');const _0x293fd7=[{'label':_0x1ab8b5(0x1e5),'path':this['configFiles'][_0x1ab8b5(0x218)],'extra':_0x1ab8b5(0x207)+this[_0x1ab8b5(0x1df)]+')'},{'label':'Project','path':this[_0x1ab8b5(0x1ea)][_0x1ab8b5(0x1ed)]},{'label':_0x1ab8b5(0x1ff),'path':this[_0x1ab8b5(0x1ea)][_0x1ab8b5(0x210)]},{'label':_0x1ab8b5(0x203),'path':this['configFiles'][_0x1ab8b5(0x215)]},{'label':_0x1ab8b5(0x1e0),'path':this[_0x1ab8b5(0x1ea)][_0x1ab8b5(0x20a)]},{'label':_0x1ab8b5(0x1f5),'path':this[_0x1ab8b5(0x1ea)][_0x1ab8b5(0x1f7)]}];for(const {label:_0x5c3d29,path:_0x3c661c,extra:_0x4491cd}of _0x293fd7){if(_0x3c661c)console[_0x1ab8b5(0x21c)](_0x5c3d29+':\x20'+_0x3c661c+'\x20✓'+(_0x4491cd?'\x20'+_0x4491cd:''));else{if(_0x5c3d29===_0x1ab8b5(0x1e5))console[_0x1ab8b5(0x21c)](_0x5c3d29+_0x1ab8b5(0x20f)+this[_0x1ab8b5(0x1df)]+')');else(_0x5c3d29===_0x1ab8b5(0x219)||_0x5c3d29===_0x1ab8b5(0x1e0))&&console[_0x1ab8b5(0x21c)](_0x5c3d29+_0x1ab8b5(0x1e7));}}}async[a39_0x146272(0x1e6)](){const _0x10690f=a39_0x146272;return this[_0x10690f(0x1e4)]=await getAPIKeyAsync(this[_0x10690f(0x21f)],this['activeProfile']||undefined),this['apiKey'];}static async[a39_0x146272(0x1f2)](_0x1a9d60){const _0x1f511e=new GlobalContext(_0x1a9d60);return await _0x1f511e['resolveAPIKeyAsync'](),_0x1f511e;}}
|
package/dist/core/keychain.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x36dcc8,_0xf61cd6){const _0x51fc8b=a40_0x4136,_0x20a2e0=_0x36dcc8();while(!![]){try{const _0x4883e5=parseInt(_0x51fc8b(0x1eb))/0x1+parseInt(_0x51fc8b(0x1f5))/0x2+-parseInt(_0x51fc8b(0x1f1))/0x3*(-parseInt(_0x51fc8b(0x1ea))/0x4)+-parseInt(_0x51fc8b(0x1f3))/0x5*(parseInt(_0x51fc8b(0x1e2))/0x6)+parseInt(_0x51fc8b(0x1fc))/0x7+parseInt(_0x51fc8b(0x1f9))/0x8*(-parseInt(_0x51fc8b(0x1da))/0x9)+-parseInt(_0x51fc8b(0x1ef))/0xa;if(_0x4883e5===_0xf61cd6)break;else _0x20a2e0['push'](_0x20a2e0['shift']());}catch(_0x350e9b){_0x20a2e0['push'](_0x20a2e0['shift']());}}}(a40_0x3a73,0x21cd9));const SERVICE_NAME='tdx';let keyringModule=null,keyringLoadError=null;async function getKeyring(){const _0x16439e=a40_0x4136;if(keyringModule!==null)return keyringModule;if(keyringLoadError!==null)return null;try{const _0x1bcf41=await import(_0x16439e(0x1ee));return keyringModule=_0x1bcf41['keyring'],keyringModule;}catch(_0x228d8a){return keyringLoadError=_0x228d8a instanceof Error?_0x228d8a:new Error(String(_0x228d8a)),null;}}function a40_0x4136(_0x329a78,_0x5d343d){const _0x3a73ac=a40_0x3a73();return a40_0x4136=function(_0x41363b,_0xa36cec){_0x41363b=_0x41363b-0x1da;let _0x168a69=_0x3a73ac[_0x41363b];return _0x168a69;},a40_0x4136(_0x329a78,_0x5d343d);}function getAccountName(_0x4c7850){const _0x44c1ae=a40_0x4136,_0x2c1cc3=_0x4c7850||'';return'profile:'+_0x2c1cc3+_0x44c1ae(0x1db);}export async function getKeychainAPIKey(_0xa637a4){const _0x587d4b=a40_0x4136,_0x150512=await getKeychainAPIKeyWithStatus(_0xa637a4);if(_0x150512[_0x587d4b(0x1f8)])return _0x150512['value'];return _0x150512[_0x587d4b(0x1f7)]===_0x587d4b(0x1e0)&&console[_0x587d4b(0x1e4)](_0x587d4b(0x1e5)+_0x150512['message']),null;}export async function getKeychainAPIKeyWithStatus(_0x15a8e9){const _0xcf5958=a40_0x4136;try{const _0x47a48a=await getKeyring();if(!_0x47a48a)return{'success':![],'reason':_0xcf5958(0x1e8)};const _0x4228af=getAccountName(_0x15a8e9),_0x458191=await _0x47a48a[_0xcf5958(0x1fa)](SERVICE_NAME,_0x4228af);if(_0x458191)return{'success':!![],'value':_0x458191};return{'success':![],'reason':_0xcf5958(0x1dd)};}catch(_0x2400ca){const _0x43e203=_0x2400ca instanceof Error?_0x2400ca[_0xcf5958(0x1ec)]:String(_0x2400ca);if(_0x43e203['includes'](_0xcf5958(0x1df))||_0x43e203[_0xcf5958(0x1f2)]()[_0xcf5958(0x1fd)](_0xcf5958(0x1f6))||_0x43e203[_0xcf5958(0x1f2)]()[_0xcf5958(0x1fd)](_0xcf5958(0x1e1)))return{'success':![],'reason':_0xcf5958(0x1dd)};if(_0x43e203[_0xcf5958(0x1fd)](_0xcf5958(0x1f0))||_0x43e203['toLowerCase']()[_0xcf5958(0x1fd)](_0xcf5958(0x1fb))||_0x43e203['toLowerCase']()[_0xcf5958(0x1fd)](_0xcf5958(0x1e7)))return{'success':![],'reason':_0xcf5958(0x1e0),'message':_0xcf5958(0x1f4)};return{'success':![],'reason':_0xcf5958(0x1e8),'message':_0x43e203};}}function a40_0x3a73(){const _0x2377ae=['deletePassword','348CmJLXU','3990pNmPij','message','cannot\x20find','@zowe/secrets-for-zowe-sdk','2057740QPsPPp','-25293','9249TxpNOY','toLowerCase','27605EhUHZt','Keychain\x20access\x20denied.\x20The\x20API\x20key\x20exists\x20but\x20cannot\x20be\x20accessed.\x20Try\x20running\x20\x22tdx\x20auth\x20setup\x22\x20to\x20re-authenticate,\x20or\x20check\x20your\x20keychain\x20permissions\x20for\x20\x22tdx\x22.','145150ADcswI','could\x20not\x20be\x20found','reason','success','899040CefddA','getPassword','restricted','1748950zRDIyj','includes','9DkLYjM',':api_key','System\x20keychain\x20is\x20not\x20available','not_found','setPassword','-25300','access_denied','not\x20found','150ENQKBC','__keychain_test__','error','Warning:\x20','not\x20supported','access','unavailable'];a40_0x3a73=function(){return _0x2377ae;};return a40_0x3a73();}export async function saveKeychainAPIKey(_0xdee6ea,_0x16016e){const _0xddda5b=a40_0x4136,_0x34aaab=await getKeyring();if(!_0x34aaab)throw new Error(_0xddda5b(0x1dc));const _0x3af86b=getAccountName(_0x16016e);await _0x34aaab[_0xddda5b(0x1de)](SERVICE_NAME,_0x3af86b,_0xdee6ea);}export async function deleteKeychainAPIKey(_0x5d861c){const _0x397ccb=a40_0x4136;try{const _0x4c103a=await getKeyring();if(!_0x4c103a)return![];const _0x44660d=getAccountName(_0x5d861c);return await _0x4c103a[_0x397ccb(0x1e9)](SERVICE_NAME,_0x44660d);}catch{return![];}}export async function isKeychainAvailable(){const _0x182ce8=a40_0x4136;try{const _0x2b7451=await getKeyring();if(!_0x2b7451)return![];return await _0x2b7451[_0x182ce8(0x1fa)](SERVICE_NAME,_0x182ce8(0x1e3)),!![];}catch(_0x2a338f){const _0x4b8186=_0x2a338f instanceof Error?_0x2a338f['message'][_0x182ce8(0x1f2)]():'';if(_0x4b8186[_0x182ce8(0x1fd)]('not\x20available')||_0x4b8186[_0x182ce8(0x1fd)](_0x182ce8(0x1e6))||_0x4b8186[_0x182ce8(0x1fd)](_0x182ce8(0x1ed)))return![];return!![];}}
|
package/dist/core/profile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x27f1f4,_0x6bbae2){const _0x555777=a39_0x5a2d,_0xde61a7=_0x27f1f4();while(!![]){try{const _0x1537a9=-parseInt(_0x555777(0x92))/0x1*(-parseInt(_0x555777(0x95))/0x2)+parseInt(_0x555777(0xa2))/0x3+-parseInt(_0x555777(0x99))/0x4*(parseInt(_0x555777(0x8e))/0x5)+-parseInt(_0x555777(0xae))/0x6+parseInt(_0x555777(0xbb))/0x7*(-parseInt(_0x555777(0x97))/0x8)+parseInt(_0x555777(0x83))/0x9*(-parseInt(_0x555777(0xa1))/0xa)+parseInt(_0x555777(0x7f))/0xb;if(_0x1537a9===_0x6bbae2)break;else _0xde61a7['push'](_0xde61a7['shift']());}catch(_0x500930){_0xde61a7['push'](_0xde61a7['shift']());}}}(a39_0x3ddf,0x84bc2));import*as a39_0x2bef55 from'node:fs';import*as a39_0x39f377 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(_0x42f183){const _0x2e42a1=a39_0x5a2d,_0x1cb60f={};if(!_0x42f183)return _0x1cb60f;for(const [_0x4fc3f9,_0x3ad8ce]of Object[_0x2e42a1(0xc7)](_0x42f183)){_0x4fc3f9!==_0x2e42a1(0x9a)&&_0x3ad8ce!==undefined&&(_0x1cb60f[_0x4fc3f9]=_0x3ad8ce);}return _0x1cb60f;}function a39_0x3ddf(){const _0x3986c8=['Invalid\x20profile\x20name:\x20','llm_project','\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20','670325uSBQXY','Warning:\x20Failed\x20to\x20parse\x20','readFileSync','2mmuZXv','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','192tTzwye','warn','4KkwtoQ','description','find','object','isDirectory','\x20does\x20not\x20exist','\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','20040IMghlD','733128aBWYOD','map','length','existsSync','.env.','\x27:\x20config\x20must\x20be\x20an\x20object','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','from','local','message','Profile\x20\x27','\x0aWarning:\x20Failed\x20to\x20parse\x20','3227358bPsYBe','name','\x27\x20will\x20be\x20ignored','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','filter','Warning:\x20Profile\x20\x27','Profile\x20','Error:\x20','join','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','parent_segment','site','24773DMsEWe','database','readdirSync','toISOString','includes','\x20already\x20exists','some','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','string','.env','has','user','entries','13637987EDDEHn','profiles','directory','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','3186BWFcZW','tdx.json','push',':\x20Invalid\x20JSON\x20syntax','llm_agent','stringify','\x20\x20mv\x20\x22','values','utf-8','profile','parse','1392955jLGmCR'];a39_0x3ddf=function(){return _0x3986c8;};return a39_0x3ddf();}export function getProfilesDir(){const _0x5acca8=a39_0x5a2d;return a39_0x39f377[_0x5acca8(0xb7)](getConfigDir(),'profiles');}function getProfileDir(_0x395df8){const _0x3d6a74=a39_0x5a2d;return a39_0x39f377[_0x3d6a74(0xb7)](getProfilesDir(),_0x395df8);}function getProfileConfigPath(_0x5ce1b3){const _0x2a3e2c=a39_0x5a2d;return a39_0x39f377[_0x2a3e2c(0xb7)](getProfileDir(_0x5ce1b3),_0x2a3e2c(0x84));}function getProfileEnvPath(_0x3b69f8){const _0x52a37c=a39_0x5a2d;return a39_0x39f377[_0x52a37c(0xb7)](getProfileDir(_0x3b69f8),_0x52a37c(0xc4));}function getGlobalConfigPath(){const _0x590ec9=a39_0x5a2d;return a39_0x39f377[_0x590ec9(0xb7)](getConfigDir(),_0x590ec9(0x84));}function validateProfileName(_0x4f8d89){const _0x3299e0=a39_0x5a2d;if(!/^[a-zA-Z0-9_-]+$/['test'](_0x4f8d89))throw new Error(_0x3299e0(0x8f)+_0x4f8d89+'.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.');}function validateProfileConfig(_0x26c083,_0x305a80){const _0x19aaa9=a39_0x5a2d;if(typeof _0x26c083!=='object'||_0x26c083===null)throw new Error(_0x19aaa9(0xac)+_0x305a80+_0x19aaa9(0xa7));const _0x5eda63=[_0x19aaa9(0x9a),_0x19aaa9(0xba),_0x19aaa9(0xbc),_0x19aaa9(0xb9),_0x19aaa9(0x90),'llm_agent'],_0x4146eb=_0x26c083;for(const _0x50cf55 of Object['keys'](_0x4146eb)){!_0x5eda63[_0x19aaa9(0xbf)](_0x50cf55)&&console[_0x19aaa9(0x98)](_0x19aaa9(0xb4)+_0x305a80+'\x27:\x20unknown\x20config\x20key\x20\x27'+_0x50cf55+_0x19aaa9(0xb0));}if(_0x4146eb[_0x19aaa9(0x9a)]!==undefined&&typeof _0x4146eb[_0x19aaa9(0x9a)]!==_0x19aaa9(0xc3))throw new Error(_0x19aaa9(0xac)+_0x305a80+'\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string');if(_0x4146eb['site']!==undefined&&typeof _0x4146eb[_0x19aaa9(0xba)]!==_0x19aaa9(0xc3))throw new Error(_0x19aaa9(0xac)+_0x305a80+_0x19aaa9(0xc2));if(_0x4146eb[_0x19aaa9(0xbc)]!==undefined&&typeof _0x4146eb[_0x19aaa9(0xbc)]!==_0x19aaa9(0xc3))throw new Error('Profile\x20\x27'+_0x305a80+'\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string');if(_0x4146eb[_0x19aaa9(0xb9)]!==undefined&&typeof _0x4146eb[_0x19aaa9(0xb9)]!=='string')throw new Error(_0x19aaa9(0xac)+_0x305a80+_0x19aaa9(0x82));if(_0x4146eb['llm_project']!==undefined&&typeof _0x4146eb[_0x19aaa9(0x90)]!==_0x19aaa9(0xc3))throw new Error(_0x19aaa9(0xac)+_0x305a80+_0x19aaa9(0xb1));if(_0x4146eb['llm_agent']!==undefined&&typeof _0x4146eb[_0x19aaa9(0x87)]!==_0x19aaa9(0xc3))throw new Error(_0x19aaa9(0xac)+_0x305a80+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x151927,_0x25dcfc){const _0x33a114=a39_0x5a2d;if(!a39_0x2bef55[_0x33a114(0xa5)](_0x151927))return[];try{const _0x473031=a39_0x2bef55['readFileSync'](_0x151927,_0x33a114(0x8b)),_0x5e0060=JSON['parse'](_0x473031);if(!_0x5e0060[_0x33a114(0x80)]||typeof _0x5e0060[_0x33a114(0x80)]!==_0x33a114(0x9c))return[];const _0x429979=[];for(const [_0x3f2f16,_0x1ac972]of Object['entries'](_0x5e0060[_0x33a114(0x80)])){try{validateProfileConfig(_0x1ac972,_0x3f2f16);const _0x10c69b=getNewCredentialPath(_0x3f2f16),_0x475c10=getOldCredentialPath(_0x3f2f16),_0x8ea02f=a39_0x2bef55['existsSync'](_0x10c69b)||a39_0x2bef55['existsSync'](_0x475c10);_0x429979[_0x33a114(0x85)]({'name':_0x3f2f16,'config':_0x1ac972,'metadata':{'name':_0x3f2f16,'createdAt':new Date()[_0x33a114(0xbe)]()},'hasCredentials':_0x8ea02f,'scope':_0x25dcfc});}catch(_0x59ab06){_0x59ab06 instanceof Error&&(console[_0x33a114(0x98)]('\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20'+_0x151927+':'),console[_0x33a114(0x98)]('\x20\x20'+_0x59ab06[_0x33a114(0xab)]+'\x0a'));}}return _0x429979;}catch(_0x54a817){return _0x54a817 instanceof SyntaxError?(console[_0x33a114(0x98)](_0x33a114(0xad)+_0x151927+_0x33a114(0x86)),console[_0x33a114(0x98)](_0x33a114(0xb6)+_0x54a817[_0x33a114(0xab)]+'\x0a')):console[_0x33a114(0x98)](_0x33a114(0x91)+_0x151927+':\x20'+_0x54a817+'\x0a'),[];}}export function getNewCredentialPath(_0x56ece5){const _0x30c980=a39_0x5a2d;return a39_0x39f377['join'](getConfigDir(),_0x30c980(0xa6)+_0x56ece5);}function getOldCredentialPath(_0x5171fb){const _0xb2c810=a39_0x5a2d;return a39_0x39f377[_0xb2c810(0xb7)](getProfilesDir(),_0x5171fb,_0xb2c810(0xc4));}function loadProfilesFromTdxJsonFiles(){const _0x569dd8=a39_0x5a2d,_0x49dadc=[],_0x8167f5=findProjectConfigPath();_0x8167f5&&_0x49dadc[_0x569dd8(0x85)](...loadProfilesFromTdxJson(_0x8167f5,_0x569dd8(0xaa)));const _0x494651=a39_0x39f377['join'](getConfigDir(),_0x569dd8(0x84));return _0x49dadc[_0x569dd8(0x85)](...loadProfilesFromTdxJson(_0x494651,_0x569dd8(0xc6))),_0x49dadc;}function loadProfilesFromDirectories(){const _0x56814a=a39_0x5a2d,_0x44d6e8=getProfilesDir();if(!a39_0x2bef55[_0x56814a(0xa5)](_0x44d6e8))return[];try{return a39_0x2bef55[_0x56814a(0xbd)](_0x44d6e8,{'withFileTypes':!![]})[_0x56814a(0xb3)](_0x4c9025=>_0x4c9025[_0x56814a(0x9d)]())[_0x56814a(0xa3)](_0x27ea39=>_0x27ea39[_0x56814a(0xaf)])[_0x56814a(0xb3)](_0x416bdd=>{const _0x41a34f=_0x56814a,_0x209396=getProfileConfigPath(_0x416bdd),_0x3197e5=getProfileEnvPath(_0x416bdd);return a39_0x2bef55[_0x41a34f(0xa5)](_0x209396)||a39_0x2bef55[_0x41a34f(0xa5)](_0x3197e5);})['map'](_0x1873d4=>{const _0x26fd23=loadProfileFromDirectory(_0x1873d4);if(_0x26fd23)return{..._0x26fd23,'scope':'directory'};return null;})['filter'](_0x27589e=>_0x27589e!==null);}catch{return[];}}function loadProfileFromDirectory(_0x355adb){const _0x436d43=a39_0x5a2d,_0x20dac8=getProfileConfigPath(_0x355adb),_0x112063=getOldCredentialPath(_0x355adb);if(!a39_0x2bef55[_0x436d43(0xa5)](_0x20dac8)&&!a39_0x2bef55[_0x436d43(0xa5)](_0x112063))return null;let _0x524253={},_0x2016ed={'name':_0x355adb,'createdAt':new Date()[_0x436d43(0xbe)]()};if(a39_0x2bef55[_0x436d43(0xa5)](_0x20dac8))try{const _0x43eabf=a39_0x2bef55[_0x436d43(0x94)](_0x20dac8,_0x436d43(0x8b)),_0x206af1=JSON[_0x436d43(0x8d)](_0x43eabf),{metadata:_0x4cb2d9,..._0x2b5c0d}=_0x206af1;_0x524253=_0x2b5c0d,_0x4cb2d9&&(_0x2016ed=_0x4cb2d9);}catch{}return{'name':_0x355adb,'config':_0x524253,'metadata':_0x2016ed,'hasCredentials':a39_0x2bef55[_0x436d43(0xa5)](_0x112063),'scope':_0x436d43(0x81)};}function a39_0x5a2d(_0x58f5b9,_0x56ab3c){const _0x3ddf0f=a39_0x3ddf();return a39_0x5a2d=function(_0x5a2dbe,_0x53917b){_0x5a2dbe=_0x5a2dbe-0x7f;let _0x13eac4=_0x3ddf0f[_0x5a2dbe];return _0x13eac4;},a39_0x5a2d(_0x58f5b9,_0x56ab3c);}export function listProfiles(){const _0x405b2d=a39_0x5a2d,_0x55e44d=loadProfilesFromTdxJsonFiles(),_0x5b6cb8=loadProfilesFromDirectories();if(_0x5b6cb8[_0x405b2d(0xa4)]>0x0){const _0x28f7aa=_0x5b6cb8[_0x405b2d(0xa3)](_0x3e1a93=>_0x3e1a93[_0x405b2d(0xaf)])[_0x405b2d(0xb7)](',\x20'),_0x346edf=getConfigDir();console[_0x405b2d(0x98)](_0x405b2d(0x9f)+_0x28f7aa),console['warn'](_0x405b2d(0x96)),console[_0x405b2d(0x98)]('\x20\x201.\x20Edit:\x20'+a39_0x39f377[_0x405b2d(0xb7)](_0x346edf,_0x405b2d(0x84))),console[_0x405b2d(0x98)](_0x405b2d(0xb2)),console['warn'](_0x405b2d(0xa8));}const _0x28c7c7=[..._0x55e44d,..._0x5b6cb8],_0x126155=new Map();for(const _0x191946 of _0x28c7c7){!_0x126155[_0x405b2d(0xc5)](_0x191946[_0x405b2d(0xaf)])&&_0x126155['set'](_0x191946[_0x405b2d(0xaf)],_0x191946);}return Array[_0x405b2d(0xa9)](_0x126155[_0x405b2d(0x8a)]())['sort']((_0x44a052,_0x2dba4d)=>_0x44a052[_0x405b2d(0xaf)]['localeCompare'](_0x2dba4d['name']));}export function profileExists(_0x4421cf){const _0x4fef2a=a39_0x5a2d,_0x48c4de=listProfiles();return _0x48c4de[_0x4fef2a(0xc1)](_0x347430=>_0x347430['name']===_0x4421cf);}export function loadProfile(_0x57b388){const _0x2b209b=a39_0x5a2d;validateProfileName(_0x57b388);const _0x1405c3=listProfiles(),_0x1e24ea=_0x1405c3[_0x2b209b(0x9b)](_0x246601=>_0x246601[_0x2b209b(0xaf)]===_0x57b388);return _0x1e24ea||null;}export function saveProfile(_0x5dd218,_0x1352af,_0x509a4b=![]){saveProfileToUserConfig(_0x5dd218,_0x1352af);}export function deleteProfile(_0xf1492f){const _0x4c6690=a39_0x5a2d;validateProfileName(_0xf1492f);const _0x5ef44f=getProfileDir(_0xf1492f);if(!a39_0x2bef55[_0x4c6690(0xa5)](_0x5ef44f))throw new Error(_0x4c6690(0xb5)+_0xf1492f+_0x4c6690(0x9e));a39_0x2bef55['rmSync'](_0x5ef44f,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x3b4504,_0x8f33ac){const _0x1fee2b=a39_0x5a2d;validateProfileName(_0x3b4504);const _0x4bc6a0=getGlobalConfigPath(),_0x363b12=getConfigDir();!a39_0x2bef55[_0x1fee2b(0xa5)](_0x363b12)&&createSecureDirectory(_0x363b12);let _0x1a9cd3={};if(a39_0x2bef55[_0x1fee2b(0xa5)](_0x4bc6a0))try{const _0x14892e=a39_0x2bef55[_0x1fee2b(0x94)](_0x4bc6a0,'utf-8');_0x1a9cd3=JSON[_0x1fee2b(0x8d)](_0x14892e);}catch{console['warn'](_0x1fee2b(0x93)+_0x4bc6a0+',\x20creating\x20new\x20file');}!_0x1a9cd3['profiles']&&(_0x1a9cd3[_0x1fee2b(0x80)]={}),_0x1a9cd3['profiles'][_0x3b4504]=_0x8f33ac,writeSecureFile(_0x4bc6a0,JSON[_0x1fee2b(0x88)](_0x1a9cd3,null,0x2));}export function getActiveProfile(){const _0x3676a0=a39_0x5a2d,_0x5ab9dd=getGlobalConfigPath();if(!a39_0x2bef55['existsSync'](_0x5ab9dd))return null;try{const _0x2a8fa7=a39_0x2bef55[_0x3676a0(0x94)](_0x5ab9dd,'utf-8'),_0x54033b=JSON[_0x3676a0(0x8d)](_0x2a8fa7);return _0x54033b[_0x3676a0(0x8c)]||null;}catch{return null;}}export function createProfile(_0x3866ed,_0xeae19b){const _0x2b4e5d=a39_0x5a2d;validateProfileName(_0x3866ed);if(profileExists(_0x3866ed))throw new Error('Profile\x20'+_0x3866ed+_0x2b4e5d(0xc0));saveProfile(_0x3866ed,_0xeae19b);}export function saveProfileCredentials(_0x3994d6,_0x19a0f1){const _0x3f387e=a39_0x5a2d;validateProfileName(_0x3994d6);if(!profileExists(_0x3994d6))throw new Error(_0x3f387e(0xb5)+_0x3994d6+_0x3f387e(0x9e));const _0x43d6ab=getNewCredentialPath(_0x3994d6);writeSecureFile(_0x43d6ab,_0x19a0f1);}export function loadProfileCredentials(_0x128ccb){const _0x8c1cc0=a39_0x5a2d;validateProfileName(_0x128ccb);const _0x38f597=getNewCredentialPath(_0x128ccb);if(a39_0x2bef55['existsSync'](_0x38f597))try{return a39_0x2bef55[_0x8c1cc0(0x94)](_0x38f597,_0x8c1cc0(0x8b));}catch{}const _0x2686d9=getOldCredentialPath(_0x128ccb);if(a39_0x2bef55[_0x8c1cc0(0xa5)](_0x2686d9)){console[_0x8c1cc0(0x98)](_0x8c1cc0(0xa0)+_0x128ccb+'\x27'),console['warn']('To\x20migrate:'),console[_0x8c1cc0(0x98)](_0x8c1cc0(0x89)+_0x2686d9+'\x22\x20\x22'+_0x38f597+'\x22'),console[_0x8c1cc0(0x98)](_0x8c1cc0(0xb8));try{return a39_0x2bef55[_0x8c1cc0(0x94)](_0x2686d9,'utf-8');}catch{return null;}}return null;}
|
|
1
|
+
(function(_0x57fb18,_0x25f1a5){const _0x3f8831=a41_0xedb7,_0x589303=_0x57fb18();while(!![]){try{const _0x281b5b=-parseInt(_0x3f8831(0x178))/0x1+parseInt(_0x3f8831(0x18c))/0x2*(-parseInt(_0x3f8831(0x181))/0x3)+-parseInt(_0x3f8831(0x187))/0x4*(-parseInt(_0x3f8831(0x189))/0x5)+-parseInt(_0x3f8831(0x18f))/0x6+parseInt(_0x3f8831(0x14e))/0x7*(parseInt(_0x3f8831(0x166))/0x8)+parseInt(_0x3f8831(0x16f))/0x9+parseInt(_0x3f8831(0x17d))/0xa;if(_0x281b5b===_0x25f1a5)break;else _0x589303['push'](_0x589303['shift']());}catch(_0x499b6b){_0x589303['push'](_0x589303['shift']());}}}(a41_0x4df9,0x86028));import*as a41_0x337097 from'node:fs';import*as a41_0x20d1e7 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(_0x4a4c40){const _0x643f92=a41_0xedb7,_0x4308d2={};if(!_0x4a4c40)return _0x4308d2;for(const [_0x5631d0,_0x31380f]of Object[_0x643f92(0x151)](_0x4a4c40)){_0x5631d0!==_0x643f92(0x165)&&_0x31380f!==undefined&&(_0x4308d2[_0x5631d0]=_0x31380f);}return _0x4308d2;}export function getProfilesDir(){const _0x3bbf76=a41_0xedb7;return a41_0x20d1e7[_0x3bbf76(0x167)](getConfigDir(),_0x3bbf76(0x18e));}function getProfileDir(_0x780944){return a41_0x20d1e7['join'](getProfilesDir(),_0x780944);}function getProfileConfigPath(_0x3ff1a5){const _0x30e54d=a41_0xedb7;return a41_0x20d1e7[_0x30e54d(0x167)](getProfileDir(_0x3ff1a5),_0x30e54d(0x14d));}function getProfileEnvPath(_0x1f68fa){return a41_0x20d1e7['join'](getProfileDir(_0x1f68fa),'.env');}function a41_0xedb7(_0x20ab63,_0x3da38c){const _0x4df99a=a41_0x4df9();return a41_0xedb7=function(_0xedb7a,_0x2fa30e){_0xedb7a=_0xedb7a-0x14c;let _0x5f42fc=_0x4df99a[_0xedb7a];return _0x5f42fc;},a41_0xedb7(_0x20ab63,_0x3da38c);}function getGlobalConfigPath(){const _0x5fb77c=a41_0xedb7;return a41_0x20d1e7[_0x5fb77c(0x167)](getConfigDir(),'tdx.json');}function validateProfileName(_0x573523){const _0x5a46a9=a41_0xedb7;if(!/^[a-zA-Z0-9_-]+$/[_0x5a46a9(0x15b)](_0x573523))throw new Error(_0x5a46a9(0x153)+_0x573523+_0x5a46a9(0x16a));}function validateProfileConfig(_0x488316,_0x7f91ed){const _0x4e6e6f=a41_0xedb7;if(typeof _0x488316!==_0x4e6e6f(0x188)||_0x488316===null)throw new Error(_0x4e6e6f(0x157)+_0x7f91ed+_0x4e6e6f(0x186));const _0x5c5b5e=['description',_0x4e6e6f(0x150),_0x4e6e6f(0x16b),_0x4e6e6f(0x168),_0x4e6e6f(0x192),'llm_agent'],_0x2572d5=_0x488316;for(const _0x2fb67f of Object[_0x4e6e6f(0x14c)](_0x2572d5)){!_0x5c5b5e[_0x4e6e6f(0x17f)](_0x2fb67f)&&console[_0x4e6e6f(0x17b)](_0x4e6e6f(0x15d)+_0x7f91ed+_0x4e6e6f(0x176)+_0x2fb67f+'\x27\x20will\x20be\x20ignored');}if(_0x2572d5[_0x4e6e6f(0x165)]!==undefined&&typeof _0x2572d5[_0x4e6e6f(0x165)]!==_0x4e6e6f(0x159))throw new Error(_0x4e6e6f(0x157)+_0x7f91ed+_0x4e6e6f(0x16d));if(_0x2572d5[_0x4e6e6f(0x150)]!==undefined&&typeof _0x2572d5['site']!=='string')throw new Error(_0x4e6e6f(0x157)+_0x7f91ed+_0x4e6e6f(0x15f));if(_0x2572d5[_0x4e6e6f(0x16b)]!==undefined&&typeof _0x2572d5[_0x4e6e6f(0x16b)]!==_0x4e6e6f(0x159))throw new Error(_0x4e6e6f(0x157)+_0x7f91ed+_0x4e6e6f(0x170));if(_0x2572d5[_0x4e6e6f(0x168)]!==undefined&&typeof _0x2572d5[_0x4e6e6f(0x168)]!=='string')throw new Error(_0x4e6e6f(0x157)+_0x7f91ed+_0x4e6e6f(0x15c));if(_0x2572d5[_0x4e6e6f(0x192)]!==undefined&&typeof _0x2572d5[_0x4e6e6f(0x192)]!==_0x4e6e6f(0x159))throw new Error('Profile\x20\x27'+_0x7f91ed+_0x4e6e6f(0x158));if(_0x2572d5[_0x4e6e6f(0x18d)]!==undefined&&typeof _0x2572d5['llm_agent']!==_0x4e6e6f(0x159))throw new Error(_0x4e6e6f(0x157)+_0x7f91ed+'\x27:\x20\x27llm_agent\x27\x20must\x20be\x20a\x20string');return!![];}function loadProfilesFromTdxJson(_0x7b63d2,_0x452d3b){const _0x425b22=a41_0xedb7;if(!a41_0x337097['existsSync'](_0x7b63d2))return[];try{const _0x4d3432=a41_0x337097[_0x425b22(0x164)](_0x7b63d2,'utf-8'),_0xb13111=JSON[_0x425b22(0x154)](_0x4d3432);if(!_0xb13111[_0x425b22(0x18e)]||typeof _0xb13111['profiles']!=='object')return[];const _0x44c210=[];for(const [_0x1e1f66,_0x320c50]of Object['entries'](_0xb13111[_0x425b22(0x18e)])){try{validateProfileConfig(_0x320c50,_0x1e1f66);const _0x38964d=getNewCredentialPath(_0x1e1f66),_0x146260=getOldCredentialPath(_0x1e1f66),_0x1b59d0=a41_0x337097[_0x425b22(0x177)](_0x38964d)||a41_0x337097[_0x425b22(0x177)](_0x146260);_0x44c210[_0x425b22(0x156)]({'name':_0x1e1f66,'config':_0x320c50,'metadata':{'name':_0x1e1f66,'createdAt':new Date()[_0x425b22(0x175)]()},'hasCredentials':_0x1b59d0,'scope':_0x452d3b});}catch(_0xebf037){_0xebf037 instanceof Error&&(console[_0x425b22(0x17b)](_0x425b22(0x193)+_0x7b63d2+':'),console[_0x425b22(0x17b)]('\x20\x20'+_0xebf037[_0x425b22(0x17c)]+'\x0a'));}}return _0x44c210;}catch(_0x2f787e){return _0x2f787e instanceof SyntaxError?(console['warn'](_0x425b22(0x18a)+_0x7b63d2+_0x425b22(0x184)),console[_0x425b22(0x17b)]('Error:\x20'+_0x2f787e['message']+'\x0a')):console[_0x425b22(0x17b)]('\x0aWarning:\x20Failed\x20to\x20load\x20profiles\x20from\x20'+_0x7b63d2+':\x20'+_0x2f787e+'\x0a'),[];}}function a41_0x4df9(){const _0x44deb9=['warn','message','16354950LQXaAU','\x20\x203.\x20Move\x20credentials:\x20mv\x20~/.config/tdx/profiles/<name>/.env\x20~/.config/tdx/.env.<name>\x0a','includes','profile','1988586UpesxK','user','from',':\x20Invalid\x20JSON\x20syntax','Please\x20migrate\x20to\x20~/.config/tdx/tdx.json:','\x27:\x20config\x20must\x20be\x20an\x20object','893732hyqoRv','object','5SrdOHO','\x0aWarning:\x20Failed\x20to\x20parse\x20','To\x20migrate:','2VeYYsV','llm_agent','profiles','3109476kbIUQd','directory','Then\x20define\x20profiles\x20in\x20~/.config/tdx/tdx.json\x0a','llm_project','\x0aWarning:\x20Skipping\x20invalid\x20profile\x20in\x20','name','keys','tdx.json','727405xJmIrW','.env.','site','entries','\x20\x202.\x20Add\x20profiles\x20under\x20a\x20\x22profiles\x22\x20key\x20(see\x20\x27tdx\x20profiles\x27\x20for\x20current\x20config)','Invalid\x20profile\x20name:\x20','parse','\x20does\x20not\x20exist','push','Profile\x20\x27','\x27:\x20\x27llm_project\x27\x20must\x20be\x20a\x20string','string','\x20\x20mv\x20\x22','test','\x27:\x20\x27parent_segment\x27\x20must\x20be\x20a\x20string','Warning:\x20Profile\x20\x27','local','\x27:\x20\x27site\x27\x20must\x20be\x20a\x20string','sort','Warning:\x20Failed\x20to\x20parse\x20','has','map','readFileSync','description','24PmKChi','join','parent_segment','\x0aWarning:\x20Using\x20deprecated\x20credential\x20location\x20for\x20profile\x20\x27','.\x20Must\x20contain\x20only\x20alphanumeric\x20characters,\x20dash,\x20and\x20underscore.','database','utf-8','\x27:\x20\x27description\x27\x20must\x20be\x20a\x20string','find','3190662asnqzV','\x27:\x20\x27database\x27\x20must\x20be\x20a\x20string',',\x20creating\x20new\x20file','filter','Profile\x20','localeCompare','toISOString','\x27:\x20unknown\x20config\x20key\x20\x27','existsSync','795179IAumPd','.env','readdirSync'];a41_0x4df9=function(){return _0x44deb9;};return a41_0x4df9();}export function getNewCredentialPath(_0x4073fb){const _0x34dac8=a41_0xedb7;return a41_0x20d1e7['join'](getConfigDir(),_0x34dac8(0x14f)+_0x4073fb);}function getOldCredentialPath(_0x47a031){const _0x4ccad6=a41_0xedb7;return a41_0x20d1e7[_0x4ccad6(0x167)](getProfilesDir(),_0x47a031,_0x4ccad6(0x179));}function loadProfilesFromTdxJsonFiles(){const _0x2f427a=a41_0xedb7,_0xf5632a=[],_0x49c6eb=findProjectConfigPath();_0x49c6eb&&_0xf5632a[_0x2f427a(0x156)](...loadProfilesFromTdxJson(_0x49c6eb,_0x2f427a(0x15e)));const _0x55b073=a41_0x20d1e7[_0x2f427a(0x167)](getConfigDir(),_0x2f427a(0x14d));return _0xf5632a[_0x2f427a(0x156)](...loadProfilesFromTdxJson(_0x55b073,_0x2f427a(0x182))),_0xf5632a;}function loadProfilesFromDirectories(){const _0x55eb23=a41_0xedb7,_0x40c4f3=getProfilesDir();if(!a41_0x337097[_0x55eb23(0x177)](_0x40c4f3))return[];try{return a41_0x337097[_0x55eb23(0x17a)](_0x40c4f3,{'withFileTypes':!![]})['filter'](_0x2fcd86=>_0x2fcd86['isDirectory']())['map'](_0x497cef=>_0x497cef['name'])[_0x55eb23(0x172)](_0x1a0568=>{const _0x63fc05=_0x55eb23,_0x510ee0=getProfileConfigPath(_0x1a0568),_0x1158fc=getProfileEnvPath(_0x1a0568);return a41_0x337097[_0x63fc05(0x177)](_0x510ee0)||a41_0x337097[_0x63fc05(0x177)](_0x1158fc);})[_0x55eb23(0x163)](_0x478a17=>{const _0x1685ef=_0x55eb23,_0x5aa671=loadProfileFromDirectory(_0x478a17);if(_0x5aa671)return{..._0x5aa671,'scope':_0x1685ef(0x190)};return null;})[_0x55eb23(0x172)](_0x3fe645=>_0x3fe645!==null);}catch{return[];}}function loadProfileFromDirectory(_0x267747){const _0x42bbc5=a41_0xedb7,_0x43dbf4=getProfileConfigPath(_0x267747),_0xd64880=getOldCredentialPath(_0x267747);if(!a41_0x337097[_0x42bbc5(0x177)](_0x43dbf4)&&!a41_0x337097['existsSync'](_0xd64880))return null;let _0x458f49={},_0x5975e2={'name':_0x267747,'createdAt':new Date()['toISOString']()};if(a41_0x337097[_0x42bbc5(0x177)](_0x43dbf4))try{const _0x3c63c3=a41_0x337097[_0x42bbc5(0x164)](_0x43dbf4,_0x42bbc5(0x16c)),_0x24c61d=JSON[_0x42bbc5(0x154)](_0x3c63c3),{metadata:_0x183ff6,..._0x429eb6}=_0x24c61d;_0x458f49=_0x429eb6,_0x183ff6&&(_0x5975e2=_0x183ff6);}catch{}return{'name':_0x267747,'config':_0x458f49,'metadata':_0x5975e2,'hasCredentials':a41_0x337097[_0x42bbc5(0x177)](_0xd64880),'scope':_0x42bbc5(0x190)};}export function listProfiles(){const _0x10939c=a41_0xedb7,_0x12fe1e=loadProfilesFromTdxJsonFiles(),_0x51744b=loadProfilesFromDirectories();if(_0x51744b['length']>0x0){const _0xfc7da6=_0x51744b['map'](_0x1da39e=>_0x1da39e[_0x10939c(0x194)])[_0x10939c(0x167)](',\x20'),_0x14ccb0=getConfigDir();console[_0x10939c(0x17b)]('\x0aWarning:\x20Profiles\x20in\x20directories\x20are\x20deprecated:\x20'+_0xfc7da6),console['warn'](_0x10939c(0x185)),console[_0x10939c(0x17b)]('\x20\x201.\x20Edit:\x20'+a41_0x20d1e7[_0x10939c(0x167)](_0x14ccb0,_0x10939c(0x14d))),console[_0x10939c(0x17b)](_0x10939c(0x152)),console[_0x10939c(0x17b)](_0x10939c(0x17e));}const _0x3b9e55=[..._0x12fe1e,..._0x51744b],_0x53220d=new Map();for(const _0x44934b of _0x3b9e55){!_0x53220d[_0x10939c(0x162)](_0x44934b[_0x10939c(0x194)])&&_0x53220d['set'](_0x44934b[_0x10939c(0x194)],_0x44934b);}return Array[_0x10939c(0x183)](_0x53220d['values']())[_0x10939c(0x160)]((_0x2f2e0f,_0x59c67b)=>_0x2f2e0f[_0x10939c(0x194)][_0x10939c(0x174)](_0x59c67b[_0x10939c(0x194)]));}export function profileExists(_0x1317b5){const _0x4fa704=listProfiles();return _0x4fa704['some'](_0x59e6bb=>_0x59e6bb['name']===_0x1317b5);}export function loadProfile(_0x26ece9){const _0x11cdeb=a41_0xedb7;validateProfileName(_0x26ece9);const _0x4c4be2=listProfiles(),_0x3e8602=_0x4c4be2[_0x11cdeb(0x16e)](_0x52d723=>_0x52d723[_0x11cdeb(0x194)]===_0x26ece9);return _0x3e8602||null;}export function saveProfile(_0x2a453c,_0xa5e674,_0x42197f=![]){saveProfileToUserConfig(_0x2a453c,_0xa5e674);}export function deleteProfile(_0x28d91b){const _0x46b8b7=a41_0xedb7;validateProfileName(_0x28d91b);const _0x2b6d87=getProfileDir(_0x28d91b);if(!a41_0x337097[_0x46b8b7(0x177)](_0x2b6d87))throw new Error(_0x46b8b7(0x173)+_0x28d91b+'\x20does\x20not\x20exist');a41_0x337097['rmSync'](_0x2b6d87,{'recursive':!![],'force':!![]});}export function saveProfileToUserConfig(_0x355085,_0x5180cf){const _0x109140=a41_0xedb7;validateProfileName(_0x355085);const _0x330a76=getGlobalConfigPath(),_0x3ee763=getConfigDir();!a41_0x337097[_0x109140(0x177)](_0x3ee763)&&createSecureDirectory(_0x3ee763);let _0x3d633b={};if(a41_0x337097[_0x109140(0x177)](_0x330a76))try{const _0x3657e5=a41_0x337097['readFileSync'](_0x330a76,_0x109140(0x16c));_0x3d633b=JSON[_0x109140(0x154)](_0x3657e5);}catch{console[_0x109140(0x17b)](_0x109140(0x161)+_0x330a76+_0x109140(0x171));}!_0x3d633b[_0x109140(0x18e)]&&(_0x3d633b[_0x109140(0x18e)]={}),_0x3d633b[_0x109140(0x18e)][_0x355085]=_0x5180cf,writeSecureFile(_0x330a76,JSON['stringify'](_0x3d633b,null,0x2));}export function getActiveProfile(){const _0x1391eb=a41_0xedb7,_0x235ec6=getGlobalConfigPath();if(!a41_0x337097['existsSync'](_0x235ec6))return null;try{const _0x3cdc11=a41_0x337097[_0x1391eb(0x164)](_0x235ec6,'utf-8'),_0xc62f47=JSON[_0x1391eb(0x154)](_0x3cdc11);return _0xc62f47[_0x1391eb(0x180)]||null;}catch{return null;}}export function createProfile(_0x18a0a2,_0x339b67){const _0x457968=a41_0xedb7;validateProfileName(_0x18a0a2);if(profileExists(_0x18a0a2))throw new Error(_0x457968(0x173)+_0x18a0a2+'\x20already\x20exists');saveProfile(_0x18a0a2,_0x339b67);}export function saveProfileCredentials(_0x4fe3a6,_0x1e20a2){const _0x1a9161=a41_0xedb7;validateProfileName(_0x4fe3a6);if(!profileExists(_0x4fe3a6))throw new Error('Profile\x20'+_0x4fe3a6+_0x1a9161(0x155));const _0x3eb17e=getNewCredentialPath(_0x4fe3a6);writeSecureFile(_0x3eb17e,_0x1e20a2);}export function loadProfileCredentials(_0x312ef8){const _0x230046=a41_0xedb7;validateProfileName(_0x312ef8);const _0x569d41=getNewCredentialPath(_0x312ef8);if(a41_0x337097['existsSync'](_0x569d41))try{return a41_0x337097['readFileSync'](_0x569d41,_0x230046(0x16c));}catch{}const _0xa0dd59=getOldCredentialPath(_0x312ef8);if(a41_0x337097[_0x230046(0x177)](_0xa0dd59)){console[_0x230046(0x17b)](_0x230046(0x169)+_0x312ef8+'\x27'),console['warn'](_0x230046(0x18b)),console[_0x230046(0x17b)](_0x230046(0x15a)+_0xa0dd59+'\x22\x20\x22'+_0x569d41+'\x22'),console[_0x230046(0x17b)](_0x230046(0x191));try{return a41_0x337097[_0x230046(0x164)](_0xa0dd59,_0x230046(0x16c));}catch{return null;}}return null;}
|