@treasuredata/tdx 0.14.7 → 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 (145) 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/tdx +10 -0
  127. package/dist/utils/async.js +1 -1
  128. package/dist/utils/colors.d.ts +2 -1
  129. package/dist/utils/colors.d.ts.map +1 -1
  130. package/dist/utils/colors.js +1 -1
  131. package/dist/utils/colors.js.map +1 -1
  132. package/dist/utils/diff.js +1 -1
  133. package/dist/utils/file-permissions.js +1 -1
  134. package/dist/utils/json-loader.js +1 -1
  135. package/dist/utils/option-validation.js +1 -1
  136. package/dist/utils/port.js +1 -1
  137. package/dist/utils/process.js +1 -1
  138. package/dist/utils/prompt.js +1 -1
  139. package/dist/utils/spinner.js +1 -1
  140. package/dist/utils/sse-parser.js +1 -1
  141. package/dist/utils/string-utils.js +1 -1
  142. package/dist/utils/table-ref-parser.js +1 -1
  143. package/dist/utils/tdx-logger.js +1 -1
  144. package/dist/utils/version-check.js +1 -1
  145. package/package.json +2 -2
@@ -1 +1 @@
1
- const a17_0x2b414a=a17_0x2370;(function(_0x13e74c,_0x415839){const _0x3673d6=a17_0x2370,_0x2bd759=_0x13e74c();while(!![]){try{const _0x2c4067=-parseInt(_0x3673d6(0x1d1))/0x1+-parseInt(_0x3673d6(0x23a))/0x2+parseInt(_0x3673d6(0x232))/0x3+-parseInt(_0x3673d6(0x191))/0x4+-parseInt(_0x3673d6(0x212))/0x5*(-parseInt(_0x3673d6(0x189))/0x6)+-parseInt(_0x3673d6(0x16c))/0x7*(-parseInt(_0x3673d6(0x1b7))/0x8)+parseInt(_0x3673d6(0x1e8))/0x9;if(_0x2c4067===_0x415839)break;else _0x2bd759['push'](_0x2bd759['shift']());}catch(_0xc6e85d){_0x2bd759['push'](_0x2bd759['shift']());}}}(a17_0x25a3,0xac472));function a17_0x2370(_0x33973b,_0x4e9e40){_0x33973b=_0x33973b-0x16b;const _0x25a303=a17_0x25a3();let _0x23703c=_0x25a303[_0x33973b];return _0x23703c;}import a17_0x2fadd9 from'chalk';import a17_0x4aee04 from'path';function a17_0x25a3(){const _0x5e1e80=['targetDir','error','Target\x20directory:\x20','draft','getParentFull','description','Getting\x20journey\x20statistics...','/j/da/je','2397654BwUCJF','toLowerCase','INVALID_ARGUMENT','population','\x27\x20not\x20found\x20in\x20','test','\x20versions)','reentryMode','\x0a[Dry\x20run]\x20No\x20files\x20were\x20written','journey:pause','length','journey:view','Resolving\x20parent\x20segment...','values','Write\x20','session','journeyName','Journey\x20name:\x20','getActivation','connection','/j/da','No\x20journeys\x20found','\x0aPull\x20summary:','(draft)','options','\x20unchanged\x20files','yes','cwd','stages','parent_segment','getStatistics','includeStats','journey:push','Resuming\x20journey...','relative','No\x20parent\x20segment\x20context\x20set.\x20Set\x20context\x20with:\x20tdx\x20sg\x20use\x20\x22Name\x22\x20or\x20tdx\x20sg\x20pull\x20\x22Name\x22','Resolving\x20journey...','Warning:\x20Could\x20not\x20resolve\x20segment\x20','filter','conversionRate','Listing\x20folders...','hasChanges','35hENfrt','(archived)','filePath','Pause\x20a\x20running\x20journey','base','Warning:\x20Could\x20not\x20resolve\x20activation\x20','exited','add','execute','Found\x20journeys\x20with\x20this\x20name\x20in\x20other\x20folders:','No\x20statistics\x20available\x20for\x20journey:\x20','Use\x20--parent-segment\x20or\x20set\x20context\x20with\x20\x22tdx\x20sg\x20use\x22','Error:\x20Journey\x20name,\x20path,\x20or\x20YAML\x20file\x20is\x20required','green','goal','Cancelled','parentName','Show\x20journey\x20details','completed','Fetching\x20parent\x20segment...','Fetching\x20','versionNumber','then','...','pause','listJourneysFromParentSegment','\x20changed\x20files','resolveJourneyId','Usage:\x20journey\x20view\x20<name-or-path>\x20[-w]','connector_config','journey:pull','journeyId','2903709fvKhke','format','file','setPhase','\x0aTip:\x20Run\x20`tdx\x20sg\x20pull\x20<parent_name>`\x20first\x20to\x20create\x20the\x20folder\x20structure','parentSegment','folderId','stageName','1937748lDWmUC','folders','Warning:\x20Stage\x20\x22','journey','Show\x20journey\x20statistics','segmentName','rule','site','journey:stats','listJourneysWithFolders','absolutePath','totalEntered','sort','.yml','repeat','totalGoalAchieved','activation_','98LhJWGR','segmentPushCommand','entered','state','dryRun','\x22\x20resumed','Pausing\x20journey...','✔\x20All\x20files\x20are\x20up\x20to\x20date','✔\x20Pulled\x20','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20--parent-segment\x20<name>\x20\x20#\x20Specify\x20parent\x20segment','get','Folder\x20path:\x20','segment','Getting\x20journey\x20details...','Push\x20journey\x20YAML\x20files\x20to\x20Treasure\x20Data','Fetching\x20users\x20for\x20email\x20resolution...','\x20(ID:\x20','buildIdToNameMap','size','name','goalRate','\x20\x20Target:\x20','\x20=\x20','\x20segment\x20rule(s)\x20to\x20match\x20for\x20','getSegment','json','journeyStages','Input:\x20','set','547266xcJDyf','stage','rootFolderId','Parent\x20segment:\x20','isNew','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)','all','Statistics\x20may\x20not\x20be\x20available\x20for\x20draft\x20or\x20newly\x20created\x20journeys.','558932cXVAgI','\x20\x20Preserving\x20local\x20segment\x20name:\x20','join','Target\x20file:\x20','attributes','helpText','Failed\x20to\x20resolve\x20YAML\x20file\x20path:\x20','no_parent','Error:\x20Parent\x20segment\x20context\x20required','✔\x20Journey\x20\x22','/app/ps/','paused','map','journeyBundleId','data','root\x20folder','blue','Are\x20you\x20sure\x20you\x20want\x20to\x20pause\x20journey\x20\x22','📁\x20','\x20->\x20','Resume\x20a\x20paused\x20journey','Are\x20you\x20sure\x20you\x20want\x20to\x20resume\x20journey\x20\x22','resourceName','Error:\x20Journey\x20\x27','getJourney','\x20new\x20files','cyan','buildIdToEmailMap','\x20files?','has','journeys','journeyBundleName','\x20(rule\x20match)','localeCompare','dim','content','push','✔\x20Found\x20','71448frTDJo','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','find','🗺️\x20','type','Options:','(root)','utf-8','activationParams','launched','errorCode','(completed)','resolveParentId','replace','relativePath','segments','Aborted.','archived','Error:\x20','/e/','\x20\x20-\x20','resume','\x20\x20-w,\x20--web\x20\x20Open\x20journey\x20in\x20web\x20browser','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20pull\x20path/to/journey.yml\x20\x20\x20\x20\x20#\x20Pull\x20specific\x20journey\x20by\x20file','Listing\x20journeys...','183563EPfVqd','verbose','table','listFolders','log','Usage:\x20journey\x20stats\x20<name-or-path>','\x20\x20Statistics\x20not\x20available','Export\x20journey(s)\x20as\x20YAML\x20files','message','split','\x22\x20not\x20found','\x5c$&','diff','yellow','\x20journey'];a17_0x25a3=function(){return _0x5e1e80;};return a17_0x25a3();}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';import{openBrowser}from'../utils/process.js';import{hyperlink}from'../sdk/util/formatters.js';function formatJourneyState(_0x115195){const _0x2e3cbf=a17_0x2370;switch(_0x115195){case _0x2e3cbf(0x1c1):return a17_0x2fadd9[_0x2e3cbf(0x21f)]('(running)');case _0x2e3cbf(0x1e3):return a17_0x2fadd9[_0x2e3cbf(0x1b3)](_0x2e3cbf(0x1ff));case _0x2e3cbf(0x19c):return a17_0x2fadd9['yellow']('(paused)');case _0x2e3cbf(0x224):return a17_0x2fadd9[_0x2e3cbf(0x1a1)](_0x2e3cbf(0x1c3));case _0x2e3cbf(0x1c9):return a17_0x2fadd9[_0x2e3cbf(0x1b3)](_0x2e3cbf(0x213));default:return'('+_0x115195+')';}}function formatJourneyItem(_0x171058,_0x3284af='',_0x301b38){const _0x4ebcaa=a17_0x2370,_0x5c1ec0=formatJourneyState(_0x171058[_0x4ebcaa(0x16f)]),_0x2b50c8=_0x301b38?hyperlink(_0x171058['journeyBundleName'],_0x301b38):_0x171058[_0x4ebcaa(0x1b0)];return _0x3284af+_0x4ebcaa(0x1bb)+_0x2b50c8+'\x20'+_0x5c1ec0;}function escapeRegex(_0x4c30ad){const _0x2850e2=a17_0x2370;return _0x4c30ad[_0x2850e2(0x1c5)](/[.*+?^${}()|[\]\\]/g,_0x2850e2(0x1dc));}function globToRegex(_0x25a4df){const _0x495288=a17_0x2370,_0x2e1eb4=_0x25a4df[_0x495288(0x1da)]('*')['map'](escapeRegex);return new RegExp(_0x2e1eb4[_0x495288(0x193)]('.*'),'i');}function buildRuleToNameMapping(_0xfe4d11){const _0x52f0ba=a17_0x2370,_0x3a2265=new Map();if(_0xfe4d11[_0x52f0ba(0x1c7)])for(const [_0x13c5cd,_0x5ddc95]of Object['entries'](_0xfe4d11[_0x52f0ba(0x1c7)])){if(_0x5ddc95['rule']){const _0x23003e=serializeRule(_0x5ddc95[_0x52f0ba(0x240)]),_0x3b6d55=_0x3a2265[_0x52f0ba(0x176)](_0x23003e);_0x3b6d55?_0x3b6d55[_0x52f0ba(0x1b5)](_0x13c5cd):_0x3a2265[_0x52f0ba(0x188)](_0x23003e,[_0x13c5cd]);}}return _0x3a2265;}async function resolveJourneyTarget(_0x3c615b,_0x1d87eb,_0x39a5bb){const _0x97bfe2=a17_0x2370;if(isYamlFilePath(_0x3c615b))try{const _0x509617=await resolveYamlFilePath(_0x3c615b);return _0x39a5bb&&(console[_0x97bfe2(0x1e1)]('Resolved\x20YAML\x20file:\x20'+_0x3c615b),console[_0x97bfe2(0x1e1)]('\x20\x20Parent\x20segment:\x20'+_0x509617[_0x97bfe2(0x237)]),console[_0x97bfe2(0x1e1)]('\x20\x20Name:\x20'+_0x509617[_0x97bfe2(0x23f)]),console['error']('\x20\x20Folder\x20path:\x20'+(_0x509617['folderPath']||'(root)'))),{'journeyName':_0x509617['segmentName'],'parentSegment':_0x509617[_0x97bfe2(0x237)],'resolved':_0x509617};}catch(_0x59b956){throw new SDKError(ErrorCode[_0x97bfe2(0x1ea)],_0x97bfe2(0x197)+_0x59b956[_0x97bfe2(0x1d9)]);}if(!_0x1d87eb)throw new SDKError(ErrorCode[_0x97bfe2(0x1ea)],_0x97bfe2(0x20b));return{'journeyName':_0x3c615b,'parentSegment':_0x1d87eb};}export class JourneyListCommand extends BaseCommand{[a17_0x2b414a(0x17f)]='journey:list';[a17_0x2b414a(0x1e5)]='List\x20journeys\x20in\x20current\x20context';async['execute'](_0x291b40){const _0x5b2753=a17_0x2b414a,{options:_0xa811bf,args:_0x2c99a7,tdx:_0x851f0}=_0x291b40,_0xd0cb47=_0x2c99a7[0x0],_0x4db246=_0xa811bf['parentSegment'];if(!_0x4db246)return console[_0x5b2753(0x1e1)](_0x5b2753(0x199)),console['error'](_0x5b2753(0x21d)),0x1;const _0x335964=await withSpinner(_0x5b2753(0x1f4),()=>_0x851f0[_0x5b2753(0x178)][_0x5b2753(0x1c4)](_0x4db246),{'verbose':_0xa811bf['verbose']}),_0x103f15=_0x335964[_0x5b2753(0x19f)];_0xa811bf[_0x5b2753(0x1d2)]&&(console[_0x5b2753(0x1e1)](_0x5b2753(0x18c)+_0x4db246+_0x5b2753(0x17c)+_0x103f15+')'),_0xd0cb47&&console['error']('Pattern:\x20'+_0xd0cb47));const _0x135997=await withSpinner(_0x5b2753(0x225),()=>_0x851f0[_0x5b2753(0x178)][_0x5b2753(0x1e4)](_0x103f15),{'verbose':_0xa811bf[_0x5b2753(0x1d2)]}),_0x24d726=_0x135997[_0x5b2753(0x19f)],_0x2dd988=_0x24d726[_0x5b2753(0x18b)],_0x590158=await withSpinner(_0x5b2753(0x1d0),()=>_0x851f0[_0x5b2753(0x23d)][_0x5b2753(0x243)](_0x103f15,_0x2dd988),{'verbose':_0xa811bf[_0x5b2753(0x1d2)]});let _0x4e8cf9=_0x590158[_0x5b2753(0x19f)][_0x5b2753(0x1af)];const _0x49fb7d=_0x590158[_0x5b2753(0x19f)][_0x5b2753(0x23b)],_0x46f882=new Map();for(const _0x561993 of _0x49fb7d){_0x46f882['set'](_0x561993['id'],_0x561993[_0x5b2753(0x17f)]);}if(_0xd0cb47){const _0x2be210=globToRegex(_0xd0cb47);_0x4e8cf9=_0x4e8cf9[_0x5b2753(0x20e)](_0xfb5a57=>_0x2be210[_0x5b2753(0x1ed)](_0xfb5a57[_0x5b2753(0x1b0)]));}console[_0x5b2753(0x1e1)](_0x5b2753(0x1b6)+_0x4e8cf9[_0x5b2753(0x1f2)]+_0x5b2753(0x1df)+(_0x4e8cf9['length']!==0x1?'s':''));const _0x1e2411=_0x210109=>{const _0x462397=_0x5b2753;return getConsoleNextUrl(_0xa811bf[_0x462397(0x241)],_0x462397(0x19b)+_0x103f15+_0x462397(0x1cb)+_0x210109+_0x462397(0x1fc));};if(_0xa811bf[_0x5b2753(0x233)]===_0x5b2753(0x1d3))await handleSDKOutput(_0x4e8cf9,_0xa811bf);else{if(_0xa811bf['format']===_0x5b2753(0x185)){const _0x2f0c7c=_0x4e8cf9[_0x5b2753(0x19d)](_0x5c4552=>({..._0x5c4552,'url':_0x1e2411(_0x5c4552['id'])}));await handleSDKOutput(_0x2f0c7c,_0xa811bf);}else{console[_0x5b2753(0x1d5)]('['+_0x4db246+']');const _0x143056=new Map(),_0x2705cb=[];for(const _0x18d06b of _0x4e8cf9){if(!_0x18d06b[_0x5b2753(0x238)]||_0x18d06b[_0x5b2753(0x238)]===_0x2dd988)_0x2705cb['push'](_0x18d06b);else{const _0x3bea72=_0x143056[_0x5b2753(0x176)](_0x18d06b[_0x5b2753(0x238)])||[];_0x3bea72[_0x5b2753(0x1b5)](_0x18d06b),_0x143056['set'](_0x18d06b['folderId'],_0x3bea72);}}const _0x2fca98=(_0x531682,_0x199115)=>_0x531682['journeyBundleName'][_0x5b2753(0x1b2)](_0x199115[_0x5b2753(0x1b0)],undefined,{'sensitivity':_0x5b2753(0x216)});_0x2705cb[_0x5b2753(0x246)](_0x2fca98);for(const _0x587577 of _0x2705cb){console['log'](formatJourneyItem(_0x587577,'',_0x1e2411(_0x587577['id'])));}const _0x50bf74=[..._0x143056['entries']()][_0x5b2753(0x246)]((_0x310cee,_0x235f26)=>{const _0x8ff3b3=_0x5b2753,_0xef7fc7=_0x46f882[_0x8ff3b3(0x176)](_0x310cee[0x0])||_0x310cee[0x0],_0x4455dc=_0x46f882[_0x8ff3b3(0x176)](_0x235f26[0x0])||_0x235f26[0x0];return _0xef7fc7[_0x8ff3b3(0x1b2)](_0x4455dc,undefined,{'sensitivity':'base'});});for(const [_0xe05668,_0x37e2f1]of _0x50bf74){const _0x1bfac7=_0x46f882[_0x5b2753(0x176)](_0xe05668)||_0xe05668;console['log'](_0x5b2753(0x1a3)+_0x1bfac7),_0x37e2f1[_0x5b2753(0x246)](_0x2fca98);for(const _0x4192fd of _0x37e2f1){console[_0x5b2753(0x1d5)](formatJourneyItem(_0x4192fd,'\x20\x20',_0x1e2411(_0x4192fd['id'])));}}}}return 0x0;}}export class JourneyViewCommand extends BaseCommand{['name']=a17_0x2b414a(0x1f3);['description']=a17_0x2b414a(0x223);async[a17_0x2b414a(0x21a)](_0x497a84){const _0x22fb6c=a17_0x2b414a,{options:_0xb3e1b4,args:_0x43c3c6,tdx:_0x263631}=_0x497a84,_0x227b6f=_0x43c3c6[0x0];if(!_0x227b6f)return console[_0x22fb6c(0x1e1)](_0x22fb6c(0x21e)),console['error'](_0x22fb6c(0x22e)),console['error'](_0x22fb6c(0x1bd)),console[_0x22fb6c(0x1e1)](_0x22fb6c(0x1ce)),0x1;_0xb3e1b4['verbose']&&console[_0x22fb6c(0x1e1)]('Input:\x20'+_0x227b6f);const _0x585a26=await resolveJourneyTarget(_0x227b6f,_0xb3e1b4[_0x22fb6c(0x237)],_0xb3e1b4[_0x22fb6c(0x1d2)]),_0x4a68dd=await withSpinner(_0x22fb6c(0x1f4),()=>_0x263631[_0x22fb6c(0x178)][_0x22fb6c(0x1c4)](_0x585a26['parentSegment']),{'verbose':_0xb3e1b4['verbose']}),_0x45c600=_0x4a68dd[_0x22fb6c(0x19f)],_0x221cde=await withSpinner(_0x22fb6c(0x20c),()=>_0x263631[_0x22fb6c(0x23d)][_0x22fb6c(0x22d)](_0x45c600,_0x585a26[_0x22fb6c(0x1f8)]),{'verbose':_0xb3e1b4['verbose']}),_0x50ebd9=_0x221cde[_0x22fb6c(0x19f)];if(_0xb3e1b4['web']){const _0x42af0f=getConsoleNextUrl(_0xb3e1b4[_0x22fb6c(0x241)],_0x22fb6c(0x19b)+_0x45c600+_0x22fb6c(0x1cb)+_0x50ebd9+_0x22fb6c(0x1e7));return console[_0x22fb6c(0x1e1)](a17_0x2fadd9[_0x22fb6c(0x21f)]('✔')+'\x20Opening\x20'+a17_0x2fadd9['cyan'](_0x42af0f)),openBrowser(_0x42af0f),0x0;}const _0x5c45a4=await withSpinner(_0x22fb6c(0x179),()=>_0x263631[_0x22fb6c(0x23d)][_0x22fb6c(0x1a9)](_0x50ebd9),{'verbose':_0xb3e1b4['verbose']}),_0x3e0e81=_0x5c45a4[_0x22fb6c(0x19f)],_0x3ccff0=_0xb3e1b4[_0x22fb6c(0x207)];let _0x1aa9cd;if(_0x3ccff0)try{const _0xc95224=await withSpinner('Getting\x20journey\x20statistics...',()=>_0x263631[_0x22fb6c(0x23d)][_0x22fb6c(0x206)](_0x50ebd9),{'verbose':_0xb3e1b4[_0x22fb6c(0x1d2)]});_0x1aa9cd=_0xc95224[_0x22fb6c(0x19f)];}catch{_0xb3e1b4[_0x22fb6c(0x1d2)]&&console[_0x22fb6c(0x1e1)](_0x22fb6c(0x1d7));}const _0x3a5779=getConsoleNextUrl(_0xb3e1b4[_0x22fb6c(0x241)],_0x22fb6c(0x19b)+_0x45c600+'/e/'+_0x50ebd9+_0x22fb6c(0x1e7)),_0x25e2b2={'id':_0x3e0e81['id'],'name':_0x3e0e81['attributes'][_0x22fb6c(0x17f)],'description':_0x3e0e81[_0x22fb6c(0x195)]['description'],'state':_0x3e0e81['attributes'][_0x22fb6c(0x16f)],'paused':_0x3e0e81[_0x22fb6c(0x195)][_0x22fb6c(0x19c)],'reentry_mode':_0x3e0e81[_0x22fb6c(0x195)][_0x22fb6c(0x1ef)],'stages':_0x3e0e81[_0x22fb6c(0x195)][_0x22fb6c(0x186)]?.[_0x22fb6c(0x1f2)]||0x0,..._0x3e0e81[_0x22fb6c(0x195)]['goal']&&{'goal':_0x3e0e81[_0x22fb6c(0x195)][_0x22fb6c(0x220)][_0x22fb6c(0x17f)]},..._0x1aa9cd&&{'statistics':{'total_entered':_0x1aa9cd[_0x22fb6c(0x245)],'goal_achieved':_0x1aa9cd[_0x22fb6c(0x249)],'goal_rate':_0x1aa9cd[_0x22fb6c(0x180)],'stages':_0x1aa9cd[_0x22fb6c(0x204)]}},'url':_0x3a5779};return await handleSingleObjectOutput(_0x25e2b2,_0xb3e1b4),0x0;}}export class JourneyStatsCommand extends BaseCommand{[a17_0x2b414a(0x17f)]=a17_0x2b414a(0x242);[a17_0x2b414a(0x1e5)]=a17_0x2b414a(0x23e);async[a17_0x2b414a(0x21a)](_0x393776){const _0x18d59d=a17_0x2b414a,{options:_0x1d05ce,args:_0x1399b4,tdx:_0x1b0aa6}=_0x393776,_0x2d0637=_0x1399b4[0x0];if(!_0x2d0637)return console[_0x18d59d(0x1e1)](_0x18d59d(0x21e)),console['error'](_0x18d59d(0x1d6)),0x1;_0x1d05ce[_0x18d59d(0x1d2)]&&console[_0x18d59d(0x1e1)](_0x18d59d(0x187)+_0x2d0637);const _0x6418d4=await resolveJourneyTarget(_0x2d0637,_0x1d05ce[_0x18d59d(0x237)],_0x1d05ce['verbose']),_0x5c8956=await withSpinner(_0x18d59d(0x1f4),()=>_0x1b0aa6[_0x18d59d(0x178)][_0x18d59d(0x1c4)](_0x6418d4[_0x18d59d(0x237)]),{'verbose':_0x1d05ce['verbose']}),_0x1afe69=_0x5c8956['data'],_0x3fe775=await withSpinner(_0x18d59d(0x20c),()=>_0x1b0aa6[_0x18d59d(0x23d)][_0x18d59d(0x22d)](_0x1afe69,_0x6418d4[_0x18d59d(0x1f8)]),{'verbose':_0x1d05ce[_0x18d59d(0x1d2)]}),_0x25fe0a=_0x3fe775[_0x18d59d(0x19f)],_0x17a91b=await withSpinner(_0x18d59d(0x1e6),()=>_0x1b0aa6[_0x18d59d(0x23d)]['getStatistics'](_0x25fe0a),{'verbose':_0x1d05ce[_0x18d59d(0x1d2)]}),_0x5b69c7=_0x17a91b['data'];if(!_0x5b69c7||_0x5b69c7['journeyId']===null)return console[_0x18d59d(0x1e1)](_0x18d59d(0x21c)+_0x6418d4['journeyName']),console['error'](_0x18d59d(0x190)),0x0;const _0x56bd03={'journey_id':_0x5b69c7[_0x18d59d(0x231)],'total_entered':_0x5b69c7[_0x18d59d(0x245)],'goal_achieved':_0x5b69c7[_0x18d59d(0x249)],'goal_rate':_0x5b69c7[_0x18d59d(0x180)],'stages':_0x5b69c7[_0x18d59d(0x204)]?.['map'](_0x9a7361=>({'name':_0x9a7361['stageName'],'population':_0x9a7361[_0x18d59d(0x1eb)],'entered':_0x9a7361[_0x18d59d(0x16e)],'exited':_0x9a7361[_0x18d59d(0x218)],'conversion_rate':_0x9a7361[_0x18d59d(0x20f)]}))},_0x12d0d6=_0x1d05ce[_0x18d59d(0x18a)];if(_0x12d0d6&&_0x5b69c7[_0x18d59d(0x204)]){const _0x54a30f=_0x5b69c7[_0x18d59d(0x204)][_0x18d59d(0x1ba)](_0x4b3c80=>_0x4b3c80[_0x18d59d(0x239)][_0x18d59d(0x1e9)]()===_0x12d0d6[_0x18d59d(0x1e9)]());if(_0x54a30f)return await handleSingleObjectOutput({'stage_name':_0x54a30f['stageName'],'population':_0x54a30f['population'],'entered':_0x54a30f[_0x18d59d(0x16e)],'exited':_0x54a30f[_0x18d59d(0x218)],'conversion_rate':_0x54a30f[_0x18d59d(0x20f)]},_0x1d05ce),0x0;console['error'](_0x18d59d(0x23c)+_0x12d0d6+_0x18d59d(0x1db));}return await handleSingleObjectOutput(_0x56bd03,_0x1d05ce),0x0;}}export class JourneyPauseCommand extends BaseCommand{[a17_0x2b414a(0x17f)]=a17_0x2b414a(0x1f1);[a17_0x2b414a(0x1e5)]=a17_0x2b414a(0x215);async[a17_0x2b414a(0x21a)](_0x4429ee){const _0x1f2583=a17_0x2b414a,{options:_0xe0843a,args:_0xe8475d,tdx:_0x1e1a1d}=_0x4429ee,_0x86a9d2=_0xe8475d[0x0];if(!_0x86a9d2)return console[_0x1f2583(0x1e1)](_0x1f2583(0x21e)),console[_0x1f2583(0x1e1)]('Usage:\x20journey\x20pause\x20<name-or-path>'),0x1;_0xe0843a[_0x1f2583(0x1d2)]&&console['error'](_0x1f2583(0x187)+_0x86a9d2);const _0x335d69=await resolveJourneyTarget(_0x86a9d2,_0xe0843a[_0x1f2583(0x237)],_0xe0843a[_0x1f2583(0x1d2)]),_0x5a9791=await withSpinner(_0x1f2583(0x1f4),()=>_0x1e1a1d[_0x1f2583(0x178)][_0x1f2583(0x1c4)](_0x335d69[_0x1f2583(0x237)]),{'verbose':_0xe0843a['verbose']}),_0x1dd55e=_0x5a9791[_0x1f2583(0x19f)],_0x3c1b45=await withSpinner(_0x1f2583(0x20c),()=>_0x1e1a1d[_0x1f2583(0x23d)][_0x1f2583(0x22d)](_0x1dd55e,_0x335d69[_0x1f2583(0x1f8)]),{'verbose':_0xe0843a[_0x1f2583(0x1d2)]}),_0x1b5350=_0x3c1b45[_0x1f2583(0x19f)];if(!_0xe0843a[_0x1f2583(0x202)]){const _0x227d03=await confirm(_0x1f2583(0x1a2)+_0x335d69[_0x1f2583(0x1f8)]+'\x22?');if(!_0x227d03)return console[_0x1f2583(0x1e1)](_0x1f2583(0x221)),0x0;}const _0x1b381d=await withSpinner(_0x1f2583(0x172),()=>_0x1e1a1d[_0x1f2583(0x23d)][_0x1f2583(0x22a)](_0x1b5350),{'verbose':_0xe0843a['verbose']}),_0x3270fe=_0x1b381d[_0x1f2583(0x19f)];return console['error'](_0x1f2583(0x19a)+_0x3270fe[_0x1f2583(0x195)][_0x1f2583(0x17f)]+'\x22\x20paused'),0x0;}}export class JourneyResumeCommand extends BaseCommand{[a17_0x2b414a(0x17f)]='journey:resume';['description']=a17_0x2b414a(0x1a5);async[a17_0x2b414a(0x21a)](_0x202446){const _0x1ba593=a17_0x2b414a,{options:_0x5c5c15,args:_0x28d56f,tdx:_0x3dc1a7}=_0x202446,_0x56f04f=_0x28d56f[0x0];if(!_0x56f04f)return console[_0x1ba593(0x1e1)](_0x1ba593(0x21e)),console['error']('Usage:\x20journey\x20resume\x20<name-or-path>'),0x1;_0x5c5c15['verbose']&&console[_0x1ba593(0x1e1)](_0x1ba593(0x187)+_0x56f04f);const _0x42ae22=await resolveJourneyTarget(_0x56f04f,_0x5c5c15[_0x1ba593(0x237)],_0x5c5c15[_0x1ba593(0x1d2)]),_0x8298e5=await withSpinner('Resolving\x20parent\x20segment...',()=>_0x3dc1a7[_0x1ba593(0x178)][_0x1ba593(0x1c4)](_0x42ae22[_0x1ba593(0x237)]),{'verbose':_0x5c5c15[_0x1ba593(0x1d2)]}),_0x2701e9=_0x8298e5[_0x1ba593(0x19f)],_0x1fbdea=await withSpinner(_0x1ba593(0x20c),()=>_0x3dc1a7[_0x1ba593(0x23d)][_0x1ba593(0x22d)](_0x2701e9,_0x42ae22['journeyName']),{'verbose':_0x5c5c15[_0x1ba593(0x1d2)]}),_0x2e89e3=_0x1fbdea[_0x1ba593(0x19f)];if(!_0x5c5c15[_0x1ba593(0x202)]){const _0xd2ce19=await confirm(_0x1ba593(0x1a6)+_0x42ae22[_0x1ba593(0x1f8)]+'\x22?');if(!_0xd2ce19)return console['error'](_0x1ba593(0x221)),0x0;}const _0x46410d=await withSpinner(_0x1ba593(0x209),()=>_0x3dc1a7[_0x1ba593(0x23d)][_0x1ba593(0x1cd)](_0x2e89e3),{'verbose':_0x5c5c15[_0x1ba593(0x1d2)]}),_0xf527be=_0x46410d[_0x1ba593(0x19f)];return console['error']('✔\x20Journey\x20\x22'+_0xf527be[_0x1ba593(0x195)][_0x1ba593(0x17f)]+_0x1ba593(0x171)),0x0;}}export class JourneyPullCommand extends BaseCommand{[a17_0x2b414a(0x17f)]=a17_0x2b414a(0x230);[a17_0x2b414a(0x1e5)]=a17_0x2b414a(0x1d8);async[a17_0x2b414a(0x21a)](_0x37ad0f){const _0x1ca9e7=a17_0x2b414a,{options:_0x5d57bc,args:_0x200b3e,tdx:_0x2cdc71}=_0x37ad0f,_0x8728ec=_0x5d57bc,_0x329fe5=_0x200b3e[0x0],_0x248c4d=_0x329fe5&&isYamlFilePath(_0x329fe5),_0x3854cc=await resolveTarget({'arg':_0x248c4d?_0x329fe5:undefined,'contextParent':_0x5d57bc[_0x1ca9e7(0x237)],'cwd':process['cwd']()});if(!isSuccessfulResolution(_0x3854cc))return _0x3854cc[_0x1ca9e7(0x1c2)]===_0x1ca9e7(0x198)?(console[_0x1ca9e7(0x1e1)](a17_0x2fadd9[_0x1ca9e7(0x1de)](_0x1ca9e7(0x1b8))),console['error'](_0x1ca9e7(0x18e)),console[_0x1ca9e7(0x1e1)](_0x1ca9e7(0x175)),console[_0x1ca9e7(0x1e1)](_0x1ca9e7(0x1cf)),console['error'](_0x1ca9e7(0x236))):(console['error'](a17_0x2fadd9['red'](_0x1ca9e7(0x1ca)+_0x3854cc[_0x1ca9e7(0x1d9)]+'\x0a')),_0x3854cc['helpText']&&console[_0x1ca9e7(0x1e1)](a17_0x2fadd9[_0x1ca9e7(0x1ab)](_0x3854cc[_0x1ca9e7(0x196)]))),0x1;let _0x59af28=_0x248c4d?undefined:_0x329fe5,_0x1bec89,_0x3fe380;_0x3854cc[_0x1ca9e7(0x1bc)]===_0x1ca9e7(0x234)&&(_0x59af28=_0x3854cc[_0x1ca9e7(0x1a7)],_0x1bec89=_0x3854cc[_0x1ca9e7(0x214)],_0x3fe380=_0x3854cc['folderPath']);const _0x1a3436=_0x3854cc[_0x1ca9e7(0x222)],_0x577e8e=_0x3854cc[_0x1ca9e7(0x1e0)];_0x8728ec[_0x1ca9e7(0x1d2)]&&(console['error'](_0x1ca9e7(0x18c)+_0x1a3436),console['error'](_0x1ca9e7(0x1e2)+_0x577e8e),_0x59af28&&console[_0x1ca9e7(0x1e1)](_0x1ca9e7(0x1f9)+_0x59af28),_0x1bec89&&console[_0x1ca9e7(0x1e1)](_0x1ca9e7(0x194)+_0x1bec89),_0x3fe380&&console[_0x1ca9e7(0x1e1)](_0x1ca9e7(0x177)+_0x3fe380));const _0x414163=await withSpinner(_0x1ca9e7(0x1f4),()=>_0x2cdc71['segment'][_0x1ca9e7(0x1c4)](_0x1a3436),{'verbose':_0x5d57bc[_0x1ca9e7(0x1d2)]}),_0x1b3a09=_0x414163[_0x1ca9e7(0x19f)],[_0x97bab1,_0x4c136b]=await Promise[_0x1ca9e7(0x18f)]([withSpinner(_0x1ca9e7(0x1d0),()=>_0x2cdc71['journey'][_0x1ca9e7(0x22b)](_0x1b3a09,undefined,{'includeAllVersions':!![]}),{'verbose':_0x5d57bc['verbose']}),withSpinner(_0x1ca9e7(0x210),()=>_0x2cdc71['segment'][_0x1ca9e7(0x1d4)](_0x1b3a09),{'verbose':_0x5d57bc[_0x1ca9e7(0x1d2)]})]);let _0x426080=_0x97bab1[_0x1ca9e7(0x19f)];const _0x59dc85=_0x4c136b[_0x1ca9e7(0x19f)],_0x2d0f4f=buildFolderIdToPathMap(_0x59dc85);if(_0x59af28){const _0x3e514f=_0x426080[_0x1ca9e7(0x20e)](_0x579456=>_0x579456[_0x1ca9e7(0x1b0)][_0x1ca9e7(0x1e9)]()===_0x59af28[_0x1ca9e7(0x1e9)]());if(_0x3e514f['length']===0x0)return console[_0x1ca9e7(0x1e1)]('Error:\x20Journey\x20not\x20found:\x20'+_0x59af28),console[_0x1ca9e7(0x1e1)](_0x1ca9e7(0x1b9)),0x1;_0x426080=_0x3e514f;}if(_0x3fe380!==undefined){const _0x5401d9=_0x426080['filter'](_0x3ab893=>{const _0x561d1e=_0x1ca9e7,_0x13dc4f=_0x3ab893['folderId']?_0x2d0f4f['get'](_0x3ab893[_0x561d1e(0x238)])||'':'';return _0x13dc4f===_0x3fe380;});if(_0x5401d9[_0x1ca9e7(0x1f2)]===0x0&&_0x426080[_0x1ca9e7(0x1f2)]>0x0){console[_0x1ca9e7(0x1e1)](_0x1ca9e7(0x1a8)+_0x59af28+_0x1ca9e7(0x1ec)+(_0x3fe380||_0x1ca9e7(0x1a0))),console[_0x1ca9e7(0x1e1)](_0x1ca9e7(0x21b));for(const _0x35125f of _0x426080){const _0x1bf110=_0x35125f[_0x1ca9e7(0x238)]?_0x2d0f4f[_0x1ca9e7(0x176)](_0x35125f[_0x1ca9e7(0x238)])||'':'';console['error'](_0x1ca9e7(0x1cc)+(_0x1bf110||_0x1ca9e7(0x1be))+'/'+_0x35125f[_0x1ca9e7(0x1b0)]);}return 0x1;}_0x426080=_0x5401d9;}if(_0x426080['length']===0x0)return console[_0x1ca9e7(0x1e1)](_0x1ca9e7(0x1fd)),0x0;const _0xc0d558=new Map();for(const _0x4dcb51 of _0x426080){const _0x2ff929=_0x4dcb51[_0x1ca9e7(0x19e)];!_0xc0d558[_0x1ca9e7(0x1ae)](_0x2ff929)&&_0xc0d558[_0x1ca9e7(0x188)](_0x2ff929,[]),_0xc0d558[_0x1ca9e7(0x176)](_0x2ff929)[_0x1ca9e7(0x1b5)](_0x4dcb51);}for(const _0x4af99c of _0xc0d558[_0x1ca9e7(0x1f5)]()){_0x4af99c[_0x1ca9e7(0x246)]((_0x459457,_0x36ddda)=>(_0x459457['versionNumber']||0x0)-(_0x36ddda[_0x1ca9e7(0x227)]||0x0));}const _0x40fdbb=[],[_0x189c15,_0x35bba1]=await Promise[_0x1ca9e7(0x18f)]([withSpinner(_0x1ca9e7(0x17b),()=>_0x2cdc71['user'][_0x1ca9e7(0x1ac)](),{'verbose':_0x5d57bc[_0x1ca9e7(0x1d2)]})[_0x1ca9e7(0x228)](_0x526ef3=>_0x526ef3[_0x1ca9e7(0x19f)]),withSpinner('Fetching\x20connections\x20for\x20name\x20resolution...',()=>_0x2cdc71[_0x1ca9e7(0x1fb)][_0x1ca9e7(0x17d)](),{'verbose':_0x5d57bc[_0x1ca9e7(0x1d2)]})[_0x1ca9e7(0x228)](_0x39d443=>_0x39d443['data'])]);for(const _0x300645 of _0xc0d558[_0x1ca9e7(0x1f5)]()){const _0x323d88=_0x300645[0x0]['journeyBundleName'],_0x14f52d=_0x300645[0x0]['folderId'],_0x2ef102=_0x14f52d?_0x2d0f4f[_0x1ca9e7(0x176)](_0x14f52d)||'':'',_0x32d194=_0x2ef102?a17_0x4aee04[_0x1ca9e7(0x193)](_0x577e8e,_0x2ef102):_0x577e8e,_0x19eed8=_0x1bec89||a17_0x4aee04[_0x1ca9e7(0x193)](_0x32d194,sanitizeFileName(_0x323d88)+'.yml');let _0x321cf2,_0x37f458;if(existsSync(_0x19eed8))try{const _0x129eea=readFileSync(_0x19eed8,'utf-8'),_0x1e5199=parseYamlString(_0x129eea);_0x37f458=_0x1e5199,_0x321cf2=buildRuleToNameMapping(_0x1e5199),_0x8728ec[_0x1ca9e7(0x1d2)]&&_0x321cf2[_0x1ca9e7(0x17e)]>0x0&&console[_0x1ca9e7(0x1e1)]('Found\x20'+_0x321cf2['size']+_0x1ca9e7(0x183)+_0x323d88);}catch(_0x5eb353){_0x8728ec[_0x1ca9e7(0x1d2)]&&console['error']('Warning:\x20Could\x20not\x20parse\x20existing\x20file\x20for\x20segment\x20name\x20preservation:\x20'+_0x5eb353[_0x1ca9e7(0x1d9)]);}const _0x15b09c=[],_0x19bcbb=new Set(),_0x18f3c0=new Map(),_0x16a6c2=new Map(),_0x21afaa=new Set(),_0x182298=new Map(),_0x1db6bc=new Map(),_0x22de9c=createJumpTargetCache();await withProgressSpinner(_0x1ca9e7(0x226)+_0x323d88+_0x1ca9e7(0x229),async _0x19d94d=>{const _0x2a9607=_0x1ca9e7;for(const _0x44add0 of _0x300645){const _0x10db5f=_0x300645[_0x2a9607(0x1f2)]>0x1?_0x44add0['journeyBundleName']+'\x20v'+(_0x44add0[_0x2a9607(0x227)]||0x1):_0x44add0[_0x2a9607(0x1b0)];_0x19d94d[_0x2a9607(0x235)](_0x2a9607(0x226)+_0x10db5f);const _0x5b9b66=await _0x2cdc71[_0x2a9607(0x23d)][_0x2a9607(0x1a9)](_0x44add0['id']),_0x235798=_0x5b9b66[_0x2a9607(0x195)]?.['audienceId'],_0x2fc5ee={'resolveSegment':async _0xa215a4=>{const _0x521168=_0x2a9607;if(!_0x235798)return{'name':_0xa215a4,'isJourneyLocal':![]};const _0x3a9952=_0x18f3c0[_0x521168(0x176)](_0xa215a4);if(_0x3a9952)return _0x3a9952;try{const _0x5db003=await _0x2cdc71[_0x521168(0x178)][_0x521168(0x184)](_0x235798,_0xa215a4),_0x2d3d97=_0x5db003['kind']===SEGMENT_KIND_JOURNEY;let _0xf90e8a,_0x59ded1=_0x5db003[_0x521168(0x17f)];if(_0x2d3d97&&_0x5db003[_0x521168(0x240)]){const _0x4dca27=await segmentResponseToDef(_0x5db003,{'resolveSegmentName':async _0x35fbcc=>{const _0x3c9f93=_0x521168,_0x399627=_0x18f3c0[_0x3c9f93(0x176)](_0x35fbcc);if(_0x399627)return _0x399627[_0x3c9f93(0x17f)];const _0x514759=await _0x2fc5ee['resolveSegment'](_0x35fbcc);return _0x514759[_0x3c9f93(0x17f)];}}),_0x1eed8a=_0x4dca27[_0x521168(0x240)];_0xf90e8a={'description':_0x5db003[_0x521168(0x1e5)],'rule':_0x1eed8a};const _0x63b143=serializeRule(_0x1eed8a),_0x2dbcec=_0x16a6c2[_0x521168(0x176)](_0x63b143);if(_0x2dbcec)_0x59ded1=_0x2dbcec,_0xf90e8a=undefined,_0x8728ec[_0x521168(0x1d2)]&&console[_0x521168(0x1e1)]('\x20\x20Consolidating\x20duplicate\x20segment:\x20'+_0x5db003[_0x521168(0x17f)]+_0x521168(0x1a4)+_0x2dbcec);else{let _0x25d019=![];if(_0x321cf2){const _0x9886ad=_0x321cf2[_0x521168(0x176)](_0x63b143);if(_0x9886ad){const _0x475337=_0x9886ad[_0x521168(0x1ba)](_0x1ca77f=>!_0x19bcbb[_0x521168(0x1ae)](_0x1ca77f));_0x475337&&(_0x59ded1=_0x475337,_0x19bcbb[_0x521168(0x219)](_0x475337),_0x16a6c2[_0x521168(0x188)](_0x63b143,_0x475337),_0x25d019=!![],_0x8728ec[_0x521168(0x1d2)]&&console[_0x521168(0x1e1)](_0x521168(0x192)+_0x475337+_0x521168(0x1b1)));}}if(!_0x25d019){const _0x571053=generateJourneyLocalName(_0x5db003[_0x521168(0x17f)]);_0x571053&&(_0x59ded1=_0x571053);let _0x342050=_0x59ded1,_0x5d1ee2=0x2;while(_0x19bcbb[_0x521168(0x1ae)](_0x342050)){_0x342050=_0x59ded1+'_'+_0x5d1ee2,_0x5d1ee2++;}_0x19bcbb['add'](_0x342050),_0x16a6c2['set'](_0x63b143,_0x342050),_0x59ded1=_0x342050;}}}const _0x1d216c={'name':_0x59ded1,'isJourneyLocal':_0x2d3d97,'definition':_0xf90e8a};return _0x18f3c0[_0x521168(0x188)](_0xa215a4,_0x1d216c),_0x1d216c;}catch(_0x49424b){return _0x5d57bc[_0x521168(0x1d2)]&&console[_0x521168(0x1e1)](_0x521168(0x20d)+_0xa215a4+':\x20'+_0x49424b[_0x521168(0x1d9)]),{'name':_0xa215a4,'isJourneyLocal':![]};}},'resolveActivation':async _0x5b1393=>{const _0x402a03=_0x2a9607,_0x9f283c=_0x182298['get'](_0x5b1393);if(_0x9f283c)return _0x9f283c;try{const _0x4e52b9=await _0x2cdc71[_0x402a03(0x23d)][_0x402a03(0x1fa)](_0x44add0['id'],_0x5b1393),_0xed5e9b=journeyActivationStepToYaml(_0x4e52b9,_0x189c15,_0x35bba1),_0x3beee0=JSON['stringify']({'name':_0xed5e9b[_0x402a03(0x17f)],'connection':_0xed5e9b[_0x402a03(0x1fb)],'connector_config':_0xed5e9b[_0x402a03(0x22f)]}),_0x1920f3=_0x1db6bc['get'](_0x3beee0);if(_0x1920f3){const _0x219ad6={'name':_0x1920f3,'isJourneyLocal':!![],'definition':_0xed5e9b};return _0x182298[_0x402a03(0x188)](_0x5b1393,_0x219ad6),_0x219ad6;}const _0x3bfa29=_0x4e52b9[_0x402a03(0x195)][_0x402a03(0x1c0)][_0x402a03(0x17f)]||_0x5b1393,_0x15ed95=sanitizeYamlKey(_0x3bfa29)||_0x402a03(0x16b)+_0x5b1393;let _0x23fa20=_0x15ed95,_0x59ec4e=0x2;while(_0x21afaa['has'](_0x23fa20)){_0x23fa20=_0x15ed95+'_'+_0x59ec4e,_0x59ec4e++;}_0x21afaa[_0x402a03(0x219)](_0x23fa20),_0x1db6bc['set'](_0x3beee0,_0x23fa20);const _0x3500f6={'name':_0x23fa20,'isJourneyLocal':!![],'definition':_0xed5e9b};return _0x182298[_0x402a03(0x188)](_0x5b1393,_0x3500f6),_0x3500f6;}catch(_0x298196){return _0x5d57bc[_0x402a03(0x1d2)]&&console[_0x402a03(0x1e1)](_0x402a03(0x217)+_0x5b1393+':\x20'+_0x298196[_0x402a03(0x1d9)]),{'name':_0x5b1393,'isJourneyLocal':![]};}},'resolveJumpTarget':async(_0x59e34e,_0x9da58e)=>{const _0x315a71=_0x2a9607;return resolveJumpTarget(_0x59e34e,_0x9da58e,_0x22de9c,_0x418063=>_0x2cdc71['journey'][_0x315a71(0x1a9)](_0x418063));}},_0x368100=await journeyResponseToDef(_0x5b9b66,_0x2fc5ee);_0x15b09c[_0x2a9607(0x1b5)]({'item':_0x44add0,'yaml':_0x368100});}},{'verbose':_0x5d57bc[_0x1ca9e7(0x1d2)]});const _0x35321f=buildMergedJourneyDef(_0x15b09c,_0x321cf2),_0x121ef4=normalizeJourneyDef(_0x35321f,_0x37f458),_0x16d028=toYamlString(_0x121ef4),_0x4d836c=_0x1bec89||a17_0x4aee04[_0x1ca9e7(0x193)](_0x32d194,sanitizeFileName(_0x323d88)+_0x1ca9e7(0x247));!_0x1bec89&&_0x2ef102&&!existsSync(_0x32d194)&&mkdirSync(_0x32d194,{'recursive':!![]});const _0x33a562=a17_0x4aee04[_0x1ca9e7(0x20a)](process[_0x1ca9e7(0x203)](),_0x4d836c);if(existsSync(_0x4d836c)){const _0x5b2174=readFileSync(_0x4d836c,_0x1ca9e7(0x1bf)),_0xd10c3d=generateDiff(_0x5b2174,_0x16d028),_0x554caf=hasChanges(_0xd10c3d);_0x40fdbb[_0x1ca9e7(0x1b5)]({'relativePath':_0x33a562,'absolutePath':_0x4d836c,'content':_0x16d028,'isNew':![],'hasChanges':_0x554caf,'diff':_0x554caf?formatDiffWithColors(_0xd10c3d):undefined});}else _0x40fdbb['push']({'relativePath':_0x33a562,'absolutePath':_0x4d836c,'content':_0x16d028,'isNew':!![],'hasChanges':![]});}const _0x58b152=_0x40fdbb['filter'](_0x383bcc=>_0x383bcc[_0x1ca9e7(0x18d)]),_0x66b47f=_0x40fdbb[_0x1ca9e7(0x20e)](_0x225830=>!_0x225830[_0x1ca9e7(0x18d)]&&_0x225830['hasChanges']),_0x35dc6e=_0x40fdbb[_0x1ca9e7(0x20e)](_0x363eb1=>!_0x363eb1['isNew']&&!_0x363eb1['hasChanges']),_0x362b9d=_0x426080[_0x1ca9e7(0x1f2)],_0x176ec9=_0xc0d558[_0x1ca9e7(0x17e)],_0x3c31fb=_0x362b9d>_0x176ec9?'\x20('+_0x362b9d+_0x1ca9e7(0x1ee):'';console[_0x1ca9e7(0x1e1)](_0x1ca9e7(0x1fe)),console['error']('\x20\x20'+a17_0x2fadd9[_0x1ca9e7(0x1ab)](_0x176ec9+'\x20journeys')+a17_0x2fadd9[_0x1ca9e7(0x1b3)](_0x3c31fb)),console[_0x1ca9e7(0x1e1)]('\x20\x20'+a17_0x2fadd9['green']('+\x20'+_0x58b152[_0x1ca9e7(0x1f2)]+_0x1ca9e7(0x1aa))),console['error']('\x20\x20'+a17_0x2fadd9['yellow']('~\x20'+_0x66b47f[_0x1ca9e7(0x1f2)]+_0x1ca9e7(0x22c))),console[_0x1ca9e7(0x1e1)]('\x20\x20'+a17_0x2fadd9[_0x1ca9e7(0x1b3)]('=\x20'+_0x35dc6e[_0x1ca9e7(0x1f2)]+_0x1ca9e7(0x201))),console[_0x1ca9e7(0x1e1)](_0x1ca9e7(0x181)+a17_0x2fadd9[_0x1ca9e7(0x1ab)](_0x577e8e)+'\x0a');if(_0x66b47f[_0x1ca9e7(0x1f2)]>0x0)for(const _0x2785da of _0x66b47f){console[_0x1ca9e7(0x1e1)]('\x0aChanges\x20to\x20\x27'+_0x2785da[_0x1ca9e7(0x1c6)]+'\x27:'),console[_0x1ca9e7(0x1e1)]('─'['repeat'](0x3c)),console[_0x1ca9e7(0x1e1)](_0x2785da[_0x1ca9e7(0x1dd)]),console[_0x1ca9e7(0x1e1)]('─'[_0x1ca9e7(0x248)](0x3c));}if(_0x8728ec[_0x1ca9e7(0x170)])return console[_0x1ca9e7(0x1e1)](a17_0x2fadd9['yellow'](_0x1ca9e7(0x1f0))),0x0;if(_0x58b152['length']===0x0&&_0x66b47f[_0x1ca9e7(0x1f2)]===0x0)return console[_0x1ca9e7(0x1e1)](a17_0x2fadd9[_0x1ca9e7(0x21f)](_0x1ca9e7(0x173))),saveSessionContext({'parent_segment':_0x1a3436},_0x8728ec[_0x1ca9e7(0x1f7)]),console[_0x1ca9e7(0x1e1)](a17_0x2fadd9[_0x1ca9e7(0x21f)]('✔\x20Context\x20set:\x20'+a17_0x2fadd9[_0x1ca9e7(0x1b3)]('parent_segment')+_0x1ca9e7(0x182)+a17_0x2fadd9[_0x1ca9e7(0x1ab)](_0x1a3436))),0x0;if(!_0x8728ec['yes']&&(_0x58b152['length']>0x0||_0x66b47f[_0x1ca9e7(0x1f2)]>0x0)){const _0x305a63=await confirmKey(_0x1ca9e7(0x1f6)+(_0x58b152['length']+_0x66b47f[_0x1ca9e7(0x1f2)])+_0x1ca9e7(0x1ad));if(!_0x305a63)return console[_0x1ca9e7(0x1e1)](_0x1ca9e7(0x1c8)),0x1;}!existsSync(_0x577e8e)&&mkdirSync(_0x577e8e,{'recursive':!![]});for(const _0x4ffb0b of _0x40fdbb){(_0x4ffb0b[_0x1ca9e7(0x18d)]||_0x4ffb0b[_0x1ca9e7(0x211)])&&writeFileSync(_0x4ffb0b[_0x1ca9e7(0x244)],_0x4ffb0b[_0x1ca9e7(0x1b4)],_0x1ca9e7(0x1bf));}return console[_0x1ca9e7(0x1e1)](a17_0x2fadd9[_0x1ca9e7(0x21f)](_0x1ca9e7(0x174)+(_0x58b152[_0x1ca9e7(0x1f2)]+_0x66b47f[_0x1ca9e7(0x1f2)])+'\x20journey\x20files\x20to\x20'+_0x577e8e)),saveSessionContext({'parent_segment':_0x1a3436},_0x8728ec['session']),console[_0x1ca9e7(0x1e1)](a17_0x2fadd9[_0x1ca9e7(0x21f)]('✔\x20Context\x20set:\x20'+a17_0x2fadd9['dim'](_0x1ca9e7(0x205))+_0x1ca9e7(0x182)+a17_0x2fadd9[_0x1ca9e7(0x1ab)](_0x1a3436))),0x0;}}export class JourneyPushCommand extends BaseCommand{[a17_0x2b414a(0x17f)]=a17_0x2b414a(0x208);[a17_0x2b414a(0x1e5)]=a17_0x2b414a(0x17a);[a17_0x2b414a(0x16d)]=new SegmentPushCommand();async[a17_0x2b414a(0x21a)](_0x4932f1){const _0x208546=a17_0x2b414a,_0x270029=_0x4932f1['args'][0x0];let _0x4dc3de;if(_0x270029){const _0x2591e1=await resolveTarget({'arg':_0x270029,'contextParent':_0x4932f1[_0x208546(0x200)]['parentSegment'],'cwd':process[_0x208546(0x203)]()});isSuccessfulResolution(_0x2591e1)&&_0x2591e1[_0x208546(0x1bc)]===_0x208546(0x234)&&(_0x4dc3de=_0x2591e1['filePath']);}const _0x58150a={..._0x4932f1,'options':{..._0x4932f1[_0x208546(0x200)],'journeysOnly':!![],..._0x4dc3de&&{'singleFilePath':_0x4dc3de}}};return this[_0x208546(0x16d)]['execute'](_0x58150a);}}
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_0x3f66d7=a18_0x3866;(function(_0x6aaadf,_0x24fd3e){const _0x4e1656=a18_0x3866,_0xb7ad7b=_0x6aaadf();while(!![]){try{const _0x1fca89=parseInt(_0x4e1656(0x215))/0x1+parseInt(_0x4e1656(0x202))/0x2*(parseInt(_0x4e1656(0x210))/0x3)+-parseInt(_0x4e1656(0x206))/0x4+parseInt(_0x4e1656(0x1f5))/0x5+-parseInt(_0x4e1656(0x207))/0x6*(parseInt(_0x4e1656(0x1f7))/0x7)+-parseInt(_0x4e1656(0x1fd))/0x8+parseInt(_0x4e1656(0x1e7))/0x9;if(_0x1fca89===_0x24fd3e)break;else _0xb7ad7b['push'](_0xb7ad7b['shift']());}catch(_0xe25293){_0xb7ad7b['push'](_0xb7ad7b['shift']());}}}(a18_0x2842,0x8a6aa));import{BaseCommand}from'./command.js';import{resolveTarget,isSuccessfulResolution}from'../sdk/segment/target-resolution.js';import{findYamlFiles}from'../sdk/segment/file-discovery.js';function a18_0x2842(){const _0x43bd1d=['skippedCount','8474600lKhXYd','cyan','valid','length','targetDir','2MJcElw','warningCount','hasErrors','\x20warning(s)\x20found','2349268ZEPuDB','6SoTDbA','relativePath','parent_segment\x20is\x20not\x20set.\x20Use\x20`tdx\x20sg\x20use\x20<parent_name>`\x20to\x20set\x20it.\x0a','yellow','journey','\x20segment\x20file(s)\x20skipped','error','errors','log','2231763NrmKoA','\x20segment\x20file(s)\x20skipped)','Error:\x20File\x20must\x20have\x20.yml\x20or\x20.yaml\x20extension:\x20','no_parent','verbose','307589LwTsle','cwd','filter','.yaml','warnings','Error:\x20','Validate\x20journey\x20YAML\x20files','message','green','name','red','validCount','16300692mxkRXU','\x20warning(s)','\x20(skipped:\x20','description','No\x20journey\x20YAML\x20files\x20found\x20in\x20','Error:\x20No\x20YAML\x20files\x20found\x20in\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','filePath','file','\x20journey(s)\x20with\x20errors,\x20','endsWith','errorCode','parentSegment','\x20\x20\x20\x20\x20\x20\x20tdx\x20journey\x20validate\x20<file_path>\x20\x20#\x20Validate\x20specific\x20file','1792820uYuelM','Validation\x20failed:\x20','7053662OcMRnv','execute','dim','Usage:\x20tdx\x20journey\x20validate\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Validate\x20all\x20(requires\x20context)','helpText'];a18_0x2842=function(){return _0x43bd1d;};return a18_0x2842();}import{existsSync}from'fs';import a18_0x3b0ed9 from'chalk';function a18_0x3866(_0x16329a,_0x53548c){_0x16329a=_0x16329a-0x1e6;const _0x2842e9=a18_0x2842();let _0x3866d9=_0x2842e9[_0x16329a];return _0x3866d9;}import{formatValidationResult}from'../sdk/segment/yaml-validator.js';import{validateYamlFiles,isValidationResult,calculateSummary}from'../sdk/segment/validate-files.js';export class JourneyValidateCommand extends BaseCommand{[a18_0x3f66d7(0x21e)]='journey:validate';[a18_0x3f66d7(0x1ea)]=a18_0x3f66d7(0x21b);async[a18_0x3f66d7(0x1f8)](_0x380b03){const _0x5b57b4=a18_0x3f66d7,{options:_0x502e90,args:_0x344cde}=_0x380b03,_0x5c9c89=_0x502e90,_0x39ad1a=await resolveTarget({'arg':_0x344cde[0x0],'contextParent':_0x502e90[_0x5b57b4(0x1f3)],'cwd':process[_0x5b57b4(0x216)]()});if(!isSuccessfulResolution(_0x39ad1a))return _0x39ad1a[_0x5b57b4(0x1f2)]===_0x5b57b4(0x213)?(console[_0x5b57b4(0x20d)](a18_0x3b0ed9['yellow'](_0x5b57b4(0x209))),console['error'](_0x5b57b4(0x1fa)),console[_0x5b57b4(0x20d)](_0x5b57b4(0x1ed)),console[_0x5b57b4(0x20d)](_0x5b57b4(0x1f4))):(console[_0x5b57b4(0x20d)](a18_0x3b0ed9[_0x5b57b4(0x21f)](_0x5b57b4(0x21a)+_0x39ad1a[_0x5b57b4(0x21c)]+'\x0a')),_0x39ad1a[_0x5b57b4(0x1fb)]&&console[_0x5b57b4(0x20d)](a18_0x3b0ed9[_0x5b57b4(0x1fe)](_0x39ad1a[_0x5b57b4(0x1fb)]))),0x1;const _0x3ba898=_0x39ad1a[_0x5b57b4(0x201)],_0x3aebc4=_0x39ad1a['type']===_0x5b57b4(0x1ef)?_0x39ad1a[_0x5b57b4(0x1ee)]:undefined;if(!_0x3aebc4&&!existsSync(_0x3ba898))return console[_0x5b57b4(0x20d)](a18_0x3b0ed9[_0x5b57b4(0x21f)]('Error:\x20Directory\x20not\x20found:\x20'+_0x3ba898+'\x0a')),0x1;let _0x374883;if(_0x3aebc4){if(!_0x3aebc4['endsWith']('.yml')&&!_0x3aebc4[_0x5b57b4(0x1f1)](_0x5b57b4(0x218)))return console[_0x5b57b4(0x20d)](a18_0x3b0ed9[_0x5b57b4(0x21f)](_0x5b57b4(0x212)+_0x3aebc4+'\x0a')),0x1;_0x374883=[_0x3aebc4];}else _0x374883=findYamlFiles(_0x3ba898);if(_0x374883[_0x5b57b4(0x200)]===0x0)return console[_0x5b57b4(0x20d)](a18_0x3b0ed9[_0x5b57b4(0x21f)](_0x5b57b4(0x1ec)+_0x3ba898+'\x0a')),0x1;const _0x12c7ef=validateYamlFiles(_0x374883,_0x3ba898,{'filterType':_0x5b57b4(0x20b)}),_0x153011=calculateSummary(_0x12c7ef),_0x227542=_0x12c7ef[_0x5b57b4(0x217)](isValidationResult);if(_0x227542['length']===0x0)return console[_0x5b57b4(0x20d)](a18_0x3b0ed9[_0x5b57b4(0x20a)](_0x5b57b4(0x1eb)+_0x3ba898+'\x0a')),_0x153011['skippedCount']>0x0&&console['error'](a18_0x3b0ed9[_0x5b57b4(0x1f9)]('('+_0x153011[_0x5b57b4(0x1fc)]+_0x5b57b4(0x211))),0x0;for(const _0x2a86dc of _0x12c7ef){if(!isValidationResult(_0x2a86dc)){_0x5c9c89[_0x5b57b4(0x214)]&&console['log'](a18_0x3b0ed9[_0x5b57b4(0x1f9)]('-\x20'+_0x2a86dc[_0x5b57b4(0x208)]+_0x5b57b4(0x1e9)+_0x2a86dc['reason']+')'));continue;}const {relativePath:_0xe9ff3,source:_0x15c8de,result:_0x15c7ad}=_0x2a86dc;if(_0x15c7ad[_0x5b57b4(0x1ff)]&&_0x15c7ad[_0x5b57b4(0x219)][_0x5b57b4(0x200)]===0x0)_0x5c9c89[_0x5b57b4(0x214)]&&console['log'](a18_0x3b0ed9[_0x5b57b4(0x21d)]('✔\x20'+_0xe9ff3));else _0x15c7ad[_0x5b57b4(0x1ff)]?(console['log'](a18_0x3b0ed9['yellow']('⚠\x20'+_0xe9ff3+':\x20'+_0x15c7ad['warnings'][_0x5b57b4(0x200)]+_0x5b57b4(0x1e8))),console[_0x5b57b4(0x20f)](formatValidationResult(_0x15c7ad,_0x15c8de,_0xe9ff3))):(console[_0x5b57b4(0x20f)](a18_0x3b0ed9[_0x5b57b4(0x21f)]('✖\x20'+_0xe9ff3+':\x20'+_0x15c7ad[_0x5b57b4(0x20e)][_0x5b57b4(0x200)]+'\x20error(s)')),console[_0x5b57b4(0x20f)](formatValidationResult(_0x15c7ad,_0x15c8de,_0xe9ff3)));}return console[_0x5b57b4(0x20f)](''),_0x153011[_0x5b57b4(0x204)]?(console[_0x5b57b4(0x20f)](a18_0x3b0ed9[_0x5b57b4(0x21f)](_0x5b57b4(0x1f6)+_0x153011['invalidCount']+_0x5b57b4(0x1f0)+_0x153011['validCount']+'\x20valid')),_0x153011[_0x5b57b4(0x203)]>0x0&&console[_0x5b57b4(0x20f)](a18_0x3b0ed9[_0x5b57b4(0x20a)](_0x153011[_0x5b57b4(0x203)]+_0x5b57b4(0x205))),_0x153011[_0x5b57b4(0x1fc)]>0x0&&console[_0x5b57b4(0x20f)](a18_0x3b0ed9[_0x5b57b4(0x1f9)](_0x153011[_0x5b57b4(0x1fc)]+'\x20segment\x20file(s)\x20skipped')),0x1):(console['log'](a18_0x3b0ed9[_0x5b57b4(0x21d)]('✔\x20All\x20'+_0x153011[_0x5b57b4(0x1e6)]+'\x20journey(s)\x20valid')),_0x153011[_0x5b57b4(0x203)]>0x0&&console[_0x5b57b4(0x20f)](a18_0x3b0ed9[_0x5b57b4(0x20a)](_0x153011[_0x5b57b4(0x203)]+_0x5b57b4(0x205))),_0x153011[_0x5b57b4(0x1fc)]>0x0&&console[_0x5b57b4(0x20f)](a18_0x3b0ed9[_0x5b57b4(0x1f9)](_0x153011[_0x5b57b4(0x1fc)]+_0x5b57b4(0x20c))),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_0x1ad83f=a19_0x18f2;(function(_0x407e52,_0x4a391d){const _0x2a6a58=a19_0x18f2,_0x1489cf=_0x407e52();while(!![]){try{const _0x4ba3e0=parseInt(_0x2a6a58(0x1ae))/0x1*(parseInt(_0x2a6a58(0x24d))/0x2)+parseInt(_0x2a6a58(0x1d0))/0x3+-parseInt(_0x2a6a58(0x1f0))/0x4*(parseInt(_0x2a6a58(0x227))/0x5)+parseInt(_0x2a6a58(0x20b))/0x6+-parseInt(_0x2a6a58(0x1c9))/0x7+parseInt(_0x2a6a58(0x20d))/0x8*(-parseInt(_0x2a6a58(0x1ce))/0x9)+parseInt(_0x2a6a58(0x1b3))/0xa*(parseInt(_0x2a6a58(0x1dc))/0xb);if(_0x4ba3e0===_0x4a391d)break;else _0x1489cf['push'](_0x1489cf['shift']());}catch(_0x343f8b){_0x1489cf['push'](_0x1489cf['shift']());}}}(a19_0x5b70,0xbd44f));import{BaseCommand}from'./command.js';import{SDKError,ErrorCode}from'../sdk/index.js';import{handleSDKOutput,writeOutput}from'../core/command-output.js';function a19_0x5b70(){const _0x721546=['\x20bytes)','Deleting\x20project\x20\x27','Error:\x20Project\x20name\x20is\x20required','output','Creating\x20project\x20\x27','No\x20agents\x20found','\x20\x20Prompts:\x20','Usage:\x20tdx\x20llm\x20use\x20<project-name>','maxToolIterations','Backing\x20up\x20project\x20\x27','stack','counts','llm:use','llm:project:delete','dim','llm:project:backup','setCurrentProject','join','Restoring\x20project\x20from\x20\x27','Usage:\x20tdx\x20llm\x20agent\x20update\x20<agent-name>\x20[options]','projectName','Unknown','sort','log','[tool_call]','Load\x20more...','__load_more__','jsonl','Error:\x20At\x20least\x20one\x20update\x20field\x20is\x20required','chats','\x20\x20Cause:\x20','select','Checking\x20for\x20existing\x20projects...','[content]','2dfzZSK','Options:\x20--name,\x20--prompt,\x20--description,\x20--starter-message','model','backupProject','Update\x20an\x20existing\x20agent','25721330sZzslV','deleteAgent','tsv','tool','\x0aStack\x20trace:','⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20backup`\x20is\x20deprecated.','Delete\x20an\x20agent','No\x20chat\x20sessions\x20found.','just\x20now','last','\x20project(s)','map','llm','substring','json','Project\x20restored:\x20','set','\x20\x20\x20Use\x20`tdx\x20agent\x20push`\x20to\x20sync\x20from\x20local\x20files,\x20or\x20`tdx\x20agent\x20clone`\x20to\x20copy\x20a\x20project.','llm:projects','dryRun','\x27\x20already\x20exists.\x20Overwrite?','List\x20agents\x20in\x20current\x20project','4189353zYLYBQ','find','targetImageGenerator','\x0aCancelled','\x20\x20Integrations:\x20','9iBJsLw','agent','3221436YYFXnH','llm:agent:show','blue','\x20->\x20WebSearch:','llm:project:create','Invalid\x20path\x20syntax:\x20','h\x20ago','push','Fetching\x20most\x20recent\x20chat...','\x20->\x20Agent:','firstInputContent','default','11gUSlUb','resolveAgentId','\x20\x20\x20Examples:','numeric','split','yes','toLowerCase','llm:history','Project\x20created:\x20','⚒️\x20','error','magenta','string','starterMessage','[error]\x20\x20','format','\x20\x20\x20Example:\x20tdx\x20agent\x20pull\x20\x22MyProject\x22\x20-o\x20./my-agents','toLocaleDateString','updatedAt','Restore\x20cancelled.','544876oegrnd','resolveProjectId','\x20\x20\x20\x20\x20\x20\x20tdx\x20llm\x20agent\x20create\x20<project-name>/<agent-name>\x20[options]','lastConversationAt','Interactive\x20chat\x20selector\x20or\x20show\x20chat\x20history','tool_call','\x20--last','localeCompare','filter','Project\x20context\x20set\x20to:\x20','projects','integrations','Project\x20not\x20found:\x20','\x27...','restoreProject','\x20-\x20','getBackupMetadata','chatId','llm:agent:create','targetWebSearchTool','[INFO]\x20Cross-site\x20restore:\x20backup\x20was\x20created\x20on\x20\x27','Project\x20deleted:\x20','red','site','Usage:\x20tdx\x20llm\x20project\x20restore\x20<folder>\x20[--name\x20<new-name>]\x20[--dry-run]','Use\x20format:\x20project-name/agent-name','(no\x20agent)','2260620RFIDSd','tdx\x20llm\x20history','11791568AxtISS','agents','includes','Error:\x20Backup\x20folder\x20path\x20is\x20required','.llm','llm:agent:delete','Usage:\x20tdx\x20llm\x20agent\x20show\x20<agent-name>','claude-4.5-haiku','Error:\x20Cannot\x20use\x20--last\x20flag\x20with\x20chat-id\x20argument','Agent\x20created:\x20','LLM_PROJECT_NOT_FOUND','cause','floor','Deleting\x20agent...','Fetching\x20chat\x20sessions...','temperature','Fetching\x20agents...','[tool]\x20\x20\x20','image','Project\x20backed\x20up\x20to:\x20','Create\x20a\x20new\x20agent\x20in\x20current\x20project','data','attributes','\x20→\x20chat:\x20','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','createdAt','55MQdfXp','rmSync','Usage:\x20tdx\x20llm\x20agent\x20delete\x20<agent-name>','keys','yellow','List\x20all\x20LLM\x20projects','Resolving\x20agent\x20\x27','en-US','[input]\x20\x20','getTime','\x20->\x20ImageGen:','Creating\x20agent\x20\x27','entries','Fetching\x20available\x20models...','Error:\x20Agent\x20name\x20is\x20required','[DRY\x20RUN]\x20Would\x20backup\x20project\x20to:\x20','projectId','targetAgent','bold','Error:\x20','systemPrompt','verbose','llm:agents','outputDir','Use\x20arrow\x20keys\x20to\x20navigate,\x20Enter\x20to\x20select,\x20Esc\x20to\x20cancel','[unknown]','getCurrentProject','input','limit','execute','exportedFrom','prompts','No\x20messages\x20found\x20in\x20chat\x20history.','m\x20ago','Usage:\x20tdx\x20llm\x20agent\x20create\x20<name>\x20[options]','\x20\x20Agents:\x20','existsSync','cyan','323366wuUEBY','Show\x20agent\x20details','Output\x20directory\x20\x27','Fetching\x20agent...','\x20\x20\x20\x20\x20tdx\x20agent\x20push\x20./my-agents/my-project/','agentId','deleteProject','Agent\x20deleted:\x20','llm:agent:update','(no\x20message)','Resolving\x20project\x20\x27','message','name','models','\x20->\x20KB:','Create\x20a\x20new\x20LLM\x20project','No\x20projects\x20found','length','content','table','description','Agent\x20updated:\x20','\x20\x20Knowledge\x20Bases:\x20','prompt','Backup\x20cancelled.','stringify','knowledgeBases','Set\x20current\x20project\x20context','[DRY\x20RUN]\x20Would\x20restore\x20project:\x20','sourceSite','...','Usage:\x20tdx\x20llm\x20project\x20create\x20<name>\x20[--description\x20<text>]'];a19_0x5b70=function(){return _0x721546;};return a19_0x5b70();}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_0x19b28c from'node:fs';function handleSDKError(_0x2812bc,_0x67161a){const _0xd0e644=a19_0x18f2;if(_0x2812bc instanceof SDKError)console[_0xd0e644(0x1e6)](_0xd0e644(0x23a)+_0x2812bc[_0xd0e644(0x177)]),_0x67161a[_0xd0e644(0x23c)]&&(_0x2812bc['cause']&&console[_0xd0e644(0x1e6)](_0xd0e644(0x1aa)+_0x2812bc[_0xd0e644(0x218)]),_0x2812bc['stack']&&(console['error'](_0xd0e644(0x1b7)),console['error'](_0x2812bc[_0xd0e644(0x196)])));else throw _0x2812bc;}function formatChatHistoryEntry(_0x57a912,_0x5750cd){const _0x2f0aed=a19_0x18f2,_0xa8b07c=getChalk(_0x5750cd),_0x3228ec=_0xa8b07c[_0x2f0aed(0x19a)](_0x57a912['at']);if(_0x2f0aed(0x242)in _0x57a912){const _0x13faf5=_0xa8b07c[_0x2f0aed(0x24c)](_0x2f0aed(0x22f));return _0x3228ec+'\x20'+_0x13faf5+':\x20'+_0x57a912[_0x2f0aed(0x242)];}if(_0x2f0aed(0x17e)in _0x57a912){const _0x523c72=_0xa8b07c['green'](_0x2f0aed(0x1ad));return _0x3228ec+'\x20'+_0x523c72+':\x20'+_0x57a912[_0x2f0aed(0x17e)];}if('tool_call'in _0x57a912){const _0x32ad8e=_0xa8b07c['yellow'](_0x2f0aed(0x1a4)),{functionName:_0xf78eef,functionArguments:_0x5a547f,targetFunction:_0x1c9857}=_0x57a912[_0x2f0aed(0x1f5)];let _0xb4d265=_0x3228ec+'\x20'+_0x32ad8e+':\x20'+_0xa8b07c[_0x2f0aed(0x239)](_0xf78eef);if(_0x5a547f&&Object[_0x2f0aed(0x22a)](_0x5a547f)['length']>0x0){const _0x244e3d=Object[_0x2f0aed(0x233)](_0x5a547f)['map'](([_0x297e68,_0x36a2d5])=>_0x297e68+'='+JSON[_0x2f0aed(0x185)](_0x36a2d5))[_0x2f0aed(0x19d)](',\x20');_0xb4d265+='('+_0x244e3d+')';}_0x1c9857&&(_0xb4d265+=_0xa8b07c[_0x2f0aed(0x19a)]('\x20['+_0x1c9857+']'));let _0x215178='';if(_0x57a912[_0x2f0aed(0x1f5)]['targetKnowledgeBase'])_0x215178=_0x2f0aed(0x17a)+_0x57a912[_0x2f0aed(0x1f5)]['targetKnowledgeBase'][_0x2f0aed(0x178)];else{if(_0x57a912[_0x2f0aed(0x1f5)]['targetAgent'])_0x215178=_0x2f0aed(0x1d9)+_0x57a912[_0x2f0aed(0x1f5)][_0x2f0aed(0x238)][_0x2f0aed(0x178)];else{if(_0x57a912[_0x2f0aed(0x1f5)]['targetWebSearchTool'])_0x215178=_0x2f0aed(0x1d3)+_0x57a912['tool_call'][_0x2f0aed(0x203)]['name'];else _0x57a912['tool_call'][_0x2f0aed(0x1cb)]&&(_0x215178=_0x2f0aed(0x231)+_0x57a912[_0x2f0aed(0x1f5)][_0x2f0aed(0x1cb)][_0x2f0aed(0x178)]);}}return _0xb4d265+_0x215178;}if(_0x2f0aed(0x1b6)in _0x57a912){const _0x30ea5e=_0xa8b07c[_0x2f0aed(0x1e7)](_0x2f0aed(0x21e)),{functionName:_0xe11ec7,functionArguments:_0x341b01,content:_0x2d4d16,newChat:_0x2ff549}=_0x57a912[_0x2f0aed(0x1b6)];let _0x31187d=_0x3228ec+'\x20'+_0x30ea5e+':\x20'+_0xa8b07c[_0x2f0aed(0x239)](_0xe11ec7);if(_0x341b01){const _0x2c76d4=typeof _0x341b01===_0x2f0aed(0x1e8)?_0x341b01:JSON[_0x2f0aed(0x185)](_0x341b01);_0x31187d+='('+_0x2c76d4+')';}return _0x2d4d16&&(_0x31187d+='\x0a'+_0xa8b07c[_0x2f0aed(0x19a)](_0x2d4d16)),_0x2ff549&&(_0x31187d+=_0xa8b07c[_0x2f0aed(0x19a)](_0x2f0aed(0x224)+_0x2ff549['id'])),_0x31187d;}if(_0x2f0aed(0x18f)in _0x57a912){const _0xffea0d=_0xa8b07c[_0x2f0aed(0x1d2)]('[output]\x20');return _0x3228ec+'\x20'+_0xffea0d+':\x20'+_0x57a912[_0x2f0aed(0x18f)][_0x2f0aed(0x178)]+'\x20('+_0x57a912[_0x2f0aed(0x18f)][_0x2f0aed(0x17e)][_0x2f0aed(0x17d)]+_0x2f0aed(0x18c);}if(_0x2f0aed(0x21f)in _0x57a912){const _0x481151=_0xa8b07c['blue']('[image]\x20\x20'),{width:_0x1491f3,height:_0x142445,headerText:_0x4346a5}=_0x57a912[_0x2f0aed(0x21f)],_0x2b8d51=_0x4346a5?_0x2f0aed(0x1ff)+_0x4346a5:'';return _0x3228ec+'\x20'+_0x481151+':\x20'+_0x1491f3+'x'+_0x142445+_0x2b8d51;}if(_0x2f0aed(0x1e6)in _0x57a912){const _0xc724eb=_0xa8b07c[_0x2f0aed(0x206)](_0x2f0aed(0x1ea));return _0x3228ec+'\x20'+_0xc724eb+':\x20'+_0x57a912[_0x2f0aed(0x1e6)];}return _0x3228ec+'\x20'+_0xa8b07c[_0x2f0aed(0x19a)](_0x2f0aed(0x240))+':\x20'+JSON[_0x2f0aed(0x185)](_0x57a912);}async function executeChatHistoryCommand(_0x12d0e4,_0x1e3616){const _0x434313=a19_0x18f2,{options:_0x28922a,args:_0x3aa961,tdx:_0x112258}=_0x12d0e4,_0x4df092=_0x3aa961[0x0],_0x549818=_0x28922a,_0x3459dc=_0x549818[_0x434313(0x1bc)];try{if(_0x3459dc&&_0x4df092)return console[_0x434313(0x1e6)](_0x434313(0x215)),console[_0x434313(0x1e6)]('Usage:\x20'+_0x1e3616+_0x434313(0x1f6)),0x1;if(!_0x4df092&&!_0x3459dc&&_0x28922a[_0x434313(0x1eb)]!==undefined){const _0x1c7977=resolveLimit(_0x28922a['limit'],DEFAULT_LLM_LIMIT),_0x3ec9e2=await withSpinner(_0x434313(0x21b),()=>_0x112258[_0x434313(0x1bf)]['chats'](_0x1c7977),{'verbose':_0x28922a[_0x434313(0x23c)]});return await handleSDKOutput(_0x3ec9e2[_0x434313(0x222)],_0x28922a),0x0;}const _0x362a44=await getChatIdOrSelect(_0x112258,_0x28922a,_0x3459dc,_0x4df092);if(!_0x362a44)return 0x0;return await displayChatHistory(_0x362a44,_0x112258,_0x28922a),0x0;}catch(_0x2ad968){return handleSDKError(_0x2ad968,_0x28922a),0x1;}}async function displayChatHistory(_0x338d7d,_0x5f4028,_0x9d2e6d){const _0x23f790=a19_0x18f2,_0x8f7024=await withSpinner('Fetching\x20chat\x20history\x20for\x20\x27'+_0x338d7d+'\x27...',()=>_0x5f4028[_0x23f790(0x1bf)]['history'](_0x338d7d),{'verbose':_0x9d2e6d[_0x23f790(0x23c)]}),_0x1c3103=_0x8f7024['data']['data']??[];if(_0x1c3103['length']===0x0){console[_0x23f790(0x1a3)](_0x23f790(0x247));return;}if(_0x9d2e6d[_0x23f790(0x1eb)]!==undefined)await handleSDKOutput(_0x1c3103,_0x9d2e6d);else{const _0x2d6d66=_0x1c3103[_0x23f790(0x1be)](_0x30570b=>formatChatHistoryEntry(_0x30570b,_0x9d2e6d)),_0x4f2b74=_0x2d6d66[_0x23f790(0x19d)]('\x0a');await writeOutput(_0x4f2b74,_0x9d2e6d[_0x23f790(0x18f)],_0x23f790(0x17f));}}async function getChatIdOrSelect(_0x220f6e,_0x40d3c6,_0x28b52,_0x147bac){const _0x593939=a19_0x18f2;if(_0x147bac)return _0x147bac;if(_0x28b52){const _0x351b36=await withSpinner(_0x593939(0x1d8),()=>_0x220f6e[_0x593939(0x1bf)][_0x593939(0x1a9)](0x1),{'verbose':_0x40d3c6['verbose']});if(_0x351b36[_0x593939(0x222)][_0x593939(0x17d)]===0x0)return console[_0x593939(0x1a3)](_0x593939(0x1ba)),undefined;return _0x351b36[_0x593939(0x222)][0x0]['id'];}const _0x26d57f=await selectChatInteractively(_0x220f6e,_0x40d3c6);if(!_0x26d57f)return console[_0x593939(0x1a3)](_0x593939(0x1cc)),undefined;return _0x26d57f;}function a19_0x18f2(_0x196dd3,_0x2b1275){_0x196dd3=_0x196dd3-0x177;const _0x5b70bd=a19_0x5b70();let _0x18f209=_0x5b70bd[_0x196dd3];return _0x18f209;}async function getProjectIdOrDefault(_0x59d7e6){const _0x421c23=await getProjectWithName(_0x59d7e6);return _0x421c23['id'];}async function getProjectWithName(_0x18fa6f){const _0xf7f3a3=a19_0x18f2,{tdx:_0x5cf22e,options:_0x1f6c76}=_0x18fa6f,_0x59cf5e=_0x1f6c76['llmProject'];if(_0x59cf5e){const _0x5217e2=await withSpinner(_0xf7f3a3(0x257)+_0x59cf5e+'\x27...',()=>_0x5cf22e[_0xf7f3a3(0x1bf)][_0xf7f3a3(0x1f1)](_0x59cf5e),{'verbose':_0x1f6c76[_0xf7f3a3(0x23c)]});return{'id':_0x5217e2['data'],'name':_0x59cf5e};}const _0x366a9a=_0x5cf22e[_0xf7f3a3(0x1bf)][_0xf7f3a3(0x241)]();if(_0x366a9a){const _0x10b05a=await _0x5cf22e[_0xf7f3a3(0x1bf)][_0xf7f3a3(0x1fa)](),_0x444d59=_0x10b05a[_0xf7f3a3(0x1ca)](_0x48b521=>_0x48b521['id']===_0x366a9a);return{'id':_0x366a9a,'name':_0x444d59?.['attributes']['name']||_0xf7f3a3(0x1a1)};}const _0x58143e=await withSpinner('Getting\x20default\x20project...',()=>_0x5cf22e[_0xf7f3a3(0x1bf)]['getOrCreateDefaultProject'](),{'verbose':_0x1f6c76[_0xf7f3a3(0x23c)]});return{'id':_0x58143e[_0xf7f3a3(0x222)]['id'],'name':_0x58143e['data'][_0xf7f3a3(0x223)]['name']};}function toLLMProjectInfo(_0x4ee944){const _0x37ff5b=a19_0x18f2;return{'name':_0x4ee944['attributes'][_0x37ff5b(0x178)],'description':_0x4ee944[_0x37ff5b(0x223)]['description'],'createdAt':_0x4ee944[_0x37ff5b(0x223)][_0x37ff5b(0x226)],'updatedAt':_0x4ee944['attributes'][_0x37ff5b(0x1ee)]};}function toAgentInfo(_0x50db94){const _0x4453d9=a19_0x18f2;return{'name':_0x50db94['attributes'][_0x4453d9(0x178)],'description':_0x50db94[_0x4453d9(0x223)][_0x4453d9(0x180)],'prompt':truncatePrompt(_0x50db94[_0x4453d9(0x223)][_0x4453d9(0x183)]),'createdAt':_0x50db94['attributes'][_0x4453d9(0x226)],'updatedAt':_0x50db94[_0x4453d9(0x223)]['updatedAt']};}function truncatePrompt(_0x55f133){const _0x12b6f6=a19_0x18f2;if(!_0x55f133)return undefined;const _0x211080=0x64;if(_0x55f133[_0x12b6f6(0x17d)]<=_0x211080)return _0x55f133;return _0x55f133['slice'](0x0,_0x211080)+_0x12b6f6(0x18a);}export class LLMModelsCommand extends BaseCommand{['name']='llm:models';[a19_0x1ad83f(0x180)]='List\x20available\x20LLM\x20models';async[a19_0x1ad83f(0x244)](_0x59c062){const _0x50cd81=a19_0x1ad83f,{options:_0x29d092,tdx:_0x4dfe9c}=_0x59c062;try{const _0x4ac8ac=await withSpinner(_0x50cd81(0x234),()=>_0x4dfe9c[_0x50cd81(0x1bf)][_0x50cd81(0x179)](),{'verbose':_0x29d092[_0x50cd81(0x23c)]});return await handleSDKOutput(_0x4ac8ac[_0x50cd81(0x222)],_0x29d092),0x0;}catch(_0x44a22c){return handleSDKError(_0x44a22c,_0x29d092),0x1;}}}export class LLMProjectsCommand extends BaseCommand{[a19_0x1ad83f(0x178)]=a19_0x1ad83f(0x1c5);[a19_0x1ad83f(0x180)]=a19_0x1ad83f(0x22c);async[a19_0x1ad83f(0x244)](_0x201d57){const _0x2af5f9=a19_0x1ad83f,{options:_0x3192c0,args:_0x118518,tdx:_0x2165a7}=_0x201d57,_0x334fbd=getChalk(_0x3192c0),_0x190a62=_0x3192c0[_0x2af5f9(0x207)];try{const _0x4b6a88=_0x118518[0x0],_0x3b01f8=resolveLimit(_0x3192c0[_0x2af5f9(0x243)],DEFAULT_LLM_LIMIT),_0x4bbf7d=await withSpinner('Fetching\x20projects...',()=>_0x2165a7[_0x2af5f9(0x1bf)]['projects'](_0x3b01f8),{'verbose':_0x3192c0[_0x2af5f9(0x23c)]});let _0x22179a=_0x4bbf7d[_0x2af5f9(0x222)];_0x4b6a88&&(_0x22179a=_0x4bbf7d[_0x2af5f9(0x222)][_0x2af5f9(0x1f8)](_0x2f3315=>matchGlobPattern(_0x2f3315[_0x2af5f9(0x223)][_0x2af5f9(0x178)],_0x4b6a88)));const _0x299b1f=_0x3192c0[_0x2af5f9(0x1eb)]==='json'||_0x3192c0[_0x2af5f9(0x1eb)]===_0x2af5f9(0x1a7)||_0x3192c0[_0x2af5f9(0x1eb)]==='table'||_0x3192c0['format']===_0x2af5f9(0x1b5);if(_0x299b1f){const _0x4b0632=_0x22179a[_0x2af5f9(0x1be)](_0xd12da=>({...toLLMProjectInfo(_0xd12da),'url':getLLMProjectUrl(_0x190a62,_0xd12da['id'])}));await handleSDKOutput(_0x4b0632,_0x3192c0);}else{const _0x184cab=[];if(_0x22179a[_0x2af5f9(0x17d)]===0x0)_0x184cab['push'](_0x334fbd['dim'](_0x2af5f9(0x17c)));else{const _0xad107d=[..._0x22179a][_0x2af5f9(0x1a2)]((_0x39136b,_0x5e45e6)=>_0x39136b[_0x2af5f9(0x223)]['name'][_0x2af5f9(0x1f7)](_0x5e45e6['attributes']['name']));for(const _0xd44f8f of _0xad107d){const _0x18d8be=getLLMProjectUrl(_0x190a62,_0xd44f8f['id']),_0x59686c=hyperlink(_0xd44f8f[_0x2af5f9(0x223)][_0x2af5f9(0x178)],_0x18d8be);_0x184cab['push'](_0x2af5f9(0x1e5)+_0x59686c);}_0x184cab[_0x2af5f9(0x1d7)](_0x334fbd['dim'](_0x22179a[_0x2af5f9(0x17d)]+_0x2af5f9(0x1bd)));}await writeOutput(_0x184cab['join']('\x0a'),_0x3192c0[_0x2af5f9(0x18f)],_0x2af5f9(0x17f));}return 0x0;}catch(_0x22dcee){return handleSDKError(_0x22dcee,_0x3192c0),0x1;}}}export class LLMAgentsCommand extends BaseCommand{[a19_0x1ad83f(0x178)]=a19_0x1ad83f(0x23d);[a19_0x1ad83f(0x180)]=a19_0x1ad83f(0x1c8);async[a19_0x1ad83f(0x244)](_0x44e749){const _0x320c6d=a19_0x1ad83f,{options:_0x2dfd20,args:_0x3f6094,tdx:_0x34cf26}=_0x44e749,_0x198560=getChalk(_0x2dfd20),_0x383252=_0x2dfd20[_0x320c6d(0x207)];try{const _0x19871b=_0x3f6094[0x0];let _0x46eb7d=_0x19871b,_0x145ee6,_0x31aa59;if(_0x19871b&&_0x19871b['includes']('/')){const _0x45538c=_0x19871b[_0x320c6d(0x1e0)]('/');if(_0x45538c[_0x320c6d(0x17d)]===0x2){const [_0x82f416,_0x187d93]=_0x45538c,_0x58da3b=await _0x34cf26[_0x320c6d(0x1bf)][_0x320c6d(0x1fa)](),_0x537b3a=_0x58da3b[_0x320c6d(0x1ca)](_0x3b8825=>_0x3b8825[_0x320c6d(0x223)]['name'][_0x320c6d(0x1e2)]()===_0x82f416[_0x320c6d(0x1e2)]());if(!_0x537b3a)throw new SDKError(ErrorCode[_0x320c6d(0x217)],_0x320c6d(0x1fc)+_0x82f416,undefined,{'helpText':_0x320c6d(0x225)});_0x145ee6=_0x537b3a['id'],_0x31aa59=_0x537b3a['attributes'][_0x320c6d(0x178)],_0x46eb7d=_0x187d93;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x320c6d(0x1d5)+_0x19871b,undefined,{'helpText':'Use\x20format:\x20project-name/agent-name'});}else{const _0x56ad63=await getProjectWithName(_0x44e749);_0x145ee6=_0x56ad63['id'],_0x31aa59=_0x56ad63[_0x320c6d(0x178)];}const _0xae8b12=await withSpinner(_0x320c6d(0x21d),()=>_0x34cf26[_0x320c6d(0x1bf)][_0x320c6d(0x20e)](_0x145ee6),{'verbose':_0x2dfd20['verbose']});let _0x3b9ed9=_0xae8b12[_0x320c6d(0x222)];_0x46eb7d&&(_0x3b9ed9=_0xae8b12['data'][_0x320c6d(0x1f8)](_0x35a27a=>matchGlobPattern(_0x35a27a[_0x320c6d(0x223)][_0x320c6d(0x178)],_0x46eb7d)));const _0x41ceb9=_0x2dfd20[_0x320c6d(0x1eb)]===_0x320c6d(0x1c1)||_0x2dfd20[_0x320c6d(0x1eb)]==='jsonl'||_0x2dfd20['format']===_0x320c6d(0x17f)||_0x2dfd20[_0x320c6d(0x1eb)]===_0x320c6d(0x1b5);if(_0x41ceb9){const _0x248fdc=_0x3b9ed9[_0x320c6d(0x1be)](_0x4c3a2c=>({...toAgentInfo(_0x4c3a2c),'chatUrl':getLLMAgentChatUrl(_0x383252,_0x145ee6,_0x4c3a2c['id'])}));await handleSDKOutput(_0x248fdc,_0x2dfd20);}else{const _0x5926bd=[];_0x5926bd['push'](_0x198560[_0x320c6d(0x19a)]('['+_0x31aa59+']'));if(_0x3b9ed9['length']===0x0)_0x5926bd[_0x320c6d(0x1d7)](_0x198560[_0x320c6d(0x19a)](_0x320c6d(0x191)));else{const _0x59b385=[..._0x3b9ed9]['sort']((_0x477986,_0x27695a)=>_0x477986[_0x320c6d(0x223)][_0x320c6d(0x178)][_0x320c6d(0x1f7)](_0x27695a['attributes']['name']));for(const _0x3f51e7 of _0x59b385){const _0x1510ef=getLLMAgentChatUrl(_0x383252,_0x145ee6,_0x3f51e7['id']),_0x5c0711=hyperlink(_0x3f51e7[_0x320c6d(0x223)][_0x320c6d(0x178)],_0x1510ef);_0x5926bd[_0x320c6d(0x1d7)]('🤖\x20'+_0x5c0711);}_0x5926bd['push'](_0x198560[_0x320c6d(0x19a)](_0x3b9ed9[_0x320c6d(0x17d)]+'\x20agent(s)'));}await writeOutput(_0x5926bd[_0x320c6d(0x19d)]('\x0a'),_0x2dfd20[_0x320c6d(0x18f)],'table');}return 0x0;}catch(_0x501b22){return handleSDKError(_0x501b22,_0x2dfd20),0x1;}}}export class LLMAgentShowCommand extends BaseCommand{['name']=a19_0x1ad83f(0x1d1);[a19_0x1ad83f(0x180)]=a19_0x1ad83f(0x24e);async[a19_0x1ad83f(0x244)](_0x106b47){const _0x38fa20=a19_0x1ad83f,{options:_0x150962,args:_0x390ec2,tdx:_0xe8a27}=_0x106b47;if(_0x390ec2[_0x38fa20(0x17d)]===0x0)return console[_0x38fa20(0x1e6)](_0x38fa20(0x235)),console['error'](_0x38fa20(0x213)),0x1;const _0x256c88=_0x390ec2[0x0];try{const _0x1e4b91=await getProjectIdOrDefault(_0x106b47),_0x1f7dce=await withSpinner(_0x38fa20(0x22d)+_0x256c88+_0x38fa20(0x1fd),()=>_0xe8a27[_0x38fa20(0x1bf)]['resolveAgentId'](_0x256c88,_0x1e4b91),{'verbose':_0x150962[_0x38fa20(0x23c)]}),_0xa1d8e2=await withSpinner(_0x38fa20(0x250),()=>_0xe8a27[_0x38fa20(0x1bf)][_0x38fa20(0x1cf)](_0x1f7dce[_0x38fa20(0x222)]),{'verbose':_0x150962[_0x38fa20(0x23c)]});return await handleSDKOutput([_0xa1d8e2[_0x38fa20(0x222)]],_0x150962),0x0;}catch(_0x5abd22){return handleSDKError(_0x5abd22,_0x150962),0x1;}}}export class LLMAgentCreateCommand extends BaseCommand{['name']=a19_0x1ad83f(0x202);[a19_0x1ad83f(0x180)]=a19_0x1ad83f(0x221);async[a19_0x1ad83f(0x244)](_0x5120ce){const _0xd12b6c=a19_0x1ad83f,{options:_0x3c2b65,args:_0x25dd66,tdx:_0x341912}=_0x5120ce;if(_0x25dd66[_0xd12b6c(0x17d)]===0x0)return console[_0xd12b6c(0x1e6)](_0xd12b6c(0x235)),console[_0xd12b6c(0x1e6)](_0xd12b6c(0x249)),console[_0xd12b6c(0x1e6)](_0xd12b6c(0x1f2)),0x1;const _0xdeacac=_0x25dd66[0x0],_0x5803d6=_0x3c2b65,_0x1fe643=_0x5803d6[_0xd12b6c(0x23b)],_0x3d287d=_0x5803d6[_0xd12b6c(0x1b0)]||_0xd12b6c(0x214),_0x261564=_0x5803d6['starterMessage'],_0x422890=_0x5803d6[_0xd12b6c(0x194)]?Number(_0x5803d6[_0xd12b6c(0x194)]):undefined,_0x170d5b=_0x5803d6[_0xd12b6c(0x21c)]?Number(_0x5803d6['temperature']):undefined;try{let _0x64e56a,_0x4eed79;if(_0xdeacac[_0xd12b6c(0x20f)]('/')){const _0x4159ef=_0xdeacac[_0xd12b6c(0x1e0)]('/');if(_0x4159ef[_0xd12b6c(0x17d)]===0x2){const [_0x894586,_0x533345]=_0x4159ef,_0x4781f6=await withSpinner(_0xd12b6c(0x257)+_0x894586+_0xd12b6c(0x1fd),()=>_0x341912[_0xd12b6c(0x1bf)][_0xd12b6c(0x1f1)](_0x894586),{'verbose':_0x3c2b65[_0xd12b6c(0x23c)]});_0x64e56a=_0x4781f6[_0xd12b6c(0x222)],_0x4eed79=_0x533345;}else throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Invalid\x20path\x20syntax:\x20'+_0xdeacac,undefined,{'helpText':_0xd12b6c(0x209)});}else _0x64e56a=await getProjectIdOrDefault(_0x5120ce),_0x4eed79=_0xdeacac;const _0x1e7c98=await withSpinner(_0xd12b6c(0x232)+_0x4eed79+_0xd12b6c(0x1fd),()=>_0x341912[_0xd12b6c(0x1bf)]['createAgent']({'name':_0x4eed79,'projectId':_0x64e56a,'modelType':_0x3d287d,'systemPrompt':_0x1fe643,'starterMessage':_0x261564,'maxToolIterations':_0x422890,'temperature':_0x170d5b}),{'verbose':_0x3c2b65[_0xd12b6c(0x23c)]});return console[_0xd12b6c(0x1a3)](_0xd12b6c(0x216)+_0x1e7c98[_0xd12b6c(0x222)]['id']),await handleSDKOutput([_0x1e7c98['data']],_0x3c2b65),0x0;}catch(_0x13c8ad){return handleSDKError(_0x13c8ad,_0x3c2b65),0x1;}}}export class LLMAgentUpdateCommand extends BaseCommand{['name']=a19_0x1ad83f(0x255);[a19_0x1ad83f(0x180)]=a19_0x1ad83f(0x1b2);async[a19_0x1ad83f(0x244)](_0x348552){const _0x2ee738=a19_0x1ad83f,{options:_0x2d8ac3,args:_0xae51a7,tdx:_0x44ad1d}=_0x348552;if(_0xae51a7[_0x2ee738(0x17d)]===0x0)return console[_0x2ee738(0x1e6)](_0x2ee738(0x235)),console[_0x2ee738(0x1e6)](_0x2ee738(0x19f)),0x1;const _0xd81e99=_0xae51a7[0x0],_0x34a056=_0x2d8ac3,_0x4ae758=_0x34a056[_0x2ee738(0x178)],_0x226ab4=_0x34a056['prompt'],_0x2be616=_0x34a056[_0x2ee738(0x180)],_0x4f699d=_0x34a056[_0x2ee738(0x1e9)];if(!_0x4ae758&&!_0x226ab4&&!_0x2be616&&!_0x4f699d)return console[_0x2ee738(0x1e6)](_0x2ee738(0x1a8)),console[_0x2ee738(0x1e6)](_0x2ee738(0x1af)),0x1;try{const _0x472398=await getProjectIdOrDefault(_0x348552),_0x5bff45=await withSpinner(_0x2ee738(0x22d)+_0xd81e99+_0x2ee738(0x1fd),()=>_0x44ad1d[_0x2ee738(0x1bf)][_0x2ee738(0x1dd)](_0xd81e99,_0x472398),{'verbose':_0x2d8ac3['verbose']}),_0x238845=_0x5bff45['data'],_0x4360eb=await withSpinner('Updating\x20agent...',()=>_0x44ad1d[_0x2ee738(0x1bf)]['updateAgent'](_0x238845,{'name':_0x4ae758,'prompt':_0x226ab4,'description':_0x2be616,'starterMessage':_0x4f699d}),{'verbose':_0x2d8ac3[_0x2ee738(0x23c)]});return console[_0x2ee738(0x1a3)](_0x2ee738(0x181)+_0x4360eb[_0x2ee738(0x222)]['id']),await handleSDKOutput([_0x4360eb[_0x2ee738(0x222)]],_0x2d8ac3),0x0;}catch(_0x1ab753){return handleSDKError(_0x1ab753,_0x2d8ac3),0x1;}}}export class LLMAgentDeleteCommand extends BaseCommand{[a19_0x1ad83f(0x178)]=a19_0x1ad83f(0x212);['description']=a19_0x1ad83f(0x1b9);async[a19_0x1ad83f(0x244)](_0x517f38){const _0x2ff87b=a19_0x1ad83f,{options:_0x363090,args:_0xc6471a,tdx:_0xf7ee65}=_0x517f38;if(_0xc6471a[_0x2ff87b(0x17d)]===0x0)return console[_0x2ff87b(0x1e6)]('Error:\x20Agent\x20name\x20is\x20required'),console[_0x2ff87b(0x1e6)](_0x2ff87b(0x229)),0x1;const _0x451d11=_0xc6471a[0x0];try{const _0x50e586=await getProjectIdOrDefault(_0x517f38),_0xd201ce=await withSpinner(_0x2ff87b(0x22d)+_0x451d11+_0x2ff87b(0x1fd),()=>_0xf7ee65[_0x2ff87b(0x1bf)][_0x2ff87b(0x1dd)](_0x451d11,_0x50e586),{'verbose':_0x363090[_0x2ff87b(0x23c)]}),_0x39aac0=_0xd201ce[_0x2ff87b(0x222)];return await withSpinner(_0x2ff87b(0x21a),()=>_0xf7ee65[_0x2ff87b(0x1bf)][_0x2ff87b(0x1b4)](_0x39aac0),{'verbose':_0x363090[_0x2ff87b(0x23c)]}),console['log'](_0x2ff87b(0x254)+_0x39aac0),0x0;}catch(_0x39589a){return handleSDKError(_0x39589a,_0x363090),0x1;}}}export class LLMHistoryCommand extends BaseCommand{[a19_0x1ad83f(0x178)]=a19_0x1ad83f(0x1e3);[a19_0x1ad83f(0x180)]='Show\x20chat\x20history\x20or\x20list\x20chat\x20sessions';async['execute'](_0x31f5db){const _0x58d0ae=a19_0x1ad83f;return executeChatHistoryCommand(_0x31f5db,_0x58d0ae(0x20c));}}export class LLMUseCommand extends BaseCommand{[a19_0x1ad83f(0x178)]=a19_0x1ad83f(0x198);['description']=a19_0x1ad83f(0x187);async[a19_0x1ad83f(0x244)](_0x170142){const _0x1512e0=a19_0x1ad83f,{options:_0x896cf,args:_0x5e37e2,tdx:_0x310d3e}=_0x170142;if(_0x5e37e2[_0x1512e0(0x17d)]===0x0)return console[_0x1512e0(0x1e6)](_0x1512e0(0x18e)),console[_0x1512e0(0x1e6)](_0x1512e0(0x193)),0x1;const _0x1424f6=_0x5e37e2[0x0];try{return await withSpinner('Setting\x20project\x20context\x20to\x20\x27'+_0x1424f6+_0x1512e0(0x1fd),()=>_0x310d3e[_0x1512e0(0x1bf)][_0x1512e0(0x19c)](_0x1424f6),{'verbose':_0x896cf[_0x1512e0(0x23c)]}),console[_0x1512e0(0x1a3)](_0x1512e0(0x1f9)+_0x1424f6),0x0;}catch(_0x5a5a37){return handleSDKError(_0x5a5a37,_0x896cf),0x1;}}}export class LLMProjectCreateCommand extends BaseCommand{[a19_0x1ad83f(0x178)]=a19_0x1ad83f(0x1d4);[a19_0x1ad83f(0x180)]=a19_0x1ad83f(0x17b);async[a19_0x1ad83f(0x244)](_0x2216fe){const _0x16c824=a19_0x1ad83f,{options:_0xcf9321,args:_0x484bae,tdx:_0x2b1d75}=_0x2216fe;if(_0x484bae['length']===0x0)return console[_0x16c824(0x1e6)]('Error:\x20Project\x20name\x20is\x20required'),console['error'](_0x16c824(0x18b)),0x1;const _0x8ef65c=_0x484bae[0x0],_0x3769e2=_0xcf9321,_0x124e08=_0x3769e2['description'];try{const _0x295061=await withSpinner(_0x16c824(0x190)+_0x8ef65c+_0x16c824(0x1fd),()=>_0x2b1d75[_0x16c824(0x1bf)]['createProject']({'name':_0x8ef65c,'description':_0x124e08}),{'verbose':_0xcf9321['verbose']});console[_0x16c824(0x1a3)](_0x16c824(0x1e4)+_0x295061[_0x16c824(0x222)]['id']);const _0x2f7d7e=toLLMProjectInfo(_0x295061[_0x16c824(0x222)]);return await handleSDKOutput([_0x2f7d7e],_0xcf9321),0x0;}catch(_0x148381){return handleSDKError(_0x148381,_0xcf9321),0x1;}}}export class LLMProjectDeleteCommand extends BaseCommand{[a19_0x1ad83f(0x178)]=a19_0x1ad83f(0x199);[a19_0x1ad83f(0x180)]='Delete\x20an\x20LLM\x20project';async['execute'](_0x8acb69){const _0x11b435=a19_0x1ad83f,{options:_0x3b07ae,args:_0x351b10,tdx:_0x860f95}=_0x8acb69;if(_0x351b10['length']===0x0)return console[_0x11b435(0x1e6)]('Error:\x20Project\x20name\x20is\x20required'),console['error']('Usage:\x20tdx\x20llm\x20project\x20delete\x20<name>'),0x1;const _0xc92229=_0x351b10[0x0];try{return await withSpinner(_0x11b435(0x18d)+_0xc92229+'\x27...',()=>_0x860f95['llm'][_0x11b435(0x253)](_0xc92229),{'verbose':_0x3b07ae[_0x11b435(0x23c)]}),console[_0x11b435(0x1a3)](_0x11b435(0x205)+_0xc92229),0x0;}catch(_0x525284){return handleSDKError(_0x525284,_0x3b07ae),0x1;}}}export class LLMProjectBackupCommand extends BaseCommand{[a19_0x1ad83f(0x178)]=a19_0x1ad83f(0x19b);[a19_0x1ad83f(0x180)]='Backup\x20an\x20LLM\x20project\x20to\x20a\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20pull`)';async[a19_0x1ad83f(0x244)](_0x300f51){const _0x9f4fdd=a19_0x1ad83f,{options:_0x459dda,args:_0x131a74,tdx:_0x475f4d}=_0x300f51,_0x2ff9c1=getChalk(_0x459dda);console[_0x9f4fdd(0x1a3)](_0x2ff9c1[_0x9f4fdd(0x22b)](_0x9f4fdd(0x1b8))),console[_0x9f4fdd(0x1a3)](_0x2ff9c1[_0x9f4fdd(0x22b)]('\x20\x20\x20Use\x20`tdx\x20agent\x20pull`\x20instead\x20for\x20Git-friendly\x20YAML/Markdown\x20format.')),console[_0x9f4fdd(0x1a3)](_0x2ff9c1[_0x9f4fdd(0x19a)](_0x9f4fdd(0x1ec))),console[_0x9f4fdd(0x1a3)]();if(_0x131a74[_0x9f4fdd(0x17d)]===0x0)return console[_0x9f4fdd(0x1e6)](_0x9f4fdd(0x18e)),console['error']('Usage:\x20tdx\x20llm\x20project\x20backup\x20<name>\x20[-o\x20<output-folder>]\x20[--dry-run]'),0x1;const _0xb31233=_0x131a74[0x0],_0x5d2348=_0x459dda,_0x17ec50=_0x5d2348['output'],_0x41541f=_0x5d2348[_0x9f4fdd(0x1c6)];try{const _0x4a5ccf=_0x17ec50||_0xb31233+_0x9f4fdd(0x211);if(a19_0x19b28c[_0x9f4fdd(0x24b)](_0x4a5ccf)&&!_0x41541f){if(!_0x459dda[_0x9f4fdd(0x1e1)]){const _0x508188=await confirm(_0x9f4fdd(0x24f)+_0x4a5ccf+_0x9f4fdd(0x1c7));if(!_0x508188)return console[_0x9f4fdd(0x1a3)](_0x9f4fdd(0x184)),0x0;}a19_0x19b28c[_0x9f4fdd(0x228)](_0x4a5ccf,{'recursive':!![]});}const _0x428a7e=await withSpinner(_0x41541f?'Analyzing\x20project\x20\x27'+_0xb31233+_0x9f4fdd(0x1fd):_0x9f4fdd(0x195)+_0xb31233+_0x9f4fdd(0x1fd),()=>_0x475f4d[_0x9f4fdd(0x1bf)][_0x9f4fdd(0x1b1)](_0xb31233,_0x17ec50,{'dryRun':_0x41541f}),{'verbose':_0x459dda[_0x9f4fdd(0x23c)]}),_0x41633e=_0x428a7e[_0x9f4fdd(0x222)];return _0x41541f?console[_0x9f4fdd(0x1a3)](_0x9f4fdd(0x236)+_0x41633e[_0x9f4fdd(0x23e)]):console[_0x9f4fdd(0x1a3)](_0x9f4fdd(0x220)+_0x41633e['outputDir']),console[_0x9f4fdd(0x1a3)](_0x9f4fdd(0x24a)+_0x41633e['counts'][_0x9f4fdd(0x20e)]),console['log'](_0x9f4fdd(0x182)+_0x41633e['counts'][_0x9f4fdd(0x186)]),console[_0x9f4fdd(0x1a3)]('\x20\x20Prompts:\x20'+_0x41633e[_0x9f4fdd(0x197)][_0x9f4fdd(0x246)]),console[_0x9f4fdd(0x1a3)]('\x20\x20Integrations:\x20'+_0x41633e[_0x9f4fdd(0x197)][_0x9f4fdd(0x1fb)]),(_0x459dda[_0x9f4fdd(0x1eb)]==='json'||_0x459dda[_0x9f4fdd(0x1eb)]==='jsonl')&&await handleSDKOutput([_0x41633e],_0x459dda),0x0;}catch(_0x70989b){return handleSDKError(_0x70989b,_0x459dda),0x1;}}}export class LLMProjectRestoreCommand extends BaseCommand{[a19_0x1ad83f(0x178)]='llm:project:restore';['description']='Restore\x20an\x20LLM\x20project\x20from\x20a\x20backup\x20folder\x20(deprecated:\x20use\x20`tdx\x20agent\x20push/clone`)';async[a19_0x1ad83f(0x244)](_0x317178){const _0x4f82cd=a19_0x1ad83f,{options:_0x537fbc,args:_0x616c83,tdx:_0x2da9de}=_0x317178,_0xcba2ae=getChalk(_0x537fbc);console['log'](_0xcba2ae[_0x4f82cd(0x22b)]('⚠️\x20\x20DEPRECATED:\x20`tdx\x20llm\x20project\x20restore`\x20is\x20deprecated.')),console[_0x4f82cd(0x1a3)](_0xcba2ae[_0x4f82cd(0x22b)](_0x4f82cd(0x1c4))),console[_0x4f82cd(0x1a3)](_0xcba2ae[_0x4f82cd(0x19a)](_0x4f82cd(0x1de))),console[_0x4f82cd(0x1a3)](_0xcba2ae[_0x4f82cd(0x19a)](_0x4f82cd(0x251))),console[_0x4f82cd(0x1a3)](_0xcba2ae[_0x4f82cd(0x19a)]('\x20\x20\x20\x20\x20tdx\x20agent\x20clone\x20\x22SourceProject\x22\x20--name\x20\x22NewProject\x22')),console[_0x4f82cd(0x1a3)]();if(_0x616c83[_0x4f82cd(0x17d)]===0x0)return console[_0x4f82cd(0x1e6)](_0x4f82cd(0x210)),console[_0x4f82cd(0x1e6)](_0x4f82cd(0x208)),0x1;const _0x419497=_0x616c83[0x0],_0x4b41b9=_0x537fbc,_0x56c375=_0x4b41b9['name'],_0x5640f7=_0x4b41b9[_0x4f82cd(0x1c6)];try{if(!_0x5640f7){const _0x2ce5b9=_0x2da9de[_0x4f82cd(0x1bf)][_0x4f82cd(0x200)](_0x419497),_0xe4ac03=_0x56c375||_0x2ce5b9[_0x4f82cd(0x245)][_0x4f82cd(0x1a0)],_0x53095d=await withSpinner(_0x4f82cd(0x1ac),()=>_0x2da9de[_0x4f82cd(0x1bf)]['projects'](),{'verbose':_0x537fbc[_0x4f82cd(0x23c)]}),_0x2841e3=_0x53095d[_0x4f82cd(0x222)][_0x4f82cd(0x1ca)](_0x27a0be=>_0x27a0be['attributes'][_0x4f82cd(0x178)]===_0xe4ac03);if(_0x2841e3&&!_0x537fbc[_0x4f82cd(0x1e1)]){const _0x3481e1=await confirm('A\x20project\x20named\x20\x27'+_0xe4ac03+'\x27\x20already\x20exists.\x20Creating\x20will\x20fail.\x20Continue\x20anyway?');if(!_0x3481e1)return console[_0x4f82cd(0x1a3)](_0x4f82cd(0x1ef)),0x0;}}const _0x2c0c64=await withSpinner(_0x5640f7?'Validating\x20backup\x20from\x20\x27'+_0x419497+_0x4f82cd(0x1fd):_0x4f82cd(0x19e)+_0x419497+'\x27...',()=>_0x2da9de[_0x4f82cd(0x1bf)][_0x4f82cd(0x1fe)](_0x419497,{'name':_0x56c375,'dryRun':_0x5640f7}),{'verbose':_0x537fbc[_0x4f82cd(0x23c)]}),_0x836748=_0x2c0c64[_0x4f82cd(0x222)];return _0x836748[_0x4f82cd(0x189)]&&console[_0x4f82cd(0x1a3)](_0x4f82cd(0x204)+_0x836748[_0x4f82cd(0x189)]+'\x27'),_0x5640f7?console[_0x4f82cd(0x1a3)](_0x4f82cd(0x188)+_0x836748[_0x4f82cd(0x1a0)]):console['log'](_0x4f82cd(0x1c2)+_0x836748[_0x4f82cd(0x1a0)]+'\x20('+_0x836748[_0x4f82cd(0x237)]+')'),console[_0x4f82cd(0x1a3)](_0x4f82cd(0x24a)+_0x836748['counts'][_0x4f82cd(0x20e)]),console[_0x4f82cd(0x1a3)]('\x20\x20Knowledge\x20Bases:\x20'+_0x836748['counts'][_0x4f82cd(0x186)]),console[_0x4f82cd(0x1a3)](_0x4f82cd(0x192)+_0x836748[_0x4f82cd(0x197)][_0x4f82cd(0x246)]),console[_0x4f82cd(0x1a3)](_0x4f82cd(0x1cd)+_0x836748[_0x4f82cd(0x197)][_0x4f82cd(0x1fb)]),(_0x537fbc['format']===_0x4f82cd(0x1c1)||_0x537fbc[_0x4f82cd(0x1eb)]===_0x4f82cd(0x1a7))&&await handleSDKOutput([_0x836748],_0x537fbc),0x0;}catch(_0x43b02f){return handleSDKError(_0x43b02f,_0x537fbc),0x1;}}}const CHAT_SELECTOR_PAGE_SIZE=0xf;async function selectChatInteractively(_0x2162a1,_0x5cf1b4){const _0x5bd805=a19_0x1ad83f,_0x222183=_0x5cf1b4[_0x5bd805(0x243)]||CHAT_SELECTOR_PAGE_SIZE;let _0x43a81e=0x0,_0x47bd2d=[];const _0x4693aa=(await import('prompts'))[_0x5bd805(0x1db)],_0x1b66c8=getChalk(_0x5cf1b4);while(!![]){const _0xd59937=await withSpinner(_0x5bd805(0x21b),()=>_0x2162a1[_0x5bd805(0x1bf)][_0x5bd805(0x1a9)](_0x222183+_0x43a81e),{'verbose':_0x5cf1b4['verbose']});_0x47bd2d=_0xd59937['data'];const _0x321f4e=_0x47bd2d['slice'](_0x43a81e,_0x43a81e+_0x222183),_0x29cd5b=_0x47bd2d[_0x5bd805(0x17d)]>_0x43a81e+_0x222183,_0x31485c=[...new Set(_0x321f4e[_0x5bd805(0x1be)](_0x5eb71a=>_0x5eb71a[_0x5bd805(0x223)]['agentId'])['filter'](_0x3d20c8=>_0x3d20c8!==undefined))],_0xbc8419=new Map();await Promise['all'](_0x31485c[_0x5bd805(0x1be)](async _0x52054d=>{const _0xbc67d6=_0x5bd805;try{const _0x53204c=await _0x2162a1[_0xbc67d6(0x1bf)][_0xbc67d6(0x1cf)](_0x52054d);_0xbc8419[_0xbc67d6(0x1c3)](_0x52054d,_0x53204c[_0xbc67d6(0x223)][_0xbc67d6(0x178)]);}catch{_0xbc8419[_0xbc67d6(0x1c3)](_0x52054d,_0x52054d);}}));const _0x2be23f=_0x321f4e['map'](_0x2845c4=>{const _0x3b6a70=_0x5bd805,_0x14600d=_0x2845c4['attributes'][_0x3b6a70(0x1da)]||_0x3b6a70(0x256),_0x107295=_0x14600d[_0x3b6a70(0x1e0)]('\x0a')[0x0],_0x315d1a=_0x107295[_0x3b6a70(0x17d)]>0x50?_0x107295[_0x3b6a70(0x1c0)](0x0,0x4d)+'...':_0x107295,_0x549287=_0x2845c4[_0x3b6a70(0x223)]['agentId']?_0xbc8419['get'](_0x2845c4[_0x3b6a70(0x223)][_0x3b6a70(0x252)])||_0x2845c4[_0x3b6a70(0x223)][_0x3b6a70(0x252)]:_0x3b6a70(0x20a),_0x19ecb8=_0x2845c4[_0x3b6a70(0x223)][_0x3b6a70(0x1f3)]||_0x2845c4[_0x3b6a70(0x223)][_0x3b6a70(0x1ee)],_0x523142=new Date(_0x19ecb8),_0x1a81b8=new Date(),_0x203c2c=_0x1a81b8['getTime']()-_0x523142[_0x3b6a70(0x230)](),_0x3ae8bf=Math[_0x3b6a70(0x219)](_0x203c2c/0xea60),_0x53634b=Math[_0x3b6a70(0x219)](_0x203c2c/0x36ee80),_0x46d68d=Math[_0x3b6a70(0x219)](_0x203c2c/0x5265c00);let _0x3d3cdd;if(_0x3ae8bf<0x1)_0x3d3cdd=_0x3b6a70(0x1bb);else{if(_0x3ae8bf<0x3c)_0x3d3cdd=_0x3ae8bf+_0x3b6a70(0x248);else{if(_0x53634b<0x18)_0x3d3cdd=_0x53634b+_0x3b6a70(0x1d6);else _0x46d68d<0x7?_0x3d3cdd=_0x46d68d+'d\x20ago':_0x3d3cdd=_0x523142[_0x3b6a70(0x1ed)](_0x3b6a70(0x22e),{'month':'short','day':_0x3b6a70(0x1df)});}}return{'title':_0x315d1a+'\x20'+_0x1b66c8['dim']('['+_0x549287+']\x20'+_0x3d3cdd),'value':_0x2845c4['id']};});_0x29cd5b&&_0x2be23f[_0x5bd805(0x1d7)]({'title':_0x1b66c8[_0x5bd805(0x24c)](_0x5bd805(0x1a5)),'value':'__load_more__'});const _0x1f6391=await _0x4693aa({'type':_0x5bd805(0x1ab),'name':'chatId','message':'Select\x20a\x20chat\x20session:','choices':_0x2be23f,'hint':_0x5bd805(0x23f)});if(!_0x1f6391['chatId'])return undefined;if(_0x1f6391[_0x5bd805(0x201)]===_0x5bd805(0x1a6)){_0x43a81e+=_0x222183;continue;}return _0x1f6391[_0x5bd805(0x201)];}}export class ChatsCommand extends BaseCommand{[a19_0x1ad83f(0x178)]=a19_0x1ad83f(0x1a9);[a19_0x1ad83f(0x180)]=a19_0x1ad83f(0x1f4);async[a19_0x1ad83f(0x244)](_0x47d711){return executeChatHistoryCommand(_0x47d711,'tdx\x20chats');}}
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_0x476b8a=a20_0x6b53;(function(_0x4e826b,_0x13d0d3){const _0x5675e2=a20_0x6b53,_0x1f15ab=_0x4e826b();while(!![]){try{const _0x31a252=parseInt(_0x5675e2(0x17f))/0x1+-parseInt(_0x5675e2(0x14d))/0x2*(-parseInt(_0x5675e2(0x15d))/0x3)+parseInt(_0x5675e2(0x14b))/0x4*(-parseInt(_0x5675e2(0x172))/0x5)+-parseInt(_0x5675e2(0x165))/0x6*(-parseInt(_0x5675e2(0x17d))/0x7)+parseInt(_0x5675e2(0x16e))/0x8+parseInt(_0x5675e2(0x17e))/0x9+-parseInt(_0x5675e2(0x168))/0xa;if(_0x31a252===_0x13d0d3)break;else _0x1f15ab['push'](_0x1f15ab['shift']());}catch(_0x5c85d9){_0x1f15ab['push'](_0x1f15ab['shift']());}}}(a20_0x1c0a,0x3f0ae));import a20_0x1daa40 from'chalk';import{BaseCommand}from'./command.js';function a20_0x6b53(_0x10c2c0,_0x4463e5){_0x10c2c0=_0x10c2c0-0x147;const _0x1c0a43=a20_0x1c0a();let _0x6b53c6=_0x1c0a43[_0x10c2c0];return _0x6b53c6;}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(_0x33b13c,_0x34424c){const _0x222d9b=a20_0x6b53,{tdx:_0x561055,options:_0x2a0e89}=_0x33b13c,_0x3c5316=_0x34424c||_0x2a0e89[_0x222d9b(0x148)];if(_0x3c5316){const _0x571583=await _0x561055[_0x222d9b(0x163)][_0x222d9b(0x17a)](),_0x305928=_0x571583['find'](_0x40bcad=>_0x40bcad[_0x222d9b(0x15c)][_0x222d9b(0x179)]===_0x3c5316);if(!_0x305928)throw new SDKError(ErrorCode[_0x222d9b(0x155)],_0x222d9b(0x160)+_0x3c5316+_0x222d9b(0x15b),undefined,{'helpText':_0x222d9b(0x176)});return _0x305928['id'];}const _0x52a525=await _0x561055[_0x222d9b(0x163)]['getOrCreateDefaultProject']();return _0x52a525['id'];}export class LLMProxyCommand extends BaseCommand{[a20_0x476b8a(0x179)]='llm:proxy';[a20_0x476b8a(0x170)]='[EXPERIMENTAL]\x20Start\x20LLM\x20proxy\x20server\x20for\x20Claude\x20Code\x20integration';[a20_0x476b8a(0x147)];['logger'];async['execute'](_0x33b516){const _0x333968=a20_0x476b8a,{tdx:_0x1ae263,options:_0x41166e}=_0x33b516;try{const _0x441c65=_0x41166e,_0x4885ed=_0x441c65[_0x333968(0x153)]||0xfa0,_0x2abc1a=_0x441c65['project'],_0x3617b9=await findAvailablePort(_0x4885ed);console['log'](a20_0x1daa40['dim']('Resolving\x20project...'));const _0x278174=await getProjectIdOrDefault(_0x33b516,_0x2abc1a),_0x464440=await _0x1ae263[_0x333968(0x163)][_0x333968(0x17a)](),_0x14ca63=_0x464440[_0x333968(0x15a)](_0x40c867=>_0x40c867['id']===_0x278174);this['logger']=new TDXLogger(_0x41166e[_0x333968(0x159)]),await this[_0x333968(0x14f)][_0x333968(0x174)](),console['log'](a20_0x1daa40['dim']('Starting\x20proxy\x20server...'));_0x3617b9!==_0x4885ed&&console['log'](a20_0x1daa40[_0x333968(0x162)](_0x333968(0x183)+_0x4885ed+_0x333968(0x175)+_0x3617b9));this[_0x333968(0x147)]=new ProxyServer({'port':_0x3617b9,'projectId':_0x278174,'tdx':_0x1ae263,'logger':this[_0x333968(0x14f)],'site':_0x41166e[_0x333968(0x154)]}),await this[_0x333968(0x147)]['start'](),console[_0x333968(0x157)](a20_0x1daa40['yellow'][_0x333968(0x158)](_0x333968(0x16c))),console[_0x333968(0x157)](a20_0x1daa40[_0x333968(0x162)](_0x333968(0x164))),console[_0x333968(0x157)](a20_0x1daa40[_0x333968(0x162)](_0x333968(0x15e))),console[_0x333968(0x157)](a20_0x1daa40['green'][_0x333968(0x158)]('✓\x20TD\x20LLM\x20Proxy\x20Server\x20is\x20running!\x0a')),console[_0x333968(0x157)](a20_0x1daa40[_0x333968(0x14e)]('Server\x20Configuration:')),console[_0x333968(0x157)](a20_0x1daa40[_0x333968(0x156)](_0x333968(0x167)),a20_0x1daa40[_0x333968(0x177)]('http://0.0.0.0:'+_0x3617b9)),console[_0x333968(0x157)](a20_0x1daa40[_0x333968(0x156)](_0x333968(0x150)),a20_0x1daa40[_0x333968(0x177)](_0x14ca63?.['attributes'][_0x333968(0x179)]||_0x278174)),console[_0x333968(0x157)](a20_0x1daa40['dim'](_0x333968(0x15f)),a20_0x1daa40[_0x333968(0x177)]('created\x20on-demand\x20per\x20model')),console[_0x333968(0x157)](a20_0x1daa40[_0x333968(0x156)](_0x333968(0x14c)),a20_0x1daa40[_0x333968(0x177)](_0x41166e[_0x333968(0x154)])),console[_0x333968(0x157)](a20_0x1daa40['cyan'](_0x333968(0x161))),console[_0x333968(0x157)](a20_0x1daa40[_0x333968(0x156)](_0x333968(0x181))),console[_0x333968(0x157)](a20_0x1daa40[_0x333968(0x177)](_0x333968(0x166))),console[_0x333968(0x157)](a20_0x1daa40[_0x333968(0x177)](_0x333968(0x180))),console[_0x333968(0x157)](a20_0x1daa40['white']('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_BASE_URL\x22:\x20\x22http://127.0.0.1:'+_0x3617b9+'\x22,')),console[_0x333968(0x157)](a20_0x1daa40['white']('\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_MODEL\x22:\x20\x22sonnet\x22,')),console['log'](a20_0x1daa40[_0x333968(0x177)](_0x333968(0x171))),console[_0x333968(0x157)](a20_0x1daa40[_0x333968(0x177)](_0x333968(0x17c))),console[_0x333968(0x157)](a20_0x1daa40['white'](_0x333968(0x16f))),console[_0x333968(0x157)](a20_0x1daa40['cyan'](_0x333968(0x16a))),console[_0x333968(0x157)](a20_0x1daa40[_0x333968(0x156)](_0x333968(0x182))),console[_0x333968(0x157)](a20_0x1daa40[_0x333968(0x156)]('\x20\x20https://docs.claude.com/en/docs/agent-sdk/typescript')),console[_0x333968(0x157)](a20_0x1daa40[_0x333968(0x156)](_0x333968(0x16d))),console[_0x333968(0x157)](a20_0x1daa40[_0x333968(0x162)](_0x333968(0x149)));const _0x4955e9=async()=>{const _0x4b307d=_0x333968;console[_0x4b307d(0x157)](a20_0x1daa40[_0x4b307d(0x156)](_0x4b307d(0x16b))),this['server']&&await this[_0x4b307d(0x147)][_0x4b307d(0x152)](),this[_0x4b307d(0x14f)]&&await this[_0x4b307d(0x14f)][_0x4b307d(0x17b)](),console[_0x4b307d(0x157)](a20_0x1daa40[_0x4b307d(0x151)](_0x4b307d(0x14a))),process[_0x4b307d(0x169)](0x0);};return process['on'](_0x333968(0x178),_0x4955e9),process['on'](_0x333968(0x173),_0x4955e9),await new Promise(()=>{}),0x0;}catch(_0x6909af){this[_0x333968(0x147)]&&await this[_0x333968(0x147)][_0x333968(0x152)]();this[_0x333968(0x14f)]&&await this['logger'][_0x333968(0x17b)]();throw _0x6909af;}}}function a20_0x1c0a(){const _0x525c27=['dim','log','bold','logLevel','find','\x27\x20not\x20found','attributes','471699bwUveb','Please\x20report\x20issues\x20at:\x20https://github.com/treasure-data/tdx/issues\x0a','\x20\x20Agents:','Project\x20\x27','\x0aClaude\x20Code\x20Configuration:','yellow','llm','This\x20proxy\x20server\x20is\x20experimental\x20and\x20may\x20have\x20limitations.','18TzuKah','\x20\x20{','\x20\x20Address:','10456580LFtQYE','exit','\x0aTesting\x20with\x20Agent\x20SDK:','\x0a\x0aShutting\x20down\x20proxy\x20server...','\x0a⚠️\x20\x20EXPERIMENTAL\x20FEATURE','\x20\x20The\x20SDK\x20reads\x20.claude/settings.json\x20for\x20ANTHROPIC_BASE_URL\x0a','3306456hgOLBC','\x20\x20}','description','\x20\x20\x20\x20\x20\x20\x22ANTHROPIC_AUTH_TOKEN\x22:\x20\x22tdx-managed-proxy\x22','765oQetcJ','SIGTERM','init','\x20is\x20unavailable,\x20using\x20port\x20','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20see\x20available\x20projects','white','SIGINT','name','projects','close','\x20\x20\x20\x20}','1179157FpxTpO','629379tGWzVY','364300fFSXOp','\x20\x20\x20\x20\x22env\x22:\x20{','\x20\x20Create\x20a\x20.claude/settings.local.json\x20file\x20with:\x0a','\x20\x20The\x20proxy\x20can\x20also\x20be\x20tested\x20with\x20Claude\x20Agent\x20SDK','Port\x20','server','llmProject','Press\x20Ctrl+C\x20to\x20stop\x20the\x20server\x0a','✓\x20Proxy\x20server\x20stopped','5392TyqwLu','\x20\x20Site:','2zlzHqQ','cyan','logger','\x20\x20Project:','green','stop','port','site','NOT_FOUND'];a20_0x1c0a=function(){return _0x525c27;};return a20_0x1c0a();}
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;}}}