@treasuredata/tdx 2026.4.17 → 2026.4.18

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 (220) 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/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/policy-command.js +1 -1
  35. package/dist/commands/profile-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/schedule-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-push-command.js +1 -1
  44. package/dist/commands/segment-update-command.js +1 -1
  45. package/dist/commands/segment-use-command.js +1 -1
  46. package/dist/commands/segment-validate-command.js +1 -1
  47. package/dist/commands/segments.js +1 -1
  48. package/dist/commands/show.js +1 -1
  49. package/dist/commands/status-command.js +1 -1
  50. package/dist/commands/tables.js +1 -1
  51. package/dist/commands/unset-command.js +1 -1
  52. package/dist/commands/upgrade-command.js +1 -1
  53. package/dist/commands/use-command.js +1 -1
  54. package/dist/commands/user-command.js +1 -1
  55. package/dist/commands/work-command.js +1 -1
  56. package/dist/commands/workflow-command.js +1 -1
  57. package/dist/core/auth.js +1 -1
  58. package/dist/core/command-output.js +1 -1
  59. package/dist/core/config.js +1 -1
  60. package/dist/core/connection-cache.js +1 -1
  61. package/dist/core/constants.js +1 -1
  62. package/dist/core/credential-cache.js +1 -1
  63. package/dist/core/global-context.js +1 -1
  64. package/dist/core/keychain.js +1 -1
  65. package/dist/core/oauth-keychain.js +1 -1
  66. package/dist/core/oauth.js +1 -1
  67. package/dist/core/profile.js +1 -1
  68. package/dist/core/project-config.js +1 -1
  69. package/dist/core/session.js +1 -1
  70. package/dist/core/user-cache.js +1 -1
  71. package/dist/core/version.js +1 -1
  72. package/dist/index.js +1 -1
  73. package/dist/mcp/server.js +1 -1
  74. package/dist/mcp/tools/index.js +1 -1
  75. package/dist/mcp/tools/tdx-run.js +1 -1
  76. package/dist/mcp/tools/tdx-search.js +1 -1
  77. package/dist/mcp/tools/work-create-item.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  141. package/dist/sdk/segment/fields-display.js +1 -1
  142. package/dist/sdk/segment/file-discovery.js +1 -1
  143. package/dist/sdk/segment/journey-utils.js +1 -1
  144. package/dist/sdk/segment/journey-validator.js +1 -1
  145. package/dist/sdk/segment/journey-yaml.js +1 -1
  146. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  147. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/pull-workflow.js +1 -1
  149. package/dist/sdk/segment/push-recovery.js +1 -1
  150. package/dist/sdk/segment/push-workflow.js +1 -1
  151. package/dist/sdk/segment/resolution-context.js +1 -1
  152. package/dist/sdk/segment/segment-path-parser.js +1 -1
  153. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  154. package/dist/sdk/segment/segment-validator.js +1 -1
  155. package/dist/sdk/segment/target-resolution.js +1 -1
  156. package/dist/sdk/segment/tdx-config.js +1 -1
  157. package/dist/sdk/segment/types/activation-schema.js +1 -1
  158. package/dist/sdk/segment/types/journey-def.js +1 -1
  159. package/dist/sdk/segment/types/journey-schema.js +1 -1
  160. package/dist/sdk/segment/types/segment-def.js +1 -1
  161. package/dist/sdk/segment/types/segment-schema.js +1 -1
  162. package/dist/sdk/segment/validate-files.js +1 -1
  163. package/dist/sdk/segment/yaml-validator.js +1 -1
  164. package/dist/sdk/segment.js +1 -1
  165. package/dist/sdk/types/index.js +1 -1
  166. package/dist/sdk/types/progress.js +1 -1
  167. package/dist/sdk/types/workspace.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/paginate.js +1 -1
  173. package/dist/sdk/util/tree-formatter.js +1 -1
  174. package/dist/sdk/workflow/archive-validation.js +1 -1
  175. package/dist/sdk/workflow/clone-workflow.js +1 -1
  176. package/dist/sdk/workflow/index.js +1 -1
  177. package/dist/sdk/workflow/pull-workflow.js +1 -1
  178. package/dist/sdk/workflow/push-workflow.js +1 -1
  179. package/dist/sdk/workflow/tdx-config.js +1 -1
  180. package/dist/sdk/workflow/workflow-utils.js +1 -1
  181. package/dist/sdk/workspace/access-tracker.js +1 -1
  182. package/dist/sdk/workspace/frontmatter.js +1 -1
  183. package/dist/sdk/workspace/git.js +1 -1
  184. package/dist/sdk/workspace/index.js +1 -1
  185. package/dist/sdk/workspace/templates.js +1 -1
  186. package/dist/sdk/workspace/weekly.js +1 -1
  187. package/dist/sdk/workspace/wikilinks.js +1 -1
  188. package/dist/test-utils/command-runner.js +1 -1
  189. package/dist/test-utils/factories.js +1 -1
  190. package/dist/test-utils/fixtures.js +1 -1
  191. package/dist/test-utils/http-mock.js +1 -1
  192. package/dist/test-utils/index.js +1 -1
  193. package/dist/utils/async.js +1 -1
  194. package/dist/utils/colors.js +1 -1
  195. package/dist/utils/diff.js +1 -1
  196. package/dist/utils/file-permissions.js +1 -1
  197. package/dist/utils/file-reader.js +1 -1
  198. package/dist/utils/github-releases.js +1 -1
  199. package/dist/utils/global-cache.js +1 -1
  200. package/dist/utils/json-loader.js +1 -1
  201. package/dist/utils/local-cache.js +1 -1
  202. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  203. package/dist/utils/logger/formatters/index.js +1 -1
  204. package/dist/utils/logger/handlers/console-handler.js +1 -1
  205. package/dist/utils/logger/handlers/file-handler.js +1 -1
  206. package/dist/utils/logger/handlers/index.js +1 -1
  207. package/dist/utils/logger/handlers/null-handler.js +1 -1
  208. package/dist/utils/logger/index.js +1 -1
  209. package/dist/utils/logger/logger.js +1 -1
  210. package/dist/utils/logger/types.js +1 -1
  211. package/dist/utils/option-validation.js +1 -1
  212. package/dist/utils/process.js +1 -1
  213. package/dist/utils/prompt.js +1 -1
  214. package/dist/utils/spinner.js +1 -1
  215. package/dist/utils/sse-parser.js +1 -1
  216. package/dist/utils/string-utils.js +1 -1
  217. package/dist/utils/table-ref-parser.js +1 -1
  218. package/dist/utils/tdx-logger.js +1 -1
  219. package/dist/utils/version-check.js +1 -1
  220. package/package.json +17 -2
@@ -1 +1 @@
1
- const a133_0x209be5=a133_0x4964;(function(_0x392ad0,_0xf84b64){const _0x29ccc4=a133_0x4964,_0x437d5c=_0x392ad0();while(!![]){try{const _0x437513=parseInt(_0x29ccc4(0x1e6))/0x1*(-parseInt(_0x29ccc4(0x159))/0x2)+parseInt(_0x29ccc4(0x246))/0x3+-parseInt(_0x29ccc4(0x18a))/0x4*(parseInt(_0x29ccc4(0x21f))/0x5)+-parseInt(_0x29ccc4(0x1a7))/0x6+parseInt(_0x29ccc4(0x162))/0x7*(-parseInt(_0x29ccc4(0x254))/0x8)+parseInt(_0x29ccc4(0x1eb))/0x9*(-parseInt(_0x29ccc4(0x239))/0xa)+parseInt(_0x29ccc4(0x1ec))/0xb;if(_0x437513===_0xf84b64)break;else _0x437d5c['push'](_0x437d5c['shift']());}catch(_0x44ef63){_0x437d5c['push'](_0x437d5c['shift']());}}}(a133_0x5b63,0x3d68c));import{LLMApiClient}from'../client/llm-api-client.js';import*as a133_0x1783c4 from'node:fs';import*as a133_0xef4c6e from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';function a133_0x4964(_0x4304e8,_0x575749){_0x4304e8=_0x4304e8-0x143;const _0x5b6385=a133_0x5b63();let _0x496432=_0x5b6385[_0x4304e8];return _0x496432;}import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';function a133_0x5b63(){const _0x272a53=['44600ZKHSFp','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','Renamed\x20integration\x20file:\x20','metadata','listExperimentalArtifacts','filter','promptId','localeCompare','site','signal','profile','getOrCreateDefaultProject','webhookCorsOrigins','779265NjdgPS','template','chat_interfaces','llm_project','Only\x20safe\x20types\x20(','isFile','pullAgent','total','experimentalKnowledgeBases','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','reasoningEffort','listChatInterfaces','agentId','KnowledgeBase','8272ioFncD','\x27.\x20This\x20should\x20not\x20happen.','agent.yml','UNAUTHENTICATED','conflict','updateExperimentalKnowledgeBase','chat_parent_segment','existsSync','attributes','backupProject','updateAgent','cloneProject','createPrompt','chatInfo','deleteProject','getDefaultAgent','cwd','ALREADY_EXISTS','starter_message.md','getProject','get','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','endsWith','high','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','ExperimentalKnowledgeBase','minimal','prompts.json','warn','knowledgeBases','variables','currentProjectId','tdDatabaseName','chatInterfaces','prompts','):\x20','(dry-run)','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','error','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','def','readFileSync','listToolTargets','updated','AGENT_NOT_FOUND','text_content','createImageGenerator','knowledgebases.json','createIntegration','Renamed\x20experimental\x20artifact\x20directory:\x20','claude-4.5-sonnet','agents','698062VTKJzx','sort','Multiple\x20agents\x20found\x20with\x20name\x20\x27','resolveProjectId','\x0a\x0a#\x20agent.yml\x0a','createFormInterface','Multiple\x20projects\x20found\x20with\x20name\x20\x27','Unable\x20to\x20create\x20project\x20after\x20','Skipping\x20integration\x20\x27','987aiHWCR','basename','exportedFrom','\x20attempts\x20due\x20to\x20name\x20conflicts.','dirname','NOT_FOUND','parse','some','---\x20schema:\x20','agent.yml\x20not\x20found\x20in\x20','sdk.llm','availableModelNames','chatIgnoreManagedActions','code.js','createExperimentalKnowledgeBase','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','temperature','action','.md','deleteAgent','form_interfaces','context','chats','experimental_artifacts','path','prompt.md','tdx.json','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','_reasoning_','web_search','starter_message','Renamed\x20prompt\x20file:\x20','LLM_PROJECT_NOT_FOUND','service_type','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','\x22\x20already\x20exists','Removed\x20deleted\x20file:\x20','\x20in\x20project\x20','PERMISSION_DENIED','1813124pGKtpH','.yml','updateTextKnowledgeBase','formInterfaces','\x27\x20(','webSearchTools','Output\x20directory\x20already\x20exists:\x20','nameToId','writeFileSync','textKnowledgeBases','getCurrentProject','split','TextKnowledgeBase','Agent\x20\x27','listAgents','tdx_default_','actions','Invalid\x20agent\x20reference\x20format:\x20','logger','chat_generic','setCurrentProject','image_gen','listFormInterfaces','getChatHistory','version','dir','duplicate','yaml','stringify','2450580DsRrLi','updateExperimentalArtifact','startChat','getAgent','\x0a---\x20function:\x20','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','Project\x20not\x20found:\x20','getBackupMetadata','createAgentResponse','history','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.','utf-8','type','event','#\x20prompt.md\x0a','experimentalArtifacts','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','listImageGenerators','message','statSync','has','integrations','modelType','listPrompts','listTextKnowledgeBases','tdx_','add','name','\x0a---\x20schema:\x20','clearDefaultAgent','unchanged','INVALID_ARGUMENT','Available\x20agents:\x20','setDefaultAgent','description','isDirectory','files','functions','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','chatWelcomeMessage','projects','---\x20file:\x20','info','createTextKnowledgeBase','listProjects','starterMessage','experimental_knowledge_bases','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','getChatInfo','agent','Removed\x20deleted\x20directory:\x20','project.json','client','imageGenerators','displayName','counts','listExperimentalKnowledgeBases','new','dryRun','tables','listIntegrations','includes','1FscstR','createKnowledgeBase','unlinkSync','loadJsonFile','pushAgent','963JUwGtv','20080863roDegF','Project\x20\x22','serviceType','length','updateChatInterface','outputs','listAgentsFull','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','toISOString','status','updatePrompt','Renamed\x20text\x20KB\x20file:\x20','errors','low','models','readdirSync','Unresolved\x20dependencies:\x20','find','content','isManaged','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','Renamed\x20form\x20interface\x20file:\x20','\x20---\x0a','availableModels','file_name','updateAgentResponse','json_schema','Renamed\x20folder:\x20','already\x20exists','INTERNAL','knowledge_bases','updateKnowledgeBase','join','listWebSearchTools','target','medium','\x20→\x20','oldPath','code','createAgent','createExperimentalArtifact','createProject','Could\x20not\x20resolve\x20agent\x20reference','Agent\x20reference\x20not\x20found',')\x20can\x20be\x20cloned.','\x0a---\x20code\x20---\x0a','json_schema.json','renamed','toLowerCase','resolveProjectName','text','5xmUgJi','getDefaultProjectName','listChats','projectName','push','resolveAgentId','chat','tools','map','deleteIntegration','dry-run-','set','size','maxToolIterations','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','updateFormInterface','systemPrompt','listKnowledgeBases','integrations.json','idToName',')\x20can\x20be\x20pushed.\x20','Unsupported\x20backup\x20version:\x20','Renamed\x20agent\x20folder:\x20','created','mkdirSync','isDir'];a133_0x5b63=function(){return _0x272a53;};return a133_0x5b63();}import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a133_0x209be5(0x19d),'chat_agent_console',a133_0x209be5(0x25a)];async function safeListOrEmpty(_0x5dba27){const _0x3a187f=a133_0x209be5;try{return await _0x5dba27();}catch(_0x77b610){if(_0x77b610 instanceof HTTPClientError&&_0x77b610[_0x3a187f(0x1f5)]===0x194)return[];throw _0x77b610;}}export class LLMSDK{[a133_0x209be5(0x144)];[a133_0x209be5(0x1dc)];[a133_0x209be5(0x178)];[a133_0x209be5(0x19c)]=Logger['of'](a133_0x209be5(0x16c));constructor(_0x42e525){const _0x27aa17=a133_0x209be5;this[_0x27aa17(0x1dc)]=new LLMApiClient(_0x42e525),this[_0x27aa17(0x178)]=_0x42e525;}[a133_0x209be5(0x220)](){const _0xb110c5=a133_0x209be5,_0x58ae37=getSanitizedUsername();return _0xb110c5(0x199)+_0x58ae37;}async[a133_0x209be5(0x19e)](_0x29b8be){const _0x365e5c=a133_0x209be5,{projectId:_0x14656e}=await this['resolveProjectName'](_0x29b8be);this[_0x365e5c(0x144)]=_0x14656e;}[a133_0x209be5(0x194)](){const _0x5f25ce=a133_0x209be5;return this[_0x5f25ce(0x144)];}async[a133_0x209be5(0x1c9)](_0x468c2d){const _0x2bff79=a133_0x209be5,_0x24c49e=this[_0x2bff79(0x178)][_0x2bff79(0x243)];let _0x17723f,_0x1f462c;if(_0x468c2d[_0x2bff79(0x1e5)]('/')){const _0x526875=_0x468c2d[_0x2bff79(0x195)]('/');if(_0x526875['length']!==0x2)throw new SDKError(ErrorCode[_0x2bff79(0x1c7)],_0x2bff79(0x19b)+_0x468c2d,undefined,{'helpText':_0x2bff79(0x22d)});const [_0x43944b,_0x14910c]=_0x526875;_0x17723f=await this[_0x2bff79(0x15c)](_0x43944b),_0x1f462c=_0x14910c;}else _0x17723f=this[_0x2bff79(0x144)]||(await this[_0x2bff79(0x244)]())['id'],_0x1f462c=_0x468c2d;const _0x2fc624=await this[_0x2bff79(0x224)](_0x1f462c,_0x17723f),_0x172bb2=await this[_0x2bff79(0x1dc)][_0x2bff79(0x1aa)](_0x2fc624);writeCachedLLMAgent(_0x172bb2[_0x2bff79(0x25c)]['name'],_0x2fc624,_0x17723f,_0x24c49e);}[a133_0x209be5(0x263)](){const _0x32b076=a133_0x209be5,_0x1d6f59=this[_0x32b076(0x178)]['profile'];return readCachedLLMAgent(_0x1d6f59)||undefined;}[a133_0x209be5(0x1c5)](){const _0x1852b8=a133_0x209be5,_0x579f78=this[_0x1852b8(0x178)][_0x1852b8(0x243)];clearCachedLLMAgent(_0x579f78);}async[a133_0x209be5(0x1fa)](){const _0x24369d=a133_0x209be5,_0x5e7d5f=await this[_0x24369d(0x1dc)]['getUserSettings'](),_0x451dce=[];for(const _0x1b9b57 of _0x5e7d5f[_0x24369d(0x16d)]){const _0x5cb2cd=_0x5e7d5f[_0x24369d(0x203)][_0x1b9b57];_0x5cb2cd&&_0x451dce[_0x24369d(0x223)]({'name':_0x1b9b57,'displayName':_0x5cb2cd[_0x24369d(0x1de)]});}return _0x451dce;}async[a133_0x209be5(0x215)](_0x436646){const _0x443824=a133_0x209be5;return await this[_0x443824(0x1dc)]['createProject'](_0x436646);}async[a133_0x209be5(0x262)](_0x380d18){const _0x1a361a=a133_0x209be5,{projectId:_0x5e1da7}=await this[_0x1a361a(0x21d)](_0x380d18);await this['client'][_0x1a361a(0x262)](_0x5e1da7);}async[a133_0x209be5(0x1d0)](_0x1926fe=0x32){const _0x28e15f=a133_0x209be5;return await this[_0x28e15f(0x1dc)][_0x28e15f(0x1d4)](_0x1926fe);}async['getOrCreateDefaultProject'](_0x49cf11){const _0x44771e=a133_0x209be5,_0x3d8f6e=_0x49cf11||this[_0x44771e(0x220)](),_0x21538b=this['context'][_0x44771e(0x243)];if(!_0x49cf11){const _0x445973=readCachedLLMProject(_0x21538b);if(_0x445973&&_0x445973[_0x44771e(0x1c3)]===_0x3d8f6e)try{const _0x4e518c=await this[_0x44771e(0x1dc)][_0x44771e(0x267)](_0x445973['id']);if(_0x4e518c[_0x44771e(0x25c)][_0x44771e(0x1c3)]===_0x3d8f6e)return _0x4e518c;}catch{}}const _0x53b7c9=await this[_0x44771e(0x1dc)][_0x44771e(0x1d4)](),_0x5c37f6=_0x53b7c9['find'](_0x171ca8=>_0x171ca8[_0x44771e(0x25c)][_0x44771e(0x1c3)]===_0x3d8f6e);if(_0x5c37f6)return!_0x49cf11&&writeCachedLLMProject(_0x3d8f6e,_0x5c37f6['id'],_0x21538b),_0x5c37f6;const _0x270030=await this[_0x44771e(0x1dc)][_0x44771e(0x215)]({'name':_0x3d8f6e,'description':_0x44771e(0x14a)+getSanitizedUsername()+')'});return!_0x49cf11&&writeCachedLLMProject(_0x3d8f6e,_0x270030['id'],_0x21538b),_0x270030;}async[a133_0x209be5(0x15c)](_0x273fd5){const _0x37820f=a133_0x209be5,_0x30b7c5=await this[_0x37820f(0x1dc)][_0x37820f(0x1d4)](),_0x5605b3=_0x30b7c5['filter'](_0x5a6baf=>_0x5a6baf['attributes'][_0x37820f(0x1c3)]===_0x273fd5);if(_0x5605b3[_0x37820f(0x1ef)]===0x0)throw new SDKError(ErrorCode[_0x37820f(0x183)],_0x37820f(0x1ae)+_0x273fd5,undefined,{'helpText':_0x37820f(0x185)});if(_0x5605b3[_0x37820f(0x1ef)]>0x1)throw new SDKError(ErrorCode[_0x37820f(0x209)],_0x37820f(0x15f)+_0x273fd5+_0x37820f(0x255));return _0x5605b3[0x0]['id'];}async['resolveProjectName'](_0x232e85){const _0x199366=a133_0x209be5,_0x3a02bf=await this['client'][_0x199366(0x1d4)](),_0x4c0b2c=_0x3a02bf['find'](_0x2ad3c2=>_0x2ad3c2[_0x199366(0x25c)][_0x199366(0x1c3)]===_0x232e85);if(_0x4c0b2c)return{'projectId':_0x4c0b2c['id'],'project':_0x4c0b2c};throw new SDKError(ErrorCode[_0x199366(0x183)],_0x199366(0x1ae)+_0x232e85,undefined,{'helpText':_0x199366(0x185)});}async['getOrCreateDefaultAgent'](_0x40cf2b=a133_0x209be5(0x157),_0x5769c9=0x0,_0x3976cc){const _0x11b57f=a133_0x209be5,_0x1af381=0xa;let _0x3ce448=0x0,_0x23c050;while(_0x3ce448<_0x1af381){try{const _0x54fb04=await this[_0x11b57f(0x244)](_0x23c050),_0x5676cc=_0x54fb04['id'],_0x2ba06e=['none',_0x11b57f(0x26e),_0x11b57f(0x1f9),_0x11b57f(0x20f),_0x11b57f(0x26b)],_0x35e8c9=_0x5769c9===0x0?_0x11b57f(0x1c1)+_0x40cf2b:_0x11b57f(0x1c1)+_0x40cf2b+_0x11b57f(0x17f)+_0x2ba06e[_0x5769c9],_0x4123d1=await this[_0x11b57f(0x1dc)]['listAgents'](_0x5676cc),_0x5b5c28=_0x4123d1[_0x11b57f(0x1fd)](_0x180154=>_0x180154[_0x11b57f(0x25c)][_0x11b57f(0x1c3)]===_0x35e8c9);if(_0x5b5c28)return _0x5b5c28;const _0x3a175c=_0x5769c9>0x0?0x1:_0x3976cc;return await this[_0x11b57f(0x1dc)]['createAgent']({'name':_0x35e8c9,'projectId':_0x5676cc,'modelType':_0x40cf2b,'systemPrompt':'','temperature':_0x3a175c,'reasoningEffort':_0x5769c9>0x0?_0x5769c9:undefined});}catch(_0x3cc67d){if(_0x3cc67d instanceof HTTPClientError){const _0x4704c0=_0x3cc67d['status'];if(_0x4704c0>=0x190&&_0x4704c0<0x1f4){if(_0x4704c0===0x191)throw new SDKError(ErrorCode[_0x11b57f(0x257)],_0x11b57f(0x171),_0x3cc67d);else{if(_0x4704c0===0x193)throw new SDKError(ErrorCode[_0x11b57f(0x189)],_0x11b57f(0x269),_0x3cc67d);}throw _0x3cc67d;}}if(errorContains(_0x3cc67d,_0x11b57f(0x208),_0x11b57f(0x1a4),_0x11b57f(0x258))){_0x3ce448++;if(_0x3ce448>=_0x1af381)throw new SDKError(ErrorCode[_0x11b57f(0x265)],_0x11b57f(0x160)+_0x1af381+_0x11b57f(0x165),_0x3cc67d);const _0x5f3894=this[_0x11b57f(0x220)]();_0x23c050=_0x5f3894+'_'+generateRandomHex();continue;}throw _0x3cc67d;}}throw new SDKError(ErrorCode[_0x11b57f(0x209)],'Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts');}async[a133_0x209be5(0x224)](_0x300bab,_0x338862){const _0x52af03=a133_0x209be5,_0x105bff=_0x338862||this[_0x52af03(0x144)],_0x55ab51=await this[_0x52af03(0x1dc)][_0x52af03(0x198)](_0x105bff),_0x5d68a5=_0x55ab51[_0x52af03(0x23e)](_0x3e9434=>_0x3e9434[_0x52af03(0x25c)][_0x52af03(0x1c3)]===_0x300bab);if(_0x5d68a5[_0x52af03(0x1ef)]===0x0){const _0x2752a8=_0x105bff?_0x52af03(0x188)+_0x105bff:'';throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],'Agent\x20not\x20found:\x20'+_0x300bab+_0x2752a8,undefined,{'helpText':_0x105bff?_0x52af03(0x1ac):_0x52af03(0x1b2)});}if(_0x5d68a5[_0x52af03(0x1ef)]>0x1)throw new SDKError(ErrorCode[_0x52af03(0x209)],_0x52af03(0x15b)+_0x300bab+_0x52af03(0x255));return _0x5d68a5[0x0]['id'];}async[a133_0x209be5(0x158)](_0x2c0003){const _0x217edb=a133_0x209be5,_0x48eec3=_0x2c0003||this[_0x217edb(0x144)];return await this[_0x217edb(0x1dc)][_0x217edb(0x198)](_0x48eec3);}async['agentsFull'](_0x2f5a83){const _0x20ec1c=a133_0x209be5;return await this[_0x20ec1c(0x1dc)]['listAgentsFull'](_0x2f5a83);}async['agent'](_0xdff30b){const _0x168a32=a133_0x209be5;return await this[_0x168a32(0x1dc)][_0x168a32(0x1aa)](_0xdff30b);}async[a133_0x209be5(0x213)](_0x1af5e8){return await this['client']['createAgent'](_0x1af5e8);}async[a133_0x209be5(0x25e)](_0x4f1e64,_0x49add9){return await this['client']['updateAgent'](_0x4f1e64,_0x49add9);}async[a133_0x209be5(0x176)](_0x2f8eb4){const _0x36ae93=a133_0x209be5;await this[_0x36ae93(0x1dc)][_0x36ae93(0x176)](_0x2f8eb4);}async[a133_0x209be5(0x1a9)](_0x2d980c){const _0x2806b0=a133_0x209be5;return await this[_0x2806b0(0x1dc)][_0x2806b0(0x1a9)]({'agentId':_0x2d980c});}async*[a133_0x209be5(0x225)](_0x50e346,_0x44aa91){const _0xe25368=a133_0x209be5;let _0xb567f7=_0x44aa91?.['chatId'];const _0x398ba1=_0x44aa91?.[_0xe25368(0x252)];if(!_0xb567f7){if(!_0x398ba1)throw new Error(_0xe25368(0x1b8));const _0x776742=await this['client'][_0xe25368(0x1a9)]({'agentId':_0x398ba1});_0xb567f7=_0x776742['id'],yield{'type':_0xe25368(0x23c),'data':{'chatId':_0xb567f7,'agentId':_0x398ba1,'projectId':_0x776742[_0xe25368(0x25c)]['projectId']}};}for await(const _0x578939 of this[_0xe25368(0x1dc)]['continueChat'](_0xb567f7,_0x50e346,_0x44aa91?.[_0xe25368(0x242)])){yield{'type':_0xe25368(0x1b5),'data':_0x578939};}}async[a133_0x209be5(0x179)](_0x5d6afb=0x32){const _0x30d764=a133_0x209be5;return await this[_0x30d764(0x1dc)][_0x30d764(0x221)](_0x5d6afb);}async[a133_0x209be5(0x1b1)](_0x112f13){const _0x2cc910=a133_0x209be5;return await this[_0x2cc910(0x1dc)][_0x2cc910(0x1a1)](_0x112f13);}async['getChatLog'](_0x224d1a){const _0x2f2b59=a133_0x209be5;return await this[_0x2f2b59(0x1dc)]['getChatLog'](_0x224d1a);}async[a133_0x209be5(0x261)](_0x2a4778){const _0x4a5154=a133_0x209be5;return await this[_0x4a5154(0x1dc)][_0x4a5154(0x1d8)](_0x2a4778);}async[a133_0x209be5(0x25d)](_0x11abf6,_0x517005,_0x4542d3){const _0x235a5d=a133_0x209be5,_0x4c4acb=_0x4542d3?.[_0x235a5d(0x1e2)]??![],{projectId:_0x2207bb,project:_0x11972d}=await this[_0x235a5d(0x21d)](_0x11abf6),_0x28d203=_0x11972d[_0x235a5d(0x25c)][_0x235a5d(0x1c3)],_0x48a4cc=_0x517005||_0x28d203+'.llm';if(a133_0x1783c4[_0x235a5d(0x25b)](_0x48a4cc)&&!_0x4c4acb)throw new SDKError(ErrorCode[_0x235a5d(0x265)],_0x235a5d(0x190)+_0x48a4cc,undefined,{'helpText':_0x235a5d(0x1f3)});const _0x874778=await this[_0x235a5d(0x1dc)]['listAgentsFull'](_0x2207bb),_0x4f737a=await this['client'][_0x235a5d(0x230)](_0x2207bb),_0x6c247d=await this['client'][_0x235a5d(0x1bf)](_0x2207bb),_0x1853dc=await this[_0x235a5d(0x1dc)][_0x235a5d(0x1e4)](_0x2207bb);if(!_0x4c4acb){a133_0x1783c4[_0x235a5d(0x237)](_0x48a4cc,{'recursive':!![]});const _0x2a5890={'version':'1.0','exportedAt':new Date()[_0x235a5d(0x1f4)](),'exportedFrom':{'site':this[_0x235a5d(0x178)]['site'],'projectId':_0x2207bb,'projectName':_0x28d203},'project':_0x11972d};a133_0x1783c4[_0x235a5d(0x192)](a133_0xef4c6e[_0x235a5d(0x20c)](_0x48a4cc,_0x235a5d(0x1db)),JSON[_0x235a5d(0x1a6)](_0x2a5890,null,0x2)),a133_0x1783c4[_0x235a5d(0x192)](a133_0xef4c6e[_0x235a5d(0x20c)](_0x48a4cc,'agents.json'),JSON[_0x235a5d(0x1a6)](_0x874778,null,0x2)),a133_0x1783c4['writeFileSync'](a133_0xef4c6e[_0x235a5d(0x20c)](_0x48a4cc,_0x235a5d(0x154)),JSON[_0x235a5d(0x1a6)](_0x4f737a,null,0x2)),a133_0x1783c4[_0x235a5d(0x192)](a133_0xef4c6e[_0x235a5d(0x20c)](_0x48a4cc,_0x235a5d(0x26f)),JSON[_0x235a5d(0x1a6)](_0x6c247d,null,0x2)),a133_0x1783c4['writeFileSync'](a133_0xef4c6e[_0x235a5d(0x20c)](_0x48a4cc,_0x235a5d(0x231)),JSON[_0x235a5d(0x1a6)](_0x1853dc,null,0x2));}return{'projectName':_0x28d203,'outputDir':_0x48a4cc,'counts':{'agents':_0x874778['length'],'knowledgeBases':_0x4f737a[_0x235a5d(0x1ef)],'prompts':_0x6c247d[_0x235a5d(0x1ef)],'integrations':_0x1853dc[_0x235a5d(0x1ef)]}};}async['restoreProject'](_0x17d1a6,_0x518705){const _0x55f883=a133_0x209be5,_0x30f854=_0x518705?.[_0x55f883(0x1e2)]??![],_0x31c5f8=this['getBackupMetadata'](_0x17d1a6),_0x24364c=_0x31c5f8[_0x55f883(0x164)]['site'],_0x11bbd6=this['context'][_0x55f883(0x241)],_0xfc7ba3=_0x24364c!==_0x11bbd6?_0x24364c:undefined,_0x5999cb=this['loadJsonFile'](a133_0xef4c6e[_0x55f883(0x20c)](_0x17d1a6,'agents.json'),[]),_0x1d8e76=this[_0x55f883(0x1e9)](a133_0xef4c6e['join'](_0x17d1a6,_0x55f883(0x154)),[]),_0x5b46a7=this['loadJsonFile'](a133_0xef4c6e['join'](_0x17d1a6,_0x55f883(0x26f)),[]),_0x2be971=this[_0x55f883(0x1e9)](a133_0xef4c6e['join'](_0x17d1a6,'integrations.json'),[]),_0x55a22c=_0x518705?.[_0x55f883(0x1c3)]||_0x31c5f8['exportedFrom'][_0x55f883(0x222)];if(_0x30f854){const _0x35f2c0=new Map(),_0x538ca3=[..._0x5999cb],_0x2cece7=_0x5999cb[_0x55f883(0x1ef)]+0x1;let _0x4d22f4=0x0;while(_0x538ca3['length']>0x0&&_0x4d22f4<_0x2cece7){_0x4d22f4++;const _0x9f9e62=[];for(const _0x430d47 of _0x538ca3){canCreateAgent(_0x430d47,_0x35f2c0)?_0x35f2c0[_0x55f883(0x22a)](_0x430d47['id'],_0x55f883(0x229)+_0x430d47['id']):_0x9f9e62[_0x55f883(0x223)](_0x430d47);}if(_0x9f9e62[_0x55f883(0x1ef)]===_0x538ca3[_0x55f883(0x1ef)])throw new SDKError(ErrorCode[_0x55f883(0x209)],_0x55f883(0x24f),undefined,{'helpText':_0x55f883(0x1ad)});_0x538ca3[_0x55f883(0x1ef)]=0x0,_0x538ca3['push'](..._0x9f9e62);}const _0x127941=_0x5b46a7[_0x55f883(0x23e)](_0x34210b=>_0x35f2c0[_0x55f883(0x1bc)](_0x34210b[_0x55f883(0x25c)][_0x55f883(0x252)]))[_0x55f883(0x1ef)];return{'projectName':_0x55a22c,'projectId':_0x55f883(0x149),'counts':{'agents':_0x5999cb[_0x55f883(0x1ef)],'knowledgeBases':_0x1d8e76[_0x55f883(0x1ef)],'prompts':_0x127941,'integrations':_0x2be971[_0x55f883(0x1ef)]},'sourceSite':_0xfc7ba3};}const _0x42c91f=await this['client'][_0x55f883(0x215)]({'name':_0x55a22c,'description':_0x31c5f8['project'][_0x55f883(0x25c)][_0x55f883(0x1ca)]}),_0x3dd134=_0x42c91f['id'],_0x371168=new Map(),_0x1c105d=new Map(),_0x2f6f9e=new Map();for(const _0x3f295c of _0x1d8e76){const _0x41f13e=await this[_0x55f883(0x1dc)][_0x55f883(0x1e7)]({'projectId':_0x3dd134,'name':_0x3f295c['attributes'][_0x55f883(0x1c3)],'tdDatabaseName':_0x3f295c[_0x55f883(0x25c)][_0x55f883(0x145)],'tables':_0x3f295c[_0x55f883(0x25c)][_0x55f883(0x1e3)]});_0x371168['set'](_0x3f295c['id'],_0x41f13e['id']);}const _0x29a1e8=[..._0x5999cb],_0x108426=_0x5999cb['length']+0x1;let _0x54ccdc=0x0;while(_0x29a1e8[_0x55f883(0x1ef)]>0x0&&_0x54ccdc<_0x108426){_0x54ccdc++;const _0x1a3ab0=[];for(const _0x3b49ca of _0x29a1e8){if(canCreateAgent(_0x3b49ca,_0x1c105d)){const _0x5f56c8=remapToolIds(_0x3b49ca[_0x55f883(0x25c)][_0x55f883(0x226)],_0x371168,_0x1c105d),_0xa345b7=remapVariableIds(_0x3b49ca[_0x55f883(0x25c)][_0x55f883(0x143)],_0x371168),_0x2929ba=await this[_0x55f883(0x1dc)][_0x55f883(0x1b0)]({'name':_0x3b49ca[_0x55f883(0x25c)]['name'],'projectId':_0x3dd134,'systemPrompt':_0x3b49ca[_0x55f883(0x25c)][_0x55f883(0x22f)],'starterMessage':_0x3b49ca[_0x55f883(0x25c)][_0x55f883(0x1d5)],'modelType':migrateModelType(_0x3b49ca[_0x55f883(0x25c)][_0x55f883(0x1be)]),'maxToolIterations':_0x3b49ca[_0x55f883(0x25c)][_0x55f883(0x22c)],'temperature':_0x3b49ca[_0x55f883(0x25c)][_0x55f883(0x173)],'reasoningEffort':_0x3b49ca[_0x55f883(0x25c)][_0x55f883(0x250)],'outputs':_0x3b49ca[_0x55f883(0x25c)][_0x55f883(0x1f1)],'tools':_0x5f56c8,'variables':_0xa345b7});_0x1c105d[_0x55f883(0x22a)](_0x3b49ca['id'],_0x2929ba['id']);}else _0x1a3ab0[_0x55f883(0x223)](_0x3b49ca);}if(_0x1a3ab0[_0x55f883(0x1ef)]===_0x29a1e8['length'])throw new SDKError(ErrorCode[_0x55f883(0x209)],_0x55f883(0x24f),undefined,{'helpText':_0x55f883(0x1ad)});_0x29a1e8[_0x55f883(0x1ef)]=0x0,_0x29a1e8[_0x55f883(0x223)](..._0x1a3ab0);}for(const _0x19852f of _0x5b46a7){const _0x3e3403=_0x1c105d[_0x55f883(0x268)](_0x19852f['attributes'][_0x55f883(0x252)]);if(!_0x3e3403)continue;const _0x2c324e=await this[_0x55f883(0x1dc)][_0x55f883(0x260)]({'projectId':_0x3dd134,'agentId':_0x3e3403,'name':_0x19852f[_0x55f883(0x25c)][_0x55f883(0x1c3)],'systemPrompt':_0x19852f[_0x55f883(0x25c)][_0x55f883(0x22f)],'template':_0x19852f[_0x55f883(0x25c)][_0x55f883(0x247)],'jsonSchemaHint':_0x19852f[_0x55f883(0x25c)]['jsonSchemaHint']});_0x2f6f9e[_0x55f883(0x22a)](_0x19852f['id'],_0x2c324e['id']);}for(const _0x5d82c3 of _0x2be971){const _0x20749f=_0x5d82c3[_0x55f883(0x25c)][_0x55f883(0x19a)][_0x55f883(0x227)](_0x1ab4a0=>({..._0x1ab4a0,'promptId':_0x2f6f9e[_0x55f883(0x268)](_0x1ab4a0[_0x55f883(0x23f)])||_0x1ab4a0[_0x55f883(0x23f)]}));await this[_0x55f883(0x1dc)][_0x55f883(0x155)]({'projectId':_0x3dd134,'serviceType':_0x5d82c3['attributes'][_0x55f883(0x1ee)],'actions':_0x20749f,'slackMessageMode':_0x5d82c3[_0x55f883(0x25c)]['slackMessageMode'],'chatIgnoreManagedActions':_0x5d82c3[_0x55f883(0x25c)][_0x55f883(0x16e)],'chatWelcomeMessage':_0x5d82c3['attributes'][_0x55f883(0x1cf)],'webhookCorsOrigins':_0x5d82c3[_0x55f883(0x25c)][_0x55f883(0x245)]});}return{'projectName':_0x55a22c,'projectId':_0x3dd134,'counts':{'agents':_0x1c105d[_0x55f883(0x22b)],'knowledgeBases':_0x371168[_0x55f883(0x22b)],'prompts':_0x2f6f9e[_0x55f883(0x22b)],'integrations':_0x2be971[_0x55f883(0x1ef)]},'sourceSite':_0xfc7ba3};}['loadJsonFile'](_0x32fa3b,_0x49fefb){const _0x3197fc=a133_0x209be5;if(!a133_0x1783c4['existsSync'](_0x32fa3b))return _0x49fefb;return JSON['parse'](a133_0x1783c4[_0x3197fc(0x14e)](_0x32fa3b,_0x3197fc(0x1b3)));}[a133_0x209be5(0x1af)](_0x179726){const _0x3e9738=a133_0x209be5;if(!a133_0x1783c4[_0x3e9738(0x25b)](_0x179726))throw new SDKError(ErrorCode['NOT_FOUND'],'Backup\x20folder\x20not\x20found:\x20'+_0x179726,undefined,{'helpText':_0x3e9738(0x26c)});const _0x318c38=a133_0xef4c6e[_0x3e9738(0x20c)](_0x179726,_0x3e9738(0x1db));if(!a133_0x1783c4['existsSync'](_0x318c38))throw new SDKError(ErrorCode[_0x3e9738(0x1c7)],'Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20'+_0x179726,undefined,{'helpText':_0x3e9738(0x17e)});const _0x32a00f=JSON[_0x3e9738(0x168)](a133_0x1783c4[_0x3e9738(0x14e)](_0x318c38,_0x3e9738(0x1b3)));if(!isSupportedBackupVersion(_0x32a00f[_0x3e9738(0x1a2)]))throw new SDKError(ErrorCode[_0x3e9738(0x1c7)],_0x3e9738(0x234)+_0x32a00f[_0x3e9738(0x1a2)],undefined,{'helpText':_0x3e9738(0x200)});return _0x32a00f;}async['pullProject'](_0x581101,_0x1bdb36,_0x11922d){const _0x538366=a133_0x209be5,{projectId:_0x3a6e44,project:_0x3b6ffc}=await this[_0x538366(0x21d)](_0x581101),_0x5b1020=_0x3b6ffc[_0x538366(0x25c)][_0x538366(0x1c3)];let _0x295693;if(_0x1bdb36)_0x295693=_0x1bdb36;else{const _0x31e87b=a133_0xef4c6e[_0x538366(0x20c)](process[_0x538366(0x264)](),'agents'),_0x4dd695=getSanitizedPathWithMigration(_0x31e87b,_0x5b1020);_0x4dd695[_0x538366(0x21b)]&&this['logger'][_0x538366(0x1d2)]('Renamed\x20folder:\x20'+a133_0xef4c6e[_0x538366(0x163)](_0x4dd695[_0x538366(0x211)])+'\x20→\x20'+a133_0xef4c6e['basename'](_0x4dd695[_0x538366(0x17b)])),_0x295693=_0x4dd695[_0x538366(0x17b)];}const _0x54451e=await this[_0x538366(0x1dc)][_0x538366(0x1f2)](_0x3a6e44),_0x4f75f2=await this['client']['listKnowledgeBases'](_0x3a6e44),_0x1f42a7=await this['client'][_0x538366(0x1c0)](_0x3a6e44),_0x343630=await safeListOrEmpty(()=>this['client'][_0x538366(0x1b9)](_0x3a6e44)),_0x23989e=await safeListOrEmpty(()=>this[_0x538366(0x1dc)][_0x538366(0x20d)](_0x3a6e44)),_0x19fe7f=await this[_0x538366(0x1dc)][_0x538366(0x1bf)](_0x3a6e44),_0x549cc1=await this[_0x538366(0x1dc)]['listIntegrations'](_0x3a6e44),_0x41543b=await safeListOrEmpty(()=>this['client']['listExperimentalKnowledgeBases'](_0x3a6e44)),_0x15e6a9=await safeListOrEmpty(()=>this[_0x538366(0x1dc)][_0x538366(0x23d)](_0x3a6e44)),_0x331203=await safeListOrEmpty(()=>this[_0x538366(0x1dc)][_0x538366(0x1a0)](_0x3a6e44)),_0x499f09=await safeListOrEmpty(()=>this[_0x538366(0x1dc)][_0x538366(0x251)](_0x3a6e44)),_0x10e1df=_0x549cc1['filter'](_0x2a25f6=>!_0x2a25f6[_0x538366(0x25c)][_0x538366(0x1ff)]&&SAFE_INTEGRATION_TYPES[_0x538366(0x1e5)](_0x2a25f6[_0x538366(0x25c)]['serviceType'][_0x538366(0x21c)]())),_0x59aa77=new Map(),_0x3acdce=new Map(),_0x515611=new Map(),_0x4ae804=new Map(),_0x1be3ae=new Map(),_0x569580=new Map(),_0x262a00=new Map();for(const _0x1feabb of _0x54451e){_0x59aa77[_0x538366(0x22a)](_0x1feabb['id'],_0x1feabb[_0x538366(0x25c)][_0x538366(0x1c3)]);}for(const _0x5d0c73 of _0x4f75f2){_0x3acdce[_0x538366(0x22a)](_0x5d0c73['id'],_0x5d0c73[_0x538366(0x25c)][_0x538366(0x1c3)]);}for(const _0x105bb0 of _0x1f42a7){_0x515611['set'](_0x105bb0['id'],_0x105bb0[_0x538366(0x25c)][_0x538366(0x1c3)]);}for(const _0x533728 of _0x343630){_0x4ae804['set'](_0x533728['id'],_0x533728[_0x538366(0x25c)][_0x538366(0x1c3)]);}for(const _0x46489d of _0x23989e){_0x1be3ae[_0x538366(0x22a)](_0x46489d['id'],_0x46489d[_0x538366(0x25c)][_0x538366(0x1c3)]);}for(const _0x54848f of _0x19fe7f){_0x569580[_0x538366(0x22a)](_0x54848f['id'],_0x54848f['attributes'][_0x538366(0x1c3)]);}for(const _0x224966 of _0x41543b){_0x262a00[_0x538366(0x22a)](_0x224966['id'],_0x224966[_0x538366(0x25c)][_0x538366(0x1c3)]);}const _0x15bdb9={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x3acdce,'TextKnowledgeBase':_0x515611,'Agent':_0x59aa77,'WebSearchTool':_0x1be3ae,'ImageGenerator':_0x4ae804,'ExperimentalKnowledgeBase':_0x262a00}),'resolvePromptName':async _0x2fc58a=>_0x569580[_0x538366(0x268)](_0x2fc58a),'onWarning':_0x2c4ff4=>this[_0x538366(0x19c)]['warn'](_0x2c4ff4)},_0x15725b={'projectName':_0x5b1020,'outputDir':_0x295693,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'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},'formInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'chatInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0x414814=[],_0x1c2308=[];for(const _0x421c1e of _0x54451e){const _0x34ae51=getSanitizedPathWithMigration(_0x295693,_0x421c1e['attributes']['name']);_0x34ae51['renamed']&&this['logger'][_0x538366(0x1d2)](_0x538366(0x235)+a133_0xef4c6e[_0x538366(0x163)](_0x34ae51['oldPath'])+_0x538366(0x210)+a133_0xef4c6e[_0x538366(0x163)](_0x34ae51[_0x538366(0x17b)]));const _0x1f11d5=_0x34ae51[_0x538366(0x17b)],_0x5ec8a7=a133_0xef4c6e['join'](_0x1f11d5,_0x538366(0x17c)),_0x31629c=a133_0xef4c6e[_0x538366(0x20c)](_0x1f11d5,'agent.yml'),_0x5c3d96=a133_0xef4c6e[_0x538366(0x20c)](_0x1f11d5,'starter_message.md'),{yaml:_0x3f4a07,systemPrompt:_0x5559a5,starterMessage:_0x2215eb}=await agentResponseToDef(_0x421c1e,_0x15bdb9),_0x1cc5b9=toAgentYamlString(_0x3f4a07),_0x2e0e05=!a133_0x1783c4['existsSync'](_0x31629c);let _0xe3a454=_0x2e0e05,_0xdce6c5;if(!_0x2e0e05){const _0x512ed1=a133_0x1783c4[_0x538366(0x25b)](_0x5ec8a7)?a133_0x1783c4[_0x538366(0x14e)](_0x5ec8a7,_0x538366(0x1b3)):'',_0x562434=a133_0x1783c4[_0x538366(0x14e)](_0x31629c,'utf-8'),_0x4e26fb='#\x20prompt.md\x0a'+_0x512ed1+_0x538366(0x15d)+_0x562434,_0x2fe158=_0x538366(0x1b6)+_0x5559a5+_0x538366(0x15d)+_0x1cc5b9,_0x4beb6b=generateDiff(_0x4e26fb,_0x2fe158);_0xe3a454=hasChanges(_0x4beb6b),_0xe3a454&&(_0xdce6c5=formatDiffWithColors(_0x4beb6b));}_0x414814[_0x538366(0x223)]({'path':_0x1f11d5,'content':'','isDir':!![]}),_0x414814[_0x538366(0x223)]({'path':_0x5ec8a7,'content':_0x5559a5}),_0x414814['push']({'path':_0x31629c,'content':_0x1cc5b9});_0x2215eb&&_0x2215eb['includes']('\x0a')&&_0x414814[_0x538366(0x223)]({'path':_0x5c3d96,'content':_0x2215eb});_0x15725b['agents'][_0x538366(0x223)]({'agentName':_0x421c1e['attributes'][_0x538366(0x1c3)],'outputPath':_0x1f11d5,'isNew':_0x2e0e05,'hasChanges':_0xe3a454,'diff':_0xdce6c5}),_0x15725b['counts']['agents'][_0x538366(0x24d)]++;if(_0x2e0e05)_0x15725b[_0x538366(0x1df)][_0x538366(0x158)][_0x538366(0x1e1)]++;else{if(_0xe3a454)_0x15725b[_0x538366(0x1df)][_0x538366(0x158)]['updated']++;else _0x15725b[_0x538366(0x1df)][_0x538366(0x158)][_0x538366(0x1c6)]++;}}for(const _0x1f8eb4 of _0x4f75f2){if(_0x1f8eb4['attributes'][_0x538366(0x1ff)])continue;const _0xb755e3=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x295693),_0x1f8eb4[_0x538366(0x25c)][_0x538366(0x1c3)],_0x538366(0x18b));_0xb755e3[_0x538366(0x21b)]&&this['logger'][_0x538366(0x1d2)]('Renamed\x20KB\x20file:\x20'+a133_0xef4c6e[_0x538366(0x163)](_0xb755e3[_0x538366(0x211)])+_0x538366(0x210)+a133_0xef4c6e[_0x538366(0x163)](_0xb755e3['path']));const _0x50ff0f=_0xb755e3[_0x538366(0x17b)],_0x4e5c16=apiKnowledgeBaseToYaml(_0x1f8eb4),_0x25be99=toKnowledgeBaseYamlString(_0x4e5c16),_0x481afc=!a133_0x1783c4[_0x538366(0x25b)](_0x50ff0f);let _0x4275af=_0x481afc,_0x3c74b1;if(!_0x481afc){const _0xb60f0e=a133_0x1783c4[_0x538366(0x14e)](_0x50ff0f,_0x538366(0x1b3)),_0x5897f2=generateDiff(_0xb60f0e,_0x25be99);_0x4275af=hasChanges(_0x5897f2),_0x4275af&&(_0x3c74b1=formatDiffWithColors(_0x5897f2));}_0x414814[_0x538366(0x223)]({'path':_0x50ff0f,'content':_0x25be99}),_0x15725b[_0x538366(0x271)][_0x538366(0x223)]({'name':_0x1f8eb4[_0x538366(0x25c)][_0x538366(0x1c3)],'outputPath':_0x50ff0f,'isNew':_0x481afc,'hasChanges':_0x4275af,'diff':_0x3c74b1}),_0x15725b[_0x538366(0x1df)]['knowledgeBases'][_0x538366(0x24d)]++;if(_0x481afc)_0x15725b[_0x538366(0x1df)][_0x538366(0x271)][_0x538366(0x1e1)]++;else{if(_0x4275af)_0x15725b[_0x538366(0x1df)][_0x538366(0x271)][_0x538366(0x150)]++;else _0x15725b['counts'][_0x538366(0x271)][_0x538366(0x1c6)]++;}}for(const _0x2170b1 of _0x1f42a7){if(_0x2170b1['attributes']['isManaged'])continue;const _0x5d6e70=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x295693),_0x2170b1[_0x538366(0x25c)][_0x538366(0x1c3)],_0x538366(0x175));_0x5d6e70['renamed']&&this[_0x538366(0x19c)][_0x538366(0x1d2)](_0x538366(0x1f7)+a133_0xef4c6e['basename'](_0x5d6e70[_0x538366(0x211)])+_0x538366(0x210)+a133_0xef4c6e[_0x538366(0x163)](_0x5d6e70[_0x538366(0x17b)]));const _0x3a7f8e=_0x5d6e70[_0x538366(0x17b)],_0x2f77e6=toTextKnowledgeBaseMd(_0x2170b1[_0x538366(0x25c)]['name'],_0x2170b1[_0x538366(0x25c)][_0x538366(0x21e)]),_0x55501b=!a133_0x1783c4['existsSync'](_0x3a7f8e);let _0x4ab7f7=_0x55501b,_0x5cf478;if(!_0x55501b){const _0x23b305=a133_0x1783c4[_0x538366(0x14e)](_0x3a7f8e,_0x538366(0x1b3)),_0x5d9e58=generateDiff(_0x23b305,_0x2f77e6);_0x4ab7f7=hasChanges(_0x5d9e58),_0x4ab7f7&&(_0x5cf478=formatDiffWithColors(_0x5d9e58));}_0x414814['push']({'path':_0x3a7f8e,'content':_0x2f77e6}),_0x15725b[_0x538366(0x193)]['push']({'name':_0x2170b1[_0x538366(0x25c)][_0x538366(0x1c3)],'outputPath':_0x3a7f8e,'isNew':_0x55501b,'hasChanges':_0x4ab7f7,'diff':_0x5cf478}),_0x15725b[_0x538366(0x1df)]['textKnowledgeBases'][_0x538366(0x24d)]++;if(_0x55501b)_0x15725b[_0x538366(0x1df)][_0x538366(0x193)]['new']++;else{if(_0x4ab7f7)_0x15725b[_0x538366(0x1df)][_0x538366(0x193)][_0x538366(0x150)]++;else _0x15725b[_0x538366(0x1df)]['textKnowledgeBases'][_0x538366(0x1c6)]++;}}for(const _0x50d081 of _0x19fe7f){if(_0x50d081['attributes']['isManaged'])continue;const _0x58323f=getSanitizedPathWithMigration(getPromptsDir(_0x295693),_0x50d081['attributes'][_0x538366(0x1c3)],_0x538366(0x18b));_0x58323f[_0x538366(0x21b)]&&this['logger'][_0x538366(0x1d2)](_0x538366(0x182)+a133_0xef4c6e[_0x538366(0x163)](_0x58323f[_0x538366(0x211)])+'\x20→\x20'+a133_0xef4c6e[_0x538366(0x163)](_0x58323f[_0x538366(0x17b)]));const _0x568383=_0x58323f[_0x538366(0x17b)],_0x3b983b=await apiPromptToYaml(_0x50d081,_0x15bdb9);if(!_0x3b983b)continue;const _0x58a70e=toPromptYamlString(_0x3b983b),_0x24a9b1=!a133_0x1783c4[_0x538366(0x25b)](_0x568383);let _0x1d4e67=_0x24a9b1,_0x4e24f8;if(!_0x24a9b1){const _0x1dc34c=a133_0x1783c4['readFileSync'](_0x568383,_0x538366(0x1b3)),_0x443f5f=generateDiff(_0x1dc34c,_0x58a70e);_0x1d4e67=hasChanges(_0x443f5f),_0x1d4e67&&(_0x4e24f8=formatDiffWithColors(_0x443f5f));}_0x414814[_0x538366(0x223)]({'path':_0x568383,'content':_0x58a70e}),_0x15725b['prompts'][_0x538366(0x223)]({'name':_0x50d081['attributes'][_0x538366(0x1c3)],'outputPath':_0x568383,'isNew':_0x24a9b1,'hasChanges':_0x1d4e67,'diff':_0x4e24f8}),_0x15725b[_0x538366(0x1df)][_0x538366(0x147)][_0x538366(0x24d)]++;if(_0x24a9b1)_0x15725b[_0x538366(0x1df)][_0x538366(0x147)][_0x538366(0x1e1)]++;else{if(_0x1d4e67)_0x15725b[_0x538366(0x1df)][_0x538366(0x147)][_0x538366(0x150)]++;else _0x15725b[_0x538366(0x1df)][_0x538366(0x147)][_0x538366(0x1c6)]++;}}for(const _0x139cd8 of _0x10e1df){const _0x97bf7a=_0x139cd8[_0x538366(0x25c)][_0x538366(0x1ee)][_0x538366(0x21c)](),_0x528027=getSanitizedPathWithMigration(getIntegrationsDir(_0x295693),_0x97bf7a,_0x538366(0x18b));_0x528027[_0x538366(0x21b)]&&this[_0x538366(0x19c)][_0x538366(0x1d2)](_0x538366(0x23b)+a133_0xef4c6e['basename'](_0x528027[_0x538366(0x211)])+_0x538366(0x210)+a133_0xef4c6e[_0x538366(0x163)](_0x528027[_0x538366(0x17b)]));const _0x1b66ce=_0x528027[_0x538366(0x17b)],_0x4f8015=await apiIntegrationToYaml(_0x139cd8,_0x15bdb9),_0x59f427=toIntegrationYamlString(_0x4f8015),_0x230f30=!a133_0x1783c4[_0x538366(0x25b)](_0x1b66ce);let _0x56ab1a=_0x230f30,_0x245fa0;if(!_0x230f30){const _0x551b80=a133_0x1783c4[_0x538366(0x14e)](_0x1b66ce,_0x538366(0x1b3)),_0x1215a1=generateDiff(_0x551b80,_0x59f427);_0x56ab1a=hasChanges(_0x1215a1),_0x56ab1a&&(_0x245fa0=formatDiffWithColors(_0x1215a1));}_0x414814[_0x538366(0x223)]({'path':_0x1b66ce,'content':_0x59f427}),_0x15725b[_0x538366(0x1bd)]['push']({'name':_0x97bf7a,'outputPath':_0x1b66ce,'isNew':_0x230f30,'hasChanges':_0x56ab1a,'diff':_0x245fa0}),_0x15725b[_0x538366(0x1df)][_0x538366(0x1bd)]['total']++;if(_0x230f30)_0x15725b['counts'][_0x538366(0x1bd)][_0x538366(0x1e1)]++;else{if(_0x56ab1a)_0x15725b[_0x538366(0x1df)]['integrations'][_0x538366(0x150)]++;else _0x15725b[_0x538366(0x1df)][_0x538366(0x1bd)][_0x538366(0x1c6)]++;}}for(const _0x25daac of _0x41543b){if(_0x25daac['attributes']['isManaged'])continue;const _0xd42e82=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x295693),_0x25daac[_0x538366(0x25c)]['name']);_0xd42e82[_0x538366(0x21b)]&&this[_0x538366(0x19c)][_0x538366(0x1d2)]('Renamed\x20experimental\x20KB\x20directory:\x20'+a133_0xef4c6e[_0x538366(0x163)](_0xd42e82[_0x538366(0x211)])+_0x538366(0x210)+a133_0xef4c6e[_0x538366(0x163)](_0xd42e82[_0x538366(0x17b)]));const _0x5890d4=_0xd42e82['path'],_0x29e34c=a133_0xef4c6e[_0x538366(0x20c)](_0x5890d4,sanitizeForFilesystem(_0x25daac[_0x538366(0x25c)]['name'])+_0x538366(0x18b)),_0x20ef60=a133_0xef4c6e[_0x538366(0x20c)](_0x5890d4,_0x538366(0x1cd)),_0x2d7b11=apiExperimentalKnowledgeBaseToYaml(_0x25daac),_0x122afb=toExperimentalKnowledgeBaseYamlString(_0x2d7b11),_0x3ea000=!a133_0x1783c4[_0x538366(0x25b)](_0x5890d4);let _0x1cd24d=_0x3ea000,_0x557ddd,_0xfef428=_0x122afb;const _0x28ee11=[..._0x2d7b11[_0x538366(0x1cd)]][_0x538366(0x15a)]((_0x2d6de8,_0x38ba77)=>_0x2d6de8['name'][_0x538366(0x240)](_0x38ba77['name']));for(const _0x43f0dd of _0x28ee11){_0xfef428+='\x0a---\x20function:\x20'+_0x43f0dd['name']+_0x538366(0x202)+_0x43f0dd[_0x538366(0x212)]+_0x538366(0x1c4)+_0x43f0dd[_0x538366(0x1c3)]+_0x538366(0x202)+_0x43f0dd['json_schema']+'\x0a';}if(!_0x3ea000){let _0x5f39e4='';a133_0x1783c4[_0x538366(0x25b)](_0x29e34c)&&(_0x5f39e4=a133_0x1783c4[_0x538366(0x14e)](_0x29e34c,_0x538366(0x1b3)));if(a133_0x1783c4[_0x538366(0x25b)](_0x20ef60)){const _0x39d027=a133_0x1783c4[_0x538366(0x1fb)](_0x20ef60,{'withFileTypes':!![]}),_0x548b87=_0x39d027[_0x538366(0x23e)](_0x599f18=>_0x599f18['isDirectory']())[_0x538366(0x15a)]((_0x1d6d6f,_0x26f89e)=>_0x1d6d6f[_0x538366(0x1c3)]['localeCompare'](_0x26f89e[_0x538366(0x1c3)]));for(const _0x147f1a of _0x548b87){const _0x43bf9b=a133_0xef4c6e[_0x538366(0x20c)](_0x20ef60,_0x147f1a[_0x538366(0x1c3)],_0x538366(0x16f)),_0x314866=a133_0xef4c6e['join'](_0x20ef60,_0x147f1a[_0x538366(0x1c3)],'json_schema.json');a133_0x1783c4[_0x538366(0x25b)](_0x43bf9b)&&(_0x5f39e4+='\x0a---\x20function:\x20'+_0x147f1a['name']+_0x538366(0x202)+a133_0x1783c4[_0x538366(0x14e)](_0x43bf9b,'utf-8')+'\x0a'),a133_0x1783c4['existsSync'](_0x314866)&&(_0x5f39e4+=_0x538366(0x16a)+_0x147f1a[_0x538366(0x1c3)]+_0x538366(0x202)+a133_0x1783c4[_0x538366(0x14e)](_0x314866,_0x538366(0x1b3))+'\x0a');}}const _0x525407=generateDiff(_0x5f39e4,_0xfef428);_0x1cd24d=hasChanges(_0x525407),_0x1cd24d&&(_0x557ddd=formatDiffWithColors(_0x525407));}_0x414814[_0x538366(0x223)]({'path':_0x5890d4,'content':'','isDir':!![]}),_0x414814['push']({'path':_0x29e34c,'content':_0x122afb}),_0x414814[_0x538366(0x223)]({'path':_0x20ef60,'content':'','isDir':!![]});for(const _0x2575ce of _0x2d7b11[_0x538366(0x1cd)]){const _0x404d44=a133_0xef4c6e[_0x538366(0x20c)](_0x20ef60,sanitizeForFilesystem(_0x2575ce[_0x538366(0x1c3)])),_0x3dc3a8=a133_0xef4c6e[_0x538366(0x20c)](_0x404d44,_0x538366(0x16f)),_0x47dd5b=a133_0xef4c6e['join'](_0x404d44,'json_schema.json');_0x414814['push']({'path':_0x404d44,'content':'','isDir':!![]}),_0x414814['push']({'path':_0x3dc3a8,'content':_0x2575ce[_0x538366(0x212)]}),_0x414814[_0x538366(0x223)]({'path':_0x47dd5b,'content':_0x2575ce[_0x538366(0x206)]});}if(a133_0x1783c4[_0x538366(0x25b)](_0x20ef60)){const _0x107db3=a133_0x1783c4[_0x538366(0x1fb)](_0x20ef60,{'withFileTypes':!![]}),_0x5d4cba=new Set(_0x2d7b11[_0x538366(0x1cd)][_0x538366(0x227)](_0xac2041=>sanitizeForFilesystem(_0xac2041['name'])));for(const _0x33f5a2 of _0x107db3){if(_0x33f5a2[_0x538366(0x1cb)]()&&!_0x5d4cba[_0x538366(0x1bc)](_0x33f5a2[_0x538366(0x1c3)])){const _0x7bea2f=a133_0xef4c6e[_0x538366(0x20c)](_0x20ef60,_0x33f5a2[_0x538366(0x1c3)]);_0x1c2308[_0x538366(0x223)]({'path':_0x7bea2f,'isDir':!![]});}}}_0x15725b[_0x538366(0x24e)][_0x538366(0x223)]({'name':_0x25daac[_0x538366(0x25c)][_0x538366(0x1c3)],'outputPath':_0x5890d4,'isNew':_0x3ea000,'hasChanges':_0x1cd24d,'diff':_0x557ddd}),_0x15725b[_0x538366(0x1df)]['experimentalKnowledgeBases']['total']++;if(_0x3ea000)_0x15725b['counts'][_0x538366(0x24e)][_0x538366(0x1e1)]++;else{if(_0x1cd24d)_0x15725b[_0x538366(0x1df)][_0x538366(0x24e)][_0x538366(0x150)]++;else _0x15725b['counts']['experimentalKnowledgeBases'][_0x538366(0x1c6)]++;}}for(const _0x302e5c of _0x15e6a9){if(_0x302e5c[_0x538366(0x25c)][_0x538366(0x1ff)])continue;const _0xce47b6=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x295693),_0x302e5c['attributes'][_0x538366(0x1c3)]);_0xce47b6[_0x538366(0x21b)]&&this[_0x538366(0x19c)]['info'](_0x538366(0x156)+a133_0xef4c6e[_0x538366(0x163)](_0xce47b6[_0x538366(0x211)])+_0x538366(0x210)+a133_0xef4c6e[_0x538366(0x163)](_0xce47b6['path']));const _0x2ce734=_0xce47b6['path'],_0x1f1645=a133_0xef4c6e[_0x538366(0x20c)](_0x2ce734,sanitizeForFilesystem(_0x302e5c[_0x538366(0x25c)][_0x538366(0x1c3)])+_0x538366(0x18b)),_0xbda998=a133_0xef4c6e[_0x538366(0x20c)](_0x2ce734,'code.js'),_0x5a2ed5=a133_0xef4c6e[_0x538366(0x20c)](_0x2ce734,_0x538366(0x1cc)),_0x1de0d1=apiExperimentalArtifactToYaml(_0x302e5c),_0x75e78e=toExperimentalArtifactYamlString(_0x1de0d1),_0x48f210=!a133_0x1783c4['existsSync'](_0x2ce734);let _0x44716a=_0x48f210,_0x24ed23,_0x47c11f=_0x75e78e+(_0x538366(0x219)+_0x1de0d1[_0x538366(0x212)]+'\x0a');const _0x36c780=[..._0x1de0d1[_0x538366(0x1cc)]][_0x538366(0x15a)]((_0x5deaea,_0x15d030)=>_0x5deaea['file_name']['localeCompare'](_0x15d030[_0x538366(0x204)]));for(const _0xbb8b7c of _0x36c780){_0x47c11f+=_0x538366(0x1d1)+_0xbb8b7c[_0x538366(0x204)]+_0x538366(0x202)+_0xbb8b7c['text_content']+'\x0a';}if(!_0x48f210){let _0x48f60a='';a133_0x1783c4['existsSync'](_0x1f1645)&&(_0x48f60a=a133_0x1783c4['readFileSync'](_0x1f1645,_0x538366(0x1b3)));a133_0x1783c4['existsSync'](_0xbda998)&&(_0x48f60a+=_0x538366(0x219)+a133_0x1783c4[_0x538366(0x14e)](_0xbda998,_0x538366(0x1b3))+'\x0a');if(a133_0x1783c4['existsSync'](_0x5a2ed5)){const _0x98a549=a133_0x1783c4[_0x538366(0x1fb)](_0x5a2ed5),_0x52c404=_0x98a549[_0x538366(0x23e)](_0x70d97=>{const _0x385fd2=_0x538366,_0x4809b5=a133_0xef4c6e[_0x385fd2(0x20c)](_0x5a2ed5,_0x70d97);return a133_0x1783c4[_0x385fd2(0x1bb)](_0x4809b5)[_0x385fd2(0x24b)]();})[_0x538366(0x15a)]((_0x343ec0,_0x2685c4)=>_0x343ec0[_0x538366(0x240)](_0x2685c4));for(const _0x59f68c of _0x52c404){const _0x3f8885=a133_0xef4c6e['join'](_0x5a2ed5,_0x59f68c);_0x48f60a+=_0x538366(0x1d1)+_0x59f68c+_0x538366(0x202)+a133_0x1783c4[_0x538366(0x14e)](_0x3f8885,_0x538366(0x1b3))+'\x0a';}}const _0x3af482=generateDiff(_0x48f60a,_0x47c11f);_0x44716a=hasChanges(_0x3af482),_0x44716a&&(_0x24ed23=formatDiffWithColors(_0x3af482));}_0x414814[_0x538366(0x223)]({'path':_0x2ce734,'content':'','isDir':!![]}),_0x414814[_0x538366(0x223)]({'path':_0x1f1645,'content':_0x75e78e}),_0x414814['push']({'path':_0xbda998,'content':_0x1de0d1[_0x538366(0x212)]});if(_0x1de0d1[_0x538366(0x1cc)]['length']>0x0){_0x414814[_0x538366(0x223)]({'path':_0x5a2ed5,'content':'','isDir':!![]});for(const _0xe8aa30 of _0x1de0d1['files']){const _0xc72b32=a133_0xef4c6e[_0x538366(0x20c)](_0x5a2ed5,_0xe8aa30[_0x538366(0x204)]);_0x414814['push']({'path':_0xc72b32,'content':_0xe8aa30[_0x538366(0x152)]});}}if(a133_0x1783c4[_0x538366(0x25b)](_0x5a2ed5)){const _0x152602=a133_0x1783c4[_0x538366(0x1fb)](_0x5a2ed5),_0x1a9f8e=new Set(_0x1de0d1[_0x538366(0x1cc)]['map'](_0x50d0f7=>_0x50d0f7['file_name']));for(const _0x3153da of _0x152602){const _0x3c3145=a133_0xef4c6e[_0x538366(0x20c)](_0x5a2ed5,_0x3153da);a133_0x1783c4[_0x538366(0x1bb)](_0x3c3145)[_0x538366(0x24b)]()&&!_0x1a9f8e['has'](_0x3153da)&&_0x1c2308['push']({'path':_0x3c3145});}}_0x15725b[_0x538366(0x1b7)]['push']({'name':_0x302e5c[_0x538366(0x25c)][_0x538366(0x1c3)],'outputPath':_0x2ce734,'isNew':_0x48f210,'hasChanges':_0x44716a,'diff':_0x24ed23}),_0x15725b[_0x538366(0x1df)][_0x538366(0x1b7)][_0x538366(0x24d)]++;if(_0x48f210)_0x15725b[_0x538366(0x1df)]['experimentalArtifacts'][_0x538366(0x1e1)]++;else{if(_0x44716a)_0x15725b[_0x538366(0x1df)][_0x538366(0x1b7)][_0x538366(0x150)]++;else _0x15725b[_0x538366(0x1df)][_0x538366(0x1b7)][_0x538366(0x1c6)]++;}}for(const _0x41299a of _0x331203){const _0x918bf8=getSanitizedPathWithMigration(getFormInterfacesDir(_0x295693),_0x41299a[_0x538366(0x25c)]['name'],_0x538366(0x18b));_0x918bf8['renamed']&&this[_0x538366(0x19c)]['info'](_0x538366(0x201)+a133_0xef4c6e[_0x538366(0x163)](_0x918bf8[_0x538366(0x211)])+_0x538366(0x210)+a133_0xef4c6e[_0x538366(0x163)](_0x918bf8[_0x538366(0x17b)]));const _0x406931=_0x918bf8[_0x538366(0x17b)],_0x5b053b=await apiFormInterfaceToYaml(_0x41299a,_0x15bdb9),_0x400b5c=toFormInterfaceYamlString(_0x5b053b),_0x24e590=!a133_0x1783c4[_0x538366(0x25b)](_0x406931);let _0x52edd0=_0x24e590,_0x3dfd86;if(!_0x24e590){const _0x44737a=a133_0x1783c4[_0x538366(0x14e)](_0x406931,_0x538366(0x1b3)),_0x4d47f7=generateDiff(_0x44737a,_0x400b5c);_0x52edd0=hasChanges(_0x4d47f7),_0x52edd0&&(_0x3dfd86=formatDiffWithColors(_0x4d47f7));}_0x414814[_0x538366(0x223)]({'path':_0x406931,'content':_0x400b5c}),_0x15725b[_0x538366(0x18d)][_0x538366(0x223)]({'name':_0x41299a[_0x538366(0x25c)][_0x538366(0x1c3)],'outputPath':_0x406931,'isNew':_0x24e590,'hasChanges':_0x52edd0,'diff':_0x3dfd86}),_0x15725b[_0x538366(0x1df)]['formInterfaces'][_0x538366(0x24d)]++;if(_0x24e590)_0x15725b[_0x538366(0x1df)][_0x538366(0x18d)][_0x538366(0x1e1)]++;else{if(_0x52edd0)_0x15725b[_0x538366(0x1df)][_0x538366(0x18d)][_0x538366(0x150)]++;else _0x15725b[_0x538366(0x1df)][_0x538366(0x18d)][_0x538366(0x1c6)]++;}}for(const _0x494349 of _0x499f09){if(_0x494349['attributes'][_0x538366(0x1ff)])continue;const _0x411cb6=getSanitizedPathWithMigration(getChatInterfacesDir(_0x295693),_0x494349[_0x538366(0x25c)]['name'],_0x538366(0x18b));_0x411cb6['renamed']&&this[_0x538366(0x19c)][_0x538366(0x1d2)]('Renamed\x20chat\x20interface\x20file:\x20'+a133_0xef4c6e[_0x538366(0x163)](_0x411cb6[_0x538366(0x211)])+_0x538366(0x210)+a133_0xef4c6e['basename'](_0x411cb6[_0x538366(0x17b)]));const _0xbfc0e7=_0x411cb6['path'],_0x166735=await apiChatInterfaceToYaml(_0x494349,_0x15bdb9),_0x35de06=toChatInterfaceYamlString(_0x166735),_0x53b347=!a133_0x1783c4[_0x538366(0x25b)](_0xbfc0e7);let _0x18908e=_0x53b347,_0x473766;if(!_0x53b347){const _0x36d714=a133_0x1783c4[_0x538366(0x14e)](_0xbfc0e7,_0x538366(0x1b3)),_0x43a23a=generateDiff(_0x36d714,_0x35de06);_0x18908e=hasChanges(_0x43a23a),_0x18908e&&(_0x473766=formatDiffWithColors(_0x43a23a));}_0x414814[_0x538366(0x223)]({'path':_0xbfc0e7,'content':_0x35de06}),_0x15725b['chatInterfaces'][_0x538366(0x223)]({'name':_0x494349[_0x538366(0x25c)][_0x538366(0x1c3)],'outputPath':_0xbfc0e7,'isNew':_0x53b347,'hasChanges':_0x18908e,'diff':_0x473766}),_0x15725b['counts'][_0x538366(0x146)]['total']++;if(_0x53b347)_0x15725b[_0x538366(0x1df)][_0x538366(0x146)][_0x538366(0x1e1)]++;else{if(_0x18908e)_0x15725b[_0x538366(0x1df)][_0x538366(0x146)][_0x538366(0x150)]++;else _0x15725b['counts']['chatInterfaces'][_0x538366(0x1c6)]++;}}if(_0x11922d?.['dryRun'])return _0x15725b;a133_0x1783c4[_0x538366(0x237)](_0x295693,{'recursive':!![]}),a133_0x1783c4['mkdirSync'](getKnowledgeBasesDir(_0x295693),{'recursive':!![]}),a133_0x1783c4['mkdirSync'](getPromptsDir(_0x295693),{'recursive':!![]}),a133_0x1783c4[_0x538366(0x237)](getIntegrationsDir(_0x295693),{'recursive':!![]}),a133_0x1783c4['mkdirSync'](getExperimentalKnowledgeBasesDir(_0x295693),{'recursive':!![]}),a133_0x1783c4[_0x538366(0x237)](getExperimentalArtifactsDir(_0x295693),{'recursive':!![]}),a133_0x1783c4[_0x538366(0x237)](getFormInterfacesDir(_0x295693),{'recursive':!![]}),a133_0x1783c4[_0x538366(0x237)](getChatInterfacesDir(_0x295693),{'recursive':!![]});const _0x5dd49f=a133_0xef4c6e[_0x538366(0x20c)](_0x295693,_0x538366(0x17d));a133_0x1783c4['writeFileSync'](_0x5dd49f,createAgentConfigContent(_0x5b1020));for(const _0x4c4c04 of _0x414814){if(_0x4c4c04[_0x538366(0x238)])a133_0x1783c4['mkdirSync'](_0x4c4c04[_0x538366(0x17b)],{'recursive':!![]});else{const _0x34c9a4=a133_0xef4c6e[_0x538366(0x166)](_0x4c4c04[_0x538366(0x17b)]);!a133_0x1783c4[_0x538366(0x25b)](_0x34c9a4)&&a133_0x1783c4[_0x538366(0x237)](_0x34c9a4,{'recursive':!![]}),a133_0x1783c4[_0x538366(0x192)](_0x4c4c04['path'],_0x4c4c04[_0x538366(0x1fe)]);}}for(const _0x227440 of _0x1c2308){_0x227440[_0x538366(0x238)]?(a133_0x1783c4['rmSync'](_0x227440[_0x538366(0x17b)],{'recursive':!![],'force':!![]}),this[_0x538366(0x19c)][_0x538366(0x1d2)](_0x538366(0x1da)+a133_0xef4c6e[_0x538366(0x163)](a133_0xef4c6e['dirname'](_0x227440['path']))+'/'+a133_0xef4c6e[_0x538366(0x163)](_0x227440[_0x538366(0x17b)]))):(a133_0x1783c4['rmSync'](_0x227440[_0x538366(0x17b)],{'force':!![]}),this['logger']['info'](_0x538366(0x187)+a133_0xef4c6e[_0x538366(0x163)](a133_0xef4c6e[_0x538366(0x166)](_0x227440[_0x538366(0x17b)]))+'/'+a133_0xef4c6e[_0x538366(0x163)](_0x227440[_0x538366(0x17b)])));}return _0x15725b;}async['pushProject'](_0x1d7b3,_0x5a0e59){const _0x4a669d=a133_0x209be5,_0x569916=a133_0xef4c6e[_0x4a669d(0x20c)](_0x1d7b3,_0x4a669d(0x17d));if(!a133_0x1783c4[_0x4a669d(0x25b)](_0x569916))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'No\x20tdx.json\x20found\x20in\x20'+_0x1d7b3,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x599d35=loadAgentConfig(_0x569916),_0x565e76=await this['resolveProjectId'](_0x599d35[_0x4a669d(0x249)]),_0x12ac4a=await this[_0x4a669d(0x1dc)][_0x4a669d(0x267)](_0x565e76),_0x53ba24=_0x12ac4a['attributes'][_0x4a669d(0x1c3)],_0x43ab40={'projectName':_0x53ba24,'projectId':_0x565e76,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'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},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x5d79e7=[],_0x3ae44c=[],_0x1e0a86=[],_0x47b54e=[],_0x4f4653=[],_0x3673d9=[],_0x3dfdbc=a133_0x1783c4['readdirSync'](_0x1d7b3,{'withFileTypes':!![]});for(const _0x305209 of _0x3dfdbc){if(!_0x305209[_0x4a669d(0x1cb)]())continue;if(['knowledge_bases',_0x4a669d(0x147),_0x4a669d(0x1bd),_0x4a669d(0x1d6),_0x4a669d(0x17a),'form_interfaces',_0x4a669d(0x248)][_0x4a669d(0x1e5)](_0x305209['name']))continue;const _0x235950=a133_0xef4c6e[_0x4a669d(0x20c)](_0x1d7b3,_0x305209[_0x4a669d(0x1c3)]);if(isAgentDir(_0x235950)){const _0x49c262=a133_0xef4c6e[_0x4a669d(0x20c)](_0x235950,_0x4a669d(0x256)),_0x18db1f=a133_0xef4c6e[_0x4a669d(0x20c)](_0x235950,'prompt.md'),_0x46838c=a133_0xef4c6e[_0x4a669d(0x20c)](_0x235950,_0x4a669d(0x266)),_0x20f0bd=parseAgentYaml(a133_0x1783c4[_0x4a669d(0x14e)](_0x49c262,_0x4a669d(0x1b3)),_0x49c262),_0x1723ba=a133_0x1783c4[_0x4a669d(0x25b)](_0x18db1f)?a133_0x1783c4['readFileSync'](_0x18db1f,_0x4a669d(0x1b3)):'',_0x85a63b=a133_0x1783c4['existsSync'](_0x46838c)?a133_0x1783c4[_0x4a669d(0x14e)](_0x46838c,'utf-8'):_0x20f0bd[_0x4a669d(0x181)];_0x5d79e7[_0x4a669d(0x223)]({'name':_0x20f0bd[_0x4a669d(0x1c3)],'dir':_0x235950,'yaml':_0x20f0bd,'systemPrompt':_0x1723ba,'starterMessage':_0x85a63b});}}const _0x491247=getKnowledgeBasesDir(_0x1d7b3);if(a133_0x1783c4[_0x4a669d(0x25b)](_0x491247)){const _0x5ce7db=a133_0x1783c4[_0x4a669d(0x1fb)](_0x491247);for(const _0x33a331 of _0x5ce7db){const _0x18e106=a133_0xef4c6e[_0x4a669d(0x20c)](_0x491247,_0x33a331);if(_0x33a331['endsWith'](_0x4a669d(0x18b))){const _0x468db7=parseKnowledgeBaseYaml(a133_0x1783c4[_0x4a669d(0x14e)](_0x18e106,'utf-8'),_0x18e106);_0x3ae44c[_0x4a669d(0x223)]({'name':_0x468db7['name'],'path':_0x18e106,'yaml':_0x468db7});}else{if(_0x33a331[_0x4a669d(0x26a)]('.md')){const _0x41f6f6=a133_0x1783c4[_0x4a669d(0x14e)](_0x18e106,_0x4a669d(0x1b3)),{name:_0x547b2f,text:_0x11fa9e}=parseTextKnowledgeBaseMd(_0x41f6f6,_0x33a331);_0x1e0a86[_0x4a669d(0x223)]({'name':_0x547b2f,'path':_0x18e106,'text':_0x11fa9e});}}}}const _0xc7d447=getPromptsDir(_0x1d7b3);if(a133_0x1783c4[_0x4a669d(0x25b)](_0xc7d447)){const _0x11bdda=a133_0x1783c4[_0x4a669d(0x1fb)](_0xc7d447)['filter'](_0x35f876=>_0x35f876['endsWith'](_0x4a669d(0x18b)));for(const _0x3b20a2 of _0x11bdda){const _0x45d872=a133_0xef4c6e[_0x4a669d(0x20c)](_0xc7d447,_0x3b20a2),_0x3dac68=parsePromptYaml(a133_0x1783c4['readFileSync'](_0x45d872,_0x4a669d(0x1b3)),_0x45d872);_0x47b54e[_0x4a669d(0x223)]({'name':_0x3dac68['name'],'path':_0x45d872,'yaml':_0x3dac68});}}const _0x48adde=[],_0x1177a7=getIntegrationsDir(_0x1d7b3);if(a133_0x1783c4[_0x4a669d(0x25b)](_0x1177a7)){const _0x2a16ad=a133_0x1783c4[_0x4a669d(0x1fb)](_0x1177a7)[_0x4a669d(0x23e)](_0xd7cb23=>_0xd7cb23[_0x4a669d(0x26a)](_0x4a669d(0x18b)));for(const _0x1eb202 of _0x2a16ad){const _0x378d0b=a133_0xef4c6e[_0x4a669d(0x20c)](_0x1177a7,_0x1eb202),_0x1340f4=parseIntegrationYaml(a133_0x1783c4['readFileSync'](_0x378d0b,_0x4a669d(0x1b3)),_0x378d0b);if(!SAFE_INTEGRATION_TYPES[_0x4a669d(0x1e5)](_0x1340f4[_0x4a669d(0x184)][_0x4a669d(0x21c)]())){this['logger'][_0x4a669d(0x270)](_0x4a669d(0x161)+_0x1340f4[_0x4a669d(0x1c3)]+'\x27\x20('+_0x1340f4[_0x4a669d(0x184)]+_0x4a669d(0x148)+(_0x4a669d(0x24a)+SAFE_INTEGRATION_TYPES[_0x4a669d(0x20c)](',\x20')+_0x4a669d(0x233))+_0x4a669d(0x172));continue;}_0x48adde['push']({'name':_0x1340f4[_0x4a669d(0x1c3)],'path':_0x378d0b,'yaml':_0x1340f4});}}const _0x67ac30=getExperimentalKnowledgeBasesDir(_0x1d7b3);if(a133_0x1783c4['existsSync'](_0x67ac30)){const _0x3ed81a=a133_0x1783c4[_0x4a669d(0x1fb)](_0x67ac30,{'withFileTypes':!![]});for(const _0x4ccb5e of _0x3ed81a){if(!_0x4ccb5e[_0x4a669d(0x1cb)]())continue;const _0x603b6b=a133_0xef4c6e[_0x4a669d(0x20c)](_0x67ac30,_0x4ccb5e[_0x4a669d(0x1c3)]),_0x59b994=a133_0xef4c6e['join'](_0x603b6b,_0x4ccb5e[_0x4a669d(0x1c3)]+_0x4a669d(0x18b)),_0x203681=a133_0xef4c6e[_0x4a669d(0x20c)](_0x603b6b,_0x4a669d(0x1cd));if(!a133_0x1783c4[_0x4a669d(0x25b)](_0x59b994))continue;const _0x9961b5=parseExperimentalKnowledgeBaseYaml(a133_0x1783c4['readFileSync'](_0x59b994,_0x4a669d(0x1b3)),_0x59b994),_0x1330fe=[];if(a133_0x1783c4[_0x4a669d(0x25b)](_0x203681)){const _0x5c6f5e=a133_0x1783c4['readdirSync'](_0x203681,{'withFileTypes':!![]});for(const _0x5efd16 of _0x5c6f5e){if(!_0x5efd16[_0x4a669d(0x1cb)]())continue;const _0x43f4e5=a133_0xef4c6e[_0x4a669d(0x20c)](_0x203681,_0x5efd16['name']),_0x2f777e=a133_0xef4c6e[_0x4a669d(0x20c)](_0x43f4e5,'code.js'),_0xa93ea8=a133_0xef4c6e[_0x4a669d(0x20c)](_0x43f4e5,_0x4a669d(0x21a));a133_0x1783c4[_0x4a669d(0x25b)](_0x2f777e)&&a133_0x1783c4['existsSync'](_0xa93ea8)&&_0x1330fe[_0x4a669d(0x223)]({'name':_0x5efd16[_0x4a669d(0x1c3)],'code':a133_0x1783c4[_0x4a669d(0x14e)](_0x2f777e,_0x4a669d(0x1b3)),'json_schema':a133_0x1783c4[_0x4a669d(0x14e)](_0xa93ea8,_0x4a669d(0x1b3))});}}const _0x44924c={..._0x9961b5,'variables':_0x9961b5[_0x4a669d(0x143)]||[],'functions':_0x1330fe};_0x4f4653[_0x4a669d(0x223)]({'name':_0x9961b5['name'],'dir':_0x603b6b,'def':_0x44924c});}}const _0x80376=getExperimentalArtifactsDir(_0x1d7b3);if(a133_0x1783c4[_0x4a669d(0x25b)](_0x80376)){const _0x2b83be=a133_0x1783c4[_0x4a669d(0x1fb)](_0x80376,{'withFileTypes':!![]});for(const _0x23ea7f of _0x2b83be){if(!_0x23ea7f['isDirectory']())continue;const _0x956fc9=a133_0xef4c6e['join'](_0x80376,_0x23ea7f[_0x4a669d(0x1c3)]),_0x2b1180=a133_0xef4c6e['join'](_0x956fc9,_0x23ea7f[_0x4a669d(0x1c3)]+_0x4a669d(0x18b)),_0x55860e=a133_0xef4c6e[_0x4a669d(0x20c)](_0x956fc9,_0x4a669d(0x16f)),_0x5d5180=a133_0xef4c6e[_0x4a669d(0x20c)](_0x956fc9,'files');if(!a133_0x1783c4[_0x4a669d(0x25b)](_0x2b1180)||!a133_0x1783c4[_0x4a669d(0x25b)](_0x55860e))continue;const _0x10238b=parseExperimentalArtifactYaml(a133_0x1783c4[_0x4a669d(0x14e)](_0x2b1180,'utf-8'),_0x2b1180),_0xf2ab8=a133_0x1783c4[_0x4a669d(0x14e)](_0x55860e,'utf-8'),_0x207cc6=[];if(a133_0x1783c4['existsSync'](_0x5d5180)){const _0x727cde=a133_0x1783c4['readdirSync'](_0x5d5180);for(const _0x74f476 of _0x727cde){const _0x2eb75b=a133_0xef4c6e['join'](_0x5d5180,_0x74f476);a133_0x1783c4[_0x4a669d(0x1bb)](_0x2eb75b)[_0x4a669d(0x24b)]()&&_0x207cc6[_0x4a669d(0x223)]({'file_name':_0x74f476,'text_content':a133_0x1783c4[_0x4a669d(0x14e)](_0x2eb75b,'utf-8')});}}const _0x5631c1={..._0x10238b,'code':_0xf2ab8,'files':_0x207cc6};_0x3673d9[_0x4a669d(0x223)]({'name':_0x10238b[_0x4a669d(0x1c3)],'dir':_0x956fc9,'def':_0x5631c1});}}const _0x3d17ff=[],_0x450653=getFormInterfacesDir(_0x1d7b3);if(a133_0x1783c4[_0x4a669d(0x25b)](_0x450653)){const _0x29d25b=a133_0x1783c4[_0x4a669d(0x1fb)](_0x450653)[_0x4a669d(0x23e)](_0x2e5a13=>_0x2e5a13[_0x4a669d(0x26a)]('.yml'));for(const _0x27d1cd of _0x29d25b){const _0xc66abd=a133_0xef4c6e[_0x4a669d(0x20c)](_0x450653,_0x27d1cd),_0x4e65d4=parseFormInterfaceYaml(a133_0x1783c4['readFileSync'](_0xc66abd,'utf-8'),_0xc66abd);_0x3d17ff[_0x4a669d(0x223)]({'name':_0x4e65d4['name'],'path':_0xc66abd,'yaml':_0x4e65d4});}}const _0x5bd0e5=[],_0x26cc3e=getChatInterfacesDir(_0x1d7b3);if(a133_0x1783c4[_0x4a669d(0x25b)](_0x26cc3e)){const _0x7a6a83=a133_0x1783c4['readdirSync'](_0x26cc3e)[_0x4a669d(0x23e)](_0x72ab27=>_0x72ab27['endsWith'](_0x4a669d(0x18b)));for(const _0x17d7b0 of _0x7a6a83){const _0x7db49d=a133_0xef4c6e[_0x4a669d(0x20c)](_0x26cc3e,_0x17d7b0),_0x1eb124=parseChatInterfaceYaml(a133_0x1783c4['readFileSync'](_0x7db49d,'utf-8'),_0x7db49d);_0x5bd0e5[_0x4a669d(0x223)]({'name':_0x1eb124[_0x4a669d(0x1c3)],'path':_0x7db49d,'yaml':_0x1eb124});}}const _0x158d2a=await this[_0x4a669d(0x1dc)][_0x4a669d(0x1f2)](_0x565e76),_0x285aaf=await this[_0x4a669d(0x1dc)]['listKnowledgeBases'](_0x565e76),_0x15dd15=await this[_0x4a669d(0x1dc)]['listTextKnowledgeBases'](_0x565e76),_0x50b808=await this[_0x4a669d(0x1dc)][_0x4a669d(0x1bf)](_0x565e76),_0x5eae18=await this[_0x4a669d(0x1dc)][_0x4a669d(0x1e4)](_0x565e76),_0x23b13b=await safeListOrEmpty(()=>this[_0x4a669d(0x1dc)][_0x4a669d(0x1e0)](_0x565e76)),_0x3e45ff=await safeListOrEmpty(()=>this[_0x4a669d(0x1dc)][_0x4a669d(0x23d)](_0x565e76)),_0xd72d48=await safeListOrEmpty(()=>this[_0x4a669d(0x1dc)][_0x4a669d(0x1a0)](_0x565e76)),_0x413d07=await safeListOrEmpty(()=>this[_0x4a669d(0x1dc)][_0x4a669d(0x251)](_0x565e76)),_0x39539c=await fetchAllToolTargetMaps((_0x11124b,_0x135b83)=>this['client'][_0x4a669d(0x14f)](_0x11124b,_0x135b83),_0x565e76),_0x4da827=new Map(),_0x33a358=new Map(),_0x162f26=new Map(),_0x608417=new Map(),_0x290296=new Map(),_0x339e40=new Map(),_0x228850=new Map();for(const _0x2bc1aa of _0x158d2a){_0x4da827['set'](_0x2bc1aa['attributes']['name'],_0x2bc1aa);}for(const _0x2abcbd of _0x285aaf){_0x33a358[_0x4a669d(0x22a)](_0x2abcbd[_0x4a669d(0x25c)][_0x4a669d(0x1c3)],_0x2abcbd);}for(const _0x2a128b of _0x15dd15){_0x162f26[_0x4a669d(0x22a)](_0x2a128b[_0x4a669d(0x25c)][_0x4a669d(0x1c3)],_0x2a128b);}for(const _0x3bb291 of _0x50b808){_0x608417[_0x4a669d(0x22a)](_0x3bb291[_0x4a669d(0x25c)][_0x4a669d(0x1c3)],_0x3bb291);}for(const _0xc10608 of _0x5eae18){_0x290296[_0x4a669d(0x22a)](_0xc10608[_0x4a669d(0x25c)]['serviceType'][_0x4a669d(0x21c)](),_0xc10608);}for(const _0x3fdcc3 of _0x23b13b){_0x339e40['set'](_0x3fdcc3[_0x4a669d(0x25c)][_0x4a669d(0x1c3)],_0x3fdcc3);}for(const _0x125ee2 of _0x3e45ff){_0x228850['set'](_0x125ee2[_0x4a669d(0x25c)][_0x4a669d(0x1c3)],_0x125ee2);}const _0x17529e=new Map(),_0x2357d9=new Map();for(const _0x2b745c of _0xd72d48){_0x17529e['set'](_0x2b745c[_0x4a669d(0x25c)]['name'],_0x2b745c);}for(const _0x5e7fe5 of _0x413d07){_0x2357d9[_0x4a669d(0x22a)](_0x5e7fe5[_0x4a669d(0x25c)]['name'],_0x5e7fe5);}const _0x5f5c78=new Map(),_0x25c41c=new Map();for(const _0x199487 of _0x158d2a){_0x5f5c78[_0x4a669d(0x22a)](_0x199487['attributes'][_0x4a669d(0x1c3)],_0x199487['id']),_0x25c41c['set'](_0x199487['id'],_0x199487[_0x4a669d(0x25c)][_0x4a669d(0x1c3)]);}const _0x54d4aa=new Map(),_0x2cd65a=new Map();for(const _0x5e080a of _0x50b808){_0x54d4aa[_0x4a669d(0x22a)](_0x5e080a[_0x4a669d(0x25c)][_0x4a669d(0x1c3)],_0x5e080a['id']),_0x2cd65a[_0x4a669d(0x22a)](_0x5e080a['id'],_0x5e080a[_0x4a669d(0x25c)][_0x4a669d(0x1c3)]);}const _0x56487e=_0x39539c[_0x4a669d(0x191)][_0x4a669d(0x253)]||new Map(),_0x231712=_0x39539c[_0x4a669d(0x191)][_0x4a669d(0x196)]||new Map(),_0x27b33d=_0x39539c[_0x4a669d(0x191)][_0x4a669d(0x26d)]||new Map(),_0x32892b=new Map(),_0x3d9053={'resolveToolTargetName':buildNameResolver({..._0x39539c[_0x4a669d(0x232)],'Agent':_0x25c41c}),'resolvePromptName':async _0x156e01=>_0x2cd65a[_0x4a669d(0x268)](_0x156e01),'onWarning':_0x1a693f=>this[_0x4a669d(0x19c)][_0x4a669d(0x270)](_0x1a693f)};let _0x1b87a7=[];const _0x1a2083={'projectId':_0x565e76,'resolveToolTargetId':buildIdResolver({..._0x39539c[_0x4a669d(0x191)],'Agent':_0x5f5c78}),'resolvePromptId':async _0x186aa8=>_0x54d4aa[_0x4a669d(0x268)](_0x186aa8),'onWarning':_0x56358d=>{const _0x10663e=_0x4a669d;this[_0x10663e(0x19c)][_0x10663e(0x270)](_0x56358d),_0x1b87a7[_0x10663e(0x223)](_0x56358d);}},{resolved:_0x417072,unresolved:_0x414cfe}=resolveAgentDependencies(_0x5d79e7,new Set(_0x4da827['keys']()));for(const {agent:_0x5428bb,missingDeps:_0x263e44}of _0x414cfe){_0x43ab40[_0x4a669d(0x158)]['push']({'agentName':_0x5428bb['yaml']['name'],'action':_0x4a669d(0x14b),'error':_0x4a669d(0x1fc)+_0x263e44[_0x4a669d(0x20c)](',\x20')+_0x4a669d(0x14c)}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x158)][_0x4a669d(0x1f8)]++;}for(const _0x3feb07 of _0x3ae44c){const _0x2c3c3a=_0x33a358[_0x4a669d(0x268)](_0x3feb07[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)]),_0x439ed1=a133_0x1783c4[_0x4a669d(0x14e)](_0x3feb07[_0x4a669d(0x17b)],_0x4a669d(0x1b3));if(_0x2c3c3a){const _0x463e10=apiKnowledgeBaseToYaml(_0x2c3c3a),_0x218552=toKnowledgeBaseYamlString(_0x463e10),_0x2764b9=generateDiff(_0x218552,_0x439ed1),_0x297c79=hasChanges(_0x2764b9);_0x297c79?(_0x43ab40['knowledgeBases'][_0x4a669d(0x223)]({'name':_0x3feb07[_0x4a669d(0x1a5)]['name'],'action':_0x4a669d(0x150),'id':_0x2c3c3a['id'],'diff':formatDiffWithColors(_0x2764b9)}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x271)]['updated']++):(_0x43ab40[_0x4a669d(0x271)]['push']({'name':_0x3feb07['yaml'][_0x4a669d(0x1c3)],'action':_0x4a669d(0x1c6),'id':_0x2c3c3a['id']}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x271)]['unchanged']++);}else _0x43ab40['knowledgeBases'][_0x4a669d(0x223)]({'name':_0x3feb07['yaml'][_0x4a669d(0x1c3)],'action':_0x4a669d(0x236)}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x271)][_0x4a669d(0x236)]++;}for(const _0x28052b of _0x1e0a86){const _0x6ff32b=_0x162f26[_0x4a669d(0x268)](_0x28052b[_0x4a669d(0x1c3)]),_0x39a8ec=a133_0x1783c4['readFileSync'](_0x28052b[_0x4a669d(0x17b)],'utf-8');if(_0x6ff32b){const _0x5dcbab=toTextKnowledgeBaseMd(_0x6ff32b[_0x4a669d(0x25c)][_0x4a669d(0x1c3)],_0x6ff32b[_0x4a669d(0x25c)][_0x4a669d(0x21e)]),_0x5dd53c=generateDiff(_0x5dcbab,_0x39a8ec),_0x291f50=hasChanges(_0x5dd53c);_0x291f50?(_0x43ab40['textKnowledgeBases'][_0x4a669d(0x223)]({'name':_0x28052b[_0x4a669d(0x1c3)],'action':_0x4a669d(0x150),'id':_0x6ff32b['id'],'diff':formatDiffWithColors(_0x5dd53c)}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x193)]['updated']++):(_0x43ab40['textKnowledgeBases']['push']({'name':_0x28052b[_0x4a669d(0x1c3)],'action':_0x4a669d(0x1c6),'id':_0x6ff32b['id']}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x193)][_0x4a669d(0x1c6)]++);}else _0x43ab40[_0x4a669d(0x193)][_0x4a669d(0x223)]({'name':_0x28052b[_0x4a669d(0x1c3)],'action':_0x4a669d(0x236)}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x193)][_0x4a669d(0x236)]++;}for(const _0x1e5ae0 of _0x417072){const _0xdf089b=_0x4da827[_0x4a669d(0x268)](_0x1e5ae0[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)]),_0xe916d5=a133_0xef4c6e[_0x4a669d(0x20c)](_0x1e5ae0[_0x4a669d(0x1a3)],_0x4a669d(0x256)),_0x8a2f45=a133_0x1783c4['readFileSync'](_0xe916d5,_0x4a669d(0x1b3)),_0x9a4bfc=_0x1e5ae0['systemPrompt'],_0x10b099='#\x20prompt.md\x0a'+_0x9a4bfc+_0x4a669d(0x15d)+_0x8a2f45;if(_0xdf089b){const {yaml:_0x17781e,systemPrompt:_0x466229}=await agentResponseToDef(_0xdf089b,_0x3d9053),_0x4f5d70=toAgentYamlString(_0x17781e),_0x3445d6=_0x4a669d(0x1b6)+_0x466229+'\x0a\x0a#\x20agent.yml\x0a'+_0x4f5d70,_0x5cb293=generateDiff(_0x3445d6,_0x10b099),_0xcb99b0=hasChanges(_0x5cb293);_0xcb99b0?(_0x43ab40[_0x4a669d(0x158)][_0x4a669d(0x223)]({'agentName':_0x1e5ae0[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],'action':_0x4a669d(0x150),'agentId':_0xdf089b['id'],'diff':formatDiffWithColors(_0x5cb293)}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x158)][_0x4a669d(0x150)]++):(_0x43ab40[_0x4a669d(0x158)][_0x4a669d(0x223)]({'agentName':_0x1e5ae0[_0x4a669d(0x1a5)]['name'],'action':_0x4a669d(0x1c6),'agentId':_0xdf089b['id']}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x158)]['unchanged']++);}else _0x43ab40[_0x4a669d(0x158)][_0x4a669d(0x223)]({'agentName':_0x1e5ae0[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],'action':_0x4a669d(0x236)}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x158)]['created']++;}for(const _0x1db26b of _0x47b54e){const _0x5376ea=_0x608417[_0x4a669d(0x268)](_0x1db26b[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)]),_0x33c78d=a133_0x1783c4[_0x4a669d(0x14e)](_0x1db26b['path'],_0x4a669d(0x1b3));if(_0x5376ea){const _0x4dd7f3=await apiPromptToYaml(_0x5376ea,_0x3d9053);if(!_0x4dd7f3){_0x43ab40[_0x4a669d(0x147)][_0x4a669d(0x223)]({'name':_0x1db26b[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],'action':_0x4a669d(0x150),'id':_0x5376ea['id']}),_0x43ab40['counts'][_0x4a669d(0x147)][_0x4a669d(0x150)]++;continue;}const _0x487222=toPromptYamlString(_0x4dd7f3),_0x5e6a49=generateDiff(_0x487222,_0x33c78d),_0x268516=hasChanges(_0x5e6a49);_0x268516?(_0x43ab40[_0x4a669d(0x147)][_0x4a669d(0x223)]({'name':_0x1db26b['yaml'][_0x4a669d(0x1c3)],'action':_0x4a669d(0x150),'id':_0x5376ea['id'],'diff':formatDiffWithColors(_0x5e6a49)}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x147)]['updated']++):(_0x43ab40[_0x4a669d(0x147)][_0x4a669d(0x223)]({'name':_0x1db26b[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],'action':_0x4a669d(0x1c6),'id':_0x5376ea['id']}),_0x43ab40[_0x4a669d(0x1df)]['prompts']['unchanged']++);}else _0x43ab40[_0x4a669d(0x147)][_0x4a669d(0x223)]({'name':_0x1db26b[_0x4a669d(0x1a5)]['name'],'action':_0x4a669d(0x236)}),_0x43ab40['counts'][_0x4a669d(0x147)][_0x4a669d(0x236)]++;}for(const _0x1eb6da of _0x48adde){const _0xf1bb10=_0x290296['get'](_0x1eb6da['yaml'][_0x4a669d(0x184)]),_0x255f55=a133_0x1783c4[_0x4a669d(0x14e)](_0x1eb6da[_0x4a669d(0x17b)],'utf-8');if(_0xf1bb10){const _0x2be6e6=await apiIntegrationToYaml(_0xf1bb10,_0x3d9053),_0xf781cf=toIntegrationYamlString(_0x2be6e6),_0x2f7a29=generateDiff(_0xf781cf,_0x255f55),_0x35450b=hasChanges(_0x2f7a29);_0x35450b?(_0x43ab40[_0x4a669d(0x1bd)][_0x4a669d(0x223)]({'name':_0x1eb6da[_0x4a669d(0x1a5)][_0x4a669d(0x184)],'action':_0x4a669d(0x150),'id':_0xf1bb10['id'],'diff':formatDiffWithColors(_0x2f7a29)}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x1bd)]['updated']++):(_0x43ab40[_0x4a669d(0x1bd)]['push']({'name':_0x1eb6da[_0x4a669d(0x1a5)][_0x4a669d(0x184)],'action':_0x4a669d(0x1c6),'id':_0xf1bb10['id']}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x1bd)]['unchanged']++);}else _0x43ab40[_0x4a669d(0x1bd)]['push']({'name':_0x1eb6da[_0x4a669d(0x1a5)][_0x4a669d(0x184)],'action':_0x4a669d(0x236)}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x1bd)][_0x4a669d(0x236)]++;}for(const _0x24eb1d of _0x4f4653){const _0x579590=_0x339e40[_0x4a669d(0x268)](_0x24eb1d['def'][_0x4a669d(0x1c3)]),_0x11c1f9=toExperimentalKnowledgeBaseYamlString(_0x24eb1d['def']);let _0x3db022=_0x11c1f9;for(const _0x1e604f of _0x24eb1d[_0x4a669d(0x14d)][_0x4a669d(0x1cd)]){_0x3db022+=_0x4a669d(0x1ab)+_0x1e604f[_0x4a669d(0x1c3)]+_0x4a669d(0x202)+_0x1e604f[_0x4a669d(0x212)]+_0x4a669d(0x1c4)+_0x1e604f[_0x4a669d(0x1c3)]+_0x4a669d(0x202)+_0x1e604f[_0x4a669d(0x206)]+'\x0a';}if(_0x579590){const _0x363d17=apiExperimentalKnowledgeBaseToYaml(_0x579590),_0x473669=toExperimentalKnowledgeBaseYamlString(_0x363d17);let _0x56f6c5=_0x473669;for(const _0x455c64 of _0x363d17[_0x4a669d(0x1cd)]){_0x56f6c5+=_0x4a669d(0x1ab)+_0x455c64[_0x4a669d(0x1c3)]+_0x4a669d(0x202)+_0x455c64[_0x4a669d(0x212)]+'\x0a---\x20schema:\x20'+_0x455c64['name']+_0x4a669d(0x202)+_0x455c64[_0x4a669d(0x206)]+'\x0a';}const _0x456752=generateDiff(_0x56f6c5,_0x3db022),_0x4ef34a=hasChanges(_0x456752);_0x4ef34a?(_0x43ab40[_0x4a669d(0x24e)][_0x4a669d(0x223)]({'name':_0x24eb1d[_0x4a669d(0x14d)]['name'],'action':_0x4a669d(0x150),'id':_0x579590['id'],'diff':formatDiffWithColors(_0x456752)}),_0x43ab40[_0x4a669d(0x1df)]['experimentalKnowledgeBases'][_0x4a669d(0x150)]++):(_0x43ab40['experimentalKnowledgeBases']['push']({'name':_0x24eb1d['def'][_0x4a669d(0x1c3)],'action':_0x4a669d(0x1c6),'id':_0x579590['id']}),_0x43ab40['counts'][_0x4a669d(0x24e)][_0x4a669d(0x1c6)]++);}else _0x43ab40['experimentalKnowledgeBases'][_0x4a669d(0x223)]({'name':_0x24eb1d[_0x4a669d(0x14d)][_0x4a669d(0x1c3)],'action':_0x4a669d(0x236)}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x24e)][_0x4a669d(0x236)]++;}for(const _0x1b74f7 of _0x3673d9){const _0x20451c=_0x228850[_0x4a669d(0x268)](_0x1b74f7[_0x4a669d(0x14d)]['name']),_0x52fb30=toExperimentalArtifactYamlString(_0x1b74f7[_0x4a669d(0x14d)]);let _0x8a6816=_0x52fb30+(_0x4a669d(0x219)+_0x1b74f7[_0x4a669d(0x14d)][_0x4a669d(0x212)]+'\x0a');for(const _0x4f749a of _0x1b74f7['def']['files']){_0x8a6816+='---\x20file:\x20'+_0x4f749a[_0x4a669d(0x204)]+'\x20---\x0a'+_0x4f749a['text_content']+'\x0a';}if(_0x20451c){const _0xee791b=apiExperimentalArtifactToYaml(_0x20451c),_0xb9d595=toExperimentalArtifactYamlString(_0xee791b);let _0x4a6f12=_0xb9d595+(_0x4a669d(0x219)+_0xee791b[_0x4a669d(0x212)]+'\x0a');for(const _0x545702 of _0xee791b[_0x4a669d(0x1cc)]){_0x4a6f12+=_0x4a669d(0x1d1)+_0x545702[_0x4a669d(0x204)]+'\x20---\x0a'+_0x545702[_0x4a669d(0x152)]+'\x0a';}const _0x35c11b=generateDiff(_0x4a6f12,_0x8a6816),_0x200072=hasChanges(_0x35c11b);_0x200072?(_0x43ab40['experimentalArtifacts'][_0x4a669d(0x223)]({'name':_0x1b74f7[_0x4a669d(0x14d)][_0x4a669d(0x1c3)],'action':_0x4a669d(0x150),'id':_0x20451c['id'],'diff':formatDiffWithColors(_0x35c11b)}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x1b7)][_0x4a669d(0x150)]++):(_0x43ab40[_0x4a669d(0x1b7)][_0x4a669d(0x223)]({'name':_0x1b74f7[_0x4a669d(0x14d)][_0x4a669d(0x1c3)],'action':_0x4a669d(0x1c6),'id':_0x20451c['id']}),_0x43ab40['counts']['experimentalArtifacts'][_0x4a669d(0x1c6)]++);}else _0x43ab40['experimentalArtifacts']['push']({'name':_0x1b74f7[_0x4a669d(0x14d)][_0x4a669d(0x1c3)],'action':_0x4a669d(0x236)}),_0x43ab40['counts'][_0x4a669d(0x1b7)]['created']++;}for(const _0x572151 of _0x3d17ff){const _0x4f3373=_0x17529e[_0x4a669d(0x268)](_0x572151[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)]),_0x661136=a133_0x1783c4['readFileSync'](_0x572151[_0x4a669d(0x17b)],'utf-8');if(_0x4f3373){const _0x5ba487=await apiFormInterfaceToYaml(_0x4f3373,_0x3d9053),_0x425c34=toFormInterfaceYamlString(_0x5ba487),_0x303a29=generateDiff(_0x425c34,_0x661136),_0x26474a=hasChanges(_0x303a29);_0x26474a?(_0x43ab40[_0x4a669d(0x18d)][_0x4a669d(0x223)]({'name':_0x572151[_0x4a669d(0x1a5)]['name'],'action':_0x4a669d(0x150),'id':_0x4f3373['id'],'diff':formatDiffWithColors(_0x303a29)}),_0x43ab40['counts'][_0x4a669d(0x18d)][_0x4a669d(0x150)]++):(_0x43ab40['formInterfaces']['push']({'name':_0x572151[_0x4a669d(0x1a5)]['name'],'action':_0x4a669d(0x1c6),'id':_0x4f3373['id']}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x18d)][_0x4a669d(0x1c6)]++);}else _0x43ab40[_0x4a669d(0x18d)]['push']({'name':_0x572151[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],'action':'created'}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x18d)][_0x4a669d(0x236)]++;}for(const _0x989845 of _0x5bd0e5){const _0x1c3714=_0x2357d9['get'](_0x989845['yaml'][_0x4a669d(0x1c3)]),_0x1830e7=a133_0x1783c4[_0x4a669d(0x14e)](_0x989845[_0x4a669d(0x17b)],_0x4a669d(0x1b3));if(_0x1c3714){const _0x5b7679=await apiChatInterfaceToYaml(_0x1c3714,_0x3d9053),_0x84afd9=toChatInterfaceYamlString(_0x5b7679),_0x254dcb=generateDiff(_0x84afd9,_0x1830e7),_0x2ec20c=hasChanges(_0x254dcb);_0x2ec20c?(_0x43ab40[_0x4a669d(0x146)][_0x4a669d(0x223)]({'name':_0x989845[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],'action':_0x4a669d(0x150),'id':_0x1c3714['id'],'diff':formatDiffWithColors(_0x254dcb)}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x146)][_0x4a669d(0x150)]++):(_0x43ab40['chatInterfaces'][_0x4a669d(0x223)]({'name':_0x989845[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],'action':'unchanged','id':_0x1c3714['id']}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x146)][_0x4a669d(0x1c6)]++);}else _0x43ab40[_0x4a669d(0x146)]['push']({'name':_0x989845[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],'action':_0x4a669d(0x236)}),_0x43ab40['counts'][_0x4a669d(0x146)]['created']++;}if(_0x5a0e59?.['dryRun'])return _0x43ab40;_0x43ab40[_0x4a669d(0x271)]=[],_0x43ab40[_0x4a669d(0x193)]=[],_0x43ab40[_0x4a669d(0x147)]=[],_0x43ab40['integrations']=[],_0x43ab40[_0x4a669d(0x24e)]=[],_0x43ab40[_0x4a669d(0x1b7)]=[],_0x43ab40[_0x4a669d(0x18d)]=[],_0x43ab40[_0x4a669d(0x146)]=[];const _0x5712d2=_0x43ab40['agents'][_0x4a669d(0x23e)](_0x1247a1=>_0x1247a1[_0x4a669d(0x174)]===_0x4a669d(0x14b));_0x43ab40['agents']=_0x5712d2,_0x43ab40[_0x4a669d(0x1df)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x5712d2['length']},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'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},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x38cf1b of _0x3ae44c){try{const _0x1ce632=_0x33a358['get'](_0x38cf1b[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)]),_0x3060cd=yamlKnowledgeBaseToApi(_0x38cf1b[_0x4a669d(0x1a5)],_0x565e76);if(_0x1ce632)await this[_0x4a669d(0x1dc)][_0x4a669d(0x20b)](_0x1ce632['id'],_0x3060cd),_0x56487e[_0x4a669d(0x22a)](_0x38cf1b[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],_0x1ce632['id']),_0x43ab40[_0x4a669d(0x271)][_0x4a669d(0x223)]({'name':_0x38cf1b[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],'action':'updated','id':_0x1ce632['id']}),_0x43ab40[_0x4a669d(0x1df)]['knowledgeBases']['updated']++;else{const _0x21e2a9=await this[_0x4a669d(0x1dc)][_0x4a669d(0x1e7)](_0x3060cd);_0x56487e[_0x4a669d(0x22a)](_0x38cf1b[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],_0x21e2a9['id']),_0x43ab40[_0x4a669d(0x271)][_0x4a669d(0x223)]({'name':_0x38cf1b[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],'action':'created','id':_0x21e2a9['id']}),_0x43ab40[_0x4a669d(0x1df)]['knowledgeBases']['created']++;}}catch(_0x18d0b1){_0x43ab40[_0x4a669d(0x271)][_0x4a669d(0x223)]({'name':_0x38cf1b[_0x4a669d(0x1a5)]['name'],'action':_0x4a669d(0x14b),'error':_0x18d0b1[_0x4a669d(0x1ba)]}),_0x43ab40[_0x4a669d(0x1df)]['knowledgeBases']['errors']++;}}for(const _0x65faab of _0x1e0a86){try{const _0x388848=_0x162f26[_0x4a669d(0x268)](_0x65faab[_0x4a669d(0x1c3)]),_0x10f2d9=yamlTextKnowledgeBaseToApi({'name':_0x65faab['name'],'text':_0x65faab[_0x4a669d(0x21e)]},_0x565e76);if(_0x388848)await this['client'][_0x4a669d(0x18c)](_0x388848['id'],_0x10f2d9),_0x231712[_0x4a669d(0x22a)](_0x65faab[_0x4a669d(0x1c3)],_0x388848['id']),_0x43ab40['textKnowledgeBases']['push']({'name':_0x65faab[_0x4a669d(0x1c3)],'action':_0x4a669d(0x150),'id':_0x388848['id']}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x193)][_0x4a669d(0x150)]++;else{const _0x3e85bd=await this[_0x4a669d(0x1dc)][_0x4a669d(0x1d3)](_0x10f2d9);_0x231712[_0x4a669d(0x22a)](_0x65faab['name'],_0x3e85bd['id']),_0x43ab40['textKnowledgeBases'][_0x4a669d(0x223)]({'name':_0x65faab[_0x4a669d(0x1c3)],'action':_0x4a669d(0x236),'id':_0x3e85bd['id']}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x193)][_0x4a669d(0x236)]++;}}catch(_0x223108){_0x43ab40[_0x4a669d(0x193)]['push']({'name':_0x65faab[_0x4a669d(0x1c3)],'action':_0x4a669d(0x14b),'error':_0x223108['message']}),_0x43ab40[_0x4a669d(0x1df)]['textKnowledgeBases'][_0x4a669d(0x1f8)]++;}}for(const _0x1bd812 of _0x4f4653){try{const _0x4d38bc=_0x339e40[_0x4a669d(0x268)](_0x1bd812[_0x4a669d(0x14d)][_0x4a669d(0x1c3)]),_0x13dc1a=yamlExperimentalKnowledgeBaseToApi(_0x1bd812[_0x4a669d(0x14d)],_0x565e76);if(_0x4d38bc)await this[_0x4a669d(0x1dc)][_0x4a669d(0x259)](_0x4d38bc['id'],_0x13dc1a),_0x27b33d['set'](_0x1bd812[_0x4a669d(0x14d)][_0x4a669d(0x1c3)],_0x4d38bc['id']),_0x43ab40[_0x4a669d(0x24e)]['push']({'name':_0x1bd812[_0x4a669d(0x14d)][_0x4a669d(0x1c3)],'action':'updated','id':_0x4d38bc['id']}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x24e)][_0x4a669d(0x150)]++;else{const _0x36745a=await this['client'][_0x4a669d(0x170)](_0x13dc1a);_0x27b33d[_0x4a669d(0x22a)](_0x1bd812['def']['name'],_0x36745a['id']),_0x43ab40[_0x4a669d(0x24e)]['push']({'name':_0x1bd812['def']['name'],'action':'created','id':_0x36745a['id']}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x24e)][_0x4a669d(0x236)]++;}}catch(_0x3e7262){_0x43ab40[_0x4a669d(0x24e)][_0x4a669d(0x223)]({'name':_0x1bd812[_0x4a669d(0x14d)]['name'],'action':_0x4a669d(0x14b),'error':_0x3e7262[_0x4a669d(0x1ba)]}),_0x43ab40[_0x4a669d(0x1df)]['experimentalKnowledgeBases'][_0x4a669d(0x1f8)]++;}}for(const _0x12e7f6 of _0x3673d9){try{const _0xa92d20=_0x228850[_0x4a669d(0x268)](_0x12e7f6[_0x4a669d(0x14d)][_0x4a669d(0x1c3)]),_0x302b02=yamlExperimentalArtifactToApi(_0x12e7f6[_0x4a669d(0x14d)],_0x565e76);if(_0xa92d20)await this[_0x4a669d(0x1dc)][_0x4a669d(0x1a8)](_0xa92d20['id'],_0x302b02),_0x32892b[_0x4a669d(0x22a)](_0x12e7f6[_0x4a669d(0x14d)][_0x4a669d(0x1c3)],_0xa92d20['id']),_0x43ab40[_0x4a669d(0x1b7)][_0x4a669d(0x223)]({'name':_0x12e7f6['def'][_0x4a669d(0x1c3)],'action':_0x4a669d(0x150),'id':_0xa92d20['id']}),_0x43ab40[_0x4a669d(0x1df)]['experimentalArtifacts'][_0x4a669d(0x150)]++;else{const _0xabc94=await this['client']['createExperimentalArtifact'](_0x302b02);_0x32892b['set'](_0x12e7f6[_0x4a669d(0x14d)]['name'],_0xabc94['id']),_0x43ab40[_0x4a669d(0x1b7)]['push']({'name':_0x12e7f6[_0x4a669d(0x14d)]['name'],'action':_0x4a669d(0x236),'id':_0xabc94['id']}),_0x43ab40['counts'][_0x4a669d(0x1b7)][_0x4a669d(0x236)]++;}}catch(_0x178096){_0x43ab40[_0x4a669d(0x1b7)][_0x4a669d(0x223)]({'name':_0x12e7f6[_0x4a669d(0x14d)][_0x4a669d(0x1c3)],'action':_0x4a669d(0x14b),'error':_0x178096[_0x4a669d(0x1ba)]}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x1b7)][_0x4a669d(0x1f8)]++;}}for(const _0x4af407 of _0x417072){_0x1b87a7=[];try{const _0x6d9952=_0x4da827[_0x4a669d(0x268)](_0x4af407[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)]),_0x532355=await agentDefToRequest(_0x4af407[_0x4a669d(0x1a5)],_0x4af407['systemPrompt'],_0x4af407['starterMessage'],_0x1a2083);if(_0x6d9952)await this[_0x4a669d(0x1dc)][_0x4a669d(0x205)](_0x6d9952['id'],_0x532355),_0x5f5c78['set'](_0x4af407['yaml'][_0x4a669d(0x1c3)],_0x6d9952['id']),_0x43ab40[_0x4a669d(0x158)][_0x4a669d(0x223)]({'agentName':_0x4af407[_0x4a669d(0x1a5)]['name'],'action':'updated','agentId':_0x6d9952['id'],'warnings':_0x1b87a7[_0x4a669d(0x1ef)]>0x0?_0x1b87a7:undefined}),_0x43ab40[_0x4a669d(0x1df)]['agents'][_0x4a669d(0x150)]++;else{const _0x32bdf7=await this[_0x4a669d(0x1dc)][_0x4a669d(0x1b0)](_0x532355);_0x5f5c78[_0x4a669d(0x22a)](_0x4af407['yaml'][_0x4a669d(0x1c3)],_0x32bdf7['id']),_0x43ab40[_0x4a669d(0x158)][_0x4a669d(0x223)]({'agentName':_0x4af407['yaml'][_0x4a669d(0x1c3)],'action':'created','agentId':_0x32bdf7['id'],'warnings':_0x1b87a7[_0x4a669d(0x1ef)]>0x0?_0x1b87a7:undefined}),_0x43ab40['counts']['agents']['created']++;}}catch(_0x5aa97e){_0x43ab40[_0x4a669d(0x158)]['push']({'agentName':_0x4af407[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],'action':'error','error':_0x5aa97e[_0x4a669d(0x1ba)],'warnings':_0x1b87a7['length']>0x0?_0x1b87a7:undefined}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x158)][_0x4a669d(0x1f8)]++;}}for(const _0x7db75f of _0x47b54e){try{const _0x115ae0=_0x608417['get'](_0x7db75f[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)]),_0x191b6b=await yamlPromptToApi(_0x7db75f[_0x4a669d(0x1a5)],_0x565e76,_0x1a2083);if(!_0x191b6b){_0x43ab40['prompts'][_0x4a669d(0x223)]({'name':_0x7db75f[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],'action':_0x4a669d(0x14b),'error':'Agent\x20reference\x20not\x20found'}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x147)][_0x4a669d(0x1f8)]++;continue;}if(_0x115ae0)await this['client'][_0x4a669d(0x1f6)](_0x115ae0['id'],_0x191b6b),_0x54d4aa['set'](_0x7db75f['yaml'][_0x4a669d(0x1c3)],_0x115ae0['id']),_0x43ab40[_0x4a669d(0x147)][_0x4a669d(0x223)]({'name':_0x7db75f['yaml'][_0x4a669d(0x1c3)],'action':'updated','id':_0x115ae0['id']}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x147)][_0x4a669d(0x150)]++;else{const _0x59f469=await this[_0x4a669d(0x1dc)]['createPrompt'](_0x191b6b);_0x54d4aa[_0x4a669d(0x22a)](_0x7db75f[_0x4a669d(0x1a5)]['name'],_0x59f469['id']),_0x43ab40[_0x4a669d(0x147)][_0x4a669d(0x223)]({'name':_0x7db75f[_0x4a669d(0x1a5)]['name'],'action':_0x4a669d(0x236),'id':_0x59f469['id']}),_0x43ab40['counts'][_0x4a669d(0x147)][_0x4a669d(0x236)]++;}}catch(_0x527018){_0x43ab40[_0x4a669d(0x147)][_0x4a669d(0x223)]({'name':_0x7db75f[_0x4a669d(0x1a5)]['name'],'action':_0x4a669d(0x14b),'error':_0x527018[_0x4a669d(0x1ba)]}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x147)]['errors']++;}}for(const _0x1ffeea of _0x48adde){try{const _0x2350aa=_0x290296[_0x4a669d(0x268)](_0x1ffeea[_0x4a669d(0x1a5)][_0x4a669d(0x184)]),_0x593936=await yamlIntegrationToApi(_0x1ffeea[_0x4a669d(0x1a5)],_0x565e76,_0x1a2083);if(_0x2350aa){await this[_0x4a669d(0x1dc)][_0x4a669d(0x228)](_0x2350aa['id']);const _0x1441a1=await this[_0x4a669d(0x1dc)][_0x4a669d(0x155)](_0x593936);_0x43ab40['integrations'][_0x4a669d(0x223)]({'name':_0x1ffeea[_0x4a669d(0x1a5)]['service_type'],'action':_0x4a669d(0x150),'id':_0x1441a1['id']}),_0x43ab40['counts'][_0x4a669d(0x1bd)][_0x4a669d(0x150)]++;}else{const _0x1086e4=await this[_0x4a669d(0x1dc)][_0x4a669d(0x155)](_0x593936);_0x43ab40[_0x4a669d(0x1bd)][_0x4a669d(0x223)]({'name':_0x1ffeea['yaml']['service_type'],'action':_0x4a669d(0x236),'id':_0x1086e4['id']}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x1bd)][_0x4a669d(0x236)]++;}}catch(_0x29a5f9){_0x43ab40[_0x4a669d(0x1bd)]['push']({'name':_0x1ffeea[_0x4a669d(0x1a5)][_0x4a669d(0x184)],'action':_0x4a669d(0x14b),'error':_0x29a5f9[_0x4a669d(0x1ba)]}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x1bd)]['errors']++;}}for(const _0x31d4a0 of _0x3d17ff){try{const _0x35110c=_0x17529e[_0x4a669d(0x268)](_0x31d4a0['yaml']['name']),_0x26673c=await yamlFormInterfaceToApi(_0x31d4a0[_0x4a669d(0x1a5)],_0x565e76,_0x1a2083);if(!_0x26673c){_0x43ab40[_0x4a669d(0x18d)][_0x4a669d(0x223)]({'name':_0x31d4a0[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],'action':_0x4a669d(0x14b),'error':_0x4a669d(0x216)}),_0x43ab40['counts'][_0x4a669d(0x18d)]['errors']++;continue;}if(_0x35110c){const _0x3e8079=await this[_0x4a669d(0x1dc)][_0x4a669d(0x22e)](_0x35110c['id'],_0x26673c);_0x43ab40[_0x4a669d(0x18d)][_0x4a669d(0x223)]({'name':_0x31d4a0[_0x4a669d(0x1a5)]['name'],'action':_0x4a669d(0x150),'id':_0x3e8079['id']}),_0x43ab40[_0x4a669d(0x1df)]['formInterfaces'][_0x4a669d(0x150)]++;}else{const _0x3fe4bf=await this[_0x4a669d(0x1dc)][_0x4a669d(0x15e)](_0x26673c);_0x43ab40[_0x4a669d(0x18d)]['push']({'name':_0x31d4a0[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],'action':'created','id':_0x3fe4bf['id']}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x18d)]['created']++;}}catch(_0x353f6f){_0x43ab40['formInterfaces']['push']({'name':_0x31d4a0['yaml'][_0x4a669d(0x1c3)],'action':_0x4a669d(0x14b),'error':_0x353f6f[_0x4a669d(0x1ba)]}),_0x43ab40[_0x4a669d(0x1df)]['formInterfaces'][_0x4a669d(0x1f8)]++;}}for(const _0x313fbc of _0x5bd0e5){try{const _0x2d859a=_0x2357d9[_0x4a669d(0x268)](_0x313fbc['yaml'][_0x4a669d(0x1c3)]),_0x4d23c2=await yamlChatInterfaceToApi(_0x313fbc[_0x4a669d(0x1a5)],_0x565e76,_0x1a2083);if(_0x2d859a){const _0x241cc9=await this[_0x4a669d(0x1dc)][_0x4a669d(0x1f0)](_0x2d859a['id'],_0x4d23c2);_0x43ab40[_0x4a669d(0x146)]['push']({'name':_0x313fbc[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],'action':'updated','id':_0x241cc9['id']}),_0x43ab40[_0x4a669d(0x1df)]['chatInterfaces']['updated']++;}else{const _0x224418=await this['client']['createChatInterface'](_0x4d23c2);_0x43ab40[_0x4a669d(0x146)]['push']({'name':_0x313fbc['yaml'][_0x4a669d(0x1c3)],'action':'created','id':_0x224418['id']}),_0x43ab40[_0x4a669d(0x1df)][_0x4a669d(0x146)]['created']++;}}catch(_0x1c2b74){_0x43ab40[_0x4a669d(0x146)][_0x4a669d(0x223)]({'name':_0x313fbc[_0x4a669d(0x1a5)][_0x4a669d(0x1c3)],'action':'error','error':_0x1c2b74['message']}),_0x43ab40['counts'][_0x4a669d(0x146)][_0x4a669d(0x1f8)]++;}}return _0x43ab40;}async[a133_0x209be5(0x24c)](_0x16a9fc,_0x3744e4,_0x3f21e5,_0x4e5b9a){const _0x34546e=a133_0x209be5,{projectId:_0x435072,project:_0x3b1f8f}=await this[_0x34546e(0x21d)](_0x16a9fc),_0x2338ff=_0x3b1f8f[_0x34546e(0x25c)]['name'],_0x5cfa20=await this['client'][_0x34546e(0x1f2)](_0x435072),_0x3e959a=_0x5cfa20[_0x34546e(0x1fd)](_0x2e15fc=>_0x2e15fc[_0x34546e(0x25c)]['name']===_0x3744e4);if(!_0x3e959a)throw new SDKError(ErrorCode[_0x34546e(0x151)],'Agent\x20not\x20found:\x20'+_0x3744e4,undefined,{'helpText':_0x34546e(0x1c8)+_0x5cfa20[_0x34546e(0x227)](_0x17ba7a=>_0x17ba7a['attributes'][_0x34546e(0x1c3)])[_0x34546e(0x20c)](',\x20')});let _0x184159;if(_0x3f21e5)_0x184159=_0x3f21e5;else{const _0x51e33e=a133_0xef4c6e[_0x34546e(0x20c)](process[_0x34546e(0x264)](),_0x34546e(0x158)),_0x9c9001=getSanitizedPathWithMigration(_0x51e33e,_0x2338ff);_0x9c9001[_0x34546e(0x21b)]&&this[_0x34546e(0x19c)][_0x34546e(0x1d2)](_0x34546e(0x207)+a133_0xef4c6e[_0x34546e(0x163)](_0x9c9001[_0x34546e(0x211)])+'\x20→\x20'+a133_0xef4c6e['basename'](_0x9c9001[_0x34546e(0x17b)])),_0x184159=_0x9c9001[_0x34546e(0x17b)];}const _0x438a41=getSanitizedPathWithMigration(_0x184159,_0x3744e4);_0x438a41[_0x34546e(0x21b)]&&this[_0x34546e(0x19c)][_0x34546e(0x1d2)](_0x34546e(0x235)+a133_0xef4c6e[_0x34546e(0x163)](_0x438a41[_0x34546e(0x211)])+_0x34546e(0x210)+a133_0xef4c6e[_0x34546e(0x163)](_0x438a41[_0x34546e(0x17b)]));const _0x1591c9=_0x438a41[_0x34546e(0x17b)],_0x1b1c4d=new Map(),_0x42ee7f=new Map(),_0x206ebe=await this[_0x34546e(0x1dc)][_0x34546e(0x230)](_0x435072),_0xef29ed=await this[_0x34546e(0x1dc)]['listTextKnowledgeBases'](_0x435072),_0x54684b=await safeListOrEmpty(()=>this[_0x34546e(0x1dc)]['listExperimentalKnowledgeBases'](_0x435072)),_0x22fa6d=new Map(),_0x2fcf35=new Map();for(const _0x26d752 of _0x206ebe){_0x1b1c4d['set'](_0x26d752['id'],_0x26d752[_0x34546e(0x25c)][_0x34546e(0x1c3)]);}for(const _0x2902a6 of _0xef29ed){_0x22fa6d[_0x34546e(0x22a)](_0x2902a6['id'],_0x2902a6[_0x34546e(0x25c)]['name']);}for(const _0xc9fead of _0x54684b){_0x2fcf35[_0x34546e(0x22a)](_0xc9fead['id'],_0xc9fead['attributes'][_0x34546e(0x1c3)]);}for(const _0x917a29 of _0x5cfa20){_0x42ee7f[_0x34546e(0x22a)](_0x917a29['id'],_0x917a29['attributes']['name']);}const _0x198687={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x1b1c4d,'TextKnowledgeBase':_0x22fa6d,'Agent':_0x42ee7f,'ExperimentalKnowledgeBase':_0x2fcf35}),'resolvePromptName':async()=>undefined,'onWarning':_0x32051a=>this['logger'][_0x34546e(0x270)](_0x32051a)},_0x25b64c=a133_0xef4c6e[_0x34546e(0x20c)](_0x1591c9,_0x34546e(0x17c)),_0x94ad16=a133_0xef4c6e[_0x34546e(0x20c)](_0x1591c9,_0x34546e(0x256)),_0x3ccb3f=a133_0xef4c6e[_0x34546e(0x20c)](_0x1591c9,_0x34546e(0x266)),_0x124f98=!a133_0x1783c4[_0x34546e(0x25b)](_0x94ad16);if(_0x4e5b9a?.[_0x34546e(0x1e2)])return{'agentName':_0x3744e4,'outputPath':_0x1591c9,'isNew':_0x124f98,'hasChanges':!![]};a133_0x1783c4[_0x34546e(0x237)](_0x184159,{'recursive':!![]}),a133_0x1783c4[_0x34546e(0x237)](_0x1591c9,{'recursive':!![]});const _0x5d0dcb=a133_0xef4c6e[_0x34546e(0x20c)](_0x184159,_0x34546e(0x17d));!a133_0x1783c4[_0x34546e(0x25b)](_0x5d0dcb)&&a133_0x1783c4[_0x34546e(0x192)](_0x5d0dcb,createAgentConfigContent(_0x16a9fc));const {yaml:_0x2291c3,systemPrompt:_0x913122,starterMessage:_0x56f652}=await agentResponseToDef(_0x3e959a,_0x198687);let _0xd749f4=_0x124f98;if(!_0x124f98){const _0x32705a=a133_0x1783c4[_0x34546e(0x25b)](_0x25b64c)?a133_0x1783c4['readFileSync'](_0x25b64c,'utf-8'):'',_0x308130=a133_0x1783c4[_0x34546e(0x14e)](_0x94ad16,_0x34546e(0x1b3));_0xd749f4=_0x32705a!==_0x913122||_0x308130!==toAgentYamlString(_0x2291c3);}a133_0x1783c4['writeFileSync'](_0x25b64c,_0x913122),a133_0x1783c4[_0x34546e(0x192)](_0x94ad16,toAgentYamlString(_0x2291c3));if(_0x56f652&&_0x56f652[_0x34546e(0x1e5)]('\x0a'))a133_0x1783c4[_0x34546e(0x192)](_0x3ccb3f,_0x56f652);else a133_0x1783c4[_0x34546e(0x25b)](_0x3ccb3f)&&a133_0x1783c4[_0x34546e(0x1e8)](_0x3ccb3f);return{'agentName':_0x3744e4,'outputPath':_0x1591c9,'isNew':_0x124f98,'hasChanges':_0xd749f4};}async[a133_0x209be5(0x1ea)](_0x3cc8fb,_0x2e1828){const _0x5b1eb7=a133_0x209be5;let _0x3aa399;isAgentYamlPath(_0x3cc8fb)?_0x3aa399=getAgentDirFromYamlPath(_0x3cc8fb):_0x3aa399=_0x3cc8fb;const {config:_0x437452}=findAgentConfig(_0x3aa399),_0x3d4751=await this[_0x5b1eb7(0x15c)](_0x437452['llm_project']),_0x421959=a133_0xef4c6e[_0x5b1eb7(0x20c)](_0x3aa399,'agent.yml'),_0x4428cf=a133_0xef4c6e[_0x5b1eb7(0x20c)](_0x3aa399,'prompt.md'),_0x3614e7=a133_0xef4c6e[_0x5b1eb7(0x20c)](_0x3aa399,_0x5b1eb7(0x266));if(!a133_0x1783c4[_0x5b1eb7(0x25b)](_0x421959))throw new SDKError(ErrorCode[_0x5b1eb7(0x167)],_0x5b1eb7(0x16b)+_0x3aa399,undefined,{'helpText':_0x5b1eb7(0x23a)});const _0x20dac5=parseAgentYaml(a133_0x1783c4[_0x5b1eb7(0x14e)](_0x421959,'utf-8'),_0x421959),_0xfe22e3=a133_0x1783c4['existsSync'](_0x4428cf)?a133_0x1783c4['readFileSync'](_0x4428cf,_0x5b1eb7(0x1b3)):'',_0x5e0827=a133_0x1783c4[_0x5b1eb7(0x25b)](_0x3614e7)?a133_0x1783c4[_0x5b1eb7(0x14e)](_0x3614e7,_0x5b1eb7(0x1b3)):_0x20dac5[_0x5b1eb7(0x181)];if(_0x2e1828?.[_0x5b1eb7(0x1e2)])return{'agentName':_0x20dac5['name'],'action':_0x5b1eb7(0x236),'projectId':_0x3d4751};const _0x181f24=await this['client'][_0x5b1eb7(0x1f2)](_0x3d4751),_0x5c821e=await fetchAllToolTargetMaps((_0x175fe4,_0x1f42d2)=>this['client']['listToolTargets'](_0x175fe4,_0x1f42d2),_0x3d4751),_0x404cfb=new Map();for(const _0xce7bb0 of _0x181f24){_0x404cfb['set'](_0xce7bb0[_0x5b1eb7(0x25c)][_0x5b1eb7(0x1c3)],_0xce7bb0['id']);}const _0x475625=[],_0x40cc05={'projectId':_0x3d4751,'resolveToolTargetId':buildIdResolver({..._0x5c821e[_0x5b1eb7(0x191)],'Agent':_0x404cfb}),'resolvePromptId':async()=>undefined,'onWarning':_0x3b6c5e=>{const _0x3c544d=_0x5b1eb7;this['logger'][_0x3c544d(0x270)](_0x3b6c5e),_0x475625[_0x3c544d(0x223)](_0x3b6c5e);}};try{const _0x20760a=_0x181f24[_0x5b1eb7(0x1fd)](_0x32b5db=>_0x32b5db['attributes'][_0x5b1eb7(0x1c3)]===_0x20dac5[_0x5b1eb7(0x1c3)]),_0x9fca5b=await agentDefToRequest(_0x20dac5,_0xfe22e3,_0x5e0827,_0x40cc05);if(_0x20760a)return await this[_0x5b1eb7(0x1dc)][_0x5b1eb7(0x205)](_0x20760a['id'],_0x9fca5b),{'agentName':_0x20dac5[_0x5b1eb7(0x1c3)],'action':_0x5b1eb7(0x150),'projectId':_0x3d4751,'agentId':_0x20760a['id'],'warnings':_0x475625[_0x5b1eb7(0x1ef)]>0x0?_0x475625:undefined};else{const _0x3f6ce9=await this[_0x5b1eb7(0x1dc)]['createAgentResponse'](_0x9fca5b);return{'agentName':_0x20dac5['name'],'action':_0x5b1eb7(0x236),'projectId':_0x3d4751,'agentId':_0x3f6ce9['id'],'warnings':_0x475625[_0x5b1eb7(0x1ef)]>0x0?_0x475625:undefined};}}catch(_0x199ee6){return{'agentName':_0x20dac5[_0x5b1eb7(0x1c3)],'action':_0x5b1eb7(0x14b),'projectId':_0x3d4751,'error':_0x199ee6[_0x5b1eb7(0x1ba)],'warnings':_0x475625[_0x5b1eb7(0x1ef)]>0x0?_0x475625:undefined};}}async[a133_0x209be5(0x25f)](_0x442aec,_0x2aea61,_0x5089a9){const _0xb729c2=a133_0x209be5,_0x360d4f=a133_0x1783c4[_0xb729c2(0x25b)](_0x442aec)&&a133_0x1783c4[_0xb729c2(0x25b)](a133_0xef4c6e[_0xb729c2(0x20c)](_0x442aec,_0xb729c2(0x17d)));let _0x270480;const _0x39ee05=[],_0xfb22a=[],_0x130062=[],_0x2822a3=[],_0x538a8a=[],_0x377c35=[],_0x572223=[],_0x542e37=[],_0x4ef8aa=[];if(_0x360d4f){const _0x5895d5=loadAgentConfig(a133_0xef4c6e[_0xb729c2(0x20c)](_0x442aec,_0xb729c2(0x17d)));_0x270480=_0x5895d5[_0xb729c2(0x249)];const _0x323d41=a133_0x1783c4[_0xb729c2(0x1fb)](_0x442aec,{'withFileTypes':!![]});for(const _0xbb82b3 of _0x323d41){if(!_0xbb82b3[_0xb729c2(0x1cb)]())continue;if([_0xb729c2(0x20a),'experimental_knowledge_bases','experimental_artifacts',_0xb729c2(0x147),'integrations',_0xb729c2(0x177),_0xb729c2(0x248)][_0xb729c2(0x1e5)](_0xbb82b3[_0xb729c2(0x1c3)]))continue;const _0x526a16=a133_0xef4c6e[_0xb729c2(0x20c)](_0x442aec,_0xbb82b3[_0xb729c2(0x1c3)]);if(isAgentDir(_0x526a16)){const _0x70a021=a133_0xef4c6e[_0xb729c2(0x20c)](_0x526a16,_0xb729c2(0x256)),_0x8385eb=a133_0xef4c6e['join'](_0x526a16,_0xb729c2(0x17c)),_0x495ffa=a133_0xef4c6e[_0xb729c2(0x20c)](_0x526a16,'starter_message.md'),_0x4a9a96=parseAgentYaml(a133_0x1783c4[_0xb729c2(0x14e)](_0x70a021,'utf-8'),_0x70a021),_0x163c82=a133_0x1783c4[_0xb729c2(0x25b)](_0x8385eb)?a133_0x1783c4[_0xb729c2(0x14e)](_0x8385eb,_0xb729c2(0x1b3)):'',_0x313e9b=a133_0x1783c4[_0xb729c2(0x25b)](_0x495ffa)?a133_0x1783c4['readFileSync'](_0x495ffa,_0xb729c2(0x1b3)):_0x4a9a96[_0xb729c2(0x181)];_0x39ee05['push']({'name':_0x4a9a96[_0xb729c2(0x1c3)],'dir':_0x526a16,'yaml':_0x4a9a96,'systemPrompt':_0x163c82,'starterMessage':_0x313e9b});}}const _0x21aab7=getKnowledgeBasesDir(_0x442aec);if(a133_0x1783c4['existsSync'](_0x21aab7)){const _0x3e626d=a133_0x1783c4[_0xb729c2(0x1fb)](_0x21aab7);for(const _0x598bd6 of _0x3e626d){const _0x352920=a133_0xef4c6e['join'](_0x21aab7,_0x598bd6);if(_0x598bd6[_0xb729c2(0x26a)](_0xb729c2(0x18b))){const _0x1f5006=parseKnowledgeBaseYaml(a133_0x1783c4[_0xb729c2(0x14e)](_0x352920,'utf-8'),_0x352920);_0xfb22a[_0xb729c2(0x223)]({'name':_0x1f5006[_0xb729c2(0x1c3)],'path':_0x352920,'yaml':_0x1f5006});}else{if(_0x598bd6['endsWith']('.md')){const _0x1d74a3=a133_0x1783c4[_0xb729c2(0x14e)](_0x352920,_0xb729c2(0x1b3)),{name:_0x2d8755,text:_0x1034e9}=parseTextKnowledgeBaseMd(_0x1d74a3,_0x598bd6);_0x130062[_0xb729c2(0x223)]({'name':_0x2d8755,'path':_0x352920,'text':_0x1034e9});}}}}const _0x4cb42d=getPromptsDir(_0x442aec);if(a133_0x1783c4[_0xb729c2(0x25b)](_0x4cb42d)){const _0x377b49=a133_0x1783c4[_0xb729c2(0x1fb)](_0x4cb42d)[_0xb729c2(0x23e)](_0x2f7b61=>_0x2f7b61[_0xb729c2(0x26a)](_0xb729c2(0x18b)));for(const _0x34ddaf of _0x377b49){const _0x2e4b99=a133_0xef4c6e[_0xb729c2(0x20c)](_0x4cb42d,_0x34ddaf),_0x365e9e=parsePromptYaml(a133_0x1783c4[_0xb729c2(0x14e)](_0x2e4b99,'utf-8'),_0x2e4b99);_0x2822a3[_0xb729c2(0x223)]({'name':_0x365e9e[_0xb729c2(0x1c3)],'path':_0x2e4b99,'yaml':_0x365e9e});}}const _0x3d174e=getIntegrationsDir(_0x442aec);if(a133_0x1783c4[_0xb729c2(0x25b)](_0x3d174e)){const _0x235678=a133_0x1783c4[_0xb729c2(0x1fb)](_0x3d174e)['filter'](_0x6030be=>_0x6030be['endsWith'](_0xb729c2(0x18b)));for(const _0x528306 of _0x235678){const _0x12adc1=a133_0xef4c6e[_0xb729c2(0x20c)](_0x3d174e,_0x528306),_0x1bb3af=parseIntegrationYaml(a133_0x1783c4[_0xb729c2(0x14e)](_0x12adc1,_0xb729c2(0x1b3)),_0x12adc1);SAFE_INTEGRATION_TYPES[_0xb729c2(0x1e5)](_0x1bb3af['service_type']['toLowerCase']())?_0x538a8a['push']({'name':_0x1bb3af['name'],'path':_0x12adc1,'yaml':_0x1bb3af}):this[_0xb729c2(0x19c)][_0xb729c2(0x270)](_0xb729c2(0x161)+_0x1bb3af['name']+_0xb729c2(0x18e)+_0x1bb3af[_0xb729c2(0x184)]+_0xb729c2(0x148)+(_0xb729c2(0x24a)+SAFE_INTEGRATION_TYPES[_0xb729c2(0x20c)](',\x20')+_0xb729c2(0x218)));}}const _0x51a469=getExperimentalKnowledgeBasesDir(_0x442aec);if(a133_0x1783c4[_0xb729c2(0x25b)](_0x51a469)){const _0x15f04b=a133_0x1783c4[_0xb729c2(0x1fb)](_0x51a469,{'withFileTypes':!![]});for(const _0x4739d7 of _0x15f04b){if(!_0x4739d7[_0xb729c2(0x1cb)]())continue;const _0x1d3fc0=a133_0xef4c6e[_0xb729c2(0x20c)](_0x51a469,_0x4739d7[_0xb729c2(0x1c3)]),_0xfb9112=a133_0xef4c6e[_0xb729c2(0x20c)](_0x1d3fc0,_0x4739d7[_0xb729c2(0x1c3)]+_0xb729c2(0x18b));if(a133_0x1783c4['existsSync'](_0xfb9112)){const _0x13e060=parseExperimentalKnowledgeBaseYaml(a133_0x1783c4['readFileSync'](_0xfb9112,_0xb729c2(0x1b3)),_0xfb9112),_0x16987f=a133_0xef4c6e[_0xb729c2(0x20c)](_0x1d3fc0,_0xb729c2(0x1cd)),_0x95acf9=[];if(a133_0x1783c4[_0xb729c2(0x25b)](_0x16987f)){const _0x227246=a133_0x1783c4[_0xb729c2(0x1fb)](_0x16987f,{'withFileTypes':!![]});for(const _0x5149ff of _0x227246){if(!_0x5149ff[_0xb729c2(0x1cb)]())continue;const _0x4ca0b9=a133_0xef4c6e[_0xb729c2(0x20c)](_0x16987f,_0x5149ff['name']),_0x4e9159=a133_0xef4c6e[_0xb729c2(0x20c)](_0x4ca0b9,_0xb729c2(0x16f)),_0x4ccc3b=a133_0xef4c6e[_0xb729c2(0x20c)](_0x4ca0b9,_0xb729c2(0x21a));if(a133_0x1783c4['existsSync'](_0x4e9159)&&a133_0x1783c4[_0xb729c2(0x25b)](_0x4ccc3b)){const _0x4abfbc=a133_0x1783c4[_0xb729c2(0x14e)](_0x4e9159,_0xb729c2(0x1b3)),_0x3f9f8b=a133_0x1783c4[_0xb729c2(0x14e)](_0x4ccc3b,_0xb729c2(0x1b3));_0x95acf9[_0xb729c2(0x223)]({'name':_0x5149ff[_0xb729c2(0x1c3)],'code':_0x4abfbc,'json_schema':_0x3f9f8b});}}}const _0x4415f0={..._0x13e060,'functions':_0x95acf9};_0x377c35['push']({'name':_0x13e060[_0xb729c2(0x1c3)],'path':_0x1d3fc0,'def':_0x4415f0});}}}const _0x2fa51d=getExperimentalArtifactsDir(_0x442aec);if(a133_0x1783c4['existsSync'](_0x2fa51d)){const _0x6c1bf8=a133_0x1783c4[_0xb729c2(0x1fb)](_0x2fa51d,{'withFileTypes':!![]});for(const _0xec3dee of _0x6c1bf8){if(!_0xec3dee[_0xb729c2(0x1cb)]())continue;const _0xbb5b1a=a133_0xef4c6e[_0xb729c2(0x20c)](_0x2fa51d,_0xec3dee[_0xb729c2(0x1c3)]),_0x5ec5ab=a133_0xef4c6e['join'](_0xbb5b1a,_0xec3dee['name']+_0xb729c2(0x18b));if(a133_0x1783c4[_0xb729c2(0x25b)](_0x5ec5ab)){const _0x40205a=parseExperimentalArtifactYaml(a133_0x1783c4[_0xb729c2(0x14e)](_0x5ec5ab,'utf-8'),_0x5ec5ab),_0x44712f=a133_0xef4c6e[_0xb729c2(0x20c)](_0xbb5b1a,_0xb729c2(0x16f)),_0x5daac4=a133_0x1783c4[_0xb729c2(0x25b)](_0x44712f)?a133_0x1783c4['readFileSync'](_0x44712f,_0xb729c2(0x1b3)):'',_0x273599=a133_0xef4c6e[_0xb729c2(0x20c)](_0xbb5b1a,_0xb729c2(0x1cc)),_0x5876d9=[];if(a133_0x1783c4['existsSync'](_0x273599)){const _0x52e9ba=a133_0x1783c4[_0xb729c2(0x1fb)](_0x273599);for(const _0x72fea7 of _0x52e9ba){const _0x3ad3d2=a133_0xef4c6e[_0xb729c2(0x20c)](_0x273599,_0x72fea7);if(a133_0x1783c4['statSync'](_0x3ad3d2)[_0xb729c2(0x24b)]()){const _0x102906=a133_0x1783c4[_0xb729c2(0x14e)](_0x3ad3d2,_0xb729c2(0x1b3));_0x5876d9[_0xb729c2(0x223)]({'file_name':_0x72fea7,'text_content':_0x102906});}}}const _0x19c10f={..._0x40205a,'code':_0x5daac4,'files':_0x5876d9};_0x572223[_0xb729c2(0x223)]({'name':_0x40205a[_0xb729c2(0x1c3)],'path':_0xbb5b1a,'def':_0x19c10f});}}}const _0x3dd85f=getFormInterfacesDir(_0x442aec);if(a133_0x1783c4[_0xb729c2(0x25b)](_0x3dd85f)){const _0x36993c=a133_0x1783c4['readdirSync'](_0x3dd85f)['filter'](_0x119bcb=>_0x119bcb[_0xb729c2(0x26a)]('.yml'));for(const _0x46cb20 of _0x36993c){const _0x260103=a133_0xef4c6e[_0xb729c2(0x20c)](_0x3dd85f,_0x46cb20),_0x4ea135=parseFormInterfaceYaml(a133_0x1783c4[_0xb729c2(0x14e)](_0x260103,_0xb729c2(0x1b3)),_0x260103);_0x542e37['push']({'name':_0x4ea135['name'],'path':_0x260103,'yaml':_0x4ea135});}}const _0x3cc8e4=getChatInterfacesDir(_0x442aec);if(a133_0x1783c4[_0xb729c2(0x25b)](_0x3cc8e4)){const _0x58ba33=a133_0x1783c4[_0xb729c2(0x1fb)](_0x3cc8e4)['filter'](_0x2f900f=>_0x2f900f[_0xb729c2(0x26a)](_0xb729c2(0x18b)));for(const _0x5cd394 of _0x58ba33){const _0x5b6a27=a133_0xef4c6e[_0xb729c2(0x20c)](_0x3cc8e4,_0x5cd394),_0x561fe1=parseChatInterfaceYaml(a133_0x1783c4[_0xb729c2(0x14e)](_0x5b6a27,'utf-8'),_0x5b6a27);_0x4ef8aa[_0xb729c2(0x223)]({'name':_0x561fe1[_0xb729c2(0x1c3)],'path':_0x5b6a27,'yaml':_0x561fe1});}}}else{const _0x56f38b=await this[_0xb729c2(0x15c)](_0x442aec),_0x22b24f=await this['client'][_0xb729c2(0x267)](_0x56f38b);_0x270480=_0x22b24f['attributes'][_0xb729c2(0x1c3)];const _0x3242b9=await this['client'][_0xb729c2(0x1f2)](_0x56f38b),_0x15f3ff=await this[_0xb729c2(0x1dc)][_0xb729c2(0x230)](_0x56f38b),_0x50a1a6=await this[_0xb729c2(0x1dc)][_0xb729c2(0x1c0)](_0x56f38b),_0x5e0359=await this[_0xb729c2(0x1dc)]['listPrompts'](_0x56f38b),_0x510244=await this[_0xb729c2(0x1dc)][_0xb729c2(0x1e4)](_0x56f38b),_0x88fa1a=await safeListOrEmpty(()=>this[_0xb729c2(0x1dc)]['listExperimentalKnowledgeBases'](_0x56f38b)),_0x4fca8d=await safeListOrEmpty(()=>this[_0xb729c2(0x1dc)][_0xb729c2(0x23d)](_0x56f38b)),_0x544c54=new Map(),_0x532c97=new Map(),_0x5cb3db=new Map(),_0x4cbc49=new Map(),_0x4bd773=new Map(),_0x3cd570=new Map();for(const _0x5b323c of _0x15f3ff){_0x544c54[_0xb729c2(0x22a)](_0x5b323c['id'],_0x5b323c[_0xb729c2(0x25c)]['name']);}for(const _0xbc3719 of _0x50a1a6){_0x532c97[_0xb729c2(0x22a)](_0xbc3719['id'],_0xbc3719[_0xb729c2(0x25c)][_0xb729c2(0x1c3)]);}for(const _0x4e80c9 of _0x3242b9){_0x5cb3db[_0xb729c2(0x22a)](_0x4e80c9['id'],_0x4e80c9['attributes'][_0xb729c2(0x1c3)]);}for(const _0x519551 of _0x5e0359){_0x4cbc49['set'](_0x519551['id'],_0x519551[_0xb729c2(0x25c)][_0xb729c2(0x1c3)]);}for(const _0x57596f of _0x88fa1a){_0x4bd773[_0xb729c2(0x22a)](_0x57596f['id'],_0x57596f[_0xb729c2(0x25c)][_0xb729c2(0x1c3)]);}for(const _0x1bd76e of _0x4fca8d){_0x3cd570[_0xb729c2(0x22a)](_0x1bd76e['id'],_0x1bd76e['attributes'][_0xb729c2(0x1c3)]);}const _0x31a79a={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x544c54,'TextKnowledgeBase':_0x532c97,'Agent':_0x5cb3db,'ExperimentalKnowledgeBase':_0x4bd773}),'resolvePromptName':async _0x28b072=>_0x4cbc49['get'](_0x28b072),'onWarning':_0x146689=>this['logger'][_0xb729c2(0x270)](_0x146689)};for(const _0x1cf339 of _0x3242b9){const _0x582fa6=await agentResponseToDef(_0x1cf339,_0x31a79a),{yaml:_0x2a9667,systemPrompt:_0xcec79e,starterMessage:_0x33be41}=_0x582fa6;_0x39ee05[_0xb729c2(0x223)]({'name':_0x2a9667[_0xb729c2(0x1c3)],'dir':'','yaml':_0x2a9667,'systemPrompt':_0xcec79e,'starterMessage':_0x33be41});}for(const _0x2bf37a of _0x15f3ff){const _0x2b0f85=apiKnowledgeBaseToYaml(_0x2bf37a);_0xfb22a[_0xb729c2(0x223)]({'name':_0x2b0f85[_0xb729c2(0x1c3)],'path':'','yaml':_0x2b0f85});}for(const _0x1c0d62 of _0x50a1a6){_0x130062[_0xb729c2(0x223)]({'name':_0x1c0d62[_0xb729c2(0x25c)][_0xb729c2(0x1c3)],'path':'','text':_0x1c0d62['attributes'][_0xb729c2(0x21e)]});}for(const _0x2e8eb1 of _0x5e0359){const _0x1f87a6=await apiPromptToYaml(_0x2e8eb1,_0x31a79a);_0x1f87a6&&_0x2822a3[_0xb729c2(0x223)]({'name':_0x1f87a6[_0xb729c2(0x1c3)],'path':'','yaml':_0x1f87a6});}for(const _0x544f1c of _0x510244){if(!_0x544f1c[_0xb729c2(0x25c)][_0xb729c2(0x1ff)]&&SAFE_INTEGRATION_TYPES['includes'](_0x544f1c[_0xb729c2(0x25c)]['serviceType'][_0xb729c2(0x21c)]())){const _0x5a5d2e=await apiIntegrationToYaml(_0x544f1c,_0x31a79a);_0x538a8a['push']({'name':_0x544f1c['attributes'][_0xb729c2(0x1ee)][_0xb729c2(0x21c)](),'path':'','yaml':_0x5a5d2e});}}for(const _0x30bb87 of _0x88fa1a){const _0x152100=apiExperimentalKnowledgeBaseToYaml(_0x30bb87);_0x377c35['push']({'name':_0x152100[_0xb729c2(0x1c3)],'path':'','def':_0x152100});}for(const _0x3bd4ac of _0x4fca8d){const _0x52a395=apiExperimentalArtifactToYaml(_0x3bd4ac);_0x572223['push']({'name':_0x52a395[_0xb729c2(0x1c3)],'path':'','def':_0x52a395});}const _0x4fc02c=await safeListOrEmpty(()=>this[_0xb729c2(0x1dc)][_0xb729c2(0x1a0)](_0x56f38b));for(const _0x53fc39 of _0x4fc02c){const _0x22c8e6=await apiFormInterfaceToYaml(_0x53fc39,_0x31a79a);_0x542e37[_0xb729c2(0x223)]({'name':_0x22c8e6[_0xb729c2(0x1c3)],'path':'','yaml':_0x22c8e6});}const _0x5c538d=await safeListOrEmpty(()=>this['client'][_0xb729c2(0x251)](_0x56f38b));for(const _0x332482 of _0x5c538d){if(_0x332482['attributes'][_0xb729c2(0x1ff)])continue;const _0x570db7=await apiChatInterfaceToYaml(_0x332482,_0x31a79a);_0x4ef8aa['push']({'name':_0x570db7[_0xb729c2(0x1c3)],'path':'','yaml':_0x570db7});}}const _0x30d805={'sourceProjectName':_0x270480,'newProjectName':_0x2aea61,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'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},'formInterfaces':{'created':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'errors':0x0}}},_0x483a70=await this[_0xb729c2(0x1dc)][_0xb729c2(0x1d4)](),_0x2ea340=_0x483a70[_0xb729c2(0x1fd)](_0x317b7d=>_0x317b7d[_0xb729c2(0x25c)][_0xb729c2(0x1c3)]===_0x2aea61);if(_0x2ea340)throw new SDKError(ErrorCode[_0xb729c2(0x265)],_0xb729c2(0x1ed)+_0x2aea61+_0xb729c2(0x186),undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x5089a9?.['dryRun'])return _0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x158)][_0xb729c2(0x236)]=_0x39ee05[_0xb729c2(0x1ef)],_0x30d805['counts'][_0xb729c2(0x271)][_0xb729c2(0x236)]=_0xfb22a[_0xb729c2(0x1ef)],_0x30d805[_0xb729c2(0x1df)]['textKnowledgeBases'][_0xb729c2(0x236)]=_0x130062[_0xb729c2(0x1ef)],_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x24e)][_0xb729c2(0x236)]=_0x377c35[_0xb729c2(0x1ef)],_0x30d805[_0xb729c2(0x1df)]['experimentalArtifacts']['created']=_0x572223['length'],_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x147)][_0xb729c2(0x236)]=_0x2822a3[_0xb729c2(0x1ef)],_0x30d805['counts'][_0xb729c2(0x1bd)][_0xb729c2(0x236)]=_0x538a8a[_0xb729c2(0x1ef)],_0x30d805;const _0x5dd1c4=await this['client'][_0xb729c2(0x215)]({'name':_0x2aea61}),_0x32fc85=_0x5dd1c4['id'];_0x30d805['newProjectId']=_0x32fc85;const _0x8f9649=new Map(),_0xbc8f2a=new Map(),_0x3bd019=new Map(),_0x406d06=new Map(),_0x4e867d=new Map(),_0xd02766=new Map(),_0x571a1d=new Map(),_0x2269fb=new Map(),_0x5328a7=new Set(),_0x3dca91=new Set();for(const _0x2d4ccc of _0x39ee05){for(const _0x3cf976 of _0x2d4ccc[_0xb729c2(0x1a5)]['tools']||[]){if(_0x3cf976[_0xb729c2(0x1b4)]===_0xb729c2(0x19f)&&_0x3cf976[_0xb729c2(0x20e)]){const _0x5d155b=parseRef(_0x3cf976['target']);if(_0x5d155b)_0x5328a7[_0xb729c2(0x1c2)](_0x5d155b[_0xb729c2(0x1c3)]);}else{if(_0x3cf976['type']===_0xb729c2(0x180)&&_0x3cf976[_0xb729c2(0x20e)]){const _0x454113=parseRef(_0x3cf976[_0xb729c2(0x20e)]);if(_0x454113)_0x3dca91['add'](_0x454113['name']);}}}}for(const _0x71f423 of _0x5328a7){try{const _0x3169c0=await this[_0xb729c2(0x1dc)][_0xb729c2(0x153)]({'projectId':_0x32fc85,'name':_0x71f423});_0x4e867d[_0xb729c2(0x22a)](_0x71f423,_0x3169c0['id']),_0x30d805['imageGenerators'][_0xb729c2(0x223)]({'name':_0x71f423,'action':'created','id':_0x3169c0['id']}),_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x1dd)][_0xb729c2(0x236)]++;}catch(_0x4740c0){_0x30d805[_0xb729c2(0x1dd)][_0xb729c2(0x223)]({'name':_0x71f423,'action':'error','error':_0x4740c0['message']}),_0x30d805['counts'][_0xb729c2(0x1dd)][_0xb729c2(0x1f8)]++;}}for(const _0x213bc6 of _0x3dca91){try{const _0xae4c1a=await this[_0xb729c2(0x1dc)]['createWebSearchTool']({'projectId':_0x32fc85,'name':_0x213bc6});_0xd02766[_0xb729c2(0x22a)](_0x213bc6,_0xae4c1a['id']),_0x30d805['webSearchTools']['push']({'name':_0x213bc6,'action':_0xb729c2(0x236),'id':_0xae4c1a['id']}),_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x18f)][_0xb729c2(0x236)]++;}catch(_0x484e57){_0x30d805[_0xb729c2(0x18f)][_0xb729c2(0x223)]({'name':_0x213bc6,'action':_0xb729c2(0x14b),'error':_0x484e57[_0xb729c2(0x1ba)]}),_0x30d805[_0xb729c2(0x1df)]['webSearchTools']['errors']++;}}const _0x3c0879=await fetchAllToolTargetMaps((_0x40fc20,_0x8248e8)=>this[_0xb729c2(0x1dc)][_0xb729c2(0x14f)](_0x40fc20,_0x8248e8),_0x32fc85);let _0x38d21e=[];const _0x17df10={'projectId':_0x32fc85,'resolveToolTargetId':buildIdResolver({..._0x3c0879[_0xb729c2(0x191)],'KnowledgeBase':_0x8f9649,'TextKnowledgeBase':_0xbc8f2a,'ExperimentalKnowledgeBase':_0x571a1d,'Agent':_0x3bd019,'WebSearchTool':_0xd02766,'ImageGenerator':_0x4e867d}),'resolvePromptId':async _0x286cb8=>_0x406d06['get'](_0x286cb8),'onWarning':_0x5555c5=>{const _0xa2698a=_0xb729c2;this['logger'][_0xa2698a(0x270)](_0x5555c5),_0x38d21e['push'](_0x5555c5);}};for(const _0x564b28 of _0xfb22a){try{const _0x5238b1=yamlKnowledgeBaseToApi(_0x564b28[_0xb729c2(0x1a5)],_0x32fc85),_0x4aa6c1=await this[_0xb729c2(0x1dc)][_0xb729c2(0x1e7)](_0x5238b1);_0x8f9649[_0xb729c2(0x22a)](_0x564b28['yaml']['name'],_0x4aa6c1['id']),_0x30d805[_0xb729c2(0x271)][_0xb729c2(0x223)]({'name':_0x564b28['yaml'][_0xb729c2(0x1c3)],'action':_0xb729c2(0x236),'id':_0x4aa6c1['id']}),_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x271)]['created']++;}catch(_0x5d9a9a){_0x30d805[_0xb729c2(0x271)][_0xb729c2(0x223)]({'name':_0x564b28[_0xb729c2(0x1a5)][_0xb729c2(0x1c3)],'action':_0xb729c2(0x14b),'error':_0x5d9a9a[_0xb729c2(0x1ba)]}),_0x30d805['counts']['knowledgeBases'][_0xb729c2(0x1f8)]++;}}for(const _0x22c4bb of _0x130062){try{const _0x29b3b5=yamlTextKnowledgeBaseToApi({'name':_0x22c4bb[_0xb729c2(0x1c3)],'text':_0x22c4bb[_0xb729c2(0x21e)]},_0x32fc85),_0x2a8bf2=await this[_0xb729c2(0x1dc)][_0xb729c2(0x1d3)](_0x29b3b5);_0xbc8f2a[_0xb729c2(0x22a)](_0x22c4bb[_0xb729c2(0x1c3)],_0x2a8bf2['id']),_0x30d805[_0xb729c2(0x193)]['push']({'name':_0x22c4bb[_0xb729c2(0x1c3)],'action':_0xb729c2(0x236),'id':_0x2a8bf2['id']}),_0x30d805[_0xb729c2(0x1df)]['textKnowledgeBases'][_0xb729c2(0x236)]++;}catch(_0x12330a){_0x30d805[_0xb729c2(0x193)]['push']({'name':_0x22c4bb[_0xb729c2(0x1c3)],'action':_0xb729c2(0x14b),'error':_0x12330a['message']}),_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x193)]['errors']++;}}for(const _0x2ca958 of _0x572223){try{const _0x1cb34f=yamlExperimentalArtifactToApi(_0x2ca958[_0xb729c2(0x14d)],_0x32fc85),_0x5664e9=await this[_0xb729c2(0x1dc)][_0xb729c2(0x214)](_0x1cb34f);_0x2269fb[_0xb729c2(0x22a)](_0x2ca958['def'][_0xb729c2(0x1c3)],_0x5664e9['id']),_0x30d805[_0xb729c2(0x1b7)][_0xb729c2(0x223)]({'name':_0x2ca958[_0xb729c2(0x14d)][_0xb729c2(0x1c3)],'action':'created','id':_0x5664e9['id']}),_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x1b7)][_0xb729c2(0x236)]++;}catch(_0x162f77){_0x30d805['experimentalArtifacts'][_0xb729c2(0x223)]({'name':_0x2ca958['def'][_0xb729c2(0x1c3)],'action':_0xb729c2(0x14b),'error':_0x162f77[_0xb729c2(0x1ba)]}),_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x1b7)][_0xb729c2(0x1f8)]++;}}for(const _0x5101c5 of _0x377c35){try{const _0x48c3d6=yamlExperimentalKnowledgeBaseToApi(_0x5101c5[_0xb729c2(0x14d)],_0x32fc85),_0x477791=await this[_0xb729c2(0x1dc)][_0xb729c2(0x170)](_0x48c3d6);_0x571a1d[_0xb729c2(0x22a)](_0x5101c5[_0xb729c2(0x14d)][_0xb729c2(0x1c3)],_0x477791['id']),_0x30d805[_0xb729c2(0x24e)][_0xb729c2(0x223)]({'name':_0x5101c5[_0xb729c2(0x14d)][_0xb729c2(0x1c3)],'action':_0xb729c2(0x236),'id':_0x477791['id']}),_0x30d805[_0xb729c2(0x1df)]['experimentalKnowledgeBases'][_0xb729c2(0x236)]++;}catch(_0x5db2fa){_0x30d805['experimentalKnowledgeBases']['push']({'name':_0x5101c5[_0xb729c2(0x14d)][_0xb729c2(0x1c3)],'action':_0xb729c2(0x14b),'error':_0x5db2fa[_0xb729c2(0x1ba)]}),_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x24e)][_0xb729c2(0x1f8)]++;}}const _0x29fa27=[..._0x39ee05][_0xb729c2(0x15a)]((_0x506c62,_0x34487c)=>{const _0x7933bf=_0xb729c2,_0x8de841=_0x506c62['yaml'][_0x7933bf(0x226)]?.['some'](_0x4c99ca=>_0x4c99ca['type']===_0x7933bf(0x1d9))??![],_0x32efc6=_0x34487c['yaml'][_0x7933bf(0x226)]?.[_0x7933bf(0x169)](_0x3a0b37=>_0x3a0b37['type']==='agent')??![];if(_0x8de841&&!_0x32efc6)return 0x1;if(!_0x8de841&&_0x32efc6)return-0x1;return 0x0;});for(const _0x33d545 of _0x29fa27){_0x38d21e=[];try{const _0x1d803b=_0x33d545['yaml'][_0xb729c2(0x226)]?.[_0xb729c2(0x23e)](_0x4cc6f3=>{const _0x39e28b=_0xb729c2;if(_0x4cc6f3[_0x39e28b(0x1b4)]===_0x39e28b(0x1d9)&&_0x4cc6f3[_0x39e28b(0x20e)]){const _0x4435e1=parseRef(_0x4cc6f3['target']);return _0x4435e1?.['name']===_0x33d545[_0x39e28b(0x1a5)]['name'];}return![];})??[];if(_0x1d803b[_0xb729c2(0x1ef)]>0x0){const _0x25d9f2=_0xb729c2(0x197)+_0x33d545['yaml'][_0xb729c2(0x1c3)]+_0xb729c2(0x1d7)+_0xb729c2(0x1ce);this[_0xb729c2(0x19c)]['warn'](_0x25d9f2),_0x38d21e[_0xb729c2(0x223)](_0x25d9f2);}const _0xbfbe76=await agentDefToRequest(_0x33d545['yaml'],_0x33d545[_0xb729c2(0x22f)],_0x33d545[_0xb729c2(0x1d5)],_0x17df10),_0x4e3bac=await this[_0xb729c2(0x1dc)]['createAgentResponse'](_0xbfbe76);_0x3bd019[_0xb729c2(0x22a)](_0x33d545[_0xb729c2(0x1a5)][_0xb729c2(0x1c3)],_0x4e3bac['id']),_0x30d805[_0xb729c2(0x158)][_0xb729c2(0x223)]({'agentName':_0x33d545[_0xb729c2(0x1a5)][_0xb729c2(0x1c3)],'action':_0xb729c2(0x236),'agentId':_0x4e3bac['id'],'warnings':_0x38d21e[_0xb729c2(0x1ef)]>0x0?_0x38d21e:undefined}),_0x30d805['counts'][_0xb729c2(0x158)][_0xb729c2(0x236)]++;}catch(_0x57bb9d){_0x30d805['agents'][_0xb729c2(0x223)]({'agentName':_0x33d545['yaml'][_0xb729c2(0x1c3)],'action':_0xb729c2(0x14b),'error':_0x57bb9d[_0xb729c2(0x1ba)],'warnings':_0x38d21e['length']>0x0?_0x38d21e:undefined}),_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x158)]['errors']++;}}for(const _0x32e9a9 of _0x2822a3){try{const _0x4b0198=await yamlPromptToApi(_0x32e9a9[_0xb729c2(0x1a5)],_0x32fc85,_0x17df10);if(!_0x4b0198){_0x30d805[_0xb729c2(0x147)][_0xb729c2(0x223)]({'name':_0x32e9a9[_0xb729c2(0x1a5)][_0xb729c2(0x1c3)],'action':_0xb729c2(0x14b),'error':_0xb729c2(0x217)}),_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x147)][_0xb729c2(0x1f8)]++;continue;}const _0x1a09be=await this[_0xb729c2(0x1dc)][_0xb729c2(0x260)](_0x4b0198);_0x406d06['set'](_0x32e9a9[_0xb729c2(0x1a5)][_0xb729c2(0x1c3)],_0x1a09be['id']),_0x30d805['prompts']['push']({'name':_0x32e9a9[_0xb729c2(0x1a5)][_0xb729c2(0x1c3)],'action':'created','id':_0x1a09be['id']}),_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x147)][_0xb729c2(0x236)]++;}catch(_0x1feeb4){_0x30d805[_0xb729c2(0x147)]['push']({'name':_0x32e9a9['yaml'][_0xb729c2(0x1c3)],'action':_0xb729c2(0x14b),'error':_0x1feeb4['message']}),_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x147)][_0xb729c2(0x1f8)]++;}}for(const _0x365225 of _0x538a8a){try{const _0xa6ee56=await yamlIntegrationToApi(_0x365225['yaml'],_0x32fc85,_0x17df10),_0x1af927=await this[_0xb729c2(0x1dc)][_0xb729c2(0x155)](_0xa6ee56);_0x30d805['integrations'][_0xb729c2(0x223)]({'name':_0x365225['yaml'][_0xb729c2(0x184)],'action':_0xb729c2(0x236),'id':_0x1af927['id']}),_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x1bd)][_0xb729c2(0x236)]++;}catch(_0x49c5d4){_0x30d805[_0xb729c2(0x1bd)][_0xb729c2(0x223)]({'name':_0x365225['yaml'][_0xb729c2(0x184)],'action':_0xb729c2(0x14b),'error':_0x49c5d4[_0xb729c2(0x1ba)]}),_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x1bd)][_0xb729c2(0x1f8)]++;}}for(const _0x574e66 of _0x542e37){try{const _0x484ebd=await yamlFormInterfaceToApi(_0x574e66[_0xb729c2(0x1a5)],_0x32fc85,_0x17df10);if(!_0x484ebd){_0x30d805[_0xb729c2(0x18d)][_0xb729c2(0x223)]({'name':_0x574e66['yaml']['name'],'action':_0xb729c2(0x14b),'error':_0xb729c2(0x216)}),_0x30d805[_0xb729c2(0x1df)]['formInterfaces'][_0xb729c2(0x1f8)]++;continue;}const _0x66cd01=await this[_0xb729c2(0x1dc)][_0xb729c2(0x15e)](_0x484ebd);_0x30d805[_0xb729c2(0x18d)][_0xb729c2(0x223)]({'name':_0x574e66[_0xb729c2(0x1a5)][_0xb729c2(0x1c3)],'action':_0xb729c2(0x236),'id':_0x66cd01['id']}),_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x18d)][_0xb729c2(0x236)]++;}catch(_0x982fe0){_0x30d805[_0xb729c2(0x18d)][_0xb729c2(0x223)]({'name':_0x574e66[_0xb729c2(0x1a5)][_0xb729c2(0x1c3)],'action':_0xb729c2(0x14b),'error':_0x982fe0[_0xb729c2(0x1ba)]}),_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x18d)][_0xb729c2(0x1f8)]++;}}for(const _0x58e581 of _0x4ef8aa){try{const _0x28e44d=await yamlChatInterfaceToApi(_0x58e581[_0xb729c2(0x1a5)],_0x32fc85,_0x17df10),_0x3616c9=await this[_0xb729c2(0x1dc)]['createChatInterface'](_0x28e44d);_0x30d805['chatInterfaces']['push']({'name':_0x58e581[_0xb729c2(0x1a5)][_0xb729c2(0x1c3)],'action':_0xb729c2(0x236),'id':_0x3616c9['id']}),_0x30d805[_0xb729c2(0x1df)]['chatInterfaces'][_0xb729c2(0x236)]++;}catch(_0x26ceb9){_0x30d805[_0xb729c2(0x146)][_0xb729c2(0x223)]({'name':_0x58e581[_0xb729c2(0x1a5)][_0xb729c2(0x1c3)],'action':_0xb729c2(0x14b),'error':_0x26ceb9[_0xb729c2(0x1ba)]}),_0x30d805[_0xb729c2(0x1df)][_0xb729c2(0x146)][_0xb729c2(0x1f8)]++;}}return _0x30d805;}}
1
+ const a133_0x14e51b=a133_0xbdbc;(function(_0x22332f,_0xcc15f9){const _0x53acf2=a133_0xbdbc,_0x313a25=_0x22332f();while(!![]){try{const _0x463b61=parseInt(_0x53acf2(0xa8))/0x1*(-parseInt(_0x53acf2(0xf3))/0x2)+-parseInt(_0x53acf2(0x196))/0x3*(parseInt(_0x53acf2(0x188))/0x4)+parseInt(_0x53acf2(0x163))/0x5*(-parseInt(_0x53acf2(0x11c))/0x6)+parseInt(_0x53acf2(0xd2))/0x7*(-parseInt(_0x53acf2(0x13f))/0x8)+-parseInt(_0x53acf2(0x11f))/0x9*(parseInt(_0x53acf2(0x13b))/0xa)+parseInt(_0x53acf2(0xe5))/0xb+parseInt(_0x53acf2(0x145))/0xc*(parseInt(_0x53acf2(0x141))/0xd);if(_0x463b61===_0xcc15f9)break;else _0x313a25['push'](_0x313a25['shift']());}catch(_0x3c28c2){_0x313a25['push'](_0x313a25['shift']());}}}(a133_0x5b5b,0x7ec7c));import{LLMApiClient}from'../client/llm-api-client.js';import*as a133_0x496aed from'node:fs';import*as a133_0x59991e from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';function a133_0x5b5b(){const _0x8714b1=['Renamed\x20folder:\x20','listExperimentalKnowledgeBases','sdk.llm','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','serviceType','createExperimentalArtifact','5FAnKwD','agent','\x0a\x0a#\x20agent.yml\x0a','idToName','size','updated','getAgent','json_schema','signal','integrations.json','Project\x20not\x20found:\x20','createImageGenerator','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','createAgentResponse','listAgents','isFile','cloneProject','ALREADY_EXISTS','\x22\x20already\x20exists','updateAgent','history','site','Could\x20not\x20resolve\x20agent\x20reference','KnowledgeBase','Renamed\x20prompt\x20file:\x20','none','resolveProjectId','continueChat','agent.yml','resolveAgentId','project','template','conflict','formInterfaces','---\x20schema:\x20','info','1876252zKgkPk','tables','isDirectory','project.json','listImageGenerators','projectId','chats','agents','name','counts','chatInfo','add','Only\x20safe\x20types\x20(','isDir','3yMFkLI','Renamed\x20KB\x20file:\x20','listWebSearchTools','dry-run-','slackMessageMode','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','createKnowledgeBase','code','textKnowledgeBases','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','webSearchTools','includes','backupProject','.md','Agent\x20\x27','dryRun','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','text_content','getChatInfo','displayName','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','listAgentsFull','getChatHistory','cwd','status','experimental_artifacts','warn','chatId','readdirSync','getBackupMetadata','availableModels','clearDefaultAgent','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','updatePrompt','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','updateTextKnowledgeBase','knowledgeBases','metadata','stringify','Skipping\x20integration\x20\x27','Agent\x20not\x20found:\x20','Agent\x20reference\x20not\x20found','chatInterfaces','file_name','agentId',')\x20can\x20be\x20pushed.\x20','\x27\x20(','Renamed\x20form\x20interface\x20file:\x20','agentsFull','experimentalArtifacts','medium','new','error','Renamed\x20agent\x20folder:\x20','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','join','mkdirSync','tdx_','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','Renamed\x20integration\x20file:\x20','isManaged','---\x20file:\x20','33531xgHcHD','variables','dir','starter_message.md','createChatInterface','content','createExperimentalKnowledgeBase','path','createWebSearchTool','createPrompt','Multiple\x20agents\x20found\x20with\x20name\x20\x27','INTERNAL','json_schema.json','listTextKnowledgeBases','LLM_PROJECT_NOT_FOUND','Invalid\x20agent\x20reference\x20format:\x20','\x20→\x20','unchanged','temperature','NOT_FOUND','toLowerCase','Backup\x20folder\x20not\x20found:\x20','getDefaultAgent','knowledge_bases','Unsupported\x20backup\x20version:\x20','models','knowledgebases.json','basename','Unresolved\x20dependencies:\x20','setDefaultAgent','1.0','getUserSettings','TextKnowledgeBase','imageGenerators','No\x20tdx.json\x20found\x20in\x20','_reasoning_','find','dirname','text','\x0a---\x20code\x20---\x0a','\x20---\x0a','form_interfaces','203IXBIIw','unlinkSync','listFormInterfaces','context','total','map','yaml','localeCompare','updateAgentResponse','type','writeFileSync','starterMessage','getProject','modelType','description','integrations','prompts.json','existsSync','AGENT_NOT_FOUND','669471dPrsCF','push','version','UNAUTHENTICATED','parse','listProjects','logger','chat_interfaces','functions','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','INVALID_ARGUMENT','target','utf-8','listExperimentalArtifacts','2FbKKJf','errors','created','low','message','tdx.json','client','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','deleteAgent','already\x20exists','event','startChat','pullAgent','web_search','listChats','listKnowledgeBases','def','chat_parent_segment','profile','tdx_default_','renamed','high','listIntegrations',')\x20can\x20be\x20cloned.','llm_project','loadJsonFile','Output\x20directory\x20already\x20exists:\x20','Unable\x20to\x20create\x20project\x20after\x20','getOrCreateDefaultAgent','experimentalKnowledgeBases','exportedFrom','Renamed\x20experimental\x20artifact\x20directory:\x20','createAgent','#\x20prompt.md\x0a','nameToId','set','prompt.md','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','statSync','systemPrompt','3622374tfJNfJ','listToolTargets','service_type','18KIPMoz','.llm','PERMISSION_DENIED','createIntegration','getCurrentProject','oldPath','some','pushProject','getDefaultProjectName','jsonSchemaHint','\x0a---\x20function:\x20','sort','updateFormInterface','tdDatabaseName','filter','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','pushAgent','agents.json','readFileSync','claude-4.5-sonnet','has','resolveProjectName','rmSync','experimental_knowledge_bases','action','createFormInterface','getChatLog','Removed\x20deleted\x20directory:\x20','3451210ZsoZou','\x20in\x20project\x20','prompts','updateExperimentalKnowledgeBase','17400YYzZvz','tools','13fwfPCL','updateExperimentalArtifact','endsWith','getOrCreateDefaultProject','27816852LnjbYR','newProjectId','chatWelcomeMessage','Renamed\x20text\x20KB\x20file:\x20','toISOString','createProject','.yml','chat_generic','files','starter_message','\x0a---\x20schema:\x20','code.js','promptId','updateChatInterface','createTextKnowledgeBase','currentProjectId','get','updateKnowledgeBase','):\x20','listPrompts','attributes','split','length','Renamed\x20chat\x20interface\x20file:\x20'];a133_0x5b5b=function(){return _0x8714b1;};return a133_0x5b5b();}import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';function a133_0xbdbc(_0x3e7894,_0x223fdf){_0x3e7894=_0x3e7894-0xa1;const _0x5b5bb9=a133_0x5b5b();let _0xbdbc4a=_0x5b5bb9[_0x3e7894];return _0xbdbc4a;}import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a133_0x14e51b(0x14c),'chat_agent_console',a133_0x14e51b(0x105)];async function safeListOrEmpty(_0x463d7e){try{return await _0x463d7e();}catch(_0x29587c){if(_0x29587c instanceof HTTPClientError&&_0x29587c['status']===0x194)return[];throw _0x29587c;}}export class LLMSDK{[a133_0x14e51b(0x154)];[a133_0x14e51b(0xf9)];[a133_0x14e51b(0xd5)];[a133_0x14e51b(0xeb)]=Logger['of'](a133_0x14e51b(0x15f));constructor(_0x434043){const _0x50eb27=a133_0x14e51b;this[_0x50eb27(0xf9)]=new LLMApiClient(_0x434043),this[_0x50eb27(0xd5)]=_0x434043;}[a133_0x14e51b(0x127)](){const _0x565cb4=a133_0x14e51b,_0x52dc45=getSanitizedUsername();return _0x565cb4(0x107)+_0x52dc45;}async['setCurrentProject'](_0x2f6cc9){const _0x4f318f=a133_0x14e51b,{projectId:_0xa99eb}=await this['resolveProjectName'](_0x2f6cc9);this[_0x4f318f(0x154)]=_0xa99eb;}[a133_0x14e51b(0x123)](){const _0x261dce=a133_0x14e51b;return this[_0x261dce(0x154)];}async[a133_0x14e51b(0xc5)](_0x2ecf8f){const _0x16d488=a133_0x14e51b,_0x1873b5=this[_0x16d488(0xd5)][_0x16d488(0x106)];let _0x280514,_0x5cd6f8;if(_0x2ecf8f[_0x16d488(0x1a1)]('/')){const _0xa00754=_0x2ecf8f[_0x16d488(0x15a)]('/');if(_0xa00754[_0x16d488(0x15b)]!==0x2)throw new SDKError(ErrorCode[_0x16d488(0xef)],_0x16d488(0xb7)+_0x2ecf8f,undefined,{'helpText':_0x16d488(0x170)});const [_0x51b771,_0x6e08bd]=_0xa00754;_0x280514=await this[_0x16d488(0x17e)](_0x51b771),_0x5cd6f8=_0x6e08bd;}else _0x280514=this[_0x16d488(0x154)]||(await this[_0x16d488(0x144)]())['id'],_0x5cd6f8=_0x2ecf8f;const _0x517a9b=await this[_0x16d488(0x181)](_0x5cd6f8,_0x280514),_0x20fc46=await this[_0x16d488(0xf9)][_0x16d488(0x169)](_0x517a9b);writeCachedLLMAgent(_0x20fc46['attributes'][_0x16d488(0x190)],_0x517a9b,_0x280514,_0x1873b5);}[a133_0x14e51b(0xbe)](){const _0x3a8918=a133_0x14e51b,_0x1195dd=this[_0x3a8918(0xd5)][_0x3a8918(0x106)];return readCachedLLMAgent(_0x1195dd)||undefined;}[a133_0x14e51b(0x1b5)](){const _0x4d0196=a133_0x14e51b,_0x22ec06=this[_0x4d0196(0xd5)][_0x4d0196(0x106)];clearCachedLLMAgent(_0x22ec06);}async[a133_0x14e51b(0xc1)](){const _0x513a2d=a133_0x14e51b,_0x36ad02=await this[_0x513a2d(0xf9)][_0x513a2d(0xc7)](),_0x4572da=[];for(const _0x24aef1 of _0x36ad02['availableModelNames']){const _0x19abb8=_0x36ad02[_0x513a2d(0x1b4)][_0x24aef1];_0x19abb8&&_0x4572da['push']({'name':_0x24aef1,'displayName':_0x19abb8[_0x513a2d(0x1a9)]});}return _0x4572da;}async[a133_0x14e51b(0x14a)](_0x5eb335){const _0x24a607=a133_0x14e51b;return await this[_0x24a607(0xf9)][_0x24a607(0x14a)](_0x5eb335);}async['deleteProject'](_0x1072b4){const _0x204fab=a133_0x14e51b,{projectId:_0x4b3f8d}=await this[_0x204fab(0x134)](_0x1072b4);await this[_0x204fab(0xf9)]['deleteProject'](_0x4b3f8d);}async['projects'](_0x6f820a=0x32){const _0x2714bc=a133_0x14e51b;return await this[_0x2714bc(0xf9)][_0x2714bc(0xea)](_0x6f820a);}async[a133_0x14e51b(0x144)](_0x17c950){const _0x19d1c7=a133_0x14e51b,_0x5d86e8=_0x17c950||this[_0x19d1c7(0x127)](),_0x36a5eb=this['context'][_0x19d1c7(0x106)];if(!_0x17c950){const _0x273381=readCachedLLMProject(_0x36a5eb);if(_0x273381&&_0x273381[_0x19d1c7(0x190)]===_0x5d86e8)try{const _0x123586=await this[_0x19d1c7(0xf9)][_0x19d1c7(0xde)](_0x273381['id']);if(_0x123586['attributes']['name']===_0x5d86e8)return _0x123586;}catch{}}const _0x2b1c54=await this['client']['listProjects'](),_0x3c6161=_0x2b1c54['find'](_0x3c3764=>_0x3c3764['attributes'][_0x19d1c7(0x190)]===_0x5d86e8);if(_0x3c6161)return!_0x17c950&&writeCachedLLMProject(_0x5d86e8,_0x3c6161['id'],_0x36a5eb),_0x3c6161;const _0x152fb5=await this[_0x19d1c7(0xf9)][_0x19d1c7(0x14a)]({'name':_0x5d86e8,'description':_0x19d1c7(0xfa)+getSanitizedUsername()+')'});return!_0x17c950&&writeCachedLLMProject(_0x5d86e8,_0x152fb5['id'],_0x36a5eb),_0x152fb5;}async[a133_0x14e51b(0x17e)](_0x55a630){const _0x39231=a133_0x14e51b,_0x486f4a=await this[_0x39231(0xf9)][_0x39231(0xea)](),_0x2759cd=_0x486f4a['filter'](_0x23fd11=>_0x23fd11[_0x39231(0x159)]['name']===_0x55a630);if(_0x2759cd[_0x39231(0x15b)]===0x0)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0x55a630,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x2759cd['length']>0x1)throw new SDKError(ErrorCode['INTERNAL'],'Multiple\x20projects\x20found\x20with\x20name\x20\x27'+_0x55a630+'\x27.\x20This\x20should\x20not\x20happen.');return _0x2759cd[0x0]['id'];}async[a133_0x14e51b(0x134)](_0x4e7641){const _0x23949d=a133_0x14e51b,_0x222f11=await this['client'][_0x23949d(0xea)](),_0x4eaef8=_0x222f11[_0x23949d(0xcc)](_0x2700ea=>_0x2700ea['attributes'][_0x23949d(0x190)]===_0x4e7641);if(_0x4eaef8)return{'projectId':_0x4eaef8['id'],'project':_0x4eaef8};throw new SDKError(ErrorCode[_0x23949d(0xb6)],_0x23949d(0x16d)+_0x4e7641,undefined,{'helpText':_0x23949d(0xfb)});}async[a133_0x14e51b(0x110)](_0x41fb7e=a133_0x14e51b(0x132),_0xb66b83=0x0,_0xaa0422){const _0x2eed10=a133_0x14e51b,_0x12ce95=0xa;let _0x406164=0x0,_0x1f33a1;while(_0x406164<_0x12ce95){try{const _0x5c9814=await this[_0x2eed10(0x144)](_0x1f33a1),_0x227f9=_0x5c9814['id'],_0x2dcb1a=[_0x2eed10(0x17d),'minimal',_0x2eed10(0xf6),_0x2eed10(0x1c8),_0x2eed10(0x109)],_0x8d190d=_0xb66b83===0x0?_0x2eed10(0xa3)+_0x41fb7e:'tdx_'+_0x41fb7e+_0x2eed10(0xcb)+_0x2dcb1a[_0xb66b83],_0x526dea=await this[_0x2eed10(0xf9)]['listAgents'](_0x227f9),_0xb56973=_0x526dea[_0x2eed10(0xcc)](_0x170345=>_0x170345[_0x2eed10(0x159)][_0x2eed10(0x190)]===_0x8d190d);if(_0xb56973)return _0xb56973;const _0x3f266f=_0xb66b83>0x0?0x1:_0xaa0422;return await this[_0x2eed10(0xf9)][_0x2eed10(0x114)]({'name':_0x8d190d,'projectId':_0x227f9,'modelType':_0x41fb7e,'systemPrompt':'','temperature':_0x3f266f,'reasoningEffort':_0xb66b83>0x0?_0xb66b83:undefined});}catch(_0x3f20a7){if(_0x3f20a7 instanceof HTTPClientError){const _0x40f0b4=_0x3f20a7[_0x2eed10(0x1ae)];if(_0x40f0b4>=0x190&&_0x40f0b4<0x1f4){if(_0x40f0b4===0x191)throw new SDKError(ErrorCode[_0x2eed10(0xe8)],'Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.',_0x3f20a7);else{if(_0x40f0b4===0x193)throw new SDKError(ErrorCode[_0x2eed10(0x121)],_0x2eed10(0x1cc),_0x3f20a7);}throw _0x3f20a7;}}if(errorContains(_0x3f20a7,_0x2eed10(0xfd),'duplicate',_0x2eed10(0x184))){_0x406164++;if(_0x406164>=_0x12ce95)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x2eed10(0x10f)+_0x12ce95+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x3f20a7);const _0x2d9f1d=this['getDefaultProjectName']();_0x1f33a1=_0x2d9f1d+'_'+generateRandomHex();continue;}throw _0x3f20a7;}}throw new SDKError(ErrorCode[_0x2eed10(0xb3)],_0x2eed10(0x12e));}async['resolveAgentId'](_0x3973a6,_0x310c5d){const _0x2fe5f5=a133_0x14e51b,_0x2995f3=_0x310c5d||this['currentProjectId'],_0x21c405=await this['client']['listAgents'](_0x2995f3),_0x4f6a03=_0x21c405[_0x2fe5f5(0x12d)](_0x1a47bd=>_0x1a47bd[_0x2fe5f5(0x159)]['name']===_0x3973a6);if(_0x4f6a03[_0x2fe5f5(0x15b)]===0x0){const _0x38bb55=_0x2995f3?_0x2fe5f5(0x13c)+_0x2995f3:'';throw new SDKError(ErrorCode[_0x2fe5f5(0xe4)],_0x2fe5f5(0x1be)+_0x3973a6+_0x38bb55,undefined,{'helpText':_0x2995f3?_0x2fe5f5(0x16f):'Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.'});}if(_0x4f6a03[_0x2fe5f5(0x15b)]>0x1)throw new SDKError(ErrorCode[_0x2fe5f5(0xb3)],_0x2fe5f5(0xb2)+_0x3973a6+'\x27.\x20This\x20should\x20not\x20happen.');return _0x4f6a03[0x0]['id'];}async[a133_0x14e51b(0x18f)](_0x1ea515){const _0x36fca0=a133_0x14e51b,_0x5b2c4c=_0x1ea515||this[_0x36fca0(0x154)];return await this[_0x36fca0(0xf9)][_0x36fca0(0x172)](_0x5b2c4c);}async[a133_0x14e51b(0x1c6)](_0x14febe){const _0x1279f0=a133_0x14e51b;return await this[_0x1279f0(0xf9)][_0x1279f0(0x1ab)](_0x14febe);}async['agent'](_0x2faa71){const _0x26a5ff=a133_0x14e51b;return await this[_0x26a5ff(0xf9)][_0x26a5ff(0x169)](_0x2faa71);}async['createAgent'](_0x1fd763){const _0xe93c27=a133_0x14e51b;return await this['client'][_0xe93c27(0x114)](_0x1fd763);}async['updateAgent'](_0x3a527d,_0x115996){const _0x30c16e=a133_0x14e51b;return await this[_0x30c16e(0xf9)][_0x30c16e(0x177)](_0x3a527d,_0x115996);}async['deleteAgent'](_0x408df7){const _0x389c87=a133_0x14e51b;await this[_0x389c87(0xf9)][_0x389c87(0xfc)](_0x408df7);}async['startChat'](_0x1fa42b){const _0x331e2c=a133_0x14e51b;return await this[_0x331e2c(0xf9)][_0x331e2c(0xff)]({'agentId':_0x1fa42b});}async*['chat'](_0x2991ac,_0x2b18be){const _0x23633e=a133_0x14e51b;let _0x3d7f91=_0x2b18be?.[_0x23633e(0x1b1)];const _0x1d27f0=_0x2b18be?.['agentId'];if(!_0x3d7f91){if(!_0x1d27f0)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x36aeb1=await this['client']['startChat']({'agentId':_0x1d27f0});_0x3d7f91=_0x36aeb1['id'],yield{'type':_0x23633e(0x1bb),'data':{'chatId':_0x3d7f91,'agentId':_0x1d27f0,'projectId':_0x36aeb1['attributes'][_0x23633e(0x18d)]}};}for await(const _0x3ee213 of this[_0x23633e(0xf9)][_0x23633e(0x17f)](_0x3d7f91,_0x2991ac,_0x2b18be?.[_0x23633e(0x16b)])){yield{'type':_0x23633e(0xfe),'data':_0x3ee213};}}async[a133_0x14e51b(0x18e)](_0x7f5ffe=0x32){const _0x129212=a133_0x14e51b;return await this[_0x129212(0xf9)][_0x129212(0x102)](_0x7f5ffe);}async[a133_0x14e51b(0x178)](_0x4dcbc1){const _0x28a9d7=a133_0x14e51b;return await this[_0x28a9d7(0xf9)][_0x28a9d7(0x1ac)](_0x4dcbc1);}async['getChatLog'](_0x264d5e){const _0x374bcd=a133_0x14e51b;return await this[_0x374bcd(0xf9)][_0x374bcd(0x139)](_0x264d5e);}async[a133_0x14e51b(0x192)](_0x1d2144){const _0x5d2808=a133_0x14e51b;return await this[_0x5d2808(0xf9)][_0x5d2808(0x1a8)](_0x1d2144);}async[a133_0x14e51b(0x1a2)](_0x43be61,_0x4a311f,_0x3d74ce){const _0x80c6e5=a133_0x14e51b,_0x96528c=_0x3d74ce?.[_0x80c6e5(0x1a5)]??![],{projectId:_0x521f58,project:_0x2ad87b}=await this['resolveProjectName'](_0x43be61),_0x3e4c5e=_0x2ad87b['attributes'][_0x80c6e5(0x190)],_0x38b7b9=_0x4a311f||_0x3e4c5e+_0x80c6e5(0x120);if(a133_0x496aed[_0x80c6e5(0xe3)](_0x38b7b9)&&!_0x96528c)throw new SDKError(ErrorCode[_0x80c6e5(0x175)],_0x80c6e5(0x10e)+_0x38b7b9,undefined,{'helpText':'Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.'});const _0xd3b853=await this[_0x80c6e5(0xf9)][_0x80c6e5(0x1ab)](_0x521f58),_0x2208c8=await this[_0x80c6e5(0xf9)][_0x80c6e5(0x103)](_0x521f58),_0x545636=await this[_0x80c6e5(0xf9)][_0x80c6e5(0x158)](_0x521f58),_0x51c5ed=await this[_0x80c6e5(0xf9)]['listIntegrations'](_0x521f58);if(!_0x96528c){a133_0x496aed[_0x80c6e5(0xa2)](_0x38b7b9,{'recursive':!![]});const _0x2ce94a={'version':_0x80c6e5(0xc6),'exportedAt':new Date()[_0x80c6e5(0x149)](),'exportedFrom':{'site':this['context']['site'],'projectId':_0x521f58,'projectName':_0x3e4c5e},'project':_0x2ad87b};a133_0x496aed[_0x80c6e5(0xdc)](a133_0x59991e[_0x80c6e5(0xa1)](_0x38b7b9,_0x80c6e5(0x18b)),JSON[_0x80c6e5(0x1bc)](_0x2ce94a,null,0x2)),a133_0x496aed['writeFileSync'](a133_0x59991e['join'](_0x38b7b9,_0x80c6e5(0x130)),JSON[_0x80c6e5(0x1bc)](_0xd3b853,null,0x2)),a133_0x496aed[_0x80c6e5(0xdc)](a133_0x59991e[_0x80c6e5(0xa1)](_0x38b7b9,_0x80c6e5(0xc2)),JSON[_0x80c6e5(0x1bc)](_0x2208c8,null,0x2)),a133_0x496aed[_0x80c6e5(0xdc)](a133_0x59991e['join'](_0x38b7b9,'prompts.json'),JSON['stringify'](_0x545636,null,0x2)),a133_0x496aed[_0x80c6e5(0xdc)](a133_0x59991e[_0x80c6e5(0xa1)](_0x38b7b9,_0x80c6e5(0x16c)),JSON[_0x80c6e5(0x1bc)](_0x51c5ed,null,0x2));}return{'projectName':_0x3e4c5e,'outputDir':_0x38b7b9,'counts':{'agents':_0xd3b853[_0x80c6e5(0x15b)],'knowledgeBases':_0x2208c8[_0x80c6e5(0x15b)],'prompts':_0x545636[_0x80c6e5(0x15b)],'integrations':_0x51c5ed[_0x80c6e5(0x15b)]}};}async['restoreProject'](_0x26e569,_0x4bcd7){const _0x503671=a133_0x14e51b,_0x3f0623=_0x4bcd7?.[_0x503671(0x1a5)]??![],_0x3bb2df=this[_0x503671(0x1b3)](_0x26e569),_0x50015d=_0x3bb2df[_0x503671(0x112)][_0x503671(0x179)],_0x588a85=this[_0x503671(0xd5)][_0x503671(0x179)],_0x13debe=_0x50015d!==_0x588a85?_0x50015d:undefined,_0x23b65e=this['loadJsonFile'](a133_0x59991e[_0x503671(0xa1)](_0x26e569,_0x503671(0x130)),[]),_0x4904d6=this[_0x503671(0x10d)](a133_0x59991e[_0x503671(0xa1)](_0x26e569,'knowledgebases.json'),[]),_0x31de61=this['loadJsonFile'](a133_0x59991e[_0x503671(0xa1)](_0x26e569,_0x503671(0xe2)),[]),_0x2ec03b=this[_0x503671(0x10d)](a133_0x59991e[_0x503671(0xa1)](_0x26e569,_0x503671(0x16c)),[]),_0x4babf3=_0x4bcd7?.[_0x503671(0x190)]||_0x3bb2df[_0x503671(0x112)]['projectName'];if(_0x3f0623){const _0x5b3dde=new Map(),_0x4563b0=[..._0x23b65e],_0x471f69=_0x23b65e[_0x503671(0x15b)]+0x1;let _0x53d42f=0x0;while(_0x4563b0[_0x503671(0x15b)]>0x0&&_0x53d42f<_0x471f69){_0x53d42f++;const _0x2a101d=[];for(const _0x42d369 of _0x4563b0){canCreateAgent(_0x42d369,_0x5b3dde)?_0x5b3dde[_0x503671(0x117)](_0x42d369['id'],_0x503671(0x199)+_0x42d369['id']):_0x2a101d['push'](_0x42d369);}if(_0x2a101d[_0x503671(0x15b)]===_0x4563b0[_0x503671(0x15b)])throw new SDKError(ErrorCode[_0x503671(0xb3)],_0x503671(0x1b6),undefined,{'helpText':_0x503671(0x19f)});_0x4563b0[_0x503671(0x15b)]=0x0,_0x4563b0[_0x503671(0xe6)](..._0x2a101d);}const _0x3c56f0=_0x31de61[_0x503671(0x12d)](_0x28927c=>_0x5b3dde[_0x503671(0x133)](_0x28927c['attributes'][_0x503671(0x1c2)]))[_0x503671(0x15b)];return{'projectName':_0x4babf3,'projectId':'(dry-run)','counts':{'agents':_0x23b65e[_0x503671(0x15b)],'knowledgeBases':_0x4904d6[_0x503671(0x15b)],'prompts':_0x3c56f0,'integrations':_0x2ec03b[_0x503671(0x15b)]},'sourceSite':_0x13debe};}const _0x59e81d=await this[_0x503671(0xf9)][_0x503671(0x14a)]({'name':_0x4babf3,'description':_0x3bb2df[_0x503671(0x182)][_0x503671(0x159)][_0x503671(0xe0)]}),_0x2daeff=_0x59e81d['id'],_0x40686e=new Map(),_0x5bea98=new Map(),_0x5605e0=new Map();for(const _0x23cb68 of _0x4904d6){const _0x4ddef2=await this['client'][_0x503671(0x19c)]({'projectId':_0x2daeff,'name':_0x23cb68[_0x503671(0x159)][_0x503671(0x190)],'tdDatabaseName':_0x23cb68['attributes'][_0x503671(0x12c)],'tables':_0x23cb68[_0x503671(0x159)][_0x503671(0x189)]});_0x40686e[_0x503671(0x117)](_0x23cb68['id'],_0x4ddef2['id']);}const _0x401b41=[..._0x23b65e],_0x229f8f=_0x23b65e[_0x503671(0x15b)]+0x1;let _0x51a7b4=0x0;while(_0x401b41[_0x503671(0x15b)]>0x0&&_0x51a7b4<_0x229f8f){_0x51a7b4++;const _0x5b553c=[];for(const _0x2d001d of _0x401b41){if(canCreateAgent(_0x2d001d,_0x5bea98)){const _0x512794=remapToolIds(_0x2d001d[_0x503671(0x159)][_0x503671(0x140)],_0x40686e,_0x5bea98),_0x5b68d0=remapVariableIds(_0x2d001d[_0x503671(0x159)]['variables'],_0x40686e),_0x76ac7e=await this[_0x503671(0xf9)][_0x503671(0x171)]({'name':_0x2d001d[_0x503671(0x159)]['name'],'projectId':_0x2daeff,'systemPrompt':_0x2d001d[_0x503671(0x159)][_0x503671(0x11b)],'starterMessage':_0x2d001d['attributes'][_0x503671(0xdd)],'modelType':migrateModelType(_0x2d001d[_0x503671(0x159)][_0x503671(0xdf)]),'maxToolIterations':_0x2d001d[_0x503671(0x159)]['maxToolIterations'],'temperature':_0x2d001d[_0x503671(0x159)][_0x503671(0xba)],'reasoningEffort':_0x2d001d[_0x503671(0x159)]['reasoningEffort'],'outputs':_0x2d001d[_0x503671(0x159)]['outputs'],'tools':_0x512794,'variables':_0x5b68d0});_0x5bea98[_0x503671(0x117)](_0x2d001d['id'],_0x76ac7e['id']);}else _0x5b553c[_0x503671(0xe6)](_0x2d001d);}if(_0x5b553c[_0x503671(0x15b)]===_0x401b41[_0x503671(0x15b)])throw new SDKError(ErrorCode[_0x503671(0xb3)],_0x503671(0x1b6),undefined,{'helpText':_0x503671(0x19f)});_0x401b41[_0x503671(0x15b)]=0x0,_0x401b41[_0x503671(0xe6)](..._0x5b553c);}for(const _0x19457f of _0x31de61){const _0x658e5a=_0x5bea98[_0x503671(0x155)](_0x19457f[_0x503671(0x159)][_0x503671(0x1c2)]);if(!_0x658e5a)continue;const _0x593ddb=await this[_0x503671(0xf9)][_0x503671(0xb1)]({'projectId':_0x2daeff,'agentId':_0x658e5a,'name':_0x19457f[_0x503671(0x159)][_0x503671(0x190)],'systemPrompt':_0x19457f[_0x503671(0x159)]['systemPrompt'],'template':_0x19457f[_0x503671(0x159)][_0x503671(0x183)],'jsonSchemaHint':_0x19457f[_0x503671(0x159)][_0x503671(0x128)]});_0x5605e0[_0x503671(0x117)](_0x19457f['id'],_0x593ddb['id']);}for(const _0x2bed33 of _0x2ec03b){const _0x1f0525=_0x2bed33[_0x503671(0x159)]['actions']['map'](_0x49eea2=>({..._0x49eea2,'promptId':_0x5605e0[_0x503671(0x155)](_0x49eea2[_0x503671(0x151)])||_0x49eea2['promptId']}));await this[_0x503671(0xf9)]['createIntegration']({'projectId':_0x2daeff,'serviceType':_0x2bed33[_0x503671(0x159)][_0x503671(0x161)],'actions':_0x1f0525,'slackMessageMode':_0x2bed33[_0x503671(0x159)][_0x503671(0x19a)],'chatIgnoreManagedActions':_0x2bed33[_0x503671(0x159)]['chatIgnoreManagedActions'],'chatWelcomeMessage':_0x2bed33['attributes'][_0x503671(0x147)],'webhookCorsOrigins':_0x2bed33[_0x503671(0x159)]['webhookCorsOrigins']});}return{'projectName':_0x4babf3,'projectId':_0x2daeff,'counts':{'agents':_0x5bea98[_0x503671(0x167)],'knowledgeBases':_0x40686e[_0x503671(0x167)],'prompts':_0x5605e0['size'],'integrations':_0x2ec03b['length']},'sourceSite':_0x13debe};}['loadJsonFile'](_0x2aabed,_0x5b5899){const _0x35396c=a133_0x14e51b;if(!a133_0x496aed[_0x35396c(0xe3)](_0x2aabed))return _0x5b5899;return JSON[_0x35396c(0xe9)](a133_0x496aed[_0x35396c(0x131)](_0x2aabed,_0x35396c(0xf1)));}[a133_0x14e51b(0x1b3)](_0x4a9a95){const _0x49df7e=a133_0x14e51b;if(!a133_0x496aed['existsSync'](_0x4a9a95))throw new SDKError(ErrorCode[_0x49df7e(0xbb)],_0x49df7e(0xbd)+_0x4a9a95,undefined,{'helpText':_0x49df7e(0x119)});const _0x5045bc=a133_0x59991e[_0x49df7e(0xa1)](_0x4a9a95,_0x49df7e(0x18b));if(!a133_0x496aed[_0x49df7e(0xe3)](_0x5045bc))throw new SDKError(ErrorCode[_0x49df7e(0xef)],_0x49df7e(0x1a6)+_0x4a9a95,undefined,{'helpText':_0x49df7e(0x1aa)});const _0x1dda38=JSON['parse'](a133_0x496aed[_0x49df7e(0x131)](_0x5045bc,_0x49df7e(0xf1)));if(!isSupportedBackupVersion(_0x1dda38[_0x49df7e(0xe7)]))throw new SDKError(ErrorCode[_0x49df7e(0xef)],_0x49df7e(0xc0)+_0x1dda38[_0x49df7e(0xe7)],undefined,{'helpText':_0x49df7e(0x1b8)});return _0x1dda38;}async['pullProject'](_0x4ce17a,_0x510fcb,_0x4e0681){const _0x59bbcd=a133_0x14e51b,{projectId:_0x2af10f,project:_0x405528}=await this[_0x59bbcd(0x134)](_0x4ce17a),_0x40fcfa=_0x405528[_0x59bbcd(0x159)][_0x59bbcd(0x190)];let _0x65384a;if(_0x510fcb)_0x65384a=_0x510fcb;else{const _0x303c73=a133_0x59991e[_0x59bbcd(0xa1)](process[_0x59bbcd(0x1ad)](),_0x59bbcd(0x18f)),_0xeac6c9=getSanitizedPathWithMigration(_0x303c73,_0x40fcfa);_0xeac6c9[_0x59bbcd(0x108)]&&this[_0x59bbcd(0xeb)][_0x59bbcd(0x187)](_0x59bbcd(0x15d)+a133_0x59991e['basename'](_0xeac6c9[_0x59bbcd(0x124)])+_0x59bbcd(0xb8)+a133_0x59991e[_0x59bbcd(0xc3)](_0xeac6c9[_0x59bbcd(0xaf)])),_0x65384a=_0xeac6c9['path'];}const _0x6cbf26=await this[_0x59bbcd(0xf9)][_0x59bbcd(0x1ab)](_0x2af10f),_0x53fb5f=await this[_0x59bbcd(0xf9)][_0x59bbcd(0x103)](_0x2af10f),_0x3aab43=await this[_0x59bbcd(0xf9)][_0x59bbcd(0xb5)](_0x2af10f),_0x391a5d=await safeListOrEmpty(()=>this['client'][_0x59bbcd(0x18c)](_0x2af10f)),_0x1357aa=await safeListOrEmpty(()=>this['client'][_0x59bbcd(0x198)](_0x2af10f)),_0x4effd4=await this[_0x59bbcd(0xf9)][_0x59bbcd(0x158)](_0x2af10f),_0x16808d=await this[_0x59bbcd(0xf9)]['listIntegrations'](_0x2af10f),_0x50464e=await safeListOrEmpty(()=>this['client'][_0x59bbcd(0x15e)](_0x2af10f)),_0x1e25e5=await safeListOrEmpty(()=>this[_0x59bbcd(0xf9)][_0x59bbcd(0xf2)](_0x2af10f)),_0x1f7086=await safeListOrEmpty(()=>this[_0x59bbcd(0xf9)][_0x59bbcd(0xd4)](_0x2af10f)),_0x336246=await safeListOrEmpty(()=>this[_0x59bbcd(0xf9)]['listChatInterfaces'](_0x2af10f)),_0x4543a9=_0x16808d['filter'](_0x4ca075=>!_0x4ca075['attributes'][_0x59bbcd(0xa6)]&&SAFE_INTEGRATION_TYPES[_0x59bbcd(0x1a1)](_0x4ca075[_0x59bbcd(0x159)][_0x59bbcd(0x161)][_0x59bbcd(0xbc)]())),_0x21f62d=new Map(),_0x58936d=new Map(),_0x33363e=new Map(),_0x59f2ea=new Map(),_0x52e185=new Map(),_0x14cddd=new Map(),_0x1cbd58=new Map();for(const _0x35d307 of _0x6cbf26){_0x21f62d[_0x59bbcd(0x117)](_0x35d307['id'],_0x35d307[_0x59bbcd(0x159)][_0x59bbcd(0x190)]);}for(const _0x5d929b of _0x53fb5f){_0x58936d[_0x59bbcd(0x117)](_0x5d929b['id'],_0x5d929b[_0x59bbcd(0x159)]['name']);}for(const _0x3118fe of _0x3aab43){_0x33363e[_0x59bbcd(0x117)](_0x3118fe['id'],_0x3118fe[_0x59bbcd(0x159)][_0x59bbcd(0x190)]);}for(const _0x471ff1 of _0x391a5d){_0x59f2ea[_0x59bbcd(0x117)](_0x471ff1['id'],_0x471ff1['attributes'][_0x59bbcd(0x190)]);}for(const _0x139604 of _0x1357aa){_0x52e185[_0x59bbcd(0x117)](_0x139604['id'],_0x139604[_0x59bbcd(0x159)][_0x59bbcd(0x190)]);}for(const _0x5e1460 of _0x4effd4){_0x14cddd[_0x59bbcd(0x117)](_0x5e1460['id'],_0x5e1460['attributes'][_0x59bbcd(0x190)]);}for(const _0x360ac3 of _0x50464e){_0x1cbd58[_0x59bbcd(0x117)](_0x360ac3['id'],_0x360ac3[_0x59bbcd(0x159)][_0x59bbcd(0x190)]);}const _0x4e928d={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x58936d,'TextKnowledgeBase':_0x33363e,'Agent':_0x21f62d,'WebSearchTool':_0x52e185,'ImageGenerator':_0x59f2ea,'ExperimentalKnowledgeBase':_0x1cbd58}),'resolvePromptName':async _0x81144f=>_0x14cddd[_0x59bbcd(0x155)](_0x81144f),'onWarning':_0x1ed669=>this[_0x59bbcd(0xeb)][_0x59bbcd(0x1b0)](_0x1ed669)},_0x544e7e={'projectName':_0x40fcfa,'outputDir':_0x65384a,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'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},'formInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'chatInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0x3bb155=[],_0xf91270=[];for(const _0x5677e8 of _0x6cbf26){const _0x3397cb=getSanitizedPathWithMigration(_0x65384a,_0x5677e8['attributes'][_0x59bbcd(0x190)]);_0x3397cb[_0x59bbcd(0x108)]&&this[_0x59bbcd(0xeb)][_0x59bbcd(0x187)]('Renamed\x20agent\x20folder:\x20'+a133_0x59991e[_0x59bbcd(0xc3)](_0x3397cb['oldPath'])+_0x59bbcd(0xb8)+a133_0x59991e['basename'](_0x3397cb[_0x59bbcd(0xaf)]));const _0x36e926=_0x3397cb[_0x59bbcd(0xaf)],_0x20af34=a133_0x59991e[_0x59bbcd(0xa1)](_0x36e926,_0x59bbcd(0x118)),_0x2307e7=a133_0x59991e[_0x59bbcd(0xa1)](_0x36e926,_0x59bbcd(0x180)),_0x176601=a133_0x59991e['join'](_0x36e926,_0x59bbcd(0xab)),{yaml:_0x3de752,systemPrompt:_0x5e84dd,starterMessage:_0x132e0e}=await agentResponseToDef(_0x5677e8,_0x4e928d),_0x59c1e8=toAgentYamlString(_0x3de752),_0x572c8e=!a133_0x496aed['existsSync'](_0x2307e7);let _0x3c3b1e=_0x572c8e,_0x371fed;if(!_0x572c8e){const _0x53387e=a133_0x496aed[_0x59bbcd(0xe3)](_0x20af34)?a133_0x496aed['readFileSync'](_0x20af34,_0x59bbcd(0xf1)):'',_0x2c49ef=a133_0x496aed[_0x59bbcd(0x131)](_0x2307e7,_0x59bbcd(0xf1)),_0x47c902=_0x59bbcd(0x115)+_0x53387e+'\x0a\x0a#\x20agent.yml\x0a'+_0x2c49ef,_0x37b0d3=_0x59bbcd(0x115)+_0x5e84dd+_0x59bbcd(0x165)+_0x59c1e8,_0x2696c0=generateDiff(_0x47c902,_0x37b0d3);_0x3c3b1e=hasChanges(_0x2696c0),_0x3c3b1e&&(_0x371fed=formatDiffWithColors(_0x2696c0));}_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x36e926,'content':'','isDir':!![]}),_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x20af34,'content':_0x5e84dd}),_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x2307e7,'content':_0x59c1e8});_0x132e0e&&_0x132e0e[_0x59bbcd(0x1a1)]('\x0a')&&_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x176601,'content':_0x132e0e});_0x544e7e[_0x59bbcd(0x18f)]['push']({'agentName':_0x5677e8['attributes'][_0x59bbcd(0x190)],'outputPath':_0x36e926,'isNew':_0x572c8e,'hasChanges':_0x3c3b1e,'diff':_0x371fed}),_0x544e7e['counts'][_0x59bbcd(0x18f)]['total']++;if(_0x572c8e)_0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x18f)][_0x59bbcd(0x1c9)]++;else{if(_0x3c3b1e)_0x544e7e['counts'][_0x59bbcd(0x18f)]['updated']++;else _0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x18f)]['unchanged']++;}}for(const _0x2e9824 of _0x53fb5f){if(_0x2e9824[_0x59bbcd(0x159)][_0x59bbcd(0xa6)])continue;const _0x2a91ce=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x65384a),_0x2e9824[_0x59bbcd(0x159)][_0x59bbcd(0x190)],_0x59bbcd(0x14b));_0x2a91ce[_0x59bbcd(0x108)]&&this[_0x59bbcd(0xeb)][_0x59bbcd(0x187)](_0x59bbcd(0x197)+a133_0x59991e[_0x59bbcd(0xc3)](_0x2a91ce[_0x59bbcd(0x124)])+_0x59bbcd(0xb8)+a133_0x59991e[_0x59bbcd(0xc3)](_0x2a91ce['path']));const _0x19f44c=_0x2a91ce[_0x59bbcd(0xaf)],_0x200508=apiKnowledgeBaseToYaml(_0x2e9824),_0x30a05c=toKnowledgeBaseYamlString(_0x200508),_0x29017b=!a133_0x496aed[_0x59bbcd(0xe3)](_0x19f44c);let _0x4d06af=_0x29017b,_0x5205e1;if(!_0x29017b){const _0x326abb=a133_0x496aed['readFileSync'](_0x19f44c,_0x59bbcd(0xf1)),_0x2ed2c8=generateDiff(_0x326abb,_0x30a05c);_0x4d06af=hasChanges(_0x2ed2c8),_0x4d06af&&(_0x5205e1=formatDiffWithColors(_0x2ed2c8));}_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x19f44c,'content':_0x30a05c}),_0x544e7e[_0x59bbcd(0x1ba)][_0x59bbcd(0xe6)]({'name':_0x2e9824[_0x59bbcd(0x159)][_0x59bbcd(0x190)],'outputPath':_0x19f44c,'isNew':_0x29017b,'hasChanges':_0x4d06af,'diff':_0x5205e1}),_0x544e7e[_0x59bbcd(0x191)]['knowledgeBases']['total']++;if(_0x29017b)_0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x1ba)][_0x59bbcd(0x1c9)]++;else{if(_0x4d06af)_0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x1ba)][_0x59bbcd(0x168)]++;else _0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x1ba)][_0x59bbcd(0xb9)]++;}}for(const _0x2b5652 of _0x3aab43){if(_0x2b5652[_0x59bbcd(0x159)][_0x59bbcd(0xa6)])continue;const _0x3ada31=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x65384a),_0x2b5652['attributes']['name'],'.md');_0x3ada31[_0x59bbcd(0x108)]&&this[_0x59bbcd(0xeb)][_0x59bbcd(0x187)](_0x59bbcd(0x148)+a133_0x59991e[_0x59bbcd(0xc3)](_0x3ada31['oldPath'])+'\x20→\x20'+a133_0x59991e[_0x59bbcd(0xc3)](_0x3ada31[_0x59bbcd(0xaf)]));const _0x34129a=_0x3ada31[_0x59bbcd(0xaf)],_0x141558=toTextKnowledgeBaseMd(_0x2b5652[_0x59bbcd(0x159)][_0x59bbcd(0x190)],_0x2b5652[_0x59bbcd(0x159)][_0x59bbcd(0xce)]),_0x4650cf=!a133_0x496aed[_0x59bbcd(0xe3)](_0x34129a);let _0x96322a=_0x4650cf,_0x13eed8;if(!_0x4650cf){const _0x2eb190=a133_0x496aed[_0x59bbcd(0x131)](_0x34129a,'utf-8'),_0x329c67=generateDiff(_0x2eb190,_0x141558);_0x96322a=hasChanges(_0x329c67),_0x96322a&&(_0x13eed8=formatDiffWithColors(_0x329c67));}_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x34129a,'content':_0x141558}),_0x544e7e[_0x59bbcd(0x19e)][_0x59bbcd(0xe6)]({'name':_0x2b5652[_0x59bbcd(0x159)][_0x59bbcd(0x190)],'outputPath':_0x34129a,'isNew':_0x4650cf,'hasChanges':_0x96322a,'diff':_0x13eed8}),_0x544e7e[_0x59bbcd(0x191)]['textKnowledgeBases'][_0x59bbcd(0xd6)]++;if(_0x4650cf)_0x544e7e[_0x59bbcd(0x191)]['textKnowledgeBases']['new']++;else{if(_0x96322a)_0x544e7e[_0x59bbcd(0x191)]['textKnowledgeBases'][_0x59bbcd(0x168)]++;else _0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x19e)]['unchanged']++;}}for(const _0x9c78c3 of _0x4effd4){if(_0x9c78c3['attributes'][_0x59bbcd(0xa6)])continue;const _0x4aaecb=getSanitizedPathWithMigration(getPromptsDir(_0x65384a),_0x9c78c3[_0x59bbcd(0x159)][_0x59bbcd(0x190)],_0x59bbcd(0x14b));_0x4aaecb[_0x59bbcd(0x108)]&&this['logger'][_0x59bbcd(0x187)](_0x59bbcd(0x17c)+a133_0x59991e[_0x59bbcd(0xc3)](_0x4aaecb[_0x59bbcd(0x124)])+'\x20→\x20'+a133_0x59991e['basename'](_0x4aaecb[_0x59bbcd(0xaf)]));const _0x3c3afd=_0x4aaecb[_0x59bbcd(0xaf)],_0x33db69=await apiPromptToYaml(_0x9c78c3,_0x4e928d);if(!_0x33db69)continue;const _0x1b73e8=toPromptYamlString(_0x33db69),_0x2fc567=!a133_0x496aed['existsSync'](_0x3c3afd);let _0x28153b=_0x2fc567,_0x5a4f09;if(!_0x2fc567){const _0x1bce53=a133_0x496aed[_0x59bbcd(0x131)](_0x3c3afd,'utf-8'),_0x288f79=generateDiff(_0x1bce53,_0x1b73e8);_0x28153b=hasChanges(_0x288f79),_0x28153b&&(_0x5a4f09=formatDiffWithColors(_0x288f79));}_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x3c3afd,'content':_0x1b73e8}),_0x544e7e['prompts']['push']({'name':_0x9c78c3[_0x59bbcd(0x159)]['name'],'outputPath':_0x3c3afd,'isNew':_0x2fc567,'hasChanges':_0x28153b,'diff':_0x5a4f09}),_0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x13d)][_0x59bbcd(0xd6)]++;if(_0x2fc567)_0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x13d)]['new']++;else{if(_0x28153b)_0x544e7e['counts'][_0x59bbcd(0x13d)][_0x59bbcd(0x168)]++;else _0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x13d)][_0x59bbcd(0xb9)]++;}}for(const _0x4d1e3d of _0x4543a9){const _0x3eea1d=_0x4d1e3d[_0x59bbcd(0x159)][_0x59bbcd(0x161)][_0x59bbcd(0xbc)](),_0x991008=getSanitizedPathWithMigration(getIntegrationsDir(_0x65384a),_0x3eea1d,_0x59bbcd(0x14b));_0x991008[_0x59bbcd(0x108)]&&this[_0x59bbcd(0xeb)][_0x59bbcd(0x187)](_0x59bbcd(0xa5)+a133_0x59991e['basename'](_0x991008[_0x59bbcd(0x124)])+_0x59bbcd(0xb8)+a133_0x59991e[_0x59bbcd(0xc3)](_0x991008[_0x59bbcd(0xaf)]));const _0x32f3e6=_0x991008[_0x59bbcd(0xaf)],_0x139677=await apiIntegrationToYaml(_0x4d1e3d,_0x4e928d),_0x3223e9=toIntegrationYamlString(_0x139677),_0x2d8366=!a133_0x496aed['existsSync'](_0x32f3e6);let _0x591cb3=_0x2d8366,_0x17b2db;if(!_0x2d8366){const _0x35ea81=a133_0x496aed[_0x59bbcd(0x131)](_0x32f3e6,'utf-8'),_0x4780a8=generateDiff(_0x35ea81,_0x3223e9);_0x591cb3=hasChanges(_0x4780a8),_0x591cb3&&(_0x17b2db=formatDiffWithColors(_0x4780a8));}_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x32f3e6,'content':_0x3223e9}),_0x544e7e['integrations'][_0x59bbcd(0xe6)]({'name':_0x3eea1d,'outputPath':_0x32f3e6,'isNew':_0x2d8366,'hasChanges':_0x591cb3,'diff':_0x17b2db}),_0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0xe1)][_0x59bbcd(0xd6)]++;if(_0x2d8366)_0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0xe1)]['new']++;else{if(_0x591cb3)_0x544e7e[_0x59bbcd(0x191)]['integrations'][_0x59bbcd(0x168)]++;else _0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0xe1)][_0x59bbcd(0xb9)]++;}}for(const _0x33d7dd of _0x50464e){if(_0x33d7dd[_0x59bbcd(0x159)][_0x59bbcd(0xa6)])continue;const _0x7c801=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x65384a),_0x33d7dd[_0x59bbcd(0x159)][_0x59bbcd(0x190)]);_0x7c801[_0x59bbcd(0x108)]&&this[_0x59bbcd(0xeb)][_0x59bbcd(0x187)]('Renamed\x20experimental\x20KB\x20directory:\x20'+a133_0x59991e[_0x59bbcd(0xc3)](_0x7c801[_0x59bbcd(0x124)])+_0x59bbcd(0xb8)+a133_0x59991e[_0x59bbcd(0xc3)](_0x7c801['path']));const _0x2206cb=_0x7c801['path'],_0x3980d0=a133_0x59991e[_0x59bbcd(0xa1)](_0x2206cb,sanitizeForFilesystem(_0x33d7dd['attributes']['name'])+_0x59bbcd(0x14b)),_0x3e3430=a133_0x59991e['join'](_0x2206cb,'functions'),_0x4b0a49=apiExperimentalKnowledgeBaseToYaml(_0x33d7dd),_0x17ea94=toExperimentalKnowledgeBaseYamlString(_0x4b0a49),_0x5a2e7c=!a133_0x496aed[_0x59bbcd(0xe3)](_0x2206cb);let _0x42b49d=_0x5a2e7c,_0x5b1f81,_0x16e539=_0x17ea94;const _0x21b147=[..._0x4b0a49[_0x59bbcd(0xed)]][_0x59bbcd(0x12a)]((_0x1b5b4a,_0x3e4f17)=>_0x1b5b4a[_0x59bbcd(0x190)]['localeCompare'](_0x3e4f17[_0x59bbcd(0x190)]));for(const _0x9c7db0 of _0x21b147){_0x16e539+=_0x59bbcd(0x129)+_0x9c7db0[_0x59bbcd(0x190)]+_0x59bbcd(0xd0)+_0x9c7db0[_0x59bbcd(0x19d)]+_0x59bbcd(0x14f)+_0x9c7db0[_0x59bbcd(0x190)]+_0x59bbcd(0xd0)+_0x9c7db0[_0x59bbcd(0x16a)]+'\x0a';}if(!_0x5a2e7c){let _0x2feb84='';a133_0x496aed[_0x59bbcd(0xe3)](_0x3980d0)&&(_0x2feb84=a133_0x496aed[_0x59bbcd(0x131)](_0x3980d0,_0x59bbcd(0xf1)));if(a133_0x496aed['existsSync'](_0x3e3430)){const _0x4833d2=a133_0x496aed[_0x59bbcd(0x1b2)](_0x3e3430,{'withFileTypes':!![]}),_0x3f8c4b=_0x4833d2[_0x59bbcd(0x12d)](_0x2be03e=>_0x2be03e[_0x59bbcd(0x18a)]())[_0x59bbcd(0x12a)]((_0x55f8b9,_0x561866)=>_0x55f8b9[_0x59bbcd(0x190)][_0x59bbcd(0xd9)](_0x561866[_0x59bbcd(0x190)]));for(const _0x49057b of _0x3f8c4b){const _0x332286=a133_0x59991e[_0x59bbcd(0xa1)](_0x3e3430,_0x49057b['name'],_0x59bbcd(0x150)),_0x20d53b=a133_0x59991e[_0x59bbcd(0xa1)](_0x3e3430,_0x49057b[_0x59bbcd(0x190)],_0x59bbcd(0xb4));a133_0x496aed[_0x59bbcd(0xe3)](_0x332286)&&(_0x2feb84+=_0x59bbcd(0x129)+_0x49057b['name']+'\x20---\x0a'+a133_0x496aed['readFileSync'](_0x332286,_0x59bbcd(0xf1))+'\x0a'),a133_0x496aed['existsSync'](_0x20d53b)&&(_0x2feb84+=_0x59bbcd(0x186)+_0x49057b[_0x59bbcd(0x190)]+_0x59bbcd(0xd0)+a133_0x496aed[_0x59bbcd(0x131)](_0x20d53b,_0x59bbcd(0xf1))+'\x0a');}}const _0xebd910=generateDiff(_0x2feb84,_0x16e539);_0x42b49d=hasChanges(_0xebd910),_0x42b49d&&(_0x5b1f81=formatDiffWithColors(_0xebd910));}_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x2206cb,'content':'','isDir':!![]}),_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x3980d0,'content':_0x17ea94}),_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x3e3430,'content':'','isDir':!![]});for(const _0x394141 of _0x4b0a49[_0x59bbcd(0xed)]){const _0x5bad83=a133_0x59991e[_0x59bbcd(0xa1)](_0x3e3430,sanitizeForFilesystem(_0x394141[_0x59bbcd(0x190)])),_0x25ce19=a133_0x59991e['join'](_0x5bad83,_0x59bbcd(0x150)),_0x5ca62d=a133_0x59991e[_0x59bbcd(0xa1)](_0x5bad83,_0x59bbcd(0xb4));_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x5bad83,'content':'','isDir':!![]}),_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x25ce19,'content':_0x394141[_0x59bbcd(0x19d)]}),_0x3bb155['push']({'path':_0x5ca62d,'content':_0x394141[_0x59bbcd(0x16a)]});}if(a133_0x496aed[_0x59bbcd(0xe3)](_0x3e3430)){const _0x39f6ee=a133_0x496aed[_0x59bbcd(0x1b2)](_0x3e3430,{'withFileTypes':!![]}),_0x4ca93a=new Set(_0x4b0a49[_0x59bbcd(0xed)][_0x59bbcd(0xd7)](_0x21e0a5=>sanitizeForFilesystem(_0x21e0a5['name'])));for(const _0x43e433 of _0x39f6ee){if(_0x43e433[_0x59bbcd(0x18a)]()&&!_0x4ca93a['has'](_0x43e433[_0x59bbcd(0x190)])){const _0x3ca892=a133_0x59991e[_0x59bbcd(0xa1)](_0x3e3430,_0x43e433['name']);_0xf91270[_0x59bbcd(0xe6)]({'path':_0x3ca892,'isDir':!![]});}}}_0x544e7e['experimentalKnowledgeBases'][_0x59bbcd(0xe6)]({'name':_0x33d7dd[_0x59bbcd(0x159)][_0x59bbcd(0x190)],'outputPath':_0x2206cb,'isNew':_0x5a2e7c,'hasChanges':_0x42b49d,'diff':_0x5b1f81}),_0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x111)][_0x59bbcd(0xd6)]++;if(_0x5a2e7c)_0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x111)][_0x59bbcd(0x1c9)]++;else{if(_0x42b49d)_0x544e7e[_0x59bbcd(0x191)]['experimentalKnowledgeBases'][_0x59bbcd(0x168)]++;else _0x544e7e[_0x59bbcd(0x191)]['experimentalKnowledgeBases']['unchanged']++;}}for(const _0x4b7431 of _0x1e25e5){if(_0x4b7431[_0x59bbcd(0x159)][_0x59bbcd(0xa6)])continue;const _0x47cddb=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x65384a),_0x4b7431['attributes'][_0x59bbcd(0x190)]);_0x47cddb[_0x59bbcd(0x108)]&&this[_0x59bbcd(0xeb)][_0x59bbcd(0x187)](_0x59bbcd(0x113)+a133_0x59991e[_0x59bbcd(0xc3)](_0x47cddb[_0x59bbcd(0x124)])+_0x59bbcd(0xb8)+a133_0x59991e[_0x59bbcd(0xc3)](_0x47cddb[_0x59bbcd(0xaf)]));const _0x432d7e=_0x47cddb['path'],_0x258f91=a133_0x59991e[_0x59bbcd(0xa1)](_0x432d7e,sanitizeForFilesystem(_0x4b7431[_0x59bbcd(0x159)][_0x59bbcd(0x190)])+_0x59bbcd(0x14b)),_0x4fece5=a133_0x59991e[_0x59bbcd(0xa1)](_0x432d7e,'code.js'),_0x502a48=a133_0x59991e[_0x59bbcd(0xa1)](_0x432d7e,_0x59bbcd(0x14d)),_0x451dee=apiExperimentalArtifactToYaml(_0x4b7431),_0x47951f=toExperimentalArtifactYamlString(_0x451dee),_0x8cef6=!a133_0x496aed[_0x59bbcd(0xe3)](_0x432d7e);let _0x460ef2=_0x8cef6,_0x5b3020,_0x541cd8=_0x47951f+(_0x59bbcd(0xcf)+_0x451dee[_0x59bbcd(0x19d)]+'\x0a');const _0x53b4eb=[..._0x451dee[_0x59bbcd(0x14d)]][_0x59bbcd(0x12a)]((_0x141cfa,_0x9eb193)=>_0x141cfa[_0x59bbcd(0x1c1)][_0x59bbcd(0xd9)](_0x9eb193[_0x59bbcd(0x1c1)]));for(const _0x10e803 of _0x53b4eb){_0x541cd8+='---\x20file:\x20'+_0x10e803[_0x59bbcd(0x1c1)]+_0x59bbcd(0xd0)+_0x10e803[_0x59bbcd(0x1a7)]+'\x0a';}if(!_0x8cef6){let _0x25e430='';a133_0x496aed[_0x59bbcd(0xe3)](_0x258f91)&&(_0x25e430=a133_0x496aed[_0x59bbcd(0x131)](_0x258f91,_0x59bbcd(0xf1)));a133_0x496aed['existsSync'](_0x4fece5)&&(_0x25e430+=_0x59bbcd(0xcf)+a133_0x496aed['readFileSync'](_0x4fece5,_0x59bbcd(0xf1))+'\x0a');if(a133_0x496aed[_0x59bbcd(0xe3)](_0x502a48)){const _0x23781f=a133_0x496aed[_0x59bbcd(0x1b2)](_0x502a48),_0x2b796e=_0x23781f[_0x59bbcd(0x12d)](_0x1970a3=>{const _0xf053a5=_0x59bbcd,_0x51ed37=a133_0x59991e['join'](_0x502a48,_0x1970a3);return a133_0x496aed[_0xf053a5(0x11a)](_0x51ed37)[_0xf053a5(0x173)]();})['sort']((_0x597c43,_0x225bab)=>_0x597c43[_0x59bbcd(0xd9)](_0x225bab));for(const _0x1db56a of _0x2b796e){const _0x116301=a133_0x59991e[_0x59bbcd(0xa1)](_0x502a48,_0x1db56a);_0x25e430+=_0x59bbcd(0xa7)+_0x1db56a+'\x20---\x0a'+a133_0x496aed['readFileSync'](_0x116301,_0x59bbcd(0xf1))+'\x0a';}}const _0x416c11=generateDiff(_0x25e430,_0x541cd8);_0x460ef2=hasChanges(_0x416c11),_0x460ef2&&(_0x5b3020=formatDiffWithColors(_0x416c11));}_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x432d7e,'content':'','isDir':!![]}),_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x258f91,'content':_0x47951f}),_0x3bb155['push']({'path':_0x4fece5,'content':_0x451dee[_0x59bbcd(0x19d)]});if(_0x451dee[_0x59bbcd(0x14d)][_0x59bbcd(0x15b)]>0x0){_0x3bb155['push']({'path':_0x502a48,'content':'','isDir':!![]});for(const _0x531d7d of _0x451dee['files']){const _0x34f2d6=a133_0x59991e[_0x59bbcd(0xa1)](_0x502a48,_0x531d7d['file_name']);_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x34f2d6,'content':_0x531d7d[_0x59bbcd(0x1a7)]});}}if(a133_0x496aed['existsSync'](_0x502a48)){const _0x2f4fec=a133_0x496aed[_0x59bbcd(0x1b2)](_0x502a48),_0x6fcc46=new Set(_0x451dee[_0x59bbcd(0x14d)][_0x59bbcd(0xd7)](_0x2d178d=>_0x2d178d[_0x59bbcd(0x1c1)]));for(const _0x3501e9 of _0x2f4fec){const _0x3e02cc=a133_0x59991e[_0x59bbcd(0xa1)](_0x502a48,_0x3501e9);a133_0x496aed['statSync'](_0x3e02cc)[_0x59bbcd(0x173)]()&&!_0x6fcc46[_0x59bbcd(0x133)](_0x3501e9)&&_0xf91270[_0x59bbcd(0xe6)]({'path':_0x3e02cc});}}_0x544e7e[_0x59bbcd(0x1c7)][_0x59bbcd(0xe6)]({'name':_0x4b7431[_0x59bbcd(0x159)][_0x59bbcd(0x190)],'outputPath':_0x432d7e,'isNew':_0x8cef6,'hasChanges':_0x460ef2,'diff':_0x5b3020}),_0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x1c7)][_0x59bbcd(0xd6)]++;if(_0x8cef6)_0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x1c7)][_0x59bbcd(0x1c9)]++;else{if(_0x460ef2)_0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x1c7)][_0x59bbcd(0x168)]++;else _0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x1c7)][_0x59bbcd(0xb9)]++;}}for(const _0x225b96 of _0x1f7086){const _0x2baf59=getSanitizedPathWithMigration(getFormInterfacesDir(_0x65384a),_0x225b96['attributes']['name'],_0x59bbcd(0x14b));_0x2baf59['renamed']&&this[_0x59bbcd(0xeb)]['info'](_0x59bbcd(0x1c5)+a133_0x59991e[_0x59bbcd(0xc3)](_0x2baf59[_0x59bbcd(0x124)])+_0x59bbcd(0xb8)+a133_0x59991e[_0x59bbcd(0xc3)](_0x2baf59[_0x59bbcd(0xaf)]));const _0x41270f=_0x2baf59[_0x59bbcd(0xaf)],_0xd5b300=await apiFormInterfaceToYaml(_0x225b96,_0x4e928d),_0x13b790=toFormInterfaceYamlString(_0xd5b300),_0x151505=!a133_0x496aed['existsSync'](_0x41270f);let _0x5a93c1=_0x151505,_0x4aede7;if(!_0x151505){const _0x29dcbf=a133_0x496aed[_0x59bbcd(0x131)](_0x41270f,_0x59bbcd(0xf1)),_0x5e1f8f=generateDiff(_0x29dcbf,_0x13b790);_0x5a93c1=hasChanges(_0x5e1f8f),_0x5a93c1&&(_0x4aede7=formatDiffWithColors(_0x5e1f8f));}_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x41270f,'content':_0x13b790}),_0x544e7e[_0x59bbcd(0x185)][_0x59bbcd(0xe6)]({'name':_0x225b96[_0x59bbcd(0x159)][_0x59bbcd(0x190)],'outputPath':_0x41270f,'isNew':_0x151505,'hasChanges':_0x5a93c1,'diff':_0x4aede7}),_0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x185)]['total']++;if(_0x151505)_0x544e7e[_0x59bbcd(0x191)]['formInterfaces'][_0x59bbcd(0x1c9)]++;else{if(_0x5a93c1)_0x544e7e['counts'][_0x59bbcd(0x185)][_0x59bbcd(0x168)]++;else _0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x185)][_0x59bbcd(0xb9)]++;}}for(const _0x297a12 of _0x336246){if(_0x297a12[_0x59bbcd(0x159)][_0x59bbcd(0xa6)])continue;const _0x564868=getSanitizedPathWithMigration(getChatInterfacesDir(_0x65384a),_0x297a12[_0x59bbcd(0x159)]['name'],_0x59bbcd(0x14b));_0x564868['renamed']&&this[_0x59bbcd(0xeb)][_0x59bbcd(0x187)](_0x59bbcd(0x15c)+a133_0x59991e['basename'](_0x564868['oldPath'])+_0x59bbcd(0xb8)+a133_0x59991e[_0x59bbcd(0xc3)](_0x564868[_0x59bbcd(0xaf)]));const _0x10fa03=_0x564868[_0x59bbcd(0xaf)],_0x42bb59=await apiChatInterfaceToYaml(_0x297a12,_0x4e928d),_0x145344=toChatInterfaceYamlString(_0x42bb59),_0x1157fc=!a133_0x496aed[_0x59bbcd(0xe3)](_0x10fa03);let _0x1b6c1c=_0x1157fc,_0x3614ae;if(!_0x1157fc){const _0x47a528=a133_0x496aed[_0x59bbcd(0x131)](_0x10fa03,_0x59bbcd(0xf1)),_0x56ad38=generateDiff(_0x47a528,_0x145344);_0x1b6c1c=hasChanges(_0x56ad38),_0x1b6c1c&&(_0x3614ae=formatDiffWithColors(_0x56ad38));}_0x3bb155[_0x59bbcd(0xe6)]({'path':_0x10fa03,'content':_0x145344}),_0x544e7e['chatInterfaces']['push']({'name':_0x297a12[_0x59bbcd(0x159)][_0x59bbcd(0x190)],'outputPath':_0x10fa03,'isNew':_0x1157fc,'hasChanges':_0x1b6c1c,'diff':_0x3614ae}),_0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x1c0)][_0x59bbcd(0xd6)]++;if(_0x1157fc)_0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x1c0)][_0x59bbcd(0x1c9)]++;else{if(_0x1b6c1c)_0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x1c0)]['updated']++;else _0x544e7e[_0x59bbcd(0x191)][_0x59bbcd(0x1c0)]['unchanged']++;}}if(_0x4e0681?.[_0x59bbcd(0x1a5)])return _0x544e7e;a133_0x496aed[_0x59bbcd(0xa2)](_0x65384a,{'recursive':!![]}),a133_0x496aed[_0x59bbcd(0xa2)](getKnowledgeBasesDir(_0x65384a),{'recursive':!![]}),a133_0x496aed[_0x59bbcd(0xa2)](getPromptsDir(_0x65384a),{'recursive':!![]}),a133_0x496aed[_0x59bbcd(0xa2)](getIntegrationsDir(_0x65384a),{'recursive':!![]}),a133_0x496aed[_0x59bbcd(0xa2)](getExperimentalKnowledgeBasesDir(_0x65384a),{'recursive':!![]}),a133_0x496aed['mkdirSync'](getExperimentalArtifactsDir(_0x65384a),{'recursive':!![]}),a133_0x496aed['mkdirSync'](getFormInterfacesDir(_0x65384a),{'recursive':!![]}),a133_0x496aed[_0x59bbcd(0xa2)](getChatInterfacesDir(_0x65384a),{'recursive':!![]});const _0x1ba49c=a133_0x59991e[_0x59bbcd(0xa1)](_0x65384a,_0x59bbcd(0xf8));a133_0x496aed['writeFileSync'](_0x1ba49c,createAgentConfigContent(_0x40fcfa));for(const _0x26cc66 of _0x3bb155){if(_0x26cc66[_0x59bbcd(0x195)])a133_0x496aed[_0x59bbcd(0xa2)](_0x26cc66[_0x59bbcd(0xaf)],{'recursive':!![]});else{const _0x17887f=a133_0x59991e[_0x59bbcd(0xcd)](_0x26cc66['path']);!a133_0x496aed[_0x59bbcd(0xe3)](_0x17887f)&&a133_0x496aed['mkdirSync'](_0x17887f,{'recursive':!![]}),a133_0x496aed[_0x59bbcd(0xdc)](_0x26cc66[_0x59bbcd(0xaf)],_0x26cc66[_0x59bbcd(0xad)]);}}for(const _0x9f1487 of _0xf91270){_0x9f1487[_0x59bbcd(0x195)]?(a133_0x496aed[_0x59bbcd(0x135)](_0x9f1487[_0x59bbcd(0xaf)],{'recursive':!![],'force':!![]}),this[_0x59bbcd(0xeb)][_0x59bbcd(0x187)](_0x59bbcd(0x13a)+a133_0x59991e[_0x59bbcd(0xc3)](a133_0x59991e['dirname'](_0x9f1487[_0x59bbcd(0xaf)]))+'/'+a133_0x59991e[_0x59bbcd(0xc3)](_0x9f1487[_0x59bbcd(0xaf)]))):(a133_0x496aed['rmSync'](_0x9f1487['path'],{'force':!![]}),this[_0x59bbcd(0xeb)][_0x59bbcd(0x187)]('Removed\x20deleted\x20file:\x20'+a133_0x59991e[_0x59bbcd(0xc3)](a133_0x59991e[_0x59bbcd(0xcd)](_0x9f1487['path']))+'/'+a133_0x59991e[_0x59bbcd(0xc3)](_0x9f1487[_0x59bbcd(0xaf)])));}return _0x544e7e;}async[a133_0x14e51b(0x126)](_0x3ea760,_0x43b248){const _0x6338a4=a133_0x14e51b,_0x3c2c44=a133_0x59991e[_0x6338a4(0xa1)](_0x3ea760,'tdx.json');if(!a133_0x496aed[_0x6338a4(0xe3)](_0x3c2c44))throw new SDKError(ErrorCode[_0x6338a4(0xef)],_0x6338a4(0xca)+_0x3ea760,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x41ed07=loadAgentConfig(_0x3c2c44),_0x3a02eb=await this[_0x6338a4(0x17e)](_0x41ed07['llm_project']),_0x1060dd=await this['client']['getProject'](_0x3a02eb),_0x29cab2=_0x1060dd[_0x6338a4(0x159)]['name'],_0x5e00ce={'projectName':_0x29cab2,'projectId':_0x3a02eb,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'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},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x34f6fa=[],_0x50d9b0=[],_0x40d222=[],_0x2ba451=[],_0x354da2=[],_0x5ce436=[],_0x1e1a4d=a133_0x496aed[_0x6338a4(0x1b2)](_0x3ea760,{'withFileTypes':!![]});for(const _0x519538 of _0x1e1a4d){if(!_0x519538[_0x6338a4(0x18a)]())continue;if([_0x6338a4(0xbf),_0x6338a4(0x13d),_0x6338a4(0xe1),_0x6338a4(0x136),_0x6338a4(0x1af),'form_interfaces',_0x6338a4(0xec)][_0x6338a4(0x1a1)](_0x519538[_0x6338a4(0x190)]))continue;const _0x4ea840=a133_0x59991e['join'](_0x3ea760,_0x519538[_0x6338a4(0x190)]);if(isAgentDir(_0x4ea840)){const _0x34920d=a133_0x59991e['join'](_0x4ea840,_0x6338a4(0x180)),_0xc6dcf7=a133_0x59991e['join'](_0x4ea840,_0x6338a4(0x118)),_0x146d70=a133_0x59991e[_0x6338a4(0xa1)](_0x4ea840,_0x6338a4(0xab)),_0xa1a663=parseAgentYaml(a133_0x496aed[_0x6338a4(0x131)](_0x34920d,_0x6338a4(0xf1)),_0x34920d),_0x596c7b=a133_0x496aed[_0x6338a4(0xe3)](_0xc6dcf7)?a133_0x496aed[_0x6338a4(0x131)](_0xc6dcf7,_0x6338a4(0xf1)):'',_0x4bea33=a133_0x496aed[_0x6338a4(0xe3)](_0x146d70)?a133_0x496aed[_0x6338a4(0x131)](_0x146d70,_0x6338a4(0xf1)):_0xa1a663['starter_message'];_0x34f6fa[_0x6338a4(0xe6)]({'name':_0xa1a663[_0x6338a4(0x190)],'dir':_0x4ea840,'yaml':_0xa1a663,'systemPrompt':_0x596c7b,'starterMessage':_0x4bea33});}}const _0x1eac44=getKnowledgeBasesDir(_0x3ea760);if(a133_0x496aed[_0x6338a4(0xe3)](_0x1eac44)){const _0x38b379=a133_0x496aed[_0x6338a4(0x1b2)](_0x1eac44);for(const _0x54692c of _0x38b379){const _0x23d908=a133_0x59991e[_0x6338a4(0xa1)](_0x1eac44,_0x54692c);if(_0x54692c[_0x6338a4(0x143)]('.yml')){const _0x4b3e57=parseKnowledgeBaseYaml(a133_0x496aed[_0x6338a4(0x131)](_0x23d908,_0x6338a4(0xf1)),_0x23d908);_0x50d9b0[_0x6338a4(0xe6)]({'name':_0x4b3e57['name'],'path':_0x23d908,'yaml':_0x4b3e57});}else{if(_0x54692c[_0x6338a4(0x143)](_0x6338a4(0x1a3))){const _0x32ebdc=a133_0x496aed[_0x6338a4(0x131)](_0x23d908,'utf-8'),{name:_0x11b9c7,text:_0x5a453a}=parseTextKnowledgeBaseMd(_0x32ebdc,_0x54692c);_0x40d222[_0x6338a4(0xe6)]({'name':_0x11b9c7,'path':_0x23d908,'text':_0x5a453a});}}}}const _0x110d73=getPromptsDir(_0x3ea760);if(a133_0x496aed[_0x6338a4(0xe3)](_0x110d73)){const _0x3d9f50=a133_0x496aed[_0x6338a4(0x1b2)](_0x110d73)[_0x6338a4(0x12d)](_0x41837d=>_0x41837d[_0x6338a4(0x143)](_0x6338a4(0x14b)));for(const _0x2009f8 of _0x3d9f50){const _0x54ffef=a133_0x59991e['join'](_0x110d73,_0x2009f8),_0x3c94f5=parsePromptYaml(a133_0x496aed[_0x6338a4(0x131)](_0x54ffef,_0x6338a4(0xf1)),_0x54ffef);_0x2ba451[_0x6338a4(0xe6)]({'name':_0x3c94f5[_0x6338a4(0x190)],'path':_0x54ffef,'yaml':_0x3c94f5});}}const _0x8c7048=[],_0x5c66e6=getIntegrationsDir(_0x3ea760);if(a133_0x496aed[_0x6338a4(0xe3)](_0x5c66e6)){const _0x207bde=a133_0x496aed[_0x6338a4(0x1b2)](_0x5c66e6)[_0x6338a4(0x12d)](_0x14180e=>_0x14180e[_0x6338a4(0x143)](_0x6338a4(0x14b)));for(const _0x4c01c0 of _0x207bde){const _0x3c2b64=a133_0x59991e['join'](_0x5c66e6,_0x4c01c0),_0x3b4ea8=parseIntegrationYaml(a133_0x496aed[_0x6338a4(0x131)](_0x3c2b64,'utf-8'),_0x3c2b64);if(!SAFE_INTEGRATION_TYPES[_0x6338a4(0x1a1)](_0x3b4ea8[_0x6338a4(0x11e)][_0x6338a4(0xbc)]())){this['logger'][_0x6338a4(0x1b0)]('Skipping\x20integration\x20\x27'+_0x3b4ea8[_0x6338a4(0x190)]+_0x6338a4(0x1c4)+_0x3b4ea8[_0x6338a4(0x11e)]+_0x6338a4(0x157)+(_0x6338a4(0x194)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x6338a4(0x1c3))+_0x6338a4(0xee));continue;}_0x8c7048[_0x6338a4(0xe6)]({'name':_0x3b4ea8['name'],'path':_0x3c2b64,'yaml':_0x3b4ea8});}}const _0x3bb812=getExperimentalKnowledgeBasesDir(_0x3ea760);if(a133_0x496aed[_0x6338a4(0xe3)](_0x3bb812)){const _0x16b754=a133_0x496aed['readdirSync'](_0x3bb812,{'withFileTypes':!![]});for(const _0x1cae69 of _0x16b754){if(!_0x1cae69[_0x6338a4(0x18a)]())continue;const _0x12d100=a133_0x59991e['join'](_0x3bb812,_0x1cae69[_0x6338a4(0x190)]),_0x167d14=a133_0x59991e[_0x6338a4(0xa1)](_0x12d100,_0x1cae69[_0x6338a4(0x190)]+_0x6338a4(0x14b)),_0x29e9d9=a133_0x59991e[_0x6338a4(0xa1)](_0x12d100,'functions');if(!a133_0x496aed[_0x6338a4(0xe3)](_0x167d14))continue;const _0x509c82=parseExperimentalKnowledgeBaseYaml(a133_0x496aed['readFileSync'](_0x167d14,'utf-8'),_0x167d14),_0x598536=[];if(a133_0x496aed[_0x6338a4(0xe3)](_0x29e9d9)){const _0xa707d2=a133_0x496aed[_0x6338a4(0x1b2)](_0x29e9d9,{'withFileTypes':!![]});for(const _0x2f7ff6 of _0xa707d2){if(!_0x2f7ff6[_0x6338a4(0x18a)]())continue;const _0x16fc3b=a133_0x59991e[_0x6338a4(0xa1)](_0x29e9d9,_0x2f7ff6['name']),_0x56751a=a133_0x59991e['join'](_0x16fc3b,_0x6338a4(0x150)),_0x1dcca4=a133_0x59991e['join'](_0x16fc3b,_0x6338a4(0xb4));a133_0x496aed[_0x6338a4(0xe3)](_0x56751a)&&a133_0x496aed[_0x6338a4(0xe3)](_0x1dcca4)&&_0x598536['push']({'name':_0x2f7ff6[_0x6338a4(0x190)],'code':a133_0x496aed[_0x6338a4(0x131)](_0x56751a,_0x6338a4(0xf1)),'json_schema':a133_0x496aed['readFileSync'](_0x1dcca4,'utf-8')});}}const _0x2d1748={..._0x509c82,'variables':_0x509c82[_0x6338a4(0xa9)]||[],'functions':_0x598536};_0x354da2[_0x6338a4(0xe6)]({'name':_0x509c82[_0x6338a4(0x190)],'dir':_0x12d100,'def':_0x2d1748});}}const _0x43b3e4=getExperimentalArtifactsDir(_0x3ea760);if(a133_0x496aed[_0x6338a4(0xe3)](_0x43b3e4)){const _0x1de165=a133_0x496aed[_0x6338a4(0x1b2)](_0x43b3e4,{'withFileTypes':!![]});for(const _0x1a46a7 of _0x1de165){if(!_0x1a46a7['isDirectory']())continue;const _0x1e10df=a133_0x59991e[_0x6338a4(0xa1)](_0x43b3e4,_0x1a46a7[_0x6338a4(0x190)]),_0x16cad9=a133_0x59991e[_0x6338a4(0xa1)](_0x1e10df,_0x1a46a7[_0x6338a4(0x190)]+_0x6338a4(0x14b)),_0x2acab9=a133_0x59991e['join'](_0x1e10df,_0x6338a4(0x150)),_0x566ac7=a133_0x59991e['join'](_0x1e10df,_0x6338a4(0x14d));if(!a133_0x496aed[_0x6338a4(0xe3)](_0x16cad9)||!a133_0x496aed[_0x6338a4(0xe3)](_0x2acab9))continue;const _0x186e0e=parseExperimentalArtifactYaml(a133_0x496aed[_0x6338a4(0x131)](_0x16cad9,'utf-8'),_0x16cad9),_0xbcbd1b=a133_0x496aed[_0x6338a4(0x131)](_0x2acab9,_0x6338a4(0xf1)),_0x3928a8=[];if(a133_0x496aed[_0x6338a4(0xe3)](_0x566ac7)){const _0x571b98=a133_0x496aed[_0x6338a4(0x1b2)](_0x566ac7);for(const _0x5153f2 of _0x571b98){const _0x4a0022=a133_0x59991e['join'](_0x566ac7,_0x5153f2);a133_0x496aed[_0x6338a4(0x11a)](_0x4a0022)[_0x6338a4(0x173)]()&&_0x3928a8[_0x6338a4(0xe6)]({'file_name':_0x5153f2,'text_content':a133_0x496aed[_0x6338a4(0x131)](_0x4a0022,_0x6338a4(0xf1))});}}const _0x3af343={..._0x186e0e,'code':_0xbcbd1b,'files':_0x3928a8};_0x5ce436[_0x6338a4(0xe6)]({'name':_0x186e0e[_0x6338a4(0x190)],'dir':_0x1e10df,'def':_0x3af343});}}const _0x7387c0=[],_0x2384c3=getFormInterfacesDir(_0x3ea760);if(a133_0x496aed[_0x6338a4(0xe3)](_0x2384c3)){const _0x1af475=a133_0x496aed['readdirSync'](_0x2384c3)[_0x6338a4(0x12d)](_0x425d8f=>_0x425d8f[_0x6338a4(0x143)](_0x6338a4(0x14b)));for(const _0x105143 of _0x1af475){const _0x2b000b=a133_0x59991e['join'](_0x2384c3,_0x105143),_0x354cf2=parseFormInterfaceYaml(a133_0x496aed[_0x6338a4(0x131)](_0x2b000b,_0x6338a4(0xf1)),_0x2b000b);_0x7387c0['push']({'name':_0x354cf2[_0x6338a4(0x190)],'path':_0x2b000b,'yaml':_0x354cf2});}}const _0x1acbef=[],_0x88c90d=getChatInterfacesDir(_0x3ea760);if(a133_0x496aed[_0x6338a4(0xe3)](_0x88c90d)){const _0x320c8f=a133_0x496aed['readdirSync'](_0x88c90d)['filter'](_0x3c0602=>_0x3c0602[_0x6338a4(0x143)](_0x6338a4(0x14b)));for(const _0x58acdb of _0x320c8f){const _0x553143=a133_0x59991e[_0x6338a4(0xa1)](_0x88c90d,_0x58acdb),_0x283bab=parseChatInterfaceYaml(a133_0x496aed['readFileSync'](_0x553143,_0x6338a4(0xf1)),_0x553143);_0x1acbef['push']({'name':_0x283bab['name'],'path':_0x553143,'yaml':_0x283bab});}}const _0x467016=await this['client'][_0x6338a4(0x1ab)](_0x3a02eb),_0x737904=await this['client'][_0x6338a4(0x103)](_0x3a02eb),_0x2b47b9=await this[_0x6338a4(0xf9)]['listTextKnowledgeBases'](_0x3a02eb),_0x1c45db=await this[_0x6338a4(0xf9)][_0x6338a4(0x158)](_0x3a02eb),_0x2ff60f=await this[_0x6338a4(0xf9)][_0x6338a4(0x10a)](_0x3a02eb),_0x222502=await safeListOrEmpty(()=>this['client']['listExperimentalKnowledgeBases'](_0x3a02eb)),_0x36ff53=await safeListOrEmpty(()=>this[_0x6338a4(0xf9)][_0x6338a4(0xf2)](_0x3a02eb)),_0x14e696=await safeListOrEmpty(()=>this[_0x6338a4(0xf9)]['listFormInterfaces'](_0x3a02eb)),_0x594296=await safeListOrEmpty(()=>this['client']['listChatInterfaces'](_0x3a02eb)),_0x6e3881=await fetchAllToolTargetMaps((_0x46a80e,_0x51b008)=>this['client']['listToolTargets'](_0x46a80e,_0x51b008),_0x3a02eb),_0x1e66f6=new Map(),_0x4046c4=new Map(),_0x352dd2=new Map(),_0x5c8488=new Map(),_0x30d6a3=new Map(),_0x3ea866=new Map(),_0xe66018=new Map();for(const _0x1e115c of _0x467016){_0x1e66f6['set'](_0x1e115c[_0x6338a4(0x159)][_0x6338a4(0x190)],_0x1e115c);}for(const _0x554eaf of _0x737904){_0x4046c4[_0x6338a4(0x117)](_0x554eaf[_0x6338a4(0x159)][_0x6338a4(0x190)],_0x554eaf);}for(const _0x367647 of _0x2b47b9){_0x352dd2[_0x6338a4(0x117)](_0x367647[_0x6338a4(0x159)][_0x6338a4(0x190)],_0x367647);}for(const _0x51bf38 of _0x1c45db){_0x5c8488[_0x6338a4(0x117)](_0x51bf38[_0x6338a4(0x159)][_0x6338a4(0x190)],_0x51bf38);}for(const _0x1e87be of _0x2ff60f){_0x30d6a3[_0x6338a4(0x117)](_0x1e87be[_0x6338a4(0x159)][_0x6338a4(0x161)][_0x6338a4(0xbc)](),_0x1e87be);}for(const _0x392bee of _0x222502){_0x3ea866[_0x6338a4(0x117)](_0x392bee[_0x6338a4(0x159)][_0x6338a4(0x190)],_0x392bee);}for(const _0x1912a3 of _0x36ff53){_0xe66018['set'](_0x1912a3[_0x6338a4(0x159)]['name'],_0x1912a3);}const _0x186053=new Map(),_0x5185dc=new Map();for(const _0x5da222 of _0x14e696){_0x186053[_0x6338a4(0x117)](_0x5da222['attributes'][_0x6338a4(0x190)],_0x5da222);}for(const _0x50a4f8 of _0x594296){_0x5185dc['set'](_0x50a4f8[_0x6338a4(0x159)][_0x6338a4(0x190)],_0x50a4f8);}const _0x5de630=new Map(),_0x30f176=new Map();for(const _0x179a42 of _0x467016){_0x5de630[_0x6338a4(0x117)](_0x179a42['attributes'][_0x6338a4(0x190)],_0x179a42['id']),_0x30f176[_0x6338a4(0x117)](_0x179a42['id'],_0x179a42[_0x6338a4(0x159)][_0x6338a4(0x190)]);}const _0x415382=new Map(),_0x1a29c8=new Map();for(const _0x43ccce of _0x1c45db){_0x415382['set'](_0x43ccce[_0x6338a4(0x159)]['name'],_0x43ccce['id']),_0x1a29c8[_0x6338a4(0x117)](_0x43ccce['id'],_0x43ccce['attributes'][_0x6338a4(0x190)]);}const _0x58def8=_0x6e3881[_0x6338a4(0x116)][_0x6338a4(0x17b)]||new Map(),_0x3ae5f3=_0x6e3881[_0x6338a4(0x116)][_0x6338a4(0xc8)]||new Map(),_0x450151=_0x6e3881['nameToId']['ExperimentalKnowledgeBase']||new Map(),_0x2e0428=new Map(),_0x5d08c1={'resolveToolTargetName':buildNameResolver({..._0x6e3881[_0x6338a4(0x166)],'Agent':_0x30f176}),'resolvePromptName':async _0xb2ac08=>_0x1a29c8[_0x6338a4(0x155)](_0xb2ac08),'onWarning':_0x2aafa2=>this[_0x6338a4(0xeb)][_0x6338a4(0x1b0)](_0x2aafa2)};let _0xd02add=[];const _0x69359c={'projectId':_0x3a02eb,'resolveToolTargetId':buildIdResolver({..._0x6e3881['nameToId'],'Agent':_0x5de630}),'resolvePromptId':async _0x1f1726=>_0x415382['get'](_0x1f1726),'onWarning':_0x4f4876=>{const _0x174aac=_0x6338a4;this[_0x174aac(0xeb)][_0x174aac(0x1b0)](_0x4f4876),_0xd02add['push'](_0x4f4876);}},{resolved:_0x876879,unresolved:_0x558c00}=resolveAgentDependencies(_0x34f6fa,new Set(_0x1e66f6['keys']()));for(const {agent:_0x195b22,missingDeps:_0x37dffb}of _0x558c00){_0x5e00ce[_0x6338a4(0x18f)][_0x6338a4(0xe6)]({'agentName':_0x195b22[_0x6338a4(0xd8)]['name'],'action':_0x6338a4(0x1ca),'error':_0x6338a4(0xc4)+_0x37dffb[_0x6338a4(0xa1)](',\x20')+_0x6338a4(0x160)}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x18f)][_0x6338a4(0xf4)]++;}for(const _0xb7f0c2 of _0x50d9b0){const _0x36d28f=_0x4046c4[_0x6338a4(0x155)](_0xb7f0c2[_0x6338a4(0xd8)][_0x6338a4(0x190)]),_0x4a39b8=a133_0x496aed[_0x6338a4(0x131)](_0xb7f0c2[_0x6338a4(0xaf)],_0x6338a4(0xf1));if(_0x36d28f){const _0x1af83a=apiKnowledgeBaseToYaml(_0x36d28f),_0x2fcb59=toKnowledgeBaseYamlString(_0x1af83a),_0xd25de7=generateDiff(_0x2fcb59,_0x4a39b8),_0x243765=hasChanges(_0xd25de7);_0x243765?(_0x5e00ce[_0x6338a4(0x1ba)][_0x6338a4(0xe6)]({'name':_0xb7f0c2['yaml'][_0x6338a4(0x190)],'action':_0x6338a4(0x168),'id':_0x36d28f['id'],'diff':formatDiffWithColors(_0xd25de7)}),_0x5e00ce[_0x6338a4(0x191)]['knowledgeBases'][_0x6338a4(0x168)]++):(_0x5e00ce[_0x6338a4(0x1ba)][_0x6338a4(0xe6)]({'name':_0xb7f0c2[_0x6338a4(0xd8)][_0x6338a4(0x190)],'action':_0x6338a4(0xb9),'id':_0x36d28f['id']}),_0x5e00ce[_0x6338a4(0x191)]['knowledgeBases'][_0x6338a4(0xb9)]++);}else _0x5e00ce['knowledgeBases']['push']({'name':_0xb7f0c2[_0x6338a4(0xd8)][_0x6338a4(0x190)],'action':'created'}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x1ba)][_0x6338a4(0xf5)]++;}for(const _0x179b2f of _0x40d222){const _0x1c88d7=_0x352dd2['get'](_0x179b2f[_0x6338a4(0x190)]),_0x524f00=a133_0x496aed[_0x6338a4(0x131)](_0x179b2f[_0x6338a4(0xaf)],_0x6338a4(0xf1));if(_0x1c88d7){const _0x3bd346=toTextKnowledgeBaseMd(_0x1c88d7['attributes'][_0x6338a4(0x190)],_0x1c88d7[_0x6338a4(0x159)][_0x6338a4(0xce)]),_0x10bdb8=generateDiff(_0x3bd346,_0x524f00),_0x2c22c0=hasChanges(_0x10bdb8);_0x2c22c0?(_0x5e00ce[_0x6338a4(0x19e)]['push']({'name':_0x179b2f[_0x6338a4(0x190)],'action':'updated','id':_0x1c88d7['id'],'diff':formatDiffWithColors(_0x10bdb8)}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x19e)][_0x6338a4(0x168)]++):(_0x5e00ce[_0x6338a4(0x19e)][_0x6338a4(0xe6)]({'name':_0x179b2f['name'],'action':_0x6338a4(0xb9),'id':_0x1c88d7['id']}),_0x5e00ce[_0x6338a4(0x191)]['textKnowledgeBases'][_0x6338a4(0xb9)]++);}else _0x5e00ce[_0x6338a4(0x19e)]['push']({'name':_0x179b2f[_0x6338a4(0x190)],'action':'created'}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x19e)]['created']++;}for(const _0x1a27b7 of _0x876879){const _0xc1faf1=_0x1e66f6[_0x6338a4(0x155)](_0x1a27b7[_0x6338a4(0xd8)]['name']),_0x5d0f1d=a133_0x59991e['join'](_0x1a27b7[_0x6338a4(0xaa)],_0x6338a4(0x180)),_0x29f38d=a133_0x496aed['readFileSync'](_0x5d0f1d,_0x6338a4(0xf1)),_0x14d6d2=_0x1a27b7[_0x6338a4(0x11b)],_0x324f4f='#\x20prompt.md\x0a'+_0x14d6d2+_0x6338a4(0x165)+_0x29f38d;if(_0xc1faf1){const {yaml:_0x4827a5,systemPrompt:_0x401f13}=await agentResponseToDef(_0xc1faf1,_0x5d08c1),_0x3a3892=toAgentYamlString(_0x4827a5),_0xa9f39a=_0x6338a4(0x115)+_0x401f13+'\x0a\x0a#\x20agent.yml\x0a'+_0x3a3892,_0x15eb25=generateDiff(_0xa9f39a,_0x324f4f),_0x45d6da=hasChanges(_0x15eb25);_0x45d6da?(_0x5e00ce[_0x6338a4(0x18f)][_0x6338a4(0xe6)]({'agentName':_0x1a27b7[_0x6338a4(0xd8)]['name'],'action':_0x6338a4(0x168),'agentId':_0xc1faf1['id'],'diff':formatDiffWithColors(_0x15eb25)}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x18f)][_0x6338a4(0x168)]++):(_0x5e00ce[_0x6338a4(0x18f)]['push']({'agentName':_0x1a27b7['yaml'][_0x6338a4(0x190)],'action':_0x6338a4(0xb9),'agentId':_0xc1faf1['id']}),_0x5e00ce['counts'][_0x6338a4(0x18f)][_0x6338a4(0xb9)]++);}else _0x5e00ce['agents'][_0x6338a4(0xe6)]({'agentName':_0x1a27b7[_0x6338a4(0xd8)][_0x6338a4(0x190)],'action':_0x6338a4(0xf5)}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x18f)]['created']++;}for(const _0x682978 of _0x2ba451){const _0x4831a6=_0x5c8488[_0x6338a4(0x155)](_0x682978[_0x6338a4(0xd8)]['name']),_0x2cd631=a133_0x496aed[_0x6338a4(0x131)](_0x682978[_0x6338a4(0xaf)],_0x6338a4(0xf1));if(_0x4831a6){const _0x1fcd63=await apiPromptToYaml(_0x4831a6,_0x5d08c1);if(!_0x1fcd63){_0x5e00ce['prompts'][_0x6338a4(0xe6)]({'name':_0x682978['yaml'][_0x6338a4(0x190)],'action':_0x6338a4(0x168),'id':_0x4831a6['id']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x13d)]['updated']++;continue;}const _0x45cbbd=toPromptYamlString(_0x1fcd63),_0x4991f7=generateDiff(_0x45cbbd,_0x2cd631),_0x32150f=hasChanges(_0x4991f7);_0x32150f?(_0x5e00ce[_0x6338a4(0x13d)][_0x6338a4(0xe6)]({'name':_0x682978['yaml'][_0x6338a4(0x190)],'action':_0x6338a4(0x168),'id':_0x4831a6['id'],'diff':formatDiffWithColors(_0x4991f7)}),_0x5e00ce[_0x6338a4(0x191)]['prompts']['updated']++):(_0x5e00ce[_0x6338a4(0x13d)][_0x6338a4(0xe6)]({'name':_0x682978[_0x6338a4(0xd8)][_0x6338a4(0x190)],'action':_0x6338a4(0xb9),'id':_0x4831a6['id']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x13d)][_0x6338a4(0xb9)]++);}else _0x5e00ce[_0x6338a4(0x13d)][_0x6338a4(0xe6)]({'name':_0x682978[_0x6338a4(0xd8)]['name'],'action':_0x6338a4(0xf5)}),_0x5e00ce['counts'][_0x6338a4(0x13d)]['created']++;}for(const _0x544a01 of _0x8c7048){const _0x5b560a=_0x30d6a3[_0x6338a4(0x155)](_0x544a01[_0x6338a4(0xd8)][_0x6338a4(0x11e)]),_0x36c5a1=a133_0x496aed[_0x6338a4(0x131)](_0x544a01['path'],'utf-8');if(_0x5b560a){const _0x2379f3=await apiIntegrationToYaml(_0x5b560a,_0x5d08c1),_0x300e05=toIntegrationYamlString(_0x2379f3),_0x414725=generateDiff(_0x300e05,_0x36c5a1),_0x3790df=hasChanges(_0x414725);_0x3790df?(_0x5e00ce[_0x6338a4(0xe1)]['push']({'name':_0x544a01['yaml'][_0x6338a4(0x11e)],'action':_0x6338a4(0x168),'id':_0x5b560a['id'],'diff':formatDiffWithColors(_0x414725)}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0xe1)][_0x6338a4(0x168)]++):(_0x5e00ce[_0x6338a4(0xe1)]['push']({'name':_0x544a01[_0x6338a4(0xd8)][_0x6338a4(0x11e)],'action':_0x6338a4(0xb9),'id':_0x5b560a['id']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0xe1)][_0x6338a4(0xb9)]++);}else _0x5e00ce['integrations'][_0x6338a4(0xe6)]({'name':_0x544a01[_0x6338a4(0xd8)][_0x6338a4(0x11e)],'action':_0x6338a4(0xf5)}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0xe1)][_0x6338a4(0xf5)]++;}for(const _0x4e66fe of _0x354da2){const _0x3e172e=_0x3ea866['get'](_0x4e66fe[_0x6338a4(0x104)]['name']),_0x4ca450=toExperimentalKnowledgeBaseYamlString(_0x4e66fe[_0x6338a4(0x104)]);let _0x5982c1=_0x4ca450;for(const _0x54e41b of _0x4e66fe['def']['functions']){_0x5982c1+=_0x6338a4(0x129)+_0x54e41b[_0x6338a4(0x190)]+'\x20---\x0a'+_0x54e41b['code']+_0x6338a4(0x14f)+_0x54e41b['name']+_0x6338a4(0xd0)+_0x54e41b['json_schema']+'\x0a';}if(_0x3e172e){const _0x306b8f=apiExperimentalKnowledgeBaseToYaml(_0x3e172e),_0x5cd263=toExperimentalKnowledgeBaseYamlString(_0x306b8f);let _0x343b14=_0x5cd263;for(const _0x1ac2ba of _0x306b8f[_0x6338a4(0xed)]){_0x343b14+='\x0a---\x20function:\x20'+_0x1ac2ba[_0x6338a4(0x190)]+_0x6338a4(0xd0)+_0x1ac2ba[_0x6338a4(0x19d)]+_0x6338a4(0x14f)+_0x1ac2ba[_0x6338a4(0x190)]+_0x6338a4(0xd0)+_0x1ac2ba[_0x6338a4(0x16a)]+'\x0a';}const _0x40cca6=generateDiff(_0x343b14,_0x5982c1),_0x5caa65=hasChanges(_0x40cca6);_0x5caa65?(_0x5e00ce[_0x6338a4(0x111)][_0x6338a4(0xe6)]({'name':_0x4e66fe[_0x6338a4(0x104)][_0x6338a4(0x190)],'action':_0x6338a4(0x168),'id':_0x3e172e['id'],'diff':formatDiffWithColors(_0x40cca6)}),_0x5e00ce['counts'][_0x6338a4(0x111)][_0x6338a4(0x168)]++):(_0x5e00ce[_0x6338a4(0x111)][_0x6338a4(0xe6)]({'name':_0x4e66fe[_0x6338a4(0x104)][_0x6338a4(0x190)],'action':_0x6338a4(0xb9),'id':_0x3e172e['id']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x111)][_0x6338a4(0xb9)]++);}else _0x5e00ce[_0x6338a4(0x111)][_0x6338a4(0xe6)]({'name':_0x4e66fe[_0x6338a4(0x104)][_0x6338a4(0x190)],'action':'created'}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x111)][_0x6338a4(0xf5)]++;}for(const _0x548097 of _0x5ce436){const _0x50ae53=_0xe66018[_0x6338a4(0x155)](_0x548097[_0x6338a4(0x104)][_0x6338a4(0x190)]),_0x2a91db=toExperimentalArtifactYamlString(_0x548097[_0x6338a4(0x104)]);let _0xcc80fa=_0x2a91db+(_0x6338a4(0xcf)+_0x548097[_0x6338a4(0x104)]['code']+'\x0a');for(const _0x3e528b of _0x548097[_0x6338a4(0x104)][_0x6338a4(0x14d)]){_0xcc80fa+=_0x6338a4(0xa7)+_0x3e528b[_0x6338a4(0x1c1)]+_0x6338a4(0xd0)+_0x3e528b[_0x6338a4(0x1a7)]+'\x0a';}if(_0x50ae53){const _0x85f644=apiExperimentalArtifactToYaml(_0x50ae53),_0x357356=toExperimentalArtifactYamlString(_0x85f644);let _0x1df521=_0x357356+(_0x6338a4(0xcf)+_0x85f644[_0x6338a4(0x19d)]+'\x0a');for(const _0x1b0206 of _0x85f644[_0x6338a4(0x14d)]){_0x1df521+='---\x20file:\x20'+_0x1b0206['file_name']+_0x6338a4(0xd0)+_0x1b0206['text_content']+'\x0a';}const _0xdc0e8f=generateDiff(_0x1df521,_0xcc80fa),_0x3230d0=hasChanges(_0xdc0e8f);_0x3230d0?(_0x5e00ce[_0x6338a4(0x1c7)][_0x6338a4(0xe6)]({'name':_0x548097[_0x6338a4(0x104)][_0x6338a4(0x190)],'action':_0x6338a4(0x168),'id':_0x50ae53['id'],'diff':formatDiffWithColors(_0xdc0e8f)}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x1c7)][_0x6338a4(0x168)]++):(_0x5e00ce['experimentalArtifacts'][_0x6338a4(0xe6)]({'name':_0x548097[_0x6338a4(0x104)]['name'],'action':_0x6338a4(0xb9),'id':_0x50ae53['id']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x1c7)][_0x6338a4(0xb9)]++);}else _0x5e00ce['experimentalArtifacts']['push']({'name':_0x548097[_0x6338a4(0x104)][_0x6338a4(0x190)],'action':_0x6338a4(0xf5)}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x1c7)][_0x6338a4(0xf5)]++;}for(const _0x378a21 of _0x7387c0){const _0x4eb658=_0x186053['get'](_0x378a21[_0x6338a4(0xd8)]['name']),_0x54b284=a133_0x496aed['readFileSync'](_0x378a21[_0x6338a4(0xaf)],_0x6338a4(0xf1));if(_0x4eb658){const _0x1d9692=await apiFormInterfaceToYaml(_0x4eb658,_0x5d08c1),_0x42097f=toFormInterfaceYamlString(_0x1d9692),_0x493245=generateDiff(_0x42097f,_0x54b284),_0x50ffac=hasChanges(_0x493245);_0x50ffac?(_0x5e00ce[_0x6338a4(0x185)]['push']({'name':_0x378a21[_0x6338a4(0xd8)][_0x6338a4(0x190)],'action':_0x6338a4(0x168),'id':_0x4eb658['id'],'diff':formatDiffWithColors(_0x493245)}),_0x5e00ce[_0x6338a4(0x191)]['formInterfaces'][_0x6338a4(0x168)]++):(_0x5e00ce[_0x6338a4(0x185)]['push']({'name':_0x378a21[_0x6338a4(0xd8)][_0x6338a4(0x190)],'action':_0x6338a4(0xb9),'id':_0x4eb658['id']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x185)][_0x6338a4(0xb9)]++);}else _0x5e00ce[_0x6338a4(0x185)][_0x6338a4(0xe6)]({'name':_0x378a21[_0x6338a4(0xd8)][_0x6338a4(0x190)],'action':_0x6338a4(0xf5)}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x185)][_0x6338a4(0xf5)]++;}for(const _0x155a31 of _0x1acbef){const _0x579e15=_0x5185dc['get'](_0x155a31['yaml']['name']),_0x3efd42=a133_0x496aed[_0x6338a4(0x131)](_0x155a31[_0x6338a4(0xaf)],_0x6338a4(0xf1));if(_0x579e15){const _0x3bc509=await apiChatInterfaceToYaml(_0x579e15,_0x5d08c1),_0x945a20=toChatInterfaceYamlString(_0x3bc509),_0x5b99ad=generateDiff(_0x945a20,_0x3efd42),_0x245eb8=hasChanges(_0x5b99ad);_0x245eb8?(_0x5e00ce[_0x6338a4(0x1c0)][_0x6338a4(0xe6)]({'name':_0x155a31[_0x6338a4(0xd8)][_0x6338a4(0x190)],'action':_0x6338a4(0x168),'id':_0x579e15['id'],'diff':formatDiffWithColors(_0x5b99ad)}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x1c0)]['updated']++):(_0x5e00ce[_0x6338a4(0x1c0)][_0x6338a4(0xe6)]({'name':_0x155a31[_0x6338a4(0xd8)]['name'],'action':_0x6338a4(0xb9),'id':_0x579e15['id']}),_0x5e00ce['counts'][_0x6338a4(0x1c0)]['unchanged']++);}else _0x5e00ce[_0x6338a4(0x1c0)][_0x6338a4(0xe6)]({'name':_0x155a31[_0x6338a4(0xd8)][_0x6338a4(0x190)],'action':_0x6338a4(0xf5)}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x1c0)]['created']++;}if(_0x43b248?.[_0x6338a4(0x1a5)])return _0x5e00ce;_0x5e00ce['knowledgeBases']=[],_0x5e00ce[_0x6338a4(0x19e)]=[],_0x5e00ce['prompts']=[],_0x5e00ce['integrations']=[],_0x5e00ce[_0x6338a4(0x111)]=[],_0x5e00ce[_0x6338a4(0x1c7)]=[],_0x5e00ce[_0x6338a4(0x185)]=[],_0x5e00ce[_0x6338a4(0x1c0)]=[];const _0x5f597a=_0x5e00ce[_0x6338a4(0x18f)][_0x6338a4(0x12d)](_0x14b91a=>_0x14b91a[_0x6338a4(0x137)]==='error');_0x5e00ce[_0x6338a4(0x18f)]=_0x5f597a,_0x5e00ce[_0x6338a4(0x191)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x5f597a['length']},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'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},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x49080b of _0x50d9b0){try{const _0x5ad5c3=_0x4046c4[_0x6338a4(0x155)](_0x49080b[_0x6338a4(0xd8)][_0x6338a4(0x190)]),_0x14cf93=yamlKnowledgeBaseToApi(_0x49080b[_0x6338a4(0xd8)],_0x3a02eb);if(_0x5ad5c3)await this[_0x6338a4(0xf9)][_0x6338a4(0x156)](_0x5ad5c3['id'],_0x14cf93),_0x58def8['set'](_0x49080b[_0x6338a4(0xd8)][_0x6338a4(0x190)],_0x5ad5c3['id']),_0x5e00ce[_0x6338a4(0x1ba)]['push']({'name':_0x49080b[_0x6338a4(0xd8)][_0x6338a4(0x190)],'action':_0x6338a4(0x168),'id':_0x5ad5c3['id']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x1ba)]['updated']++;else{const _0x116d5b=await this[_0x6338a4(0xf9)][_0x6338a4(0x19c)](_0x14cf93);_0x58def8[_0x6338a4(0x117)](_0x49080b[_0x6338a4(0xd8)][_0x6338a4(0x190)],_0x116d5b['id']),_0x5e00ce[_0x6338a4(0x1ba)][_0x6338a4(0xe6)]({'name':_0x49080b[_0x6338a4(0xd8)]['name'],'action':_0x6338a4(0xf5),'id':_0x116d5b['id']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x1ba)][_0x6338a4(0xf5)]++;}}catch(_0x281c97){_0x5e00ce['knowledgeBases']['push']({'name':_0x49080b[_0x6338a4(0xd8)][_0x6338a4(0x190)],'action':_0x6338a4(0x1ca),'error':_0x281c97[_0x6338a4(0xf7)]}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x1ba)][_0x6338a4(0xf4)]++;}}for(const _0x5ce5bf of _0x40d222){try{const _0x3ca75a=_0x352dd2[_0x6338a4(0x155)](_0x5ce5bf[_0x6338a4(0x190)]),_0x537a41=yamlTextKnowledgeBaseToApi({'name':_0x5ce5bf['name'],'text':_0x5ce5bf[_0x6338a4(0xce)]},_0x3a02eb);if(_0x3ca75a)await this[_0x6338a4(0xf9)][_0x6338a4(0x1b9)](_0x3ca75a['id'],_0x537a41),_0x3ae5f3[_0x6338a4(0x117)](_0x5ce5bf[_0x6338a4(0x190)],_0x3ca75a['id']),_0x5e00ce[_0x6338a4(0x19e)][_0x6338a4(0xe6)]({'name':_0x5ce5bf[_0x6338a4(0x190)],'action':_0x6338a4(0x168),'id':_0x3ca75a['id']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x19e)][_0x6338a4(0x168)]++;else{const _0x32cf5f=await this['client'][_0x6338a4(0x153)](_0x537a41);_0x3ae5f3[_0x6338a4(0x117)](_0x5ce5bf['name'],_0x32cf5f['id']),_0x5e00ce[_0x6338a4(0x19e)][_0x6338a4(0xe6)]({'name':_0x5ce5bf[_0x6338a4(0x190)],'action':'created','id':_0x32cf5f['id']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x19e)][_0x6338a4(0xf5)]++;}}catch(_0x3e8747){_0x5e00ce[_0x6338a4(0x19e)][_0x6338a4(0xe6)]({'name':_0x5ce5bf[_0x6338a4(0x190)],'action':_0x6338a4(0x1ca),'error':_0x3e8747[_0x6338a4(0xf7)]}),_0x5e00ce['counts'][_0x6338a4(0x19e)][_0x6338a4(0xf4)]++;}}for(const _0xca5067 of _0x354da2){try{const _0xfde4e=_0x3ea866[_0x6338a4(0x155)](_0xca5067['def'][_0x6338a4(0x190)]),_0x46aecd=yamlExperimentalKnowledgeBaseToApi(_0xca5067[_0x6338a4(0x104)],_0x3a02eb);if(_0xfde4e)await this[_0x6338a4(0xf9)][_0x6338a4(0x13e)](_0xfde4e['id'],_0x46aecd),_0x450151[_0x6338a4(0x117)](_0xca5067[_0x6338a4(0x104)][_0x6338a4(0x190)],_0xfde4e['id']),_0x5e00ce[_0x6338a4(0x111)][_0x6338a4(0xe6)]({'name':_0xca5067[_0x6338a4(0x104)][_0x6338a4(0x190)],'action':_0x6338a4(0x168),'id':_0xfde4e['id']}),_0x5e00ce['counts'][_0x6338a4(0x111)][_0x6338a4(0x168)]++;else{const _0x287417=await this[_0x6338a4(0xf9)][_0x6338a4(0xae)](_0x46aecd);_0x450151[_0x6338a4(0x117)](_0xca5067[_0x6338a4(0x104)][_0x6338a4(0x190)],_0x287417['id']),_0x5e00ce[_0x6338a4(0x111)][_0x6338a4(0xe6)]({'name':_0xca5067[_0x6338a4(0x104)][_0x6338a4(0x190)],'action':'created','id':_0x287417['id']}),_0x5e00ce['counts'][_0x6338a4(0x111)][_0x6338a4(0xf5)]++;}}catch(_0x22bc26){_0x5e00ce[_0x6338a4(0x111)][_0x6338a4(0xe6)]({'name':_0xca5067['def'][_0x6338a4(0x190)],'action':_0x6338a4(0x1ca),'error':_0x22bc26[_0x6338a4(0xf7)]}),_0x5e00ce['counts'][_0x6338a4(0x111)]['errors']++;}}for(const _0x57c595 of _0x5ce436){try{const _0xc07d90=_0xe66018[_0x6338a4(0x155)](_0x57c595[_0x6338a4(0x104)][_0x6338a4(0x190)]),_0x43c670=yamlExperimentalArtifactToApi(_0x57c595[_0x6338a4(0x104)],_0x3a02eb);if(_0xc07d90)await this[_0x6338a4(0xf9)][_0x6338a4(0x142)](_0xc07d90['id'],_0x43c670),_0x2e0428[_0x6338a4(0x117)](_0x57c595[_0x6338a4(0x104)]['name'],_0xc07d90['id']),_0x5e00ce[_0x6338a4(0x1c7)][_0x6338a4(0xe6)]({'name':_0x57c595[_0x6338a4(0x104)][_0x6338a4(0x190)],'action':'updated','id':_0xc07d90['id']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x1c7)][_0x6338a4(0x168)]++;else{const _0x5a37eb=await this[_0x6338a4(0xf9)][_0x6338a4(0x162)](_0x43c670);_0x2e0428['set'](_0x57c595[_0x6338a4(0x104)][_0x6338a4(0x190)],_0x5a37eb['id']),_0x5e00ce['experimentalArtifacts']['push']({'name':_0x57c595[_0x6338a4(0x104)][_0x6338a4(0x190)],'action':_0x6338a4(0xf5),'id':_0x5a37eb['id']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x1c7)][_0x6338a4(0xf5)]++;}}catch(_0x33a863){_0x5e00ce[_0x6338a4(0x1c7)][_0x6338a4(0xe6)]({'name':_0x57c595[_0x6338a4(0x104)][_0x6338a4(0x190)],'action':_0x6338a4(0x1ca),'error':_0x33a863['message']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x1c7)][_0x6338a4(0xf4)]++;}}for(const _0x2aa0d3 of _0x876879){_0xd02add=[];try{const _0x5880a1=_0x1e66f6[_0x6338a4(0x155)](_0x2aa0d3['yaml'][_0x6338a4(0x190)]),_0x1c70ae=await agentDefToRequest(_0x2aa0d3[_0x6338a4(0xd8)],_0x2aa0d3[_0x6338a4(0x11b)],_0x2aa0d3['starterMessage'],_0x69359c);if(_0x5880a1)await this['client'][_0x6338a4(0xda)](_0x5880a1['id'],_0x1c70ae),_0x5de630[_0x6338a4(0x117)](_0x2aa0d3['yaml'][_0x6338a4(0x190)],_0x5880a1['id']),_0x5e00ce[_0x6338a4(0x18f)][_0x6338a4(0xe6)]({'agentName':_0x2aa0d3[_0x6338a4(0xd8)]['name'],'action':_0x6338a4(0x168),'agentId':_0x5880a1['id'],'warnings':_0xd02add[_0x6338a4(0x15b)]>0x0?_0xd02add:undefined}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x18f)]['updated']++;else{const _0x158081=await this['client'][_0x6338a4(0x171)](_0x1c70ae);_0x5de630[_0x6338a4(0x117)](_0x2aa0d3[_0x6338a4(0xd8)][_0x6338a4(0x190)],_0x158081['id']),_0x5e00ce['agents']['push']({'agentName':_0x2aa0d3[_0x6338a4(0xd8)][_0x6338a4(0x190)],'action':_0x6338a4(0xf5),'agentId':_0x158081['id'],'warnings':_0xd02add[_0x6338a4(0x15b)]>0x0?_0xd02add:undefined}),_0x5e00ce[_0x6338a4(0x191)]['agents']['created']++;}}catch(_0x5e6463){_0x5e00ce[_0x6338a4(0x18f)][_0x6338a4(0xe6)]({'agentName':_0x2aa0d3['yaml'][_0x6338a4(0x190)],'action':_0x6338a4(0x1ca),'error':_0x5e6463[_0x6338a4(0xf7)],'warnings':_0xd02add[_0x6338a4(0x15b)]>0x0?_0xd02add:undefined}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x18f)][_0x6338a4(0xf4)]++;}}for(const _0xdbb130 of _0x2ba451){try{const _0x4db737=_0x5c8488[_0x6338a4(0x155)](_0xdbb130[_0x6338a4(0xd8)][_0x6338a4(0x190)]),_0x19a0b7=await yamlPromptToApi(_0xdbb130[_0x6338a4(0xd8)],_0x3a02eb,_0x69359c);if(!_0x19a0b7){_0x5e00ce[_0x6338a4(0x13d)][_0x6338a4(0xe6)]({'name':_0xdbb130[_0x6338a4(0xd8)][_0x6338a4(0x190)],'action':'error','error':'Agent\x20reference\x20not\x20found'}),_0x5e00ce['counts'][_0x6338a4(0x13d)]['errors']++;continue;}if(_0x4db737)await this['client'][_0x6338a4(0x1b7)](_0x4db737['id'],_0x19a0b7),_0x415382[_0x6338a4(0x117)](_0xdbb130[_0x6338a4(0xd8)][_0x6338a4(0x190)],_0x4db737['id']),_0x5e00ce[_0x6338a4(0x13d)][_0x6338a4(0xe6)]({'name':_0xdbb130[_0x6338a4(0xd8)][_0x6338a4(0x190)],'action':_0x6338a4(0x168),'id':_0x4db737['id']}),_0x5e00ce['counts']['prompts'][_0x6338a4(0x168)]++;else{const _0x2a0ee9=await this['client'][_0x6338a4(0xb1)](_0x19a0b7);_0x415382[_0x6338a4(0x117)](_0xdbb130['yaml'][_0x6338a4(0x190)],_0x2a0ee9['id']),_0x5e00ce[_0x6338a4(0x13d)]['push']({'name':_0xdbb130['yaml'][_0x6338a4(0x190)],'action':'created','id':_0x2a0ee9['id']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x13d)][_0x6338a4(0xf5)]++;}}catch(_0x7c9b14){_0x5e00ce[_0x6338a4(0x13d)][_0x6338a4(0xe6)]({'name':_0xdbb130[_0x6338a4(0xd8)][_0x6338a4(0x190)],'action':'error','error':_0x7c9b14[_0x6338a4(0xf7)]}),_0x5e00ce['counts'][_0x6338a4(0x13d)][_0x6338a4(0xf4)]++;}}for(const _0x501fe8 of _0x8c7048){try{const _0x16f0fc=_0x30d6a3[_0x6338a4(0x155)](_0x501fe8[_0x6338a4(0xd8)][_0x6338a4(0x11e)]),_0x53033c=await yamlIntegrationToApi(_0x501fe8[_0x6338a4(0xd8)],_0x3a02eb,_0x69359c);if(_0x16f0fc){await this[_0x6338a4(0xf9)]['deleteIntegration'](_0x16f0fc['id']);const _0x40515b=await this[_0x6338a4(0xf9)][_0x6338a4(0x122)](_0x53033c);_0x5e00ce[_0x6338a4(0xe1)]['push']({'name':_0x501fe8['yaml'][_0x6338a4(0x11e)],'action':_0x6338a4(0x168),'id':_0x40515b['id']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0xe1)][_0x6338a4(0x168)]++;}else{const _0x5cc85d=await this[_0x6338a4(0xf9)]['createIntegration'](_0x53033c);_0x5e00ce['integrations'][_0x6338a4(0xe6)]({'name':_0x501fe8['yaml'][_0x6338a4(0x11e)],'action':_0x6338a4(0xf5),'id':_0x5cc85d['id']}),_0x5e00ce[_0x6338a4(0x191)]['integrations'][_0x6338a4(0xf5)]++;}}catch(_0x49abf5){_0x5e00ce['integrations']['push']({'name':_0x501fe8[_0x6338a4(0xd8)][_0x6338a4(0x11e)],'action':'error','error':_0x49abf5[_0x6338a4(0xf7)]}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0xe1)][_0x6338a4(0xf4)]++;}}for(const _0xf4e4b2 of _0x7387c0){try{const _0x49575a=_0x186053[_0x6338a4(0x155)](_0xf4e4b2[_0x6338a4(0xd8)][_0x6338a4(0x190)]),_0x46bd4e=await yamlFormInterfaceToApi(_0xf4e4b2['yaml'],_0x3a02eb,_0x69359c);if(!_0x46bd4e){_0x5e00ce['formInterfaces'][_0x6338a4(0xe6)]({'name':_0xf4e4b2['yaml']['name'],'action':_0x6338a4(0x1ca),'error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x185)][_0x6338a4(0xf4)]++;continue;}if(_0x49575a){const _0x3c6a9d=await this[_0x6338a4(0xf9)][_0x6338a4(0x12b)](_0x49575a['id'],_0x46bd4e);_0x5e00ce[_0x6338a4(0x185)]['push']({'name':_0xf4e4b2['yaml']['name'],'action':_0x6338a4(0x168),'id':_0x3c6a9d['id']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x185)][_0x6338a4(0x168)]++;}else{const _0x5ee481=await this[_0x6338a4(0xf9)]['createFormInterface'](_0x46bd4e);_0x5e00ce[_0x6338a4(0x185)][_0x6338a4(0xe6)]({'name':_0xf4e4b2[_0x6338a4(0xd8)][_0x6338a4(0x190)],'action':_0x6338a4(0xf5),'id':_0x5ee481['id']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x185)][_0x6338a4(0xf5)]++;}}catch(_0x4ca2c6){_0x5e00ce['formInterfaces'][_0x6338a4(0xe6)]({'name':_0xf4e4b2[_0x6338a4(0xd8)]['name'],'action':_0x6338a4(0x1ca),'error':_0x4ca2c6[_0x6338a4(0xf7)]}),_0x5e00ce['counts']['formInterfaces'][_0x6338a4(0xf4)]++;}}for(const _0x2e8e30 of _0x1acbef){try{const _0x2dd383=_0x5185dc[_0x6338a4(0x155)](_0x2e8e30[_0x6338a4(0xd8)][_0x6338a4(0x190)]),_0x20d7c4=await yamlChatInterfaceToApi(_0x2e8e30['yaml'],_0x3a02eb,_0x69359c);if(_0x2dd383){const _0x3e2d05=await this[_0x6338a4(0xf9)][_0x6338a4(0x152)](_0x2dd383['id'],_0x20d7c4);_0x5e00ce[_0x6338a4(0x1c0)]['push']({'name':_0x2e8e30['yaml'][_0x6338a4(0x190)],'action':_0x6338a4(0x168),'id':_0x3e2d05['id']}),_0x5e00ce[_0x6338a4(0x191)][_0x6338a4(0x1c0)][_0x6338a4(0x168)]++;}else{const _0x3cea57=await this['client'][_0x6338a4(0xac)](_0x20d7c4);_0x5e00ce[_0x6338a4(0x1c0)]['push']({'name':_0x2e8e30[_0x6338a4(0xd8)]['name'],'action':_0x6338a4(0xf5),'id':_0x3cea57['id']}),_0x5e00ce['counts'][_0x6338a4(0x1c0)][_0x6338a4(0xf5)]++;}}catch(_0x4da812){_0x5e00ce[_0x6338a4(0x1c0)][_0x6338a4(0xe6)]({'name':_0x2e8e30[_0x6338a4(0xd8)][_0x6338a4(0x190)],'action':_0x6338a4(0x1ca),'error':_0x4da812[_0x6338a4(0xf7)]}),_0x5e00ce[_0x6338a4(0x191)]['chatInterfaces']['errors']++;}}return _0x5e00ce;}async[a133_0x14e51b(0x100)](_0x33cfed,_0x518c93,_0x4d96b3,_0x45c8fc){const _0xae0b9f=a133_0x14e51b,{projectId:_0x219243,project:_0x2e5d32}=await this[_0xae0b9f(0x134)](_0x33cfed),_0x341796=_0x2e5d32['attributes'][_0xae0b9f(0x190)],_0x440917=await this[_0xae0b9f(0xf9)][_0xae0b9f(0x1ab)](_0x219243),_0x279d15=_0x440917[_0xae0b9f(0xcc)](_0x1a1565=>_0x1a1565['attributes']['name']===_0x518c93);if(!_0x279d15)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],'Agent\x20not\x20found:\x20'+_0x518c93,undefined,{'helpText':'Available\x20agents:\x20'+_0x440917['map'](_0xdc850f=>_0xdc850f['attributes'][_0xae0b9f(0x190)])[_0xae0b9f(0xa1)](',\x20')});let _0x162fd4;if(_0x4d96b3)_0x162fd4=_0x4d96b3;else{const _0x547ac4=a133_0x59991e[_0xae0b9f(0xa1)](process['cwd'](),_0xae0b9f(0x18f)),_0x5481f5=getSanitizedPathWithMigration(_0x547ac4,_0x341796);_0x5481f5[_0xae0b9f(0x108)]&&this[_0xae0b9f(0xeb)][_0xae0b9f(0x187)](_0xae0b9f(0x15d)+a133_0x59991e[_0xae0b9f(0xc3)](_0x5481f5[_0xae0b9f(0x124)])+_0xae0b9f(0xb8)+a133_0x59991e[_0xae0b9f(0xc3)](_0x5481f5['path'])),_0x162fd4=_0x5481f5[_0xae0b9f(0xaf)];}const _0x1d97f6=getSanitizedPathWithMigration(_0x162fd4,_0x518c93);_0x1d97f6[_0xae0b9f(0x108)]&&this[_0xae0b9f(0xeb)][_0xae0b9f(0x187)](_0xae0b9f(0x1cb)+a133_0x59991e[_0xae0b9f(0xc3)](_0x1d97f6[_0xae0b9f(0x124)])+_0xae0b9f(0xb8)+a133_0x59991e[_0xae0b9f(0xc3)](_0x1d97f6[_0xae0b9f(0xaf)]));const _0x4b548a=_0x1d97f6['path'],_0x56ad6c=new Map(),_0x28045a=new Map(),_0x3c91ab=await this[_0xae0b9f(0xf9)][_0xae0b9f(0x103)](_0x219243),_0x37ef22=await this['client'][_0xae0b9f(0xb5)](_0x219243),_0x45b386=await safeListOrEmpty(()=>this[_0xae0b9f(0xf9)]['listExperimentalKnowledgeBases'](_0x219243)),_0x1fe27a=new Map(),_0x54408c=new Map();for(const _0x1f7a10 of _0x3c91ab){_0x56ad6c[_0xae0b9f(0x117)](_0x1f7a10['id'],_0x1f7a10[_0xae0b9f(0x159)]['name']);}for(const _0x29bbcd of _0x37ef22){_0x1fe27a[_0xae0b9f(0x117)](_0x29bbcd['id'],_0x29bbcd[_0xae0b9f(0x159)][_0xae0b9f(0x190)]);}for(const _0x7f170a of _0x45b386){_0x54408c[_0xae0b9f(0x117)](_0x7f170a['id'],_0x7f170a[_0xae0b9f(0x159)][_0xae0b9f(0x190)]);}for(const _0x543316 of _0x440917){_0x28045a[_0xae0b9f(0x117)](_0x543316['id'],_0x543316['attributes'][_0xae0b9f(0x190)]);}const _0x211ed3={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x56ad6c,'TextKnowledgeBase':_0x1fe27a,'Agent':_0x28045a,'ExperimentalKnowledgeBase':_0x54408c}),'resolvePromptName':async()=>undefined,'onWarning':_0x15692b=>this[_0xae0b9f(0xeb)]['warn'](_0x15692b)},_0x28f50f=a133_0x59991e['join'](_0x4b548a,_0xae0b9f(0x118)),_0x11e72f=a133_0x59991e[_0xae0b9f(0xa1)](_0x4b548a,_0xae0b9f(0x180)),_0x40f366=a133_0x59991e['join'](_0x4b548a,_0xae0b9f(0xab)),_0x4e7213=!a133_0x496aed['existsSync'](_0x11e72f);if(_0x45c8fc?.[_0xae0b9f(0x1a5)])return{'agentName':_0x518c93,'outputPath':_0x4b548a,'isNew':_0x4e7213,'hasChanges':!![]};a133_0x496aed[_0xae0b9f(0xa2)](_0x162fd4,{'recursive':!![]}),a133_0x496aed[_0xae0b9f(0xa2)](_0x4b548a,{'recursive':!![]});const _0x32194c=a133_0x59991e[_0xae0b9f(0xa1)](_0x162fd4,'tdx.json');!a133_0x496aed[_0xae0b9f(0xe3)](_0x32194c)&&a133_0x496aed[_0xae0b9f(0xdc)](_0x32194c,createAgentConfigContent(_0x33cfed));const {yaml:_0xe3297f,systemPrompt:_0x56be7,starterMessage:_0x351c25}=await agentResponseToDef(_0x279d15,_0x211ed3);let _0x23ab81=_0x4e7213;if(!_0x4e7213){const _0x1b8697=a133_0x496aed['existsSync'](_0x28f50f)?a133_0x496aed[_0xae0b9f(0x131)](_0x28f50f,'utf-8'):'',_0x2acc47=a133_0x496aed[_0xae0b9f(0x131)](_0x11e72f,_0xae0b9f(0xf1));_0x23ab81=_0x1b8697!==_0x56be7||_0x2acc47!==toAgentYamlString(_0xe3297f);}a133_0x496aed['writeFileSync'](_0x28f50f,_0x56be7),a133_0x496aed[_0xae0b9f(0xdc)](_0x11e72f,toAgentYamlString(_0xe3297f));if(_0x351c25&&_0x351c25[_0xae0b9f(0x1a1)]('\x0a'))a133_0x496aed[_0xae0b9f(0xdc)](_0x40f366,_0x351c25);else a133_0x496aed[_0xae0b9f(0xe3)](_0x40f366)&&a133_0x496aed[_0xae0b9f(0xd3)](_0x40f366);return{'agentName':_0x518c93,'outputPath':_0x4b548a,'isNew':_0x4e7213,'hasChanges':_0x23ab81};}async[a133_0x14e51b(0x12f)](_0x1d8314,_0x540b26){const _0x3565d2=a133_0x14e51b;let _0x551d14;isAgentYamlPath(_0x1d8314)?_0x551d14=getAgentDirFromYamlPath(_0x1d8314):_0x551d14=_0x1d8314;const {config:_0x5ea75c}=findAgentConfig(_0x551d14),_0x530bcc=await this[_0x3565d2(0x17e)](_0x5ea75c[_0x3565d2(0x10c)]),_0x3ff802=a133_0x59991e['join'](_0x551d14,_0x3565d2(0x180)),_0x5be6c2=a133_0x59991e[_0x3565d2(0xa1)](_0x551d14,_0x3565d2(0x118)),_0x15664b=a133_0x59991e[_0x3565d2(0xa1)](_0x551d14,_0x3565d2(0xab));if(!a133_0x496aed['existsSync'](_0x3ff802))throw new SDKError(ErrorCode['NOT_FOUND'],'agent.yml\x20not\x20found\x20in\x20'+_0x551d14,undefined,{'helpText':_0x3565d2(0xa4)});const _0x1ce5e4=parseAgentYaml(a133_0x496aed['readFileSync'](_0x3ff802,'utf-8'),_0x3ff802),_0x5edb3f=a133_0x496aed[_0x3565d2(0xe3)](_0x5be6c2)?a133_0x496aed[_0x3565d2(0x131)](_0x5be6c2,_0x3565d2(0xf1)):'',_0x3c8325=a133_0x496aed[_0x3565d2(0xe3)](_0x15664b)?a133_0x496aed['readFileSync'](_0x15664b,'utf-8'):_0x1ce5e4[_0x3565d2(0x14e)];if(_0x540b26?.[_0x3565d2(0x1a5)])return{'agentName':_0x1ce5e4[_0x3565d2(0x190)],'action':'created','projectId':_0x530bcc};const _0x12bcb1=await this[_0x3565d2(0xf9)]['listAgentsFull'](_0x530bcc),_0x569ecd=await fetchAllToolTargetMaps((_0x27a2dd,_0x58e05a)=>this[_0x3565d2(0xf9)][_0x3565d2(0x11d)](_0x27a2dd,_0x58e05a),_0x530bcc),_0x483349=new Map();for(const _0x24381c of _0x12bcb1){_0x483349[_0x3565d2(0x117)](_0x24381c['attributes']['name'],_0x24381c['id']);}const _0x30fc1c=[],_0x3b0c19={'projectId':_0x530bcc,'resolveToolTargetId':buildIdResolver({..._0x569ecd['nameToId'],'Agent':_0x483349}),'resolvePromptId':async()=>undefined,'onWarning':_0x1fdf8f=>{const _0x43e378=_0x3565d2;this[_0x43e378(0xeb)][_0x43e378(0x1b0)](_0x1fdf8f),_0x30fc1c[_0x43e378(0xe6)](_0x1fdf8f);}};try{const _0x255d1b=_0x12bcb1[_0x3565d2(0xcc)](_0x5cbdea=>_0x5cbdea[_0x3565d2(0x159)][_0x3565d2(0x190)]===_0x1ce5e4['name']),_0x4b5318=await agentDefToRequest(_0x1ce5e4,_0x5edb3f,_0x3c8325,_0x3b0c19);if(_0x255d1b)return await this[_0x3565d2(0xf9)][_0x3565d2(0xda)](_0x255d1b['id'],_0x4b5318),{'agentName':_0x1ce5e4[_0x3565d2(0x190)],'action':_0x3565d2(0x168),'projectId':_0x530bcc,'agentId':_0x255d1b['id'],'warnings':_0x30fc1c['length']>0x0?_0x30fc1c:undefined};else{const _0x4b54f9=await this['client'][_0x3565d2(0x171)](_0x4b5318);return{'agentName':_0x1ce5e4[_0x3565d2(0x190)],'action':'created','projectId':_0x530bcc,'agentId':_0x4b54f9['id'],'warnings':_0x30fc1c[_0x3565d2(0x15b)]>0x0?_0x30fc1c:undefined};}}catch(_0x2a339b){return{'agentName':_0x1ce5e4[_0x3565d2(0x190)],'action':_0x3565d2(0x1ca),'projectId':_0x530bcc,'error':_0x2a339b[_0x3565d2(0xf7)],'warnings':_0x30fc1c['length']>0x0?_0x30fc1c:undefined};}}async[a133_0x14e51b(0x174)](_0x7a191b,_0x3ba646,_0x5dff02){const _0x30d272=a133_0x14e51b,_0x59d7fd=a133_0x496aed[_0x30d272(0xe3)](_0x7a191b)&&a133_0x496aed[_0x30d272(0xe3)](a133_0x59991e[_0x30d272(0xa1)](_0x7a191b,'tdx.json'));let _0x35b7f2;const _0x296cdf=[],_0xef634c=[],_0x5ec02f=[],_0x477d3c=[],_0x470dab=[],_0x579a4f=[],_0x51fa47=[],_0x3bdb20=[],_0x8598c=[];if(_0x59d7fd){const _0x438855=loadAgentConfig(a133_0x59991e['join'](_0x7a191b,_0x30d272(0xf8)));_0x35b7f2=_0x438855['llm_project'];const _0x1caec0=a133_0x496aed['readdirSync'](_0x7a191b,{'withFileTypes':!![]});for(const _0x514c39 of _0x1caec0){if(!_0x514c39[_0x30d272(0x18a)]())continue;if([_0x30d272(0xbf),_0x30d272(0x136),_0x30d272(0x1af),_0x30d272(0x13d),_0x30d272(0xe1),_0x30d272(0xd1),_0x30d272(0xec)][_0x30d272(0x1a1)](_0x514c39['name']))continue;const _0x28f582=a133_0x59991e[_0x30d272(0xa1)](_0x7a191b,_0x514c39['name']);if(isAgentDir(_0x28f582)){const _0x535c1d=a133_0x59991e['join'](_0x28f582,_0x30d272(0x180)),_0x448236=a133_0x59991e[_0x30d272(0xa1)](_0x28f582,_0x30d272(0x118)),_0x18deba=a133_0x59991e[_0x30d272(0xa1)](_0x28f582,_0x30d272(0xab)),_0x52d1ee=parseAgentYaml(a133_0x496aed[_0x30d272(0x131)](_0x535c1d,_0x30d272(0xf1)),_0x535c1d),_0x1334bc=a133_0x496aed['existsSync'](_0x448236)?a133_0x496aed[_0x30d272(0x131)](_0x448236,_0x30d272(0xf1)):'',_0x1d7bb9=a133_0x496aed['existsSync'](_0x18deba)?a133_0x496aed[_0x30d272(0x131)](_0x18deba,_0x30d272(0xf1)):_0x52d1ee['starter_message'];_0x296cdf[_0x30d272(0xe6)]({'name':_0x52d1ee['name'],'dir':_0x28f582,'yaml':_0x52d1ee,'systemPrompt':_0x1334bc,'starterMessage':_0x1d7bb9});}}const _0x3cfb9f=getKnowledgeBasesDir(_0x7a191b);if(a133_0x496aed[_0x30d272(0xe3)](_0x3cfb9f)){const _0x11802e=a133_0x496aed[_0x30d272(0x1b2)](_0x3cfb9f);for(const _0x886002 of _0x11802e){const _0xac5192=a133_0x59991e[_0x30d272(0xa1)](_0x3cfb9f,_0x886002);if(_0x886002['endsWith'](_0x30d272(0x14b))){const _0x4d8e79=parseKnowledgeBaseYaml(a133_0x496aed[_0x30d272(0x131)](_0xac5192,_0x30d272(0xf1)),_0xac5192);_0xef634c[_0x30d272(0xe6)]({'name':_0x4d8e79[_0x30d272(0x190)],'path':_0xac5192,'yaml':_0x4d8e79});}else{if(_0x886002['endsWith'](_0x30d272(0x1a3))){const _0x1a5b0b=a133_0x496aed['readFileSync'](_0xac5192,_0x30d272(0xf1)),{name:_0x1dd872,text:_0x127c66}=parseTextKnowledgeBaseMd(_0x1a5b0b,_0x886002);_0x5ec02f['push']({'name':_0x1dd872,'path':_0xac5192,'text':_0x127c66});}}}}const _0x2edc52=getPromptsDir(_0x7a191b);if(a133_0x496aed[_0x30d272(0xe3)](_0x2edc52)){const _0x108c53=a133_0x496aed['readdirSync'](_0x2edc52)[_0x30d272(0x12d)](_0x3e0ec9=>_0x3e0ec9[_0x30d272(0x143)](_0x30d272(0x14b)));for(const _0x170e33 of _0x108c53){const _0x2e823c=a133_0x59991e[_0x30d272(0xa1)](_0x2edc52,_0x170e33),_0x3cdb01=parsePromptYaml(a133_0x496aed[_0x30d272(0x131)](_0x2e823c,_0x30d272(0xf1)),_0x2e823c);_0x477d3c[_0x30d272(0xe6)]({'name':_0x3cdb01['name'],'path':_0x2e823c,'yaml':_0x3cdb01});}}const _0x184d5d=getIntegrationsDir(_0x7a191b);if(a133_0x496aed[_0x30d272(0xe3)](_0x184d5d)){const _0x30cc82=a133_0x496aed['readdirSync'](_0x184d5d)[_0x30d272(0x12d)](_0x20ea21=>_0x20ea21[_0x30d272(0x143)](_0x30d272(0x14b)));for(const _0x566fa1 of _0x30cc82){const _0x568de1=a133_0x59991e['join'](_0x184d5d,_0x566fa1),_0x2cb4db=parseIntegrationYaml(a133_0x496aed['readFileSync'](_0x568de1,_0x30d272(0xf1)),_0x568de1);SAFE_INTEGRATION_TYPES[_0x30d272(0x1a1)](_0x2cb4db['service_type'][_0x30d272(0xbc)]())?_0x470dab[_0x30d272(0xe6)]({'name':_0x2cb4db['name'],'path':_0x568de1,'yaml':_0x2cb4db}):this[_0x30d272(0xeb)][_0x30d272(0x1b0)](_0x30d272(0x1bd)+_0x2cb4db[_0x30d272(0x190)]+_0x30d272(0x1c4)+_0x2cb4db['service_type']+_0x30d272(0x157)+(_0x30d272(0x194)+SAFE_INTEGRATION_TYPES[_0x30d272(0xa1)](',\x20')+_0x30d272(0x10b)));}}const _0x3fdd2b=getExperimentalKnowledgeBasesDir(_0x7a191b);if(a133_0x496aed[_0x30d272(0xe3)](_0x3fdd2b)){const _0x9c03a2=a133_0x496aed['readdirSync'](_0x3fdd2b,{'withFileTypes':!![]});for(const _0x1acaf3 of _0x9c03a2){if(!_0x1acaf3[_0x30d272(0x18a)]())continue;const _0x135ce2=a133_0x59991e[_0x30d272(0xa1)](_0x3fdd2b,_0x1acaf3['name']),_0x2e860e=a133_0x59991e['join'](_0x135ce2,_0x1acaf3[_0x30d272(0x190)]+_0x30d272(0x14b));if(a133_0x496aed['existsSync'](_0x2e860e)){const _0x2dddc5=parseExperimentalKnowledgeBaseYaml(a133_0x496aed['readFileSync'](_0x2e860e,_0x30d272(0xf1)),_0x2e860e),_0x2f8f83=a133_0x59991e['join'](_0x135ce2,_0x30d272(0xed)),_0x28785e=[];if(a133_0x496aed[_0x30d272(0xe3)](_0x2f8f83)){const _0x5c9de2=a133_0x496aed[_0x30d272(0x1b2)](_0x2f8f83,{'withFileTypes':!![]});for(const _0x1ae8ac of _0x5c9de2){if(!_0x1ae8ac[_0x30d272(0x18a)]())continue;const _0x53d61f=a133_0x59991e[_0x30d272(0xa1)](_0x2f8f83,_0x1ae8ac[_0x30d272(0x190)]),_0x34b584=a133_0x59991e[_0x30d272(0xa1)](_0x53d61f,'code.js'),_0x59b3e1=a133_0x59991e[_0x30d272(0xa1)](_0x53d61f,_0x30d272(0xb4));if(a133_0x496aed[_0x30d272(0xe3)](_0x34b584)&&a133_0x496aed['existsSync'](_0x59b3e1)){const _0x4344ca=a133_0x496aed['readFileSync'](_0x34b584,_0x30d272(0xf1)),_0x4aef62=a133_0x496aed[_0x30d272(0x131)](_0x59b3e1,_0x30d272(0xf1));_0x28785e[_0x30d272(0xe6)]({'name':_0x1ae8ac[_0x30d272(0x190)],'code':_0x4344ca,'json_schema':_0x4aef62});}}}const _0x1ef483={..._0x2dddc5,'functions':_0x28785e};_0x579a4f['push']({'name':_0x2dddc5['name'],'path':_0x135ce2,'def':_0x1ef483});}}}const _0x3cff3f=getExperimentalArtifactsDir(_0x7a191b);if(a133_0x496aed[_0x30d272(0xe3)](_0x3cff3f)){const _0x3b5210=a133_0x496aed[_0x30d272(0x1b2)](_0x3cff3f,{'withFileTypes':!![]});for(const _0x14b659 of _0x3b5210){if(!_0x14b659[_0x30d272(0x18a)]())continue;const _0x4761bf=a133_0x59991e['join'](_0x3cff3f,_0x14b659['name']),_0x2a7e52=a133_0x59991e['join'](_0x4761bf,_0x14b659[_0x30d272(0x190)]+'.yml');if(a133_0x496aed[_0x30d272(0xe3)](_0x2a7e52)){const _0x14aa14=parseExperimentalArtifactYaml(a133_0x496aed['readFileSync'](_0x2a7e52,'utf-8'),_0x2a7e52),_0x211027=a133_0x59991e[_0x30d272(0xa1)](_0x4761bf,'code.js'),_0x32ff77=a133_0x496aed['existsSync'](_0x211027)?a133_0x496aed[_0x30d272(0x131)](_0x211027,_0x30d272(0xf1)):'',_0x42bfcc=a133_0x59991e[_0x30d272(0xa1)](_0x4761bf,_0x30d272(0x14d)),_0x294c7d=[];if(a133_0x496aed['existsSync'](_0x42bfcc)){const _0x4a5c12=a133_0x496aed[_0x30d272(0x1b2)](_0x42bfcc);for(const _0x3eebef of _0x4a5c12){const _0x142759=a133_0x59991e['join'](_0x42bfcc,_0x3eebef);if(a133_0x496aed[_0x30d272(0x11a)](_0x142759)[_0x30d272(0x173)]()){const _0x5a0be4=a133_0x496aed[_0x30d272(0x131)](_0x142759,_0x30d272(0xf1));_0x294c7d['push']({'file_name':_0x3eebef,'text_content':_0x5a0be4});}}}const _0x1155ae={..._0x14aa14,'code':_0x32ff77,'files':_0x294c7d};_0x51fa47[_0x30d272(0xe6)]({'name':_0x14aa14['name'],'path':_0x4761bf,'def':_0x1155ae});}}}const _0x442c2a=getFormInterfacesDir(_0x7a191b);if(a133_0x496aed['existsSync'](_0x442c2a)){const _0x396e87=a133_0x496aed['readdirSync'](_0x442c2a)[_0x30d272(0x12d)](_0x36f7bb=>_0x36f7bb[_0x30d272(0x143)](_0x30d272(0x14b)));for(const _0x5c805c of _0x396e87){const _0xb53936=a133_0x59991e[_0x30d272(0xa1)](_0x442c2a,_0x5c805c),_0x11ab1f=parseFormInterfaceYaml(a133_0x496aed[_0x30d272(0x131)](_0xb53936,_0x30d272(0xf1)),_0xb53936);_0x3bdb20[_0x30d272(0xe6)]({'name':_0x11ab1f['name'],'path':_0xb53936,'yaml':_0x11ab1f});}}const _0x26c30d=getChatInterfacesDir(_0x7a191b);if(a133_0x496aed[_0x30d272(0xe3)](_0x26c30d)){const _0x335d1e=a133_0x496aed[_0x30d272(0x1b2)](_0x26c30d)['filter'](_0x5cdf82=>_0x5cdf82['endsWith'](_0x30d272(0x14b)));for(const _0xdbc1f7 of _0x335d1e){const _0x4f0593=a133_0x59991e['join'](_0x26c30d,_0xdbc1f7),_0x58d8fa=parseChatInterfaceYaml(a133_0x496aed[_0x30d272(0x131)](_0x4f0593,_0x30d272(0xf1)),_0x4f0593);_0x8598c[_0x30d272(0xe6)]({'name':_0x58d8fa[_0x30d272(0x190)],'path':_0x4f0593,'yaml':_0x58d8fa});}}}else{const _0x1e16fb=await this[_0x30d272(0x17e)](_0x7a191b),_0x5c097c=await this['client'][_0x30d272(0xde)](_0x1e16fb);_0x35b7f2=_0x5c097c[_0x30d272(0x159)][_0x30d272(0x190)];const _0x233f1a=await this[_0x30d272(0xf9)][_0x30d272(0x1ab)](_0x1e16fb),_0x42e592=await this[_0x30d272(0xf9)][_0x30d272(0x103)](_0x1e16fb),_0x59122f=await this[_0x30d272(0xf9)][_0x30d272(0xb5)](_0x1e16fb),_0x3adacd=await this[_0x30d272(0xf9)][_0x30d272(0x158)](_0x1e16fb),_0x185b35=await this[_0x30d272(0xf9)][_0x30d272(0x10a)](_0x1e16fb),_0x1e1107=await safeListOrEmpty(()=>this['client']['listExperimentalKnowledgeBases'](_0x1e16fb)),_0x52f1ed=await safeListOrEmpty(()=>this[_0x30d272(0xf9)][_0x30d272(0xf2)](_0x1e16fb)),_0x1896bf=new Map(),_0x165e2c=new Map(),_0x38897a=new Map(),_0x4ceb2a=new Map(),_0x5668ce=new Map(),_0x1fc74c=new Map();for(const _0xee1414 of _0x42e592){_0x1896bf[_0x30d272(0x117)](_0xee1414['id'],_0xee1414[_0x30d272(0x159)][_0x30d272(0x190)]);}for(const _0x1675a9 of _0x59122f){_0x165e2c['set'](_0x1675a9['id'],_0x1675a9[_0x30d272(0x159)][_0x30d272(0x190)]);}for(const _0x3b3c07 of _0x233f1a){_0x38897a[_0x30d272(0x117)](_0x3b3c07['id'],_0x3b3c07['attributes'][_0x30d272(0x190)]);}for(const _0x282d52 of _0x3adacd){_0x4ceb2a[_0x30d272(0x117)](_0x282d52['id'],_0x282d52[_0x30d272(0x159)][_0x30d272(0x190)]);}for(const _0x2f2b2b of _0x1e1107){_0x5668ce[_0x30d272(0x117)](_0x2f2b2b['id'],_0x2f2b2b[_0x30d272(0x159)][_0x30d272(0x190)]);}for(const _0x2282ff of _0x52f1ed){_0x1fc74c[_0x30d272(0x117)](_0x2282ff['id'],_0x2282ff[_0x30d272(0x159)]['name']);}const _0x44f35f={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x1896bf,'TextKnowledgeBase':_0x165e2c,'Agent':_0x38897a,'ExperimentalKnowledgeBase':_0x5668ce}),'resolvePromptName':async _0x5b2c4a=>_0x4ceb2a['get'](_0x5b2c4a),'onWarning':_0xaf86af=>this[_0x30d272(0xeb)][_0x30d272(0x1b0)](_0xaf86af)};for(const _0x3af58a of _0x233f1a){const _0x1f20ae=await agentResponseToDef(_0x3af58a,_0x44f35f),{yaml:_0x27f6d0,systemPrompt:_0x555b60,starterMessage:_0xd706c9}=_0x1f20ae;_0x296cdf[_0x30d272(0xe6)]({'name':_0x27f6d0['name'],'dir':'','yaml':_0x27f6d0,'systemPrompt':_0x555b60,'starterMessage':_0xd706c9});}for(const _0x1e59ad of _0x42e592){const _0x416741=apiKnowledgeBaseToYaml(_0x1e59ad);_0xef634c[_0x30d272(0xe6)]({'name':_0x416741[_0x30d272(0x190)],'path':'','yaml':_0x416741});}for(const _0x30f246 of _0x59122f){_0x5ec02f[_0x30d272(0xe6)]({'name':_0x30f246['attributes'][_0x30d272(0x190)],'path':'','text':_0x30f246[_0x30d272(0x159)]['text']});}for(const _0x283cd6 of _0x3adacd){const _0x4d45a3=await apiPromptToYaml(_0x283cd6,_0x44f35f);_0x4d45a3&&_0x477d3c['push']({'name':_0x4d45a3[_0x30d272(0x190)],'path':'','yaml':_0x4d45a3});}for(const _0x2cf898 of _0x185b35){if(!_0x2cf898[_0x30d272(0x159)][_0x30d272(0xa6)]&&SAFE_INTEGRATION_TYPES[_0x30d272(0x1a1)](_0x2cf898[_0x30d272(0x159)][_0x30d272(0x161)]['toLowerCase']())){const _0x2735a4=await apiIntegrationToYaml(_0x2cf898,_0x44f35f);_0x470dab[_0x30d272(0xe6)]({'name':_0x2cf898[_0x30d272(0x159)]['serviceType'][_0x30d272(0xbc)](),'path':'','yaml':_0x2735a4});}}for(const _0x57398e of _0x1e1107){const _0x2e75aa=apiExperimentalKnowledgeBaseToYaml(_0x57398e);_0x579a4f[_0x30d272(0xe6)]({'name':_0x2e75aa[_0x30d272(0x190)],'path':'','def':_0x2e75aa});}for(const _0x409c87 of _0x52f1ed){const _0x1498ac=apiExperimentalArtifactToYaml(_0x409c87);_0x51fa47[_0x30d272(0xe6)]({'name':_0x1498ac[_0x30d272(0x190)],'path':'','def':_0x1498ac});}const _0x8cb0c5=await safeListOrEmpty(()=>this['client'][_0x30d272(0xd4)](_0x1e16fb));for(const _0x682937 of _0x8cb0c5){const _0x120bab=await apiFormInterfaceToYaml(_0x682937,_0x44f35f);_0x3bdb20[_0x30d272(0xe6)]({'name':_0x120bab[_0x30d272(0x190)],'path':'','yaml':_0x120bab});}const _0x106238=await safeListOrEmpty(()=>this[_0x30d272(0xf9)]['listChatInterfaces'](_0x1e16fb));for(const _0x2070f5 of _0x106238){if(_0x2070f5[_0x30d272(0x159)][_0x30d272(0xa6)])continue;const _0x1d0b74=await apiChatInterfaceToYaml(_0x2070f5,_0x44f35f);_0x8598c[_0x30d272(0xe6)]({'name':_0x1d0b74[_0x30d272(0x190)],'path':'','yaml':_0x1d0b74});}}const _0xe30565={'sourceProjectName':_0x35b7f2,'newProjectName':_0x3ba646,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'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},'formInterfaces':{'created':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'errors':0x0}}},_0x1c192c=await this[_0x30d272(0xf9)]['listProjects'](),_0x505782=_0x1c192c['find'](_0x448966=>_0x448966['attributes'][_0x30d272(0x190)]===_0x3ba646);if(_0x505782)throw new SDKError(ErrorCode[_0x30d272(0x175)],'Project\x20\x22'+_0x3ba646+_0x30d272(0x176),undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x5dff02?.[_0x30d272(0x1a5)])return _0xe30565[_0x30d272(0x191)][_0x30d272(0x18f)][_0x30d272(0xf5)]=_0x296cdf[_0x30d272(0x15b)],_0xe30565[_0x30d272(0x191)][_0x30d272(0x1ba)][_0x30d272(0xf5)]=_0xef634c[_0x30d272(0x15b)],_0xe30565[_0x30d272(0x191)]['textKnowledgeBases']['created']=_0x5ec02f[_0x30d272(0x15b)],_0xe30565[_0x30d272(0x191)][_0x30d272(0x111)][_0x30d272(0xf5)]=_0x579a4f['length'],_0xe30565[_0x30d272(0x191)]['experimentalArtifacts']['created']=_0x51fa47[_0x30d272(0x15b)],_0xe30565[_0x30d272(0x191)][_0x30d272(0x13d)][_0x30d272(0xf5)]=_0x477d3c[_0x30d272(0x15b)],_0xe30565[_0x30d272(0x191)][_0x30d272(0xe1)][_0x30d272(0xf5)]=_0x470dab[_0x30d272(0x15b)],_0xe30565;const _0x478f9d=await this[_0x30d272(0xf9)][_0x30d272(0x14a)]({'name':_0x3ba646}),_0x10ce89=_0x478f9d['id'];_0xe30565[_0x30d272(0x146)]=_0x10ce89;const _0x4f44d6=new Map(),_0x4905cb=new Map(),_0x17c9a6=new Map(),_0x4385a8=new Map(),_0x16d0eb=new Map(),_0x5c5702=new Map(),_0x193bae=new Map(),_0x430b68=new Map(),_0x335901=new Set(),_0x154663=new Set();for(const _0x42e071 of _0x296cdf){for(const _0x15a02b of _0x42e071[_0x30d272(0xd8)]['tools']||[]){if(_0x15a02b[_0x30d272(0xdb)]==='image_gen'&&_0x15a02b[_0x30d272(0xf0)]){const _0x154ea1=parseRef(_0x15a02b[_0x30d272(0xf0)]);if(_0x154ea1)_0x335901[_0x30d272(0x193)](_0x154ea1['name']);}else{if(_0x15a02b[_0x30d272(0xdb)]===_0x30d272(0x101)&&_0x15a02b[_0x30d272(0xf0)]){const _0x590d94=parseRef(_0x15a02b[_0x30d272(0xf0)]);if(_0x590d94)_0x154663[_0x30d272(0x193)](_0x590d94[_0x30d272(0x190)]);}}}}for(const _0x13bbe3 of _0x335901){try{const _0x1acf58=await this[_0x30d272(0xf9)][_0x30d272(0x16e)]({'projectId':_0x10ce89,'name':_0x13bbe3});_0x16d0eb[_0x30d272(0x117)](_0x13bbe3,_0x1acf58['id']),_0xe30565[_0x30d272(0xc9)]['push']({'name':_0x13bbe3,'action':_0x30d272(0xf5),'id':_0x1acf58['id']}),_0xe30565[_0x30d272(0x191)][_0x30d272(0xc9)][_0x30d272(0xf5)]++;}catch(_0x25eb26){_0xe30565[_0x30d272(0xc9)][_0x30d272(0xe6)]({'name':_0x13bbe3,'action':_0x30d272(0x1ca),'error':_0x25eb26[_0x30d272(0xf7)]}),_0xe30565[_0x30d272(0x191)][_0x30d272(0xc9)][_0x30d272(0xf4)]++;}}for(const _0xb7b4d1 of _0x154663){try{const _0x490013=await this['client'][_0x30d272(0xb0)]({'projectId':_0x10ce89,'name':_0xb7b4d1});_0x5c5702[_0x30d272(0x117)](_0xb7b4d1,_0x490013['id']),_0xe30565[_0x30d272(0x1a0)][_0x30d272(0xe6)]({'name':_0xb7b4d1,'action':_0x30d272(0xf5),'id':_0x490013['id']}),_0xe30565['counts']['webSearchTools'][_0x30d272(0xf5)]++;}catch(_0x3db841){_0xe30565[_0x30d272(0x1a0)][_0x30d272(0xe6)]({'name':_0xb7b4d1,'action':_0x30d272(0x1ca),'error':_0x3db841[_0x30d272(0xf7)]}),_0xe30565[_0x30d272(0x191)]['webSearchTools'][_0x30d272(0xf4)]++;}}const _0x3ec719=await fetchAllToolTargetMaps((_0x22c881,_0x4ee51f)=>this[_0x30d272(0xf9)][_0x30d272(0x11d)](_0x22c881,_0x4ee51f),_0x10ce89);let _0x24c38b=[];const _0x3af08b={'projectId':_0x10ce89,'resolveToolTargetId':buildIdResolver({..._0x3ec719['nameToId'],'KnowledgeBase':_0x4f44d6,'TextKnowledgeBase':_0x4905cb,'ExperimentalKnowledgeBase':_0x193bae,'Agent':_0x17c9a6,'WebSearchTool':_0x5c5702,'ImageGenerator':_0x16d0eb}),'resolvePromptId':async _0x355717=>_0x4385a8[_0x30d272(0x155)](_0x355717),'onWarning':_0x10b1c4=>{const _0x17a480=_0x30d272;this[_0x17a480(0xeb)]['warn'](_0x10b1c4),_0x24c38b['push'](_0x10b1c4);}};for(const _0x24b138 of _0xef634c){try{const _0x52f58d=yamlKnowledgeBaseToApi(_0x24b138['yaml'],_0x10ce89),_0x2c2c3e=await this['client'][_0x30d272(0x19c)](_0x52f58d);_0x4f44d6[_0x30d272(0x117)](_0x24b138['yaml']['name'],_0x2c2c3e['id']),_0xe30565[_0x30d272(0x1ba)][_0x30d272(0xe6)]({'name':_0x24b138[_0x30d272(0xd8)]['name'],'action':_0x30d272(0xf5),'id':_0x2c2c3e['id']}),_0xe30565[_0x30d272(0x191)]['knowledgeBases']['created']++;}catch(_0xa5064b){_0xe30565[_0x30d272(0x1ba)][_0x30d272(0xe6)]({'name':_0x24b138[_0x30d272(0xd8)][_0x30d272(0x190)],'action':_0x30d272(0x1ca),'error':_0xa5064b['message']}),_0xe30565[_0x30d272(0x191)]['knowledgeBases']['errors']++;}}for(const _0x1102ee of _0x5ec02f){try{const _0x58dd8b=yamlTextKnowledgeBaseToApi({'name':_0x1102ee[_0x30d272(0x190)],'text':_0x1102ee[_0x30d272(0xce)]},_0x10ce89),_0x545c41=await this[_0x30d272(0xf9)]['createTextKnowledgeBase'](_0x58dd8b);_0x4905cb[_0x30d272(0x117)](_0x1102ee[_0x30d272(0x190)],_0x545c41['id']),_0xe30565[_0x30d272(0x19e)][_0x30d272(0xe6)]({'name':_0x1102ee[_0x30d272(0x190)],'action':_0x30d272(0xf5),'id':_0x545c41['id']}),_0xe30565[_0x30d272(0x191)][_0x30d272(0x19e)][_0x30d272(0xf5)]++;}catch(_0x2c8dfc){_0xe30565['textKnowledgeBases'][_0x30d272(0xe6)]({'name':_0x1102ee[_0x30d272(0x190)],'action':_0x30d272(0x1ca),'error':_0x2c8dfc['message']}),_0xe30565[_0x30d272(0x191)]['textKnowledgeBases'][_0x30d272(0xf4)]++;}}for(const _0x7a286e of _0x51fa47){try{const _0x4b1bfe=yamlExperimentalArtifactToApi(_0x7a286e['def'],_0x10ce89),_0x4052c4=await this[_0x30d272(0xf9)][_0x30d272(0x162)](_0x4b1bfe);_0x430b68['set'](_0x7a286e[_0x30d272(0x104)][_0x30d272(0x190)],_0x4052c4['id']),_0xe30565[_0x30d272(0x1c7)][_0x30d272(0xe6)]({'name':_0x7a286e['def'][_0x30d272(0x190)],'action':_0x30d272(0xf5),'id':_0x4052c4['id']}),_0xe30565[_0x30d272(0x191)][_0x30d272(0x1c7)][_0x30d272(0xf5)]++;}catch(_0x20b4d2){_0xe30565[_0x30d272(0x1c7)]['push']({'name':_0x7a286e[_0x30d272(0x104)][_0x30d272(0x190)],'action':_0x30d272(0x1ca),'error':_0x20b4d2[_0x30d272(0xf7)]}),_0xe30565[_0x30d272(0x191)][_0x30d272(0x1c7)][_0x30d272(0xf4)]++;}}for(const _0x59f160 of _0x579a4f){try{const _0xb8ac5f=yamlExperimentalKnowledgeBaseToApi(_0x59f160[_0x30d272(0x104)],_0x10ce89),_0x578be7=await this[_0x30d272(0xf9)]['createExperimentalKnowledgeBase'](_0xb8ac5f);_0x193bae['set'](_0x59f160[_0x30d272(0x104)][_0x30d272(0x190)],_0x578be7['id']),_0xe30565['experimentalKnowledgeBases'][_0x30d272(0xe6)]({'name':_0x59f160['def'][_0x30d272(0x190)],'action':'created','id':_0x578be7['id']}),_0xe30565[_0x30d272(0x191)][_0x30d272(0x111)]['created']++;}catch(_0x148019){_0xe30565[_0x30d272(0x111)]['push']({'name':_0x59f160[_0x30d272(0x104)]['name'],'action':_0x30d272(0x1ca),'error':_0x148019[_0x30d272(0xf7)]}),_0xe30565[_0x30d272(0x191)][_0x30d272(0x111)]['errors']++;}}const _0x5873f9=[..._0x296cdf]['sort']((_0x57f39e,_0x5e0905)=>{const _0x3d3ccb=_0x30d272,_0x299b81=_0x57f39e[_0x3d3ccb(0xd8)][_0x3d3ccb(0x140)]?.['some'](_0x6a4332=>_0x6a4332[_0x3d3ccb(0xdb)]===_0x3d3ccb(0x164))??![],_0x33a3b4=_0x5e0905[_0x3d3ccb(0xd8)][_0x3d3ccb(0x140)]?.[_0x3d3ccb(0x125)](_0xcc07c5=>_0xcc07c5[_0x3d3ccb(0xdb)]==='agent')??![];if(_0x299b81&&!_0x33a3b4)return 0x1;if(!_0x299b81&&_0x33a3b4)return-0x1;return 0x0;});for(const _0xf328bb of _0x5873f9){_0x24c38b=[];try{const _0x17105a=_0xf328bb[_0x30d272(0xd8)]['tools']?.[_0x30d272(0x12d)](_0x2a5b37=>{const _0x3ad3b9=_0x30d272;if(_0x2a5b37['type']===_0x3ad3b9(0x164)&&_0x2a5b37['target']){const _0x179e25=parseRef(_0x2a5b37[_0x3ad3b9(0xf0)]);return _0x179e25?.[_0x3ad3b9(0x190)]===_0xf328bb[_0x3ad3b9(0xd8)][_0x3ad3b9(0x190)];}return![];})??[];if(_0x17105a[_0x30d272(0x15b)]>0x0){const _0xda1860=_0x30d272(0x1a4)+_0xf328bb[_0x30d272(0xd8)][_0x30d272(0x190)]+_0x30d272(0x19b)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this[_0x30d272(0xeb)]['warn'](_0xda1860),_0x24c38b[_0x30d272(0xe6)](_0xda1860);}const _0x4a3b24=await agentDefToRequest(_0xf328bb[_0x30d272(0xd8)],_0xf328bb[_0x30d272(0x11b)],_0xf328bb[_0x30d272(0xdd)],_0x3af08b),_0x166734=await this['client'][_0x30d272(0x171)](_0x4a3b24);_0x17c9a6[_0x30d272(0x117)](_0xf328bb[_0x30d272(0xd8)]['name'],_0x166734['id']),_0xe30565[_0x30d272(0x18f)][_0x30d272(0xe6)]({'agentName':_0xf328bb[_0x30d272(0xd8)][_0x30d272(0x190)],'action':_0x30d272(0xf5),'agentId':_0x166734['id'],'warnings':_0x24c38b[_0x30d272(0x15b)]>0x0?_0x24c38b:undefined}),_0xe30565[_0x30d272(0x191)][_0x30d272(0x18f)][_0x30d272(0xf5)]++;}catch(_0x51f3f2){_0xe30565[_0x30d272(0x18f)][_0x30d272(0xe6)]({'agentName':_0xf328bb[_0x30d272(0xd8)][_0x30d272(0x190)],'action':_0x30d272(0x1ca),'error':_0x51f3f2[_0x30d272(0xf7)],'warnings':_0x24c38b[_0x30d272(0x15b)]>0x0?_0x24c38b:undefined}),_0xe30565['counts'][_0x30d272(0x18f)][_0x30d272(0xf4)]++;}}for(const _0x289b07 of _0x477d3c){try{const _0xa96d18=await yamlPromptToApi(_0x289b07['yaml'],_0x10ce89,_0x3af08b);if(!_0xa96d18){_0xe30565['prompts'][_0x30d272(0xe6)]({'name':_0x289b07[_0x30d272(0xd8)][_0x30d272(0x190)],'action':_0x30d272(0x1ca),'error':_0x30d272(0x1bf)}),_0xe30565[_0x30d272(0x191)][_0x30d272(0x13d)]['errors']++;continue;}const _0x34c2a1=await this['client'][_0x30d272(0xb1)](_0xa96d18);_0x4385a8['set'](_0x289b07[_0x30d272(0xd8)][_0x30d272(0x190)],_0x34c2a1['id']),_0xe30565[_0x30d272(0x13d)][_0x30d272(0xe6)]({'name':_0x289b07[_0x30d272(0xd8)][_0x30d272(0x190)],'action':_0x30d272(0xf5),'id':_0x34c2a1['id']}),_0xe30565[_0x30d272(0x191)]['prompts'][_0x30d272(0xf5)]++;}catch(_0x5ca115){_0xe30565[_0x30d272(0x13d)]['push']({'name':_0x289b07[_0x30d272(0xd8)][_0x30d272(0x190)],'action':_0x30d272(0x1ca),'error':_0x5ca115[_0x30d272(0xf7)]}),_0xe30565[_0x30d272(0x191)][_0x30d272(0x13d)][_0x30d272(0xf4)]++;}}for(const _0x557eeb of _0x470dab){try{const _0x46237c=await yamlIntegrationToApi(_0x557eeb[_0x30d272(0xd8)],_0x10ce89,_0x3af08b),_0x3915a5=await this['client'][_0x30d272(0x122)](_0x46237c);_0xe30565[_0x30d272(0xe1)]['push']({'name':_0x557eeb['yaml'][_0x30d272(0x11e)],'action':_0x30d272(0xf5),'id':_0x3915a5['id']}),_0xe30565['counts'][_0x30d272(0xe1)][_0x30d272(0xf5)]++;}catch(_0x52863c){_0xe30565[_0x30d272(0xe1)][_0x30d272(0xe6)]({'name':_0x557eeb['yaml']['service_type'],'action':_0x30d272(0x1ca),'error':_0x52863c[_0x30d272(0xf7)]}),_0xe30565[_0x30d272(0x191)]['integrations'][_0x30d272(0xf4)]++;}}for(const _0x294b54 of _0x3bdb20){try{const _0x272178=await yamlFormInterfaceToApi(_0x294b54[_0x30d272(0xd8)],_0x10ce89,_0x3af08b);if(!_0x272178){_0xe30565['formInterfaces'][_0x30d272(0xe6)]({'name':_0x294b54[_0x30d272(0xd8)]['name'],'action':_0x30d272(0x1ca),'error':_0x30d272(0x17a)}),_0xe30565[_0x30d272(0x191)][_0x30d272(0x185)][_0x30d272(0xf4)]++;continue;}const _0x3f8b54=await this['client'][_0x30d272(0x138)](_0x272178);_0xe30565['formInterfaces'][_0x30d272(0xe6)]({'name':_0x294b54[_0x30d272(0xd8)]['name'],'action':_0x30d272(0xf5),'id':_0x3f8b54['id']}),_0xe30565[_0x30d272(0x191)][_0x30d272(0x185)][_0x30d272(0xf5)]++;}catch(_0x599ccd){_0xe30565['formInterfaces']['push']({'name':_0x294b54[_0x30d272(0xd8)][_0x30d272(0x190)],'action':_0x30d272(0x1ca),'error':_0x599ccd[_0x30d272(0xf7)]}),_0xe30565[_0x30d272(0x191)]['formInterfaces'][_0x30d272(0xf4)]++;}}for(const _0x4e22f9 of _0x8598c){try{const _0x519644=await yamlChatInterfaceToApi(_0x4e22f9[_0x30d272(0xd8)],_0x10ce89,_0x3af08b),_0x207d46=await this[_0x30d272(0xf9)]['createChatInterface'](_0x519644);_0xe30565[_0x30d272(0x1c0)]['push']({'name':_0x4e22f9['yaml'][_0x30d272(0x190)],'action':_0x30d272(0xf5),'id':_0x207d46['id']}),_0xe30565['counts'][_0x30d272(0x1c0)]['created']++;}catch(_0x3352e5){_0xe30565['chatInterfaces'][_0x30d272(0xe6)]({'name':_0x4e22f9[_0x30d272(0xd8)][_0x30d272(0x190)],'action':'error','error':_0x3352e5[_0x30d272(0xf7)]}),_0xe30565[_0x30d272(0x191)][_0x30d272(0x1c0)][_0x30d272(0xf4)]++;}}return _0xe30565;}}