@treasuredata/tdx 2026.3.27 → 2026.3.28
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.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +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/auth-login-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.d.ts +141 -2
- package/dist/commands/parent-segment-command.d.ts.map +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/parent-segment-command.js.map +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/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/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/client/cdp-api-client.d.ts +29 -1
- package/dist/sdk/client/cdp-api-client.d.ts.map +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/cdp-api-client.js.map +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.d.ts +228 -0
- package/dist/sdk/personalization.d.ts.map +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/personalization.js.map +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.d.ts +57 -0
- package/dist/sdk/realtime.d.ts.map +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/realtime.js.map +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/cdp.d.ts +76 -0
- package/dist/sdk/types/cdp.d.ts.map +1 -1
- package/dist/sdk/types/index.d.ts +1 -1
- package/dist/sdk/types/index.d.ts.map +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/index.js.map +1 -1
- package/dist/sdk/types/progress.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/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 a26_0xd9fd1b=a26_0x2628;(function(_0x2d0618,_0x1c38bb){const _0x112e57=a26_0x2628,_0x1c9ba2=_0x2d0618();while(!![]){try{const _0x8007b=parseInt(_0x112e57(0x14f))/0x1+-parseInt(_0x112e57(0x1e8))/0x2+parseInt(_0x112e57(0x145))/0x3+-parseInt(_0x112e57(0x160))/0x4*(parseInt(_0x112e57(0x1e1))/0x5)+-parseInt(_0x112e57(0x226))/0x6+-parseInt(_0x112e57(0x142))/0x7+parseInt(_0x112e57(0x1e2))/0x8;if(_0x8007b===_0x1c38bb)break;else _0x1c9ba2['push'](_0x1c9ba2['shift']());}catch(_0x51f2b2){_0x1c9ba2['push'](_0x1c9ba2['shift']());}}}(a26_0x1963,0x7bd3f));import a26_0x4d8a10 from'chalk';import a26_0xc0c7af from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{aggregateStageHistory,assembleJourneyStats,buildStageNameMap}from'../sdk/journey.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey,isInteractive}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';function a26_0x2628(_0x4dd9e8,_0x10b2f1){_0x4dd9e8=_0x4dd9e8-0x12e;const _0x196343=a26_0x1963();let _0x262836=_0x196343[_0x4dd9e8];return _0x262836;}import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{journeyResponseToDef,toYamlString,parseYamlString,normalizeJourneyDef}from'../sdk/segment/journey-yaml.js';import{segmentResponseToDef,journeyActivationStepToYaml,serializeRule}from'../sdk/segment/child-segment-yaml.js';import{saveSessionContext}from'../core/session.js';import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{createTdxConfigContent}from'../sdk/segment/tdx-config.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,createJumpTargetCache,resolveJumpTarget}from'../sdk/segment/journey-utils.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function requireNameOrPath(_0x4c0119){const _0xc0c451=a26_0x2628;return!_0x4c0119&&(console['error'](_0xc0c451(0x1cf)),console[_0xc0c451(0x1ff)](_0xc0c451(0x1ec))),!!_0x4c0119;}function withJsonFormat(_0x31bdf0){if(!_0x31bdf0['format']&&!_0x31bdf0['json']&&!_0x31bdf0['jsonl']&&!_0x31bdf0['tsv'])return{..._0x31bdf0,'format':'json','json':!![]};return _0x31bdf0;}function formatJourneyState(_0x44d2b1){const _0x55269e=a26_0x2628;switch(_0x44d2b1){case _0x55269e(0x1d7):return a26_0x4d8a10[_0x55269e(0x16d)]('(running)');case _0x55269e(0x233):return a26_0x4d8a10[_0x55269e(0x238)](_0x55269e(0x231));case'paused':return a26_0x4d8a10[_0x55269e(0x146)](_0x55269e(0x154));case _0x55269e(0x191):return a26_0x4d8a10[_0x55269e(0x21c)](_0x55269e(0x20c));case _0x55269e(0x1d8):return a26_0x4d8a10[_0x55269e(0x238)]('(archived)');default:return'('+_0x44d2b1+')';}}function formatJourneyItem(_0x10e5f0,_0x14ffe3='',_0x73f718){const _0x29815d=a26_0x2628,_0x450443=formatJourneyState(_0x10e5f0[_0x29815d(0x219)]),_0x5a6cfc=_0x73f718?hyperlink(_0x10e5f0[_0x29815d(0x23c)],_0x73f718):_0x10e5f0[_0x29815d(0x23c)];return _0x14ffe3+'🗺️\x20'+_0x5a6cfc+'\x20'+_0x450443;}function escapeRegex(_0x5aa528){const _0x2f0f24=a26_0x2628;return _0x5aa528[_0x2f0f24(0x1ee)](/[.*+?^${}()|[\]\\]/g,_0x2f0f24(0x202));}function globToRegex(_0x3d10d5){const _0x4534a5=a26_0x2628,_0x93a3ab=_0x3d10d5[_0x4534a5(0x1a7)]('*')[_0x4534a5(0x220)](escapeRegex);return new RegExp(_0x93a3ab[_0x4534a5(0x182)]('.*'),'i');}function buildRuleToNameMapping(_0x320c82){const _0x1db65c=a26_0x2628,_0x4832c3=new Map();if(_0x320c82['segments'])for(const [_0x12a76a,_0x39e5ad]of Object[_0x1db65c(0x1dc)](_0x320c82[_0x1db65c(0x16c)])){if(_0x39e5ad[_0x1db65c(0x13d)]){const _0x5e61e1=serializeRule(_0x39e5ad[_0x1db65c(0x13d)]),_0x18cbd1=_0x4832c3['get'](_0x5e61e1);_0x18cbd1?_0x18cbd1['push'](_0x12a76a):_0x4832c3[_0x1db65c(0x1c5)](_0x5e61e1,[_0x12a76a]);}}return _0x4832c3;}async function resolveJourneyIdFromInput(_0x33e055,_0x747c3a,_0x86a785){const _0x7e628c=a26_0x2628,_0x28bf1e=await resolveJourneyTarget(_0x33e055,_0x747c3a[_0x7e628c(0x18b)],_0x747c3a[_0x7e628c(0x17e)]),_0x3c17ca=_0x28bf1e[_0x7e628c(0x18b)];if(!_0x3c17ca)throw new SDKError(ErrorCode[_0x7e628c(0x1b6)],_0x7e628c(0x171));const _0x265c1c=await withSpinner(_0x7e628c(0x216),()=>_0x86a785[_0x7e628c(0x13e)][_0x7e628c(0x17f)](_0x3c17ca),{'verbose':_0x747c3a[_0x7e628c(0x17e)]}),_0x265a2a=_0x265c1c[_0x7e628c(0x186)],_0x506335=await withSpinner(_0x7e628c(0x1ba),()=>_0x86a785[_0x7e628c(0x15d)][_0x7e628c(0x198)](_0x265a2a,_0x28bf1e[_0x7e628c(0x1f9)]),{'verbose':_0x747c3a[_0x7e628c(0x17e)]});return{'journeyId':_0x506335[_0x7e628c(0x186)],'journeyName':_0x28bf1e[_0x7e628c(0x1f9)],'parentSegmentId':_0x265a2a};}async function resolveJourneyTarget(_0x13174c,_0x10c93a,_0x23639a){const _0xe1fd4f=a26_0x2628;if(isYamlFilePath(_0x13174c))try{const _0x3343c3=await resolveYamlFilePath(_0x13174c);return _0x23639a&&(console[_0xe1fd4f(0x1ff)]('Resolved\x20YAML\x20file:\x20'+_0x13174c),console[_0xe1fd4f(0x1ff)](_0xe1fd4f(0x209)+_0x3343c3[_0xe1fd4f(0x18b)]),console[_0xe1fd4f(0x1ff)]('\x20\x20Name:\x20'+_0x3343c3[_0xe1fd4f(0x23b)]),console[_0xe1fd4f(0x1ff)](_0xe1fd4f(0x185)+(_0x3343c3[_0xe1fd4f(0x234)]||_0xe1fd4f(0x140)))),{'journeyName':_0x3343c3[_0xe1fd4f(0x23b)],'parentSegment':_0x3343c3[_0xe1fd4f(0x18b)],'resolved':_0x3343c3};}catch(_0x221fd8){throw new SDKError(ErrorCode[_0xe1fd4f(0x1b6)],_0xe1fd4f(0x208)+_0x221fd8[_0xe1fd4f(0x229)]);}if(!_0x10c93a)throw new SDKError(ErrorCode[_0xe1fd4f(0x1b6)],_0xe1fd4f(0x1a2));return{'journeyName':_0x13174c,'parentSegment':_0x10c93a};}export class JourneyListCommand extends BaseCommand{['name']=a26_0xd9fd1b(0x19b);[a26_0xd9fd1b(0x1eb)]=a26_0xd9fd1b(0x18d);async[a26_0xd9fd1b(0x133)](_0x1f13e5){const _0x226a1b=a26_0xd9fd1b,{options:_0x55aa54,args:_0x90e0ee,tdx:_0x5272f9}=_0x1f13e5,_0x51a4d7=_0x90e0ee[0x0],_0x14a3ae=_0x55aa54[_0x226a1b(0x18b)];if(!_0x14a3ae)return console[_0x226a1b(0x1ff)](_0x226a1b(0x176)),console[_0x226a1b(0x1ff)](_0x226a1b(0x22f)),0x1;const _0x197615=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x5272f9[_0x226a1b(0x13e)][_0x226a1b(0x17f)](_0x14a3ae),{'verbose':_0x55aa54[_0x226a1b(0x17e)]}),_0x158817=_0x197615[_0x226a1b(0x186)];_0x55aa54[_0x226a1b(0x17e)]&&(console[_0x226a1b(0x1ff)]('Parent\x20segment:\x20'+_0x14a3ae+_0x226a1b(0x225)+_0x158817+')'),_0x51a4d7&&console[_0x226a1b(0x1ff)](_0x226a1b(0x1f7)+_0x51a4d7));const _0x51fe21=await withSpinner(_0x226a1b(0x1f3),()=>_0x5272f9[_0x226a1b(0x13e)][_0x226a1b(0x236)](_0x158817),{'verbose':_0x55aa54[_0x226a1b(0x17e)]}),_0x4f2d64=_0x51fe21['data'],_0x38de45=_0x4f2d64[_0x226a1b(0x1a6)],_0x50cda5=await withSpinner(_0x226a1b(0x1d3),()=>_0x5272f9[_0x226a1b(0x15d)]['listJourneysWithFolders'](_0x158817,_0x38de45),{'verbose':_0x55aa54[_0x226a1b(0x17e)]});let _0x31c449=_0x50cda5[_0x226a1b(0x186)][_0x226a1b(0x235)];const _0x55853c=_0x50cda5[_0x226a1b(0x186)][_0x226a1b(0x1e6)],_0xb57893=new Map();for(const _0xb59b3d of _0x55853c){_0xb57893[_0x226a1b(0x1c5)](_0xb59b3d['id'],_0xb59b3d[_0x226a1b(0x15b)]);}if(_0x51a4d7){const _0x37b80d=globToRegex(_0x51a4d7);_0x31c449=_0x31c449['filter'](_0x1cf66d=>_0x37b80d[_0x226a1b(0x239)](_0x1cf66d[_0x226a1b(0x23c)]));}console[_0x226a1b(0x1ff)](_0x226a1b(0x20e)+_0x31c449[_0x226a1b(0x21d)]+_0x226a1b(0x156)+(_0x31c449['length']!==0x1?'s':''));const _0x427166=_0x43b442=>{const _0x1f07af=_0x226a1b;return getConsoleNextUrl(_0x55aa54[_0x1f07af(0x137)],_0x1f07af(0x1b2)+_0x158817+'/e/'+_0x43b442+_0x1f07af(0x144));};if(_0x55aa54['format']===_0x226a1b(0x1c8))await handleSDKOutput(_0x31c449,_0x55aa54);else{if(_0x55aa54[_0x226a1b(0x14b)]==='json'){const _0x359e8e=_0x31c449[_0x226a1b(0x220)](_0x2a4ca8=>({..._0x2a4ca8,'url':_0x427166(_0x2a4ca8['id'])}));await handleSDKOutput(_0x359e8e,_0x55aa54);}else{console[_0x226a1b(0x17c)]('['+_0x14a3ae+']');const _0x1b4a99=new Map(),_0x4af533=[];for(const _0x5ecc8b of _0x31c449){if(!_0x5ecc8b[_0x226a1b(0x17b)]||_0x5ecc8b[_0x226a1b(0x17b)]===_0x38de45)_0x4af533[_0x226a1b(0x135)](_0x5ecc8b);else{const _0xb2164a=_0x1b4a99[_0x226a1b(0x150)](_0x5ecc8b[_0x226a1b(0x17b)])||[];_0xb2164a[_0x226a1b(0x135)](_0x5ecc8b),_0x1b4a99[_0x226a1b(0x1c5)](_0x5ecc8b[_0x226a1b(0x17b)],_0xb2164a);}}const _0x417306=(_0x18aacb,_0x5777e3)=>_0x18aacb[_0x226a1b(0x23c)][_0x226a1b(0x172)](_0x5777e3['journeyBundleName'],undefined,{'sensitivity':_0x226a1b(0x1a5)});_0x4af533[_0x226a1b(0x1df)](_0x417306);for(const _0x2c2102 of _0x4af533){console['log'](formatJourneyItem(_0x2c2102,'',_0x427166(_0x2c2102['id'])));}const _0xe44b30=[..._0x1b4a99[_0x226a1b(0x1dc)]()]['sort']((_0x1e5f5e,_0x159829)=>{const _0x137de8=_0x226a1b,_0x49d35f=_0xb57893[_0x137de8(0x150)](_0x1e5f5e[0x0])||_0x1e5f5e[0x0],_0x5ccf55=_0xb57893[_0x137de8(0x150)](_0x159829[0x0])||_0x159829[0x0];return _0x49d35f[_0x137de8(0x172)](_0x5ccf55,undefined,{'sensitivity':_0x137de8(0x1a5)});});for(const [_0x7a6580,_0x106208]of _0xe44b30){const _0x5205b9=_0xb57893[_0x226a1b(0x150)](_0x7a6580)||_0x7a6580;console[_0x226a1b(0x17c)](_0x226a1b(0x132)+_0x5205b9),_0x106208[_0x226a1b(0x1df)](_0x417306);for(const _0x347772 of _0x106208){console[_0x226a1b(0x17c)](formatJourneyItem(_0x347772,'\x20\x20',_0x427166(_0x347772['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{['name']=a26_0xd9fd1b(0x1e4);['description']=a26_0xd9fd1b(0x183);async['execute'](_0x441e24){const _0x156a54=a26_0xd9fd1b,{options:_0x1a0b0b,args:_0x1b835a,tdx:_0x203a29}=_0x441e24,_0x1477e7=_0x1b835a[0x0];if(!_0x1477e7)return console[_0x156a54(0x1ff)](_0x156a54(0x1cf)),console[_0x156a54(0x1ff)](_0x156a54(0x1c0)),console[_0x156a54(0x1ff)](_0x156a54(0x161)),console[_0x156a54(0x1ff)](_0x156a54(0x228)),0x1;_0x1a0b0b['verbose']&&console[_0x156a54(0x1ff)](_0x156a54(0x1f8)+_0x1477e7);const {journeyId:_0x44ec9b,parentSegmentId:_0x367322}=await resolveJourneyIdFromInput(_0x1477e7,_0x1a0b0b,_0x203a29);if(_0x1a0b0b[_0x156a54(0x1de)]){const _0x405f58=getConsoleNextUrl(_0x1a0b0b[_0x156a54(0x137)],'/app/ps/'+_0x367322+_0x156a54(0x165)+_0x44ec9b+'/j/da/je');return console['error'](a26_0x4d8a10[_0x156a54(0x16d)]('✔')+_0x156a54(0x1d4)+a26_0x4d8a10[_0x156a54(0x212)](_0x405f58)),openBrowser(_0x405f58),0x0;}const _0x3f13ab=await withSpinner(_0x156a54(0x141),()=>_0x203a29[_0x156a54(0x15d)][_0x156a54(0x16f)](_0x44ec9b),{'verbose':_0x1a0b0b[_0x156a54(0x17e)]}),_0xe54261=_0x3f13ab[_0x156a54(0x186)],_0x3fd428=_0x1a0b0b[_0x156a54(0x23f)];let _0x21f2de;if(_0x3fd428)try{const _0x40f087=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x203a29['journey'][_0x156a54(0x1f0)](_0x44ec9b),{'verbose':_0x1a0b0b[_0x156a54(0x17e)]});_0x21f2de=_0x40f087[_0x156a54(0x186)];}catch{_0x1a0b0b[_0x156a54(0x17e)]&&console[_0x156a54(0x1ff)](_0x156a54(0x203));}const _0x23c697=getConsoleNextUrl(_0x1a0b0b['site'],_0x156a54(0x1b2)+_0x367322+_0x156a54(0x165)+_0x44ec9b+'/j/da/je'),_0x5d5932={'id':_0xe54261['id'],'name':_0xe54261[_0x156a54(0x184)][_0x156a54(0x15b)],'description':_0xe54261[_0x156a54(0x184)][_0x156a54(0x1eb)],'state':_0xe54261[_0x156a54(0x184)]['state'],'paused':_0xe54261[_0x156a54(0x184)][_0x156a54(0x14c)],'reentry_mode':_0xe54261[_0x156a54(0x184)][_0x156a54(0x197)],'stages':_0xe54261[_0x156a54(0x184)][_0x156a54(0x19f)]?.[_0x156a54(0x21d)]||0x0,..._0xe54261[_0x156a54(0x184)][_0x156a54(0x1ab)]&&{'goal':_0xe54261['attributes'][_0x156a54(0x1ab)][_0x156a54(0x15b)]},..._0x21f2de&&{'statistics':{'size':_0x21f2de[_0x156a54(0x169)],'entered':_0x21f2de[_0x156a54(0x152)],'goal_achieved':_0x21f2de[_0x156a54(0x240)],'completion_rate':_0x21f2de[_0x156a54(0x1c4)],'exit_or_jump':_0x21f2de[_0x156a54(0x1fe)],'exit_or_jump_rate':_0x21f2de[_0x156a54(0x178)],'stages':_0x21f2de[_0x156a54(0x1e5)]}},'url':_0x23c697};return await handleSingleObjectOutput(_0x5d5932,_0x1a0b0b),0x0;}}function a26_0x1963(){const _0x2312ec=['/e/','\x20\x20Preserving\x20local\x20segment\x20name:\x20','add','\x20->\x20','size','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','filter','segments','green','stringify','getJourney','Cancelled','Could\x20not\x20resolve\x20parent\x20segment.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','localeCompare','then','Creating\x20new\x20version...','parentName','Error:\x20Parent\x20segment\x20context\x20required','\x20changed\x20files','exitOrJumpRate','journey:pause','no_parent','folderId','log','Aborted.','verbose','resolveParentId','listJourneysFromParentSegment','✔\x20Pulled\x20','join','Show\x20journey\x20details','attributes','\x20\x20Folder\x20path:\x20','data','View\x20a\x20specific\x20version\x20of\x20a\x20journey','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','resourceName','Pause\x20a\x20running\x20journey','parentSegment','segmentPushCommand','List\x20journeys\x20in\x20current\x20context','cwd','user','json','completed','\x20=\x20','stageNameMap','\x22.\x20Must\x20be\x20\x22conversion\x22\x20or\x20\x22activation\x22.','options','listActivationsFlat','reentryMode','resolveJourneyId','dryRun','journey:push','journey:list','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Getting\x20journey\x20traffic\x20data...','journey:activations','journeyStages','\x20(draft)\x20—\x20\x22','Listing\x20journey\x20activations...','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','✔\x20All\x20files\x20are\x20up\x20to\x20date','Fetching\x20','base','rootFolderId','split','Warning:\x20Could\x20not\x20resolve\x20segment\x20','hasChanges','\x20activation','goal','\x0aChanges\x20to\x20\x27','Pausing\x20journey...','Show\x20journey\x20table\x20column\x20mapping','Table:\x20','\x20new\x20files','.yml','/app/ps/','Fetching\x20journeys\x20and\x20folders...','renderStats','type','INVALID_ARGUMENT','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','\x22\x20not\x20found','Resolving\x20journey...','setPhase','Export\x20journey(s)\x20as\x20YAML\x20files','Error:\x20Version\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','audienceId','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','toLowerCase','\x22\x20resumed','journey:columns','completionRate','set','\x27\x20not\x20found\x20in\x20','jsonl','table','Getting\x20version\x20','Usage:\x20tdx\x20journey\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Inside\x20a\x20segment\x20folder\x20(with\x20tdx.json)','\x20version','version','Get\x20journey\x20traffic\x20data\x20(Sankey\x20charts)','Found\x20','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','Journey\x20name:\x20','Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation','Create\x20a\x20new\x20draft\x20version\x20of\x20a\x20journey','Listing\x20journeys...','\x20Opening\x20','yes','\x20versions)','launched','archived','Error:\x20','Getting\x20column\x20mapping...','file','entries','✔\x20Journey\x20\x22','web','sort','Fetching\x20users\x20and\x20connections...','4762715JPzHIZ','11895384Gohxln','has','journey:view','stages','folders','\x20\x20Journey\x20ID:\x20','1104664HlHnJy','\x20not\x20found.\x20Available:\x20','createVersion','description','Usage:\x20journey\x20<subcommand>\x20<name-or-path>','\x0aError:','replace','kind','getStatistics','includeHistory','Error:\x20Journey\x20not\x20found:\x20','Fetching\x20parent\x20segment...','database','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','nodes','Pattern:\x20','Input:\x20','journeyName','connector_config','Traffic\x20data\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','from','...','exitOrJumpSize','error','\x20files?','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','\x5c$&','\x20\x20Statistics\x20not\x20available','versionNumber','\x20(rule\x20match)','Warning:\x20--include-history\x20without\x20--from/--to\x20may\x20return\x20all-time\x20history','Resolving\x20version...','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20\x20Parent\x20segment:\x20','isNew','filePath','(completed)','Usage:\x20journey\x20version\x20view\x20<name-or-path>\x20--version\x20N','✔\x20Found\x20','conversion','columns','journey:resume','cyan','journeyId','errorCode','helpText','Resolving\x20parent\x20segment...','Target\x20file:\x20','Getting\x20journey\x20statistics...','state','links','-\x20no\x20files\x20written','blue','length','hasPeriod','Resume\x20a\x20paused\x20journey','map','Database:\x20','Create\x20a\x20new\x20draft\x20version\x20of\x20journey\x20\x22','journey:pull','Available\x20stages:\x20','\x20(ID:\x20','590796yLLJrZ','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','message','getColumnMapping','✔\x20Context\x20set:\x20','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','bold','stage','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','journeyBundleId','(draft)','history','draft','folderPath','journeys','getParentFull','listVersions','dim','test','journey:versions','segmentName','journeyBundleName','utf-8','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','includeStats','goalSize','Warning:\x20Could\x20not\x20resolve\x20activation\x20','parent_segment','If\x20the\x20journey\x20is\x20active,\x20the\x20date\x20range\x20may\x20be\x20too\x20wide.\x20Try\x20a\x20shorter\x20period\x20(max\x20~90\x20days).','all','createdAt','activationParams','activation','relative','📁\x20','execute','find','push','Parent\x20segment:\x20','site','tdx.json','\x20Created\x20v','Error:\x20--version\x20option\x20is\x20required','Target\x20directory:\x20','root\x20folder','rule','segment','\x20\x20Target:\x20','(root)','Getting\x20journey\x20details...','3208926qaPEPL','repeat','/j/da','2384505JXRLcP','yellow','Listing\x20journey\x20versions...',',\x20version:\x20','\x20\x20-\x20','List\x20all\x20versions\x20of\x20a\x20journey','format','paused','content','Error:\x20Stage\x20\x22','287200OJGOdW','get','activation_','enteredSize','Error:\x20Invalid\x20version\x20number:\x20','(paused)','/j/da/je','\x20journey','journey:version:create','\x20journeys','\x0aPull\x20summary:','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','name','getSegment','journey','\x20details...','connection','4KothhV','Options:','targetDir','diff','values'];a26_0x1963=function(){return _0x2312ec;};return a26_0x1963();}export class JourneyStatsCommand extends BaseCommand{[a26_0xd9fd1b(0x15b)]='journey:stats';[a26_0xd9fd1b(0x1eb)]='Show\x20journey\x20statistics';async[a26_0xd9fd1b(0x133)](_0x559be8){const _0x3810b8=a26_0xd9fd1b,{options:_0x1feba5,args:_0xe5fd94,tdx:_0x2e5bad}=_0x559be8,_0xf1e00f=_0xe5fd94[0x0];if(!requireNameOrPath(_0xf1e00f))return 0x1;_0x1feba5[_0x3810b8(0x17e)]&&console[_0x3810b8(0x1ff)](_0x3810b8(0x1f8)+_0xf1e00f);const _0x5e2d6d=_0x1feba5,_0x216d25=_0x5e2d6d[_0x3810b8(0x1fc)],_0x25d954=_0x5e2d6d['to'],_0x7466f6=_0x5e2d6d[_0x3810b8(0x1f1)],_0x569502=_0x5e2d6d[_0x3810b8(0x22e)];_0x7466f6&&!_0x216d25&&!_0x25d954&&console['error'](_0x3810b8(0x206));const _0x52fe48=_0x7466f6?withJsonFormat(_0x1feba5):_0x1feba5,{journeyId:_0x552d1e,journeyName:_0x4bf26a}=await resolveJourneyIdFromInput(_0xf1e00f,_0x52fe48,_0x2e5bad),_0x45302c=_0x216d25||_0x25d954?{'from':_0x216d25,'to':_0x25d954}:undefined,_0x7850f8=await withSpinner(_0x3810b8(0x218),()=>Promise[_0x3810b8(0x244)]([_0x2e5bad['journey']['getJourney'](_0x552d1e),_0x2e5bad['journey'][_0x3810b8(0x1f0)](_0x552d1e,_0x45302c)]),{'verbose':_0x52fe48[_0x3810b8(0x17e)]}),[_0x10d144,_0x3e98ab]=_0x7850f8['data'];if(!_0x3e98ab||_0x3e98ab[_0x3810b8(0x213)]===null)return console[_0x3810b8(0x1ff)]('No\x20statistics\x20available\x20for\x20journey:\x20'+_0x4bf26a),console[_0x3810b8(0x1ff)](_0x3810b8(0x22c)),0x0;const _0x9aeffb=buildStageNameMap(_0x10d144),_0x4d7da2=!!(_0x45302c&&_0x3e98ab[_0x3810b8(0x232)]?.[_0x3810b8(0x21d)]),_0x227f1c={'stageNameMap':_0x9aeffb,'hasPeriod':_0x4d7da2,'includeHistory':!!_0x7466f6};if(_0x569502&&_0x3e98ab['stages']){const _0x2e6439=_0x3e98ab[_0x3810b8(0x1e5)][_0x3810b8(0x134)](_0x2518f4=>{const _0x15d186=_0x3810b8,_0x132212=_0x9aeffb[_0x15d186(0x150)](_0x2518f4['id'])??'';return _0x132212[_0x15d186(0x1c1)]()===_0x569502[_0x15d186(0x1c1)]();});if(_0x2e6439)return await handleSingleObjectOutput(formatStageStats(_0x2e6439,_0x227f1c),_0x52fe48),0x0;const _0xcf0557=_0x3e98ab[_0x3810b8(0x1e5)][_0x3810b8(0x220)](_0x23e62e=>_0x9aeffb[_0x3810b8(0x150)](_0x23e62e['id'])??_0x23e62e['id']);return console[_0x3810b8(0x1ff)](_0x3810b8(0x14e)+_0x569502+_0x3810b8(0x1b9)),console['error'](_0x3810b8(0x224)+_0xcf0557[_0x3810b8(0x182)](',\x20')),0x1;}const _0x483164=_0x3e98ab[_0x3810b8(0x1e5)]?.[_0x3810b8(0x220)](_0x355f32=>formatStageStats(_0x355f32,_0x227f1c)),_0x562d2d=assembleJourneyStats(_0x3e98ab,{'from':_0x216d25,'to':_0x25d954,'includeHistory':_0x7466f6});return await this[_0x3810b8(0x1b4)](_0x562d2d,_0x483164??[],_0x52fe48),0x0;}async['renderStats'](_0x11894a,_0x11a5c5,_0x1bfbff){const _0x4ae6a3=a26_0xd9fd1b,_0x257c17=_0x1bfbff[_0x4ae6a3(0x14b)]==='json'||_0x1bfbff['format']===_0x4ae6a3(0x1c7)||_0x1bfbff[_0x4ae6a3(0x190)]||_0x1bfbff['jsonl'];if(_0x257c17){_0x11894a[_0x4ae6a3(0x1e5)]=_0x11a5c5,await handleSingleObjectOutput(_0x11894a,_0x1bfbff);return;}await handleSingleObjectOutput(_0x11894a,_0x1bfbff);for(const _0x470473 of _0x11a5c5){console['log'](''),console[_0x4ae6a3(0x17c)](String(a26_0x4d8a10[_0x4ae6a3(0x212)][_0x4ae6a3(0x22d)]('['+_0x470473['name']+']'))+a26_0x4d8a10[_0x4ae6a3(0x238)]('\x20'+_0x470473['id']));const {id:_0x115f8e,name:_0x146c4b,..._0x1773f3}=_0x470473;await handleSingleObjectOutput(_0x1773f3,_0x1bfbff);}}}export class JourneyTrafficCommand extends BaseCommand{[a26_0xd9fd1b(0x15b)]='journey:traffic';['description']=a26_0xd9fd1b(0x1cd);async[a26_0xd9fd1b(0x133)](_0x45d323){const _0xc9705=a26_0xd9fd1b,{options:_0x4846ce,args:_0x171946,tdx:_0x397b2c}=_0x45d323,_0x4bc11a=_0x171946[0x0];if(!requireNameOrPath(_0x4bc11a))return 0x1;_0x4846ce[_0xc9705(0x17e)]&&console[_0xc9705(0x1ff)]('Input:\x20'+_0x4bc11a);const _0x3f4aed=_0x4846ce,_0x48a5ff=_0x3f4aed[_0xc9705(0x1b5)],_0x4cde5d=_0x3f4aed[_0xc9705(0x1fc)],_0x55d469=_0x3f4aed['to'],_0x6d1e64=_0x3f4aed['limit'];if(_0x48a5ff&&_0x48a5ff!==_0xc9705(0x20f)&&_0x48a5ff!==_0xc9705(0x130))return console[_0xc9705(0x1ff)]('Error:\x20Invalid\x20--type\x20\x22'+_0x48a5ff+_0xc9705(0x194)),0x1;const _0x30253a=withJsonFormat(_0x4846ce),{journeyId:_0x25d45f,journeyName:_0x5963b9}=await resolveJourneyIdFromInput(_0x4bc11a,_0x30253a,_0x397b2c),_0x5e4d45={'type':_0x48a5ff,'from':_0x4cde5d,'to':_0x55d469,'limit':_0x6d1e64},_0x517ec=await withSpinner(_0xc9705(0x19d),()=>_0x397b2c[_0xc9705(0x15d)]['getTrafficData'](_0x25d45f,_0x5e4d45),{'verbose':_0x30253a['verbose']}),_0x5438eb=_0x517ec[_0xc9705(0x186)],_0x53fc6f=_0x5438eb[_0xc9705(0x20f)]&&(_0x5438eb['conversion'][_0xc9705(0x1f6)][_0xc9705(0x21d)]>0x0||_0x5438eb[_0xc9705(0x20f)][_0xc9705(0x21a)][_0xc9705(0x21d)]>0x0),_0x42e3de=_0x5438eb[_0xc9705(0x130)]&&_0x5438eb[_0xc9705(0x130)][_0xc9705(0x21d)]>0x0;if(!_0x53fc6f&&!_0x42e3de)return console['error']('No\x20traffic\x20data\x20available\x20for\x20journey:\x20'+_0x5963b9),console[_0xc9705(0x1ff)](_0xc9705(0x1fb)),_0x4cde5d&&_0x55d469&&console[_0xc9705(0x1ff)](_0xc9705(0x243)),0x0;return await handleSingleObjectOutput(_0x5438eb,_0x30253a),0x0;}}function formatStageStats(_0x1c6ed6,_0x27de0b){const _0x6ec1e0=a26_0xd9fd1b,_0x5b9b62=_0x27de0b['hasPeriod']&&_0x1c6ed6['history']?.[_0x6ec1e0(0x21d)]?aggregateStageHistory(_0x1c6ed6[_0x6ec1e0(0x232)]):{'size':_0x1c6ed6[_0x6ec1e0(0x169)],'entered':_0x1c6ed6[_0x6ec1e0(0x152)],'milestone':_0x1c6ed6['milestoneSize'],'milestone_rate':_0x1c6ed6['completeMilestoneRate'],'exit_or_jump':_0x1c6ed6[_0x6ec1e0(0x1fe)],'exit_or_jump_rate':_0x1c6ed6[_0x6ec1e0(0x178)]},_0x4c6dbb={'id':_0x1c6ed6['id'],'name':_0x27de0b[_0x6ec1e0(0x193)][_0x6ec1e0(0x150)](_0x1c6ed6['id'])??_0x1c6ed6['id'],..._0x5b9b62};return _0x27de0b[_0x6ec1e0(0x21e)]&&_0x27de0b[_0x6ec1e0(0x1f1)]&&_0x1c6ed6['history']&&(_0x4c6dbb[_0x6ec1e0(0x232)]=_0x1c6ed6[_0x6ec1e0(0x232)]),_0x4c6dbb;}export class JourneyPauseCommand extends BaseCommand{['name']=a26_0xd9fd1b(0x179);['description']=a26_0xd9fd1b(0x18a);async[a26_0xd9fd1b(0x133)](_0x4e7c84){const _0x4bf3d2=a26_0xd9fd1b,{options:_0x30e4e4,args:_0x478313,tdx:_0x367e78}=_0x4e7c84,_0x2672e4=_0x478313[0x0];if(!requireNameOrPath(_0x2672e4))return 0x1;_0x30e4e4[_0x4bf3d2(0x17e)]&&console[_0x4bf3d2(0x1ff)](_0x4bf3d2(0x1f8)+_0x2672e4);const {journeyId:_0x21ac71,journeyName:_0x3e57c8}=await resolveJourneyIdFromInput(_0x2672e4,_0x30e4e4,_0x367e78);if(!_0x30e4e4[_0x4bf3d2(0x1d5)]){const _0x4b94a2=await confirm(_0x4bf3d2(0x188)+_0x3e57c8+'\x22?');if(!_0x4b94a2)return console[_0x4bf3d2(0x1ff)](_0x4bf3d2(0x170)),0x0;}const _0x29d6e4=await withSpinner(_0x4bf3d2(0x1ad),()=>_0x367e78[_0x4bf3d2(0x15d)]['pause'](_0x21ac71),{'verbose':_0x30e4e4[_0x4bf3d2(0x17e)]}),_0x7a956f=_0x29d6e4[_0x4bf3d2(0x186)];return console['error'](_0x4bf3d2(0x1dd)+_0x7a956f[_0x4bf3d2(0x184)][_0x4bf3d2(0x15b)]+'\x22\x20paused'),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a26_0xd9fd1b(0x15b)]=a26_0xd9fd1b(0x211);[a26_0xd9fd1b(0x1eb)]=a26_0xd9fd1b(0x21f);async[a26_0xd9fd1b(0x133)](_0x4f8609){const _0x1a61eb=a26_0xd9fd1b,{options:_0x2ff7ac,args:_0x24f555,tdx:_0x16b181}=_0x4f8609,_0x56d6b9=_0x24f555[0x0];if(!requireNameOrPath(_0x56d6b9))return 0x1;_0x2ff7ac[_0x1a61eb(0x17e)]&&console[_0x1a61eb(0x1ff)](_0x1a61eb(0x1f8)+_0x56d6b9);const {journeyId:_0x459e8c,journeyName:_0x575e2a}=await resolveJourneyIdFromInput(_0x56d6b9,_0x2ff7ac,_0x16b181);if(!_0x2ff7ac['yes']){const _0x942995=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22'+_0x575e2a+'\x22?');if(!_0x942995)return console[_0x1a61eb(0x1ff)](_0x1a61eb(0x170)),0x0;}const _0x4855fd=await withSpinner('Resuming\x20journey...',()=>_0x16b181['journey']['resume'](_0x459e8c),{'verbose':_0x2ff7ac[_0x1a61eb(0x17e)]}),_0xf1ec72=_0x4855fd['data'];return console[_0x1a61eb(0x1ff)](_0x1a61eb(0x1dd)+_0xf1ec72[_0x1a61eb(0x184)][_0x1a61eb(0x15b)]+_0x1a61eb(0x1c2)),0x0;}}export class JourneyPullCommand extends BaseCommand{['name']=a26_0xd9fd1b(0x223);[a26_0xd9fd1b(0x1eb)]=a26_0xd9fd1b(0x1bc);async[a26_0xd9fd1b(0x133)](_0x60171c){const _0x5aadeb=a26_0xd9fd1b,{options:_0x24f00b,args:_0xb736d3,tdx:_0x4e2d18}=_0x60171c,_0x2b6d7f=_0x24f00b,_0x47e772=_0xb736d3[0x0],_0x288b32=_0x47e772&&isYamlFilePath(_0x47e772),_0x567222=await resolveTarget({'arg':_0x288b32?_0x47e772:undefined,'contextParent':_0x24f00b[_0x5aadeb(0x18b)],'cwd':process[_0x5aadeb(0x18e)]()});if(!isSuccessfulResolution(_0x567222))return _0x567222[_0x5aadeb(0x214)]===_0x5aadeb(0x17a)?(console[_0x5aadeb(0x1ff)](a26_0x4d8a10[_0x5aadeb(0x146)](_0x5aadeb(0x19c))),console[_0x5aadeb(0x1ff)](_0x5aadeb(0x1ca)),console[_0x5aadeb(0x1ff)](_0x5aadeb(0x1be)),console[_0x5aadeb(0x1ff)](_0x5aadeb(0x227)),console[_0x5aadeb(0x1ff)](_0x5aadeb(0x1b7))):(console['error'](a26_0x4d8a10['red'](_0x5aadeb(0x1d9)+_0x567222[_0x5aadeb(0x229)]+'\x0a')),_0x567222[_0x5aadeb(0x215)]&&console['error'](a26_0x4d8a10[_0x5aadeb(0x212)](_0x567222['helpText']))),0x1;let _0x4e9c50=_0x288b32?undefined:_0x47e772,_0x1b723a,_0x211493;_0x567222['type']===_0x5aadeb(0x1db)&&(_0x4e9c50=_0x567222[_0x5aadeb(0x189)],_0x1b723a=_0x567222[_0x5aadeb(0x20b)],_0x211493=_0x567222[_0x5aadeb(0x234)]);const _0x675a9b=_0x567222[_0x5aadeb(0x175)],_0x5cd88f=_0x567222[_0x5aadeb(0x162)];_0x2b6d7f[_0x5aadeb(0x17e)]&&(console[_0x5aadeb(0x1ff)](_0x5aadeb(0x136)+_0x675a9b),console['error'](_0x5aadeb(0x13b)+_0x5cd88f),_0x4e9c50&&console[_0x5aadeb(0x1ff)](_0x5aadeb(0x1d0)+_0x4e9c50),_0x1b723a&&console['error'](_0x5aadeb(0x217)+_0x1b723a),_0x211493&&console[_0x5aadeb(0x1ff)]('Folder\x20path:\x20'+_0x211493));const _0x1cfaca=await withSpinner(_0x5aadeb(0x216),()=>_0x4e2d18[_0x5aadeb(0x13e)][_0x5aadeb(0x17f)](_0x675a9b),{'verbose':_0x24f00b[_0x5aadeb(0x17e)]}),_0x5c0e25=_0x1cfaca[_0x5aadeb(0x186)],{journeys:_0x53ac61,folders:_0x305f5d}=await withSpinner(_0x5aadeb(0x1b3),async()=>{const _0x5e6e5a=_0x5aadeb,[_0x4168a5,_0x345161]=await Promise['all']([_0x4e2d18['journey'][_0x5e6e5a(0x180)](_0x5c0e25,undefined,{'includeAllVersions':!![]}),_0x4e2d18[_0x5e6e5a(0x13e)]['listFolders'](_0x5c0e25)]);return{'journeys':_0x4168a5,'folders':_0x345161};},{'verbose':_0x24f00b['verbose']})[_0x5aadeb(0x173)](_0xa32474=>_0xa32474['data']);let _0x2b0ffc=_0x53ac61;const _0x408bc8=buildFolderIdToPathMap(_0x305f5d);if(_0x4e9c50){const _0x32aca5=_0x2b0ffc['filter'](_0x339e90=>_0x339e90[_0x5aadeb(0x23c)][_0x5aadeb(0x1c1)]()===_0x4e9c50[_0x5aadeb(0x1c1)]());if(_0x32aca5['length']===0x0)return console[_0x5aadeb(0x1ff)](_0x5aadeb(0x1f2)+_0x4e9c50),console[_0x5aadeb(0x1ff)](_0x5aadeb(0x1b8)),0x1;_0x2b0ffc=_0x32aca5;}if(_0x211493!==undefined){const _0x1958e9=_0x2b0ffc['filter'](_0x5f1bb9=>{const _0x369210=_0x5aadeb,_0xcf8b14=_0x5f1bb9['folderId']?_0x408bc8[_0x369210(0x150)](_0x5f1bb9['folderId'])||'':'';return _0xcf8b14===_0x211493;});if(_0x1958e9[_0x5aadeb(0x21d)]===0x0&&_0x2b0ffc[_0x5aadeb(0x21d)]>0x0){console[_0x5aadeb(0x1ff)]('Error:\x20Journey\x20\x27'+_0x4e9c50+_0x5aadeb(0x1c6)+(_0x211493||_0x5aadeb(0x13c))),console[_0x5aadeb(0x1ff)](_0x5aadeb(0x201));for(const _0x5e21c9 of _0x2b0ffc){const _0x4acc2a=_0x5e21c9[_0x5aadeb(0x17b)]?_0x408bc8[_0x5aadeb(0x150)](_0x5e21c9[_0x5aadeb(0x17b)])||'':'';console[_0x5aadeb(0x1ff)](_0x5aadeb(0x149)+(_0x4acc2a||_0x5aadeb(0x140))+'/'+_0x5e21c9['journeyBundleName']);}return 0x1;}_0x2b0ffc=_0x1958e9;}if(_0x2b0ffc[_0x5aadeb(0x21d)]===0x0)return console[_0x5aadeb(0x1ff)]('No\x20journeys\x20found'),0x0;const _0x75e383=new Map();for(const _0x22cbf2 of _0x2b0ffc){const _0x344f6e=_0x22cbf2[_0x5aadeb(0x230)];!_0x75e383[_0x5aadeb(0x1e3)](_0x344f6e)&&_0x75e383[_0x5aadeb(0x1c5)](_0x344f6e,[]),_0x75e383[_0x5aadeb(0x150)](_0x344f6e)['push'](_0x22cbf2);}for(const _0x308069 of _0x75e383['values']()){_0x308069['sort']((_0x4c82a8,_0x3b52d1)=>(_0x4c82a8[_0x5aadeb(0x204)]||0x0)-(_0x3b52d1['versionNumber']||0x0));}const _0xbfa028=[],{idToEmailMap:_0x12a703,connectionIdToNameMap:_0x5e704b}=await withSpinner(_0x5aadeb(0x1e0),async()=>{const _0x20ad21=_0x5aadeb,[_0x10dd47,_0x177477]=await Promise['all']([_0x4e2d18[_0x20ad21(0x18f)]['buildIdToEmailMap'](),_0x4e2d18[_0x20ad21(0x15f)]['buildIdToNameMap']()]);return{'idToEmailMap':_0x10dd47,'connectionIdToNameMap':_0x177477};},{'verbose':_0x24f00b[_0x5aadeb(0x17e)]})[_0x5aadeb(0x173)](_0x4afa26=>_0x4afa26[_0x5aadeb(0x186)]);for(const _0x1192f9 of _0x75e383[_0x5aadeb(0x164)]()){const _0x32e08f=_0x1192f9[0x0][_0x5aadeb(0x23c)],_0x2a6d78=_0x1192f9[0x0]['folderId'],_0xa2130=_0x2a6d78?_0x408bc8[_0x5aadeb(0x150)](_0x2a6d78)||'':'',_0x427921=_0xa2130?a26_0xc0c7af[_0x5aadeb(0x182)](_0x5cd88f,_0xa2130):_0x5cd88f,_0x3135bb=_0x1b723a||a26_0xc0c7af[_0x5aadeb(0x182)](_0x427921,sanitizeFileName(_0x32e08f)+_0x5aadeb(0x1b1));let _0x66174b,_0x94d3be;if(existsSync(_0x3135bb))try{const _0x153e50=readFileSync(_0x3135bb,'utf-8'),_0x1df77c=parseYamlString(_0x153e50);_0x94d3be=_0x1df77c,_0x66174b=buildRuleToNameMapping(_0x1df77c),_0x2b6d7f[_0x5aadeb(0x17e)]&&_0x66174b[_0x5aadeb(0x169)]>0x0&&console[_0x5aadeb(0x1ff)](_0x5aadeb(0x1ce)+_0x66174b[_0x5aadeb(0x169)]+_0x5aadeb(0x15a)+_0x32e08f);}catch(_0x5f3b04){_0x2b6d7f['verbose']&&console[_0x5aadeb(0x1ff)]('Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20'+_0x5f3b04[_0x5aadeb(0x229)]);}const _0x400780=[],_0x15cdbd=new Set(),_0x4870b6=new Map(),_0x329871=new Map(),_0x2f27aa=new Set(),_0x843329=new Map(),_0x5b59aa=new Map(),_0xd7e15e=createJumpTargetCache();await withProgressSpinner(_0x5aadeb(0x1a4)+_0x32e08f+_0x5aadeb(0x1fd),async _0x541afb=>{const _0x43c307=_0x5aadeb;for(const _0x59b34b of _0x1192f9){const _0x3d3f30=_0x1192f9[_0x43c307(0x21d)]>0x1?_0x59b34b[_0x43c307(0x23c)]+'\x20v'+(_0x59b34b[_0x43c307(0x204)]||0x1):_0x59b34b[_0x43c307(0x23c)];_0x541afb[_0x43c307(0x1bb)](_0x43c307(0x1a4)+_0x3d3f30);const _0x49c383=await _0x4e2d18[_0x43c307(0x15d)][_0x43c307(0x16f)](_0x59b34b['id']),_0x1c76ca=_0x49c383[_0x43c307(0x184)]?.[_0x43c307(0x1bf)],_0x5cb4be={'resolveSegment':async _0x56bda5=>{const _0xc33f24=_0x43c307;if(!_0x1c76ca)return{'name':_0x56bda5,'isJourneyLocal':![]};const _0xe13e46=_0x4870b6['get'](_0x56bda5);if(_0xe13e46)return _0xe13e46;try{const _0x56e5d1=await _0x4e2d18[_0xc33f24(0x13e)][_0xc33f24(0x15c)](_0x1c76ca,_0x56bda5),_0x588882=_0x56e5d1[_0xc33f24(0x1ef)]===SEGMENT_KIND_JOURNEY;let _0x5a3a05,_0x262e1c=_0x56e5d1[_0xc33f24(0x15b)];if(_0x588882&&_0x56e5d1['rule']){const _0x12fa8c=await segmentResponseToDef(_0x56e5d1,{'resolveSegmentName':async _0x3e32bc=>{const _0x54029a=_0xc33f24,_0xf56782=_0x4870b6[_0x54029a(0x150)](_0x3e32bc);if(_0xf56782)return _0xf56782[_0x54029a(0x15b)];const _0x71b21=await _0x5cb4be['resolveSegment'](_0x3e32bc);return _0x71b21[_0x54029a(0x15b)];}}),_0x1588af=_0x12fa8c[_0xc33f24(0x13d)];_0x5a3a05={'description':_0x56e5d1[_0xc33f24(0x1eb)],'rule':_0x1588af};const _0x2a6f40=serializeRule(_0x1588af),_0x14e6b9=_0x329871[_0xc33f24(0x150)](_0x2a6f40);if(_0x14e6b9)_0x262e1c=_0x14e6b9,_0x5a3a05=undefined,_0x2b6d7f[_0xc33f24(0x17e)]&&console[_0xc33f24(0x1ff)]('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0x56e5d1[_0xc33f24(0x15b)]+_0xc33f24(0x168)+_0x14e6b9);else{let _0x2fc10c=![];if(_0x66174b){const _0x210f2a=_0x66174b['get'](_0x2a6f40);if(_0x210f2a){const _0x947bc7=_0x210f2a[_0xc33f24(0x134)](_0x514eb2=>!_0x15cdbd['has'](_0x514eb2));_0x947bc7&&(_0x262e1c=_0x947bc7,_0x15cdbd[_0xc33f24(0x167)](_0x947bc7),_0x329871[_0xc33f24(0x1c5)](_0x2a6f40,_0x947bc7),_0x2fc10c=!![],_0x2b6d7f[_0xc33f24(0x17e)]&&console[_0xc33f24(0x1ff)](_0xc33f24(0x166)+_0x947bc7+_0xc33f24(0x205)));}}if(!_0x2fc10c){const _0x5bed08=generateJourneyLocalName(_0x56e5d1[_0xc33f24(0x15b)]);_0x5bed08&&(_0x262e1c=_0x5bed08);let _0x71795a=_0x262e1c,_0x5d8f6c=0x2;while(_0x15cdbd[_0xc33f24(0x1e3)](_0x71795a)){_0x71795a=_0x262e1c+'_'+_0x5d8f6c,_0x5d8f6c++;}_0x15cdbd['add'](_0x71795a),_0x329871['set'](_0x2a6f40,_0x71795a),_0x262e1c=_0x71795a;}}}const _0x1751d3={'name':_0x262e1c,'isJourneyLocal':_0x588882,'definition':_0x5a3a05};return _0x4870b6[_0xc33f24(0x1c5)](_0x56bda5,_0x1751d3),_0x1751d3;}catch(_0x3e2985){return _0x24f00b[_0xc33f24(0x17e)]&&console[_0xc33f24(0x1ff)](_0xc33f24(0x1a8)+_0x56bda5+':\x20'+_0x3e2985['message']),{'name':_0x56bda5,'isJourneyLocal':![]};}},'resolveActivation':async _0x4bf6dd=>{const _0x336c04=_0x43c307,_0x5e0f29=_0x843329[_0x336c04(0x150)](_0x4bf6dd);if(_0x5e0f29)return _0x5e0f29;try{const _0x54d5cf=await _0x4e2d18['journey']['getActivation'](_0x59b34b['id'],_0x4bf6dd),_0x48f0af=journeyActivationStepToYaml(_0x54d5cf,_0x12a703,_0x5e704b),_0x387a86=JSON[_0x336c04(0x16e)]({'name':_0x48f0af[_0x336c04(0x15b)],'connection':_0x48f0af['connection'],'connector_config':_0x48f0af[_0x336c04(0x1fa)]}),_0x3cf91d=_0x5b59aa['get'](_0x387a86);if(_0x3cf91d){const _0x48a925={'name':_0x3cf91d,'isJourneyLocal':!![],'definition':_0x48f0af};return _0x843329[_0x336c04(0x1c5)](_0x4bf6dd,_0x48a925),_0x48a925;}const _0x642249=_0x54d5cf[_0x336c04(0x184)][_0x336c04(0x12f)][_0x336c04(0x15b)]||_0x4bf6dd,_0x2ca205=sanitizeYamlKey(_0x642249)||_0x336c04(0x151)+_0x4bf6dd;let _0x46e939=_0x2ca205,_0x2c4eca=0x2;while(_0x2f27aa['has'](_0x46e939)){_0x46e939=_0x2ca205+'_'+_0x2c4eca,_0x2c4eca++;}_0x2f27aa[_0x336c04(0x167)](_0x46e939),_0x5b59aa[_0x336c04(0x1c5)](_0x387a86,_0x46e939);const _0x5a6977={'name':_0x46e939,'isJourneyLocal':!![],'definition':_0x48f0af};return _0x843329[_0x336c04(0x1c5)](_0x4bf6dd,_0x5a6977),_0x5a6977;}catch(_0x554394){return _0x24f00b[_0x336c04(0x17e)]&&console[_0x336c04(0x1ff)](_0x336c04(0x241)+_0x4bf6dd+':\x20'+_0x554394[_0x336c04(0x229)]),{'name':_0x4bf6dd,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x4128df,_0x1f3d59)=>{const _0x8c78e6=_0x43c307;return resolveJumpTarget(_0x4128df,_0x1f3d59,_0xd7e15e,_0x233661=>_0x4e2d18[_0x8c78e6(0x15d)][_0x8c78e6(0x16f)](_0x233661));}},_0x2d54f2=await journeyResponseToDef(_0x49c383,_0x5cb4be);_0x400780[_0x43c307(0x135)]({'item':_0x59b34b,'yaml':_0x2d54f2});}},{'verbose':_0x24f00b[_0x5aadeb(0x17e)]});const _0x26ac26=await _0x4e2d18[_0x5aadeb(0x15d)]['getLatestJourneyId'](_0x1192f9[0x0][_0x5aadeb(0x230)]),_0x5e5c52=buildMergedJourneyDef(_0x400780,_0x66174b,_0x26ac26),_0x491f3d=normalizeJourneyDef(_0x5e5c52,_0x94d3be),_0x51805b=toYamlString(_0x491f3d),_0x35a367=_0x1b723a||a26_0xc0c7af[_0x5aadeb(0x182)](_0x427921,sanitizeFileName(_0x32e08f)+_0x5aadeb(0x1b1));!_0x1b723a&&_0xa2130&&!existsSync(_0x427921)&&mkdirSync(_0x427921,{'recursive':!![]});const _0x23cd90=a26_0xc0c7af[_0x5aadeb(0x131)](process[_0x5aadeb(0x18e)](),_0x35a367);if(existsSync(_0x35a367)){const _0x364f18=readFileSync(_0x35a367,_0x5aadeb(0x23d)),_0x2fbc97=generateDiff(_0x364f18,_0x51805b),_0x4665a1=hasChanges(_0x2fbc97);_0xbfa028[_0x5aadeb(0x135)]({'relativePath':_0x23cd90,'absolutePath':_0x35a367,'content':_0x51805b,'isNew':![],'hasChanges':_0x4665a1,'diff':_0x4665a1?formatDiffWithColors(_0x2fbc97):undefined});}else _0xbfa028[_0x5aadeb(0x135)]({'relativePath':_0x23cd90,'absolutePath':_0x35a367,'content':_0x51805b,'isNew':!![],'hasChanges':![]});}const _0x1990b9=_0xbfa028['filter'](_0x1bfc91=>_0x1bfc91[_0x5aadeb(0x20a)]),_0x237519=_0xbfa028[_0x5aadeb(0x16b)](_0x3e43b5=>!_0x3e43b5[_0x5aadeb(0x20a)]&&_0x3e43b5['hasChanges']),_0x4722fa=_0xbfa028[_0x5aadeb(0x16b)](_0x3284fa=>!_0x3284fa[_0x5aadeb(0x20a)]&&!_0x3284fa[_0x5aadeb(0x1a9)]),_0x48c38c=_0x2b0ffc[_0x5aadeb(0x21d)],_0x506947=_0x75e383[_0x5aadeb(0x169)],_0x170f06=_0x48c38c>_0x506947?'\x20('+_0x48c38c+_0x5aadeb(0x1d6):'';console[_0x5aadeb(0x1ff)](_0x5aadeb(0x159)),console[_0x5aadeb(0x1ff)]('\x20\x20'+a26_0x4d8a10[_0x5aadeb(0x212)](_0x506947+_0x5aadeb(0x158))+a26_0x4d8a10[_0x5aadeb(0x238)](_0x170f06)),console[_0x5aadeb(0x1ff)]('\x20\x20'+a26_0x4d8a10[_0x5aadeb(0x16d)]('+\x20'+_0x1990b9['length']+_0x5aadeb(0x1b0))),console[_0x5aadeb(0x1ff)]('\x20\x20'+a26_0x4d8a10['yellow']('~\x20'+_0x237519['length']+_0x5aadeb(0x177))),console[_0x5aadeb(0x1ff)]('\x20\x20'+a26_0x4d8a10[_0x5aadeb(0x238)]('=\x20'+_0x4722fa[_0x5aadeb(0x21d)]+'\x20unchanged\x20files')),console[_0x5aadeb(0x1ff)](_0x5aadeb(0x13f)+a26_0x4d8a10[_0x5aadeb(0x212)](_0x5cd88f)+'\x0a');if(_0x237519[_0x5aadeb(0x21d)]>0x0)for(const _0x557450 of _0x237519){console[_0x5aadeb(0x1ff)](_0x5aadeb(0x1ac)+_0x557450['relativePath']+'\x27:'),console['error']('─'[_0x5aadeb(0x143)](0x3c)),console[_0x5aadeb(0x1ff)](_0x557450[_0x5aadeb(0x163)]),console[_0x5aadeb(0x1ff)]('─'[_0x5aadeb(0x143)](0x3c));}if(_0x2b6d7f[_0x5aadeb(0x199)])return console['error'](a26_0x4d8a10[_0x5aadeb(0x146)](_0x5aadeb(0x23e))),0x0;if(_0x1990b9[_0x5aadeb(0x21d)]===0x0&&_0x237519['length']===0x0)return console['error'](a26_0x4d8a10['green'](_0x5aadeb(0x1a3))),saveSessionContext({'parent_segment':_0x675a9b},_0x2b6d7f['session']),console[_0x5aadeb(0x1ff)](a26_0x4d8a10[_0x5aadeb(0x16d)](_0x5aadeb(0x22b)+a26_0x4d8a10[_0x5aadeb(0x238)](_0x5aadeb(0x242))+_0x5aadeb(0x192)+a26_0x4d8a10['cyan'](_0x675a9b))),0x0;if(!_0x2b6d7f[_0x5aadeb(0x1d5)]&&(_0x1990b9[_0x5aadeb(0x21d)]>0x0||_0x237519[_0x5aadeb(0x21d)]>0x0)){if(!isInteractive())return console['error'](a26_0x4d8a10['red'](_0x5aadeb(0x1ed)),_0x5aadeb(0x1f5)),console[_0x5aadeb(0x1ff)](a26_0x4d8a10[_0x5aadeb(0x238)](_0x5aadeb(0x1d1))),0x1;const _0x1eeabe=await confirmKey('Write\x20'+(_0x1990b9[_0x5aadeb(0x21d)]+_0x237519['length'])+_0x5aadeb(0x200));if(!_0x1eeabe)return console[_0x5aadeb(0x1ff)](a26_0x4d8a10[_0x5aadeb(0x146)](_0x5aadeb(0x17d)),_0x5aadeb(0x21b)),0x1;}!existsSync(_0x5cd88f)&&mkdirSync(_0x5cd88f,{'recursive':!![]});const _0x548a18=a26_0xc0c7af[_0x5aadeb(0x182)](_0x5cd88f,_0x5aadeb(0x138));writeFileSync(_0x548a18,createTdxConfigContent(_0x675a9b),'utf-8');for(const _0x570837 of _0xbfa028){(_0x570837['isNew']||_0x570837[_0x5aadeb(0x1a9)])&&writeFileSync(_0x570837['absolutePath'],_0x570837[_0x5aadeb(0x14d)],_0x5aadeb(0x23d));}return console[_0x5aadeb(0x1ff)](a26_0x4d8a10['green'](_0x5aadeb(0x181)+(_0x1990b9[_0x5aadeb(0x21d)]+_0x237519[_0x5aadeb(0x21d)])+'\x20journey\x20files\x20to\x20'+_0x5cd88f)),saveSessionContext({'parent_segment':_0x675a9b},_0x2b6d7f['session']),console[_0x5aadeb(0x1ff)](a26_0x4d8a10[_0x5aadeb(0x16d)](_0x5aadeb(0x22b)+a26_0x4d8a10[_0x5aadeb(0x238)](_0x5aadeb(0x242))+'\x20=\x20'+a26_0x4d8a10[_0x5aadeb(0x212)](_0x675a9b))),0x0;}}export class JourneyColumnsCommand extends BaseCommand{[a26_0xd9fd1b(0x15b)]=a26_0xd9fd1b(0x1c3);[a26_0xd9fd1b(0x1eb)]=a26_0xd9fd1b(0x1ae);async[a26_0xd9fd1b(0x133)](_0x502554){const _0x31b745=a26_0xd9fd1b,{options:_0x214bf1,args:_0x233229,tdx:_0x4380fa}=_0x502554,_0x45f47f=_0x233229[0x0];if(!requireNameOrPath(_0x45f47f))return 0x1;_0x214bf1[_0x31b745(0x17e)]&&console[_0x31b745(0x1ff)](_0x31b745(0x1f8)+_0x45f47f);const {journeyId:_0x1e1ff1}=await resolveJourneyIdFromInput(_0x45f47f,_0x214bf1,_0x4380fa),_0x46d3ac=await withSpinner(_0x31b745(0x1da),()=>_0x4380fa['journey'][_0x31b745(0x22a)](_0x1e1ff1),{'verbose':_0x214bf1[_0x31b745(0x17e)]}),_0x1b73d0=_0x46d3ac[_0x31b745(0x186)];return console['log'](_0x31b745(0x221)+_0x1b73d0[_0x31b745(0x1f4)]),console['log'](_0x31b745(0x1af)+_0x1b73d0[_0x31b745(0x1c8)]),await handleSDKOutput(_0x1b73d0[_0x31b745(0x210)],_0x214bf1),0x0;}}export class JourneyActivationsCommand extends BaseCommand{[a26_0xd9fd1b(0x15b)]=a26_0xd9fd1b(0x19e);[a26_0xd9fd1b(0x1eb)]='List\x20activations\x20for\x20a\x20journey';async[a26_0xd9fd1b(0x133)](_0x4ac02e){const _0x110f71=a26_0xd9fd1b,{options:_0xab6834,args:_0x2f9669,tdx:_0x10aaea}=_0x4ac02e,_0x3d6ded=_0x2f9669[0x0];if(!requireNameOrPath(_0x3d6ded))return 0x1;_0xab6834[_0x110f71(0x17e)]&&console['error'](_0x110f71(0x1f8)+_0x3d6ded);const {journeyId:_0x277792}=await resolveJourneyIdFromInput(_0x3d6ded,_0xab6834,_0x10aaea),_0x37e2d6=await withSpinner(_0x110f71(0x1a1),()=>_0x10aaea[_0x110f71(0x15d)][_0x110f71(0x196)](_0x277792),{'verbose':_0xab6834[_0x110f71(0x17e)]}),_0x35f879=_0x37e2d6['data'];return console[_0x110f71(0x1ff)](_0x110f71(0x1ce)+_0x35f879['length']+_0x110f71(0x1aa)+(_0x35f879[_0x110f71(0x21d)]!==0x1?'s':'')),await handleSDKOutput(_0x35f879,_0xab6834),0x0;}}export class JourneyPushCommand extends BaseCommand{[a26_0xd9fd1b(0x15b)]=a26_0xd9fd1b(0x19a);[a26_0xd9fd1b(0x1eb)]=a26_0xd9fd1b(0x16a);[a26_0xd9fd1b(0x18c)]=new SegmentPushCommand();async['execute'](_0x146ec7){const _0x5cc7c5=a26_0xd9fd1b,_0xeee0e=_0x146ec7['args'][0x0];let _0x5713a7;if(_0xeee0e){const _0xec3c70=await resolveTarget({'arg':_0xeee0e,'contextParent':_0x146ec7[_0x5cc7c5(0x195)][_0x5cc7c5(0x18b)],'cwd':process[_0x5cc7c5(0x18e)]()});isSuccessfulResolution(_0xec3c70)&&_0xec3c70[_0x5cc7c5(0x1b5)]==='file'&&(_0x5713a7=_0xec3c70['filePath']);}const _0xf809bf={..._0x146ec7,'options':{..._0x146ec7[_0x5cc7c5(0x195)],'journeysOnly':!![],..._0x5713a7&&{'singleFilePath':_0x5713a7}}};return this[_0x5cc7c5(0x18c)][_0x5cc7c5(0x133)](_0xf809bf);}}export class JourneyVersionsCommand extends BaseCommand{['name']=a26_0xd9fd1b(0x23a);[a26_0xd9fd1b(0x1eb)]=a26_0xd9fd1b(0x14a);async[a26_0xd9fd1b(0x133)](_0x3fcc13){const _0x5be4f4=a26_0xd9fd1b,{options:_0xcf3ac0,args:_0x152a77,tdx:_0x4c574f}=_0x3fcc13,_0x3529a4=_0x152a77[0x0];if(!requireNameOrPath(_0x3529a4))return 0x1;if(_0xcf3ac0[_0x5be4f4(0x17e)])console[_0x5be4f4(0x1ff)](_0x5be4f4(0x1f8)+_0x3529a4);const {journeyId:_0x5201ba}=await resolveJourneyIdFromInput(_0x3529a4,_0xcf3ac0,_0x4c574f),_0x26e89a=await withSpinner(_0x5be4f4(0x147),()=>_0x4c574f[_0x5be4f4(0x15d)][_0x5be4f4(0x237)](_0x5201ba),{'verbose':_0xcf3ac0[_0x5be4f4(0x17e)]}),{bundleName:_0x323c5e,versions:_0x203678,latestJourneyId:_0x9e906c}=_0x26e89a[_0x5be4f4(0x186)];console[_0x5be4f4(0x1ff)](_0x323c5e+':\x20'+_0x203678[_0x5be4f4(0x21d)]+_0x5be4f4(0x1cb)+(_0x203678[_0x5be4f4(0x21d)]!==0x1?'s':''));const _0x23cfee=_0x203678[_0x5be4f4(0x220)](_0x48e1ef=>({'version':_0x48e1ef[_0x5be4f4(0x204)],'journey_id':_0x48e1ef[_0x5be4f4(0x213)],'name':_0x48e1ef[_0x5be4f4(0x15b)],'state':_0x48e1ef[_0x5be4f4(0x219)],'paused':_0x48e1ef[_0x5be4f4(0x14c)],'latest':_0x48e1ef[_0x5be4f4(0x213)]===_0x9e906c,'created_at':_0x48e1ef[_0x5be4f4(0x12e)]}));return await handleSDKOutput(_0x23cfee,_0xcf3ac0),0x0;}}export class JourneyVersionCreateCommand extends BaseCommand{[a26_0xd9fd1b(0x15b)]=a26_0xd9fd1b(0x157);[a26_0xd9fd1b(0x1eb)]=a26_0xd9fd1b(0x1d2);async[a26_0xd9fd1b(0x133)](_0xdbd912){const _0x2a9d80=a26_0xd9fd1b,{options:_0x2d5091,args:_0x319346,tdx:_0x125a01}=_0xdbd912,_0x256692=_0x319346[0x0];if(!requireNameOrPath(_0x256692))return 0x1;if(_0x2d5091[_0x2a9d80(0x17e)])console[_0x2a9d80(0x1ff)]('Input:\x20'+_0x256692);const {journeyId:_0x53c2eb,journeyName:_0x18e15f}=await resolveJourneyIdFromInput(_0x256692,_0x2d5091,_0x125a01);if(!_0x2d5091['yes']){const _0x5525d7=await confirm(_0x2a9d80(0x222)+_0x18e15f+'\x22?');if(!_0x5525d7)return console[_0x2a9d80(0x1ff)](_0x2a9d80(0x170)),0x0;}const _0x2de843=await withSpinner(_0x2a9d80(0x174),()=>_0x125a01['journey'][_0x2a9d80(0x1ea)](_0x53c2eb),{'verbose':_0x2d5091[_0x2a9d80(0x17e)]}),_0x1eb7c3=_0x2de843['data'];return console[_0x2a9d80(0x1ff)](a26_0x4d8a10[_0x2a9d80(0x16d)]('✔')+_0x2a9d80(0x139)+_0x1eb7c3[_0x2a9d80(0x184)][_0x2a9d80(0x204)]+_0x2a9d80(0x1a0)+_0x1eb7c3[_0x2a9d80(0x184)][_0x2a9d80(0x15b)]+'\x22'),console[_0x2a9d80(0x1ff)](_0x2a9d80(0x1e7)+_0x1eb7c3['id']),await handleSingleObjectOutput({'id':_0x1eb7c3['id'],'name':_0x1eb7c3['attributes']['name'],'version':_0x1eb7c3['attributes'][_0x2a9d80(0x204)],'state':_0x1eb7c3[_0x2a9d80(0x184)][_0x2a9d80(0x219)],'bundle_id':_0x1eb7c3[_0x2a9d80(0x184)][_0x2a9d80(0x230)],'created_at':_0x1eb7c3['attributes'][_0x2a9d80(0x12e)]},_0x2d5091),0x0;}}export class JourneyVersionViewCommand extends BaseCommand{[a26_0xd9fd1b(0x15b)]='journey:version:view';[a26_0xd9fd1b(0x1eb)]=a26_0xd9fd1b(0x187);async['execute'](_0x41abfa){const _0x4c1e1e=a26_0xd9fd1b,{options:_0x49b17f,args:_0x4183c4,tdx:_0x1ffacc}=_0x41abfa,_0x49dd7b=_0x4183c4[0x0];if(!requireNameOrPath(_0x49dd7b))return 0x1;const _0x50517e=_0x49b17f[_0x4c1e1e(0x1cc)];if(!_0x50517e)return console[_0x4c1e1e(0x1ff)](_0x4c1e1e(0x13a)),console['error'](_0x4c1e1e(0x20d)),0x1;const _0x29d0df=parseInt(_0x50517e,0xa);if(isNaN(_0x29d0df)||_0x29d0df<0x1)return console[_0x4c1e1e(0x1ff)](_0x4c1e1e(0x153)+_0x50517e),0x1;if(_0x49b17f[_0x4c1e1e(0x17e)])console[_0x4c1e1e(0x1ff)]('Input:\x20'+_0x49dd7b+_0x4c1e1e(0x148)+_0x29d0df);const {journeyId:_0x348906,parentSegmentId:_0x3d1357}=await resolveJourneyIdFromInput(_0x49dd7b,_0x49b17f,_0x1ffacc),_0xe46a1d=await withSpinner(_0x4c1e1e(0x207),()=>_0x1ffacc[_0x4c1e1e(0x15d)][_0x4c1e1e(0x237)](_0x348906),{'verbose':_0x49b17f[_0x4c1e1e(0x17e)]}),{versions:_0x45059b,latestJourneyId:_0x588778}=_0xe46a1d[_0x4c1e1e(0x186)],_0x34dd2d=_0x45059b[_0x4c1e1e(0x134)](_0x17b3ac=>_0x17b3ac[_0x4c1e1e(0x204)]===_0x29d0df);if(!_0x34dd2d){const _0x29b40c=_0x45059b[_0x4c1e1e(0x220)](_0xf4fb40=>'v'+_0xf4fb40[_0x4c1e1e(0x204)])[_0x4c1e1e(0x182)](',\x20');return console[_0x4c1e1e(0x1ff)](_0x4c1e1e(0x1bd)+_0x29d0df+_0x4c1e1e(0x1e9)+_0x29b40c),0x1;}const _0x28fe68=await withSpinner(_0x4c1e1e(0x1c9)+_0x29d0df+_0x4c1e1e(0x15e),()=>_0x1ffacc[_0x4c1e1e(0x15d)][_0x4c1e1e(0x16f)](_0x34dd2d[_0x4c1e1e(0x213)]),{'verbose':_0x49b17f[_0x4c1e1e(0x17e)]}),_0xb3df9b=_0x28fe68['data'],_0x3f2e0a=getConsoleNextUrl(_0x49b17f[_0x4c1e1e(0x137)],'/app/ps/'+_0x3d1357+_0x4c1e1e(0x165)+_0x34dd2d['journeyId']+_0x4c1e1e(0x155));return await handleSingleObjectOutput({'id':_0xb3df9b['id'],'name':_0xb3df9b[_0x4c1e1e(0x184)][_0x4c1e1e(0x15b)],'version':_0xb3df9b[_0x4c1e1e(0x184)][_0x4c1e1e(0x204)],'description':_0xb3df9b[_0x4c1e1e(0x184)]['description'],'state':_0xb3df9b[_0x4c1e1e(0x184)][_0x4c1e1e(0x219)],'paused':_0xb3df9b['attributes'][_0x4c1e1e(0x14c)],'reentry_mode':_0xb3df9b[_0x4c1e1e(0x184)][_0x4c1e1e(0x197)],'stages':_0xb3df9b[_0x4c1e1e(0x184)][_0x4c1e1e(0x19f)]?.[_0x4c1e1e(0x21d)]||0x0,..._0xb3df9b[_0x4c1e1e(0x184)][_0x4c1e1e(0x1ab)]&&{'goal':_0xb3df9b[_0x4c1e1e(0x184)][_0x4c1e1e(0x1ab)]['name']},'latest':_0x34dd2d[_0x4c1e1e(0x213)]===_0x588778,'created_at':_0xb3df9b[_0x4c1e1e(0x184)]['createdAt'],'updated_at':_0xb3df9b['attributes']['updatedAt'],'url':_0x3f2e0a},_0x49b17f),0x0;}}
|
|
1
|
+
const a26_0x1da60b=a26_0x538c;(function(_0x4aa070,_0x468d31){const _0xaf3346=a26_0x538c,_0x532055=_0x4aa070();while(!![]){try{const _0x309218=parseInt(_0xaf3346(0x1dd))/0x1+-parseInt(_0xaf3346(0x2b3))/0x2+-parseInt(_0xaf3346(0x1d4))/0x3*(parseInt(_0xaf3346(0x242))/0x4)+-parseInt(_0xaf3346(0x238))/0x5+parseInt(_0xaf3346(0x2a5))/0x6+-parseInt(_0xaf3346(0x1ea))/0x7+parseInt(_0xaf3346(0x207))/0x8*(parseInt(_0xaf3346(0x20f))/0x9);if(_0x309218===_0x468d31)break;else _0x532055['push'](_0x532055['shift']());}catch(_0x50dda2){_0x532055['push'](_0x532055['shift']());}}}(a26_0x27bc,0x2ca77));import a26_0xd062a4 from'chalk';import a26_0x51d0c5 from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{aggregateStageHistory,assembleJourneyStats,buildStageNameMap}from'../sdk/journey.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';function a26_0x538c(_0x54734f,_0x2e4d0){_0x54734f=_0x54734f-0x1bf;const _0x27bc12=a26_0x27bc();let _0x538c6e=_0x27bc12[_0x54734f];return _0x538c6e;}import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey,isInteractive}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';import{isYamlFilePath,resolveYamlFilePath}from'../sdk/segment/segment-path-parser.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{journeyResponseToDef,toYamlString,parseYamlString,normalizeJourneyDef}from'../sdk/segment/journey-yaml.js';import{segmentResponseToDef,journeyActivationStepToYaml,serializeRule}from'../sdk/segment/child-segment-yaml.js';import{saveSessionContext}from'../core/session.js';function a26_0x27bc(){const _0x17a8b6=['length','split','state','\x20journey','\x22\x20not\x20found','\x20changed\x20files','site','Usage:\x20journey\x20<subcommand>\x20<name-or-path>','3204AEDeGg','(completed)','description','utf-8','all','Creating\x20new\x20version...','goal','journeyStages','journeyName','\x20journey\x20files\x20to\x20','parent_segment','completed','\x20unchanged\x20files','journey:pull','dryRun','sort','(root)','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','web','file','\x22.\x20Must\x20be\x20\x22conversion\x22\x20or\x20\x22activation\x22.','getTrafficData','size','completionRate','Error:\x20--version\x20option\x20is\x20required','columns','resolveSegment','no_parent','journey:view','\x20\x20Journey\x20ID:\x20','/j/da/je','replace','map','segmentPushCommand','history','Listing\x20journey\x20versions...','✔\x20All\x20files\x20are\x20up\x20to\x20date','\x20\x20Statistics\x20not\x20available','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','connector_config','\x22\x20resumed','🗺️\x20','\x27\x20not\x20found\x20in\x20','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','milestoneSize','\x20not\x20found.\x20Available:\x20','...','Table:\x20','Confirmation\x20required\x20but\x20running\x20in\x20non-interactive\x20mode','table','message','Error:\x20Parent\x20segment\x20context\x20required','✔\x20Found\x20','folderId','getStatistics','Warning:\x20Could\x20not\x20resolve\x20activation\x20','\x20details...','createdAt','Cancelled','Fetching\x20','then','reentryMode','activation','getColumnMapping','toLowerCase','yes','-\x20no\x20files\x20written','📁\x20','journey:version:create','stages','relative','tdx.json','includeHistory','\x20->\x20','targetDir','parentName','name','resolveJourneyId','updatedAt','Resolving\x20version...','Target\x20directory:\x20','journey:activations','conversion','cyan','format','hasPeriod','Usage:\x20tdx\x20journey\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Inside\x20a\x20segment\x20folder\x20(with\x20tdx.json)','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','Resolved\x20YAML\x20file:\x20','repeat','isNew','content','(paused)','listJourneysFromParentSegment','getJourney','Warning:\x20Could\x20not\x20resolve\x20segment\x20','\x20journeys','1243470nDPPyC','args','error','Folder\x20path:\x20','parentSegment','/j/da','log','from','jsonl','values','Parent\x20segment:\x20','\x20(ID:\x20','/app/ps/','set','666960kMUavP','createVersion','journey:pause','execute','\x5c$&','join','Target\x20file:\x20','versionNumber','completeMilestoneRate','folders','helpText','limit','get','add','database','Options:','setPhase','stage','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','links','renderStats','yellow','\x0aError:','has','Warning:\x20--include-history\x20without\x20--from/--to\x20may\x20return\x20all-time\x20history','Pausing\x20journey...','buildIdToEmailMap','getActivation','getSegment','\x0aChanges\x20to\x20\x27','(draft)','✔\x20Pulled\x20','Database:\x20','Resolving\x20parent\x20segment...','push','\x20Opening\x20','localeCompare','resourceName','archived','654ySGAVt','green','Getting\x20column\x20mapping...','session','listActivationsFlat','entries','absolutePath','Resolving\x20journey...','kind','213289IgvomU','journeyBundleId','Getting\x20version\x20','\x20(draft)\x20—\x20\x22','Found\x20','journeyBundleName','includeStats','resolveParentId','resume','✔\x20Context\x20set:\x20','rule','journey','listVersions','69811AvRuoO','hasChanges','No\x20statistics\x20available\x20for\x20journey:\x20','verbose','journey:columns','Pattern:\x20','Getting\x20journey\x20details...','No\x20journeys\x20found','journey:version:view','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','segments','buildIdToNameMap','List\x20all\x20versions\x20of\x20a\x20journey','journey:resume','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','find','segmentName','stringify','Create\x20a\x20new\x20draft\x20version\x20of\x20a\x20journey','\x20\x20-\x20','cwd','base','json','View\x20a\x20specific\x20version\x20of\x20a\x20journey','data','\x20\x20Name:\x20','filter','segment','\x20(rule\x20match)','8XaaQVM','Show\x20journey\x20details','type','root\x20folder','activation_','\x20new\x20files','/e/','\x20\x20Folder\x20path:\x20','3295719EXICqx','(archived)','diff','Write\x20','red','Getting\x20journey\x20statistics...','dim','pause','getParentFull','✔\x20Journey\x20\x22','Journey\x20name:\x20','\x20=\x20','folderPath','relativePath','Input:\x20','filePath','\x20version','exitOrJumpRate','Available\x20stages:\x20','Error:\x20Invalid\x20version\x20number:\x20','\x20activation','journeyId','Fetching\x20parent\x20segment...','Listing\x20journey\x20activations...','nodes','options','version','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','Could\x20not\x20resolve\x20parent\x20segment.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Fetching\x20users\x20and\x20connections...','journey:traffic','Error:\x20Stage\x20\x22','audienceId','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','exitOrJumpSize','activationParams','attributes','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','listFolders','journey:stats','enteredSize','428755NQTKSw','Show\x20journey\x20statistics'];a26_0x27bc=function(){return _0x17a8b6;};return a26_0x27bc();}import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.js';import{createTdxConfigContent}from'../sdk/segment/tdx-config.js';import{SEGMENT_KIND_JOURNEY,generateJourneyLocalName,sanitizeYamlKey,buildMergedJourneyDef,createJumpTargetCache,resolveJumpTarget}from'../sdk/segment/journey-utils.js';import{getConsoleNextUrl}from'../sdk/client/endpoints.js';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function requireNameOrPath(_0x27cbba){const _0x500af9=a26_0x538c;return!_0x27cbba&&(console[_0x500af9(0x2a7)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x500af9(0x2a7)](_0x500af9(0x241))),!!_0x27cbba;}function withJsonFormat(_0x60aba){const _0x363721=a26_0x538c;if(!_0x60aba[_0x363721(0x297)]&&!_0x60aba[_0x363721(0x200)]&&!_0x60aba[_0x363721(0x2ad)]&&!_0x60aba['tsv'])return{..._0x60aba,'format':_0x363721(0x200),'json':!![]};return _0x60aba;}function formatJourneyState(_0x5961c6){const _0x99e850=a26_0x538c;switch(_0x5961c6){case'launched':return a26_0xd062a4['green']('(running)');case'draft':return a26_0xd062a4[_0x99e850(0x215)](_0x99e850(0x1cb));case'paused':return a26_0xd062a4['yellow'](_0x99e850(0x2a0));case _0x99e850(0x24d):return a26_0xd062a4['blue'](_0x99e850(0x243));case _0x99e850(0x1d3):return a26_0xd062a4['dim'](_0x99e850(0x210));default:return'('+_0x5961c6+')';}}function formatJourneyItem(_0x30742e,_0x317477='',_0x56fcc4){const _0x5934c5=a26_0x538c,_0x260fb3=formatJourneyState(_0x30742e[_0x5934c5(0x23c)]),_0x4af024=_0x56fcc4?hyperlink(_0x30742e['journeyBundleName'],_0x56fcc4):_0x30742e[_0x5934c5(0x1e2)];return _0x317477+_0x5934c5(0x26c)+_0x4af024+'\x20'+_0x260fb3;}function escapeRegex(_0x573d25){const _0x21d993=a26_0x538c;return _0x573d25[_0x21d993(0x262)](/[.*+?^${}()|[\]\\]/g,_0x21d993(0x2b7));}function globToRegex(_0x455a05){const _0x279f77=a26_0x538c,_0x5a0e35=_0x455a05[_0x279f77(0x23b)]('*')[_0x279f77(0x263)](escapeRegex);return new RegExp(_0x5a0e35['join']('.*'),'i');}function buildRuleToNameMapping(_0x22e232){const _0x50d965=a26_0x538c,_0x5aff44=new Map();if(_0x22e232[_0x50d965(0x1f4)])for(const [_0x26d537,_0x99bc6d]of Object[_0x50d965(0x1d9)](_0x22e232['segments'])){if(_0x99bc6d[_0x50d965(0x1e7)]){const _0x417853=serializeRule(_0x99bc6d['rule']),_0x222de8=_0x5aff44[_0x50d965(0x2bf)](_0x417853);_0x222de8?_0x222de8['push'](_0x26d537):_0x5aff44[_0x50d965(0x2b2)](_0x417853,[_0x26d537]);}}return _0x5aff44;}async function resolveJourneyIdFromInput(_0x36bed5,_0x31c46e,_0x311304){const _0x4ab8d4=a26_0x538c,_0x5fda9d=await resolveJourneyTarget(_0x36bed5,_0x31c46e[_0x4ab8d4(0x2a9)],_0x31c46e[_0x4ab8d4(0x1ed)]),_0x215557=_0x5fda9d['parentSegment'];if(!_0x215557)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4ab8d4(0x22b));const _0x16f431=await withSpinner(_0x4ab8d4(0x1ce),()=>_0x311304[_0x4ab8d4(0x205)][_0x4ab8d4(0x1e4)](_0x215557),{'verbose':_0x31c46e[_0x4ab8d4(0x1ed)]}),_0x3138b2=_0x16f431[_0x4ab8d4(0x202)],_0x35ec7d=await withSpinner(_0x4ab8d4(0x1db),()=>_0x311304[_0x4ab8d4(0x1e8)][_0x4ab8d4(0x290)](_0x3138b2,_0x5fda9d[_0x4ab8d4(0x24a)]),{'verbose':_0x31c46e[_0x4ab8d4(0x1ed)]});return{'journeyId':_0x35ec7d[_0x4ab8d4(0x202)],'journeyName':_0x5fda9d['journeyName'],'parentSegmentId':_0x3138b2};}async function resolveJourneyTarget(_0x209bf5,_0x54c871,_0x4dc035){const _0x2cda9e=a26_0x538c;if(isYamlFilePath(_0x209bf5))try{const _0x1908de=await resolveYamlFilePath(_0x209bf5);return _0x4dc035&&(console[_0x2cda9e(0x2a7)](_0x2cda9e(0x29c)+_0x209bf5),console[_0x2cda9e(0x2a7)]('\x20\x20Parent\x20segment:\x20'+_0x1908de[_0x2cda9e(0x2a9)]),console['error'](_0x2cda9e(0x203)+_0x1908de['segmentName']),console[_0x2cda9e(0x2a7)](_0x2cda9e(0x20e)+(_0x1908de['folderPath']||_0x2cda9e(0x252)))),{'journeyName':_0x1908de[_0x2cda9e(0x1fa)],'parentSegment':_0x1908de[_0x2cda9e(0x2a9)],'resolved':_0x1908de};}catch(_0x7f6fa){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2cda9e(0x1f8)+_0x7f6fa['message']);}if(!_0x54c871)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2cda9e(0x253));return{'journeyName':_0x209bf5,'parentSegment':_0x54c871};}export class JourneyListCommand extends BaseCommand{[a26_0x1da60b(0x28f)]='journey:list';['description']='List\x20journeys\x20in\x20current\x20context';async['execute'](_0x12ade7){const _0x2eef2c=a26_0x1da60b,{options:_0x515740,args:_0xc31ff9,tdx:_0x4a62f7}=_0x12ade7,_0x1794dc=_0xc31ff9[0x0],_0x5d27dc=_0x515740[_0x2eef2c(0x2a9)];if(!_0x5d27dc)return console['error'](_0x2eef2c(0x276)),console[_0x2eef2c(0x2a7)](_0x2eef2c(0x1f3)),0x1;const _0x52b2e2=await withSpinner(_0x2eef2c(0x1ce),()=>_0x4a62f7[_0x2eef2c(0x205)][_0x2eef2c(0x1e4)](_0x5d27dc),{'verbose':_0x515740['verbose']}),_0x3c40bb=_0x52b2e2['data'];_0x515740[_0x2eef2c(0x1ed)]&&(console[_0x2eef2c(0x2a7)](_0x2eef2c(0x2af)+_0x5d27dc+_0x2eef2c(0x2b0)+_0x3c40bb+')'),_0x1794dc&&console['error'](_0x2eef2c(0x1ef)+_0x1794dc));const _0x2e90ec=await withSpinner(_0x2eef2c(0x225),()=>_0x4a62f7[_0x2eef2c(0x205)][_0x2eef2c(0x217)](_0x3c40bb),{'verbose':_0x515740[_0x2eef2c(0x1ed)]}),_0x4c0121=_0x2e90ec[_0x2eef2c(0x202)],_0x40b9c3=_0x4c0121['rootFolderId'],_0x314d1d=await withSpinner('Listing\x20journeys...',()=>_0x4a62f7[_0x2eef2c(0x1e8)]['listJourneysWithFolders'](_0x3c40bb,_0x40b9c3),{'verbose':_0x515740['verbose']});let _0x1548f6=_0x314d1d[_0x2eef2c(0x202)]['journeys'];const _0x4e91e5=_0x314d1d[_0x2eef2c(0x202)][_0x2eef2c(0x2bc)],_0x32639b=new Map();for(const _0x5088b4 of _0x4e91e5){_0x32639b['set'](_0x5088b4['id'],_0x5088b4['name']);}if(_0x1794dc){const _0x4bd5c8=globToRegex(_0x1794dc);_0x1548f6=_0x1548f6[_0x2eef2c(0x204)](_0xf2b2e8=>_0x4bd5c8['test'](_0xf2b2e8['journeyBundleName']));}console[_0x2eef2c(0x2a7)](_0x2eef2c(0x277)+_0x1548f6[_0x2eef2c(0x23a)]+_0x2eef2c(0x23d)+(_0x1548f6[_0x2eef2c(0x23a)]!==0x1?'s':''));const _0x36d05d=_0x1d980d=>{const _0x3777af=_0x2eef2c;return getConsoleNextUrl(_0x515740[_0x3777af(0x240)],_0x3777af(0x2b1)+_0x3c40bb+_0x3777af(0x20d)+_0x1d980d+_0x3777af(0x2aa));};if(_0x515740['format']==='table')await handleSDKOutput(_0x1548f6,_0x515740);else{if(_0x515740[_0x2eef2c(0x297)]==='json'){const _0x254a88=_0x1548f6['map'](_0x27606c=>({..._0x27606c,'url':_0x36d05d(_0x27606c['id'])}));await handleSDKOutput(_0x254a88,_0x515740);}else{console['log']('['+_0x5d27dc+']');const _0x13ace7=new Map(),_0x46f0db=[];for(const _0xa1a313 of _0x1548f6){if(!_0xa1a313[_0x2eef2c(0x278)]||_0xa1a313[_0x2eef2c(0x278)]===_0x40b9c3)_0x46f0db[_0x2eef2c(0x1cf)](_0xa1a313);else{const _0x561431=_0x13ace7[_0x2eef2c(0x2bf)](_0xa1a313[_0x2eef2c(0x278)])||[];_0x561431[_0x2eef2c(0x1cf)](_0xa1a313),_0x13ace7[_0x2eef2c(0x2b2)](_0xa1a313[_0x2eef2c(0x278)],_0x561431);}}const _0x469b29=(_0xc5400,_0x5e42e3)=>_0xc5400[_0x2eef2c(0x1e2)][_0x2eef2c(0x1d1)](_0x5e42e3[_0x2eef2c(0x1e2)],undefined,{'sensitivity':'base'});_0x46f0db[_0x2eef2c(0x251)](_0x469b29);for(const _0x4c82f6 of _0x46f0db){console[_0x2eef2c(0x2ab)](formatJourneyItem(_0x4c82f6,'',_0x36d05d(_0x4c82f6['id'])));}const _0x3de02d=[..._0x13ace7[_0x2eef2c(0x1d9)]()][_0x2eef2c(0x251)]((_0x7644dc,_0x3d003d)=>{const _0xce276c=_0x2eef2c,_0x10334c=_0x32639b[_0xce276c(0x2bf)](_0x7644dc[0x0])||_0x7644dc[0x0],_0xe36461=_0x32639b['get'](_0x3d003d[0x0])||_0x3d003d[0x0];return _0x10334c[_0xce276c(0x1d1)](_0xe36461,undefined,{'sensitivity':_0xce276c(0x1ff)});});for(const [_0x312f5b,_0x30acd0]of _0x3de02d){const _0x35a753=_0x32639b[_0x2eef2c(0x2bf)](_0x312f5b)||_0x312f5b;console[_0x2eef2c(0x2ab)](_0x2eef2c(0x286)+_0x35a753),_0x30acd0[_0x2eef2c(0x251)](_0x469b29);for(const _0x5cba68 of _0x30acd0){console['log'](formatJourneyItem(_0x5cba68,'\x20\x20',_0x36d05d(_0x5cba68['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a26_0x1da60b(0x28f)]=a26_0x1da60b(0x25f);[a26_0x1da60b(0x244)]=a26_0x1da60b(0x208);async['execute'](_0x588c23){const _0x51d149=a26_0x1da60b,{options:_0x1a2d41,args:_0x4e2cc6,tdx:_0x2a06fb}=_0x588c23,_0x14b762=_0x4e2cc6[0x0];if(!_0x14b762)return console[_0x51d149(0x2a7)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x51d149(0x2a7)](_0x51d149(0x1bf)),console[_0x51d149(0x2a7)](_0x51d149(0x2c2)),console[_0x51d149(0x2a7)]('\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser'),0x1;_0x1a2d41[_0x51d149(0x1ed)]&&console[_0x51d149(0x2a7)](_0x51d149(0x21d)+_0x14b762);const {journeyId:_0xcb158,parentSegmentId:_0xe1126}=await resolveJourneyIdFromInput(_0x14b762,_0x1a2d41,_0x2a06fb);if(_0x1a2d41[_0x51d149(0x255)]){const _0x21bb07=getConsoleNextUrl(_0x1a2d41[_0x51d149(0x240)],_0x51d149(0x2b1)+_0xe1126+_0x51d149(0x20d)+_0xcb158+_0x51d149(0x261));return console[_0x51d149(0x2a7)](a26_0xd062a4[_0x51d149(0x1d5)]('✔')+_0x51d149(0x1d0)+a26_0xd062a4['cyan'](_0x21bb07)),openBrowser(_0x21bb07),0x0;}const _0x4f5f95=await withSpinner(_0x51d149(0x1f0),()=>_0x2a06fb[_0x51d149(0x1e8)][_0x51d149(0x2a2)](_0xcb158),{'verbose':_0x1a2d41[_0x51d149(0x1ed)]}),_0x3b8390=_0x4f5f95[_0x51d149(0x202)],_0x1a4a67=_0x1a2d41[_0x51d149(0x1e3)];let _0x1f9980;if(_0x1a4a67)try{const _0x55ea80=await withSpinner(_0x51d149(0x214),()=>_0x2a06fb[_0x51d149(0x1e8)]['getStatistics'](_0xcb158),{'verbose':_0x1a2d41[_0x51d149(0x1ed)]});_0x1f9980=_0x55ea80[_0x51d149(0x202)];}catch{_0x1a2d41[_0x51d149(0x1ed)]&&console[_0x51d149(0x2a7)](_0x51d149(0x268));}const _0x41508b=getConsoleNextUrl(_0x1a2d41[_0x51d149(0x240)],_0x51d149(0x2b1)+_0xe1126+_0x51d149(0x20d)+_0xcb158+_0x51d149(0x261)),_0x1f00fb={'id':_0x3b8390['id'],'name':_0x3b8390[_0x51d149(0x233)][_0x51d149(0x28f)],'description':_0x3b8390[_0x51d149(0x233)][_0x51d149(0x244)],'state':_0x3b8390[_0x51d149(0x233)]['state'],'paused':_0x3b8390[_0x51d149(0x233)]['paused'],'reentry_mode':_0x3b8390[_0x51d149(0x233)][_0x51d149(0x280)],'stages':_0x3b8390['attributes'][_0x51d149(0x249)]?.[_0x51d149(0x23a)]||0x0,..._0x3b8390[_0x51d149(0x233)][_0x51d149(0x248)]&&{'goal':_0x3b8390[_0x51d149(0x233)]['goal'][_0x51d149(0x28f)]},..._0x1f9980&&{'statistics':{'size':_0x1f9980['size'],'entered':_0x1f9980[_0x51d149(0x237)],'goal_achieved':_0x1f9980['goalSize'],'completion_rate':_0x1f9980[_0x51d149(0x25a)],'exit_or_jump':_0x1f9980[_0x51d149(0x231)],'exit_or_jump_rate':_0x1f9980['exitOrJumpRate'],'stages':_0x1f9980[_0x51d149(0x288)]}},'url':_0x41508b};return await handleSingleObjectOutput(_0x1f00fb,_0x1a2d41),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a26_0x1da60b(0x28f)]=a26_0x1da60b(0x236);[a26_0x1da60b(0x244)]=a26_0x1da60b(0x239);async[a26_0x1da60b(0x2b6)](_0x354385){const _0x14cd16=a26_0x1da60b,{options:_0x10209c,args:_0x25b8ae,tdx:_0x4479d4}=_0x354385,_0x1cb422=_0x25b8ae[0x0];if(!requireNameOrPath(_0x1cb422))return 0x1;_0x10209c[_0x14cd16(0x1ed)]&&console[_0x14cd16(0x2a7)](_0x14cd16(0x21d)+_0x1cb422);const _0xecf8fd=_0x10209c,_0xa85cc4=_0xecf8fd[_0x14cd16(0x2ac)],_0x5a564d=_0xecf8fd['to'],_0x285ef5=_0xecf8fd[_0x14cd16(0x28b)],_0x48e756=_0xecf8fd[_0x14cd16(0x2c4)];_0x285ef5&&!_0xa85cc4&&!_0x5a564d&&console[_0x14cd16(0x2a7)](_0x14cd16(0x1c5));const _0x6b97bf=_0x285ef5?withJsonFormat(_0x10209c):_0x10209c,{journeyId:_0x7c8fa6,journeyName:_0x340173}=await resolveJourneyIdFromInput(_0x1cb422,_0x6b97bf,_0x4479d4),_0x14d568=_0xa85cc4||_0x5a564d?{'from':_0xa85cc4,'to':_0x5a564d}:undefined,_0x4cd2b2=await withSpinner(_0x14cd16(0x214),()=>Promise[_0x14cd16(0x246)]([_0x4479d4[_0x14cd16(0x1e8)][_0x14cd16(0x2a2)](_0x7c8fa6),_0x4479d4[_0x14cd16(0x1e8)][_0x14cd16(0x279)](_0x7c8fa6,_0x14d568)]),{'verbose':_0x6b97bf[_0x14cd16(0x1ed)]}),[_0x5f2d64,_0x30dda1]=_0x4cd2b2[_0x14cd16(0x202)];if(!_0x30dda1||_0x30dda1[_0x14cd16(0x224)]===null)return console[_0x14cd16(0x2a7)](_0x14cd16(0x1ec)+_0x340173),console[_0x14cd16(0x2a7)](_0x14cd16(0x29b)),0x0;const _0x5311f2=buildStageNameMap(_0x5f2d64),_0x4eb591=!!(_0x14d568&&_0x30dda1[_0x14cd16(0x265)]?.[_0x14cd16(0x23a)]),_0x566f6b={'stageNameMap':_0x5311f2,'hasPeriod':_0x4eb591,'includeHistory':!!_0x285ef5};if(_0x48e756&&_0x30dda1['stages']){const _0x2da0d3=_0x30dda1[_0x14cd16(0x288)][_0x14cd16(0x1f9)](_0x414e1b=>{const _0x5589b5=_0x14cd16,_0x13dd00=_0x5311f2['get'](_0x414e1b['id'])??'';return _0x13dd00['toLowerCase']()===_0x48e756[_0x5589b5(0x283)]();});if(_0x2da0d3)return await handleSingleObjectOutput(formatStageStats(_0x2da0d3,_0x566f6b),_0x6b97bf),0x0;const _0x5b6aa0=_0x30dda1['stages']['map'](_0x4871f8=>_0x5311f2[_0x14cd16(0x2bf)](_0x4871f8['id'])??_0x4871f8['id']);return console['error'](_0x14cd16(0x22e)+_0x48e756+_0x14cd16(0x23e)),console['error'](_0x14cd16(0x221)+_0x5b6aa0[_0x14cd16(0x2b8)](',\x20')),0x1;}const _0x48e0a8=_0x30dda1['stages']?.[_0x14cd16(0x263)](_0x56e322=>formatStageStats(_0x56e322,_0x566f6b)),_0x2783e6=assembleJourneyStats(_0x30dda1,{'from':_0xa85cc4,'to':_0x5a564d,'includeHistory':_0x285ef5});return await this[_0x14cd16(0x1c1)](_0x2783e6,_0x48e0a8??[],_0x6b97bf),0x0;}async[a26_0x1da60b(0x1c1)](_0x30c85c,_0x49d2c4,_0x5ac0b0){const _0x59182f=a26_0x1da60b,_0x4833e4=_0x5ac0b0[_0x59182f(0x297)]===_0x59182f(0x200)||_0x5ac0b0[_0x59182f(0x297)]===_0x59182f(0x2ad)||_0x5ac0b0[_0x59182f(0x200)]||_0x5ac0b0[_0x59182f(0x2ad)];if(_0x4833e4){_0x30c85c['stages']=_0x49d2c4,await handleSingleObjectOutput(_0x30c85c,_0x5ac0b0);return;}await handleSingleObjectOutput(_0x30c85c,_0x5ac0b0);for(const _0x18e0c9 of _0x49d2c4){console[_0x59182f(0x2ab)](''),console[_0x59182f(0x2ab)](String(a26_0xd062a4[_0x59182f(0x296)]['bold']('['+_0x18e0c9[_0x59182f(0x28f)]+']'))+a26_0xd062a4[_0x59182f(0x215)]('\x20'+_0x18e0c9['id']));const {id:_0x2d8551,name:_0x414094,..._0x28c9cf}=_0x18e0c9;await handleSingleObjectOutput(_0x28c9cf,_0x5ac0b0);}}}export class JourneyTrafficCommand extends BaseCommand{['name']=a26_0x1da60b(0x22d);[a26_0x1da60b(0x244)]='Get\x20journey\x20traffic\x20data\x20(Sankey\x20charts)';async[a26_0x1da60b(0x2b6)](_0x89504d){const _0x1c5970=a26_0x1da60b,{options:_0x34a59d,args:_0x12a149,tdx:_0x5171cf}=_0x89504d,_0xdadbd5=_0x12a149[0x0];if(!requireNameOrPath(_0xdadbd5))return 0x1;_0x34a59d[_0x1c5970(0x1ed)]&&console[_0x1c5970(0x2a7)](_0x1c5970(0x21d)+_0xdadbd5);const _0x3fd03c=_0x34a59d,_0x42f6a4=_0x3fd03c[_0x1c5970(0x209)],_0x227ce7=_0x3fd03c[_0x1c5970(0x2ac)],_0x3bea35=_0x3fd03c['to'],_0x2c2977=_0x3fd03c[_0x1c5970(0x2be)];if(_0x42f6a4&&_0x42f6a4!==_0x1c5970(0x295)&&_0x42f6a4!==_0x1c5970(0x281))return console[_0x1c5970(0x2a7)]('Error:\x20Invalid\x20--type\x20\x22'+_0x42f6a4+_0x1c5970(0x257)),0x1;const _0x2f73ac=withJsonFormat(_0x34a59d),{journeyId:_0x42b530,journeyName:_0x2aeddf}=await resolveJourneyIdFromInput(_0xdadbd5,_0x2f73ac,_0x5171cf),_0x3dd98b={'type':_0x42f6a4,'from':_0x227ce7,'to':_0x3bea35,'limit':_0x2c2977},_0x4125cd=await withSpinner('Getting\x20journey\x20traffic\x20data...',()=>_0x5171cf[_0x1c5970(0x1e8)][_0x1c5970(0x258)](_0x42b530,_0x3dd98b),{'verbose':_0x2f73ac[_0x1c5970(0x1ed)]}),_0x3e9cdc=_0x4125cd[_0x1c5970(0x202)],_0x3239d9=_0x3e9cdc['conversion']&&(_0x3e9cdc[_0x1c5970(0x295)][_0x1c5970(0x227)][_0x1c5970(0x23a)]>0x0||_0x3e9cdc[_0x1c5970(0x295)][_0x1c5970(0x1c0)][_0x1c5970(0x23a)]>0x0),_0x5f59cd=_0x3e9cdc['activation']&&_0x3e9cdc[_0x1c5970(0x281)][_0x1c5970(0x23a)]>0x0;if(!_0x3239d9&&!_0x5f59cd)return console[_0x1c5970(0x2a7)]('No\x20traffic\x20data\x20available\x20for\x20journey:\x20'+_0x2aeddf),console[_0x1c5970(0x2a7)]('Traffic\x20data\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.'),_0x227ce7&&_0x3bea35&&console['error']('If\x20the\x20journey\x20is\x20active,\x20the\x20date\x20range\x20may\x20be\x20too\x20wide.\x20Try\x20a\x20shorter\x20period\x20(max\x20~90\x20days).'),0x0;return await handleSingleObjectOutput(_0x3e9cdc,_0x2f73ac),0x0;}}function formatStageStats(_0x15e64f,_0x2a1c4f){const _0x58c6c4=a26_0x1da60b,_0x410af5=_0x2a1c4f['hasPeriod']&&_0x15e64f['history']?.[_0x58c6c4(0x23a)]?aggregateStageHistory(_0x15e64f[_0x58c6c4(0x265)]):{'size':_0x15e64f['size'],'entered':_0x15e64f[_0x58c6c4(0x237)],'milestone':_0x15e64f[_0x58c6c4(0x26f)],'milestone_rate':_0x15e64f[_0x58c6c4(0x2bb)],'exit_or_jump':_0x15e64f[_0x58c6c4(0x231)],'exit_or_jump_rate':_0x15e64f[_0x58c6c4(0x220)]},_0x23a258={'id':_0x15e64f['id'],'name':_0x2a1c4f['stageNameMap'][_0x58c6c4(0x2bf)](_0x15e64f['id'])??_0x15e64f['id'],..._0x410af5};return _0x2a1c4f[_0x58c6c4(0x298)]&&_0x2a1c4f[_0x58c6c4(0x28b)]&&_0x15e64f['history']&&(_0x23a258[_0x58c6c4(0x265)]=_0x15e64f[_0x58c6c4(0x265)]),_0x23a258;}export class JourneyPauseCommand extends BaseCommand{[a26_0x1da60b(0x28f)]=a26_0x1da60b(0x2b5);[a26_0x1da60b(0x244)]='Pause\x20a\x20running\x20journey';async[a26_0x1da60b(0x2b6)](_0x565bf3){const _0x523a88=a26_0x1da60b,{options:_0x1e6274,args:_0x4f7537,tdx:_0x3b5262}=_0x565bf3,_0x401e51=_0x4f7537[0x0];if(!requireNameOrPath(_0x401e51))return 0x1;_0x1e6274[_0x523a88(0x1ed)]&&console['error'](_0x523a88(0x21d)+_0x401e51);const {journeyId:_0x2af260,journeyName:_0xcdfcc1}=await resolveJourneyIdFromInput(_0x401e51,_0x1e6274,_0x3b5262);if(!_0x1e6274[_0x523a88(0x284)]){const _0x2d7176=await confirm(_0x523a88(0x22a)+_0xcdfcc1+'\x22?');if(!_0x2d7176)return console['error']('Cancelled'),0x0;}const _0x5bc326=await withSpinner(_0x523a88(0x1c6),()=>_0x3b5262[_0x523a88(0x1e8)][_0x523a88(0x216)](_0x2af260),{'verbose':_0x1e6274['verbose']}),_0x526ab4=_0x5bc326[_0x523a88(0x202)];return console[_0x523a88(0x2a7)](_0x523a88(0x218)+_0x526ab4[_0x523a88(0x233)][_0x523a88(0x28f)]+'\x22\x20paused'),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a26_0x1da60b(0x28f)]=a26_0x1da60b(0x1f7);[a26_0x1da60b(0x244)]='Resume\x20a\x20paused\x20journey';async[a26_0x1da60b(0x2b6)](_0x373b4b){const _0x1b4be3=a26_0x1da60b,{options:_0x38a4be,args:_0x3e86eb,tdx:_0x1c7821}=_0x373b4b,_0x286b75=_0x3e86eb[0x0];if(!requireNameOrPath(_0x286b75))return 0x1;_0x38a4be[_0x1b4be3(0x1ed)]&&console['error'](_0x1b4be3(0x21d)+_0x286b75);const {journeyId:_0x5eac6a,journeyName:_0x1c071f}=await resolveJourneyIdFromInput(_0x286b75,_0x38a4be,_0x1c7821);if(!_0x38a4be[_0x1b4be3(0x284)]){const _0x32a3a0=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22'+_0x1c071f+'\x22?');if(!_0x32a3a0)return console[_0x1b4be3(0x2a7)]('Cancelled'),0x0;}const _0x1b9a32=await withSpinner('Resuming\x20journey...',()=>_0x1c7821[_0x1b4be3(0x1e8)][_0x1b4be3(0x1e5)](_0x5eac6a),{'verbose':_0x38a4be[_0x1b4be3(0x1ed)]}),_0x51a948=_0x1b9a32[_0x1b4be3(0x202)];return console[_0x1b4be3(0x2a7)](_0x1b4be3(0x218)+_0x51a948[_0x1b4be3(0x233)]['name']+_0x1b4be3(0x26b)),0x0;}}export class JourneyPullCommand extends BaseCommand{['name']=a26_0x1da60b(0x24f);['description']='Export\x20journey(s)\x20as\x20YAML\x20files';async[a26_0x1da60b(0x2b6)](_0x32dc2f){const _0xf81733=a26_0x1da60b,{options:_0x1e4cc0,args:_0x478f45,tdx:_0x495e60}=_0x32dc2f,_0x1c419e=_0x1e4cc0,_0x879a51=_0x478f45[0x0],_0x3f684d=_0x879a51&&isYamlFilePath(_0x879a51),_0x134b07=await resolveTarget({'arg':_0x3f684d?_0x879a51:undefined,'contextParent':_0x1e4cc0[_0xf81733(0x2a9)],'cwd':process[_0xf81733(0x1fe)]()});if(!isSuccessfulResolution(_0x134b07))return _0x134b07['errorCode']===_0xf81733(0x25e)?(console[_0xf81733(0x2a7)](a26_0xd062a4[_0xf81733(0x1c2)](_0xf81733(0x234))),console[_0xf81733(0x2a7)](_0xf81733(0x299)),console[_0xf81733(0x2a7)](_0xf81733(0x269)),console[_0xf81733(0x2a7)](_0xf81733(0x29a)),console['error'](_0xf81733(0x2c5))):(console['error'](a26_0xd062a4['red']('Error:\x20'+_0x134b07[_0xf81733(0x275)]+'\x0a')),_0x134b07['helpText']&&console[_0xf81733(0x2a7)](a26_0xd062a4[_0xf81733(0x296)](_0x134b07[_0xf81733(0x2bd)]))),0x1;let _0x27fed6=_0x3f684d?undefined:_0x879a51,_0x8996bd,_0x47fe78;_0x134b07[_0xf81733(0x209)]===_0xf81733(0x256)&&(_0x27fed6=_0x134b07[_0xf81733(0x1d2)],_0x8996bd=_0x134b07[_0xf81733(0x21e)],_0x47fe78=_0x134b07[_0xf81733(0x21b)]);const _0x29fb18=_0x134b07[_0xf81733(0x28e)],_0x5740b3=_0x134b07[_0xf81733(0x28d)];_0x1c419e[_0xf81733(0x1ed)]&&(console[_0xf81733(0x2a7)](_0xf81733(0x2af)+_0x29fb18),console[_0xf81733(0x2a7)](_0xf81733(0x293)+_0x5740b3),_0x27fed6&&console[_0xf81733(0x2a7)](_0xf81733(0x219)+_0x27fed6),_0x8996bd&&console[_0xf81733(0x2a7)](_0xf81733(0x2b9)+_0x8996bd),_0x47fe78&&console[_0xf81733(0x2a7)](_0xf81733(0x2a8)+_0x47fe78));const _0x35635d=await withSpinner(_0xf81733(0x1ce),()=>_0x495e60['segment'][_0xf81733(0x1e4)](_0x29fb18),{'verbose':_0x1e4cc0[_0xf81733(0x1ed)]}),_0x5ba275=_0x35635d[_0xf81733(0x202)],{journeys:_0x1ee253,folders:_0x84972e}=await withSpinner('Fetching\x20journeys\x20and\x20folders...',async()=>{const _0x4bc823=_0xf81733,[_0x5d9ab9,_0x498ff5]=await Promise[_0x4bc823(0x246)]([_0x495e60[_0x4bc823(0x1e8)][_0x4bc823(0x2a1)](_0x5ba275,undefined,{'includeAllVersions':!![]}),_0x495e60['segment'][_0x4bc823(0x235)](_0x5ba275)]);return{'journeys':_0x5d9ab9,'folders':_0x498ff5};},{'verbose':_0x1e4cc0['verbose']})[_0xf81733(0x27f)](_0x102efa=>_0x102efa[_0xf81733(0x202)]);let _0x5f3eb7=_0x1ee253;const _0x3f5fc2=buildFolderIdToPathMap(_0x84972e);if(_0x27fed6){const _0x558437=_0x5f3eb7[_0xf81733(0x204)](_0x20c3c3=>_0x20c3c3[_0xf81733(0x1e2)][_0xf81733(0x283)]()===_0x27fed6['toLowerCase']());if(_0x558437['length']===0x0)return console['error']('Error:\x20Journey\x20not\x20found:\x20'+_0x27fed6),console[_0xf81733(0x2a7)](_0xf81733(0x254)),0x1;_0x5f3eb7=_0x558437;}if(_0x47fe78!==undefined){const _0x32074b=_0x5f3eb7['filter'](_0xbbfe18=>{const _0x52fcfc=_0xf81733,_0x32f5ee=_0xbbfe18[_0x52fcfc(0x278)]?_0x3f5fc2['get'](_0xbbfe18[_0x52fcfc(0x278)])||'':'';return _0x32f5ee===_0x47fe78;});if(_0x32074b[_0xf81733(0x23a)]===0x0&&_0x5f3eb7[_0xf81733(0x23a)]>0x0){console['error']('Error:\x20Journey\x20\x27'+_0x27fed6+_0xf81733(0x26d)+(_0x47fe78||_0xf81733(0x20a))),console[_0xf81733(0x2a7)](_0xf81733(0x26e));for(const _0x5f46a2 of _0x5f3eb7){const _0x2f156c=_0x5f46a2['folderId']?_0x3f5fc2[_0xf81733(0x2bf)](_0x5f46a2[_0xf81733(0x278)])||'':'';console['error'](_0xf81733(0x1fd)+(_0x2f156c||_0xf81733(0x252))+'/'+_0x5f46a2[_0xf81733(0x1e2)]);}return 0x1;}_0x5f3eb7=_0x32074b;}if(_0x5f3eb7['length']===0x0)return console[_0xf81733(0x2a7)](_0xf81733(0x1f1)),0x0;const _0x184e2d=new Map();for(const _0x41ddfd of _0x5f3eb7){const _0x3dfa6c=_0x41ddfd['journeyBundleId'];!_0x184e2d[_0xf81733(0x1c4)](_0x3dfa6c)&&_0x184e2d['set'](_0x3dfa6c,[]),_0x184e2d[_0xf81733(0x2bf)](_0x3dfa6c)[_0xf81733(0x1cf)](_0x41ddfd);}for(const _0x87e39a of _0x184e2d[_0xf81733(0x2ae)]()){_0x87e39a[_0xf81733(0x251)]((_0x79a17f,_0x5cf6dc)=>(_0x79a17f[_0xf81733(0x2ba)]||0x0)-(_0x5cf6dc[_0xf81733(0x2ba)]||0x0));}const _0x3a58fb=[],{idToEmailMap:_0x6895cb,connectionIdToNameMap:_0x12eb01}=await withSpinner(_0xf81733(0x22c),async()=>{const _0x108cc7=_0xf81733,[_0x2e8dc9,_0x1b011a]=await Promise[_0x108cc7(0x246)]([_0x495e60['user'][_0x108cc7(0x1c7)](),_0x495e60['connection'][_0x108cc7(0x1f5)]()]);return{'idToEmailMap':_0x2e8dc9,'connectionIdToNameMap':_0x1b011a};},{'verbose':_0x1e4cc0[_0xf81733(0x1ed)]})[_0xf81733(0x27f)](_0xd18a38=>_0xd18a38[_0xf81733(0x202)]);for(const _0x5acdf6 of _0x184e2d[_0xf81733(0x2ae)]()){const _0x6b8c35=_0x5acdf6[0x0][_0xf81733(0x1e2)],_0xad770c=_0x5acdf6[0x0][_0xf81733(0x278)],_0x520279=_0xad770c?_0x3f5fc2['get'](_0xad770c)||'':'',_0x21afde=_0x520279?a26_0x51d0c5['join'](_0x5740b3,_0x520279):_0x5740b3,_0x1b2441=_0x8996bd||a26_0x51d0c5['join'](_0x21afde,sanitizeFileName(_0x6b8c35)+'.yml');let _0x4b901e,_0x2d83bd;if(existsSync(_0x1b2441))try{const _0x37c001=readFileSync(_0x1b2441,_0xf81733(0x245)),_0x5658cd=parseYamlString(_0x37c001);_0x2d83bd=_0x5658cd,_0x4b901e=buildRuleToNameMapping(_0x5658cd),_0x1c419e[_0xf81733(0x1ed)]&&_0x4b901e[_0xf81733(0x259)]>0x0&&console['error'](_0xf81733(0x1e1)+_0x4b901e[_0xf81733(0x259)]+'\x20segment\x20rule(s)\x20to\x20match\x20for\x20'+_0x6b8c35);}catch(_0x5990e2){_0x1c419e[_0xf81733(0x1ed)]&&console[_0xf81733(0x2a7)](_0xf81733(0x230)+_0x5990e2['message']);}const _0x39fed9=[],_0x977b52=new Set(),_0x3dc72b=new Map(),_0x70326b=new Map(),_0x30f985=new Set(),_0xc2692b=new Map(),_0x2fcf6b=new Map(),_0x418d3e=createJumpTargetCache();await withProgressSpinner(_0xf81733(0x27e)+_0x6b8c35+_0xf81733(0x271),async _0x320a8b=>{const _0xde9e66=_0xf81733;for(const _0x8cfe32 of _0x5acdf6){const _0x1ebf89=_0x5acdf6['length']>0x1?_0x8cfe32['journeyBundleName']+'\x20v'+(_0x8cfe32[_0xde9e66(0x2ba)]||0x1):_0x8cfe32['journeyBundleName'];_0x320a8b[_0xde9e66(0x2c3)]('Fetching\x20'+_0x1ebf89);const _0xcac894=await _0x495e60[_0xde9e66(0x1e8)][_0xde9e66(0x2a2)](_0x8cfe32['id']),_0x4106b5=_0xcac894[_0xde9e66(0x233)]?.[_0xde9e66(0x22f)],_0x5797fd={'resolveSegment':async _0x22a46c=>{const _0x5cf94e=_0xde9e66;if(!_0x4106b5)return{'name':_0x22a46c,'isJourneyLocal':![]};const _0x445dd5=_0x3dc72b[_0x5cf94e(0x2bf)](_0x22a46c);if(_0x445dd5)return _0x445dd5;try{const _0x285305=await _0x495e60[_0x5cf94e(0x205)][_0x5cf94e(0x1c9)](_0x4106b5,_0x22a46c),_0x32bb22=_0x285305[_0x5cf94e(0x1dc)]===SEGMENT_KIND_JOURNEY;let _0x3d2023,_0xd1d91a=_0x285305[_0x5cf94e(0x28f)];if(_0x32bb22&&_0x285305[_0x5cf94e(0x1e7)]){const _0x4c0824=await segmentResponseToDef(_0x285305,{'resolveSegmentName':async _0x351b67=>{const _0x1b0213=_0x5cf94e,_0x269a64=_0x3dc72b[_0x1b0213(0x2bf)](_0x351b67);if(_0x269a64)return _0x269a64[_0x1b0213(0x28f)];const _0x2a87c2=await _0x5797fd[_0x1b0213(0x25d)](_0x351b67);return _0x2a87c2[_0x1b0213(0x28f)];}}),_0x1cd387=_0x4c0824['rule'];_0x3d2023={'description':_0x285305[_0x5cf94e(0x244)],'rule':_0x1cd387};const _0x7f4e3c=serializeRule(_0x1cd387),_0x363adc=_0x70326b['get'](_0x7f4e3c);if(_0x363adc)_0xd1d91a=_0x363adc,_0x3d2023=undefined,_0x1c419e[_0x5cf94e(0x1ed)]&&console[_0x5cf94e(0x2a7)]('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0x285305[_0x5cf94e(0x28f)]+_0x5cf94e(0x28c)+_0x363adc);else{let _0x505348=![];if(_0x4b901e){const _0x454fc0=_0x4b901e[_0x5cf94e(0x2bf)](_0x7f4e3c);if(_0x454fc0){const _0x428bb9=_0x454fc0['find'](_0x16dec7=>!_0x977b52[_0x5cf94e(0x1c4)](_0x16dec7));_0x428bb9&&(_0xd1d91a=_0x428bb9,_0x977b52[_0x5cf94e(0x2c0)](_0x428bb9),_0x70326b['set'](_0x7f4e3c,_0x428bb9),_0x505348=!![],_0x1c419e[_0x5cf94e(0x1ed)]&&console[_0x5cf94e(0x2a7)]('\x20\x20Preserving\x20local\x20segment\x20name:\x20'+_0x428bb9+_0x5cf94e(0x206)));}}if(!_0x505348){const _0x971a0b=generateJourneyLocalName(_0x285305['name']);_0x971a0b&&(_0xd1d91a=_0x971a0b);let _0x508461=_0xd1d91a,_0x4549a8=0x2;while(_0x977b52[_0x5cf94e(0x1c4)](_0x508461)){_0x508461=_0xd1d91a+'_'+_0x4549a8,_0x4549a8++;}_0x977b52['add'](_0x508461),_0x70326b[_0x5cf94e(0x2b2)](_0x7f4e3c,_0x508461),_0xd1d91a=_0x508461;}}}const _0xac46d={'name':_0xd1d91a,'isJourneyLocal':_0x32bb22,'definition':_0x3d2023};return _0x3dc72b[_0x5cf94e(0x2b2)](_0x22a46c,_0xac46d),_0xac46d;}catch(_0x18434b){return _0x1e4cc0[_0x5cf94e(0x1ed)]&&console[_0x5cf94e(0x2a7)](_0x5cf94e(0x2a3)+_0x22a46c+':\x20'+_0x18434b['message']),{'name':_0x22a46c,'isJourneyLocal':![]};}},'resolveActivation':async _0x5554b6=>{const _0x52f9f0=_0xde9e66,_0x596f1f=_0xc2692b[_0x52f9f0(0x2bf)](_0x5554b6);if(_0x596f1f)return _0x596f1f;try{const _0x5294e7=await _0x495e60[_0x52f9f0(0x1e8)][_0x52f9f0(0x1c8)](_0x8cfe32['id'],_0x5554b6),_0x30a2ed=journeyActivationStepToYaml(_0x5294e7,_0x6895cb,_0x12eb01),_0x2943bd=JSON[_0x52f9f0(0x1fb)]({'name':_0x30a2ed[_0x52f9f0(0x28f)],'connection':_0x30a2ed['connection'],'connector_config':_0x30a2ed[_0x52f9f0(0x26a)]}),_0x151835=_0x2fcf6b['get'](_0x2943bd);if(_0x151835){const _0x54dc75={'name':_0x151835,'isJourneyLocal':!![],'definition':_0x30a2ed};return _0xc2692b[_0x52f9f0(0x2b2)](_0x5554b6,_0x54dc75),_0x54dc75;}const _0x3428d9=_0x5294e7[_0x52f9f0(0x233)][_0x52f9f0(0x232)][_0x52f9f0(0x28f)]||_0x5554b6,_0x435c43=sanitizeYamlKey(_0x3428d9)||_0x52f9f0(0x20b)+_0x5554b6;let _0x69dd19=_0x435c43,_0x44e1d6=0x2;while(_0x30f985['has'](_0x69dd19)){_0x69dd19=_0x435c43+'_'+_0x44e1d6,_0x44e1d6++;}_0x30f985['add'](_0x69dd19),_0x2fcf6b['set'](_0x2943bd,_0x69dd19);const _0xe6f692={'name':_0x69dd19,'isJourneyLocal':!![],'definition':_0x30a2ed};return _0xc2692b[_0x52f9f0(0x2b2)](_0x5554b6,_0xe6f692),_0xe6f692;}catch(_0x26e6b6){return _0x1e4cc0[_0x52f9f0(0x1ed)]&&console[_0x52f9f0(0x2a7)](_0x52f9f0(0x27a)+_0x5554b6+':\x20'+_0x26e6b6[_0x52f9f0(0x275)]),{'name':_0x5554b6,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x5331a7,_0xfb0ae5)=>{const _0xadca4d=_0xde9e66;return resolveJumpTarget(_0x5331a7,_0xfb0ae5,_0x418d3e,_0x2a2062=>_0x495e60[_0xadca4d(0x1e8)][_0xadca4d(0x2a2)](_0x2a2062));}},_0x5a5bb8=await journeyResponseToDef(_0xcac894,_0x5797fd);_0x39fed9[_0xde9e66(0x1cf)]({'item':_0x8cfe32,'yaml':_0x5a5bb8});}},{'verbose':_0x1e4cc0[_0xf81733(0x1ed)]});const _0x17f966=await _0x495e60[_0xf81733(0x1e8)]['getLatestJourneyId'](_0x5acdf6[0x0][_0xf81733(0x1de)]),_0x253844=buildMergedJourneyDef(_0x39fed9,_0x4b901e,_0x17f966),_0x2ca230=normalizeJourneyDef(_0x253844,_0x2d83bd),_0xdb3908=toYamlString(_0x2ca230),_0x582911=_0x8996bd||a26_0x51d0c5[_0xf81733(0x2b8)](_0x21afde,sanitizeFileName(_0x6b8c35)+'.yml');!_0x8996bd&&_0x520279&&!existsSync(_0x21afde)&&mkdirSync(_0x21afde,{'recursive':!![]});const _0xa4f824=a26_0x51d0c5[_0xf81733(0x289)](process[_0xf81733(0x1fe)](),_0x582911);if(existsSync(_0x582911)){const _0x1e5819=readFileSync(_0x582911,_0xf81733(0x245)),_0x1f5ced=generateDiff(_0x1e5819,_0xdb3908),_0x16dfba=hasChanges(_0x1f5ced);_0x3a58fb['push']({'relativePath':_0xa4f824,'absolutePath':_0x582911,'content':_0xdb3908,'isNew':![],'hasChanges':_0x16dfba,'diff':_0x16dfba?formatDiffWithColors(_0x1f5ced):undefined});}else _0x3a58fb[_0xf81733(0x1cf)]({'relativePath':_0xa4f824,'absolutePath':_0x582911,'content':_0xdb3908,'isNew':!![],'hasChanges':![]});}const _0x4a6b60=_0x3a58fb[_0xf81733(0x204)](_0x4d7778=>_0x4d7778[_0xf81733(0x29e)]),_0x697fb9=_0x3a58fb[_0xf81733(0x204)](_0x440c11=>!_0x440c11[_0xf81733(0x29e)]&&_0x440c11['hasChanges']),_0x34a6c2=_0x3a58fb[_0xf81733(0x204)](_0x2d763e=>!_0x2d763e['isNew']&&!_0x2d763e[_0xf81733(0x1eb)]),_0x4c5a26=_0x5f3eb7[_0xf81733(0x23a)],_0x5787d0=_0x184e2d[_0xf81733(0x259)],_0x30a1ab=_0x4c5a26>_0x5787d0?'\x20('+_0x4c5a26+'\x20versions)':'';console[_0xf81733(0x2a7)]('\x0aPull\x20summary:'),console[_0xf81733(0x2a7)]('\x20\x20'+a26_0xd062a4[_0xf81733(0x296)](_0x5787d0+_0xf81733(0x2a4))+a26_0xd062a4[_0xf81733(0x215)](_0x30a1ab)),console[_0xf81733(0x2a7)]('\x20\x20'+a26_0xd062a4[_0xf81733(0x1d5)]('+\x20'+_0x4a6b60[_0xf81733(0x23a)]+_0xf81733(0x20c))),console[_0xf81733(0x2a7)]('\x20\x20'+a26_0xd062a4['yellow']('~\x20'+_0x697fb9['length']+_0xf81733(0x23f))),console['error']('\x20\x20'+a26_0xd062a4['dim']('=\x20'+_0x34a6c2[_0xf81733(0x23a)]+_0xf81733(0x24e))),console['error']('\x20\x20Target:\x20'+a26_0xd062a4[_0xf81733(0x296)](_0x5740b3)+'\x0a');if(_0x697fb9['length']>0x0)for(const _0x563024 of _0x697fb9){console[_0xf81733(0x2a7)](_0xf81733(0x1ca)+_0x563024[_0xf81733(0x21c)]+'\x27:'),console[_0xf81733(0x2a7)]('─'[_0xf81733(0x29d)](0x3c)),console[_0xf81733(0x2a7)](_0x563024[_0xf81733(0x211)]),console['error']('─'[_0xf81733(0x29d)](0x3c));}if(_0x1c419e[_0xf81733(0x250)])return console['error'](a26_0xd062a4['yellow']('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x4a6b60[_0xf81733(0x23a)]===0x0&&_0x697fb9[_0xf81733(0x23a)]===0x0)return console[_0xf81733(0x2a7)](a26_0xd062a4['green'](_0xf81733(0x267))),saveSessionContext({'parent_segment':_0x29fb18},_0x1c419e[_0xf81733(0x1d7)]),console[_0xf81733(0x2a7)](a26_0xd062a4['green'](_0xf81733(0x1e6)+a26_0xd062a4[_0xf81733(0x215)](_0xf81733(0x24c))+_0xf81733(0x21a)+a26_0xd062a4[_0xf81733(0x296)](_0x29fb18))),0x0;if(!_0x1c419e[_0xf81733(0x284)]&&(_0x4a6b60[_0xf81733(0x23a)]>0x0||_0x697fb9[_0xf81733(0x23a)]>0x0)){if(!isInteractive())return console['error'](a26_0xd062a4[_0xf81733(0x213)](_0xf81733(0x1c3)),_0xf81733(0x273)),console[_0xf81733(0x2a7)](a26_0xd062a4['dim']('Use\x20-y\x20or\x20--yes\x20flag\x20to\x20apply\x20changes\x20without\x20confirmation')),0x1;const _0x359ea3=await confirmKey(_0xf81733(0x212)+(_0x4a6b60['length']+_0x697fb9[_0xf81733(0x23a)])+'\x20files?');if(!_0x359ea3)return console['error'](a26_0xd062a4[_0xf81733(0x1c2)]('Aborted.'),_0xf81733(0x285)),0x1;}!existsSync(_0x5740b3)&&mkdirSync(_0x5740b3,{'recursive':!![]});const _0x4343dd=a26_0x51d0c5[_0xf81733(0x2b8)](_0x5740b3,_0xf81733(0x28a));writeFileSync(_0x4343dd,createTdxConfigContent(_0x29fb18),_0xf81733(0x245));for(const _0x2a92bd of _0x3a58fb){(_0x2a92bd[_0xf81733(0x29e)]||_0x2a92bd[_0xf81733(0x1eb)])&&writeFileSync(_0x2a92bd[_0xf81733(0x1da)],_0x2a92bd[_0xf81733(0x29f)],'utf-8');}return console[_0xf81733(0x2a7)](a26_0xd062a4[_0xf81733(0x1d5)](_0xf81733(0x1cc)+(_0x4a6b60[_0xf81733(0x23a)]+_0x697fb9['length'])+_0xf81733(0x24b)+_0x5740b3)),saveSessionContext({'parent_segment':_0x29fb18},_0x1c419e[_0xf81733(0x1d7)]),console[_0xf81733(0x2a7)](a26_0xd062a4['green']('✔\x20Context\x20set:\x20'+a26_0xd062a4[_0xf81733(0x215)](_0xf81733(0x24c))+_0xf81733(0x21a)+a26_0xd062a4[_0xf81733(0x296)](_0x29fb18))),0x0;}}export class JourneyColumnsCommand extends BaseCommand{[a26_0x1da60b(0x28f)]=a26_0x1da60b(0x1ee);[a26_0x1da60b(0x244)]='Show\x20journey\x20table\x20column\x20mapping';async[a26_0x1da60b(0x2b6)](_0x5bf541){const _0x12fb51=a26_0x1da60b,{options:_0x4dac20,args:_0x5a9a98,tdx:_0x2d1572}=_0x5bf541,_0x69e872=_0x5a9a98[0x0];if(!requireNameOrPath(_0x69e872))return 0x1;_0x4dac20['verbose']&&console['error'](_0x12fb51(0x21d)+_0x69e872);const {journeyId:_0x2ea4f1}=await resolveJourneyIdFromInput(_0x69e872,_0x4dac20,_0x2d1572),_0x48e5e9=await withSpinner(_0x12fb51(0x1d6),()=>_0x2d1572['journey'][_0x12fb51(0x282)](_0x2ea4f1),{'verbose':_0x4dac20[_0x12fb51(0x1ed)]}),_0x249db4=_0x48e5e9[_0x12fb51(0x202)];return console[_0x12fb51(0x2ab)](_0x12fb51(0x1cd)+_0x249db4[_0x12fb51(0x2c1)]),console[_0x12fb51(0x2ab)](_0x12fb51(0x272)+_0x249db4[_0x12fb51(0x274)]),await handleSDKOutput(_0x249db4[_0x12fb51(0x25c)],_0x4dac20),0x0;}}export class JourneyActivationsCommand extends BaseCommand{['name']=a26_0x1da60b(0x294);[a26_0x1da60b(0x244)]='List\x20activations\x20for\x20a\x20journey';async[a26_0x1da60b(0x2b6)](_0x245a9d){const _0x4dcd3a=a26_0x1da60b,{options:_0x4a92ed,args:_0x388abb,tdx:_0x2ae830}=_0x245a9d,_0x11748a=_0x388abb[0x0];if(!requireNameOrPath(_0x11748a))return 0x1;_0x4a92ed['verbose']&&console[_0x4dcd3a(0x2a7)](_0x4dcd3a(0x21d)+_0x11748a);const {journeyId:_0x1f89b3}=await resolveJourneyIdFromInput(_0x11748a,_0x4a92ed,_0x2ae830),_0x52f255=await withSpinner(_0x4dcd3a(0x226),()=>_0x2ae830[_0x4dcd3a(0x1e8)][_0x4dcd3a(0x1d8)](_0x1f89b3),{'verbose':_0x4a92ed[_0x4dcd3a(0x1ed)]}),_0x5f057a=_0x52f255[_0x4dcd3a(0x202)];return console['error'](_0x4dcd3a(0x1e1)+_0x5f057a[_0x4dcd3a(0x23a)]+_0x4dcd3a(0x223)+(_0x5f057a[_0x4dcd3a(0x23a)]!==0x1?'s':'')),await handleSDKOutput(_0x5f057a,_0x4a92ed),0x0;}}export class JourneyPushCommand extends BaseCommand{['name']='journey:push';[a26_0x1da60b(0x244)]='Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data';[a26_0x1da60b(0x264)]=new SegmentPushCommand();async['execute'](_0x1b2620){const _0x23d0ca=a26_0x1da60b,_0x14a548=_0x1b2620[_0x23d0ca(0x2a6)][0x0];let _0x5483c7;if(_0x14a548){const _0x103c0a=await resolveTarget({'arg':_0x14a548,'contextParent':_0x1b2620[_0x23d0ca(0x228)][_0x23d0ca(0x2a9)],'cwd':process[_0x23d0ca(0x1fe)]()});isSuccessfulResolution(_0x103c0a)&&_0x103c0a[_0x23d0ca(0x209)]===_0x23d0ca(0x256)&&(_0x5483c7=_0x103c0a[_0x23d0ca(0x21e)]);}const _0xfabb91={..._0x1b2620,'options':{..._0x1b2620[_0x23d0ca(0x228)],'journeysOnly':!![],..._0x5483c7&&{'singleFilePath':_0x5483c7}}};return this[_0x23d0ca(0x264)][_0x23d0ca(0x2b6)](_0xfabb91);}}export class JourneyVersionsCommand extends BaseCommand{[a26_0x1da60b(0x28f)]='journey:versions';['description']=a26_0x1da60b(0x1f6);async[a26_0x1da60b(0x2b6)](_0x45473a){const _0x54b691=a26_0x1da60b,{options:_0x12a868,args:_0x7af581,tdx:_0x44a07c}=_0x45473a,_0x2c00b0=_0x7af581[0x0];if(!requireNameOrPath(_0x2c00b0))return 0x1;if(_0x12a868[_0x54b691(0x1ed)])console['error'](_0x54b691(0x21d)+_0x2c00b0);const {journeyId:_0x4614b6}=await resolveJourneyIdFromInput(_0x2c00b0,_0x12a868,_0x44a07c),_0x3bc3e4=await withSpinner(_0x54b691(0x266),()=>_0x44a07c['journey']['listVersions'](_0x4614b6),{'verbose':_0x12a868['verbose']}),{bundleName:_0x4f7dbf,versions:_0x251693,latestJourneyId:_0xf963fa}=_0x3bc3e4[_0x54b691(0x202)];console[_0x54b691(0x2a7)](_0x4f7dbf+':\x20'+_0x251693[_0x54b691(0x23a)]+_0x54b691(0x21f)+(_0x251693['length']!==0x1?'s':''));const _0x4bbfdf=_0x251693['map'](_0x25b261=>({'version':_0x25b261[_0x54b691(0x2ba)],'journey_id':_0x25b261['journeyId'],'name':_0x25b261['name'],'state':_0x25b261[_0x54b691(0x23c)],'paused':_0x25b261['paused'],'latest':_0x25b261['journeyId']===_0xf963fa,'created_at':_0x25b261[_0x54b691(0x27c)]}));return await handleSDKOutput(_0x4bbfdf,_0x12a868),0x0;}}export class JourneyVersionCreateCommand extends BaseCommand{['name']=a26_0x1da60b(0x287);['description']=a26_0x1da60b(0x1fc);async[a26_0x1da60b(0x2b6)](_0x5dab6e){const _0x2c1586=a26_0x1da60b,{options:_0x264909,args:_0x5a48da,tdx:_0xd61d90}=_0x5dab6e,_0x5a8238=_0x5a48da[0x0];if(!requireNameOrPath(_0x5a8238))return 0x1;if(_0x264909[_0x2c1586(0x1ed)])console[_0x2c1586(0x2a7)](_0x2c1586(0x21d)+_0x5a8238);const {journeyId:_0x7ef9c2,journeyName:_0x5a3536}=await resolveJourneyIdFromInput(_0x5a8238,_0x264909,_0xd61d90);if(!_0x264909['yes']){const _0x388232=await confirm('Create\x20a\x20new\x20draft\x20version\x20of\x20journey\x20\x22'+_0x5a3536+'\x22?');if(!_0x388232)return console[_0x2c1586(0x2a7)](_0x2c1586(0x27d)),0x0;}const _0x272044=await withSpinner(_0x2c1586(0x247),()=>_0xd61d90[_0x2c1586(0x1e8)][_0x2c1586(0x2b4)](_0x7ef9c2),{'verbose':_0x264909['verbose']}),_0x41c6fb=_0x272044[_0x2c1586(0x202)];return console[_0x2c1586(0x2a7)](a26_0xd062a4[_0x2c1586(0x1d5)]('✔')+'\x20Created\x20v'+_0x41c6fb[_0x2c1586(0x233)][_0x2c1586(0x2ba)]+_0x2c1586(0x1e0)+_0x41c6fb[_0x2c1586(0x233)][_0x2c1586(0x28f)]+'\x22'),console[_0x2c1586(0x2a7)](_0x2c1586(0x260)+_0x41c6fb['id']),await handleSingleObjectOutput({'id':_0x41c6fb['id'],'name':_0x41c6fb[_0x2c1586(0x233)][_0x2c1586(0x28f)],'version':_0x41c6fb[_0x2c1586(0x233)][_0x2c1586(0x2ba)],'state':_0x41c6fb[_0x2c1586(0x233)][_0x2c1586(0x23c)],'bundle_id':_0x41c6fb[_0x2c1586(0x233)][_0x2c1586(0x1de)],'created_at':_0x41c6fb[_0x2c1586(0x233)]['createdAt']},_0x264909),0x0;}}export class JourneyVersionViewCommand extends BaseCommand{[a26_0x1da60b(0x28f)]=a26_0x1da60b(0x1f2);[a26_0x1da60b(0x244)]=a26_0x1da60b(0x201);async[a26_0x1da60b(0x2b6)](_0x180ad4){const _0xc6a135=a26_0x1da60b,{options:_0x1ed380,args:_0x5e1387,tdx:_0x2fafe5}=_0x180ad4,_0x2dc60c=_0x5e1387[0x0];if(!requireNameOrPath(_0x2dc60c))return 0x1;const _0x5e0ff1=_0x1ed380[_0xc6a135(0x229)];if(!_0x5e0ff1)return console[_0xc6a135(0x2a7)](_0xc6a135(0x25b)),console[_0xc6a135(0x2a7)]('Usage:\x20journey\x20version\x20view\x20<name-or-path>\x20--version\x20N'),0x1;const _0x2e92ca=parseInt(_0x5e0ff1,0xa);if(isNaN(_0x2e92ca)||_0x2e92ca<0x1)return console['error'](_0xc6a135(0x222)+_0x5e0ff1),0x1;if(_0x1ed380[_0xc6a135(0x1ed)])console['error'](_0xc6a135(0x21d)+_0x2dc60c+',\x20version:\x20'+_0x2e92ca);const {journeyId:_0x15ba72,parentSegmentId:_0x5db754}=await resolveJourneyIdFromInput(_0x2dc60c,_0x1ed380,_0x2fafe5),_0x215d01=await withSpinner(_0xc6a135(0x292),()=>_0x2fafe5['journey'][_0xc6a135(0x1e9)](_0x15ba72),{'verbose':_0x1ed380['verbose']}),{versions:_0x5619e2,latestJourneyId:_0x33d817}=_0x215d01['data'],_0x4734f8=_0x5619e2['find'](_0x3a3acd=>_0x3a3acd[_0xc6a135(0x2ba)]===_0x2e92ca);if(!_0x4734f8){const _0x422c3c=_0x5619e2[_0xc6a135(0x263)](_0x40bfec=>'v'+_0x40bfec[_0xc6a135(0x2ba)])[_0xc6a135(0x2b8)](',\x20');return console[_0xc6a135(0x2a7)]('Error:\x20Version\x20'+_0x2e92ca+_0xc6a135(0x270)+_0x422c3c),0x1;}const _0x23e94c=await withSpinner(_0xc6a135(0x1df)+_0x2e92ca+_0xc6a135(0x27b),()=>_0x2fafe5[_0xc6a135(0x1e8)][_0xc6a135(0x2a2)](_0x4734f8[_0xc6a135(0x224)]),{'verbose':_0x1ed380['verbose']}),_0x2ccf=_0x23e94c[_0xc6a135(0x202)],_0x5cf9bd=getConsoleNextUrl(_0x1ed380[_0xc6a135(0x240)],'/app/ps/'+_0x5db754+'/e/'+_0x4734f8[_0xc6a135(0x224)]+_0xc6a135(0x261));return await handleSingleObjectOutput({'id':_0x2ccf['id'],'name':_0x2ccf['attributes'][_0xc6a135(0x28f)],'version':_0x2ccf[_0xc6a135(0x233)][_0xc6a135(0x2ba)],'description':_0x2ccf[_0xc6a135(0x233)][_0xc6a135(0x244)],'state':_0x2ccf['attributes']['state'],'paused':_0x2ccf[_0xc6a135(0x233)]['paused'],'reentry_mode':_0x2ccf[_0xc6a135(0x233)]['reentryMode'],'stages':_0x2ccf[_0xc6a135(0x233)][_0xc6a135(0x249)]?.[_0xc6a135(0x23a)]||0x0,..._0x2ccf[_0xc6a135(0x233)]['goal']&&{'goal':_0x2ccf[_0xc6a135(0x233)][_0xc6a135(0x248)]['name']},'latest':_0x4734f8[_0xc6a135(0x224)]===_0x33d817,'created_at':_0x2ccf['attributes']['createdAt'],'updated_at':_0x2ccf[_0xc6a135(0x233)][_0xc6a135(0x291)],'url':_0x5cf9bd},_0x1ed380),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a27_0x5f09fe=a27_0x49a7;(function(_0x5acc1a,_0x5b1320){const _0x48161b=a27_0x49a7,_0x201a8d=_0x5acc1a();while(!![]){try{const _0x12318a=-parseInt(_0x48161b(0x1fa))/0x1+parseInt(_0x48161b(0x215))/0x2+-parseInt(_0x48161b(0x220))/0x3*(-parseInt(_0x48161b(0x1f6))/0x4)+-parseInt(_0x48161b(0x1f5))/0x5*(-parseInt(_0x48161b(0x203))/0x6)+-parseInt(_0x48161b(0x204))/0x7*(parseInt(_0x48161b(0x1f3))/0x8)+parseInt(_0x48161b(0x210))/0x9+parseInt(_0x48161b(0x211))/0xa;if(_0x12318a===_0x5b1320)break;else _0x201a8d['push'](_0x201a8d['shift']());}catch(_0x324f70){_0x201a8d['push'](_0x201a8d['shift']());}}}(a27_0x88cc,0x8ca4a));function a27_0x88cc(){const _0x155bba=['targetDir','\x20segment\x20file(s)\x20skipped','warningCount','No\x20journey\x20YAML\x20files\x20found\x20in\x20','description','log','error','Error:\x20Directory\x20not\x20found:\x20','\x20journey(s)\x20with\x20errors,\x20','cyan','Error:\x20','1513881cfDnMH','12340860cmxDEM','no_parent','\x20journey(s)\x20valid','errorCode','644754gLNHvm','endsWith','errors','verbose','message','red','execute','helpText','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','.yml','yellow','21bNrZJt','journey','valid','Validate\x20journey\x20YAML\x20files','warnings','validCount','reason','.yaml','dim','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','green','284936sjhxNT','length','15ssHByi','104476SCrrwk','\x20segment\x20file(s)\x20skipped)','\x20error(s)','\x20warning(s)','648945ObWkBF','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20.\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20current\x20directory','relativePath','skippedCount','file','\x20warning(s)\x20found','\x20(skipped:\x20','invalidCount','\x20valid','843282uwLeHi','217byMpbz'];a27_0x88cc=function(){return _0x155bba;};return a27_0x88cc();}import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';function a27_0x49a7(_0x3d1a64,_0xb96c49){_0x3d1a64=_0x3d1a64-0x1e9;const _0x88cc6d=a27_0x88cc();let _0x49a707=_0x88cc6d[_0x3d1a64];return _0x49a707;}import{existsSync}from'fs';import a27_0x48680f from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class JourneyValidateCommand extends BaseCommand{['name']='journey:validate';[a27_0x5f09fe(0x209)]=a27_0x5f09fe(0x1ea);async[a27_0x5f09fe(0x21b)](_0x49fb51){const _0x4e6864=a27_0x5f09fe,{options:_0x4a59f6,args:_0x4fdee6}=_0x49fb51,_0x1fa650=_0x4a59f6,_0xe80205=await resolveTarget({'arg':_0x4fdee6[0x0],'contextParent':_0x4a59f6['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0xe80205))return _0xe80205[_0x4e6864(0x214)]===_0x4e6864(0x212)?(console[_0x4e6864(0x20b)](a27_0x48680f[_0x4e6864(0x21f)](_0x4e6864(0x1f1))),console['error'](_0x4e6864(0x21d)),console[_0x4e6864(0x20b)](_0x4e6864(0x1fb)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file')):(console[_0x4e6864(0x20b)](a27_0x48680f[_0x4e6864(0x21a)](_0x4e6864(0x20f)+_0xe80205[_0x4e6864(0x219)]+'\x0a')),_0xe80205[_0x4e6864(0x21c)]&&console[_0x4e6864(0x20b)](a27_0x48680f[_0x4e6864(0x20e)](_0xe80205[_0x4e6864(0x21c)]))),0x1;const _0x226d02=_0xe80205[_0x4e6864(0x205)],_0x536bf1=_0xe80205['type']===_0x4e6864(0x1fe)?_0xe80205['filePath']:undefined;if(!_0x536bf1&&!existsSync(_0x226d02))return console['error'](a27_0x48680f[_0x4e6864(0x21a)](_0x4e6864(0x20c)+_0x226d02+'\x0a')),0x1;let _0x3ec696;if(_0x536bf1){if(!_0x536bf1[_0x4e6864(0x216)](_0x4e6864(0x21e))&&!_0x536bf1[_0x4e6864(0x216)](_0x4e6864(0x1ee)))return console[_0x4e6864(0x20b)](a27_0x48680f[_0x4e6864(0x21a)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x536bf1+'\x0a')),0x1;_0x3ec696=[_0x536bf1];}else _0x3ec696=findYamlFiles(_0x226d02);if(_0x3ec696[_0x4e6864(0x1f4)]===0x0)return console[_0x4e6864(0x20b)](a27_0x48680f[_0x4e6864(0x21a)](_0x4e6864(0x1f0)+_0x226d02+'\x0a')),0x1;const _0x5441d4=validateYamlFiles(_0x3ec696,_0x226d02,{'filterType':_0x4e6864(0x221)}),_0x5dcc79=calculateSummary(_0x5441d4),_0x4e2800=_0x5441d4['filter'](isValidationResult);if(_0x4e2800[_0x4e6864(0x1f4)]===0x0)return console[_0x4e6864(0x20b)](a27_0x48680f['yellow'](_0x4e6864(0x208)+_0x226d02+'\x0a')),_0x5dcc79[_0x4e6864(0x1fd)]>0x0&&console[_0x4e6864(0x20b)](a27_0x48680f[_0x4e6864(0x1ef)]('('+_0x5dcc79[_0x4e6864(0x1fd)]+_0x4e6864(0x1f7))),0x0;for(const _0x5e434c of _0x5441d4){if(!isValidationResult(_0x5e434c)){_0x1fa650[_0x4e6864(0x218)]&&console[_0x4e6864(0x20a)](a27_0x48680f[_0x4e6864(0x1ef)]('-\x20'+_0x5e434c[_0x4e6864(0x1fc)]+_0x4e6864(0x200)+_0x5e434c[_0x4e6864(0x1ed)]+')'));continue;}const {relativePath:_0x844eb0,source:_0x4db5bd,result:_0x56630c}=_0x5e434c;if(_0x56630c[_0x4e6864(0x1e9)]&&_0x56630c[_0x4e6864(0x1eb)][_0x4e6864(0x1f4)]===0x0)_0x1fa650[_0x4e6864(0x218)]&&console[_0x4e6864(0x20a)](a27_0x48680f[_0x4e6864(0x1f2)]('✔\x20'+_0x844eb0));else _0x56630c[_0x4e6864(0x1e9)]?(console[_0x4e6864(0x20a)](a27_0x48680f['yellow']('⚠\x20'+_0x844eb0+':\x20'+_0x56630c[_0x4e6864(0x1eb)][_0x4e6864(0x1f4)]+_0x4e6864(0x1f9))),console[_0x4e6864(0x20a)](formatValidationResult(_0x56630c,_0x4db5bd,_0x844eb0))):(console['log'](a27_0x48680f['red']('✖\x20'+_0x844eb0+':\x20'+_0x56630c[_0x4e6864(0x217)][_0x4e6864(0x1f4)]+_0x4e6864(0x1f8))),console[_0x4e6864(0x20a)](formatValidationResult(_0x56630c,_0x4db5bd,_0x844eb0)));}return console['log'](''),_0x5dcc79['hasErrors']?(console[_0x4e6864(0x20a)](a27_0x48680f[_0x4e6864(0x21a)]('Validation\x20failed:\x20'+_0x5dcc79[_0x4e6864(0x201)]+_0x4e6864(0x20d)+_0x5dcc79[_0x4e6864(0x1ec)]+_0x4e6864(0x202))),_0x5dcc79[_0x4e6864(0x207)]>0x0&&console[_0x4e6864(0x20a)](a27_0x48680f[_0x4e6864(0x21f)](_0x5dcc79[_0x4e6864(0x207)]+'\x20warning(s)\x20found')),_0x5dcc79['skippedCount']>0x0&&console[_0x4e6864(0x20a)](a27_0x48680f[_0x4e6864(0x1ef)](_0x5dcc79[_0x4e6864(0x1fd)]+_0x4e6864(0x206))),0x1):(console['log'](a27_0x48680f[_0x4e6864(0x1f2)]('✔\x20All\x20'+_0x5dcc79[_0x4e6864(0x1ec)]+_0x4e6864(0x213))),_0x5dcc79['warningCount']>0x0&&console[_0x4e6864(0x20a)](a27_0x48680f[_0x4e6864(0x21f)](_0x5dcc79['warningCount']+_0x4e6864(0x1ff))),_0x5dcc79[_0x4e6864(0x1fd)]>0x0&&console[_0x4e6864(0x20a)](a27_0x48680f['dim'](_0x5dcc79['skippedCount']+_0x4e6864(0x206))),0x0);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a28_0x18daf8=a28_0x561d;(function(_0x444b7b,_0x1abdb1){const _0x27ca0c=a28_0x561d,_0x30242d=_0x444b7b();while(!![]){try{const _0xed3224=-parseInt(_0x27ca0c(0x21e))/0x1+-parseInt(_0x27ca0c(0x211))/0x2+-parseInt(_0x27ca0c(0x22e))/0x3+parseInt(_0x27ca0c(0x1e3))/0x4+parseInt(_0x27ca0c(0x1a6))/0x5*(-parseInt(_0x27ca0c(0x16a))/0x6)+parseInt(_0x27ca0c(0x1d5))/0x7*(-parseInt(_0x27ca0c(0x1bf))/0x8)+parseInt(_0x27ca0c(0x17d))/0x9*(parseInt(_0x27ca0c(0x22b))/0xa);if(_0xed3224===_0x1abdb1)break;else _0x30242d['push'](_0x30242d['shift']());}catch(_0x54a18a){_0x30242d['push'](_0x30242d['shift']());}}}(a28_0x27e5,0xee815));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{confirm}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import*as a28_0x418b9f from'node:fs';function handleSDKError(_0x4ceea0,_0x5d034c){const _0x2dde6d=a28_0x561d;if(_0x4ceea0 instanceof SDKError)console[_0x2dde6d(0x1a3)](_0x2dde6d(0x1c9)+_0x4ceea0[_0x2dde6d(0x18e)]),_0x5d034c[_0x2dde6d(0x1ca)]&&(_0x4ceea0[_0x2dde6d(0x17f)]&&console['error'](_0x2dde6d(0x196)+_0x4ceea0[_0x2dde6d(0x17f)]),_0x4ceea0[_0x2dde6d(0x1eb)]&&(console[_0x2dde6d(0x1a3)](_0x2dde6d(0x1a5)),console[_0x2dde6d(0x1a3)](_0x4ceea0[_0x2dde6d(0x1eb)])));else throw _0x4ceea0;}function formatChatHistoryEntry(_0x42111b,_0x2aa1f7){const _0x1c6d68=a28_0x561d,_0x41f195=getChalk(_0x2aa1f7),_0x208907=_0x41f195[_0x1c6d68(0x203)](_0x42111b['at']);if(_0x1c6d68(0x1f2)in _0x42111b){const _0xa0da08=_0x41f195[_0x1c6d68(0x1f0)](_0x1c6d68(0x1f1));return _0x208907+'\x20'+_0xa0da08+':\x20'+_0x42111b['input'];}if(_0x1c6d68(0x199)in _0x42111b){const _0x557231=_0x41f195['green'](_0x1c6d68(0x1f8));return _0x208907+'\x20'+_0x557231+':\x20'+_0x42111b[_0x1c6d68(0x199)];}if(_0x1c6d68(0x15d)in _0x42111b){const _0x243964=_0x41f195[_0x1c6d68(0x1ad)](_0x1c6d68(0x219)),{functionName:_0x2e1781,functionArguments:_0x27b2cf,targetFunction:_0x34d92f}=_0x42111b[_0x1c6d68(0x15d)];let _0xdbd616=_0x208907+'\x20'+_0x243964+':\x20'+_0x41f195['bold'](_0x2e1781);if(_0x27b2cf&&Object[_0x1c6d68(0x222)](_0x27b2cf)[_0x1c6d68(0x1ea)]>0x0){const _0x3fc786=Object['entries'](_0x27b2cf)[_0x1c6d68(0x1ac)](([_0x15dcea,_0x3531e4])=>_0x15dcea+'='+JSON[_0x1c6d68(0x213)](_0x3531e4))[_0x1c6d68(0x1e5)](',\x20');_0xdbd616+='('+_0x3fc786+')';}_0x34d92f&&(_0xdbd616+=_0x41f195[_0x1c6d68(0x203)]('\x20['+_0x34d92f+']'));let _0x76d457='';if(_0x42111b[_0x1c6d68(0x15d)][_0x1c6d68(0x193)])_0x76d457=_0x1c6d68(0x1e6)+_0x42111b[_0x1c6d68(0x15d)]['targetKnowledgeBase']['name'];else{if(_0x42111b['tool_call']['targetAgent'])_0x76d457=_0x1c6d68(0x234)+_0x42111b[_0x1c6d68(0x15d)][_0x1c6d68(0x16b)][_0x1c6d68(0x198)];else{if(_0x42111b['tool_call']['targetWebSearchTool'])_0x76d457='\x20->\x20WebSearch:'+_0x42111b['tool_call']['targetWebSearchTool'][_0x1c6d68(0x198)];else _0x42111b['tool_call'][_0x1c6d68(0x1e9)]&&(_0x76d457=_0x1c6d68(0x1ae)+_0x42111b[_0x1c6d68(0x15d)][_0x1c6d68(0x1e9)]['name']);}}return _0xdbd616+_0x76d457;}if(_0x1c6d68(0x1ed)in _0x42111b){const _0x511beb=_0x41f195[_0x1c6d68(0x1e1)]('[tool]\x20\x20\x20'),{functionName:_0x1568ba,functionArguments:_0x222f19,content:_0x250447,newChat:_0x3f940f}=_0x42111b[_0x1c6d68(0x1ed)];let _0x2a42af=_0x208907+'\x20'+_0x511beb+':\x20'+_0x41f195[_0x1c6d68(0x202)](_0x1568ba);if(_0x222f19){const _0x2ba16d=typeof _0x222f19===_0x1c6d68(0x1d9)?_0x222f19:JSON['stringify'](_0x222f19);_0x2a42af+='('+_0x2ba16d+')';}return _0x250447&&(_0x2a42af+='\x0a'+_0x41f195[_0x1c6d68(0x203)](_0x250447)),_0x3f940f&&(_0x2a42af+=_0x41f195[_0x1c6d68(0x203)]('\x20→\x20chat:\x20'+_0x3f940f['id'])),_0x2a42af;}if(_0x1c6d68(0x19c)in _0x42111b){const _0x1cf96e=_0x41f195[_0x1c6d68(0x1b1)]('[output]\x20');return _0x208907+'\x20'+_0x1cf96e+':\x20'+_0x42111b[_0x1c6d68(0x19c)][_0x1c6d68(0x198)]+'\x20('+_0x42111b[_0x1c6d68(0x19c)][_0x1c6d68(0x199)][_0x1c6d68(0x1ea)]+'\x20bytes)';}if(_0x1c6d68(0x194)in _0x42111b){const _0x582415=_0x41f195[_0x1c6d68(0x1b1)](_0x1c6d68(0x217)),{width:_0x23a75b,height:_0x57509c,headerText:_0x9bd5a3}=_0x42111b['image'],_0x1552bb=_0x9bd5a3?'\x20-\x20'+_0x9bd5a3:'';return _0x208907+'\x20'+_0x582415+':\x20'+_0x23a75b+'x'+_0x57509c+_0x1552bb;}if(_0x1c6d68(0x1a3)in _0x42111b){const _0x7f2f13=_0x41f195[_0x1c6d68(0x16f)](_0x1c6d68(0x206));return _0x208907+'\x20'+_0x7f2f13+':\x20'+_0x42111b['error'];}return _0x208907+'\x20'+_0x41f195[_0x1c6d68(0x203)](_0x1c6d68(0x214))+':\x20'+JSON[_0x1c6d68(0x213)](_0x42111b);}async function executeChatHistoryCommand(_0x14cc06,_0x5bc1be){const _0x5a4b1e=a28_0x561d,{options:_0x5b8199,args:_0xda7dbc,tdx:_0x1900d9}=_0x14cc06,_0x1e0f64=_0xda7dbc[0x0],_0x5b7d25=_0x5b8199,_0x4251fa=_0x5b7d25[_0x5a4b1e(0x1f7)];try{if(_0x4251fa&&_0x1e0f64)return console[_0x5a4b1e(0x1a3)]('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console[_0x5a4b1e(0x1a3)]('Usage:\x20'+_0x5bc1be+_0x5a4b1e(0x191)),0x1;if(!_0x1e0f64&&!_0x4251fa&&_0x5b8199[_0x5a4b1e(0x19a)]!==undefined){const _0x2f82bd=resolveLimit(_0x5b8199['limit'],DEFAULT_LLM_LIMIT),_0x3302a1=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0x1900d9[_0x5a4b1e(0x1d3)][_0x5a4b1e(0x20f)](_0x2f82bd),{'verbose':_0x5b8199[_0x5a4b1e(0x1ca)]});return await handleSDKOutput(_0x3302a1[_0x5a4b1e(0x1ee)],_0x5b8199),0x0;}const _0x1ab4c4=await getChatIdOrSelect(_0x1900d9,_0x5b8199,_0x4251fa,_0x1e0f64);if(!_0x1ab4c4)return 0x0;return await displayChatHistory(_0x1ab4c4,_0x1900d9,_0x5b8199),0x0;}catch(_0x4529a6){return handleSDKError(_0x4529a6,_0x5b8199),0x1;}}async function displayChatHistory(_0x1b9925,_0x2e4e1a,_0xfec17b){const _0x5d40eb=a28_0x561d,_0x212f23=await withSpinner('Fetching\x20chat\x20history\x20for\x20\x27'+_0x1b9925+_0x5d40eb(0x18d),()=>_0x2e4e1a['llm']['history'](_0x1b9925),{'verbose':_0xfec17b[_0x5d40eb(0x1ca)]}),_0x5a0db7=_0x212f23[_0x5d40eb(0x1ee)]['data']??[];if(_0x5a0db7[_0x5d40eb(0x1ea)]===0x0){console[_0x5d40eb(0x162)](_0x5d40eb(0x17c));return;}if(_0xfec17b['format']!==undefined)await handleSDKOutput(_0x5a0db7,_0xfec17b);else{const _0x4c1f06=_0x5a0db7['map'](_0x451b7b=>formatChatHistoryEntry(_0x451b7b,_0xfec17b)),_0x103e6c=_0x4c1f06['join']('\x0a');await writeOutput(_0x103e6c,_0xfec17b['output'],_0x5d40eb(0x1bd));}}async function getChatIdOrSelect(_0x11607,_0x38ec82,_0x1614b5,_0xb8b88e){const _0x84cd49=a28_0x561d;if(_0xb8b88e)return _0xb8b88e;if(_0x1614b5){const _0x56655a=await withSpinner(_0x84cd49(0x1df),()=>_0x11607[_0x84cd49(0x1d3)][_0x84cd49(0x20f)](0x1),{'verbose':_0x38ec82['verbose']});if(_0x56655a[_0x84cd49(0x1ee)]['length']===0x0)return console['log']('No\x20chat\x20sessions\x20found.'),undefined;return _0x56655a['data'][0x0]['id'];}const _0x4d11cf=await selectChatInteractively(_0x11607,_0x38ec82);if(!_0x4d11cf)return console['log'](_0x84cd49(0x210)),undefined;return _0x4d11cf;}async function getProjectIdOrDefault(_0x383b54){const _0x5983a0=await getProjectWithName(_0x383b54);return _0x5983a0['id'];}async function getProjectWithName(_0x5a12d7){const _0x54b28b=a28_0x561d,{tdx:_0xcc9424,options:_0x1947cf}=_0x5a12d7,_0x38d07e=_0x1947cf[_0x54b28b(0x163)];if(_0x38d07e){const _0x4049f7=await withSpinner(_0x54b28b(0x1b7)+_0x38d07e+_0x54b28b(0x18d),()=>_0xcc9424[_0x54b28b(0x1d3)]['resolveProjectId'](_0x38d07e),{'verbose':_0x1947cf[_0x54b28b(0x1ca)]});return{'id':_0x4049f7['data'],'name':_0x38d07e};}const _0x864bb9=_0xcc9424[_0x54b28b(0x1d3)][_0x54b28b(0x1f6)]();if(_0x864bb9){const _0x13b5cb=await _0xcc9424[_0x54b28b(0x1d3)]['projects'](),_0x1e004f=_0x13b5cb['find'](_0x4c8af7=>_0x4c8af7['id']===_0x864bb9);return{'id':_0x864bb9,'name':_0x1e004f?.[_0x54b28b(0x1a8)][_0x54b28b(0x198)]||'Unknown'};}const _0x2e37b8=await withSpinner(_0x54b28b(0x1c8),()=>_0xcc9424[_0x54b28b(0x1d3)][_0x54b28b(0x201)](),{'verbose':_0x1947cf[_0x54b28b(0x1ca)]});return{'id':_0x2e37b8[_0x54b28b(0x1ee)]['id'],'name':_0x2e37b8[_0x54b28b(0x1ee)][_0x54b28b(0x1a8)][_0x54b28b(0x198)]};}function toLLMProjectInfo(_0xde165c){const _0x51d6e5=a28_0x561d;return{'name':_0xde165c[_0x51d6e5(0x1a8)][_0x51d6e5(0x198)],'description':_0xde165c[_0x51d6e5(0x1a8)][_0x51d6e5(0x1dc)],'createdAt':_0xde165c[_0x51d6e5(0x1a8)]['createdAt'],'updatedAt':_0xde165c[_0x51d6e5(0x1a8)][_0x51d6e5(0x184)]};}function toAgentInfo(_0x317f35){const _0x42e622=a28_0x561d;return{'name':_0x317f35[_0x42e622(0x1a8)]['name'],'description':_0x317f35[_0x42e622(0x1a8)][_0x42e622(0x1dc)],'prompt':truncatePrompt(_0x317f35[_0x42e622(0x1a8)][_0x42e622(0x179)]),'createdAt':_0x317f35[_0x42e622(0x1a8)][_0x42e622(0x1c0)],'updatedAt':_0x317f35[_0x42e622(0x1a8)][_0x42e622(0x184)]};}function truncatePrompt(_0x2b822b){if(!_0x2b822b)return undefined;const _0x9fee40=0x64;if(_0x2b822b['length']<=_0x9fee40)return _0x2b822b;return _0x2b822b['slice'](0x0,_0x9fee40)+'...';}export class LLMModelsCommand extends BaseCommand{[a28_0x18daf8(0x198)]=a28_0x18daf8(0x189);[a28_0x18daf8(0x1dc)]=a28_0x18daf8(0x20b);async[a28_0x18daf8(0x1e8)](_0xa88215){const _0x544927=a28_0x18daf8,{options:_0x243986,tdx:_0x289542}=_0xa88215;try{const _0x5a2f20=await withSpinner(_0x544927(0x21b),()=>_0x289542[_0x544927(0x1d3)][_0x544927(0x1b0)](),{'verbose':_0x243986['verbose']});return await handleSDKOutput(_0x5a2f20['data'],_0x243986),0x0;}catch(_0x17d209){return handleSDKError(_0x17d209,_0x243986),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a28_0x18daf8(0x198)]=a28_0x18daf8(0x1d0);[a28_0x18daf8(0x1dc)]=a28_0x18daf8(0x18f);async[a28_0x18daf8(0x1e8)](_0x4c229f){const _0x55118e=a28_0x18daf8,{options:_0x44bdc3,args:_0x42bcf8,tdx:_0x45f809}=_0x4c229f,_0xb7a2f9=getChalk(_0x44bdc3),_0x11a723=_0x44bdc3['site'];try{const _0x5c2e57=_0x42bcf8[0x0],_0xed4255=resolveLimit(_0x44bdc3[_0x55118e(0x18b)],DEFAULT_LLM_LIMIT),_0x4c39fc=await withSpinner(_0x55118e(0x1e2),()=>_0x45f809[_0x55118e(0x1d3)]['projects'](_0xed4255),{'verbose':_0x44bdc3[_0x55118e(0x1ca)]});let _0x381553=_0x4c39fc[_0x55118e(0x1ee)];_0x5c2e57&&(_0x381553=_0x4c39fc[_0x55118e(0x1ee)][_0x55118e(0x1a9)](_0x4c65ee=>matchGlobPattern(_0x4c65ee[_0x55118e(0x1a8)]['name'],_0x5c2e57)));const _0x59d826=_0x44bdc3[_0x55118e(0x19a)]===_0x55118e(0x1fe)||_0x44bdc3[_0x55118e(0x19a)]===_0x55118e(0x233)||_0x44bdc3[_0x55118e(0x19a)]===_0x55118e(0x1bd)||_0x44bdc3[_0x55118e(0x19a)]===_0x55118e(0x228);if(_0x59d826){const _0x5eb8e8=_0x381553[_0x55118e(0x1ac)](_0x51d097=>({...toLLMProjectInfo(_0x51d097),'url':getLLMProjectUrl(_0x11a723,_0x51d097['id'])}));await handleSDKOutput(_0x5eb8e8,_0x44bdc3);}else{const _0x1ae599=[];if(_0x381553[_0x55118e(0x1ea)]===0x0)_0x1ae599[_0x55118e(0x1c2)](_0xb7a2f9[_0x55118e(0x203)](_0x55118e(0x1de)));else{const _0xdc300a=[..._0x381553]['sort']((_0x4aced4,_0x132115)=>_0x4aced4[_0x55118e(0x1a8)][_0x55118e(0x198)][_0x55118e(0x175)](_0x132115[_0x55118e(0x1a8)][_0x55118e(0x198)]));for(const _0x2cf366 of _0xdc300a){const _0x4a627e=getLLMProjectUrl(_0x11a723,_0x2cf366['id']),_0x657c22=hyperlink(_0x2cf366[_0x55118e(0x1a8)]['name'],_0x4a627e);_0x1ae599[_0x55118e(0x1c2)](_0x55118e(0x1f3)+_0x657c22);}_0x1ae599[_0x55118e(0x1c2)](_0xb7a2f9[_0x55118e(0x203)](_0x381553[_0x55118e(0x1ea)]+_0x55118e(0x1d4)));}await writeOutput(_0x1ae599[_0x55118e(0x1e5)]('\x0a'),_0x44bdc3[_0x55118e(0x19c)],_0x55118e(0x1bd));}return 0x0;}catch(_0x4e0378){return handleSDKError(_0x4e0378,_0x44bdc3),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a28_0x18daf8(0x198)]=a28_0x18daf8(0x1b8);[a28_0x18daf8(0x1dc)]='List\x20agents\x20in\x20current\x20project';async[a28_0x18daf8(0x1e8)](_0x41db01){const _0x57dbbd=a28_0x18daf8,{options:_0x50d560,args:_0x54e1e9,tdx:_0x19d5f6}=_0x41db01,_0x4a21df=getChalk(_0x50d560),_0x44d2bf=_0x50d560[_0x57dbbd(0x20a)];try{const _0x2dfb19=_0x54e1e9[0x0];let _0x156124=_0x2dfb19,_0x45b73a,_0x2788e9;if(_0x2dfb19&&_0x2dfb19[_0x57dbbd(0x1a2)]('/')){const _0x1a18fd=_0x2dfb19[_0x57dbbd(0x1c1)]('/');if(_0x1a18fd[_0x57dbbd(0x1ea)]===0x2){const [_0x20eef5,_0x2771c8]=_0x1a18fd,_0x5aae97=await _0x19d5f6['llm'][_0x57dbbd(0x204)](),_0x12613a=_0x5aae97[_0x57dbbd(0x208)](_0x4bbcf8=>_0x4bbcf8[_0x57dbbd(0x1a8)]['name']['toLowerCase']()===_0x20eef5[_0x57dbbd(0x1e4)]());if(!_0x12613a)throw new SDKError(ErrorCode[_0x57dbbd(0x232)],_0x57dbbd(0x19d)+_0x20eef5,undefined,{'helpText':_0x57dbbd(0x226)});_0x45b73a=_0x12613a['id'],_0x2788e9=_0x12613a[_0x57dbbd(0x1a8)][_0x57dbbd(0x198)],_0x156124=_0x2771c8;}else throw new SDKError(ErrorCode[_0x57dbbd(0x227)],'Invalid\x20path\x20syntax:\x20'+_0x2dfb19,undefined,{'helpText':_0x57dbbd(0x1a1)});}else{const _0x16452a=await getProjectWithName(_0x41db01);_0x45b73a=_0x16452a['id'],_0x2788e9=_0x16452a[_0x57dbbd(0x198)];}const _0x3b25a0=await withSpinner(_0x57dbbd(0x161),()=>_0x19d5f6['llm'][_0x57dbbd(0x220)](_0x45b73a),{'verbose':_0x50d560[_0x57dbbd(0x1ca)]});let _0x27051b=_0x3b25a0['data'];_0x156124&&(_0x27051b=_0x3b25a0[_0x57dbbd(0x1ee)]['filter'](_0x159e85=>matchGlobPattern(_0x159e85['attributes'][_0x57dbbd(0x198)],_0x156124)));const _0x4fe7e3=_0x50d560[_0x57dbbd(0x19a)]===_0x57dbbd(0x1fe)||_0x50d560[_0x57dbbd(0x19a)]===_0x57dbbd(0x233)||_0x50d560[_0x57dbbd(0x19a)]==='table'||_0x50d560['format']==='tsv';if(_0x4fe7e3){const _0x2a0412=_0x27051b[_0x57dbbd(0x1ac)](_0x2001b3=>({...toAgentInfo(_0x2001b3),'chatUrl':getLLMAgentChatUrl(_0x44d2bf,_0x45b73a,_0x2001b3['id'])}));await handleSDKOutput(_0x2a0412,_0x50d560);}else{const _0x11702d=[];_0x11702d[_0x57dbbd(0x1c2)](_0x4a21df[_0x57dbbd(0x203)]('['+_0x2788e9+']'));if(_0x27051b[_0x57dbbd(0x1ea)]===0x0)_0x11702d[_0x57dbbd(0x1c2)](_0x4a21df[_0x57dbbd(0x203)]('No\x20agents\x20found'));else{const _0x12e216=[..._0x27051b][_0x57dbbd(0x216)]((_0x4378f1,_0x4ced6a)=>_0x4378f1[_0x57dbbd(0x1a8)][_0x57dbbd(0x198)][_0x57dbbd(0x175)](_0x4ced6a[_0x57dbbd(0x1a8)]['name']));for(const _0x246886 of _0x12e216){const _0x2d4d58=getLLMAgentChatUrl(_0x44d2bf,_0x45b73a,_0x246886['id']),_0x305225=hyperlink(_0x246886[_0x57dbbd(0x1a8)]['name'],_0x2d4d58);_0x11702d['push'](_0x57dbbd(0x218)+_0x305225);}_0x11702d['push'](_0x4a21df[_0x57dbbd(0x203)](_0x27051b[_0x57dbbd(0x1ea)]+_0x57dbbd(0x1d2)));}await writeOutput(_0x11702d[_0x57dbbd(0x1e5)]('\x0a'),_0x50d560['output'],_0x57dbbd(0x1bd));}return 0x0;}catch(_0x221c60){return handleSDKError(_0x221c60,_0x50d560),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a28_0x18daf8(0x198)]=a28_0x18daf8(0x1ec);[a28_0x18daf8(0x1dc)]=a28_0x18daf8(0x209);async[a28_0x18daf8(0x1e8)](_0x2393b3){const _0x3ccbf8=a28_0x18daf8,{options:_0x355ce5,args:_0x26a56f,tdx:_0x173e71}=_0x2393b3;if(_0x26a56f[_0x3ccbf8(0x1ea)]===0x0)return console['error'](_0x3ccbf8(0x1d8)),console[_0x3ccbf8(0x1a3)](_0x3ccbf8(0x21d)),0x1;const _0x227a82=_0x26a56f[0x0];try{const _0x48b03b=await getProjectIdOrDefault(_0x2393b3),_0x3fcdfa=await withSpinner(_0x3ccbf8(0x188)+_0x227a82+_0x3ccbf8(0x18d),()=>_0x173e71[_0x3ccbf8(0x1d3)][_0x3ccbf8(0x168)](_0x227a82,_0x48b03b),{'verbose':_0x355ce5[_0x3ccbf8(0x1ca)]}),_0x45953c=await withSpinner('Fetching\x20agent...',()=>_0x173e71[_0x3ccbf8(0x1d3)][_0x3ccbf8(0x221)](_0x3fcdfa[_0x3ccbf8(0x1ee)]),{'verbose':_0x355ce5[_0x3ccbf8(0x1ca)]});return await handleSDKOutput([_0x45953c['data']],_0x355ce5),0x0;}catch(_0x22fd43){return handleSDKError(_0x22fd43,_0x355ce5),0x1;}}}function a28_0x561d(_0x231678,_0x35ac83){_0x231678=_0x231678-0x158;const _0x27e5ce=a28_0x27e5();let _0x561d70=_0x27e5ce[_0x231678];return _0x561d70;}function a28_0x27e5(){const _0x47a8c4=['content','format','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','output','Project\x20not\x20found:\x20','session','slice','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)','Use\x20format:\x20project-name/agent-name','includes','error','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','\x0aStack\x20trace:','50OyWcKC','d\x20ago','attributes','filter','Updating\x20agent...','(no\x20message)','map','yellow','\x20->\x20ImageGen:','Project\x20restored:\x20','models','blue','createProject','outputDir','Restore\x20cancelled.','getBackupMetadata','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','Resolving\x20project\x20\x27','llm:agents','llm:project:backup','rmSync','llm:agent:create','select','table','Checking\x20for\x20existing\x20projects...','12362088jlclxj','createdAt','split','push','yes','\x20\x20Knowledge\x20Bases:\x20','llm:agent:update','Backing\x20up\x20project\x20\x27','knowledgeBases','Getting\x20default\x20project...','Error:\x20','verbose','setCurrentProject','Agent\x20created:\x20','Invalid\x20path\x20syntax:\x20','.llm','\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/','llm:projects','firstInputContent','\x20agent(s)','llm','\x20project(s)','7gjnMYE','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','Restoring\x20project\x20from\x20\x27','Error:\x20Agent\x20name\x20is\x20required','string','Usage:\x20TDX_EXPERIMENTAL=true\x20tdx\x20llm\x20log\x20<chat-id>','just\x20now','description','(no\x20agent)','No\x20projects\x20found','Fetching\x20most\x20recent\x20chat...','tdx\x20llm\x20history','magenta','Fetching\x20projects...','6275516pWuKEZ','toLowerCase','join','\x20->\x20KB:','projectName','execute','targetImageGenerator','length','stack','llm:agent:show','tool','data','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','cyan','[input]\x20\x20','input','⚒️\x20','m\x20ago','temperature','getCurrentProject','last','[content]','deleteAgent','llm:project:restore','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','default','restoreProject','json','model','exportedFrom','getOrCreateDefaultProject','bold','dim','projects','counts','[error]\x20\x20','Usage:\x20tdx\x20llm\x20use\x20<project-name>','find','Show\x20agent\x20details','site','List\x20available\x20LLM\x20models','tdx\x20chats','green','claude-4.5-haiku','chats','\x0aCancelled','2435284vQUwJR','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','stringify','[unknown]','Create\x20a\x20new\x20agent\x20in\x20current\x20project','sort','[image]\x20\x20','🤖\x20','[tool_call]','\x20\x20Prompts:\x20','Fetching\x20available\x20models...','substring','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','370719oBgPll','h\x20ago','agents','agent','keys','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','Agent\x20updated:\x20','Set\x20current\x20project\x20context','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','INVALID_ARGUMENT','tsv','lastConversationAt','\x20\x20\x20Examples:','443500QgztKy','Error:\x20chat-id\x20is\x20required','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','4085460cmCIML','Backup\x20cancelled.','prompts','Analyzing\x20project\x20\x27','LLM_PROJECT_NOT_FOUND','jsonl','\x20->\x20Agent:','Select\x20a\x20chat\x20session:','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','en-US','systemPrompt','floor','Fetching\x20chat\x20log\x20for\x20\x27','tool_call','backupProject','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','Project\x20deleted:\x20','Fetching\x20agents...','log','llmProject','Create\x20a\x20new\x20LLM\x20project','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','Error:\x20Project\x20name\x20is\x20required','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','resolveAgentId','Delete\x20an\x20LLM\x20project','132642hGnvIr','targetAgent','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','Update\x20an\x20existing\x20agent','Agent\x20deleted:\x20','red','Deleting\x20agent...','getTime','numeric','maxToolIterations','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','localeCompare','__load_more__','Session\x20llm_project\x20set\x20to:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','prompt','createAgent','deleteProject','No\x20messages\x20found\x20in\x20chat\x20history.','837FFDqiL','integrations','cause','set','Deleting\x20project\x20\x27','llm:use','Creating\x20agent\x20\x27','updatedAt','\x20\x20Integrations:\x20','llm:project:create','starterMessage','Resolving\x20agent\x20\x27','llm:models','agentId','limit','get','\x27...','message','List\x20all\x20LLM\x20projects','all','\x20--last','sourceSite','targetKnowledgeBase','image','\x20\x20Agents:\x20','\x20\x20Cause:\x20','short','name'];a28_0x27e5=function(){return _0x47a8c4;};return a28_0x27e5();}export class LLMAgentCreateCommand extends BaseCommand{[a28_0x18daf8(0x198)]=a28_0x18daf8(0x1bb);[a28_0x18daf8(0x1dc)]=a28_0x18daf8(0x215);async[a28_0x18daf8(0x1e8)](_0x13ecb0){const _0x495d49=a28_0x18daf8,{options:_0x303b9d,args:_0x1d654a,tdx:_0x1b8aad}=_0x13ecb0;if(_0x1d654a[_0x495d49(0x1ea)]===0x0)return console[_0x495d49(0x1a3)](_0x495d49(0x1d8)),console['error']('Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]'),console[_0x495d49(0x1a3)](_0x495d49(0x178)),0x1;const _0x3b41f7=_0x1d654a[0x0],_0x258a27=_0x303b9d,_0x13956d=_0x258a27[_0x495d49(0x15a)],_0x5d4591=_0x258a27[_0x495d49(0x1ff)]||_0x495d49(0x20e),_0x379c2c=_0x258a27[_0x495d49(0x187)],_0x10f760=_0x258a27[_0x495d49(0x173)]?Number(_0x258a27[_0x495d49(0x173)]):undefined,_0x1ccc19=_0x258a27[_0x495d49(0x1f5)]?Number(_0x258a27[_0x495d49(0x1f5)]):undefined;try{let _0x393a1b,_0x5c1afb;if(_0x3b41f7['includes']('/')){const _0x5041d1=_0x3b41f7[_0x495d49(0x1c1)]('/');if(_0x5041d1['length']===0x2){const [_0x58d4b7,_0x44013d]=_0x5041d1,_0x3b7997=await withSpinner(_0x495d49(0x1b7)+_0x58d4b7+_0x495d49(0x18d),()=>_0x1b8aad[_0x495d49(0x1d3)]['resolveProjectId'](_0x58d4b7),{'verbose':_0x303b9d[_0x495d49(0x1ca)]});_0x393a1b=_0x3b7997['data'],_0x5c1afb=_0x44013d;}else throw new SDKError(ErrorCode[_0x495d49(0x227)],_0x495d49(0x1cd)+_0x3b41f7,undefined,{'helpText':_0x495d49(0x1a1)});}else _0x393a1b=await getProjectIdOrDefault(_0x13ecb0),_0x5c1afb=_0x3b41f7;const _0xe876c7=await withSpinner(_0x495d49(0x183)+_0x5c1afb+_0x495d49(0x18d),()=>_0x1b8aad[_0x495d49(0x1d3)][_0x495d49(0x17a)]({'name':_0x5c1afb,'projectId':_0x393a1b,'modelType':_0x5d4591,'systemPrompt':_0x13956d,'starterMessage':_0x379c2c,'maxToolIterations':_0x10f760,'temperature':_0x1ccc19}),{'verbose':_0x303b9d[_0x495d49(0x1ca)]});return console[_0x495d49(0x162)](_0x495d49(0x1cc)+_0xe876c7[_0x495d49(0x1ee)]['id']),await handleSDKOutput([_0xe876c7[_0x495d49(0x1ee)]],_0x303b9d),0x0;}catch(_0x4a48b9){return handleSDKError(_0x4a48b9,_0x303b9d),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a28_0x18daf8(0x198)]=a28_0x18daf8(0x1c5);[a28_0x18daf8(0x1dc)]=a28_0x18daf8(0x16d);async[a28_0x18daf8(0x1e8)](_0x58dcce){const _0x280434=a28_0x18daf8,{options:_0x2d6dfe,args:_0x31e059,tdx:_0x5929d4}=_0x58dcce;if(_0x31e059['length']===0x0)return console[_0x280434(0x1a3)](_0x280434(0x1d8)),console['error'](_0x280434(0x1d6)),0x1;const _0x54c7b7=_0x31e059[0x0],_0x2ebc09=_0x2d6dfe,_0x1c9dc1=_0x2ebc09[_0x280434(0x198)],_0x549cf5=_0x2ebc09[_0x280434(0x179)],_0x4fc00f=_0x2ebc09[_0x280434(0x1dc)],_0x2cb7a8=_0x2ebc09['starterMessage'];if(!_0x1c9dc1&&!_0x549cf5&&!_0x4fc00f&&!_0x2cb7a8)return console[_0x280434(0x1a3)](_0x280434(0x165)),console['error'](_0x280434(0x1fb)),0x1;try{const _0x3531d0=await getProjectIdOrDefault(_0x58dcce),_0x191ef0=await withSpinner('Resolving\x20agent\x20\x27'+_0x54c7b7+_0x280434(0x18d),()=>_0x5929d4[_0x280434(0x1d3)][_0x280434(0x168)](_0x54c7b7,_0x3531d0),{'verbose':_0x2d6dfe[_0x280434(0x1ca)]}),_0x411241=_0x191ef0[_0x280434(0x1ee)],_0x25b646=await withSpinner(_0x280434(0x1aa),()=>_0x5929d4[_0x280434(0x1d3)]['updateAgent'](_0x411241,{'name':_0x1c9dc1,'prompt':_0x549cf5,'description':_0x4fc00f,'starterMessage':_0x2cb7a8}),{'verbose':_0x2d6dfe['verbose']});return console[_0x280434(0x162)](_0x280434(0x224)+_0x25b646[_0x280434(0x1ee)]['id']),await handleSDKOutput([_0x25b646['data']],_0x2d6dfe),0x0;}catch(_0x276132){return handleSDKError(_0x276132,_0x2d6dfe),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a28_0x18daf8(0x198)]='llm:agent:delete';[a28_0x18daf8(0x1dc)]='Delete\x20an\x20agent';async[a28_0x18daf8(0x1e8)](_0x21f94b){const _0x136787=a28_0x18daf8,{options:_0x564d6d,args:_0x4cdce7,tdx:_0x292439}=_0x21f94b;if(_0x4cdce7[_0x136787(0x1ea)]===0x0)return console['error'](_0x136787(0x1d8)),console['error']('Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>'),0x1;const _0x27c634=_0x4cdce7[0x0];try{const _0x45d2dc=await getProjectIdOrDefault(_0x21f94b),_0x46c289=await withSpinner(_0x136787(0x188)+_0x27c634+'\x27...',()=>_0x292439[_0x136787(0x1d3)]['resolveAgentId'](_0x27c634,_0x45d2dc),{'verbose':_0x564d6d[_0x136787(0x1ca)]}),_0x599fe0=_0x46c289[_0x136787(0x1ee)];return await withSpinner(_0x136787(0x170),()=>_0x292439[_0x136787(0x1d3)][_0x136787(0x1f9)](_0x599fe0),{'verbose':_0x564d6d[_0x136787(0x1ca)]}),console['log'](_0x136787(0x16e)+_0x599fe0),0x0;}catch(_0x532a52){return handleSDKError(_0x532a52,_0x564d6d),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a28_0x18daf8(0x198)]='llm:history';['description']=a28_0x18daf8(0x174);async[a28_0x18daf8(0x1e8)](_0x3b5e92){const _0x286de8=a28_0x18daf8;return executeChatHistoryCommand(_0x3b5e92,_0x286de8(0x1e0));}}export class LLMUseCommand extends BaseCommand{[a28_0x18daf8(0x198)]=a28_0x18daf8(0x182);[a28_0x18daf8(0x1dc)]=a28_0x18daf8(0x225);async['execute'](_0x52a955){const _0x521ffb=a28_0x18daf8,{options:_0x208f6f,args:_0xd9b42c,tdx:_0x169e9f}=_0x52a955;if(_0xd9b42c[_0x521ffb(0x1ea)]===0x0)return console['error'](_0x521ffb(0x166)),console[_0x521ffb(0x1a3)](_0x521ffb(0x207)),0x1;const _0x125557=_0xd9b42c[0x0];try{await withSpinner('Setting\x20project\x20context\x20to\x20\x27'+_0x125557+_0x521ffb(0x18d),()=>_0x169e9f[_0x521ffb(0x1d3)][_0x521ffb(0x1cb)](_0x125557),{'verbose':_0x208f6f[_0x521ffb(0x1ca)]}),saveSessionContext({'llm_project':_0x125557},_0x208f6f[_0x521ffb(0x19e)]);const _0x5bcd5a=getChalk(_0x208f6f);return console[_0x521ffb(0x162)](_0x521ffb(0x177)+_0x5bcd5a[_0x521ffb(0x20d)](_0x125557)),0x0;}catch(_0x420d16){return handleSDKError(_0x420d16,_0x208f6f),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a28_0x18daf8(0x198)]=a28_0x18daf8(0x186);[a28_0x18daf8(0x1dc)]=a28_0x18daf8(0x164);async['execute'](_0xba5819){const _0x57c829=a28_0x18daf8,{options:_0x28bfaf,args:_0x40181c,tdx:_0xf5015b}=_0xba5819;if(_0x40181c['length']===0x0)return console[_0x57c829(0x1a3)](_0x57c829(0x166)),console['error'](_0x57c829(0x19b)),0x1;const _0x183e8e=_0x40181c[0x0],_0x4d8f85=_0x28bfaf,_0x4a9d6e=_0x4d8f85['description'];try{const _0x1d7378=await withSpinner('Creating\x20project\x20\x27'+_0x183e8e+'\x27...',()=>_0xf5015b['llm'][_0x57c829(0x1b2)]({'name':_0x183e8e,'description':_0x4a9d6e}),{'verbose':_0x28bfaf['verbose']});console['log']('Project\x20created:\x20'+_0x1d7378[_0x57c829(0x1ee)]['id']);const _0x3e4822=toLLMProjectInfo(_0x1d7378['data']);return await handleSDKOutput([_0x3e4822],_0x28bfaf),0x0;}catch(_0x51340f){return handleSDKError(_0x51340f,_0x28bfaf),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a28_0x18daf8(0x198)]='llm:project:delete';['description']=a28_0x18daf8(0x169);async[a28_0x18daf8(0x1e8)](_0x5082ae){const _0x22f18a=a28_0x18daf8,{options:_0x33c5a1,args:_0x3a6433,tdx:_0x3bd517}=_0x5082ae;if(_0x3a6433[_0x22f18a(0x1ea)]===0x0)return console[_0x22f18a(0x1a3)](_0x22f18a(0x166)),console[_0x22f18a(0x1a3)]('Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>'),0x1;const _0x3f3e54=_0x3a6433[0x0];try{return await withSpinner(_0x22f18a(0x181)+_0x3f3e54+'\x27...',()=>_0x3bd517['llm'][_0x22f18a(0x17b)](_0x3f3e54),{'verbose':_0x33c5a1[_0x22f18a(0x1ca)]}),console['log'](_0x22f18a(0x160)+_0x3f3e54),0x0;}catch(_0xa975b4){return handleSDKError(_0xa975b4,_0x33c5a1),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a28_0x18daf8(0x198)]=a28_0x18daf8(0x1b9);[a28_0x18daf8(0x1dc)]=a28_0x18daf8(0x16c);async[a28_0x18daf8(0x1e8)](_0x2502cb){const _0x39b4c8=a28_0x18daf8,{options:_0x1d3d49,args:_0x4cc008,tdx:_0xf2f423}=_0x2502cb,_0x3a3a84=getChalk(_0x1d3d49);console['log'](_0x3a3a84[_0x39b4c8(0x1ad)]('⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.')),console[_0x39b4c8(0x162)](_0x3a3a84[_0x39b4c8(0x1ad)](_0x39b4c8(0x158))),console['log'](_0x3a3a84['dim'](_0x39b4c8(0x15f))),console[_0x39b4c8(0x162)]();if(_0x4cc008[_0x39b4c8(0x1ea)]===0x0)return console[_0x39b4c8(0x1a3)](_0x39b4c8(0x166)),console[_0x39b4c8(0x1a3)](_0x39b4c8(0x1a4)),0x1;const _0x1f8fd4=_0x4cc008[0x0],_0x59793e=_0x1d3d49,_0x4521b7=_0x59793e[_0x39b4c8(0x19c)],_0x25c1c3=_0x59793e['dryRun'];try{const _0x67cc45=_0x4521b7||_0x1f8fd4+_0x39b4c8(0x1ce);if(a28_0x418b9f['existsSync'](_0x67cc45)&&!_0x25c1c3){if(!_0x1d3d49[_0x39b4c8(0x1c3)]){const _0x45b59f=await confirm('Output\x20directory\x20\x27'+_0x67cc45+'\x27\x20already\x20exists.\x20Overwrite?');if(!_0x45b59f)return console[_0x39b4c8(0x162)](_0x39b4c8(0x22f)),0x0;}a28_0x418b9f[_0x39b4c8(0x1ba)](_0x67cc45,{'recursive':!![]});}const _0x31fd79=await withSpinner(_0x25c1c3?_0x39b4c8(0x231)+_0x1f8fd4+_0x39b4c8(0x18d):_0x39b4c8(0x1c6)+_0x1f8fd4+'\x27...',()=>_0xf2f423['llm'][_0x39b4c8(0x15e)](_0x1f8fd4,_0x4521b7,{'dryRun':_0x25c1c3}),{'verbose':_0x1d3d49[_0x39b4c8(0x1ca)]}),_0x3084cd=_0x31fd79[_0x39b4c8(0x1ee)];return _0x25c1c3?console[_0x39b4c8(0x162)](_0x39b4c8(0x212)+_0x3084cd['outputDir']):console[_0x39b4c8(0x162)]('Project\x20backed\x20up\x20to:\x20'+_0x3084cd[_0x39b4c8(0x1b3)]),console[_0x39b4c8(0x162)](_0x39b4c8(0x195)+_0x3084cd[_0x39b4c8(0x205)][_0x39b4c8(0x220)]),console[_0x39b4c8(0x162)]('\x20\x20Knowledge\x20Bases:\x20'+_0x3084cd[_0x39b4c8(0x205)][_0x39b4c8(0x1c7)]),console[_0x39b4c8(0x162)](_0x39b4c8(0x21a)+_0x3084cd[_0x39b4c8(0x205)][_0x39b4c8(0x230)]),console[_0x39b4c8(0x162)](_0x39b4c8(0x185)+_0x3084cd[_0x39b4c8(0x205)][_0x39b4c8(0x17e)]),(_0x1d3d49[_0x39b4c8(0x19a)]===_0x39b4c8(0x1fe)||_0x1d3d49[_0x39b4c8(0x19a)]===_0x39b4c8(0x233))&&await handleSDKOutput([_0x3084cd],_0x1d3d49),0x0;}catch(_0x2b2af3){return handleSDKError(_0x2b2af3,_0x1d3d49),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a28_0x18daf8(0x198)]=a28_0x18daf8(0x1fa);[a28_0x18daf8(0x1dc)]=a28_0x18daf8(0x1a0);async[a28_0x18daf8(0x1e8)](_0x506250){const _0x6e3151=a28_0x18daf8,{options:_0x2fec42,args:_0x3b8678,tdx:_0x50f080}=_0x506250,_0x2c8a7e=getChalk(_0x2fec42);console[_0x6e3151(0x162)](_0x2c8a7e['yellow']('⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.')),console[_0x6e3151(0x162)](_0x2c8a7e[_0x6e3151(0x1ad)]('\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.')),console[_0x6e3151(0x162)](_0x2c8a7e[_0x6e3151(0x203)](_0x6e3151(0x22a))),console[_0x6e3151(0x162)](_0x2c8a7e[_0x6e3151(0x203)](_0x6e3151(0x1cf))),console[_0x6e3151(0x162)](_0x2c8a7e['dim'](_0x6e3151(0x1ef))),console[_0x6e3151(0x162)]();if(_0x3b8678['length']===0x0)return console[_0x6e3151(0x1a3)]('Error:\x20Backup\x20folder\x20path\x20is\x20required'),console[_0x6e3151(0x1a3)]('Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]'),0x1;const _0x321638=_0x3b8678[0x0],_0x5b856c=_0x2fec42,_0xd3c7f7=_0x5b856c['name'],_0x182868=_0x5b856c['dryRun'];try{if(!_0x182868){const _0x56f31f=_0x50f080[_0x6e3151(0x1d3)][_0x6e3151(0x1b5)](_0x321638),_0xfbc353=_0xd3c7f7||_0x56f31f[_0x6e3151(0x200)][_0x6e3151(0x1e7)],_0x2e3132=await withSpinner(_0x6e3151(0x1be),()=>_0x50f080['llm'][_0x6e3151(0x204)](),{'verbose':_0x2fec42[_0x6e3151(0x1ca)]}),_0x50f313=_0x2e3132[_0x6e3151(0x1ee)][_0x6e3151(0x208)](_0x139379=>_0x139379[_0x6e3151(0x1a8)][_0x6e3151(0x198)]===_0xfbc353);if(_0x50f313&&!_0x2fec42[_0x6e3151(0x1c3)]){const _0x2ab197=await confirm('A\x20project\x20named\x20\x27'+_0xfbc353+_0x6e3151(0x167));if(!_0x2ab197)return console['log'](_0x6e3151(0x1b4)),0x0;}}const _0x3089f8=await withSpinner(_0x182868?'Validating\x20backup\x20from\x20\x27'+_0x321638+_0x6e3151(0x18d):_0x6e3151(0x1d7)+_0x321638+_0x6e3151(0x18d),()=>_0x50f080['llm'][_0x6e3151(0x1fd)](_0x321638,{'name':_0xd3c7f7,'dryRun':_0x182868}),{'verbose':_0x2fec42[_0x6e3151(0x1ca)]}),_0xc68854=_0x3089f8['data'];return _0xc68854[_0x6e3151(0x192)]&&console[_0x6e3151(0x162)](_0x6e3151(0x1b6)+_0xc68854[_0x6e3151(0x192)]+'\x27'),_0x182868?console[_0x6e3151(0x162)](_0x6e3151(0x223)+_0xc68854[_0x6e3151(0x1e7)]):console['log'](_0x6e3151(0x1af)+_0xc68854['projectName']+'\x20('+_0xc68854['projectId']+')'),console[_0x6e3151(0x162)]('\x20\x20Agents:\x20'+_0xc68854[_0x6e3151(0x205)]['agents']),console[_0x6e3151(0x162)](_0x6e3151(0x1c4)+_0xc68854['counts'][_0x6e3151(0x1c7)]),console[_0x6e3151(0x162)](_0x6e3151(0x21a)+_0xc68854['counts'][_0x6e3151(0x230)]),console[_0x6e3151(0x162)](_0x6e3151(0x185)+_0xc68854[_0x6e3151(0x205)][_0x6e3151(0x17e)]),(_0x2fec42['format']===_0x6e3151(0x1fe)||_0x2fec42['format']===_0x6e3151(0x233))&&await handleSDKOutput([_0xc68854],_0x2fec42),0x0;}catch(_0x115164){return handleSDKError(_0x115164,_0x2fec42),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0xab9f8f,_0x5d5b78){const _0x3f485d=a28_0x18daf8,_0x3853d2=_0x5d5b78['limit']||CHAT_SELECTOR_PAGE_SIZE;let _0x5d5ad8=0x0,_0x46bab3=[];const _0x67c7b0=(await import(_0x3f485d(0x230)))[_0x3f485d(0x1fc)],_0x4ac69b=getChalk(_0x5d5b78);while(!![]){const _0x531a21=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0xab9f8f['llm'][_0x3f485d(0x20f)](_0x3853d2+_0x5d5ad8),{'verbose':_0x5d5b78[_0x3f485d(0x1ca)]});_0x46bab3=_0x531a21['data'];const _0x1e0bd9=_0x46bab3[_0x3f485d(0x19f)](_0x5d5ad8,_0x5d5ad8+_0x3853d2),_0x637319=_0x46bab3[_0x3f485d(0x1ea)]>_0x5d5ad8+_0x3853d2,_0x2cb285=[...new Set(_0x1e0bd9[_0x3f485d(0x1ac)](_0x81acb8=>_0x81acb8[_0x3f485d(0x1a8)][_0x3f485d(0x18a)])[_0x3f485d(0x1a9)](_0x408499=>_0x408499!==undefined))],_0x54f748=new Map();await Promise[_0x3f485d(0x190)](_0x2cb285['map'](async _0x30f434=>{const _0x2bafec=_0x3f485d;try{const _0x5bb481=await _0xab9f8f[_0x2bafec(0x1d3)][_0x2bafec(0x221)](_0x30f434);_0x54f748[_0x2bafec(0x180)](_0x30f434,_0x5bb481[_0x2bafec(0x1a8)][_0x2bafec(0x198)]);}catch{_0x54f748[_0x2bafec(0x180)](_0x30f434,_0x30f434);}}));const _0x2ca230=_0x1e0bd9['map'](_0x110519=>{const _0x3d392f=_0x3f485d,_0x419342=_0x110519[_0x3d392f(0x1a8)][_0x3d392f(0x1d1)]||_0x3d392f(0x1ab),_0x444448=_0x419342[_0x3d392f(0x1c1)]('\x0a')[0x0],_0x35ceac=_0x444448[_0x3d392f(0x1ea)]>0x50?_0x444448[_0x3d392f(0x21c)](0x0,0x4d)+'...':_0x444448,_0x34b679=_0x110519[_0x3d392f(0x1a8)][_0x3d392f(0x18a)]?_0x54f748[_0x3d392f(0x18c)](_0x110519[_0x3d392f(0x1a8)][_0x3d392f(0x18a)])||_0x110519['attributes'][_0x3d392f(0x18a)]:_0x3d392f(0x1dd),_0x33198b=_0x110519[_0x3d392f(0x1a8)][_0x3d392f(0x229)]||_0x110519[_0x3d392f(0x1a8)][_0x3d392f(0x184)],_0x29dc35=new Date(_0x33198b),_0x411514=new Date(),_0x5eae5f=_0x411514[_0x3d392f(0x171)]()-_0x29dc35[_0x3d392f(0x171)](),_0x517b3a=Math[_0x3d392f(0x15b)](_0x5eae5f/0xea60),_0x1a2891=Math[_0x3d392f(0x15b)](_0x5eae5f/0x36ee80),_0x17427d=Math[_0x3d392f(0x15b)](_0x5eae5f/0x5265c00);let _0x39e676;if(_0x517b3a<0x1)_0x39e676=_0x3d392f(0x1db);else{if(_0x517b3a<0x3c)_0x39e676=_0x517b3a+_0x3d392f(0x1f4);else{if(_0x1a2891<0x18)_0x39e676=_0x1a2891+_0x3d392f(0x21f);else _0x17427d<0x7?_0x39e676=_0x17427d+_0x3d392f(0x1a7):_0x39e676=_0x29dc35['toLocaleDateString'](_0x3d392f(0x159),{'month':_0x3d392f(0x197),'day':_0x3d392f(0x172)});}}return{'title':_0x35ceac+'\x20'+_0x4ac69b['dim']('['+_0x34b679+']\x20'+_0x39e676),'value':_0x110519['id']};});_0x637319&&_0x2ca230[_0x3f485d(0x1c2)]({'title':_0x4ac69b[_0x3f485d(0x1f0)]('Load\x20more...'),'value':_0x3f485d(0x176)});const _0x360b86=await _0x67c7b0({'type':_0x3f485d(0x1bc),'name':'chatId','message':_0x3f485d(0x235),'choices':_0x2ca230,'hint':'Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel'});if(!_0x360b86['chatId'])return undefined;if(_0x360b86['chatId']===_0x3f485d(0x176)){_0x5d5ad8+=_0x3853d2;continue;}return _0x360b86['chatId'];}}export class ChatsCommand extends BaseCommand{[a28_0x18daf8(0x198)]=a28_0x18daf8(0x20f);[a28_0x18daf8(0x1dc)]=a28_0x18daf8(0x22d);async[a28_0x18daf8(0x1e8)](_0x44700b){const _0x551f94=a28_0x18daf8;return executeChatHistoryCommand(_0x44700b,_0x551f94(0x20c));}}export class LLMLogCommand extends BaseCommand{['name']='llm:log';[a28_0x18daf8(0x1dc)]='Show\x20chat\x20log';async[a28_0x18daf8(0x1e8)](_0x15e63a){const _0x525bd1=a28_0x18daf8,{options:_0x40868f,args:_0x387d0b,tdx:_0x4fc434}=_0x15e63a,_0x4d8d76=_0x387d0b[0x0];if(!_0x4d8d76)return console[_0x525bd1(0x1a3)](_0x525bd1(0x22c)),console[_0x525bd1(0x1a3)](_0x525bd1(0x1da)),0x1;const _0x3700de=await withSpinner(_0x525bd1(0x15c)+_0x4d8d76+'\x27...',()=>_0x4fc434[_0x525bd1(0x1d3)]['getChatLog'](_0x4d8d76),{'verbose':_0x40868f[_0x525bd1(0x1ca)]});return await handleSDKOutput(_0x3700de[_0x525bd1(0x1ee)][_0x525bd1(0x1ee)],_0x40868f),0x0;}}
|
|
1
|
+
const a28_0x9865ec=a28_0x455a;(function(_0x4f0b4e,_0x42fb71){const _0x4ff4b1=a28_0x455a,_0x2336e7=_0x4f0b4e();while(!![]){try{const _0x5439fb=-parseInt(_0x4ff4b1(0x15a))/0x1*(parseInt(_0x4ff4b1(0x186))/0x2)+-parseInt(_0x4ff4b1(0x12c))/0x3+parseInt(_0x4ff4b1(0x127))/0x4*(-parseInt(_0x4ff4b1(0x155))/0x5)+parseInt(_0x4ff4b1(0x17e))/0x6*(-parseInt(_0x4ff4b1(0xd1))/0x7)+parseInt(_0x4ff4b1(0xf0))/0x8+parseInt(_0x4ff4b1(0x185))/0x9*(-parseInt(_0x4ff4b1(0x10d))/0xa)+-parseInt(_0x4ff4b1(0x131))/0xb*(-parseInt(_0x4ff4b1(0xf1))/0xc);if(_0x5439fb===_0x42fb71)break;else _0x2336e7['push'](_0x2336e7['shift']());}catch(_0x2d821f){_0x2336e7['push'](_0x2336e7['shift']());}}}(a28_0x9874,0x2877f));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../core/command-output.js';import{withSpinner}from'../utils/spinner.js';import{matchGlobPattern}from'../utils/string-utils.js';import{getChalk}from'../utils/colors.js';import{DEFAULT_LLM_LIMIT,resolveLimit}from'../core/constants.js';import{confirm}from'../utils/prompt.js';import{saveSessionContext}from'../core/session.js';import{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import*as a28_0x4cac73 from'node:fs';function handleSDKError(_0x574411,_0x2b2e39){const _0x3c1056=a28_0x455a;if(_0x574411 instanceof SDKError)console['error'](_0x3c1056(0x135)+_0x574411[_0x3c1056(0xee)]),_0x2b2e39[_0x3c1056(0x170)]&&(_0x574411[_0x3c1056(0xfb)]&&console[_0x3c1056(0x100)](_0x3c1056(0x152)+_0x574411[_0x3c1056(0xfb)]),_0x574411[_0x3c1056(0x197)]&&(console[_0x3c1056(0x100)](_0x3c1056(0x125)),console[_0x3c1056(0x100)](_0x574411[_0x3c1056(0x197)])));else throw _0x574411;}function formatChatHistoryEntry(_0x1afe44,_0x243f4c){const _0x4d174e=a28_0x455a,_0x209d7f=getChalk(_0x243f4c),_0x1e9bfe=_0x209d7f[_0x4d174e(0x171)](_0x1afe44['at']);if(_0x4d174e(0xe3)in _0x1afe44){const _0x197f88=_0x209d7f['cyan'](_0x4d174e(0x15f));return _0x1e9bfe+'\x20'+_0x197f88+':\x20'+_0x1afe44[_0x4d174e(0xe3)];}if(_0x4d174e(0x16c)in _0x1afe44){const _0xa8b877=_0x209d7f[_0x4d174e(0x1a0)](_0x4d174e(0x13c));return _0x1e9bfe+'\x20'+_0xa8b877+':\x20'+_0x1afe44['content'];}if('tool_call'in _0x1afe44){const _0x2b4929=_0x209d7f[_0x4d174e(0x156)](_0x4d174e(0x17f)),{functionName:_0x847137,functionArguments:_0x31da8e,targetFunction:_0x38f265}=_0x1afe44[_0x4d174e(0x118)];let _0x158c2d=_0x1e9bfe+'\x20'+_0x2b4929+':\x20'+_0x209d7f[_0x4d174e(0x17d)](_0x847137);if(_0x31da8e&&Object[_0x4d174e(0xec)](_0x31da8e)['length']>0x0){const _0x4e5086=Object['entries'](_0x31da8e)[_0x4d174e(0x1a8)](([_0x3283aa,_0x520c44])=>_0x3283aa+'='+JSON[_0x4d174e(0x126)](_0x520c44))[_0x4d174e(0x19f)](',\x20');_0x158c2d+='('+_0x4e5086+')';}_0x38f265&&(_0x158c2d+=_0x209d7f[_0x4d174e(0x171)]('\x20['+_0x38f265+']'));let _0x115457='';if(_0x1afe44['tool_call'][_0x4d174e(0x160)])_0x115457=_0x4d174e(0xf6)+_0x1afe44[_0x4d174e(0x118)]['targetKnowledgeBase'][_0x4d174e(0x146)];else{if(_0x1afe44[_0x4d174e(0x118)][_0x4d174e(0x163)])_0x115457=_0x4d174e(0x198)+_0x1afe44[_0x4d174e(0x118)][_0x4d174e(0x163)]['name'];else{if(_0x1afe44[_0x4d174e(0x118)][_0x4d174e(0xf3)])_0x115457=_0x4d174e(0x1a3)+_0x1afe44[_0x4d174e(0x118)][_0x4d174e(0xf3)][_0x4d174e(0x146)];else _0x1afe44[_0x4d174e(0x118)][_0x4d174e(0x190)]&&(_0x115457=_0x4d174e(0x19b)+_0x1afe44[_0x4d174e(0x118)][_0x4d174e(0x190)][_0x4d174e(0x146)]);}}return _0x158c2d+_0x115457;}if(_0x4d174e(0x159)in _0x1afe44){const _0x347931=_0x209d7f[_0x4d174e(0x18c)](_0x4d174e(0x16e)),{functionName:_0x5f58a9,functionArguments:_0x765114,content:_0x1b1c4b,newChat:_0x531aa7}=_0x1afe44[_0x4d174e(0x159)];let _0x53c6a0=_0x1e9bfe+'\x20'+_0x347931+':\x20'+_0x209d7f[_0x4d174e(0x17d)](_0x5f58a9);if(_0x765114){const _0x46e321=typeof _0x765114==='string'?_0x765114:JSON[_0x4d174e(0x126)](_0x765114);_0x53c6a0+='('+_0x46e321+')';}return _0x1b1c4b&&(_0x53c6a0+='\x0a'+_0x209d7f[_0x4d174e(0x171)](_0x1b1c4b)),_0x531aa7&&(_0x53c6a0+=_0x209d7f[_0x4d174e(0x171)]('\x20→\x20chat:\x20'+_0x531aa7['id'])),_0x53c6a0;}if('output'in _0x1afe44){const _0x5ac943=_0x209d7f[_0x4d174e(0x13e)](_0x4d174e(0x137));return _0x1e9bfe+'\x20'+_0x5ac943+':\x20'+_0x1afe44['output']['name']+'\x20('+_0x1afe44['output'][_0x4d174e(0x16c)]['length']+'\x20bytes)';}if('image'in _0x1afe44){const _0x577197=_0x209d7f[_0x4d174e(0x13e)](_0x4d174e(0xf4)),{width:_0x6cb273,height:_0x441371,headerText:_0x5f0e70}=_0x1afe44[_0x4d174e(0x193)],_0x1f4eeb=_0x5f0e70?_0x4d174e(0x1a7)+_0x5f0e70:'';return _0x1e9bfe+'\x20'+_0x577197+':\x20'+_0x6cb273+'x'+_0x441371+_0x1f4eeb;}if(_0x4d174e(0x100)in _0x1afe44){const _0x103e1b=_0x209d7f[_0x4d174e(0xd2)](_0x4d174e(0x15d));return _0x1e9bfe+'\x20'+_0x103e1b+':\x20'+_0x1afe44['error'];}return _0x1e9bfe+'\x20'+_0x209d7f[_0x4d174e(0x171)](_0x4d174e(0x105))+':\x20'+JSON[_0x4d174e(0x126)](_0x1afe44);}async function executeChatHistoryCommand(_0x33b842,_0x463305){const _0x497056=a28_0x455a,{options:_0x4b8858,args:_0x2e7af3,tdx:_0x1bbb63}=_0x33b842,_0x1fb561=_0x2e7af3[0x0],_0x798896=_0x4b8858,_0x298b4d=_0x798896[_0x497056(0xdc)];try{if(_0x298b4d&&_0x1fb561)return console[_0x497056(0x100)](_0x497056(0x196)),console['error']('Usage:\x20'+_0x463305+'\x20--last'),0x1;if(!_0x1fb561&&!_0x298b4d&&_0x4b8858['format']!==undefined){const _0x1e3694=resolveLimit(_0x4b8858[_0x497056(0x153)],DEFAULT_LLM_LIMIT),_0x3b8d74=await withSpinner(_0x497056(0x12d),()=>_0x1bbb63[_0x497056(0x16d)]['chats'](_0x1e3694),{'verbose':_0x4b8858[_0x497056(0x170)]});return await handleSDKOutput(_0x3b8d74[_0x497056(0x173)],_0x4b8858),0x0;}const _0x26e814=await getChatIdOrSelect(_0x1bbb63,_0x4b8858,_0x298b4d,_0x1fb561);if(!_0x26e814)return 0x0;return await displayChatHistory(_0x26e814,_0x1bbb63,_0x4b8858),0x0;}catch(_0x56dc85){return handleSDKError(_0x56dc85,_0x4b8858),0x1;}}async function displayChatHistory(_0x54e6ea,_0x4f2482,_0x3a1e1b){const _0x21b227=a28_0x455a,_0x32d8ac=await withSpinner(_0x21b227(0xe4)+_0x54e6ea+_0x21b227(0xd4),()=>_0x4f2482[_0x21b227(0x16d)][_0x21b227(0x104)](_0x54e6ea),{'verbose':_0x3a1e1b[_0x21b227(0x170)]}),_0x29b389=_0x32d8ac['data'][_0x21b227(0x173)]??[];if(_0x29b389[_0x21b227(0xde)]===0x0){console[_0x21b227(0x11a)](_0x21b227(0x10b));return;}if(_0x3a1e1b[_0x21b227(0x18d)]!==undefined)await handleSDKOutput(_0x29b389,_0x3a1e1b);else{const _0x2d90b8=_0x29b389['map'](_0x3ab49e=>formatChatHistoryEntry(_0x3ab49e,_0x3a1e1b)),_0x45918f=_0x2d90b8[_0x21b227(0x19f)]('\x0a');await writeOutput(_0x45918f,_0x3a1e1b[_0x21b227(0x1a1)],'table');}}async function getChatIdOrSelect(_0x4de69f,_0x9b0141,_0x96c617,_0x5905fa){const _0x42d9f9=a28_0x455a;if(_0x5905fa)return _0x5905fa;if(_0x96c617){const _0x5dadf5=await withSpinner(_0x42d9f9(0x11e),()=>_0x4de69f[_0x42d9f9(0x16d)]['chats'](0x1),{'verbose':_0x9b0141[_0x42d9f9(0x170)]});if(_0x5dadf5[_0x42d9f9(0x173)][_0x42d9f9(0xde)]===0x0)return console['log'](_0x42d9f9(0xe7)),undefined;return _0x5dadf5[_0x42d9f9(0x173)][0x0]['id'];}const _0x159245=await selectChatInteractively(_0x4de69f,_0x9b0141);if(!_0x159245)return console[_0x42d9f9(0x11a)]('\x0aCancelled'),undefined;return _0x159245;}async function getProjectIdOrDefault(_0x35e108){const _0x5641b4=await getProjectWithName(_0x35e108);return _0x5641b4['id'];}async function getProjectWithName(_0x341517){const _0xe23ab5=a28_0x455a,{tdx:_0x3131f3,options:_0x316f94}=_0x341517,_0x1fd25a=_0x316f94[_0xe23ab5(0x18a)];if(_0x1fd25a){const _0x23e698=await withSpinner(_0xe23ab5(0x192)+_0x1fd25a+_0xe23ab5(0xd4),()=>_0x3131f3['llm'][_0xe23ab5(0xfc)](_0x1fd25a),{'verbose':_0x316f94[_0xe23ab5(0x170)]});return{'id':_0x23e698[_0xe23ab5(0x173)],'name':_0x1fd25a};}const _0x13aa11=_0x3131f3[_0xe23ab5(0x16d)][_0xe23ab5(0x15e)]();if(_0x13aa11){const _0x3034d9=await _0x3131f3['llm'][_0xe23ab5(0xf5)](),_0xe23a0=_0x3034d9[_0xe23ab5(0x129)](_0x1342c2=>_0x1342c2['id']===_0x13aa11);return{'id':_0x13aa11,'name':_0xe23a0?.['attributes'][_0xe23ab5(0x146)]||'Unknown'};}const _0x570735=await withSpinner('Getting\x20default\x20project...',()=>_0x3131f3[_0xe23ab5(0x16d)]['getOrCreateDefaultProject'](),{'verbose':_0x316f94[_0xe23ab5(0x170)]});return{'id':_0x570735['data']['id'],'name':_0x570735[_0xe23ab5(0x173)]['attributes'][_0xe23ab5(0x146)]};}function toLLMProjectInfo(_0x4e5bcc){const _0x52bbc4=a28_0x455a;return{'name':_0x4e5bcc[_0x52bbc4(0x1a6)]['name'],'description':_0x4e5bcc[_0x52bbc4(0x1a6)]['description'],'createdAt':_0x4e5bcc['attributes'][_0x52bbc4(0x175)],'updatedAt':_0x4e5bcc[_0x52bbc4(0x1a6)][_0x52bbc4(0xf8)]};}function toAgentInfo(_0x52c80e){const _0x216616=a28_0x455a;return{'name':_0x52c80e[_0x216616(0x1a6)][_0x216616(0x146)],'description':_0x52c80e[_0x216616(0x1a6)][_0x216616(0x14a)],'prompt':truncatePrompt(_0x52c80e[_0x216616(0x1a6)]['prompt']),'createdAt':_0x52c80e[_0x216616(0x1a6)][_0x216616(0x175)],'updatedAt':_0x52c80e[_0x216616(0x1a6)][_0x216616(0xf8)]};}function truncatePrompt(_0x1714e0){const _0x435d6d=a28_0x455a;if(!_0x1714e0)return undefined;const _0x5e502f=0x64;if(_0x1714e0[_0x435d6d(0xde)]<=_0x5e502f)return _0x1714e0;return _0x1714e0[_0x435d6d(0x12f)](0x0,_0x5e502f)+'...';}export class LLMModelsCommand extends BaseCommand{[a28_0x9865ec(0x146)]=a28_0x9865ec(0xe1);['description']='List\x20available\x20LLM\x20models';async['execute'](_0x355cd5){const _0x53d056=a28_0x9865ec,{options:_0x3d2c4d,tdx:_0x4330ec}=_0x355cd5;try{const _0x19208d=await withSpinner('Fetching\x20available\x20models...',()=>_0x4330ec[_0x53d056(0x16d)][_0x53d056(0x165)](),{'verbose':_0x3d2c4d[_0x53d056(0x170)]});return await handleSDKOutput(_0x19208d['data'],_0x3d2c4d),0x0;}catch(_0x54ac0b){return handleSDKError(_0x54ac0b,_0x3d2c4d),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a28_0x9865ec(0x146)]=a28_0x9865ec(0x12b);[a28_0x9865ec(0x14a)]='List\x20all\x20LLM\x20projects';async[a28_0x9865ec(0x19c)](_0x59bf62){const _0x1b7cd9=a28_0x9865ec,{options:_0x4db277,args:_0x10dd77,tdx:_0x469b46}=_0x59bf62,_0x374c58=getChalk(_0x4db277),_0x285607=_0x4db277[_0x1b7cd9(0xed)];try{const _0x2ad8e1=_0x10dd77[0x0],_0x1fd568=resolveLimit(_0x4db277[_0x1b7cd9(0x153)],DEFAULT_LLM_LIMIT),_0x5de223=await withSpinner(_0x1b7cd9(0x13f),()=>_0x469b46['llm'][_0x1b7cd9(0xf5)](_0x1fd568),{'verbose':_0x4db277['verbose']});let _0x472f7a=_0x5de223[_0x1b7cd9(0x173)];_0x2ad8e1&&(_0x472f7a=_0x5de223['data'][_0x1b7cd9(0x117)](_0x1749bc=>matchGlobPattern(_0x1749bc['attributes'][_0x1b7cd9(0x146)],_0x2ad8e1)));const _0x5c003f=_0x4db277[_0x1b7cd9(0x18d)]===_0x1b7cd9(0x1a2)||_0x4db277['format']==='jsonl'||_0x4db277[_0x1b7cd9(0x18d)]===_0x1b7cd9(0x119)||_0x4db277['format']==='tsv';if(_0x5c003f){const _0xa32c33=_0x472f7a[_0x1b7cd9(0x1a8)](_0x2a18cf=>({...toLLMProjectInfo(_0x2a18cf),'url':getLLMProjectUrl(_0x285607,_0x2a18cf['id'])}));await handleSDKOutput(_0xa32c33,_0x4db277);}else{const _0x590996=[];if(_0x472f7a[_0x1b7cd9(0xde)]===0x0)_0x590996[_0x1b7cd9(0x191)](_0x374c58[_0x1b7cd9(0x171)](_0x1b7cd9(0x134)));else{const _0x304e91=[..._0x472f7a][_0x1b7cd9(0x12a)]((_0x3a27de,_0x29ef13)=>_0x3a27de['attributes'][_0x1b7cd9(0x146)][_0x1b7cd9(0x13b)](_0x29ef13['attributes'][_0x1b7cd9(0x146)]));for(const _0x3911d7 of _0x304e91){const _0xce2c73=getLLMProjectUrl(_0x285607,_0x3911d7['id']),_0xa8f5cd=hyperlink(_0x3911d7[_0x1b7cd9(0x1a6)][_0x1b7cd9(0x146)],_0xce2c73);_0x590996[_0x1b7cd9(0x191)](_0x1b7cd9(0x180)+_0xa8f5cd);}_0x590996[_0x1b7cd9(0x191)](_0x374c58[_0x1b7cd9(0x171)](_0x472f7a[_0x1b7cd9(0xde)]+_0x1b7cd9(0x149)));}await writeOutput(_0x590996[_0x1b7cd9(0x19f)]('\x0a'),_0x4db277[_0x1b7cd9(0x1a1)],_0x1b7cd9(0x119));}return 0x0;}catch(_0x1b29dc){return handleSDKError(_0x1b29dc,_0x4db277),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a28_0x9865ec(0x146)]=a28_0x9865ec(0x184);[a28_0x9865ec(0x14a)]=a28_0x9865ec(0x111);async['execute'](_0x4776e5){const _0x4685b5=a28_0x9865ec,{options:_0x553a1d,args:_0xf1b2cc,tdx:_0x1917a7}=_0x4776e5,_0x51698b=getChalk(_0x553a1d),_0x46961c=_0x553a1d[_0x4685b5(0xed)];try{const _0x497abd=_0xf1b2cc[0x0];let _0x49a2b3=_0x497abd,_0x377f9b,_0xeebeba;if(_0x497abd&&_0x497abd[_0x4685b5(0x10e)]('/')){const _0x18f571=_0x497abd[_0x4685b5(0x154)]('/');if(_0x18f571['length']===0x2){const [_0xd78dd3,_0x389c98]=_0x18f571,_0x42b340=await _0x1917a7[_0x4685b5(0x16d)][_0x4685b5(0xf5)](),_0x398c96=_0x42b340['find'](_0x1b5f03=>_0x1b5f03[_0x4685b5(0x1a6)][_0x4685b5(0x146)][_0x4685b5(0xdf)]()===_0xd78dd3[_0x4685b5(0xdf)]());if(!_0x398c96)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0xd78dd3,undefined,{'helpText':_0x4685b5(0x18f)});_0x377f9b=_0x398c96['id'],_0xeebeba=_0x398c96['attributes'][_0x4685b5(0x146)],_0x49a2b3=_0x389c98;}else throw new SDKError(ErrorCode[_0x4685b5(0xff)],_0x4685b5(0x1ac)+_0x497abd,undefined,{'helpText':_0x4685b5(0x168)});}else{const _0x114b26=await getProjectWithName(_0x4776e5);_0x377f9b=_0x114b26['id'],_0xeebeba=_0x114b26[_0x4685b5(0x146)];}const _0x5bd3ae=await withSpinner('Fetching\x20agents...',()=>_0x1917a7[_0x4685b5(0x16d)][_0x4685b5(0x157)](_0x377f9b),{'verbose':_0x553a1d[_0x4685b5(0x170)]});let _0x14ff14=_0x5bd3ae[_0x4685b5(0x173)];_0x49a2b3&&(_0x14ff14=_0x5bd3ae['data']['filter'](_0x3db2d3=>matchGlobPattern(_0x3db2d3[_0x4685b5(0x1a6)]['name'],_0x49a2b3)));const _0x4721c0=_0x553a1d[_0x4685b5(0x18d)]===_0x4685b5(0x1a2)||_0x553a1d[_0x4685b5(0x18d)]==='jsonl'||_0x553a1d[_0x4685b5(0x18d)]===_0x4685b5(0x119)||_0x553a1d[_0x4685b5(0x18d)]===_0x4685b5(0x169);if(_0x4721c0){const _0x13ea72=_0x14ff14['map'](_0x5a6931=>({...toAgentInfo(_0x5a6931),'chatUrl':getLLMAgentChatUrl(_0x46961c,_0x377f9b,_0x5a6931['id'])}));await handleSDKOutput(_0x13ea72,_0x553a1d);}else{const _0x5e9440=[];_0x5e9440[_0x4685b5(0x191)](_0x51698b['dim']('['+_0xeebeba+']'));if(_0x14ff14[_0x4685b5(0xde)]===0x0)_0x5e9440[_0x4685b5(0x191)](_0x51698b['dim'](_0x4685b5(0x115)));else{const _0x3d8d96=[..._0x14ff14][_0x4685b5(0x12a)]((_0x201e00,_0x34322f)=>_0x201e00[_0x4685b5(0x1a6)][_0x4685b5(0x146)][_0x4685b5(0x13b)](_0x34322f[_0x4685b5(0x1a6)][_0x4685b5(0x146)]));for(const _0x49d34a of _0x3d8d96){const _0x4c6d52=getLLMAgentChatUrl(_0x46961c,_0x377f9b,_0x49d34a['id']),_0x170d36=hyperlink(_0x49d34a[_0x4685b5(0x1a6)][_0x4685b5(0x146)],_0x4c6d52);_0x5e9440[_0x4685b5(0x191)](_0x4685b5(0x15b)+_0x170d36);}_0x5e9440['push'](_0x51698b[_0x4685b5(0x171)](_0x14ff14[_0x4685b5(0xde)]+_0x4685b5(0x106)));}await writeOutput(_0x5e9440[_0x4685b5(0x19f)]('\x0a'),_0x553a1d[_0x4685b5(0x1a1)],_0x4685b5(0x119));}return 0x0;}catch(_0x320d67){return handleSDKError(_0x320d67,_0x553a1d),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a28_0x9865ec(0x146)]=a28_0x9865ec(0x151);[a28_0x9865ec(0x14a)]='Show\x20agent\x20details';async['execute'](_0x3903c6){const _0x48ddd1=a28_0x9865ec,{options:_0xd3fae6,args:_0x390aa5,tdx:_0x25bedb}=_0x3903c6;if(_0x390aa5[_0x48ddd1(0xde)]===0x0)return console[_0x48ddd1(0x100)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x48ddd1(0x100)]('Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>'),0x1;const _0x6766a8=_0x390aa5[0x0];try{const _0x269845=await getProjectIdOrDefault(_0x3903c6),_0x70c31b=await withSpinner(_0x48ddd1(0xeb)+_0x6766a8+_0x48ddd1(0xd4),()=>_0x25bedb[_0x48ddd1(0x16d)][_0x48ddd1(0x110)](_0x6766a8,_0x269845),{'verbose':_0xd3fae6[_0x48ddd1(0x170)]}),_0x4acb9b=await withSpinner(_0x48ddd1(0x181),()=>_0x25bedb[_0x48ddd1(0x16d)][_0x48ddd1(0x162)](_0x70c31b[_0x48ddd1(0x173)]),{'verbose':_0xd3fae6[_0x48ddd1(0x170)]});return await handleSDKOutput([_0x4acb9b[_0x48ddd1(0x173)]],_0xd3fae6),0x0;}catch(_0x344545){return handleSDKError(_0x344545,_0xd3fae6),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{['name']='llm:agent:create';[a28_0x9865ec(0x14a)]=a28_0x9865ec(0x11d);async[a28_0x9865ec(0x19c)](_0x403368){const _0x244402=a28_0x9865ec,{options:_0x4dc12c,args:_0x2043bb,tdx:_0x2031a9}=_0x403368;if(_0x2043bb[_0x244402(0xde)]===0x0)return console[_0x244402(0x100)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x244402(0x100)](_0x244402(0x167)),console[_0x244402(0x100)](_0x244402(0x109)),0x1;const _0x38d4de=_0x2043bb[0x0],_0x3a5743=_0x4dc12c,_0x344cf7=_0x3a5743[_0x244402(0x177)],_0x1cfd80=_0x3a5743[_0x244402(0x124)]||_0x244402(0x139),_0x2b518a=_0x3a5743['starterMessage'],_0xa4abce=_0x3a5743['maxToolIterations']?Number(_0x3a5743['maxToolIterations']):undefined,_0x592193=_0x3a5743[_0x244402(0x101)]?Number(_0x3a5743['temperature']):undefined;try{let _0x1ff5a4,_0x1103a6;if(_0x38d4de['includes']('/')){const _0x2e5c19=_0x38d4de[_0x244402(0x154)]('/');if(_0x2e5c19['length']===0x2){const [_0x33b981,_0x3b291d]=_0x2e5c19,_0x13d32b=await withSpinner(_0x244402(0x192)+_0x33b981+'\x27...',()=>_0x2031a9['llm']['resolveProjectId'](_0x33b981),{'verbose':_0x4dc12c[_0x244402(0x170)]});_0x1ff5a4=_0x13d32b['data'],_0x1103a6=_0x3b291d;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x244402(0x1ac)+_0x38d4de,undefined,{'helpText':_0x244402(0x168)});}else _0x1ff5a4=await getProjectIdOrDefault(_0x403368),_0x1103a6=_0x38d4de;const _0x2bc2c6=await withSpinner(_0x244402(0x194)+_0x1103a6+'\x27...',()=>_0x2031a9[_0x244402(0x16d)][_0x244402(0x1ab)]({'name':_0x1103a6,'projectId':_0x1ff5a4,'modelType':_0x1cfd80,'systemPrompt':_0x344cf7,'starterMessage':_0x2b518a,'maxToolIterations':_0xa4abce,'temperature':_0x592193}),{'verbose':_0x4dc12c[_0x244402(0x170)]});return console[_0x244402(0x11a)](_0x244402(0x19a)+_0x2bc2c6[_0x244402(0x173)]['id']),await handleSDKOutput([_0x2bc2c6[_0x244402(0x173)]],_0x4dc12c),0x0;}catch(_0x1e4858){return handleSDKError(_0x1e4858,_0x4dc12c),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{['name']='llm:agent:update';[a28_0x9865ec(0x14a)]=a28_0x9865ec(0x17c);async[a28_0x9865ec(0x19c)](_0x5532b6){const _0x25a4b8=a28_0x9865ec,{options:_0x56427,args:_0x49291c,tdx:_0xfe3422}=_0x5532b6;if(_0x49291c[_0x25a4b8(0xde)]===0x0)return console['error'](_0x25a4b8(0x122)),console[_0x25a4b8(0x100)](_0x25a4b8(0xda)),0x1;const _0x332a1e=_0x49291c[0x0],_0x5f1b3f=_0x56427,_0xe562da=_0x5f1b3f['name'],_0x3cdccc=_0x5f1b3f[_0x25a4b8(0x16b)],_0x4326c1=_0x5f1b3f[_0x25a4b8(0x14a)],_0x12ca9f=_0x5f1b3f[_0x25a4b8(0x178)];if(!_0xe562da&&!_0x3cdccc&&!_0x4326c1&&!_0x12ca9f)return console[_0x25a4b8(0x100)](_0x25a4b8(0xfd)),console['error'](_0x25a4b8(0x145)),0x1;try{const _0x175f33=await getProjectIdOrDefault(_0x5532b6),_0xd7e808=await withSpinner('Resolving\x20agent\x20\x27'+_0x332a1e+_0x25a4b8(0xd4),()=>_0xfe3422['llm'][_0x25a4b8(0x110)](_0x332a1e,_0x175f33),{'verbose':_0x56427['verbose']}),_0x5813d2=_0xd7e808[_0x25a4b8(0x173)],_0x4a432b=await withSpinner('Updating\x20agent...',()=>_0xfe3422['llm'][_0x25a4b8(0x1a4)](_0x5813d2,{'name':_0xe562da,'prompt':_0x3cdccc,'description':_0x4326c1,'starterMessage':_0x12ca9f}),{'verbose':_0x56427[_0x25a4b8(0x170)]});return console['log']('Agent\x20updated:\x20'+_0x4a432b['data']['id']),await handleSDKOutput([_0x4a432b['data']],_0x56427),0x0;}catch(_0x270526){return handleSDKError(_0x270526,_0x56427),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a28_0x9865ec(0x146)]=a28_0x9865ec(0x138);[a28_0x9865ec(0x14a)]=a28_0x9865ec(0x11c);async[a28_0x9865ec(0x19c)](_0x2395b5){const _0x31bb36=a28_0x9865ec,{options:_0x41b250,args:_0x3747e5,tdx:_0x201a98}=_0x2395b5;if(_0x3747e5[_0x31bb36(0xde)]===0x0)return console[_0x31bb36(0x100)](_0x31bb36(0x122)),console[_0x31bb36(0x100)](_0x31bb36(0x19e)),0x1;const _0x42e6b7=_0x3747e5[0x0];try{const _0x1f5530=await getProjectIdOrDefault(_0x2395b5),_0x489c08=await withSpinner(_0x31bb36(0xeb)+_0x42e6b7+_0x31bb36(0xd4),()=>_0x201a98[_0x31bb36(0x16d)]['resolveAgentId'](_0x42e6b7,_0x1f5530),{'verbose':_0x41b250[_0x31bb36(0x170)]}),_0x56d25d=_0x489c08[_0x31bb36(0x173)];return await withSpinner('Deleting\x20agent...',()=>_0x201a98[_0x31bb36(0x16d)][_0x31bb36(0xd5)](_0x56d25d),{'verbose':_0x41b250['verbose']}),console[_0x31bb36(0x11a)]('Agent\x20deleted:\x20'+_0x56d25d),0x0;}catch(_0x37fabd){return handleSDKError(_0x37fabd,_0x41b250),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a28_0x9865ec(0x146)]='llm:history';[a28_0x9865ec(0x14a)]=a28_0x9865ec(0x123);async[a28_0x9865ec(0x19c)](_0x19a221){const _0x4cd3d4=a28_0x9865ec;return executeChatHistoryCommand(_0x19a221,_0x4cd3d4(0x132));}}export class LLMUseCommand extends BaseCommand{[a28_0x9865ec(0x146)]=a28_0x9865ec(0x16a);[a28_0x9865ec(0x14a)]='Set\x20current\x20project\x20context';async['execute'](_0x2d5d50){const _0xa49b06=a28_0x9865ec,{options:_0x1ddd70,args:_0x2a6456,tdx:_0x3355c3}=_0x2d5d50;if(_0x2a6456[_0xa49b06(0xde)]===0x0)return console[_0xa49b06(0x100)](_0xa49b06(0x182)),console[_0xa49b06(0x100)](_0xa49b06(0x14e)),0x1;const _0x101f2a=_0x2a6456[0x0];try{await withSpinner(_0xa49b06(0x14f)+_0x101f2a+_0xa49b06(0xd4),()=>_0x3355c3[_0xa49b06(0x16d)][_0xa49b06(0x187)](_0x101f2a),{'verbose':_0x1ddd70[_0xa49b06(0x170)]}),saveSessionContext({'llm_project':_0x101f2a},_0x1ddd70[_0xa49b06(0xd8)]);const _0x3ae028=getChalk(_0x1ddd70);return console['log'](_0xa49b06(0x188)+_0x3ae028[_0xa49b06(0x1a0)](_0x101f2a)),0x0;}catch(_0x3d1ebe){return handleSDKError(_0x3d1ebe,_0x1ddd70),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a28_0x9865ec(0x146)]=a28_0x9865ec(0x14d);[a28_0x9865ec(0x14a)]=a28_0x9865ec(0xf7);async['execute'](_0x5babd2){const _0x36eb01=a28_0x9865ec,{options:_0x5e5fd4,args:_0x3eea8d,tdx:_0x5b16cc}=_0x5babd2;if(_0x3eea8d['length']===0x0)return console[_0x36eb01(0x100)](_0x36eb01(0x182)),console['error'](_0x36eb01(0x17a)),0x1;const _0x11ddd6=_0x3eea8d[0x0],_0x5372b7=_0x5e5fd4,_0x23d607=_0x5372b7['description'];try{const _0x192dec=await withSpinner(_0x36eb01(0x172)+_0x11ddd6+_0x36eb01(0xd4),()=>_0x5b16cc['llm']['createProject']({'name':_0x11ddd6,'description':_0x23d607}),{'verbose':_0x5e5fd4[_0x36eb01(0x170)]});console[_0x36eb01(0x11a)](_0x36eb01(0x13d)+_0x192dec[_0x36eb01(0x173)]['id']);const _0x47dace=toLLMProjectInfo(_0x192dec['data']);return await handleSDKOutput([_0x47dace],_0x5e5fd4),0x0;}catch(_0x396f83){return handleSDKError(_0x396f83,_0x5e5fd4),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a28_0x9865ec(0x146)]=a28_0x9865ec(0x10f);['description']='Delete\x20an\x20LLM\x20project';async['execute'](_0x36d8e3){const _0x2d205a=a28_0x9865ec,{options:_0x2c8c26,args:_0x2e6728,tdx:_0x113959}=_0x36d8e3;if(_0x2e6728[_0x2d205a(0xde)]===0x0)return console['error'](_0x2d205a(0x182)),console[_0x2d205a(0x100)]('Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>'),0x1;const _0x482720=_0x2e6728[0x0];try{return await withSpinner(_0x2d205a(0x10a)+_0x482720+'\x27...',()=>_0x113959[_0x2d205a(0x16d)][_0x2d205a(0x189)](_0x482720),{'verbose':_0x2c8c26[_0x2d205a(0x170)]}),console[_0x2d205a(0x11a)](_0x2d205a(0x103)+_0x482720),0x0;}catch(_0x5db571){return handleSDKError(_0x5db571,_0x2c8c26),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{['name']=a28_0x9865ec(0x14b);[a28_0x9865ec(0x14a)]=a28_0x9865ec(0x108);async[a28_0x9865ec(0x19c)](_0x577cdc){const _0x543b0e=a28_0x9865ec,{options:_0x610885,args:_0xc3f29a,tdx:_0x4aeba6}=_0x577cdc,_0x428d96=getChalk(_0x610885);console[_0x543b0e(0x11a)](_0x428d96[_0x543b0e(0x156)](_0x543b0e(0xdb))),console[_0x543b0e(0x11a)](_0x428d96['yellow']('\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.')),console[_0x543b0e(0x11a)](_0x428d96[_0x543b0e(0x171)](_0x543b0e(0x1a9))),console[_0x543b0e(0x11a)]();if(_0xc3f29a[_0x543b0e(0xde)]===0x0)return console['error'](_0x543b0e(0x182)),console['error']('Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]'),0x1;const _0x1fd879=_0xc3f29a[0x0],_0x102231=_0x610885,_0x71dcc1=_0x102231[_0x543b0e(0x1a1)],_0x9bb4fc=_0x102231['dryRun'];try{const _0x58f62e=_0x71dcc1||_0x1fd879+'.llm';if(a28_0x4cac73['existsSync'](_0x58f62e)&&!_0x9bb4fc){if(!_0x610885[_0x543b0e(0x14c)]){const _0x4307cf=await confirm(_0x543b0e(0xfe)+_0x58f62e+_0x543b0e(0x102));if(!_0x4307cf)return console[_0x543b0e(0x11a)](_0x543b0e(0xe0)),0x0;}a28_0x4cac73[_0x543b0e(0x130)](_0x58f62e,{'recursive':!![]});}const _0x3697d4=await withSpinner(_0x9bb4fc?_0x543b0e(0xd3)+_0x1fd879+_0x543b0e(0xd4):_0x543b0e(0x147)+_0x1fd879+'\x27...',()=>_0x4aeba6[_0x543b0e(0x16d)]['backupProject'](_0x1fd879,_0x71dcc1,{'dryRun':_0x9bb4fc}),{'verbose':_0x610885[_0x543b0e(0x170)]}),_0x32af74=_0x3697d4[_0x543b0e(0x173)];return _0x9bb4fc?console[_0x543b0e(0x11a)](_0x543b0e(0x1ad)+_0x32af74[_0x543b0e(0x15c)]):console[_0x543b0e(0x11a)]('Project\x20backed\x20up\x20to:\x20'+_0x32af74[_0x543b0e(0x15c)]),console['log'](_0x543b0e(0x140)+_0x32af74[_0x543b0e(0x19d)][_0x543b0e(0x157)]),console[_0x543b0e(0x11a)](_0x543b0e(0x18e)+_0x32af74['counts'][_0x543b0e(0x161)]),console[_0x543b0e(0x11a)](_0x543b0e(0x13a)+_0x32af74[_0x543b0e(0x19d)][_0x543b0e(0x174)]),console[_0x543b0e(0x11a)](_0x543b0e(0x114)+_0x32af74[_0x543b0e(0x19d)][_0x543b0e(0xe2)]),(_0x610885[_0x543b0e(0x18d)]===_0x543b0e(0x1a2)||_0x610885['format']==='jsonl')&&await handleSDKOutput([_0x32af74],_0x610885),0x0;}catch(_0x42d1bf){return handleSDKError(_0x42d1bf,_0x610885),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a28_0x9865ec(0x146)]='llm:project:restore';[a28_0x9865ec(0x14a)]=a28_0x9865ec(0x1b1);async['execute'](_0x3cd886){const _0x299bbe=a28_0x9865ec,{options:_0x464062,args:_0x3a9c84,tdx:_0x2c368b}=_0x3cd886,_0x147466=getChalk(_0x464062);console[_0x299bbe(0x11a)](_0x147466[_0x299bbe(0x156)](_0x299bbe(0x1aa))),console[_0x299bbe(0x11a)](_0x147466['yellow']('\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.')),console[_0x299bbe(0x11a)](_0x147466[_0x299bbe(0x171)](_0x299bbe(0x10c))),console[_0x299bbe(0x11a)](_0x147466[_0x299bbe(0x171)](_0x299bbe(0xd9))),console[_0x299bbe(0x11a)](_0x147466[_0x299bbe(0x171)]('\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22')),console[_0x299bbe(0x11a)]();if(_0x3a9c84[_0x299bbe(0xde)]===0x0)return console[_0x299bbe(0x100)](_0x299bbe(0x142)),console[_0x299bbe(0x100)](_0x299bbe(0xea)),0x1;const _0x2ef3bd=_0x3a9c84[0x0],_0x5f34f2=_0x464062,_0x19ebef=_0x5f34f2[_0x299bbe(0x146)],_0x46a188=_0x5f34f2[_0x299bbe(0x133)];try{if(!_0x46a188){const _0x3dcfea=_0x2c368b[_0x299bbe(0x16d)][_0x299bbe(0x158)](_0x2ef3bd),_0x1c0a78=_0x19ebef||_0x3dcfea['exportedFrom'][_0x299bbe(0x113)],_0x8fdf5a=await withSpinner(_0x299bbe(0x166),()=>_0x2c368b['llm'][_0x299bbe(0xf5)](),{'verbose':_0x464062[_0x299bbe(0x170)]}),_0x58ec10=_0x8fdf5a[_0x299bbe(0x173)][_0x299bbe(0x129)](_0x42571e=>_0x42571e[_0x299bbe(0x1a6)][_0x299bbe(0x146)]===_0x1c0a78);if(_0x58ec10&&!_0x464062[_0x299bbe(0x14c)]){const _0x7a77e9=await confirm(_0x299bbe(0x116)+_0x1c0a78+_0x299bbe(0x164));if(!_0x7a77e9)return console[_0x299bbe(0x11a)](_0x299bbe(0x183)),0x0;}}const _0x172e96=await withSpinner(_0x46a188?'Validating\x20backup\x20from\x20\x27'+_0x2ef3bd+_0x299bbe(0xd4):_0x299bbe(0xf9)+_0x2ef3bd+'\x27...',()=>_0x2c368b[_0x299bbe(0x16d)]['restoreProject'](_0x2ef3bd,{'name':_0x19ebef,'dryRun':_0x46a188}),{'verbose':_0x464062[_0x299bbe(0x170)]}),_0x51c0fb=_0x172e96['data'];return _0x51c0fb['sourceSite']&&console[_0x299bbe(0x11a)]('[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27'+_0x51c0fb[_0x299bbe(0x195)]+'\x27'),_0x46a188?console[_0x299bbe(0x11a)](_0x299bbe(0x1af)+_0x51c0fb['projectName']):console['log']('Project\x20restored:\x20'+_0x51c0fb[_0x299bbe(0x113)]+'\x20('+_0x51c0fb[_0x299bbe(0x17b)]+')'),console[_0x299bbe(0x11a)](_0x299bbe(0x140)+_0x51c0fb[_0x299bbe(0x19d)][_0x299bbe(0x157)]),console['log'](_0x299bbe(0x18e)+_0x51c0fb['counts'][_0x299bbe(0x161)]),console['log'](_0x299bbe(0x13a)+_0x51c0fb[_0x299bbe(0x19d)]['prompts']),console[_0x299bbe(0x11a)]('\x20\x20Integrations:\x20'+_0x51c0fb['counts'][_0x299bbe(0xe2)]),(_0x464062['format']===_0x299bbe(0x1a2)||_0x464062[_0x299bbe(0x18d)]===_0x299bbe(0x179))&&await handleSDKOutput([_0x51c0fb],_0x464062),0x0;}catch(_0x322bdb){return handleSDKError(_0x322bdb,_0x464062),0x1;}}}function a28_0x455a(_0x48061b,_0x27f25f){_0x48061b=_0x48061b-0xd1;const _0x9874b4=a28_0x9874();let _0x455adf=_0x9874b4[_0x48061b];return _0x455adf;}function a28_0x9874(){const _0x41e848=['log','m\x20ago','Delete\x20an\x20agent','Create\x20a\x20new\x20agent\x20in\x20current\x20project','Fetching\x20most\x20recent\x20chat...','Select\x20a\x20chat\x20session:','__load_more__','...','Error:\x20Agent\x20name\x20is\x20required','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','model','\x0aStack\x20trace:','stringify','904mqwVRa','just\x20now','find','sort','llm:projects','341214FsOuWx','Fetching\x20chat\x20sessions...','all','slice','rmSync','11DtSLUl','tdx\x20llm\x20history','dryRun','No\x20projects\x20found','Error:\x20','floor','[output]\x20','llm:agent:delete','claude-4.5-haiku','\x20\x20Prompts:\x20','localeCompare','[content]','Project\x20created:\x20','blue','Fetching\x20projects...','\x20\x20Agents:\x20','substring','Error:\x20Backup\x20folder\x20path\x20is\x20required','default','short','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','name','Backing\x20up\x20project\x20\x27','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','\x20project(s)','description','llm:project:backup','yes','llm:project:create','Usage:\x20tdx\x20llm\x20use\x20<project-name>','Setting\x20project\x20context\x20to\x20\x27','d\x20ago','llm:agent:show','\x20\x20Cause:\x20','limit','split','2545LKUedF','yellow','agents','getBackupMetadata','tool','1909ZyLGRt','🤖\x20','outputDir','[error]\x20\x20','getCurrentProject','[input]\x20\x20','targetKnowledgeBase','knowledgeBases','agent','targetAgent','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','models','Checking\x20for\x20existing\x20projects...','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','Use\x20format:\x20project-name/agent-name','tsv','llm:use','prompt','content','llm','[tool]\x20\x20\x20','get','verbose','dim','Creating\x20project\x20\x27','data','prompts','createdAt','h\x20ago','systemPrompt','starterMessage','jsonl','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','projectId','Update\x20an\x20existing\x20agent','bold','1763358rZvvqB','[tool_call]','⚒️\x20','Fetching\x20agent...','Error:\x20Project\x20name\x20is\x20required','Restore\x20cancelled.','llm:agents','9Behrhh','314SxCidb','setCurrentProject','Session\x20llm_project\x20set\x20to:\x20','deleteProject','llmProject','Fetching\x20chat\x20log\x20for\x20\x27','magenta','format','\x20\x20Knowledge\x20Bases:\x20','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','targetImageGenerator','push','Resolving\x20project\x20\x27','image','Creating\x20agent\x20\x27','sourceSite','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','stack','\x20->\x20Agent:','en-US','Agent\x20created:\x20','\x20->\x20ImageGen:','execute','counts','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','join','green','output','json','\x20->\x20WebSearch:','updateAgent','Error:\x20chat-id\x20is\x20required','attributes','\x20-\x20','map','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.','createAgent','Invalid\x20path\x20syntax:\x20','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','agentId','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','cyan','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)','7hPxkWQ','red','Analyzing\x20project\x20\x27','\x27...','deleteAgent','Load\x20more...','chatId','session','\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.','last','Show\x20chat\x20log','length','toLowerCase','Backup\x20cancelled.','llm:models','integrations','input','Fetching\x20chat\x20history\x20for\x20\x27','chats','Usage:\x20TDX_EXPERIMENTAL=true\x20tdx\x20llm\x20log\x20<chat-id>','No\x20chat\x20sessions\x20found.','set','firstInputContent','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','Resolving\x20agent\x20\x27','keys','site','message','(no\x20message)','2258352rRFJzm','9064020qaqCwp','numeric','targetWebSearchTool','[image]\x20\x20','projects','\x20->\x20KB:','Create\x20a\x20new\x20LLM\x20project','updatedAt','Restoring\x20project\x20from\x20\x27','(no\x20agent)','cause','resolveProjectId','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','Output\x20directory\x20\x27','INVALID_ARGUMENT','error','temperature','\x27\x20already\x20exists.\x20Overwrite?','Project\x20deleted:\x20','history','[unknown]','\x20agent(s)','select','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','Deleting\x20project\x20\x27','No\x20messages\x20found\x20in\x20chat\x20history.','\x20\x20\x20Examples:','494920bRQgJV','includes','llm:project:delete','resolveAgentId','List\x20agents\x20in\x20current\x20project','toLocaleDateString','projectName','\x20\x20Integrations:\x20','No\x20agents\x20found','A\x20project\x20named\x20\x27','filter','tool_call','table'];a28_0x9874=function(){return _0x41e848;};return a28_0x9874();}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x26494f,_0x339e75){const _0x1bf52d=a28_0x9865ec,_0x1c6567=_0x339e75[_0x1bf52d(0x153)]||CHAT_SELECTOR_PAGE_SIZE;let _0x50b6ad=0x0,_0x433114=[];const _0x279009=(await import('prompts'))[_0x1bf52d(0x143)],_0x212b14=getChalk(_0x339e75);while(!![]){const _0x3fba68=await withSpinner(_0x1bf52d(0x12d),()=>_0x26494f[_0x1bf52d(0x16d)][_0x1bf52d(0xe5)](_0x1c6567+_0x50b6ad),{'verbose':_0x339e75[_0x1bf52d(0x170)]});_0x433114=_0x3fba68[_0x1bf52d(0x173)];const _0x37cad1=_0x433114[_0x1bf52d(0x12f)](_0x50b6ad,_0x50b6ad+_0x1c6567),_0x496aed=_0x433114[_0x1bf52d(0xde)]>_0x50b6ad+_0x1c6567,_0x5480e8=[...new Set(_0x37cad1['map'](_0x35d4c1=>_0x35d4c1[_0x1bf52d(0x1a6)][_0x1bf52d(0x1ae)])[_0x1bf52d(0x117)](_0x75bfb0=>_0x75bfb0!==undefined))],_0x541332=new Map();await Promise[_0x1bf52d(0x12e)](_0x5480e8[_0x1bf52d(0x1a8)](async _0x42e3ca=>{const _0x3a540f=_0x1bf52d;try{const _0x534989=await _0x26494f[_0x3a540f(0x16d)]['agent'](_0x42e3ca);_0x541332[_0x3a540f(0xe8)](_0x42e3ca,_0x534989['attributes'][_0x3a540f(0x146)]);}catch{_0x541332[_0x3a540f(0xe8)](_0x42e3ca,_0x42e3ca);}}));const _0x412179=_0x37cad1['map'](_0x8df9ae=>{const _0x3111b0=_0x1bf52d,_0xdd576c=_0x8df9ae['attributes'][_0x3111b0(0xe9)]||_0x3111b0(0xef),_0x4a8a3=_0xdd576c[_0x3111b0(0x154)]('\x0a')[0x0],_0x5d8b00=_0x4a8a3[_0x3111b0(0xde)]>0x50?_0x4a8a3[_0x3111b0(0x141)](0x0,0x4d)+_0x3111b0(0x121):_0x4a8a3,_0x21329e=_0x8df9ae[_0x3111b0(0x1a6)][_0x3111b0(0x1ae)]?_0x541332[_0x3111b0(0x16f)](_0x8df9ae['attributes'][_0x3111b0(0x1ae)])||_0x8df9ae['attributes'][_0x3111b0(0x1ae)]:_0x3111b0(0xfa),_0x1cc6f4=_0x8df9ae['attributes']['lastConversationAt']||_0x8df9ae[_0x3111b0(0x1a6)][_0x3111b0(0xf8)],_0x2fa58a=new Date(_0x1cc6f4),_0x5b6a0a=new Date(),_0x262303=_0x5b6a0a['getTime']()-_0x2fa58a['getTime'](),_0x50be16=Math[_0x3111b0(0x136)](_0x262303/0xea60),_0x174c61=Math[_0x3111b0(0x136)](_0x262303/0x36ee80),_0x243dad=Math[_0x3111b0(0x136)](_0x262303/0x5265c00);let _0x350dc9;if(_0x50be16<0x1)_0x350dc9=_0x3111b0(0x128);else{if(_0x50be16<0x3c)_0x350dc9=_0x50be16+_0x3111b0(0x11b);else{if(_0x174c61<0x18)_0x350dc9=_0x174c61+_0x3111b0(0x176);else _0x243dad<0x7?_0x350dc9=_0x243dad+_0x3111b0(0x150):_0x350dc9=_0x2fa58a[_0x3111b0(0x112)](_0x3111b0(0x199),{'month':_0x3111b0(0x144),'day':_0x3111b0(0xf2)});}}return{'title':_0x5d8b00+'\x20'+_0x212b14[_0x3111b0(0x171)]('['+_0x21329e+']\x20'+_0x350dc9),'value':_0x8df9ae['id']};});_0x496aed&&_0x412179['push']({'title':_0x212b14[_0x1bf52d(0x1b0)](_0x1bf52d(0xd6)),'value':_0x1bf52d(0x120)});const _0x3029f0=await _0x279009({'type':_0x1bf52d(0x107),'name':_0x1bf52d(0xd7),'message':_0x1bf52d(0x11f),'choices':_0x412179,'hint':'Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel'});if(!_0x3029f0[_0x1bf52d(0xd7)])return undefined;if(_0x3029f0['chatId']==='__load_more__'){_0x50b6ad+=_0x1c6567;continue;}return _0x3029f0['chatId'];}}export class ChatsCommand extends BaseCommand{[a28_0x9865ec(0x146)]=a28_0x9865ec(0xe5);[a28_0x9865ec(0x14a)]=a28_0x9865ec(0x148);async[a28_0x9865ec(0x19c)](_0x40ec9e){return executeChatHistoryCommand(_0x40ec9e,'tdx\x20chats');}}export class LLMLogCommand extends BaseCommand{[a28_0x9865ec(0x146)]='llm:log';[a28_0x9865ec(0x14a)]=a28_0x9865ec(0xdd);async[a28_0x9865ec(0x19c)](_0x21b260){const _0x49e9e0=a28_0x9865ec,{options:_0x5afb0a,args:_0x3a7c06,tdx:_0x3bb11f}=_0x21b260,_0x1a2bba=_0x3a7c06[0x0];if(!_0x1a2bba)return console[_0x49e9e0(0x100)](_0x49e9e0(0x1a5)),console[_0x49e9e0(0x100)](_0x49e9e0(0xe6)),0x1;const _0x53dbce=await withSpinner(_0x49e9e0(0x18b)+_0x1a2bba+'\x27...',()=>_0x3bb11f[_0x49e9e0(0x16d)]['getChatLog'](_0x1a2bba),{'verbose':_0x5afb0a[_0x49e9e0(0x170)]});return await handleSDKOutput(_0x53dbce['data'][_0x49e9e0(0x173)],_0x5afb0a),0x0;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a29_0x90fb(_0x493e7c,_0x527f38){_0x493e7c=_0x493e7c-0xb5;const _0x5551d7=a29_0x5551();let _0x90fb04=_0x5551d7[_0x493e7c];return _0x90fb04;}const a29_0x948719=a29_0x90fb;(function(_0x47db7d,_0x5d8ce6){const _0x526ddc=a29_0x90fb,_0x357654=_0x47db7d();while(!![]){try{const _0x5df913=-parseInt(_0x526ddc(0xc2))/0x1*(-parseInt(_0x526ddc(0xce))/0x2)+parseInt(_0x526ddc(0xcb))/0x3*(-parseInt(_0x526ddc(0xba))/0x4)+-parseInt(_0x526ddc(0xcc))/0x5*(parseInt(_0x526ddc(0xcd))/0x6)+parseInt(_0x526ddc(0xc0))/0x7*(-parseInt(_0x526ddc(0xc4))/0x8)+parseInt(_0x526ddc(0xb7))/0x9+-parseInt(_0x526ddc(0xbe))/0xa*(-parseInt(_0x526ddc(0xc1))/0xb)+-parseInt(_0x526ddc(0xb5))/0xc;if(_0x5df913===_0x5d8ce6)break;else _0x357654['push'](_0x357654['shift']());}catch(_0x53b4c7){_0x357654['push'](_0x357654['shift']());}}}(a29_0x5551,0x548e8));import{BaseCommand}from'./command.js';export class MCPCommand extends BaseCommand{[a29_0x948719(0xca)]=a29_0x948719(0xc5);[a29_0x948719(0xb9)]=a29_0x948719(0xc9);async[a29_0x948719(0xbf)](_0x28688c){const _0x428438=a29_0x948719,{tdx:_0x53538f}=_0x28688c,_0x4450e7={};if(process.env.TDX_PROFILE)_0x4450e7[_0x428438(0xcf)]=process.env.TDX_PROFILE;else{if(process.env.TDX_API_KEY)_0x4450e7['TDX_API_KEY']=process.env.TDX_API_KEY,process.env.TDX_SITE&&(_0x4450e7['TDX_SITE']=process.env.TDX_SITE);else{if(_0x53538f[_0x428438(0xb6)][_0x428438(0xc6)])_0x4450e7[_0x428438(0xd0)]=_0x53538f[_0x428438(0xb6)]['accessToken'],_0x4450e7[_0x428438(0xd1)]=_0x53538f[_0x428438(0xb6)][_0x428438(0xbc)];else _0x53538f[_0x428438(0xb6)]['apiKey']&&(_0x4450e7[_0x428438(0xc8)]=_0x53538f[_0x428438(0xb6)][_0x428438(0xbb)],_0x4450e7[_0x428438(0xd1)]=_0x53538f[_0x428438(0xb6)][_0x428438(0xbc)]);}}_0x53538f['context'][_0x428438(0xb8)]&&(_0x4450e7[_0x428438(0xcf)]=_0x53538f[_0x428438(0xb6)][_0x428438(0xb8)]);try{const {startMCPServer:_0x1bddcf}=await import(_0x428438(0xc3));return await _0x1bddcf({'env':_0x4450e7}),0x0;}catch(_0x585361){const _0x2405e5=_0x585361 instanceof Error?_0x585361[_0x428438(0xc7)]:String(_0x585361);return console['error'](_0x428438(0xbd)+_0x2405e5),0x1;}}}function a29_0x5551(){const _0x972dd5=['1926QCUjWZ','TDX_PROFILE','TDX_ACCESS_TOKEN','TDX_SITE','4029396wMLwcB','context','6073299nEiOxj','profile','description','8KcRVFv','apiKey','site','MCP\x20server\x20error:\x20','3890LYiOgR','execute','98AirpXK','6127ZcrTlf','559nnBvQw','../mcp/server.js','338512PHNbXN','mcp','accessToken','message','TDX_API_KEY','Start\x20MCP\x20server\x20for\x20AI\x20tool\x20integration','name','45876VrmbMn','5ZSkeef','748164SWtfcQ'];a29_0x5551=function(){return _0x972dd5;};return a29_0x5551();}
|