@treasuredata/tdx 0.16.1 → 0.16.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/describe.js +1 -1
  18. package/dist/commands/engage-command.js +1 -1
  19. package/dist/commands/job-command.js +1 -1
  20. package/dist/commands/journey-command.js +1 -1
  21. package/dist/commands/journey-validate-command.js +1 -1
  22. package/dist/commands/llm-command.js +1 -1
  23. package/dist/commands/llm-proxy.js +1 -1
  24. package/dist/commands/mcp-command.js +1 -1
  25. package/dist/commands/parent-segment-command.js +1 -1
  26. package/dist/commands/profile-command.js +1 -1
  27. package/dist/commands/profiles-command.js +1 -1
  28. package/dist/commands/query-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-update-command.js +1 -1
  35. package/dist/commands/segment-use-command.js +1 -1
  36. package/dist/commands/segment-validate-command.js +1 -1
  37. package/dist/commands/segments.js +1 -1
  38. package/dist/commands/show.js +1 -1
  39. package/dist/commands/tables.js +1 -1
  40. package/dist/commands/unset-command.js +1 -1
  41. package/dist/commands/use-command.js +1 -1
  42. package/dist/commands/user-command.js +1 -1
  43. package/dist/commands/workflow-command.js +1 -1
  44. package/dist/core/auth.js +1 -1
  45. package/dist/core/command-output.js +1 -1
  46. package/dist/core/config.js +1 -1
  47. package/dist/core/connection-cache.js +1 -1
  48. package/dist/core/constants.js +1 -1
  49. package/dist/core/credential-cache.js +1 -1
  50. package/dist/core/global-context.js +1 -1
  51. package/dist/core/keychain.js +1 -1
  52. package/dist/core/profile.js +1 -1
  53. package/dist/core/project-config.js +1 -1
  54. package/dist/core/session.js +1 -1
  55. package/dist/core/user-cache.js +1 -1
  56. package/dist/core/version.js +1 -1
  57. package/dist/index.js +1 -1
  58. package/dist/mcp/server.js +1 -1
  59. package/dist/mcp/tools/index.js +1 -1
  60. package/dist/mcp/tools/tdx-run.js +1 -1
  61. package/dist/mcp/tools/tdx-search.js +1 -1
  62. package/dist/mcp/utils.js +1 -1
  63. package/dist/proxy/anthropic-adapter.js +1 -1
  64. package/dist/proxy/claude-usage-tracker.js +1 -1
  65. package/dist/proxy/context-signature.js +1 -1
  66. package/dist/proxy/conversation-utils.js +1 -1
  67. package/dist/proxy/passthrough-server.js +1 -1
  68. package/dist/proxy/server.js +1 -1
  69. package/dist/proxy/session-cache.js +1 -1
  70. package/dist/proxy/sse-usage-parser.js +1 -1
  71. package/dist/sdk/agent/agent-config.js +1 -1
  72. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  73. package/dist/sdk/agent/agent-yaml.js +1 -1
  74. package/dist/sdk/agent/test/evaluator.js +1 -1
  75. package/dist/sdk/agent/test/executor.js +1 -1
  76. package/dist/sdk/agent/test/index.js +1 -1
  77. package/dist/sdk/agent/test/output.js +1 -1
  78. package/dist/sdk/agent/test/parser.js +1 -1
  79. package/dist/sdk/api.js +1 -1
  80. package/dist/sdk/claude-agent/claude-agent-client.d.ts +19 -1
  81. package/dist/sdk/claude-agent/claude-agent-client.d.ts.map +1 -1
  82. package/dist/sdk/claude-agent/claude-agent-client.js +1 -1
  83. package/dist/sdk/claude-agent/claude-agent-client.js.map +1 -1
  84. package/dist/sdk/claude-agent/environment.d.ts +9 -0
  85. package/dist/sdk/claude-agent/environment.d.ts.map +1 -1
  86. package/dist/sdk/claude-agent/environment.js +1 -1
  87. package/dist/sdk/claude-agent/environment.js.map +1 -1
  88. package/dist/sdk/claude-agent/index.js +1 -1
  89. package/dist/sdk/claude-agent/system-prompts.js +1 -1
  90. package/dist/sdk/claude-agent/types.d.ts +26 -0
  91. package/dist/sdk/claude-agent/types.d.ts.map +1 -1
  92. package/dist/sdk/client/cdp-api-client.js +1 -1
  93. package/dist/sdk/client/endpoints.js +1 -1
  94. package/dist/sdk/client/engage-api-client.js +1 -1
  95. package/dist/sdk/client/http-client.js +1 -1
  96. package/dist/sdk/client/llm-api-client.js +1 -1
  97. package/dist/sdk/client/rate-limiter.js +1 -1
  98. package/dist/sdk/client/td-api-client.js +1 -1
  99. package/dist/sdk/client/trino-api-client.js +1 -1
  100. package/dist/sdk/client/workflow-client.js +1 -1
  101. package/dist/sdk/connection-validator.js +1 -1
  102. package/dist/sdk/connection.js +1 -1
  103. package/dist/sdk/engage.js +1 -1
  104. package/dist/sdk/errors.js +1 -1
  105. package/dist/sdk/index.js +1 -1
  106. package/dist/sdk/io/index.js +1 -1
  107. package/dist/sdk/io/node-filesystem.js +1 -1
  108. package/dist/sdk/job.js +1 -1
  109. package/dist/sdk/journey.js +1 -1
  110. package/dist/sdk/llm/chat-cache.js +1 -1
  111. package/dist/sdk/llm/index.js +1 -1
  112. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  113. package/dist/sdk/llm/model-aliases.js +1 -1
  114. package/dist/sdk/llm/model-factors.js +1 -1
  115. package/dist/sdk/query/index.js +1 -1
  116. package/dist/sdk/query/sql-parser.js +1 -1
  117. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  118. package/dist/sdk/segment/fields-display.js +1 -1
  119. package/dist/sdk/segment/file-discovery.js +1 -1
  120. package/dist/sdk/segment/journey-utils.js +1 -1
  121. package/dist/sdk/segment/journey-yaml.js +1 -1
  122. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  123. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  124. package/dist/sdk/segment/pull-workflow.js +1 -1
  125. package/dist/sdk/segment/push-workflow.js +1 -1
  126. package/dist/sdk/segment/resolution-context.js +1 -1
  127. package/dist/sdk/segment/segment-path-parser.js +1 -1
  128. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  129. package/dist/sdk/segment/target-resolution.js +1 -1
  130. package/dist/sdk/segment/tdx-config.js +1 -1
  131. package/dist/sdk/segment/validate-files.js +1 -1
  132. package/dist/sdk/segment/yaml-validator.js +1 -1
  133. package/dist/sdk/segment.js +1 -1
  134. package/dist/sdk/types/index.js +1 -1
  135. package/dist/sdk/types/progress.js +1 -1
  136. package/dist/sdk/user.js +1 -1
  137. package/dist/sdk/util/format-detector.js +1 -1
  138. package/dist/sdk/util/formatters.js +1 -1
  139. package/dist/sdk/util/index.js +1 -1
  140. package/dist/sdk/util/tree-formatter.js +1 -1
  141. package/dist/sdk/workflow/clone-workflow.js +1 -1
  142. package/dist/sdk/workflow/index.js +1 -1
  143. package/dist/sdk/workflow/pull-workflow.js +1 -1
  144. package/dist/sdk/workflow/push-workflow.js +1 -1
  145. package/dist/sdk/workflow/tdx-config.js +1 -1
  146. package/dist/sdk/workflow/workflow-utils.js +1 -1
  147. package/dist/utils/async.js +1 -1
  148. package/dist/utils/colors.js +1 -1
  149. package/dist/utils/diff.js +1 -1
  150. package/dist/utils/file-permissions.js +1 -1
  151. package/dist/utils/json-loader.js +1 -1
  152. package/dist/utils/option-validation.js +1 -1
  153. package/dist/utils/port.js +1 -1
  154. package/dist/utils/process.js +1 -1
  155. package/dist/utils/prompt.js +1 -1
  156. package/dist/utils/spinner.js +1 -1
  157. package/dist/utils/sse-parser.js +1 -1
  158. package/dist/utils/string-utils.js +1 -1
  159. package/dist/utils/table-ref-parser.js +1 -1
  160. package/dist/utils/tdx-logger.js +1 -1
  161. package/dist/utils/version-check.js +1 -1
  162. package/package.json +1 -1
