@treasuredata/tdx 2026.6.3 → 2026.6.4

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 (234) 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.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/engage-template-pull-command.js +1 -1
  28. package/dist/commands/engage-template-push-command.js +1 -1
  29. package/dist/commands/engage-template-validate-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/journey-validate-command.js +1 -1
  33. package/dist/commands/llm-command.js +1 -1
  34. package/dist/commands/mcp-command.js +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/policy-command.js +1 -1
  37. package/dist/commands/profile-command.js +1 -1
  38. package/dist/commands/profiles-command.js +1 -1
  39. package/dist/commands/query-command.js +1 -1
  40. package/dist/commands/schedule-command.js +1 -1
  41. package/dist/commands/segment-command.js +1 -1
  42. package/dist/commands/segment-create-command.js +1 -1
  43. package/dist/commands/segment-fields-command.js +1 -1
  44. package/dist/commands/segment-pull-command.js +1 -1
  45. package/dist/commands/segment-push-command.js +1 -1
  46. package/dist/commands/segment-update-command.js +1 -1
  47. package/dist/commands/segment-use-command.js +1 -1
  48. package/dist/commands/segment-validate-command.js +1 -1
  49. package/dist/commands/segments.js +1 -1
  50. package/dist/commands/show.js +1 -1
  51. package/dist/commands/status-command.js +1 -1
  52. package/dist/commands/table-deleted.js +1 -1
  53. package/dist/commands/tables.js +1 -1
  54. package/dist/commands/unset-command.js +1 -1
  55. package/dist/commands/upgrade-command.js +1 -1
  56. package/dist/commands/use-command.js +1 -1
  57. package/dist/commands/user-command.js +1 -1
  58. package/dist/commands/work-command.js +1 -1
  59. package/dist/commands/workflow-command.js +1 -1
  60. package/dist/core/auth.js +1 -1
  61. package/dist/core/command-output.js +1 -1
  62. package/dist/core/config.d.ts +14 -0
  63. package/dist/core/config.d.ts.map +1 -1
  64. package/dist/core/config.js +1 -1
  65. package/dist/core/config.js.map +1 -1
  66. package/dist/core/connection-cache.js +1 -1
  67. package/dist/core/constants.js +1 -1
  68. package/dist/core/credential-cache.js +1 -1
  69. package/dist/core/global-context.js +1 -1
  70. package/dist/core/keychain.js +1 -1
  71. package/dist/core/oauth-keychain.js +1 -1
  72. package/dist/core/oauth.js +1 -1
  73. package/dist/core/profile.js +1 -1
  74. package/dist/core/project-config.d.ts +1 -0
  75. package/dist/core/project-config.d.ts.map +1 -1
  76. package/dist/core/project-config.js +1 -1
  77. package/dist/core/project-config.js.map +1 -1
  78. package/dist/core/session.js +1 -1
  79. package/dist/core/user-cache.js +1 -1
  80. package/dist/core/version.js +1 -1
  81. package/dist/index.js +1 -1
  82. package/dist/mcp/server.js +1 -1
  83. package/dist/mcp/tools/index.js +1 -1
  84. package/dist/mcp/tools/tdx-run.js +1 -1
  85. package/dist/mcp/tools/tdx-search.d.ts.map +1 -1
  86. package/dist/mcp/tools/tdx-search.js +1 -1
  87. package/dist/mcp/tools/tdx-search.js.map +1 -1
  88. package/dist/mcp/tools/work-create-item.js +1 -1
  89. package/dist/mcp/utils.js +1 -1
  90. package/dist/proxy/claude-usage-tracker.js +1 -1
  91. package/dist/proxy/passthrough-server.js +1 -1
  92. package/dist/proxy/sse-usage-parser.js +1 -1
  93. package/dist/sdk/agent/agent-config.js +1 -1
  94. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  95. package/dist/sdk/agent/agent-yaml.js +1 -1
  96. package/dist/sdk/agent/test/evaluator.js +1 -1
  97. package/dist/sdk/agent/test/executor.js +1 -1
  98. package/dist/sdk/agent/test/index.js +1 -1
  99. package/dist/sdk/agent/test/output.js +1 -1
  100. package/dist/sdk/agent/test/parser.js +1 -1
  101. package/dist/sdk/agent/tool-target-registry.js +1 -1
  102. package/dist/sdk/api.js +1 -1
  103. package/dist/sdk/cas/cas-api-client.js +1 -1
  104. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  105. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  106. package/dist/sdk/cas/index.js +1 -1
  107. package/dist/sdk/cas/pull-workflow.js +1 -1
  108. package/dist/sdk/cas/push-workflow.js +1 -1
  109. package/dist/sdk/client/cdp-api-client.js +1 -1
  110. package/dist/sdk/client/delivery-api-client.js +1 -1
  111. package/dist/sdk/client/endpoints.js +1 -1
  112. package/dist/sdk/client/engage-api-client.js +1 -1
  113. package/dist/sdk/client/http-client.js +1 -1
  114. package/dist/sdk/client/llm-api-client.js +1 -1
  115. package/dist/sdk/client/oauth-refresh.js +1 -1
  116. package/dist/sdk/client/rate-limiter.js +1 -1
  117. package/dist/sdk/client/td-api-client.js +1 -1
  118. package/dist/sdk/client/trino-api-client.js +1 -1
  119. package/dist/sdk/client/workflow-client.js +1 -1
  120. package/dist/sdk/connection-validator.js +1 -1
  121. package/dist/sdk/connection.js +1 -1
  122. package/dist/sdk/delivery.js +1 -1
  123. package/dist/sdk/engage/campaign-pull.js +1 -1
  124. package/dist/sdk/engage/campaign-push.js +1 -1
  125. package/dist/sdk/engage/campaign-validator.js +1 -1
  126. package/dist/sdk/engage/campaign-yaml.js +1 -1
  127. package/dist/sdk/engage/template-pull.js +1 -1
  128. package/dist/sdk/engage/template-push.js +1 -1
  129. package/dist/sdk/engage/template-validator.js +1 -1
  130. package/dist/sdk/engage/template-yaml.js +1 -1
  131. package/dist/sdk/engage/types/campaign-def.js +1 -1
  132. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  133. package/dist/sdk/engage/types/template-schema.js +1 -1
  134. package/dist/sdk/engage.js +1 -1
  135. package/dist/sdk/errors.js +1 -1
  136. package/dist/sdk/index.js +1 -1
  137. package/dist/sdk/io/index.js +1 -1
  138. package/dist/sdk/io/node-filesystem.js +1 -1
  139. package/dist/sdk/job.js +1 -1
  140. package/dist/sdk/journey.js +1 -1
  141. package/dist/sdk/llm/chat-cache.js +1 -1
  142. package/dist/sdk/llm/index.js +1 -1
  143. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  144. package/dist/sdk/llm/model-factors.js +1 -1
  145. package/dist/sdk/llm/user-settings.js +1 -1
  146. package/dist/sdk/personalization.js +1 -1
  147. package/dist/sdk/policy.js +1 -1
  148. package/dist/sdk/query/deleted-table-validation.js +1 -1
  149. package/dist/sdk/query/index.js +1 -1
  150. package/dist/sdk/query/sql-parser.js +1 -1
  151. package/dist/sdk/realtime.js +1 -1
  152. package/dist/sdk/schedule.js +1 -1
  153. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  154. package/dist/sdk/segment/fields-display.js +1 -1
  155. package/dist/sdk/segment/file-discovery.js +1 -1
  156. package/dist/sdk/segment/journey-utils.js +1 -1
  157. package/dist/sdk/segment/journey-validator.js +1 -1
  158. package/dist/sdk/segment/journey-yaml.js +1 -1
  159. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  160. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  161. package/dist/sdk/segment/pull-workflow.js +1 -1
  162. package/dist/sdk/segment/push-recovery.js +1 -1
  163. package/dist/sdk/segment/push-workflow.js +1 -1
  164. package/dist/sdk/segment/resolution-context.js +1 -1
  165. package/dist/sdk/segment/segment-path-parser.js +1 -1
  166. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  167. package/dist/sdk/segment/segment-validator.js +1 -1
  168. package/dist/sdk/segment/target-resolution.js +1 -1
  169. package/dist/sdk/segment/tdx-config.js +1 -1
  170. package/dist/sdk/segment/types/activation-schema.js +1 -1
  171. package/dist/sdk/segment/types/journey-def.js +1 -1
  172. package/dist/sdk/segment/types/journey-schema.js +1 -1
  173. package/dist/sdk/segment/types/segment-def.js +1 -1
  174. package/dist/sdk/segment/types/segment-schema.js +1 -1
  175. package/dist/sdk/segment/validate-files.js +1 -1
  176. package/dist/sdk/segment/yaml-validator.js +1 -1
  177. package/dist/sdk/segment.js +1 -1
  178. package/dist/sdk/types/index.js +1 -1
  179. package/dist/sdk/types/progress.js +1 -1
  180. package/dist/sdk/types/workspace.js +1 -1
  181. package/dist/sdk/user.js +1 -1
  182. package/dist/sdk/util/format-detector.js +1 -1
  183. package/dist/sdk/util/formatters.js +1 -1
  184. package/dist/sdk/util/index.js +1 -1
  185. package/dist/sdk/util/paginate.js +1 -1
  186. package/dist/sdk/util/tree-formatter.js +1 -1
  187. package/dist/sdk/workflow/archive-validation.js +1 -1
  188. package/dist/sdk/workflow/clone-workflow.js +1 -1
  189. package/dist/sdk/workflow/index.js +1 -1
  190. package/dist/sdk/workflow/pull-workflow.js +1 -1
  191. package/dist/sdk/workflow/push-workflow.js +1 -1
  192. package/dist/sdk/workflow/task-graph.js +1 -1
  193. package/dist/sdk/workflow/tdx-config.js +1 -1
  194. package/dist/sdk/workflow/workflow-utils.js +1 -1
  195. package/dist/sdk/workspace/access-tracker.js +1 -1
  196. package/dist/sdk/workspace/frontmatter.js +1 -1
  197. package/dist/sdk/workspace/git.js +1 -1
  198. package/dist/sdk/workspace/index.js +1 -1
  199. package/dist/sdk/workspace/templates.js +1 -1
  200. package/dist/sdk/workspace/weekly.js +1 -1
  201. package/dist/sdk/workspace/wikilinks.js +1 -1
  202. package/dist/test-utils/command-runner.js +1 -1
  203. package/dist/test-utils/factories.js +1 -1
  204. package/dist/test-utils/fixtures.js +1 -1
  205. package/dist/test-utils/http-mock.js +1 -1
  206. package/dist/test-utils/index.js +1 -1
  207. package/dist/utils/async.js +1 -1
  208. package/dist/utils/colors.js +1 -1
  209. package/dist/utils/diff.js +1 -1
  210. package/dist/utils/file-permissions.js +1 -1
  211. package/dist/utils/file-reader.js +1 -1
  212. package/dist/utils/github-releases.js +1 -1
  213. package/dist/utils/global-cache.js +1 -1
  214. package/dist/utils/json-loader.js +1 -1
  215. package/dist/utils/local-cache.js +1 -1
  216. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  217. package/dist/utils/logger/formatters/index.js +1 -1
  218. package/dist/utils/logger/handlers/console-handler.js +1 -1
  219. package/dist/utils/logger/handlers/file-handler.js +1 -1
  220. package/dist/utils/logger/handlers/index.js +1 -1
  221. package/dist/utils/logger/handlers/null-handler.js +1 -1
  222. package/dist/utils/logger/index.js +1 -1
  223. package/dist/utils/logger/logger.js +1 -1
  224. package/dist/utils/logger/types.js +1 -1
  225. package/dist/utils/option-validation.js +1 -1
  226. package/dist/utils/process.js +1 -1
  227. package/dist/utils/prompt.js +1 -1
  228. package/dist/utils/spinner.js +1 -1
  229. package/dist/utils/sse-parser.js +1 -1
  230. package/dist/utils/string-utils.js +1 -1
  231. package/dist/utils/table-ref-parser.js +1 -1
  232. package/dist/utils/tdx-logger.js +1 -1
  233. package/dist/utils/version-check.js +1 -1
  234. package/package.json +1 -1
@@ -1 +1 @@
1
- const a134_0x1280fc=a134_0x357b;(function(_0x63f38c,_0x406e75){const _0x6ec7af=a134_0x357b,_0x513051=_0x63f38c();while(!![]){try{const _0x46d4ca=-parseInt(_0x6ec7af(0x21c))/0x1+-parseInt(_0x6ec7af(0x294))/0x2+parseInt(_0x6ec7af(0x27f))/0x3+-parseInt(_0x6ec7af(0x274))/0x4*(parseInt(_0x6ec7af(0x278))/0x5)+parseInt(_0x6ec7af(0x20b))/0x6+parseInt(_0x6ec7af(0x23f))/0x7+parseInt(_0x6ec7af(0x26e))/0x8;if(_0x46d4ca===_0x406e75)break;else _0x513051['push'](_0x513051['shift']());}catch(_0x2b0c31){_0x513051['push'](_0x513051['shift']());}}}(a134_0x4cab,0xa1272));import{LLMApiClient}from'../client/llm-api-client.js';import*as a134_0x4f3caa from'node:fs';import*as a134_0xb4a0ec from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{toModelInfos}from'./user-settings.js';function a134_0x4cab(){const _0x44d521=['def','tdDatabaseName','idToName','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','1059546dmjcns','file_name','text_content','currentProjectId','chatIgnoreManagedActions','\x27.\x20This\x20should\x20not\x20happen.','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','has','agent.yml','toISOString','tools','total','integrations','loadJsonFile','pushAgent','info','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','low','readFileSync','Renamed\x20form\x20interface\x20file:\x20','writeFileSync','length','filter','listPrompts','project.json','duplicate','\x0a---\x20code\x20---\x0a','backupProject','listTextKnowledgeBases','setCurrentProject','updateExperimentalKnowledgeBase','attributes','formInterfaces','template','webhookCorsOrigins','json_schema','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','chat','path','listImageGenerators','deleteProject','Renamed\x20integration\x20file:\x20','getDefaultAgent','web_search','AGENT_NOT_FOUND','Renamed\x20agent\x20folder:\x20','\x20---\x0a','createFormInterface','keys','errors','newProjectId','utf-8','context','createIntegration','event','localeCompare','#\x20prompt.md\x0a','site','Agent\x20reference\x20not\x20found','message','createTextKnowledgeBase','maxToolIterations','listProjects','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','logger','listAgents','NOT_FOUND','agent','service_type','cloneProject','error','listChatInterfaces','agents','Renamed\x20KB\x20file:\x20','---\x20file:\x20','already\x20exists','get','chat_interfaces','dry-run-','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','isManaged','claude-4.5-sonnet','temperature','.yml','json_schema.json','deleteAgent','map','experimentalKnowledgeBases','Renamed\x20text\x20KB\x20file:\x20','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','parse','tdx_default_','starterMessage','createAgentResponse','getDefaultProjectName','Project\x20\x22','updateTextKnowledgeBase','):\x20','getChatInfo','target','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.','updateFormInterface','name','listIntegrations','updateAgentResponse','listExperimentalKnowledgeBases','chat_parent_segment','updatePrompt','Only\x20safe\x20types\x20(','listAgentsFull','Agent\x20not\x20found:\x20','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','Removed\x20deleted\x20directory:\x20','knowledgeBases','endsWith','Renamed\x20chat\x20interface\x20file:\x20','getCurrentProject','.md','resolveProjectId','warn','starter_message',')\x20can\x20be\x20pushed.\x20','isDir','find','getProject','history','setDefaultAgent','size','integrations.json','new','counts','createProject','tdx.json','(dry-run)','slackMessageMode','split','systemPrompt','project','stringify','getAgent','files','getOrCreateDefaultProject','getOrCreateDefaultAgent','client','signal','isFile','\x0a\x0a#\x20agent.yml\x0a','INVALID_ARGUMENT','createExperimentalKnowledgeBase','Skipping\x20integration\x20\x27','experimentalArtifacts','1464300ZQLiye','includes','knowledge_bases','clearDefaultAgent','mkdirSync','.llm','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','code.js','experimental_artifacts','prompt.md','action','type','---\x20schema:\x20','rmSync','KnowledgeBase','Removed\x20deleted\x20file:\x20','createExperimentalArtifact','1010302QLNVhq','\x27\x20(','listWebSearchTools','medium','webSearchTools','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','Available\x20agents:\x20','form_interfaces','\x0a---\x20schema:\x20','image_gen','\x0a---\x20function:\x20','dir','description','profile','listFormInterfaces','Unable\x20to\x20create\x20project\x20after\x20','INTERNAL','Multiple\x20agents\x20found\x20with\x20name\x20\x27','chat_generic','starter_message.md','text','unlinkSync','updated','chats','renamed','Invalid\x20agent\x20reference\x20format:\x20','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','Renamed\x20prompt\x20file:\x20','createWebSearchTool','UNAUTHENTICATED','unchanged','toLowerCase','basename',')\x20can\x20be\x20cloned.','sort','7508333QHcWeA','_reasoning_','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','\x20in\x20project\x20','Unsupported\x20backup\x20version:\x20','Renamed\x20experimental\x20artifact\x20directory:\x20','imageGenerators','add','listKnowledgeBases','dryRun','readdirSync','createChatInterface','resolveAgentId','listToolTargets','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','projectName','functions','ALREADY_EXISTS','updateAgent','getBackupMetadata','Unresolved\x20dependencies:\x20','oldPath','agentId','createPrompt','projects','some','resolveProjectName','createAgent','Agent\x20\x27','tdx_','prompts','chat_agent_console','textKnowledgeBases','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','getChatHistory','Multiple\x20projects\x20found\x20with\x20name\x20\x27','startChat','createKnowledgeBase','Project\x20not\x20found:\x20','chatInterfaces','agents.json','statSync','createImageGenerator','updateKnowledgeBase','status','Could\x20not\x20resolve\x20agent\x20reference','agentsFull','8267528GQWDan','set','exportedFrom','join','high','existsSync','1203692UZXpWj','chatWelcomeMessage','Renamed\x20folder:\x20','push','15AYequa','Renamed\x20experimental\x20KB\x20directory:\x20','deleteIntegration','created','LLM_PROJECT_NOT_FOUND','content','isDirectory','2258448reErHG','llm_project','updateExperimentalArtifact','TextKnowledgeBase','experimental_knowledge_bases','dirname','promptId','chatId','variables','nameToId','sdk.llm','code','yaml','getChatLog','\x20→\x20','knowledgebases.json','serviceType'];a134_0x4cab=function(){return _0x44d521;};return a134_0x4cab();}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';function a134_0x357b(_0x109b72,_0x1f7db6){_0x109b72=_0x109b72-0x177;const _0x4cab85=a134_0x4cab();let _0x357b4e=_0x4cab85[_0x109b72];return _0x357b4e;}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';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a134_0x1280fc(0x22e),a134_0x1280fc(0x25e),a134_0x1280fc(0x1de)];async function safeListOrEmpty(_0xd223a1){const _0x340b6b=a134_0x1280fc;try{return await _0xd223a1();}catch(_0x92bddf){if(_0x92bddf instanceof HTTPClientError&&_0x92bddf[_0x340b6b(0x26b)]===0x194)return[];throw _0x92bddf;}}export class LLMSDK{[a134_0x1280fc(0x177)];[a134_0x1280fc(0x203)];[a134_0x1280fc(0x1a8)];[a134_0x1280fc(0x1b4)]=Logger['of'](a134_0x1280fc(0x289));constructor(_0x1c2211){const _0x121c8a=a134_0x1280fc;this[_0x121c8a(0x203)]=new LLMApiClient(_0x1c2211),this[_0x121c8a(0x1a8)]=_0x1c2211;}[a134_0x1280fc(0x1d2)](){const _0x377ad2=a134_0x1280fc,_0x4e3a50=getSanitizedUsername();return _0x377ad2(0x1cf)+_0x4e3a50;}async[a134_0x1280fc(0x191)](_0x5b9528){const _0xe1dafb=a134_0x1280fc,{projectId:_0x341be9}=await this[_0xe1dafb(0x259)](_0x5b9528);this[_0xe1dafb(0x177)]=_0x341be9;}[a134_0x1280fc(0x1e8)](){const _0x22dff4=a134_0x1280fc;return this[_0x22dff4(0x177)];}async[a134_0x1280fc(0x1f2)](_0x2585d1){const _0x29cf3a=a134_0x1280fc,_0x1f8f75=this[_0x29cf3a(0x1a8)][_0x29cf3a(0x229)];let _0x18cc46,_0x177271;if(_0x2585d1[_0x29cf3a(0x20c)]('/')){const _0x4fa31e=_0x2585d1[_0x29cf3a(0x1fb)]('/');if(_0x4fa31e['length']!==0x2)throw new SDKError(ErrorCode[_0x29cf3a(0x207)],_0x29cf3a(0x235)+_0x2585d1,undefined,{'helpText':_0x29cf3a(0x260)});const [_0x5234cc,_0x124f13]=_0x4fa31e;_0x18cc46=await this['resolveProjectId'](_0x5234cc),_0x177271=_0x124f13;}else _0x18cc46=this[_0x29cf3a(0x177)]||(await this[_0x29cf3a(0x201)]())['id'],_0x177271=_0x2585d1;const _0x1bfff9=await this[_0x29cf3a(0x24b)](_0x177271,_0x18cc46),_0xbaa63d=await this[_0x29cf3a(0x203)][_0x29cf3a(0x1ff)](_0x1bfff9);writeCachedLLMAgent(_0xbaa63d['attributes'][_0x29cf3a(0x1da)],_0x1bfff9,_0x18cc46,_0x1f8f75);}[a134_0x1280fc(0x19e)](){const _0x3fd463=a134_0x1280fc,_0x2c7dab=this[_0x3fd463(0x1a8)][_0x3fd463(0x229)];return readCachedLLMAgent(_0x2c7dab)||undefined;}[a134_0x1280fc(0x20e)](){const _0x2f588b=a134_0x1280fc,_0x76e640=this[_0x2f588b(0x1a8)]['profile'];clearCachedLLMAgent(_0x76e640);}async['models'](){const _0xa9529d=a134_0x1280fc,_0x11f351=await this[_0xa9529d(0x203)]['getUserSettings']();return toModelInfos(_0x11f351);}async[a134_0x1280fc(0x1f7)](_0x544ef7){const _0x32046a=a134_0x1280fc;return await this['client'][_0x32046a(0x1f7)](_0x544ef7);}async[a134_0x1280fc(0x19c)](_0x17c524){const _0x40d0e4=a134_0x1280fc,{projectId:_0x1bb6d1}=await this[_0x40d0e4(0x259)](_0x17c524);await this[_0x40d0e4(0x203)][_0x40d0e4(0x19c)](_0x1bb6d1);}async[a134_0x1280fc(0x257)](_0x2f4163=0x32){const _0x114099=a134_0x1280fc;return await this[_0x114099(0x203)][_0x114099(0x1b2)](_0x2f4163);}async[a134_0x1280fc(0x201)](_0xe0d31c){const _0x57a985=a134_0x1280fc,_0x3bfd42=_0xe0d31c||this[_0x57a985(0x1d2)](),_0x514561=this[_0x57a985(0x1a8)]['profile'];if(!_0xe0d31c){const _0x1415f5=readCachedLLMProject(_0x514561);if(_0x1415f5&&_0x1415f5['name']===_0x3bfd42)try{const _0x2d5914=await this['client'][_0x57a985(0x1f0)](_0x1415f5['id']);if(_0x2d5914['attributes'][_0x57a985(0x1da)]===_0x3bfd42)return _0x2d5914;}catch{}}const _0x443a59=await this['client']['listProjects'](),_0xfd4988=_0x443a59[_0x57a985(0x1ef)](_0x1945f3=>_0x1945f3[_0x57a985(0x193)][_0x57a985(0x1da)]===_0x3bfd42);if(_0xfd4988)return!_0xe0d31c&&writeCachedLLMProject(_0x3bfd42,_0xfd4988['id'],_0x514561),_0xfd4988;const _0x2c5057=await this[_0x57a985(0x203)][_0x57a985(0x1f7)]({'name':_0x3bfd42,'description':'Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20'+getSanitizedUsername()+')'});return!_0xe0d31c&&writeCachedLLMProject(_0x3bfd42,_0x2c5057['id'],_0x514561),_0x2c5057;}async['resolveProjectId'](_0x5971d4){const _0x3f98f6=a134_0x1280fc,_0x1b1112=await this[_0x3f98f6(0x203)][_0x3f98f6(0x1b2)](),_0x5a6279=_0x1b1112[_0x3f98f6(0x18a)](_0x5bf322=>_0x5bf322[_0x3f98f6(0x193)]['name']===_0x5971d4);if(_0x5a6279[_0x3f98f6(0x189)]===0x0)throw new SDKError(ErrorCode[_0x3f98f6(0x27c)],'Project\x20not\x20found:\x20'+_0x5971d4,undefined,{'helpText':_0x3f98f6(0x17a)});if(_0x5a6279[_0x3f98f6(0x189)]>0x1)throw new SDKError(ErrorCode[_0x3f98f6(0x22c)],_0x3f98f6(0x262)+_0x5971d4+_0x3f98f6(0x179));return _0x5a6279[0x0]['id'];}async['resolveProjectName'](_0x2e3f74){const _0x2cb3d5=a134_0x1280fc,_0x2a20f0=await this[_0x2cb3d5(0x203)][_0x2cb3d5(0x1b2)](),_0x4255f7=_0x2a20f0[_0x2cb3d5(0x1ef)](_0x61c3a4=>_0x61c3a4[_0x2cb3d5(0x193)][_0x2cb3d5(0x1da)]===_0x2e3f74);if(_0x4255f7)return{'projectId':_0x4255f7['id'],'project':_0x4255f7};throw new SDKError(ErrorCode[_0x2cb3d5(0x27c)],_0x2cb3d5(0x265)+_0x2e3f74,undefined,{'helpText':_0x2cb3d5(0x17a)});}async[a134_0x1280fc(0x202)](_0x5a29a9=a134_0x1280fc(0x1c5),_0x4b1f6c=0x0,_0x5a66a8){const _0x58873a=a134_0x1280fc,_0x531552=0xa;let _0x3ca027=0x0,_0xe9d189;while(_0x3ca027<_0x531552){try{const _0x4d75bf=await this[_0x58873a(0x201)](_0xe9d189),_0x58b344=_0x4d75bf['id'],_0x496833=['none','minimal',_0x58873a(0x185),_0x58873a(0x21f),_0x58873a(0x272)],_0x1258e2=_0x4b1f6c===0x0?'tdx_'+_0x5a29a9:_0x58873a(0x25c)+_0x5a29a9+_0x58873a(0x240)+_0x496833[_0x4b1f6c],_0x3febf3=await this[_0x58873a(0x203)][_0x58873a(0x1b5)](_0x58b344),_0x389a81=_0x3febf3[_0x58873a(0x1ef)](_0x38685e=>_0x38685e[_0x58873a(0x193)][_0x58873a(0x1da)]===_0x1258e2);if(_0x389a81)return _0x389a81;const _0x27b363=_0x4b1f6c>0x0?0x1:_0x5a66a8;return await this[_0x58873a(0x203)][_0x58873a(0x25a)]({'name':_0x1258e2,'projectId':_0x58b344,'modelType':_0x5a29a9,'systemPrompt':'','temperature':_0x27b363,'reasoningEffort':_0x4b1f6c>0x0?_0x4b1f6c:undefined});}catch(_0x312132){if(_0x312132 instanceof HTTPClientError){const _0x3f3659=_0x312132['status'];if(_0x3f3659>=0x190&&_0x3f3659<0x1f4){if(_0x3f3659===0x191)throw new SDKError(ErrorCode[_0x58873a(0x239)],_0x58873a(0x293),_0x312132);else{if(_0x3f3659===0x193)throw new SDKError(ErrorCode['PERMISSION_DENIED'],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x312132);}throw _0x312132;}}if(errorContains(_0x312132,_0x58873a(0x1bf),_0x58873a(0x18d),'conflict')){_0x3ca027++;if(_0x3ca027>=_0x531552)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x58873a(0x22b)+_0x531552+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x312132);const _0x3a1017=this['getDefaultProjectName']();_0xe9d189=_0x3a1017+'_'+generateRandomHex();continue;}throw _0x312132;}}throw new SDKError(ErrorCode[_0x58873a(0x22c)],_0x58873a(0x198));}async[a134_0x1280fc(0x24b)](_0x8457e,_0x574791){const _0x355e5f=a134_0x1280fc,_0x19c86b=_0x574791||this['currentProjectId'],_0x45fd8e=await this['client'][_0x355e5f(0x1b5)](_0x19c86b),_0x54f14e=_0x45fd8e[_0x355e5f(0x18a)](_0x322f54=>_0x322f54['attributes'][_0x355e5f(0x1da)]===_0x8457e);if(_0x54f14e[_0x355e5f(0x189)]===0x0){const _0x47072a=_0x19c86b?_0x355e5f(0x242)+_0x19c86b:'';throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x355e5f(0x1e2)+_0x8457e+_0x47072a,undefined,{'helpText':_0x19c86b?_0x355e5f(0x1e3):_0x355e5f(0x1d8)});}if(_0x54f14e[_0x355e5f(0x189)]>0x1)throw new SDKError(ErrorCode[_0x355e5f(0x22c)],_0x355e5f(0x22d)+_0x8457e+'\x27.\x20This\x20should\x20not\x20happen.');return _0x54f14e[0x0]['id'];}async[a134_0x1280fc(0x1bc)](_0x7cac48){const _0x5d6957=a134_0x1280fc,_0x5ba806=_0x7cac48||this[_0x5d6957(0x177)];return await this[_0x5d6957(0x203)][_0x5d6957(0x1b5)](_0x5ba806);}async[a134_0x1280fc(0x26d)](_0x388d9c){const _0x24c189=a134_0x1280fc;return await this[_0x24c189(0x203)][_0x24c189(0x1e1)](_0x388d9c);}async[a134_0x1280fc(0x1b7)](_0x39ac7c){const _0x50831f=a134_0x1280fc;return await this[_0x50831f(0x203)][_0x50831f(0x1ff)](_0x39ac7c);}async[a134_0x1280fc(0x25a)](_0x503a65){const _0x2688ee=a134_0x1280fc;return await this['client'][_0x2688ee(0x25a)](_0x503a65);}async[a134_0x1280fc(0x251)](_0x32fff1,_0x4513c5){const _0x480e9a=a134_0x1280fc;return await this[_0x480e9a(0x203)][_0x480e9a(0x251)](_0x32fff1,_0x4513c5);}async[a134_0x1280fc(0x1c9)](_0xcc19d2){const _0x2a7d20=a134_0x1280fc;await this[_0x2a7d20(0x203)][_0x2a7d20(0x1c9)](_0xcc19d2);}async[a134_0x1280fc(0x263)](_0x39fafd){const _0x5db47b=a134_0x1280fc;return await this['client'][_0x5db47b(0x263)]({'agentId':_0x39fafd});}async*[a134_0x1280fc(0x199)](_0x4201cb,_0x115932){const _0x317bef=a134_0x1280fc;let _0x5b5927=_0x115932?.[_0x317bef(0x286)];const _0xd6bca6=_0x115932?.['agentId'];if(!_0x5b5927){if(!_0xd6bca6)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x36c9ee=await this[_0x317bef(0x203)][_0x317bef(0x263)]({'agentId':_0xd6bca6});_0x5b5927=_0x36c9ee['id'],yield{'type':'metadata','data':{'chatId':_0x5b5927,'agentId':_0xd6bca6,'projectId':_0x36c9ee[_0x317bef(0x193)]['projectId']}};}for await(const _0x13b782 of this['client']['continueChat'](_0x5b5927,_0x4201cb,_0x115932?.[_0x317bef(0x204)])){yield{'type':_0x317bef(0x1aa),'data':_0x13b782};}}async[a134_0x1280fc(0x233)](_0x1cab66=0x32){const _0x180bba=a134_0x1280fc;return await this[_0x180bba(0x203)]['listChats'](_0x1cab66);}async[a134_0x1280fc(0x1f1)](_0x23282c){const _0x34aacb=a134_0x1280fc;return await this['client'][_0x34aacb(0x261)](_0x23282c);}async['getChatLog'](_0x325b22){const _0x684de5=a134_0x1280fc;return await this[_0x684de5(0x203)][_0x684de5(0x28c)](_0x325b22);}async['chatInfo'](_0x1cc3f8){const _0x5223a8=a134_0x1280fc;return await this[_0x5223a8(0x203)][_0x5223a8(0x1d6)](_0x1cc3f8);}async[a134_0x1280fc(0x18f)](_0x6c5116,_0x3e4af5,_0x1c71d0){const _0x8cc1ad=a134_0x1280fc,_0x4516dc=_0x1c71d0?.[_0x8cc1ad(0x248)]??![],{projectId:_0x5d501b,project:_0xcaebd3}=await this[_0x8cc1ad(0x259)](_0x6c5116),_0x58ab9b=_0xcaebd3['attributes'][_0x8cc1ad(0x1da)],_0xd1ea7e=_0x3e4af5||_0x58ab9b+_0x8cc1ad(0x210);if(a134_0x4f3caa[_0x8cc1ad(0x273)](_0xd1ea7e)&&!_0x4516dc)throw new SDKError(ErrorCode[_0x8cc1ad(0x250)],'Output\x20directory\x20already\x20exists:\x20'+_0xd1ea7e,undefined,{'helpText':_0x8cc1ad(0x1c3)});const _0x52df8f=await this[_0x8cc1ad(0x203)][_0x8cc1ad(0x1e1)](_0x5d501b),_0x5b5124=await this[_0x8cc1ad(0x203)]['listKnowledgeBases'](_0x5d501b),_0x3eb08c=await this['client'][_0x8cc1ad(0x18b)](_0x5d501b),_0x4dbc26=await this[_0x8cc1ad(0x203)]['listIntegrations'](_0x5d501b);if(!_0x4516dc){a134_0x4f3caa['mkdirSync'](_0xd1ea7e,{'recursive':!![]});const _0xa671e1={'version':'1.0','exportedAt':new Date()[_0x8cc1ad(0x17d)](),'exportedFrom':{'site':this['context'][_0x8cc1ad(0x1ad)],'projectId':_0x5d501b,'projectName':_0x58ab9b},'project':_0xcaebd3};a134_0x4f3caa[_0x8cc1ad(0x188)](a134_0xb4a0ec['join'](_0xd1ea7e,_0x8cc1ad(0x18c)),JSON[_0x8cc1ad(0x1fe)](_0xa671e1,null,0x2)),a134_0x4f3caa[_0x8cc1ad(0x188)](a134_0xb4a0ec[_0x8cc1ad(0x271)](_0xd1ea7e,_0x8cc1ad(0x267)),JSON[_0x8cc1ad(0x1fe)](_0x52df8f,null,0x2)),a134_0x4f3caa[_0x8cc1ad(0x188)](a134_0xb4a0ec[_0x8cc1ad(0x271)](_0xd1ea7e,_0x8cc1ad(0x28e)),JSON[_0x8cc1ad(0x1fe)](_0x5b5124,null,0x2)),a134_0x4f3caa[_0x8cc1ad(0x188)](a134_0xb4a0ec['join'](_0xd1ea7e,'prompts.json'),JSON[_0x8cc1ad(0x1fe)](_0x3eb08c,null,0x2)),a134_0x4f3caa['writeFileSync'](a134_0xb4a0ec[_0x8cc1ad(0x271)](_0xd1ea7e,_0x8cc1ad(0x1f4)),JSON[_0x8cc1ad(0x1fe)](_0x4dbc26,null,0x2));}return{'projectName':_0x58ab9b,'outputDir':_0xd1ea7e,'counts':{'agents':_0x52df8f['length'],'knowledgeBases':_0x5b5124[_0x8cc1ad(0x189)],'prompts':_0x3eb08c['length'],'integrations':_0x4dbc26['length']}};}async['restoreProject'](_0x44e4f8,_0x31834e){const _0x4146ae=a134_0x1280fc,_0x16fa56=_0x31834e?.[_0x4146ae(0x248)]??![],_0x47189f=this['getBackupMetadata'](_0x44e4f8),_0x211d8d=_0x47189f[_0x4146ae(0x270)][_0x4146ae(0x1ad)],_0x11b4b1=this['context'][_0x4146ae(0x1ad)],_0x3e7ea7=_0x211d8d!==_0x11b4b1?_0x211d8d:undefined,_0x29892a=this['loadJsonFile'](a134_0xb4a0ec['join'](_0x44e4f8,_0x4146ae(0x267)),[]),_0x20c693=this['loadJsonFile'](a134_0xb4a0ec[_0x4146ae(0x271)](_0x44e4f8,_0x4146ae(0x28e)),[]),_0x26301c=this[_0x4146ae(0x181)](a134_0xb4a0ec[_0x4146ae(0x271)](_0x44e4f8,'prompts.json'),[]),_0x5b3292=this[_0x4146ae(0x181)](a134_0xb4a0ec[_0x4146ae(0x271)](_0x44e4f8,_0x4146ae(0x1f4)),[]),_0x301bea=_0x31834e?.[_0x4146ae(0x1da)]||_0x47189f[_0x4146ae(0x270)][_0x4146ae(0x24e)];if(_0x16fa56){const _0x1910ca=new Map(),_0x355432=[..._0x29892a],_0x357ae3=_0x29892a[_0x4146ae(0x189)]+0x1;let _0xf389f5=0x0;while(_0x355432[_0x4146ae(0x189)]>0x0&&_0xf389f5<_0x357ae3){_0xf389f5++;const _0xbf866a=[];for(const _0x13d7fa of _0x355432){canCreateAgent(_0x13d7fa,_0x1910ca)?_0x1910ca[_0x4146ae(0x26f)](_0x13d7fa['id'],_0x4146ae(0x1c2)+_0x13d7fa['id']):_0xbf866a[_0x4146ae(0x277)](_0x13d7fa);}if(_0xbf866a['length']===_0x355432['length'])throw new SDKError(ErrorCode[_0x4146ae(0x22c)],_0x4146ae(0x241),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x355432[_0x4146ae(0x189)]=0x0,_0x355432[_0x4146ae(0x277)](..._0xbf866a);}const _0x3b2c47=_0x26301c[_0x4146ae(0x18a)](_0x203edc=>_0x1910ca['has'](_0x203edc[_0x4146ae(0x193)][_0x4146ae(0x255)]))[_0x4146ae(0x189)];return{'projectName':_0x301bea,'projectId':_0x4146ae(0x1f9),'counts':{'agents':_0x29892a['length'],'knowledgeBases':_0x20c693['length'],'prompts':_0x3b2c47,'integrations':_0x5b3292[_0x4146ae(0x189)]},'sourceSite':_0x3e7ea7};}const _0x1dc163=await this[_0x4146ae(0x203)][_0x4146ae(0x1f7)]({'name':_0x301bea,'description':_0x47189f[_0x4146ae(0x1fd)][_0x4146ae(0x193)][_0x4146ae(0x228)]}),_0x15aa2e=_0x1dc163['id'],_0x5f2bf4=new Map(),_0x3eea21=new Map(),_0x4f5b55=new Map();for(const _0x1c9cb8 of _0x20c693){const _0x59a1c0=await this[_0x4146ae(0x203)]['createKnowledgeBase']({'projectId':_0x15aa2e,'name':_0x1c9cb8[_0x4146ae(0x193)][_0x4146ae(0x1da)],'tdDatabaseName':_0x1c9cb8[_0x4146ae(0x193)][_0x4146ae(0x291)],'tables':_0x1c9cb8[_0x4146ae(0x193)]['tables']});_0x5f2bf4['set'](_0x1c9cb8['id'],_0x59a1c0['id']);}const _0x2b3625=[..._0x29892a],_0x24173d=_0x29892a[_0x4146ae(0x189)]+0x1;let _0x14fd77=0x0;while(_0x2b3625[_0x4146ae(0x189)]>0x0&&_0x14fd77<_0x24173d){_0x14fd77++;const _0x5c3f84=[];for(const _0x530e31 of _0x2b3625){if(canCreateAgent(_0x530e31,_0x3eea21)){const _0x35d53a=remapToolIds(_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x17e)],_0x5f2bf4,_0x3eea21),_0x430c13=remapVariableIds(_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x287)],_0x5f2bf4),_0x4102fd=await this[_0x4146ae(0x203)][_0x4146ae(0x1d1)]({'name':_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x1da)],'projectId':_0x15aa2e,'systemPrompt':_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x1fc)],'starterMessage':_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x1d0)],'modelType':migrateModelType(_0x530e31[_0x4146ae(0x193)]['modelType']),'maxToolIterations':_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x1b1)],'temperature':_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x1c6)],'reasoningEffort':_0x530e31[_0x4146ae(0x193)]['reasoningEffort'],'outputs':_0x530e31[_0x4146ae(0x193)]['outputs'],'tools':_0x35d53a,'variables':_0x430c13});_0x3eea21['set'](_0x530e31['id'],_0x4102fd['id']);}else _0x5c3f84[_0x4146ae(0x277)](_0x530e31);}if(_0x5c3f84['length']===_0x2b3625[_0x4146ae(0x189)])throw new SDKError(ErrorCode[_0x4146ae(0x22c)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x4146ae(0x1cd)});_0x2b3625['length']=0x0,_0x2b3625['push'](..._0x5c3f84);}for(const _0x4a911c of _0x26301c){const _0x1de4e7=_0x3eea21[_0x4146ae(0x1c0)](_0x4a911c[_0x4146ae(0x193)][_0x4146ae(0x255)]);if(!_0x1de4e7)continue;const _0x4f34c9=await this[_0x4146ae(0x203)][_0x4146ae(0x256)]({'projectId':_0x15aa2e,'agentId':_0x1de4e7,'name':_0x4a911c['attributes'][_0x4146ae(0x1da)],'systemPrompt':_0x4a911c['attributes'][_0x4146ae(0x1fc)],'template':_0x4a911c['attributes'][_0x4146ae(0x195)],'jsonSchemaHint':_0x4a911c[_0x4146ae(0x193)]['jsonSchemaHint']});_0x4f5b55['set'](_0x4a911c['id'],_0x4f34c9['id']);}for(const _0x214ee1 of _0x5b3292){const _0x37ef99=_0x214ee1[_0x4146ae(0x193)]['actions']['map'](_0x333d35=>({..._0x333d35,'promptId':_0x4f5b55['get'](_0x333d35['promptId'])||_0x333d35[_0x4146ae(0x285)]}));await this[_0x4146ae(0x203)]['createIntegration']({'projectId':_0x15aa2e,'serviceType':_0x214ee1[_0x4146ae(0x193)][_0x4146ae(0x28f)],'actions':_0x37ef99,'slackMessageMode':_0x214ee1[_0x4146ae(0x193)][_0x4146ae(0x1fa)],'chatIgnoreManagedActions':_0x214ee1[_0x4146ae(0x193)][_0x4146ae(0x178)],'chatWelcomeMessage':_0x214ee1[_0x4146ae(0x193)][_0x4146ae(0x275)],'webhookCorsOrigins':_0x214ee1[_0x4146ae(0x193)][_0x4146ae(0x196)]});}return{'projectName':_0x301bea,'projectId':_0x15aa2e,'counts':{'agents':_0x3eea21[_0x4146ae(0x1f3)],'knowledgeBases':_0x5f2bf4[_0x4146ae(0x1f3)],'prompts':_0x4f5b55['size'],'integrations':_0x5b3292['length']},'sourceSite':_0x3e7ea7};}[a134_0x1280fc(0x181)](_0x225a88,_0x3cb6ed){const _0x1ff26e=a134_0x1280fc;if(!a134_0x4f3caa[_0x1ff26e(0x273)](_0x225a88))return _0x3cb6ed;return JSON[_0x1ff26e(0x1ce)](a134_0x4f3caa['readFileSync'](_0x225a88,_0x1ff26e(0x1a7)));}[a134_0x1280fc(0x252)](_0x255b33){const _0x297597=a134_0x1280fc;if(!a134_0x4f3caa['existsSync'](_0x255b33))throw new SDKError(ErrorCode[_0x297597(0x1b6)],'Backup\x20folder\x20not\x20found:\x20'+_0x255b33,undefined,{'helpText':'Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.'});const _0x3c1d8d=a134_0xb4a0ec[_0x297597(0x271)](_0x255b33,_0x297597(0x18c));if(!a134_0x4f3caa[_0x297597(0x273)](_0x3c1d8d))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x297597(0x236)+_0x255b33,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x5c91c4=JSON[_0x297597(0x1ce)](a134_0x4f3caa['readFileSync'](_0x3c1d8d,_0x297597(0x1a7)));if(!isSupportedBackupVersion(_0x5c91c4['version']))throw new SDKError(ErrorCode[_0x297597(0x207)],_0x297597(0x243)+_0x5c91c4['version'],undefined,{'helpText':_0x297597(0x24d)});return _0x5c91c4;}async['pullProject'](_0x3c1847,_0x487078,_0x34d44e){const _0xf29d78=a134_0x1280fc,{projectId:_0x352944,project:_0x347a6b}=await this[_0xf29d78(0x259)](_0x3c1847),_0x14b4cd=_0x347a6b[_0xf29d78(0x193)][_0xf29d78(0x1da)];let _0xdfd7dd;if(_0x487078)_0xdfd7dd=_0x487078;else{const _0x1a2ab0=a134_0xb4a0ec[_0xf29d78(0x271)](process['cwd'](),_0xf29d78(0x1bc)),_0x3c5d46=getSanitizedPathWithMigration(_0x1a2ab0,_0x14b4cd);_0x3c5d46[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x276)+a134_0xb4a0ec['basename'](_0x3c5d46['oldPath'])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x3c5d46[_0xf29d78(0x19a)])),_0xdfd7dd=_0x3c5d46[_0xf29d78(0x19a)];}const _0x3c27bc=await this[_0xf29d78(0x203)][_0xf29d78(0x1e1)](_0x352944),_0x126dfc=await this['client'][_0xf29d78(0x247)](_0x352944),_0x3d9472=await this['client'][_0xf29d78(0x190)](_0x352944),_0x5ccf34=await safeListOrEmpty(()=>this['client'][_0xf29d78(0x19b)](_0x352944)),_0x1c8100=await safeListOrEmpty(()=>this[_0xf29d78(0x203)][_0xf29d78(0x21e)](_0x352944)),_0x43e05c=await this['client'][_0xf29d78(0x18b)](_0x352944),_0x51b02b=await this['client']['listIntegrations'](_0x352944),_0x1c730b=await safeListOrEmpty(()=>this['client'][_0xf29d78(0x1dd)](_0x352944)),_0x993f1c=await safeListOrEmpty(()=>this[_0xf29d78(0x203)]['listExperimentalArtifacts'](_0x352944)),_0x265ea1=await safeListOrEmpty(()=>this[_0xf29d78(0x203)]['listFormInterfaces'](_0x352944)),_0x5de67f=await safeListOrEmpty(()=>this[_0xf29d78(0x203)][_0xf29d78(0x1bb)](_0x352944)),_0x1de2e9=_0x51b02b[_0xf29d78(0x18a)](_0x576dc7=>!_0x576dc7[_0xf29d78(0x193)][_0xf29d78(0x1c4)]&&SAFE_INTEGRATION_TYPES[_0xf29d78(0x20c)](_0x576dc7[_0xf29d78(0x193)]['serviceType'][_0xf29d78(0x23b)]())),_0x1dd883=new Map(),_0x2c524e=new Map(),_0x3e92b8=new Map(),_0x316799=new Map(),_0x3f9d81=new Map(),_0x58d4fb=new Map(),_0x77f6d0=new Map();for(const _0x4a9c6f of _0x3c27bc){_0x1dd883['set'](_0x4a9c6f['id'],_0x4a9c6f['attributes'][_0xf29d78(0x1da)]);}for(const _0x4330cd of _0x126dfc){_0x2c524e[_0xf29d78(0x26f)](_0x4330cd['id'],_0x4330cd[_0xf29d78(0x193)][_0xf29d78(0x1da)]);}for(const _0x1941f9 of _0x3d9472){_0x3e92b8[_0xf29d78(0x26f)](_0x1941f9['id'],_0x1941f9[_0xf29d78(0x193)][_0xf29d78(0x1da)]);}for(const _0x3dab6c of _0x5ccf34){_0x316799[_0xf29d78(0x26f)](_0x3dab6c['id'],_0x3dab6c[_0xf29d78(0x193)]['name']);}for(const _0xe36575 of _0x1c8100){_0x3f9d81[_0xf29d78(0x26f)](_0xe36575['id'],_0xe36575[_0xf29d78(0x193)][_0xf29d78(0x1da)]);}for(const _0x2f336b of _0x43e05c){_0x58d4fb[_0xf29d78(0x26f)](_0x2f336b['id'],_0x2f336b['attributes'][_0xf29d78(0x1da)]);}for(const _0x5d6452 of _0x1c730b){_0x77f6d0['set'](_0x5d6452['id'],_0x5d6452[_0xf29d78(0x193)][_0xf29d78(0x1da)]);}const _0x241aab={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x2c524e,'TextKnowledgeBase':_0x3e92b8,'Agent':_0x1dd883,'WebSearchTool':_0x3f9d81,'ImageGenerator':_0x316799,'ExperimentalKnowledgeBase':_0x77f6d0}),'resolvePromptName':async _0x42488e=>_0x58d4fb['get'](_0x42488e),'onWarning':_0xd1161b=>this['logger'][_0xf29d78(0x1eb)](_0xd1161b)},_0x2ca305={'projectName':_0x14b4cd,'outputDir':_0xdfd7dd,'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}}},_0x2d2735=[],_0x4fa164=[];for(const _0x103eab of _0x3c27bc){const _0x1284c9=getSanitizedPathWithMigration(_0xdfd7dd,_0x103eab[_0xf29d78(0x193)][_0xf29d78(0x1da)]);_0x1284c9[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x1a1)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x1284c9['oldPath'])+'\x20→\x20'+a134_0xb4a0ec['basename'](_0x1284c9[_0xf29d78(0x19a)]));const _0x4b39aa=_0x1284c9[_0xf29d78(0x19a)],_0x5808e5=a134_0xb4a0ec['join'](_0x4b39aa,'prompt.md'),_0x5d2561=a134_0xb4a0ec[_0xf29d78(0x271)](_0x4b39aa,_0xf29d78(0x17c)),_0x12acb1=a134_0xb4a0ec['join'](_0x4b39aa,_0xf29d78(0x22f)),{yaml:_0x4ef23c,systemPrompt:_0x1d967e,starterMessage:_0x4854cb}=await agentResponseToDef(_0x103eab,_0x241aab),_0x1c6cf6=toAgentYamlString(_0x4ef23c),_0x245fea=!a134_0x4f3caa[_0xf29d78(0x273)](_0x5d2561);let _0x336f3c=_0x245fea,_0x11fadd;if(!_0x245fea){const _0x22fc26=a134_0x4f3caa[_0xf29d78(0x273)](_0x5808e5)?a134_0x4f3caa[_0xf29d78(0x186)](_0x5808e5,_0xf29d78(0x1a7)):'',_0x184fee=a134_0x4f3caa[_0xf29d78(0x186)](_0x5d2561,_0xf29d78(0x1a7)),_0x1c129c=_0xf29d78(0x1ac)+_0x22fc26+_0xf29d78(0x206)+_0x184fee,_0x122b7b='#\x20prompt.md\x0a'+_0x1d967e+_0xf29d78(0x206)+_0x1c6cf6,_0x33849b=generateDiff(_0x1c129c,_0x122b7b);_0x336f3c=hasChanges(_0x33849b),_0x336f3c&&(_0x11fadd=formatDiffWithColors(_0x33849b));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x4b39aa,'content':'','isDir':!![]}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x5808e5,'content':_0x1d967e}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x5d2561,'content':_0x1c6cf6});_0x4854cb&&_0x4854cb['includes']('\x0a')&&_0x2d2735[_0xf29d78(0x277)]({'path':_0x12acb1,'content':_0x4854cb});_0x2ca305[_0xf29d78(0x1bc)][_0xf29d78(0x277)]({'agentName':_0x103eab[_0xf29d78(0x193)][_0xf29d78(0x1da)],'outputPath':_0x4b39aa,'isNew':_0x245fea,'hasChanges':_0x336f3c,'diff':_0x11fadd}),_0x2ca305[_0xf29d78(0x1f6)]['agents'][_0xf29d78(0x17f)]++;if(_0x245fea)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1bc)]['new']++;else{if(_0x336f3c)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1bc)][_0xf29d78(0x232)]++;else _0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1bc)][_0xf29d78(0x23a)]++;}}for(const _0x2d7671 of _0x126dfc){if(_0x2d7671[_0xf29d78(0x193)][_0xf29d78(0x1c4)])continue;const _0x432268=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0xdfd7dd),_0x2d7671[_0xf29d78(0x193)][_0xf29d78(0x1da)],'.yml');_0x432268['renamed']&&this[_0xf29d78(0x1b4)]['info'](_0xf29d78(0x1bd)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x432268[_0xf29d78(0x254)])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x432268[_0xf29d78(0x19a)]));const _0x5a7efa=_0x432268['path'],_0x140838=apiKnowledgeBaseToYaml(_0x2d7671),_0x43bb72=toKnowledgeBaseYamlString(_0x140838),_0x2cdcc2=!a134_0x4f3caa[_0xf29d78(0x273)](_0x5a7efa);let _0x20ee22=_0x2cdcc2,_0x4bc67e;if(!_0x2cdcc2){const _0x40de0c=a134_0x4f3caa[_0xf29d78(0x186)](_0x5a7efa,_0xf29d78(0x1a7)),_0x3bebfb=generateDiff(_0x40de0c,_0x43bb72);_0x20ee22=hasChanges(_0x3bebfb),_0x20ee22&&(_0x4bc67e=formatDiffWithColors(_0x3bebfb));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x5a7efa,'content':_0x43bb72}),_0x2ca305[_0xf29d78(0x1e5)]['push']({'name':_0x2d7671[_0xf29d78(0x193)]['name'],'outputPath':_0x5a7efa,'isNew':_0x2cdcc2,'hasChanges':_0x20ee22,'diff':_0x4bc67e}),_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1e5)][_0xf29d78(0x17f)]++;if(_0x2cdcc2)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1e5)][_0xf29d78(0x1f5)]++;else{if(_0x20ee22)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1e5)][_0xf29d78(0x232)]++;else _0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1e5)]['unchanged']++;}}for(const _0x51b885 of _0x3d9472){if(_0x51b885[_0xf29d78(0x193)][_0xf29d78(0x1c4)])continue;const _0x5d8a7e=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0xdfd7dd),_0x51b885[_0xf29d78(0x193)][_0xf29d78(0x1da)],_0xf29d78(0x1e9));_0x5d8a7e[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x1cc)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x5d8a7e[_0xf29d78(0x254)])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x5d8a7e[_0xf29d78(0x19a)]));const _0x199ab2=_0x5d8a7e[_0xf29d78(0x19a)],_0x1d4664=toTextKnowledgeBaseMd(_0x51b885['attributes'][_0xf29d78(0x1da)],_0x51b885[_0xf29d78(0x193)][_0xf29d78(0x230)]),_0x5b353b=!a134_0x4f3caa['existsSync'](_0x199ab2);let _0x4c3744=_0x5b353b,_0x3de15a;if(!_0x5b353b){const _0x974709=a134_0x4f3caa[_0xf29d78(0x186)](_0x199ab2,_0xf29d78(0x1a7)),_0x1a0b04=generateDiff(_0x974709,_0x1d4664);_0x4c3744=hasChanges(_0x1a0b04),_0x4c3744&&(_0x3de15a=formatDiffWithColors(_0x1a0b04));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x199ab2,'content':_0x1d4664}),_0x2ca305[_0xf29d78(0x25f)]['push']({'name':_0x51b885['attributes'][_0xf29d78(0x1da)],'outputPath':_0x199ab2,'isNew':_0x5b353b,'hasChanges':_0x4c3744,'diff':_0x3de15a}),_0x2ca305[_0xf29d78(0x1f6)]['textKnowledgeBases']['total']++;if(_0x5b353b)_0x2ca305[_0xf29d78(0x1f6)]['textKnowledgeBases'][_0xf29d78(0x1f5)]++;else{if(_0x4c3744)_0x2ca305['counts'][_0xf29d78(0x25f)][_0xf29d78(0x232)]++;else _0x2ca305[_0xf29d78(0x1f6)]['textKnowledgeBases'][_0xf29d78(0x23a)]++;}}for(const _0x54ee17 of _0x43e05c){if(_0x54ee17[_0xf29d78(0x193)]['isManaged'])continue;const _0x5cff93=getSanitizedPathWithMigration(getPromptsDir(_0xdfd7dd),_0x54ee17['attributes']['name'],_0xf29d78(0x1c7));_0x5cff93['renamed']&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x237)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x5cff93['oldPath'])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x5cff93[_0xf29d78(0x19a)]));const _0x569639=_0x5cff93[_0xf29d78(0x19a)],_0x29760c=await apiPromptToYaml(_0x54ee17,_0x241aab);if(!_0x29760c)continue;const _0x5ca7a2=toPromptYamlString(_0x29760c),_0x3a014c=!a134_0x4f3caa[_0xf29d78(0x273)](_0x569639);let _0x2f8478=_0x3a014c,_0x153636;if(!_0x3a014c){const _0x31096c=a134_0x4f3caa[_0xf29d78(0x186)](_0x569639,_0xf29d78(0x1a7)),_0x179d54=generateDiff(_0x31096c,_0x5ca7a2);_0x2f8478=hasChanges(_0x179d54),_0x2f8478&&(_0x153636=formatDiffWithColors(_0x179d54));}_0x2d2735['push']({'path':_0x569639,'content':_0x5ca7a2}),_0x2ca305[_0xf29d78(0x25d)][_0xf29d78(0x277)]({'name':_0x54ee17[_0xf29d78(0x193)][_0xf29d78(0x1da)],'outputPath':_0x569639,'isNew':_0x3a014c,'hasChanges':_0x2f8478,'diff':_0x153636}),_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x25d)][_0xf29d78(0x17f)]++;if(_0x3a014c)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x25d)]['new']++;else{if(_0x2f8478)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x25d)][_0xf29d78(0x232)]++;else _0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x25d)][_0xf29d78(0x23a)]++;}}for(const _0x4d6dcd of _0x1de2e9){const _0x259ca4=_0x4d6dcd[_0xf29d78(0x193)]['serviceType'][_0xf29d78(0x23b)](),_0x2492c5=getSanitizedPathWithMigration(getIntegrationsDir(_0xdfd7dd),_0x259ca4,'.yml');_0x2492c5[_0xf29d78(0x234)]&&this['logger'][_0xf29d78(0x183)](_0xf29d78(0x19d)+a134_0xb4a0ec['basename'](_0x2492c5[_0xf29d78(0x254)])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x2492c5[_0xf29d78(0x19a)]));const _0x2aba39=_0x2492c5[_0xf29d78(0x19a)],_0x2a36fe=await apiIntegrationToYaml(_0x4d6dcd,_0x241aab),_0x5de757=toIntegrationYamlString(_0x2a36fe),_0x52fce5=!a134_0x4f3caa[_0xf29d78(0x273)](_0x2aba39);let _0x5d85a5=_0x52fce5,_0x1e6f10;if(!_0x52fce5){const _0x4abacb=a134_0x4f3caa['readFileSync'](_0x2aba39,'utf-8'),_0x101093=generateDiff(_0x4abacb,_0x5de757);_0x5d85a5=hasChanges(_0x101093),_0x5d85a5&&(_0x1e6f10=formatDiffWithColors(_0x101093));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x2aba39,'content':_0x5de757}),_0x2ca305[_0xf29d78(0x180)]['push']({'name':_0x259ca4,'outputPath':_0x2aba39,'isNew':_0x52fce5,'hasChanges':_0x5d85a5,'diff':_0x1e6f10}),_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x180)]['total']++;if(_0x52fce5)_0x2ca305[_0xf29d78(0x1f6)]['integrations']['new']++;else{if(_0x5d85a5)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x180)]['updated']++;else _0x2ca305['counts'][_0xf29d78(0x180)]['unchanged']++;}}for(const _0x2cf992 of _0x1c730b){if(_0x2cf992[_0xf29d78(0x193)][_0xf29d78(0x1c4)])continue;const _0x402e4e=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0xdfd7dd),_0x2cf992['attributes'][_0xf29d78(0x1da)]);_0x402e4e[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x279)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x402e4e['oldPath'])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x402e4e[_0xf29d78(0x19a)]));const _0x42adba=_0x402e4e['path'],_0x33248e=a134_0xb4a0ec[_0xf29d78(0x271)](_0x42adba,sanitizeForFilesystem(_0x2cf992[_0xf29d78(0x193)][_0xf29d78(0x1da)])+_0xf29d78(0x1c7)),_0x566ed4=a134_0xb4a0ec[_0xf29d78(0x271)](_0x42adba,_0xf29d78(0x24f)),_0x230a99=apiExperimentalKnowledgeBaseToYaml(_0x2cf992),_0x2fbb73=toExperimentalKnowledgeBaseYamlString(_0x230a99),_0x4b2d43=!a134_0x4f3caa[_0xf29d78(0x273)](_0x42adba);let _0x3a7007=_0x4b2d43,_0x390a74,_0x163d51=_0x2fbb73;const _0x4cb1a6=[..._0x230a99['functions']][_0xf29d78(0x23e)]((_0x20c907,_0x20da0e)=>_0x20c907[_0xf29d78(0x1da)][_0xf29d78(0x1ab)](_0x20da0e[_0xf29d78(0x1da)]));for(const _0x38a296 of _0x4cb1a6){_0x163d51+='\x0a---\x20function:\x20'+_0x38a296['name']+_0xf29d78(0x1a2)+_0x38a296[_0xf29d78(0x28a)]+_0xf29d78(0x224)+_0x38a296[_0xf29d78(0x1da)]+'\x20---\x0a'+_0x38a296[_0xf29d78(0x197)]+'\x0a';}if(!_0x4b2d43){let _0x382981='';a134_0x4f3caa[_0xf29d78(0x273)](_0x33248e)&&(_0x382981=a134_0x4f3caa[_0xf29d78(0x186)](_0x33248e,_0xf29d78(0x1a7)));if(a134_0x4f3caa['existsSync'](_0x566ed4)){const _0x478fca=a134_0x4f3caa['readdirSync'](_0x566ed4,{'withFileTypes':!![]}),_0x420565=_0x478fca[_0xf29d78(0x18a)](_0x362e2e=>_0x362e2e[_0xf29d78(0x27e)]())[_0xf29d78(0x23e)]((_0x35aeeb,_0x353f3d)=>_0x35aeeb[_0xf29d78(0x1da)][_0xf29d78(0x1ab)](_0x353f3d[_0xf29d78(0x1da)]));for(const _0x196fb6 of _0x420565){const _0x464e26=a134_0xb4a0ec[_0xf29d78(0x271)](_0x566ed4,_0x196fb6[_0xf29d78(0x1da)],'code.js'),_0x114826=a134_0xb4a0ec['join'](_0x566ed4,_0x196fb6[_0xf29d78(0x1da)],_0xf29d78(0x1c8));a134_0x4f3caa[_0xf29d78(0x273)](_0x464e26)&&(_0x382981+=_0xf29d78(0x226)+_0x196fb6[_0xf29d78(0x1da)]+'\x20---\x0a'+a134_0x4f3caa[_0xf29d78(0x186)](_0x464e26,_0xf29d78(0x1a7))+'\x0a'),a134_0x4f3caa[_0xf29d78(0x273)](_0x114826)&&(_0x382981+=_0xf29d78(0x217)+_0x196fb6[_0xf29d78(0x1da)]+_0xf29d78(0x1a2)+a134_0x4f3caa['readFileSync'](_0x114826,_0xf29d78(0x1a7))+'\x0a');}}const _0x3eae3d=generateDiff(_0x382981,_0x163d51);_0x3a7007=hasChanges(_0x3eae3d),_0x3a7007&&(_0x390a74=formatDiffWithColors(_0x3eae3d));}_0x2d2735['push']({'path':_0x42adba,'content':'','isDir':!![]}),_0x2d2735['push']({'path':_0x33248e,'content':_0x2fbb73}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x566ed4,'content':'','isDir':!![]});for(const _0x2325c6 of _0x230a99[_0xf29d78(0x24f)]){const _0x4202c3=a134_0xb4a0ec[_0xf29d78(0x271)](_0x566ed4,sanitizeForFilesystem(_0x2325c6[_0xf29d78(0x1da)])),_0x6e604b=a134_0xb4a0ec[_0xf29d78(0x271)](_0x4202c3,_0xf29d78(0x212)),_0x11779c=a134_0xb4a0ec['join'](_0x4202c3,_0xf29d78(0x1c8));_0x2d2735[_0xf29d78(0x277)]({'path':_0x4202c3,'content':'','isDir':!![]}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x6e604b,'content':_0x2325c6[_0xf29d78(0x28a)]}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x11779c,'content':_0x2325c6['json_schema']});}if(a134_0x4f3caa['existsSync'](_0x566ed4)){const _0xad1dec=a134_0x4f3caa[_0xf29d78(0x249)](_0x566ed4,{'withFileTypes':!![]}),_0x2f388e=new Set(_0x230a99[_0xf29d78(0x24f)][_0xf29d78(0x1ca)](_0x5867fb=>sanitizeForFilesystem(_0x5867fb[_0xf29d78(0x1da)])));for(const _0x40f7b6 of _0xad1dec){if(_0x40f7b6[_0xf29d78(0x27e)]()&&!_0x2f388e['has'](_0x40f7b6[_0xf29d78(0x1da)])){const _0x1562e3=a134_0xb4a0ec[_0xf29d78(0x271)](_0x566ed4,_0x40f7b6[_0xf29d78(0x1da)]);_0x4fa164[_0xf29d78(0x277)]({'path':_0x1562e3,'isDir':!![]});}}}_0x2ca305[_0xf29d78(0x1cb)][_0xf29d78(0x277)]({'name':_0x2cf992[_0xf29d78(0x193)]['name'],'outputPath':_0x42adba,'isNew':_0x4b2d43,'hasChanges':_0x3a7007,'diff':_0x390a74}),_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1cb)][_0xf29d78(0x17f)]++;if(_0x4b2d43)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1cb)][_0xf29d78(0x1f5)]++;else{if(_0x3a7007)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1cb)][_0xf29d78(0x232)]++;else _0x2ca305['counts'][_0xf29d78(0x1cb)][_0xf29d78(0x23a)]++;}}for(const _0x5b2201 of _0x993f1c){if(_0x5b2201[_0xf29d78(0x193)][_0xf29d78(0x1c4)])continue;const _0x2bfaab=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0xdfd7dd),_0x5b2201['attributes'][_0xf29d78(0x1da)]);_0x2bfaab[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x244)+a134_0xb4a0ec['basename'](_0x2bfaab[_0xf29d78(0x254)])+'\x20→\x20'+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x2bfaab[_0xf29d78(0x19a)]));const _0x1cad31=_0x2bfaab[_0xf29d78(0x19a)],_0x55c133=a134_0xb4a0ec[_0xf29d78(0x271)](_0x1cad31,sanitizeForFilesystem(_0x5b2201[_0xf29d78(0x193)][_0xf29d78(0x1da)])+_0xf29d78(0x1c7)),_0x3c834b=a134_0xb4a0ec[_0xf29d78(0x271)](_0x1cad31,_0xf29d78(0x212)),_0x2d5e54=a134_0xb4a0ec['join'](_0x1cad31,_0xf29d78(0x200)),_0x3867ec=apiExperimentalArtifactToYaml(_0x5b2201),_0x1e9f5d=toExperimentalArtifactYamlString(_0x3867ec),_0x33d6a2=!a134_0x4f3caa[_0xf29d78(0x273)](_0x1cad31);let _0x4bc959=_0x33d6a2,_0x301806,_0x37dbd7=_0x1e9f5d+(_0xf29d78(0x18e)+_0x3867ec[_0xf29d78(0x28a)]+'\x0a');const _0x538a27=[..._0x3867ec[_0xf29d78(0x200)]]['sort']((_0xa2e0e4,_0x495715)=>_0xa2e0e4[_0xf29d78(0x295)]['localeCompare'](_0x495715['file_name']));for(const _0x587708 of _0x538a27){_0x37dbd7+=_0xf29d78(0x1be)+_0x587708[_0xf29d78(0x295)]+_0xf29d78(0x1a2)+_0x587708[_0xf29d78(0x296)]+'\x0a';}if(!_0x33d6a2){let _0x1fe6fe='';a134_0x4f3caa['existsSync'](_0x55c133)&&(_0x1fe6fe=a134_0x4f3caa[_0xf29d78(0x186)](_0x55c133,_0xf29d78(0x1a7)));a134_0x4f3caa[_0xf29d78(0x273)](_0x3c834b)&&(_0x1fe6fe+=_0xf29d78(0x18e)+a134_0x4f3caa['readFileSync'](_0x3c834b,'utf-8')+'\x0a');if(a134_0x4f3caa[_0xf29d78(0x273)](_0x2d5e54)){const _0x300fe1=a134_0x4f3caa['readdirSync'](_0x2d5e54),_0x1358d1=_0x300fe1[_0xf29d78(0x18a)](_0x6730f3=>{const _0x21d8c0=_0xf29d78,_0x20f754=a134_0xb4a0ec[_0x21d8c0(0x271)](_0x2d5e54,_0x6730f3);return a134_0x4f3caa[_0x21d8c0(0x268)](_0x20f754)[_0x21d8c0(0x205)]();})['sort']((_0x4ea3f9,_0x485089)=>_0x4ea3f9[_0xf29d78(0x1ab)](_0x485089));for(const _0x5f3357 of _0x1358d1){const _0x888580=a134_0xb4a0ec['join'](_0x2d5e54,_0x5f3357);_0x1fe6fe+=_0xf29d78(0x1be)+_0x5f3357+_0xf29d78(0x1a2)+a134_0x4f3caa[_0xf29d78(0x186)](_0x888580,_0xf29d78(0x1a7))+'\x0a';}}const _0x412aa7=generateDiff(_0x1fe6fe,_0x37dbd7);_0x4bc959=hasChanges(_0x412aa7),_0x4bc959&&(_0x301806=formatDiffWithColors(_0x412aa7));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x1cad31,'content':'','isDir':!![]}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x55c133,'content':_0x1e9f5d}),_0x2d2735['push']({'path':_0x3c834b,'content':_0x3867ec[_0xf29d78(0x28a)]});if(_0x3867ec[_0xf29d78(0x200)][_0xf29d78(0x189)]>0x0){_0x2d2735[_0xf29d78(0x277)]({'path':_0x2d5e54,'content':'','isDir':!![]});for(const _0x48a1c7 of _0x3867ec[_0xf29d78(0x200)]){const _0x4c3410=a134_0xb4a0ec[_0xf29d78(0x271)](_0x2d5e54,_0x48a1c7['file_name']);_0x2d2735[_0xf29d78(0x277)]({'path':_0x4c3410,'content':_0x48a1c7[_0xf29d78(0x296)]});}}if(a134_0x4f3caa[_0xf29d78(0x273)](_0x2d5e54)){const _0x390861=a134_0x4f3caa[_0xf29d78(0x249)](_0x2d5e54),_0x1551c0=new Set(_0x3867ec[_0xf29d78(0x200)][_0xf29d78(0x1ca)](_0x1800aa=>_0x1800aa['file_name']));for(const _0x205ae3 of _0x390861){const _0x20147c=a134_0xb4a0ec[_0xf29d78(0x271)](_0x2d5e54,_0x205ae3);a134_0x4f3caa[_0xf29d78(0x268)](_0x20147c)[_0xf29d78(0x205)]()&&!_0x1551c0[_0xf29d78(0x17b)](_0x205ae3)&&_0x4fa164['push']({'path':_0x20147c});}}_0x2ca305['experimentalArtifacts']['push']({'name':_0x5b2201[_0xf29d78(0x193)]['name'],'outputPath':_0x1cad31,'isNew':_0x33d6a2,'hasChanges':_0x4bc959,'diff':_0x301806}),_0x2ca305['counts'][_0xf29d78(0x20a)]['total']++;if(_0x33d6a2)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x20a)][_0xf29d78(0x1f5)]++;else{if(_0x4bc959)_0x2ca305[_0xf29d78(0x1f6)]['experimentalArtifacts'][_0xf29d78(0x232)]++;else _0x2ca305['counts']['experimentalArtifacts']['unchanged']++;}}for(const _0x33334 of _0x265ea1){const _0x48ea4d=getSanitizedPathWithMigration(getFormInterfacesDir(_0xdfd7dd),_0x33334[_0xf29d78(0x193)][_0xf29d78(0x1da)],_0xf29d78(0x1c7));_0x48ea4d[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x187)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x48ea4d[_0xf29d78(0x254)])+'\x20→\x20'+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x48ea4d[_0xf29d78(0x19a)]));const _0x29c772=_0x48ea4d['path'],_0x38a3ee=await apiFormInterfaceToYaml(_0x33334,_0x241aab),_0x13ca79=toFormInterfaceYamlString(_0x38a3ee),_0x2b2706=!a134_0x4f3caa[_0xf29d78(0x273)](_0x29c772);let _0x595c80=_0x2b2706,_0x1f147b;if(!_0x2b2706){const _0x4461e8=a134_0x4f3caa[_0xf29d78(0x186)](_0x29c772,_0xf29d78(0x1a7)),_0x1e8377=generateDiff(_0x4461e8,_0x13ca79);_0x595c80=hasChanges(_0x1e8377),_0x595c80&&(_0x1f147b=formatDiffWithColors(_0x1e8377));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x29c772,'content':_0x13ca79}),_0x2ca305['formInterfaces'][_0xf29d78(0x277)]({'name':_0x33334[_0xf29d78(0x193)][_0xf29d78(0x1da)],'outputPath':_0x29c772,'isNew':_0x2b2706,'hasChanges':_0x595c80,'diff':_0x1f147b}),_0x2ca305[_0xf29d78(0x1f6)]['formInterfaces'][_0xf29d78(0x17f)]++;if(_0x2b2706)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x194)]['new']++;else{if(_0x595c80)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x194)][_0xf29d78(0x232)]++;else _0x2ca305['counts'][_0xf29d78(0x194)]['unchanged']++;}}for(const _0x3a1b37 of _0x5de67f){if(_0x3a1b37[_0xf29d78(0x193)][_0xf29d78(0x1c4)])continue;const _0x2fb407=getSanitizedPathWithMigration(getChatInterfacesDir(_0xdfd7dd),_0x3a1b37['attributes']['name'],_0xf29d78(0x1c7));_0x2fb407[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x1e7)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x2fb407[_0xf29d78(0x254)])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x2fb407[_0xf29d78(0x19a)]));const _0x166b5a=_0x2fb407[_0xf29d78(0x19a)],_0x2cdf15=await apiChatInterfaceToYaml(_0x3a1b37,_0x241aab),_0xbc08f=toChatInterfaceYamlString(_0x2cdf15),_0x36d2db=!a134_0x4f3caa[_0xf29d78(0x273)](_0x166b5a);let _0x5837ad=_0x36d2db,_0x550b52;if(!_0x36d2db){const _0x23c990=a134_0x4f3caa['readFileSync'](_0x166b5a,_0xf29d78(0x1a7)),_0x5ca427=generateDiff(_0x23c990,_0xbc08f);_0x5837ad=hasChanges(_0x5ca427),_0x5837ad&&(_0x550b52=formatDiffWithColors(_0x5ca427));}_0x2d2735['push']({'path':_0x166b5a,'content':_0xbc08f}),_0x2ca305[_0xf29d78(0x266)][_0xf29d78(0x277)]({'name':_0x3a1b37[_0xf29d78(0x193)][_0xf29d78(0x1da)],'outputPath':_0x166b5a,'isNew':_0x36d2db,'hasChanges':_0x5837ad,'diff':_0x550b52}),_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x266)][_0xf29d78(0x17f)]++;if(_0x36d2db)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x266)][_0xf29d78(0x1f5)]++;else{if(_0x5837ad)_0x2ca305['counts']['chatInterfaces'][_0xf29d78(0x232)]++;else _0x2ca305[_0xf29d78(0x1f6)]['chatInterfaces'][_0xf29d78(0x23a)]++;}}if(_0x34d44e?.[_0xf29d78(0x248)])return _0x2ca305;a134_0x4f3caa[_0xf29d78(0x20f)](_0xdfd7dd,{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x20f)](getKnowledgeBasesDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa['mkdirSync'](getPromptsDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x20f)](getIntegrationsDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x20f)](getExperimentalKnowledgeBasesDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa['mkdirSync'](getExperimentalArtifactsDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x20f)](getFormInterfacesDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x20f)](getChatInterfacesDir(_0xdfd7dd),{'recursive':!![]});const _0x52d1a7=a134_0xb4a0ec['join'](_0xdfd7dd,_0xf29d78(0x1f8));a134_0x4f3caa['writeFileSync'](_0x52d1a7,createAgentConfigContent(_0x14b4cd));for(const _0x16848e of _0x2d2735){if(_0x16848e[_0xf29d78(0x1ee)])a134_0x4f3caa[_0xf29d78(0x20f)](_0x16848e[_0xf29d78(0x19a)],{'recursive':!![]});else{const _0xce03cd=a134_0xb4a0ec['dirname'](_0x16848e['path']);!a134_0x4f3caa['existsSync'](_0xce03cd)&&a134_0x4f3caa[_0xf29d78(0x20f)](_0xce03cd,{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x188)](_0x16848e[_0xf29d78(0x19a)],_0x16848e[_0xf29d78(0x27d)]);}}for(const _0xdc8710 of _0x4fa164){_0xdc8710['isDir']?(a134_0x4f3caa[_0xf29d78(0x218)](_0xdc8710[_0xf29d78(0x19a)],{'recursive':!![],'force':!![]}),this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x1e4)+a134_0xb4a0ec[_0xf29d78(0x23c)](a134_0xb4a0ec['dirname'](_0xdc8710['path']))+'/'+a134_0xb4a0ec[_0xf29d78(0x23c)](_0xdc8710[_0xf29d78(0x19a)]))):(a134_0x4f3caa[_0xf29d78(0x218)](_0xdc8710[_0xf29d78(0x19a)],{'force':!![]}),this[_0xf29d78(0x1b4)]['info'](_0xf29d78(0x21a)+a134_0xb4a0ec[_0xf29d78(0x23c)](a134_0xb4a0ec[_0xf29d78(0x284)](_0xdc8710[_0xf29d78(0x19a)]))+'/'+a134_0xb4a0ec[_0xf29d78(0x23c)](_0xdc8710[_0xf29d78(0x19a)])));}return _0x2ca305;}async['pushProject'](_0x49eda2,_0xa08415){const _0x23ebf3=a134_0x1280fc,_0x404ebb=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x49eda2,_0x23ebf3(0x1f8));if(!a134_0x4f3caa[_0x23ebf3(0x273)](_0x404ebb))throw new SDKError(ErrorCode[_0x23ebf3(0x207)],'No\x20tdx.json\x20found\x20in\x20'+_0x49eda2,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x38878e=loadAgentConfig(_0x404ebb),_0xe54f73=await this['resolveProjectId'](_0x38878e[_0x23ebf3(0x280)]),_0x3d2ae7=await this[_0x23ebf3(0x203)]['getProject'](_0xe54f73),_0x519d5f=_0x3d2ae7[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0xd109b3={'projectName':_0x519d5f,'projectId':_0xe54f73,'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}}},_0x2fe103=[],_0x28d482=[],_0x45a269=[],_0x2bd3f5=[],_0x36233a=[],_0x122fc5=[],_0x5e71c8=a134_0x4f3caa[_0x23ebf3(0x249)](_0x49eda2,{'withFileTypes':!![]});for(const _0x64ddb6 of _0x5e71c8){if(!_0x64ddb6[_0x23ebf3(0x27e)]())continue;if([_0x23ebf3(0x20d),_0x23ebf3(0x25d),_0x23ebf3(0x180),_0x23ebf3(0x283),_0x23ebf3(0x213),_0x23ebf3(0x223),_0x23ebf3(0x1c1)][_0x23ebf3(0x20c)](_0x64ddb6[_0x23ebf3(0x1da)]))continue;const _0x513d7b=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x49eda2,_0x64ddb6['name']);if(isAgentDir(_0x513d7b)){const _0x30cc7d=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x513d7b,'agent.yml'),_0x4253ae=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x513d7b,_0x23ebf3(0x214)),_0x4c01ae=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x513d7b,_0x23ebf3(0x22f)),_0x26a75c=parseAgentYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x30cc7d,_0x23ebf3(0x1a7)),_0x30cc7d),_0x65bea9=a134_0x4f3caa[_0x23ebf3(0x273)](_0x4253ae)?a134_0x4f3caa[_0x23ebf3(0x186)](_0x4253ae,_0x23ebf3(0x1a7)):'',_0x5e3e9d=a134_0x4f3caa[_0x23ebf3(0x273)](_0x4c01ae)?a134_0x4f3caa[_0x23ebf3(0x186)](_0x4c01ae,_0x23ebf3(0x1a7)):_0x26a75c[_0x23ebf3(0x1ec)];_0x2fe103['push']({'name':_0x26a75c[_0x23ebf3(0x1da)],'dir':_0x513d7b,'yaml':_0x26a75c,'systemPrompt':_0x65bea9,'starterMessage':_0x5e3e9d});}}const _0x5420eb=getKnowledgeBasesDir(_0x49eda2);if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x5420eb)){const _0x811129=a134_0x4f3caa[_0x23ebf3(0x249)](_0x5420eb);for(const _0x1dc257 of _0x811129){const _0x311e0a=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x5420eb,_0x1dc257);if(_0x1dc257[_0x23ebf3(0x1e6)](_0x23ebf3(0x1c7))){const _0x5bdf81=parseKnowledgeBaseYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x311e0a,_0x23ebf3(0x1a7)),_0x311e0a);_0x28d482[_0x23ebf3(0x277)]({'name':_0x5bdf81[_0x23ebf3(0x1da)],'path':_0x311e0a,'yaml':_0x5bdf81});}else{if(_0x1dc257[_0x23ebf3(0x1e6)]('.md')){const _0x15c10d=a134_0x4f3caa[_0x23ebf3(0x186)](_0x311e0a,_0x23ebf3(0x1a7)),{name:_0x4c67ce,text:_0x3dc2bd}=parseTextKnowledgeBaseMd(_0x15c10d,_0x1dc257);_0x45a269[_0x23ebf3(0x277)]({'name':_0x4c67ce,'path':_0x311e0a,'text':_0x3dc2bd});}}}}const _0xc68f93=getPromptsDir(_0x49eda2);if(a134_0x4f3caa['existsSync'](_0xc68f93)){const _0x30030e=a134_0x4f3caa['readdirSync'](_0xc68f93)[_0x23ebf3(0x18a)](_0x104be1=>_0x104be1[_0x23ebf3(0x1e6)](_0x23ebf3(0x1c7)));for(const _0x2ce7a8 of _0x30030e){const _0x481757=a134_0xb4a0ec[_0x23ebf3(0x271)](_0xc68f93,_0x2ce7a8),_0x2f9672=parsePromptYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x481757,_0x23ebf3(0x1a7)),_0x481757);_0x2bd3f5[_0x23ebf3(0x277)]({'name':_0x2f9672[_0x23ebf3(0x1da)],'path':_0x481757,'yaml':_0x2f9672});}}const _0x13d6c4=[],_0x2ef806=getIntegrationsDir(_0x49eda2);if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x2ef806)){const _0x11853f=a134_0x4f3caa[_0x23ebf3(0x249)](_0x2ef806)[_0x23ebf3(0x18a)](_0x4822e3=>_0x4822e3[_0x23ebf3(0x1e6)](_0x23ebf3(0x1c7)));for(const _0x3103c6 of _0x11853f){const _0x9e5e1e=a134_0xb4a0ec['join'](_0x2ef806,_0x3103c6),_0x315028=parseIntegrationYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x9e5e1e,_0x23ebf3(0x1a7)),_0x9e5e1e);if(!SAFE_INTEGRATION_TYPES['includes'](_0x315028[_0x23ebf3(0x1b8)][_0x23ebf3(0x23b)]())){this[_0x23ebf3(0x1b4)][_0x23ebf3(0x1eb)](_0x23ebf3(0x209)+_0x315028['name']+_0x23ebf3(0x21d)+_0x315028['service_type']+'):\x20'+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES[_0x23ebf3(0x271)](',\x20')+_0x23ebf3(0x1ed))+_0x23ebf3(0x184));continue;}_0x13d6c4[_0x23ebf3(0x277)]({'name':_0x315028[_0x23ebf3(0x1da)],'path':_0x9e5e1e,'yaml':_0x315028});}}const _0x30c51a=getExperimentalKnowledgeBasesDir(_0x49eda2);if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x30c51a)){const _0x4bc792=a134_0x4f3caa['readdirSync'](_0x30c51a,{'withFileTypes':!![]});for(const _0x43b673 of _0x4bc792){if(!_0x43b673[_0x23ebf3(0x27e)]())continue;const _0x443d2a=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x30c51a,_0x43b673[_0x23ebf3(0x1da)]),_0x3dbc96=a134_0xb4a0ec['join'](_0x443d2a,_0x43b673[_0x23ebf3(0x1da)]+_0x23ebf3(0x1c7)),_0x2dcffd=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x443d2a,'functions');if(!a134_0x4f3caa[_0x23ebf3(0x273)](_0x3dbc96))continue;const _0x202459=parseExperimentalKnowledgeBaseYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x3dbc96,'utf-8'),_0x3dbc96),_0x398e02=[];if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x2dcffd)){const _0x2d7415=a134_0x4f3caa[_0x23ebf3(0x249)](_0x2dcffd,{'withFileTypes':!![]});for(const _0x3136d6 of _0x2d7415){if(!_0x3136d6[_0x23ebf3(0x27e)]())continue;const _0x93ea58=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x2dcffd,_0x3136d6[_0x23ebf3(0x1da)]),_0x1ce00d=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x93ea58,_0x23ebf3(0x212)),_0x353f33=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x93ea58,_0x23ebf3(0x1c8));a134_0x4f3caa[_0x23ebf3(0x273)](_0x1ce00d)&&a134_0x4f3caa[_0x23ebf3(0x273)](_0x353f33)&&_0x398e02['push']({'name':_0x3136d6[_0x23ebf3(0x1da)],'code':a134_0x4f3caa[_0x23ebf3(0x186)](_0x1ce00d,_0x23ebf3(0x1a7)),'json_schema':a134_0x4f3caa[_0x23ebf3(0x186)](_0x353f33,_0x23ebf3(0x1a7))});}}const _0x14192c={..._0x202459,'variables':_0x202459['variables']||[],'functions':_0x398e02};_0x36233a[_0x23ebf3(0x277)]({'name':_0x202459['name'],'dir':_0x443d2a,'def':_0x14192c});}}const _0x4332de=getExperimentalArtifactsDir(_0x49eda2);if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x4332de)){const _0x231b2b=a134_0x4f3caa[_0x23ebf3(0x249)](_0x4332de,{'withFileTypes':!![]});for(const _0x439bc7 of _0x231b2b){if(!_0x439bc7['isDirectory']())continue;const _0x564b73=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x4332de,_0x439bc7[_0x23ebf3(0x1da)]),_0x4a7fcd=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x564b73,_0x439bc7['name']+'.yml'),_0x55297a=a134_0xb4a0ec['join'](_0x564b73,_0x23ebf3(0x212)),_0x49a3a3=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x564b73,'files');if(!a134_0x4f3caa[_0x23ebf3(0x273)](_0x4a7fcd)||!a134_0x4f3caa[_0x23ebf3(0x273)](_0x55297a))continue;const _0x4cf2e3=parseExperimentalArtifactYaml(a134_0x4f3caa['readFileSync'](_0x4a7fcd,'utf-8'),_0x4a7fcd),_0x17d2e7=a134_0x4f3caa[_0x23ebf3(0x186)](_0x55297a,'utf-8'),_0x47c17f=[];if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x49a3a3)){const _0x3e9d1d=a134_0x4f3caa[_0x23ebf3(0x249)](_0x49a3a3);for(const _0x55f40c of _0x3e9d1d){const _0x27174c=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x49a3a3,_0x55f40c);a134_0x4f3caa[_0x23ebf3(0x268)](_0x27174c)[_0x23ebf3(0x205)]()&&_0x47c17f['push']({'file_name':_0x55f40c,'text_content':a134_0x4f3caa['readFileSync'](_0x27174c,_0x23ebf3(0x1a7))});}}const _0xebba13={..._0x4cf2e3,'code':_0x17d2e7,'files':_0x47c17f};_0x122fc5[_0x23ebf3(0x277)]({'name':_0x4cf2e3['name'],'dir':_0x564b73,'def':_0xebba13});}}const _0x29f193=[],_0x92e15e=getFormInterfacesDir(_0x49eda2);if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x92e15e)){const _0x30de2e=a134_0x4f3caa[_0x23ebf3(0x249)](_0x92e15e)[_0x23ebf3(0x18a)](_0x4e011a=>_0x4e011a['endsWith']('.yml'));for(const _0x245afd of _0x30de2e){const _0x3abf82=a134_0xb4a0ec['join'](_0x92e15e,_0x245afd),_0x3c9a19=parseFormInterfaceYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x3abf82,_0x23ebf3(0x1a7)),_0x3abf82);_0x29f193[_0x23ebf3(0x277)]({'name':_0x3c9a19[_0x23ebf3(0x1da)],'path':_0x3abf82,'yaml':_0x3c9a19});}}const _0x108c54=[],_0x7d3da6=getChatInterfacesDir(_0x49eda2);if(a134_0x4f3caa['existsSync'](_0x7d3da6)){const _0x1a4e50=a134_0x4f3caa[_0x23ebf3(0x249)](_0x7d3da6)[_0x23ebf3(0x18a)](_0x365e35=>_0x365e35[_0x23ebf3(0x1e6)](_0x23ebf3(0x1c7)));for(const _0x12adf7 of _0x1a4e50){const _0x44595b=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x7d3da6,_0x12adf7),_0x3da76a=parseChatInterfaceYaml(a134_0x4f3caa['readFileSync'](_0x44595b,_0x23ebf3(0x1a7)),_0x44595b);_0x108c54[_0x23ebf3(0x277)]({'name':_0x3da76a['name'],'path':_0x44595b,'yaml':_0x3da76a});}}const _0x3e3d02=await this[_0x23ebf3(0x203)][_0x23ebf3(0x1e1)](_0xe54f73),_0x1a26f0=await this['client'][_0x23ebf3(0x247)](_0xe54f73),_0xae9c3e=await this['client'][_0x23ebf3(0x190)](_0xe54f73),_0x5c80a2=await this[_0x23ebf3(0x203)][_0x23ebf3(0x18b)](_0xe54f73),_0x118ad1=await this[_0x23ebf3(0x203)]['listIntegrations'](_0xe54f73),_0x159b8f=await safeListOrEmpty(()=>this[_0x23ebf3(0x203)][_0x23ebf3(0x1dd)](_0xe54f73)),_0x169577=await safeListOrEmpty(()=>this[_0x23ebf3(0x203)]['listExperimentalArtifacts'](_0xe54f73)),_0x20d24d=await safeListOrEmpty(()=>this[_0x23ebf3(0x203)][_0x23ebf3(0x22a)](_0xe54f73)),_0x1a2b4a=await safeListOrEmpty(()=>this[_0x23ebf3(0x203)][_0x23ebf3(0x1bb)](_0xe54f73)),_0x5ea292=await fetchAllToolTargetMaps((_0x3c0774,_0x2141d6)=>this[_0x23ebf3(0x203)][_0x23ebf3(0x24c)](_0x3c0774,_0x2141d6),_0xe54f73),_0x4969ef=new Map(),_0x470d3e=new Map(),_0x4ea27b=new Map(),_0x530c8c=new Map(),_0x49e608=new Map(),_0x2fa7fe=new Map(),_0x3a6ab3=new Map();for(const _0x1ca8f2 of _0x3e3d02){_0x4969ef[_0x23ebf3(0x26f)](_0x1ca8f2[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x1ca8f2);}for(const _0x31a11d of _0x1a26f0){_0x470d3e[_0x23ebf3(0x26f)](_0x31a11d[_0x23ebf3(0x193)]['name'],_0x31a11d);}for(const _0x14ac4c of _0xae9c3e){_0x4ea27b[_0x23ebf3(0x26f)](_0x14ac4c['attributes'][_0x23ebf3(0x1da)],_0x14ac4c);}for(const _0x30053e of _0x5c80a2){_0x530c8c['set'](_0x30053e[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x30053e);}for(const _0x5c953c of _0x118ad1){_0x49e608[_0x23ebf3(0x26f)](_0x5c953c['attributes'][_0x23ebf3(0x28f)]['toLowerCase'](),_0x5c953c);}for(const _0x8defda of _0x159b8f){_0x2fa7fe['set'](_0x8defda[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x8defda);}for(const _0xe5838f of _0x169577){_0x3a6ab3[_0x23ebf3(0x26f)](_0xe5838f[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0xe5838f);}const _0x4d167e=new Map(),_0x226e44=new Map();for(const _0x53fc47 of _0x20d24d){_0x4d167e[_0x23ebf3(0x26f)](_0x53fc47[_0x23ebf3(0x193)]['name'],_0x53fc47);}for(const _0x3cf412 of _0x1a2b4a){_0x226e44[_0x23ebf3(0x26f)](_0x3cf412[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x3cf412);}const _0x3acc7d=new Map(),_0x3d3ae7=new Map();for(const _0x3df1ec of _0x3e3d02){_0x3acc7d[_0x23ebf3(0x26f)](_0x3df1ec[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x3df1ec['id']),_0x3d3ae7[_0x23ebf3(0x26f)](_0x3df1ec['id'],_0x3df1ec[_0x23ebf3(0x193)][_0x23ebf3(0x1da)]);}const _0x51dea4=new Map(),_0x42fdc8=new Map();for(const _0x53ed04 of _0x5c80a2){_0x51dea4['set'](_0x53ed04[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x53ed04['id']),_0x42fdc8[_0x23ebf3(0x26f)](_0x53ed04['id'],_0x53ed04[_0x23ebf3(0x193)]['name']);}const _0xd25b66=_0x5ea292['nameToId'][_0x23ebf3(0x219)]||new Map(),_0x553293=_0x5ea292['nameToId'][_0x23ebf3(0x282)]||new Map(),_0x5753f5=_0x5ea292[_0x23ebf3(0x288)]['ExperimentalKnowledgeBase']||new Map(),_0xadf01f=new Map(),_0x1286b9={'resolveToolTargetName':buildNameResolver({..._0x5ea292[_0x23ebf3(0x292)],'Agent':_0x3d3ae7}),'resolvePromptName':async _0xf32e83=>_0x42fdc8['get'](_0xf32e83),'onWarning':_0x4b12c2=>this[_0x23ebf3(0x1b4)][_0x23ebf3(0x1eb)](_0x4b12c2)};let _0x1dafc5=[];const _0x23718f={'projectId':_0xe54f73,'resolveToolTargetId':buildIdResolver({..._0x5ea292[_0x23ebf3(0x288)],'Agent':_0x3acc7d}),'resolvePromptId':async _0x1bf33c=>_0x51dea4[_0x23ebf3(0x1c0)](_0x1bf33c),'onWarning':_0x44b937=>{const _0x802bd=_0x23ebf3;this[_0x802bd(0x1b4)]['warn'](_0x44b937),_0x1dafc5[_0x802bd(0x277)](_0x44b937);}},{resolved:_0xa14eff,unresolved:_0x259343}=resolveAgentDependencies(_0x2fe103,new Set(_0x4969ef[_0x23ebf3(0x1a4)]()));for(const {agent:_0x10d6a1,missingDeps:_0x3d0e4b}of _0x259343){_0xd109b3['agents']['push']({'agentName':_0x10d6a1[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x23ebf3(0x253)+_0x3d0e4b[_0x23ebf3(0x271)](',\x20')+_0x23ebf3(0x211)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1bc)][_0x23ebf3(0x1a5)]++;}for(const _0x2e227c of _0x28d482){const _0x749a1f=_0x470d3e[_0x23ebf3(0x1c0)](_0x2e227c[_0x23ebf3(0x28b)]['name']),_0x1d4328=a134_0x4f3caa['readFileSync'](_0x2e227c[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x749a1f){const _0x7564fe=apiKnowledgeBaseToYaml(_0x749a1f),_0x13a9bf=toKnowledgeBaseYamlString(_0x7564fe),_0x2688f3=generateDiff(_0x13a9bf,_0x1d4328),_0x29e89a=hasChanges(_0x2688f3);_0x29e89a?(_0xd109b3[_0x23ebf3(0x1e5)][_0x23ebf3(0x277)]({'name':_0x2e227c[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x749a1f['id'],'diff':formatDiffWithColors(_0x2688f3)}),_0xd109b3[_0x23ebf3(0x1f6)]['knowledgeBases'][_0x23ebf3(0x232)]++):(_0xd109b3['knowledgeBases'][_0x23ebf3(0x277)]({'name':_0x2e227c['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x23a),'id':_0x749a1f['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['knowledgeBases'][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x1e5)][_0x23ebf3(0x277)]({'name':_0x2e227c['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b)}),_0xd109b3['counts']['knowledgeBases'][_0x23ebf3(0x27b)]++;}for(const _0x920566 of _0x45a269){const _0x5456a5=_0x4ea27b[_0x23ebf3(0x1c0)](_0x920566[_0x23ebf3(0x1da)]),_0x5b45a0=a134_0x4f3caa[_0x23ebf3(0x186)](_0x920566[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x5456a5){const _0x379e31=toTextKnowledgeBaseMd(_0x5456a5['attributes'][_0x23ebf3(0x1da)],_0x5456a5['attributes'][_0x23ebf3(0x230)]),_0x1d59c2=generateDiff(_0x379e31,_0x5b45a0),_0x2f69bc=hasChanges(_0x1d59c2);_0x2f69bc?(_0xd109b3[_0x23ebf3(0x25f)]['push']({'name':_0x920566[_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x5456a5['id'],'diff':formatDiffWithColors(_0x1d59c2)}),_0xd109b3['counts']['textKnowledgeBases'][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x25f)]['push']({'name':_0x920566['name'],'action':_0x23ebf3(0x23a),'id':_0x5456a5['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25f)][_0x23ebf3(0x23a)]++);}else _0xd109b3['textKnowledgeBases'][_0x23ebf3(0x277)]({'name':_0x920566[_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b)}),_0xd109b3[_0x23ebf3(0x1f6)]['textKnowledgeBases'][_0x23ebf3(0x27b)]++;}for(const _0x33574d of _0xa14eff){const _0x3c4922=_0x4969ef[_0x23ebf3(0x1c0)](_0x33574d[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)]),_0x5e98d6=a134_0xb4a0ec['join'](_0x33574d[_0x23ebf3(0x227)],_0x23ebf3(0x17c)),_0x147159=a134_0x4f3caa['readFileSync'](_0x5e98d6,'utf-8'),_0x1c46b7=_0x33574d['systemPrompt'],_0x37e0e8=_0x23ebf3(0x1ac)+_0x1c46b7+'\x0a\x0a#\x20agent.yml\x0a'+_0x147159;if(_0x3c4922){const {yaml:_0x2018db,systemPrompt:_0x4b15fb}=await agentResponseToDef(_0x3c4922,_0x1286b9),_0x220780=toAgentYamlString(_0x2018db),_0x114bb7='#\x20prompt.md\x0a'+_0x4b15fb+_0x23ebf3(0x206)+_0x220780,_0x32cd47=generateDiff(_0x114bb7,_0x37e0e8),_0x25cfa1=hasChanges(_0x32cd47);_0x25cfa1?(_0xd109b3[_0x23ebf3(0x1bc)][_0x23ebf3(0x277)]({'agentName':_0x33574d[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'agentId':_0x3c4922['id'],'diff':formatDiffWithColors(_0x32cd47)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1bc)][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x1bc)][_0x23ebf3(0x277)]({'agentName':_0x33574d[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':'unchanged','agentId':_0x3c4922['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['agents']['unchanged']++);}else _0xd109b3[_0x23ebf3(0x1bc)][_0x23ebf3(0x277)]({'agentName':_0x33574d[_0x23ebf3(0x28b)]['name'],'action':'created'}),_0xd109b3['counts'][_0x23ebf3(0x1bc)][_0x23ebf3(0x27b)]++;}for(const _0x4753d9 of _0x2bd3f5){const _0x56e391=_0x530c8c[_0x23ebf3(0x1c0)](_0x4753d9[_0x23ebf3(0x28b)]['name']),_0x1b0409=a134_0x4f3caa['readFileSync'](_0x4753d9[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x56e391){const _0x5407b5=await apiPromptToYaml(_0x56e391,_0x1286b9);if(!_0x5407b5){_0xd109b3['prompts'][_0x23ebf3(0x277)]({'name':_0x4753d9[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':'updated','id':_0x56e391['id']}),_0xd109b3['counts']['prompts'][_0x23ebf3(0x232)]++;continue;}const _0x5749b6=toPromptYamlString(_0x5407b5),_0x50675b=generateDiff(_0x5749b6,_0x1b0409),_0x2c2954=hasChanges(_0x50675b);_0x2c2954?(_0xd109b3['prompts'][_0x23ebf3(0x277)]({'name':_0x4753d9[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':'updated','id':_0x56e391['id'],'diff':formatDiffWithColors(_0x50675b)}),_0xd109b3['counts'][_0x23ebf3(0x25d)][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x25d)][_0x23ebf3(0x277)]({'name':_0x4753d9[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x23a),'id':_0x56e391['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25d)][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x25d)]['push']({'name':_0x4753d9[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b)}),_0xd109b3['counts'][_0x23ebf3(0x25d)][_0x23ebf3(0x27b)]++;}for(const _0x1a807f of _0x13d6c4){const _0x33f188=_0x49e608[_0x23ebf3(0x1c0)](_0x1a807f[_0x23ebf3(0x28b)][_0x23ebf3(0x1b8)]),_0x271892=a134_0x4f3caa['readFileSync'](_0x1a807f[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x33f188){const _0x3a88c1=await apiIntegrationToYaml(_0x33f188,_0x1286b9),_0x598afe=toIntegrationYamlString(_0x3a88c1),_0x41c900=generateDiff(_0x598afe,_0x271892),_0x224b5f=hasChanges(_0x41c900);_0x224b5f?(_0xd109b3[_0x23ebf3(0x180)][_0x23ebf3(0x277)]({'name':_0x1a807f['yaml'][_0x23ebf3(0x1b8)],'action':_0x23ebf3(0x232),'id':_0x33f188['id'],'diff':formatDiffWithColors(_0x41c900)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x180)][_0x23ebf3(0x232)]++):(_0xd109b3['integrations']['push']({'name':_0x1a807f['yaml']['service_type'],'action':_0x23ebf3(0x23a),'id':_0x33f188['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['integrations'][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x180)][_0x23ebf3(0x277)]({'name':_0x1a807f[_0x23ebf3(0x28b)]['service_type'],'action':_0x23ebf3(0x27b)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x180)][_0x23ebf3(0x27b)]++;}for(const _0x4fa755 of _0x36233a){const _0x1271b7=_0x2fa7fe[_0x23ebf3(0x1c0)](_0x4fa755[_0x23ebf3(0x290)]['name']),_0x355194=toExperimentalKnowledgeBaseYamlString(_0x4fa755[_0x23ebf3(0x290)]);let _0x5db6f8=_0x355194;for(const _0x1c9075 of _0x4fa755['def'][_0x23ebf3(0x24f)]){_0x5db6f8+='\x0a---\x20function:\x20'+_0x1c9075[_0x23ebf3(0x1da)]+_0x23ebf3(0x1a2)+_0x1c9075[_0x23ebf3(0x28a)]+'\x0a---\x20schema:\x20'+_0x1c9075[_0x23ebf3(0x1da)]+'\x20---\x0a'+_0x1c9075[_0x23ebf3(0x197)]+'\x0a';}if(_0x1271b7){const _0x289a88=apiExperimentalKnowledgeBaseToYaml(_0x1271b7),_0x30159f=toExperimentalKnowledgeBaseYamlString(_0x289a88);let _0x7dd604=_0x30159f;for(const _0x35512d of _0x289a88[_0x23ebf3(0x24f)]){_0x7dd604+=_0x23ebf3(0x226)+_0x35512d[_0x23ebf3(0x1da)]+_0x23ebf3(0x1a2)+_0x35512d[_0x23ebf3(0x28a)]+'\x0a---\x20schema:\x20'+_0x35512d['name']+_0x23ebf3(0x1a2)+_0x35512d[_0x23ebf3(0x197)]+'\x0a';}const _0x187eea=generateDiff(_0x7dd604,_0x5db6f8),_0xbb142f=hasChanges(_0x187eea);_0xbb142f?(_0xd109b3[_0x23ebf3(0x1cb)]['push']({'name':_0x4fa755['def'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x1271b7['id'],'diff':formatDiffWithColors(_0x187eea)}),_0xd109b3[_0x23ebf3(0x1f6)]['experimentalKnowledgeBases'][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x1cb)][_0x23ebf3(0x277)]({'name':_0x4fa755[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x23a),'id':_0x1271b7['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1cb)][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x1cb)][_0x23ebf3(0x277)]({'name':_0x4fa755[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b)}),_0xd109b3['counts'][_0x23ebf3(0x1cb)][_0x23ebf3(0x27b)]++;}for(const _0x40fb9f of _0x122fc5){const _0x1745fd=_0x3a6ab3[_0x23ebf3(0x1c0)](_0x40fb9f['def'][_0x23ebf3(0x1da)]),_0x4e7e3b=toExperimentalArtifactYamlString(_0x40fb9f[_0x23ebf3(0x290)]);let _0x54a778=_0x4e7e3b+(_0x23ebf3(0x18e)+_0x40fb9f['def'][_0x23ebf3(0x28a)]+'\x0a');for(const _0x33da11 of _0x40fb9f[_0x23ebf3(0x290)][_0x23ebf3(0x200)]){_0x54a778+='---\x20file:\x20'+_0x33da11[_0x23ebf3(0x295)]+_0x23ebf3(0x1a2)+_0x33da11[_0x23ebf3(0x296)]+'\x0a';}if(_0x1745fd){const _0x42487d=apiExperimentalArtifactToYaml(_0x1745fd),_0x2f51c4=toExperimentalArtifactYamlString(_0x42487d);let _0x451d6e=_0x2f51c4+(_0x23ebf3(0x18e)+_0x42487d[_0x23ebf3(0x28a)]+'\x0a');for(const _0x444943 of _0x42487d['files']){_0x451d6e+='---\x20file:\x20'+_0x444943[_0x23ebf3(0x295)]+'\x20---\x0a'+_0x444943[_0x23ebf3(0x296)]+'\x0a';}const _0x2087fb=generateDiff(_0x451d6e,_0x54a778),_0x550572=hasChanges(_0x2087fb);_0x550572?(_0xd109b3[_0x23ebf3(0x20a)][_0x23ebf3(0x277)]({'name':_0x40fb9f['def'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x1745fd['id'],'diff':formatDiffWithColors(_0x2087fb)}),_0xd109b3['counts'][_0x23ebf3(0x20a)][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x20a)]['push']({'name':_0x40fb9f[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x23a),'id':_0x1745fd['id']}),_0xd109b3['counts'][_0x23ebf3(0x20a)][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x20a)]['push']({'name':_0x40fb9f[_0x23ebf3(0x290)]['name'],'action':'created'}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x20a)][_0x23ebf3(0x27b)]++;}for(const _0x33a29c of _0x29f193){const _0x560459=_0x4d167e['get'](_0x33a29c[_0x23ebf3(0x28b)]['name']),_0x1e1139=a134_0x4f3caa['readFileSync'](_0x33a29c[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x560459){const _0x5385ae=await apiFormInterfaceToYaml(_0x560459,_0x1286b9),_0x234d78=toFormInterfaceYamlString(_0x5385ae),_0x16a6c8=generateDiff(_0x234d78,_0x1e1139),_0x659bdf=hasChanges(_0x16a6c8);_0x659bdf?(_0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x33a29c[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x560459['id'],'diff':formatDiffWithColors(_0x16a6c8)}),_0xd109b3[_0x23ebf3(0x1f6)]['formInterfaces'][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x33a29c[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x23a),'id':_0x560459['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x194)]['unchanged']++);}else _0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x33a29c['yaml']['name'],'action':_0x23ebf3(0x27b)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x194)][_0x23ebf3(0x27b)]++;}for(const _0x5d7b8d of _0x108c54){const _0x52c001=_0x226e44[_0x23ebf3(0x1c0)](_0x5d7b8d['yaml'][_0x23ebf3(0x1da)]),_0x1270e9=a134_0x4f3caa[_0x23ebf3(0x186)](_0x5d7b8d[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x52c001){const _0x36a111=await apiChatInterfaceToYaml(_0x52c001,_0x1286b9),_0x907a0b=toChatInterfaceYamlString(_0x36a111),_0x37d01c=generateDiff(_0x907a0b,_0x1270e9),_0x573d62=hasChanges(_0x37d01c);_0x573d62?(_0xd109b3[_0x23ebf3(0x266)][_0x23ebf3(0x277)]({'name':_0x5d7b8d[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x52c001['id'],'diff':formatDiffWithColors(_0x37d01c)}),_0xd109b3['counts'][_0x23ebf3(0x266)]['updated']++):(_0xd109b3[_0x23ebf3(0x266)][_0x23ebf3(0x277)]({'name':_0x5d7b8d[_0x23ebf3(0x28b)]['name'],'action':_0x23ebf3(0x23a),'id':_0x52c001['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x266)][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x266)][_0x23ebf3(0x277)]({'name':_0x5d7b8d['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b)}),_0xd109b3['counts'][_0x23ebf3(0x266)][_0x23ebf3(0x27b)]++;}if(_0xa08415?.['dryRun'])return _0xd109b3;_0xd109b3[_0x23ebf3(0x1e5)]=[],_0xd109b3[_0x23ebf3(0x25f)]=[],_0xd109b3[_0x23ebf3(0x25d)]=[],_0xd109b3[_0x23ebf3(0x180)]=[],_0xd109b3[_0x23ebf3(0x1cb)]=[],_0xd109b3[_0x23ebf3(0x20a)]=[],_0xd109b3[_0x23ebf3(0x194)]=[],_0xd109b3[_0x23ebf3(0x266)]=[];const _0xec9582=_0xd109b3[_0x23ebf3(0x1bc)]['filter'](_0x5b7ca0=>_0x5b7ca0[_0x23ebf3(0x215)]==='error');_0xd109b3[_0x23ebf3(0x1bc)]=_0xec9582,_0xd109b3[_0x23ebf3(0x1f6)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0xec9582[_0x23ebf3(0x189)]},'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 _0x2a0e2d of _0x28d482){try{const _0x4c7e81=_0x470d3e[_0x23ebf3(0x1c0)](_0x2a0e2d['yaml'][_0x23ebf3(0x1da)]),_0x105a2e=yamlKnowledgeBaseToApi(_0x2a0e2d[_0x23ebf3(0x28b)],_0xe54f73);if(_0x4c7e81)await this[_0x23ebf3(0x203)][_0x23ebf3(0x26a)](_0x4c7e81['id'],_0x105a2e),_0xd25b66[_0x23ebf3(0x26f)](_0x2a0e2d[_0x23ebf3(0x28b)]['name'],_0x4c7e81['id']),_0xd109b3[_0x23ebf3(0x1e5)]['push']({'name':_0x2a0e2d['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x4c7e81['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['knowledgeBases'][_0x23ebf3(0x232)]++;else{const _0x4c782b=await this['client']['createKnowledgeBase'](_0x105a2e);_0xd25b66[_0x23ebf3(0x26f)](_0x2a0e2d['yaml']['name'],_0x4c782b['id']),_0xd109b3[_0x23ebf3(0x1e5)][_0x23ebf3(0x277)]({'name':_0x2a0e2d[_0x23ebf3(0x28b)]['name'],'action':'created','id':_0x4c782b['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1e5)][_0x23ebf3(0x27b)]++;}}catch(_0x34867f){_0xd109b3[_0x23ebf3(0x1e5)][_0x23ebf3(0x277)]({'name':_0x2a0e2d[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x34867f[_0x23ebf3(0x1af)]}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1e5)][_0x23ebf3(0x1a5)]++;}}for(const _0x442d17 of _0x45a269){try{const _0x276e18=_0x4ea27b[_0x23ebf3(0x1c0)](_0x442d17['name']),_0x2e5c04=yamlTextKnowledgeBaseToApi({'name':_0x442d17['name'],'text':_0x442d17[_0x23ebf3(0x230)]},_0xe54f73);if(_0x276e18)await this['client'][_0x23ebf3(0x1d4)](_0x276e18['id'],_0x2e5c04),_0x553293['set'](_0x442d17[_0x23ebf3(0x1da)],_0x276e18['id']),_0xd109b3[_0x23ebf3(0x25f)]['push']({'name':_0x442d17[_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x276e18['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['textKnowledgeBases']['updated']++;else{const _0x29313b=await this[_0x23ebf3(0x203)][_0x23ebf3(0x1b0)](_0x2e5c04);_0x553293['set'](_0x442d17[_0x23ebf3(0x1da)],_0x29313b['id']),_0xd109b3[_0x23ebf3(0x25f)][_0x23ebf3(0x277)]({'name':_0x442d17['name'],'action':_0x23ebf3(0x27b),'id':_0x29313b['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25f)]['created']++;}}catch(_0x2d6a4d){_0xd109b3[_0x23ebf3(0x25f)]['push']({'name':_0x442d17[_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x2d6a4d[_0x23ebf3(0x1af)]}),_0xd109b3[_0x23ebf3(0x1f6)]['textKnowledgeBases'][_0x23ebf3(0x1a5)]++;}}for(const _0x112968 of _0x36233a){try{const _0x47f80d=_0x2fa7fe[_0x23ebf3(0x1c0)](_0x112968[_0x23ebf3(0x290)][_0x23ebf3(0x1da)]),_0x19dc9a=yamlExperimentalKnowledgeBaseToApi(_0x112968['def'],_0xe54f73);if(_0x47f80d)await this[_0x23ebf3(0x203)][_0x23ebf3(0x192)](_0x47f80d['id'],_0x19dc9a),_0x5753f5[_0x23ebf3(0x26f)](_0x112968[_0x23ebf3(0x290)]['name'],_0x47f80d['id']),_0xd109b3[_0x23ebf3(0x1cb)][_0x23ebf3(0x277)]({'name':_0x112968[_0x23ebf3(0x290)]['name'],'action':'updated','id':_0x47f80d['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1cb)]['updated']++;else{const _0x499865=await this[_0x23ebf3(0x203)][_0x23ebf3(0x208)](_0x19dc9a);_0x5753f5[_0x23ebf3(0x26f)](_0x112968[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],_0x499865['id']),_0xd109b3[_0x23ebf3(0x1cb)][_0x23ebf3(0x277)]({'name':_0x112968[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b),'id':_0x499865['id']}),_0xd109b3['counts'][_0x23ebf3(0x1cb)]['created']++;}}catch(_0x26e25b){_0xd109b3[_0x23ebf3(0x1cb)][_0x23ebf3(0x277)]({'name':_0x112968[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x26e25b[_0x23ebf3(0x1af)]}),_0xd109b3['counts']['experimentalKnowledgeBases']['errors']++;}}for(const _0x3a47f4 of _0x122fc5){try{const _0x5b1db8=_0x3a6ab3[_0x23ebf3(0x1c0)](_0x3a47f4[_0x23ebf3(0x290)][_0x23ebf3(0x1da)]),_0x21cc3f=yamlExperimentalArtifactToApi(_0x3a47f4[_0x23ebf3(0x290)],_0xe54f73);if(_0x5b1db8)await this[_0x23ebf3(0x203)][_0x23ebf3(0x281)](_0x5b1db8['id'],_0x21cc3f),_0xadf01f['set'](_0x3a47f4[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],_0x5b1db8['id']),_0xd109b3[_0x23ebf3(0x20a)][_0x23ebf3(0x277)]({'name':_0x3a47f4['def'][_0x23ebf3(0x1da)],'action':'updated','id':_0x5b1db8['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x20a)][_0x23ebf3(0x232)]++;else{const _0x1dacfc=await this[_0x23ebf3(0x203)][_0x23ebf3(0x21b)](_0x21cc3f);_0xadf01f['set'](_0x3a47f4['def'][_0x23ebf3(0x1da)],_0x1dacfc['id']),_0xd109b3['experimentalArtifacts'][_0x23ebf3(0x277)]({'name':_0x3a47f4[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b),'id':_0x1dacfc['id']}),_0xd109b3['counts'][_0x23ebf3(0x20a)][_0x23ebf3(0x27b)]++;}}catch(_0x288992){_0xd109b3[_0x23ebf3(0x20a)][_0x23ebf3(0x277)]({'name':_0x3a47f4['def'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x288992['message']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x20a)][_0x23ebf3(0x1a5)]++;}}for(const _0x2180f6 of _0xa14eff){_0x1dafc5=[];try{const _0x5ac498=_0x4969ef[_0x23ebf3(0x1c0)](_0x2180f6[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)]),_0x4f8554=await agentDefToRequest(_0x2180f6['yaml'],_0x2180f6[_0x23ebf3(0x1fc)],_0x2180f6[_0x23ebf3(0x1d0)],_0x23718f);if(_0x5ac498)await this[_0x23ebf3(0x203)][_0x23ebf3(0x1dc)](_0x5ac498['id'],_0x4f8554),_0x3acc7d[_0x23ebf3(0x26f)](_0x2180f6[_0x23ebf3(0x28b)]['name'],_0x5ac498['id']),_0xd109b3[_0x23ebf3(0x1bc)][_0x23ebf3(0x277)]({'agentName':_0x2180f6['yaml'][_0x23ebf3(0x1da)],'action':'updated','agentId':_0x5ac498['id'],'warnings':_0x1dafc5['length']>0x0?_0x1dafc5:undefined}),_0xd109b3['counts'][_0x23ebf3(0x1bc)][_0x23ebf3(0x232)]++;else{const _0x39f40e=await this[_0x23ebf3(0x203)][_0x23ebf3(0x1d1)](_0x4f8554);_0x3acc7d[_0x23ebf3(0x26f)](_0x2180f6['yaml'][_0x23ebf3(0x1da)],_0x39f40e['id']),_0xd109b3[_0x23ebf3(0x1bc)]['push']({'agentName':_0x2180f6[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b),'agentId':_0x39f40e['id'],'warnings':_0x1dafc5[_0x23ebf3(0x189)]>0x0?_0x1dafc5:undefined}),_0xd109b3['counts'][_0x23ebf3(0x1bc)][_0x23ebf3(0x27b)]++;}}catch(_0x549d70){_0xd109b3['agents']['push']({'agentName':_0x2180f6[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x549d70[_0x23ebf3(0x1af)],'warnings':_0x1dafc5['length']>0x0?_0x1dafc5:undefined}),_0xd109b3[_0x23ebf3(0x1f6)]['agents'][_0x23ebf3(0x1a5)]++;}}for(const _0x11a7de of _0x2bd3f5){try{const _0x4ddbf4=_0x530c8c[_0x23ebf3(0x1c0)](_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)]),_0x2d6c5b=await yamlPromptToApi(_0x11a7de[_0x23ebf3(0x28b)],_0xe54f73,_0x23718f);if(!_0x2d6c5b){_0xd109b3[_0x23ebf3(0x25d)][_0x23ebf3(0x277)]({'name':_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x23ebf3(0x1ae)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25d)][_0x23ebf3(0x1a5)]++;continue;}if(_0x4ddbf4)await this[_0x23ebf3(0x203)][_0x23ebf3(0x1df)](_0x4ddbf4['id'],_0x2d6c5b),_0x51dea4['set'](_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],_0x4ddbf4['id']),_0xd109b3[_0x23ebf3(0x25d)][_0x23ebf3(0x277)]({'name':_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x4ddbf4['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25d)][_0x23ebf3(0x232)]++;else{const _0x7b5bd=await this[_0x23ebf3(0x203)][_0x23ebf3(0x256)](_0x2d6c5b);_0x51dea4[_0x23ebf3(0x26f)](_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],_0x7b5bd['id']),_0xd109b3[_0x23ebf3(0x25d)][_0x23ebf3(0x277)]({'name':_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':'created','id':_0x7b5bd['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25d)][_0x23ebf3(0x27b)]++;}}catch(_0x307cd6){_0xd109b3['prompts'][_0x23ebf3(0x277)]({'name':_0x11a7de['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x307cd6['message']}),_0xd109b3[_0x23ebf3(0x1f6)]['prompts'][_0x23ebf3(0x1a5)]++;}}for(const _0x330703 of _0x13d6c4){try{const _0x5f2086=_0x49e608[_0x23ebf3(0x1c0)](_0x330703[_0x23ebf3(0x28b)][_0x23ebf3(0x1b8)]),_0x196d87=await yamlIntegrationToApi(_0x330703[_0x23ebf3(0x28b)],_0xe54f73,_0x23718f);if(_0x5f2086){await this[_0x23ebf3(0x203)][_0x23ebf3(0x27a)](_0x5f2086['id']);const _0xed109f=await this['client'][_0x23ebf3(0x1a9)](_0x196d87);_0xd109b3[_0x23ebf3(0x180)][_0x23ebf3(0x277)]({'name':_0x330703['yaml'][_0x23ebf3(0x1b8)],'action':_0x23ebf3(0x232),'id':_0xed109f['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x180)][_0x23ebf3(0x232)]++;}else{const _0x3f2b2f=await this[_0x23ebf3(0x203)][_0x23ebf3(0x1a9)](_0x196d87);_0xd109b3[_0x23ebf3(0x180)][_0x23ebf3(0x277)]({'name':_0x330703[_0x23ebf3(0x28b)][_0x23ebf3(0x1b8)],'action':_0x23ebf3(0x27b),'id':_0x3f2b2f['id']}),_0xd109b3['counts'][_0x23ebf3(0x180)][_0x23ebf3(0x27b)]++;}}catch(_0x36abb1){_0xd109b3['integrations']['push']({'name':_0x330703['yaml'][_0x23ebf3(0x1b8)],'action':_0x23ebf3(0x1ba),'error':_0x36abb1['message']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x180)][_0x23ebf3(0x1a5)]++;}}for(const _0x410382 of _0x29f193){try{const _0x30d7fa=_0x4d167e[_0x23ebf3(0x1c0)](_0x410382[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)]),_0x1e4d46=await yamlFormInterfaceToApi(_0x410382[_0x23ebf3(0x28b)],_0xe54f73,_0x23718f);if(!_0x1e4d46){_0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x410382[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x23ebf3(0x26c)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x194)][_0x23ebf3(0x1a5)]++;continue;}if(_0x30d7fa){const _0x182ad6=await this[_0x23ebf3(0x203)][_0x23ebf3(0x1d9)](_0x30d7fa['id'],_0x1e4d46);_0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x410382['yaml'][_0x23ebf3(0x1da)],'action':'updated','id':_0x182ad6['id']}),_0xd109b3['counts'][_0x23ebf3(0x194)]['updated']++;}else{const _0x17ddf1=await this['client'][_0x23ebf3(0x1a3)](_0x1e4d46);_0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x410382['yaml']['name'],'action':_0x23ebf3(0x27b),'id':_0x17ddf1['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x194)]['created']++;}}catch(_0x3aa51f){_0xd109b3['formInterfaces'][_0x23ebf3(0x277)]({'name':_0x410382[_0x23ebf3(0x28b)]['name'],'action':'error','error':_0x3aa51f['message']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x194)][_0x23ebf3(0x1a5)]++;}}for(const _0x3fe349 of _0x108c54){try{const _0xf2146c=_0x226e44[_0x23ebf3(0x1c0)](_0x3fe349[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)]),_0x49dc8f=await yamlChatInterfaceToApi(_0x3fe349['yaml'],_0xe54f73,_0x23718f);if(_0xf2146c){const _0x3da358=await this['client']['updateChatInterface'](_0xf2146c['id'],_0x49dc8f);_0xd109b3['chatInterfaces'][_0x23ebf3(0x277)]({'name':_0x3fe349[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x3da358['id']}),_0xd109b3['counts']['chatInterfaces']['updated']++;}else{const _0x3a5a89=await this[_0x23ebf3(0x203)][_0x23ebf3(0x24a)](_0x49dc8f);_0xd109b3[_0x23ebf3(0x266)]['push']({'name':_0x3fe349[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b),'id':_0x3a5a89['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['chatInterfaces'][_0x23ebf3(0x27b)]++;}}catch(_0x1b1d91){_0xd109b3[_0x23ebf3(0x266)][_0x23ebf3(0x277)]({'name':_0x3fe349['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x1b1d91['message']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x266)][_0x23ebf3(0x1a5)]++;}}return _0xd109b3;}async['pullAgent'](_0x37cf9f,_0x16004f,_0x4aea3a,_0x8b8500){const _0xe2c72b=a134_0x1280fc,{projectId:_0x2e2a22,project:_0x44472a}=await this['resolveProjectName'](_0x37cf9f),_0x268df7=_0x44472a['attributes'][_0xe2c72b(0x1da)],_0x322e93=await this[_0xe2c72b(0x203)][_0xe2c72b(0x1e1)](_0x2e2a22),_0x34e1e3=_0x322e93[_0xe2c72b(0x1ef)](_0x144997=>_0x144997['attributes'][_0xe2c72b(0x1da)]===_0x16004f);if(!_0x34e1e3)throw new SDKError(ErrorCode[_0xe2c72b(0x1a0)],'Agent\x20not\x20found:\x20'+_0x16004f,undefined,{'helpText':_0xe2c72b(0x222)+_0x322e93[_0xe2c72b(0x1ca)](_0x254989=>_0x254989[_0xe2c72b(0x193)][_0xe2c72b(0x1da)])[_0xe2c72b(0x271)](',\x20')});let _0x581fa1;if(_0x4aea3a)_0x581fa1=_0x4aea3a;else{const _0x5d86f7=a134_0xb4a0ec[_0xe2c72b(0x271)](process['cwd'](),_0xe2c72b(0x1bc)),_0x54fc3c=getSanitizedPathWithMigration(_0x5d86f7,_0x268df7);_0x54fc3c[_0xe2c72b(0x234)]&&this[_0xe2c72b(0x1b4)][_0xe2c72b(0x183)](_0xe2c72b(0x276)+a134_0xb4a0ec['basename'](_0x54fc3c[_0xe2c72b(0x254)])+_0xe2c72b(0x28d)+a134_0xb4a0ec[_0xe2c72b(0x23c)](_0x54fc3c['path'])),_0x581fa1=_0x54fc3c['path'];}const _0xb1dcf4=getSanitizedPathWithMigration(_0x581fa1,_0x16004f);_0xb1dcf4['renamed']&&this[_0xe2c72b(0x1b4)]['info'](_0xe2c72b(0x1a1)+a134_0xb4a0ec[_0xe2c72b(0x23c)](_0xb1dcf4[_0xe2c72b(0x254)])+'\x20→\x20'+a134_0xb4a0ec[_0xe2c72b(0x23c)](_0xb1dcf4[_0xe2c72b(0x19a)]));const _0x1662e7=_0xb1dcf4['path'],_0x5d2631=new Map(),_0x4bdff1=new Map(),_0x1560eb=await this[_0xe2c72b(0x203)][_0xe2c72b(0x247)](_0x2e2a22),_0x4f0d46=await this[_0xe2c72b(0x203)]['listTextKnowledgeBases'](_0x2e2a22),_0x400e60=await safeListOrEmpty(()=>this['client']['listExperimentalKnowledgeBases'](_0x2e2a22)),_0xe50afc=new Map(),_0x5eb2d3=new Map();for(const _0x239418 of _0x1560eb){_0x5d2631[_0xe2c72b(0x26f)](_0x239418['id'],_0x239418[_0xe2c72b(0x193)]['name']);}for(const _0x36ed46 of _0x4f0d46){_0xe50afc[_0xe2c72b(0x26f)](_0x36ed46['id'],_0x36ed46[_0xe2c72b(0x193)][_0xe2c72b(0x1da)]);}for(const _0x21b599 of _0x400e60){_0x5eb2d3['set'](_0x21b599['id'],_0x21b599['attributes'][_0xe2c72b(0x1da)]);}for(const _0x495719 of _0x322e93){_0x4bdff1[_0xe2c72b(0x26f)](_0x495719['id'],_0x495719['attributes'][_0xe2c72b(0x1da)]);}const _0xdccfcb={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x5d2631,'TextKnowledgeBase':_0xe50afc,'Agent':_0x4bdff1,'ExperimentalKnowledgeBase':_0x5eb2d3}),'resolvePromptName':async()=>undefined,'onWarning':_0x1c2132=>this[_0xe2c72b(0x1b4)]['warn'](_0x1c2132)},_0x39813b=a134_0xb4a0ec[_0xe2c72b(0x271)](_0x1662e7,_0xe2c72b(0x214)),_0x5afb5b=a134_0xb4a0ec[_0xe2c72b(0x271)](_0x1662e7,'agent.yml'),_0x237ad2=a134_0xb4a0ec[_0xe2c72b(0x271)](_0x1662e7,_0xe2c72b(0x22f)),_0x49d000=!a134_0x4f3caa['existsSync'](_0x5afb5b);if(_0x8b8500?.[_0xe2c72b(0x248)])return{'agentName':_0x16004f,'outputPath':_0x1662e7,'isNew':_0x49d000,'hasChanges':!![]};a134_0x4f3caa[_0xe2c72b(0x20f)](_0x581fa1,{'recursive':!![]}),a134_0x4f3caa[_0xe2c72b(0x20f)](_0x1662e7,{'recursive':!![]});const _0x31d8a3=a134_0xb4a0ec[_0xe2c72b(0x271)](_0x581fa1,'tdx.json');!a134_0x4f3caa[_0xe2c72b(0x273)](_0x31d8a3)&&a134_0x4f3caa[_0xe2c72b(0x188)](_0x31d8a3,createAgentConfigContent(_0x37cf9f));const {yaml:_0x245659,systemPrompt:_0x392c4b,starterMessage:_0x520eef}=await agentResponseToDef(_0x34e1e3,_0xdccfcb);let _0xfe9587=_0x49d000;if(!_0x49d000){const _0x514cb3=a134_0x4f3caa[_0xe2c72b(0x273)](_0x39813b)?a134_0x4f3caa[_0xe2c72b(0x186)](_0x39813b,_0xe2c72b(0x1a7)):'',_0x273645=a134_0x4f3caa[_0xe2c72b(0x186)](_0x5afb5b,'utf-8');_0xfe9587=_0x514cb3!==_0x392c4b||_0x273645!==toAgentYamlString(_0x245659);}a134_0x4f3caa['writeFileSync'](_0x39813b,_0x392c4b),a134_0x4f3caa[_0xe2c72b(0x188)](_0x5afb5b,toAgentYamlString(_0x245659));if(_0x520eef&&_0x520eef[_0xe2c72b(0x20c)]('\x0a'))a134_0x4f3caa['writeFileSync'](_0x237ad2,_0x520eef);else a134_0x4f3caa[_0xe2c72b(0x273)](_0x237ad2)&&a134_0x4f3caa[_0xe2c72b(0x231)](_0x237ad2);return{'agentName':_0x16004f,'outputPath':_0x1662e7,'isNew':_0x49d000,'hasChanges':_0xfe9587};}async[a134_0x1280fc(0x182)](_0x10601e,_0xc3c24){const _0x37e604=a134_0x1280fc;let _0x3c3779;isAgentYamlPath(_0x10601e)?_0x3c3779=getAgentDirFromYamlPath(_0x10601e):_0x3c3779=_0x10601e;const {config:_0x9348ae}=findAgentConfig(_0x3c3779),_0x57236d=await this[_0x37e604(0x1ea)](_0x9348ae[_0x37e604(0x280)]),_0x43284e=a134_0xb4a0ec['join'](_0x3c3779,'agent.yml'),_0x4b1dda=a134_0xb4a0ec[_0x37e604(0x271)](_0x3c3779,_0x37e604(0x214)),_0x2b94e4=a134_0xb4a0ec['join'](_0x3c3779,'starter_message.md');if(!a134_0x4f3caa[_0x37e604(0x273)](_0x43284e))throw new SDKError(ErrorCode['NOT_FOUND'],'agent.yml\x20not\x20found\x20in\x20'+_0x3c3779,undefined,{'helpText':_0x37e604(0x221)});const _0x3097ea=parseAgentYaml(a134_0x4f3caa[_0x37e604(0x186)](_0x43284e,_0x37e604(0x1a7)),_0x43284e),_0x1cc1e0=a134_0x4f3caa[_0x37e604(0x273)](_0x4b1dda)?a134_0x4f3caa[_0x37e604(0x186)](_0x4b1dda,_0x37e604(0x1a7)):'',_0xe98055=a134_0x4f3caa[_0x37e604(0x273)](_0x2b94e4)?a134_0x4f3caa[_0x37e604(0x186)](_0x2b94e4,_0x37e604(0x1a7)):_0x3097ea[_0x37e604(0x1ec)];if(_0xc3c24?.[_0x37e604(0x248)])return{'agentName':_0x3097ea[_0x37e604(0x1da)],'action':_0x37e604(0x27b),'projectId':_0x57236d};const _0x4fa599=await this[_0x37e604(0x203)][_0x37e604(0x1e1)](_0x57236d),_0x4d302a=await fetchAllToolTargetMaps((_0x1a4f71,_0x114816)=>this[_0x37e604(0x203)][_0x37e604(0x24c)](_0x1a4f71,_0x114816),_0x57236d),_0x373bb5=new Map();for(const _0x18fd93 of _0x4fa599){_0x373bb5[_0x37e604(0x26f)](_0x18fd93['attributes']['name'],_0x18fd93['id']);}const _0x1b56fd=[],_0x1db545={'projectId':_0x57236d,'resolveToolTargetId':buildIdResolver({..._0x4d302a['nameToId'],'Agent':_0x373bb5}),'resolvePromptId':async()=>undefined,'onWarning':_0x1808bf=>{const _0x55e331=_0x37e604;this['logger'][_0x55e331(0x1eb)](_0x1808bf),_0x1b56fd[_0x55e331(0x277)](_0x1808bf);}};try{const _0x2e60b8=_0x4fa599[_0x37e604(0x1ef)](_0x3ea2f7=>_0x3ea2f7[_0x37e604(0x193)][_0x37e604(0x1da)]===_0x3097ea[_0x37e604(0x1da)]),_0x189f70=await agentDefToRequest(_0x3097ea,_0x1cc1e0,_0xe98055,_0x1db545);if(_0x2e60b8)return await this['client'][_0x37e604(0x1dc)](_0x2e60b8['id'],_0x189f70),{'agentName':_0x3097ea[_0x37e604(0x1da)],'action':_0x37e604(0x232),'projectId':_0x57236d,'agentId':_0x2e60b8['id'],'warnings':_0x1b56fd[_0x37e604(0x189)]>0x0?_0x1b56fd:undefined};else{const _0x15d1b2=await this['client'][_0x37e604(0x1d1)](_0x189f70);return{'agentName':_0x3097ea[_0x37e604(0x1da)],'action':_0x37e604(0x27b),'projectId':_0x57236d,'agentId':_0x15d1b2['id'],'warnings':_0x1b56fd['length']>0x0?_0x1b56fd:undefined};}}catch(_0x2e1611){return{'agentName':_0x3097ea['name'],'action':_0x37e604(0x1ba),'projectId':_0x57236d,'error':_0x2e1611[_0x37e604(0x1af)],'warnings':_0x1b56fd[_0x37e604(0x189)]>0x0?_0x1b56fd:undefined};}}async[a134_0x1280fc(0x1b9)](_0x39af0f,_0x41565c,_0x1e875e){const _0x347fc7=a134_0x1280fc,_0x890f50=a134_0x4f3caa['existsSync'](_0x39af0f)&&a134_0x4f3caa['existsSync'](a134_0xb4a0ec[_0x347fc7(0x271)](_0x39af0f,_0x347fc7(0x1f8)));let _0x4ebeb8;const _0x9cd1b=[],_0x5db401=[],_0x2cec3b=[],_0x19013c=[],_0x4e691a=[],_0x1a3e3b=[],_0x42c6c2=[],_0x358682=[],_0x52b041=[];if(_0x890f50){const _0x26b076=loadAgentConfig(a134_0xb4a0ec[_0x347fc7(0x271)](_0x39af0f,_0x347fc7(0x1f8)));_0x4ebeb8=_0x26b076[_0x347fc7(0x280)];const _0x45d470=a134_0x4f3caa['readdirSync'](_0x39af0f,{'withFileTypes':!![]});for(const _0x9feb2d of _0x45d470){if(!_0x9feb2d['isDirectory']())continue;if(['knowledge_bases',_0x347fc7(0x283),'experimental_artifacts',_0x347fc7(0x25d),_0x347fc7(0x180),_0x347fc7(0x223),_0x347fc7(0x1c1)]['includes'](_0x9feb2d[_0x347fc7(0x1da)]))continue;const _0x75b221=a134_0xb4a0ec[_0x347fc7(0x271)](_0x39af0f,_0x9feb2d[_0x347fc7(0x1da)]);if(isAgentDir(_0x75b221)){const _0x3d94ad=a134_0xb4a0ec[_0x347fc7(0x271)](_0x75b221,'agent.yml'),_0x50a95c=a134_0xb4a0ec[_0x347fc7(0x271)](_0x75b221,_0x347fc7(0x214)),_0x43a50c=a134_0xb4a0ec[_0x347fc7(0x271)](_0x75b221,_0x347fc7(0x22f)),_0x114c8f=parseAgentYaml(a134_0x4f3caa['readFileSync'](_0x3d94ad,'utf-8'),_0x3d94ad),_0x47f93d=a134_0x4f3caa[_0x347fc7(0x273)](_0x50a95c)?a134_0x4f3caa[_0x347fc7(0x186)](_0x50a95c,'utf-8'):'',_0x498299=a134_0x4f3caa[_0x347fc7(0x273)](_0x43a50c)?a134_0x4f3caa[_0x347fc7(0x186)](_0x43a50c,'utf-8'):_0x114c8f[_0x347fc7(0x1ec)];_0x9cd1b['push']({'name':_0x114c8f['name'],'dir':_0x75b221,'yaml':_0x114c8f,'systemPrompt':_0x47f93d,'starterMessage':_0x498299});}}const _0x19d19b=getKnowledgeBasesDir(_0x39af0f);if(a134_0x4f3caa[_0x347fc7(0x273)](_0x19d19b)){const _0x9b615c=a134_0x4f3caa[_0x347fc7(0x249)](_0x19d19b);for(const _0x595790 of _0x9b615c){const _0x18893b=a134_0xb4a0ec['join'](_0x19d19b,_0x595790);if(_0x595790['endsWith'](_0x347fc7(0x1c7))){const _0x4d1a75=parseKnowledgeBaseYaml(a134_0x4f3caa['readFileSync'](_0x18893b,_0x347fc7(0x1a7)),_0x18893b);_0x5db401['push']({'name':_0x4d1a75[_0x347fc7(0x1da)],'path':_0x18893b,'yaml':_0x4d1a75});}else{if(_0x595790[_0x347fc7(0x1e6)](_0x347fc7(0x1e9))){const _0x5da31f=a134_0x4f3caa['readFileSync'](_0x18893b,'utf-8'),{name:_0x481086,text:_0xe73e23}=parseTextKnowledgeBaseMd(_0x5da31f,_0x595790);_0x2cec3b[_0x347fc7(0x277)]({'name':_0x481086,'path':_0x18893b,'text':_0xe73e23});}}}}const _0x247afe=getPromptsDir(_0x39af0f);if(a134_0x4f3caa['existsSync'](_0x247afe)){const _0x433c79=a134_0x4f3caa[_0x347fc7(0x249)](_0x247afe)[_0x347fc7(0x18a)](_0x54da1b=>_0x54da1b[_0x347fc7(0x1e6)](_0x347fc7(0x1c7)));for(const _0x4b1450 of _0x433c79){const _0xc39a80=a134_0xb4a0ec['join'](_0x247afe,_0x4b1450),_0x202938=parsePromptYaml(a134_0x4f3caa[_0x347fc7(0x186)](_0xc39a80,_0x347fc7(0x1a7)),_0xc39a80);_0x19013c[_0x347fc7(0x277)]({'name':_0x202938[_0x347fc7(0x1da)],'path':_0xc39a80,'yaml':_0x202938});}}const _0x48f6a0=getIntegrationsDir(_0x39af0f);if(a134_0x4f3caa[_0x347fc7(0x273)](_0x48f6a0)){const _0x2ddffb=a134_0x4f3caa[_0x347fc7(0x249)](_0x48f6a0)[_0x347fc7(0x18a)](_0x218eb5=>_0x218eb5['endsWith'](_0x347fc7(0x1c7)));for(const _0x26f5d1 of _0x2ddffb){const _0x5a5838=a134_0xb4a0ec['join'](_0x48f6a0,_0x26f5d1),_0x409c63=parseIntegrationYaml(a134_0x4f3caa['readFileSync'](_0x5a5838,'utf-8'),_0x5a5838);SAFE_INTEGRATION_TYPES[_0x347fc7(0x20c)](_0x409c63[_0x347fc7(0x1b8)][_0x347fc7(0x23b)]())?_0x4e691a[_0x347fc7(0x277)]({'name':_0x409c63[_0x347fc7(0x1da)],'path':_0x5a5838,'yaml':_0x409c63}):this[_0x347fc7(0x1b4)][_0x347fc7(0x1eb)](_0x347fc7(0x209)+_0x409c63[_0x347fc7(0x1da)]+_0x347fc7(0x21d)+_0x409c63[_0x347fc7(0x1b8)]+_0x347fc7(0x1d5)+(_0x347fc7(0x1e0)+SAFE_INTEGRATION_TYPES[_0x347fc7(0x271)](',\x20')+_0x347fc7(0x23d)));}}const _0x35271d=getExperimentalKnowledgeBasesDir(_0x39af0f);if(a134_0x4f3caa[_0x347fc7(0x273)](_0x35271d)){const _0x4187ab=a134_0x4f3caa[_0x347fc7(0x249)](_0x35271d,{'withFileTypes':!![]});for(const _0x4c4ea1 of _0x4187ab){if(!_0x4c4ea1[_0x347fc7(0x27e)]())continue;const _0x480439=a134_0xb4a0ec['join'](_0x35271d,_0x4c4ea1[_0x347fc7(0x1da)]),_0x21caf3=a134_0xb4a0ec[_0x347fc7(0x271)](_0x480439,_0x4c4ea1[_0x347fc7(0x1da)]+_0x347fc7(0x1c7));if(a134_0x4f3caa[_0x347fc7(0x273)](_0x21caf3)){const _0x51334b=parseExperimentalKnowledgeBaseYaml(a134_0x4f3caa[_0x347fc7(0x186)](_0x21caf3,_0x347fc7(0x1a7)),_0x21caf3),_0x1fb73=a134_0xb4a0ec[_0x347fc7(0x271)](_0x480439,'functions'),_0x19806e=[];if(a134_0x4f3caa[_0x347fc7(0x273)](_0x1fb73)){const _0x2a03d3=a134_0x4f3caa[_0x347fc7(0x249)](_0x1fb73,{'withFileTypes':!![]});for(const _0x1509cb of _0x2a03d3){if(!_0x1509cb[_0x347fc7(0x27e)]())continue;const _0x58e583=a134_0xb4a0ec[_0x347fc7(0x271)](_0x1fb73,_0x1509cb['name']),_0x9d8323=a134_0xb4a0ec[_0x347fc7(0x271)](_0x58e583,'code.js'),_0x4fff1e=a134_0xb4a0ec[_0x347fc7(0x271)](_0x58e583,_0x347fc7(0x1c8));if(a134_0x4f3caa[_0x347fc7(0x273)](_0x9d8323)&&a134_0x4f3caa[_0x347fc7(0x273)](_0x4fff1e)){const _0x7a3302=a134_0x4f3caa[_0x347fc7(0x186)](_0x9d8323,_0x347fc7(0x1a7)),_0x4643f6=a134_0x4f3caa[_0x347fc7(0x186)](_0x4fff1e,_0x347fc7(0x1a7));_0x19806e[_0x347fc7(0x277)]({'name':_0x1509cb[_0x347fc7(0x1da)],'code':_0x7a3302,'json_schema':_0x4643f6});}}}const _0x57c463={..._0x51334b,'functions':_0x19806e};_0x1a3e3b[_0x347fc7(0x277)]({'name':_0x51334b[_0x347fc7(0x1da)],'path':_0x480439,'def':_0x57c463});}}}const _0xcd2d54=getExperimentalArtifactsDir(_0x39af0f);if(a134_0x4f3caa[_0x347fc7(0x273)](_0xcd2d54)){const _0xd81fcc=a134_0x4f3caa[_0x347fc7(0x249)](_0xcd2d54,{'withFileTypes':!![]});for(const _0x3eefd9 of _0xd81fcc){if(!_0x3eefd9['isDirectory']())continue;const _0x4fed3b=a134_0xb4a0ec['join'](_0xcd2d54,_0x3eefd9[_0x347fc7(0x1da)]),_0x41d49b=a134_0xb4a0ec['join'](_0x4fed3b,_0x3eefd9['name']+'.yml');if(a134_0x4f3caa[_0x347fc7(0x273)](_0x41d49b)){const _0x4291d2=parseExperimentalArtifactYaml(a134_0x4f3caa[_0x347fc7(0x186)](_0x41d49b,'utf-8'),_0x41d49b),_0x551f8f=a134_0xb4a0ec[_0x347fc7(0x271)](_0x4fed3b,_0x347fc7(0x212)),_0x31676a=a134_0x4f3caa['existsSync'](_0x551f8f)?a134_0x4f3caa[_0x347fc7(0x186)](_0x551f8f,_0x347fc7(0x1a7)):'',_0x821505=a134_0xb4a0ec[_0x347fc7(0x271)](_0x4fed3b,'files'),_0x459076=[];if(a134_0x4f3caa[_0x347fc7(0x273)](_0x821505)){const _0x38f092=a134_0x4f3caa[_0x347fc7(0x249)](_0x821505);for(const _0x49eefe of _0x38f092){const _0x35ba8a=a134_0xb4a0ec['join'](_0x821505,_0x49eefe);if(a134_0x4f3caa[_0x347fc7(0x268)](_0x35ba8a)[_0x347fc7(0x205)]()){const _0x25e1b0=a134_0x4f3caa[_0x347fc7(0x186)](_0x35ba8a,_0x347fc7(0x1a7));_0x459076[_0x347fc7(0x277)]({'file_name':_0x49eefe,'text_content':_0x25e1b0});}}}const _0x26a6e1={..._0x4291d2,'code':_0x31676a,'files':_0x459076};_0x42c6c2[_0x347fc7(0x277)]({'name':_0x4291d2[_0x347fc7(0x1da)],'path':_0x4fed3b,'def':_0x26a6e1});}}}const _0x4f17ca=getFormInterfacesDir(_0x39af0f);if(a134_0x4f3caa[_0x347fc7(0x273)](_0x4f17ca)){const _0x8ea91c=a134_0x4f3caa[_0x347fc7(0x249)](_0x4f17ca)[_0x347fc7(0x18a)](_0x1fc08f=>_0x1fc08f[_0x347fc7(0x1e6)](_0x347fc7(0x1c7)));for(const _0x296a79 of _0x8ea91c){const _0xaa7362=a134_0xb4a0ec[_0x347fc7(0x271)](_0x4f17ca,_0x296a79),_0x4dca4c=parseFormInterfaceYaml(a134_0x4f3caa[_0x347fc7(0x186)](_0xaa7362,'utf-8'),_0xaa7362);_0x358682[_0x347fc7(0x277)]({'name':_0x4dca4c[_0x347fc7(0x1da)],'path':_0xaa7362,'yaml':_0x4dca4c});}}const _0x15ad82=getChatInterfacesDir(_0x39af0f);if(a134_0x4f3caa['existsSync'](_0x15ad82)){const _0x44fbc9=a134_0x4f3caa[_0x347fc7(0x249)](_0x15ad82)['filter'](_0x18001c=>_0x18001c[_0x347fc7(0x1e6)](_0x347fc7(0x1c7)));for(const _0x5e8f62 of _0x44fbc9){const _0x3ae5e2=a134_0xb4a0ec[_0x347fc7(0x271)](_0x15ad82,_0x5e8f62),_0x15dff0=parseChatInterfaceYaml(a134_0x4f3caa[_0x347fc7(0x186)](_0x3ae5e2,'utf-8'),_0x3ae5e2);_0x52b041['push']({'name':_0x15dff0['name'],'path':_0x3ae5e2,'yaml':_0x15dff0});}}}else{const _0x5c4a0c=await this[_0x347fc7(0x1ea)](_0x39af0f),_0x53179a=await this['client'][_0x347fc7(0x1f0)](_0x5c4a0c);_0x4ebeb8=_0x53179a['attributes'][_0x347fc7(0x1da)];const _0x4359dc=await this[_0x347fc7(0x203)]['listAgentsFull'](_0x5c4a0c),_0x4f32ab=await this[_0x347fc7(0x203)][_0x347fc7(0x247)](_0x5c4a0c),_0xfebee6=await this[_0x347fc7(0x203)][_0x347fc7(0x190)](_0x5c4a0c),_0xd188aa=await this[_0x347fc7(0x203)][_0x347fc7(0x18b)](_0x5c4a0c),_0x242099=await this[_0x347fc7(0x203)][_0x347fc7(0x1db)](_0x5c4a0c),_0x5cd944=await safeListOrEmpty(()=>this[_0x347fc7(0x203)]['listExperimentalKnowledgeBases'](_0x5c4a0c)),_0x4c5c4c=await safeListOrEmpty(()=>this['client']['listExperimentalArtifacts'](_0x5c4a0c)),_0x188ea2=new Map(),_0xe21d3=new Map(),_0x229bba=new Map(),_0x50b9c1=new Map(),_0x463b64=new Map(),_0x135855=new Map();for(const _0x5a07df of _0x4f32ab){_0x188ea2['set'](_0x5a07df['id'],_0x5a07df[_0x347fc7(0x193)]['name']);}for(const _0x420476 of _0xfebee6){_0xe21d3[_0x347fc7(0x26f)](_0x420476['id'],_0x420476[_0x347fc7(0x193)]['name']);}for(const _0x324f91 of _0x4359dc){_0x229bba[_0x347fc7(0x26f)](_0x324f91['id'],_0x324f91[_0x347fc7(0x193)][_0x347fc7(0x1da)]);}for(const _0x4a4f6b of _0xd188aa){_0x50b9c1[_0x347fc7(0x26f)](_0x4a4f6b['id'],_0x4a4f6b[_0x347fc7(0x193)][_0x347fc7(0x1da)]);}for(const _0x3043c8 of _0x5cd944){_0x463b64[_0x347fc7(0x26f)](_0x3043c8['id'],_0x3043c8['attributes']['name']);}for(const _0x3dbc68 of _0x4c5c4c){_0x135855[_0x347fc7(0x26f)](_0x3dbc68['id'],_0x3dbc68['attributes'][_0x347fc7(0x1da)]);}const _0x2854d3={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x188ea2,'TextKnowledgeBase':_0xe21d3,'Agent':_0x229bba,'ExperimentalKnowledgeBase':_0x463b64}),'resolvePromptName':async _0x3fb5c6=>_0x50b9c1[_0x347fc7(0x1c0)](_0x3fb5c6),'onWarning':_0x5e8bdd=>this[_0x347fc7(0x1b4)][_0x347fc7(0x1eb)](_0x5e8bdd)};for(const _0x625917 of _0x4359dc){const _0x43c0e7=await agentResponseToDef(_0x625917,_0x2854d3),{yaml:_0x261161,systemPrompt:_0x1956c9,starterMessage:_0x3853c1}=_0x43c0e7;_0x9cd1b['push']({'name':_0x261161[_0x347fc7(0x1da)],'dir':'','yaml':_0x261161,'systemPrompt':_0x1956c9,'starterMessage':_0x3853c1});}for(const _0x3ebdba of _0x4f32ab){const _0x535d41=apiKnowledgeBaseToYaml(_0x3ebdba);_0x5db401[_0x347fc7(0x277)]({'name':_0x535d41[_0x347fc7(0x1da)],'path':'','yaml':_0x535d41});}for(const _0x54c450 of _0xfebee6){_0x2cec3b[_0x347fc7(0x277)]({'name':_0x54c450[_0x347fc7(0x193)][_0x347fc7(0x1da)],'path':'','text':_0x54c450['attributes'][_0x347fc7(0x230)]});}for(const _0x12f5e8 of _0xd188aa){const _0x38aef1=await apiPromptToYaml(_0x12f5e8,_0x2854d3);_0x38aef1&&_0x19013c[_0x347fc7(0x277)]({'name':_0x38aef1[_0x347fc7(0x1da)],'path':'','yaml':_0x38aef1});}for(const _0x387f51 of _0x242099){if(!_0x387f51[_0x347fc7(0x193)][_0x347fc7(0x1c4)]&&SAFE_INTEGRATION_TYPES['includes'](_0x387f51[_0x347fc7(0x193)][_0x347fc7(0x28f)][_0x347fc7(0x23b)]())){const _0x16ee09=await apiIntegrationToYaml(_0x387f51,_0x2854d3);_0x4e691a['push']({'name':_0x387f51[_0x347fc7(0x193)][_0x347fc7(0x28f)][_0x347fc7(0x23b)](),'path':'','yaml':_0x16ee09});}}for(const _0x3f05af of _0x5cd944){const _0x5b32b7=apiExperimentalKnowledgeBaseToYaml(_0x3f05af);_0x1a3e3b['push']({'name':_0x5b32b7[_0x347fc7(0x1da)],'path':'','def':_0x5b32b7});}for(const _0xf7c544 of _0x4c5c4c){const _0x350e4c=apiExperimentalArtifactToYaml(_0xf7c544);_0x42c6c2[_0x347fc7(0x277)]({'name':_0x350e4c[_0x347fc7(0x1da)],'path':'','def':_0x350e4c});}const _0x365c37=await safeListOrEmpty(()=>this[_0x347fc7(0x203)][_0x347fc7(0x22a)](_0x5c4a0c));for(const _0x292711 of _0x365c37){const _0x5daace=await apiFormInterfaceToYaml(_0x292711,_0x2854d3);_0x358682[_0x347fc7(0x277)]({'name':_0x5daace[_0x347fc7(0x1da)],'path':'','yaml':_0x5daace});}const _0x509c19=await safeListOrEmpty(()=>this[_0x347fc7(0x203)][_0x347fc7(0x1bb)](_0x5c4a0c));for(const _0x35ba40 of _0x509c19){if(_0x35ba40['attributes']['isManaged'])continue;const _0x6326d2=await apiChatInterfaceToYaml(_0x35ba40,_0x2854d3);_0x52b041[_0x347fc7(0x277)]({'name':_0x6326d2[_0x347fc7(0x1da)],'path':'','yaml':_0x6326d2});}}const _0x8b72ab={'sourceProjectName':_0x4ebeb8,'newProjectName':_0x41565c,'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}}},_0x130ea1=await this['client'][_0x347fc7(0x1b2)](),_0x55df98=_0x130ea1[_0x347fc7(0x1ef)](_0x26cfd3=>_0x26cfd3[_0x347fc7(0x193)]['name']===_0x41565c);if(_0x55df98)throw new SDKError(ErrorCode[_0x347fc7(0x250)],_0x347fc7(0x1d3)+_0x41565c+'\x22\x20already\x20exists',undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x1e875e?.[_0x347fc7(0x248)])return _0x8b72ab['counts']['agents'][_0x347fc7(0x27b)]=_0x9cd1b[_0x347fc7(0x189)],_0x8b72ab['counts']['knowledgeBases'][_0x347fc7(0x27b)]=_0x5db401['length'],_0x8b72ab[_0x347fc7(0x1f6)]['textKnowledgeBases']['created']=_0x2cec3b[_0x347fc7(0x189)],_0x8b72ab[_0x347fc7(0x1f6)]['experimentalKnowledgeBases'][_0x347fc7(0x27b)]=_0x1a3e3b[_0x347fc7(0x189)],_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x20a)][_0x347fc7(0x27b)]=_0x42c6c2[_0x347fc7(0x189)],_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x25d)]['created']=_0x19013c[_0x347fc7(0x189)],_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x180)][_0x347fc7(0x27b)]=_0x4e691a['length'],_0x8b72ab;const _0x776bc4=await this[_0x347fc7(0x203)][_0x347fc7(0x1f7)]({'name':_0x41565c}),_0x49ac2a=_0x776bc4['id'];_0x8b72ab[_0x347fc7(0x1a6)]=_0x49ac2a;const _0x3aabec=new Map(),_0x1fe7b8=new Map(),_0x1bad79=new Map(),_0x12b430=new Map(),_0x1b9391=new Map(),_0x1c9acc=new Map(),_0x3faaf5=new Map(),_0x62f5c7=new Map(),_0x5af7ec=new Set(),_0x139e67=new Set();for(const _0x5aa219 of _0x9cd1b){for(const _0x574313 of _0x5aa219['yaml'][_0x347fc7(0x17e)]||[]){if(_0x574313[_0x347fc7(0x216)]===_0x347fc7(0x225)&&_0x574313[_0x347fc7(0x1d7)]){const _0x211020=parseRef(_0x574313[_0x347fc7(0x1d7)]);if(_0x211020)_0x5af7ec[_0x347fc7(0x246)](_0x211020[_0x347fc7(0x1da)]);}else{if(_0x574313[_0x347fc7(0x216)]===_0x347fc7(0x19f)&&_0x574313['target']){const _0x378066=parseRef(_0x574313[_0x347fc7(0x1d7)]);if(_0x378066)_0x139e67[_0x347fc7(0x246)](_0x378066[_0x347fc7(0x1da)]);}}}}for(const _0x5dcd6c of _0x5af7ec){try{const _0x5c7e26=await this[_0x347fc7(0x203)][_0x347fc7(0x269)]({'projectId':_0x49ac2a,'name':_0x5dcd6c});_0x1b9391[_0x347fc7(0x26f)](_0x5dcd6c,_0x5c7e26['id']),_0x8b72ab[_0x347fc7(0x245)][_0x347fc7(0x277)]({'name':_0x5dcd6c,'action':_0x347fc7(0x27b),'id':_0x5c7e26['id']}),_0x8b72ab[_0x347fc7(0x1f6)]['imageGenerators'][_0x347fc7(0x27b)]++;}catch(_0xfd41d7){_0x8b72ab['imageGenerators'][_0x347fc7(0x277)]({'name':_0x5dcd6c,'action':_0x347fc7(0x1ba),'error':_0xfd41d7[_0x347fc7(0x1af)]}),_0x8b72ab[_0x347fc7(0x1f6)]['imageGenerators'][_0x347fc7(0x1a5)]++;}}for(const _0x2c8a9f of _0x139e67){try{const _0x14d8d8=await this[_0x347fc7(0x203)][_0x347fc7(0x238)]({'projectId':_0x49ac2a,'name':_0x2c8a9f});_0x1c9acc[_0x347fc7(0x26f)](_0x2c8a9f,_0x14d8d8['id']),_0x8b72ab[_0x347fc7(0x220)][_0x347fc7(0x277)]({'name':_0x2c8a9f,'action':_0x347fc7(0x27b),'id':_0x14d8d8['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x220)][_0x347fc7(0x27b)]++;}catch(_0x3a3c52){_0x8b72ab[_0x347fc7(0x220)][_0x347fc7(0x277)]({'name':_0x2c8a9f,'action':_0x347fc7(0x1ba),'error':_0x3a3c52[_0x347fc7(0x1af)]}),_0x8b72ab['counts'][_0x347fc7(0x220)][_0x347fc7(0x1a5)]++;}}const _0x113577=await fetchAllToolTargetMaps((_0xa56550,_0x15827a)=>this[_0x347fc7(0x203)][_0x347fc7(0x24c)](_0xa56550,_0x15827a),_0x49ac2a);let _0x373869=[];const _0x4d31ba={'projectId':_0x49ac2a,'resolveToolTargetId':buildIdResolver({..._0x113577[_0x347fc7(0x288)],'KnowledgeBase':_0x3aabec,'TextKnowledgeBase':_0x1fe7b8,'ExperimentalKnowledgeBase':_0x3faaf5,'Agent':_0x1bad79,'WebSearchTool':_0x1c9acc,'ImageGenerator':_0x1b9391}),'resolvePromptId':async _0x8b3c2=>_0x12b430[_0x347fc7(0x1c0)](_0x8b3c2),'onWarning':_0x2e8078=>{const _0x536451=_0x347fc7;this[_0x536451(0x1b4)]['warn'](_0x2e8078),_0x373869[_0x536451(0x277)](_0x2e8078);}};for(const _0x23aa9c of _0x5db401){try{const _0x4a43a4=yamlKnowledgeBaseToApi(_0x23aa9c['yaml'],_0x49ac2a),_0x586cce=await this[_0x347fc7(0x203)][_0x347fc7(0x264)](_0x4a43a4);_0x3aabec[_0x347fc7(0x26f)](_0x23aa9c['yaml'][_0x347fc7(0x1da)],_0x586cce['id']),_0x8b72ab[_0x347fc7(0x1e5)][_0x347fc7(0x277)]({'name':_0x23aa9c['yaml'][_0x347fc7(0x1da)],'action':_0x347fc7(0x27b),'id':_0x586cce['id']}),_0x8b72ab['counts'][_0x347fc7(0x1e5)][_0x347fc7(0x27b)]++;}catch(_0x193660){_0x8b72ab[_0x347fc7(0x1e5)][_0x347fc7(0x277)]({'name':_0x23aa9c[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x193660[_0x347fc7(0x1af)]}),_0x8b72ab['counts'][_0x347fc7(0x1e5)][_0x347fc7(0x1a5)]++;}}for(const _0x45474d of _0x2cec3b){try{const _0x342891=yamlTextKnowledgeBaseToApi({'name':_0x45474d[_0x347fc7(0x1da)],'text':_0x45474d[_0x347fc7(0x230)]},_0x49ac2a),_0x1ee9b9=await this[_0x347fc7(0x203)][_0x347fc7(0x1b0)](_0x342891);_0x1fe7b8[_0x347fc7(0x26f)](_0x45474d[_0x347fc7(0x1da)],_0x1ee9b9['id']),_0x8b72ab[_0x347fc7(0x25f)]['push']({'name':_0x45474d[_0x347fc7(0x1da)],'action':_0x347fc7(0x27b),'id':_0x1ee9b9['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x25f)][_0x347fc7(0x27b)]++;}catch(_0x4c4168){_0x8b72ab[_0x347fc7(0x25f)][_0x347fc7(0x277)]({'name':_0x45474d[_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x4c4168['message']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x25f)][_0x347fc7(0x1a5)]++;}}for(const _0x2e86c9 of _0x42c6c2){try{const _0x18feea=yamlExperimentalArtifactToApi(_0x2e86c9[_0x347fc7(0x290)],_0x49ac2a),_0x51c1de=await this[_0x347fc7(0x203)][_0x347fc7(0x21b)](_0x18feea);_0x62f5c7[_0x347fc7(0x26f)](_0x2e86c9[_0x347fc7(0x290)][_0x347fc7(0x1da)],_0x51c1de['id']),_0x8b72ab[_0x347fc7(0x20a)]['push']({'name':_0x2e86c9['def'][_0x347fc7(0x1da)],'action':_0x347fc7(0x27b),'id':_0x51c1de['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x20a)][_0x347fc7(0x27b)]++;}catch(_0x242e15){_0x8b72ab[_0x347fc7(0x20a)][_0x347fc7(0x277)]({'name':_0x2e86c9[_0x347fc7(0x290)]['name'],'action':_0x347fc7(0x1ba),'error':_0x242e15['message']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x20a)]['errors']++;}}for(const _0x276859 of _0x1a3e3b){try{const _0x27bacf=yamlExperimentalKnowledgeBaseToApi(_0x276859[_0x347fc7(0x290)],_0x49ac2a),_0x1e0f82=await this[_0x347fc7(0x203)]['createExperimentalKnowledgeBase'](_0x27bacf);_0x3faaf5[_0x347fc7(0x26f)](_0x276859[_0x347fc7(0x290)][_0x347fc7(0x1da)],_0x1e0f82['id']),_0x8b72ab[_0x347fc7(0x1cb)][_0x347fc7(0x277)]({'name':_0x276859[_0x347fc7(0x290)][_0x347fc7(0x1da)],'action':'created','id':_0x1e0f82['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x1cb)][_0x347fc7(0x27b)]++;}catch(_0x52b5f8){_0x8b72ab[_0x347fc7(0x1cb)][_0x347fc7(0x277)]({'name':_0x276859['def'][_0x347fc7(0x1da)],'action':'error','error':_0x52b5f8['message']}),_0x8b72ab['counts'][_0x347fc7(0x1cb)][_0x347fc7(0x1a5)]++;}}const _0x4a37cb=[..._0x9cd1b][_0x347fc7(0x23e)]((_0x5cde3e,_0x36fa2b)=>{const _0x10ced8=_0x347fc7,_0x5bc9e6=_0x5cde3e[_0x10ced8(0x28b)]['tools']?.['some'](_0x1f73a6=>_0x1f73a6['type']===_0x10ced8(0x1b7))??![],_0x1430bb=_0x36fa2b[_0x10ced8(0x28b)][_0x10ced8(0x17e)]?.[_0x10ced8(0x258)](_0x54281b=>_0x54281b['type']==='agent')??![];if(_0x5bc9e6&&!_0x1430bb)return 0x1;if(!_0x5bc9e6&&_0x1430bb)return-0x1;return 0x0;});for(const _0x201f07 of _0x4a37cb){_0x373869=[];try{const _0x461af6=_0x201f07[_0x347fc7(0x28b)]['tools']?.[_0x347fc7(0x18a)](_0x40b059=>{const _0x24b7d8=_0x347fc7;if(_0x40b059[_0x24b7d8(0x216)]==='agent'&&_0x40b059[_0x24b7d8(0x1d7)]){const _0x335e4c=parseRef(_0x40b059[_0x24b7d8(0x1d7)]);return _0x335e4c?.['name']===_0x201f07[_0x24b7d8(0x28b)][_0x24b7d8(0x1da)];}return![];})??[];if(_0x461af6[_0x347fc7(0x189)]>0x0){const _0x2367e5=_0x347fc7(0x25b)+_0x201f07[_0x347fc7(0x28b)][_0x347fc7(0x1da)]+_0x347fc7(0x1b3)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this[_0x347fc7(0x1b4)][_0x347fc7(0x1eb)](_0x2367e5),_0x373869[_0x347fc7(0x277)](_0x2367e5);}const _0x1842dc=await agentDefToRequest(_0x201f07['yaml'],_0x201f07['systemPrompt'],_0x201f07[_0x347fc7(0x1d0)],_0x4d31ba),_0x3740b2=await this[_0x347fc7(0x203)][_0x347fc7(0x1d1)](_0x1842dc);_0x1bad79['set'](_0x201f07['yaml'][_0x347fc7(0x1da)],_0x3740b2['id']),_0x8b72ab['agents'][_0x347fc7(0x277)]({'agentName':_0x201f07[_0x347fc7(0x28b)]['name'],'action':_0x347fc7(0x27b),'agentId':_0x3740b2['id'],'warnings':_0x373869[_0x347fc7(0x189)]>0x0?_0x373869:undefined}),_0x8b72ab[_0x347fc7(0x1f6)]['agents']['created']++;}catch(_0x4869b8){_0x8b72ab[_0x347fc7(0x1bc)][_0x347fc7(0x277)]({'agentName':_0x201f07['yaml'][_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x4869b8[_0x347fc7(0x1af)],'warnings':_0x373869['length']>0x0?_0x373869:undefined}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x1bc)][_0x347fc7(0x1a5)]++;}}for(const _0x3adfd0 of _0x19013c){try{const _0x33cafe=await yamlPromptToApi(_0x3adfd0[_0x347fc7(0x28b)],_0x49ac2a,_0x4d31ba);if(!_0x33cafe){_0x8b72ab[_0x347fc7(0x25d)][_0x347fc7(0x277)]({'name':_0x3adfd0[_0x347fc7(0x28b)]['name'],'action':'error','error':'Agent\x20reference\x20not\x20found'}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x25d)][_0x347fc7(0x1a5)]++;continue;}const _0x522e97=await this['client'][_0x347fc7(0x256)](_0x33cafe);_0x12b430[_0x347fc7(0x26f)](_0x3adfd0[_0x347fc7(0x28b)][_0x347fc7(0x1da)],_0x522e97['id']),_0x8b72ab[_0x347fc7(0x25d)][_0x347fc7(0x277)]({'name':_0x3adfd0[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':_0x347fc7(0x27b),'id':_0x522e97['id']}),_0x8b72ab['counts'][_0x347fc7(0x25d)][_0x347fc7(0x27b)]++;}catch(_0x1f3508){_0x8b72ab[_0x347fc7(0x25d)][_0x347fc7(0x277)]({'name':_0x3adfd0[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x1f3508[_0x347fc7(0x1af)]}),_0x8b72ab['counts'][_0x347fc7(0x25d)]['errors']++;}}for(const _0x54e76d of _0x4e691a){try{const _0x4390a3=await yamlIntegrationToApi(_0x54e76d[_0x347fc7(0x28b)],_0x49ac2a,_0x4d31ba),_0xd69e1f=await this[_0x347fc7(0x203)][_0x347fc7(0x1a9)](_0x4390a3);_0x8b72ab[_0x347fc7(0x180)]['push']({'name':_0x54e76d[_0x347fc7(0x28b)]['service_type'],'action':_0x347fc7(0x27b),'id':_0xd69e1f['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x180)][_0x347fc7(0x27b)]++;}catch(_0x3b7983){_0x8b72ab[_0x347fc7(0x180)][_0x347fc7(0x277)]({'name':_0x54e76d[_0x347fc7(0x28b)]['service_type'],'action':_0x347fc7(0x1ba),'error':_0x3b7983[_0x347fc7(0x1af)]}),_0x8b72ab[_0x347fc7(0x1f6)]['integrations']['errors']++;}}for(const _0x17a24d of _0x358682){try{const _0x2d886b=await yamlFormInterfaceToApi(_0x17a24d[_0x347fc7(0x28b)],_0x49ac2a,_0x4d31ba);if(!_0x2d886b){_0x8b72ab[_0x347fc7(0x194)][_0x347fc7(0x277)]({'name':_0x17a24d[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x347fc7(0x26c)}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x194)][_0x347fc7(0x1a5)]++;continue;}const _0x7404d8=await this['client'][_0x347fc7(0x1a3)](_0x2d886b);_0x8b72ab[_0x347fc7(0x194)][_0x347fc7(0x277)]({'name':_0x17a24d[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':_0x347fc7(0x27b),'id':_0x7404d8['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x194)][_0x347fc7(0x27b)]++;}catch(_0x13cbdb){_0x8b72ab[_0x347fc7(0x194)][_0x347fc7(0x277)]({'name':_0x17a24d[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':'error','error':_0x13cbdb['message']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x194)][_0x347fc7(0x1a5)]++;}}for(const _0x3a2357 of _0x52b041){try{const _0x17f7d6=await yamlChatInterfaceToApi(_0x3a2357['yaml'],_0x49ac2a,_0x4d31ba),_0x21ee0d=await this['client']['createChatInterface'](_0x17f7d6);_0x8b72ab[_0x347fc7(0x266)][_0x347fc7(0x277)]({'name':_0x3a2357[_0x347fc7(0x28b)]['name'],'action':_0x347fc7(0x27b),'id':_0x21ee0d['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x266)]['created']++;}catch(_0x3fd4a7){_0x8b72ab[_0x347fc7(0x266)]['push']({'name':_0x3a2357['yaml'][_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x3fd4a7['message']}),_0x8b72ab['counts'][_0x347fc7(0x266)][_0x347fc7(0x1a5)]++;}}return _0x8b72ab;}}
1
+ const a134_0x1ba902=a134_0x2202;(function(_0x4f48b5,_0x31bace){const _0x40f78b=a134_0x2202,_0x3dc342=_0x4f48b5();while(!![]){try{const _0x39ff34=parseInt(_0x40f78b(0x115))/0x1+parseInt(_0x40f78b(0x15a))/0x2*(parseInt(_0x40f78b(0x154))/0x3)+-parseInt(_0x40f78b(0xfc))/0x4*(parseInt(_0x40f78b(0x17d))/0x5)+-parseInt(_0x40f78b(0x177))/0x6*(parseInt(_0x40f78b(0xfe))/0x7)+-parseInt(_0x40f78b(0x121))/0x8+-parseInt(_0x40f78b(0xa7))/0x9+parseInt(_0x40f78b(0x16c))/0xa;if(_0x39ff34===_0x31bace)break;else _0x3dc342['push'](_0x3dc342['shift']());}catch(_0x92e298){_0x3dc342['push'](_0x3dc342['shift']());}}}(a134_0x5ef0,0x7cb26));import{LLMApiClient}from'../client/llm-api-client.js';import*as a134_0x2bc8a9 from'node:fs';import*as a134_0x453e78 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{toModelInfos}from'./user-settings.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';function a134_0x2202(_0xcc9880,_0x35bf03){_0xcc9880=_0xcc9880-0x99;const _0x5ef034=a134_0x5ef0();let _0x22027e=_0x5ef034[_0xcc9880];return _0x22027e;}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';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a134_0x1ba902(0x19f),a134_0x1ba902(0xbc),'chat_parent_segment'];async function safeListOrEmpty(_0x2a002e){const _0x4384d0=a134_0x1ba902;try{return await _0x2a002e();}catch(_0x55a42f){if(_0x55a42f instanceof HTTPClientError&&_0x55a42f[_0x4384d0(0x192)]===0x194)return[];throw _0x55a42f;}}export class LLMSDK{['currentProjectId'];['client'];[a134_0x1ba902(0x127)];[a134_0x1ba902(0xc6)]=Logger['of'](a134_0x1ba902(0x1a4));constructor(_0xc8f0e3){const _0x39360e=a134_0x1ba902;this[_0x39360e(0xea)]=new LLMApiClient(_0xc8f0e3),this[_0x39360e(0x127)]=_0xc8f0e3;}[a134_0x1ba902(0x120)](){const _0x37691a=getSanitizedUsername();return'tdx_default_'+_0x37691a;}async[a134_0x1ba902(0x15e)](_0x2f9ab2){const _0x286334=a134_0x1ba902,{projectId:_0xef0476}=await this['resolveProjectName'](_0x2f9ab2);this[_0x286334(0x152)]=_0xef0476;}[a134_0x1ba902(0x148)](){const _0x589b70=a134_0x1ba902;return this[_0x589b70(0x152)];}async[a134_0x1ba902(0x11a)](_0x166301){const _0x39430e=a134_0x1ba902,_0x221056=this['context']['profile'];let _0x11f231,_0x5a68dd;if(_0x166301[_0x39430e(0x16d)]('/')){const _0x1a3b23=_0x166301['split']('/');if(_0x1a3b23['length']!==0x2)throw new SDKError(ErrorCode[_0x39430e(0x10a)],'Invalid\x20agent\x20reference\x20format:\x20'+_0x166301,undefined,{'helpText':_0x39430e(0x153)});const [_0x1c1d77,_0x4216e0]=_0x1a3b23;_0x11f231=await this[_0x39430e(0x11c)](_0x1c1d77),_0x5a68dd=_0x4216e0;}else _0x11f231=this[_0x39430e(0x152)]||(await this[_0x39430e(0x186)]())['id'],_0x5a68dd=_0x166301;const _0x3e8569=await this[_0x39430e(0x189)](_0x5a68dd,_0x11f231),_0x20ec76=await this[_0x39430e(0xea)][_0x39430e(0xd6)](_0x3e8569);writeCachedLLMAgent(_0x20ec76[_0x39430e(0x15d)][_0x39430e(0x12b)],_0x3e8569,_0x11f231,_0x221056);}[a134_0x1ba902(0x155)](){const _0x521a53=a134_0x1ba902,_0x4474b1=this[_0x521a53(0x127)][_0x521a53(0xef)];return readCachedLLMAgent(_0x4474b1)||undefined;}['clearDefaultAgent'](){const _0x3fd1a3=a134_0x1ba902,_0x524009=this['context'][_0x3fd1a3(0xef)];clearCachedLLMAgent(_0x524009);}async[a134_0x1ba902(0x16a)](){const _0x12beb2=a134_0x1ba902,_0x28c237=await this[_0x12beb2(0xea)]['getUserSettings']();return toModelInfos(_0x28c237);}async[a134_0x1ba902(0x170)](_0x55da05){const _0xc8785e=a134_0x1ba902;return await this[_0xc8785e(0xea)][_0xc8785e(0x170)](_0x55da05);}async[a134_0x1ba902(0xa0)](_0x4fe26f){const _0x3057b1=a134_0x1ba902,{projectId:_0x3ae675}=await this[_0x3057b1(0x13e)](_0x4fe26f);await this[_0x3057b1(0xea)]['deleteProject'](_0x3ae675);}async['projects'](_0x5bbb7c=0x32){const _0x452176=a134_0x1ba902;return await this[_0x452176(0xea)][_0x452176(0x183)](_0x5bbb7c);}async[a134_0x1ba902(0x186)](_0x22828e){const _0x335eb1=a134_0x1ba902,_0x2f04b8=_0x22828e||this['getDefaultProjectName'](),_0x18e40e=this[_0x335eb1(0x127)][_0x335eb1(0xef)];if(!_0x22828e){const _0x25b943=readCachedLLMProject(_0x18e40e);if(_0x25b943&&_0x25b943[_0x335eb1(0x12b)]===_0x2f04b8)try{const _0x26c24c=await this[_0x335eb1(0xea)][_0x335eb1(0x125)](_0x25b943['id']);if(_0x26c24c[_0x335eb1(0x15d)][_0x335eb1(0x12b)]===_0x2f04b8)return _0x26c24c;}catch{}}const _0x29f4fc=await this['client'][_0x335eb1(0x183)](),_0x50fa9c=_0x29f4fc['find'](_0x2b3bd2=>_0x2b3bd2[_0x335eb1(0x15d)][_0x335eb1(0x12b)]===_0x2f04b8);if(_0x50fa9c)return!_0x22828e&&writeCachedLLMProject(_0x2f04b8,_0x50fa9c['id'],_0x18e40e),_0x50fa9c;const _0x252f21=await this[_0x335eb1(0xea)][_0x335eb1(0x170)]({'name':_0x2f04b8,'description':'Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20'+getSanitizedUsername()+')'});return!_0x22828e&&writeCachedLLMProject(_0x2f04b8,_0x252f21['id'],_0x18e40e),_0x252f21;}async[a134_0x1ba902(0x11c)](_0x22022c){const _0x29c9ad=a134_0x1ba902,_0x55b081=await this[_0x29c9ad(0xea)][_0x29c9ad(0x183)](),_0x5f04d9=_0x55b081[_0x29c9ad(0x126)](_0x36059e=>_0x36059e['attributes'][_0x29c9ad(0x12b)]===_0x22022c);if(_0x5f04d9[_0x29c9ad(0x10e)]===0x0)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x29c9ad(0x103)+_0x22022c,undefined,{'helpText':_0x29c9ad(0xc3)});if(_0x5f04d9['length']>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x29c9ad(0x156)+_0x22022c+'\x27.\x20This\x20should\x20not\x20happen.');return _0x5f04d9[0x0]['id'];}async['resolveProjectName'](_0x300436){const _0x376454=a134_0x1ba902,_0x589375=await this[_0x376454(0xea)][_0x376454(0x183)](),_0x2a56f4=_0x589375[_0x376454(0x151)](_0x3ab1bc=>_0x3ab1bc[_0x376454(0x15d)][_0x376454(0x12b)]===_0x300436);if(_0x2a56f4)return{'projectId':_0x2a56f4['id'],'project':_0x2a56f4};throw new SDKError(ErrorCode[_0x376454(0xee)],_0x376454(0x103)+_0x300436,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async[a134_0x1ba902(0xca)](_0x578c50=a134_0x1ba902(0x195),_0xd4b9d5=0x0,_0xcf193d){const _0x2d108f=a134_0x1ba902,_0x6fc1bc=0xa;let _0x2b213d=0x0,_0x2f6fcc;while(_0x2b213d<_0x6fc1bc){try{const _0x34336a=await this[_0x2d108f(0x186)](_0x2f6fcc),_0x3bd101=_0x34336a['id'],_0x3ad4e7=[_0x2d108f(0x147),_0x2d108f(0xbe),'low',_0x2d108f(0x129),_0x2d108f(0x12f)],_0x13cb41=_0xd4b9d5===0x0?_0x2d108f(0x1a5)+_0x578c50:_0x2d108f(0x1a5)+_0x578c50+_0x2d108f(0x113)+_0x3ad4e7[_0xd4b9d5],_0x4af1de=await this[_0x2d108f(0xea)]['listAgents'](_0x3bd101),_0xb42539=_0x4af1de[_0x2d108f(0x151)](_0x5b40ec=>_0x5b40ec['attributes'][_0x2d108f(0x12b)]===_0x13cb41);if(_0xb42539)return _0xb42539;const _0x3203a1=_0xd4b9d5>0x0?0x1:_0xcf193d;return await this[_0x2d108f(0xea)][_0x2d108f(0xb3)]({'name':_0x13cb41,'projectId':_0x3bd101,'modelType':_0x578c50,'systemPrompt':'','temperature':_0x3203a1,'reasoningEffort':_0xd4b9d5>0x0?_0xd4b9d5:undefined});}catch(_0x2065f2){if(_0x2065f2 instanceof HTTPClientError){const _0x260a47=_0x2065f2[_0x2d108f(0x192)];if(_0x260a47>=0x190&&_0x260a47<0x1f4){if(_0x260a47===0x191)throw new SDKError(ErrorCode[_0x2d108f(0xcc)],'Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.',_0x2065f2);else{if(_0x260a47===0x193)throw new SDKError(ErrorCode[_0x2d108f(0x1b0)],_0x2d108f(0xe8),_0x2065f2);}throw _0x2065f2;}}if(errorContains(_0x2065f2,_0x2d108f(0x185),_0x2d108f(0x19b),_0x2d108f(0x173))){_0x2b213d++;if(_0x2b213d>=_0x6fc1bc)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x2d108f(0xe9)+_0x6fc1bc+_0x2d108f(0xcb),_0x2065f2);const _0x433ca6=this['getDefaultProjectName']();_0x2f6fcc=_0x433ca6+'_'+generateRandomHex();continue;}throw _0x2065f2;}}throw new SDKError(ErrorCode[_0x2d108f(0x1a3)],'Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts');}async['resolveAgentId'](_0x1663ae,_0x52e578){const _0x3601b1=a134_0x1ba902,_0x4add34=_0x52e578||this['currentProjectId'],_0x264c6c=await this[_0x3601b1(0xea)][_0x3601b1(0x131)](_0x4add34),_0x237e3b=_0x264c6c[_0x3601b1(0x126)](_0x511317=>_0x511317[_0x3601b1(0x15d)]['name']===_0x1663ae);if(_0x237e3b[_0x3601b1(0x10e)]===0x0){const _0x295f64=_0x4add34?_0x3601b1(0xf5)+_0x4add34:'';throw new SDKError(ErrorCode[_0x3601b1(0x107)],_0x3601b1(0x105)+_0x1663ae+_0x295f64,undefined,{'helpText':_0x4add34?_0x3601b1(0x137):_0x3601b1(0x141)});}if(_0x237e3b[_0x3601b1(0x10e)]>0x1)throw new SDKError(ErrorCode[_0x3601b1(0x1a3)],_0x3601b1(0x1a0)+_0x1663ae+'\x27.\x20This\x20should\x20not\x20happen.');return _0x237e3b[0x0]['id'];}async[a134_0x1ba902(0x1a9)](_0xd33a6d){const _0x36553d=a134_0x1ba902,_0x12d423=_0xd33a6d||this[_0x36553d(0x152)];return await this[_0x36553d(0xea)][_0x36553d(0x131)](_0x12d423);}async[a134_0x1ba902(0xcd)](_0x1d3b43){const _0x17cf78=a134_0x1ba902;return await this['client'][_0x17cf78(0x118)](_0x1d3b43);}async[a134_0x1ba902(0x169)](_0x5cf37b){return await this['client']['getAgent'](_0x5cf37b);}async[a134_0x1ba902(0xb3)](_0x214b75){const _0x295a52=a134_0x1ba902;return await this[_0x295a52(0xea)][_0x295a52(0xb3)](_0x214b75);}async[a134_0x1ba902(0xc1)](_0x16e501,_0x3b179f){const _0x145f59=a134_0x1ba902;return await this[_0x145f59(0xea)][_0x145f59(0xc1)](_0x16e501,_0x3b179f);}async[a134_0x1ba902(0x18b)](_0x285ff2){const _0x3fc443=a134_0x1ba902;await this[_0x3fc443(0xea)][_0x3fc443(0x18b)](_0x285ff2);}async['startChat'](_0x257645){const _0x320636=a134_0x1ba902;return await this[_0x320636(0xea)][_0x320636(0x18c)]({'agentId':_0x257645});}async*[a134_0x1ba902(0x9a)](_0x1abfed,_0x27e910){const _0xd81d6=a134_0x1ba902;let _0x2c35b4=_0x27e910?.[_0xd81d6(0x199)];const _0x514fe7=_0x27e910?.[_0xd81d6(0x18e)];if(!_0x2c35b4){if(!_0x514fe7)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0xb09c0c=await this[_0xd81d6(0xea)]['startChat']({'agentId':_0x514fe7});_0x2c35b4=_0xb09c0c['id'],yield{'type':_0xd81d6(0xba),'data':{'chatId':_0x2c35b4,'agentId':_0x514fe7,'projectId':_0xb09c0c[_0xd81d6(0x15d)][_0xd81d6(0x10d)]}};}for await(const _0x5a83de of this[_0xd81d6(0xea)][_0xd81d6(0xda)](_0x2c35b4,_0x1abfed,_0x27e910?.['signal'])){yield{'type':'event','data':_0x5a83de};}}async[a134_0x1ba902(0xd5)](_0x39d2f3=0x32){const _0x3e1229=a134_0x1ba902;return await this[_0x3e1229(0xea)][_0x3e1229(0x1a1)](_0x39d2f3);}async[a134_0x1ba902(0xa4)](_0x212f9e){const _0x5b160b=a134_0x1ba902;return await this[_0x5b160b(0xea)][_0x5b160b(0xd4)](_0x212f9e);}async[a134_0x1ba902(0xb8)](_0x10c612){const _0x3806a4=a134_0x1ba902;return await this[_0x3806a4(0xea)][_0x3806a4(0xb8)](_0x10c612);}async['chatInfo'](_0x30b74a){const _0x3bcbc0=a134_0x1ba902;return await this[_0x3bcbc0(0xea)]['getChatInfo'](_0x30b74a);}async[a134_0x1ba902(0xc8)](_0x496be0,_0x5f061d,_0x110388){const _0x1d14e7=a134_0x1ba902,_0x49ed2a=_0x110388?.[_0x1d14e7(0xf8)]??![],{projectId:_0x1d9f76,project:_0x5b136d}=await this[_0x1d14e7(0x13e)](_0x496be0),_0x86285=_0x5b136d[_0x1d14e7(0x15d)][_0x1d14e7(0x12b)],_0x56bfa4=_0x5f061d||_0x86285+'.llm';if(a134_0x2bc8a9['existsSync'](_0x56bfa4)&&!_0x49ed2a)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x1d14e7(0x167)+_0x56bfa4,undefined,{'helpText':'Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.'});const _0x4fe335=await this[_0x1d14e7(0xea)]['listAgentsFull'](_0x1d9f76),_0x1731df=await this[_0x1d14e7(0xea)][_0x1d14e7(0x19a)](_0x1d9f76),_0xeb75db=await this['client'][_0x1d14e7(0xfd)](_0x1d9f76),_0x4afb1a=await this[_0x1d14e7(0xea)][_0x1d14e7(0xf3)](_0x1d9f76);if(!_0x49ed2a){a134_0x2bc8a9[_0x1d14e7(0x181)](_0x56bfa4,{'recursive':!![]});const _0x4fff46={'version':'1.0','exportedAt':new Date()['toISOString'](),'exportedFrom':{'site':this[_0x1d14e7(0x127)][_0x1d14e7(0xc4)],'projectId':_0x1d9f76,'projectName':_0x86285},'project':_0x5b136d};a134_0x2bc8a9['writeFileSync'](a134_0x453e78[_0x1d14e7(0x133)](_0x56bfa4,_0x1d14e7(0x163)),JSON[_0x1d14e7(0xbd)](_0x4fff46,null,0x2)),a134_0x2bc8a9[_0x1d14e7(0x138)](a134_0x453e78[_0x1d14e7(0x133)](_0x56bfa4,'agents.json'),JSON[_0x1d14e7(0xbd)](_0x4fe335,null,0x2)),a134_0x2bc8a9[_0x1d14e7(0x138)](a134_0x453e78[_0x1d14e7(0x133)](_0x56bfa4,_0x1d14e7(0xfb)),JSON[_0x1d14e7(0xbd)](_0x1731df,null,0x2)),a134_0x2bc8a9[_0x1d14e7(0x138)](a134_0x453e78[_0x1d14e7(0x133)](_0x56bfa4,_0x1d14e7(0xdc)),JSON[_0x1d14e7(0xbd)](_0xeb75db,null,0x2)),a134_0x2bc8a9[_0x1d14e7(0x138)](a134_0x453e78[_0x1d14e7(0x133)](_0x56bfa4,_0x1d14e7(0x9f)),JSON[_0x1d14e7(0xbd)](_0x4afb1a,null,0x2));}return{'projectName':_0x86285,'outputDir':_0x56bfa4,'counts':{'agents':_0x4fe335[_0x1d14e7(0x10e)],'knowledgeBases':_0x1731df[_0x1d14e7(0x10e)],'prompts':_0xeb75db[_0x1d14e7(0x10e)],'integrations':_0x4afb1a[_0x1d14e7(0x10e)]}};}async[a134_0x1ba902(0xf4)](_0x517b87,_0x3f60b9){const _0x48a995=a134_0x1ba902,_0x448cfd=_0x3f60b9?.[_0x48a995(0xf8)]??![],_0x329da4=this[_0x48a995(0x134)](_0x517b87),_0x6e56cb=_0x329da4[_0x48a995(0x12c)]['site'],_0x440e68=this[_0x48a995(0x127)]['site'],_0x108cff=_0x6e56cb!==_0x440e68?_0x6e56cb:undefined,_0x508a75=this[_0x48a995(0x157)](a134_0x453e78['join'](_0x517b87,_0x48a995(0x14d)),[]),_0x3071f3=this[_0x48a995(0x157)](a134_0x453e78[_0x48a995(0x133)](_0x517b87,_0x48a995(0xfb)),[]),_0x59fc73=this[_0x48a995(0x157)](a134_0x453e78[_0x48a995(0x133)](_0x517b87,_0x48a995(0xdc)),[]),_0x37909f=this[_0x48a995(0x157)](a134_0x453e78[_0x48a995(0x133)](_0x517b87,'integrations.json'),[]),_0x5117a5=_0x3f60b9?.['name']||_0x329da4['exportedFrom'][_0x48a995(0xa9)];if(_0x448cfd){const _0x280bd1=new Map(),_0x2ef0d5=[..._0x508a75],_0x2ed726=_0x508a75[_0x48a995(0x10e)]+0x1;let _0x4f71a2=0x0;while(_0x2ef0d5['length']>0x0&&_0x4f71a2<_0x2ed726){_0x4f71a2++;const _0x2cf549=[];for(const _0x32385d of _0x2ef0d5){canCreateAgent(_0x32385d,_0x280bd1)?_0x280bd1[_0x48a995(0x116)](_0x32385d['id'],_0x48a995(0x100)+_0x32385d['id']):_0x2cf549[_0x48a995(0x1ac)](_0x32385d);}if(_0x2cf549[_0x48a995(0x10e)]===_0x2ef0d5['length'])throw new SDKError(ErrorCode[_0x48a995(0x1a3)],_0x48a995(0x112),undefined,{'helpText':_0x48a995(0x143)});_0x2ef0d5[_0x48a995(0x10e)]=0x0,_0x2ef0d5[_0x48a995(0x1ac)](..._0x2cf549);}const _0x386815=_0x59fc73[_0x48a995(0x126)](_0x3b88b2=>_0x280bd1[_0x48a995(0x128)](_0x3b88b2[_0x48a995(0x15d)][_0x48a995(0x18e)]))[_0x48a995(0x10e)];return{'projectName':_0x5117a5,'projectId':_0x48a995(0xe4),'counts':{'agents':_0x508a75[_0x48a995(0x10e)],'knowledgeBases':_0x3071f3['length'],'prompts':_0x386815,'integrations':_0x37909f[_0x48a995(0x10e)]},'sourceSite':_0x108cff};}const _0xd70b93=await this['client'][_0x48a995(0x170)]({'name':_0x5117a5,'description':_0x329da4['project']['attributes'][_0x48a995(0xb9)]}),_0x2da7da=_0xd70b93['id'],_0x40be80=new Map(),_0x14e7bc=new Map(),_0x5a6b64=new Map();for(const _0x548499 of _0x3071f3){const _0x4f3e97=await this['client'][_0x48a995(0x178)]({'projectId':_0x2da7da,'name':_0x548499[_0x48a995(0x15d)][_0x48a995(0x12b)],'tdDatabaseName':_0x548499[_0x48a995(0x15d)][_0x48a995(0xe2)],'tables':_0x548499['attributes']['tables']});_0x40be80[_0x48a995(0x116)](_0x548499['id'],_0x4f3e97['id']);}const _0x4a7da2=[..._0x508a75],_0x1e4bca=_0x508a75[_0x48a995(0x10e)]+0x1;let _0x5435d7=0x0;while(_0x4a7da2[_0x48a995(0x10e)]>0x0&&_0x5435d7<_0x1e4bca){_0x5435d7++;const _0x2ea1c7=[];for(const _0x33e2ab of _0x4a7da2){if(canCreateAgent(_0x33e2ab,_0x14e7bc)){const _0xd7752b=remapToolIds(_0x33e2ab['attributes']['tools'],_0x40be80,_0x14e7bc),_0x2a4bd2=remapVariableIds(_0x33e2ab[_0x48a995(0x15d)]['variables'],_0x40be80),_0x3da88e=await this[_0x48a995(0xea)][_0x48a995(0xaa)]({'name':_0x33e2ab[_0x48a995(0x15d)][_0x48a995(0x12b)],'projectId':_0x2da7da,'systemPrompt':_0x33e2ab[_0x48a995(0x15d)][_0x48a995(0x15c)],'starterMessage':_0x33e2ab[_0x48a995(0x15d)][_0x48a995(0xf9)],'modelType':migrateModelType(_0x33e2ab[_0x48a995(0x15d)][_0x48a995(0x168)]),'maxToolIterations':_0x33e2ab[_0x48a995(0x15d)]['maxToolIterations'],'temperature':_0x33e2ab[_0x48a995(0x15d)][_0x48a995(0xb5)],'reasoningEffort':_0x33e2ab[_0x48a995(0x15d)][_0x48a995(0x180)],'outputs':_0x33e2ab[_0x48a995(0x15d)]['outputs'],'tools':_0xd7752b,'variables':_0x2a4bd2});_0x14e7bc[_0x48a995(0x116)](_0x33e2ab['id'],_0x3da88e['id']);}else _0x2ea1c7[_0x48a995(0x1ac)](_0x33e2ab);}if(_0x2ea1c7[_0x48a995(0x10e)]===_0x4a7da2[_0x48a995(0x10e)])throw new SDKError(ErrorCode[_0x48a995(0x1a3)],_0x48a995(0x112),undefined,{'helpText':_0x48a995(0x143)});_0x4a7da2[_0x48a995(0x10e)]=0x0,_0x4a7da2['push'](..._0x2ea1c7);}for(const _0x553217 of _0x59fc73){const _0x3d6e99=_0x14e7bc['get'](_0x553217['attributes'][_0x48a995(0x18e)]);if(!_0x3d6e99)continue;const _0x56abb7=await this['client']['createPrompt']({'projectId':_0x2da7da,'agentId':_0x3d6e99,'name':_0x553217['attributes'][_0x48a995(0x12b)],'systemPrompt':_0x553217[_0x48a995(0x15d)][_0x48a995(0x15c)],'template':_0x553217[_0x48a995(0x15d)]['template'],'jsonSchemaHint':_0x553217[_0x48a995(0x15d)][_0x48a995(0x111)]});_0x5a6b64[_0x48a995(0x116)](_0x553217['id'],_0x56abb7['id']);}for(const _0x2236f7 of _0x37909f){const _0x2c6012=_0x2236f7['attributes'][_0x48a995(0x13b)]['map'](_0x385735=>({..._0x385735,'promptId':_0x5a6b64[_0x48a995(0x9d)](_0x385735[_0x48a995(0x161)])||_0x385735[_0x48a995(0x161)]}));await this[_0x48a995(0xea)][_0x48a995(0x10b)]({'projectId':_0x2da7da,'serviceType':_0x2236f7['attributes'][_0x48a995(0x114)],'actions':_0x2c6012,'slackMessageMode':_0x2236f7[_0x48a995(0x15d)][_0x48a995(0x179)],'chatIgnoreManagedActions':_0x2236f7[_0x48a995(0x15d)]['chatIgnoreManagedActions'],'chatWelcomeMessage':_0x2236f7[_0x48a995(0x15d)][_0x48a995(0x99)],'webhookCorsOrigins':_0x2236f7['attributes'][_0x48a995(0x18f)]});}return{'projectName':_0x5117a5,'projectId':_0x2da7da,'counts':{'agents':_0x14e7bc['size'],'knowledgeBases':_0x40be80['size'],'prompts':_0x5a6b64['size'],'integrations':_0x37909f['length']},'sourceSite':_0x108cff};}['loadJsonFile'](_0x2715b6,_0x3a8020){const _0x352635=a134_0x1ba902;if(!a134_0x2bc8a9[_0x352635(0x149)](_0x2715b6))return _0x3a8020;return JSON['parse'](a134_0x2bc8a9[_0x352635(0x198)](_0x2715b6,_0x352635(0x14e)));}[a134_0x1ba902(0x134)](_0x13736e){const _0x4e1c11=a134_0x1ba902;if(!a134_0x2bc8a9['existsSync'](_0x13736e))throw new SDKError(ErrorCode[_0x4e1c11(0xe0)],_0x4e1c11(0xa2)+_0x13736e,undefined,{'helpText':_0x4e1c11(0x17c)});const _0x1233ec=a134_0x453e78[_0x4e1c11(0x133)](_0x13736e,_0x4e1c11(0x163));if(!a134_0x2bc8a9[_0x4e1c11(0x149)](_0x1233ec))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4e1c11(0x13a)+_0x13736e,undefined,{'helpText':_0x4e1c11(0x16b)});const _0x49b19f=JSON[_0x4e1c11(0x9e)](a134_0x2bc8a9[_0x4e1c11(0x198)](_0x1233ec,'utf-8'));if(!isSupportedBackupVersion(_0x49b19f['version']))throw new SDKError(ErrorCode[_0x4e1c11(0x10a)],_0x4e1c11(0xf7)+_0x49b19f[_0x4e1c11(0xd3)],undefined,{'helpText':_0x4e1c11(0x9b)});return _0x49b19f;}async[a134_0x1ba902(0xeb)](_0x464fb7,_0x43f237,_0x26bea9){const _0x454d00=a134_0x1ba902,{projectId:_0x5afb61,project:_0x18ec76}=await this['resolveProjectName'](_0x464fb7),_0x4cac4e=_0x18ec76['attributes']['name'];let _0x47216f;if(_0x43f237)_0x47216f=_0x43f237;else{const _0x3372b9=a134_0x453e78[_0x454d00(0x133)](process[_0x454d00(0xc0)](),_0x454d00(0x1a9)),_0x1b47f0=getSanitizedPathWithMigration(_0x3372b9,_0x4cac4e);_0x1b47f0[_0x454d00(0x9c)]&&this[_0x454d00(0xc6)][_0x454d00(0x17e)]('Renamed\x20folder:\x20'+a134_0x453e78[_0x454d00(0x188)](_0x1b47f0[_0x454d00(0x1a6)])+_0x454d00(0xc2)+a134_0x453e78[_0x454d00(0x188)](_0x1b47f0['path'])),_0x47216f=_0x1b47f0['path'];}const _0x4616a3=await this[_0x454d00(0xea)][_0x454d00(0x118)](_0x5afb61),_0x216c8a=await this[_0x454d00(0xea)][_0x454d00(0x19a)](_0x5afb61),_0x535905=await this[_0x454d00(0xea)][_0x454d00(0x142)](_0x5afb61),_0xe3fa4a=await safeListOrEmpty(()=>this[_0x454d00(0xea)]['listImageGenerators'](_0x5afb61)),_0x4fd4b1=await safeListOrEmpty(()=>this[_0x454d00(0xea)][_0x454d00(0x16f)](_0x5afb61)),_0x7307e4=await this[_0x454d00(0xea)][_0x454d00(0xfd)](_0x5afb61),_0x32f4e8=await this[_0x454d00(0xea)][_0x454d00(0xf3)](_0x5afb61),_0xd14ecf=await safeListOrEmpty(()=>this['client'][_0x454d00(0x11d)](_0x5afb61)),_0x2194d3=await safeListOrEmpty(()=>this[_0x454d00(0xea)][_0x454d00(0xb1)](_0x5afb61)),_0x7e9b51=await safeListOrEmpty(()=>this[_0x454d00(0xea)][_0x454d00(0x132)](_0x5afb61)),_0x344ed6=await safeListOrEmpty(()=>this['client'][_0x454d00(0x13f)](_0x5afb61)),_0x5ed293=_0x32f4e8[_0x454d00(0x126)](_0x5da926=>!_0x5da926[_0x454d00(0x15d)][_0x454d00(0x190)]&&SAFE_INTEGRATION_TYPES[_0x454d00(0x16d)](_0x5da926[_0x454d00(0x15d)][_0x454d00(0x114)][_0x454d00(0x13d)]())),_0x182e03=new Map(),_0xb511c1=new Map(),_0x13d396=new Map(),_0xe67aa7=new Map(),_0x21be7e=new Map(),_0x33049d=new Map(),_0x3a8801=new Map();for(const _0x5d87a7 of _0x4616a3){_0x182e03[_0x454d00(0x116)](_0x5d87a7['id'],_0x5d87a7[_0x454d00(0x15d)][_0x454d00(0x12b)]);}for(const _0x5cb145 of _0x216c8a){_0xb511c1[_0x454d00(0x116)](_0x5cb145['id'],_0x5cb145[_0x454d00(0x15d)][_0x454d00(0x12b)]);}for(const _0x3d5532 of _0x535905){_0x13d396[_0x454d00(0x116)](_0x3d5532['id'],_0x3d5532[_0x454d00(0x15d)]['name']);}for(const _0x4bd29d of _0xe3fa4a){_0xe67aa7[_0x454d00(0x116)](_0x4bd29d['id'],_0x4bd29d[_0x454d00(0x15d)]['name']);}for(const _0x2747d8 of _0x4fd4b1){_0x21be7e['set'](_0x2747d8['id'],_0x2747d8[_0x454d00(0x15d)][_0x454d00(0x12b)]);}for(const _0x40e4fd of _0x7307e4){_0x33049d[_0x454d00(0x116)](_0x40e4fd['id'],_0x40e4fd['attributes'][_0x454d00(0x12b)]);}for(const _0x2642ba of _0xd14ecf){_0x3a8801['set'](_0x2642ba['id'],_0x2642ba['attributes'][_0x454d00(0x12b)]);}const _0x2daf6f={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0xb511c1,'TextKnowledgeBase':_0x13d396,'Agent':_0x182e03,'WebSearchTool':_0x21be7e,'ImageGenerator':_0xe67aa7,'ExperimentalKnowledgeBase':_0x3a8801}),'resolvePromptName':async _0xb59938=>_0x33049d[_0x454d00(0x9d)](_0xb59938),'onWarning':_0x35ba0f=>this[_0x454d00(0xc6)][_0x454d00(0x1a2)](_0x35ba0f)},_0x4008df={'projectName':_0x4cac4e,'outputDir':_0x47216f,'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}}},_0x208da5=[],_0x271618=[];for(const _0x24ab75 of _0x4616a3){const _0xdadbbf=getSanitizedPathWithMigration(_0x47216f,_0x24ab75[_0x454d00(0x15d)][_0x454d00(0x12b)]);_0xdadbbf[_0x454d00(0x9c)]&&this[_0x454d00(0xc6)][_0x454d00(0x17e)](_0x454d00(0x184)+a134_0x453e78['basename'](_0xdadbbf[_0x454d00(0x1a6)])+_0x454d00(0xc2)+a134_0x453e78[_0x454d00(0x188)](_0xdadbbf['path']));const _0x5a2dfc=_0xdadbbf[_0x454d00(0x14b)],_0x5965b6=a134_0x453e78['join'](_0x5a2dfc,_0x454d00(0x15f)),_0x4005ca=a134_0x453e78[_0x454d00(0x133)](_0x5a2dfc,_0x454d00(0xff)),_0x1cb6fe=a134_0x453e78[_0x454d00(0x133)](_0x5a2dfc,_0x454d00(0xcf)),{yaml:_0x4cf9cd,systemPrompt:_0xf6a8de,starterMessage:_0x1246d2}=await agentResponseToDef(_0x24ab75,_0x2daf6f),_0x55d5c7=toAgentYamlString(_0x4cf9cd),_0x1c5a38=!a134_0x2bc8a9[_0x454d00(0x149)](_0x4005ca);let _0x5a717d=_0x1c5a38,_0x4a8276;if(!_0x1c5a38){const _0x4f9f27=a134_0x2bc8a9[_0x454d00(0x149)](_0x5965b6)?a134_0x2bc8a9[_0x454d00(0x198)](_0x5965b6,_0x454d00(0x14e)):'',_0x3ca341=a134_0x2bc8a9[_0x454d00(0x198)](_0x4005ca,_0x454d00(0x14e)),_0x4d641b=_0x454d00(0x108)+_0x4f9f27+_0x454d00(0x175)+_0x3ca341,_0x574f38='#\x20prompt.md\x0a'+_0xf6a8de+_0x454d00(0x175)+_0x55d5c7,_0x4e3049=generateDiff(_0x4d641b,_0x574f38);_0x5a717d=hasChanges(_0x4e3049),_0x5a717d&&(_0x4a8276=formatDiffWithColors(_0x4e3049));}_0x208da5[_0x454d00(0x1ac)]({'path':_0x5a2dfc,'content':'','isDir':!![]}),_0x208da5[_0x454d00(0x1ac)]({'path':_0x5965b6,'content':_0xf6a8de}),_0x208da5[_0x454d00(0x1ac)]({'path':_0x4005ca,'content':_0x55d5c7});_0x1246d2&&_0x1246d2[_0x454d00(0x16d)]('\x0a')&&_0x208da5['push']({'path':_0x1cb6fe,'content':_0x1246d2});_0x4008df['agents'][_0x454d00(0x1ac)]({'agentName':_0x24ab75[_0x454d00(0x15d)][_0x454d00(0x12b)],'outputPath':_0x5a2dfc,'isNew':_0x1c5a38,'hasChanges':_0x5a717d,'diff':_0x4a8276}),_0x4008df[_0x454d00(0xec)]['agents'][_0x454d00(0x17f)]++;if(_0x1c5a38)_0x4008df['counts'][_0x454d00(0x1a9)][_0x454d00(0x101)]++;else{if(_0x5a717d)_0x4008df[_0x454d00(0xec)][_0x454d00(0x1a9)]['updated']++;else _0x4008df[_0x454d00(0xec)]['agents'][_0x454d00(0x14f)]++;}}for(const _0x2737b8 of _0x216c8a){if(_0x2737b8[_0x454d00(0x15d)][_0x454d00(0x190)])continue;const _0x3d4b86=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x47216f),_0x2737b8[_0x454d00(0x15d)][_0x454d00(0x12b)],_0x454d00(0xb7));_0x3d4b86[_0x454d00(0x9c)]&&this[_0x454d00(0xc6)][_0x454d00(0x17e)](_0x454d00(0xb2)+a134_0x453e78[_0x454d00(0x188)](_0x3d4b86['oldPath'])+_0x454d00(0xc2)+a134_0x453e78[_0x454d00(0x188)](_0x3d4b86['path']));const _0x526976=_0x3d4b86['path'],_0x346441=apiKnowledgeBaseToYaml(_0x2737b8),_0x4b7341=toKnowledgeBaseYamlString(_0x346441),_0x3bc8b6=!a134_0x2bc8a9[_0x454d00(0x149)](_0x526976);let _0x4304b3=_0x3bc8b6,_0x298a7f;if(!_0x3bc8b6){const _0x3ea4f3=a134_0x2bc8a9[_0x454d00(0x198)](_0x526976,_0x454d00(0x14e)),_0x4ae7f9=generateDiff(_0x3ea4f3,_0x4b7341);_0x4304b3=hasChanges(_0x4ae7f9),_0x4304b3&&(_0x298a7f=formatDiffWithColors(_0x4ae7f9));}_0x208da5[_0x454d00(0x1ac)]({'path':_0x526976,'content':_0x4b7341}),_0x4008df[_0x454d00(0xa8)][_0x454d00(0x1ac)]({'name':_0x2737b8['attributes'][_0x454d00(0x12b)],'outputPath':_0x526976,'isNew':_0x3bc8b6,'hasChanges':_0x4304b3,'diff':_0x298a7f}),_0x4008df[_0x454d00(0xec)]['knowledgeBases'][_0x454d00(0x17f)]++;if(_0x3bc8b6)_0x4008df[_0x454d00(0xec)][_0x454d00(0xa8)][_0x454d00(0x101)]++;else{if(_0x4304b3)_0x4008df['counts'][_0x454d00(0xa8)][_0x454d00(0xce)]++;else _0x4008df[_0x454d00(0xec)][_0x454d00(0xa8)][_0x454d00(0x14f)]++;}}for(const _0x16a5d0 of _0x535905){if(_0x16a5d0[_0x454d00(0x15d)][_0x454d00(0x190)])continue;const _0x2dc1c0=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x47216f),_0x16a5d0[_0x454d00(0x15d)][_0x454d00(0x12b)],_0x454d00(0x11f));_0x2dc1c0['renamed']&&this[_0x454d00(0xc6)][_0x454d00(0x17e)]('Renamed\x20text\x20KB\x20file:\x20'+a134_0x453e78[_0x454d00(0x188)](_0x2dc1c0[_0x454d00(0x1a6)])+_0x454d00(0xc2)+a134_0x453e78[_0x454d00(0x188)](_0x2dc1c0[_0x454d00(0x14b)]));const _0x48e753=_0x2dc1c0['path'],_0x3aaa0c=toTextKnowledgeBaseMd(_0x16a5d0[_0x454d00(0x15d)][_0x454d00(0x12b)],_0x16a5d0[_0x454d00(0x15d)][_0x454d00(0x136)]),_0x52e178=!a134_0x2bc8a9[_0x454d00(0x149)](_0x48e753);let _0x36959b=_0x52e178,_0x55773d;if(!_0x52e178){const _0x367e07=a134_0x2bc8a9[_0x454d00(0x198)](_0x48e753,_0x454d00(0x14e)),_0x1c4ae9=generateDiff(_0x367e07,_0x3aaa0c);_0x36959b=hasChanges(_0x1c4ae9),_0x36959b&&(_0x55773d=formatDiffWithColors(_0x1c4ae9));}_0x208da5[_0x454d00(0x1ac)]({'path':_0x48e753,'content':_0x3aaa0c}),_0x4008df['textKnowledgeBases']['push']({'name':_0x16a5d0[_0x454d00(0x15d)]['name'],'outputPath':_0x48e753,'isNew':_0x52e178,'hasChanges':_0x36959b,'diff':_0x55773d}),_0x4008df['counts'][_0x454d00(0x1ab)][_0x454d00(0x17f)]++;if(_0x52e178)_0x4008df['counts'][_0x454d00(0x1ab)][_0x454d00(0x101)]++;else{if(_0x36959b)_0x4008df[_0x454d00(0xec)][_0x454d00(0x1ab)]['updated']++;else _0x4008df[_0x454d00(0xec)][_0x454d00(0x1ab)][_0x454d00(0x14f)]++;}}for(const _0x56c43d of _0x7307e4){if(_0x56c43d[_0x454d00(0x15d)][_0x454d00(0x190)])continue;const _0x1abb4e=getSanitizedPathWithMigration(getPromptsDir(_0x47216f),_0x56c43d[_0x454d00(0x15d)][_0x454d00(0x12b)],_0x454d00(0xb7));_0x1abb4e[_0x454d00(0x9c)]&&this['logger']['info']('Renamed\x20prompt\x20file:\x20'+a134_0x453e78[_0x454d00(0x188)](_0x1abb4e['oldPath'])+_0x454d00(0xc2)+a134_0x453e78[_0x454d00(0x188)](_0x1abb4e[_0x454d00(0x14b)]));const _0x27763c=_0x1abb4e[_0x454d00(0x14b)],_0x36aefe=await apiPromptToYaml(_0x56c43d,_0x2daf6f);if(!_0x36aefe)continue;const _0x38def3=toPromptYamlString(_0x36aefe),_0x5554c0=!a134_0x2bc8a9['existsSync'](_0x27763c);let _0x517519=_0x5554c0,_0xff8dd0;if(!_0x5554c0){const _0x59855e=a134_0x2bc8a9['readFileSync'](_0x27763c,_0x454d00(0x14e)),_0x544117=generateDiff(_0x59855e,_0x38def3);_0x517519=hasChanges(_0x544117),_0x517519&&(_0xff8dd0=formatDiffWithColors(_0x544117));}_0x208da5[_0x454d00(0x1ac)]({'path':_0x27763c,'content':_0x38def3}),_0x4008df[_0x454d00(0x110)][_0x454d00(0x1ac)]({'name':_0x56c43d['attributes'][_0x454d00(0x12b)],'outputPath':_0x27763c,'isNew':_0x5554c0,'hasChanges':_0x517519,'diff':_0xff8dd0}),_0x4008df['counts'][_0x454d00(0x110)][_0x454d00(0x17f)]++;if(_0x5554c0)_0x4008df[_0x454d00(0xec)][_0x454d00(0x110)][_0x454d00(0x101)]++;else{if(_0x517519)_0x4008df[_0x454d00(0xec)][_0x454d00(0x110)][_0x454d00(0xce)]++;else _0x4008df['counts'][_0x454d00(0x110)]['unchanged']++;}}for(const _0x45f594 of _0x5ed293){const _0x2f5b7f=_0x45f594[_0x454d00(0x15d)]['serviceType'][_0x454d00(0x13d)](),_0x450239=getSanitizedPathWithMigration(getIntegrationsDir(_0x47216f),_0x2f5b7f,'.yml');_0x450239['renamed']&&this[_0x454d00(0xc6)][_0x454d00(0x17e)]('Renamed\x20integration\x20file:\x20'+a134_0x453e78[_0x454d00(0x188)](_0x450239[_0x454d00(0x1a6)])+_0x454d00(0xc2)+a134_0x453e78[_0x454d00(0x188)](_0x450239[_0x454d00(0x14b)]));const _0x20f1cd=_0x450239[_0x454d00(0x14b)],_0x17b3fa=await apiIntegrationToYaml(_0x45f594,_0x2daf6f),_0x4d3189=toIntegrationYamlString(_0x17b3fa),_0xf0a97f=!a134_0x2bc8a9[_0x454d00(0x149)](_0x20f1cd);let _0x1efd60=_0xf0a97f,_0xa6454a;if(!_0xf0a97f){const _0x12a4c5=a134_0x2bc8a9['readFileSync'](_0x20f1cd,_0x454d00(0x14e)),_0x5c917b=generateDiff(_0x12a4c5,_0x4d3189);_0x1efd60=hasChanges(_0x5c917b),_0x1efd60&&(_0xa6454a=formatDiffWithColors(_0x5c917b));}_0x208da5[_0x454d00(0x1ac)]({'path':_0x20f1cd,'content':_0x4d3189}),_0x4008df['integrations'][_0x454d00(0x1ac)]({'name':_0x2f5b7f,'outputPath':_0x20f1cd,'isNew':_0xf0a97f,'hasChanges':_0x1efd60,'diff':_0xa6454a}),_0x4008df[_0x454d00(0xec)]['integrations'][_0x454d00(0x17f)]++;if(_0xf0a97f)_0x4008df['counts'][_0x454d00(0x104)][_0x454d00(0x101)]++;else{if(_0x1efd60)_0x4008df[_0x454d00(0xec)][_0x454d00(0x104)]['updated']++;else _0x4008df[_0x454d00(0xec)][_0x454d00(0x104)]['unchanged']++;}}for(const _0x163f37 of _0xd14ecf){if(_0x163f37['attributes'][_0x454d00(0x190)])continue;const _0x503f73=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x47216f),_0x163f37[_0x454d00(0x15d)]['name']);_0x503f73[_0x454d00(0x9c)]&&this[_0x454d00(0xc6)][_0x454d00(0x17e)](_0x454d00(0x123)+a134_0x453e78[_0x454d00(0x188)](_0x503f73[_0x454d00(0x1a6)])+_0x454d00(0xc2)+a134_0x453e78[_0x454d00(0x188)](_0x503f73['path']));const _0x2eab1a=_0x503f73[_0x454d00(0x14b)],_0x23fcd4=a134_0x453e78[_0x454d00(0x133)](_0x2eab1a,sanitizeForFilesystem(_0x163f37[_0x454d00(0x15d)][_0x454d00(0x12b)])+_0x454d00(0xb7)),_0x531632=a134_0x453e78[_0x454d00(0x133)](_0x2eab1a,_0x454d00(0xa5)),_0x1d3b7f=apiExperimentalKnowledgeBaseToYaml(_0x163f37),_0xb08779=toExperimentalKnowledgeBaseYamlString(_0x1d3b7f),_0x54bd59=!a134_0x2bc8a9[_0x454d00(0x149)](_0x2eab1a);let _0x11b934=_0x54bd59,_0x2bf901,_0x24aa92=_0xb08779;const _0x37f10c=[..._0x1d3b7f['functions']][_0x454d00(0xfa)]((_0x2aa36a,_0x5bc146)=>_0x2aa36a['name'][_0x454d00(0x172)](_0x5bc146[_0x454d00(0x12b)]));for(const _0x29091b of _0x37f10c){_0x24aa92+=_0x454d00(0x12d)+_0x29091b[_0x454d00(0x12b)]+'\x20---\x0a'+_0x29091b[_0x454d00(0xe7)]+_0x454d00(0xf0)+_0x29091b[_0x454d00(0x12b)]+_0x454d00(0x146)+_0x29091b['json_schema']+'\x0a';}if(!_0x54bd59){let _0x28ba80='';a134_0x2bc8a9[_0x454d00(0x149)](_0x23fcd4)&&(_0x28ba80=a134_0x2bc8a9[_0x454d00(0x198)](_0x23fcd4,_0x454d00(0x14e)));if(a134_0x2bc8a9['existsSync'](_0x531632)){const _0xc06a56=a134_0x2bc8a9['readdirSync'](_0x531632,{'withFileTypes':!![]}),_0x110bc1=_0xc06a56['filter'](_0x21e352=>_0x21e352[_0x454d00(0xc7)]())[_0x454d00(0xfa)]((_0x28773f,_0x18d817)=>_0x28773f[_0x454d00(0x12b)][_0x454d00(0x172)](_0x18d817['name']));for(const _0x34dc24 of _0x110bc1){const _0xf3eee3=a134_0x453e78[_0x454d00(0x133)](_0x531632,_0x34dc24[_0x454d00(0x12b)],_0x454d00(0x14a)),_0x2b2509=a134_0x453e78['join'](_0x531632,_0x34dc24[_0x454d00(0x12b)],_0x454d00(0x174));a134_0x2bc8a9[_0x454d00(0x149)](_0xf3eee3)&&(_0x28ba80+=_0x454d00(0x12d)+_0x34dc24[_0x454d00(0x12b)]+_0x454d00(0x146)+a134_0x2bc8a9[_0x454d00(0x198)](_0xf3eee3,_0x454d00(0x14e))+'\x0a'),a134_0x2bc8a9[_0x454d00(0x149)](_0x2b2509)&&(_0x28ba80+=_0x454d00(0xac)+_0x34dc24[_0x454d00(0x12b)]+_0x454d00(0x146)+a134_0x2bc8a9['readFileSync'](_0x2b2509,'utf-8')+'\x0a');}}const _0x4c62dc=generateDiff(_0x28ba80,_0x24aa92);_0x11b934=hasChanges(_0x4c62dc),_0x11b934&&(_0x2bf901=formatDiffWithColors(_0x4c62dc));}_0x208da5[_0x454d00(0x1ac)]({'path':_0x2eab1a,'content':'','isDir':!![]}),_0x208da5['push']({'path':_0x23fcd4,'content':_0xb08779}),_0x208da5[_0x454d00(0x1ac)]({'path':_0x531632,'content':'','isDir':!![]});for(const _0x4a182c of _0x1d3b7f[_0x454d00(0xa5)]){const _0x27593c=a134_0x453e78[_0x454d00(0x133)](_0x531632,sanitizeForFilesystem(_0x4a182c[_0x454d00(0x12b)])),_0x368f6f=a134_0x453e78[_0x454d00(0x133)](_0x27593c,_0x454d00(0x14a)),_0x5664c0=a134_0x453e78[_0x454d00(0x133)](_0x27593c,_0x454d00(0x174));_0x208da5[_0x454d00(0x1ac)]({'path':_0x27593c,'content':'','isDir':!![]}),_0x208da5[_0x454d00(0x1ac)]({'path':_0x368f6f,'content':_0x4a182c[_0x454d00(0xe7)]}),_0x208da5[_0x454d00(0x1ac)]({'path':_0x5664c0,'content':_0x4a182c[_0x454d00(0x162)]});}if(a134_0x2bc8a9['existsSync'](_0x531632)){const _0x2d4a77=a134_0x2bc8a9['readdirSync'](_0x531632,{'withFileTypes':!![]}),_0x1747a1=new Set(_0x1d3b7f[_0x454d00(0xa5)]['map'](_0x20a6ec=>sanitizeForFilesystem(_0x20a6ec[_0x454d00(0x12b)])));for(const _0x5d4f2c of _0x2d4a77){if(_0x5d4f2c[_0x454d00(0xc7)]()&&!_0x1747a1['has'](_0x5d4f2c[_0x454d00(0x12b)])){const _0x851f31=a134_0x453e78[_0x454d00(0x133)](_0x531632,_0x5d4f2c[_0x454d00(0x12b)]);_0x271618[_0x454d00(0x1ac)]({'path':_0x851f31,'isDir':!![]});}}}_0x4008df[_0x454d00(0xc9)]['push']({'name':_0x163f37[_0x454d00(0x15d)]['name'],'outputPath':_0x2eab1a,'isNew':_0x54bd59,'hasChanges':_0x11b934,'diff':_0x2bf901}),_0x4008df[_0x454d00(0xec)][_0x454d00(0xc9)]['total']++;if(_0x54bd59)_0x4008df[_0x454d00(0xec)][_0x454d00(0xc9)][_0x454d00(0x101)]++;else{if(_0x11b934)_0x4008df[_0x454d00(0xec)][_0x454d00(0xc9)]['updated']++;else _0x4008df['counts']['experimentalKnowledgeBases'][_0x454d00(0x14f)]++;}}for(const _0x40c99e of _0x2194d3){if(_0x40c99e[_0x454d00(0x15d)][_0x454d00(0x190)])continue;const _0x608d76=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x47216f),_0x40c99e['attributes']['name']);_0x608d76[_0x454d00(0x9c)]&&this[_0x454d00(0xc6)]['info'](_0x454d00(0x194)+a134_0x453e78['basename'](_0x608d76[_0x454d00(0x1a6)])+_0x454d00(0xc2)+a134_0x453e78[_0x454d00(0x188)](_0x608d76[_0x454d00(0x14b)]));const _0x1dd91f=_0x608d76[_0x454d00(0x14b)],_0x581b90=a134_0x453e78['join'](_0x1dd91f,sanitizeForFilesystem(_0x40c99e['attributes']['name'])+_0x454d00(0xb7)),_0x3cfe90=a134_0x453e78['join'](_0x1dd91f,'code.js'),_0x402512=a134_0x453e78[_0x454d00(0x133)](_0x1dd91f,_0x454d00(0x10f)),_0x3dd36b=apiExperimentalArtifactToYaml(_0x40c99e),_0x4339fb=toExperimentalArtifactYamlString(_0x3dd36b),_0x7555de=!a134_0x2bc8a9['existsSync'](_0x1dd91f);let _0xa1309e=_0x7555de,_0x5a72c8,_0x3ceb2a=_0x4339fb+(_0x454d00(0x12e)+_0x3dd36b[_0x454d00(0xe7)]+'\x0a');const _0x8ad8fb=[..._0x3dd36b[_0x454d00(0x10f)]][_0x454d00(0xfa)]((_0x1ab105,_0x4a8016)=>_0x1ab105[_0x454d00(0xe3)][_0x454d00(0x172)](_0x4a8016[_0x454d00(0xe3)]));for(const _0x563ccc of _0x8ad8fb){_0x3ceb2a+=_0x454d00(0xd9)+_0x563ccc[_0x454d00(0xe3)]+_0x454d00(0x146)+_0x563ccc[_0x454d00(0x18d)]+'\x0a';}if(!_0x7555de){let _0x173024='';a134_0x2bc8a9[_0x454d00(0x149)](_0x581b90)&&(_0x173024=a134_0x2bc8a9['readFileSync'](_0x581b90,_0x454d00(0x14e)));a134_0x2bc8a9[_0x454d00(0x149)](_0x3cfe90)&&(_0x173024+=_0x454d00(0x12e)+a134_0x2bc8a9[_0x454d00(0x198)](_0x3cfe90,_0x454d00(0x14e))+'\x0a');if(a134_0x2bc8a9[_0x454d00(0x149)](_0x402512)){const _0x50e0dc=a134_0x2bc8a9[_0x454d00(0x130)](_0x402512),_0x7713d1=_0x50e0dc[_0x454d00(0x126)](_0xd162a3=>{const _0x5cb956=_0x454d00,_0x1fef5c=a134_0x453e78[_0x5cb956(0x133)](_0x402512,_0xd162a3);return a134_0x2bc8a9['statSync'](_0x1fef5c)['isFile']();})[_0x454d00(0xfa)]((_0x128891,_0x222b41)=>_0x128891[_0x454d00(0x172)](_0x222b41));for(const _0x36a321 of _0x7713d1){const _0x1abbad=a134_0x453e78[_0x454d00(0x133)](_0x402512,_0x36a321);_0x173024+=_0x454d00(0xd9)+_0x36a321+_0x454d00(0x146)+a134_0x2bc8a9['readFileSync'](_0x1abbad,_0x454d00(0x14e))+'\x0a';}}const _0x44c51e=generateDiff(_0x173024,_0x3ceb2a);_0xa1309e=hasChanges(_0x44c51e),_0xa1309e&&(_0x5a72c8=formatDiffWithColors(_0x44c51e));}_0x208da5[_0x454d00(0x1ac)]({'path':_0x1dd91f,'content':'','isDir':!![]}),_0x208da5[_0x454d00(0x1ac)]({'path':_0x581b90,'content':_0x4339fb}),_0x208da5[_0x454d00(0x1ac)]({'path':_0x3cfe90,'content':_0x3dd36b['code']});if(_0x3dd36b['files'][_0x454d00(0x10e)]>0x0){_0x208da5[_0x454d00(0x1ac)]({'path':_0x402512,'content':'','isDir':!![]});for(const _0x2b5fb4 of _0x3dd36b['files']){const _0x4938dd=a134_0x453e78[_0x454d00(0x133)](_0x402512,_0x2b5fb4[_0x454d00(0xe3)]);_0x208da5[_0x454d00(0x1ac)]({'path':_0x4938dd,'content':_0x2b5fb4[_0x454d00(0x18d)]});}}if(a134_0x2bc8a9[_0x454d00(0x149)](_0x402512)){const _0x418d1e=a134_0x2bc8a9[_0x454d00(0x130)](_0x402512),_0x67ea36=new Set(_0x3dd36b[_0x454d00(0x10f)][_0x454d00(0x17b)](_0x4926f7=>_0x4926f7['file_name']));for(const _0x5e8e17 of _0x418d1e){const _0x36925b=a134_0x453e78[_0x454d00(0x133)](_0x402512,_0x5e8e17);a134_0x2bc8a9[_0x454d00(0xf2)](_0x36925b)[_0x454d00(0x139)]()&&!_0x67ea36[_0x454d00(0x128)](_0x5e8e17)&&_0x271618['push']({'path':_0x36925b});}}_0x4008df[_0x454d00(0xb6)]['push']({'name':_0x40c99e[_0x454d00(0x15d)]['name'],'outputPath':_0x1dd91f,'isNew':_0x7555de,'hasChanges':_0xa1309e,'diff':_0x5a72c8}),_0x4008df[_0x454d00(0xec)][_0x454d00(0xb6)]['total']++;if(_0x7555de)_0x4008df[_0x454d00(0xec)][_0x454d00(0xb6)][_0x454d00(0x101)]++;else{if(_0xa1309e)_0x4008df[_0x454d00(0xec)]['experimentalArtifacts'][_0x454d00(0xce)]++;else _0x4008df[_0x454d00(0xec)]['experimentalArtifacts'][_0x454d00(0x14f)]++;}}for(const _0x1c1a88 of _0x7e9b51){const _0x53e785=getSanitizedPathWithMigration(getFormInterfacesDir(_0x47216f),_0x1c1a88[_0x454d00(0x15d)]['name'],_0x454d00(0xb7));_0x53e785[_0x454d00(0x9c)]&&this['logger'][_0x454d00(0x17e)]('Renamed\x20form\x20interface\x20file:\x20'+a134_0x453e78['basename'](_0x53e785['oldPath'])+_0x454d00(0xc2)+a134_0x453e78[_0x454d00(0x188)](_0x53e785[_0x454d00(0x14b)]));const _0x4c9b9f=_0x53e785[_0x454d00(0x14b)],_0x326034=await apiFormInterfaceToYaml(_0x1c1a88,_0x2daf6f),_0x183ad4=toFormInterfaceYamlString(_0x326034),_0x33d6f3=!a134_0x2bc8a9[_0x454d00(0x149)](_0x4c9b9f);let _0x3b2762=_0x33d6f3,_0x9d1aef;if(!_0x33d6f3){const _0x5e4307=a134_0x2bc8a9[_0x454d00(0x198)](_0x4c9b9f,_0x454d00(0x14e)),_0x725c00=generateDiff(_0x5e4307,_0x183ad4);_0x3b2762=hasChanges(_0x725c00),_0x3b2762&&(_0x9d1aef=formatDiffWithColors(_0x725c00));}_0x208da5[_0x454d00(0x1ac)]({'path':_0x4c9b9f,'content':_0x183ad4}),_0x4008df[_0x454d00(0x11b)][_0x454d00(0x1ac)]({'name':_0x1c1a88[_0x454d00(0x15d)][_0x454d00(0x12b)],'outputPath':_0x4c9b9f,'isNew':_0x33d6f3,'hasChanges':_0x3b2762,'diff':_0x9d1aef}),_0x4008df[_0x454d00(0xec)]['formInterfaces'][_0x454d00(0x17f)]++;if(_0x33d6f3)_0x4008df['counts'][_0x454d00(0x11b)][_0x454d00(0x101)]++;else{if(_0x3b2762)_0x4008df[_0x454d00(0xec)]['formInterfaces']['updated']++;else _0x4008df['counts'][_0x454d00(0x11b)][_0x454d00(0x14f)]++;}}for(const _0x2e22e5 of _0x344ed6){if(_0x2e22e5[_0x454d00(0x15d)][_0x454d00(0x190)])continue;const _0x205e76=getSanitizedPathWithMigration(getChatInterfacesDir(_0x47216f),_0x2e22e5[_0x454d00(0x15d)][_0x454d00(0x12b)],_0x454d00(0xb7));_0x205e76['renamed']&&this[_0x454d00(0xc6)][_0x454d00(0x17e)](_0x454d00(0xbb)+a134_0x453e78['basename'](_0x205e76['oldPath'])+_0x454d00(0xc2)+a134_0x453e78[_0x454d00(0x188)](_0x205e76[_0x454d00(0x14b)]));const _0x5deadf=_0x205e76['path'],_0x294cd5=await apiChatInterfaceToYaml(_0x2e22e5,_0x2daf6f),_0x4238ab=toChatInterfaceYamlString(_0x294cd5),_0x44c826=!a134_0x2bc8a9[_0x454d00(0x149)](_0x5deadf);let _0x421f15=_0x44c826,_0x4f225e;if(!_0x44c826){const _0x380503=a134_0x2bc8a9[_0x454d00(0x198)](_0x5deadf,_0x454d00(0x14e)),_0x5bfaf9=generateDiff(_0x380503,_0x4238ab);_0x421f15=hasChanges(_0x5bfaf9),_0x421f15&&(_0x4f225e=formatDiffWithColors(_0x5bfaf9));}_0x208da5['push']({'path':_0x5deadf,'content':_0x4238ab}),_0x4008df[_0x454d00(0x135)][_0x454d00(0x1ac)]({'name':_0x2e22e5[_0x454d00(0x15d)]['name'],'outputPath':_0x5deadf,'isNew':_0x44c826,'hasChanges':_0x421f15,'diff':_0x4f225e}),_0x4008df['counts'][_0x454d00(0x135)][_0x454d00(0x17f)]++;if(_0x44c826)_0x4008df['counts'][_0x454d00(0x135)][_0x454d00(0x101)]++;else{if(_0x421f15)_0x4008df['counts'][_0x454d00(0x135)][_0x454d00(0xce)]++;else _0x4008df[_0x454d00(0xec)][_0x454d00(0x135)]['unchanged']++;}}if(_0x26bea9?.['dryRun'])return _0x4008df;a134_0x2bc8a9['mkdirSync'](_0x47216f,{'recursive':!![]}),a134_0x2bc8a9[_0x454d00(0x181)](getKnowledgeBasesDir(_0x47216f),{'recursive':!![]}),a134_0x2bc8a9[_0x454d00(0x181)](getPromptsDir(_0x47216f),{'recursive':!![]}),a134_0x2bc8a9[_0x454d00(0x181)](getIntegrationsDir(_0x47216f),{'recursive':!![]}),a134_0x2bc8a9['mkdirSync'](getExperimentalKnowledgeBasesDir(_0x47216f),{'recursive':!![]}),a134_0x2bc8a9[_0x454d00(0x181)](getExperimentalArtifactsDir(_0x47216f),{'recursive':!![]}),a134_0x2bc8a9[_0x454d00(0x181)](getFormInterfacesDir(_0x47216f),{'recursive':!![]}),a134_0x2bc8a9['mkdirSync'](getChatInterfacesDir(_0x47216f),{'recursive':!![]});const _0x2d98ef=a134_0x453e78[_0x454d00(0x133)](_0x47216f,_0x454d00(0x19e));a134_0x2bc8a9['writeFileSync'](_0x2d98ef,createAgentConfigContent(_0x4cac4e));for(const _0xba6e4c of _0x208da5){if(_0xba6e4c['isDir'])a134_0x2bc8a9[_0x454d00(0x181)](_0xba6e4c['path'],{'recursive':!![]});else{const _0xe21470=a134_0x453e78['dirname'](_0xba6e4c[_0x454d00(0x14b)]);!a134_0x2bc8a9[_0x454d00(0x149)](_0xe21470)&&a134_0x2bc8a9[_0x454d00(0x181)](_0xe21470,{'recursive':!![]}),a134_0x2bc8a9[_0x454d00(0x138)](_0xba6e4c['path'],_0xba6e4c['content']);}}for(const _0xbe08d1 of _0x271618){_0xbe08d1[_0x454d00(0x171)]?(a134_0x2bc8a9['rmSync'](_0xbe08d1[_0x454d00(0x14b)],{'recursive':!![],'force':!![]}),this[_0x454d00(0xc6)][_0x454d00(0x17e)](_0x454d00(0xc5)+a134_0x453e78['basename'](a134_0x453e78[_0x454d00(0x182)](_0xbe08d1[_0x454d00(0x14b)]))+'/'+a134_0x453e78['basename'](_0xbe08d1[_0x454d00(0x14b)]))):(a134_0x2bc8a9['rmSync'](_0xbe08d1[_0x454d00(0x14b)],{'force':!![]}),this[_0x454d00(0xc6)][_0x454d00(0x17e)](_0x454d00(0x1a7)+a134_0x453e78[_0x454d00(0x188)](a134_0x453e78[_0x454d00(0x182)](_0xbe08d1['path']))+'/'+a134_0x453e78['basename'](_0xbe08d1[_0x454d00(0x14b)])));}return _0x4008df;}async[a134_0x1ba902(0xad)](_0x409874,_0x449f37){const _0x4cf4ba=a134_0x1ba902,_0x585e28=a134_0x453e78['join'](_0x409874,_0x4cf4ba(0x19e));if(!a134_0x2bc8a9[_0x4cf4ba(0x149)](_0x585e28))throw new SDKError(ErrorCode[_0x4cf4ba(0x10a)],'No\x20tdx.json\x20found\x20in\x20'+_0x409874,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x67cd1=loadAgentConfig(_0x585e28),_0x408de6=await this[_0x4cf4ba(0x11c)](_0x67cd1['llm_project']),_0x24eb38=await this[_0x4cf4ba(0xea)][_0x4cf4ba(0x125)](_0x408de6),_0x1db1a0=_0x24eb38[_0x4cf4ba(0x15d)]['name'],_0x4fa29e={'projectName':_0x1db1a0,'projectId':_0x408de6,'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}}},_0x2ccfa1=[],_0x197d34=[],_0x220449=[],_0x33b8f9=[],_0x417598=[],_0x163877=[],_0x1ddd39=a134_0x2bc8a9[_0x4cf4ba(0x130)](_0x409874,{'withFileTypes':!![]});for(const _0x239bc2 of _0x1ddd39){if(!_0x239bc2[_0x4cf4ba(0xc7)]())continue;if(['knowledge_bases','prompts',_0x4cf4ba(0x104),_0x4cf4ba(0xd8),_0x4cf4ba(0x102),_0x4cf4ba(0x1a8),_0x4cf4ba(0x12a)]['includes'](_0x239bc2['name']))continue;const _0x8ba2e5=a134_0x453e78[_0x4cf4ba(0x133)](_0x409874,_0x239bc2[_0x4cf4ba(0x12b)]);if(isAgentDir(_0x8ba2e5)){const _0xb5b745=a134_0x453e78[_0x4cf4ba(0x133)](_0x8ba2e5,'agent.yml'),_0x4a413c=a134_0x453e78[_0x4cf4ba(0x133)](_0x8ba2e5,'prompt.md'),_0x4a1351=a134_0x453e78[_0x4cf4ba(0x133)](_0x8ba2e5,_0x4cf4ba(0xcf)),_0x321eeb=parseAgentYaml(a134_0x2bc8a9['readFileSync'](_0xb5b745,_0x4cf4ba(0x14e)),_0xb5b745),_0x45b1a1=a134_0x2bc8a9[_0x4cf4ba(0x149)](_0x4a413c)?a134_0x2bc8a9['readFileSync'](_0x4a413c,_0x4cf4ba(0x14e)):'',_0x22fd67=a134_0x2bc8a9[_0x4cf4ba(0x149)](_0x4a1351)?a134_0x2bc8a9[_0x4cf4ba(0x198)](_0x4a1351,'utf-8'):_0x321eeb[_0x4cf4ba(0x15b)];_0x2ccfa1[_0x4cf4ba(0x1ac)]({'name':_0x321eeb[_0x4cf4ba(0x12b)],'dir':_0x8ba2e5,'yaml':_0x321eeb,'systemPrompt':_0x45b1a1,'starterMessage':_0x22fd67});}}const _0x1bd11f=getKnowledgeBasesDir(_0x409874);if(a134_0x2bc8a9['existsSync'](_0x1bd11f)){const _0x4084d1=a134_0x2bc8a9[_0x4cf4ba(0x130)](_0x1bd11f);for(const _0x1e17bd of _0x4084d1){const _0x2eb46c=a134_0x453e78[_0x4cf4ba(0x133)](_0x1bd11f,_0x1e17bd);if(_0x1e17bd[_0x4cf4ba(0x166)](_0x4cf4ba(0xb7))){const _0x3b7914=parseKnowledgeBaseYaml(a134_0x2bc8a9[_0x4cf4ba(0x198)](_0x2eb46c,_0x4cf4ba(0x14e)),_0x2eb46c);_0x197d34[_0x4cf4ba(0x1ac)]({'name':_0x3b7914[_0x4cf4ba(0x12b)],'path':_0x2eb46c,'yaml':_0x3b7914});}else{if(_0x1e17bd[_0x4cf4ba(0x166)]('.md')){const _0x1ab00f=a134_0x2bc8a9[_0x4cf4ba(0x198)](_0x2eb46c,_0x4cf4ba(0x14e)),{name:_0x4b587d,text:_0x18f288}=parseTextKnowledgeBaseMd(_0x1ab00f,_0x1e17bd);_0x220449[_0x4cf4ba(0x1ac)]({'name':_0x4b587d,'path':_0x2eb46c,'text':_0x18f288});}}}}const _0x230b12=getPromptsDir(_0x409874);if(a134_0x2bc8a9['existsSync'](_0x230b12)){const _0x48fddf=a134_0x2bc8a9[_0x4cf4ba(0x130)](_0x230b12)[_0x4cf4ba(0x126)](_0x593045=>_0x593045[_0x4cf4ba(0x166)](_0x4cf4ba(0xb7)));for(const _0x121c66 of _0x48fddf){const _0x56b310=a134_0x453e78[_0x4cf4ba(0x133)](_0x230b12,_0x121c66),_0x12db1c=parsePromptYaml(a134_0x2bc8a9[_0x4cf4ba(0x198)](_0x56b310,_0x4cf4ba(0x14e)),_0x56b310);_0x33b8f9[_0x4cf4ba(0x1ac)]({'name':_0x12db1c[_0x4cf4ba(0x12b)],'path':_0x56b310,'yaml':_0x12db1c});}}const _0xf84442=[],_0x3c85da=getIntegrationsDir(_0x409874);if(a134_0x2bc8a9['existsSync'](_0x3c85da)){const _0x1802f2=a134_0x2bc8a9[_0x4cf4ba(0x130)](_0x3c85da)[_0x4cf4ba(0x126)](_0x14621e=>_0x14621e['endsWith']('.yml'));for(const _0x12fa3b of _0x1802f2){const _0x41f677=a134_0x453e78[_0x4cf4ba(0x133)](_0x3c85da,_0x12fa3b),_0x3bc320=parseIntegrationYaml(a134_0x2bc8a9[_0x4cf4ba(0x198)](_0x41f677,_0x4cf4ba(0x14e)),_0x41f677);if(!SAFE_INTEGRATION_TYPES['includes'](_0x3bc320[_0x4cf4ba(0xed)][_0x4cf4ba(0x13d)]())){this[_0x4cf4ba(0xc6)][_0x4cf4ba(0x1a2)](_0x4cf4ba(0x16e)+_0x3bc320[_0x4cf4ba(0x12b)]+'\x27\x20('+_0x3bc320[_0x4cf4ba(0xed)]+_0x4cf4ba(0xae)+(_0x4cf4ba(0x1aa)+SAFE_INTEGRATION_TYPES[_0x4cf4ba(0x133)](',\x20')+')\x20can\x20be\x20pushed.\x20')+'Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.');continue;}_0xf84442[_0x4cf4ba(0x1ac)]({'name':_0x3bc320[_0x4cf4ba(0x12b)],'path':_0x41f677,'yaml':_0x3bc320});}}const _0x3dad56=getExperimentalKnowledgeBasesDir(_0x409874);if(a134_0x2bc8a9[_0x4cf4ba(0x149)](_0x3dad56)){const _0x4f4e9b=a134_0x2bc8a9[_0x4cf4ba(0x130)](_0x3dad56,{'withFileTypes':!![]});for(const _0x2e34c3 of _0x4f4e9b){if(!_0x2e34c3[_0x4cf4ba(0xc7)]())continue;const _0x4eed25=a134_0x453e78[_0x4cf4ba(0x133)](_0x3dad56,_0x2e34c3[_0x4cf4ba(0x12b)]),_0x3f5410=a134_0x453e78[_0x4cf4ba(0x133)](_0x4eed25,_0x2e34c3[_0x4cf4ba(0x12b)]+_0x4cf4ba(0xb7)),_0x137ce2=a134_0x453e78[_0x4cf4ba(0x133)](_0x4eed25,'functions');if(!a134_0x2bc8a9['existsSync'](_0x3f5410))continue;const _0x3415bb=parseExperimentalKnowledgeBaseYaml(a134_0x2bc8a9[_0x4cf4ba(0x198)](_0x3f5410,'utf-8'),_0x3f5410),_0x277cc9=[];if(a134_0x2bc8a9[_0x4cf4ba(0x149)](_0x137ce2)){const _0x553979=a134_0x2bc8a9[_0x4cf4ba(0x130)](_0x137ce2,{'withFileTypes':!![]});for(const _0x30a1e7 of _0x553979){if(!_0x30a1e7[_0x4cf4ba(0xc7)]())continue;const _0x425f19=a134_0x453e78[_0x4cf4ba(0x133)](_0x137ce2,_0x30a1e7[_0x4cf4ba(0x12b)]),_0x52423e=a134_0x453e78['join'](_0x425f19,'code.js'),_0x26c1be=a134_0x453e78[_0x4cf4ba(0x133)](_0x425f19,_0x4cf4ba(0x174));a134_0x2bc8a9[_0x4cf4ba(0x149)](_0x52423e)&&a134_0x2bc8a9[_0x4cf4ba(0x149)](_0x26c1be)&&_0x277cc9[_0x4cf4ba(0x1ac)]({'name':_0x30a1e7[_0x4cf4ba(0x12b)],'code':a134_0x2bc8a9[_0x4cf4ba(0x198)](_0x52423e,_0x4cf4ba(0x14e)),'json_schema':a134_0x2bc8a9['readFileSync'](_0x26c1be,_0x4cf4ba(0x14e))});}}const _0x38641a={..._0x3415bb,'variables':_0x3415bb['variables']||[],'functions':_0x277cc9};_0x417598[_0x4cf4ba(0x1ac)]({'name':_0x3415bb[_0x4cf4ba(0x12b)],'dir':_0x4eed25,'def':_0x38641a});}}const _0x406f60=getExperimentalArtifactsDir(_0x409874);if(a134_0x2bc8a9['existsSync'](_0x406f60)){const _0x48e92e=a134_0x2bc8a9[_0x4cf4ba(0x130)](_0x406f60,{'withFileTypes':!![]});for(const _0x176e3c of _0x48e92e){if(!_0x176e3c[_0x4cf4ba(0xc7)]())continue;const _0x2a1c28=a134_0x453e78[_0x4cf4ba(0x133)](_0x406f60,_0x176e3c[_0x4cf4ba(0x12b)]),_0x291250=a134_0x453e78[_0x4cf4ba(0x133)](_0x2a1c28,_0x176e3c['name']+_0x4cf4ba(0xb7)),_0x2a82c7=a134_0x453e78[_0x4cf4ba(0x133)](_0x2a1c28,_0x4cf4ba(0x14a)),_0xae8f26=a134_0x453e78[_0x4cf4ba(0x133)](_0x2a1c28,_0x4cf4ba(0x10f));if(!a134_0x2bc8a9[_0x4cf4ba(0x149)](_0x291250)||!a134_0x2bc8a9[_0x4cf4ba(0x149)](_0x2a82c7))continue;const _0x1aadca=parseExperimentalArtifactYaml(a134_0x2bc8a9[_0x4cf4ba(0x198)](_0x291250,_0x4cf4ba(0x14e)),_0x291250),_0x2cd7fe=a134_0x2bc8a9[_0x4cf4ba(0x198)](_0x2a82c7,_0x4cf4ba(0x14e)),_0x31603f=[];if(a134_0x2bc8a9[_0x4cf4ba(0x149)](_0xae8f26)){const _0x36b905=a134_0x2bc8a9[_0x4cf4ba(0x130)](_0xae8f26);for(const _0x3471cb of _0x36b905){const _0x45f147=a134_0x453e78[_0x4cf4ba(0x133)](_0xae8f26,_0x3471cb);a134_0x2bc8a9[_0x4cf4ba(0xf2)](_0x45f147)[_0x4cf4ba(0x139)]()&&_0x31603f[_0x4cf4ba(0x1ac)]({'file_name':_0x3471cb,'text_content':a134_0x2bc8a9[_0x4cf4ba(0x198)](_0x45f147,_0x4cf4ba(0x14e))});}}const _0x588791={..._0x1aadca,'code':_0x2cd7fe,'files':_0x31603f};_0x163877[_0x4cf4ba(0x1ac)]({'name':_0x1aadca[_0x4cf4ba(0x12b)],'dir':_0x2a1c28,'def':_0x588791});}}const _0x350be2=[],_0x3677a0=getFormInterfacesDir(_0x409874);if(a134_0x2bc8a9[_0x4cf4ba(0x149)](_0x3677a0)){const _0x1ece71=a134_0x2bc8a9[_0x4cf4ba(0x130)](_0x3677a0)[_0x4cf4ba(0x126)](_0x54413a=>_0x54413a[_0x4cf4ba(0x166)](_0x4cf4ba(0xb7)));for(const _0xf2f78c of _0x1ece71){const _0x33641f=a134_0x453e78[_0x4cf4ba(0x133)](_0x3677a0,_0xf2f78c),_0x50aa7d=parseFormInterfaceYaml(a134_0x2bc8a9['readFileSync'](_0x33641f,_0x4cf4ba(0x14e)),_0x33641f);_0x350be2[_0x4cf4ba(0x1ac)]({'name':_0x50aa7d['name'],'path':_0x33641f,'yaml':_0x50aa7d});}}const _0x20bd05=[],_0x58b395=getChatInterfacesDir(_0x409874);if(a134_0x2bc8a9[_0x4cf4ba(0x149)](_0x58b395)){const _0x32c7bd=a134_0x2bc8a9[_0x4cf4ba(0x130)](_0x58b395)[_0x4cf4ba(0x126)](_0x51dc78=>_0x51dc78['endsWith'](_0x4cf4ba(0xb7)));for(const _0x356447 of _0x32c7bd){const _0x90139f=a134_0x453e78['join'](_0x58b395,_0x356447),_0xf0b7c8=parseChatInterfaceYaml(a134_0x2bc8a9[_0x4cf4ba(0x198)](_0x90139f,'utf-8'),_0x90139f);_0x20bd05[_0x4cf4ba(0x1ac)]({'name':_0xf0b7c8[_0x4cf4ba(0x12b)],'path':_0x90139f,'yaml':_0xf0b7c8});}}const _0x1fda75=await this[_0x4cf4ba(0xea)][_0x4cf4ba(0x118)](_0x408de6),_0x519af5=await this[_0x4cf4ba(0xea)][_0x4cf4ba(0x19a)](_0x408de6),_0x5a1768=await this[_0x4cf4ba(0xea)][_0x4cf4ba(0x142)](_0x408de6),_0x2bb6ab=await this[_0x4cf4ba(0xea)][_0x4cf4ba(0xfd)](_0x408de6),_0x2efe15=await this[_0x4cf4ba(0xea)]['listIntegrations'](_0x408de6),_0x1f708a=await safeListOrEmpty(()=>this[_0x4cf4ba(0xea)][_0x4cf4ba(0x11d)](_0x408de6)),_0x4beca2=await safeListOrEmpty(()=>this['client'][_0x4cf4ba(0xb1)](_0x408de6)),_0x3124c4=await safeListOrEmpty(()=>this['client'][_0x4cf4ba(0x132)](_0x408de6)),_0xc24d23=await safeListOrEmpty(()=>this[_0x4cf4ba(0xea)]['listChatInterfaces'](_0x408de6)),_0x1a699f=await fetchAllToolTargetMaps((_0x1b08ed,_0xab4ab0)=>this[_0x4cf4ba(0xea)][_0x4cf4ba(0xf1)](_0x1b08ed,_0xab4ab0),_0x408de6),_0x48a6b2=new Map(),_0x50cc72=new Map(),_0x205384=new Map(),_0x18c157=new Map(),_0x1c9e3d=new Map(),_0x1be8ef=new Map(),_0x581b06=new Map();for(const _0x3c6f08 of _0x1fda75){_0x48a6b2[_0x4cf4ba(0x116)](_0x3c6f08['attributes'][_0x4cf4ba(0x12b)],_0x3c6f08);}for(const _0x19d6e6 of _0x519af5){_0x50cc72[_0x4cf4ba(0x116)](_0x19d6e6[_0x4cf4ba(0x15d)][_0x4cf4ba(0x12b)],_0x19d6e6);}for(const _0x44e01d of _0x5a1768){_0x205384[_0x4cf4ba(0x116)](_0x44e01d['attributes'][_0x4cf4ba(0x12b)],_0x44e01d);}for(const _0x1dfa1b of _0x2bb6ab){_0x18c157[_0x4cf4ba(0x116)](_0x1dfa1b['attributes'][_0x4cf4ba(0x12b)],_0x1dfa1b);}for(const _0x358b15 of _0x2efe15){_0x1c9e3d[_0x4cf4ba(0x116)](_0x358b15[_0x4cf4ba(0x15d)][_0x4cf4ba(0x114)][_0x4cf4ba(0x13d)](),_0x358b15);}for(const _0x1212a0 of _0x1f708a){_0x1be8ef[_0x4cf4ba(0x116)](_0x1212a0[_0x4cf4ba(0x15d)][_0x4cf4ba(0x12b)],_0x1212a0);}for(const _0x30c243 of _0x4beca2){_0x581b06['set'](_0x30c243[_0x4cf4ba(0x15d)][_0x4cf4ba(0x12b)],_0x30c243);}const _0x236c41=new Map(),_0x11009c=new Map();for(const _0xf1b639 of _0x3124c4){_0x236c41[_0x4cf4ba(0x116)](_0xf1b639[_0x4cf4ba(0x15d)][_0x4cf4ba(0x12b)],_0xf1b639);}for(const _0x921042 of _0xc24d23){_0x11009c[_0x4cf4ba(0x116)](_0x921042[_0x4cf4ba(0x15d)][_0x4cf4ba(0x12b)],_0x921042);}const _0x2a3739=new Map(),_0x2db452=new Map();for(const _0x209b6f of _0x1fda75){_0x2a3739[_0x4cf4ba(0x116)](_0x209b6f['attributes'][_0x4cf4ba(0x12b)],_0x209b6f['id']),_0x2db452[_0x4cf4ba(0x116)](_0x209b6f['id'],_0x209b6f[_0x4cf4ba(0x15d)]['name']);}const _0x3d6b22=new Map(),_0x30d2e8=new Map();for(const _0x8fb20a of _0x2bb6ab){_0x3d6b22[_0x4cf4ba(0x116)](_0x8fb20a[_0x4cf4ba(0x15d)]['name'],_0x8fb20a['id']),_0x30d2e8[_0x4cf4ba(0x116)](_0x8fb20a['id'],_0x8fb20a[_0x4cf4ba(0x15d)][_0x4cf4ba(0x12b)]);}const _0x2a4ab5=_0x1a699f[_0x4cf4ba(0x13c)][_0x4cf4ba(0xab)]||new Map(),_0x2b87ad=_0x1a699f[_0x4cf4ba(0x13c)][_0x4cf4ba(0xaf)]||new Map(),_0x3695f9=_0x1a699f[_0x4cf4ba(0x13c)]['ExperimentalKnowledgeBase']||new Map(),_0xe0691=new Map(),_0x1ed764={'resolveToolTargetName':buildNameResolver({..._0x1a699f['idToName'],'Agent':_0x2db452}),'resolvePromptName':async _0x23511f=>_0x30d2e8[_0x4cf4ba(0x9d)](_0x23511f),'onWarning':_0x1755a0=>this[_0x4cf4ba(0xc6)][_0x4cf4ba(0x1a2)](_0x1755a0)};let _0x315c07=[];const _0x252df4={'projectId':_0x408de6,'resolveToolTargetId':buildIdResolver({..._0x1a699f['nameToId'],'Agent':_0x2a3739}),'resolvePromptId':async _0xa24f01=>_0x3d6b22[_0x4cf4ba(0x9d)](_0xa24f01),'onWarning':_0x93b80e=>{const _0x388024=_0x4cf4ba;this['logger']['warn'](_0x93b80e),_0x315c07[_0x388024(0x1ac)](_0x93b80e);}},{resolved:_0x57e4,unresolved:_0x14fc93}=resolveAgentDependencies(_0x2ccfa1,new Set(_0x48a6b2['keys']()));for(const {agent:_0x42ecf3,missingDeps:_0x39c63a}of _0x14fc93){_0x4fa29e[_0x4cf4ba(0x1a9)][_0x4cf4ba(0x1ac)]({'agentName':_0x42ecf3[_0x4cf4ba(0xa6)]['name'],'action':'error','error':_0x4cf4ba(0x122)+_0x39c63a[_0x4cf4ba(0x133)](',\x20')+_0x4cf4ba(0x144)}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x1a9)][_0x4cf4ba(0xf6)]++;}for(const _0x106517 of _0x197d34){const _0x1cab22=_0x50cc72[_0x4cf4ba(0x9d)](_0x106517[_0x4cf4ba(0xa6)]['name']),_0x33d6e1=a134_0x2bc8a9[_0x4cf4ba(0x198)](_0x106517[_0x4cf4ba(0x14b)],_0x4cf4ba(0x14e));if(_0x1cab22){const _0x37e1b7=apiKnowledgeBaseToYaml(_0x1cab22),_0x2e0d80=toKnowledgeBaseYamlString(_0x37e1b7),_0x440421=generateDiff(_0x2e0d80,_0x33d6e1),_0x2704b1=hasChanges(_0x440421);_0x2704b1?(_0x4fa29e['knowledgeBases'][_0x4cf4ba(0x1ac)]({'name':_0x106517[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0xce),'id':_0x1cab22['id'],'diff':formatDiffWithColors(_0x440421)}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0xa8)]['updated']++):(_0x4fa29e[_0x4cf4ba(0xa8)][_0x4cf4ba(0x1ac)]({'name':_0x106517[_0x4cf4ba(0xa6)]['name'],'action':_0x4cf4ba(0x14f),'id':_0x1cab22['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0xa8)][_0x4cf4ba(0x14f)]++);}else _0x4fa29e[_0x4cf4ba(0xa8)]['push']({'name':_0x106517['yaml']['name'],'action':_0x4cf4ba(0x1af)}),_0x4fa29e['counts'][_0x4cf4ba(0xa8)][_0x4cf4ba(0x1af)]++;}for(const _0x44a3e4 of _0x220449){const _0x1fa07c=_0x205384[_0x4cf4ba(0x9d)](_0x44a3e4['name']),_0x4ca59c=a134_0x2bc8a9[_0x4cf4ba(0x198)](_0x44a3e4['path'],'utf-8');if(_0x1fa07c){const _0x365fda=toTextKnowledgeBaseMd(_0x1fa07c[_0x4cf4ba(0x15d)][_0x4cf4ba(0x12b)],_0x1fa07c[_0x4cf4ba(0x15d)][_0x4cf4ba(0x136)]),_0xd6d08f=generateDiff(_0x365fda,_0x4ca59c),_0x25df80=hasChanges(_0xd6d08f);_0x25df80?(_0x4fa29e[_0x4cf4ba(0x1ab)][_0x4cf4ba(0x1ac)]({'name':_0x44a3e4[_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0xce),'id':_0x1fa07c['id'],'diff':formatDiffWithColors(_0xd6d08f)}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x1ab)][_0x4cf4ba(0xce)]++):(_0x4fa29e[_0x4cf4ba(0x1ab)][_0x4cf4ba(0x1ac)]({'name':_0x44a3e4[_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x14f),'id':_0x1fa07c['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x1ab)][_0x4cf4ba(0x14f)]++);}else _0x4fa29e[_0x4cf4ba(0x1ab)][_0x4cf4ba(0x1ac)]({'name':_0x44a3e4[_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x1af)}),_0x4fa29e['counts']['textKnowledgeBases'][_0x4cf4ba(0x1af)]++;}for(const _0x34c062 of _0x57e4){const _0x3b83d1=_0x48a6b2[_0x4cf4ba(0x9d)](_0x34c062['yaml'][_0x4cf4ba(0x12b)]),_0x5d0332=a134_0x453e78['join'](_0x34c062[_0x4cf4ba(0x19d)],_0x4cf4ba(0xff)),_0x145e79=a134_0x2bc8a9['readFileSync'](_0x5d0332,'utf-8'),_0x57d840=_0x34c062[_0x4cf4ba(0x15c)],_0x3ea50b=_0x4cf4ba(0x108)+_0x57d840+_0x4cf4ba(0x175)+_0x145e79;if(_0x3b83d1){const {yaml:_0x2463ae,systemPrompt:_0x17ebb6}=await agentResponseToDef(_0x3b83d1,_0x1ed764),_0x5abe95=toAgentYamlString(_0x2463ae),_0x3581fc='#\x20prompt.md\x0a'+_0x17ebb6+_0x4cf4ba(0x175)+_0x5abe95,_0x115f63=generateDiff(_0x3581fc,_0x3ea50b),_0x5df9b9=hasChanges(_0x115f63);_0x5df9b9?(_0x4fa29e[_0x4cf4ba(0x1a9)][_0x4cf4ba(0x1ac)]({'agentName':_0x34c062[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0xce),'agentId':_0x3b83d1['id'],'diff':formatDiffWithColors(_0x115f63)}),_0x4fa29e['counts'][_0x4cf4ba(0x1a9)][_0x4cf4ba(0xce)]++):(_0x4fa29e[_0x4cf4ba(0x1a9)][_0x4cf4ba(0x1ac)]({'agentName':_0x34c062[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x14f),'agentId':_0x3b83d1['id']}),_0x4fa29e['counts'][_0x4cf4ba(0x1a9)][_0x4cf4ba(0x14f)]++);}else _0x4fa29e[_0x4cf4ba(0x1a9)][_0x4cf4ba(0x1ac)]({'agentName':_0x34c062[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x1af)}),_0x4fa29e[_0x4cf4ba(0xec)]['agents'][_0x4cf4ba(0x1af)]++;}for(const _0x29a156 of _0x33b8f9){const _0x1c474c=_0x18c157['get'](_0x29a156[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)]),_0x5bb50e=a134_0x2bc8a9[_0x4cf4ba(0x198)](_0x29a156[_0x4cf4ba(0x14b)],_0x4cf4ba(0x14e));if(_0x1c474c){const _0x4a25f7=await apiPromptToYaml(_0x1c474c,_0x1ed764);if(!_0x4a25f7){_0x4fa29e[_0x4cf4ba(0x110)]['push']({'name':_0x29a156['yaml'][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0xce),'id':_0x1c474c['id']}),_0x4fa29e['counts'][_0x4cf4ba(0x110)][_0x4cf4ba(0xce)]++;continue;}const _0x477e65=toPromptYamlString(_0x4a25f7),_0x187f57=generateDiff(_0x477e65,_0x5bb50e),_0x3dc69b=hasChanges(_0x187f57);_0x3dc69b?(_0x4fa29e[_0x4cf4ba(0x110)][_0x4cf4ba(0x1ac)]({'name':_0x29a156[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0xce),'id':_0x1c474c['id'],'diff':formatDiffWithColors(_0x187f57)}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x110)][_0x4cf4ba(0xce)]++):(_0x4fa29e[_0x4cf4ba(0x110)][_0x4cf4ba(0x1ac)]({'name':_0x29a156['yaml'][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x14f),'id':_0x1c474c['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x110)][_0x4cf4ba(0x14f)]++);}else _0x4fa29e[_0x4cf4ba(0x110)][_0x4cf4ba(0x1ac)]({'name':_0x29a156[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x1af)}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x110)][_0x4cf4ba(0x1af)]++;}for(const _0x2ec0e4 of _0xf84442){const _0x8e0a87=_0x1c9e3d['get'](_0x2ec0e4[_0x4cf4ba(0xa6)][_0x4cf4ba(0xed)]),_0x5e591c=a134_0x2bc8a9[_0x4cf4ba(0x198)](_0x2ec0e4[_0x4cf4ba(0x14b)],_0x4cf4ba(0x14e));if(_0x8e0a87){const _0x5062bc=await apiIntegrationToYaml(_0x8e0a87,_0x1ed764),_0x29f09a=toIntegrationYamlString(_0x5062bc),_0xc274d1=generateDiff(_0x29f09a,_0x5e591c),_0x558eeb=hasChanges(_0xc274d1);_0x558eeb?(_0x4fa29e['integrations'][_0x4cf4ba(0x1ac)]({'name':_0x2ec0e4['yaml'][_0x4cf4ba(0xed)],'action':'updated','id':_0x8e0a87['id'],'diff':formatDiffWithColors(_0xc274d1)}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x104)]['updated']++):(_0x4fa29e['integrations'][_0x4cf4ba(0x1ac)]({'name':_0x2ec0e4[_0x4cf4ba(0xa6)]['service_type'],'action':_0x4cf4ba(0x14f),'id':_0x8e0a87['id']}),_0x4fa29e['counts'][_0x4cf4ba(0x104)][_0x4cf4ba(0x14f)]++);}else _0x4fa29e['integrations'][_0x4cf4ba(0x1ac)]({'name':_0x2ec0e4[_0x4cf4ba(0xa6)][_0x4cf4ba(0xed)],'action':'created'}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x104)][_0x4cf4ba(0x1af)]++;}for(const _0x1b54bf of _0x417598){const _0x2b8482=_0x1be8ef['get'](_0x1b54bf[_0x4cf4ba(0xd2)]['name']),_0x34935a=toExperimentalKnowledgeBaseYamlString(_0x1b54bf[_0x4cf4ba(0xd2)]);let _0x3ffd05=_0x34935a;for(const _0x1933ae of _0x1b54bf['def'][_0x4cf4ba(0xa5)]){_0x3ffd05+=_0x4cf4ba(0x12d)+_0x1933ae[_0x4cf4ba(0x12b)]+_0x4cf4ba(0x146)+_0x1933ae[_0x4cf4ba(0xe7)]+_0x4cf4ba(0xf0)+_0x1933ae[_0x4cf4ba(0x12b)]+'\x20---\x0a'+_0x1933ae['json_schema']+'\x0a';}if(_0x2b8482){const _0x5ee250=apiExperimentalKnowledgeBaseToYaml(_0x2b8482),_0x87d101=toExperimentalKnowledgeBaseYamlString(_0x5ee250);let _0x2b3607=_0x87d101;for(const _0x55f6bb of _0x5ee250['functions']){_0x2b3607+=_0x4cf4ba(0x12d)+_0x55f6bb[_0x4cf4ba(0x12b)]+_0x4cf4ba(0x146)+_0x55f6bb[_0x4cf4ba(0xe7)]+'\x0a---\x20schema:\x20'+_0x55f6bb[_0x4cf4ba(0x12b)]+_0x4cf4ba(0x146)+_0x55f6bb[_0x4cf4ba(0x162)]+'\x0a';}const _0x3dface=generateDiff(_0x2b3607,_0x3ffd05),_0x208615=hasChanges(_0x3dface);_0x208615?(_0x4fa29e[_0x4cf4ba(0xc9)][_0x4cf4ba(0x1ac)]({'name':_0x1b54bf['def']['name'],'action':_0x4cf4ba(0xce),'id':_0x2b8482['id'],'diff':formatDiffWithColors(_0x3dface)}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0xc9)]['updated']++):(_0x4fa29e['experimentalKnowledgeBases'][_0x4cf4ba(0x1ac)]({'name':_0x1b54bf['def'][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x14f),'id':_0x2b8482['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0xc9)][_0x4cf4ba(0x14f)]++);}else _0x4fa29e[_0x4cf4ba(0xc9)][_0x4cf4ba(0x1ac)]({'name':_0x1b54bf['def'][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x1af)}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0xc9)][_0x4cf4ba(0x1af)]++;}for(const _0x4fd53d of _0x163877){const _0xd9c415=_0x581b06['get'](_0x4fd53d['def'][_0x4cf4ba(0x12b)]),_0x318084=toExperimentalArtifactYamlString(_0x4fd53d[_0x4cf4ba(0xd2)]);let _0x1a7f89=_0x318084+(_0x4cf4ba(0x12e)+_0x4fd53d[_0x4cf4ba(0xd2)][_0x4cf4ba(0xe7)]+'\x0a');for(const _0x5d552d of _0x4fd53d['def'][_0x4cf4ba(0x10f)]){_0x1a7f89+=_0x4cf4ba(0xd9)+_0x5d552d['file_name']+_0x4cf4ba(0x146)+_0x5d552d[_0x4cf4ba(0x18d)]+'\x0a';}if(_0xd9c415){const _0x5ae5b4=apiExperimentalArtifactToYaml(_0xd9c415),_0x476fe4=toExperimentalArtifactYamlString(_0x5ae5b4);let _0x2df932=_0x476fe4+('\x0a---\x20code\x20---\x0a'+_0x5ae5b4[_0x4cf4ba(0xe7)]+'\x0a');for(const _0xdbcb87 of _0x5ae5b4['files']){_0x2df932+='---\x20file:\x20'+_0xdbcb87[_0x4cf4ba(0xe3)]+_0x4cf4ba(0x146)+_0xdbcb87[_0x4cf4ba(0x18d)]+'\x0a';}const _0xb1cf89=generateDiff(_0x2df932,_0x1a7f89),_0x1fdfc0=hasChanges(_0xb1cf89);_0x1fdfc0?(_0x4fa29e[_0x4cf4ba(0xb6)][_0x4cf4ba(0x1ac)]({'name':_0x4fd53d[_0x4cf4ba(0xd2)][_0x4cf4ba(0x12b)],'action':'updated','id':_0xd9c415['id'],'diff':formatDiffWithColors(_0xb1cf89)}),_0x4fa29e[_0x4cf4ba(0xec)]['experimentalArtifacts'][_0x4cf4ba(0xce)]++):(_0x4fa29e['experimentalArtifacts'][_0x4cf4ba(0x1ac)]({'name':_0x4fd53d['def'][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x14f),'id':_0xd9c415['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0xb6)]['unchanged']++);}else _0x4fa29e[_0x4cf4ba(0xb6)][_0x4cf4ba(0x1ac)]({'name':_0x4fd53d[_0x4cf4ba(0xd2)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x1af)}),_0x4fa29e['counts'][_0x4cf4ba(0xb6)]['created']++;}for(const _0x54e277 of _0x350be2){const _0x50e532=_0x236c41[_0x4cf4ba(0x9d)](_0x54e277[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)]),_0x17d5bd=a134_0x2bc8a9[_0x4cf4ba(0x198)](_0x54e277[_0x4cf4ba(0x14b)],_0x4cf4ba(0x14e));if(_0x50e532){const _0x6198fe=await apiFormInterfaceToYaml(_0x50e532,_0x1ed764),_0x468531=toFormInterfaceYamlString(_0x6198fe),_0x58cc23=generateDiff(_0x468531,_0x17d5bd),_0x2aa13c=hasChanges(_0x58cc23);_0x2aa13c?(_0x4fa29e[_0x4cf4ba(0x11b)]['push']({'name':_0x54e277[_0x4cf4ba(0xa6)]['name'],'action':_0x4cf4ba(0xce),'id':_0x50e532['id'],'diff':formatDiffWithColors(_0x58cc23)}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x11b)][_0x4cf4ba(0xce)]++):(_0x4fa29e[_0x4cf4ba(0x11b)][_0x4cf4ba(0x1ac)]({'name':_0x54e277[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x14f),'id':_0x50e532['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x11b)]['unchanged']++);}else _0x4fa29e[_0x4cf4ba(0x11b)][_0x4cf4ba(0x1ac)]({'name':_0x54e277[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x1af)}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x11b)][_0x4cf4ba(0x1af)]++;}for(const _0x506f1b of _0x20bd05){const _0x58fb68=_0x11009c[_0x4cf4ba(0x9d)](_0x506f1b[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)]),_0x2c148a=a134_0x2bc8a9['readFileSync'](_0x506f1b[_0x4cf4ba(0x14b)],'utf-8');if(_0x58fb68){const _0x27561c=await apiChatInterfaceToYaml(_0x58fb68,_0x1ed764),_0x13e57a=toChatInterfaceYamlString(_0x27561c),_0x32abbb=generateDiff(_0x13e57a,_0x2c148a),_0x4feff5=hasChanges(_0x32abbb);_0x4feff5?(_0x4fa29e[_0x4cf4ba(0x135)][_0x4cf4ba(0x1ac)]({'name':_0x506f1b[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0xce),'id':_0x58fb68['id'],'diff':formatDiffWithColors(_0x32abbb)}),_0x4fa29e[_0x4cf4ba(0xec)]['chatInterfaces'][_0x4cf4ba(0xce)]++):(_0x4fa29e[_0x4cf4ba(0x135)]['push']({'name':_0x506f1b[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':'unchanged','id':_0x58fb68['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x135)]['unchanged']++);}else _0x4fa29e[_0x4cf4ba(0x135)][_0x4cf4ba(0x1ac)]({'name':_0x506f1b[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x1af)}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x135)][_0x4cf4ba(0x1af)]++;}if(_0x449f37?.[_0x4cf4ba(0xf8)])return _0x4fa29e;_0x4fa29e[_0x4cf4ba(0xa8)]=[],_0x4fa29e[_0x4cf4ba(0x1ab)]=[],_0x4fa29e[_0x4cf4ba(0x110)]=[],_0x4fa29e[_0x4cf4ba(0x104)]=[],_0x4fa29e[_0x4cf4ba(0xc9)]=[],_0x4fa29e[_0x4cf4ba(0xb6)]=[],_0x4fa29e[_0x4cf4ba(0x11b)]=[],_0x4fa29e[_0x4cf4ba(0x135)]=[];const _0x12b151=_0x4fa29e[_0x4cf4ba(0x1a9)][_0x4cf4ba(0x126)](_0x20e403=>_0x20e403[_0x4cf4ba(0xb0)]===_0x4cf4ba(0x196));_0x4fa29e[_0x4cf4ba(0x1a9)]=_0x12b151,_0x4fa29e[_0x4cf4ba(0xec)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x12b151[_0x4cf4ba(0x10e)]},'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 _0x2ae9df of _0x197d34){try{const _0x2d25a6=_0x50cc72[_0x4cf4ba(0x9d)](_0x2ae9df[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)]),_0x4499e1=yamlKnowledgeBaseToApi(_0x2ae9df[_0x4cf4ba(0xa6)],_0x408de6);if(_0x2d25a6)await this['client']['updateKnowledgeBase'](_0x2d25a6['id'],_0x4499e1),_0x2a4ab5[_0x4cf4ba(0x116)](_0x2ae9df[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],_0x2d25a6['id']),_0x4fa29e[_0x4cf4ba(0xa8)][_0x4cf4ba(0x1ac)]({'name':_0x2ae9df['yaml'][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0xce),'id':_0x2d25a6['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0xa8)]['updated']++;else{const _0xa6eabb=await this['client'][_0x4cf4ba(0x178)](_0x4499e1);_0x2a4ab5[_0x4cf4ba(0x116)](_0x2ae9df[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],_0xa6eabb['id']),_0x4fa29e[_0x4cf4ba(0xa8)]['push']({'name':_0x2ae9df[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':'created','id':_0xa6eabb['id']}),_0x4fa29e[_0x4cf4ba(0xec)]['knowledgeBases'][_0x4cf4ba(0x1af)]++;}}catch(_0x5082e0){_0x4fa29e['knowledgeBases'][_0x4cf4ba(0x1ac)]({'name':_0x2ae9df[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x196),'error':_0x5082e0[_0x4cf4ba(0xa3)]}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0xa8)][_0x4cf4ba(0xf6)]++;}}for(const _0x25751b of _0x220449){try{const _0x36b84c=_0x205384[_0x4cf4ba(0x9d)](_0x25751b[_0x4cf4ba(0x12b)]),_0x367fc2=yamlTextKnowledgeBaseToApi({'name':_0x25751b[_0x4cf4ba(0x12b)],'text':_0x25751b['text']},_0x408de6);if(_0x36b84c)await this['client'][_0x4cf4ba(0xb4)](_0x36b84c['id'],_0x367fc2),_0x2b87ad['set'](_0x25751b[_0x4cf4ba(0x12b)],_0x36b84c['id']),_0x4fa29e[_0x4cf4ba(0x1ab)][_0x4cf4ba(0x1ac)]({'name':_0x25751b['name'],'action':'updated','id':_0x36b84c['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x1ab)][_0x4cf4ba(0xce)]++;else{const _0x34b934=await this[_0x4cf4ba(0xea)][_0x4cf4ba(0xd7)](_0x367fc2);_0x2b87ad['set'](_0x25751b[_0x4cf4ba(0x12b)],_0x34b934['id']),_0x4fa29e[_0x4cf4ba(0x1ab)][_0x4cf4ba(0x1ac)]({'name':_0x25751b['name'],'action':_0x4cf4ba(0x1af),'id':_0x34b934['id']}),_0x4fa29e['counts']['textKnowledgeBases']['created']++;}}catch(_0x52d1ea){_0x4fa29e[_0x4cf4ba(0x1ab)][_0x4cf4ba(0x1ac)]({'name':_0x25751b[_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x196),'error':_0x52d1ea[_0x4cf4ba(0xa3)]}),_0x4fa29e[_0x4cf4ba(0xec)]['textKnowledgeBases'][_0x4cf4ba(0xf6)]++;}}for(const _0x23ff13 of _0x417598){try{const _0x205b93=_0x1be8ef[_0x4cf4ba(0x9d)](_0x23ff13[_0x4cf4ba(0xd2)][_0x4cf4ba(0x12b)]),_0x4e093c=yamlExperimentalKnowledgeBaseToApi(_0x23ff13[_0x4cf4ba(0xd2)],_0x408de6);if(_0x205b93)await this['client'][_0x4cf4ba(0x117)](_0x205b93['id'],_0x4e093c),_0x3695f9[_0x4cf4ba(0x116)](_0x23ff13['def']['name'],_0x205b93['id']),_0x4fa29e['experimentalKnowledgeBases']['push']({'name':_0x23ff13[_0x4cf4ba(0xd2)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0xce),'id':_0x205b93['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0xc9)][_0x4cf4ba(0xce)]++;else{const _0xd979b0=await this[_0x4cf4ba(0xea)]['createExperimentalKnowledgeBase'](_0x4e093c);_0x3695f9[_0x4cf4ba(0x116)](_0x23ff13[_0x4cf4ba(0xd2)][_0x4cf4ba(0x12b)],_0xd979b0['id']),_0x4fa29e[_0x4cf4ba(0xc9)]['push']({'name':_0x23ff13[_0x4cf4ba(0xd2)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x1af),'id':_0xd979b0['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0xc9)][_0x4cf4ba(0x1af)]++;}}catch(_0x483c71){_0x4fa29e[_0x4cf4ba(0xc9)][_0x4cf4ba(0x1ac)]({'name':_0x23ff13['def']['name'],'action':_0x4cf4ba(0x196),'error':_0x483c71[_0x4cf4ba(0xa3)]}),_0x4fa29e['counts']['experimentalKnowledgeBases'][_0x4cf4ba(0xf6)]++;}}for(const _0x37b30c of _0x163877){try{const _0x2be1b6=_0x581b06[_0x4cf4ba(0x9d)](_0x37b30c[_0x4cf4ba(0xd2)]['name']),_0x11ca30=yamlExperimentalArtifactToApi(_0x37b30c[_0x4cf4ba(0xd2)],_0x408de6);if(_0x2be1b6)await this[_0x4cf4ba(0xea)][_0x4cf4ba(0x124)](_0x2be1b6['id'],_0x11ca30),_0xe0691[_0x4cf4ba(0x116)](_0x37b30c['def']['name'],_0x2be1b6['id']),_0x4fa29e[_0x4cf4ba(0xb6)][_0x4cf4ba(0x1ac)]({'name':_0x37b30c[_0x4cf4ba(0xd2)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0xce),'id':_0x2be1b6['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0xb6)][_0x4cf4ba(0xce)]++;else{const _0x35b497=await this[_0x4cf4ba(0xea)]['createExperimentalArtifact'](_0x11ca30);_0xe0691[_0x4cf4ba(0x116)](_0x37b30c[_0x4cf4ba(0xd2)][_0x4cf4ba(0x12b)],_0x35b497['id']),_0x4fa29e[_0x4cf4ba(0xb6)][_0x4cf4ba(0x1ac)]({'name':_0x37b30c['def'][_0x4cf4ba(0x12b)],'action':'created','id':_0x35b497['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0xb6)]['created']++;}}catch(_0x1a9a84){_0x4fa29e[_0x4cf4ba(0xb6)][_0x4cf4ba(0x1ac)]({'name':_0x37b30c[_0x4cf4ba(0xd2)]['name'],'action':_0x4cf4ba(0x196),'error':_0x1a9a84[_0x4cf4ba(0xa3)]}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0xb6)][_0x4cf4ba(0xf6)]++;}}for(const _0x1719cd of _0x57e4){_0x315c07=[];try{const _0x41d2b6=_0x48a6b2['get'](_0x1719cd[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)]),_0x2f5919=await agentDefToRequest(_0x1719cd[_0x4cf4ba(0xa6)],_0x1719cd[_0x4cf4ba(0x15c)],_0x1719cd[_0x4cf4ba(0xf9)],_0x252df4);if(_0x41d2b6)await this[_0x4cf4ba(0xea)][_0x4cf4ba(0x109)](_0x41d2b6['id'],_0x2f5919),_0x2a3739[_0x4cf4ba(0x116)](_0x1719cd[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],_0x41d2b6['id']),_0x4fa29e[_0x4cf4ba(0x1a9)][_0x4cf4ba(0x1ac)]({'agentName':_0x1719cd['yaml']['name'],'action':'updated','agentId':_0x41d2b6['id'],'warnings':_0x315c07[_0x4cf4ba(0x10e)]>0x0?_0x315c07:undefined}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x1a9)][_0x4cf4ba(0xce)]++;else{const _0x1fe72f=await this[_0x4cf4ba(0xea)][_0x4cf4ba(0xaa)](_0x2f5919);_0x2a3739[_0x4cf4ba(0x116)](_0x1719cd['yaml'][_0x4cf4ba(0x12b)],_0x1fe72f['id']),_0x4fa29e[_0x4cf4ba(0x1a9)][_0x4cf4ba(0x1ac)]({'agentName':_0x1719cd[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':'created','agentId':_0x1fe72f['id'],'warnings':_0x315c07[_0x4cf4ba(0x10e)]>0x0?_0x315c07:undefined}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x1a9)][_0x4cf4ba(0x1af)]++;}}catch(_0x2e3e06){_0x4fa29e['agents'][_0x4cf4ba(0x1ac)]({'agentName':_0x1719cd[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':'error','error':_0x2e3e06[_0x4cf4ba(0xa3)],'warnings':_0x315c07[_0x4cf4ba(0x10e)]>0x0?_0x315c07:undefined}),_0x4fa29e['counts'][_0x4cf4ba(0x1a9)]['errors']++;}}for(const _0x1d33bb of _0x33b8f9){try{const _0x553852=_0x18c157[_0x4cf4ba(0x9d)](_0x1d33bb[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)]),_0x34610b=await yamlPromptToApi(_0x1d33bb[_0x4cf4ba(0xa6)],_0x408de6,_0x252df4);if(!_0x34610b){_0x4fa29e['prompts'][_0x4cf4ba(0x1ac)]({'name':_0x1d33bb['yaml'][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x196),'error':_0x4cf4ba(0x160)}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x110)][_0x4cf4ba(0xf6)]++;continue;}if(_0x553852)await this[_0x4cf4ba(0xea)][_0x4cf4ba(0x140)](_0x553852['id'],_0x34610b),_0x3d6b22[_0x4cf4ba(0x116)](_0x1d33bb[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],_0x553852['id']),_0x4fa29e['prompts'][_0x4cf4ba(0x1ac)]({'name':_0x1d33bb[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':'updated','id':_0x553852['id']}),_0x4fa29e[_0x4cf4ba(0xec)]['prompts'][_0x4cf4ba(0xce)]++;else{const _0x2dedc9=await this[_0x4cf4ba(0xea)][_0x4cf4ba(0x106)](_0x34610b);_0x3d6b22[_0x4cf4ba(0x116)](_0x1d33bb['yaml'][_0x4cf4ba(0x12b)],_0x2dedc9['id']),_0x4fa29e[_0x4cf4ba(0x110)][_0x4cf4ba(0x1ac)]({'name':_0x1d33bb[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x1af),'id':_0x2dedc9['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x110)][_0x4cf4ba(0x1af)]++;}}catch(_0x4be43a){_0x4fa29e[_0x4cf4ba(0x110)][_0x4cf4ba(0x1ac)]({'name':_0x1d33bb['yaml'][_0x4cf4ba(0x12b)],'action':'error','error':_0x4be43a['message']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x110)][_0x4cf4ba(0xf6)]++;}}for(const _0x264987 of _0xf84442){try{const _0x4b1598=_0x1c9e3d[_0x4cf4ba(0x9d)](_0x264987['yaml']['service_type']),_0x592185=await yamlIntegrationToApi(_0x264987[_0x4cf4ba(0xa6)],_0x408de6,_0x252df4);if(_0x4b1598){await this[_0x4cf4ba(0xea)][_0x4cf4ba(0x197)](_0x4b1598['id']);const _0x14fd3b=await this['client']['createIntegration'](_0x592185);_0x4fa29e[_0x4cf4ba(0x104)][_0x4cf4ba(0x1ac)]({'name':_0x264987['yaml'][_0x4cf4ba(0xed)],'action':_0x4cf4ba(0xce),'id':_0x14fd3b['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x104)][_0x4cf4ba(0xce)]++;}else{const _0x55473d=await this[_0x4cf4ba(0xea)][_0x4cf4ba(0x10b)](_0x592185);_0x4fa29e[_0x4cf4ba(0x104)]['push']({'name':_0x264987[_0x4cf4ba(0xa6)][_0x4cf4ba(0xed)],'action':_0x4cf4ba(0x1af),'id':_0x55473d['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x104)][_0x4cf4ba(0x1af)]++;}}catch(_0x1e1f8b){_0x4fa29e['integrations']['push']({'name':_0x264987[_0x4cf4ba(0xa6)][_0x4cf4ba(0xed)],'action':_0x4cf4ba(0x196),'error':_0x1e1f8b['message']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x104)][_0x4cf4ba(0xf6)]++;}}for(const _0x5cefb2 of _0x350be2){try{const _0x4ed6ec=_0x236c41[_0x4cf4ba(0x9d)](_0x5cefb2[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)]),_0x161683=await yamlFormInterfaceToApi(_0x5cefb2[_0x4cf4ba(0xa6)],_0x408de6,_0x252df4);if(!_0x161683){_0x4fa29e[_0x4cf4ba(0x11b)][_0x4cf4ba(0x1ac)]({'name':_0x5cefb2[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':'error','error':_0x4cf4ba(0x17a)}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x11b)][_0x4cf4ba(0xf6)]++;continue;}if(_0x4ed6ec){const _0x3d514d=await this[_0x4cf4ba(0xea)][_0x4cf4ba(0xde)](_0x4ed6ec['id'],_0x161683);_0x4fa29e[_0x4cf4ba(0x11b)][_0x4cf4ba(0x1ac)]({'name':_0x5cefb2[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0xce),'id':_0x3d514d['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x11b)]['updated']++;}else{const _0x2fd59a=await this[_0x4cf4ba(0xea)][_0x4cf4ba(0x18a)](_0x161683);_0x4fa29e[_0x4cf4ba(0x11b)][_0x4cf4ba(0x1ac)]({'name':_0x5cefb2[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x1af),'id':_0x2fd59a['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x11b)]['created']++;}}catch(_0x4860b9){_0x4fa29e[_0x4cf4ba(0x11b)][_0x4cf4ba(0x1ac)]({'name':_0x5cefb2[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x196),'error':_0x4860b9[_0x4cf4ba(0xa3)]}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x11b)][_0x4cf4ba(0xf6)]++;}}for(const _0xc21e04 of _0x20bd05){try{const _0x17b2fb=_0x11009c['get'](_0xc21e04[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)]),_0x3a7822=await yamlChatInterfaceToApi(_0xc21e04['yaml'],_0x408de6,_0x252df4);if(_0x17b2fb){const _0x4fcef4=await this[_0x4cf4ba(0xea)]['updateChatInterface'](_0x17b2fb['id'],_0x3a7822);_0x4fa29e[_0x4cf4ba(0x135)][_0x4cf4ba(0x1ac)]({'name':_0xc21e04['yaml']['name'],'action':_0x4cf4ba(0xce),'id':_0x4fcef4['id']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x135)][_0x4cf4ba(0xce)]++;}else{const _0x5d3f19=await this[_0x4cf4ba(0xea)][_0x4cf4ba(0xe6)](_0x3a7822);_0x4fa29e[_0x4cf4ba(0x135)][_0x4cf4ba(0x1ac)]({'name':_0xc21e04[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':'created','id':_0x5d3f19['id']}),_0x4fa29e['counts'][_0x4cf4ba(0x135)][_0x4cf4ba(0x1af)]++;}}catch(_0x5e68fa){_0x4fa29e[_0x4cf4ba(0x135)][_0x4cf4ba(0x1ac)]({'name':_0xc21e04[_0x4cf4ba(0xa6)][_0x4cf4ba(0x12b)],'action':_0x4cf4ba(0x196),'error':_0x5e68fa['message']}),_0x4fa29e[_0x4cf4ba(0xec)][_0x4cf4ba(0x135)][_0x4cf4ba(0xf6)]++;}}return _0x4fa29e;}async['pullAgent'](_0x2b1632,_0x5be7bc,_0x7d5256,_0xc21e1){const _0x385c8b=a134_0x1ba902,{projectId:_0x144ce1,project:_0x297159}=await this[_0x385c8b(0x13e)](_0x2b1632),_0x59a4d8=_0x297159[_0x385c8b(0x15d)][_0x385c8b(0x12b)],_0x5ea8b2=await this[_0x385c8b(0xea)][_0x385c8b(0x118)](_0x144ce1),_0x164df4=_0x5ea8b2[_0x385c8b(0x151)](_0x42af61=>_0x42af61[_0x385c8b(0x15d)][_0x385c8b(0x12b)]===_0x5be7bc);if(!_0x164df4)throw new SDKError(ErrorCode[_0x385c8b(0x107)],_0x385c8b(0x105)+_0x5be7bc,undefined,{'helpText':'Available\x20agents:\x20'+_0x5ea8b2[_0x385c8b(0x17b)](_0x31b63b=>_0x31b63b[_0x385c8b(0x15d)][_0x385c8b(0x12b)])[_0x385c8b(0x133)](',\x20')});let _0x33b3bb;if(_0x7d5256)_0x33b3bb=_0x7d5256;else{const _0x1459b7=a134_0x453e78[_0x385c8b(0x133)](process[_0x385c8b(0xc0)](),_0x385c8b(0x1a9)),_0x355319=getSanitizedPathWithMigration(_0x1459b7,_0x59a4d8);_0x355319['renamed']&&this[_0x385c8b(0xc6)][_0x385c8b(0x17e)](_0x385c8b(0x164)+a134_0x453e78[_0x385c8b(0x188)](_0x355319['oldPath'])+_0x385c8b(0xc2)+a134_0x453e78[_0x385c8b(0x188)](_0x355319[_0x385c8b(0x14b)])),_0x33b3bb=_0x355319[_0x385c8b(0x14b)];}const _0x273fb5=getSanitizedPathWithMigration(_0x33b3bb,_0x5be7bc);_0x273fb5[_0x385c8b(0x9c)]&&this[_0x385c8b(0xc6)][_0x385c8b(0x17e)](_0x385c8b(0x184)+a134_0x453e78[_0x385c8b(0x188)](_0x273fb5['oldPath'])+_0x385c8b(0xc2)+a134_0x453e78['basename'](_0x273fb5[_0x385c8b(0x14b)]));const _0x1b6c2f=_0x273fb5[_0x385c8b(0x14b)],_0xe0cabf=new Map(),_0x22cc38=new Map(),_0x44faaa=await this['client'][_0x385c8b(0x19a)](_0x144ce1),_0x3bf327=await this[_0x385c8b(0xea)][_0x385c8b(0x142)](_0x144ce1),_0x585cce=await safeListOrEmpty(()=>this[_0x385c8b(0xea)]['listExperimentalKnowledgeBases'](_0x144ce1)),_0xeea218=new Map(),_0x17292c=new Map();for(const _0x1b465f of _0x44faaa){_0xe0cabf[_0x385c8b(0x116)](_0x1b465f['id'],_0x1b465f['attributes']['name']);}for(const _0x117f24 of _0x3bf327){_0xeea218[_0x385c8b(0x116)](_0x117f24['id'],_0x117f24['attributes'][_0x385c8b(0x12b)]);}for(const _0x26a272 of _0x585cce){_0x17292c[_0x385c8b(0x116)](_0x26a272['id'],_0x26a272[_0x385c8b(0x15d)][_0x385c8b(0x12b)]);}for(const _0x38e147 of _0x5ea8b2){_0x22cc38['set'](_0x38e147['id'],_0x38e147[_0x385c8b(0x15d)]['name']);}const _0x3fccc7={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0xe0cabf,'TextKnowledgeBase':_0xeea218,'Agent':_0x22cc38,'ExperimentalKnowledgeBase':_0x17292c}),'resolvePromptName':async()=>undefined,'onWarning':_0x535db7=>this['logger'][_0x385c8b(0x1a2)](_0x535db7)},_0x48bf3d=a134_0x453e78['join'](_0x1b6c2f,_0x385c8b(0x15f)),_0xf2a77c=a134_0x453e78[_0x385c8b(0x133)](_0x1b6c2f,_0x385c8b(0xff)),_0x1d8544=a134_0x453e78[_0x385c8b(0x133)](_0x1b6c2f,_0x385c8b(0xcf)),_0x40c9dc=!a134_0x2bc8a9[_0x385c8b(0x149)](_0xf2a77c);if(_0xc21e1?.['dryRun'])return{'agentName':_0x5be7bc,'outputPath':_0x1b6c2f,'isNew':_0x40c9dc,'hasChanges':!![]};a134_0x2bc8a9[_0x385c8b(0x181)](_0x33b3bb,{'recursive':!![]}),a134_0x2bc8a9[_0x385c8b(0x181)](_0x1b6c2f,{'recursive':!![]});const _0x49ed10=a134_0x453e78[_0x385c8b(0x133)](_0x33b3bb,'tdx.json');!a134_0x2bc8a9[_0x385c8b(0x149)](_0x49ed10)&&a134_0x2bc8a9[_0x385c8b(0x138)](_0x49ed10,createAgentConfigContent(_0x2b1632));const {yaml:_0x1362e5,systemPrompt:_0x39cb50,starterMessage:_0x399361}=await agentResponseToDef(_0x164df4,_0x3fccc7);let _0x14c349=_0x40c9dc;if(!_0x40c9dc){const _0x137719=a134_0x2bc8a9['existsSync'](_0x48bf3d)?a134_0x2bc8a9[_0x385c8b(0x198)](_0x48bf3d,_0x385c8b(0x14e)):'',_0xe4643b=a134_0x2bc8a9[_0x385c8b(0x198)](_0xf2a77c,_0x385c8b(0x14e));_0x14c349=_0x137719!==_0x39cb50||_0xe4643b!==toAgentYamlString(_0x1362e5);}a134_0x2bc8a9['writeFileSync'](_0x48bf3d,_0x39cb50),a134_0x2bc8a9[_0x385c8b(0x138)](_0xf2a77c,toAgentYamlString(_0x1362e5));if(_0x399361&&_0x399361[_0x385c8b(0x16d)]('\x0a'))a134_0x2bc8a9['writeFileSync'](_0x1d8544,_0x399361);else a134_0x2bc8a9[_0x385c8b(0x149)](_0x1d8544)&&a134_0x2bc8a9[_0x385c8b(0x187)](_0x1d8544);return{'agentName':_0x5be7bc,'outputPath':_0x1b6c2f,'isNew':_0x40c9dc,'hasChanges':_0x14c349};}async[a134_0x1ba902(0x1ad)](_0x5b06f8,_0x48a70d){const _0x450f3d=a134_0x1ba902;let _0x3640cb;isAgentYamlPath(_0x5b06f8)?_0x3640cb=getAgentDirFromYamlPath(_0x5b06f8):_0x3640cb=_0x5b06f8;const {config:_0x1a618d}=findAgentConfig(_0x3640cb),_0x239c6a=await this[_0x450f3d(0x11c)](_0x1a618d[_0x450f3d(0xdb)]),_0x14d8ce=a134_0x453e78[_0x450f3d(0x133)](_0x3640cb,'agent.yml'),_0x2f6fe1=a134_0x453e78[_0x450f3d(0x133)](_0x3640cb,_0x450f3d(0x15f)),_0x1a1060=a134_0x453e78['join'](_0x3640cb,_0x450f3d(0xcf));if(!a134_0x2bc8a9[_0x450f3d(0x149)](_0x14d8ce))throw new SDKError(ErrorCode[_0x450f3d(0xe0)],_0x450f3d(0xdd)+_0x3640cb,undefined,{'helpText':_0x450f3d(0x19c)});const _0x57e812=parseAgentYaml(a134_0x2bc8a9[_0x450f3d(0x198)](_0x14d8ce,_0x450f3d(0x14e)),_0x14d8ce),_0x4533a1=a134_0x2bc8a9[_0x450f3d(0x149)](_0x2f6fe1)?a134_0x2bc8a9['readFileSync'](_0x2f6fe1,_0x450f3d(0x14e)):'',_0x5d2470=a134_0x2bc8a9[_0x450f3d(0x149)](_0x1a1060)?a134_0x2bc8a9['readFileSync'](_0x1a1060,_0x450f3d(0x14e)):_0x57e812[_0x450f3d(0x15b)];if(_0x48a70d?.[_0x450f3d(0xf8)])return{'agentName':_0x57e812[_0x450f3d(0x12b)],'action':_0x450f3d(0x1af),'projectId':_0x239c6a};const _0x123bed=await this['client'][_0x450f3d(0x118)](_0x239c6a),_0x3fab78=await fetchAllToolTargetMaps((_0x1d30ee,_0x415d79)=>this[_0x450f3d(0xea)]['listToolTargets'](_0x1d30ee,_0x415d79),_0x239c6a),_0x33a398=new Map();for(const _0x257faf of _0x123bed){_0x33a398[_0x450f3d(0x116)](_0x257faf[_0x450f3d(0x15d)][_0x450f3d(0x12b)],_0x257faf['id']);}const _0x40fce1=[],_0x1b2dd9={'projectId':_0x239c6a,'resolveToolTargetId':buildIdResolver({..._0x3fab78[_0x450f3d(0x13c)],'Agent':_0x33a398}),'resolvePromptId':async()=>undefined,'onWarning':_0x5adf8c=>{const _0x4486d1=_0x450f3d;this['logger'][_0x4486d1(0x1a2)](_0x5adf8c),_0x40fce1[_0x4486d1(0x1ac)](_0x5adf8c);}};try{const _0x146ca9=_0x123bed[_0x450f3d(0x151)](_0x5cd8b4=>_0x5cd8b4[_0x450f3d(0x15d)][_0x450f3d(0x12b)]===_0x57e812[_0x450f3d(0x12b)]),_0x143062=await agentDefToRequest(_0x57e812,_0x4533a1,_0x5d2470,_0x1b2dd9);if(_0x146ca9)return await this[_0x450f3d(0xea)][_0x450f3d(0x109)](_0x146ca9['id'],_0x143062),{'agentName':_0x57e812[_0x450f3d(0x12b)],'action':_0x450f3d(0xce),'projectId':_0x239c6a,'agentId':_0x146ca9['id'],'warnings':_0x40fce1[_0x450f3d(0x10e)]>0x0?_0x40fce1:undefined};else{const _0x391550=await this[_0x450f3d(0xea)][_0x450f3d(0xaa)](_0x143062);return{'agentName':_0x57e812['name'],'action':'created','projectId':_0x239c6a,'agentId':_0x391550['id'],'warnings':_0x40fce1[_0x450f3d(0x10e)]>0x0?_0x40fce1:undefined};}}catch(_0x13e7dd){return{'agentName':_0x57e812['name'],'action':_0x450f3d(0x196),'projectId':_0x239c6a,'error':_0x13e7dd[_0x450f3d(0xa3)],'warnings':_0x40fce1[_0x450f3d(0x10e)]>0x0?_0x40fce1:undefined};}}async[a134_0x1ba902(0xe1)](_0x3eb821,_0x488856,_0x2e4f10){const _0x442260=a134_0x1ba902,_0x291b59=a134_0x2bc8a9['existsSync'](_0x3eb821)&&a134_0x2bc8a9[_0x442260(0x149)](a134_0x453e78[_0x442260(0x133)](_0x3eb821,_0x442260(0x19e)));let _0xa5e2cb;const _0x208335=[],_0xa71f42=[],_0x2312b4=[],_0x1b34ae=[],_0x46d2de=[],_0x284f2b=[],_0x28c7cb=[],_0x375c39=[],_0x128c36=[];if(_0x291b59){const _0x575966=loadAgentConfig(a134_0x453e78['join'](_0x3eb821,_0x442260(0x19e)));_0xa5e2cb=_0x575966['llm_project'];const _0x50454f=a134_0x2bc8a9['readdirSync'](_0x3eb821,{'withFileTypes':!![]});for(const _0x4915dd of _0x50454f){if(!_0x4915dd[_0x442260(0xc7)]())continue;if([_0x442260(0x1b1),_0x442260(0xd8),'experimental_artifacts',_0x442260(0x110),'integrations',_0x442260(0x1a8),_0x442260(0x12a)][_0x442260(0x16d)](_0x4915dd[_0x442260(0x12b)]))continue;const _0x5c252a=a134_0x453e78['join'](_0x3eb821,_0x4915dd[_0x442260(0x12b)]);if(isAgentDir(_0x5c252a)){const _0x2f90b6=a134_0x453e78[_0x442260(0x133)](_0x5c252a,'agent.yml'),_0x1bcbf9=a134_0x453e78['join'](_0x5c252a,'prompt.md'),_0x3f88df=a134_0x453e78[_0x442260(0x133)](_0x5c252a,_0x442260(0xcf)),_0x359f17=parseAgentYaml(a134_0x2bc8a9[_0x442260(0x198)](_0x2f90b6,_0x442260(0x14e)),_0x2f90b6),_0x243ba2=a134_0x2bc8a9[_0x442260(0x149)](_0x1bcbf9)?a134_0x2bc8a9[_0x442260(0x198)](_0x1bcbf9,_0x442260(0x14e)):'',_0x228b9a=a134_0x2bc8a9[_0x442260(0x149)](_0x3f88df)?a134_0x2bc8a9[_0x442260(0x198)](_0x3f88df,_0x442260(0x14e)):_0x359f17[_0x442260(0x15b)];_0x208335['push']({'name':_0x359f17[_0x442260(0x12b)],'dir':_0x5c252a,'yaml':_0x359f17,'systemPrompt':_0x243ba2,'starterMessage':_0x228b9a});}}const _0x1f55df=getKnowledgeBasesDir(_0x3eb821);if(a134_0x2bc8a9['existsSync'](_0x1f55df)){const _0x4957dd=a134_0x2bc8a9[_0x442260(0x130)](_0x1f55df);for(const _0x3f02fc of _0x4957dd){const _0x425515=a134_0x453e78[_0x442260(0x133)](_0x1f55df,_0x3f02fc);if(_0x3f02fc[_0x442260(0x166)](_0x442260(0xb7))){const _0x4f160c=parseKnowledgeBaseYaml(a134_0x2bc8a9[_0x442260(0x198)](_0x425515,_0x442260(0x14e)),_0x425515);_0xa71f42[_0x442260(0x1ac)]({'name':_0x4f160c[_0x442260(0x12b)],'path':_0x425515,'yaml':_0x4f160c});}else{if(_0x3f02fc[_0x442260(0x166)](_0x442260(0x11f))){const _0x1b624a=a134_0x2bc8a9['readFileSync'](_0x425515,'utf-8'),{name:_0x4df15b,text:_0x94ad55}=parseTextKnowledgeBaseMd(_0x1b624a,_0x3f02fc);_0x2312b4[_0x442260(0x1ac)]({'name':_0x4df15b,'path':_0x425515,'text':_0x94ad55});}}}}const _0x15341e=getPromptsDir(_0x3eb821);if(a134_0x2bc8a9[_0x442260(0x149)](_0x15341e)){const _0x35fc9b=a134_0x2bc8a9[_0x442260(0x130)](_0x15341e)[_0x442260(0x126)](_0x9e4c67=>_0x9e4c67[_0x442260(0x166)](_0x442260(0xb7)));for(const _0x182462 of _0x35fc9b){const _0x235e5a=a134_0x453e78[_0x442260(0x133)](_0x15341e,_0x182462),_0x4dae44=parsePromptYaml(a134_0x2bc8a9['readFileSync'](_0x235e5a,_0x442260(0x14e)),_0x235e5a);_0x1b34ae[_0x442260(0x1ac)]({'name':_0x4dae44[_0x442260(0x12b)],'path':_0x235e5a,'yaml':_0x4dae44});}}const _0x4c90e4=getIntegrationsDir(_0x3eb821);if(a134_0x2bc8a9['existsSync'](_0x4c90e4)){const _0x2041a5=a134_0x2bc8a9[_0x442260(0x130)](_0x4c90e4)[_0x442260(0x126)](_0x5e8d22=>_0x5e8d22['endsWith'](_0x442260(0xb7)));for(const _0x53914a of _0x2041a5){const _0x1e6b01=a134_0x453e78['join'](_0x4c90e4,_0x53914a),_0x561a81=parseIntegrationYaml(a134_0x2bc8a9[_0x442260(0x198)](_0x1e6b01,_0x442260(0x14e)),_0x1e6b01);SAFE_INTEGRATION_TYPES[_0x442260(0x16d)](_0x561a81[_0x442260(0xed)][_0x442260(0x13d)]())?_0x46d2de[_0x442260(0x1ac)]({'name':_0x561a81[_0x442260(0x12b)],'path':_0x1e6b01,'yaml':_0x561a81}):this['logger'][_0x442260(0x1a2)](_0x442260(0x16e)+_0x561a81[_0x442260(0x12b)]+'\x27\x20('+_0x561a81[_0x442260(0xed)]+_0x442260(0xae)+(_0x442260(0x1aa)+SAFE_INTEGRATION_TYPES[_0x442260(0x133)](',\x20')+_0x442260(0xbf)));}}const _0x2d12d8=getExperimentalKnowledgeBasesDir(_0x3eb821);if(a134_0x2bc8a9[_0x442260(0x149)](_0x2d12d8)){const _0x13ddcd=a134_0x2bc8a9[_0x442260(0x130)](_0x2d12d8,{'withFileTypes':!![]});for(const _0x953e9e of _0x13ddcd){if(!_0x953e9e['isDirectory']())continue;const _0x3a8ef2=a134_0x453e78[_0x442260(0x133)](_0x2d12d8,_0x953e9e[_0x442260(0x12b)]),_0x348c4f=a134_0x453e78[_0x442260(0x133)](_0x3a8ef2,_0x953e9e[_0x442260(0x12b)]+'.yml');if(a134_0x2bc8a9[_0x442260(0x149)](_0x348c4f)){const _0x5f4595=parseExperimentalKnowledgeBaseYaml(a134_0x2bc8a9[_0x442260(0x198)](_0x348c4f,'utf-8'),_0x348c4f),_0x2a97bc=a134_0x453e78['join'](_0x3a8ef2,'functions'),_0x52ae3c=[];if(a134_0x2bc8a9[_0x442260(0x149)](_0x2a97bc)){const _0x362f9e=a134_0x2bc8a9['readdirSync'](_0x2a97bc,{'withFileTypes':!![]});for(const _0x314a67 of _0x362f9e){if(!_0x314a67[_0x442260(0xc7)]())continue;const _0x1f63a5=a134_0x453e78[_0x442260(0x133)](_0x2a97bc,_0x314a67['name']),_0x240dbb=a134_0x453e78[_0x442260(0x133)](_0x1f63a5,_0x442260(0x14a)),_0x1a3233=a134_0x453e78[_0x442260(0x133)](_0x1f63a5,'json_schema.json');if(a134_0x2bc8a9[_0x442260(0x149)](_0x240dbb)&&a134_0x2bc8a9[_0x442260(0x149)](_0x1a3233)){const _0x508632=a134_0x2bc8a9[_0x442260(0x198)](_0x240dbb,_0x442260(0x14e)),_0x17f731=a134_0x2bc8a9['readFileSync'](_0x1a3233,'utf-8');_0x52ae3c[_0x442260(0x1ac)]({'name':_0x314a67[_0x442260(0x12b)],'code':_0x508632,'json_schema':_0x17f731});}}}const _0x553e65={..._0x5f4595,'functions':_0x52ae3c};_0x284f2b['push']({'name':_0x5f4595[_0x442260(0x12b)],'path':_0x3a8ef2,'def':_0x553e65});}}}const _0x3b1899=getExperimentalArtifactsDir(_0x3eb821);if(a134_0x2bc8a9[_0x442260(0x149)](_0x3b1899)){const _0x8b70b9=a134_0x2bc8a9[_0x442260(0x130)](_0x3b1899,{'withFileTypes':!![]});for(const _0x29c038 of _0x8b70b9){if(!_0x29c038['isDirectory']())continue;const _0x7264d3=a134_0x453e78[_0x442260(0x133)](_0x3b1899,_0x29c038[_0x442260(0x12b)]),_0x53a4f2=a134_0x453e78[_0x442260(0x133)](_0x7264d3,_0x29c038[_0x442260(0x12b)]+_0x442260(0xb7));if(a134_0x2bc8a9['existsSync'](_0x53a4f2)){const _0x51492d=parseExperimentalArtifactYaml(a134_0x2bc8a9[_0x442260(0x198)](_0x53a4f2,_0x442260(0x14e)),_0x53a4f2),_0x368bc5=a134_0x453e78[_0x442260(0x133)](_0x7264d3,_0x442260(0x14a)),_0x4d55f3=a134_0x2bc8a9[_0x442260(0x149)](_0x368bc5)?a134_0x2bc8a9[_0x442260(0x198)](_0x368bc5,_0x442260(0x14e)):'',_0x274a88=a134_0x453e78[_0x442260(0x133)](_0x7264d3,_0x442260(0x10f)),_0x3b3a6a=[];if(a134_0x2bc8a9[_0x442260(0x149)](_0x274a88)){const _0x14becb=a134_0x2bc8a9[_0x442260(0x130)](_0x274a88);for(const _0x351c5f of _0x14becb){const _0x3a4a1a=a134_0x453e78[_0x442260(0x133)](_0x274a88,_0x351c5f);if(a134_0x2bc8a9[_0x442260(0xf2)](_0x3a4a1a)[_0x442260(0x139)]()){const _0xd72512=a134_0x2bc8a9[_0x442260(0x198)](_0x3a4a1a,_0x442260(0x14e));_0x3b3a6a[_0x442260(0x1ac)]({'file_name':_0x351c5f,'text_content':_0xd72512});}}}const _0x577b4a={..._0x51492d,'code':_0x4d55f3,'files':_0x3b3a6a};_0x28c7cb[_0x442260(0x1ac)]({'name':_0x51492d[_0x442260(0x12b)],'path':_0x7264d3,'def':_0x577b4a});}}}const _0x4b4539=getFormInterfacesDir(_0x3eb821);if(a134_0x2bc8a9[_0x442260(0x149)](_0x4b4539)){const _0x2ccad2=a134_0x2bc8a9[_0x442260(0x130)](_0x4b4539)[_0x442260(0x126)](_0x23b699=>_0x23b699[_0x442260(0x166)](_0x442260(0xb7)));for(const _0x57c39 of _0x2ccad2){const _0x3079de=a134_0x453e78[_0x442260(0x133)](_0x4b4539,_0x57c39),_0x22c303=parseFormInterfaceYaml(a134_0x2bc8a9[_0x442260(0x198)](_0x3079de,_0x442260(0x14e)),_0x3079de);_0x375c39[_0x442260(0x1ac)]({'name':_0x22c303[_0x442260(0x12b)],'path':_0x3079de,'yaml':_0x22c303});}}const _0x31f77a=getChatInterfacesDir(_0x3eb821);if(a134_0x2bc8a9[_0x442260(0x149)](_0x31f77a)){const _0x2830f0=a134_0x2bc8a9['readdirSync'](_0x31f77a)[_0x442260(0x126)](_0x367ecf=>_0x367ecf[_0x442260(0x166)](_0x442260(0xb7)));for(const _0x3e8c0a of _0x2830f0){const _0x1af405=a134_0x453e78[_0x442260(0x133)](_0x31f77a,_0x3e8c0a),_0xd96c68=parseChatInterfaceYaml(a134_0x2bc8a9['readFileSync'](_0x1af405,_0x442260(0x14e)),_0x1af405);_0x128c36['push']({'name':_0xd96c68[_0x442260(0x12b)],'path':_0x1af405,'yaml':_0xd96c68});}}}else{const _0x56b154=await this[_0x442260(0x11c)](_0x3eb821),_0x3c4169=await this[_0x442260(0xea)][_0x442260(0x125)](_0x56b154);_0xa5e2cb=_0x3c4169[_0x442260(0x15d)]['name'];const _0x2b1c86=await this['client']['listAgentsFull'](_0x56b154),_0x4c74aa=await this[_0x442260(0xea)][_0x442260(0x19a)](_0x56b154),_0x2e71b2=await this[_0x442260(0xea)][_0x442260(0x142)](_0x56b154),_0x324bbb=await this['client'][_0x442260(0xfd)](_0x56b154),_0x4a5407=await this[_0x442260(0xea)][_0x442260(0xf3)](_0x56b154),_0x5879e4=await safeListOrEmpty(()=>this[_0x442260(0xea)]['listExperimentalKnowledgeBases'](_0x56b154)),_0x280992=await safeListOrEmpty(()=>this['client'][_0x442260(0xb1)](_0x56b154)),_0x5e394d=new Map(),_0x503eab=new Map(),_0x302927=new Map(),_0x2dbbf2=new Map(),_0x2122ba=new Map(),_0x700cb3=new Map();for(const _0x12896f of _0x4c74aa){_0x5e394d[_0x442260(0x116)](_0x12896f['id'],_0x12896f[_0x442260(0x15d)][_0x442260(0x12b)]);}for(const _0x480e6c of _0x2e71b2){_0x503eab[_0x442260(0x116)](_0x480e6c['id'],_0x480e6c['attributes']['name']);}for(const _0x647180 of _0x2b1c86){_0x302927[_0x442260(0x116)](_0x647180['id'],_0x647180[_0x442260(0x15d)][_0x442260(0x12b)]);}for(const _0x405ecc of _0x324bbb){_0x2dbbf2[_0x442260(0x116)](_0x405ecc['id'],_0x405ecc[_0x442260(0x15d)][_0x442260(0x12b)]);}for(const _0xe57f55 of _0x5879e4){_0x2122ba['set'](_0xe57f55['id'],_0xe57f55[_0x442260(0x15d)]['name']);}for(const _0x557e7e of _0x280992){_0x700cb3['set'](_0x557e7e['id'],_0x557e7e[_0x442260(0x15d)]['name']);}const _0x534c2d={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x5e394d,'TextKnowledgeBase':_0x503eab,'Agent':_0x302927,'ExperimentalKnowledgeBase':_0x2122ba}),'resolvePromptName':async _0x37ef6f=>_0x2dbbf2[_0x442260(0x9d)](_0x37ef6f),'onWarning':_0x6d21a2=>this[_0x442260(0xc6)][_0x442260(0x1a2)](_0x6d21a2)};for(const _0x2e2e54 of _0x2b1c86){const _0x346004=await agentResponseToDef(_0x2e2e54,_0x534c2d),{yaml:_0x1a38fb,systemPrompt:_0x1ca135,starterMessage:_0x5a7359}=_0x346004;_0x208335[_0x442260(0x1ac)]({'name':_0x1a38fb['name'],'dir':'','yaml':_0x1a38fb,'systemPrompt':_0x1ca135,'starterMessage':_0x5a7359});}for(const _0x353369 of _0x4c74aa){const _0x20e1a5=apiKnowledgeBaseToYaml(_0x353369);_0xa71f42['push']({'name':_0x20e1a5[_0x442260(0x12b)],'path':'','yaml':_0x20e1a5});}for(const _0xf86d43 of _0x2e71b2){_0x2312b4['push']({'name':_0xf86d43[_0x442260(0x15d)][_0x442260(0x12b)],'path':'','text':_0xf86d43[_0x442260(0x15d)]['text']});}for(const _0x351e75 of _0x324bbb){const _0x265a12=await apiPromptToYaml(_0x351e75,_0x534c2d);_0x265a12&&_0x1b34ae[_0x442260(0x1ac)]({'name':_0x265a12[_0x442260(0x12b)],'path':'','yaml':_0x265a12});}for(const _0x1f5183 of _0x4a5407){if(!_0x1f5183[_0x442260(0x15d)][_0x442260(0x190)]&&SAFE_INTEGRATION_TYPES[_0x442260(0x16d)](_0x1f5183[_0x442260(0x15d)][_0x442260(0x114)][_0x442260(0x13d)]())){const _0xb0b11=await apiIntegrationToYaml(_0x1f5183,_0x534c2d);_0x46d2de['push']({'name':_0x1f5183[_0x442260(0x15d)][_0x442260(0x114)]['toLowerCase'](),'path':'','yaml':_0xb0b11});}}for(const _0x3eb3f9 of _0x5879e4){const _0x2d0ee3=apiExperimentalKnowledgeBaseToYaml(_0x3eb3f9);_0x284f2b['push']({'name':_0x2d0ee3['name'],'path':'','def':_0x2d0ee3});}for(const _0x2d64bc of _0x280992){const _0x274f6b=apiExperimentalArtifactToYaml(_0x2d64bc);_0x28c7cb[_0x442260(0x1ac)]({'name':_0x274f6b[_0x442260(0x12b)],'path':'','def':_0x274f6b});}const _0x4d8be0=await safeListOrEmpty(()=>this[_0x442260(0xea)][_0x442260(0x132)](_0x56b154));for(const _0x265967 of _0x4d8be0){const _0x426e70=await apiFormInterfaceToYaml(_0x265967,_0x534c2d);_0x375c39[_0x442260(0x1ac)]({'name':_0x426e70[_0x442260(0x12b)],'path':'','yaml':_0x426e70});}const _0x10b994=await safeListOrEmpty(()=>this[_0x442260(0xea)][_0x442260(0x13f)](_0x56b154));for(const _0x53856e of _0x10b994){if(_0x53856e[_0x442260(0x15d)][_0x442260(0x190)])continue;const _0x32ddf4=await apiChatInterfaceToYaml(_0x53856e,_0x534c2d);_0x128c36[_0x442260(0x1ac)]({'name':_0x32ddf4[_0x442260(0x12b)],'path':'','yaml':_0x32ddf4});}}const _0x10cb01={'sourceProjectName':_0xa5e2cb,'newProjectName':_0x488856,'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}}},_0x59cb6b=await this['client']['listProjects'](),_0x488c52=_0x59cb6b['find'](_0x327204=>_0x327204['attributes']['name']===_0x488856);if(_0x488c52)throw new SDKError(ErrorCode[_0x442260(0x14c)],_0x442260(0x119)+_0x488856+'\x22\x20already\x20exists',undefined,{'helpText':_0x442260(0x191)});if(_0x2e4f10?.['dryRun'])return _0x10cb01[_0x442260(0xec)][_0x442260(0x1a9)]['created']=_0x208335[_0x442260(0x10e)],_0x10cb01[_0x442260(0xec)]['knowledgeBases']['created']=_0xa71f42[_0x442260(0x10e)],_0x10cb01[_0x442260(0xec)][_0x442260(0x1ab)][_0x442260(0x1af)]=_0x2312b4[_0x442260(0x10e)],_0x10cb01[_0x442260(0xec)][_0x442260(0xc9)][_0x442260(0x1af)]=_0x284f2b[_0x442260(0x10e)],_0x10cb01['counts'][_0x442260(0xb6)]['created']=_0x28c7cb[_0x442260(0x10e)],_0x10cb01[_0x442260(0xec)][_0x442260(0x110)][_0x442260(0x1af)]=_0x1b34ae['length'],_0x10cb01[_0x442260(0xec)]['integrations'][_0x442260(0x1af)]=_0x46d2de[_0x442260(0x10e)],_0x10cb01;const _0x578d93=await this[_0x442260(0xea)][_0x442260(0x170)]({'name':_0x488856}),_0x3fa6a9=_0x578d93['id'];_0x10cb01['newProjectId']=_0x3fa6a9;const _0x5ddbd1=new Map(),_0x589f9b=new Map(),_0x405eea=new Map(),_0x24a545=new Map(),_0xc4666c=new Map(),_0x48dd84=new Map(),_0xcc1f33=new Map(),_0x1009b8=new Map(),_0x4b0b3c=new Set(),_0x31dfe0=new Set();for(const _0x144596 of _0x208335){for(const _0x191d71 of _0x144596[_0x442260(0xa6)]['tools']||[]){if(_0x191d71[_0x442260(0x176)]===_0x442260(0x159)&&_0x191d71[_0x442260(0x158)]){const _0x4d0c13=parseRef(_0x191d71[_0x442260(0x158)]);if(_0x4d0c13)_0x4b0b3c['add'](_0x4d0c13[_0x442260(0x12b)]);}else{if(_0x191d71[_0x442260(0x176)]===_0x442260(0xd1)&&_0x191d71['target']){const _0x2fbee9=parseRef(_0x191d71[_0x442260(0x158)]);if(_0x2fbee9)_0x31dfe0[_0x442260(0x150)](_0x2fbee9['name']);}}}}for(const _0xdb4be9 of _0x4b0b3c){try{const _0x59ef07=await this[_0x442260(0xea)][_0x442260(0x145)]({'projectId':_0x3fa6a9,'name':_0xdb4be9});_0xc4666c[_0x442260(0x116)](_0xdb4be9,_0x59ef07['id']),_0x10cb01['imageGenerators'][_0x442260(0x1ac)]({'name':_0xdb4be9,'action':'created','id':_0x59ef07['id']}),_0x10cb01[_0x442260(0xec)][_0x442260(0x1ae)][_0x442260(0x1af)]++;}catch(_0x45dcb6){_0x10cb01[_0x442260(0x1ae)]['push']({'name':_0xdb4be9,'action':_0x442260(0x196),'error':_0x45dcb6['message']}),_0x10cb01['counts'][_0x442260(0x1ae)]['errors']++;}}for(const _0x500047 of _0x31dfe0){try{const _0x371be8=await this[_0x442260(0xea)][_0x442260(0x1b2)]({'projectId':_0x3fa6a9,'name':_0x500047});_0x48dd84[_0x442260(0x116)](_0x500047,_0x371be8['id']),_0x10cb01[_0x442260(0xe5)]['push']({'name':_0x500047,'action':_0x442260(0x1af),'id':_0x371be8['id']}),_0x10cb01[_0x442260(0xec)]['webSearchTools'][_0x442260(0x1af)]++;}catch(_0x3cc04e){_0x10cb01[_0x442260(0xe5)][_0x442260(0x1ac)]({'name':_0x500047,'action':_0x442260(0x196),'error':_0x3cc04e[_0x442260(0xa3)]}),_0x10cb01['counts'][_0x442260(0xe5)][_0x442260(0xf6)]++;}}const _0x175b6e=await fetchAllToolTargetMaps((_0x37647d,_0x2830ae)=>this['client'][_0x442260(0xf1)](_0x37647d,_0x2830ae),_0x3fa6a9);let _0x3a4cf8=[];const _0xc6ed31={'projectId':_0x3fa6a9,'resolveToolTargetId':buildIdResolver({..._0x175b6e[_0x442260(0x13c)],'KnowledgeBase':_0x5ddbd1,'TextKnowledgeBase':_0x589f9b,'ExperimentalKnowledgeBase':_0xcc1f33,'Agent':_0x405eea,'WebSearchTool':_0x48dd84,'ImageGenerator':_0xc4666c}),'resolvePromptId':async _0x350258=>_0x24a545['get'](_0x350258),'onWarning':_0x3ab610=>{const _0x374c4b=_0x442260;this[_0x374c4b(0xc6)][_0x374c4b(0x1a2)](_0x3ab610),_0x3a4cf8['push'](_0x3ab610);}};for(const _0x471a19 of _0xa71f42){try{const _0x40ea90=yamlKnowledgeBaseToApi(_0x471a19[_0x442260(0xa6)],_0x3fa6a9),_0x4e4d71=await this[_0x442260(0xea)][_0x442260(0x178)](_0x40ea90);_0x5ddbd1[_0x442260(0x116)](_0x471a19[_0x442260(0xa6)][_0x442260(0x12b)],_0x4e4d71['id']),_0x10cb01['knowledgeBases']['push']({'name':_0x471a19[_0x442260(0xa6)][_0x442260(0x12b)],'action':_0x442260(0x1af),'id':_0x4e4d71['id']}),_0x10cb01[_0x442260(0xec)][_0x442260(0xa8)][_0x442260(0x1af)]++;}catch(_0x2d073e){_0x10cb01[_0x442260(0xa8)]['push']({'name':_0x471a19['yaml']['name'],'action':_0x442260(0x196),'error':_0x2d073e[_0x442260(0xa3)]}),_0x10cb01['counts'][_0x442260(0xa8)][_0x442260(0xf6)]++;}}for(const _0x5ce8f4 of _0x2312b4){try{const _0x44ac62=yamlTextKnowledgeBaseToApi({'name':_0x5ce8f4[_0x442260(0x12b)],'text':_0x5ce8f4[_0x442260(0x136)]},_0x3fa6a9),_0x17f2de=await this[_0x442260(0xea)][_0x442260(0xd7)](_0x44ac62);_0x589f9b[_0x442260(0x116)](_0x5ce8f4['name'],_0x17f2de['id']),_0x10cb01['textKnowledgeBases'][_0x442260(0x1ac)]({'name':_0x5ce8f4[_0x442260(0x12b)],'action':_0x442260(0x1af),'id':_0x17f2de['id']}),_0x10cb01['counts'][_0x442260(0x1ab)]['created']++;}catch(_0xcf46d6){_0x10cb01[_0x442260(0x1ab)]['push']({'name':_0x5ce8f4[_0x442260(0x12b)],'action':_0x442260(0x196),'error':_0xcf46d6[_0x442260(0xa3)]}),_0x10cb01[_0x442260(0xec)]['textKnowledgeBases'][_0x442260(0xf6)]++;}}for(const _0x1334df of _0x28c7cb){try{const _0x22b223=yamlExperimentalArtifactToApi(_0x1334df['def'],_0x3fa6a9),_0x53021a=await this[_0x442260(0xea)][_0x442260(0x11e)](_0x22b223);_0x1009b8['set'](_0x1334df[_0x442260(0xd2)][_0x442260(0x12b)],_0x53021a['id']),_0x10cb01[_0x442260(0xb6)][_0x442260(0x1ac)]({'name':_0x1334df[_0x442260(0xd2)][_0x442260(0x12b)],'action':_0x442260(0x1af),'id':_0x53021a['id']}),_0x10cb01[_0x442260(0xec)][_0x442260(0xb6)][_0x442260(0x1af)]++;}catch(_0x4c27c0){_0x10cb01['experimentalArtifacts'][_0x442260(0x1ac)]({'name':_0x1334df[_0x442260(0xd2)]['name'],'action':'error','error':_0x4c27c0[_0x442260(0xa3)]}),_0x10cb01[_0x442260(0xec)][_0x442260(0xb6)][_0x442260(0xf6)]++;}}for(const _0x3eb995 of _0x284f2b){try{const _0x522954=yamlExperimentalKnowledgeBaseToApi(_0x3eb995[_0x442260(0xd2)],_0x3fa6a9),_0x5e9217=await this[_0x442260(0xea)][_0x442260(0x193)](_0x522954);_0xcc1f33[_0x442260(0x116)](_0x3eb995[_0x442260(0xd2)][_0x442260(0x12b)],_0x5e9217['id']),_0x10cb01[_0x442260(0xc9)]['push']({'name':_0x3eb995[_0x442260(0xd2)][_0x442260(0x12b)],'action':_0x442260(0x1af),'id':_0x5e9217['id']}),_0x10cb01[_0x442260(0xec)][_0x442260(0xc9)][_0x442260(0x1af)]++;}catch(_0x28ae4d){_0x10cb01[_0x442260(0xc9)][_0x442260(0x1ac)]({'name':_0x3eb995[_0x442260(0xd2)][_0x442260(0x12b)],'action':_0x442260(0x196),'error':_0x28ae4d[_0x442260(0xa3)]}),_0x10cb01[_0x442260(0xec)]['experimentalKnowledgeBases']['errors']++;}}const _0x3d5a83=[..._0x208335]['sort']((_0x1f1307,_0x2c3137)=>{const _0xfcb64d=_0x442260,_0x17740d=_0x1f1307['yaml']['tools']?.[_0xfcb64d(0xa1)](_0x4c7da9=>_0x4c7da9[_0xfcb64d(0x176)]==='agent')??![],_0x35484a=_0x2c3137[_0xfcb64d(0xa6)][_0xfcb64d(0x165)]?.['some'](_0x1a12d1=>_0x1a12d1[_0xfcb64d(0x176)]===_0xfcb64d(0x169))??![];if(_0x17740d&&!_0x35484a)return 0x1;if(!_0x17740d&&_0x35484a)return-0x1;return 0x0;});for(const _0x418793 of _0x3d5a83){_0x3a4cf8=[];try{const _0x3fe490=_0x418793[_0x442260(0xa6)][_0x442260(0x165)]?.[_0x442260(0x126)](_0x125f7b=>{const _0x813524=_0x442260;if(_0x125f7b['type']===_0x813524(0x169)&&_0x125f7b[_0x813524(0x158)]){const _0x59f5f2=parseRef(_0x125f7b[_0x813524(0x158)]);return _0x59f5f2?.[_0x813524(0x12b)]===_0x418793['yaml'][_0x813524(0x12b)];}return![];})??[];if(_0x3fe490[_0x442260(0x10e)]>0x0){const _0x1c5b92=_0x442260(0x10c)+_0x418793[_0x442260(0xa6)][_0x442260(0x12b)]+_0x442260(0xd0)+_0x442260(0xdf);this[_0x442260(0xc6)][_0x442260(0x1a2)](_0x1c5b92),_0x3a4cf8[_0x442260(0x1ac)](_0x1c5b92);}const _0x4ed78c=await agentDefToRequest(_0x418793['yaml'],_0x418793[_0x442260(0x15c)],_0x418793[_0x442260(0xf9)],_0xc6ed31),_0x2f1616=await this[_0x442260(0xea)][_0x442260(0xaa)](_0x4ed78c);_0x405eea[_0x442260(0x116)](_0x418793['yaml'][_0x442260(0x12b)],_0x2f1616['id']),_0x10cb01['agents']['push']({'agentName':_0x418793['yaml'][_0x442260(0x12b)],'action':'created','agentId':_0x2f1616['id'],'warnings':_0x3a4cf8['length']>0x0?_0x3a4cf8:undefined}),_0x10cb01[_0x442260(0xec)][_0x442260(0x1a9)]['created']++;}catch(_0x4dd813){_0x10cb01[_0x442260(0x1a9)][_0x442260(0x1ac)]({'agentName':_0x418793[_0x442260(0xa6)][_0x442260(0x12b)],'action':_0x442260(0x196),'error':_0x4dd813['message'],'warnings':_0x3a4cf8[_0x442260(0x10e)]>0x0?_0x3a4cf8:undefined}),_0x10cb01[_0x442260(0xec)][_0x442260(0x1a9)][_0x442260(0xf6)]++;}}for(const _0xffc62d of _0x1b34ae){try{const _0x46b36c=await yamlPromptToApi(_0xffc62d[_0x442260(0xa6)],_0x3fa6a9,_0xc6ed31);if(!_0x46b36c){_0x10cb01['prompts'][_0x442260(0x1ac)]({'name':_0xffc62d[_0x442260(0xa6)]['name'],'action':_0x442260(0x196),'error':_0x442260(0x160)}),_0x10cb01[_0x442260(0xec)]['prompts'][_0x442260(0xf6)]++;continue;}const _0x219831=await this[_0x442260(0xea)][_0x442260(0x106)](_0x46b36c);_0x24a545[_0x442260(0x116)](_0xffc62d[_0x442260(0xa6)][_0x442260(0x12b)],_0x219831['id']),_0x10cb01[_0x442260(0x110)][_0x442260(0x1ac)]({'name':_0xffc62d[_0x442260(0xa6)][_0x442260(0x12b)],'action':_0x442260(0x1af),'id':_0x219831['id']}),_0x10cb01[_0x442260(0xec)]['prompts'][_0x442260(0x1af)]++;}catch(_0x51cae8){_0x10cb01[_0x442260(0x110)]['push']({'name':_0xffc62d[_0x442260(0xa6)][_0x442260(0x12b)],'action':_0x442260(0x196),'error':_0x51cae8['message']}),_0x10cb01[_0x442260(0xec)][_0x442260(0x110)]['errors']++;}}for(const _0x5654bd of _0x46d2de){try{const _0xd94485=await yamlIntegrationToApi(_0x5654bd[_0x442260(0xa6)],_0x3fa6a9,_0xc6ed31),_0x380363=await this[_0x442260(0xea)][_0x442260(0x10b)](_0xd94485);_0x10cb01[_0x442260(0x104)][_0x442260(0x1ac)]({'name':_0x5654bd[_0x442260(0xa6)]['service_type'],'action':_0x442260(0x1af),'id':_0x380363['id']}),_0x10cb01[_0x442260(0xec)][_0x442260(0x104)][_0x442260(0x1af)]++;}catch(_0x268eb0){_0x10cb01[_0x442260(0x104)][_0x442260(0x1ac)]({'name':_0x5654bd['yaml']['service_type'],'action':_0x442260(0x196),'error':_0x268eb0[_0x442260(0xa3)]}),_0x10cb01['counts'][_0x442260(0x104)][_0x442260(0xf6)]++;}}for(const _0x422c79 of _0x375c39){try{const _0x432c4e=await yamlFormInterfaceToApi(_0x422c79[_0x442260(0xa6)],_0x3fa6a9,_0xc6ed31);if(!_0x432c4e){_0x10cb01[_0x442260(0x11b)]['push']({'name':_0x422c79['yaml'][_0x442260(0x12b)],'action':_0x442260(0x196),'error':_0x442260(0x17a)}),_0x10cb01[_0x442260(0xec)][_0x442260(0x11b)][_0x442260(0xf6)]++;continue;}const _0x59f6ed=await this[_0x442260(0xea)][_0x442260(0x18a)](_0x432c4e);_0x10cb01['formInterfaces'][_0x442260(0x1ac)]({'name':_0x422c79['yaml'][_0x442260(0x12b)],'action':_0x442260(0x1af),'id':_0x59f6ed['id']}),_0x10cb01[_0x442260(0xec)][_0x442260(0x11b)][_0x442260(0x1af)]++;}catch(_0xae59ad){_0x10cb01[_0x442260(0x11b)]['push']({'name':_0x422c79[_0x442260(0xa6)][_0x442260(0x12b)],'action':_0x442260(0x196),'error':_0xae59ad[_0x442260(0xa3)]}),_0x10cb01[_0x442260(0xec)]['formInterfaces'][_0x442260(0xf6)]++;}}for(const _0x4e9008 of _0x128c36){try{const _0x5345c5=await yamlChatInterfaceToApi(_0x4e9008[_0x442260(0xa6)],_0x3fa6a9,_0xc6ed31),_0x1ae9bb=await this[_0x442260(0xea)][_0x442260(0xe6)](_0x5345c5);_0x10cb01['chatInterfaces']['push']({'name':_0x4e9008[_0x442260(0xa6)]['name'],'action':_0x442260(0x1af),'id':_0x1ae9bb['id']}),_0x10cb01[_0x442260(0xec)][_0x442260(0x135)][_0x442260(0x1af)]++;}catch(_0x5aba79){_0x10cb01[_0x442260(0x135)][_0x442260(0x1ac)]({'name':_0x4e9008['yaml'][_0x442260(0x12b)],'action':_0x442260(0x196),'error':_0x5aba79['message']}),_0x10cb01[_0x442260(0xec)][_0x442260(0x135)][_0x442260(0xf6)]++;}}return _0x10cb01;}}function a134_0x5ef0(){const _0x503c76=['continueChat','llm_project','prompts.json','agent.yml\x20not\x20found\x20in\x20','updateFormInterface','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','NOT_FOUND','cloneProject','tdDatabaseName','file_name','(dry-run)','webSearchTools','createChatInterface','code','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','Unable\x20to\x20create\x20project\x20after\x20','client','pullProject','counts','service_type','LLM_PROJECT_NOT_FOUND','profile','\x0a---\x20schema:\x20','listToolTargets','statSync','listIntegrations','restoreProject','\x20in\x20project\x20','errors','Unsupported\x20backup\x20version:\x20','dryRun','starterMessage','sort','knowledgebases.json','384FEoFBp','listPrompts','56SHKBMB','agent.yml','dry-run-','new','experimental_artifacts','Project\x20not\x20found:\x20','integrations','Agent\x20not\x20found:\x20','createPrompt','AGENT_NOT_FOUND','#\x20prompt.md\x0a','updateAgentResponse','INVALID_ARGUMENT','createIntegration','Agent\x20\x27','projectId','length','files','prompts','jsonSchemaHint','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','_reasoning_','serviceType','721088CsYtTR','set','updateExperimentalKnowledgeBase','listAgentsFull','Project\x20\x22','setDefaultAgent','formInterfaces','resolveProjectId','listExperimentalKnowledgeBases','createExperimentalArtifact','.md','getDefaultProjectName','6050336MHcLTl','Unresolved\x20dependencies:\x20','Renamed\x20experimental\x20KB\x20directory:\x20','updateExperimentalArtifact','getProject','filter','context','has','medium','chat_interfaces','name','exportedFrom','\x0a---\x20function:\x20','\x0a---\x20code\x20---\x0a','high','readdirSync','listAgents','listFormInterfaces','join','getBackupMetadata','chatInterfaces','text','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','writeFileSync','isFile','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','actions','nameToId','toLowerCase','resolveProjectName','listChatInterfaces','updatePrompt','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.','listTextKnowledgeBases','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','createImageGenerator','\x20---\x0a','none','getCurrentProject','existsSync','code.js','path','ALREADY_EXISTS','agents.json','utf-8','unchanged','add','find','currentProjectId','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','94932CwxfBB','getDefaultAgent','Multiple\x20projects\x20found\x20with\x20name\x20\x27','loadJsonFile','target','image_gen','36EoKsmg','starter_message','systemPrompt','attributes','setCurrentProject','prompt.md','Agent\x20reference\x20not\x20found','promptId','json_schema','project.json','Renamed\x20folder:\x20','tools','endsWith','Output\x20directory\x20already\x20exists:\x20','modelType','agent','models','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','13803950JEJWnm','includes','Skipping\x20integration\x20\x27','listWebSearchTools','createProject','isDir','localeCompare','conflict','json_schema.json','\x0a\x0a#\x20agent.yml\x0a','type','94518mOMMRA','createKnowledgeBase','slackMessageMode','Could\x20not\x20resolve\x20agent\x20reference','map','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','18540psMMWi','info','total','reasoningEffort','mkdirSync','dirname','listProjects','Renamed\x20agent\x20folder:\x20','already\x20exists','getOrCreateDefaultProject','unlinkSync','basename','resolveAgentId','createFormInterface','deleteAgent','startChat','text_content','agentId','webhookCorsOrigins','isManaged','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','status','createExperimentalKnowledgeBase','Renamed\x20experimental\x20artifact\x20directory:\x20','claude-4.5-sonnet','error','deleteIntegration','readFileSync','chatId','listKnowledgeBases','duplicate','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','dir','tdx.json','chat_generic','Multiple\x20agents\x20found\x20with\x20name\x20\x27','listChats','warn','INTERNAL','sdk.llm','tdx_','oldPath','Removed\x20deleted\x20file:\x20','form_interfaces','agents','Only\x20safe\x20types\x20(','textKnowledgeBases','push','pushAgent','imageGenerators','created','PERMISSION_DENIED','knowledge_bases','createWebSearchTool','chatWelcomeMessage','chat','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','renamed','get','parse','integrations.json','deleteProject','some','Backup\x20folder\x20not\x20found:\x20','message','history','functions','yaml','8298297KICxUz','knowledgeBases','projectName','createAgentResponse','KnowledgeBase','---\x20schema:\x20','pushProject','):\x20','TextKnowledgeBase','action','listExperimentalArtifacts','Renamed\x20KB\x20file:\x20','createAgent','updateTextKnowledgeBase','temperature','experimentalArtifacts','.yml','getChatLog','description','metadata','Renamed\x20chat\x20interface\x20file:\x20','chat_agent_console','stringify','minimal',')\x20can\x20be\x20cloned.','cwd','updateAgent','\x20→\x20','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','site','Removed\x20deleted\x20directory:\x20','logger','isDirectory','backupProject','experimentalKnowledgeBases','getOrCreateDefaultAgent','\x20attempts\x20due\x20to\x20name\x20conflicts.','UNAUTHENTICATED','agentsFull','updated','starter_message.md','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','web_search','def','version','getChatHistory','chats','getAgent','createTextKnowledgeBase','experimental_knowledge_bases','---\x20file:\x20'];a134_0x5ef0=function(){return _0x503c76;};return a134_0x5ef0();}