@treasuredata/tdx 0.16.1 → 0.16.3

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.
Files changed (162) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/describe.js +1 -1
  18. package/dist/commands/engage-command.js +1 -1
  19. package/dist/commands/job-command.js +1 -1
  20. package/dist/commands/journey-command.js +1 -1
  21. package/dist/commands/journey-validate-command.js +1 -1
  22. package/dist/commands/llm-command.js +1 -1
  23. package/dist/commands/llm-proxy.js +1 -1
  24. package/dist/commands/mcp-command.js +1 -1
  25. package/dist/commands/parent-segment-command.js +1 -1
  26. package/dist/commands/profile-command.js +1 -1
  27. package/dist/commands/profiles-command.js +1 -1
  28. package/dist/commands/query-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-update-command.js +1 -1
  35. package/dist/commands/segment-use-command.js +1 -1
  36. package/dist/commands/segment-validate-command.js +1 -1
  37. package/dist/commands/segments.js +1 -1
  38. package/dist/commands/show.js +1 -1
  39. package/dist/commands/tables.js +1 -1
  40. package/dist/commands/unset-command.js +1 -1
  41. package/dist/commands/use-command.js +1 -1
  42. package/dist/commands/user-command.js +1 -1
  43. package/dist/commands/workflow-command.js +1 -1
  44. package/dist/core/auth.js +1 -1
  45. package/dist/core/command-output.js +1 -1
  46. package/dist/core/config.js +1 -1
  47. package/dist/core/connection-cache.js +1 -1
  48. package/dist/core/constants.js +1 -1
  49. package/dist/core/credential-cache.js +1 -1
  50. package/dist/core/global-context.js +1 -1
  51. package/dist/core/keychain.js +1 -1
  52. package/dist/core/profile.js +1 -1
  53. package/dist/core/project-config.js +1 -1
  54. package/dist/core/session.js +1 -1
  55. package/dist/core/user-cache.js +1 -1
  56. package/dist/core/version.js +1 -1
  57. package/dist/index.js +1 -1
  58. package/dist/mcp/server.js +1 -1
  59. package/dist/mcp/tools/index.js +1 -1
  60. package/dist/mcp/tools/tdx-run.js +1 -1
  61. package/dist/mcp/tools/tdx-search.js +1 -1
  62. package/dist/mcp/utils.js +1 -1
  63. package/dist/proxy/anthropic-adapter.js +1 -1
  64. package/dist/proxy/claude-usage-tracker.js +1 -1
  65. package/dist/proxy/context-signature.js +1 -1
  66. package/dist/proxy/conversation-utils.js +1 -1
  67. package/dist/proxy/passthrough-server.js +1 -1
  68. package/dist/proxy/server.js +1 -1
  69. package/dist/proxy/session-cache.js +1 -1
  70. package/dist/proxy/sse-usage-parser.js +1 -1
  71. package/dist/sdk/agent/agent-config.js +1 -1
  72. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  73. package/dist/sdk/agent/agent-yaml.js +1 -1
  74. package/dist/sdk/agent/test/evaluator.js +1 -1
  75. package/dist/sdk/agent/test/executor.js +1 -1
  76. package/dist/sdk/agent/test/index.js +1 -1
  77. package/dist/sdk/agent/test/output.js +1 -1
  78. package/dist/sdk/agent/test/parser.js +1 -1
  79. package/dist/sdk/api.js +1 -1
  80. package/dist/sdk/claude-agent/claude-agent-client.d.ts +19 -1
  81. package/dist/sdk/claude-agent/claude-agent-client.d.ts.map +1 -1
  82. package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
  83. package/dist/sdk/claude-agent/claude-agent-client.js.map +1 -1
  84. package/dist/sdk/claude-agent/environment.d.ts +9 -0
  85. package/dist/sdk/claude-agent/environment.d.ts.map +1 -1
  86. package/dist/sdk/claude-agent/environment.js +1 -1
  87. package/dist/sdk/claude-agent/environment.js.map +1 -1
  88. package/dist/sdk/claude-agent/index.js +1 -1
  89. package/dist/sdk/claude-agent/system-prompts.js +1 -1
  90. package/dist/sdk/claude-agent/types.d.ts +26 -0
  91. package/dist/sdk/claude-agent/types.d.ts.map +1 -1
  92. package/dist/sdk/client/cdp-api-client.js +1 -1
  93. package/dist/sdk/client/endpoints.js +1 -1
  94. package/dist/sdk/client/engage-api-client.js +1 -1
  95. package/dist/sdk/client/http-client.js +1 -1
  96. package/dist/sdk/client/llm-api-client.js +1 -1
  97. package/dist/sdk/client/rate-limiter.js +1 -1
  98. package/dist/sdk/client/td-api-client.js +1 -1
  99. package/dist/sdk/client/trino-api-client.js +1 -1
  100. package/dist/sdk/client/workflow-client.js +1 -1
  101. package/dist/sdk/connection-validator.js +1 -1
  102. package/dist/sdk/connection.js +1 -1
  103. package/dist/sdk/engage.js +1 -1
  104. package/dist/sdk/errors.js +1 -1
  105. package/dist/sdk/index.js +1 -1
  106. package/dist/sdk/io/index.js +1 -1
  107. package/dist/sdk/io/node-filesystem.js +1 -1
  108. package/dist/sdk/job.js +1 -1
  109. package/dist/sdk/journey.js +1 -1
  110. package/dist/sdk/llm/chat-cache.js +1 -1
  111. package/dist/sdk/llm/index.js +1 -1
  112. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  113. package/dist/sdk/llm/model-aliases.js +1 -1
  114. package/dist/sdk/llm/model-factors.js +1 -1
  115. package/dist/sdk/query/index.js +1 -1
  116. package/dist/sdk/query/sql-parser.js +1 -1
  117. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  118. package/dist/sdk/segment/fields-display.js +1 -1
  119. package/dist/sdk/segment/file-discovery.js +1 -1
  120. package/dist/sdk/segment/journey-utils.js +1 -1
  121. package/dist/sdk/segment/journey-yaml.js +1 -1
  122. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  123. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  124. package/dist/sdk/segment/pull-workflow.js +1 -1
  125. package/dist/sdk/segment/push-workflow.js +1 -1
  126. package/dist/sdk/segment/resolution-context.js +1 -1
  127. package/dist/sdk/segment/segment-path-parser.js +1 -1
  128. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  129. package/dist/sdk/segment/target-resolution.js +1 -1
  130. package/dist/sdk/segment/tdx-config.js +1 -1
  131. package/dist/sdk/segment/validate-files.js +1 -1
  132. package/dist/sdk/segment/yaml-validator.js +1 -1
  133. package/dist/sdk/segment.js +1 -1
  134. package/dist/sdk/types/index.js +1 -1
  135. package/dist/sdk/types/progress.js +1 -1
  136. package/dist/sdk/user.js +1 -1
  137. package/dist/sdk/util/format-detector.js +1 -1
  138. package/dist/sdk/util/formatters.js +1 -1
  139. package/dist/sdk/util/index.js +1 -1
  140. package/dist/sdk/util/tree-formatter.js +1 -1
  141. package/dist/sdk/workflow/clone-workflow.js +1 -1
  142. package/dist/sdk/workflow/index.js +1 -1
  143. package/dist/sdk/workflow/pull-workflow.js +1 -1
  144. package/dist/sdk/workflow/push-workflow.js +1 -1
  145. package/dist/sdk/workflow/tdx-config.js +1 -1
  146. package/dist/sdk/workflow/workflow-utils.js +1 -1
  147. package/dist/utils/async.js +1 -1
  148. package/dist/utils/colors.js +1 -1
  149. package/dist/utils/diff.js +1 -1
  150. package/dist/utils/file-permissions.js +1 -1
  151. package/dist/utils/json-loader.js +1 -1
  152. package/dist/utils/option-validation.js +1 -1
  153. package/dist/utils/port.js +1 -1
  154. package/dist/utils/process.js +1 -1
  155. package/dist/utils/prompt.js +1 -1
  156. package/dist/utils/spinner.js +1 -1
  157. package/dist/utils/sse-parser.js +1 -1
  158. package/dist/utils/string-utils.js +1 -1
  159. package/dist/utils/table-ref-parser.js +1 -1
  160. package/dist/utils/tdx-logger.js +1 -1
  161. package/dist/utils/version-check.js +1 -1
  162. package/package.json +1 -1