@@ -1 +1 @@
1
- const a103_0x4a85e0=a103_0x37a0;(function(_0x44d606,_0x33ef72){const _0x17d589=a103_0x37a0,_0x4c634e=_0x44d606();while(!![]){try{const _0x259069=parseInt(_0x17d589(0x1ac))/0x1*(-parseInt(_0x17d589(0x1a1))/0x2)+parseInt(_0x17d589(0x1b7))/0x3+parseInt(_0x17d589(0x197))/0x4*(parseInt(_0x17d589(0x1a7))/0x5)+-parseInt(_0x17d589(0x194))/0x6+parseInt(_0x17d589(0x1b1))/0x7*(parseInt(_0x17d589(0x18d))/0x8)+parseInt(_0x17d589(0x1b6))/0x9*(parseInt(_0x17d589(0x176))/0xa)+parseInt(_0x17d589(0x17f))/0xb*(-parseInt(_0x17d589(0x171))/0xc);if(_0x259069===_0x33ef72)break;else _0x4c634e['push'](_0x4c634e['shift']());}catch(_0xf07508){_0x4c634e['push'](_0x4c634e['shift']());}}}(a103_0x461a,0x5c15e));import{CDPApiClient}from'./client/cdp-api-client.js';import{SDKError,ErrorCode,isHttp404Error}from'./errors.js';function getBundleId(_0x10c73d){const _0x15aaf3=a103_0x37a0;return _0x10c73d[_0x15aaf3(0x182)]??_0x10c73d[_0x15aaf3(0x17d)]?.[_0x15aaf3(0x182)]??undefined;}function getVersionNumber(_0x35c9c9){const _0x570b83=a103_0x37a0;return _0x35c9c9[_0x570b83(0x1b2)]??_0x35c9c9[_0x570b83(0x17d)]?.['versionNumber']??0x0;}function a103_0x461a(){const _0xc54cab=['folder-segment','950112EPXygg','listActivations','client','2396hbvGKo','relationships','activationStepsById','create','JOURNEY_NOT_FOUND','listJourneysFromParentSegment','journeys','getJourney','all','description','815390nGoECY','string','find','journey','pauseJourney','listEntitiesByFolder','4735MQIkVu','push','listJourneysWithFolders','getActivation','flat','1gfygAk','resume','add','idx-','Journey\x20activation\x20step\x20not\x20found:\x20','91fLqCPQ','versionNumber','includeAllVersions','getStatistics','rootFolderId','9KrqqTk','2124135bzjfZV','parentFolder','listJourneys','data','\x20in\x20journey\x20','createdAt','filter','19950036xxjzZH','listSegmentFolders','get','type','resumeJourney','5924630lBdhSE','NOT_FOUND','journeyBundleName','simulation','listJourneysWithDetailsFromParentSegment','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','update','attributes','map','11pMrOHc','createJourney','logger','journeyBundleId','segmentFolderId','updatedAt','set','Journey\x20not\x20found:\x20','getJourneyStatistics','listJourneyActivations','getParentSegmentFull','draft','name','applyVersionDeduplication','454136NdFZfK','toLowerCase','getJourneyActivation','createJourneyActivation','has','listJourneysWithDetails'];a103_0x461a=function(){return _0xc54cab;};return a103_0x461a();}export function deduplicateJourneysByBundle(_0xf5a258){const _0x18443b=a103_0x37a0,_0xf04518=new Map();let _0x82a10e=0x0;for(const _0x1429eb of _0xf5a258){const _0x163ae6=getBundleId(_0x1429eb);if(!_0x163ae6){const _0x545d35='no-bundle-'+(_0x1429eb['id']??_0x18443b(0x1af)+_0x82a10e++);_0xf04518[_0x18443b(0x185)](_0x545d35,_0x1429eb);continue;}const _0x535010=_0xf04518[_0x18443b(0x173)](_0x163ae6);if(!_0x535010)_0xf04518[_0x18443b(0x185)](_0x163ae6,_0x1429eb);else{const _0x585129=getVersionNumber(_0x535010),_0x2d5c70=getVersionNumber(_0x1429eb);_0x2d5c70>_0x585129&&_0xf04518[_0x18443b(0x185)](_0x163ae6,_0x1429eb);}}return Array['from'](_0xf04518['values']());}const VALID_JOURNEY_STATES=new Set([a103_0x4a85e0(0x18a),a103_0x4a85e0(0x179),'launched']);function a103_0x37a0(_0x4b10b4,_0x299aef){_0x4b10b4=_0x4b10b4-0x16f;const _0x461a40=a103_0x461a();let _0x37a0f2=_0x461a40[_0x4b10b4];return _0x37a0f2;}export function parseJourneyState(_0x5d8b4a){const _0xc78709=a103_0x4a85e0;if(typeof _0x5d8b4a===_0xc78709(0x1a2)&&VALID_JOURNEY_STATES[_0xc78709(0x191)](_0x5d8b4a))return _0x5d8b4a;return'draft';}export function entityToJourneyListItem(_0x46ffa9,_0x234766){const _0x343366=a103_0x4a85e0,_0xaab4ac=_0x46ffa9[_0x343366(0x17d)];return{'id':_0x46ffa9['id'],'name':_0xaab4ac['name']??'','journeyBundleName':_0xaab4ac['journeyBundleName']??_0xaab4ac[_0x343366(0x18b)]??'','journeyBundleId':_0xaab4ac[_0x343366(0x182)]??'','versionNumber':_0xaab4ac[_0x343366(0x1b2)],'description':_0xaab4ac[_0x343366(0x1a0)]??null,'state':parseJourneyState(_0xaab4ac['state']),'paused':_0xaab4ac['paused']??![],'audienceId':_0x234766,'folderId':_0xaab4ac[_0x343366(0x183)]??_0x46ffa9[_0x343366(0x198)]?.[_0x343366(0x1b8)]?.[_0x343366(0x1ba)]?.['id']??null,'createdAt':_0xaab4ac[_0x343366(0x16f)]??'','updatedAt':_0xaab4ac[_0x343366(0x184)]??''};}export class JourneySDK{['client'];constructor(_0x1a1d8a){const _0x18688c=a103_0x4a85e0;this['client']=new CDPApiClient(_0x1a1d8a,_0x1a1d8a[_0x18688c(0x181)]);}['applyVersionDeduplication'](_0x11ebfc,_0x23c4fe){return _0x23c4fe?_0x11ebfc:deduplicateJourneysByBundle(_0x11ebfc);}async[a103_0x4a85e0(0x192)](_0x27c6e0,_0x29a033){const _0x4fe498=a103_0x4a85e0;try{const _0x3a0663=await this[_0x4fe498(0x196)][_0x4fe498(0x192)](_0x27c6e0);return{'journeys':this[_0x4fe498(0x18c)](_0x3a0663['journeys'],_0x29a033),'activationStepsById':_0x3a0663[_0x4fe498(0x199)]};}catch(_0x3770c1){if(isHttp404Error(_0x3770c1))return{'journeys':[],'activationStepsById':new Map()};throw _0x3770c1;}}async[a103_0x4a85e0(0x19c)](_0x66aa9b,_0x1a1c14,_0x548d36){const _0x58acc3=a103_0x4a85e0;let _0x2568fc=_0x1a1c14;if(!_0x2568fc)try{const _0x183ca3=await this[_0x58acc3(0x196)][_0x58acc3(0x189)](_0x66aa9b);_0x2568fc=_0x183ca3[_0x58acc3(0x1b5)]??undefined;}catch(_0x18dd16){if(isHttp404Error(_0x18dd16))return[];throw _0x18dd16;}if(!_0x2568fc)return[];let _0x52c498;if(_0x548d36?.[_0x58acc3(0x1b3)]){const _0x4e8cfb=await this[_0x58acc3(0x196)][_0x58acc3(0x172)](_0x66aa9b),_0x3f469c=_0x4e8cfb[_0x58acc3(0x17e)](_0x35fadc=>this[_0x58acc3(0x196)][_0x58acc3(0x1b9)](_0x35fadc['id'])),_0x2c7d1c=await Promise[_0x58acc3(0x19f)](_0x3f469c);_0x52c498=_0x2c7d1c[_0x58acc3(0x1ab)]();}else{const _0x4d4830=await this[_0x58acc3(0x196)][_0x58acc3(0x1a6)](_0x2568fc,0x20,![]),_0x3a39a3=_0x4d4830['data'],_0x5f2457=_0x3a39a3[_0x58acc3(0x170)](_0x12a43c=>_0x12a43c[_0x58acc3(0x174)]===_0x58acc3(0x1a4));_0x52c498=_0x5f2457[_0x58acc3(0x17e)](_0x33b851=>entityToJourneyListItem(_0x33b851,_0x66aa9b));}return this[_0x58acc3(0x18c)](_0x52c498,_0x548d36?.['includeAllVersions']);}async[a103_0x4a85e0(0x1a9)](_0x753590,_0x47335a,_0x26766c){const _0x1aa04e=a103_0x4a85e0;if(!_0x47335a)return{'journeys':[],'folders':[]};const _0x2e916d=await this['client'][_0x1aa04e(0x1a6)](_0x47335a,0x20,![]),_0x154382=_0x2e916d[_0x1aa04e(0x1ba)],_0x4d2996=_0x154382[_0x1aa04e(0x170)](_0x589442=>_0x589442['type']===_0x1aa04e(0x193)&&_0x589442['id']!==_0x47335a),_0x4d2bee=_0x4d2996[_0x1aa04e(0x17e)](_0x42c763=>({'id':_0x42c763['id'],'name':_0x42c763[_0x1aa04e(0x17d)][_0x1aa04e(0x18b)]})),_0x36369d=_0x154382[_0x1aa04e(0x170)](_0x582184=>_0x582184[_0x1aa04e(0x174)]===_0x1aa04e(0x1a4)),_0x4004e3=_0x36369d[_0x1aa04e(0x17e)](_0x56c57c=>entityToJourneyListItem(_0x56c57c,_0x753590));return{'journeys':this[_0x1aa04e(0x18c)](_0x4004e3,_0x26766c?.[_0x1aa04e(0x1b3)]),'folders':_0x4d2bee};}async[a103_0x4a85e0(0x17a)](_0x6e74b6,_0x3de14b){const _0x50a2fe=a103_0x4a85e0;let _0x4f1aae;try{_0x4f1aae=await this['client'][_0x50a2fe(0x172)](_0x6e74b6);}catch(_0x285df9){if(isHttp404Error(_0x285df9))return{'journeys':[],'activationStepsById':new Map()};throw _0x285df9;}const _0x1c9364=_0x4f1aae[_0x50a2fe(0x17e)](async _0x2a5087=>{const _0x52ea9b=_0x50a2fe;return await this[_0x52ea9b(0x192)](_0x2a5087['id'],_0x3de14b?.[_0x52ea9b(0x1b3)]);}),_0x1d2bcc=await Promise[_0x50a2fe(0x19f)](_0x1c9364),_0x5ba8fc=new Map(),_0x354dfe=[];for(const _0x144287 of _0x1d2bcc){_0x354dfe[_0x50a2fe(0x1a8)](..._0x144287[_0x50a2fe(0x19d)]);for(const [_0x3790e9,_0x3c6c80]of _0x144287[_0x50a2fe(0x199)]){_0x5ba8fc[_0x50a2fe(0x185)](_0x3790e9,_0x3c6c80);}}const _0x3c6407=new Set(),_0xec3f25=_0x354dfe[_0x50a2fe(0x170)](_0x1af01e=>{const _0x28b732=_0x50a2fe;if(_0x3c6407[_0x28b732(0x191)](_0x1af01e['id']))return![];return _0x3c6407[_0x28b732(0x1ae)](_0x1af01e['id']),!![];});return{'journeys':this[_0x50a2fe(0x18c)](_0xec3f25,_0x3de14b?.[_0x50a2fe(0x1b3)]),'activationStepsById':_0x5ba8fc};}async['getJourney'](_0x421208){const _0x6b8f8=a103_0x4a85e0;try{return await this[_0x6b8f8(0x196)][_0x6b8f8(0x19e)](_0x421208);}catch(_0x124436){if(isHttp404Error(_0x124436))throw new SDKError(ErrorCode[_0x6b8f8(0x19b)],_0x6b8f8(0x186)+_0x421208,_0x124436);throw _0x124436;}}async['resolveJourneyId'](_0x2ff24b,_0x378191){const _0x187188=a103_0x4a85e0,_0x57d83d=await this[_0x187188(0x19c)](_0x2ff24b),_0x16755d=_0x57d83d[_0x187188(0x1a3)](_0x5ad71e=>_0x5ad71e[_0x187188(0x178)][_0x187188(0x18e)]()===_0x378191[_0x187188(0x18e)]());if(!_0x16755d)throw new SDKError(ErrorCode[_0x187188(0x19b)],_0x187188(0x186)+_0x378191,undefined,{'helpText':_0x187188(0x17b)});return _0x16755d['id'];}async[a103_0x4a85e0(0x1b4)](_0x42a70f){const _0x39d7d5=a103_0x4a85e0;try{return await this[_0x39d7d5(0x196)][_0x39d7d5(0x187)](_0x42a70f);}catch(_0x381e9b){if(isHttp404Error(_0x381e9b))throw new SDKError(ErrorCode[_0x39d7d5(0x19b)],_0x39d7d5(0x186)+_0x42a70f,_0x381e9b);throw _0x381e9b;}}async['pause'](_0x4cbcdf){const _0x5a3dfd=a103_0x4a85e0;try{return await this[_0x5a3dfd(0x196)][_0x5a3dfd(0x1a5)](_0x4cbcdf);}catch(_0x5c6ba5){if(isHttp404Error(_0x5c6ba5))throw new SDKError(ErrorCode[_0x5a3dfd(0x19b)],_0x5a3dfd(0x186)+_0x4cbcdf,_0x5c6ba5);throw _0x5c6ba5;}}async[a103_0x4a85e0(0x1ad)](_0x1eb8ad){const _0x53c173=a103_0x4a85e0;try{return await this[_0x53c173(0x196)][_0x53c173(0x175)](_0x1eb8ad);}catch(_0x1a961c){if(isHttp404Error(_0x1a961c))throw new SDKError(ErrorCode[_0x53c173(0x19b)],'Journey\x20not\x20found:\x20'+_0x1eb8ad,_0x1a961c);throw _0x1a961c;}}async[a103_0x4a85e0(0x19a)](_0x2b3ffa){const _0x422b6a=a103_0x4a85e0;return await this[_0x422b6a(0x196)][_0x422b6a(0x180)](_0x2b3ffa);}async[a103_0x4a85e0(0x17c)](_0x4680dd,_0x38c4c6){const _0x55ca40=a103_0x4a85e0;try{return await this[_0x55ca40(0x196)]['updateJourney'](_0x4680dd,_0x38c4c6);}catch(_0x55fe6f){if(isHttp404Error(_0x55fe6f))throw new SDKError(ErrorCode[_0x55ca40(0x19b)],_0x55ca40(0x186)+_0x4680dd,_0x55fe6f);throw _0x55fe6f;}}async[a103_0x4a85e0(0x1aa)](_0x133aa4,_0x3b66d7){const _0x5515bc=a103_0x4a85e0;try{return await this['client'][_0x5515bc(0x18f)](_0x133aa4,_0x3b66d7);}catch(_0x3b0857){if(isHttp404Error(_0x3b0857))throw new SDKError(ErrorCode[_0x5515bc(0x177)],_0x5515bc(0x1b0)+_0x3b66d7+_0x5515bc(0x1bb)+_0x133aa4,_0x3b0857);throw _0x3b0857;}}async[a103_0x4a85e0(0x195)](_0x2bb00b){const _0x3e20f0=a103_0x4a85e0;try{return await this['client'][_0x3e20f0(0x188)](_0x2bb00b);}catch(_0x254a36){if(isHttp404Error(_0x254a36))return[];throw _0x254a36;}}async['createActivation'](_0x518368,_0x172aca){const _0x5a0d38=a103_0x4a85e0;return await this[_0x5a0d38(0x196)][_0x5a0d38(0x190)](_0x518368,_0x172aca);}}
1
+ const a103_0x12dc57=a103_0x10b0;(function(_0x130421,_0x54c17e){const _0x2831a1=a103_0x10b0,_0x387609=_0x130421();while(!![]){try{const _0xae059b=-parseInt(_0x2831a1(0x13d))/0x1+-parseInt(_0x2831a1(0x12c))/0x2+-parseInt(_0x2831a1(0x115))/0x3*(parseInt(_0x2831a1(0x137))/0x4)+parseInt(_0x2831a1(0x159))/0x5+parseInt(_0x2831a1(0x121))/0x6*(-parseInt(_0x2831a1(0x12a))/0x7)+parseInt(_0x2831a1(0x152))/0x8*(parseInt(_0x2831a1(0x147))/0x9)+parseInt(_0x2831a1(0x131))/0xa*(parseInt(_0x2831a1(0x11a))/0xb);if(_0xae059b===_0x54c17e)break;else _0x387609['push'](_0x387609['shift']());}catch(_0x2ae80c){_0x387609['push'](_0x387609['shift']());}}}(a103_0x3bd4,0x41fbb));function a103_0x3bd4(){const _0x2a8b7c=['flat','getJourney','description','has','listJourneysWithDetailsFromParentSegment','598508xefJue','listJourneysWithFolders','journeys','listSegmentFolders','resolveJourneyId','listJourneysWithDetails','540379EkAdVJ','create','data','toLowerCase','createJourney','createJourneyActivation','journeyBundleId','get','JOURNEY_NOT_FOUND','map','45hEExyE','listActivations','segmentFolderId','applyVersionDeduplication','name','\x20in\x20journey\x20','all','from','includeAllVersions','journeyBundleName','parentFolder','204728YONyhB','pause','getStatistics','resume','Use\x20\x22tdx\x20journey\x20list\x22\x20to\x20see\x20available\x20journeys','listJourneyActivations','type','1484635PqJfHL','relationships','no-bundle-','getJourneyActivation','paused','push','attributes','values','set','rootFolderId','9DICFEz','createdAt','updatedAt','filter','Journey\x20activation\x20step\x20not\x20found:\x20','43879CnFQQl','listEntitiesByFolder','add','string','getActivation','listJourneys','find','4602OeqVwC','getJourneyStatistics','activationStepsById','update','NOT_FOUND','versionNumber','idx-','listJourneysFromParentSegment','draft','4179FzDJPk','getParentSegmentFull','71586XtLRJB','client','journey','Journey\x20not\x20found:\x20','pauseJourney','3330osmoVh'];a103_0x3bd4=function(){return _0x2a8b7c;};return a103_0x3bd4();}import{CDPApiClient}from'./client/cdp-api-client.js';import{SDKError,ErrorCode,isHttp404Error}from'./errors.js';function getBundleId(_0x5f03fd){const _0x2023ad=a103_0x10b0;return _0x5f03fd[_0x2023ad(0x143)]??_0x5f03fd[_0x2023ad(0x15f)]?.[_0x2023ad(0x143)]??undefined;}function getVersionNumber(_0xaa2c6c){const _0x16138e=a103_0x10b0;return _0xaa2c6c[_0x16138e(0x126)]??_0xaa2c6c[_0x16138e(0x15f)]?.[_0x16138e(0x126)]??0x0;}export function deduplicateJourneysByBundle(_0x62a49c){const _0x575151=a103_0x10b0,_0x2333f2=new Map();let _0xf40b3c=0x0;for(const _0x523b71 of _0x62a49c){const _0x1dcf26=getBundleId(_0x523b71);if(!_0x1dcf26){const _0x576421=_0x575151(0x15b)+(_0x523b71['id']??_0x575151(0x127)+_0xf40b3c++);_0x2333f2[_0x575151(0x161)](_0x576421,_0x523b71);continue;}const _0x404d4d=_0x2333f2[_0x575151(0x144)](_0x1dcf26);if(!_0x404d4d)_0x2333f2[_0x575151(0x161)](_0x1dcf26,_0x523b71);else{const _0x45c542=getVersionNumber(_0x404d4d),_0x243ae1=getVersionNumber(_0x523b71);_0x243ae1>_0x45c542&&_0x2333f2['set'](_0x1dcf26,_0x523b71);}}return Array[_0x575151(0x14e)](_0x2333f2[_0x575151(0x160)]());}const VALID_JOURNEY_STATES=new Set(['draft','simulation','launched']);function a103_0x10b0(_0x26c950,_0x570b29){_0x26c950=_0x26c950-0x114;const _0x3bd4d9=a103_0x3bd4();let _0x10b0a3=_0x3bd4d9[_0x26c950];return _0x10b0a3;}export function parseJourneyState(_0x57b40e){const _0x28eab3=a103_0x10b0;if(typeof _0x57b40e===_0x28eab3(0x11d)&&VALID_JOURNEY_STATES[_0x28eab3(0x135)](_0x57b40e))return _0x57b40e;return _0x28eab3(0x129);}export function entityToJourneyListItem(_0x4df60d,_0x2ce1c0){const _0x506f33=a103_0x10b0,_0x59cd20=_0x4df60d[_0x506f33(0x15f)];return{'id':_0x4df60d['id'],'name':_0x59cd20[_0x506f33(0x14b)]??'','journeyBundleName':_0x59cd20[_0x506f33(0x150)]??_0x59cd20[_0x506f33(0x14b)]??'','journeyBundleId':_0x59cd20[_0x506f33(0x143)]??'','versionNumber':_0x59cd20['versionNumber'],'description':_0x59cd20[_0x506f33(0x134)]??null,'state':parseJourneyState(_0x59cd20['state']),'paused':_0x59cd20[_0x506f33(0x15d)]??![],'audienceId':_0x2ce1c0,'folderId':_0x59cd20[_0x506f33(0x149)]??_0x4df60d[_0x506f33(0x15a)]?.[_0x506f33(0x151)]?.[_0x506f33(0x13f)]?.['id']??null,'createdAt':_0x59cd20[_0x506f33(0x116)]??'','updatedAt':_0x59cd20[_0x506f33(0x117)]??''};}export class JourneySDK{[a103_0x12dc57(0x12d)];constructor(_0x5d2083){this['client']=new CDPApiClient(_0x5d2083,_0x5d2083['logger']);}[a103_0x12dc57(0x14a)](_0x23e63f,_0x5c48c9){return _0x5c48c9?_0x23e63f:deduplicateJourneysByBundle(_0x23e63f);}async[a103_0x12dc57(0x13c)](_0x225624,_0x278812){const _0x532c14=a103_0x12dc57;try{const _0x26379c=await this[_0x532c14(0x12d)][_0x532c14(0x13c)](_0x225624);return{'journeys':this[_0x532c14(0x14a)](_0x26379c[_0x532c14(0x139)],_0x278812),'activationStepsById':_0x26379c[_0x532c14(0x123)]};}catch(_0x17e270){if(isHttp404Error(_0x17e270))return{'journeys':[],'activationStepsById':new Map()};throw _0x17e270;}}async[a103_0x12dc57(0x128)](_0x8c63ee,_0x32f632,_0x58efc6){const _0x574589=a103_0x12dc57;let _0x536585=_0x32f632;if(!_0x536585)try{const _0x1f1f16=await this['client'][_0x574589(0x12b)](_0x8c63ee);_0x536585=_0x1f1f16[_0x574589(0x114)]??undefined;}catch(_0x2c5fd7){if(isHttp404Error(_0x2c5fd7))return[];throw _0x2c5fd7;}if(!_0x536585)return[];let _0x4f9375;if(_0x58efc6?.[_0x574589(0x14f)]){const _0x22cf0e=await this['client'][_0x574589(0x13a)](_0x8c63ee),_0x28d795=_0x22cf0e[_0x574589(0x146)](_0x25936a=>this[_0x574589(0x12d)][_0x574589(0x11f)](_0x25936a['id'])),_0x2e004b=await Promise[_0x574589(0x14d)](_0x28d795);_0x4f9375=_0x2e004b[_0x574589(0x132)]();}else{const _0x7e436=await this['client'][_0x574589(0x11b)](_0x536585,0x20,![]),_0x5041db=_0x7e436[_0x574589(0x13f)],_0x983baa=_0x5041db[_0x574589(0x118)](_0x1ce628=>_0x1ce628[_0x574589(0x158)]===_0x574589(0x12e));_0x4f9375=_0x983baa[_0x574589(0x146)](_0x4c5b2b=>entityToJourneyListItem(_0x4c5b2b,_0x8c63ee));}return this['applyVersionDeduplication'](_0x4f9375,_0x58efc6?.[_0x574589(0x14f)]);}async[a103_0x12dc57(0x138)](_0x559699,_0x21f7f8,_0x635a52){const _0x22ff95=a103_0x12dc57;if(!_0x21f7f8)return{'journeys':[],'folders':[]};const _0x56a161=await this[_0x22ff95(0x12d)][_0x22ff95(0x11b)](_0x21f7f8,0x20,![]),_0x54b9d3=_0x56a161[_0x22ff95(0x13f)],_0x284782=_0x54b9d3['filter'](_0x17241e=>_0x17241e[_0x22ff95(0x158)]==='folder-segment'&&_0x17241e['id']!==_0x21f7f8),_0x4a968a=_0x284782['map'](_0x5eaf2e=>({'id':_0x5eaf2e['id'],'name':_0x5eaf2e[_0x22ff95(0x15f)][_0x22ff95(0x14b)]})),_0x400781=_0x54b9d3[_0x22ff95(0x118)](_0x14c242=>_0x14c242[_0x22ff95(0x158)]===_0x22ff95(0x12e)),_0x24f7d9=_0x400781[_0x22ff95(0x146)](_0x47f10d=>entityToJourneyListItem(_0x47f10d,_0x559699));return{'journeys':this['applyVersionDeduplication'](_0x24f7d9,_0x635a52?.[_0x22ff95(0x14f)]),'folders':_0x4a968a};}async[a103_0x12dc57(0x136)](_0x110e8a,_0x130817){const _0x3a064e=a103_0x12dc57;let _0x10efa7;try{_0x10efa7=await this[_0x3a064e(0x12d)]['listSegmentFolders'](_0x110e8a);}catch(_0x396077){if(isHttp404Error(_0x396077))return{'journeys':[],'activationStepsById':new Map()};throw _0x396077;}const _0x4791c0=_0x10efa7[_0x3a064e(0x146)](async _0x2cf275=>{const _0x43768e=_0x3a064e;return await this[_0x43768e(0x13c)](_0x2cf275['id'],_0x130817?.[_0x43768e(0x14f)]);}),_0x4f83a0=await Promise[_0x3a064e(0x14d)](_0x4791c0),_0x7efde4=new Map(),_0x51cf0b=[];for(const _0x1a3fe2 of _0x4f83a0){_0x51cf0b[_0x3a064e(0x15e)](..._0x1a3fe2[_0x3a064e(0x139)]);for(const [_0x53d362,_0x13f023]of _0x1a3fe2[_0x3a064e(0x123)]){_0x7efde4[_0x3a064e(0x161)](_0x53d362,_0x13f023);}}const _0x1a477a=new Set(),_0x4ad624=_0x51cf0b['filter'](_0x19bb9e=>{const _0x3289d1=_0x3a064e;if(_0x1a477a[_0x3289d1(0x135)](_0x19bb9e['id']))return![];return _0x1a477a[_0x3289d1(0x11c)](_0x19bb9e['id']),!![];});return{'journeys':this[_0x3a064e(0x14a)](_0x4ad624,_0x130817?.[_0x3a064e(0x14f)]),'activationStepsById':_0x7efde4};}async[a103_0x12dc57(0x133)](_0x1901a2){const _0x4b19c9=a103_0x12dc57;try{return await this[_0x4b19c9(0x12d)][_0x4b19c9(0x133)](_0x1901a2);}catch(_0x424c3d){if(isHttp404Error(_0x424c3d))throw new SDKError(ErrorCode[_0x4b19c9(0x145)],'Journey\x20not\x20found:\x20'+_0x1901a2,_0x424c3d);throw _0x424c3d;}}async[a103_0x12dc57(0x13b)](_0x4dd6b1,_0x4fbf0d){const _0x239376=a103_0x12dc57,_0x549ea7=await this[_0x239376(0x128)](_0x4dd6b1),_0x56c8cc=_0x549ea7[_0x239376(0x120)](_0x2dce89=>_0x2dce89[_0x239376(0x150)][_0x239376(0x140)]()===_0x4fbf0d[_0x239376(0x140)]());if(!_0x56c8cc)throw new SDKError(ErrorCode[_0x239376(0x145)],_0x239376(0x12f)+_0x4fbf0d,undefined,{'helpText':_0x239376(0x156)});return _0x56c8cc['id'];}async[a103_0x12dc57(0x154)](_0xda2b19){const _0x3a6899=a103_0x12dc57;try{return await this['client'][_0x3a6899(0x122)](_0xda2b19);}catch(_0x2113a5){if(isHttp404Error(_0x2113a5))throw new SDKError(ErrorCode['JOURNEY_NOT_FOUND'],'Journey\x20not\x20found:\x20'+_0xda2b19,_0x2113a5);throw _0x2113a5;}}async[a103_0x12dc57(0x153)](_0x2a5a1c){const _0x1beeb4=a103_0x12dc57;try{return await this[_0x1beeb4(0x12d)][_0x1beeb4(0x130)](_0x2a5a1c);}catch(_0x486e14){if(isHttp404Error(_0x486e14))throw new SDKError(ErrorCode[_0x1beeb4(0x145)],_0x1beeb4(0x12f)+_0x2a5a1c,_0x486e14);throw _0x486e14;}}async[a103_0x12dc57(0x155)](_0x39dba6){const _0x573e3b=a103_0x12dc57;try{return await this[_0x573e3b(0x12d)]['resumeJourney'](_0x39dba6);}catch(_0x1038fe){if(isHttp404Error(_0x1038fe))throw new SDKError(ErrorCode[_0x573e3b(0x145)],'Journey\x20not\x20found:\x20'+_0x39dba6,_0x1038fe);throw _0x1038fe;}}async[a103_0x12dc57(0x13e)](_0x1c9a93){const _0x294b76=a103_0x12dc57;return await this[_0x294b76(0x12d)][_0x294b76(0x141)](_0x1c9a93);}async[a103_0x12dc57(0x124)](_0x3a8487,_0x509ce1){const _0x18431e=a103_0x12dc57;try{return await this[_0x18431e(0x12d)]['updateJourney'](_0x3a8487,_0x509ce1);}catch(_0x13d587){if(isHttp404Error(_0x13d587))throw new SDKError(ErrorCode['JOURNEY_NOT_FOUND'],_0x18431e(0x12f)+_0x3a8487,_0x13d587);throw _0x13d587;}}async[a103_0x12dc57(0x11e)](_0x485964,_0x4b6201){const _0x5e7183=a103_0x12dc57;try{return await this['client'][_0x5e7183(0x15c)](_0x485964,_0x4b6201);}catch(_0x5098fa){if(isHttp404Error(_0x5098fa))throw new SDKError(ErrorCode[_0x5e7183(0x125)],_0x5e7183(0x119)+_0x4b6201+_0x5e7183(0x14c)+_0x485964,_0x5098fa);throw _0x5098fa;}}async[a103_0x12dc57(0x148)](_0x281088){const _0x37f137=a103_0x12dc57;try{return await this[_0x37f137(0x12d)][_0x37f137(0x157)](_0x281088);}catch(_0xc28616){if(isHttp404Error(_0xc28616))return[];throw _0xc28616;}}async['createActivation'](_0x5624b0,_0x29b47d){const _0x2cde07=a103_0x12dc57;return await this[_0x2cde07(0x12d)][_0x2cde07(0x142)](_0x5624b0,_0x29b47d);}}
@@ -1 +1 @@
1
- (function(_0x373c40,_0x220ba7){const _0x4044b2=a104_0xd0a5,_0x45a3be=_0x373c40();while(!![]){try{const _0x1ab820=parseInt(_0x4044b2(0xdd))/0x1*(parseInt(_0x4044b2(0xe8))/0x2)+parseInt(_0x4044b2(0xe7))/0x3+-parseInt(_0x4044b2(0xe2))/0x4+-parseInt(_0x4044b2(0xeb))/0x5*(parseInt(_0x4044b2(0xe3))/0x6)+parseInt(_0x4044b2(0xe4))/0x7*(-parseInt(_0x4044b2(0xe9))/0x8)+parseInt(_0x4044b2(0xe5))/0x9+parseInt(_0x4044b2(0xe0))/0xa;if(_0x1ab820===_0x220ba7)break;else _0x45a3be['push'](_0x45a3be['shift']());}catch(_0x4f21e7){_0x45a3be['push'](_0x45a3be['shift']());}}}(a104_0x2ebf,0x54ca8));import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{join}from'path';function getCacheDir(){const _0x410873=a104_0xd0a5;return join(process[_0x410873(0xe1)](),_0x410873(0xde),_0x410873(0xdf));}function a104_0xd0a5(_0x15ee76,_0x22e585){_0x15ee76=_0x15ee76-0xdd;const _0x2ebf47=a104_0x2ebf();let _0xd0a51=_0x2ebf47[_0x15ee76];return _0xd0a51;}function a104_0x2ebf(){const _0x5a40b2=['trim','2510630MItAtP','92939LYmRRQ','.cache','tdx','3706310KQRAEp','cwd','934192VQiptR','6FpPOEB','155071iDoiYf','4058496ZXnzGy','utf-8','519927Qhplul','10bWIGmQ','136EpIPNA'];a104_0x2ebf=function(){return _0x5a40b2;};return a104_0x2ebf();}function getLastChatIdPath(){return join(getCacheDir(),'last_chat_id');}function ensureCacheDir(){const _0x2d2616=getCacheDir();!existsSync(_0x2d2616)&&mkdirSync(_0x2d2616,{'recursive':!![]});}export function saveLastChatId(_0x4d1154){const _0x340ee7=a104_0xd0a5;ensureCacheDir();const _0x229fc4=getLastChatIdPath();writeFileSync(_0x229fc4,_0x4d1154,_0x340ee7(0xe6));}export function loadLastChatId(){const _0x9a63a6=a104_0xd0a5,_0x372ac1=getLastChatIdPath();if(!existsSync(_0x372ac1))return undefined;try{const _0x480265=readFileSync(_0x372ac1,_0x9a63a6(0xe6))[_0x9a63a6(0xea)]();return _0x480265||undefined;}catch{return undefined;}}export function clearLastChatId(){const _0x373f9c=a104_0xd0a5,_0x263adc=getLastChatIdPath();if(existsSync(_0x263adc))try{writeFileSync(_0x263adc,'',_0x373f9c(0xe6));}catch{}}
1
+ (function(_0x133bd3,_0x1d13c7){const _0x2f045a=a104_0x2ef1,_0x5af855=_0x133bd3();while(!![]){try{const _0x36945f=-parseInt(_0x2f045a(0xb8))/0x1*(parseInt(_0x2f045a(0xab))/0x2)+-parseInt(_0x2f045a(0xbb))/0x3*(parseInt(_0x2f045a(0xb2))/0x4)+parseInt(_0x2f045a(0xaf))/0x5*(-parseInt(_0x2f045a(0xb5))/0x6)+-parseInt(_0x2f045a(0xb7))/0x7*(parseInt(_0x2f045a(0xae))/0x8)+parseInt(_0x2f045a(0xba))/0x9+-parseInt(_0x2f045a(0xad))/0xa*(parseInt(_0x2f045a(0xb3))/0xb)+parseInt(_0x2f045a(0xbc))/0xc*(parseInt(_0x2f045a(0xb6))/0xd);if(_0x36945f===_0x1d13c7)break;else _0x5af855['push'](_0x5af855['shift']());}catch(_0xe3a6a5){_0x5af855['push'](_0x5af855['shift']());}}}(a104_0x423a,0x82e97));import{existsSync,mkdirSync,readFileSync,writeFileSync}from'fs';import{join}from'path';function a104_0x423a(){const _0x5640cc=['2535ZYFpgS','utf-8','.cache','7640yuJfGE','1705ODENbp','last_chat_id','9894kXzwBd','5798ICHQpr','854854UxuZTI','11ncCgig','tdx','1441269gHfuDH','3rBMSdS','76008GrUUWZ','trim','149230gBvdKR','cwd','43100NhMeYS','8LvvXAT'];a104_0x423a=function(){return _0x5640cc;};return a104_0x423a();}function getCacheDir(){const _0xef1539=a104_0x2ef1;return join(process[_0xef1539(0xac)](),_0xef1539(0xb1),_0xef1539(0xb9));}function getLastChatIdPath(){const _0x2fc2aa=a104_0x2ef1;return join(getCacheDir(),_0x2fc2aa(0xb4));}function ensureCacheDir(){const _0x507f0b=getCacheDir();!existsSync(_0x507f0b)&&mkdirSync(_0x507f0b,{'recursive':!![]});}export function saveLastChatId(_0x5eba13){const _0x2fb8b1=a104_0x2ef1;ensureCacheDir();const _0x2fdf7f=getLastChatIdPath();writeFileSync(_0x2fdf7f,_0x5eba13,_0x2fb8b1(0xb0));}export function loadLastChatId(){const _0xcaa043=a104_0x2ef1,_0x21e86e=getLastChatIdPath();if(!existsSync(_0x21e86e))return undefined;try{const _0x36eb70=readFileSync(_0x21e86e,_0xcaa043(0xb0))[_0xcaa043(0xaa)]();return _0x36eb70||undefined;}catch{return undefined;}}function a104_0x2ef1(_0x69a559,_0x4d6d77){_0x69a559=_0x69a559-0xaa;const _0x423a3d=a104_0x423a();let _0x2ef1a3=_0x423a3d[_0x69a559];return _0x2ef1a3;}export function clearLastChatId(){const _0x2865cb=getLastChatIdPath();if(existsSync(_0x2865cb))try{writeFileSync(_0x2865cb,'','utf-8');}catch{}}
@@ -1 +1 @@
1
- const a105_0x54707d=a105_0x299c;(function(_0x2cbcc9,_0x4d7da1){const _0x156e71=a105_0x299c,_0x43402d=_0x2cbcc9();while(!![]){try{const _0x5ad7bc=parseInt(_0x156e71(0x22f))/0x1+parseInt(_0x156e71(0x1fd))/0x2+-parseInt(_0x156e71(0x204))/0x3+parseInt(_0x156e71(0x1b1))/0x4*(parseInt(_0x156e71(0x1b2))/0x5)+parseInt(_0x156e71(0x18e))/0x6*(-parseInt(_0x156e71(0x1e2))/0x7)+parseInt(_0x156e71(0x1a6))/0x8*(-parseInt(_0x156e71(0x150))/0x9)+parseInt(_0x156e71(0x203))/0xa*(parseInt(_0x156e71(0x157))/0xb);if(_0x5ad7bc===_0x4d7da1)break;else _0x43402d['push'](_0x43402d['shift']());}catch(_0x328858){_0x43402d['push'](_0x43402d['shift']());}}}(a105_0xe862,0x63012));import{LLMApiClient}from'../client/llm-api-client.js';import*as a105_0x5c029b from'node:fs';import*as a105_0x2abb29 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlPromptToApi,resolveAgentDependencies}from'../agent/agent-yaml.js';function a105_0x299c(_0x24b0fa,_0x7b9ea5){_0x24b0fa=_0x24b0fa-0x14c;const _0xe86241=a105_0xe862();let _0x299c9b=_0xe86241[_0x24b0fa];return _0x299c9b;}import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';function a105_0xe862(){const _0x4dba28=['33LANarb','createWebSearchTool','isDirectory','chatId','version','\x20in\x20project\x20','listWebSearchTools','listPrompts','stringify','Unable\x20to\x20create\x20project\x20after\x20','listKnowledgeBases','some','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','readFileSync','logger','content','agents','LLM_PROJECT_NOT_FOUND','webSearchTools','chatWelcomeMessage','message','oldPath','setCurrentProject','agent.yml','claude-4.5-sonnet','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','parse','listImageGenerators','resolveProjectName','utf-8','Output\x20directory\x20already\x20exists:\x20','promptId','jsonSchemaHint','Agent\x20not\x20found:\x20','endsWith','starterMessage','info','reasoningEffort','listIntegrations','pushAgent','updateKnowledgeBase','maxToolIterations','unchanged','INVALID_ARGUMENT','temperature','conflict','getBackupMetadata','starter_message.md','deleteProject','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','knowledge_bases','filter','agent','updated','image_gen','15528niBqfJ','warn','mkdirSync','ALREADY_EXISTS','profile','pullAgent','Renamed\x20folder:\x20','actions','getDefaultAgent','attributes','1.0','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','\x20attempts\x20due\x20to\x20name\x20conflicts.','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','existsSync','getOrCreateDefaultAgent','serviceType','#\x20prompt.md\x0a','getOrCreateDefaultProject','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','high','projectName','medium','Project\x20not\x20found:\x20','49968msWxfd','createAgentResponse','_reasoning_','none','renamed','Project\x20\x22','minimal','tdx.json','name','modelType','target','4mUKqur','1160695XTwbWb','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','metadata','description','readdirSync','AGENT_NOT_FOUND','tables','createProject','yaml','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','web_search','tdx_','deleteAgent','listProjects','createIntegration','already\x20exists','newProjectId','INTERNAL','isDir','length','loadJsonFile','chatIgnoreManagedActions','resolveProjectId','UNAUTHENTICATED','site','Invalid\x20agent\x20reference\x20format:\x20','knowledgeBases','knowledgebases.json','createAgent','chatInfo','agentsFull','Unsupported\x20backup\x20version:\x20','backupProject','getUserSettings','tdDatabaseName','path','set','createTextKnowledgeBase','\x20→\x20','size','created','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','outputs','duplicate','action','getProject','prompts','project.json','1358BnbbqE','event','pushProject','agents.json','writeFileSync','models','chats','isManaged','context','Renamed\x20prompt\x20file:\x20','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','projects','.yml','tools','prompts.json','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','toISOString','Agent\x20reference\x20not\x20found','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','client','tdx_default_','imageGenerators','NOT_FOUND','createPrompt','getChatInfo','get','525166OPzEQa','\x0a\x0a#\x20agent.yml\x0a','agent.yml\x20not\x20found\x20in\x20','listAgents','.md','Multiple\x20agents\x20found\x20with\x20name\x20\x27','864010izfhUg','361359sSjjGp','map','displayName','includes','Renamed\x20KB\x20file:\x20','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','join','chat','listTextKnowledgeBases','unlinkSync','Renamed\x20agent\x20folder:\x20','\x22\x20already\x20exists','integrations','systemPrompt','createKnowledgeBase','add','dir','starter_message','cwd','clearDefaultAgent','counts','dry-run-','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','startChat','agentId','\x27.\x20This\x20should\x20not\x20happen.','resolveAgentId','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','pullProject','availableModelNames','textKnowledgeBases','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','total','updatePrompt','split','text','getAgent','currentProjectId','push','listChats','No\x20tdx.json\x20found\x20in\x20','llm_project','dryRun','730080fmsNtf','prompt.md','find','listAgentsFull','updateAgent','new','template','status','type','errors','getCurrentProject','updateAgentResponse','error','657AfLVKS','PERMISSION_DENIED','updateTextKnowledgeBase','basename','variables','low','createImageGenerator'];a105_0xe862=function(){return _0x4dba28;};return a105_0xe862();}import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';export class LLMSDK{[a105_0x54707d(0x229)];[a105_0x54707d(0x1f6)];['context'];constructor(_0x25e99a){const _0x20276e=a105_0x54707d;this[_0x20276e(0x1f6)]=new LLMApiClient(_0x25e99a,_0x25e99a[_0x20276e(0x165)]),this[_0x20276e(0x1ea)]=_0x25e99a;}['getDefaultProjectName'](){const _0x3355e7=a105_0x54707d,_0x22823a=getSanitizedUsername();return _0x3355e7(0x1f7)+_0x22823a;}async[a105_0x54707d(0x16d)](_0x41d3b2){const _0x1a9135=a105_0x54707d,{projectId:_0x5c4152}=await this[_0x1a9135(0x173)](_0x41d3b2);this[_0x1a9135(0x229)]=_0x5c4152;}[a105_0x54707d(0x14d)](){const _0x2bbe96=a105_0x54707d;return this[_0x2bbe96(0x229)];}async['setDefaultAgent'](_0x2c886c){const _0x28c486=a105_0x54707d,_0xd079a=this[_0x28c486(0x1ea)][_0x28c486(0x192)];let _0x4564c3,_0x49a0a3;if(_0x2c886c['includes']('/')){const _0x104155=_0x2c886c[_0x28c486(0x226)]('/');if(_0x104155[_0x28c486(0x1c5)]!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x28c486(0x1cb)+_0x2c886c,undefined,{'helpText':'Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22'});const [_0x144781,_0x446056]=_0x104155;_0x4564c3=await this[_0x28c486(0x1c8)](_0x144781),_0x49a0a3=_0x446056;}else _0x4564c3=this[_0x28c486(0x229)]||(await this[_0x28c486(0x1a0)]())['id'],_0x49a0a3=_0x2c886c;const _0x481cc1=await this[_0x28c486(0x21e)](_0x49a0a3,_0x4564c3),_0x1ac64e=await this['client'][_0x28c486(0x228)](_0x481cc1);writeCachedLLMAgent(_0x1ac64e[_0x28c486(0x197)][_0x28c486(0x1ae)],_0x481cc1,_0x4564c3,_0xd079a);}[a105_0x54707d(0x196)](){const _0x598973=a105_0x54707d,_0x3937a6=this[_0x598973(0x1ea)][_0x598973(0x192)];return readCachedLLMAgent(_0x3937a6)||undefined;}[a105_0x54707d(0x217)](){const _0x5ac570=a105_0x54707d,_0x309029=this['context'][_0x5ac570(0x192)];clearCachedLLMAgent(_0x309029);}async[a105_0x54707d(0x1e7)](){const _0xde4074=a105_0x54707d,_0x3dea6d=await this[_0xde4074(0x1f6)][_0xde4074(0x1d3)](),_0x2f57ae=[];for(const _0x2c373c of _0x3dea6d[_0xde4074(0x221)]){const _0x8ecd39=_0x3dea6d['availableModels'][_0x2c373c];_0x8ecd39&&_0x2f57ae[_0xde4074(0x22a)]({'name':_0x2c373c,'displayName':_0x8ecd39[_0xde4074(0x206)]});}return _0x2f57ae;}async[a105_0x54707d(0x1b9)](_0x30d239){const _0x3e7310=a105_0x54707d;return await this[_0x3e7310(0x1f6)][_0x3e7310(0x1b9)](_0x30d239);}async[a105_0x54707d(0x187)](_0x6fb2b4){const _0x34c025=a105_0x54707d,{projectId:_0x30ac34}=await this[_0x34c025(0x173)](_0x6fb2b4);await this[_0x34c025(0x1f6)][_0x34c025(0x187)](_0x30ac34);}async[a105_0x54707d(0x1ed)](_0x3c0f1f=0x32){const _0x4fcb97=a105_0x54707d;return await this[_0x4fcb97(0x1f6)]['listProjects'](_0x3c0f1f);}async[a105_0x54707d(0x1a0)](_0x4d0b0b){const _0x47f475=a105_0x54707d,_0x31405c=_0x4d0b0b||this['getDefaultProjectName'](),_0x2c9641=this[_0x47f475(0x1ea)][_0x47f475(0x192)];if(!_0x4d0b0b){const _0x215562=readCachedLLMProject(_0x2c9641);if(_0x215562&&_0x215562[_0x47f475(0x1ae)]===_0x31405c)try{const _0xe3a65c=await this[_0x47f475(0x1f6)][_0x47f475(0x1df)](_0x215562['id']);if(_0xe3a65c[_0x47f475(0x197)]['name']===_0x31405c)return _0xe3a65c;}catch{}}const _0x3c177d=await this['client'][_0x47f475(0x1bf)](),_0x206a1b=_0x3c177d['find'](_0x2e325e=>_0x2e325e['attributes'][_0x47f475(0x1ae)]===_0x31405c);if(_0x206a1b)return!_0x4d0b0b&&writeCachedLLMProject(_0x31405c,_0x206a1b['id'],_0x2c9641),_0x206a1b;const _0x456510=await this[_0x47f475(0x1f6)][_0x47f475(0x1b9)]({'name':_0x31405c,'description':'Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20'+getSanitizedUsername()+')'});return!_0x4d0b0b&&writeCachedLLMProject(_0x31405c,_0x456510['id'],_0x2c9641),_0x456510;}async[a105_0x54707d(0x1c8)](_0x1d1d3d){const _0x45ab44=a105_0x54707d,_0x31a153=await this[_0x45ab44(0x1f6)][_0x45ab44(0x1bf)](),_0x2a5c9f=_0x31a153[_0x45ab44(0x18a)](_0x22c96f=>_0x22c96f[_0x45ab44(0x197)][_0x45ab44(0x1ae)]===_0x1d1d3d);if(_0x2a5c9f[_0x45ab44(0x1c5)]===0x0)throw new SDKError(ErrorCode[_0x45ab44(0x168)],_0x45ab44(0x1a5)+_0x1d1d3d,undefined,{'helpText':_0x45ab44(0x223)});if(_0x2a5c9f['length']>0x1)throw new SDKError(ErrorCode[_0x45ab44(0x1c3)],'Multiple\x20projects\x20found\x20with\x20name\x20\x27'+_0x1d1d3d+_0x45ab44(0x21d));return _0x2a5c9f[0x0]['id'];}async[a105_0x54707d(0x173)](_0x59c50f){const _0x4c5ca1=a105_0x54707d,_0x31ac75=await this[_0x4c5ca1(0x1f6)][_0x4c5ca1(0x1bf)](),_0x2a7cdf=_0x31ac75[_0x4c5ca1(0x231)](_0x21fea7=>_0x21fea7[_0x4c5ca1(0x197)][_0x4c5ca1(0x1ae)]===_0x59c50f);if(_0x2a7cdf)return{'projectId':_0x2a7cdf['id'],'project':_0x2a7cdf};throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x4c5ca1(0x1a5)+_0x59c50f,undefined,{'helpText':_0x4c5ca1(0x223)});}async[a105_0x54707d(0x19d)](_0x5754ff=a105_0x54707d(0x16f),_0x39c8ab=0x0,_0xbeac9a){const _0x185539=a105_0x54707d,_0x1c71a2=0xa;let _0x35b3ee=0x0,_0x1077c1;while(_0x35b3ee<_0x1c71a2){try{const _0x9e2911=await this['getOrCreateDefaultProject'](_0x1077c1),_0x364984=_0x9e2911['id'],_0x3b6e47=[_0x185539(0x1a9),_0x185539(0x1ac),_0x185539(0x155),_0x185539(0x1a4),_0x185539(0x1a2)],_0x26791a=_0x39c8ab===0x0?'tdx_'+_0x5754ff:_0x185539(0x1bd)+_0x5754ff+_0x185539(0x1a8)+_0x3b6e47[_0x39c8ab],_0x425c29=await this[_0x185539(0x1f6)][_0x185539(0x200)](_0x364984),_0xed931e=_0x425c29[_0x185539(0x231)](_0x1612ca=>_0x1612ca[_0x185539(0x197)][_0x185539(0x1ae)]===_0x26791a);if(_0xed931e)return _0xed931e;const _0x35934e=_0x39c8ab>0x0?0x1:_0xbeac9a;return await this[_0x185539(0x1f6)]['createAgent']({'name':_0x26791a,'projectId':_0x364984,'modelType':_0x5754ff,'systemPrompt':'','temperature':_0x35934e,'reasoningEffort':_0x39c8ab>0x0?_0x39c8ab:undefined});}catch(_0x37d3c6){if(_0x37d3c6 instanceof HTTPClientError){const _0x21255b=_0x37d3c6[_0x185539(0x236)];if(_0x21255b>=0x190&&_0x21255b<0x1f4){if(_0x21255b===0x191)throw new SDKError(ErrorCode[_0x185539(0x1c9)],_0x185539(0x163),_0x37d3c6);else{if(_0x21255b===0x193)throw new SDKError(ErrorCode[_0x185539(0x151)],_0x185539(0x188),_0x37d3c6);}throw _0x37d3c6;}}if(errorContains(_0x37d3c6,_0x185539(0x1c1),_0x185539(0x1dd),_0x185539(0x184))){_0x35b3ee++;if(_0x35b3ee>=_0x1c71a2)throw new SDKError(ErrorCode[_0x185539(0x191)],_0x185539(0x160)+_0x1c71a2+_0x185539(0x19a),_0x37d3c6);const _0x4f9071=this['getDefaultProjectName']();_0x1077c1=_0x4f9071+'_'+generateRandomHex();continue;}throw _0x37d3c6;}}throw new SDKError(ErrorCode[_0x185539(0x1c3)],_0x185539(0x21a));}async[a105_0x54707d(0x21e)](_0x11bb72,_0x5afd96){const _0x371dda=a105_0x54707d,_0x50e392=_0x5afd96||this['currentProjectId'],_0x286cd8=await this[_0x371dda(0x1f6)][_0x371dda(0x200)](_0x50e392),_0x185fb4=_0x286cd8[_0x371dda(0x18a)](_0x21c6aa=>_0x21c6aa[_0x371dda(0x197)][_0x371dda(0x1ae)]===_0x11bb72);if(_0x185fb4[_0x371dda(0x1c5)]===0x0){const _0x4c2a53=_0x50e392?_0x371dda(0x15c)+_0x50e392:'';throw new SDKError(ErrorCode[_0x371dda(0x1b7)],_0x371dda(0x178)+_0x11bb72+_0x4c2a53,undefined,{'helpText':_0x50e392?_0x371dda(0x1f4):'Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.'});}if(_0x185fb4[_0x371dda(0x1c5)]>0x1)throw new SDKError(ErrorCode[_0x371dda(0x1c3)],_0x371dda(0x202)+_0x11bb72+'\x27.\x20This\x20should\x20not\x20happen.');return _0x185fb4[0x0]['id'];}async[a105_0x54707d(0x167)](_0x2ef379){const _0x558386=a105_0x54707d,_0x579af5=_0x2ef379||this[_0x558386(0x229)];return await this[_0x558386(0x1f6)][_0x558386(0x200)](_0x579af5);}async[a105_0x54707d(0x1d0)](_0x2e2af0){const _0x4fdbac=a105_0x54707d;return await this[_0x4fdbac(0x1f6)][_0x4fdbac(0x232)](_0x2e2af0);}async['agent'](_0x17a624){const _0x5e3714=a105_0x54707d;return await this[_0x5e3714(0x1f6)]['getAgent'](_0x17a624);}async[a105_0x54707d(0x1ce)](_0x2a50f7){const _0x23e958=a105_0x54707d;return await this[_0x23e958(0x1f6)][_0x23e958(0x1ce)](_0x2a50f7);}async['updateAgent'](_0x32895c,_0x574420){const _0x44576f=a105_0x54707d;return await this[_0x44576f(0x1f6)][_0x44576f(0x233)](_0x32895c,_0x574420);}async[a105_0x54707d(0x1be)](_0x24366c){const _0x1d7e2e=a105_0x54707d;await this[_0x1d7e2e(0x1f6)][_0x1d7e2e(0x1be)](_0x24366c);}async[a105_0x54707d(0x21b)](_0xbd643a){const _0x294b6f=a105_0x54707d;return await this['client'][_0x294b6f(0x21b)]({'agentId':_0xbd643a});}async*[a105_0x54707d(0x20b)](_0x42c518,_0x4970b0){const _0x8e4031=a105_0x54707d;let _0x35bcb7=_0x4970b0?.[_0x8e4031(0x15a)];const _0x1689dd=_0x4970b0?.[_0x8e4031(0x21c)];if(!_0x35bcb7){if(!_0x1689dd)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x1cfe65=await this[_0x8e4031(0x1f6)]['startChat']({'agentId':_0x1689dd});_0x35bcb7=_0x1cfe65['id'],yield{'type':_0x8e4031(0x1b4),'data':{'chatId':_0x35bcb7,'agentId':_0x1689dd}};}for await(const _0x46cce5 of this[_0x8e4031(0x1f6)]['continueChat'](_0x35bcb7,_0x42c518,_0x4970b0?.['signal'])){yield{'type':_0x8e4031(0x1e3),'data':_0x46cce5};}}async[a105_0x54707d(0x1e8)](_0x5dece8=0x32){const _0x37c106=a105_0x54707d;return await this['client'][_0x37c106(0x22b)](_0x5dece8);}async['history'](_0x84eee9){const _0x1e444e=a105_0x54707d;return await this[_0x1e444e(0x1f6)]['getChatHistory'](_0x84eee9);}async[a105_0x54707d(0x1cf)](_0x503d9f){const _0x238e33=a105_0x54707d;return await this[_0x238e33(0x1f6)][_0x238e33(0x1fb)](_0x503d9f);}async[a105_0x54707d(0x1d2)](_0x22ea9f,_0x5ea6e7,_0x1787ac){const _0x23ae82=a105_0x54707d,_0x539ee2=_0x1787ac?.[_0x23ae82(0x22e)]??![],{projectId:_0x524d1c,project:_0x4eb0c1}=await this['resolveProjectName'](_0x22ea9f),_0x1a3cec=_0x4eb0c1[_0x23ae82(0x197)][_0x23ae82(0x1ae)],_0x59b1a8=_0x5ea6e7||_0x1a3cec+'.llm';if(a105_0x5c029b[_0x23ae82(0x19c)](_0x59b1a8)&&!_0x539ee2)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x23ae82(0x175)+_0x59b1a8,undefined,{'helpText':_0x23ae82(0x1ec)});const _0x1a3504=await this['client'][_0x23ae82(0x232)](_0x524d1c),_0x1b08b8=await this[_0x23ae82(0x1f6)][_0x23ae82(0x161)](_0x524d1c),_0x1c7771=await this['client'][_0x23ae82(0x15e)](_0x524d1c),_0x1b1503=await this['client'][_0x23ae82(0x17d)](_0x524d1c);if(!_0x539ee2){a105_0x5c029b[_0x23ae82(0x190)](_0x59b1a8,{'recursive':!![]});const _0x58de33={'version':_0x23ae82(0x198),'exportedAt':new Date()[_0x23ae82(0x1f2)](),'exportedFrom':{'site':this[_0x23ae82(0x1ea)]['site'],'projectId':_0x524d1c,'projectName':_0x1a3cec},'project':_0x4eb0c1};a105_0x5c029b[_0x23ae82(0x1e6)](a105_0x2abb29[_0x23ae82(0x20a)](_0x59b1a8,_0x23ae82(0x1e1)),JSON[_0x23ae82(0x15f)](_0x58de33,null,0x2)),a105_0x5c029b[_0x23ae82(0x1e6)](a105_0x2abb29[_0x23ae82(0x20a)](_0x59b1a8,_0x23ae82(0x1e5)),JSON[_0x23ae82(0x15f)](_0x1a3504,null,0x2)),a105_0x5c029b[_0x23ae82(0x1e6)](a105_0x2abb29[_0x23ae82(0x20a)](_0x59b1a8,_0x23ae82(0x1cd)),JSON[_0x23ae82(0x15f)](_0x1b08b8,null,0x2)),a105_0x5c029b[_0x23ae82(0x1e6)](a105_0x2abb29[_0x23ae82(0x20a)](_0x59b1a8,_0x23ae82(0x1f0)),JSON[_0x23ae82(0x15f)](_0x1c7771,null,0x2)),a105_0x5c029b['writeFileSync'](a105_0x2abb29[_0x23ae82(0x20a)](_0x59b1a8,'integrations.json'),JSON['stringify'](_0x1b1503,null,0x2));}return{'projectName':_0x1a3cec,'outputDir':_0x59b1a8,'counts':{'agents':_0x1a3504[_0x23ae82(0x1c5)],'knowledgeBases':_0x1b08b8[_0x23ae82(0x1c5)],'prompts':_0x1c7771[_0x23ae82(0x1c5)],'integrations':_0x1b1503[_0x23ae82(0x1c5)]}};}async['restoreProject'](_0x1c5672,_0x12ddf2){const _0xfbe521=a105_0x54707d,_0x38054d=_0x12ddf2?.[_0xfbe521(0x22e)]??![],_0x2ffa81=this[_0xfbe521(0x185)](_0x1c5672),_0x1091d1=_0x2ffa81['exportedFrom']['site'],_0x1299cc=this[_0xfbe521(0x1ea)][_0xfbe521(0x1ca)],_0x167220=_0x1091d1!==_0x1299cc?_0x1091d1:undefined,_0x4a10a7=this[_0xfbe521(0x1c6)](a105_0x2abb29[_0xfbe521(0x20a)](_0x1c5672,'agents.json'),[]),_0x5239ff=this[_0xfbe521(0x1c6)](a105_0x2abb29[_0xfbe521(0x20a)](_0x1c5672,_0xfbe521(0x1cd)),[]),_0x52f80d=this[_0xfbe521(0x1c6)](a105_0x2abb29['join'](_0x1c5672,_0xfbe521(0x1f0)),[]),_0x38708a=this[_0xfbe521(0x1c6)](a105_0x2abb29['join'](_0x1c5672,'integrations.json'),[]),_0x53240c=_0x12ddf2?.[_0xfbe521(0x1ae)]||_0x2ffa81['exportedFrom'][_0xfbe521(0x1a3)];if(_0x38054d){const _0x834178=new Map(),_0x5d2567=[..._0x4a10a7],_0x173042=_0x4a10a7[_0xfbe521(0x1c5)]+0x1;let _0x5c51ed=0x0;while(_0x5d2567[_0xfbe521(0x1c5)]>0x0&&_0x5c51ed<_0x173042){_0x5c51ed++;const _0x544407=[];for(const _0x939510 of _0x5d2567){canCreateAgent(_0x939510,_0x834178)?_0x834178['set'](_0x939510['id'],_0xfbe521(0x219)+_0x939510['id']):_0x544407[_0xfbe521(0x22a)](_0x939510);}if(_0x544407['length']===_0x5d2567[_0xfbe521(0x1c5)])throw new SDKError(ErrorCode[_0xfbe521(0x1c3)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x5d2567[_0xfbe521(0x1c5)]=0x0,_0x5d2567['push'](..._0x544407);}const _0x63ab3d=_0x52f80d[_0xfbe521(0x18a)](_0x33e0b6=>_0x834178['has'](_0x33e0b6['attributes'][_0xfbe521(0x21c)]))[_0xfbe521(0x1c5)];return{'projectName':_0x53240c,'projectId':'(dry-run)','counts':{'agents':_0x4a10a7[_0xfbe521(0x1c5)],'knowledgeBases':_0x5239ff['length'],'prompts':_0x63ab3d,'integrations':_0x38708a[_0xfbe521(0x1c5)]},'sourceSite':_0x167220};}const _0x56497a=await this[_0xfbe521(0x1f6)]['createProject']({'name':_0x53240c,'description':_0x2ffa81['project'][_0xfbe521(0x197)][_0xfbe521(0x1b5)]}),_0x5905e8=_0x56497a['id'],_0x4289d4=new Map(),_0x12f21c=new Map(),_0x34da3f=new Map();for(const _0x1b5399 of _0x5239ff){const _0x367fef=await this[_0xfbe521(0x1f6)][_0xfbe521(0x212)]({'projectId':_0x5905e8,'name':_0x1b5399[_0xfbe521(0x197)][_0xfbe521(0x1ae)],'tdDatabaseName':_0x1b5399[_0xfbe521(0x197)][_0xfbe521(0x1d4)],'tables':_0x1b5399[_0xfbe521(0x197)][_0xfbe521(0x1b8)]});_0x4289d4[_0xfbe521(0x1d6)](_0x1b5399['id'],_0x367fef['id']);}const _0x36d0fb=[..._0x4a10a7],_0x286904=_0x4a10a7['length']+0x1;let _0x9d849b=0x0;while(_0x36d0fb[_0xfbe521(0x1c5)]>0x0&&_0x9d849b<_0x286904){_0x9d849b++;const _0x488e16=[];for(const _0x37674e of _0x36d0fb){if(canCreateAgent(_0x37674e,_0x12f21c)){const _0x3befd0=remapToolIds(_0x37674e[_0xfbe521(0x197)][_0xfbe521(0x1ef)],_0x4289d4,_0x12f21c),_0x44df62=remapVariableIds(_0x37674e[_0xfbe521(0x197)][_0xfbe521(0x154)],_0x4289d4),_0x4c2990=await this[_0xfbe521(0x1f6)][_0xfbe521(0x1a7)]({'name':_0x37674e[_0xfbe521(0x197)][_0xfbe521(0x1ae)],'projectId':_0x5905e8,'systemPrompt':_0x37674e[_0xfbe521(0x197)][_0xfbe521(0x211)],'starterMessage':_0x37674e[_0xfbe521(0x197)][_0xfbe521(0x17a)],'modelType':migrateModelType(_0x37674e[_0xfbe521(0x197)][_0xfbe521(0x1af)]),'maxToolIterations':_0x37674e[_0xfbe521(0x197)][_0xfbe521(0x180)],'temperature':_0x37674e[_0xfbe521(0x197)][_0xfbe521(0x183)],'reasoningEffort':_0x37674e[_0xfbe521(0x197)][_0xfbe521(0x17c)],'outputs':_0x37674e[_0xfbe521(0x197)][_0xfbe521(0x1dc)],'tools':_0x3befd0,'variables':_0x44df62});_0x12f21c[_0xfbe521(0x1d6)](_0x37674e['id'],_0x4c2990['id']);}else _0x488e16[_0xfbe521(0x22a)](_0x37674e);}if(_0x488e16[_0xfbe521(0x1c5)]===_0x36d0fb[_0xfbe521(0x1c5)])throw new SDKError(ErrorCode[_0xfbe521(0x1c3)],_0xfbe521(0x1db),undefined,{'helpText':_0xfbe521(0x21f)});_0x36d0fb[_0xfbe521(0x1c5)]=0x0,_0x36d0fb['push'](..._0x488e16);}for(const _0x3f8b67 of _0x52f80d){const _0x2a561a=_0x12f21c['get'](_0x3f8b67[_0xfbe521(0x197)][_0xfbe521(0x21c)]);if(!_0x2a561a)continue;const _0x3b9f95=await this[_0xfbe521(0x1f6)][_0xfbe521(0x1fa)]({'projectId':_0x5905e8,'agentId':_0x2a561a,'name':_0x3f8b67['attributes']['name'],'systemPrompt':_0x3f8b67['attributes'][_0xfbe521(0x211)],'template':_0x3f8b67[_0xfbe521(0x197)][_0xfbe521(0x235)],'jsonSchemaHint':_0x3f8b67[_0xfbe521(0x197)][_0xfbe521(0x177)]});_0x34da3f['set'](_0x3f8b67['id'],_0x3b9f95['id']);}for(const _0x2ab8fb of _0x38708a){const _0x4eec77=_0x2ab8fb[_0xfbe521(0x197)][_0xfbe521(0x195)][_0xfbe521(0x205)](_0x2a1349=>({..._0x2a1349,'promptId':_0x34da3f[_0xfbe521(0x1fc)](_0x2a1349[_0xfbe521(0x176)])||_0x2a1349[_0xfbe521(0x176)]}));await this['client'][_0xfbe521(0x1c0)]({'projectId':_0x5905e8,'serviceType':_0x2ab8fb['attributes'][_0xfbe521(0x19e)],'actions':_0x4eec77,'slackMessageMode':_0x2ab8fb[_0xfbe521(0x197)]['slackMessageMode'],'chatIgnoreManagedActions':_0x2ab8fb[_0xfbe521(0x197)][_0xfbe521(0x1c7)],'chatWelcomeMessage':_0x2ab8fb[_0xfbe521(0x197)][_0xfbe521(0x16a)],'webhookCorsOrigins':_0x2ab8fb[_0xfbe521(0x197)]['webhookCorsOrigins']});}return{'projectName':_0x53240c,'projectId':_0x5905e8,'counts':{'agents':_0x12f21c[_0xfbe521(0x1d9)],'knowledgeBases':_0x4289d4['size'],'prompts':_0x34da3f[_0xfbe521(0x1d9)],'integrations':_0x38708a[_0xfbe521(0x1c5)]},'sourceSite':_0x167220};}[a105_0x54707d(0x1c6)](_0x249377,_0x5cfa78){const _0x54ea7e=a105_0x54707d;if(!a105_0x5c029b[_0x54ea7e(0x19c)](_0x249377))return _0x5cfa78;return JSON[_0x54ea7e(0x171)](a105_0x5c029b[_0x54ea7e(0x164)](_0x249377,_0x54ea7e(0x174)));}[a105_0x54707d(0x185)](_0x3b7845){const _0x38a836=a105_0x54707d;if(!a105_0x5c029b['existsSync'](_0x3b7845))throw new SDKError(ErrorCode[_0x38a836(0x1f9)],'Backup\x20folder\x20not\x20found:\x20'+_0x3b7845,undefined,{'helpText':_0x38a836(0x1bb)});const _0x3f0c47=a105_0x2abb29['join'](_0x3b7845,'project.json');if(!a105_0x5c029b[_0x38a836(0x19c)](_0x3f0c47))throw new SDKError(ErrorCode[_0x38a836(0x182)],_0x38a836(0x170)+_0x3b7845,undefined,{'helpText':_0x38a836(0x1f5)});const _0x516caa=JSON[_0x38a836(0x171)](a105_0x5c029b[_0x38a836(0x164)](_0x3f0c47,_0x38a836(0x174)));if(!isSupportedBackupVersion(_0x516caa[_0x38a836(0x15b)]))throw new SDKError(ErrorCode[_0x38a836(0x182)],_0x38a836(0x1d1)+_0x516caa[_0x38a836(0x15b)],undefined,{'helpText':_0x38a836(0x199)});return _0x516caa;}async[a105_0x54707d(0x220)](_0x475579,_0xbe4975,_0x216a75){const _0x557e55=a105_0x54707d,{projectId:_0x59edbe,project:_0xb33781}=await this[_0x557e55(0x173)](_0x475579),_0x5aea57=_0xb33781[_0x557e55(0x197)]['name'];let _0x33c880;if(_0xbe4975)_0x33c880=_0xbe4975;else{const _0x56f0e8=a105_0x2abb29[_0x557e55(0x20a)](process[_0x557e55(0x216)](),_0x557e55(0x167)),_0x4bff62=getSanitizedPathWithMigration(_0x56f0e8,_0x5aea57);_0x4bff62[_0x557e55(0x1aa)]&&this[_0x557e55(0x1ea)][_0x557e55(0x165)]?.[_0x557e55(0x17b)]('Renamed\x20folder:\x20'+a105_0x2abb29['basename'](_0x4bff62[_0x557e55(0x16c)])+_0x557e55(0x1d8)+a105_0x2abb29['basename'](_0x4bff62[_0x557e55(0x1d5)])),_0x33c880=_0x4bff62[_0x557e55(0x1d5)];}const _0x44bd30=await this['client'][_0x557e55(0x232)](_0x59edbe),_0x5c25b3=await this[_0x557e55(0x1f6)][_0x557e55(0x161)](_0x59edbe),_0x235837=await this[_0x557e55(0x1f6)][_0x557e55(0x20c)](_0x59edbe),_0x5b9a4d=await this[_0x557e55(0x1f6)][_0x557e55(0x172)](_0x59edbe),_0x3202bb=await this[_0x557e55(0x1f6)][_0x557e55(0x15d)](_0x59edbe),_0x33b2f1=await this['client'][_0x557e55(0x15e)](_0x59edbe),_0x187213=new Map(),_0x3bc06e=new Map(),_0x26b9ec=new Map(),_0x2caf99=new Map(),_0x4948c5=new Map(),_0x173859=new Map();for(const _0x26ebce of _0x44bd30){_0x187213[_0x557e55(0x1d6)](_0x26ebce['id'],_0x26ebce[_0x557e55(0x197)]['name']);}for(const _0x2cd8c3 of _0x5c25b3){_0x3bc06e[_0x557e55(0x1d6)](_0x2cd8c3['id'],_0x2cd8c3['attributes'][_0x557e55(0x1ae)]);}for(const _0x1ad412 of _0x235837){_0x26b9ec[_0x557e55(0x1d6)](_0x1ad412['id'],_0x1ad412[_0x557e55(0x197)][_0x557e55(0x1ae)]);}for(const _0x592236 of _0x5b9a4d){_0x2caf99['set'](_0x592236['id'],_0x592236[_0x557e55(0x197)][_0x557e55(0x1ae)]);}for(const _0x42cee2 of _0x3202bb){_0x4948c5[_0x557e55(0x1d6)](_0x42cee2['id'],_0x42cee2[_0x557e55(0x197)][_0x557e55(0x1ae)]);}for(const _0x4d3fb0 of _0x33b2f1){_0x173859[_0x557e55(0x1d6)](_0x4d3fb0['id'],_0x4d3fb0[_0x557e55(0x197)]['name']);}const _0x4d1255={'resolveKnowledgeBaseName':async _0x33ee11=>_0x3bc06e[_0x557e55(0x1fc)](_0x33ee11),'resolveTextKnowledgeBaseName':async _0x35988=>_0x26b9ec[_0x557e55(0x1fc)](_0x35988),'resolveAgentName':async _0x31fc4f=>_0x187213[_0x557e55(0x1fc)](_0x31fc4f),'resolveWebSearchToolName':async _0x56a9b5=>_0x4948c5[_0x557e55(0x1fc)](_0x56a9b5),'resolveImageGeneratorName':async _0x10a290=>_0x2caf99[_0x557e55(0x1fc)](_0x10a290),'resolvePromptName':async _0x4d8b30=>_0x173859[_0x557e55(0x1fc)](_0x4d8b30),'onWarning':_0x2d7b65=>this[_0x557e55(0x1ea)][_0x557e55(0x165)]?.[_0x557e55(0x18f)](_0x2d7b65)},_0x577c3e={'projectName':_0x5aea57,'outputDir':_0x33c880,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'counts':{'agents':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'knowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'textKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'prompts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0x468cac=[];for(const _0x4def43 of _0x44bd30){const _0x347667=getSanitizedPathWithMigration(_0x33c880,_0x4def43[_0x557e55(0x197)]['name']);_0x347667[_0x557e55(0x1aa)]&&this[_0x557e55(0x1ea)]['logger']?.[_0x557e55(0x17b)](_0x557e55(0x20e)+a105_0x2abb29[_0x557e55(0x153)](_0x347667['oldPath'])+'\x20→\x20'+a105_0x2abb29[_0x557e55(0x153)](_0x347667[_0x557e55(0x1d5)]));const _0x320d5f=_0x347667['path'],_0x3387e0=a105_0x2abb29['join'](_0x320d5f,_0x557e55(0x230)),_0x2d6b4e=a105_0x2abb29[_0x557e55(0x20a)](_0x320d5f,_0x557e55(0x16e)),_0x526ed6=a105_0x2abb29['join'](_0x320d5f,_0x557e55(0x186)),{yaml:_0x22082e,systemPrompt:_0x103582,starterMessage:_0x20ac95}=await agentResponseToDef(_0x4def43,_0x4d1255),_0x32645f=toAgentYamlString(_0x22082e),_0x3fa7dd=!a105_0x5c029b[_0x557e55(0x19c)](_0x2d6b4e);let _0x1a6258=_0x3fa7dd,_0x17776d;if(!_0x3fa7dd){const _0x1a2218=a105_0x5c029b['existsSync'](_0x3387e0)?a105_0x5c029b[_0x557e55(0x164)](_0x3387e0,_0x557e55(0x174)):'',_0x25a27f=a105_0x5c029b[_0x557e55(0x164)](_0x2d6b4e,'utf-8'),_0x1a9e40='#\x20prompt.md\x0a'+_0x1a2218+_0x557e55(0x1fe)+_0x25a27f,_0x1993da=_0x557e55(0x19f)+_0x103582+_0x557e55(0x1fe)+_0x32645f,_0x7774b3=generateDiff(_0x1a9e40,_0x1993da);_0x1a6258=hasChanges(_0x7774b3),_0x1a6258&&(_0x17776d=formatDiffWithColors(_0x7774b3));}_0x468cac[_0x557e55(0x22a)]({'path':_0x320d5f,'content':'','isDir':!![]}),_0x468cac[_0x557e55(0x22a)]({'path':_0x3387e0,'content':_0x103582}),_0x468cac['push']({'path':_0x2d6b4e,'content':_0x32645f});_0x20ac95&&_0x20ac95[_0x557e55(0x207)]('\x0a')&&_0x468cac[_0x557e55(0x22a)]({'path':_0x526ed6,'content':_0x20ac95});_0x577c3e[_0x557e55(0x167)][_0x557e55(0x22a)]({'agentName':_0x4def43[_0x557e55(0x197)][_0x557e55(0x1ae)],'outputPath':_0x320d5f,'isNew':_0x3fa7dd,'hasChanges':_0x1a6258,'diff':_0x17776d}),_0x577c3e[_0x557e55(0x218)][_0x557e55(0x167)][_0x557e55(0x224)]++;if(_0x3fa7dd)_0x577c3e[_0x557e55(0x218)][_0x557e55(0x167)][_0x557e55(0x234)]++;else{if(_0x1a6258)_0x577c3e[_0x557e55(0x218)][_0x557e55(0x167)][_0x557e55(0x18c)]++;else _0x577c3e['counts'][_0x557e55(0x167)][_0x557e55(0x181)]++;}}for(const _0x21d5a6 of _0x5c25b3){if(_0x21d5a6[_0x557e55(0x197)][_0x557e55(0x1e9)])continue;const _0x588fdf=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x33c880),_0x21d5a6[_0x557e55(0x197)][_0x557e55(0x1ae)],_0x557e55(0x1ee));_0x588fdf['renamed']&&this['context']['logger']?.['info'](_0x557e55(0x208)+a105_0x2abb29[_0x557e55(0x153)](_0x588fdf[_0x557e55(0x16c)])+_0x557e55(0x1d8)+a105_0x2abb29[_0x557e55(0x153)](_0x588fdf['path']));const _0x195b96=_0x588fdf[_0x557e55(0x1d5)],_0x3792b8=apiKnowledgeBaseToYaml(_0x21d5a6),_0x540933=toKnowledgeBaseYamlString(_0x3792b8),_0x2891ea=!a105_0x5c029b[_0x557e55(0x19c)](_0x195b96);let _0x761ca0=_0x2891ea,_0xdd0e9a;if(!_0x2891ea){const _0x2ba7f8=a105_0x5c029b[_0x557e55(0x164)](_0x195b96,_0x557e55(0x174)),_0x4ec6f8=generateDiff(_0x2ba7f8,_0x540933);_0x761ca0=hasChanges(_0x4ec6f8),_0x761ca0&&(_0xdd0e9a=formatDiffWithColors(_0x4ec6f8));}_0x468cac[_0x557e55(0x22a)]({'path':_0x195b96,'content':_0x540933}),_0x577c3e[_0x557e55(0x1cc)][_0x557e55(0x22a)]({'name':_0x21d5a6['attributes'][_0x557e55(0x1ae)],'outputPath':_0x195b96,'isNew':_0x2891ea,'hasChanges':_0x761ca0,'diff':_0xdd0e9a}),_0x577c3e[_0x557e55(0x218)]['knowledgeBases'][_0x557e55(0x224)]++;if(_0x2891ea)_0x577c3e[_0x557e55(0x218)][_0x557e55(0x1cc)][_0x557e55(0x234)]++;else{if(_0x761ca0)_0x577c3e['counts'][_0x557e55(0x1cc)][_0x557e55(0x18c)]++;else _0x577c3e['counts'][_0x557e55(0x1cc)][_0x557e55(0x181)]++;}}for(const _0x4cab45 of _0x235837){if(_0x4cab45['attributes'][_0x557e55(0x1e9)])continue;const _0x38c668=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x33c880),_0x4cab45[_0x557e55(0x197)][_0x557e55(0x1ae)],'.md');_0x38c668[_0x557e55(0x1aa)]&&this[_0x557e55(0x1ea)]['logger']?.[_0x557e55(0x17b)]('Renamed\x20text\x20KB\x20file:\x20'+a105_0x2abb29[_0x557e55(0x153)](_0x38c668[_0x557e55(0x16c)])+'\x20→\x20'+a105_0x2abb29[_0x557e55(0x153)](_0x38c668[_0x557e55(0x1d5)]));const _0x60abd6=_0x38c668[_0x557e55(0x1d5)],_0x549f4a=toTextKnowledgeBaseMd(_0x4cab45[_0x557e55(0x197)][_0x557e55(0x1ae)],_0x4cab45[_0x557e55(0x197)][_0x557e55(0x227)]),_0x5e2fc1=!a105_0x5c029b[_0x557e55(0x19c)](_0x60abd6);let _0x3f1671=_0x5e2fc1,_0x49de41;if(!_0x5e2fc1){const _0x3cb744=a105_0x5c029b[_0x557e55(0x164)](_0x60abd6,'utf-8'),_0xdf6bdc=generateDiff(_0x3cb744,_0x549f4a);_0x3f1671=hasChanges(_0xdf6bdc),_0x3f1671&&(_0x49de41=formatDiffWithColors(_0xdf6bdc));}_0x468cac[_0x557e55(0x22a)]({'path':_0x60abd6,'content':_0x549f4a}),_0x577c3e[_0x557e55(0x222)][_0x557e55(0x22a)]({'name':_0x4cab45[_0x557e55(0x197)]['name'],'outputPath':_0x60abd6,'isNew':_0x5e2fc1,'hasChanges':_0x3f1671,'diff':_0x49de41}),_0x577c3e[_0x557e55(0x218)][_0x557e55(0x222)][_0x557e55(0x224)]++;if(_0x5e2fc1)_0x577c3e[_0x557e55(0x218)][_0x557e55(0x222)][_0x557e55(0x234)]++;else{if(_0x3f1671)_0x577c3e[_0x557e55(0x218)][_0x557e55(0x222)][_0x557e55(0x18c)]++;else _0x577c3e[_0x557e55(0x218)]['textKnowledgeBases'][_0x557e55(0x181)]++;}}for(const _0x6d1fe3 of _0x33b2f1){if(_0x6d1fe3[_0x557e55(0x197)][_0x557e55(0x1e9)])continue;const _0x2c1acd=getSanitizedPathWithMigration(getPromptsDir(_0x33c880),_0x6d1fe3[_0x557e55(0x197)][_0x557e55(0x1ae)],'.yml');_0x2c1acd['renamed']&&this[_0x557e55(0x1ea)][_0x557e55(0x165)]?.[_0x557e55(0x17b)](_0x557e55(0x1eb)+a105_0x2abb29[_0x557e55(0x153)](_0x2c1acd[_0x557e55(0x16c)])+_0x557e55(0x1d8)+a105_0x2abb29[_0x557e55(0x153)](_0x2c1acd[_0x557e55(0x1d5)]));const _0xccc660=_0x2c1acd[_0x557e55(0x1d5)],_0x1d7688=await apiPromptToYaml(_0x6d1fe3,_0x4d1255);if(!_0x1d7688)continue;const _0x29210b=toPromptYamlString(_0x1d7688),_0x4e2bbb=!a105_0x5c029b[_0x557e55(0x19c)](_0xccc660);let _0x35f6e0=_0x4e2bbb,_0x42a709;if(!_0x4e2bbb){const _0x13aae9=a105_0x5c029b[_0x557e55(0x164)](_0xccc660,_0x557e55(0x174)),_0x1483be=generateDiff(_0x13aae9,_0x29210b);_0x35f6e0=hasChanges(_0x1483be),_0x35f6e0&&(_0x42a709=formatDiffWithColors(_0x1483be));}_0x468cac[_0x557e55(0x22a)]({'path':_0xccc660,'content':_0x29210b}),_0x577c3e[_0x557e55(0x1e0)][_0x557e55(0x22a)]({'name':_0x6d1fe3['attributes'][_0x557e55(0x1ae)],'outputPath':_0xccc660,'isNew':_0x4e2bbb,'hasChanges':_0x35f6e0,'diff':_0x42a709}),_0x577c3e[_0x557e55(0x218)][_0x557e55(0x1e0)]['total']++;if(_0x4e2bbb)_0x577c3e[_0x557e55(0x218)][_0x557e55(0x1e0)][_0x557e55(0x234)]++;else{if(_0x35f6e0)_0x577c3e[_0x557e55(0x218)]['prompts']['updated']++;else _0x577c3e[_0x557e55(0x218)][_0x557e55(0x1e0)][_0x557e55(0x181)]++;}}if(_0x216a75?.[_0x557e55(0x22e)])return _0x577c3e;a105_0x5c029b[_0x557e55(0x190)](_0x33c880,{'recursive':!![]}),a105_0x5c029b['mkdirSync'](getKnowledgeBasesDir(_0x33c880),{'recursive':!![]}),a105_0x5c029b['mkdirSync'](getPromptsDir(_0x33c880),{'recursive':!![]});const _0x57d1a0=a105_0x2abb29['join'](_0x33c880,_0x557e55(0x1ad));a105_0x5c029b[_0x557e55(0x1e6)](_0x57d1a0,createAgentConfigContent(_0x5aea57));for(const _0xfbaf11 of _0x468cac){if(_0xfbaf11[_0x557e55(0x1c4)])a105_0x5c029b['mkdirSync'](_0xfbaf11['path'],{'recursive':!![]});else{const _0x30f027=a105_0x2abb29['dirname'](_0xfbaf11['path']);!a105_0x5c029b[_0x557e55(0x19c)](_0x30f027)&&a105_0x5c029b[_0x557e55(0x190)](_0x30f027,{'recursive':!![]}),a105_0x5c029b[_0x557e55(0x1e6)](_0xfbaf11[_0x557e55(0x1d5)],_0xfbaf11[_0x557e55(0x166)]);}}return _0x577c3e;}async[a105_0x54707d(0x1e4)](_0x12e832,_0x31923e){const _0x15128f=a105_0x54707d,_0x2538f1=a105_0x2abb29[_0x15128f(0x20a)](_0x12e832,_0x15128f(0x1ad));if(!a105_0x5c029b[_0x15128f(0x19c)](_0x2538f1))throw new SDKError(ErrorCode[_0x15128f(0x182)],_0x15128f(0x22c)+_0x12e832,undefined,{'helpText':_0x15128f(0x1a1)});const _0x5cb5c3=loadAgentConfig(_0x2538f1),_0x497fda=await this[_0x15128f(0x1c8)](_0x5cb5c3[_0x15128f(0x22d)]),_0xd07195=await this[_0x15128f(0x1f6)][_0x15128f(0x1df)](_0x497fda),_0x3d187a=_0xd07195['attributes'][_0x15128f(0x1ae)],_0x27a8c5={'projectName':_0x3d187a,'projectId':_0x497fda,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0xf66207=[],_0x4c5527=[],_0x13ed81=[],_0x23b3d2=[],_0x544b1e=a105_0x5c029b[_0x15128f(0x1b6)](_0x12e832,{'withFileTypes':!![]});for(const _0x5df1ce of _0x544b1e){if(!_0x5df1ce[_0x15128f(0x159)]())continue;if([_0x15128f(0x189),'prompts',_0x15128f(0x210)][_0x15128f(0x207)](_0x5df1ce[_0x15128f(0x1ae)]))continue;const _0x270659=a105_0x2abb29[_0x15128f(0x20a)](_0x12e832,_0x5df1ce[_0x15128f(0x1ae)]);if(isAgentDir(_0x270659)){const _0x1cc8d5=a105_0x2abb29[_0x15128f(0x20a)](_0x270659,'agent.yml'),_0xa38c18=a105_0x2abb29[_0x15128f(0x20a)](_0x270659,_0x15128f(0x230)),_0x36f3bb=a105_0x2abb29[_0x15128f(0x20a)](_0x270659,_0x15128f(0x186)),_0x227b3a=parseAgentYaml(a105_0x5c029b[_0x15128f(0x164)](_0x1cc8d5,'utf-8'),_0x1cc8d5),_0x5e7166=a105_0x5c029b[_0x15128f(0x19c)](_0xa38c18)?a105_0x5c029b[_0x15128f(0x164)](_0xa38c18,_0x15128f(0x174)):'',_0xe5e9d3=a105_0x5c029b[_0x15128f(0x19c)](_0x36f3bb)?a105_0x5c029b[_0x15128f(0x164)](_0x36f3bb,_0x15128f(0x174)):_0x227b3a[_0x15128f(0x215)];_0xf66207[_0x15128f(0x22a)]({'name':_0x227b3a[_0x15128f(0x1ae)],'dir':_0x270659,'yaml':_0x227b3a,'systemPrompt':_0x5e7166,'starterMessage':_0xe5e9d3});}}const _0x32787a=getKnowledgeBasesDir(_0x12e832);if(a105_0x5c029b[_0x15128f(0x19c)](_0x32787a)){const _0x4e95e0=a105_0x5c029b[_0x15128f(0x1b6)](_0x32787a);for(const _0x2f712f of _0x4e95e0){const _0xf12e1b=a105_0x2abb29[_0x15128f(0x20a)](_0x32787a,_0x2f712f);if(_0x2f712f[_0x15128f(0x179)]('.yml')){const _0x26f9d5=parseKnowledgeBaseYaml(a105_0x5c029b[_0x15128f(0x164)](_0xf12e1b,_0x15128f(0x174)),_0xf12e1b);_0x4c5527[_0x15128f(0x22a)]({'name':_0x26f9d5[_0x15128f(0x1ae)],'path':_0xf12e1b,'yaml':_0x26f9d5});}else{if(_0x2f712f[_0x15128f(0x179)](_0x15128f(0x201))){const _0x4a1736=a105_0x5c029b['readFileSync'](_0xf12e1b,_0x15128f(0x174)),{name:_0x5bc3d6,text:_0xfc4cb7}=parseTextKnowledgeBaseMd(_0x4a1736,_0x2f712f);_0x13ed81['push']({'name':_0x5bc3d6,'path':_0xf12e1b,'text':_0xfc4cb7});}}}}const _0x4fb07a=getPromptsDir(_0x12e832);if(a105_0x5c029b[_0x15128f(0x19c)](_0x4fb07a)){const _0x5e3d0d=a105_0x5c029b['readdirSync'](_0x4fb07a)[_0x15128f(0x18a)](_0x12e283=>_0x12e283[_0x15128f(0x179)]('.yml'));for(const _0x3c77d5 of _0x5e3d0d){const _0x410d2f=a105_0x2abb29[_0x15128f(0x20a)](_0x4fb07a,_0x3c77d5),_0x534bf0=parsePromptYaml(a105_0x5c029b[_0x15128f(0x164)](_0x410d2f,'utf-8'),_0x410d2f);_0x23b3d2[_0x15128f(0x22a)]({'name':_0x534bf0[_0x15128f(0x1ae)],'path':_0x410d2f,'yaml':_0x534bf0});}}const _0x59fcaa=await this['client'][_0x15128f(0x232)](_0x497fda),_0x5d7ac8=await this[_0x15128f(0x1f6)]['listKnowledgeBases'](_0x497fda),_0x189ea9=await this[_0x15128f(0x1f6)][_0x15128f(0x20c)](_0x497fda),_0x20b81e=await this[_0x15128f(0x1f6)][_0x15128f(0x172)](_0x497fda),_0x2d9c23=await this[_0x15128f(0x1f6)][_0x15128f(0x15d)](_0x497fda),_0x3b5375=await this[_0x15128f(0x1f6)]['listPrompts'](_0x497fda),_0x363774=new Map(),_0x10b29c=new Map(),_0x39b86b=new Map(),_0x1062c7=new Map();for(const _0x2fab83 of _0x59fcaa){_0x363774[_0x15128f(0x1d6)](_0x2fab83[_0x15128f(0x197)][_0x15128f(0x1ae)],_0x2fab83);}for(const _0x43c729 of _0x5d7ac8){_0x10b29c[_0x15128f(0x1d6)](_0x43c729[_0x15128f(0x197)][_0x15128f(0x1ae)],_0x43c729);}for(const _0x52ca4c of _0x189ea9){_0x39b86b[_0x15128f(0x1d6)](_0x52ca4c[_0x15128f(0x197)]['name'],_0x52ca4c);}for(const _0x2fe697 of _0x3b5375){_0x1062c7['set'](_0x2fe697[_0x15128f(0x197)][_0x15128f(0x1ae)],_0x2fe697);}const _0x317d07=new Map(),_0x371496=new Map(),_0x24fc03=new Map(),_0x53a1a0=new Map(),_0x238388=new Map(),_0x42df2b=new Map(),_0xc40557=new Map(),_0x115f1e=new Map(),_0x35713e=new Map(),_0x2707a4=new Map(),_0x4764d6=new Map(),_0xd5cb33=new Map();for(const _0x2aa4d5 of _0x5d7ac8){_0x317d07[_0x15128f(0x1d6)](_0x2aa4d5[_0x15128f(0x197)]['name'],_0x2aa4d5['id']),_0xc40557[_0x15128f(0x1d6)](_0x2aa4d5['id'],_0x2aa4d5[_0x15128f(0x197)]['name']);}for(const _0x351877 of _0x189ea9){_0x371496[_0x15128f(0x1d6)](_0x351877['attributes'][_0x15128f(0x1ae)],_0x351877['id']),_0x115f1e[_0x15128f(0x1d6)](_0x351877['id'],_0x351877['attributes']['name']);}for(const _0xade989 of _0x59fcaa){_0x24fc03['set'](_0xade989['attributes'][_0x15128f(0x1ae)],_0xade989['id']),_0x35713e['set'](_0xade989['id'],_0xade989[_0x15128f(0x197)][_0x15128f(0x1ae)]);}for(const _0x4184ee of _0x20b81e){_0x53a1a0['set'](_0x4184ee[_0x15128f(0x197)][_0x15128f(0x1ae)],_0x4184ee['id']),_0x2707a4[_0x15128f(0x1d6)](_0x4184ee['id'],_0x4184ee[_0x15128f(0x197)][_0x15128f(0x1ae)]);}for(const _0x450b1b of _0x2d9c23){_0x238388[_0x15128f(0x1d6)](_0x450b1b[_0x15128f(0x197)][_0x15128f(0x1ae)],_0x450b1b['id']),_0x4764d6['set'](_0x450b1b['id'],_0x450b1b['attributes'][_0x15128f(0x1ae)]);}for(const _0x4f6a0a of _0x3b5375){_0x42df2b['set'](_0x4f6a0a[_0x15128f(0x197)][_0x15128f(0x1ae)],_0x4f6a0a['id']),_0xd5cb33[_0x15128f(0x1d6)](_0x4f6a0a['id'],_0x4f6a0a[_0x15128f(0x197)][_0x15128f(0x1ae)]);}const _0x7ae408={'resolveKnowledgeBaseName':async _0x3623c4=>_0xc40557[_0x15128f(0x1fc)](_0x3623c4),'resolveTextKnowledgeBaseName':async _0x11ff2c=>_0x115f1e['get'](_0x11ff2c),'resolveAgentName':async _0x3e4c53=>_0x35713e['get'](_0x3e4c53),'resolveWebSearchToolName':async _0x20e8b3=>_0x4764d6[_0x15128f(0x1fc)](_0x20e8b3),'resolveImageGeneratorName':async _0xaf6a2c=>_0x2707a4[_0x15128f(0x1fc)](_0xaf6a2c),'resolvePromptName':async _0x31c8a1=>_0xd5cb33[_0x15128f(0x1fc)](_0x31c8a1),'onWarning':_0x200b64=>this['context']['logger']?.[_0x15128f(0x18f)](_0x200b64)},_0x184fc0={'projectId':_0x497fda,'resolveKnowledgeBaseId':async _0x1d5f7e=>_0x317d07[_0x15128f(0x1fc)](_0x1d5f7e),'resolveTextKnowledgeBaseId':async _0x355399=>_0x371496['get'](_0x355399),'resolveAgentId':async _0x70c8bd=>_0x24fc03[_0x15128f(0x1fc)](_0x70c8bd),'resolveWebSearchToolId':async _0x5953cc=>_0x238388[_0x15128f(0x1fc)](_0x5953cc),'resolveImageGeneratorId':async _0x3d6bcf=>_0x53a1a0['get'](_0x3d6bcf),'resolvePromptId':async _0xc076f0=>_0x42df2b[_0x15128f(0x1fc)](_0xc076f0),'onWarning':_0x472d8c=>this[_0x15128f(0x1ea)]['logger']?.[_0x15128f(0x18f)](_0x472d8c)},{resolved:_0x5be39f,unresolved:_0x3b018a}=resolveAgentDependencies(_0xf66207,new Set(_0x363774['keys']()));for(const {agent:_0x38c36d,missingDeps:_0x5a7390}of _0x3b018a){_0x27a8c5['agents'][_0x15128f(0x22a)]({'agentName':_0x38c36d[_0x15128f(0x1ba)][_0x15128f(0x1ae)],'action':'error','error':'Unresolved\x20dependencies:\x20'+_0x5a7390[_0x15128f(0x20a)](',\x20')+_0x15128f(0x1b3)}),_0x27a8c5[_0x15128f(0x218)][_0x15128f(0x167)][_0x15128f(0x14c)]++;}for(const _0x2bb0b5 of _0x4c5527){const _0x3a037b=_0x10b29c[_0x15128f(0x1fc)](_0x2bb0b5[_0x15128f(0x1ba)][_0x15128f(0x1ae)]),_0x5d40c2=a105_0x5c029b[_0x15128f(0x164)](_0x2bb0b5[_0x15128f(0x1d5)],_0x15128f(0x174));if(_0x3a037b){const _0x5e928b=apiKnowledgeBaseToYaml(_0x3a037b),_0x33fbeb=toKnowledgeBaseYamlString(_0x5e928b),_0x16f0fd=generateDiff(_0x33fbeb,_0x5d40c2),_0x407020=hasChanges(_0x16f0fd);_0x407020?(_0x27a8c5['knowledgeBases']['push']({'name':_0x2bb0b5['yaml'][_0x15128f(0x1ae)],'action':_0x15128f(0x18c),'id':_0x3a037b['id'],'diff':formatDiffWithColors(_0x16f0fd)}),_0x27a8c5[_0x15128f(0x218)][_0x15128f(0x1cc)][_0x15128f(0x18c)]++):(_0x27a8c5[_0x15128f(0x1cc)][_0x15128f(0x22a)]({'name':_0x2bb0b5[_0x15128f(0x1ba)]['name'],'action':_0x15128f(0x181),'id':_0x3a037b['id']}),_0x27a8c5['counts']['knowledgeBases']['unchanged']++);}else _0x27a8c5[_0x15128f(0x1cc)]['push']({'name':_0x2bb0b5[_0x15128f(0x1ba)][_0x15128f(0x1ae)],'action':_0x15128f(0x1da)}),_0x27a8c5['counts']['knowledgeBases']['created']++;}for(const _0x28ce8c of _0x13ed81){const _0x3529f9=_0x39b86b[_0x15128f(0x1fc)](_0x28ce8c[_0x15128f(0x1ae)]),_0x2f7d8c=a105_0x5c029b[_0x15128f(0x164)](_0x28ce8c['path'],_0x15128f(0x174));if(_0x3529f9){const _0x9475db=toTextKnowledgeBaseMd(_0x3529f9[_0x15128f(0x197)][_0x15128f(0x1ae)],_0x3529f9['attributes']['text']),_0x1e4084=generateDiff(_0x9475db,_0x2f7d8c),_0x404919=hasChanges(_0x1e4084);_0x404919?(_0x27a8c5[_0x15128f(0x222)][_0x15128f(0x22a)]({'name':_0x28ce8c['name'],'action':'updated','id':_0x3529f9['id'],'diff':formatDiffWithColors(_0x1e4084)}),_0x27a8c5[_0x15128f(0x218)][_0x15128f(0x222)][_0x15128f(0x18c)]++):(_0x27a8c5[_0x15128f(0x222)][_0x15128f(0x22a)]({'name':_0x28ce8c[_0x15128f(0x1ae)],'action':'unchanged','id':_0x3529f9['id']}),_0x27a8c5[_0x15128f(0x218)][_0x15128f(0x222)][_0x15128f(0x181)]++);}else _0x27a8c5[_0x15128f(0x222)][_0x15128f(0x22a)]({'name':_0x28ce8c['name'],'action':_0x15128f(0x1da)}),_0x27a8c5[_0x15128f(0x218)][_0x15128f(0x222)][_0x15128f(0x1da)]++;}for(const _0x43991c of _0x5be39f){const _0x52ca50=_0x363774[_0x15128f(0x1fc)](_0x43991c[_0x15128f(0x1ba)][_0x15128f(0x1ae)]),_0x14b0ce=a105_0x2abb29['join'](_0x43991c[_0x15128f(0x214)],'agent.yml'),_0x3e1f99=a105_0x5c029b[_0x15128f(0x164)](_0x14b0ce,_0x15128f(0x174)),_0x5bb248=_0x43991c[_0x15128f(0x211)],_0x2b0eb7='#\x20prompt.md\x0a'+_0x5bb248+_0x15128f(0x1fe)+_0x3e1f99;if(_0x52ca50){const {yaml:_0x200b4a,systemPrompt:_0x35058d}=await agentResponseToDef(_0x52ca50,_0x7ae408),_0x73bb58=toAgentYamlString(_0x200b4a),_0x354b1b=_0x15128f(0x19f)+_0x35058d+_0x15128f(0x1fe)+_0x73bb58,_0x2141ee=generateDiff(_0x354b1b,_0x2b0eb7),_0x13b0f5=hasChanges(_0x2141ee);_0x13b0f5?(_0x27a8c5[_0x15128f(0x167)]['push']({'agentName':_0x43991c[_0x15128f(0x1ba)][_0x15128f(0x1ae)],'action':_0x15128f(0x18c),'agentId':_0x52ca50['id'],'diff':formatDiffWithColors(_0x2141ee)}),_0x27a8c5[_0x15128f(0x218)][_0x15128f(0x167)][_0x15128f(0x18c)]++):(_0x27a8c5['agents'][_0x15128f(0x22a)]({'agentName':_0x43991c[_0x15128f(0x1ba)][_0x15128f(0x1ae)],'action':_0x15128f(0x181),'agentId':_0x52ca50['id']}),_0x27a8c5[_0x15128f(0x218)][_0x15128f(0x167)][_0x15128f(0x181)]++);}else _0x27a8c5[_0x15128f(0x167)][_0x15128f(0x22a)]({'agentName':_0x43991c[_0x15128f(0x1ba)]['name'],'action':_0x15128f(0x1da)}),_0x27a8c5['counts'][_0x15128f(0x167)][_0x15128f(0x1da)]++;}for(const _0x12cf62 of _0x23b3d2){const _0x5460e2=_0x1062c7['get'](_0x12cf62[_0x15128f(0x1ba)][_0x15128f(0x1ae)]),_0x478483=a105_0x5c029b['readFileSync'](_0x12cf62[_0x15128f(0x1d5)],_0x15128f(0x174));if(_0x5460e2){const _0x3acb57=await apiPromptToYaml(_0x5460e2,_0x7ae408);if(!_0x3acb57){_0x27a8c5[_0x15128f(0x1e0)][_0x15128f(0x22a)]({'name':_0x12cf62[_0x15128f(0x1ba)]['name'],'action':_0x15128f(0x18c),'id':_0x5460e2['id']}),_0x27a8c5[_0x15128f(0x218)][_0x15128f(0x1e0)]['updated']++;continue;}const _0x21162b=toPromptYamlString(_0x3acb57),_0x35159b=generateDiff(_0x21162b,_0x478483),_0x3373bd=hasChanges(_0x35159b);_0x3373bd?(_0x27a8c5[_0x15128f(0x1e0)]['push']({'name':_0x12cf62[_0x15128f(0x1ba)][_0x15128f(0x1ae)],'action':_0x15128f(0x18c),'id':_0x5460e2['id'],'diff':formatDiffWithColors(_0x35159b)}),_0x27a8c5['counts'][_0x15128f(0x1e0)][_0x15128f(0x18c)]++):(_0x27a8c5[_0x15128f(0x1e0)][_0x15128f(0x22a)]({'name':_0x12cf62[_0x15128f(0x1ba)]['name'],'action':_0x15128f(0x181),'id':_0x5460e2['id']}),_0x27a8c5[_0x15128f(0x218)][_0x15128f(0x1e0)][_0x15128f(0x181)]++);}else _0x27a8c5[_0x15128f(0x1e0)][_0x15128f(0x22a)]({'name':_0x12cf62[_0x15128f(0x1ba)][_0x15128f(0x1ae)],'action':_0x15128f(0x1da)}),_0x27a8c5[_0x15128f(0x218)][_0x15128f(0x1e0)][_0x15128f(0x1da)]++;}if(_0x31923e?.[_0x15128f(0x22e)])return _0x27a8c5;_0x27a8c5[_0x15128f(0x1cc)]=[],_0x27a8c5[_0x15128f(0x222)]=[],_0x27a8c5[_0x15128f(0x1e0)]=[];const _0x3e8c97=_0x27a8c5[_0x15128f(0x167)][_0x15128f(0x18a)](_0x10190b=>_0x10190b[_0x15128f(0x1de)]===_0x15128f(0x14f));_0x27a8c5[_0x15128f(0x167)]=_0x3e8c97,_0x27a8c5[_0x15128f(0x218)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x3e8c97[_0x15128f(0x1c5)]},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x7a28ed of _0x4c5527){try{const _0x3d2e5a=_0x10b29c[_0x15128f(0x1fc)](_0x7a28ed[_0x15128f(0x1ba)][_0x15128f(0x1ae)]),_0x817924=yamlKnowledgeBaseToApi(_0x7a28ed['yaml'],_0x497fda);if(_0x3d2e5a)await this[_0x15128f(0x1f6)][_0x15128f(0x17f)](_0x3d2e5a['id'],_0x817924),_0x317d07[_0x15128f(0x1d6)](_0x7a28ed['yaml'][_0x15128f(0x1ae)],_0x3d2e5a['id']),_0x27a8c5[_0x15128f(0x1cc)]['push']({'name':_0x7a28ed[_0x15128f(0x1ba)][_0x15128f(0x1ae)],'action':_0x15128f(0x18c),'id':_0x3d2e5a['id']}),_0x27a8c5[_0x15128f(0x218)]['knowledgeBases'][_0x15128f(0x18c)]++;else{const _0x150462=await this[_0x15128f(0x1f6)]['createKnowledgeBase'](_0x817924);_0x317d07['set'](_0x7a28ed['yaml'][_0x15128f(0x1ae)],_0x150462['id']),_0x27a8c5[_0x15128f(0x1cc)][_0x15128f(0x22a)]({'name':_0x7a28ed['yaml'][_0x15128f(0x1ae)],'action':_0x15128f(0x1da),'id':_0x150462['id']}),_0x27a8c5[_0x15128f(0x218)][_0x15128f(0x1cc)]['created']++;}}catch(_0x58cf05){_0x27a8c5[_0x15128f(0x1cc)]['push']({'name':_0x7a28ed[_0x15128f(0x1ba)][_0x15128f(0x1ae)],'action':_0x15128f(0x14f),'error':_0x58cf05['message']}),_0x27a8c5[_0x15128f(0x218)]['knowledgeBases'][_0x15128f(0x14c)]++;}}for(const _0x3eb124 of _0x13ed81){try{const _0x4bdf3e=_0x39b86b['get'](_0x3eb124[_0x15128f(0x1ae)]),_0x2a5f9a=yamlTextKnowledgeBaseToApi({'name':_0x3eb124[_0x15128f(0x1ae)],'text':_0x3eb124[_0x15128f(0x227)]},_0x497fda);if(_0x4bdf3e)await this[_0x15128f(0x1f6)][_0x15128f(0x152)](_0x4bdf3e['id'],_0x2a5f9a),_0x371496[_0x15128f(0x1d6)](_0x3eb124['name'],_0x4bdf3e['id']),_0x27a8c5[_0x15128f(0x222)][_0x15128f(0x22a)]({'name':_0x3eb124['name'],'action':_0x15128f(0x18c),'id':_0x4bdf3e['id']}),_0x27a8c5[_0x15128f(0x218)]['textKnowledgeBases'][_0x15128f(0x18c)]++;else{const _0x1d52b0=await this[_0x15128f(0x1f6)][_0x15128f(0x1d7)](_0x2a5f9a);_0x371496[_0x15128f(0x1d6)](_0x3eb124[_0x15128f(0x1ae)],_0x1d52b0['id']),_0x27a8c5['textKnowledgeBases'][_0x15128f(0x22a)]({'name':_0x3eb124['name'],'action':_0x15128f(0x1da),'id':_0x1d52b0['id']}),_0x27a8c5[_0x15128f(0x218)][_0x15128f(0x222)]['created']++;}}catch(_0x1bfff8){_0x27a8c5[_0x15128f(0x222)][_0x15128f(0x22a)]({'name':_0x3eb124['name'],'action':'error','error':_0x1bfff8[_0x15128f(0x16b)]}),_0x27a8c5['counts'][_0x15128f(0x222)][_0x15128f(0x14c)]++;}}for(const _0x3dbcfb of _0x5be39f){try{const _0x457c8e=_0x363774[_0x15128f(0x1fc)](_0x3dbcfb[_0x15128f(0x1ba)]['name']),_0x4ee5a0=await agentDefToRequest(_0x3dbcfb[_0x15128f(0x1ba)],_0x3dbcfb['systemPrompt'],_0x3dbcfb[_0x15128f(0x17a)],_0x184fc0);if(_0x457c8e)await this[_0x15128f(0x1f6)]['updateAgentResponse'](_0x457c8e['id'],_0x4ee5a0),_0x24fc03[_0x15128f(0x1d6)](_0x3dbcfb[_0x15128f(0x1ba)][_0x15128f(0x1ae)],_0x457c8e['id']),_0x27a8c5[_0x15128f(0x167)][_0x15128f(0x22a)]({'agentName':_0x3dbcfb[_0x15128f(0x1ba)][_0x15128f(0x1ae)],'action':_0x15128f(0x18c),'agentId':_0x457c8e['id']}),_0x27a8c5[_0x15128f(0x218)][_0x15128f(0x167)][_0x15128f(0x18c)]++;else{const _0x7095fc=await this['client'][_0x15128f(0x1a7)](_0x4ee5a0);_0x24fc03[_0x15128f(0x1d6)](_0x3dbcfb[_0x15128f(0x1ba)][_0x15128f(0x1ae)],_0x7095fc['id']),_0x27a8c5[_0x15128f(0x167)][_0x15128f(0x22a)]({'agentName':_0x3dbcfb['yaml']['name'],'action':_0x15128f(0x1da),'agentId':_0x7095fc['id']}),_0x27a8c5[_0x15128f(0x218)][_0x15128f(0x167)][_0x15128f(0x1da)]++;}}catch(_0x4854ce){_0x27a8c5[_0x15128f(0x167)][_0x15128f(0x22a)]({'agentName':_0x3dbcfb[_0x15128f(0x1ba)]['name'],'action':_0x15128f(0x14f),'error':_0x4854ce[_0x15128f(0x16b)]}),_0x27a8c5[_0x15128f(0x218)][_0x15128f(0x167)][_0x15128f(0x14c)]++;}}for(const _0x295344 of _0x23b3d2){try{const _0x381fbe=_0x1062c7[_0x15128f(0x1fc)](_0x295344[_0x15128f(0x1ba)][_0x15128f(0x1ae)]),_0xe36fd1=await yamlPromptToApi(_0x295344[_0x15128f(0x1ba)],_0x497fda,_0x184fc0);if(!_0xe36fd1){_0x27a8c5[_0x15128f(0x1e0)][_0x15128f(0x22a)]({'name':_0x295344[_0x15128f(0x1ba)][_0x15128f(0x1ae)],'action':'error','error':_0x15128f(0x1f3)}),_0x27a8c5['counts'][_0x15128f(0x1e0)][_0x15128f(0x14c)]++;continue;}if(_0x381fbe)await this[_0x15128f(0x1f6)][_0x15128f(0x225)](_0x381fbe['id'],_0xe36fd1),_0x42df2b[_0x15128f(0x1d6)](_0x295344[_0x15128f(0x1ba)]['name'],_0x381fbe['id']),_0x27a8c5[_0x15128f(0x1e0)][_0x15128f(0x22a)]({'name':_0x295344[_0x15128f(0x1ba)][_0x15128f(0x1ae)],'action':'updated','id':_0x381fbe['id']}),_0x27a8c5[_0x15128f(0x218)][_0x15128f(0x1e0)]['updated']++;else{const _0x45c0fb=await this[_0x15128f(0x1f6)][_0x15128f(0x1fa)](_0xe36fd1);_0x42df2b[_0x15128f(0x1d6)](_0x295344[_0x15128f(0x1ba)]['name'],_0x45c0fb['id']),_0x27a8c5['prompts'][_0x15128f(0x22a)]({'name':_0x295344[_0x15128f(0x1ba)][_0x15128f(0x1ae)],'action':_0x15128f(0x1da),'id':_0x45c0fb['id']}),_0x27a8c5['counts'][_0x15128f(0x1e0)][_0x15128f(0x1da)]++;}}catch(_0x1c077e){_0x27a8c5[_0x15128f(0x1e0)][_0x15128f(0x22a)]({'name':_0x295344['yaml']['name'],'action':_0x15128f(0x14f),'error':_0x1c077e[_0x15128f(0x16b)]}),_0x27a8c5[_0x15128f(0x218)][_0x15128f(0x1e0)][_0x15128f(0x14c)]++;}}return _0x27a8c5;}async[a105_0x54707d(0x193)](_0x19ab47,_0x94e7da,_0x153b71,_0x29d2f8){const _0x5e980c=a105_0x54707d,{projectId:_0x2e3d85,project:_0x3c9545}=await this['resolveProjectName'](_0x19ab47),_0x18ba38=_0x3c9545[_0x5e980c(0x197)][_0x5e980c(0x1ae)],_0x37e1d8=await this['client'][_0x5e980c(0x232)](_0x2e3d85),_0xafb2b6=_0x37e1d8['find'](_0x253f2d=>_0x253f2d[_0x5e980c(0x197)][_0x5e980c(0x1ae)]===_0x94e7da);if(!_0xafb2b6)throw new SDKError(ErrorCode[_0x5e980c(0x1b7)],_0x5e980c(0x178)+_0x94e7da,undefined,{'helpText':'Available\x20agents:\x20'+_0x37e1d8[_0x5e980c(0x205)](_0x598142=>_0x598142['attributes'][_0x5e980c(0x1ae)])[_0x5e980c(0x20a)](',\x20')});let _0x46a9c3;if(_0x153b71)_0x46a9c3=_0x153b71;else{const _0x434875=a105_0x2abb29[_0x5e980c(0x20a)](process[_0x5e980c(0x216)](),_0x5e980c(0x167)),_0x5e9e25=getSanitizedPathWithMigration(_0x434875,_0x18ba38);_0x5e9e25['renamed']&&this[_0x5e980c(0x1ea)][_0x5e980c(0x165)]?.[_0x5e980c(0x17b)](_0x5e980c(0x194)+a105_0x2abb29[_0x5e980c(0x153)](_0x5e9e25[_0x5e980c(0x16c)])+_0x5e980c(0x1d8)+a105_0x2abb29[_0x5e980c(0x153)](_0x5e9e25[_0x5e980c(0x1d5)])),_0x46a9c3=_0x5e9e25[_0x5e980c(0x1d5)];}const _0x55bc02=getSanitizedPathWithMigration(_0x46a9c3,_0x94e7da);_0x55bc02[_0x5e980c(0x1aa)]&&this[_0x5e980c(0x1ea)]['logger']?.[_0x5e980c(0x17b)]('Renamed\x20agent\x20folder:\x20'+a105_0x2abb29[_0x5e980c(0x153)](_0x55bc02[_0x5e980c(0x16c)])+_0x5e980c(0x1d8)+a105_0x2abb29[_0x5e980c(0x153)](_0x55bc02['path']));const _0x5332d0=_0x55bc02['path'],_0x442717=new Map(),_0x5cc640=new Map(),_0x56ca04=await this[_0x5e980c(0x1f6)][_0x5e980c(0x161)](_0x2e3d85),_0x323280=await this[_0x5e980c(0x1f6)][_0x5e980c(0x20c)](_0x2e3d85),_0x5ad981=new Map();for(const _0x1dcbea of _0x56ca04){_0x442717[_0x5e980c(0x1d6)](_0x1dcbea['id'],_0x1dcbea[_0x5e980c(0x197)]['name']);}for(const _0xa3c10e of _0x323280){_0x5ad981[_0x5e980c(0x1d6)](_0xa3c10e['id'],_0xa3c10e[_0x5e980c(0x197)][_0x5e980c(0x1ae)]);}for(const _0x10fe5c of _0x37e1d8){_0x5cc640['set'](_0x10fe5c['id'],_0x10fe5c['attributes'][_0x5e980c(0x1ae)]);}const _0x482751={'resolveKnowledgeBaseName':async _0x23e17c=>_0x442717[_0x5e980c(0x1fc)](_0x23e17c),'resolveTextKnowledgeBaseName':async _0x349d19=>_0x5ad981['get'](_0x349d19),'resolveAgentName':async _0x5d9427=>_0x5cc640['get'](_0x5d9427),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async()=>undefined,'onWarning':_0x325f9a=>this[_0x5e980c(0x1ea)][_0x5e980c(0x165)]?.[_0x5e980c(0x18f)](_0x325f9a)},_0xb8b601=a105_0x2abb29[_0x5e980c(0x20a)](_0x5332d0,_0x5e980c(0x230)),_0x288f8e=a105_0x2abb29[_0x5e980c(0x20a)](_0x5332d0,'agent.yml'),_0x5b8ed7=a105_0x2abb29[_0x5e980c(0x20a)](_0x5332d0,'starter_message.md'),_0xf8adc6=!a105_0x5c029b['existsSync'](_0x288f8e);if(_0x29d2f8?.[_0x5e980c(0x22e)])return{'agentName':_0x94e7da,'outputPath':_0x5332d0,'isNew':_0xf8adc6,'hasChanges':!![]};a105_0x5c029b['mkdirSync'](_0x46a9c3,{'recursive':!![]}),a105_0x5c029b[_0x5e980c(0x190)](_0x5332d0,{'recursive':!![]});const _0xcb0783=a105_0x2abb29['join'](_0x46a9c3,'tdx.json');!a105_0x5c029b['existsSync'](_0xcb0783)&&a105_0x5c029b[_0x5e980c(0x1e6)](_0xcb0783,createAgentConfigContent(_0x19ab47));const {yaml:_0x1419c8,systemPrompt:_0x5e0bd0,starterMessage:_0x2d0c2b}=await agentResponseToDef(_0xafb2b6,_0x482751);let _0x476927=_0xf8adc6;if(!_0xf8adc6){const _0x2f00ad=a105_0x5c029b[_0x5e980c(0x19c)](_0xb8b601)?a105_0x5c029b['readFileSync'](_0xb8b601,_0x5e980c(0x174)):'',_0x4b4088=a105_0x5c029b[_0x5e980c(0x164)](_0x288f8e,_0x5e980c(0x174));_0x476927=_0x2f00ad!==_0x5e0bd0||_0x4b4088!==toAgentYamlString(_0x1419c8);}a105_0x5c029b[_0x5e980c(0x1e6)](_0xb8b601,_0x5e0bd0),a105_0x5c029b[_0x5e980c(0x1e6)](_0x288f8e,toAgentYamlString(_0x1419c8));if(_0x2d0c2b&&_0x2d0c2b['includes']('\x0a'))a105_0x5c029b['writeFileSync'](_0x5b8ed7,_0x2d0c2b);else a105_0x5c029b[_0x5e980c(0x19c)](_0x5b8ed7)&&a105_0x5c029b[_0x5e980c(0x20d)](_0x5b8ed7);return{'agentName':_0x94e7da,'outputPath':_0x5332d0,'isNew':_0xf8adc6,'hasChanges':_0x476927};}async[a105_0x54707d(0x17e)](_0xbe15ad,_0x558eb0){const _0x51472f=a105_0x54707d;let _0x86e409;isAgentYamlPath(_0xbe15ad)?_0x86e409=getAgentDirFromYamlPath(_0xbe15ad):_0x86e409=_0xbe15ad;const {config:_0x26bfb7}=findAgentConfig(_0x86e409),_0x2c5835=await this[_0x51472f(0x1c8)](_0x26bfb7[_0x51472f(0x22d)]),_0x51020c=a105_0x2abb29[_0x51472f(0x20a)](_0x86e409,_0x51472f(0x16e)),_0x592373=a105_0x2abb29[_0x51472f(0x20a)](_0x86e409,_0x51472f(0x230)),_0x25f86d=a105_0x2abb29[_0x51472f(0x20a)](_0x86e409,_0x51472f(0x186));if(!a105_0x5c029b[_0x51472f(0x19c)](_0x51020c))throw new SDKError(ErrorCode[_0x51472f(0x1f9)],_0x51472f(0x1ff)+_0x86e409,undefined,{'helpText':'Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.'});const _0x1ea1c3=parseAgentYaml(a105_0x5c029b[_0x51472f(0x164)](_0x51020c,_0x51472f(0x174)),_0x51020c),_0x365aa2=a105_0x5c029b['existsSync'](_0x592373)?a105_0x5c029b[_0x51472f(0x164)](_0x592373,'utf-8'):'',_0x37f0ce=a105_0x5c029b[_0x51472f(0x19c)](_0x25f86d)?a105_0x5c029b[_0x51472f(0x164)](_0x25f86d,_0x51472f(0x174)):_0x1ea1c3[_0x51472f(0x215)];if(_0x558eb0?.[_0x51472f(0x22e)])return{'agentName':_0x1ea1c3[_0x51472f(0x1ae)],'action':_0x51472f(0x1da),'projectId':_0x2c5835};const _0x1d80ea=await this['client'][_0x51472f(0x232)](_0x2c5835),_0x1357c5=await this[_0x51472f(0x1f6)][_0x51472f(0x161)](_0x2c5835),_0x3e667a=await this[_0x51472f(0x1f6)][_0x51472f(0x20c)](_0x2c5835),_0x15bde7=new Map(),_0x3ae97a=new Map(),_0x20be5f=new Map();for(const _0x256635 of _0x1357c5){_0x15bde7['set'](_0x256635['attributes'][_0x51472f(0x1ae)],_0x256635['id']);}for(const _0x9db51a of _0x3e667a){_0x3ae97a[_0x51472f(0x1d6)](_0x9db51a['attributes'][_0x51472f(0x1ae)],_0x9db51a['id']);}for(const _0x37e091 of _0x1d80ea){_0x20be5f[_0x51472f(0x1d6)](_0x37e091[_0x51472f(0x197)][_0x51472f(0x1ae)],_0x37e091['id']);}const _0x151ec1={'projectId':_0x2c5835,'resolveKnowledgeBaseId':async _0x18bba7=>_0x15bde7[_0x51472f(0x1fc)](_0x18bba7),'resolveTextKnowledgeBaseId':async _0x3e67b4=>_0x3ae97a[_0x51472f(0x1fc)](_0x3e67b4),'resolveAgentId':async _0x41f098=>_0x20be5f[_0x51472f(0x1fc)](_0x41f098),'resolveWebSearchToolId':async()=>undefined,'resolveImageGeneratorId':async()=>undefined,'resolvePromptId':async()=>undefined,'onWarning':_0x27f26d=>this[_0x51472f(0x1ea)][_0x51472f(0x165)]?.[_0x51472f(0x18f)](_0x27f26d)};try{const _0x43b9c8=_0x1d80ea[_0x51472f(0x231)](_0x491d01=>_0x491d01['attributes']['name']===_0x1ea1c3[_0x51472f(0x1ae)]),_0x1e159a=await agentDefToRequest(_0x1ea1c3,_0x365aa2,_0x37f0ce,_0x151ec1);if(_0x43b9c8)return await this[_0x51472f(0x1f6)][_0x51472f(0x14e)](_0x43b9c8['id'],_0x1e159a),{'agentName':_0x1ea1c3['name'],'action':_0x51472f(0x18c),'projectId':_0x2c5835,'agentId':_0x43b9c8['id']};else{const _0x4c1ed2=await this[_0x51472f(0x1f6)][_0x51472f(0x1a7)](_0x1e159a);return{'agentName':_0x1ea1c3['name'],'action':'created','projectId':_0x2c5835,'agentId':_0x4c1ed2['id']};}}catch(_0x3ff247){return{'agentName':_0x1ea1c3['name'],'action':_0x51472f(0x14f),'projectId':_0x2c5835,'error':_0x3ff247[_0x51472f(0x16b)]};}}async['cloneProject'](_0x468aa9,_0x2ba960,_0xfbde06){const _0x5dde5a=a105_0x54707d,_0x408b93=a105_0x5c029b['existsSync'](_0x468aa9)&&a105_0x5c029b[_0x5dde5a(0x19c)](a105_0x2abb29[_0x5dde5a(0x20a)](_0x468aa9,_0x5dde5a(0x1ad)));let _0x303e0a;const _0x5c5152=[],_0x1b73ac=[],_0x5b8766=[],_0x10a3d6=[];if(_0x408b93){const _0x2972d6=loadAgentConfig(a105_0x2abb29[_0x5dde5a(0x20a)](_0x468aa9,_0x5dde5a(0x1ad)));_0x303e0a=_0x2972d6[_0x5dde5a(0x22d)];const _0x3fa209=a105_0x5c029b[_0x5dde5a(0x1b6)](_0x468aa9,{'withFileTypes':!![]});for(const _0x3d22ec of _0x3fa209){if(!_0x3d22ec['isDirectory']())continue;if([_0x5dde5a(0x189),_0x5dde5a(0x1e0),_0x5dde5a(0x210)]['includes'](_0x3d22ec[_0x5dde5a(0x1ae)]))continue;const _0x594833=a105_0x2abb29[_0x5dde5a(0x20a)](_0x468aa9,_0x3d22ec[_0x5dde5a(0x1ae)]);if(isAgentDir(_0x594833)){const _0x53709d=a105_0x2abb29[_0x5dde5a(0x20a)](_0x594833,_0x5dde5a(0x16e)),_0x377e3d=a105_0x2abb29[_0x5dde5a(0x20a)](_0x594833,_0x5dde5a(0x230)),_0x3060dc=a105_0x2abb29[_0x5dde5a(0x20a)](_0x594833,_0x5dde5a(0x186)),_0x5bb1b1=parseAgentYaml(a105_0x5c029b[_0x5dde5a(0x164)](_0x53709d,_0x5dde5a(0x174)),_0x53709d),_0x5ccc8d=a105_0x5c029b[_0x5dde5a(0x19c)](_0x377e3d)?a105_0x5c029b[_0x5dde5a(0x164)](_0x377e3d,_0x5dde5a(0x174)):'',_0x589a0f=a105_0x5c029b['existsSync'](_0x3060dc)?a105_0x5c029b[_0x5dde5a(0x164)](_0x3060dc,_0x5dde5a(0x174)):_0x5bb1b1[_0x5dde5a(0x215)];_0x5c5152[_0x5dde5a(0x22a)]({'name':_0x5bb1b1['name'],'dir':_0x594833,'yaml':_0x5bb1b1,'systemPrompt':_0x5ccc8d,'starterMessage':_0x589a0f});}}const _0xc21a5a=getKnowledgeBasesDir(_0x468aa9);if(a105_0x5c029b[_0x5dde5a(0x19c)](_0xc21a5a)){const _0x48b28b=a105_0x5c029b['readdirSync'](_0xc21a5a);for(const _0x39eff5 of _0x48b28b){const _0x1b1adb=a105_0x2abb29[_0x5dde5a(0x20a)](_0xc21a5a,_0x39eff5);if(_0x39eff5[_0x5dde5a(0x179)](_0x5dde5a(0x1ee))){const _0x16e18c=parseKnowledgeBaseYaml(a105_0x5c029b['readFileSync'](_0x1b1adb,'utf-8'),_0x1b1adb);_0x1b73ac[_0x5dde5a(0x22a)]({'name':_0x16e18c[_0x5dde5a(0x1ae)],'path':_0x1b1adb,'yaml':_0x16e18c});}else{if(_0x39eff5[_0x5dde5a(0x179)](_0x5dde5a(0x201))){const _0x313c4d=a105_0x5c029b[_0x5dde5a(0x164)](_0x1b1adb,'utf-8'),{name:_0x4a48b7,text:_0x51282e}=parseTextKnowledgeBaseMd(_0x313c4d,_0x39eff5);_0x5b8766['push']({'name':_0x4a48b7,'path':_0x1b1adb,'text':_0x51282e});}}}}const _0x5ca9d1=getPromptsDir(_0x468aa9);if(a105_0x5c029b[_0x5dde5a(0x19c)](_0x5ca9d1)){const _0x19f354=a105_0x5c029b[_0x5dde5a(0x1b6)](_0x5ca9d1)['filter'](_0x4dc4c4=>_0x4dc4c4[_0x5dde5a(0x179)]('.yml'));for(const _0x4e8d08 of _0x19f354){const _0x552a37=a105_0x2abb29[_0x5dde5a(0x20a)](_0x5ca9d1,_0x4e8d08),_0x241b1d=parsePromptYaml(a105_0x5c029b[_0x5dde5a(0x164)](_0x552a37,_0x5dde5a(0x174)),_0x552a37);_0x10a3d6[_0x5dde5a(0x22a)]({'name':_0x241b1d[_0x5dde5a(0x1ae)],'path':_0x552a37,'yaml':_0x241b1d});}}}else{const _0x1b2471=await this[_0x5dde5a(0x1c8)](_0x468aa9),_0x5acc76=await this[_0x5dde5a(0x1f6)][_0x5dde5a(0x1df)](_0x1b2471);_0x303e0a=_0x5acc76[_0x5dde5a(0x197)]['name'];const _0x4bcd05=await this[_0x5dde5a(0x1f6)]['listAgentsFull'](_0x1b2471),_0x1a8870=await this[_0x5dde5a(0x1f6)]['listKnowledgeBases'](_0x1b2471),_0x236b0e=await this[_0x5dde5a(0x1f6)][_0x5dde5a(0x20c)](_0x1b2471),_0x59fd88=await this[_0x5dde5a(0x1f6)][_0x5dde5a(0x15e)](_0x1b2471),_0x536e27=new Map(),_0x228c00=new Map(),_0x15505c=new Map(),_0xe06a12=new Map();for(const _0x211d14 of _0x1a8870){_0x536e27['set'](_0x211d14['id'],_0x211d14['attributes']['name']);}for(const _0x282e95 of _0x236b0e){_0x228c00[_0x5dde5a(0x1d6)](_0x282e95['id'],_0x282e95[_0x5dde5a(0x197)][_0x5dde5a(0x1ae)]);}for(const _0x3c055a of _0x4bcd05){_0x15505c[_0x5dde5a(0x1d6)](_0x3c055a['id'],_0x3c055a[_0x5dde5a(0x197)][_0x5dde5a(0x1ae)]);}for(const _0x37a4cf of _0x59fd88){_0xe06a12['set'](_0x37a4cf['id'],_0x37a4cf['attributes']['name']);}const _0xa56bdc={'resolveKnowledgeBaseName':async _0x199c58=>_0x536e27[_0x5dde5a(0x1fc)](_0x199c58),'resolveTextKnowledgeBaseName':async _0x206572=>_0x228c00[_0x5dde5a(0x1fc)](_0x206572),'resolveAgentName':async _0x334f85=>_0x15505c['get'](_0x334f85),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async _0x5ad35d=>_0xe06a12[_0x5dde5a(0x1fc)](_0x5ad35d),'onWarning':_0x475299=>this[_0x5dde5a(0x1ea)][_0x5dde5a(0x165)]?.['warn'](_0x475299)};for(const _0x589b37 of _0x4bcd05){const _0x29d63f=await agentResponseToDef(_0x589b37,_0xa56bdc),{yaml:_0x331a2b,systemPrompt:_0x215d9a,starterMessage:_0x5916e5}=_0x29d63f;_0x5c5152[_0x5dde5a(0x22a)]({'name':_0x331a2b[_0x5dde5a(0x1ae)],'dir':'','yaml':_0x331a2b,'systemPrompt':_0x215d9a,'starterMessage':_0x5916e5});}for(const _0x22b06e of _0x1a8870){const _0x1fb531=apiKnowledgeBaseToYaml(_0x22b06e);_0x1b73ac['push']({'name':_0x1fb531['name'],'path':'','yaml':_0x1fb531});}for(const _0x408fcf of _0x236b0e){_0x5b8766[_0x5dde5a(0x22a)]({'name':_0x408fcf[_0x5dde5a(0x197)][_0x5dde5a(0x1ae)],'path':'','text':_0x408fcf['attributes']['text']});}for(const _0x17a2e7 of _0x59fd88){const _0x160a82=await apiPromptToYaml(_0x17a2e7,_0xa56bdc);_0x160a82&&_0x10a3d6['push']({'name':_0x160a82[_0x5dde5a(0x1ae)],'path':'','yaml':_0x160a82});}}const _0x4573ba={'sourceProjectName':_0x303e0a,'newProjectName':_0x2ba960,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'imageGenerators':{'created':0x0,'errors':0x0},'webSearchTools':{'created':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x434b77=await this['client'][_0x5dde5a(0x1bf)](),_0x5e53b0=_0x434b77[_0x5dde5a(0x231)](_0x1968af=>_0x1968af[_0x5dde5a(0x197)][_0x5dde5a(0x1ae)]===_0x2ba960);if(_0x5e53b0)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x5dde5a(0x1ab)+_0x2ba960+_0x5dde5a(0x20f),undefined,{'helpText':_0x5dde5a(0x209)});if(_0xfbde06?.[_0x5dde5a(0x22e)])return _0x4573ba[_0x5dde5a(0x218)][_0x5dde5a(0x167)]['created']=_0x5c5152['length'],_0x4573ba['counts']['knowledgeBases'][_0x5dde5a(0x1da)]=_0x1b73ac[_0x5dde5a(0x1c5)],_0x4573ba[_0x5dde5a(0x218)][_0x5dde5a(0x222)][_0x5dde5a(0x1da)]=_0x5b8766[_0x5dde5a(0x1c5)],_0x4573ba[_0x5dde5a(0x218)]['prompts']['created']=_0x10a3d6[_0x5dde5a(0x1c5)],_0x4573ba;const _0x2ac3a3=await this[_0x5dde5a(0x1f6)][_0x5dde5a(0x1b9)]({'name':_0x2ba960}),_0x2e8fa8=_0x2ac3a3['id'];_0x4573ba[_0x5dde5a(0x1c2)]=_0x2e8fa8;const _0x5c353f=new Map(),_0xa9196c=new Map(),_0x1d6128=new Map(),_0x102df8=new Map(),_0xc869e5=new Map(),_0x5e34d8=new Map(),_0x40385d=new Set(),_0x98a407=new Set();for(const _0x469709 of _0x5c5152){for(const _0xd427bb of _0x469709[_0x5dde5a(0x1ba)][_0x5dde5a(0x1ef)]||[]){if(_0xd427bb['type']===_0x5dde5a(0x18d)){const _0xce6121=parseRef(_0xd427bb['target']);if(_0xce6121)_0x40385d['add'](_0xce6121[_0x5dde5a(0x1ae)]);}else{if(_0xd427bb[_0x5dde5a(0x237)]===_0x5dde5a(0x1bc)){const _0x449391=parseRef(_0xd427bb[_0x5dde5a(0x1b0)]);if(_0x449391)_0x98a407[_0x5dde5a(0x213)](_0x449391[_0x5dde5a(0x1ae)]);}}}}for(const _0x1cce0e of _0x40385d){try{const _0x5b8356=await this['client'][_0x5dde5a(0x156)]({'projectId':_0x2e8fa8,'name':_0x1cce0e});_0xc869e5[_0x5dde5a(0x1d6)](_0x1cce0e,_0x5b8356['id']),_0x4573ba['imageGenerators'][_0x5dde5a(0x22a)]({'name':_0x1cce0e,'action':_0x5dde5a(0x1da),'id':_0x5b8356['id']}),_0x4573ba[_0x5dde5a(0x218)][_0x5dde5a(0x1f8)][_0x5dde5a(0x1da)]++;}catch(_0x2c8eb4){_0x4573ba[_0x5dde5a(0x1f8)]['push']({'name':_0x1cce0e,'action':_0x5dde5a(0x14f),'error':_0x2c8eb4[_0x5dde5a(0x16b)]}),_0x4573ba[_0x5dde5a(0x218)][_0x5dde5a(0x1f8)]['errors']++;}}for(const _0x24b443 of _0x98a407){try{const _0x23032a=await this['client'][_0x5dde5a(0x158)]({'projectId':_0x2e8fa8,'name':_0x24b443});_0x5e34d8[_0x5dde5a(0x1d6)](_0x24b443,_0x23032a['id']),_0x4573ba[_0x5dde5a(0x169)][_0x5dde5a(0x22a)]({'name':_0x24b443,'action':_0x5dde5a(0x1da),'id':_0x23032a['id']}),_0x4573ba[_0x5dde5a(0x218)][_0x5dde5a(0x169)]['created']++;}catch(_0x126349){_0x4573ba[_0x5dde5a(0x169)]['push']({'name':_0x24b443,'action':_0x5dde5a(0x14f),'error':_0x126349[_0x5dde5a(0x16b)]}),_0x4573ba['counts']['webSearchTools'][_0x5dde5a(0x14c)]++;}}const _0x2f1958={'projectId':_0x2e8fa8,'resolveKnowledgeBaseId':async _0x4024c7=>_0x5c353f[_0x5dde5a(0x1fc)](_0x4024c7),'resolveTextKnowledgeBaseId':async _0x4d9a58=>_0xa9196c['get'](_0x4d9a58),'resolveAgentId':async _0x41fa68=>_0x1d6128['get'](_0x41fa68),'resolveWebSearchToolId':async _0x26c28a=>_0x5e34d8[_0x5dde5a(0x1fc)](_0x26c28a),'resolveImageGeneratorId':async _0x30d7a3=>_0xc869e5[_0x5dde5a(0x1fc)](_0x30d7a3),'resolvePromptId':async _0x4134ba=>_0x102df8[_0x5dde5a(0x1fc)](_0x4134ba),'onWarning':_0x21a71f=>this['context']['logger']?.[_0x5dde5a(0x18f)](_0x21a71f)};for(const _0x4343a4 of _0x1b73ac){try{const _0x1c40be=yamlKnowledgeBaseToApi(_0x4343a4['yaml'],_0x2e8fa8),_0x5f16b2=await this[_0x5dde5a(0x1f6)]['createKnowledgeBase'](_0x1c40be);_0x5c353f[_0x5dde5a(0x1d6)](_0x4343a4[_0x5dde5a(0x1ba)][_0x5dde5a(0x1ae)],_0x5f16b2['id']),_0x4573ba[_0x5dde5a(0x1cc)]['push']({'name':_0x4343a4['yaml'][_0x5dde5a(0x1ae)],'action':_0x5dde5a(0x1da),'id':_0x5f16b2['id']}),_0x4573ba[_0x5dde5a(0x218)][_0x5dde5a(0x1cc)][_0x5dde5a(0x1da)]++;}catch(_0x4d0256){_0x4573ba[_0x5dde5a(0x1cc)][_0x5dde5a(0x22a)]({'name':_0x4343a4[_0x5dde5a(0x1ba)][_0x5dde5a(0x1ae)],'action':_0x5dde5a(0x14f),'error':_0x4d0256[_0x5dde5a(0x16b)]}),_0x4573ba[_0x5dde5a(0x218)][_0x5dde5a(0x1cc)][_0x5dde5a(0x14c)]++;}}for(const _0x8b3c91 of _0x5b8766){try{const _0x186fc8=yamlTextKnowledgeBaseToApi({'name':_0x8b3c91[_0x5dde5a(0x1ae)],'text':_0x8b3c91['text']},_0x2e8fa8),_0x5005cc=await this[_0x5dde5a(0x1f6)][_0x5dde5a(0x1d7)](_0x186fc8);_0xa9196c[_0x5dde5a(0x1d6)](_0x8b3c91[_0x5dde5a(0x1ae)],_0x5005cc['id']),_0x4573ba[_0x5dde5a(0x222)][_0x5dde5a(0x22a)]({'name':_0x8b3c91['name'],'action':_0x5dde5a(0x1da),'id':_0x5005cc['id']}),_0x4573ba['counts'][_0x5dde5a(0x222)]['created']++;}catch(_0x2266e4){_0x4573ba[_0x5dde5a(0x222)][_0x5dde5a(0x22a)]({'name':_0x8b3c91[_0x5dde5a(0x1ae)],'action':_0x5dde5a(0x14f),'error':_0x2266e4[_0x5dde5a(0x16b)]}),_0x4573ba[_0x5dde5a(0x218)][_0x5dde5a(0x222)][_0x5dde5a(0x14c)]++;}}const _0x431397=[..._0x5c5152]['sort']((_0x2d76c0,_0x18e23e)=>{const _0x396a16=_0x5dde5a,_0x2faf63=_0x2d76c0['yaml'][_0x396a16(0x1ef)]?.['some'](_0x1a07f4=>_0x1a07f4['type']==='agent')??![],_0x516485=_0x18e23e[_0x396a16(0x1ba)][_0x396a16(0x1ef)]?.[_0x396a16(0x162)](_0x26d09f=>_0x26d09f['type']===_0x396a16(0x18b))??![];if(_0x2faf63&&!_0x516485)return 0x1;if(!_0x2faf63&&_0x516485)return-0x1;return 0x0;});for(const _0x2d77ae of _0x431397){try{const _0x3f0740=_0x2d77ae[_0x5dde5a(0x1ba)][_0x5dde5a(0x1ef)]?.[_0x5dde5a(0x18a)](_0x1afd4a=>{const _0x5276bd=_0x5dde5a;if(_0x1afd4a[_0x5276bd(0x237)]==='agent'){const _0x298c82=parseRef(_0x1afd4a['target']);return _0x298c82?.[_0x5276bd(0x1ae)]===_0x2d77ae['yaml'][_0x5276bd(0x1ae)];}return![];})??[];_0x3f0740[_0x5dde5a(0x1c5)]>0x0&&this[_0x5dde5a(0x1ea)]['logger']?.[_0x5dde5a(0x18f)]('Agent\x20\x27'+_0x2d77ae['yaml'][_0x5dde5a(0x1ae)]+_0x5dde5a(0x19b)+_0x5dde5a(0x1f1));const _0x1a4a71=await agentDefToRequest(_0x2d77ae['yaml'],_0x2d77ae['systemPrompt'],_0x2d77ae['starterMessage'],_0x2f1958),_0x2f80e0=await this[_0x5dde5a(0x1f6)][_0x5dde5a(0x1a7)](_0x1a4a71);_0x1d6128[_0x5dde5a(0x1d6)](_0x2d77ae[_0x5dde5a(0x1ba)][_0x5dde5a(0x1ae)],_0x2f80e0['id']),_0x4573ba[_0x5dde5a(0x167)][_0x5dde5a(0x22a)]({'agentName':_0x2d77ae[_0x5dde5a(0x1ba)][_0x5dde5a(0x1ae)],'action':_0x5dde5a(0x1da),'agentId':_0x2f80e0['id']}),_0x4573ba[_0x5dde5a(0x218)][_0x5dde5a(0x167)][_0x5dde5a(0x1da)]++;}catch(_0x18a97c){_0x4573ba[_0x5dde5a(0x167)][_0x5dde5a(0x22a)]({'agentName':_0x2d77ae[_0x5dde5a(0x1ba)][_0x5dde5a(0x1ae)],'action':'error','error':_0x18a97c[_0x5dde5a(0x16b)]}),_0x4573ba[_0x5dde5a(0x218)][_0x5dde5a(0x167)][_0x5dde5a(0x14c)]++;}}for(const _0x1b2a13 of _0x10a3d6){try{const _0x112eb1=await yamlPromptToApi(_0x1b2a13[_0x5dde5a(0x1ba)],_0x2e8fa8,_0x2f1958);if(!_0x112eb1){_0x4573ba[_0x5dde5a(0x1e0)][_0x5dde5a(0x22a)]({'name':_0x1b2a13[_0x5dde5a(0x1ba)][_0x5dde5a(0x1ae)],'action':_0x5dde5a(0x14f),'error':_0x5dde5a(0x1f3)}),_0x4573ba[_0x5dde5a(0x218)][_0x5dde5a(0x1e0)][_0x5dde5a(0x14c)]++;continue;}const _0x29ee2d=await this[_0x5dde5a(0x1f6)][_0x5dde5a(0x1fa)](_0x112eb1);_0x102df8[_0x5dde5a(0x1d6)](_0x1b2a13[_0x5dde5a(0x1ba)][_0x5dde5a(0x1ae)],_0x29ee2d['id']),_0x4573ba['prompts'][_0x5dde5a(0x22a)]({'name':_0x1b2a13[_0x5dde5a(0x1ba)][_0x5dde5a(0x1ae)],'action':_0x5dde5a(0x1da),'id':_0x29ee2d['id']}),_0x4573ba[_0x5dde5a(0x218)][_0x5dde5a(0x1e0)][_0x5dde5a(0x1da)]++;}catch(_0x339e2f){_0x4573ba[_0x5dde5a(0x1e0)][_0x5dde5a(0x22a)]({'name':_0x1b2a13[_0x5dde5a(0x1ba)][_0x5dde5a(0x1ae)],'action':_0x5dde5a(0x14f),'error':_0x339e2f[_0x5dde5a(0x16b)]}),_0x4573ba[_0x5dde5a(0x218)][_0x5dde5a(0x1e0)][_0x5dde5a(0x14c)]++;}}return _0x4573ba;}}
1
+ const a105_0x561b8e=a105_0x5408;(function(_0x369ee6,_0x2eb0f3){const _0x4fa516=a105_0x5408,_0x1e560f=_0x369ee6();while(!![]){try{const _0x5eb349=parseInt(_0x4fa516(0x1fa))/0x1+parseInt(_0x4fa516(0x1e8))/0x2+parseInt(_0x4fa516(0x22a))/0x3+parseInt(_0x4fa516(0x230))/0x4*(-parseInt(_0x4fa516(0x20d))/0x5)+-parseInt(_0x4fa516(0x1e7))/0x6+parseInt(_0x4fa516(0x1f0))/0x7+-parseInt(_0x4fa516(0x1a1))/0x8;if(_0x5eb349===_0x2eb0f3)break;else _0x1e560f['push'](_0x1e560f['shift']());}catch(_0x4e4cc7){_0x1e560f['push'](_0x1e560f['shift']());}}}(a105_0x4859,0xd4566));import{LLMApiClient}from'../client/llm-api-client.js';import*as a105_0x18dc27 from'node:fs';function a105_0x4859(){const _0x259850=['1038724ypzndU','backupProject','setDefaultAgent','has','setCurrentProject','info','llm_project','toISOString','pullProject','resolveAgentId','push','continueChat','cwd','path','getAgent','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','add','client','oldPath','message','listImageGenerators','createPrompt','\x20→\x20','agent.yml','agent.yml\x20not\x20found\x20in\x20','error','created','Multiple\x20agents\x20found\x20with\x20name\x20\x27','AGENT_NOT_FOUND','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','errors','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','createKnowledgeBase','listAgentsFull','metadata','listKnowledgeBases','textKnowledgeBases','tdx.json','currentProjectId','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','updateAgent','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','already\x20exists','clearDefaultAgent','utf-8','web_search','getBackupMetadata','getUserSettings','agentId','stringify','includes','Project\x20not\x20found:\x20','dryRun','target','action','createImageGenerator','Renamed\x20prompt\x20file:\x20','getDefaultProjectName','\x20attempts\x20due\x20to\x20name\x20conflicts.','listWebSearchTools','site','resolveProjectId','variables','history','version','prompts','length','profile','high','starter_message','yaml','\x0a\x0a#\x20agent.yml\x0a','listAgents','createProject','Agent\x20not\x20found:\x20','knowledgebases.json','resolveProjectName','PERMISSION_DENIED','systemPrompt','image_gen','getOrCreateDefaultProject','duplicate','starter_message.md','knowledgeBases','serviceType','5804128IiUkCb','LLM_PROJECT_NOT_FOUND','createAgentResponse','project.json','listTextKnowledgeBases','isManaged','writeFileSync','renamed','newProjectId','new','Unable\x20to\x20create\x20project\x20after\x20','reasoningEffort','unchanged','createTextKnowledgeBase','webSearchTools','availableModelNames','isDirectory','pushAgent','models','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','agents','get','tools','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','conflict','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','Renamed\x20folder:\x20','getCurrentProject','mkdirSync','Renamed\x20agent\x20folder:\x20','text','map','getProject','updateAgentResponse','Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.','listPrompts','getOrCreateDefaultAgent','listProjects','agents.json','filter','Project\x20\x22','webhookCorsOrigins','listIntegrations','agent','createWebSearchTool','context','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','parse','knowledge_bases','UNAUTHENTICATED','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','chatInfo','INTERNAL','#\x20prompt.md\x0a','displayName','prompt.md','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','find','deleteAgent','counts','updateTextKnowledgeBase','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','integrations.json','projects','\x22\x20already\x20exists','unlinkSync','name','prompts.json','type','set','5083950CMijBP','637616MTACTc','Multiple\x20projects\x20found\x20with\x20name\x20\x27','imageGenerators','modelType','availableModels','some','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','tdx_default_','6422598QajZBC','exportedFrom','none','.yml','NOT_FOUND','ALREADY_EXISTS','1.0','endsWith','startChat','description','540998FUbkRX','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','Invalid\x20agent\x20reference\x20format:\x20','.md','chatWelcomeMessage','_reasoning_','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','promptId','getChatHistory','logger','updated','dry-run-','getDefaultAgent','sort','readdirSync','starterMessage','loadJsonFile','pushProject','size','20IQWosL','dirname','tdx_','low','content','readFileSync','signal','split','existsSync','chatIgnoreManagedActions','projectName','warn','Backup\x20folder\x20not\x20found:\x20','dir','tdDatabaseName','No\x20tdx.json\x20found\x20in\x20','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','Agent\x20\x27','basename','deleteProject','claude-4.5-sonnet','Renamed\x20KB\x20file:\x20','listChats','createAgent','Renamed\x20text\x20KB\x20file:\x20','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','total','jsonSchemaHint','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','5111937zrEmwz','INVALID_ARGUMENT','keys','Agent\x20reference\x20not\x20found','join','attributes'];a105_0x4859=function(){return _0x259850;};return a105_0x4859();}import*as a105_0x39fc19 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlPromptToApi,resolveAgentDependencies}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';function a105_0x5408(_0x2b794f,_0x5ee225){_0x2b794f=_0x2b794f-0x173;const _0x485974=a105_0x4859();let _0x540878=_0x485974[_0x2b794f];return _0x540878;}import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';export class LLMSDK{[a105_0x561b8e(0x256)];[a105_0x561b8e(0x241)];['context'];constructor(_0xe6d31){const _0x58b304=a105_0x561b8e;this[_0x58b304(0x241)]=new LLMApiClient(_0xe6d31,_0xe6d31['logger']),this[_0x58b304(0x1ce)]=_0xe6d31;}[a105_0x561b8e(0x185)](){const _0x37231d=a105_0x561b8e,_0x59469a=getSanitizedUsername();return _0x37231d(0x1ef)+_0x59469a;}async[a105_0x561b8e(0x234)](_0x47c9f5){const _0x1c5088=a105_0x561b8e,{projectId:_0x23163f}=await this[_0x1c5088(0x198)](_0x47c9f5);this[_0x1c5088(0x256)]=_0x23163f;}[a105_0x561b8e(0x1bc)](){const _0x40f839=a105_0x561b8e;return this[_0x40f839(0x256)];}async[a105_0x561b8e(0x232)](_0x52f00a){const _0x4be371=a105_0x561b8e,_0x482beb=this['context']['profile'];let _0x4687b8,_0x580ebe;if(_0x52f00a[_0x4be371(0x17e)]('/')){const _0x1cbb78=_0x52f00a[_0x4be371(0x214)]('/');if(_0x1cbb78['length']!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4be371(0x1fc)+_0x52f00a,undefined,{'helpText':_0x4be371(0x175)});const [_0x3ee259,_0x27dc97]=_0x1cbb78;_0x4687b8=await this[_0x4be371(0x189)](_0x3ee259),_0x580ebe=_0x27dc97;}else _0x4687b8=this[_0x4be371(0x256)]||(await this[_0x4be371(0x19c)]())['id'],_0x580ebe=_0x52f00a;const _0x5e020e=await this['resolveAgentId'](_0x580ebe,_0x4687b8),_0x13f5d4=await this['client'][_0x4be371(0x23e)](_0x5e020e);writeCachedLLMAgent(_0x13f5d4[_0x4be371(0x22f)][_0x4be371(0x1e3)],_0x5e020e,_0x4687b8,_0x482beb);}[a105_0x561b8e(0x206)](){const _0x253e9b=a105_0x561b8e,_0x45d45a=this['context'][_0x253e9b(0x18f)];return readCachedLLMAgent(_0x45d45a)||undefined;}[a105_0x561b8e(0x177)](){const _0x12c492=a105_0x561b8e,_0x5a2ef3=this[_0x12c492(0x1ce)][_0x12c492(0x18f)];clearCachedLLMAgent(_0x5a2ef3);}async[a105_0x561b8e(0x1b3)](){const _0x286a86=a105_0x561b8e,_0x463efb=await this[_0x286a86(0x241)][_0x286a86(0x17b)](),_0x5a95b6=[];for(const _0x501ede of _0x463efb[_0x286a86(0x1b0)]){const _0x325fca=_0x463efb[_0x286a86(0x1ec)][_0x501ede];_0x325fca&&_0x5a95b6[_0x286a86(0x23a)]({'name':_0x501ede,'displayName':_0x325fca[_0x286a86(0x1d7)]});}return _0x5a95b6;}async[a105_0x561b8e(0x195)](_0x1521fc){const _0x4d5048=a105_0x561b8e;return await this[_0x4d5048(0x241)][_0x4d5048(0x195)](_0x1521fc);}async[a105_0x561b8e(0x220)](_0x2059c4){const _0x5bccb1=a105_0x561b8e,{projectId:_0x564c67}=await this[_0x5bccb1(0x198)](_0x2059c4);await this[_0x5bccb1(0x241)][_0x5bccb1(0x220)](_0x564c67);}async[a105_0x561b8e(0x1e0)](_0x43ecb4=0x32){const _0x485004=a105_0x561b8e;return await this[_0x485004(0x241)][_0x485004(0x1c6)](_0x43ecb4);}async[a105_0x561b8e(0x19c)](_0xce7464){const _0x340aac=a105_0x561b8e,_0x48878a=_0xce7464||this[_0x340aac(0x185)](),_0x79ba38=this[_0x340aac(0x1ce)][_0x340aac(0x18f)];if(!_0xce7464){const _0x3868cb=readCachedLLMProject(_0x79ba38);if(_0x3868cb&&_0x3868cb[_0x340aac(0x1e3)]===_0x48878a)try{const _0x480f56=await this[_0x340aac(0x241)][_0x340aac(0x1c1)](_0x3868cb['id']);if(_0x480f56[_0x340aac(0x22f)]['name']===_0x48878a)return _0x480f56;}catch{}}const _0x505fc7=await this[_0x340aac(0x241)][_0x340aac(0x1c6)](),_0x172fbb=_0x505fc7[_0x340aac(0x1da)](_0x20a189=>_0x20a189[_0x340aac(0x22f)][_0x340aac(0x1e3)]===_0x48878a);if(_0x172fbb)return!_0xce7464&&writeCachedLLMProject(_0x48878a,_0x172fbb['id'],_0x79ba38),_0x172fbb;const _0x1a5acb=await this[_0x340aac(0x241)][_0x340aac(0x195)]({'name':_0x48878a,'description':_0x340aac(0x1de)+getSanitizedUsername()+')'});return!_0xce7464&&writeCachedLLMProject(_0x48878a,_0x1a5acb['id'],_0x79ba38),_0x1a5acb;}async[a105_0x561b8e(0x189)](_0x560e5a){const _0xa613f8=a105_0x561b8e,_0x29fb13=await this[_0xa613f8(0x241)][_0xa613f8(0x1c6)](),_0x47d0e6=_0x29fb13[_0xa613f8(0x1c8)](_0x3daf37=>_0x3daf37['attributes'][_0xa613f8(0x1e3)]===_0x560e5a);if(_0x47d0e6[_0xa613f8(0x18e)]===0x0)throw new SDKError(ErrorCode[_0xa613f8(0x1a2)],_0xa613f8(0x17f)+_0x560e5a,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x47d0e6['length']>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0xa613f8(0x1e9)+_0x560e5a+'\x27.\x20This\x20should\x20not\x20happen.');return _0x47d0e6[0x0]['id'];}async[a105_0x561b8e(0x198)](_0x17ef76){const _0xd47a6b=a105_0x561b8e,_0x262f69=await this[_0xd47a6b(0x241)][_0xd47a6b(0x1c6)](),_0x599eee=_0x262f69['find'](_0x173438=>_0x173438[_0xd47a6b(0x22f)][_0xd47a6b(0x1e3)]===_0x17ef76);if(_0x599eee)return{'projectId':_0x599eee['id'],'project':_0x599eee};throw new SDKError(ErrorCode[_0xd47a6b(0x1a2)],_0xd47a6b(0x17f)+_0x17ef76,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async[a105_0x561b8e(0x1c5)](_0x4a0d63=a105_0x561b8e(0x221),_0x137c68=0x0,_0x5c5650){const _0x5e6f64=a105_0x561b8e,_0x34608a=0xa;let _0x368f75=0x0,_0x40f6dc;while(_0x368f75<_0x34608a){try{const _0x153f22=await this[_0x5e6f64(0x19c)](_0x40f6dc),_0x478ece=_0x153f22['id'],_0x363f81=[_0x5e6f64(0x1f2),'minimal',_0x5e6f64(0x210),'medium',_0x5e6f64(0x190)],_0x30eb96=_0x137c68===0x0?_0x5e6f64(0x20f)+_0x4a0d63:_0x5e6f64(0x20f)+_0x4a0d63+_0x5e6f64(0x1ff)+_0x363f81[_0x137c68],_0x34d697=await this[_0x5e6f64(0x241)]['listAgents'](_0x478ece),_0xa2eac6=_0x34d697[_0x5e6f64(0x1da)](_0xf38ac8=>_0xf38ac8[_0x5e6f64(0x22f)][_0x5e6f64(0x1e3)]===_0x30eb96);if(_0xa2eac6)return _0xa2eac6;const _0x32e152=_0x137c68>0x0?0x1:_0x5c5650;return await this[_0x5e6f64(0x241)]['createAgent']({'name':_0x30eb96,'projectId':_0x478ece,'modelType':_0x4a0d63,'systemPrompt':'','temperature':_0x32e152,'reasoningEffort':_0x137c68>0x0?_0x137c68:undefined});}catch(_0x2c0a7f){if(_0x2c0a7f instanceof HTTPClientError){const _0x553e78=_0x2c0a7f['status'];if(_0x553e78>=0x190&&_0x553e78<0x1f4){if(_0x553e78===0x191)throw new SDKError(ErrorCode[_0x5e6f64(0x1d2)],_0x5e6f64(0x1ba),_0x2c0a7f);else{if(_0x553e78===0x193)throw new SDKError(ErrorCode[_0x5e6f64(0x199)],_0x5e6f64(0x173),_0x2c0a7f);}throw _0x2c0a7f;}}if(errorContains(_0x2c0a7f,_0x5e6f64(0x176),_0x5e6f64(0x19d),_0x5e6f64(0x1b9))){_0x368f75++;if(_0x368f75>=_0x34608a)throw new SDKError(ErrorCode[_0x5e6f64(0x1f5)],_0x5e6f64(0x1ab)+_0x34608a+_0x5e6f64(0x186),_0x2c0a7f);const _0x20125f=this[_0x5e6f64(0x185)]();_0x40f6dc=_0x20125f+'_'+generateRandomHex();continue;}throw _0x2c0a7f;}}throw new SDKError(ErrorCode[_0x5e6f64(0x1d5)],'Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts');}async[a105_0x561b8e(0x239)](_0x5ad680,_0x89d727){const _0x1a09af=a105_0x561b8e,_0x26b691=_0x89d727||this['currentProjectId'],_0x542fc4=await this[_0x1a09af(0x241)][_0x1a09af(0x194)](_0x26b691),_0x3f8ba3=_0x542fc4[_0x1a09af(0x1c8)](_0x4d0b04=>_0x4d0b04[_0x1a09af(0x22f)][_0x1a09af(0x1e3)]===_0x5ad680);if(_0x3f8ba3['length']===0x0){const _0x5929ce=_0x26b691?'\x20in\x20project\x20'+_0x26b691:'';throw new SDKError(ErrorCode[_0x1a09af(0x24c)],_0x1a09af(0x196)+_0x5ad680+_0x5929ce,undefined,{'helpText':_0x26b691?_0x1a09af(0x1b4):_0x1a09af(0x1c3)});}if(_0x3f8ba3['length']>0x1)throw new SDKError(ErrorCode[_0x1a09af(0x1d5)],_0x1a09af(0x24b)+_0x5ad680+'\x27.\x20This\x20should\x20not\x20happen.');return _0x3f8ba3[0x0]['id'];}async[a105_0x561b8e(0x1b5)](_0xd69436){const _0x538d5f=a105_0x561b8e,_0x37942c=_0xd69436||this['currentProjectId'];return await this[_0x538d5f(0x241)][_0x538d5f(0x194)](_0x37942c);}async['agentsFull'](_0x57d812){const _0x25ee6f=a105_0x561b8e;return await this[_0x25ee6f(0x241)][_0x25ee6f(0x251)](_0x57d812);}async[a105_0x561b8e(0x1cc)](_0x169da6){const _0x3038cc=a105_0x561b8e;return await this[_0x3038cc(0x241)][_0x3038cc(0x23e)](_0x169da6);}async[a105_0x561b8e(0x224)](_0x317937){return await this['client']['createAgent'](_0x317937);}async[a105_0x561b8e(0x174)](_0x4ad3cc,_0x3908d5){const _0x49dac3=a105_0x561b8e;return await this[_0x49dac3(0x241)][_0x49dac3(0x174)](_0x4ad3cc,_0x3908d5);}async[a105_0x561b8e(0x1db)](_0xb51e1e){const _0x255a74=a105_0x561b8e;await this[_0x255a74(0x241)][_0x255a74(0x1db)](_0xb51e1e);}async[a105_0x561b8e(0x1f8)](_0x5b4efb){const _0x425a7d=a105_0x561b8e;return await this['client'][_0x425a7d(0x1f8)]({'agentId':_0x5b4efb});}async*['chat'](_0x406309,_0x1fcf3a){const _0x212978=a105_0x561b8e;let _0x54ac88=_0x1fcf3a?.['chatId'];const _0xe0d628=_0x1fcf3a?.[_0x212978(0x17c)];if(!_0x54ac88){if(!_0xe0d628)throw new Error(_0x212978(0x23f));const _0x5e1772=await this[_0x212978(0x241)]['startChat']({'agentId':_0xe0d628});_0x54ac88=_0x5e1772['id'],yield{'type':_0x212978(0x252),'data':{'chatId':_0x54ac88,'agentId':_0xe0d628}};}for await(const _0x3a9d8d of this[_0x212978(0x241)][_0x212978(0x23b)](_0x54ac88,_0x406309,_0x1fcf3a?.[_0x212978(0x213)])){yield{'type':'event','data':_0x3a9d8d};}}async['chats'](_0x18ca67=0x32){const _0x43d38b=a105_0x561b8e;return await this[_0x43d38b(0x241)][_0x43d38b(0x223)](_0x18ca67);}async[a105_0x561b8e(0x18b)](_0x3b3f42){const _0x70c47e=a105_0x561b8e;return await this[_0x70c47e(0x241)][_0x70c47e(0x202)](_0x3b3f42);}async[a105_0x561b8e(0x1d4)](_0x2e1cc5){const _0x37e3e7=a105_0x561b8e;return await this[_0x37e3e7(0x241)]['getChatInfo'](_0x2e1cc5);}async[a105_0x561b8e(0x231)](_0x1aaf3b,_0x705b6e,_0x41d3db){const _0xcd4040=a105_0x561b8e,_0x3172f6=_0x41d3db?.[_0xcd4040(0x180)]??![],{projectId:_0x5884fa,project:_0x20445e}=await this['resolveProjectName'](_0x1aaf3b),_0x54bf15=_0x20445e[_0xcd4040(0x22f)][_0xcd4040(0x1e3)],_0x4f5165=_0x705b6e||_0x54bf15+'.llm';if(a105_0x18dc27[_0xcd4040(0x215)](_0x4f5165)&&!_0x3172f6)throw new SDKError(ErrorCode['ALREADY_EXISTS'],'Output\x20directory\x20already\x20exists:\x20'+_0x4f5165,undefined,{'helpText':'Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.'});const _0x2391fb=await this[_0xcd4040(0x241)][_0xcd4040(0x251)](_0x5884fa),_0x50864a=await this[_0xcd4040(0x241)][_0xcd4040(0x253)](_0x5884fa),_0x417c38=await this[_0xcd4040(0x241)][_0xcd4040(0x1c4)](_0x5884fa),_0x4fbd10=await this[_0xcd4040(0x241)][_0xcd4040(0x1cb)](_0x5884fa);if(!_0x3172f6){a105_0x18dc27[_0xcd4040(0x1bd)](_0x4f5165,{'recursive':!![]});const _0x5de223={'version':_0xcd4040(0x1f6),'exportedAt':new Date()[_0xcd4040(0x237)](),'exportedFrom':{'site':this[_0xcd4040(0x1ce)][_0xcd4040(0x188)],'projectId':_0x5884fa,'projectName':_0x54bf15},'project':_0x20445e};a105_0x18dc27[_0xcd4040(0x1a7)](a105_0x39fc19['join'](_0x4f5165,_0xcd4040(0x1a4)),JSON[_0xcd4040(0x17d)](_0x5de223,null,0x2)),a105_0x18dc27['writeFileSync'](a105_0x39fc19[_0xcd4040(0x22e)](_0x4f5165,_0xcd4040(0x1c7)),JSON[_0xcd4040(0x17d)](_0x2391fb,null,0x2)),a105_0x18dc27[_0xcd4040(0x1a7)](a105_0x39fc19[_0xcd4040(0x22e)](_0x4f5165,_0xcd4040(0x197)),JSON['stringify'](_0x50864a,null,0x2)),a105_0x18dc27[_0xcd4040(0x1a7)](a105_0x39fc19['join'](_0x4f5165,_0xcd4040(0x1e4)),JSON[_0xcd4040(0x17d)](_0x417c38,null,0x2)),a105_0x18dc27[_0xcd4040(0x1a7)](a105_0x39fc19[_0xcd4040(0x22e)](_0x4f5165,_0xcd4040(0x1df)),JSON[_0xcd4040(0x17d)](_0x4fbd10,null,0x2));}return{'projectName':_0x54bf15,'outputDir':_0x4f5165,'counts':{'agents':_0x2391fb[_0xcd4040(0x18e)],'knowledgeBases':_0x50864a['length'],'prompts':_0x417c38[_0xcd4040(0x18e)],'integrations':_0x4fbd10['length']}};}async['restoreProject'](_0x34a541,_0x37ef32){const _0x337666=a105_0x561b8e,_0x1cd283=_0x37ef32?.[_0x337666(0x180)]??![],_0xc525b0=this[_0x337666(0x17a)](_0x34a541),_0x435b36=_0xc525b0['exportedFrom'][_0x337666(0x188)],_0x23f065=this[_0x337666(0x1ce)][_0x337666(0x188)],_0x2e450a=_0x435b36!==_0x23f065?_0x435b36:undefined,_0xa4a433=this[_0x337666(0x20a)](a105_0x39fc19[_0x337666(0x22e)](_0x34a541,_0x337666(0x1c7)),[]),_0x359b6c=this['loadJsonFile'](a105_0x39fc19[_0x337666(0x22e)](_0x34a541,_0x337666(0x197)),[]),_0x458860=this[_0x337666(0x20a)](a105_0x39fc19[_0x337666(0x22e)](_0x34a541,_0x337666(0x1e4)),[]),_0x3a3b14=this[_0x337666(0x20a)](a105_0x39fc19[_0x337666(0x22e)](_0x34a541,'integrations.json'),[]),_0x1171bc=_0x37ef32?.[_0x337666(0x1e3)]||_0xc525b0[_0x337666(0x1f1)][_0x337666(0x217)];if(_0x1cd283){const _0x23de1c=new Map(),_0x5cc498=[..._0xa4a433],_0x48819f=_0xa4a433[_0x337666(0x18e)]+0x1;let _0x1e2cf2=0x0;while(_0x5cc498[_0x337666(0x18e)]>0x0&&_0x1e2cf2<_0x48819f){_0x1e2cf2++;const _0x817e68=[];for(const _0x3ab637 of _0x5cc498){canCreateAgent(_0x3ab637,_0x23de1c)?_0x23de1c[_0x337666(0x1e6)](_0x3ab637['id'],_0x337666(0x205)+_0x3ab637['id']):_0x817e68[_0x337666(0x23a)](_0x3ab637);}if(_0x817e68['length']===_0x5cc498[_0x337666(0x18e)])throw new SDKError(ErrorCode[_0x337666(0x1d5)],_0x337666(0x1fb),undefined,{'helpText':_0x337666(0x24d)});_0x5cc498[_0x337666(0x18e)]=0x0,_0x5cc498[_0x337666(0x23a)](..._0x817e68);}const _0x36d0d8=_0x458860[_0x337666(0x1c8)](_0x59ce81=>_0x23de1c[_0x337666(0x233)](_0x59ce81[_0x337666(0x22f)]['agentId']))['length'];return{'projectName':_0x1171bc,'projectId':'(dry-run)','counts':{'agents':_0xa4a433[_0x337666(0x18e)],'knowledgeBases':_0x359b6c[_0x337666(0x18e)],'prompts':_0x36d0d8,'integrations':_0x3a3b14[_0x337666(0x18e)]},'sourceSite':_0x2e450a};}const _0x5477bc=await this[_0x337666(0x241)][_0x337666(0x195)]({'name':_0x1171bc,'description':_0xc525b0['project'][_0x337666(0x22f)][_0x337666(0x1f9)]}),_0x2fcedc=_0x5477bc['id'],_0x3e625b=new Map(),_0x927285=new Map(),_0x38609a=new Map();for(const _0x16a891 of _0x359b6c){const _0x3d8336=await this[_0x337666(0x241)][_0x337666(0x250)]({'projectId':_0x2fcedc,'name':_0x16a891[_0x337666(0x22f)]['name'],'tdDatabaseName':_0x16a891['attributes'][_0x337666(0x21b)],'tables':_0x16a891['attributes']['tables']});_0x3e625b[_0x337666(0x1e6)](_0x16a891['id'],_0x3d8336['id']);}const _0xcc7f33=[..._0xa4a433],_0x316ca1=_0xa4a433[_0x337666(0x18e)]+0x1;let _0x5425b4=0x0;while(_0xcc7f33['length']>0x0&&_0x5425b4<_0x316ca1){_0x5425b4++;const _0xe37444=[];for(const _0x1bceb7 of _0xcc7f33){if(canCreateAgent(_0x1bceb7,_0x927285)){const _0x13d35b=remapToolIds(_0x1bceb7[_0x337666(0x22f)]['tools'],_0x3e625b,_0x927285),_0x567f99=remapVariableIds(_0x1bceb7['attributes'][_0x337666(0x18a)],_0x3e625b),_0x37fa10=await this['client']['createAgentResponse']({'name':_0x1bceb7['attributes'][_0x337666(0x1e3)],'projectId':_0x2fcedc,'systemPrompt':_0x1bceb7[_0x337666(0x22f)][_0x337666(0x19a)],'starterMessage':_0x1bceb7[_0x337666(0x22f)][_0x337666(0x209)],'modelType':migrateModelType(_0x1bceb7[_0x337666(0x22f)][_0x337666(0x1eb)]),'maxToolIterations':_0x1bceb7[_0x337666(0x22f)]['maxToolIterations'],'temperature':_0x1bceb7[_0x337666(0x22f)]['temperature'],'reasoningEffort':_0x1bceb7[_0x337666(0x22f)][_0x337666(0x1ac)],'outputs':_0x1bceb7[_0x337666(0x22f)]['outputs'],'tools':_0x13d35b,'variables':_0x567f99});_0x927285[_0x337666(0x1e6)](_0x1bceb7['id'],_0x37fa10['id']);}else _0xe37444[_0x337666(0x23a)](_0x1bceb7);}if(_0xe37444['length']===_0xcc7f33['length'])throw new SDKError(ErrorCode[_0x337666(0x1d5)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x337666(0x24d)});_0xcc7f33[_0x337666(0x18e)]=0x0,_0xcc7f33[_0x337666(0x23a)](..._0xe37444);}for(const _0x31c71d of _0x458860){const _0x1ed525=_0x927285['get'](_0x31c71d[_0x337666(0x22f)][_0x337666(0x17c)]);if(!_0x1ed525)continue;const _0x403ffa=await this['client']['createPrompt']({'projectId':_0x2fcedc,'agentId':_0x1ed525,'name':_0x31c71d[_0x337666(0x22f)][_0x337666(0x1e3)],'systemPrompt':_0x31c71d[_0x337666(0x22f)][_0x337666(0x19a)],'template':_0x31c71d[_0x337666(0x22f)]['template'],'jsonSchemaHint':_0x31c71d[_0x337666(0x22f)][_0x337666(0x228)]});_0x38609a[_0x337666(0x1e6)](_0x31c71d['id'],_0x403ffa['id']);}for(const _0x12a171 of _0x3a3b14){const _0x2e9f09=_0x12a171[_0x337666(0x22f)]['actions'][_0x337666(0x1c0)](_0x4e1f70=>({..._0x4e1f70,'promptId':_0x38609a[_0x337666(0x1b6)](_0x4e1f70[_0x337666(0x201)])||_0x4e1f70[_0x337666(0x201)]}));await this[_0x337666(0x241)]['createIntegration']({'projectId':_0x2fcedc,'serviceType':_0x12a171[_0x337666(0x22f)][_0x337666(0x1a0)],'actions':_0x2e9f09,'slackMessageMode':_0x12a171[_0x337666(0x22f)]['slackMessageMode'],'chatIgnoreManagedActions':_0x12a171['attributes'][_0x337666(0x216)],'chatWelcomeMessage':_0x12a171['attributes'][_0x337666(0x1fe)],'webhookCorsOrigins':_0x12a171[_0x337666(0x22f)][_0x337666(0x1ca)]});}return{'projectName':_0x1171bc,'projectId':_0x2fcedc,'counts':{'agents':_0x927285[_0x337666(0x20c)],'knowledgeBases':_0x3e625b[_0x337666(0x20c)],'prompts':_0x38609a[_0x337666(0x20c)],'integrations':_0x3a3b14[_0x337666(0x18e)]},'sourceSite':_0x2e450a};}[a105_0x561b8e(0x20a)](_0x3b5407,_0x28c0d3){const _0x485f7b=a105_0x561b8e;if(!a105_0x18dc27['existsSync'](_0x3b5407))return _0x28c0d3;return JSON[_0x485f7b(0x1d0)](a105_0x18dc27[_0x485f7b(0x212)](_0x3b5407,_0x485f7b(0x178)));}['getBackupMetadata'](_0xeb4199){const _0x14b871=a105_0x561b8e;if(!a105_0x18dc27[_0x14b871(0x215)](_0xeb4199))throw new SDKError(ErrorCode['NOT_FOUND'],_0x14b871(0x219)+_0xeb4199,undefined,{'helpText':_0x14b871(0x1d9)});const _0x3b3ae1=a105_0x39fc19[_0x14b871(0x22e)](_0xeb4199,_0x14b871(0x1a4));if(!a105_0x18dc27['existsSync'](_0x3b3ae1))throw new SDKError(ErrorCode[_0x14b871(0x22b)],_0x14b871(0x1b8)+_0xeb4199,undefined,{'helpText':_0x14b871(0x226)});const _0x5eccb1=JSON['parse'](a105_0x18dc27[_0x14b871(0x212)](_0x3b3ae1,_0x14b871(0x178)));if(!isSupportedBackupVersion(_0x5eccb1[_0x14b871(0x18c)]))throw new SDKError(ErrorCode[_0x14b871(0x22b)],'Unsupported\x20backup\x20version:\x20'+_0x5eccb1[_0x14b871(0x18c)],undefined,{'helpText':_0x14b871(0x1cf)});return _0x5eccb1;}async[a105_0x561b8e(0x238)](_0x5dd878,_0x3941b9,_0x5ef423){const _0x11607d=a105_0x561b8e,{projectId:_0x19044f,project:_0x5c2ddb}=await this[_0x11607d(0x198)](_0x5dd878),_0x1ef9c8=_0x5c2ddb[_0x11607d(0x22f)][_0x11607d(0x1e3)];let _0x44fc4f;if(_0x3941b9)_0x44fc4f=_0x3941b9;else{const _0xc9164f=a105_0x39fc19[_0x11607d(0x22e)](process['cwd'](),_0x11607d(0x1b5)),_0x3d881b=getSanitizedPathWithMigration(_0xc9164f,_0x1ef9c8);_0x3d881b['renamed']&&this[_0x11607d(0x1ce)]['logger']?.[_0x11607d(0x235)](_0x11607d(0x1bb)+a105_0x39fc19[_0x11607d(0x21f)](_0x3d881b[_0x11607d(0x242)])+_0x11607d(0x246)+a105_0x39fc19[_0x11607d(0x21f)](_0x3d881b[_0x11607d(0x23d)])),_0x44fc4f=_0x3d881b[_0x11607d(0x23d)];}const _0x14e301=await this[_0x11607d(0x241)][_0x11607d(0x251)](_0x19044f),_0x4d31cd=await this['client'][_0x11607d(0x253)](_0x19044f),_0x46b517=await this[_0x11607d(0x241)][_0x11607d(0x1a5)](_0x19044f),_0x5af5ba=await this[_0x11607d(0x241)]['listImageGenerators'](_0x19044f),_0xa525a=await this[_0x11607d(0x241)][_0x11607d(0x187)](_0x19044f),_0x1f5360=await this[_0x11607d(0x241)][_0x11607d(0x1c4)](_0x19044f),_0x112961=new Map(),_0xdc2ac3=new Map(),_0x5b03af=new Map(),_0x101381=new Map(),_0x375088=new Map(),_0x4739a0=new Map();for(const _0x3e0407 of _0x14e301){_0x112961[_0x11607d(0x1e6)](_0x3e0407['id'],_0x3e0407[_0x11607d(0x22f)][_0x11607d(0x1e3)]);}for(const _0x4f5e2b of _0x4d31cd){_0xdc2ac3[_0x11607d(0x1e6)](_0x4f5e2b['id'],_0x4f5e2b[_0x11607d(0x22f)]['name']);}for(const _0x390595 of _0x46b517){_0x5b03af[_0x11607d(0x1e6)](_0x390595['id'],_0x390595[_0x11607d(0x22f)][_0x11607d(0x1e3)]);}for(const _0xdc05b6 of _0x5af5ba){_0x101381[_0x11607d(0x1e6)](_0xdc05b6['id'],_0xdc05b6[_0x11607d(0x22f)][_0x11607d(0x1e3)]);}for(const _0x1e267d of _0xa525a){_0x375088['set'](_0x1e267d['id'],_0x1e267d[_0x11607d(0x22f)]['name']);}for(const _0xe0bffa of _0x1f5360){_0x4739a0[_0x11607d(0x1e6)](_0xe0bffa['id'],_0xe0bffa['attributes'][_0x11607d(0x1e3)]);}const _0x3ca813={'resolveKnowledgeBaseName':async _0x3c827c=>_0xdc2ac3[_0x11607d(0x1b6)](_0x3c827c),'resolveTextKnowledgeBaseName':async _0x4d3503=>_0x5b03af[_0x11607d(0x1b6)](_0x4d3503),'resolveAgentName':async _0x5c3235=>_0x112961['get'](_0x5c3235),'resolveWebSearchToolName':async _0x33bfc4=>_0x375088[_0x11607d(0x1b6)](_0x33bfc4),'resolveImageGeneratorName':async _0x3bb46d=>_0x101381[_0x11607d(0x1b6)](_0x3bb46d),'resolvePromptName':async _0x2e8d05=>_0x4739a0[_0x11607d(0x1b6)](_0x2e8d05),'onWarning':_0x512949=>this[_0x11607d(0x1ce)]['logger']?.[_0x11607d(0x218)](_0x512949)},_0x13ebee={'projectName':_0x1ef9c8,'outputDir':_0x44fc4f,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'counts':{'agents':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'knowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'textKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'prompts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0x18fb5b=[];for(const _0x57cc59 of _0x14e301){const _0x310e28=getSanitizedPathWithMigration(_0x44fc4f,_0x57cc59[_0x11607d(0x22f)]['name']);_0x310e28[_0x11607d(0x1a8)]&&this['context']['logger']?.[_0x11607d(0x235)](_0x11607d(0x1be)+a105_0x39fc19[_0x11607d(0x21f)](_0x310e28['oldPath'])+_0x11607d(0x246)+a105_0x39fc19[_0x11607d(0x21f)](_0x310e28[_0x11607d(0x23d)]));const _0xe27f18=_0x310e28['path'],_0x31d01d=a105_0x39fc19[_0x11607d(0x22e)](_0xe27f18,_0x11607d(0x1d8)),_0x42043d=a105_0x39fc19[_0x11607d(0x22e)](_0xe27f18,_0x11607d(0x247)),_0x1366fd=a105_0x39fc19[_0x11607d(0x22e)](_0xe27f18,_0x11607d(0x19e)),{yaml:_0x274861,systemPrompt:_0x3c6dff,starterMessage:_0x410f28}=await agentResponseToDef(_0x57cc59,_0x3ca813),_0x5cfddc=toAgentYamlString(_0x274861),_0x66db7b=!a105_0x18dc27['existsSync'](_0x42043d);let _0x3b0918=_0x66db7b,_0x2d397f;if(!_0x66db7b){const _0x4403fa=a105_0x18dc27[_0x11607d(0x215)](_0x31d01d)?a105_0x18dc27['readFileSync'](_0x31d01d,_0x11607d(0x178)):'',_0x4693ea=a105_0x18dc27[_0x11607d(0x212)](_0x42043d,_0x11607d(0x178)),_0xb460db=_0x11607d(0x1d6)+_0x4403fa+_0x11607d(0x193)+_0x4693ea,_0x56de0c='#\x20prompt.md\x0a'+_0x3c6dff+'\x0a\x0a#\x20agent.yml\x0a'+_0x5cfddc,_0x52e71a=generateDiff(_0xb460db,_0x56de0c);_0x3b0918=hasChanges(_0x52e71a),_0x3b0918&&(_0x2d397f=formatDiffWithColors(_0x52e71a));}_0x18fb5b[_0x11607d(0x23a)]({'path':_0xe27f18,'content':'','isDir':!![]}),_0x18fb5b[_0x11607d(0x23a)]({'path':_0x31d01d,'content':_0x3c6dff}),_0x18fb5b['push']({'path':_0x42043d,'content':_0x5cfddc});_0x410f28&&_0x410f28['includes']('\x0a')&&_0x18fb5b[_0x11607d(0x23a)]({'path':_0x1366fd,'content':_0x410f28});_0x13ebee[_0x11607d(0x1b5)][_0x11607d(0x23a)]({'agentName':_0x57cc59[_0x11607d(0x22f)][_0x11607d(0x1e3)],'outputPath':_0xe27f18,'isNew':_0x66db7b,'hasChanges':_0x3b0918,'diff':_0x2d397f}),_0x13ebee[_0x11607d(0x1dc)][_0x11607d(0x1b5)][_0x11607d(0x227)]++;if(_0x66db7b)_0x13ebee[_0x11607d(0x1dc)][_0x11607d(0x1b5)][_0x11607d(0x1aa)]++;else{if(_0x3b0918)_0x13ebee[_0x11607d(0x1dc)][_0x11607d(0x1b5)][_0x11607d(0x204)]++;else _0x13ebee[_0x11607d(0x1dc)][_0x11607d(0x1b5)][_0x11607d(0x1ad)]++;}}for(const _0x3e52d4 of _0x4d31cd){if(_0x3e52d4[_0x11607d(0x22f)][_0x11607d(0x1a6)])continue;const _0x34fe58=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x44fc4f),_0x3e52d4[_0x11607d(0x22f)][_0x11607d(0x1e3)],_0x11607d(0x1f3));_0x34fe58[_0x11607d(0x1a8)]&&this[_0x11607d(0x1ce)][_0x11607d(0x203)]?.['info'](_0x11607d(0x222)+a105_0x39fc19[_0x11607d(0x21f)](_0x34fe58[_0x11607d(0x242)])+'\x20→\x20'+a105_0x39fc19[_0x11607d(0x21f)](_0x34fe58[_0x11607d(0x23d)]));const _0xa17e21=_0x34fe58[_0x11607d(0x23d)],_0x1168a1=apiKnowledgeBaseToYaml(_0x3e52d4),_0x401619=toKnowledgeBaseYamlString(_0x1168a1),_0x276b4c=!a105_0x18dc27['existsSync'](_0xa17e21);let _0x2db5f8=_0x276b4c,_0x170288;if(!_0x276b4c){const _0x372e24=a105_0x18dc27[_0x11607d(0x212)](_0xa17e21,_0x11607d(0x178)),_0x2f3e83=generateDiff(_0x372e24,_0x401619);_0x2db5f8=hasChanges(_0x2f3e83),_0x2db5f8&&(_0x170288=formatDiffWithColors(_0x2f3e83));}_0x18fb5b[_0x11607d(0x23a)]({'path':_0xa17e21,'content':_0x401619}),_0x13ebee[_0x11607d(0x19f)][_0x11607d(0x23a)]({'name':_0x3e52d4[_0x11607d(0x22f)][_0x11607d(0x1e3)],'outputPath':_0xa17e21,'isNew':_0x276b4c,'hasChanges':_0x2db5f8,'diff':_0x170288}),_0x13ebee[_0x11607d(0x1dc)][_0x11607d(0x19f)][_0x11607d(0x227)]++;if(_0x276b4c)_0x13ebee[_0x11607d(0x1dc)][_0x11607d(0x19f)][_0x11607d(0x1aa)]++;else{if(_0x2db5f8)_0x13ebee[_0x11607d(0x1dc)][_0x11607d(0x19f)][_0x11607d(0x204)]++;else _0x13ebee[_0x11607d(0x1dc)]['knowledgeBases']['unchanged']++;}}for(const _0x4cf7a1 of _0x46b517){if(_0x4cf7a1[_0x11607d(0x22f)][_0x11607d(0x1a6)])continue;const _0x5c535e=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x44fc4f),_0x4cf7a1[_0x11607d(0x22f)][_0x11607d(0x1e3)],'.md');_0x5c535e['renamed']&&this['context'][_0x11607d(0x203)]?.[_0x11607d(0x235)](_0x11607d(0x225)+a105_0x39fc19[_0x11607d(0x21f)](_0x5c535e[_0x11607d(0x242)])+'\x20→\x20'+a105_0x39fc19[_0x11607d(0x21f)](_0x5c535e['path']));const _0x342f99=_0x5c535e[_0x11607d(0x23d)],_0x3625c4=toTextKnowledgeBaseMd(_0x4cf7a1['attributes'][_0x11607d(0x1e3)],_0x4cf7a1['attributes'][_0x11607d(0x1bf)]),_0x49287a=!a105_0x18dc27[_0x11607d(0x215)](_0x342f99);let _0x28f3e4=_0x49287a,_0x363c6d;if(!_0x49287a){const _0x4ebff9=a105_0x18dc27[_0x11607d(0x212)](_0x342f99,_0x11607d(0x178)),_0x232ba4=generateDiff(_0x4ebff9,_0x3625c4);_0x28f3e4=hasChanges(_0x232ba4),_0x28f3e4&&(_0x363c6d=formatDiffWithColors(_0x232ba4));}_0x18fb5b[_0x11607d(0x23a)]({'path':_0x342f99,'content':_0x3625c4}),_0x13ebee[_0x11607d(0x254)][_0x11607d(0x23a)]({'name':_0x4cf7a1['attributes'][_0x11607d(0x1e3)],'outputPath':_0x342f99,'isNew':_0x49287a,'hasChanges':_0x28f3e4,'diff':_0x363c6d}),_0x13ebee[_0x11607d(0x1dc)][_0x11607d(0x254)][_0x11607d(0x227)]++;if(_0x49287a)_0x13ebee[_0x11607d(0x1dc)][_0x11607d(0x254)][_0x11607d(0x1aa)]++;else{if(_0x28f3e4)_0x13ebee[_0x11607d(0x1dc)][_0x11607d(0x254)][_0x11607d(0x204)]++;else _0x13ebee['counts'][_0x11607d(0x254)][_0x11607d(0x1ad)]++;}}for(const _0x3151f1 of _0x1f5360){if(_0x3151f1['attributes'][_0x11607d(0x1a6)])continue;const _0x400e8c=getSanitizedPathWithMigration(getPromptsDir(_0x44fc4f),_0x3151f1[_0x11607d(0x22f)][_0x11607d(0x1e3)],_0x11607d(0x1f3));_0x400e8c['renamed']&&this[_0x11607d(0x1ce)][_0x11607d(0x203)]?.[_0x11607d(0x235)](_0x11607d(0x184)+a105_0x39fc19[_0x11607d(0x21f)](_0x400e8c[_0x11607d(0x242)])+'\x20→\x20'+a105_0x39fc19[_0x11607d(0x21f)](_0x400e8c['path']));const _0x545741=_0x400e8c[_0x11607d(0x23d)],_0xf60499=await apiPromptToYaml(_0x3151f1,_0x3ca813);if(!_0xf60499)continue;const _0x55740d=toPromptYamlString(_0xf60499),_0x5554d5=!a105_0x18dc27[_0x11607d(0x215)](_0x545741);let _0x5e60cb=_0x5554d5,_0x14c0ce;if(!_0x5554d5){const _0x25cfa7=a105_0x18dc27[_0x11607d(0x212)](_0x545741,_0x11607d(0x178)),_0x23eb01=generateDiff(_0x25cfa7,_0x55740d);_0x5e60cb=hasChanges(_0x23eb01),_0x5e60cb&&(_0x14c0ce=formatDiffWithColors(_0x23eb01));}_0x18fb5b[_0x11607d(0x23a)]({'path':_0x545741,'content':_0x55740d}),_0x13ebee['prompts']['push']({'name':_0x3151f1[_0x11607d(0x22f)][_0x11607d(0x1e3)],'outputPath':_0x545741,'isNew':_0x5554d5,'hasChanges':_0x5e60cb,'diff':_0x14c0ce}),_0x13ebee[_0x11607d(0x1dc)][_0x11607d(0x18d)][_0x11607d(0x227)]++;if(_0x5554d5)_0x13ebee['counts'][_0x11607d(0x18d)][_0x11607d(0x1aa)]++;else{if(_0x5e60cb)_0x13ebee['counts'][_0x11607d(0x18d)][_0x11607d(0x204)]++;else _0x13ebee[_0x11607d(0x1dc)][_0x11607d(0x18d)][_0x11607d(0x1ad)]++;}}if(_0x5ef423?.[_0x11607d(0x180)])return _0x13ebee;a105_0x18dc27[_0x11607d(0x1bd)](_0x44fc4f,{'recursive':!![]}),a105_0x18dc27[_0x11607d(0x1bd)](getKnowledgeBasesDir(_0x44fc4f),{'recursive':!![]}),a105_0x18dc27[_0x11607d(0x1bd)](getPromptsDir(_0x44fc4f),{'recursive':!![]});const _0x4ce14d=a105_0x39fc19[_0x11607d(0x22e)](_0x44fc4f,'tdx.json');a105_0x18dc27['writeFileSync'](_0x4ce14d,createAgentConfigContent(_0x1ef9c8));for(const _0x4fd023 of _0x18fb5b){if(_0x4fd023['isDir'])a105_0x18dc27[_0x11607d(0x1bd)](_0x4fd023[_0x11607d(0x23d)],{'recursive':!![]});else{const _0x168d4b=a105_0x39fc19[_0x11607d(0x20e)](_0x4fd023[_0x11607d(0x23d)]);!a105_0x18dc27[_0x11607d(0x215)](_0x168d4b)&&a105_0x18dc27[_0x11607d(0x1bd)](_0x168d4b,{'recursive':!![]}),a105_0x18dc27[_0x11607d(0x1a7)](_0x4fd023[_0x11607d(0x23d)],_0x4fd023[_0x11607d(0x211)]);}}return _0x13ebee;}async[a105_0x561b8e(0x20b)](_0x6cad25,_0x441e3f){const _0x242d57=a105_0x561b8e,_0x1c4e89=a105_0x39fc19['join'](_0x6cad25,_0x242d57(0x255));if(!a105_0x18dc27['existsSync'](_0x1c4e89))throw new SDKError(ErrorCode[_0x242d57(0x22b)],_0x242d57(0x21c)+_0x6cad25,undefined,{'helpText':_0x242d57(0x1d3)});const _0x5960c2=loadAgentConfig(_0x1c4e89),_0x89ef8f=await this[_0x242d57(0x189)](_0x5960c2[_0x242d57(0x236)]),_0x5ca79a=await this[_0x242d57(0x241)][_0x242d57(0x1c1)](_0x89ef8f),_0x441a4b=_0x5ca79a[_0x242d57(0x22f)]['name'],_0x5685f4={'projectName':_0x441a4b,'projectId':_0x89ef8f,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x8fbf62=[],_0x1808bf=[],_0x6ca6ba=[],_0x47d2c9=[],_0x226db0=a105_0x18dc27['readdirSync'](_0x6cad25,{'withFileTypes':!![]});for(const _0x14169c of _0x226db0){if(!_0x14169c[_0x242d57(0x1b1)]())continue;if([_0x242d57(0x1d1),_0x242d57(0x18d),'integrations'][_0x242d57(0x17e)](_0x14169c[_0x242d57(0x1e3)]))continue;const _0x464fda=a105_0x39fc19[_0x242d57(0x22e)](_0x6cad25,_0x14169c[_0x242d57(0x1e3)]);if(isAgentDir(_0x464fda)){const _0xade35=a105_0x39fc19['join'](_0x464fda,_0x242d57(0x247)),_0x552387=a105_0x39fc19[_0x242d57(0x22e)](_0x464fda,_0x242d57(0x1d8)),_0x14a550=a105_0x39fc19['join'](_0x464fda,'starter_message.md'),_0x19e9e9=parseAgentYaml(a105_0x18dc27[_0x242d57(0x212)](_0xade35,_0x242d57(0x178)),_0xade35),_0x9a75b3=a105_0x18dc27['existsSync'](_0x552387)?a105_0x18dc27[_0x242d57(0x212)](_0x552387,_0x242d57(0x178)):'',_0x53d143=a105_0x18dc27['existsSync'](_0x14a550)?a105_0x18dc27[_0x242d57(0x212)](_0x14a550,'utf-8'):_0x19e9e9[_0x242d57(0x191)];_0x8fbf62[_0x242d57(0x23a)]({'name':_0x19e9e9[_0x242d57(0x1e3)],'dir':_0x464fda,'yaml':_0x19e9e9,'systemPrompt':_0x9a75b3,'starterMessage':_0x53d143});}}const _0x5f4fee=getKnowledgeBasesDir(_0x6cad25);if(a105_0x18dc27['existsSync'](_0x5f4fee)){const _0x53ad90=a105_0x18dc27[_0x242d57(0x208)](_0x5f4fee);for(const _0xcaefda of _0x53ad90){const _0x4c82c3=a105_0x39fc19[_0x242d57(0x22e)](_0x5f4fee,_0xcaefda);if(_0xcaefda[_0x242d57(0x1f7)](_0x242d57(0x1f3))){const _0x55eb48=parseKnowledgeBaseYaml(a105_0x18dc27[_0x242d57(0x212)](_0x4c82c3,_0x242d57(0x178)),_0x4c82c3);_0x1808bf[_0x242d57(0x23a)]({'name':_0x55eb48[_0x242d57(0x1e3)],'path':_0x4c82c3,'yaml':_0x55eb48});}else{if(_0xcaefda[_0x242d57(0x1f7)](_0x242d57(0x1fd))){const _0xeb317=a105_0x18dc27[_0x242d57(0x212)](_0x4c82c3,_0x242d57(0x178)),{name:_0x2c13aa,text:_0x15a879}=parseTextKnowledgeBaseMd(_0xeb317,_0xcaefda);_0x6ca6ba[_0x242d57(0x23a)]({'name':_0x2c13aa,'path':_0x4c82c3,'text':_0x15a879});}}}}const _0x5b6717=getPromptsDir(_0x6cad25);if(a105_0x18dc27[_0x242d57(0x215)](_0x5b6717)){const _0x4934c2=a105_0x18dc27[_0x242d57(0x208)](_0x5b6717)['filter'](_0x5a156b=>_0x5a156b['endsWith'](_0x242d57(0x1f3)));for(const _0x1fef9f of _0x4934c2){const _0x406baa=a105_0x39fc19[_0x242d57(0x22e)](_0x5b6717,_0x1fef9f),_0x1a1376=parsePromptYaml(a105_0x18dc27[_0x242d57(0x212)](_0x406baa,_0x242d57(0x178)),_0x406baa);_0x47d2c9[_0x242d57(0x23a)]({'name':_0x1a1376['name'],'path':_0x406baa,'yaml':_0x1a1376});}}const _0x33e392=await this[_0x242d57(0x241)][_0x242d57(0x251)](_0x89ef8f),_0x4d6126=await this[_0x242d57(0x241)][_0x242d57(0x253)](_0x89ef8f),_0x3e4bad=await this[_0x242d57(0x241)][_0x242d57(0x1a5)](_0x89ef8f),_0x381939=await this[_0x242d57(0x241)][_0x242d57(0x244)](_0x89ef8f),_0x23a004=await this['client']['listWebSearchTools'](_0x89ef8f),_0x866a88=await this['client'][_0x242d57(0x1c4)](_0x89ef8f),_0x4591b0=new Map(),_0x4a28ba=new Map(),_0x37be04=new Map(),_0x173679=new Map();for(const _0x55e36c of _0x33e392){_0x4591b0[_0x242d57(0x1e6)](_0x55e36c[_0x242d57(0x22f)]['name'],_0x55e36c);}for(const _0x682396 of _0x4d6126){_0x4a28ba[_0x242d57(0x1e6)](_0x682396[_0x242d57(0x22f)]['name'],_0x682396);}for(const _0x371a11 of _0x3e4bad){_0x37be04[_0x242d57(0x1e6)](_0x371a11[_0x242d57(0x22f)]['name'],_0x371a11);}for(const _0x466b29 of _0x866a88){_0x173679[_0x242d57(0x1e6)](_0x466b29['attributes'][_0x242d57(0x1e3)],_0x466b29);}const _0xda1457=new Map(),_0x44908d=new Map(),_0x17b773=new Map(),_0xafd094=new Map(),_0x2010bb=new Map(),_0x201b02=new Map(),_0x20bd2a=new Map(),_0xd71d96=new Map(),_0x14fead=new Map(),_0x5cce0a=new Map(),_0x120e8e=new Map(),_0x471233=new Map();for(const _0x9a1c04 of _0x4d6126){_0xda1457[_0x242d57(0x1e6)](_0x9a1c04[_0x242d57(0x22f)][_0x242d57(0x1e3)],_0x9a1c04['id']),_0x20bd2a[_0x242d57(0x1e6)](_0x9a1c04['id'],_0x9a1c04[_0x242d57(0x22f)][_0x242d57(0x1e3)]);}for(const _0x2e1d59 of _0x3e4bad){_0x44908d[_0x242d57(0x1e6)](_0x2e1d59[_0x242d57(0x22f)][_0x242d57(0x1e3)],_0x2e1d59['id']),_0xd71d96['set'](_0x2e1d59['id'],_0x2e1d59[_0x242d57(0x22f)][_0x242d57(0x1e3)]);}for(const _0x5aac17 of _0x33e392){_0x17b773[_0x242d57(0x1e6)](_0x5aac17['attributes'][_0x242d57(0x1e3)],_0x5aac17['id']),_0x14fead[_0x242d57(0x1e6)](_0x5aac17['id'],_0x5aac17['attributes'][_0x242d57(0x1e3)]);}for(const _0x2457dc of _0x381939){_0xafd094[_0x242d57(0x1e6)](_0x2457dc[_0x242d57(0x22f)][_0x242d57(0x1e3)],_0x2457dc['id']),_0x5cce0a[_0x242d57(0x1e6)](_0x2457dc['id'],_0x2457dc[_0x242d57(0x22f)][_0x242d57(0x1e3)]);}for(const _0x12f2b1 of _0x23a004){_0x2010bb[_0x242d57(0x1e6)](_0x12f2b1[_0x242d57(0x22f)][_0x242d57(0x1e3)],_0x12f2b1['id']),_0x120e8e['set'](_0x12f2b1['id'],_0x12f2b1[_0x242d57(0x22f)][_0x242d57(0x1e3)]);}for(const _0x1060e2 of _0x866a88){_0x201b02[_0x242d57(0x1e6)](_0x1060e2[_0x242d57(0x22f)][_0x242d57(0x1e3)],_0x1060e2['id']),_0x471233[_0x242d57(0x1e6)](_0x1060e2['id'],_0x1060e2[_0x242d57(0x22f)][_0x242d57(0x1e3)]);}const _0x5e46bf={'resolveKnowledgeBaseName':async _0x2e9264=>_0x20bd2a['get'](_0x2e9264),'resolveTextKnowledgeBaseName':async _0x2b3a1a=>_0xd71d96[_0x242d57(0x1b6)](_0x2b3a1a),'resolveAgentName':async _0x5c8ced=>_0x14fead[_0x242d57(0x1b6)](_0x5c8ced),'resolveWebSearchToolName':async _0x211155=>_0x120e8e[_0x242d57(0x1b6)](_0x211155),'resolveImageGeneratorName':async _0x34a5b0=>_0x5cce0a[_0x242d57(0x1b6)](_0x34a5b0),'resolvePromptName':async _0x27196a=>_0x471233[_0x242d57(0x1b6)](_0x27196a),'onWarning':_0x385aaa=>this['context'][_0x242d57(0x203)]?.[_0x242d57(0x218)](_0x385aaa)},_0x4abfda={'projectId':_0x89ef8f,'resolveKnowledgeBaseId':async _0x2b1abd=>_0xda1457['get'](_0x2b1abd),'resolveTextKnowledgeBaseId':async _0x38521e=>_0x44908d[_0x242d57(0x1b6)](_0x38521e),'resolveAgentId':async _0x333627=>_0x17b773[_0x242d57(0x1b6)](_0x333627),'resolveWebSearchToolId':async _0x52cf09=>_0x2010bb[_0x242d57(0x1b6)](_0x52cf09),'resolveImageGeneratorId':async _0x24f3c4=>_0xafd094[_0x242d57(0x1b6)](_0x24f3c4),'resolvePromptId':async _0x59c9bf=>_0x201b02[_0x242d57(0x1b6)](_0x59c9bf),'onWarning':_0x585806=>this[_0x242d57(0x1ce)]['logger']?.['warn'](_0x585806)},{resolved:_0x413abf,unresolved:_0x560c0e}=resolveAgentDependencies(_0x8fbf62,new Set(_0x4591b0[_0x242d57(0x22c)]()));for(const {agent:_0x57b249,missingDeps:_0xa6eee3}of _0x560c0e){_0x5685f4[_0x242d57(0x1b5)][_0x242d57(0x23a)]({'agentName':_0x57b249['yaml'][_0x242d57(0x1e3)],'action':_0x242d57(0x249),'error':'Unresolved\x20dependencies:\x20'+_0xa6eee3[_0x242d57(0x22e)](',\x20')+_0x242d57(0x200)}),_0x5685f4['counts'][_0x242d57(0x1b5)][_0x242d57(0x24e)]++;}for(const _0x6e1f05 of _0x1808bf){const _0x3f01ab=_0x4a28ba[_0x242d57(0x1b6)](_0x6e1f05['yaml']['name']),_0x399b34=a105_0x18dc27[_0x242d57(0x212)](_0x6e1f05[_0x242d57(0x23d)],_0x242d57(0x178));if(_0x3f01ab){const _0xaa1c6a=apiKnowledgeBaseToYaml(_0x3f01ab),_0x5883d9=toKnowledgeBaseYamlString(_0xaa1c6a),_0x1a6e2e=generateDiff(_0x5883d9,_0x399b34),_0x1e4861=hasChanges(_0x1a6e2e);_0x1e4861?(_0x5685f4[_0x242d57(0x19f)][_0x242d57(0x23a)]({'name':_0x6e1f05[_0x242d57(0x192)][_0x242d57(0x1e3)],'action':_0x242d57(0x204),'id':_0x3f01ab['id'],'diff':formatDiffWithColors(_0x1a6e2e)}),_0x5685f4['counts'][_0x242d57(0x19f)][_0x242d57(0x204)]++):(_0x5685f4[_0x242d57(0x19f)][_0x242d57(0x23a)]({'name':_0x6e1f05[_0x242d57(0x192)][_0x242d57(0x1e3)],'action':_0x242d57(0x1ad),'id':_0x3f01ab['id']}),_0x5685f4[_0x242d57(0x1dc)][_0x242d57(0x19f)][_0x242d57(0x1ad)]++);}else _0x5685f4['knowledgeBases']['push']({'name':_0x6e1f05['yaml'][_0x242d57(0x1e3)],'action':'created'}),_0x5685f4[_0x242d57(0x1dc)][_0x242d57(0x19f)][_0x242d57(0x24a)]++;}for(const _0x3427ba of _0x6ca6ba){const _0x4ef46b=_0x37be04[_0x242d57(0x1b6)](_0x3427ba[_0x242d57(0x1e3)]),_0x4b740c=a105_0x18dc27[_0x242d57(0x212)](_0x3427ba['path'],_0x242d57(0x178));if(_0x4ef46b){const _0x33e85f=toTextKnowledgeBaseMd(_0x4ef46b['attributes'][_0x242d57(0x1e3)],_0x4ef46b[_0x242d57(0x22f)]['text']),_0x456737=generateDiff(_0x33e85f,_0x4b740c),_0x25c79f=hasChanges(_0x456737);_0x25c79f?(_0x5685f4[_0x242d57(0x254)][_0x242d57(0x23a)]({'name':_0x3427ba[_0x242d57(0x1e3)],'action':'updated','id':_0x4ef46b['id'],'diff':formatDiffWithColors(_0x456737)}),_0x5685f4[_0x242d57(0x1dc)]['textKnowledgeBases'][_0x242d57(0x204)]++):(_0x5685f4['textKnowledgeBases']['push']({'name':_0x3427ba['name'],'action':_0x242d57(0x1ad),'id':_0x4ef46b['id']}),_0x5685f4[_0x242d57(0x1dc)][_0x242d57(0x254)][_0x242d57(0x1ad)]++);}else _0x5685f4[_0x242d57(0x254)][_0x242d57(0x23a)]({'name':_0x3427ba['name'],'action':_0x242d57(0x24a)}),_0x5685f4['counts'][_0x242d57(0x254)][_0x242d57(0x24a)]++;}for(const _0x98cd88 of _0x413abf){const _0x538bf5=_0x4591b0[_0x242d57(0x1b6)](_0x98cd88[_0x242d57(0x192)][_0x242d57(0x1e3)]),_0x1c5d28=a105_0x39fc19[_0x242d57(0x22e)](_0x98cd88[_0x242d57(0x21a)],_0x242d57(0x247)),_0x183c68=a105_0x18dc27[_0x242d57(0x212)](_0x1c5d28,_0x242d57(0x178)),_0x2fda4d=_0x98cd88[_0x242d57(0x19a)],_0x24b5f8=_0x242d57(0x1d6)+_0x2fda4d+_0x242d57(0x193)+_0x183c68;if(_0x538bf5){const {yaml:_0x3a3d90,systemPrompt:_0x3e2895}=await agentResponseToDef(_0x538bf5,_0x5e46bf),_0x3065ec=toAgentYamlString(_0x3a3d90),_0x457d41=_0x242d57(0x1d6)+_0x3e2895+_0x242d57(0x193)+_0x3065ec,_0x1343bc=generateDiff(_0x457d41,_0x24b5f8),_0x4185e4=hasChanges(_0x1343bc);_0x4185e4?(_0x5685f4[_0x242d57(0x1b5)][_0x242d57(0x23a)]({'agentName':_0x98cd88[_0x242d57(0x192)][_0x242d57(0x1e3)],'action':_0x242d57(0x204),'agentId':_0x538bf5['id'],'diff':formatDiffWithColors(_0x1343bc)}),_0x5685f4[_0x242d57(0x1dc)][_0x242d57(0x1b5)][_0x242d57(0x204)]++):(_0x5685f4[_0x242d57(0x1b5)]['push']({'agentName':_0x98cd88['yaml'][_0x242d57(0x1e3)],'action':_0x242d57(0x1ad),'agentId':_0x538bf5['id']}),_0x5685f4[_0x242d57(0x1dc)][_0x242d57(0x1b5)]['unchanged']++);}else _0x5685f4['agents'][_0x242d57(0x23a)]({'agentName':_0x98cd88[_0x242d57(0x192)][_0x242d57(0x1e3)],'action':_0x242d57(0x24a)}),_0x5685f4['counts'][_0x242d57(0x1b5)]['created']++;}for(const _0x8c59ff of _0x47d2c9){const _0x59c74e=_0x173679[_0x242d57(0x1b6)](_0x8c59ff['yaml']['name']),_0x1ca11a=a105_0x18dc27[_0x242d57(0x212)](_0x8c59ff[_0x242d57(0x23d)],_0x242d57(0x178));if(_0x59c74e){const _0x2302be=await apiPromptToYaml(_0x59c74e,_0x5e46bf);if(!_0x2302be){_0x5685f4[_0x242d57(0x18d)][_0x242d57(0x23a)]({'name':_0x8c59ff[_0x242d57(0x192)][_0x242d57(0x1e3)],'action':_0x242d57(0x204),'id':_0x59c74e['id']}),_0x5685f4[_0x242d57(0x1dc)][_0x242d57(0x18d)][_0x242d57(0x204)]++;continue;}const _0x4accf8=toPromptYamlString(_0x2302be),_0x1c10f6=generateDiff(_0x4accf8,_0x1ca11a),_0x18b4e7=hasChanges(_0x1c10f6);_0x18b4e7?(_0x5685f4[_0x242d57(0x18d)]['push']({'name':_0x8c59ff[_0x242d57(0x192)][_0x242d57(0x1e3)],'action':_0x242d57(0x204),'id':_0x59c74e['id'],'diff':formatDiffWithColors(_0x1c10f6)}),_0x5685f4[_0x242d57(0x1dc)][_0x242d57(0x18d)][_0x242d57(0x204)]++):(_0x5685f4[_0x242d57(0x18d)][_0x242d57(0x23a)]({'name':_0x8c59ff[_0x242d57(0x192)]['name'],'action':'unchanged','id':_0x59c74e['id']}),_0x5685f4[_0x242d57(0x1dc)][_0x242d57(0x18d)][_0x242d57(0x1ad)]++);}else _0x5685f4['prompts'][_0x242d57(0x23a)]({'name':_0x8c59ff[_0x242d57(0x192)][_0x242d57(0x1e3)],'action':_0x242d57(0x24a)}),_0x5685f4[_0x242d57(0x1dc)]['prompts'][_0x242d57(0x24a)]++;}if(_0x441e3f?.['dryRun'])return _0x5685f4;_0x5685f4[_0x242d57(0x19f)]=[],_0x5685f4[_0x242d57(0x254)]=[],_0x5685f4[_0x242d57(0x18d)]=[];const _0x457d12=_0x5685f4[_0x242d57(0x1b5)][_0x242d57(0x1c8)](_0x192173=>_0x192173[_0x242d57(0x182)]===_0x242d57(0x249));_0x5685f4[_0x242d57(0x1b5)]=_0x457d12,_0x5685f4['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x457d12['length']},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x2562c4 of _0x1808bf){try{const _0x1e2941=_0x4a28ba[_0x242d57(0x1b6)](_0x2562c4['yaml'][_0x242d57(0x1e3)]),_0x19ce47=yamlKnowledgeBaseToApi(_0x2562c4[_0x242d57(0x192)],_0x89ef8f);if(_0x1e2941)await this[_0x242d57(0x241)]['updateKnowledgeBase'](_0x1e2941['id'],_0x19ce47),_0xda1457[_0x242d57(0x1e6)](_0x2562c4[_0x242d57(0x192)][_0x242d57(0x1e3)],_0x1e2941['id']),_0x5685f4[_0x242d57(0x19f)][_0x242d57(0x23a)]({'name':_0x2562c4[_0x242d57(0x192)][_0x242d57(0x1e3)],'action':'updated','id':_0x1e2941['id']}),_0x5685f4[_0x242d57(0x1dc)]['knowledgeBases'][_0x242d57(0x204)]++;else{const _0x12d360=await this[_0x242d57(0x241)]['createKnowledgeBase'](_0x19ce47);_0xda1457[_0x242d57(0x1e6)](_0x2562c4['yaml'][_0x242d57(0x1e3)],_0x12d360['id']),_0x5685f4[_0x242d57(0x19f)][_0x242d57(0x23a)]({'name':_0x2562c4[_0x242d57(0x192)][_0x242d57(0x1e3)],'action':_0x242d57(0x24a),'id':_0x12d360['id']}),_0x5685f4[_0x242d57(0x1dc)][_0x242d57(0x19f)][_0x242d57(0x24a)]++;}}catch(_0x4a59c4){_0x5685f4['knowledgeBases'][_0x242d57(0x23a)]({'name':_0x2562c4[_0x242d57(0x192)][_0x242d57(0x1e3)],'action':_0x242d57(0x249),'error':_0x4a59c4['message']}),_0x5685f4['counts'][_0x242d57(0x19f)][_0x242d57(0x24e)]++;}}for(const _0x4ca805 of _0x6ca6ba){try{const _0x244e37=_0x37be04[_0x242d57(0x1b6)](_0x4ca805[_0x242d57(0x1e3)]),_0x93b64d=yamlTextKnowledgeBaseToApi({'name':_0x4ca805['name'],'text':_0x4ca805[_0x242d57(0x1bf)]},_0x89ef8f);if(_0x244e37)await this[_0x242d57(0x241)][_0x242d57(0x1dd)](_0x244e37['id'],_0x93b64d),_0x44908d[_0x242d57(0x1e6)](_0x4ca805[_0x242d57(0x1e3)],_0x244e37['id']),_0x5685f4[_0x242d57(0x254)]['push']({'name':_0x4ca805[_0x242d57(0x1e3)],'action':'updated','id':_0x244e37['id']}),_0x5685f4[_0x242d57(0x1dc)][_0x242d57(0x254)]['updated']++;else{const _0x291d17=await this[_0x242d57(0x241)]['createTextKnowledgeBase'](_0x93b64d);_0x44908d['set'](_0x4ca805['name'],_0x291d17['id']),_0x5685f4[_0x242d57(0x254)][_0x242d57(0x23a)]({'name':_0x4ca805['name'],'action':_0x242d57(0x24a),'id':_0x291d17['id']}),_0x5685f4[_0x242d57(0x1dc)][_0x242d57(0x254)][_0x242d57(0x24a)]++;}}catch(_0x5882eb){_0x5685f4[_0x242d57(0x254)][_0x242d57(0x23a)]({'name':_0x4ca805[_0x242d57(0x1e3)],'action':_0x242d57(0x249),'error':_0x5882eb[_0x242d57(0x243)]}),_0x5685f4['counts']['textKnowledgeBases'][_0x242d57(0x24e)]++;}}for(const _0x54d3f5 of _0x413abf){try{const _0x41780c=_0x4591b0['get'](_0x54d3f5[_0x242d57(0x192)][_0x242d57(0x1e3)]),_0x78878c=await agentDefToRequest(_0x54d3f5[_0x242d57(0x192)],_0x54d3f5[_0x242d57(0x19a)],_0x54d3f5[_0x242d57(0x209)],_0x4abfda);if(_0x41780c)await this['client']['updateAgentResponse'](_0x41780c['id'],_0x78878c),_0x17b773[_0x242d57(0x1e6)](_0x54d3f5[_0x242d57(0x192)][_0x242d57(0x1e3)],_0x41780c['id']),_0x5685f4[_0x242d57(0x1b5)]['push']({'agentName':_0x54d3f5[_0x242d57(0x192)][_0x242d57(0x1e3)],'action':_0x242d57(0x204),'agentId':_0x41780c['id']}),_0x5685f4[_0x242d57(0x1dc)][_0x242d57(0x1b5)][_0x242d57(0x204)]++;else{const _0x4863f2=await this[_0x242d57(0x241)]['createAgentResponse'](_0x78878c);_0x17b773[_0x242d57(0x1e6)](_0x54d3f5['yaml'][_0x242d57(0x1e3)],_0x4863f2['id']),_0x5685f4[_0x242d57(0x1b5)][_0x242d57(0x23a)]({'agentName':_0x54d3f5[_0x242d57(0x192)][_0x242d57(0x1e3)],'action':_0x242d57(0x24a),'agentId':_0x4863f2['id']}),_0x5685f4[_0x242d57(0x1dc)][_0x242d57(0x1b5)][_0x242d57(0x24a)]++;}}catch(_0x501b6f){_0x5685f4[_0x242d57(0x1b5)][_0x242d57(0x23a)]({'agentName':_0x54d3f5[_0x242d57(0x192)][_0x242d57(0x1e3)],'action':_0x242d57(0x249),'error':_0x501b6f['message']}),_0x5685f4[_0x242d57(0x1dc)]['agents']['errors']++;}}for(const _0x777905 of _0x47d2c9){try{const _0x3d8e5a=_0x173679[_0x242d57(0x1b6)](_0x777905[_0x242d57(0x192)][_0x242d57(0x1e3)]),_0x58e213=await yamlPromptToApi(_0x777905[_0x242d57(0x192)],_0x89ef8f,_0x4abfda);if(!_0x58e213){_0x5685f4[_0x242d57(0x18d)][_0x242d57(0x23a)]({'name':_0x777905['yaml'][_0x242d57(0x1e3)],'action':_0x242d57(0x249),'error':_0x242d57(0x22d)}),_0x5685f4[_0x242d57(0x1dc)][_0x242d57(0x18d)][_0x242d57(0x24e)]++;continue;}if(_0x3d8e5a)await this['client']['updatePrompt'](_0x3d8e5a['id'],_0x58e213),_0x201b02[_0x242d57(0x1e6)](_0x777905[_0x242d57(0x192)][_0x242d57(0x1e3)],_0x3d8e5a['id']),_0x5685f4[_0x242d57(0x18d)][_0x242d57(0x23a)]({'name':_0x777905[_0x242d57(0x192)][_0x242d57(0x1e3)],'action':'updated','id':_0x3d8e5a['id']}),_0x5685f4[_0x242d57(0x1dc)][_0x242d57(0x18d)][_0x242d57(0x204)]++;else{const _0x481ea8=await this[_0x242d57(0x241)][_0x242d57(0x245)](_0x58e213);_0x201b02[_0x242d57(0x1e6)](_0x777905['yaml'][_0x242d57(0x1e3)],_0x481ea8['id']),_0x5685f4[_0x242d57(0x18d)][_0x242d57(0x23a)]({'name':_0x777905[_0x242d57(0x192)]['name'],'action':_0x242d57(0x24a),'id':_0x481ea8['id']}),_0x5685f4[_0x242d57(0x1dc)][_0x242d57(0x18d)][_0x242d57(0x24a)]++;}}catch(_0x30b43a){_0x5685f4[_0x242d57(0x18d)][_0x242d57(0x23a)]({'name':_0x777905['yaml'][_0x242d57(0x1e3)],'action':_0x242d57(0x249),'error':_0x30b43a['message']}),_0x5685f4[_0x242d57(0x1dc)][_0x242d57(0x18d)]['errors']++;}}return _0x5685f4;}async['pullAgent'](_0x12d8f2,_0x5e89c2,_0x2e8b19,_0x26f31b){const _0x3ea742=a105_0x561b8e,{projectId:_0xaa8a2b,project:_0x36e4a2}=await this[_0x3ea742(0x198)](_0x12d8f2),_0x19570f=_0x36e4a2[_0x3ea742(0x22f)][_0x3ea742(0x1e3)],_0x2b06d9=await this[_0x3ea742(0x241)]['listAgentsFull'](_0xaa8a2b),_0x4e6f4d=_0x2b06d9[_0x3ea742(0x1da)](_0x5f330f=>_0x5f330f[_0x3ea742(0x22f)]['name']===_0x5e89c2);if(!_0x4e6f4d)throw new SDKError(ErrorCode[_0x3ea742(0x24c)],'Agent\x20not\x20found:\x20'+_0x5e89c2,undefined,{'helpText':'Available\x20agents:\x20'+_0x2b06d9[_0x3ea742(0x1c0)](_0xb08822=>_0xb08822[_0x3ea742(0x22f)]['name'])[_0x3ea742(0x22e)](',\x20')});let _0x305657;if(_0x2e8b19)_0x305657=_0x2e8b19;else{const _0x2173a6=a105_0x39fc19[_0x3ea742(0x22e)](process[_0x3ea742(0x23c)](),_0x3ea742(0x1b5)),_0x44dce4=getSanitizedPathWithMigration(_0x2173a6,_0x19570f);_0x44dce4['renamed']&&this[_0x3ea742(0x1ce)][_0x3ea742(0x203)]?.['info'](_0x3ea742(0x1bb)+a105_0x39fc19['basename'](_0x44dce4['oldPath'])+_0x3ea742(0x246)+a105_0x39fc19['basename'](_0x44dce4[_0x3ea742(0x23d)])),_0x305657=_0x44dce4['path'];}const _0x4ccf22=getSanitizedPathWithMigration(_0x305657,_0x5e89c2);_0x4ccf22[_0x3ea742(0x1a8)]&&this[_0x3ea742(0x1ce)][_0x3ea742(0x203)]?.[_0x3ea742(0x235)](_0x3ea742(0x1be)+a105_0x39fc19[_0x3ea742(0x21f)](_0x4ccf22[_0x3ea742(0x242)])+_0x3ea742(0x246)+a105_0x39fc19[_0x3ea742(0x21f)](_0x4ccf22[_0x3ea742(0x23d)]));const _0x53490b=_0x4ccf22[_0x3ea742(0x23d)],_0x30cf90=new Map(),_0x4fcdc2=new Map(),_0x39c846=await this[_0x3ea742(0x241)][_0x3ea742(0x253)](_0xaa8a2b),_0x560831=await this[_0x3ea742(0x241)][_0x3ea742(0x1a5)](_0xaa8a2b),_0x48424b=new Map();for(const _0x13797b of _0x39c846){_0x30cf90['set'](_0x13797b['id'],_0x13797b[_0x3ea742(0x22f)][_0x3ea742(0x1e3)]);}for(const _0x448b94 of _0x560831){_0x48424b['set'](_0x448b94['id'],_0x448b94[_0x3ea742(0x22f)][_0x3ea742(0x1e3)]);}for(const _0x415a76 of _0x2b06d9){_0x4fcdc2['set'](_0x415a76['id'],_0x415a76[_0x3ea742(0x22f)]['name']);}const _0x1552a3={'resolveKnowledgeBaseName':async _0x12380c=>_0x30cf90[_0x3ea742(0x1b6)](_0x12380c),'resolveTextKnowledgeBaseName':async _0x2cf892=>_0x48424b[_0x3ea742(0x1b6)](_0x2cf892),'resolveAgentName':async _0x23ee75=>_0x4fcdc2[_0x3ea742(0x1b6)](_0x23ee75),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async()=>undefined,'onWarning':_0x3fa7ca=>this[_0x3ea742(0x1ce)]['logger']?.[_0x3ea742(0x218)](_0x3fa7ca)},_0x2d9cbf=a105_0x39fc19['join'](_0x53490b,_0x3ea742(0x1d8)),_0x308935=a105_0x39fc19[_0x3ea742(0x22e)](_0x53490b,_0x3ea742(0x247)),_0x257d89=a105_0x39fc19[_0x3ea742(0x22e)](_0x53490b,_0x3ea742(0x19e)),_0x5c8f4b=!a105_0x18dc27[_0x3ea742(0x215)](_0x308935);if(_0x26f31b?.[_0x3ea742(0x180)])return{'agentName':_0x5e89c2,'outputPath':_0x53490b,'isNew':_0x5c8f4b,'hasChanges':!![]};a105_0x18dc27[_0x3ea742(0x1bd)](_0x305657,{'recursive':!![]}),a105_0x18dc27[_0x3ea742(0x1bd)](_0x53490b,{'recursive':!![]});const _0x51b48a=a105_0x39fc19[_0x3ea742(0x22e)](_0x305657,_0x3ea742(0x255));!a105_0x18dc27[_0x3ea742(0x215)](_0x51b48a)&&a105_0x18dc27[_0x3ea742(0x1a7)](_0x51b48a,createAgentConfigContent(_0x12d8f2));const {yaml:_0x90bf6d,systemPrompt:_0x430323,starterMessage:_0x3e19df}=await agentResponseToDef(_0x4e6f4d,_0x1552a3);let _0xb5d7aa=_0x5c8f4b;if(!_0x5c8f4b){const _0x194cd7=a105_0x18dc27['existsSync'](_0x2d9cbf)?a105_0x18dc27[_0x3ea742(0x212)](_0x2d9cbf,'utf-8'):'',_0x336020=a105_0x18dc27[_0x3ea742(0x212)](_0x308935,'utf-8');_0xb5d7aa=_0x194cd7!==_0x430323||_0x336020!==toAgentYamlString(_0x90bf6d);}a105_0x18dc27[_0x3ea742(0x1a7)](_0x2d9cbf,_0x430323),a105_0x18dc27[_0x3ea742(0x1a7)](_0x308935,toAgentYamlString(_0x90bf6d));if(_0x3e19df&&_0x3e19df[_0x3ea742(0x17e)]('\x0a'))a105_0x18dc27[_0x3ea742(0x1a7)](_0x257d89,_0x3e19df);else a105_0x18dc27['existsSync'](_0x257d89)&&a105_0x18dc27[_0x3ea742(0x1e2)](_0x257d89);return{'agentName':_0x5e89c2,'outputPath':_0x53490b,'isNew':_0x5c8f4b,'hasChanges':_0xb5d7aa};}async[a105_0x561b8e(0x1b2)](_0x2444c6,_0x213a69){const _0x37aa3e=a105_0x561b8e;let _0x41282e;isAgentYamlPath(_0x2444c6)?_0x41282e=getAgentDirFromYamlPath(_0x2444c6):_0x41282e=_0x2444c6;const {config:_0x54015b}=findAgentConfig(_0x41282e),_0x514f53=await this['resolveProjectId'](_0x54015b[_0x37aa3e(0x236)]),_0x240174=a105_0x39fc19[_0x37aa3e(0x22e)](_0x41282e,'agent.yml'),_0x866d38=a105_0x39fc19[_0x37aa3e(0x22e)](_0x41282e,_0x37aa3e(0x1d8)),_0x351e41=a105_0x39fc19['join'](_0x41282e,'starter_message.md');if(!a105_0x18dc27[_0x37aa3e(0x215)](_0x240174))throw new SDKError(ErrorCode[_0x37aa3e(0x1f4)],_0x37aa3e(0x248)+_0x41282e,undefined,{'helpText':_0x37aa3e(0x229)});const _0x35204f=parseAgentYaml(a105_0x18dc27[_0x37aa3e(0x212)](_0x240174,_0x37aa3e(0x178)),_0x240174),_0x1380fe=a105_0x18dc27[_0x37aa3e(0x215)](_0x866d38)?a105_0x18dc27[_0x37aa3e(0x212)](_0x866d38,_0x37aa3e(0x178)):'',_0x5046ba=a105_0x18dc27['existsSync'](_0x351e41)?a105_0x18dc27['readFileSync'](_0x351e41,_0x37aa3e(0x178)):_0x35204f[_0x37aa3e(0x191)];if(_0x213a69?.[_0x37aa3e(0x180)])return{'agentName':_0x35204f[_0x37aa3e(0x1e3)],'action':'created','projectId':_0x514f53};const _0x570453=await this[_0x37aa3e(0x241)]['listAgentsFull'](_0x514f53),_0x535122=await this['client'][_0x37aa3e(0x253)](_0x514f53),_0x4941e6=await this[_0x37aa3e(0x241)][_0x37aa3e(0x1a5)](_0x514f53),_0x83ba11=new Map(),_0x5ba50c=new Map(),_0x33b75d=new Map();for(const _0x256203 of _0x535122){_0x83ba11['set'](_0x256203['attributes']['name'],_0x256203['id']);}for(const _0xcc1ee9 of _0x4941e6){_0x5ba50c[_0x37aa3e(0x1e6)](_0xcc1ee9['attributes'][_0x37aa3e(0x1e3)],_0xcc1ee9['id']);}for(const _0x56ef3c of _0x570453){_0x33b75d[_0x37aa3e(0x1e6)](_0x56ef3c['attributes'][_0x37aa3e(0x1e3)],_0x56ef3c['id']);}const _0x4e15bd={'projectId':_0x514f53,'resolveKnowledgeBaseId':async _0x4b8c7a=>_0x83ba11[_0x37aa3e(0x1b6)](_0x4b8c7a),'resolveTextKnowledgeBaseId':async _0x4d5736=>_0x5ba50c['get'](_0x4d5736),'resolveAgentId':async _0x53860d=>_0x33b75d[_0x37aa3e(0x1b6)](_0x53860d),'resolveWebSearchToolId':async()=>undefined,'resolveImageGeneratorId':async()=>undefined,'resolvePromptId':async()=>undefined,'onWarning':_0x58c618=>this[_0x37aa3e(0x1ce)][_0x37aa3e(0x203)]?.['warn'](_0x58c618)};try{const _0x18b072=_0x570453[_0x37aa3e(0x1da)](_0x26ed30=>_0x26ed30[_0x37aa3e(0x22f)][_0x37aa3e(0x1e3)]===_0x35204f[_0x37aa3e(0x1e3)]),_0x20ca2a=await agentDefToRequest(_0x35204f,_0x1380fe,_0x5046ba,_0x4e15bd);if(_0x18b072)return await this[_0x37aa3e(0x241)][_0x37aa3e(0x1c2)](_0x18b072['id'],_0x20ca2a),{'agentName':_0x35204f[_0x37aa3e(0x1e3)],'action':_0x37aa3e(0x204),'projectId':_0x514f53,'agentId':_0x18b072['id']};else{const _0x5431f4=await this['client'][_0x37aa3e(0x1a3)](_0x20ca2a);return{'agentName':_0x35204f[_0x37aa3e(0x1e3)],'action':_0x37aa3e(0x24a),'projectId':_0x514f53,'agentId':_0x5431f4['id']};}}catch(_0x45ca55){return{'agentName':_0x35204f[_0x37aa3e(0x1e3)],'action':_0x37aa3e(0x249),'projectId':_0x514f53,'error':_0x45ca55[_0x37aa3e(0x243)]};}}async['cloneProject'](_0x522194,_0x11019a,_0x3a70d1){const _0x50cd98=a105_0x561b8e,_0x474080=a105_0x18dc27['existsSync'](_0x522194)&&a105_0x18dc27[_0x50cd98(0x215)](a105_0x39fc19[_0x50cd98(0x22e)](_0x522194,_0x50cd98(0x255)));let _0x32d28d;const _0x17c1e6=[],_0x2e290d=[],_0x23a1ea=[],_0x2dde73=[];if(_0x474080){const _0xfc323c=loadAgentConfig(a105_0x39fc19['join'](_0x522194,_0x50cd98(0x255)));_0x32d28d=_0xfc323c[_0x50cd98(0x236)];const _0x5e1da5=a105_0x18dc27[_0x50cd98(0x208)](_0x522194,{'withFileTypes':!![]});for(const _0x286a4d of _0x5e1da5){if(!_0x286a4d[_0x50cd98(0x1b1)]())continue;if(['knowledge_bases',_0x50cd98(0x18d),'integrations']['includes'](_0x286a4d[_0x50cd98(0x1e3)]))continue;const _0x494d46=a105_0x39fc19[_0x50cd98(0x22e)](_0x522194,_0x286a4d[_0x50cd98(0x1e3)]);if(isAgentDir(_0x494d46)){const _0x35e914=a105_0x39fc19[_0x50cd98(0x22e)](_0x494d46,_0x50cd98(0x247)),_0xecc698=a105_0x39fc19[_0x50cd98(0x22e)](_0x494d46,_0x50cd98(0x1d8)),_0x1aff5c=a105_0x39fc19[_0x50cd98(0x22e)](_0x494d46,'starter_message.md'),_0x1b0d1a=parseAgentYaml(a105_0x18dc27[_0x50cd98(0x212)](_0x35e914,'utf-8'),_0x35e914),_0x57b565=a105_0x18dc27[_0x50cd98(0x215)](_0xecc698)?a105_0x18dc27['readFileSync'](_0xecc698,_0x50cd98(0x178)):'',_0x2bfe8d=a105_0x18dc27[_0x50cd98(0x215)](_0x1aff5c)?a105_0x18dc27[_0x50cd98(0x212)](_0x1aff5c,'utf-8'):_0x1b0d1a[_0x50cd98(0x191)];_0x17c1e6[_0x50cd98(0x23a)]({'name':_0x1b0d1a[_0x50cd98(0x1e3)],'dir':_0x494d46,'yaml':_0x1b0d1a,'systemPrompt':_0x57b565,'starterMessage':_0x2bfe8d});}}const _0x37cae7=getKnowledgeBasesDir(_0x522194);if(a105_0x18dc27[_0x50cd98(0x215)](_0x37cae7)){const _0x5777b9=a105_0x18dc27[_0x50cd98(0x208)](_0x37cae7);for(const _0x3e2455 of _0x5777b9){const _0x39990d=a105_0x39fc19[_0x50cd98(0x22e)](_0x37cae7,_0x3e2455);if(_0x3e2455[_0x50cd98(0x1f7)](_0x50cd98(0x1f3))){const _0x45194d=parseKnowledgeBaseYaml(a105_0x18dc27[_0x50cd98(0x212)](_0x39990d,_0x50cd98(0x178)),_0x39990d);_0x2e290d[_0x50cd98(0x23a)]({'name':_0x45194d['name'],'path':_0x39990d,'yaml':_0x45194d});}else{if(_0x3e2455[_0x50cd98(0x1f7)]('.md')){const _0x3173d1=a105_0x18dc27['readFileSync'](_0x39990d,_0x50cd98(0x178)),{name:_0x49dc49,text:_0x2731ef}=parseTextKnowledgeBaseMd(_0x3173d1,_0x3e2455);_0x23a1ea[_0x50cd98(0x23a)]({'name':_0x49dc49,'path':_0x39990d,'text':_0x2731ef});}}}}const _0x3c3be1=getPromptsDir(_0x522194);if(a105_0x18dc27['existsSync'](_0x3c3be1)){const _0x3dc90e=a105_0x18dc27[_0x50cd98(0x208)](_0x3c3be1)['filter'](_0x103603=>_0x103603[_0x50cd98(0x1f7)]('.yml'));for(const _0x4d0e8f of _0x3dc90e){const _0x4b557f=a105_0x39fc19[_0x50cd98(0x22e)](_0x3c3be1,_0x4d0e8f),_0x4b5e66=parsePromptYaml(a105_0x18dc27[_0x50cd98(0x212)](_0x4b557f,_0x50cd98(0x178)),_0x4b557f);_0x2dde73[_0x50cd98(0x23a)]({'name':_0x4b5e66[_0x50cd98(0x1e3)],'path':_0x4b557f,'yaml':_0x4b5e66});}}}else{const _0x209a97=await this[_0x50cd98(0x189)](_0x522194),_0x59c12d=await this[_0x50cd98(0x241)]['getProject'](_0x209a97);_0x32d28d=_0x59c12d[_0x50cd98(0x22f)]['name'];const _0x50691f=await this[_0x50cd98(0x241)]['listAgentsFull'](_0x209a97),_0x309d33=await this[_0x50cd98(0x241)][_0x50cd98(0x253)](_0x209a97),_0x37dbab=await this[_0x50cd98(0x241)][_0x50cd98(0x1a5)](_0x209a97),_0x17119=await this[_0x50cd98(0x241)]['listPrompts'](_0x209a97),_0x245bb6=new Map(),_0x1772a5=new Map(),_0x26ea88=new Map(),_0x192b00=new Map();for(const _0x405c99 of _0x309d33){_0x245bb6[_0x50cd98(0x1e6)](_0x405c99['id'],_0x405c99['attributes'][_0x50cd98(0x1e3)]);}for(const _0x149074 of _0x37dbab){_0x1772a5[_0x50cd98(0x1e6)](_0x149074['id'],_0x149074[_0x50cd98(0x22f)][_0x50cd98(0x1e3)]);}for(const _0x423ca5 of _0x50691f){_0x26ea88[_0x50cd98(0x1e6)](_0x423ca5['id'],_0x423ca5['attributes']['name']);}for(const _0x47ee11 of _0x17119){_0x192b00['set'](_0x47ee11['id'],_0x47ee11[_0x50cd98(0x22f)][_0x50cd98(0x1e3)]);}const _0x109c9c={'resolveKnowledgeBaseName':async _0x176069=>_0x245bb6[_0x50cd98(0x1b6)](_0x176069),'resolveTextKnowledgeBaseName':async _0x281dda=>_0x1772a5[_0x50cd98(0x1b6)](_0x281dda),'resolveAgentName':async _0x301943=>_0x26ea88[_0x50cd98(0x1b6)](_0x301943),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async _0x590595=>_0x192b00[_0x50cd98(0x1b6)](_0x590595),'onWarning':_0x5f4fe7=>this[_0x50cd98(0x1ce)][_0x50cd98(0x203)]?.[_0x50cd98(0x218)](_0x5f4fe7)};for(const _0x4c91ba of _0x50691f){const _0x52dc65=await agentResponseToDef(_0x4c91ba,_0x109c9c),{yaml:_0x13b89b,systemPrompt:_0x2a94cb,starterMessage:_0x413555}=_0x52dc65;_0x17c1e6[_0x50cd98(0x23a)]({'name':_0x13b89b['name'],'dir':'','yaml':_0x13b89b,'systemPrompt':_0x2a94cb,'starterMessage':_0x413555});}for(const _0x1ea5c5 of _0x309d33){const _0x2a963=apiKnowledgeBaseToYaml(_0x1ea5c5);_0x2e290d['push']({'name':_0x2a963[_0x50cd98(0x1e3)],'path':'','yaml':_0x2a963});}for(const _0x4b6c79 of _0x37dbab){_0x23a1ea['push']({'name':_0x4b6c79[_0x50cd98(0x22f)]['name'],'path':'','text':_0x4b6c79['attributes'][_0x50cd98(0x1bf)]});}for(const _0x105dbb of _0x17119){const _0x249fdd=await apiPromptToYaml(_0x105dbb,_0x109c9c);_0x249fdd&&_0x2dde73[_0x50cd98(0x23a)]({'name':_0x249fdd['name'],'path':'','yaml':_0x249fdd});}}const _0x209ab9={'sourceProjectName':_0x32d28d,'newProjectName':_0x11019a,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'imageGenerators':{'created':0x0,'errors':0x0},'webSearchTools':{'created':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x5bf778=await this['client'][_0x50cd98(0x1c6)](),_0x3d3f62=_0x5bf778[_0x50cd98(0x1da)](_0x370a26=>_0x370a26['attributes'][_0x50cd98(0x1e3)]===_0x11019a);if(_0x3d3f62)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x50cd98(0x1c9)+_0x11019a+_0x50cd98(0x1e1),undefined,{'helpText':_0x50cd98(0x21d)});if(_0x3a70d1?.[_0x50cd98(0x180)])return _0x209ab9[_0x50cd98(0x1dc)][_0x50cd98(0x1b5)][_0x50cd98(0x24a)]=_0x17c1e6['length'],_0x209ab9['counts']['knowledgeBases'][_0x50cd98(0x24a)]=_0x2e290d[_0x50cd98(0x18e)],_0x209ab9[_0x50cd98(0x1dc)]['textKnowledgeBases'][_0x50cd98(0x24a)]=_0x23a1ea[_0x50cd98(0x18e)],_0x209ab9[_0x50cd98(0x1dc)]['prompts'][_0x50cd98(0x24a)]=_0x2dde73[_0x50cd98(0x18e)],_0x209ab9;const _0x4e923e=await this[_0x50cd98(0x241)][_0x50cd98(0x195)]({'name':_0x11019a}),_0xfccd93=_0x4e923e['id'];_0x209ab9[_0x50cd98(0x1a9)]=_0xfccd93;const _0x23bc65=new Map(),_0x2a49af=new Map(),_0x2ba38d=new Map(),_0x15fa28=new Map(),_0x54296d=new Map(),_0x3ed844=new Map(),_0xf276fd=new Set(),_0x2e26e0=new Set();for(const _0x4caea8 of _0x17c1e6){for(const _0x21def3 of _0x4caea8[_0x50cd98(0x192)][_0x50cd98(0x1b7)]||[]){if(_0x21def3[_0x50cd98(0x1e5)]===_0x50cd98(0x19b)){const _0x46dbc6=parseRef(_0x21def3[_0x50cd98(0x181)]);if(_0x46dbc6)_0xf276fd['add'](_0x46dbc6[_0x50cd98(0x1e3)]);}else{if(_0x21def3['type']===_0x50cd98(0x179)){const _0x458f18=parseRef(_0x21def3[_0x50cd98(0x181)]);if(_0x458f18)_0x2e26e0[_0x50cd98(0x240)](_0x458f18[_0x50cd98(0x1e3)]);}}}}for(const _0x163496 of _0xf276fd){try{const _0x40f0aa=await this[_0x50cd98(0x241)][_0x50cd98(0x183)]({'projectId':_0xfccd93,'name':_0x163496});_0x54296d[_0x50cd98(0x1e6)](_0x163496,_0x40f0aa['id']),_0x209ab9['imageGenerators']['push']({'name':_0x163496,'action':_0x50cd98(0x24a),'id':_0x40f0aa['id']}),_0x209ab9[_0x50cd98(0x1dc)]['imageGenerators'][_0x50cd98(0x24a)]++;}catch(_0x988fb9){_0x209ab9[_0x50cd98(0x1ea)][_0x50cd98(0x23a)]({'name':_0x163496,'action':_0x50cd98(0x249),'error':_0x988fb9['message']}),_0x209ab9[_0x50cd98(0x1dc)][_0x50cd98(0x1ea)][_0x50cd98(0x24e)]++;}}for(const _0x13f13e of _0x2e26e0){try{const _0x50f117=await this['client'][_0x50cd98(0x1cd)]({'projectId':_0xfccd93,'name':_0x13f13e});_0x3ed844[_0x50cd98(0x1e6)](_0x13f13e,_0x50f117['id']),_0x209ab9[_0x50cd98(0x1af)][_0x50cd98(0x23a)]({'name':_0x13f13e,'action':_0x50cd98(0x24a),'id':_0x50f117['id']}),_0x209ab9['counts'][_0x50cd98(0x1af)][_0x50cd98(0x24a)]++;}catch(_0x54f598){_0x209ab9[_0x50cd98(0x1af)][_0x50cd98(0x23a)]({'name':_0x13f13e,'action':_0x50cd98(0x249),'error':_0x54f598[_0x50cd98(0x243)]}),_0x209ab9[_0x50cd98(0x1dc)][_0x50cd98(0x1af)][_0x50cd98(0x24e)]++;}}const _0x1dd02a={'projectId':_0xfccd93,'resolveKnowledgeBaseId':async _0x1a93c8=>_0x23bc65[_0x50cd98(0x1b6)](_0x1a93c8),'resolveTextKnowledgeBaseId':async _0x5b04af=>_0x2a49af[_0x50cd98(0x1b6)](_0x5b04af),'resolveAgentId':async _0x34994c=>_0x2ba38d['get'](_0x34994c),'resolveWebSearchToolId':async _0x1dfe47=>_0x3ed844[_0x50cd98(0x1b6)](_0x1dfe47),'resolveImageGeneratorId':async _0x57b241=>_0x54296d['get'](_0x57b241),'resolvePromptId':async _0xfbcbb6=>_0x15fa28[_0x50cd98(0x1b6)](_0xfbcbb6),'onWarning':_0x5ddc9b=>this[_0x50cd98(0x1ce)][_0x50cd98(0x203)]?.[_0x50cd98(0x218)](_0x5ddc9b)};for(const _0x23a04a of _0x2e290d){try{const _0x3288b4=yamlKnowledgeBaseToApi(_0x23a04a[_0x50cd98(0x192)],_0xfccd93),_0x1a2532=await this[_0x50cd98(0x241)][_0x50cd98(0x250)](_0x3288b4);_0x23bc65['set'](_0x23a04a[_0x50cd98(0x192)][_0x50cd98(0x1e3)],_0x1a2532['id']),_0x209ab9[_0x50cd98(0x19f)][_0x50cd98(0x23a)]({'name':_0x23a04a['yaml'][_0x50cd98(0x1e3)],'action':'created','id':_0x1a2532['id']}),_0x209ab9[_0x50cd98(0x1dc)][_0x50cd98(0x19f)][_0x50cd98(0x24a)]++;}catch(_0x4cd690){_0x209ab9[_0x50cd98(0x19f)][_0x50cd98(0x23a)]({'name':_0x23a04a[_0x50cd98(0x192)][_0x50cd98(0x1e3)],'action':_0x50cd98(0x249),'error':_0x4cd690[_0x50cd98(0x243)]}),_0x209ab9['counts'][_0x50cd98(0x19f)][_0x50cd98(0x24e)]++;}}for(const _0x1b04cb of _0x23a1ea){try{const _0x403246=yamlTextKnowledgeBaseToApi({'name':_0x1b04cb[_0x50cd98(0x1e3)],'text':_0x1b04cb[_0x50cd98(0x1bf)]},_0xfccd93),_0x52cd64=await this[_0x50cd98(0x241)][_0x50cd98(0x1ae)](_0x403246);_0x2a49af[_0x50cd98(0x1e6)](_0x1b04cb[_0x50cd98(0x1e3)],_0x52cd64['id']),_0x209ab9[_0x50cd98(0x254)][_0x50cd98(0x23a)]({'name':_0x1b04cb[_0x50cd98(0x1e3)],'action':_0x50cd98(0x24a),'id':_0x52cd64['id']}),_0x209ab9[_0x50cd98(0x1dc)][_0x50cd98(0x254)][_0x50cd98(0x24a)]++;}catch(_0x589fd9){_0x209ab9[_0x50cd98(0x254)][_0x50cd98(0x23a)]({'name':_0x1b04cb[_0x50cd98(0x1e3)],'action':_0x50cd98(0x249),'error':_0x589fd9[_0x50cd98(0x243)]}),_0x209ab9[_0x50cd98(0x1dc)][_0x50cd98(0x254)][_0x50cd98(0x24e)]++;}}const _0x3baf0c=[..._0x17c1e6][_0x50cd98(0x207)]((_0x56b553,_0x5634a0)=>{const _0x565886=_0x50cd98,_0x9d84ab=_0x56b553['yaml'][_0x565886(0x1b7)]?.[_0x565886(0x1ed)](_0x5b370e=>_0x5b370e[_0x565886(0x1e5)]===_0x565886(0x1cc))??![],_0x2fbdf4=_0x5634a0[_0x565886(0x192)][_0x565886(0x1b7)]?.[_0x565886(0x1ed)](_0x4d912f=>_0x4d912f[_0x565886(0x1e5)]==='agent')??![];if(_0x9d84ab&&!_0x2fbdf4)return 0x1;if(!_0x9d84ab&&_0x2fbdf4)return-0x1;return 0x0;});for(const _0x28943e of _0x3baf0c){try{const _0xedc6ab=_0x28943e[_0x50cd98(0x192)][_0x50cd98(0x1b7)]?.[_0x50cd98(0x1c8)](_0x3a7a05=>{const _0x5e9d3e=_0x50cd98;if(_0x3a7a05[_0x5e9d3e(0x1e5)]===_0x5e9d3e(0x1cc)){const _0x12d6ab=parseRef(_0x3a7a05[_0x5e9d3e(0x181)]);return _0x12d6ab?.[_0x5e9d3e(0x1e3)]===_0x28943e[_0x5e9d3e(0x192)][_0x5e9d3e(0x1e3)];}return![];})??[];_0xedc6ab[_0x50cd98(0x18e)]>0x0&&this[_0x50cd98(0x1ce)]['logger']?.[_0x50cd98(0x218)](_0x50cd98(0x21e)+_0x28943e['yaml'][_0x50cd98(0x1e3)]+_0x50cd98(0x1ee)+_0x50cd98(0x24f));const _0x327028=await agentDefToRequest(_0x28943e[_0x50cd98(0x192)],_0x28943e[_0x50cd98(0x19a)],_0x28943e[_0x50cd98(0x209)],_0x1dd02a),_0x4f0136=await this[_0x50cd98(0x241)]['createAgentResponse'](_0x327028);_0x2ba38d[_0x50cd98(0x1e6)](_0x28943e[_0x50cd98(0x192)][_0x50cd98(0x1e3)],_0x4f0136['id']),_0x209ab9['agents'][_0x50cd98(0x23a)]({'agentName':_0x28943e[_0x50cd98(0x192)][_0x50cd98(0x1e3)],'action':_0x50cd98(0x24a),'agentId':_0x4f0136['id']}),_0x209ab9[_0x50cd98(0x1dc)][_0x50cd98(0x1b5)]['created']++;}catch(_0x3a7199){_0x209ab9[_0x50cd98(0x1b5)][_0x50cd98(0x23a)]({'agentName':_0x28943e['yaml'][_0x50cd98(0x1e3)],'action':_0x50cd98(0x249),'error':_0x3a7199[_0x50cd98(0x243)]}),_0x209ab9[_0x50cd98(0x1dc)][_0x50cd98(0x1b5)]['errors']++;}}for(const _0x5f2dec of _0x2dde73){try{const _0xf4b170=await yamlPromptToApi(_0x5f2dec[_0x50cd98(0x192)],_0xfccd93,_0x1dd02a);if(!_0xf4b170){_0x209ab9[_0x50cd98(0x18d)][_0x50cd98(0x23a)]({'name':_0x5f2dec[_0x50cd98(0x192)][_0x50cd98(0x1e3)],'action':_0x50cd98(0x249),'error':_0x50cd98(0x22d)}),_0x209ab9['counts'][_0x50cd98(0x18d)][_0x50cd98(0x24e)]++;continue;}const _0x581f25=await this[_0x50cd98(0x241)][_0x50cd98(0x245)](_0xf4b170);_0x15fa28['set'](_0x5f2dec[_0x50cd98(0x192)][_0x50cd98(0x1e3)],_0x581f25['id']),_0x209ab9[_0x50cd98(0x18d)]['push']({'name':_0x5f2dec[_0x50cd98(0x192)][_0x50cd98(0x1e3)],'action':_0x50cd98(0x24a),'id':_0x581f25['id']}),_0x209ab9['counts'][_0x50cd98(0x18d)][_0x50cd98(0x24a)]++;}catch(_0x90862){_0x209ab9[_0x50cd98(0x18d)][_0x50cd98(0x23a)]({'name':_0x5f2dec[_0x50cd98(0x192)][_0x50cd98(0x1e3)],'action':'error','error':_0x90862['message']}),_0x209ab9[_0x50cd98(0x1dc)]['prompts'][_0x50cd98(0x24e)]++;}}return _0x209ab9;}}
@@ -1 +1 @@
1
- (function(_0x4618a3,_0x29b13f){const _0x3e9479=a106_0x11d1,_0x1938c4=_0x4618a3();while(!![]){try{const _0x4832de=parseInt(_0x3e9479(0x121))/0x1+parseInt(_0x3e9479(0x131))/0x2*(-parseInt(_0x3e9479(0x124))/0x3)+-parseInt(_0x3e9479(0x12f))/0x4+-parseInt(_0x3e9479(0x12b))/0x5*(parseInt(_0x3e9479(0x130))/0x6)+-parseInt(_0x3e9479(0x123))/0x7*(-parseInt(_0x3e9479(0x122))/0x8)+parseInt(_0x3e9479(0x12c))/0x9*(parseInt(_0x3e9479(0x127))/0xa)+parseInt(_0x3e9479(0x120))/0xb*(-parseInt(_0x3e9479(0x128))/0xc);if(_0x4832de===_0x29b13f)break;else _0x1938c4['push'](_0x1938c4['shift']());}catch(_0x4df707){_0x1938c4['push'](_0x1938c4['shift']());}}}(a106_0x4a68,0xb87f9));export function canCreateAgent(_0x5e9682,_0x4fe7cb){const _0x25fce6=a106_0x11d1;for(const _0x3ba68e of _0x5e9682['attributes'][_0x25fce6(0x125)]){if(_0x3ba68e[_0x25fce6(0x12d)]&&!_0x4fe7cb[_0x25fce6(0x12e)](_0x3ba68e['targetAgentId']))return![];}return!![];}export function remapToolIds(_0x10ae67,_0x228ee8,_0x4ecce1){const _0x43d0c2=a106_0x11d1;return _0x10ae67[_0x43d0c2(0x126)](_0x47eb1b=>({..._0x47eb1b,'targetKnowledgeBaseId':_0x47eb1b[_0x43d0c2(0x132)]?_0x228ee8[_0x43d0c2(0x12a)](_0x47eb1b['targetKnowledgeBaseId'])||_0x47eb1b[_0x43d0c2(0x132)]:undefined,'targetAgentId':_0x47eb1b[_0x43d0c2(0x12d)]?_0x4ecce1[_0x43d0c2(0x12a)](_0x47eb1b[_0x43d0c2(0x12d)])||_0x47eb1b[_0x43d0c2(0x12d)]:undefined}));}function a106_0x4a68(){const _0x8d83f9=['has','1114896prMSxL','1065612dWObdI','251234ARfbrb','targetKnowledgeBaseId','15114AcuoKy','1174459RjwEtj','120URnSky','470127Vedpvu','6HpwimZ','tools','map','50qSVPgw','11844YbAzeF','1.0','get','20LrOtQb','2106603lEvpAq','targetAgentId'];a106_0x4a68=function(){return _0x8d83f9;};return a106_0x4a68();}function a106_0x11d1(_0x41f90d,_0x3e5570){_0x41f90d=_0x41f90d-0x120;const _0x4a6819=a106_0x4a68();let _0x11d150=_0x4a6819[_0x41f90d];return _0x11d150;}export function remapVariableIds(_0x2ae593,_0x328b93){const _0x31ed04=a106_0x11d1;return _0x2ae593[_0x31ed04(0x126)](_0xe292ff=>({..._0xe292ff,'targetKnowledgeBaseId':_0x328b93[_0x31ed04(0x12a)](_0xe292ff[_0x31ed04(0x132)])||_0xe292ff[_0x31ed04(0x132)]}));}export function isSupportedBackupVersion(_0x2b1277){const _0x49a535=a106_0x11d1;return _0x2b1277===_0x49a535(0x129);}
1
+ (function(_0xabe3b3,_0x380fe9){const _0x51411d=a106_0x37e0,_0x3ea201=_0xabe3b3();while(!![]){try{const _0x1d60c7=-parseInt(_0x51411d(0x155))/0x1+-parseInt(_0x51411d(0x154))/0x2+-parseInt(_0x51411d(0x14c))/0x3*(parseInt(_0x51411d(0x14d))/0x4)+-parseInt(_0x51411d(0x14a))/0x5*(-parseInt(_0x51411d(0x150))/0x6)+-parseInt(_0x51411d(0x148))/0x7*(-parseInt(_0x51411d(0x14b))/0x8)+-parseInt(_0x51411d(0x151))/0x9*(parseInt(_0x51411d(0x14e))/0xa)+parseInt(_0x51411d(0x14f))/0xb;if(_0x1d60c7===_0x380fe9)break;else _0x3ea201['push'](_0x3ea201['shift']());}catch(_0x4a0f92){_0x3ea201['push'](_0x3ea201['shift']());}}}(a106_0x5c9d,0x81bf5));export function canCreateAgent(_0x542052,_0xa3ab71){const _0x174663=a106_0x37e0;for(const _0x41c633 of _0x542052[_0x174663(0x153)][_0x174663(0x152)]){if(_0x41c633[_0x174663(0x145)]&&!_0xa3ab71['has'](_0x41c633[_0x174663(0x145)]))return![];}return!![];}export function remapToolIds(_0x12aba1,_0x4f8f28,_0x5b6e98){const _0x5b208b=a106_0x37e0;return _0x12aba1[_0x5b208b(0x149)](_0x5e04f1=>({..._0x5e04f1,'targetKnowledgeBaseId':_0x5e04f1[_0x5b208b(0x146)]?_0x4f8f28[_0x5b208b(0x147)](_0x5e04f1[_0x5b208b(0x146)])||_0x5e04f1['targetKnowledgeBaseId']:undefined,'targetAgentId':_0x5e04f1['targetAgentId']?_0x5b6e98[_0x5b208b(0x147)](_0x5e04f1[_0x5b208b(0x145)])||_0x5e04f1[_0x5b208b(0x145)]:undefined}));}function a106_0x5c9d(){const _0x1198a3=['544HRASLr','176835OkPDvI','8hghmWg','150nUgsas','13349325gMFPEX','504330GdylDv','447237yyfMEb','tools','attributes','623810BgSMzY','792053gouyNQ','targetAgentId','targetKnowledgeBaseId','get','71722gjHbtx','map','35XMKHbw'];a106_0x5c9d=function(){return _0x1198a3;};return a106_0x5c9d();}export function remapVariableIds(_0x4612c0,_0x430747){const _0x1b9ac9=a106_0x37e0;return _0x4612c0[_0x1b9ac9(0x149)](_0x1d3065=>({..._0x1d3065,'targetKnowledgeBaseId':_0x430747[_0x1b9ac9(0x147)](_0x1d3065['targetKnowledgeBaseId'])||_0x1d3065[_0x1b9ac9(0x146)]}));}function a106_0x37e0(_0x21255d,_0xcac42c){_0x21255d=_0x21255d-0x145;const _0x5c9d6d=a106_0x5c9d();let _0x37e087=_0x5c9d6d[_0x21255d];return _0x37e087;}export function isSupportedBackupVersion(_0x3b3ec0){return _0x3b3ec0==='1.0';}
@@ -1 +1 @@
1
- function a107_0x92fa(){const _0x1d345a=['toLowerCase','133iJdeue','1029150FbWxHY','3kNmlLT','8UxzenD','match','7561850BmSdOR','claude-4.5-sonnet','336321NPEcYW','2vDDvie','1264452eevPCd','174222dzXdyI','1018661PtpxQn','7082240vRjTZq','claude-4.5-haiku'];a107_0x92fa=function(){return _0x1d345a;};return a107_0x92fa();}const a107_0x11e4ba=a107_0x3eaf;function a107_0x3eaf(_0x29ae47,_0x5c7487){_0x29ae47=_0x29ae47-0xec;const _0x92fad0=a107_0x92fa();let _0x3eafb4=_0x92fad0[_0x29ae47];return _0x3eafb4;}(function(_0x52a6a7,_0x12e9a0){const _0x1878f7=a107_0x3eaf,_0x358d17=_0x52a6a7();while(!![]){try{const _0x472c24=-parseInt(_0x1878f7(0xf6))/0x1*(-parseInt(_0x1878f7(0xf3))/0x2)+parseInt(_0x1878f7(0xed))/0x3*(-parseInt(_0x1878f7(0xf4))/0x4)+parseInt(_0x1878f7(0xf0))/0x5+-parseInt(_0x1878f7(0xf5))/0x6*(parseInt(_0x1878f7(0xfa))/0x7)+parseInt(_0x1878f7(0xee))/0x8*(-parseInt(_0x1878f7(0xf2))/0x9)+-parseInt(_0x1878f7(0xec))/0xa+-parseInt(_0x1878f7(0xf7))/0xb;if(_0x472c24===_0x12e9a0)break;else _0x358d17['push'](_0x358d17['shift']());}catch(_0x5f50db){_0x358d17['push'](_0x358d17['shift']());}}}(a107_0x92fa,0xd69f3));const MODEL_ALIASES={'haiku':a107_0x11e4ba(0xf8),'sonnet':a107_0x11e4ba(0xf1)};export function extractModelAlias(_0x106949){const _0x5ef277=a107_0x11e4ba,_0x1283ef=_0x106949[_0x5ef277(0xef)](/^claude-(?:\d+-)?(?:\d+-?)?(sonnet|haiku|opus)/i);if(_0x1283ef)return _0x1283ef[0x1][_0x5ef277(0xf9)]();return _0x106949;}export function resolveModelAlias(_0x4cc217){const _0x1b8b5b=a107_0x11e4ba;return MODEL_ALIASES[_0x4cc217[_0x1b8b5b(0xf9)]()]||_0x4cc217;}export function getModelAliases(){return{...MODEL_ALIASES};}
1
+ const a107_0x4e3941=a107_0x2f60;function a107_0x3893(){const _0x3a1b46=['7pTXZTe','8eHyMqs','6899618faQndC','1386810giZoEY','12801512coHNPS','claude-4.5-haiku','toLowerCase','70JmJKli','327331jivslz','65FOdrMm','154668RQPVCL','12dFyApG','40356HqipPE','claude-4.5-sonnet','match','124164kiarYd'];a107_0x3893=function(){return _0x3a1b46;};return a107_0x3893();}(function(_0x322036,_0x67cddd){const _0x1aed80=a107_0x2f60,_0x40db02=_0x322036();while(!![]){try{const _0x218f0e=parseInt(_0x1aed80(0xd4))/0x1+-parseInt(_0x1aed80(0xcd))/0x2*(parseInt(_0x1aed80(0xd6))/0x3)+parseInt(_0x1aed80(0xcb))/0x4*(-parseInt(_0x1aed80(0xd5))/0x5)+-parseInt(_0x1aed80(0xd8))/0x6+parseInt(_0x1aed80(0xcc))/0x7*(parseInt(_0x1aed80(0xd0))/0x8)+parseInt(_0x1aed80(0xcf))/0x9*(-parseInt(_0x1aed80(0xd3))/0xa)+parseInt(_0x1aed80(0xce))/0xb*(parseInt(_0x1aed80(0xd7))/0xc);if(_0x218f0e===_0x67cddd)break;else _0x40db02['push'](_0x40db02['shift']());}catch(_0x4feb74){_0x40db02['push'](_0x40db02['shift']());}}}(a107_0x3893,0xd1dfd));const MODEL_ALIASES={'haiku':a107_0x4e3941(0xd1),'sonnet':a107_0x4e3941(0xd9)};export function extractModelAlias(_0x52966c){const _0x17607f=a107_0x4e3941,_0xc58a9f=_0x52966c[_0x17607f(0xca)](/^claude-(?:\d+-)?(?:\d+-?)?(sonnet|haiku|opus)/i);if(_0xc58a9f)return _0xc58a9f[0x1][_0x17607f(0xd2)]();return _0x52966c;}export function resolveModelAlias(_0x60debf){const _0x12fa48=a107_0x4e3941;return MODEL_ALIASES[_0x60debf[_0x12fa48(0xd2)]()]||_0x60debf;}function a107_0x2f60(_0xd5433,_0x12bb34){_0xd5433=_0xd5433-0xca;const _0x3893e1=a107_0x3893();let _0x2f60e4=_0x3893e1[_0xd5433];return _0x2f60e4;}export function getModelAliases(){return{...MODEL_ALIASES};}
@@ -1 +1 @@
1
- (function(_0x332b7a,_0x1b49d6){const _0x306841=a108_0x122f,_0x44297b=_0x332b7a();while(!![]){try{const _0x4a74c9=-parseInt(_0x306841(0x14d))/0x1+parseInt(_0x306841(0x157))/0x2*(parseInt(_0x306841(0x15a))/0x3)+-parseInt(_0x306841(0x161))/0x4*(-parseInt(_0x306841(0x15e))/0x5)+parseInt(_0x306841(0x146))/0x6*(parseInt(_0x306841(0x152))/0x7)+parseInt(_0x306841(0x150))/0x8*(parseInt(_0x306841(0x14f))/0x9)+-parseInt(_0x306841(0x158))/0xa*(-parseInt(_0x306841(0x14b))/0xb)+parseInt(_0x306841(0x15b))/0xc*(-parseInt(_0x306841(0x15f))/0xd);if(_0x4a74c9===_0x1b49d6)break;else _0x44297b['push'](_0x44297b['shift']());}catch(_0x165d41){_0x44297b['push'](_0x44297b['shift']());}}}(a108_0x230c,0x4d842));export const MODEL_FACTORS={'sonnet':0xa,'claude-4.5-sonnet':0xa,'claude-sonnet-4':0xa,'haiku':3.4,'claude-4.5-haiku':3.4,'claude-haiku-4':3.4,'opus':0xf,'claude-4-opus':0xf,'claude-opus-4':0xf};function a108_0x230c(){const _0x57c0bd=['425212bTYImk','3255710CJEGeT','Haiku\x204','3Tdepow','141132BWmbhP','4.5','Haiku\x204.5','985tTUqko','1391FctPJV','Claude','6928xWNQMl','54pNEBsz','default','toLocaleString','en-US','Sonnet\x204.5','11DkcNRe','toLowerCase','72091LlVXrR','includes','6462uHIRPA','3176wiahIK','4-5','376131LdlLXJ','Sonnet\x204','opus','haiku','sonnet'];a108_0x230c=function(){return _0x57c0bd;};return a108_0x230c();}export const CONTEXT_LIMITS={'sonnet':0x30d40,'haiku':0x30d40,'opus':0x30d40,'default':0x30d40};export function getModelFactor(_0x566a04){const _0x3680d4=a108_0x122f,_0xd25c1=_0x566a04['toLowerCase']();if(MODEL_FACTORS[_0xd25c1])return MODEL_FACTORS[_0xd25c1];if(_0xd25c1[_0x3680d4(0x14e)](_0x3680d4(0x156)))return MODEL_FACTORS['sonnet'];if(_0xd25c1[_0x3680d4(0x14e)](_0x3680d4(0x155)))return MODEL_FACTORS[_0x3680d4(0x155)];if(_0xd25c1[_0x3680d4(0x14e)]('opus'))return MODEL_FACTORS['opus'];return MODEL_FACTORS[_0x3680d4(0x156)];}function a108_0x122f(_0x291380,_0x582f45){_0x291380=_0x291380-0x146;const _0x230c87=a108_0x230c();let _0x122f40=_0x230c87[_0x291380];return _0x122f40;}export function getContextLimit(_0x4505a5){const _0x3f29f6=a108_0x122f,_0x1c1f80=_0x4505a5[_0x3f29f6(0x14c)]();if(_0x1c1f80[_0x3f29f6(0x14e)](_0x3f29f6(0x156)))return CONTEXT_LIMITS[_0x3f29f6(0x156)];if(_0x1c1f80[_0x3f29f6(0x14e)](_0x3f29f6(0x155)))return CONTEXT_LIMITS['haiku'];if(_0x1c1f80[_0x3f29f6(0x14e)](_0x3f29f6(0x154)))return CONTEXT_LIMITS[_0x3f29f6(0x154)];return CONTEXT_LIMITS[_0x3f29f6(0x147)];}export function calculateChatUnit(_0x3b5279,_0x3d1ade,_0x14ff8f){return(_0x3b5279+_0x3d1ade)/0x1388*_0x14ff8f;}export function calculateCredits(_0x30cafc){return _0x30cafc/0x2904;}export function getModelDisplayName(_0x6634c6){const _0x4582ef=a108_0x122f,_0x32ed93=_0x6634c6['toLowerCase']();if(_0x32ed93[_0x4582ef(0x14e)](_0x4582ef(0x156))){if(_0x32ed93[_0x4582ef(0x14e)]('4-5')||_0x32ed93[_0x4582ef(0x14e)](_0x4582ef(0x15c)))return _0x4582ef(0x14a);return _0x4582ef(0x153);}if(_0x32ed93[_0x4582ef(0x14e)](_0x4582ef(0x155))){if(_0x32ed93[_0x4582ef(0x14e)](_0x4582ef(0x151))||_0x32ed93[_0x4582ef(0x14e)](_0x4582ef(0x15c)))return _0x4582ef(0x15d);return _0x4582ef(0x159);}if(_0x32ed93[_0x4582ef(0x14e)]('opus')){if(_0x32ed93[_0x4582ef(0x14e)](_0x4582ef(0x151))||_0x32ed93[_0x4582ef(0x14e)](_0x4582ef(0x15c)))return'Opus\x204.5';return'Opus\x204';}return _0x4582ef(0x160);}export function formatTokenCount(_0x101a72){const _0x3a74ea=a108_0x122f;return _0x101a72[_0x3a74ea(0x148)](_0x3a74ea(0x149));}export function calculateContextPercentage(_0x590cbd,_0x33ce00){const _0x9f2288=getContextLimit(_0x33ce00);return Math['round'](_0x590cbd/_0x9f2288*0x64);}
1
+ (function(_0x5d5d66,_0x1fd7e6){const _0x361685=a108_0x386c,_0x3daa7d=_0x5d5d66();while(!![]){try{const _0xad6276=parseInt(_0x361685(0x1dc))/0x1+-parseInt(_0x361685(0x1e4))/0x2*(parseInt(_0x361685(0x1e6))/0x3)+-parseInt(_0x361685(0x1df))/0x4+parseInt(_0x361685(0x1db))/0x5+-parseInt(_0x361685(0x1d6))/0x6+parseInt(_0x361685(0x1e9))/0x7+parseInt(_0x361685(0x1e2))/0x8*(parseInt(_0x361685(0x1e7))/0x9);if(_0xad6276===_0x1fd7e6)break;else _0x3daa7d['push'](_0x3daa7d['shift']());}catch(_0x249717){_0x3daa7d['push'](_0x3daa7d['shift']());}}}(a108_0x3a7b,0x25f72));export const MODEL_FACTORS={'sonnet':0xa,'claude-4.5-sonnet':0xa,'claude-sonnet-4':0xa,'haiku':3.4,'claude-4.5-haiku':3.4,'claude-haiku-4':3.4,'opus':0xf,'claude-4-opus':0xf,'claude-opus-4':0xf};export const CONTEXT_LIMITS={'sonnet':0x30d40,'haiku':0x30d40,'opus':0x30d40,'default':0x30d40};export function getModelFactor(_0x920e53){const _0x28cff3=a108_0x386c,_0x169fca=_0x920e53['toLowerCase']();if(MODEL_FACTORS[_0x169fca])return MODEL_FACTORS[_0x169fca];if(_0x169fca[_0x28cff3(0x1e1)]('sonnet'))return MODEL_FACTORS['sonnet'];if(_0x169fca[_0x28cff3(0x1e1)]('haiku'))return MODEL_FACTORS[_0x28cff3(0x1ea)];if(_0x169fca['includes'](_0x28cff3(0x1e3)))return MODEL_FACTORS[_0x28cff3(0x1e3)];return MODEL_FACTORS[_0x28cff3(0x1e5)];}export function getContextLimit(_0x4215b7){const _0x3b8686=a108_0x386c,_0x4cf4fe=_0x4215b7[_0x3b8686(0x1e0)]();if(_0x4cf4fe[_0x3b8686(0x1e1)](_0x3b8686(0x1e5)))return CONTEXT_LIMITS[_0x3b8686(0x1e5)];if(_0x4cf4fe[_0x3b8686(0x1e1)]('haiku'))return CONTEXT_LIMITS['haiku'];if(_0x4cf4fe[_0x3b8686(0x1e1)](_0x3b8686(0x1e3)))return CONTEXT_LIMITS[_0x3b8686(0x1e3)];return CONTEXT_LIMITS[_0x3b8686(0x1d9)];}export function calculateChatUnit(_0xf0c387,_0x4fa971,_0x2bc4ba){return(_0xf0c387+_0x4fa971)/0x1388*_0x2bc4ba;}function a108_0x386c(_0x3a79fa,_0x10245b){_0x3a79fa=_0x3a79fa-0x1d4;const _0x3a7b46=a108_0x3a7b();let _0x386cf3=_0x3a7b46[_0x3a79fa];return _0x386cf3;}export function calculateCredits(_0x1648ab){return _0x1648ab/0x2904;}function a108_0x3a7b(){const _0x3d5b6a=['opus','116fLbOnW','sonnet','15684ShxmRu','375651THnDyH','Sonnet\x204','1141546RcupWl','haiku','Haiku\x204','4-5','round','1631328mFlurx','Claude','4.5','default','Opus\x204','485270KbIuOm','237560BkhrGA','en-US','toLocaleString','904812RLHMLA','toLowerCase','includes','88YVSCDi'];a108_0x3a7b=function(){return _0x3d5b6a;};return a108_0x3a7b();}export function getModelDisplayName(_0xfe2301){const _0x155b2f=a108_0x386c,_0x305475=_0xfe2301[_0x155b2f(0x1e0)]();if(_0x305475['includes'](_0x155b2f(0x1e5))){if(_0x305475[_0x155b2f(0x1e1)](_0x155b2f(0x1d4))||_0x305475[_0x155b2f(0x1e1)](_0x155b2f(0x1d8)))return'Sonnet\x204.5';return _0x155b2f(0x1e8);}if(_0x305475[_0x155b2f(0x1e1)](_0x155b2f(0x1ea))){if(_0x305475['includes'](_0x155b2f(0x1d4))||_0x305475['includes'](_0x155b2f(0x1d8)))return'Haiku\x204.5';return _0x155b2f(0x1eb);}if(_0x305475[_0x155b2f(0x1e1)](_0x155b2f(0x1e3))){if(_0x305475[_0x155b2f(0x1e1)](_0x155b2f(0x1d4))||_0x305475['includes']('4.5'))return'Opus\x204.5';return _0x155b2f(0x1da);}return _0x155b2f(0x1d7);}export function formatTokenCount(_0x36e558){const _0x494ba7=a108_0x386c;return _0x36e558[_0x494ba7(0x1de)](_0x494ba7(0x1dd));}export function calculateContextPercentage(_0x5a7ded,_0x8306de){const _0x402ba3=a108_0x386c,_0x42791e=getContextLimit(_0x8306de);return Math[_0x402ba3(0x1d5)](_0x5a7ded/_0x42791e*0x64);}