@treasuredata/tdx 0.14.8 → 0.14.9

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 (144) hide show
  1. package/README.md +21 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/build-info.json +3 -3
  4. package/dist/cli-categories.js +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/commands/activations.js +1 -1
  7. package/dist/commands/agent-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/parent-segment-command.js +1 -1
  25. package/dist/commands/profile-command.js +1 -1
  26. package/dist/commands/profiles-command.js +1 -1
  27. package/dist/commands/query-command.js +1 -1
  28. package/dist/commands/segment-command.js +1 -1
  29. package/dist/commands/segment-create-command.js +1 -1
  30. package/dist/commands/segment-fields-command.js +1 -1
  31. package/dist/commands/segment-pull-command.js +1 -1
  32. package/dist/commands/segment-push-command.js +1 -1
  33. package/dist/commands/segment-update-command.js +1 -1
  34. package/dist/commands/segment-use-command.js +1 -1
  35. package/dist/commands/segment-validate-command.js +1 -1
  36. package/dist/commands/segments.js +1 -1
  37. package/dist/commands/show.js +1 -1
  38. package/dist/commands/tables.js +1 -1
  39. package/dist/commands/unset-command.js +1 -1
  40. package/dist/commands/use-command.js +1 -1
  41. package/dist/commands/user-command.js +1 -1
  42. package/dist/commands/workflow-command.js +1 -1
  43. package/dist/core/auth.js +1 -1
  44. package/dist/core/command-output.js +1 -1
  45. package/dist/core/config.js +1 -1
  46. package/dist/core/connection-cache.js +1 -1
  47. package/dist/core/constants.js +1 -1
  48. package/dist/core/credential-cache.js +1 -1
  49. package/dist/core/global-context.js +1 -1
  50. package/dist/core/keychain.js +1 -1
  51. package/dist/core/profile.js +1 -1
  52. package/dist/core/project-config.js +1 -1
  53. package/dist/core/session.js +1 -1
  54. package/dist/core/user-cache.js +1 -1
  55. package/dist/core/version.js +1 -1
  56. package/dist/index.js +1 -1
  57. package/dist/proxy/anthropic-adapter.js +1 -1
  58. package/dist/proxy/claude-usage-tracker.js +1 -1
  59. package/dist/proxy/context-signature.js +1 -1
  60. package/dist/proxy/conversation-utils.js +1 -1
  61. package/dist/proxy/passthrough-server.js +1 -1
  62. package/dist/proxy/server.js +1 -1
  63. package/dist/proxy/session-cache.js +1 -1
  64. package/dist/proxy/sse-usage-parser.js +1 -1
  65. package/dist/sdk/agent/agent-config.js +1 -1
  66. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  67. package/dist/sdk/agent/agent-yaml.js +1 -1
  68. package/dist/sdk/api.js +1 -1
  69. package/dist/sdk/client/cdp-api-client.js +1 -1
  70. package/dist/sdk/client/endpoints.js +1 -1
  71. package/dist/sdk/client/engage-api-client.js +1 -1
  72. package/dist/sdk/client/http-client.js +1 -1
  73. package/dist/sdk/client/llm-api-client.js +1 -1
  74. package/dist/sdk/client/rate-limiter.js +1 -1
  75. package/dist/sdk/client/td-api-client.js +1 -1
  76. package/dist/sdk/client/trino-api-client.d.ts.map +1 -1
  77. package/dist/sdk/client/trino-api-client.js +1 -1
  78. package/dist/sdk/client/trino-api-client.js.map +1 -1
  79. package/dist/sdk/client/workflow-client.js +1 -1
  80. package/dist/sdk/connection-validator.js +1 -1
  81. package/dist/sdk/connection.js +1 -1
  82. package/dist/sdk/engage.js +1 -1
  83. package/dist/sdk/errors.js +1 -1
  84. package/dist/sdk/index.js +1 -1
  85. package/dist/sdk/io/index.js +1 -1
  86. package/dist/sdk/io/node-filesystem.js +1 -1
  87. package/dist/sdk/job.js +1 -1
  88. package/dist/sdk/journey.js +1 -1
  89. package/dist/sdk/llm/chat-cache.js +1 -1
  90. package/dist/sdk/llm/index.js +1 -1
  91. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  92. package/dist/sdk/llm/model-aliases.js +1 -1
  93. package/dist/sdk/llm/model-factors.js +1 -1
  94. package/dist/sdk/query/index.js +1 -1
  95. package/dist/sdk/query/sql-parser.js +1 -1
  96. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  97. package/dist/sdk/segment/fields-display.js +1 -1
  98. package/dist/sdk/segment/file-discovery.js +1 -1
  99. package/dist/sdk/segment/journey-utils.js +1 -1
  100. package/dist/sdk/segment/journey-yaml.js +1 -1
  101. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  102. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  103. package/dist/sdk/segment/pull-workflow.js +1 -1
  104. package/dist/sdk/segment/push-workflow.js +1 -1
  105. package/dist/sdk/segment/resolution-context.js +1 -1
  106. package/dist/sdk/segment/segment-path-parser.js +1 -1
  107. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  108. package/dist/sdk/segment/target-resolution.js +1 -1
  109. package/dist/sdk/segment/tdx-config.js +1 -1
  110. package/dist/sdk/segment/validate-files.js +1 -1
  111. package/dist/sdk/segment/yaml-validator.js +1 -1
  112. package/dist/sdk/segment.js +1 -1
  113. package/dist/sdk/types/index.js +1 -1
  114. package/dist/sdk/types/progress.js +1 -1
  115. package/dist/sdk/user.js +1 -1
  116. package/dist/sdk/util/format-detector.js +1 -1
  117. package/dist/sdk/util/formatters.js +1 -1
  118. package/dist/sdk/util/index.js +1 -1
  119. package/dist/sdk/util/tree-formatter.js +1 -1
  120. package/dist/sdk/workflow/clone-workflow.js +1 -1
  121. package/dist/sdk/workflow/index.js +1 -1
  122. package/dist/sdk/workflow/pull-workflow.js +1 -1
  123. package/dist/sdk/workflow/push-workflow.js +1 -1
  124. package/dist/sdk/workflow/tdx-config.js +1 -1
  125. package/dist/sdk/workflow/workflow-utils.js +1 -1
  126. package/dist/utils/async.js +1 -1
  127. package/dist/utils/colors.d.ts +2 -1
  128. package/dist/utils/colors.d.ts.map +1 -1
  129. package/dist/utils/colors.js +1 -1
  130. package/dist/utils/colors.js.map +1 -1
  131. package/dist/utils/diff.js +1 -1
  132. package/dist/utils/file-permissions.js +1 -1
  133. package/dist/utils/json-loader.js +1 -1
  134. package/dist/utils/option-validation.js +1 -1
  135. package/dist/utils/port.js +1 -1
  136. package/dist/utils/process.js +1 -1
  137. package/dist/utils/prompt.js +1 -1
  138. package/dist/utils/spinner.js +1 -1
  139. package/dist/utils/sse-parser.js +1 -1
  140. package/dist/utils/string-utils.js +1 -1
  141. package/dist/utils/table-ref-parser.js +1 -1
  142. package/dist/utils/tdx-logger.js +1 -1
  143. package/dist/utils/version-check.js +1 -1
  144. package/package.json +1 -1