@@ -1 +1 @@
1
- const a18_0x258d28=a18_0x3261;(function(_0x38b350,_0x5889c6){const _0x5d55ef=a18_0x3261,_0x52e76d=_0x38b350();while(!![]){try{const _0x3bf5db=parseInt(_0x5d55ef(0x1e7))/0x1*(parseInt(_0x5d55ef(0x1d5))/0x2)+-parseInt(_0x5d55ef(0x1b0))/0x3+-parseInt(_0x5d55ef(0x1b2))/0x4*(parseInt(_0x5d55ef(0x1ea))/0x5)+parseInt(_0x5d55ef(0x20d))/0x6*(-parseInt(_0x5d55ef(0x1be))/0x7)+parseInt(_0x5d55ef(0x215))/0x8+-parseInt(_0x5d55ef(0x242))/0x9*(parseInt(_0x5d55ef(0x275))/0xa)+parseInt(_0x5d55ef(0x24a))/0xb;if(_0x3bf5db===_0x5889c6)break;else _0x52e76d['push'](_0x52e76d['shift']());}catch(_0x375c4d){_0x52e76d['push'](_0x52e76d['shift']());}}}(a18_0x2715,0xa7209));import a18_0x577901 from'chalk';import a18_0x1dbfac from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';function a18_0x2715(){const _0x34e0a2=['error','entries','dim','audienceId','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','cyan','\x20journey','kind','log','filePath','buildIdToEmailMap','Journey\x20name:\x20','\x20\x20Parent\x20segment:\x20','Target\x20directory:\x20','\x20unchanged\x20files','Pausing\x20journey...','file','88467dszHuB','Resuming\x20journey...','folderId','1285EzHtVV','then','utf-8','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','Options:','Error:\x20Journey\x20not\x20found:\x20','toLowerCase','Cancelled','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','isNew','folderPath','\x20\x20Folder\x20path:\x20','folders','parent_segment','\x20journey\x20files\x20to\x20','rootFolderId','red','verbose','(completed)','table','has','segmentPushCommand','hasChanges','yellow','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','Listing\x20folders...','entered','Parent\x20segment:\x20','\x20Opening\x20','Listing\x20journeys...','Write\x20','\x20files?','repeat','message','resolveJourneyId','109518VmSolq','setPhase','✔\x20Found\x20','Warning:\x20Could\x20not\x20resolve\x20segment\x20','segmentName','No\x20statistics\x20available\x20for\x20journey:\x20','\x20\x20Preserving\x20local\x20segment\x20name:\x20','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','1585624lRibDv','stringify','relativePath','/j/da','\x20=\x20','Resolving\x20parent\x20segment...','journeyStages','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','set','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','targetDir','journeyBundleId','getJourney','type','user','yes','reentryMode','getStatistics','Resolved\x20YAML\x20file:\x20','journeyId','root\x20folder','format','Show\x20journey\x20details','\x0aChanges\x20to\x20\x27','absolutePath','name','dryRun','\x27\x20not\x20found\x20in\x20','getParentFull','📁\x20','\x20\x20Target:\x20','listFolders','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','execute','\x5c$&','journey:pause','Fetching\x20parent\x20segment...','state','attributes','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','rule','relative','Folder\x20path:\x20','resolveParentId','push','2807514WdjOLh','/e/','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','green','cwd','Input:\x20','listJourneysWithFolders','journey:resume','26219798bkAySg','(draft)','(root)','length','journeyBundleName','...','split','totalGoalAchieved','\x20->\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','site','\x22\x20resumed','parentName','\x22\x20not\x20found','listJourneysFromParentSegment','Warning:\x20Stage\x20\x22','size','journey:list','data','completed','\x20\x20Statistics\x20not\x20available','\x22\x20paused','Getting\x20journey\x20statistics...','/app/ps/','replace','journeys','Fetching\x20connections\x20for\x20name\x20resolution...','Resolving\x20journey...','exited','stage','get','Found\x20','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','paused','goal','List\x20journeys\x20in\x20current\x20context','join','versionNumber','INVALID_ARGUMENT','✔\x20Context\x20set:\x20','stageName','(paused)','/j/da/je','40CRQzME','segment','stages','Error:\x20Parent\x20segment\x20context\x20required','population','find','activationParams','journey','filter','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','base','localeCompare','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','Error:\x20','all','resume','journeyName','.yml','Usage:\x20journey\x20resume\x20<name-or-path>','Usage:\x20journey\x20stats\x20<name-or-path>','(archived)','2173602TmWAOa','Usage:\x20journey\x20pause\x20<name-or-path>','3620iStaXv','Fetching\x20','journey:pull','map','sort','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','✔\x20Journey\x20\x22','session','journey:stats','conversionRate','journey:push','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','357WsuBNi','web','\x20(ID:\x20','Warning:\x20Could\x20not\x20resolve\x20activation\x20','Pattern:\x20','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','blue','description','errorCode','connection','values','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','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)','add','args','launched','activation_','\x20(rule\x20match)','resolveSegment','\x20\x20-\x20','Target\x20file:\x20','Resume\x20a\x20paused\x20journey','parentSegment','28cSAOSL'];a18_0x2715=function(){return _0x34e0a2;};return a18_0x2715();}import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey}from'../utils/prompt.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../utils/diff.js';function a18_0x3261(_0x5bc662,_0x14cba7){_0x5bc662=_0x5bc662-0x1b0;const _0x271590=a18_0x2715();let _0x3261b1=_0x271590[_0x5bc662];return _0x3261b1;}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{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 formatJourneyState(_0x4b3a39){const _0x385ca6=a18_0x3261;switch(_0x4b3a39){case _0x385ca6(0x1cd):return a18_0x577901[_0x385ca6(0x245)]('(running)');case'draft':return a18_0x577901['dim'](_0x385ca6(0x24b));case _0x385ca6(0x26b):return a18_0x577901[_0x385ca6(0x201)](_0x385ca6(0x273));case _0x385ca6(0x25d):return a18_0x577901[_0x385ca6(0x1c4)](_0x385ca6(0x1fc));case'archived':return a18_0x577901[_0x385ca6(0x1d8)](_0x385ca6(0x289));default:return'('+_0x4b3a39+')';}}function formatJourneyItem(_0x405909,_0x236839='',_0x13a94b){const _0x14ac5a=a18_0x3261,_0x5da3b7=formatJourneyState(_0x405909[_0x14ac5a(0x23a)]),_0x5a8d97=_0x13a94b?hyperlink(_0x405909[_0x14ac5a(0x24e)],_0x13a94b):_0x405909['journeyBundleName'];return _0x236839+'🗺️\x20'+_0x5a8d97+'\x20'+_0x5da3b7;}function escapeRegex(_0x1d18a5){const _0x1918bc=a18_0x3261;return _0x1d18a5[_0x1918bc(0x262)](/[.*+?^${}()|[\]\\]/g,_0x1918bc(0x237));}function globToRegex(_0x318b86){const _0x37f98e=a18_0x3261,_0x4bfb52=_0x318b86[_0x37f98e(0x250)]('*')['map'](escapeRegex);return new RegExp(_0x4bfb52['join']('.*'),'i');}function buildRuleToNameMapping(_0x239c21){const _0x476433=a18_0x3261,_0x22e3df=new Map();if(_0x239c21['segments'])for(const [_0x3b1386,_0x2b6bdf]of Object[_0x476433(0x1d7)](_0x239c21['segments'])){if(_0x2b6bdf['rule']){const _0x73d42a=serializeRule(_0x2b6bdf[_0x476433(0x23d)]),_0x412875=_0x22e3df['get'](_0x73d42a);_0x412875?_0x412875[_0x476433(0x241)](_0x3b1386):_0x22e3df[_0x476433(0x21d)](_0x73d42a,[_0x3b1386]);}}return _0x22e3df;}async function resolveJourneyTarget(_0x367aab,_0x1703a0,_0x17ef95){const _0x2c721d=a18_0x3261;if(isYamlFilePath(_0x367aab))try{const _0x44de79=await resolveYamlFilePath(_0x367aab);return _0x17ef95&&(console[_0x2c721d(0x1d6)](_0x2c721d(0x227)+_0x367aab),console['error'](_0x2c721d(0x1e2)+_0x44de79[_0x2c721d(0x1d4)]),console[_0x2c721d(0x1d6)]('\x20\x20Name:\x20'+_0x44de79[_0x2c721d(0x211)]),console[_0x2c721d(0x1d6)](_0x2c721d(0x1f5)+(_0x44de79[_0x2c721d(0x1f4)]||_0x2c721d(0x24c)))),{'journeyName':_0x44de79[_0x2c721d(0x211)],'parentSegment':_0x44de79[_0x2c721d(0x1d4)],'resolved':_0x44de79};}catch(_0x39f8c7){throw new SDKError(ErrorCode[_0x2c721d(0x270)],_0x2c721d(0x244)+_0x39f8c7[_0x2c721d(0x20b)]);}if(!_0x1703a0)throw new SDKError(ErrorCode[_0x2c721d(0x270)],'No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22');return{'journeyName':_0x367aab,'parentSegment':_0x1703a0};}export class JourneyListCommand extends BaseCommand{[a18_0x258d28(0x22e)]=a18_0x258d28(0x25b);[a18_0x258d28(0x1c5)]=a18_0x258d28(0x26d);async['execute'](_0xd5945b){const _0x1622c8=a18_0x258d28,{options:_0x485aba,args:_0x52d0cd,tdx:_0x183acf}=_0xd5945b,_0x9a0ac7=_0x52d0cd[0x0],_0x46e7ad=_0x485aba['parentSegment'];if(!_0x46e7ad)return console['error'](_0x1622c8(0x278)),console[_0x1622c8(0x1d6)](_0x1622c8(0x281)),0x1;const _0x433e09=await withSpinner(_0x1622c8(0x21a),()=>_0x183acf[_0x1622c8(0x276)]['resolveParentId'](_0x46e7ad),{'verbose':_0x485aba['verbose']}),_0x663b06=_0x433e09[_0x1622c8(0x25c)];_0x485aba[_0x1622c8(0x1fb)]&&(console[_0x1622c8(0x1d6)](_0x1622c8(0x205)+_0x46e7ad+_0x1622c8(0x1c0)+_0x663b06+')'),_0x9a0ac7&&console[_0x1622c8(0x1d6)](_0x1622c8(0x1c2)+_0x9a0ac7));const _0x2d4c8f=await withSpinner(_0x1622c8(0x239),()=>_0x183acf[_0x1622c8(0x276)][_0x1622c8(0x231)](_0x663b06),{'verbose':_0x485aba[_0x1622c8(0x1fb)]}),_0x598444=_0x2d4c8f[_0x1622c8(0x25c)],_0x2d7adb=_0x598444[_0x1622c8(0x1f9)],_0x4f4d62=await withSpinner(_0x1622c8(0x207),()=>_0x183acf[_0x1622c8(0x27c)][_0x1622c8(0x248)](_0x663b06,_0x2d7adb),{'verbose':_0x485aba[_0x1622c8(0x1fb)]});let _0x4066dd=_0x4f4d62['data'][_0x1622c8(0x263)];const _0x2fcb87=_0x4f4d62[_0x1622c8(0x25c)][_0x1622c8(0x1f6)],_0x13037b=new Map();for(const _0x551965 of _0x2fcb87){_0x13037b[_0x1622c8(0x21d)](_0x551965['id'],_0x551965['name']);}if(_0x9a0ac7){const _0x4a21b2=globToRegex(_0x9a0ac7);_0x4066dd=_0x4066dd[_0x1622c8(0x27d)](_0x40c999=>_0x4a21b2['test'](_0x40c999[_0x1622c8(0x24e)]));}console['error'](_0x1622c8(0x20f)+_0x4066dd[_0x1622c8(0x24d)]+_0x1622c8(0x1dc)+(_0x4066dd[_0x1622c8(0x24d)]!==0x1?'s':''));const _0xcad308=_0x54e597=>{const _0x231d3b=_0x1622c8;return getConsoleNextUrl(_0x485aba['site'],_0x231d3b(0x261)+_0x663b06+_0x231d3b(0x243)+_0x54e597+_0x231d3b(0x218));};if(_0x485aba['format']===_0x1622c8(0x1fd))await handleSDKOutput(_0x4066dd,_0x485aba);else{if(_0x485aba[_0x1622c8(0x22a)]==='json'){const _0x19dfb9=_0x4066dd[_0x1622c8(0x1b5)](_0x1dac0d=>({..._0x1dac0d,'url':_0xcad308(_0x1dac0d['id'])}));await handleSDKOutput(_0x19dfb9,_0x485aba);}else{console[_0x1622c8(0x1de)]('['+_0x46e7ad+']');const _0x4a8864=new Map(),_0xc13529=[];for(const _0x1551ac of _0x4066dd){if(!_0x1551ac[_0x1622c8(0x1e9)]||_0x1551ac[_0x1622c8(0x1e9)]===_0x2d7adb)_0xc13529[_0x1622c8(0x241)](_0x1551ac);else{const _0x4472e7=_0x4a8864[_0x1622c8(0x268)](_0x1551ac[_0x1622c8(0x1e9)])||[];_0x4472e7[_0x1622c8(0x241)](_0x1551ac),_0x4a8864['set'](_0x1551ac['folderId'],_0x4472e7);}}const _0x1bf9cb=(_0x463181,_0x32cf8b)=>_0x463181[_0x1622c8(0x24e)][_0x1622c8(0x280)](_0x32cf8b[_0x1622c8(0x24e)],undefined,{'sensitivity':_0x1622c8(0x27f)});_0xc13529[_0x1622c8(0x1b6)](_0x1bf9cb);for(const _0x41deaf of _0xc13529){console['log'](formatJourneyItem(_0x41deaf,'',_0xcad308(_0x41deaf['id'])));}const _0x1aecbd=[..._0x4a8864[_0x1622c8(0x1d7)]()]['sort']((_0x4c1ce2,_0x812484)=>{const _0x1cc3e3=_0x1622c8,_0x42fab1=_0x13037b['get'](_0x4c1ce2[0x0])||_0x4c1ce2[0x0],_0x3883e1=_0x13037b['get'](_0x812484[0x0])||_0x812484[0x0];return _0x42fab1['localeCompare'](_0x3883e1,undefined,{'sensitivity':_0x1cc3e3(0x27f)});});for(const [_0x2e6d8a,_0x448618]of _0x1aecbd){const _0x46bf84=_0x13037b[_0x1622c8(0x268)](_0x2e6d8a)||_0x2e6d8a;console[_0x1622c8(0x1de)](_0x1622c8(0x232)+_0x46bf84),_0x448618[_0x1622c8(0x1b6)](_0x1bf9cb);for(const _0x5b3968 of _0x448618){console[_0x1622c8(0x1de)](formatJourneyItem(_0x5b3968,'\x20\x20',_0xcad308(_0x5b3968['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a18_0x258d28(0x22e)]='journey:view';[a18_0x258d28(0x1c5)]=a18_0x258d28(0x22b);async['execute'](_0x3b4d14){const _0x44aed0=a18_0x258d28,{options:_0x5f0a96,args:_0xc8ed6b,tdx:_0x44135d}=_0x3b4d14,_0x1a1641=_0xc8ed6b[0x0];if(!_0x1a1641)return console[_0x44aed0(0x1d6)](_0x44aed0(0x1c9)),console[_0x44aed0(0x1d6)](_0x44aed0(0x1f2)),console['error'](_0x44aed0(0x1ee)),console[_0x44aed0(0x1d6)](_0x44aed0(0x27e)),0x1;_0x5f0a96[_0x44aed0(0x1fb)]&&console[_0x44aed0(0x1d6)](_0x44aed0(0x247)+_0x1a1641);const _0xde1a98=await resolveJourneyTarget(_0x1a1641,_0x5f0a96[_0x44aed0(0x1d4)],_0x5f0a96[_0x44aed0(0x1fb)]),_0x7f8cc6=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x44135d[_0x44aed0(0x276)][_0x44aed0(0x240)](_0xde1a98[_0x44aed0(0x1d4)]),{'verbose':_0x5f0a96['verbose']}),_0x3bfdab=_0x7f8cc6['data'],_0x27efd3=await withSpinner(_0x44aed0(0x265),()=>_0x44135d['journey'][_0x44aed0(0x20c)](_0x3bfdab,_0xde1a98[_0x44aed0(0x285)]),{'verbose':_0x5f0a96[_0x44aed0(0x1fb)]}),_0x58a98b=_0x27efd3[_0x44aed0(0x25c)];if(_0x5f0a96[_0x44aed0(0x1bf)]){const _0x209104=getConsoleNextUrl(_0x5f0a96[_0x44aed0(0x254)],_0x44aed0(0x261)+_0x3bfdab+_0x44aed0(0x243)+_0x58a98b+'/j/da/je');return console['error'](a18_0x577901[_0x44aed0(0x245)]('✔')+_0x44aed0(0x206)+a18_0x577901[_0x44aed0(0x1db)](_0x209104)),openBrowser(_0x209104),0x0;}const _0x4cb8ba=await withSpinner('Getting\x20journey\x20details...',()=>_0x44135d['journey'][_0x44aed0(0x221)](_0x58a98b),{'verbose':_0x5f0a96[_0x44aed0(0x1fb)]}),_0x21b912=_0x4cb8ba[_0x44aed0(0x25c)],_0x800e23=_0x5f0a96['includeStats'];let _0x3c275f;if(_0x800e23)try{const _0x58704a=await withSpinner(_0x44aed0(0x260),()=>_0x44135d[_0x44aed0(0x27c)][_0x44aed0(0x226)](_0x58a98b),{'verbose':_0x5f0a96[_0x44aed0(0x1fb)]});_0x3c275f=_0x58704a[_0x44aed0(0x25c)];}catch{_0x5f0a96[_0x44aed0(0x1fb)]&&console[_0x44aed0(0x1d6)](_0x44aed0(0x25e));}const _0x18ffd3=getConsoleNextUrl(_0x5f0a96['site'],'/app/ps/'+_0x3bfdab+_0x44aed0(0x243)+_0x58a98b+_0x44aed0(0x274)),_0x4f80da={'id':_0x21b912['id'],'name':_0x21b912[_0x44aed0(0x23b)][_0x44aed0(0x22e)],'description':_0x21b912[_0x44aed0(0x23b)]['description'],'state':_0x21b912['attributes']['state'],'paused':_0x21b912['attributes'][_0x44aed0(0x26b)],'reentry_mode':_0x21b912['attributes'][_0x44aed0(0x225)],'stages':_0x21b912['attributes'][_0x44aed0(0x21b)]?.[_0x44aed0(0x24d)]||0x0,..._0x21b912[_0x44aed0(0x23b)][_0x44aed0(0x26c)]&&{'goal':_0x21b912['attributes'][_0x44aed0(0x26c)][_0x44aed0(0x22e)]},..._0x3c275f&&{'statistics':{'total_entered':_0x3c275f['totalEntered'],'goal_achieved':_0x3c275f[_0x44aed0(0x251)],'goal_rate':_0x3c275f['goalRate'],'stages':_0x3c275f[_0x44aed0(0x277)]}},'url':_0x18ffd3};return await handleSingleObjectOutput(_0x4f80da,_0x5f0a96),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a18_0x258d28(0x22e)]=a18_0x258d28(0x1ba);[a18_0x258d28(0x1c5)]='Show\x20journey\x20statistics';async[a18_0x258d28(0x236)](_0x3002f9){const _0x2a6405=a18_0x258d28,{options:_0x181087,args:_0x5dbdbf,tdx:_0x58aaa2}=_0x3002f9,_0x1c049c=_0x5dbdbf[0x0];if(!_0x1c049c)return console[_0x2a6405(0x1d6)](_0x2a6405(0x1c9)),console['error'](_0x2a6405(0x288)),0x1;_0x181087['verbose']&&console[_0x2a6405(0x1d6)]('Input:\x20'+_0x1c049c);const _0x4992f8=await resolveJourneyTarget(_0x1c049c,_0x181087[_0x2a6405(0x1d4)],_0x181087[_0x2a6405(0x1fb)]),_0x3276e6=await withSpinner(_0x2a6405(0x21a),()=>_0x58aaa2[_0x2a6405(0x276)]['resolveParentId'](_0x4992f8[_0x2a6405(0x1d4)]),{'verbose':_0x181087[_0x2a6405(0x1fb)]}),_0x347973=_0x3276e6['data'],_0x14bd9c=await withSpinner(_0x2a6405(0x265),()=>_0x58aaa2[_0x2a6405(0x27c)][_0x2a6405(0x20c)](_0x347973,_0x4992f8[_0x2a6405(0x285)]),{'verbose':_0x181087['verbose']}),_0x2c32ce=_0x14bd9c[_0x2a6405(0x25c)],_0x20a0e0=await withSpinner(_0x2a6405(0x260),()=>_0x58aaa2[_0x2a6405(0x27c)][_0x2a6405(0x226)](_0x2c32ce),{'verbose':_0x181087['verbose']}),_0x1ffb3b=_0x20a0e0[_0x2a6405(0x25c)];if(!_0x1ffb3b||_0x1ffb3b[_0x2a6405(0x228)]===null)return console[_0x2a6405(0x1d6)](_0x2a6405(0x212)+_0x4992f8[_0x2a6405(0x285)]),console['error'](_0x2a6405(0x1ed)),0x0;const _0x15355={'journey_id':_0x1ffb3b[_0x2a6405(0x228)],'total_entered':_0x1ffb3b['totalEntered'],'goal_achieved':_0x1ffb3b[_0x2a6405(0x251)],'goal_rate':_0x1ffb3b['goalRate'],'stages':_0x1ffb3b[_0x2a6405(0x277)]?.[_0x2a6405(0x1b5)](_0x4d2e46=>({'name':_0x4d2e46['stageName'],'population':_0x4d2e46[_0x2a6405(0x279)],'entered':_0x4d2e46[_0x2a6405(0x204)],'exited':_0x4d2e46['exited'],'conversion_rate':_0x4d2e46['conversionRate']}))},_0x42299b=_0x181087[_0x2a6405(0x267)];if(_0x42299b&&_0x1ffb3b[_0x2a6405(0x277)]){const _0x51408f=_0x1ffb3b['stages']['find'](_0x57634d=>_0x57634d[_0x2a6405(0x272)][_0x2a6405(0x1f0)]()===_0x42299b[_0x2a6405(0x1f0)]());if(_0x51408f)return await handleSingleObjectOutput({'stage_name':_0x51408f[_0x2a6405(0x272)],'population':_0x51408f['population'],'entered':_0x51408f['entered'],'exited':_0x51408f[_0x2a6405(0x266)],'conversion_rate':_0x51408f[_0x2a6405(0x1bb)]},_0x181087),0x0;console['error'](_0x2a6405(0x259)+_0x42299b+_0x2a6405(0x257));}return await handleSingleObjectOutput(_0x15355,_0x181087),0x0;}}export class JourneyPauseCommand extends BaseCommand{['name']=a18_0x258d28(0x238);[a18_0x258d28(0x1c5)]='Pause\x20a\x20running\x20journey';async['execute'](_0x25c1ab){const _0x5105b0=a18_0x258d28,{options:_0x15c827,args:_0x52e098,tdx:_0x129311}=_0x25c1ab,_0x2010a0=_0x52e098[0x0];if(!_0x2010a0)return console[_0x5105b0(0x1d6)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console['error'](_0x5105b0(0x1b1)),0x1;_0x15c827[_0x5105b0(0x1fb)]&&console[_0x5105b0(0x1d6)](_0x5105b0(0x247)+_0x2010a0);const _0x22a1e1=await resolveJourneyTarget(_0x2010a0,_0x15c827[_0x5105b0(0x1d4)],_0x15c827[_0x5105b0(0x1fb)]),_0x3c3216=await withSpinner(_0x5105b0(0x21a),()=>_0x129311[_0x5105b0(0x276)][_0x5105b0(0x240)](_0x22a1e1[_0x5105b0(0x1d4)]),{'verbose':_0x15c827['verbose']}),_0x3c8428=_0x3c3216['data'],_0x5d5738=await withSpinner('Resolving\x20journey...',()=>_0x129311['journey'][_0x5105b0(0x20c)](_0x3c8428,_0x22a1e1[_0x5105b0(0x285)]),{'verbose':_0x15c827[_0x5105b0(0x1fb)]}),_0x554f4f=_0x5d5738[_0x5105b0(0x25c)];if(!_0x15c827[_0x5105b0(0x224)]){const _0x18d0ba=await confirm(_0x5105b0(0x26a)+_0x22a1e1[_0x5105b0(0x285)]+'\x22?');if(!_0x18d0ba)return console[_0x5105b0(0x1d6)](_0x5105b0(0x1f1)),0x0;}const _0x1af58e=await withSpinner(_0x5105b0(0x1e5),()=>_0x129311[_0x5105b0(0x27c)]['pause'](_0x554f4f),{'verbose':_0x15c827[_0x5105b0(0x1fb)]}),_0x285633=_0x1af58e[_0x5105b0(0x25c)];return console[_0x5105b0(0x1d6)](_0x5105b0(0x1b8)+_0x285633[_0x5105b0(0x23b)][_0x5105b0(0x22e)]+_0x5105b0(0x25f)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a18_0x258d28(0x22e)]=a18_0x258d28(0x249);[a18_0x258d28(0x1c5)]=a18_0x258d28(0x1d3);async['execute'](_0x49651c){const _0x123284=a18_0x258d28,{options:_0x1467a8,args:_0x3c7e27,tdx:_0x4066c5}=_0x49651c,_0x1b1d2a=_0x3c7e27[0x0];if(!_0x1b1d2a)return console['error'](_0x123284(0x1c9)),console[_0x123284(0x1d6)](_0x123284(0x287)),0x1;_0x1467a8['verbose']&&console[_0x123284(0x1d6)]('Input:\x20'+_0x1b1d2a);const _0x2673a6=await resolveJourneyTarget(_0x1b1d2a,_0x1467a8[_0x123284(0x1d4)],_0x1467a8[_0x123284(0x1fb)]),_0x3fdb19=await withSpinner(_0x123284(0x21a),()=>_0x4066c5[_0x123284(0x276)][_0x123284(0x240)](_0x2673a6[_0x123284(0x1d4)]),{'verbose':_0x1467a8[_0x123284(0x1fb)]}),_0x57802e=_0x3fdb19[_0x123284(0x25c)],_0x219e9b=await withSpinner('Resolving\x20journey...',()=>_0x4066c5[_0x123284(0x27c)][_0x123284(0x20c)](_0x57802e,_0x2673a6[_0x123284(0x285)]),{'verbose':_0x1467a8[_0x123284(0x1fb)]}),_0x6ba1c0=_0x219e9b[_0x123284(0x25c)];if(!_0x1467a8[_0x123284(0x224)]){const _0x33f75f=await confirm(_0x123284(0x23c)+_0x2673a6[_0x123284(0x285)]+'\x22?');if(!_0x33f75f)return console[_0x123284(0x1d6)](_0x123284(0x1f1)),0x0;}const _0x1f5d54=await withSpinner(_0x123284(0x1e8),()=>_0x4066c5[_0x123284(0x27c)][_0x123284(0x284)](_0x6ba1c0),{'verbose':_0x1467a8['verbose']}),_0x82f7a9=_0x1f5d54[_0x123284(0x25c)];return console[_0x123284(0x1d6)](_0x123284(0x1b8)+_0x82f7a9['attributes'][_0x123284(0x22e)]+_0x123284(0x255)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a18_0x258d28(0x22e)]=a18_0x258d28(0x1b4);[a18_0x258d28(0x1c5)]='Export\x20journey(s)\x20as\x20YAML\x20files';async['execute'](_0xc97b19){const _0x140758=a18_0x258d28,{options:_0x3535,args:_0xa8f570,tdx:_0x5f23ca}=_0xc97b19,_0x3a8060=_0x3535,_0x3638d0=_0xa8f570[0x0],_0x46d060=_0x3638d0&&isYamlFilePath(_0x3638d0),_0x9f6646=await resolveTarget({'arg':_0x46d060?_0x3638d0:undefined,'contextParent':_0x3535['parentSegment'],'cwd':process[_0x140758(0x246)]()});if(!isSuccessfulResolution(_0x9f6646))return _0x9f6646[_0x140758(0x1c6)]==='no_parent'?(console[_0x140758(0x1d6)](a18_0x577901['yellow'](_0x140758(0x1da))),console['error'](_0x140758(0x1ca)),console['error'](_0x140758(0x253)),console[_0x140758(0x1d6)](_0x140758(0x21c)),console[_0x140758(0x1d6)](_0x140758(0x1b7))):(console[_0x140758(0x1d6)](a18_0x577901[_0x140758(0x1fa)](_0x140758(0x282)+_0x9f6646[_0x140758(0x20b)]+'\x0a')),_0x9f6646['helpText']&&console['error'](a18_0x577901[_0x140758(0x1db)](_0x9f6646['helpText']))),0x1;let _0x453d55=_0x46d060?undefined:_0x3638d0,_0x5ce82a,_0xe3dacf;_0x9f6646[_0x140758(0x222)]==='file'&&(_0x453d55=_0x9f6646['resourceName'],_0x5ce82a=_0x9f6646[_0x140758(0x1df)],_0xe3dacf=_0x9f6646[_0x140758(0x1f4)]);const _0x23f8ce=_0x9f6646[_0x140758(0x256)],_0x45db93=_0x9f6646[_0x140758(0x21f)];_0x3a8060['verbose']&&(console[_0x140758(0x1d6)](_0x140758(0x205)+_0x23f8ce),console['error'](_0x140758(0x1e3)+_0x45db93),_0x453d55&&console[_0x140758(0x1d6)](_0x140758(0x1e1)+_0x453d55),_0x5ce82a&&console[_0x140758(0x1d6)](_0x140758(0x1d2)+_0x5ce82a),_0xe3dacf&&console[_0x140758(0x1d6)](_0x140758(0x23f)+_0xe3dacf));const _0x19c7ca=await withSpinner(_0x140758(0x21a),()=>_0x5f23ca[_0x140758(0x276)][_0x140758(0x240)](_0x23f8ce),{'verbose':_0x3535[_0x140758(0x1fb)]}),_0x5d78b2=_0x19c7ca[_0x140758(0x25c)],[_0x54a3b3,_0x129b62]=await Promise['all']([withSpinner(_0x140758(0x207),()=>_0x5f23ca[_0x140758(0x27c)][_0x140758(0x258)](_0x5d78b2,undefined,{'includeAllVersions':!![]}),{'verbose':_0x3535[_0x140758(0x1fb)]}),withSpinner(_0x140758(0x203),()=>_0x5f23ca[_0x140758(0x276)][_0x140758(0x234)](_0x5d78b2),{'verbose':_0x3535['verbose']})]);let _0x5f36e5=_0x54a3b3[_0x140758(0x25c)];const _0x2e3791=_0x129b62['data'],_0x25e1ad=buildFolderIdToPathMap(_0x2e3791);if(_0x453d55){const _0x5b1a26=_0x5f36e5[_0x140758(0x27d)](_0x1a92bd=>_0x1a92bd[_0x140758(0x24e)]['toLowerCase']()===_0x453d55[_0x140758(0x1f0)]());if(_0x5b1a26[_0x140758(0x24d)]===0x0)return console['error'](_0x140758(0x1ef)+_0x453d55),console[_0x140758(0x1d6)](_0x140758(0x1c3)),0x1;_0x5f36e5=_0x5b1a26;}if(_0xe3dacf!==undefined){const _0x1a04af=_0x5f36e5[_0x140758(0x27d)](_0x33b4ae=>{const _0x123308=_0x140758,_0x1649ab=_0x33b4ae[_0x123308(0x1e9)]?_0x25e1ad['get'](_0x33b4ae[_0x123308(0x1e9)])||'':'';return _0x1649ab===_0xe3dacf;});if(_0x1a04af[_0x140758(0x24d)]===0x0&&_0x5f36e5['length']>0x0){console[_0x140758(0x1d6)]('Error:\x20Journey\x20\x27'+_0x453d55+_0x140758(0x230)+(_0xe3dacf||_0x140758(0x229))),console[_0x140758(0x1d6)](_0x140758(0x214));for(const _0x326aaf of _0x5f36e5){const _0x7f9b03=_0x326aaf[_0x140758(0x1e9)]?_0x25e1ad[_0x140758(0x268)](_0x326aaf[_0x140758(0x1e9)])||'':'';console[_0x140758(0x1d6)](_0x140758(0x1d1)+(_0x7f9b03||_0x140758(0x24c))+'/'+_0x326aaf['journeyBundleName']);}return 0x1;}_0x5f36e5=_0x1a04af;}if(_0x5f36e5[_0x140758(0x24d)]===0x0)return console['error']('No\x20journeys\x20found'),0x0;const _0x2274f3=new Map();for(const _0x46c9e2 of _0x5f36e5){const _0x58c555=_0x46c9e2[_0x140758(0x220)];!_0x2274f3[_0x140758(0x1fe)](_0x58c555)&&_0x2274f3['set'](_0x58c555,[]),_0x2274f3[_0x140758(0x268)](_0x58c555)[_0x140758(0x241)](_0x46c9e2);}for(const _0x49dc6c of _0x2274f3[_0x140758(0x1c8)]()){_0x49dc6c[_0x140758(0x1b6)]((_0x4ea033,_0x28847d)=>(_0x4ea033[_0x140758(0x26f)]||0x0)-(_0x28847d[_0x140758(0x26f)]||0x0));}const _0x479564=[],[_0x4297dd,_0x30ecf0]=await Promise[_0x140758(0x283)]([withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x5f23ca[_0x140758(0x223)][_0x140758(0x1e0)](),{'verbose':_0x3535[_0x140758(0x1fb)]})[_0x140758(0x1eb)](_0x5b864c=>_0x5b864c['data']),withSpinner(_0x140758(0x264),()=>_0x5f23ca[_0x140758(0x1c7)]['buildIdToNameMap'](),{'verbose':_0x3535[_0x140758(0x1fb)]})[_0x140758(0x1eb)](_0x2282f6=>_0x2282f6[_0x140758(0x25c)])]);for(const _0x4f8d06 of _0x2274f3['values']()){const _0x58eba9=_0x4f8d06[0x0][_0x140758(0x24e)],_0xff816d=_0x4f8d06[0x0][_0x140758(0x1e9)],_0x584776=_0xff816d?_0x25e1ad['get'](_0xff816d)||'':'',_0x593d62=_0x584776?a18_0x1dbfac['join'](_0x45db93,_0x584776):_0x45db93,_0x5658e4=_0x5ce82a||a18_0x1dbfac[_0x140758(0x26e)](_0x593d62,sanitizeFileName(_0x58eba9)+'.yml');let _0x35ce9e,_0x59de51;if(existsSync(_0x5658e4))try{const _0x2a8eaf=readFileSync(_0x5658e4,_0x140758(0x1ec)),_0x427407=parseYamlString(_0x2a8eaf);_0x59de51=_0x427407,_0x35ce9e=buildRuleToNameMapping(_0x427407),_0x3a8060[_0x140758(0x1fb)]&&_0x35ce9e['size']>0x0&&console[_0x140758(0x1d6)](_0x140758(0x269)+_0x35ce9e['size']+_0x140758(0x235)+_0x58eba9);}catch(_0x4d2a2b){_0x3a8060[_0x140758(0x1fb)]&&console[_0x140758(0x1d6)](_0x140758(0x202)+_0x4d2a2b[_0x140758(0x20b)]);}const _0xa4aa64=[],_0x10309c=new Set(),_0x3b31f4=new Map(),_0x2c4b55=new Map(),_0x2d916c=new Set(),_0x2ee692=new Map(),_0x135006=new Map(),_0x32b3ee=createJumpTargetCache();await withProgressSpinner('Fetching\x20'+_0x58eba9+_0x140758(0x24f),async _0x1f56ed=>{const _0x49fed0=_0x140758;for(const _0xd3561e of _0x4f8d06){const _0x1feff0=_0x4f8d06['length']>0x1?_0xd3561e[_0x49fed0(0x24e)]+'\x20v'+(_0xd3561e[_0x49fed0(0x26f)]||0x1):_0xd3561e['journeyBundleName'];_0x1f56ed[_0x49fed0(0x20e)](_0x49fed0(0x1b3)+_0x1feff0);const _0x483ee3=await _0x5f23ca['journey'][_0x49fed0(0x221)](_0xd3561e['id']),_0x3b3abf=_0x483ee3[_0x49fed0(0x23b)]?.[_0x49fed0(0x1d9)],_0x6cda77={'resolveSegment':async _0x172029=>{const _0x13e369=_0x49fed0;if(!_0x3b3abf)return{'name':_0x172029,'isJourneyLocal':![]};const _0x3a08ce=_0x3b31f4[_0x13e369(0x268)](_0x172029);if(_0x3a08ce)return _0x3a08ce;try{const _0x549f5a=await _0x5f23ca[_0x13e369(0x276)]['getSegment'](_0x3b3abf,_0x172029),_0x464392=_0x549f5a[_0x13e369(0x1dd)]===SEGMENT_KIND_JOURNEY;let _0x149061,_0x184483=_0x549f5a['name'];if(_0x464392&&_0x549f5a['rule']){const _0x2ead81=await segmentResponseToDef(_0x549f5a,{'resolveSegmentName':async _0x56b280=>{const _0x1639a0=_0x13e369,_0x1b7793=_0x3b31f4[_0x1639a0(0x268)](_0x56b280);if(_0x1b7793)return _0x1b7793[_0x1639a0(0x22e)];const _0x2b7885=await _0x6cda77[_0x1639a0(0x1d0)](_0x56b280);return _0x2b7885['name'];}}),_0xd09290=_0x2ead81['rule'];_0x149061={'description':_0x549f5a[_0x13e369(0x1c5)],'rule':_0xd09290};const _0xfe0613=serializeRule(_0xd09290),_0x22aa04=_0x2c4b55[_0x13e369(0x268)](_0xfe0613);if(_0x22aa04)_0x184483=_0x22aa04,_0x149061=undefined,_0x3a8060['verbose']&&console[_0x13e369(0x1d6)]('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0x549f5a[_0x13e369(0x22e)]+_0x13e369(0x252)+_0x22aa04);else{let _0x4619e1=![];if(_0x35ce9e){const _0x12152d=_0x35ce9e[_0x13e369(0x268)](_0xfe0613);if(_0x12152d){const _0x3cd7dd=_0x12152d[_0x13e369(0x27a)](_0x244a04=>!_0x10309c[_0x13e369(0x1fe)](_0x244a04));_0x3cd7dd&&(_0x184483=_0x3cd7dd,_0x10309c['add'](_0x3cd7dd),_0x2c4b55[_0x13e369(0x21d)](_0xfe0613,_0x3cd7dd),_0x4619e1=!![],_0x3a8060[_0x13e369(0x1fb)]&&console[_0x13e369(0x1d6)](_0x13e369(0x213)+_0x3cd7dd+_0x13e369(0x1cf)));}}if(!_0x4619e1){const _0x45fad2=generateJourneyLocalName(_0x549f5a['name']);_0x45fad2&&(_0x184483=_0x45fad2);let _0x5dadd3=_0x184483,_0xc3fa8b=0x2;while(_0x10309c[_0x13e369(0x1fe)](_0x5dadd3)){_0x5dadd3=_0x184483+'_'+_0xc3fa8b,_0xc3fa8b++;}_0x10309c['add'](_0x5dadd3),_0x2c4b55['set'](_0xfe0613,_0x5dadd3),_0x184483=_0x5dadd3;}}}const _0x3577c8={'name':_0x184483,'isJourneyLocal':_0x464392,'definition':_0x149061};return _0x3b31f4[_0x13e369(0x21d)](_0x172029,_0x3577c8),_0x3577c8;}catch(_0x565cda){return _0x3535[_0x13e369(0x1fb)]&&console['error'](_0x13e369(0x210)+_0x172029+':\x20'+_0x565cda['message']),{'name':_0x172029,'isJourneyLocal':![]};}},'resolveActivation':async _0x4d8a65=>{const _0x5498ef=_0x49fed0,_0x3558be=_0x2ee692[_0x5498ef(0x268)](_0x4d8a65);if(_0x3558be)return _0x3558be;try{const _0x43dd63=await _0x5f23ca[_0x5498ef(0x27c)]['getActivation'](_0xd3561e['id'],_0x4d8a65),_0x423ff9=journeyActivationStepToYaml(_0x43dd63,_0x4297dd,_0x30ecf0),_0x399f47=JSON[_0x5498ef(0x216)]({'name':_0x423ff9[_0x5498ef(0x22e)],'connection':_0x423ff9[_0x5498ef(0x1c7)],'connector_config':_0x423ff9['connector_config']}),_0x45fd9a=_0x135006['get'](_0x399f47);if(_0x45fd9a){const _0x31d561={'name':_0x45fd9a,'isJourneyLocal':!![],'definition':_0x423ff9};return _0x2ee692[_0x5498ef(0x21d)](_0x4d8a65,_0x31d561),_0x31d561;}const _0x33e733=_0x43dd63[_0x5498ef(0x23b)][_0x5498ef(0x27b)][_0x5498ef(0x22e)]||_0x4d8a65,_0x7b634=sanitizeYamlKey(_0x33e733)||_0x5498ef(0x1ce)+_0x4d8a65;let _0x568c71=_0x7b634,_0x33c2c2=0x2;while(_0x2d916c['has'](_0x568c71)){_0x568c71=_0x7b634+'_'+_0x33c2c2,_0x33c2c2++;}_0x2d916c[_0x5498ef(0x1cb)](_0x568c71),_0x135006[_0x5498ef(0x21d)](_0x399f47,_0x568c71);const _0x13ed15={'name':_0x568c71,'isJourneyLocal':!![],'definition':_0x423ff9};return _0x2ee692[_0x5498ef(0x21d)](_0x4d8a65,_0x13ed15),_0x13ed15;}catch(_0x573c06){return _0x3535['verbose']&&console[_0x5498ef(0x1d6)](_0x5498ef(0x1c1)+_0x4d8a65+':\x20'+_0x573c06[_0x5498ef(0x20b)]),{'name':_0x4d8a65,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x2957a3,_0x15bbe9)=>{const _0x26c27e=_0x49fed0;return resolveJumpTarget(_0x2957a3,_0x15bbe9,_0x32b3ee,_0x159786=>_0x5f23ca['journey'][_0x26c27e(0x221)](_0x159786));}},_0x310f28=await journeyResponseToDef(_0x483ee3,_0x6cda77);_0xa4aa64[_0x49fed0(0x241)]({'item':_0xd3561e,'yaml':_0x310f28});}},{'verbose':_0x3535['verbose']});const _0x2deec4=buildMergedJourneyDef(_0xa4aa64,_0x35ce9e),_0x2dfde8=normalizeJourneyDef(_0x2deec4,_0x59de51),_0x51e625=toYamlString(_0x2dfde8),_0x3bf20f=_0x5ce82a||a18_0x1dbfac[_0x140758(0x26e)](_0x593d62,sanitizeFileName(_0x58eba9)+_0x140758(0x286));!_0x5ce82a&&_0x584776&&!existsSync(_0x593d62)&&mkdirSync(_0x593d62,{'recursive':!![]});const _0x46a3c2=a18_0x1dbfac[_0x140758(0x23e)](process[_0x140758(0x246)](),_0x3bf20f);if(existsSync(_0x3bf20f)){const _0x58fbf8=readFileSync(_0x3bf20f,'utf-8'),_0x55d786=generateDiff(_0x58fbf8,_0x51e625),_0x59ee7e=hasChanges(_0x55d786);_0x479564[_0x140758(0x241)]({'relativePath':_0x46a3c2,'absolutePath':_0x3bf20f,'content':_0x51e625,'isNew':![],'hasChanges':_0x59ee7e,'diff':_0x59ee7e?formatDiffWithColors(_0x55d786):undefined});}else _0x479564[_0x140758(0x241)]({'relativePath':_0x46a3c2,'absolutePath':_0x3bf20f,'content':_0x51e625,'isNew':!![],'hasChanges':![]});}const _0x8ae9a5=_0x479564[_0x140758(0x27d)](_0x2c6763=>_0x2c6763[_0x140758(0x1f3)]),_0x34505a=_0x479564[_0x140758(0x27d)](_0x4304a1=>!_0x4304a1[_0x140758(0x1f3)]&&_0x4304a1[_0x140758(0x200)]),_0x14e2e9=_0x479564['filter'](_0x24904d=>!_0x24904d[_0x140758(0x1f3)]&&!_0x24904d['hasChanges']),_0x25f528=_0x5f36e5['length'],_0x3d20e5=_0x2274f3[_0x140758(0x25a)],_0x23aa4c=_0x25f528>_0x3d20e5?'\x20('+_0x25f528+'\x20versions)':'';console[_0x140758(0x1d6)]('\x0aPull\x20summary:'),console[_0x140758(0x1d6)]('\x20\x20'+a18_0x577901[_0x140758(0x1db)](_0x3d20e5+'\x20journeys')+a18_0x577901['dim'](_0x23aa4c)),console['error']('\x20\x20'+a18_0x577901['green']('+\x20'+_0x8ae9a5[_0x140758(0x24d)]+'\x20new\x20files')),console['error']('\x20\x20'+a18_0x577901[_0x140758(0x201)]('~\x20'+_0x34505a[_0x140758(0x24d)]+'\x20changed\x20files')),console[_0x140758(0x1d6)]('\x20\x20'+a18_0x577901['dim']('=\x20'+_0x14e2e9['length']+_0x140758(0x1e4))),console['error'](_0x140758(0x233)+a18_0x577901[_0x140758(0x1db)](_0x45db93)+'\x0a');if(_0x34505a[_0x140758(0x24d)]>0x0)for(const _0x3b9861 of _0x34505a){console[_0x140758(0x1d6)](_0x140758(0x22c)+_0x3b9861[_0x140758(0x217)]+'\x27:'),console[_0x140758(0x1d6)]('─'[_0x140758(0x20a)](0x3c)),console[_0x140758(0x1d6)](_0x3b9861['diff']),console['error']('─'['repeat'](0x3c));}if(_0x3a8060[_0x140758(0x22f)])return console[_0x140758(0x1d6)](a18_0x577901[_0x140758(0x201)](_0x140758(0x21e))),0x0;if(_0x8ae9a5[_0x140758(0x24d)]===0x0&&_0x34505a[_0x140758(0x24d)]===0x0)return console['error'](a18_0x577901[_0x140758(0x245)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x23f8ce},_0x3a8060[_0x140758(0x1b9)]),console[_0x140758(0x1d6)](a18_0x577901[_0x140758(0x245)]('✔\x20Context\x20set:\x20'+a18_0x577901[_0x140758(0x1d8)](_0x140758(0x1f7))+_0x140758(0x219)+a18_0x577901['cyan'](_0x23f8ce))),0x0;if(!_0x3a8060[_0x140758(0x224)]&&(_0x8ae9a5[_0x140758(0x24d)]>0x0||_0x34505a['length']>0x0)){const _0x2ddd54=await confirmKey(_0x140758(0x208)+(_0x8ae9a5[_0x140758(0x24d)]+_0x34505a['length'])+_0x140758(0x209));if(!_0x2ddd54)return console[_0x140758(0x1d6)]('Aborted.'),0x1;}!existsSync(_0x45db93)&&mkdirSync(_0x45db93,{'recursive':!![]});for(const _0x394cc4 of _0x479564){(_0x394cc4[_0x140758(0x1f3)]||_0x394cc4[_0x140758(0x200)])&&writeFileSync(_0x394cc4[_0x140758(0x22d)],_0x394cc4['content'],_0x140758(0x1ec));}return console[_0x140758(0x1d6)](a18_0x577901[_0x140758(0x245)]('✔\x20Pulled\x20'+(_0x8ae9a5[_0x140758(0x24d)]+_0x34505a[_0x140758(0x24d)])+_0x140758(0x1f8)+_0x45db93)),saveSessionContext({'parent_segment':_0x23f8ce},_0x3a8060['session']),console[_0x140758(0x1d6)](a18_0x577901['green'](_0x140758(0x271)+a18_0x577901['dim'](_0x140758(0x1f7))+_0x140758(0x219)+a18_0x577901[_0x140758(0x1db)](_0x23f8ce))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a18_0x258d28(0x22e)]=a18_0x258d28(0x1bc);[a18_0x258d28(0x1c5)]=a18_0x258d28(0x1bd);[a18_0x258d28(0x1ff)]=new SegmentPushCommand();async[a18_0x258d28(0x236)](_0x45b1b9){const _0x47e56e=a18_0x258d28,_0x2968a2=_0x45b1b9[_0x47e56e(0x1cc)][0x0];let _0x21609d;if(_0x2968a2){const _0x140957=await resolveTarget({'arg':_0x2968a2,'contextParent':_0x45b1b9['options']['parentSegment'],'cwd':process[_0x47e56e(0x246)]()});isSuccessfulResolution(_0x140957)&&_0x140957['type']===_0x47e56e(0x1e6)&&(_0x21609d=_0x140957['filePath']);}const _0x36ad5f={..._0x45b1b9,'options':{..._0x45b1b9['options'],'journeysOnly':!![],..._0x21609d&&{'singleFilePath':_0x21609d}}};return this[_0x47e56e(0x1ff)]['execute'](_0x36ad5f);}}
1
+ const a18_0x4e85c7=a18_0x3b4d;(function(_0x3b97a7,_0x4c4141){const _0x218c05=a18_0x3b4d,_0x49bbc2=_0x3b97a7();while(!![]){try{const _0x151467=parseInt(_0x218c05(0x186))/0x1+-parseInt(_0x218c05(0x1be))/0x2+parseInt(_0x218c05(0x1fb))/0x3*(-parseInt(_0x218c05(0x226))/0x4)+parseInt(_0x218c05(0x215))/0x5*(-parseInt(_0x218c05(0x18f))/0x6)+parseInt(_0x218c05(0x17d))/0x7+-parseInt(_0x218c05(0x231))/0x8*(parseInt(_0x218c05(0x22e))/0x9)+parseInt(_0x218c05(0x1ce))/0xa;if(_0x151467===_0x4c4141)break;else _0x49bbc2['push'](_0x49bbc2['shift']());}catch(_0x112b70){_0x49bbc2['push'](_0x49bbc2['shift']());}}}(a18_0x3698,0xdbf19));import a18_0x240862 from'chalk';import a18_0x2f0a39 from'path';import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,handleSingleObjectOutput}from'../core/command-output.js';import{withSpinner,withProgressSpinner}from'../utils/spinner.js';import{confirm,confirmKey}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 a18_0x3698(){const _0x18e621=['2169QrFgke','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','cyan','24872SUdouh','(root)','push','test','Found\x20','Parent\x20segment:\x20','args','segmentPushCommand','rootFolderId','journeyBundleName','\x20\x20Preserving\x20local\x20segment\x20name:\x20','(completed)','reentryMode','goal','stageName','description','Resolving\x20parent\x20segment...','toLowerCase','journey:stats','kind','execute','rule','Show\x20journey\x20details','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','state','errorCode','\x5c$&','activation_','Warning:\x20Could\x20not\x20resolve\x20activation\x20','session','Listing\x20journeys...','\x20journey','table','setPhase','Pattern:\x20','No\x20statistics\x20available\x20for\x20journey:\x20','journey:view','cwd','data','7816424AXTRex','\x20versions)','\x20files?','utf-8','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','/j/da','filter','has','1062598wTVfyE','Input:\x20','parentName','(archived)','INVALID_ARGUMENT','totalEntered','buildIdToEmailMap','Fetching\x20parent\x20segment...','user','4895958lNMEBl','/e/','pause','\x20journey\x20files\x20to\x20','Resolving\x20journey...','No\x20journeys\x20found','\x20\x20Consolidating\x20duplicate\x20segment:\x20','join','get','🗺️\x20','getJourney','relativePath','verbose','green','no_parent','stringify','type','...','values','attributes','entered','Error:\x20Journey\x20\x27','Journey\x20name:\x20','listJourneysWithFolders','listJourneysFromParentSegment','\x20(rule\x20match)','all','Listing\x20folders...','connection','site','Resuming\x20journey...','\x20journeys','getParentFull','isNew','Pause\x20a\x20running\x20journey','Resume\x20a\x20paused\x20journey','📁\x20','(paused)','segments','then','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','Target\x20directory:\x20','replace','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Error:\x20Journey\x20not\x20found:\x20','find','add','770548eoUMyx','sort','dryRun','entries','hasChanges','resolveParentId','launched','\x20=\x20','\x0aChanges\x20to\x20\x27','blue','message','connector_config','journeys','\x20\x20Statistics\x20not\x20available','helpText','content','21597070PCkfaP','paused','\x22\x20resumed','getSegment','buildIdToNameMap','Folder\x20path:\x20','\x27\x20not\x20found\x20in\x20','✔\x20Context\x20set:\x20','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','folderPath','\x20unchanged\x20files','\x20\x20-\x20','segment','Warning:\x20Stage\x20\x22','size','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','Fetching\x20','Pausing\x20journey...','Options:','segmentName','filePath','Write\x20','/app/ps/','Usage:\x20journey\x20stats\x20<name-or-path>','Target\x20file:\x20','journeyStages','Cancelled','listFolders','(running)','population','includeStats','Show\x20journey\x20statistics','/j/da/je','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','set','journey:resume','repeat','resume','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','dim','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','resolveJourneyId','getActivation','Getting\x20journey\x20statistics...','24SLDQsE','\x20new\x20files','journey:push','Usage:\x20journey\x20resume\x20<name-or-path>','journey','split','totalGoalAchieved','goalRate','yellow','red','✔\x20Journey\x20\x22','relative','length','stages','format','error','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','targetDir','log','resourceName','web','.yml','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','journeyName','json','versionNumber','5GYSjRW','file','exited','\x20->\x20','map','yes','✔\x20All\x20files\x20are\x20up\x20to\x20date','\x20\x20Folder\x20path:\x20','folderId','stage','Error:\x20','parentSegment','Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','getStatistics','\x20Opening\x20','List\x20journeys\x20in\x20current\x20context','743756mYNJbH','completed','conversionRate','journeyId','base','✔\x20Pulled\x20','options','name'];a18_0x3698=function(){return _0x18e621;};return a18_0x3698();}import{sanitizeFileName}from'../utils/string-utils.js';import{SegmentPushCommand}from'./segment-push-command.js';import{buildFolderIdToPathMap}from'../sdk/segment/resolution-context.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 formatJourneyState(_0xe05b95){const _0xd811bc=a18_0x3b4d;switch(_0xe05b95){case _0xd811bc(0x1c4):return a18_0x240862[_0xd811bc(0x19c)](_0xd811bc(0x1eb));case'draft':return a18_0x240862[_0xd811bc(0x1f6)]('(draft)');case'paused':return a18_0x240862[_0xd811bc(0x203)](_0xd811bc(0x1b4));case _0xd811bc(0x227):return a18_0x240862[_0xd811bc(0x1c7)](_0xd811bc(0x161));case'archived':return a18_0x240862[_0xd811bc(0x1f6)](_0xd811bc(0x189));default:return'('+_0xe05b95+')';}}function a18_0x3b4d(_0x4b7b17,_0x1b8e47){_0x4b7b17=_0x4b7b17-0x15a;const _0x36987c=a18_0x3698();let _0x3b4dc7=_0x36987c[_0x4b7b17];return _0x3b4dc7;}function formatJourneyItem(_0x2f07b8,_0x12bb5d='',_0x56ea4e){const _0x39b4ee=a18_0x3b4d,_0x59d3c2=formatJourneyState(_0x2f07b8[_0x39b4ee(0x16e)]),_0x48e8de=_0x56ea4e?hyperlink(_0x2f07b8[_0x39b4ee(0x15f)],_0x56ea4e):_0x2f07b8[_0x39b4ee(0x15f)];return _0x12bb5d+_0x39b4ee(0x198)+_0x48e8de+'\x20'+_0x59d3c2;}function escapeRegex(_0x5d4df0){const _0xb78b=a18_0x3b4d;return _0x5d4df0[_0xb78b(0x1b9)](/[.*+?^${}()|[\]\\]/g,_0xb78b(0x170));}function globToRegex(_0x45f099){const _0x3a87b7=a18_0x3b4d,_0x5061f4=_0x45f099[_0x3a87b7(0x200)]('*')[_0x3a87b7(0x219)](escapeRegex);return new RegExp(_0x5061f4[_0x3a87b7(0x196)]('.*'),'i');}function buildRuleToNameMapping(_0x5d2599){const _0x79460b=a18_0x3b4d,_0x2f5fce=new Map();if(_0x5d2599[_0x79460b(0x1b5)])for(const [_0x34cc09,_0xd83556]of Object[_0x79460b(0x1c1)](_0x5d2599[_0x79460b(0x1b5)])){if(_0xd83556[_0x79460b(0x16b)]){const _0x3b306b=serializeRule(_0xd83556[_0x79460b(0x16b)]),_0x4f2924=_0x2f5fce[_0x79460b(0x197)](_0x3b306b);_0x4f2924?_0x4f2924['push'](_0x34cc09):_0x2f5fce['set'](_0x3b306b,[_0x34cc09]);}}return _0x2f5fce;}async function resolveJourneyTarget(_0x405784,_0x1b4983,_0xf9ea68){const _0x50a553=a18_0x3b4d;if(isYamlFilePath(_0x405784))try{const _0x4ecab8=await resolveYamlFilePath(_0x405784);return _0xf9ea68&&(console[_0x50a553(0x20a)]('Resolved\x20YAML\x20file:\x20'+_0x405784),console['error']('\x20\x20Parent\x20segment:\x20'+_0x4ecab8[_0x50a553(0x220)]),console['error']('\x20\x20Name:\x20'+_0x4ecab8['segmentName']),console[_0x50a553(0x20a)](_0x50a553(0x21c)+(_0x4ecab8[_0x50a553(0x1d7)]||_0x50a553(0x232)))),{'journeyName':_0x4ecab8[_0x50a553(0x1e2)],'parentSegment':_0x4ecab8[_0x50a553(0x220)],'resolved':_0x4ecab8};}catch(_0x5ab7f8){throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x50a553(0x1b7)+_0x5ab7f8[_0x50a553(0x1c8)]);}if(!_0x1b4983)throw new SDKError(ErrorCode[_0x50a553(0x18a)],_0x50a553(0x1f0));return{'journeyName':_0x405784,'parentSegment':_0x1b4983};}export class JourneyListCommand extends BaseCommand{[a18_0x4e85c7(0x22d)]='journey:list';[a18_0x4e85c7(0x165)]=a18_0x4e85c7(0x225);async[a18_0x4e85c7(0x16a)](_0x455d07){const _0x4b23d2=a18_0x4e85c7,{options:_0x170c53,args:_0x4e14d3,tdx:_0x5ee70a}=_0x455d07,_0xed8088=_0x4e14d3[0x0],_0x132296=_0x170c53[_0x4b23d2(0x220)];if(!_0x132296)return console[_0x4b23d2(0x20a)]('Error:\x20Parent\x20segment\x20context\x20required'),console['error'](_0x4b23d2(0x1de)),0x1;const _0x2e9bb6=await withSpinner(_0x4b23d2(0x166),()=>_0x5ee70a[_0x4b23d2(0x1da)][_0x4b23d2(0x1c3)](_0x132296),{'verbose':_0x170c53[_0x4b23d2(0x19b)]}),_0x3ed851=_0x2e9bb6[_0x4b23d2(0x17c)];_0x170c53[_0x4b23d2(0x19b)]&&(console[_0x4b23d2(0x20a)](_0x4b23d2(0x15b)+_0x132296+'\x20(ID:\x20'+_0x3ed851+')'),_0xed8088&&console[_0x4b23d2(0x20a)](_0x4b23d2(0x178)+_0xed8088));const _0x454acb=await withSpinner(_0x4b23d2(0x18d),()=>_0x5ee70a['segment'][_0x4b23d2(0x1af)](_0x3ed851),{'verbose':_0x170c53[_0x4b23d2(0x19b)]}),_0x1e51a7=_0x454acb['data'],_0x1abb1d=_0x1e51a7[_0x4b23d2(0x15e)],_0x59bc97=await withSpinner(_0x4b23d2(0x174),()=>_0x5ee70a[_0x4b23d2(0x1ff)][_0x4b23d2(0x1a6)](_0x3ed851,_0x1abb1d),{'verbose':_0x170c53[_0x4b23d2(0x19b)]});let _0x4478e6=_0x59bc97['data'][_0x4b23d2(0x1ca)];const _0x174828=_0x59bc97[_0x4b23d2(0x17c)]['folders'],_0x4ce9d0=new Map();for(const _0x20d478 of _0x174828){_0x4ce9d0['set'](_0x20d478['id'],_0x20d478[_0x4b23d2(0x22d)]);}if(_0xed8088){const _0x518105=globToRegex(_0xed8088);_0x4478e6=_0x4478e6[_0x4b23d2(0x184)](_0x2c25f0=>_0x518105[_0x4b23d2(0x234)](_0x2c25f0[_0x4b23d2(0x15f)]));}console['error']('✔\x20Found\x20'+_0x4478e6[_0x4b23d2(0x207)]+_0x4b23d2(0x175)+(_0x4478e6[_0x4b23d2(0x207)]!==0x1?'s':''));const _0x363efe=_0x47613e=>{const _0x52f67d=_0x4b23d2;return getConsoleNextUrl(_0x170c53['site'],_0x52f67d(0x1e5)+_0x3ed851+_0x52f67d(0x190)+_0x47613e+_0x52f67d(0x183));};if(_0x170c53['format']===_0x4b23d2(0x176))await handleSDKOutput(_0x4478e6,_0x170c53);else{if(_0x170c53[_0x4b23d2(0x209)]===_0x4b23d2(0x213)){const _0x3bfb43=_0x4478e6['map'](_0x83eb26=>({..._0x83eb26,'url':_0x363efe(_0x83eb26['id'])}));await handleSDKOutput(_0x3bfb43,_0x170c53);}else{console[_0x4b23d2(0x20d)]('['+_0x132296+']');const _0x49a81e=new Map(),_0x271c63=[];for(const _0x422c60 of _0x4478e6){if(!_0x422c60[_0x4b23d2(0x21d)]||_0x422c60[_0x4b23d2(0x21d)]===_0x1abb1d)_0x271c63[_0x4b23d2(0x233)](_0x422c60);else{const _0x2c4d57=_0x49a81e['get'](_0x422c60['folderId'])||[];_0x2c4d57[_0x4b23d2(0x233)](_0x422c60),_0x49a81e[_0x4b23d2(0x1f1)](_0x422c60[_0x4b23d2(0x21d)],_0x2c4d57);}}const _0x41d62d=(_0x238869,_0x57fca1)=>_0x238869[_0x4b23d2(0x15f)]['localeCompare'](_0x57fca1[_0x4b23d2(0x15f)],undefined,{'sensitivity':_0x4b23d2(0x22a)});_0x271c63[_0x4b23d2(0x1bf)](_0x41d62d);for(const _0x521fe1 of _0x271c63){console['log'](formatJourneyItem(_0x521fe1,'',_0x363efe(_0x521fe1['id'])));}const _0x35ed3e=[..._0x49a81e[_0x4b23d2(0x1c1)]()][_0x4b23d2(0x1bf)]((_0x3f85b8,_0x2e3e8f)=>{const _0x5b677e=_0x4b23d2,_0x4fa749=_0x4ce9d0[_0x5b677e(0x197)](_0x3f85b8[0x0])||_0x3f85b8[0x0],_0xe9e069=_0x4ce9d0[_0x5b677e(0x197)](_0x2e3e8f[0x0])||_0x2e3e8f[0x0];return _0x4fa749['localeCompare'](_0xe9e069,undefined,{'sensitivity':_0x5b677e(0x22a)});});for(const [_0x4daa52,_0x36489b]of _0x35ed3e){const _0x33a517=_0x4ce9d0[_0x4b23d2(0x197)](_0x4daa52)||_0x4daa52;console[_0x4b23d2(0x20d)](_0x4b23d2(0x1b3)+_0x33a517),_0x36489b[_0x4b23d2(0x1bf)](_0x41d62d);for(const _0x56edb8 of _0x36489b){console[_0x4b23d2(0x20d)](formatJourneyItem(_0x56edb8,'\x20\x20',_0x363efe(_0x56edb8['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a18_0x4e85c7(0x22d)]=a18_0x4e85c7(0x17a);[a18_0x4e85c7(0x165)]=a18_0x4e85c7(0x16c);async['execute'](_0x76d10e){const _0x8e1eb8=a18_0x4e85c7,{options:_0x3501e2,args:_0x3f39ba,tdx:_0x225136}=_0x76d10e,_0x51d350=_0x3f39ba[0x0];if(!_0x51d350)return console['error']('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x8e1eb8(0x20a)](_0x8e1eb8(0x1f5)),console[_0x8e1eb8(0x20a)](_0x8e1eb8(0x1e1)),console[_0x8e1eb8(0x20a)](_0x8e1eb8(0x222)),0x1;_0x3501e2[_0x8e1eb8(0x19b)]&&console[_0x8e1eb8(0x20a)](_0x8e1eb8(0x187)+_0x51d350);const _0x5acd8d=await resolveJourneyTarget(_0x51d350,_0x3501e2[_0x8e1eb8(0x220)],_0x3501e2[_0x8e1eb8(0x19b)]),_0x19d752=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x225136[_0x8e1eb8(0x1da)]['resolveParentId'](_0x5acd8d[_0x8e1eb8(0x220)]),{'verbose':_0x3501e2[_0x8e1eb8(0x19b)]}),_0x1531e4=_0x19d752[_0x8e1eb8(0x17c)],_0x1efa39=await withSpinner(_0x8e1eb8(0x193),()=>_0x225136[_0x8e1eb8(0x1ff)][_0x8e1eb8(0x1f8)](_0x1531e4,_0x5acd8d[_0x8e1eb8(0x212)]),{'verbose':_0x3501e2[_0x8e1eb8(0x19b)]}),_0x5da2e2=_0x1efa39['data'];if(_0x3501e2[_0x8e1eb8(0x20f)]){const _0x38a82f=getConsoleNextUrl(_0x3501e2[_0x8e1eb8(0x1ac)],_0x8e1eb8(0x1e5)+_0x1531e4+_0x8e1eb8(0x190)+_0x5da2e2+'/j/da/je');return console[_0x8e1eb8(0x20a)](a18_0x240862[_0x8e1eb8(0x19c)]('✔')+_0x8e1eb8(0x224)+a18_0x240862['cyan'](_0x38a82f)),openBrowser(_0x38a82f),0x0;}const _0x5c9c6a=await withSpinner('Getting\x20journey\x20details...',()=>_0x225136['journey']['getJourney'](_0x5da2e2),{'verbose':_0x3501e2['verbose']}),_0xb3c74=_0x5c9c6a[_0x8e1eb8(0x17c)],_0x104944=_0x3501e2[_0x8e1eb8(0x1ed)];let _0x139cc5;if(_0x104944)try{const _0x119ad9=await withSpinner(_0x8e1eb8(0x1fa),()=>_0x225136[_0x8e1eb8(0x1ff)][_0x8e1eb8(0x223)](_0x5da2e2),{'verbose':_0x3501e2[_0x8e1eb8(0x19b)]});_0x139cc5=_0x119ad9[_0x8e1eb8(0x17c)];}catch{_0x3501e2[_0x8e1eb8(0x19b)]&&console['error'](_0x8e1eb8(0x1cb));}const _0x341f13=getConsoleNextUrl(_0x3501e2[_0x8e1eb8(0x1ac)],_0x8e1eb8(0x1e5)+_0x1531e4+_0x8e1eb8(0x190)+_0x5da2e2+_0x8e1eb8(0x1ef)),_0x9bdbd2={'id':_0xb3c74['id'],'name':_0xb3c74[_0x8e1eb8(0x1a2)][_0x8e1eb8(0x22d)],'description':_0xb3c74[_0x8e1eb8(0x1a2)][_0x8e1eb8(0x165)],'state':_0xb3c74['attributes'][_0x8e1eb8(0x16e)],'paused':_0xb3c74[_0x8e1eb8(0x1a2)][_0x8e1eb8(0x1cf)],'reentry_mode':_0xb3c74[_0x8e1eb8(0x1a2)][_0x8e1eb8(0x162)],'stages':_0xb3c74[_0x8e1eb8(0x1a2)][_0x8e1eb8(0x1e8)]?.[_0x8e1eb8(0x207)]||0x0,..._0xb3c74[_0x8e1eb8(0x1a2)][_0x8e1eb8(0x163)]&&{'goal':_0xb3c74[_0x8e1eb8(0x1a2)][_0x8e1eb8(0x163)]['name']},..._0x139cc5&&{'statistics':{'total_entered':_0x139cc5[_0x8e1eb8(0x18b)],'goal_achieved':_0x139cc5[_0x8e1eb8(0x201)],'goal_rate':_0x139cc5['goalRate'],'stages':_0x139cc5[_0x8e1eb8(0x208)]}},'url':_0x341f13};return await handleSingleObjectOutput(_0x9bdbd2,_0x3501e2),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a18_0x4e85c7(0x22d)]=a18_0x4e85c7(0x168);[a18_0x4e85c7(0x165)]=a18_0x4e85c7(0x1ee);async[a18_0x4e85c7(0x16a)](_0x233265){const _0x58a0ca=a18_0x4e85c7,{options:_0x3a3690,args:_0x4bd820,tdx:_0x5aed8b}=_0x233265,_0x272296=_0x4bd820[0x0];if(!_0x272296)return console[_0x58a0ca(0x20a)](_0x58a0ca(0x20b)),console[_0x58a0ca(0x20a)](_0x58a0ca(0x1e6)),0x1;_0x3a3690[_0x58a0ca(0x19b)]&&console['error'](_0x58a0ca(0x187)+_0x272296);const _0x4dd144=await resolveJourneyTarget(_0x272296,_0x3a3690[_0x58a0ca(0x220)],_0x3a3690[_0x58a0ca(0x19b)]),_0x2c3382=await withSpinner(_0x58a0ca(0x166),()=>_0x5aed8b[_0x58a0ca(0x1da)][_0x58a0ca(0x1c3)](_0x4dd144[_0x58a0ca(0x220)]),{'verbose':_0x3a3690[_0x58a0ca(0x19b)]}),_0x508fc0=_0x2c3382[_0x58a0ca(0x17c)],_0x1f5618=await withSpinner(_0x58a0ca(0x193),()=>_0x5aed8b[_0x58a0ca(0x1ff)][_0x58a0ca(0x1f8)](_0x508fc0,_0x4dd144[_0x58a0ca(0x212)]),{'verbose':_0x3a3690[_0x58a0ca(0x19b)]}),_0x5be799=_0x1f5618[_0x58a0ca(0x17c)],_0x415204=await withSpinner(_0x58a0ca(0x1fa),()=>_0x5aed8b[_0x58a0ca(0x1ff)][_0x58a0ca(0x223)](_0x5be799),{'verbose':_0x3a3690[_0x58a0ca(0x19b)]}),_0x32a173=_0x415204[_0x58a0ca(0x17c)];if(!_0x32a173||_0x32a173['journeyId']===null)return console[_0x58a0ca(0x20a)](_0x58a0ca(0x179)+_0x4dd144['journeyName']),console['error'](_0x58a0ca(0x182)),0x0;const _0xc52837={'journey_id':_0x32a173[_0x58a0ca(0x229)],'total_entered':_0x32a173[_0x58a0ca(0x18b)],'goal_achieved':_0x32a173[_0x58a0ca(0x201)],'goal_rate':_0x32a173[_0x58a0ca(0x202)],'stages':_0x32a173[_0x58a0ca(0x208)]?.[_0x58a0ca(0x219)](_0xc0aa1d=>({'name':_0xc0aa1d[_0x58a0ca(0x164)],'population':_0xc0aa1d['population'],'entered':_0xc0aa1d[_0x58a0ca(0x1a3)],'exited':_0xc0aa1d[_0x58a0ca(0x217)],'conversion_rate':_0xc0aa1d[_0x58a0ca(0x228)]}))},_0x437252=_0x3a3690[_0x58a0ca(0x21e)];if(_0x437252&&_0x32a173['stages']){const _0x45bf3f=_0x32a173[_0x58a0ca(0x208)][_0x58a0ca(0x1bc)](_0x2c4861=>_0x2c4861['stageName'][_0x58a0ca(0x167)]()===_0x437252[_0x58a0ca(0x167)]());if(_0x45bf3f)return await handleSingleObjectOutput({'stage_name':_0x45bf3f[_0x58a0ca(0x164)],'population':_0x45bf3f[_0x58a0ca(0x1ec)],'entered':_0x45bf3f[_0x58a0ca(0x1a3)],'exited':_0x45bf3f[_0x58a0ca(0x217)],'conversion_rate':_0x45bf3f[_0x58a0ca(0x228)]},_0x3a3690),0x0;console[_0x58a0ca(0x20a)](_0x58a0ca(0x1db)+_0x437252+'\x22\x20not\x20found');}return await handleSingleObjectOutput(_0xc52837,_0x3a3690),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a18_0x4e85c7(0x22d)]='journey:pause';['description']=a18_0x4e85c7(0x1b1);async['execute'](_0x5acc94){const _0x23b401=a18_0x4e85c7,{options:_0x42ea45,args:_0x846876,tdx:_0x27f7ca}=_0x5acc94,_0x344907=_0x846876[0x0];if(!_0x344907)return console['error']('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console['error']('Usage:\x20journey\x20pause\x20<name-or-path>'),0x1;_0x42ea45[_0x23b401(0x19b)]&&console[_0x23b401(0x20a)](_0x23b401(0x187)+_0x344907);const _0x5253c8=await resolveJourneyTarget(_0x344907,_0x42ea45['parentSegment'],_0x42ea45['verbose']),_0x40945d=await withSpinner(_0x23b401(0x166),()=>_0x27f7ca[_0x23b401(0x1da)][_0x23b401(0x1c3)](_0x5253c8[_0x23b401(0x220)]),{'verbose':_0x42ea45[_0x23b401(0x19b)]}),_0x488972=_0x40945d['data'],_0x356c1b=await withSpinner('Resolving\x20journey...',()=>_0x27f7ca[_0x23b401(0x1ff)][_0x23b401(0x1f8)](_0x488972,_0x5253c8[_0x23b401(0x212)]),{'verbose':_0x42ea45[_0x23b401(0x19b)]}),_0x124f55=_0x356c1b[_0x23b401(0x17c)];if(!_0x42ea45[_0x23b401(0x21a)]){const _0x3d6546=await confirm(_0x23b401(0x1f7)+_0x5253c8[_0x23b401(0x212)]+'\x22?');if(!_0x3d6546)return console[_0x23b401(0x20a)](_0x23b401(0x1e9)),0x0;}const _0x950021=await withSpinner(_0x23b401(0x1e0),()=>_0x27f7ca[_0x23b401(0x1ff)][_0x23b401(0x191)](_0x124f55),{'verbose':_0x42ea45[_0x23b401(0x19b)]}),_0x57b27b=_0x950021[_0x23b401(0x17c)];return console['error']('✔\x20Journey\x20\x22'+_0x57b27b[_0x23b401(0x1a2)][_0x23b401(0x22d)]+'\x22\x20paused'),0x0;}}export class JourneyResumeCommand extends BaseCommand{['name']=a18_0x4e85c7(0x1f2);[a18_0x4e85c7(0x165)]=a18_0x4e85c7(0x1b2);async[a18_0x4e85c7(0x16a)](_0x45d9f1){const _0x5466d4=a18_0x4e85c7,{options:_0x28c9df,args:_0x4707e9,tdx:_0x43dfb0}=_0x45d9f1,_0x308178=_0x4707e9[0x0];if(!_0x308178)return console['error'](_0x5466d4(0x20b)),console[_0x5466d4(0x20a)](_0x5466d4(0x1fe)),0x1;_0x28c9df[_0x5466d4(0x19b)]&&console[_0x5466d4(0x20a)](_0x5466d4(0x187)+_0x308178);const _0x418129=await resolveJourneyTarget(_0x308178,_0x28c9df[_0x5466d4(0x220)],_0x28c9df[_0x5466d4(0x19b)]),_0x50681b=await withSpinner(_0x5466d4(0x166),()=>_0x43dfb0[_0x5466d4(0x1da)][_0x5466d4(0x1c3)](_0x418129[_0x5466d4(0x220)]),{'verbose':_0x28c9df[_0x5466d4(0x19b)]}),_0x5c04bb=_0x50681b[_0x5466d4(0x17c)],_0x1ec18f=await withSpinner('Resolving\x20journey...',()=>_0x43dfb0[_0x5466d4(0x1ff)][_0x5466d4(0x1f8)](_0x5c04bb,_0x418129[_0x5466d4(0x212)]),{'verbose':_0x28c9df[_0x5466d4(0x19b)]}),_0x27fd0f=_0x1ec18f['data'];if(!_0x28c9df[_0x5466d4(0x21a)]){const _0x1ce1d8=await confirm(_0x5466d4(0x211)+_0x418129['journeyName']+'\x22?');if(!_0x1ce1d8)return console['error'](_0x5466d4(0x1e9)),0x0;}const _0x51463e=await withSpinner(_0x5466d4(0x1ad),()=>_0x43dfb0[_0x5466d4(0x1ff)][_0x5466d4(0x1f4)](_0x27fd0f),{'verbose':_0x28c9df[_0x5466d4(0x19b)]}),_0x49dc3=_0x51463e[_0x5466d4(0x17c)];return console[_0x5466d4(0x20a)](_0x5466d4(0x205)+_0x49dc3['attributes'][_0x5466d4(0x22d)]+_0x5466d4(0x1d0)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a18_0x4e85c7(0x22d)]='journey:pull';['description']='Export\x20journey(s)\x20as\x20YAML\x20files';async[a18_0x4e85c7(0x16a)](_0x456450){const _0xeaf349=a18_0x4e85c7,{options:_0xea5a75,args:_0x58c63b,tdx:_0x2e5a85}=_0x456450,_0x4bec49=_0xea5a75,_0x27b2dd=_0x58c63b[0x0],_0x19eefa=_0x27b2dd&&isYamlFilePath(_0x27b2dd),_0x311121=await resolveTarget({'arg':_0x19eefa?_0x27b2dd:undefined,'contextParent':_0xea5a75[_0xeaf349(0x220)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x311121))return _0x311121[_0xeaf349(0x16f)]===_0xeaf349(0x19d)?(console[_0xeaf349(0x20a)](a18_0x240862['yellow'](_0xeaf349(0x1ba))),console[_0xeaf349(0x20a)]('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)'),console[_0xeaf349(0x20a)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment'),console[_0xeaf349(0x20a)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file'),console[_0xeaf349(0x20a)](_0xeaf349(0x1dd))):(console[_0xeaf349(0x20a)](a18_0x240862[_0xeaf349(0x204)](_0xeaf349(0x21f)+_0x311121[_0xeaf349(0x1c8)]+'\x0a')),_0x311121[_0xeaf349(0x1cc)]&&console['error'](a18_0x240862[_0xeaf349(0x230)](_0x311121[_0xeaf349(0x1cc)]))),0x1;let _0x4b005f=_0x19eefa?undefined:_0x27b2dd,_0x45b4a3,_0x1ecc03;_0x311121['type']===_0xeaf349(0x216)&&(_0x4b005f=_0x311121[_0xeaf349(0x20e)],_0x45b4a3=_0x311121[_0xeaf349(0x1e3)],_0x1ecc03=_0x311121[_0xeaf349(0x1d7)]);const _0x3eec1b=_0x311121[_0xeaf349(0x188)],_0x41cbd8=_0x311121[_0xeaf349(0x20c)];_0x4bec49[_0xeaf349(0x19b)]&&(console[_0xeaf349(0x20a)]('Parent\x20segment:\x20'+_0x3eec1b),console['error'](_0xeaf349(0x1b8)+_0x41cbd8),_0x4b005f&&console[_0xeaf349(0x20a)](_0xeaf349(0x1a5)+_0x4b005f),_0x45b4a3&&console[_0xeaf349(0x20a)](_0xeaf349(0x1e7)+_0x45b4a3),_0x1ecc03&&console['error'](_0xeaf349(0x1d3)+_0x1ecc03));const _0x182499=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x2e5a85[_0xeaf349(0x1da)][_0xeaf349(0x1c3)](_0x3eec1b),{'verbose':_0xea5a75[_0xeaf349(0x19b)]}),_0x435156=_0x182499[_0xeaf349(0x17c)],[_0x30c256,_0x4d6065]=await Promise[_0xeaf349(0x1a9)]([withSpinner('Listing\x20journeys...',()=>_0x2e5a85['journey'][_0xeaf349(0x1a7)](_0x435156,undefined,{'includeAllVersions':!![]}),{'verbose':_0xea5a75[_0xeaf349(0x19b)]}),withSpinner(_0xeaf349(0x1aa),()=>_0x2e5a85[_0xeaf349(0x1da)][_0xeaf349(0x1ea)](_0x435156),{'verbose':_0xea5a75['verbose']})]);let _0x11433d=_0x30c256[_0xeaf349(0x17c)];const _0x4aa599=_0x4d6065['data'],_0x53e76f=buildFolderIdToPathMap(_0x4aa599);if(_0x4b005f){const _0x25e5fe=_0x11433d['filter'](_0x2ba5bd=>_0x2ba5bd[_0xeaf349(0x15f)][_0xeaf349(0x167)]()===_0x4b005f[_0xeaf349(0x167)]());if(_0x25e5fe[_0xeaf349(0x207)]===0x0)return console[_0xeaf349(0x20a)](_0xeaf349(0x1bb)+_0x4b005f),console[_0xeaf349(0x20a)](_0xeaf349(0x16d)),0x1;_0x11433d=_0x25e5fe;}if(_0x1ecc03!==undefined){const _0x4d224d=_0x11433d['filter'](_0x5e9229=>{const _0x1a0f79=_0xeaf349,_0x142b0d=_0x5e9229[_0x1a0f79(0x21d)]?_0x53e76f[_0x1a0f79(0x197)](_0x5e9229[_0x1a0f79(0x21d)])||'':'';return _0x142b0d===_0x1ecc03;});if(_0x4d224d[_0xeaf349(0x207)]===0x0&&_0x11433d['length']>0x0){console['error'](_0xeaf349(0x1a4)+_0x4b005f+_0xeaf349(0x1d4)+(_0x1ecc03||'root\x20folder')),console[_0xeaf349(0x20a)](_0xeaf349(0x181));for(const _0x141f53 of _0x11433d){const _0x470436=_0x141f53[_0xeaf349(0x21d)]?_0x53e76f[_0xeaf349(0x197)](_0x141f53[_0xeaf349(0x21d)])||'':'';console[_0xeaf349(0x20a)](_0xeaf349(0x1d9)+(_0x470436||_0xeaf349(0x232))+'/'+_0x141f53['journeyBundleName']);}return 0x1;}_0x11433d=_0x4d224d;}if(_0x11433d[_0xeaf349(0x207)]===0x0)return console[_0xeaf349(0x20a)](_0xeaf349(0x194)),0x0;const _0x32a4eb=new Map();for(const _0xc5e006 of _0x11433d){const _0x4f7057=_0xc5e006['journeyBundleId'];!_0x32a4eb['has'](_0x4f7057)&&_0x32a4eb[_0xeaf349(0x1f1)](_0x4f7057,[]),_0x32a4eb[_0xeaf349(0x197)](_0x4f7057)[_0xeaf349(0x233)](_0xc5e006);}for(const _0x209c22 of _0x32a4eb[_0xeaf349(0x1a1)]()){_0x209c22[_0xeaf349(0x1bf)]((_0x3db63c,_0x33e95a)=>(_0x3db63c['versionNumber']||0x0)-(_0x33e95a[_0xeaf349(0x214)]||0x0));}const _0x1b29eb=[],[_0x527678,_0x16c2fe]=await Promise[_0xeaf349(0x1a9)]([withSpinner('Fetching\x20users\x20for\x20email\x20resolution...',()=>_0x2e5a85[_0xeaf349(0x18e)][_0xeaf349(0x18c)](),{'verbose':_0xea5a75['verbose']})[_0xeaf349(0x1b6)](_0x7275f7=>_0x7275f7[_0xeaf349(0x17c)]),withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',()=>_0x2e5a85['connection'][_0xeaf349(0x1d2)](),{'verbose':_0xea5a75['verbose']})[_0xeaf349(0x1b6)](_0x525327=>_0x525327[_0xeaf349(0x17c)])]);for(const _0x23d482 of _0x32a4eb['values']()){const _0x127a58=_0x23d482[0x0][_0xeaf349(0x15f)],_0xd7c414=_0x23d482[0x0][_0xeaf349(0x21d)],_0x95316d=_0xd7c414?_0x53e76f[_0xeaf349(0x197)](_0xd7c414)||'':'',_0x10bd57=_0x95316d?a18_0x2f0a39['join'](_0x41cbd8,_0x95316d):_0x41cbd8,_0x2990cc=_0x45b4a3||a18_0x2f0a39[_0xeaf349(0x196)](_0x10bd57,sanitizeFileName(_0x127a58)+'.yml');let _0x44cdcc,_0x73a21c;if(existsSync(_0x2990cc))try{const _0x5c61bf=readFileSync(_0x2990cc,_0xeaf349(0x180)),_0x23744d=parseYamlString(_0x5c61bf);_0x73a21c=_0x23744d,_0x44cdcc=buildRuleToNameMapping(_0x23744d),_0x4bec49[_0xeaf349(0x19b)]&&_0x44cdcc[_0xeaf349(0x1dc)]>0x0&&console['error'](_0xeaf349(0x15a)+_0x44cdcc[_0xeaf349(0x1dc)]+'\x20segment\x20rule(s)\x20to\x20match\x20for\x20'+_0x127a58);}catch(_0x17f27b){_0x4bec49['verbose']&&console[_0xeaf349(0x20a)](_0xeaf349(0x221)+_0x17f27b[_0xeaf349(0x1c8)]);}const _0x23315a=[],_0x47e692=new Set(),_0x4fcb3f=new Map(),_0x5dd4c7=new Map(),_0x45e72a=new Set(),_0x1cad6c=new Map(),_0x1b8cc7=new Map(),_0x5674dc=createJumpTargetCache();await withProgressSpinner(_0xeaf349(0x1df)+_0x127a58+_0xeaf349(0x1a0),async _0x19865b=>{const _0x58b35e=_0xeaf349;for(const _0x183bc9 of _0x23d482){const _0x10a2cc=_0x23d482['length']>0x1?_0x183bc9[_0x58b35e(0x15f)]+'\x20v'+(_0x183bc9[_0x58b35e(0x214)]||0x1):_0x183bc9[_0x58b35e(0x15f)];_0x19865b[_0x58b35e(0x177)](_0x58b35e(0x1df)+_0x10a2cc);const _0x26fc6c=await _0x2e5a85['journey'][_0x58b35e(0x199)](_0x183bc9['id']),_0x3709df=_0x26fc6c[_0x58b35e(0x1a2)]?.['audienceId'],_0x3e73f9={'resolveSegment':async _0x315fcb=>{const _0x2cad6d=_0x58b35e;if(!_0x3709df)return{'name':_0x315fcb,'isJourneyLocal':![]};const _0x1fa97f=_0x4fcb3f[_0x2cad6d(0x197)](_0x315fcb);if(_0x1fa97f)return _0x1fa97f;try{const _0x26cd78=await _0x2e5a85[_0x2cad6d(0x1da)][_0x2cad6d(0x1d1)](_0x3709df,_0x315fcb),_0x229d80=_0x26cd78[_0x2cad6d(0x169)]===SEGMENT_KIND_JOURNEY;let _0x36d56f,_0x178da8=_0x26cd78[_0x2cad6d(0x22d)];if(_0x229d80&&_0x26cd78[_0x2cad6d(0x16b)]){const _0x2c9235=await segmentResponseToDef(_0x26cd78,{'resolveSegmentName':async _0x328525=>{const _0x5d0358=_0x2cad6d,_0x3a8d6e=_0x4fcb3f[_0x5d0358(0x197)](_0x328525);if(_0x3a8d6e)return _0x3a8d6e['name'];const _0x23371d=await _0x3e73f9['resolveSegment'](_0x328525);return _0x23371d[_0x5d0358(0x22d)];}}),_0x5657ba=_0x2c9235[_0x2cad6d(0x16b)];_0x36d56f={'description':_0x26cd78[_0x2cad6d(0x165)],'rule':_0x5657ba};const _0x2ed9ff=serializeRule(_0x5657ba),_0x58bdf1=_0x5dd4c7[_0x2cad6d(0x197)](_0x2ed9ff);if(_0x58bdf1)_0x178da8=_0x58bdf1,_0x36d56f=undefined,_0x4bec49['verbose']&&console[_0x2cad6d(0x20a)](_0x2cad6d(0x195)+_0x26cd78[_0x2cad6d(0x22d)]+_0x2cad6d(0x218)+_0x58bdf1);else{let _0x53b40d=![];if(_0x44cdcc){const _0x13b0d8=_0x44cdcc[_0x2cad6d(0x197)](_0x2ed9ff);if(_0x13b0d8){const _0x4fbe80=_0x13b0d8[_0x2cad6d(0x1bc)](_0x5849bf=>!_0x47e692[_0x2cad6d(0x185)](_0x5849bf));_0x4fbe80&&(_0x178da8=_0x4fbe80,_0x47e692[_0x2cad6d(0x1bd)](_0x4fbe80),_0x5dd4c7[_0x2cad6d(0x1f1)](_0x2ed9ff,_0x4fbe80),_0x53b40d=!![],_0x4bec49[_0x2cad6d(0x19b)]&&console[_0x2cad6d(0x20a)](_0x2cad6d(0x160)+_0x4fbe80+_0x2cad6d(0x1a8)));}}if(!_0x53b40d){const _0x360ad7=generateJourneyLocalName(_0x26cd78[_0x2cad6d(0x22d)]);_0x360ad7&&(_0x178da8=_0x360ad7);let _0x1fc012=_0x178da8,_0x22f3e6=0x2;while(_0x47e692[_0x2cad6d(0x185)](_0x1fc012)){_0x1fc012=_0x178da8+'_'+_0x22f3e6,_0x22f3e6++;}_0x47e692['add'](_0x1fc012),_0x5dd4c7['set'](_0x2ed9ff,_0x1fc012),_0x178da8=_0x1fc012;}}}const _0x1f2f0b={'name':_0x178da8,'isJourneyLocal':_0x229d80,'definition':_0x36d56f};return _0x4fcb3f['set'](_0x315fcb,_0x1f2f0b),_0x1f2f0b;}catch(_0x1d9edb){return _0xea5a75[_0x2cad6d(0x19b)]&&console[_0x2cad6d(0x20a)]('Warning:\x20Could\x20not\x20resolve\x20segment\x20'+_0x315fcb+':\x20'+_0x1d9edb[_0x2cad6d(0x1c8)]),{'name':_0x315fcb,'isJourneyLocal':![]};}},'resolveActivation':async _0x4bb593=>{const _0x3f2e25=_0x58b35e,_0x5ef233=_0x1cad6c[_0x3f2e25(0x197)](_0x4bb593);if(_0x5ef233)return _0x5ef233;try{const _0x332195=await _0x2e5a85[_0x3f2e25(0x1ff)][_0x3f2e25(0x1f9)](_0x183bc9['id'],_0x4bb593),_0x434402=journeyActivationStepToYaml(_0x332195,_0x527678,_0x16c2fe),_0x3d9168=JSON[_0x3f2e25(0x19e)]({'name':_0x434402[_0x3f2e25(0x22d)],'connection':_0x434402[_0x3f2e25(0x1ab)],'connector_config':_0x434402[_0x3f2e25(0x1c9)]}),_0x4dca87=_0x1b8cc7[_0x3f2e25(0x197)](_0x3d9168);if(_0x4dca87){const _0x24fb05={'name':_0x4dca87,'isJourneyLocal':!![],'definition':_0x434402};return _0x1cad6c[_0x3f2e25(0x1f1)](_0x4bb593,_0x24fb05),_0x24fb05;}const _0x152df1=_0x332195[_0x3f2e25(0x1a2)]['activationParams'][_0x3f2e25(0x22d)]||_0x4bb593,_0x450d03=sanitizeYamlKey(_0x152df1)||_0x3f2e25(0x171)+_0x4bb593;let _0x17addf=_0x450d03,_0x391386=0x2;while(_0x45e72a['has'](_0x17addf)){_0x17addf=_0x450d03+'_'+_0x391386,_0x391386++;}_0x45e72a[_0x3f2e25(0x1bd)](_0x17addf),_0x1b8cc7[_0x3f2e25(0x1f1)](_0x3d9168,_0x17addf);const _0x97f84b={'name':_0x17addf,'isJourneyLocal':!![],'definition':_0x434402};return _0x1cad6c['set'](_0x4bb593,_0x97f84b),_0x97f84b;}catch(_0x11cce7){return _0xea5a75[_0x3f2e25(0x19b)]&&console[_0x3f2e25(0x20a)](_0x3f2e25(0x172)+_0x4bb593+':\x20'+_0x11cce7[_0x3f2e25(0x1c8)]),{'name':_0x4bb593,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x3a7b01,_0x26f568)=>{const _0x1672b9=_0x58b35e;return resolveJumpTarget(_0x3a7b01,_0x26f568,_0x5674dc,_0x4ce197=>_0x2e5a85[_0x1672b9(0x1ff)]['getJourney'](_0x4ce197));}},_0x57edce=await journeyResponseToDef(_0x26fc6c,_0x3e73f9);_0x23315a['push']({'item':_0x183bc9,'yaml':_0x57edce});}},{'verbose':_0xea5a75[_0xeaf349(0x19b)]});const _0x14e0e3=buildMergedJourneyDef(_0x23315a,_0x44cdcc),_0x758141=normalizeJourneyDef(_0x14e0e3,_0x73a21c),_0xaef616=toYamlString(_0x758141),_0xfc828b=_0x45b4a3||a18_0x2f0a39[_0xeaf349(0x196)](_0x10bd57,sanitizeFileName(_0x127a58)+_0xeaf349(0x210));!_0x45b4a3&&_0x95316d&&!existsSync(_0x10bd57)&&mkdirSync(_0x10bd57,{'recursive':!![]});const _0x35ebc9=a18_0x2f0a39[_0xeaf349(0x206)](process[_0xeaf349(0x17b)](),_0xfc828b);if(existsSync(_0xfc828b)){const _0x4abc98=readFileSync(_0xfc828b,_0xeaf349(0x180)),_0x1ef6a3=generateDiff(_0x4abc98,_0xaef616),_0x499935=hasChanges(_0x1ef6a3);_0x1b29eb[_0xeaf349(0x233)]({'relativePath':_0x35ebc9,'absolutePath':_0xfc828b,'content':_0xaef616,'isNew':![],'hasChanges':_0x499935,'diff':_0x499935?formatDiffWithColors(_0x1ef6a3):undefined});}else _0x1b29eb[_0xeaf349(0x233)]({'relativePath':_0x35ebc9,'absolutePath':_0xfc828b,'content':_0xaef616,'isNew':!![],'hasChanges':![]});}const _0x2b2d8e=_0x1b29eb[_0xeaf349(0x184)](_0x3f0e6b=>_0x3f0e6b[_0xeaf349(0x1b0)]),_0x286be7=_0x1b29eb[_0xeaf349(0x184)](_0x29a229=>!_0x29a229[_0xeaf349(0x1b0)]&&_0x29a229[_0xeaf349(0x1c2)]),_0x3c33f7=_0x1b29eb['filter'](_0x309548=>!_0x309548['isNew']&&!_0x309548['hasChanges']),_0x3875d5=_0x11433d[_0xeaf349(0x207)],_0xfcdd29=_0x32a4eb[_0xeaf349(0x1dc)],_0xc11c34=_0x3875d5>_0xfcdd29?'\x20('+_0x3875d5+_0xeaf349(0x17e):'';console[_0xeaf349(0x20a)]('\x0aPull\x20summary:'),console['error']('\x20\x20'+a18_0x240862[_0xeaf349(0x230)](_0xfcdd29+_0xeaf349(0x1ae))+a18_0x240862[_0xeaf349(0x1f6)](_0xc11c34)),console[_0xeaf349(0x20a)]('\x20\x20'+a18_0x240862[_0xeaf349(0x19c)]('+\x20'+_0x2b2d8e[_0xeaf349(0x207)]+_0xeaf349(0x1fc))),console['error']('\x20\x20'+a18_0x240862['yellow']('~\x20'+_0x286be7['length']+'\x20changed\x20files')),console['error']('\x20\x20'+a18_0x240862[_0xeaf349(0x1f6)]('=\x20'+_0x3c33f7[_0xeaf349(0x207)]+_0xeaf349(0x1d8))),console[_0xeaf349(0x20a)]('\x20\x20Target:\x20'+a18_0x240862[_0xeaf349(0x230)](_0x41cbd8)+'\x0a');if(_0x286be7['length']>0x0)for(const _0x4cc862 of _0x286be7){console[_0xeaf349(0x20a)](_0xeaf349(0x1c6)+_0x4cc862[_0xeaf349(0x19a)]+'\x27:'),console['error']('─'[_0xeaf349(0x1f3)](0x3c)),console['error'](_0x4cc862['diff']),console['error']('─'[_0xeaf349(0x1f3)](0x3c));}if(_0x4bec49[_0xeaf349(0x1c0)])return console[_0xeaf349(0x20a)](a18_0x240862[_0xeaf349(0x203)](_0xeaf349(0x22f))),0x0;if(_0x2b2d8e[_0xeaf349(0x207)]===0x0&&_0x286be7[_0xeaf349(0x207)]===0x0)return console['error'](a18_0x240862[_0xeaf349(0x19c)](_0xeaf349(0x21b))),saveSessionContext({'parent_segment':_0x3eec1b},_0x4bec49[_0xeaf349(0x173)]),console['error'](a18_0x240862[_0xeaf349(0x19c)](_0xeaf349(0x1d5)+a18_0x240862[_0xeaf349(0x1f6)]('parent_segment')+_0xeaf349(0x1c5)+a18_0x240862[_0xeaf349(0x230)](_0x3eec1b))),0x0;if(!_0x4bec49['yes']&&(_0x2b2d8e[_0xeaf349(0x207)]>0x0||_0x286be7[_0xeaf349(0x207)]>0x0)){const _0x3effda=await confirmKey(_0xeaf349(0x1e4)+(_0x2b2d8e[_0xeaf349(0x207)]+_0x286be7[_0xeaf349(0x207)])+_0xeaf349(0x17f));if(!_0x3effda)return console['error']('Aborted.'),0x1;}!existsSync(_0x41cbd8)&&mkdirSync(_0x41cbd8,{'recursive':!![]});for(const _0x31b445 of _0x1b29eb){(_0x31b445[_0xeaf349(0x1b0)]||_0x31b445['hasChanges'])&&writeFileSync(_0x31b445['absolutePath'],_0x31b445[_0xeaf349(0x1cd)],_0xeaf349(0x180));}return console[_0xeaf349(0x20a)](a18_0x240862[_0xeaf349(0x19c)](_0xeaf349(0x22b)+(_0x2b2d8e[_0xeaf349(0x207)]+_0x286be7[_0xeaf349(0x207)])+_0xeaf349(0x192)+_0x41cbd8)),saveSessionContext({'parent_segment':_0x3eec1b},_0x4bec49['session']),console['error'](a18_0x240862[_0xeaf349(0x19c)]('✔\x20Context\x20set:\x20'+a18_0x240862[_0xeaf349(0x1f6)]('parent_segment')+'\x20=\x20'+a18_0x240862[_0xeaf349(0x230)](_0x3eec1b))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a18_0x4e85c7(0x22d)]=a18_0x4e85c7(0x1fd);['description']=a18_0x4e85c7(0x1d6);[a18_0x4e85c7(0x15d)]=new SegmentPushCommand();async[a18_0x4e85c7(0x16a)](_0x4d3e69){const _0x51ec42=a18_0x4e85c7,_0xc62600=_0x4d3e69[_0x51ec42(0x15c)][0x0];let _0x2415b4;if(_0xc62600){const _0xace59c=await resolveTarget({'arg':_0xc62600,'contextParent':_0x4d3e69[_0x51ec42(0x22c)][_0x51ec42(0x220)],'cwd':process[_0x51ec42(0x17b)]()});isSuccessfulResolution(_0xace59c)&&_0xace59c[_0x51ec42(0x19f)]===_0x51ec42(0x216)&&(_0x2415b4=_0xace59c[_0x51ec42(0x1e3)]);}const _0x3cb617={..._0x4d3e69,'options':{..._0x4d3e69[_0x51ec42(0x22c)],'journeysOnly':!![],..._0x2415b4&&{'singleFilePath':_0x2415b4}}};return this[_0x51ec42(0x15d)]['execute'](_0x3cb617);}}
@@ -1 +1 @@
1
- const a19_0x408f64=a19_0x56ad;(function(_0x9bd6d,_0x3f73a6){const _0x27b498=a19_0x56ad,_0x5375e6=_0x9bd6d();while(!![]){try{const _0x48b765=parseInt(_0x27b498(0x147))/0x1+-parseInt(_0x27b498(0x146))/0x2+-parseInt(_0x27b498(0x16f))/0x3*(-parseInt(_0x27b498(0x163))/0x4)+parseInt(_0x27b498(0x14e))/0x5+-parseInt(_0x27b498(0x165))/0x6*(-parseInt(_0x27b498(0x14c))/0x7)+-parseInt(_0x27b498(0x16e))/0x8*(parseInt(_0x27b498(0x162))/0x9)+-parseInt(_0x27b498(0x164))/0xa*(parseInt(_0x27b498(0x15b))/0xb);if(_0x48b765===_0x3f73a6)break;else _0x5375e6['push'](_0x5375e6['shift']());}catch(_0x26f83b){_0x5375e6['push'](_0x5375e6['shift']());}}}(a19_0x4c99,0x6b78e));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';function a19_0x56ad(_0x4e0db8,_0xd94b8d){_0x4e0db8=_0x4e0db8-0x139;const _0x4c99a0=a19_0x4c99();let _0x56adb3=_0x4c99a0[_0x4e0db8];return _0x56adb3;}import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a19_0x1eb0db from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';function a19_0x4c99(){const _0x1edf7d=['No\x20journey\x20YAML\x20files\x20found\x20in\x20','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','cyan','1084648kzpRdn','14990RwxvCN','no_parent','\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','targetDir','yellow','231665iriKlb','skippedCount','722945GOzUXg','dim','\x20valid','invalidCount','\x20segment\x20file(s)\x20skipped','filter','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','\x20journey(s)\x20valid','errorCode','Error:\x20','\x20segment\x20file(s)\x20skipped)','red','error','671qNkWHe','.yml','endsWith','file','validCount','name','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','2151ldgEnp','230956brfFBk','71560ntsegZ','156rsYKXb','message','errors','.yaml','\x20warning(s)\x20found','length','Validate\x20journey\x20YAML\x20files','helpText','Error:\x20Directory\x20not\x20found:\x20','7904wfwlch','33raQmor','warnings','warningCount','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Validation\x20failed:\x20','\x20(skipped:\x20','log','filePath','description','relativePath','✔\x20All\x20','green','verbose'];a19_0x4c99=function(){return _0x1edf7d;};return a19_0x4c99();}import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class JourneyValidateCommand extends BaseCommand{[a19_0x408f64(0x160)]='journey:validate';[a19_0x408f64(0x13e)]=a19_0x408f64(0x16b);async['execute'](_0x252e7a){const _0x1f6602=a19_0x408f64,{options:_0x39b500,args:_0x53d348}=_0x252e7a,_0x41c46e=_0x39b500,_0x2ea445=await resolveTarget({'arg':_0x53d348[0x0],'contextParent':_0x39b500['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x2ea445))return _0x2ea445[_0x1f6602(0x156)]===_0x1f6602(0x148)?(console[_0x1f6602(0x15a)](a19_0x1eb0db['yellow'](_0x1f6602(0x139))),console[_0x1f6602(0x15a)](_0x1f6602(0x154)),console['error'](_0x1f6602(0x149)),console[_0x1f6602(0x15a)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file')):(console[_0x1f6602(0x15a)](a19_0x1eb0db[_0x1f6602(0x159)](_0x1f6602(0x157)+_0x2ea445[_0x1f6602(0x166)]+'\x0a')),_0x2ea445[_0x1f6602(0x16c)]&&console[_0x1f6602(0x15a)](a19_0x1eb0db[_0x1f6602(0x145)](_0x2ea445[_0x1f6602(0x16c)]))),0x1;const _0x4fb9f7=_0x2ea445[_0x1f6602(0x14a)],_0xf2ab17=_0x2ea445['type']===_0x1f6602(0x15e)?_0x2ea445[_0x1f6602(0x13d)]:undefined;if(!_0xf2ab17&&!existsSync(_0x4fb9f7))return console[_0x1f6602(0x15a)](a19_0x1eb0db[_0x1f6602(0x159)](_0x1f6602(0x16d)+_0x4fb9f7+'\x0a')),0x1;let _0x5c8a9e;if(_0xf2ab17){if(!_0xf2ab17[_0x1f6602(0x15d)](_0x1f6602(0x15c))&&!_0xf2ab17[_0x1f6602(0x15d)](_0x1f6602(0x168)))return console[_0x1f6602(0x15a)](a19_0x1eb0db[_0x1f6602(0x159)](_0x1f6602(0x161)+_0xf2ab17+'\x0a')),0x1;_0x5c8a9e=[_0xf2ab17];}else _0x5c8a9e=findYamlFiles(_0x4fb9f7);if(_0x5c8a9e[_0x1f6602(0x16a)]===0x0)return console[_0x1f6602(0x15a)](a19_0x1eb0db[_0x1f6602(0x159)](_0x1f6602(0x144)+_0x4fb9f7+'\x0a')),0x1;const _0x15bdc1=validateYamlFiles(_0x5c8a9e,_0x4fb9f7,{'filterType':'journey'}),_0x675c8=calculateSummary(_0x15bdc1),_0x579330=_0x15bdc1[_0x1f6602(0x153)](isValidationResult);if(_0x579330[_0x1f6602(0x16a)]===0x0)return console[_0x1f6602(0x15a)](a19_0x1eb0db[_0x1f6602(0x14b)](_0x1f6602(0x143)+_0x4fb9f7+'\x0a')),_0x675c8[_0x1f6602(0x14d)]>0x0&&console[_0x1f6602(0x15a)](a19_0x1eb0db['dim']('('+_0x675c8[_0x1f6602(0x14d)]+_0x1f6602(0x158))),0x0;for(const _0x4d1192 of _0x15bdc1){if(!isValidationResult(_0x4d1192)){_0x41c46e[_0x1f6602(0x142)]&&console[_0x1f6602(0x13c)](a19_0x1eb0db[_0x1f6602(0x14f)]('-\x20'+_0x4d1192[_0x1f6602(0x13f)]+_0x1f6602(0x13b)+_0x4d1192['reason']+')'));continue;}const {relativePath:_0x110c90,source:_0x53574e,result:_0xd633aa}=_0x4d1192;if(_0xd633aa['valid']&&_0xd633aa[_0x1f6602(0x170)][_0x1f6602(0x16a)]===0x0)_0x41c46e['verbose']&&console[_0x1f6602(0x13c)](a19_0x1eb0db['green']('✔\x20'+_0x110c90));else _0xd633aa['valid']?(console[_0x1f6602(0x13c)](a19_0x1eb0db[_0x1f6602(0x14b)]('⚠\x20'+_0x110c90+':\x20'+_0xd633aa['warnings'][_0x1f6602(0x16a)]+'\x20warning(s)')),console[_0x1f6602(0x13c)](formatValidationResult(_0xd633aa,_0x53574e,_0x110c90))):(console[_0x1f6602(0x13c)](a19_0x1eb0db[_0x1f6602(0x159)]('✖\x20'+_0x110c90+':\x20'+_0xd633aa[_0x1f6602(0x167)]['length']+'\x20error(s)')),console[_0x1f6602(0x13c)](formatValidationResult(_0xd633aa,_0x53574e,_0x110c90)));}return console[_0x1f6602(0x13c)](''),_0x675c8['hasErrors']?(console[_0x1f6602(0x13c)](a19_0x1eb0db[_0x1f6602(0x159)](_0x1f6602(0x13a)+_0x675c8[_0x1f6602(0x151)]+'\x20journey(s)\x20with\x20errors,\x20'+_0x675c8[_0x1f6602(0x15f)]+_0x1f6602(0x150))),_0x675c8[_0x1f6602(0x171)]>0x0&&console[_0x1f6602(0x13c)](a19_0x1eb0db[_0x1f6602(0x14b)](_0x675c8[_0x1f6602(0x171)]+_0x1f6602(0x169))),_0x675c8[_0x1f6602(0x14d)]>0x0&&console[_0x1f6602(0x13c)](a19_0x1eb0db[_0x1f6602(0x14f)](_0x675c8[_0x1f6602(0x14d)]+_0x1f6602(0x152))),0x1):(console[_0x1f6602(0x13c)](a19_0x1eb0db[_0x1f6602(0x141)](_0x1f6602(0x140)+_0x675c8[_0x1f6602(0x15f)]+_0x1f6602(0x155))),_0x675c8[_0x1f6602(0x171)]>0x0&&console[_0x1f6602(0x13c)](a19_0x1eb0db['yellow'](_0x675c8['warningCount']+_0x1f6602(0x169))),_0x675c8[_0x1f6602(0x14d)]>0x0&&console['log'](a19_0x1eb0db[_0x1f6602(0x14f)](_0x675c8[_0x1f6602(0x14d)]+_0x1f6602(0x152))),0x0);}}
1
+ const a19_0x2ae75a=a19_0x5123;(function(_0x29660e,_0xa03e20){const _0x13d3db=a19_0x5123,_0x27d74e=_0x29660e();while(!![]){try{const _0x338bd5=parseInt(_0x13d3db(0x13a))/0x1*(-parseInt(_0x13d3db(0x10e))/0x2)+-parseInt(_0x13d3db(0x127))/0x3*(parseInt(_0x13d3db(0x10a))/0x4)+-parseInt(_0x13d3db(0x119))/0x5*(parseInt(_0x13d3db(0x139))/0x6)+-parseInt(_0x13d3db(0x128))/0x7+-parseInt(_0x13d3db(0x130))/0x8+-parseInt(_0x13d3db(0x140))/0x9*(-parseInt(_0x13d3db(0x137))/0xa)+parseInt(_0x13d3db(0x10f))/0xb*(parseInt(_0x13d3db(0x108))/0xc);if(_0x338bd5===_0xa03e20)break;else _0x27d74e['push'](_0x27d74e['shift']());}catch(_0x314f32){_0x27d74e['push'](_0x27d74e['shift']());}}}(a19_0x5f40,0x48616));function a19_0x5f40(){const _0x2f8d4b=['1262YsSQYu','110URyBkN','reason','warningCount','length','Validate\x20journey\x20YAML\x20files','name','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','execute','red','message','10gtYfeo','No\x20journey\x20YAML\x20files\x20found\x20in\x20','skippedCount','\x20segment\x20file(s)\x20skipped','\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','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','\x20valid','journey:validate','parentSegment','warnings','log','validCount','Error:\x20Directory\x20not\x20found:\x20','Error:\x20','6693UtAPSG','3377045dmQTYM','error','helpText','invalidCount','Validation\x20failed:\x20','errorCode','\x20segment\x20file(s)\x20skipped)','yellow','2926936fgvTwE','dim','.yaml','type','filter','filePath','valid','849350dkSCWz','✔\x20All\x20','562404AckfMj','566mwCrgb','cwd','\x20warning(s)\x20found','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','relativePath','.yml','9SxpUzk','no_parent','2217156rjCxqN','journey','436cbEIJa','cyan','description','green'];a19_0x5f40=function(){return _0x2f8d4b;};return a19_0x5f40();}import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';function a19_0x5123(_0x23fa71,_0x3acc89){_0x23fa71=_0x23fa71-0x107;const _0x5f408b=a19_0x5f40();let _0x5123d7=_0x5f408b[_0x23fa71];return _0x5123d7;}import{existsSync}from'fs';import a19_0x2a42b8 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{[a19_0x2ae75a(0x114)]=a19_0x2ae75a(0x120);[a19_0x2ae75a(0x10c)]=a19_0x2ae75a(0x113);async[a19_0x2ae75a(0x116)](_0x58fe3a){const _0x3b9e7d=a19_0x2ae75a,{options:_0x3557dd,args:_0x4adc94}=_0x58fe3a,_0xd9fd8c=_0x3557dd,_0x1f5968=await resolveTarget({'arg':_0x4adc94[0x0],'contextParent':_0x3557dd[_0x3b9e7d(0x121)],'cwd':process[_0x3b9e7d(0x13b)]()});if(!isSuccessfulResolution(_0x1f5968))return _0x1f5968[_0x3b9e7d(0x12d)]===_0x3b9e7d(0x107)?(console[_0x3b9e7d(0x129)](a19_0x2a42b8[_0x3b9e7d(0x12f)](_0x3b9e7d(0x11e))),console[_0x3b9e7d(0x129)]('Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)'),console[_0x3b9e7d(0x129)](_0x3b9e7d(0x11d)),console['error'](_0x3b9e7d(0x13d))):(console['error'](a19_0x2a42b8[_0x3b9e7d(0x117)](_0x3b9e7d(0x126)+_0x1f5968[_0x3b9e7d(0x118)]+'\x0a')),_0x1f5968[_0x3b9e7d(0x12a)]&&console[_0x3b9e7d(0x129)](a19_0x2a42b8[_0x3b9e7d(0x10b)](_0x1f5968['helpText']))),0x1;const _0x360a2c=_0x1f5968['targetDir'],_0x5faa4a=_0x1f5968[_0x3b9e7d(0x133)]==='file'?_0x1f5968[_0x3b9e7d(0x135)]:undefined;if(!_0x5faa4a&&!existsSync(_0x360a2c))return console[_0x3b9e7d(0x129)](a19_0x2a42b8[_0x3b9e7d(0x117)](_0x3b9e7d(0x125)+_0x360a2c+'\x0a')),0x1;let _0x511ebb;if(_0x5faa4a){if(!_0x5faa4a['endsWith'](_0x3b9e7d(0x13f))&&!_0x5faa4a['endsWith'](_0x3b9e7d(0x132)))return console['error'](a19_0x2a42b8[_0x3b9e7d(0x117)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x5faa4a+'\x0a')),0x1;_0x511ebb=[_0x5faa4a];}else _0x511ebb=findYamlFiles(_0x360a2c);if(_0x511ebb[_0x3b9e7d(0x112)]===0x0)return console[_0x3b9e7d(0x129)](a19_0x2a42b8[_0x3b9e7d(0x117)](_0x3b9e7d(0x115)+_0x360a2c+'\x0a')),0x1;const _0xdd42f3=validateYamlFiles(_0x511ebb,_0x360a2c,{'filterType':_0x3b9e7d(0x109)}),_0x32d522=calculateSummary(_0xdd42f3),_0x167ef9=_0xdd42f3[_0x3b9e7d(0x134)](isValidationResult);if(_0x167ef9['length']===0x0)return console[_0x3b9e7d(0x129)](a19_0x2a42b8[_0x3b9e7d(0x12f)](_0x3b9e7d(0x11a)+_0x360a2c+'\x0a')),_0x32d522['skippedCount']>0x0&&console['error'](a19_0x2a42b8[_0x3b9e7d(0x131)]('('+_0x32d522[_0x3b9e7d(0x11b)]+_0x3b9e7d(0x12e))),0x0;for(const _0x530c91 of _0xdd42f3){if(!isValidationResult(_0x530c91)){_0xd9fd8c['verbose']&&console['log'](a19_0x2a42b8[_0x3b9e7d(0x131)]('-\x20'+_0x530c91[_0x3b9e7d(0x13e)]+'\x20(skipped:\x20'+_0x530c91[_0x3b9e7d(0x110)]+')'));continue;}const {relativePath:_0x1671b0,source:_0x479c6d,result:_0x3d9a27}=_0x530c91;if(_0x3d9a27[_0x3b9e7d(0x136)]&&_0x3d9a27[_0x3b9e7d(0x122)][_0x3b9e7d(0x112)]===0x0)_0xd9fd8c['verbose']&&console['log'](a19_0x2a42b8[_0x3b9e7d(0x10d)]('✔\x20'+_0x1671b0));else _0x3d9a27[_0x3b9e7d(0x136)]?(console[_0x3b9e7d(0x123)](a19_0x2a42b8[_0x3b9e7d(0x12f)]('⚠\x20'+_0x1671b0+':\x20'+_0x3d9a27[_0x3b9e7d(0x122)][_0x3b9e7d(0x112)]+'\x20warning(s)')),console[_0x3b9e7d(0x123)](formatValidationResult(_0x3d9a27,_0x479c6d,_0x1671b0))):(console['log'](a19_0x2a42b8[_0x3b9e7d(0x117)]('✖\x20'+_0x1671b0+':\x20'+_0x3d9a27['errors'][_0x3b9e7d(0x112)]+'\x20error(s)')),console[_0x3b9e7d(0x123)](formatValidationResult(_0x3d9a27,_0x479c6d,_0x1671b0)));}return console['log'](''),_0x32d522['hasErrors']?(console[_0x3b9e7d(0x123)](a19_0x2a42b8['red'](_0x3b9e7d(0x12c)+_0x32d522[_0x3b9e7d(0x12b)]+'\x20journey(s)\x20with\x20errors,\x20'+_0x32d522[_0x3b9e7d(0x124)]+_0x3b9e7d(0x11f))),_0x32d522[_0x3b9e7d(0x111)]>0x0&&console[_0x3b9e7d(0x123)](a19_0x2a42b8[_0x3b9e7d(0x12f)](_0x32d522[_0x3b9e7d(0x111)]+'\x20warning(s)\x20found')),_0x32d522[_0x3b9e7d(0x11b)]>0x0&&console[_0x3b9e7d(0x123)](a19_0x2a42b8[_0x3b9e7d(0x131)](_0x32d522[_0x3b9e7d(0x11b)]+_0x3b9e7d(0x11c))),0x1):(console['log'](a19_0x2a42b8[_0x3b9e7d(0x10d)](_0x3b9e7d(0x138)+_0x32d522['validCount']+'\x20journey(s)\x20valid')),_0x32d522[_0x3b9e7d(0x111)]>0x0&&console[_0x3b9e7d(0x123)](a19_0x2a42b8[_0x3b9e7d(0x12f)](_0x32d522[_0x3b9e7d(0x111)]+_0x3b9e7d(0x13c))),_0x32d522[_0x3b9e7d(0x11b)]>0x0&&console[_0x3b9e7d(0x123)](a19_0x2a42b8[_0x3b9e7d(0x131)](_0x32d522[_0x3b9e7d(0x11b)]+'\x20segment\x20file(s)\x20skipped')),0x0);}}
@@ -1 +1 @@
1
- const a20_0x5c60f0=a20_0x58cf;(function(_0x1ad4ff,_0x44e8e7){const _0x29c613=a20_0x58cf,_0x4d0c59=_0x1ad4ff();while(!![]){try{const _0x579495=parseInt(_0x29c613(0x212))/0x1*(parseInt(_0x29c613(0x1fe))/0x2)+parseInt(_0x29c613(0x27e))/0x3+parseInt(_0x29c613(0x1df))/0x4*(-parseInt(_0x29c613(0x268))/0x5)+-parseInt(_0x29c613(0x1d5))/0x6+parseInt(_0x29c613(0x257))/0x7+-parseInt(_0x29c613(0x27a))/0x8*(parseInt(_0x29c613(0x20c))/0x9)+parseInt(_0x29c613(0x261))/0xa;if(_0x579495===_0x44e8e7)break;else _0x4d0c59['push'](_0x4d0c59['shift']());}catch(_0x4a13ba){_0x4d0c59['push'](_0x4d0c59['shift']());}}}(a20_0x3687,0x8d256));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../core/command-output.js';function a20_0x3687(){const _0x5ae69a=['(no\x20agent)','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','agents','log','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','filter','\x20\x20\x20Examples:','Unknown','267489WANHpB','getBackupMetadata','Error:\x20Project\x20name\x20is\x20required','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.','targetWebSearchTool','existsSync','7LMoxuD','chats','chatId','\x20\x20Cause:\x20','\x27...','exportedFrom','Restore\x20cancelled.','List\x20available\x20LLM\x20models','\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.','Backup\x20cancelled.','targetKnowledgeBase','Fetching\x20available\x20models...','INVALID_ARGUMENT','prompt','jsonl','(no\x20message)','⚒️\x20','Getting\x20default\x20project...','history','getCurrentProject','sort','Fetching\x20chat\x20sessions...','Backing\x20up\x20project\x20\x27','targetImageGenerator','content','\x20\x20Integrations:\x20','Invalid\x20path\x20syntax:\x20','integrations','numeric','\x20\x20Knowledge\x20Bases:\x20','Error:\x20Agent\x20name\x20is\x20required','cause','Error:\x20','message','deleteProject','llmProject','join','h\x20ago','llm:agent:delete','...','find','dim','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','site','tool','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','Delete\x20an\x20LLM\x20project','\x20agent(s)','Resolving\x20agent\x20\x27','Project\x20not\x20found:\x20','[error]\x20\x20','format','localeCompare','string','tsv','Show\x20agent\x20details','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','keys','\x20\x20Agents:\x20','stringify','targetAgent','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','Use\x20format:\x20project-name/agent-name','includes','Set\x20current\x20project\x20context','\x0aStack\x20trace:','Project\x20restored:\x20','updateAgent','2501618FUInCq','Fetching\x20chat\x20history\x20for\x20\x27','cyan','.llm','firstInputContent','Update\x20an\x20existing\x20agent','toLocaleDateString','dryRun','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','updatedAt','6520990zmRnGk','set','createdAt','Load\x20more...','llm:agent:show','No\x20messages\x20found\x20in\x20chat\x20history.','Project\x20context\x20set\x20to:\x20','1803845XgtRMd','attributes','Project\x20created:\x20','knowledgeBases','name','agentId','length','tdx\x20chats','restoreProject','llm:agent:create','\x20->\x20ImageGen:','getOrCreateDefaultProject','counts','prompts','Select\x20a\x20chat\x20session:','[image]\x20\x20','Create\x20a\x20new\x20LLM\x20project','No\x20agents\x20found','216CbyzXs','resolveProjectId','[input]\x20\x20','llm:project:create','1288533qKurLw','LLM_PROJECT_NOT_FOUND','resolveAgentId','🤖\x20','llm:project:delete','llm:projects','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','stack','\x20bytes)','Restoring\x20project\x20from\x20\x27','Creating\x20project\x20\x27','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.','input','backupProject','limit','claude-4.5-haiku','red','data','agent','Creating\x20agent\x20\x27','No\x20projects\x20found','map','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','llm','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','short','projects','split','rmSync','bold','Fetching\x20agent...','No\x20chat\x20sessions\x20found.','verbose','Create\x20a\x20new\x20agent\x20in\x20current\x20project','get','push','\x20--last','tool_call','setCurrentProject','Output\x20directory\x20\x27','\x20project(s)','toLowerCase','yes','table','magenta','\x20->\x20KB:','temperature','maxToolIterations','error','just\x20now','3411702NmIfQP','description','\x27\x20already\x20exists.\x20Overwrite?','m\x20ago','getTime','createProject','\x20→\x20chat:\x20','Project\x20backed\x20up\x20to:\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','all','4LhwXYw','floor','\x20\x20Prompts:\x20','llm:history','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','tdx\x20llm\x20history','Fetching\x20projects...','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','Deleting\x20project\x20\x27','blue','Agent\x20created:\x20','lastConversationAt','Checking\x20for\x20existing\x20projects...','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','Analyzing\x20project\x20\x27','Delete\x20an\x20agent','execute','Agent\x20deleted:\x20','__load_more__','projectName','[unknown]','Setting\x20project\x20context\x20to\x20\x27','[tool]\x20\x20\x20','systemPrompt','yellow','en-US','starterMessage','llm:use','json','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','deleteAgent','248858JfXMlu','image','[tool_call]','output','outputDir'];a20_0x3687=function(){return _0x5ae69a;};return a20_0x3687();}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{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import*as a20_0x42782c from'node:fs';function handleSDKError(_0x53b350,_0x1fb5d1){const _0x11d9b5=a20_0x58cf;if(_0x53b350 instanceof SDKError)console[_0x11d9b5(0x1d3)](_0x11d9b5(0x232)+_0x53b350[_0x11d9b5(0x233)]),_0x1fb5d1[_0x11d9b5(0x29e)]&&(_0x53b350['cause']&&console[_0x11d9b5(0x1d3)](_0x11d9b5(0x215)+_0x53b350[_0x11d9b5(0x231)]),_0x53b350[_0x11d9b5(0x285)]&&(console['error'](_0x11d9b5(0x254)),console[_0x11d9b5(0x1d3)](_0x53b350[_0x11d9b5(0x285)])));else throw _0x53b350;}function formatChatHistoryEntry(_0x3dcf69,_0x3381e2){const _0x4a1a87=a20_0x58cf,_0x16d3e6=getChalk(_0x3381e2),_0x509b49=_0x16d3e6[_0x4a1a87(0x23b)](_0x3dcf69['at']);if(_0x4a1a87(0x28a)in _0x3dcf69){const _0x2f1244=_0x16d3e6[_0x4a1a87(0x259)](_0x4a1a87(0x27c));return _0x509b49+'\x20'+_0x2f1244+':\x20'+_0x3dcf69['input'];}if('content'in _0x3dcf69){const _0x161675=_0x16d3e6['green']('[content]');return _0x509b49+'\x20'+_0x161675+':\x20'+_0x3dcf69[_0x4a1a87(0x22a)];}if(_0x4a1a87(0x1c8)in _0x3dcf69){const _0x2fac80=_0x16d3e6[_0x4a1a87(0x1f7)](_0x4a1a87(0x200)),{functionName:_0x3823d6,functionArguments:_0x2c53a6,targetFunction:_0x2f08cc}=_0x3dcf69[_0x4a1a87(0x1c8)];let _0x3b8755=_0x509b49+'\x20'+_0x2fac80+':\x20'+_0x16d3e6[_0x4a1a87(0x29b)](_0x3823d6);if(_0x2c53a6&&Object[_0x4a1a87(0x24b)](_0x2c53a6)[_0x4a1a87(0x26e)]>0x0){const _0x3de3fd=Object['entries'](_0x2c53a6)['map'](([_0x5f31f5,_0x3940d7])=>_0x5f31f5+'='+JSON['stringify'](_0x3940d7))[_0x4a1a87(0x236)](',\x20');_0x3b8755+='('+_0x3de3fd+')';}_0x2f08cc&&(_0x3b8755+=_0x16d3e6[_0x4a1a87(0x23b)]('\x20['+_0x2f08cc+']'));let _0x4c8331='';if(_0x3dcf69[_0x4a1a87(0x1c8)][_0x4a1a87(0x21c)])_0x4c8331=_0x4a1a87(0x1d0)+_0x3dcf69[_0x4a1a87(0x1c8)][_0x4a1a87(0x21c)]['name'];else{if(_0x3dcf69[_0x4a1a87(0x1c8)]['targetAgent'])_0x4c8331='\x20->\x20Agent:'+_0x3dcf69[_0x4a1a87(0x1c8)][_0x4a1a87(0x24e)][_0x4a1a87(0x26c)];else{if(_0x3dcf69['tool_call'][_0x4a1a87(0x210)])_0x4c8331='\x20->\x20WebSearch:'+_0x3dcf69[_0x4a1a87(0x1c8)]['targetWebSearchTool'][_0x4a1a87(0x26c)];else _0x3dcf69[_0x4a1a87(0x1c8)][_0x4a1a87(0x229)]&&(_0x4c8331=_0x4a1a87(0x272)+_0x3dcf69[_0x4a1a87(0x1c8)][_0x4a1a87(0x229)]['name']);}}return _0x3b8755+_0x4c8331;}if(_0x4a1a87(0x23e)in _0x3dcf69){const _0x26e44e=_0x16d3e6[_0x4a1a87(0x1cf)](_0x4a1a87(0x1f5)),{functionName:_0x386aa2,functionArguments:_0x36cd0b,content:_0x333e41,newChat:_0x2b3824}=_0x3dcf69[_0x4a1a87(0x23e)];let _0x491b1b=_0x509b49+'\x20'+_0x26e44e+':\x20'+_0x16d3e6[_0x4a1a87(0x29b)](_0x386aa2);if(_0x36cd0b){const _0x209876=typeof _0x36cd0b===_0x4a1a87(0x247)?_0x36cd0b:JSON[_0x4a1a87(0x24d)](_0x36cd0b);_0x491b1b+='('+_0x209876+')';}return _0x333e41&&(_0x491b1b+='\x0a'+_0x16d3e6[_0x4a1a87(0x23b)](_0x333e41)),_0x2b3824&&(_0x491b1b+=_0x16d3e6['dim'](_0x4a1a87(0x1db)+_0x2b3824['id'])),_0x491b1b;}if('output'in _0x3dcf69){const _0x5d0e2a=_0x16d3e6[_0x4a1a87(0x1e8)]('[output]\x20');return _0x509b49+'\x20'+_0x5d0e2a+':\x20'+_0x3dcf69[_0x4a1a87(0x201)][_0x4a1a87(0x26c)]+'\x20('+_0x3dcf69[_0x4a1a87(0x201)]['content']['length']+_0x4a1a87(0x286);}if(_0x4a1a87(0x1ff)in _0x3dcf69){const _0x2aa44f=_0x16d3e6[_0x4a1a87(0x1e8)](_0x4a1a87(0x277)),{width:_0x236f9a,height:_0x4ac0b9,headerText:_0x50cb46}=_0x3dcf69[_0x4a1a87(0x1ff)],_0x42dbf7=_0x50cb46?'\x20-\x20'+_0x50cb46:'';return _0x509b49+'\x20'+_0x2aa44f+':\x20'+_0x236f9a+'x'+_0x4ac0b9+_0x42dbf7;}if(_0x4a1a87(0x1d3)in _0x3dcf69){const _0x287195=_0x16d3e6[_0x4a1a87(0x28e)](_0x4a1a87(0x244));return _0x509b49+'\x20'+_0x287195+':\x20'+_0x3dcf69[_0x4a1a87(0x1d3)];}return _0x509b49+'\x20'+_0x16d3e6[_0x4a1a87(0x23b)](_0x4a1a87(0x1f3))+':\x20'+JSON['stringify'](_0x3dcf69);}function a20_0x58cf(_0x4dbe24,_0x437c15){_0x4dbe24=_0x4dbe24-0x1c8;const _0x36877e=a20_0x3687();let _0x58cf81=_0x36877e[_0x4dbe24];return _0x58cf81;}async function executeChatHistoryCommand(_0xdbd149,_0x6f71dd){const _0xe443dc=a20_0x58cf,{options:_0x377a13,args:_0x36bdb9,tdx:_0x11d837}=_0xdbd149,_0x234015=_0x36bdb9[0x0],_0x5bfef3=_0x377a13,_0x54aed8=_0x5bfef3['last'];try{if(_0x54aed8&&_0x234015)return console[_0xe443dc(0x1d3)]('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console['error']('Usage:\x20'+_0x6f71dd+_0xe443dc(0x2a2)),0x1;if(!_0x234015&&!_0x54aed8&&_0x377a13[_0xe443dc(0x245)]!==undefined){const _0x2e5b47=resolveLimit(_0x377a13[_0xe443dc(0x28c)],DEFAULT_LLM_LIMIT),_0x4fdc66=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0x11d837[_0xe443dc(0x295)][_0xe443dc(0x213)](_0x2e5b47),{'verbose':_0x377a13['verbose']});return await handleSDKOutput(_0x4fdc66[_0xe443dc(0x28f)],_0x377a13),0x0;}const _0x38f0e5=await getChatIdOrSelect(_0x11d837,_0x377a13,_0x54aed8,_0x234015);if(!_0x38f0e5)return 0x0;return await displayChatHistory(_0x38f0e5,_0x11d837,_0x377a13),0x0;}catch(_0x5a793c){return handleSDKError(_0x5a793c,_0x377a13),0x1;}}async function displayChatHistory(_0x148dba,_0x6463be,_0x263416){const _0x107b02=a20_0x58cf,_0x2d2602=await withSpinner(_0x107b02(0x258)+_0x148dba+_0x107b02(0x216),()=>_0x6463be[_0x107b02(0x295)][_0x107b02(0x224)](_0x148dba),{'verbose':_0x263416[_0x107b02(0x29e)]}),_0x49e565=_0x2d2602[_0x107b02(0x28f)][_0x107b02(0x28f)]??[];if(_0x49e565['length']===0x0){console['log'](_0x107b02(0x266));return;}if(_0x263416['format']!==undefined)await handleSDKOutput(_0x49e565,_0x263416);else{const _0x592afd=_0x49e565['map'](_0x58adfb=>formatChatHistoryEntry(_0x58adfb,_0x263416)),_0x277e9e=_0x592afd['join']('\x0a');await writeOutput(_0x277e9e,_0x263416[_0x107b02(0x201)],_0x107b02(0x1ce));}}async function getChatIdOrSelect(_0x59cacc,_0x4928f9,_0x4e81c0,_0x5cfaf3){const _0xdfc234=a20_0x58cf;if(_0x5cfaf3)return _0x5cfaf3;if(_0x4e81c0){const _0x23808d=await withSpinner('Fetching\x20most\x20recent\x20chat...',()=>_0x59cacc['llm'][_0xdfc234(0x213)](0x1),{'verbose':_0x4928f9['verbose']});if(_0x23808d['data'][_0xdfc234(0x26e)]===0x0)return console[_0xdfc234(0x207)](_0xdfc234(0x29d)),undefined;return _0x23808d[_0xdfc234(0x28f)][0x0]['id'];}const _0x4a0d80=await selectChatInteractively(_0x59cacc,_0x4928f9);if(!_0x4a0d80)return console[_0xdfc234(0x207)]('\x0aCancelled'),undefined;return _0x4a0d80;}async function getProjectIdOrDefault(_0x1dc394){const _0x23b387=await getProjectWithName(_0x1dc394);return _0x23b387['id'];}async function getProjectWithName(_0x387820){const _0x1f456b=a20_0x58cf,{tdx:_0x5a145c,options:_0x18d56d}=_0x387820,_0x473630=_0x18d56d[_0x1f456b(0x235)];if(_0x473630){const _0x357760=await withSpinner('Resolving\x20project\x20\x27'+_0x473630+'\x27...',()=>_0x5a145c[_0x1f456b(0x295)]['resolveProjectId'](_0x473630),{'verbose':_0x18d56d[_0x1f456b(0x29e)]});return{'id':_0x357760[_0x1f456b(0x28f)],'name':_0x473630};}const _0x910fab=_0x5a145c[_0x1f456b(0x295)][_0x1f456b(0x225)]();if(_0x910fab){const _0x3d8666=await _0x5a145c[_0x1f456b(0x295)][_0x1f456b(0x298)](),_0xc72ff7=_0x3d8666[_0x1f456b(0x23a)](_0x5801e4=>_0x5801e4['id']===_0x910fab);return{'id':_0x910fab,'name':_0xc72ff7?.[_0x1f456b(0x269)][_0x1f456b(0x26c)]||_0x1f456b(0x20b)};}const _0xd87abd=await withSpinner(_0x1f456b(0x223),()=>_0x5a145c[_0x1f456b(0x295)][_0x1f456b(0x273)](),{'verbose':_0x18d56d['verbose']});return{'id':_0xd87abd[_0x1f456b(0x28f)]['id'],'name':_0xd87abd[_0x1f456b(0x28f)][_0x1f456b(0x269)][_0x1f456b(0x26c)]};}function toLLMProjectInfo(_0x1d1cad){const _0x3a68dd=a20_0x58cf;return{'name':_0x1d1cad[_0x3a68dd(0x269)]['name'],'description':_0x1d1cad['attributes']['description'],'createdAt':_0x1d1cad[_0x3a68dd(0x269)][_0x3a68dd(0x263)],'updatedAt':_0x1d1cad['attributes'][_0x3a68dd(0x260)]};}function toAgentInfo(_0x4c912e){const _0x207108=a20_0x58cf;return{'name':_0x4c912e[_0x207108(0x269)]['name'],'description':_0x4c912e[_0x207108(0x269)][_0x207108(0x1d6)],'prompt':truncatePrompt(_0x4c912e[_0x207108(0x269)][_0x207108(0x21f)]),'createdAt':_0x4c912e[_0x207108(0x269)][_0x207108(0x263)],'updatedAt':_0x4c912e['attributes'][_0x207108(0x260)]};}function truncatePrompt(_0x1dca39){const _0xe14a47=a20_0x58cf;if(!_0x1dca39)return undefined;const _0x2d2d40=0x64;if(_0x1dca39['length']<=_0x2d2d40)return _0x1dca39;return _0x1dca39['slice'](0x0,_0x2d2d40)+_0xe14a47(0x239);}export class LLMModelsCommand extends BaseCommand{[a20_0x5c60f0(0x26c)]='llm:models';[a20_0x5c60f0(0x1d6)]=a20_0x5c60f0(0x219);async[a20_0x5c60f0(0x1ef)](_0x580616){const _0x42924a=a20_0x5c60f0,{options:_0x454329,tdx:_0x236f67}=_0x580616;try{const _0x38a6ee=await withSpinner(_0x42924a(0x21d),()=>_0x236f67[_0x42924a(0x295)]['models'](),{'verbose':_0x454329['verbose']});return await handleSDKOutput(_0x38a6ee[_0x42924a(0x28f)],_0x454329),0x0;}catch(_0x3d5f01){return handleSDKError(_0x3d5f01,_0x454329),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a20_0x5c60f0(0x26c)]=a20_0x5c60f0(0x283);[a20_0x5c60f0(0x1d6)]='List\x20all\x20LLM\x20projects';async['execute'](_0x5950e2){const _0x295fbc=a20_0x5c60f0,{options:_0xf160ef,args:_0x2a74d0,tdx:_0x516b60}=_0x5950e2,_0x581cf4=getChalk(_0xf160ef),_0x43bec8=_0xf160ef[_0x295fbc(0x23d)];try{const _0x2ef836=_0x2a74d0[0x0],_0x591646=resolveLimit(_0xf160ef['limit'],DEFAULT_LLM_LIMIT),_0x3efd5e=await withSpinner(_0x295fbc(0x1e5),()=>_0x516b60[_0x295fbc(0x295)]['projects'](_0x591646),{'verbose':_0xf160ef[_0x295fbc(0x29e)]});let _0x1f7767=_0x3efd5e[_0x295fbc(0x28f)];_0x2ef836&&(_0x1f7767=_0x3efd5e['data'][_0x295fbc(0x209)](_0x199a36=>matchGlobPattern(_0x199a36[_0x295fbc(0x269)][_0x295fbc(0x26c)],_0x2ef836)));const _0x2bcfd4=_0xf160ef['format']===_0x295fbc(0x1fb)||_0xf160ef[_0x295fbc(0x245)]==='jsonl'||_0xf160ef['format']==='table'||_0xf160ef['format']===_0x295fbc(0x248);if(_0x2bcfd4){const _0x18ba3c=_0x1f7767[_0x295fbc(0x293)](_0x4677eb=>({...toLLMProjectInfo(_0x4677eb),'url':getLLMProjectUrl(_0x43bec8,_0x4677eb['id'])}));await handleSDKOutput(_0x18ba3c,_0xf160ef);}else{const _0x5373f8=[];if(_0x1f7767[_0x295fbc(0x26e)]===0x0)_0x5373f8[_0x295fbc(0x2a1)](_0x581cf4[_0x295fbc(0x23b)](_0x295fbc(0x292)));else{const _0x57b818=[..._0x1f7767][_0x295fbc(0x226)]((_0x40dfa6,_0x532d2f)=>_0x40dfa6['attributes']['name'][_0x295fbc(0x246)](_0x532d2f['attributes']['name']));for(const _0x58dc76 of _0x57b818){const _0x1f641d=getLLMProjectUrl(_0x43bec8,_0x58dc76['id']),_0x396c91=hyperlink(_0x58dc76[_0x295fbc(0x269)][_0x295fbc(0x26c)],_0x1f641d);_0x5373f8[_0x295fbc(0x2a1)](_0x295fbc(0x222)+_0x396c91);}_0x5373f8[_0x295fbc(0x2a1)](_0x581cf4[_0x295fbc(0x23b)](_0x1f7767[_0x295fbc(0x26e)]+_0x295fbc(0x1cb)));}await writeOutput(_0x5373f8[_0x295fbc(0x236)]('\x0a'),_0xf160ef[_0x295fbc(0x201)],_0x295fbc(0x1ce));}return 0x0;}catch(_0x155771){return handleSDKError(_0x155771,_0xf160ef),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a20_0x5c60f0(0x26c)]='llm:agents';[a20_0x5c60f0(0x1d6)]='List\x20agents\x20in\x20current\x20project';async[a20_0x5c60f0(0x1ef)](_0x3afb94){const _0x193a09=a20_0x5c60f0,{options:_0x3c0e58,args:_0x251ab6,tdx:_0x82db21}=_0x3afb94,_0x4c627c=getChalk(_0x3c0e58),_0x1e752c=_0x3c0e58[_0x193a09(0x23d)];try{const _0x118d1c=_0x251ab6[0x0];let _0x3f7e26=_0x118d1c,_0x417c17,_0x44edda;if(_0x118d1c&&_0x118d1c[_0x193a09(0x252)]('/')){const _0x1bf1d4=_0x118d1c[_0x193a09(0x299)]('/');if(_0x1bf1d4[_0x193a09(0x26e)]===0x2){const [_0x3980d8,_0xad366e]=_0x1bf1d4,_0x9d10c=await _0x82db21['llm'][_0x193a09(0x298)](),_0x2b3bf6=_0x9d10c['find'](_0x36556c=>_0x36556c['attributes'][_0x193a09(0x26c)][_0x193a09(0x1cc)]()===_0x3980d8[_0x193a09(0x1cc)]());if(!_0x2b3bf6)throw new SDKError(ErrorCode[_0x193a09(0x27f)],_0x193a09(0x243)+_0x3980d8,undefined,{'helpText':_0x193a09(0x296)});_0x417c17=_0x2b3bf6['id'],_0x44edda=_0x2b3bf6[_0x193a09(0x269)]['name'],_0x3f7e26=_0xad366e;}else throw new SDKError(ErrorCode[_0x193a09(0x21e)],_0x193a09(0x22c)+_0x118d1c,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else{const _0x39da7d=await getProjectWithName(_0x3afb94);_0x417c17=_0x39da7d['id'],_0x44edda=_0x39da7d[_0x193a09(0x26c)];}const _0x57742b=await withSpinner('Fetching\x20agents...',()=>_0x82db21[_0x193a09(0x295)][_0x193a09(0x206)](_0x417c17),{'verbose':_0x3c0e58[_0x193a09(0x29e)]});let _0x3ae2e5=_0x57742b['data'];_0x3f7e26&&(_0x3ae2e5=_0x57742b[_0x193a09(0x28f)][_0x193a09(0x209)](_0x2e4341=>matchGlobPattern(_0x2e4341[_0x193a09(0x269)]['name'],_0x3f7e26)));const _0x3a7c19=_0x3c0e58[_0x193a09(0x245)]===_0x193a09(0x1fb)||_0x3c0e58[_0x193a09(0x245)]===_0x193a09(0x220)||_0x3c0e58[_0x193a09(0x245)]===_0x193a09(0x1ce)||_0x3c0e58[_0x193a09(0x245)]===_0x193a09(0x248);if(_0x3a7c19){const _0x14cbb8=_0x3ae2e5[_0x193a09(0x293)](_0x73b63b=>({...toAgentInfo(_0x73b63b),'chatUrl':getLLMAgentChatUrl(_0x1e752c,_0x417c17,_0x73b63b['id'])}));await handleSDKOutput(_0x14cbb8,_0x3c0e58);}else{const _0x1fe9d8=[];_0x1fe9d8[_0x193a09(0x2a1)](_0x4c627c[_0x193a09(0x23b)]('['+_0x44edda+']'));if(_0x3ae2e5[_0x193a09(0x26e)]===0x0)_0x1fe9d8['push'](_0x4c627c['dim'](_0x193a09(0x279)));else{const _0x49634a=[..._0x3ae2e5][_0x193a09(0x226)]((_0x5eb790,_0x4f9352)=>_0x5eb790[_0x193a09(0x269)][_0x193a09(0x26c)]['localeCompare'](_0x4f9352[_0x193a09(0x269)]['name']));for(const _0x3b8006 of _0x49634a){const _0x581361=getLLMAgentChatUrl(_0x1e752c,_0x417c17,_0x3b8006['id']),_0x4bdf9f=hyperlink(_0x3b8006[_0x193a09(0x269)][_0x193a09(0x26c)],_0x581361);_0x1fe9d8[_0x193a09(0x2a1)](_0x193a09(0x281)+_0x4bdf9f);}_0x1fe9d8[_0x193a09(0x2a1)](_0x4c627c['dim'](_0x3ae2e5[_0x193a09(0x26e)]+_0x193a09(0x241)));}await writeOutput(_0x1fe9d8['join']('\x0a'),_0x3c0e58['output'],_0x193a09(0x1ce));}return 0x0;}catch(_0x396e8c){return handleSDKError(_0x396e8c,_0x3c0e58),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{[a20_0x5c60f0(0x26c)]=a20_0x5c60f0(0x265);[a20_0x5c60f0(0x1d6)]=a20_0x5c60f0(0x249);async[a20_0x5c60f0(0x1ef)](_0x10beda){const _0xc18089=a20_0x5c60f0,{options:_0x11a144,args:_0x234d0d,tdx:_0x401fb7}=_0x10beda;if(_0x234d0d[_0xc18089(0x26e)]===0x0)return console[_0xc18089(0x1d3)](_0xc18089(0x230)),console['error']('Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>'),0x1;const _0x424d33=_0x234d0d[0x0];try{const _0x2b12fe=await getProjectIdOrDefault(_0x10beda),_0x17db5e=await withSpinner(_0xc18089(0x242)+_0x424d33+'\x27...',()=>_0x401fb7[_0xc18089(0x295)]['resolveAgentId'](_0x424d33,_0x2b12fe),{'verbose':_0x11a144['verbose']}),_0x21f9f0=await withSpinner(_0xc18089(0x29c),()=>_0x401fb7[_0xc18089(0x295)][_0xc18089(0x290)](_0x17db5e[_0xc18089(0x28f)]),{'verbose':_0x11a144['verbose']});return await handleSDKOutput([_0x21f9f0[_0xc18089(0x28f)]],_0x11a144),0x0;}catch(_0x36b98b){return handleSDKError(_0x36b98b,_0x11a144),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a20_0x5c60f0(0x26c)]=a20_0x5c60f0(0x271);[a20_0x5c60f0(0x1d6)]=a20_0x5c60f0(0x29f);async[a20_0x5c60f0(0x1ef)](_0xd9f150){const _0x2eab5f=a20_0x5c60f0,{options:_0x451eec,args:_0x55711e,tdx:_0x3c3c3e}=_0xd9f150;if(_0x55711e['length']===0x0)return console[_0x2eab5f(0x1d3)](_0x2eab5f(0x230)),console['error']('Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]'),console['error'](_0x2eab5f(0x1dd)),0x1;const _0x482a83=_0x55711e[0x0],_0x4b1249=_0x451eec,_0x1f6c01=_0x4b1249[_0x2eab5f(0x1f6)],_0x3c1ab5=_0x4b1249['model']||_0x2eab5f(0x28d),_0x178df8=_0x4b1249[_0x2eab5f(0x1f9)],_0x41f16b=_0x4b1249[_0x2eab5f(0x1d2)]?Number(_0x4b1249[_0x2eab5f(0x1d2)]):undefined,_0x110107=_0x4b1249[_0x2eab5f(0x1d1)]?Number(_0x4b1249[_0x2eab5f(0x1d1)]):undefined;try{let _0x10dabf,_0x139524;if(_0x482a83['includes']('/')){const _0x1cd974=_0x482a83[_0x2eab5f(0x299)]('/');if(_0x1cd974[_0x2eab5f(0x26e)]===0x2){const [_0x5797af,_0x47333d]=_0x1cd974,_0x34e319=await withSpinner('Resolving\x20project\x20\x27'+_0x5797af+_0x2eab5f(0x216),()=>_0x3c3c3e[_0x2eab5f(0x295)][_0x2eab5f(0x27b)](_0x5797af),{'verbose':_0x451eec[_0x2eab5f(0x29e)]});_0x10dabf=_0x34e319[_0x2eab5f(0x28f)],_0x139524=_0x47333d;}else throw new SDKError(ErrorCode[_0x2eab5f(0x21e)],'Invalid\x20path\x20syntax:\x20'+_0x482a83,undefined,{'helpText':_0x2eab5f(0x251)});}else _0x10dabf=await getProjectIdOrDefault(_0xd9f150),_0x139524=_0x482a83;const _0x5a2656=await withSpinner(_0x2eab5f(0x291)+_0x139524+'\x27...',()=>_0x3c3c3e[_0x2eab5f(0x295)]['createAgent']({'name':_0x139524,'projectId':_0x10dabf,'modelType':_0x3c1ab5,'systemPrompt':_0x1f6c01,'starterMessage':_0x178df8,'maxToolIterations':_0x41f16b,'temperature':_0x110107}),{'verbose':_0x451eec[_0x2eab5f(0x29e)]});return console[_0x2eab5f(0x207)](_0x2eab5f(0x1e9)+_0x5a2656['data']['id']),await handleSDKOutput([_0x5a2656[_0x2eab5f(0x28f)]],_0x451eec),0x0;}catch(_0x4305d0){return handleSDKError(_0x4305d0,_0x451eec),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a20_0x5c60f0(0x26c)]='llm:agent:update';['description']=a20_0x5c60f0(0x25c);async[a20_0x5c60f0(0x1ef)](_0x1a8842){const _0x50872c=a20_0x5c60f0,{options:_0x19bdde,args:_0x4afcb4,tdx:_0x3af86f}=_0x1a8842;if(_0x4afcb4[_0x50872c(0x26e)]===0x0)return console[_0x50872c(0x1d3)](_0x50872c(0x230)),console[_0x50872c(0x1d3)](_0x50872c(0x284)),0x1;const _0x1facbf=_0x4afcb4[0x0],_0x1ce652=_0x19bdde,_0x1bbc52=_0x1ce652[_0x50872c(0x26c)],_0x47940a=_0x1ce652['prompt'],_0x1917ff=_0x1ce652[_0x50872c(0x1d6)],_0x413851=_0x1ce652[_0x50872c(0x1f9)];if(!_0x1bbc52&&!_0x47940a&&!_0x1917ff&&!_0x413851)return console['error']('Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required'),console['error'](_0x50872c(0x1ec)),0x1;try{const _0x436cb7=await getProjectIdOrDefault(_0x1a8842),_0xa33209=await withSpinner(_0x50872c(0x242)+_0x1facbf+_0x50872c(0x216),()=>_0x3af86f[_0x50872c(0x295)][_0x50872c(0x280)](_0x1facbf,_0x436cb7),{'verbose':_0x19bdde[_0x50872c(0x29e)]}),_0x48a65d=_0xa33209['data'],_0x8c19db=await withSpinner('Updating\x20agent...',()=>_0x3af86f[_0x50872c(0x295)][_0x50872c(0x256)](_0x48a65d,{'name':_0x1bbc52,'prompt':_0x47940a,'description':_0x1917ff,'starterMessage':_0x413851}),{'verbose':_0x19bdde['verbose']});return console[_0x50872c(0x207)]('Agent\x20updated:\x20'+_0x8c19db[_0x50872c(0x28f)]['id']),await handleSDKOutput([_0x8c19db[_0x50872c(0x28f)]],_0x19bdde),0x0;}catch(_0x435137){return handleSDKError(_0x435137,_0x19bdde),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a20_0x5c60f0(0x26c)]=a20_0x5c60f0(0x238);[a20_0x5c60f0(0x1d6)]=a20_0x5c60f0(0x1ee);async[a20_0x5c60f0(0x1ef)](_0xe5897a){const _0x540788=a20_0x5c60f0,{options:_0x42db51,args:_0x1d1a1b,tdx:_0xb7a677}=_0xe5897a;if(_0x1d1a1b[_0x540788(0x26e)]===0x0)return console[_0x540788(0x1d3)](_0x540788(0x230)),console[_0x540788(0x1d3)](_0x540788(0x294)),0x1;const _0x273312=_0x1d1a1b[0x0];try{const _0x150f2b=await getProjectIdOrDefault(_0xe5897a),_0x11af0d=await withSpinner('Resolving\x20agent\x20\x27'+_0x273312+'\x27...',()=>_0xb7a677[_0x540788(0x295)][_0x540788(0x280)](_0x273312,_0x150f2b),{'verbose':_0x42db51[_0x540788(0x29e)]}),_0x1fe7e4=_0x11af0d[_0x540788(0x28f)];return await withSpinner('Deleting\x20agent...',()=>_0xb7a677[_0x540788(0x295)][_0x540788(0x1fd)](_0x1fe7e4),{'verbose':_0x42db51['verbose']}),console[_0x540788(0x207)](_0x540788(0x1f0)+_0x1fe7e4),0x0;}catch(_0x4d715f){return handleSDKError(_0x4d715f,_0x42db51),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a20_0x5c60f0(0x26c)]=a20_0x5c60f0(0x1e2);[a20_0x5c60f0(0x1d6)]=a20_0x5c60f0(0x208);async[a20_0x5c60f0(0x1ef)](_0x8a57af){const _0x5ac797=a20_0x5c60f0;return executeChatHistoryCommand(_0x8a57af,_0x5ac797(0x1e4));}}export class LLMUseCommand extends BaseCommand{[a20_0x5c60f0(0x26c)]=a20_0x5c60f0(0x1fa);['description']=a20_0x5c60f0(0x253);async['execute'](_0xc48d71){const _0x156012=a20_0x5c60f0,{options:_0x196931,args:_0x2431f5,tdx:_0x441434}=_0xc48d71;if(_0x2431f5[_0x156012(0x26e)]===0x0)return console[_0x156012(0x1d3)](_0x156012(0x20e)),console[_0x156012(0x1d3)]('Usage:\x20tdx\x20llm\x20use\x20<project-name>'),0x1;const _0x4509b5=_0x2431f5[0x0];try{return await withSpinner(_0x156012(0x1f4)+_0x4509b5+_0x156012(0x216),()=>_0x441434[_0x156012(0x295)][_0x156012(0x1c9)](_0x4509b5),{'verbose':_0x196931['verbose']}),console['log'](_0x156012(0x267)+_0x4509b5),0x0;}catch(_0x5c351e){return handleSDKError(_0x5c351e,_0x196931),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{['name']=a20_0x5c60f0(0x27d);['description']=a20_0x5c60f0(0x278);async[a20_0x5c60f0(0x1ef)](_0x551f68){const _0x48a621=a20_0x5c60f0,{options:_0x3b2d6,args:_0x373a24,tdx:_0x1a0356}=_0x551f68;if(_0x373a24[_0x48a621(0x26e)]===0x0)return console[_0x48a621(0x1d3)](_0x48a621(0x20e)),console['error']('Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]'),0x1;const _0x51ceab=_0x373a24[0x0],_0xc25dd=_0x3b2d6,_0x554720=_0xc25dd[_0x48a621(0x1d6)];try{const _0x535027=await withSpinner(_0x48a621(0x288)+_0x51ceab+'\x27...',()=>_0x1a0356[_0x48a621(0x295)][_0x48a621(0x1da)]({'name':_0x51ceab,'description':_0x554720}),{'verbose':_0x3b2d6[_0x48a621(0x29e)]});console['log'](_0x48a621(0x26a)+_0x535027[_0x48a621(0x28f)]['id']);const _0x3fe95f=toLLMProjectInfo(_0x535027[_0x48a621(0x28f)]);return await handleSDKOutput([_0x3fe95f],_0x3b2d6),0x0;}catch(_0x12c860){return handleSDKError(_0x12c860,_0x3b2d6),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a20_0x5c60f0(0x26c)]=a20_0x5c60f0(0x282);[a20_0x5c60f0(0x1d6)]=a20_0x5c60f0(0x240);async[a20_0x5c60f0(0x1ef)](_0x1f94d2){const _0xe20280=a20_0x5c60f0,{options:_0x459a73,args:_0x1a52a0,tdx:_0x3e7354}=_0x1f94d2;if(_0x1a52a0['length']===0x0)return console['error'](_0xe20280(0x20e)),console[_0xe20280(0x1d3)](_0xe20280(0x1fc)),0x1;const _0x276d20=_0x1a52a0[0x0];try{return await withSpinner(_0xe20280(0x1e7)+_0x276d20+'\x27...',()=>_0x3e7354['llm'][_0xe20280(0x234)](_0x276d20),{'verbose':_0x459a73[_0xe20280(0x29e)]}),console['log']('Project\x20deleted:\x20'+_0x276d20),0x0;}catch(_0x228a23){return handleSDKError(_0x228a23,_0x459a73),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a20_0x5c60f0(0x26c)]='llm:project:backup';[a20_0x5c60f0(0x1d6)]=a20_0x5c60f0(0x23f);async['execute'](_0x3c0753){const _0x297278=a20_0x5c60f0,{options:_0x2c0485,args:_0x5e64ff,tdx:_0x4d41ee}=_0x3c0753,_0x3af8dc=getChalk(_0x2c0485);console[_0x297278(0x207)](_0x3af8dc[_0x297278(0x1f7)](_0x297278(0x289))),console[_0x297278(0x207)](_0x3af8dc['yellow'](_0x297278(0x24f))),console['log'](_0x3af8dc[_0x297278(0x23b)](_0x297278(0x24a))),console[_0x297278(0x207)]();if(_0x5e64ff[_0x297278(0x26e)]===0x0)return console[_0x297278(0x1d3)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x297278(0x1d3)]('Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]'),0x1;const _0x3174d6=_0x5e64ff[0x0],_0x42a411=_0x2c0485,_0x2fd387=_0x42a411[_0x297278(0x201)],_0x221520=_0x42a411['dryRun'];try{const _0x56fb19=_0x2fd387||_0x3174d6+_0x297278(0x25a);if(a20_0x42782c[_0x297278(0x211)](_0x56fb19)&&!_0x221520){if(!_0x2c0485[_0x297278(0x1cd)]){const _0x151533=await confirm(_0x297278(0x1ca)+_0x56fb19+_0x297278(0x1d7));if(!_0x151533)return console[_0x297278(0x207)](_0x297278(0x21b)),0x0;}a20_0x42782c[_0x297278(0x29a)](_0x56fb19,{'recursive':!![]});}const _0x49d28b=await withSpinner(_0x221520?_0x297278(0x1ed)+_0x3174d6+_0x297278(0x216):_0x297278(0x228)+_0x3174d6+_0x297278(0x216),()=>_0x4d41ee[_0x297278(0x295)][_0x297278(0x28b)](_0x3174d6,_0x2fd387,{'dryRun':_0x221520}),{'verbose':_0x2c0485[_0x297278(0x29e)]}),_0x44c065=_0x49d28b['data'];return _0x221520?console['log'](_0x297278(0x1e3)+_0x44c065[_0x297278(0x202)]):console[_0x297278(0x207)](_0x297278(0x1dc)+_0x44c065[_0x297278(0x202)]),console['log'](_0x297278(0x24c)+_0x44c065[_0x297278(0x274)][_0x297278(0x206)]),console[_0x297278(0x207)](_0x297278(0x22f)+_0x44c065[_0x297278(0x274)][_0x297278(0x26b)]),console[_0x297278(0x207)](_0x297278(0x1e1)+_0x44c065['counts']['prompts']),console[_0x297278(0x207)]('\x20\x20Integrations:\x20'+_0x44c065[_0x297278(0x274)][_0x297278(0x22d)]),(_0x2c0485[_0x297278(0x245)]===_0x297278(0x1fb)||_0x2c0485[_0x297278(0x245)]===_0x297278(0x220))&&await handleSDKOutput([_0x44c065],_0x2c0485),0x0;}catch(_0x249f77){return handleSDKError(_0x249f77,_0x2c0485),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a20_0x5c60f0(0x26c)]='llm:project:restore';[a20_0x5c60f0(0x1d6)]='Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)';async[a20_0x5c60f0(0x1ef)](_0x312817){const _0x26dddc=a20_0x5c60f0,{options:_0x2e2e06,args:_0x2f6201,tdx:_0x4429e8}=_0x312817,_0x21c550=getChalk(_0x2e2e06);console['log'](_0x21c550[_0x26dddc(0x1f7)](_0x26dddc(0x20f))),console[_0x26dddc(0x207)](_0x21c550[_0x26dddc(0x1f7)](_0x26dddc(0x21a))),console[_0x26dddc(0x207)](_0x21c550[_0x26dddc(0x23b)](_0x26dddc(0x20a))),console['log'](_0x21c550[_0x26dddc(0x23b)]('\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/')),console[_0x26dddc(0x207)](_0x21c550['dim'](_0x26dddc(0x205))),console[_0x26dddc(0x207)]();if(_0x2f6201[_0x26dddc(0x26e)]===0x0)return console['error']('Error:\x20Backup\x20folder\x20path\x20is\x20required'),console[_0x26dddc(0x1d3)]('Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]'),0x1;const _0x31df7f=_0x2f6201[0x0],_0x14b19d=_0x2e2e06,_0x5d859e=_0x14b19d[_0x26dddc(0x26c)],_0x37007d=_0x14b19d[_0x26dddc(0x25e)];try{if(!_0x37007d){const _0x298868=_0x4429e8[_0x26dddc(0x295)][_0x26dddc(0x20d)](_0x31df7f),_0x33a1b5=_0x5d859e||_0x298868[_0x26dddc(0x217)][_0x26dddc(0x1f2)],_0x150b65=await withSpinner(_0x26dddc(0x1eb),()=>_0x4429e8[_0x26dddc(0x295)]['projects'](),{'verbose':_0x2e2e06[_0x26dddc(0x29e)]}),_0x3ffc9b=_0x150b65['data'][_0x26dddc(0x23a)](_0x41a134=>_0x41a134['attributes'][_0x26dddc(0x26c)]===_0x33a1b5);if(_0x3ffc9b&&!_0x2e2e06[_0x26dddc(0x1cd)]){const _0xc2c35e=await confirm('A\x20project\x20named\x20\x27'+_0x33a1b5+_0x26dddc(0x204));if(!_0xc2c35e)return console[_0x26dddc(0x207)](_0x26dddc(0x218)),0x0;}}const _0x1c2d83=await withSpinner(_0x37007d?'Validating\x20backup\x20from\x20\x27'+_0x31df7f+'\x27...':_0x26dddc(0x287)+_0x31df7f+_0x26dddc(0x216),()=>_0x4429e8['llm'][_0x26dddc(0x270)](_0x31df7f,{'name':_0x5d859e,'dryRun':_0x37007d}),{'verbose':_0x2e2e06[_0x26dddc(0x29e)]}),_0xfa2a31=_0x1c2d83[_0x26dddc(0x28f)];return _0xfa2a31['sourceSite']&&console['log'](_0x26dddc(0x23c)+_0xfa2a31['sourceSite']+'\x27'),_0x37007d?console[_0x26dddc(0x207)](_0x26dddc(0x1e6)+_0xfa2a31[_0x26dddc(0x1f2)]):console['log'](_0x26dddc(0x255)+_0xfa2a31['projectName']+'\x20('+_0xfa2a31['projectId']+')'),console[_0x26dddc(0x207)](_0x26dddc(0x24c)+_0xfa2a31['counts'][_0x26dddc(0x206)]),console[_0x26dddc(0x207)](_0x26dddc(0x22f)+_0xfa2a31['counts'][_0x26dddc(0x26b)]),console[_0x26dddc(0x207)](_0x26dddc(0x1e1)+_0xfa2a31[_0x26dddc(0x274)][_0x26dddc(0x275)]),console['log'](_0x26dddc(0x22b)+_0xfa2a31['counts'][_0x26dddc(0x22d)]),(_0x2e2e06['format']===_0x26dddc(0x1fb)||_0x2e2e06[_0x26dddc(0x245)]===_0x26dddc(0x220))&&await handleSDKOutput([_0xfa2a31],_0x2e2e06),0x0;}catch(_0xe0f375){return handleSDKError(_0xe0f375,_0x2e2e06),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0xc55ccb,_0xb5d110){const _0x3897b5=a20_0x5c60f0,_0x29145c=_0xb5d110[_0x3897b5(0x28c)]||CHAT_SELECTOR_PAGE_SIZE;let _0xb6f27c=0x0,_0x568f67=[];const _0xac99a3=(await import(_0x3897b5(0x275)))['default'],_0x5921e4=getChalk(_0xb5d110);while(!![]){const _0x4f025a=await withSpinner(_0x3897b5(0x227),()=>_0xc55ccb['llm'][_0x3897b5(0x213)](_0x29145c+_0xb6f27c),{'verbose':_0xb5d110[_0x3897b5(0x29e)]});_0x568f67=_0x4f025a[_0x3897b5(0x28f)];const _0x2f60aa=_0x568f67['slice'](_0xb6f27c,_0xb6f27c+_0x29145c),_0x24aa6a=_0x568f67[_0x3897b5(0x26e)]>_0xb6f27c+_0x29145c,_0x550b9b=[...new Set(_0x2f60aa[_0x3897b5(0x293)](_0x4d29fe=>_0x4d29fe[_0x3897b5(0x269)]['agentId'])['filter'](_0x546f23=>_0x546f23!==undefined))],_0x3081ce=new Map();await Promise[_0x3897b5(0x1de)](_0x550b9b[_0x3897b5(0x293)](async _0x3823f9=>{const _0x57458c=_0x3897b5;try{const _0x12b92f=await _0xc55ccb['llm']['agent'](_0x3823f9);_0x3081ce['set'](_0x3823f9,_0x12b92f[_0x57458c(0x269)]['name']);}catch{_0x3081ce[_0x57458c(0x262)](_0x3823f9,_0x3823f9);}}));const _0x500444=_0x2f60aa[_0x3897b5(0x293)](_0x404133=>{const _0x591466=_0x3897b5,_0x4920ff=_0x404133[_0x591466(0x269)][_0x591466(0x25b)]||_0x591466(0x221),_0x3917e3=_0x4920ff[_0x591466(0x299)]('\x0a')[0x0],_0x2e18eb=_0x3917e3[_0x591466(0x26e)]>0x50?_0x3917e3['substring'](0x0,0x4d)+_0x591466(0x239):_0x3917e3,_0x281887=_0x404133['attributes'][_0x591466(0x26d)]?_0x3081ce[_0x591466(0x2a0)](_0x404133[_0x591466(0x269)][_0x591466(0x26d)])||_0x404133['attributes'][_0x591466(0x26d)]:_0x591466(0x203),_0x3a9991=_0x404133[_0x591466(0x269)][_0x591466(0x1ea)]||_0x404133[_0x591466(0x269)][_0x591466(0x260)],_0x31579e=new Date(_0x3a9991),_0x2d0a30=new Date(),_0x214aba=_0x2d0a30['getTime']()-_0x31579e[_0x591466(0x1d9)](),_0x5bf2eb=Math[_0x591466(0x1e0)](_0x214aba/0xea60),_0x51cc17=Math['floor'](_0x214aba/0x36ee80),_0x4013de=Math['floor'](_0x214aba/0x5265c00);let _0x24a13f;if(_0x5bf2eb<0x1)_0x24a13f=_0x591466(0x1d4);else{if(_0x5bf2eb<0x3c)_0x24a13f=_0x5bf2eb+_0x591466(0x1d8);else{if(_0x51cc17<0x18)_0x24a13f=_0x51cc17+_0x591466(0x237);else _0x4013de<0x7?_0x24a13f=_0x4013de+'d\x20ago':_0x24a13f=_0x31579e[_0x591466(0x25d)](_0x591466(0x1f8),{'month':_0x591466(0x297),'day':_0x591466(0x22e)});}}return{'title':_0x2e18eb+'\x20'+_0x5921e4['dim']('['+_0x281887+']\x20'+_0x24a13f),'value':_0x404133['id']};});_0x24aa6a&&_0x500444[_0x3897b5(0x2a1)]({'title':_0x5921e4['cyan'](_0x3897b5(0x264)),'value':_0x3897b5(0x1f1)});const _0x4a9fca=await _0xac99a3({'type':'select','name':_0x3897b5(0x214),'message':_0x3897b5(0x276),'choices':_0x500444,'hint':_0x3897b5(0x25f)});if(!_0x4a9fca[_0x3897b5(0x214)])return undefined;if(_0x4a9fca[_0x3897b5(0x214)]===_0x3897b5(0x1f1)){_0xb6f27c+=_0x29145c;continue;}return _0x4a9fca[_0x3897b5(0x214)];}}export class ChatsCommand extends BaseCommand{[a20_0x5c60f0(0x26c)]=a20_0x5c60f0(0x213);[a20_0x5c60f0(0x1d6)]=a20_0x5c60f0(0x250);async[a20_0x5c60f0(0x1ef)](_0x4738c4){const _0x1cb308=a20_0x5c60f0;return executeChatHistoryCommand(_0x4738c4,_0x1cb308(0x26f));}}
1
+ const a20_0x480902=a20_0x2d26;(function(_0x5520f5,_0xc6f4ec){const _0x537dc4=a20_0x2d26,_0x3e2980=_0x5520f5();while(!![]){try{const _0x80ba1e=parseInt(_0x537dc4(0x1ad))/0x1*(-parseInt(_0x537dc4(0x24d))/0x2)+parseInt(_0x537dc4(0x1c5))/0x3+-parseInt(_0x537dc4(0x1f4))/0x4+-parseInt(_0x537dc4(0x220))/0x5*(-parseInt(_0x537dc4(0x219))/0x6)+parseInt(_0x537dc4(0x1d1))/0x7+parseInt(_0x537dc4(0x1e6))/0x8+-parseInt(_0x537dc4(0x20e))/0x9*(parseInt(_0x537dc4(0x254))/0xa);if(_0x80ba1e===_0xc6f4ec)break;else _0x3e2980['push'](_0x3e2980['shift']());}catch(_0x595897){_0x3e2980['push'](_0x3e2980['shift']());}}}(a20_0x519b,0x7426c));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{getLLMProjectUrl,getLLMAgentChatUrl}from'../sdk/client/endpoints.js';import{hyperlink}from'../sdk/util/formatters.js';import*as a20_0x51942f from'node:fs';function handleSDKError(_0x28fd01,_0x252119){const _0x1def1a=a20_0x2d26;if(_0x28fd01 instanceof SDKError)console[_0x1def1a(0x1c0)](_0x1def1a(0x1e2)+_0x28fd01[_0x1def1a(0x1f3)]),_0x252119['verbose']&&(_0x28fd01[_0x1def1a(0x268)]&&console['error'](_0x1def1a(0x194)+_0x28fd01[_0x1def1a(0x268)]),_0x28fd01[_0x1def1a(0x24e)]&&(console['error']('\x0aStack\x20trace:'),console[_0x1def1a(0x1c0)](_0x28fd01[_0x1def1a(0x24e)])));else throw _0x28fd01;}function formatChatHistoryEntry(_0x2344a6,_0x21c564){const _0x3fbe73=a20_0x2d26,_0x2cebf1=getChalk(_0x21c564),_0x5303c0=_0x2cebf1[_0x3fbe73(0x1e1)](_0x2344a6['at']);if('input'in _0x2344a6){const _0xe2b562=_0x2cebf1[_0x3fbe73(0x195)](_0x3fbe73(0x235));return _0x5303c0+'\x20'+_0xe2b562+':\x20'+_0x2344a6[_0x3fbe73(0x1d6)];}if(_0x3fbe73(0x240)in _0x2344a6){const _0x2bb12e=_0x2cebf1['green'](_0x3fbe73(0x1ce));return _0x5303c0+'\x20'+_0x2bb12e+':\x20'+_0x2344a6[_0x3fbe73(0x240)];}if('tool_call'in _0x2344a6){const _0x44672b=_0x2cebf1[_0x3fbe73(0x251)](_0x3fbe73(0x1d0)),{functionName:_0x42f486,functionArguments:_0x3a0d9a,targetFunction:_0x57e17f}=_0x2344a6['tool_call'];let _0x55b4dc=_0x5303c0+'\x20'+_0x44672b+':\x20'+_0x2cebf1[_0x3fbe73(0x21d)](_0x42f486);if(_0x3a0d9a&&Object[_0x3fbe73(0x1eb)](_0x3a0d9a)['length']>0x0){const _0x3715cf=Object[_0x3fbe73(0x1b4)](_0x3a0d9a)[_0x3fbe73(0x1cc)](([_0x5a9fcc,_0x5229e6])=>_0x5a9fcc+'='+JSON[_0x3fbe73(0x1dc)](_0x5229e6))[_0x3fbe73(0x1b5)](',\x20');_0x55b4dc+='('+_0x3715cf+')';}_0x57e17f&&(_0x55b4dc+=_0x2cebf1[_0x3fbe73(0x1e1)]('\x20['+_0x57e17f+']'));let _0x10408d='';if(_0x2344a6[_0x3fbe73(0x208)][_0x3fbe73(0x19e)])_0x10408d='\x20->\x20KB:'+_0x2344a6[_0x3fbe73(0x208)][_0x3fbe73(0x19e)]['name'];else{if(_0x2344a6[_0x3fbe73(0x208)][_0x3fbe73(0x246)])_0x10408d='\x20->\x20Agent:'+_0x2344a6[_0x3fbe73(0x208)][_0x3fbe73(0x246)][_0x3fbe73(0x1d5)];else{if(_0x2344a6['tool_call']['targetWebSearchTool'])_0x10408d='\x20->\x20WebSearch:'+_0x2344a6[_0x3fbe73(0x208)]['targetWebSearchTool'][_0x3fbe73(0x1d5)];else _0x2344a6['tool_call'][_0x3fbe73(0x1ec)]&&(_0x10408d=_0x3fbe73(0x1c8)+_0x2344a6['tool_call'][_0x3fbe73(0x1ec)][_0x3fbe73(0x1d5)]);}}return _0x55b4dc+_0x10408d;}if(_0x3fbe73(0x1b2)in _0x2344a6){const _0x302e4f=_0x2cebf1[_0x3fbe73(0x21b)](_0x3fbe73(0x228)),{functionName:_0x4c7f70,functionArguments:_0x1d2bf6,content:_0x2c2859,newChat:_0x49559d}=_0x2344a6[_0x3fbe73(0x1b2)];let _0x743b45=_0x5303c0+'\x20'+_0x302e4f+':\x20'+_0x2cebf1[_0x3fbe73(0x21d)](_0x4c7f70);if(_0x1d2bf6){const _0x5f2df4=typeof _0x1d2bf6===_0x3fbe73(0x1f5)?_0x1d2bf6:JSON['stringify'](_0x1d2bf6);_0x743b45+='('+_0x5f2df4+')';}return _0x2c2859&&(_0x743b45+='\x0a'+_0x2cebf1['dim'](_0x2c2859)),_0x49559d&&(_0x743b45+=_0x2cebf1[_0x3fbe73(0x1e1)]('\x20→\x20chat:\x20'+_0x49559d['id'])),_0x743b45;}if(_0x3fbe73(0x221)in _0x2344a6){const _0x462c27=_0x2cebf1[_0x3fbe73(0x266)](_0x3fbe73(0x1b1));return _0x5303c0+'\x20'+_0x462c27+':\x20'+_0x2344a6[_0x3fbe73(0x221)][_0x3fbe73(0x1d5)]+'\x20('+_0x2344a6['output'][_0x3fbe73(0x240)][_0x3fbe73(0x192)]+'\x20bytes)';}if(_0x3fbe73(0x1a6)in _0x2344a6){const _0x44728f=_0x2cebf1[_0x3fbe73(0x266)](_0x3fbe73(0x23d)),{width:_0x11c57b,height:_0x5cd536,headerText:_0x20926f}=_0x2344a6[_0x3fbe73(0x1a6)],_0x39ce1b=_0x20926f?'\x20-\x20'+_0x20926f:'';return _0x5303c0+'\x20'+_0x44728f+':\x20'+_0x11c57b+'x'+_0x5cd536+_0x39ce1b;}if('error'in _0x2344a6){const _0x49ebf8=_0x2cebf1[_0x3fbe73(0x1fe)]('[error]\x20\x20');return _0x5303c0+'\x20'+_0x49ebf8+':\x20'+_0x2344a6[_0x3fbe73(0x1c0)];}return _0x5303c0+'\x20'+_0x2cebf1[_0x3fbe73(0x1e1)](_0x3fbe73(0x25f))+':\x20'+JSON[_0x3fbe73(0x1dc)](_0x2344a6);}async function executeChatHistoryCommand(_0x5bc023,_0xcfac48){const _0x5e9137=a20_0x2d26,{options:_0x4a184d,args:_0x8e0b0b,tdx:_0x3017e6}=_0x5bc023,_0x578877=_0x8e0b0b[0x0],_0xd63972=_0x4a184d,_0x43721b=_0xd63972[_0x5e9137(0x1f7)];try{if(_0x43721b&&_0x578877)return console[_0x5e9137(0x1c0)](_0x5e9137(0x237)),console[_0x5e9137(0x1c0)](_0x5e9137(0x26b)+_0xcfac48+'\x20--last'),0x1;if(!_0x578877&&!_0x43721b&&_0x4a184d['format']!==undefined){const _0x5893f1=resolveLimit(_0x4a184d[_0x5e9137(0x1ae)],DEFAULT_LLM_LIMIT),_0x35ac9d=await withSpinner(_0x5e9137(0x248),()=>_0x3017e6[_0x5e9137(0x269)][_0x5e9137(0x234)](_0x5893f1),{'verbose':_0x4a184d[_0x5e9137(0x1da)]});return await handleSDKOutput(_0x35ac9d[_0x5e9137(0x1b0)],_0x4a184d),0x0;}const _0x3dd816=await getChatIdOrSelect(_0x3017e6,_0x4a184d,_0x43721b,_0x578877);if(!_0x3dd816)return 0x0;return await displayChatHistory(_0x3dd816,_0x3017e6,_0x4a184d),0x0;}catch(_0x405c36){return handleSDKError(_0x405c36,_0x4a184d),0x1;}}async function displayChatHistory(_0x2ea721,_0x688cda,_0xe5e904){const _0x427748=a20_0x2d26,_0x1111c7=await withSpinner(_0x427748(0x24a)+_0x2ea721+'\x27...',()=>_0x688cda[_0x427748(0x269)][_0x427748(0x1f8)](_0x2ea721),{'verbose':_0xe5e904[_0x427748(0x1da)]}),_0x1a5ea9=_0x1111c7[_0x427748(0x1b0)][_0x427748(0x1b0)]??[];if(_0x1a5ea9['length']===0x0){console[_0x427748(0x24b)](_0x427748(0x204));return;}if(_0xe5e904[_0x427748(0x217)]!==undefined)await handleSDKOutput(_0x1a5ea9,_0xe5e904);else{const _0x3dc46d=_0x1a5ea9[_0x427748(0x1cc)](_0x37f7cb=>formatChatHistoryEntry(_0x37f7cb,_0xe5e904)),_0x2cdf35=_0x3dc46d['join']('\x0a');await writeOutput(_0x2cdf35,_0xe5e904[_0x427748(0x221)],'table');}}async function getChatIdOrSelect(_0x14a887,_0x27f565,_0x2b7311,_0x3abd24){const _0x43ccd9=a20_0x2d26;if(_0x3abd24)return _0x3abd24;if(_0x2b7311){const _0x4e0a87=await withSpinner(_0x43ccd9(0x226),()=>_0x14a887[_0x43ccd9(0x269)][_0x43ccd9(0x234)](0x1),{'verbose':_0x27f565[_0x43ccd9(0x1da)]});if(_0x4e0a87[_0x43ccd9(0x1b0)][_0x43ccd9(0x192)]===0x0)return console[_0x43ccd9(0x24b)](_0x43ccd9(0x20a)),undefined;return _0x4e0a87[_0x43ccd9(0x1b0)][0x0]['id'];}const _0x4b40c7=await selectChatInteractively(_0x14a887,_0x27f565);if(!_0x4b40c7)return console[_0x43ccd9(0x24b)](_0x43ccd9(0x1be)),undefined;return _0x4b40c7;}async function getProjectIdOrDefault(_0x163d14){const _0x5b2f1f=await getProjectWithName(_0x163d14);return _0x5b2f1f['id'];}async function getProjectWithName(_0x3861b4){const _0x324b56=a20_0x2d26,{tdx:_0x28fe55,options:_0x408b66}=_0x3861b4,_0x557055=_0x408b66[_0x324b56(0x23e)];if(_0x557055){const _0x5b14ec=await withSpinner(_0x324b56(0x1ac)+_0x557055+_0x324b56(0x1ab),()=>_0x28fe55[_0x324b56(0x269)][_0x324b56(0x1c2)](_0x557055),{'verbose':_0x408b66['verbose']});return{'id':_0x5b14ec['data'],'name':_0x557055};}const _0x559668=_0x28fe55[_0x324b56(0x269)]['getCurrentProject']();if(_0x559668){const _0x492df5=await _0x28fe55[_0x324b56(0x269)]['projects'](),_0x30e583=_0x492df5['find'](_0xfc593c=>_0xfc593c['id']===_0x559668);return{'id':_0x559668,'name':_0x30e583?.[_0x324b56(0x1aa)][_0x324b56(0x1d5)]||_0x324b56(0x211)};}const _0x59af6e=await withSpinner(_0x324b56(0x209),()=>_0x28fe55[_0x324b56(0x269)][_0x324b56(0x1d4)](),{'verbose':_0x408b66[_0x324b56(0x1da)]});return{'id':_0x59af6e[_0x324b56(0x1b0)]['id'],'name':_0x59af6e[_0x324b56(0x1b0)][_0x324b56(0x1aa)][_0x324b56(0x1d5)]};}function toLLMProjectInfo(_0x2512b5){const _0x9f7943=a20_0x2d26;return{'name':_0x2512b5[_0x9f7943(0x1aa)][_0x9f7943(0x1d5)],'description':_0x2512b5[_0x9f7943(0x1aa)][_0x9f7943(0x1a2)],'createdAt':_0x2512b5['attributes']['createdAt'],'updatedAt':_0x2512b5[_0x9f7943(0x1aa)][_0x9f7943(0x1e9)]};}function toAgentInfo(_0x4bc56d){const _0x35c091=a20_0x2d26;return{'name':_0x4bc56d['attributes'][_0x35c091(0x1d5)],'description':_0x4bc56d['attributes']['description'],'prompt':truncatePrompt(_0x4bc56d[_0x35c091(0x1aa)][_0x35c091(0x225)]),'createdAt':_0x4bc56d['attributes'][_0x35c091(0x218)],'updatedAt':_0x4bc56d[_0x35c091(0x1aa)][_0x35c091(0x1e9)]};}function truncatePrompt(_0x2e7a8d){const _0x22b43e=a20_0x2d26;if(!_0x2e7a8d)return undefined;const _0x157eca=0x64;if(_0x2e7a8d['length']<=_0x157eca)return _0x2e7a8d;return _0x2e7a8d[_0x22b43e(0x1fc)](0x0,_0x157eca)+'...';}function a20_0x519b(){const _0x105a20=['Analyzing\x20project\x20\x27','outputDir','map','\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/','[content]','Fetching\x20agent...','[tool_call]','429226CfvFHw','Invalid\x20path\x20syntax:\x20','llm:models','getOrCreateDefaultProject','name','input','model','No\x20agents\x20found','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','verbose','Project\x20restored:\x20','stringify','llm:projects','rmSync','agentId','createAgent','dim','Error:\x20','find','agents','prompts','1036912uVJcqB','Checking\x20for\x20existing\x20projects...','\x20\x20Integrations:\x20','updatedAt','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','keys','targetImageGenerator','projects','systemPrompt','__load_more__','projectName','\x20\x20Knowledge\x20Bases:\x20','Backup\x20cancelled.','message','1315672VKYwkx','string','maxToolIterations','last','history','substring','llm:use','llm:agent:update','slice','toLowerCase','red','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','sort','llm:agent:create','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','Deleting\x20agent...','No\x20messages\x20found\x20in\x20chat\x20history.','split','llm:project:create','\x27\x20already\x20exists.\x20Overwrite?','tool_call','Getting\x20default\x20project...','No\x20chat\x20sessions\x20found.','List\x20agents\x20in\x20current\x20project','LLM_PROJECT_NOT_FOUND','🤖\x20','9kGKZwg','Create\x20a\x20new\x20agent\x20in\x20current\x20project','Output\x20directory\x20\x27','Unknown','en-US','chatId','knowledgeBases','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','Project\x20backed\x20up\x20to:\x20','format','createdAt','50124veEHJq','just\x20now','magenta','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','bold','integrations','tdx\x20llm\x20history','565aLOZzr','output','Project\x20not\x20found:\x20','Fetching\x20available\x20models...','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','prompt','Fetching\x20most\x20recent\x20chat...','getBackupMetadata','[tool]\x20\x20\x20','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.','Show\x20agent\x20details','Resolving\x20agent\x20\x27','Error:\x20Agent\x20name\x20is\x20required','temperature','Project\x20context\x20set\x20to:\x20','jsonl','llm:agent:delete','(no\x20message)','Update\x20an\x20existing\x20agent','Create\x20a\x20new\x20LLM\x20project','chats','[input]\x20\x20','llm:project:delete','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','(no\x20agent)','Select\x20a\x20chat\x20session:','claude-4.5-haiku','Creating\x20agent\x20\x27','execute','[image]\x20\x20','llmProject','No\x20projects\x20found','content','deleteAgent','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','filter','Agent\x20deleted:\x20','\x20\x20Prompts:\x20','targetAgent','Setting\x20project\x20context\x20to\x20\x27','Fetching\x20chat\x20sessions...','numeric','Fetching\x20chat\x20history\x20for\x20\x27','log','all','7814tpdNOw','stack','\x20project(s)','Restoring\x20project\x20from\x20\x27','yellow','Usage:\x20tdx\x20llm\x20use\x20<project-name>','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','3988880qaeIXt','tsv','toLocaleDateString','\x20\x20Agents:\x20','tdx\x20chats','push','llm:agents','Deleting\x20project\x20\x27','d\x20ago','yes','sourceSite','[unknown]','table','deleteProject','includes','llm:agent:show','starterMessage','lastConversationAt','blue','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','cause','llm','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','Usage:\x20','Project\x20deleted:\x20','length','⚒️\x20','\x20\x20Cause:\x20','cyan','Delete\x20an\x20LLM\x20project','Agent\x20updated:\x20','getTime','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','\x20\x20\x20Examples:','floor','Error:\x20Project\x20name\x20is\x20required','json','targetKnowledgeBase','counts','default','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','description','Fetching\x20projects...','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','firstInputContent','image','dryRun','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)','backupProject','attributes','\x27...','Resolving\x20project\x20\x27','181uYhUGA','limit','m\x20ago','data','[output]\x20','tool','site','entries','join','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.','Agent\x20created:\x20','projectId','Use\x20format:\x20project-name/agent-name','resolveAgentId','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','Restore\x20cancelled.','\x0aCancelled','INVALID_ARGUMENT','error','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','resolveProjectId','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','...','2327385jpkAiV','localeCompare','Updating\x20agent...','\x20->\x20ImageGen:','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]'];a20_0x519b=function(){return _0x105a20;};return a20_0x519b();}export class LLMModelsCommand extends BaseCommand{[a20_0x480902(0x1d5)]=a20_0x480902(0x1d3);[a20_0x480902(0x1a2)]='List\x20available\x20LLM\x20models';async[a20_0x480902(0x23c)](_0x455e6b){const _0x42f723=a20_0x480902,{options:_0x1bb38b,tdx:_0x9f2de4}=_0x455e6b;try{const _0xa43129=await withSpinner(_0x42f723(0x223),()=>_0x9f2de4['llm']['models'](),{'verbose':_0x1bb38b['verbose']});return await handleSDKOutput(_0xa43129[_0x42f723(0x1b0)],_0x1bb38b),0x0;}catch(_0x56464f){return handleSDKError(_0x56464f,_0x1bb38b),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a20_0x480902(0x1d5)]=a20_0x480902(0x1dd);[a20_0x480902(0x1a2)]='List\x20all\x20LLM\x20projects';async[a20_0x480902(0x23c)](_0xa040d5){const _0x6e8b5d=a20_0x480902,{options:_0x346ce1,args:_0x2323af,tdx:_0x237109}=_0xa040d5,_0x38c457=getChalk(_0x346ce1),_0x29a41c=_0x346ce1['site'];try{const _0x4642bc=_0x2323af[0x0],_0x595bf9=resolveLimit(_0x346ce1[_0x6e8b5d(0x1ae)],DEFAULT_LLM_LIMIT),_0x203acb=await withSpinner(_0x6e8b5d(0x1a3),()=>_0x237109['llm'][_0x6e8b5d(0x1ed)](_0x595bf9),{'verbose':_0x346ce1[_0x6e8b5d(0x1da)]});let _0x47f8f4=_0x203acb['data'];_0x4642bc&&(_0x47f8f4=_0x203acb[_0x6e8b5d(0x1b0)]['filter'](_0x4ed88b=>matchGlobPattern(_0x4ed88b[_0x6e8b5d(0x1aa)]['name'],_0x4642bc)));const _0x339f64=_0x346ce1[_0x6e8b5d(0x217)]===_0x6e8b5d(0x19d)||_0x346ce1[_0x6e8b5d(0x217)]===_0x6e8b5d(0x22f)||_0x346ce1[_0x6e8b5d(0x217)]===_0x6e8b5d(0x260)||_0x346ce1[_0x6e8b5d(0x217)]===_0x6e8b5d(0x255);if(_0x339f64){const _0x2a1afa=_0x47f8f4[_0x6e8b5d(0x1cc)](_0x14b846=>({...toLLMProjectInfo(_0x14b846),'url':getLLMProjectUrl(_0x29a41c,_0x14b846['id'])}));await handleSDKOutput(_0x2a1afa,_0x346ce1);}else{const _0x28e554=[];if(_0x47f8f4[_0x6e8b5d(0x192)]===0x0)_0x28e554[_0x6e8b5d(0x259)](_0x38c457[_0x6e8b5d(0x1e1)](_0x6e8b5d(0x23f)));else{const _0x2410b8=[..._0x47f8f4][_0x6e8b5d(0x200)]((_0x58f242,_0x30dfbe)=>_0x58f242[_0x6e8b5d(0x1aa)][_0x6e8b5d(0x1d5)][_0x6e8b5d(0x1c6)](_0x30dfbe[_0x6e8b5d(0x1aa)]['name']));for(const _0x5474c9 of _0x2410b8){const _0x5a2d30=getLLMProjectUrl(_0x29a41c,_0x5474c9['id']),_0x3089d8=hyperlink(_0x5474c9['attributes'][_0x6e8b5d(0x1d5)],_0x5a2d30);_0x28e554[_0x6e8b5d(0x259)](_0x6e8b5d(0x193)+_0x3089d8);}_0x28e554[_0x6e8b5d(0x259)](_0x38c457[_0x6e8b5d(0x1e1)](_0x47f8f4['length']+_0x6e8b5d(0x24f)));}await writeOutput(_0x28e554[_0x6e8b5d(0x1b5)]('\x0a'),_0x346ce1['output'],_0x6e8b5d(0x260));}return 0x0;}catch(_0x5ac830){return handleSDKError(_0x5ac830,_0x346ce1),0x1;}}}export class LLMAgentsCommand extends BaseCommand{['name']=a20_0x480902(0x25a);[a20_0x480902(0x1a2)]=a20_0x480902(0x20b);async['execute'](_0x368bae){const _0x535424=a20_0x480902,{options:_0x4a7283,args:_0x55e0e6,tdx:_0x4ff1f6}=_0x368bae,_0x1fd803=getChalk(_0x4a7283),_0x59211a=_0x4a7283[_0x535424(0x1b3)];try{const _0x4c0b62=_0x55e0e6[0x0];let _0x46faaa=_0x4c0b62,_0x273873,_0x27836b;if(_0x4c0b62&&_0x4c0b62[_0x535424(0x262)]('/')){const _0x160ce5=_0x4c0b62[_0x535424(0x205)]('/');if(_0x160ce5[_0x535424(0x192)]===0x2){const [_0x55b806,_0x22a693]=_0x160ce5,_0xe1c849=await _0x4ff1f6[_0x535424(0x269)]['projects'](),_0x17272f=_0xe1c849['find'](_0x592cb3=>_0x592cb3[_0x535424(0x1aa)][_0x535424(0x1d5)]['toLowerCase']()===_0x55b806[_0x535424(0x1fd)]());if(!_0x17272f)throw new SDKError(ErrorCode[_0x535424(0x20c)],_0x535424(0x222)+_0x55b806,undefined,{'helpText':_0x535424(0x267)});_0x273873=_0x17272f['id'],_0x27836b=_0x17272f['attributes'][_0x535424(0x1d5)],_0x46faaa=_0x22a693;}else throw new SDKError(ErrorCode[_0x535424(0x1bf)],_0x535424(0x1d2)+_0x4c0b62,undefined,{'helpText':_0x535424(0x1ba)});}else{const _0x5356b9=await getProjectWithName(_0x368bae);_0x273873=_0x5356b9['id'],_0x27836b=_0x5356b9[_0x535424(0x1d5)];}const _0x31b723=await withSpinner('Fetching\x20agents...',()=>_0x4ff1f6[_0x535424(0x269)][_0x535424(0x1e4)](_0x273873),{'verbose':_0x4a7283[_0x535424(0x1da)]});let _0x2d669f=_0x31b723[_0x535424(0x1b0)];_0x46faaa&&(_0x2d669f=_0x31b723[_0x535424(0x1b0)][_0x535424(0x243)](_0x21702b=>matchGlobPattern(_0x21702b[_0x535424(0x1aa)][_0x535424(0x1d5)],_0x46faaa)));const _0x31844b=_0x4a7283['format']==='json'||_0x4a7283[_0x535424(0x217)]==='jsonl'||_0x4a7283[_0x535424(0x217)]===_0x535424(0x260)||_0x4a7283['format']==='tsv';if(_0x31844b){const _0x45b46c=_0x2d669f['map'](_0xd386c2=>({...toAgentInfo(_0xd386c2),'chatUrl':getLLMAgentChatUrl(_0x59211a,_0x273873,_0xd386c2['id'])}));await handleSDKOutput(_0x45b46c,_0x4a7283);}else{const _0x505748=[];_0x505748[_0x535424(0x259)](_0x1fd803['dim']('['+_0x27836b+']'));if(_0x2d669f[_0x535424(0x192)]===0x0)_0x505748['push'](_0x1fd803[_0x535424(0x1e1)](_0x535424(0x1d8)));else{const _0x5be3fb=[..._0x2d669f][_0x535424(0x200)]((_0x104f60,_0x5b8d16)=>_0x104f60[_0x535424(0x1aa)][_0x535424(0x1d5)]['localeCompare'](_0x5b8d16['attributes'][_0x535424(0x1d5)]));for(const _0x1f9824 of _0x5be3fb){const _0xcbf5f7=getLLMAgentChatUrl(_0x59211a,_0x273873,_0x1f9824['id']),_0x7a7241=hyperlink(_0x1f9824[_0x535424(0x1aa)][_0x535424(0x1d5)],_0xcbf5f7);_0x505748['push'](_0x535424(0x20d)+_0x7a7241);}_0x505748[_0x535424(0x259)](_0x1fd803[_0x535424(0x1e1)](_0x2d669f[_0x535424(0x192)]+'\x20agent(s)'));}await writeOutput(_0x505748[_0x535424(0x1b5)]('\x0a'),_0x4a7283['output'],_0x535424(0x260));}return 0x0;}catch(_0x503882){return handleSDKError(_0x503882,_0x4a7283),0x1;}}}function a20_0x2d26(_0x4a7d09,_0x214555){_0x4a7d09=_0x4a7d09-0x191;const _0x519bca=a20_0x519b();let _0x2d26b1=_0x519bca[_0x4a7d09];return _0x2d26b1;}export class LLMAgentShowCommand extends BaseCommand{[a20_0x480902(0x1d5)]=a20_0x480902(0x263);[a20_0x480902(0x1a2)]=a20_0x480902(0x22a);async[a20_0x480902(0x23c)](_0xd63338){const _0x3fcb52=a20_0x480902,{options:_0xe5e836,args:_0x5700ae,tdx:_0x5f5d44}=_0xd63338;if(_0x5700ae['length']===0x0)return console[_0x3fcb52(0x1c0)]('Error:\x20Agent\x20name\x20is\x20required'),console['error'](_0x3fcb52(0x224)),0x1;const _0x318d5f=_0x5700ae[0x0];try{const _0x59ddb3=await getProjectIdOrDefault(_0xd63338),_0x25596e=await withSpinner(_0x3fcb52(0x22b)+_0x318d5f+_0x3fcb52(0x1ab),()=>_0x5f5d44[_0x3fcb52(0x269)][_0x3fcb52(0x1bb)](_0x318d5f,_0x59ddb3),{'verbose':_0xe5e836['verbose']}),_0x4f5768=await withSpinner(_0x3fcb52(0x1cf),()=>_0x5f5d44[_0x3fcb52(0x269)]['agent'](_0x25596e[_0x3fcb52(0x1b0)]),{'verbose':_0xe5e836[_0x3fcb52(0x1da)]});return await handleSDKOutput([_0x4f5768[_0x3fcb52(0x1b0)]],_0xe5e836),0x0;}catch(_0x4ffa2a){return handleSDKError(_0x4ffa2a,_0xe5e836),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a20_0x480902(0x1d5)]=a20_0x480902(0x201);['description']=a20_0x480902(0x20f);async[a20_0x480902(0x23c)](_0x2b70f5){const _0x35b891=a20_0x480902,{options:_0x4f53aa,args:_0x4518b9,tdx:_0x4cbb18}=_0x2b70f5;if(_0x4518b9[_0x35b891(0x192)]===0x0)return console[_0x35b891(0x1c0)](_0x35b891(0x22c)),console['error'](_0x35b891(0x199)),console[_0x35b891(0x1c0)]('\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]'),0x1;const _0x4e0921=_0x4518b9[0x0],_0x3834b6=_0x4f53aa,_0x12f892=_0x3834b6[_0x35b891(0x1ee)],_0x2f825e=_0x3834b6[_0x35b891(0x1d7)]||_0x35b891(0x23a),_0x1b9c41=_0x3834b6['starterMessage'],_0x26044c=_0x3834b6[_0x35b891(0x1f6)]?Number(_0x3834b6['maxToolIterations']):undefined,_0x3c3687=_0x3834b6[_0x35b891(0x22d)]?Number(_0x3834b6['temperature']):undefined;try{let _0x3ea575,_0x423307;if(_0x4e0921[_0x35b891(0x262)]('/')){const _0x2feeec=_0x4e0921[_0x35b891(0x205)]('/');if(_0x2feeec[_0x35b891(0x192)]===0x2){const [_0x5afa64,_0x49caad]=_0x2feeec,_0x35c924=await withSpinner('Resolving\x20project\x20\x27'+_0x5afa64+_0x35b891(0x1ab),()=>_0x4cbb18[_0x35b891(0x269)][_0x35b891(0x1c2)](_0x5afa64),{'verbose':_0x4f53aa[_0x35b891(0x1da)]});_0x3ea575=_0x35c924['data'],_0x423307=_0x49caad;}else throw new SDKError(ErrorCode[_0x35b891(0x1bf)],_0x35b891(0x1d2)+_0x4e0921,undefined,{'helpText':_0x35b891(0x1ba)});}else _0x3ea575=await getProjectIdOrDefault(_0x2b70f5),_0x423307=_0x4e0921;const _0x589bdf=await withSpinner(_0x35b891(0x23b)+_0x423307+_0x35b891(0x1ab),()=>_0x4cbb18['llm'][_0x35b891(0x1e0)]({'name':_0x423307,'projectId':_0x3ea575,'modelType':_0x2f825e,'systemPrompt':_0x12f892,'starterMessage':_0x1b9c41,'maxToolIterations':_0x26044c,'temperature':_0x3c3687}),{'verbose':_0x4f53aa[_0x35b891(0x1da)]});return console[_0x35b891(0x24b)](_0x35b891(0x1b8)+_0x589bdf[_0x35b891(0x1b0)]['id']),await handleSDKOutput([_0x589bdf[_0x35b891(0x1b0)]],_0x4f53aa),0x0;}catch(_0x11d5b1){return handleSDKError(_0x11d5b1,_0x4f53aa),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{['name']=a20_0x480902(0x1fb);['description']=a20_0x480902(0x232);async[a20_0x480902(0x23c)](_0x5ed464){const _0x3d8375=a20_0x480902,{options:_0x277364,args:_0x28aed6,tdx:_0x71df43}=_0x5ed464;if(_0x28aed6[_0x3d8375(0x192)]===0x0)return console[_0x3d8375(0x1c0)](_0x3d8375(0x22c)),console[_0x3d8375(0x1c0)](_0x3d8375(0x1ff)),0x1;const _0xe31ece=_0x28aed6[0x0],_0x463593=_0x277364,_0x480008=_0x463593[_0x3d8375(0x1d5)],_0x54ab09=_0x463593['prompt'],_0x536c86=_0x463593[_0x3d8375(0x1a2)],_0x4c82c2=_0x463593[_0x3d8375(0x264)];if(!_0x480008&&!_0x54ab09&&!_0x536c86&&!_0x4c82c2)return console['error'](_0x3d8375(0x1a4)),console[_0x3d8375(0x1c0)](_0x3d8375(0x21c)),0x1;try{const _0x599797=await getProjectIdOrDefault(_0x5ed464),_0x3f1401=await withSpinner(_0x3d8375(0x22b)+_0xe31ece+_0x3d8375(0x1ab),()=>_0x71df43[_0x3d8375(0x269)][_0x3d8375(0x1bb)](_0xe31ece,_0x599797),{'verbose':_0x277364[_0x3d8375(0x1da)]}),_0xc0d10b=_0x3f1401[_0x3d8375(0x1b0)],_0x3b9aac=await withSpinner(_0x3d8375(0x1c7),()=>_0x71df43[_0x3d8375(0x269)]['updateAgent'](_0xc0d10b,{'name':_0x480008,'prompt':_0x54ab09,'description':_0x536c86,'starterMessage':_0x4c82c2}),{'verbose':_0x277364['verbose']});return console[_0x3d8375(0x24b)](_0x3d8375(0x197)+_0x3b9aac['data']['id']),await handleSDKOutput([_0x3b9aac[_0x3d8375(0x1b0)]],_0x277364),0x0;}catch(_0x4110a2){return handleSDKError(_0x4110a2,_0x277364),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a20_0x480902(0x1d5)]=a20_0x480902(0x230);[a20_0x480902(0x1a2)]='Delete\x20an\x20agent';async[a20_0x480902(0x23c)](_0x26661d){const _0x1161d4=a20_0x480902,{options:_0x285a30,args:_0x2c3070,tdx:_0x1c0f30}=_0x26661d;if(_0x2c3070[_0x1161d4(0x192)]===0x0)return console[_0x1161d4(0x1c0)](_0x1161d4(0x22c)),console['error'](_0x1161d4(0x253)),0x1;const _0x3f58ca=_0x2c3070[0x0];try{const _0x943953=await getProjectIdOrDefault(_0x26661d),_0x916016=await withSpinner(_0x1161d4(0x22b)+_0x3f58ca+_0x1161d4(0x1ab),()=>_0x1c0f30[_0x1161d4(0x269)][_0x1161d4(0x1bb)](_0x3f58ca,_0x943953),{'verbose':_0x285a30['verbose']}),_0x324e6f=_0x916016[_0x1161d4(0x1b0)];return await withSpinner(_0x1161d4(0x203),()=>_0x1c0f30[_0x1161d4(0x269)][_0x1161d4(0x241)](_0x324e6f),{'verbose':_0x285a30[_0x1161d4(0x1da)]}),console['log'](_0x1161d4(0x244)+_0x324e6f),0x0;}catch(_0x1dbb20){return handleSDKError(_0x1dbb20,_0x285a30),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a20_0x480902(0x1d5)]='llm:history';[a20_0x480902(0x1a2)]=a20_0x480902(0x1ea);async[a20_0x480902(0x23c)](_0x3dfa03){const _0x5866fc=a20_0x480902;return executeChatHistoryCommand(_0x3dfa03,_0x5866fc(0x21f));}}export class LLMUseCommand extends BaseCommand{[a20_0x480902(0x1d5)]=a20_0x480902(0x1fa);['description']='Set\x20current\x20project\x20context';async['execute'](_0x3203cc){const _0x169e43=a20_0x480902,{options:_0x558212,args:_0x21392a,tdx:_0x83de5f}=_0x3203cc;if(_0x21392a[_0x169e43(0x192)]===0x0)return console['error'](_0x169e43(0x19c)),console[_0x169e43(0x1c0)](_0x169e43(0x252)),0x1;const _0x21dd17=_0x21392a[0x0];try{return await withSpinner(_0x169e43(0x247)+_0x21dd17+_0x169e43(0x1ab),()=>_0x83de5f[_0x169e43(0x269)]['setCurrentProject'](_0x21dd17),{'verbose':_0x558212[_0x169e43(0x1da)]}),console[_0x169e43(0x24b)](_0x169e43(0x22e)+_0x21dd17),0x0;}catch(_0x35758f){return handleSDKError(_0x35758f,_0x558212),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a20_0x480902(0x1d5)]=a20_0x480902(0x206);[a20_0x480902(0x1a2)]=a20_0x480902(0x233);async['execute'](_0x471db7){const _0x22026f=a20_0x480902,{options:_0x592c03,args:_0x27fe60,tdx:_0x513043}=_0x471db7;if(_0x27fe60[_0x22026f(0x192)]===0x0)return console['error']('Error:\x20Project\x20name\x20is\x20required'),console[_0x22026f(0x1c0)](_0x22026f(0x1d9)),0x1;const _0x284ac0=_0x27fe60[0x0],_0x587e94=_0x592c03,_0x413cf4=_0x587e94[_0x22026f(0x1a2)];try{const _0x37f0b9=await withSpinner('Creating\x20project\x20\x27'+_0x284ac0+_0x22026f(0x1ab),()=>_0x513043[_0x22026f(0x269)]['createProject']({'name':_0x284ac0,'description':_0x413cf4}),{'verbose':_0x592c03[_0x22026f(0x1da)]});console['log']('Project\x20created:\x20'+_0x37f0b9[_0x22026f(0x1b0)]['id']);const _0x263283=toLLMProjectInfo(_0x37f0b9[_0x22026f(0x1b0)]);return await handleSDKOutput([_0x263283],_0x592c03),0x0;}catch(_0x20cf0f){return handleSDKError(_0x20cf0f,_0x592c03),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a20_0x480902(0x1d5)]=a20_0x480902(0x236);[a20_0x480902(0x1a2)]=a20_0x480902(0x196);async[a20_0x480902(0x23c)](_0xabd065){const _0x5b506f=a20_0x480902,{options:_0x226285,args:_0x293aea,tdx:_0x1a843b}=_0xabd065;if(_0x293aea[_0x5b506f(0x192)]===0x0)return console[_0x5b506f(0x1c0)](_0x5b506f(0x19c)),console[_0x5b506f(0x1c0)](_0x5b506f(0x1c1)),0x1;const _0x28e20f=_0x293aea[0x0];try{return await withSpinner(_0x5b506f(0x25b)+_0x28e20f+_0x5b506f(0x1ab),()=>_0x1a843b['llm'][_0x5b506f(0x261)](_0x28e20f),{'verbose':_0x226285[_0x5b506f(0x1da)]}),console[_0x5b506f(0x24b)](_0x5b506f(0x191)+_0x28e20f),0x0;}catch(_0x26bd5d){return handleSDKError(_0x26bd5d,_0x226285),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a20_0x480902(0x1d5)]='llm:project:backup';['description']='Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)';async[a20_0x480902(0x23c)](_0x346d3d){const _0x2a6dd6=a20_0x480902,{options:_0x1fed40,args:_0x525a92,tdx:_0x510c7a}=_0x346d3d,_0x1ec1b4=getChalk(_0x1fed40);console['log'](_0x1ec1b4[_0x2a6dd6(0x251)]('⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.')),console[_0x2a6dd6(0x24b)](_0x1ec1b4['yellow'](_0x2a6dd6(0x1a1))),console['log'](_0x1ec1b4['dim']('\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents')),console[_0x2a6dd6(0x24b)]();if(_0x525a92[_0x2a6dd6(0x192)]===0x0)return console[_0x2a6dd6(0x1c0)](_0x2a6dd6(0x19c)),console['error'](_0x2a6dd6(0x1c9)),0x1;const _0x2af564=_0x525a92[0x0],_0x1afcbe=_0x1fed40,_0x27dd55=_0x1afcbe[_0x2a6dd6(0x221)],_0x4390c4=_0x1afcbe[_0x2a6dd6(0x1a7)];try{const _0x246353=_0x27dd55||_0x2af564+'.llm';if(a20_0x51942f['existsSync'](_0x246353)&&!_0x4390c4){if(!_0x1fed40['yes']){const _0x3c96f0=await confirm(_0x2a6dd6(0x210)+_0x246353+_0x2a6dd6(0x207));if(!_0x3c96f0)return console[_0x2a6dd6(0x24b)](_0x2a6dd6(0x1f2)),0x0;}a20_0x51942f[_0x2a6dd6(0x1de)](_0x246353,{'recursive':!![]});}const _0x2d95c7=await withSpinner(_0x4390c4?_0x2a6dd6(0x1ca)+_0x2af564+_0x2a6dd6(0x1ab):'Backing\x20up\x20project\x20\x27'+_0x2af564+_0x2a6dd6(0x1ab),()=>_0x510c7a[_0x2a6dd6(0x269)][_0x2a6dd6(0x1a9)](_0x2af564,_0x27dd55,{'dryRun':_0x4390c4}),{'verbose':_0x1fed40[_0x2a6dd6(0x1da)]}),_0x3f2ba3=_0x2d95c7[_0x2a6dd6(0x1b0)];return _0x4390c4?console[_0x2a6dd6(0x24b)](_0x2a6dd6(0x242)+_0x3f2ba3['outputDir']):console[_0x2a6dd6(0x24b)](_0x2a6dd6(0x216)+_0x3f2ba3[_0x2a6dd6(0x1cb)]),console[_0x2a6dd6(0x24b)]('\x20\x20Agents:\x20'+_0x3f2ba3[_0x2a6dd6(0x19f)]['agents']),console[_0x2a6dd6(0x24b)](_0x2a6dd6(0x1f1)+_0x3f2ba3[_0x2a6dd6(0x19f)]['knowledgeBases']),console[_0x2a6dd6(0x24b)]('\x20\x20Prompts:\x20'+_0x3f2ba3[_0x2a6dd6(0x19f)][_0x2a6dd6(0x1e5)]),console[_0x2a6dd6(0x24b)](_0x2a6dd6(0x1e8)+_0x3f2ba3[_0x2a6dd6(0x19f)][_0x2a6dd6(0x21e)]),(_0x1fed40['format']===_0x2a6dd6(0x19d)||_0x1fed40['format']===_0x2a6dd6(0x22f))&&await handleSDKOutput([_0x3f2ba3],_0x1fed40),0x0;}catch(_0x2882a3){return handleSDKError(_0x2882a3,_0x1fed40),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{['name']='llm:project:restore';[a20_0x480902(0x1a2)]=a20_0x480902(0x1a8);async[a20_0x480902(0x23c)](_0x2f0ea8){const _0x510a1f=a20_0x480902,{options:_0x25186a,args:_0x252422,tdx:_0x227c3d}=_0x2f0ea8,_0x24adaf=getChalk(_0x25186a);console[_0x510a1f(0x24b)](_0x24adaf[_0x510a1f(0x251)](_0x510a1f(0x229))),console[_0x510a1f(0x24b)](_0x24adaf[_0x510a1f(0x251)](_0x510a1f(0x1b7))),console[_0x510a1f(0x24b)](_0x24adaf[_0x510a1f(0x1e1)](_0x510a1f(0x19a))),console[_0x510a1f(0x24b)](_0x24adaf[_0x510a1f(0x1e1)](_0x510a1f(0x1cd))),console[_0x510a1f(0x24b)](_0x24adaf[_0x510a1f(0x1e1)](_0x510a1f(0x1c3))),console[_0x510a1f(0x24b)]();if(_0x252422[_0x510a1f(0x192)]===0x0)return console[_0x510a1f(0x1c0)]('Error:\x20Backup\x20folder\x20path\x20is\x20required'),console[_0x510a1f(0x1c0)](_0x510a1f(0x215)),0x1;const _0x4287e6=_0x252422[0x0],_0x1f92d5=_0x25186a,_0x34b764=_0x1f92d5[_0x510a1f(0x1d5)],_0x50f67e=_0x1f92d5['dryRun'];try{if(!_0x50f67e){const _0x339edf=_0x227c3d[_0x510a1f(0x269)][_0x510a1f(0x227)](_0x4287e6),_0x4e053a=_0x34b764||_0x339edf['exportedFrom'][_0x510a1f(0x1f0)],_0x29741f=await withSpinner(_0x510a1f(0x1e7),()=>_0x227c3d[_0x510a1f(0x269)][_0x510a1f(0x1ed)](),{'verbose':_0x25186a['verbose']}),_0x2aa745=_0x29741f[_0x510a1f(0x1b0)][_0x510a1f(0x1e3)](_0x561a85=>_0x561a85[_0x510a1f(0x1aa)][_0x510a1f(0x1d5)]===_0x4e053a);if(_0x2aa745&&!_0x25186a[_0x510a1f(0x25d)]){const _0x37763e=await confirm('A\x20project\x20named\x20\x27'+_0x4e053a+'\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?');if(!_0x37763e)return console['log'](_0x510a1f(0x1bd)),0x0;}}const _0x36abcb=await withSpinner(_0x50f67e?'Validating\x20backup\x20from\x20\x27'+_0x4287e6+_0x510a1f(0x1ab):_0x510a1f(0x250)+_0x4287e6+'\x27...',()=>_0x227c3d[_0x510a1f(0x269)]['restoreProject'](_0x4287e6,{'name':_0x34b764,'dryRun':_0x50f67e}),{'verbose':_0x25186a[_0x510a1f(0x1da)]}),_0xae913a=_0x36abcb[_0x510a1f(0x1b0)];return _0xae913a['sourceSite']&&console['log'](_0x510a1f(0x202)+_0xae913a[_0x510a1f(0x25e)]+'\x27'),_0x50f67e?console['log'](_0x510a1f(0x1bc)+_0xae913a['projectName']):console['log'](_0x510a1f(0x1db)+_0xae913a[_0x510a1f(0x1f0)]+'\x20('+_0xae913a[_0x510a1f(0x1b9)]+')'),console[_0x510a1f(0x24b)](_0x510a1f(0x257)+_0xae913a['counts']['agents']),console[_0x510a1f(0x24b)](_0x510a1f(0x1f1)+_0xae913a['counts'][_0x510a1f(0x214)]),console[_0x510a1f(0x24b)](_0x510a1f(0x245)+_0xae913a[_0x510a1f(0x19f)]['prompts']),console[_0x510a1f(0x24b)](_0x510a1f(0x1e8)+_0xae913a[_0x510a1f(0x19f)]['integrations']),(_0x25186a[_0x510a1f(0x217)]==='json'||_0x25186a[_0x510a1f(0x217)]===_0x510a1f(0x22f))&&await handleSDKOutput([_0xae913a],_0x25186a),0x0;}catch(_0x35249a){return handleSDKError(_0x35249a,_0x25186a),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x2a3082,_0x429b73){const _0x5cfbcc=a20_0x480902,_0x575282=_0x429b73['limit']||CHAT_SELECTOR_PAGE_SIZE;let _0x5267f5=0x0,_0x51cf54=[];const _0x4e885a=(await import(_0x5cfbcc(0x1e5)))[_0x5cfbcc(0x1a0)],_0x32da31=getChalk(_0x429b73);while(!![]){const _0xc4fa28=await withSpinner(_0x5cfbcc(0x248),()=>_0x2a3082[_0x5cfbcc(0x269)][_0x5cfbcc(0x234)](_0x575282+_0x5267f5),{'verbose':_0x429b73[_0x5cfbcc(0x1da)]});_0x51cf54=_0xc4fa28['data'];const _0x1763de=_0x51cf54['slice'](_0x5267f5,_0x5267f5+_0x575282),_0x543a5e=_0x51cf54[_0x5cfbcc(0x192)]>_0x5267f5+_0x575282,_0x509002=[...new Set(_0x1763de['map'](_0x164224=>_0x164224[_0x5cfbcc(0x1aa)][_0x5cfbcc(0x1df)])['filter'](_0x58fdd2=>_0x58fdd2!==undefined))],_0x2d1477=new Map();await Promise[_0x5cfbcc(0x24c)](_0x509002[_0x5cfbcc(0x1cc)](async _0x18194d=>{const _0x134685=_0x5cfbcc;try{const _0x39f211=await _0x2a3082[_0x134685(0x269)]['agent'](_0x18194d);_0x2d1477['set'](_0x18194d,_0x39f211['attributes'][_0x134685(0x1d5)]);}catch{_0x2d1477['set'](_0x18194d,_0x18194d);}}));const _0x529e34=_0x1763de['map'](_0x3d921a=>{const _0x4ce0dd=_0x5cfbcc,_0x2856e9=_0x3d921a[_0x4ce0dd(0x1aa)][_0x4ce0dd(0x1a5)]||_0x4ce0dd(0x231),_0x3c9687=_0x2856e9[_0x4ce0dd(0x205)]('\x0a')[0x0],_0x31a5ec=_0x3c9687[_0x4ce0dd(0x192)]>0x50?_0x3c9687[_0x4ce0dd(0x1f9)](0x0,0x4d)+_0x4ce0dd(0x1c4):_0x3c9687,_0x30d309=_0x3d921a['attributes'][_0x4ce0dd(0x1df)]?_0x2d1477['get'](_0x3d921a[_0x4ce0dd(0x1aa)][_0x4ce0dd(0x1df)])||_0x3d921a[_0x4ce0dd(0x1aa)][_0x4ce0dd(0x1df)]:_0x4ce0dd(0x238),_0x29ed81=_0x3d921a[_0x4ce0dd(0x1aa)][_0x4ce0dd(0x265)]||_0x3d921a[_0x4ce0dd(0x1aa)]['updatedAt'],_0x43d086=new Date(_0x29ed81),_0x212011=new Date(),_0x4cc9e3=_0x212011[_0x4ce0dd(0x198)]()-_0x43d086['getTime'](),_0x226896=Math['floor'](_0x4cc9e3/0xea60),_0x46e79c=Math[_0x4ce0dd(0x19b)](_0x4cc9e3/0x36ee80),_0xafbda2=Math[_0x4ce0dd(0x19b)](_0x4cc9e3/0x5265c00);let _0x433c2b;if(_0x226896<0x1)_0x433c2b=_0x4ce0dd(0x21a);else{if(_0x226896<0x3c)_0x433c2b=_0x226896+_0x4ce0dd(0x1af);else{if(_0x46e79c<0x18)_0x433c2b=_0x46e79c+'h\x20ago';else _0xafbda2<0x7?_0x433c2b=_0xafbda2+_0x4ce0dd(0x25c):_0x433c2b=_0x43d086[_0x4ce0dd(0x256)](_0x4ce0dd(0x212),{'month':'short','day':_0x4ce0dd(0x249)});}}return{'title':_0x31a5ec+'\x20'+_0x32da31[_0x4ce0dd(0x1e1)]('['+_0x30d309+']\x20'+_0x433c2b),'value':_0x3d921a['id']};});_0x543a5e&&_0x529e34[_0x5cfbcc(0x259)]({'title':_0x32da31['cyan']('Load\x20more...'),'value':'__load_more__'});const _0x2378c7=await _0x4e885a({'type':'select','name':_0x5cfbcc(0x213),'message':_0x5cfbcc(0x239),'choices':_0x529e34,'hint':_0x5cfbcc(0x26a)});if(!_0x2378c7[_0x5cfbcc(0x213)])return undefined;if(_0x2378c7[_0x5cfbcc(0x213)]===_0x5cfbcc(0x1ef)){_0x5267f5+=_0x575282;continue;}return _0x2378c7['chatId'];}}export class ChatsCommand extends BaseCommand{[a20_0x480902(0x1d5)]=a20_0x480902(0x234);[a20_0x480902(0x1a2)]=a20_0x480902(0x1b6);async[a20_0x480902(0x23c)](_0x69a78c){const _0x4c3ba1=a20_0x480902;return executeChatHistoryCommand(_0x69a78c,_0x4c3ba1(0x258));}}
@@ -1 +1 @@
1
- const a21_0x4d9154=a21_0x4ba0;(function(_0x49cda1,_0x12c672){const _0x590718=a21_0x4ba0,_0x37e843=_0x49cda1();while(!![]){try{const _0x535b0b=parseInt(_0x590718(0x1c5))/0x1+-parseInt(_0x590718(0x1d7))/0x2*(-parseInt(_0x590718(0x1cf))/0x3)+parseInt(_0x590718(0x1d0))/0x4*(parseInt(_0x590718(0x200))/0x5)+-parseInt(_0x590718(0x1f6))/0x6+-parseInt(_0x590718(0x1fc))/0x7+-parseInt(_0x590718(0x1c9))/0x8+-parseInt(_0x590718(0x1dc))/0x9*(-parseInt(_0x590718(0x201))/0xa);if(_0x535b0b===_0x12c672)break;else _0x37e843['push'](_0x37e843['shift']());}catch(_0x432a28){_0x37e843['push'](_0x37e843['shift']());}}}(a21_0x5788,0xea6db));import a21_0x306c97 from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';import{findAvailablePort}from'../utils/port.js';function a21_0x5788(){const _0x412fc1=['site','llm','llm:proxy','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','4778BzEsmr','\x27\x20not\x20found','name','NOT_FOUND','description','3019293gFRHKT','created\x20on-demand\x20per\x20model','\x20\x20}','projects','\x20\x20\x20\x20\x22env\x22:\x20{','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','✓\x20Proxy\x20server\x20stopped','init','green','server','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','logLevel','Server\x20Configuration:','\x20\x20Site:','cyan','Resolving\x20project...','getOrCreateDefaultProject','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','white','Starting\x20proxy\x20server...','attributes','llmProject','dim','9660666QUnHoO','bold','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','\x20\x20Address:','\x20is\x20unavailable,\x20using\x20port\x20','5954228qoJJSD','port','SIGTERM','log','5pdrSzC','30ddfwQE','close','project','stop','1080487uUBQDD','Project\x20\x27','Port\x20','yellow','3551504fOuotp','\x0a\x0aShutting\x20down\x20proxy\x20server...','\x20\x20\x20\x20}','logger','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','SIGINT','1251hXriBx','3126964ubKFOp','✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a','start'];a21_0x5788=function(){return _0x412fc1;};return a21_0x5788();}async function getProjectIdOrDefault(_0xf7f362,_0x3313a4){const _0x4aa194=a21_0x4ba0,{tdx:_0x100a31,options:_0x59cf87}=_0xf7f362,_0x566432=_0x3313a4||_0x59cf87[_0x4aa194(0x1f4)];if(_0x566432){const _0x2e36fc=await _0x100a31['llm'][_0x4aa194(0x1df)](),_0x4f0a73=_0x2e36fc['find'](_0x1e1278=>_0x1e1278[_0x4aa194(0x1f3)][_0x4aa194(0x1d9)]===_0x566432);if(!_0x4f0a73)throw new SDKError(ErrorCode[_0x4aa194(0x1da)],_0x4aa194(0x1c6)+_0x566432+_0x4aa194(0x1d8),undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects'});return _0x4f0a73['id'];}const _0x8cd2ad=await _0x100a31[_0x4aa194(0x1d4)][_0x4aa194(0x1ef)]();return _0x8cd2ad['id'];}function a21_0x4ba0(_0x6b158,_0x9efa6c){_0x6b158=_0x6b158-0x1c4;const _0x57883b=a21_0x5788();let _0x4ba060=_0x57883b[_0x6b158];return _0x4ba060;}export class LLMProxyCommand extends BaseCommand{[a21_0x4d9154(0x1d9)]=a21_0x4d9154(0x1d5);[a21_0x4d9154(0x1db)]=a21_0x4d9154(0x1e9);[a21_0x4d9154(0x1e5)];[a21_0x4d9154(0x1cc)];async['execute'](_0x5ecbca){const _0x3adddc=a21_0x4d9154,{tdx:_0x327373,options:_0x4bed60}=_0x5ecbca;try{const _0x1dca82=_0x4bed60,_0x3bed54=_0x1dca82[_0x3adddc(0x1fd)]||0xfa0,_0x58032c=_0x1dca82[_0x3adddc(0x203)],_0x4c8c8d=await findAvailablePort(_0x3bed54);console[_0x3adddc(0x1ff)](a21_0x306c97[_0x3adddc(0x1f5)](_0x3adddc(0x1ee)));const _0x155e87=await getProjectIdOrDefault(_0x5ecbca,_0x58032c),_0x9de716=await _0x327373[_0x3adddc(0x1d4)][_0x3adddc(0x1df)](),_0x6ab738=_0x9de716['find'](_0x590214=>_0x590214['id']===_0x155e87);this[_0x3adddc(0x1cc)]=new TDXLogger(_0x4bed60[_0x3adddc(0x1ea)]),await this[_0x3adddc(0x1cc)][_0x3adddc(0x1e3)](),console[_0x3adddc(0x1ff)](a21_0x306c97[_0x3adddc(0x1f5)](_0x3adddc(0x1f2)));_0x4c8c8d!==_0x3bed54&&console['log'](a21_0x306c97[_0x3adddc(0x1c8)](_0x3adddc(0x1c7)+_0x3bed54+_0x3adddc(0x1fb)+_0x4c8c8d));this[_0x3adddc(0x1e5)]=new ProxyServer({'port':_0x4c8c8d,'projectId':_0x155e87,'tdx':_0x327373,'logger':this[_0x3adddc(0x1cc)],'site':_0x4bed60['site']}),await this[_0x3adddc(0x1e5)][_0x3adddc(0x1d2)](),console['log'](a21_0x306c97[_0x3adddc(0x1c8)]['bold'](_0x3adddc(0x1cd))),console[_0x3adddc(0x1ff)](a21_0x306c97[_0x3adddc(0x1c8)](_0x3adddc(0x1e6))),console[_0x3adddc(0x1ff)](a21_0x306c97[_0x3adddc(0x1c8)](_0x3adddc(0x1f9))),console['log'](a21_0x306c97[_0x3adddc(0x1e4)][_0x3adddc(0x1f7)](_0x3adddc(0x1d1))),console[_0x3adddc(0x1ff)](a21_0x306c97[_0x3adddc(0x1ed)](_0x3adddc(0x1eb))),console[_0x3adddc(0x1ff)](a21_0x306c97[_0x3adddc(0x1f5)](_0x3adddc(0x1fa)),a21_0x306c97[_0x3adddc(0x1f1)]('http://0.0.0.0:'+_0x4c8c8d)),console[_0x3adddc(0x1ff)](a21_0x306c97['dim']('\x20\x20Project:'),a21_0x306c97[_0x3adddc(0x1f1)](_0x6ab738?.['attributes'][_0x3adddc(0x1d9)]||_0x155e87)),console['log'](a21_0x306c97[_0x3adddc(0x1f5)]('\x20\x20Agents:'),a21_0x306c97['white'](_0x3adddc(0x1dd))),console['log'](a21_0x306c97[_0x3adddc(0x1f5)](_0x3adddc(0x1ec)),a21_0x306c97[_0x3adddc(0x1f1)](_0x4bed60[_0x3adddc(0x1d3)])),console[_0x3adddc(0x1ff)](a21_0x306c97['cyan']('\x0aClaude\x20Code\x20Configuration:')),console[_0x3adddc(0x1ff)](a21_0x306c97[_0x3adddc(0x1f5)](_0x3adddc(0x1f0))),console[_0x3adddc(0x1ff)](a21_0x306c97[_0x3adddc(0x1f1)]('\x20\x20{')),console['log'](a21_0x306c97[_0x3adddc(0x1f1)](_0x3adddc(0x1e0))),console[_0x3adddc(0x1ff)](a21_0x306c97[_0x3adddc(0x1f1)](_0x3adddc(0x1e1)+_0x4c8c8d+'\x22,')),console[_0x3adddc(0x1ff)](a21_0x306c97['white'](_0x3adddc(0x1e7))),console[_0x3adddc(0x1ff)](a21_0x306c97['white'](_0x3adddc(0x1d6))),console['log'](a21_0x306c97[_0x3adddc(0x1f1)](_0x3adddc(0x1cb))),console['log'](a21_0x306c97[_0x3adddc(0x1f1)](_0x3adddc(0x1de))),console[_0x3adddc(0x1ff)](a21_0x306c97['cyan']('\x0aTesting\x20with\x20Agent\x20SDK:')),console[_0x3adddc(0x1ff)](a21_0x306c97[_0x3adddc(0x1f5)](_0x3adddc(0x1e8))),console[_0x3adddc(0x1ff)](a21_0x306c97[_0x3adddc(0x1f5)]('\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript')),console['log'](a21_0x306c97[_0x3adddc(0x1f5)](_0x3adddc(0x1f8))),console[_0x3adddc(0x1ff)](a21_0x306c97[_0x3adddc(0x1c8)]('Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a'));const _0x456ad7=async()=>{const _0x122bae=_0x3adddc;console[_0x122bae(0x1ff)](a21_0x306c97[_0x122bae(0x1f5)](_0x122bae(0x1ca))),this[_0x122bae(0x1e5)]&&await this[_0x122bae(0x1e5)][_0x122bae(0x1c4)](),this['logger']&&await this[_0x122bae(0x1cc)]['close'](),console[_0x122bae(0x1ff)](a21_0x306c97[_0x122bae(0x1e4)](_0x122bae(0x1e2))),process['exit'](0x0);};return process['on'](_0x3adddc(0x1ce),_0x456ad7),process['on'](_0x3adddc(0x1fe),_0x456ad7),await new Promise(()=>{}),0x0;}catch(_0x2b3785){this[_0x3adddc(0x1e5)]&&await this[_0x3adddc(0x1e5)]['stop']();this['logger']&&await this[_0x3adddc(0x1cc)][_0x3adddc(0x202)]();throw _0x2b3785;}}}
1
+ const a21_0x52c832=a21_0x3d82;(function(_0x449b1f,_0x4dbbf0){const _0x351ce2=a21_0x3d82,_0x9af354=_0x449b1f();while(!![]){try{const _0x23cd04=-parseInt(_0x351ce2(0x15e))/0x1+parseInt(_0x351ce2(0x151))/0x2+-parseInt(_0x351ce2(0x159))/0x3+parseInt(_0x351ce2(0x145))/0x4*(-parseInt(_0x351ce2(0x15a))/0x5)+-parseInt(_0x351ce2(0x168))/0x6+parseInt(_0x351ce2(0x14a))/0x7*(parseInt(_0x351ce2(0x16e))/0x8)+parseInt(_0x351ce2(0x14b))/0x9;if(_0x23cd04===_0x4dbbf0)break;else _0x9af354['push'](_0x9af354['shift']());}catch(_0x22ab0e){_0x9af354['push'](_0x9af354['shift']());}}}(a21_0x3a21,0xe3267));import a21_0x5cdace from'chalk';import{BaseCommand}from'./command.js';import{ProxyServer}from'../proxy/server.js';import{TDXLogger}from'../utils/tdx-logger.js';import{SDKError,ErrorCode}from'../sdk/errors.js';function a21_0x3d82(_0x14acc5,_0x56c61f){_0x14acc5=_0x14acc5-0x13c;const _0x3a212e=a21_0x3a21();let _0x3d8221=_0x3a212e[_0x14acc5];return _0x3d8221;}function a21_0x3a21(){const _0x471a46=['[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','llm','close','12617675HMepUB','24356043jgMPQW','llmProject','log','find','created\x20on-demand\x20per\x20model','llm:proxy','961630AyBAml','SIGINT','yellow','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','\x20\x20}','server','SIGTERM','http://0.0.0.0:','1938519LcuqKO','5HkuCIx','bold','\x20\x20Address:','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','1273601DUtVrm','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','\x0aClaude\x20Code\x20Configuration:','execute','\x20\x20\x20\x20}','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','Starting\x20proxy\x20server...','\x20\x20{','green','5189346pXHLNT','name','dim','✓\x20Proxy\x20server\x20stopped','\x0aTesting\x20with\x20Agent\x20SDK:','logger','8ZOQUZi','start','cyan','project','attributes','site','Server\x20Configuration:','\x20\x20\x20\x20\x22env\x22:\x20{','white','stop','projects','getOrCreateDefaultProject','\x0a\x0aShutting\x20down\x20proxy\x20server...','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','5097980sIFeix','Port\x20'];a21_0x3a21=function(){return _0x471a46;};return a21_0x3a21();}import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x1bf0c3,_0xb1db8b){const _0x13676a=a21_0x3d82,{tdx:_0x329c71,options:_0x2b9d0c}=_0x1bf0c3,_0xdf9f8b=_0xb1db8b||_0x2b9d0c[_0x13676a(0x14c)];if(_0xdf9f8b){const _0x4593c7=await _0x329c71[_0x13676a(0x148)][_0x13676a(0x141)](),_0x14154b=_0x4593c7[_0x13676a(0x14e)](_0x9dbc31=>_0x9dbc31['attributes']['name']===_0xdf9f8b);if(!_0x14154b)throw new SDKError(ErrorCode['NOT_FOUND'],'Project\x20\x27'+_0xdf9f8b+'\x27\x20not\x20found',undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects'});return _0x14154b['id'];}const _0x470ae5=await _0x329c71[_0x13676a(0x148)][_0x13676a(0x142)]();return _0x470ae5['id'];}export class LLMProxyCommand extends BaseCommand{[a21_0x52c832(0x169)]=a21_0x52c832(0x150);['description']=a21_0x52c832(0x147);[a21_0x52c832(0x156)];['logger'];async[a21_0x52c832(0x161)](_0x4f540b){const _0x311f31=a21_0x52c832,{tdx:_0x70f193,options:_0x2b2904}=_0x4f540b;try{const _0x14521b=_0x2b2904,_0x59222e=_0x14521b['port']||0xfa0,_0x73c9d3=_0x14521b[_0x311f31(0x171)],_0x45a64a=await findAvailablePort(_0x59222e);console[_0x311f31(0x14d)](a21_0x5cdace['dim']('Resolving\x20project...'));const _0x28afc9=await getProjectIdOrDefault(_0x4f540b,_0x73c9d3),_0x5b991d=await _0x70f193['llm'][_0x311f31(0x141)](),_0xf20f7b=_0x5b991d[_0x311f31(0x14e)](_0xfd4ff1=>_0xfd4ff1['id']===_0x28afc9);this[_0x311f31(0x16d)]=new TDXLogger(_0x2b2904['logLevel']),await this[_0x311f31(0x16d)]['init'](),console[_0x311f31(0x14d)](a21_0x5cdace[_0x311f31(0x16a)](_0x311f31(0x165)));_0x45a64a!==_0x59222e&&console['log'](a21_0x5cdace['yellow'](_0x311f31(0x146)+_0x59222e+'\x20is\x20unavailable,\x20using\x20port\x20'+_0x45a64a));this[_0x311f31(0x156)]=new ProxyServer({'port':_0x45a64a,'projectId':_0x28afc9,'tdx':_0x70f193,'logger':this[_0x311f31(0x16d)],'site':_0x2b2904[_0x311f31(0x13c)]}),await this[_0x311f31(0x156)][_0x311f31(0x16f)](),console['log'](a21_0x5cdace[_0x311f31(0x153)][_0x311f31(0x15b)]('\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE')),console[_0x311f31(0x14d)](a21_0x5cdace[_0x311f31(0x153)]('This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.')),console[_0x311f31(0x14d)](a21_0x5cdace[_0x311f31(0x153)]('Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a')),console[_0x311f31(0x14d)](a21_0x5cdace[_0x311f31(0x167)][_0x311f31(0x15b)]('✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a')),console[_0x311f31(0x14d)](a21_0x5cdace[_0x311f31(0x170)](_0x311f31(0x13d))),console[_0x311f31(0x14d)](a21_0x5cdace[_0x311f31(0x16a)](_0x311f31(0x15c)),a21_0x5cdace[_0x311f31(0x13f)](_0x311f31(0x158)+_0x45a64a)),console[_0x311f31(0x14d)](a21_0x5cdace['dim']('\x20\x20Project:'),a21_0x5cdace[_0x311f31(0x13f)](_0xf20f7b?.[_0x311f31(0x172)][_0x311f31(0x169)]||_0x28afc9)),console[_0x311f31(0x14d)](a21_0x5cdace[_0x311f31(0x16a)]('\x20\x20Agents:'),a21_0x5cdace['white'](_0x311f31(0x14f))),console[_0x311f31(0x14d)](a21_0x5cdace[_0x311f31(0x16a)]('\x20\x20Site:'),a21_0x5cdace[_0x311f31(0x13f)](_0x2b2904[_0x311f31(0x13c)])),console['log'](a21_0x5cdace[_0x311f31(0x170)](_0x311f31(0x160))),console['log'](a21_0x5cdace['dim'](_0x311f31(0x144))),console[_0x311f31(0x14d)](a21_0x5cdace[_0x311f31(0x13f)](_0x311f31(0x166))),console['log'](a21_0x5cdace[_0x311f31(0x13f)](_0x311f31(0x13e))),console[_0x311f31(0x14d)](a21_0x5cdace[_0x311f31(0x13f)](_0x311f31(0x164)+_0x45a64a+'\x22,')),console[_0x311f31(0x14d)](a21_0x5cdace[_0x311f31(0x13f)](_0x311f31(0x15f))),console['log'](a21_0x5cdace[_0x311f31(0x13f)]('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22')),console[_0x311f31(0x14d)](a21_0x5cdace['white'](_0x311f31(0x162))),console[_0x311f31(0x14d)](a21_0x5cdace[_0x311f31(0x13f)](_0x311f31(0x155))),console[_0x311f31(0x14d)](a21_0x5cdace[_0x311f31(0x170)](_0x311f31(0x16c))),console[_0x311f31(0x14d)](a21_0x5cdace[_0x311f31(0x16a)]('\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK')),console[_0x311f31(0x14d)](a21_0x5cdace[_0x311f31(0x16a)](_0x311f31(0x163))),console[_0x311f31(0x14d)](a21_0x5cdace['dim'](_0x311f31(0x15d))),console['log'](a21_0x5cdace[_0x311f31(0x153)](_0x311f31(0x154)));const _0x2bc93d=async()=>{const _0x3845f2=_0x311f31;console[_0x3845f2(0x14d)](a21_0x5cdace[_0x3845f2(0x16a)](_0x3845f2(0x143))),this[_0x3845f2(0x156)]&&await this[_0x3845f2(0x156)][_0x3845f2(0x140)](),this['logger']&&await this[_0x3845f2(0x16d)][_0x3845f2(0x149)](),console[_0x3845f2(0x14d)](a21_0x5cdace[_0x3845f2(0x167)](_0x3845f2(0x16b))),process['exit'](0x0);};return process['on'](_0x311f31(0x152),_0x2bc93d),process['on'](_0x311f31(0x157),_0x2bc93d),await new Promise(()=>{}),0x0;}catch(_0x11c8e3){this['server']&&await this[_0x311f31(0x156)][_0x311f31(0x140)]();this[_0x311f31(0x16d)]&&await this['logger'][_0x311f31(0x149)]();throw _0x11c8e3;}}}
@@ -1 +1 @@
1
- const a22_0x1824dc=a22_0x318a;(function(_0x188a37,_0x59243a){const _0x2214d2=a22_0x318a,_0x4bacb6=_0x188a37();while(!![]){try{const _0x7c4ab2=parseInt(_0x2214d2(0x11d))/0x1+-parseInt(_0x2214d2(0x11e))/0x2+parseInt(_0x2214d2(0x10f))/0x3*(parseInt(_0x2214d2(0x115))/0x4)+parseInt(_0x2214d2(0x122))/0x5*(-parseInt(_0x2214d2(0x118))/0x6)+parseInt(_0x2214d2(0x111))/0x7*(parseInt(_0x2214d2(0x116))/0x8)+-parseInt(_0x2214d2(0x120))/0x9+parseInt(_0x2214d2(0x110))/0xa;if(_0x7c4ab2===_0x59243a)break;else _0x4bacb6['push'](_0x4bacb6['shift']());}catch(_0x19916d){_0x4bacb6['push'](_0x4bacb6['shift']());}}}(a22_0x4559,0x3b823));import{BaseCommand}from'./command.js';import{startMCPServer}from'../mcp/server.js';function a22_0x4559(){const _0x2bdd63=['context','apiKey','Start\x20MCP\x20server\x20for\x20AI\x20tool\x20integration','error','327773uFpztZ','434868kIgWij','execute','1529208iBEBIz','TDX_PROFILE','1055NXYSVC','TDX_SITE','mcp','120pNVDMT','1167010bAoLbt','2962582LMjArz','site','TDX_API_KEY','env','19320vkFkPy','8moxVhr','name','12222nuMPfQ'];a22_0x4559=function(){return _0x2bdd63;};return a22_0x4559();}function a22_0x318a(_0x4a7235,_0x3a33ec){_0x4a7235=_0x4a7235-0x10e;const _0x4559d8=a22_0x4559();let _0x318ac0=_0x4559d8[_0x4a7235];return _0x318ac0;}export class MCPCommand extends BaseCommand{[a22_0x1824dc(0x117)]=a22_0x1824dc(0x10e);['description']=a22_0x1824dc(0x11b);async[a22_0x1824dc(0x11f)](_0x12772f){const _0x40a355=a22_0x1824dc,{tdx:_0x5d0b08}=_0x12772f,_0x2d2db0={};if(process[_0x40a355(0x114)][_0x40a355(0x121)])_0x2d2db0['TDX_PROFILE']=process[_0x40a355(0x114)][_0x40a355(0x121)];else{if(process[_0x40a355(0x114)][_0x40a355(0x113)])_0x2d2db0[_0x40a355(0x113)]=process['env'][_0x40a355(0x113)],process[_0x40a355(0x114)][_0x40a355(0x123)]&&(_0x2d2db0[_0x40a355(0x123)]=process[_0x40a355(0x114)]['TDX_SITE']);else _0x5d0b08[_0x40a355(0x119)][_0x40a355(0x11a)]&&(_0x2d2db0[_0x40a355(0x113)]=_0x5d0b08[_0x40a355(0x119)][_0x40a355(0x11a)],_0x2d2db0['TDX_SITE']=_0x5d0b08[_0x40a355(0x119)][_0x40a355(0x112)]);}_0x5d0b08[_0x40a355(0x119)]['profile']&&(_0x2d2db0[_0x40a355(0x121)]=_0x5d0b08['context']['profile']);try{return await startMCPServer({'env':_0x2d2db0}),0x0;}catch(_0x6d31c1){const _0x557734=_0x6d31c1 instanceof Error?_0x6d31c1['message']:String(_0x6d31c1);return console[_0x40a355(0x11c)]('MCP\x20server\x20error:\x20'+_0x557734),0x1;}}}
1
+ function a22_0x4d1e(){const _0x1ed3a8=['message','7134PPvsYj','context','858233cjsCdn','752NvqNsr','env','Start\x20MCP\x20server\x20for\x20AI\x20tool\x20integration','48vcJVJR','TDX_PROFILE','4333NhANnf','TDX_API_KEY','7959650LRTkNz','apiKey','profile','188937spYCdc','name','2naitqc','11163823AJQakz','5750JbXiGb','TDX_SITE','error','MCP\x20server\x20error:\x20','28953omkonv'];a22_0x4d1e=function(){return _0x1ed3a8;};return a22_0x4d1e();}function a22_0x492b(_0x1bf551,_0x13cce0){_0x1bf551=_0x1bf551-0x1aa;const _0x4d1e96=a22_0x4d1e();let _0x492bcc=_0x4d1e96[_0x1bf551];return _0x492bcc;}const a22_0x229ae0=a22_0x492b;(function(_0x91dd84,_0x13b7c6){const _0xe4f546=a22_0x492b,_0x1d73ec=_0x91dd84();while(!![]){try{const _0x2f769a=-parseInt(_0xe4f546(0x1b3))/0x1+-parseInt(_0xe4f546(0x1c0))/0x2*(parseInt(_0xe4f546(0x1af))/0x3)+parseInt(_0xe4f546(0x1b4))/0x4*(parseInt(_0xe4f546(0x1ab))/0x5)+parseInt(_0xe4f546(0x1b1))/0x6*(parseInt(_0xe4f546(0x1b9))/0x7)+parseInt(_0xe4f546(0x1b7))/0x8*(parseInt(_0xe4f546(0x1be))/0x9)+-parseInt(_0xe4f546(0x1bb))/0xa+parseInt(_0xe4f546(0x1aa))/0xb;if(_0x2f769a===_0x13b7c6)break;else _0x1d73ec['push'](_0x1d73ec['shift']());}catch(_0x1c0d73){_0x1d73ec['push'](_0x1d73ec['shift']());}}}(a22_0x4d1e,0x68c89));import{BaseCommand}from'./command.js';import{startMCPServer}from'../mcp/server.js';export class MCPCommand extends BaseCommand{[a22_0x229ae0(0x1bf)]='mcp';['description']=a22_0x229ae0(0x1b6);async['execute'](_0x49fdc2){const _0x5ee53b=a22_0x229ae0,{tdx:_0x5bde24}=_0x49fdc2,_0x43c233={};if(process[_0x5ee53b(0x1b5)][_0x5ee53b(0x1b8)])_0x43c233[_0x5ee53b(0x1b8)]=process[_0x5ee53b(0x1b5)]['TDX_PROFILE'];else{if(process[_0x5ee53b(0x1b5)][_0x5ee53b(0x1ba)])_0x43c233['TDX_API_KEY']=process[_0x5ee53b(0x1b5)]['TDX_API_KEY'],process[_0x5ee53b(0x1b5)][_0x5ee53b(0x1ac)]&&(_0x43c233['TDX_SITE']=process[_0x5ee53b(0x1b5)][_0x5ee53b(0x1ac)]);else _0x5bde24['context'][_0x5ee53b(0x1bc)]&&(_0x43c233[_0x5ee53b(0x1ba)]=_0x5bde24[_0x5ee53b(0x1b2)][_0x5ee53b(0x1bc)],_0x43c233[_0x5ee53b(0x1ac)]=_0x5bde24['context']['site']);}_0x5bde24[_0x5ee53b(0x1b2)][_0x5ee53b(0x1bd)]&&(_0x43c233['TDX_PROFILE']=_0x5bde24[_0x5ee53b(0x1b2)][_0x5ee53b(0x1bd)]);try{return await startMCPServer({'env':_0x43c233}),0x0;}catch(_0x11b4d0){const _0x51587f=_0x11b4d0 instanceof Error?_0x11b4d0[_0x5ee53b(0x1b0)]:String(_0x11b4d0);return console[_0x5ee53b(0x1ad)](_0x5ee53b(0x1ae)+_0x51587f),0x1;}}}