@treasuredata/tdx 2026.7.2 → 2026.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.d.ts.map +1 -1
  10. package/dist/commands/auth-command.js +1 -1
  11. package/dist/commands/auth-command.js.map +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.d.ts.map +1 -1
  16. package/dist/commands/claude-command.js +1 -1
  17. package/dist/commands/claude-command.js.map +1 -1
  18. package/dist/commands/claude-statusline-command.js +1 -1
  19. package/dist/commands/claude-usage-command.js +1 -1
  20. package/dist/commands/command.js +1 -1
  21. package/dist/commands/connection-command.js +1 -1
  22. package/dist/commands/databases.js +1 -1
  23. package/dist/commands/delivery-command.js +1 -1
  24. package/dist/commands/describe.js +1 -1
  25. package/dist/commands/engage-campaign-pull-command.js +1 -1
  26. package/dist/commands/engage-campaign-push-command.js +1 -1
  27. package/dist/commands/engage-campaign-validate-command.js +1 -1
  28. package/dist/commands/engage-command.js +1 -1
  29. package/dist/commands/engage-template-pull-command.js +1 -1
  30. package/dist/commands/engage-template-push-command.js +1 -1
  31. package/dist/commands/engage-template-validate-command.js +1 -1
  32. package/dist/commands/job-command.js +1 -1
  33. package/dist/commands/journey-command.js +1 -1
  34. package/dist/commands/journey-validate-command.js +1 -1
  35. package/dist/commands/llm-command.js +1 -1
  36. package/dist/commands/mcp-command.js +1 -1
  37. package/dist/commands/parent-segment-command.js +1 -1
  38. package/dist/commands/policy-command.js +1 -1
  39. package/dist/commands/profile-command.js +1 -1
  40. package/dist/commands/profiles-command.js +1 -1
  41. package/dist/commands/query-command.js +1 -1
  42. package/dist/commands/schedule-command.js +1 -1
  43. package/dist/commands/segment-command.js +1 -1
  44. package/dist/commands/segment-create-command.js +1 -1
  45. package/dist/commands/segment-fields-command.js +1 -1
  46. package/dist/commands/segment-move-command.js +1 -1
  47. package/dist/commands/segment-pull-command.js +1 -1
  48. package/dist/commands/segment-push-command.js +1 -1
  49. package/dist/commands/segment-update-command.js +1 -1
  50. package/dist/commands/segment-use-command.js +1 -1
  51. package/dist/commands/segment-validate-command.js +1 -1
  52. package/dist/commands/segments.js +1 -1
  53. package/dist/commands/show.js +1 -1
  54. package/dist/commands/status-command.js +1 -1
  55. package/dist/commands/table-deleted.js +1 -1
  56. package/dist/commands/tables.js +1 -1
  57. package/dist/commands/unset-command.js +1 -1
  58. package/dist/commands/upgrade-command.js +1 -1
  59. package/dist/commands/use-command.js +1 -1
  60. package/dist/commands/user-command.js +1 -1
  61. package/dist/commands/work-command.js +1 -1
  62. package/dist/commands/workflow-command.js +1 -1
  63. package/dist/core/auth.js +1 -1
  64. package/dist/core/command-output.js +1 -1
  65. package/dist/core/config.js +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.d.ts +11 -2
  73. package/dist/core/oauth.d.ts.map +1 -1
  74. package/dist/core/oauth.js +1 -1
  75. package/dist/core/oauth.js.map +1 -1
  76. package/dist/core/profile.js +1 -1
  77. package/dist/core/project-config.js +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.js +1 -1
  86. package/dist/mcp/tools/work-create-item.js +1 -1
  87. package/dist/mcp/utils.js +1 -1
  88. package/dist/proxy/claude-usage-tracker.js +1 -1
  89. package/dist/proxy/passthrough-server.d.ts +16 -0
  90. package/dist/proxy/passthrough-server.d.ts.map +1 -1
  91. package/dist/proxy/passthrough-server.js +1 -1
  92. package/dist/proxy/passthrough-server.js.map +1 -1
  93. package/dist/proxy/sse-usage-parser.js +1 -1
  94. package/dist/sdk/agent/agent-config.js +1 -1
  95. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  96. package/dist/sdk/agent/agent-yaml.js +1 -1
  97. package/dist/sdk/agent/test/evaluator.js +1 -1
  98. package/dist/sdk/agent/test/executor.js +1 -1
  99. package/dist/sdk/agent/test/index.js +1 -1
  100. package/dist/sdk/agent/test/output.js +1 -1
  101. package/dist/sdk/agent/test/parser.js +1 -1
  102. package/dist/sdk/agent/tool-target-registry.js +1 -1
  103. package/dist/sdk/api.js +1 -1
  104. package/dist/sdk/cas/cas-api-client.js +1 -1
  105. package/dist/sdk/cas/cas-audience-schema.js +1 -1
  106. package/dist/sdk/cas/cas-audience-validator.js +1 -1
  107. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  108. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  109. package/dist/sdk/cas/index.js +1 -1
  110. package/dist/sdk/cas/pull-workflow.js +1 -1
  111. package/dist/sdk/cas/push-workflow.js +1 -1
  112. package/dist/sdk/cas/validate-files.js +1 -1
  113. package/dist/sdk/client/cdp-api-client.js +1 -1
  114. package/dist/sdk/client/delivery-api-client.js +1 -1
  115. package/dist/sdk/client/endpoints.js +1 -1
  116. package/dist/sdk/client/engage-api-client.js +1 -1
  117. package/dist/sdk/client/http-client.js +1 -1
  118. package/dist/sdk/client/llm-api-client.js +1 -1
  119. package/dist/sdk/client/oauth-refresh.d.ts +5 -1
  120. package/dist/sdk/client/oauth-refresh.d.ts.map +1 -1
  121. package/dist/sdk/client/oauth-refresh.js +1 -1
  122. package/dist/sdk/client/oauth-refresh.js.map +1 -1
  123. package/dist/sdk/client/rate-limiter.js +1 -1
  124. package/dist/sdk/client/td-api-client.js +1 -1
  125. package/dist/sdk/client/trino-api-client.js +1 -1
  126. package/dist/sdk/client/workflow-client.js +1 -1
  127. package/dist/sdk/connection-validator.js +1 -1
  128. package/dist/sdk/connection.js +1 -1
  129. package/dist/sdk/delivery.js +1 -1
  130. package/dist/sdk/engage/campaign-pull.js +1 -1
  131. package/dist/sdk/engage/campaign-push.js +1 -1
  132. package/dist/sdk/engage/campaign-validator.js +1 -1
  133. package/dist/sdk/engage/campaign-yaml.js +1 -1
  134. package/dist/sdk/engage/template-pull.js +1 -1
  135. package/dist/sdk/engage/template-push.js +1 -1
  136. package/dist/sdk/engage/template-validator.js +1 -1
  137. package/dist/sdk/engage/template-yaml.js +1 -1
  138. package/dist/sdk/engage/types/campaign-def.js +1 -1
  139. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  140. package/dist/sdk/engage/types/template-schema.js +1 -1
  141. package/dist/sdk/engage.js +1 -1
  142. package/dist/sdk/errors.js +1 -1
  143. package/dist/sdk/index.js +1 -1
  144. package/dist/sdk/io/index.js +1 -1
  145. package/dist/sdk/io/node-filesystem.js +1 -1
  146. package/dist/sdk/job.js +1 -1
  147. package/dist/sdk/journey.js +1 -1
  148. package/dist/sdk/llm/chat-cache.js +1 -1
  149. package/dist/sdk/llm/index.js +1 -1
  150. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  151. package/dist/sdk/llm/model-factors.js +1 -1
  152. package/dist/sdk/llm/user-settings.js +1 -1
  153. package/dist/sdk/personalization.js +1 -1
  154. package/dist/sdk/policy.js +1 -1
  155. package/dist/sdk/query/deleted-table-validation.js +1 -1
  156. package/dist/sdk/query/index.js +1 -1
  157. package/dist/sdk/query/sql-parser.js +1 -1
  158. package/dist/sdk/realtime.js +1 -1
  159. package/dist/sdk/schedule.js +1 -1
  160. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  161. package/dist/sdk/segment/fields-display.js +1 -1
  162. package/dist/sdk/segment/file-discovery.js +1 -1
  163. package/dist/sdk/segment/journey-utils.js +1 -1
  164. package/dist/sdk/segment/journey-validator.js +1 -1
  165. package/dist/sdk/segment/journey-yaml.js +1 -1
  166. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  167. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  168. package/dist/sdk/segment/pull-workflow.js +1 -1
  169. package/dist/sdk/segment/push-recovery.js +1 -1
  170. package/dist/sdk/segment/push-workflow.js +1 -1
  171. package/dist/sdk/segment/resolution-context.js +1 -1
  172. package/dist/sdk/segment/segment-path-parser.js +1 -1
  173. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  174. package/dist/sdk/segment/segment-validator.js +1 -1
  175. package/dist/sdk/segment/target-resolution.js +1 -1
  176. package/dist/sdk/segment/tdx-config.js +1 -1
  177. package/dist/sdk/segment/types/activation-schema.js +1 -1
  178. package/dist/sdk/segment/types/journey-def.js +1 -1
  179. package/dist/sdk/segment/types/journey-schema.js +1 -1
  180. package/dist/sdk/segment/types/segment-def.js +1 -1
  181. package/dist/sdk/segment/types/segment-schema.js +1 -1
  182. package/dist/sdk/segment/validate-files.js +1 -1
  183. package/dist/sdk/segment/yaml-validator.js +1 -1
  184. package/dist/sdk/segment.js +1 -1
  185. package/dist/sdk/types/index.js +1 -1
  186. package/dist/sdk/types/progress.js +1 -1
  187. package/dist/sdk/types/workspace.js +1 -1
  188. package/dist/sdk/user.js +1 -1
  189. package/dist/sdk/util/format-detector.js +1 -1
  190. package/dist/sdk/util/formatters.js +1 -1
  191. package/dist/sdk/util/index.js +1 -1
  192. package/dist/sdk/util/paginate.js +1 -1
  193. package/dist/sdk/util/tree-formatter.js +1 -1
  194. package/dist/sdk/util/tree-search.js +1 -1
  195. package/dist/sdk/workflow/archive-validation.js +1 -1
  196. package/dist/sdk/workflow/clone-workflow.js +1 -1
  197. package/dist/sdk/workflow/index.js +1 -1
  198. package/dist/sdk/workflow/pull-workflow.js +1 -1
  199. package/dist/sdk/workflow/push-workflow.js +1 -1
  200. package/dist/sdk/workflow/task-graph.js +1 -1
  201. package/dist/sdk/workflow/tdx-config.js +1 -1
  202. package/dist/sdk/workflow/workflow-utils.js +1 -1
  203. package/dist/sdk/workspace/access-tracker.js +1 -1
  204. package/dist/sdk/workspace/frontmatter.js +1 -1
  205. package/dist/sdk/workspace/git.js +1 -1
  206. package/dist/sdk/workspace/index.js +1 -1
  207. package/dist/sdk/workspace/templates.js +1 -1
  208. package/dist/sdk/workspace/weekly.js +1 -1
  209. package/dist/sdk/workspace/wikilinks.js +1 -1
  210. package/dist/test-utils/command-runner.js +1 -1
  211. package/dist/test-utils/factories.js +1 -1
  212. package/dist/test-utils/fixtures.js +1 -1
  213. package/dist/test-utils/http-mock.js +1 -1
  214. package/dist/test-utils/index.js +1 -1
  215. package/dist/utils/async.js +1 -1
  216. package/dist/utils/colors.js +1 -1
  217. package/dist/utils/diff.js +1 -1
  218. package/dist/utils/file-permissions.js +1 -1
  219. package/dist/utils/file-reader.js +1 -1
  220. package/dist/utils/github-releases.js +1 -1
  221. package/dist/utils/global-cache.js +1 -1
  222. package/dist/utils/json-loader.js +1 -1
  223. package/dist/utils/local-cache.js +1 -1
  224. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  225. package/dist/utils/logger/formatters/index.js +1 -1
  226. package/dist/utils/logger/handlers/console-handler.js +1 -1
  227. package/dist/utils/logger/handlers/file-handler.js +1 -1
  228. package/dist/utils/logger/handlers/index.js +1 -1
  229. package/dist/utils/logger/handlers/null-handler.js +1 -1
  230. package/dist/utils/logger/index.js +1 -1
  231. package/dist/utils/logger/logger.js +1 -1
  232. package/dist/utils/logger/types.js +1 -1
  233. package/dist/utils/option-validation.js +1 -1
  234. package/dist/utils/process.js +1 -1
  235. package/dist/utils/prompt.js +1 -1
  236. package/dist/utils/proxy-fetch.d.ts +29 -0
  237. package/dist/utils/proxy-fetch.d.ts.map +1 -0
  238. package/dist/utils/proxy-fetch.js +1 -0
  239. package/dist/utils/proxy-fetch.js.map +1 -0
  240. package/dist/utils/spinner.js +1 -1
  241. package/dist/utils/sse-parser.js +1 -1
  242. package/dist/utils/string-utils.js +1 -1
  243. package/dist/utils/table-ref-parser.js +1 -1
  244. package/dist/utils/tdx-logger.js +1 -1
  245. package/dist/utils/version-check.js +1 -1
  246. package/package.json +1 -1
@@ -1 +1 @@
1
- const a138_0x3b91f2=a138_0x30ab;(function(_0x2681cc,_0x5be5bc){const _0x2247bc=a138_0x30ab,_0x144670=_0x2681cc();while(!![]){try{const _0x192a45=-parseInt(_0x2247bc(0xaf))/0x1+-parseInt(_0x2247bc(0xd6))/0x2+-parseInt(_0x2247bc(0x84))/0x3*(-parseInt(_0x2247bc(0x8b))/0x4)+-parseInt(_0x2247bc(0x117))/0x5+parseInt(_0x2247bc(0x15c))/0x6*(parseInt(_0x2247bc(0xce))/0x7)+parseInt(_0x2247bc(0x98))/0x8+parseInt(_0x2247bc(0x8e))/0x9;if(_0x192a45===_0x5be5bc)break;else _0x144670['push'](_0x144670['shift']());}catch(_0x40d14c){_0x144670['push'](_0x144670['shift']());}}}(a138_0x4d9b,0xa446a));import{LLMApiClient}from'../client/llm-api-client.js';function a138_0x30ab(_0x1bd1b2,_0x336f4c){_0x1bd1b2=_0x1bd1b2-0x7b;const _0x4d9b89=a138_0x4d9b();let _0x30ab55=_0x4d9b89[_0x1bd1b2];return _0x30ab55;}import*as a138_0x3989b2 from'node:fs';import*as a138_0x1b85f8 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';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';function a138_0x4d9b(){const _0x3b91db=['dry-run-','modelType','code.js','Project\x20not\x20found:\x20','Unsupported\x20backup\x20version:\x20','starterMessage','toISOString','listProjects','low','\x22\x20already\x20exists','listPrompts','---\x20schema:\x20','Agent\x20not\x20found:\x20','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','nameToId','dir','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','dryRun','code','profile','endsWith','agents.json','projectId','target','agentId','file_name','\x0a\x0a#\x20agent.yml\x0a','push','\x0a---\x20function:\x20','#\x20prompt.md\x0a','sdk.llm','starter_message','action','.md','readFileSync','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','createFormInterface','medium','description','startChat','cwd','Renamed\x20experimental\x20KB\x20directory:\x20','path','dirname','keys','INTERNAL','created','prompts','updatePrompt','6384655vzppmc','unlinkSync','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','readdirSync','setDefaultAgent','updateExperimentalKnowledgeBase','createKnowledgeBase','agent.yml\x20not\x20found\x20in\x20','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','Project\x20\x22','Agent\x20reference\x20not\x20found','some','listWebSearchTools','map','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','tdDatabaseName','isDirectory','starter_message.md','updateChatInterface','jsonSchemaHint','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','isManaged','version','promptId','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','add','chatIgnoreManagedActions','listExperimentalKnowledgeBases','formInterfaces','Renamed\x20text\x20KB\x20file:\x20','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','Available\x20agents:\x20','yaml','listKnowledgeBases','logger','metadata','chat_interfaces','total','.yml','web_search','duplicate','resolveAgentId','Multiple\x20projects\x20found\x20with\x20name\x20\x27','---\x20file:\x20','name','minimal','chatInfo','basename','knowledgebases.json','Only\x20safe\x20types\x20(','project','createChatInterface','serviceType','listChatInterfaces','attributes','imageGenerators','message','listTextKnowledgeBases','\x20---\x0a','filter','writeFileSync','Renamed\x20chat\x20interface\x20file:\x20','createPrompt','text','updateTextKnowledgeBase','stringify','agent.yml','updateAgent','listChats','30384ZKLEXF','def','updateAgentResponse','projectName','Renamed\x20folder:\x20','get','project.json','prompt.md','webSearchTools','template','\x20attempts\x20due\x20to\x20name\x20conflicts.','statSync','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.','functions','knowledge_bases','size','status','pushAgent',')\x20can\x20be\x20pushed.\x20','listAgents','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','temperature',')\x20can\x20be\x20cloned.','join','error','systemPrompt','ExperimentalKnowledgeBase','files','):\x20','loadJsonFile','actions','\x20in\x20project\x20','new','TextKnowledgeBase','createProject','agentsFull','INVALID_ARGUMENT','NOT_FOUND','counts','experimental_knowledge_bases','LLM_PROJECT_NOT_FOUND','Removed\x20deleted\x20file:\x20','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','Invalid\x20agent\x20reference\x20format:\x20','isFile','pullProject','chat_parent_segment','experimentalArtifacts','clearDefaultAgent','createIntegration','existsSync','updateFormInterface','getAgent','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','exportedFrom','length','getCurrentProject','deleteProject','service_type','listToolTargets','Renamed\x20agent\x20folder:\x20','signal','projects','parse','textKnowledgeBases','Renamed\x20experimental\x20artifact\x20directory:\x20','knowledgeBases','getOrCreateDefaultProject','createTextKnowledgeBase','has','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','Output\x20directory\x20already\x20exists:\x20','getDefaultAgent','currentProjectId','errors','1410jNoafS','form_interfaces','type','conflict','info','getDefaultProjectName','agents','4652CwCMQf','Could\x20not\x20resolve\x20agent\x20reference','integrations','6854499tBYApu','chat','\x0a---\x20code\x20---\x0a','history','localeCompare','getProject','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','listFormInterfaces','createExperimentalKnowledgeBase','listAgentsFull','8675352fbJVzn','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','text_content','outputs','\x27\x20(','UNAUTHENTICATED','rmSync','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','getUserSettings','mkdirSync','listImageGenerators','PERMISSION_DENIED','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','getChatInfo','includes','listIntegrations','tdx_','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','toLowerCase','image_gen','json_schema.json','resolveProjectName','integrations.json','911806vZdSWL','content','oldPath','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','renamed','continueChat','deleteAgent','prompts.json','none','context','pullAgent','reasoningEffort','chatInterfaces','llm_project','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','\x0a---\x20schema:\x20','(dry-run)','experimental_artifacts','listExperimentalArtifacts','\x20→\x20','getBackupMetadata','createAgent','tools','resolveProjectId','experimentalKnowledgeBases','sort','utf-8','updated','restoreProject','getOrCreateDefaultAgent','tdx.json','1148LPZsaR','variables','isDir','set','site','agent','event','Skipping\x20integration\x20\x27','723050OhoAqP','ALREADY_EXISTS','pushProject','idToName','client','createAgentResponse','newProjectId','find','json_schema','getChatLog','warn','unchanged','maxToolIterations','high','createExperimentalArtifact','Unresolved\x20dependencies:\x20'];a138_0x4d9b=function(){return _0x3b91db;};return a138_0x4d9b();}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=['chat_generic','chat_agent_console',a138_0x3b91f2(0x18a)];async function safeListOrEmpty(_0xf9b425){const _0x1beff4=a138_0x3b91f2;try{return await _0xf9b425();}catch(_0x48a27f){if(_0x48a27f instanceof HTTPClientError&&_0x48a27f[_0x1beff4(0x16c)]===0x194)return[];throw _0x48a27f;}}export class LLMSDK{[a138_0x3b91f2(0x82)];[a138_0x3b91f2(0xda)];['context'];[a138_0x3b91f2(0x139)]=Logger['of'](a138_0x3b91f2(0x104));constructor(_0x4afa87){const _0xa0eabd=a138_0x3b91f2;this[_0xa0eabd(0xda)]=new LLMApiClient(_0x4afa87),this[_0xa0eabd(0xb8)]=_0x4afa87;}[a138_0x3b91f2(0x89)](){const _0x400e89=getSanitizedUsername();return'tdx_default_'+_0x400e89;}async['setCurrentProject'](_0x561f8){const _0x14db28=a138_0x3b91f2,{projectId:_0x1259a2}=await this[_0x14db28(0xad)](_0x561f8);this[_0x14db28(0x82)]=_0x1259a2;}[a138_0x3b91f2(0x194)](){const _0xd5666b=a138_0x3b91f2;return this[_0xd5666b(0x82)];}async[a138_0x3b91f2(0x11b)](_0x2d28ae){const _0xfbe55a=a138_0x3b91f2,_0x3dbce1=this[_0xfbe55a(0xb8)][_0xfbe55a(0xf9)];let _0x37b127,_0x23c2db;if(_0x2d28ae[_0xfbe55a(0xa6)]('/')){const _0x178acc=_0x2d28ae['split']('/');if(_0x178acc['length']!==0x2)throw new SDKError(ErrorCode[_0xfbe55a(0x180)],_0xfbe55a(0x187)+_0x2d28ae,undefined,{'helpText':_0xfbe55a(0xbd)});const [_0x368152,_0x1c287f]=_0x178acc;_0x37b127=await this[_0xfbe55a(0xc6)](_0x368152),_0x23c2db=_0x1c287f;}else _0x37b127=this[_0xfbe55a(0x82)]||(await this[_0xfbe55a(0x7c)]())['id'],_0x23c2db=_0x2d28ae;const _0x29200=await this[_0xfbe55a(0x140)](_0x23c2db,_0x37b127),_0x4b148b=await this[_0xfbe55a(0xda)]['getAgent'](_0x29200);writeCachedLLMAgent(_0x4b148b[_0xfbe55a(0x14d)]['name'],_0x29200,_0x37b127,_0x3dbce1);}[a138_0x3b91f2(0x81)](){const _0x5d61a8=a138_0x3b91f2,_0x33b569=this[_0x5d61a8(0xb8)][_0x5d61a8(0xf9)];return readCachedLLMAgent(_0x33b569)||undefined;}[a138_0x3b91f2(0x18c)](){const _0x32e462=a138_0x3b91f2,_0x142a2c=this['context'][_0x32e462(0xf9)];clearCachedLLMAgent(_0x142a2c);}async['models'](){const _0x412bb2=a138_0x3b91f2,_0x2f82cf=await this[_0x412bb2(0xda)][_0x412bb2(0xa0)]();return toModelInfos(_0x2f82cf);}async[a138_0x3b91f2(0x17e)](_0x1a848a){const _0x30090a=a138_0x3b91f2;return await this['client'][_0x30090a(0x17e)](_0x1a848a);}async[a138_0x3b91f2(0x195)](_0x372968){const _0x557f6f=a138_0x3b91f2,{projectId:_0x2dd8ce}=await this[_0x557f6f(0xad)](_0x372968);await this[_0x557f6f(0xda)][_0x557f6f(0x195)](_0x2dd8ce);}async[a138_0x3b91f2(0x19a)](_0x4baacf=0x32){const _0x3d4665=a138_0x3b91f2;return await this[_0x3d4665(0xda)]['listProjects'](_0x4baacf);}async['getOrCreateDefaultProject'](_0x4cd416){const _0x4f1eff=a138_0x3b91f2,_0x4c6453=_0x4cd416||this[_0x4f1eff(0x89)](),_0x25562e=this[_0x4f1eff(0xb8)][_0x4f1eff(0xf9)];if(!_0x4cd416){const _0x539664=readCachedLLMProject(_0x25562e);if(_0x539664&&_0x539664[_0x4f1eff(0x143)]===_0x4c6453)try{const _0x3614e9=await this['client'][_0x4f1eff(0x93)](_0x539664['id']);if(_0x3614e9[_0x4f1eff(0x14d)]['name']===_0x4c6453)return _0x3614e9;}catch{}}const _0x25657e=await this[_0x4f1eff(0xda)][_0x4f1eff(0xed)](),_0x5a399b=_0x25657e[_0x4f1eff(0xdd)](_0x5e4fc3=>_0x5e4fc3['attributes'][_0x4f1eff(0x143)]===_0x4c6453);if(_0x5a399b)return!_0x4cd416&&writeCachedLLMProject(_0x4c6453,_0x5a399b['id'],_0x25562e),_0x5a399b;const _0x130600=await this[_0x4f1eff(0xda)]['createProject']({'name':_0x4c6453,'description':_0x4f1eff(0x9f)+getSanitizedUsername()+')'});return!_0x4cd416&&writeCachedLLMProject(_0x4c6453,_0x130600['id'],_0x25562e),_0x130600;}async[a138_0x3b91f2(0xc6)](_0x2eff09){const _0x522064=a138_0x3b91f2,_0x5b10c6=await this['client'][_0x522064(0xed)](),_0x597ce5=_0x5b10c6[_0x522064(0x152)](_0x409222=>_0x409222['attributes']['name']===_0x2eff09);if(_0x597ce5[_0x522064(0x193)]===0x0)throw new SDKError(ErrorCode[_0x522064(0x184)],_0x522064(0xe9)+_0x2eff09,undefined,{'helpText':_0x522064(0x11f)});if(_0x597ce5['length']>0x1)throw new SDKError(ErrorCode[_0x522064(0x113)],_0x522064(0x141)+_0x2eff09+'\x27.\x20This\x20should\x20not\x20happen.');return _0x597ce5[0x0]['id'];}async[a138_0x3b91f2(0xad)](_0x26a6d2){const _0x13794d=a138_0x3b91f2,_0x2f7cea=await this['client']['listProjects'](),_0x1997cd=_0x2f7cea[_0x13794d(0xdd)](_0x1d943f=>_0x1d943f[_0x13794d(0x14d)][_0x13794d(0x143)]===_0x26a6d2);if(_0x1997cd)return{'projectId':_0x1997cd['id'],'project':_0x1997cd};throw new SDKError(ErrorCode[_0x13794d(0x184)],'Project\x20not\x20found:\x20'+_0x26a6d2,undefined,{'helpText':_0x13794d(0x11f)});}async[a138_0x3b91f2(0xcc)](_0x4c7563='claude-4.5-sonnet',_0x394ede=0x0,_0x2ce2c2){const _0xf6c87e=a138_0x3b91f2,_0x977090=0xa;let _0x2f1690=0x0,_0x2e8e2e;while(_0x2f1690<_0x977090){try{const _0x23517b=await this['getOrCreateDefaultProject'](_0x2e8e2e),_0x58ff0e=_0x23517b['id'],_0x4718e1=[_0xf6c87e(0xb7),_0xf6c87e(0x144),_0xf6c87e(0xee),_0xf6c87e(0x10b),_0xf6c87e(0xe3)],_0x282743=_0x394ede===0x0?_0xf6c87e(0xa8)+_0x4c7563:'tdx_'+_0x4c7563+'_reasoning_'+_0x4718e1[_0x394ede],_0x2187ff=await this[_0xf6c87e(0xda)][_0xf6c87e(0x16f)](_0x58ff0e),_0x41f009=_0x2187ff['find'](_0x50ee1e=>_0x50ee1e[_0xf6c87e(0x14d)]['name']===_0x282743);if(_0x41f009)return _0x41f009;const _0x5a59bb=_0x394ede>0x0?0x1:_0x2ce2c2;return await this['client'][_0xf6c87e(0xc4)]({'name':_0x282743,'projectId':_0x58ff0e,'modelType':_0x4c7563,'systemPrompt':'','temperature':_0x5a59bb,'reasoningEffort':_0x394ede>0x0?_0x394ede:undefined});}catch(_0x1bd8b3){if(_0x1bd8b3 instanceof HTTPClientError){const _0x747612=_0x1bd8b3[_0xf6c87e(0x16c)];if(_0x747612>=0x190&&_0x747612<0x1f4){if(_0x747612===0x191)throw new SDKError(ErrorCode[_0xf6c87e(0x9d)],_0xf6c87e(0x12f),_0x1bd8b3);else{if(_0x747612===0x193)throw new SDKError(ErrorCode[_0xf6c87e(0xa3)],_0xf6c87e(0x135),_0x1bd8b3);}throw _0x1bd8b3;}}if(errorContains(_0x1bd8b3,'already\x20exists',_0xf6c87e(0x13f),_0xf6c87e(0x87))){_0x2f1690++;if(_0x2f1690>=_0x977090)throw new SDKError(ErrorCode[_0xf6c87e(0xd7)],'Unable\x20to\x20create\x20project\x20after\x20'+_0x977090+_0xf6c87e(0x166),_0x1bd8b3);const _0x3de185=this[_0xf6c87e(0x89)]();_0x2e8e2e=_0x3de185+'_'+generateRandomHex();continue;}throw _0x1bd8b3;}}throw new SDKError(ErrorCode[_0xf6c87e(0x113)],_0xf6c87e(0xa9));}async['resolveAgentId'](_0x5ac330,_0x392acd){const _0x4a570b=a138_0x3b91f2,_0xf5be1b=_0x392acd||this[_0x4a570b(0x82)],_0x7c6ac3=await this[_0x4a570b(0xda)]['listAgents'](_0xf5be1b),_0x55cbeb=_0x7c6ac3[_0x4a570b(0x152)](_0x4cc14d=>_0x4cc14d['attributes'][_0x4a570b(0x143)]===_0x5ac330);if(_0x55cbeb[_0x4a570b(0x193)]===0x0){const _0xd7d4d9=_0xf5be1b?_0x4a570b(0x17b)+_0xf5be1b:'';throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x4a570b(0xf2)+_0x5ac330+_0xd7d4d9,undefined,{'helpText':_0xf5be1b?_0x4a570b(0x186):_0x4a570b(0x168)});}if(_0x55cbeb['length']>0x1)throw new SDKError(ErrorCode[_0x4a570b(0x113)],'Multiple\x20agents\x20found\x20with\x20name\x20\x27'+_0x5ac330+'\x27.\x20This\x20should\x20not\x20happen.');return _0x55cbeb[0x0]['id'];}async[a138_0x3b91f2(0x8a)](_0x383715){const _0x3ecde5=a138_0x3b91f2,_0xb88fd1=_0x383715||this['currentProjectId'];return await this['client'][_0x3ecde5(0x16f)](_0xb88fd1);}async[a138_0x3b91f2(0x17f)](_0x52ce9b){const _0x6e8bdc=a138_0x3b91f2;return await this['client'][_0x6e8bdc(0x97)](_0x52ce9b);}async[a138_0x3b91f2(0xd3)](_0x317a0f){const _0xaef342=a138_0x3b91f2;return await this[_0xaef342(0xda)][_0xaef342(0x190)](_0x317a0f);}async[a138_0x3b91f2(0xc4)](_0x2c0872){const _0x39d7df=a138_0x3b91f2;return await this[_0x39d7df(0xda)][_0x39d7df(0xc4)](_0x2c0872);}async[a138_0x3b91f2(0x15a)](_0xe74c,_0x3ce599){const _0x5c1910=a138_0x3b91f2;return await this[_0x5c1910(0xda)]['updateAgent'](_0xe74c,_0x3ce599);}async[a138_0x3b91f2(0xb5)](_0x4c0a09){const _0x130543=a138_0x3b91f2;await this[_0x130543(0xda)]['deleteAgent'](_0x4c0a09);}async['startChat'](_0x481ff0){const _0x59d83b=a138_0x3b91f2;return await this[_0x59d83b(0xda)]['startChat']({'agentId':_0x481ff0});}async*[a138_0x3b91f2(0x8f)](_0xf6f891,_0x13b741){const _0x268fe4=a138_0x3b91f2;let _0x4a044c=_0x13b741?.['chatId'];const _0x440768=_0x13b741?.['agentId'];if(!_0x4a044c){if(!_0x440768)throw new Error(_0x268fe4(0x170));const _0x2d5135=await this[_0x268fe4(0xda)][_0x268fe4(0x10d)]({'agentId':_0x440768});_0x4a044c=_0x2d5135['id'],yield{'type':_0x268fe4(0x13a),'data':{'chatId':_0x4a044c,'agentId':_0x440768,'projectId':_0x2d5135[_0x268fe4(0x14d)][_0x268fe4(0xfc)]}};}for await(const _0x3ee654 of this[_0x268fe4(0xda)][_0x268fe4(0xb4)](_0x4a044c,_0xf6f891,_0x13b741?.[_0x268fe4(0x199)])){yield{'type':_0x268fe4(0xd4),'data':_0x3ee654};}}async['chats'](_0xe801b8=0x32){const _0x302412=a138_0x3b91f2;return await this['client'][_0x302412(0x15b)](_0xe801b8);}async[a138_0x3b91f2(0x91)](_0x10677e){return await this['client']['getChatHistory'](_0x10677e);}async[a138_0x3b91f2(0xdf)](_0x50f61c){const _0x38d13c=a138_0x3b91f2;return await this[_0x38d13c(0xda)][_0x38d13c(0xdf)](_0x50f61c);}async[a138_0x3b91f2(0x145)](_0x4c2ad1){const _0x59f334=a138_0x3b91f2;return await this[_0x59f334(0xda)][_0x59f334(0xa5)](_0x4c2ad1);}async['backupProject'](_0x370325,_0x1fc4c8,_0x2f7996){const _0x1535d7=a138_0x3b91f2,_0x3b2304=_0x2f7996?.[_0x1535d7(0xf7)]??![],{projectId:_0x5d1b38,project:_0x27158d}=await this[_0x1535d7(0xad)](_0x370325),_0x50fdd8=_0x27158d[_0x1535d7(0x14d)][_0x1535d7(0x143)],_0x2cc7a8=_0x1fc4c8||_0x50fdd8+'.llm';if(a138_0x3989b2[_0x1535d7(0x18e)](_0x2cc7a8)&&!_0x3b2304)throw new SDKError(ErrorCode[_0x1535d7(0xd7)],_0x1535d7(0x80)+_0x2cc7a8,undefined,{'helpText':_0x1535d7(0xb2)});const _0x236ddf=await this[_0x1535d7(0xda)][_0x1535d7(0x97)](_0x5d1b38),_0x4a5ac8=await this[_0x1535d7(0xda)][_0x1535d7(0x138)](_0x5d1b38),_0x2c0e11=await this[_0x1535d7(0xda)]['listPrompts'](_0x5d1b38),_0x163ccc=await this['client'][_0x1535d7(0xa7)](_0x5d1b38);if(!_0x3b2304){a138_0x3989b2[_0x1535d7(0xa1)](_0x2cc7a8,{'recursive':!![]});const _0x14ebc9={'version':'1.0','exportedAt':new Date()[_0x1535d7(0xec)](),'exportedFrom':{'site':this['context'][_0x1535d7(0xd2)],'projectId':_0x5d1b38,'projectName':_0x50fdd8},'project':_0x27158d};a138_0x3989b2[_0x1535d7(0x153)](a138_0x1b85f8['join'](_0x2cc7a8,_0x1535d7(0x162)),JSON['stringify'](_0x14ebc9,null,0x2)),a138_0x3989b2['writeFileSync'](a138_0x1b85f8[_0x1535d7(0x173)](_0x2cc7a8,_0x1535d7(0xfb)),JSON[_0x1535d7(0x158)](_0x236ddf,null,0x2)),a138_0x3989b2[_0x1535d7(0x153)](a138_0x1b85f8[_0x1535d7(0x173)](_0x2cc7a8,_0x1535d7(0x147)),JSON['stringify'](_0x4a5ac8,null,0x2)),a138_0x3989b2['writeFileSync'](a138_0x1b85f8['join'](_0x2cc7a8,_0x1535d7(0xb6)),JSON['stringify'](_0x2c0e11,null,0x2)),a138_0x3989b2[_0x1535d7(0x153)](a138_0x1b85f8[_0x1535d7(0x173)](_0x2cc7a8,_0x1535d7(0xae)),JSON[_0x1535d7(0x158)](_0x163ccc,null,0x2));}return{'projectName':_0x50fdd8,'outputDir':_0x2cc7a8,'counts':{'agents':_0x236ddf[_0x1535d7(0x193)],'knowledgeBases':_0x4a5ac8[_0x1535d7(0x193)],'prompts':_0x2c0e11[_0x1535d7(0x193)],'integrations':_0x163ccc['length']}};}async[a138_0x3b91f2(0xcb)](_0x2d6a2a,_0x390826){const _0x4fce88=a138_0x3b91f2,_0xab3385=_0x390826?.[_0x4fce88(0xf7)]??![],_0x27ce1f=this[_0x4fce88(0xc3)](_0x2d6a2a),_0x3d3437=_0x27ce1f[_0x4fce88(0x192)][_0x4fce88(0xd2)],_0x2a534a=this[_0x4fce88(0xb8)][_0x4fce88(0xd2)],_0x2d1d95=_0x3d3437!==_0x2a534a?_0x3d3437:undefined,_0x4c5d8c=this['loadJsonFile'](a138_0x1b85f8[_0x4fce88(0x173)](_0x2d6a2a,'agents.json'),[]),_0x53594e=this[_0x4fce88(0x179)](a138_0x1b85f8[_0x4fce88(0x173)](_0x2d6a2a,_0x4fce88(0x147)),[]),_0x16d8da=this[_0x4fce88(0x179)](a138_0x1b85f8['join'](_0x2d6a2a,_0x4fce88(0xb6)),[]),_0x3728d3=this[_0x4fce88(0x179)](a138_0x1b85f8[_0x4fce88(0x173)](_0x2d6a2a,_0x4fce88(0xae)),[]),_0x4cc57e=_0x390826?.[_0x4fce88(0x143)]||_0x27ce1f[_0x4fce88(0x192)][_0x4fce88(0x15f)];if(_0xab3385){const _0x5201e6=new Map(),_0x53c6d1=[..._0x4c5d8c],_0x442722=_0x4c5d8c[_0x4fce88(0x193)]+0x1;let _0x3d4ded=0x0;while(_0x53c6d1[_0x4fce88(0x193)]>0x0&&_0x3d4ded<_0x442722){_0x3d4ded++;const _0x13155b=[];for(const _0x10ea8c of _0x53c6d1){canCreateAgent(_0x10ea8c,_0x5201e6)?_0x5201e6[_0x4fce88(0xd1)](_0x10ea8c['id'],_0x4fce88(0xe6)+_0x10ea8c['id']):_0x13155b[_0x4fce88(0x101)](_0x10ea8c);}if(_0x13155b['length']===_0x53c6d1[_0x4fce88(0x193)])throw new SDKError(ErrorCode[_0x4fce88(0x113)],_0x4fce88(0x94),undefined,{'helpText':_0x4fce88(0x109)});_0x53c6d1[_0x4fce88(0x193)]=0x0,_0x53c6d1[_0x4fce88(0x101)](..._0x13155b);}const _0x3cf7f6=_0x16d8da[_0x4fce88(0x152)](_0x1a5cbd=>_0x5201e6[_0x4fce88(0x7e)](_0x1a5cbd[_0x4fce88(0x14d)][_0x4fce88(0xfe)]))[_0x4fce88(0x193)];return{'projectName':_0x4cc57e,'projectId':_0x4fce88(0xbf),'counts':{'agents':_0x4c5d8c[_0x4fce88(0x193)],'knowledgeBases':_0x53594e['length'],'prompts':_0x3cf7f6,'integrations':_0x3728d3[_0x4fce88(0x193)]},'sourceSite':_0x2d1d95};}const _0xf4020e=await this[_0x4fce88(0xda)][_0x4fce88(0x17e)]({'name':_0x4cc57e,'description':_0x27ce1f[_0x4fce88(0x149)]['attributes'][_0x4fce88(0x10c)]}),_0x877a0=_0xf4020e['id'],_0x167102=new Map(),_0x447c66=new Map(),_0x325c91=new Map();for(const _0x474d87 of _0x53594e){const _0x105325=await this[_0x4fce88(0xda)][_0x4fce88(0x11d)]({'projectId':_0x877a0,'name':_0x474d87[_0x4fce88(0x14d)][_0x4fce88(0x143)],'tdDatabaseName':_0x474d87[_0x4fce88(0x14d)][_0x4fce88(0x126)],'tables':_0x474d87['attributes']['tables']});_0x167102[_0x4fce88(0xd1)](_0x474d87['id'],_0x105325['id']);}const _0x429f98=[..._0x4c5d8c],_0x3ac658=_0x4c5d8c[_0x4fce88(0x193)]+0x1;let _0x42c925=0x0;while(_0x429f98[_0x4fce88(0x193)]>0x0&&_0x42c925<_0x3ac658){_0x42c925++;const _0x15a6a1=[];for(const _0x5e7906 of _0x429f98){if(canCreateAgent(_0x5e7906,_0x447c66)){const _0x479f4f=remapToolIds(_0x5e7906[_0x4fce88(0x14d)][_0x4fce88(0xc5)],_0x167102,_0x447c66),_0x3acbe0=remapVariableIds(_0x5e7906['attributes'][_0x4fce88(0xcf)],_0x167102),_0x9d9139=await this[_0x4fce88(0xda)][_0x4fce88(0xdb)]({'name':_0x5e7906['attributes'][_0x4fce88(0x143)],'projectId':_0x877a0,'systemPrompt':_0x5e7906[_0x4fce88(0x14d)][_0x4fce88(0x175)],'starterMessage':_0x5e7906[_0x4fce88(0x14d)][_0x4fce88(0xeb)],'modelType':migrateModelType(_0x5e7906[_0x4fce88(0x14d)][_0x4fce88(0xe7)]),'maxToolIterations':_0x5e7906[_0x4fce88(0x14d)][_0x4fce88(0xe2)],'temperature':_0x5e7906['attributes'][_0x4fce88(0x171)],'reasoningEffort':_0x5e7906['attributes'][_0x4fce88(0xba)],'outputs':_0x5e7906[_0x4fce88(0x14d)][_0x4fce88(0x9b)],'tools':_0x479f4f,'variables':_0x3acbe0});_0x447c66[_0x4fce88(0xd1)](_0x5e7906['id'],_0x9d9139['id']);}else _0x15a6a1[_0x4fce88(0x101)](_0x5e7906);}if(_0x15a6a1[_0x4fce88(0x193)]===_0x429f98[_0x4fce88(0x193)])throw new SDKError(ErrorCode['INTERNAL'],_0x4fce88(0x94),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x429f98[_0x4fce88(0x193)]=0x0,_0x429f98[_0x4fce88(0x101)](..._0x15a6a1);}for(const _0x392bb8 of _0x16d8da){const _0x46f4d3=_0x447c66[_0x4fce88(0x161)](_0x392bb8[_0x4fce88(0x14d)][_0x4fce88(0xfe)]);if(!_0x46f4d3)continue;const _0x5d7ba1=await this[_0x4fce88(0xda)][_0x4fce88(0x155)]({'projectId':_0x877a0,'agentId':_0x46f4d3,'name':_0x392bb8[_0x4fce88(0x14d)]['name'],'systemPrompt':_0x392bb8[_0x4fce88(0x14d)]['systemPrompt'],'template':_0x392bb8[_0x4fce88(0x14d)][_0x4fce88(0x165)],'jsonSchemaHint':_0x392bb8[_0x4fce88(0x14d)][_0x4fce88(0x12a)]});_0x325c91['set'](_0x392bb8['id'],_0x5d7ba1['id']);}for(const _0x3de448 of _0x3728d3){const _0x4d6cc8=_0x3de448[_0x4fce88(0x14d)][_0x4fce88(0x17a)][_0x4fce88(0x124)](_0x4d4746=>({..._0x4d4746,'promptId':_0x325c91[_0x4fce88(0x161)](_0x4d4746[_0x4fce88(0x12e)])||_0x4d4746[_0x4fce88(0x12e)]}));await this['client'][_0x4fce88(0x18d)]({'projectId':_0x877a0,'serviceType':_0x3de448['attributes'][_0x4fce88(0x14b)],'actions':_0x4d6cc8,'slackMessageMode':_0x3de448['attributes']['slackMessageMode'],'chatIgnoreManagedActions':_0x3de448[_0x4fce88(0x14d)][_0x4fce88(0x131)],'chatWelcomeMessage':_0x3de448[_0x4fce88(0x14d)]['chatWelcomeMessage'],'webhookCorsOrigins':_0x3de448['attributes']['webhookCorsOrigins']});}return{'projectName':_0x4cc57e,'projectId':_0x877a0,'counts':{'agents':_0x447c66[_0x4fce88(0x16b)],'knowledgeBases':_0x167102['size'],'prompts':_0x325c91[_0x4fce88(0x16b)],'integrations':_0x3728d3[_0x4fce88(0x193)]},'sourceSite':_0x2d1d95};}[a138_0x3b91f2(0x179)](_0x155cf7,_0x26eba4){const _0xbde8e4=a138_0x3b91f2;if(!a138_0x3989b2[_0xbde8e4(0x18e)](_0x155cf7))return _0x26eba4;return JSON[_0xbde8e4(0x19b)](a138_0x3989b2[_0xbde8e4(0x108)](_0x155cf7,'utf-8'));}[a138_0x3b91f2(0xc3)](_0x39be94){const _0x227947=a138_0x3b91f2;if(!a138_0x3989b2['existsSync'](_0x39be94))throw new SDKError(ErrorCode[_0x227947(0x181)],'Backup\x20folder\x20not\x20found:\x20'+_0x39be94,undefined,{'helpText':_0x227947(0xf3)});const _0x2c72da=a138_0x1b85f8[_0x227947(0x173)](_0x39be94,_0x227947(0x162));if(!a138_0x3989b2[_0x227947(0x18e)](_0x2c72da))throw new SDKError(ErrorCode[_0x227947(0x180)],_0x227947(0x119)+_0x39be94,undefined,{'helpText':_0x227947(0x191)});const _0x3788e7=JSON[_0x227947(0x19b)](a138_0x3989b2['readFileSync'](_0x2c72da,_0x227947(0xc9)));if(!isSupportedBackupVersion(_0x3788e7[_0x227947(0x12d)]))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x227947(0xea)+_0x3788e7['version'],undefined,{'helpText':_0x227947(0xa4)});return _0x3788e7;}async[a138_0x3b91f2(0x189)](_0x23237a,_0x5a4584,_0x126881){const _0xdfd191=a138_0x3b91f2,{projectId:_0x5efc1e,project:_0x28bb9c}=await this['resolveProjectName'](_0x23237a),_0x55d1d7=_0x28bb9c['attributes'][_0xdfd191(0x143)];let _0x469054;if(_0x5a4584)_0x469054=_0x5a4584;else{const _0x4bc2db=a138_0x1b85f8[_0xdfd191(0x173)](process[_0xdfd191(0x10e)](),_0xdfd191(0x8a)),_0x13d1b5=getSanitizedPathWithMigration(_0x4bc2db,_0x55d1d7);_0x13d1b5['renamed']&&this['logger'][_0xdfd191(0x88)](_0xdfd191(0x160)+a138_0x1b85f8[_0xdfd191(0x146)](_0x13d1b5['oldPath'])+_0xdfd191(0xc2)+a138_0x1b85f8[_0xdfd191(0x146)](_0x13d1b5['path'])),_0x469054=_0x13d1b5[_0xdfd191(0x110)];}const _0x15b01d=await this[_0xdfd191(0xda)][_0xdfd191(0x97)](_0x5efc1e),_0x5eaf89=await this[_0xdfd191(0xda)][_0xdfd191(0x138)](_0x5efc1e),_0x39a05d=await this[_0xdfd191(0xda)][_0xdfd191(0x150)](_0x5efc1e),_0x4d87bc=await safeListOrEmpty(()=>this[_0xdfd191(0xda)][_0xdfd191(0xa2)](_0x5efc1e)),_0x32eeb6=await safeListOrEmpty(()=>this[_0xdfd191(0xda)][_0xdfd191(0x123)](_0x5efc1e)),_0x24e63b=await this[_0xdfd191(0xda)]['listPrompts'](_0x5efc1e),_0x4a67d=await this['client'][_0xdfd191(0xa7)](_0x5efc1e),_0x31012c=await safeListOrEmpty(()=>this['client'][_0xdfd191(0x132)](_0x5efc1e)),_0x4d9af5=await safeListOrEmpty(()=>this[_0xdfd191(0xda)]['listExperimentalArtifacts'](_0x5efc1e)),_0x224216=await safeListOrEmpty(()=>this[_0xdfd191(0xda)][_0xdfd191(0x95)](_0x5efc1e)),_0x3140ca=await safeListOrEmpty(()=>this[_0xdfd191(0xda)][_0xdfd191(0x14c)](_0x5efc1e)),_0x2e8fd3=_0x4a67d[_0xdfd191(0x152)](_0x39f3cc=>!_0x39f3cc['attributes']['isManaged']&&SAFE_INTEGRATION_TYPES[_0xdfd191(0xa6)](_0x39f3cc['attributes'][_0xdfd191(0x14b)]['toLowerCase']())),_0x1bbcdb=new Map(),_0x578114=new Map(),_0x57d1d=new Map(),_0x276f88=new Map(),_0x1d4193=new Map(),_0x42c822=new Map(),_0x27e6c9=new Map();for(const _0x466354 of _0x15b01d){_0x1bbcdb[_0xdfd191(0xd1)](_0x466354['id'],_0x466354['attributes']['name']);}for(const _0x409838 of _0x5eaf89){_0x578114[_0xdfd191(0xd1)](_0x409838['id'],_0x409838[_0xdfd191(0x14d)][_0xdfd191(0x143)]);}for(const _0x43d42e of _0x39a05d){_0x57d1d[_0xdfd191(0xd1)](_0x43d42e['id'],_0x43d42e[_0xdfd191(0x14d)][_0xdfd191(0x143)]);}for(const _0x5d26ee of _0x4d87bc){_0x276f88[_0xdfd191(0xd1)](_0x5d26ee['id'],_0x5d26ee[_0xdfd191(0x14d)][_0xdfd191(0x143)]);}for(const _0x285a43 of _0x32eeb6){_0x1d4193[_0xdfd191(0xd1)](_0x285a43['id'],_0x285a43[_0xdfd191(0x14d)][_0xdfd191(0x143)]);}for(const _0x2a41dc of _0x24e63b){_0x42c822['set'](_0x2a41dc['id'],_0x2a41dc[_0xdfd191(0x14d)][_0xdfd191(0x143)]);}for(const _0x1c838f of _0x31012c){_0x27e6c9[_0xdfd191(0xd1)](_0x1c838f['id'],_0x1c838f['attributes']['name']);}const _0x32534f={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x578114,'TextKnowledgeBase':_0x57d1d,'Agent':_0x1bbcdb,'WebSearchTool':_0x1d4193,'ImageGenerator':_0x276f88,'ExperimentalKnowledgeBase':_0x27e6c9}),'resolvePromptName':async _0x5af472=>_0x42c822[_0xdfd191(0x161)](_0x5af472),'onWarning':_0x42ef92=>this[_0xdfd191(0x139)][_0xdfd191(0xe0)](_0x42ef92)},_0x63f6be={'projectName':_0x55d1d7,'outputDir':_0x469054,'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}}},_0x5b2358=[],_0x500fda=[];for(const _0x266eba of _0x15b01d){const _0x4d881f=getSanitizedPathWithMigration(_0x469054,_0x266eba['attributes']['name']);_0x4d881f['renamed']&&this[_0xdfd191(0x139)]['info'](_0xdfd191(0x198)+a138_0x1b85f8[_0xdfd191(0x146)](_0x4d881f['oldPath'])+_0xdfd191(0xc2)+a138_0x1b85f8[_0xdfd191(0x146)](_0x4d881f[_0xdfd191(0x110)]));const _0x16096a=_0x4d881f[_0xdfd191(0x110)],_0x1d31b2=a138_0x1b85f8[_0xdfd191(0x173)](_0x16096a,_0xdfd191(0x163)),_0x4589c6=a138_0x1b85f8['join'](_0x16096a,_0xdfd191(0x159)),_0x18b089=a138_0x1b85f8['join'](_0x16096a,_0xdfd191(0x128)),{yaml:_0x4d57eb,systemPrompt:_0x32fbd1,starterMessage:_0x3961bb}=await agentResponseToDef(_0x266eba,_0x32534f),_0x31bb59=toAgentYamlString(_0x4d57eb),_0x1e0118=!a138_0x3989b2[_0xdfd191(0x18e)](_0x4589c6);let _0x20a4f0=_0x1e0118,_0x3c3351;if(!_0x1e0118){const _0x465a37=a138_0x3989b2[_0xdfd191(0x18e)](_0x1d31b2)?a138_0x3989b2[_0xdfd191(0x108)](_0x1d31b2,'utf-8'):'',_0x49dc5d=a138_0x3989b2[_0xdfd191(0x108)](_0x4589c6,_0xdfd191(0xc9)),_0x5f364d=_0xdfd191(0x103)+_0x465a37+_0xdfd191(0x100)+_0x49dc5d,_0x38b9b0=_0xdfd191(0x103)+_0x32fbd1+_0xdfd191(0x100)+_0x31bb59,_0x5580c3=generateDiff(_0x5f364d,_0x38b9b0);_0x20a4f0=hasChanges(_0x5580c3),_0x20a4f0&&(_0x3c3351=formatDiffWithColors(_0x5580c3));}_0x5b2358[_0xdfd191(0x101)]({'path':_0x16096a,'content':'','isDir':!![]}),_0x5b2358[_0xdfd191(0x101)]({'path':_0x1d31b2,'content':_0x32fbd1}),_0x5b2358[_0xdfd191(0x101)]({'path':_0x4589c6,'content':_0x31bb59});_0x3961bb&&_0x3961bb[_0xdfd191(0xa6)]('\x0a')&&_0x5b2358[_0xdfd191(0x101)]({'path':_0x18b089,'content':_0x3961bb});_0x63f6be['agents'][_0xdfd191(0x101)]({'agentName':_0x266eba[_0xdfd191(0x14d)][_0xdfd191(0x143)],'outputPath':_0x16096a,'isNew':_0x1e0118,'hasChanges':_0x20a4f0,'diff':_0x3c3351}),_0x63f6be[_0xdfd191(0x182)][_0xdfd191(0x8a)][_0xdfd191(0x13c)]++;if(_0x1e0118)_0x63f6be[_0xdfd191(0x182)]['agents'][_0xdfd191(0x17c)]++;else{if(_0x20a4f0)_0x63f6be[_0xdfd191(0x182)]['agents'][_0xdfd191(0xca)]++;else _0x63f6be[_0xdfd191(0x182)][_0xdfd191(0x8a)]['unchanged']++;}}for(const _0x24116b of _0x5eaf89){if(_0x24116b[_0xdfd191(0x14d)]['isManaged'])continue;const _0x455f6d=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x469054),_0x24116b[_0xdfd191(0x14d)]['name'],_0xdfd191(0x13d));_0x455f6d[_0xdfd191(0xb3)]&&this[_0xdfd191(0x139)][_0xdfd191(0x88)]('Renamed\x20KB\x20file:\x20'+a138_0x1b85f8[_0xdfd191(0x146)](_0x455f6d[_0xdfd191(0xb1)])+'\x20→\x20'+a138_0x1b85f8[_0xdfd191(0x146)](_0x455f6d[_0xdfd191(0x110)]));const _0x1d284d=_0x455f6d[_0xdfd191(0x110)],_0x3e944e=apiKnowledgeBaseToYaml(_0x24116b),_0x56435a=toKnowledgeBaseYamlString(_0x3e944e),_0x55fcc0=!a138_0x3989b2[_0xdfd191(0x18e)](_0x1d284d);let _0x7cc3fb=_0x55fcc0,_0x3592ee;if(!_0x55fcc0){const _0x517642=a138_0x3989b2[_0xdfd191(0x108)](_0x1d284d,_0xdfd191(0xc9)),_0x88a914=generateDiff(_0x517642,_0x56435a);_0x7cc3fb=hasChanges(_0x88a914),_0x7cc3fb&&(_0x3592ee=formatDiffWithColors(_0x88a914));}_0x5b2358['push']({'path':_0x1d284d,'content':_0x56435a}),_0x63f6be[_0xdfd191(0x7b)][_0xdfd191(0x101)]({'name':_0x24116b['attributes']['name'],'outputPath':_0x1d284d,'isNew':_0x55fcc0,'hasChanges':_0x7cc3fb,'diff':_0x3592ee}),_0x63f6be[_0xdfd191(0x182)]['knowledgeBases'][_0xdfd191(0x13c)]++;if(_0x55fcc0)_0x63f6be['counts']['knowledgeBases'][_0xdfd191(0x17c)]++;else{if(_0x7cc3fb)_0x63f6be['counts']['knowledgeBases'][_0xdfd191(0xca)]++;else _0x63f6be['counts']['knowledgeBases'][_0xdfd191(0xe1)]++;}}for(const _0x510e7e of _0x39a05d){if(_0x510e7e[_0xdfd191(0x14d)][_0xdfd191(0x12c)])continue;const _0x196696=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x469054),_0x510e7e['attributes'][_0xdfd191(0x143)],'.md');_0x196696[_0xdfd191(0xb3)]&&this[_0xdfd191(0x139)]['info'](_0xdfd191(0x134)+a138_0x1b85f8['basename'](_0x196696[_0xdfd191(0xb1)])+_0xdfd191(0xc2)+a138_0x1b85f8[_0xdfd191(0x146)](_0x196696[_0xdfd191(0x110)]));const _0x526467=_0x196696[_0xdfd191(0x110)],_0x283bc7=toTextKnowledgeBaseMd(_0x510e7e[_0xdfd191(0x14d)][_0xdfd191(0x143)],_0x510e7e['attributes'][_0xdfd191(0x156)]),_0x1bb0e1=!a138_0x3989b2[_0xdfd191(0x18e)](_0x526467);let _0x26ae83=_0x1bb0e1,_0x19a9fc;if(!_0x1bb0e1){const _0x35a3f3=a138_0x3989b2[_0xdfd191(0x108)](_0x526467,_0xdfd191(0xc9)),_0x34fe0b=generateDiff(_0x35a3f3,_0x283bc7);_0x26ae83=hasChanges(_0x34fe0b),_0x26ae83&&(_0x19a9fc=formatDiffWithColors(_0x34fe0b));}_0x5b2358[_0xdfd191(0x101)]({'path':_0x526467,'content':_0x283bc7}),_0x63f6be[_0xdfd191(0x19c)][_0xdfd191(0x101)]({'name':_0x510e7e['attributes'][_0xdfd191(0x143)],'outputPath':_0x526467,'isNew':_0x1bb0e1,'hasChanges':_0x26ae83,'diff':_0x19a9fc}),_0x63f6be[_0xdfd191(0x182)]['textKnowledgeBases']['total']++;if(_0x1bb0e1)_0x63f6be[_0xdfd191(0x182)]['textKnowledgeBases']['new']++;else{if(_0x26ae83)_0x63f6be[_0xdfd191(0x182)][_0xdfd191(0x19c)][_0xdfd191(0xca)]++;else _0x63f6be[_0xdfd191(0x182)]['textKnowledgeBases'][_0xdfd191(0xe1)]++;}}for(const _0x4be909 of _0x24e63b){if(_0x4be909['attributes'][_0xdfd191(0x12c)])continue;const _0x526581=getSanitizedPathWithMigration(getPromptsDir(_0x469054),_0x4be909[_0xdfd191(0x14d)][_0xdfd191(0x143)],_0xdfd191(0x13d));_0x526581[_0xdfd191(0xb3)]&&this[_0xdfd191(0x139)]['info']('Renamed\x20prompt\x20file:\x20'+a138_0x1b85f8['basename'](_0x526581[_0xdfd191(0xb1)])+_0xdfd191(0xc2)+a138_0x1b85f8[_0xdfd191(0x146)](_0x526581[_0xdfd191(0x110)]));const _0x37f998=_0x526581[_0xdfd191(0x110)],_0x5294c9=await apiPromptToYaml(_0x4be909,_0x32534f);if(!_0x5294c9)continue;const _0x4e01b0=toPromptYamlString(_0x5294c9),_0x278fcb=!a138_0x3989b2[_0xdfd191(0x18e)](_0x37f998);let _0xb1d858=_0x278fcb,_0x25eabc;if(!_0x278fcb){const _0x334213=a138_0x3989b2[_0xdfd191(0x108)](_0x37f998,_0xdfd191(0xc9)),_0x56f2d5=generateDiff(_0x334213,_0x4e01b0);_0xb1d858=hasChanges(_0x56f2d5),_0xb1d858&&(_0x25eabc=formatDiffWithColors(_0x56f2d5));}_0x5b2358[_0xdfd191(0x101)]({'path':_0x37f998,'content':_0x4e01b0}),_0x63f6be[_0xdfd191(0x115)][_0xdfd191(0x101)]({'name':_0x4be909[_0xdfd191(0x14d)][_0xdfd191(0x143)],'outputPath':_0x37f998,'isNew':_0x278fcb,'hasChanges':_0xb1d858,'diff':_0x25eabc}),_0x63f6be['counts']['prompts'][_0xdfd191(0x13c)]++;if(_0x278fcb)_0x63f6be['counts'][_0xdfd191(0x115)]['new']++;else{if(_0xb1d858)_0x63f6be[_0xdfd191(0x182)][_0xdfd191(0x115)][_0xdfd191(0xca)]++;else _0x63f6be[_0xdfd191(0x182)][_0xdfd191(0x115)][_0xdfd191(0xe1)]++;}}for(const _0x27e129 of _0x2e8fd3){const _0x35eb4d=_0x27e129[_0xdfd191(0x14d)][_0xdfd191(0x14b)][_0xdfd191(0xaa)](),_0x26c19a=getSanitizedPathWithMigration(getIntegrationsDir(_0x469054),_0x35eb4d,_0xdfd191(0x13d));_0x26c19a['renamed']&&this[_0xdfd191(0x139)][_0xdfd191(0x88)]('Renamed\x20integration\x20file:\x20'+a138_0x1b85f8[_0xdfd191(0x146)](_0x26c19a[_0xdfd191(0xb1)])+_0xdfd191(0xc2)+a138_0x1b85f8[_0xdfd191(0x146)](_0x26c19a[_0xdfd191(0x110)]));const _0x4c5ce8=_0x26c19a[_0xdfd191(0x110)],_0x2dc902=await apiIntegrationToYaml(_0x27e129,_0x32534f),_0x4ad96f=toIntegrationYamlString(_0x2dc902),_0x321b22=!a138_0x3989b2[_0xdfd191(0x18e)](_0x4c5ce8);let _0x2cc464=_0x321b22,_0x18c9bf;if(!_0x321b22){const _0x40394f=a138_0x3989b2[_0xdfd191(0x108)](_0x4c5ce8,_0xdfd191(0xc9)),_0x486c26=generateDiff(_0x40394f,_0x4ad96f);_0x2cc464=hasChanges(_0x486c26),_0x2cc464&&(_0x18c9bf=formatDiffWithColors(_0x486c26));}_0x5b2358[_0xdfd191(0x101)]({'path':_0x4c5ce8,'content':_0x4ad96f}),_0x63f6be[_0xdfd191(0x8d)][_0xdfd191(0x101)]({'name':_0x35eb4d,'outputPath':_0x4c5ce8,'isNew':_0x321b22,'hasChanges':_0x2cc464,'diff':_0x18c9bf}),_0x63f6be[_0xdfd191(0x182)]['integrations'][_0xdfd191(0x13c)]++;if(_0x321b22)_0x63f6be['counts'][_0xdfd191(0x8d)][_0xdfd191(0x17c)]++;else{if(_0x2cc464)_0x63f6be[_0xdfd191(0x182)][_0xdfd191(0x8d)][_0xdfd191(0xca)]++;else _0x63f6be[_0xdfd191(0x182)][_0xdfd191(0x8d)][_0xdfd191(0xe1)]++;}}for(const _0x10bed9 of _0x31012c){if(_0x10bed9[_0xdfd191(0x14d)][_0xdfd191(0x12c)])continue;const _0x56084d=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x469054),_0x10bed9[_0xdfd191(0x14d)][_0xdfd191(0x143)]);_0x56084d[_0xdfd191(0xb3)]&&this[_0xdfd191(0x139)][_0xdfd191(0x88)](_0xdfd191(0x10f)+a138_0x1b85f8['basename'](_0x56084d[_0xdfd191(0xb1)])+'\x20→\x20'+a138_0x1b85f8[_0xdfd191(0x146)](_0x56084d[_0xdfd191(0x110)]));const _0x48dee6=_0x56084d['path'],_0x576538=a138_0x1b85f8[_0xdfd191(0x173)](_0x48dee6,sanitizeForFilesystem(_0x10bed9[_0xdfd191(0x14d)][_0xdfd191(0x143)])+_0xdfd191(0x13d)),_0x5066e9=a138_0x1b85f8[_0xdfd191(0x173)](_0x48dee6,'functions'),_0x391408=apiExperimentalKnowledgeBaseToYaml(_0x10bed9),_0x3ba5c4=toExperimentalKnowledgeBaseYamlString(_0x391408),_0x1e3748=!a138_0x3989b2[_0xdfd191(0x18e)](_0x48dee6);let _0x27a1e4=_0x1e3748,_0x42dc3a,_0x6b4899=_0x3ba5c4;const _0x264aae=[..._0x391408['functions']][_0xdfd191(0xc8)]((_0x294051,_0x25106a)=>_0x294051[_0xdfd191(0x143)][_0xdfd191(0x92)](_0x25106a['name']));for(const _0x1fefa5 of _0x264aae){_0x6b4899+=_0xdfd191(0x102)+_0x1fefa5[_0xdfd191(0x143)]+_0xdfd191(0x151)+_0x1fefa5[_0xdfd191(0xf8)]+_0xdfd191(0xbe)+_0x1fefa5['name']+_0xdfd191(0x151)+_0x1fefa5[_0xdfd191(0xde)]+'\x0a';}if(!_0x1e3748){let _0x4fe318='';a138_0x3989b2[_0xdfd191(0x18e)](_0x576538)&&(_0x4fe318=a138_0x3989b2[_0xdfd191(0x108)](_0x576538,_0xdfd191(0xc9)));if(a138_0x3989b2[_0xdfd191(0x18e)](_0x5066e9)){const _0x814345=a138_0x3989b2[_0xdfd191(0x11a)](_0x5066e9,{'withFileTypes':!![]}),_0x220e6b=_0x814345[_0xdfd191(0x152)](_0x1a6cb0=>_0x1a6cb0[_0xdfd191(0x127)]())[_0xdfd191(0xc8)]((_0x543815,_0x414541)=>_0x543815[_0xdfd191(0x143)]['localeCompare'](_0x414541['name']));for(const _0x2ce2f4 of _0x220e6b){const _0x2c7e1d=a138_0x1b85f8[_0xdfd191(0x173)](_0x5066e9,_0x2ce2f4[_0xdfd191(0x143)],_0xdfd191(0xe8)),_0x492da2=a138_0x1b85f8[_0xdfd191(0x173)](_0x5066e9,_0x2ce2f4[_0xdfd191(0x143)],_0xdfd191(0xac));a138_0x3989b2['existsSync'](_0x2c7e1d)&&(_0x4fe318+=_0xdfd191(0x102)+_0x2ce2f4[_0xdfd191(0x143)]+'\x20---\x0a'+a138_0x3989b2[_0xdfd191(0x108)](_0x2c7e1d,_0xdfd191(0xc9))+'\x0a'),a138_0x3989b2[_0xdfd191(0x18e)](_0x492da2)&&(_0x4fe318+=_0xdfd191(0xf1)+_0x2ce2f4['name']+_0xdfd191(0x151)+a138_0x3989b2[_0xdfd191(0x108)](_0x492da2,_0xdfd191(0xc9))+'\x0a');}}const _0x23652f=generateDiff(_0x4fe318,_0x6b4899);_0x27a1e4=hasChanges(_0x23652f),_0x27a1e4&&(_0x42dc3a=formatDiffWithColors(_0x23652f));}_0x5b2358[_0xdfd191(0x101)]({'path':_0x48dee6,'content':'','isDir':!![]}),_0x5b2358[_0xdfd191(0x101)]({'path':_0x576538,'content':_0x3ba5c4}),_0x5b2358['push']({'path':_0x5066e9,'content':'','isDir':!![]});for(const _0x4c3a81 of _0x391408[_0xdfd191(0x169)]){const _0xa5203=a138_0x1b85f8[_0xdfd191(0x173)](_0x5066e9,sanitizeForFilesystem(_0x4c3a81['name'])),_0x342888=a138_0x1b85f8[_0xdfd191(0x173)](_0xa5203,_0xdfd191(0xe8)),_0x4dd0e4=a138_0x1b85f8[_0xdfd191(0x173)](_0xa5203,_0xdfd191(0xac));_0x5b2358[_0xdfd191(0x101)]({'path':_0xa5203,'content':'','isDir':!![]}),_0x5b2358['push']({'path':_0x342888,'content':_0x4c3a81[_0xdfd191(0xf8)]}),_0x5b2358[_0xdfd191(0x101)]({'path':_0x4dd0e4,'content':_0x4c3a81['json_schema']});}if(a138_0x3989b2[_0xdfd191(0x18e)](_0x5066e9)){const _0x4d8e73=a138_0x3989b2['readdirSync'](_0x5066e9,{'withFileTypes':!![]}),_0x4e9546=new Set(_0x391408[_0xdfd191(0x169)][_0xdfd191(0x124)](_0x1cf7b9=>sanitizeForFilesystem(_0x1cf7b9[_0xdfd191(0x143)])));for(const _0x99c451 of _0x4d8e73){if(_0x99c451[_0xdfd191(0x127)]()&&!_0x4e9546[_0xdfd191(0x7e)](_0x99c451[_0xdfd191(0x143)])){const _0x292d74=a138_0x1b85f8[_0xdfd191(0x173)](_0x5066e9,_0x99c451[_0xdfd191(0x143)]);_0x500fda[_0xdfd191(0x101)]({'path':_0x292d74,'isDir':!![]});}}}_0x63f6be[_0xdfd191(0xc7)]['push']({'name':_0x10bed9[_0xdfd191(0x14d)]['name'],'outputPath':_0x48dee6,'isNew':_0x1e3748,'hasChanges':_0x27a1e4,'diff':_0x42dc3a}),_0x63f6be[_0xdfd191(0x182)]['experimentalKnowledgeBases'][_0xdfd191(0x13c)]++;if(_0x1e3748)_0x63f6be[_0xdfd191(0x182)][_0xdfd191(0xc7)][_0xdfd191(0x17c)]++;else{if(_0x27a1e4)_0x63f6be['counts'][_0xdfd191(0xc7)][_0xdfd191(0xca)]++;else _0x63f6be[_0xdfd191(0x182)][_0xdfd191(0xc7)][_0xdfd191(0xe1)]++;}}for(const _0x509c9a of _0x4d9af5){if(_0x509c9a[_0xdfd191(0x14d)][_0xdfd191(0x12c)])continue;const _0x16875a=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x469054),_0x509c9a[_0xdfd191(0x14d)][_0xdfd191(0x143)]);_0x16875a['renamed']&&this[_0xdfd191(0x139)][_0xdfd191(0x88)](_0xdfd191(0x19d)+a138_0x1b85f8['basename'](_0x16875a['oldPath'])+'\x20→\x20'+a138_0x1b85f8[_0xdfd191(0x146)](_0x16875a['path']));const _0x4794cd=_0x16875a[_0xdfd191(0x110)],_0x1a472c=a138_0x1b85f8[_0xdfd191(0x173)](_0x4794cd,sanitizeForFilesystem(_0x509c9a['attributes']['name'])+_0xdfd191(0x13d)),_0x3656f6=a138_0x1b85f8[_0xdfd191(0x173)](_0x4794cd,_0xdfd191(0xe8)),_0x464b4f=a138_0x1b85f8[_0xdfd191(0x173)](_0x4794cd,_0xdfd191(0x177)),_0x4d74c0=apiExperimentalArtifactToYaml(_0x509c9a),_0x117b6f=toExperimentalArtifactYamlString(_0x4d74c0),_0x2568ed=!a138_0x3989b2[_0xdfd191(0x18e)](_0x4794cd);let _0x4234a7=_0x2568ed,_0x16f026,_0x3cdd24=_0x117b6f+(_0xdfd191(0x90)+_0x4d74c0[_0xdfd191(0xf8)]+'\x0a');const _0x2c9779=[..._0x4d74c0[_0xdfd191(0x177)]]['sort']((_0x3d451e,_0x27b144)=>_0x3d451e[_0xdfd191(0xff)]['localeCompare'](_0x27b144['file_name']));for(const _0x471512 of _0x2c9779){_0x3cdd24+='---\x20file:\x20'+_0x471512['file_name']+_0xdfd191(0x151)+_0x471512[_0xdfd191(0x9a)]+'\x0a';}if(!_0x2568ed){let _0xf21319='';a138_0x3989b2[_0xdfd191(0x18e)](_0x1a472c)&&(_0xf21319=a138_0x3989b2[_0xdfd191(0x108)](_0x1a472c,'utf-8'));a138_0x3989b2['existsSync'](_0x3656f6)&&(_0xf21319+=_0xdfd191(0x90)+a138_0x3989b2[_0xdfd191(0x108)](_0x3656f6,'utf-8')+'\x0a');if(a138_0x3989b2['existsSync'](_0x464b4f)){const _0x598307=a138_0x3989b2['readdirSync'](_0x464b4f),_0x4cb7f4=_0x598307[_0xdfd191(0x152)](_0x335c83=>{const _0x238f9e=_0xdfd191,_0x10b962=a138_0x1b85f8['join'](_0x464b4f,_0x335c83);return a138_0x3989b2[_0x238f9e(0x167)](_0x10b962)[_0x238f9e(0x188)]();})[_0xdfd191(0xc8)]((_0x5a49a7,_0x22d90a)=>_0x5a49a7['localeCompare'](_0x22d90a));for(const _0x39a5de of _0x4cb7f4){const _0x3f3d95=a138_0x1b85f8[_0xdfd191(0x173)](_0x464b4f,_0x39a5de);_0xf21319+=_0xdfd191(0x142)+_0x39a5de+_0xdfd191(0x151)+a138_0x3989b2[_0xdfd191(0x108)](_0x3f3d95,'utf-8')+'\x0a';}}const _0x25da35=generateDiff(_0xf21319,_0x3cdd24);_0x4234a7=hasChanges(_0x25da35),_0x4234a7&&(_0x16f026=formatDiffWithColors(_0x25da35));}_0x5b2358[_0xdfd191(0x101)]({'path':_0x4794cd,'content':'','isDir':!![]}),_0x5b2358[_0xdfd191(0x101)]({'path':_0x1a472c,'content':_0x117b6f}),_0x5b2358['push']({'path':_0x3656f6,'content':_0x4d74c0[_0xdfd191(0xf8)]});if(_0x4d74c0[_0xdfd191(0x177)][_0xdfd191(0x193)]>0x0){_0x5b2358[_0xdfd191(0x101)]({'path':_0x464b4f,'content':'','isDir':!![]});for(const _0x26e692 of _0x4d74c0[_0xdfd191(0x177)]){const _0x32664a=a138_0x1b85f8[_0xdfd191(0x173)](_0x464b4f,_0x26e692[_0xdfd191(0xff)]);_0x5b2358[_0xdfd191(0x101)]({'path':_0x32664a,'content':_0x26e692[_0xdfd191(0x9a)]});}}if(a138_0x3989b2['existsSync'](_0x464b4f)){const _0x13b1d3=a138_0x3989b2[_0xdfd191(0x11a)](_0x464b4f),_0x14ba14=new Set(_0x4d74c0['files'][_0xdfd191(0x124)](_0x5bd343=>_0x5bd343[_0xdfd191(0xff)]));for(const _0x3ca8ca of _0x13b1d3){const _0x99129f=a138_0x1b85f8['join'](_0x464b4f,_0x3ca8ca);a138_0x3989b2['statSync'](_0x99129f)['isFile']()&&!_0x14ba14['has'](_0x3ca8ca)&&_0x500fda[_0xdfd191(0x101)]({'path':_0x99129f});}}_0x63f6be[_0xdfd191(0x18b)]['push']({'name':_0x509c9a['attributes']['name'],'outputPath':_0x4794cd,'isNew':_0x2568ed,'hasChanges':_0x4234a7,'diff':_0x16f026}),_0x63f6be[_0xdfd191(0x182)][_0xdfd191(0x18b)][_0xdfd191(0x13c)]++;if(_0x2568ed)_0x63f6be[_0xdfd191(0x182)][_0xdfd191(0x18b)]['new']++;else{if(_0x4234a7)_0x63f6be['counts'][_0xdfd191(0x18b)][_0xdfd191(0xca)]++;else _0x63f6be[_0xdfd191(0x182)][_0xdfd191(0x18b)][_0xdfd191(0xe1)]++;}}for(const _0x5137b7 of _0x224216){const _0x58faf4=getSanitizedPathWithMigration(getFormInterfacesDir(_0x469054),_0x5137b7[_0xdfd191(0x14d)][_0xdfd191(0x143)],_0xdfd191(0x13d));_0x58faf4['renamed']&&this[_0xdfd191(0x139)][_0xdfd191(0x88)]('Renamed\x20form\x20interface\x20file:\x20'+a138_0x1b85f8[_0xdfd191(0x146)](_0x58faf4[_0xdfd191(0xb1)])+_0xdfd191(0xc2)+a138_0x1b85f8[_0xdfd191(0x146)](_0x58faf4[_0xdfd191(0x110)]));const _0x1b0f73=_0x58faf4['path'],_0x32b3b5=await apiFormInterfaceToYaml(_0x5137b7,_0x32534f),_0x302c84=toFormInterfaceYamlString(_0x32b3b5),_0x5b627a=!a138_0x3989b2[_0xdfd191(0x18e)](_0x1b0f73);let _0x2e3dca=_0x5b627a,_0x5fcf2c;if(!_0x5b627a){const _0x47c682=a138_0x3989b2[_0xdfd191(0x108)](_0x1b0f73,_0xdfd191(0xc9)),_0x3e9e92=generateDiff(_0x47c682,_0x302c84);_0x2e3dca=hasChanges(_0x3e9e92),_0x2e3dca&&(_0x5fcf2c=formatDiffWithColors(_0x3e9e92));}_0x5b2358[_0xdfd191(0x101)]({'path':_0x1b0f73,'content':_0x302c84}),_0x63f6be[_0xdfd191(0x133)][_0xdfd191(0x101)]({'name':_0x5137b7['attributes'][_0xdfd191(0x143)],'outputPath':_0x1b0f73,'isNew':_0x5b627a,'hasChanges':_0x2e3dca,'diff':_0x5fcf2c}),_0x63f6be[_0xdfd191(0x182)][_0xdfd191(0x133)][_0xdfd191(0x13c)]++;if(_0x5b627a)_0x63f6be[_0xdfd191(0x182)][_0xdfd191(0x133)]['new']++;else{if(_0x2e3dca)_0x63f6be[_0xdfd191(0x182)]['formInterfaces'][_0xdfd191(0xca)]++;else _0x63f6be[_0xdfd191(0x182)][_0xdfd191(0x133)]['unchanged']++;}}for(const _0x57edd9 of _0x3140ca){if(_0x57edd9[_0xdfd191(0x14d)][_0xdfd191(0x12c)])continue;const _0x20134a=getSanitizedPathWithMigration(getChatInterfacesDir(_0x469054),_0x57edd9['attributes']['name'],'.yml');_0x20134a['renamed']&&this['logger'][_0xdfd191(0x88)](_0xdfd191(0x154)+a138_0x1b85f8['basename'](_0x20134a[_0xdfd191(0xb1)])+_0xdfd191(0xc2)+a138_0x1b85f8[_0xdfd191(0x146)](_0x20134a[_0xdfd191(0x110)]));const _0x38daee=_0x20134a[_0xdfd191(0x110)],_0x33208a=await apiChatInterfaceToYaml(_0x57edd9,_0x32534f),_0x1e6440=toChatInterfaceYamlString(_0x33208a),_0x34a9af=!a138_0x3989b2[_0xdfd191(0x18e)](_0x38daee);let _0x526bea=_0x34a9af,_0x1d4052;if(!_0x34a9af){const _0x1f1be0=a138_0x3989b2['readFileSync'](_0x38daee,_0xdfd191(0xc9)),_0x393304=generateDiff(_0x1f1be0,_0x1e6440);_0x526bea=hasChanges(_0x393304),_0x526bea&&(_0x1d4052=formatDiffWithColors(_0x393304));}_0x5b2358['push']({'path':_0x38daee,'content':_0x1e6440}),_0x63f6be[_0xdfd191(0xbb)]['push']({'name':_0x57edd9[_0xdfd191(0x14d)][_0xdfd191(0x143)],'outputPath':_0x38daee,'isNew':_0x34a9af,'hasChanges':_0x526bea,'diff':_0x1d4052}),_0x63f6be['counts']['chatInterfaces'][_0xdfd191(0x13c)]++;if(_0x34a9af)_0x63f6be['counts']['chatInterfaces']['new']++;else{if(_0x526bea)_0x63f6be[_0xdfd191(0x182)][_0xdfd191(0xbb)][_0xdfd191(0xca)]++;else _0x63f6be[_0xdfd191(0x182)][_0xdfd191(0xbb)][_0xdfd191(0xe1)]++;}}if(_0x126881?.[_0xdfd191(0xf7)])return _0x63f6be;a138_0x3989b2['mkdirSync'](_0x469054,{'recursive':!![]}),a138_0x3989b2[_0xdfd191(0xa1)](getKnowledgeBasesDir(_0x469054),{'recursive':!![]}),a138_0x3989b2[_0xdfd191(0xa1)](getPromptsDir(_0x469054),{'recursive':!![]}),a138_0x3989b2[_0xdfd191(0xa1)](getIntegrationsDir(_0x469054),{'recursive':!![]}),a138_0x3989b2[_0xdfd191(0xa1)](getExperimentalKnowledgeBasesDir(_0x469054),{'recursive':!![]}),a138_0x3989b2[_0xdfd191(0xa1)](getExperimentalArtifactsDir(_0x469054),{'recursive':!![]}),a138_0x3989b2[_0xdfd191(0xa1)](getFormInterfacesDir(_0x469054),{'recursive':!![]}),a138_0x3989b2[_0xdfd191(0xa1)](getChatInterfacesDir(_0x469054),{'recursive':!![]});const _0x277125=a138_0x1b85f8[_0xdfd191(0x173)](_0x469054,_0xdfd191(0xcd));a138_0x3989b2[_0xdfd191(0x153)](_0x277125,createAgentConfigContent(_0x55d1d7));for(const _0x38ab63 of _0x5b2358){if(_0x38ab63[_0xdfd191(0xd0)])a138_0x3989b2[_0xdfd191(0xa1)](_0x38ab63[_0xdfd191(0x110)],{'recursive':!![]});else{const _0x5be6fe=a138_0x1b85f8[_0xdfd191(0x111)](_0x38ab63[_0xdfd191(0x110)]);!a138_0x3989b2[_0xdfd191(0x18e)](_0x5be6fe)&&a138_0x3989b2[_0xdfd191(0xa1)](_0x5be6fe,{'recursive':!![]}),a138_0x3989b2['writeFileSync'](_0x38ab63[_0xdfd191(0x110)],_0x38ab63[_0xdfd191(0xb0)]);}}for(const _0x1b8535 of _0x500fda){_0x1b8535[_0xdfd191(0xd0)]?(a138_0x3989b2[_0xdfd191(0x9e)](_0x1b8535[_0xdfd191(0x110)],{'recursive':!![],'force':!![]}),this['logger']['info']('Removed\x20deleted\x20directory:\x20'+a138_0x1b85f8[_0xdfd191(0x146)](a138_0x1b85f8[_0xdfd191(0x111)](_0x1b8535[_0xdfd191(0x110)]))+'/'+a138_0x1b85f8['basename'](_0x1b8535[_0xdfd191(0x110)]))):(a138_0x3989b2[_0xdfd191(0x9e)](_0x1b8535[_0xdfd191(0x110)],{'force':!![]}),this[_0xdfd191(0x139)][_0xdfd191(0x88)](_0xdfd191(0x185)+a138_0x1b85f8[_0xdfd191(0x146)](a138_0x1b85f8[_0xdfd191(0x111)](_0x1b8535[_0xdfd191(0x110)]))+'/'+a138_0x1b85f8[_0xdfd191(0x146)](_0x1b8535['path'])));}return _0x63f6be;}async[a138_0x3b91f2(0xd8)](_0x5e7ba5,_0x32dc5e){const _0x38eb8a=a138_0x3b91f2,_0x1f5ef5=a138_0x1b85f8[_0x38eb8a(0x173)](_0x5e7ba5,'tdx.json');if(!a138_0x3989b2[_0x38eb8a(0x18e)](_0x1f5ef5))throw new SDKError(ErrorCode[_0x38eb8a(0x180)],'No\x20tdx.json\x20found\x20in\x20'+_0x5e7ba5,undefined,{'helpText':_0x38eb8a(0x125)});const _0x58fb95=loadAgentConfig(_0x1f5ef5),_0x20bd7d=await this[_0x38eb8a(0xc6)](_0x58fb95[_0x38eb8a(0xbc)]),_0x1a4fe6=await this[_0x38eb8a(0xda)][_0x38eb8a(0x93)](_0x20bd7d),_0x4c4cf8=_0x1a4fe6['attributes']['name'],_0x27eae4={'projectName':_0x4c4cf8,'projectId':_0x20bd7d,'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}}},_0x1e9977=[],_0xd9c967=[],_0x3197d1=[],_0x22019e=[],_0x4f12b7=[],_0x5ded14=[],_0x3e9696=a138_0x3989b2[_0x38eb8a(0x11a)](_0x5e7ba5,{'withFileTypes':!![]});for(const _0x320452 of _0x3e9696){if(!_0x320452[_0x38eb8a(0x127)]())continue;if([_0x38eb8a(0x16a),_0x38eb8a(0x115),_0x38eb8a(0x8d),'experimental_knowledge_bases',_0x38eb8a(0xc0),'form_interfaces','chat_interfaces'][_0x38eb8a(0xa6)](_0x320452[_0x38eb8a(0x143)]))continue;const _0x134139=a138_0x1b85f8['join'](_0x5e7ba5,_0x320452[_0x38eb8a(0x143)]);if(isAgentDir(_0x134139)){const _0x1cb3ca=a138_0x1b85f8[_0x38eb8a(0x173)](_0x134139,_0x38eb8a(0x159)),_0x293f05=a138_0x1b85f8[_0x38eb8a(0x173)](_0x134139,_0x38eb8a(0x163)),_0x3ae86e=a138_0x1b85f8[_0x38eb8a(0x173)](_0x134139,_0x38eb8a(0x128)),_0x4153f3=parseAgentYaml(a138_0x3989b2['readFileSync'](_0x1cb3ca,_0x38eb8a(0xc9)),_0x1cb3ca),_0x4eb511=a138_0x3989b2['existsSync'](_0x293f05)?a138_0x3989b2['readFileSync'](_0x293f05,_0x38eb8a(0xc9)):'',_0x1e9607=a138_0x3989b2[_0x38eb8a(0x18e)](_0x3ae86e)?a138_0x3989b2[_0x38eb8a(0x108)](_0x3ae86e,_0x38eb8a(0xc9)):_0x4153f3[_0x38eb8a(0x105)];_0x1e9977['push']({'name':_0x4153f3[_0x38eb8a(0x143)],'dir':_0x134139,'yaml':_0x4153f3,'systemPrompt':_0x4eb511,'starterMessage':_0x1e9607});}}const _0x686b5d=getKnowledgeBasesDir(_0x5e7ba5);if(a138_0x3989b2[_0x38eb8a(0x18e)](_0x686b5d)){const _0x5a5125=a138_0x3989b2['readdirSync'](_0x686b5d);for(const _0x27be10 of _0x5a5125){const _0x38ad6c=a138_0x1b85f8['join'](_0x686b5d,_0x27be10);if(_0x27be10[_0x38eb8a(0xfa)](_0x38eb8a(0x13d))){const _0x1b8206=parseKnowledgeBaseYaml(a138_0x3989b2[_0x38eb8a(0x108)](_0x38ad6c,_0x38eb8a(0xc9)),_0x38ad6c);_0xd9c967[_0x38eb8a(0x101)]({'name':_0x1b8206[_0x38eb8a(0x143)],'path':_0x38ad6c,'yaml':_0x1b8206});}else{if(_0x27be10[_0x38eb8a(0xfa)]('.md')){const _0x154b8c=a138_0x3989b2[_0x38eb8a(0x108)](_0x38ad6c,_0x38eb8a(0xc9)),{name:_0x3995da,text:_0x2da658}=parseTextKnowledgeBaseMd(_0x154b8c,_0x27be10);_0x3197d1['push']({'name':_0x3995da,'path':_0x38ad6c,'text':_0x2da658});}}}}const _0x9b7b5e=getPromptsDir(_0x5e7ba5);if(a138_0x3989b2[_0x38eb8a(0x18e)](_0x9b7b5e)){const _0x53a6e7=a138_0x3989b2[_0x38eb8a(0x11a)](_0x9b7b5e)[_0x38eb8a(0x152)](_0x28c280=>_0x28c280[_0x38eb8a(0xfa)](_0x38eb8a(0x13d)));for(const _0x3f7159 of _0x53a6e7){const _0x5cc5ef=a138_0x1b85f8[_0x38eb8a(0x173)](_0x9b7b5e,_0x3f7159),_0x5d5e4e=parsePromptYaml(a138_0x3989b2['readFileSync'](_0x5cc5ef,'utf-8'),_0x5cc5ef);_0x22019e['push']({'name':_0x5d5e4e[_0x38eb8a(0x143)],'path':_0x5cc5ef,'yaml':_0x5d5e4e});}}const _0x1cadb6=[],_0x2b42a7=getIntegrationsDir(_0x5e7ba5);if(a138_0x3989b2[_0x38eb8a(0x18e)](_0x2b42a7)){const _0x3bc651=a138_0x3989b2[_0x38eb8a(0x11a)](_0x2b42a7)['filter'](_0x52265d=>_0x52265d['endsWith'](_0x38eb8a(0x13d)));for(const _0x52e0a5 of _0x3bc651){const _0x55c020=a138_0x1b85f8[_0x38eb8a(0x173)](_0x2b42a7,_0x52e0a5),_0x2d8c41=parseIntegrationYaml(a138_0x3989b2[_0x38eb8a(0x108)](_0x55c020,_0x38eb8a(0xc9)),_0x55c020);if(!SAFE_INTEGRATION_TYPES['includes'](_0x2d8c41[_0x38eb8a(0x196)]['toLowerCase']())){this[_0x38eb8a(0x139)]['warn'](_0x38eb8a(0xd5)+_0x2d8c41[_0x38eb8a(0x143)]+_0x38eb8a(0x9c)+_0x2d8c41[_0x38eb8a(0x196)]+_0x38eb8a(0x178)+(_0x38eb8a(0x148)+SAFE_INTEGRATION_TYPES[_0x38eb8a(0x173)](',\x20')+_0x38eb8a(0x16e))+_0x38eb8a(0xf6));continue;}_0x1cadb6['push']({'name':_0x2d8c41[_0x38eb8a(0x143)],'path':_0x55c020,'yaml':_0x2d8c41});}}const _0x373dc8=getExperimentalKnowledgeBasesDir(_0x5e7ba5);if(a138_0x3989b2['existsSync'](_0x373dc8)){const _0x5bd6e0=a138_0x3989b2[_0x38eb8a(0x11a)](_0x373dc8,{'withFileTypes':!![]});for(const _0x136f73 of _0x5bd6e0){if(!_0x136f73[_0x38eb8a(0x127)]())continue;const _0x36f4cc=a138_0x1b85f8['join'](_0x373dc8,_0x136f73[_0x38eb8a(0x143)]),_0x2ad5b8=a138_0x1b85f8[_0x38eb8a(0x173)](_0x36f4cc,_0x136f73['name']+_0x38eb8a(0x13d)),_0xb750b5=a138_0x1b85f8['join'](_0x36f4cc,'functions');if(!a138_0x3989b2['existsSync'](_0x2ad5b8))continue;const _0x4fc9e1=parseExperimentalKnowledgeBaseYaml(a138_0x3989b2[_0x38eb8a(0x108)](_0x2ad5b8,_0x38eb8a(0xc9)),_0x2ad5b8),_0x293387=[];if(a138_0x3989b2['existsSync'](_0xb750b5)){const _0x390cc1=a138_0x3989b2[_0x38eb8a(0x11a)](_0xb750b5,{'withFileTypes':!![]});for(const _0x28b9d8 of _0x390cc1){if(!_0x28b9d8['isDirectory']())continue;const _0x22e814=a138_0x1b85f8['join'](_0xb750b5,_0x28b9d8[_0x38eb8a(0x143)]),_0xc2e19=a138_0x1b85f8['join'](_0x22e814,'code.js'),_0x31bce4=a138_0x1b85f8['join'](_0x22e814,_0x38eb8a(0xac));a138_0x3989b2[_0x38eb8a(0x18e)](_0xc2e19)&&a138_0x3989b2['existsSync'](_0x31bce4)&&_0x293387[_0x38eb8a(0x101)]({'name':_0x28b9d8[_0x38eb8a(0x143)],'code':a138_0x3989b2[_0x38eb8a(0x108)](_0xc2e19,_0x38eb8a(0xc9)),'json_schema':a138_0x3989b2[_0x38eb8a(0x108)](_0x31bce4,'utf-8')});}}const _0x4efe6e={..._0x4fc9e1,'variables':_0x4fc9e1['variables']||[],'functions':_0x293387};_0x4f12b7['push']({'name':_0x4fc9e1[_0x38eb8a(0x143)],'dir':_0x36f4cc,'def':_0x4efe6e});}}const _0x1fa696=getExperimentalArtifactsDir(_0x5e7ba5);if(a138_0x3989b2[_0x38eb8a(0x18e)](_0x1fa696)){const _0x32dc6c=a138_0x3989b2[_0x38eb8a(0x11a)](_0x1fa696,{'withFileTypes':!![]});for(const _0x5c32c9 of _0x32dc6c){if(!_0x5c32c9[_0x38eb8a(0x127)]())continue;const _0x1840c0=a138_0x1b85f8[_0x38eb8a(0x173)](_0x1fa696,_0x5c32c9['name']),_0x53bbb0=a138_0x1b85f8['join'](_0x1840c0,_0x5c32c9[_0x38eb8a(0x143)]+'.yml'),_0x4c4186=a138_0x1b85f8[_0x38eb8a(0x173)](_0x1840c0,_0x38eb8a(0xe8)),_0xc81020=a138_0x1b85f8['join'](_0x1840c0,'files');if(!a138_0x3989b2[_0x38eb8a(0x18e)](_0x53bbb0)||!a138_0x3989b2[_0x38eb8a(0x18e)](_0x4c4186))continue;const _0x45977c=parseExperimentalArtifactYaml(a138_0x3989b2['readFileSync'](_0x53bbb0,_0x38eb8a(0xc9)),_0x53bbb0),_0x17365b=a138_0x3989b2[_0x38eb8a(0x108)](_0x4c4186,'utf-8'),_0x5b3bbf=[];if(a138_0x3989b2[_0x38eb8a(0x18e)](_0xc81020)){const _0x10a8e4=a138_0x3989b2[_0x38eb8a(0x11a)](_0xc81020);for(const _0x3d91a9 of _0x10a8e4){const _0x2381e0=a138_0x1b85f8[_0x38eb8a(0x173)](_0xc81020,_0x3d91a9);a138_0x3989b2[_0x38eb8a(0x167)](_0x2381e0)[_0x38eb8a(0x188)]()&&_0x5b3bbf['push']({'file_name':_0x3d91a9,'text_content':a138_0x3989b2[_0x38eb8a(0x108)](_0x2381e0,_0x38eb8a(0xc9))});}}const _0x39186c={..._0x45977c,'code':_0x17365b,'files':_0x5b3bbf};_0x5ded14[_0x38eb8a(0x101)]({'name':_0x45977c[_0x38eb8a(0x143)],'dir':_0x1840c0,'def':_0x39186c});}}const _0xadcff8=[],_0x2db9df=getFormInterfacesDir(_0x5e7ba5);if(a138_0x3989b2[_0x38eb8a(0x18e)](_0x2db9df)){const _0x164aa7=a138_0x3989b2[_0x38eb8a(0x11a)](_0x2db9df)['filter'](_0x24f3a9=>_0x24f3a9[_0x38eb8a(0xfa)](_0x38eb8a(0x13d)));for(const _0x21886a of _0x164aa7){const _0x23186f=a138_0x1b85f8[_0x38eb8a(0x173)](_0x2db9df,_0x21886a),_0x297698=parseFormInterfaceYaml(a138_0x3989b2[_0x38eb8a(0x108)](_0x23186f,'utf-8'),_0x23186f);_0xadcff8[_0x38eb8a(0x101)]({'name':_0x297698[_0x38eb8a(0x143)],'path':_0x23186f,'yaml':_0x297698});}}const _0x1d8964=[],_0x339068=getChatInterfacesDir(_0x5e7ba5);if(a138_0x3989b2[_0x38eb8a(0x18e)](_0x339068)){const _0x4c618f=a138_0x3989b2[_0x38eb8a(0x11a)](_0x339068)['filter'](_0x4ca9be=>_0x4ca9be['endsWith']('.yml'));for(const _0x66d141 of _0x4c618f){const _0x4efee8=a138_0x1b85f8['join'](_0x339068,_0x66d141),_0x1b80a1=parseChatInterfaceYaml(a138_0x3989b2[_0x38eb8a(0x108)](_0x4efee8,_0x38eb8a(0xc9)),_0x4efee8);_0x1d8964[_0x38eb8a(0x101)]({'name':_0x1b80a1[_0x38eb8a(0x143)],'path':_0x4efee8,'yaml':_0x1b80a1});}}const _0x261e7b=await this['client'][_0x38eb8a(0x97)](_0x20bd7d),_0x34d3ae=await this[_0x38eb8a(0xda)][_0x38eb8a(0x138)](_0x20bd7d),_0x3aab09=await this[_0x38eb8a(0xda)][_0x38eb8a(0x150)](_0x20bd7d),_0x140651=await this[_0x38eb8a(0xda)]['listPrompts'](_0x20bd7d),_0x4aa6b1=await this[_0x38eb8a(0xda)]['listIntegrations'](_0x20bd7d),_0x49d08b=await safeListOrEmpty(()=>this[_0x38eb8a(0xda)][_0x38eb8a(0x132)](_0x20bd7d)),_0x3ed8c9=await safeListOrEmpty(()=>this['client'][_0x38eb8a(0xc1)](_0x20bd7d)),_0x34bb8f=await safeListOrEmpty(()=>this[_0x38eb8a(0xda)][_0x38eb8a(0x95)](_0x20bd7d)),_0xa2f278=await safeListOrEmpty(()=>this[_0x38eb8a(0xda)]['listChatInterfaces'](_0x20bd7d)),_0x21158f=await fetchAllToolTargetMaps((_0x3a806c,_0x32ec43)=>this[_0x38eb8a(0xda)][_0x38eb8a(0x197)](_0x3a806c,_0x32ec43),_0x20bd7d),_0x2ade95=new Map(),_0x9c30a=new Map(),_0x1b7c72=new Map(),_0xa8e207=new Map(),_0x9b13be=new Map(),_0x382fb2=new Map(),_0x19691e=new Map();for(const _0xc4bf54 of _0x261e7b){_0x2ade95['set'](_0xc4bf54['attributes'][_0x38eb8a(0x143)],_0xc4bf54);}for(const _0xb51d05 of _0x34d3ae){_0x9c30a[_0x38eb8a(0xd1)](_0xb51d05[_0x38eb8a(0x14d)][_0x38eb8a(0x143)],_0xb51d05);}for(const _0x1a6b4c of _0x3aab09){_0x1b7c72[_0x38eb8a(0xd1)](_0x1a6b4c[_0x38eb8a(0x14d)][_0x38eb8a(0x143)],_0x1a6b4c);}for(const _0x4831c0 of _0x140651){_0xa8e207['set'](_0x4831c0[_0x38eb8a(0x14d)]['name'],_0x4831c0);}for(const _0x1f9a05 of _0x4aa6b1){_0x9b13be['set'](_0x1f9a05['attributes'][_0x38eb8a(0x14b)]['toLowerCase'](),_0x1f9a05);}for(const _0x531158 of _0x49d08b){_0x382fb2[_0x38eb8a(0xd1)](_0x531158[_0x38eb8a(0x14d)][_0x38eb8a(0x143)],_0x531158);}for(const _0x3caa1a of _0x3ed8c9){_0x19691e[_0x38eb8a(0xd1)](_0x3caa1a[_0x38eb8a(0x14d)]['name'],_0x3caa1a);}const _0x58bcfe=new Map(),_0x472239=new Map();for(const _0x4bf1fb of _0x34bb8f){_0x58bcfe[_0x38eb8a(0xd1)](_0x4bf1fb[_0x38eb8a(0x14d)][_0x38eb8a(0x143)],_0x4bf1fb);}for(const _0x1659c4 of _0xa2f278){_0x472239[_0x38eb8a(0xd1)](_0x1659c4['attributes'][_0x38eb8a(0x143)],_0x1659c4);}const _0xa6b35f=new Map(),_0xc4bf4f=new Map();for(const _0x102108 of _0x261e7b){_0xa6b35f['set'](_0x102108[_0x38eb8a(0x14d)][_0x38eb8a(0x143)],_0x102108['id']),_0xc4bf4f[_0x38eb8a(0xd1)](_0x102108['id'],_0x102108[_0x38eb8a(0x14d)]['name']);}const _0x1f52e7=new Map(),_0x1639bc=new Map();for(const _0x509a47 of _0x140651){_0x1f52e7[_0x38eb8a(0xd1)](_0x509a47['attributes'][_0x38eb8a(0x143)],_0x509a47['id']),_0x1639bc['set'](_0x509a47['id'],_0x509a47['attributes'][_0x38eb8a(0x143)]);}const _0x8850cd=_0x21158f[_0x38eb8a(0xf4)]['KnowledgeBase']||new Map(),_0x153091=_0x21158f[_0x38eb8a(0xf4)][_0x38eb8a(0x17d)]||new Map(),_0x1234b3=_0x21158f[_0x38eb8a(0xf4)][_0x38eb8a(0x176)]||new Map(),_0x18409f=new Map(),_0x277e5c={'resolveToolTargetName':buildNameResolver({..._0x21158f[_0x38eb8a(0xd9)],'Agent':_0xc4bf4f}),'resolvePromptName':async _0x2564ba=>_0x1639bc['get'](_0x2564ba),'onWarning':_0x36334f=>this[_0x38eb8a(0x139)]['warn'](_0x36334f)};let _0x4dea26=[];const _0x20913a={'projectId':_0x20bd7d,'resolveToolTargetId':buildIdResolver({..._0x21158f[_0x38eb8a(0xf4)],'Agent':_0xa6b35f}),'resolvePromptId':async _0x42fecc=>_0x1f52e7[_0x38eb8a(0x161)](_0x42fecc),'onWarning':_0x17e9b=>{const _0x364fc4=_0x38eb8a;this['logger'][_0x364fc4(0xe0)](_0x17e9b),_0x4dea26[_0x364fc4(0x101)](_0x17e9b);}},{resolved:_0x211ed5,unresolved:_0x527a9f}=resolveAgentDependencies(_0x1e9977,new Set(_0x2ade95[_0x38eb8a(0x112)]()));for(const {agent:_0x3c6b8d,missingDeps:_0x4b90e4}of _0x527a9f){_0x27eae4['agents']['push']({'agentName':_0x3c6b8d[_0x38eb8a(0x137)]['name'],'action':_0x38eb8a(0x174),'error':_0x38eb8a(0xe5)+_0x4b90e4[_0x38eb8a(0x173)](',\x20')+_0x38eb8a(0x7f)}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x8a)]['errors']++;}for(const _0x2890f1 of _0xd9c967){const _0x213523=_0x9c30a['get'](_0x2890f1['yaml'][_0x38eb8a(0x143)]),_0x5114e1=a138_0x3989b2['readFileSync'](_0x2890f1[_0x38eb8a(0x110)],'utf-8');if(_0x213523){const _0x2ba003=apiKnowledgeBaseToYaml(_0x213523),_0x4d3bb6=toKnowledgeBaseYamlString(_0x2ba003),_0x4b21de=generateDiff(_0x4d3bb6,_0x5114e1),_0xc40c93=hasChanges(_0x4b21de);_0xc40c93?(_0x27eae4['knowledgeBases'][_0x38eb8a(0x101)]({'name':_0x2890f1[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':_0x38eb8a(0xca),'id':_0x213523['id'],'diff':formatDiffWithColors(_0x4b21de)}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x7b)][_0x38eb8a(0xca)]++):(_0x27eae4['knowledgeBases']['push']({'name':_0x2890f1[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':_0x38eb8a(0xe1),'id':_0x213523['id']}),_0x27eae4['counts'][_0x38eb8a(0x7b)]['unchanged']++);}else _0x27eae4[_0x38eb8a(0x7b)][_0x38eb8a(0x101)]({'name':_0x2890f1[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':'created'}),_0x27eae4['counts'][_0x38eb8a(0x7b)][_0x38eb8a(0x114)]++;}for(const _0x208ba0 of _0x3197d1){const _0x3e8e01=_0x1b7c72[_0x38eb8a(0x161)](_0x208ba0[_0x38eb8a(0x143)]),_0x51b712=a138_0x3989b2['readFileSync'](_0x208ba0[_0x38eb8a(0x110)],_0x38eb8a(0xc9));if(_0x3e8e01){const _0x33bd8c=toTextKnowledgeBaseMd(_0x3e8e01['attributes'][_0x38eb8a(0x143)],_0x3e8e01[_0x38eb8a(0x14d)][_0x38eb8a(0x156)]),_0x32e727=generateDiff(_0x33bd8c,_0x51b712),_0x521c5d=hasChanges(_0x32e727);_0x521c5d?(_0x27eae4[_0x38eb8a(0x19c)][_0x38eb8a(0x101)]({'name':_0x208ba0[_0x38eb8a(0x143)],'action':_0x38eb8a(0xca),'id':_0x3e8e01['id'],'diff':formatDiffWithColors(_0x32e727)}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x19c)]['updated']++):(_0x27eae4[_0x38eb8a(0x19c)][_0x38eb8a(0x101)]({'name':_0x208ba0[_0x38eb8a(0x143)],'action':'unchanged','id':_0x3e8e01['id']}),_0x27eae4['counts']['textKnowledgeBases'][_0x38eb8a(0xe1)]++);}else _0x27eae4[_0x38eb8a(0x19c)]['push']({'name':_0x208ba0[_0x38eb8a(0x143)],'action':_0x38eb8a(0x114)}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x19c)][_0x38eb8a(0x114)]++;}for(const _0x5d5362 of _0x211ed5){const _0x4fd93e=_0x2ade95[_0x38eb8a(0x161)](_0x5d5362[_0x38eb8a(0x137)][_0x38eb8a(0x143)]),_0x23cf14=a138_0x1b85f8[_0x38eb8a(0x173)](_0x5d5362[_0x38eb8a(0xf5)],_0x38eb8a(0x159)),_0x28d353=a138_0x3989b2[_0x38eb8a(0x108)](_0x23cf14,_0x38eb8a(0xc9)),_0x1bdbbf=_0x5d5362['systemPrompt'],_0x3c14e0='#\x20prompt.md\x0a'+_0x1bdbbf+_0x38eb8a(0x100)+_0x28d353;if(_0x4fd93e){const {yaml:_0xeadf2,systemPrompt:_0x1c6fa9}=await agentResponseToDef(_0x4fd93e,_0x277e5c),_0x2350ba=toAgentYamlString(_0xeadf2),_0x24c60='#\x20prompt.md\x0a'+_0x1c6fa9+_0x38eb8a(0x100)+_0x2350ba,_0x45d979=generateDiff(_0x24c60,_0x3c14e0),_0x3c34e3=hasChanges(_0x45d979);_0x3c34e3?(_0x27eae4[_0x38eb8a(0x8a)][_0x38eb8a(0x101)]({'agentName':_0x5d5362[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':_0x38eb8a(0xca),'agentId':_0x4fd93e['id'],'diff':formatDiffWithColors(_0x45d979)}),_0x27eae4['counts'][_0x38eb8a(0x8a)]['updated']++):(_0x27eae4[_0x38eb8a(0x8a)][_0x38eb8a(0x101)]({'agentName':_0x5d5362['yaml'][_0x38eb8a(0x143)],'action':_0x38eb8a(0xe1),'agentId':_0x4fd93e['id']}),_0x27eae4[_0x38eb8a(0x182)]['agents'][_0x38eb8a(0xe1)]++);}else _0x27eae4['agents'][_0x38eb8a(0x101)]({'agentName':_0x5d5362['yaml']['name'],'action':_0x38eb8a(0x114)}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x8a)][_0x38eb8a(0x114)]++;}for(const _0x52580b of _0x22019e){const _0x408184=_0xa8e207[_0x38eb8a(0x161)](_0x52580b[_0x38eb8a(0x137)][_0x38eb8a(0x143)]),_0x1784ce=a138_0x3989b2[_0x38eb8a(0x108)](_0x52580b[_0x38eb8a(0x110)],_0x38eb8a(0xc9));if(_0x408184){const _0x3b848f=await apiPromptToYaml(_0x408184,_0x277e5c);if(!_0x3b848f){_0x27eae4[_0x38eb8a(0x115)][_0x38eb8a(0x101)]({'name':_0x52580b[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':_0x38eb8a(0xca),'id':_0x408184['id']}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x115)][_0x38eb8a(0xca)]++;continue;}const _0x2cfb83=toPromptYamlString(_0x3b848f),_0x12ebe8=generateDiff(_0x2cfb83,_0x1784ce),_0x106208=hasChanges(_0x12ebe8);_0x106208?(_0x27eae4[_0x38eb8a(0x115)][_0x38eb8a(0x101)]({'name':_0x52580b[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':_0x38eb8a(0xca),'id':_0x408184['id'],'diff':formatDiffWithColors(_0x12ebe8)}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x115)][_0x38eb8a(0xca)]++):(_0x27eae4['prompts']['push']({'name':_0x52580b[_0x38eb8a(0x137)]['name'],'action':_0x38eb8a(0xe1),'id':_0x408184['id']}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x115)][_0x38eb8a(0xe1)]++);}else _0x27eae4['prompts'][_0x38eb8a(0x101)]({'name':_0x52580b[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':'created'}),_0x27eae4['counts'][_0x38eb8a(0x115)][_0x38eb8a(0x114)]++;}for(const _0x19c114 of _0x1cadb6){const _0x189f65=_0x9b13be['get'](_0x19c114[_0x38eb8a(0x137)]['service_type']),_0x4db298=a138_0x3989b2[_0x38eb8a(0x108)](_0x19c114[_0x38eb8a(0x110)],_0x38eb8a(0xc9));if(_0x189f65){const _0xc0def2=await apiIntegrationToYaml(_0x189f65,_0x277e5c),_0x16d8ff=toIntegrationYamlString(_0xc0def2),_0x5c275f=generateDiff(_0x16d8ff,_0x4db298),_0x4d5499=hasChanges(_0x5c275f);_0x4d5499?(_0x27eae4['integrations'][_0x38eb8a(0x101)]({'name':_0x19c114[_0x38eb8a(0x137)][_0x38eb8a(0x196)],'action':_0x38eb8a(0xca),'id':_0x189f65['id'],'diff':formatDiffWithColors(_0x5c275f)}),_0x27eae4[_0x38eb8a(0x182)]['integrations'][_0x38eb8a(0xca)]++):(_0x27eae4[_0x38eb8a(0x8d)][_0x38eb8a(0x101)]({'name':_0x19c114[_0x38eb8a(0x137)][_0x38eb8a(0x196)],'action':_0x38eb8a(0xe1),'id':_0x189f65['id']}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x8d)]['unchanged']++);}else _0x27eae4[_0x38eb8a(0x8d)][_0x38eb8a(0x101)]({'name':_0x19c114[_0x38eb8a(0x137)][_0x38eb8a(0x196)],'action':_0x38eb8a(0x114)}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x8d)][_0x38eb8a(0x114)]++;}for(const _0x3f485a of _0x4f12b7){const _0x3687e1=_0x382fb2[_0x38eb8a(0x161)](_0x3f485a[_0x38eb8a(0x15d)][_0x38eb8a(0x143)]),_0x5d7430=toExperimentalKnowledgeBaseYamlString(_0x3f485a[_0x38eb8a(0x15d)]);let _0xba804a=_0x5d7430;for(const _0x236c0a of _0x3f485a[_0x38eb8a(0x15d)]['functions']){_0xba804a+=_0x38eb8a(0x102)+_0x236c0a['name']+_0x38eb8a(0x151)+_0x236c0a['code']+'\x0a---\x20schema:\x20'+_0x236c0a[_0x38eb8a(0x143)]+_0x38eb8a(0x151)+_0x236c0a[_0x38eb8a(0xde)]+'\x0a';}if(_0x3687e1){const _0x204714=apiExperimentalKnowledgeBaseToYaml(_0x3687e1),_0x1ac533=toExperimentalKnowledgeBaseYamlString(_0x204714);let _0x27f063=_0x1ac533;for(const _0x433021 of _0x204714[_0x38eb8a(0x169)]){_0x27f063+=_0x38eb8a(0x102)+_0x433021[_0x38eb8a(0x143)]+_0x38eb8a(0x151)+_0x433021['code']+_0x38eb8a(0xbe)+_0x433021[_0x38eb8a(0x143)]+'\x20---\x0a'+_0x433021['json_schema']+'\x0a';}const _0x208247=generateDiff(_0x27f063,_0xba804a),_0x19ca23=hasChanges(_0x208247);_0x19ca23?(_0x27eae4['experimentalKnowledgeBases']['push']({'name':_0x3f485a['def']['name'],'action':'updated','id':_0x3687e1['id'],'diff':formatDiffWithColors(_0x208247)}),_0x27eae4[_0x38eb8a(0x182)]['experimentalKnowledgeBases'][_0x38eb8a(0xca)]++):(_0x27eae4[_0x38eb8a(0xc7)][_0x38eb8a(0x101)]({'name':_0x3f485a[_0x38eb8a(0x15d)][_0x38eb8a(0x143)],'action':'unchanged','id':_0x3687e1['id']}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0xc7)][_0x38eb8a(0xe1)]++);}else _0x27eae4[_0x38eb8a(0xc7)][_0x38eb8a(0x101)]({'name':_0x3f485a[_0x38eb8a(0x15d)][_0x38eb8a(0x143)],'action':_0x38eb8a(0x114)}),_0x27eae4[_0x38eb8a(0x182)]['experimentalKnowledgeBases']['created']++;}for(const _0x5f32b2 of _0x5ded14){const _0x234508=_0x19691e[_0x38eb8a(0x161)](_0x5f32b2[_0x38eb8a(0x15d)][_0x38eb8a(0x143)]),_0x232f3a=toExperimentalArtifactYamlString(_0x5f32b2[_0x38eb8a(0x15d)]);let _0x35e766=_0x232f3a+(_0x38eb8a(0x90)+_0x5f32b2['def'][_0x38eb8a(0xf8)]+'\x0a');for(const _0x65eaef of _0x5f32b2[_0x38eb8a(0x15d)]['files']){_0x35e766+=_0x38eb8a(0x142)+_0x65eaef[_0x38eb8a(0xff)]+'\x20---\x0a'+_0x65eaef[_0x38eb8a(0x9a)]+'\x0a';}if(_0x234508){const _0x4e325a=apiExperimentalArtifactToYaml(_0x234508),_0x47decc=toExperimentalArtifactYamlString(_0x4e325a);let _0x57eff6=_0x47decc+(_0x38eb8a(0x90)+_0x4e325a[_0x38eb8a(0xf8)]+'\x0a');for(const _0x4c2fb8 of _0x4e325a[_0x38eb8a(0x177)]){_0x57eff6+=_0x38eb8a(0x142)+_0x4c2fb8[_0x38eb8a(0xff)]+_0x38eb8a(0x151)+_0x4c2fb8[_0x38eb8a(0x9a)]+'\x0a';}const _0x18c066=generateDiff(_0x57eff6,_0x35e766),_0x2ae5c3=hasChanges(_0x18c066);_0x2ae5c3?(_0x27eae4['experimentalArtifacts'][_0x38eb8a(0x101)]({'name':_0x5f32b2['def'][_0x38eb8a(0x143)],'action':_0x38eb8a(0xca),'id':_0x234508['id'],'diff':formatDiffWithColors(_0x18c066)}),_0x27eae4['counts'][_0x38eb8a(0x18b)][_0x38eb8a(0xca)]++):(_0x27eae4[_0x38eb8a(0x18b)]['push']({'name':_0x5f32b2['def']['name'],'action':_0x38eb8a(0xe1),'id':_0x234508['id']}),_0x27eae4[_0x38eb8a(0x182)]['experimentalArtifacts'][_0x38eb8a(0xe1)]++);}else _0x27eae4[_0x38eb8a(0x18b)]['push']({'name':_0x5f32b2[_0x38eb8a(0x15d)]['name'],'action':_0x38eb8a(0x114)}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x18b)][_0x38eb8a(0x114)]++;}for(const _0x21e7fb of _0xadcff8){const _0x16102e=_0x58bcfe['get'](_0x21e7fb[_0x38eb8a(0x137)][_0x38eb8a(0x143)]),_0x4004ff=a138_0x3989b2[_0x38eb8a(0x108)](_0x21e7fb[_0x38eb8a(0x110)],'utf-8');if(_0x16102e){const _0x2b4cb6=await apiFormInterfaceToYaml(_0x16102e,_0x277e5c),_0x532cea=toFormInterfaceYamlString(_0x2b4cb6),_0x42b9a7=generateDiff(_0x532cea,_0x4004ff),_0x3ec526=hasChanges(_0x42b9a7);_0x3ec526?(_0x27eae4[_0x38eb8a(0x133)]['push']({'name':_0x21e7fb[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':'updated','id':_0x16102e['id'],'diff':formatDiffWithColors(_0x42b9a7)}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x133)][_0x38eb8a(0xca)]++):(_0x27eae4[_0x38eb8a(0x133)][_0x38eb8a(0x101)]({'name':_0x21e7fb['yaml']['name'],'action':_0x38eb8a(0xe1),'id':_0x16102e['id']}),_0x27eae4['counts'][_0x38eb8a(0x133)][_0x38eb8a(0xe1)]++);}else _0x27eae4['formInterfaces']['push']({'name':_0x21e7fb[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':'created'}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x133)][_0x38eb8a(0x114)]++;}for(const _0x1eca85 of _0x1d8964){const _0x5b5a33=_0x472239[_0x38eb8a(0x161)](_0x1eca85['yaml'][_0x38eb8a(0x143)]),_0x9d3a27=a138_0x3989b2[_0x38eb8a(0x108)](_0x1eca85[_0x38eb8a(0x110)],_0x38eb8a(0xc9));if(_0x5b5a33){const _0x323b00=await apiChatInterfaceToYaml(_0x5b5a33,_0x277e5c),_0x708db4=toChatInterfaceYamlString(_0x323b00),_0x2d893c=generateDiff(_0x708db4,_0x9d3a27),_0x424246=hasChanges(_0x2d893c);_0x424246?(_0x27eae4[_0x38eb8a(0xbb)][_0x38eb8a(0x101)]({'name':_0x1eca85[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':_0x38eb8a(0xca),'id':_0x5b5a33['id'],'diff':formatDiffWithColors(_0x2d893c)}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0xbb)][_0x38eb8a(0xca)]++):(_0x27eae4[_0x38eb8a(0xbb)]['push']({'name':_0x1eca85[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':_0x38eb8a(0xe1),'id':_0x5b5a33['id']}),_0x27eae4[_0x38eb8a(0x182)]['chatInterfaces']['unchanged']++);}else _0x27eae4[_0x38eb8a(0xbb)][_0x38eb8a(0x101)]({'name':_0x1eca85['yaml']['name'],'action':_0x38eb8a(0x114)}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0xbb)][_0x38eb8a(0x114)]++;}if(_0x32dc5e?.[_0x38eb8a(0xf7)])return _0x27eae4;_0x27eae4[_0x38eb8a(0x7b)]=[],_0x27eae4[_0x38eb8a(0x19c)]=[],_0x27eae4[_0x38eb8a(0x115)]=[],_0x27eae4[_0x38eb8a(0x8d)]=[],_0x27eae4[_0x38eb8a(0xc7)]=[],_0x27eae4[_0x38eb8a(0x18b)]=[],_0x27eae4['formInterfaces']=[],_0x27eae4['chatInterfaces']=[];const _0x1ccf84=_0x27eae4['agents']['filter'](_0x32b147=>_0x32b147[_0x38eb8a(0x106)]==='error');_0x27eae4[_0x38eb8a(0x8a)]=_0x1ccf84,_0x27eae4['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x1ccf84[_0x38eb8a(0x193)]},'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 _0xbf81e3 of _0xd9c967){try{const _0x4f9a1f=_0x9c30a[_0x38eb8a(0x161)](_0xbf81e3['yaml'][_0x38eb8a(0x143)]),_0x21afb3=yamlKnowledgeBaseToApi(_0xbf81e3[_0x38eb8a(0x137)],_0x20bd7d);if(_0x4f9a1f)await this[_0x38eb8a(0xda)]['updateKnowledgeBase'](_0x4f9a1f['id'],_0x21afb3),_0x8850cd['set'](_0xbf81e3['yaml'][_0x38eb8a(0x143)],_0x4f9a1f['id']),_0x27eae4[_0x38eb8a(0x7b)][_0x38eb8a(0x101)]({'name':_0xbf81e3['yaml'][_0x38eb8a(0x143)],'action':_0x38eb8a(0xca),'id':_0x4f9a1f['id']}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x7b)][_0x38eb8a(0xca)]++;else{const _0x163b6a=await this['client'][_0x38eb8a(0x11d)](_0x21afb3);_0x8850cd[_0x38eb8a(0xd1)](_0xbf81e3[_0x38eb8a(0x137)][_0x38eb8a(0x143)],_0x163b6a['id']),_0x27eae4[_0x38eb8a(0x7b)][_0x38eb8a(0x101)]({'name':_0xbf81e3[_0x38eb8a(0x137)]['name'],'action':_0x38eb8a(0x114),'id':_0x163b6a['id']}),_0x27eae4[_0x38eb8a(0x182)]['knowledgeBases'][_0x38eb8a(0x114)]++;}}catch(_0x18d9fe){_0x27eae4[_0x38eb8a(0x7b)]['push']({'name':_0xbf81e3[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':'error','error':_0x18d9fe[_0x38eb8a(0x14f)]}),_0x27eae4[_0x38eb8a(0x182)]['knowledgeBases'][_0x38eb8a(0x83)]++;}}for(const _0x3038ce of _0x3197d1){try{const _0x1e9bfd=_0x1b7c72[_0x38eb8a(0x161)](_0x3038ce[_0x38eb8a(0x143)]),_0xfe66d3=yamlTextKnowledgeBaseToApi({'name':_0x3038ce[_0x38eb8a(0x143)],'text':_0x3038ce[_0x38eb8a(0x156)]},_0x20bd7d);if(_0x1e9bfd)await this['client'][_0x38eb8a(0x157)](_0x1e9bfd['id'],_0xfe66d3),_0x153091[_0x38eb8a(0xd1)](_0x3038ce[_0x38eb8a(0x143)],_0x1e9bfd['id']),_0x27eae4[_0x38eb8a(0x19c)][_0x38eb8a(0x101)]({'name':_0x3038ce[_0x38eb8a(0x143)],'action':_0x38eb8a(0xca),'id':_0x1e9bfd['id']}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x19c)]['updated']++;else{const _0x42cce6=await this[_0x38eb8a(0xda)][_0x38eb8a(0x7d)](_0xfe66d3);_0x153091[_0x38eb8a(0xd1)](_0x3038ce[_0x38eb8a(0x143)],_0x42cce6['id']),_0x27eae4[_0x38eb8a(0x19c)][_0x38eb8a(0x101)]({'name':_0x3038ce['name'],'action':'created','id':_0x42cce6['id']}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x19c)]['created']++;}}catch(_0x54d6be){_0x27eae4[_0x38eb8a(0x19c)][_0x38eb8a(0x101)]({'name':_0x3038ce[_0x38eb8a(0x143)],'action':_0x38eb8a(0x174),'error':_0x54d6be[_0x38eb8a(0x14f)]}),_0x27eae4['counts'][_0x38eb8a(0x19c)][_0x38eb8a(0x83)]++;}}for(const _0x3d1366 of _0x4f12b7){try{const _0x8edb05=_0x382fb2[_0x38eb8a(0x161)](_0x3d1366[_0x38eb8a(0x15d)][_0x38eb8a(0x143)]),_0x18fcfb=yamlExperimentalKnowledgeBaseToApi(_0x3d1366[_0x38eb8a(0x15d)],_0x20bd7d);if(_0x8edb05)await this[_0x38eb8a(0xda)][_0x38eb8a(0x11c)](_0x8edb05['id'],_0x18fcfb),_0x1234b3[_0x38eb8a(0xd1)](_0x3d1366[_0x38eb8a(0x15d)][_0x38eb8a(0x143)],_0x8edb05['id']),_0x27eae4['experimentalKnowledgeBases'][_0x38eb8a(0x101)]({'name':_0x3d1366[_0x38eb8a(0x15d)]['name'],'action':_0x38eb8a(0xca),'id':_0x8edb05['id']}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0xc7)][_0x38eb8a(0xca)]++;else{const _0x40b4a4=await this[_0x38eb8a(0xda)]['createExperimentalKnowledgeBase'](_0x18fcfb);_0x1234b3[_0x38eb8a(0xd1)](_0x3d1366[_0x38eb8a(0x15d)]['name'],_0x40b4a4['id']),_0x27eae4[_0x38eb8a(0xc7)][_0x38eb8a(0x101)]({'name':_0x3d1366[_0x38eb8a(0x15d)]['name'],'action':'created','id':_0x40b4a4['id']}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0xc7)][_0x38eb8a(0x114)]++;}}catch(_0x52fe1f){_0x27eae4[_0x38eb8a(0xc7)]['push']({'name':_0x3d1366[_0x38eb8a(0x15d)]['name'],'action':_0x38eb8a(0x174),'error':_0x52fe1f['message']}),_0x27eae4[_0x38eb8a(0x182)]['experimentalKnowledgeBases'][_0x38eb8a(0x83)]++;}}for(const _0x252c51 of _0x5ded14){try{const _0x259af1=_0x19691e['get'](_0x252c51['def']['name']),_0x6813a7=yamlExperimentalArtifactToApi(_0x252c51[_0x38eb8a(0x15d)],_0x20bd7d);if(_0x259af1)await this[_0x38eb8a(0xda)]['updateExperimentalArtifact'](_0x259af1['id'],_0x6813a7),_0x18409f['set'](_0x252c51[_0x38eb8a(0x15d)][_0x38eb8a(0x143)],_0x259af1['id']),_0x27eae4[_0x38eb8a(0x18b)]['push']({'name':_0x252c51[_0x38eb8a(0x15d)][_0x38eb8a(0x143)],'action':_0x38eb8a(0xca),'id':_0x259af1['id']}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x18b)][_0x38eb8a(0xca)]++;else{const _0x5bd4a5=await this[_0x38eb8a(0xda)][_0x38eb8a(0xe4)](_0x6813a7);_0x18409f['set'](_0x252c51['def']['name'],_0x5bd4a5['id']),_0x27eae4[_0x38eb8a(0x18b)][_0x38eb8a(0x101)]({'name':_0x252c51[_0x38eb8a(0x15d)][_0x38eb8a(0x143)],'action':_0x38eb8a(0x114),'id':_0x5bd4a5['id']}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x18b)][_0x38eb8a(0x114)]++;}}catch(_0x1eccec){_0x27eae4[_0x38eb8a(0x18b)]['push']({'name':_0x252c51[_0x38eb8a(0x15d)][_0x38eb8a(0x143)],'action':_0x38eb8a(0x174),'error':_0x1eccec[_0x38eb8a(0x14f)]}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x18b)][_0x38eb8a(0x83)]++;}}for(const _0x2de0ea of _0x211ed5){_0x4dea26=[];try{const _0x3012b0=_0x2ade95['get'](_0x2de0ea['yaml'][_0x38eb8a(0x143)]),_0x78b112=await agentDefToRequest(_0x2de0ea['yaml'],_0x2de0ea[_0x38eb8a(0x175)],_0x2de0ea['starterMessage'],_0x20913a);if(_0x3012b0)await this['client'][_0x38eb8a(0x15e)](_0x3012b0['id'],_0x78b112),_0xa6b35f[_0x38eb8a(0xd1)](_0x2de0ea[_0x38eb8a(0x137)][_0x38eb8a(0x143)],_0x3012b0['id']),_0x27eae4[_0x38eb8a(0x8a)][_0x38eb8a(0x101)]({'agentName':_0x2de0ea[_0x38eb8a(0x137)]['name'],'action':_0x38eb8a(0xca),'agentId':_0x3012b0['id'],'warnings':_0x4dea26[_0x38eb8a(0x193)]>0x0?_0x4dea26:undefined}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x8a)][_0x38eb8a(0xca)]++;else{const _0x27abe7=await this[_0x38eb8a(0xda)][_0x38eb8a(0xdb)](_0x78b112);_0xa6b35f[_0x38eb8a(0xd1)](_0x2de0ea[_0x38eb8a(0x137)][_0x38eb8a(0x143)],_0x27abe7['id']),_0x27eae4[_0x38eb8a(0x8a)][_0x38eb8a(0x101)]({'agentName':_0x2de0ea[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':_0x38eb8a(0x114),'agentId':_0x27abe7['id'],'warnings':_0x4dea26[_0x38eb8a(0x193)]>0x0?_0x4dea26:undefined}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x8a)][_0x38eb8a(0x114)]++;}}catch(_0x48a455){_0x27eae4['agents'][_0x38eb8a(0x101)]({'agentName':_0x2de0ea[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':_0x38eb8a(0x174),'error':_0x48a455[_0x38eb8a(0x14f)],'warnings':_0x4dea26['length']>0x0?_0x4dea26:undefined}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x8a)][_0x38eb8a(0x83)]++;}}for(const _0x4721d1 of _0x22019e){try{const _0xfc93a3=_0xa8e207[_0x38eb8a(0x161)](_0x4721d1[_0x38eb8a(0x137)][_0x38eb8a(0x143)]),_0x526f96=await yamlPromptToApi(_0x4721d1[_0x38eb8a(0x137)],_0x20bd7d,_0x20913a);if(!_0x526f96){_0x27eae4[_0x38eb8a(0x115)][_0x38eb8a(0x101)]({'name':_0x4721d1[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':_0x38eb8a(0x174),'error':_0x38eb8a(0x121)}),_0x27eae4[_0x38eb8a(0x182)]['prompts']['errors']++;continue;}if(_0xfc93a3)await this[_0x38eb8a(0xda)][_0x38eb8a(0x116)](_0xfc93a3['id'],_0x526f96),_0x1f52e7[_0x38eb8a(0xd1)](_0x4721d1[_0x38eb8a(0x137)][_0x38eb8a(0x143)],_0xfc93a3['id']),_0x27eae4[_0x38eb8a(0x115)][_0x38eb8a(0x101)]({'name':_0x4721d1[_0x38eb8a(0x137)]['name'],'action':_0x38eb8a(0xca),'id':_0xfc93a3['id']}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x115)]['updated']++;else{const _0xf5c201=await this[_0x38eb8a(0xda)]['createPrompt'](_0x526f96);_0x1f52e7['set'](_0x4721d1[_0x38eb8a(0x137)][_0x38eb8a(0x143)],_0xf5c201['id']),_0x27eae4[_0x38eb8a(0x115)][_0x38eb8a(0x101)]({'name':_0x4721d1['yaml'][_0x38eb8a(0x143)],'action':'created','id':_0xf5c201['id']}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x115)][_0x38eb8a(0x114)]++;}}catch(_0x230925){_0x27eae4['prompts']['push']({'name':_0x4721d1[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':_0x38eb8a(0x174),'error':_0x230925['message']}),_0x27eae4['counts'][_0x38eb8a(0x115)][_0x38eb8a(0x83)]++;}}for(const _0x3788ca of _0x1cadb6){try{const _0x34b5b1=_0x9b13be[_0x38eb8a(0x161)](_0x3788ca[_0x38eb8a(0x137)][_0x38eb8a(0x196)]),_0x5493fc=await yamlIntegrationToApi(_0x3788ca[_0x38eb8a(0x137)],_0x20bd7d,_0x20913a);if(_0x34b5b1){await this['client']['deleteIntegration'](_0x34b5b1['id']);const _0x3c2a7d=await this['client']['createIntegration'](_0x5493fc);_0x27eae4[_0x38eb8a(0x8d)][_0x38eb8a(0x101)]({'name':_0x3788ca[_0x38eb8a(0x137)]['service_type'],'action':_0x38eb8a(0xca),'id':_0x3c2a7d['id']}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x8d)][_0x38eb8a(0xca)]++;}else{const _0x2be54f=await this[_0x38eb8a(0xda)]['createIntegration'](_0x5493fc);_0x27eae4['integrations'][_0x38eb8a(0x101)]({'name':_0x3788ca[_0x38eb8a(0x137)][_0x38eb8a(0x196)],'action':_0x38eb8a(0x114),'id':_0x2be54f['id']}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x8d)][_0x38eb8a(0x114)]++;}}catch(_0x408136){_0x27eae4[_0x38eb8a(0x8d)][_0x38eb8a(0x101)]({'name':_0x3788ca[_0x38eb8a(0x137)]['service_type'],'action':_0x38eb8a(0x174),'error':_0x408136[_0x38eb8a(0x14f)]}),_0x27eae4[_0x38eb8a(0x182)]['integrations'][_0x38eb8a(0x83)]++;}}for(const _0xafca0c of _0xadcff8){try{const _0x540bec=_0x58bcfe['get'](_0xafca0c[_0x38eb8a(0x137)][_0x38eb8a(0x143)]),_0x1e3dca=await yamlFormInterfaceToApi(_0xafca0c['yaml'],_0x20bd7d,_0x20913a);if(!_0x1e3dca){_0x27eae4[_0x38eb8a(0x133)][_0x38eb8a(0x101)]({'name':_0xafca0c[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':_0x38eb8a(0x174),'error':_0x38eb8a(0x8c)}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x133)][_0x38eb8a(0x83)]++;continue;}if(_0x540bec){const _0x4bb466=await this[_0x38eb8a(0xda)][_0x38eb8a(0x18f)](_0x540bec['id'],_0x1e3dca);_0x27eae4[_0x38eb8a(0x133)][_0x38eb8a(0x101)]({'name':_0xafca0c['yaml']['name'],'action':_0x38eb8a(0xca),'id':_0x4bb466['id']}),_0x27eae4['counts'][_0x38eb8a(0x133)][_0x38eb8a(0xca)]++;}else{const _0x4602fa=await this['client'][_0x38eb8a(0x10a)](_0x1e3dca);_0x27eae4[_0x38eb8a(0x133)][_0x38eb8a(0x101)]({'name':_0xafca0c[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':_0x38eb8a(0x114),'id':_0x4602fa['id']}),_0x27eae4[_0x38eb8a(0x182)]['formInterfaces'][_0x38eb8a(0x114)]++;}}catch(_0x2b6071){_0x27eae4[_0x38eb8a(0x133)][_0x38eb8a(0x101)]({'name':_0xafca0c[_0x38eb8a(0x137)]['name'],'action':'error','error':_0x2b6071[_0x38eb8a(0x14f)]}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0x133)][_0x38eb8a(0x83)]++;}}for(const _0x27c58b of _0x1d8964){try{const _0x38affa=_0x472239[_0x38eb8a(0x161)](_0x27c58b[_0x38eb8a(0x137)][_0x38eb8a(0x143)]),_0x1e909c=await yamlChatInterfaceToApi(_0x27c58b[_0x38eb8a(0x137)],_0x20bd7d,_0x20913a);if(_0x38affa){const _0x2d4c64=await this[_0x38eb8a(0xda)][_0x38eb8a(0x129)](_0x38affa['id'],_0x1e909c);_0x27eae4[_0x38eb8a(0xbb)][_0x38eb8a(0x101)]({'name':_0x27c58b[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':'updated','id':_0x2d4c64['id']}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0xbb)]['updated']++;}else{const _0x4795f3=await this[_0x38eb8a(0xda)][_0x38eb8a(0x14a)](_0x1e909c);_0x27eae4['chatInterfaces']['push']({'name':_0x27c58b['yaml'][_0x38eb8a(0x143)],'action':_0x38eb8a(0x114),'id':_0x4795f3['id']}),_0x27eae4[_0x38eb8a(0x182)]['chatInterfaces'][_0x38eb8a(0x114)]++;}}catch(_0x1885e3){_0x27eae4[_0x38eb8a(0xbb)][_0x38eb8a(0x101)]({'name':_0x27c58b[_0x38eb8a(0x137)][_0x38eb8a(0x143)],'action':_0x38eb8a(0x174),'error':_0x1885e3[_0x38eb8a(0x14f)]}),_0x27eae4[_0x38eb8a(0x182)][_0x38eb8a(0xbb)]['errors']++;}}return _0x27eae4;}async[a138_0x3b91f2(0xb9)](_0x5e5b9f,_0x5439c4,_0x414e75,_0x25f955){const _0x38ee48=a138_0x3b91f2,{projectId:_0x5c1c50,project:_0x396912}=await this[_0x38ee48(0xad)](_0x5e5b9f),_0x2375a9=_0x396912['attributes'][_0x38ee48(0x143)],_0x241c66=await this[_0x38ee48(0xda)][_0x38ee48(0x97)](_0x5c1c50),_0x2c1d4a=_0x241c66['find'](_0x1f1cdc=>_0x1f1cdc[_0x38ee48(0x14d)][_0x38ee48(0x143)]===_0x5439c4);if(!_0x2c1d4a)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x38ee48(0xf2)+_0x5439c4,undefined,{'helpText':_0x38ee48(0x136)+_0x241c66[_0x38ee48(0x124)](_0x1528fa=>_0x1528fa[_0x38ee48(0x14d)][_0x38ee48(0x143)])['join'](',\x20')});let _0x5891cb;if(_0x414e75)_0x5891cb=_0x414e75;else{const _0x1cd284=a138_0x1b85f8['join'](process['cwd'](),_0x38ee48(0x8a)),_0x5d3bcb=getSanitizedPathWithMigration(_0x1cd284,_0x2375a9);_0x5d3bcb[_0x38ee48(0xb3)]&&this['logger']['info'](_0x38ee48(0x160)+a138_0x1b85f8[_0x38ee48(0x146)](_0x5d3bcb['oldPath'])+'\x20→\x20'+a138_0x1b85f8[_0x38ee48(0x146)](_0x5d3bcb[_0x38ee48(0x110)])),_0x5891cb=_0x5d3bcb['path'];}const _0x4f5cb4=getSanitizedPathWithMigration(_0x5891cb,_0x5439c4);_0x4f5cb4[_0x38ee48(0xb3)]&&this[_0x38ee48(0x139)][_0x38ee48(0x88)](_0x38ee48(0x198)+a138_0x1b85f8[_0x38ee48(0x146)](_0x4f5cb4[_0x38ee48(0xb1)])+_0x38ee48(0xc2)+a138_0x1b85f8['basename'](_0x4f5cb4[_0x38ee48(0x110)]));const _0x1851fa=_0x4f5cb4[_0x38ee48(0x110)],_0x477ed=new Map(),_0x505b77=new Map(),_0xd83352=await this['client'][_0x38ee48(0x138)](_0x5c1c50),_0x281f6a=await this[_0x38ee48(0xda)][_0x38ee48(0x150)](_0x5c1c50),_0x4ce0cb=await safeListOrEmpty(()=>this['client'][_0x38ee48(0x132)](_0x5c1c50)),_0x43c494=new Map(),_0x3f5caf=new Map();for(const _0x20c3a7 of _0xd83352){_0x477ed[_0x38ee48(0xd1)](_0x20c3a7['id'],_0x20c3a7[_0x38ee48(0x14d)][_0x38ee48(0x143)]);}for(const _0x14bdbc of _0x281f6a){_0x43c494['set'](_0x14bdbc['id'],_0x14bdbc['attributes'][_0x38ee48(0x143)]);}for(const _0x1a1a86 of _0x4ce0cb){_0x3f5caf[_0x38ee48(0xd1)](_0x1a1a86['id'],_0x1a1a86[_0x38ee48(0x14d)][_0x38ee48(0x143)]);}for(const _0x2076b2 of _0x241c66){_0x505b77[_0x38ee48(0xd1)](_0x2076b2['id'],_0x2076b2[_0x38ee48(0x14d)]['name']);}const _0x18dce0={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x477ed,'TextKnowledgeBase':_0x43c494,'Agent':_0x505b77,'ExperimentalKnowledgeBase':_0x3f5caf}),'resolvePromptName':async()=>undefined,'onWarning':_0x684374=>this[_0x38ee48(0x139)]['warn'](_0x684374)},_0x54ce8a=a138_0x1b85f8[_0x38ee48(0x173)](_0x1851fa,'prompt.md'),_0x26ab3c=a138_0x1b85f8['join'](_0x1851fa,_0x38ee48(0x159)),_0x16c465=a138_0x1b85f8[_0x38ee48(0x173)](_0x1851fa,'starter_message.md'),_0x10cb92=!a138_0x3989b2[_0x38ee48(0x18e)](_0x26ab3c);if(_0x25f955?.[_0x38ee48(0xf7)])return{'agentName':_0x5439c4,'outputPath':_0x1851fa,'isNew':_0x10cb92,'hasChanges':!![]};a138_0x3989b2['mkdirSync'](_0x5891cb,{'recursive':!![]}),a138_0x3989b2['mkdirSync'](_0x1851fa,{'recursive':!![]});const _0x538660=a138_0x1b85f8[_0x38ee48(0x173)](_0x5891cb,_0x38ee48(0xcd));!a138_0x3989b2[_0x38ee48(0x18e)](_0x538660)&&a138_0x3989b2[_0x38ee48(0x153)](_0x538660,createAgentConfigContent(_0x5e5b9f));const {yaml:_0x278488,systemPrompt:_0x2bb80a,starterMessage:_0x4f7b33}=await agentResponseToDef(_0x2c1d4a,_0x18dce0);let _0x4aad87=_0x10cb92;if(!_0x10cb92){const _0x2d793a=a138_0x3989b2['existsSync'](_0x54ce8a)?a138_0x3989b2[_0x38ee48(0x108)](_0x54ce8a,'utf-8'):'',_0x6ebf88=a138_0x3989b2[_0x38ee48(0x108)](_0x26ab3c,'utf-8');_0x4aad87=_0x2d793a!==_0x2bb80a||_0x6ebf88!==toAgentYamlString(_0x278488);}a138_0x3989b2[_0x38ee48(0x153)](_0x54ce8a,_0x2bb80a),a138_0x3989b2['writeFileSync'](_0x26ab3c,toAgentYamlString(_0x278488));if(_0x4f7b33&&_0x4f7b33[_0x38ee48(0xa6)]('\x0a'))a138_0x3989b2[_0x38ee48(0x153)](_0x16c465,_0x4f7b33);else a138_0x3989b2[_0x38ee48(0x18e)](_0x16c465)&&a138_0x3989b2[_0x38ee48(0x118)](_0x16c465);return{'agentName':_0x5439c4,'outputPath':_0x1851fa,'isNew':_0x10cb92,'hasChanges':_0x4aad87};}async[a138_0x3b91f2(0x16d)](_0x549182,_0xba8c83){const _0x583de5=a138_0x3b91f2;let _0x97f831;isAgentYamlPath(_0x549182)?_0x97f831=getAgentDirFromYamlPath(_0x549182):_0x97f831=_0x549182;const {config:_0x109638}=findAgentConfig(_0x97f831),_0x2ae4ec=await this[_0x583de5(0xc6)](_0x109638[_0x583de5(0xbc)]),_0x5aafd0=a138_0x1b85f8[_0x583de5(0x173)](_0x97f831,_0x583de5(0x159)),_0x207f53=a138_0x1b85f8[_0x583de5(0x173)](_0x97f831,_0x583de5(0x163)),_0x48f1c0=a138_0x1b85f8[_0x583de5(0x173)](_0x97f831,_0x583de5(0x128));if(!a138_0x3989b2[_0x583de5(0x18e)](_0x5aafd0))throw new SDKError(ErrorCode[_0x583de5(0x181)],_0x583de5(0x11e)+_0x97f831,undefined,{'helpText':_0x583de5(0x99)});const _0xa86b65=parseAgentYaml(a138_0x3989b2[_0x583de5(0x108)](_0x5aafd0,'utf-8'),_0x5aafd0),_0x158c34=a138_0x3989b2[_0x583de5(0x18e)](_0x207f53)?a138_0x3989b2[_0x583de5(0x108)](_0x207f53,'utf-8'):'',_0x1ae9c0=a138_0x3989b2[_0x583de5(0x18e)](_0x48f1c0)?a138_0x3989b2[_0x583de5(0x108)](_0x48f1c0,'utf-8'):_0xa86b65[_0x583de5(0x105)];if(_0xba8c83?.['dryRun'])return{'agentName':_0xa86b65[_0x583de5(0x143)],'action':_0x583de5(0x114),'projectId':_0x2ae4ec};const _0x17c535=await this[_0x583de5(0xda)][_0x583de5(0x97)](_0x2ae4ec),_0x37dd84=await fetchAllToolTargetMaps((_0x2e0c4c,_0x6f480b)=>this[_0x583de5(0xda)][_0x583de5(0x197)](_0x2e0c4c,_0x6f480b),_0x2ae4ec),_0x5144a7=new Map();for(const _0x1a55a6 of _0x17c535){_0x5144a7[_0x583de5(0xd1)](_0x1a55a6[_0x583de5(0x14d)][_0x583de5(0x143)],_0x1a55a6['id']);}const _0x2519f5=[],_0xea78bc={'projectId':_0x2ae4ec,'resolveToolTargetId':buildIdResolver({..._0x37dd84[_0x583de5(0xf4)],'Agent':_0x5144a7}),'resolvePromptId':async()=>undefined,'onWarning':_0x30c4c7=>{const _0xc32cda=_0x583de5;this[_0xc32cda(0x139)][_0xc32cda(0xe0)](_0x30c4c7),_0x2519f5['push'](_0x30c4c7);}};try{const _0x18ba9a=_0x17c535[_0x583de5(0xdd)](_0x729ab9=>_0x729ab9[_0x583de5(0x14d)]['name']===_0xa86b65['name']),_0x3e72f3=await agentDefToRequest(_0xa86b65,_0x158c34,_0x1ae9c0,_0xea78bc);if(_0x18ba9a)return await this[_0x583de5(0xda)][_0x583de5(0x15e)](_0x18ba9a['id'],_0x3e72f3),{'agentName':_0xa86b65[_0x583de5(0x143)],'action':'updated','projectId':_0x2ae4ec,'agentId':_0x18ba9a['id'],'warnings':_0x2519f5[_0x583de5(0x193)]>0x0?_0x2519f5:undefined};else{const _0x3cda0d=await this['client']['createAgentResponse'](_0x3e72f3);return{'agentName':_0xa86b65['name'],'action':'created','projectId':_0x2ae4ec,'agentId':_0x3cda0d['id'],'warnings':_0x2519f5['length']>0x0?_0x2519f5:undefined};}}catch(_0x447ac3){return{'agentName':_0xa86b65[_0x583de5(0x143)],'action':_0x583de5(0x174),'projectId':_0x2ae4ec,'error':_0x447ac3[_0x583de5(0x14f)],'warnings':_0x2519f5['length']>0x0?_0x2519f5:undefined};}}async['cloneProject'](_0x47bd8d,_0x583e22,_0xe1e864){const _0x43949b=a138_0x3b91f2,_0x5bfa50=a138_0x3989b2[_0x43949b(0x18e)](_0x47bd8d)&&a138_0x3989b2[_0x43949b(0x18e)](a138_0x1b85f8['join'](_0x47bd8d,'tdx.json'));let _0x1ba80e;const _0x496ef7=[],_0x261194=[],_0x25effd=[],_0x4aeddf=[],_0x285659=[],_0x113cb0=[],_0x5d246e=[],_0x3846c3=[],_0x1ad0de=[];if(_0x5bfa50){const _0x2c57b1=loadAgentConfig(a138_0x1b85f8[_0x43949b(0x173)](_0x47bd8d,'tdx.json'));_0x1ba80e=_0x2c57b1[_0x43949b(0xbc)];const _0x3861b3=a138_0x3989b2[_0x43949b(0x11a)](_0x47bd8d,{'withFileTypes':!![]});for(const _0x3269ef of _0x3861b3){if(!_0x3269ef[_0x43949b(0x127)]())continue;if([_0x43949b(0x16a),_0x43949b(0x183),_0x43949b(0xc0),_0x43949b(0x115),_0x43949b(0x8d),_0x43949b(0x85),_0x43949b(0x13b)][_0x43949b(0xa6)](_0x3269ef['name']))continue;const _0x20d081=a138_0x1b85f8[_0x43949b(0x173)](_0x47bd8d,_0x3269ef['name']);if(isAgentDir(_0x20d081)){const _0x3e853c=a138_0x1b85f8[_0x43949b(0x173)](_0x20d081,_0x43949b(0x159)),_0x3eff83=a138_0x1b85f8[_0x43949b(0x173)](_0x20d081,'prompt.md'),_0x5c72be=a138_0x1b85f8[_0x43949b(0x173)](_0x20d081,'starter_message.md'),_0x4b6aef=parseAgentYaml(a138_0x3989b2[_0x43949b(0x108)](_0x3e853c,_0x43949b(0xc9)),_0x3e853c),_0x29cdbe=a138_0x3989b2[_0x43949b(0x18e)](_0x3eff83)?a138_0x3989b2['readFileSync'](_0x3eff83,_0x43949b(0xc9)):'',_0xe33501=a138_0x3989b2['existsSync'](_0x5c72be)?a138_0x3989b2[_0x43949b(0x108)](_0x5c72be,_0x43949b(0xc9)):_0x4b6aef[_0x43949b(0x105)];_0x496ef7[_0x43949b(0x101)]({'name':_0x4b6aef[_0x43949b(0x143)],'dir':_0x20d081,'yaml':_0x4b6aef,'systemPrompt':_0x29cdbe,'starterMessage':_0xe33501});}}const _0x1a5090=getKnowledgeBasesDir(_0x47bd8d);if(a138_0x3989b2['existsSync'](_0x1a5090)){const _0x103ef9=a138_0x3989b2['readdirSync'](_0x1a5090);for(const _0x40418f of _0x103ef9){const _0x35a125=a138_0x1b85f8[_0x43949b(0x173)](_0x1a5090,_0x40418f);if(_0x40418f[_0x43949b(0xfa)]('.yml')){const _0x1fa4a9=parseKnowledgeBaseYaml(a138_0x3989b2[_0x43949b(0x108)](_0x35a125,_0x43949b(0xc9)),_0x35a125);_0x261194['push']({'name':_0x1fa4a9[_0x43949b(0x143)],'path':_0x35a125,'yaml':_0x1fa4a9});}else{if(_0x40418f[_0x43949b(0xfa)](_0x43949b(0x107))){const _0x305137=a138_0x3989b2['readFileSync'](_0x35a125,_0x43949b(0xc9)),{name:_0x4952d1,text:_0x32451f}=parseTextKnowledgeBaseMd(_0x305137,_0x40418f);_0x25effd[_0x43949b(0x101)]({'name':_0x4952d1,'path':_0x35a125,'text':_0x32451f});}}}}const _0x2ecefc=getPromptsDir(_0x47bd8d);if(a138_0x3989b2[_0x43949b(0x18e)](_0x2ecefc)){const _0x129171=a138_0x3989b2[_0x43949b(0x11a)](_0x2ecefc)[_0x43949b(0x152)](_0x531ce4=>_0x531ce4[_0x43949b(0xfa)]('.yml'));for(const _0x501691 of _0x129171){const _0x745929=a138_0x1b85f8[_0x43949b(0x173)](_0x2ecefc,_0x501691),_0x88f7e1=parsePromptYaml(a138_0x3989b2[_0x43949b(0x108)](_0x745929,_0x43949b(0xc9)),_0x745929);_0x4aeddf['push']({'name':_0x88f7e1['name'],'path':_0x745929,'yaml':_0x88f7e1});}}const _0x2e585d=getIntegrationsDir(_0x47bd8d);if(a138_0x3989b2['existsSync'](_0x2e585d)){const _0x1f49c7=a138_0x3989b2['readdirSync'](_0x2e585d)[_0x43949b(0x152)](_0x2048f2=>_0x2048f2[_0x43949b(0xfa)]('.yml'));for(const _0x1f83eb of _0x1f49c7){const _0x5d56e3=a138_0x1b85f8[_0x43949b(0x173)](_0x2e585d,_0x1f83eb),_0x4e2293=parseIntegrationYaml(a138_0x3989b2[_0x43949b(0x108)](_0x5d56e3,_0x43949b(0xc9)),_0x5d56e3);SAFE_INTEGRATION_TYPES[_0x43949b(0xa6)](_0x4e2293[_0x43949b(0x196)][_0x43949b(0xaa)]())?_0x285659[_0x43949b(0x101)]({'name':_0x4e2293[_0x43949b(0x143)],'path':_0x5d56e3,'yaml':_0x4e2293}):this[_0x43949b(0x139)][_0x43949b(0xe0)](_0x43949b(0xd5)+_0x4e2293[_0x43949b(0x143)]+_0x43949b(0x9c)+_0x4e2293['service_type']+_0x43949b(0x178)+(_0x43949b(0x148)+SAFE_INTEGRATION_TYPES[_0x43949b(0x173)](',\x20')+_0x43949b(0x172)));}}const _0x34cf3e=getExperimentalKnowledgeBasesDir(_0x47bd8d);if(a138_0x3989b2[_0x43949b(0x18e)](_0x34cf3e)){const _0x1b3473=a138_0x3989b2['readdirSync'](_0x34cf3e,{'withFileTypes':!![]});for(const _0x232eab of _0x1b3473){if(!_0x232eab['isDirectory']())continue;const _0x32a19a=a138_0x1b85f8[_0x43949b(0x173)](_0x34cf3e,_0x232eab[_0x43949b(0x143)]),_0x445f7d=a138_0x1b85f8[_0x43949b(0x173)](_0x32a19a,_0x232eab['name']+_0x43949b(0x13d));if(a138_0x3989b2[_0x43949b(0x18e)](_0x445f7d)){const _0x91279d=parseExperimentalKnowledgeBaseYaml(a138_0x3989b2['readFileSync'](_0x445f7d,_0x43949b(0xc9)),_0x445f7d),_0x3279c7=a138_0x1b85f8[_0x43949b(0x173)](_0x32a19a,_0x43949b(0x169)),_0x1ffda5=[];if(a138_0x3989b2['existsSync'](_0x3279c7)){const _0x3cbc25=a138_0x3989b2[_0x43949b(0x11a)](_0x3279c7,{'withFileTypes':!![]});for(const _0x500f6 of _0x3cbc25){if(!_0x500f6['isDirectory']())continue;const _0xcbaeb6=a138_0x1b85f8[_0x43949b(0x173)](_0x3279c7,_0x500f6['name']),_0x3da4ba=a138_0x1b85f8[_0x43949b(0x173)](_0xcbaeb6,_0x43949b(0xe8)),_0x55e0be=a138_0x1b85f8[_0x43949b(0x173)](_0xcbaeb6,_0x43949b(0xac));if(a138_0x3989b2[_0x43949b(0x18e)](_0x3da4ba)&&a138_0x3989b2[_0x43949b(0x18e)](_0x55e0be)){const _0x3cac22=a138_0x3989b2[_0x43949b(0x108)](_0x3da4ba,_0x43949b(0xc9)),_0x4aa5f7=a138_0x3989b2[_0x43949b(0x108)](_0x55e0be,_0x43949b(0xc9));_0x1ffda5['push']({'name':_0x500f6['name'],'code':_0x3cac22,'json_schema':_0x4aa5f7});}}}const _0x401362={..._0x91279d,'functions':_0x1ffda5};_0x113cb0[_0x43949b(0x101)]({'name':_0x91279d['name'],'path':_0x32a19a,'def':_0x401362});}}}const _0x545572=getExperimentalArtifactsDir(_0x47bd8d);if(a138_0x3989b2[_0x43949b(0x18e)](_0x545572)){const _0x438b23=a138_0x3989b2['readdirSync'](_0x545572,{'withFileTypes':!![]});for(const _0x3073f3 of _0x438b23){if(!_0x3073f3[_0x43949b(0x127)]())continue;const _0x3ada69=a138_0x1b85f8['join'](_0x545572,_0x3073f3[_0x43949b(0x143)]),_0x3426e0=a138_0x1b85f8[_0x43949b(0x173)](_0x3ada69,_0x3073f3[_0x43949b(0x143)]+_0x43949b(0x13d));if(a138_0x3989b2[_0x43949b(0x18e)](_0x3426e0)){const _0x5be85c=parseExperimentalArtifactYaml(a138_0x3989b2['readFileSync'](_0x3426e0,_0x43949b(0xc9)),_0x3426e0),_0x34ec2d=a138_0x1b85f8[_0x43949b(0x173)](_0x3ada69,'code.js'),_0x4ff325=a138_0x3989b2['existsSync'](_0x34ec2d)?a138_0x3989b2[_0x43949b(0x108)](_0x34ec2d,_0x43949b(0xc9)):'',_0x28610d=a138_0x1b85f8['join'](_0x3ada69,_0x43949b(0x177)),_0x4fc6e5=[];if(a138_0x3989b2[_0x43949b(0x18e)](_0x28610d)){const _0x202df4=a138_0x3989b2['readdirSync'](_0x28610d);for(const _0x4a34c1 of _0x202df4){const _0x44299d=a138_0x1b85f8['join'](_0x28610d,_0x4a34c1);if(a138_0x3989b2['statSync'](_0x44299d)[_0x43949b(0x188)]()){const _0x375757=a138_0x3989b2['readFileSync'](_0x44299d,'utf-8');_0x4fc6e5['push']({'file_name':_0x4a34c1,'text_content':_0x375757});}}}const _0x4d6788={..._0x5be85c,'code':_0x4ff325,'files':_0x4fc6e5};_0x5d246e[_0x43949b(0x101)]({'name':_0x5be85c[_0x43949b(0x143)],'path':_0x3ada69,'def':_0x4d6788});}}}const _0x1e37c4=getFormInterfacesDir(_0x47bd8d);if(a138_0x3989b2['existsSync'](_0x1e37c4)){const _0x8830=a138_0x3989b2[_0x43949b(0x11a)](_0x1e37c4)[_0x43949b(0x152)](_0x463185=>_0x463185[_0x43949b(0xfa)](_0x43949b(0x13d)));for(const _0xa45467 of _0x8830){const _0x5b365b=a138_0x1b85f8[_0x43949b(0x173)](_0x1e37c4,_0xa45467),_0x173e82=parseFormInterfaceYaml(a138_0x3989b2[_0x43949b(0x108)](_0x5b365b,'utf-8'),_0x5b365b);_0x3846c3[_0x43949b(0x101)]({'name':_0x173e82[_0x43949b(0x143)],'path':_0x5b365b,'yaml':_0x173e82});}}const _0x1262fb=getChatInterfacesDir(_0x47bd8d);if(a138_0x3989b2[_0x43949b(0x18e)](_0x1262fb)){const _0xef5a2a=a138_0x3989b2['readdirSync'](_0x1262fb)[_0x43949b(0x152)](_0x23df52=>_0x23df52[_0x43949b(0xfa)](_0x43949b(0x13d)));for(const _0x38f2cc of _0xef5a2a){const _0x43b461=a138_0x1b85f8[_0x43949b(0x173)](_0x1262fb,_0x38f2cc),_0xf62740=parseChatInterfaceYaml(a138_0x3989b2[_0x43949b(0x108)](_0x43b461,_0x43949b(0xc9)),_0x43b461);_0x1ad0de['push']({'name':_0xf62740[_0x43949b(0x143)],'path':_0x43b461,'yaml':_0xf62740});}}}else{const _0x4db20d=await this[_0x43949b(0xc6)](_0x47bd8d),_0x1c4412=await this[_0x43949b(0xda)][_0x43949b(0x93)](_0x4db20d);_0x1ba80e=_0x1c4412[_0x43949b(0x14d)][_0x43949b(0x143)];const _0x29f0de=await this[_0x43949b(0xda)][_0x43949b(0x97)](_0x4db20d),_0x2fc76a=await this[_0x43949b(0xda)][_0x43949b(0x138)](_0x4db20d),_0x388cb5=await this[_0x43949b(0xda)][_0x43949b(0x150)](_0x4db20d),_0x454395=await this[_0x43949b(0xda)][_0x43949b(0xf0)](_0x4db20d),_0x1e3dac=await this['client']['listIntegrations'](_0x4db20d),_0x49afad=await safeListOrEmpty(()=>this[_0x43949b(0xda)]['listExperimentalKnowledgeBases'](_0x4db20d)),_0x22f156=await safeListOrEmpty(()=>this[_0x43949b(0xda)][_0x43949b(0xc1)](_0x4db20d)),_0x1675a7=new Map(),_0xbd5a6e=new Map(),_0x3f497e=new Map(),_0x3ff016=new Map(),_0x4b046f=new Map(),_0x27566e=new Map();for(const _0x2f102b of _0x2fc76a){_0x1675a7[_0x43949b(0xd1)](_0x2f102b['id'],_0x2f102b['attributes'][_0x43949b(0x143)]);}for(const _0x5074ff of _0x388cb5){_0xbd5a6e['set'](_0x5074ff['id'],_0x5074ff[_0x43949b(0x14d)]['name']);}for(const _0x1c3254 of _0x29f0de){_0x3f497e['set'](_0x1c3254['id'],_0x1c3254[_0x43949b(0x14d)][_0x43949b(0x143)]);}for(const _0x1f58f0 of _0x454395){_0x3ff016['set'](_0x1f58f0['id'],_0x1f58f0[_0x43949b(0x14d)]['name']);}for(const _0x5649d of _0x49afad){_0x4b046f[_0x43949b(0xd1)](_0x5649d['id'],_0x5649d[_0x43949b(0x14d)][_0x43949b(0x143)]);}for(const _0x3f324f of _0x22f156){_0x27566e[_0x43949b(0xd1)](_0x3f324f['id'],_0x3f324f[_0x43949b(0x14d)][_0x43949b(0x143)]);}const _0xacfa05={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x1675a7,'TextKnowledgeBase':_0xbd5a6e,'Agent':_0x3f497e,'ExperimentalKnowledgeBase':_0x4b046f}),'resolvePromptName':async _0x1f472a=>_0x3ff016[_0x43949b(0x161)](_0x1f472a),'onWarning':_0x33e489=>this['logger']['warn'](_0x33e489)};for(const _0x37d288 of _0x29f0de){const _0x533538=await agentResponseToDef(_0x37d288,_0xacfa05),{yaml:_0x2371f9,systemPrompt:_0x12e22d,starterMessage:_0x314f29}=_0x533538;_0x496ef7[_0x43949b(0x101)]({'name':_0x2371f9[_0x43949b(0x143)],'dir':'','yaml':_0x2371f9,'systemPrompt':_0x12e22d,'starterMessage':_0x314f29});}for(const _0x498891 of _0x2fc76a){const _0x2ed62f=apiKnowledgeBaseToYaml(_0x498891);_0x261194[_0x43949b(0x101)]({'name':_0x2ed62f['name'],'path':'','yaml':_0x2ed62f});}for(const _0x5e36e4 of _0x388cb5){_0x25effd[_0x43949b(0x101)]({'name':_0x5e36e4[_0x43949b(0x14d)][_0x43949b(0x143)],'path':'','text':_0x5e36e4[_0x43949b(0x14d)][_0x43949b(0x156)]});}for(const _0x27722f of _0x454395){const _0x5719cd=await apiPromptToYaml(_0x27722f,_0xacfa05);_0x5719cd&&_0x4aeddf[_0x43949b(0x101)]({'name':_0x5719cd[_0x43949b(0x143)],'path':'','yaml':_0x5719cd});}for(const _0x581ae4 of _0x1e3dac){if(!_0x581ae4['attributes'][_0x43949b(0x12c)]&&SAFE_INTEGRATION_TYPES[_0x43949b(0xa6)](_0x581ae4['attributes'][_0x43949b(0x14b)][_0x43949b(0xaa)]())){const _0x1bf773=await apiIntegrationToYaml(_0x581ae4,_0xacfa05);_0x285659['push']({'name':_0x581ae4[_0x43949b(0x14d)][_0x43949b(0x14b)][_0x43949b(0xaa)](),'path':'','yaml':_0x1bf773});}}for(const _0x5238c3 of _0x49afad){const _0x39d488=apiExperimentalKnowledgeBaseToYaml(_0x5238c3);_0x113cb0['push']({'name':_0x39d488['name'],'path':'','def':_0x39d488});}for(const _0x9ce639 of _0x22f156){const _0x172f59=apiExperimentalArtifactToYaml(_0x9ce639);_0x5d246e[_0x43949b(0x101)]({'name':_0x172f59[_0x43949b(0x143)],'path':'','def':_0x172f59});}const _0x5ccb6d=await safeListOrEmpty(()=>this[_0x43949b(0xda)][_0x43949b(0x95)](_0x4db20d));for(const _0x4a60df of _0x5ccb6d){const _0x10425d=await apiFormInterfaceToYaml(_0x4a60df,_0xacfa05);_0x3846c3['push']({'name':_0x10425d[_0x43949b(0x143)],'path':'','yaml':_0x10425d});}const _0x140d67=await safeListOrEmpty(()=>this[_0x43949b(0xda)][_0x43949b(0x14c)](_0x4db20d));for(const _0x47e0d3 of _0x140d67){if(_0x47e0d3[_0x43949b(0x14d)][_0x43949b(0x12c)])continue;const _0x2f2552=await apiChatInterfaceToYaml(_0x47e0d3,_0xacfa05);_0x1ad0de[_0x43949b(0x101)]({'name':_0x2f2552[_0x43949b(0x143)],'path':'','yaml':_0x2f2552});}}const _0x3a8732={'sourceProjectName':_0x1ba80e,'newProjectName':_0x583e22,'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}}},_0x45cf12=await this[_0x43949b(0xda)][_0x43949b(0xed)](),_0x79000b=_0x45cf12['find'](_0x1e9aed=>_0x1e9aed['attributes'][_0x43949b(0x143)]===_0x583e22);if(_0x79000b)throw new SDKError(ErrorCode[_0x43949b(0xd7)],_0x43949b(0x120)+_0x583e22+_0x43949b(0xef),undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0xe1e864?.[_0x43949b(0xf7)])return _0x3a8732[_0x43949b(0x182)][_0x43949b(0x8a)]['created']=_0x496ef7['length'],_0x3a8732[_0x43949b(0x182)][_0x43949b(0x7b)]['created']=_0x261194[_0x43949b(0x193)],_0x3a8732[_0x43949b(0x182)][_0x43949b(0x19c)][_0x43949b(0x114)]=_0x25effd[_0x43949b(0x193)],_0x3a8732[_0x43949b(0x182)][_0x43949b(0xc7)]['created']=_0x113cb0[_0x43949b(0x193)],_0x3a8732[_0x43949b(0x182)][_0x43949b(0x18b)][_0x43949b(0x114)]=_0x5d246e['length'],_0x3a8732[_0x43949b(0x182)][_0x43949b(0x115)]['created']=_0x4aeddf[_0x43949b(0x193)],_0x3a8732[_0x43949b(0x182)][_0x43949b(0x8d)][_0x43949b(0x114)]=_0x285659['length'],_0x3a8732;const _0x2a5749=await this['client'][_0x43949b(0x17e)]({'name':_0x583e22}),_0xe9ad8f=_0x2a5749['id'];_0x3a8732[_0x43949b(0xdc)]=_0xe9ad8f;const _0x3a5096=new Map(),_0x34be5e=new Map(),_0x3d696f=new Map(),_0xa6a9fe=new Map(),_0x299663=new Map(),_0x5a2f99=new Map(),_0x514e91=new Map(),_0x76ecdb=new Map(),_0x202de2=new Set(),_0x59e266=new Set();for(const _0xbf2195 of _0x496ef7){for(const _0x3c62ee of _0xbf2195[_0x43949b(0x137)][_0x43949b(0xc5)]||[]){if(_0x3c62ee[_0x43949b(0x86)]===_0x43949b(0xab)&&_0x3c62ee[_0x43949b(0xfd)]){const _0x59af3c=parseRef(_0x3c62ee[_0x43949b(0xfd)]);if(_0x59af3c)_0x202de2[_0x43949b(0x130)](_0x59af3c[_0x43949b(0x143)]);}else{if(_0x3c62ee[_0x43949b(0x86)]===_0x43949b(0x13e)&&_0x3c62ee[_0x43949b(0xfd)]){const _0x2d6322=parseRef(_0x3c62ee[_0x43949b(0xfd)]);if(_0x2d6322)_0x59e266[_0x43949b(0x130)](_0x2d6322['name']);}}}}for(const _0x30e1d0 of _0x202de2){try{const _0x58dda9=await this[_0x43949b(0xda)]['createImageGenerator']({'projectId':_0xe9ad8f,'name':_0x30e1d0});_0x299663[_0x43949b(0xd1)](_0x30e1d0,_0x58dda9['id']),_0x3a8732[_0x43949b(0x14e)]['push']({'name':_0x30e1d0,'action':_0x43949b(0x114),'id':_0x58dda9['id']}),_0x3a8732['counts'][_0x43949b(0x14e)][_0x43949b(0x114)]++;}catch(_0x220398){_0x3a8732[_0x43949b(0x14e)][_0x43949b(0x101)]({'name':_0x30e1d0,'action':'error','error':_0x220398[_0x43949b(0x14f)]}),_0x3a8732['counts'][_0x43949b(0x14e)][_0x43949b(0x83)]++;}}for(const _0x26a702 of _0x59e266){try{const _0x5d31ea=await this[_0x43949b(0xda)]['createWebSearchTool']({'projectId':_0xe9ad8f,'name':_0x26a702});_0x5a2f99[_0x43949b(0xd1)](_0x26a702,_0x5d31ea['id']),_0x3a8732[_0x43949b(0x164)][_0x43949b(0x101)]({'name':_0x26a702,'action':_0x43949b(0x114),'id':_0x5d31ea['id']}),_0x3a8732['counts'][_0x43949b(0x164)][_0x43949b(0x114)]++;}catch(_0x5479ec){_0x3a8732[_0x43949b(0x164)]['push']({'name':_0x26a702,'action':_0x43949b(0x174),'error':_0x5479ec[_0x43949b(0x14f)]}),_0x3a8732[_0x43949b(0x182)]['webSearchTools']['errors']++;}}const _0x1c01df=await fetchAllToolTargetMaps((_0x1d6076,_0x4b8433)=>this[_0x43949b(0xda)]['listToolTargets'](_0x1d6076,_0x4b8433),_0xe9ad8f);let _0x3e8c3b=[];const _0x3f9c4f={'projectId':_0xe9ad8f,'resolveToolTargetId':buildIdResolver({..._0x1c01df[_0x43949b(0xf4)],'KnowledgeBase':_0x3a5096,'TextKnowledgeBase':_0x34be5e,'ExperimentalKnowledgeBase':_0x514e91,'Agent':_0x3d696f,'WebSearchTool':_0x5a2f99,'ImageGenerator':_0x299663}),'resolvePromptId':async _0x2df248=>_0xa6a9fe[_0x43949b(0x161)](_0x2df248),'onWarning':_0x153f5c=>{const _0x1c9040=_0x43949b;this[_0x1c9040(0x139)][_0x1c9040(0xe0)](_0x153f5c),_0x3e8c3b[_0x1c9040(0x101)](_0x153f5c);}};for(const _0x13c12d of _0x261194){try{const _0x2dd7c2=yamlKnowledgeBaseToApi(_0x13c12d[_0x43949b(0x137)],_0xe9ad8f),_0x97ef31=await this[_0x43949b(0xda)][_0x43949b(0x11d)](_0x2dd7c2);_0x3a5096[_0x43949b(0xd1)](_0x13c12d[_0x43949b(0x137)][_0x43949b(0x143)],_0x97ef31['id']),_0x3a8732['knowledgeBases'][_0x43949b(0x101)]({'name':_0x13c12d[_0x43949b(0x137)][_0x43949b(0x143)],'action':_0x43949b(0x114),'id':_0x97ef31['id']}),_0x3a8732[_0x43949b(0x182)][_0x43949b(0x7b)][_0x43949b(0x114)]++;}catch(_0x3a1aa7){_0x3a8732[_0x43949b(0x7b)]['push']({'name':_0x13c12d[_0x43949b(0x137)]['name'],'action':'error','error':_0x3a1aa7['message']}),_0x3a8732[_0x43949b(0x182)]['knowledgeBases'][_0x43949b(0x83)]++;}}for(const _0xf1fd29 of _0x25effd){try{const _0x540a78=yamlTextKnowledgeBaseToApi({'name':_0xf1fd29[_0x43949b(0x143)],'text':_0xf1fd29[_0x43949b(0x156)]},_0xe9ad8f),_0xefe1e1=await this[_0x43949b(0xda)][_0x43949b(0x7d)](_0x540a78);_0x34be5e[_0x43949b(0xd1)](_0xf1fd29[_0x43949b(0x143)],_0xefe1e1['id']),_0x3a8732[_0x43949b(0x19c)][_0x43949b(0x101)]({'name':_0xf1fd29['name'],'action':_0x43949b(0x114),'id':_0xefe1e1['id']}),_0x3a8732[_0x43949b(0x182)][_0x43949b(0x19c)][_0x43949b(0x114)]++;}catch(_0x56d7fb){_0x3a8732[_0x43949b(0x19c)][_0x43949b(0x101)]({'name':_0xf1fd29['name'],'action':'error','error':_0x56d7fb[_0x43949b(0x14f)]}),_0x3a8732[_0x43949b(0x182)][_0x43949b(0x19c)][_0x43949b(0x83)]++;}}for(const _0x2d3154 of _0x5d246e){try{const _0x54330a=yamlExperimentalArtifactToApi(_0x2d3154[_0x43949b(0x15d)],_0xe9ad8f),_0x1db255=await this[_0x43949b(0xda)][_0x43949b(0xe4)](_0x54330a);_0x76ecdb[_0x43949b(0xd1)](_0x2d3154[_0x43949b(0x15d)][_0x43949b(0x143)],_0x1db255['id']),_0x3a8732[_0x43949b(0x18b)][_0x43949b(0x101)]({'name':_0x2d3154[_0x43949b(0x15d)][_0x43949b(0x143)],'action':_0x43949b(0x114),'id':_0x1db255['id']}),_0x3a8732[_0x43949b(0x182)][_0x43949b(0x18b)][_0x43949b(0x114)]++;}catch(_0x1fcf3a){_0x3a8732['experimentalArtifacts']['push']({'name':_0x2d3154[_0x43949b(0x15d)]['name'],'action':_0x43949b(0x174),'error':_0x1fcf3a[_0x43949b(0x14f)]}),_0x3a8732[_0x43949b(0x182)][_0x43949b(0x18b)][_0x43949b(0x83)]++;}}for(const _0x38dbd8 of _0x113cb0){try{const _0x319dc3=yamlExperimentalKnowledgeBaseToApi(_0x38dbd8[_0x43949b(0x15d)],_0xe9ad8f),_0x43f015=await this[_0x43949b(0xda)][_0x43949b(0x96)](_0x319dc3);_0x514e91['set'](_0x38dbd8[_0x43949b(0x15d)]['name'],_0x43f015['id']),_0x3a8732[_0x43949b(0xc7)]['push']({'name':_0x38dbd8['def']['name'],'action':_0x43949b(0x114),'id':_0x43f015['id']}),_0x3a8732[_0x43949b(0x182)][_0x43949b(0xc7)][_0x43949b(0x114)]++;}catch(_0x2f3ff9){_0x3a8732['experimentalKnowledgeBases'][_0x43949b(0x101)]({'name':_0x38dbd8['def']['name'],'action':'error','error':_0x2f3ff9[_0x43949b(0x14f)]}),_0x3a8732[_0x43949b(0x182)][_0x43949b(0xc7)][_0x43949b(0x83)]++;}}const _0xebfcbf=[..._0x496ef7]['sort']((_0x2906ef,_0x366ae4)=>{const _0x1b25f8=_0x43949b,_0x1f26fd=_0x2906ef['yaml'][_0x1b25f8(0xc5)]?.[_0x1b25f8(0x122)](_0x321d5c=>_0x321d5c['type']===_0x1b25f8(0xd3))??![],_0x449360=_0x366ae4[_0x1b25f8(0x137)][_0x1b25f8(0xc5)]?.[_0x1b25f8(0x122)](_0x42cbda=>_0x42cbda['type']===_0x1b25f8(0xd3))??![];if(_0x1f26fd&&!_0x449360)return 0x1;if(!_0x1f26fd&&_0x449360)return-0x1;return 0x0;});for(const _0x3b90f2 of _0xebfcbf){_0x3e8c3b=[];try{const _0x537fba=_0x3b90f2[_0x43949b(0x137)][_0x43949b(0xc5)]?.[_0x43949b(0x152)](_0x3d6c39=>{const _0x218a75=_0x43949b;if(_0x3d6c39['type']===_0x218a75(0xd3)&&_0x3d6c39[_0x218a75(0xfd)]){const _0x59368e=parseRef(_0x3d6c39[_0x218a75(0xfd)]);return _0x59368e?.[_0x218a75(0x143)]===_0x3b90f2[_0x218a75(0x137)]['name'];}return![];})??[];if(_0x537fba[_0x43949b(0x193)]>0x0){const _0x2a200c='Agent\x20\x27'+_0x3b90f2[_0x43949b(0x137)][_0x43949b(0x143)]+'\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20'+_0x43949b(0x12b);this[_0x43949b(0x139)][_0x43949b(0xe0)](_0x2a200c),_0x3e8c3b[_0x43949b(0x101)](_0x2a200c);}const _0x5b18a0=await agentDefToRequest(_0x3b90f2['yaml'],_0x3b90f2[_0x43949b(0x175)],_0x3b90f2[_0x43949b(0xeb)],_0x3f9c4f),_0x5e4311=await this[_0x43949b(0xda)]['createAgentResponse'](_0x5b18a0);_0x3d696f[_0x43949b(0xd1)](_0x3b90f2[_0x43949b(0x137)][_0x43949b(0x143)],_0x5e4311['id']),_0x3a8732[_0x43949b(0x8a)][_0x43949b(0x101)]({'agentName':_0x3b90f2[_0x43949b(0x137)][_0x43949b(0x143)],'action':_0x43949b(0x114),'agentId':_0x5e4311['id'],'warnings':_0x3e8c3b[_0x43949b(0x193)]>0x0?_0x3e8c3b:undefined}),_0x3a8732[_0x43949b(0x182)]['agents'][_0x43949b(0x114)]++;}catch(_0x1c6db7){_0x3a8732[_0x43949b(0x8a)][_0x43949b(0x101)]({'agentName':_0x3b90f2[_0x43949b(0x137)][_0x43949b(0x143)],'action':_0x43949b(0x174),'error':_0x1c6db7['message'],'warnings':_0x3e8c3b[_0x43949b(0x193)]>0x0?_0x3e8c3b:undefined}),_0x3a8732['counts'][_0x43949b(0x8a)][_0x43949b(0x83)]++;}}for(const _0x2f733e of _0x4aeddf){try{const _0x198e7a=await yamlPromptToApi(_0x2f733e[_0x43949b(0x137)],_0xe9ad8f,_0x3f9c4f);if(!_0x198e7a){_0x3a8732[_0x43949b(0x115)]['push']({'name':_0x2f733e[_0x43949b(0x137)][_0x43949b(0x143)],'action':_0x43949b(0x174),'error':_0x43949b(0x121)}),_0x3a8732[_0x43949b(0x182)]['prompts'][_0x43949b(0x83)]++;continue;}const _0x2841c2=await this[_0x43949b(0xda)][_0x43949b(0x155)](_0x198e7a);_0xa6a9fe[_0x43949b(0xd1)](_0x2f733e[_0x43949b(0x137)][_0x43949b(0x143)],_0x2841c2['id']),_0x3a8732[_0x43949b(0x115)][_0x43949b(0x101)]({'name':_0x2f733e[_0x43949b(0x137)][_0x43949b(0x143)],'action':'created','id':_0x2841c2['id']}),_0x3a8732[_0x43949b(0x182)][_0x43949b(0x115)]['created']++;}catch(_0xacf4a3){_0x3a8732[_0x43949b(0x115)][_0x43949b(0x101)]({'name':_0x2f733e[_0x43949b(0x137)][_0x43949b(0x143)],'action':_0x43949b(0x174),'error':_0xacf4a3[_0x43949b(0x14f)]}),_0x3a8732[_0x43949b(0x182)][_0x43949b(0x115)][_0x43949b(0x83)]++;}}for(const _0x50d8d6 of _0x285659){try{const _0x2f2d21=await yamlIntegrationToApi(_0x50d8d6[_0x43949b(0x137)],_0xe9ad8f,_0x3f9c4f),_0x1dfae2=await this[_0x43949b(0xda)][_0x43949b(0x18d)](_0x2f2d21);_0x3a8732[_0x43949b(0x8d)]['push']({'name':_0x50d8d6[_0x43949b(0x137)][_0x43949b(0x196)],'action':_0x43949b(0x114),'id':_0x1dfae2['id']}),_0x3a8732['counts'][_0x43949b(0x8d)][_0x43949b(0x114)]++;}catch(_0x424a7e){_0x3a8732[_0x43949b(0x8d)]['push']({'name':_0x50d8d6['yaml'][_0x43949b(0x196)],'action':'error','error':_0x424a7e['message']}),_0x3a8732[_0x43949b(0x182)][_0x43949b(0x8d)]['errors']++;}}for(const _0x461ca9 of _0x3846c3){try{const _0x53f118=await yamlFormInterfaceToApi(_0x461ca9[_0x43949b(0x137)],_0xe9ad8f,_0x3f9c4f);if(!_0x53f118){_0x3a8732[_0x43949b(0x133)][_0x43949b(0x101)]({'name':_0x461ca9[_0x43949b(0x137)]['name'],'action':_0x43949b(0x174),'error':_0x43949b(0x8c)}),_0x3a8732[_0x43949b(0x182)][_0x43949b(0x133)][_0x43949b(0x83)]++;continue;}const _0x45b9be=await this[_0x43949b(0xda)][_0x43949b(0x10a)](_0x53f118);_0x3a8732['formInterfaces']['push']({'name':_0x461ca9[_0x43949b(0x137)][_0x43949b(0x143)],'action':_0x43949b(0x114),'id':_0x45b9be['id']}),_0x3a8732[_0x43949b(0x182)][_0x43949b(0x133)][_0x43949b(0x114)]++;}catch(_0x2e9f22){_0x3a8732[_0x43949b(0x133)][_0x43949b(0x101)]({'name':_0x461ca9['yaml'][_0x43949b(0x143)],'action':_0x43949b(0x174),'error':_0x2e9f22[_0x43949b(0x14f)]}),_0x3a8732[_0x43949b(0x182)][_0x43949b(0x133)][_0x43949b(0x83)]++;}}for(const _0x2cdb91 of _0x1ad0de){try{const _0x3d6dd2=await yamlChatInterfaceToApi(_0x2cdb91['yaml'],_0xe9ad8f,_0x3f9c4f),_0x2867d6=await this['client'][_0x43949b(0x14a)](_0x3d6dd2);_0x3a8732[_0x43949b(0xbb)][_0x43949b(0x101)]({'name':_0x2cdb91['yaml'][_0x43949b(0x143)],'action':_0x43949b(0x114),'id':_0x2867d6['id']}),_0x3a8732[_0x43949b(0x182)][_0x43949b(0xbb)][_0x43949b(0x114)]++;}catch(_0x3e00b9){_0x3a8732[_0x43949b(0xbb)][_0x43949b(0x101)]({'name':_0x2cdb91[_0x43949b(0x137)][_0x43949b(0x143)],'action':'error','error':_0x3e00b9['message']}),_0x3a8732[_0x43949b(0x182)]['chatInterfaces'][_0x43949b(0x83)]++;}}return _0x3a8732;}}
1
+ const a138_0xec2434=a138_0x4c79;function a138_0x4c79(_0x1cb9ab,_0x405b83){_0x1cb9ab=_0x1cb9ab-0xb6;const _0x5d467e=a138_0x5d46();let _0x4c79f2=_0x5d467e[_0x1cb9ab];return _0x4c79f2;}(function(_0x573faf,_0x7b90d0){const _0xf53a73=a138_0x4c79,_0x30909f=_0x573faf();while(!![]){try{const _0x4dd4bb=-parseInt(_0xf53a73(0x19a))/0x1+parseInt(_0xf53a73(0x18a))/0x2+parseInt(_0xf53a73(0x149))/0x3*(parseInt(_0xf53a73(0x195))/0x4)+-parseInt(_0xf53a73(0xbb))/0x5+parseInt(_0xf53a73(0xde))/0x6+parseInt(_0xf53a73(0x127))/0x7+-parseInt(_0xf53a73(0x16e))/0x8*(parseInt(_0xf53a73(0x10a))/0x9);if(_0x4dd4bb===_0x7b90d0)break;else _0x30909f['push'](_0x30909f['shift']());}catch(_0x4f25e6){_0x30909f['push'](_0x30909f['shift']());}}}(a138_0x5d46,0xef05b));import{LLMApiClient}from'../client/llm-api-client.js';import*as a138_0x1c3d61 from'node:fs';import*as a138_0x2da90b 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';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=[a138_0xec2434(0x16a),a138_0xec2434(0x140),a138_0xec2434(0x193)];async function safeListOrEmpty(_0x297c23){const _0x11c650=a138_0xec2434;try{return await _0x297c23();}catch(_0x2976fd){if(_0x2976fd instanceof HTTPClientError&&_0x2976fd[_0x11c650(0x130)]===0x194)return[];throw _0x2976fd;}}export class LLMSDK{[a138_0xec2434(0x132)];[a138_0xec2434(0x19c)];[a138_0xec2434(0xd8)];[a138_0xec2434(0xb9)]=Logger['of'](a138_0xec2434(0x147));constructor(_0x287eb7){const _0x4909f2=a138_0xec2434;this[_0x4909f2(0x19c)]=new LLMApiClient(_0x287eb7),this[_0x4909f2(0xd8)]=_0x287eb7;}['getDefaultProjectName'](){const _0x5ed562=getSanitizedUsername();return'tdx_default_'+_0x5ed562;}async['setCurrentProject'](_0x546c13){const _0x203c4f=a138_0xec2434,{projectId:_0xc84456}=await this[_0x203c4f(0x17c)](_0x546c13);this[_0x203c4f(0x132)]=_0xc84456;}[a138_0xec2434(0xe6)](){const _0x56aa3a=a138_0xec2434;return this[_0x56aa3a(0x132)];}async['setDefaultAgent'](_0x1a67e3){const _0x71317d=a138_0xec2434,_0x2e1c9d=this[_0x71317d(0xd8)]['profile'];let _0x50b679,_0x1bfa0f;if(_0x1a67e3[_0x71317d(0x158)]('/')){const _0x161d9c=_0x1a67e3['split']('/');if(_0x161d9c[_0x71317d(0xed)]!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x71317d(0x10f)+_0x1a67e3,undefined,{'helpText':_0x71317d(0x1ce)});const [_0x544f3a,_0xe26d40]=_0x161d9c;_0x50b679=await this['resolveProjectId'](_0x544f3a),_0x1bfa0f=_0xe26d40;}else _0x50b679=this[_0x71317d(0x132)]||(await this[_0x71317d(0x18f)]())['id'],_0x1bfa0f=_0x1a67e3;const _0x3f542c=await this['resolveAgentId'](_0x1bfa0f,_0x50b679),_0x4fdf5d=await this[_0x71317d(0x19c)][_0x71317d(0x172)](_0x3f542c);writeCachedLLMAgent(_0x4fdf5d[_0x71317d(0x178)][_0x71317d(0x11d)],_0x3f542c,_0x50b679,_0x2e1c9d);}[a138_0xec2434(0x167)](){const _0x21ec54=a138_0xec2434,_0x4a397d=this[_0x21ec54(0xd8)][_0x21ec54(0xc7)];return readCachedLLMAgent(_0x4a397d)||undefined;}[a138_0xec2434(0xdf)](){const _0x16b154=a138_0xec2434,_0x49139d=this[_0x16b154(0xd8)][_0x16b154(0xc7)];clearCachedLLMAgent(_0x49139d);}async['models'](){const _0x49b5fa=a138_0xec2434,_0x31c33c=await this['client'][_0x49b5fa(0xdb)]();return toModelInfos(_0x31c33c);}async['createProject'](_0x1a5c8d){const _0x2284f6=a138_0xec2434;return await this[_0x2284f6(0x19c)][_0x2284f6(0x143)](_0x1a5c8d);}async['deleteProject'](_0x23ae9b){const _0x159570=a138_0xec2434,{projectId:_0x6fd955}=await this[_0x159570(0x17c)](_0x23ae9b);await this['client']['deleteProject'](_0x6fd955);}async[a138_0xec2434(0xbf)](_0x5c3cba=0x32){const _0xfa3e0b=a138_0xec2434;return await this[_0xfa3e0b(0x19c)][_0xfa3e0b(0x129)](_0x5c3cba);}async['getOrCreateDefaultProject'](_0x19f1c8){const _0x5a900d=a138_0xec2434,_0x8c883e=_0x19f1c8||this[_0x5a900d(0x1d1)](),_0x5bb2ab=this['context'][_0x5a900d(0xc7)];if(!_0x19f1c8){const _0xfe83ef=readCachedLLMProject(_0x5bb2ab);if(_0xfe83ef&&_0xfe83ef[_0x5a900d(0x11d)]===_0x8c883e)try{const _0x263694=await this['client'][_0x5a900d(0xf7)](_0xfe83ef['id']);if(_0x263694[_0x5a900d(0x178)]['name']===_0x8c883e)return _0x263694;}catch{}}const _0x198b57=await this[_0x5a900d(0x19c)][_0x5a900d(0x129)](),_0x2ebabc=_0x198b57[_0x5a900d(0x190)](_0x492cd5=>_0x492cd5[_0x5a900d(0x178)][_0x5a900d(0x11d)]===_0x8c883e);if(_0x2ebabc)return!_0x19f1c8&&writeCachedLLMProject(_0x8c883e,_0x2ebabc['id'],_0x5bb2ab),_0x2ebabc;const _0x9d15df=await this[_0x5a900d(0x19c)][_0x5a900d(0x143)]({'name':_0x8c883e,'description':_0x5a900d(0x1a0)+getSanitizedUsername()+')'});return!_0x19f1c8&&writeCachedLLMProject(_0x8c883e,_0x9d15df['id'],_0x5bb2ab),_0x9d15df;}async[a138_0xec2434(0xe8)](_0xb3bb5b){const _0xfbe1e2=a138_0xec2434,_0x3eb8f3=await this['client'][_0xfbe1e2(0x129)](),_0x3a5b5a=_0x3eb8f3[_0xfbe1e2(0x17e)](_0x94bbe5=>_0x94bbe5[_0xfbe1e2(0x178)][_0xfbe1e2(0x11d)]===_0xb3bb5b);if(_0x3a5b5a[_0xfbe1e2(0xed)]===0x0)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0xb3bb5b,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x3a5b5a[_0xfbe1e2(0xed)]>0x1)throw new SDKError(ErrorCode[_0xfbe1e2(0xe5)],_0xfbe1e2(0x1cd)+_0xb3bb5b+'\x27.\x20This\x20should\x20not\x20happen.');return _0x3a5b5a[0x0]['id'];}async[a138_0xec2434(0x17c)](_0x2f2715){const _0xd01782=a138_0xec2434,_0x339ff3=await this[_0xd01782(0x19c)][_0xd01782(0x129)](),_0x5dce47=_0x339ff3['find'](_0x3616a9=>_0x3616a9[_0xd01782(0x178)][_0xd01782(0x11d)]===_0x2f2715);if(_0x5dce47)return{'projectId':_0x5dce47['id'],'project':_0x5dce47};throw new SDKError(ErrorCode[_0xd01782(0xf8)],_0xd01782(0x100)+_0x2f2715,undefined,{'helpText':_0xd01782(0xc4)});}async[a138_0xec2434(0x19b)](_0x410ba8=a138_0xec2434(0x15c),_0x5e7abf=0x0,_0x59213b){const _0x85d84a=a138_0xec2434,_0x13eb76=0xa;let _0x2229f9=0x0,_0x342ef5;while(_0x2229f9<_0x13eb76){try{const _0x29d7ae=await this[_0x85d84a(0x18f)](_0x342ef5),_0x4f8a83=_0x29d7ae['id'],_0x51cb8c=[_0x85d84a(0x1a1),_0x85d84a(0x1aa),_0x85d84a(0x18b),_0x85d84a(0x122),'high'],_0x4e3c7a=_0x5e7abf===0x0?_0x85d84a(0xe2)+_0x410ba8:'tdx_'+_0x410ba8+_0x85d84a(0xba)+_0x51cb8c[_0x5e7abf],_0x56fbdd=await this[_0x85d84a(0x19c)][_0x85d84a(0x124)](_0x4f8a83),_0x40ee93=_0x56fbdd[_0x85d84a(0x190)](_0x3fbe39=>_0x3fbe39[_0x85d84a(0x178)]['name']===_0x4e3c7a);if(_0x40ee93)return _0x40ee93;const _0x2fda97=_0x5e7abf>0x0?0x1:_0x59213b;return await this[_0x85d84a(0x19c)]['createAgent']({'name':_0x4e3c7a,'projectId':_0x4f8a83,'modelType':_0x410ba8,'systemPrompt':'','temperature':_0x2fda97,'reasoningEffort':_0x5e7abf>0x0?_0x5e7abf:undefined});}catch(_0x10d527){if(_0x10d527 instanceof HTTPClientError){const _0x5ca863=_0x10d527['status'];if(_0x5ca863>=0x190&&_0x5ca863<0x1f4){if(_0x5ca863===0x191)throw new SDKError(ErrorCode[_0x85d84a(0x1dc)],_0x85d84a(0x145),_0x10d527);else{if(_0x5ca863===0x193)throw new SDKError(ErrorCode[_0x85d84a(0x163)],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x10d527);}throw _0x10d527;}}if(errorContains(_0x10d527,_0x85d84a(0x1ab),_0x85d84a(0xd3),_0x85d84a(0x1b2))){_0x2229f9++;if(_0x2229f9>=_0x13eb76)throw new SDKError(ErrorCode[_0x85d84a(0x1ba)],_0x85d84a(0xd4)+_0x13eb76+_0x85d84a(0x1ca),_0x10d527);const _0x1270df=this['getDefaultProjectName']();_0x342ef5=_0x1270df+'_'+generateRandomHex();continue;}throw _0x10d527;}}throw new SDKError(ErrorCode['INTERNAL'],_0x85d84a(0x1b5));}async[a138_0xec2434(0x1ad)](_0xe7d3a8,_0x1a290b){const _0x545ec4=a138_0xec2434,_0x5279ba=_0x1a290b||this[_0x545ec4(0x132)],_0x3bd40c=await this[_0x545ec4(0x19c)][_0x545ec4(0x124)](_0x5279ba),_0x3f8b00=_0x3bd40c[_0x545ec4(0x17e)](_0x12c932=>_0x12c932[_0x545ec4(0x178)][_0x545ec4(0x11d)]===_0xe7d3a8);if(_0x3f8b00[_0x545ec4(0xed)]===0x0){const _0xe979b2=_0x5279ba?'\x20in\x20project\x20'+_0x5279ba:'';throw new SDKError(ErrorCode[_0x545ec4(0x196)],'Agent\x20not\x20found:\x20'+_0xe7d3a8+_0xe979b2,undefined,{'helpText':_0x5279ba?_0x545ec4(0x1d3):_0x545ec4(0x17a)});}if(_0x3f8b00['length']>0x1)throw new SDKError(ErrorCode[_0x545ec4(0xe5)],_0x545ec4(0x17b)+_0xe7d3a8+'\x27.\x20This\x20should\x20not\x20happen.');return _0x3f8b00[0x0]['id'];}async[a138_0xec2434(0x15e)](_0x49b0ca){const _0x259629=a138_0xec2434,_0x376cce=_0x49b0ca||this[_0x259629(0x132)];return await this['client'][_0x259629(0x124)](_0x376cce);}async[a138_0xec2434(0x187)](_0xcdbd50){const _0x7d8b6b=a138_0xec2434;return await this[_0x7d8b6b(0x19c)][_0x7d8b6b(0x1af)](_0xcdbd50);}async[a138_0xec2434(0x12c)](_0x49511d){const _0x22e80f=a138_0xec2434;return await this[_0x22e80f(0x19c)][_0x22e80f(0x172)](_0x49511d);}async[a138_0xec2434(0x144)](_0x3c405d){const _0x160404=a138_0xec2434;return await this['client'][_0x160404(0x144)](_0x3c405d);}async[a138_0xec2434(0x1a6)](_0xedb324,_0x3eea37){const _0x1d34a8=a138_0xec2434;return await this[_0x1d34a8(0x19c)][_0x1d34a8(0x1a6)](_0xedb324,_0x3eea37);}async['deleteAgent'](_0x40bff1){await this['client']['deleteAgent'](_0x40bff1);}async[a138_0xec2434(0x1a8)](_0x1b1510){return await this['client']['startChat']({'agentId':_0x1b1510});}async*['chat'](_0x352109,_0xb2be0c){const _0x5542d9=a138_0xec2434;let _0x136272=_0xb2be0c?.['chatId'];const _0x5dcdd1=_0xb2be0c?.[_0x5542d9(0x14e)];if(!_0x136272){if(!_0x5dcdd1)throw new Error(_0x5542d9(0x13a));const _0x103585=await this['client']['startChat']({'agentId':_0x5dcdd1});_0x136272=_0x103585['id'],yield{'type':_0x5542d9(0x108),'data':{'chatId':_0x136272,'agentId':_0x5dcdd1,'projectId':_0x103585['attributes'][_0x5542d9(0x157)]}};}for await(const _0x471003 of this[_0x5542d9(0x19c)]['continueChat'](_0x136272,_0x352109,_0xb2be0c?.[_0x5542d9(0x19f)])){yield{'type':_0x5542d9(0x126),'data':_0x471003};}}async[a138_0xec2434(0x1c2)](_0x42931f=0x32){const _0x32f839=a138_0xec2434;return await this['client'][_0x32f839(0x155)](_0x42931f);}async[a138_0xec2434(0xc9)](_0x51c072){const _0x4d3072=a138_0xec2434;return await this[_0x4d3072(0x19c)][_0x4d3072(0x19e)](_0x51c072);}async[a138_0xec2434(0xfb)](_0x57af90){const _0xa33bcd=a138_0xec2434;return await this[_0xa33bcd(0x19c)]['getChatLog'](_0x57af90);}async[a138_0xec2434(0x115)](_0x537571){const _0x3ccecd=a138_0xec2434;return await this[_0x3ccecd(0x19c)][_0x3ccecd(0xcc)](_0x537571);}async[a138_0xec2434(0x12d)](_0x4eea12,_0x3cdb5b,_0x250d46){const _0x32d8ee=a138_0xec2434,_0x1ce84b=_0x250d46?.[_0x32d8ee(0x174)]??![],{projectId:_0x2921f6,project:_0x31fb38}=await this[_0x32d8ee(0x17c)](_0x4eea12),_0x2577a8=_0x31fb38[_0x32d8ee(0x178)][_0x32d8ee(0x11d)],_0x2caa84=_0x3cdb5b||_0x2577a8+_0x32d8ee(0x18c);if(a138_0x1c3d61[_0x32d8ee(0xfe)](_0x2caa84)&&!_0x1ce84b)throw new SDKError(ErrorCode[_0x32d8ee(0x1ba)],_0x32d8ee(0xf4)+_0x2caa84,undefined,{'helpText':_0x32d8ee(0x11b)});const _0x19474f=await this['client'][_0x32d8ee(0x1af)](_0x2921f6),_0x281de0=await this[_0x32d8ee(0x19c)][_0x32d8ee(0xef)](_0x2921f6),_0x425217=await this[_0x32d8ee(0x19c)][_0x32d8ee(0x181)](_0x2921f6),_0x1df9d9=await this[_0x32d8ee(0x19c)]['listIntegrations'](_0x2921f6);if(!_0x1ce84b){a138_0x1c3d61[_0x32d8ee(0xd9)](_0x2caa84,{'recursive':!![]});const _0x108576={'version':_0x32d8ee(0x17d),'exportedAt':new Date()[_0x32d8ee(0x14f)](),'exportedFrom':{'site':this[_0x32d8ee(0xd8)][_0x32d8ee(0xc0)],'projectId':_0x2921f6,'projectName':_0x2577a8},'project':_0x31fb38};a138_0x1c3d61[_0x32d8ee(0x183)](a138_0x2da90b[_0x32d8ee(0x1cc)](_0x2caa84,_0x32d8ee(0x189)),JSON[_0x32d8ee(0x116)](_0x108576,null,0x2)),a138_0x1c3d61[_0x32d8ee(0x183)](a138_0x2da90b[_0x32d8ee(0x1cc)](_0x2caa84,_0x32d8ee(0x188)),JSON['stringify'](_0x19474f,null,0x2)),a138_0x1c3d61['writeFileSync'](a138_0x2da90b[_0x32d8ee(0x1cc)](_0x2caa84,'knowledgebases.json'),JSON[_0x32d8ee(0x116)](_0x281de0,null,0x2)),a138_0x1c3d61[_0x32d8ee(0x183)](a138_0x2da90b['join'](_0x2caa84,_0x32d8ee(0x10b)),JSON['stringify'](_0x425217,null,0x2)),a138_0x1c3d61[_0x32d8ee(0x183)](a138_0x2da90b['join'](_0x2caa84,_0x32d8ee(0x173)),JSON[_0x32d8ee(0x116)](_0x1df9d9,null,0x2));}return{'projectName':_0x2577a8,'outputDir':_0x2caa84,'counts':{'agents':_0x19474f['length'],'knowledgeBases':_0x281de0['length'],'prompts':_0x425217[_0x32d8ee(0xed)],'integrations':_0x1df9d9[_0x32d8ee(0xed)]}};}async[a138_0xec2434(0x12a)](_0x4db5c6,_0x3f4ace){const _0x4c617c=a138_0xec2434,_0x1f35df=_0x3f4ace?.[_0x4c617c(0x174)]??![],_0xdf8986=this[_0x4c617c(0x15a)](_0x4db5c6),_0x5e65b9=_0xdf8986[_0x4c617c(0x186)][_0x4c617c(0xc0)],_0x227edc=this['context'][_0x4c617c(0xc0)],_0x713c2b=_0x5e65b9!==_0x227edc?_0x5e65b9:undefined,_0x8a985c=this['loadJsonFile'](a138_0x2da90b[_0x4c617c(0x1cc)](_0x4db5c6,_0x4c617c(0x188)),[]),_0x2af8b9=this['loadJsonFile'](a138_0x2da90b['join'](_0x4db5c6,'knowledgebases.json'),[]),_0x15edcc=this[_0x4c617c(0x198)](a138_0x2da90b[_0x4c617c(0x1cc)](_0x4db5c6,_0x4c617c(0x10b)),[]),_0x7ec985=this[_0x4c617c(0x198)](a138_0x2da90b[_0x4c617c(0x1cc)](_0x4db5c6,_0x4c617c(0x173)),[]),_0x1fd660=_0x3f4ace?.['name']||_0xdf8986[_0x4c617c(0x186)][_0x4c617c(0x113)];if(_0x1f35df){const _0x3bee00=new Map(),_0x4d66bc=[..._0x8a985c],_0x1f1264=_0x8a985c[_0x4c617c(0xed)]+0x1;let _0xdccdff=0x0;while(_0x4d66bc[_0x4c617c(0xed)]>0x0&&_0xdccdff<_0x1f1264){_0xdccdff++;const _0x352375=[];for(const _0x2afbdf of _0x4d66bc){canCreateAgent(_0x2afbdf,_0x3bee00)?_0x3bee00['set'](_0x2afbdf['id'],_0x4c617c(0x1cb)+_0x2afbdf['id']):_0x352375['push'](_0x2afbdf);}if(_0x352375[_0x4c617c(0xed)]===_0x4d66bc[_0x4c617c(0xed)])throw new SDKError(ErrorCode[_0x4c617c(0xe5)],_0x4c617c(0x15d),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x4d66bc[_0x4c617c(0xed)]=0x0,_0x4d66bc[_0x4c617c(0x1b9)](..._0x352375);}const _0x3281f6=_0x15edcc['filter'](_0x564853=>_0x3bee00[_0x4c617c(0xee)](_0x564853[_0x4c617c(0x178)][_0x4c617c(0x14e)]))[_0x4c617c(0xed)];return{'projectName':_0x1fd660,'projectId':_0x4c617c(0x134),'counts':{'agents':_0x8a985c[_0x4c617c(0xed)],'knowledgeBases':_0x2af8b9[_0x4c617c(0xed)],'prompts':_0x3281f6,'integrations':_0x7ec985[_0x4c617c(0xed)]},'sourceSite':_0x713c2b};}const _0x363eb7=await this['client']['createProject']({'name':_0x1fd660,'description':_0xdf8986[_0x4c617c(0xc2)][_0x4c617c(0x178)][_0x4c617c(0xd5)]}),_0x5318ce=_0x363eb7['id'],_0x2f29a3=new Map(),_0x5a3c7e=new Map(),_0x3b8692=new Map();for(const _0x1c0bff of _0x2af8b9){const _0x37ea38=await this[_0x4c617c(0x19c)][_0x4c617c(0xe1)]({'projectId':_0x5318ce,'name':_0x1c0bff[_0x4c617c(0x178)][_0x4c617c(0x11d)],'tdDatabaseName':_0x1c0bff[_0x4c617c(0x178)][_0x4c617c(0x18e)],'tables':_0x1c0bff[_0x4c617c(0x178)][_0x4c617c(0xc5)]});_0x2f29a3[_0x4c617c(0x14d)](_0x1c0bff['id'],_0x37ea38['id']);}const _0x5a5ea6=[..._0x8a985c],_0x414ca2=_0x8a985c['length']+0x1;let _0x256e28=0x0;while(_0x5a5ea6[_0x4c617c(0xed)]>0x0&&_0x256e28<_0x414ca2){_0x256e28++;const _0x3064eb=[];for(const _0x1a48f3 of _0x5a5ea6){if(canCreateAgent(_0x1a48f3,_0x5a3c7e)){const _0x192c1d=remapToolIds(_0x1a48f3[_0x4c617c(0x178)][_0x4c617c(0xd0)],_0x2f29a3,_0x5a3c7e),_0x5b27c5=remapVariableIds(_0x1a48f3[_0x4c617c(0x178)][_0x4c617c(0x199)],_0x2f29a3),_0x110ee3=await this[_0x4c617c(0x19c)][_0x4c617c(0xc3)]({'name':_0x1a48f3['attributes'][_0x4c617c(0x11d)],'projectId':_0x5318ce,'systemPrompt':_0x1a48f3[_0x4c617c(0x178)][_0x4c617c(0x182)],'starterMessage':_0x1a48f3['attributes'][_0x4c617c(0x118)],'modelType':migrateModelType(_0x1a48f3[_0x4c617c(0x178)][_0x4c617c(0x16f)]),'maxToolIterations':_0x1a48f3[_0x4c617c(0x178)]['maxToolIterations'],'temperature':_0x1a48f3[_0x4c617c(0x178)][_0x4c617c(0x1db)],'reasoningEffort':_0x1a48f3['attributes'][_0x4c617c(0x13f)],'outputs':_0x1a48f3['attributes'][_0x4c617c(0x12b)],'tools':_0x192c1d,'variables':_0x5b27c5});_0x5a3c7e[_0x4c617c(0x14d)](_0x1a48f3['id'],_0x110ee3['id']);}else _0x3064eb['push'](_0x1a48f3);}if(_0x3064eb['length']===_0x5a5ea6['length'])throw new SDKError(ErrorCode[_0x4c617c(0xe5)],_0x4c617c(0x15d),undefined,{'helpText':_0x4c617c(0xce)});_0x5a5ea6[_0x4c617c(0xed)]=0x0,_0x5a5ea6[_0x4c617c(0x1b9)](..._0x3064eb);}for(const _0x27b6de of _0x15edcc){const _0x2b8356=_0x5a3c7e[_0x4c617c(0x141)](_0x27b6de[_0x4c617c(0x178)][_0x4c617c(0x14e)]);if(!_0x2b8356)continue;const _0x1ccd2e=await this[_0x4c617c(0x19c)][_0x4c617c(0x1d8)]({'projectId':_0x5318ce,'agentId':_0x2b8356,'name':_0x27b6de['attributes'][_0x4c617c(0x11d)],'systemPrompt':_0x27b6de[_0x4c617c(0x178)]['systemPrompt'],'template':_0x27b6de[_0x4c617c(0x178)][_0x4c617c(0xf9)],'jsonSchemaHint':_0x27b6de[_0x4c617c(0x178)][_0x4c617c(0x16b)]});_0x3b8692[_0x4c617c(0x14d)](_0x27b6de['id'],_0x1ccd2e['id']);}for(const _0x2acec1 of _0x7ec985){const _0x37a3cc=_0x2acec1[_0x4c617c(0x178)]['actions'][_0x4c617c(0x1ae)](_0x359324=>({..._0x359324,'promptId':_0x3b8692['get'](_0x359324[_0x4c617c(0xd2)])||_0x359324[_0x4c617c(0xd2)]}));await this[_0x4c617c(0x19c)][_0x4c617c(0xd7)]({'projectId':_0x5318ce,'serviceType':_0x2acec1[_0x4c617c(0x178)][_0x4c617c(0x1c9)],'actions':_0x37a3cc,'slackMessageMode':_0x2acec1[_0x4c617c(0x178)][_0x4c617c(0x1d9)],'chatIgnoreManagedActions':_0x2acec1['attributes'][_0x4c617c(0x160)],'chatWelcomeMessage':_0x2acec1[_0x4c617c(0x178)][_0x4c617c(0x1d2)],'webhookCorsOrigins':_0x2acec1[_0x4c617c(0x178)][_0x4c617c(0x106)]});}return{'projectName':_0x1fd660,'projectId':_0x5318ce,'counts':{'agents':_0x5a3c7e[_0x4c617c(0x169)],'knowledgeBases':_0x2f29a3[_0x4c617c(0x169)],'prompts':_0x3b8692[_0x4c617c(0x169)],'integrations':_0x7ec985[_0x4c617c(0xed)]},'sourceSite':_0x713c2b};}[a138_0xec2434(0x198)](_0x126300,_0x20c325){const _0x387f86=a138_0xec2434;if(!a138_0x1c3d61[_0x387f86(0xfe)](_0x126300))return _0x20c325;return JSON['parse'](a138_0x1c3d61['readFileSync'](_0x126300,_0x387f86(0xcf)));}[a138_0xec2434(0x15a)](_0x10ef69){const _0x318bb0=a138_0xec2434;if(!a138_0x1c3d61[_0x318bb0(0xfe)](_0x10ef69))throw new SDKError(ErrorCode[_0x318bb0(0x1c0)],_0x318bb0(0x109)+_0x10ef69,undefined,{'helpText':'Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.'});const _0x2e9af0=a138_0x2da90b[_0x318bb0(0x1cc)](_0x10ef69,'project.json');if(!a138_0x1c3d61[_0x318bb0(0xfe)](_0x2e9af0))throw new SDKError(ErrorCode[_0x318bb0(0x148)],_0x318bb0(0xda)+_0x10ef69,undefined,{'helpText':_0x318bb0(0x152)});const _0xaf342c=JSON['parse'](a138_0x1c3d61[_0x318bb0(0x1bc)](_0x2e9af0,_0x318bb0(0xcf)));if(!isSupportedBackupVersion(_0xaf342c[_0x318bb0(0x1c4)]))throw new SDKError(ErrorCode[_0x318bb0(0x148)],_0x318bb0(0x1c6)+_0xaf342c[_0x318bb0(0x1c4)],undefined,{'helpText':_0x318bb0(0x13e)});return _0xaf342c;}async[a138_0xec2434(0xe4)](_0x4cdff9,_0xd9920d,_0x5dd203){const _0x473f95=a138_0xec2434,{projectId:_0x21f5dc,project:_0x184553}=await this['resolveProjectName'](_0x4cdff9),_0x48915a=_0x184553['attributes'][_0x473f95(0x11d)];let _0x4999e9;if(_0xd9920d)_0x4999e9=_0xd9920d;else{const _0x2e9c6d=a138_0x2da90b[_0x473f95(0x1cc)](process[_0x473f95(0x14b)](),_0x473f95(0x15e)),_0x545a28=getSanitizedPathWithMigration(_0x2e9c6d,_0x48915a);_0x545a28['renamed']&&this[_0x473f95(0xb9)][_0x473f95(0x1bb)](_0x473f95(0x1d7)+a138_0x2da90b[_0x473f95(0x128)](_0x545a28[_0x473f95(0x1b3)])+_0x473f95(0x136)+a138_0x2da90b[_0x473f95(0x128)](_0x545a28['path'])),_0x4999e9=_0x545a28[_0x473f95(0xe7)];}const _0x5afdb6=await this[_0x473f95(0x19c)][_0x473f95(0x1af)](_0x21f5dc),_0x136ee7=await this[_0x473f95(0x19c)][_0x473f95(0xef)](_0x21f5dc),_0x186640=await this['client']['listTextKnowledgeBases'](_0x21f5dc),_0x189e65=await safeListOrEmpty(()=>this[_0x473f95(0x19c)]['listImageGenerators'](_0x21f5dc)),_0x34c325=await safeListOrEmpty(()=>this[_0x473f95(0x19c)][_0x473f95(0x1b1)](_0x21f5dc)),_0x529e6b=await this['client'][_0x473f95(0x181)](_0x21f5dc),_0x131b61=await this['client'][_0x473f95(0xc8)](_0x21f5dc),_0x27f906=await safeListOrEmpty(()=>this['client'][_0x473f95(0x1d4)](_0x21f5dc)),_0x56631d=await safeListOrEmpty(()=>this[_0x473f95(0x19c)][_0x473f95(0xf0)](_0x21f5dc)),_0x319816=await safeListOrEmpty(()=>this[_0x473f95(0x19c)][_0x473f95(0x1b8)](_0x21f5dc)),_0x29c1d3=await safeListOrEmpty(()=>this[_0x473f95(0x19c)]['listChatInterfaces'](_0x21f5dc)),_0x51e6d2=_0x131b61[_0x473f95(0x17e)](_0x3f9c2f=>!_0x3f9c2f[_0x473f95(0x178)]['isManaged']&&SAFE_INTEGRATION_TYPES['includes'](_0x3f9c2f[_0x473f95(0x178)][_0x473f95(0x1c9)][_0x473f95(0x11e)]())),_0xff5457=new Map(),_0x41f8e=new Map(),_0x2337b2=new Map(),_0x10484f=new Map(),_0x426754=new Map(),_0x1e70bc=new Map(),_0x5aa7b3=new Map();for(const _0x3a5e88 of _0x5afdb6){_0xff5457[_0x473f95(0x14d)](_0x3a5e88['id'],_0x3a5e88['attributes'][_0x473f95(0x11d)]);}for(const _0x2bdac1 of _0x136ee7){_0x41f8e[_0x473f95(0x14d)](_0x2bdac1['id'],_0x2bdac1[_0x473f95(0x178)][_0x473f95(0x11d)]);}for(const _0x1818a4 of _0x186640){_0x2337b2[_0x473f95(0x14d)](_0x1818a4['id'],_0x1818a4[_0x473f95(0x178)][_0x473f95(0x11d)]);}for(const _0x3203cf of _0x189e65){_0x10484f[_0x473f95(0x14d)](_0x3203cf['id'],_0x3203cf[_0x473f95(0x178)][_0x473f95(0x11d)]);}for(const _0x494877 of _0x34c325){_0x426754[_0x473f95(0x14d)](_0x494877['id'],_0x494877[_0x473f95(0x178)][_0x473f95(0x11d)]);}for(const _0x20e865 of _0x529e6b){_0x1e70bc['set'](_0x20e865['id'],_0x20e865[_0x473f95(0x178)][_0x473f95(0x11d)]);}for(const _0x1ea602 of _0x27f906){_0x5aa7b3[_0x473f95(0x14d)](_0x1ea602['id'],_0x1ea602[_0x473f95(0x178)][_0x473f95(0x11d)]);}const _0x55f9f0={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x41f8e,'TextKnowledgeBase':_0x2337b2,'Agent':_0xff5457,'WebSearchTool':_0x426754,'ImageGenerator':_0x10484f,'ExperimentalKnowledgeBase':_0x5aa7b3}),'resolvePromptName':async _0x42b3d4=>_0x1e70bc[_0x473f95(0x141)](_0x42b3d4),'onWarning':_0x15471a=>this[_0x473f95(0xb9)][_0x473f95(0x1a5)](_0x15471a)},_0x200da7={'projectName':_0x48915a,'outputDir':_0x4999e9,'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}}},_0x146cbd=[],_0x430268=[];for(const _0x46197b of _0x5afdb6){const _0x3a588b=getSanitizedPathWithMigration(_0x4999e9,_0x46197b[_0x473f95(0x178)][_0x473f95(0x11d)]);_0x3a588b[_0x473f95(0xf6)]&&this[_0x473f95(0xb9)][_0x473f95(0x1bb)](_0x473f95(0x179)+a138_0x2da90b['basename'](_0x3a588b['oldPath'])+'\x20→\x20'+a138_0x2da90b[_0x473f95(0x128)](_0x3a588b[_0x473f95(0xe7)]));const _0x16adc1=_0x3a588b[_0x473f95(0xe7)],_0x218520=a138_0x2da90b[_0x473f95(0x1cc)](_0x16adc1,'prompt.md'),_0x5923fa=a138_0x2da90b[_0x473f95(0x1cc)](_0x16adc1,_0x473f95(0x16c)),_0x841e8b=a138_0x2da90b[_0x473f95(0x1cc)](_0x16adc1,'starter_message.md'),{yaml:_0x3f60ac,systemPrompt:_0xddc239,starterMessage:_0x268a70}=await agentResponseToDef(_0x46197b,_0x55f9f0),_0x3a0685=toAgentYamlString(_0x3f60ac),_0x56ec30=!a138_0x1c3d61[_0x473f95(0xfe)](_0x5923fa);let _0x17e579=_0x56ec30,_0x427c78;if(!_0x56ec30){const _0x539f61=a138_0x1c3d61['existsSync'](_0x218520)?a138_0x1c3d61['readFileSync'](_0x218520,_0x473f95(0xcf)):'',_0x2e54ec=a138_0x1c3d61[_0x473f95(0x1bc)](_0x5923fa,'utf-8'),_0x1847c1=_0x473f95(0x102)+_0x539f61+_0x473f95(0x11c)+_0x2e54ec,_0x3a3b43='#\x20prompt.md\x0a'+_0xddc239+_0x473f95(0x11c)+_0x3a0685,_0x37d012=generateDiff(_0x1847c1,_0x3a3b43);_0x17e579=hasChanges(_0x37d012),_0x17e579&&(_0x427c78=formatDiffWithColors(_0x37d012));}_0x146cbd['push']({'path':_0x16adc1,'content':'','isDir':!![]}),_0x146cbd[_0x473f95(0x1b9)]({'path':_0x218520,'content':_0xddc239}),_0x146cbd[_0x473f95(0x1b9)]({'path':_0x5923fa,'content':_0x3a0685});_0x268a70&&_0x268a70[_0x473f95(0x158)]('\x0a')&&_0x146cbd['push']({'path':_0x841e8b,'content':_0x268a70});_0x200da7['agents']['push']({'agentName':_0x46197b[_0x473f95(0x178)][_0x473f95(0x11d)],'outputPath':_0x16adc1,'isNew':_0x56ec30,'hasChanges':_0x17e579,'diff':_0x427c78}),_0x200da7[_0x473f95(0x111)]['agents']['total']++;if(_0x56ec30)_0x200da7['counts'][_0x473f95(0x15e)][_0x473f95(0x159)]++;else{if(_0x17e579)_0x200da7['counts'][_0x473f95(0x15e)]['updated']++;else _0x200da7[_0x473f95(0x111)][_0x473f95(0x15e)][_0x473f95(0x1c3)]++;}}for(const _0x479e27 of _0x136ee7){if(_0x479e27['attributes'][_0x473f95(0x135)])continue;const _0x1ce5f8=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x4999e9),_0x479e27[_0x473f95(0x178)][_0x473f95(0x11d)],_0x473f95(0x1a2));_0x1ce5f8['renamed']&&this[_0x473f95(0xb9)][_0x473f95(0x1bb)](_0x473f95(0x119)+a138_0x2da90b[_0x473f95(0x128)](_0x1ce5f8[_0x473f95(0x1b3)])+'\x20→\x20'+a138_0x2da90b['basename'](_0x1ce5f8[_0x473f95(0xe7)]));const _0x3fd613=_0x1ce5f8[_0x473f95(0xe7)],_0x1522e7=apiKnowledgeBaseToYaml(_0x479e27),_0x97d855=toKnowledgeBaseYamlString(_0x1522e7),_0x22b2bb=!a138_0x1c3d61[_0x473f95(0xfe)](_0x3fd613);let _0x3eae6e=_0x22b2bb,_0x3677f7;if(!_0x22b2bb){const _0x2e5d81=a138_0x1c3d61[_0x473f95(0x1bc)](_0x3fd613,'utf-8'),_0x3dab57=generateDiff(_0x2e5d81,_0x97d855);_0x3eae6e=hasChanges(_0x3dab57),_0x3eae6e&&(_0x3677f7=formatDiffWithColors(_0x3dab57));}_0x146cbd['push']({'path':_0x3fd613,'content':_0x97d855}),_0x200da7[_0x473f95(0x121)][_0x473f95(0x1b9)]({'name':_0x479e27[_0x473f95(0x178)][_0x473f95(0x11d)],'outputPath':_0x3fd613,'isNew':_0x22b2bb,'hasChanges':_0x3eae6e,'diff':_0x3677f7}),_0x200da7[_0x473f95(0x111)]['knowledgeBases'][_0x473f95(0xe3)]++;if(_0x22b2bb)_0x200da7[_0x473f95(0x111)][_0x473f95(0x121)][_0x473f95(0x159)]++;else{if(_0x3eae6e)_0x200da7[_0x473f95(0x111)][_0x473f95(0x121)]['updated']++;else _0x200da7[_0x473f95(0x111)][_0x473f95(0x121)][_0x473f95(0x1c3)]++;}}for(const _0x14b57e of _0x186640){if(_0x14b57e[_0x473f95(0x178)]['isManaged'])continue;const _0x178256=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x4999e9),_0x14b57e[_0x473f95(0x178)][_0x473f95(0x11d)],_0x473f95(0x185));_0x178256[_0x473f95(0xf6)]&&this[_0x473f95(0xb9)][_0x473f95(0x1bb)](_0x473f95(0xd6)+a138_0x2da90b[_0x473f95(0x128)](_0x178256[_0x473f95(0x1b3)])+_0x473f95(0x136)+a138_0x2da90b['basename'](_0x178256[_0x473f95(0xe7)]));const _0x3cd705=_0x178256[_0x473f95(0xe7)],_0x250ed6=toTextKnowledgeBaseMd(_0x14b57e[_0x473f95(0x178)][_0x473f95(0x11d)],_0x14b57e[_0x473f95(0x178)][_0x473f95(0x103)]),_0x907dfd=!a138_0x1c3d61[_0x473f95(0xfe)](_0x3cd705);let _0x29d67d=_0x907dfd,_0x1b509b;if(!_0x907dfd){const _0x40b1cf=a138_0x1c3d61[_0x473f95(0x1bc)](_0x3cd705,_0x473f95(0xcf)),_0x1e63b4=generateDiff(_0x40b1cf,_0x250ed6);_0x29d67d=hasChanges(_0x1e63b4),_0x29d67d&&(_0x1b509b=formatDiffWithColors(_0x1e63b4));}_0x146cbd[_0x473f95(0x1b9)]({'path':_0x3cd705,'content':_0x250ed6}),_0x200da7[_0x473f95(0x191)][_0x473f95(0x1b9)]({'name':_0x14b57e[_0x473f95(0x178)][_0x473f95(0x11d)],'outputPath':_0x3cd705,'isNew':_0x907dfd,'hasChanges':_0x29d67d,'diff':_0x1b509b}),_0x200da7[_0x473f95(0x111)][_0x473f95(0x191)]['total']++;if(_0x907dfd)_0x200da7[_0x473f95(0x111)][_0x473f95(0x191)]['new']++;else{if(_0x29d67d)_0x200da7[_0x473f95(0x111)][_0x473f95(0x191)]['updated']++;else _0x200da7[_0x473f95(0x111)][_0x473f95(0x191)][_0x473f95(0x1c3)]++;}}for(const _0x14a352 of _0x529e6b){if(_0x14a352[_0x473f95(0x178)][_0x473f95(0x135)])continue;const _0x58920c=getSanitizedPathWithMigration(getPromptsDir(_0x4999e9),_0x14a352[_0x473f95(0x178)]['name'],_0x473f95(0x1a2));_0x58920c[_0x473f95(0xf6)]&&this[_0x473f95(0xb9)][_0x473f95(0x1bb)](_0x473f95(0x1c7)+a138_0x2da90b['basename'](_0x58920c['oldPath'])+_0x473f95(0x136)+a138_0x2da90b[_0x473f95(0x128)](_0x58920c[_0x473f95(0xe7)]));const _0x383abb=_0x58920c['path'],_0x186445=await apiPromptToYaml(_0x14a352,_0x55f9f0);if(!_0x186445)continue;const _0x60fe69=toPromptYamlString(_0x186445),_0x1d4439=!a138_0x1c3d61[_0x473f95(0xfe)](_0x383abb);let _0x7f927f=_0x1d4439,_0x8ac724;if(!_0x1d4439){const _0xf814a9=a138_0x1c3d61[_0x473f95(0x1bc)](_0x383abb,'utf-8'),_0x34232c=generateDiff(_0xf814a9,_0x60fe69);_0x7f927f=hasChanges(_0x34232c),_0x7f927f&&(_0x8ac724=formatDiffWithColors(_0x34232c));}_0x146cbd[_0x473f95(0x1b9)]({'path':_0x383abb,'content':_0x60fe69}),_0x200da7[_0x473f95(0x1a9)]['push']({'name':_0x14a352['attributes'][_0x473f95(0x11d)],'outputPath':_0x383abb,'isNew':_0x1d4439,'hasChanges':_0x7f927f,'diff':_0x8ac724}),_0x200da7[_0x473f95(0x111)]['prompts'][_0x473f95(0xe3)]++;if(_0x1d4439)_0x200da7['counts'][_0x473f95(0x1a9)][_0x473f95(0x159)]++;else{if(_0x7f927f)_0x200da7[_0x473f95(0x111)][_0x473f95(0x1a9)][_0x473f95(0x1c5)]++;else _0x200da7['counts']['prompts'][_0x473f95(0x1c3)]++;}}for(const _0x18bf2a of _0x51e6d2){const _0x254b08=_0x18bf2a[_0x473f95(0x178)][_0x473f95(0x1c9)][_0x473f95(0x11e)](),_0x3bc984=getSanitizedPathWithMigration(getIntegrationsDir(_0x4999e9),_0x254b08,_0x473f95(0x1a2));_0x3bc984[_0x473f95(0xf6)]&&this[_0x473f95(0xb9)][_0x473f95(0x1bb)](_0x473f95(0xf1)+a138_0x2da90b['basename'](_0x3bc984[_0x473f95(0x1b3)])+_0x473f95(0x136)+a138_0x2da90b['basename'](_0x3bc984[_0x473f95(0xe7)]));const _0xc60083=_0x3bc984[_0x473f95(0xe7)],_0x3866fc=await apiIntegrationToYaml(_0x18bf2a,_0x55f9f0),_0x3244ce=toIntegrationYamlString(_0x3866fc),_0x2c6ee5=!a138_0x1c3d61[_0x473f95(0xfe)](_0xc60083);let _0x492b25=_0x2c6ee5,_0x1f7409;if(!_0x2c6ee5){const _0x5b38ff=a138_0x1c3d61[_0x473f95(0x1bc)](_0xc60083,_0x473f95(0xcf)),_0x5aa186=generateDiff(_0x5b38ff,_0x3244ce);_0x492b25=hasChanges(_0x5aa186),_0x492b25&&(_0x1f7409=formatDiffWithColors(_0x5aa186));}_0x146cbd['push']({'path':_0xc60083,'content':_0x3244ce}),_0x200da7[_0x473f95(0x16d)]['push']({'name':_0x254b08,'outputPath':_0xc60083,'isNew':_0x2c6ee5,'hasChanges':_0x492b25,'diff':_0x1f7409}),_0x200da7[_0x473f95(0x111)]['integrations'][_0x473f95(0xe3)]++;if(_0x2c6ee5)_0x200da7[_0x473f95(0x111)][_0x473f95(0x16d)][_0x473f95(0x159)]++;else{if(_0x492b25)_0x200da7['counts'][_0x473f95(0x16d)]['updated']++;else _0x200da7['counts'][_0x473f95(0x16d)]['unchanged']++;}}for(const _0x269879 of _0x27f906){if(_0x269879[_0x473f95(0x178)][_0x473f95(0x135)])continue;const _0x2d928b=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x4999e9),_0x269879[_0x473f95(0x178)][_0x473f95(0x11d)]);_0x2d928b[_0x473f95(0xf6)]&&this[_0x473f95(0xb9)][_0x473f95(0x1bb)](_0x473f95(0x10c)+a138_0x2da90b[_0x473f95(0x128)](_0x2d928b[_0x473f95(0x1b3)])+_0x473f95(0x136)+a138_0x2da90b[_0x473f95(0x128)](_0x2d928b['path']));const _0x32ce4c=_0x2d928b['path'],_0x16dabf=a138_0x2da90b[_0x473f95(0x1cc)](_0x32ce4c,sanitizeForFilesystem(_0x269879[_0x473f95(0x178)]['name'])+_0x473f95(0x1a2)),_0x59cff6=a138_0x2da90b['join'](_0x32ce4c,_0x473f95(0x101)),_0xf400ce=apiExperimentalKnowledgeBaseToYaml(_0x269879),_0x58496b=toExperimentalKnowledgeBaseYamlString(_0xf400ce),_0x519a0a=!a138_0x1c3d61[_0x473f95(0xfe)](_0x32ce4c);let _0xe669be=_0x519a0a,_0x36f358,_0x34bdb0=_0x58496b;const _0x58e73f=[..._0xf400ce[_0x473f95(0x101)]][_0x473f95(0x171)]((_0x17c3b9,_0x170f26)=>_0x17c3b9[_0x473f95(0x11d)][_0x473f95(0xff)](_0x170f26[_0x473f95(0x11d)]));for(const _0x71ce1f of _0x58e73f){_0x34bdb0+=_0x473f95(0x138)+_0x71ce1f['name']+_0x473f95(0x1bf)+_0x71ce1f[_0x473f95(0xd1)]+_0x473f95(0x1cf)+_0x71ce1f[_0x473f95(0x11d)]+'\x20---\x0a'+_0x71ce1f['json_schema']+'\x0a';}if(!_0x519a0a){let _0xa993cc='';a138_0x1c3d61[_0x473f95(0xfe)](_0x16dabf)&&(_0xa993cc=a138_0x1c3d61[_0x473f95(0x1bc)](_0x16dabf,_0x473f95(0xcf)));if(a138_0x1c3d61[_0x473f95(0xfe)](_0x59cff6)){const _0x2442b6=a138_0x1c3d61[_0x473f95(0x14c)](_0x59cff6,{'withFileTypes':!![]}),_0x27e33c=_0x2442b6['filter'](_0x1cdba3=>_0x1cdba3['isDirectory']())[_0x473f95(0x171)]((_0x24d6ac,_0x1af67b)=>_0x24d6ac[_0x473f95(0x11d)][_0x473f95(0xff)](_0x1af67b[_0x473f95(0x11d)]));for(const _0x2c5fd5 of _0x27e33c){const _0x1cff85=a138_0x2da90b[_0x473f95(0x1cc)](_0x59cff6,_0x2c5fd5[_0x473f95(0x11d)],'code.js'),_0x4a9e40=a138_0x2da90b[_0x473f95(0x1cc)](_0x59cff6,_0x2c5fd5[_0x473f95(0x11d)],_0x473f95(0x192));a138_0x1c3d61[_0x473f95(0xfe)](_0x1cff85)&&(_0xa993cc+=_0x473f95(0x138)+_0x2c5fd5[_0x473f95(0x11d)]+_0x473f95(0x1bf)+a138_0x1c3d61[_0x473f95(0x1bc)](_0x1cff85,'utf-8')+'\x0a'),a138_0x1c3d61[_0x473f95(0xfe)](_0x4a9e40)&&(_0xa993cc+='---\x20schema:\x20'+_0x2c5fd5[_0x473f95(0x11d)]+'\x20---\x0a'+a138_0x1c3d61['readFileSync'](_0x4a9e40,'utf-8')+'\x0a');}}const _0x4d4a29=generateDiff(_0xa993cc,_0x34bdb0);_0xe669be=hasChanges(_0x4d4a29),_0xe669be&&(_0x36f358=formatDiffWithColors(_0x4d4a29));}_0x146cbd[_0x473f95(0x1b9)]({'path':_0x32ce4c,'content':'','isDir':!![]}),_0x146cbd['push']({'path':_0x16dabf,'content':_0x58496b}),_0x146cbd[_0x473f95(0x1b9)]({'path':_0x59cff6,'content':'','isDir':!![]});for(const _0x43df3f of _0xf400ce[_0x473f95(0x101)]){const _0x4bc4a9=a138_0x2da90b[_0x473f95(0x1cc)](_0x59cff6,sanitizeForFilesystem(_0x43df3f[_0x473f95(0x11d)])),_0x47f3ba=a138_0x2da90b[_0x473f95(0x1cc)](_0x4bc4a9,_0x473f95(0x13c)),_0xa68f2d=a138_0x2da90b[_0x473f95(0x1cc)](_0x4bc4a9,_0x473f95(0x192));_0x146cbd[_0x473f95(0x1b9)]({'path':_0x4bc4a9,'content':'','isDir':!![]}),_0x146cbd[_0x473f95(0x1b9)]({'path':_0x47f3ba,'content':_0x43df3f[_0x473f95(0xd1)]}),_0x146cbd['push']({'path':_0xa68f2d,'content':_0x43df3f[_0x473f95(0x125)]});}if(a138_0x1c3d61[_0x473f95(0xfe)](_0x59cff6)){const _0x5b868b=a138_0x1c3d61[_0x473f95(0x14c)](_0x59cff6,{'withFileTypes':!![]}),_0x5d7339=new Set(_0xf400ce[_0x473f95(0x101)][_0x473f95(0x1ae)](_0x4fe652=>sanitizeForFilesystem(_0x4fe652['name'])));for(const _0x13494e of _0x5b868b){if(_0x13494e[_0x473f95(0xdc)]()&&!_0x5d7339[_0x473f95(0xee)](_0x13494e[_0x473f95(0x11d)])){const _0x53538e=a138_0x2da90b[_0x473f95(0x1cc)](_0x59cff6,_0x13494e['name']);_0x430268[_0x473f95(0x1b9)]({'path':_0x53538e,'isDir':!![]});}}}_0x200da7[_0x473f95(0x139)][_0x473f95(0x1b9)]({'name':_0x269879[_0x473f95(0x178)][_0x473f95(0x11d)],'outputPath':_0x32ce4c,'isNew':_0x519a0a,'hasChanges':_0xe669be,'diff':_0x36f358}),_0x200da7['counts'][_0x473f95(0x139)]['total']++;if(_0x519a0a)_0x200da7['counts'][_0x473f95(0x139)][_0x473f95(0x159)]++;else{if(_0xe669be)_0x200da7['counts']['experimentalKnowledgeBases'][_0x473f95(0x1c5)]++;else _0x200da7[_0x473f95(0x111)][_0x473f95(0x139)][_0x473f95(0x1c3)]++;}}for(const _0x2a45d9 of _0x56631d){if(_0x2a45d9['attributes'][_0x473f95(0x135)])continue;const _0x24e123=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x4999e9),_0x2a45d9[_0x473f95(0x178)][_0x473f95(0x11d)]);_0x24e123[_0x473f95(0xf6)]&&this[_0x473f95(0xb9)][_0x473f95(0x1bb)](_0x473f95(0xb6)+a138_0x2da90b['basename'](_0x24e123[_0x473f95(0x1b3)])+_0x473f95(0x136)+a138_0x2da90b[_0x473f95(0x128)](_0x24e123[_0x473f95(0xe7)]));const _0x1d0b38=_0x24e123[_0x473f95(0xe7)],_0x5481b0=a138_0x2da90b[_0x473f95(0x1cc)](_0x1d0b38,sanitizeForFilesystem(_0x2a45d9[_0x473f95(0x178)][_0x473f95(0x11d)])+_0x473f95(0x1a2)),_0x22f4b8=a138_0x2da90b[_0x473f95(0x1cc)](_0x1d0b38,_0x473f95(0x13c)),_0x2eafbf=a138_0x2da90b['join'](_0x1d0b38,_0x473f95(0x1da)),_0x3753d7=apiExperimentalArtifactToYaml(_0x2a45d9),_0x294c1a=toExperimentalArtifactYamlString(_0x3753d7),_0x2398ca=!a138_0x1c3d61[_0x473f95(0xfe)](_0x1d0b38);let _0x38fc55=_0x2398ca,_0x27a8fc,_0x58bb65=_0x294c1a+(_0x473f95(0x166)+_0x3753d7[_0x473f95(0xd1)]+'\x0a');const _0x974811=[..._0x3753d7[_0x473f95(0x1da)]][_0x473f95(0x171)]((_0x29f576,_0x24167b)=>_0x29f576[_0x473f95(0x10d)][_0x473f95(0xff)](_0x24167b[_0x473f95(0x10d)]));for(const _0x3d92e5 of _0x974811){_0x58bb65+=_0x473f95(0xf2)+_0x3d92e5[_0x473f95(0x10d)]+_0x473f95(0x1bf)+_0x3d92e5[_0x473f95(0x110)]+'\x0a';}if(!_0x2398ca){let _0x504e2='';a138_0x1c3d61[_0x473f95(0xfe)](_0x5481b0)&&(_0x504e2=a138_0x1c3d61[_0x473f95(0x1bc)](_0x5481b0,_0x473f95(0xcf)));a138_0x1c3d61[_0x473f95(0xfe)](_0x22f4b8)&&(_0x504e2+=_0x473f95(0x166)+a138_0x1c3d61[_0x473f95(0x1bc)](_0x22f4b8,_0x473f95(0xcf))+'\x0a');if(a138_0x1c3d61[_0x473f95(0xfe)](_0x2eafbf)){const _0x313337=a138_0x1c3d61[_0x473f95(0x14c)](_0x2eafbf),_0x6503=_0x313337[_0x473f95(0x17e)](_0x394a91=>{const _0x30b44d=_0x473f95,_0x5185e2=a138_0x2da90b['join'](_0x2eafbf,_0x394a91);return a138_0x1c3d61['statSync'](_0x5185e2)[_0x30b44d(0x1b4)]();})[_0x473f95(0x171)]((_0x12a6cf,_0x211fb5)=>_0x12a6cf[_0x473f95(0xff)](_0x211fb5));for(const _0x4e8ae7 of _0x6503){const _0x4f8f88=a138_0x2da90b[_0x473f95(0x1cc)](_0x2eafbf,_0x4e8ae7);_0x504e2+=_0x473f95(0xf2)+_0x4e8ae7+_0x473f95(0x1bf)+a138_0x1c3d61[_0x473f95(0x1bc)](_0x4f8f88,_0x473f95(0xcf))+'\x0a';}}const _0x95e3d2=generateDiff(_0x504e2,_0x58bb65);_0x38fc55=hasChanges(_0x95e3d2),_0x38fc55&&(_0x27a8fc=formatDiffWithColors(_0x95e3d2));}_0x146cbd[_0x473f95(0x1b9)]({'path':_0x1d0b38,'content':'','isDir':!![]}),_0x146cbd[_0x473f95(0x1b9)]({'path':_0x5481b0,'content':_0x294c1a}),_0x146cbd[_0x473f95(0x1b9)]({'path':_0x22f4b8,'content':_0x3753d7[_0x473f95(0xd1)]});if(_0x3753d7[_0x473f95(0x1da)][_0x473f95(0xed)]>0x0){_0x146cbd[_0x473f95(0x1b9)]({'path':_0x2eafbf,'content':'','isDir':!![]});for(const _0x1b5524 of _0x3753d7[_0x473f95(0x1da)]){const _0x54ee20=a138_0x2da90b[_0x473f95(0x1cc)](_0x2eafbf,_0x1b5524[_0x473f95(0x10d)]);_0x146cbd[_0x473f95(0x1b9)]({'path':_0x54ee20,'content':_0x1b5524[_0x473f95(0x110)]});}}if(a138_0x1c3d61['existsSync'](_0x2eafbf)){const _0x1eefcf=a138_0x1c3d61[_0x473f95(0x14c)](_0x2eafbf),_0x17be5a=new Set(_0x3753d7[_0x473f95(0x1da)][_0x473f95(0x1ae)](_0x29ba27=>_0x29ba27['file_name']));for(const _0xf1c198 of _0x1eefcf){const _0x855be0=a138_0x2da90b[_0x473f95(0x1cc)](_0x2eafbf,_0xf1c198);a138_0x1c3d61[_0x473f95(0x164)](_0x855be0)[_0x473f95(0x1b4)]()&&!_0x17be5a['has'](_0xf1c198)&&_0x430268[_0x473f95(0x1b9)]({'path':_0x855be0});}}_0x200da7['experimentalArtifacts'][_0x473f95(0x1b9)]({'name':_0x2a45d9[_0x473f95(0x178)]['name'],'outputPath':_0x1d0b38,'isNew':_0x2398ca,'hasChanges':_0x38fc55,'diff':_0x27a8fc}),_0x200da7[_0x473f95(0x111)][_0x473f95(0xbe)]['total']++;if(_0x2398ca)_0x200da7[_0x473f95(0x111)][_0x473f95(0xbe)][_0x473f95(0x159)]++;else{if(_0x38fc55)_0x200da7['counts']['experimentalArtifacts'][_0x473f95(0x1c5)]++;else _0x200da7['counts'][_0x473f95(0xbe)][_0x473f95(0x1c3)]++;}}for(const _0x594e07 of _0x319816){const _0x27be5b=getSanitizedPathWithMigration(getFormInterfacesDir(_0x4999e9),_0x594e07[_0x473f95(0x178)][_0x473f95(0x11d)],_0x473f95(0x1a2));_0x27be5b[_0x473f95(0xf6)]&&this[_0x473f95(0xb9)][_0x473f95(0x1bb)](_0x473f95(0xb8)+a138_0x2da90b['basename'](_0x27be5b[_0x473f95(0x1b3)])+_0x473f95(0x136)+a138_0x2da90b['basename'](_0x27be5b[_0x473f95(0xe7)]));const _0x3337ab=_0x27be5b['path'],_0x3b677b=await apiFormInterfaceToYaml(_0x594e07,_0x55f9f0),_0x441063=toFormInterfaceYamlString(_0x3b677b),_0x4e9469=!a138_0x1c3d61[_0x473f95(0xfe)](_0x3337ab);let _0xfc9e25=_0x4e9469,_0x5b74bf;if(!_0x4e9469){const _0x33ce85=a138_0x1c3d61['readFileSync'](_0x3337ab,_0x473f95(0xcf)),_0x422b43=generateDiff(_0x33ce85,_0x441063);_0xfc9e25=hasChanges(_0x422b43),_0xfc9e25&&(_0x5b74bf=formatDiffWithColors(_0x422b43));}_0x146cbd['push']({'path':_0x3337ab,'content':_0x441063}),_0x200da7[_0x473f95(0x146)][_0x473f95(0x1b9)]({'name':_0x594e07['attributes'][_0x473f95(0x11d)],'outputPath':_0x3337ab,'isNew':_0x4e9469,'hasChanges':_0xfc9e25,'diff':_0x5b74bf}),_0x200da7[_0x473f95(0x111)][_0x473f95(0x146)][_0x473f95(0xe3)]++;if(_0x4e9469)_0x200da7[_0x473f95(0x111)]['formInterfaces'][_0x473f95(0x159)]++;else{if(_0xfc9e25)_0x200da7[_0x473f95(0x111)][_0x473f95(0x146)][_0x473f95(0x1c5)]++;else _0x200da7[_0x473f95(0x111)][_0x473f95(0x146)]['unchanged']++;}}for(const _0x206cf3 of _0x29c1d3){if(_0x206cf3[_0x473f95(0x178)][_0x473f95(0x135)])continue;const _0x497241=getSanitizedPathWithMigration(getChatInterfacesDir(_0x4999e9),_0x206cf3['attributes'][_0x473f95(0x11d)],_0x473f95(0x1a2));_0x497241['renamed']&&this[_0x473f95(0xb9)][_0x473f95(0x1bb)]('Renamed\x20chat\x20interface\x20file:\x20'+a138_0x2da90b['basename'](_0x497241[_0x473f95(0x1b3)])+_0x473f95(0x136)+a138_0x2da90b[_0x473f95(0x128)](_0x497241['path']));const _0x415a09=_0x497241[_0x473f95(0xe7)],_0x41127a=await apiChatInterfaceToYaml(_0x206cf3,_0x55f9f0),_0x44e07f=toChatInterfaceYamlString(_0x41127a),_0x5434f6=!a138_0x1c3d61[_0x473f95(0xfe)](_0x415a09);let _0x17d028=_0x5434f6,_0x2fd891;if(!_0x5434f6){const _0x1b3589=a138_0x1c3d61[_0x473f95(0x1bc)](_0x415a09,_0x473f95(0xcf)),_0x563caa=generateDiff(_0x1b3589,_0x44e07f);_0x17d028=hasChanges(_0x563caa),_0x17d028&&(_0x2fd891=formatDiffWithColors(_0x563caa));}_0x146cbd[_0x473f95(0x1b9)]({'path':_0x415a09,'content':_0x44e07f}),_0x200da7[_0x473f95(0x1ac)][_0x473f95(0x1b9)]({'name':_0x206cf3[_0x473f95(0x178)]['name'],'outputPath':_0x415a09,'isNew':_0x5434f6,'hasChanges':_0x17d028,'diff':_0x2fd891}),_0x200da7[_0x473f95(0x111)][_0x473f95(0x1ac)]['total']++;if(_0x5434f6)_0x200da7[_0x473f95(0x111)][_0x473f95(0x1ac)][_0x473f95(0x159)]++;else{if(_0x17d028)_0x200da7[_0x473f95(0x111)][_0x473f95(0x1ac)][_0x473f95(0x1c5)]++;else _0x200da7[_0x473f95(0x111)][_0x473f95(0x1ac)][_0x473f95(0x1c3)]++;}}if(_0x5dd203?.[_0x473f95(0x174)])return _0x200da7;a138_0x1c3d61['mkdirSync'](_0x4999e9,{'recursive':!![]}),a138_0x1c3d61['mkdirSync'](getKnowledgeBasesDir(_0x4999e9),{'recursive':!![]}),a138_0x1c3d61[_0x473f95(0xd9)](getPromptsDir(_0x4999e9),{'recursive':!![]}),a138_0x1c3d61['mkdirSync'](getIntegrationsDir(_0x4999e9),{'recursive':!![]}),a138_0x1c3d61['mkdirSync'](getExperimentalKnowledgeBasesDir(_0x4999e9),{'recursive':!![]}),a138_0x1c3d61[_0x473f95(0xd9)](getExperimentalArtifactsDir(_0x4999e9),{'recursive':!![]}),a138_0x1c3d61['mkdirSync'](getFormInterfacesDir(_0x4999e9),{'recursive':!![]}),a138_0x1c3d61[_0x473f95(0xd9)](getChatInterfacesDir(_0x4999e9),{'recursive':!![]});const _0x89436d=a138_0x2da90b[_0x473f95(0x1cc)](_0x4999e9,_0x473f95(0x142));a138_0x1c3d61[_0x473f95(0x183)](_0x89436d,createAgentConfigContent(_0x48915a));for(const _0x3c0c6c of _0x146cbd){if(_0x3c0c6c['isDir'])a138_0x1c3d61[_0x473f95(0xd9)](_0x3c0c6c[_0x473f95(0xe7)],{'recursive':!![]});else{const _0x2a8f7d=a138_0x2da90b[_0x473f95(0x11f)](_0x3c0c6c['path']);!a138_0x1c3d61[_0x473f95(0xfe)](_0x2a8f7d)&&a138_0x1c3d61[_0x473f95(0xd9)](_0x2a8f7d,{'recursive':!![]}),a138_0x1c3d61[_0x473f95(0x183)](_0x3c0c6c[_0x473f95(0xe7)],_0x3c0c6c[_0x473f95(0x156)]);}}for(const _0x4a8547 of _0x430268){_0x4a8547[_0x473f95(0x151)]?(a138_0x1c3d61['rmSync'](_0x4a8547[_0x473f95(0xe7)],{'recursive':!![],'force':!![]}),this[_0x473f95(0xb9)][_0x473f95(0x1bb)]('Removed\x20deleted\x20directory:\x20'+a138_0x2da90b[_0x473f95(0x128)](a138_0x2da90b[_0x473f95(0x11f)](_0x4a8547['path']))+'/'+a138_0x2da90b[_0x473f95(0x128)](_0x4a8547[_0x473f95(0xe7)]))):(a138_0x1c3d61[_0x473f95(0xf3)](_0x4a8547[_0x473f95(0xe7)],{'force':!![]}),this[_0x473f95(0xb9)]['info']('Removed\x20deleted\x20file:\x20'+a138_0x2da90b[_0x473f95(0x128)](a138_0x2da90b[_0x473f95(0x11f)](_0x4a8547[_0x473f95(0xe7)]))+'/'+a138_0x2da90b[_0x473f95(0x128)](_0x4a8547['path'])));}return _0x200da7;}async[a138_0xec2434(0x19d)](_0x10d8f8,_0x54d9fe){const _0x4257b0=a138_0xec2434,_0x557046=a138_0x2da90b['join'](_0x10d8f8,_0x4257b0(0x142));if(!a138_0x1c3d61[_0x4257b0(0xfe)](_0x557046))throw new SDKError(ErrorCode[_0x4257b0(0x148)],_0x4257b0(0x197)+_0x10d8f8,undefined,{'helpText':_0x4257b0(0x13b)});const _0x162201=loadAgentConfig(_0x557046),_0x5d188a=await this[_0x4257b0(0xe8)](_0x162201[_0x4257b0(0x154)]),_0x1489fb=await this[_0x4257b0(0x19c)][_0x4257b0(0xf7)](_0x5d188a),_0x217200=_0x1489fb[_0x4257b0(0x178)][_0x4257b0(0x11d)],_0x542b0e={'projectName':_0x217200,'projectId':_0x5d188a,'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}}},_0x5b3004=[],_0xc25391=[],_0xaab9c4=[],_0x1c1e65=[],_0x49129d=[],_0x540064=[],_0x2e6700=a138_0x1c3d61['readdirSync'](_0x10d8f8,{'withFileTypes':!![]});for(const _0x608566 of _0x2e6700){if(!_0x608566[_0x4257b0(0xdc)]())continue;if([_0x4257b0(0x170),'prompts',_0x4257b0(0x16d),_0x4257b0(0xc1),_0x4257b0(0xe9),_0x4257b0(0xec),_0x4257b0(0x1d0)][_0x4257b0(0x158)](_0x608566[_0x4257b0(0x11d)]))continue;const _0x1c3b56=a138_0x2da90b[_0x4257b0(0x1cc)](_0x10d8f8,_0x608566[_0x4257b0(0x11d)]);if(isAgentDir(_0x1c3b56)){const _0x535ab6=a138_0x2da90b[_0x4257b0(0x1cc)](_0x1c3b56,'agent.yml'),_0x6cb3f6=a138_0x2da90b[_0x4257b0(0x1cc)](_0x1c3b56,_0x4257b0(0x105)),_0x80cb73=a138_0x2da90b[_0x4257b0(0x1cc)](_0x1c3b56,_0x4257b0(0xea)),_0x11be1a=parseAgentYaml(a138_0x1c3d61[_0x4257b0(0x1bc)](_0x535ab6,_0x4257b0(0xcf)),_0x535ab6),_0x3bbeea=a138_0x1c3d61[_0x4257b0(0xfe)](_0x6cb3f6)?a138_0x1c3d61[_0x4257b0(0x1bc)](_0x6cb3f6,_0x4257b0(0xcf)):'',_0x1cdc98=a138_0x1c3d61['existsSync'](_0x80cb73)?a138_0x1c3d61[_0x4257b0(0x1bc)](_0x80cb73,_0x4257b0(0xcf)):_0x11be1a[_0x4257b0(0x18d)];_0x5b3004[_0x4257b0(0x1b9)]({'name':_0x11be1a['name'],'dir':_0x1c3b56,'yaml':_0x11be1a,'systemPrompt':_0x3bbeea,'starterMessage':_0x1cdc98});}}const _0x6a65f3=getKnowledgeBasesDir(_0x10d8f8);if(a138_0x1c3d61[_0x4257b0(0xfe)](_0x6a65f3)){const _0x5d51fc=a138_0x1c3d61[_0x4257b0(0x14c)](_0x6a65f3);for(const _0x552488 of _0x5d51fc){const _0x3161e4=a138_0x2da90b[_0x4257b0(0x1cc)](_0x6a65f3,_0x552488);if(_0x552488[_0x4257b0(0x15b)](_0x4257b0(0x1a2))){const _0x57841a=parseKnowledgeBaseYaml(a138_0x1c3d61[_0x4257b0(0x1bc)](_0x3161e4,_0x4257b0(0xcf)),_0x3161e4);_0xc25391[_0x4257b0(0x1b9)]({'name':_0x57841a[_0x4257b0(0x11d)],'path':_0x3161e4,'yaml':_0x57841a});}else{if(_0x552488['endsWith'](_0x4257b0(0x185))){const _0x16ad0d=a138_0x1c3d61[_0x4257b0(0x1bc)](_0x3161e4,_0x4257b0(0xcf)),{name:_0x5f1e71,text:_0x2ed6f1}=parseTextKnowledgeBaseMd(_0x16ad0d,_0x552488);_0xaab9c4[_0x4257b0(0x1b9)]({'name':_0x5f1e71,'path':_0x3161e4,'text':_0x2ed6f1});}}}}const _0x582555=getPromptsDir(_0x10d8f8);if(a138_0x1c3d61[_0x4257b0(0xfe)](_0x582555)){const _0x4fc7e3=a138_0x1c3d61['readdirSync'](_0x582555)[_0x4257b0(0x17e)](_0xd854ea=>_0xd854ea[_0x4257b0(0x15b)](_0x4257b0(0x1a2)));for(const _0x37f652 of _0x4fc7e3){const _0x4385b2=a138_0x2da90b['join'](_0x582555,_0x37f652),_0x5f2da2=parsePromptYaml(a138_0x1c3d61[_0x4257b0(0x1bc)](_0x4385b2,_0x4257b0(0xcf)),_0x4385b2);_0x1c1e65[_0x4257b0(0x1b9)]({'name':_0x5f2da2[_0x4257b0(0x11d)],'path':_0x4385b2,'yaml':_0x5f2da2});}}const _0x214b5c=[],_0x18582f=getIntegrationsDir(_0x10d8f8);if(a138_0x1c3d61[_0x4257b0(0xfe)](_0x18582f)){const _0xc2f0d2=a138_0x1c3d61[_0x4257b0(0x14c)](_0x18582f)[_0x4257b0(0x17e)](_0x166508=>_0x166508['endsWith'](_0x4257b0(0x1a2)));for(const _0x4a7825 of _0xc2f0d2){const _0x356187=a138_0x2da90b[_0x4257b0(0x1cc)](_0x18582f,_0x4a7825),_0x341ce1=parseIntegrationYaml(a138_0x1c3d61['readFileSync'](_0x356187,_0x4257b0(0xcf)),_0x356187);if(!SAFE_INTEGRATION_TYPES[_0x4257b0(0x158)](_0x341ce1[_0x4257b0(0xcd)][_0x4257b0(0x11e)]())){this['logger']['warn'](_0x4257b0(0x1c1)+_0x341ce1[_0x4257b0(0x11d)]+'\x27\x20('+_0x341ce1['service_type']+_0x4257b0(0x180)+(_0x4257b0(0xdd)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x4257b0(0xe0))+_0x4257b0(0x1be));continue;}_0x214b5c[_0x4257b0(0x1b9)]({'name':_0x341ce1[_0x4257b0(0x11d)],'path':_0x356187,'yaml':_0x341ce1});}}const _0x21e10f=getExperimentalKnowledgeBasesDir(_0x10d8f8);if(a138_0x1c3d61[_0x4257b0(0xfe)](_0x21e10f)){const _0x14452c=a138_0x1c3d61[_0x4257b0(0x14c)](_0x21e10f,{'withFileTypes':!![]});for(const _0x16d83a of _0x14452c){if(!_0x16d83a[_0x4257b0(0xdc)]())continue;const _0x3fdd45=a138_0x2da90b[_0x4257b0(0x1cc)](_0x21e10f,_0x16d83a[_0x4257b0(0x11d)]),_0x304283=a138_0x2da90b[_0x4257b0(0x1cc)](_0x3fdd45,_0x16d83a[_0x4257b0(0x11d)]+'.yml'),_0x48fd97=a138_0x2da90b[_0x4257b0(0x1cc)](_0x3fdd45,_0x4257b0(0x101));if(!a138_0x1c3d61[_0x4257b0(0xfe)](_0x304283))continue;const _0x6579f4=parseExperimentalKnowledgeBaseYaml(a138_0x1c3d61[_0x4257b0(0x1bc)](_0x304283,_0x4257b0(0xcf)),_0x304283),_0x564ecf=[];if(a138_0x1c3d61[_0x4257b0(0xfe)](_0x48fd97)){const _0x262820=a138_0x1c3d61[_0x4257b0(0x14c)](_0x48fd97,{'withFileTypes':!![]});for(const _0x43a33a of _0x262820){if(!_0x43a33a[_0x4257b0(0xdc)]())continue;const _0x4c219d=a138_0x2da90b[_0x4257b0(0x1cc)](_0x48fd97,_0x43a33a[_0x4257b0(0x11d)]),_0x1a156e=a138_0x2da90b[_0x4257b0(0x1cc)](_0x4c219d,'code.js'),_0xfacd97=a138_0x2da90b[_0x4257b0(0x1cc)](_0x4c219d,_0x4257b0(0x192));a138_0x1c3d61[_0x4257b0(0xfe)](_0x1a156e)&&a138_0x1c3d61[_0x4257b0(0xfe)](_0xfacd97)&&_0x564ecf[_0x4257b0(0x1b9)]({'name':_0x43a33a[_0x4257b0(0x11d)],'code':a138_0x1c3d61[_0x4257b0(0x1bc)](_0x1a156e,_0x4257b0(0xcf)),'json_schema':a138_0x1c3d61['readFileSync'](_0xfacd97,_0x4257b0(0xcf))});}}const _0x4fd0bd={..._0x6579f4,'variables':_0x6579f4['variables']||[],'functions':_0x564ecf};_0x49129d[_0x4257b0(0x1b9)]({'name':_0x6579f4[_0x4257b0(0x11d)],'dir':_0x3fdd45,'def':_0x4fd0bd});}}const _0x34ed70=getExperimentalArtifactsDir(_0x10d8f8);if(a138_0x1c3d61[_0x4257b0(0xfe)](_0x34ed70)){const _0x39c380=a138_0x1c3d61['readdirSync'](_0x34ed70,{'withFileTypes':!![]});for(const _0x32a68e of _0x39c380){if(!_0x32a68e['isDirectory']())continue;const _0x3a1c5d=a138_0x2da90b[_0x4257b0(0x1cc)](_0x34ed70,_0x32a68e[_0x4257b0(0x11d)]),_0x20228a=a138_0x2da90b[_0x4257b0(0x1cc)](_0x3a1c5d,_0x32a68e[_0x4257b0(0x11d)]+_0x4257b0(0x1a2)),_0x33e4f5=a138_0x2da90b['join'](_0x3a1c5d,_0x4257b0(0x13c)),_0x5736b2=a138_0x2da90b['join'](_0x3a1c5d,_0x4257b0(0x1da));if(!a138_0x1c3d61['existsSync'](_0x20228a)||!a138_0x1c3d61[_0x4257b0(0xfe)](_0x33e4f5))continue;const _0x197355=parseExperimentalArtifactYaml(a138_0x1c3d61[_0x4257b0(0x1bc)](_0x20228a,_0x4257b0(0xcf)),_0x20228a),_0x1b052c=a138_0x1c3d61['readFileSync'](_0x33e4f5,'utf-8'),_0x4c11e9=[];if(a138_0x1c3d61[_0x4257b0(0xfe)](_0x5736b2)){const _0x4b031d=a138_0x1c3d61[_0x4257b0(0x14c)](_0x5736b2);for(const _0xeadd4f of _0x4b031d){const _0x18e6b3=a138_0x2da90b[_0x4257b0(0x1cc)](_0x5736b2,_0xeadd4f);a138_0x1c3d61[_0x4257b0(0x164)](_0x18e6b3)[_0x4257b0(0x1b4)]()&&_0x4c11e9[_0x4257b0(0x1b9)]({'file_name':_0xeadd4f,'text_content':a138_0x1c3d61[_0x4257b0(0x1bc)](_0x18e6b3,_0x4257b0(0xcf))});}}const _0x50488d={..._0x197355,'code':_0x1b052c,'files':_0x4c11e9};_0x540064['push']({'name':_0x197355[_0x4257b0(0x11d)],'dir':_0x3a1c5d,'def':_0x50488d});}}const _0x2b6366=[],_0x20c5da=getFormInterfacesDir(_0x10d8f8);if(a138_0x1c3d61[_0x4257b0(0xfe)](_0x20c5da)){const _0x364aa2=a138_0x1c3d61[_0x4257b0(0x14c)](_0x20c5da)[_0x4257b0(0x17e)](_0x282e0e=>_0x282e0e[_0x4257b0(0x15b)](_0x4257b0(0x1a2)));for(const _0x3ae70d of _0x364aa2){const _0x38a196=a138_0x2da90b[_0x4257b0(0x1cc)](_0x20c5da,_0x3ae70d),_0xc5b0c4=parseFormInterfaceYaml(a138_0x1c3d61[_0x4257b0(0x1bc)](_0x38a196,_0x4257b0(0xcf)),_0x38a196);_0x2b6366[_0x4257b0(0x1b9)]({'name':_0xc5b0c4[_0x4257b0(0x11d)],'path':_0x38a196,'yaml':_0xc5b0c4});}}const _0x55f1d2=[],_0x2767ec=getChatInterfacesDir(_0x10d8f8);if(a138_0x1c3d61[_0x4257b0(0xfe)](_0x2767ec)){const _0x1a347b=a138_0x1c3d61['readdirSync'](_0x2767ec)['filter'](_0x2f36d4=>_0x2f36d4[_0x4257b0(0x15b)](_0x4257b0(0x1a2)));for(const _0x313c6a of _0x1a347b){const _0x23a9ef=a138_0x2da90b[_0x4257b0(0x1cc)](_0x2767ec,_0x313c6a),_0xb79f33=parseChatInterfaceYaml(a138_0x1c3d61[_0x4257b0(0x1bc)](_0x23a9ef,'utf-8'),_0x23a9ef);_0x55f1d2['push']({'name':_0xb79f33[_0x4257b0(0x11d)],'path':_0x23a9ef,'yaml':_0xb79f33});}}const _0x73ddbb=await this[_0x4257b0(0x19c)][_0x4257b0(0x1af)](_0x5d188a),_0x1dbe52=await this[_0x4257b0(0x19c)][_0x4257b0(0xef)](_0x5d188a),_0x1f81e2=await this['client'][_0x4257b0(0xbc)](_0x5d188a),_0x29f846=await this[_0x4257b0(0x19c)][_0x4257b0(0x181)](_0x5d188a),_0x557ecd=await this[_0x4257b0(0x19c)][_0x4257b0(0xc8)](_0x5d188a),_0x1eee25=await safeListOrEmpty(()=>this[_0x4257b0(0x19c)][_0x4257b0(0x1d4)](_0x5d188a)),_0x16d1b3=await safeListOrEmpty(()=>this[_0x4257b0(0x19c)][_0x4257b0(0xf0)](_0x5d188a)),_0x377f24=await safeListOrEmpty(()=>this[_0x4257b0(0x19c)][_0x4257b0(0x1b8)](_0x5d188a)),_0x468e52=await safeListOrEmpty(()=>this[_0x4257b0(0x19c)][_0x4257b0(0xfd)](_0x5d188a)),_0xb5e756=await fetchAllToolTargetMaps((_0xa7aefa,_0x5af767)=>this[_0x4257b0(0x19c)]['listToolTargets'](_0xa7aefa,_0x5af767),_0x5d188a),_0x5ef0ca=new Map(),_0x59fff9=new Map(),_0x2c49b5=new Map(),_0x3e4f57=new Map(),_0x43a465=new Map(),_0x595d78=new Map(),_0x55ffe9=new Map();for(const _0x2850a7 of _0x73ddbb){_0x5ef0ca['set'](_0x2850a7['attributes']['name'],_0x2850a7);}for(const _0x35a95c of _0x1dbe52){_0x59fff9[_0x4257b0(0x14d)](_0x35a95c[_0x4257b0(0x178)]['name'],_0x35a95c);}for(const _0x4165e2 of _0x1f81e2){_0x2c49b5[_0x4257b0(0x14d)](_0x4165e2['attributes'][_0x4257b0(0x11d)],_0x4165e2);}for(const _0x4dcda4 of _0x29f846){_0x3e4f57[_0x4257b0(0x14d)](_0x4dcda4[_0x4257b0(0x178)][_0x4257b0(0x11d)],_0x4dcda4);}for(const _0x5abd8f of _0x557ecd){_0x43a465['set'](_0x5abd8f[_0x4257b0(0x178)][_0x4257b0(0x1c9)][_0x4257b0(0x11e)](),_0x5abd8f);}for(const _0xa467e3 of _0x1eee25){_0x595d78['set'](_0xa467e3[_0x4257b0(0x178)][_0x4257b0(0x11d)],_0xa467e3);}for(const _0x298067 of _0x16d1b3){_0x55ffe9['set'](_0x298067['attributes']['name'],_0x298067);}const _0x322613=new Map(),_0x332b4c=new Map();for(const _0x129d07 of _0x377f24){_0x322613[_0x4257b0(0x14d)](_0x129d07[_0x4257b0(0x178)]['name'],_0x129d07);}for(const _0x3eacbf of _0x468e52){_0x332b4c[_0x4257b0(0x14d)](_0x3eacbf['attributes'][_0x4257b0(0x11d)],_0x3eacbf);}const _0x21be5c=new Map(),_0x28d73e=new Map();for(const _0x44ade2 of _0x73ddbb){_0x21be5c[_0x4257b0(0x14d)](_0x44ade2['attributes']['name'],_0x44ade2['id']),_0x28d73e[_0x4257b0(0x14d)](_0x44ade2['id'],_0x44ade2['attributes'][_0x4257b0(0x11d)]);}const _0x1defca=new Map(),_0x471546=new Map();for(const _0x296b8b of _0x29f846){_0x1defca[_0x4257b0(0x14d)](_0x296b8b[_0x4257b0(0x178)]['name'],_0x296b8b['id']),_0x471546[_0x4257b0(0x14d)](_0x296b8b['id'],_0x296b8b['attributes']['name']);}const _0x2e1ea5=_0xb5e756[_0x4257b0(0x1d5)][_0x4257b0(0xb7)]||new Map(),_0x517081=_0xb5e756[_0x4257b0(0x1d5)][_0x4257b0(0xfc)]||new Map(),_0x2c3248=_0xb5e756[_0x4257b0(0x1d5)][_0x4257b0(0x107)]||new Map(),_0x185f55=new Map(),_0x34b578={'resolveToolTargetName':buildNameResolver({..._0xb5e756['idToName'],'Agent':_0x28d73e}),'resolvePromptName':async _0x125e83=>_0x471546['get'](_0x125e83),'onWarning':_0x35b7de=>this['logger'][_0x4257b0(0x1a5)](_0x35b7de)};let _0x355742=[];const _0x5d48d7={'projectId':_0x5d188a,'resolveToolTargetId':buildIdResolver({..._0xb5e756[_0x4257b0(0x1d5)],'Agent':_0x21be5c}),'resolvePromptId':async _0x24c9b9=>_0x1defca[_0x4257b0(0x141)](_0x24c9b9),'onWarning':_0x1ab9fc=>{const _0x359a55=_0x4257b0;this[_0x359a55(0xb9)][_0x359a55(0x1a5)](_0x1ab9fc),_0x355742['push'](_0x1ab9fc);}},{resolved:_0x4843f8,unresolved:_0x51c2c3}=resolveAgentDependencies(_0x5b3004,new Set(_0x5ef0ca['keys']()));for(const {agent:_0x79e949,missingDeps:_0x1f743c}of _0x51c2c3){_0x542b0e[_0x4257b0(0x15e)][_0x4257b0(0x1b9)]({'agentName':_0x79e949[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':_0x4257b0(0x120),'error':_0x4257b0(0x175)+_0x1f743c[_0x4257b0(0x1cc)](',\x20')+_0x4257b0(0xeb)}),_0x542b0e[_0x4257b0(0x111)]['agents']['errors']++;}for(const _0x2eca20 of _0xc25391){const _0x2227ed=_0x59fff9[_0x4257b0(0x141)](_0x2eca20[_0x4257b0(0x12f)][_0x4257b0(0x11d)]),_0x20ef6a=a138_0x1c3d61[_0x4257b0(0x1bc)](_0x2eca20[_0x4257b0(0xe7)],_0x4257b0(0xcf));if(_0x2227ed){const _0x59dc99=apiKnowledgeBaseToYaml(_0x2227ed),_0x3ba170=toKnowledgeBaseYamlString(_0x59dc99),_0x24c018=generateDiff(_0x3ba170,_0x20ef6a),_0x3e6bf9=hasChanges(_0x24c018);_0x3e6bf9?(_0x542b0e[_0x4257b0(0x121)][_0x4257b0(0x1b9)]({'name':_0x2eca20[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c5),'id':_0x2227ed['id'],'diff':formatDiffWithColors(_0x24c018)}),_0x542b0e[_0x4257b0(0x111)]['knowledgeBases']['updated']++):(_0x542b0e[_0x4257b0(0x121)][_0x4257b0(0x1b9)]({'name':_0x2eca20[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c3),'id':_0x2227ed['id']}),_0x542b0e['counts'][_0x4257b0(0x121)][_0x4257b0(0x1c3)]++);}else _0x542b0e[_0x4257b0(0x121)][_0x4257b0(0x1b9)]({'name':_0x2eca20[_0x4257b0(0x12f)]['name'],'action':_0x4257b0(0x1c8)}),_0x542b0e[_0x4257b0(0x111)]['knowledgeBases'][_0x4257b0(0x1c8)]++;}for(const _0xdbb0a0 of _0xaab9c4){const _0x3c9883=_0x2c49b5[_0x4257b0(0x141)](_0xdbb0a0['name']),_0x1d8593=a138_0x1c3d61[_0x4257b0(0x1bc)](_0xdbb0a0[_0x4257b0(0xe7)],_0x4257b0(0xcf));if(_0x3c9883){const _0x3c2de3=toTextKnowledgeBaseMd(_0x3c9883[_0x4257b0(0x178)][_0x4257b0(0x11d)],_0x3c9883[_0x4257b0(0x178)]['text']),_0x3a94bd=generateDiff(_0x3c2de3,_0x1d8593),_0x98c6a1=hasChanges(_0x3a94bd);_0x98c6a1?(_0x542b0e['textKnowledgeBases'][_0x4257b0(0x1b9)]({'name':_0xdbb0a0['name'],'action':_0x4257b0(0x1c5),'id':_0x3c9883['id'],'diff':formatDiffWithColors(_0x3a94bd)}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x191)][_0x4257b0(0x1c5)]++):(_0x542b0e['textKnowledgeBases']['push']({'name':_0xdbb0a0[_0x4257b0(0x11d)],'action':_0x4257b0(0x1c3),'id':_0x3c9883['id']}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x191)][_0x4257b0(0x1c3)]++);}else _0x542b0e['textKnowledgeBases'][_0x4257b0(0x1b9)]({'name':_0xdbb0a0[_0x4257b0(0x11d)],'action':_0x4257b0(0x1c8)}),_0x542b0e['counts'][_0x4257b0(0x191)][_0x4257b0(0x1c8)]++;}for(const _0x438c3f of _0x4843f8){const _0x8ce1dd=_0x5ef0ca['get'](_0x438c3f[_0x4257b0(0x12f)]['name']),_0x7ec7c1=a138_0x2da90b[_0x4257b0(0x1cc)](_0x438c3f[_0x4257b0(0x1d6)],_0x4257b0(0x16c)),_0x3f3259=a138_0x1c3d61[_0x4257b0(0x1bc)](_0x7ec7c1,_0x4257b0(0xcf)),_0x4f754f=_0x438c3f[_0x4257b0(0x182)],_0x214cac=_0x4257b0(0x102)+_0x4f754f+_0x4257b0(0x11c)+_0x3f3259;if(_0x8ce1dd){const {yaml:_0x2a5cd5,systemPrompt:_0x1b8d5c}=await agentResponseToDef(_0x8ce1dd,_0x34b578),_0x23e17f=toAgentYamlString(_0x2a5cd5),_0x27a996='#\x20prompt.md\x0a'+_0x1b8d5c+_0x4257b0(0x11c)+_0x23e17f,_0x32d22a=generateDiff(_0x27a996,_0x214cac),_0x17a238=hasChanges(_0x32d22a);_0x17a238?(_0x542b0e[_0x4257b0(0x15e)][_0x4257b0(0x1b9)]({'agentName':_0x438c3f['yaml'][_0x4257b0(0x11d)],'action':'updated','agentId':_0x8ce1dd['id'],'diff':formatDiffWithColors(_0x32d22a)}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x15e)]['updated']++):(_0x542b0e[_0x4257b0(0x15e)][_0x4257b0(0x1b9)]({'agentName':_0x438c3f[_0x4257b0(0x12f)]['name'],'action':'unchanged','agentId':_0x8ce1dd['id']}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x15e)][_0x4257b0(0x1c3)]++);}else _0x542b0e[_0x4257b0(0x15e)][_0x4257b0(0x1b9)]({'agentName':_0x438c3f['yaml'][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c8)}),_0x542b0e[_0x4257b0(0x111)]['agents'][_0x4257b0(0x1c8)]++;}for(const _0x5a0c71 of _0x1c1e65){const _0xe4ef6a=_0x3e4f57[_0x4257b0(0x141)](_0x5a0c71[_0x4257b0(0x12f)][_0x4257b0(0x11d)]),_0x2062e2=a138_0x1c3d61[_0x4257b0(0x1bc)](_0x5a0c71['path'],_0x4257b0(0xcf));if(_0xe4ef6a){const _0x31cd37=await apiPromptToYaml(_0xe4ef6a,_0x34b578);if(!_0x31cd37){_0x542b0e[_0x4257b0(0x1a9)]['push']({'name':_0x5a0c71['yaml'][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c5),'id':_0xe4ef6a['id']}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x1a9)][_0x4257b0(0x1c5)]++;continue;}const _0x4cfcff=toPromptYamlString(_0x31cd37),_0xf889de=generateDiff(_0x4cfcff,_0x2062e2),_0x2f45e8=hasChanges(_0xf889de);_0x2f45e8?(_0x542b0e[_0x4257b0(0x1a9)][_0x4257b0(0x1b9)]({'name':_0x5a0c71[_0x4257b0(0x12f)]['name'],'action':_0x4257b0(0x1c5),'id':_0xe4ef6a['id'],'diff':formatDiffWithColors(_0xf889de)}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x1a9)]['updated']++):(_0x542b0e['prompts'][_0x4257b0(0x1b9)]({'name':_0x5a0c71[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':'unchanged','id':_0xe4ef6a['id']}),_0x542b0e['counts'][_0x4257b0(0x1a9)]['unchanged']++);}else _0x542b0e[_0x4257b0(0x1a9)][_0x4257b0(0x1b9)]({'name':_0x5a0c71[_0x4257b0(0x12f)]['name'],'action':'created'}),_0x542b0e['counts'][_0x4257b0(0x1a9)][_0x4257b0(0x1c8)]++;}for(const _0x2e5686 of _0x214b5c){const _0x3fa199=_0x43a465['get'](_0x2e5686[_0x4257b0(0x12f)]['service_type']),_0x417edf=a138_0x1c3d61[_0x4257b0(0x1bc)](_0x2e5686[_0x4257b0(0xe7)],_0x4257b0(0xcf));if(_0x3fa199){const _0x2914db=await apiIntegrationToYaml(_0x3fa199,_0x34b578),_0x21edf0=toIntegrationYamlString(_0x2914db),_0x132ce1=generateDiff(_0x21edf0,_0x417edf),_0x4a3950=hasChanges(_0x132ce1);_0x4a3950?(_0x542b0e['integrations'][_0x4257b0(0x1b9)]({'name':_0x2e5686[_0x4257b0(0x12f)][_0x4257b0(0xcd)],'action':_0x4257b0(0x1c5),'id':_0x3fa199['id'],'diff':formatDiffWithColors(_0x132ce1)}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x16d)]['updated']++):(_0x542b0e['integrations']['push']({'name':_0x2e5686[_0x4257b0(0x12f)]['service_type'],'action':_0x4257b0(0x1c3),'id':_0x3fa199['id']}),_0x542b0e[_0x4257b0(0x111)]['integrations']['unchanged']++);}else _0x542b0e[_0x4257b0(0x16d)][_0x4257b0(0x1b9)]({'name':_0x2e5686['yaml']['service_type'],'action':_0x4257b0(0x1c8)}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x16d)][_0x4257b0(0x1c8)]++;}for(const _0x4990b8 of _0x49129d){const _0x311a08=_0x595d78['get'](_0x4990b8[_0x4257b0(0x10e)][_0x4257b0(0x11d)]),_0x2e229d=toExperimentalKnowledgeBaseYamlString(_0x4990b8[_0x4257b0(0x10e)]);let _0x2dcd20=_0x2e229d;for(const _0x20b88a of _0x4990b8[_0x4257b0(0x10e)][_0x4257b0(0x101)]){_0x2dcd20+=_0x4257b0(0x138)+_0x20b88a[_0x4257b0(0x11d)]+_0x4257b0(0x1bf)+_0x20b88a[_0x4257b0(0xd1)]+_0x4257b0(0x1cf)+_0x20b88a[_0x4257b0(0x11d)]+_0x4257b0(0x1bf)+_0x20b88a[_0x4257b0(0x125)]+'\x0a';}if(_0x311a08){const _0x1b52b7=apiExperimentalKnowledgeBaseToYaml(_0x311a08),_0x415405=toExperimentalKnowledgeBaseYamlString(_0x1b52b7);let _0x2d4efb=_0x415405;for(const _0x3dd5a2 of _0x1b52b7['functions']){_0x2d4efb+=_0x4257b0(0x138)+_0x3dd5a2[_0x4257b0(0x11d)]+_0x4257b0(0x1bf)+_0x3dd5a2[_0x4257b0(0xd1)]+_0x4257b0(0x1cf)+_0x3dd5a2['name']+_0x4257b0(0x1bf)+_0x3dd5a2[_0x4257b0(0x125)]+'\x0a';}const _0x808d8f=generateDiff(_0x2d4efb,_0x2dcd20),_0x295951=hasChanges(_0x808d8f);_0x295951?(_0x542b0e[_0x4257b0(0x139)][_0x4257b0(0x1b9)]({'name':_0x4990b8[_0x4257b0(0x10e)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c5),'id':_0x311a08['id'],'diff':formatDiffWithColors(_0x808d8f)}),_0x542b0e[_0x4257b0(0x111)]['experimentalKnowledgeBases'][_0x4257b0(0x1c5)]++):(_0x542b0e[_0x4257b0(0x139)][_0x4257b0(0x1b9)]({'name':_0x4990b8[_0x4257b0(0x10e)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c3),'id':_0x311a08['id']}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x139)][_0x4257b0(0x1c3)]++);}else _0x542b0e[_0x4257b0(0x139)][_0x4257b0(0x1b9)]({'name':_0x4990b8['def'][_0x4257b0(0x11d)],'action':'created'}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x139)][_0x4257b0(0x1c8)]++;}for(const _0x40ef67 of _0x540064){const _0x525ced=_0x55ffe9[_0x4257b0(0x141)](_0x40ef67[_0x4257b0(0x10e)][_0x4257b0(0x11d)]),_0x3c00aa=toExperimentalArtifactYamlString(_0x40ef67[_0x4257b0(0x10e)]);let _0x29cc13=_0x3c00aa+(_0x4257b0(0x166)+_0x40ef67[_0x4257b0(0x10e)][_0x4257b0(0xd1)]+'\x0a');for(const _0x496c2b of _0x40ef67['def']['files']){_0x29cc13+=_0x4257b0(0xf2)+_0x496c2b[_0x4257b0(0x10d)]+_0x4257b0(0x1bf)+_0x496c2b[_0x4257b0(0x110)]+'\x0a';}if(_0x525ced){const _0x3ae71b=apiExperimentalArtifactToYaml(_0x525ced),_0x15d5e5=toExperimentalArtifactYamlString(_0x3ae71b);let _0x100ccc=_0x15d5e5+(_0x4257b0(0x166)+_0x3ae71b[_0x4257b0(0xd1)]+'\x0a');for(const _0x1cc15a of _0x3ae71b[_0x4257b0(0x1da)]){_0x100ccc+='---\x20file:\x20'+_0x1cc15a[_0x4257b0(0x10d)]+_0x4257b0(0x1bf)+_0x1cc15a[_0x4257b0(0x110)]+'\x0a';}const _0x38e2e8=generateDiff(_0x100ccc,_0x29cc13),_0x345bcc=hasChanges(_0x38e2e8);_0x345bcc?(_0x542b0e[_0x4257b0(0xbe)]['push']({'name':_0x40ef67[_0x4257b0(0x10e)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c5),'id':_0x525ced['id'],'diff':formatDiffWithColors(_0x38e2e8)}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0xbe)]['updated']++):(_0x542b0e[_0x4257b0(0xbe)][_0x4257b0(0x1b9)]({'name':_0x40ef67['def']['name'],'action':'unchanged','id':_0x525ced['id']}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0xbe)][_0x4257b0(0x1c3)]++);}else _0x542b0e['experimentalArtifacts'][_0x4257b0(0x1b9)]({'name':_0x40ef67[_0x4257b0(0x10e)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c8)}),_0x542b0e['counts'][_0x4257b0(0xbe)][_0x4257b0(0x1c8)]++;}for(const _0x31ae4c of _0x2b6366){const _0x21fb4c=_0x322613[_0x4257b0(0x141)](_0x31ae4c[_0x4257b0(0x12f)]['name']),_0xc6daeb=a138_0x1c3d61[_0x4257b0(0x1bc)](_0x31ae4c['path'],'utf-8');if(_0x21fb4c){const _0x5dbce5=await apiFormInterfaceToYaml(_0x21fb4c,_0x34b578),_0x30fa15=toFormInterfaceYamlString(_0x5dbce5),_0x965962=generateDiff(_0x30fa15,_0xc6daeb),_0x238aa1=hasChanges(_0x965962);_0x238aa1?(_0x542b0e[_0x4257b0(0x146)][_0x4257b0(0x1b9)]({'name':_0x31ae4c['yaml'][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c5),'id':_0x21fb4c['id'],'diff':formatDiffWithColors(_0x965962)}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x146)][_0x4257b0(0x1c5)]++):(_0x542b0e[_0x4257b0(0x146)]['push']({'name':_0x31ae4c[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c3),'id':_0x21fb4c['id']}),_0x542b0e[_0x4257b0(0x111)]['formInterfaces'][_0x4257b0(0x1c3)]++);}else _0x542b0e[_0x4257b0(0x146)]['push']({'name':_0x31ae4c[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c8)}),_0x542b0e['counts']['formInterfaces'][_0x4257b0(0x1c8)]++;}for(const _0x4a3d3c of _0x55f1d2){const _0x303834=_0x332b4c['get'](_0x4a3d3c['yaml']['name']),_0x1570cd=a138_0x1c3d61[_0x4257b0(0x1bc)](_0x4a3d3c[_0x4257b0(0xe7)],'utf-8');if(_0x303834){const _0x59c83c=await apiChatInterfaceToYaml(_0x303834,_0x34b578),_0x6daf44=toChatInterfaceYamlString(_0x59c83c),_0x5048d1=generateDiff(_0x6daf44,_0x1570cd),_0x4c06ef=hasChanges(_0x5048d1);_0x4c06ef?(_0x542b0e[_0x4257b0(0x1ac)]['push']({'name':_0x4a3d3c[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c5),'id':_0x303834['id'],'diff':formatDiffWithColors(_0x5048d1)}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x1ac)]['updated']++):(_0x542b0e[_0x4257b0(0x1ac)]['push']({'name':_0x4a3d3c[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c3),'id':_0x303834['id']}),_0x542b0e['counts']['chatInterfaces']['unchanged']++);}else _0x542b0e[_0x4257b0(0x1ac)]['push']({'name':_0x4a3d3c[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c8)}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x1ac)][_0x4257b0(0x1c8)]++;}if(_0x54d9fe?.[_0x4257b0(0x174)])return _0x542b0e;_0x542b0e[_0x4257b0(0x121)]=[],_0x542b0e[_0x4257b0(0x191)]=[],_0x542b0e[_0x4257b0(0x1a9)]=[],_0x542b0e[_0x4257b0(0x16d)]=[],_0x542b0e['experimentalKnowledgeBases']=[],_0x542b0e['experimentalArtifacts']=[],_0x542b0e['formInterfaces']=[],_0x542b0e[_0x4257b0(0x1ac)]=[];const _0x3ce753=_0x542b0e[_0x4257b0(0x15e)][_0x4257b0(0x17e)](_0xcf6bf6=>_0xcf6bf6[_0x4257b0(0x12e)]==='error');_0x542b0e[_0x4257b0(0x15e)]=_0x3ce753,_0x542b0e[_0x4257b0(0x111)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x3ce753[_0x4257b0(0xed)]},'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 _0x99a1f9 of _0xc25391){try{const _0x427d12=_0x59fff9[_0x4257b0(0x141)](_0x99a1f9['yaml'][_0x4257b0(0x11d)]),_0x30bd4b=yamlKnowledgeBaseToApi(_0x99a1f9[_0x4257b0(0x12f)],_0x5d188a);if(_0x427d12)await this[_0x4257b0(0x19c)]['updateKnowledgeBase'](_0x427d12['id'],_0x30bd4b),_0x2e1ea5[_0x4257b0(0x14d)](_0x99a1f9[_0x4257b0(0x12f)]['name'],_0x427d12['id']),_0x542b0e['knowledgeBases'][_0x4257b0(0x1b9)]({'name':_0x99a1f9[_0x4257b0(0x12f)]['name'],'action':_0x4257b0(0x1c5),'id':_0x427d12['id']}),_0x542b0e[_0x4257b0(0x111)]['knowledgeBases'][_0x4257b0(0x1c5)]++;else{const _0x1acd40=await this[_0x4257b0(0x19c)]['createKnowledgeBase'](_0x30bd4b);_0x2e1ea5[_0x4257b0(0x14d)](_0x99a1f9[_0x4257b0(0x12f)][_0x4257b0(0x11d)],_0x1acd40['id']),_0x542b0e['knowledgeBases'][_0x4257b0(0x1b9)]({'name':_0x99a1f9['yaml']['name'],'action':_0x4257b0(0x1c8),'id':_0x1acd40['id']}),_0x542b0e['counts'][_0x4257b0(0x121)][_0x4257b0(0x1c8)]++;}}catch(_0x30de8a){_0x542b0e[_0x4257b0(0x121)][_0x4257b0(0x1b9)]({'name':_0x99a1f9[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':_0x4257b0(0x120),'error':_0x30de8a[_0x4257b0(0x114)]}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x121)][_0x4257b0(0xbd)]++;}}for(const _0x16f200 of _0xaab9c4){try{const _0x3c3688=_0x2c49b5[_0x4257b0(0x141)](_0x16f200[_0x4257b0(0x11d)]),_0x25c693=yamlTextKnowledgeBaseToApi({'name':_0x16f200[_0x4257b0(0x11d)],'text':_0x16f200[_0x4257b0(0x103)]},_0x5d188a);if(_0x3c3688)await this[_0x4257b0(0x19c)][_0x4257b0(0x162)](_0x3c3688['id'],_0x25c693),_0x517081['set'](_0x16f200[_0x4257b0(0x11d)],_0x3c3688['id']),_0x542b0e[_0x4257b0(0x191)]['push']({'name':_0x16f200[_0x4257b0(0x11d)],'action':_0x4257b0(0x1c5),'id':_0x3c3688['id']}),_0x542b0e['counts']['textKnowledgeBases'][_0x4257b0(0x1c5)]++;else{const _0x5da894=await this['client']['createTextKnowledgeBase'](_0x25c693);_0x517081[_0x4257b0(0x14d)](_0x16f200['name'],_0x5da894['id']),_0x542b0e[_0x4257b0(0x191)][_0x4257b0(0x1b9)]({'name':_0x16f200[_0x4257b0(0x11d)],'action':_0x4257b0(0x1c8),'id':_0x5da894['id']}),_0x542b0e['counts']['textKnowledgeBases']['created']++;}}catch(_0x30b645){_0x542b0e['textKnowledgeBases'][_0x4257b0(0x1b9)]({'name':_0x16f200['name'],'action':_0x4257b0(0x120),'error':_0x30b645[_0x4257b0(0x114)]}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x191)][_0x4257b0(0xbd)]++;}}for(const _0x3cbbec of _0x49129d){try{const _0x388a7f=_0x595d78[_0x4257b0(0x141)](_0x3cbbec[_0x4257b0(0x10e)][_0x4257b0(0x11d)]),_0x354e62=yamlExperimentalKnowledgeBaseToApi(_0x3cbbec[_0x4257b0(0x10e)],_0x5d188a);if(_0x388a7f)await this[_0x4257b0(0x19c)][_0x4257b0(0x177)](_0x388a7f['id'],_0x354e62),_0x2c3248['set'](_0x3cbbec['def'][_0x4257b0(0x11d)],_0x388a7f['id']),_0x542b0e[_0x4257b0(0x139)][_0x4257b0(0x1b9)]({'name':_0x3cbbec[_0x4257b0(0x10e)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c5),'id':_0x388a7f['id']}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x139)][_0x4257b0(0x1c5)]++;else{const _0x43f740=await this[_0x4257b0(0x19c)][_0x4257b0(0x104)](_0x354e62);_0x2c3248[_0x4257b0(0x14d)](_0x3cbbec['def'][_0x4257b0(0x11d)],_0x43f740['id']),_0x542b0e['experimentalKnowledgeBases'][_0x4257b0(0x1b9)]({'name':_0x3cbbec[_0x4257b0(0x10e)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c8),'id':_0x43f740['id']}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x139)][_0x4257b0(0x1c8)]++;}}catch(_0x5b8b1b){_0x542b0e['experimentalKnowledgeBases'][_0x4257b0(0x1b9)]({'name':_0x3cbbec[_0x4257b0(0x10e)][_0x4257b0(0x11d)],'action':_0x4257b0(0x120),'error':_0x5b8b1b[_0x4257b0(0x114)]}),_0x542b0e['counts']['experimentalKnowledgeBases'][_0x4257b0(0xbd)]++;}}for(const _0x5bb276 of _0x540064){try{const _0x42f5dd=_0x55ffe9['get'](_0x5bb276[_0x4257b0(0x10e)][_0x4257b0(0x11d)]),_0x34e274=yamlExperimentalArtifactToApi(_0x5bb276['def'],_0x5d188a);if(_0x42f5dd)await this['client'][_0x4257b0(0x117)](_0x42f5dd['id'],_0x34e274),_0x185f55[_0x4257b0(0x14d)](_0x5bb276[_0x4257b0(0x10e)][_0x4257b0(0x11d)],_0x42f5dd['id']),_0x542b0e[_0x4257b0(0xbe)][_0x4257b0(0x1b9)]({'name':_0x5bb276[_0x4257b0(0x10e)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c5),'id':_0x42f5dd['id']}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0xbe)]['updated']++;else{const _0x423898=await this[_0x4257b0(0x19c)][_0x4257b0(0x165)](_0x34e274);_0x185f55['set'](_0x5bb276[_0x4257b0(0x10e)][_0x4257b0(0x11d)],_0x423898['id']),_0x542b0e[_0x4257b0(0xbe)]['push']({'name':_0x5bb276[_0x4257b0(0x10e)][_0x4257b0(0x11d)],'action':'created','id':_0x423898['id']}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0xbe)][_0x4257b0(0x1c8)]++;}}catch(_0x4fd1ba){_0x542b0e[_0x4257b0(0xbe)][_0x4257b0(0x1b9)]({'name':_0x5bb276[_0x4257b0(0x10e)][_0x4257b0(0x11d)],'action':_0x4257b0(0x120),'error':_0x4fd1ba[_0x4257b0(0x114)]}),_0x542b0e['counts'][_0x4257b0(0xbe)]['errors']++;}}for(const _0x3d1c72 of _0x4843f8){_0x355742=[];try{const _0x2fa41f=_0x5ef0ca['get'](_0x3d1c72[_0x4257b0(0x12f)][_0x4257b0(0x11d)]),_0x7ec54a=await agentDefToRequest(_0x3d1c72['yaml'],_0x3d1c72[_0x4257b0(0x182)],_0x3d1c72[_0x4257b0(0x118)],_0x5d48d7);if(_0x2fa41f)await this[_0x4257b0(0x19c)][_0x4257b0(0x17f)](_0x2fa41f['id'],_0x7ec54a),_0x21be5c[_0x4257b0(0x14d)](_0x3d1c72['yaml'][_0x4257b0(0x11d)],_0x2fa41f['id']),_0x542b0e[_0x4257b0(0x15e)][_0x4257b0(0x1b9)]({'agentName':_0x3d1c72[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c5),'agentId':_0x2fa41f['id'],'warnings':_0x355742['length']>0x0?_0x355742:undefined}),_0x542b0e['counts']['agents'][_0x4257b0(0x1c5)]++;else{const _0x3d0115=await this[_0x4257b0(0x19c)]['createAgentResponse'](_0x7ec54a);_0x21be5c[_0x4257b0(0x14d)](_0x3d1c72[_0x4257b0(0x12f)][_0x4257b0(0x11d)],_0x3d0115['id']),_0x542b0e[_0x4257b0(0x15e)]['push']({'agentName':_0x3d1c72[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c8),'agentId':_0x3d0115['id'],'warnings':_0x355742['length']>0x0?_0x355742:undefined}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x15e)][_0x4257b0(0x1c8)]++;}}catch(_0x57d983){_0x542b0e[_0x4257b0(0x15e)][_0x4257b0(0x1b9)]({'agentName':_0x3d1c72['yaml'][_0x4257b0(0x11d)],'action':_0x4257b0(0x120),'error':_0x57d983[_0x4257b0(0x114)],'warnings':_0x355742[_0x4257b0(0xed)]>0x0?_0x355742:undefined}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x15e)][_0x4257b0(0xbd)]++;}}for(const _0x3c2069 of _0x1c1e65){try{const _0x5bceb5=_0x3e4f57[_0x4257b0(0x141)](_0x3c2069[_0x4257b0(0x12f)][_0x4257b0(0x11d)]),_0x1800c1=await yamlPromptToApi(_0x3c2069[_0x4257b0(0x12f)],_0x5d188a,_0x5d48d7);if(!_0x1800c1){_0x542b0e[_0x4257b0(0x1a9)][_0x4257b0(0x1b9)]({'name':_0x3c2069[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':_0x4257b0(0x120),'error':_0x4257b0(0x150)}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x1a9)]['errors']++;continue;}if(_0x5bceb5)await this[_0x4257b0(0x19c)]['updatePrompt'](_0x5bceb5['id'],_0x1800c1),_0x1defca[_0x4257b0(0x14d)](_0x3c2069[_0x4257b0(0x12f)]['name'],_0x5bceb5['id']),_0x542b0e[_0x4257b0(0x1a9)][_0x4257b0(0x1b9)]({'name':_0x3c2069[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':'updated','id':_0x5bceb5['id']}),_0x542b0e['counts'][_0x4257b0(0x1a9)][_0x4257b0(0x1c5)]++;else{const _0x323d44=await this['client'][_0x4257b0(0x1d8)](_0x1800c1);_0x1defca[_0x4257b0(0x14d)](_0x3c2069[_0x4257b0(0x12f)][_0x4257b0(0x11d)],_0x323d44['id']),_0x542b0e[_0x4257b0(0x1a9)][_0x4257b0(0x1b9)]({'name':_0x3c2069[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c8),'id':_0x323d44['id']}),_0x542b0e['counts'][_0x4257b0(0x1a9)][_0x4257b0(0x1c8)]++;}}catch(_0x53f55f){_0x542b0e['prompts']['push']({'name':_0x3c2069['yaml']['name'],'action':_0x4257b0(0x120),'error':_0x53f55f[_0x4257b0(0x114)]}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x1a9)]['errors']++;}}for(const _0x3fb92b of _0x214b5c){try{const _0x25e6cf=_0x43a465[_0x4257b0(0x141)](_0x3fb92b['yaml'][_0x4257b0(0xcd)]),_0x1b0681=await yamlIntegrationToApi(_0x3fb92b[_0x4257b0(0x12f)],_0x5d188a,_0x5d48d7);if(_0x25e6cf){await this[_0x4257b0(0x19c)][_0x4257b0(0xf5)](_0x25e6cf['id']);const _0x52d524=await this[_0x4257b0(0x19c)][_0x4257b0(0xd7)](_0x1b0681);_0x542b0e['integrations'][_0x4257b0(0x1b9)]({'name':_0x3fb92b[_0x4257b0(0x12f)][_0x4257b0(0xcd)],'action':_0x4257b0(0x1c5),'id':_0x52d524['id']}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x16d)][_0x4257b0(0x1c5)]++;}else{const _0x57107d=await this[_0x4257b0(0x19c)][_0x4257b0(0xd7)](_0x1b0681);_0x542b0e['integrations']['push']({'name':_0x3fb92b[_0x4257b0(0x12f)][_0x4257b0(0xcd)],'action':_0x4257b0(0x1c8),'id':_0x57107d['id']}),_0x542b0e[_0x4257b0(0x111)]['integrations']['created']++;}}catch(_0x1e46ac){_0x542b0e[_0x4257b0(0x16d)][_0x4257b0(0x1b9)]({'name':_0x3fb92b[_0x4257b0(0x12f)][_0x4257b0(0xcd)],'action':_0x4257b0(0x120),'error':_0x1e46ac['message']}),_0x542b0e[_0x4257b0(0x111)]['integrations']['errors']++;}}for(const _0x13bf5c of _0x2b6366){try{const _0x3f4285=_0x322613['get'](_0x13bf5c[_0x4257b0(0x12f)][_0x4257b0(0x11d)]),_0x1b8e59=await yamlFormInterfaceToApi(_0x13bf5c[_0x4257b0(0x12f)],_0x5d188a,_0x5d48d7);if(!_0x1b8e59){_0x542b0e[_0x4257b0(0x146)][_0x4257b0(0x1b9)]({'name':_0x13bf5c[_0x4257b0(0x12f)]['name'],'action':_0x4257b0(0x120),'error':_0x4257b0(0x112)}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x146)][_0x4257b0(0xbd)]++;continue;}if(_0x3f4285){const _0x44251c=await this['client'][_0x4257b0(0x15f)](_0x3f4285['id'],_0x1b8e59);_0x542b0e[_0x4257b0(0x146)][_0x4257b0(0x1b9)]({'name':_0x13bf5c[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c5),'id':_0x44251c['id']}),_0x542b0e[_0x4257b0(0x111)]['formInterfaces']['updated']++;}else{const _0x338d8c=await this[_0x4257b0(0x19c)][_0x4257b0(0x1b6)](_0x1b8e59);_0x542b0e[_0x4257b0(0x146)]['push']({'name':_0x13bf5c[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':_0x4257b0(0x1c8),'id':_0x338d8c['id']}),_0x542b0e[_0x4257b0(0x111)]['formInterfaces'][_0x4257b0(0x1c8)]++;}}catch(_0x44694d){_0x542b0e[_0x4257b0(0x146)][_0x4257b0(0x1b9)]({'name':_0x13bf5c[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':'error','error':_0x44694d[_0x4257b0(0x114)]}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x146)][_0x4257b0(0xbd)]++;}}for(const _0x88ed77 of _0x55f1d2){try{const _0xe51f00=_0x332b4c['get'](_0x88ed77[_0x4257b0(0x12f)][_0x4257b0(0x11d)]),_0x25f99a=await yamlChatInterfaceToApi(_0x88ed77['yaml'],_0x5d188a,_0x5d48d7);if(_0xe51f00){const _0x415c80=await this[_0x4257b0(0x19c)]['updateChatInterface'](_0xe51f00['id'],_0x25f99a);_0x542b0e[_0x4257b0(0x1ac)][_0x4257b0(0x1b9)]({'name':_0x88ed77[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':'updated','id':_0x415c80['id']}),_0x542b0e['counts'][_0x4257b0(0x1ac)]['updated']++;}else{const _0x10ef8c=await this[_0x4257b0(0x19c)][_0x4257b0(0x194)](_0x25f99a);_0x542b0e[_0x4257b0(0x1ac)][_0x4257b0(0x1b9)]({'name':_0x88ed77[_0x4257b0(0x12f)]['name'],'action':_0x4257b0(0x1c8),'id':_0x10ef8c['id']}),_0x542b0e[_0x4257b0(0x111)][_0x4257b0(0x1ac)]['created']++;}}catch(_0x392c6b){_0x542b0e[_0x4257b0(0x1ac)][_0x4257b0(0x1b9)]({'name':_0x88ed77[_0x4257b0(0x12f)][_0x4257b0(0x11d)],'action':_0x4257b0(0x120),'error':_0x392c6b['message']}),_0x542b0e[_0x4257b0(0x111)]['chatInterfaces']['errors']++;}}return _0x542b0e;}async[a138_0xec2434(0x1bd)](_0x254a4a,_0x56c5d0,_0x113a50,_0x3a4190){const _0x279cef=a138_0xec2434,{projectId:_0x59e364,project:_0x493d52}=await this['resolveProjectName'](_0x254a4a),_0x3d44e5=_0x493d52[_0x279cef(0x178)][_0x279cef(0x11d)],_0x66b4ef=await this[_0x279cef(0x19c)][_0x279cef(0x1af)](_0x59e364),_0x478c98=_0x66b4ef[_0x279cef(0x190)](_0x1cdb92=>_0x1cdb92[_0x279cef(0x178)][_0x279cef(0x11d)]===_0x56c5d0);if(!_0x478c98)throw new SDKError(ErrorCode[_0x279cef(0x196)],'Agent\x20not\x20found:\x20'+_0x56c5d0,undefined,{'helpText':'Available\x20agents:\x20'+_0x66b4ef[_0x279cef(0x1ae)](_0x3d0966=>_0x3d0966[_0x279cef(0x178)][_0x279cef(0x11d)])[_0x279cef(0x1cc)](',\x20')});let _0x3e8160;if(_0x113a50)_0x3e8160=_0x113a50;else{const _0x1aea60=a138_0x2da90b[_0x279cef(0x1cc)](process[_0x279cef(0x14b)](),_0x279cef(0x15e)),_0x4bbfb6=getSanitizedPathWithMigration(_0x1aea60,_0x3d44e5);_0x4bbfb6[_0x279cef(0xf6)]&&this['logger'][_0x279cef(0x1bb)](_0x279cef(0x1d7)+a138_0x2da90b['basename'](_0x4bbfb6[_0x279cef(0x1b3)])+'\x20→\x20'+a138_0x2da90b[_0x279cef(0x128)](_0x4bbfb6[_0x279cef(0xe7)])),_0x3e8160=_0x4bbfb6['path'];}const _0x2c5080=getSanitizedPathWithMigration(_0x3e8160,_0x56c5d0);_0x2c5080[_0x279cef(0xf6)]&&this['logger'][_0x279cef(0x1bb)]('Renamed\x20agent\x20folder:\x20'+a138_0x2da90b[_0x279cef(0x128)](_0x2c5080[_0x279cef(0x1b3)])+_0x279cef(0x136)+a138_0x2da90b[_0x279cef(0x128)](_0x2c5080[_0x279cef(0xe7)]));const _0xc912=_0x2c5080[_0x279cef(0xe7)],_0x32acfe=new Map(),_0x2c3191=new Map(),_0x2338f0=await this['client'][_0x279cef(0xef)](_0x59e364),_0x7f3af8=await this[_0x279cef(0x19c)][_0x279cef(0xbc)](_0x59e364),_0x56f18d=await safeListOrEmpty(()=>this[_0x279cef(0x19c)][_0x279cef(0x1d4)](_0x59e364)),_0x78bd4d=new Map(),_0x49da22=new Map();for(const _0x4c876e of _0x2338f0){_0x32acfe[_0x279cef(0x14d)](_0x4c876e['id'],_0x4c876e[_0x279cef(0x178)]['name']);}for(const _0x4e525c of _0x7f3af8){_0x78bd4d[_0x279cef(0x14d)](_0x4e525c['id'],_0x4e525c['attributes']['name']);}for(const _0x148fb6 of _0x56f18d){_0x49da22[_0x279cef(0x14d)](_0x148fb6['id'],_0x148fb6[_0x279cef(0x178)][_0x279cef(0x11d)]);}for(const _0x504878 of _0x66b4ef){_0x2c3191[_0x279cef(0x14d)](_0x504878['id'],_0x504878['attributes'][_0x279cef(0x11d)]);}const _0x445b4c={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x32acfe,'TextKnowledgeBase':_0x78bd4d,'Agent':_0x2c3191,'ExperimentalKnowledgeBase':_0x49da22}),'resolvePromptName':async()=>undefined,'onWarning':_0x50464b=>this[_0x279cef(0xb9)][_0x279cef(0x1a5)](_0x50464b)},_0x5b484b=a138_0x2da90b[_0x279cef(0x1cc)](_0xc912,'prompt.md'),_0x57f5e3=a138_0x2da90b['join'](_0xc912,_0x279cef(0x16c)),_0x36932b=a138_0x2da90b[_0x279cef(0x1cc)](_0xc912,'starter_message.md'),_0x131dc6=!a138_0x1c3d61['existsSync'](_0x57f5e3);if(_0x3a4190?.[_0x279cef(0x174)])return{'agentName':_0x56c5d0,'outputPath':_0xc912,'isNew':_0x131dc6,'hasChanges':!![]};a138_0x1c3d61[_0x279cef(0xd9)](_0x3e8160,{'recursive':!![]}),a138_0x1c3d61[_0x279cef(0xd9)](_0xc912,{'recursive':!![]});const _0x35574a=a138_0x2da90b['join'](_0x3e8160,'tdx.json');!a138_0x1c3d61[_0x279cef(0xfe)](_0x35574a)&&a138_0x1c3d61[_0x279cef(0x183)](_0x35574a,createAgentConfigContent(_0x254a4a));const {yaml:_0x127265,systemPrompt:_0x458a84,starterMessage:_0x34852b}=await agentResponseToDef(_0x478c98,_0x445b4c);let _0x528af3=_0x131dc6;if(!_0x131dc6){const _0x4c830=a138_0x1c3d61[_0x279cef(0xfe)](_0x5b484b)?a138_0x1c3d61[_0x279cef(0x1bc)](_0x5b484b,_0x279cef(0xcf)):'',_0x56698e=a138_0x1c3d61[_0x279cef(0x1bc)](_0x57f5e3,_0x279cef(0xcf));_0x528af3=_0x4c830!==_0x458a84||_0x56698e!==toAgentYamlString(_0x127265);}a138_0x1c3d61['writeFileSync'](_0x5b484b,_0x458a84),a138_0x1c3d61[_0x279cef(0x183)](_0x57f5e3,toAgentYamlString(_0x127265));if(_0x34852b&&_0x34852b[_0x279cef(0x158)]('\x0a'))a138_0x1c3d61['writeFileSync'](_0x36932b,_0x34852b);else a138_0x1c3d61[_0x279cef(0xfe)](_0x36932b)&&a138_0x1c3d61[_0x279cef(0x161)](_0x36932b);return{'agentName':_0x56c5d0,'outputPath':_0xc912,'isNew':_0x131dc6,'hasChanges':_0x528af3};}async[a138_0xec2434(0x184)](_0x515665,_0x3cb89a){const _0x3f090d=a138_0xec2434;let _0x2466e6;isAgentYamlPath(_0x515665)?_0x2466e6=getAgentDirFromYamlPath(_0x515665):_0x2466e6=_0x515665;const {config:_0x380cd8}=findAgentConfig(_0x2466e6),_0x5d770a=await this['resolveProjectId'](_0x380cd8[_0x3f090d(0x154)]),_0x22ab03=a138_0x2da90b[_0x3f090d(0x1cc)](_0x2466e6,_0x3f090d(0x16c)),_0x4f0b1a=a138_0x2da90b[_0x3f090d(0x1cc)](_0x2466e6,_0x3f090d(0x105)),_0x27974=a138_0x2da90b[_0x3f090d(0x1cc)](_0x2466e6,_0x3f090d(0xea));if(!a138_0x1c3d61[_0x3f090d(0xfe)](_0x22ab03))throw new SDKError(ErrorCode[_0x3f090d(0x1c0)],_0x3f090d(0x1a3)+_0x2466e6,undefined,{'helpText':_0x3f090d(0xc6)});const _0x55497e=parseAgentYaml(a138_0x1c3d61[_0x3f090d(0x1bc)](_0x22ab03,'utf-8'),_0x22ab03),_0xc3f670=a138_0x1c3d61[_0x3f090d(0xfe)](_0x4f0b1a)?a138_0x1c3d61['readFileSync'](_0x4f0b1a,'utf-8'):'',_0x3c0140=a138_0x1c3d61['existsSync'](_0x27974)?a138_0x1c3d61[_0x3f090d(0x1bc)](_0x27974,'utf-8'):_0x55497e[_0x3f090d(0x18d)];if(_0x3cb89a?.[_0x3f090d(0x174)])return{'agentName':_0x55497e[_0x3f090d(0x11d)],'action':_0x3f090d(0x1c8),'projectId':_0x5d770a};const _0x2c0d9d=await this[_0x3f090d(0x19c)][_0x3f090d(0x1af)](_0x5d770a),_0x1c9bef=await fetchAllToolTargetMaps((_0x3d429a,_0x4dfa37)=>this[_0x3f090d(0x19c)][_0x3f090d(0xca)](_0x3d429a,_0x4dfa37),_0x5d770a),_0x53075d=new Map();for(const _0x53444b of _0x2c0d9d){_0x53075d[_0x3f090d(0x14d)](_0x53444b[_0x3f090d(0x178)]['name'],_0x53444b['id']);}const _0x2e60f2=[],_0x79fb51={'projectId':_0x5d770a,'resolveToolTargetId':buildIdResolver({..._0x1c9bef[_0x3f090d(0x1d5)],'Agent':_0x53075d}),'resolvePromptId':async()=>undefined,'onWarning':_0x6a476f=>{const _0x6cd657=_0x3f090d;this[_0x6cd657(0xb9)][_0x6cd657(0x1a5)](_0x6a476f),_0x2e60f2[_0x6cd657(0x1b9)](_0x6a476f);}};try{const _0x3f8f78=_0x2c0d9d[_0x3f090d(0x190)](_0x40a719=>_0x40a719[_0x3f090d(0x178)][_0x3f090d(0x11d)]===_0x55497e[_0x3f090d(0x11d)]),_0x28aab2=await agentDefToRequest(_0x55497e,_0xc3f670,_0x3c0140,_0x79fb51);if(_0x3f8f78)return await this[_0x3f090d(0x19c)][_0x3f090d(0x17f)](_0x3f8f78['id'],_0x28aab2),{'agentName':_0x55497e['name'],'action':_0x3f090d(0x1c5),'projectId':_0x5d770a,'agentId':_0x3f8f78['id'],'warnings':_0x2e60f2[_0x3f090d(0xed)]>0x0?_0x2e60f2:undefined};else{const _0x3f336c=await this['client'][_0x3f090d(0xc3)](_0x28aab2);return{'agentName':_0x55497e[_0x3f090d(0x11d)],'action':_0x3f090d(0x1c8),'projectId':_0x5d770a,'agentId':_0x3f336c['id'],'warnings':_0x2e60f2[_0x3f090d(0xed)]>0x0?_0x2e60f2:undefined};}}catch(_0x50c7eb){return{'agentName':_0x55497e['name'],'action':_0x3f090d(0x120),'projectId':_0x5d770a,'error':_0x50c7eb['message'],'warnings':_0x2e60f2[_0x3f090d(0xed)]>0x0?_0x2e60f2:undefined};}}async['cloneProject'](_0xe729cd,_0x72666c,_0x53ab50){const _0x350ca0=a138_0xec2434,_0x17a8e1=a138_0x1c3d61['existsSync'](_0xe729cd)&&a138_0x1c3d61[_0x350ca0(0xfe)](a138_0x2da90b[_0x350ca0(0x1cc)](_0xe729cd,_0x350ca0(0x142)));let _0x39d5df;const _0x3bfad4=[],_0x1a2d81=[],_0xf8e281=[],_0x3bc5e6=[],_0x3d1b75=[],_0x4c4a06=[],_0x3b4dcd=[],_0x440c8a=[],_0x443065=[];if(_0x17a8e1){const _0x53c653=loadAgentConfig(a138_0x2da90b['join'](_0xe729cd,_0x350ca0(0x142)));_0x39d5df=_0x53c653[_0x350ca0(0x154)];const _0x1a9b29=a138_0x1c3d61[_0x350ca0(0x14c)](_0xe729cd,{'withFileTypes':!![]});for(const _0x467512 of _0x1a9b29){if(!_0x467512['isDirectory']())continue;if([_0x350ca0(0x170),_0x350ca0(0xc1),_0x350ca0(0xe9),'prompts',_0x350ca0(0x16d),'form_interfaces',_0x350ca0(0x1d0)][_0x350ca0(0x158)](_0x467512[_0x350ca0(0x11d)]))continue;const _0x5ce558=a138_0x2da90b[_0x350ca0(0x1cc)](_0xe729cd,_0x467512[_0x350ca0(0x11d)]);if(isAgentDir(_0x5ce558)){const _0x4f88f7=a138_0x2da90b['join'](_0x5ce558,'agent.yml'),_0x3f15d8=a138_0x2da90b[_0x350ca0(0x1cc)](_0x5ce558,_0x350ca0(0x105)),_0xaf6c8a=a138_0x2da90b['join'](_0x5ce558,_0x350ca0(0xea)),_0x1a3804=parseAgentYaml(a138_0x1c3d61[_0x350ca0(0x1bc)](_0x4f88f7,'utf-8'),_0x4f88f7),_0xb35032=a138_0x1c3d61[_0x350ca0(0xfe)](_0x3f15d8)?a138_0x1c3d61[_0x350ca0(0x1bc)](_0x3f15d8,_0x350ca0(0xcf)):'',_0x2fed82=a138_0x1c3d61[_0x350ca0(0xfe)](_0xaf6c8a)?a138_0x1c3d61['readFileSync'](_0xaf6c8a,'utf-8'):_0x1a3804[_0x350ca0(0x18d)];_0x3bfad4['push']({'name':_0x1a3804[_0x350ca0(0x11d)],'dir':_0x5ce558,'yaml':_0x1a3804,'systemPrompt':_0xb35032,'starterMessage':_0x2fed82});}}const _0x56bd3e=getKnowledgeBasesDir(_0xe729cd);if(a138_0x1c3d61['existsSync'](_0x56bd3e)){const _0x2566a5=a138_0x1c3d61['readdirSync'](_0x56bd3e);for(const _0x1e5799 of _0x2566a5){const _0x1b802b=a138_0x2da90b[_0x350ca0(0x1cc)](_0x56bd3e,_0x1e5799);if(_0x1e5799[_0x350ca0(0x15b)]('.yml')){const _0x3276a5=parseKnowledgeBaseYaml(a138_0x1c3d61['readFileSync'](_0x1b802b,'utf-8'),_0x1b802b);_0x1a2d81[_0x350ca0(0x1b9)]({'name':_0x3276a5[_0x350ca0(0x11d)],'path':_0x1b802b,'yaml':_0x3276a5});}else{if(_0x1e5799[_0x350ca0(0x15b)]('.md')){const _0x95b8f6=a138_0x1c3d61['readFileSync'](_0x1b802b,'utf-8'),{name:_0x331a1a,text:_0x4eb1cd}=parseTextKnowledgeBaseMd(_0x95b8f6,_0x1e5799);_0xf8e281[_0x350ca0(0x1b9)]({'name':_0x331a1a,'path':_0x1b802b,'text':_0x4eb1cd});}}}}const _0x2c50ca=getPromptsDir(_0xe729cd);if(a138_0x1c3d61[_0x350ca0(0xfe)](_0x2c50ca)){const _0x2654c2=a138_0x1c3d61['readdirSync'](_0x2c50ca)[_0x350ca0(0x17e)](_0x1ab506=>_0x1ab506[_0x350ca0(0x15b)]('.yml'));for(const _0x45cdc9 of _0x2654c2){const _0x1314aa=a138_0x2da90b[_0x350ca0(0x1cc)](_0x2c50ca,_0x45cdc9),_0x494ed7=parsePromptYaml(a138_0x1c3d61[_0x350ca0(0x1bc)](_0x1314aa,_0x350ca0(0xcf)),_0x1314aa);_0x3bc5e6[_0x350ca0(0x1b9)]({'name':_0x494ed7[_0x350ca0(0x11d)],'path':_0x1314aa,'yaml':_0x494ed7});}}const _0x3ff5c5=getIntegrationsDir(_0xe729cd);if(a138_0x1c3d61[_0x350ca0(0xfe)](_0x3ff5c5)){const _0x580711=a138_0x1c3d61[_0x350ca0(0x14c)](_0x3ff5c5)[_0x350ca0(0x17e)](_0x16a59c=>_0x16a59c[_0x350ca0(0x15b)]('.yml'));for(const _0x154ff8 of _0x580711){const _0x1fd738=a138_0x2da90b[_0x350ca0(0x1cc)](_0x3ff5c5,_0x154ff8),_0x4af081=parseIntegrationYaml(a138_0x1c3d61[_0x350ca0(0x1bc)](_0x1fd738,_0x350ca0(0xcf)),_0x1fd738);SAFE_INTEGRATION_TYPES[_0x350ca0(0x158)](_0x4af081['service_type'][_0x350ca0(0x11e)]())?_0x3d1b75['push']({'name':_0x4af081[_0x350ca0(0x11d)],'path':_0x1fd738,'yaml':_0x4af081}):this[_0x350ca0(0xb9)][_0x350ca0(0x1a5)](_0x350ca0(0x1c1)+_0x4af081[_0x350ca0(0x11d)]+_0x350ca0(0x176)+_0x4af081[_0x350ca0(0xcd)]+_0x350ca0(0x180)+(_0x350ca0(0xdd)+SAFE_INTEGRATION_TYPES['join'](',\x20')+')\x20can\x20be\x20cloned.'));}}const _0x3ca9e7=getExperimentalKnowledgeBasesDir(_0xe729cd);if(a138_0x1c3d61[_0x350ca0(0xfe)](_0x3ca9e7)){const _0x449726=a138_0x1c3d61[_0x350ca0(0x14c)](_0x3ca9e7,{'withFileTypes':!![]});for(const _0x4cc46a of _0x449726){if(!_0x4cc46a[_0x350ca0(0xdc)]())continue;const _0x284c20=a138_0x2da90b['join'](_0x3ca9e7,_0x4cc46a[_0x350ca0(0x11d)]),_0x101e34=a138_0x2da90b[_0x350ca0(0x1cc)](_0x284c20,_0x4cc46a[_0x350ca0(0x11d)]+_0x350ca0(0x1a2));if(a138_0x1c3d61[_0x350ca0(0xfe)](_0x101e34)){const _0x5c4851=parseExperimentalKnowledgeBaseYaml(a138_0x1c3d61['readFileSync'](_0x101e34,_0x350ca0(0xcf)),_0x101e34),_0x47afb2=a138_0x2da90b['join'](_0x284c20,'functions'),_0x21e115=[];if(a138_0x1c3d61['existsSync'](_0x47afb2)){const _0x52ef62=a138_0x1c3d61[_0x350ca0(0x14c)](_0x47afb2,{'withFileTypes':!![]});for(const _0x30e036 of _0x52ef62){if(!_0x30e036[_0x350ca0(0xdc)]())continue;const _0x55c33a=a138_0x2da90b[_0x350ca0(0x1cc)](_0x47afb2,_0x30e036[_0x350ca0(0x11d)]),_0x5b742c=a138_0x2da90b['join'](_0x55c33a,_0x350ca0(0x13c)),_0x39a1f9=a138_0x2da90b['join'](_0x55c33a,_0x350ca0(0x192));if(a138_0x1c3d61[_0x350ca0(0xfe)](_0x5b742c)&&a138_0x1c3d61[_0x350ca0(0xfe)](_0x39a1f9)){const _0x32878=a138_0x1c3d61['readFileSync'](_0x5b742c,_0x350ca0(0xcf)),_0x2c0d10=a138_0x1c3d61['readFileSync'](_0x39a1f9,_0x350ca0(0xcf));_0x21e115[_0x350ca0(0x1b9)]({'name':_0x30e036['name'],'code':_0x32878,'json_schema':_0x2c0d10});}}}const _0x57d703={..._0x5c4851,'functions':_0x21e115};_0x4c4a06['push']({'name':_0x5c4851[_0x350ca0(0x11d)],'path':_0x284c20,'def':_0x57d703});}}}const _0x7e5729=getExperimentalArtifactsDir(_0xe729cd);if(a138_0x1c3d61[_0x350ca0(0xfe)](_0x7e5729)){const _0x36fc17=a138_0x1c3d61[_0x350ca0(0x14c)](_0x7e5729,{'withFileTypes':!![]});for(const _0x32ab05 of _0x36fc17){if(!_0x32ab05[_0x350ca0(0xdc)]())continue;const _0x5c5e2c=a138_0x2da90b[_0x350ca0(0x1cc)](_0x7e5729,_0x32ab05[_0x350ca0(0x11d)]),_0x4e8581=a138_0x2da90b[_0x350ca0(0x1cc)](_0x5c5e2c,_0x32ab05[_0x350ca0(0x11d)]+_0x350ca0(0x1a2));if(a138_0x1c3d61[_0x350ca0(0xfe)](_0x4e8581)){const _0x4f7cc5=parseExperimentalArtifactYaml(a138_0x1c3d61[_0x350ca0(0x1bc)](_0x4e8581,_0x350ca0(0xcf)),_0x4e8581),_0x182a8b=a138_0x2da90b['join'](_0x5c5e2c,'code.js'),_0x2f33fb=a138_0x1c3d61[_0x350ca0(0xfe)](_0x182a8b)?a138_0x1c3d61[_0x350ca0(0x1bc)](_0x182a8b,_0x350ca0(0xcf)):'',_0x789f53=a138_0x2da90b[_0x350ca0(0x1cc)](_0x5c5e2c,_0x350ca0(0x1da)),_0x200b72=[];if(a138_0x1c3d61[_0x350ca0(0xfe)](_0x789f53)){const _0x54c773=a138_0x1c3d61['readdirSync'](_0x789f53);for(const _0x45678d of _0x54c773){const _0x4b505a=a138_0x2da90b[_0x350ca0(0x1cc)](_0x789f53,_0x45678d);if(a138_0x1c3d61[_0x350ca0(0x164)](_0x4b505a)[_0x350ca0(0x1b4)]()){const _0x54bbd5=a138_0x1c3d61[_0x350ca0(0x1bc)](_0x4b505a,'utf-8');_0x200b72['push']({'file_name':_0x45678d,'text_content':_0x54bbd5});}}}const _0x260827={..._0x4f7cc5,'code':_0x2f33fb,'files':_0x200b72};_0x3b4dcd['push']({'name':_0x4f7cc5[_0x350ca0(0x11d)],'path':_0x5c5e2c,'def':_0x260827});}}}const _0x51411b=getFormInterfacesDir(_0xe729cd);if(a138_0x1c3d61['existsSync'](_0x51411b)){const _0x57e7c2=a138_0x1c3d61[_0x350ca0(0x14c)](_0x51411b)[_0x350ca0(0x17e)](_0x3a1a32=>_0x3a1a32[_0x350ca0(0x15b)](_0x350ca0(0x1a2)));for(const _0x4cb3b1 of _0x57e7c2){const _0x246472=a138_0x2da90b['join'](_0x51411b,_0x4cb3b1),_0x33644d=parseFormInterfaceYaml(a138_0x1c3d61[_0x350ca0(0x1bc)](_0x246472,_0x350ca0(0xcf)),_0x246472);_0x440c8a[_0x350ca0(0x1b9)]({'name':_0x33644d[_0x350ca0(0x11d)],'path':_0x246472,'yaml':_0x33644d});}}const _0x27ad62=getChatInterfacesDir(_0xe729cd);if(a138_0x1c3d61[_0x350ca0(0xfe)](_0x27ad62)){const _0x777f99=a138_0x1c3d61[_0x350ca0(0x14c)](_0x27ad62)['filter'](_0x441c80=>_0x441c80['endsWith'](_0x350ca0(0x1a2)));for(const _0x476792 of _0x777f99){const _0x1bcc75=a138_0x2da90b['join'](_0x27ad62,_0x476792),_0x5a6400=parseChatInterfaceYaml(a138_0x1c3d61[_0x350ca0(0x1bc)](_0x1bcc75,'utf-8'),_0x1bcc75);_0x443065['push']({'name':_0x5a6400[_0x350ca0(0x11d)],'path':_0x1bcc75,'yaml':_0x5a6400});}}}else{const _0x67ca79=await this[_0x350ca0(0xe8)](_0xe729cd),_0x322314=await this['client'][_0x350ca0(0xf7)](_0x67ca79);_0x39d5df=_0x322314[_0x350ca0(0x178)][_0x350ca0(0x11d)];const _0x53c0af=await this['client'][_0x350ca0(0x1af)](_0x67ca79),_0x59b16b=await this['client'][_0x350ca0(0xef)](_0x67ca79),_0x2c0b2b=await this[_0x350ca0(0x19c)][_0x350ca0(0xbc)](_0x67ca79),_0x52d655=await this['client'][_0x350ca0(0x181)](_0x67ca79),_0x425ce1=await this[_0x350ca0(0x19c)]['listIntegrations'](_0x67ca79),_0x36f31e=await safeListOrEmpty(()=>this[_0x350ca0(0x19c)][_0x350ca0(0x1d4)](_0x67ca79)),_0x5c833e=await safeListOrEmpty(()=>this[_0x350ca0(0x19c)]['listExperimentalArtifacts'](_0x67ca79)),_0x53639c=new Map(),_0x697815=new Map(),_0x4ffdf3=new Map(),_0x251b50=new Map(),_0x57762b=new Map(),_0x333a31=new Map();for(const _0x54dc04 of _0x59b16b){_0x53639c[_0x350ca0(0x14d)](_0x54dc04['id'],_0x54dc04[_0x350ca0(0x178)][_0x350ca0(0x11d)]);}for(const _0x3a2b7b of _0x2c0b2b){_0x697815[_0x350ca0(0x14d)](_0x3a2b7b['id'],_0x3a2b7b[_0x350ca0(0x178)][_0x350ca0(0x11d)]);}for(const _0x18ef37 of _0x53c0af){_0x4ffdf3[_0x350ca0(0x14d)](_0x18ef37['id'],_0x18ef37['attributes'][_0x350ca0(0x11d)]);}for(const _0x170391 of _0x52d655){_0x251b50[_0x350ca0(0x14d)](_0x170391['id'],_0x170391['attributes'][_0x350ca0(0x11d)]);}for(const _0x270b69 of _0x36f31e){_0x57762b['set'](_0x270b69['id'],_0x270b69[_0x350ca0(0x178)][_0x350ca0(0x11d)]);}for(const _0x3ffa16 of _0x5c833e){_0x333a31[_0x350ca0(0x14d)](_0x3ffa16['id'],_0x3ffa16['attributes'][_0x350ca0(0x11d)]);}const _0x3f8a0b={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x53639c,'TextKnowledgeBase':_0x697815,'Agent':_0x4ffdf3,'ExperimentalKnowledgeBase':_0x57762b}),'resolvePromptName':async _0x3d0ef7=>_0x251b50['get'](_0x3d0ef7),'onWarning':_0x3a2267=>this[_0x350ca0(0xb9)][_0x350ca0(0x1a5)](_0x3a2267)};for(const _0x258510 of _0x53c0af){const _0x15c148=await agentResponseToDef(_0x258510,_0x3f8a0b),{yaml:_0x4f65ef,systemPrompt:_0x3fcd94,starterMessage:_0x26c2be}=_0x15c148;_0x3bfad4[_0x350ca0(0x1b9)]({'name':_0x4f65ef[_0x350ca0(0x11d)],'dir':'','yaml':_0x4f65ef,'systemPrompt':_0x3fcd94,'starterMessage':_0x26c2be});}for(const _0x21ff1d of _0x59b16b){const _0x57378a=apiKnowledgeBaseToYaml(_0x21ff1d);_0x1a2d81[_0x350ca0(0x1b9)]({'name':_0x57378a[_0x350ca0(0x11d)],'path':'','yaml':_0x57378a});}for(const _0x35878d of _0x2c0b2b){_0xf8e281[_0x350ca0(0x1b9)]({'name':_0x35878d[_0x350ca0(0x178)][_0x350ca0(0x11d)],'path':'','text':_0x35878d[_0x350ca0(0x178)][_0x350ca0(0x103)]});}for(const _0x1215cd of _0x52d655){const _0x3e71e7=await apiPromptToYaml(_0x1215cd,_0x3f8a0b);_0x3e71e7&&_0x3bc5e6[_0x350ca0(0x1b9)]({'name':_0x3e71e7[_0x350ca0(0x11d)],'path':'','yaml':_0x3e71e7});}for(const _0x2ede02 of _0x425ce1){if(!_0x2ede02[_0x350ca0(0x178)][_0x350ca0(0x135)]&&SAFE_INTEGRATION_TYPES[_0x350ca0(0x158)](_0x2ede02['attributes'][_0x350ca0(0x1c9)]['toLowerCase']())){const _0xa4f8c1=await apiIntegrationToYaml(_0x2ede02,_0x3f8a0b);_0x3d1b75[_0x350ca0(0x1b9)]({'name':_0x2ede02['attributes'][_0x350ca0(0x1c9)]['toLowerCase'](),'path':'','yaml':_0xa4f8c1});}}for(const _0x226d49 of _0x36f31e){const _0x17acb5=apiExperimentalKnowledgeBaseToYaml(_0x226d49);_0x4c4a06[_0x350ca0(0x1b9)]({'name':_0x17acb5['name'],'path':'','def':_0x17acb5});}for(const _0x46da8c of _0x5c833e){const _0x39c4b4=apiExperimentalArtifactToYaml(_0x46da8c);_0x3b4dcd[_0x350ca0(0x1b9)]({'name':_0x39c4b4[_0x350ca0(0x11d)],'path':'','def':_0x39c4b4});}const _0x19c4f6=await safeListOrEmpty(()=>this[_0x350ca0(0x19c)][_0x350ca0(0x1b8)](_0x67ca79));for(const _0x1548e3 of _0x19c4f6){const _0x5d0f9b=await apiFormInterfaceToYaml(_0x1548e3,_0x3f8a0b);_0x440c8a[_0x350ca0(0x1b9)]({'name':_0x5d0f9b['name'],'path':'','yaml':_0x5d0f9b});}const _0x3652d9=await safeListOrEmpty(()=>this[_0x350ca0(0x19c)][_0x350ca0(0xfd)](_0x67ca79));for(const _0x41c239 of _0x3652d9){if(_0x41c239['attributes']['isManaged'])continue;const _0x176a32=await apiChatInterfaceToYaml(_0x41c239,_0x3f8a0b);_0x443065[_0x350ca0(0x1b9)]({'name':_0x176a32['name'],'path':'','yaml':_0x176a32});}}const _0x4466ac={'sourceProjectName':_0x39d5df,'newProjectName':_0x72666c,'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}}},_0x8ecc01=await this[_0x350ca0(0x19c)][_0x350ca0(0x129)](),_0x22ef80=_0x8ecc01[_0x350ca0(0x190)](_0x596f9b=>_0x596f9b[_0x350ca0(0x178)]['name']===_0x72666c);if(_0x22ef80)throw new SDKError(ErrorCode[_0x350ca0(0x1ba)],_0x350ca0(0x137)+_0x72666c+_0x350ca0(0x168),undefined,{'helpText':_0x350ca0(0x13d)});if(_0x53ab50?.[_0x350ca0(0x174)])return _0x4466ac[_0x350ca0(0x111)][_0x350ca0(0x15e)]['created']=_0x3bfad4[_0x350ca0(0xed)],_0x4466ac[_0x350ca0(0x111)]['knowledgeBases']['created']=_0x1a2d81['length'],_0x4466ac['counts']['textKnowledgeBases'][_0x350ca0(0x1c8)]=_0xf8e281['length'],_0x4466ac[_0x350ca0(0x111)][_0x350ca0(0x139)][_0x350ca0(0x1c8)]=_0x4c4a06['length'],_0x4466ac[_0x350ca0(0x111)][_0x350ca0(0xbe)][_0x350ca0(0x1c8)]=_0x3b4dcd['length'],_0x4466ac['counts'][_0x350ca0(0x1a9)][_0x350ca0(0x1c8)]=_0x3bc5e6[_0x350ca0(0xed)],_0x4466ac[_0x350ca0(0x111)][_0x350ca0(0x16d)][_0x350ca0(0x1c8)]=_0x3d1b75[_0x350ca0(0xed)],_0x4466ac;const _0x9a845c=await this[_0x350ca0(0x19c)][_0x350ca0(0x143)]({'name':_0x72666c}),_0x484344=_0x9a845c['id'];_0x4466ac['newProjectId']=_0x484344;const _0x582b77=new Map(),_0x392103=new Map(),_0x4186c2=new Map(),_0x38966e=new Map(),_0x2976fc=new Map(),_0x48ba45=new Map(),_0x2e5ea4=new Map(),_0x1aa6f1=new Map(),_0x12c60f=new Set(),_0x2d36a3=new Set();for(const _0x31e94b of _0x3bfad4){for(const _0x5a2911 of _0x31e94b[_0x350ca0(0x12f)][_0x350ca0(0xd0)]||[]){if(_0x5a2911['type']==='image_gen'&&_0x5a2911[_0x350ca0(0x153)]){const _0x42bcdd=parseRef(_0x5a2911[_0x350ca0(0x153)]);if(_0x42bcdd)_0x12c60f[_0x350ca0(0x1b7)](_0x42bcdd[_0x350ca0(0x11d)]);}else{if(_0x5a2911[_0x350ca0(0x11a)]===_0x350ca0(0x123)&&_0x5a2911[_0x350ca0(0x153)]){const _0x368502=parseRef(_0x5a2911[_0x350ca0(0x153)]);if(_0x368502)_0x2d36a3[_0x350ca0(0x1b7)](_0x368502[_0x350ca0(0x11d)]);}}}}for(const _0x35bb3f of _0x12c60f){try{const _0x1e085b=await this[_0x350ca0(0x19c)][_0x350ca0(0x1a4)]({'projectId':_0x484344,'name':_0x35bb3f});_0x2976fc[_0x350ca0(0x14d)](_0x35bb3f,_0x1e085b['id']),_0x4466ac[_0x350ca0(0xcb)][_0x350ca0(0x1b9)]({'name':_0x35bb3f,'action':_0x350ca0(0x1c8),'id':_0x1e085b['id']}),_0x4466ac[_0x350ca0(0x111)][_0x350ca0(0xcb)][_0x350ca0(0x1c8)]++;}catch(_0x4d7b7a){_0x4466ac[_0x350ca0(0xcb)][_0x350ca0(0x1b9)]({'name':_0x35bb3f,'action':_0x350ca0(0x120),'error':_0x4d7b7a[_0x350ca0(0x114)]}),_0x4466ac['counts']['imageGenerators'][_0x350ca0(0xbd)]++;}}for(const _0x3ea700 of _0x2d36a3){try{const _0x2a1ef0=await this[_0x350ca0(0x19c)][_0x350ca0(0x1b0)]({'projectId':_0x484344,'name':_0x3ea700});_0x48ba45[_0x350ca0(0x14d)](_0x3ea700,_0x2a1ef0['id']),_0x4466ac['webSearchTools'][_0x350ca0(0x1b9)]({'name':_0x3ea700,'action':'created','id':_0x2a1ef0['id']}),_0x4466ac['counts'][_0x350ca0(0x133)]['created']++;}catch(_0x15588e){_0x4466ac[_0x350ca0(0x133)][_0x350ca0(0x1b9)]({'name':_0x3ea700,'action':_0x350ca0(0x120),'error':_0x15588e[_0x350ca0(0x114)]}),_0x4466ac['counts'][_0x350ca0(0x133)][_0x350ca0(0xbd)]++;}}const _0x37a573=await fetchAllToolTargetMaps((_0x238738,_0x103188)=>this[_0x350ca0(0x19c)][_0x350ca0(0xca)](_0x238738,_0x103188),_0x484344);let _0x39f9d8=[];const _0x5a522d={'projectId':_0x484344,'resolveToolTargetId':buildIdResolver({..._0x37a573[_0x350ca0(0x1d5)],'KnowledgeBase':_0x582b77,'TextKnowledgeBase':_0x392103,'ExperimentalKnowledgeBase':_0x2e5ea4,'Agent':_0x4186c2,'WebSearchTool':_0x48ba45,'ImageGenerator':_0x2976fc}),'resolvePromptId':async _0x27c331=>_0x38966e['get'](_0x27c331),'onWarning':_0x331055=>{const _0x51b890=_0x350ca0;this[_0x51b890(0xb9)][_0x51b890(0x1a5)](_0x331055),_0x39f9d8[_0x51b890(0x1b9)](_0x331055);}};for(const _0x2a80fb of _0x1a2d81){try{const _0x272b58=yamlKnowledgeBaseToApi(_0x2a80fb['yaml'],_0x484344),_0x57381e=await this[_0x350ca0(0x19c)][_0x350ca0(0xe1)](_0x272b58);_0x582b77['set'](_0x2a80fb[_0x350ca0(0x12f)][_0x350ca0(0x11d)],_0x57381e['id']),_0x4466ac[_0x350ca0(0x121)]['push']({'name':_0x2a80fb[_0x350ca0(0x12f)][_0x350ca0(0x11d)],'action':_0x350ca0(0x1c8),'id':_0x57381e['id']}),_0x4466ac[_0x350ca0(0x111)][_0x350ca0(0x121)]['created']++;}catch(_0x39acf1){_0x4466ac[_0x350ca0(0x121)][_0x350ca0(0x1b9)]({'name':_0x2a80fb[_0x350ca0(0x12f)]['name'],'action':_0x350ca0(0x120),'error':_0x39acf1[_0x350ca0(0x114)]}),_0x4466ac['counts'][_0x350ca0(0x121)][_0x350ca0(0xbd)]++;}}for(const _0x289675 of _0xf8e281){try{const _0x4cb913=yamlTextKnowledgeBaseToApi({'name':_0x289675[_0x350ca0(0x11d)],'text':_0x289675[_0x350ca0(0x103)]},_0x484344),_0x1cd2b2=await this[_0x350ca0(0x19c)]['createTextKnowledgeBase'](_0x4cb913);_0x392103[_0x350ca0(0x14d)](_0x289675[_0x350ca0(0x11d)],_0x1cd2b2['id']),_0x4466ac['textKnowledgeBases'][_0x350ca0(0x1b9)]({'name':_0x289675[_0x350ca0(0x11d)],'action':_0x350ca0(0x1c8),'id':_0x1cd2b2['id']}),_0x4466ac[_0x350ca0(0x111)][_0x350ca0(0x191)][_0x350ca0(0x1c8)]++;}catch(_0x551a7b){_0x4466ac['textKnowledgeBases'][_0x350ca0(0x1b9)]({'name':_0x289675[_0x350ca0(0x11d)],'action':_0x350ca0(0x120),'error':_0x551a7b[_0x350ca0(0x114)]}),_0x4466ac[_0x350ca0(0x111)][_0x350ca0(0x191)][_0x350ca0(0xbd)]++;}}for(const _0x55f93b of _0x3b4dcd){try{const _0x36af81=yamlExperimentalArtifactToApi(_0x55f93b[_0x350ca0(0x10e)],_0x484344),_0x20e4dc=await this['client'][_0x350ca0(0x165)](_0x36af81);_0x1aa6f1[_0x350ca0(0x14d)](_0x55f93b['def'][_0x350ca0(0x11d)],_0x20e4dc['id']),_0x4466ac[_0x350ca0(0xbe)][_0x350ca0(0x1b9)]({'name':_0x55f93b['def']['name'],'action':'created','id':_0x20e4dc['id']}),_0x4466ac[_0x350ca0(0x111)]['experimentalArtifacts'][_0x350ca0(0x1c8)]++;}catch(_0x4929ac){_0x4466ac[_0x350ca0(0xbe)][_0x350ca0(0x1b9)]({'name':_0x55f93b[_0x350ca0(0x10e)]['name'],'action':_0x350ca0(0x120),'error':_0x4929ac[_0x350ca0(0x114)]}),_0x4466ac[_0x350ca0(0x111)]['experimentalArtifacts'][_0x350ca0(0xbd)]++;}}for(const _0x567a55 of _0x4c4a06){try{const _0x144b20=yamlExperimentalKnowledgeBaseToApi(_0x567a55['def'],_0x484344),_0x20bd93=await this['client'][_0x350ca0(0x104)](_0x144b20);_0x2e5ea4[_0x350ca0(0x14d)](_0x567a55[_0x350ca0(0x10e)][_0x350ca0(0x11d)],_0x20bd93['id']),_0x4466ac[_0x350ca0(0x139)][_0x350ca0(0x1b9)]({'name':_0x567a55[_0x350ca0(0x10e)][_0x350ca0(0x11d)],'action':_0x350ca0(0x1c8),'id':_0x20bd93['id']}),_0x4466ac[_0x350ca0(0x111)][_0x350ca0(0x139)][_0x350ca0(0x1c8)]++;}catch(_0x310cab){_0x4466ac[_0x350ca0(0x139)]['push']({'name':_0x567a55[_0x350ca0(0x10e)][_0x350ca0(0x11d)],'action':_0x350ca0(0x120),'error':_0x310cab[_0x350ca0(0x114)]}),_0x4466ac['counts']['experimentalKnowledgeBases']['errors']++;}}const _0x2a17ea=[..._0x3bfad4]['sort']((_0xb9e7ab,_0x3ab383)=>{const _0x5b17d5=_0x350ca0,_0x32def8=_0xb9e7ab[_0x5b17d5(0x12f)]['tools']?.[_0x5b17d5(0x1a7)](_0x427b31=>_0x427b31[_0x5b17d5(0x11a)]==='agent')??![],_0x30064b=_0x3ab383[_0x5b17d5(0x12f)][_0x5b17d5(0xd0)]?.[_0x5b17d5(0x1a7)](_0x4925d3=>_0x4925d3[_0x5b17d5(0x11a)]==='agent')??![];if(_0x32def8&&!_0x30064b)return 0x1;if(!_0x32def8&&_0x30064b)return-0x1;return 0x0;});for(const _0x6c8816 of _0x2a17ea){_0x39f9d8=[];try{const _0x504c63=_0x6c8816['yaml'][_0x350ca0(0xd0)]?.[_0x350ca0(0x17e)](_0x28dd69=>{const _0x51d6f5=_0x350ca0;if(_0x28dd69[_0x51d6f5(0x11a)]==='agent'&&_0x28dd69['target']){const _0x536535=parseRef(_0x28dd69[_0x51d6f5(0x153)]);return _0x536535?.['name']===_0x6c8816[_0x51d6f5(0x12f)][_0x51d6f5(0x11d)];}return![];})??[];if(_0x504c63[_0x350ca0(0xed)]>0x0){const _0x4d7db5=_0x350ca0(0xfa)+_0x6c8816[_0x350ca0(0x12f)]['name']+_0x350ca0(0x14a)+_0x350ca0(0x131);this[_0x350ca0(0xb9)][_0x350ca0(0x1a5)](_0x4d7db5),_0x39f9d8[_0x350ca0(0x1b9)](_0x4d7db5);}const _0x41dc12=await agentDefToRequest(_0x6c8816[_0x350ca0(0x12f)],_0x6c8816['systemPrompt'],_0x6c8816[_0x350ca0(0x118)],_0x5a522d),_0x475b11=await this[_0x350ca0(0x19c)]['createAgentResponse'](_0x41dc12);_0x4186c2['set'](_0x6c8816[_0x350ca0(0x12f)][_0x350ca0(0x11d)],_0x475b11['id']),_0x4466ac['agents'][_0x350ca0(0x1b9)]({'agentName':_0x6c8816[_0x350ca0(0x12f)][_0x350ca0(0x11d)],'action':'created','agentId':_0x475b11['id'],'warnings':_0x39f9d8[_0x350ca0(0xed)]>0x0?_0x39f9d8:undefined}),_0x4466ac[_0x350ca0(0x111)]['agents'][_0x350ca0(0x1c8)]++;}catch(_0x266d24){_0x4466ac['agents'][_0x350ca0(0x1b9)]({'agentName':_0x6c8816[_0x350ca0(0x12f)][_0x350ca0(0x11d)],'action':_0x350ca0(0x120),'error':_0x266d24[_0x350ca0(0x114)],'warnings':_0x39f9d8[_0x350ca0(0xed)]>0x0?_0x39f9d8:undefined}),_0x4466ac[_0x350ca0(0x111)][_0x350ca0(0x15e)][_0x350ca0(0xbd)]++;}}for(const _0x35ba1d of _0x3bc5e6){try{const _0x5af31d=await yamlPromptToApi(_0x35ba1d[_0x350ca0(0x12f)],_0x484344,_0x5a522d);if(!_0x5af31d){_0x4466ac['prompts'][_0x350ca0(0x1b9)]({'name':_0x35ba1d[_0x350ca0(0x12f)][_0x350ca0(0x11d)],'action':_0x350ca0(0x120),'error':_0x350ca0(0x150)}),_0x4466ac['counts']['prompts'][_0x350ca0(0xbd)]++;continue;}const _0x2ae999=await this['client'][_0x350ca0(0x1d8)](_0x5af31d);_0x38966e['set'](_0x35ba1d['yaml'][_0x350ca0(0x11d)],_0x2ae999['id']),_0x4466ac[_0x350ca0(0x1a9)]['push']({'name':_0x35ba1d[_0x350ca0(0x12f)][_0x350ca0(0x11d)],'action':_0x350ca0(0x1c8),'id':_0x2ae999['id']}),_0x4466ac[_0x350ca0(0x111)][_0x350ca0(0x1a9)][_0x350ca0(0x1c8)]++;}catch(_0x34e34f){_0x4466ac[_0x350ca0(0x1a9)][_0x350ca0(0x1b9)]({'name':_0x35ba1d[_0x350ca0(0x12f)][_0x350ca0(0x11d)],'action':_0x350ca0(0x120),'error':_0x34e34f[_0x350ca0(0x114)]}),_0x4466ac[_0x350ca0(0x111)][_0x350ca0(0x1a9)]['errors']++;}}for(const _0x4e2ae0 of _0x3d1b75){try{const _0x416bed=await yamlIntegrationToApi(_0x4e2ae0[_0x350ca0(0x12f)],_0x484344,_0x5a522d),_0x5784b5=await this[_0x350ca0(0x19c)][_0x350ca0(0xd7)](_0x416bed);_0x4466ac[_0x350ca0(0x16d)][_0x350ca0(0x1b9)]({'name':_0x4e2ae0[_0x350ca0(0x12f)]['service_type'],'action':_0x350ca0(0x1c8),'id':_0x5784b5['id']}),_0x4466ac['counts'][_0x350ca0(0x16d)][_0x350ca0(0x1c8)]++;}catch(_0x5cb89c){_0x4466ac[_0x350ca0(0x16d)][_0x350ca0(0x1b9)]({'name':_0x4e2ae0[_0x350ca0(0x12f)]['service_type'],'action':_0x350ca0(0x120),'error':_0x5cb89c['message']}),_0x4466ac['counts'][_0x350ca0(0x16d)][_0x350ca0(0xbd)]++;}}for(const _0xd16f21 of _0x440c8a){try{const _0x2ea719=await yamlFormInterfaceToApi(_0xd16f21[_0x350ca0(0x12f)],_0x484344,_0x5a522d);if(!_0x2ea719){_0x4466ac[_0x350ca0(0x146)][_0x350ca0(0x1b9)]({'name':_0xd16f21[_0x350ca0(0x12f)][_0x350ca0(0x11d)],'action':_0x350ca0(0x120),'error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x4466ac[_0x350ca0(0x111)][_0x350ca0(0x146)][_0x350ca0(0xbd)]++;continue;}const _0x3e20ca=await this[_0x350ca0(0x19c)]['createFormInterface'](_0x2ea719);_0x4466ac[_0x350ca0(0x146)]['push']({'name':_0xd16f21['yaml'][_0x350ca0(0x11d)],'action':_0x350ca0(0x1c8),'id':_0x3e20ca['id']}),_0x4466ac[_0x350ca0(0x111)]['formInterfaces'][_0x350ca0(0x1c8)]++;}catch(_0x20b348){_0x4466ac['formInterfaces'][_0x350ca0(0x1b9)]({'name':_0xd16f21['yaml'][_0x350ca0(0x11d)],'action':_0x350ca0(0x120),'error':_0x20b348[_0x350ca0(0x114)]}),_0x4466ac['counts'][_0x350ca0(0x146)][_0x350ca0(0xbd)]++;}}for(const _0x5a4eb5 of _0x443065){try{const _0x3abb1e=await yamlChatInterfaceToApi(_0x5a4eb5[_0x350ca0(0x12f)],_0x484344,_0x5a522d),_0x566209=await this[_0x350ca0(0x19c)][_0x350ca0(0x194)](_0x3abb1e);_0x4466ac[_0x350ca0(0x1ac)][_0x350ca0(0x1b9)]({'name':_0x5a4eb5['yaml'][_0x350ca0(0x11d)],'action':'created','id':_0x566209['id']}),_0x4466ac[_0x350ca0(0x111)][_0x350ca0(0x1ac)][_0x350ca0(0x1c8)]++;}catch(_0x594f98){_0x4466ac[_0x350ca0(0x1ac)][_0x350ca0(0x1b9)]({'name':_0x5a4eb5[_0x350ca0(0x12f)][_0x350ca0(0x11d)],'action':'error','error':_0x594f98['message']}),_0x4466ac[_0x350ca0(0x111)][_0x350ca0(0x1ac)][_0x350ca0(0xbd)]++;}}return _0x4466ac;}}function a138_0x5d46(){const _0x2a3c2b=['clearDefaultAgent',')\x20can\x20be\x20pushed.\x20','createKnowledgeBase','tdx_','total','pullProject','INTERNAL','getCurrentProject','path','resolveProjectId','experimental_artifacts','starter_message.md','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','form_interfaces','length','has','listKnowledgeBases','listExperimentalArtifacts','Renamed\x20integration\x20file:\x20','---\x20file:\x20','rmSync','Output\x20directory\x20already\x20exists:\x20','deleteIntegration','renamed','getProject','LLM_PROJECT_NOT_FOUND','template','Agent\x20\x27','getChatLog','TextKnowledgeBase','listChatInterfaces','existsSync','localeCompare','Project\x20not\x20found:\x20','functions','#\x20prompt.md\x0a','text','createExperimentalKnowledgeBase','prompt.md','webhookCorsOrigins','ExperimentalKnowledgeBase','metadata','Backup\x20folder\x20not\x20found:\x20','51390GscuEp','prompts.json','Renamed\x20experimental\x20KB\x20directory:\x20','file_name','def','Invalid\x20agent\x20reference\x20format:\x20','text_content','counts','Could\x20not\x20resolve\x20agent\x20reference','projectName','message','chatInfo','stringify','updateExperimentalArtifact','starterMessage','Renamed\x20KB\x20file:\x20','type','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','\x0a\x0a#\x20agent.yml\x0a','name','toLowerCase','dirname','error','knowledgeBases','medium','web_search','listAgents','json_schema','event','2752680kxAEEj','basename','listProjects','restoreProject','outputs','agent','backupProject','action','yaml','status','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','currentProjectId','webSearchTools','(dry-run)','isManaged','\x20→\x20','Project\x20\x22','\x0a---\x20function:\x20','experimentalKnowledgeBases','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','code.js','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','reasoningEffort','chat_agent_console','get','tdx.json','createProject','createAgent','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','formInterfaces','sdk.llm','INVALID_ARGUMENT','528633CGzbli','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','cwd','readdirSync','set','agentId','toISOString','Agent\x20reference\x20not\x20found','isDir','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','target','llm_project','listChats','content','projectId','includes','new','getBackupMetadata','endsWith','claude-4.5-sonnet','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','agents','updateFormInterface','chatIgnoreManagedActions','unlinkSync','updateTextKnowledgeBase','PERMISSION_DENIED','statSync','createExperimentalArtifact','\x0a---\x20code\x20---\x0a','getDefaultAgent','\x22\x20already\x20exists','size','chat_generic','jsonSchemaHint','agent.yml','integrations','1472WsuuNw','modelType','knowledge_bases','sort','getAgent','integrations.json','dryRun','Unresolved\x20dependencies:\x20','\x27\x20(','updateExperimentalKnowledgeBase','attributes','Renamed\x20agent\x20folder:\x20','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.','Multiple\x20agents\x20found\x20with\x20name\x20\x27','resolveProjectName','1.0','filter','updateAgentResponse','):\x20','listPrompts','systemPrompt','writeFileSync','pushAgent','.md','exportedFrom','agentsFull','agents.json','project.json','25254XNpcgN','low','.llm','starter_message','tdDatabaseName','getOrCreateDefaultProject','find','textKnowledgeBases','json_schema.json','chat_parent_segment','createChatInterface','36CSgVSF','AGENT_NOT_FOUND','No\x20tdx.json\x20found\x20in\x20','loadJsonFile','variables','681083TJyTPB','getOrCreateDefaultAgent','client','pushProject','getChatHistory','signal','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','none','.yml','agent.yml\x20not\x20found\x20in\x20','createImageGenerator','warn','updateAgent','some','startChat','prompts','minimal','already\x20exists','chatInterfaces','resolveAgentId','map','listAgentsFull','createWebSearchTool','listWebSearchTools','conflict','oldPath','isFile','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','createFormInterface','add','listFormInterfaces','push','ALREADY_EXISTS','info','readFileSync','pullAgent','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','\x20---\x0a','NOT_FOUND','Skipping\x20integration\x20\x27','chats','unchanged','version','updated','Unsupported\x20backup\x20version:\x20','Renamed\x20prompt\x20file:\x20','created','serviceType','\x20attempts\x20due\x20to\x20name\x20conflicts.','dry-run-','join','Multiple\x20projects\x20found\x20with\x20name\x20\x27','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','\x0a---\x20schema:\x20','chat_interfaces','getDefaultProjectName','chatWelcomeMessage','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','listExperimentalKnowledgeBases','nameToId','dir','Renamed\x20folder:\x20','createPrompt','slackMessageMode','files','temperature','UNAUTHENTICATED','Renamed\x20experimental\x20artifact\x20directory:\x20','KnowledgeBase','Renamed\x20form\x20interface\x20file:\x20','logger','_reasoning_','6192895FDOGkO','listTextKnowledgeBases','errors','experimentalArtifacts','projects','site','experimental_knowledge_bases','project','createAgentResponse','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','tables','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','profile','listIntegrations','history','listToolTargets','imageGenerators','getChatInfo','service_type','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','utf-8','tools','code','promptId','duplicate','Unable\x20to\x20create\x20project\x20after\x20','description','Renamed\x20text\x20KB\x20file:\x20','createIntegration','context','mkdirSync','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','getUserSettings','isDirectory','Only\x20safe\x20types\x20(','11745426JNPUle'];a138_0x5d46=function(){return _0x2a3c2b;};return a138_0x5d46();}