@@ -1 +1 @@
1
- const a17_0x2f6182=a17_0x3aee;(function(_0x527930,_0x4cc2bb){const _0x3832d9=a17_0x3aee,_0x4ac118=_0x527930();while(!![]){try{const _0x45908b=-parseInt(_0x3832d9(0x164))/0x1+-parseInt(_0x3832d9(0x10b))/0x2+-parseInt(_0x3832d9(0xe7))/0x3+parseInt(_0x3832d9(0x175))/0x4*(-parseInt(_0x3832d9(0x145))/0x5)+-parseInt(_0x3832d9(0xc2))/0x6+-parseInt(_0x3832d9(0x18b))/0x7*(parseInt(_0x3832d9(0x18d))/0x8)+parseInt(_0x3832d9(0x131))/0x9*(parseInt(_0x3832d9(0xdb))/0xa);if(_0x45908b===_0x4cc2bb)break;else _0x4ac118['push'](_0x4ac118['shift']());}catch(_0x493465){_0x4ac118['push'](_0x4ac118['shift']());}}}(a17_0x486e,0x4cf55));import a17_0x3c7621 from'chalk';import a17_0x5a78d7 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';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';function a17_0x3aee(_0x129146,_0x1884de){_0x129146=_0x129146-0xc2;const _0x486e22=a17_0x486e();let _0x3aee53=_0x486e22[_0x129146];return _0x3aee53;}import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function formatJourneyState(_0x201434){const _0x538da8=a17_0x3aee;switch(_0x201434){case _0x538da8(0x160):return a17_0x3c7621['green'](_0x538da8(0x184));case _0x538da8(0xe3):return a17_0x3c7621[_0x538da8(0x189)](_0x538da8(0x125));case _0x538da8(0xcb):return a17_0x3c7621[_0x538da8(0x14a)](_0x538da8(0x109));case _0x538da8(0x110):return a17_0x3c7621[_0x538da8(0xfc)]('(completed)');case'archived':return a17_0x3c7621[_0x538da8(0x189)]('(archived)');default:return'('+_0x201434+')';}}function formatJourneyItem(_0x373afe,_0x3af0b2='',_0x5bee53){const _0x154ecd=a17_0x3aee,_0x431102=formatJourneyState(_0x373afe[_0x154ecd(0x14c)]),_0x48d736=_0x5bee53?hyperlink(_0x373afe['journeyBundleName'],_0x5bee53):_0x373afe['journeyBundleName'];return _0x3af0b2+_0x154ecd(0xf3)+_0x48d736+'\x20'+_0x431102;}function escapeRegex(_0x4a7f51){const _0x4aa6d8=a17_0x3aee;return _0x4a7f51[_0x4aa6d8(0x195)](/[.*+?^${}()|[\]\\]/g,_0x4aa6d8(0xe1));}function globToRegex(_0x3528d3){const _0x508805=a17_0x3aee,_0x2ca9c8=_0x3528d3[_0x508805(0x124)]('*')[_0x508805(0xf4)](escapeRegex);return new RegExp(_0x2ca9c8['join']('.*'),'i');}function a17_0x486e(){const _0x5dc5f0=['resolveSegment','launched','\x20\x20Consolidating\x20duplicate\x20segment:\x20','attributes','population','221491BhsexI','journeyName','\x20->\x20','values','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','listJourneysFromParentSegment','activationParams','Resuming\x20journey...','red','\x20journey','✔\x20Pulled\x20','journeyStages','web','Usage:\x20journey\x20resume\x20<name-or-path>','isNew','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','Aborted.','32GtfmOA','Usage:\x20journey\x20stats\x20<name-or-path>','✔\x20Found\x20','\x20\x20Target:\x20','get','segmentPushCommand','getStatistics','targetDir','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','\x20=\x20','message','session','toLowerCase','no_parent','/j/da/je','(running)','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','test','filter','Target\x20file:\x20','dim','Write\x20','7slBohQ','journey','2113816xslszY','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','find','pause','includeStats','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','Export\x20journey(s)\x20as\x20YAML\x20files','No\x20statistics\x20available\x20for\x20journey:\x20','replace','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','journey:view','versionNumber','\x20\x20Folder\x20path:\x20','Getting\x20journey\x20statistics...','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','log','172404KVuTlv','journey:resume','\x20new\x20files','cyan','audienceId','Cancelled','Listing\x20folders...','table','Show\x20journey\x20details','paused','file','\x22\x20resumed','\x20Opening\x20','getParentFull','cwd','size','folderPath','Fetching\x20users\x20for\x20email\x20resolution...','Fetching\x20','Usage:\x20tdx\x20journey\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Inside\x20a\x20segment\x20folder\x20(with\x20tdx.json)','/e/','execute','\x20\x20Parent\x20segment:\x20','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','\x20files?','2270uvCbvh','\x20changed\x20files','Warning:\x20Could\x20not\x20resolve\x20activation\x20','add','journey:list','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','\x5c$&','relativePath','draft','✔\x20All\x20files\x20are\x20up\x20to\x20date','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','Pattern:\x20','1350801QuXzyO','base','Target\x20directory:\x20','...','segments','Error:\x20Journey\x20\x27','INVALID_ARGUMENT','options','then','repeat','segment','stages','🗺️\x20','map','connection','totalEntered','\x0aChanges\x20to\x20\x27','Getting\x20journey\x20details...','/j/da','data','Warning:\x20Stage\x20\x22','blue','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','journeyBundleName','goalRate','utf-8','hasChanges','List\x20journeys\x20in\x20current\x20context','\x20\x20-\x20','\x20(rule\x20match)','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','journey:push','rule','reentryMode','(paused)','resolveParentId','626464pQjNDl','\x20\x20Name:\x20','rootFolderId','dryRun','args','completed','segmentName','activation_','Resolved\x20YAML\x20file:\x20','parentName','verbose','\x20unchanged\x20files','listJourneysWithFolders','/app/ps/','kind','\x20journey\x20files\x20to\x20','join','getJourney','journeyId','relative','connector_config','\x22\x20paused','Resolving\x20journey...','setPhase','Warning:\x20Could\x20not\x20resolve\x20segment\x20','split','(draft)','parent_segment','totalGoalAchieved','stringify','\x20\x20Statistics\x20not\x20available','journey:pause','sort','helpText','length','exited','folders','resolveJourneyId','82692DYjmfq','absolutePath','Input:\x20','Journey\x20name:\x20','folderId','No\x20journeys\x20found','has','error','entries','getSegment','entered','parentSegment','Folder\x20path:\x20','format','Error:\x20Parent\x20segment\x20context\x20required','site','✔\x20Journey\x20\x22','(root)','journeyBundleId','conversionRate','307815amEuZC','Error:\x20','type','push','.yml','yellow','stage','state','Fetching\x20parent\x20segment...','\x0aPull\x20summary:','yes','name','set','\x20versions)','✔\x20Context\x20set:\x20','buildIdToNameMap','stageName','goal','journey:stats','Error:\x20Journey\x20not\x20found:\x20','Pausing\x20journey...','description','green','localeCompare','all','Resolving\x20parent\x20segment...'];a17_0x486e=function(){return _0x5dc5f0;};return a17_0x486e();}function buildRuleToNameMapping(_0x3d38a5){const _0x470293=a17_0x3aee,_0x3a25e3=new Map();if(_0x3d38a5[_0x470293(0xeb)])for(const [_0x2e4b6d,_0x52feb7]of Object[_0x470293(0x139)](_0x3d38a5[_0x470293(0xeb)])){if(_0x52feb7[_0x470293(0x107)]){const _0x1425d3=serializeRule(_0x52feb7['rule']),_0x259b26=_0x3a25e3[_0x470293(0x179)](_0x1425d3);_0x259b26?_0x259b26[_0x470293(0x148)](_0x2e4b6d):_0x3a25e3[_0x470293(0x151)](_0x1425d3,[_0x2e4b6d]);}}return _0x3a25e3;}async function resolveJourneyTarget(_0x5a718c,_0x2f3fde,_0x57f488){const _0x1e84aa=a17_0x3aee;if(isYamlFilePath(_0x5a718c))try{const _0x2504ec=await resolveYamlFilePath(_0x5a718c);return _0x57f488&&(console[_0x1e84aa(0x138)](_0x1e84aa(0x113)+_0x5a718c),console[_0x1e84aa(0x138)](_0x1e84aa(0xd8)+_0x2504ec[_0x1e84aa(0x13c)]),console[_0x1e84aa(0x138)](_0x1e84aa(0x10c)+_0x2504ec[_0x1e84aa(0x111)]),console['error'](_0x1e84aa(0x199)+(_0x2504ec['folderPath']||_0x1e84aa(0x142)))),{'journeyName':_0x2504ec[_0x1e84aa(0x111)],'parentSegment':_0x2504ec[_0x1e84aa(0x13c)],'resolved':_0x2504ec};}catch(_0x3c8210){throw new SDKError(ErrorCode[_0x1e84aa(0xed)],_0x1e84aa(0x185)+_0x3c8210[_0x1e84aa(0x17f)]);}if(!_0x2f3fde)throw new SDKError(ErrorCode[_0x1e84aa(0xed)],_0x1e84aa(0x105));return{'journeyName':_0x5a718c,'parentSegment':_0x2f3fde};}export class JourneyListCommand extends BaseCommand{[a17_0x2f6182(0x150)]=a17_0x2f6182(0xdf);[a17_0x2f6182(0x15a)]=a17_0x2f6182(0x102);async[a17_0x2f6182(0xd7)](_0x2ec443){const _0x285469=a17_0x2f6182,{options:_0x5b370d,args:_0x19a977,tdx:_0xe3cb61}=_0x2ec443,_0x2d23c8=_0x19a977[0x0],_0x4aa9d8=_0x5b370d[_0x285469(0x13c)];if(!_0x4aa9d8)return console[_0x285469(0x138)](_0x285469(0x13f)),console[_0x285469(0x138)](_0x285469(0x17d)),0x1;const _0x3f5a87=await withSpinner('Resolving\x20parent\x20segment...',()=>_0xe3cb61[_0x285469(0xf1)][_0x285469(0x10a)](_0x4aa9d8),{'verbose':_0x5b370d[_0x285469(0x115)]}),_0x129bda=_0x3f5a87[_0x285469(0xfa)];_0x5b370d[_0x285469(0x115)]&&(console['error']('Parent\x20segment:\x20'+_0x4aa9d8+'\x20(ID:\x20'+_0x129bda+')'),_0x2d23c8&&console[_0x285469(0x138)](_0x285469(0xe6)+_0x2d23c8));const _0x55359d=await withSpinner(_0x285469(0x14d),()=>_0xe3cb61[_0x285469(0xf1)][_0x285469(0xcf)](_0x129bda),{'verbose':_0x5b370d[_0x285469(0x115)]}),_0x2472ef=_0x55359d[_0x285469(0xfa)],_0x1c0382=_0x2472ef[_0x285469(0x10d)],_0x3ddbd3=await withSpinner('Listing\x20journeys...',()=>_0xe3cb61[_0x285469(0x18c)][_0x285469(0x117)](_0x129bda,_0x1c0382),{'verbose':_0x5b370d[_0x285469(0x115)]});let _0x393ea1=_0x3ddbd3[_0x285469(0xfa)]['journeys'];const _0x4f6f44=_0x3ddbd3[_0x285469(0xfa)][_0x285469(0x12f)],_0x4512ab=new Map();for(const _0xe83439 of _0x4f6f44){_0x4512ab[_0x285469(0x151)](_0xe83439['id'],_0xe83439[_0x285469(0x150)]);}if(_0x2d23c8){const _0x364112=globToRegex(_0x2d23c8);_0x393ea1=_0x393ea1[_0x285469(0x187)](_0x3a3aee=>_0x364112[_0x285469(0x186)](_0x3a3aee[_0x285469(0xfe)]));}console[_0x285469(0x138)](_0x285469(0x177)+_0x393ea1[_0x285469(0x12d)]+_0x285469(0x16d)+(_0x393ea1[_0x285469(0x12d)]!==0x1?'s':''));const _0x7459ee=_0xb0541e=>{const _0x2cc97e=_0x285469;return getConsoleNextUrl(_0x5b370d[_0x2cc97e(0x140)],_0x2cc97e(0x118)+_0x129bda+_0x2cc97e(0xd6)+_0xb0541e+_0x2cc97e(0xf9));};if(_0x5b370d[_0x285469(0x13e)]===_0x285469(0xc9))await handleSDKOutput(_0x393ea1,_0x5b370d);else{if(_0x5b370d[_0x285469(0x13e)]==='json'){const _0x1ffab2=_0x393ea1[_0x285469(0xf4)](_0x2d0048=>({..._0x2d0048,'url':_0x7459ee(_0x2d0048['id'])}));await handleSDKOutput(_0x1ffab2,_0x5b370d);}else{console[_0x285469(0x19c)]('['+_0x4aa9d8+']');const _0x17037e=new Map(),_0xd6b7d2=[];for(const _0x51b865 of _0x393ea1){if(!_0x51b865[_0x285469(0x135)]||_0x51b865['folderId']===_0x1c0382)_0xd6b7d2[_0x285469(0x148)](_0x51b865);else{const _0x395bb9=_0x17037e[_0x285469(0x179)](_0x51b865[_0x285469(0x135)])||[];_0x395bb9[_0x285469(0x148)](_0x51b865),_0x17037e[_0x285469(0x151)](_0x51b865[_0x285469(0x135)],_0x395bb9);}}const _0x1669de=(_0x4417d1,_0x377ae5)=>_0x4417d1['journeyBundleName']['localeCompare'](_0x377ae5[_0x285469(0xfe)],undefined,{'sensitivity':_0x285469(0xe8)});_0xd6b7d2[_0x285469(0x12b)](_0x1669de);for(const _0x432060 of _0xd6b7d2){console['log'](formatJourneyItem(_0x432060,'',_0x7459ee(_0x432060['id'])));}const _0x351c0c=[..._0x17037e[_0x285469(0x139)]()][_0x285469(0x12b)]((_0x1a8231,_0x44102a)=>{const _0x1d8ab5=_0x285469,_0x2cab9b=_0x4512ab['get'](_0x1a8231[0x0])||_0x1a8231[0x0],_0x1a7d57=_0x4512ab['get'](_0x44102a[0x0])||_0x44102a[0x0];return _0x2cab9b[_0x1d8ab5(0x15c)](_0x1a7d57,undefined,{'sensitivity':_0x1d8ab5(0xe8)});});for(const [_0x40c8f1,_0x1ca5ef]of _0x351c0c){const _0x344938=_0x4512ab[_0x285469(0x179)](_0x40c8f1)||_0x40c8f1;console[_0x285469(0x19c)]('📁\x20'+_0x344938),_0x1ca5ef['sort'](_0x1669de);for(const _0x362d72 of _0x1ca5ef){console[_0x285469(0x19c)](formatJourneyItem(_0x362d72,'\x20\x20',_0x7459ee(_0x362d72['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a17_0x2f6182(0x150)]=a17_0x2f6182(0x197);[a17_0x2f6182(0x15a)]=a17_0x2f6182(0xca);async['execute'](_0x4fd52d){const _0x21013f=a17_0x2f6182,{options:_0x3b383d,args:_0x10e425,tdx:_0x463f90}=_0x4fd52d,_0x4f74d2=_0x10e425[0x0];if(!_0x4f74d2)return console[_0x21013f(0x138)](_0x21013f(0x18e)),console['error'](_0x21013f(0x173)),console[_0x21013f(0x138)]('Options:'),console[_0x21013f(0x138)](_0x21013f(0x196)),0x1;_0x3b383d[_0x21013f(0x115)]&&console['error'](_0x21013f(0x133)+_0x4f74d2);const _0x1ca645=await resolveJourneyTarget(_0x4f74d2,_0x3b383d['parentSegment'],_0x3b383d[_0x21013f(0x115)]),_0x526f69=await withSpinner(_0x21013f(0x15e),()=>_0x463f90[_0x21013f(0xf1)]['resolveParentId'](_0x1ca645[_0x21013f(0x13c)]),{'verbose':_0x3b383d['verbose']}),_0x1c29a4=_0x526f69[_0x21013f(0xfa)],_0x275256=await withSpinner(_0x21013f(0x121),()=>_0x463f90[_0x21013f(0x18c)][_0x21013f(0x130)](_0x1c29a4,_0x1ca645[_0x21013f(0x165)]),{'verbose':_0x3b383d[_0x21013f(0x115)]}),_0x557985=_0x275256['data'];if(_0x3b383d[_0x21013f(0x170)]){const _0x41406a=getConsoleNextUrl(_0x3b383d[_0x21013f(0x140)],'/app/ps/'+_0x1c29a4+_0x21013f(0xd6)+_0x557985+'/j/da/je');return console[_0x21013f(0x138)](a17_0x3c7621[_0x21013f(0x15b)]('✔')+_0x21013f(0xce)+a17_0x3c7621[_0x21013f(0xc5)](_0x41406a)),openBrowser(_0x41406a),0x0;}const _0x43787d=await withSpinner(_0x21013f(0xf8),()=>_0x463f90[_0x21013f(0x18c)][_0x21013f(0x11c)](_0x557985),{'verbose':_0x3b383d[_0x21013f(0x115)]}),_0x32f4ee=_0x43787d[_0x21013f(0xfa)],_0x4ebe8e=_0x3b383d[_0x21013f(0x191)];let _0x23378c;if(_0x4ebe8e)try{const _0x22263e=await withSpinner(_0x21013f(0x19a),()=>_0x463f90[_0x21013f(0x18c)][_0x21013f(0x17b)](_0x557985),{'verbose':_0x3b383d['verbose']});_0x23378c=_0x22263e[_0x21013f(0xfa)];}catch{_0x3b383d[_0x21013f(0x115)]&&console[_0x21013f(0x138)](_0x21013f(0x129));}const _0x4e2b87=getConsoleNextUrl(_0x3b383d['site'],_0x21013f(0x118)+_0x1c29a4+_0x21013f(0xd6)+_0x557985+_0x21013f(0x183)),_0x3ce8ca={'id':_0x32f4ee['id'],'name':_0x32f4ee[_0x21013f(0x162)][_0x21013f(0x150)],'description':_0x32f4ee['attributes']['description'],'state':_0x32f4ee[_0x21013f(0x162)][_0x21013f(0x14c)],'paused':_0x32f4ee[_0x21013f(0x162)][_0x21013f(0xcb)],'reentry_mode':_0x32f4ee[_0x21013f(0x162)][_0x21013f(0x108)],'stages':_0x32f4ee[_0x21013f(0x162)][_0x21013f(0x16f)]?.[_0x21013f(0x12d)]||0x0,..._0x32f4ee['attributes']['goal']&&{'goal':_0x32f4ee['attributes'][_0x21013f(0x156)][_0x21013f(0x150)]},..._0x23378c&&{'statistics':{'total_entered':_0x23378c[_0x21013f(0xf6)],'goal_achieved':_0x23378c['totalGoalAchieved'],'goal_rate':_0x23378c[_0x21013f(0xff)],'stages':_0x23378c[_0x21013f(0xf2)]}},'url':_0x4e2b87};return await handleSingleObjectOutput(_0x3ce8ca,_0x3b383d),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a17_0x2f6182(0x150)]=a17_0x2f6182(0x157);[a17_0x2f6182(0x15a)]='Show\x20journey\x20statistics';async[a17_0x2f6182(0xd7)](_0x93fac8){const _0x2d0c9b=a17_0x2f6182,{options:_0x53c21e,args:_0x36a4a4,tdx:_0x470363}=_0x93fac8,_0x513e7c=_0x36a4a4[0x0];if(!_0x513e7c)return console[_0x2d0c9b(0x138)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x2d0c9b(0x138)](_0x2d0c9b(0x176)),0x1;_0x53c21e[_0x2d0c9b(0x115)]&&console[_0x2d0c9b(0x138)]('Input:\x20'+_0x513e7c);const _0x325181=await resolveJourneyTarget(_0x513e7c,_0x53c21e[_0x2d0c9b(0x13c)],_0x53c21e[_0x2d0c9b(0x115)]),_0x4a7883=await withSpinner(_0x2d0c9b(0x15e),()=>_0x470363['segment']['resolveParentId'](_0x325181[_0x2d0c9b(0x13c)]),{'verbose':_0x53c21e[_0x2d0c9b(0x115)]}),_0x5b62b9=_0x4a7883[_0x2d0c9b(0xfa)],_0x57eae7=await withSpinner(_0x2d0c9b(0x121),()=>_0x470363[_0x2d0c9b(0x18c)][_0x2d0c9b(0x130)](_0x5b62b9,_0x325181['journeyName']),{'verbose':_0x53c21e[_0x2d0c9b(0x115)]}),_0x11dac4=_0x57eae7[_0x2d0c9b(0xfa)],_0x3dda9c=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x470363[_0x2d0c9b(0x18c)][_0x2d0c9b(0x17b)](_0x11dac4),{'verbose':_0x53c21e[_0x2d0c9b(0x115)]}),_0x381f9b=_0x3dda9c[_0x2d0c9b(0xfa)];if(!_0x381f9b||_0x381f9b[_0x2d0c9b(0x11d)]===null)return console[_0x2d0c9b(0x138)](_0x2d0c9b(0x194)+_0x325181[_0x2d0c9b(0x165)]),console[_0x2d0c9b(0x138)](_0x2d0c9b(0x19b)),0x0;const _0x36ebf8={'journey_id':_0x381f9b[_0x2d0c9b(0x11d)],'total_entered':_0x381f9b[_0x2d0c9b(0xf6)],'goal_achieved':_0x381f9b[_0x2d0c9b(0x127)],'goal_rate':_0x381f9b[_0x2d0c9b(0xff)],'stages':_0x381f9b['stages']?.['map'](_0x6392ee=>({'name':_0x6392ee[_0x2d0c9b(0x155)],'population':_0x6392ee[_0x2d0c9b(0x163)],'entered':_0x6392ee[_0x2d0c9b(0x13b)],'exited':_0x6392ee[_0x2d0c9b(0x12e)],'conversion_rate':_0x6392ee[_0x2d0c9b(0x144)]}))},_0xdec7af=_0x53c21e[_0x2d0c9b(0x14b)];if(_0xdec7af&&_0x381f9b[_0x2d0c9b(0xf2)]){const _0x62de16=_0x381f9b[_0x2d0c9b(0xf2)][_0x2d0c9b(0x18f)](_0x1b9217=>_0x1b9217[_0x2d0c9b(0x155)][_0x2d0c9b(0x181)]()===_0xdec7af[_0x2d0c9b(0x181)]());if(_0x62de16)return await handleSingleObjectOutput({'stage_name':_0x62de16[_0x2d0c9b(0x155)],'population':_0x62de16[_0x2d0c9b(0x163)],'entered':_0x62de16[_0x2d0c9b(0x13b)],'exited':_0x62de16[_0x2d0c9b(0x12e)],'conversion_rate':_0x62de16[_0x2d0c9b(0x144)]},_0x53c21e),0x0;console[_0x2d0c9b(0x138)](_0x2d0c9b(0xfb)+_0xdec7af+'\x22\x20not\x20found');}return await handleSingleObjectOutput(_0x36ebf8,_0x53c21e),0x0;}}export class JourneyPauseCommand extends BaseCommand{['name']=a17_0x2f6182(0x12a);[a17_0x2f6182(0x15a)]='Pause\x20a\x20running\x20journey';async[a17_0x2f6182(0xd7)](_0x5dfdb8){const _0x14b364=a17_0x2f6182,{options:_0x48e760,args:_0x9f63b4,tdx:_0x464307}=_0x5dfdb8,_0x247f49=_0x9f63b4[0x0];if(!_0x247f49)return console[_0x14b364(0x138)](_0x14b364(0x18e)),console[_0x14b364(0x138)]('Usage:\x20journey\x20pause\x20<name-or-path>'),0x1;_0x48e760['verbose']&&console[_0x14b364(0x138)]('Input:\x20'+_0x247f49);const _0x5d4dad=await resolveJourneyTarget(_0x247f49,_0x48e760['parentSegment'],_0x48e760[_0x14b364(0x115)]),_0x565bed=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x464307[_0x14b364(0xf1)][_0x14b364(0x10a)](_0x5d4dad[_0x14b364(0x13c)]),{'verbose':_0x48e760['verbose']}),_0x50e407=_0x565bed[_0x14b364(0xfa)],_0x1272e3=await withSpinner(_0x14b364(0x121),()=>_0x464307['journey'][_0x14b364(0x130)](_0x50e407,_0x5d4dad['journeyName']),{'verbose':_0x48e760[_0x14b364(0x115)]}),_0x281ae9=_0x1272e3[_0x14b364(0xfa)];if(!_0x48e760[_0x14b364(0x14f)]){const _0x20e709=await confirm(_0x14b364(0x192)+_0x5d4dad[_0x14b364(0x165)]+'\x22?');if(!_0x20e709)return console[_0x14b364(0x138)](_0x14b364(0xc7)),0x0;}const _0x544119=await withSpinner(_0x14b364(0x159),()=>_0x464307[_0x14b364(0x18c)][_0x14b364(0x190)](_0x281ae9),{'verbose':_0x48e760[_0x14b364(0x115)]}),_0x5091df=_0x544119[_0x14b364(0xfa)];return console[_0x14b364(0x138)](_0x14b364(0x141)+_0x5091df['attributes'][_0x14b364(0x150)]+_0x14b364(0x120)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a17_0x2f6182(0x150)]=a17_0x2f6182(0xc3);[a17_0x2f6182(0x15a)]='Resume\x20a\x20paused\x20journey';async[a17_0x2f6182(0xd7)](_0x331cc4){const _0x5084a1=a17_0x2f6182,{options:_0xae4e73,args:_0x2b5523,tdx:_0x5e6a77}=_0x331cc4,_0x241238=_0x2b5523[0x0];if(!_0x241238)return console['error'](_0x5084a1(0x18e)),console[_0x5084a1(0x138)](_0x5084a1(0x171)),0x1;_0xae4e73[_0x5084a1(0x115)]&&console[_0x5084a1(0x138)]('Input:\x20'+_0x241238);const _0x37acce=await resolveJourneyTarget(_0x241238,_0xae4e73[_0x5084a1(0x13c)],_0xae4e73['verbose']),_0x3c228b=await withSpinner(_0x5084a1(0x15e),()=>_0x5e6a77[_0x5084a1(0xf1)][_0x5084a1(0x10a)](_0x37acce[_0x5084a1(0x13c)]),{'verbose':_0xae4e73[_0x5084a1(0x115)]}),_0x371f97=_0x3c228b['data'],_0x2cee14=await withSpinner(_0x5084a1(0x121),()=>_0x5e6a77['journey'][_0x5084a1(0x130)](_0x371f97,_0x37acce['journeyName']),{'verbose':_0xae4e73[_0x5084a1(0x115)]}),_0x5b976a=_0x2cee14[_0x5084a1(0xfa)];if(!_0xae4e73[_0x5084a1(0x14f)]){const _0x5a454e=await confirm(_0x5084a1(0xe5)+_0x37acce[_0x5084a1(0x165)]+'\x22?');if(!_0x5a454e)return console[_0x5084a1(0x138)](_0x5084a1(0xc7)),0x0;}const _0x47f719=await withSpinner(_0x5084a1(0x16b),()=>_0x5e6a77[_0x5084a1(0x18c)]['resume'](_0x5b976a),{'verbose':_0xae4e73[_0x5084a1(0x115)]}),_0x4e0f9e=_0x47f719[_0x5084a1(0xfa)];return console[_0x5084a1(0x138)]('✔\x20Journey\x20\x22'+_0x4e0f9e[_0x5084a1(0x162)]['name']+_0x5084a1(0xcd)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a17_0x2f6182(0x150)]='journey:pull';['description']=a17_0x2f6182(0x193);async[a17_0x2f6182(0xd7)](_0x3bd407){const _0x570cc2=a17_0x2f6182,{options:_0x257c62,args:_0x213f5b,tdx:_0x36d6a3}=_0x3bd407,_0x509529=_0x257c62,_0x37d1b5=_0x213f5b[0x0],_0x3c3a0d=_0x37d1b5&&isYamlFilePath(_0x37d1b5),_0x4d8ff8=await resolveTarget({'arg':_0x3c3a0d?_0x37d1b5:undefined,'contextParent':_0x257c62[_0x570cc2(0x13c)],'cwd':process[_0x570cc2(0xd0)]()});if(!isSuccessfulResolution(_0x4d8ff8))return _0x4d8ff8['errorCode']===_0x570cc2(0x182)?(console['error'](a17_0x3c7621[_0x570cc2(0x14a)](_0x570cc2(0x168))),console[_0x570cc2(0x138)](_0x570cc2(0xd5)),console['error']('\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment'),console[_0x570cc2(0x138)](_0x570cc2(0xe0)),console['error'](_0x570cc2(0xfd))):(console[_0x570cc2(0x138)](a17_0x3c7621[_0x570cc2(0x16c)](_0x570cc2(0x146)+_0x4d8ff8[_0x570cc2(0x17f)]+'\x0a')),_0x4d8ff8['helpText']&&console[_0x570cc2(0x138)](a17_0x3c7621[_0x570cc2(0xc5)](_0x4d8ff8[_0x570cc2(0x12c)]))),0x1;let _0x46319a=_0x3c3a0d?undefined:_0x37d1b5,_0xf61309,_0x18d63a;_0x4d8ff8[_0x570cc2(0x147)]==='file'&&(_0x46319a=_0x4d8ff8['resourceName'],_0xf61309=_0x4d8ff8['filePath'],_0x18d63a=_0x4d8ff8[_0x570cc2(0xd2)]);const _0x20c61c=_0x4d8ff8[_0x570cc2(0x114)],_0x38fbb7=_0x4d8ff8[_0x570cc2(0x17c)];_0x509529[_0x570cc2(0x115)]&&(console['error']('Parent\x20segment:\x20'+_0x20c61c),console[_0x570cc2(0x138)](_0x570cc2(0xe9)+_0x38fbb7),_0x46319a&&console['error'](_0x570cc2(0x134)+_0x46319a),_0xf61309&&console[_0x570cc2(0x138)](_0x570cc2(0x188)+_0xf61309),_0x18d63a&&console[_0x570cc2(0x138)](_0x570cc2(0x13d)+_0x18d63a));const _0x4e5ab1=await withSpinner(_0x570cc2(0x15e),()=>_0x36d6a3[_0x570cc2(0xf1)]['resolveParentId'](_0x20c61c),{'verbose':_0x257c62[_0x570cc2(0x115)]}),_0xca4669=_0x4e5ab1[_0x570cc2(0xfa)],[_0x8d4a26,_0x44603c]=await Promise['all']([withSpinner('Listing\x20journeys...',()=>_0x36d6a3[_0x570cc2(0x18c)][_0x570cc2(0x169)](_0xca4669,undefined,{'includeAllVersions':!![]}),{'verbose':_0x257c62[_0x570cc2(0x115)]}),withSpinner(_0x570cc2(0xc8),()=>_0x36d6a3[_0x570cc2(0xf1)]['listFolders'](_0xca4669),{'verbose':_0x257c62[_0x570cc2(0x115)]})]);let _0x4a0854=_0x8d4a26[_0x570cc2(0xfa)];const _0x52c8e4=_0x44603c[_0x570cc2(0xfa)],_0x3268e5=buildFolderIdToPathMap(_0x52c8e4);if(_0x46319a){const _0x124171=_0x4a0854['filter'](_0x105963=>_0x105963[_0x570cc2(0xfe)][_0x570cc2(0x181)]()===_0x46319a['toLowerCase']());if(_0x124171[_0x570cc2(0x12d)]===0x0)return console[_0x570cc2(0x138)](_0x570cc2(0x158)+_0x46319a),console[_0x570cc2(0x138)](_0x570cc2(0xd9)),0x1;_0x4a0854=_0x124171;}if(_0x18d63a!==undefined){const _0x13911f=_0x4a0854['filter'](_0x340810=>{const _0x29be6b=_0x570cc2,_0x4ee18b=_0x340810[_0x29be6b(0x135)]?_0x3268e5['get'](_0x340810[_0x29be6b(0x135)])||'':'';return _0x4ee18b===_0x18d63a;});if(_0x13911f['length']===0x0&&_0x4a0854[_0x570cc2(0x12d)]>0x0){console[_0x570cc2(0x138)](_0x570cc2(0xec)+_0x46319a+'\x27\x20not\x20found\x20in\x20'+(_0x18d63a||'root\x20folder')),console[_0x570cc2(0x138)]('Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:');for(const _0x417e83 of _0x4a0854){const _0x2724c4=_0x417e83[_0x570cc2(0x135)]?_0x3268e5['get'](_0x417e83[_0x570cc2(0x135)])||'':'';console[_0x570cc2(0x138)](_0x570cc2(0x103)+(_0x2724c4||_0x570cc2(0x142))+'/'+_0x417e83[_0x570cc2(0xfe)]);}return 0x1;}_0x4a0854=_0x13911f;}if(_0x4a0854[_0x570cc2(0x12d)]===0x0)return console[_0x570cc2(0x138)](_0x570cc2(0x136)),0x0;const _0x3187d0=new Map();for(const _0x19e9a7 of _0x4a0854){const _0x11f816=_0x19e9a7[_0x570cc2(0x143)];!_0x3187d0[_0x570cc2(0x137)](_0x11f816)&&_0x3187d0['set'](_0x11f816,[]),_0x3187d0[_0x570cc2(0x179)](_0x11f816)[_0x570cc2(0x148)](_0x19e9a7);}for(const _0x53fd0d of _0x3187d0[_0x570cc2(0x167)]()){_0x53fd0d[_0x570cc2(0x12b)]((_0x50e08b,_0x3204d7)=>(_0x50e08b[_0x570cc2(0x198)]||0x0)-(_0x3204d7[_0x570cc2(0x198)]||0x0));}const _0x2a9e6c=[],[_0x496660,_0x32c20d]=await Promise[_0x570cc2(0x15d)]([withSpinner(_0x570cc2(0xd3),()=>_0x36d6a3['user']['buildIdToEmailMap'](),{'verbose':_0x257c62[_0x570cc2(0x115)]})[_0x570cc2(0xef)](_0x52f5bf=>_0x52f5bf[_0x570cc2(0xfa)]),withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',()=>_0x36d6a3[_0x570cc2(0xf5)][_0x570cc2(0x154)](),{'verbose':_0x257c62['verbose']})[_0x570cc2(0xef)](_0x82f4a=>_0x82f4a[_0x570cc2(0xfa)])]);for(const _0x53c6b0 of _0x3187d0['values']()){const _0x49109e=_0x53c6b0[0x0][_0x570cc2(0xfe)],_0x323c2d=_0x53c6b0[0x0][_0x570cc2(0x135)],_0x405702=_0x323c2d?_0x3268e5[_0x570cc2(0x179)](_0x323c2d)||'':'',_0x314f7a=_0x405702?a17_0x5a78d7[_0x570cc2(0x11b)](_0x38fbb7,_0x405702):_0x38fbb7,_0x47c69b=_0xf61309||a17_0x5a78d7[_0x570cc2(0x11b)](_0x314f7a,sanitizeFileName(_0x49109e)+_0x570cc2(0x149));let _0x839ab9,_0xc3525b;if(existsSync(_0x47c69b))try{const _0x671fb2=readFileSync(_0x47c69b,_0x570cc2(0x100)),_0xc164ac=parseYamlString(_0x671fb2);_0xc3525b=_0xc164ac,_0x839ab9=buildRuleToNameMapping(_0xc164ac),_0x509529[_0x570cc2(0x115)]&&_0x839ab9['size']>0x0&&console[_0x570cc2(0x138)]('Found\x20'+_0x839ab9[_0x570cc2(0xd1)]+'\x20segment\x20rule(s)\x20to\x20match\x20for\x20'+_0x49109e);}catch(_0x35206c){_0x509529['verbose']&&console[_0x570cc2(0x138)]('Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20'+_0x35206c[_0x570cc2(0x17f)]);}const _0x23d6b5=[],_0x511f3b=new Set(),_0x2e6b5f=new Map(),_0x2ef09b=new Map(),_0x2c0483=new Set(),_0x224c86=new Map(),_0x263d55=new Map(),_0x28e0b3=createJumpTargetCache();await withProgressSpinner(_0x570cc2(0xd4)+_0x49109e+_0x570cc2(0xea),async _0x3c53fe=>{const _0x3c7ab2=_0x570cc2;for(const _0x2e3e62 of _0x53c6b0){const _0x3abc26=_0x53c6b0[_0x3c7ab2(0x12d)]>0x1?_0x2e3e62[_0x3c7ab2(0xfe)]+'\x20v'+(_0x2e3e62[_0x3c7ab2(0x198)]||0x1):_0x2e3e62[_0x3c7ab2(0xfe)];_0x3c53fe[_0x3c7ab2(0x122)](_0x3c7ab2(0xd4)+_0x3abc26);const _0x25027f=await _0x36d6a3[_0x3c7ab2(0x18c)][_0x3c7ab2(0x11c)](_0x2e3e62['id']),_0x512814=_0x25027f[_0x3c7ab2(0x162)]?.[_0x3c7ab2(0xc6)],_0x137a12={'resolveSegment':async _0x767603=>{const _0x54bc8a=_0x3c7ab2;if(!_0x512814)return{'name':_0x767603,'isJourneyLocal':![]};const _0x546442=_0x2e6b5f['get'](_0x767603);if(_0x546442)return _0x546442;try{const _0x4a697c=await _0x36d6a3[_0x54bc8a(0xf1)][_0x54bc8a(0x13a)](_0x512814,_0x767603),_0x1d2fc5=_0x4a697c[_0x54bc8a(0x119)]===SEGMENT_KIND_JOURNEY;let _0x1afc0c,_0x124968=_0x4a697c[_0x54bc8a(0x150)];if(_0x1d2fc5&&_0x4a697c['rule']){const _0x35f0fe=await segmentResponseToDef(_0x4a697c,{'resolveSegmentName':async _0x411566=>{const _0x5161e4=_0x54bc8a,_0x3d6db0=_0x2e6b5f[_0x5161e4(0x179)](_0x411566);if(_0x3d6db0)return _0x3d6db0[_0x5161e4(0x150)];const _0x296a27=await _0x137a12[_0x5161e4(0x15f)](_0x411566);return _0x296a27[_0x5161e4(0x150)];}}),_0x52b44=_0x35f0fe[_0x54bc8a(0x107)];_0x1afc0c={'description':_0x4a697c['description'],'rule':_0x52b44};const _0x24c009=serializeRule(_0x52b44),_0x4b1134=_0x2ef09b[_0x54bc8a(0x179)](_0x24c009);if(_0x4b1134)_0x124968=_0x4b1134,_0x1afc0c=undefined,_0x509529[_0x54bc8a(0x115)]&&console[_0x54bc8a(0x138)](_0x54bc8a(0x161)+_0x4a697c[_0x54bc8a(0x150)]+_0x54bc8a(0x166)+_0x4b1134);else{let _0xb67fa8=![];if(_0x839ab9){const _0x10360f=_0x839ab9[_0x54bc8a(0x179)](_0x24c009);if(_0x10360f){const _0x56d9ec=_0x10360f[_0x54bc8a(0x18f)](_0x5ec300=>!_0x511f3b[_0x54bc8a(0x137)](_0x5ec300));_0x56d9ec&&(_0x124968=_0x56d9ec,_0x511f3b[_0x54bc8a(0xde)](_0x56d9ec),_0x2ef09b[_0x54bc8a(0x151)](_0x24c009,_0x56d9ec),_0xb67fa8=!![],_0x509529[_0x54bc8a(0x115)]&&console[_0x54bc8a(0x138)]('\x20\x20Preserving\x20local\x20segment\x20name:\x20'+_0x56d9ec+_0x54bc8a(0x104)));}}if(!_0xb67fa8){const _0x239175=generateJourneyLocalName(_0x4a697c['name']);_0x239175&&(_0x124968=_0x239175);let _0xf90427=_0x124968,_0x18b925=0x2;while(_0x511f3b[_0x54bc8a(0x137)](_0xf90427)){_0xf90427=_0x124968+'_'+_0x18b925,_0x18b925++;}_0x511f3b[_0x54bc8a(0xde)](_0xf90427),_0x2ef09b[_0x54bc8a(0x151)](_0x24c009,_0xf90427),_0x124968=_0xf90427;}}}const _0x909f58={'name':_0x124968,'isJourneyLocal':_0x1d2fc5,'definition':_0x1afc0c};return _0x2e6b5f[_0x54bc8a(0x151)](_0x767603,_0x909f58),_0x909f58;}catch(_0x46e87e){return _0x257c62[_0x54bc8a(0x115)]&&console[_0x54bc8a(0x138)](_0x54bc8a(0x123)+_0x767603+':\x20'+_0x46e87e['message']),{'name':_0x767603,'isJourneyLocal':![]};}},'resolveActivation':async _0x5f498a=>{const _0x39188b=_0x3c7ab2,_0x36650d=_0x224c86['get'](_0x5f498a);if(_0x36650d)return _0x36650d;try{const _0x2388b1=await _0x36d6a3[_0x39188b(0x18c)]['getActivation'](_0x2e3e62['id'],_0x5f498a),_0x4f836d=journeyActivationStepToYaml(_0x2388b1,_0x496660,_0x32c20d),_0x1ec081=JSON[_0x39188b(0x128)]({'name':_0x4f836d['name'],'connection':_0x4f836d['connection'],'connector_config':_0x4f836d[_0x39188b(0x11f)]}),_0x3273e2=_0x263d55[_0x39188b(0x179)](_0x1ec081);if(_0x3273e2){const _0x113f2c={'name':_0x3273e2,'isJourneyLocal':!![],'definition':_0x4f836d};return _0x224c86['set'](_0x5f498a,_0x113f2c),_0x113f2c;}const _0x1fe7ff=_0x2388b1['attributes'][_0x39188b(0x16a)][_0x39188b(0x150)]||_0x5f498a,_0x5cac31=sanitizeYamlKey(_0x1fe7ff)||_0x39188b(0x112)+_0x5f498a;let _0x10fddb=_0x5cac31,_0x1b1183=0x2;while(_0x2c0483[_0x39188b(0x137)](_0x10fddb)){_0x10fddb=_0x5cac31+'_'+_0x1b1183,_0x1b1183++;}_0x2c0483['add'](_0x10fddb),_0x263d55[_0x39188b(0x151)](_0x1ec081,_0x10fddb);const _0x54d19a={'name':_0x10fddb,'isJourneyLocal':!![],'definition':_0x4f836d};return _0x224c86[_0x39188b(0x151)](_0x5f498a,_0x54d19a),_0x54d19a;}catch(_0x57ce88){return _0x257c62[_0x39188b(0x115)]&&console[_0x39188b(0x138)](_0x39188b(0xdd)+_0x5f498a+':\x20'+_0x57ce88[_0x39188b(0x17f)]),{'name':_0x5f498a,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x324ecf,_0x85dd3a)=>{const _0x5b9531=_0x3c7ab2;return resolveJumpTarget(_0x324ecf,_0x85dd3a,_0x28e0b3,_0x4a52f3=>_0x36d6a3[_0x5b9531(0x18c)][_0x5b9531(0x11c)](_0x4a52f3));}},_0x2b7ffb=await journeyResponseToDef(_0x25027f,_0x137a12);_0x23d6b5['push']({'item':_0x2e3e62,'yaml':_0x2b7ffb});}},{'verbose':_0x257c62[_0x570cc2(0x115)]});const _0x2e3562=buildMergedJourneyDef(_0x23d6b5,_0x839ab9),_0x19c33e=normalizeJourneyDef(_0x2e3562,_0xc3525b),_0x3d8a92=toYamlString(_0x19c33e),_0x1b4ab7=_0xf61309||a17_0x5a78d7[_0x570cc2(0x11b)](_0x314f7a,sanitizeFileName(_0x49109e)+_0x570cc2(0x149));!_0xf61309&&_0x405702&&!existsSync(_0x314f7a)&&mkdirSync(_0x314f7a,{'recursive':!![]});const _0x778793=a17_0x5a78d7[_0x570cc2(0x11e)](process[_0x570cc2(0xd0)](),_0x1b4ab7);if(existsSync(_0x1b4ab7)){const _0x105ddd=readFileSync(_0x1b4ab7,'utf-8'),_0x20df25=generateDiff(_0x105ddd,_0x3d8a92),_0x535a01=hasChanges(_0x20df25);_0x2a9e6c['push']({'relativePath':_0x778793,'absolutePath':_0x1b4ab7,'content':_0x3d8a92,'isNew':![],'hasChanges':_0x535a01,'diff':_0x535a01?formatDiffWithColors(_0x20df25):undefined});}else _0x2a9e6c[_0x570cc2(0x148)]({'relativePath':_0x778793,'absolutePath':_0x1b4ab7,'content':_0x3d8a92,'isNew':!![],'hasChanges':![]});}const _0x592a20=_0x2a9e6c[_0x570cc2(0x187)](_0x105ab3=>_0x105ab3['isNew']),_0x16de21=_0x2a9e6c[_0x570cc2(0x187)](_0x3037ef=>!_0x3037ef[_0x570cc2(0x172)]&&_0x3037ef[_0x570cc2(0x101)]),_0x2743e7=_0x2a9e6c[_0x570cc2(0x187)](_0x509478=>!_0x509478[_0x570cc2(0x172)]&&!_0x509478[_0x570cc2(0x101)]),_0x228caa=_0x4a0854[_0x570cc2(0x12d)],_0x54454d=_0x3187d0[_0x570cc2(0xd1)],_0x5a59ed=_0x228caa>_0x54454d?'\x20('+_0x228caa+_0x570cc2(0x152):'';console[_0x570cc2(0x138)](_0x570cc2(0x14e)),console[_0x570cc2(0x138)]('\x20\x20'+a17_0x3c7621[_0x570cc2(0xc5)](_0x54454d+'\x20journeys')+a17_0x3c7621['dim'](_0x5a59ed)),console[_0x570cc2(0x138)]('\x20\x20'+a17_0x3c7621[_0x570cc2(0x15b)]('+\x20'+_0x592a20[_0x570cc2(0x12d)]+_0x570cc2(0xc4))),console[_0x570cc2(0x138)]('\x20\x20'+a17_0x3c7621['yellow']('~\x20'+_0x16de21['length']+_0x570cc2(0xdc))),console['error']('\x20\x20'+a17_0x3c7621[_0x570cc2(0x189)]('=\x20'+_0x2743e7[_0x570cc2(0x12d)]+_0x570cc2(0x116))),console[_0x570cc2(0x138)](_0x570cc2(0x178)+a17_0x3c7621['cyan'](_0x38fbb7)+'\x0a');if(_0x16de21['length']>0x0)for(const _0x16f2a9 of _0x16de21){console[_0x570cc2(0x138)](_0x570cc2(0xf7)+_0x16f2a9[_0x570cc2(0xe2)]+'\x27:'),console[_0x570cc2(0x138)]('─'['repeat'](0x3c)),console[_0x570cc2(0x138)](_0x16f2a9['diff']),console[_0x570cc2(0x138)]('─'[_0x570cc2(0xf0)](0x3c));}if(_0x509529[_0x570cc2(0x10e)])return console['error'](a17_0x3c7621[_0x570cc2(0x14a)]('\x0a[Dry\x20run]\x20No\x20files\x20were\x20written')),0x0;if(_0x592a20[_0x570cc2(0x12d)]===0x0&&_0x16de21[_0x570cc2(0x12d)]===0x0)return console[_0x570cc2(0x138)](a17_0x3c7621[_0x570cc2(0x15b)](_0x570cc2(0xe4))),saveSessionContext({'parent_segment':_0x20c61c},_0x509529[_0x570cc2(0x180)]),console['error'](a17_0x3c7621['green']('✔\x20Context\x20set:\x20'+a17_0x3c7621[_0x570cc2(0x189)]('parent_segment')+_0x570cc2(0x17e)+a17_0x3c7621[_0x570cc2(0xc5)](_0x20c61c))),0x0;if(!_0x509529[_0x570cc2(0x14f)]&&(_0x592a20[_0x570cc2(0x12d)]>0x0||_0x16de21[_0x570cc2(0x12d)]>0x0)){const _0xa18107=await confirmKey(_0x570cc2(0x18a)+(_0x592a20['length']+_0x16de21[_0x570cc2(0x12d)])+_0x570cc2(0xda));if(!_0xa18107)return console[_0x570cc2(0x138)](_0x570cc2(0x174)),0x1;}!existsSync(_0x38fbb7)&&mkdirSync(_0x38fbb7,{'recursive':!![]});for(const _0x1e383a of _0x2a9e6c){(_0x1e383a['isNew']||_0x1e383a[_0x570cc2(0x101)])&&writeFileSync(_0x1e383a[_0x570cc2(0x132)],_0x1e383a['content'],_0x570cc2(0x100));}return console[_0x570cc2(0x138)](a17_0x3c7621['green'](_0x570cc2(0x16e)+(_0x592a20['length']+_0x16de21[_0x570cc2(0x12d)])+_0x570cc2(0x11a)+_0x38fbb7)),saveSessionContext({'parent_segment':_0x20c61c},_0x509529[_0x570cc2(0x180)]),console[_0x570cc2(0x138)](a17_0x3c7621[_0x570cc2(0x15b)](_0x570cc2(0x153)+a17_0x3c7621[_0x570cc2(0x189)](_0x570cc2(0x126))+_0x570cc2(0x17e)+a17_0x3c7621[_0x570cc2(0xc5)](_0x20c61c))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a17_0x2f6182(0x150)]=a17_0x2f6182(0x106);[a17_0x2f6182(0x15a)]='Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data';[a17_0x2f6182(0x17a)]=new SegmentPushCommand();async[a17_0x2f6182(0xd7)](_0x13e039){const _0x590449=a17_0x2f6182,_0x5900cb=_0x13e039[_0x590449(0x10f)][0x0];let _0x5951f3;if(_0x5900cb){const _0x180656=await resolveTarget({'arg':_0x5900cb,'contextParent':_0x13e039[_0x590449(0xee)]['parentSegment'],'cwd':process[_0x590449(0xd0)]()});isSuccessfulResolution(_0x180656)&&_0x180656[_0x590449(0x147)]===_0x590449(0xcc)&&(_0x5951f3=_0x180656['filePath']);}const _0x4d9574={..._0x13e039,'options':{..._0x13e039[_0x590449(0xee)],'journeysOnly':!![],..._0x5951f3&&{'singleFilePath':_0x5951f3}}};return this[_0x590449(0x17a)]['execute'](_0x4d9574);}}
1
+ const a17_0x4801a5=a17_0x34aa;(function(_0x303968,_0x575659){const _0x2598c2=a17_0x34aa,_0x5e5d27=_0x303968();while(!![]){try{const _0x197471=parseInt(_0x2598c2(0x214))/0x1*(parseInt(_0x2598c2(0x188))/0x2)+parseInt(_0x2598c2(0x18d))/0x3+-parseInt(_0x2598c2(0x1a6))/0x4*(parseInt(_0x2598c2(0x174))/0x5)+-parseInt(_0x2598c2(0x1d8))/0x6*(-parseInt(_0x2598c2(0x1e7))/0x7)+-parseInt(_0x2598c2(0x189))/0x8+-parseInt(_0x2598c2(0x195))/0x9*(-parseInt(_0x2598c2(0x143))/0xa)+parseInt(_0x2598c2(0x193))/0xb*(-parseInt(_0x2598c2(0x13f))/0xc);if(_0x197471===_0x575659)break;else _0x5e5d27['push'](_0x5e5d27['shift']());}catch(_0x290651){_0x5e5d27['push'](_0x5e5d27['shift']());}}}(a17_0x4c93,0x645d4));import a17_0x541acc from'chalk';import a17_0xcf09ce 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';function a17_0x34aa(_0x49be5b,_0x44b7ed){_0x49be5b=_0x49be5b-0x138;const _0x4c93ec=a17_0x4c93();let _0x34aac4=_0x4c93ec[_0x49be5b];return _0x34aac4;}import{withSpinner,withProgressSpinner}from'../utils/spinner.js';function a17_0x4c93(){const _0x41d00e=['Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','\x20unchanged\x20files','journey','getParentFull','/j/da/je','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','relativePath','state','user','rule','then','connection','data','yes','Options:','paused','Resolved\x20YAML\x20file:\x20','file','conversionRate','parentName','/j/da','\x22\x20not\x20found','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','hasChanges','kind','journey:list','targetDir','listFolders','\x20\x20Statistics\x20not\x20available','\x20\x20Name:\x20','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','get','pause','attributes','site','split','error','\x5c$&','5yuabNb','message','stages','(paused)','goalRate','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','resourceName','Listing\x20journeys...','\x20=\x20','isNew','getStatistics','Export\x20journey(s)\x20as\x20YAML\x20files','No\x20journeys\x20found','values','Found\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','filter','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','execute','Error:\x20Parent\x20segment\x20context\x20required','5712jZvUBm','4409000JTRUxs','Fetching\x20users\x20for\x20email\x20resolution...','Folder\x20path:\x20','archived','1191078fOlBdt','goal','/e/','options','join','reentryMode','58091xpcjiO','\x20(rule\x20match)','6216975amDEOu','versionNumber','\x20versions)','Cancelled','audienceId','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','population','map','blue','parent_segment','resolveSegment','Parent\x20segment:\x20','INVALID_ARGUMENT','\x0aChanges\x20to\x20\x27','\x27\x20not\x20found\x20in\x20','.yml','buildIdToEmailMap','816292ZvBxIl','totalEntered','red','exited','no_parent','launched','segmentPushCommand','folders','\x20(ID:\x20','journeyId','dim','\x20->\x20','setPhase','activation_','yellow','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)','content','resolveJourneyId','getJourney','\x22\x20resumed','push','utf-8','resume','Error:\x20','segmentName','sort','✔\x20Journey\x20\x22','No\x20statistics\x20available\x20for\x20journey:\x20','json','diff','cyan','segment','verbose','\x20\x20-\x20','🗺️\x20','session','log','\x20new\x20files','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','Resolving\x20journey...','(completed)','journey:view','relative','parentSegment','cwd','Warning:\x20Could\x20not\x20resolve\x20activation\x20','errorCode','✔\x20Pulled\x20','listJourneysWithFolders','getSegment','12sgmGhU','Getting\x20journey\x20details...','Resolving\x20parent\x20segment...','Show\x20journey\x20statistics','stageName','journeyBundleId','\x20journey\x20files\x20to\x20','Getting\x20journey\x20statistics...','journeys','\x20changed\x20files','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','has','\x20files?','Target\x20file:\x20','448805dYEXnl','Error:\x20Journey\x20\x27','folderId','size','completed','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','absolutePath','journeyStages','Usage:\x20journey\x20stats\x20<name-or-path>','Journey\x20name:\x20','Warning:\x20Could\x20not\x20resolve\x20segment\x20','Resume\x20a\x20paused\x20journey','args','\x22\x20paused','stringify','totalGoalAchieved','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','Input:\x20','buildIdToNameMap','green','helpText','connector_config','\x20Opening\x20','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','repeat','filePath','add','Warning:\x20Stage\x20\x22','Error:\x20Journey\x20not\x20found:\x20','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','Target\x20directory:\x20','segments','draft','entered','find','description','...','toLowerCase','\x20\x20Target:\x20','activationParams','(root)','localeCompare','\x20\x20Folder\x20path:\x20','web','set','51LRUVaN','includeStats','(archived)','Show\x20journey\x20details','name','journeyBundleName','resolveParentId','all','444OiMDoF','entries','format','\x0aPull\x20summary:','10lRIsMq','✔\x20Context\x20set:\x20','stage','Fetching\x20connections\x20for\x20name\x20resolution...','✔\x20Found\x20','Fetching\x20','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','length','/app/ps/','journeyName','table'];a17_0x4c93=function(){return _0x41d00e;};return a17_0x4c93();}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';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(_0x4d3c4b){const _0x35fac0=a17_0x34aa;switch(_0x4d3c4b){case _0x35fac0(0x1ab):return a17_0x541acc['green']('(running)');case _0x35fac0(0x207):return a17_0x541acc['dim']('(draft)');case _0x35fac0(0x15d):return a17_0x541acc[_0x35fac0(0x1b4)](_0x35fac0(0x177));case _0x35fac0(0x1eb):return a17_0x541acc[_0x35fac0(0x19d)](_0x35fac0(0x1ce));case _0x35fac0(0x18c):return a17_0x541acc['dim'](_0x35fac0(0x139));default:return'('+_0x4d3c4b+')';}}function formatJourneyItem(_0x6a797b,_0x42766b='',_0x1b933f){const _0xdcc87c=a17_0x34aa,_0x3e2c58=formatJourneyState(_0x6a797b[_0xdcc87c(0x155)]),_0x56ea0f=_0x1b933f?hyperlink(_0x6a797b[_0xdcc87c(0x13c)],_0x1b933f):_0x6a797b[_0xdcc87c(0x13c)];return _0x42766b+_0xdcc87c(0x1c8)+_0x56ea0f+'\x20'+_0x3e2c58;}function escapeRegex(_0x2aef8f){const _0x4e8579=a17_0x34aa;return _0x2aef8f['replace'](/[.*+?^${}()|[\]\\]/g,_0x4e8579(0x173));}function globToRegex(_0x4952fb){const _0x4bd283=a17_0x34aa,_0x34164e=_0x4952fb[_0x4bd283(0x171)]('*')[_0x4bd283(0x19c)](escapeRegex);return new RegExp(_0x34164e['join']('.*'),'i');}function buildRuleToNameMapping(_0x5e2116){const _0x28ea84=a17_0x34aa,_0x5183ee=new Map();if(_0x5e2116[_0x28ea84(0x206)])for(const [_0x1b4a68,_0x126179]of Object[_0x28ea84(0x140)](_0x5e2116[_0x28ea84(0x206)])){if(_0x126179[_0x28ea84(0x157)]){const _0x4c1a67=serializeRule(_0x126179['rule']),_0x2f1bf5=_0x5183ee[_0x28ea84(0x16d)](_0x4c1a67);_0x2f1bf5?_0x2f1bf5[_0x28ea84(0x1ba)](_0x1b4a68):_0x5183ee[_0x28ea84(0x213)](_0x4c1a67,[_0x1b4a68]);}}return _0x5183ee;}async function resolveJourneyTarget(_0x13aaa1,_0xa98bd7,_0x40ce04){const _0x1bec0d=a17_0x34aa;if(isYamlFilePath(_0x13aaa1))try{const _0x20e65f=await resolveYamlFilePath(_0x13aaa1);return _0x40ce04&&(console[_0x1bec0d(0x172)](_0x1bec0d(0x15e)+_0x13aaa1),console['error']('\x20\x20Parent\x20segment:\x20'+_0x20e65f[_0x1bec0d(0x1d1)]),console[_0x1bec0d(0x172)](_0x1bec0d(0x16b)+_0x20e65f[_0x1bec0d(0x1be)]),console[_0x1bec0d(0x172)](_0x1bec0d(0x211)+(_0x20e65f['folderPath']||_0x1bec0d(0x20f)))),{'journeyName':_0x20e65f[_0x1bec0d(0x1be)],'parentSegment':_0x20e65f[_0x1bec0d(0x1d1)],'resolved':_0x20e65f};}catch(_0x382583){throw new SDKError(ErrorCode[_0x1bec0d(0x1a1)],_0x1bec0d(0x14e)+_0x382583[_0x1bec0d(0x175)]);}if(!_0xa98bd7)throw new SDKError(ErrorCode[_0x1bec0d(0x1a1)],_0x1bec0d(0x179));return{'journeyName':_0x13aaa1,'parentSegment':_0xa98bd7};}export class JourneyListCommand extends BaseCommand{[a17_0x4801a5(0x13b)]=a17_0x4801a5(0x167);[a17_0x4801a5(0x20a)]='List\x20journeys\x20in\x20current\x20context';async[a17_0x4801a5(0x186)](_0x5c35e6){const _0x12365d=a17_0x4801a5,{options:_0x2c59dd,args:_0x22632a,tdx:_0x4917b6}=_0x5c35e6,_0x43658d=_0x22632a[0x0],_0x2d9401=_0x2c59dd[_0x12365d(0x1d1)];if(!_0x2d9401)return console['error'](_0x12365d(0x187)),console['error'](_0x12365d(0x164)),0x1;const _0x5832f0=await withSpinner(_0x12365d(0x1da),()=>_0x4917b6[_0x12365d(0x1c5)]['resolveParentId'](_0x2d9401),{'verbose':_0x2c59dd[_0x12365d(0x1c6)]}),_0x38653c=_0x5832f0[_0x12365d(0x15a)];_0x2c59dd['verbose']&&(console[_0x12365d(0x172)](_0x12365d(0x1a0)+_0x2d9401+_0x12365d(0x1ae)+_0x38653c+')'),_0x43658d&&console[_0x12365d(0x172)]('Pattern:\x20'+_0x43658d));const _0x3822d7=await withSpinner('Fetching\x20parent\x20segment...',()=>_0x4917b6[_0x12365d(0x1c5)][_0x12365d(0x151)](_0x38653c),{'verbose':_0x2c59dd[_0x12365d(0x1c6)]}),_0x173ffd=_0x3822d7['data'],_0x5494f7=_0x173ffd['rootFolderId'],_0x1ee095=await withSpinner(_0x12365d(0x17b),()=>_0x4917b6[_0x12365d(0x150)][_0x12365d(0x1d6)](_0x38653c,_0x5494f7),{'verbose':_0x2c59dd[_0x12365d(0x1c6)]});let _0x5434f=_0x1ee095['data'][_0x12365d(0x1e0)];const _0x1a0d75=_0x1ee095[_0x12365d(0x15a)][_0x12365d(0x1ad)],_0x51bf52=new Map();for(const _0x1196ea of _0x1a0d75){_0x51bf52[_0x12365d(0x213)](_0x1196ea['id'],_0x1196ea[_0x12365d(0x13b)]);}if(_0x43658d){const _0x2ecd73=globToRegex(_0x43658d);_0x5434f=_0x5434f[_0x12365d(0x184)](_0x5cfa14=>_0x2ecd73['test'](_0x5cfa14['journeyBundleName']));}console['error'](_0x12365d(0x147)+_0x5434f[_0x12365d(0x14a)]+'\x20journey'+(_0x5434f[_0x12365d(0x14a)]!==0x1?'s':''));const _0x50518e=_0x473e03=>{const _0x3a1e08=_0x12365d;return getConsoleNextUrl(_0x2c59dd[_0x3a1e08(0x170)],_0x3a1e08(0x14b)+_0x38653c+_0x3a1e08(0x18f)+_0x473e03+_0x3a1e08(0x162));};if(_0x2c59dd[_0x12365d(0x141)]===_0x12365d(0x14d))await handleSDKOutput(_0x5434f,_0x2c59dd);else{if(_0x2c59dd['format']===_0x12365d(0x1c2)){const _0x465989=_0x5434f[_0x12365d(0x19c)](_0x22acdf=>({..._0x22acdf,'url':_0x50518e(_0x22acdf['id'])}));await handleSDKOutput(_0x465989,_0x2c59dd);}else{console[_0x12365d(0x1ca)]('['+_0x2d9401+']');const _0xda7923=new Map(),_0x117855=[];for(const _0x2fd600 of _0x5434f){if(!_0x2fd600['folderId']||_0x2fd600[_0x12365d(0x1e9)]===_0x5494f7)_0x117855[_0x12365d(0x1ba)](_0x2fd600);else{const _0x483169=_0xda7923[_0x12365d(0x16d)](_0x2fd600['folderId'])||[];_0x483169[_0x12365d(0x1ba)](_0x2fd600),_0xda7923['set'](_0x2fd600[_0x12365d(0x1e9)],_0x483169);}}const _0x1c5250=(_0x1ce9e1,_0x325f44)=>_0x1ce9e1[_0x12365d(0x13c)][_0x12365d(0x210)](_0x325f44[_0x12365d(0x13c)],undefined,{'sensitivity':'base'});_0x117855['sort'](_0x1c5250);for(const _0x522405 of _0x117855){console[_0x12365d(0x1ca)](formatJourneyItem(_0x522405,'',_0x50518e(_0x522405['id'])));}const _0x505a70=[..._0xda7923[_0x12365d(0x140)]()][_0x12365d(0x1bf)]((_0x3e7ac2,_0x4f02fd)=>{const _0x7c91dc=_0x12365d,_0xc070e=_0x51bf52[_0x7c91dc(0x16d)](_0x3e7ac2[0x0])||_0x3e7ac2[0x0],_0x302827=_0x51bf52['get'](_0x4f02fd[0x0])||_0x4f02fd[0x0];return _0xc070e[_0x7c91dc(0x210)](_0x302827,undefined,{'sensitivity':'base'});});for(const [_0xb6d214,_0x4ac0b9]of _0x505a70){const _0x3ae1bd=_0x51bf52[_0x12365d(0x16d)](_0xb6d214)||_0xb6d214;console[_0x12365d(0x1ca)]('📁\x20'+_0x3ae1bd),_0x4ac0b9['sort'](_0x1c5250);for(const _0x55a0b1 of _0x4ac0b9){console[_0x12365d(0x1ca)](formatJourneyItem(_0x55a0b1,'\x20\x20',_0x50518e(_0x55a0b1['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{[a17_0x4801a5(0x13b)]=a17_0x4801a5(0x1cf);[a17_0x4801a5(0x20a)]=a17_0x4801a5(0x13a);async[a17_0x4801a5(0x186)](_0xe64094){const _0x1d94e5=a17_0x4801a5,{options:_0x160059,args:_0x20e0cd,tdx:_0x6c645d}=_0xe64094,_0x35fd09=_0x20e0cd[0x0];if(!_0x35fd09)return console[_0x1d94e5(0x172)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x1d94e5(0x172)](_0x1d94e5(0x204)),console[_0x1d94e5(0x172)](_0x1d94e5(0x15c)),console[_0x1d94e5(0x172)]('\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser'),0x1;_0x160059[_0x1d94e5(0x1c6)]&&console['error'](_0x1d94e5(0x1f8)+_0x35fd09);const _0x8ef5f3=await resolveJourneyTarget(_0x35fd09,_0x160059[_0x1d94e5(0x1d1)],_0x160059[_0x1d94e5(0x1c6)]),_0x585b8c=await withSpinner(_0x1d94e5(0x1da),()=>_0x6c645d['segment'][_0x1d94e5(0x13d)](_0x8ef5f3[_0x1d94e5(0x1d1)]),{'verbose':_0x160059['verbose']}),_0x4ee9cd=_0x585b8c[_0x1d94e5(0x15a)],_0x211282=await withSpinner(_0x1d94e5(0x1cd),()=>_0x6c645d[_0x1d94e5(0x150)][_0x1d94e5(0x1b7)](_0x4ee9cd,_0x8ef5f3['journeyName']),{'verbose':_0x160059[_0x1d94e5(0x1c6)]}),_0x3148e2=_0x211282['data'];if(_0x160059[_0x1d94e5(0x212)]){const _0x38a01b=getConsoleNextUrl(_0x160059['site'],_0x1d94e5(0x14b)+_0x4ee9cd+_0x1d94e5(0x18f)+_0x3148e2+_0x1d94e5(0x152));return console[_0x1d94e5(0x172)](a17_0x541acc['green']('✔')+_0x1d94e5(0x1fd)+a17_0x541acc[_0x1d94e5(0x1c4)](_0x38a01b)),openBrowser(_0x38a01b),0x0;}const _0x4432b7=await withSpinner(_0x1d94e5(0x1d9),()=>_0x6c645d[_0x1d94e5(0x150)]['getJourney'](_0x3148e2),{'verbose':_0x160059[_0x1d94e5(0x1c6)]}),_0x1803af=_0x4432b7['data'],_0x47fa63=_0x160059[_0x1d94e5(0x138)];let _0x2e08dd;if(_0x47fa63)try{const _0x8be0ca=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x6c645d[_0x1d94e5(0x150)][_0x1d94e5(0x17e)](_0x3148e2),{'verbose':_0x160059[_0x1d94e5(0x1c6)]});_0x2e08dd=_0x8be0ca[_0x1d94e5(0x15a)];}catch{_0x160059[_0x1d94e5(0x1c6)]&&console[_0x1d94e5(0x172)](_0x1d94e5(0x16a));}const _0x5907d3=getConsoleNextUrl(_0x160059['site'],_0x1d94e5(0x14b)+_0x4ee9cd+_0x1d94e5(0x18f)+_0x3148e2+_0x1d94e5(0x152)),_0x104346={'id':_0x1803af['id'],'name':_0x1803af['attributes'][_0x1d94e5(0x13b)],'description':_0x1803af[_0x1d94e5(0x16f)][_0x1d94e5(0x20a)],'state':_0x1803af[_0x1d94e5(0x16f)][_0x1d94e5(0x155)],'paused':_0x1803af[_0x1d94e5(0x16f)]['paused'],'reentry_mode':_0x1803af[_0x1d94e5(0x16f)][_0x1d94e5(0x192)],'stages':_0x1803af[_0x1d94e5(0x16f)][_0x1d94e5(0x1ee)]?.['length']||0x0,..._0x1803af[_0x1d94e5(0x16f)][_0x1d94e5(0x18e)]&&{'goal':_0x1803af[_0x1d94e5(0x16f)][_0x1d94e5(0x18e)][_0x1d94e5(0x13b)]},..._0x2e08dd&&{'statistics':{'total_entered':_0x2e08dd[_0x1d94e5(0x1a7)],'goal_achieved':_0x2e08dd[_0x1d94e5(0x1f6)],'goal_rate':_0x2e08dd[_0x1d94e5(0x178)],'stages':_0x2e08dd[_0x1d94e5(0x176)]}},'url':_0x5907d3};return await handleSingleObjectOutput(_0x104346,_0x160059),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a17_0x4801a5(0x13b)]='journey:stats';[a17_0x4801a5(0x20a)]=a17_0x4801a5(0x1db);async[a17_0x4801a5(0x186)](_0x54b9fc){const _0x55f9a0=a17_0x4801a5,{options:_0x545b3e,args:_0x1c4f72,tdx:_0x580f34}=_0x54b9fc,_0x271dac=_0x1c4f72[0x0];if(!_0x271dac)return console[_0x55f9a0(0x172)](_0x55f9a0(0x16c)),console[_0x55f9a0(0x172)](_0x55f9a0(0x1ef)),0x1;_0x545b3e[_0x55f9a0(0x1c6)]&&console[_0x55f9a0(0x172)](_0x55f9a0(0x1f8)+_0x271dac);const _0x3a42b5=await resolveJourneyTarget(_0x271dac,_0x545b3e[_0x55f9a0(0x1d1)],_0x545b3e[_0x55f9a0(0x1c6)]),_0x4da734=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x580f34[_0x55f9a0(0x1c5)][_0x55f9a0(0x13d)](_0x3a42b5['parentSegment']),{'verbose':_0x545b3e[_0x55f9a0(0x1c6)]}),_0x486887=_0x4da734[_0x55f9a0(0x15a)],_0x5102bd=await withSpinner(_0x55f9a0(0x1cd),()=>_0x580f34[_0x55f9a0(0x150)][_0x55f9a0(0x1b7)](_0x486887,_0x3a42b5[_0x55f9a0(0x14c)]),{'verbose':_0x545b3e[_0x55f9a0(0x1c6)]}),_0x573354=_0x5102bd[_0x55f9a0(0x15a)],_0x54d621=await withSpinner(_0x55f9a0(0x1df),()=>_0x580f34['journey'][_0x55f9a0(0x17e)](_0x573354),{'verbose':_0x545b3e[_0x55f9a0(0x1c6)]}),_0x4c433a=_0x54d621[_0x55f9a0(0x15a)];if(!_0x4c433a||_0x4c433a[_0x55f9a0(0x1af)]===null)return console[_0x55f9a0(0x172)](_0x55f9a0(0x1c1)+_0x3a42b5[_0x55f9a0(0x14c)]),console['error'](_0x55f9a0(0x185)),0x0;const _0xb5d7c0={'journey_id':_0x4c433a[_0x55f9a0(0x1af)],'total_entered':_0x4c433a['totalEntered'],'goal_achieved':_0x4c433a[_0x55f9a0(0x1f6)],'goal_rate':_0x4c433a[_0x55f9a0(0x178)],'stages':_0x4c433a['stages']?.[_0x55f9a0(0x19c)](_0x233d56=>({'name':_0x233d56[_0x55f9a0(0x1dc)],'population':_0x233d56[_0x55f9a0(0x19b)],'entered':_0x233d56[_0x55f9a0(0x208)],'exited':_0x233d56[_0x55f9a0(0x1a9)],'conversion_rate':_0x233d56[_0x55f9a0(0x160)]}))},_0x200456=_0x545b3e[_0x55f9a0(0x145)];if(_0x200456&&_0x4c433a[_0x55f9a0(0x176)]){const _0x46a877=_0x4c433a[_0x55f9a0(0x176)][_0x55f9a0(0x209)](_0xed9ae1=>_0xed9ae1[_0x55f9a0(0x1dc)][_0x55f9a0(0x20c)]()===_0x200456[_0x55f9a0(0x20c)]());if(_0x46a877)return await handleSingleObjectOutput({'stage_name':_0x46a877[_0x55f9a0(0x1dc)],'population':_0x46a877[_0x55f9a0(0x19b)],'entered':_0x46a877[_0x55f9a0(0x208)],'exited':_0x46a877[_0x55f9a0(0x1a9)],'conversion_rate':_0x46a877[_0x55f9a0(0x160)]},_0x545b3e),0x0;console[_0x55f9a0(0x172)](_0x55f9a0(0x202)+_0x200456+_0x55f9a0(0x163));}return await handleSingleObjectOutput(_0xb5d7c0,_0x545b3e),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a17_0x4801a5(0x13b)]='journey:pause';[a17_0x4801a5(0x20a)]='Pause\x20a\x20running\x20journey';async[a17_0x4801a5(0x186)](_0x282f09){const _0x526076=a17_0x4801a5,{options:_0x42b699,args:_0x260cc9,tdx:_0x1c4e65}=_0x282f09,_0x428b69=_0x260cc9[0x0];if(!_0x428b69)return console[_0x526076(0x172)]('Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required'),console[_0x526076(0x172)]('Usage:\x20journey\x20pause\x20<name-or-path>'),0x1;_0x42b699[_0x526076(0x1c6)]&&console[_0x526076(0x172)](_0x526076(0x1f8)+_0x428b69);const _0x2ace07=await resolveJourneyTarget(_0x428b69,_0x42b699['parentSegment'],_0x42b699[_0x526076(0x1c6)]),_0x1a1c37=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x1c4e65['segment'][_0x526076(0x13d)](_0x2ace07[_0x526076(0x1d1)]),{'verbose':_0x42b699['verbose']}),_0x396c3e=_0x1a1c37[_0x526076(0x15a)],_0x4bae89=await withSpinner(_0x526076(0x1cd),()=>_0x1c4e65[_0x526076(0x150)][_0x526076(0x1b7)](_0x396c3e,_0x2ace07[_0x526076(0x14c)]),{'verbose':_0x42b699[_0x526076(0x1c6)]}),_0x5d2c3f=_0x4bae89[_0x526076(0x15a)];if(!_0x42b699[_0x526076(0x15b)]){const _0xed8b94=await confirm(_0x526076(0x1e2)+_0x2ace07[_0x526076(0x14c)]+'\x22?');if(!_0xed8b94)return console[_0x526076(0x172)](_0x526076(0x198)),0x0;}const _0x463bb2=await withSpinner('Pausing\x20journey...',()=>_0x1c4e65[_0x526076(0x150)][_0x526076(0x16e)](_0x5d2c3f),{'verbose':_0x42b699['verbose']}),_0x1a7ee0=_0x463bb2['data'];return console[_0x526076(0x172)](_0x526076(0x1c0)+_0x1a7ee0[_0x526076(0x16f)][_0x526076(0x13b)]+_0x526076(0x1f4)),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a17_0x4801a5(0x13b)]='journey:resume';[a17_0x4801a5(0x20a)]=a17_0x4801a5(0x1f2);async[a17_0x4801a5(0x186)](_0x3eda04){const _0x3a7af0=a17_0x4801a5,{options:_0x5207bf,args:_0x2904cb,tdx:_0x13aff4}=_0x3eda04,_0xfdcd8e=_0x2904cb[0x0];if(!_0xfdcd8e)return console[_0x3a7af0(0x172)](_0x3a7af0(0x16c)),console[_0x3a7af0(0x172)]('Usage:\x20journey\x20resume\x20<name-or-path>'),0x1;_0x5207bf['verbose']&&console[_0x3a7af0(0x172)](_0x3a7af0(0x1f8)+_0xfdcd8e);const _0x13d697=await resolveJourneyTarget(_0xfdcd8e,_0x5207bf[_0x3a7af0(0x1d1)],_0x5207bf['verbose']),_0x139e4d=await withSpinner(_0x3a7af0(0x1da),()=>_0x13aff4[_0x3a7af0(0x1c5)][_0x3a7af0(0x13d)](_0x13d697[_0x3a7af0(0x1d1)]),{'verbose':_0x5207bf[_0x3a7af0(0x1c6)]}),_0x164117=_0x139e4d['data'],_0x517463=await withSpinner(_0x3a7af0(0x1cd),()=>_0x13aff4[_0x3a7af0(0x150)][_0x3a7af0(0x1b7)](_0x164117,_0x13d697[_0x3a7af0(0x14c)]),{'verbose':_0x5207bf[_0x3a7af0(0x1c6)]}),_0x53b45f=_0x517463[_0x3a7af0(0x15a)];if(!_0x5207bf[_0x3a7af0(0x15b)]){const _0x2dce2b=await confirm('Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22'+_0x13d697[_0x3a7af0(0x14c)]+'\x22?');if(!_0x2dce2b)return console['error'](_0x3a7af0(0x198)),0x0;}const _0x30dd6f=await withSpinner('Resuming\x20journey...',()=>_0x13aff4[_0x3a7af0(0x150)][_0x3a7af0(0x1bc)](_0x53b45f),{'verbose':_0x5207bf[_0x3a7af0(0x1c6)]}),_0x39edbe=_0x30dd6f[_0x3a7af0(0x15a)];return console[_0x3a7af0(0x172)](_0x3a7af0(0x1c0)+_0x39edbe[_0x3a7af0(0x16f)]['name']+_0x3a7af0(0x1b9)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a17_0x4801a5(0x13b)]='journey:pull';[a17_0x4801a5(0x20a)]=a17_0x4801a5(0x17f);async['execute'](_0x259754){const _0x1d567a=a17_0x4801a5,{options:_0x5ca7c1,args:_0x2b3ab2,tdx:_0x22472e}=_0x259754,_0x3772d5=_0x5ca7c1,_0x461c47=_0x2b3ab2[0x0],_0x3cb126=_0x461c47&&isYamlFilePath(_0x461c47),_0x387f4d=await resolveTarget({'arg':_0x3cb126?_0x461c47:undefined,'contextParent':_0x5ca7c1[_0x1d567a(0x1d1)],'cwd':process[_0x1d567a(0x1d2)]()});if(!isSuccessfulResolution(_0x387f4d))return _0x387f4d[_0x1d567a(0x1d4)]===_0x1d567a(0x1aa)?(console['error'](a17_0x541acc[_0x1d567a(0x1b4)](_0x1d567a(0x1fe))),console[_0x1d567a(0x172)](_0x1d567a(0x1b5)),console['error'](_0x1d567a(0x19a)),console[_0x1d567a(0x172)](_0x1d567a(0x183)),console[_0x1d567a(0x172)](_0x1d567a(0x1f7))):(console[_0x1d567a(0x172)](a17_0x541acc[_0x1d567a(0x1a8)](_0x1d567a(0x1bd)+_0x387f4d[_0x1d567a(0x175)]+'\x0a')),_0x387f4d[_0x1d567a(0x1fb)]&&console[_0x1d567a(0x172)](a17_0x541acc['cyan'](_0x387f4d[_0x1d567a(0x1fb)]))),0x1;let _0x2a0fd4=_0x3cb126?undefined:_0x461c47,_0x2afd32,_0x4c8953;_0x387f4d['type']===_0x1d567a(0x15f)&&(_0x2a0fd4=_0x387f4d[_0x1d567a(0x17a)],_0x2afd32=_0x387f4d[_0x1d567a(0x200)],_0x4c8953=_0x387f4d['folderPath']);const _0x306526=_0x387f4d[_0x1d567a(0x161)],_0x35fd18=_0x387f4d[_0x1d567a(0x168)];_0x3772d5['verbose']&&(console[_0x1d567a(0x172)]('Parent\x20segment:\x20'+_0x306526),console[_0x1d567a(0x172)](_0x1d567a(0x205)+_0x35fd18),_0x2a0fd4&&console[_0x1d567a(0x172)](_0x1d567a(0x1f0)+_0x2a0fd4),_0x2afd32&&console['error'](_0x1d567a(0x1e6)+_0x2afd32),_0x4c8953&&console['error'](_0x1d567a(0x18b)+_0x4c8953));const _0x3a2a59=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x22472e[_0x1d567a(0x1c5)][_0x1d567a(0x13d)](_0x306526),{'verbose':_0x5ca7c1['verbose']}),_0x520ada=_0x3a2a59[_0x1d567a(0x15a)],[_0x3e4bea,_0x2a45d3]=await Promise[_0x1d567a(0x13e)]([withSpinner('Listing\x20journeys...',()=>_0x22472e[_0x1d567a(0x150)]['listJourneysFromParentSegment'](_0x520ada,undefined,{'includeAllVersions':!![]}),{'verbose':_0x5ca7c1['verbose']}),withSpinner('Listing\x20folders...',()=>_0x22472e[_0x1d567a(0x1c5)][_0x1d567a(0x169)](_0x520ada),{'verbose':_0x5ca7c1[_0x1d567a(0x1c6)]})]);let _0x4c2653=_0x3e4bea[_0x1d567a(0x15a)];const _0x4ded15=_0x2a45d3[_0x1d567a(0x15a)],_0x1133b0=buildFolderIdToPathMap(_0x4ded15);if(_0x2a0fd4){const _0x354e15=_0x4c2653[_0x1d567a(0x184)](_0x5ea990=>_0x5ea990[_0x1d567a(0x13c)][_0x1d567a(0x20c)]()===_0x2a0fd4[_0x1d567a(0x20c)]());if(_0x354e15[_0x1d567a(0x14a)]===0x0)return console['error'](_0x1d567a(0x203)+_0x2a0fd4),console[_0x1d567a(0x172)](_0x1d567a(0x1cc)),0x1;_0x4c2653=_0x354e15;}if(_0x4c8953!==undefined){const _0x5ebabe=_0x4c2653['filter'](_0x54be57=>{const _0x4ae1b1=_0x1d567a,_0x5c1b31=_0x54be57['folderId']?_0x1133b0[_0x4ae1b1(0x16d)](_0x54be57[_0x4ae1b1(0x1e9)])||'':'';return _0x5c1b31===_0x4c8953;});if(_0x5ebabe[_0x1d567a(0x14a)]===0x0&&_0x4c2653[_0x1d567a(0x14a)]>0x0){console[_0x1d567a(0x172)](_0x1d567a(0x1e8)+_0x2a0fd4+_0x1d567a(0x1a3)+(_0x4c8953||'root\x20folder')),console[_0x1d567a(0x172)](_0x1d567a(0x1ec));for(const _0x7bfcd2 of _0x4c2653){const _0x2971f4=_0x7bfcd2[_0x1d567a(0x1e9)]?_0x1133b0[_0x1d567a(0x16d)](_0x7bfcd2[_0x1d567a(0x1e9)])||'':'';console['error'](_0x1d567a(0x1c7)+(_0x2971f4||'(root)')+'/'+_0x7bfcd2['journeyBundleName']);}return 0x1;}_0x4c2653=_0x5ebabe;}if(_0x4c2653[_0x1d567a(0x14a)]===0x0)return console[_0x1d567a(0x172)](_0x1d567a(0x180)),0x0;const _0x5f5110=new Map();for(const _0x3e1632 of _0x4c2653){const _0x32807f=_0x3e1632[_0x1d567a(0x1dd)];!_0x5f5110[_0x1d567a(0x1e4)](_0x32807f)&&_0x5f5110['set'](_0x32807f,[]),_0x5f5110[_0x1d567a(0x16d)](_0x32807f)['push'](_0x3e1632);}for(const _0x348652 of _0x5f5110[_0x1d567a(0x181)]()){_0x348652[_0x1d567a(0x1bf)]((_0xe23423,_0x1237b6)=>(_0xe23423[_0x1d567a(0x196)]||0x0)-(_0x1237b6[_0x1d567a(0x196)]||0x0));}const _0x1b943d=[],[_0xdddade,_0x4413a7]=await Promise['all']([withSpinner(_0x1d567a(0x18a),()=>_0x22472e[_0x1d567a(0x156)][_0x1d567a(0x1a5)](),{'verbose':_0x5ca7c1[_0x1d567a(0x1c6)]})[_0x1d567a(0x158)](_0x49bbed=>_0x49bbed[_0x1d567a(0x15a)]),withSpinner(_0x1d567a(0x146),()=>_0x22472e[_0x1d567a(0x159)][_0x1d567a(0x1f9)](),{'verbose':_0x5ca7c1[_0x1d567a(0x1c6)]})[_0x1d567a(0x158)](_0x39e859=>_0x39e859[_0x1d567a(0x15a)])]);for(const _0x341f97 of _0x5f5110[_0x1d567a(0x181)]()){const _0x26e9d2=_0x341f97[0x0][_0x1d567a(0x13c)],_0x29c0b3=_0x341f97[0x0][_0x1d567a(0x1e9)],_0x4e939f=_0x29c0b3?_0x1133b0[_0x1d567a(0x16d)](_0x29c0b3)||'':'',_0x45753=_0x4e939f?a17_0xcf09ce[_0x1d567a(0x191)](_0x35fd18,_0x4e939f):_0x35fd18,_0xcbfbf5=_0x2afd32||a17_0xcf09ce[_0x1d567a(0x191)](_0x45753,sanitizeFileName(_0x26e9d2)+_0x1d567a(0x1a4));let _0x50fb5c,_0x17309e;if(existsSync(_0xcbfbf5))try{const _0x59b95c=readFileSync(_0xcbfbf5,_0x1d567a(0x1bb)),_0x23def4=parseYamlString(_0x59b95c);_0x17309e=_0x23def4,_0x50fb5c=buildRuleToNameMapping(_0x23def4),_0x3772d5[_0x1d567a(0x1c6)]&&_0x50fb5c['size']>0x0&&console[_0x1d567a(0x172)](_0x1d567a(0x182)+_0x50fb5c[_0x1d567a(0x1ea)]+_0x1d567a(0x149)+_0x26e9d2);}catch(_0x49add9){_0x3772d5[_0x1d567a(0x1c6)]&&console[_0x1d567a(0x172)]('Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20'+_0x49add9[_0x1d567a(0x175)]);}const _0x3436f6=[],_0x262663=new Set(),_0x3f06e9=new Map(),_0x15a049=new Map(),_0xc0c3ef=new Set(),_0x5cced1=new Map(),_0x558078=new Map(),_0x3a159b=createJumpTargetCache();await withProgressSpinner(_0x1d567a(0x148)+_0x26e9d2+_0x1d567a(0x20b),async _0x3766ca=>{const _0x2c8b7f=_0x1d567a;for(const _0x47c793 of _0x341f97){const _0x1a9e1a=_0x341f97[_0x2c8b7f(0x14a)]>0x1?_0x47c793[_0x2c8b7f(0x13c)]+'\x20v'+(_0x47c793[_0x2c8b7f(0x196)]||0x1):_0x47c793[_0x2c8b7f(0x13c)];_0x3766ca[_0x2c8b7f(0x1b2)](_0x2c8b7f(0x148)+_0x1a9e1a);const _0x4c66b1=await _0x22472e[_0x2c8b7f(0x150)][_0x2c8b7f(0x1b8)](_0x47c793['id']),_0x1d99a8=_0x4c66b1['attributes']?.[_0x2c8b7f(0x199)],_0x59aacd={'resolveSegment':async _0xe3cce3=>{const _0x520d50=_0x2c8b7f;if(!_0x1d99a8)return{'name':_0xe3cce3,'isJourneyLocal':![]};const _0xf65c7c=_0x3f06e9[_0x520d50(0x16d)](_0xe3cce3);if(_0xf65c7c)return _0xf65c7c;try{const _0x307911=await _0x22472e[_0x520d50(0x1c5)][_0x520d50(0x1d7)](_0x1d99a8,_0xe3cce3),_0x3d006b=_0x307911[_0x520d50(0x166)]===SEGMENT_KIND_JOURNEY;let _0x55a9b4,_0x134ab8=_0x307911[_0x520d50(0x13b)];if(_0x3d006b&&_0x307911[_0x520d50(0x157)]){const _0x241fb2=await segmentResponseToDef(_0x307911,{'resolveSegmentName':async _0x254f77=>{const _0x502794=_0x520d50,_0x1d0fac=_0x3f06e9['get'](_0x254f77);if(_0x1d0fac)return _0x1d0fac['name'];const _0x4b44aa=await _0x59aacd[_0x502794(0x19f)](_0x254f77);return _0x4b44aa[_0x502794(0x13b)];}}),_0x490d81=_0x241fb2['rule'];_0x55a9b4={'description':_0x307911[_0x520d50(0x20a)],'rule':_0x490d81};const _0x5830bd=serializeRule(_0x490d81),_0x3475e8=_0x15a049[_0x520d50(0x16d)](_0x5830bd);if(_0x3475e8)_0x134ab8=_0x3475e8,_0x55a9b4=undefined,_0x3772d5['verbose']&&console[_0x520d50(0x172)]('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0x307911['name']+_0x520d50(0x1b1)+_0x3475e8);else{let _0x4b98b7=![];if(_0x50fb5c){const _0x5dd4c2=_0x50fb5c[_0x520d50(0x16d)](_0x5830bd);if(_0x5dd4c2){const _0x272310=_0x5dd4c2['find'](_0x88219b=>!_0x262663[_0x520d50(0x1e4)](_0x88219b));_0x272310&&(_0x134ab8=_0x272310,_0x262663[_0x520d50(0x201)](_0x272310),_0x15a049['set'](_0x5830bd,_0x272310),_0x4b98b7=!![],_0x3772d5[_0x520d50(0x1c6)]&&console[_0x520d50(0x172)]('\x20\x20Preserving\x20local\x20segment\x20name:\x20'+_0x272310+_0x520d50(0x194)));}}if(!_0x4b98b7){const _0x4ef112=generateJourneyLocalName(_0x307911[_0x520d50(0x13b)]);_0x4ef112&&(_0x134ab8=_0x4ef112);let _0x377790=_0x134ab8,_0x70ca89=0x2;while(_0x262663[_0x520d50(0x1e4)](_0x377790)){_0x377790=_0x134ab8+'_'+_0x70ca89,_0x70ca89++;}_0x262663[_0x520d50(0x201)](_0x377790),_0x15a049['set'](_0x5830bd,_0x377790),_0x134ab8=_0x377790;}}}const _0x5635f0={'name':_0x134ab8,'isJourneyLocal':_0x3d006b,'definition':_0x55a9b4};return _0x3f06e9[_0x520d50(0x213)](_0xe3cce3,_0x5635f0),_0x5635f0;}catch(_0xa9c744){return _0x5ca7c1['verbose']&&console[_0x520d50(0x172)](_0x520d50(0x1f1)+_0xe3cce3+':\x20'+_0xa9c744[_0x520d50(0x175)]),{'name':_0xe3cce3,'isJourneyLocal':![]};}},'resolveActivation':async _0x3036c4=>{const _0x11fb71=_0x2c8b7f,_0x2e6301=_0x5cced1['get'](_0x3036c4);if(_0x2e6301)return _0x2e6301;try{const _0x351508=await _0x22472e['journey']['getActivation'](_0x47c793['id'],_0x3036c4),_0xd7ae38=journeyActivationStepToYaml(_0x351508,_0xdddade,_0x4413a7),_0x6ade24=JSON[_0x11fb71(0x1f5)]({'name':_0xd7ae38[_0x11fb71(0x13b)],'connection':_0xd7ae38['connection'],'connector_config':_0xd7ae38[_0x11fb71(0x1fc)]}),_0x390fd3=_0x558078[_0x11fb71(0x16d)](_0x6ade24);if(_0x390fd3){const _0x3637e1={'name':_0x390fd3,'isJourneyLocal':!![],'definition':_0xd7ae38};return _0x5cced1[_0x11fb71(0x213)](_0x3036c4,_0x3637e1),_0x3637e1;}const _0x27c90d=_0x351508['attributes'][_0x11fb71(0x20e)][_0x11fb71(0x13b)]||_0x3036c4,_0x14bf36=sanitizeYamlKey(_0x27c90d)||_0x11fb71(0x1b3)+_0x3036c4;let _0x2900c6=_0x14bf36,_0x3ce1c4=0x2;while(_0xc0c3ef['has'](_0x2900c6)){_0x2900c6=_0x14bf36+'_'+_0x3ce1c4,_0x3ce1c4++;}_0xc0c3ef[_0x11fb71(0x201)](_0x2900c6),_0x558078['set'](_0x6ade24,_0x2900c6);const _0x550dfb={'name':_0x2900c6,'isJourneyLocal':!![],'definition':_0xd7ae38};return _0x5cced1[_0x11fb71(0x213)](_0x3036c4,_0x550dfb),_0x550dfb;}catch(_0x299068){return _0x5ca7c1[_0x11fb71(0x1c6)]&&console[_0x11fb71(0x172)](_0x11fb71(0x1d3)+_0x3036c4+':\x20'+_0x299068['message']),{'name':_0x3036c4,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x34b4a0,_0x820a0c)=>{const _0xa8f3c8=_0x2c8b7f;return resolveJumpTarget(_0x34b4a0,_0x820a0c,_0x3a159b,_0x13c479=>_0x22472e[_0xa8f3c8(0x150)][_0xa8f3c8(0x1b8)](_0x13c479));}},_0x5dab01=await journeyResponseToDef(_0x4c66b1,_0x59aacd);_0x3436f6[_0x2c8b7f(0x1ba)]({'item':_0x47c793,'yaml':_0x5dab01});}},{'verbose':_0x5ca7c1['verbose']});const _0x5c4fcb=buildMergedJourneyDef(_0x3436f6,_0x50fb5c),_0x507b10=normalizeJourneyDef(_0x5c4fcb,_0x17309e),_0x1d6023=toYamlString(_0x507b10),_0x5b08af=_0x2afd32||a17_0xcf09ce[_0x1d567a(0x191)](_0x45753,sanitizeFileName(_0x26e9d2)+_0x1d567a(0x1a4));!_0x2afd32&&_0x4e939f&&!existsSync(_0x45753)&&mkdirSync(_0x45753,{'recursive':!![]});const _0x21140c=a17_0xcf09ce[_0x1d567a(0x1d0)](process[_0x1d567a(0x1d2)](),_0x5b08af);if(existsSync(_0x5b08af)){const _0x8bdc32=readFileSync(_0x5b08af,_0x1d567a(0x1bb)),_0x2708b1=generateDiff(_0x8bdc32,_0x1d6023),_0x4cc0ee=hasChanges(_0x2708b1);_0x1b943d[_0x1d567a(0x1ba)]({'relativePath':_0x21140c,'absolutePath':_0x5b08af,'content':_0x1d6023,'isNew':![],'hasChanges':_0x4cc0ee,'diff':_0x4cc0ee?formatDiffWithColors(_0x2708b1):undefined});}else _0x1b943d[_0x1d567a(0x1ba)]({'relativePath':_0x21140c,'absolutePath':_0x5b08af,'content':_0x1d6023,'isNew':!![],'hasChanges':![]});}const _0x8074b4=_0x1b943d[_0x1d567a(0x184)](_0x3b9f43=>_0x3b9f43[_0x1d567a(0x17d)]),_0x472a19=_0x1b943d[_0x1d567a(0x184)](_0x2fade7=>!_0x2fade7['isNew']&&_0x2fade7[_0x1d567a(0x165)]),_0x275253=_0x1b943d[_0x1d567a(0x184)](_0x113a47=>!_0x113a47[_0x1d567a(0x17d)]&&!_0x113a47[_0x1d567a(0x165)]),_0x26bd87=_0x4c2653[_0x1d567a(0x14a)],_0x1c030d=_0x5f5110[_0x1d567a(0x1ea)],_0x443eff=_0x26bd87>_0x1c030d?'\x20('+_0x26bd87+_0x1d567a(0x197):'';console['error'](_0x1d567a(0x142)),console['error']('\x20\x20'+a17_0x541acc[_0x1d567a(0x1c4)](_0x1c030d+'\x20journeys')+a17_0x541acc[_0x1d567a(0x1b0)](_0x443eff)),console[_0x1d567a(0x172)]('\x20\x20'+a17_0x541acc['green']('+\x20'+_0x8074b4[_0x1d567a(0x14a)]+_0x1d567a(0x1cb))),console['error']('\x20\x20'+a17_0x541acc[_0x1d567a(0x1b4)]('~\x20'+_0x472a19[_0x1d567a(0x14a)]+_0x1d567a(0x1e1))),console[_0x1d567a(0x172)]('\x20\x20'+a17_0x541acc[_0x1d567a(0x1b0)]('=\x20'+_0x275253[_0x1d567a(0x14a)]+_0x1d567a(0x14f))),console[_0x1d567a(0x172)](_0x1d567a(0x20d)+a17_0x541acc[_0x1d567a(0x1c4)](_0x35fd18)+'\x0a');if(_0x472a19[_0x1d567a(0x14a)]>0x0)for(const _0x4b36f6 of _0x472a19){console[_0x1d567a(0x172)](_0x1d567a(0x1a2)+_0x4b36f6[_0x1d567a(0x154)]+'\x27:'),console[_0x1d567a(0x172)]('─'[_0x1d567a(0x1ff)](0x3c)),console[_0x1d567a(0x172)](_0x4b36f6[_0x1d567a(0x1c3)]),console[_0x1d567a(0x172)]('─'['repeat'](0x3c));}if(_0x3772d5['dryRun'])return console[_0x1d567a(0x172)](a17_0x541acc['yellow'](_0x1d567a(0x153))),0x0;if(_0x8074b4[_0x1d567a(0x14a)]===0x0&&_0x472a19[_0x1d567a(0x14a)]===0x0)return console[_0x1d567a(0x172)](a17_0x541acc[_0x1d567a(0x1fa)]('✔\x20All\x20files\x20are\x20up\x20to\x20date')),saveSessionContext({'parent_segment':_0x306526},_0x3772d5[_0x1d567a(0x1c9)]),console['error'](a17_0x541acc[_0x1d567a(0x1fa)](_0x1d567a(0x144)+a17_0x541acc[_0x1d567a(0x1b0)]('parent_segment')+_0x1d567a(0x17c)+a17_0x541acc['cyan'](_0x306526))),0x0;if(!_0x3772d5[_0x1d567a(0x15b)]&&(_0x8074b4[_0x1d567a(0x14a)]>0x0||_0x472a19[_0x1d567a(0x14a)]>0x0)){const _0x58842a=await confirmKey('Write\x20'+(_0x8074b4[_0x1d567a(0x14a)]+_0x472a19[_0x1d567a(0x14a)])+_0x1d567a(0x1e5));if(!_0x58842a)return console['error']('Aborted.'),0x1;}!existsSync(_0x35fd18)&&mkdirSync(_0x35fd18,{'recursive':!![]});for(const _0x323c24 of _0x1b943d){(_0x323c24[_0x1d567a(0x17d)]||_0x323c24[_0x1d567a(0x165)])&&writeFileSync(_0x323c24[_0x1d567a(0x1ed)],_0x323c24[_0x1d567a(0x1b6)],'utf-8');}return console['error'](a17_0x541acc[_0x1d567a(0x1fa)](_0x1d567a(0x1d5)+(_0x8074b4[_0x1d567a(0x14a)]+_0x472a19[_0x1d567a(0x14a)])+_0x1d567a(0x1de)+_0x35fd18)),saveSessionContext({'parent_segment':_0x306526},_0x3772d5[_0x1d567a(0x1c9)]),console[_0x1d567a(0x172)](a17_0x541acc[_0x1d567a(0x1fa)](_0x1d567a(0x144)+a17_0x541acc[_0x1d567a(0x1b0)](_0x1d567a(0x19e))+_0x1d567a(0x17c)+a17_0x541acc['cyan'](_0x306526))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a17_0x4801a5(0x13b)]='journey:push';[a17_0x4801a5(0x20a)]=a17_0x4801a5(0x1e3);[a17_0x4801a5(0x1ac)]=new SegmentPushCommand();async[a17_0x4801a5(0x186)](_0x23dece){const _0x20ade0=a17_0x4801a5,_0x26abba=_0x23dece[_0x20ade0(0x1f3)][0x0];let _0x5ce78a;if(_0x26abba){const _0x3c676f=await resolveTarget({'arg':_0x26abba,'contextParent':_0x23dece[_0x20ade0(0x190)]['parentSegment'],'cwd':process[_0x20ade0(0x1d2)]()});isSuccessfulResolution(_0x3c676f)&&_0x3c676f['type']===_0x20ade0(0x15f)&&(_0x5ce78a=_0x3c676f['filePath']);}const _0xdeab82={..._0x23dece,'options':{..._0x23dece[_0x20ade0(0x190)],'journeysOnly':!![],..._0x5ce78a&&{'singleFilePath':_0x5ce78a}}};return this['segmentPushCommand'][_0x20ade0(0x186)](_0xdeab82);}}
@@ -1 +1 @@
1
- const a18_0x47ea46=a18_0x3e3c;(function(_0x2d0dff,_0x14adbb){const _0x2f1f0d=a18_0x3e3c,_0xf051cc=_0x2d0dff();while(!![]){try{const _0x1ceb76=-parseInt(_0x2f1f0d(0x1ed))/0x1+-parseInt(_0x2f1f0d(0x1d5))/0x2+-parseInt(_0x2f1f0d(0x1ec))/0x3+parseInt(_0x2f1f0d(0x1e3))/0x4*(parseInt(_0x2f1f0d(0x1db))/0x5)+-parseInt(_0x2f1f0d(0x1f3))/0x6+parseInt(_0x2f1f0d(0x1d9))/0x7+parseInt(_0x2f1f0d(0x1f8))/0x8;if(_0x1ceb76===_0x14adbb)break;else _0xf051cc['push'](_0xf051cc['shift']());}catch(_0xa3e95e){_0xf051cc['push'](_0xf051cc['shift']());}}}(a18_0x2bea,0x3b69a));function a18_0x2bea(){const _0x30f8ff=['parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','\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','warningCount','\x20valid','\x20journey(s)\x20with\x20errors,\x20','\x20segment\x20file(s)\x20skipped','hasErrors','errorCode','warnings','122582TDtwyB','cwd','errors','targetDir','2757839ECGyct','length','15kUtukQ','\x20(skipped:\x20','\x20warning(s)\x20found','helpText','✔\x20All\x20','red','.yaml','green','618324bdyMMF','type','file','error','invalidCount','name','no_parent','verbose','log','368472atlVAQ','483064UtIBpW','.yml','cyan','Validation\x20failed:\x20','Validate\x20journey\x20YAML\x20files','endsWith','691494IVXrHb','valid','No\x20journey\x20YAML\x20files\x20found\x20in\x20','yellow','\x20warning(s)','1344496enJIdy','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','relativePath','filter','\x20segment\x20file(s)\x20skipped)','dim','skippedCount','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','\x20error(s)','filePath','journey:validate'];a18_0x2bea=function(){return _0x30f8ff;};return a18_0x2bea();}function a18_0x3e3c(_0x3fbdee,_0x3cfd61){_0x3fbdee=_0x3fbdee-0x1c7;const _0x2bea5a=a18_0x2bea();let _0x3e3c56=_0x2bea5a[_0x3fbdee];return _0x3e3c56;}import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a18_0x2e9b64 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{[a18_0x47ea46(0x1e8)]=a18_0x47ea46(0x1ca);['description']=a18_0x47ea46(0x1f1);async['execute'](_0x1ebd60){const _0xcbd7da=a18_0x47ea46,{options:_0x3e4d10,args:_0x23f4cd}=_0x1ebd60,_0x2e674a=_0x3e4d10,_0x2bcad7=await resolveTarget({'arg':_0x23f4cd[0x0],'contextParent':_0x3e4d10['parentSegment'],'cwd':process[_0xcbd7da(0x1d6)]()});if(!isSuccessfulResolution(_0x2bcad7))return _0x2bcad7[_0xcbd7da(0x1d3)]===_0xcbd7da(0x1e9)?(console[_0xcbd7da(0x1e6)](a18_0x2e9b64[_0xcbd7da(0x1f6)](_0xcbd7da(0x1cb))),console[_0xcbd7da(0x1e6)]('Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)'),console[_0xcbd7da(0x1e6)](_0xcbd7da(0x1cd)),console[_0xcbd7da(0x1e6)](_0xcbd7da(0x1c7))):(console['error'](a18_0x2e9b64['red']('Error:\x20'+_0x2bcad7['message']+'\x0a')),_0x2bcad7['helpText']&&console['error'](a18_0x2e9b64[_0xcbd7da(0x1ef)](_0x2bcad7[_0xcbd7da(0x1de)]))),0x1;const _0x3dc40d=_0x2bcad7[_0xcbd7da(0x1d8)],_0x92ed9a=_0x2bcad7[_0xcbd7da(0x1e4)]===_0xcbd7da(0x1e5)?_0x2bcad7[_0xcbd7da(0x1c9)]:undefined;if(!_0x92ed9a&&!existsSync(_0x3dc40d))return console[_0xcbd7da(0x1e6)](a18_0x2e9b64[_0xcbd7da(0x1e0)]('Error:\x20Directory\x20not\x20found:\x20'+_0x3dc40d+'\x0a')),0x1;let _0x4e4922;if(_0x92ed9a){if(!_0x92ed9a[_0xcbd7da(0x1f2)](_0xcbd7da(0x1ee))&&!_0x92ed9a['endsWith'](_0xcbd7da(0x1e1)))return console['error'](a18_0x2e9b64[_0xcbd7da(0x1e0)](_0xcbd7da(0x1cc)+_0x92ed9a+'\x0a')),0x1;_0x4e4922=[_0x92ed9a];}else _0x4e4922=findYamlFiles(_0x3dc40d);if(_0x4e4922[_0xcbd7da(0x1da)]===0x0)return console['error'](a18_0x2e9b64[_0xcbd7da(0x1e0)](_0xcbd7da(0x1f9)+_0x3dc40d+'\x0a')),0x1;const _0x480a9b=validateYamlFiles(_0x4e4922,_0x3dc40d,{'filterType':'journey'}),_0x1e4be1=calculateSummary(_0x480a9b),_0x392416=_0x480a9b[_0xcbd7da(0x1fb)](isValidationResult);if(_0x392416[_0xcbd7da(0x1da)]===0x0)return console['error'](a18_0x2e9b64[_0xcbd7da(0x1f6)](_0xcbd7da(0x1f5)+_0x3dc40d+'\x0a')),_0x1e4be1['skippedCount']>0x0&&console['error'](a18_0x2e9b64[_0xcbd7da(0x1fd)]('('+_0x1e4be1[_0xcbd7da(0x1fe)]+_0xcbd7da(0x1fc))),0x0;for(const _0x451c13 of _0x480a9b){if(!isValidationResult(_0x451c13)){_0x2e674a[_0xcbd7da(0x1ea)]&&console[_0xcbd7da(0x1eb)](a18_0x2e9b64[_0xcbd7da(0x1fd)]('-\x20'+_0x451c13[_0xcbd7da(0x1fa)]+_0xcbd7da(0x1dc)+_0x451c13['reason']+')'));continue;}const {relativePath:_0x12ce6b,source:_0x46d61c,result:_0x17db93}=_0x451c13;if(_0x17db93[_0xcbd7da(0x1f4)]&&_0x17db93[_0xcbd7da(0x1d4)][_0xcbd7da(0x1da)]===0x0)_0x2e674a[_0xcbd7da(0x1ea)]&&console[_0xcbd7da(0x1eb)](a18_0x2e9b64[_0xcbd7da(0x1e2)]('✔\x20'+_0x12ce6b));else _0x17db93[_0xcbd7da(0x1f4)]?(console[_0xcbd7da(0x1eb)](a18_0x2e9b64[_0xcbd7da(0x1f6)]('⚠\x20'+_0x12ce6b+':\x20'+_0x17db93[_0xcbd7da(0x1d4)]['length']+_0xcbd7da(0x1f7))),console[_0xcbd7da(0x1eb)](formatValidationResult(_0x17db93,_0x46d61c,_0x12ce6b))):(console[_0xcbd7da(0x1eb)](a18_0x2e9b64[_0xcbd7da(0x1e0)]('✖\x20'+_0x12ce6b+':\x20'+_0x17db93[_0xcbd7da(0x1d7)]['length']+_0xcbd7da(0x1c8))),console['log'](formatValidationResult(_0x17db93,_0x46d61c,_0x12ce6b)));}return console[_0xcbd7da(0x1eb)](''),_0x1e4be1[_0xcbd7da(0x1d2)]?(console[_0xcbd7da(0x1eb)](a18_0x2e9b64[_0xcbd7da(0x1e0)](_0xcbd7da(0x1f0)+_0x1e4be1[_0xcbd7da(0x1e7)]+_0xcbd7da(0x1d0)+_0x1e4be1['validCount']+_0xcbd7da(0x1cf))),_0x1e4be1[_0xcbd7da(0x1ce)]>0x0&&console['log'](a18_0x2e9b64[_0xcbd7da(0x1f6)](_0x1e4be1['warningCount']+_0xcbd7da(0x1dd))),_0x1e4be1[_0xcbd7da(0x1fe)]>0x0&&console[_0xcbd7da(0x1eb)](a18_0x2e9b64[_0xcbd7da(0x1fd)](_0x1e4be1[_0xcbd7da(0x1fe)]+_0xcbd7da(0x1d1))),0x1):(console[_0xcbd7da(0x1eb)](a18_0x2e9b64[_0xcbd7da(0x1e2)](_0xcbd7da(0x1df)+_0x1e4be1['validCount']+'\x20journey(s)\x20valid')),_0x1e4be1[_0xcbd7da(0x1ce)]>0x0&&console[_0xcbd7da(0x1eb)](a18_0x2e9b64[_0xcbd7da(0x1f6)](_0x1e4be1[_0xcbd7da(0x1ce)]+_0xcbd7da(0x1dd))),_0x1e4be1[_0xcbd7da(0x1fe)]>0x0&&console['log'](a18_0x2e9b64['dim'](_0x1e4be1[_0xcbd7da(0x1fe)]+_0xcbd7da(0x1d1))),0x0);}}
1
+ const a18_0x33c7ee=a18_0x5c3f;(function(_0x1b6baf,_0x1a6eae){const _0x4e636b=a18_0x5c3f,_0x5887e1=_0x1b6baf();while(!![]){try{const _0x5860dd=parseInt(_0x4e636b(0x212))/0x1*(parseInt(_0x4e636b(0x216))/0x2)+-parseInt(_0x4e636b(0x21f))/0x3*(parseInt(_0x4e636b(0x1fe))/0x4)+-parseInt(_0x4e636b(0x1f7))/0x5*(-parseInt(_0x4e636b(0x21b))/0x6)+parseInt(_0x4e636b(0x213))/0x7+-parseInt(_0x4e636b(0x1f0))/0x8*(parseInt(_0x4e636b(0x204))/0x9)+parseInt(_0x4e636b(0x220))/0xa+-parseInt(_0x4e636b(0x202))/0xb;if(_0x5860dd===_0x1a6eae)break;else _0x5887e1['push'](_0x5887e1['shift']());}catch(_0x963982){_0x5887e1['push'](_0x5887e1['shift']());}}}(a18_0x4fac,0xeffef));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';import{existsSync}from'fs';import a18_0x2f002f from'chalk';import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';function a18_0x4fac(){const _0x2d1490=['name','skippedCount','helpText','filter','8059QsacMW','221802hWwalD','error','Validation\x20failed:\x20','158MBSXug','description','warningCount','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','hasErrors','11526kwoLOn','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','\x20segment\x20file(s)\x20skipped)','yellow','19371hqggqy','13891490zEgwhY','dim','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','log','warnings','length','targetDir','72PePFWC','Validate\x20journey\x20YAML\x20files','errorCode','reason','message','\x20warning(s)','verbose','1570ZMOYSS','type','cyan','valid','\x20journey(s)\x20with\x20errors,\x20','green','\x20(skipped:\x20','500zmtDgW','endsWith','errors','\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','5699419nretfx','\x20segment\x20file(s)\x20skipped','352413tCmzPF','Error:\x20Directory\x20not\x20found:\x20','Error:\x20No\x20YAML\x20files\x20found\x20in\x20','✔\x20All\x20','red','no_parent','relativePath','\x20error(s)','validCount','\x20journey(s)\x20valid'];a18_0x4fac=function(){return _0x2d1490;};return a18_0x4fac();}function a18_0x5c3f(_0x4f8e89,_0x22d5d0){_0x4f8e89=_0x4f8e89-0x1ec;const _0x4fac99=a18_0x4fac();let _0x5c3f76=_0x4fac99[_0x4f8e89];return _0x5c3f76;}export class JourneyValidateCommand extends BaseCommand{[a18_0x33c7ee(0x20e)]='journey:validate';[a18_0x33c7ee(0x217)]=a18_0x33c7ee(0x1f1);async['execute'](_0x3eff71){const _0x183675=a18_0x33c7ee,{options:_0x256e95,args:_0xd4ff83}=_0x3eff71,_0x210b89=_0x256e95,_0x2ee3e0=await resolveTarget({'arg':_0xd4ff83[0x0],'contextParent':_0x256e95['parentSegment'],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x2ee3e0))return _0x2ee3e0[_0x183675(0x1f2)]===_0x183675(0x209)?(console[_0x183675(0x214)](a18_0x2f002f[_0x183675(0x21e)](_0x183675(0x219))),console[_0x183675(0x214)](_0x183675(0x21c)),console[_0x183675(0x214)](_0x183675(0x201)),console[_0x183675(0x214)](_0x183675(0x222))):(console[_0x183675(0x214)](a18_0x2f002f[_0x183675(0x208)]('Error:\x20'+_0x2ee3e0[_0x183675(0x1f4)]+'\x0a')),_0x2ee3e0[_0x183675(0x210)]&&console[_0x183675(0x214)](a18_0x2f002f[_0x183675(0x1f9)](_0x2ee3e0[_0x183675(0x210)]))),0x1;const _0x568173=_0x2ee3e0[_0x183675(0x1ef)],_0x2b5631=_0x2ee3e0[_0x183675(0x1f8)]==='file'?_0x2ee3e0['filePath']:undefined;if(!_0x2b5631&&!existsSync(_0x568173))return console['error'](a18_0x2f002f[_0x183675(0x208)](_0x183675(0x205)+_0x568173+'\x0a')),0x1;let _0x1d005b;if(_0x2b5631){if(!_0x2b5631[_0x183675(0x1ff)]('.yml')&&!_0x2b5631[_0x183675(0x1ff)]('.yaml'))return console[_0x183675(0x214)](a18_0x2f002f[_0x183675(0x208)]('Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20'+_0x2b5631+'\x0a')),0x1;_0x1d005b=[_0x2b5631];}else _0x1d005b=findYamlFiles(_0x568173);if(_0x1d005b['length']===0x0)return console[_0x183675(0x214)](a18_0x2f002f[_0x183675(0x208)](_0x183675(0x206)+_0x568173+'\x0a')),0x1;const _0x25d5c0=validateYamlFiles(_0x1d005b,_0x568173,{'filterType':'journey'}),_0x5054d7=calculateSummary(_0x25d5c0),_0x46a87a=_0x25d5c0[_0x183675(0x211)](isValidationResult);if(_0x46a87a[_0x183675(0x1ee)]===0x0)return console[_0x183675(0x214)](a18_0x2f002f[_0x183675(0x21e)]('No\x20journey\x20YAML\x20files\x20found\x20in\x20'+_0x568173+'\x0a')),_0x5054d7[_0x183675(0x20f)]>0x0&&console[_0x183675(0x214)](a18_0x2f002f[_0x183675(0x221)]('('+_0x5054d7[_0x183675(0x20f)]+_0x183675(0x21d))),0x0;for(const _0x5a2f2b of _0x25d5c0){if(!isValidationResult(_0x5a2f2b)){_0x210b89[_0x183675(0x1f6)]&&console[_0x183675(0x1ec)](a18_0x2f002f[_0x183675(0x221)]('-\x20'+_0x5a2f2b[_0x183675(0x20a)]+_0x183675(0x1fd)+_0x5a2f2b[_0x183675(0x1f3)]+')'));continue;}const {relativePath:_0x1f97ee,source:_0x358d20,result:_0x1495d2}=_0x5a2f2b;if(_0x1495d2[_0x183675(0x1fa)]&&_0x1495d2[_0x183675(0x1ed)][_0x183675(0x1ee)]===0x0)_0x210b89[_0x183675(0x1f6)]&&console[_0x183675(0x1ec)](a18_0x2f002f['green']('✔\x20'+_0x1f97ee));else _0x1495d2[_0x183675(0x1fa)]?(console[_0x183675(0x1ec)](a18_0x2f002f[_0x183675(0x21e)]('⚠\x20'+_0x1f97ee+':\x20'+_0x1495d2[_0x183675(0x1ed)]['length']+_0x183675(0x1f5))),console['log'](formatValidationResult(_0x1495d2,_0x358d20,_0x1f97ee))):(console[_0x183675(0x1ec)](a18_0x2f002f['red']('✖\x20'+_0x1f97ee+':\x20'+_0x1495d2[_0x183675(0x200)][_0x183675(0x1ee)]+_0x183675(0x20b))),console[_0x183675(0x1ec)](formatValidationResult(_0x1495d2,_0x358d20,_0x1f97ee)));}return console[_0x183675(0x1ec)](''),_0x5054d7[_0x183675(0x21a)]?(console['log'](a18_0x2f002f[_0x183675(0x208)](_0x183675(0x215)+_0x5054d7['invalidCount']+_0x183675(0x1fb)+_0x5054d7[_0x183675(0x20c)]+'\x20valid')),_0x5054d7[_0x183675(0x218)]>0x0&&console[_0x183675(0x1ec)](a18_0x2f002f['yellow'](_0x5054d7[_0x183675(0x218)]+'\x20warning(s)\x20found')),_0x5054d7[_0x183675(0x20f)]>0x0&&console[_0x183675(0x1ec)](a18_0x2f002f[_0x183675(0x221)](_0x5054d7[_0x183675(0x20f)]+'\x20segment\x20file(s)\x20skipped')),0x1):(console[_0x183675(0x1ec)](a18_0x2f002f[_0x183675(0x1fc)](_0x183675(0x207)+_0x5054d7[_0x183675(0x20c)]+_0x183675(0x20d))),_0x5054d7[_0x183675(0x218)]>0x0&&console[_0x183675(0x1ec)](a18_0x2f002f['yellow'](_0x5054d7[_0x183675(0x218)]+'\x20warning(s)\x20found')),_0x5054d7['skippedCount']>0x0&&console[_0x183675(0x1ec)](a18_0x2f002f['dim'](_0x5054d7['skippedCount']+_0x183675(0x203))),0x0);}}
@@ -1 +1 @@
1
- const a19_0x373325=a19_0x3b47;(function(_0x56799c,_0x192e9c){const _0x51d2c7=a19_0x3b47,_0x5bfdad=_0x56799c();while(!![]){try{const _0x47d9f0=-parseInt(_0x51d2c7(0x1d8))/0x1*(parseInt(_0x51d2c7(0x1c5))/0x2)+-parseInt(_0x51d2c7(0x1f0))/0x3+-parseInt(_0x51d2c7(0x1a6))/0x4+-parseInt(_0x51d2c7(0x1ee))/0x5*(parseInt(_0x51d2c7(0x1db))/0x6)+-parseInt(_0x51d2c7(0x188))/0x7+-parseInt(_0x51d2c7(0x1e3))/0x8+parseInt(_0x51d2c7(0x1f8))/0x9;if(_0x47d9f0===_0x192e9c)break;else _0x5bfdad['push'](_0x5bfdad['shift']());}catch(_0x5a70d9){_0x5bfdad['push'](_0x5bfdad['shift']());}}}(a19_0x5081,0x61e96));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../core/command-output.js';function a19_0x3b47(_0x399742,_0xec46dd){_0x399742=_0x399742-0x14d;const _0x5081da=a19_0x5081();let _0x3b4742=_0x5081da[_0x399742];return _0x3b4742;}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';function a19_0x5081(){const _0x48592d=['length','models','(no\x20message)','starterMessage','Restore\x20cancelled.','substring','[unknown]','systemPrompt','projects','short','\x20-\x20','includes','resolveAgentId','\x20->\x20Agent:','name','attributes','maxToolIterations','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','List\x20agents\x20in\x20current\x20project','entries','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','tsv','counts','yellow','\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','join','setCurrentProject','Error:\x20Backup\x20folder\x20path\x20is\x20required','Resolving\x20project\x20\x27','Create\x20a\x20new\x20agent\x20in\x20current\x20project','[error]\x20\x20','projectName','last','outputDir','llm','Project\x20deleted:\x20','\x20→\x20chat:\x20','data','Invalid\x20path\x20syntax:\x20','Fetching\x20projects...','llm:project:restore','INVALID_ARGUMENT','error','Project\x20created:\x20','prompt','slice','[input]\x20\x20','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.','Use\x20format:\x20project-name/agent-name','llm:projects','output','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','deleteAgent','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','split','llm:agents','[tool_call]','getBackupMetadata','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','find','yes','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','No\x20messages\x20found\x20in\x20chat\x20history.','history','Fetching\x20available\x20models...','llm:agent:update','3254923cdVtqU','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','Creating\x20agent\x20\x27','verbose','limit','Backup\x20cancelled.','json','dryRun','toLocaleDateString','\x20--last','prompts','existsSync','llm:use','site','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','Creating\x20project\x20\x27','deleteProject','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.','llm:agent:create','\x20\x20Prompts:\x20','h\x20ago','llm:project:delete','Project\x20restored:\x20','getOrCreateDefaultProject','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]','\x20\x20Integrations:\x20','toLowerCase','targetKnowledgeBase','(no\x20agent)','execute','1670972tyQpYy','jsonl','.llm','\x0aCancelled','Backing\x20up\x20project\x20\x27','map','input','No\x20projects\x20found','sort','List\x20all\x20LLM\x20projects','content','Agent\x20deleted:\x20','chats','\x27\x20already\x20exists.\x20Overwrite?','Fetching\x20agent...','\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.','Project\x20context\x20set\x20to:\x20','Validating\x20backup\x20from\x20\x27','set','Agent\x20updated:\x20','Resolving\x20agent\x20\x27','model','stringify','localeCompare','llm:agent:delete','Deleting\x20project\x20\x27','targetImageGenerator','claude-4.5-haiku','Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions','description','just\x20now','146YzHdsR','updatedAt','\x20\x20Knowledge\x20Bases:\x20','Load\x20more...','...','\x0aStack\x20trace:','Fetching\x20agents...','Analyzing\x20project\x20\x27','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','integrations','Fetching\x20chat\x20sessions...','Getting\x20default\x20project...','cause','targetAgent','Checking\x20for\x20existing\x20projects...','push','string','en-US','Deleting\x20agent...','653bqLxxS','tdx\x20chats','firstInputContent','4148022NswUzw','rmSync','Project\x20backed\x20up\x20to:\x20','LLM_PROJECT_NOT_FOUND','knowledgeBases','filter','No\x20agents\x20found','Show\x20agent\x20details','5061888jjDFdt','stack','List\x20available\x20LLM\x20models','format','resolveProjectId','createAgent','Unknown','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','getCurrentProject','log','bold','5BQLJky','llm:models','2291439hoVYOu','sourceSite','select','tool_call','chatId','dim','blue','Error:\x20Agent\x20name\x20is\x20required','30773997JcIDed','agentId','agents','A\x20project\x20named\x20\x27','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','\x20project(s)','\x20bytes)','Fetching\x20chat\x20history\x20for\x20\x27','Set\x20current\x20project\x20context','[content]','Delete\x20an\x20agent','createdAt','Delete\x20an\x20LLM\x20project','tool','cyan','table','\x27...','updateAgent','getTime','agent','Error:\x20Project\x20name\x20is\x20required','Create\x20a\x20new\x20LLM\x20project','\x20agent(s)','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','Restoring\x20project\x20from\x20\x27','targetWebSearchTool','restoreProject','Fetching\x20most\x20recent\x20chat...','createProject','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','__load_more__','Update\x20an\x20existing\x20agent','image','numeric','message','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)','temperature','Usage:\x20','floor'];a19_0x5081=function(){return _0x48592d;};return a19_0x5081();}import{hyperlink}from'../sdk/util/formatters.js';import*as a19_0x1e2fc2 from'node:fs';function handleSDKError(_0x1d1b92,_0x139c44){const _0x3d198e=a19_0x3b47;if(_0x1d1b92 instanceof SDKError)console[_0x3d198e(0x16e)]('Error:\x20'+_0x1d1b92[_0x3d198e(0x21a)]),_0x139c44[_0x3d198e(0x18b)]&&(_0x1d1b92[_0x3d198e(0x1d1)]&&console[_0x3d198e(0x16e)]('\x20\x20Cause:\x20'+_0x1d1b92[_0x3d198e(0x1d1)]),_0x1d1b92[_0x3d198e(0x1e4)]&&(console[_0x3d198e(0x16e)](_0x3d198e(0x1ca)),console[_0x3d198e(0x16e)](_0x1d1b92[_0x3d198e(0x1e4)])));else throw _0x1d1b92;}function formatChatHistoryEntry(_0x2e5108,_0x41d935){const _0x47e1ea=a19_0x3b47,_0x4feade=getChalk(_0x41d935),_0x42bdb6=_0x4feade[_0x47e1ea(0x1f5)](_0x2e5108['at']);if(_0x47e1ea(0x1ac)in _0x2e5108){const _0xab882e=_0x4feade[_0x47e1ea(0x206)](_0x47e1ea(0x172));return _0x42bdb6+'\x20'+_0xab882e+':\x20'+_0x2e5108[_0x47e1ea(0x1ac)];}if(_0x47e1ea(0x1b0)in _0x2e5108){const _0x1a4b53=_0x4feade['green'](_0x47e1ea(0x201));return _0x42bdb6+'\x20'+_0x1a4b53+':\x20'+_0x2e5108['content'];}if(_0x47e1ea(0x1f3)in _0x2e5108){const _0x49c28b=_0x4feade[_0x47e1ea(0x15a)](_0x47e1ea(0x17c)),{functionName:_0x298051,functionArguments:_0xeb5461,targetFunction:_0x46bc71}=_0x2e5108[_0x47e1ea(0x1f3)];let _0x60c778=_0x42bdb6+'\x20'+_0x49c28b+':\x20'+_0x4feade[_0x47e1ea(0x1ed)](_0x298051);if(_0xeb5461&&Object['keys'](_0xeb5461)[_0x47e1ea(0x21f)]>0x0){const _0x14bf87=Object[_0x47e1ea(0x155)](_0xeb5461)['map'](([_0x1b0017,_0xcfe2df])=>_0x1b0017+'='+JSON[_0x47e1ea(0x1bc)](_0xcfe2df))[_0x47e1ea(0x15d)](',\x20');_0x60c778+='('+_0x14bf87+')';}_0x46bc71&&(_0x60c778+=_0x4feade[_0x47e1ea(0x1f5)]('\x20['+_0x46bc71+']'));let _0x5a381d='';if(_0x2e5108[_0x47e1ea(0x1f3)][_0x47e1ea(0x1a3)])_0x5a381d='\x20->\x20KB:'+_0x2e5108['tool_call'][_0x47e1ea(0x1a3)][_0x47e1ea(0x150)];else{if(_0x2e5108[_0x47e1ea(0x1f3)]['targetAgent'])_0x5a381d=_0x47e1ea(0x14f)+_0x2e5108[_0x47e1ea(0x1f3)][_0x47e1ea(0x1d2)][_0x47e1ea(0x150)];else{if(_0x2e5108['tool_call'][_0x47e1ea(0x211)])_0x5a381d='\x20->\x20WebSearch:'+_0x2e5108[_0x47e1ea(0x1f3)][_0x47e1ea(0x211)][_0x47e1ea(0x150)];else _0x2e5108['tool_call'][_0x47e1ea(0x1c0)]&&(_0x5a381d='\x20->\x20ImageGen:'+_0x2e5108[_0x47e1ea(0x1f3)]['targetImageGenerator'][_0x47e1ea(0x150)]);}}return _0x60c778+_0x5a381d;}if(_0x47e1ea(0x205)in _0x2e5108){const _0x31469b=_0x4feade['magenta']('[tool]\x20\x20\x20'),{functionName:_0x3fb42c,functionArguments:_0x307c25,content:_0x10085d,newChat:_0x195206}=_0x2e5108[_0x47e1ea(0x205)];let _0x2747d6=_0x42bdb6+'\x20'+_0x31469b+':\x20'+_0x4feade[_0x47e1ea(0x1ed)](_0x3fb42c);if(_0x307c25){const _0x3e4f4e=typeof _0x307c25===_0x47e1ea(0x1d5)?_0x307c25:JSON['stringify'](_0x307c25);_0x2747d6+='('+_0x3e4f4e+')';}return _0x10085d&&(_0x2747d6+='\x0a'+_0x4feade[_0x47e1ea(0x1f5)](_0x10085d)),_0x195206&&(_0x2747d6+=_0x4feade[_0x47e1ea(0x1f5)](_0x47e1ea(0x168)+_0x195206['id'])),_0x2747d6;}if('output'in _0x2e5108){const _0x121b33=_0x4feade['blue']('[output]\x20');return _0x42bdb6+'\x20'+_0x121b33+':\x20'+_0x2e5108[_0x47e1ea(0x176)]['name']+'\x20('+_0x2e5108[_0x47e1ea(0x176)][_0x47e1ea(0x1b0)][_0x47e1ea(0x21f)]+_0x47e1ea(0x1fe);}if(_0x47e1ea(0x218)in _0x2e5108){const _0x4d20ae=_0x4feade[_0x47e1ea(0x1f6)]('[image]\x20\x20'),{width:_0x16bbfd,height:_0x1997eb,headerText:_0x3178d4}=_0x2e5108[_0x47e1ea(0x218)],_0x337dca=_0x3178d4?_0x47e1ea(0x229)+_0x3178d4:'';return _0x42bdb6+'\x20'+_0x4d20ae+':\x20'+_0x16bbfd+'x'+_0x1997eb+_0x337dca;}if(_0x47e1ea(0x16e)in _0x2e5108){const _0x14cd89=_0x4feade['red'](_0x47e1ea(0x162));return _0x42bdb6+'\x20'+_0x14cd89+':\x20'+_0x2e5108['error'];}return _0x42bdb6+'\x20'+_0x4feade[_0x47e1ea(0x1f5)](_0x47e1ea(0x225))+':\x20'+JSON[_0x47e1ea(0x1bc)](_0x2e5108);}async function executeChatHistoryCommand(_0x4d93b0,_0x38c620){const _0x24fb94=a19_0x3b47,{options:_0x232cf0,args:_0x36536e,tdx:_0x14dbeb}=_0x4d93b0,_0x3a0fc1=_0x36536e[0x0],_0x2328cf=_0x232cf0,_0x30a504=_0x2328cf[_0x24fb94(0x164)];try{if(_0x30a504&&_0x3a0fc1)return console[_0x24fb94(0x16e)]('Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument'),console[_0x24fb94(0x16e)](_0x24fb94(0x21d)+_0x38c620+_0x24fb94(0x191)),0x1;if(!_0x3a0fc1&&!_0x30a504&&_0x232cf0[_0x24fb94(0x1e6)]!==undefined){const _0x46c2ef=resolveLimit(_0x232cf0[_0x24fb94(0x18c)],DEFAULT_LLM_LIMIT),_0x10f4c9=await withSpinner(_0x24fb94(0x1cf),()=>_0x14dbeb[_0x24fb94(0x166)][_0x24fb94(0x1b2)](_0x46c2ef),{'verbose':_0x232cf0['verbose']});return await handleSDKOutput(_0x10f4c9[_0x24fb94(0x169)],_0x232cf0),0x0;}const _0x50b146=await getChatIdOrSelect(_0x14dbeb,_0x232cf0,_0x30a504,_0x3a0fc1);if(!_0x50b146)return 0x0;return await displayChatHistory(_0x50b146,_0x14dbeb,_0x232cf0),0x0;}catch(_0x16fecd){return handleSDKError(_0x16fecd,_0x232cf0),0x1;}}async function displayChatHistory(_0x36d7f8,_0x599f02,_0x4df87a){const _0xdeb73e=a19_0x3b47,_0x1c6d9b=await withSpinner(_0xdeb73e(0x1ff)+_0x36d7f8+_0xdeb73e(0x208),()=>_0x599f02['llm'][_0xdeb73e(0x185)](_0x36d7f8),{'verbose':_0x4df87a[_0xdeb73e(0x18b)]}),_0x3dc53b=_0x1c6d9b[_0xdeb73e(0x169)][_0xdeb73e(0x169)]??[];if(_0x3dc53b[_0xdeb73e(0x21f)]===0x0){console[_0xdeb73e(0x1ec)](_0xdeb73e(0x184));return;}if(_0x4df87a[_0xdeb73e(0x1e6)]!==undefined)await handleSDKOutput(_0x3dc53b,_0x4df87a);else{const _0x46419e=_0x3dc53b[_0xdeb73e(0x1ab)](_0x42b91a=>formatChatHistoryEntry(_0x42b91a,_0x4df87a)),_0x1bf104=_0x46419e['join']('\x0a');await writeOutput(_0x1bf104,_0x4df87a[_0xdeb73e(0x176)],'table');}}async function getChatIdOrSelect(_0x9deb62,_0x4a8948,_0x58e2f7,_0x57bebc){const _0x343163=a19_0x3b47;if(_0x57bebc)return _0x57bebc;if(_0x58e2f7){const _0x57baba=await withSpinner(_0x343163(0x213),()=>_0x9deb62['llm'][_0x343163(0x1b2)](0x1),{'verbose':_0x4a8948[_0x343163(0x18b)]});if(_0x57baba[_0x343163(0x169)][_0x343163(0x21f)]===0x0)return console[_0x343163(0x1ec)]('No\x20chat\x20sessions\x20found.'),undefined;return _0x57baba[_0x343163(0x169)][0x0]['id'];}const _0x53f90a=await selectChatInteractively(_0x9deb62,_0x4a8948);if(!_0x53f90a)return console[_0x343163(0x1ec)](_0x343163(0x1a9)),undefined;return _0x53f90a;}async function getProjectIdOrDefault(_0x28c9d1){const _0x22f14f=await getProjectWithName(_0x28c9d1);return _0x22f14f['id'];}async function getProjectWithName(_0x5a09a1){const _0x5eb448=a19_0x3b47,{tdx:_0x45e01c,options:_0x16b210}=_0x5a09a1,_0x22b3eb=_0x16b210['llmProject'];if(_0x22b3eb){const _0x59f466=await withSpinner('Resolving\x20project\x20\x27'+_0x22b3eb+_0x5eb448(0x208),()=>_0x45e01c[_0x5eb448(0x166)][_0x5eb448(0x1e7)](_0x22b3eb),{'verbose':_0x16b210[_0x5eb448(0x18b)]});return{'id':_0x59f466['data'],'name':_0x22b3eb};}const _0x1a1a5a=_0x45e01c[_0x5eb448(0x166)][_0x5eb448(0x1eb)]();if(_0x1a1a5a){const _0x5dc644=await _0x45e01c[_0x5eb448(0x166)][_0x5eb448(0x227)](),_0x526315=_0x5dc644[_0x5eb448(0x17f)](_0x2b30b7=>_0x2b30b7['id']===_0x1a1a5a);return{'id':_0x1a1a5a,'name':_0x526315?.[_0x5eb448(0x151)][_0x5eb448(0x150)]||_0x5eb448(0x1e9)};}const _0x97d3c9=await withSpinner(_0x5eb448(0x1d0),()=>_0x45e01c['llm'][_0x5eb448(0x19f)](),{'verbose':_0x16b210['verbose']});return{'id':_0x97d3c9[_0x5eb448(0x169)]['id'],'name':_0x97d3c9['data'][_0x5eb448(0x151)][_0x5eb448(0x150)]};}function toLLMProjectInfo(_0x49a02c){const _0x2e66ce=a19_0x3b47;return{'name':_0x49a02c[_0x2e66ce(0x151)]['name'],'description':_0x49a02c[_0x2e66ce(0x151)][_0x2e66ce(0x1c3)],'createdAt':_0x49a02c[_0x2e66ce(0x151)][_0x2e66ce(0x203)],'updatedAt':_0x49a02c[_0x2e66ce(0x151)]['updatedAt']};}function toAgentInfo(_0x25207b){const _0x314f84=a19_0x3b47;return{'name':_0x25207b['attributes'][_0x314f84(0x150)],'description':_0x25207b[_0x314f84(0x151)][_0x314f84(0x1c3)],'prompt':truncatePrompt(_0x25207b[_0x314f84(0x151)]['prompt']),'createdAt':_0x25207b[_0x314f84(0x151)]['createdAt'],'updatedAt':_0x25207b[_0x314f84(0x151)][_0x314f84(0x1c6)]};}function truncatePrompt(_0x2c28f7){const _0x10a8b1=a19_0x3b47;if(!_0x2c28f7)return undefined;const _0x4ee5e8=0x64;if(_0x2c28f7['length']<=_0x4ee5e8)return _0x2c28f7;return _0x2c28f7[_0x10a8b1(0x171)](0x0,_0x4ee5e8)+_0x10a8b1(0x1c9);}export class LLMModelsCommand extends BaseCommand{[a19_0x373325(0x150)]=a19_0x373325(0x1ef);[a19_0x373325(0x1c3)]=a19_0x373325(0x1e5);async[a19_0x373325(0x1a5)](_0x1a5f26){const _0x4b2401=a19_0x373325,{options:_0x684dfc,tdx:_0xe08e2a}=_0x1a5f26;try{const _0x5719cc=await withSpinner(_0x4b2401(0x186),()=>_0xe08e2a[_0x4b2401(0x166)][_0x4b2401(0x220)](),{'verbose':_0x684dfc[_0x4b2401(0x18b)]});return await handleSDKOutput(_0x5719cc[_0x4b2401(0x169)],_0x684dfc),0x0;}catch(_0x5a3842){return handleSDKError(_0x5a3842,_0x684dfc),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a19_0x373325(0x150)]=a19_0x373325(0x175);[a19_0x373325(0x1c3)]=a19_0x373325(0x1af);async[a19_0x373325(0x1a5)](_0x5a5586){const _0x9faeb0=a19_0x373325,{options:_0x354a63,args:_0x4de290,tdx:_0x554bc0}=_0x5a5586,_0x51908c=getChalk(_0x354a63),_0x244d49=_0x354a63[_0x9faeb0(0x195)];try{const _0x2067f6=_0x4de290[0x0],_0x2bf0ed=resolveLimit(_0x354a63['limit'],DEFAULT_LLM_LIMIT),_0xca79a0=await withSpinner(_0x9faeb0(0x16b),()=>_0x554bc0['llm'][_0x9faeb0(0x227)](_0x2bf0ed),{'verbose':_0x354a63[_0x9faeb0(0x18b)]});let _0x45b7b5=_0xca79a0[_0x9faeb0(0x169)];_0x2067f6&&(_0x45b7b5=_0xca79a0[_0x9faeb0(0x169)][_0x9faeb0(0x1e0)](_0x5270df=>matchGlobPattern(_0x5270df[_0x9faeb0(0x151)][_0x9faeb0(0x150)],_0x2067f6)));const _0x106105=_0x354a63['format']===_0x9faeb0(0x18e)||_0x354a63[_0x9faeb0(0x1e6)]==='jsonl'||_0x354a63[_0x9faeb0(0x1e6)]===_0x9faeb0(0x207)||_0x354a63['format']===_0x9faeb0(0x158);if(_0x106105){const _0x295567=_0x45b7b5[_0x9faeb0(0x1ab)](_0x13d074=>({...toLLMProjectInfo(_0x13d074),'url':getLLMProjectUrl(_0x244d49,_0x13d074['id'])}));await handleSDKOutput(_0x295567,_0x354a63);}else{const _0x2a1dcc=[];if(_0x45b7b5[_0x9faeb0(0x21f)]===0x0)_0x2a1dcc[_0x9faeb0(0x1d4)](_0x51908c[_0x9faeb0(0x1f5)](_0x9faeb0(0x1ad)));else{const _0x5496ff=[..._0x45b7b5][_0x9faeb0(0x1ae)]((_0x51477a,_0x31cb19)=>_0x51477a[_0x9faeb0(0x151)]['name'][_0x9faeb0(0x1bd)](_0x31cb19['attributes'][_0x9faeb0(0x150)]));for(const _0x274364 of _0x5496ff){const _0x9f42a8=getLLMProjectUrl(_0x244d49,_0x274364['id']),_0x7f6ddb=hyperlink(_0x274364[_0x9faeb0(0x151)][_0x9faeb0(0x150)],_0x9f42a8);_0x2a1dcc[_0x9faeb0(0x1d4)]('⚒️\x20'+_0x7f6ddb);}_0x2a1dcc[_0x9faeb0(0x1d4)](_0x51908c[_0x9faeb0(0x1f5)](_0x45b7b5[_0x9faeb0(0x21f)]+_0x9faeb0(0x1fd)));}await writeOutput(_0x2a1dcc[_0x9faeb0(0x15d)]('\x0a'),_0x354a63[_0x9faeb0(0x176)],_0x9faeb0(0x207));}return 0x0;}catch(_0x5770ff){return handleSDKError(_0x5770ff,_0x354a63),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a19_0x373325(0x150)]=a19_0x373325(0x17b);[a19_0x373325(0x1c3)]=a19_0x373325(0x154);async[a19_0x373325(0x1a5)](_0x51608a){const _0x4a04e5=a19_0x373325,{options:_0x264005,args:_0x34a57d,tdx:_0x3066ca}=_0x51608a,_0x31f368=getChalk(_0x264005),_0x4b2068=_0x264005['site'];try{const _0xf0cfd9=_0x34a57d[0x0];let _0x375be4=_0xf0cfd9,_0x4028df,_0x142d88;if(_0xf0cfd9&&_0xf0cfd9[_0x4a04e5(0x14d)]('/')){const _0x43930f=_0xf0cfd9[_0x4a04e5(0x17a)]('/');if(_0x43930f[_0x4a04e5(0x21f)]===0x2){const [_0x4b7c91,_0x42188e]=_0x43930f,_0x4f1935=await _0x3066ca[_0x4a04e5(0x166)][_0x4a04e5(0x227)](),_0x7a7bf6=_0x4f1935['find'](_0x5bffdc=>_0x5bffdc[_0x4a04e5(0x151)][_0x4a04e5(0x150)][_0x4a04e5(0x1a2)]()===_0x4b7c91[_0x4a04e5(0x1a2)]());if(!_0x7a7bf6)throw new SDKError(ErrorCode[_0x4a04e5(0x1de)],'Project\x20not\x20found:\x20'+_0x4b7c91,undefined,{'helpText':_0x4a04e5(0x215)});_0x4028df=_0x7a7bf6['id'],_0x142d88=_0x7a7bf6[_0x4a04e5(0x151)][_0x4a04e5(0x150)],_0x375be4=_0x42188e;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4a04e5(0x16a)+_0xf0cfd9,undefined,{'helpText':_0x4a04e5(0x174)});}else{const _0x3203f6=await getProjectWithName(_0x51608a);_0x4028df=_0x3203f6['id'],_0x142d88=_0x3203f6[_0x4a04e5(0x150)];}const _0x2646f8=await withSpinner(_0x4a04e5(0x1cb),()=>_0x3066ca['llm'][_0x4a04e5(0x1fa)](_0x4028df),{'verbose':_0x264005['verbose']});let _0x5b7e9b=_0x2646f8[_0x4a04e5(0x169)];_0x375be4&&(_0x5b7e9b=_0x2646f8[_0x4a04e5(0x169)]['filter'](_0x19893e=>matchGlobPattern(_0x19893e['attributes'][_0x4a04e5(0x150)],_0x375be4)));const _0x41a397=_0x264005[_0x4a04e5(0x1e6)]===_0x4a04e5(0x18e)||_0x264005[_0x4a04e5(0x1e6)]===_0x4a04e5(0x1a7)||_0x264005[_0x4a04e5(0x1e6)]==='table'||_0x264005[_0x4a04e5(0x1e6)]==='tsv';if(_0x41a397){const _0x4c6537=_0x5b7e9b['map'](_0x2a1a45=>({...toAgentInfo(_0x2a1a45),'chatUrl':getLLMAgentChatUrl(_0x4b2068,_0x4028df,_0x2a1a45['id'])}));await handleSDKOutput(_0x4c6537,_0x264005);}else{const _0x100adc=[];_0x100adc[_0x4a04e5(0x1d4)](_0x31f368['dim']('['+_0x142d88+']'));if(_0x5b7e9b[_0x4a04e5(0x21f)]===0x0)_0x100adc[_0x4a04e5(0x1d4)](_0x31f368[_0x4a04e5(0x1f5)](_0x4a04e5(0x1e1)));else{const _0x5020c0=[..._0x5b7e9b][_0x4a04e5(0x1ae)]((_0x582c40,_0x2d932c)=>_0x582c40[_0x4a04e5(0x151)][_0x4a04e5(0x150)]['localeCompare'](_0x2d932c['attributes'][_0x4a04e5(0x150)]));for(const _0xc1135e of _0x5020c0){const _0x150d4c=getLLMAgentChatUrl(_0x4b2068,_0x4028df,_0xc1135e['id']),_0x59eda1=hyperlink(_0xc1135e[_0x4a04e5(0x151)]['name'],_0x150d4c);_0x100adc[_0x4a04e5(0x1d4)]('🤖\x20'+_0x59eda1);}_0x100adc[_0x4a04e5(0x1d4)](_0x31f368[_0x4a04e5(0x1f5)](_0x5b7e9b[_0x4a04e5(0x21f)]+_0x4a04e5(0x20e)));}await writeOutput(_0x100adc['join']('\x0a'),_0x264005['output'],'table');}return 0x0;}catch(_0x4d7e77){return handleSDKError(_0x4d7e77,_0x264005),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{['name']='llm:agent:show';['description']=a19_0x373325(0x1e2);async['execute'](_0x5d07f3){const _0x4e32df=a19_0x373325,{options:_0x3d103c,args:_0x549c23,tdx:_0x38e142}=_0x5d07f3;if(_0x549c23['length']===0x0)return console['error'](_0x4e32df(0x1f7)),console['error'](_0x4e32df(0x20f)),0x1;const _0x30c5b0=_0x549c23[0x0];try{const _0x5abe6f=await getProjectIdOrDefault(_0x5d07f3),_0x1ef603=await withSpinner(_0x4e32df(0x1ba)+_0x30c5b0+_0x4e32df(0x208),()=>_0x38e142['llm'][_0x4e32df(0x14e)](_0x30c5b0,_0x5abe6f),{'verbose':_0x3d103c[_0x4e32df(0x18b)]}),_0x159dbc=await withSpinner(_0x4e32df(0x1b4),()=>_0x38e142['llm'][_0x4e32df(0x20b)](_0x1ef603[_0x4e32df(0x169)]),{'verbose':_0x3d103c[_0x4e32df(0x18b)]});return await handleSDKOutput([_0x159dbc[_0x4e32df(0x169)]],_0x3d103c),0x0;}catch(_0x69f4bd){return handleSDKError(_0x69f4bd,_0x3d103c),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{[a19_0x373325(0x150)]=a19_0x373325(0x19a);['description']=a19_0x373325(0x161);async[a19_0x373325(0x1a5)](_0x4028b0){const _0x1b69d3=a19_0x373325,{options:_0x476006,args:_0x227cfa,tdx:_0x2b29f6}=_0x4028b0;if(_0x227cfa[_0x1b69d3(0x21f)]===0x0)return console[_0x1b69d3(0x16e)](_0x1b69d3(0x1f7)),console[_0x1b69d3(0x16e)]('Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]'),console[_0x1b69d3(0x16e)](_0x1b69d3(0x157)),0x1;const _0x3bcbb2=_0x227cfa[0x0],_0xb401e7=_0x476006,_0x352a7f=_0xb401e7[_0x1b69d3(0x226)],_0x3cb0e6=_0xb401e7[_0x1b69d3(0x1bb)]||_0x1b69d3(0x1c1),_0x2e51f5=_0xb401e7['starterMessage'],_0x54a29a=_0xb401e7[_0x1b69d3(0x152)]?Number(_0xb401e7[_0x1b69d3(0x152)]):undefined,_0x238d5f=_0xb401e7[_0x1b69d3(0x21c)]?Number(_0xb401e7[_0x1b69d3(0x21c)]):undefined;try{let _0xb9198c,_0x1b95a8;if(_0x3bcbb2[_0x1b69d3(0x14d)]('/')){const _0x45167a=_0x3bcbb2[_0x1b69d3(0x17a)]('/');if(_0x45167a[_0x1b69d3(0x21f)]===0x2){const [_0x45fa3c,_0x8fdb41]=_0x45167a,_0x71aa80=await withSpinner(_0x1b69d3(0x160)+_0x45fa3c+_0x1b69d3(0x208),()=>_0x2b29f6[_0x1b69d3(0x166)][_0x1b69d3(0x1e7)](_0x45fa3c),{'verbose':_0x476006['verbose']});_0xb9198c=_0x71aa80[_0x1b69d3(0x169)],_0x1b95a8=_0x8fdb41;}else throw new SDKError(ErrorCode[_0x1b69d3(0x16d)],'Invalid\x20path\x20syntax:\x20'+_0x3bcbb2,undefined,{'helpText':_0x1b69d3(0x174)});}else _0xb9198c=await getProjectIdOrDefault(_0x4028b0),_0x1b95a8=_0x3bcbb2;const _0x393d88=await withSpinner(_0x1b69d3(0x18a)+_0x1b95a8+_0x1b69d3(0x208),()=>_0x2b29f6[_0x1b69d3(0x166)][_0x1b69d3(0x1e8)]({'name':_0x1b95a8,'projectId':_0xb9198c,'modelType':_0x3cb0e6,'systemPrompt':_0x352a7f,'starterMessage':_0x2e51f5,'maxToolIterations':_0x54a29a,'temperature':_0x238d5f}),{'verbose':_0x476006[_0x1b69d3(0x18b)]});return console[_0x1b69d3(0x1ec)]('Agent\x20created:\x20'+_0x393d88['data']['id']),await handleSDKOutput([_0x393d88['data']],_0x476006),0x0;}catch(_0x50360e){return handleSDKError(_0x50360e,_0x476006),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{['name']=a19_0x373325(0x187);[a19_0x373325(0x1c3)]=a19_0x373325(0x217);async[a19_0x373325(0x1a5)](_0x39633f){const _0x22f135=a19_0x373325,{options:_0x199f3d,args:_0x4e677f,tdx:_0x320c3d}=_0x39633f;if(_0x4e677f[_0x22f135(0x21f)]===0x0)return console['error']('Error:\x20Agent\x20name\x20is\x20required'),console[_0x22f135(0x16e)](_0x22f135(0x1ea)),0x1;const _0x446166=_0x4e677f[0x0],_0x263e20=_0x199f3d,_0x3e73ea=_0x263e20[_0x22f135(0x150)],_0x12c760=_0x263e20[_0x22f135(0x170)],_0x55e2c0=_0x263e20[_0x22f135(0x1c3)],_0x125989=_0x263e20[_0x22f135(0x222)];if(!_0x3e73ea&&!_0x12c760&&!_0x55e2c0&&!_0x125989)return console[_0x22f135(0x16e)](_0x22f135(0x153)),console['error'](_0x22f135(0x183)),0x1;try{const _0xa5c21f=await getProjectIdOrDefault(_0x39633f),_0x218af2=await withSpinner(_0x22f135(0x1ba)+_0x446166+_0x22f135(0x208),()=>_0x320c3d[_0x22f135(0x166)][_0x22f135(0x14e)](_0x446166,_0xa5c21f),{'verbose':_0x199f3d[_0x22f135(0x18b)]}),_0xdc1923=_0x218af2[_0x22f135(0x169)],_0x440f99=await withSpinner('Updating\x20agent...',()=>_0x320c3d[_0x22f135(0x166)][_0x22f135(0x209)](_0xdc1923,{'name':_0x3e73ea,'prompt':_0x12c760,'description':_0x55e2c0,'starterMessage':_0x125989}),{'verbose':_0x199f3d[_0x22f135(0x18b)]});return console[_0x22f135(0x1ec)](_0x22f135(0x1b9)+_0x440f99['data']['id']),await handleSDKOutput([_0x440f99[_0x22f135(0x169)]],_0x199f3d),0x0;}catch(_0x4b525c){return handleSDKError(_0x4b525c,_0x199f3d),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{['name']=a19_0x373325(0x1be);[a19_0x373325(0x1c3)]=a19_0x373325(0x202);async['execute'](_0x3ed21d){const _0x2880e1=a19_0x373325,{options:_0x24f86f,args:_0x4bb169,tdx:_0xc26990}=_0x3ed21d;if(_0x4bb169[_0x2880e1(0x21f)]===0x0)return console[_0x2880e1(0x16e)](_0x2880e1(0x1f7)),console[_0x2880e1(0x16e)](_0x2880e1(0x1cd)),0x1;const _0x2e7c8d=_0x4bb169[0x0];try{const _0x4d37a7=await getProjectIdOrDefault(_0x3ed21d),_0x1477b4=await withSpinner(_0x2880e1(0x1ba)+_0x2e7c8d+_0x2880e1(0x208),()=>_0xc26990[_0x2880e1(0x166)]['resolveAgentId'](_0x2e7c8d,_0x4d37a7),{'verbose':_0x24f86f['verbose']}),_0x1ff46a=_0x1477b4[_0x2880e1(0x169)];return await withSpinner(_0x2880e1(0x1d7),()=>_0xc26990[_0x2880e1(0x166)][_0x2880e1(0x178)](_0x1ff46a),{'verbose':_0x24f86f[_0x2880e1(0x18b)]}),console[_0x2880e1(0x1ec)](_0x2880e1(0x1b1)+_0x1ff46a),0x0;}catch(_0x5e6c7b){return handleSDKError(_0x5e6c7b,_0x24f86f),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a19_0x373325(0x150)]='llm:history';[a19_0x373325(0x1c3)]=a19_0x373325(0x1c2);async[a19_0x373325(0x1a5)](_0x1851b9){return executeChatHistoryCommand(_0x1851b9,'tdx\x20llm\x20history');}}export class LLMUseCommand extends BaseCommand{[a19_0x373325(0x150)]=a19_0x373325(0x194);[a19_0x373325(0x1c3)]=a19_0x373325(0x200);async[a19_0x373325(0x1a5)](_0x4c57b1){const _0x2d3f3f=a19_0x373325,{options:_0x416773,args:_0x51838e,tdx:_0x4125ea}=_0x4c57b1;if(_0x51838e[_0x2d3f3f(0x21f)]===0x0)return console[_0x2d3f3f(0x16e)](_0x2d3f3f(0x20c)),console[_0x2d3f3f(0x16e)]('Usage:\x20tdx\x20llm\x20use\x20<project-name>'),0x1;const _0x185b41=_0x51838e[0x0];try{return await withSpinner('Setting\x20project\x20context\x20to\x20\x27'+_0x185b41+_0x2d3f3f(0x208),()=>_0x4125ea[_0x2d3f3f(0x166)][_0x2d3f3f(0x15e)](_0x185b41),{'verbose':_0x416773['verbose']}),console['log'](_0x2d3f3f(0x1b6)+_0x185b41),0x0;}catch(_0x34c48b){return handleSDKError(_0x34c48b,_0x416773),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a19_0x373325(0x150)]='llm:project:create';[a19_0x373325(0x1c3)]=a19_0x373325(0x20d);async[a19_0x373325(0x1a5)](_0x5adabf){const _0x5eff01=a19_0x373325,{options:_0x48db6c,args:_0x1a98e4,tdx:_0x367b54}=_0x5adabf;if(_0x1a98e4[_0x5eff01(0x21f)]===0x0)return console[_0x5eff01(0x16e)](_0x5eff01(0x20c)),console[_0x5eff01(0x16e)](_0x5eff01(0x1a0)),0x1;const _0x5e27a2=_0x1a98e4[0x0],_0x579955=_0x48db6c,_0x932037=_0x579955[_0x5eff01(0x1c3)];try{const _0x3d16cf=await withSpinner(_0x5eff01(0x197)+_0x5e27a2+'\x27...',()=>_0x367b54[_0x5eff01(0x166)][_0x5eff01(0x214)]({'name':_0x5e27a2,'description':_0x932037}),{'verbose':_0x48db6c['verbose']});console[_0x5eff01(0x1ec)](_0x5eff01(0x16f)+_0x3d16cf[_0x5eff01(0x169)]['id']);const _0x116ffc=toLLMProjectInfo(_0x3d16cf[_0x5eff01(0x169)]);return await handleSDKOutput([_0x116ffc],_0x48db6c),0x0;}catch(_0x28267e){return handleSDKError(_0x28267e,_0x48db6c),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a19_0x373325(0x150)]=a19_0x373325(0x19d);[a19_0x373325(0x1c3)]=a19_0x373325(0x204);async[a19_0x373325(0x1a5)](_0x4e4c64){const _0x2c4b4f=a19_0x373325,{options:_0x270ae8,args:_0x4fa49e,tdx:_0x5f365e}=_0x4e4c64;if(_0x4fa49e['length']===0x0)return console[_0x2c4b4f(0x16e)](_0x2c4b4f(0x20c)),console['error'](_0x2c4b4f(0x182)),0x1;const _0x29c799=_0x4fa49e[0x0];try{return await withSpinner(_0x2c4b4f(0x1bf)+_0x29c799+_0x2c4b4f(0x208),()=>_0x5f365e[_0x2c4b4f(0x166)][_0x2c4b4f(0x198)](_0x29c799),{'verbose':_0x270ae8[_0x2c4b4f(0x18b)]}),console[_0x2c4b4f(0x1ec)](_0x2c4b4f(0x167)+_0x29c799),0x0;}catch(_0x4629ed){return handleSDKError(_0x4629ed,_0x270ae8),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a19_0x373325(0x150)]='llm:project:backup';[a19_0x373325(0x1c3)]=a19_0x373325(0x177);async[a19_0x373325(0x1a5)](_0x60cb3f){const _0x1e6288=a19_0x373325,{options:_0x28591c,args:_0x23bb38,tdx:_0x274151}=_0x60cb3f,_0x2270e1=getChalk(_0x28591c);console['log'](_0x2270e1[_0x1e6288(0x15a)](_0x1e6288(0x173))),console[_0x1e6288(0x1ec)](_0x2270e1[_0x1e6288(0x15a)](_0x1e6288(0x15b))),console[_0x1e6288(0x1ec)](_0x2270e1[_0x1e6288(0x1f5)](_0x1e6288(0x179))),console['log']();if(_0x23bb38[_0x1e6288(0x21f)]===0x0)return console[_0x1e6288(0x16e)](_0x1e6288(0x20c)),console[_0x1e6288(0x16e)]('Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]'),0x1;const _0x2626a5=_0x23bb38[0x0],_0x46f20e=_0x28591c,_0x41d715=_0x46f20e[_0x1e6288(0x176)],_0x3d8f44=_0x46f20e[_0x1e6288(0x18f)];try{const _0x4f94b1=_0x41d715||_0x2626a5+_0x1e6288(0x1a8);if(a19_0x1e2fc2[_0x1e6288(0x193)](_0x4f94b1)&&!_0x3d8f44){if(!_0x28591c[_0x1e6288(0x180)]){const _0x526329=await confirm('Output\x20directory\x20\x27'+_0x4f94b1+_0x1e6288(0x1b3));if(!_0x526329)return console[_0x1e6288(0x1ec)](_0x1e6288(0x18d)),0x0;}a19_0x1e2fc2[_0x1e6288(0x1dc)](_0x4f94b1,{'recursive':!![]});}const _0x247d98=await withSpinner(_0x3d8f44?_0x1e6288(0x1cc)+_0x2626a5+'\x27...':_0x1e6288(0x1aa)+_0x2626a5+'\x27...',()=>_0x274151[_0x1e6288(0x166)]['backupProject'](_0x2626a5,_0x41d715,{'dryRun':_0x3d8f44}),{'verbose':_0x28591c[_0x1e6288(0x18b)]}),_0x67ffb0=_0x247d98['data'];return _0x3d8f44?console[_0x1e6288(0x1ec)](_0x1e6288(0x17e)+_0x67ffb0[_0x1e6288(0x165)]):console[_0x1e6288(0x1ec)](_0x1e6288(0x1dd)+_0x67ffb0[_0x1e6288(0x165)]),console[_0x1e6288(0x1ec)]('\x20\x20Agents:\x20'+_0x67ffb0[_0x1e6288(0x159)]['agents']),console['log']('\x20\x20Knowledge\x20Bases:\x20'+_0x67ffb0['counts'][_0x1e6288(0x1df)]),console[_0x1e6288(0x1ec)](_0x1e6288(0x19b)+_0x67ffb0[_0x1e6288(0x159)][_0x1e6288(0x192)]),console['log'](_0x1e6288(0x1a1)+_0x67ffb0['counts'][_0x1e6288(0x1ce)]),(_0x28591c[_0x1e6288(0x1e6)]===_0x1e6288(0x18e)||_0x28591c[_0x1e6288(0x1e6)]===_0x1e6288(0x1a7))&&await handleSDKOutput([_0x67ffb0],_0x28591c),0x0;}catch(_0x37c5b6){return handleSDKError(_0x37c5b6,_0x28591c),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{['name']=a19_0x373325(0x16c);[a19_0x373325(0x1c3)]=a19_0x373325(0x21b);async[a19_0x373325(0x1a5)](_0x43550e){const _0x6c71c7=a19_0x373325,{options:_0x33a143,args:_0x31c98e,tdx:_0x4ae93c}=_0x43550e,_0xab7975=getChalk(_0x33a143);console['log'](_0xab7975[_0x6c71c7(0x15a)](_0x6c71c7(0x199))),console['log'](_0xab7975[_0x6c71c7(0x15a)](_0x6c71c7(0x1b5))),console[_0x6c71c7(0x1ec)](_0xab7975[_0x6c71c7(0x1f5)]('\x20\x20\x20Examples:')),console[_0x6c71c7(0x1ec)](_0xab7975['dim']('\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/')),console[_0x6c71c7(0x1ec)](_0xab7975[_0x6c71c7(0x1f5)]('\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22')),console[_0x6c71c7(0x1ec)]();if(_0x31c98e[_0x6c71c7(0x21f)]===0x0)return console[_0x6c71c7(0x16e)](_0x6c71c7(0x15f)),console[_0x6c71c7(0x16e)](_0x6c71c7(0x1fc)),0x1;const _0x3fc675=_0x31c98e[0x0],_0x257375=_0x33a143,_0x3a0151=_0x257375[_0x6c71c7(0x150)],_0x321bce=_0x257375[_0x6c71c7(0x18f)];try{if(!_0x321bce){const _0x461fa8=_0x4ae93c[_0x6c71c7(0x166)][_0x6c71c7(0x17d)](_0x3fc675),_0x30c9d0=_0x3a0151||_0x461fa8['exportedFrom'][_0x6c71c7(0x163)],_0x280b7b=await withSpinner(_0x6c71c7(0x1d3),()=>_0x4ae93c['llm'][_0x6c71c7(0x227)](),{'verbose':_0x33a143['verbose']}),_0x5176f6=_0x280b7b[_0x6c71c7(0x169)][_0x6c71c7(0x17f)](_0x3b5330=>_0x3b5330[_0x6c71c7(0x151)][_0x6c71c7(0x150)]===_0x30c9d0);if(_0x5176f6&&!_0x33a143[_0x6c71c7(0x180)]){const _0x3e3168=await confirm(_0x6c71c7(0x1fb)+_0x30c9d0+_0x6c71c7(0x196));if(!_0x3e3168)return console[_0x6c71c7(0x1ec)](_0x6c71c7(0x223)),0x0;}}const _0x5c3571=await withSpinner(_0x321bce?_0x6c71c7(0x1b7)+_0x3fc675+'\x27...':_0x6c71c7(0x210)+_0x3fc675+_0x6c71c7(0x208),()=>_0x4ae93c['llm'][_0x6c71c7(0x212)](_0x3fc675,{'name':_0x3a0151,'dryRun':_0x321bce}),{'verbose':_0x33a143['verbose']}),_0x3250cb=_0x5c3571['data'];return _0x3250cb[_0x6c71c7(0x1f1)]&&console['log'](_0x6c71c7(0x15c)+_0x3250cb[_0x6c71c7(0x1f1)]+'\x27'),_0x321bce?console[_0x6c71c7(0x1ec)](_0x6c71c7(0x181)+_0x3250cb[_0x6c71c7(0x163)]):console['log'](_0x6c71c7(0x19e)+_0x3250cb[_0x6c71c7(0x163)]+'\x20('+_0x3250cb['projectId']+')'),console[_0x6c71c7(0x1ec)]('\x20\x20Agents:\x20'+_0x3250cb[_0x6c71c7(0x159)][_0x6c71c7(0x1fa)]),console[_0x6c71c7(0x1ec)](_0x6c71c7(0x1c7)+_0x3250cb[_0x6c71c7(0x159)][_0x6c71c7(0x1df)]),console['log'](_0x6c71c7(0x19b)+_0x3250cb[_0x6c71c7(0x159)]['prompts']),console[_0x6c71c7(0x1ec)]('\x20\x20Integrations:\x20'+_0x3250cb['counts']['integrations']),(_0x33a143['format']===_0x6c71c7(0x18e)||_0x33a143[_0x6c71c7(0x1e6)]===_0x6c71c7(0x1a7))&&await handleSDKOutput([_0x3250cb],_0x33a143),0x0;}catch(_0x550af5){return handleSDKError(_0x550af5,_0x33a143),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x1064f8,_0x117d60){const _0x36ce43=a19_0x373325,_0x279c1d=_0x117d60[_0x36ce43(0x18c)]||CHAT_SELECTOR_PAGE_SIZE;let _0x19e976=0x0,_0x3e50f9=[];const _0x94a4e6=(await import(_0x36ce43(0x192)))['default'],_0x40be0e=getChalk(_0x117d60);while(!![]){const _0x103880=await withSpinner(_0x36ce43(0x1cf),()=>_0x1064f8[_0x36ce43(0x166)][_0x36ce43(0x1b2)](_0x279c1d+_0x19e976),{'verbose':_0x117d60[_0x36ce43(0x18b)]});_0x3e50f9=_0x103880['data'];const _0xb62948=_0x3e50f9[_0x36ce43(0x171)](_0x19e976,_0x19e976+_0x279c1d),_0x55ccdd=_0x3e50f9[_0x36ce43(0x21f)]>_0x19e976+_0x279c1d,_0x596f1d=[...new Set(_0xb62948[_0x36ce43(0x1ab)](_0x2f0421=>_0x2f0421['attributes']['agentId'])['filter'](_0x4135e5=>_0x4135e5!==undefined))],_0x4cb0a6=new Map();await Promise['all'](_0x596f1d[_0x36ce43(0x1ab)](async _0x2c2f0a=>{const _0x35e9ab=_0x36ce43;try{const _0x2d7849=await _0x1064f8[_0x35e9ab(0x166)][_0x35e9ab(0x20b)](_0x2c2f0a);_0x4cb0a6[_0x35e9ab(0x1b8)](_0x2c2f0a,_0x2d7849[_0x35e9ab(0x151)]['name']);}catch{_0x4cb0a6[_0x35e9ab(0x1b8)](_0x2c2f0a,_0x2c2f0a);}}));const _0x3522be=_0xb62948[_0x36ce43(0x1ab)](_0x3314ed=>{const _0x3b57bf=_0x36ce43,_0x242e3a=_0x3314ed[_0x3b57bf(0x151)][_0x3b57bf(0x1da)]||_0x3b57bf(0x221),_0x10fbba=_0x242e3a[_0x3b57bf(0x17a)]('\x0a')[0x0],_0x49f9e4=_0x10fbba[_0x3b57bf(0x21f)]>0x50?_0x10fbba[_0x3b57bf(0x224)](0x0,0x4d)+_0x3b57bf(0x1c9):_0x10fbba,_0x30d67a=_0x3314ed[_0x3b57bf(0x151)][_0x3b57bf(0x1f9)]?_0x4cb0a6['get'](_0x3314ed[_0x3b57bf(0x151)]['agentId'])||_0x3314ed[_0x3b57bf(0x151)]['agentId']:_0x3b57bf(0x1a4),_0x4881a5=_0x3314ed[_0x3b57bf(0x151)]['lastConversationAt']||_0x3314ed[_0x3b57bf(0x151)][_0x3b57bf(0x1c6)],_0x5ac909=new Date(_0x4881a5),_0x52a0a8=new Date(),_0x5cf238=_0x52a0a8[_0x3b57bf(0x20a)]()-_0x5ac909[_0x3b57bf(0x20a)](),_0x36a8d2=Math[_0x3b57bf(0x21e)](_0x5cf238/0xea60),_0x1cc043=Math[_0x3b57bf(0x21e)](_0x5cf238/0x36ee80),_0x53abb1=Math['floor'](_0x5cf238/0x5265c00);let _0x3829f0;if(_0x36a8d2<0x1)_0x3829f0=_0x3b57bf(0x1c4);else{if(_0x36a8d2<0x3c)_0x3829f0=_0x36a8d2+'m\x20ago';else{if(_0x1cc043<0x18)_0x3829f0=_0x1cc043+_0x3b57bf(0x19c);else _0x53abb1<0x7?_0x3829f0=_0x53abb1+'d\x20ago':_0x3829f0=_0x5ac909[_0x3b57bf(0x190)](_0x3b57bf(0x1d6),{'month':_0x3b57bf(0x228),'day':_0x3b57bf(0x219)});}}return{'title':_0x49f9e4+'\x20'+_0x40be0e['dim']('['+_0x30d67a+']\x20'+_0x3829f0),'value':_0x3314ed['id']};});_0x55ccdd&&_0x3522be['push']({'title':_0x40be0e[_0x36ce43(0x206)](_0x36ce43(0x1c8)),'value':'__load_more__'});const _0x5e9a1f=await _0x94a4e6({'type':_0x36ce43(0x1f2),'name':'chatId','message':'Select\x20a\x20chat\x20session:','choices':_0x3522be,'hint':_0x36ce43(0x156)});if(!_0x5e9a1f['chatId'])return undefined;if(_0x5e9a1f[_0x36ce43(0x1f4)]===_0x36ce43(0x216)){_0x19e976+=_0x279c1d;continue;}return _0x5e9a1f['chatId'];}}export class ChatsCommand extends BaseCommand{[a19_0x373325(0x150)]=a19_0x373325(0x1b2);[a19_0x373325(0x1c3)]=a19_0x373325(0x189);async[a19_0x373325(0x1a5)](_0x2b6ab4){const _0x3f041a=a19_0x373325;return executeChatHistoryCommand(_0x2b6ab4,_0x3f041a(0x1d9));}}
1
+ const a19_0x56d8bc=a19_0x34e1;(function(_0x15ac81,_0x3721d2){const _0xb15615=a19_0x34e1,_0x34ed46=_0x15ac81();while(!![]){try{const _0xfac846=parseInt(_0xb15615(0x2a1))/0x1*(parseInt(_0xb15615(0x294))/0x2)+parseInt(_0xb15615(0x203))/0x3+-parseInt(_0xb15615(0x247))/0x4*(-parseInt(_0xb15615(0x266))/0x5)+parseInt(_0xb15615(0x261))/0x6+-parseInt(_0xb15615(0x20f))/0x7*(parseInt(_0xb15615(0x2a3))/0x8)+parseInt(_0xb15615(0x1d1))/0x9+-parseInt(_0xb15615(0x24d))/0xa;if(_0xfac846===_0x3721d2)break;else _0x34ed46['push'](_0x34ed46['shift']());}catch(_0x22c698){_0x34ed46['push'](_0x34ed46['shift']());}}}(a19_0x2642,0x2e747));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 a19_0x3d840f from'node:fs';function handleSDKError(_0x5d6747,_0x3f42d5){const _0xacb08a=a19_0x34e1;if(_0x5d6747 instanceof SDKError)console[_0xacb08a(0x28e)](_0xacb08a(0x276)+_0x5d6747['message']),_0x3f42d5[_0xacb08a(0x250)]&&(_0x5d6747[_0xacb08a(0x23c)]&&console[_0xacb08a(0x28e)](_0xacb08a(0x263)+_0x5d6747[_0xacb08a(0x23c)]),_0x5d6747['stack']&&(console[_0xacb08a(0x28e)](_0xacb08a(0x1fe)),console[_0xacb08a(0x28e)](_0x5d6747[_0xacb08a(0x232)])));else throw _0x5d6747;}function a19_0x2642(){const _0xdca7f9=['yes','Project\x20restored:\x20','Fetching\x20most\x20recent\x20chat...','sort','\x20\x20Agents:\x20','Fetching\x20chat\x20sessions...','[unknown]','Fetching\x20chat\x20history\x20for\x20\x27','table','starterMessage','Deleting\x20agent...','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','models','llm:agent:delete','stack','🤖\x20','dryRun','keys','bold','slice','select','prompts','Backing\x20up\x20project\x20\x27','getTime','cause','localeCompare','List\x20agents\x20in\x20current\x20project','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','Project\x20backed\x20up\x20to:\x20','join','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','push','\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?','d\x20ago','output','72204VjbPly','knowledgeBases','Invalid\x20path\x20syntax:\x20','set','model','Project\x20context\x20set\x20to:\x20','4822600IHsfZf','json','format','verbose','\x20\x20Knowledge\x20Bases:\x20','llm:agents','Set\x20current\x20project\x20context','limit','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','content','llm:project:delete','[tool_call]','llm:agent:show','Delete\x20an\x20agent','(no\x20agent)','entries','deleteProject','Setting\x20project\x20context\x20to\x20\x27','Project\x20deleted:\x20','data','1979442xWrJei','Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)','\x20\x20Cause:\x20','Usage:\x20tdx\x20llm\x20use\x20<project-name>','Checking\x20for\x20existing\x20projects...','45OUzXwA','targetKnowledgeBase','substring','Backup\x20cancelled.','Getting\x20default\x20project...','tsv','llm:models','Project\x20created:\x20','targetWebSearchTool','Select\x20a\x20chat\x20session:','counts','resolveProjectId','includes','Creating\x20project\x20\x27','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','No\x20projects\x20found','Error:\x20','Resolving\x20agent\x20\x27','dim','Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)','createProject','\x20->\x20KB:','site','\x20\x20Integrations:\x20','tool','llm:projects','Fetching\x20available\x20models...','Agent\x20created:\x20','No\x20messages\x20found\x20in\x20chat\x20history.','maxToolIterations','length','default','yellow','[input]\x20\x20','attributes','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','\x20-\x20','llm:agent:update','Use\x20format:\x20project-name/agent-name','Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]','error','\x20→\x20chat:\x20','floor','\x20--last','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','2RfuHQW','Delete\x20an\x20LLM\x20project','agents','projectName','targetAgent','updatedAt','Error:\x20Backup\x20folder\x20path\x20is\x20required','Update\x20an\x20existing\x20agent','tool_call','red','split','image','filter','207514vwmsgt','chats','16onROKY','name','399312JCfNNj','exportedFrom','history','\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.','(no\x20message)','Resolving\x20project\x20\x27','\x20agent(s)','[image]\x20\x20','string','toLocaleDateString','last','execute','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','Usage:\x20','.llm','Creating\x20agent\x20\x27','all','Restore\x20cancelled.','outputDir','map','systemPrompt','Error:\x20Agent\x20name\x20is\x20required','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','\x20->\x20Agent:','agentId','createdAt','\x20\x20\x20Examples:','toLowerCase','[content]','Validating\x20backup\x20from\x20\x27','numeric','magenta','cyan','\x20bytes)','temperature','setCurrentProject','List\x20available\x20LLM\x20models','deleteAgent','description','Output\x20directory\x20\x27','log','updateAgent','...','Analyzing\x20project\x20\x27','integrations','\x0aStack\x20trace:','lastConversationAt','llm','resolveAgentId','\x0aCancelled','762099uyLUHc','m\x20ago','llmProject','restoreProject','Fetching\x20agents...','agent','chatId','Updating\x20agent...','\x27...','just\x20now','\x20\x20Prompts:\x20','find','1140097vmLqzq','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','Agent\x20deleted:\x20','jsonl','sourceSite','projects','existsSync','short','input','\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22','green','llm:project:backup','[output]\x20','__load_more__','No\x20agents\x20found','stringify','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.','get','targetImageGenerator','Agent\x20updated:\x20','Error:\x20Project\x20name\x20is\x20required'];a19_0x2642=function(){return _0xdca7f9;};return a19_0x2642();}function formatChatHistoryEntry(_0x1a5b7d,_0x13e68c){const _0x3262f6=a19_0x34e1,_0x284ec1=getChalk(_0x13e68c),_0x262ef9=_0x284ec1['dim'](_0x1a5b7d['at']);if(_0x3262f6(0x217)in _0x1a5b7d){const _0x1b3fc6=_0x284ec1[_0x3262f6(0x1f1)](_0x3262f6(0x287));return _0x262ef9+'\x20'+_0x1b3fc6+':\x20'+_0x1a5b7d[_0x3262f6(0x217)];}if(_0x3262f6(0x256)in _0x1a5b7d){const _0x16aab1=_0x284ec1[_0x3262f6(0x219)](_0x3262f6(0x1ed));return _0x262ef9+'\x20'+_0x16aab1+':\x20'+_0x1a5b7d[_0x3262f6(0x256)];}if(_0x3262f6(0x29c)in _0x1a5b7d){const _0x152071=_0x284ec1[_0x3262f6(0x286)](_0x3262f6(0x258)),{functionName:_0x4c8c41,functionArguments:_0x4b26a5,targetFunction:_0x563fa6}=_0x1a5b7d[_0x3262f6(0x29c)];let _0x1a8553=_0x262ef9+'\x20'+_0x152071+':\x20'+_0x284ec1[_0x3262f6(0x236)](_0x4c8c41);if(_0x4b26a5&&Object[_0x3262f6(0x235)](_0x4b26a5)[_0x3262f6(0x284)]>0x0){const _0xe65f25=Object[_0x3262f6(0x25c)](_0x4b26a5)[_0x3262f6(0x1e4)](([_0x5f3c47,_0x39109c])=>_0x5f3c47+'='+JSON[_0x3262f6(0x21e)](_0x39109c))[_0x3262f6(0x241)](',\x20');_0x1a8553+='('+_0xe65f25+')';}_0x563fa6&&(_0x1a8553+=_0x284ec1[_0x3262f6(0x278)]('\x20['+_0x563fa6+']'));let _0x1cc14d='';if(_0x1a5b7d[_0x3262f6(0x29c)][_0x3262f6(0x267)])_0x1cc14d=_0x3262f6(0x27b)+_0x1a5b7d[_0x3262f6(0x29c)]['targetKnowledgeBase'][_0x3262f6(0x1d0)];else{if(_0x1a5b7d[_0x3262f6(0x29c)]['targetAgent'])_0x1cc14d=_0x3262f6(0x1e8)+_0x1a5b7d[_0x3262f6(0x29c)][_0x3262f6(0x298)][_0x3262f6(0x1d0)];else{if(_0x1a5b7d[_0x3262f6(0x29c)][_0x3262f6(0x26e)])_0x1cc14d='\x20->\x20WebSearch:'+_0x1a5b7d[_0x3262f6(0x29c)][_0x3262f6(0x26e)][_0x3262f6(0x1d0)];else _0x1a5b7d[_0x3262f6(0x29c)][_0x3262f6(0x221)]&&(_0x1cc14d='\x20->\x20ImageGen:'+_0x1a5b7d[_0x3262f6(0x29c)][_0x3262f6(0x221)]['name']);}}return _0x1a8553+_0x1cc14d;}if(_0x3262f6(0x27e)in _0x1a5b7d){const _0x146d95=_0x284ec1[_0x3262f6(0x1f0)]('[tool]\x20\x20\x20'),{functionName:_0x25df2b,functionArguments:_0x5722cd,content:_0x2ffd0c,newChat:_0x2093da}=_0x1a5b7d[_0x3262f6(0x27e)];let _0x1a944a=_0x262ef9+'\x20'+_0x146d95+':\x20'+_0x284ec1[_0x3262f6(0x236)](_0x25df2b);if(_0x5722cd){const _0x2a25e2=typeof _0x5722cd===_0x3262f6(0x1d9)?_0x5722cd:JSON[_0x3262f6(0x21e)](_0x5722cd);_0x1a944a+='('+_0x2a25e2+')';}return _0x2ffd0c&&(_0x1a944a+='\x0a'+_0x284ec1[_0x3262f6(0x278)](_0x2ffd0c)),_0x2093da&&(_0x1a944a+=_0x284ec1[_0x3262f6(0x278)](_0x3262f6(0x28f)+_0x2093da['id'])),_0x1a944a;}if(_0x3262f6(0x246)in _0x1a5b7d){const _0x2713fd=_0x284ec1['blue'](_0x3262f6(0x21b));return _0x262ef9+'\x20'+_0x2713fd+':\x20'+_0x1a5b7d[_0x3262f6(0x246)][_0x3262f6(0x1d0)]+'\x20('+_0x1a5b7d[_0x3262f6(0x246)]['content'][_0x3262f6(0x284)]+_0x3262f6(0x1f2);}if(_0x3262f6(0x29f)in _0x1a5b7d){const _0x150c27=_0x284ec1['blue'](_0x3262f6(0x1d8)),{width:_0x2b9615,height:_0x5d1d31,headerText:_0x49cd41}=_0x1a5b7d[_0x3262f6(0x29f)],_0xc34dac=_0x49cd41?_0x3262f6(0x28a)+_0x49cd41:'';return _0x262ef9+'\x20'+_0x150c27+':\x20'+_0x2b9615+'x'+_0x5d1d31+_0xc34dac;}if('error'in _0x1a5b7d){const _0x35c45a=_0x284ec1[_0x3262f6(0x29d)]('[error]\x20\x20');return _0x262ef9+'\x20'+_0x35c45a+':\x20'+_0x1a5b7d['error'];}return _0x262ef9+'\x20'+_0x284ec1['dim'](_0x3262f6(0x22a))+':\x20'+JSON[_0x3262f6(0x21e)](_0x1a5b7d);}async function executeChatHistoryCommand(_0x22cd27,_0x2f7a65){const _0x177880=a19_0x34e1,{options:_0x3e580e,args:_0x4fb8e9,tdx:_0x83d118}=_0x22cd27,_0x5a0c0f=_0x4fb8e9[0x0],_0x2d5491=_0x3e580e,_0x3dc2ce=_0x2d5491[_0x177880(0x1db)];try{if(_0x3dc2ce&&_0x5a0c0f)return console[_0x177880(0x28e)](_0x177880(0x1e7)),console['error'](_0x177880(0x1de)+_0x2f7a65+_0x177880(0x291)),0x1;if(!_0x5a0c0f&&!_0x3dc2ce&&_0x3e580e['format']!==undefined){const _0x57692d=resolveLimit(_0x3e580e[_0x177880(0x254)],DEFAULT_LLM_LIMIT),_0x480f71=await withSpinner(_0x177880(0x229),()=>_0x83d118['llm'][_0x177880(0x2a2)](_0x57692d),{'verbose':_0x3e580e['verbose']});return await handleSDKOutput(_0x480f71[_0x177880(0x260)],_0x3e580e),0x0;}const _0x38f278=await getChatIdOrSelect(_0x83d118,_0x3e580e,_0x3dc2ce,_0x5a0c0f);if(!_0x38f278)return 0x0;return await displayChatHistory(_0x38f278,_0x83d118,_0x3e580e),0x0;}catch(_0x5dcde5){return handleSDKError(_0x5dcde5,_0x3e580e),0x1;}}async function displayChatHistory(_0x323225,_0x517d8d,_0x2405dd){const _0x145474=a19_0x34e1,_0x38e57d=await withSpinner(_0x145474(0x22b)+_0x323225+_0x145474(0x20b),()=>_0x517d8d[_0x145474(0x200)][_0x145474(0x1d3)](_0x323225),{'verbose':_0x2405dd[_0x145474(0x250)]}),_0x4b1113=_0x38e57d[_0x145474(0x260)]['data']??[];if(_0x4b1113['length']===0x0){console[_0x145474(0x1f9)](_0x145474(0x282));return;}if(_0x2405dd['format']!==undefined)await handleSDKOutput(_0x4b1113,_0x2405dd);else{const _0x4b8fb4=_0x4b1113[_0x145474(0x1e4)](_0x5777c4=>formatChatHistoryEntry(_0x5777c4,_0x2405dd)),_0x2a2a8b=_0x4b8fb4[_0x145474(0x241)]('\x0a');await writeOutput(_0x2a2a8b,_0x2405dd[_0x145474(0x246)],_0x145474(0x22c));}}async function getChatIdOrSelect(_0x49c0be,_0x37648e,_0x43a388,_0x2d9206){const _0x1b581b=a19_0x34e1;if(_0x2d9206)return _0x2d9206;if(_0x43a388){const _0x479319=await withSpinner(_0x1b581b(0x226),()=>_0x49c0be['llm']['chats'](0x1),{'verbose':_0x37648e['verbose']});if(_0x479319[_0x1b581b(0x260)][_0x1b581b(0x284)]===0x0)return console[_0x1b581b(0x1f9)]('No\x20chat\x20sessions\x20found.'),undefined;return _0x479319[_0x1b581b(0x260)][0x0]['id'];}const _0x141289=await selectChatInteractively(_0x49c0be,_0x37648e);if(!_0x141289)return console[_0x1b581b(0x1f9)](_0x1b581b(0x202)),undefined;return _0x141289;}async function getProjectIdOrDefault(_0x3118c6){const _0x3a576a=await getProjectWithName(_0x3118c6);return _0x3a576a['id'];}async function getProjectWithName(_0x351293){const _0x30110c=a19_0x34e1,{tdx:_0x2ca7e2,options:_0x3c90b9}=_0x351293,_0xed3636=_0x3c90b9[_0x30110c(0x205)];if(_0xed3636){const _0x7662e6=await withSpinner(_0x30110c(0x1d6)+_0xed3636+_0x30110c(0x20b),()=>_0x2ca7e2[_0x30110c(0x200)][_0x30110c(0x271)](_0xed3636),{'verbose':_0x3c90b9[_0x30110c(0x250)]});return{'id':_0x7662e6[_0x30110c(0x260)],'name':_0xed3636};}const _0x582d32=_0x2ca7e2[_0x30110c(0x200)]['getCurrentProject']();if(_0x582d32){const _0x40f895=await _0x2ca7e2[_0x30110c(0x200)]['projects'](),_0x3ab824=_0x40f895['find'](_0x13495e=>_0x13495e['id']===_0x582d32);return{'id':_0x582d32,'name':_0x3ab824?.[_0x30110c(0x288)][_0x30110c(0x1d0)]||'Unknown'};}const _0x298dd0=await withSpinner(_0x30110c(0x26a),()=>_0x2ca7e2[_0x30110c(0x200)]['getOrCreateDefaultProject'](),{'verbose':_0x3c90b9[_0x30110c(0x250)]});return{'id':_0x298dd0[_0x30110c(0x260)]['id'],'name':_0x298dd0[_0x30110c(0x260)][_0x30110c(0x288)][_0x30110c(0x1d0)]};}function a19_0x34e1(_0x3a394e,_0xb0fe8){_0x3a394e=_0x3a394e-0x1d0;const _0x2642a1=a19_0x2642();let _0x34e13e=_0x2642a1[_0x3a394e];return _0x34e13e;}function toLLMProjectInfo(_0x3394f9){const _0x44a17c=a19_0x34e1;return{'name':_0x3394f9['attributes'][_0x44a17c(0x1d0)],'description':_0x3394f9[_0x44a17c(0x288)]['description'],'createdAt':_0x3394f9[_0x44a17c(0x288)]['createdAt'],'updatedAt':_0x3394f9[_0x44a17c(0x288)]['updatedAt']};}function toAgentInfo(_0x508c2c){const _0x5afbd1=a19_0x34e1;return{'name':_0x508c2c[_0x5afbd1(0x288)][_0x5afbd1(0x1d0)],'description':_0x508c2c[_0x5afbd1(0x288)][_0x5afbd1(0x1f7)],'prompt':truncatePrompt(_0x508c2c[_0x5afbd1(0x288)]['prompt']),'createdAt':_0x508c2c[_0x5afbd1(0x288)][_0x5afbd1(0x1ea)],'updatedAt':_0x508c2c[_0x5afbd1(0x288)][_0x5afbd1(0x299)]};}function truncatePrompt(_0x2429a3){const _0x4a574b=a19_0x34e1;if(!_0x2429a3)return undefined;const _0x559f34=0x64;if(_0x2429a3[_0x4a574b(0x284)]<=_0x559f34)return _0x2429a3;return _0x2429a3['slice'](0x0,_0x559f34)+'...';}export class LLMModelsCommand extends BaseCommand{[a19_0x56d8bc(0x1d0)]=a19_0x56d8bc(0x26c);[a19_0x56d8bc(0x1f7)]=a19_0x56d8bc(0x1f5);async[a19_0x56d8bc(0x1dc)](_0x3bb545){const _0x1c2833=a19_0x56d8bc,{options:_0x475757,tdx:_0x35bcb2}=_0x3bb545;try{const _0x4c4376=await withSpinner(_0x1c2833(0x280),()=>_0x35bcb2[_0x1c2833(0x200)][_0x1c2833(0x230)](),{'verbose':_0x475757[_0x1c2833(0x250)]});return await handleSDKOutput(_0x4c4376[_0x1c2833(0x260)],_0x475757),0x0;}catch(_0x5c4709){return handleSDKError(_0x5c4709,_0x475757),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a19_0x56d8bc(0x1d0)]=a19_0x56d8bc(0x27f);[a19_0x56d8bc(0x1f7)]='List\x20all\x20LLM\x20projects';async[a19_0x56d8bc(0x1dc)](_0x5bf21d){const _0x1be53c=a19_0x56d8bc,{options:_0x188645,args:_0x39d711,tdx:_0xce79e7}=_0x5bf21d,_0x23a6f4=getChalk(_0x188645),_0x45b84e=_0x188645['site'];try{const _0x523741=_0x39d711[0x0],_0x381e7d=resolveLimit(_0x188645['limit'],DEFAULT_LLM_LIMIT),_0x3f185b=await withSpinner('Fetching\x20projects...',()=>_0xce79e7[_0x1be53c(0x200)][_0x1be53c(0x214)](_0x381e7d),{'verbose':_0x188645[_0x1be53c(0x250)]});let _0x3b14e3=_0x3f185b[_0x1be53c(0x260)];_0x523741&&(_0x3b14e3=_0x3f185b[_0x1be53c(0x260)]['filter'](_0x4a90f4=>matchGlobPattern(_0x4a90f4[_0x1be53c(0x288)]['name'],_0x523741)));const _0x3f7a0f=_0x188645[_0x1be53c(0x24f)]==='json'||_0x188645[_0x1be53c(0x24f)]==='jsonl'||_0x188645[_0x1be53c(0x24f)]==='table'||_0x188645['format']===_0x1be53c(0x26b);if(_0x3f7a0f){const _0x3bc914=_0x3b14e3[_0x1be53c(0x1e4)](_0x52e0b8=>({...toLLMProjectInfo(_0x52e0b8),'url':getLLMProjectUrl(_0x45b84e,_0x52e0b8['id'])}));await handleSDKOutput(_0x3bc914,_0x188645);}else{const _0x50802c=[];if(_0x3b14e3['length']===0x0)_0x50802c['push'](_0x23a6f4[_0x1be53c(0x278)](_0x1be53c(0x275)));else{const _0x36c507=[..._0x3b14e3][_0x1be53c(0x227)]((_0x41173b,_0x104bc6)=>_0x41173b[_0x1be53c(0x288)][_0x1be53c(0x1d0)][_0x1be53c(0x23d)](_0x104bc6[_0x1be53c(0x288)][_0x1be53c(0x1d0)]));for(const _0x2008fd of _0x36c507){const _0xc0c4e7=getLLMProjectUrl(_0x45b84e,_0x2008fd['id']),_0x3b96de=hyperlink(_0x2008fd['attributes'][_0x1be53c(0x1d0)],_0xc0c4e7);_0x50802c['push']('⚒️\x20'+_0x3b96de);}_0x50802c['push'](_0x23a6f4[_0x1be53c(0x278)](_0x3b14e3['length']+'\x20project(s)'));}await writeOutput(_0x50802c[_0x1be53c(0x241)]('\x0a'),_0x188645[_0x1be53c(0x246)],'table');}return 0x0;}catch(_0x3374d6){return handleSDKError(_0x3374d6,_0x188645),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a19_0x56d8bc(0x1d0)]=a19_0x56d8bc(0x252);['description']=a19_0x56d8bc(0x23e);async[a19_0x56d8bc(0x1dc)](_0x3f107c){const _0x54f871=a19_0x56d8bc,{options:_0x14c7a6,args:_0x2ce896,tdx:_0x2f5fa2}=_0x3f107c,_0x14062e=getChalk(_0x14c7a6),_0x4cefd6=_0x14c7a6[_0x54f871(0x27c)];try{const _0x2b3b21=_0x2ce896[0x0];let _0x1c09ef=_0x2b3b21,_0x5d194e,_0x1a668f;if(_0x2b3b21&&_0x2b3b21[_0x54f871(0x272)]('/')){const _0x464624=_0x2b3b21[_0x54f871(0x29e)]('/');if(_0x464624[_0x54f871(0x284)]===0x2){const [_0x199f3f,_0x335b5d]=_0x464624,_0x4c189d=await _0x2f5fa2[_0x54f871(0x200)][_0x54f871(0x214)](),_0x142b94=_0x4c189d[_0x54f871(0x20e)](_0x169b2a=>_0x169b2a[_0x54f871(0x288)][_0x54f871(0x1d0)][_0x54f871(0x1ec)]()===_0x199f3f[_0x54f871(0x1ec)]());if(!_0x142b94)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0x199f3f,undefined,{'helpText':_0x54f871(0x242)});_0x5d194e=_0x142b94['id'],_0x1a668f=_0x142b94[_0x54f871(0x288)][_0x54f871(0x1d0)],_0x1c09ef=_0x335b5d;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x54f871(0x249)+_0x2b3b21,undefined,{'helpText':_0x54f871(0x28c)});}else{const _0x1f5780=await getProjectWithName(_0x3f107c);_0x5d194e=_0x1f5780['id'],_0x1a668f=_0x1f5780[_0x54f871(0x1d0)];}const _0xc5084e=await withSpinner(_0x54f871(0x207),()=>_0x2f5fa2[_0x54f871(0x200)][_0x54f871(0x296)](_0x5d194e),{'verbose':_0x14c7a6[_0x54f871(0x250)]});let _0x590d82=_0xc5084e['data'];_0x1c09ef&&(_0x590d82=_0xc5084e[_0x54f871(0x260)][_0x54f871(0x2a0)](_0x198af6=>matchGlobPattern(_0x198af6[_0x54f871(0x288)]['name'],_0x1c09ef)));const _0x3b6cd9=_0x14c7a6['format']===_0x54f871(0x24e)||_0x14c7a6[_0x54f871(0x24f)]===_0x54f871(0x212)||_0x14c7a6[_0x54f871(0x24f)]===_0x54f871(0x22c)||_0x14c7a6[_0x54f871(0x24f)]===_0x54f871(0x26b);if(_0x3b6cd9){const _0x3febbd=_0x590d82[_0x54f871(0x1e4)](_0x12513b=>({...toAgentInfo(_0x12513b),'chatUrl':getLLMAgentChatUrl(_0x4cefd6,_0x5d194e,_0x12513b['id'])}));await handleSDKOutput(_0x3febbd,_0x14c7a6);}else{const _0x38aa91=[];_0x38aa91['push'](_0x14062e[_0x54f871(0x278)]('['+_0x1a668f+']'));if(_0x590d82[_0x54f871(0x284)]===0x0)_0x38aa91[_0x54f871(0x243)](_0x14062e[_0x54f871(0x278)](_0x54f871(0x21d)));else{const _0xade4ef=[..._0x590d82][_0x54f871(0x227)]((_0x1fbc1e,_0x413291)=>_0x1fbc1e[_0x54f871(0x288)][_0x54f871(0x1d0)][_0x54f871(0x23d)](_0x413291[_0x54f871(0x288)]['name']));for(const _0x21a22a of _0xade4ef){const _0x1fc596=getLLMAgentChatUrl(_0x4cefd6,_0x5d194e,_0x21a22a['id']),_0x432201=hyperlink(_0x21a22a['attributes'][_0x54f871(0x1d0)],_0x1fc596);_0x38aa91[_0x54f871(0x243)](_0x54f871(0x233)+_0x432201);}_0x38aa91[_0x54f871(0x243)](_0x14062e['dim'](_0x590d82[_0x54f871(0x284)]+_0x54f871(0x1d7)));}await writeOutput(_0x38aa91[_0x54f871(0x241)]('\x0a'),_0x14c7a6['output'],_0x54f871(0x22c));}return 0x0;}catch(_0x103365){return handleSDKError(_0x103365,_0x14c7a6),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{['name']=a19_0x56d8bc(0x259);[a19_0x56d8bc(0x1f7)]='Show\x20agent\x20details';async[a19_0x56d8bc(0x1dc)](_0x3f8beb){const _0x1b2225=a19_0x56d8bc,{options:_0x2cd632,args:_0xefa6b7,tdx:_0x67416a}=_0x3f8beb;if(_0xefa6b7[_0x1b2225(0x284)]===0x0)return console[_0x1b2225(0x28e)](_0x1b2225(0x1e6)),console[_0x1b2225(0x28e)](_0x1b2225(0x210)),0x1;const _0x2c490f=_0xefa6b7[0x0];try{const _0x7e080f=await getProjectIdOrDefault(_0x3f8beb),_0x355342=await withSpinner('Resolving\x20agent\x20\x27'+_0x2c490f+_0x1b2225(0x20b),()=>_0x67416a[_0x1b2225(0x200)][_0x1b2225(0x201)](_0x2c490f,_0x7e080f),{'verbose':_0x2cd632[_0x1b2225(0x250)]}),_0x5115d8=await withSpinner('Fetching\x20agent...',()=>_0x67416a[_0x1b2225(0x200)][_0x1b2225(0x208)](_0x355342[_0x1b2225(0x260)]),{'verbose':_0x2cd632[_0x1b2225(0x250)]});return await handleSDKOutput([_0x5115d8[_0x1b2225(0x260)]],_0x2cd632),0x0;}catch(_0x1c92ba){return handleSDKError(_0x1c92ba,_0x2cd632),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{['name']='llm:agent:create';[a19_0x56d8bc(0x1f7)]='Create\x20a\x20new\x20agent\x20in\x20current\x20project';async[a19_0x56d8bc(0x1dc)](_0x577d01){const _0x3bb9c2=a19_0x56d8bc,{options:_0x364261,args:_0x5b4a99,tdx:_0x39eaae}=_0x577d01;if(_0x5b4a99[_0x3bb9c2(0x284)]===0x0)return console['error'](_0x3bb9c2(0x1e6)),console['error'](_0x3bb9c2(0x289)),console[_0x3bb9c2(0x28e)](_0x3bb9c2(0x292)),0x1;const _0x4f615b=_0x5b4a99[0x0],_0x1a9c91=_0x364261,_0x429568=_0x1a9c91[_0x3bb9c2(0x1e5)],_0xd5a57=_0x1a9c91[_0x3bb9c2(0x24b)]||'claude-4.5-haiku',_0x318a7f=_0x1a9c91[_0x3bb9c2(0x22d)],_0x5f5c00=_0x1a9c91['maxToolIterations']?Number(_0x1a9c91[_0x3bb9c2(0x283)]):undefined,_0x98ce60=_0x1a9c91[_0x3bb9c2(0x1f3)]?Number(_0x1a9c91[_0x3bb9c2(0x1f3)]):undefined;try{let _0x58d932,_0x34d318;if(_0x4f615b['includes']('/')){const _0x756b06=_0x4f615b[_0x3bb9c2(0x29e)]('/');if(_0x756b06[_0x3bb9c2(0x284)]===0x2){const [_0x4d7b49,_0x1c915f]=_0x756b06,_0x36a9cb=await withSpinner('Resolving\x20project\x20\x27'+_0x4d7b49+_0x3bb9c2(0x20b),()=>_0x39eaae[_0x3bb9c2(0x200)]['resolveProjectId'](_0x4d7b49),{'verbose':_0x364261['verbose']});_0x58d932=_0x36a9cb[_0x3bb9c2(0x260)],_0x34d318=_0x1c915f;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3bb9c2(0x249)+_0x4f615b,undefined,{'helpText':_0x3bb9c2(0x28c)});}else _0x58d932=await getProjectIdOrDefault(_0x577d01),_0x34d318=_0x4f615b;const _0x1a9749=await withSpinner(_0x3bb9c2(0x1e0)+_0x34d318+'\x27...',()=>_0x39eaae[_0x3bb9c2(0x200)]['createAgent']({'name':_0x34d318,'projectId':_0x58d932,'modelType':_0xd5a57,'systemPrompt':_0x429568,'starterMessage':_0x318a7f,'maxToolIterations':_0x5f5c00,'temperature':_0x98ce60}),{'verbose':_0x364261['verbose']});return console[_0x3bb9c2(0x1f9)](_0x3bb9c2(0x281)+_0x1a9749[_0x3bb9c2(0x260)]['id']),await handleSDKOutput([_0x1a9749['data']],_0x364261),0x0;}catch(_0x21b462){return handleSDKError(_0x21b462,_0x364261),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{[a19_0x56d8bc(0x1d0)]=a19_0x56d8bc(0x28b);[a19_0x56d8bc(0x1f7)]=a19_0x56d8bc(0x29b);async['execute'](_0x206435){const _0x5f0a30=a19_0x56d8bc,{options:_0x5037d2,args:_0x214e20,tdx:_0x2fbb35}=_0x206435;if(_0x214e20[_0x5f0a30(0x284)]===0x0)return console[_0x5f0a30(0x28e)](_0x5f0a30(0x1e6)),console[_0x5f0a30(0x28e)](_0x5f0a30(0x1dd)),0x1;const _0x232113=_0x214e20[0x0],_0x4c721f=_0x5037d2,_0x24d4e0=_0x4c721f[_0x5f0a30(0x1d0)],_0xaf0d5d=_0x4c721f['prompt'],_0x1ccac3=_0x4c721f[_0x5f0a30(0x1f7)],_0x1c27fd=_0x4c721f[_0x5f0a30(0x22d)];if(!_0x24d4e0&&!_0xaf0d5d&&!_0x1ccac3&&!_0x1c27fd)return console[_0x5f0a30(0x28e)]('Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required'),console[_0x5f0a30(0x28e)](_0x5f0a30(0x23f)),0x1;try{const _0x8bd104=await getProjectIdOrDefault(_0x206435),_0x4d877a=await withSpinner('Resolving\x20agent\x20\x27'+_0x232113+_0x5f0a30(0x20b),()=>_0x2fbb35['llm']['resolveAgentId'](_0x232113,_0x8bd104),{'verbose':_0x5037d2[_0x5f0a30(0x250)]}),_0x51f7ff=_0x4d877a[_0x5f0a30(0x260)],_0x524bc6=await withSpinner(_0x5f0a30(0x20a),()=>_0x2fbb35[_0x5f0a30(0x200)][_0x5f0a30(0x1fa)](_0x51f7ff,{'name':_0x24d4e0,'prompt':_0xaf0d5d,'description':_0x1ccac3,'starterMessage':_0x1c27fd}),{'verbose':_0x5037d2[_0x5f0a30(0x250)]});return console[_0x5f0a30(0x1f9)](_0x5f0a30(0x222)+_0x524bc6[_0x5f0a30(0x260)]['id']),await handleSDKOutput([_0x524bc6[_0x5f0a30(0x260)]],_0x5037d2),0x0;}catch(_0x307285){return handleSDKError(_0x307285,_0x5037d2),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a19_0x56d8bc(0x1d0)]=a19_0x56d8bc(0x231);[a19_0x56d8bc(0x1f7)]=a19_0x56d8bc(0x25a);async['execute'](_0x1a2240){const _0x4b7da8=a19_0x56d8bc,{options:_0x8e5964,args:_0x40ffa4,tdx:_0x5c242a}=_0x1a2240;if(_0x40ffa4[_0x4b7da8(0x284)]===0x0)return console[_0x4b7da8(0x28e)](_0x4b7da8(0x1e6)),console[_0x4b7da8(0x28e)]('Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>'),0x1;const _0xfe18fa=_0x40ffa4[0x0];try{const _0x45dd2a=await getProjectIdOrDefault(_0x1a2240),_0x58e6a8=await withSpinner(_0x4b7da8(0x277)+_0xfe18fa+_0x4b7da8(0x20b),()=>_0x5c242a[_0x4b7da8(0x200)][_0x4b7da8(0x201)](_0xfe18fa,_0x45dd2a),{'verbose':_0x8e5964[_0x4b7da8(0x250)]}),_0x5177d9=_0x58e6a8[_0x4b7da8(0x260)];return await withSpinner(_0x4b7da8(0x22e),()=>_0x5c242a[_0x4b7da8(0x200)][_0x4b7da8(0x1f6)](_0x5177d9),{'verbose':_0x8e5964['verbose']}),console[_0x4b7da8(0x1f9)](_0x4b7da8(0x211)+_0x5177d9),0x0;}catch(_0x102617){return handleSDKError(_0x102617,_0x8e5964),0x1;}}}export class LLMHistoryCommand extends BaseCommand{['name']='llm:history';[a19_0x56d8bc(0x1f7)]='Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions';async['execute'](_0x254b78){return executeChatHistoryCommand(_0x254b78,'tdx\x20llm\x20history');}}export class LLMUseCommand extends BaseCommand{['name']='llm:use';[a19_0x56d8bc(0x1f7)]=a19_0x56d8bc(0x253);async[a19_0x56d8bc(0x1dc)](_0x4c10ec){const _0x24020e=a19_0x56d8bc,{options:_0x227346,args:_0x2fd025,tdx:_0x3f9d51}=_0x4c10ec;if(_0x2fd025[_0x24020e(0x284)]===0x0)return console[_0x24020e(0x28e)](_0x24020e(0x223)),console[_0x24020e(0x28e)](_0x24020e(0x264)),0x1;const _0x4a1524=_0x2fd025[0x0];try{return await withSpinner(_0x24020e(0x25e)+_0x4a1524+_0x24020e(0x20b),()=>_0x3f9d51[_0x24020e(0x200)][_0x24020e(0x1f4)](_0x4a1524),{'verbose':_0x227346[_0x24020e(0x250)]}),console[_0x24020e(0x1f9)](_0x24020e(0x24c)+_0x4a1524),0x0;}catch(_0x1dbe29){return handleSDKError(_0x1dbe29,_0x227346),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{['name']='llm:project:create';[a19_0x56d8bc(0x1f7)]='Create\x20a\x20new\x20LLM\x20project';async[a19_0x56d8bc(0x1dc)](_0xe16cb9){const _0x4a163d=a19_0x56d8bc,{options:_0x6e3555,args:_0x1b3b1d,tdx:_0x4a9fb9}=_0xe16cb9;if(_0x1b3b1d[_0x4a163d(0x284)]===0x0)return console['error'](_0x4a163d(0x223)),console[_0x4a163d(0x28e)]('Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]'),0x1;const _0x39cc33=_0x1b3b1d[0x0],_0x103f3e=_0x6e3555,_0x70cb7c=_0x103f3e[_0x4a163d(0x1f7)];try{const _0x2bb589=await withSpinner(_0x4a163d(0x273)+_0x39cc33+_0x4a163d(0x20b),()=>_0x4a9fb9[_0x4a163d(0x200)][_0x4a163d(0x27a)]({'name':_0x39cc33,'description':_0x70cb7c}),{'verbose':_0x6e3555[_0x4a163d(0x250)]});console[_0x4a163d(0x1f9)](_0x4a163d(0x26d)+_0x2bb589[_0x4a163d(0x260)]['id']);const _0x22e5ca=toLLMProjectInfo(_0x2bb589[_0x4a163d(0x260)]);return await handleSDKOutput([_0x22e5ca],_0x6e3555),0x0;}catch(_0x26cc4f){return handleSDKError(_0x26cc4f,_0x6e3555),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a19_0x56d8bc(0x1d0)]=a19_0x56d8bc(0x257);[a19_0x56d8bc(0x1f7)]=a19_0x56d8bc(0x295);async[a19_0x56d8bc(0x1dc)](_0x47ccfe){const _0x28cd10=a19_0x56d8bc,{options:_0x14a6ff,args:_0x3225ee,tdx:_0x4e1484}=_0x47ccfe;if(_0x3225ee['length']===0x0)return console[_0x28cd10(0x28e)]('Error:\x20Project\x20name\x20is\x20required'),console[_0x28cd10(0x28e)]('Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>'),0x1;const _0x5690f7=_0x3225ee[0x0];try{return await withSpinner('Deleting\x20project\x20\x27'+_0x5690f7+_0x28cd10(0x20b),()=>_0x4e1484[_0x28cd10(0x200)][_0x28cd10(0x25d)](_0x5690f7),{'verbose':_0x14a6ff[_0x28cd10(0x250)]}),console['log'](_0x28cd10(0x25f)+_0x5690f7),0x0;}catch(_0x2497a9){return handleSDKError(_0x2497a9,_0x14a6ff),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a19_0x56d8bc(0x1d0)]=a19_0x56d8bc(0x21a);[a19_0x56d8bc(0x1f7)]=a19_0x56d8bc(0x262);async['execute'](_0x542cae){const _0xc6a169=a19_0x56d8bc,{options:_0x33f677,args:_0x15ca78,tdx:_0x57e72e}=_0x542cae,_0x3aaa59=getChalk(_0x33f677);console['log'](_0x3aaa59[_0xc6a169(0x286)](_0xc6a169(0x21f))),console[_0xc6a169(0x1f9)](_0x3aaa59['yellow']('\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.')),console[_0xc6a169(0x1f9)](_0x3aaa59[_0xc6a169(0x278)]('\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents')),console[_0xc6a169(0x1f9)]();if(_0x15ca78[_0xc6a169(0x284)]===0x0)return console[_0xc6a169(0x28e)](_0xc6a169(0x223)),console[_0xc6a169(0x28e)](_0xc6a169(0x28d)),0x1;const _0x1566d6=_0x15ca78[0x0],_0x4dcdf4=_0x33f677,_0x264627=_0x4dcdf4['output'],_0x3a0b48=_0x4dcdf4['dryRun'];try{const _0x54a590=_0x264627||_0x1566d6+_0xc6a169(0x1df);if(a19_0x3d840f[_0xc6a169(0x215)](_0x54a590)&&!_0x3a0b48){if(!_0x33f677['yes']){const _0x3f970f=await confirm(_0xc6a169(0x1f8)+_0x54a590+'\x27\x20already\x20exists.\x20Overwrite?');if(!_0x3f970f)return console[_0xc6a169(0x1f9)](_0xc6a169(0x269)),0x0;}a19_0x3d840f['rmSync'](_0x54a590,{'recursive':!![]});}const _0x76f3ea=await withSpinner(_0x3a0b48?_0xc6a169(0x1fc)+_0x1566d6+_0xc6a169(0x20b):_0xc6a169(0x23a)+_0x1566d6+'\x27...',()=>_0x57e72e[_0xc6a169(0x200)]['backupProject'](_0x1566d6,_0x264627,{'dryRun':_0x3a0b48}),{'verbose':_0x33f677[_0xc6a169(0x250)]}),_0x297adf=_0x76f3ea['data'];return _0x3a0b48?console[_0xc6a169(0x1f9)]('[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20'+_0x297adf[_0xc6a169(0x1e3)]):console[_0xc6a169(0x1f9)](_0xc6a169(0x240)+_0x297adf['outputDir']),console[_0xc6a169(0x1f9)](_0xc6a169(0x228)+_0x297adf[_0xc6a169(0x270)][_0xc6a169(0x296)]),console['log']('\x20\x20Knowledge\x20Bases:\x20'+_0x297adf[_0xc6a169(0x270)]['knowledgeBases']),console[_0xc6a169(0x1f9)](_0xc6a169(0x20d)+_0x297adf[_0xc6a169(0x270)][_0xc6a169(0x239)]),console['log'](_0xc6a169(0x27d)+_0x297adf[_0xc6a169(0x270)]['integrations']),(_0x33f677['format']===_0xc6a169(0x24e)||_0x33f677[_0xc6a169(0x24f)]===_0xc6a169(0x212))&&await handleSDKOutput([_0x297adf],_0x33f677),0x0;}catch(_0x81312b){return handleSDKError(_0x81312b,_0x33f677),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a19_0x56d8bc(0x1d0)]='llm:project:restore';[a19_0x56d8bc(0x1f7)]=a19_0x56d8bc(0x279);async[a19_0x56d8bc(0x1dc)](_0x4ffb38){const _0x1527ce=a19_0x56d8bc,{options:_0x2e63d8,args:_0x44dd25,tdx:_0x13089a}=_0x4ffb38,_0x3ed9c2=getChalk(_0x2e63d8);console[_0x1527ce(0x1f9)](_0x3ed9c2[_0x1527ce(0x286)]('⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.')),console['log'](_0x3ed9c2[_0x1527ce(0x286)](_0x1527ce(0x1d4))),console['log'](_0x3ed9c2[_0x1527ce(0x278)](_0x1527ce(0x1eb))),console[_0x1527ce(0x1f9)](_0x3ed9c2[_0x1527ce(0x278)]('\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/')),console['log'](_0x3ed9c2[_0x1527ce(0x278)](_0x1527ce(0x218))),console[_0x1527ce(0x1f9)]();if(_0x44dd25[_0x1527ce(0x284)]===0x0)return console[_0x1527ce(0x28e)](_0x1527ce(0x29a)),console[_0x1527ce(0x28e)](_0x1527ce(0x22f)),0x1;const _0x16df85=_0x44dd25[0x0],_0x577ff8=_0x2e63d8,_0x42c91d=_0x577ff8['name'],_0xfbe290=_0x577ff8[_0x1527ce(0x234)];try{if(!_0xfbe290){const _0xc9cb36=_0x13089a[_0x1527ce(0x200)]['getBackupMetadata'](_0x16df85),_0x3efb9d=_0x42c91d||_0xc9cb36[_0x1527ce(0x1d2)][_0x1527ce(0x297)],_0x4a6265=await withSpinner(_0x1527ce(0x265),()=>_0x13089a[_0x1527ce(0x200)]['projects'](),{'verbose':_0x2e63d8[_0x1527ce(0x250)]}),_0x5850fb=_0x4a6265['data'][_0x1527ce(0x20e)](_0x247b4d=>_0x247b4d[_0x1527ce(0x288)][_0x1527ce(0x1d0)]===_0x3efb9d);if(_0x5850fb&&!_0x2e63d8[_0x1527ce(0x224)]){const _0x744eb7=await confirm('A\x20project\x20named\x20\x27'+_0x3efb9d+_0x1527ce(0x244));if(!_0x744eb7)return console[_0x1527ce(0x1f9)](_0x1527ce(0x1e2)),0x0;}}const _0x396972=await withSpinner(_0xfbe290?_0x1527ce(0x1ee)+_0x16df85+_0x1527ce(0x20b):'Restoring\x20project\x20from\x20\x27'+_0x16df85+'\x27...',()=>_0x13089a[_0x1527ce(0x200)][_0x1527ce(0x206)](_0x16df85,{'name':_0x42c91d,'dryRun':_0xfbe290}),{'verbose':_0x2e63d8[_0x1527ce(0x250)]}),_0x3c9036=_0x396972[_0x1527ce(0x260)];return _0x3c9036[_0x1527ce(0x213)]&&console[_0x1527ce(0x1f9)](_0x1527ce(0x255)+_0x3c9036[_0x1527ce(0x213)]+'\x27'),_0xfbe290?console[_0x1527ce(0x1f9)]('[DRY\x20RUN]\x20Would\x20restore\x20project:\x20'+_0x3c9036[_0x1527ce(0x297)]):console[_0x1527ce(0x1f9)](_0x1527ce(0x225)+_0x3c9036[_0x1527ce(0x297)]+'\x20('+_0x3c9036['projectId']+')'),console[_0x1527ce(0x1f9)](_0x1527ce(0x228)+_0x3c9036[_0x1527ce(0x270)][_0x1527ce(0x296)]),console[_0x1527ce(0x1f9)](_0x1527ce(0x251)+_0x3c9036[_0x1527ce(0x270)][_0x1527ce(0x248)]),console['log'](_0x1527ce(0x20d)+_0x3c9036[_0x1527ce(0x270)][_0x1527ce(0x239)]),console[_0x1527ce(0x1f9)](_0x1527ce(0x27d)+_0x3c9036[_0x1527ce(0x270)][_0x1527ce(0x1fd)]),(_0x2e63d8[_0x1527ce(0x24f)]==='json'||_0x2e63d8[_0x1527ce(0x24f)]===_0x1527ce(0x212))&&await handleSDKOutput([_0x3c9036],_0x2e63d8),0x0;}catch(_0x3412b9){return handleSDKError(_0x3412b9,_0x2e63d8),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x1ca5e2,_0x21785d){const _0x2304ff=a19_0x56d8bc,_0x2ff13d=_0x21785d[_0x2304ff(0x254)]||CHAT_SELECTOR_PAGE_SIZE;let _0x57ebd4=0x0,_0x167a65=[];const _0x445951=(await import('prompts'))[_0x2304ff(0x285)],_0xd39db8=getChalk(_0x21785d);while(!![]){const _0x4d1aa5=await withSpinner('Fetching\x20chat\x20sessions...',()=>_0x1ca5e2[_0x2304ff(0x200)][_0x2304ff(0x2a2)](_0x2ff13d+_0x57ebd4),{'verbose':_0x21785d[_0x2304ff(0x250)]});_0x167a65=_0x4d1aa5['data'];const _0x2d4313=_0x167a65[_0x2304ff(0x237)](_0x57ebd4,_0x57ebd4+_0x2ff13d),_0x2d113b=_0x167a65['length']>_0x57ebd4+_0x2ff13d,_0x176be5=[...new Set(_0x2d4313['map'](_0x12c2b0=>_0x12c2b0[_0x2304ff(0x288)][_0x2304ff(0x1e9)])[_0x2304ff(0x2a0)](_0x3c2537=>_0x3c2537!==undefined))],_0x54dec2=new Map();await Promise[_0x2304ff(0x1e1)](_0x176be5[_0x2304ff(0x1e4)](async _0x18e661=>{const _0xcb5aec=_0x2304ff;try{const _0x2e2e39=await _0x1ca5e2[_0xcb5aec(0x200)][_0xcb5aec(0x208)](_0x18e661);_0x54dec2[_0xcb5aec(0x24a)](_0x18e661,_0x2e2e39[_0xcb5aec(0x288)]['name']);}catch{_0x54dec2[_0xcb5aec(0x24a)](_0x18e661,_0x18e661);}}));const _0x434441=_0x2d4313[_0x2304ff(0x1e4)](_0x1b37e0=>{const _0x14e130=_0x2304ff,_0x57d03a=_0x1b37e0['attributes']['firstInputContent']||_0x14e130(0x1d5),_0x2f20d1=_0x57d03a[_0x14e130(0x29e)]('\x0a')[0x0],_0x3d00fe=_0x2f20d1['length']>0x50?_0x2f20d1[_0x14e130(0x268)](0x0,0x4d)+_0x14e130(0x1fb):_0x2f20d1,_0x58eb41=_0x1b37e0[_0x14e130(0x288)]['agentId']?_0x54dec2[_0x14e130(0x220)](_0x1b37e0[_0x14e130(0x288)][_0x14e130(0x1e9)])||_0x1b37e0[_0x14e130(0x288)]['agentId']:_0x14e130(0x25b),_0x3e856a=_0x1b37e0[_0x14e130(0x288)][_0x14e130(0x1ff)]||_0x1b37e0['attributes']['updatedAt'],_0x5d1179=new Date(_0x3e856a),_0x40ddb4=new Date(),_0x32781e=_0x40ddb4[_0x14e130(0x23b)]()-_0x5d1179[_0x14e130(0x23b)](),_0x55c784=Math[_0x14e130(0x290)](_0x32781e/0xea60),_0x2bdaa5=Math[_0x14e130(0x290)](_0x32781e/0x36ee80),_0x1e2bc7=Math[_0x14e130(0x290)](_0x32781e/0x5265c00);let _0x338c9b;if(_0x55c784<0x1)_0x338c9b=_0x14e130(0x20c);else{if(_0x55c784<0x3c)_0x338c9b=_0x55c784+_0x14e130(0x204);else{if(_0x2bdaa5<0x18)_0x338c9b=_0x2bdaa5+'h\x20ago';else _0x1e2bc7<0x7?_0x338c9b=_0x1e2bc7+_0x14e130(0x245):_0x338c9b=_0x5d1179[_0x14e130(0x1da)]('en-US',{'month':_0x14e130(0x216),'day':_0x14e130(0x1ef)});}}return{'title':_0x3d00fe+'\x20'+_0xd39db8['dim']('['+_0x58eb41+']\x20'+_0x338c9b),'value':_0x1b37e0['id']};});_0x2d113b&&_0x434441['push']({'title':_0xd39db8['cyan']('Load\x20more...'),'value':'__load_more__'});const _0x4385ca=await _0x445951({'type':_0x2304ff(0x238),'name':_0x2304ff(0x209),'message':_0x2304ff(0x26f),'choices':_0x434441,'hint':_0x2304ff(0x293)});if(!_0x4385ca[_0x2304ff(0x209)])return undefined;if(_0x4385ca[_0x2304ff(0x209)]===_0x2304ff(0x21c)){_0x57ebd4+=_0x2ff13d;continue;}return _0x4385ca['chatId'];}}export class ChatsCommand extends BaseCommand{[a19_0x56d8bc(0x1d0)]=a19_0x56d8bc(0x2a2);[a19_0x56d8bc(0x1f7)]=a19_0x56d8bc(0x274);async['execute'](_0x25c0f6){return executeChatHistoryCommand(_0x25c0f6,'tdx\x20chats');}}
@@ -1 +1 @@
1
- const a20_0x44490b=a20_0xa06a;(function(_0x49e375,_0x92f0e){const _0x35be6a=a20_0xa06a,_0x3db09a=_0x49e375();while(!![]){try{const _0x18574e=-parseInt(_0x35be6a(0xc7))/0x1+-parseInt(_0x35be6a(0xd3))/0x2+-parseInt(_0x35be6a(0xc1))/0x3*(-parseInt(_0x35be6a(0xdd))/0x4)+-parseInt(_0x35be6a(0xd2))/0x5*(-parseInt(_0x35be6a(0xc9))/0x6)+parseInt(_0x35be6a(0xcf))/0x7*(parseInt(_0x35be6a(0xd4))/0x8)+parseInt(_0x35be6a(0xe1))/0x9+-parseInt(_0x35be6a(0xed))/0xa;if(_0x18574e===_0x92f0e)break;else _0x3db09a['push'](_0x3db09a['shift']());}catch(_0x44cb2b){_0x3db09a['push'](_0x3db09a['shift']());}}}(a20_0x3fed,0xf01ed));function a20_0x3fed(){const _0x328dbe=['1213008BBpAWp','green','163110IybzvO','server','created\x20on-demand\x20per\x20model','exit','SIGINT','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','35189QaYnsE','SIGTERM','\x20\x20Site:','165zINglv','1082848EjESjx','344cIdumk','white','\x20\x20Project:','dim','\x20\x20{','site','start','projects','\x0aTesting\x20with\x20Agent\x20SDK:','4kStHiu','log','find','init','13753323yGEgUv','Port\x20','http://0.0.0.0:','\x20is\x20unavailable,\x20using\x20port\x20','\x0aClaude\x20Code\x20Configuration:','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript','project','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','close','llmProject','attributes','9050290gBJngy','name','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','yellow','port','\x20\x20}','bold','Server\x20Configuration:','logger','✓\x20Proxy\x20server\x20stopped','\x27\x20not\x20found','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','stop','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','cyan','llm','3004743EGuBQu','getOrCreateDefaultProject','Resolving\x20project...','\x20\x20Agents:','Project\x20\x27','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:'];a20_0x3fed=function(){return _0x328dbe;};return a20_0x3fed();}import a20_0x2bed84 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';async function getProjectIdOrDefault(_0xa7769c,_0x3f3750){const _0x2f8908=a20_0xa06a,{tdx:_0x5c30fb,options:_0x1d6394}=_0xa7769c,_0xa8afeb=_0x3f3750||_0x1d6394[_0x2f8908(0xeb)];if(_0xa8afeb){const _0x264afe=await _0x5c30fb[_0x2f8908(0xc0)][_0x2f8908(0xdb)](),_0xa17000=_0x264afe[_0x2f8908(0xdf)](_0x31fb21=>_0x31fb21['attributes'][_0x2f8908(0xb2)]===_0xa8afeb);if(!_0xa17000)throw new SDKError(ErrorCode['NOT_FOUND'],_0x2f8908(0xc5)+_0xa8afeb+_0x2f8908(0xbb),undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects'});return _0xa17000['id'];}const _0x3cfadc=await _0x5c30fb[_0x2f8908(0xc0)][_0x2f8908(0xc2)]();return _0x3cfadc['id'];}function a20_0xa06a(_0x407284,_0xd4c84c){_0x407284=_0x407284-0xb2;const _0x3fede9=a20_0x3fed();let _0xa06a70=_0x3fede9[_0x407284];return _0xa06a70;}export class LLMProxyCommand extends BaseCommand{[a20_0x44490b(0xb2)]='llm:proxy';['description']='[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration';['server'];[a20_0x44490b(0xb9)];async['execute'](_0x1634b5){const _0xaec23a=a20_0x44490b,{tdx:_0x50f775,options:_0xcb06f6}=_0x1634b5;try{const _0x27a957=_0xcb06f6,_0x3bd491=_0x27a957[_0xaec23a(0xb5)]||0xfa0,_0x5ef5c2=_0x27a957[_0xaec23a(0xe8)],_0xf49689=await findAvailablePort(_0x3bd491);console[_0xaec23a(0xde)](a20_0x2bed84[_0xaec23a(0xd7)](_0xaec23a(0xc3)));const _0x245089=await getProjectIdOrDefault(_0x1634b5,_0x5ef5c2),_0x34ee22=await _0x50f775[_0xaec23a(0xc0)][_0xaec23a(0xdb)](),_0xbc0d5d=_0x34ee22['find'](_0x55b8f3=>_0x55b8f3['id']===_0x245089);this[_0xaec23a(0xb9)]=new TDXLogger(_0xcb06f6['logLevel']),await this[_0xaec23a(0xb9)][_0xaec23a(0xe0)](),console[_0xaec23a(0xde)](a20_0x2bed84[_0xaec23a(0xd7)]('Starting\x20proxy\x20server...'));_0xf49689!==_0x3bd491&&console[_0xaec23a(0xde)](a20_0x2bed84[_0xaec23a(0xb4)](_0xaec23a(0xe2)+_0x3bd491+_0xaec23a(0xe4)+_0xf49689));this[_0xaec23a(0xca)]=new ProxyServer({'port':_0xf49689,'projectId':_0x245089,'tdx':_0x50f775,'logger':this['logger'],'site':_0xcb06f6[_0xaec23a(0xd9)]}),await this[_0xaec23a(0xca)][_0xaec23a(0xda)](),console['log'](a20_0x2bed84[_0xaec23a(0xb4)][_0xaec23a(0xb7)]('\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE')),console[_0xaec23a(0xde)](a20_0x2bed84[_0xaec23a(0xb4)](_0xaec23a(0xbc))),console['log'](a20_0x2bed84[_0xaec23a(0xb4)](_0xaec23a(0xbe))),console[_0xaec23a(0xde)](a20_0x2bed84['green']['bold']('✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a')),console[_0xaec23a(0xde)](a20_0x2bed84['cyan'](_0xaec23a(0xb8))),console[_0xaec23a(0xde)](a20_0x2bed84[_0xaec23a(0xd7)]('\x20\x20Address:'),a20_0x2bed84[_0xaec23a(0xd5)](_0xaec23a(0xe3)+_0xf49689)),console[_0xaec23a(0xde)](a20_0x2bed84[_0xaec23a(0xd7)](_0xaec23a(0xd6)),a20_0x2bed84['white'](_0xbc0d5d?.[_0xaec23a(0xec)][_0xaec23a(0xb2)]||_0x245089)),console['log'](a20_0x2bed84[_0xaec23a(0xd7)](_0xaec23a(0xc4)),a20_0x2bed84[_0xaec23a(0xd5)](_0xaec23a(0xcb))),console[_0xaec23a(0xde)](a20_0x2bed84[_0xaec23a(0xd7)](_0xaec23a(0xd1)),a20_0x2bed84[_0xaec23a(0xd5)](_0xcb06f6[_0xaec23a(0xd9)])),console[_0xaec23a(0xde)](a20_0x2bed84[_0xaec23a(0xbf)](_0xaec23a(0xe5))),console[_0xaec23a(0xde)](a20_0x2bed84[_0xaec23a(0xd7)](_0xaec23a(0xce))),console[_0xaec23a(0xde)](a20_0x2bed84['white'](_0xaec23a(0xd8))),console['log'](a20_0x2bed84[_0xaec23a(0xd5)]('\x20\x20\x20\x20\x22env\x22:\x20{')),console[_0xaec23a(0xde)](a20_0x2bed84[_0xaec23a(0xd5)](_0xaec23a(0xc6)+_0xf49689+'\x22,')),console[_0xaec23a(0xde)](a20_0x2bed84[_0xaec23a(0xd5)](_0xaec23a(0xb3))),console[_0xaec23a(0xde)](a20_0x2bed84[_0xaec23a(0xd5)](_0xaec23a(0xe6))),console[_0xaec23a(0xde)](a20_0x2bed84[_0xaec23a(0xd5)]('\x20\x20\x20\x20}')),console[_0xaec23a(0xde)](a20_0x2bed84['white'](_0xaec23a(0xb6))),console[_0xaec23a(0xde)](a20_0x2bed84['cyan'](_0xaec23a(0xdc))),console['log'](a20_0x2bed84[_0xaec23a(0xd7)]('\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK')),console[_0xaec23a(0xde)](a20_0x2bed84[_0xaec23a(0xd7)](_0xaec23a(0xe7))),console[_0xaec23a(0xde)](a20_0x2bed84[_0xaec23a(0xd7)]('\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a')),console[_0xaec23a(0xde)](a20_0x2bed84[_0xaec23a(0xb4)](_0xaec23a(0xe9)));const _0x21102a=async()=>{const _0x442808=_0xaec23a;console[_0x442808(0xde)](a20_0x2bed84['dim']('\x0a\x0aShutting\x20down\x20proxy\x20server...')),this[_0x442808(0xca)]&&await this['server'][_0x442808(0xbd)](),this[_0x442808(0xb9)]&&await this['logger'][_0x442808(0xea)](),console['log'](a20_0x2bed84[_0x442808(0xc8)](_0x442808(0xba))),process[_0x442808(0xcc)](0x0);};return process['on'](_0xaec23a(0xcd),_0x21102a),process['on'](_0xaec23a(0xd0),_0x21102a),await new Promise(()=>{}),0x0;}catch(_0x296f85){this['server']&&await this['server'][_0xaec23a(0xbd)]();this[_0xaec23a(0xb9)]&&await this[_0xaec23a(0xb9)][_0xaec23a(0xea)]();throw _0x296f85;}}}
1
+ const a20_0x409d64=a20_0x3928;(function(_0x2253b2,_0x1ce24d){const _0x1646af=a20_0x3928,_0x1dcdb8=_0x2253b2();while(!![]){try{const _0x48cc91=parseInt(_0x1646af(0x15d))/0x1+-parseInt(_0x1646af(0x146))/0x2+-parseInt(_0x1646af(0x156))/0x3+-parseInt(_0x1646af(0x139))/0x4*(parseInt(_0x1646af(0x124))/0x5)+-parseInt(_0x1646af(0x126))/0x6+parseInt(_0x1646af(0x159))/0x7+parseInt(_0x1646af(0x12b))/0x8*(parseInt(_0x1646af(0x140))/0x9);if(_0x48cc91===_0x1ce24d)break;else _0x1dcdb8['push'](_0x1dcdb8['shift']());}catch(_0x207377){_0x1dcdb8['push'](_0x1dcdb8['shift']());}}}(a20_0x1d0a,0x9fdd9));import a20_0x2bffc5 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 a20_0x1d0a(){const _0x315775=['projects','dim','find','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','http://0.0.0.0:','site','attributes','logLevel','SIGINT','\x20\x20{','close','logger','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','1496211KMWJtv','log','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','7901516QtARtC','green','[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration','white','641012mTvKZT','getOrCreateDefaultProject','init','port','exit','5CdvrYQ','bold','885420DKVIzh','\x20\x20Address:','Resolving\x20project...','SIGTERM','created\x20on-demand\x20per\x20model','16HIGNpk','llm:proxy','cyan','start','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','description','NOT_FOUND','llm','server','Port\x20','name','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','\x20\x20Project:','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','1915052MKXokF','stop','Starting\x20proxy\x20server...','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','\x20is\x20unavailable,\x20using\x20port\x20','\x20\x20\x20\x20}','Server\x20Configuration:','1721889CMydCT','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','yellow','llmProject','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,','745126WidyMz','project','Project\x20\x27'];a20_0x1d0a=function(){return _0x315775;};return a20_0x1d0a();}function a20_0x3928(_0x4ef8d0,_0x1125e7){_0x4ef8d0=_0x4ef8d0-0x123;const _0x1d0ae1=a20_0x1d0a();let _0x392857=_0x1d0ae1[_0x4ef8d0];return _0x392857;}import{findAvailablePort}from'../utils/port.js';async function getProjectIdOrDefault(_0x1d28db,_0x317d0c){const _0x334038=a20_0x3928,{tdx:_0x215951,options:_0x1f3c16}=_0x1d28db,_0x381403=_0x317d0c||_0x1f3c16[_0x334038(0x144)];if(_0x381403){const _0x2d96c2=await _0x215951[_0x334038(0x132)]['projects'](),_0x31b0ca=_0x2d96c2['find'](_0x46b05b=>_0x46b05b[_0x334038(0x14f)][_0x334038(0x135)]===_0x381403);if(!_0x31b0ca)throw new SDKError(ErrorCode[_0x334038(0x131)],_0x334038(0x148)+_0x381403+'\x27\x20not\x20found',undefined,{'helpText':_0x334038(0x13c)});return _0x31b0ca['id'];}const _0x15f346=await _0x215951[_0x334038(0x132)][_0x334038(0x15e)]();return _0x15f346['id'];}export class LLMProxyCommand extends BaseCommand{['name']=a20_0x409d64(0x12c);[a20_0x409d64(0x130)]=a20_0x409d64(0x15b);[a20_0x409d64(0x133)];[a20_0x409d64(0x154)];async['execute'](_0x4b941a){const _0x25611e=a20_0x409d64,{tdx:_0x440717,options:_0x4b21d8}=_0x4b941a;try{const _0x3de025=_0x4b21d8,_0xa96baa=_0x3de025[_0x25611e(0x160)]||0xfa0,_0x1800a3=_0x3de025[_0x25611e(0x147)],_0x2c0ea=await findAvailablePort(_0xa96baa);console[_0x25611e(0x157)](a20_0x2bffc5['dim'](_0x25611e(0x128)));const _0x48a77b=await getProjectIdOrDefault(_0x4b941a,_0x1800a3),_0x3cce38=await _0x440717['llm'][_0x25611e(0x149)](),_0x56f39a=_0x3cce38[_0x25611e(0x14b)](_0x485c14=>_0x485c14['id']===_0x48a77b);this[_0x25611e(0x154)]=new TDXLogger(_0x4b21d8[_0x25611e(0x150)]),await this[_0x25611e(0x154)][_0x25611e(0x15f)](),console['log'](a20_0x2bffc5['dim'](_0x25611e(0x13b)));_0x2c0ea!==_0xa96baa&&console[_0x25611e(0x157)](a20_0x2bffc5[_0x25611e(0x143)](_0x25611e(0x134)+_0xa96baa+_0x25611e(0x13d)+_0x2c0ea));this[_0x25611e(0x133)]=new ProxyServer({'port':_0x2c0ea,'projectId':_0x48a77b,'tdx':_0x440717,'logger':this['logger'],'site':_0x4b21d8[_0x25611e(0x14e)]}),await this['server'][_0x25611e(0x12e)](),console[_0x25611e(0x157)](a20_0x2bffc5[_0x25611e(0x143)][_0x25611e(0x125)](_0x25611e(0x155))),console['log'](a20_0x2bffc5[_0x25611e(0x143)](_0x25611e(0x142))),console[_0x25611e(0x157)](a20_0x2bffc5[_0x25611e(0x143)](_0x25611e(0x138))),console['log'](a20_0x2bffc5['green']['bold']('✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a')),console[_0x25611e(0x157)](a20_0x2bffc5[_0x25611e(0x12d)](_0x25611e(0x13f))),console[_0x25611e(0x157)](a20_0x2bffc5['dim'](_0x25611e(0x127)),a20_0x2bffc5[_0x25611e(0x15c)](_0x25611e(0x14d)+_0x2c0ea)),console[_0x25611e(0x157)](a20_0x2bffc5['dim'](_0x25611e(0x137)),a20_0x2bffc5[_0x25611e(0x15c)](_0x56f39a?.[_0x25611e(0x14f)]['name']||_0x48a77b)),console[_0x25611e(0x157)](a20_0x2bffc5[_0x25611e(0x14a)]('\x20\x20Agents:'),a20_0x2bffc5['white'](_0x25611e(0x12a))),console[_0x25611e(0x157)](a20_0x2bffc5['dim']('\x20\x20Site:'),a20_0x2bffc5[_0x25611e(0x15c)](_0x4b21d8[_0x25611e(0x14e)])),console['log'](a20_0x2bffc5[_0x25611e(0x12d)]('\x0aClaude\x20Code\x20Configuration:')),console[_0x25611e(0x157)](a20_0x2bffc5[_0x25611e(0x14a)](_0x25611e(0x158))),console[_0x25611e(0x157)](a20_0x2bffc5[_0x25611e(0x15c)](_0x25611e(0x152))),console['log'](a20_0x2bffc5[_0x25611e(0x15c)]('\x20\x20\x20\x20\x22env\x22:\x20{')),console[_0x25611e(0x157)](a20_0x2bffc5['white'](_0x25611e(0x141)+_0x2c0ea+'\x22,')),console['log'](a20_0x2bffc5[_0x25611e(0x15c)](_0x25611e(0x145))),console[_0x25611e(0x157)](a20_0x2bffc5[_0x25611e(0x15c)](_0x25611e(0x14c))),console[_0x25611e(0x157)](a20_0x2bffc5['white'](_0x25611e(0x13e))),console['log'](a20_0x2bffc5[_0x25611e(0x15c)]('\x20\x20}')),console[_0x25611e(0x157)](a20_0x2bffc5[_0x25611e(0x12d)]('\x0aTesting\x20with\x20Agent\x20SDK:')),console['log'](a20_0x2bffc5[_0x25611e(0x14a)](_0x25611e(0x136))),console[_0x25611e(0x157)](a20_0x2bffc5[_0x25611e(0x14a)]('\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript')),console[_0x25611e(0x157)](a20_0x2bffc5[_0x25611e(0x14a)]('\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a')),console[_0x25611e(0x157)](a20_0x2bffc5[_0x25611e(0x143)](_0x25611e(0x12f)));const _0x46b4b2=async()=>{const _0x1dc8b7=_0x25611e;console[_0x1dc8b7(0x157)](a20_0x2bffc5[_0x1dc8b7(0x14a)]('\x0a\x0aShutting\x20down\x20proxy\x20server...')),this[_0x1dc8b7(0x133)]&&await this['server']['stop'](),this[_0x1dc8b7(0x154)]&&await this[_0x1dc8b7(0x154)][_0x1dc8b7(0x153)](),console[_0x1dc8b7(0x157)](a20_0x2bffc5[_0x1dc8b7(0x15a)]('✓\x20Proxy\x20server\x20stopped')),process[_0x1dc8b7(0x123)](0x0);};return process['on'](_0x25611e(0x151),_0x46b4b2),process['on'](_0x25611e(0x129),_0x46b4b2),await new Promise(()=>{}),0x0;}catch(_0x5deaa2){this[_0x25611e(0x133)]&&await this[_0x25611e(0x133)][_0x25611e(0x13a)]();this[_0x25611e(0x154)]&&await this[_0x25611e(0x154)]['close']();throw _0x5deaa2;}}}