@treasuredata/tdx 2026.4.3 → 2026.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/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/cas-command.js +1 -1
- package/dist/commands/cas-segment-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/policy-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-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-pull-command.js +1 -1
- package/dist/commands/segment-push-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/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/work-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.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/oauth-keychain.js +1 -1
- package/dist/core/oauth.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/tools/work-create-item.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/cas/cas-api-client.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js +1 -1
- package/dist/sdk/cas/cas-segment-yaml.js +1 -1
- package/dist/sdk/cas/index.js +1 -1
- package/dist/sdk/cas/pull-workflow.js +1 -1
- package/dist/sdk/cas/push-workflow.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/types/workspace.d.ts +2 -0
- package/dist/sdk/types/workspace.d.ts.map +1 -1
- package/dist/sdk/types/workspace.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/sdk/workspace/access-tracker.d.ts +5 -0
- package/dist/sdk/workspace/access-tracker.d.ts.map +1 -0
- package/dist/sdk/workspace/access-tracker.js +1 -0
- package/dist/sdk/workspace/access-tracker.js.map +1 -0
- package/dist/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.d.ts +1 -1
- package/dist/sdk/workspace/git.d.ts.map +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/git.js.map +1 -1
- package/dist/sdk/workspace/index.d.ts +8 -0
- package/dist/sdk/workspace/index.d.ts.map +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/index.js.map +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.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/version-check.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const a8_0x2fb3cc=a8_0x15c2;(function(_0x13196c,_0x20d589){const _0x500eaa=a8_0x15c2,_0x24ebde=_0x13196c();while(!![]){try{const _0x12333a=-parseInt(_0x500eaa(0x186))/0x1*(-parseInt(_0x500eaa(0x17f))/0x2)+-parseInt(_0x500eaa(0x199))/0x3*(-parseInt(_0x500eaa(0x1d5))/0x4)+-parseInt(_0x500eaa(0x1d2))/0x5*(parseInt(_0x500eaa(0x181))/0x6)+parseInt(_0x500eaa(0x1d9))/0x7*(parseInt(_0x500eaa(0x1ad))/0x8)+parseInt(_0x500eaa(0x19b))/0x9+parseInt(_0x500eaa(0x198))/0xa+-parseInt(_0x500eaa(0x1b6))/0xb;if(_0x12333a===_0x20d589)break;else _0x24ebde['push'](_0x24ebde['shift']());}catch(_0x386828){_0x24ebde['push'](_0x24ebde['shift']());}}}(a8_0x3102,0xd97be));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import a8_0xfb1312 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';function a8_0x3102(){const _0x49b833=['Master\x20Table','Fetching\x20audience\x20\x27','description','basename','No\x20composable\x20audience\x20specified.','filter','names','\x20file(s)\x20to\x20','dirname','\x20segments,\x20','8lTeKsM','push','All\x20files\x20are\x20up\x20to\x20date.','name','\x20—\x20','table','cas:pull','🧊\x20','execute','66900548quHDcY','List\x20composable\x20audiences','files','success','masterTable','audienceName','relativePath','\x20file(s)\x20to\x20write\x20','dryRun','No\x20YAML\x20files\x20found\x20in:\x20','underline','map','counts','Wrote\x20','status','\x20\x20Table:\x20\x20','absolutePath','isNew','population','dim','log','Cancelled.','cas','diff','list','\x0a⚠\x20Experimental:\x20CAS\x20push\x20runs\x20in\x20dry-run\x20mode\x20only.\x20Push\x20support\x20is\x20not\x20yet\x20complete.','\x20=\x20','verbose','910585kofEEL','Behaviors\x20(','attributes','488oxACCB','pull','content','Error:\x20\x20','9324119pDVtOS','yes','\x27...','type','cas:push','toLocaleString','tdx\x20cas\x20push\x20<path>','behaviors','bold','\x0aSample\x20Rows\x20(','dir','audiences','masterSchema','Pulling\x20composable\x20audience\x20\x27','Attributes\x20(','Count:\x20\x20','relative','Context\x20set:\x20','Fetching\x20composable\x20audiences...','cwd','cas:desc','Pull\x20composable\x20audience\x20to\x20YAML\x20files','timeColumn','Would\x20push:\x20','(dry\x20run\x20—\x20push\x20is\x20not\x20yet\x20implemented)','Use\x20','--audience\x20<name>','Status:\x20','segments','cyan','yellow','Write\x20files?','Directory\x20not\x20found:\x20','1638586QlgvmZ','length','6HJNBKo','Push\x20YAML\x20files\x20to\x20CAS\x20API','green','composableAudience','No\x20composable\x20audiences\x20found.','2qEnvNV','\x20or\x20set\x20context\x20with\x20','column','\x20(time:\x20','join','composable_audience','schema','cas:preview','get','Audience:\x20','(dry\x20run\x20—\x20no\x20files\x20written)','red','rows','\x20audience(s)','data','activations','\x20\x20Key:\x20\x20\x20\x20','Found\x20','16412660lxtrFS','22107wPOyeD','cas:list','14795208HBdfpl','count','error','tdx\x20cas\x20pull\x20<name>','tdx\x20use\x20cas\x20<name>','Audience\x20name\x20required.','setPhase','Tip:\x20Run\x20`tdx\x20cas\x20pull\x20<name>`\x20first\x20to\x20create\x20the\x20folder\x20structure'];a8_0x3102=function(){return _0x49b833;};return a8_0x3102();}import a8_0x3567e1 from'path';function a8_0x15c2(_0x4bb5de,_0x334800){_0x4bb5de=_0x4bb5de-0x162;const _0x3102f2=a8_0x3102();let _0x15c2b0=_0x3102f2[_0x4bb5de];return _0x15c2b0;}import{confirmKey,isInteractive}from'../utils/prompt.js';import{collectYamlFiles}from'../sdk/cas/push-workflow.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';export class CASListCommand extends BaseCommand{[a8_0x2fb3cc(0x1b0)]=a8_0x2fb3cc(0x19a);['description']=a8_0x2fb3cc(0x1b7);async[a8_0x2fb3cc(0x1b5)](_0xcf0298){const _0x5d65bd=a8_0x2fb3cc,{options:_0x49ff0a,tdx:_0x3b4190}=_0xcf0298,_0x1d8187=await withProgressSpinner(_0x5d65bd(0x170),()=>_0x3b4190[_0x5d65bd(0x1cc)][_0x5d65bd(0x1ce)](),{'verbose':_0x49ff0a[_0x5d65bd(0x1d1)]}),_0x59ba71=_0x1d8187[_0x5d65bd(0x194)];if(isStructuredFormat(_0x49ff0a))return await handleSDKOutput(_0x59ba71,_0x49ff0a),0x0;if(_0x59ba71[_0x5d65bd(0x180)]===0x0)return console[_0x5d65bd(0x1ca)](a8_0xfb1312[_0x5d65bd(0x1c9)](_0x5d65bd(0x185))),0x0;console['log'](a8_0xfb1312[_0x5d65bd(0x183)](_0x5d65bd(0x197)+_0x59ba71['length']+'\x20composable\x20audiences'));for(const _0x45210d of _0x59ba71){const _0x39f715=_0x45210d[_0x5d65bd(0x1c8)]?a8_0xfb1312[_0x5d65bd(0x1c9)]('\x20('+Number(_0x45210d['population'])[_0x5d65bd(0x163)]()+')'):'',_0x33260f=a8_0xfb1312[_0x5d65bd(0x1c9)]('\x20'+_0x45210d['masterSchema']+'.'+_0x45210d[_0x5d65bd(0x1ba)]);console[_0x5d65bd(0x1ca)](_0x5d65bd(0x1b4)+_0x45210d[_0x5d65bd(0x1b0)]+_0x39f715+_0x33260f),_0x45210d['description']&&console[_0x5d65bd(0x1ca)]('\x20\x20'+a8_0xfb1312[_0x5d65bd(0x1c9)](_0x45210d['description']));}return 0x0;}}export class CASDescCommand extends BaseCommand{['name']=a8_0x2fb3cc(0x172);[a8_0x2fb3cc(0x1a5)]='Describe\x20a\x20composable\x20audience';async[a8_0x2fb3cc(0x1b5)](_0x3db07b){const _0x4c8ee2=a8_0x2fb3cc,{options:_0x40082e,args:_0x20615d,tdx:_0x559114}=_0x3db07b,_0x5dc36e=_0x20615d[0x0]||_0x40082e[_0x4c8ee2(0x184)];if(!_0x5dc36e)return console[_0x4c8ee2(0x19d)](a8_0xfb1312[_0x4c8ee2(0x17c)](_0x4c8ee2(0x1a7))),console[_0x4c8ee2(0x19d)](_0x4c8ee2(0x177)+a8_0xfb1312[_0x4c8ee2(0x17b)]('tdx\x20cas\x20desc\x20<name>')+'\x20or\x20set\x20context\x20with\x20'+a8_0xfb1312[_0x4c8ee2(0x17b)](_0x4c8ee2(0x19f))),0x1;const _0x14225d=await withProgressSpinner(_0x4c8ee2(0x1a4)+_0x5dc36e+_0x4c8ee2(0x1db),()=>_0x559114[_0x4c8ee2(0x1cc)][_0x4c8ee2(0x18e)](_0x5dc36e),{'verbose':_0x40082e[_0x4c8ee2(0x1d1)]}),_0x4f233d=_0x14225d[_0x4c8ee2(0x194)];if(isStructuredFormat(_0x40082e))return await handleSingleObjectOutput(_0x4f233d,_0x40082e),0x0;console[_0x4c8ee2(0x1ca)](a8_0xfb1312[_0x4c8ee2(0x166)](_0x4f233d[_0x4c8ee2(0x1b0)]));if(_0x4f233d['description'])console[_0x4c8ee2(0x1ca)](a8_0xfb1312['dim'](_0x4f233d[_0x4c8ee2(0x1a5)]));console[_0x4c8ee2(0x1ca)](),console[_0x4c8ee2(0x1ca)](a8_0xfb1312[_0x4c8ee2(0x1c0)](_0x4c8ee2(0x1a3))),console[_0x4c8ee2(0x1ca)]('\x20\x20Schema:\x20'+_0x4f233d[_0x4c8ee2(0x16a)]),console[_0x4c8ee2(0x1ca)](_0x4c8ee2(0x1c5)+_0x4f233d[_0x4c8ee2(0x1ba)]),console[_0x4c8ee2(0x1ca)](_0x4c8ee2(0x196)+_0x4f233d['masterKeyColumn']),console[_0x4c8ee2(0x1ca)]();if(_0x4f233d[_0x4c8ee2(0x1d4)]?.[_0x4c8ee2(0x180)]){console[_0x4c8ee2(0x1ca)](a8_0xfb1312['underline'](_0x4c8ee2(0x16c)+_0x4f233d['attributes'][_0x4c8ee2(0x180)]+')'));for(const _0x2c67d1 of _0x4f233d[_0x4c8ee2(0x1d4)]){console['log']('\x20\x20'+a8_0xfb1312['bold'](_0x2c67d1['name'])+_0x4c8ee2(0x1b1)+_0x2c67d1[_0x4c8ee2(0x18c)]+'.'+_0x2c67d1[_0x4c8ee2(0x1b2)]+'.'+_0x2c67d1[_0x4c8ee2(0x188)]+'\x20('+a8_0xfb1312[_0x4c8ee2(0x1c9)](_0x2c67d1[_0x4c8ee2(0x1dc)])+')');}console[_0x4c8ee2(0x1ca)]();}if(_0x4f233d[_0x4c8ee2(0x165)]?.[_0x4c8ee2(0x180)]){console['log'](a8_0xfb1312[_0x4c8ee2(0x1c0)](_0x4c8ee2(0x1d3)+_0x4f233d[_0x4c8ee2(0x165)][_0x4c8ee2(0x180)]+')'));for(const _0x3ed4fd of _0x4f233d[_0x4c8ee2(0x165)]){const _0x2e9b86=_0x3ed4fd[_0x4c8ee2(0x174)]?_0x4c8ee2(0x189)+_0x3ed4fd[_0x4c8ee2(0x174)]+')':'';console[_0x4c8ee2(0x1ca)]('\x20\x20'+a8_0xfb1312['bold'](_0x3ed4fd[_0x4c8ee2(0x1b0)])+_0x4c8ee2(0x1b1)+_0x3ed4fd[_0x4c8ee2(0x18c)]+'.'+_0x3ed4fd[_0x4c8ee2(0x1b2)]+_0x2e9b86);}}return 0x0;}}export class CASPullCommand extends BaseCommand{[a8_0x2fb3cc(0x1b0)]=a8_0x2fb3cc(0x1b3);[a8_0x2fb3cc(0x1a5)]=a8_0x2fb3cc(0x173);async[a8_0x2fb3cc(0x1b5)](_0x219452){const _0x4d2941=a8_0x2fb3cc,{options:_0x3b77e4,args:_0x27420e,tdx:_0x28468f}=_0x219452,_0x704232=_0x3b77e4,_0x1760b3=_0x27420e[0x0]||_0x3b77e4[_0x4d2941(0x184)];if(!_0x1760b3)return console[_0x4d2941(0x19d)](a8_0xfb1312['yellow'](_0x4d2941(0x1a7))),console[_0x4d2941(0x19d)](_0x4d2941(0x177)+a8_0xfb1312[_0x4d2941(0x17b)](_0x4d2941(0x19e))+'\x20or\x20set\x20context\x20with\x20'+a8_0xfb1312[_0x4d2941(0x17b)](_0x4d2941(0x19f))),0x1;const _0x5641fc=_0x704232[_0x4d2941(0x168)]||a8_0x3567e1[_0x4d2941(0x18a)](process[_0x4d2941(0x171)](),_0x4d2941(0x1cc),sanitizeFileName(_0x1760b3)),_0x45d45d=await withProgressSpinner(_0x4d2941(0x16b)+_0x1760b3+_0x4d2941(0x1db),_0xd8cd3e=>_0x28468f[_0x4d2941(0x1cc)][_0x4d2941(0x1d6)](_0x1760b3,{'targetDir':_0x5641fc,'verbose':_0x704232['verbose'],'progress':{'update':_0xce4e76=>_0xd8cd3e[_0x4d2941(0x1a1)](_0xce4e76)}}),{'verbose':_0x704232['verbose']}),_0x21c52d=_0x45d45d[_0x4d2941(0x194)],_0x2fe7f6=_0x21c52d[_0x4d2941(0x1b8)][_0x4d2941(0x1a8)](_0x361f0c=>_0x361f0c[_0x4d2941(0x1c7)]||_0x361f0c['hasChanges']);saveSessionContext({'composable_audience':_0x21c52d['audienceName']},_0x704232['session']),console['log'](a8_0xfb1312['green'](_0x4d2941(0x16f)+a8_0xfb1312[_0x4d2941(0x1c9)](_0x4d2941(0x18b))+_0x4d2941(0x1d0)+a8_0xfb1312['cyan'](_0x21c52d[_0x4d2941(0x1bb)])));if(_0x2fe7f6[_0x4d2941(0x180)]===0x0)return console[_0x4d2941(0x1ca)](a8_0xfb1312['green'](_0x4d2941(0x1af))),0x0;for(const _0x4de78d of _0x2fe7f6){if(_0x4de78d['isNew'])console['log'](a8_0xfb1312[_0x4d2941(0x183)]('+\x20'+_0x4de78d[_0x4d2941(0x1bc)]+'\x20(new)'));else _0x4de78d[_0x4d2941(0x1cd)]&&(console[_0x4d2941(0x1ca)](a8_0xfb1312['yellow']('~\x20'+_0x4de78d['relativePath'])),console['log'](_0x4de78d[_0x4d2941(0x1cd)]));}console['log']('\x0a'+_0x2fe7f6['length']+_0x4d2941(0x1bd)+('('+_0x21c52d[_0x4d2941(0x1c2)][_0x4d2941(0x17a)]+_0x4d2941(0x1ac)+_0x21c52d[_0x4d2941(0x1c2)][_0x4d2941(0x195)]+'\x20activations)'));if(_0x704232[_0x4d2941(0x1be)])return console[_0x4d2941(0x1ca)](a8_0xfb1312[_0x4d2941(0x1c9)](_0x4d2941(0x190))),0x0;if(!_0x704232[_0x4d2941(0x1da)]&&isInteractive()){const _0x29b335=await confirmKey(_0x4d2941(0x17d));if(!_0x29b335)return console['log'](a8_0xfb1312[_0x4d2941(0x1c9)](_0x4d2941(0x1cb))),0x0;}for(const _0x47333a of _0x2fe7f6){const _0x45a544=a8_0x3567e1[_0x4d2941(0x1ab)](_0x47333a[_0x4d2941(0x1c6)]);if(!existsSync(_0x45a544))mkdirSync(_0x45a544,{'recursive':!![]});writeFileSync(_0x47333a[_0x4d2941(0x1c6)],_0x47333a[_0x4d2941(0x1d7)],'utf-8');}return console['log'](a8_0xfb1312['green'](_0x4d2941(0x1c3)+_0x2fe7f6[_0x4d2941(0x180)]+_0x4d2941(0x1aa)+_0x5641fc)),0x0;}}export class CASPushCommand extends BaseCommand{['name']=a8_0x2fb3cc(0x162);['description']=a8_0x2fb3cc(0x182);async['execute'](_0x22fe26){const _0x279ddf=a8_0x2fb3cc,{options:_0x4cca76,args:_0x185e2a,tdx:_0x32e3e8}=_0x22fe26,_0x58b437=_0x4cca76;let _0x556949=_0x185e2a[0x0];!_0x556949&&_0x4cca76[_0x279ddf(0x184)]&&(_0x556949=a8_0x3567e1['join'](process['cwd'](),_0x279ddf(0x1cc),sanitizeFileName(_0x4cca76['composableAudience'])));if(!_0x556949)return console[_0x279ddf(0x19d)](a8_0xfb1312[_0x279ddf(0x17c)](_0x279ddf(0x1a7))),console['error'](_0x279ddf(0x177)+a8_0xfb1312[_0x279ddf(0x17b)](_0x279ddf(0x164))+_0x279ddf(0x187)+a8_0xfb1312[_0x279ddf(0x17b)](_0x279ddf(0x19f))),0x1;if(!existsSync(_0x556949))return console['error'](a8_0xfb1312[_0x279ddf(0x191)](_0x279ddf(0x17e)+_0x556949)),console[_0x279ddf(0x19d)](a8_0xfb1312[_0x279ddf(0x1c9)](_0x279ddf(0x1a2))),0x1;const _0xc6ecbe=_0x4cca76['composableAudience']||a8_0x3567e1[_0x279ddf(0x1a6)](_0x556949),_0x1dc6fb=a8_0x3567e1[_0x279ddf(0x16e)](process['cwd'](),_0x556949)||'.';console['log'](_0x279ddf(0x18f)+a8_0xfb1312[_0x279ddf(0x17b)](_0xc6ecbe)),console[_0x279ddf(0x1ca)]('Source:\x20\x20\x20'+a8_0xfb1312[_0x279ddf(0x1c9)](_0x1dc6fb)),console['log'](a8_0xfb1312[_0x279ddf(0x17c)](_0x279ddf(0x1cf))),console['log']();const _0x65439e=collectYamlFiles(_0x556949);if(_0x65439e[_0x279ddf(0x180)]===0x0)return console[_0x279ddf(0x19d)](a8_0xfb1312['red'](_0x279ddf(0x1bf)+_0x556949)),0x1;console[_0x279ddf(0x1ca)](_0x279ddf(0x197)+_0x65439e[_0x279ddf(0x180)]+'\x20YAML\x20file(s)');const _0x8d5711=await withProgressSpinner('Analyzing\x20CAS\x20YAML\x20files...',_0x43242f=>_0x32e3e8[_0x279ddf(0x1cc)][_0x279ddf(0x1ae)](_0x65439e,{'dryRun':!![],'verbose':_0x58b437['verbose'],'progress':{'update':_0x3812af=>_0x43242f[_0x279ddf(0x1a1)](_0x3812af)}}),{'verbose':_0x58b437[_0x279ddf(0x1d1)]}),_0x304977=_0x8d5711[_0x279ddf(0x194)],{created:_0x902424}=_0x304977,_0x280090=[];if(_0x902424['audiences'])_0x280090['push'](_0x902424[_0x279ddf(0x169)]+_0x279ddf(0x193));if(_0x902424[_0x279ddf(0x17a)])_0x280090[_0x279ddf(0x1ae)](_0x902424['segments']+'\x20segment(s)');if(_0x902424['activations'])_0x280090['push'](_0x902424['activations']+'\x20activation(s)');return _0x280090[_0x279ddf(0x180)]===0x0?console[_0x279ddf(0x1ca)](a8_0xfb1312[_0x279ddf(0x1c9)]('No\x20CAS\x20resources\x20found\x20in\x20YAML\x20files.')):console[_0x279ddf(0x1ca)](_0x279ddf(0x175)+_0x280090[_0x279ddf(0x18a)](',\x20')),console[_0x279ddf(0x1ca)](a8_0xfb1312[_0x279ddf(0x1c9)](_0x279ddf(0x176))),0x0;}}export class CASPreviewCommand extends BaseCommand{[a8_0x2fb3cc(0x1b0)]=a8_0x2fb3cc(0x18d);['description']='Preview\x20composable\x20segment\x20query\x20on\x20CDW';async[a8_0x2fb3cc(0x1b5)](_0x234783){const _0x1b2762=a8_0x2fb3cc,{options:_0x34a131,args:_0xf7d142,tdx:_0x5632db}=_0x234783,_0x1486ec=_0xf7d142[0x0],_0x371602=_0xf7d142[0x1]||_0x34a131[_0x1b2762(0x184)];if(!_0x1486ec)return console[_0x1b2762(0x19d)](a8_0xfb1312[_0x1b2762(0x191)]('Usage:\x20tdx\x20cas\x20preview\x20<segment_name>\x20[--audience\x20<name>]')),0x1;if(!_0x371602)return console[_0x1b2762(0x19d)](a8_0xfb1312['yellow'](_0x1b2762(0x1a0))),console[_0x1b2762(0x19d)](_0x1b2762(0x177)+a8_0xfb1312[_0x1b2762(0x17b)](_0x1b2762(0x178))+_0x1b2762(0x187)+a8_0xfb1312[_0x1b2762(0x17b)](_0x1b2762(0x19f))),0x1;const _0x4517e5=await withProgressSpinner('Running\x20preview\x20for\x20\x27'+_0x1486ec+_0x1b2762(0x1db),()=>_0x5632db[_0x1b2762(0x1cc)]['preview'](_0x371602,_0x1486ec),{'verbose':_0x34a131[_0x1b2762(0x1d1)]}),{query:_0x409005,customers:_0x420a6d}=_0x4517e5[_0x1b2762(0x194)];if(isStructuredFormat(_0x34a131))return await handleSingleObjectOutput({'query':_0x409005,'customers':_0x420a6d},_0x34a131),0x0;const _0x3e487=_0x409005[_0x1b2762(0x1c4)]===_0x1b2762(0x1b9)?a8_0xfb1312[_0x1b2762(0x183)]:a8_0xfb1312[_0x1b2762(0x17c)];console[_0x1b2762(0x1ca)](_0x1b2762(0x179)+_0x3e487(_0x409005[_0x1b2762(0x1c4)])),console[_0x1b2762(0x1ca)](_0x1b2762(0x16d)+a8_0xfb1312['bold'](String(_0x409005[_0x1b2762(0x19c)])));_0x409005[_0x1b2762(0x19d)]&&console['log'](_0x1b2762(0x1d8)+a8_0xfb1312['red'](_0x409005['error']));if(_0x420a6d?.[_0x1b2762(0x1a9)]&&_0x420a6d?.[_0x1b2762(0x192)]){console['log'](a8_0xfb1312[_0x1b2762(0x1c0)](_0x1b2762(0x167)+_0x420a6d[_0x1b2762(0x192)][_0x1b2762(0x180)]+')'));const _0x544bdb=_0x420a6d[_0x1b2762(0x192)][_0x1b2762(0x1c1)](_0x4301cc=>{const _0x340895=_0x1b2762,_0x478a2d={};for(let _0x49fe8c=0x0;_0x49fe8c<_0x420a6d[_0x340895(0x1a9)][_0x340895(0x180)];_0x49fe8c++){_0x478a2d[_0x420a6d[_0x340895(0x1a9)][_0x49fe8c]]=_0x4301cc[_0x49fe8c];}return _0x478a2d;});await handleSDKOutput(_0x544bdb,_0x34a131);}return 0x0;}}
|
|
1
|
+
const a8_0x1271fb=a8_0x53a4;function a8_0x53a4(_0x1d2830,_0x39226f){_0x1d2830=_0x1d2830-0xce;const _0x1e6da5=a8_0x1e6d();let _0x53a494=_0x1e6da5[_0x1d2830];return _0x53a494;}(function(_0xbf0a6d,_0x3ed50e){const _0x2c9ce4=a8_0x53a4,_0x3153b5=_0xbf0a6d();while(!![]){try{const _0x31c6f2=parseInt(_0x2c9ce4(0x120))/0x1+-parseInt(_0x2c9ce4(0x132))/0x2*(-parseInt(_0x2c9ce4(0x107))/0x3)+parseInt(_0x2c9ce4(0x105))/0x4*(parseInt(_0x2c9ce4(0x135))/0x5)+parseInt(_0x2c9ce4(0x122))/0x6*(parseInt(_0x2c9ce4(0x123))/0x7)+-parseInt(_0x2c9ce4(0x116))/0x8*(-parseInt(_0x2c9ce4(0xf2))/0x9)+-parseInt(_0x2c9ce4(0x11a))/0xa*(-parseInt(_0x2c9ce4(0xf5))/0xb)+-parseInt(_0x2c9ce4(0x108))/0xc*(parseInt(_0x2c9ce4(0xfd))/0xd);if(_0x31c6f2===_0x3ed50e)break;else _0x3153b5['push'](_0x3153b5['shift']());}catch(_0x1091f1){_0x3153b5['push'](_0x3153b5['shift']());}}}(a8_0x1e6d,0x788fc));import{BaseCommand}from'./command.js';function a8_0x1e6d(){const _0x5a1fc6=['cas:push','utf-8','Running\x20preview\x20for\x20\x27','\x20segment(s)','cas:preview','yellow','composable_audience','error','No\x20CAS\x20resources\x20found\x20in\x20YAML\x20files.','preview','Behaviors\x20(','No\x20composable\x20audiences\x20found.','tdx\x20cas\x20desc\x20<name>','Attributes\x20(','get','\x20or\x20set\x20context\x20with\x20','All\x20files\x20are\x20up\x20to\x20date.','dirname','Source:\x20\x20\x20','--audience\x20<name>','tdx\x20use\x20cas\x20<name>','count','No\x20composable\x20audience\x20specified.','Fetching\x20audience\x20\x27','9TVzdSd','yes','names','396qAZGnq','timeColumn','cas:list','cyan','Write\x20files?','filter','behaviors','dim','231959INpaiT','Found\x20','bold','\x20(time:\x20','cas','underline','table','Describe\x20a\x20composable\x20audience','527140raKETE','\x0aSample\x20Rows\x20(','501FwQiHz','1944vzBpOs','list','rows','\x27...','Master\x20Table','\x20\x20Schema:\x20','masterSchema','audiences','\x20YAML\x20file(s)','tdx\x20cas\x20pull\x20<name>','\x20file(s)\x20to\x20write\x20','session','Wrote\x20','dir','3526240uFbbBR','success','segments','\x20segments,\x20','160350ptEuUx','\x0a⚠\x20Experimental:\x20CAS\x20push\x20runs\x20in\x20dry-run\x20mode\x20only.\x20Push\x20support\x20is\x20not\x20yet\x20complete.','dryRun','hasChanges','Context\x20set:\x20','audienceName','395691EXhbUT','Use\x20','1917294OfUalg','14rflsmQ','activations','setPhase','composableAudience','push','Would\x20push:\x20','\x20=\x20','cwd','name','\x20audience(s)','basename','\x20composable\x20audiences','cas:desc','description','Cancelled.','11212QRPnWF','Error:\x20\x20','\x20activation(s)','15xGPNCi','toLocaleString','verbose','Preview\x20composable\x20segment\x20query\x20on\x20CDW','green','log','status','\x20—\x20','red','schema','No\x20YAML\x20files\x20found\x20in:\x20','masterKeyColumn','(dry\x20run\x20—\x20push\x20is\x20not\x20yet\x20implemented)','population','Pull\x20composable\x20audience\x20to\x20YAML\x20files','Fetching\x20composable\x20audiences...','Audience\x20name\x20required.','data','pull','List\x20composable\x20audiences','\x20file(s)\x20to\x20','attributes','Audience:\x20','tdx\x20cas\x20push\x20<path>','type','(dry\x20run\x20—\x20no\x20files\x20written)','Count:\x20\x20','\x20\x20Table:\x20\x20','map','join','absolutePath','execute','length','masterTable','isNew','Status:\x20'];a8_0x1e6d=function(){return _0x5a1fc6;};return a8_0x1e6d();}import{withProgressSpinner}from'../utils/spinner.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat}from'../core/command-output.js';import a8_0x588110 from'chalk';import{existsSync,mkdirSync,writeFileSync}from'fs';import a8_0x3f25f1 from'path';import{confirmKey,isInteractive}from'../utils/prompt.js';import{collectYamlFiles}from'../sdk/cas/push-workflow.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';export class CASListCommand extends BaseCommand{[a8_0x1271fb(0x12b)]=a8_0x1271fb(0xf7);[a8_0x1271fb(0x130)]=a8_0x1271fb(0x148);async[a8_0x1271fb(0xd5)](_0x5a6247){const _0x3cc7c8=a8_0x1271fb,{options:_0x5a113f,tdx:_0x3a3c65}=_0x5a6247,_0x339b54=await withProgressSpinner(_0x3cc7c8(0x144),()=>_0x3a3c65[_0x3cc7c8(0x101)][_0x3cc7c8(0x109)](),{'verbose':_0x5a113f['verbose']}),_0xa135df=_0x339b54['data'];if(isStructuredFormat(_0x5a113f))return await handleSDKOutput(_0xa135df,_0x5a113f),0x0;if(_0xa135df[_0x3cc7c8(0xd6)]===0x0)return console[_0x3cc7c8(0x13a)](a8_0x588110['dim'](_0x3cc7c8(0xe5))),0x0;console['log'](a8_0x588110[_0x3cc7c8(0x139)](_0x3cc7c8(0xfe)+_0xa135df['length']+_0x3cc7c8(0x12e)));for(const _0x709a65 of _0xa135df){const _0x39e940=_0x709a65[_0x3cc7c8(0x142)]?a8_0x588110[_0x3cc7c8(0xfc)]('\x20('+Number(_0x709a65[_0x3cc7c8(0x142)])[_0x3cc7c8(0x136)]()+')'):'',_0x48ff1e=a8_0x588110['dim']('\x20'+_0x709a65[_0x3cc7c8(0x10e)]+'.'+_0x709a65[_0x3cc7c8(0xd7)]);console[_0x3cc7c8(0x13a)]('🧊\x20'+_0x709a65[_0x3cc7c8(0x12b)]+_0x39e940+_0x48ff1e),_0x709a65['description']&&console['log']('\x20\x20'+a8_0x588110[_0x3cc7c8(0xfc)](_0x709a65[_0x3cc7c8(0x130)]));}return 0x0;}}export class CASDescCommand extends BaseCommand{[a8_0x1271fb(0x12b)]=a8_0x1271fb(0x12f);[a8_0x1271fb(0x130)]=a8_0x1271fb(0x104);async[a8_0x1271fb(0xd5)](_0x4be520){const _0x23e195=a8_0x1271fb,{options:_0x324af8,args:_0x4e007f,tdx:_0x2a55f2}=_0x4be520,_0x63f7a2=_0x4e007f[0x0]||_0x324af8[_0x23e195(0x126)];if(!_0x63f7a2)return console[_0x23e195(0xe1)](a8_0x588110[_0x23e195(0xdf)]('No\x20composable\x20audience\x20specified.')),console['error'](_0x23e195(0x121)+a8_0x588110['cyan'](_0x23e195(0xe6))+_0x23e195(0xe9)+a8_0x588110[_0x23e195(0xf8)]('tdx\x20use\x20cas\x20<name>')),0x1;const _0x53c797=await withProgressSpinner(_0x23e195(0xf1)+_0x63f7a2+_0x23e195(0x10b),()=>_0x2a55f2[_0x23e195(0x101)][_0x23e195(0xe8)](_0x63f7a2),{'verbose':_0x324af8[_0x23e195(0x137)]}),_0x2135da=_0x53c797[_0x23e195(0x146)];if(isStructuredFormat(_0x324af8))return await handleSingleObjectOutput(_0x2135da,_0x324af8),0x0;console['log'](a8_0x588110['bold'](_0x2135da[_0x23e195(0x12b)]));if(_0x2135da[_0x23e195(0x130)])console['log'](a8_0x588110['dim'](_0x2135da['description']));console[_0x23e195(0x13a)](),console[_0x23e195(0x13a)](a8_0x588110['underline'](_0x23e195(0x10c))),console[_0x23e195(0x13a)](_0x23e195(0x10d)+_0x2135da['masterSchema']),console[_0x23e195(0x13a)](_0x23e195(0xd1)+_0x2135da[_0x23e195(0xd7)]),console[_0x23e195(0x13a)]('\x20\x20Key:\x20\x20\x20\x20'+_0x2135da[_0x23e195(0x140)]),console[_0x23e195(0x13a)]();if(_0x2135da['attributes']?.[_0x23e195(0xd6)]){console['log'](a8_0x588110[_0x23e195(0x102)](_0x23e195(0xe7)+_0x2135da[_0x23e195(0x14a)][_0x23e195(0xd6)]+')'));for(const _0x2c6d6c of _0x2135da['attributes']){console[_0x23e195(0x13a)]('\x20\x20'+a8_0x588110[_0x23e195(0xff)](_0x2c6d6c['name'])+_0x23e195(0x13c)+_0x2c6d6c[_0x23e195(0x13e)]+'.'+_0x2c6d6c[_0x23e195(0x103)]+'.'+_0x2c6d6c['column']+'\x20('+a8_0x588110[_0x23e195(0xfc)](_0x2c6d6c[_0x23e195(0xce)])+')');}console[_0x23e195(0x13a)]();}if(_0x2135da[_0x23e195(0xfb)]?.['length']){console[_0x23e195(0x13a)](a8_0x588110[_0x23e195(0x102)](_0x23e195(0xe4)+_0x2135da[_0x23e195(0xfb)][_0x23e195(0xd6)]+')'));for(const _0x3ea220 of _0x2135da[_0x23e195(0xfb)]){const _0x54678d=_0x3ea220[_0x23e195(0xf6)]?_0x23e195(0x100)+_0x3ea220[_0x23e195(0xf6)]+')':'';console['log']('\x20\x20'+a8_0x588110[_0x23e195(0xff)](_0x3ea220[_0x23e195(0x12b)])+_0x23e195(0x13c)+_0x3ea220['schema']+'.'+_0x3ea220['table']+_0x54678d);}}return 0x0;}}export class CASPullCommand extends BaseCommand{[a8_0x1271fb(0x12b)]='cas:pull';[a8_0x1271fb(0x130)]=a8_0x1271fb(0x143);async[a8_0x1271fb(0xd5)](_0x3c53ce){const _0x4f5301=a8_0x1271fb,{options:_0x20be95,args:_0x20c3b3,tdx:_0x2677c6}=_0x3c53ce,_0x14a8c0=_0x20be95,_0x2cde25=_0x20c3b3[0x0]||_0x20be95[_0x4f5301(0x126)];if(!_0x2cde25)return console[_0x4f5301(0xe1)](a8_0x588110['yellow'](_0x4f5301(0xf0))),console[_0x4f5301(0xe1)](_0x4f5301(0x121)+a8_0x588110[_0x4f5301(0xf8)](_0x4f5301(0x111))+_0x4f5301(0xe9)+a8_0x588110[_0x4f5301(0xf8)](_0x4f5301(0xee))),0x1;const _0x4f8bbc=_0x14a8c0[_0x4f5301(0x115)]||a8_0x3f25f1[_0x4f5301(0xd3)](process[_0x4f5301(0x12a)](),_0x4f5301(0x101),sanitizeFileName(_0x2cde25)),_0x340ba3=await withProgressSpinner('Pulling\x20composable\x20audience\x20\x27'+_0x2cde25+_0x4f5301(0x10b),_0xfbbc01=>_0x2677c6[_0x4f5301(0x101)][_0x4f5301(0x147)](_0x2cde25,{'targetDir':_0x4f8bbc,'verbose':_0x14a8c0[_0x4f5301(0x137)],'progress':{'update':_0x4b1262=>_0xfbbc01[_0x4f5301(0x125)](_0x4b1262)}}),{'verbose':_0x14a8c0[_0x4f5301(0x137)]}),_0x2d40df=_0x340ba3[_0x4f5301(0x146)],_0x5954f0=_0x2d40df['files'][_0x4f5301(0xfa)](_0x373948=>_0x373948[_0x4f5301(0xd8)]||_0x373948[_0x4f5301(0x11d)]);saveSessionContext({'composable_audience':_0x2d40df[_0x4f5301(0x11f)]},_0x14a8c0[_0x4f5301(0x113)]),console[_0x4f5301(0x13a)](a8_0x588110[_0x4f5301(0x139)](_0x4f5301(0x11e)+a8_0x588110['dim'](_0x4f5301(0xe0))+_0x4f5301(0x129)+a8_0x588110['cyan'](_0x2d40df[_0x4f5301(0x11f)])));if(_0x5954f0[_0x4f5301(0xd6)]===0x0)return console[_0x4f5301(0x13a)](a8_0x588110['green'](_0x4f5301(0xea))),0x0;for(const _0x4dddec of _0x5954f0){if(_0x4dddec['isNew'])console[_0x4f5301(0x13a)](a8_0x588110['green']('+\x20'+_0x4dddec['relativePath']+'\x20(new)'));else _0x4dddec['diff']&&(console[_0x4f5301(0x13a)](a8_0x588110[_0x4f5301(0xdf)]('~\x20'+_0x4dddec['relativePath'])),console[_0x4f5301(0x13a)](_0x4dddec['diff']));}console['log']('\x0a'+_0x5954f0[_0x4f5301(0xd6)]+_0x4f5301(0x112)+('('+_0x2d40df['counts'][_0x4f5301(0x118)]+_0x4f5301(0x119)+_0x2d40df['counts'][_0x4f5301(0x124)]+'\x20activations)'));if(_0x14a8c0[_0x4f5301(0x11c)])return console[_0x4f5301(0x13a)](a8_0x588110['dim'](_0x4f5301(0xcf))),0x0;if(!_0x14a8c0[_0x4f5301(0xf3)]&&isInteractive()){const _0x1378e3=await confirmKey(_0x4f5301(0xf9));if(!_0x1378e3)return console['log'](a8_0x588110['dim'](_0x4f5301(0x131))),0x0;}for(const _0x18974f of _0x5954f0){const _0x2267af=a8_0x3f25f1[_0x4f5301(0xeb)](_0x18974f[_0x4f5301(0xd4)]);if(!existsSync(_0x2267af))mkdirSync(_0x2267af,{'recursive':!![]});writeFileSync(_0x18974f[_0x4f5301(0xd4)],_0x18974f['content'],_0x4f5301(0xdb));}return console[_0x4f5301(0x13a)](a8_0x588110[_0x4f5301(0x139)](_0x4f5301(0x114)+_0x5954f0[_0x4f5301(0xd6)]+_0x4f5301(0x149)+_0x4f8bbc)),0x0;}}export class CASPushCommand extends BaseCommand{[a8_0x1271fb(0x12b)]=a8_0x1271fb(0xda);[a8_0x1271fb(0x130)]='Push\x20YAML\x20files\x20to\x20CAS\x20API';async[a8_0x1271fb(0xd5)](_0x5ceb9c){const _0x55d76e=a8_0x1271fb,{options:_0x30530d,args:_0x27c6b8,tdx:_0x967101}=_0x5ceb9c,_0x56e940=_0x30530d;let _0x44c887=_0x27c6b8[0x0];!_0x44c887&&_0x30530d[_0x55d76e(0x126)]&&(_0x44c887=a8_0x3f25f1[_0x55d76e(0xd3)](process['cwd'](),_0x55d76e(0x101),sanitizeFileName(_0x30530d['composableAudience'])));if(!_0x44c887)return console['error'](a8_0x588110[_0x55d76e(0xdf)](_0x55d76e(0xf0))),console[_0x55d76e(0xe1)](_0x55d76e(0x121)+a8_0x588110['cyan'](_0x55d76e(0x14c))+'\x20or\x20set\x20context\x20with\x20'+a8_0x588110['cyan']('tdx\x20use\x20cas\x20<name>')),0x1;if(!existsSync(_0x44c887))return console['error'](a8_0x588110[_0x55d76e(0x13d)]('Directory\x20not\x20found:\x20'+_0x44c887)),console[_0x55d76e(0xe1)](a8_0x588110[_0x55d76e(0xfc)]('Tip:\x20Run\x20`tdx\x20cas\x20pull\x20<name>`\x20first\x20to\x20create\x20the\x20folder\x20structure')),0x1;const _0x50de87=_0x30530d[_0x55d76e(0x126)]||a8_0x3f25f1[_0x55d76e(0x12d)](_0x44c887),_0x8580a5=a8_0x3f25f1['relative'](process[_0x55d76e(0x12a)](),_0x44c887)||'.';console[_0x55d76e(0x13a)](_0x55d76e(0x14b)+a8_0x588110[_0x55d76e(0xf8)](_0x50de87)),console[_0x55d76e(0x13a)](_0x55d76e(0xec)+a8_0x588110[_0x55d76e(0xfc)](_0x8580a5)),console[_0x55d76e(0x13a)](a8_0x588110[_0x55d76e(0xdf)](_0x55d76e(0x11b))),console[_0x55d76e(0x13a)]();const _0xa50a3b=collectYamlFiles(_0x44c887);if(_0xa50a3b[_0x55d76e(0xd6)]===0x0)return console['error'](a8_0x588110[_0x55d76e(0x13d)](_0x55d76e(0x13f)+_0x44c887)),0x1;console[_0x55d76e(0x13a)](_0x55d76e(0xfe)+_0xa50a3b[_0x55d76e(0xd6)]+_0x55d76e(0x110));const _0x110049=await withProgressSpinner('Analyzing\x20CAS\x20YAML\x20files...',_0x15b2a8=>_0x967101[_0x55d76e(0x101)]['push'](_0xa50a3b,{'dryRun':!![],'verbose':_0x56e940[_0x55d76e(0x137)],'progress':{'update':_0x2bffd6=>_0x15b2a8['setPhase'](_0x2bffd6)}}),{'verbose':_0x56e940[_0x55d76e(0x137)]}),_0x429a2e=_0x110049[_0x55d76e(0x146)],{created:_0x14ad02}=_0x429a2e,_0x37c74b=[];if(_0x14ad02[_0x55d76e(0x10f)])_0x37c74b[_0x55d76e(0x127)](_0x14ad02[_0x55d76e(0x10f)]+_0x55d76e(0x12c));if(_0x14ad02[_0x55d76e(0x118)])_0x37c74b[_0x55d76e(0x127)](_0x14ad02['segments']+_0x55d76e(0xdd));if(_0x14ad02[_0x55d76e(0x124)])_0x37c74b['push'](_0x14ad02[_0x55d76e(0x124)]+_0x55d76e(0x134));return _0x37c74b[_0x55d76e(0xd6)]===0x0?console['log'](a8_0x588110[_0x55d76e(0xfc)](_0x55d76e(0xe2))):console[_0x55d76e(0x13a)](_0x55d76e(0x128)+_0x37c74b[_0x55d76e(0xd3)](',\x20')),console[_0x55d76e(0x13a)](a8_0x588110[_0x55d76e(0xfc)](_0x55d76e(0x141))),0x0;}}export class CASPreviewCommand extends BaseCommand{[a8_0x1271fb(0x12b)]=a8_0x1271fb(0xde);[a8_0x1271fb(0x130)]=a8_0x1271fb(0x138);async[a8_0x1271fb(0xd5)](_0x2c22e4){const _0x637467=a8_0x1271fb,{options:_0x3943ea,args:_0x1ecf04,tdx:_0x109097}=_0x2c22e4,_0x189714=_0x1ecf04[0x0],_0x40a3ff=_0x1ecf04[0x1]||_0x3943ea['composableAudience'];if(!_0x189714)return console['error'](a8_0x588110[_0x637467(0x13d)]('Usage:\x20tdx\x20cas\x20preview\x20<segment_name>\x20[--audience\x20<name>]')),0x1;if(!_0x40a3ff)return console[_0x637467(0xe1)](a8_0x588110[_0x637467(0xdf)](_0x637467(0x145))),console[_0x637467(0xe1)](_0x637467(0x121)+a8_0x588110[_0x637467(0xf8)](_0x637467(0xed))+_0x637467(0xe9)+a8_0x588110['cyan'](_0x637467(0xee))),0x1;const _0x3407e8=await withProgressSpinner(_0x637467(0xdc)+_0x189714+_0x637467(0x10b),()=>_0x109097['cas'][_0x637467(0xe3)](_0x40a3ff,_0x189714),{'verbose':_0x3943ea[_0x637467(0x137)]}),{query:_0x5d6386,customers:_0x137ba9}=_0x3407e8[_0x637467(0x146)];if(isStructuredFormat(_0x3943ea))return await handleSingleObjectOutput({'query':_0x5d6386,'customers':_0x137ba9},_0x3943ea),0x0;const _0x270c40=_0x5d6386[_0x637467(0x13b)]===_0x637467(0x117)?a8_0x588110[_0x637467(0x139)]:a8_0x588110[_0x637467(0xdf)];console['log'](_0x637467(0xd9)+_0x270c40(_0x5d6386[_0x637467(0x13b)])),console[_0x637467(0x13a)](_0x637467(0xd0)+a8_0x588110[_0x637467(0xff)](String(_0x5d6386[_0x637467(0xef)])));_0x5d6386[_0x637467(0xe1)]&&console[_0x637467(0x13a)](_0x637467(0x133)+a8_0x588110[_0x637467(0x13d)](_0x5d6386[_0x637467(0xe1)]));if(_0x137ba9?.['names']&&_0x137ba9?.[_0x637467(0x10a)]){console[_0x637467(0x13a)](a8_0x588110[_0x637467(0x102)](_0x637467(0x106)+_0x137ba9['rows'][_0x637467(0xd6)]+')'));const _0x301185=_0x137ba9[_0x637467(0x10a)][_0x637467(0xd2)](_0x39e819=>{const _0x12ae37=_0x637467,_0x3e977b={};for(let _0x357aa7=0x0;_0x357aa7<_0x137ba9[_0x12ae37(0xf4)][_0x12ae37(0xd6)];_0x357aa7++){_0x3e977b[_0x137ba9[_0x12ae37(0xf4)][_0x357aa7]]=_0x39e819[_0x357aa7];}return _0x3e977b;});await handleSDKOutput(_0x301185,_0x3943ea);}return 0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a9_0x4ab6(){const _0x26008c=['composableAudience','population','listSegments','red','Usage:\x20tdx\x20cas\x20sg\x20list\x20<audience_name>','cas:sg:list','8683080wOGdGF','log','Or\x20set\x20context:\x20tdx\x20use\x20cas\x20<audience_name>','4457827FNcmAv','List\x20composable\x20segments\x20for\x20an\x20audience','dim','2404ClRTdn','name','description','4119yyLtOO','green','129608kEXODT','4711nhmddz','execute','12wEXpBD','9297qevrxK','5LCtvoO','13XZBtTe','2512cTyBah','2311675oDsrUY','🎯\x20','\x27...','data','length','14940ABGjuy','error','cas'];a9_0x4ab6=function(){return _0x26008c;};return a9_0x4ab6();}const a9_0x3f3ed3=a9_0x5a70;(function(_0x239b94,_0x5025f7){const _0x5ca608=a9_0x5a70,_0x566585=_0x239b94();while(!![]){try{const _0x1717d1=-parseInt(_0x5ca608(0x18d))/0x1*(parseInt(_0x5ca608(0x188))/0x2)+-parseInt(_0x5ca608(0x186))/0x3*(parseInt(_0x5ca608(0x1a4))/0x4)+-parseInt(_0x5ca608(0x190))/0x5*(-parseInt(_0x5ca608(0x18b))/0x6)+parseInt(_0x5ca608(0x189))/0x7*(-parseInt(_0x5ca608(0x18f))/0x8)+parseInt(_0x5ca608(0x18c))/0x9*(parseInt(_0x5ca608(0x195))/0xa)+parseInt(_0x5ca608(0x1a1))/0xb+-parseInt(_0x5ca608(0x19e))/0xc*(parseInt(_0x5ca608(0x18e))/0xd);if(_0x1717d1===_0x5025f7)break;else _0x566585['push'](_0x566585['shift']());}catch(_0x2b9ff1){_0x566585['push'](_0x566585['shift']());}}}(a9_0x4ab6,0xc0a84));import{BaseCommand}from'./command.js';import{withProgressSpinner}from'../utils/spinner.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';function a9_0x5a70(_0x43cceb,_0x49215a){_0x43cceb=_0x43cceb-0x185;const _0x4ab604=a9_0x4ab6();let _0x5a700c=_0x4ab604[_0x43cceb];return _0x5a700c;}import{formatRows}from'../sdk/util/formatters.js';import a9_0xfbf8b2 from'chalk';export class CASSegmentListCommand extends BaseCommand{[a9_0x3f3ed3(0x1a5)]=a9_0x3f3ed3(0x19d);['description']=a9_0x3f3ed3(0x1a2);async[a9_0x3f3ed3(0x18a)](_0x4fb96a){const _0x7c28fa=a9_0x3f3ed3,{options:_0x3468ec,args:_0x222c91,tdx:_0xf7fef}=_0x4fb96a,_0x3b7c55=_0x222c91[0x0]||_0x3468ec[_0x7c28fa(0x198)];if(!_0x3b7c55)return console[_0x7c28fa(0x196)](a9_0xfbf8b2[_0x7c28fa(0x19b)](_0x7c28fa(0x19c))),console[_0x7c28fa(0x196)](a9_0xfbf8b2[_0x7c28fa(0x1a3)](_0x7c28fa(0x1a0))),0x1;const _0x559ce5=await withProgressSpinner('Fetching\x20segments\x20for\x20\x27'+_0x3b7c55+_0x7c28fa(0x192),()=>_0xf7fef[_0x7c28fa(0x197)][_0x7c28fa(0x19a)](_0x3b7c55),{'verbose':_0x3468ec['verbose']}),_0x11e0cd=_0x559ce5[_0x7c28fa(0x193)];if(isStructuredFormat(_0x3468ec))return await handleSDKOutput(_0x11e0cd,_0x3468ec),0x0;console[_0x7c28fa(0x19f)](a9_0xfbf8b2[_0x7c28fa(0x187)]('Found\x20'+_0x11e0cd[_0x7c28fa(0x194)]+'\x20segment'+(_0x11e0cd[_0x7c28fa(0x194)]!==0x1?'s':'')));if(_0x11e0cd[_0x7c28fa(0x194)]===0x0)return 0x0;for(const _0x430883 of _0x11e0cd){const _0x50ae00=_0x430883['population']!=null?a9_0xfbf8b2[_0x7c28fa(0x1a3)]('\x20('+formatRows(_0x430883[_0x7c28fa(0x199)])+')'):'';console[_0x7c28fa(0x19f)](_0x7c28fa(0x191)+_0x430883['name']+_0x50ae00),_0x430883['description']&&console[_0x7c28fa(0x19f)]('\x20\x20'+a9_0xfbf8b2[_0x7c28fa(0x1a3)](_0x430883[_0x7c28fa(0x185)]));}return 0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a10_0x37de99=a10_0x17d2;(function(_0x5bcf85,_0x45bb2c){const _0xb477b3=a10_0x17d2,_0x26417e=_0x5bcf85();while(!![]){try{const _0x1d07b1=-parseInt(_0xb477b3(0x90))/0x1*(-parseInt(_0xb477b3(0xbd))/0x2)+parseInt(_0xb477b3(0x88))/0x3*(parseInt(_0xb477b3(0xb6))/0x4)+parseInt(_0xb477b3(0xc0))/0x5*(-parseInt(_0xb477b3(0xb8))/0x6)+parseInt(_0xb477b3(0xcb))/0x7+-parseInt(_0xb477b3(0x8e))/0x8+parseInt(_0xb477b3(0x98))/0x9*(parseInt(_0xb477b3(0xa8))/0xa)+parseInt(_0xb477b3(0x9b))/0xb*(parseInt(_0xb477b3(0xa9))/0xc);if(_0x1d07b1===_0x45bb2c)break;else _0x26417e['push'](_0x26417e['shift']());}catch(_0x1585d3){_0x26417e['push'](_0x26417e['shift']());}}}(a10_0x361c,0xc944e));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';function a10_0x17d2(_0x5b0d12,_0x338cc3){_0x5b0d12=_0x5b0d12-0x87;const _0x361c14=a10_0x361c();let _0x17d29a=_0x361c14[_0x5b0d12];return _0x17d29a;}import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';import{getLLMConversationUrl}from'../sdk/client/endpoints.js';function handleSDKError(_0xdba940,_0x2d3d8a){const _0x22c047=a10_0x17d2;if(_0xdba940 instanceof SDKError)console['error'](_0x22c047(0xad)+_0xdba940[_0x22c047(0x9a)]),_0x2d3d8a[_0x22c047(0xa7)]&&(_0xdba940[_0x22c047(0xba)]&&console[_0x22c047(0xcf)]('\x20\x20Cause:\x20'+_0xdba940[_0x22c047(0xba)]),_0xdba940[_0x22c047(0x9d)]&&(console['error']('\x0aStack\x20trace:'),console[_0x22c047(0xcf)](_0xdba940['stack'])));else throw _0xdba940;}function a10_0x361c(){const _0xde9cb3=['214wArgGc','resolveAgentId','execute','850235XoabPm','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','404','resolveProjectId','tool_call','Chat\x20session:\x20','chat','Resolving\x20project\x20\x27','new','tool_result','tool','5418266vLyNCV','Getting\x20default\x20agent...','data','event','error','includes','Agent\x20required.\x20Use\x20--agent\x20\x22Project/Agent\x22\x20or\x20set\x20agent\x20with\x20\x22tdx\x20use\x20agent\x22','join','targetAgent','name','chatId','llm','29166INVpHV','description','\x27...','code','stream','chat-create','6549616lurzTa','content','11414YduprJ','--agent\x20flag','Create\x20a\x20new\x20chat\x20session','stringify','type','Continuing\x20chat:\x20','Error:\x20Cannot\x20use\x20--new\x20and\x20--chat-id\x20together','done','9yttszO','targetKnowledgeBase','message','22lqmRQg','llmAgent','stack','session\x20context','write','Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options','slice','string','args','agent','Using\x20cached\x20default\x20agent:\x20','functionName','verbose','67390TpklSd','3821484cwshUs','No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22','getOrCreateDefaultAgent','streamChatJsonl','Error:\x20','llmProject','log','validate','Resolving\x20agent\x20\x27','Using\x20agent\x20from\x20','metadata','\x27\x20not\x20found','Error:\x20Chat\x20session\x20\x27','80iQeEOr','targetFunction','42wUIQxf','projectId','cause','agentId','claude-4.5-haiku'];a10_0x361c=function(){return _0xde9cb3;};return a10_0x361c();}async function resolveAgentId(_0x3dec00,_0x3bf2fc,_0x2feec0,_0x810985,_0x421b18){const _0x20227a=a10_0x17d2,_0x794f32=_0x3bf2fc||_0x2feec0;if(_0x794f32){const {projectName:_0x2bbf1f,agentName:_0x562a0f}=parseAgentRef(_0x794f32),_0x18bba6=_0x562a0f||_0x794f32,_0x392918=_0x562a0f?_0x2bbf1f:_0x810985;if(!_0x392918)throw new Error(_0x20227a(0xaa));if(_0x421b18){const _0x256ecd=_0x3bf2fc?_0x20227a(0x91):_0x20227a(0x9e);console['error'](_0x20227a(0xb2)+_0x256ecd+':\x20'+_0x392918+'/'+_0x18bba6);}const _0x51da95=await withSpinner(_0x20227a(0xc7)+_0x392918+'\x27...',()=>_0x3dec00[_0x20227a(0x87)][_0x20227a(0xc3)](_0x392918),{'verbose':_0x421b18}),_0xd13209=await withSpinner(_0x20227a(0xb1)+_0x18bba6+_0x20227a(0x8a),()=>_0x3dec00[_0x20227a(0x87)][_0x20227a(0xbe)](_0x18bba6,_0x51da95[_0x20227a(0xcd)]),{'verbose':_0x421b18});return _0xd13209[_0x20227a(0xcd)];}else{const _0x129f22=_0x3dec00[_0x20227a(0x87)]['getDefaultAgent']();if(_0x129f22)return _0x421b18&&console[_0x20227a(0xcf)](_0x20227a(0xa5)+_0x129f22[_0x20227a(0xd4)]),_0x129f22['id'];const _0x1a12bc=await withSpinner(_0x20227a(0xcc),()=>_0x3dec00[_0x20227a(0x87)][_0x20227a(0xab)](_0x20227a(0xbc),0x0),{'verbose':_0x421b18});return _0x1a12bc['data']['id'];}}export class ChatCommand extends BaseCommand{[a10_0x37de99(0xd4)]='chat';[a10_0x37de99(0x89)]=a10_0x37de99(0xc1);['validate'](_0x10daf1){const _0x2456ee=a10_0x37de99,_0x2ecf46=_0x10daf1[_0x2456ee(0xa3)][_0x2456ee(0xd2)]('\x20');if(!_0x2ecf46)return _0x2456ee(0xa0);return undefined;}async['streamChat'](_0x4c442e,_0x501310,_0x1a7c84,_0x98bad9,_0x19dbf5){const _0x3a9027=a10_0x37de99;for await(const _0x5ed92b of _0x4c442e[_0x3a9027(0x87)][_0x3a9027(0xc6)](_0x501310,{'agentId':_0x1a7c84,'chatId':_0x98bad9})){if(_0x5ed92b['type']===_0x3a9027(0xb3)){const _0x485ff9=_0x5ed92b[_0x3a9027(0xcd)][_0x3a9027(0xd5)];saveLastChatId(_0x485ff9),_0x19dbf5&&console['error'](_0x3a9027(0xc5)+_0x485ff9);}else _0x5ed92b['type']==='event'&&this['handleChatEvent'](_0x5ed92b[_0x3a9027(0xcd)]);}}async['streamChatJsonl'](_0x41bd45,_0x1e8123,_0x3c774e,_0x1ed654){const _0x337bb6=a10_0x37de99,_0x4663b0=_0x41bd45['context']['site'];let _0x335960=![];for await(const _0x59e0ea of _0x41bd45[_0x337bb6(0x87)][_0x337bb6(0xc6)](_0x1e8123,{'agentId':_0x3c774e,'chatId':_0x1ed654})){if(_0x59e0ea[_0x337bb6(0x94)]==='metadata'){const _0x55392f=_0x59e0ea['data'];saveLastChatId(_0x55392f[_0x337bb6(0xd5)]);const _0x5d4179=_0x55392f['projectId']&&_0x55392f[_0x337bb6(0xbb)]?getLLMConversationUrl(_0x4663b0,_0x55392f[_0x337bb6(0xb9)],_0x55392f[_0x337bb6(0xbb)],_0x55392f[_0x337bb6(0xd5)]):undefined;console['log'](JSON['stringify']({'type':'metadata','data':{'chatId':_0x55392f[_0x337bb6(0xd5)],'agentId':_0x55392f[_0x337bb6(0xbb)],'consoleUrl':_0x5d4179}})),_0x335960=!![];}else{if(_0x59e0ea[_0x337bb6(0x94)]===_0x337bb6(0xce)){!_0x335960&&_0x1ed654&&(console[_0x337bb6(0xaf)](JSON['stringify']({'type':_0x337bb6(0xb3),'data':{'chatId':_0x1ed654}})),_0x335960=!![]);const _0x22a8b3=_0x59e0ea['data'];if(_0x337bb6(0x8f)in _0x22a8b3)console[_0x337bb6(0xaf)](JSON[_0x337bb6(0x93)]({'type':_0x337bb6(0x8f),'data':{'content':_0x22a8b3['content']}}));else{if(_0x337bb6(0xc4)in _0x22a8b3){const _0x2ff3c1=_0x22a8b3[_0x337bb6(0xc4)];console[_0x337bb6(0xaf)](JSON['stringify']({'type':_0x337bb6(0xc4),'data':{'id':_0x2ff3c1['id'],'name':_0x2ff3c1[_0x337bb6(0xa6)],'target':_0x2ff3c1[_0x337bb6(0x99)]?.[_0x337bb6(0xd4)]||_0x2ff3c1[_0x337bb6(0xd3)]?.[_0x337bb6(0xd4)]||_0x2ff3c1['targetWebSearchTool']?.[_0x337bb6(0xd4)]||_0x2ff3c1[_0x337bb6(0xb7)]}}));}else{if(_0x337bb6(0xca)in _0x22a8b3)console['log'](JSON[_0x337bb6(0x93)]({'type':_0x337bb6(0xc9),'data':{'id':_0x22a8b3[_0x337bb6(0xca)]['id'],'name':_0x22a8b3[_0x337bb6(0xca)][_0x337bb6(0xa6)],'result':typeof _0x22a8b3['tool'][_0x337bb6(0x8f)]===_0x337bb6(0xa2)?_0x22a8b3[_0x337bb6(0xca)]['content'][_0x337bb6(0xa1)](0x0,0x1f4):''}}));else _0x337bb6(0xcf)in _0x22a8b3&&console[_0x337bb6(0xaf)](JSON['stringify']({'type':'error','data':{'error':_0x22a8b3[_0x337bb6(0xcf)]}}));}}}}}console['log'](JSON[_0x337bb6(0x93)]({'type':_0x337bb6(0x97)}));}async[a10_0x37de99(0xbf)](_0x296185){const _0x412e56=a10_0x37de99,{options:_0xa184d,args:_0x2383d2,tdx:_0x4870b4}=_0x296185,_0x1feaae=_0x2383d2[_0x412e56(0xd2)]('\x20'),_0xf05e5c=_0xa184d,_0x308614=_0xf05e5c[_0x412e56(0xa4)],_0x47bb0c=_0xf05e5c['llmAgent'],_0x504523=_0xf05e5c[_0x412e56(0xae)],_0x39cdc7=_0xf05e5c[_0x412e56(0xc8)],_0x2a9341=_0xf05e5c['chatId'],_0x1f3c1b=_0xf05e5c[_0x412e56(0x8c)];if(_0x39cdc7&&_0x2a9341)return console[_0x412e56(0xcf)](_0x412e56(0x96)),0x1;try{let _0x23e3e4,_0x18b7e4;if(_0x2a9341)_0x18b7e4=_0x2a9341;else!_0x39cdc7&&(_0x18b7e4=loadLastChatId(),_0x18b7e4&&_0xa184d[_0x412e56(0xa7)]&&console[_0x412e56(0xcf)](_0x412e56(0x95)+_0x18b7e4));!_0x2a9341&&(_0x39cdc7||!_0x18b7e4)&&(_0x23e3e4=await resolveAgentId(_0x4870b4,_0x308614,_0x47bb0c,_0x504523,_0xa184d[_0x412e56(0xa7)]));const _0x377849=_0x1f3c1b?(_0x363d2f,_0x71dc6a,_0x304fef)=>this[_0x412e56(0xac)](_0x4870b4,_0x363d2f,_0x71dc6a,_0x304fef):(_0x4041f8,_0xb33e41,_0x1cc0c5)=>this['streamChat'](_0x4870b4,_0x4041f8,_0xb33e41,_0x1cc0c5,_0xa184d[_0x412e56(0xa7)]);try{await _0x377849(_0x1feaae,_0x23e3e4,_0x18b7e4);}catch(_0x5c7777){const _0x416dc9=_0x5c7777 instanceof SDKError&&_0x5c7777[_0x412e56(0x8b)]===ErrorCode['CHAT_NOT_FOUND']||_0x5c7777 instanceof Error&&_0x5c7777[_0x412e56(0x9a)][_0x412e56(0xd0)](_0x412e56(0xc2));if(_0x416dc9&&_0x2a9341)return console['error'](_0x412e56(0xb5)+_0x2a9341+_0x412e56(0xb4)),0x1;if(_0x416dc9)_0xa184d[_0x412e56(0xa7)]&&console[_0x412e56(0xcf)]('Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...'),!_0x23e3e4&&(_0x23e3e4=await resolveAgentId(_0x4870b4,_0x308614,_0x47bb0c,_0x504523,_0xa184d[_0x412e56(0xa7)])),await _0x377849(_0x1feaae,_0x23e3e4,undefined);else throw _0x5c7777;}return!_0x1f3c1b&&console[_0x412e56(0xaf)](),0x0;}catch(_0x45fe19){return console[_0x412e56(0xcf)](),handleSDKError(_0x45fe19,_0xa184d),0x1;}}['handleChatEvent'](_0x591f87){const _0x1ba4c=a10_0x37de99;if(_0x1ba4c(0x8f)in _0x591f87)process['stdout'][_0x1ba4c(0x9f)](_0x591f87[_0x1ba4c(0x8f)]);else _0x1ba4c(0xcf)in _0x591f87&&console[_0x1ba4c(0xcf)]('\x0aError:\x20'+_0x591f87['error']);}}export class ChatCreateCommand extends BaseCommand{[a10_0x37de99(0xd4)]=a10_0x37de99(0x8d);[a10_0x37de99(0x89)]=a10_0x37de99(0x92);[a10_0x37de99(0xb0)](_0x11a593){const _0xe3ed33=a10_0x37de99,_0x1715d2=_0x11a593['options'],_0x3688e4=_0x1715d2[_0xe3ed33(0xa4)],_0x2fbf13=_0x1715d2[_0xe3ed33(0x9c)];if(!_0x3688e4&&!_0x2fbf13)return _0xe3ed33(0xd1);return undefined;}async[a10_0x37de99(0xbf)](_0x5c509d){const _0x468b61=a10_0x37de99,{options:_0x2b71e1,tdx:_0xfca44}=_0x5c509d,_0x4abf51=_0x2b71e1,_0x45b853=_0x4abf51[_0x468b61(0xa4)],_0x3ced12=_0x4abf51['llmAgent'],_0x27593d=_0x4abf51[_0x468b61(0xae)];try{const _0x14af12=await resolveAgentId(_0xfca44,_0x45b853,_0x3ced12,_0x27593d,_0x2b71e1[_0x468b61(0xa7)]),_0x2178e5=await _0xfca44[_0x468b61(0x87)]['startChat'](_0x14af12);return saveLastChatId(_0x2178e5['id']),console[_0x468b61(0xaf)](JSON[_0x468b61(0x93)]({'chatId':_0x2178e5['id'],'agentId':_0x14af12})),0x0;}catch(_0x30d216){return handleSDKError(_0x30d216,_0x2b71e1),0x1;}}}
|
|
1
|
+
const a10_0x31b9b1=a10_0x1196;(function(_0x245cb9,_0x2d7a0f){const _0x5617e3=a10_0x1196,_0xd085b7=_0x245cb9();while(!![]){try{const _0x2db7b5=-parseInt(_0x5617e3(0x198))/0x1+parseInt(_0x5617e3(0x172))/0x2*(parseInt(_0x5617e3(0x16f))/0x3)+-parseInt(_0x5617e3(0x18a))/0x4+parseInt(_0x5617e3(0x164))/0x5+-parseInt(_0x5617e3(0x160))/0x6*(parseInt(_0x5617e3(0x17a))/0x7)+parseInt(_0x5617e3(0x199))/0x8*(parseInt(_0x5617e3(0x169))/0x9)+-parseInt(_0x5617e3(0x161))/0xa*(-parseInt(_0x5617e3(0x1a2))/0xb);if(_0x2db7b5===_0x2d7a0f)break;else _0xd085b7['push'](_0xd085b7['shift']());}catch(_0x45ed3b){_0xd085b7['push'](_0xd085b7['shift']());}}}(a10_0xca7f,0x46e14));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{withSpinner}from'../utils/spinner.js';import{parseAgentRef}from'../sdk/agent/agent-ref-parser.js';import{saveLastChatId,loadLastChatId}from'../sdk/llm/chat-cache.js';import{getLLMConversationUrl}from'../sdk/client/endpoints.js';function handleSDKError(_0x6750ac,_0xd48a56){const _0x532330=a10_0x1196;if(_0x6750ac instanceof SDKError)console['error'](_0x532330(0x170)+_0x6750ac['message']),_0xd48a56[_0x532330(0x15f)]&&(_0x6750ac[_0x532330(0x185)]&&console[_0x532330(0x183)](_0x532330(0x162)+_0x6750ac[_0x532330(0x185)]),_0x6750ac[_0x532330(0x176)]&&(console[_0x532330(0x183)]('\x0aStack\x20trace:'),console['error'](_0x6750ac['stack'])));else throw _0x6750ac;}async function resolveAgentId(_0xbe83f,_0x51f7fd,_0x51ee20,_0x4c7b82,_0x5d0b2b){const _0x3ce026=a10_0x1196,_0xa5f119=_0x51f7fd||_0x51ee20;if(_0xa5f119){const {projectName:_0x3dab88,agentName:_0x3acc7f}=parseAgentRef(_0xa5f119),_0x455160=_0x3acc7f||_0xa5f119,_0x331c0c=_0x3acc7f?_0x3dab88:_0x4c7b82;if(!_0x331c0c)throw new Error('No\x20project\x20specified.\x20Use\x20\x22Project/Agent\x22\x20format\x20or\x20set\x20project\x20with\x20\x22tdx\x20use\x20llm_project\x22');if(_0x5d0b2b){const _0x462de7=_0x51f7fd?_0x3ce026(0x195):'session\x20context';console['error'](_0x3ce026(0x17b)+_0x462de7+':\x20'+_0x331c0c+'/'+_0x455160);}const _0x22ae9d=await withSpinner('Resolving\x20project\x20\x27'+_0x331c0c+_0x3ce026(0x1a7),()=>_0xbe83f[_0x3ce026(0x15e)]['resolveProjectId'](_0x331c0c),{'verbose':_0x5d0b2b}),_0x575386=await withSpinner(_0x3ce026(0x1a4)+_0x455160+_0x3ce026(0x1a7),()=>_0xbe83f[_0x3ce026(0x15e)][_0x3ce026(0x173)](_0x455160,_0x22ae9d[_0x3ce026(0x181)]),{'verbose':_0x5d0b2b});return _0x575386['data'];}else{const _0x2b0e3b=_0xbe83f['llm'][_0x3ce026(0x178)]();if(_0x2b0e3b)return _0x5d0b2b&&console['error']('Using\x20cached\x20default\x20agent:\x20'+_0x2b0e3b[_0x3ce026(0x17d)]),_0x2b0e3b['id'];const _0x29dd8a=await withSpinner(_0x3ce026(0x193),()=>_0xbe83f[_0x3ce026(0x15e)][_0x3ce026(0x1a0)](_0x3ce026(0x19e),0x0),{'verbose':_0x5d0b2b});return _0x29dd8a[_0x3ce026(0x181)]['id'];}}function a10_0xca7f(){const _0xb02e0=['name','chatId','\x0aError:\x20','type','data','includes','error','event','cause','stdout','handleChatEvent','execute','chat','1350856AEYBPZ','validate','Create\x20a\x20new\x20chat\x20session','agentId','streamChatJsonl','projectId','code','tool','join','Getting\x20default\x20agent...','stream','--agent\x20flag','targetAgent','Chat\x20session\x20not\x20found,\x20starting\x20new\x20chat...','248989rownBL','449008LIHTTA','Chat\x20with\x20an\x20LLM\x20agent\x20(simplified)','agent','done','content','claude-4.5-haiku','slice','getOrCreateDefaultAgent','functionName','1177lAyACr','llmAgent','Resolving\x20agent\x20\x27','context','Error:\x20Chat\x20session\x20\x27','\x27...','chat-create','llm','verbose','6ZQHOFI','52330FLrexn','\x20\x20Cause:\x20','streamChat','2019090mVFkVy','log','Agent\x20required.\x20Use\x20--agent\x20\x22Project/Agent\x22\x20or\x20set\x20agent\x20with\x20\x22tdx\x20use\x20agent\x22','CHAT_NOT_FOUND','new','45xrIlwA','write','description','Continuing\x20chat:\x20','tool_call','options','9657ffWWnO','Error:\x20','stringify','14NxqgRi','resolveAgentId','targetFunction','startChat','stack','string','getDefaultAgent','metadata','2729195HapNOG','Using\x20agent\x20from\x20','targetWebSearchTool'];a10_0xca7f=function(){return _0xb02e0;};return a10_0xca7f();}export class ChatCommand extends BaseCommand{['name']=a10_0x31b9b1(0x189);['description']=a10_0x31b9b1(0x19a);[a10_0x31b9b1(0x18b)](_0x3cf17c){const _0x499f9e=a10_0x31b9b1,_0x50dd57=_0x3cf17c['args'][_0x499f9e(0x192)]('\x20');if(!_0x50dd57)return'Usage:\x20tdx\x20chat\x20\x22your\x20message\x22\x0a\x0aRun\x20\x27tdx\x20chat\x20--help\x27\x20for\x20more\x20options';return undefined;}async[a10_0x31b9b1(0x163)](_0x1d8f82,_0x3c4df7,_0x23573f,_0x4b293c,_0x374a0a){const _0x411a60=a10_0x31b9b1;for await(const _0x2517e5 of _0x1d8f82[_0x411a60(0x15e)][_0x411a60(0x189)](_0x3c4df7,{'agentId':_0x23573f,'chatId':_0x4b293c})){if(_0x2517e5[_0x411a60(0x180)]===_0x411a60(0x179)){const _0x5c291=_0x2517e5[_0x411a60(0x181)][_0x411a60(0x17e)];saveLastChatId(_0x5c291),_0x374a0a&&console['error']('Chat\x20session:\x20'+_0x5c291);}else _0x2517e5[_0x411a60(0x180)]===_0x411a60(0x184)&&this[_0x411a60(0x187)](_0x2517e5['data']);}}async[a10_0x31b9b1(0x18e)](_0xd6a525,_0x50e4fc,_0x111bee,_0x44edbd){const _0x471b63=a10_0x31b9b1,_0x225374=_0xd6a525[_0x471b63(0x1a5)]['site'];let _0x4f703f=![];for await(const _0x5515b7 of _0xd6a525['llm'][_0x471b63(0x189)](_0x50e4fc,{'agentId':_0x111bee,'chatId':_0x44edbd})){if(_0x5515b7['type']===_0x471b63(0x179)){const _0x2d18ef=_0x5515b7[_0x471b63(0x181)];saveLastChatId(_0x2d18ef[_0x471b63(0x17e)]);const _0x17e33b=_0x2d18ef[_0x471b63(0x18f)]&&_0x2d18ef[_0x471b63(0x18d)]?getLLMConversationUrl(_0x225374,_0x2d18ef[_0x471b63(0x18f)],_0x2d18ef[_0x471b63(0x18d)],_0x2d18ef[_0x471b63(0x17e)]):undefined;console[_0x471b63(0x165)](JSON[_0x471b63(0x171)]({'type':_0x471b63(0x179),'data':{'chatId':_0x2d18ef[_0x471b63(0x17e)],'agentId':_0x2d18ef[_0x471b63(0x18d)],'consoleUrl':_0x17e33b}})),_0x4f703f=!![];}else{if(_0x5515b7[_0x471b63(0x180)]===_0x471b63(0x184)){!_0x4f703f&&_0x44edbd&&(console[_0x471b63(0x165)](JSON[_0x471b63(0x171)]({'type':_0x471b63(0x179),'data':{'chatId':_0x44edbd}})),_0x4f703f=!![]);const _0x3c27cd=_0x5515b7['data'];if(_0x471b63(0x19d)in _0x3c27cd)console['log'](JSON[_0x471b63(0x171)]({'type':_0x471b63(0x19d),'data':{'content':_0x3c27cd[_0x471b63(0x19d)]}}));else{if(_0x471b63(0x16d)in _0x3c27cd){const _0x1abc41=_0x3c27cd[_0x471b63(0x16d)];console['log'](JSON[_0x471b63(0x171)]({'type':_0x471b63(0x16d),'data':{'id':_0x1abc41['id'],'name':_0x1abc41[_0x471b63(0x1a1)],'target':_0x1abc41['targetKnowledgeBase']?.[_0x471b63(0x17d)]||_0x1abc41[_0x471b63(0x196)]?.['name']||_0x1abc41[_0x471b63(0x17c)]?.[_0x471b63(0x17d)]||_0x1abc41[_0x471b63(0x174)]}}));}else{if(_0x471b63(0x191)in _0x3c27cd)console[_0x471b63(0x165)](JSON[_0x471b63(0x171)]({'type':'tool_result','data':{'id':_0x3c27cd[_0x471b63(0x191)]['id'],'name':_0x3c27cd[_0x471b63(0x191)][_0x471b63(0x1a1)],'result':typeof _0x3c27cd[_0x471b63(0x191)][_0x471b63(0x19d)]===_0x471b63(0x177)?_0x3c27cd[_0x471b63(0x191)][_0x471b63(0x19d)][_0x471b63(0x19f)](0x0,0x1f4):''}}));else _0x471b63(0x183)in _0x3c27cd&&console['log'](JSON[_0x471b63(0x171)]({'type':_0x471b63(0x183),'data':{'error':_0x3c27cd[_0x471b63(0x183)]}}));}}}}}console[_0x471b63(0x165)](JSON[_0x471b63(0x171)]({'type':_0x471b63(0x19c)}));}async['execute'](_0x5757c7){const _0x14a2b0=a10_0x31b9b1,{options:_0x2408c1,args:_0x13e9b8,tdx:_0x35ff08}=_0x5757c7,_0x59ead3=_0x13e9b8[_0x14a2b0(0x192)]('\x20'),_0x34e00b=_0x2408c1,_0x5c0ac6=_0x34e00b['agent'],_0x1c595e=_0x34e00b[_0x14a2b0(0x1a3)],_0x5dd908=_0x34e00b['llmProject'],_0x2a88ec=_0x34e00b[_0x14a2b0(0x168)],_0x2cd54e=_0x34e00b[_0x14a2b0(0x17e)],_0x860d9c=_0x34e00b[_0x14a2b0(0x194)];if(_0x2a88ec&&_0x2cd54e)return console[_0x14a2b0(0x183)]('Error:\x20Cannot\x20use\x20--new\x20and\x20--chat-id\x20together'),0x1;try{let _0x3fb5fe,_0x280b5e;if(_0x2cd54e)_0x280b5e=_0x2cd54e;else!_0x2a88ec&&(_0x280b5e=loadLastChatId(),_0x280b5e&&_0x2408c1[_0x14a2b0(0x15f)]&&console['error'](_0x14a2b0(0x16c)+_0x280b5e));!_0x2cd54e&&(_0x2a88ec||!_0x280b5e)&&(_0x3fb5fe=await resolveAgentId(_0x35ff08,_0x5c0ac6,_0x1c595e,_0x5dd908,_0x2408c1[_0x14a2b0(0x15f)]));const _0x27499a=_0x860d9c?(_0x3ab702,_0x380c08,_0x3d79ab)=>this[_0x14a2b0(0x18e)](_0x35ff08,_0x3ab702,_0x380c08,_0x3d79ab):(_0x105108,_0x201d57,_0x47ef10)=>this['streamChat'](_0x35ff08,_0x105108,_0x201d57,_0x47ef10,_0x2408c1['verbose']);try{await _0x27499a(_0x59ead3,_0x3fb5fe,_0x280b5e);}catch(_0x57f181){const _0x15d4e6=_0x57f181 instanceof SDKError&&_0x57f181[_0x14a2b0(0x190)]===ErrorCode[_0x14a2b0(0x167)]||_0x57f181 instanceof Error&&_0x57f181['message'][_0x14a2b0(0x182)]('404');if(_0x15d4e6&&_0x2cd54e)return console['error'](_0x14a2b0(0x1a6)+_0x2cd54e+'\x27\x20not\x20found'),0x1;if(_0x15d4e6)_0x2408c1['verbose']&&console[_0x14a2b0(0x183)](_0x14a2b0(0x197)),!_0x3fb5fe&&(_0x3fb5fe=await resolveAgentId(_0x35ff08,_0x5c0ac6,_0x1c595e,_0x5dd908,_0x2408c1[_0x14a2b0(0x15f)])),await _0x27499a(_0x59ead3,_0x3fb5fe,undefined);else throw _0x57f181;}return!_0x860d9c&&console[_0x14a2b0(0x165)](),0x0;}catch(_0x4e0f23){return console[_0x14a2b0(0x183)](),handleSDKError(_0x4e0f23,_0x2408c1),0x1;}}[a10_0x31b9b1(0x187)](_0x4461c1){const _0x586d32=a10_0x31b9b1;if('content'in _0x4461c1)process[_0x586d32(0x186)][_0x586d32(0x16a)](_0x4461c1[_0x586d32(0x19d)]);else _0x586d32(0x183)in _0x4461c1&&console[_0x586d32(0x183)](_0x586d32(0x17f)+_0x4461c1[_0x586d32(0x183)]);}}function a10_0x1196(_0x1378cd,_0x4a5bb3){_0x1378cd=_0x1378cd-0x15e;const _0xca7f2d=a10_0xca7f();let _0x1196d6=_0xca7f2d[_0x1378cd];return _0x1196d6;}export class ChatCreateCommand extends BaseCommand{['name']=a10_0x31b9b1(0x1a8);[a10_0x31b9b1(0x16b)]=a10_0x31b9b1(0x18c);[a10_0x31b9b1(0x18b)](_0x1dd806){const _0xa4dd3e=a10_0x31b9b1,_0x132e4f=_0x1dd806[_0xa4dd3e(0x16e)],_0x29287a=_0x132e4f[_0xa4dd3e(0x19b)],_0x4b673d=_0x132e4f[_0xa4dd3e(0x1a3)];if(!_0x29287a&&!_0x4b673d)return _0xa4dd3e(0x166);return undefined;}async[a10_0x31b9b1(0x188)](_0x15dfc7){const _0x52d6fe=a10_0x31b9b1,{options:_0x16e0b4,tdx:_0x2128d2}=_0x15dfc7,_0x1eaf6d=_0x16e0b4,_0x2c3c46=_0x1eaf6d[_0x52d6fe(0x19b)],_0x1f900a=_0x1eaf6d[_0x52d6fe(0x1a3)],_0x8b6419=_0x1eaf6d['llmProject'];try{const _0x21a3e4=await resolveAgentId(_0x2128d2,_0x2c3c46,_0x1f900a,_0x8b6419,_0x16e0b4[_0x52d6fe(0x15f)]),_0x1b3ff9=await _0x2128d2[_0x52d6fe(0x15e)][_0x52d6fe(0x175)](_0x21a3e4);return saveLastChatId(_0x1b3ff9['id']),console[_0x52d6fe(0x165)](JSON['stringify']({'chatId':_0x1b3ff9['id'],'agentId':_0x21a3e4})),0x0;}catch(_0xe98ea1){return handleSDKError(_0xe98ea1,_0x16e0b4),0x1;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a11_0x47d108=a11_0x297a;(function(_0x1928ff,_0x2c3cf8){const _0x3d30af=a11_0x297a,_0x51bfc4=_0x1928ff();while(!![]){try{const _0x5a1f32=parseInt(_0x3d30af(0x214))/0x1*(parseInt(_0x3d30af(0x1f8))/0x2)+-parseInt(_0x3d30af(0x218))/0x3+-parseInt(_0x3d30af(0x1ee))/0x4+parseInt(_0x3d30af(0x1fd))/0x5*(-parseInt(_0x3d30af(0x230))/0x6)+parseInt(_0x3d30af(0x257))/0x7+parseInt(_0x3d30af(0x22e))/0x8*(parseInt(_0x3d30af(0x1cf))/0x9)+parseInt(_0x3d30af(0x232))/0xa*(parseInt(_0x3d30af(0x1d5))/0xb);if(_0x5a1f32===_0x2c3cf8)break;else _0x51bfc4['push'](_0x51bfc4['shift']());}catch(_0x1fa313){_0x51bfc4['push'](_0x51bfc4['shift']());}}}(a11_0x27cb,0x50fc5));import{readFile,writeFile,mkdir,unlink}from'node:fs/promises';import{execFile}from'node:child_process';import{existsSync}from'node:fs';import{homedir}from'node:os';import{join}from'node:path';import{promisify}from'node:util';import a11_0x1f52ba from'chalk';import{BaseCommand}from'./command.js';import{PassThroughProxyServer}from'../proxy/passthrough-server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{getEndpoint,getConsoleUrl}from'../sdk/client/endpoints.js';import{getOAuthTokens}from'../core/oauth-keychain.js';import{findExecutable,crossSpawn}from'../utils/process.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo,loadReleaseChannel}from'../core/config.js';import{resolveReleaseTag}from'../utils/github-releases.js';const execFileAsync=promisify(execFile),MIN_CLAUDE_VERSION=a11_0x47d108(0x1c7),SETTINGS_BACKUP_FILENAME='.tdx-settings-backup.json';function isProcessRunning(_0x5a072e){const _0x459307=a11_0x47d108;try{return process[_0x459307(0x25a)](_0x5a072e,0x0),!![];}catch{return![];}}async function applyOriginalSettings(_0x47d2b5,_0x3dc9a0){const _0x2a786b=a11_0x47d108;if(!existsSync(_0x47d2b5))return;try{const _0x1058cc=await readFile(_0x47d2b5,_0x2a786b(0x1f2)),_0x1bae35=JSON[_0x2a786b(0x1e4)](_0x1058cc),_0x5497b9=_0x1bae35[_0x2a786b(0x247)]||{};for(const _0x170108 of['ANTHROPIC_BASE_URL',_0x2a786b(0x1cc),_0x2a786b(0x1e0),_0x2a786b(0x222),_0x2a786b(0x239)]){_0x3dc9a0[_0x170108]!==undefined?_0x5497b9[_0x170108]=_0x3dc9a0[_0x170108]:delete _0x5497b9[_0x170108];}_0x3dc9a0[_0x2a786b(0x24e)]!==undefined?_0x1bae35['statusLine']=_0x3dc9a0[_0x2a786b(0x24e)]:delete _0x1bae35[_0x2a786b(0x24e)],_0x1bae35['env']=_0x5497b9,await writeFile(_0x47d2b5,JSON[_0x2a786b(0x1c4)](_0x1bae35,null,0x2)+'\x0a');}catch{}}async function safeUnlink(_0x17cbc1){try{await unlink(_0x17cbc1);}catch{}}async function recoverFromStaleBackup(_0x36c79d,_0x38f319){const _0x3a2cc6=a11_0x47d108;if(!existsSync(_0x38f319))return undefined;try{const _0x3f81d9=await readFile(_0x38f319,'utf-8'),_0x559dc6=JSON[_0x3a2cc6(0x1e4)](_0x3f81d9);if(isProcessRunning(_0x559dc6[_0x3a2cc6(0x1f3)]))return{'liveSessionOriginals':_0x559dc6[_0x3a2cc6(0x1ff)]};return await applyOriginalSettings(_0x36c79d,_0x559dc6[_0x3a2cc6(0x1ff)]),await safeUnlink(_0x38f319),undefined;}catch{return await safeUnlink(_0x38f319),undefined;}}function handleInstallationError(_0x4d3f24,_0x4110d2,_0x35cd25,_0x1c2d74){const _0x587190=a11_0x47d108;errorContains(_0x4d3f24,_0x587190(0x20d),_0x587190(0x220),_0x587190(0x235))?(_0x35cd25[_0x587190(0x22d)]='✓\x20'+_0x4110d2+'\x20already\x20configured',_0x1c2d74?.[_0x587190(0x20c)](_0x4110d2+_0x587190(0x204)),_0x4d3f24 instanceof SDKError&&_0x4d3f24[_0x587190(0x22f)]&&_0x1c2d74?.[_0x587190(0x266)]('Command\x20output:\x20'+_0x4d3f24['cause'][_0x587190(0x24c)])):(_0x35cd25['warn'](_0x587190(0x1f1)+_0x4110d2),_0x1c2d74?.[_0x587190(0x1dd)](_0x4110d2+'\x20configuration\x20failed',_0x4d3f24));}export function parseVersion(_0x2cf6b4){const _0x4f9593=a11_0x47d108,_0x5f4d25=_0x2cf6b4[_0x4f9593(0x1da)]()['match'](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x5f4d25)return null;return{'major':parseInt(_0x5f4d25[0x1],0xa),'minor':parseInt(_0x5f4d25[0x2],0xa),'patch':parseInt(_0x5f4d25[0x3],0xa)};}export function compareVersions(_0x82bf68,_0x152519){const _0x14c0ef=a11_0x47d108;if(_0x82bf68[_0x14c0ef(0x21f)]!==_0x152519[_0x14c0ef(0x21f)])return _0x82bf68[_0x14c0ef(0x21f)]-_0x152519[_0x14c0ef(0x21f)];if(_0x82bf68[_0x14c0ef(0x1f5)]!==_0x152519['minor'])return _0x82bf68['minor']-_0x152519[_0x14c0ef(0x1f5)];return _0x82bf68['patch']-_0x152519[_0x14c0ef(0x22b)];}function a11_0x27cb(){const _0x221056=['apiKey','Restored\x20default\x20td-skills\x20marketplace','kill','apikey','logger','Creating\x20.claude/settings.local.json...','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped','expires_at','close','join','workflow-skills','update','add','Failed\x20to\x20update\x20marketplace\x20\x27','debug','resume','Configuring\x20MCP\x20server\x20\x27','✓\x20Logs\x20saved\x20to\x20','✓\x20Settings\x20configured:\x20.claude/settings.local.json','Claude\x20Code\x20version\x20','port','fetch','marketplace','stringify','Checking\x20out\x20td-skills\x20','\x27...','2.0.20','tdx\x20--profile\x20','continue','✓\x20Logging\x20to\x20','settings.local.json','ANTHROPIC_MODEL','td-skills\x20checked\x20out\x20at\x20tag\x20','Initializing...','513mrCmtQ','includes','plugin','Installing\x20plugin\x20\x27','install','oauth','44hLeLRI','inherit','site','http','init','trim','Setup\x20failed','sql-skills','error','checkout','...','ANTHROPIC_AUTH_TOKEN','td-skills','Failed\x20to\x20install\x20plugin\x20\x27','Command\x20spawn\x20error:\x20','parse','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20','red','--hard','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','INSTALLATION_FAILED','Checking\x20Claude\x20Code\x20version...','refresh_token','log','✓\x20MCP\x20server\x20\x27','2366520LlpFeD','✓\x20Claude\x20Code\x20version\x20OK','code','Warning:\x20Failed\x20to\x20configure\x20','utf-8','pid','\x27\x20configured','minor','claude','INVALID_ARGUMENT','2daEhdb','list','✓\x20Marketplace\x20\x27','td-docs','Authentication\x20required\x20for\x20TD\x20LLM\x20Proxy.\x20Run:\x20tdx\x20auth\x20setup','110OPLHSJ','tdx-skills','originalSettings','description','marketplaces','context','✓\x20Plugin\x20\x27','\x20already\x20configured','Claude\x20Code\x20version\x20check\x20failed','TD\x20Docs\x20MCP\x20Server','\x27\x20installed','td-skills\x20Plugins','toISOString','http://127.0.0.1:','Configuring\x20marketplace\x20\x27','info','already\x20exists','profile','\x20meets\x20minimum\x20requirement','plugins','access_token','warn','Claude\x20Code\x20CLI\x20not\x20found','233593buYFTZ','getCurrent','--version','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','1686855povqLa','verbose','cwd','data','toString','stop','Updating\x20marketplace\x20\x27','major','already\x20installed','\x20→\x20','CLAUDE_CODE_USE_BEDROCK','command','Failed\x20to\x20list\x20marketplaces','.claude','git','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','passThroughServer','getLogPath','treasure-data','patch','logLevel','text','2648fMHuSX','cause','46014bdENVX','\x27\x20updated','3189020NuWbIR','Failed\x20to\x20remove\x20marketplace\x20\x27','fail','already\x20configured','\x20claude\x20statusline','Failed\x20to\x20launch\x20Claude\x20Code:\x20','✓\x20td-skills\x20checked\x20out\x20at\x20','CLAUDE_CODE_USE_VERTEX','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','stderr','ENOENT','stdout','--force','green','CLAUDE_CODE_NOT_FOUND','Marketplace\x20\x27','origin','Initializing\x20proxy\x20logger...','):\x20claude\x20','ANTHROPIC_BASE_URL','--tags','env','exit','unshift','false','main','message','\x27:\x20','statusLine','tdx-cli','tdx\x20claude\x20statusline','start','✓\x20Settings\x20restored:\x20.claude/settings.local.json','llm-proxy','account_id','\x27\x20not\x20found\x20in\x20list,\x20skipping\x20removal','tdx-managed-proxy','883974xZhNuz'];a11_0x27cb=function(){return _0x221056;};return a11_0x27cb();}async function checkClaudeVersion(_0x5a26a8,_0x9aca08){const _0x479496=a11_0x47d108;_0x9aca08?.[_0x479496(0x266)]('Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20'+_0x5a26a8+')');const _0x7728c4=await executeClaudeCommand([_0x479496(0x216)],undefined,_0x9aca08),_0x392f50=parseVersion(_0x7728c4);if(!_0x392f50){_0x9aca08?.['warn'](_0x479496(0x227)+_0x7728c4);return;}const _0x4503e3=_0x392f50['major']+'.'+_0x392f50[_0x479496(0x1f5)]+'.'+_0x392f50[_0x479496(0x22b)],_0x18871f=parseVersion(_0x5a26a8);if(!_0x18871f){_0x9aca08?.['warn']('Invalid\x20minimum\x20version\x20format:\x20'+_0x5a26a8);return;}if(compareVersions(_0x392f50,_0x18871f)<0x0){_0x9aca08?.[_0x479496(0x1dd)](_0x479496(0x26b)+_0x4503e3+'\x20is\x20too\x20old\x20(minimum:\x20'+_0x5a26a8+')');throw new SDKError(ErrorCode['CLAUDE_CODE_UNSUPPORTED_VERSION'],'Claude\x20Code\x20version\x20'+_0x4503e3+'\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20'+_0x5a26a8+'\x20or\x20later.',undefined,{'helpText':_0x479496(0x217)});}_0x9aca08?.[_0x479496(0x266)]('Claude\x20Code\x20version\x20'+_0x4503e3+_0x479496(0x20f));}async function executeClaudeCommand(_0x1aa5b0,_0x27d81c,_0x1979e3){const _0x2f64a0=a11_0x47d108;return _0x1979e3?.[_0x2f64a0(0x20c)]('Executing:\x20claude\x20'+_0x1aa5b0[_0x2f64a0(0x261)]('\x20')),new Promise((_0x18305b,_0x3bfdb8)=>{const _0x32405d=_0x2f64a0,_0x5e527f=crossSpawn(_0x32405d(0x1f6),_0x1aa5b0,{'stdio':'pipe'});let _0x59a526='',_0x4df8a9='';_0x5e527f[_0x32405d(0x23d)]?.['on'](_0x32405d(0x21b),_0x494940=>{const _0x526957=_0x32405d;_0x59a526+=_0x494940[_0x526957(0x21c)]();}),_0x5e527f[_0x32405d(0x23b)]?.['on']('data',_0x237cef=>{const _0x542aab=_0x32405d;_0x4df8a9+=_0x237cef[_0x542aab(0x21c)]();}),_0x5e527f['on']('error',_0x4080f2=>{const _0x43d9d1=_0x32405d;_0x4080f2[_0x43d9d1(0x1f0)]===_0x43d9d1(0x23c)?(_0x1979e3?.['error']('Claude\x20Code\x20CLI\x20not\x20found'),_0x3bfdb8(new SDKError(ErrorCode[_0x43d9d1(0x240)],_0x43d9d1(0x213),_0x4080f2,{'helpText':_0x43d9d1(0x23a)}))):(_0x1979e3?.[_0x43d9d1(0x1dd)](_0x43d9d1(0x1e3)+_0x4080f2[_0x43d9d1(0x24c)]),_0x3bfdb8(new SDKError(ErrorCode['INTERNAL'],'Failed\x20to\x20spawn\x20claude\x20command:\x20'+_0x4080f2[_0x43d9d1(0x24c)],_0x4080f2)));}),_0x5e527f['on'](_0x32405d(0x248),_0x47642a=>{const _0x2378dd=_0x32405d;if(_0x47642a===0x0)_0x18305b(_0x59a526);else _0x27d81c?(_0x1979e3?.['error']('Command\x20failed\x20(exit\x20'+_0x47642a+_0x2378dd(0x244)+_0x1aa5b0[_0x2378dd(0x261)]('\x20')),_0x3bfdb8(new SDKError(ErrorCode[_0x2378dd(0x1e9)],_0x27d81c,new Error(_0x4df8a9)))):_0x18305b('');});});}async function ensureMcpServer(_0xd382b7,_0x4cfbb3,_0xbb796c,_0x14a372,_0x1cddf1){const _0x20179e=a11_0x47d108;_0x14a372[_0x20179e(0x22d)]=_0x20179e(0x268)+_0xd382b7+_0x20179e(0x1c6),await executeClaudeCommand(['mcp','add',_0xd382b7,_0x4cfbb3,'--transport',_0xbb796c],'Failed\x20to\x20configure\x20MCP\x20server\x20\x27'+_0xd382b7+'\x27',_0x1cddf1),_0x14a372[_0x20179e(0x22d)]=_0x20179e(0x1ed)+_0xd382b7+'\x27\x20configured';}export const DEFAULT_TD_SKILLS_URL='https://github.com/treasure-data/td-skills';export function getTdSkillsRepoUrl(){const _0x1e0d03=process.env.TDX_TD_SKILLS_REPO;if(_0x1e0d03)return _0x1e0d03;return DEFAULT_TD_SKILLS_URL;}async function removeMarketplace(_0x14a2c5,_0x1dc227){const _0x547043=a11_0x47d108;try{const _0x56d6aa=await executeClaudeCommand([_0x547043(0x1d1),_0x547043(0x1c3),_0x547043(0x1f9)],_0x547043(0x224),_0x1dc227);if(!_0x56d6aa[_0x547043(0x1d0)](_0x14a2c5)){_0x1dc227?.[_0x547043(0x266)](_0x547043(0x241)+_0x14a2c5+_0x547043(0x255));return;}await executeClaudeCommand(['plugin',_0x547043(0x1c3),'remove',_0x14a2c5],_0x547043(0x233)+_0x14a2c5+'\x27',_0x1dc227),_0x1dc227?.[_0x547043(0x20c)]('Marketplace\x20\x27'+_0x14a2c5+'\x27\x20removed');}catch(_0x1b8077){_0x1dc227?.[_0x547043(0x212)](_0x547043(0x233)+_0x14a2c5+_0x547043(0x24d)+_0x1b8077);}}async function restoreDefaultTdSkillsMarketplace(_0x1c3f56){const _0x187fc4=a11_0x47d108;try{await removeMarketplace(_0x187fc4(0x1e1),_0x1c3f56),await executeClaudeCommand(['plugin','marketplace',_0x187fc4(0x264),DEFAULT_TD_SKILLS_URL],undefined,_0x1c3f56),_0x1c3f56?.['info'](_0x187fc4(0x259));}catch{}}async function ensureMarketplace(_0x59aa9c,_0x5d3e2c,_0xa6d10c,_0x39c87c){const _0x1acc57=a11_0x47d108;_0xa6d10c[_0x1acc57(0x22d)]=_0x1acc57(0x20b)+_0x59aa9c+_0x1acc57(0x1c6),await executeClaudeCommand([_0x1acc57(0x1d1),_0x1acc57(0x1c3),'add',_0x5d3e2c],'Failed\x20to\x20configure\x20marketplace\x20\x27'+_0x59aa9c+'\x27',_0x39c87c),_0xa6d10c[_0x1acc57(0x22d)]=_0x1acc57(0x1fa)+_0x59aa9c+_0x1acc57(0x1f4);}async function updateMarketplace(_0x500172,_0x5234fe,_0x54f4ea){const _0x5749c8=a11_0x47d108;_0x5234fe[_0x5749c8(0x22d)]=_0x5749c8(0x21e)+_0x500172+'\x27...',await executeClaudeCommand([_0x5749c8(0x1d1),_0x5749c8(0x1c3),_0x5749c8(0x263)],_0x5749c8(0x265)+_0x500172+'\x27',_0x54f4ea),_0x5234fe['text']=_0x5749c8(0x1fa)+_0x500172+_0x5749c8(0x231);}async function ensurePlugin(_0x5411b1,_0x372ec3,_0x1cc72c,_0x376cdb){const _0x52b308=a11_0x47d108;_0x1cc72c[_0x52b308(0x22d)]=_0x52b308(0x1d2)+_0x5411b1+_0x52b308(0x1c6),await executeClaudeCommand([_0x52b308(0x1d1),_0x52b308(0x1d3),_0x5411b1+'@'+_0x372ec3],_0x52b308(0x1e2)+_0x5411b1+'\x27',_0x376cdb),_0x1cc72c['text']=_0x52b308(0x203)+_0x5411b1+_0x52b308(0x207);}function getClaudeConfigDir(){const _0xaeb43d=a11_0x47d108;return process.env.CLAUDE_CONFIG_DIR||join(homedir(),_0xaeb43d(0x225));}async function checkoutReleaseTag(_0x3590c0,_0x1a2a91,_0x4fcbd7){const _0x44e463=a11_0x47d108,_0x117cce=join(getClaudeConfigDir(),_0x44e463(0x210),_0x44e463(0x201),_0x44e463(0x1e1));if(!existsSync(_0x117cce)){_0x4fcbd7?.[_0x44e463(0x266)]('td-skills\x20marketplace\x20dir\x20not\x20found,\x20skipping\x20release\x20tag\x20checkout');return;}_0x1a2a91['text']=_0x44e463(0x1c5)+_0x3590c0+_0x44e463(0x1df),await execFileAsync(_0x44e463(0x226),[_0x44e463(0x26d),_0x44e463(0x242),_0x44e463(0x246),_0x44e463(0x23e)],{'cwd':_0x117cce});try{await execFileAsync(_0x44e463(0x226),[_0x44e463(0x1de),_0x44e463(0x24b)],{'cwd':_0x117cce});}catch{await execFileAsync(_0x44e463(0x226),[_0x44e463(0x1de),'-b','main','origin/main'],{'cwd':_0x117cce});}await execFileAsync(_0x44e463(0x226),['reset',_0x44e463(0x1e7),_0x3590c0],{'cwd':_0x117cce}),_0x1a2a91[_0x44e463(0x22d)]=_0x44e463(0x238)+_0x3590c0,_0x4fcbd7?.[_0x44e463(0x20c)](_0x44e463(0x1cd)+_0x3590c0);}function a11_0x297a(_0x4adabf,_0xfc3e4a){_0x4adabf=_0x4adabf-0x1c3;const _0x27cb88=a11_0x27cb();let _0x297a34=_0x27cb88[_0x4adabf];return _0x297a34;}async function createClaudeSettings(_0xa3f339,_0x5d92e0,_0x150b76){const _0x1568c9=a11_0x47d108,_0x403d85=join(process[_0x1568c9(0x21a)](),_0x1568c9(0x225)),_0x4caccd=join(_0x403d85,_0x1568c9(0x1cb)),_0x40eb02=join(_0x403d85,SETTINGS_BACKUP_FILENAME);await mkdir(_0x403d85,{'recursive':!![]});const _0x660d33=await recoverFromStaleBackup(_0x4caccd,_0x40eb02);let _0x593682;if(_0x660d33)_0x593682=_0x660d33['liveSessionOriginals'];else{let _0x48d364={};if(existsSync(_0x4caccd))try{const _0x11aa46=await readFile(_0x4caccd,'utf-8');_0x48d364=JSON[_0x1568c9(0x1e4)](_0x11aa46);}catch{_0x48d364={};}const _0x1c3385=_0x48d364['env']||{};_0x593682={'ANTHROPIC_BASE_URL':_0x1c3385[_0x1568c9(0x245)],'ANTHROPIC_MODEL':_0x1c3385[_0x1568c9(0x1cc)],'ANTHROPIC_AUTH_TOKEN':_0x1c3385[_0x1568c9(0x1e0)],'CLAUDE_CODE_USE_BEDROCK':_0x1c3385[_0x1568c9(0x222)],'CLAUDE_CODE_USE_VERTEX':_0x1c3385[_0x1568c9(0x239)],'statusLine':_0x48d364[_0x1568c9(0x24e)]};const _0x33b053={'createdAt':new Date()[_0x1568c9(0x209)](),'pid':process['pid'],'originalSettings':_0x593682};await writeFile(_0x40eb02,JSON[_0x1568c9(0x1c4)](_0x33b053,null,0x2)+'\x0a');}let _0x262bd3={};if(existsSync(_0x4caccd))try{const _0x275a64=await readFile(_0x4caccd,_0x1568c9(0x1f2));_0x262bd3=JSON[_0x1568c9(0x1e4)](_0x275a64);}catch{_0x262bd3={};}const _0x2afae0=_0x262bd3[_0x1568c9(0x247)]||{},_0x2e3e92={..._0x262bd3,'env':{..._0x2afae0,'ANTHROPIC_BASE_URL':_0x1568c9(0x20a)+_0xa3f339,..._0x5d92e0&&{'ANTHROPIC_MODEL':_0x5d92e0},'ANTHROPIC_AUTH_TOKEN':_0x1568c9(0x256),'CLAUDE_CODE_USE_BEDROCK':_0x1568c9(0x24a),'CLAUDE_CODE_USE_VERTEX':'false'},'statusLine':{'type':_0x1568c9(0x223),'command':_0x150b76?_0x1568c9(0x1c8)+_0x150b76+_0x1568c9(0x236):_0x1568c9(0x250)}};return await writeFile(_0x4caccd,JSON[_0x1568c9(0x1c4)](_0x2e3e92,null,0x2)+'\x0a'),_0x593682;}async function restoreClaudeSettings(_0xda5bdd){const _0x275cdc=a11_0x47d108,_0x992da1=join(process[_0x275cdc(0x21a)](),'.claude'),_0x4d9c77=join(_0x992da1,_0x275cdc(0x1cb)),_0x325bf7=join(_0x992da1,SETTINGS_BACKUP_FILENAME);await applyOriginalSettings(_0x4d9c77,_0xda5bdd);try{if(existsSync(_0x325bf7)){const _0x47bdee=await readFile(_0x325bf7,_0x275cdc(0x1f2)),_0x3be444=JSON[_0x275cdc(0x1e4)](_0x47bdee);_0x3be444[_0x275cdc(0x1f3)]===process[_0x275cdc(0x1f3)]&&await safeUnlink(_0x325bf7);}}catch{}}export class ClaudeCommand extends BaseCommand{['name']=a11_0x47d108(0x1f6);[a11_0x47d108(0x200)]='Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy';[a11_0x47d108(0x228)];[a11_0x47d108(0x1ff)];['logger'];[a11_0x47d108(0x26c)];async['execute'](_0x12fe5a){const _0x206de8=a11_0x47d108,{tdx:_0x4534fc,options:_0x28aea0,args:_0x596e49}=_0x12fe5a;let _0x59c884=![];try{const _0x20a6c1=_0x28aea0,_0x170acb=_0x20a6c1['proxy']===![],_0xe4d7df=_0x20a6c1[_0x206de8(0x1c9)]===!![],_0x492152=_0x20a6c1[_0x206de8(0x267)]===!![],_0x46553f=[..._0x596e49];if(_0xe4d7df)_0x46553f[_0x206de8(0x249)]('-c');else _0x492152&&_0x46553f[_0x206de8(0x249)]('-r');const _0x11a784=createCommandSpinner(_0x206de8(0x1ce),{'verbose':_0x28aea0[_0x206de8(0x219)]});_0x11a784[_0x206de8(0x251)]();try{if(!_0x170acb){const _0x3c15f5=_0x28aea0[_0x206de8(0x20e)];try{const _0x4a9bc3=await _0x4534fc['user'][_0x206de8(0x215)]();_0x4a9bc3[_0x206de8(0x254)]&&writeCachedAccountInfo(_0x28aea0['site'],_0x4a9bc3[_0x206de8(0x254)],_0x3c15f5);}catch{}_0x11a784['text']=_0x206de8(0x243),this[_0x206de8(0x25c)]=new TDXLogger(_0x28aea0[_0x206de8(0x22c)],!![]),await this[_0x206de8(0x25c)][_0x206de8(0x1d9)]();const _0x39d1f3=this['logger'][_0x206de8(0x229)]();_0x11a784[_0x206de8(0x22d)]=_0x206de8(0x1ca)+_0x39d1f3;const _0x435e5c=getEndpoint(_0x28aea0['site'],_0x206de8(0x253));_0x11a784[_0x206de8(0x22d)]='Starting\x20TD\x20LLM\x20pass-through\x20proxy...';let _0x23bec8;const _0x34e5a8=await getOAuthTokens(_0x3c15f5);if(_0x34e5a8)_0x23bec8={'type':_0x206de8(0x1d4),'accessToken':_0x34e5a8[_0x206de8(0x211)],'refreshToken':_0x34e5a8[_0x206de8(0x1eb)],'expiresAt':_0x34e5a8[_0x206de8(0x25f)],'consoleUrl':getConsoleUrl(_0x28aea0[_0x206de8(0x1d7)])};else{if(_0x4534fc['context'][_0x206de8(0x258)])_0x23bec8={'type':_0x206de8(0x25b),'apiKey':_0x4534fc[_0x206de8(0x202)][_0x206de8(0x258)]};else throw new SDKError(ErrorCode[_0x206de8(0x1f7)],_0x206de8(0x1fc));}this[_0x206de8(0x228)]=new PassThroughProxyServer({'startPort':0xfa0,'llmProxyUrl':_0x435e5c,'auth':_0x23bec8,'logger':this[_0x206de8(0x25c)],'site':_0x28aea0[_0x206de8(0x1d7)],'profile':_0x3c15f5}),await this['passThroughServer'][_0x206de8(0x251)](),this['port']=this[_0x206de8(0x228)][_0x206de8(0x26c)],_0x11a784[_0x206de8(0x22d)]=_0x206de8(0x1e5)+this[_0x206de8(0x26c)]+_0x206de8(0x221)+_0x435e5c,_0x11a784['text']=_0x206de8(0x25d),this[_0x206de8(0x1ff)]=await createClaudeSettings(this[_0x206de8(0x26c)],undefined,_0x3c15f5),_0x11a784[_0x206de8(0x22d)]=_0x206de8(0x26a);}else _0x11a784['text']=_0x206de8(0x1e8);try{_0x11a784[_0x206de8(0x22d)]=_0x206de8(0x1ea),await checkClaudeVersion(MIN_CLAUDE_VERSION,this['logger']),_0x11a784[_0x206de8(0x22d)]=_0x206de8(0x1ef);}catch(_0x97fa40){_0x11a784[_0x206de8(0x234)](_0x206de8(0x205));throw _0x97fa40;}try{await ensureMcpServer(_0x206de8(0x1fb),'https://docs.treasuredata.com/mcp',_0x206de8(0x1d8),_0x11a784,this[_0x206de8(0x25c)]);}catch(_0x16d41f){handleInstallationError(_0x16d41f,_0x206de8(0x206),_0x11a784,this[_0x206de8(0x25c)]);}try{const _0x4249cb=getTdSkillsRepoUrl();_0x59c884=_0x4249cb!==DEFAULT_TD_SKILLS_URL;_0x59c884&&await removeMarketplace('td-skills',this[_0x206de8(0x25c)]);await ensureMarketplace(_0x206de8(0x1e1),_0x4249cb,_0x11a784,this[_0x206de8(0x25c)]),await updateMarketplace(_0x206de8(0x1e1),_0x11a784,this[_0x206de8(0x25c)]),await ensurePlugin(_0x206de8(0x1dc),_0x206de8(0x1e1),_0x11a784,this[_0x206de8(0x25c)]),await ensurePlugin(_0x206de8(0x262),'td-skills',_0x11a784,this[_0x206de8(0x25c)]),await ensurePlugin(_0x206de8(0x1fe),_0x206de8(0x1e1),_0x11a784,this[_0x206de8(0x25c)]);try{const _0x162603=loadReleaseChannel(),_0x8c2b32=await resolveReleaseTag(_0x162603,_0x206de8(0x22a),'td-skills',_0x206de8(0x24f));_0x8c2b32&&await checkoutReleaseTag(_0x8c2b32,_0x11a784,this[_0x206de8(0x25c)]);}catch(_0x1a1653){this['logger']?.[_0x206de8(0x212)]('Failed\x20to\x20apply\x20td-skills\x20release\x20channel:\x20'+_0x1a1653);}}catch(_0xaa1181){handleInstallationError(_0xaa1181,_0x206de8(0x208),_0x11a784,this[_0x206de8(0x25c)]);}_0x11a784[_0x206de8(0x21d)]();}catch(_0x90e25a){_0x11a784[_0x206de8(0x234)](_0x206de8(0x1db));throw _0x90e25a;}const _0xa08067=await findExecutable(_0x206de8(0x1f6));if(!_0xa08067)throw new SDKError(ErrorCode[_0x206de8(0x240)],_0x206de8(0x213),undefined,{'helpText':'Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code'});const _0x4f093b={...process.env};!_0x170acb&&(_0x4f093b['ANTHROPIC_BASE_URL']=_0x206de8(0x20a)+this['port'],_0x4f093b['ANTHROPIC_AUTH_TOKEN']=_0x206de8(0x256),_0x4f093b[_0x206de8(0x222)]='false',_0x4f093b[_0x206de8(0x239)]=_0x206de8(0x24a));const _0x4881e6=crossSpawn(_0xa08067,_0x46553f,{'stdio':_0x206de8(0x1d6),'env':_0x4f093b}),_0x37eb33=await new Promise(_0x58db69=>{const _0x3d29ae=_0x206de8;_0x4881e6['on'](_0x3d29ae(0x248),_0x426662=>{_0x58db69(_0x426662||0x0);}),_0x4881e6['on']('error',_0x2f685b=>{const _0x199a7a=_0x3d29ae;console[_0x199a7a(0x1dd)](a11_0x1f52ba[_0x199a7a(0x1e6)](_0x199a7a(0x237)+_0x2f685b[_0x199a7a(0x24c)])),_0x58db69(0x1);});});_0x59c884&&await restoreDefaultTdSkillsMarketplace(this['logger']);this[_0x206de8(0x228)]&&(await this[_0x206de8(0x228)]['stop'](),console[_0x206de8(0x1ec)](a11_0x1f52ba['green'](_0x206de8(0x25e))));if(this[_0x206de8(0x25c)]){await this[_0x206de8(0x25c)][_0x206de8(0x260)]();const _0x51ca3a=this['logger']['getLogPath']();console['log'](a11_0x1f52ba[_0x206de8(0x23f)](_0x206de8(0x269)+_0x51ca3a));}return this[_0x206de8(0x1ff)]&&(await restoreClaudeSettings(this[_0x206de8(0x1ff)]),console['log'](a11_0x1f52ba['green'](_0x206de8(0x252)))),_0x37eb33;}catch(_0x1e00fe){_0x59c884&&await restoreDefaultTdSkillsMarketplace(this['logger']);this[_0x206de8(0x228)]&&await this[_0x206de8(0x228)][_0x206de8(0x21d)]();this[_0x206de8(0x25c)]&&await this[_0x206de8(0x25c)]['close']();this[_0x206de8(0x1ff)]&&await restoreClaudeSettings(this['originalSettings']);throw _0x1e00fe;}}}
|
|
1
|
+
const a11_0x3adbf2=a11_0x13c9;(function(_0x449901,_0x48c7ce){const _0x58a036=a11_0x13c9,_0x44aea5=_0x449901();while(!![]){try{const _0x1f3909=-parseInt(_0x58a036(0x1ba))/0x1+parseInt(_0x58a036(0x192))/0x2*(-parseInt(_0x58a036(0x1d8))/0x3)+parseInt(_0x58a036(0x19f))/0x4*(-parseInt(_0x58a036(0x1d0))/0x5)+parseInt(_0x58a036(0x187))/0x6*(-parseInt(_0x58a036(0x160))/0x7)+parseInt(_0x58a036(0x188))/0x8*(parseInt(_0x58a036(0x197))/0x9)+parseInt(_0x58a036(0x183))/0xa*(parseInt(_0x58a036(0x1b0))/0xb)+-parseInt(_0x58a036(0x14c))/0xc*(-parseInt(_0x58a036(0x158))/0xd);if(_0x1f3909===_0x48c7ce)break;else _0x44aea5['push'](_0x44aea5['shift']());}catch(_0x2cb696){_0x44aea5['push'](_0x44aea5['shift']());}}}(a11_0x3a84,0xd2081));import{readFile,writeFile,mkdir,unlink}from'node:fs/promises';import{execFile}from'node:child_process';function a11_0x3a84(){const _0x55f482=['✓\x20Settings\x20restored:\x20.claude/settings.local.json','✓\x20MCP\x20server\x20\x27','plugin','\x27\x20updated','1070677Mekumc','Claude\x20Code\x20version\x20check\x20failed','patch','parse','CLAUDE_CODE_USE_VERTEX','CLAUDE_CODE_NOT_FOUND','passThroughServer','.tdx-settings-backup.json','✓\x20Logging\x20to\x20','stderr','--tags','expires_at','stdout','stop','major','Starting\x20TD\x20LLM\x20pass-through\x20proxy...','plugins','Installing\x20plugin\x20\x27','message','--transport','claude','kill','15rkuNTH','Initializing...','stringify','add','marketplaces','context','Setup\x20failed','init','84HDnUax','fetch','origin','minor','\x20claude\x20statusline','marketplace','):\x20claude\x20','Failed\x20to\x20remove\x20marketplace\x20\x27','liveSessionOriginals','Launch\x20Claude\x20Code\x20with\x20integrated\x20LLM\x20proxy','install','.claude','fail','env','inherit','account_id','cause','reset','td-skills\x20marketplace\x20dir\x20not\x20found,\x20skipping\x20release\x20tag\x20checkout','Could\x20not\x20parse\x20Claude\x20Code\x20version\x20from:\x20','--version','INVALID_ARGUMENT','access_token','\x27...','sql-skills','settings.local.json','Configuring\x20marketplace\x20\x27','code','description','statusLine','Marketplace\x20\x27','http','main','update','td-docs','12MVQbmi','logLevel','text','http://127.0.0.1:','trim','Command\x20spawn\x20error:\x20','join','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20server\x20stopped','CLAUDE_CODE_USE_BEDROCK','tdx\x20--profile\x20','\x27\x20not\x20found\x20in\x20list,\x20skipping\x20removal','Authentication\x20required\x20for\x20TD\x20LLM\x20Proxy.\x20Run:\x20tdx\x20auth\x20setup','39780689cnPuTg','user','tdx-managed-proxy','error','apikey','✓\x20TD\x20LLM\x20pass-through\x20proxy\x20running\x20on\x20port\x20','toString','Failed\x20to\x20install\x20plugin\x20\x27','203uBNYuU','Please\x20install\x20Claude\x20Code\x20from\x20https://claude.com/claude-code','ANTHROPIC_BASE_URL','green','Checking\x20Claude\x20Code\x20version...','red','oauth','profile','debug','\x20configuration\x20failed','close','originalSettings','continue','https://github.com/treasure-data/td-skills','utf-8','INTERNAL','false','TD\x20Docs\x20MCP\x20Server','Skipping\x20TD\x20LLM\x20proxy\x20setup\x20(--no-proxy)','Failed\x20to\x20list\x20marketplaces','✓\x20Marketplace\x20\x27','checkout','Claude\x20Code\x20CLI\x20not\x20found','warn','unshift','start','ANTHROPIC_MODEL','getLogPath','port','...','2.0.20','Warning:\x20Failed\x20to\x20configure\x20','Initializing\x20proxy\x20logger...','✓\x20Settings\x20configured:\x20.claude/settings.local.json','already\x20exists','9643030uipZPH','log','pid','Updating\x20marketplace\x20\x27','312798bPspBb','319552VmdSbd','Executing:\x20claude\x20','info','tdx\x20claude\x20statusline','✓\x20Logs\x20saved\x20to\x20','match','Failed\x20to\x20configure\x20marketplace\x20\x27','td-skills\x20checked\x20out\x20at\x20tag\x20','\x27:\x20','Creating\x20.claude/settings.local.json...','111394rkrDut','origin/main','already\x20installed','\x20or\x20later.','Claude\x20Code\x20version\x20','369OwJZlZ','td-skills','exit','\x20already\x20configured','Failed\x20to\x20apply\x20td-skills\x20release\x20channel:\x20','workflow-skills','list','cwd','879628uesruZ','Download\x20the\x20latest\x20version\x20from\x20https://claude.com/claude-code','Checking\x20out\x20td-skills\x20','treasure-data','ENOENT','Failed\x20to\x20launch\x20Claude\x20Code:\x20','\x20meets\x20minimum\x20requirement','CLAUDE_CODE_UNSUPPORTED_VERSION','toISOString','site','logger','\x27\x20configured','ANTHROPIC_AUTH_TOKEN','Command\x20output:\x20','resume','apiKey','data','11BdJfys','\x20→\x20','verbose','Failed\x20to\x20update\x20marketplace\x20\x27','git','llm-proxy'];a11_0x3a84=function(){return _0x55f482;};return a11_0x3a84();}import{existsSync}from'node:fs';import{homedir}from'node:os';import{join}from'node:path';import{promisify}from'node:util';import a11_0x2ad7c6 from'chalk';import{BaseCommand}from'./command.js';import{PassThroughProxyServer}from'../proxy/passthrough-server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{getEndpoint,getConsoleUrl}from'../sdk/client/endpoints.js';import{getOAuthTokens}from'../core/oauth-keychain.js';import{findExecutable,crossSpawn}from'../utils/process.js';import{SDKError,ErrorCode,errorContains}from'../sdk/errors.js';import{createCommandSpinner}from'../utils/spinner.js';import{writeCachedAccountInfo,loadReleaseChannel}from'../core/config.js';import{resolveReleaseTag}from'../utils/github-releases.js';const execFileAsync=promisify(execFile),MIN_CLAUDE_VERSION=a11_0x3adbf2(0x17e),SETTINGS_BACKUP_FILENAME=a11_0x3adbf2(0x1c1);function isProcessRunning(_0x569b0f){const _0x21d31d=a11_0x3adbf2;try{return process[_0x21d31d(0x1cf)](_0x569b0f,0x0),!![];}catch{return![];}}async function applyOriginalSettings(_0x25fd6c,_0x41b26a){const _0x167d46=a11_0x3adbf2;if(!existsSync(_0x25fd6c))return;try{const _0x49e8d6=await readFile(_0x25fd6c,_0x167d46(0x16e)),_0x569921=JSON[_0x167d46(0x1bd)](_0x49e8d6),_0x32c181=_0x569921[_0x167d46(0x136)]||{};for(const _0x5e3e5a of[_0x167d46(0x162),_0x167d46(0x17a),_0x167d46(0x1ab),_0x167d46(0x154),'CLAUDE_CODE_USE_VERTEX']){_0x41b26a[_0x5e3e5a]!==undefined?_0x32c181[_0x5e3e5a]=_0x41b26a[_0x5e3e5a]:delete _0x32c181[_0x5e3e5a];}_0x41b26a[_0x167d46(0x146)]!==undefined?_0x569921[_0x167d46(0x146)]=_0x41b26a[_0x167d46(0x146)]:delete _0x569921[_0x167d46(0x146)],_0x569921[_0x167d46(0x136)]=_0x32c181,await writeFile(_0x25fd6c,JSON[_0x167d46(0x1d2)](_0x569921,null,0x2)+'\x0a');}catch{}}async function safeUnlink(_0x3972b1){try{await unlink(_0x3972b1);}catch{}}function a11_0x13c9(_0x1d432e,_0x5db1da){_0x1d432e=_0x1d432e-0x12c;const _0x3a84f3=a11_0x3a84();let _0x13c908=_0x3a84f3[_0x1d432e];return _0x13c908;}async function recoverFromStaleBackup(_0x3eeba8,_0x18cb8c){const _0x336e1e=a11_0x3adbf2;if(!existsSync(_0x18cb8c))return undefined;try{const _0x5b76c3=await readFile(_0x18cb8c,_0x336e1e(0x16e)),_0x56e818=JSON[_0x336e1e(0x1bd)](_0x5b76c3);if(isProcessRunning(_0x56e818[_0x336e1e(0x185)]))return{'liveSessionOriginals':_0x56e818[_0x336e1e(0x16b)]};return await applyOriginalSettings(_0x3eeba8,_0x56e818[_0x336e1e(0x16b)]),await safeUnlink(_0x18cb8c),undefined;}catch{return await safeUnlink(_0x18cb8c),undefined;}}function handleInstallationError(_0x3dc6ff,_0xba30,_0x493ba7,_0x3d1572){const _0x3fdde6=a11_0x3adbf2;errorContains(_0x3dc6ff,_0x3fdde6(0x182),_0x3fdde6(0x194),'already\x20configured')?(_0x493ba7[_0x3fdde6(0x14e)]='✓\x20'+_0xba30+_0x3fdde6(0x19a),_0x3d1572?.['info'](_0xba30+_0x3fdde6(0x19a)),_0x3dc6ff instanceof SDKError&&_0x3dc6ff[_0x3fdde6(0x139)]&&_0x3d1572?.[_0x3fdde6(0x168)](_0x3fdde6(0x1ac)+_0x3dc6ff[_0x3fdde6(0x139)][_0x3fdde6(0x1cc)])):(_0x493ba7[_0x3fdde6(0x177)](_0x3fdde6(0x17f)+_0xba30),_0x3d1572?.[_0x3fdde6(0x15b)](_0xba30+_0x3fdde6(0x169),_0x3dc6ff));}export function parseVersion(_0x5bba22){const _0x3b53e0=a11_0x3adbf2,_0x5d4b8b=_0x5bba22[_0x3b53e0(0x150)]()[_0x3b53e0(0x18d)](/^v?(\d+)\.(\d+)\.(\d+)/);if(!_0x5d4b8b)return null;return{'major':parseInt(_0x5d4b8b[0x1],0xa),'minor':parseInt(_0x5d4b8b[0x2],0xa),'patch':parseInt(_0x5d4b8b[0x3],0xa)};}export function compareVersions(_0x2d7015,_0x2c5032){const _0x76f948=a11_0x3adbf2;if(_0x2d7015['major']!==_0x2c5032[_0x76f948(0x1c8)])return _0x2d7015['major']-_0x2c5032[_0x76f948(0x1c8)];if(_0x2d7015[_0x76f948(0x12c)]!==_0x2c5032[_0x76f948(0x12c)])return _0x2d7015['minor']-_0x2c5032[_0x76f948(0x12c)];return _0x2d7015[_0x76f948(0x1bc)]-_0x2c5032[_0x76f948(0x1bc)];}async function checkClaudeVersion(_0x3e85fb,_0x4e8449){const _0x4b169d=a11_0x3adbf2;_0x4e8449?.[_0x4b169d(0x168)]('Checking\x20Claude\x20Code\x20version\x20(minimum\x20required:\x20'+_0x3e85fb+')');const _0x16c088=await executeClaudeCommand([_0x4b169d(0x13d)],undefined,_0x4e8449),_0x52fff4=parseVersion(_0x16c088);if(!_0x52fff4){_0x4e8449?.[_0x4b169d(0x177)](_0x4b169d(0x13c)+_0x16c088);return;}const _0x23029a=_0x52fff4['major']+'.'+_0x52fff4[_0x4b169d(0x12c)]+'.'+_0x52fff4['patch'],_0x3f0a99=parseVersion(_0x3e85fb);if(!_0x3f0a99){_0x4e8449?.['warn']('Invalid\x20minimum\x20version\x20format:\x20'+_0x3e85fb);return;}if(compareVersions(_0x52fff4,_0x3f0a99)<0x0){_0x4e8449?.[_0x4b169d(0x15b)](_0x4b169d(0x196)+_0x23029a+'\x20is\x20too\x20old\x20(minimum:\x20'+_0x3e85fb+')');throw new SDKError(ErrorCode[_0x4b169d(0x1a6)],_0x4b169d(0x196)+_0x23029a+'\x20does\x20not\x20support\x20required\x20features.\x20Please\x20upgrade\x20to\x20version\x20'+_0x3e85fb+_0x4b169d(0x195),undefined,{'helpText':_0x4b169d(0x1a0)});}_0x4e8449?.['debug'](_0x4b169d(0x196)+_0x23029a+_0x4b169d(0x1a5));}async function executeClaudeCommand(_0x3e7c40,_0x290bd7,_0x4caaaf){const _0x37d91e=a11_0x3adbf2;return _0x4caaaf?.['info'](_0x37d91e(0x189)+_0x3e7c40['join']('\x20')),new Promise((_0x25c95d,_0x56bf0c)=>{const _0x345567=_0x37d91e,_0x4e27a8=crossSpawn('claude',_0x3e7c40,{'stdio':'pipe'});let _0x6ae7a='',_0x26c1ff='';_0x4e27a8[_0x345567(0x1c6)]?.['on'](_0x345567(0x1af),_0x45618d=>{_0x6ae7a+=_0x45618d['toString']();}),_0x4e27a8[_0x345567(0x1c3)]?.['on']('data',_0x4fd97e=>{const _0x3c2b7f=_0x345567;_0x26c1ff+=_0x4fd97e[_0x3c2b7f(0x15e)]();}),_0x4e27a8['on'](_0x345567(0x15b),_0x2f2ca1=>{const _0x3e7858=_0x345567;_0x2f2ca1[_0x3e7858(0x144)]===_0x3e7858(0x1a3)?(_0x4caaaf?.[_0x3e7858(0x15b)](_0x3e7858(0x176)),_0x56bf0c(new SDKError(ErrorCode['CLAUDE_CODE_NOT_FOUND'],_0x3e7858(0x176),_0x2f2ca1,{'helpText':_0x3e7858(0x161)}))):(_0x4caaaf?.[_0x3e7858(0x15b)](_0x3e7858(0x151)+_0x2f2ca1[_0x3e7858(0x1cc)]),_0x56bf0c(new SDKError(ErrorCode[_0x3e7858(0x16f)],'Failed\x20to\x20spawn\x20claude\x20command:\x20'+_0x2f2ca1[_0x3e7858(0x1cc)],_0x2f2ca1)));}),_0x4e27a8['on'](_0x345567(0x199),_0x1b8080=>{const _0x25c2b2=_0x345567;if(_0x1b8080===0x0)_0x25c95d(_0x6ae7a);else _0x290bd7?(_0x4caaaf?.['error']('Command\x20failed\x20(exit\x20'+_0x1b8080+_0x25c2b2(0x12f)+_0x3e7c40[_0x25c2b2(0x152)]('\x20')),_0x56bf0c(new SDKError(ErrorCode['INSTALLATION_FAILED'],_0x290bd7,new Error(_0x26c1ff)))):_0x25c95d('');});});}async function ensureMcpServer(_0x525231,_0x51b9b0,_0x515fe2,_0x4e9404,_0x23f55e){const _0x4abd82=a11_0x3adbf2;_0x4e9404['text']='Configuring\x20MCP\x20server\x20\x27'+_0x525231+_0x4abd82(0x140),await executeClaudeCommand(['mcp',_0x4abd82(0x1d3),_0x525231,_0x51b9b0,_0x4abd82(0x1cd),_0x515fe2],'Failed\x20to\x20configure\x20MCP\x20server\x20\x27'+_0x525231+'\x27',_0x23f55e),_0x4e9404[_0x4abd82(0x14e)]=_0x4abd82(0x1b7)+_0x525231+_0x4abd82(0x1aa);}export const DEFAULT_TD_SKILLS_URL=a11_0x3adbf2(0x16d);export function getTdSkillsRepoUrl(){const _0x46d520=process.env.TDX_TD_SKILLS_REPO;if(_0x46d520)return _0x46d520;return DEFAULT_TD_SKILLS_URL;}async function removeMarketplace(_0x49603d,_0x4638e3){const _0x596b50=a11_0x3adbf2;try{const _0x44190d=await executeClaudeCommand(['plugin',_0x596b50(0x12e),_0x596b50(0x19d)],_0x596b50(0x173),_0x4638e3);if(!_0x44190d['includes'](_0x49603d)){_0x4638e3?.[_0x596b50(0x168)]('Marketplace\x20\x27'+_0x49603d+_0x596b50(0x156));return;}await executeClaudeCommand([_0x596b50(0x1b8),'marketplace','remove',_0x49603d],_0x596b50(0x130)+_0x49603d+'\x27',_0x4638e3),_0x4638e3?.[_0x596b50(0x18a)](_0x596b50(0x147)+_0x49603d+'\x27\x20removed');}catch(_0x47d089){_0x4638e3?.[_0x596b50(0x177)](_0x596b50(0x130)+_0x49603d+_0x596b50(0x190)+_0x47d089);}}async function restoreDefaultTdSkillsMarketplace(_0xfc5ae6){const _0xf3728d=a11_0x3adbf2;try{await removeMarketplace(_0xf3728d(0x198),_0xfc5ae6),await executeClaudeCommand([_0xf3728d(0x1b8),_0xf3728d(0x12e),_0xf3728d(0x1d3),DEFAULT_TD_SKILLS_URL],undefined,_0xfc5ae6),_0xfc5ae6?.[_0xf3728d(0x18a)]('Restored\x20default\x20td-skills\x20marketplace');}catch{}}async function ensureMarketplace(_0x342395,_0x7df5e3,_0x53c9b3,_0xebbf31){const _0x819140=a11_0x3adbf2;_0x53c9b3['text']=_0x819140(0x143)+_0x342395+_0x819140(0x140),await executeClaudeCommand(['plugin',_0x819140(0x12e),'add',_0x7df5e3],_0x819140(0x18e)+_0x342395+'\x27',_0xebbf31),_0x53c9b3[_0x819140(0x14e)]=_0x819140(0x174)+_0x342395+_0x819140(0x1aa);}async function updateMarketplace(_0xe5b2e0,_0x355318,_0x846b9e){const _0x4668b3=a11_0x3adbf2;_0x355318[_0x4668b3(0x14e)]=_0x4668b3(0x186)+_0xe5b2e0+_0x4668b3(0x140),await executeClaudeCommand([_0x4668b3(0x1b8),_0x4668b3(0x12e),_0x4668b3(0x14a)],_0x4668b3(0x1b3)+_0xe5b2e0+'\x27',_0x846b9e),_0x355318['text']='✓\x20Marketplace\x20\x27'+_0xe5b2e0+_0x4668b3(0x1b9);}async function ensurePlugin(_0x442e7c,_0x189b75,_0x588bfc,_0x1535d6){const _0x54561f=a11_0x3adbf2;_0x588bfc['text']=_0x54561f(0x1cb)+_0x442e7c+_0x54561f(0x140),await executeClaudeCommand(['plugin',_0x54561f(0x133),_0x442e7c+'@'+_0x189b75],_0x54561f(0x15f)+_0x442e7c+'\x27',_0x1535d6),_0x588bfc[_0x54561f(0x14e)]='✓\x20Plugin\x20\x27'+_0x442e7c+'\x27\x20installed';}function getClaudeConfigDir(){return process.env.CLAUDE_CONFIG_DIR||join(homedir(),'.claude');}async function checkoutReleaseTag(_0x4641c3,_0x1d9de1,_0x3162c5){const _0x9f4ca5=a11_0x3adbf2,_0xb29088=join(getClaudeConfigDir(),_0x9f4ca5(0x1ca),_0x9f4ca5(0x1d4),_0x9f4ca5(0x198));if(!existsSync(_0xb29088)){_0x3162c5?.[_0x9f4ca5(0x168)](_0x9f4ca5(0x13b));return;}_0x1d9de1[_0x9f4ca5(0x14e)]=_0x9f4ca5(0x1a1)+_0x4641c3+_0x9f4ca5(0x17d),await execFileAsync(_0x9f4ca5(0x1b4),[_0x9f4ca5(0x1d9),_0x9f4ca5(0x1da),_0x9f4ca5(0x1c4),'--force'],{'cwd':_0xb29088});try{await execFileAsync(_0x9f4ca5(0x1b4),[_0x9f4ca5(0x175),_0x9f4ca5(0x149)],{'cwd':_0xb29088});}catch{await execFileAsync(_0x9f4ca5(0x1b4),[_0x9f4ca5(0x175),'-b',_0x9f4ca5(0x149),_0x9f4ca5(0x193)],{'cwd':_0xb29088});}await execFileAsync(_0x9f4ca5(0x1b4),[_0x9f4ca5(0x13a),'--hard',_0x4641c3],{'cwd':_0xb29088}),_0x1d9de1[_0x9f4ca5(0x14e)]='✓\x20td-skills\x20checked\x20out\x20at\x20'+_0x4641c3,_0x3162c5?.['info'](_0x9f4ca5(0x18f)+_0x4641c3);}async function createClaudeSettings(_0x14f9fc,_0x40b2ed,_0x1b8351){const _0x8e8fd5=a11_0x3adbf2,_0x413c9b=join(process['cwd'](),_0x8e8fd5(0x134)),_0x39b079=join(_0x413c9b,'settings.local.json'),_0x54dc34=join(_0x413c9b,SETTINGS_BACKUP_FILENAME);await mkdir(_0x413c9b,{'recursive':!![]});const _0x2aa26d=await recoverFromStaleBackup(_0x39b079,_0x54dc34);let _0x3f9161;if(_0x2aa26d)_0x3f9161=_0x2aa26d[_0x8e8fd5(0x131)];else{let _0x2e4bcb={};if(existsSync(_0x39b079))try{const _0x47656f=await readFile(_0x39b079,_0x8e8fd5(0x16e));_0x2e4bcb=JSON['parse'](_0x47656f);}catch{_0x2e4bcb={};}const _0x1f70b5=_0x2e4bcb['env']||{};_0x3f9161={'ANTHROPIC_BASE_URL':_0x1f70b5[_0x8e8fd5(0x162)],'ANTHROPIC_MODEL':_0x1f70b5[_0x8e8fd5(0x17a)],'ANTHROPIC_AUTH_TOKEN':_0x1f70b5[_0x8e8fd5(0x1ab)],'CLAUDE_CODE_USE_BEDROCK':_0x1f70b5[_0x8e8fd5(0x154)],'CLAUDE_CODE_USE_VERTEX':_0x1f70b5[_0x8e8fd5(0x1be)],'statusLine':_0x2e4bcb['statusLine']};const _0x1e018a={'createdAt':new Date()[_0x8e8fd5(0x1a7)](),'pid':process['pid'],'originalSettings':_0x3f9161};await writeFile(_0x54dc34,JSON['stringify'](_0x1e018a,null,0x2)+'\x0a');}let _0x569c20={};if(existsSync(_0x39b079))try{const _0x4efbe5=await readFile(_0x39b079,_0x8e8fd5(0x16e));_0x569c20=JSON['parse'](_0x4efbe5);}catch{_0x569c20={};}const _0x57a487=_0x569c20[_0x8e8fd5(0x136)]||{},_0x28885d={..._0x569c20,'env':{..._0x57a487,'ANTHROPIC_BASE_URL':_0x8e8fd5(0x14f)+_0x14f9fc,..._0x40b2ed&&{'ANTHROPIC_MODEL':_0x40b2ed},'ANTHROPIC_AUTH_TOKEN':_0x8e8fd5(0x15a),'CLAUDE_CODE_USE_BEDROCK':'false','CLAUDE_CODE_USE_VERTEX':'false'},'statusLine':{'type':'command','command':_0x1b8351?_0x8e8fd5(0x155)+_0x1b8351+_0x8e8fd5(0x12d):_0x8e8fd5(0x18b)}};return await writeFile(_0x39b079,JSON['stringify'](_0x28885d,null,0x2)+'\x0a'),_0x3f9161;}async function restoreClaudeSettings(_0x4c8dbf){const _0x34c4d3=a11_0x3adbf2,_0x19c398=join(process[_0x34c4d3(0x19e)](),_0x34c4d3(0x134)),_0x360ecd=join(_0x19c398,_0x34c4d3(0x142)),_0x4171a1=join(_0x19c398,SETTINGS_BACKUP_FILENAME);await applyOriginalSettings(_0x360ecd,_0x4c8dbf);try{if(existsSync(_0x4171a1)){const _0x294521=await readFile(_0x4171a1,_0x34c4d3(0x16e)),_0x54848c=JSON[_0x34c4d3(0x1bd)](_0x294521);_0x54848c[_0x34c4d3(0x185)]===process[_0x34c4d3(0x185)]&&await safeUnlink(_0x4171a1);}}catch{}}export class ClaudeCommand extends BaseCommand{['name']=a11_0x3adbf2(0x1ce);[a11_0x3adbf2(0x145)]=a11_0x3adbf2(0x132);[a11_0x3adbf2(0x1c0)];['originalSettings'];['logger'];[a11_0x3adbf2(0x17c)];async['execute'](_0x101829){const _0x34d60a=a11_0x3adbf2,{tdx:_0x254f27,options:_0x5c998e,args:_0x203385}=_0x101829;let _0x265dfd=![];try{const _0x137174=_0x5c998e,_0x438b5b=_0x137174['proxy']===![],_0x1a34bf=_0x137174[_0x34d60a(0x16c)]===!![],_0x28a21b=_0x137174[_0x34d60a(0x1ad)]===!![],_0x4cd523=[..._0x203385];if(_0x1a34bf)_0x4cd523[_0x34d60a(0x178)]('-c');else _0x28a21b&&_0x4cd523['unshift']('-r');const _0x5b903c=createCommandSpinner(_0x34d60a(0x1d1),{'verbose':_0x5c998e[_0x34d60a(0x1b2)]});_0x5b903c[_0x34d60a(0x179)]();try{if(!_0x438b5b){const _0x4809ed=_0x5c998e[_0x34d60a(0x167)];try{const _0xf7e64f=await _0x254f27[_0x34d60a(0x159)]['getCurrent']();_0xf7e64f[_0x34d60a(0x138)]&&writeCachedAccountInfo(_0x5c998e[_0x34d60a(0x1a8)],_0xf7e64f[_0x34d60a(0x138)],_0x4809ed);}catch{}_0x5b903c[_0x34d60a(0x14e)]=_0x34d60a(0x180),this[_0x34d60a(0x1a9)]=new TDXLogger(_0x5c998e[_0x34d60a(0x14d)],!![]),await this[_0x34d60a(0x1a9)][_0x34d60a(0x1d7)]();const _0x4e9393=this[_0x34d60a(0x1a9)][_0x34d60a(0x17b)]();_0x5b903c['text']=_0x34d60a(0x1c2)+_0x4e9393;const _0x5a5d40=getEndpoint(_0x5c998e['site'],_0x34d60a(0x1b5));_0x5b903c[_0x34d60a(0x14e)]=_0x34d60a(0x1c9);let _0x3b7306;const _0x33497d=await getOAuthTokens(_0x4809ed);if(_0x33497d)_0x3b7306={'type':_0x34d60a(0x166),'accessToken':_0x33497d[_0x34d60a(0x13f)],'refreshToken':_0x33497d['refresh_token'],'expiresAt':_0x33497d[_0x34d60a(0x1c5)],'consoleUrl':getConsoleUrl(_0x5c998e[_0x34d60a(0x1a8)])};else{if(_0x254f27[_0x34d60a(0x1d5)]['apiKey'])_0x3b7306={'type':_0x34d60a(0x15c),'apiKey':_0x254f27[_0x34d60a(0x1d5)][_0x34d60a(0x1ae)]};else throw new SDKError(ErrorCode[_0x34d60a(0x13e)],_0x34d60a(0x157));}this['passThroughServer']=new PassThroughProxyServer({'startPort':0xfa0,'llmProxyUrl':_0x5a5d40,'auth':_0x3b7306,'logger':this['logger'],'site':_0x5c998e[_0x34d60a(0x1a8)],'profile':_0x4809ed}),await this['passThroughServer'][_0x34d60a(0x179)](),this[_0x34d60a(0x17c)]=this[_0x34d60a(0x1c0)][_0x34d60a(0x17c)],_0x5b903c['text']=_0x34d60a(0x15d)+this[_0x34d60a(0x17c)]+_0x34d60a(0x1b1)+_0x5a5d40,_0x5b903c['text']=_0x34d60a(0x191),this[_0x34d60a(0x16b)]=await createClaudeSettings(this[_0x34d60a(0x17c)],undefined,_0x4809ed),_0x5b903c[_0x34d60a(0x14e)]=_0x34d60a(0x181);}else _0x5b903c[_0x34d60a(0x14e)]=_0x34d60a(0x172);try{_0x5b903c['text']=_0x34d60a(0x164),await checkClaudeVersion(MIN_CLAUDE_VERSION,this[_0x34d60a(0x1a9)]),_0x5b903c[_0x34d60a(0x14e)]='✓\x20Claude\x20Code\x20version\x20OK';}catch(_0x9502c9){_0x5b903c['fail'](_0x34d60a(0x1bb));throw _0x9502c9;}try{await ensureMcpServer(_0x34d60a(0x14b),'https://docs.treasuredata.com/mcp',_0x34d60a(0x148),_0x5b903c,this['logger']);}catch(_0x48b64e){handleInstallationError(_0x48b64e,_0x34d60a(0x171),_0x5b903c,this[_0x34d60a(0x1a9)]);}try{const _0x5cd33e=getTdSkillsRepoUrl();_0x265dfd=_0x5cd33e!==DEFAULT_TD_SKILLS_URL;_0x265dfd&&await removeMarketplace('td-skills',this[_0x34d60a(0x1a9)]);await ensureMarketplace('td-skills',_0x5cd33e,_0x5b903c,this[_0x34d60a(0x1a9)]),await updateMarketplace('td-skills',_0x5b903c,this['logger']),await ensurePlugin(_0x34d60a(0x141),_0x34d60a(0x198),_0x5b903c,this[_0x34d60a(0x1a9)]),await ensurePlugin(_0x34d60a(0x19c),_0x34d60a(0x198),_0x5b903c,this['logger']),await ensurePlugin('tdx-skills',_0x34d60a(0x198),_0x5b903c,this[_0x34d60a(0x1a9)]);try{const _0x35ac04=loadReleaseChannel(),_0x1cc987=await resolveReleaseTag(_0x35ac04,_0x34d60a(0x1a2),_0x34d60a(0x198),'tdx-cli');_0x1cc987&&await checkoutReleaseTag(_0x1cc987,_0x5b903c,this['logger']);}catch(_0x3a37e0){this[_0x34d60a(0x1a9)]?.[_0x34d60a(0x177)](_0x34d60a(0x19b)+_0x3a37e0);}}catch(_0xd15989){handleInstallationError(_0xd15989,'td-skills\x20Plugins',_0x5b903c,this[_0x34d60a(0x1a9)]);}_0x5b903c[_0x34d60a(0x1c7)]();}catch(_0x53d4d0){_0x5b903c[_0x34d60a(0x135)](_0x34d60a(0x1d6));throw _0x53d4d0;}const _0x188499=await findExecutable(_0x34d60a(0x1ce));if(!_0x188499)throw new SDKError(ErrorCode[_0x34d60a(0x1bf)],_0x34d60a(0x176),undefined,{'helpText':_0x34d60a(0x161)});const _0x2c049a={...process.env};!_0x438b5b&&(_0x2c049a['ANTHROPIC_BASE_URL']=_0x34d60a(0x14f)+this[_0x34d60a(0x17c)],_0x2c049a[_0x34d60a(0x1ab)]='tdx-managed-proxy',_0x2c049a[_0x34d60a(0x154)]='false',_0x2c049a[_0x34d60a(0x1be)]=_0x34d60a(0x170));const _0x443729=crossSpawn(_0x188499,_0x4cd523,{'stdio':_0x34d60a(0x137),'env':_0x2c049a}),_0x2c7bc3=await new Promise(_0x19e7ef=>{const _0x1f0d02=_0x34d60a;_0x443729['on'](_0x1f0d02(0x199),_0x1ecc07=>{_0x19e7ef(_0x1ecc07||0x0);}),_0x443729['on'](_0x1f0d02(0x15b),_0xeaae64=>{const _0x47cc3d=_0x1f0d02;console[_0x47cc3d(0x15b)](a11_0x2ad7c6[_0x47cc3d(0x165)](_0x47cc3d(0x1a4)+_0xeaae64[_0x47cc3d(0x1cc)])),_0x19e7ef(0x1);});});_0x265dfd&&await restoreDefaultTdSkillsMarketplace(this['logger']);this[_0x34d60a(0x1c0)]&&(await this[_0x34d60a(0x1c0)][_0x34d60a(0x1c7)](),console['log'](a11_0x2ad7c6[_0x34d60a(0x163)](_0x34d60a(0x153))));if(this[_0x34d60a(0x1a9)]){await this['logger']['close']();const _0x502d26=this['logger'][_0x34d60a(0x17b)]();console[_0x34d60a(0x184)](a11_0x2ad7c6['green'](_0x34d60a(0x18c)+_0x502d26));}return this['originalSettings']&&(await restoreClaudeSettings(this[_0x34d60a(0x16b)]),console['log'](a11_0x2ad7c6[_0x34d60a(0x163)](_0x34d60a(0x1b6)))),_0x2c7bc3;}catch(_0x59fd2d){_0x265dfd&&await restoreDefaultTdSkillsMarketplace(this['logger']);this['passThroughServer']&&await this[_0x34d60a(0x1c0)][_0x34d60a(0x1c7)]();this[_0x34d60a(0x1a9)]&&await this['logger'][_0x34d60a(0x16a)]();this['originalSettings']&&await restoreClaudeSettings(this['originalSettings']);throw _0x59fd2d;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a12_0x5918c1=a12_0x3650;function a12_0x3650(_0x308867,_0x4c0c09){_0x308867=_0x308867-0x1d6;const _0xed0c4=a12_0xed0c();let _0x36502b=_0xed0c4[_0x308867];return _0x36502b;}(function(_0x2354d0,_0x1baab7){const _0x465e4c=a12_0x3650,_0x5413f7=_0x2354d0();while(!![]){try{const _0x5260e8=parseInt(_0x465e4c(0x1fa))/0x1*(parseInt(_0x465e4c(0x1da))/0x2)+parseInt(_0x465e4c(0x1d8))/0x3*(-parseInt(_0x465e4c(0x1ff))/0x4)+parseInt(_0x465e4c(0x1e3))/0x5+-parseInt(_0x465e4c(0x1f0))/0x6*(-parseInt(_0x465e4c(0x1fd))/0x7)+parseInt(_0x465e4c(0x1f8))/0x8*(parseInt(_0x465e4c(0x1ed))/0x9)+parseInt(_0x465e4c(0x1e1))/0xa*(-parseInt(_0x465e4c(0x1eb))/0xb)+-parseInt(_0x465e4c(0x1f4))/0xc;if(_0x5260e8===_0x1baab7)break;else _0x5413f7['push'](_0x5413f7['shift']());}catch(_0xcd846f){_0x5413f7['push'](_0x5413f7['shift']());}}}(a12_0xed0c,0x9af82));import{createInterface}from'node:readline';import{BaseCommand}from'./command.js';import{getUsageStats}from'../proxy/claude-usage-tracker.js';import{readCachedAccountInfo}from'../core/config.js';import{getModelDisplayName,formatTokenCount}from'../sdk/llm/model-factors.js';async function readStdinJson(_0x1183ac=0x64){return new Promise(_0x1dab80=>{const _0x1fa45c=a12_0x3650;let _0x5b9171='',_0xd0b140=![];const _0x2df24a=createInterface({'input':process[_0x1fa45c(0x1fe)],'terminal':![]}),_0x416d0c=_0x1139a5=>{const _0x383f9a=_0x1fa45c;if(_0xd0b140)return;_0xd0b140=!![],clearTimeout(_0x5e76fa),_0x2df24a[_0x383f9a(0x1fc)](),_0x1dab80(_0x1139a5);},_0x5e76fa=setTimeout(()=>{_0x416d0c(null);},_0x1183ac);_0x2df24a['on']('line',_0x4922e5=>{_0x5b9171+=_0x4922e5;}),_0x2df24a['on'](_0x1fa45c(0x1fc),()=>{const _0x179f1e=_0x1fa45c;if(_0xd0b140)return;try{const _0x49298e=JSON[_0x179f1e(0x1db)](_0x5b9171);_0x416d0c(_0x49298e);}catch{_0x416d0c(null);}});});}function formatCredits(_0x457248){const _0xeed09=a12_0x3650;return _0x457248[_0xeed09(0x1f3)](0x2);}function a12_0xed0c(){const _0x225bb9=['1959018sxEHnI','sessionCredits','43228dPbuZx','parse','cache_read_input_tokens','tdx\x20','🧠\x20','Output\x20statusline\x20for\x20Claude\x20Code\x20(reads\x20JSON\x20from\x20stdin)','🪙\x20credit:\x20','5125280sAjWMG','options','4492775YxWRxo','push','\x20today\x20/\x20','\x20session\x20/\x20','description','site','used_percentage','execute','11FdZLzK','monthCredits','9njUxhN','todayCredits','input_tokens','135006wuVurg','profile','model','toFixed','17240196aiYyJO','round','log','💎\x20','9626264SzOxaI','💎\x20tdx\x20-\x20Claude','14pRYaCr','\x20|\x20','close','259CDQloG','stdin','4ySyvKL','\x20-\x20','session_id','join','current_usage','cache_creation_input_tokens'];a12_0xed0c=function(){return _0x225bb9;};return a12_0xed0c();}export class ClaudeStatuslineCommand extends BaseCommand{['name']='statusline';[a12_0x5918c1(0x1e7)]=a12_0x5918c1(0x1df);async[a12_0x5918c1(0x1ea)](_0x3b3304){const _0x315285=a12_0x5918c1;try{const _0x3a7e83=await readStdinJson();if(!_0x3a7e83?.[_0x315285(0x201)])return console[_0x315285(0x1f6)](_0x315285(0x1f9)),0x0;const _0xb58508=_0x3a7e83[_0x315285(0x201)],_0x5b2aab=_0x3a7e83[_0x315285(0x1f2)]?.['id']||'',_0x154a27=_0x3a7e83['profile']||_0x3b3304[_0x315285(0x1e2)][_0x315285(0x1f1)],_0x57c6ab=await getUsageStats(_0xb58508,_0x154a27),_0x36c216=[],_0x6e4414=readCachedAccountInfo(_0x154a27),_0x220c8f=_0x6e4414?_0x315285(0x1dd)+_0x6e4414[_0x315285(0x1e8)]+':'+_0x6e4414['accountId']:'tdx',_0x1c0186=_0x5b2aab?getModelDisplayName(_0x5b2aab):'Claude';_0x36c216[_0x315285(0x1e4)](_0x315285(0x1f7)+_0x220c8f+_0x315285(0x200)+_0x1c0186);const _0x454974=formatCredits(_0x57c6ab[_0x315285(0x1d9)]),_0x4cd36a=formatCredits(_0x57c6ab[_0x315285(0x1ee)]),_0x1c33fa=formatCredits(_0x57c6ab[_0x315285(0x1ec)]);_0x36c216[_0x315285(0x1e4)](_0x315285(0x1e0)+_0x454974+_0x315285(0x1e6)+_0x4cd36a+_0x315285(0x1e5)+_0x1c33fa+'\x20month');const _0x3f4c40=_0x3a7e83['context_window'],_0x2073e5=_0x3f4c40?.[_0x315285(0x1d6)];if(_0x2073e5&&_0x3f4c40?.['used_percentage']!=null){const _0x3c0adb=_0x2073e5[_0x315285(0x1ef)]+_0x2073e5[_0x315285(0x1d7)]+_0x2073e5[_0x315285(0x1dc)],_0x53f56c=formatTokenCount(_0x3c0adb),_0x2be919=Math[_0x315285(0x1f5)](_0x3f4c40[_0x315285(0x1e9)]);_0x36c216[_0x315285(0x1e4)](_0x315285(0x1de)+_0x53f56c+'\x20('+_0x2be919+'%)');}return console['log'](_0x36c216[_0x315285(0x202)](_0x315285(0x1fb))),0x0;}catch{return console[_0x315285(0x1f6)]('💎\x20tdx\x20-\x20Claude'),0x0;}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a13_0x2da064=a13_0x3cc8;(function(_0x4f202e,_0x1d5380){const _0x390683=a13_0x3cc8,_0x509d08=_0x4f202e();while(!![]){try{const _0x42a527=-parseInt(_0x390683(0x1ec))/0x1+parseInt(_0x390683(0x1d7))/0x2+parseInt(_0x390683(0x1c3))/0x3+parseInt(_0x390683(0x1b7))/0x4+-parseInt(_0x390683(0x1c6))/0x5*(-parseInt(_0x390683(0x1bb))/0x6)+-parseInt(_0x390683(0x1eb))/0x7+-parseInt(_0x390683(0x1ea))/0x8*(parseInt(_0x390683(0x1ce))/0x9);if(_0x42a527===_0x1d5380)break;else _0x509d08['push'](_0x509d08['shift']());}catch(_0x2092fa){_0x509d08['push'](_0x509d08['shift']());}}}(a13_0x2bfe,0x6de84));import a13_0x2c696b from'chalk';import{BaseCommand}from'./command.js';import{handleSDKOutput}from'../core/command-output.js';import{getAllProfileStats,getAllSourceStats,getUsageSummary}from'../proxy/claude-usage-tracker.js';function formatCredits(_0x48da06){const _0x642eb7=a13_0x3cc8;return _0x48da06[_0x642eb7(0x1c2)](0x2);}function formatLastUsed(_0xabe687){const _0x423d68=a13_0x3cc8;if(!_0xabe687)return _0x423d68(0x1f6);const _0x545229=new Date(_0xabe687),_0x5e3b87=new Date(),_0x7acb1f=_0x545229[_0x423d68(0x1c5)]('en-CA'),_0x39c9d2=_0x5e3b87['toLocaleDateString'](_0x423d68(0x1d2));if(_0x7acb1f===_0x39c9d2)return _0x423d68(0x1f7)+_0x545229[_0x423d68(0x1f0)](_0x423d68(0x1cd),{'hour':_0x423d68(0x1e5),'minute':_0x423d68(0x1e5)});const _0x47e0ce=new Date(_0x7acb1f),_0x331c67=new Date(_0x39c9d2),_0x3d566d=Math[_0x423d68(0x1c7)]((_0x331c67[_0x423d68(0x1f4)]()-_0x47e0ce[_0x423d68(0x1f4)]())/(0x18*0x3c*0x3c*0x3e8));if(_0x3d566d===0x1)return _0x423d68(0x1e1);else return _0x3d566d>0x1&&_0x3d566d<0x7?_0x3d566d+_0x423d68(0x1c0):_0x545229['toLocaleDateString'](_0x423d68(0x1cd),{'month':_0x423d68(0x1f5),'day':_0x423d68(0x1be)});}function a13_0x3cc8(_0x32d85e,_0x1afe13){_0x32d85e=_0x32d85e-0x1b7;const _0x2bfeb6=a13_0x2bfe();let _0x3cc89e=_0x2bfeb6[_0x32d85e];return _0x3cc89e;}export class ClaudeUsageCommand extends BaseCommand{[a13_0x2da064(0x1df)]=a13_0x2da064(0x1f2);[a13_0x2da064(0x1e9)]='Show\x20AI\x20Suite\x20credit\x20usage\x20by\x20profile';async[a13_0x2da064(0x1ba)](_0x2e0ae0){const _0x36993d=a13_0x2da064,{options:_0x102f58}=_0x2e0ae0,_0x298588=_0x102f58[_0x36993d(0x1e6)]===_0x36993d(0x1cc)||_0x102f58[_0x36993d(0x1e6)]==='jsonl'||_0x102f58[_0x36993d(0x1cc)];try{const [_0x2b0b8a,_0x58a4f3,_0x9b6b12]=await Promise[_0x36993d(0x1c8)]([getAllProfileStats(),getAllSourceStats(),getUsageSummary()]);return _0x298588?await this[_0x36993d(0x1d3)](_0x2b0b8a,_0x58a4f3,_0x9b6b12,_0x102f58):this[_0x36993d(0x1d6)](_0x2b0b8a,_0x58a4f3,_0x9b6b12),0x0;}catch(_0x38a92){const _0x2c3306=_0x38a92 instanceof Error?_0x38a92['message']:_0x36993d(0x1d1);return console[_0x36993d(0x1e8)](a13_0x2c696b[_0x36993d(0x1d8)](_0x36993d(0x1e3)+_0x2c3306)),0x1;}}async[a13_0x2da064(0x1d3)](_0x1f3e59,_0x20fadf,_0x21ce8b,_0x118ac7){const _0x18ebbb=a13_0x2da064,_0x16bd1e={'summary':{'todayCredits':_0x21ce8b['todayCredits'],'monthCredits':_0x21ce8b[_0x18ebbb(0x1b9)],'totalCredits':_0x21ce8b[_0x18ebbb(0x1ee)],'profileCount':_0x21ce8b['profileCount']},'profiles':_0x1f3e59[_0x18ebbb(0x1cb)](_0x404f40=>({'profile':_0x404f40[_0x18ebbb(0x1c4)],'credits':_0x404f40[_0x18ebbb(0x1c9)],'requests':_0x404f40[_0x18ebbb(0x1bc)],'lastUsedAt':_0x404f40[_0x18ebbb(0x1de)]})),'sources':_0x20fadf['map'](_0x31240c=>({'source':_0x31240c[_0x18ebbb(0x1bd)],'credits':_0x31240c['credits'],'todayCredits':_0x31240c[_0x18ebbb(0x1f1)],'monthCredits':_0x31240c[_0x18ebbb(0x1b9)],'requests':_0x31240c[_0x18ebbb(0x1bc)]}))};await handleSDKOutput([_0x16bd1e],_0x118ac7);}[a13_0x2da064(0x1d6)](_0x2baaba,_0x3a3b39,_0x54856a){const _0x15b88d=a13_0x2da064;console[_0x15b88d(0x1f8)](a13_0x2c696b[_0x15b88d(0x1ef)](_0x15b88d(0x1e7))),console[_0x15b88d(0x1f8)](a13_0x2c696b['dim']('─'['repeat'](0x32))),console[_0x15b88d(0x1f8)](_0x15b88d(0x1bf)+a13_0x2c696b[_0x15b88d(0x1cf)](formatCredits(_0x54856a[_0x15b88d(0x1f1)]))+_0x15b88d(0x1e4)),console[_0x15b88d(0x1f8)]('\x20\x20Month:\x20\x20\x20'+a13_0x2c696b[_0x15b88d(0x1cf)](formatCredits(_0x54856a[_0x15b88d(0x1b9)]))+_0x15b88d(0x1e4)),console[_0x15b88d(0x1f8)](_0x15b88d(0x1ed)+a13_0x2c696b[_0x15b88d(0x1cf)](formatCredits(_0x54856a[_0x15b88d(0x1ee)]))+_0x15b88d(0x1e4)),console[_0x15b88d(0x1f8)]();if(_0x3a3b39['length']>0x0){console[_0x15b88d(0x1f8)](a13_0x2c696b[_0x15b88d(0x1ef)](_0x15b88d(0x1d4))),console[_0x15b88d(0x1f8)](a13_0x2c696b[_0x15b88d(0x1b8)]('─'['repeat'](0x3c)));const _0x4b3c22=0xc,_0x2879e9=0xa,_0x41071f=0xa,_0x34406d=0xa;console[_0x15b88d(0x1f8)]('\x20\x20'+_0x15b88d(0x1d9)[_0x15b88d(0x1dd)](_0x4b3c22)+'\x20\x20'+'Total'['padStart'](_0x2879e9)+'\x20\x20'+_0x15b88d(0x1d5)[_0x15b88d(0x1da)](_0x41071f)+'\x20\x20'+'Month'['padStart'](_0x34406d));for(const _0x3620a6 of _0x3a3b39){console['log']('\x20\x20'+_0x3620a6['source'][_0x15b88d(0x1dd)](_0x4b3c22)+'\x20\x20'+a13_0x2c696b[_0x15b88d(0x1cf)](formatCredits(_0x3620a6['credits'])[_0x15b88d(0x1da)](_0x2879e9))+'\x20\x20'+formatCredits(_0x3620a6['todayCredits'])[_0x15b88d(0x1da)](_0x41071f)+'\x20\x20'+formatCredits(_0x3620a6['monthCredits'])[_0x15b88d(0x1da)](_0x34406d));}console[_0x15b88d(0x1f8)]();}if(_0x2baaba[_0x15b88d(0x1e0)]===0x0){console[_0x15b88d(0x1f8)](a13_0x2c696b['dim'](_0x15b88d(0x1d0))),console[_0x15b88d(0x1f8)](a13_0x2c696b['dim']('\x20\x20Run\x20\x22tdx\x20claude\x22\x20to\x20start\x20using\x20AI\x20Suite.\x0a'));return;}console[_0x15b88d(0x1f8)](a13_0x2c696b[_0x15b88d(0x1ef)]('Usage\x20by\x20Profile')),console[_0x15b88d(0x1f8)](a13_0x2c696b[_0x15b88d(0x1b8)]('─'[_0x15b88d(0x1ca)](0x3c)));const _0x3d412d=Math['max'](0xc,..._0x2baaba['map'](_0x562a60=>_0x562a60[_0x15b88d(0x1c4)]===_0x15b88d(0x1f3)?_0x15b88d(0x1c1)['length']:_0x562a60['profile']['length'])),_0x2269d5=0xa,_0xdf4b68=0xa;console['log']('\x20\x20'+_0x15b88d(0x1db)[_0x15b88d(0x1dd)](_0x3d412d)+'\x20\x20'+_0x15b88d(0x1e2)[_0x15b88d(0x1da)](_0x2269d5)+'\x20\x20'+'Requests'[_0x15b88d(0x1da)](_0xdf4b68)+'\x20\x20'+_0x15b88d(0x1dc));for(const _0x18684c of _0x2baaba){const _0xa97e5d=_0x18684c['profile']===_0x15b88d(0x1f3)?_0x15b88d(0x1c1):_0x18684c[_0x15b88d(0x1c4)],_0x60f640=_0xa97e5d[_0x15b88d(0x1dd)](_0x3d412d),_0x109b67=_0x18684c[_0x15b88d(0x1c4)]===_0x15b88d(0x1f3)?a13_0x2c696b['dim'](_0x60f640):_0x60f640;console[_0x15b88d(0x1f8)]('\x20\x20'+_0x109b67+'\x20\x20'+a13_0x2c696b[_0x15b88d(0x1cf)](formatCredits(_0x18684c[_0x15b88d(0x1c9)])[_0x15b88d(0x1da)](_0x2269d5))+'\x20\x20'+String(_0x18684c['entryCount'])[_0x15b88d(0x1da)](_0xdf4b68)+'\x20\x20'+a13_0x2c696b['dim'](formatLastUsed(_0x18684c[_0x15b88d(0x1de)])));}console[_0x15b88d(0x1f8)](),console[_0x15b88d(0x1f8)](a13_0x2c696b[_0x15b88d(0x1b8)]('Note:\x20Credit\x20values\x20are\x20estimates\x20based\x20on\x20token\x20usage.')),console[_0x15b88d(0x1f8)]();}}function a13_0x2bfe(){const _0x196371=['1313838nEAJLY','red','Source','padStart','Profile','Last\x20Used','padEnd','lastUsedAt','name','length','yesterday','Credits','Error:\x20','\x20credits','2-digit','format','\x0aAI\x20Suite\x20Credit\x20Usage\x20Summary','error','description','1622584ZEsKfi','4321814sesTrp','551905KmCADO','\x20\x20Total:\x20\x20\x20','totalCredits','bold','toLocaleTimeString','todayCredits','usage','default','getTime','short','never','today\x20','log','2628352ngnJmZ','dim','monthCredits','execute','66WxYxsq','entryCount','source','numeric','\x20\x20Today:\x20\x20\x20','\x20days\x20ago','(default)','toFixed','117492SmgoYl','profile','toLocaleDateString','213245pUuugK','round','all','credits','repeat','map','json','en-US','9oHclTK','cyan','\x20\x20No\x20usage\x20data\x20recorded\x20yet.','Unknown\x20error','en-CA','outputStructured','Usage\x20by\x20Source','Today','outputTable'];a13_0x2bfe=function(){return _0x196371;};return a13_0x2bfe();}
|
package/dist/commands/command.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a14_0x5e80d5=a14_0x6b33;(function(_0x5c52db,_0x3081b7){const _0x18971f=a14_0x6b33,_0x31f7f8=_0x5c52db();while(!![]){try{const _0x11dc7f=-parseInt(_0x18971f(0xa6))/0x1*(-parseInt(_0x18971f(0x94))/0x2)+-parseInt(_0x18971f(0xbd))/0x3+-parseInt(_0x18971f(0xc0))/0x4*(parseInt(_0x18971f(0xb6))/0x5)+-parseInt(_0x18971f(0xc3))/0x6+parseInt(_0x18971f(0xb3))/0x7*(parseInt(_0x18971f(0xb5))/0x8)+-parseInt(_0x18971f(0xa5))/0x9+parseInt(_0x18971f(0xaf))/0xa;if(_0x11dc7f===_0x3081b7)break;else _0x31f7f8['push'](_0x31f7f8['shift']());}catch(_0x30843d){_0x31f7f8['push'](_0x31f7f8['shift']());}}}(a14_0x187e,0x24f6c));import{validateLimitOption}from'../utils/option-validation.js';import{HTTPClientError}from'../sdk/client/http-client.js';import{SDKError,ErrorCategory}from'../sdk/errors.js';import{Logger}from'../utils/logger/index.js';import a14_0x2194f2 from'chalk';export function printAuthError(_0x5b2ed8,_0x256438=![],_0x4eea86){const _0x186eec=a14_0x6b33,_0x34e5b9=_0x5b2ed8[_0x186eec(0xba)]?.[_0x186eec(0xa9)]||_0x5b2ed8['message'];console[_0x186eec(0xb0)](a14_0x2194f2[_0x186eec(0xad)](_0x186eec(0xbe))),console[_0x186eec(0xb0)](a14_0x2194f2[_0x186eec(0xad)](_0x186eec(0x9a)+_0x34e5b9));if(_0x256438){const _0x21b216=_0x4eea86?'\x20--profile\x20'+_0x4eea86:'';console[_0x186eec(0xb0)]('\x0a'+a14_0x2194f2[_0x186eec(0xbc)]('To\x20set\x20up\x20authentication:')),console['error']('\x20\x20'+a14_0x2194f2[_0x186eec(0xc1)](_0x186eec(0xa8)+_0x21b216)+'\x0a'),console[_0x186eec(0xb0)](''+a14_0x2194f2[_0x186eec(0xbc)](_0x186eec(0x96))),console[_0x186eec(0xb0)]('\x20\x20'+a14_0x2194f2[_0x186eec(0xc1)](_0x186eec(0xbb)+_0x21b216));}}export class BaseCommand{[a14_0x5e80d5(0xa4)](_0x50c762){const _0x55debd=a14_0x5e80d5,{options:_0x38ad2e}=_0x50c762,_0x20d2dc=_0x38ad2e[_0x55debd(0xb7)];if(_0x20d2dc!==undefined){const _0x4e2304=typeof _0x20d2dc===_0x55debd(0xc4)?_0x20d2dc:parseInt(_0x20d2dc,0xa);if(isNaN(_0x4e2304))return'Invalid\x20limit\x20value:\x20'+_0x20d2dc+_0x55debd(0xa2);const _0x10ba5e=validateLimitOption(_0x4e2304);if(!_0x10ba5e[_0x55debd(0xb1)])return _0x10ba5e[_0x55debd(0xb0)];_0x50c762['options'][_0x55debd(0xb7)]=_0x10ba5e['value'];}return undefined;}[a14_0x5e80d5(0x9b)](_0x4073a2){return undefined;}async[a14_0x5e80d5(0x9f)](_0x93298b){const _0x2f3728=a14_0x5e80d5;try{const _0x3c818f=this['validateGlobalOptions'](_0x93298b);if(_0x3c818f)return console['error']('Error:\x20'+_0x3c818f),0x1;const _0x11c6e9=this[_0x2f3728(0x9b)](_0x93298b);if(_0x11c6e9){const _0x12aa53=/^\s*(Usage|Note|Warning|Error):/i[_0x2f3728(0x98)](_0x11c6e9);return _0x12aa53?console[_0x2f3728(0xb0)](_0x11c6e9):console['error'](_0x2f3728(0xae)+_0x11c6e9),0x1;}const _0x223952=await this[_0x2f3728(0xa0)](_0x93298b);return _0x223952??0x0;}catch(_0x46982c){if(_0x46982c instanceof Error){if(_0x46982c instanceof HTTPClientError&&_0x46982c[_0x2f3728(0xb8)]===0x191){const _0x1b0494=_0x93298b['options']['profile'];printAuthError(_0x46982c,!![],_0x1b0494);if(_0x46982c['stack']){const _0x4abefd=Logger['of'](_0x2f3728(0xa7));_0x4abefd[_0x2f3728(0xa1)]('Authentication\x20error\x20stack\x20trace:'),_0x4abefd[_0x2f3728(0xa1)](_0x46982c['stack']);}return 0x1;}console[_0x2f3728(0xb0)](a14_0x2194f2[_0x2f3728(0xad)]('Error:\x20'+_0x46982c[_0x2f3728(0xab)]));_0x46982c instanceof SDKError&&_0x46982c[_0x2f3728(0xa3)]&&console[_0x2f3728(0xb0)](a14_0x2194f2[_0x2f3728(0xb4)](_0x46982c[_0x2f3728(0xa3)]));const _0x285d78=_0x46982c instanceof SDKError&&_0x46982c[_0x2f3728(0x9c)]===ErrorCategory[_0x2f3728(0xc2)];_0x46982c[_0x2f3728(0x9e)]&&!_0x285d78&&console[_0x2f3728(0xb0)](_0x2f3728(0x99)+_0x46982c[_0x2f3728(0x9e)]);}else console[_0x2f3728(0xb0)]('Error:\x20'+String(_0x46982c));return 0x1;}}}function a14_0x187e(){const _0x28429a=['isValid','getAll','2191adSASm','yellow','4528ZNlYOk','1441130ZAvCxy','limit','status','name','problemDetails','tdx\x20auth','dim','204741SLOjHq','Authentication\x20failed','get','4bTmjDh','cyan','USER_ERROR','474336kHNABZ','number','2YmftMb','commands','To\x20check\x20your\x20current\x20auth\x20status:','register','test','\x0aStack\x20trace:\x0a','Reason:\x20','validate','category','from','stack','run','execute','debug','.\x20Must\x20be\x20a\x20number.','helpText','validateGlobalOptions','279504ZNmEmJ','86410UuaYvY','command','tdx\x20auth\x20setup','detail','\x27\x20is\x20already\x20registered','message','has','red','Error:\x20','3544210aoKBfA','error'];a14_0x187e=function(){return _0x28429a;};return a14_0x187e();}export class CommandRegistry{[a14_0x5e80d5(0x95)]=new Map();[a14_0x5e80d5(0x97)](_0x5c14db){const _0x7b23de=a14_0x5e80d5;if(this[_0x7b23de(0x95)][_0x7b23de(0xac)](_0x5c14db['name']))throw new Error('Command\x20\x27'+_0x5c14db[_0x7b23de(0xb9)]+_0x7b23de(0xaa));this[_0x7b23de(0x95)]['set'](_0x5c14db[_0x7b23de(0xb9)],_0x5c14db);}[a14_0x5e80d5(0xbf)](_0x51601b){const _0x5e626b=a14_0x5e80d5;return this[_0x5e626b(0x95)][_0x5e626b(0xbf)](_0x51601b);}[a14_0x5e80d5(0xb2)](){const _0x571a80=a14_0x5e80d5;return Array[_0x571a80(0x9d)](this['commands']['values']());}[a14_0x5e80d5(0xac)](_0xca40ec){const _0x2ac0e4=a14_0x5e80d5;return this['commands'][_0x2ac0e4(0xac)](_0xca40ec);}}function a14_0x6b33(_0xabf481,_0xc604ea){_0xabf481=_0xabf481-0x94;const _0x187e34=a14_0x187e();let _0x6b3322=_0x187e34[_0xabf481];return _0x6b3322;}export const registry=new CommandRegistry();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a15_0x46af76=a15_0x2214;(function(_0x19c640,_0x5ce454){const _0x205b87=a15_0x2214,_0x2971c5=_0x19c640();while(!![]){try{const _0x3102f3=parseInt(_0x205b87(0xdb))/0x1*(-parseInt(_0x205b87(0xfb))/0x2)+parseInt(_0x205b87(0xb1))/0x3+parseInt(_0x205b87(0xe9))/0x4+parseInt(_0x205b87(0x99))/0x5+parseInt(_0x205b87(0xb3))/0x6*(parseInt(_0x205b87(0xb2))/0x7)+-parseInt(_0x205b87(0xc3))/0x8+parseInt(_0x205b87(0x106))/0x9*(parseInt(_0x205b87(0xa1))/0xa);if(_0x3102f3===_0x5ce454)break;else _0x2971c5['push'](_0x2971c5['shift']());}catch(_0xfc1f5e){_0x2971c5['push'](_0x2971c5['shift']());}}}(a15_0x3fe2,0x3fbfc));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';function a15_0x2214(_0x2c4b78,_0x14d557){_0x2c4b78=_0x2c4b78-0x98;const _0x3fe27b=a15_0x3fe2();let _0x221412=_0x3fe27b[_0x2c4b78];return _0x221412;}import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../core/constants.js';function a15_0x3fe2(){const _0x35dadc=['name','log','\x27\x20as\x20connector\x20type','object','40tiFold','connection:types','Options:\x20','connection:schema','Show\x20connector\x20output\x20schema\x20for\x20connector_config\x20validation','verbose','criteria','properties','Show\x20connection-level\x20settings\x20(credentials,\x20authentication)','>=\x20','join','repeat','✔\x20Found\x20','Show\x20connection\x20details','bold','getMetadata','262146hiTlzf','7nJeYfV','468738Fvpxdp','table','hint','listTypes','connection:list','entries','options','data','resolve','owner','type','cyan','length','\x20\x20\x20\x20','label','Usage:\x20tdx\x20connection\x20settings\x20<type>\x0a\x0aArguments:\x0a\x20\x20<type>\x20\x20\x20\x20Connector\x20type\x20(e.g.,\x20\x27salesforce\x27,\x20\x27rest\x27,\x20\x27s3\x27)\x0a\x0aExamples:\x0a\x20\x20tdx\x20connection\x20settings\x20rest\x0a\x20\x20tdx\x20connection\x20settings\x20salesforce\x0a\x20\x20tdx\x20connection\x20settings\x20s3\x0a\x0aNote:\x20This\x20shows\x20settings\x20for\x20creating/configuring\x20a\x20connection.\x0aFor\x20activation\x20output\x20settings,\x20use\x20\x27tdx\x20connection\x20schema\x20<type>\x27.\x0aUse\x20\x27tdx\x20connection\x20types\x27\x20to\x20list\x20available\x20connector\x20types.','2705664ukbdrB','Site:\x20','Type:\x20','blue','✔\x20Found\x20schema\x20for\x20connection\x20\x27','connection:show','\x0aConnector:\x20','✔\x20Found\x20connection:\x20','legacy_settings','title','\x20connector\x20type','Listing\x20connector\x20types...','Name:\x20','execute','dim','List\x20available\x20connector\x20types','map','yellow','stringify','\x27\x20as\x20connection\x20name\x20→\x20type:\x20','connection','Show\x20when:\x20','✔\x20Found\x20settings\x20for\x20connector\x20type:\x20','enumeration','3zMowpT','\x27...','Looking\x20up\x20connection:\x20','validate','error','findByName','limit','\x20\x20\x20\x20Options:\x20','\x20-\x20','\x0aNo\x20credential\x20settings\x20defined','max','\x20connection','description','Usage:\x20tdx\x20connection\x20schema\x20<type-or-name>\x0a\x0aArguments:\x0a\x20\x20<type-or-name>\x20\x20\x20\x20Connector\x20type\x20(e.g.,\x20\x27salesforce\x27,\x20\x27pgsql\x27,\x20\x27s3\x27)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20or\x20connection\x20name\x20(e.g.,\x20\x27my-salesforce-connection\x27)\x0a\x0aExamples:\x0a\x20\x20tdx\x20connection\x20schema\x20salesforce\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20By\x20connector\x20type\x0a\x20\x20tdx\x20connection\x20schema\x20my-s3-connection\x20\x20\x20\x20\x20#\x20By\x20connection\x20name\x0a\x20\x20tdx\x20connection\x20schema\x20pgsql\x0a\x0aUse\x20\x27tdx\x20connection\x20types\x27\x20to\x20list\x20available\x20connector\x20types.\x0aUse\x20\x27tdx\x20connection\x20list\x27\x20to\x20list\x20available\x20connections.','1549656wIvYLN','padStart','input','credential','hidden','\x20\x20\x20\x20Default:\x20','legacy','record','maximum','\x20[record]','\x0aAvailable\x20fields:','Default:\x20','\x0aCredential\x20settings:','localeCompare','default_value','\x0aNo\x20fields\x20defined\x20in\x20schema','filter','Listing\x20connections...','279878rjkBwJ','site','Resolving\x20connector\x20type\x20or\x20name:\x20','connection:settings','Treating\x20\x27','push','minimum','Fetching\x20schema\x20for\x20\x27','output','green','value','110286xlPoJm','getOutputSchema','Fetching\x20connection\x20\x27','2086030MghcFp','✔\x20Resolved\x20\x27','Fetching\x20settings\x20for\x20connector\x20type:\x20','Usage:\x20tdx\x20connection\x20show\x20<name>\x0a\x0aArguments:\x0a\x20\x20<name>\x20\x20\x20\x20Connection\x20name\x0a\x0aExamples:\x0a\x20\x20tdx\x20connection\x20show\x20my-s3-connection\x0a\x20\x20tdx\x20connection\x20show\x20\x22My\x20Salesforce\x20Connection\x22'];a15_0x3fe2=function(){return _0x35dadc;};return a15_0x3fe2();}import a15_0x1f3233 from'chalk';function normalizeSchemaForDisplay(_0x3073c5){const _0x4c11b2=a15_0x2214,_0x5db87f=_0x3073c5[_0x4c11b2(0xa8)]||[],_0x314e17=_0x5db87f['find'](_0xf0a6e2=>_0xf0a6e2[_0x4c11b2(0x9d)]===_0x4c11b2(0xcb)&&_0xf0a6e2[_0x4c11b2(0xbd)]===_0x4c11b2(0xf0)&&_0xf0a6e2[_0x4c11b2(0xa8)]);if(_0x314e17?.[_0x4c11b2(0xa8)]){const _0x59834a=_0x5db87f[_0x4c11b2(0xf9)](_0x69e23c=>_0x69e23c['name']!=='legacy'&&_0x69e23c[_0x4c11b2(0x9d)]!==_0x4c11b2(0xcb));return[..._0x59834a,..._0x314e17[_0x4c11b2(0xa8)]];}return _0x5db87f[_0x4c11b2(0xf9)](_0x5a9832=>_0x5a9832['name']!==_0x4c11b2(0xef));}function printSchemaFields(_0x1006c4,_0x42827a){const _0x212c08=a15_0x2214,_0x1eb39b='\x20\x20'[_0x212c08(0xac)](_0x42827a+0x1),_0x4742df='\x20\x20'[_0x212c08(0xac)](_0x42827a+0x2);for(const _0x46524c of _0x1006c4){if(!_0x46524c[_0x212c08(0x9d)])continue;const _0x19beef=_0x46524c[_0x212c08(0xbd)]===_0x212c08(0xf0)&&_0x46524c[_0x212c08(0xa8)]&&_0x46524c[_0x212c08(0xa8)][_0x212c08(0xbf)]>0x0&&_0x46524c[_0x212c08(0x9d)]!=='legacy_settings';let _0x1a5fb4=''+_0x1eb39b+a15_0x1f3233[_0x212c08(0x104)](_0x46524c[_0x212c08(0x9d)]);_0x46524c[_0x212c08(0xcc)]&&(_0x1a5fb4+=':\x20'+_0x46524c['title']);if(_0x46524c[_0x212c08(0xeb)])_0x1a5fb4+=a15_0x1f3233[_0x212c08(0xd1)]('\x20['+_0x46524c[_0x212c08(0xeb)]+']');else _0x19beef&&(_0x1a5fb4+=a15_0x1f3233[_0x212c08(0xd1)](_0x212c08(0xf2)));console[_0x212c08(0x9e)](_0x1a5fb4);_0x46524c[_0x212c08(0xe7)]&&console[_0x212c08(0x9e)](''+_0x4742df+a15_0x1f3233[_0x212c08(0xd1)](_0x46524c[_0x212c08(0xe7)]));if(_0x46524c[_0x212c08(0xda)]){const _0x4a80c3=_0x46524c[_0x212c08(0xda)][_0x212c08(0xd3)](_0x5df0ab=>typeof _0x5df0ab===_0x212c08(0xa0)&&'value'in _0x5df0ab?_0x5df0ab[_0x212c08(0x105)]:_0x5df0ab)['join'](',\x20');console[_0x212c08(0x9e)](_0x4742df+_0x212c08(0xa3)+a15_0x1f3233[_0x212c08(0xd4)](_0x4a80c3));}_0x46524c[_0x212c08(0xf7)]!==undefined&&console[_0x212c08(0x9e)](_0x4742df+_0x212c08(0xf4)+a15_0x1f3233[_0x212c08(0xc6)](String(_0x46524c[_0x212c08(0xf7)])));if(_0x46524c['minimum']!==undefined||_0x46524c['maximum']!==undefined){const _0x44277e=_0x46524c[_0x212c08(0x101)]!==undefined&&_0x46524c[_0x212c08(0xf1)]!==undefined?_0x46524c[_0x212c08(0x101)]+_0x212c08(0xe3)+_0x46524c['maximum']:_0x46524c[_0x212c08(0x101)]!==undefined?_0x212c08(0xaa)+_0x46524c['minimum']:'<=\x20'+_0x46524c['maximum'];console[_0x212c08(0x9e)](_0x4742df+'Range:\x20'+a15_0x1f3233[_0x212c08(0xc6)](_0x44277e));}if(_0x46524c['criteria']){const _0x199ed8=Object[_0x212c08(0xb8)](_0x46524c[_0x212c08(0xa7)])[_0x212c08(0xd3)](([_0x33569b,_0x343d6c])=>_0x33569b+'='+JSON['stringify'](_0x343d6c))[_0x212c08(0xab)](',\x20');console[_0x212c08(0x9e)](''+_0x4742df+a15_0x1f3233[_0x212c08(0xd1)](_0x212c08(0xd8)+_0x199ed8));}_0x19beef&&_0x46524c[_0x212c08(0xa8)]&&printSchemaFields(_0x46524c[_0x212c08(0xa8)],_0x42827a+0x1);}}export class ConnectionListCommand extends BaseCommand{[a15_0x46af76(0x9d)]=a15_0x46af76(0xb7);[a15_0x46af76(0xe7)]='List\x20all\x20result\x20output\x20connections';async['execute'](_0x40ed6b){const _0x3d373e=a15_0x46af76,{options:_0x5e05ea,tdx:_0x7c1244}=_0x40ed6b;_0x5e05ea[_0x3d373e(0xa6)]&&console[_0x3d373e(0xdf)](_0x3d373e(0xc4)+_0x5e05ea[_0x3d373e(0xfc)]);const _0x16eb42=resolveLimit(_0x5e05ea[_0x3d373e(0xe1)],DEFAULT_LISTING_LIMIT),_0xe74e45=await withSpinner(_0x3d373e(0xfa),()=>_0x7c1244[_0x3d373e(0xd7)]['list'](),{'verbose':_0x5e05ea[_0x3d373e(0xa6)]}),_0x17ae40=_0xe74e45[_0x3d373e(0xba)];console[_0x3d373e(0xdf)](_0x3d373e(0xad)+_0x17ae40['length']+_0x3d373e(0xe6)+(_0x17ae40[_0x3d373e(0xbf)]!==0x1?'s':''));if(isStructuredFormat(_0x5e05ea)){const _0x18eb42=_0x17ae40['slice'](0x0,_0x16eb42);await handleSDKOutput(_0x18eb42,{..._0x5e05ea,'limit':_0x16eb42});}else{const _0x49a2d5=_0x17ae40['length']>0x0?Math[_0x3d373e(0xe5)](..._0x17ae40[_0x3d373e(0xd3)](_0xff104e=>_0xff104e[_0x3d373e(0xbd)][_0x3d373e(0xbf)])):0x0,_0x5ef766=[];for(const _0x419aa5 of _0x17ae40){const _0x40711e=a15_0x1f3233[_0x3d373e(0xbe)](_0x419aa5[_0x3d373e(0xbd)]['padStart'](_0x49a2d5)),_0x286736=_0x419aa5[_0x3d373e(0xbc)]?.[_0x3d373e(0x9d)]?_0x3d373e(0xe3)+a15_0x1f3233[_0x3d373e(0xd1)](_0x419aa5['owner'][_0x3d373e(0x9d)]):'';_0x5ef766[_0x3d373e(0x100)](_0x40711e+'\x20\x20'+_0x419aa5[_0x3d373e(0x9d)]+_0x286736);}await writeOutput(_0x5ef766['join']('\x0a'),_0x5e05ea['output'],_0x3d373e(0xb4));}return 0x0;}}export class ConnectionShowCommand extends BaseCommand{[a15_0x46af76(0x9d)]=a15_0x46af76(0xc8);[a15_0x46af76(0xe7)]=a15_0x46af76(0xae);['validate'](_0x17f998){const _0x11ec52=a15_0x46af76,{args:_0x27d3b3}=_0x17f998;if(!_0x27d3b3[0x0])return _0x11ec52(0x9c);return undefined;}async[a15_0x46af76(0xd0)](_0x67d553){const _0x22a146=a15_0x46af76,{options:_0x5ad781,args:_0x4a04e3,tdx:_0x46d693}=_0x67d553,_0x481b48=_0x4a04e3[0x0];_0x5ad781[_0x22a146(0xa6)]&&(console[_0x22a146(0xdf)]('Site:\x20'+_0x5ad781['site']),console['error'](_0x22a146(0xdd)+_0x481b48));const _0x2f3917=await withSpinner(_0x22a146(0x98)+_0x481b48+_0x22a146(0xdc),()=>_0x46d693[_0x22a146(0xd7)][_0x22a146(0xbb)](_0x481b48),{'verbose':_0x5ad781[_0x22a146(0xa6)]}),_0x564e7e=_0x2f3917[_0x22a146(0xba)];return console[_0x22a146(0xdf)](_0x22a146(0xca)+_0x564e7e['name']),await handleSingleObjectOutput(_0x564e7e,_0x5ad781),0x0;}}export class ConnectionSchemaCommand extends BaseCommand{['name']=a15_0x46af76(0xa4);['description']=a15_0x46af76(0xa5);[a15_0x46af76(0xde)](_0x1aeddb){const _0x8fa772=a15_0x46af76,{args:_0x1d36e4}=_0x1aeddb;if(!_0x1d36e4[0x0])return _0x8fa772(0xe8);return undefined;}async[a15_0x46af76(0xd0)](_0x341589){const _0x499f17=a15_0x46af76,{options:_0x30dbc8,args:_0x46604f,tdx:_0x30f8e5}=_0x341589,_0x537fad=_0x46604f[0x0];_0x30dbc8[_0x499f17(0xa6)]&&(console[_0x499f17(0xdf)](_0x499f17(0xc4)+_0x30dbc8[_0x499f17(0xfc)]),console[_0x499f17(0xdf)](_0x499f17(0xfd)+_0x537fad));let _0x3a7878=_0x537fad,_0x3f742a;try{const _0x3f942d=await _0x30f8e5[_0x499f17(0xd7)][_0x499f17(0xe0)](_0x537fad);_0x3f942d&&(_0x3a7878=_0x3f942d['type'],_0x3f742a=_0x3f942d[_0x499f17(0x9d)],_0x30dbc8[_0x499f17(0xa6)]&&console['error'](_0x499f17(0x9a)+_0x537fad+_0x499f17(0xd6)+_0x3a7878));}catch{_0x30dbc8[_0x499f17(0xa6)]&&console[_0x499f17(0xdf)](_0x499f17(0xff)+_0x537fad+_0x499f17(0x9f));}const _0x8ee477=await withSpinner(_0x499f17(0x102)+_0x3a7878+_0x499f17(0xdc),()=>_0x30f8e5[_0x499f17(0xd7)][_0x499f17(0x107)](_0x3a7878),{'verbose':_0x30dbc8[_0x499f17(0xa6)]}),_0x5eb2d9=_0x8ee477[_0x499f17(0xba)];_0x3f742a?console[_0x499f17(0xdf)](_0x499f17(0xc7)+_0x3f742a+'\x27\x20(type:\x20'+_0x3a7878+')'):console['error']('✔\x20Found\x20schema\x20for\x20connector\x20type:\x20'+_0x3a7878);if(isStructuredFormat(_0x30dbc8))await handleSingleObjectOutput(_0x5eb2d9,_0x30dbc8);else{const _0x556d56=normalizeSchemaForDisplay(_0x5eb2d9);_0x3f742a?(console[_0x499f17(0x9e)]('\x0aConnection:\x20'+a15_0x1f3233['cyan'](_0x3f742a)),console[_0x499f17(0x9e)](_0x499f17(0xc5)+a15_0x1f3233[_0x499f17(0xd1)](_0x3a7878))):console[_0x499f17(0x9e)](_0x499f17(0xc9)+a15_0x1f3233[_0x499f17(0xbe)](_0x3a7878)),_0x556d56['length']>0x0?(console['log'](a15_0x1f3233[_0x499f17(0xaf)]('\x0aAvailable\x20fields:')),printSchemaFields(_0x556d56,0x0)):console[_0x499f17(0x9e)](a15_0x1f3233['dim'](_0x499f17(0xf8)));}return 0x0;}}export class ConnectionTypesCommand extends BaseCommand{[a15_0x46af76(0x9d)]=a15_0x46af76(0xa2);[a15_0x46af76(0xe7)]=a15_0x46af76(0xd2);async[a15_0x46af76(0xd0)](_0x3f6e1f){const _0xa9f37d=a15_0x46af76,{options:_0x103673,tdx:_0x3f99a7}=_0x3f6e1f;_0x103673[_0xa9f37d(0xa6)]&&console[_0xa9f37d(0xdf)]('Site:\x20'+_0x103673['site']);const _0x2d02f5=await withSpinner(_0xa9f37d(0xce),()=>_0x3f99a7[_0xa9f37d(0xd7)][_0xa9f37d(0xb6)](),{'verbose':_0x103673[_0xa9f37d(0xa6)]}),_0x175411=_0x2d02f5[_0xa9f37d(0xba)]['sort']((_0xa9f56d,_0x52b36c)=>_0xa9f56d['type'][_0xa9f37d(0xf6)](_0x52b36c[_0xa9f37d(0xbd)]));console['error']('✔\x20Found\x20'+_0x175411[_0xa9f37d(0xbf)]+_0xa9f37d(0xcd)+(_0x175411[_0xa9f37d(0xbf)]!==0x1?'s':''));if(isStructuredFormat(_0x103673))await handleSDKOutput(_0x175411,_0x103673);else{const _0x1a474a=_0x175411[_0xa9f37d(0xbf)]>0x0?Math[_0xa9f37d(0xe5)](..._0x175411[_0xa9f37d(0xd3)](_0x51dad3=>_0x51dad3[_0xa9f37d(0xbd)][_0xa9f37d(0xbf)])):0x0,_0x4fa862=[];for(const _0x324a6c of _0x175411){const _0x1d447b=a15_0x1f3233[_0xa9f37d(0xbe)](_0x324a6c[_0xa9f37d(0xbd)][_0xa9f37d(0xea)](_0x1a474a));_0x4fa862[_0xa9f37d(0x100)](_0x1d447b+'\x20\x20'+_0x324a6c[_0xa9f37d(0x9d)]);}await writeOutput(_0x4fa862[_0xa9f37d(0xab)]('\x0a'),_0x103673[_0xa9f37d(0x103)],_0xa9f37d(0xb4));}return 0x0;}}export class ConnectionSettingsCommand extends BaseCommand{[a15_0x46af76(0x9d)]=a15_0x46af76(0xfe);['description']=a15_0x46af76(0xa9);[a15_0x46af76(0xde)](_0xcc0636){const _0x5ebf98=a15_0x46af76,{args:_0x2d196e}=_0xcc0636;if(!_0x2d196e[0x0])return _0x5ebf98(0xc2);return undefined;}async[a15_0x46af76(0xd0)](_0x206ea7){const _0x11800b=a15_0x46af76,{options:_0x2cb82c,args:_0x5dbd59,tdx:_0x35603d}=_0x206ea7,_0x53f8d9=_0x5dbd59[0x0];_0x2cb82c[_0x11800b(0xa6)]&&(console[_0x11800b(0xdf)](_0x11800b(0xc4)+_0x2cb82c[_0x11800b(0xfc)]),console[_0x11800b(0xdf)](_0x11800b(0x9b)+_0x53f8d9));const _0xefce94=await withSpinner('Fetching\x20settings\x20for\x20\x27'+_0x53f8d9+_0x11800b(0xdc),()=>_0x35603d[_0x11800b(0xd7)][_0x11800b(0xb0)](_0x53f8d9),{'verbose':_0x2cb82c['verbose']}),_0x278831=_0xefce94['data'];console[_0x11800b(0xdf)](_0x11800b(0xd9)+_0x53f8d9);if(isStructuredFormat(_0x2cb82c))await handleSingleObjectOutput(_0x278831,_0x2cb82c);else{console['log'](_0x11800b(0xc9)+a15_0x1f3233['cyan'](_0x53f8d9)),console['log'](_0x11800b(0xcf)+_0x278831['name']);const _0x3b71da=_0x278831['settings']||[],_0x3c6350=_0x3b71da['filter'](_0x5f51a6=>_0x5f51a6[_0x11800b(0xec)]);_0x3c6350[_0x11800b(0xbf)]>0x0&&(console['log'](a15_0x1f3233['bold'](_0x11800b(0xf5))),printMetadataSettings(_0x3c6350));let _0x25716d=![];try{const _0x186196=await _0x35603d[_0x11800b(0xd7)][_0x11800b(0x107)](_0x53f8d9),_0x4c4d53=normalizeSchemaForDisplay(_0x186196);_0x4c4d53[_0x11800b(0xbf)]>0x0&&(console[_0x11800b(0x9e)](a15_0x1f3233[_0x11800b(0xaf)](_0x11800b(0xf3))),printSchemaFields(_0x4c4d53,0x0),_0x25716d=!![]);}catch{const _0x415fa2=_0x3b71da[_0x11800b(0xf9)](_0x5e65b2=>!_0x5e65b2[_0x11800b(0xec)]);_0x415fa2[_0x11800b(0xbf)]>0x0&&(console[_0x11800b(0x9e)](a15_0x1f3233[_0x11800b(0xaf)]('\x0aAvailable\x20fields:')),printMetadataSettings(_0x415fa2),_0x25716d=!![]);}!_0x25716d&&_0x2cb82c[_0x11800b(0xa6)]&&console[_0x11800b(0xdf)](a15_0x1f3233['dim']('No\x20available\x20fields\x20for\x20this\x20connector')),_0x3c6350[_0x11800b(0xbf)]===0x0&&console['log'](a15_0x1f3233[_0x11800b(0xd1)](_0x11800b(0xe4)));}return 0x0;}}function printMetadataSettings(_0x22cbab){const _0x29d3cd=a15_0x46af76;for(const _0x163e1b of _0x22cbab){if(!_0x163e1b['name'])continue;if(_0x163e1b[_0x29d3cd(0xed)])continue;let _0x53bcca='\x20\x20'+a15_0x1f3233['green'](_0x163e1b[_0x29d3cd(0x9d)]);_0x163e1b[_0x29d3cd(0xc1)]&&(_0x53bcca+=':\x20'+_0x163e1b['label']);_0x163e1b[_0x29d3cd(0xbd)]&&(_0x53bcca+=a15_0x1f3233[_0x29d3cd(0xd1)]('\x20['+_0x163e1b[_0x29d3cd(0xbd)]+']'));console[_0x29d3cd(0x9e)](_0x53bcca);_0x163e1b[_0x29d3cd(0xb5)]&&console[_0x29d3cd(0x9e)](_0x29d3cd(0xc0)+a15_0x1f3233[_0x29d3cd(0xd1)](_0x163e1b['hint']));if(_0x163e1b[_0x29d3cd(0xb9)]){const _0x560613=_0x163e1b['options'][_0x29d3cd(0xd3)](_0x184124=>_0x184124[_0x29d3cd(0x105)])[_0x29d3cd(0xab)](',\x20');console[_0x29d3cd(0x9e)](_0x29d3cd(0xe2)+a15_0x1f3233['yellow'](_0x560613));}_0x163e1b[_0x29d3cd(0xf7)]!==undefined&&_0x163e1b[_0x29d3cd(0xf7)]!==null&&console[_0x29d3cd(0x9e)](_0x29d3cd(0xee)+a15_0x1f3233['blue'](String(_0x163e1b['default_value'])));if(_0x163e1b['criteria']){const _0x53b744=Object[_0x29d3cd(0xb8)](_0x163e1b[_0x29d3cd(0xa7)])[_0x29d3cd(0xd3)](([_0x380285,_0x3373f8])=>_0x380285+'='+JSON[_0x29d3cd(0xd5)](_0x3373f8))[_0x29d3cd(0xab)](',\x20');console['log'](_0x29d3cd(0xc0)+a15_0x1f3233['dim']('Show\x20when:\x20'+_0x53b744));}}}
|
|
1
|
+
function a15_0x44fe(_0x52506c,_0x2a38a1){_0x52506c=_0x52506c-0x7c;const _0x3d9317=a15_0x3d93();let _0x44fe16=_0x3d9317[_0x52506c];return _0x44fe16;}const a15_0x484c31=a15_0x44fe;(function(_0x40de54,_0x3628b7){const _0x491421=a15_0x44fe,_0x183e12=_0x40de54();while(!![]){try{const _0x324ccb=parseInt(_0x491421(0xdb))/0x1*(parseInt(_0x491421(0xd0))/0x2)+-parseInt(_0x491421(0xce))/0x3*(-parseInt(_0x491421(0x9a))/0x4)+parseInt(_0x491421(0x81))/0x5+parseInt(_0x491421(0x95))/0x6*(parseInt(_0x491421(0x7c))/0x7)+parseInt(_0x491421(0x80))/0x8*(parseInt(_0x491421(0xa1))/0x9)+-parseInt(_0x491421(0xa5))/0xa*(-parseInt(_0x491421(0xd5))/0xb)+parseInt(_0x491421(0x9f))/0xc*(-parseInt(_0x491421(0x8f))/0xd);if(_0x324ccb===_0x3628b7)break;else _0x183e12['push'](_0x183e12['shift']());}catch(_0x38eba2){_0x183e12['push'](_0x183e12['shift']());}}}(a15_0x3d93,0xa1973));import{BaseCommand}from'./command.js';import{handleSDKOutput,handleSingleObjectOutput,isStructuredFormat,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../core/constants.js';import a15_0x1b3f95 from'chalk';function normalizeSchemaForDisplay(_0x37137d){const _0x34bcb4=a15_0x44fe,_0x1a2df5=_0x37137d[_0x34bcb4(0xd7)]||[],_0x2cc69e=_0x1a2df5['find'](_0x5ac67d=>_0x5ac67d[_0x34bcb4(0xa4)]===_0x34bcb4(0xe8)&&_0x5ac67d[_0x34bcb4(0xdd)]===_0x34bcb4(0x88)&&_0x5ac67d[_0x34bcb4(0xd7)]);if(_0x2cc69e?.[_0x34bcb4(0xd7)]){const _0x527051=_0x1a2df5['filter'](_0x119726=>_0x119726[_0x34bcb4(0xa4)]!==_0x34bcb4(0x91)&&_0x119726[_0x34bcb4(0xa4)]!=='legacy_settings');return[..._0x527051,..._0x2cc69e[_0x34bcb4(0xd7)]];}return _0x1a2df5[_0x34bcb4(0xe0)](_0x5d2fd5=>_0x5d2fd5[_0x34bcb4(0xa4)]!==_0x34bcb4(0x91));}function printSchemaFields(_0x9e2b2a,_0x3dbc9a){const _0x5455f7=a15_0x44fe,_0x3397a1='\x20\x20'[_0x5455f7(0xc4)](_0x3dbc9a+0x1),_0x1ba258='\x20\x20'[_0x5455f7(0xc4)](_0x3dbc9a+0x2);for(const _0x4c837c of _0x9e2b2a){if(!_0x4c837c[_0x5455f7(0xa4)])continue;const _0x3599d4=_0x4c837c[_0x5455f7(0xdd)]==='record'&&_0x4c837c['properties']&&_0x4c837c[_0x5455f7(0xd7)]['length']>0x0&&_0x4c837c['name']!=='legacy_settings';let _0x2968b2=''+_0x3397a1+a15_0x1b3f95[_0x5455f7(0xe6)](_0x4c837c[_0x5455f7(0xa4)]);_0x4c837c[_0x5455f7(0x7d)]&&(_0x2968b2+=':\x20'+_0x4c837c[_0x5455f7(0x7d)]);if(_0x4c837c[_0x5455f7(0xbc)])_0x2968b2+=a15_0x1b3f95[_0x5455f7(0x90)]('\x20['+_0x4c837c['input']+']');else _0x3599d4&&(_0x2968b2+=a15_0x1b3f95['dim'](_0x5455f7(0xd2)));console[_0x5455f7(0x89)](_0x2968b2);_0x4c837c[_0x5455f7(0xb3)]&&console['log'](''+_0x1ba258+a15_0x1b3f95[_0x5455f7(0x90)](_0x4c837c[_0x5455f7(0xb3)]));if(_0x4c837c[_0x5455f7(0x8d)]){const _0x4c396b=_0x4c837c[_0x5455f7(0x8d)][_0x5455f7(0xc8)](_0x5bf8f8=>typeof _0x5bf8f8===_0x5455f7(0xe7)&&'value'in _0x5bf8f8?_0x5bf8f8[_0x5455f7(0x8b)]:_0x5bf8f8)[_0x5455f7(0xbd)](',\x20');console[_0x5455f7(0x89)](_0x1ba258+_0x5455f7(0xba)+a15_0x1b3f95['yellow'](_0x4c396b));}_0x4c837c[_0x5455f7(0x9d)]!==undefined&&console['log'](_0x1ba258+_0x5455f7(0xa3)+a15_0x1b3f95[_0x5455f7(0x93)](String(_0x4c837c[_0x5455f7(0x9d)])));if(_0x4c837c[_0x5455f7(0x85)]!==undefined||_0x4c837c[_0x5455f7(0xe2)]!==undefined){const _0x40f825=_0x4c837c[_0x5455f7(0x85)]!==undefined&&_0x4c837c[_0x5455f7(0xe2)]!==undefined?_0x4c837c['minimum']+_0x5455f7(0x9c)+_0x4c837c['maximum']:_0x4c837c[_0x5455f7(0x85)]!==undefined?_0x5455f7(0xcf)+_0x4c837c[_0x5455f7(0x85)]:_0x5455f7(0xc3)+_0x4c837c['maximum'];console[_0x5455f7(0x89)](_0x1ba258+'Range:\x20'+a15_0x1b3f95[_0x5455f7(0x93)](_0x40f825));}if(_0x4c837c[_0x5455f7(0x82)]){const _0x2b5994=Object['entries'](_0x4c837c[_0x5455f7(0x82)])[_0x5455f7(0xc8)](([_0x5c0d29,_0x22387b])=>_0x5c0d29+'='+JSON[_0x5455f7(0xd1)](_0x22387b))[_0x5455f7(0xbd)](',\x20');console[_0x5455f7(0x89)](''+_0x1ba258+a15_0x1b3f95[_0x5455f7(0x90)](_0x5455f7(0xbf)+_0x2b5994));}_0x3599d4&&_0x4c837c[_0x5455f7(0xd7)]&&printSchemaFields(_0x4c837c['properties'],_0x3dbc9a+0x1);}}function a15_0x3d93(){const _0x255f71=['415070AYgksI','hint','Looking\x20up\x20connection:\x20','connection:settings','bold','limit','error','Fetching\x20settings\x20for\x20connector\x20type:\x20','Usage:\x20tdx\x20connection\x20schema\x20<type-or-name>\x0a\x0aArguments:\x0a\x20\x20<type-or-name>\x20\x20\x20\x20Connector\x20type\x20(e.g.,\x20\x27salesforce\x27,\x20\x27pgsql\x27,\x20\x27s3\x27)\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20or\x20connection\x20name\x20(e.g.,\x20\x27my-salesforce-connection\x27)\x0a\x0aExamples:\x0a\x20\x20tdx\x20connection\x20schema\x20salesforce\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20By\x20connector\x20type\x0a\x20\x20tdx\x20connection\x20schema\x20my-s3-connection\x20\x20\x20\x20\x20#\x20By\x20connection\x20name\x0a\x20\x20tdx\x20connection\x20schema\x20pgsql\x0a\x0aUse\x20\x27tdx\x20connection\x20types\x27\x20to\x20list\x20available\x20connector\x20types.\x0aUse\x20\x27tdx\x20connection\x20list\x27\x20to\x20list\x20available\x20connections.','Show\x20connection-level\x20settings\x20(credentials,\x20authentication)','\x20\x20\x20\x20Default:\x20','List\x20all\x20result\x20output\x20connections','Usage:\x20tdx\x20connection\x20show\x20<name>\x0a\x0aArguments:\x0a\x20\x20<name>\x20\x20\x20\x20Connection\x20name\x0a\x0aExamples:\x0a\x20\x20tdx\x20connection\x20show\x20my-s3-connection\x0a\x20\x20tdx\x20connection\x20show\x20\x22My\x20Salesforce\x20Connection\x22','\x0aConnection:\x20','description','Show\x20connector\x20output\x20schema\x20for\x20connector_config\x20validation','Site:\x20','\x20connector\x20type','max','\x27\x20(type:\x20','connection:schema','Options:\x20','connection:types','input','join','Fetching\x20connection\x20\x27','Show\x20when:\x20','connection','list','listTypes','<=\x20','repeat','cyan','\x0aConnector:\x20','padStart','map','✔\x20Resolved\x20\x27','Name:\x20','table','Fetching\x20settings\x20for\x20\x27','length','845682WeToeT','>=\x20','1467354PzPIyY','stringify','\x20[record]','\x20\x20\x20\x20','settings','66cSKciX','✔\x20Found\x20settings\x20for\x20connector\x20type:\x20','properties','\x0aCredential\x20settings:','List\x20available\x20connector\x20types','\x0aAvailable\x20fields:','1qBVWpQ','getOutputSchema','type','\x27...','data','filter','Usage:\x20tdx\x20connection\x20settings\x20<type>\x0a\x0aArguments:\x0a\x20\x20<type>\x20\x20\x20\x20Connector\x20type\x20(e.g.,\x20\x27salesforce\x27,\x20\x27rest\x27,\x20\x27s3\x27)\x0a\x0aExamples:\x0a\x20\x20tdx\x20connection\x20settings\x20rest\x0a\x20\x20tdx\x20connection\x20settings\x20salesforce\x0a\x20\x20tdx\x20connection\x20settings\x20s3\x0a\x0aNote:\x20This\x20shows\x20settings\x20for\x20creating/configuring\x20a\x20connection.\x0aFor\x20activation\x20output\x20settings,\x20use\x20\x27tdx\x20connection\x20schema\x20<type>\x27.\x0aUse\x20\x27tdx\x20connection\x20types\x27\x20to\x20list\x20available\x20connector\x20types.','maximum','No\x20available\x20fields\x20for\x20this\x20connector','options','push','green','object','legacy_settings','12677AdOZqy','title','Type:\x20','site','9597968yqeZZH','5951655DAxSwN','criteria','Listing\x20connector\x20types...','Fetching\x20schema\x20for\x20\x27','minimum','verbose','entries','record','log','output','value','connection:show','enumeration','findByName','2809339KbrRjQ','dim','legacy','validate','blue','\x20\x20\x20\x20Options:\x20','2256VUVeyB','credential','✔\x20Found\x20schema\x20for\x20connection\x20\x27','Resolving\x20connector\x20type\x20or\x20name:\x20','label','4ulOiuT','execute','\x20-\x20','default_value','resolve','204YtfdeL','owner','9dTefYD','Listing\x20connections...','Default:\x20','name'];a15_0x3d93=function(){return _0x255f71;};return a15_0x3d93();}export class ConnectionListCommand extends BaseCommand{['name']='connection:list';['description']=a15_0x484c31(0xb0);async['execute'](_0x38321f){const _0x10bde6=a15_0x484c31,{options:_0x1ad163,tdx:_0x69be9}=_0x38321f;_0x1ad163[_0x10bde6(0x86)]&&console[_0x10bde6(0xab)](_0x10bde6(0xb5)+_0x1ad163[_0x10bde6(0x7f)]);const _0x251d7c=resolveLimit(_0x1ad163[_0x10bde6(0xaa)],DEFAULT_LISTING_LIMIT),_0x3526b9=await withSpinner(_0x10bde6(0xa2),()=>_0x69be9[_0x10bde6(0xc0)][_0x10bde6(0xc1)](),{'verbose':_0x1ad163[_0x10bde6(0x86)]}),_0x5c8d67=_0x3526b9[_0x10bde6(0xdf)];console[_0x10bde6(0xab)]('✔\x20Found\x20'+_0x5c8d67[_0x10bde6(0xcd)]+'\x20connection'+(_0x5c8d67['length']!==0x1?'s':''));if(isStructuredFormat(_0x1ad163)){const _0xa01055=_0x5c8d67['slice'](0x0,_0x251d7c);await handleSDKOutput(_0xa01055,{..._0x1ad163,'limit':_0x251d7c});}else{const _0x581548=_0x5c8d67['length']>0x0?Math[_0x10bde6(0xb7)](..._0x5c8d67['map'](_0x2e470b=>_0x2e470b[_0x10bde6(0xdd)][_0x10bde6(0xcd)])):0x0,_0x4c65bc=[];for(const _0x2b3290 of _0x5c8d67){const _0xc3d5a5=a15_0x1b3f95['cyan'](_0x2b3290[_0x10bde6(0xdd)][_0x10bde6(0xc7)](_0x581548)),_0x2cd34c=_0x2b3290[_0x10bde6(0xa0)]?.[_0x10bde6(0xa4)]?_0x10bde6(0x9c)+a15_0x1b3f95[_0x10bde6(0x90)](_0x2b3290[_0x10bde6(0xa0)][_0x10bde6(0xa4)]):'';_0x4c65bc[_0x10bde6(0xe5)](_0xc3d5a5+'\x20\x20'+_0x2b3290[_0x10bde6(0xa4)]+_0x2cd34c);}await writeOutput(_0x4c65bc[_0x10bde6(0xbd)]('\x0a'),_0x1ad163[_0x10bde6(0x8a)],_0x10bde6(0xcb));}return 0x0;}}export class ConnectionShowCommand extends BaseCommand{[a15_0x484c31(0xa4)]=a15_0x484c31(0x8c);['description']='Show\x20connection\x20details';['validate'](_0x6a1776){const _0x515782=a15_0x484c31,{args:_0x3308f8}=_0x6a1776;if(!_0x3308f8[0x0])return _0x515782(0xb1);return undefined;}async[a15_0x484c31(0x9b)](_0x3c1343){const _0x454e94=a15_0x484c31,{options:_0x183eb9,args:_0x165564,tdx:_0x4d7bc6}=_0x3c1343,_0xc36fb0=_0x165564[0x0];_0x183eb9['verbose']&&(console[_0x454e94(0xab)](_0x454e94(0xb5)+_0x183eb9[_0x454e94(0x7f)]),console[_0x454e94(0xab)](_0x454e94(0xa7)+_0xc36fb0));const _0x446802=await withSpinner(_0x454e94(0xbe)+_0xc36fb0+_0x454e94(0xde),()=>_0x4d7bc6[_0x454e94(0xc0)][_0x454e94(0x9e)](_0xc36fb0),{'verbose':_0x183eb9['verbose']}),_0x488aa3=_0x446802['data'];return console[_0x454e94(0xab)]('✔\x20Found\x20connection:\x20'+_0x488aa3[_0x454e94(0xa4)]),await handleSingleObjectOutput(_0x488aa3,_0x183eb9),0x0;}}export class ConnectionSchemaCommand extends BaseCommand{[a15_0x484c31(0xa4)]=a15_0x484c31(0xb9);[a15_0x484c31(0xb3)]=a15_0x484c31(0xb4);[a15_0x484c31(0x92)](_0x48692d){const _0xe17ef1=a15_0x484c31,{args:_0x27b330}=_0x48692d;if(!_0x27b330[0x0])return _0xe17ef1(0xad);return undefined;}async[a15_0x484c31(0x9b)](_0x5a3578){const _0x402f7e=a15_0x484c31,{options:_0x6688e8,args:_0x196edf,tdx:_0x5499e9}=_0x5a3578,_0x281fab=_0x196edf[0x0];_0x6688e8[_0x402f7e(0x86)]&&(console[_0x402f7e(0xab)](_0x402f7e(0xb5)+_0x6688e8[_0x402f7e(0x7f)]),console['error'](_0x402f7e(0x98)+_0x281fab));let _0x1d279c=_0x281fab,_0x2a05ff;try{const _0x56f37d=await _0x5499e9[_0x402f7e(0xc0)][_0x402f7e(0x8e)](_0x281fab);_0x56f37d&&(_0x1d279c=_0x56f37d[_0x402f7e(0xdd)],_0x2a05ff=_0x56f37d[_0x402f7e(0xa4)],_0x6688e8['verbose']&&console[_0x402f7e(0xab)](_0x402f7e(0xc9)+_0x281fab+'\x27\x20as\x20connection\x20name\x20→\x20type:\x20'+_0x1d279c));}catch{_0x6688e8['verbose']&&console['error']('Treating\x20\x27'+_0x281fab+'\x27\x20as\x20connector\x20type');}const _0x4c8c26=await withSpinner(_0x402f7e(0x84)+_0x1d279c+_0x402f7e(0xde),()=>_0x5499e9[_0x402f7e(0xc0)]['getOutputSchema'](_0x1d279c),{'verbose':_0x6688e8[_0x402f7e(0x86)]}),_0x17d9fd=_0x4c8c26[_0x402f7e(0xdf)];_0x2a05ff?console[_0x402f7e(0xab)](_0x402f7e(0x97)+_0x2a05ff+_0x402f7e(0xb8)+_0x1d279c+')'):console[_0x402f7e(0xab)]('✔\x20Found\x20schema\x20for\x20connector\x20type:\x20'+_0x1d279c);if(isStructuredFormat(_0x6688e8))await handleSingleObjectOutput(_0x17d9fd,_0x6688e8);else{const _0xea68de=normalizeSchemaForDisplay(_0x17d9fd);_0x2a05ff?(console[_0x402f7e(0x89)](_0x402f7e(0xb2)+a15_0x1b3f95[_0x402f7e(0xc5)](_0x2a05ff)),console[_0x402f7e(0x89)](_0x402f7e(0x7e)+a15_0x1b3f95['dim'](_0x1d279c))):console[_0x402f7e(0x89)](_0x402f7e(0xc6)+a15_0x1b3f95[_0x402f7e(0xc5)](_0x1d279c)),_0xea68de['length']>0x0?(console[_0x402f7e(0x89)](a15_0x1b3f95[_0x402f7e(0xa9)](_0x402f7e(0xda))),printSchemaFields(_0xea68de,0x0)):console['log'](a15_0x1b3f95[_0x402f7e(0x90)]('\x0aNo\x20fields\x20defined\x20in\x20schema'));}return 0x0;}}export class ConnectionTypesCommand extends BaseCommand{[a15_0x484c31(0xa4)]=a15_0x484c31(0xbb);[a15_0x484c31(0xb3)]=a15_0x484c31(0xd9);async[a15_0x484c31(0x9b)](_0x197d59){const _0x344e04=a15_0x484c31,{options:_0x6cb3d3,tdx:_0x460a69}=_0x197d59;_0x6cb3d3['verbose']&&console[_0x344e04(0xab)](_0x344e04(0xb5)+_0x6cb3d3[_0x344e04(0x7f)]);const _0x558195=await withSpinner(_0x344e04(0x83),()=>_0x460a69[_0x344e04(0xc0)][_0x344e04(0xc2)](),{'verbose':_0x6cb3d3['verbose']}),_0x323a11=_0x558195[_0x344e04(0xdf)]['sort']((_0x630a2e,_0x394067)=>_0x630a2e[_0x344e04(0xdd)]['localeCompare'](_0x394067[_0x344e04(0xdd)]));console[_0x344e04(0xab)]('✔\x20Found\x20'+_0x323a11[_0x344e04(0xcd)]+_0x344e04(0xb6)+(_0x323a11['length']!==0x1?'s':''));if(isStructuredFormat(_0x6cb3d3))await handleSDKOutput(_0x323a11,_0x6cb3d3);else{const _0x2eb368=_0x323a11[_0x344e04(0xcd)]>0x0?Math[_0x344e04(0xb7)](..._0x323a11['map'](_0x1bb04f=>_0x1bb04f[_0x344e04(0xdd)]['length'])):0x0,_0x2318c2=[];for(const _0x6f0b21 of _0x323a11){const _0x471ed1=a15_0x1b3f95[_0x344e04(0xc5)](_0x6f0b21[_0x344e04(0xdd)][_0x344e04(0xc7)](_0x2eb368));_0x2318c2[_0x344e04(0xe5)](_0x471ed1+'\x20\x20'+_0x6f0b21[_0x344e04(0xa4)]);}await writeOutput(_0x2318c2[_0x344e04(0xbd)]('\x0a'),_0x6cb3d3[_0x344e04(0x8a)],_0x344e04(0xcb));}return 0x0;}}export class ConnectionSettingsCommand extends BaseCommand{['name']=a15_0x484c31(0xa8);['description']=a15_0x484c31(0xae);[a15_0x484c31(0x92)](_0x5cb098){const _0x209c1f=a15_0x484c31,{args:_0x1705de}=_0x5cb098;if(!_0x1705de[0x0])return _0x209c1f(0xe1);return undefined;}async[a15_0x484c31(0x9b)](_0xe18ec7){const _0x5e3253=a15_0x484c31,{options:_0x57a38d,args:_0x4c03bc,tdx:_0x1599c5}=_0xe18ec7,_0x242d6e=_0x4c03bc[0x0];_0x57a38d[_0x5e3253(0x86)]&&(console['error'](_0x5e3253(0xb5)+_0x57a38d[_0x5e3253(0x7f)]),console['error'](_0x5e3253(0xac)+_0x242d6e));const _0x2c993c=await withSpinner(_0x5e3253(0xcc)+_0x242d6e+_0x5e3253(0xde),()=>_0x1599c5[_0x5e3253(0xc0)]['getMetadata'](_0x242d6e),{'verbose':_0x57a38d['verbose']}),_0x5b9574=_0x2c993c[_0x5e3253(0xdf)];console[_0x5e3253(0xab)](_0x5e3253(0xd6)+_0x242d6e);if(isStructuredFormat(_0x57a38d))await handleSingleObjectOutput(_0x5b9574,_0x57a38d);else{console[_0x5e3253(0x89)]('\x0aConnector:\x20'+a15_0x1b3f95[_0x5e3253(0xc5)](_0x242d6e)),console['log'](_0x5e3253(0xca)+_0x5b9574[_0x5e3253(0xa4)]);const _0x2b568f=_0x5b9574[_0x5e3253(0xd4)]||[],_0x29cba4=_0x2b568f[_0x5e3253(0xe0)](_0x343fab=>_0x343fab[_0x5e3253(0x96)]);_0x29cba4[_0x5e3253(0xcd)]>0x0&&(console['log'](a15_0x1b3f95[_0x5e3253(0xa9)](_0x5e3253(0xd8))),printMetadataSettings(_0x29cba4));let _0x27975a=![];try{const _0x5ee608=await _0x1599c5[_0x5e3253(0xc0)][_0x5e3253(0xdc)](_0x242d6e),_0x2281cd=normalizeSchemaForDisplay(_0x5ee608);_0x2281cd['length']>0x0&&(console['log'](a15_0x1b3f95[_0x5e3253(0xa9)](_0x5e3253(0xda))),printSchemaFields(_0x2281cd,0x0),_0x27975a=!![]);}catch{const _0x138d72=_0x2b568f[_0x5e3253(0xe0)](_0x1a7fb1=>!_0x1a7fb1[_0x5e3253(0x96)]);_0x138d72[_0x5e3253(0xcd)]>0x0&&(console['log'](a15_0x1b3f95[_0x5e3253(0xa9)](_0x5e3253(0xda))),printMetadataSettings(_0x138d72),_0x27975a=!![]);}!_0x27975a&&_0x57a38d[_0x5e3253(0x86)]&&console[_0x5e3253(0xab)](a15_0x1b3f95[_0x5e3253(0x90)](_0x5e3253(0xe3))),_0x29cba4[_0x5e3253(0xcd)]===0x0&&console[_0x5e3253(0x89)](a15_0x1b3f95['dim']('\x0aNo\x20credential\x20settings\x20defined'));}return 0x0;}}function printMetadataSettings(_0x5e1cf6){const _0x3baa01=a15_0x484c31;for(const _0x5c5c29 of _0x5e1cf6){if(!_0x5c5c29[_0x3baa01(0xa4)])continue;if(_0x5c5c29['hidden'])continue;let _0xc53032='\x20\x20'+a15_0x1b3f95[_0x3baa01(0xe6)](_0x5c5c29['name']);_0x5c5c29['label']&&(_0xc53032+=':\x20'+_0x5c5c29[_0x3baa01(0x99)]);_0x5c5c29[_0x3baa01(0xdd)]&&(_0xc53032+=a15_0x1b3f95[_0x3baa01(0x90)]('\x20['+_0x5c5c29[_0x3baa01(0xdd)]+']'));console[_0x3baa01(0x89)](_0xc53032);_0x5c5c29['hint']&&console[_0x3baa01(0x89)](_0x3baa01(0xd3)+a15_0x1b3f95['dim'](_0x5c5c29[_0x3baa01(0xa6)]));if(_0x5c5c29['options']){const _0x52b23d=_0x5c5c29[_0x3baa01(0xe4)][_0x3baa01(0xc8)](_0xbaf623=>_0xbaf623[_0x3baa01(0x8b)])['join'](',\x20');console['log'](_0x3baa01(0x94)+a15_0x1b3f95['yellow'](_0x52b23d));}_0x5c5c29[_0x3baa01(0x9d)]!==undefined&&_0x5c5c29[_0x3baa01(0x9d)]!==null&&console[_0x3baa01(0x89)](_0x3baa01(0xaf)+a15_0x1b3f95[_0x3baa01(0x93)](String(_0x5c5c29[_0x3baa01(0x9d)])));if(_0x5c5c29[_0x3baa01(0x82)]){const _0x1a0542=Object[_0x3baa01(0x87)](_0x5c5c29[_0x3baa01(0x82)])[_0x3baa01(0xc8)](([_0x2ca2a0,_0x538701])=>_0x2ca2a0+'='+JSON[_0x3baa01(0xd1)](_0x538701))[_0x3baa01(0xbd)](',\x20');console[_0x3baa01(0x89)](_0x3baa01(0xd3)+a15_0x1b3f95[_0x3baa01(0x90)](_0x3baa01(0xbf)+_0x1a0542));}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a16_0x23ae3e=a16_0x1628;function a16_0x2185(){const _0x2b09ef=['10069884RhEQnX','name','166952ghrzKi','7699434AqilWl','7xoFshM','error','length','log','603GlDqbb','cause','description','limit','List\x20all\x20databases','37235EyxlBX','listDatabases','1626910IKtnMf','databases','site','📦\x20','✔\x20Found\x20','\x20\x20Cause:\x20','data','10tDFamr','execute','verbose','message','Pattern:\x20','568CMxIZj','2161551Oufdnk','database_name','265218tGgjbs'];a16_0x2185=function(){return _0x2b09ef;};return a16_0x2185();}(function(_0x5d0c6c,_0x329787){const _0x1b55f7=a16_0x1628,_0x1c88fe=_0x5d0c6c();while(!![]){try{const _0x3288f0=parseInt(_0x1b55f7(0x1bd))/0x1*(parseInt(_0x1b55f7(0x1d4))/0x2)+-parseInt(_0x1b55f7(0x1bb))/0x3+parseInt(_0x1b55f7(0x1d9))/0x4*(parseInt(_0x1b55f7(0x1cb))/0x5)+parseInt(_0x1b55f7(0x1c1))/0x6*(parseInt(_0x1b55f7(0x1c2))/0x7)+parseInt(_0x1b55f7(0x1c0))/0x8*(-parseInt(_0x1b55f7(0x1c6))/0x9)+parseInt(_0x1b55f7(0x1cd))/0xa+-parseInt(_0x1b55f7(0x1be))/0xb;if(_0x3288f0===_0x329787)break;else _0x1c88fe['push'](_0x1c88fe['shift']());}catch(_0x29fc2c){_0x1c88fe['push'](_0x1c88fe['shift']());}}}(a16_0x2185,0xc22ae));function a16_0x1628(_0x3d9320,_0x1a0d4f){_0x3d9320=_0x3d9320-0x1bb;const _0x218596=a16_0x2185();let _0x162817=_0x218596[_0x3d9320];return _0x162817;}import{BaseCommand}from'./command.js';import{SDKError}from'../sdk/index.js';import{handleSDKOutput,isStructuredFormat}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{DEFAULT_LISTING_LIMIT,resolveLimit}from'../core/constants.js';export class DatabasesCommand extends BaseCommand{[a16_0x23ae3e(0x1bf)]=a16_0x23ae3e(0x1ce);[a16_0x23ae3e(0x1c8)]=a16_0x23ae3e(0x1ca);async[a16_0x23ae3e(0x1d5)](_0x3622c7){const _0xb4683=a16_0x23ae3e,{options:_0x36cd72,args:_0x2a6edb,tdx:_0x49d186}=_0x3622c7,_0x22693b=_0x2a6edb[0x0];try{_0x36cd72[_0xb4683(0x1d6)]&&(console['error']('Site:\x20'+_0x36cd72[_0xb4683(0x1cf)]),_0x22693b&&console[_0xb4683(0x1c3)](_0xb4683(0x1d8)+_0x22693b));const _0x314a4d=resolveLimit(_0x36cd72[_0xb4683(0x1c9)],DEFAULT_LISTING_LIMIT),_0x35fc79=await withSpinner('Listing\x20databases...',()=>_0x49d186['query'][_0xb4683(0x1cc)](_0x22693b,_0x314a4d),{'verbose':_0x36cd72[_0xb4683(0x1d6)]}),_0x5ca440=_0x35fc79[_0xb4683(0x1d3)];console[_0xb4683(0x1c3)](_0xb4683(0x1d1)+_0x5ca440[_0xb4683(0x1c4)]+'\x20database'+(_0x5ca440['length']!==0x1?'s':''));if(isStructuredFormat(_0x36cd72))await handleSDKOutput(_0x5ca440,{..._0x36cd72,'limit':_0x314a4d});else for(const _0x44f26c of _0x5ca440){console[_0xb4683(0x1c5)](_0xb4683(0x1d0)+_0x44f26c[_0xb4683(0x1bc)]);}return 0x0;}catch(_0xcbb4c0){if(_0xcbb4c0 instanceof SDKError)return console[_0xb4683(0x1c3)]('Error:\x20'+_0xcbb4c0[_0xb4683(0x1d7)]),_0xcbb4c0[_0xb4683(0x1c7)]&&console['error'](_0xb4683(0x1d2)+_0xcbb4c0[_0xb4683(0x1c7)]),0x1;throw _0xcbb4c0;}}}
|