@treasuredata/tdx 2026.3.23 → 2026.3.24

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 (203) 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/auth-login-command.js +1 -1
  11. package/dist/commands/chat-command.js +1 -1
  12. package/dist/commands/claude-command.js +1 -1
  13. package/dist/commands/claude-statusline-command.js +1 -1
  14. package/dist/commands/claude-usage-command.js +1 -1
  15. package/dist/commands/command.js +1 -1
  16. package/dist/commands/connection-command.js +1 -1
  17. package/dist/commands/databases.js +1 -1
  18. package/dist/commands/delivery-command.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-campaign-pull-command.js +1 -1
  21. package/dist/commands/engage-campaign-push-command.js +1 -1
  22. package/dist/commands/engage-campaign-validate-command.js +1 -1
  23. package/dist/commands/engage-command.js +1 -1
  24. package/dist/commands/engage-template-pull-command.js +1 -1
  25. package/dist/commands/engage-template-push-command.js +1 -1
  26. package/dist/commands/engage-template-validate-command.js +1 -1
  27. package/dist/commands/job-command.js +1 -1
  28. package/dist/commands/journey-command.js +1 -1
  29. package/dist/commands/journey-validate-command.js +1 -1
  30. package/dist/commands/llm-command.js +1 -1
  31. package/dist/commands/mcp-command.js +1 -1
  32. package/dist/commands/parent-segment-command.js +1 -1
  33. package/dist/commands/policy-command.js +1 -1
  34. package/dist/commands/profile-command.js +1 -1
  35. package/dist/commands/profiles-command.js +1 -1
  36. package/dist/commands/query-command.js +1 -1
  37. package/dist/commands/schedule-command.js +1 -1
  38. package/dist/commands/segment-command.js +1 -1
  39. package/dist/commands/segment-create-command.js +1 -1
  40. package/dist/commands/segment-fields-command.js +1 -1
  41. package/dist/commands/segment-pull-command.js +1 -1
  42. package/dist/commands/segment-push-command.js +1 -1
  43. package/dist/commands/segment-update-command.js +1 -1
  44. package/dist/commands/segment-use-command.js +1 -1
  45. package/dist/commands/segment-validate-command.js +1 -1
  46. package/dist/commands/segments.js +1 -1
  47. package/dist/commands/show.js +1 -1
  48. package/dist/commands/status-command.js +1 -1
  49. package/dist/commands/tables.js +1 -1
  50. package/dist/commands/unset-command.js +1 -1
  51. package/dist/commands/upgrade-command.js +1 -1
  52. package/dist/commands/use-command.js +1 -1
  53. package/dist/commands/user-command.js +1 -1
  54. package/dist/commands/workflow-command.js +1 -1
  55. package/dist/core/auth.js +1 -1
  56. package/dist/core/command-output.js +1 -1
  57. package/dist/core/config.js +1 -1
  58. package/dist/core/connection-cache.js +1 -1
  59. package/dist/core/constants.js +1 -1
  60. package/dist/core/credential-cache.js +1 -1
  61. package/dist/core/global-context.js +1 -1
  62. package/dist/core/keychain.js +1 -1
  63. package/dist/core/oauth-keychain.js +1 -1
  64. package/dist/core/oauth.js +1 -1
  65. package/dist/core/profile.js +1 -1
  66. package/dist/core/project-config.js +1 -1
  67. package/dist/core/session.js +1 -1
  68. package/dist/core/user-cache.js +1 -1
  69. package/dist/core/version.js +1 -1
  70. package/dist/index.js +1 -1
  71. package/dist/mcp/server.js +1 -1
  72. package/dist/mcp/tools/index.js +1 -1
  73. package/dist/mcp/tools/tdx-run.js +1 -1
  74. package/dist/mcp/tools/tdx-search.js +1 -1
  75. package/dist/mcp/utils.js +1 -1
  76. package/dist/proxy/claude-usage-tracker.js +1 -1
  77. package/dist/proxy/passthrough-server.js +1 -1
  78. package/dist/proxy/sse-usage-parser.js +1 -1
  79. package/dist/sdk/agent/agent-config.js +1 -1
  80. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  81. package/dist/sdk/agent/agent-yaml.js +1 -1
  82. package/dist/sdk/agent/test/evaluator.js +1 -1
  83. package/dist/sdk/agent/test/executor.js +1 -1
  84. package/dist/sdk/agent/test/index.js +1 -1
  85. package/dist/sdk/agent/test/output.js +1 -1
  86. package/dist/sdk/agent/test/parser.js +1 -1
  87. package/dist/sdk/agent/tool-target-registry.js +1 -1
  88. package/dist/sdk/api.js +1 -1
  89. package/dist/sdk/client/cdp-api-client.js +1 -1
  90. package/dist/sdk/client/delivery-api-client.js +1 -1
  91. package/dist/sdk/client/endpoints.js +1 -1
  92. package/dist/sdk/client/engage-api-client.js +1 -1
  93. package/dist/sdk/client/http-client.js +1 -1
  94. package/dist/sdk/client/llm-api-client.js +1 -1
  95. package/dist/sdk/client/oauth-refresh.js +1 -1
  96. package/dist/sdk/client/rate-limiter.js +1 -1
  97. package/dist/sdk/client/td-api-client.js +1 -1
  98. package/dist/sdk/client/trino-api-client.js +1 -1
  99. package/dist/sdk/client/workflow-client.js +1 -1
  100. package/dist/sdk/connection-validator.js +1 -1
  101. package/dist/sdk/connection.js +1 -1
  102. package/dist/sdk/delivery.js +1 -1
  103. package/dist/sdk/engage/campaign-pull.js +1 -1
  104. package/dist/sdk/engage/campaign-push.js +1 -1
  105. package/dist/sdk/engage/campaign-validator.js +1 -1
  106. package/dist/sdk/engage/campaign-yaml.js +1 -1
  107. package/dist/sdk/engage/template-pull.js +1 -1
  108. package/dist/sdk/engage/template-push.js +1 -1
  109. package/dist/sdk/engage/template-validator.js +1 -1
  110. package/dist/sdk/engage/template-yaml.js +1 -1
  111. package/dist/sdk/engage/types/campaign-def.js +1 -1
  112. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  113. package/dist/sdk/engage/types/template-schema.js +1 -1
  114. package/dist/sdk/engage.js +1 -1
  115. package/dist/sdk/errors.js +1 -1
  116. package/dist/sdk/index.js +1 -1
  117. package/dist/sdk/io/index.js +1 -1
  118. package/dist/sdk/io/node-filesystem.js +1 -1
  119. package/dist/sdk/job.js +1 -1
  120. package/dist/sdk/journey.js +1 -1
  121. package/dist/sdk/llm/chat-cache.js +1 -1
  122. package/dist/sdk/llm/index.js +1 -1
  123. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  124. package/dist/sdk/llm/model-factors.js +1 -1
  125. package/dist/sdk/personalization.js +1 -1
  126. package/dist/sdk/policy.js +1 -1
  127. package/dist/sdk/query/index.js +1 -1
  128. package/dist/sdk/query/sql-parser.js +1 -1
  129. package/dist/sdk/realtime.js +1 -1
  130. package/dist/sdk/schedule.js +1 -1
  131. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  132. package/dist/sdk/segment/fields-display.js +1 -1
  133. package/dist/sdk/segment/file-discovery.js +1 -1
  134. package/dist/sdk/segment/journey-utils.js +1 -1
  135. package/dist/sdk/segment/journey-validator.js +1 -1
  136. package/dist/sdk/segment/journey-yaml.js +1 -1
  137. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  138. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  139. package/dist/sdk/segment/pull-workflow.js +1 -1
  140. package/dist/sdk/segment/push-recovery.js +1 -1
  141. package/dist/sdk/segment/push-workflow.js +1 -1
  142. package/dist/sdk/segment/resolution-context.js +1 -1
  143. package/dist/sdk/segment/segment-path-parser.js +1 -1
  144. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  145. package/dist/sdk/segment/segment-validator.js +1 -1
  146. package/dist/sdk/segment/target-resolution.js +1 -1
  147. package/dist/sdk/segment/tdx-config.js +1 -1
  148. package/dist/sdk/segment/types/activation-schema.js +1 -1
  149. package/dist/sdk/segment/types/journey-def.js +1 -1
  150. package/dist/sdk/segment/types/journey-schema.js +1 -1
  151. package/dist/sdk/segment/types/segment-def.js +1 -1
  152. package/dist/sdk/segment/types/segment-schema.js +1 -1
  153. package/dist/sdk/segment/validate-files.js +1 -1
  154. package/dist/sdk/segment/yaml-validator.js +1 -1
  155. package/dist/sdk/segment.js +1 -1
  156. package/dist/sdk/types/index.js +1 -1
  157. package/dist/sdk/types/progress.js +1 -1
  158. package/dist/sdk/user.js +1 -1
  159. package/dist/sdk/util/format-detector.js +1 -1
  160. package/dist/sdk/util/formatters.js +1 -1
  161. package/dist/sdk/util/index.js +1 -1
  162. package/dist/sdk/util/paginate.js +1 -1
  163. package/dist/sdk/util/tree-formatter.js +1 -1
  164. package/dist/sdk/workflow/archive-validation.js +1 -1
  165. package/dist/sdk/workflow/clone-workflow.js +1 -1
  166. package/dist/sdk/workflow/index.js +1 -1
  167. package/dist/sdk/workflow/pull-workflow.js +1 -1
  168. package/dist/sdk/workflow/push-workflow.js +1 -1
  169. package/dist/sdk/workflow/tdx-config.js +1 -1
  170. package/dist/sdk/workflow/workflow-utils.js +1 -1
  171. package/dist/test-utils/command-runner.js +1 -1
  172. package/dist/test-utils/factories.js +1 -1
  173. package/dist/test-utils/fixtures.js +1 -1
  174. package/dist/test-utils/http-mock.js +1 -1
  175. package/dist/test-utils/index.js +1 -1
  176. package/dist/utils/async.js +1 -1
  177. package/dist/utils/colors.js +1 -1
  178. package/dist/utils/diff.js +1 -1
  179. package/dist/utils/file-permissions.js +1 -1
  180. package/dist/utils/file-reader.js +1 -1
  181. package/dist/utils/github-releases.js +1 -1
  182. package/dist/utils/global-cache.js +1 -1
  183. package/dist/utils/json-loader.js +1 -1
  184. package/dist/utils/local-cache.js +1 -1
  185. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  186. package/dist/utils/logger/formatters/index.js +1 -1
  187. package/dist/utils/logger/handlers/console-handler.js +1 -1
  188. package/dist/utils/logger/handlers/file-handler.js +1 -1
  189. package/dist/utils/logger/handlers/index.js +1 -1
  190. package/dist/utils/logger/handlers/null-handler.js +1 -1
  191. package/dist/utils/logger/index.js +1 -1
  192. package/dist/utils/logger/logger.js +1 -1
  193. package/dist/utils/logger/types.js +1 -1
  194. package/dist/utils/option-validation.js +1 -1
  195. package/dist/utils/process.js +1 -1
  196. package/dist/utils/prompt.js +1 -1
  197. package/dist/utils/spinner.js +1 -1
  198. package/dist/utils/sse-parser.js +1 -1
  199. package/dist/utils/string-utils.js +1 -1
  200. package/dist/utils/table-ref-parser.js +1 -1
  201. package/dist/utils/tdx-logger.js +1 -1
  202. package/dist/utils/version-check.js +1 -1
  203. package/package.json +1 -1
@@ -1 +1 @@
1
- const a123_0x5aa90d=a123_0x4621;(function(_0x380f6c,_0x55add7){const _0x2f8614=a123_0x4621,_0x5e1040=_0x380f6c();while(!![]){try{const _0x47435f=parseInt(_0x2f8614(0xbb))/0x1+-parseInt(_0x2f8614(0x1a2))/0x2+parseInt(_0x2f8614(0x1af))/0x3+parseInt(_0x2f8614(0x168))/0x4*(-parseInt(_0x2f8614(0xca))/0x5)+-parseInt(_0x2f8614(0x170))/0x6*(parseInt(_0x2f8614(0x188))/0x7)+-parseInt(_0x2f8614(0x160))/0x8+parseInt(_0x2f8614(0x119))/0x9;if(_0x47435f===_0x55add7)break;else _0x5e1040['push'](_0x5e1040['shift']());}catch(_0x3bb472){_0x5e1040['push'](_0x5e1040['shift']());}}}(a123_0x1a8a,0xa381c));import{LLMApiClient}from'../client/llm-api-client.js';import*as a123_0x1fc611 from'node:fs';import*as a123_0x522ebe 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,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir}from'../agent/agent-config.js';function a123_0x1a8a(){const _0x1d672e=['yaml','context','prompt.md','version','Renamed\x20experimental\x20KB\x20directory:\x20','medium','set','agentId','push','existsSync','unchanged','TextKnowledgeBase','webhookCorsOrigins','agents.json','getOrCreateDefaultAgent','isDir','basename','sdk.llm','(dry-run)','getUserSettings','pullProject','listIntegrations','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','textKnowledgeBases','LLM_PROJECT_NOT_FOUND','Renamed\x20integration\x20file:\x20','No\x20tdx.json\x20found\x20in\x20','errors','chat_parent_segment','Unable\x20to\x20create\x20project\x20after\x20','\x0a---\x20schema:\x20','20618379udAjZN','getProject','experimental_artifacts','localeCompare','updated','serviceType','attributes','code.js','createProject','projectId','listImageGenerators','slackMessageMode','stringify','image_gen','isDirectory','listAgentsFull','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','chats','message','imageGenerators','sort','tdx_default_','map','\x0a---\x20code\x20---\x0a','listExperimentalArtifacts','#\x20prompt.md\x0a','NOT_FOUND','add','variables','listPrompts','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','site','code','functions','setCurrentProject','file_name','listProjects','claude-4.5-sonnet','reasoningEffort','restoreProject','find','\x22\x20already\x20exists','resolveProjectName','updateAgentResponse','starter_message.md','getDefaultProjectName','size','deleteIntegration','modelType','---\x20file:\x20','INVALID_ARGUMENT','service_type','.yml','split','listWebSearchTools','getOrCreateDefaultProject','.md','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','target','chatId','toLowerCase','total','\x27\x20(','createWebSearchTool','none','Agent\x20not\x20found:\x20','oldPath','keys','availableModels','signal','1279760whvpDv','updateAgent','.llm','exportedFrom','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','createAgent','tdx_','listChats','1786648oEYUSY','description','knowledge_bases','updatePrompt','prompts','Only\x20safe\x20types\x20(','project','Available\x20agents:\x20','2047398zgaKlC','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','tdx.json','getChatLog','chat_agent_console','projectName','listTextKnowledgeBases','promptId','maxToolIterations','writeFileSync','mkdirSync','Agent\x20reference\x20not\x20found','createKnowledgeBase','\x20---\x0a','createIntegration','nameToId','rmSync','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','chatInfo','experimentalKnowledgeBases','1.0','knowledgeBases','Renamed\x20agent\x20folder:\x20','logger','14JCUSwh','updateExperimentalArtifact','updateTextKnowledgeBase','pullAgent','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','chat','Project\x20\x22','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','filter','tdDatabaseName','startChat','knowledgebases.json','listAgents','PERMISSION_DENIED','isFile','statSync','\x20in\x20project\x20','Removed\x20deleted\x20file:\x20','Project\x20not\x20found:\x20','Unsupported\x20backup\x20version:\x20','metadata','listExperimentalKnowledgeBases','createExperimentalArtifact','text_content','):\x20','Invalid\x20agent\x20reference\x20format:\x20','2528812AgpxVI','experimentalArtifacts','dry-run-','type','deleteAgent','tools','renamed','history','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','isManaged','parse','loadJsonFile','experimental_knowledge_bases','3174405TwLCah','project.json','updateExperimentalKnowledgeBase','agent.yml','name','Multiple\x20projects\x20found\x20with\x20name\x20\x27','counts','updateKnowledgeBase','createImageGenerator','Renamed\x20prompt\x20file:\x20','webSearchTools','dirname','conflict','content','temperature','Renamed\x20KB\x20file:\x20','Renamed\x20text\x20KB\x20file:\x20','resolveProjectId','starterMessage','getAgent','profile','high','Agent\x20\x27','path','pushAgent','dryRun','listToolTargets','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','Renamed\x20folder:\x20','\x0a\x0a#\x20agent.yml\x0a','client','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.','new','starter_message','AGENT_NOT_FOUND','agent','listKnowledgeBases','utf-8','currentProjectId','json_schema','320824xtULpd','agent.yml\x20not\x20found\x20in\x20','llm_project','KnowledgeBase',')\x20can\x20be\x20cloned.','readFileSync','Renamed\x20experimental\x20artifact\x20directory:\x20','setDefaultAgent','clearDefaultAgent','outputs','prompts.json','already\x20exists','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','integrations','getChatInfo','10vvZAnx','includes','readdirSync','createAgentResponse','systemPrompt','\x20→\x20','createPrompt','json_schema.json','INTERNAL','text','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','\x27.\x20This\x20should\x20not\x20happen.','agents','Unresolved\x20dependencies:\x20','ExperimentalKnowledgeBase','Skipping\x20integration\x20\x27','status','created','tables','resolveAgentId','models','template','agentsFull','chatIgnoreManagedActions','projects','chatWelcomeMessage','error','jsonSchemaHint','createTextKnowledgeBase','UNAUTHENTICATED','\x0a---\x20function:\x20','toISOString','files','warn','info','endsWith','has','newProjectId','chat_generic','ALREADY_EXISTS','length','createExperimentalKnowledgeBase','actions','get','def','join','duplicate','pushProject'];a123_0x1a8a=function(){return _0x1d672e;};return a123_0x1a8a();}import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a123_0x5aa90d(0xf0),a123_0x5aa90d(0x174),a123_0x5aa90d(0x116)];function a123_0x4621(_0x16da8a,_0x3304d8){_0x16da8a=_0x16da8a-0xb3;const _0x1a8aa4=a123_0x1a8a();let _0x462168=_0x1a8aa4[_0x16da8a];return _0x462168;}async function safeListOrEmpty(_0x5e2636){const _0x2651f5=a123_0x5aa90d;try{return await _0x5e2636();}catch(_0x7a98cb){if(_0x7a98cb instanceof HTTPClientError&&_0x7a98cb[_0x2651f5(0xda)]===0x194)return[];throw _0x7a98cb;}}export class LLMSDK{[a123_0x5aa90d(0xb9)];[a123_0x5aa90d(0x1cd)];[a123_0x5aa90d(0xfb)];[a123_0x5aa90d(0x187)]=Logger['of'](a123_0x5aa90d(0x10b));constructor(_0x10ab97){const _0x2e371f=a123_0x5aa90d;this[_0x2e371f(0x1cd)]=new LLMApiClient(_0x10ab97),this[_0x2e371f(0xfb)]=_0x10ab97;}[a123_0x5aa90d(0x147)](){const _0x4f32d1=a123_0x5aa90d,_0x12f165=getSanitizedUsername();return _0x4f32d1(0x12e)+_0x12f165;}async[a123_0x5aa90d(0x13c)](_0x2001ed){const _0xdf2cc=a123_0x5aa90d,{projectId:_0xefad81}=await this[_0xdf2cc(0x144)](_0x2001ed);this[_0xdf2cc(0xb9)]=_0xefad81;}['getCurrentProject'](){const _0x34e4b9=a123_0x5aa90d;return this[_0x34e4b9(0xb9)];}async[a123_0x5aa90d(0xc2)](_0x23914a){const _0x36ec5e=a123_0x5aa90d,_0x3283c7=this[_0x36ec5e(0xfb)][_0x36ec5e(0x1c3)];let _0x583aad,_0xab960e;if(_0x23914a[_0x36ec5e(0xcb)]('/')){const _0xa9f3f1=_0x23914a[_0x36ec5e(0x14f)]('/');if(_0xa9f3f1['length']!==0x2)throw new SDKError(ErrorCode[_0x36ec5e(0x14c)],_0x36ec5e(0x1a1)+_0x23914a,undefined,{'helpText':_0x36ec5e(0x138)});const [_0x4d5903,_0x27c7de]=_0xa9f3f1;_0x583aad=await this[_0x36ec5e(0x1c0)](_0x4d5903),_0xab960e=_0x27c7de;}else _0x583aad=this[_0x36ec5e(0xb9)]||(await this['getOrCreateDefaultProject']())['id'],_0xab960e=_0x23914a;const _0x5d8bee=await this[_0x36ec5e(0xdd)](_0xab960e,_0x583aad),_0x3ee880=await this[_0x36ec5e(0x1cd)][_0x36ec5e(0x1c2)](_0x5d8bee);writeCachedLLMAgent(_0x3ee880[_0x36ec5e(0x11f)][_0x36ec5e(0x1b3)],_0x5d8bee,_0x583aad,_0x3283c7);}['getDefaultAgent'](){const _0x4e2bf0=a123_0x5aa90d,_0x318aed=this[_0x4e2bf0(0xfb)][_0x4e2bf0(0x1c3)];return readCachedLLMAgent(_0x318aed)||undefined;}[a123_0x5aa90d(0xc3)](){const _0x5b936e=a123_0x5aa90d,_0x174b07=this['context'][_0x5b936e(0x1c3)];clearCachedLLMAgent(_0x174b07);}async[a123_0x5aa90d(0xde)](){const _0x3955e6=a123_0x5aa90d,_0x3d9b3e=await this['client'][_0x3955e6(0x10d)](),_0x383f1e=[];for(const _0x54b620 of _0x3d9b3e['availableModelNames']){const _0x39a1f3=_0x3d9b3e[_0x3955e6(0x15e)][_0x54b620];_0x39a1f3&&_0x383f1e[_0x3955e6(0x102)]({'name':_0x54b620,'displayName':_0x39a1f3['displayName']});}return _0x383f1e;}async[a123_0x5aa90d(0x121)](_0x55c983){const _0x59a496=a123_0x5aa90d;return await this[_0x59a496(0x1cd)]['createProject'](_0x55c983);}async['deleteProject'](_0x10dfe6){const _0x2bfd91=a123_0x5aa90d,{projectId:_0x1f3afa}=await this[_0x2bfd91(0x144)](_0x10dfe6);await this[_0x2bfd91(0x1cd)]['deleteProject'](_0x1f3afa);}async[a123_0x5aa90d(0xe2)](_0x38615c=0x32){const _0x4f8ae0=a123_0x5aa90d;return await this[_0x4f8ae0(0x1cd)][_0x4f8ae0(0x13e)](_0x38615c);}async[a123_0x5aa90d(0x151)](_0x3142d5){const _0x202737=a123_0x5aa90d,_0x39ee1d=_0x3142d5||this[_0x202737(0x147)](),_0x540faf=this['context'][_0x202737(0x1c3)];if(!_0x3142d5){const _0x385498=readCachedLLMProject(_0x540faf);if(_0x385498&&_0x385498[_0x202737(0x1b3)]===_0x39ee1d)try{const _0x31c58a=await this[_0x202737(0x1cd)][_0x202737(0x11a)](_0x385498['id']);if(_0x31c58a['attributes'][_0x202737(0x1b3)]===_0x39ee1d)return _0x31c58a;}catch{}}const _0x569079=await this[_0x202737(0x1cd)][_0x202737(0x13e)](),_0x5da37e=_0x569079[_0x202737(0x142)](_0x27ea1b=>_0x27ea1b[_0x202737(0x11f)][_0x202737(0x1b3)]===_0x39ee1d);if(_0x5da37e)return!_0x3142d5&&writeCachedLLMProject(_0x39ee1d,_0x5da37e['id'],_0x540faf),_0x5da37e;const _0x5ed198=await this['client'][_0x202737(0x121)]({'name':_0x39ee1d,'description':_0x202737(0x110)+getSanitizedUsername()+')'});return!_0x3142d5&&writeCachedLLMProject(_0x39ee1d,_0x5ed198['id'],_0x540faf),_0x5ed198;}async[a123_0x5aa90d(0x1c0)](_0x11afbe){const _0x3c719b=a123_0x5aa90d,_0x50b754=await this[_0x3c719b(0x1cd)][_0x3c719b(0x13e)](),_0x4ffca8=_0x50b754['filter'](_0x32ae63=>_0x32ae63[_0x3c719b(0x11f)][_0x3c719b(0x1b3)]===_0x11afbe);if(_0x4ffca8[_0x3c719b(0xf2)]===0x0)throw new SDKError(ErrorCode[_0x3c719b(0x112)],_0x3c719b(0x19a)+_0x11afbe,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x4ffca8[_0x3c719b(0xf2)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x3c719b(0x1b4)+_0x11afbe+_0x3c719b(0xd5));return _0x4ffca8[0x0]['id'];}async[a123_0x5aa90d(0x144)](_0x13777d){const _0x535d90=a123_0x5aa90d,_0x451ae2=await this[_0x535d90(0x1cd)][_0x535d90(0x13e)](),_0x1c3ce5=_0x451ae2[_0x535d90(0x142)](_0xc7e97a=>_0xc7e97a[_0x535d90(0x11f)][_0x535d90(0x1b3)]===_0x13777d);if(_0x1c3ce5)return{'projectId':_0x1c3ce5['id'],'project':_0x1c3ce5};throw new SDKError(ErrorCode[_0x535d90(0x112)],_0x535d90(0x19a)+_0x13777d,undefined,{'helpText':_0x535d90(0xc7)});}async[a123_0x5aa90d(0x108)](_0x3fe74d=a123_0x5aa90d(0x13f),_0x37fbf7=0x0,_0x1ebd56){const _0x38f53c=a123_0x5aa90d,_0xddd765=0xa;let _0x33f04d=0x0,_0x3a0a7c;while(_0x33f04d<_0xddd765){try{const _0x30637f=await this['getOrCreateDefaultProject'](_0x3a0a7c),_0x56b148=_0x30637f['id'],_0x426a1d=[_0x38f53c(0x15a),'minimal','low',_0x38f53c(0xff),_0x38f53c(0x1c4)],_0x492935=_0x37fbf7===0x0?'tdx_'+_0x3fe74d:_0x38f53c(0x166)+_0x3fe74d+'_reasoning_'+_0x426a1d[_0x37fbf7],_0x2903fc=await this[_0x38f53c(0x1cd)]['listAgents'](_0x56b148),_0x3b4454=_0x2903fc[_0x38f53c(0x142)](_0x3fea18=>_0x3fea18[_0x38f53c(0x11f)][_0x38f53c(0x1b3)]===_0x492935);if(_0x3b4454)return _0x3b4454;const _0x464495=_0x37fbf7>0x0?0x1:_0x1ebd56;return await this[_0x38f53c(0x1cd)]['createAgent']({'name':_0x492935,'projectId':_0x56b148,'modelType':_0x3fe74d,'systemPrompt':'','temperature':_0x464495,'reasoningEffort':_0x37fbf7>0x0?_0x37fbf7:undefined});}catch(_0x2a5a17){if(_0x2a5a17 instanceof HTTPClientError){const _0x58deef=_0x2a5a17[_0x38f53c(0xda)];if(_0x58deef>=0x190&&_0x58deef<0x1f4){if(_0x58deef===0x191)throw new SDKError(ErrorCode[_0x38f53c(0xe7)],_0x38f53c(0x137),_0x2a5a17);else{if(_0x58deef===0x193)throw new SDKError(ErrorCode[_0x38f53c(0x195)],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x2a5a17);}throw _0x2a5a17;}}if(errorContains(_0x2a5a17,_0x38f53c(0xc6),_0x38f53c(0xf8),_0x38f53c(0x1bb))){_0x33f04d++;if(_0x33f04d>=_0xddd765)throw new SDKError(ErrorCode[_0x38f53c(0xf1)],_0x38f53c(0x117)+_0xddd765+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x2a5a17);const _0x31e32=this[_0x38f53c(0x147)]();_0x3a0a7c=_0x31e32+'_'+generateRandomHex();continue;}throw _0x2a5a17;}}throw new SDKError(ErrorCode['INTERNAL'],'Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts');}async[a123_0x5aa90d(0xdd)](_0xfb7cc9,_0x3e462b){const _0x134881=a123_0x5aa90d,_0x4f08e1=_0x3e462b||this[_0x134881(0xb9)],_0xb5c07c=await this[_0x134881(0x1cd)][_0x134881(0x194)](_0x4f08e1),_0x4fbcff=_0xb5c07c['filter'](_0x46f223=>_0x46f223['attributes'][_0x134881(0x1b3)]===_0xfb7cc9);if(_0x4fbcff['length']===0x0){const _0x193508=_0x4f08e1?_0x134881(0x198)+_0x4f08e1:'';throw new SDKError(ErrorCode[_0x134881(0xb5)],'Agent\x20not\x20found:\x20'+_0xfb7cc9+_0x193508,undefined,{'helpText':_0x4f08e1?'Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.':_0x134881(0x1ce)});}if(_0x4fbcff[_0x134881(0xf2)]>0x1)throw new SDKError(ErrorCode[_0x134881(0xd2)],'Multiple\x20agents\x20found\x20with\x20name\x20\x27'+_0xfb7cc9+_0x134881(0xd5));return _0x4fbcff[0x0]['id'];}async[a123_0x5aa90d(0xd6)](_0x3377d7){const _0xab38a6=a123_0x5aa90d,_0x51ca35=_0x3377d7||this[_0xab38a6(0xb9)];return await this['client'][_0xab38a6(0x194)](_0x51ca35);}async[a123_0x5aa90d(0xe0)](_0x461878){return await this['client']['listAgentsFull'](_0x461878);}async[a123_0x5aa90d(0xb6)](_0x2ea393){const _0x240eca=a123_0x5aa90d;return await this[_0x240eca(0x1cd)]['getAgent'](_0x2ea393);}async[a123_0x5aa90d(0x165)](_0x1c30d2){const _0x347b67=a123_0x5aa90d;return await this['client'][_0x347b67(0x165)](_0x1c30d2);}async[a123_0x5aa90d(0x161)](_0x399cb2,_0x2937ce){const _0xce5974=a123_0x5aa90d;return await this[_0xce5974(0x1cd)][_0xce5974(0x161)](_0x399cb2,_0x2937ce);}async[a123_0x5aa90d(0x1a6)](_0x1247a3){await this['client']['deleteAgent'](_0x1247a3);}async[a123_0x5aa90d(0x192)](_0x29a93e){const _0x2d7f9f=a123_0x5aa90d;return await this[_0x2d7f9f(0x1cd)][_0x2d7f9f(0x192)]({'agentId':_0x29a93e});}async*[a123_0x5aa90d(0x18d)](_0x37e6bc,_0x3c1afe){const _0x2778db=a123_0x5aa90d;let _0x1368d1=_0x3c1afe?.[_0x2778db(0x155)];const _0x919318=_0x3c1afe?.[_0x2778db(0x101)];if(!_0x1368d1){if(!_0x919318)throw new Error(_0x2778db(0x153));const _0x593f43=await this[_0x2778db(0x1cd)][_0x2778db(0x192)]({'agentId':_0x919318});_0x1368d1=_0x593f43['id'],yield{'type':_0x2778db(0x19c),'data':{'chatId':_0x1368d1,'agentId':_0x919318,'projectId':_0x593f43[_0x2778db(0x11f)][_0x2778db(0x122)]}};}for await(const _0x34db9f of this[_0x2778db(0x1cd)]['continueChat'](_0x1368d1,_0x37e6bc,_0x3c1afe?.[_0x2778db(0x15f)])){yield{'type':'event','data':_0x34db9f};}}async[a123_0x5aa90d(0x12a)](_0x47a859=0x32){const _0x4559ad=a123_0x5aa90d;return await this[_0x4559ad(0x1cd)][_0x4559ad(0x167)](_0x47a859);}async[a123_0x5aa90d(0x1a9)](_0x15f0d8){const _0x152486=a123_0x5aa90d;return await this[_0x152486(0x1cd)]['getChatHistory'](_0x15f0d8);}async[a123_0x5aa90d(0x173)](_0x3afb2a){const _0x3fa0b6=a123_0x5aa90d;return await this[_0x3fa0b6(0x1cd)][_0x3fa0b6(0x173)](_0x3afb2a);}async[a123_0x5aa90d(0x182)](_0x4f4089){const _0x169340=a123_0x5aa90d;return await this['client'][_0x169340(0xc9)](_0x4f4089);}async['backupProject'](_0x41ebfe,_0x444fd8,_0x4732c7){const _0x1462ea=a123_0x5aa90d,_0x535e51=_0x4732c7?.['dryRun']??![],{projectId:_0x12baba,project:_0x3842f9}=await this[_0x1462ea(0x144)](_0x41ebfe),_0x32777e=_0x3842f9[_0x1462ea(0x11f)][_0x1462ea(0x1b3)],_0x255dc4=_0x444fd8||_0x32777e+_0x1462ea(0x162);if(a123_0x1fc611[_0x1462ea(0x103)](_0x255dc4)&&!_0x535e51)throw new SDKError(ErrorCode[_0x1462ea(0xf1)],'Output\x20directory\x20already\x20exists:\x20'+_0x255dc4,undefined,{'helpText':'Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.'});const _0x5a4000=await this[_0x1462ea(0x1cd)][_0x1462ea(0x128)](_0x12baba),_0x47e0c3=await this['client'][_0x1462ea(0xb7)](_0x12baba),_0x3198cb=await this[_0x1462ea(0x1cd)][_0x1462ea(0x136)](_0x12baba),_0x5c1ffe=await this[_0x1462ea(0x1cd)][_0x1462ea(0x10f)](_0x12baba);if(!_0x535e51){a123_0x1fc611[_0x1462ea(0x17a)](_0x255dc4,{'recursive':!![]});const _0xcb289f={'version':_0x1462ea(0x184),'exportedAt':new Date()[_0x1462ea(0xe9)](),'exportedFrom':{'site':this[_0x1462ea(0xfb)][_0x1462ea(0x139)],'projectId':_0x12baba,'projectName':_0x32777e},'project':_0x3842f9};a123_0x1fc611[_0x1462ea(0x179)](a123_0x522ebe['join'](_0x255dc4,_0x1462ea(0x1b0)),JSON[_0x1462ea(0x125)](_0xcb289f,null,0x2)),a123_0x1fc611[_0x1462ea(0x179)](a123_0x522ebe[_0x1462ea(0xf7)](_0x255dc4,_0x1462ea(0x107)),JSON[_0x1462ea(0x125)](_0x5a4000,null,0x2)),a123_0x1fc611['writeFileSync'](a123_0x522ebe[_0x1462ea(0xf7)](_0x255dc4,'knowledgebases.json'),JSON[_0x1462ea(0x125)](_0x47e0c3,null,0x2)),a123_0x1fc611[_0x1462ea(0x179)](a123_0x522ebe[_0x1462ea(0xf7)](_0x255dc4,_0x1462ea(0xc5)),JSON[_0x1462ea(0x125)](_0x3198cb,null,0x2)),a123_0x1fc611['writeFileSync'](a123_0x522ebe[_0x1462ea(0xf7)](_0x255dc4,'integrations.json'),JSON[_0x1462ea(0x125)](_0x5c1ffe,null,0x2));}return{'projectName':_0x32777e,'outputDir':_0x255dc4,'counts':{'agents':_0x5a4000[_0x1462ea(0xf2)],'knowledgeBases':_0x47e0c3[_0x1462ea(0xf2)],'prompts':_0x3198cb['length'],'integrations':_0x5c1ffe['length']}};}async[a123_0x5aa90d(0x141)](_0x5e2433,_0x5d4fae){const _0x324aab=a123_0x5aa90d,_0x138506=_0x5d4fae?.[_0x324aab(0x1c8)]??![],_0x413ebf=this['getBackupMetadata'](_0x5e2433),_0xcbc5d5=_0x413ebf[_0x324aab(0x163)][_0x324aab(0x139)],_0x4088e3=this['context'][_0x324aab(0x139)],_0x1c6e8e=_0xcbc5d5!==_0x4088e3?_0xcbc5d5:undefined,_0xa6cb4e=this[_0x324aab(0x1ad)](a123_0x522ebe[_0x324aab(0xf7)](_0x5e2433,_0x324aab(0x107)),[]),_0x541d36=this[_0x324aab(0x1ad)](a123_0x522ebe['join'](_0x5e2433,_0x324aab(0x193)),[]),_0x59129d=this['loadJsonFile'](a123_0x522ebe[_0x324aab(0xf7)](_0x5e2433,'prompts.json'),[]),_0x2662e7=this['loadJsonFile'](a123_0x522ebe[_0x324aab(0xf7)](_0x5e2433,'integrations.json'),[]),_0x372b7c=_0x5d4fae?.[_0x324aab(0x1b3)]||_0x413ebf[_0x324aab(0x163)][_0x324aab(0x175)];if(_0x138506){const _0xd87df6=new Map(),_0x53ecb8=[..._0xa6cb4e],_0x129e0c=_0xa6cb4e[_0x324aab(0xf2)]+0x1;let _0x3b0d39=0x0;while(_0x53ecb8[_0x324aab(0xf2)]>0x0&&_0x3b0d39<_0x129e0c){_0x3b0d39++;const _0x3d18af=[];for(const _0x39cc5d of _0x53ecb8){canCreateAgent(_0x39cc5d,_0xd87df6)?_0xd87df6['set'](_0x39cc5d['id'],_0x324aab(0x1a4)+_0x39cc5d['id']):_0x3d18af[_0x324aab(0x102)](_0x39cc5d);}if(_0x3d18af[_0x324aab(0xf2)]===_0x53ecb8[_0x324aab(0xf2)])throw new SDKError(ErrorCode[_0x324aab(0xd2)],_0x324aab(0xd4),undefined,{'helpText':_0x324aab(0x181)});_0x53ecb8['length']=0x0,_0x53ecb8[_0x324aab(0x102)](..._0x3d18af);}const _0x25d976=_0x59129d[_0x324aab(0x190)](_0x2f9c70=>_0xd87df6['has'](_0x2f9c70[_0x324aab(0x11f)][_0x324aab(0x101)]))['length'];return{'projectName':_0x372b7c,'projectId':_0x324aab(0x10c),'counts':{'agents':_0xa6cb4e['length'],'knowledgeBases':_0x541d36[_0x324aab(0xf2)],'prompts':_0x25d976,'integrations':_0x2662e7['length']},'sourceSite':_0x1c6e8e};}const _0x22b8ec=await this[_0x324aab(0x1cd)][_0x324aab(0x121)]({'name':_0x372b7c,'description':_0x413ebf[_0x324aab(0x16e)]['attributes'][_0x324aab(0x169)]}),_0x3d6c89=_0x22b8ec['id'],_0x68a7e8=new Map(),_0x2442fe=new Map(),_0x599c7a=new Map();for(const _0x2023fc of _0x541d36){const _0x17315d=await this['client'][_0x324aab(0x17c)]({'projectId':_0x3d6c89,'name':_0x2023fc[_0x324aab(0x11f)][_0x324aab(0x1b3)],'tdDatabaseName':_0x2023fc[_0x324aab(0x11f)][_0x324aab(0x191)],'tables':_0x2023fc['attributes'][_0x324aab(0xdc)]});_0x68a7e8[_0x324aab(0x100)](_0x2023fc['id'],_0x17315d['id']);}const _0x105185=[..._0xa6cb4e],_0x35f648=_0xa6cb4e[_0x324aab(0xf2)]+0x1;let _0x52e01a=0x0;while(_0x105185[_0x324aab(0xf2)]>0x0&&_0x52e01a<_0x35f648){_0x52e01a++;const _0x3e4cb0=[];for(const _0x369ead of _0x105185){if(canCreateAgent(_0x369ead,_0x2442fe)){const _0x25ce4a=remapToolIds(_0x369ead[_0x324aab(0x11f)][_0x324aab(0x1a7)],_0x68a7e8,_0x2442fe),_0xa634be=remapVariableIds(_0x369ead[_0x324aab(0x11f)][_0x324aab(0x135)],_0x68a7e8),_0x3f29cf=await this[_0x324aab(0x1cd)][_0x324aab(0xcd)]({'name':_0x369ead[_0x324aab(0x11f)][_0x324aab(0x1b3)],'projectId':_0x3d6c89,'systemPrompt':_0x369ead[_0x324aab(0x11f)][_0x324aab(0xce)],'starterMessage':_0x369ead[_0x324aab(0x11f)][_0x324aab(0x1c1)],'modelType':migrateModelType(_0x369ead[_0x324aab(0x11f)][_0x324aab(0x14a)]),'maxToolIterations':_0x369ead[_0x324aab(0x11f)][_0x324aab(0x178)],'temperature':_0x369ead[_0x324aab(0x11f)][_0x324aab(0x1bd)],'reasoningEffort':_0x369ead[_0x324aab(0x11f)][_0x324aab(0x140)],'outputs':_0x369ead['attributes'][_0x324aab(0xc4)],'tools':_0x25ce4a,'variables':_0xa634be});_0x2442fe[_0x324aab(0x100)](_0x369ead['id'],_0x3f29cf['id']);}else _0x3e4cb0['push'](_0x369ead);}if(_0x3e4cb0[_0x324aab(0xf2)]===_0x105185['length'])throw new SDKError(ErrorCode[_0x324aab(0xd2)],_0x324aab(0xd4),undefined,{'helpText':_0x324aab(0x181)});_0x105185[_0x324aab(0xf2)]=0x0,_0x105185['push'](..._0x3e4cb0);}for(const _0x532510 of _0x59129d){const _0x36bbb2=_0x2442fe[_0x324aab(0xf5)](_0x532510['attributes']['agentId']);if(!_0x36bbb2)continue;const _0x46b079=await this[_0x324aab(0x1cd)][_0x324aab(0xd0)]({'projectId':_0x3d6c89,'agentId':_0x36bbb2,'name':_0x532510['attributes']['name'],'systemPrompt':_0x532510[_0x324aab(0x11f)][_0x324aab(0xce)],'template':_0x532510['attributes'][_0x324aab(0xdf)],'jsonSchemaHint':_0x532510['attributes'][_0x324aab(0xe5)]});_0x599c7a[_0x324aab(0x100)](_0x532510['id'],_0x46b079['id']);}for(const _0x4bbe1b of _0x2662e7){const _0x2dd4be=_0x4bbe1b[_0x324aab(0x11f)][_0x324aab(0xf4)][_0x324aab(0x12f)](_0x45279b=>({..._0x45279b,'promptId':_0x599c7a[_0x324aab(0xf5)](_0x45279b[_0x324aab(0x177)])||_0x45279b['promptId']}));await this[_0x324aab(0x1cd)][_0x324aab(0x17e)]({'projectId':_0x3d6c89,'serviceType':_0x4bbe1b[_0x324aab(0x11f)][_0x324aab(0x11e)],'actions':_0x2dd4be,'slackMessageMode':_0x4bbe1b[_0x324aab(0x11f)][_0x324aab(0x124)],'chatIgnoreManagedActions':_0x4bbe1b[_0x324aab(0x11f)][_0x324aab(0xe1)],'chatWelcomeMessage':_0x4bbe1b[_0x324aab(0x11f)][_0x324aab(0xe3)],'webhookCorsOrigins':_0x4bbe1b[_0x324aab(0x11f)][_0x324aab(0x106)]});}return{'projectName':_0x372b7c,'projectId':_0x3d6c89,'counts':{'agents':_0x2442fe[_0x324aab(0x148)],'knowledgeBases':_0x68a7e8[_0x324aab(0x148)],'prompts':_0x599c7a[_0x324aab(0x148)],'integrations':_0x2662e7[_0x324aab(0xf2)]},'sourceSite':_0x1c6e8e};}[a123_0x5aa90d(0x1ad)](_0x2c83db,_0x3b470f){const _0x34ee0b=a123_0x5aa90d;if(!a123_0x1fc611['existsSync'](_0x2c83db))return _0x3b470f;return JSON[_0x34ee0b(0x1ac)](a123_0x1fc611[_0x34ee0b(0xc0)](_0x2c83db,_0x34ee0b(0xb8)));}['getBackupMetadata'](_0x21f942){const _0x42ccd9=a123_0x5aa90d;if(!a123_0x1fc611[_0x42ccd9(0x103)](_0x21f942))throw new SDKError(ErrorCode[_0x42ccd9(0x133)],'Backup\x20folder\x20not\x20found:\x20'+_0x21f942,undefined,{'helpText':_0x42ccd9(0x1aa)});const _0x669ec2=a123_0x522ebe[_0x42ccd9(0xf7)](_0x21f942,_0x42ccd9(0x1b0));if(!a123_0x1fc611[_0x42ccd9(0x103)](_0x669ec2))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x42ccd9(0x18f)+_0x21f942,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x3abfec=JSON[_0x42ccd9(0x1ac)](a123_0x1fc611['readFileSync'](_0x669ec2,'utf-8'));if(!isSupportedBackupVersion(_0x3abfec[_0x42ccd9(0xfd)]))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x42ccd9(0x19b)+_0x3abfec[_0x42ccd9(0xfd)],undefined,{'helpText':_0x42ccd9(0x18c)});return _0x3abfec;}async[a123_0x5aa90d(0x10e)](_0x1c47e4,_0x141009,_0x4b5ba9){const _0x30eb1a=a123_0x5aa90d,{projectId:_0x27fda0,project:_0xa99427}=await this['resolveProjectName'](_0x1c47e4),_0x2359a7=_0xa99427[_0x30eb1a(0x11f)][_0x30eb1a(0x1b3)];let _0x5cb9a2;if(_0x141009)_0x5cb9a2=_0x141009;else{const _0x3ef0cf=a123_0x522ebe[_0x30eb1a(0xf7)](process['cwd'](),_0x30eb1a(0xd6)),_0x20d0a2=getSanitizedPathWithMigration(_0x3ef0cf,_0x2359a7);_0x20d0a2[_0x30eb1a(0x1a8)]&&this[_0x30eb1a(0x187)][_0x30eb1a(0xec)](_0x30eb1a(0x1cb)+a123_0x522ebe['basename'](_0x20d0a2['oldPath'])+_0x30eb1a(0xcf)+a123_0x522ebe['basename'](_0x20d0a2[_0x30eb1a(0x1c6)])),_0x5cb9a2=_0x20d0a2['path'];}const _0x141a58=await this[_0x30eb1a(0x1cd)]['listAgentsFull'](_0x27fda0),_0x349d98=await this[_0x30eb1a(0x1cd)][_0x30eb1a(0xb7)](_0x27fda0),_0x35c668=await this[_0x30eb1a(0x1cd)]['listTextKnowledgeBases'](_0x27fda0),_0xd5e18c=await safeListOrEmpty(()=>this['client'][_0x30eb1a(0x123)](_0x27fda0)),_0x3f9722=await safeListOrEmpty(()=>this['client'][_0x30eb1a(0x150)](_0x27fda0)),_0x3fce6e=await this[_0x30eb1a(0x1cd)][_0x30eb1a(0x136)](_0x27fda0),_0x190d25=await this['client'][_0x30eb1a(0x10f)](_0x27fda0),_0x5b1f69=await safeListOrEmpty(()=>this['client'][_0x30eb1a(0x19d)](_0x27fda0)),_0x5666bc=await safeListOrEmpty(()=>this['client']['listExperimentalArtifacts'](_0x27fda0)),_0x4c9f8a=_0x190d25[_0x30eb1a(0x190)](_0x859926=>!_0x859926['attributes'][_0x30eb1a(0x1ab)]&&SAFE_INTEGRATION_TYPES[_0x30eb1a(0xcb)](_0x859926[_0x30eb1a(0x11f)]['serviceType'][_0x30eb1a(0x156)]())),_0x478691=new Map(),_0x3d736d=new Map(),_0xfe6c9d=new Map(),_0x36229f=new Map(),_0x2e4011=new Map(),_0x518276=new Map(),_0x4d8cf5=new Map();for(const _0x5e99e8 of _0x141a58){_0x478691[_0x30eb1a(0x100)](_0x5e99e8['id'],_0x5e99e8[_0x30eb1a(0x11f)][_0x30eb1a(0x1b3)]);}for(const _0x4bde79 of _0x349d98){_0x3d736d[_0x30eb1a(0x100)](_0x4bde79['id'],_0x4bde79[_0x30eb1a(0x11f)][_0x30eb1a(0x1b3)]);}for(const _0x2191e1 of _0x35c668){_0xfe6c9d[_0x30eb1a(0x100)](_0x2191e1['id'],_0x2191e1[_0x30eb1a(0x11f)][_0x30eb1a(0x1b3)]);}for(const _0xf7e21a of _0xd5e18c){_0x36229f['set'](_0xf7e21a['id'],_0xf7e21a[_0x30eb1a(0x11f)][_0x30eb1a(0x1b3)]);}for(const _0x55b078 of _0x3f9722){_0x2e4011[_0x30eb1a(0x100)](_0x55b078['id'],_0x55b078[_0x30eb1a(0x11f)]['name']);}for(const _0x3409fa of _0x3fce6e){_0x518276['set'](_0x3409fa['id'],_0x3409fa[_0x30eb1a(0x11f)][_0x30eb1a(0x1b3)]);}for(const _0x458f2a of _0x5b1f69){_0x4d8cf5[_0x30eb1a(0x100)](_0x458f2a['id'],_0x458f2a['attributes'][_0x30eb1a(0x1b3)]);}const _0x1f62dd={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x3d736d,'TextKnowledgeBase':_0xfe6c9d,'Agent':_0x478691,'WebSearchTool':_0x2e4011,'ImageGenerator':_0x36229f,'ExperimentalKnowledgeBase':_0x4d8cf5}),'resolvePromptName':async _0x10bfd2=>_0x518276[_0x30eb1a(0xf5)](_0x10bfd2),'onWarning':_0x32eed2=>this[_0x30eb1a(0x187)]['warn'](_0x32eed2)},_0x587a71={'projectName':_0x2359a7,'outputDir':_0x5cb9a2,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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},'integrations':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalArtifacts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0xecbb24=[],_0x235b26=[];for(const _0x41969c of _0x141a58){const _0x100973=getSanitizedPathWithMigration(_0x5cb9a2,_0x41969c['attributes']['name']);_0x100973[_0x30eb1a(0x1a8)]&&this[_0x30eb1a(0x187)][_0x30eb1a(0xec)](_0x30eb1a(0x186)+a123_0x522ebe[_0x30eb1a(0x10a)](_0x100973['oldPath'])+_0x30eb1a(0xcf)+a123_0x522ebe[_0x30eb1a(0x10a)](_0x100973[_0x30eb1a(0x1c6)]));const _0x559d7f=_0x100973[_0x30eb1a(0x1c6)],_0x2ca949=a123_0x522ebe[_0x30eb1a(0xf7)](_0x559d7f,'prompt.md'),_0x45b75=a123_0x522ebe[_0x30eb1a(0xf7)](_0x559d7f,_0x30eb1a(0x1b2)),_0x40fa79=a123_0x522ebe['join'](_0x559d7f,'starter_message.md'),{yaml:_0x47fd4e,systemPrompt:_0x10dc25,starterMessage:_0x334539}=await agentResponseToDef(_0x41969c,_0x1f62dd),_0xd2b798=toAgentYamlString(_0x47fd4e),_0x46cc59=!a123_0x1fc611[_0x30eb1a(0x103)](_0x45b75);let _0x44da19=_0x46cc59,_0xaff283;if(!_0x46cc59){const _0x37fef9=a123_0x1fc611[_0x30eb1a(0x103)](_0x2ca949)?a123_0x1fc611[_0x30eb1a(0xc0)](_0x2ca949,_0x30eb1a(0xb8)):'',_0x1eec2d=a123_0x1fc611[_0x30eb1a(0xc0)](_0x45b75,'utf-8'),_0x2f37f7=_0x30eb1a(0x132)+_0x37fef9+_0x30eb1a(0x1cc)+_0x1eec2d,_0x178bda='#\x20prompt.md\x0a'+_0x10dc25+_0x30eb1a(0x1cc)+_0xd2b798,_0x362ced=generateDiff(_0x2f37f7,_0x178bda);_0x44da19=hasChanges(_0x362ced),_0x44da19&&(_0xaff283=formatDiffWithColors(_0x362ced));}_0xecbb24[_0x30eb1a(0x102)]({'path':_0x559d7f,'content':'','isDir':!![]}),_0xecbb24[_0x30eb1a(0x102)]({'path':_0x2ca949,'content':_0x10dc25}),_0xecbb24[_0x30eb1a(0x102)]({'path':_0x45b75,'content':_0xd2b798});_0x334539&&_0x334539['includes']('\x0a')&&_0xecbb24['push']({'path':_0x40fa79,'content':_0x334539});_0x587a71['agents']['push']({'agentName':_0x41969c[_0x30eb1a(0x11f)][_0x30eb1a(0x1b3)],'outputPath':_0x559d7f,'isNew':_0x46cc59,'hasChanges':_0x44da19,'diff':_0xaff283}),_0x587a71[_0x30eb1a(0x1b5)][_0x30eb1a(0xd6)][_0x30eb1a(0x157)]++;if(_0x46cc59)_0x587a71[_0x30eb1a(0x1b5)][_0x30eb1a(0xd6)][_0x30eb1a(0xb3)]++;else{if(_0x44da19)_0x587a71[_0x30eb1a(0x1b5)][_0x30eb1a(0xd6)][_0x30eb1a(0x11d)]++;else _0x587a71[_0x30eb1a(0x1b5)]['agents'][_0x30eb1a(0x104)]++;}}for(const _0x1a7ccf of _0x349d98){if(_0x1a7ccf['attributes'][_0x30eb1a(0x1ab)])continue;const _0x3932e9=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x5cb9a2),_0x1a7ccf['attributes'][_0x30eb1a(0x1b3)],'.yml');_0x3932e9[_0x30eb1a(0x1a8)]&&this[_0x30eb1a(0x187)]['info'](_0x30eb1a(0x1be)+a123_0x522ebe['basename'](_0x3932e9[_0x30eb1a(0x15c)])+'\x20→\x20'+a123_0x522ebe[_0x30eb1a(0x10a)](_0x3932e9[_0x30eb1a(0x1c6)]));const _0x50e19e=_0x3932e9[_0x30eb1a(0x1c6)],_0x15e3bb=apiKnowledgeBaseToYaml(_0x1a7ccf),_0x511209=toKnowledgeBaseYamlString(_0x15e3bb),_0x1981d0=!a123_0x1fc611[_0x30eb1a(0x103)](_0x50e19e);let _0x423af3=_0x1981d0,_0x4f5dc2;if(!_0x1981d0){const _0x284dab=a123_0x1fc611['readFileSync'](_0x50e19e,_0x30eb1a(0xb8)),_0x20a282=generateDiff(_0x284dab,_0x511209);_0x423af3=hasChanges(_0x20a282),_0x423af3&&(_0x4f5dc2=formatDiffWithColors(_0x20a282));}_0xecbb24[_0x30eb1a(0x102)]({'path':_0x50e19e,'content':_0x511209}),_0x587a71[_0x30eb1a(0x185)][_0x30eb1a(0x102)]({'name':_0x1a7ccf[_0x30eb1a(0x11f)][_0x30eb1a(0x1b3)],'outputPath':_0x50e19e,'isNew':_0x1981d0,'hasChanges':_0x423af3,'diff':_0x4f5dc2}),_0x587a71[_0x30eb1a(0x1b5)]['knowledgeBases'][_0x30eb1a(0x157)]++;if(_0x1981d0)_0x587a71['counts'][_0x30eb1a(0x185)]['new']++;else{if(_0x423af3)_0x587a71['counts'][_0x30eb1a(0x185)][_0x30eb1a(0x11d)]++;else _0x587a71[_0x30eb1a(0x1b5)][_0x30eb1a(0x185)][_0x30eb1a(0x104)]++;}}for(const _0x1a25cd of _0x35c668){if(_0x1a25cd['attributes'][_0x30eb1a(0x1ab)])continue;const _0x58b144=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x5cb9a2),_0x1a25cd['attributes']['name'],_0x30eb1a(0x152));_0x58b144[_0x30eb1a(0x1a8)]&&this[_0x30eb1a(0x187)][_0x30eb1a(0xec)](_0x30eb1a(0x1bf)+a123_0x522ebe[_0x30eb1a(0x10a)](_0x58b144[_0x30eb1a(0x15c)])+'\x20→\x20'+a123_0x522ebe[_0x30eb1a(0x10a)](_0x58b144[_0x30eb1a(0x1c6)]));const _0x22bea0=_0x58b144['path'],_0x4c3771=toTextKnowledgeBaseMd(_0x1a25cd['attributes'][_0x30eb1a(0x1b3)],_0x1a25cd[_0x30eb1a(0x11f)]['text']),_0x87f84a=!a123_0x1fc611[_0x30eb1a(0x103)](_0x22bea0);let _0xbf2d93=_0x87f84a,_0x2dfaff;if(!_0x87f84a){const _0x1b3744=a123_0x1fc611[_0x30eb1a(0xc0)](_0x22bea0,'utf-8'),_0x185ad4=generateDiff(_0x1b3744,_0x4c3771);_0xbf2d93=hasChanges(_0x185ad4),_0xbf2d93&&(_0x2dfaff=formatDiffWithColors(_0x185ad4));}_0xecbb24['push']({'path':_0x22bea0,'content':_0x4c3771}),_0x587a71[_0x30eb1a(0x111)][_0x30eb1a(0x102)]({'name':_0x1a25cd[_0x30eb1a(0x11f)][_0x30eb1a(0x1b3)],'outputPath':_0x22bea0,'isNew':_0x87f84a,'hasChanges':_0xbf2d93,'diff':_0x2dfaff}),_0x587a71[_0x30eb1a(0x1b5)]['textKnowledgeBases'][_0x30eb1a(0x157)]++;if(_0x87f84a)_0x587a71[_0x30eb1a(0x1b5)][_0x30eb1a(0x111)][_0x30eb1a(0xb3)]++;else{if(_0xbf2d93)_0x587a71['counts'][_0x30eb1a(0x111)]['updated']++;else _0x587a71[_0x30eb1a(0x1b5)]['textKnowledgeBases'][_0x30eb1a(0x104)]++;}}for(const _0x2763e7 of _0x3fce6e){if(_0x2763e7[_0x30eb1a(0x11f)][_0x30eb1a(0x1ab)])continue;const _0x53d8a7=getSanitizedPathWithMigration(getPromptsDir(_0x5cb9a2),_0x2763e7[_0x30eb1a(0x11f)][_0x30eb1a(0x1b3)],_0x30eb1a(0x14e));_0x53d8a7[_0x30eb1a(0x1a8)]&&this[_0x30eb1a(0x187)][_0x30eb1a(0xec)](_0x30eb1a(0x1b8)+a123_0x522ebe[_0x30eb1a(0x10a)](_0x53d8a7[_0x30eb1a(0x15c)])+_0x30eb1a(0xcf)+a123_0x522ebe['basename'](_0x53d8a7[_0x30eb1a(0x1c6)]));const _0x3fd0ec=_0x53d8a7[_0x30eb1a(0x1c6)],_0x5d8661=await apiPromptToYaml(_0x2763e7,_0x1f62dd);if(!_0x5d8661)continue;const _0x321749=toPromptYamlString(_0x5d8661),_0x2ff998=!a123_0x1fc611['existsSync'](_0x3fd0ec);let _0x1e9707=_0x2ff998,_0x4fefd2;if(!_0x2ff998){const _0x152435=a123_0x1fc611[_0x30eb1a(0xc0)](_0x3fd0ec,_0x30eb1a(0xb8)),_0x32be94=generateDiff(_0x152435,_0x321749);_0x1e9707=hasChanges(_0x32be94),_0x1e9707&&(_0x4fefd2=formatDiffWithColors(_0x32be94));}_0xecbb24[_0x30eb1a(0x102)]({'path':_0x3fd0ec,'content':_0x321749}),_0x587a71[_0x30eb1a(0x16c)][_0x30eb1a(0x102)]({'name':_0x2763e7[_0x30eb1a(0x11f)][_0x30eb1a(0x1b3)],'outputPath':_0x3fd0ec,'isNew':_0x2ff998,'hasChanges':_0x1e9707,'diff':_0x4fefd2}),_0x587a71[_0x30eb1a(0x1b5)][_0x30eb1a(0x16c)]['total']++;if(_0x2ff998)_0x587a71[_0x30eb1a(0x1b5)][_0x30eb1a(0x16c)][_0x30eb1a(0xb3)]++;else{if(_0x1e9707)_0x587a71['counts'][_0x30eb1a(0x16c)][_0x30eb1a(0x11d)]++;else _0x587a71[_0x30eb1a(0x1b5)][_0x30eb1a(0x16c)][_0x30eb1a(0x104)]++;}}for(const _0x2d5c2e of _0x4c9f8a){const _0x217bd3=_0x2d5c2e[_0x30eb1a(0x11f)]['serviceType'][_0x30eb1a(0x156)](),_0x4d2d90=getSanitizedPathWithMigration(getIntegrationsDir(_0x5cb9a2),_0x217bd3,_0x30eb1a(0x14e));_0x4d2d90[_0x30eb1a(0x1a8)]&&this[_0x30eb1a(0x187)][_0x30eb1a(0xec)](_0x30eb1a(0x113)+a123_0x522ebe[_0x30eb1a(0x10a)](_0x4d2d90['oldPath'])+'\x20→\x20'+a123_0x522ebe[_0x30eb1a(0x10a)](_0x4d2d90['path']));const _0x19198c=_0x4d2d90[_0x30eb1a(0x1c6)],_0x1600b7=await apiIntegrationToYaml(_0x2d5c2e,_0x1f62dd),_0x3b61b4=toIntegrationYamlString(_0x1600b7),_0x16ccb6=!a123_0x1fc611['existsSync'](_0x19198c);let _0x2e3187=_0x16ccb6,_0x3237fc;if(!_0x16ccb6){const _0x50b66b=a123_0x1fc611[_0x30eb1a(0xc0)](_0x19198c,_0x30eb1a(0xb8)),_0x575f2b=generateDiff(_0x50b66b,_0x3b61b4);_0x2e3187=hasChanges(_0x575f2b),_0x2e3187&&(_0x3237fc=formatDiffWithColors(_0x575f2b));}_0xecbb24['push']({'path':_0x19198c,'content':_0x3b61b4}),_0x587a71[_0x30eb1a(0xc8)]['push']({'name':_0x217bd3,'outputPath':_0x19198c,'isNew':_0x16ccb6,'hasChanges':_0x2e3187,'diff':_0x3237fc}),_0x587a71['counts'][_0x30eb1a(0xc8)]['total']++;if(_0x16ccb6)_0x587a71[_0x30eb1a(0x1b5)][_0x30eb1a(0xc8)]['new']++;else{if(_0x2e3187)_0x587a71['counts'][_0x30eb1a(0xc8)]['updated']++;else _0x587a71[_0x30eb1a(0x1b5)][_0x30eb1a(0xc8)]['unchanged']++;}}for(const _0x506a8a of _0x5b1f69){if(_0x506a8a[_0x30eb1a(0x11f)][_0x30eb1a(0x1ab)])continue;const _0x1cdbd5=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x5cb9a2),_0x506a8a['attributes'][_0x30eb1a(0x1b3)]);_0x1cdbd5[_0x30eb1a(0x1a8)]&&this[_0x30eb1a(0x187)][_0x30eb1a(0xec)](_0x30eb1a(0xfe)+a123_0x522ebe[_0x30eb1a(0x10a)](_0x1cdbd5[_0x30eb1a(0x15c)])+_0x30eb1a(0xcf)+a123_0x522ebe[_0x30eb1a(0x10a)](_0x1cdbd5['path']));const _0x10e72c=_0x1cdbd5[_0x30eb1a(0x1c6)],_0x4ab297=a123_0x522ebe[_0x30eb1a(0xf7)](_0x10e72c,sanitizeForFilesystem(_0x506a8a[_0x30eb1a(0x11f)][_0x30eb1a(0x1b3)])+'.yml'),_0x3c2a0e=a123_0x522ebe['join'](_0x10e72c,'functions'),_0x4aa719=apiExperimentalKnowledgeBaseToYaml(_0x506a8a),_0x17d8a1=toExperimentalKnowledgeBaseYamlString(_0x4aa719),_0xef200b=!a123_0x1fc611[_0x30eb1a(0x103)](_0x10e72c);let _0x29a81e=_0xef200b,_0x3fb0de,_0x4e6879=_0x17d8a1;const _0x5d524f=[..._0x4aa719['functions']][_0x30eb1a(0x12d)]((_0xa8801c,_0x3909cb)=>_0xa8801c[_0x30eb1a(0x1b3)][_0x30eb1a(0x11c)](_0x3909cb[_0x30eb1a(0x1b3)]));for(const _0x34a7d7 of _0x5d524f){_0x4e6879+=_0x30eb1a(0xe8)+_0x34a7d7[_0x30eb1a(0x1b3)]+'\x20---\x0a'+_0x34a7d7[_0x30eb1a(0x13a)]+_0x30eb1a(0x118)+_0x34a7d7[_0x30eb1a(0x1b3)]+_0x30eb1a(0x17d)+_0x34a7d7[_0x30eb1a(0xba)]+'\x0a';}if(!_0xef200b){let _0x2c224b='';a123_0x1fc611[_0x30eb1a(0x103)](_0x4ab297)&&(_0x2c224b=a123_0x1fc611['readFileSync'](_0x4ab297,_0x30eb1a(0xb8)));if(a123_0x1fc611[_0x30eb1a(0x103)](_0x3c2a0e)){const _0x2a56da=a123_0x1fc611[_0x30eb1a(0xcc)](_0x3c2a0e,{'withFileTypes':!![]}),_0x28ba5b=_0x2a56da[_0x30eb1a(0x190)](_0x1f5c92=>_0x1f5c92[_0x30eb1a(0x127)]())[_0x30eb1a(0x12d)]((_0x2a031f,_0x5e26bc)=>_0x2a031f[_0x30eb1a(0x1b3)][_0x30eb1a(0x11c)](_0x5e26bc['name']));for(const _0x12958c of _0x28ba5b){const _0x116c3f=a123_0x522ebe['join'](_0x3c2a0e,_0x12958c[_0x30eb1a(0x1b3)],_0x30eb1a(0x120)),_0x4b03b5=a123_0x522ebe['join'](_0x3c2a0e,_0x12958c[_0x30eb1a(0x1b3)],'json_schema.json');a123_0x1fc611['existsSync'](_0x116c3f)&&(_0x2c224b+='\x0a---\x20function:\x20'+_0x12958c[_0x30eb1a(0x1b3)]+_0x30eb1a(0x17d)+a123_0x1fc611[_0x30eb1a(0xc0)](_0x116c3f,_0x30eb1a(0xb8))+'\x0a'),a123_0x1fc611[_0x30eb1a(0x103)](_0x4b03b5)&&(_0x2c224b+='---\x20schema:\x20'+_0x12958c[_0x30eb1a(0x1b3)]+_0x30eb1a(0x17d)+a123_0x1fc611[_0x30eb1a(0xc0)](_0x4b03b5,'utf-8')+'\x0a');}}const _0x5745ab=generateDiff(_0x2c224b,_0x4e6879);_0x29a81e=hasChanges(_0x5745ab),_0x29a81e&&(_0x3fb0de=formatDiffWithColors(_0x5745ab));}_0xecbb24['push']({'path':_0x10e72c,'content':'','isDir':!![]}),_0xecbb24[_0x30eb1a(0x102)]({'path':_0x4ab297,'content':_0x17d8a1}),_0xecbb24[_0x30eb1a(0x102)]({'path':_0x3c2a0e,'content':'','isDir':!![]});for(const _0x4be50d of _0x4aa719['functions']){const _0x45a267=a123_0x522ebe[_0x30eb1a(0xf7)](_0x3c2a0e,sanitizeForFilesystem(_0x4be50d[_0x30eb1a(0x1b3)])),_0x16a902=a123_0x522ebe['join'](_0x45a267,_0x30eb1a(0x120)),_0x4798ae=a123_0x522ebe['join'](_0x45a267,_0x30eb1a(0xd1));_0xecbb24[_0x30eb1a(0x102)]({'path':_0x45a267,'content':'','isDir':!![]}),_0xecbb24[_0x30eb1a(0x102)]({'path':_0x16a902,'content':_0x4be50d['code']}),_0xecbb24[_0x30eb1a(0x102)]({'path':_0x4798ae,'content':_0x4be50d[_0x30eb1a(0xba)]});}if(a123_0x1fc611[_0x30eb1a(0x103)](_0x3c2a0e)){const _0x5f1db4=a123_0x1fc611['readdirSync'](_0x3c2a0e,{'withFileTypes':!![]}),_0x355316=new Set(_0x4aa719[_0x30eb1a(0x13b)]['map'](_0x428e6a=>sanitizeForFilesystem(_0x428e6a[_0x30eb1a(0x1b3)])));for(const _0x4fb249 of _0x5f1db4){if(_0x4fb249[_0x30eb1a(0x127)]()&&!_0x355316['has'](_0x4fb249[_0x30eb1a(0x1b3)])){const _0x3b154f=a123_0x522ebe[_0x30eb1a(0xf7)](_0x3c2a0e,_0x4fb249[_0x30eb1a(0x1b3)]);_0x235b26[_0x30eb1a(0x102)]({'path':_0x3b154f,'isDir':!![]});}}}_0x587a71['experimentalKnowledgeBases']['push']({'name':_0x506a8a[_0x30eb1a(0x11f)][_0x30eb1a(0x1b3)],'outputPath':_0x10e72c,'isNew':_0xef200b,'hasChanges':_0x29a81e,'diff':_0x3fb0de}),_0x587a71['counts'][_0x30eb1a(0x183)][_0x30eb1a(0x157)]++;if(_0xef200b)_0x587a71['counts'][_0x30eb1a(0x183)]['new']++;else{if(_0x29a81e)_0x587a71['counts'][_0x30eb1a(0x183)][_0x30eb1a(0x11d)]++;else _0x587a71['counts'][_0x30eb1a(0x183)][_0x30eb1a(0x104)]++;}}for(const _0x3e3bc2 of _0x5666bc){if(_0x3e3bc2['attributes'][_0x30eb1a(0x1ab)])continue;const _0x3cddc2=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x5cb9a2),_0x3e3bc2[_0x30eb1a(0x11f)]['name']);_0x3cddc2['renamed']&&this[_0x30eb1a(0x187)][_0x30eb1a(0xec)](_0x30eb1a(0xc1)+a123_0x522ebe[_0x30eb1a(0x10a)](_0x3cddc2[_0x30eb1a(0x15c)])+_0x30eb1a(0xcf)+a123_0x522ebe['basename'](_0x3cddc2[_0x30eb1a(0x1c6)]));const _0x3b3724=_0x3cddc2['path'],_0x1a5e05=a123_0x522ebe[_0x30eb1a(0xf7)](_0x3b3724,sanitizeForFilesystem(_0x3e3bc2[_0x30eb1a(0x11f)]['name'])+_0x30eb1a(0x14e)),_0x191223=a123_0x522ebe[_0x30eb1a(0xf7)](_0x3b3724,_0x30eb1a(0x120)),_0x8c15fb=a123_0x522ebe[_0x30eb1a(0xf7)](_0x3b3724,_0x30eb1a(0xea)),_0x4450a7=apiExperimentalArtifactToYaml(_0x3e3bc2),_0x1ce767=toExperimentalArtifactYamlString(_0x4450a7),_0x1245f2=!a123_0x1fc611[_0x30eb1a(0x103)](_0x3b3724);let _0x118589=_0x1245f2,_0x305590,_0x2bccfe=_0x1ce767+('\x0a---\x20code\x20---\x0a'+_0x4450a7['code']+'\x0a');const _0x21490c=[..._0x4450a7[_0x30eb1a(0xea)]][_0x30eb1a(0x12d)]((_0x21342f,_0x107c74)=>_0x21342f[_0x30eb1a(0x13d)][_0x30eb1a(0x11c)](_0x107c74[_0x30eb1a(0x13d)]));for(const _0x23b110 of _0x21490c){_0x2bccfe+=_0x30eb1a(0x14b)+_0x23b110[_0x30eb1a(0x13d)]+_0x30eb1a(0x17d)+_0x23b110[_0x30eb1a(0x19f)]+'\x0a';}if(!_0x1245f2){let _0x1dce3e='';a123_0x1fc611[_0x30eb1a(0x103)](_0x1a5e05)&&(_0x1dce3e=a123_0x1fc611[_0x30eb1a(0xc0)](_0x1a5e05,_0x30eb1a(0xb8)));a123_0x1fc611[_0x30eb1a(0x103)](_0x191223)&&(_0x1dce3e+=_0x30eb1a(0x130)+a123_0x1fc611[_0x30eb1a(0xc0)](_0x191223,'utf-8')+'\x0a');if(a123_0x1fc611[_0x30eb1a(0x103)](_0x8c15fb)){const _0x49e172=a123_0x1fc611[_0x30eb1a(0xcc)](_0x8c15fb),_0x24b12a=_0x49e172['filter'](_0x33dbc2=>{const _0x1d13a6=_0x30eb1a,_0x549fe5=a123_0x522ebe[_0x1d13a6(0xf7)](_0x8c15fb,_0x33dbc2);return a123_0x1fc611[_0x1d13a6(0x197)](_0x549fe5)[_0x1d13a6(0x196)]();})[_0x30eb1a(0x12d)]((_0x49a6ac,_0x3998dc)=>_0x49a6ac[_0x30eb1a(0x11c)](_0x3998dc));for(const _0x37d6ef of _0x24b12a){const _0x120d62=a123_0x522ebe[_0x30eb1a(0xf7)](_0x8c15fb,_0x37d6ef);_0x1dce3e+=_0x30eb1a(0x14b)+_0x37d6ef+_0x30eb1a(0x17d)+a123_0x1fc611[_0x30eb1a(0xc0)](_0x120d62,_0x30eb1a(0xb8))+'\x0a';}}const _0x8f46ad=generateDiff(_0x1dce3e,_0x2bccfe);_0x118589=hasChanges(_0x8f46ad),_0x118589&&(_0x305590=formatDiffWithColors(_0x8f46ad));}_0xecbb24[_0x30eb1a(0x102)]({'path':_0x3b3724,'content':'','isDir':!![]}),_0xecbb24[_0x30eb1a(0x102)]({'path':_0x1a5e05,'content':_0x1ce767}),_0xecbb24[_0x30eb1a(0x102)]({'path':_0x191223,'content':_0x4450a7[_0x30eb1a(0x13a)]});if(_0x4450a7[_0x30eb1a(0xea)][_0x30eb1a(0xf2)]>0x0){_0xecbb24[_0x30eb1a(0x102)]({'path':_0x8c15fb,'content':'','isDir':!![]});for(const _0x54b7d9 of _0x4450a7['files']){const _0x3701a5=a123_0x522ebe['join'](_0x8c15fb,_0x54b7d9['file_name']);_0xecbb24[_0x30eb1a(0x102)]({'path':_0x3701a5,'content':_0x54b7d9[_0x30eb1a(0x19f)]});}}if(a123_0x1fc611[_0x30eb1a(0x103)](_0x8c15fb)){const _0x540ef2=a123_0x1fc611['readdirSync'](_0x8c15fb),_0x384ecb=new Set(_0x4450a7[_0x30eb1a(0xea)]['map'](_0x185324=>_0x185324[_0x30eb1a(0x13d)]));for(const _0x3f2d29 of _0x540ef2){const _0x1404e8=a123_0x522ebe['join'](_0x8c15fb,_0x3f2d29);a123_0x1fc611[_0x30eb1a(0x197)](_0x1404e8)[_0x30eb1a(0x196)]()&&!_0x384ecb[_0x30eb1a(0xee)](_0x3f2d29)&&_0x235b26[_0x30eb1a(0x102)]({'path':_0x1404e8});}}_0x587a71[_0x30eb1a(0x1a3)][_0x30eb1a(0x102)]({'name':_0x3e3bc2[_0x30eb1a(0x11f)][_0x30eb1a(0x1b3)],'outputPath':_0x3b3724,'isNew':_0x1245f2,'hasChanges':_0x118589,'diff':_0x305590}),_0x587a71['counts'][_0x30eb1a(0x1a3)][_0x30eb1a(0x157)]++;if(_0x1245f2)_0x587a71[_0x30eb1a(0x1b5)]['experimentalArtifacts']['new']++;else{if(_0x118589)_0x587a71['counts']['experimentalArtifacts'][_0x30eb1a(0x11d)]++;else _0x587a71[_0x30eb1a(0x1b5)]['experimentalArtifacts'][_0x30eb1a(0x104)]++;}}if(_0x4b5ba9?.['dryRun'])return _0x587a71;a123_0x1fc611[_0x30eb1a(0x17a)](_0x5cb9a2,{'recursive':!![]}),a123_0x1fc611[_0x30eb1a(0x17a)](getKnowledgeBasesDir(_0x5cb9a2),{'recursive':!![]}),a123_0x1fc611[_0x30eb1a(0x17a)](getPromptsDir(_0x5cb9a2),{'recursive':!![]}),a123_0x1fc611[_0x30eb1a(0x17a)](getIntegrationsDir(_0x5cb9a2),{'recursive':!![]}),a123_0x1fc611[_0x30eb1a(0x17a)](getExperimentalKnowledgeBasesDir(_0x5cb9a2),{'recursive':!![]}),a123_0x1fc611[_0x30eb1a(0x17a)](getExperimentalArtifactsDir(_0x5cb9a2),{'recursive':!![]});const _0x4db2a9=a123_0x522ebe['join'](_0x5cb9a2,_0x30eb1a(0x172));a123_0x1fc611[_0x30eb1a(0x179)](_0x4db2a9,createAgentConfigContent(_0x2359a7));for(const _0x451560 of _0xecbb24){if(_0x451560[_0x30eb1a(0x109)])a123_0x1fc611[_0x30eb1a(0x17a)](_0x451560[_0x30eb1a(0x1c6)],{'recursive':!![]});else{const _0x1d357a=a123_0x522ebe['dirname'](_0x451560[_0x30eb1a(0x1c6)]);!a123_0x1fc611[_0x30eb1a(0x103)](_0x1d357a)&&a123_0x1fc611[_0x30eb1a(0x17a)](_0x1d357a,{'recursive':!![]}),a123_0x1fc611[_0x30eb1a(0x179)](_0x451560[_0x30eb1a(0x1c6)],_0x451560[_0x30eb1a(0x1bc)]);}}for(const _0x22da74 of _0x235b26){_0x22da74['isDir']?(a123_0x1fc611[_0x30eb1a(0x180)](_0x22da74[_0x30eb1a(0x1c6)],{'recursive':!![],'force':!![]}),this[_0x30eb1a(0x187)][_0x30eb1a(0xec)]('Removed\x20deleted\x20directory:\x20'+a123_0x522ebe['basename'](a123_0x522ebe[_0x30eb1a(0x1ba)](_0x22da74['path']))+'/'+a123_0x522ebe[_0x30eb1a(0x10a)](_0x22da74[_0x30eb1a(0x1c6)]))):(a123_0x1fc611[_0x30eb1a(0x180)](_0x22da74[_0x30eb1a(0x1c6)],{'force':!![]}),this[_0x30eb1a(0x187)]['info'](_0x30eb1a(0x199)+a123_0x522ebe[_0x30eb1a(0x10a)](a123_0x522ebe[_0x30eb1a(0x1ba)](_0x22da74[_0x30eb1a(0x1c6)]))+'/'+a123_0x522ebe[_0x30eb1a(0x10a)](_0x22da74[_0x30eb1a(0x1c6)])));}return _0x587a71;}async[a123_0x5aa90d(0xf9)](_0x54d8a8,_0x56d015){const _0x1a9c41=a123_0x5aa90d,_0x3b1700=a123_0x522ebe[_0x1a9c41(0xf7)](_0x54d8a8,_0x1a9c41(0x172));if(!a123_0x1fc611[_0x1a9c41(0x103)](_0x3b1700))throw new SDKError(ErrorCode[_0x1a9c41(0x14c)],_0x1a9c41(0x114)+_0x54d8a8,undefined,{'helpText':_0x1a9c41(0x129)});const _0xf7127d=loadAgentConfig(_0x3b1700),_0x417521=await this[_0x1a9c41(0x1c0)](_0xf7127d[_0x1a9c41(0xbd)]),_0x1350d9=await this[_0x1a9c41(0x1cd)]['getProject'](_0x417521),_0x5e7ef0=_0x1350d9[_0x1a9c41(0x11f)][_0x1a9c41(0x1b3)],_0x2bc488={'projectName':_0x5e7ef0,'projectId':_0x417521,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x1e312d=[],_0x49121f=[],_0x1e85c1=[],_0x5b583b=[],_0x2dbf10=[],_0x585420=[],_0x248c0e=a123_0x1fc611[_0x1a9c41(0xcc)](_0x54d8a8,{'withFileTypes':!![]});for(const _0x30bed8 of _0x248c0e){if(!_0x30bed8[_0x1a9c41(0x127)]())continue;if([_0x1a9c41(0x16a),_0x1a9c41(0x16c),_0x1a9c41(0xc8),_0x1a9c41(0x1ae),'experimental_artifacts']['includes'](_0x30bed8[_0x1a9c41(0x1b3)]))continue;const _0x52428d=a123_0x522ebe[_0x1a9c41(0xf7)](_0x54d8a8,_0x30bed8[_0x1a9c41(0x1b3)]);if(isAgentDir(_0x52428d)){const _0x11205c=a123_0x522ebe[_0x1a9c41(0xf7)](_0x52428d,_0x1a9c41(0x1b2)),_0x14e66f=a123_0x522ebe[_0x1a9c41(0xf7)](_0x52428d,_0x1a9c41(0xfc)),_0x55ef2a=a123_0x522ebe[_0x1a9c41(0xf7)](_0x52428d,_0x1a9c41(0x146)),_0x4ee686=parseAgentYaml(a123_0x1fc611[_0x1a9c41(0xc0)](_0x11205c,'utf-8'),_0x11205c),_0x1830ad=a123_0x1fc611[_0x1a9c41(0x103)](_0x14e66f)?a123_0x1fc611[_0x1a9c41(0xc0)](_0x14e66f,_0x1a9c41(0xb8)):'',_0x2f6660=a123_0x1fc611[_0x1a9c41(0x103)](_0x55ef2a)?a123_0x1fc611[_0x1a9c41(0xc0)](_0x55ef2a,_0x1a9c41(0xb8)):_0x4ee686['starter_message'];_0x1e312d[_0x1a9c41(0x102)]({'name':_0x4ee686[_0x1a9c41(0x1b3)],'dir':_0x52428d,'yaml':_0x4ee686,'systemPrompt':_0x1830ad,'starterMessage':_0x2f6660});}}const _0x14dce2=getKnowledgeBasesDir(_0x54d8a8);if(a123_0x1fc611['existsSync'](_0x14dce2)){const _0x407834=a123_0x1fc611[_0x1a9c41(0xcc)](_0x14dce2);for(const _0x2d9d42 of _0x407834){const _0x30e6fe=a123_0x522ebe['join'](_0x14dce2,_0x2d9d42);if(_0x2d9d42['endsWith'](_0x1a9c41(0x14e))){const _0x3dc88c=parseKnowledgeBaseYaml(a123_0x1fc611[_0x1a9c41(0xc0)](_0x30e6fe,_0x1a9c41(0xb8)),_0x30e6fe);_0x49121f['push']({'name':_0x3dc88c[_0x1a9c41(0x1b3)],'path':_0x30e6fe,'yaml':_0x3dc88c});}else{if(_0x2d9d42['endsWith'](_0x1a9c41(0x152))){const _0x25a3e5=a123_0x1fc611['readFileSync'](_0x30e6fe,'utf-8'),{name:_0x265a83,text:_0x66c45}=parseTextKnowledgeBaseMd(_0x25a3e5,_0x2d9d42);_0x1e85c1['push']({'name':_0x265a83,'path':_0x30e6fe,'text':_0x66c45});}}}}const _0x42de76=getPromptsDir(_0x54d8a8);if(a123_0x1fc611[_0x1a9c41(0x103)](_0x42de76)){const _0xab710c=a123_0x1fc611[_0x1a9c41(0xcc)](_0x42de76)['filter'](_0x1bee5d=>_0x1bee5d[_0x1a9c41(0xed)](_0x1a9c41(0x14e)));for(const _0x1e89f6 of _0xab710c){const _0x494473=a123_0x522ebe[_0x1a9c41(0xf7)](_0x42de76,_0x1e89f6),_0x22c1ba=parsePromptYaml(a123_0x1fc611['readFileSync'](_0x494473,'utf-8'),_0x494473);_0x5b583b[_0x1a9c41(0x102)]({'name':_0x22c1ba[_0x1a9c41(0x1b3)],'path':_0x494473,'yaml':_0x22c1ba});}}const _0x3c5cf6=[],_0x2bfde9=getIntegrationsDir(_0x54d8a8);if(a123_0x1fc611[_0x1a9c41(0x103)](_0x2bfde9)){const _0x4270d6=a123_0x1fc611['readdirSync'](_0x2bfde9)[_0x1a9c41(0x190)](_0x20df72=>_0x20df72[_0x1a9c41(0xed)](_0x1a9c41(0x14e)));for(const _0x34aebb of _0x4270d6){const _0xf952b2=a123_0x522ebe[_0x1a9c41(0xf7)](_0x2bfde9,_0x34aebb),_0x21e1a0=parseIntegrationYaml(a123_0x1fc611[_0x1a9c41(0xc0)](_0xf952b2,_0x1a9c41(0xb8)),_0xf952b2);if(!SAFE_INTEGRATION_TYPES[_0x1a9c41(0xcb)](_0x21e1a0['service_type'][_0x1a9c41(0x156)]())){this[_0x1a9c41(0x187)]['warn'](_0x1a9c41(0xd9)+_0x21e1a0[_0x1a9c41(0x1b3)]+'\x27\x20('+_0x21e1a0[_0x1a9c41(0x14d)]+_0x1a9c41(0x1a0)+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES[_0x1a9c41(0xf7)](',\x20')+')\x20can\x20be\x20pushed.\x20')+_0x1a9c41(0x164));continue;}_0x3c5cf6[_0x1a9c41(0x102)]({'name':_0x21e1a0[_0x1a9c41(0x1b3)],'path':_0xf952b2,'yaml':_0x21e1a0});}}const _0xa1c96f=getExperimentalKnowledgeBasesDir(_0x54d8a8);if(a123_0x1fc611[_0x1a9c41(0x103)](_0xa1c96f)){const _0x461540=a123_0x1fc611[_0x1a9c41(0xcc)](_0xa1c96f,{'withFileTypes':!![]});for(const _0x2a8e2b of _0x461540){if(!_0x2a8e2b[_0x1a9c41(0x127)]())continue;const _0x19e756=a123_0x522ebe[_0x1a9c41(0xf7)](_0xa1c96f,_0x2a8e2b['name']),_0x52a8da=a123_0x522ebe['join'](_0x19e756,_0x2a8e2b[_0x1a9c41(0x1b3)]+_0x1a9c41(0x14e)),_0x138e74=a123_0x522ebe['join'](_0x19e756,_0x1a9c41(0x13b));if(!a123_0x1fc611[_0x1a9c41(0x103)](_0x52a8da))continue;const _0x22cfa8=parseExperimentalKnowledgeBaseYaml(a123_0x1fc611['readFileSync'](_0x52a8da,_0x1a9c41(0xb8)),_0x52a8da),_0x13ae2f=[];if(a123_0x1fc611['existsSync'](_0x138e74)){const _0x2c0e77=a123_0x1fc611['readdirSync'](_0x138e74,{'withFileTypes':!![]});for(const _0x5ae0df of _0x2c0e77){if(!_0x5ae0df[_0x1a9c41(0x127)]())continue;const _0x3115de=a123_0x522ebe[_0x1a9c41(0xf7)](_0x138e74,_0x5ae0df['name']),_0x52a2a1=a123_0x522ebe[_0x1a9c41(0xf7)](_0x3115de,_0x1a9c41(0x120)),_0x557197=a123_0x522ebe['join'](_0x3115de,_0x1a9c41(0xd1));a123_0x1fc611[_0x1a9c41(0x103)](_0x52a2a1)&&a123_0x1fc611[_0x1a9c41(0x103)](_0x557197)&&_0x13ae2f['push']({'name':_0x5ae0df[_0x1a9c41(0x1b3)],'code':a123_0x1fc611[_0x1a9c41(0xc0)](_0x52a2a1,_0x1a9c41(0xb8)),'json_schema':a123_0x1fc611[_0x1a9c41(0xc0)](_0x557197,_0x1a9c41(0xb8))});}}const _0x403bfe={..._0x22cfa8,'variables':_0x22cfa8[_0x1a9c41(0x135)]||[],'functions':_0x13ae2f};_0x2dbf10[_0x1a9c41(0x102)]({'name':_0x22cfa8['name'],'dir':_0x19e756,'def':_0x403bfe});}}const _0x15ea93=getExperimentalArtifactsDir(_0x54d8a8);if(a123_0x1fc611[_0x1a9c41(0x103)](_0x15ea93)){const _0x4e842c=a123_0x1fc611[_0x1a9c41(0xcc)](_0x15ea93,{'withFileTypes':!![]});for(const _0xe28e59 of _0x4e842c){if(!_0xe28e59[_0x1a9c41(0x127)]())continue;const _0x174d49=a123_0x522ebe[_0x1a9c41(0xf7)](_0x15ea93,_0xe28e59[_0x1a9c41(0x1b3)]),_0x52fdc3=a123_0x522ebe['join'](_0x174d49,_0xe28e59[_0x1a9c41(0x1b3)]+'.yml'),_0x302771=a123_0x522ebe[_0x1a9c41(0xf7)](_0x174d49,_0x1a9c41(0x120)),_0x297b74=a123_0x522ebe[_0x1a9c41(0xf7)](_0x174d49,'files');if(!a123_0x1fc611[_0x1a9c41(0x103)](_0x52fdc3)||!a123_0x1fc611['existsSync'](_0x302771))continue;const _0xed9737=parseExperimentalArtifactYaml(a123_0x1fc611[_0x1a9c41(0xc0)](_0x52fdc3,_0x1a9c41(0xb8)),_0x52fdc3),_0x18c265=a123_0x1fc611['readFileSync'](_0x302771,'utf-8'),_0x51735f=[];if(a123_0x1fc611['existsSync'](_0x297b74)){const _0x451062=a123_0x1fc611[_0x1a9c41(0xcc)](_0x297b74);for(const _0x894775 of _0x451062){const _0x4f4f0f=a123_0x522ebe[_0x1a9c41(0xf7)](_0x297b74,_0x894775);a123_0x1fc611[_0x1a9c41(0x197)](_0x4f4f0f)[_0x1a9c41(0x196)]()&&_0x51735f[_0x1a9c41(0x102)]({'file_name':_0x894775,'text_content':a123_0x1fc611[_0x1a9c41(0xc0)](_0x4f4f0f,_0x1a9c41(0xb8))});}}const _0x50009e={..._0xed9737,'code':_0x18c265,'files':_0x51735f};_0x585420['push']({'name':_0xed9737[_0x1a9c41(0x1b3)],'dir':_0x174d49,'def':_0x50009e});}}const _0x142ae1=await this[_0x1a9c41(0x1cd)]['listAgentsFull'](_0x417521),_0xedce83=await this['client'][_0x1a9c41(0xb7)](_0x417521),_0x5ac587=await this[_0x1a9c41(0x1cd)][_0x1a9c41(0x176)](_0x417521),_0x4e0d91=await this['client'][_0x1a9c41(0x136)](_0x417521),_0x2a546e=await this['client'][_0x1a9c41(0x10f)](_0x417521),_0x2135e8=await safeListOrEmpty(()=>this[_0x1a9c41(0x1cd)][_0x1a9c41(0x19d)](_0x417521)),_0x3b90e1=await safeListOrEmpty(()=>this[_0x1a9c41(0x1cd)][_0x1a9c41(0x131)](_0x417521)),_0x3f083c=await fetchAllToolTargetMaps((_0x5a13a8,_0x2a4a85)=>this[_0x1a9c41(0x1cd)]['listToolTargets'](_0x5a13a8,_0x2a4a85),_0x417521),_0x5ee228=new Map(),_0x3b8a08=new Map(),_0x1b4592=new Map(),_0x48362a=new Map(),_0x47247b=new Map(),_0x1acf7d=new Map(),_0x22e241=new Map();for(const _0x35035b of _0x142ae1){_0x5ee228[_0x1a9c41(0x100)](_0x35035b[_0x1a9c41(0x11f)][_0x1a9c41(0x1b3)],_0x35035b);}for(const _0x48d976 of _0xedce83){_0x3b8a08[_0x1a9c41(0x100)](_0x48d976[_0x1a9c41(0x11f)][_0x1a9c41(0x1b3)],_0x48d976);}for(const _0x20b31a of _0x5ac587){_0x1b4592[_0x1a9c41(0x100)](_0x20b31a['attributes'][_0x1a9c41(0x1b3)],_0x20b31a);}for(const _0x3c5c8c of _0x4e0d91){_0x48362a['set'](_0x3c5c8c[_0x1a9c41(0x11f)]['name'],_0x3c5c8c);}for(const _0x5589bb of _0x2a546e){_0x47247b[_0x1a9c41(0x100)](_0x5589bb[_0x1a9c41(0x11f)]['serviceType'][_0x1a9c41(0x156)](),_0x5589bb);}for(const _0x1dc2e0 of _0x2135e8){_0x1acf7d[_0x1a9c41(0x100)](_0x1dc2e0[_0x1a9c41(0x11f)][_0x1a9c41(0x1b3)],_0x1dc2e0);}for(const _0x17f4e9 of _0x3b90e1){_0x22e241[_0x1a9c41(0x100)](_0x17f4e9['attributes'][_0x1a9c41(0x1b3)],_0x17f4e9);}const _0x43d7c3=new Map(),_0x72b371=new Map();for(const _0x438c4d of _0x142ae1){_0x43d7c3[_0x1a9c41(0x100)](_0x438c4d['attributes'][_0x1a9c41(0x1b3)],_0x438c4d['id']),_0x72b371[_0x1a9c41(0x100)](_0x438c4d['id'],_0x438c4d[_0x1a9c41(0x11f)][_0x1a9c41(0x1b3)]);}const _0x105e00=new Map(),_0x29f5e4=new Map();for(const _0x5adbc of _0x4e0d91){_0x105e00['set'](_0x5adbc['attributes'][_0x1a9c41(0x1b3)],_0x5adbc['id']),_0x29f5e4[_0x1a9c41(0x100)](_0x5adbc['id'],_0x5adbc[_0x1a9c41(0x11f)]['name']);}const _0x19f806=_0x3f083c['nameToId'][_0x1a9c41(0xbe)]||new Map(),_0x4999dd=_0x3f083c[_0x1a9c41(0x17f)][_0x1a9c41(0x105)]||new Map(),_0x3aab6c=_0x3f083c[_0x1a9c41(0x17f)][_0x1a9c41(0xd8)]||new Map(),_0xce7499=new Map(),_0x15ccec={'resolveToolTargetName':buildNameResolver({..._0x3f083c['idToName'],'Agent':_0x72b371}),'resolvePromptName':async _0x4fa90d=>_0x29f5e4['get'](_0x4fa90d),'onWarning':_0x25b2e8=>this[_0x1a9c41(0x187)][_0x1a9c41(0xeb)](_0x25b2e8)};let _0x1a430a=[];const _0x3f331b={'projectId':_0x417521,'resolveToolTargetId':buildIdResolver({..._0x3f083c[_0x1a9c41(0x17f)],'Agent':_0x43d7c3}),'resolvePromptId':async _0x595106=>_0x105e00[_0x1a9c41(0xf5)](_0x595106),'onWarning':_0x548037=>{const _0x1ff742=_0x1a9c41;this[_0x1ff742(0x187)][_0x1ff742(0xeb)](_0x548037),_0x1a430a[_0x1ff742(0x102)](_0x548037);}},{resolved:_0x462e35,unresolved:_0x5562f3}=resolveAgentDependencies(_0x1e312d,new Set(_0x5ee228[_0x1a9c41(0x15d)]()));for(const {agent:_0x2f7eff,missingDeps:_0xe25b99}of _0x5562f3){_0x2bc488['agents'][_0x1a9c41(0x102)]({'agentName':_0x2f7eff['yaml']['name'],'action':_0x1a9c41(0xe4),'error':_0x1a9c41(0xd7)+_0xe25b99[_0x1a9c41(0xf7)](',\x20')+'.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.'}),_0x2bc488[_0x1a9c41(0x1b5)]['agents'][_0x1a9c41(0x115)]++;}for(const _0x2d3c75 of _0x49121f){const _0x4a1dc0=_0x3b8a08[_0x1a9c41(0xf5)](_0x2d3c75['yaml'][_0x1a9c41(0x1b3)]),_0x1e5e61=a123_0x1fc611[_0x1a9c41(0xc0)](_0x2d3c75[_0x1a9c41(0x1c6)],'utf-8');if(_0x4a1dc0){const _0xe80569=apiKnowledgeBaseToYaml(_0x4a1dc0),_0x29869d=toKnowledgeBaseYamlString(_0xe80569),_0x4ff70c=generateDiff(_0x29869d,_0x1e5e61),_0x297e76=hasChanges(_0x4ff70c);_0x297e76?(_0x2bc488[_0x1a9c41(0x185)][_0x1a9c41(0x102)]({'name':_0x2d3c75[_0x1a9c41(0xfa)]['name'],'action':'updated','id':_0x4a1dc0['id'],'diff':formatDiffWithColors(_0x4ff70c)}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x185)][_0x1a9c41(0x11d)]++):(_0x2bc488['knowledgeBases'][_0x1a9c41(0x102)]({'name':_0x2d3c75['yaml'][_0x1a9c41(0x1b3)],'action':'unchanged','id':_0x4a1dc0['id']}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x185)][_0x1a9c41(0x104)]++);}else _0x2bc488[_0x1a9c41(0x185)][_0x1a9c41(0x102)]({'name':_0x2d3c75[_0x1a9c41(0xfa)]['name'],'action':_0x1a9c41(0xdb)}),_0x2bc488[_0x1a9c41(0x1b5)]['knowledgeBases']['created']++;}for(const _0x8b7f1a of _0x1e85c1){const _0x5287ef=_0x1b4592[_0x1a9c41(0xf5)](_0x8b7f1a[_0x1a9c41(0x1b3)]),_0x150173=a123_0x1fc611['readFileSync'](_0x8b7f1a['path'],'utf-8');if(_0x5287ef){const _0x47b665=toTextKnowledgeBaseMd(_0x5287ef['attributes'][_0x1a9c41(0x1b3)],_0x5287ef[_0x1a9c41(0x11f)]['text']),_0x17be36=generateDiff(_0x47b665,_0x150173),_0x3b342a=hasChanges(_0x17be36);_0x3b342a?(_0x2bc488[_0x1a9c41(0x111)][_0x1a9c41(0x102)]({'name':_0x8b7f1a[_0x1a9c41(0x1b3)],'action':_0x1a9c41(0x11d),'id':_0x5287ef['id'],'diff':formatDiffWithColors(_0x17be36)}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x111)][_0x1a9c41(0x11d)]++):(_0x2bc488[_0x1a9c41(0x111)][_0x1a9c41(0x102)]({'name':_0x8b7f1a[_0x1a9c41(0x1b3)],'action':_0x1a9c41(0x104),'id':_0x5287ef['id']}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x111)][_0x1a9c41(0x104)]++);}else _0x2bc488[_0x1a9c41(0x111)][_0x1a9c41(0x102)]({'name':_0x8b7f1a[_0x1a9c41(0x1b3)],'action':_0x1a9c41(0xdb)}),_0x2bc488[_0x1a9c41(0x1b5)]['textKnowledgeBases'][_0x1a9c41(0xdb)]++;}for(const _0x28f511 of _0x462e35){const _0x50e481=_0x5ee228[_0x1a9c41(0xf5)](_0x28f511[_0x1a9c41(0xfa)][_0x1a9c41(0x1b3)]),_0x101f63=a123_0x522ebe[_0x1a9c41(0xf7)](_0x28f511['dir'],_0x1a9c41(0x1b2)),_0x5ee72a=a123_0x1fc611[_0x1a9c41(0xc0)](_0x101f63,_0x1a9c41(0xb8)),_0x1fd63b=_0x28f511[_0x1a9c41(0xce)],_0xd5f60c=_0x1a9c41(0x132)+_0x1fd63b+'\x0a\x0a#\x20agent.yml\x0a'+_0x5ee72a;if(_0x50e481){const {yaml:_0x128983,systemPrompt:_0x2b30bf}=await agentResponseToDef(_0x50e481,_0x15ccec),_0x4e2f69=toAgentYamlString(_0x128983),_0x345f9a=_0x1a9c41(0x132)+_0x2b30bf+_0x1a9c41(0x1cc)+_0x4e2f69,_0x746530=generateDiff(_0x345f9a,_0xd5f60c),_0x3959c0=hasChanges(_0x746530);_0x3959c0?(_0x2bc488[_0x1a9c41(0xd6)][_0x1a9c41(0x102)]({'agentName':_0x28f511[_0x1a9c41(0xfa)][_0x1a9c41(0x1b3)],'action':_0x1a9c41(0x11d),'agentId':_0x50e481['id'],'diff':formatDiffWithColors(_0x746530)}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0xd6)][_0x1a9c41(0x11d)]++):(_0x2bc488[_0x1a9c41(0xd6)][_0x1a9c41(0x102)]({'agentName':_0x28f511[_0x1a9c41(0xfa)]['name'],'action':_0x1a9c41(0x104),'agentId':_0x50e481['id']}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0xd6)][_0x1a9c41(0x104)]++);}else _0x2bc488[_0x1a9c41(0xd6)]['push']({'agentName':_0x28f511[_0x1a9c41(0xfa)][_0x1a9c41(0x1b3)],'action':_0x1a9c41(0xdb)}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0xd6)][_0x1a9c41(0xdb)]++;}for(const _0x4aee2d of _0x5b583b){const _0x30278b=_0x48362a[_0x1a9c41(0xf5)](_0x4aee2d[_0x1a9c41(0xfa)][_0x1a9c41(0x1b3)]),_0x3408c7=a123_0x1fc611['readFileSync'](_0x4aee2d['path'],_0x1a9c41(0xb8));if(_0x30278b){const _0x4d8395=await apiPromptToYaml(_0x30278b,_0x15ccec);if(!_0x4d8395){_0x2bc488[_0x1a9c41(0x16c)]['push']({'name':_0x4aee2d[_0x1a9c41(0xfa)][_0x1a9c41(0x1b3)],'action':_0x1a9c41(0x11d),'id':_0x30278b['id']}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x16c)][_0x1a9c41(0x11d)]++;continue;}const _0x286b7a=toPromptYamlString(_0x4d8395),_0x55cc11=generateDiff(_0x286b7a,_0x3408c7),_0x1c762b=hasChanges(_0x55cc11);_0x1c762b?(_0x2bc488['prompts'][_0x1a9c41(0x102)]({'name':_0x4aee2d[_0x1a9c41(0xfa)][_0x1a9c41(0x1b3)],'action':_0x1a9c41(0x11d),'id':_0x30278b['id'],'diff':formatDiffWithColors(_0x55cc11)}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x16c)]['updated']++):(_0x2bc488[_0x1a9c41(0x16c)][_0x1a9c41(0x102)]({'name':_0x4aee2d['yaml'][_0x1a9c41(0x1b3)],'action':_0x1a9c41(0x104),'id':_0x30278b['id']}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x16c)][_0x1a9c41(0x104)]++);}else _0x2bc488[_0x1a9c41(0x16c)][_0x1a9c41(0x102)]({'name':_0x4aee2d[_0x1a9c41(0xfa)]['name'],'action':_0x1a9c41(0xdb)}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x16c)]['created']++;}for(const _0x3bda36 of _0x3c5cf6){const _0x5e6eed=_0x47247b[_0x1a9c41(0xf5)](_0x3bda36['yaml']['service_type']),_0x3931af=a123_0x1fc611[_0x1a9c41(0xc0)](_0x3bda36['path'],'utf-8');if(_0x5e6eed){const _0x19b66a=await apiIntegrationToYaml(_0x5e6eed,_0x15ccec),_0x4b6d44=toIntegrationYamlString(_0x19b66a),_0x2ed274=generateDiff(_0x4b6d44,_0x3931af),_0x1843ba=hasChanges(_0x2ed274);_0x1843ba?(_0x2bc488[_0x1a9c41(0xc8)][_0x1a9c41(0x102)]({'name':_0x3bda36[_0x1a9c41(0xfa)]['service_type'],'action':'updated','id':_0x5e6eed['id'],'diff':formatDiffWithColors(_0x2ed274)}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0xc8)][_0x1a9c41(0x11d)]++):(_0x2bc488[_0x1a9c41(0xc8)][_0x1a9c41(0x102)]({'name':_0x3bda36[_0x1a9c41(0xfa)]['service_type'],'action':_0x1a9c41(0x104),'id':_0x5e6eed['id']}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0xc8)][_0x1a9c41(0x104)]++);}else _0x2bc488[_0x1a9c41(0xc8)]['push']({'name':_0x3bda36['yaml'][_0x1a9c41(0x14d)],'action':_0x1a9c41(0xdb)}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0xc8)][_0x1a9c41(0xdb)]++;}for(const _0x4c6805 of _0x2dbf10){const _0x541008=_0x1acf7d[_0x1a9c41(0xf5)](_0x4c6805[_0x1a9c41(0xf6)]['name']),_0x55d8cc=toExperimentalKnowledgeBaseYamlString(_0x4c6805[_0x1a9c41(0xf6)]);let _0x3fca4b=_0x55d8cc;for(const _0xe8d60c of _0x4c6805[_0x1a9c41(0xf6)][_0x1a9c41(0x13b)]){_0x3fca4b+=_0x1a9c41(0xe8)+_0xe8d60c[_0x1a9c41(0x1b3)]+'\x20---\x0a'+_0xe8d60c['code']+_0x1a9c41(0x118)+_0xe8d60c[_0x1a9c41(0x1b3)]+_0x1a9c41(0x17d)+_0xe8d60c[_0x1a9c41(0xba)]+'\x0a';}if(_0x541008){const _0x43efaf=apiExperimentalKnowledgeBaseToYaml(_0x541008),_0x5030e3=toExperimentalKnowledgeBaseYamlString(_0x43efaf);let _0x30f963=_0x5030e3;for(const _0x154918 of _0x43efaf[_0x1a9c41(0x13b)]){_0x30f963+='\x0a---\x20function:\x20'+_0x154918[_0x1a9c41(0x1b3)]+'\x20---\x0a'+_0x154918['code']+_0x1a9c41(0x118)+_0x154918[_0x1a9c41(0x1b3)]+_0x1a9c41(0x17d)+_0x154918[_0x1a9c41(0xba)]+'\x0a';}const _0xac6bac=generateDiff(_0x30f963,_0x3fca4b),_0x37cec6=hasChanges(_0xac6bac);_0x37cec6?(_0x2bc488[_0x1a9c41(0x183)][_0x1a9c41(0x102)]({'name':_0x4c6805[_0x1a9c41(0xf6)][_0x1a9c41(0x1b3)],'action':_0x1a9c41(0x11d),'id':_0x541008['id'],'diff':formatDiffWithColors(_0xac6bac)}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x183)][_0x1a9c41(0x11d)]++):(_0x2bc488[_0x1a9c41(0x183)]['push']({'name':_0x4c6805['def']['name'],'action':_0x1a9c41(0x104),'id':_0x541008['id']}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x183)][_0x1a9c41(0x104)]++);}else _0x2bc488[_0x1a9c41(0x183)][_0x1a9c41(0x102)]({'name':_0x4c6805[_0x1a9c41(0xf6)][_0x1a9c41(0x1b3)],'action':_0x1a9c41(0xdb)}),_0x2bc488['counts'][_0x1a9c41(0x183)][_0x1a9c41(0xdb)]++;}for(const _0x44c328 of _0x585420){const _0x286a2c=_0x22e241[_0x1a9c41(0xf5)](_0x44c328[_0x1a9c41(0xf6)]['name']),_0x11f155=toExperimentalArtifactYamlString(_0x44c328[_0x1a9c41(0xf6)]);let _0x283e0c=_0x11f155+('\x0a---\x20code\x20---\x0a'+_0x44c328[_0x1a9c41(0xf6)]['code']+'\x0a');for(const _0x43d5b4 of _0x44c328[_0x1a9c41(0xf6)][_0x1a9c41(0xea)]){_0x283e0c+=_0x1a9c41(0x14b)+_0x43d5b4[_0x1a9c41(0x13d)]+_0x1a9c41(0x17d)+_0x43d5b4[_0x1a9c41(0x19f)]+'\x0a';}if(_0x286a2c){const _0x16641e=apiExperimentalArtifactToYaml(_0x286a2c),_0xb27dca=toExperimentalArtifactYamlString(_0x16641e);let _0x486a74=_0xb27dca+(_0x1a9c41(0x130)+_0x16641e[_0x1a9c41(0x13a)]+'\x0a');for(const _0x3a97c6 of _0x16641e[_0x1a9c41(0xea)]){_0x486a74+=_0x1a9c41(0x14b)+_0x3a97c6[_0x1a9c41(0x13d)]+'\x20---\x0a'+_0x3a97c6[_0x1a9c41(0x19f)]+'\x0a';}const _0x436a41=generateDiff(_0x486a74,_0x283e0c),_0x3994ef=hasChanges(_0x436a41);_0x3994ef?(_0x2bc488[_0x1a9c41(0x1a3)][_0x1a9c41(0x102)]({'name':_0x44c328['def'][_0x1a9c41(0x1b3)],'action':_0x1a9c41(0x11d),'id':_0x286a2c['id'],'diff':formatDiffWithColors(_0x436a41)}),_0x2bc488['counts']['experimentalArtifacts']['updated']++):(_0x2bc488[_0x1a9c41(0x1a3)][_0x1a9c41(0x102)]({'name':_0x44c328[_0x1a9c41(0xf6)][_0x1a9c41(0x1b3)],'action':'unchanged','id':_0x286a2c['id']}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x1a3)][_0x1a9c41(0x104)]++);}else _0x2bc488[_0x1a9c41(0x1a3)][_0x1a9c41(0x102)]({'name':_0x44c328[_0x1a9c41(0xf6)][_0x1a9c41(0x1b3)],'action':_0x1a9c41(0xdb)}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x1a3)][_0x1a9c41(0xdb)]++;}if(_0x56d015?.[_0x1a9c41(0x1c8)])return _0x2bc488;_0x2bc488[_0x1a9c41(0x185)]=[],_0x2bc488[_0x1a9c41(0x111)]=[],_0x2bc488['prompts']=[],_0x2bc488[_0x1a9c41(0xc8)]=[],_0x2bc488[_0x1a9c41(0x183)]=[],_0x2bc488[_0x1a9c41(0x1a3)]=[];const _0xa9dc5d=_0x2bc488[_0x1a9c41(0xd6)]['filter'](_0x2b0c44=>_0x2b0c44['action']===_0x1a9c41(0xe4));_0x2bc488[_0x1a9c41(0xd6)]=_0xa9dc5d,_0x2bc488[_0x1a9c41(0x1b5)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0xa9dc5d[_0x1a9c41(0xf2)]},'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},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x14a4c4 of _0x49121f){try{const _0x17bb75=_0x3b8a08[_0x1a9c41(0xf5)](_0x14a4c4[_0x1a9c41(0xfa)][_0x1a9c41(0x1b3)]),_0x44e89b=yamlKnowledgeBaseToApi(_0x14a4c4[_0x1a9c41(0xfa)],_0x417521);if(_0x17bb75)await this[_0x1a9c41(0x1cd)][_0x1a9c41(0x1b6)](_0x17bb75['id'],_0x44e89b),_0x19f806[_0x1a9c41(0x100)](_0x14a4c4[_0x1a9c41(0xfa)][_0x1a9c41(0x1b3)],_0x17bb75['id']),_0x2bc488[_0x1a9c41(0x185)][_0x1a9c41(0x102)]({'name':_0x14a4c4[_0x1a9c41(0xfa)][_0x1a9c41(0x1b3)],'action':_0x1a9c41(0x11d),'id':_0x17bb75['id']}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x185)][_0x1a9c41(0x11d)]++;else{const _0x1a16b1=await this[_0x1a9c41(0x1cd)][_0x1a9c41(0x17c)](_0x44e89b);_0x19f806[_0x1a9c41(0x100)](_0x14a4c4['yaml']['name'],_0x1a16b1['id']),_0x2bc488[_0x1a9c41(0x185)]['push']({'name':_0x14a4c4[_0x1a9c41(0xfa)]['name'],'action':_0x1a9c41(0xdb),'id':_0x1a16b1['id']}),_0x2bc488['counts'][_0x1a9c41(0x185)][_0x1a9c41(0xdb)]++;}}catch(_0x38d773){_0x2bc488[_0x1a9c41(0x185)][_0x1a9c41(0x102)]({'name':_0x14a4c4[_0x1a9c41(0xfa)][_0x1a9c41(0x1b3)],'action':_0x1a9c41(0xe4),'error':_0x38d773['message']}),_0x2bc488['counts']['knowledgeBases']['errors']++;}}for(const _0x4e2f89 of _0x1e85c1){try{const _0x2fb6cf=_0x1b4592[_0x1a9c41(0xf5)](_0x4e2f89[_0x1a9c41(0x1b3)]),_0x5543c1=yamlTextKnowledgeBaseToApi({'name':_0x4e2f89[_0x1a9c41(0x1b3)],'text':_0x4e2f89[_0x1a9c41(0xd3)]},_0x417521);if(_0x2fb6cf)await this['client'][_0x1a9c41(0x18a)](_0x2fb6cf['id'],_0x5543c1),_0x4999dd['set'](_0x4e2f89[_0x1a9c41(0x1b3)],_0x2fb6cf['id']),_0x2bc488[_0x1a9c41(0x111)][_0x1a9c41(0x102)]({'name':_0x4e2f89[_0x1a9c41(0x1b3)],'action':_0x1a9c41(0x11d),'id':_0x2fb6cf['id']}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x111)][_0x1a9c41(0x11d)]++;else{const _0x343fd7=await this[_0x1a9c41(0x1cd)]['createTextKnowledgeBase'](_0x5543c1);_0x4999dd[_0x1a9c41(0x100)](_0x4e2f89[_0x1a9c41(0x1b3)],_0x343fd7['id']),_0x2bc488['textKnowledgeBases'][_0x1a9c41(0x102)]({'name':_0x4e2f89[_0x1a9c41(0x1b3)],'action':_0x1a9c41(0xdb),'id':_0x343fd7['id']}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x111)][_0x1a9c41(0xdb)]++;}}catch(_0x1bbf42){_0x2bc488[_0x1a9c41(0x111)][_0x1a9c41(0x102)]({'name':_0x4e2f89[_0x1a9c41(0x1b3)],'action':_0x1a9c41(0xe4),'error':_0x1bbf42['message']}),_0x2bc488[_0x1a9c41(0x1b5)]['textKnowledgeBases'][_0x1a9c41(0x115)]++;}}for(const _0x43e55c of _0x2dbf10){try{const _0x1656b4=_0x1acf7d[_0x1a9c41(0xf5)](_0x43e55c['def'][_0x1a9c41(0x1b3)]),_0x1a6ca3=yamlExperimentalKnowledgeBaseToApi(_0x43e55c[_0x1a9c41(0xf6)],_0x417521);if(_0x1656b4)await this[_0x1a9c41(0x1cd)][_0x1a9c41(0x1b1)](_0x1656b4['id'],_0x1a6ca3),_0x3aab6c[_0x1a9c41(0x100)](_0x43e55c[_0x1a9c41(0xf6)][_0x1a9c41(0x1b3)],_0x1656b4['id']),_0x2bc488[_0x1a9c41(0x183)][_0x1a9c41(0x102)]({'name':_0x43e55c[_0x1a9c41(0xf6)][_0x1a9c41(0x1b3)],'action':_0x1a9c41(0x11d),'id':_0x1656b4['id']}),_0x2bc488['counts'][_0x1a9c41(0x183)][_0x1a9c41(0x11d)]++;else{const _0x50f600=await this[_0x1a9c41(0x1cd)][_0x1a9c41(0xf3)](_0x1a6ca3);_0x3aab6c[_0x1a9c41(0x100)](_0x43e55c[_0x1a9c41(0xf6)][_0x1a9c41(0x1b3)],_0x50f600['id']),_0x2bc488[_0x1a9c41(0x183)][_0x1a9c41(0x102)]({'name':_0x43e55c[_0x1a9c41(0xf6)][_0x1a9c41(0x1b3)],'action':_0x1a9c41(0xdb),'id':_0x50f600['id']}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x183)][_0x1a9c41(0xdb)]++;}}catch(_0x16f58a){_0x2bc488[_0x1a9c41(0x183)]['push']({'name':_0x43e55c[_0x1a9c41(0xf6)][_0x1a9c41(0x1b3)],'action':_0x1a9c41(0xe4),'error':_0x16f58a[_0x1a9c41(0x12b)]}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x183)][_0x1a9c41(0x115)]++;}}for(const _0x3240c5 of _0x585420){try{const _0x58e64e=_0x22e241[_0x1a9c41(0xf5)](_0x3240c5[_0x1a9c41(0xf6)][_0x1a9c41(0x1b3)]),_0x5e9068=yamlExperimentalArtifactToApi(_0x3240c5[_0x1a9c41(0xf6)],_0x417521);if(_0x58e64e)await this[_0x1a9c41(0x1cd)][_0x1a9c41(0x189)](_0x58e64e['id'],_0x5e9068),_0xce7499[_0x1a9c41(0x100)](_0x3240c5['def'][_0x1a9c41(0x1b3)],_0x58e64e['id']),_0x2bc488['experimentalArtifacts']['push']({'name':_0x3240c5['def'][_0x1a9c41(0x1b3)],'action':_0x1a9c41(0x11d),'id':_0x58e64e['id']}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x1a3)][_0x1a9c41(0x11d)]++;else{const _0x2e7e4b=await this['client'][_0x1a9c41(0x19e)](_0x5e9068);_0xce7499[_0x1a9c41(0x100)](_0x3240c5['def'][_0x1a9c41(0x1b3)],_0x2e7e4b['id']),_0x2bc488[_0x1a9c41(0x1a3)]['push']({'name':_0x3240c5['def']['name'],'action':_0x1a9c41(0xdb),'id':_0x2e7e4b['id']}),_0x2bc488[_0x1a9c41(0x1b5)]['experimentalArtifacts'][_0x1a9c41(0xdb)]++;}}catch(_0xc14061){_0x2bc488['experimentalArtifacts']['push']({'name':_0x3240c5['def']['name'],'action':_0x1a9c41(0xe4),'error':_0xc14061[_0x1a9c41(0x12b)]}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x1a3)][_0x1a9c41(0x115)]++;}}for(const _0x263c80 of _0x462e35){_0x1a430a=[];try{const _0x45b279=_0x5ee228[_0x1a9c41(0xf5)](_0x263c80['yaml'][_0x1a9c41(0x1b3)]),_0x4c8a77=await agentDefToRequest(_0x263c80[_0x1a9c41(0xfa)],_0x263c80['systemPrompt'],_0x263c80[_0x1a9c41(0x1c1)],_0x3f331b);if(_0x45b279)await this[_0x1a9c41(0x1cd)][_0x1a9c41(0x145)](_0x45b279['id'],_0x4c8a77),_0x43d7c3[_0x1a9c41(0x100)](_0x263c80[_0x1a9c41(0xfa)][_0x1a9c41(0x1b3)],_0x45b279['id']),_0x2bc488['agents'][_0x1a9c41(0x102)]({'agentName':_0x263c80[_0x1a9c41(0xfa)][_0x1a9c41(0x1b3)],'action':'updated','agentId':_0x45b279['id'],'warnings':_0x1a430a[_0x1a9c41(0xf2)]>0x0?_0x1a430a:undefined}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0xd6)][_0x1a9c41(0x11d)]++;else{const _0x223406=await this[_0x1a9c41(0x1cd)]['createAgentResponse'](_0x4c8a77);_0x43d7c3[_0x1a9c41(0x100)](_0x263c80[_0x1a9c41(0xfa)]['name'],_0x223406['id']),_0x2bc488[_0x1a9c41(0xd6)]['push']({'agentName':_0x263c80['yaml'][_0x1a9c41(0x1b3)],'action':_0x1a9c41(0xdb),'agentId':_0x223406['id'],'warnings':_0x1a430a[_0x1a9c41(0xf2)]>0x0?_0x1a430a:undefined}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0xd6)]['created']++;}}catch(_0x3188d4){_0x2bc488[_0x1a9c41(0xd6)][_0x1a9c41(0x102)]({'agentName':_0x263c80[_0x1a9c41(0xfa)]['name'],'action':'error','error':_0x3188d4[_0x1a9c41(0x12b)],'warnings':_0x1a430a[_0x1a9c41(0xf2)]>0x0?_0x1a430a:undefined}),_0x2bc488[_0x1a9c41(0x1b5)]['agents'][_0x1a9c41(0x115)]++;}}for(const _0x40ad70 of _0x5b583b){try{const _0x546564=_0x48362a[_0x1a9c41(0xf5)](_0x40ad70[_0x1a9c41(0xfa)][_0x1a9c41(0x1b3)]),_0x17a76b=await yamlPromptToApi(_0x40ad70[_0x1a9c41(0xfa)],_0x417521,_0x3f331b);if(!_0x17a76b){_0x2bc488[_0x1a9c41(0x16c)]['push']({'name':_0x40ad70[_0x1a9c41(0xfa)]['name'],'action':_0x1a9c41(0xe4),'error':_0x1a9c41(0x17b)}),_0x2bc488[_0x1a9c41(0x1b5)]['prompts']['errors']++;continue;}if(_0x546564)await this[_0x1a9c41(0x1cd)][_0x1a9c41(0x16b)](_0x546564['id'],_0x17a76b),_0x105e00[_0x1a9c41(0x100)](_0x40ad70[_0x1a9c41(0xfa)][_0x1a9c41(0x1b3)],_0x546564['id']),_0x2bc488[_0x1a9c41(0x16c)]['push']({'name':_0x40ad70[_0x1a9c41(0xfa)][_0x1a9c41(0x1b3)],'action':'updated','id':_0x546564['id']}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x16c)]['updated']++;else{const _0x30d458=await this['client']['createPrompt'](_0x17a76b);_0x105e00[_0x1a9c41(0x100)](_0x40ad70[_0x1a9c41(0xfa)][_0x1a9c41(0x1b3)],_0x30d458['id']),_0x2bc488[_0x1a9c41(0x16c)][_0x1a9c41(0x102)]({'name':_0x40ad70[_0x1a9c41(0xfa)][_0x1a9c41(0x1b3)],'action':_0x1a9c41(0xdb),'id':_0x30d458['id']}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x16c)]['created']++;}}catch(_0x252729){_0x2bc488[_0x1a9c41(0x16c)]['push']({'name':_0x40ad70['yaml']['name'],'action':_0x1a9c41(0xe4),'error':_0x252729[_0x1a9c41(0x12b)]}),_0x2bc488[_0x1a9c41(0x1b5)][_0x1a9c41(0x16c)][_0x1a9c41(0x115)]++;}}for(const _0x4d8498 of _0x3c5cf6){try{const _0x133f4a=_0x47247b[_0x1a9c41(0xf5)](_0x4d8498[_0x1a9c41(0xfa)]['service_type']),_0x1df224=await yamlIntegrationToApi(_0x4d8498[_0x1a9c41(0xfa)],_0x417521,_0x3f331b);if(_0x133f4a){await this[_0x1a9c41(0x1cd)][_0x1a9c41(0x149)](_0x133f4a['id']);const _0x4a1f26=await this[_0x1a9c41(0x1cd)][_0x1a9c41(0x17e)](_0x1df224);_0x2bc488['integrations'][_0x1a9c41(0x102)]({'name':_0x4d8498[_0x1a9c41(0xfa)]['service_type'],'action':_0x1a9c41(0x11d),'id':_0x4a1f26['id']}),_0x2bc488['counts'][_0x1a9c41(0xc8)][_0x1a9c41(0x11d)]++;}else{const _0x286a31=await this[_0x1a9c41(0x1cd)][_0x1a9c41(0x17e)](_0x1df224);_0x2bc488[_0x1a9c41(0xc8)]['push']({'name':_0x4d8498[_0x1a9c41(0xfa)][_0x1a9c41(0x14d)],'action':'created','id':_0x286a31['id']}),_0x2bc488['counts'][_0x1a9c41(0xc8)][_0x1a9c41(0xdb)]++;}}catch(_0x2af1b2){_0x2bc488[_0x1a9c41(0xc8)][_0x1a9c41(0x102)]({'name':_0x4d8498['yaml'][_0x1a9c41(0x14d)],'action':'error','error':_0x2af1b2[_0x1a9c41(0x12b)]}),_0x2bc488[_0x1a9c41(0x1b5)]['integrations'][_0x1a9c41(0x115)]++;}}return _0x2bc488;}async[a123_0x5aa90d(0x18b)](_0x64a4c9,_0x3586ce,_0x12162a,_0x3241c9){const _0x5b9965=a123_0x5aa90d,{projectId:_0x45d765,project:_0x230ed9}=await this[_0x5b9965(0x144)](_0x64a4c9),_0x12d3e9=_0x230ed9[_0x5b9965(0x11f)][_0x5b9965(0x1b3)],_0x453d72=await this['client'][_0x5b9965(0x128)](_0x45d765),_0x30c022=_0x453d72[_0x5b9965(0x142)](_0x521f33=>_0x521f33[_0x5b9965(0x11f)][_0x5b9965(0x1b3)]===_0x3586ce);if(!_0x30c022)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x5b9965(0x15b)+_0x3586ce,undefined,{'helpText':_0x5b9965(0x16f)+_0x453d72[_0x5b9965(0x12f)](_0x49d0ed=>_0x49d0ed['attributes'][_0x5b9965(0x1b3)])[_0x5b9965(0xf7)](',\x20')});let _0x564e92;if(_0x12162a)_0x564e92=_0x12162a;else{const _0x17fb13=a123_0x522ebe[_0x5b9965(0xf7)](process['cwd'](),_0x5b9965(0xd6)),_0x3c4119=getSanitizedPathWithMigration(_0x17fb13,_0x12d3e9);_0x3c4119['renamed']&&this[_0x5b9965(0x187)][_0x5b9965(0xec)]('Renamed\x20folder:\x20'+a123_0x522ebe[_0x5b9965(0x10a)](_0x3c4119['oldPath'])+_0x5b9965(0xcf)+a123_0x522ebe['basename'](_0x3c4119[_0x5b9965(0x1c6)])),_0x564e92=_0x3c4119[_0x5b9965(0x1c6)];}const _0x372756=getSanitizedPathWithMigration(_0x564e92,_0x3586ce);_0x372756[_0x5b9965(0x1a8)]&&this[_0x5b9965(0x187)][_0x5b9965(0xec)](_0x5b9965(0x186)+a123_0x522ebe[_0x5b9965(0x10a)](_0x372756[_0x5b9965(0x15c)])+_0x5b9965(0xcf)+a123_0x522ebe[_0x5b9965(0x10a)](_0x372756[_0x5b9965(0x1c6)]));const _0x32b598=_0x372756[_0x5b9965(0x1c6)],_0x279779=new Map(),_0x5b8c8c=new Map(),_0x5a796f=await this[_0x5b9965(0x1cd)][_0x5b9965(0xb7)](_0x45d765),_0x1068e2=await this[_0x5b9965(0x1cd)][_0x5b9965(0x176)](_0x45d765),_0x2ec311=await safeListOrEmpty(()=>this[_0x5b9965(0x1cd)][_0x5b9965(0x19d)](_0x45d765)),_0x5c82fe=new Map(),_0x146ad1=new Map();for(const _0x1a65b5 of _0x5a796f){_0x279779[_0x5b9965(0x100)](_0x1a65b5['id'],_0x1a65b5[_0x5b9965(0x11f)][_0x5b9965(0x1b3)]);}for(const _0x215a70 of _0x1068e2){_0x5c82fe[_0x5b9965(0x100)](_0x215a70['id'],_0x215a70[_0x5b9965(0x11f)][_0x5b9965(0x1b3)]);}for(const _0xbe2443 of _0x2ec311){_0x146ad1[_0x5b9965(0x100)](_0xbe2443['id'],_0xbe2443[_0x5b9965(0x11f)]['name']);}for(const _0x110992 of _0x453d72){_0x5b8c8c[_0x5b9965(0x100)](_0x110992['id'],_0x110992[_0x5b9965(0x11f)][_0x5b9965(0x1b3)]);}const _0xf2c0f8={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x279779,'TextKnowledgeBase':_0x5c82fe,'Agent':_0x5b8c8c,'ExperimentalKnowledgeBase':_0x146ad1}),'resolvePromptName':async()=>undefined,'onWarning':_0x198dc8=>this[_0x5b9965(0x187)][_0x5b9965(0xeb)](_0x198dc8)},_0x5476c4=a123_0x522ebe[_0x5b9965(0xf7)](_0x32b598,_0x5b9965(0xfc)),_0x2b0aac=a123_0x522ebe[_0x5b9965(0xf7)](_0x32b598,_0x5b9965(0x1b2)),_0x1e14aa=a123_0x522ebe[_0x5b9965(0xf7)](_0x32b598,'starter_message.md'),_0x29cd9c=!a123_0x1fc611[_0x5b9965(0x103)](_0x2b0aac);if(_0x3241c9?.[_0x5b9965(0x1c8)])return{'agentName':_0x3586ce,'outputPath':_0x32b598,'isNew':_0x29cd9c,'hasChanges':!![]};a123_0x1fc611[_0x5b9965(0x17a)](_0x564e92,{'recursive':!![]}),a123_0x1fc611['mkdirSync'](_0x32b598,{'recursive':!![]});const _0x4dea83=a123_0x522ebe[_0x5b9965(0xf7)](_0x564e92,_0x5b9965(0x172));!a123_0x1fc611[_0x5b9965(0x103)](_0x4dea83)&&a123_0x1fc611[_0x5b9965(0x179)](_0x4dea83,createAgentConfigContent(_0x64a4c9));const {yaml:_0x4ccfc7,systemPrompt:_0x38d451,starterMessage:_0xb09c3}=await agentResponseToDef(_0x30c022,_0xf2c0f8);let _0x1f8645=_0x29cd9c;if(!_0x29cd9c){const _0x1134da=a123_0x1fc611[_0x5b9965(0x103)](_0x5476c4)?a123_0x1fc611['readFileSync'](_0x5476c4,_0x5b9965(0xb8)):'',_0x22bb86=a123_0x1fc611[_0x5b9965(0xc0)](_0x2b0aac,_0x5b9965(0xb8));_0x1f8645=_0x1134da!==_0x38d451||_0x22bb86!==toAgentYamlString(_0x4ccfc7);}a123_0x1fc611[_0x5b9965(0x179)](_0x5476c4,_0x38d451),a123_0x1fc611[_0x5b9965(0x179)](_0x2b0aac,toAgentYamlString(_0x4ccfc7));if(_0xb09c3&&_0xb09c3[_0x5b9965(0xcb)]('\x0a'))a123_0x1fc611[_0x5b9965(0x179)](_0x1e14aa,_0xb09c3);else a123_0x1fc611['existsSync'](_0x1e14aa)&&a123_0x1fc611['unlinkSync'](_0x1e14aa);return{'agentName':_0x3586ce,'outputPath':_0x32b598,'isNew':_0x29cd9c,'hasChanges':_0x1f8645};}async[a123_0x5aa90d(0x1c7)](_0x155b99,_0x4ec315){const _0x4bc720=a123_0x5aa90d;let _0x18a47a;isAgentYamlPath(_0x155b99)?_0x18a47a=getAgentDirFromYamlPath(_0x155b99):_0x18a47a=_0x155b99;const {config:_0x47550d}=findAgentConfig(_0x18a47a),_0x294057=await this[_0x4bc720(0x1c0)](_0x47550d['llm_project']),_0x4342ce=a123_0x522ebe[_0x4bc720(0xf7)](_0x18a47a,'agent.yml'),_0x62b358=a123_0x522ebe[_0x4bc720(0xf7)](_0x18a47a,_0x4bc720(0xfc)),_0xf0531e=a123_0x522ebe[_0x4bc720(0xf7)](_0x18a47a,_0x4bc720(0x146));if(!a123_0x1fc611[_0x4bc720(0x103)](_0x4342ce))throw new SDKError(ErrorCode[_0x4bc720(0x133)],_0x4bc720(0xbc)+_0x18a47a,undefined,{'helpText':_0x4bc720(0x1ca)});const _0xd0a7c2=parseAgentYaml(a123_0x1fc611[_0x4bc720(0xc0)](_0x4342ce,'utf-8'),_0x4342ce),_0x1daee3=a123_0x1fc611[_0x4bc720(0x103)](_0x62b358)?a123_0x1fc611[_0x4bc720(0xc0)](_0x62b358,'utf-8'):'',_0x23e324=a123_0x1fc611['existsSync'](_0xf0531e)?a123_0x1fc611['readFileSync'](_0xf0531e,_0x4bc720(0xb8)):_0xd0a7c2[_0x4bc720(0xb4)];if(_0x4ec315?.[_0x4bc720(0x1c8)])return{'agentName':_0xd0a7c2['name'],'action':_0x4bc720(0xdb),'projectId':_0x294057};const _0x3e286d=await this[_0x4bc720(0x1cd)][_0x4bc720(0x128)](_0x294057),_0x2a6b50=await fetchAllToolTargetMaps((_0x2a4dcd,_0x4e44ed)=>this[_0x4bc720(0x1cd)][_0x4bc720(0x1c9)](_0x2a4dcd,_0x4e44ed),_0x294057),_0x2132ca=new Map();for(const _0xe337fa of _0x3e286d){_0x2132ca[_0x4bc720(0x100)](_0xe337fa[_0x4bc720(0x11f)][_0x4bc720(0x1b3)],_0xe337fa['id']);}const _0x6c763=[],_0x38ef32={'projectId':_0x294057,'resolveToolTargetId':buildIdResolver({..._0x2a6b50[_0x4bc720(0x17f)],'Agent':_0x2132ca}),'resolvePromptId':async()=>undefined,'onWarning':_0x5f3194=>{this['logger']['warn'](_0x5f3194),_0x6c763['push'](_0x5f3194);}};try{const _0x5c3911=_0x3e286d['find'](_0x71c1cd=>_0x71c1cd[_0x4bc720(0x11f)][_0x4bc720(0x1b3)]===_0xd0a7c2['name']),_0x2ad4fd=await agentDefToRequest(_0xd0a7c2,_0x1daee3,_0x23e324,_0x38ef32);if(_0x5c3911)return await this[_0x4bc720(0x1cd)][_0x4bc720(0x145)](_0x5c3911['id'],_0x2ad4fd),{'agentName':_0xd0a7c2['name'],'action':_0x4bc720(0x11d),'projectId':_0x294057,'agentId':_0x5c3911['id'],'warnings':_0x6c763['length']>0x0?_0x6c763:undefined};else{const _0x482302=await this[_0x4bc720(0x1cd)][_0x4bc720(0xcd)](_0x2ad4fd);return{'agentName':_0xd0a7c2[_0x4bc720(0x1b3)],'action':'created','projectId':_0x294057,'agentId':_0x482302['id'],'warnings':_0x6c763[_0x4bc720(0xf2)]>0x0?_0x6c763:undefined};}}catch(_0x18abe2){return{'agentName':_0xd0a7c2[_0x4bc720(0x1b3)],'action':'error','projectId':_0x294057,'error':_0x18abe2[_0x4bc720(0x12b)],'warnings':_0x6c763[_0x4bc720(0xf2)]>0x0?_0x6c763:undefined};}}async['cloneProject'](_0x17a02a,_0x34c928,_0x43cc8d){const _0x1d9486=a123_0x5aa90d,_0x4a80d1=a123_0x1fc611[_0x1d9486(0x103)](_0x17a02a)&&a123_0x1fc611[_0x1d9486(0x103)](a123_0x522ebe['join'](_0x17a02a,_0x1d9486(0x172)));let _0xf4c38a;const _0x5d0a3e=[],_0x453446=[],_0x3bcac6=[],_0x122f6f=[],_0x42baca=[],_0x2da978=[],_0xf83fb5=[];if(_0x4a80d1){const _0xbbc6c9=loadAgentConfig(a123_0x522ebe[_0x1d9486(0xf7)](_0x17a02a,_0x1d9486(0x172)));_0xf4c38a=_0xbbc6c9[_0x1d9486(0xbd)];const _0x40d579=a123_0x1fc611['readdirSync'](_0x17a02a,{'withFileTypes':!![]});for(const _0x2bddd0 of _0x40d579){if(!_0x2bddd0[_0x1d9486(0x127)]())continue;if([_0x1d9486(0x16a),_0x1d9486(0x1ae),_0x1d9486(0x11b),_0x1d9486(0x16c),_0x1d9486(0xc8)][_0x1d9486(0xcb)](_0x2bddd0[_0x1d9486(0x1b3)]))continue;const _0x4167e8=a123_0x522ebe[_0x1d9486(0xf7)](_0x17a02a,_0x2bddd0[_0x1d9486(0x1b3)]);if(isAgentDir(_0x4167e8)){const _0x27518a=a123_0x522ebe[_0x1d9486(0xf7)](_0x4167e8,'agent.yml'),_0xa350a8=a123_0x522ebe[_0x1d9486(0xf7)](_0x4167e8,_0x1d9486(0xfc)),_0x2e4a56=a123_0x522ebe[_0x1d9486(0xf7)](_0x4167e8,'starter_message.md'),_0x18d636=parseAgentYaml(a123_0x1fc611['readFileSync'](_0x27518a,'utf-8'),_0x27518a),_0x967c0e=a123_0x1fc611[_0x1d9486(0x103)](_0xa350a8)?a123_0x1fc611[_0x1d9486(0xc0)](_0xa350a8,_0x1d9486(0xb8)):'',_0x14b9b2=a123_0x1fc611[_0x1d9486(0x103)](_0x2e4a56)?a123_0x1fc611[_0x1d9486(0xc0)](_0x2e4a56,_0x1d9486(0xb8)):_0x18d636[_0x1d9486(0xb4)];_0x5d0a3e[_0x1d9486(0x102)]({'name':_0x18d636[_0x1d9486(0x1b3)],'dir':_0x4167e8,'yaml':_0x18d636,'systemPrompt':_0x967c0e,'starterMessage':_0x14b9b2});}}const _0x3aa9bb=getKnowledgeBasesDir(_0x17a02a);if(a123_0x1fc611[_0x1d9486(0x103)](_0x3aa9bb)){const _0x4e711d=a123_0x1fc611[_0x1d9486(0xcc)](_0x3aa9bb);for(const _0xe3b080 of _0x4e711d){const _0xe7a8ed=a123_0x522ebe[_0x1d9486(0xf7)](_0x3aa9bb,_0xe3b080);if(_0xe3b080['endsWith'](_0x1d9486(0x14e))){const _0xf457d=parseKnowledgeBaseYaml(a123_0x1fc611['readFileSync'](_0xe7a8ed,_0x1d9486(0xb8)),_0xe7a8ed);_0x453446[_0x1d9486(0x102)]({'name':_0xf457d[_0x1d9486(0x1b3)],'path':_0xe7a8ed,'yaml':_0xf457d});}else{if(_0xe3b080['endsWith']('.md')){const _0x2d7a66=a123_0x1fc611[_0x1d9486(0xc0)](_0xe7a8ed,'utf-8'),{name:_0x2f1f67,text:_0x5e9706}=parseTextKnowledgeBaseMd(_0x2d7a66,_0xe3b080);_0x3bcac6[_0x1d9486(0x102)]({'name':_0x2f1f67,'path':_0xe7a8ed,'text':_0x5e9706});}}}}const _0x5897f8=getPromptsDir(_0x17a02a);if(a123_0x1fc611['existsSync'](_0x5897f8)){const _0x4ab1ea=a123_0x1fc611[_0x1d9486(0xcc)](_0x5897f8)[_0x1d9486(0x190)](_0x3776e8=>_0x3776e8[_0x1d9486(0xed)](_0x1d9486(0x14e)));for(const _0xbe3860 of _0x4ab1ea){const _0x443fdc=a123_0x522ebe['join'](_0x5897f8,_0xbe3860),_0x252eae=parsePromptYaml(a123_0x1fc611[_0x1d9486(0xc0)](_0x443fdc,'utf-8'),_0x443fdc);_0x122f6f['push']({'name':_0x252eae[_0x1d9486(0x1b3)],'path':_0x443fdc,'yaml':_0x252eae});}}const _0xba488a=getIntegrationsDir(_0x17a02a);if(a123_0x1fc611[_0x1d9486(0x103)](_0xba488a)){const _0x5b22d3=a123_0x1fc611[_0x1d9486(0xcc)](_0xba488a)[_0x1d9486(0x190)](_0x3dfd77=>_0x3dfd77['endsWith'](_0x1d9486(0x14e)));for(const _0x3cac70 of _0x5b22d3){const _0x10bac1=a123_0x522ebe[_0x1d9486(0xf7)](_0xba488a,_0x3cac70),_0x25fb8b=parseIntegrationYaml(a123_0x1fc611['readFileSync'](_0x10bac1,_0x1d9486(0xb8)),_0x10bac1);SAFE_INTEGRATION_TYPES[_0x1d9486(0xcb)](_0x25fb8b[_0x1d9486(0x14d)][_0x1d9486(0x156)]())?_0x42baca[_0x1d9486(0x102)]({'name':_0x25fb8b[_0x1d9486(0x1b3)],'path':_0x10bac1,'yaml':_0x25fb8b}):this[_0x1d9486(0x187)][_0x1d9486(0xeb)](_0x1d9486(0xd9)+_0x25fb8b[_0x1d9486(0x1b3)]+_0x1d9486(0x158)+_0x25fb8b['service_type']+'):\x20'+(_0x1d9486(0x16d)+SAFE_INTEGRATION_TYPES[_0x1d9486(0xf7)](',\x20')+_0x1d9486(0xbf)));}}const _0x53568d=getExperimentalKnowledgeBasesDir(_0x17a02a);if(a123_0x1fc611[_0x1d9486(0x103)](_0x53568d)){const _0x1930c7=a123_0x1fc611[_0x1d9486(0xcc)](_0x53568d,{'withFileTypes':!![]});for(const _0x237ad4 of _0x1930c7){if(!_0x237ad4[_0x1d9486(0x127)]())continue;const _0x4839bc=a123_0x522ebe[_0x1d9486(0xf7)](_0x53568d,_0x237ad4[_0x1d9486(0x1b3)]),_0x467c05=a123_0x522ebe[_0x1d9486(0xf7)](_0x4839bc,_0x237ad4['name']+_0x1d9486(0x14e));if(a123_0x1fc611['existsSync'](_0x467c05)){const _0x17398f=parseExperimentalKnowledgeBaseYaml(a123_0x1fc611[_0x1d9486(0xc0)](_0x467c05,_0x1d9486(0xb8)),_0x467c05),_0x7e35ea=a123_0x522ebe[_0x1d9486(0xf7)](_0x4839bc,_0x1d9486(0x13b)),_0x43d521=[];if(a123_0x1fc611[_0x1d9486(0x103)](_0x7e35ea)){const _0x47c9ee=a123_0x1fc611[_0x1d9486(0xcc)](_0x7e35ea,{'withFileTypes':!![]});for(const _0x2a3906 of _0x47c9ee){if(!_0x2a3906[_0x1d9486(0x127)]())continue;const _0x3ccdd0=a123_0x522ebe[_0x1d9486(0xf7)](_0x7e35ea,_0x2a3906[_0x1d9486(0x1b3)]),_0x3afedf=a123_0x522ebe[_0x1d9486(0xf7)](_0x3ccdd0,_0x1d9486(0x120)),_0x5dd226=a123_0x522ebe[_0x1d9486(0xf7)](_0x3ccdd0,'json_schema.json');if(a123_0x1fc611[_0x1d9486(0x103)](_0x3afedf)&&a123_0x1fc611[_0x1d9486(0x103)](_0x5dd226)){const _0x216627=a123_0x1fc611[_0x1d9486(0xc0)](_0x3afedf,'utf-8'),_0x48d640=a123_0x1fc611[_0x1d9486(0xc0)](_0x5dd226,_0x1d9486(0xb8));_0x43d521[_0x1d9486(0x102)]({'name':_0x2a3906[_0x1d9486(0x1b3)],'code':_0x216627,'json_schema':_0x48d640});}}}const _0x377f47={..._0x17398f,'functions':_0x43d521};_0x2da978[_0x1d9486(0x102)]({'name':_0x17398f[_0x1d9486(0x1b3)],'path':_0x4839bc,'def':_0x377f47});}}}const _0x550d98=getExperimentalArtifactsDir(_0x17a02a);if(a123_0x1fc611[_0x1d9486(0x103)](_0x550d98)){const _0x34cb8f=a123_0x1fc611[_0x1d9486(0xcc)](_0x550d98,{'withFileTypes':!![]});for(const _0x27158a of _0x34cb8f){if(!_0x27158a[_0x1d9486(0x127)]())continue;const _0x161092=a123_0x522ebe[_0x1d9486(0xf7)](_0x550d98,_0x27158a['name']),_0x2c559c=a123_0x522ebe[_0x1d9486(0xf7)](_0x161092,_0x27158a[_0x1d9486(0x1b3)]+'.yml');if(a123_0x1fc611[_0x1d9486(0x103)](_0x2c559c)){const _0x167c1c=parseExperimentalArtifactYaml(a123_0x1fc611[_0x1d9486(0xc0)](_0x2c559c,_0x1d9486(0xb8)),_0x2c559c),_0x387fee=a123_0x522ebe[_0x1d9486(0xf7)](_0x161092,'code.js'),_0x58c105=a123_0x1fc611[_0x1d9486(0x103)](_0x387fee)?a123_0x1fc611[_0x1d9486(0xc0)](_0x387fee,'utf-8'):'',_0x131c49=a123_0x522ebe['join'](_0x161092,_0x1d9486(0xea)),_0x216880=[];if(a123_0x1fc611[_0x1d9486(0x103)](_0x131c49)){const _0x5edc8e=a123_0x1fc611[_0x1d9486(0xcc)](_0x131c49);for(const _0x5d8ad9 of _0x5edc8e){const _0x4feaa5=a123_0x522ebe[_0x1d9486(0xf7)](_0x131c49,_0x5d8ad9);if(a123_0x1fc611['statSync'](_0x4feaa5)[_0x1d9486(0x196)]()){const _0x22fc4c=a123_0x1fc611[_0x1d9486(0xc0)](_0x4feaa5,_0x1d9486(0xb8));_0x216880[_0x1d9486(0x102)]({'file_name':_0x5d8ad9,'text_content':_0x22fc4c});}}}const _0x37b520={..._0x167c1c,'code':_0x58c105,'files':_0x216880};_0xf83fb5[_0x1d9486(0x102)]({'name':_0x167c1c[_0x1d9486(0x1b3)],'path':_0x161092,'def':_0x37b520});}}}}else{const _0x3ce445=await this[_0x1d9486(0x1c0)](_0x17a02a),_0x50dfed=await this[_0x1d9486(0x1cd)][_0x1d9486(0x11a)](_0x3ce445);_0xf4c38a=_0x50dfed[_0x1d9486(0x11f)][_0x1d9486(0x1b3)];const _0x847ee8=await this[_0x1d9486(0x1cd)]['listAgentsFull'](_0x3ce445),_0x56ce2e=await this[_0x1d9486(0x1cd)][_0x1d9486(0xb7)](_0x3ce445),_0x2e05df=await this[_0x1d9486(0x1cd)][_0x1d9486(0x176)](_0x3ce445),_0x83428b=await this[_0x1d9486(0x1cd)][_0x1d9486(0x136)](_0x3ce445),_0xb9d379=await this[_0x1d9486(0x1cd)][_0x1d9486(0x10f)](_0x3ce445),_0x113d89=await safeListOrEmpty(()=>this['client'][_0x1d9486(0x19d)](_0x3ce445)),_0x3af6e4=await safeListOrEmpty(()=>this[_0x1d9486(0x1cd)][_0x1d9486(0x131)](_0x3ce445)),_0x374a6c=new Map(),_0x471c70=new Map(),_0x2c7360=new Map(),_0x4649ae=new Map(),_0x1e5f5b=new Map(),_0x41b8a5=new Map();for(const _0x74e4d1 of _0x56ce2e){_0x374a6c[_0x1d9486(0x100)](_0x74e4d1['id'],_0x74e4d1[_0x1d9486(0x11f)]['name']);}for(const _0xb3a3e of _0x2e05df){_0x471c70['set'](_0xb3a3e['id'],_0xb3a3e[_0x1d9486(0x11f)][_0x1d9486(0x1b3)]);}for(const _0x214922 of _0x847ee8){_0x2c7360[_0x1d9486(0x100)](_0x214922['id'],_0x214922[_0x1d9486(0x11f)][_0x1d9486(0x1b3)]);}for(const _0x4f5d2c of _0x83428b){_0x4649ae[_0x1d9486(0x100)](_0x4f5d2c['id'],_0x4f5d2c[_0x1d9486(0x11f)][_0x1d9486(0x1b3)]);}for(const _0x164ecb of _0x113d89){_0x1e5f5b[_0x1d9486(0x100)](_0x164ecb['id'],_0x164ecb[_0x1d9486(0x11f)][_0x1d9486(0x1b3)]);}for(const _0x440142 of _0x3af6e4){_0x41b8a5[_0x1d9486(0x100)](_0x440142['id'],_0x440142[_0x1d9486(0x11f)][_0x1d9486(0x1b3)]);}const _0x3eb6aa={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x374a6c,'TextKnowledgeBase':_0x471c70,'Agent':_0x2c7360,'ExperimentalKnowledgeBase':_0x1e5f5b}),'resolvePromptName':async _0x1c31fe=>_0x4649ae[_0x1d9486(0xf5)](_0x1c31fe),'onWarning':_0x299d48=>this[_0x1d9486(0x187)][_0x1d9486(0xeb)](_0x299d48)};for(const _0x431708 of _0x847ee8){const _0x4a6691=await agentResponseToDef(_0x431708,_0x3eb6aa),{yaml:_0x1bfabe,systemPrompt:_0x1adcbc,starterMessage:_0x21e048}=_0x4a6691;_0x5d0a3e[_0x1d9486(0x102)]({'name':_0x1bfabe['name'],'dir':'','yaml':_0x1bfabe,'systemPrompt':_0x1adcbc,'starterMessage':_0x21e048});}for(const _0x4f418d of _0x56ce2e){const _0x396c77=apiKnowledgeBaseToYaml(_0x4f418d);_0x453446['push']({'name':_0x396c77['name'],'path':'','yaml':_0x396c77});}for(const _0x11702a of _0x2e05df){_0x3bcac6[_0x1d9486(0x102)]({'name':_0x11702a['attributes'][_0x1d9486(0x1b3)],'path':'','text':_0x11702a[_0x1d9486(0x11f)][_0x1d9486(0xd3)]});}for(const _0xa7f0d of _0x83428b){const _0x2b0bb2=await apiPromptToYaml(_0xa7f0d,_0x3eb6aa);_0x2b0bb2&&_0x122f6f['push']({'name':_0x2b0bb2['name'],'path':'','yaml':_0x2b0bb2});}for(const _0x342ef3 of _0xb9d379){if(!_0x342ef3['attributes'][_0x1d9486(0x1ab)]&&SAFE_INTEGRATION_TYPES[_0x1d9486(0xcb)](_0x342ef3[_0x1d9486(0x11f)][_0x1d9486(0x11e)][_0x1d9486(0x156)]())){const _0x1cabff=await apiIntegrationToYaml(_0x342ef3,_0x3eb6aa);_0x42baca[_0x1d9486(0x102)]({'name':_0x342ef3[_0x1d9486(0x11f)][_0x1d9486(0x11e)][_0x1d9486(0x156)](),'path':'','yaml':_0x1cabff});}}for(const _0x5e232e of _0x113d89){const _0x1f242f=apiExperimentalKnowledgeBaseToYaml(_0x5e232e);_0x2da978[_0x1d9486(0x102)]({'name':_0x1f242f[_0x1d9486(0x1b3)],'path':'','def':_0x1f242f});}for(const _0x24be52 of _0x3af6e4){const _0x11ef73=apiExperimentalArtifactToYaml(_0x24be52);_0xf83fb5[_0x1d9486(0x102)]({'name':_0x11ef73[_0x1d9486(0x1b3)],'path':'','def':_0x11ef73});}}const _0x4bfb66={'sourceProjectName':_0xf4c38a,'newProjectName':_0x34c928,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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},'integrations':{'created':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0xd0d625=await this['client'][_0x1d9486(0x13e)](),_0x51e20e=_0xd0d625[_0x1d9486(0x142)](_0x2fc502=>_0x2fc502['attributes'][_0x1d9486(0x1b3)]===_0x34c928);if(_0x51e20e)throw new SDKError(ErrorCode[_0x1d9486(0xf1)],_0x1d9486(0x18e)+_0x34c928+_0x1d9486(0x143),undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x43cc8d?.[_0x1d9486(0x1c8)])return _0x4bfb66[_0x1d9486(0x1b5)][_0x1d9486(0xd6)][_0x1d9486(0xdb)]=_0x5d0a3e['length'],_0x4bfb66[_0x1d9486(0x1b5)]['knowledgeBases'][_0x1d9486(0xdb)]=_0x453446[_0x1d9486(0xf2)],_0x4bfb66[_0x1d9486(0x1b5)][_0x1d9486(0x111)][_0x1d9486(0xdb)]=_0x3bcac6[_0x1d9486(0xf2)],_0x4bfb66[_0x1d9486(0x1b5)]['experimentalKnowledgeBases']['created']=_0x2da978['length'],_0x4bfb66[_0x1d9486(0x1b5)][_0x1d9486(0x1a3)][_0x1d9486(0xdb)]=_0xf83fb5[_0x1d9486(0xf2)],_0x4bfb66['counts'][_0x1d9486(0x16c)][_0x1d9486(0xdb)]=_0x122f6f[_0x1d9486(0xf2)],_0x4bfb66[_0x1d9486(0x1b5)][_0x1d9486(0xc8)][_0x1d9486(0xdb)]=_0x42baca[_0x1d9486(0xf2)],_0x4bfb66;const _0x4ca775=await this['client'][_0x1d9486(0x121)]({'name':_0x34c928}),_0x1920b4=_0x4ca775['id'];_0x4bfb66[_0x1d9486(0xef)]=_0x1920b4;const _0x213990=new Map(),_0x82f70c=new Map(),_0x1c937c=new Map(),_0x443e8d=new Map(),_0x1ec9db=new Map(),_0x31b986=new Map(),_0x408321=new Map(),_0x84bf93=new Map(),_0x28c0cd=new Set(),_0x499a72=new Set();for(const _0x34b9c7 of _0x5d0a3e){for(const _0x1bef08 of _0x34b9c7[_0x1d9486(0xfa)][_0x1d9486(0x1a7)]||[]){if(_0x1bef08[_0x1d9486(0x1a5)]===_0x1d9486(0x126)&&_0x1bef08['target']){const _0x254222=parseRef(_0x1bef08[_0x1d9486(0x154)]);if(_0x254222)_0x28c0cd[_0x1d9486(0x134)](_0x254222[_0x1d9486(0x1b3)]);}else{if(_0x1bef08['type']==='web_search'&&_0x1bef08[_0x1d9486(0x154)]){const _0xc42346=parseRef(_0x1bef08[_0x1d9486(0x154)]);if(_0xc42346)_0x499a72[_0x1d9486(0x134)](_0xc42346[_0x1d9486(0x1b3)]);}}}}for(const _0xce8abb of _0x28c0cd){try{const _0x5e32f6=await this[_0x1d9486(0x1cd)][_0x1d9486(0x1b7)]({'projectId':_0x1920b4,'name':_0xce8abb});_0x1ec9db[_0x1d9486(0x100)](_0xce8abb,_0x5e32f6['id']),_0x4bfb66[_0x1d9486(0x12c)][_0x1d9486(0x102)]({'name':_0xce8abb,'action':_0x1d9486(0xdb),'id':_0x5e32f6['id']}),_0x4bfb66['counts'][_0x1d9486(0x12c)][_0x1d9486(0xdb)]++;}catch(_0x10a4bc){_0x4bfb66[_0x1d9486(0x12c)][_0x1d9486(0x102)]({'name':_0xce8abb,'action':_0x1d9486(0xe4),'error':_0x10a4bc[_0x1d9486(0x12b)]}),_0x4bfb66['counts'][_0x1d9486(0x12c)][_0x1d9486(0x115)]++;}}for(const _0x279b49 of _0x499a72){try{const _0x436b44=await this[_0x1d9486(0x1cd)][_0x1d9486(0x159)]({'projectId':_0x1920b4,'name':_0x279b49});_0x31b986[_0x1d9486(0x100)](_0x279b49,_0x436b44['id']),_0x4bfb66[_0x1d9486(0x1b9)][_0x1d9486(0x102)]({'name':_0x279b49,'action':_0x1d9486(0xdb),'id':_0x436b44['id']}),_0x4bfb66['counts'][_0x1d9486(0x1b9)][_0x1d9486(0xdb)]++;}catch(_0x31c1a3){_0x4bfb66[_0x1d9486(0x1b9)][_0x1d9486(0x102)]({'name':_0x279b49,'action':'error','error':_0x31c1a3[_0x1d9486(0x12b)]}),_0x4bfb66[_0x1d9486(0x1b5)][_0x1d9486(0x1b9)]['errors']++;}}const _0x591e8f=await fetchAllToolTargetMaps((_0x668be7,_0x31b5eb)=>this[_0x1d9486(0x1cd)][_0x1d9486(0x1c9)](_0x668be7,_0x31b5eb),_0x1920b4);let _0x557ba5=[];const _0x2334ae={'projectId':_0x1920b4,'resolveToolTargetId':buildIdResolver({..._0x591e8f[_0x1d9486(0x17f)],'KnowledgeBase':_0x213990,'TextKnowledgeBase':_0x82f70c,'ExperimentalKnowledgeBase':_0x408321,'Agent':_0x1c937c,'WebSearchTool':_0x31b986,'ImageGenerator':_0x1ec9db}),'resolvePromptId':async _0x311f6f=>_0x443e8d['get'](_0x311f6f),'onWarning':_0x49742d=>{const _0x8fdb20=_0x1d9486;this[_0x8fdb20(0x187)][_0x8fdb20(0xeb)](_0x49742d),_0x557ba5[_0x8fdb20(0x102)](_0x49742d);}};for(const _0x305fe0 of _0x453446){try{const _0x3ef990=yamlKnowledgeBaseToApi(_0x305fe0[_0x1d9486(0xfa)],_0x1920b4),_0xa8885a=await this['client'][_0x1d9486(0x17c)](_0x3ef990);_0x213990['set'](_0x305fe0[_0x1d9486(0xfa)][_0x1d9486(0x1b3)],_0xa8885a['id']),_0x4bfb66[_0x1d9486(0x185)][_0x1d9486(0x102)]({'name':_0x305fe0['yaml']['name'],'action':_0x1d9486(0xdb),'id':_0xa8885a['id']}),_0x4bfb66['counts']['knowledgeBases'][_0x1d9486(0xdb)]++;}catch(_0x23c113){_0x4bfb66['knowledgeBases'][_0x1d9486(0x102)]({'name':_0x305fe0['yaml']['name'],'action':_0x1d9486(0xe4),'error':_0x23c113[_0x1d9486(0x12b)]}),_0x4bfb66['counts']['knowledgeBases']['errors']++;}}for(const _0xf9e0b0 of _0x3bcac6){try{const _0x2d4b04=yamlTextKnowledgeBaseToApi({'name':_0xf9e0b0[_0x1d9486(0x1b3)],'text':_0xf9e0b0[_0x1d9486(0xd3)]},_0x1920b4),_0x4ffad6=await this['client'][_0x1d9486(0xe6)](_0x2d4b04);_0x82f70c[_0x1d9486(0x100)](_0xf9e0b0[_0x1d9486(0x1b3)],_0x4ffad6['id']),_0x4bfb66['textKnowledgeBases'][_0x1d9486(0x102)]({'name':_0xf9e0b0[_0x1d9486(0x1b3)],'action':_0x1d9486(0xdb),'id':_0x4ffad6['id']}),_0x4bfb66['counts'][_0x1d9486(0x111)][_0x1d9486(0xdb)]++;}catch(_0x4d2d32){_0x4bfb66[_0x1d9486(0x111)][_0x1d9486(0x102)]({'name':_0xf9e0b0[_0x1d9486(0x1b3)],'action':_0x1d9486(0xe4),'error':_0x4d2d32['message']}),_0x4bfb66['counts'][_0x1d9486(0x111)][_0x1d9486(0x115)]++;}}for(const _0x2eb782 of _0xf83fb5){try{const _0x5d8f9a=yamlExperimentalArtifactToApi(_0x2eb782['def'],_0x1920b4),_0x13b3d4=await this[_0x1d9486(0x1cd)][_0x1d9486(0x19e)](_0x5d8f9a);_0x84bf93[_0x1d9486(0x100)](_0x2eb782[_0x1d9486(0xf6)][_0x1d9486(0x1b3)],_0x13b3d4['id']),_0x4bfb66[_0x1d9486(0x1a3)]['push']({'name':_0x2eb782[_0x1d9486(0xf6)][_0x1d9486(0x1b3)],'action':_0x1d9486(0xdb),'id':_0x13b3d4['id']}),_0x4bfb66[_0x1d9486(0x1b5)]['experimentalArtifacts'][_0x1d9486(0xdb)]++;}catch(_0x24f118){_0x4bfb66['experimentalArtifacts'][_0x1d9486(0x102)]({'name':_0x2eb782[_0x1d9486(0xf6)][_0x1d9486(0x1b3)],'action':_0x1d9486(0xe4),'error':_0x24f118['message']}),_0x4bfb66['counts'][_0x1d9486(0x1a3)]['errors']++;}}for(const _0x93d477 of _0x2da978){try{const _0x2b9a99=yamlExperimentalKnowledgeBaseToApi(_0x93d477[_0x1d9486(0xf6)],_0x1920b4),_0x13454a=await this['client'][_0x1d9486(0xf3)](_0x2b9a99);_0x408321['set'](_0x93d477[_0x1d9486(0xf6)][_0x1d9486(0x1b3)],_0x13454a['id']),_0x4bfb66['experimentalKnowledgeBases'][_0x1d9486(0x102)]({'name':_0x93d477[_0x1d9486(0xf6)][_0x1d9486(0x1b3)],'action':'created','id':_0x13454a['id']}),_0x4bfb66['counts'][_0x1d9486(0x183)][_0x1d9486(0xdb)]++;}catch(_0x29f2a0){_0x4bfb66[_0x1d9486(0x183)][_0x1d9486(0x102)]({'name':_0x93d477['def'][_0x1d9486(0x1b3)],'action':'error','error':_0x29f2a0[_0x1d9486(0x12b)]}),_0x4bfb66[_0x1d9486(0x1b5)][_0x1d9486(0x183)]['errors']++;}}const _0x4042a7=[..._0x5d0a3e][_0x1d9486(0x12d)]((_0xaf3af7,_0x18f309)=>{const _0xaecaf6=_0x1d9486,_0x86c6af=_0xaf3af7['yaml']['tools']?.['some'](_0xf22625=>_0xf22625[_0xaecaf6(0x1a5)]===_0xaecaf6(0xb6))??![],_0x1d4d00=_0x18f309[_0xaecaf6(0xfa)][_0xaecaf6(0x1a7)]?.['some'](_0x132125=>_0x132125[_0xaecaf6(0x1a5)]===_0xaecaf6(0xb6))??![];if(_0x86c6af&&!_0x1d4d00)return 0x1;if(!_0x86c6af&&_0x1d4d00)return-0x1;return 0x0;});for(const _0x440ee6 of _0x4042a7){_0x557ba5=[];try{const _0x3e52e4=_0x440ee6[_0x1d9486(0xfa)][_0x1d9486(0x1a7)]?.[_0x1d9486(0x190)](_0x31da67=>{const _0x8bcbb2=_0x1d9486;if(_0x31da67['type']===_0x8bcbb2(0xb6)&&_0x31da67['target']){const _0x22964d=parseRef(_0x31da67[_0x8bcbb2(0x154)]);return _0x22964d?.['name']===_0x440ee6[_0x8bcbb2(0xfa)][_0x8bcbb2(0x1b3)];}return![];})??[];if(_0x3e52e4[_0x1d9486(0xf2)]>0x0){const _0x194e7a=_0x1d9486(0x1c5)+_0x440ee6[_0x1d9486(0xfa)][_0x1d9486(0x1b3)]+_0x1d9486(0x171)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this['logger']['warn'](_0x194e7a),_0x557ba5['push'](_0x194e7a);}const _0x1eb537=await agentDefToRequest(_0x440ee6[_0x1d9486(0xfa)],_0x440ee6[_0x1d9486(0xce)],_0x440ee6[_0x1d9486(0x1c1)],_0x2334ae),_0x34e347=await this['client'][_0x1d9486(0xcd)](_0x1eb537);_0x1c937c['set'](_0x440ee6[_0x1d9486(0xfa)][_0x1d9486(0x1b3)],_0x34e347['id']),_0x4bfb66['agents']['push']({'agentName':_0x440ee6[_0x1d9486(0xfa)][_0x1d9486(0x1b3)],'action':_0x1d9486(0xdb),'agentId':_0x34e347['id'],'warnings':_0x557ba5[_0x1d9486(0xf2)]>0x0?_0x557ba5:undefined}),_0x4bfb66[_0x1d9486(0x1b5)]['agents']['created']++;}catch(_0x1a257a){_0x4bfb66[_0x1d9486(0xd6)][_0x1d9486(0x102)]({'agentName':_0x440ee6['yaml'][_0x1d9486(0x1b3)],'action':'error','error':_0x1a257a[_0x1d9486(0x12b)],'warnings':_0x557ba5['length']>0x0?_0x557ba5:undefined}),_0x4bfb66[_0x1d9486(0x1b5)][_0x1d9486(0xd6)][_0x1d9486(0x115)]++;}}for(const _0x531387 of _0x122f6f){try{const _0x65d0f2=await yamlPromptToApi(_0x531387['yaml'],_0x1920b4,_0x2334ae);if(!_0x65d0f2){_0x4bfb66[_0x1d9486(0x16c)][_0x1d9486(0x102)]({'name':_0x531387[_0x1d9486(0xfa)][_0x1d9486(0x1b3)],'action':_0x1d9486(0xe4),'error':_0x1d9486(0x17b)}),_0x4bfb66[_0x1d9486(0x1b5)][_0x1d9486(0x16c)][_0x1d9486(0x115)]++;continue;}const _0xafca7a=await this['client'][_0x1d9486(0xd0)](_0x65d0f2);_0x443e8d[_0x1d9486(0x100)](_0x531387[_0x1d9486(0xfa)]['name'],_0xafca7a['id']),_0x4bfb66['prompts'][_0x1d9486(0x102)]({'name':_0x531387[_0x1d9486(0xfa)][_0x1d9486(0x1b3)],'action':_0x1d9486(0xdb),'id':_0xafca7a['id']}),_0x4bfb66[_0x1d9486(0x1b5)][_0x1d9486(0x16c)][_0x1d9486(0xdb)]++;}catch(_0x28e59c){_0x4bfb66[_0x1d9486(0x16c)][_0x1d9486(0x102)]({'name':_0x531387[_0x1d9486(0xfa)][_0x1d9486(0x1b3)],'action':'error','error':_0x28e59c[_0x1d9486(0x12b)]}),_0x4bfb66[_0x1d9486(0x1b5)][_0x1d9486(0x16c)][_0x1d9486(0x115)]++;}}for(const _0x4a2d90 of _0x42baca){try{const _0x50bc4e=await yamlIntegrationToApi(_0x4a2d90[_0x1d9486(0xfa)],_0x1920b4,_0x2334ae),_0x2dd81c=await this[_0x1d9486(0x1cd)][_0x1d9486(0x17e)](_0x50bc4e);_0x4bfb66[_0x1d9486(0xc8)][_0x1d9486(0x102)]({'name':_0x4a2d90['yaml']['service_type'],'action':_0x1d9486(0xdb),'id':_0x2dd81c['id']}),_0x4bfb66[_0x1d9486(0x1b5)][_0x1d9486(0xc8)][_0x1d9486(0xdb)]++;}catch(_0x4c09f3){_0x4bfb66[_0x1d9486(0xc8)][_0x1d9486(0x102)]({'name':_0x4a2d90[_0x1d9486(0xfa)]['service_type'],'action':_0x1d9486(0xe4),'error':_0x4c09f3[_0x1d9486(0x12b)]}),_0x4bfb66[_0x1d9486(0x1b5)]['integrations'][_0x1d9486(0x115)]++;}}return _0x4bfb66;}}
1
+ function a123_0x3d9e(){const _0x70fb5a=['chatIgnoreManagedActions','content','LLM_PROJECT_NOT_FOUND','prompts.json','webSearchTools','UNAUTHENTICATED','getAgent','version','Available\x20agents:\x20','Renamed\x20KB\x20file:\x20','toLowerCase','Agent\x20\x27','2525456FwxKYq','Renamed\x20text\x20KB\x20file:\x20','signal','text_content','KnowledgeBase','listExperimentalArtifacts','site','profile','getProject','agentsFull','Project\x20not\x20found:\x20','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','set','Agent\x20reference\x20not\x20found','files','readdirSync','createAgentResponse','getOrCreateDefaultAgent','createKnowledgeBase','json_schema','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','webhookCorsOrigins','event','knowledgebases.json','metadata','integrations.json','Renamed\x20agent\x20folder:\x20','dryRun','experimentalKnowledgeBases','cloneProject','sort','#\x20prompt.md\x0a','duplicate','history','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','14iArqbE','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','No\x20tdx.json\x20found\x20in\x20','updateExperimentalArtifact','type','endsWith','isDir','claude-4.5-sonnet','already\x20exists','Backup\x20folder\x20not\x20found:\x20','length','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','models','unchanged','createTextKnowledgeBase','Invalid\x20agent\x20reference\x20format:\x20','deleteIntegration','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','new','yaml','low','knowledge_bases','Renamed\x20prompt\x20file:\x20','description','promptId','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','getOrCreateDefaultProject','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','.yml','1131830qgczPd','starter_message.md','some','integrations','\x0a---\x20schema:\x20','\x20attempts\x20due\x20to\x20name\x20conflicts.','file_name','Removed\x20deleted\x20file:\x20','web_search','createIntegration','Renamed\x20folder:\x20','---\x20schema:\x20','service_type','Unresolved\x20dependencies:\x20','chats','chat_generic','createImageGenerator','nameToId','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','Only\x20safe\x20types\x20(','conflict','llm_project','updatePrompt','loadJsonFile','variables','5080528cUfvMg','tables','experimentalArtifacts','979099RLkbFy','listExperimentalKnowledgeBases','Unsupported\x20backup\x20version:\x20','tdx.json','getChatHistory','NOT_FOUND','---\x20file:\x20','project.json','jsonSchemaHint','listIntegrations','chat_parent_segment','code.js','localeCompare','cwd','393DciHcX','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','stringify','156jnwiqL','11436pFklui','agent','):\x20','Agent\x20not\x20found:\x20','\x0a---\x20function:\x20','context','name','displayName','prompt.md','listImageGenerators','statSync','json_schema.json','startChat','actions','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','mkdirSync','resolveAgentId','listToolTargets','restoreProject','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','15479610qIjrHV','has','readFileSync','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','path','action','agentId','\x0a\x0a#\x20agent.yml\x0a','ALREADY_EXISTS','\x27.\x20This\x20should\x20not\x20happen.','map','\x27\x20(','createPrompt','resolveProjectId','\x20→\x20','projects','size','text','tdx_default_','clearDefaultAgent','attributes','prompts','join','.md','logger','imageGenerators','45urDzWS','agents.json','pullProject','chatId','\x20---\x0a','dir','Renamed\x20experimental\x20KB\x20directory:\x20','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','push','TextKnowledgeBase','listPrompts','dirname','existsSync','split','modelType','rmSync','Project\x20\x22','getUserSettings','project','.llm','PERMISSION_DENIED','target','\x20in\x20project\x20','minimal','isFile','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','filter','renamed','info','pullAgent','getBackupMetadata','Output\x20directory\x20already\x20exists:\x20','agent.yml','continueChat','experimental_artifacts','add','basename','getChatLog','pushProject','isManaged','chatWelcomeMessage','updated','toISOString','\x22\x20already\x20exists','updateAgent','created','AGENT_NOT_FOUND','updateExperimentalKnowledgeBase',')\x20can\x20be\x20cloned.','systemPrompt','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','pushAgent','listKnowledgeBases','projectName','Unable\x20to\x20create\x20project\x20after\x20','knowledgeBases','setCurrentProject','agents','warn','exportedFrom','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','backupProject','projectId','image_gen','isDirectory','status','createExperimentalKnowledgeBase','dry-run-','deleteAgent','INVALID_ARGUMENT','client','listAgents','none','availableModels','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','listProjects','starterMessage','resolveProjectName','5xgUlDW','INTERNAL','getChatInfo','deleteProject','errors','listTextKnowledgeBases','code','error','find','template','getCurrentProject','message','def','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','functions','Removed\x20deleted\x20directory:\x20','total','includes','createExperimentalArtifact','availableModelNames','1.0','utf-8','updateTextKnowledgeBase','counts','createAgent','listWebSearchTools','writeFileSync','parse','oldPath','medium','createProject','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.','sdk.llm','\x0a---\x20code\x20---\x0a','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','textKnowledgeBases','listAgentsFull','get','maxToolIterations','experimental_knowledge_bases','starter_message','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','idToName','Skipping\x20integration\x20\x27','getDefaultProjectName','Renamed\x20integration\x20file:\x20','tools','currentProjectId','serviceType','5070vOzARX','agent.yml\x20not\x20found\x20in\x20','chatInfo'];a123_0x3d9e=function(){return _0x70fb5a;};return a123_0x3d9e();}const a123_0x44cb81=a123_0x1092;(function(_0x305287,_0x1f3519){const _0x390354=a123_0x1092,_0x5d62bc=_0x305287();while(!![]){try{const _0x20b2b0=-parseInt(_0x390354(0xa5))/0x1+-parseInt(_0x390354(0x180))/0x2*(parseInt(_0x390354(0xcf))/0x3)+-parseInt(_0x390354(0xbe))/0x4*(-parseInt(_0x390354(0x14f))/0x5)+parseInt(_0x390354(0xd3))/0x6*(-parseInt(_0x390354(0x1b2))/0x7)+parseInt(_0x390354(0x18f))/0x8*(parseInt(_0x390354(0x101))/0x9)+-parseInt(_0x390354(0xe7))/0xa+parseInt(_0x390354(0xc1))/0xb*(parseInt(_0x390354(0xd2))/0xc);if(_0x20b2b0===_0x1f3519)break;else _0x5d62bc['push'](_0x5d62bc['shift']());}catch(_0x215abf){_0x5d62bc['push'](_0x5d62bc['shift']());}}}(a123_0x3d9e,0xf1b13));import{LLMApiClient}from'../client/llm-api-client.js';import*as a123_0xbdc0df from'node:fs';import*as a123_0xe6e455 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,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';function a123_0x1092(_0x22a56d,_0x1f7f7e){_0x22a56d=_0x22a56d-0xa5;const _0x3d9eaa=a123_0x3d9e();let _0x1092e0=_0x3d9eaa[_0x22a56d];return _0x1092e0;}import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a123_0x44cb81(0xb4),'chat_agent_console',a123_0x44cb81(0xcb)];async function safeListOrEmpty(_0x8c6f4d){const _0xe624ed=a123_0x44cb81;try{return await _0x8c6f4d();}catch(_0x1ef8c4){if(_0x1ef8c4 instanceof HTTPClientError&&_0x1ef8c4[_0xe624ed(0x142)]===0x194)return[];throw _0x1ef8c4;}}export class LLMSDK{[a123_0x44cb81(0x17e)];[a123_0x44cb81(0x147)];['context'];['logger']=Logger['of'](a123_0x44cb81(0x16f));constructor(_0xc54731){const _0x3b9ba2=a123_0x44cb81;this[_0x3b9ba2(0x147)]=new LLMApiClient(_0xc54731),this['context']=_0xc54731;}[a123_0x44cb81(0x17b)](){const _0x5b2215=a123_0x44cb81,_0x35d6d8=getSanitizedUsername();return _0x5b2215(0xf9)+_0x35d6d8;}async[a123_0x44cb81(0x139)](_0x5d973a){const _0x37840e=a123_0x44cb81,{projectId:_0x36f6cf}=await this[_0x37840e(0x14e)](_0x5d973a);this['currentProjectId']=_0x36f6cf;}[a123_0x44cb81(0x159)](){const _0x7885ad=a123_0x44cb81;return this[_0x7885ad(0x17e)];}async['setDefaultAgent'](_0x1f1192){const _0x52a6b4=a123_0x44cb81,_0x1f9ff6=this[_0x52a6b4(0xd8)][_0x52a6b4(0x196)];let _0x4fd981,_0x27dde1;if(_0x1f1192[_0x52a6b4(0x160)]('/')){const _0x216d8c=_0x1f1192[_0x52a6b4(0x10e)]('/');if(_0x216d8c['length']!==0x2)throw new SDKError(ErrorCode[_0x52a6b4(0x146)],_0x52a6b4(0x1c1)+_0x1f1192,undefined,{'helpText':'Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22'});const [_0xefe5b9,_0x337f37]=_0x216d8c;_0x4fd981=await this[_0x52a6b4(0xf4)](_0xefe5b9),_0x27dde1=_0x337f37;}else _0x4fd981=this[_0x52a6b4(0x17e)]||(await this['getOrCreateDefaultProject']())['id'],_0x27dde1=_0x1f1192;const _0x366144=await this[_0x52a6b4(0xe3)](_0x27dde1,_0x4fd981),_0x54c03b=await this[_0x52a6b4(0x147)][_0x52a6b4(0x189)](_0x366144);writeCachedLLMAgent(_0x54c03b['attributes'][_0x52a6b4(0xd9)],_0x366144,_0x4fd981,_0x1f9ff6);}['getDefaultAgent'](){const _0x54ddf7=a123_0x44cb81,_0x54abcd=this[_0x54ddf7(0xd8)][_0x54ddf7(0x196)];return readCachedLLMAgent(_0x54abcd)||undefined;}[a123_0x44cb81(0xfa)](){const _0x3c6a26=a123_0x44cb81,_0x353cbb=this[_0x3c6a26(0xd8)][_0x3c6a26(0x196)];clearCachedLLMAgent(_0x353cbb);}async[a123_0x44cb81(0x1be)](){const _0x9326a0=a123_0x44cb81,_0x40008f=await this[_0x9326a0(0x147)][_0x9326a0(0x112)](),_0x23518b=[];for(const _0x5d5b60 of _0x40008f[_0x9326a0(0x162)]){const _0x1542e6=_0x40008f[_0x9326a0(0x14a)][_0x5d5b60];_0x1542e6&&_0x23518b['push']({'name':_0x5d5b60,'displayName':_0x1542e6[_0x9326a0(0xda)]});}return _0x23518b;}async['createProject'](_0x1650f3){const _0x296146=a123_0x44cb81;return await this[_0x296146(0x147)][_0x296146(0x16d)](_0x1650f3);}async[a123_0x44cb81(0x152)](_0x58a706){const _0x41b877=a123_0x44cb81,{projectId:_0x31dad2}=await this[_0x41b877(0x14e)](_0x58a706);await this[_0x41b877(0x147)][_0x41b877(0x152)](_0x31dad2);}async[a123_0x44cb81(0xf6)](_0xcd26ac=0x32){const _0x10f944=a123_0x44cb81;return await this[_0x10f944(0x147)]['listProjects'](_0xcd26ac);}async[a123_0x44cb81(0x1cc)](_0x3c3356){const _0x12cf54=a123_0x44cb81,_0x5b4f08=_0x3c3356||this[_0x12cf54(0x17b)](),_0x42656b=this[_0x12cf54(0xd8)][_0x12cf54(0x196)];if(!_0x3c3356){const _0x1412b4=readCachedLLMProject(_0x42656b);if(_0x1412b4&&_0x1412b4[_0x12cf54(0xd9)]===_0x5b4f08)try{const _0x463fdf=await this['client']['getProject'](_0x1412b4['id']);if(_0x463fdf[_0x12cf54(0xfb)][_0x12cf54(0xd9)]===_0x5b4f08)return _0x463fdf;}catch{}}const _0x14abb9=await this[_0x12cf54(0x147)]['listProjects'](),_0x2299e5=_0x14abb9[_0x12cf54(0x157)](_0xbcad0e=>_0xbcad0e[_0x12cf54(0xfb)][_0x12cf54(0xd9)]===_0x5b4f08);if(_0x2299e5)return!_0x3c3356&&writeCachedLLMProject(_0x5b4f08,_0x2299e5['id'],_0x42656b),_0x2299e5;const _0x180a4e=await this[_0x12cf54(0x147)][_0x12cf54(0x16d)]({'name':_0x5b4f08,'description':_0x12cf54(0xea)+getSanitizedUsername()+')'});return!_0x3c3356&&writeCachedLLMProject(_0x5b4f08,_0x180a4e['id'],_0x42656b),_0x180a4e;}async[a123_0x44cb81(0xf4)](_0x5ee041){const _0x2f032e=a123_0x44cb81,_0x51fb05=await this[_0x2f032e(0x147)][_0x2f032e(0x14c)](),_0x24cab1=_0x51fb05['filter'](_0x5055d6=>_0x5055d6[_0x2f032e(0xfb)][_0x2f032e(0xd9)]===_0x5ee041);if(_0x24cab1['length']===0x0)throw new SDKError(ErrorCode[_0x2f032e(0x185)],_0x2f032e(0x199)+_0x5ee041,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x24cab1[_0x2f032e(0x1bc)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],'Multiple\x20projects\x20found\x20with\x20name\x20\x27'+_0x5ee041+'\x27.\x20This\x20should\x20not\x20happen.');return _0x24cab1[0x0]['id'];}async['resolveProjectName'](_0x3c7230){const _0x1f0dd=a123_0x44cb81,_0x3e52a9=await this[_0x1f0dd(0x147)][_0x1f0dd(0x14c)](),_0xb31b78=_0x3e52a9[_0x1f0dd(0x157)](_0x492aed=>_0x492aed[_0x1f0dd(0xfb)][_0x1f0dd(0xd9)]===_0x3c7230);if(_0xb31b78)return{'projectId':_0xb31b78['id'],'project':_0xb31b78};throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0x3c7230,undefined,{'helpText':_0x1f0dd(0x14b)});}async[a123_0x44cb81(0x1a0)](_0x57a84c=a123_0x44cb81(0x1b9),_0x24799e=0x0,_0x2c8c68){const _0x273583=a123_0x44cb81,_0x523c53=0xa;let _0x57c0ea=0x0,_0x5340f0;while(_0x57c0ea<_0x523c53){try{const _0x390587=await this[_0x273583(0x1cc)](_0x5340f0),_0x3b53c6=_0x390587['id'],_0x24c511=[_0x273583(0x149),_0x273583(0x118),_0x273583(0x1c6),_0x273583(0x16c),'high'],_0x1b0e60=_0x24799e===0x0?'tdx_'+_0x57a84c:'tdx_'+_0x57a84c+'_reasoning_'+_0x24c511[_0x24799e],_0x1e0ffe=await this[_0x273583(0x147)][_0x273583(0x148)](_0x3b53c6),_0x4c4241=_0x1e0ffe[_0x273583(0x157)](_0x158dcf=>_0x158dcf['attributes'][_0x273583(0xd9)]===_0x1b0e60);if(_0x4c4241)return _0x4c4241;const _0x3db51b=_0x24799e>0x0?0x1:_0x2c8c68;return await this['client'][_0x273583(0x167)]({'name':_0x1b0e60,'projectId':_0x3b53c6,'modelType':_0x57a84c,'systemPrompt':'','temperature':_0x3db51b,'reasoningEffort':_0x24799e>0x0?_0x24799e:undefined});}catch(_0x210a90){if(_0x210a90 instanceof HTTPClientError){const _0x5811aa=_0x210a90[_0x273583(0x142)];if(_0x5811aa>=0x190&&_0x5811aa<0x1f4){if(_0x5811aa===0x191)throw new SDKError(ErrorCode[_0x273583(0x188)],_0x273583(0x1cd),_0x210a90);else{if(_0x5811aa===0x193)throw new SDKError(ErrorCode[_0x273583(0x115)],_0x273583(0xb7),_0x210a90);}throw _0x210a90;}}if(errorContains(_0x210a90,_0x273583(0x1ba),_0x273583(0x1af),_0x273583(0xb9))){_0x57c0ea++;if(_0x57c0ea>=_0x523c53)throw new SDKError(ErrorCode[_0x273583(0xef)],_0x273583(0x137)+_0x523c53+_0x273583(0xaa),_0x210a90);const _0x5e313d=this[_0x273583(0x17b)]();_0x5340f0=_0x5e313d+'_'+generateRandomHex();continue;}throw _0x210a90;}}throw new SDKError(ErrorCode['INTERNAL'],_0x273583(0x11a));}async[a123_0x44cb81(0xe3)](_0x412c25,_0x5d5a12){const _0x1d26f5=a123_0x44cb81,_0x11eb50=_0x5d5a12||this['currentProjectId'],_0x526d6b=await this[_0x1d26f5(0x147)][_0x1d26f5(0x148)](_0x11eb50),_0x523932=_0x526d6b[_0x1d26f5(0x11b)](_0x38e495=>_0x38e495[_0x1d26f5(0xfb)][_0x1d26f5(0xd9)]===_0x412c25);if(_0x523932['length']===0x0){const _0x5a3aca=_0x11eb50?_0x1d26f5(0x117)+_0x11eb50:'';throw new SDKError(ErrorCode[_0x1d26f5(0x12f)],_0x1d26f5(0xd6)+_0x412c25+_0x5a3aca,undefined,{'helpText':_0x11eb50?_0x1d26f5(0x13d):_0x1d26f5(0x16e)});}if(_0x523932['length']>0x1)throw new SDKError(ErrorCode['INTERNAL'],'Multiple\x20agents\x20found\x20with\x20name\x20\x27'+_0x412c25+_0x1d26f5(0xf0));return _0x523932[0x0]['id'];}async[a123_0x44cb81(0x13a)](_0x3ec8c9){const _0x3ab9f5=a123_0x44cb81,_0x48e265=_0x3ec8c9||this[_0x3ab9f5(0x17e)];return await this['client']['listAgents'](_0x48e265);}async[a123_0x44cb81(0x198)](_0x12b4e7){const _0x58b0f4=a123_0x44cb81;return await this[_0x58b0f4(0x147)][_0x58b0f4(0x173)](_0x12b4e7);}async['agent'](_0x1f762f){const _0x3dc884=a123_0x44cb81;return await this[_0x3dc884(0x147)][_0x3dc884(0x189)](_0x1f762f);}async[a123_0x44cb81(0x167)](_0x359ffd){const _0x3b618f=a123_0x44cb81;return await this[_0x3b618f(0x147)][_0x3b618f(0x167)](_0x359ffd);}async[a123_0x44cb81(0x12d)](_0xde444a,_0x3e6b20){const _0x4aff26=a123_0x44cb81;return await this[_0x4aff26(0x147)][_0x4aff26(0x12d)](_0xde444a,_0x3e6b20);}async[a123_0x44cb81(0x145)](_0x5b3635){const _0x21297f=a123_0x44cb81;await this['client'][_0x21297f(0x145)](_0x5b3635);}async[a123_0x44cb81(0xdf)](_0xd79615){const _0xacf4ae=a123_0x44cb81;return await this[_0xacf4ae(0x147)]['startChat']({'agentId':_0xd79615});}async*['chat'](_0x223292,_0x2c06e1){const _0x4b1f3=a123_0x44cb81;let _0xa91bbc=_0x2c06e1?.[_0x4b1f3(0x104)];const _0x2831a7=_0x2c06e1?.[_0x4b1f3(0xed)];if(!_0xa91bbc){if(!_0x2831a7)throw new Error(_0x4b1f3(0xe6));const _0x3959f2=await this[_0x4b1f3(0x147)][_0x4b1f3(0xdf)]({'agentId':_0x2831a7});_0xa91bbc=_0x3959f2['id'],yield{'type':_0x4b1f3(0x1a7),'data':{'chatId':_0xa91bbc,'agentId':_0x2831a7,'projectId':_0x3959f2['attributes'][_0x4b1f3(0x13f)]}};}for await(const _0x307f7d of this[_0x4b1f3(0x147)][_0x4b1f3(0x122)](_0xa91bbc,_0x223292,_0x2c06e1?.[_0x4b1f3(0x191)])){yield{'type':_0x4b1f3(0x1a5),'data':_0x307f7d};}}async[a123_0x44cb81(0xb3)](_0x5c7e43=0x32){const _0x5f2617=a123_0x44cb81;return await this[_0x5f2617(0x147)]['listChats'](_0x5c7e43);}async[a123_0x44cb81(0x1b0)](_0x3d04cf){const _0x1e0fbc=a123_0x44cb81;return await this[_0x1e0fbc(0x147)][_0x1e0fbc(0xc5)](_0x3d04cf);}async['getChatLog'](_0x3730c0){const _0x5257a0=a123_0x44cb81;return await this[_0x5257a0(0x147)][_0x5257a0(0x126)](_0x3730c0);}async[a123_0x44cb81(0x182)](_0x439580){const _0x14fea3=a123_0x44cb81;return await this['client'][_0x14fea3(0x151)](_0x439580);}async[a123_0x44cb81(0x13e)](_0xf596b3,_0x155c0a,_0x1cb3fd){const _0x42f003=a123_0x44cb81,_0x480acc=_0x1cb3fd?.[_0x42f003(0x1aa)]??![],{projectId:_0x56a4bf,project:_0x3c11c8}=await this[_0x42f003(0x14e)](_0xf596b3),_0x242dd4=_0x3c11c8[_0x42f003(0xfb)][_0x42f003(0xd9)],_0x10a9c6=_0x155c0a||_0x242dd4+_0x42f003(0x114);if(a123_0xbdc0df[_0x42f003(0x10d)](_0x10a9c6)&&!_0x480acc)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x42f003(0x120)+_0x10a9c6,undefined,{'helpText':_0x42f003(0x1b1)});const _0x3b6401=await this[_0x42f003(0x147)][_0x42f003(0x173)](_0x56a4bf),_0x3fe43f=await this['client']['listKnowledgeBases'](_0x56a4bf),_0x5a613f=await this[_0x42f003(0x147)][_0x42f003(0x10b)](_0x56a4bf),_0x2a1386=await this[_0x42f003(0x147)]['listIntegrations'](_0x56a4bf);if(!_0x480acc){a123_0xbdc0df['mkdirSync'](_0x10a9c6,{'recursive':!![]});const _0x4f0cae={'version':_0x42f003(0x163),'exportedAt':new Date()[_0x42f003(0x12b)](),'exportedFrom':{'site':this['context'][_0x42f003(0x195)],'projectId':_0x56a4bf,'projectName':_0x242dd4},'project':_0x3c11c8};a123_0xbdc0df[_0x42f003(0x169)](a123_0xe6e455['join'](_0x10a9c6,_0x42f003(0xc8)),JSON[_0x42f003(0xd1)](_0x4f0cae,null,0x2)),a123_0xbdc0df[_0x42f003(0x169)](a123_0xe6e455[_0x42f003(0xfd)](_0x10a9c6,'agents.json'),JSON[_0x42f003(0xd1)](_0x3b6401,null,0x2)),a123_0xbdc0df[_0x42f003(0x169)](a123_0xe6e455[_0x42f003(0xfd)](_0x10a9c6,_0x42f003(0x1a6)),JSON['stringify'](_0x3fe43f,null,0x2)),a123_0xbdc0df['writeFileSync'](a123_0xe6e455[_0x42f003(0xfd)](_0x10a9c6,_0x42f003(0x186)),JSON['stringify'](_0x5a613f,null,0x2)),a123_0xbdc0df[_0x42f003(0x169)](a123_0xe6e455[_0x42f003(0xfd)](_0x10a9c6,_0x42f003(0x1a8)),JSON[_0x42f003(0xd1)](_0x2a1386,null,0x2));}return{'projectName':_0x242dd4,'outputDir':_0x10a9c6,'counts':{'agents':_0x3b6401[_0x42f003(0x1bc)],'knowledgeBases':_0x3fe43f[_0x42f003(0x1bc)],'prompts':_0x5a613f[_0x42f003(0x1bc)],'integrations':_0x2a1386['length']}};}async[a123_0x44cb81(0xe5)](_0x56324e,_0x59961a){const _0x5e115=a123_0x44cb81,_0x4189da=_0x59961a?.[_0x5e115(0x1aa)]??![],_0x2bf2ae=this['getBackupMetadata'](_0x56324e),_0x48c10d=_0x2bf2ae[_0x5e115(0x13c)]['site'],_0x594688=this[_0x5e115(0xd8)][_0x5e115(0x195)],_0x3c67fd=_0x48c10d!==_0x594688?_0x48c10d:undefined,_0x501867=this[_0x5e115(0xbc)](a123_0xe6e455['join'](_0x56324e,_0x5e115(0x102)),[]),_0x15903d=this[_0x5e115(0xbc)](a123_0xe6e455[_0x5e115(0xfd)](_0x56324e,'knowledgebases.json'),[]),_0x380d45=this['loadJsonFile'](a123_0xe6e455[_0x5e115(0xfd)](_0x56324e,_0x5e115(0x186)),[]),_0x3b5d61=this[_0x5e115(0xbc)](a123_0xe6e455[_0x5e115(0xfd)](_0x56324e,_0x5e115(0x1a8)),[]),_0x1963d7=_0x59961a?.[_0x5e115(0xd9)]||_0x2bf2ae['exportedFrom'][_0x5e115(0x136)];if(_0x4189da){const _0x17f12b=new Map(),_0x550e6a=[..._0x501867],_0x5b02ca=_0x501867['length']+0x1;let _0x3b969a=0x0;while(_0x550e6a[_0x5e115(0x1bc)]>0x0&&_0x3b969a<_0x5b02ca){_0x3b969a++;const _0x1e4edc=[];for(const _0x1e4cce of _0x550e6a){canCreateAgent(_0x1e4cce,_0x17f12b)?_0x17f12b['set'](_0x1e4cce['id'],_0x5e115(0x144)+_0x1e4cce['id']):_0x1e4edc[_0x5e115(0x109)](_0x1e4cce);}if(_0x1e4edc[_0x5e115(0x1bc)]===_0x550e6a['length'])throw new SDKError(ErrorCode[_0x5e115(0x150)],_0x5e115(0x178),undefined,{'helpText':_0x5e115(0x19a)});_0x550e6a[_0x5e115(0x1bc)]=0x0,_0x550e6a[_0x5e115(0x109)](..._0x1e4edc);}const _0x380a82=_0x380d45[_0x5e115(0x11b)](_0x389f11=>_0x17f12b[_0x5e115(0xe8)](_0x389f11['attributes'][_0x5e115(0xed)]))['length'];return{'projectName':_0x1963d7,'projectId':'(dry-run)','counts':{'agents':_0x501867[_0x5e115(0x1bc)],'knowledgeBases':_0x15903d[_0x5e115(0x1bc)],'prompts':_0x380a82,'integrations':_0x3b5d61[_0x5e115(0x1bc)]},'sourceSite':_0x3c67fd};}const _0x362ff9=await this['client']['createProject']({'name':_0x1963d7,'description':_0x2bf2ae[_0x5e115(0x113)][_0x5e115(0xfb)][_0x5e115(0x1c9)]}),_0x4b5ab8=_0x362ff9['id'],_0x4a409d=new Map(),_0x23fa09=new Map(),_0x4e5bd5=new Map();for(const _0x292192 of _0x15903d){const _0x88af9e=await this[_0x5e115(0x147)][_0x5e115(0x1a1)]({'projectId':_0x4b5ab8,'name':_0x292192[_0x5e115(0xfb)]['name'],'tdDatabaseName':_0x292192['attributes']['tdDatabaseName'],'tables':_0x292192[_0x5e115(0xfb)][_0x5e115(0xbf)]});_0x4a409d['set'](_0x292192['id'],_0x88af9e['id']);}const _0x113dc4=[..._0x501867],_0x5c9e0c=_0x501867[_0x5e115(0x1bc)]+0x1;let _0xc5d36a=0x0;while(_0x113dc4['length']>0x0&&_0xc5d36a<_0x5c9e0c){_0xc5d36a++;const _0x271439=[];for(const _0xbba985 of _0x113dc4){if(canCreateAgent(_0xbba985,_0x23fa09)){const _0x19c845=remapToolIds(_0xbba985[_0x5e115(0xfb)][_0x5e115(0x17d)],_0x4a409d,_0x23fa09),_0x2ed7e0=remapVariableIds(_0xbba985[_0x5e115(0xfb)]['variables'],_0x4a409d),_0x552f0d=await this[_0x5e115(0x147)][_0x5e115(0x19f)]({'name':_0xbba985['attributes'][_0x5e115(0xd9)],'projectId':_0x4b5ab8,'systemPrompt':_0xbba985['attributes'][_0x5e115(0x132)],'starterMessage':_0xbba985[_0x5e115(0xfb)][_0x5e115(0x14d)],'modelType':migrateModelType(_0xbba985[_0x5e115(0xfb)][_0x5e115(0x10f)]),'maxToolIterations':_0xbba985['attributes'][_0x5e115(0x175)],'temperature':_0xbba985[_0x5e115(0xfb)]['temperature'],'reasoningEffort':_0xbba985[_0x5e115(0xfb)]['reasoningEffort'],'outputs':_0xbba985[_0x5e115(0xfb)]['outputs'],'tools':_0x19c845,'variables':_0x2ed7e0});_0x23fa09[_0x5e115(0x19b)](_0xbba985['id'],_0x552f0d['id']);}else _0x271439[_0x5e115(0x109)](_0xbba985);}if(_0x271439[_0x5e115(0x1bc)]===_0x113dc4[_0x5e115(0x1bc)])throw new SDKError(ErrorCode[_0x5e115(0x150)],_0x5e115(0x178),undefined,{'helpText':_0x5e115(0x19a)});_0x113dc4[_0x5e115(0x1bc)]=0x0,_0x113dc4[_0x5e115(0x109)](..._0x271439);}for(const _0x12954a of _0x380d45){const _0x4e564f=_0x23fa09[_0x5e115(0x174)](_0x12954a['attributes']['agentId']);if(!_0x4e564f)continue;const _0x562e74=await this[_0x5e115(0x147)]['createPrompt']({'projectId':_0x4b5ab8,'agentId':_0x4e564f,'name':_0x12954a[_0x5e115(0xfb)]['name'],'systemPrompt':_0x12954a[_0x5e115(0xfb)][_0x5e115(0x132)],'template':_0x12954a[_0x5e115(0xfb)][_0x5e115(0x158)],'jsonSchemaHint':_0x12954a[_0x5e115(0xfb)][_0x5e115(0xc9)]});_0x4e5bd5[_0x5e115(0x19b)](_0x12954a['id'],_0x562e74['id']);}for(const _0x294806 of _0x3b5d61){const _0x3dc650=_0x294806[_0x5e115(0xfb)][_0x5e115(0xe0)]['map'](_0xfe43e8=>({..._0xfe43e8,'promptId':_0x4e5bd5[_0x5e115(0x174)](_0xfe43e8['promptId'])||_0xfe43e8[_0x5e115(0x1ca)]}));await this[_0x5e115(0x147)][_0x5e115(0xae)]({'projectId':_0x4b5ab8,'serviceType':_0x294806[_0x5e115(0xfb)][_0x5e115(0x17f)],'actions':_0x3dc650,'slackMessageMode':_0x294806[_0x5e115(0xfb)]['slackMessageMode'],'chatIgnoreManagedActions':_0x294806['attributes'][_0x5e115(0x183)],'chatWelcomeMessage':_0x294806[_0x5e115(0xfb)][_0x5e115(0x129)],'webhookCorsOrigins':_0x294806[_0x5e115(0xfb)][_0x5e115(0x1a4)]});}return{'projectName':_0x1963d7,'projectId':_0x4b5ab8,'counts':{'agents':_0x23fa09[_0x5e115(0xf7)],'knowledgeBases':_0x4a409d[_0x5e115(0xf7)],'prompts':_0x4e5bd5[_0x5e115(0xf7)],'integrations':_0x3b5d61[_0x5e115(0x1bc)]},'sourceSite':_0x3c67fd};}[a123_0x44cb81(0xbc)](_0x4c4212,_0x155c8e){const _0x118c8d=a123_0x44cb81;if(!a123_0xbdc0df[_0x118c8d(0x10d)](_0x4c4212))return _0x155c8e;return JSON[_0x118c8d(0x16a)](a123_0xbdc0df[_0x118c8d(0xe9)](_0x4c4212,_0x118c8d(0x164)));}[a123_0x44cb81(0x11f)](_0x4c3079){const _0x14601c=a123_0x44cb81;if(!a123_0xbdc0df[_0x14601c(0x10d)](_0x4c3079))throw new SDKError(ErrorCode['NOT_FOUND'],_0x14601c(0x1bb)+_0x4c3079,undefined,{'helpText':_0x14601c(0x108)});const _0x4d7e88=a123_0xe6e455[_0x14601c(0xfd)](_0x4c3079,_0x14601c(0xc8));if(!a123_0xbdc0df[_0x14601c(0x10d)](_0x4d7e88))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x14601c(0x1b3)+_0x4c3079,undefined,{'helpText':_0x14601c(0x1a3)});const _0x4d7fd2=JSON['parse'](a123_0xbdc0df[_0x14601c(0xe9)](_0x4d7e88,_0x14601c(0x164)));if(!isSupportedBackupVersion(_0x4d7fd2[_0x14601c(0x18a)]))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x14601c(0xc3)+_0x4d7fd2[_0x14601c(0x18a)],undefined,{'helpText':_0x14601c(0x133)});return _0x4d7fd2;}async[a123_0x44cb81(0x103)](_0x3dafd1,_0x17efac,_0x27c9fa){const _0x5e0c91=a123_0x44cb81,{projectId:_0x156340,project:_0x53c302}=await this[_0x5e0c91(0x14e)](_0x3dafd1),_0x21681a=_0x53c302['attributes'][_0x5e0c91(0xd9)];let _0x194cc4;if(_0x17efac)_0x194cc4=_0x17efac;else{const _0x192f0d=a123_0xe6e455[_0x5e0c91(0xfd)](process[_0x5e0c91(0xce)](),'agents'),_0x108052=getSanitizedPathWithMigration(_0x192f0d,_0x21681a);_0x108052[_0x5e0c91(0x11c)]&&this[_0x5e0c91(0xff)][_0x5e0c91(0x11d)]('Renamed\x20folder:\x20'+a123_0xe6e455[_0x5e0c91(0x125)](_0x108052[_0x5e0c91(0x16b)])+_0x5e0c91(0xf5)+a123_0xe6e455[_0x5e0c91(0x125)](_0x108052[_0x5e0c91(0xeb)])),_0x194cc4=_0x108052[_0x5e0c91(0xeb)];}const _0x1fac5d=await this[_0x5e0c91(0x147)]['listAgentsFull'](_0x156340),_0x3b805f=await this[_0x5e0c91(0x147)]['listKnowledgeBases'](_0x156340),_0x111f7c=await this[_0x5e0c91(0x147)][_0x5e0c91(0x154)](_0x156340),_0x292c78=await safeListOrEmpty(()=>this['client'][_0x5e0c91(0xdc)](_0x156340)),_0x259c5a=await safeListOrEmpty(()=>this[_0x5e0c91(0x147)][_0x5e0c91(0x168)](_0x156340)),_0x22c57c=await this[_0x5e0c91(0x147)][_0x5e0c91(0x10b)](_0x156340),_0x3310f3=await this[_0x5e0c91(0x147)]['listIntegrations'](_0x156340),_0x2bfd74=await safeListOrEmpty(()=>this[_0x5e0c91(0x147)][_0x5e0c91(0xc2)](_0x156340)),_0x2d18ca=await safeListOrEmpty(()=>this[_0x5e0c91(0x147)][_0x5e0c91(0x194)](_0x156340)),_0xbffe0=_0x3310f3[_0x5e0c91(0x11b)](_0x16e985=>!_0x16e985[_0x5e0c91(0xfb)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x5e0c91(0x160)](_0x16e985[_0x5e0c91(0xfb)]['serviceType'][_0x5e0c91(0x18d)]())),_0x41d219=new Map(),_0x31823a=new Map(),_0x90f650=new Map(),_0x4be19a=new Map(),_0x31604c=new Map(),_0x5c984d=new Map(),_0x4d9394=new Map();for(const _0x1b1bb3 of _0x1fac5d){_0x41d219[_0x5e0c91(0x19b)](_0x1b1bb3['id'],_0x1b1bb3['attributes']['name']);}for(const _0x3998ed of _0x3b805f){_0x31823a[_0x5e0c91(0x19b)](_0x3998ed['id'],_0x3998ed['attributes'][_0x5e0c91(0xd9)]);}for(const _0x196298 of _0x111f7c){_0x90f650[_0x5e0c91(0x19b)](_0x196298['id'],_0x196298[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)]);}for(const _0x32a866 of _0x292c78){_0x4be19a['set'](_0x32a866['id'],_0x32a866[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)]);}for(const _0x15a212 of _0x259c5a){_0x31604c[_0x5e0c91(0x19b)](_0x15a212['id'],_0x15a212[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)]);}for(const _0x1b3654 of _0x22c57c){_0x5c984d[_0x5e0c91(0x19b)](_0x1b3654['id'],_0x1b3654['attributes']['name']);}for(const _0x1aba0f of _0x2bfd74){_0x4d9394[_0x5e0c91(0x19b)](_0x1aba0f['id'],_0x1aba0f[_0x5e0c91(0xfb)]['name']);}const _0x545455={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x31823a,'TextKnowledgeBase':_0x90f650,'Agent':_0x41d219,'WebSearchTool':_0x31604c,'ImageGenerator':_0x4be19a,'ExperimentalKnowledgeBase':_0x4d9394}),'resolvePromptName':async _0x19bbd4=>_0x5c984d[_0x5e0c91(0x174)](_0x19bbd4),'onWarning':_0x119372=>this['logger'][_0x5e0c91(0x13b)](_0x119372)},_0x1e511a={'projectName':_0x21681a,'outputDir':_0x194cc4,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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},'integrations':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalArtifacts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0x22f9e3=[],_0x3855a5=[];for(const _0x10dbd1 of _0x1fac5d){const _0x1f958f=getSanitizedPathWithMigration(_0x194cc4,_0x10dbd1['attributes']['name']);_0x1f958f[_0x5e0c91(0x11c)]&&this[_0x5e0c91(0xff)][_0x5e0c91(0x11d)](_0x5e0c91(0x1a9)+a123_0xe6e455[_0x5e0c91(0x125)](_0x1f958f[_0x5e0c91(0x16b)])+'\x20→\x20'+a123_0xe6e455[_0x5e0c91(0x125)](_0x1f958f[_0x5e0c91(0xeb)]));const _0xdf0e5b=_0x1f958f[_0x5e0c91(0xeb)],_0x45f626=a123_0xe6e455[_0x5e0c91(0xfd)](_0xdf0e5b,'prompt.md'),_0x3492e6=a123_0xe6e455['join'](_0xdf0e5b,'agent.yml'),_0x2e756a=a123_0xe6e455[_0x5e0c91(0xfd)](_0xdf0e5b,'starter_message.md'),{yaml:_0x81b709,systemPrompt:_0x512e94,starterMessage:_0x5ea633}=await agentResponseToDef(_0x10dbd1,_0x545455),_0x34cddc=toAgentYamlString(_0x81b709),_0x434a28=!a123_0xbdc0df[_0x5e0c91(0x10d)](_0x3492e6);let _0x556000=_0x434a28,_0x2d844d;if(!_0x434a28){const _0x517a4e=a123_0xbdc0df[_0x5e0c91(0x10d)](_0x45f626)?a123_0xbdc0df[_0x5e0c91(0xe9)](_0x45f626,_0x5e0c91(0x164)):'',_0x17125c=a123_0xbdc0df['readFileSync'](_0x3492e6,_0x5e0c91(0x164)),_0x171b42=_0x5e0c91(0x1ae)+_0x517a4e+_0x5e0c91(0xee)+_0x17125c,_0x1f76d7='#\x20prompt.md\x0a'+_0x512e94+_0x5e0c91(0xee)+_0x34cddc,_0x57c89f=generateDiff(_0x171b42,_0x1f76d7);_0x556000=hasChanges(_0x57c89f),_0x556000&&(_0x2d844d=formatDiffWithColors(_0x57c89f));}_0x22f9e3['push']({'path':_0xdf0e5b,'content':'','isDir':!![]}),_0x22f9e3['push']({'path':_0x45f626,'content':_0x512e94}),_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x3492e6,'content':_0x34cddc});_0x5ea633&&_0x5ea633[_0x5e0c91(0x160)]('\x0a')&&_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x2e756a,'content':_0x5ea633});_0x1e511a['agents']['push']({'agentName':_0x10dbd1[_0x5e0c91(0xfb)]['name'],'outputPath':_0xdf0e5b,'isNew':_0x434a28,'hasChanges':_0x556000,'diff':_0x2d844d}),_0x1e511a[_0x5e0c91(0x166)]['agents'][_0x5e0c91(0x15f)]++;if(_0x434a28)_0x1e511a[_0x5e0c91(0x166)]['agents'][_0x5e0c91(0x1c4)]++;else{if(_0x556000)_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0x13a)][_0x5e0c91(0x12a)]++;else _0x1e511a['counts']['agents']['unchanged']++;}}for(const _0x584449 of _0x3b805f){if(_0x584449[_0x5e0c91(0xfb)]['isManaged'])continue;const _0x4ef257=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x194cc4),_0x584449[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)],_0x5e0c91(0x1ce));_0x4ef257['renamed']&&this[_0x5e0c91(0xff)][_0x5e0c91(0x11d)](_0x5e0c91(0x18c)+a123_0xe6e455[_0x5e0c91(0x125)](_0x4ef257[_0x5e0c91(0x16b)])+'\x20→\x20'+a123_0xe6e455[_0x5e0c91(0x125)](_0x4ef257[_0x5e0c91(0xeb)]));const _0x52186f=_0x4ef257['path'],_0x26cb5d=apiKnowledgeBaseToYaml(_0x584449),_0xda1901=toKnowledgeBaseYamlString(_0x26cb5d),_0x139a03=!a123_0xbdc0df[_0x5e0c91(0x10d)](_0x52186f);let _0x15ff47=_0x139a03,_0xd2b0e0;if(!_0x139a03){const _0x223870=a123_0xbdc0df[_0x5e0c91(0xe9)](_0x52186f,'utf-8'),_0x2ebc0f=generateDiff(_0x223870,_0xda1901);_0x15ff47=hasChanges(_0x2ebc0f),_0x15ff47&&(_0xd2b0e0=formatDiffWithColors(_0x2ebc0f));}_0x22f9e3['push']({'path':_0x52186f,'content':_0xda1901}),_0x1e511a[_0x5e0c91(0x138)][_0x5e0c91(0x109)]({'name':_0x584449['attributes'][_0x5e0c91(0xd9)],'outputPath':_0x52186f,'isNew':_0x139a03,'hasChanges':_0x15ff47,'diff':_0xd2b0e0}),_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0x138)][_0x5e0c91(0x15f)]++;if(_0x139a03)_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0x138)][_0x5e0c91(0x1c4)]++;else{if(_0x15ff47)_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0x138)][_0x5e0c91(0x12a)]++;else _0x1e511a[_0x5e0c91(0x166)]['knowledgeBases'][_0x5e0c91(0x1bf)]++;}}for(const _0x392501 of _0x111f7c){if(_0x392501['attributes']['isManaged'])continue;const _0x5f5234=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x194cc4),_0x392501['attributes']['name'],_0x5e0c91(0xfe));_0x5f5234[_0x5e0c91(0x11c)]&&this[_0x5e0c91(0xff)][_0x5e0c91(0x11d)](_0x5e0c91(0x190)+a123_0xe6e455[_0x5e0c91(0x125)](_0x5f5234[_0x5e0c91(0x16b)])+_0x5e0c91(0xf5)+a123_0xe6e455[_0x5e0c91(0x125)](_0x5f5234[_0x5e0c91(0xeb)]));const _0x2561a1=_0x5f5234[_0x5e0c91(0xeb)],_0x1c3815=toTextKnowledgeBaseMd(_0x392501[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)],_0x392501[_0x5e0c91(0xfb)][_0x5e0c91(0xf8)]),_0x3d2c67=!a123_0xbdc0df[_0x5e0c91(0x10d)](_0x2561a1);let _0x1009f8=_0x3d2c67,_0x3b0411;if(!_0x3d2c67){const _0x4f9d34=a123_0xbdc0df[_0x5e0c91(0xe9)](_0x2561a1,_0x5e0c91(0x164)),_0x9901a3=generateDiff(_0x4f9d34,_0x1c3815);_0x1009f8=hasChanges(_0x9901a3),_0x1009f8&&(_0x3b0411=formatDiffWithColors(_0x9901a3));}_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x2561a1,'content':_0x1c3815}),_0x1e511a[_0x5e0c91(0x172)][_0x5e0c91(0x109)]({'name':_0x392501[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)],'outputPath':_0x2561a1,'isNew':_0x3d2c67,'hasChanges':_0x1009f8,'diff':_0x3b0411}),_0x1e511a[_0x5e0c91(0x166)]['textKnowledgeBases'][_0x5e0c91(0x15f)]++;if(_0x3d2c67)_0x1e511a[_0x5e0c91(0x166)]['textKnowledgeBases']['new']++;else{if(_0x1009f8)_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0x172)]['updated']++;else _0x1e511a[_0x5e0c91(0x166)]['textKnowledgeBases'][_0x5e0c91(0x1bf)]++;}}for(const _0x34bd87 of _0x22c57c){if(_0x34bd87[_0x5e0c91(0xfb)][_0x5e0c91(0x128)])continue;const _0x196742=getSanitizedPathWithMigration(getPromptsDir(_0x194cc4),_0x34bd87[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)],_0x5e0c91(0x1ce));_0x196742[_0x5e0c91(0x11c)]&&this[_0x5e0c91(0xff)][_0x5e0c91(0x11d)](_0x5e0c91(0x1c8)+a123_0xe6e455[_0x5e0c91(0x125)](_0x196742[_0x5e0c91(0x16b)])+'\x20→\x20'+a123_0xe6e455[_0x5e0c91(0x125)](_0x196742[_0x5e0c91(0xeb)]));const _0x23950d=_0x196742[_0x5e0c91(0xeb)],_0x56ee9d=await apiPromptToYaml(_0x34bd87,_0x545455);if(!_0x56ee9d)continue;const _0x4fac8f=toPromptYamlString(_0x56ee9d),_0x48a7f8=!a123_0xbdc0df[_0x5e0c91(0x10d)](_0x23950d);let _0x24a6ac=_0x48a7f8,_0x3c365c;if(!_0x48a7f8){const _0x2af7e8=a123_0xbdc0df[_0x5e0c91(0xe9)](_0x23950d,_0x5e0c91(0x164)),_0x41cd6c=generateDiff(_0x2af7e8,_0x4fac8f);_0x24a6ac=hasChanges(_0x41cd6c),_0x24a6ac&&(_0x3c365c=formatDiffWithColors(_0x41cd6c));}_0x22f9e3['push']({'path':_0x23950d,'content':_0x4fac8f}),_0x1e511a['prompts'][_0x5e0c91(0x109)]({'name':_0x34bd87[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)],'outputPath':_0x23950d,'isNew':_0x48a7f8,'hasChanges':_0x24a6ac,'diff':_0x3c365c}),_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0xfc)]['total']++;if(_0x48a7f8)_0x1e511a['counts'][_0x5e0c91(0xfc)][_0x5e0c91(0x1c4)]++;else{if(_0x24a6ac)_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0xfc)][_0x5e0c91(0x12a)]++;else _0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0xfc)][_0x5e0c91(0x1bf)]++;}}for(const _0x54b8f2 of _0xbffe0){const _0x39f6ab=_0x54b8f2[_0x5e0c91(0xfb)][_0x5e0c91(0x17f)][_0x5e0c91(0x18d)](),_0x3f6be2=getSanitizedPathWithMigration(getIntegrationsDir(_0x194cc4),_0x39f6ab,_0x5e0c91(0x1ce));_0x3f6be2['renamed']&&this[_0x5e0c91(0xff)][_0x5e0c91(0x11d)](_0x5e0c91(0x17c)+a123_0xe6e455['basename'](_0x3f6be2[_0x5e0c91(0x16b)])+_0x5e0c91(0xf5)+a123_0xe6e455[_0x5e0c91(0x125)](_0x3f6be2['path']));const _0x662a7f=_0x3f6be2[_0x5e0c91(0xeb)],_0x1bf8f8=await apiIntegrationToYaml(_0x54b8f2,_0x545455),_0x59dc66=toIntegrationYamlString(_0x1bf8f8),_0x4c5a98=!a123_0xbdc0df['existsSync'](_0x662a7f);let _0x264866=_0x4c5a98,_0xf5d6c0;if(!_0x4c5a98){const _0x13f900=a123_0xbdc0df[_0x5e0c91(0xe9)](_0x662a7f,_0x5e0c91(0x164)),_0x1216ae=generateDiff(_0x13f900,_0x59dc66);_0x264866=hasChanges(_0x1216ae),_0x264866&&(_0xf5d6c0=formatDiffWithColors(_0x1216ae));}_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x662a7f,'content':_0x59dc66}),_0x1e511a[_0x5e0c91(0xa8)][_0x5e0c91(0x109)]({'name':_0x39f6ab,'outputPath':_0x662a7f,'isNew':_0x4c5a98,'hasChanges':_0x264866,'diff':_0xf5d6c0}),_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0xa8)][_0x5e0c91(0x15f)]++;if(_0x4c5a98)_0x1e511a['counts'][_0x5e0c91(0xa8)][_0x5e0c91(0x1c4)]++;else{if(_0x264866)_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0xa8)][_0x5e0c91(0x12a)]++;else _0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0xa8)][_0x5e0c91(0x1bf)]++;}}for(const _0x3cae47 of _0x2bfd74){if(_0x3cae47[_0x5e0c91(0xfb)]['isManaged'])continue;const _0x529730=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x194cc4),_0x3cae47[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)]);_0x529730[_0x5e0c91(0x11c)]&&this[_0x5e0c91(0xff)][_0x5e0c91(0x11d)](_0x5e0c91(0x107)+a123_0xe6e455['basename'](_0x529730['oldPath'])+'\x20→\x20'+a123_0xe6e455['basename'](_0x529730[_0x5e0c91(0xeb)]));const _0x30701c=_0x529730[_0x5e0c91(0xeb)],_0x5d3f4a=a123_0xe6e455[_0x5e0c91(0xfd)](_0x30701c,sanitizeForFilesystem(_0x3cae47[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)])+'.yml'),_0x30b4da=a123_0xe6e455[_0x5e0c91(0xfd)](_0x30701c,_0x5e0c91(0x15d)),_0x53e32d=apiExperimentalKnowledgeBaseToYaml(_0x3cae47),_0x16b9b8=toExperimentalKnowledgeBaseYamlString(_0x53e32d),_0x2bfa72=!a123_0xbdc0df[_0x5e0c91(0x10d)](_0x30701c);let _0x453910=_0x2bfa72,_0x3d7402,_0x51d7de=_0x16b9b8;const _0x5714fe=[..._0x53e32d['functions']][_0x5e0c91(0x1ad)]((_0x548184,_0x416aad)=>_0x548184[_0x5e0c91(0xd9)]['localeCompare'](_0x416aad[_0x5e0c91(0xd9)]));for(const _0x43bfad of _0x5714fe){_0x51d7de+=_0x5e0c91(0xd7)+_0x43bfad[_0x5e0c91(0xd9)]+_0x5e0c91(0x105)+_0x43bfad[_0x5e0c91(0x155)]+_0x5e0c91(0xa9)+_0x43bfad[_0x5e0c91(0xd9)]+'\x20---\x0a'+_0x43bfad[_0x5e0c91(0x1a2)]+'\x0a';}if(!_0x2bfa72){let _0xd065ad='';a123_0xbdc0df['existsSync'](_0x5d3f4a)&&(_0xd065ad=a123_0xbdc0df[_0x5e0c91(0xe9)](_0x5d3f4a,_0x5e0c91(0x164)));if(a123_0xbdc0df[_0x5e0c91(0x10d)](_0x30b4da)){const _0x2e4b93=a123_0xbdc0df[_0x5e0c91(0x19e)](_0x30b4da,{'withFileTypes':!![]}),_0x488fa0=_0x2e4b93[_0x5e0c91(0x11b)](_0x14488f=>_0x14488f[_0x5e0c91(0x141)]())[_0x5e0c91(0x1ad)]((_0x26b4b9,_0x28c4f0)=>_0x26b4b9[_0x5e0c91(0xd9)][_0x5e0c91(0xcd)](_0x28c4f0[_0x5e0c91(0xd9)]));for(const _0x440dc1 of _0x488fa0){const _0x51896e=a123_0xe6e455['join'](_0x30b4da,_0x440dc1[_0x5e0c91(0xd9)],_0x5e0c91(0xcc)),_0x3d0a71=a123_0xe6e455[_0x5e0c91(0xfd)](_0x30b4da,_0x440dc1[_0x5e0c91(0xd9)],_0x5e0c91(0xde));a123_0xbdc0df[_0x5e0c91(0x10d)](_0x51896e)&&(_0xd065ad+=_0x5e0c91(0xd7)+_0x440dc1['name']+'\x20---\x0a'+a123_0xbdc0df[_0x5e0c91(0xe9)](_0x51896e,_0x5e0c91(0x164))+'\x0a'),a123_0xbdc0df[_0x5e0c91(0x10d)](_0x3d0a71)&&(_0xd065ad+=_0x5e0c91(0xb0)+_0x440dc1[_0x5e0c91(0xd9)]+'\x20---\x0a'+a123_0xbdc0df[_0x5e0c91(0xe9)](_0x3d0a71,_0x5e0c91(0x164))+'\x0a');}}const _0x5769ff=generateDiff(_0xd065ad,_0x51d7de);_0x453910=hasChanges(_0x5769ff),_0x453910&&(_0x3d7402=formatDiffWithColors(_0x5769ff));}_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x30701c,'content':'','isDir':!![]}),_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x5d3f4a,'content':_0x16b9b8}),_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x30b4da,'content':'','isDir':!![]});for(const _0x8b4aed of _0x53e32d[_0x5e0c91(0x15d)]){const _0x134844=a123_0xe6e455['join'](_0x30b4da,sanitizeForFilesystem(_0x8b4aed[_0x5e0c91(0xd9)])),_0x2a6a3d=a123_0xe6e455[_0x5e0c91(0xfd)](_0x134844,'code.js'),_0x1f58fa=a123_0xe6e455[_0x5e0c91(0xfd)](_0x134844,_0x5e0c91(0xde));_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x134844,'content':'','isDir':!![]}),_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x2a6a3d,'content':_0x8b4aed[_0x5e0c91(0x155)]}),_0x22f9e3['push']({'path':_0x1f58fa,'content':_0x8b4aed[_0x5e0c91(0x1a2)]});}if(a123_0xbdc0df['existsSync'](_0x30b4da)){const _0x4370f7=a123_0xbdc0df[_0x5e0c91(0x19e)](_0x30b4da,{'withFileTypes':!![]}),_0x543ca1=new Set(_0x53e32d['functions'][_0x5e0c91(0xf1)](_0xbb8505=>sanitizeForFilesystem(_0xbb8505[_0x5e0c91(0xd9)])));for(const _0xecfb2d of _0x4370f7){if(_0xecfb2d[_0x5e0c91(0x141)]()&&!_0x543ca1[_0x5e0c91(0xe8)](_0xecfb2d[_0x5e0c91(0xd9)])){const _0x4e6f09=a123_0xe6e455[_0x5e0c91(0xfd)](_0x30b4da,_0xecfb2d[_0x5e0c91(0xd9)]);_0x3855a5[_0x5e0c91(0x109)]({'path':_0x4e6f09,'isDir':!![]});}}}_0x1e511a[_0x5e0c91(0x1ab)][_0x5e0c91(0x109)]({'name':_0x3cae47[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)],'outputPath':_0x30701c,'isNew':_0x2bfa72,'hasChanges':_0x453910,'diff':_0x3d7402}),_0x1e511a[_0x5e0c91(0x166)]['experimentalKnowledgeBases']['total']++;if(_0x2bfa72)_0x1e511a[_0x5e0c91(0x166)]['experimentalKnowledgeBases'][_0x5e0c91(0x1c4)]++;else{if(_0x453910)_0x1e511a['counts'][_0x5e0c91(0x1ab)][_0x5e0c91(0x12a)]++;else _0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0x1ab)]['unchanged']++;}}for(const _0x4626b0 of _0x2d18ca){if(_0x4626b0[_0x5e0c91(0xfb)][_0x5e0c91(0x128)])continue;const _0x3f7c20=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x194cc4),_0x4626b0['attributes']['name']);_0x3f7c20[_0x5e0c91(0x11c)]&&this[_0x5e0c91(0xff)]['info']('Renamed\x20experimental\x20artifact\x20directory:\x20'+a123_0xe6e455[_0x5e0c91(0x125)](_0x3f7c20[_0x5e0c91(0x16b)])+'\x20→\x20'+a123_0xe6e455[_0x5e0c91(0x125)](_0x3f7c20[_0x5e0c91(0xeb)]));const _0x182e0f=_0x3f7c20[_0x5e0c91(0xeb)],_0x2e400f=a123_0xe6e455[_0x5e0c91(0xfd)](_0x182e0f,sanitizeForFilesystem(_0x4626b0[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)])+_0x5e0c91(0x1ce)),_0x514ecd=a123_0xe6e455[_0x5e0c91(0xfd)](_0x182e0f,_0x5e0c91(0xcc)),_0x35fc8c=a123_0xe6e455[_0x5e0c91(0xfd)](_0x182e0f,_0x5e0c91(0x19d)),_0xd22bf5=apiExperimentalArtifactToYaml(_0x4626b0),_0x41c148=toExperimentalArtifactYamlString(_0xd22bf5),_0x37d237=!a123_0xbdc0df['existsSync'](_0x182e0f);let _0x740c95=_0x37d237,_0x422889,_0x1db121=_0x41c148+(_0x5e0c91(0x170)+_0xd22bf5[_0x5e0c91(0x155)]+'\x0a');const _0x43eab8=[..._0xd22bf5[_0x5e0c91(0x19d)]][_0x5e0c91(0x1ad)]((_0x348af0,_0x1012b8)=>_0x348af0['file_name'][_0x5e0c91(0xcd)](_0x1012b8[_0x5e0c91(0xab)]));for(const _0x1c679f of _0x43eab8){_0x1db121+=_0x5e0c91(0xc7)+_0x1c679f['file_name']+'\x20---\x0a'+_0x1c679f[_0x5e0c91(0x192)]+'\x0a';}if(!_0x37d237){let _0x2f557b='';a123_0xbdc0df[_0x5e0c91(0x10d)](_0x2e400f)&&(_0x2f557b=a123_0xbdc0df[_0x5e0c91(0xe9)](_0x2e400f,_0x5e0c91(0x164)));a123_0xbdc0df['existsSync'](_0x514ecd)&&(_0x2f557b+=_0x5e0c91(0x170)+a123_0xbdc0df[_0x5e0c91(0xe9)](_0x514ecd,'utf-8')+'\x0a');if(a123_0xbdc0df[_0x5e0c91(0x10d)](_0x35fc8c)){const _0x4a2395=a123_0xbdc0df[_0x5e0c91(0x19e)](_0x35fc8c),_0x56a759=_0x4a2395['filter'](_0x3856db=>{const _0xc6a646=_0x5e0c91,_0x2632b5=a123_0xe6e455['join'](_0x35fc8c,_0x3856db);return a123_0xbdc0df[_0xc6a646(0xdd)](_0x2632b5)[_0xc6a646(0x119)]();})[_0x5e0c91(0x1ad)]((_0x538da0,_0x4cb96c)=>_0x538da0[_0x5e0c91(0xcd)](_0x4cb96c));for(const _0x544c23 of _0x56a759){const _0x1cbc39=a123_0xe6e455[_0x5e0c91(0xfd)](_0x35fc8c,_0x544c23);_0x2f557b+=_0x5e0c91(0xc7)+_0x544c23+_0x5e0c91(0x105)+a123_0xbdc0df[_0x5e0c91(0xe9)](_0x1cbc39,'utf-8')+'\x0a';}}const _0x498992=generateDiff(_0x2f557b,_0x1db121);_0x740c95=hasChanges(_0x498992),_0x740c95&&(_0x422889=formatDiffWithColors(_0x498992));}_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x182e0f,'content':'','isDir':!![]}),_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x2e400f,'content':_0x41c148}),_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x514ecd,'content':_0xd22bf5[_0x5e0c91(0x155)]});if(_0xd22bf5[_0x5e0c91(0x19d)]['length']>0x0){_0x22f9e3['push']({'path':_0x35fc8c,'content':'','isDir':!![]});for(const _0x3a5470 of _0xd22bf5[_0x5e0c91(0x19d)]){const _0x53c63d=a123_0xe6e455[_0x5e0c91(0xfd)](_0x35fc8c,_0x3a5470[_0x5e0c91(0xab)]);_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x53c63d,'content':_0x3a5470[_0x5e0c91(0x192)]});}}if(a123_0xbdc0df[_0x5e0c91(0x10d)](_0x35fc8c)){const _0x4b3617=a123_0xbdc0df[_0x5e0c91(0x19e)](_0x35fc8c),_0x2beb13=new Set(_0xd22bf5[_0x5e0c91(0x19d)][_0x5e0c91(0xf1)](_0x22cd90=>_0x22cd90[_0x5e0c91(0xab)]));for(const _0x42f997 of _0x4b3617){const _0x3af0e6=a123_0xe6e455[_0x5e0c91(0xfd)](_0x35fc8c,_0x42f997);a123_0xbdc0df[_0x5e0c91(0xdd)](_0x3af0e6)[_0x5e0c91(0x119)]()&&!_0x2beb13['has'](_0x42f997)&&_0x3855a5[_0x5e0c91(0x109)]({'path':_0x3af0e6});}}_0x1e511a['experimentalArtifacts'][_0x5e0c91(0x109)]({'name':_0x4626b0['attributes']['name'],'outputPath':_0x182e0f,'isNew':_0x37d237,'hasChanges':_0x740c95,'diff':_0x422889}),_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0xc0)][_0x5e0c91(0x15f)]++;if(_0x37d237)_0x1e511a[_0x5e0c91(0x166)]['experimentalArtifacts']['new']++;else{if(_0x740c95)_0x1e511a[_0x5e0c91(0x166)]['experimentalArtifacts'][_0x5e0c91(0x12a)]++;else _0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0xc0)][_0x5e0c91(0x1bf)]++;}}if(_0x27c9fa?.[_0x5e0c91(0x1aa)])return _0x1e511a;a123_0xbdc0df[_0x5e0c91(0xe2)](_0x194cc4,{'recursive':!![]}),a123_0xbdc0df[_0x5e0c91(0xe2)](getKnowledgeBasesDir(_0x194cc4),{'recursive':!![]}),a123_0xbdc0df['mkdirSync'](getPromptsDir(_0x194cc4),{'recursive':!![]}),a123_0xbdc0df[_0x5e0c91(0xe2)](getIntegrationsDir(_0x194cc4),{'recursive':!![]}),a123_0xbdc0df['mkdirSync'](getExperimentalKnowledgeBasesDir(_0x194cc4),{'recursive':!![]}),a123_0xbdc0df[_0x5e0c91(0xe2)](getExperimentalArtifactsDir(_0x194cc4),{'recursive':!![]});const _0x14f76b=a123_0xe6e455[_0x5e0c91(0xfd)](_0x194cc4,_0x5e0c91(0xc4));a123_0xbdc0df[_0x5e0c91(0x169)](_0x14f76b,createAgentConfigContent(_0x21681a));for(const _0x10a17d of _0x22f9e3){if(_0x10a17d[_0x5e0c91(0x1b8)])a123_0xbdc0df[_0x5e0c91(0xe2)](_0x10a17d[_0x5e0c91(0xeb)],{'recursive':!![]});else{const _0x460ce9=a123_0xe6e455[_0x5e0c91(0x10c)](_0x10a17d[_0x5e0c91(0xeb)]);!a123_0xbdc0df['existsSync'](_0x460ce9)&&a123_0xbdc0df[_0x5e0c91(0xe2)](_0x460ce9,{'recursive':!![]}),a123_0xbdc0df[_0x5e0c91(0x169)](_0x10a17d[_0x5e0c91(0xeb)],_0x10a17d[_0x5e0c91(0x184)]);}}for(const _0x2925f3 of _0x3855a5){_0x2925f3['isDir']?(a123_0xbdc0df[_0x5e0c91(0x110)](_0x2925f3[_0x5e0c91(0xeb)],{'recursive':!![],'force':!![]}),this[_0x5e0c91(0xff)]['info'](_0x5e0c91(0x15e)+a123_0xe6e455[_0x5e0c91(0x125)](a123_0xe6e455['dirname'](_0x2925f3['path']))+'/'+a123_0xe6e455[_0x5e0c91(0x125)](_0x2925f3[_0x5e0c91(0xeb)]))):(a123_0xbdc0df['rmSync'](_0x2925f3[_0x5e0c91(0xeb)],{'force':!![]}),this[_0x5e0c91(0xff)][_0x5e0c91(0x11d)](_0x5e0c91(0xac)+a123_0xe6e455[_0x5e0c91(0x125)](a123_0xe6e455[_0x5e0c91(0x10c)](_0x2925f3[_0x5e0c91(0xeb)]))+'/'+a123_0xe6e455[_0x5e0c91(0x125)](_0x2925f3[_0x5e0c91(0xeb)])));}return _0x1e511a;}async[a123_0x44cb81(0x127)](_0x1bcaa4,_0x48d7be){const _0x339701=a123_0x44cb81,_0x43b93f=a123_0xe6e455['join'](_0x1bcaa4,_0x339701(0xc4));if(!a123_0xbdc0df[_0x339701(0x10d)](_0x43b93f))throw new SDKError(ErrorCode[_0x339701(0x146)],_0x339701(0x1b4)+_0x1bcaa4,undefined,{'helpText':_0x339701(0x1cb)});const _0x15448b=loadAgentConfig(_0x43b93f),_0x15f1ee=await this[_0x339701(0xf4)](_0x15448b[_0x339701(0xba)]),_0x4c750e=await this[_0x339701(0x147)][_0x339701(0x197)](_0x15f1ee),_0x420db2=_0x4c750e[_0x339701(0xfb)][_0x339701(0xd9)],_0x38f469={'projectName':_0x420db2,'projectId':_0x15f1ee,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x39961d=[],_0x5add69=[],_0x1d4e9c=[],_0x28ca99=[],_0x568323=[],_0x7f36bd=[],_0x497a21=a123_0xbdc0df[_0x339701(0x19e)](_0x1bcaa4,{'withFileTypes':!![]});for(const _0x5d33b6 of _0x497a21){if(!_0x5d33b6[_0x339701(0x141)]())continue;if([_0x339701(0x1c7),_0x339701(0xfc),_0x339701(0xa8),_0x339701(0x176),_0x339701(0x123)][_0x339701(0x160)](_0x5d33b6[_0x339701(0xd9)]))continue;const _0x3089d7=a123_0xe6e455[_0x339701(0xfd)](_0x1bcaa4,_0x5d33b6[_0x339701(0xd9)]);if(isAgentDir(_0x3089d7)){const _0xa5afe9=a123_0xe6e455[_0x339701(0xfd)](_0x3089d7,'agent.yml'),_0x42d391=a123_0xe6e455['join'](_0x3089d7,_0x339701(0xdb)),_0x4bf550=a123_0xe6e455[_0x339701(0xfd)](_0x3089d7,_0x339701(0xa6)),_0x51c02c=parseAgentYaml(a123_0xbdc0df[_0x339701(0xe9)](_0xa5afe9,_0x339701(0x164)),_0xa5afe9),_0x43f15e=a123_0xbdc0df[_0x339701(0x10d)](_0x42d391)?a123_0xbdc0df[_0x339701(0xe9)](_0x42d391,_0x339701(0x164)):'',_0x2c351b=a123_0xbdc0df[_0x339701(0x10d)](_0x4bf550)?a123_0xbdc0df['readFileSync'](_0x4bf550,'utf-8'):_0x51c02c['starter_message'];_0x39961d['push']({'name':_0x51c02c[_0x339701(0xd9)],'dir':_0x3089d7,'yaml':_0x51c02c,'systemPrompt':_0x43f15e,'starterMessage':_0x2c351b});}}const _0x3d9415=getKnowledgeBasesDir(_0x1bcaa4);if(a123_0xbdc0df[_0x339701(0x10d)](_0x3d9415)){const _0x1df24c=a123_0xbdc0df[_0x339701(0x19e)](_0x3d9415);for(const _0x23659f of _0x1df24c){const _0x486b3a=a123_0xe6e455[_0x339701(0xfd)](_0x3d9415,_0x23659f);if(_0x23659f[_0x339701(0x1b7)](_0x339701(0x1ce))){const _0x5dc814=parseKnowledgeBaseYaml(a123_0xbdc0df['readFileSync'](_0x486b3a,_0x339701(0x164)),_0x486b3a);_0x5add69['push']({'name':_0x5dc814[_0x339701(0xd9)],'path':_0x486b3a,'yaml':_0x5dc814});}else{if(_0x23659f[_0x339701(0x1b7)](_0x339701(0xfe))){const _0x251bff=a123_0xbdc0df[_0x339701(0xe9)](_0x486b3a,_0x339701(0x164)),{name:_0x5d685c,text:_0x423e94}=parseTextKnowledgeBaseMd(_0x251bff,_0x23659f);_0x1d4e9c[_0x339701(0x109)]({'name':_0x5d685c,'path':_0x486b3a,'text':_0x423e94});}}}}const _0x2c4405=getPromptsDir(_0x1bcaa4);if(a123_0xbdc0df[_0x339701(0x10d)](_0x2c4405)){const _0x14109e=a123_0xbdc0df['readdirSync'](_0x2c4405)[_0x339701(0x11b)](_0x27d74b=>_0x27d74b[_0x339701(0x1b7)]('.yml'));for(const _0x473ffa of _0x14109e){const _0x572c79=a123_0xe6e455[_0x339701(0xfd)](_0x2c4405,_0x473ffa),_0xf6931e=parsePromptYaml(a123_0xbdc0df[_0x339701(0xe9)](_0x572c79,_0x339701(0x164)),_0x572c79);_0x28ca99[_0x339701(0x109)]({'name':_0xf6931e['name'],'path':_0x572c79,'yaml':_0xf6931e});}}const _0x4a89dd=[],_0x443571=getIntegrationsDir(_0x1bcaa4);if(a123_0xbdc0df[_0x339701(0x10d)](_0x443571)){const _0x27746b=a123_0xbdc0df['readdirSync'](_0x443571)[_0x339701(0x11b)](_0x5cf667=>_0x5cf667[_0x339701(0x1b7)]('.yml'));for(const _0x507a6d of _0x27746b){const _0x738fef=a123_0xe6e455['join'](_0x443571,_0x507a6d),_0x4b3785=parseIntegrationYaml(a123_0xbdc0df[_0x339701(0xe9)](_0x738fef,_0x339701(0x164)),_0x738fef);if(!SAFE_INTEGRATION_TYPES[_0x339701(0x160)](_0x4b3785[_0x339701(0xb1)][_0x339701(0x18d)]())){this[_0x339701(0xff)]['warn'](_0x339701(0x17a)+_0x4b3785[_0x339701(0xd9)]+_0x339701(0xf2)+_0x4b3785[_0x339701(0xb1)]+'):\x20'+(_0x339701(0xb8)+SAFE_INTEGRATION_TYPES[_0x339701(0xfd)](',\x20')+')\x20can\x20be\x20pushed.\x20')+_0x339701(0x171));continue;}_0x4a89dd[_0x339701(0x109)]({'name':_0x4b3785[_0x339701(0xd9)],'path':_0x738fef,'yaml':_0x4b3785});}}const _0x2666b1=getExperimentalKnowledgeBasesDir(_0x1bcaa4);if(a123_0xbdc0df[_0x339701(0x10d)](_0x2666b1)){const _0x33653e=a123_0xbdc0df[_0x339701(0x19e)](_0x2666b1,{'withFileTypes':!![]});for(const _0x48cc2a of _0x33653e){if(!_0x48cc2a[_0x339701(0x141)]())continue;const _0x529c1c=a123_0xe6e455['join'](_0x2666b1,_0x48cc2a[_0x339701(0xd9)]),_0x63bbb1=a123_0xe6e455['join'](_0x529c1c,_0x48cc2a[_0x339701(0xd9)]+_0x339701(0x1ce)),_0x3665c6=a123_0xe6e455['join'](_0x529c1c,_0x339701(0x15d));if(!a123_0xbdc0df[_0x339701(0x10d)](_0x63bbb1))continue;const _0x4e3e9c=parseExperimentalKnowledgeBaseYaml(a123_0xbdc0df[_0x339701(0xe9)](_0x63bbb1,_0x339701(0x164)),_0x63bbb1),_0x69968a=[];if(a123_0xbdc0df[_0x339701(0x10d)](_0x3665c6)){const _0x327c38=a123_0xbdc0df[_0x339701(0x19e)](_0x3665c6,{'withFileTypes':!![]});for(const _0x48795c of _0x327c38){if(!_0x48795c['isDirectory']())continue;const _0x1498a5=a123_0xe6e455[_0x339701(0xfd)](_0x3665c6,_0x48795c[_0x339701(0xd9)]),_0x39e005=a123_0xe6e455[_0x339701(0xfd)](_0x1498a5,_0x339701(0xcc)),_0x4b01c9=a123_0xe6e455[_0x339701(0xfd)](_0x1498a5,_0x339701(0xde));a123_0xbdc0df['existsSync'](_0x39e005)&&a123_0xbdc0df[_0x339701(0x10d)](_0x4b01c9)&&_0x69968a[_0x339701(0x109)]({'name':_0x48795c[_0x339701(0xd9)],'code':a123_0xbdc0df['readFileSync'](_0x39e005,'utf-8'),'json_schema':a123_0xbdc0df[_0x339701(0xe9)](_0x4b01c9,_0x339701(0x164))});}}const _0x489256={..._0x4e3e9c,'variables':_0x4e3e9c[_0x339701(0xbd)]||[],'functions':_0x69968a};_0x568323['push']({'name':_0x4e3e9c[_0x339701(0xd9)],'dir':_0x529c1c,'def':_0x489256});}}const _0x1a79a3=getExperimentalArtifactsDir(_0x1bcaa4);if(a123_0xbdc0df[_0x339701(0x10d)](_0x1a79a3)){const _0x2c92e6=a123_0xbdc0df[_0x339701(0x19e)](_0x1a79a3,{'withFileTypes':!![]});for(const _0x4cf353 of _0x2c92e6){if(!_0x4cf353[_0x339701(0x141)]())continue;const _0x159b8c=a123_0xe6e455[_0x339701(0xfd)](_0x1a79a3,_0x4cf353['name']),_0x14a97f=a123_0xe6e455[_0x339701(0xfd)](_0x159b8c,_0x4cf353[_0x339701(0xd9)]+_0x339701(0x1ce)),_0x414912=a123_0xe6e455[_0x339701(0xfd)](_0x159b8c,'code.js'),_0x3d9509=a123_0xe6e455['join'](_0x159b8c,_0x339701(0x19d));if(!a123_0xbdc0df[_0x339701(0x10d)](_0x14a97f)||!a123_0xbdc0df[_0x339701(0x10d)](_0x414912))continue;const _0x507e0f=parseExperimentalArtifactYaml(a123_0xbdc0df[_0x339701(0xe9)](_0x14a97f,_0x339701(0x164)),_0x14a97f),_0x10be6c=a123_0xbdc0df[_0x339701(0xe9)](_0x414912,'utf-8'),_0x3bdaeb=[];if(a123_0xbdc0df['existsSync'](_0x3d9509)){const _0x255427=a123_0xbdc0df['readdirSync'](_0x3d9509);for(const _0x15733e of _0x255427){const _0x216343=a123_0xe6e455[_0x339701(0xfd)](_0x3d9509,_0x15733e);a123_0xbdc0df[_0x339701(0xdd)](_0x216343)[_0x339701(0x119)]()&&_0x3bdaeb['push']({'file_name':_0x15733e,'text_content':a123_0xbdc0df[_0x339701(0xe9)](_0x216343,_0x339701(0x164))});}}const _0x322dcf={..._0x507e0f,'code':_0x10be6c,'files':_0x3bdaeb};_0x7f36bd['push']({'name':_0x507e0f['name'],'dir':_0x159b8c,'def':_0x322dcf});}}const _0x3ac46e=await this[_0x339701(0x147)]['listAgentsFull'](_0x15f1ee),_0x71f371=await this[_0x339701(0x147)][_0x339701(0x135)](_0x15f1ee),_0x219f91=await this[_0x339701(0x147)][_0x339701(0x154)](_0x15f1ee),_0x2cc4f6=await this['client']['listPrompts'](_0x15f1ee),_0x2cca72=await this[_0x339701(0x147)][_0x339701(0xca)](_0x15f1ee),_0x5e2f5a=await safeListOrEmpty(()=>this[_0x339701(0x147)][_0x339701(0xc2)](_0x15f1ee)),_0x35f153=await safeListOrEmpty(()=>this['client']['listExperimentalArtifacts'](_0x15f1ee)),_0x5ea31f=await fetchAllToolTargetMaps((_0x4358ac,_0x6ea999)=>this['client'][_0x339701(0xe4)](_0x4358ac,_0x6ea999),_0x15f1ee),_0x16f481=new Map(),_0x395e6b=new Map(),_0x32109e=new Map(),_0x2c1e56=new Map(),_0x434b4a=new Map(),_0x27d9aa=new Map(),_0x4a4a1c=new Map();for(const _0x454dbb of _0x3ac46e){_0x16f481[_0x339701(0x19b)](_0x454dbb[_0x339701(0xfb)][_0x339701(0xd9)],_0x454dbb);}for(const _0x288422 of _0x71f371){_0x395e6b[_0x339701(0x19b)](_0x288422['attributes'][_0x339701(0xd9)],_0x288422);}for(const _0x3702c1 of _0x219f91){_0x32109e[_0x339701(0x19b)](_0x3702c1[_0x339701(0xfb)][_0x339701(0xd9)],_0x3702c1);}for(const _0x5aaad0 of _0x2cc4f6){_0x2c1e56[_0x339701(0x19b)](_0x5aaad0[_0x339701(0xfb)][_0x339701(0xd9)],_0x5aaad0);}for(const _0x234311 of _0x2cca72){_0x434b4a[_0x339701(0x19b)](_0x234311[_0x339701(0xfb)][_0x339701(0x17f)][_0x339701(0x18d)](),_0x234311);}for(const _0x29005b of _0x5e2f5a){_0x27d9aa[_0x339701(0x19b)](_0x29005b[_0x339701(0xfb)][_0x339701(0xd9)],_0x29005b);}for(const _0x2efee8 of _0x35f153){_0x4a4a1c['set'](_0x2efee8[_0x339701(0xfb)][_0x339701(0xd9)],_0x2efee8);}const _0x582a36=new Map(),_0x461eba=new Map();for(const _0xca49a7 of _0x3ac46e){_0x582a36[_0x339701(0x19b)](_0xca49a7[_0x339701(0xfb)]['name'],_0xca49a7['id']),_0x461eba['set'](_0xca49a7['id'],_0xca49a7['attributes'][_0x339701(0xd9)]);}const _0x5be9fa=new Map(),_0x391778=new Map();for(const _0x5f4ee5 of _0x2cc4f6){_0x5be9fa[_0x339701(0x19b)](_0x5f4ee5[_0x339701(0xfb)][_0x339701(0xd9)],_0x5f4ee5['id']),_0x391778['set'](_0x5f4ee5['id'],_0x5f4ee5[_0x339701(0xfb)][_0x339701(0xd9)]);}const _0x4490a4=_0x5ea31f[_0x339701(0xb6)][_0x339701(0x193)]||new Map(),_0x1f3b8e=_0x5ea31f['nameToId'][_0x339701(0x10a)]||new Map(),_0x5b4c3a=_0x5ea31f['nameToId']['ExperimentalKnowledgeBase']||new Map(),_0x2c126d=new Map(),_0x23de3e={'resolveToolTargetName':buildNameResolver({..._0x5ea31f[_0x339701(0x179)],'Agent':_0x461eba}),'resolvePromptName':async _0x26a4c2=>_0x391778[_0x339701(0x174)](_0x26a4c2),'onWarning':_0x4a0b26=>this[_0x339701(0xff)][_0x339701(0x13b)](_0x4a0b26)};let _0xe34015=[];const _0x4ece={'projectId':_0x15f1ee,'resolveToolTargetId':buildIdResolver({..._0x5ea31f[_0x339701(0xb6)],'Agent':_0x582a36}),'resolvePromptId':async _0x34088e=>_0x5be9fa[_0x339701(0x174)](_0x34088e),'onWarning':_0x4a2266=>{const _0x238c4f=_0x339701;this[_0x238c4f(0xff)]['warn'](_0x4a2266),_0xe34015['push'](_0x4a2266);}},{resolved:_0x16610d,unresolved:_0x15fcdd}=resolveAgentDependencies(_0x39961d,new Set(_0x16f481['keys']()));for(const {agent:_0x5a2161,missingDeps:_0xb5e05}of _0x15fcdd){_0x38f469['agents'][_0x339701(0x109)]({'agentName':_0x5a2161[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x156),'error':_0x339701(0xb2)+_0xb5e05['join'](',\x20')+_0x339701(0xe1)}),_0x38f469[_0x339701(0x166)][_0x339701(0x13a)]['errors']++;}for(const _0x31c2a6 of _0x5add69){const _0x37d3dc=_0x395e6b[_0x339701(0x174)](_0x31c2a6[_0x339701(0x1c5)][_0x339701(0xd9)]),_0x272975=a123_0xbdc0df[_0x339701(0xe9)](_0x31c2a6['path'],_0x339701(0x164));if(_0x37d3dc){const _0x5e2e60=apiKnowledgeBaseToYaml(_0x37d3dc),_0x21d66f=toKnowledgeBaseYamlString(_0x5e2e60),_0x33b319=generateDiff(_0x21d66f,_0x272975),_0x6debfc=hasChanges(_0x33b319);_0x6debfc?(_0x38f469[_0x339701(0x138)][_0x339701(0x109)]({'name':_0x31c2a6[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x12a),'id':_0x37d3dc['id'],'diff':formatDiffWithColors(_0x33b319)}),_0x38f469[_0x339701(0x166)][_0x339701(0x138)][_0x339701(0x12a)]++):(_0x38f469[_0x339701(0x138)][_0x339701(0x109)]({'name':_0x31c2a6[_0x339701(0x1c5)]['name'],'action':_0x339701(0x1bf),'id':_0x37d3dc['id']}),_0x38f469['counts'][_0x339701(0x138)][_0x339701(0x1bf)]++);}else _0x38f469[_0x339701(0x138)][_0x339701(0x109)]({'name':_0x31c2a6[_0x339701(0x1c5)][_0x339701(0xd9)],'action':'created'}),_0x38f469[_0x339701(0x166)][_0x339701(0x138)]['created']++;}for(const _0x376558 of _0x1d4e9c){const _0x5093d9=_0x32109e[_0x339701(0x174)](_0x376558[_0x339701(0xd9)]),_0x46b990=a123_0xbdc0df[_0x339701(0xe9)](_0x376558[_0x339701(0xeb)],'utf-8');if(_0x5093d9){const _0x2fba52=toTextKnowledgeBaseMd(_0x5093d9[_0x339701(0xfb)]['name'],_0x5093d9['attributes']['text']),_0x504d90=generateDiff(_0x2fba52,_0x46b990),_0x2154d5=hasChanges(_0x504d90);_0x2154d5?(_0x38f469[_0x339701(0x172)][_0x339701(0x109)]({'name':_0x376558[_0x339701(0xd9)],'action':_0x339701(0x12a),'id':_0x5093d9['id'],'diff':formatDiffWithColors(_0x504d90)}),_0x38f469[_0x339701(0x166)][_0x339701(0x172)][_0x339701(0x12a)]++):(_0x38f469['textKnowledgeBases'][_0x339701(0x109)]({'name':_0x376558[_0x339701(0xd9)],'action':'unchanged','id':_0x5093d9['id']}),_0x38f469['counts'][_0x339701(0x172)]['unchanged']++);}else _0x38f469[_0x339701(0x172)]['push']({'name':_0x376558[_0x339701(0xd9)],'action':'created'}),_0x38f469[_0x339701(0x166)][_0x339701(0x172)][_0x339701(0x12e)]++;}for(const _0x349f01 of _0x16610d){const _0x3ca56f=_0x16f481[_0x339701(0x174)](_0x349f01[_0x339701(0x1c5)][_0x339701(0xd9)]),_0xfc78b6=a123_0xe6e455['join'](_0x349f01[_0x339701(0x106)],_0x339701(0x121)),_0x49699e=a123_0xbdc0df['readFileSync'](_0xfc78b6,'utf-8'),_0x13e2c0=_0x349f01[_0x339701(0x132)],_0x114cc8=_0x339701(0x1ae)+_0x13e2c0+_0x339701(0xee)+_0x49699e;if(_0x3ca56f){const {yaml:_0x5744d5,systemPrompt:_0x322d6e}=await agentResponseToDef(_0x3ca56f,_0x23de3e),_0x2059aa=toAgentYamlString(_0x5744d5),_0x112f32=_0x339701(0x1ae)+_0x322d6e+'\x0a\x0a#\x20agent.yml\x0a'+_0x2059aa,_0x814989=generateDiff(_0x112f32,_0x114cc8),_0x15f0ba=hasChanges(_0x814989);_0x15f0ba?(_0x38f469[_0x339701(0x13a)][_0x339701(0x109)]({'agentName':_0x349f01[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x12a),'agentId':_0x3ca56f['id'],'diff':formatDiffWithColors(_0x814989)}),_0x38f469[_0x339701(0x166)]['agents'][_0x339701(0x12a)]++):(_0x38f469['agents'][_0x339701(0x109)]({'agentName':_0x349f01[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x1bf),'agentId':_0x3ca56f['id']}),_0x38f469['counts'][_0x339701(0x13a)]['unchanged']++);}else _0x38f469[_0x339701(0x13a)][_0x339701(0x109)]({'agentName':_0x349f01['yaml'][_0x339701(0xd9)],'action':'created'}),_0x38f469[_0x339701(0x166)][_0x339701(0x13a)]['created']++;}for(const _0x416184 of _0x28ca99){const _0x28db90=_0x2c1e56['get'](_0x416184[_0x339701(0x1c5)]['name']),_0x5ce76d=a123_0xbdc0df[_0x339701(0xe9)](_0x416184[_0x339701(0xeb)],_0x339701(0x164));if(_0x28db90){const _0x31ba56=await apiPromptToYaml(_0x28db90,_0x23de3e);if(!_0x31ba56){_0x38f469['prompts']['push']({'name':_0x416184['yaml']['name'],'action':_0x339701(0x12a),'id':_0x28db90['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0xfc)][_0x339701(0x12a)]++;continue;}const _0x30f822=toPromptYamlString(_0x31ba56),_0x2b310c=generateDiff(_0x30f822,_0x5ce76d),_0x3f5af9=hasChanges(_0x2b310c);_0x3f5af9?(_0x38f469[_0x339701(0xfc)][_0x339701(0x109)]({'name':_0x416184['yaml'][_0x339701(0xd9)],'action':'updated','id':_0x28db90['id'],'diff':formatDiffWithColors(_0x2b310c)}),_0x38f469[_0x339701(0x166)][_0x339701(0xfc)][_0x339701(0x12a)]++):(_0x38f469['prompts']['push']({'name':_0x416184['yaml'][_0x339701(0xd9)],'action':_0x339701(0x1bf),'id':_0x28db90['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0xfc)][_0x339701(0x1bf)]++);}else _0x38f469['prompts']['push']({'name':_0x416184['yaml'][_0x339701(0xd9)],'action':_0x339701(0x12e)}),_0x38f469[_0x339701(0x166)]['prompts'][_0x339701(0x12e)]++;}for(const _0x51eb27 of _0x4a89dd){const _0xdefba3=_0x434b4a['get'](_0x51eb27[_0x339701(0x1c5)][_0x339701(0xb1)]),_0xc78618=a123_0xbdc0df[_0x339701(0xe9)](_0x51eb27[_0x339701(0xeb)],'utf-8');if(_0xdefba3){const _0x56b76b=await apiIntegrationToYaml(_0xdefba3,_0x23de3e),_0x468584=toIntegrationYamlString(_0x56b76b),_0x216067=generateDiff(_0x468584,_0xc78618),_0x2b43b4=hasChanges(_0x216067);_0x2b43b4?(_0x38f469['integrations']['push']({'name':_0x51eb27[_0x339701(0x1c5)][_0x339701(0xb1)],'action':_0x339701(0x12a),'id':_0xdefba3['id'],'diff':formatDiffWithColors(_0x216067)}),_0x38f469['counts'][_0x339701(0xa8)][_0x339701(0x12a)]++):(_0x38f469[_0x339701(0xa8)][_0x339701(0x109)]({'name':_0x51eb27['yaml'][_0x339701(0xb1)],'action':_0x339701(0x1bf),'id':_0xdefba3['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0xa8)][_0x339701(0x1bf)]++);}else _0x38f469['integrations']['push']({'name':_0x51eb27['yaml'][_0x339701(0xb1)],'action':_0x339701(0x12e)}),_0x38f469[_0x339701(0x166)][_0x339701(0xa8)][_0x339701(0x12e)]++;}for(const _0x2a0ff8 of _0x568323){const _0x5b41bc=_0x27d9aa['get'](_0x2a0ff8[_0x339701(0x15b)][_0x339701(0xd9)]),_0x3f3bc8=toExperimentalKnowledgeBaseYamlString(_0x2a0ff8[_0x339701(0x15b)]);let _0x114ee5=_0x3f3bc8;for(const _0x3650d5 of _0x2a0ff8[_0x339701(0x15b)][_0x339701(0x15d)]){_0x114ee5+='\x0a---\x20function:\x20'+_0x3650d5[_0x339701(0xd9)]+_0x339701(0x105)+_0x3650d5[_0x339701(0x155)]+_0x339701(0xa9)+_0x3650d5[_0x339701(0xd9)]+'\x20---\x0a'+_0x3650d5[_0x339701(0x1a2)]+'\x0a';}if(_0x5b41bc){const _0x4be41c=apiExperimentalKnowledgeBaseToYaml(_0x5b41bc),_0x2a3916=toExperimentalKnowledgeBaseYamlString(_0x4be41c);let _0x2eaf1f=_0x2a3916;for(const _0x4ef173 of _0x4be41c[_0x339701(0x15d)]){_0x2eaf1f+='\x0a---\x20function:\x20'+_0x4ef173[_0x339701(0xd9)]+_0x339701(0x105)+_0x4ef173['code']+_0x339701(0xa9)+_0x4ef173[_0x339701(0xd9)]+_0x339701(0x105)+_0x4ef173[_0x339701(0x1a2)]+'\x0a';}const _0x47deda=generateDiff(_0x2eaf1f,_0x114ee5),_0x2fd8d5=hasChanges(_0x47deda);_0x2fd8d5?(_0x38f469[_0x339701(0x1ab)]['push']({'name':_0x2a0ff8[_0x339701(0x15b)][_0x339701(0xd9)],'action':'updated','id':_0x5b41bc['id'],'diff':formatDiffWithColors(_0x47deda)}),_0x38f469['counts']['experimentalKnowledgeBases'][_0x339701(0x12a)]++):(_0x38f469[_0x339701(0x1ab)][_0x339701(0x109)]({'name':_0x2a0ff8[_0x339701(0x15b)]['name'],'action':_0x339701(0x1bf),'id':_0x5b41bc['id']}),_0x38f469['counts'][_0x339701(0x1ab)]['unchanged']++);}else _0x38f469[_0x339701(0x1ab)][_0x339701(0x109)]({'name':_0x2a0ff8[_0x339701(0x15b)][_0x339701(0xd9)],'action':_0x339701(0x12e)}),_0x38f469[_0x339701(0x166)][_0x339701(0x1ab)][_0x339701(0x12e)]++;}for(const _0x3a678e of _0x7f36bd){const _0x5273cc=_0x4a4a1c[_0x339701(0x174)](_0x3a678e[_0x339701(0x15b)][_0x339701(0xd9)]),_0x9482e9=toExperimentalArtifactYamlString(_0x3a678e[_0x339701(0x15b)]);let _0x28e498=_0x9482e9+('\x0a---\x20code\x20---\x0a'+_0x3a678e['def']['code']+'\x0a');for(const _0x5d6ef3 of _0x3a678e[_0x339701(0x15b)][_0x339701(0x19d)]){_0x28e498+=_0x339701(0xc7)+_0x5d6ef3['file_name']+_0x339701(0x105)+_0x5d6ef3['text_content']+'\x0a';}if(_0x5273cc){const _0x2df91a=apiExperimentalArtifactToYaml(_0x5273cc),_0x3621cd=toExperimentalArtifactYamlString(_0x2df91a);let _0x582cf4=_0x3621cd+(_0x339701(0x170)+_0x2df91a[_0x339701(0x155)]+'\x0a');for(const _0x58398d of _0x2df91a[_0x339701(0x19d)]){_0x582cf4+=_0x339701(0xc7)+_0x58398d[_0x339701(0xab)]+_0x339701(0x105)+_0x58398d[_0x339701(0x192)]+'\x0a';}const _0x4e53a2=generateDiff(_0x582cf4,_0x28e498),_0x10a462=hasChanges(_0x4e53a2);_0x10a462?(_0x38f469['experimentalArtifacts'][_0x339701(0x109)]({'name':_0x3a678e[_0x339701(0x15b)][_0x339701(0xd9)],'action':_0x339701(0x12a),'id':_0x5273cc['id'],'diff':formatDiffWithColors(_0x4e53a2)}),_0x38f469[_0x339701(0x166)][_0x339701(0xc0)][_0x339701(0x12a)]++):(_0x38f469['experimentalArtifacts'][_0x339701(0x109)]({'name':_0x3a678e[_0x339701(0x15b)][_0x339701(0xd9)],'action':'unchanged','id':_0x5273cc['id']}),_0x38f469['counts']['experimentalArtifacts'][_0x339701(0x1bf)]++);}else _0x38f469['experimentalArtifacts'][_0x339701(0x109)]({'name':_0x3a678e[_0x339701(0x15b)][_0x339701(0xd9)],'action':'created'}),_0x38f469[_0x339701(0x166)]['experimentalArtifacts']['created']++;}if(_0x48d7be?.[_0x339701(0x1aa)])return _0x38f469;_0x38f469['knowledgeBases']=[],_0x38f469[_0x339701(0x172)]=[],_0x38f469[_0x339701(0xfc)]=[],_0x38f469[_0x339701(0xa8)]=[],_0x38f469['experimentalKnowledgeBases']=[],_0x38f469[_0x339701(0xc0)]=[];const _0x26fbe0=_0x38f469[_0x339701(0x13a)][_0x339701(0x11b)](_0x928389=>_0x928389[_0x339701(0xec)]===_0x339701(0x156));_0x38f469[_0x339701(0x13a)]=_0x26fbe0,_0x38f469[_0x339701(0x166)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x26fbe0[_0x339701(0x1bc)]},'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},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x46275b of _0x5add69){try{const _0x554e74=_0x395e6b[_0x339701(0x174)](_0x46275b[_0x339701(0x1c5)][_0x339701(0xd9)]),_0x24d8ec=yamlKnowledgeBaseToApi(_0x46275b[_0x339701(0x1c5)],_0x15f1ee);if(_0x554e74)await this['client']['updateKnowledgeBase'](_0x554e74['id'],_0x24d8ec),_0x4490a4[_0x339701(0x19b)](_0x46275b[_0x339701(0x1c5)][_0x339701(0xd9)],_0x554e74['id']),_0x38f469[_0x339701(0x138)]['push']({'name':_0x46275b[_0x339701(0x1c5)][_0x339701(0xd9)],'action':'updated','id':_0x554e74['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0x138)]['updated']++;else{const _0x223370=await this[_0x339701(0x147)][_0x339701(0x1a1)](_0x24d8ec);_0x4490a4[_0x339701(0x19b)](_0x46275b['yaml'][_0x339701(0xd9)],_0x223370['id']),_0x38f469[_0x339701(0x138)][_0x339701(0x109)]({'name':_0x46275b[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x12e),'id':_0x223370['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0x138)][_0x339701(0x12e)]++;}}catch(_0x4f0434){_0x38f469[_0x339701(0x138)]['push']({'name':_0x46275b[_0x339701(0x1c5)][_0x339701(0xd9)],'action':'error','error':_0x4f0434[_0x339701(0x15a)]}),_0x38f469[_0x339701(0x166)][_0x339701(0x138)]['errors']++;}}for(const _0x2e6eec of _0x1d4e9c){try{const _0x21bd23=_0x32109e[_0x339701(0x174)](_0x2e6eec[_0x339701(0xd9)]),_0x195950=yamlTextKnowledgeBaseToApi({'name':_0x2e6eec[_0x339701(0xd9)],'text':_0x2e6eec[_0x339701(0xf8)]},_0x15f1ee);if(_0x21bd23)await this[_0x339701(0x147)][_0x339701(0x165)](_0x21bd23['id'],_0x195950),_0x1f3b8e['set'](_0x2e6eec[_0x339701(0xd9)],_0x21bd23['id']),_0x38f469[_0x339701(0x172)][_0x339701(0x109)]({'name':_0x2e6eec[_0x339701(0xd9)],'action':'updated','id':_0x21bd23['id']}),_0x38f469['counts'][_0x339701(0x172)][_0x339701(0x12a)]++;else{const _0x40bc87=await this['client'][_0x339701(0x1c0)](_0x195950);_0x1f3b8e[_0x339701(0x19b)](_0x2e6eec[_0x339701(0xd9)],_0x40bc87['id']),_0x38f469['textKnowledgeBases'][_0x339701(0x109)]({'name':_0x2e6eec[_0x339701(0xd9)],'action':_0x339701(0x12e),'id':_0x40bc87['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0x172)][_0x339701(0x12e)]++;}}catch(_0x3ea747){_0x38f469[_0x339701(0x172)][_0x339701(0x109)]({'name':_0x2e6eec[_0x339701(0xd9)],'action':_0x339701(0x156),'error':_0x3ea747[_0x339701(0x15a)]}),_0x38f469[_0x339701(0x166)][_0x339701(0x172)][_0x339701(0x153)]++;}}for(const _0x5d91ec of _0x568323){try{const _0x4c644a=_0x27d9aa[_0x339701(0x174)](_0x5d91ec[_0x339701(0x15b)]['name']),_0x3fa821=yamlExperimentalKnowledgeBaseToApi(_0x5d91ec[_0x339701(0x15b)],_0x15f1ee);if(_0x4c644a)await this['client'][_0x339701(0x130)](_0x4c644a['id'],_0x3fa821),_0x5b4c3a[_0x339701(0x19b)](_0x5d91ec['def'][_0x339701(0xd9)],_0x4c644a['id']),_0x38f469[_0x339701(0x1ab)][_0x339701(0x109)]({'name':_0x5d91ec[_0x339701(0x15b)]['name'],'action':_0x339701(0x12a),'id':_0x4c644a['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0x1ab)][_0x339701(0x12a)]++;else{const _0x523ca5=await this[_0x339701(0x147)][_0x339701(0x143)](_0x3fa821);_0x5b4c3a[_0x339701(0x19b)](_0x5d91ec['def'][_0x339701(0xd9)],_0x523ca5['id']),_0x38f469[_0x339701(0x1ab)][_0x339701(0x109)]({'name':_0x5d91ec[_0x339701(0x15b)][_0x339701(0xd9)],'action':'created','id':_0x523ca5['id']}),_0x38f469['counts'][_0x339701(0x1ab)][_0x339701(0x12e)]++;}}catch(_0xf6a6df){_0x38f469[_0x339701(0x1ab)][_0x339701(0x109)]({'name':_0x5d91ec['def'][_0x339701(0xd9)],'action':_0x339701(0x156),'error':_0xf6a6df[_0x339701(0x15a)]}),_0x38f469[_0x339701(0x166)]['experimentalKnowledgeBases'][_0x339701(0x153)]++;}}for(const _0x82844f of _0x7f36bd){try{const _0xa8af99=_0x4a4a1c[_0x339701(0x174)](_0x82844f[_0x339701(0x15b)]['name']),_0x432817=yamlExperimentalArtifactToApi(_0x82844f['def'],_0x15f1ee);if(_0xa8af99)await this[_0x339701(0x147)][_0x339701(0x1b5)](_0xa8af99['id'],_0x432817),_0x2c126d[_0x339701(0x19b)](_0x82844f['def'][_0x339701(0xd9)],_0xa8af99['id']),_0x38f469[_0x339701(0xc0)][_0x339701(0x109)]({'name':_0x82844f['def'][_0x339701(0xd9)],'action':_0x339701(0x12a),'id':_0xa8af99['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0xc0)][_0x339701(0x12a)]++;else{const _0x12ffe4=await this['client']['createExperimentalArtifact'](_0x432817);_0x2c126d[_0x339701(0x19b)](_0x82844f['def']['name'],_0x12ffe4['id']),_0x38f469[_0x339701(0xc0)]['push']({'name':_0x82844f[_0x339701(0x15b)][_0x339701(0xd9)],'action':'created','id':_0x12ffe4['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0xc0)][_0x339701(0x12e)]++;}}catch(_0xc62d2e){_0x38f469[_0x339701(0xc0)][_0x339701(0x109)]({'name':_0x82844f[_0x339701(0x15b)][_0x339701(0xd9)],'action':'error','error':_0xc62d2e['message']}),_0x38f469[_0x339701(0x166)][_0x339701(0xc0)]['errors']++;}}for(const _0x18fe8a of _0x16610d){_0xe34015=[];try{const _0x4a24b0=_0x16f481[_0x339701(0x174)](_0x18fe8a['yaml'][_0x339701(0xd9)]),_0x1411b6=await agentDefToRequest(_0x18fe8a['yaml'],_0x18fe8a['systemPrompt'],_0x18fe8a[_0x339701(0x14d)],_0x4ece);if(_0x4a24b0)await this[_0x339701(0x147)]['updateAgentResponse'](_0x4a24b0['id'],_0x1411b6),_0x582a36[_0x339701(0x19b)](_0x18fe8a[_0x339701(0x1c5)]['name'],_0x4a24b0['id']),_0x38f469['agents'][_0x339701(0x109)]({'agentName':_0x18fe8a[_0x339701(0x1c5)]['name'],'action':'updated','agentId':_0x4a24b0['id'],'warnings':_0xe34015['length']>0x0?_0xe34015:undefined}),_0x38f469[_0x339701(0x166)][_0x339701(0x13a)][_0x339701(0x12a)]++;else{const _0x11dfc6=await this[_0x339701(0x147)][_0x339701(0x19f)](_0x1411b6);_0x582a36[_0x339701(0x19b)](_0x18fe8a[_0x339701(0x1c5)][_0x339701(0xd9)],_0x11dfc6['id']),_0x38f469['agents'][_0x339701(0x109)]({'agentName':_0x18fe8a[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x12e),'agentId':_0x11dfc6['id'],'warnings':_0xe34015['length']>0x0?_0xe34015:undefined}),_0x38f469[_0x339701(0x166)][_0x339701(0x13a)]['created']++;}}catch(_0xc43b01){_0x38f469[_0x339701(0x13a)][_0x339701(0x109)]({'agentName':_0x18fe8a[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x156),'error':_0xc43b01[_0x339701(0x15a)],'warnings':_0xe34015['length']>0x0?_0xe34015:undefined}),_0x38f469[_0x339701(0x166)][_0x339701(0x13a)]['errors']++;}}for(const _0x109196 of _0x28ca99){try{const _0x4cf911=_0x2c1e56['get'](_0x109196[_0x339701(0x1c5)][_0x339701(0xd9)]),_0x32f80b=await yamlPromptToApi(_0x109196['yaml'],_0x15f1ee,_0x4ece);if(!_0x32f80b){_0x38f469['prompts']['push']({'name':_0x109196[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x156),'error':_0x339701(0x19c)}),_0x38f469[_0x339701(0x166)][_0x339701(0xfc)][_0x339701(0x153)]++;continue;}if(_0x4cf911)await this[_0x339701(0x147)][_0x339701(0xbb)](_0x4cf911['id'],_0x32f80b),_0x5be9fa['set'](_0x109196[_0x339701(0x1c5)][_0x339701(0xd9)],_0x4cf911['id']),_0x38f469['prompts'][_0x339701(0x109)]({'name':_0x109196['yaml']['name'],'action':'updated','id':_0x4cf911['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0xfc)][_0x339701(0x12a)]++;else{const _0x4f5553=await this[_0x339701(0x147)][_0x339701(0xf3)](_0x32f80b);_0x5be9fa[_0x339701(0x19b)](_0x109196[_0x339701(0x1c5)][_0x339701(0xd9)],_0x4f5553['id']),_0x38f469['prompts'][_0x339701(0x109)]({'name':_0x109196[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x12e),'id':_0x4f5553['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0xfc)][_0x339701(0x12e)]++;}}catch(_0x4991ad){_0x38f469[_0x339701(0xfc)][_0x339701(0x109)]({'name':_0x109196[_0x339701(0x1c5)][_0x339701(0xd9)],'action':'error','error':_0x4991ad[_0x339701(0x15a)]}),_0x38f469['counts'][_0x339701(0xfc)][_0x339701(0x153)]++;}}for(const _0x56b47b of _0x4a89dd){try{const _0x1c0aaf=_0x434b4a['get'](_0x56b47b[_0x339701(0x1c5)][_0x339701(0xb1)]),_0x29ece1=await yamlIntegrationToApi(_0x56b47b[_0x339701(0x1c5)],_0x15f1ee,_0x4ece);if(_0x1c0aaf){await this[_0x339701(0x147)][_0x339701(0x1c2)](_0x1c0aaf['id']);const _0x5c03de=await this['client'][_0x339701(0xae)](_0x29ece1);_0x38f469[_0x339701(0xa8)]['push']({'name':_0x56b47b['yaml']['service_type'],'action':_0x339701(0x12a),'id':_0x5c03de['id']}),_0x38f469['counts'][_0x339701(0xa8)][_0x339701(0x12a)]++;}else{const _0x271672=await this['client'][_0x339701(0xae)](_0x29ece1);_0x38f469['integrations'][_0x339701(0x109)]({'name':_0x56b47b[_0x339701(0x1c5)][_0x339701(0xb1)],'action':_0x339701(0x12e),'id':_0x271672['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0xa8)]['created']++;}}catch(_0x3f153b){_0x38f469[_0x339701(0xa8)]['push']({'name':_0x56b47b['yaml'][_0x339701(0xb1)],'action':_0x339701(0x156),'error':_0x3f153b[_0x339701(0x15a)]}),_0x38f469[_0x339701(0x166)][_0x339701(0xa8)][_0x339701(0x153)]++;}}return _0x38f469;}async[a123_0x44cb81(0x11e)](_0x14164d,_0x422cf2,_0x2c5b8e,_0x35ec6d){const _0x32feba=a123_0x44cb81,{projectId:_0x575957,project:_0x2e1348}=await this['resolveProjectName'](_0x14164d),_0x270426=_0x2e1348[_0x32feba(0xfb)][_0x32feba(0xd9)],_0x433c48=await this[_0x32feba(0x147)][_0x32feba(0x173)](_0x575957),_0x125ba6=_0x433c48[_0x32feba(0x157)](_0x7235d7=>_0x7235d7['attributes']['name']===_0x422cf2);if(!_0x125ba6)throw new SDKError(ErrorCode[_0x32feba(0x12f)],_0x32feba(0xd6)+_0x422cf2,undefined,{'helpText':_0x32feba(0x18b)+_0x433c48[_0x32feba(0xf1)](_0x45dd6f=>_0x45dd6f['attributes'][_0x32feba(0xd9)])[_0x32feba(0xfd)](',\x20')});let _0x2dbf02;if(_0x2c5b8e)_0x2dbf02=_0x2c5b8e;else{const _0xd8ddec=a123_0xe6e455[_0x32feba(0xfd)](process[_0x32feba(0xce)](),_0x32feba(0x13a)),_0x2ee09e=getSanitizedPathWithMigration(_0xd8ddec,_0x270426);_0x2ee09e[_0x32feba(0x11c)]&&this[_0x32feba(0xff)]['info'](_0x32feba(0xaf)+a123_0xe6e455['basename'](_0x2ee09e[_0x32feba(0x16b)])+'\x20→\x20'+a123_0xe6e455[_0x32feba(0x125)](_0x2ee09e[_0x32feba(0xeb)])),_0x2dbf02=_0x2ee09e[_0x32feba(0xeb)];}const _0x2bba8e=getSanitizedPathWithMigration(_0x2dbf02,_0x422cf2);_0x2bba8e[_0x32feba(0x11c)]&&this[_0x32feba(0xff)][_0x32feba(0x11d)](_0x32feba(0x1a9)+a123_0xe6e455[_0x32feba(0x125)](_0x2bba8e['oldPath'])+_0x32feba(0xf5)+a123_0xe6e455['basename'](_0x2bba8e[_0x32feba(0xeb)]));const _0x152ed0=_0x2bba8e['path'],_0x4a4cdd=new Map(),_0x2246a3=new Map(),_0x380d88=await this[_0x32feba(0x147)][_0x32feba(0x135)](_0x575957),_0x1538d3=await this[_0x32feba(0x147)][_0x32feba(0x154)](_0x575957),_0x2346c5=await safeListOrEmpty(()=>this[_0x32feba(0x147)]['listExperimentalKnowledgeBases'](_0x575957)),_0x3e26f3=new Map(),_0x2bacbf=new Map();for(const _0x5a7ec3 of _0x380d88){_0x4a4cdd[_0x32feba(0x19b)](_0x5a7ec3['id'],_0x5a7ec3[_0x32feba(0xfb)]['name']);}for(const _0x54a606 of _0x1538d3){_0x3e26f3['set'](_0x54a606['id'],_0x54a606['attributes'][_0x32feba(0xd9)]);}for(const _0x4bc102 of _0x2346c5){_0x2bacbf[_0x32feba(0x19b)](_0x4bc102['id'],_0x4bc102[_0x32feba(0xfb)][_0x32feba(0xd9)]);}for(const _0x3ea198 of _0x433c48){_0x2246a3['set'](_0x3ea198['id'],_0x3ea198['attributes'][_0x32feba(0xd9)]);}const _0x24a456={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x4a4cdd,'TextKnowledgeBase':_0x3e26f3,'Agent':_0x2246a3,'ExperimentalKnowledgeBase':_0x2bacbf}),'resolvePromptName':async()=>undefined,'onWarning':_0x47c002=>this[_0x32feba(0xff)][_0x32feba(0x13b)](_0x47c002)},_0xfed664=a123_0xe6e455[_0x32feba(0xfd)](_0x152ed0,_0x32feba(0xdb)),_0x4a5649=a123_0xe6e455['join'](_0x152ed0,_0x32feba(0x121)),_0x49e20b=a123_0xe6e455[_0x32feba(0xfd)](_0x152ed0,_0x32feba(0xa6)),_0x1827b3=!a123_0xbdc0df['existsSync'](_0x4a5649);if(_0x35ec6d?.[_0x32feba(0x1aa)])return{'agentName':_0x422cf2,'outputPath':_0x152ed0,'isNew':_0x1827b3,'hasChanges':!![]};a123_0xbdc0df[_0x32feba(0xe2)](_0x2dbf02,{'recursive':!![]}),a123_0xbdc0df[_0x32feba(0xe2)](_0x152ed0,{'recursive':!![]});const _0x17f2f8=a123_0xe6e455[_0x32feba(0xfd)](_0x2dbf02,_0x32feba(0xc4));!a123_0xbdc0df[_0x32feba(0x10d)](_0x17f2f8)&&a123_0xbdc0df['writeFileSync'](_0x17f2f8,createAgentConfigContent(_0x14164d));const {yaml:_0x59aeb6,systemPrompt:_0x4e0fba,starterMessage:_0x397940}=await agentResponseToDef(_0x125ba6,_0x24a456);let _0x380d62=_0x1827b3;if(!_0x1827b3){const _0x36f52d=a123_0xbdc0df['existsSync'](_0xfed664)?a123_0xbdc0df[_0x32feba(0xe9)](_0xfed664,_0x32feba(0x164)):'',_0x3f354b=a123_0xbdc0df['readFileSync'](_0x4a5649,_0x32feba(0x164));_0x380d62=_0x36f52d!==_0x4e0fba||_0x3f354b!==toAgentYamlString(_0x59aeb6);}a123_0xbdc0df[_0x32feba(0x169)](_0xfed664,_0x4e0fba),a123_0xbdc0df[_0x32feba(0x169)](_0x4a5649,toAgentYamlString(_0x59aeb6));if(_0x397940&&_0x397940[_0x32feba(0x160)]('\x0a'))a123_0xbdc0df['writeFileSync'](_0x49e20b,_0x397940);else a123_0xbdc0df[_0x32feba(0x10d)](_0x49e20b)&&a123_0xbdc0df['unlinkSync'](_0x49e20b);return{'agentName':_0x422cf2,'outputPath':_0x152ed0,'isNew':_0x1827b3,'hasChanges':_0x380d62};}async[a123_0x44cb81(0x134)](_0x5d84e6,_0x160bee){const _0x6695eb=a123_0x44cb81;let _0x34988b;isAgentYamlPath(_0x5d84e6)?_0x34988b=getAgentDirFromYamlPath(_0x5d84e6):_0x34988b=_0x5d84e6;const {config:_0x297d53}=findAgentConfig(_0x34988b),_0x54f3ad=await this[_0x6695eb(0xf4)](_0x297d53[_0x6695eb(0xba)]),_0x28b40f=a123_0xe6e455[_0x6695eb(0xfd)](_0x34988b,_0x6695eb(0x121)),_0x1c501a=a123_0xe6e455[_0x6695eb(0xfd)](_0x34988b,_0x6695eb(0xdb)),_0x4a1fb4=a123_0xe6e455[_0x6695eb(0xfd)](_0x34988b,_0x6695eb(0xa6));if(!a123_0xbdc0df[_0x6695eb(0x10d)](_0x28b40f))throw new SDKError(ErrorCode[_0x6695eb(0xc6)],_0x6695eb(0x181)+_0x34988b,undefined,{'helpText':_0x6695eb(0x1bd)});const _0x1feda0=parseAgentYaml(a123_0xbdc0df[_0x6695eb(0xe9)](_0x28b40f,_0x6695eb(0x164)),_0x28b40f),_0x4b150d=a123_0xbdc0df[_0x6695eb(0x10d)](_0x1c501a)?a123_0xbdc0df[_0x6695eb(0xe9)](_0x1c501a,_0x6695eb(0x164)):'',_0x2c238c=a123_0xbdc0df['existsSync'](_0x4a1fb4)?a123_0xbdc0df[_0x6695eb(0xe9)](_0x4a1fb4,_0x6695eb(0x164)):_0x1feda0[_0x6695eb(0x177)];if(_0x160bee?.[_0x6695eb(0x1aa)])return{'agentName':_0x1feda0[_0x6695eb(0xd9)],'action':_0x6695eb(0x12e),'projectId':_0x54f3ad};const _0x515669=await this['client']['listAgentsFull'](_0x54f3ad),_0x19a732=await fetchAllToolTargetMaps((_0x3b2bc3,_0x47e076)=>this[_0x6695eb(0x147)][_0x6695eb(0xe4)](_0x3b2bc3,_0x47e076),_0x54f3ad),_0x297d8c=new Map();for(const _0x20ce7b of _0x515669){_0x297d8c['set'](_0x20ce7b[_0x6695eb(0xfb)][_0x6695eb(0xd9)],_0x20ce7b['id']);}const _0x1646d5=[],_0x29233d={'projectId':_0x54f3ad,'resolveToolTargetId':buildIdResolver({..._0x19a732[_0x6695eb(0xb6)],'Agent':_0x297d8c}),'resolvePromptId':async()=>undefined,'onWarning':_0xc81a9c=>{const _0x3ff735=_0x6695eb;this['logger'][_0x3ff735(0x13b)](_0xc81a9c),_0x1646d5[_0x3ff735(0x109)](_0xc81a9c);}};try{const _0x272d3c=_0x515669[_0x6695eb(0x157)](_0x103908=>_0x103908[_0x6695eb(0xfb)][_0x6695eb(0xd9)]===_0x1feda0[_0x6695eb(0xd9)]),_0xbf41dd=await agentDefToRequest(_0x1feda0,_0x4b150d,_0x2c238c,_0x29233d);if(_0x272d3c)return await this[_0x6695eb(0x147)]['updateAgentResponse'](_0x272d3c['id'],_0xbf41dd),{'agentName':_0x1feda0[_0x6695eb(0xd9)],'action':'updated','projectId':_0x54f3ad,'agentId':_0x272d3c['id'],'warnings':_0x1646d5[_0x6695eb(0x1bc)]>0x0?_0x1646d5:undefined};else{const _0x4914dd=await this[_0x6695eb(0x147)]['createAgentResponse'](_0xbf41dd);return{'agentName':_0x1feda0[_0x6695eb(0xd9)],'action':'created','projectId':_0x54f3ad,'agentId':_0x4914dd['id'],'warnings':_0x1646d5[_0x6695eb(0x1bc)]>0x0?_0x1646d5:undefined};}}catch(_0x3bf5e1){return{'agentName':_0x1feda0[_0x6695eb(0xd9)],'action':'error','projectId':_0x54f3ad,'error':_0x3bf5e1['message'],'warnings':_0x1646d5[_0x6695eb(0x1bc)]>0x0?_0x1646d5:undefined};}}async[a123_0x44cb81(0x1ac)](_0x18d74f,_0x42a5ba,_0x32db7a){const _0x44fa74=a123_0x44cb81,_0x2fd17d=a123_0xbdc0df[_0x44fa74(0x10d)](_0x18d74f)&&a123_0xbdc0df['existsSync'](a123_0xe6e455['join'](_0x18d74f,_0x44fa74(0xc4)));let _0x24602c;const _0x4550b5=[],_0x192b27=[],_0x47724d=[],_0x45a20a=[],_0x1e1bd4=[],_0x2348e1=[],_0x428d13=[];if(_0x2fd17d){const _0x26ad2c=loadAgentConfig(a123_0xe6e455[_0x44fa74(0xfd)](_0x18d74f,'tdx.json'));_0x24602c=_0x26ad2c[_0x44fa74(0xba)];const _0x4f5143=a123_0xbdc0df[_0x44fa74(0x19e)](_0x18d74f,{'withFileTypes':!![]});for(const _0x1f00f7 of _0x4f5143){if(!_0x1f00f7[_0x44fa74(0x141)]())continue;if([_0x44fa74(0x1c7),_0x44fa74(0x176),_0x44fa74(0x123),_0x44fa74(0xfc),_0x44fa74(0xa8)][_0x44fa74(0x160)](_0x1f00f7[_0x44fa74(0xd9)]))continue;const _0x2b2450=a123_0xe6e455[_0x44fa74(0xfd)](_0x18d74f,_0x1f00f7[_0x44fa74(0xd9)]);if(isAgentDir(_0x2b2450)){const _0x55e0e0=a123_0xe6e455[_0x44fa74(0xfd)](_0x2b2450,_0x44fa74(0x121)),_0x304bb9=a123_0xe6e455[_0x44fa74(0xfd)](_0x2b2450,_0x44fa74(0xdb)),_0x1b0754=a123_0xe6e455[_0x44fa74(0xfd)](_0x2b2450,_0x44fa74(0xa6)),_0x1095c9=parseAgentYaml(a123_0xbdc0df[_0x44fa74(0xe9)](_0x55e0e0,_0x44fa74(0x164)),_0x55e0e0),_0x448bec=a123_0xbdc0df[_0x44fa74(0x10d)](_0x304bb9)?a123_0xbdc0df['readFileSync'](_0x304bb9,_0x44fa74(0x164)):'',_0x2df408=a123_0xbdc0df['existsSync'](_0x1b0754)?a123_0xbdc0df['readFileSync'](_0x1b0754,_0x44fa74(0x164)):_0x1095c9[_0x44fa74(0x177)];_0x4550b5[_0x44fa74(0x109)]({'name':_0x1095c9[_0x44fa74(0xd9)],'dir':_0x2b2450,'yaml':_0x1095c9,'systemPrompt':_0x448bec,'starterMessage':_0x2df408});}}const _0x3a9967=getKnowledgeBasesDir(_0x18d74f);if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x3a9967)){const _0x206d1b=a123_0xbdc0df['readdirSync'](_0x3a9967);for(const _0x5cfbcf of _0x206d1b){const _0x3d4e83=a123_0xe6e455[_0x44fa74(0xfd)](_0x3a9967,_0x5cfbcf);if(_0x5cfbcf['endsWith'](_0x44fa74(0x1ce))){const _0x5df75c=parseKnowledgeBaseYaml(a123_0xbdc0df['readFileSync'](_0x3d4e83,_0x44fa74(0x164)),_0x3d4e83);_0x192b27['push']({'name':_0x5df75c[_0x44fa74(0xd9)],'path':_0x3d4e83,'yaml':_0x5df75c});}else{if(_0x5cfbcf[_0x44fa74(0x1b7)](_0x44fa74(0xfe))){const _0x4c0ded=a123_0xbdc0df[_0x44fa74(0xe9)](_0x3d4e83,'utf-8'),{name:_0x3c2b9f,text:_0x311fba}=parseTextKnowledgeBaseMd(_0x4c0ded,_0x5cfbcf);_0x47724d['push']({'name':_0x3c2b9f,'path':_0x3d4e83,'text':_0x311fba});}}}}const _0x4232a3=getPromptsDir(_0x18d74f);if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x4232a3)){const _0xe64b1c=a123_0xbdc0df[_0x44fa74(0x19e)](_0x4232a3)[_0x44fa74(0x11b)](_0x35728a=>_0x35728a[_0x44fa74(0x1b7)](_0x44fa74(0x1ce)));for(const _0x59b4b7 of _0xe64b1c){const _0x5682ec=a123_0xe6e455[_0x44fa74(0xfd)](_0x4232a3,_0x59b4b7),_0x25e7d2=parsePromptYaml(a123_0xbdc0df['readFileSync'](_0x5682ec,_0x44fa74(0x164)),_0x5682ec);_0x45a20a[_0x44fa74(0x109)]({'name':_0x25e7d2['name'],'path':_0x5682ec,'yaml':_0x25e7d2});}}const _0x43a1f6=getIntegrationsDir(_0x18d74f);if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x43a1f6)){const _0x3c3d5e=a123_0xbdc0df[_0x44fa74(0x19e)](_0x43a1f6)[_0x44fa74(0x11b)](_0x5c6c44=>_0x5c6c44[_0x44fa74(0x1b7)](_0x44fa74(0x1ce)));for(const _0x196f24 of _0x3c3d5e){const _0x2375fa=a123_0xe6e455[_0x44fa74(0xfd)](_0x43a1f6,_0x196f24),_0x78c0ef=parseIntegrationYaml(a123_0xbdc0df[_0x44fa74(0xe9)](_0x2375fa,'utf-8'),_0x2375fa);SAFE_INTEGRATION_TYPES['includes'](_0x78c0ef[_0x44fa74(0xb1)][_0x44fa74(0x18d)]())?_0x1e1bd4['push']({'name':_0x78c0ef['name'],'path':_0x2375fa,'yaml':_0x78c0ef}):this['logger'][_0x44fa74(0x13b)]('Skipping\x20integration\x20\x27'+_0x78c0ef[_0x44fa74(0xd9)]+_0x44fa74(0xf2)+_0x78c0ef[_0x44fa74(0xb1)]+_0x44fa74(0xd5)+(_0x44fa74(0xb8)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x44fa74(0x131)));}}const _0x1869cd=getExperimentalKnowledgeBasesDir(_0x18d74f);if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x1869cd)){const _0x140793=a123_0xbdc0df[_0x44fa74(0x19e)](_0x1869cd,{'withFileTypes':!![]});for(const _0xe41366 of _0x140793){if(!_0xe41366[_0x44fa74(0x141)]())continue;const _0x5c9eae=a123_0xe6e455['join'](_0x1869cd,_0xe41366[_0x44fa74(0xd9)]),_0x559757=a123_0xe6e455['join'](_0x5c9eae,_0xe41366[_0x44fa74(0xd9)]+_0x44fa74(0x1ce));if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x559757)){const _0x33ab39=parseExperimentalKnowledgeBaseYaml(a123_0xbdc0df[_0x44fa74(0xe9)](_0x559757,_0x44fa74(0x164)),_0x559757),_0x4d6faf=a123_0xe6e455[_0x44fa74(0xfd)](_0x5c9eae,_0x44fa74(0x15d)),_0xa3de2=[];if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x4d6faf)){const _0x3cd774=a123_0xbdc0df[_0x44fa74(0x19e)](_0x4d6faf,{'withFileTypes':!![]});for(const _0x1a1ca3 of _0x3cd774){if(!_0x1a1ca3['isDirectory']())continue;const _0x40b2b4=a123_0xe6e455['join'](_0x4d6faf,_0x1a1ca3[_0x44fa74(0xd9)]),_0x2b2cfe=a123_0xe6e455['join'](_0x40b2b4,'code.js'),_0x437d7d=a123_0xe6e455[_0x44fa74(0xfd)](_0x40b2b4,_0x44fa74(0xde));if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x2b2cfe)&&a123_0xbdc0df[_0x44fa74(0x10d)](_0x437d7d)){const _0x472297=a123_0xbdc0df[_0x44fa74(0xe9)](_0x2b2cfe,'utf-8'),_0x3dd3b8=a123_0xbdc0df[_0x44fa74(0xe9)](_0x437d7d,'utf-8');_0xa3de2['push']({'name':_0x1a1ca3['name'],'code':_0x472297,'json_schema':_0x3dd3b8});}}}const _0x5fb55a={..._0x33ab39,'functions':_0xa3de2};_0x2348e1[_0x44fa74(0x109)]({'name':_0x33ab39[_0x44fa74(0xd9)],'path':_0x5c9eae,'def':_0x5fb55a});}}}const _0x32638b=getExperimentalArtifactsDir(_0x18d74f);if(a123_0xbdc0df['existsSync'](_0x32638b)){const _0x1b082a=a123_0xbdc0df[_0x44fa74(0x19e)](_0x32638b,{'withFileTypes':!![]});for(const _0x66f19f of _0x1b082a){if(!_0x66f19f[_0x44fa74(0x141)]())continue;const _0x28a683=a123_0xe6e455['join'](_0x32638b,_0x66f19f[_0x44fa74(0xd9)]),_0x46bfa2=a123_0xe6e455[_0x44fa74(0xfd)](_0x28a683,_0x66f19f['name']+_0x44fa74(0x1ce));if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x46bfa2)){const _0x253101=parseExperimentalArtifactYaml(a123_0xbdc0df[_0x44fa74(0xe9)](_0x46bfa2,_0x44fa74(0x164)),_0x46bfa2),_0x413bec=a123_0xe6e455[_0x44fa74(0xfd)](_0x28a683,_0x44fa74(0xcc)),_0x20f4ec=a123_0xbdc0df[_0x44fa74(0x10d)](_0x413bec)?a123_0xbdc0df[_0x44fa74(0xe9)](_0x413bec,_0x44fa74(0x164)):'',_0x50671a=a123_0xe6e455[_0x44fa74(0xfd)](_0x28a683,_0x44fa74(0x19d)),_0x65ff03=[];if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x50671a)){const _0x1295b9=a123_0xbdc0df[_0x44fa74(0x19e)](_0x50671a);for(const _0x1886fc of _0x1295b9){const _0x513ac4=a123_0xe6e455[_0x44fa74(0xfd)](_0x50671a,_0x1886fc);if(a123_0xbdc0df[_0x44fa74(0xdd)](_0x513ac4)[_0x44fa74(0x119)]()){const _0xbf4902=a123_0xbdc0df[_0x44fa74(0xe9)](_0x513ac4,_0x44fa74(0x164));_0x65ff03[_0x44fa74(0x109)]({'file_name':_0x1886fc,'text_content':_0xbf4902});}}}const _0x3895ec={..._0x253101,'code':_0x20f4ec,'files':_0x65ff03};_0x428d13['push']({'name':_0x253101[_0x44fa74(0xd9)],'path':_0x28a683,'def':_0x3895ec});}}}}else{const _0x2f72ee=await this[_0x44fa74(0xf4)](_0x18d74f),_0x53f8fa=await this[_0x44fa74(0x147)]['getProject'](_0x2f72ee);_0x24602c=_0x53f8fa[_0x44fa74(0xfb)][_0x44fa74(0xd9)];const _0x249bb1=await this[_0x44fa74(0x147)][_0x44fa74(0x173)](_0x2f72ee),_0x419f7d=await this['client'][_0x44fa74(0x135)](_0x2f72ee),_0x57e594=await this[_0x44fa74(0x147)][_0x44fa74(0x154)](_0x2f72ee),_0x43f550=await this[_0x44fa74(0x147)]['listPrompts'](_0x2f72ee),_0x4c0368=await this['client'][_0x44fa74(0xca)](_0x2f72ee),_0x529566=await safeListOrEmpty(()=>this[_0x44fa74(0x147)][_0x44fa74(0xc2)](_0x2f72ee)),_0x1b5629=await safeListOrEmpty(()=>this[_0x44fa74(0x147)][_0x44fa74(0x194)](_0x2f72ee)),_0x37991d=new Map(),_0xa067aa=new Map(),_0x52bd00=new Map(),_0x2c6b7a=new Map(),_0x244f69=new Map(),_0x44fd8b=new Map();for(const _0x157df4 of _0x419f7d){_0x37991d['set'](_0x157df4['id'],_0x157df4['attributes']['name']);}for(const _0x5d49c4 of _0x57e594){_0xa067aa['set'](_0x5d49c4['id'],_0x5d49c4[_0x44fa74(0xfb)]['name']);}for(const _0x371921 of _0x249bb1){_0x52bd00['set'](_0x371921['id'],_0x371921['attributes'][_0x44fa74(0xd9)]);}for(const _0x2c71cc of _0x43f550){_0x2c6b7a['set'](_0x2c71cc['id'],_0x2c71cc[_0x44fa74(0xfb)][_0x44fa74(0xd9)]);}for(const _0x249de7 of _0x529566){_0x244f69[_0x44fa74(0x19b)](_0x249de7['id'],_0x249de7[_0x44fa74(0xfb)][_0x44fa74(0xd9)]);}for(const _0x3b6f10 of _0x1b5629){_0x44fd8b[_0x44fa74(0x19b)](_0x3b6f10['id'],_0x3b6f10[_0x44fa74(0xfb)][_0x44fa74(0xd9)]);}const _0x29dc15={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x37991d,'TextKnowledgeBase':_0xa067aa,'Agent':_0x52bd00,'ExperimentalKnowledgeBase':_0x244f69}),'resolvePromptName':async _0x52a71c=>_0x2c6b7a[_0x44fa74(0x174)](_0x52a71c),'onWarning':_0x18c9b=>this['logger'][_0x44fa74(0x13b)](_0x18c9b)};for(const _0x227528 of _0x249bb1){const _0x4623f6=await agentResponseToDef(_0x227528,_0x29dc15),{yaml:_0x78677d,systemPrompt:_0x5d9b3d,starterMessage:_0x12e77c}=_0x4623f6;_0x4550b5[_0x44fa74(0x109)]({'name':_0x78677d[_0x44fa74(0xd9)],'dir':'','yaml':_0x78677d,'systemPrompt':_0x5d9b3d,'starterMessage':_0x12e77c});}for(const _0x5d0f3a of _0x419f7d){const _0x406eb2=apiKnowledgeBaseToYaml(_0x5d0f3a);_0x192b27['push']({'name':_0x406eb2[_0x44fa74(0xd9)],'path':'','yaml':_0x406eb2});}for(const _0xbf87b2 of _0x57e594){_0x47724d[_0x44fa74(0x109)]({'name':_0xbf87b2[_0x44fa74(0xfb)][_0x44fa74(0xd9)],'path':'','text':_0xbf87b2['attributes']['text']});}for(const _0x104bdb of _0x43f550){const _0x3b8c8f=await apiPromptToYaml(_0x104bdb,_0x29dc15);_0x3b8c8f&&_0x45a20a[_0x44fa74(0x109)]({'name':_0x3b8c8f[_0x44fa74(0xd9)],'path':'','yaml':_0x3b8c8f});}for(const _0x3eb7d9 of _0x4c0368){if(!_0x3eb7d9[_0x44fa74(0xfb)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x44fa74(0x160)](_0x3eb7d9[_0x44fa74(0xfb)][_0x44fa74(0x17f)][_0x44fa74(0x18d)]())){const _0x47ee47=await apiIntegrationToYaml(_0x3eb7d9,_0x29dc15);_0x1e1bd4[_0x44fa74(0x109)]({'name':_0x3eb7d9['attributes'][_0x44fa74(0x17f)]['toLowerCase'](),'path':'','yaml':_0x47ee47});}}for(const _0xe2a006 of _0x529566){const _0x46f679=apiExperimentalKnowledgeBaseToYaml(_0xe2a006);_0x2348e1[_0x44fa74(0x109)]({'name':_0x46f679[_0x44fa74(0xd9)],'path':'','def':_0x46f679});}for(const _0x4238e3 of _0x1b5629){const _0x23d043=apiExperimentalArtifactToYaml(_0x4238e3);_0x428d13[_0x44fa74(0x109)]({'name':_0x23d043[_0x44fa74(0xd9)],'path':'','def':_0x23d043});}}const _0x5acc94={'sourceProjectName':_0x24602c,'newProjectName':_0x42a5ba,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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},'integrations':{'created':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x1510d9=await this[_0x44fa74(0x147)][_0x44fa74(0x14c)](),_0x394c17=_0x1510d9[_0x44fa74(0x157)](_0x3953a0=>_0x3953a0[_0x44fa74(0xfb)][_0x44fa74(0xd9)]===_0x42a5ba);if(_0x394c17)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x44fa74(0x111)+_0x42a5ba+_0x44fa74(0x12c),undefined,{'helpText':_0x44fa74(0xd0)});if(_0x32db7a?.[_0x44fa74(0x1aa)])return _0x5acc94['counts']['agents'][_0x44fa74(0x12e)]=_0x4550b5[_0x44fa74(0x1bc)],_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x138)][_0x44fa74(0x12e)]=_0x192b27[_0x44fa74(0x1bc)],_0x5acc94[_0x44fa74(0x166)]['textKnowledgeBases'][_0x44fa74(0x12e)]=_0x47724d[_0x44fa74(0x1bc)],_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x1ab)][_0x44fa74(0x12e)]=_0x2348e1['length'],_0x5acc94['counts']['experimentalArtifacts']['created']=_0x428d13[_0x44fa74(0x1bc)],_0x5acc94['counts'][_0x44fa74(0xfc)][_0x44fa74(0x12e)]=_0x45a20a[_0x44fa74(0x1bc)],_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0xa8)]['created']=_0x1e1bd4[_0x44fa74(0x1bc)],_0x5acc94;const _0x434e54=await this[_0x44fa74(0x147)][_0x44fa74(0x16d)]({'name':_0x42a5ba}),_0x18deb6=_0x434e54['id'];_0x5acc94['newProjectId']=_0x18deb6;const _0x2a3311=new Map(),_0x259067=new Map(),_0x2f8d1a=new Map(),_0x3eac33=new Map(),_0x57bc73=new Map(),_0x4c9524=new Map(),_0xa8b739=new Map(),_0x49da45=new Map(),_0x127088=new Set(),_0x2372fd=new Set();for(const _0x4b213c of _0x4550b5){for(const _0x37eb75 of _0x4b213c[_0x44fa74(0x1c5)][_0x44fa74(0x17d)]||[]){if(_0x37eb75[_0x44fa74(0x1b6)]===_0x44fa74(0x140)&&_0x37eb75[_0x44fa74(0x116)]){const _0x47d327=parseRef(_0x37eb75['target']);if(_0x47d327)_0x127088['add'](_0x47d327[_0x44fa74(0xd9)]);}else{if(_0x37eb75[_0x44fa74(0x1b6)]===_0x44fa74(0xad)&&_0x37eb75[_0x44fa74(0x116)]){const _0x485bb4=parseRef(_0x37eb75[_0x44fa74(0x116)]);if(_0x485bb4)_0x2372fd[_0x44fa74(0x124)](_0x485bb4['name']);}}}}for(const _0x7e63e8 of _0x127088){try{const _0x100b22=await this['client'][_0x44fa74(0xb5)]({'projectId':_0x18deb6,'name':_0x7e63e8});_0x57bc73[_0x44fa74(0x19b)](_0x7e63e8,_0x100b22['id']),_0x5acc94['imageGenerators'][_0x44fa74(0x109)]({'name':_0x7e63e8,'action':_0x44fa74(0x12e),'id':_0x100b22['id']}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x100)][_0x44fa74(0x12e)]++;}catch(_0x1753d6){_0x5acc94[_0x44fa74(0x100)][_0x44fa74(0x109)]({'name':_0x7e63e8,'action':_0x44fa74(0x156),'error':_0x1753d6['message']}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x100)][_0x44fa74(0x153)]++;}}for(const _0x3a6d5c of _0x2372fd){try{const _0x2bcc4c=await this[_0x44fa74(0x147)]['createWebSearchTool']({'projectId':_0x18deb6,'name':_0x3a6d5c});_0x4c9524['set'](_0x3a6d5c,_0x2bcc4c['id']),_0x5acc94['webSearchTools']['push']({'name':_0x3a6d5c,'action':_0x44fa74(0x12e),'id':_0x2bcc4c['id']}),_0x5acc94[_0x44fa74(0x166)]['webSearchTools']['created']++;}catch(_0x5763e0){_0x5acc94['webSearchTools']['push']({'name':_0x3a6d5c,'action':_0x44fa74(0x156),'error':_0x5763e0['message']}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x187)][_0x44fa74(0x153)]++;}}const _0x453c85=await fetchAllToolTargetMaps((_0x56f3f5,_0x37cccd)=>this[_0x44fa74(0x147)]['listToolTargets'](_0x56f3f5,_0x37cccd),_0x18deb6);let _0x3c3243=[];const _0x226871={'projectId':_0x18deb6,'resolveToolTargetId':buildIdResolver({..._0x453c85[_0x44fa74(0xb6)],'KnowledgeBase':_0x2a3311,'TextKnowledgeBase':_0x259067,'ExperimentalKnowledgeBase':_0xa8b739,'Agent':_0x2f8d1a,'WebSearchTool':_0x4c9524,'ImageGenerator':_0x57bc73}),'resolvePromptId':async _0x281d0b=>_0x3eac33[_0x44fa74(0x174)](_0x281d0b),'onWarning':_0x571432=>{const _0x4dc4a8=_0x44fa74;this[_0x4dc4a8(0xff)][_0x4dc4a8(0x13b)](_0x571432),_0x3c3243[_0x4dc4a8(0x109)](_0x571432);}};for(const _0x507c5e of _0x192b27){try{const _0x44d4e0=yamlKnowledgeBaseToApi(_0x507c5e[_0x44fa74(0x1c5)],_0x18deb6),_0x33f522=await this[_0x44fa74(0x147)][_0x44fa74(0x1a1)](_0x44d4e0);_0x2a3311[_0x44fa74(0x19b)](_0x507c5e[_0x44fa74(0x1c5)]['name'],_0x33f522['id']),_0x5acc94[_0x44fa74(0x138)][_0x44fa74(0x109)]({'name':_0x507c5e['yaml'][_0x44fa74(0xd9)],'action':_0x44fa74(0x12e),'id':_0x33f522['id']}),_0x5acc94['counts'][_0x44fa74(0x138)][_0x44fa74(0x12e)]++;}catch(_0x5cbe96){_0x5acc94['knowledgeBases'][_0x44fa74(0x109)]({'name':_0x507c5e[_0x44fa74(0x1c5)][_0x44fa74(0xd9)],'action':_0x44fa74(0x156),'error':_0x5cbe96[_0x44fa74(0x15a)]}),_0x5acc94[_0x44fa74(0x166)]['knowledgeBases'][_0x44fa74(0x153)]++;}}for(const _0x389039 of _0x47724d){try{const _0x39093d=yamlTextKnowledgeBaseToApi({'name':_0x389039[_0x44fa74(0xd9)],'text':_0x389039[_0x44fa74(0xf8)]},_0x18deb6),_0x416637=await this[_0x44fa74(0x147)][_0x44fa74(0x1c0)](_0x39093d);_0x259067[_0x44fa74(0x19b)](_0x389039['name'],_0x416637['id']),_0x5acc94[_0x44fa74(0x172)]['push']({'name':_0x389039[_0x44fa74(0xd9)],'action':'created','id':_0x416637['id']}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x172)][_0x44fa74(0x12e)]++;}catch(_0x125adc){_0x5acc94['textKnowledgeBases'][_0x44fa74(0x109)]({'name':_0x389039[_0x44fa74(0xd9)],'action':'error','error':_0x125adc[_0x44fa74(0x15a)]}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x172)][_0x44fa74(0x153)]++;}}for(const _0x1823a9 of _0x428d13){try{const _0x37e07e=yamlExperimentalArtifactToApi(_0x1823a9[_0x44fa74(0x15b)],_0x18deb6),_0x5163d1=await this[_0x44fa74(0x147)][_0x44fa74(0x161)](_0x37e07e);_0x49da45['set'](_0x1823a9['def'][_0x44fa74(0xd9)],_0x5163d1['id']),_0x5acc94['experimentalArtifacts'][_0x44fa74(0x109)]({'name':_0x1823a9[_0x44fa74(0x15b)][_0x44fa74(0xd9)],'action':'created','id':_0x5163d1['id']}),_0x5acc94['counts'][_0x44fa74(0xc0)][_0x44fa74(0x12e)]++;}catch(_0x26f7de){_0x5acc94[_0x44fa74(0xc0)][_0x44fa74(0x109)]({'name':_0x1823a9['def'][_0x44fa74(0xd9)],'action':'error','error':_0x26f7de[_0x44fa74(0x15a)]}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0xc0)][_0x44fa74(0x153)]++;}}for(const _0x339625 of _0x2348e1){try{const _0x2cd59f=yamlExperimentalKnowledgeBaseToApi(_0x339625[_0x44fa74(0x15b)],_0x18deb6),_0x3958ea=await this[_0x44fa74(0x147)][_0x44fa74(0x143)](_0x2cd59f);_0xa8b739['set'](_0x339625[_0x44fa74(0x15b)]['name'],_0x3958ea['id']),_0x5acc94[_0x44fa74(0x1ab)][_0x44fa74(0x109)]({'name':_0x339625['def'][_0x44fa74(0xd9)],'action':_0x44fa74(0x12e),'id':_0x3958ea['id']}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x1ab)][_0x44fa74(0x12e)]++;}catch(_0x5cddb4){_0x5acc94[_0x44fa74(0x1ab)][_0x44fa74(0x109)]({'name':_0x339625[_0x44fa74(0x15b)]['name'],'action':_0x44fa74(0x156),'error':_0x5cddb4[_0x44fa74(0x15a)]}),_0x5acc94[_0x44fa74(0x166)]['experimentalKnowledgeBases'][_0x44fa74(0x153)]++;}}const _0x442146=[..._0x4550b5][_0x44fa74(0x1ad)]((_0x4b6ce1,_0x1635ac)=>{const _0x5ee3da=_0x44fa74,_0x341357=_0x4b6ce1[_0x5ee3da(0x1c5)][_0x5ee3da(0x17d)]?.[_0x5ee3da(0xa7)](_0x129926=>_0x129926['type']===_0x5ee3da(0xd4))??![],_0x3d094d=_0x1635ac[_0x5ee3da(0x1c5)][_0x5ee3da(0x17d)]?.[_0x5ee3da(0xa7)](_0x5cbbfa=>_0x5cbbfa['type']==='agent')??![];if(_0x341357&&!_0x3d094d)return 0x1;if(!_0x341357&&_0x3d094d)return-0x1;return 0x0;});for(const _0x51c5f4 of _0x442146){_0x3c3243=[];try{const _0x4b54fa=_0x51c5f4[_0x44fa74(0x1c5)][_0x44fa74(0x17d)]?.[_0x44fa74(0x11b)](_0x50b6b9=>{const _0xc93000=_0x44fa74;if(_0x50b6b9['type']==='agent'&&_0x50b6b9[_0xc93000(0x116)]){const _0x3ea0a3=parseRef(_0x50b6b9['target']);return _0x3ea0a3?.[_0xc93000(0xd9)]===_0x51c5f4[_0xc93000(0x1c5)][_0xc93000(0xd9)];}return![];})??[];if(_0x4b54fa['length']>0x0){const _0x1e77dc=_0x44fa74(0x18e)+_0x51c5f4[_0x44fa74(0x1c5)][_0x44fa74(0xd9)]+_0x44fa74(0x1c3)+_0x44fa74(0x15c);this['logger']['warn'](_0x1e77dc),_0x3c3243['push'](_0x1e77dc);}const _0x129753=await agentDefToRequest(_0x51c5f4[_0x44fa74(0x1c5)],_0x51c5f4[_0x44fa74(0x132)],_0x51c5f4[_0x44fa74(0x14d)],_0x226871),_0x42ac9=await this[_0x44fa74(0x147)][_0x44fa74(0x19f)](_0x129753);_0x2f8d1a[_0x44fa74(0x19b)](_0x51c5f4[_0x44fa74(0x1c5)][_0x44fa74(0xd9)],_0x42ac9['id']),_0x5acc94[_0x44fa74(0x13a)][_0x44fa74(0x109)]({'agentName':_0x51c5f4['yaml'][_0x44fa74(0xd9)],'action':'created','agentId':_0x42ac9['id'],'warnings':_0x3c3243['length']>0x0?_0x3c3243:undefined}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x13a)]['created']++;}catch(_0x4c6dcb){_0x5acc94[_0x44fa74(0x13a)][_0x44fa74(0x109)]({'agentName':_0x51c5f4[_0x44fa74(0x1c5)]['name'],'action':'error','error':_0x4c6dcb['message'],'warnings':_0x3c3243[_0x44fa74(0x1bc)]>0x0?_0x3c3243:undefined}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x13a)]['errors']++;}}for(const _0x200c7f of _0x45a20a){try{const _0x2d2f82=await yamlPromptToApi(_0x200c7f[_0x44fa74(0x1c5)],_0x18deb6,_0x226871);if(!_0x2d2f82){_0x5acc94[_0x44fa74(0xfc)][_0x44fa74(0x109)]({'name':_0x200c7f[_0x44fa74(0x1c5)][_0x44fa74(0xd9)],'action':_0x44fa74(0x156),'error':_0x44fa74(0x19c)}),_0x5acc94['counts']['prompts'][_0x44fa74(0x153)]++;continue;}const _0x17a157=await this[_0x44fa74(0x147)][_0x44fa74(0xf3)](_0x2d2f82);_0x3eac33[_0x44fa74(0x19b)](_0x200c7f['yaml']['name'],_0x17a157['id']),_0x5acc94[_0x44fa74(0xfc)]['push']({'name':_0x200c7f['yaml'][_0x44fa74(0xd9)],'action':_0x44fa74(0x12e),'id':_0x17a157['id']}),_0x5acc94[_0x44fa74(0x166)]['prompts'][_0x44fa74(0x12e)]++;}catch(_0x86c33e){_0x5acc94[_0x44fa74(0xfc)][_0x44fa74(0x109)]({'name':_0x200c7f[_0x44fa74(0x1c5)][_0x44fa74(0xd9)],'action':_0x44fa74(0x156),'error':_0x86c33e[_0x44fa74(0x15a)]}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0xfc)][_0x44fa74(0x153)]++;}}for(const _0x4025fd of _0x1e1bd4){try{const _0x478703=await yamlIntegrationToApi(_0x4025fd[_0x44fa74(0x1c5)],_0x18deb6,_0x226871),_0x44d56e=await this[_0x44fa74(0x147)][_0x44fa74(0xae)](_0x478703);_0x5acc94[_0x44fa74(0xa8)][_0x44fa74(0x109)]({'name':_0x4025fd['yaml'][_0x44fa74(0xb1)],'action':'created','id':_0x44d56e['id']}),_0x5acc94['counts'][_0x44fa74(0xa8)][_0x44fa74(0x12e)]++;}catch(_0x9ad254){_0x5acc94['integrations'][_0x44fa74(0x109)]({'name':_0x4025fd[_0x44fa74(0x1c5)][_0x44fa74(0xb1)],'action':_0x44fa74(0x156),'error':_0x9ad254[_0x44fa74(0x15a)]}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0xa8)]['errors']++;}}return _0x5acc94;}}
@@ -1 +1 @@
1
- function a124_0x2a9b(){const _0xfbe630=['40563bWtwWf','attributes','6288725PHazGq','8360592yyHYFm','tools','374290nDbiBQ','map','get','3624222uLbRNi','4880DfbpdA','22556xFTirH','targetKnowledgeBaseId','7529800ayccrZ','targetAgentId','324WEAgql','4pGcOIP'];a124_0x2a9b=function(){return _0xfbe630;};return a124_0x2a9b();}(function(_0x185703,_0x59b9ab){const _0x393a64=a124_0x1ae6,_0xbcfe74=_0x185703();while(!![]){try{const _0xb0a192=parseInt(_0x393a64(0x172))/0x1*(-parseInt(_0x393a64(0x168))/0x2)+-parseInt(_0x393a64(0x171))/0x3*(-parseInt(_0x393a64(0x16d))/0x4)+-parseInt(_0x393a64(0x175))/0x5+parseInt(_0x393a64(0x176))/0x6+-parseInt(_0x393a64(0x16b))/0x7+-parseInt(_0x393a64(0x16f))/0x8+-parseInt(_0x393a64(0x173))/0x9*(-parseInt(_0x393a64(0x16c))/0xa);if(_0xb0a192===_0x59b9ab)break;else _0xbcfe74['push'](_0xbcfe74['shift']());}catch(_0x1726cf){_0xbcfe74['push'](_0xbcfe74['shift']());}}}(a124_0x2a9b,0xb3d34));export function canCreateAgent(_0x3473c7,_0x4f9c2d){const _0x4a3126=a124_0x1ae6;for(const _0x52bd25 of _0x3473c7[_0x4a3126(0x174)][_0x4a3126(0x167)]){if(_0x52bd25[_0x4a3126(0x170)]&&!_0x4f9c2d['has'](_0x52bd25[_0x4a3126(0x170)]))return![];}return!![];}function a124_0x1ae6(_0x466106,_0x57df77){_0x466106=_0x466106-0x167;const _0x2a9b0a=a124_0x2a9b();let _0x1ae6d5=_0x2a9b0a[_0x466106];return _0x1ae6d5;}export function remapToolIds(_0x7a9b61,_0x27a732,_0x462661){const _0xfa11d=a124_0x1ae6;return _0x7a9b61[_0xfa11d(0x169)](_0x56a104=>({..._0x56a104,'targetKnowledgeBaseId':_0x56a104[_0xfa11d(0x16e)]?_0x27a732[_0xfa11d(0x16a)](_0x56a104[_0xfa11d(0x16e)])||_0x56a104[_0xfa11d(0x16e)]:undefined,'targetAgentId':_0x56a104[_0xfa11d(0x170)]?_0x462661['get'](_0x56a104[_0xfa11d(0x170)])||_0x56a104['targetAgentId']:undefined}));}export function remapVariableIds(_0x1465fe,_0x39c6bf){const _0x1a047b=a124_0x1ae6;return _0x1465fe[_0x1a047b(0x169)](_0x1599c1=>({..._0x1599c1,'targetKnowledgeBaseId':_0x39c6bf[_0x1a047b(0x16a)](_0x1599c1[_0x1a047b(0x16e)])||_0x1599c1['targetKnowledgeBaseId']}));}export function isSupportedBackupVersion(_0xcfe548){return _0xcfe548==='1.0';}
1
+ function a124_0x311d(){const _0x4501c0=['5503326JJyRdF','map','tools','5391420wdLInx','1.0','9XRaAzm','442670XyNklc','776YjbBhc','has','1138015OiCzlm','targetKnowledgeBaseId','get','10381neVfca','193593ccPJyk','targetAgentId','36AxeCBi','attributes','30743530PrCGXX'];a124_0x311d=function(){return _0x4501c0;};return a124_0x311d();}(function(_0x7316ca,_0xe21b1a){const _0x20cd29=a124_0x58de,_0x12945f=_0x7316ca();while(!![]){try{const _0x2bd282=-parseInt(_0x20cd29(0xdf))/0x1+parseInt(_0x20cd29(0xdc))/0x2+-parseInt(_0x20cd29(0xd1))/0x3*(-parseInt(_0x20cd29(0xd3))/0x4)+-parseInt(_0x20cd29(0xd9))/0x5+-parseInt(_0x20cd29(0xd6))/0x6+parseInt(_0x20cd29(0xd0))/0x7*(-parseInt(_0x20cd29(0xdd))/0x8)+-parseInt(_0x20cd29(0xdb))/0x9*(-parseInt(_0x20cd29(0xd5))/0xa);if(_0x2bd282===_0xe21b1a)break;else _0x12945f['push'](_0x12945f['shift']());}catch(_0x299a5b){_0x12945f['push'](_0x12945f['shift']());}}}(a124_0x311d,0x92438));export function canCreateAgent(_0x323eaa,_0x2f62f1){const _0x33450e=a124_0x58de;for(const _0x1d3e05 of _0x323eaa[_0x33450e(0xd4)][_0x33450e(0xd8)]){if(_0x1d3e05[_0x33450e(0xd2)]&&!_0x2f62f1[_0x33450e(0xde)](_0x1d3e05[_0x33450e(0xd2)]))return![];}return!![];}function a124_0x58de(_0x3fd0f2,_0x1de88f){_0x3fd0f2=_0x3fd0f2-0xce;const _0x311dd0=a124_0x311d();let _0x58def9=_0x311dd0[_0x3fd0f2];return _0x58def9;}export function remapToolIds(_0x118a96,_0x541ae1,_0x57a29f){const _0x1d9a53=a124_0x58de;return _0x118a96[_0x1d9a53(0xd7)](_0x40780f=>({..._0x40780f,'targetKnowledgeBaseId':_0x40780f[_0x1d9a53(0xce)]?_0x541ae1[_0x1d9a53(0xcf)](_0x40780f[_0x1d9a53(0xce)])||_0x40780f[_0x1d9a53(0xce)]:undefined,'targetAgentId':_0x40780f[_0x1d9a53(0xd2)]?_0x57a29f[_0x1d9a53(0xcf)](_0x40780f[_0x1d9a53(0xd2)])||_0x40780f[_0x1d9a53(0xd2)]:undefined}));}export function remapVariableIds(_0x2bbaea,_0x2b32e6){const _0x268bb0=a124_0x58de;return _0x2bbaea[_0x268bb0(0xd7)](_0x36b1eb=>({..._0x36b1eb,'targetKnowledgeBaseId':_0x2b32e6['get'](_0x36b1eb[_0x268bb0(0xce)])||_0x36b1eb['targetKnowledgeBaseId']}));}export function isSupportedBackupVersion(_0x55ad08){const _0x46ebcc=a124_0x58de;return _0x55ad08===_0x46ebcc(0xda);}