@treasuredata/tdx 2026.6.3 → 2026.6.5

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 (249) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/engage-template-pull-command.js +1 -1
  28. package/dist/commands/engage-template-push-command.js +1 -1
  29. package/dist/commands/engage-template-validate-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/journey-validate-command.js +1 -1
  33. package/dist/commands/llm-command.js +1 -1
  34. package/dist/commands/mcp-command.js +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/policy-command.js +1 -1
  37. package/dist/commands/profile-command.js +1 -1
  38. package/dist/commands/profiles-command.js +1 -1
  39. package/dist/commands/query-command.js +1 -1
  40. package/dist/commands/schedule-command.js +1 -1
  41. package/dist/commands/segment-command.js +1 -1
  42. package/dist/commands/segment-create-command.js +1 -1
  43. package/dist/commands/segment-fields-command.js +1 -1
  44. package/dist/commands/segment-move-command.d.ts +19 -0
  45. package/dist/commands/segment-move-command.d.ts.map +1 -0
  46. package/dist/commands/segment-move-command.js +1 -0
  47. package/dist/commands/segment-move-command.js.map +1 -0
  48. package/dist/commands/segment-pull-command.js +1 -1
  49. package/dist/commands/segment-push-command.js +1 -1
  50. package/dist/commands/segment-update-command.js +1 -1
  51. package/dist/commands/segment-use-command.js +1 -1
  52. package/dist/commands/segment-validate-command.js +1 -1
  53. package/dist/commands/segments.js +1 -1
  54. package/dist/commands/show.js +1 -1
  55. package/dist/commands/status-command.js +1 -1
  56. package/dist/commands/table-deleted.js +1 -1
  57. package/dist/commands/tables.js +1 -1
  58. package/dist/commands/unset-command.js +1 -1
  59. package/dist/commands/upgrade-command.js +1 -1
  60. package/dist/commands/use-command.js +1 -1
  61. package/dist/commands/user-command.js +1 -1
  62. package/dist/commands/work-command.js +1 -1
  63. package/dist/commands/workflow-command.js +1 -1
  64. package/dist/core/auth.js +1 -1
  65. package/dist/core/command-output.js +1 -1
  66. package/dist/core/config.d.ts +14 -0
  67. package/dist/core/config.d.ts.map +1 -1
  68. package/dist/core/config.js +1 -1
  69. package/dist/core/config.js.map +1 -1
  70. package/dist/core/connection-cache.js +1 -1
  71. package/dist/core/constants.js +1 -1
  72. package/dist/core/credential-cache.js +1 -1
  73. package/dist/core/global-context.js +1 -1
  74. package/dist/core/keychain.js +1 -1
  75. package/dist/core/oauth-keychain.js +1 -1
  76. package/dist/core/oauth.js +1 -1
  77. package/dist/core/profile.js +1 -1
  78. package/dist/core/project-config.d.ts +1 -0
  79. package/dist/core/project-config.d.ts.map +1 -1
  80. package/dist/core/project-config.js +1 -1
  81. package/dist/core/project-config.js.map +1 -1
  82. package/dist/core/session.js +1 -1
  83. package/dist/core/user-cache.js +1 -1
  84. package/dist/core/version.js +1 -1
  85. package/dist/index.js +1 -1
  86. package/dist/mcp/server.js +1 -1
  87. package/dist/mcp/tools/index.js +1 -1
  88. package/dist/mcp/tools/tdx-run.js +1 -1
  89. package/dist/mcp/tools/tdx-search.d.ts.map +1 -1
  90. package/dist/mcp/tools/tdx-search.js +1 -1
  91. package/dist/mcp/tools/tdx-search.js.map +1 -1
  92. package/dist/mcp/tools/work-create-item.js +1 -1
  93. package/dist/mcp/utils.js +1 -1
  94. package/dist/proxy/claude-usage-tracker.js +1 -1
  95. package/dist/proxy/passthrough-server.js +1 -1
  96. package/dist/proxy/sse-usage-parser.js +1 -1
  97. package/dist/sdk/agent/agent-config.js +1 -1
  98. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  99. package/dist/sdk/agent/agent-yaml.js +1 -1
  100. package/dist/sdk/agent/test/evaluator.js +1 -1
  101. package/dist/sdk/agent/test/executor.js +1 -1
  102. package/dist/sdk/agent/test/index.js +1 -1
  103. package/dist/sdk/agent/test/output.js +1 -1
  104. package/dist/sdk/agent/test/parser.js +1 -1
  105. package/dist/sdk/agent/tool-target-registry.js +1 -1
  106. package/dist/sdk/api.js +1 -1
  107. package/dist/sdk/cas/cas-api-client.js +1 -1
  108. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  109. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  110. package/dist/sdk/cas/index.js +1 -1
  111. package/dist/sdk/cas/pull-workflow.js +1 -1
  112. package/dist/sdk/cas/push-workflow.js +1 -1
  113. package/dist/sdk/client/cdp-api-client.d.ts +18 -0
  114. package/dist/sdk/client/cdp-api-client.d.ts.map +1 -1
  115. package/dist/sdk/client/cdp-api-client.js +1 -1
  116. package/dist/sdk/client/cdp-api-client.js.map +1 -1
  117. package/dist/sdk/client/delivery-api-client.js +1 -1
  118. package/dist/sdk/client/endpoints.js +1 -1
  119. package/dist/sdk/client/engage-api-client.js +1 -1
  120. package/dist/sdk/client/http-client.js +1 -1
  121. package/dist/sdk/client/llm-api-client.js +1 -1
  122. package/dist/sdk/client/oauth-refresh.js +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.d.ts +28 -1
  185. package/dist/sdk/segment.d.ts.map +1 -1
  186. package/dist/sdk/segment.js +1 -1
  187. package/dist/sdk/segment.js.map +1 -1
  188. package/dist/sdk/types/cdp.d.ts +15 -0
  189. package/dist/sdk/types/cdp.d.ts.map +1 -1
  190. package/dist/sdk/types/index.d.ts +1 -1
  191. package/dist/sdk/types/index.d.ts.map +1 -1
  192. package/dist/sdk/types/index.js +1 -1
  193. package/dist/sdk/types/index.js.map +1 -1
  194. package/dist/sdk/types/progress.js +1 -1
  195. package/dist/sdk/types/workspace.js +1 -1
  196. package/dist/sdk/user.js +1 -1
  197. package/dist/sdk/util/format-detector.js +1 -1
  198. package/dist/sdk/util/formatters.js +1 -1
  199. package/dist/sdk/util/index.js +1 -1
  200. package/dist/sdk/util/paginate.js +1 -1
  201. package/dist/sdk/util/tree-formatter.js +1 -1
  202. package/dist/sdk/workflow/archive-validation.js +1 -1
  203. package/dist/sdk/workflow/clone-workflow.js +1 -1
  204. package/dist/sdk/workflow/index.js +1 -1
  205. package/dist/sdk/workflow/pull-workflow.js +1 -1
  206. package/dist/sdk/workflow/push-workflow.js +1 -1
  207. package/dist/sdk/workflow/task-graph.js +1 -1
  208. package/dist/sdk/workflow/tdx-config.js +1 -1
  209. package/dist/sdk/workflow/workflow-utils.js +1 -1
  210. package/dist/sdk/workspace/access-tracker.js +1 -1
  211. package/dist/sdk/workspace/frontmatter.js +1 -1
  212. package/dist/sdk/workspace/git.js +1 -1
  213. package/dist/sdk/workspace/index.js +1 -1
  214. package/dist/sdk/workspace/templates.js +1 -1
  215. package/dist/sdk/workspace/weekly.js +1 -1
  216. package/dist/sdk/workspace/wikilinks.js +1 -1
  217. package/dist/test-utils/command-runner.js +1 -1
  218. package/dist/test-utils/factories.js +1 -1
  219. package/dist/test-utils/fixtures.js +1 -1
  220. package/dist/test-utils/http-mock.js +1 -1
  221. package/dist/test-utils/index.js +1 -1
  222. package/dist/utils/async.js +1 -1
  223. package/dist/utils/colors.js +1 -1
  224. package/dist/utils/diff.js +1 -1
  225. package/dist/utils/file-permissions.js +1 -1
  226. package/dist/utils/file-reader.js +1 -1
  227. package/dist/utils/github-releases.js +1 -1
  228. package/dist/utils/global-cache.js +1 -1
  229. package/dist/utils/json-loader.js +1 -1
  230. package/dist/utils/local-cache.js +1 -1
  231. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  232. package/dist/utils/logger/formatters/index.js +1 -1
  233. package/dist/utils/logger/handlers/console-handler.js +1 -1
  234. package/dist/utils/logger/handlers/file-handler.js +1 -1
  235. package/dist/utils/logger/handlers/index.js +1 -1
  236. package/dist/utils/logger/handlers/null-handler.js +1 -1
  237. package/dist/utils/logger/index.js +1 -1
  238. package/dist/utils/logger/logger.js +1 -1
  239. package/dist/utils/logger/types.js +1 -1
  240. package/dist/utils/option-validation.js +1 -1
  241. package/dist/utils/process.js +1 -1
  242. package/dist/utils/prompt.js +1 -1
  243. package/dist/utils/spinner.js +1 -1
  244. package/dist/utils/sse-parser.js +1 -1
  245. package/dist/utils/string-utils.js +1 -1
  246. package/dist/utils/table-ref-parser.js +1 -1
  247. package/dist/utils/tdx-logger.js +1 -1
  248. package/dist/utils/version-check.js +1 -1
  249. package/package.json +1 -1
@@ -1 +1 @@
1
- const a134_0x1280fc=a134_0x357b;(function(_0x63f38c,_0x406e75){const _0x6ec7af=a134_0x357b,_0x513051=_0x63f38c();while(!![]){try{const _0x46d4ca=-parseInt(_0x6ec7af(0x21c))/0x1+-parseInt(_0x6ec7af(0x294))/0x2+parseInt(_0x6ec7af(0x27f))/0x3+-parseInt(_0x6ec7af(0x274))/0x4*(parseInt(_0x6ec7af(0x278))/0x5)+parseInt(_0x6ec7af(0x20b))/0x6+parseInt(_0x6ec7af(0x23f))/0x7+parseInt(_0x6ec7af(0x26e))/0x8;if(_0x46d4ca===_0x406e75)break;else _0x513051['push'](_0x513051['shift']());}catch(_0x2b0c31){_0x513051['push'](_0x513051['shift']());}}}(a134_0x4cab,0xa1272));import{LLMApiClient}from'../client/llm-api-client.js';import*as a134_0x4f3caa from'node:fs';import*as a134_0xb4a0ec from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{toModelInfos}from'./user-settings.js';function a134_0x4cab(){const _0x44d521=['def','tdDatabaseName','idToName','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','1059546dmjcns','file_name','text_content','currentProjectId','chatIgnoreManagedActions','\x27.\x20This\x20should\x20not\x20happen.','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','has','agent.yml','toISOString','tools','total','integrations','loadJsonFile','pushAgent','info','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','low','readFileSync','Renamed\x20form\x20interface\x20file:\x20','writeFileSync','length','filter','listPrompts','project.json','duplicate','\x0a---\x20code\x20---\x0a','backupProject','listTextKnowledgeBases','setCurrentProject','updateExperimentalKnowledgeBase','attributes','formInterfaces','template','webhookCorsOrigins','json_schema','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','chat','path','listImageGenerators','deleteProject','Renamed\x20integration\x20file:\x20','getDefaultAgent','web_search','AGENT_NOT_FOUND','Renamed\x20agent\x20folder:\x20','\x20---\x0a','createFormInterface','keys','errors','newProjectId','utf-8','context','createIntegration','event','localeCompare','#\x20prompt.md\x0a','site','Agent\x20reference\x20not\x20found','message','createTextKnowledgeBase','maxToolIterations','listProjects','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','logger','listAgents','NOT_FOUND','agent','service_type','cloneProject','error','listChatInterfaces','agents','Renamed\x20KB\x20file:\x20','---\x20file:\x20','already\x20exists','get','chat_interfaces','dry-run-','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','isManaged','claude-4.5-sonnet','temperature','.yml','json_schema.json','deleteAgent','map','experimentalKnowledgeBases','Renamed\x20text\x20KB\x20file:\x20','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','parse','tdx_default_','starterMessage','createAgentResponse','getDefaultProjectName','Project\x20\x22','updateTextKnowledgeBase','):\x20','getChatInfo','target','Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.','updateFormInterface','name','listIntegrations','updateAgentResponse','listExperimentalKnowledgeBases','chat_parent_segment','updatePrompt','Only\x20safe\x20types\x20(','listAgentsFull','Agent\x20not\x20found:\x20','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','Removed\x20deleted\x20directory:\x20','knowledgeBases','endsWith','Renamed\x20chat\x20interface\x20file:\x20','getCurrentProject','.md','resolveProjectId','warn','starter_message',')\x20can\x20be\x20pushed.\x20','isDir','find','getProject','history','setDefaultAgent','size','integrations.json','new','counts','createProject','tdx.json','(dry-run)','slackMessageMode','split','systemPrompt','project','stringify','getAgent','files','getOrCreateDefaultProject','getOrCreateDefaultAgent','client','signal','isFile','\x0a\x0a#\x20agent.yml\x0a','INVALID_ARGUMENT','createExperimentalKnowledgeBase','Skipping\x20integration\x20\x27','experimentalArtifacts','1464300ZQLiye','includes','knowledge_bases','clearDefaultAgent','mkdirSync','.llm','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','code.js','experimental_artifacts','prompt.md','action','type','---\x20schema:\x20','rmSync','KnowledgeBase','Removed\x20deleted\x20file:\x20','createExperimentalArtifact','1010302QLNVhq','\x27\x20(','listWebSearchTools','medium','webSearchTools','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','Available\x20agents:\x20','form_interfaces','\x0a---\x20schema:\x20','image_gen','\x0a---\x20function:\x20','dir','description','profile','listFormInterfaces','Unable\x20to\x20create\x20project\x20after\x20','INTERNAL','Multiple\x20agents\x20found\x20with\x20name\x20\x27','chat_generic','starter_message.md','text','unlinkSync','updated','chats','renamed','Invalid\x20agent\x20reference\x20format:\x20','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','Renamed\x20prompt\x20file:\x20','createWebSearchTool','UNAUTHENTICATED','unchanged','toLowerCase','basename',')\x20can\x20be\x20cloned.','sort','7508333QHcWeA','_reasoning_','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','\x20in\x20project\x20','Unsupported\x20backup\x20version:\x20','Renamed\x20experimental\x20artifact\x20directory:\x20','imageGenerators','add','listKnowledgeBases','dryRun','readdirSync','createChatInterface','resolveAgentId','listToolTargets','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','projectName','functions','ALREADY_EXISTS','updateAgent','getBackupMetadata','Unresolved\x20dependencies:\x20','oldPath','agentId','createPrompt','projects','some','resolveProjectName','createAgent','Agent\x20\x27','tdx_','prompts','chat_agent_console','textKnowledgeBases','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','getChatHistory','Multiple\x20projects\x20found\x20with\x20name\x20\x27','startChat','createKnowledgeBase','Project\x20not\x20found:\x20','chatInterfaces','agents.json','statSync','createImageGenerator','updateKnowledgeBase','status','Could\x20not\x20resolve\x20agent\x20reference','agentsFull','8267528GQWDan','set','exportedFrom','join','high','existsSync','1203692UZXpWj','chatWelcomeMessage','Renamed\x20folder:\x20','push','15AYequa','Renamed\x20experimental\x20KB\x20directory:\x20','deleteIntegration','created','LLM_PROJECT_NOT_FOUND','content','isDirectory','2258448reErHG','llm_project','updateExperimentalArtifact','TextKnowledgeBase','experimental_knowledge_bases','dirname','promptId','chatId','variables','nameToId','sdk.llm','code','yaml','getChatLog','\x20→\x20','knowledgebases.json','serviceType'];a134_0x4cab=function(){return _0x44d521;};return a134_0x4cab();}import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';function a134_0x357b(_0x109b72,_0x1f7db6){_0x109b72=_0x109b72-0x177;const _0x4cab85=a134_0x4cab();let _0x357b4e=_0x4cab85[_0x109b72];return _0x357b4e;}import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a134_0x1280fc(0x22e),a134_0x1280fc(0x25e),a134_0x1280fc(0x1de)];async function safeListOrEmpty(_0xd223a1){const _0x340b6b=a134_0x1280fc;try{return await _0xd223a1();}catch(_0x92bddf){if(_0x92bddf instanceof HTTPClientError&&_0x92bddf[_0x340b6b(0x26b)]===0x194)return[];throw _0x92bddf;}}export class LLMSDK{[a134_0x1280fc(0x177)];[a134_0x1280fc(0x203)];[a134_0x1280fc(0x1a8)];[a134_0x1280fc(0x1b4)]=Logger['of'](a134_0x1280fc(0x289));constructor(_0x1c2211){const _0x121c8a=a134_0x1280fc;this[_0x121c8a(0x203)]=new LLMApiClient(_0x1c2211),this[_0x121c8a(0x1a8)]=_0x1c2211;}[a134_0x1280fc(0x1d2)](){const _0x377ad2=a134_0x1280fc,_0x4e3a50=getSanitizedUsername();return _0x377ad2(0x1cf)+_0x4e3a50;}async[a134_0x1280fc(0x191)](_0x5b9528){const _0xe1dafb=a134_0x1280fc,{projectId:_0x341be9}=await this[_0xe1dafb(0x259)](_0x5b9528);this[_0xe1dafb(0x177)]=_0x341be9;}[a134_0x1280fc(0x1e8)](){const _0x22dff4=a134_0x1280fc;return this[_0x22dff4(0x177)];}async[a134_0x1280fc(0x1f2)](_0x2585d1){const _0x29cf3a=a134_0x1280fc,_0x1f8f75=this[_0x29cf3a(0x1a8)][_0x29cf3a(0x229)];let _0x18cc46,_0x177271;if(_0x2585d1[_0x29cf3a(0x20c)]('/')){const _0x4fa31e=_0x2585d1[_0x29cf3a(0x1fb)]('/');if(_0x4fa31e['length']!==0x2)throw new SDKError(ErrorCode[_0x29cf3a(0x207)],_0x29cf3a(0x235)+_0x2585d1,undefined,{'helpText':_0x29cf3a(0x260)});const [_0x5234cc,_0x124f13]=_0x4fa31e;_0x18cc46=await this['resolveProjectId'](_0x5234cc),_0x177271=_0x124f13;}else _0x18cc46=this[_0x29cf3a(0x177)]||(await this[_0x29cf3a(0x201)]())['id'],_0x177271=_0x2585d1;const _0x1bfff9=await this[_0x29cf3a(0x24b)](_0x177271,_0x18cc46),_0xbaa63d=await this[_0x29cf3a(0x203)][_0x29cf3a(0x1ff)](_0x1bfff9);writeCachedLLMAgent(_0xbaa63d['attributes'][_0x29cf3a(0x1da)],_0x1bfff9,_0x18cc46,_0x1f8f75);}[a134_0x1280fc(0x19e)](){const _0x3fd463=a134_0x1280fc,_0x2c7dab=this[_0x3fd463(0x1a8)][_0x3fd463(0x229)];return readCachedLLMAgent(_0x2c7dab)||undefined;}[a134_0x1280fc(0x20e)](){const _0x2f588b=a134_0x1280fc,_0x76e640=this[_0x2f588b(0x1a8)]['profile'];clearCachedLLMAgent(_0x76e640);}async['models'](){const _0xa9529d=a134_0x1280fc,_0x11f351=await this[_0xa9529d(0x203)]['getUserSettings']();return toModelInfos(_0x11f351);}async[a134_0x1280fc(0x1f7)](_0x544ef7){const _0x32046a=a134_0x1280fc;return await this['client'][_0x32046a(0x1f7)](_0x544ef7);}async[a134_0x1280fc(0x19c)](_0x17c524){const _0x40d0e4=a134_0x1280fc,{projectId:_0x1bb6d1}=await this[_0x40d0e4(0x259)](_0x17c524);await this[_0x40d0e4(0x203)][_0x40d0e4(0x19c)](_0x1bb6d1);}async[a134_0x1280fc(0x257)](_0x2f4163=0x32){const _0x114099=a134_0x1280fc;return await this[_0x114099(0x203)][_0x114099(0x1b2)](_0x2f4163);}async[a134_0x1280fc(0x201)](_0xe0d31c){const _0x57a985=a134_0x1280fc,_0x3bfd42=_0xe0d31c||this[_0x57a985(0x1d2)](),_0x514561=this[_0x57a985(0x1a8)]['profile'];if(!_0xe0d31c){const _0x1415f5=readCachedLLMProject(_0x514561);if(_0x1415f5&&_0x1415f5['name']===_0x3bfd42)try{const _0x2d5914=await this['client'][_0x57a985(0x1f0)](_0x1415f5['id']);if(_0x2d5914['attributes'][_0x57a985(0x1da)]===_0x3bfd42)return _0x2d5914;}catch{}}const _0x443a59=await this['client']['listProjects'](),_0xfd4988=_0x443a59[_0x57a985(0x1ef)](_0x1945f3=>_0x1945f3[_0x57a985(0x193)][_0x57a985(0x1da)]===_0x3bfd42);if(_0xfd4988)return!_0xe0d31c&&writeCachedLLMProject(_0x3bfd42,_0xfd4988['id'],_0x514561),_0xfd4988;const _0x2c5057=await this[_0x57a985(0x203)][_0x57a985(0x1f7)]({'name':_0x3bfd42,'description':'Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20'+getSanitizedUsername()+')'});return!_0xe0d31c&&writeCachedLLMProject(_0x3bfd42,_0x2c5057['id'],_0x514561),_0x2c5057;}async['resolveProjectId'](_0x5971d4){const _0x3f98f6=a134_0x1280fc,_0x1b1112=await this[_0x3f98f6(0x203)][_0x3f98f6(0x1b2)](),_0x5a6279=_0x1b1112[_0x3f98f6(0x18a)](_0x5bf322=>_0x5bf322[_0x3f98f6(0x193)]['name']===_0x5971d4);if(_0x5a6279[_0x3f98f6(0x189)]===0x0)throw new SDKError(ErrorCode[_0x3f98f6(0x27c)],'Project\x20not\x20found:\x20'+_0x5971d4,undefined,{'helpText':_0x3f98f6(0x17a)});if(_0x5a6279[_0x3f98f6(0x189)]>0x1)throw new SDKError(ErrorCode[_0x3f98f6(0x22c)],_0x3f98f6(0x262)+_0x5971d4+_0x3f98f6(0x179));return _0x5a6279[0x0]['id'];}async['resolveProjectName'](_0x2e3f74){const _0x2cb3d5=a134_0x1280fc,_0x2a20f0=await this[_0x2cb3d5(0x203)][_0x2cb3d5(0x1b2)](),_0x4255f7=_0x2a20f0[_0x2cb3d5(0x1ef)](_0x61c3a4=>_0x61c3a4[_0x2cb3d5(0x193)][_0x2cb3d5(0x1da)]===_0x2e3f74);if(_0x4255f7)return{'projectId':_0x4255f7['id'],'project':_0x4255f7};throw new SDKError(ErrorCode[_0x2cb3d5(0x27c)],_0x2cb3d5(0x265)+_0x2e3f74,undefined,{'helpText':_0x2cb3d5(0x17a)});}async[a134_0x1280fc(0x202)](_0x5a29a9=a134_0x1280fc(0x1c5),_0x4b1f6c=0x0,_0x5a66a8){const _0x58873a=a134_0x1280fc,_0x531552=0xa;let _0x3ca027=0x0,_0xe9d189;while(_0x3ca027<_0x531552){try{const _0x4d75bf=await this[_0x58873a(0x201)](_0xe9d189),_0x58b344=_0x4d75bf['id'],_0x496833=['none','minimal',_0x58873a(0x185),_0x58873a(0x21f),_0x58873a(0x272)],_0x1258e2=_0x4b1f6c===0x0?'tdx_'+_0x5a29a9:_0x58873a(0x25c)+_0x5a29a9+_0x58873a(0x240)+_0x496833[_0x4b1f6c],_0x3febf3=await this[_0x58873a(0x203)][_0x58873a(0x1b5)](_0x58b344),_0x389a81=_0x3febf3[_0x58873a(0x1ef)](_0x38685e=>_0x38685e[_0x58873a(0x193)][_0x58873a(0x1da)]===_0x1258e2);if(_0x389a81)return _0x389a81;const _0x27b363=_0x4b1f6c>0x0?0x1:_0x5a66a8;return await this[_0x58873a(0x203)][_0x58873a(0x25a)]({'name':_0x1258e2,'projectId':_0x58b344,'modelType':_0x5a29a9,'systemPrompt':'','temperature':_0x27b363,'reasoningEffort':_0x4b1f6c>0x0?_0x4b1f6c:undefined});}catch(_0x312132){if(_0x312132 instanceof HTTPClientError){const _0x3f3659=_0x312132['status'];if(_0x3f3659>=0x190&&_0x3f3659<0x1f4){if(_0x3f3659===0x191)throw new SDKError(ErrorCode[_0x58873a(0x239)],_0x58873a(0x293),_0x312132);else{if(_0x3f3659===0x193)throw new SDKError(ErrorCode['PERMISSION_DENIED'],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x312132);}throw _0x312132;}}if(errorContains(_0x312132,_0x58873a(0x1bf),_0x58873a(0x18d),'conflict')){_0x3ca027++;if(_0x3ca027>=_0x531552)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x58873a(0x22b)+_0x531552+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x312132);const _0x3a1017=this['getDefaultProjectName']();_0xe9d189=_0x3a1017+'_'+generateRandomHex();continue;}throw _0x312132;}}throw new SDKError(ErrorCode[_0x58873a(0x22c)],_0x58873a(0x198));}async[a134_0x1280fc(0x24b)](_0x8457e,_0x574791){const _0x355e5f=a134_0x1280fc,_0x19c86b=_0x574791||this['currentProjectId'],_0x45fd8e=await this['client'][_0x355e5f(0x1b5)](_0x19c86b),_0x54f14e=_0x45fd8e[_0x355e5f(0x18a)](_0x322f54=>_0x322f54['attributes'][_0x355e5f(0x1da)]===_0x8457e);if(_0x54f14e[_0x355e5f(0x189)]===0x0){const _0x47072a=_0x19c86b?_0x355e5f(0x242)+_0x19c86b:'';throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x355e5f(0x1e2)+_0x8457e+_0x47072a,undefined,{'helpText':_0x19c86b?_0x355e5f(0x1e3):_0x355e5f(0x1d8)});}if(_0x54f14e[_0x355e5f(0x189)]>0x1)throw new SDKError(ErrorCode[_0x355e5f(0x22c)],_0x355e5f(0x22d)+_0x8457e+'\x27.\x20This\x20should\x20not\x20happen.');return _0x54f14e[0x0]['id'];}async[a134_0x1280fc(0x1bc)](_0x7cac48){const _0x5d6957=a134_0x1280fc,_0x5ba806=_0x7cac48||this[_0x5d6957(0x177)];return await this[_0x5d6957(0x203)][_0x5d6957(0x1b5)](_0x5ba806);}async[a134_0x1280fc(0x26d)](_0x388d9c){const _0x24c189=a134_0x1280fc;return await this[_0x24c189(0x203)][_0x24c189(0x1e1)](_0x388d9c);}async[a134_0x1280fc(0x1b7)](_0x39ac7c){const _0x50831f=a134_0x1280fc;return await this[_0x50831f(0x203)][_0x50831f(0x1ff)](_0x39ac7c);}async[a134_0x1280fc(0x25a)](_0x503a65){const _0x2688ee=a134_0x1280fc;return await this['client'][_0x2688ee(0x25a)](_0x503a65);}async[a134_0x1280fc(0x251)](_0x32fff1,_0x4513c5){const _0x480e9a=a134_0x1280fc;return await this[_0x480e9a(0x203)][_0x480e9a(0x251)](_0x32fff1,_0x4513c5);}async[a134_0x1280fc(0x1c9)](_0xcc19d2){const _0x2a7d20=a134_0x1280fc;await this[_0x2a7d20(0x203)][_0x2a7d20(0x1c9)](_0xcc19d2);}async[a134_0x1280fc(0x263)](_0x39fafd){const _0x5db47b=a134_0x1280fc;return await this['client'][_0x5db47b(0x263)]({'agentId':_0x39fafd});}async*[a134_0x1280fc(0x199)](_0x4201cb,_0x115932){const _0x317bef=a134_0x1280fc;let _0x5b5927=_0x115932?.[_0x317bef(0x286)];const _0xd6bca6=_0x115932?.['agentId'];if(!_0x5b5927){if(!_0xd6bca6)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x36c9ee=await this[_0x317bef(0x203)][_0x317bef(0x263)]({'agentId':_0xd6bca6});_0x5b5927=_0x36c9ee['id'],yield{'type':'metadata','data':{'chatId':_0x5b5927,'agentId':_0xd6bca6,'projectId':_0x36c9ee[_0x317bef(0x193)]['projectId']}};}for await(const _0x13b782 of this['client']['continueChat'](_0x5b5927,_0x4201cb,_0x115932?.[_0x317bef(0x204)])){yield{'type':_0x317bef(0x1aa),'data':_0x13b782};}}async[a134_0x1280fc(0x233)](_0x1cab66=0x32){const _0x180bba=a134_0x1280fc;return await this[_0x180bba(0x203)]['listChats'](_0x1cab66);}async[a134_0x1280fc(0x1f1)](_0x23282c){const _0x34aacb=a134_0x1280fc;return await this['client'][_0x34aacb(0x261)](_0x23282c);}async['getChatLog'](_0x325b22){const _0x684de5=a134_0x1280fc;return await this[_0x684de5(0x203)][_0x684de5(0x28c)](_0x325b22);}async['chatInfo'](_0x1cc3f8){const _0x5223a8=a134_0x1280fc;return await this[_0x5223a8(0x203)][_0x5223a8(0x1d6)](_0x1cc3f8);}async[a134_0x1280fc(0x18f)](_0x6c5116,_0x3e4af5,_0x1c71d0){const _0x8cc1ad=a134_0x1280fc,_0x4516dc=_0x1c71d0?.[_0x8cc1ad(0x248)]??![],{projectId:_0x5d501b,project:_0xcaebd3}=await this[_0x8cc1ad(0x259)](_0x6c5116),_0x58ab9b=_0xcaebd3['attributes'][_0x8cc1ad(0x1da)],_0xd1ea7e=_0x3e4af5||_0x58ab9b+_0x8cc1ad(0x210);if(a134_0x4f3caa[_0x8cc1ad(0x273)](_0xd1ea7e)&&!_0x4516dc)throw new SDKError(ErrorCode[_0x8cc1ad(0x250)],'Output\x20directory\x20already\x20exists:\x20'+_0xd1ea7e,undefined,{'helpText':_0x8cc1ad(0x1c3)});const _0x52df8f=await this[_0x8cc1ad(0x203)][_0x8cc1ad(0x1e1)](_0x5d501b),_0x5b5124=await this[_0x8cc1ad(0x203)]['listKnowledgeBases'](_0x5d501b),_0x3eb08c=await this['client'][_0x8cc1ad(0x18b)](_0x5d501b),_0x4dbc26=await this[_0x8cc1ad(0x203)]['listIntegrations'](_0x5d501b);if(!_0x4516dc){a134_0x4f3caa['mkdirSync'](_0xd1ea7e,{'recursive':!![]});const _0xa671e1={'version':'1.0','exportedAt':new Date()[_0x8cc1ad(0x17d)](),'exportedFrom':{'site':this['context'][_0x8cc1ad(0x1ad)],'projectId':_0x5d501b,'projectName':_0x58ab9b},'project':_0xcaebd3};a134_0x4f3caa[_0x8cc1ad(0x188)](a134_0xb4a0ec['join'](_0xd1ea7e,_0x8cc1ad(0x18c)),JSON[_0x8cc1ad(0x1fe)](_0xa671e1,null,0x2)),a134_0x4f3caa[_0x8cc1ad(0x188)](a134_0xb4a0ec[_0x8cc1ad(0x271)](_0xd1ea7e,_0x8cc1ad(0x267)),JSON[_0x8cc1ad(0x1fe)](_0x52df8f,null,0x2)),a134_0x4f3caa[_0x8cc1ad(0x188)](a134_0xb4a0ec[_0x8cc1ad(0x271)](_0xd1ea7e,_0x8cc1ad(0x28e)),JSON[_0x8cc1ad(0x1fe)](_0x5b5124,null,0x2)),a134_0x4f3caa[_0x8cc1ad(0x188)](a134_0xb4a0ec['join'](_0xd1ea7e,'prompts.json'),JSON[_0x8cc1ad(0x1fe)](_0x3eb08c,null,0x2)),a134_0x4f3caa['writeFileSync'](a134_0xb4a0ec[_0x8cc1ad(0x271)](_0xd1ea7e,_0x8cc1ad(0x1f4)),JSON[_0x8cc1ad(0x1fe)](_0x4dbc26,null,0x2));}return{'projectName':_0x58ab9b,'outputDir':_0xd1ea7e,'counts':{'agents':_0x52df8f['length'],'knowledgeBases':_0x5b5124[_0x8cc1ad(0x189)],'prompts':_0x3eb08c['length'],'integrations':_0x4dbc26['length']}};}async['restoreProject'](_0x44e4f8,_0x31834e){const _0x4146ae=a134_0x1280fc,_0x16fa56=_0x31834e?.[_0x4146ae(0x248)]??![],_0x47189f=this['getBackupMetadata'](_0x44e4f8),_0x211d8d=_0x47189f[_0x4146ae(0x270)][_0x4146ae(0x1ad)],_0x11b4b1=this['context'][_0x4146ae(0x1ad)],_0x3e7ea7=_0x211d8d!==_0x11b4b1?_0x211d8d:undefined,_0x29892a=this['loadJsonFile'](a134_0xb4a0ec['join'](_0x44e4f8,_0x4146ae(0x267)),[]),_0x20c693=this['loadJsonFile'](a134_0xb4a0ec[_0x4146ae(0x271)](_0x44e4f8,_0x4146ae(0x28e)),[]),_0x26301c=this[_0x4146ae(0x181)](a134_0xb4a0ec[_0x4146ae(0x271)](_0x44e4f8,'prompts.json'),[]),_0x5b3292=this[_0x4146ae(0x181)](a134_0xb4a0ec[_0x4146ae(0x271)](_0x44e4f8,_0x4146ae(0x1f4)),[]),_0x301bea=_0x31834e?.[_0x4146ae(0x1da)]||_0x47189f[_0x4146ae(0x270)][_0x4146ae(0x24e)];if(_0x16fa56){const _0x1910ca=new Map(),_0x355432=[..._0x29892a],_0x357ae3=_0x29892a[_0x4146ae(0x189)]+0x1;let _0xf389f5=0x0;while(_0x355432[_0x4146ae(0x189)]>0x0&&_0xf389f5<_0x357ae3){_0xf389f5++;const _0xbf866a=[];for(const _0x13d7fa of _0x355432){canCreateAgent(_0x13d7fa,_0x1910ca)?_0x1910ca[_0x4146ae(0x26f)](_0x13d7fa['id'],_0x4146ae(0x1c2)+_0x13d7fa['id']):_0xbf866a[_0x4146ae(0x277)](_0x13d7fa);}if(_0xbf866a['length']===_0x355432['length'])throw new SDKError(ErrorCode[_0x4146ae(0x22c)],_0x4146ae(0x241),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x355432[_0x4146ae(0x189)]=0x0,_0x355432[_0x4146ae(0x277)](..._0xbf866a);}const _0x3b2c47=_0x26301c[_0x4146ae(0x18a)](_0x203edc=>_0x1910ca['has'](_0x203edc[_0x4146ae(0x193)][_0x4146ae(0x255)]))[_0x4146ae(0x189)];return{'projectName':_0x301bea,'projectId':_0x4146ae(0x1f9),'counts':{'agents':_0x29892a['length'],'knowledgeBases':_0x20c693['length'],'prompts':_0x3b2c47,'integrations':_0x5b3292[_0x4146ae(0x189)]},'sourceSite':_0x3e7ea7};}const _0x1dc163=await this[_0x4146ae(0x203)][_0x4146ae(0x1f7)]({'name':_0x301bea,'description':_0x47189f[_0x4146ae(0x1fd)][_0x4146ae(0x193)][_0x4146ae(0x228)]}),_0x15aa2e=_0x1dc163['id'],_0x5f2bf4=new Map(),_0x3eea21=new Map(),_0x4f5b55=new Map();for(const _0x1c9cb8 of _0x20c693){const _0x59a1c0=await this[_0x4146ae(0x203)]['createKnowledgeBase']({'projectId':_0x15aa2e,'name':_0x1c9cb8[_0x4146ae(0x193)][_0x4146ae(0x1da)],'tdDatabaseName':_0x1c9cb8[_0x4146ae(0x193)][_0x4146ae(0x291)],'tables':_0x1c9cb8[_0x4146ae(0x193)]['tables']});_0x5f2bf4['set'](_0x1c9cb8['id'],_0x59a1c0['id']);}const _0x2b3625=[..._0x29892a],_0x24173d=_0x29892a[_0x4146ae(0x189)]+0x1;let _0x14fd77=0x0;while(_0x2b3625[_0x4146ae(0x189)]>0x0&&_0x14fd77<_0x24173d){_0x14fd77++;const _0x5c3f84=[];for(const _0x530e31 of _0x2b3625){if(canCreateAgent(_0x530e31,_0x3eea21)){const _0x35d53a=remapToolIds(_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x17e)],_0x5f2bf4,_0x3eea21),_0x430c13=remapVariableIds(_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x287)],_0x5f2bf4),_0x4102fd=await this[_0x4146ae(0x203)][_0x4146ae(0x1d1)]({'name':_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x1da)],'projectId':_0x15aa2e,'systemPrompt':_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x1fc)],'starterMessage':_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x1d0)],'modelType':migrateModelType(_0x530e31[_0x4146ae(0x193)]['modelType']),'maxToolIterations':_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x1b1)],'temperature':_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x1c6)],'reasoningEffort':_0x530e31[_0x4146ae(0x193)]['reasoningEffort'],'outputs':_0x530e31[_0x4146ae(0x193)]['outputs'],'tools':_0x35d53a,'variables':_0x430c13});_0x3eea21['set'](_0x530e31['id'],_0x4102fd['id']);}else _0x5c3f84[_0x4146ae(0x277)](_0x530e31);}if(_0x5c3f84['length']===_0x2b3625[_0x4146ae(0x189)])throw new SDKError(ErrorCode[_0x4146ae(0x22c)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x4146ae(0x1cd)});_0x2b3625['length']=0x0,_0x2b3625['push'](..._0x5c3f84);}for(const _0x4a911c of _0x26301c){const _0x1de4e7=_0x3eea21[_0x4146ae(0x1c0)](_0x4a911c[_0x4146ae(0x193)][_0x4146ae(0x255)]);if(!_0x1de4e7)continue;const _0x4f34c9=await this[_0x4146ae(0x203)][_0x4146ae(0x256)]({'projectId':_0x15aa2e,'agentId':_0x1de4e7,'name':_0x4a911c['attributes'][_0x4146ae(0x1da)],'systemPrompt':_0x4a911c['attributes'][_0x4146ae(0x1fc)],'template':_0x4a911c['attributes'][_0x4146ae(0x195)],'jsonSchemaHint':_0x4a911c[_0x4146ae(0x193)]['jsonSchemaHint']});_0x4f5b55['set'](_0x4a911c['id'],_0x4f34c9['id']);}for(const _0x214ee1 of _0x5b3292){const _0x37ef99=_0x214ee1[_0x4146ae(0x193)]['actions']['map'](_0x333d35=>({..._0x333d35,'promptId':_0x4f5b55['get'](_0x333d35['promptId'])||_0x333d35[_0x4146ae(0x285)]}));await this[_0x4146ae(0x203)]['createIntegration']({'projectId':_0x15aa2e,'serviceType':_0x214ee1[_0x4146ae(0x193)][_0x4146ae(0x28f)],'actions':_0x37ef99,'slackMessageMode':_0x214ee1[_0x4146ae(0x193)][_0x4146ae(0x1fa)],'chatIgnoreManagedActions':_0x214ee1[_0x4146ae(0x193)][_0x4146ae(0x178)],'chatWelcomeMessage':_0x214ee1[_0x4146ae(0x193)][_0x4146ae(0x275)],'webhookCorsOrigins':_0x214ee1[_0x4146ae(0x193)][_0x4146ae(0x196)]});}return{'projectName':_0x301bea,'projectId':_0x15aa2e,'counts':{'agents':_0x3eea21[_0x4146ae(0x1f3)],'knowledgeBases':_0x5f2bf4[_0x4146ae(0x1f3)],'prompts':_0x4f5b55['size'],'integrations':_0x5b3292['length']},'sourceSite':_0x3e7ea7};}[a134_0x1280fc(0x181)](_0x225a88,_0x3cb6ed){const _0x1ff26e=a134_0x1280fc;if(!a134_0x4f3caa[_0x1ff26e(0x273)](_0x225a88))return _0x3cb6ed;return JSON[_0x1ff26e(0x1ce)](a134_0x4f3caa['readFileSync'](_0x225a88,_0x1ff26e(0x1a7)));}[a134_0x1280fc(0x252)](_0x255b33){const _0x297597=a134_0x1280fc;if(!a134_0x4f3caa['existsSync'](_0x255b33))throw new SDKError(ErrorCode[_0x297597(0x1b6)],'Backup\x20folder\x20not\x20found:\x20'+_0x255b33,undefined,{'helpText':'Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.'});const _0x3c1d8d=a134_0xb4a0ec[_0x297597(0x271)](_0x255b33,_0x297597(0x18c));if(!a134_0x4f3caa[_0x297597(0x273)](_0x3c1d8d))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x297597(0x236)+_0x255b33,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x5c91c4=JSON[_0x297597(0x1ce)](a134_0x4f3caa['readFileSync'](_0x3c1d8d,_0x297597(0x1a7)));if(!isSupportedBackupVersion(_0x5c91c4['version']))throw new SDKError(ErrorCode[_0x297597(0x207)],_0x297597(0x243)+_0x5c91c4['version'],undefined,{'helpText':_0x297597(0x24d)});return _0x5c91c4;}async['pullProject'](_0x3c1847,_0x487078,_0x34d44e){const _0xf29d78=a134_0x1280fc,{projectId:_0x352944,project:_0x347a6b}=await this[_0xf29d78(0x259)](_0x3c1847),_0x14b4cd=_0x347a6b[_0xf29d78(0x193)][_0xf29d78(0x1da)];let _0xdfd7dd;if(_0x487078)_0xdfd7dd=_0x487078;else{const _0x1a2ab0=a134_0xb4a0ec[_0xf29d78(0x271)](process['cwd'](),_0xf29d78(0x1bc)),_0x3c5d46=getSanitizedPathWithMigration(_0x1a2ab0,_0x14b4cd);_0x3c5d46[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x276)+a134_0xb4a0ec['basename'](_0x3c5d46['oldPath'])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x3c5d46[_0xf29d78(0x19a)])),_0xdfd7dd=_0x3c5d46[_0xf29d78(0x19a)];}const _0x3c27bc=await this[_0xf29d78(0x203)][_0xf29d78(0x1e1)](_0x352944),_0x126dfc=await this['client'][_0xf29d78(0x247)](_0x352944),_0x3d9472=await this['client'][_0xf29d78(0x190)](_0x352944),_0x5ccf34=await safeListOrEmpty(()=>this['client'][_0xf29d78(0x19b)](_0x352944)),_0x1c8100=await safeListOrEmpty(()=>this[_0xf29d78(0x203)][_0xf29d78(0x21e)](_0x352944)),_0x43e05c=await this['client'][_0xf29d78(0x18b)](_0x352944),_0x51b02b=await this['client']['listIntegrations'](_0x352944),_0x1c730b=await safeListOrEmpty(()=>this['client'][_0xf29d78(0x1dd)](_0x352944)),_0x993f1c=await safeListOrEmpty(()=>this[_0xf29d78(0x203)]['listExperimentalArtifacts'](_0x352944)),_0x265ea1=await safeListOrEmpty(()=>this[_0xf29d78(0x203)]['listFormInterfaces'](_0x352944)),_0x5de67f=await safeListOrEmpty(()=>this[_0xf29d78(0x203)][_0xf29d78(0x1bb)](_0x352944)),_0x1de2e9=_0x51b02b[_0xf29d78(0x18a)](_0x576dc7=>!_0x576dc7[_0xf29d78(0x193)][_0xf29d78(0x1c4)]&&SAFE_INTEGRATION_TYPES[_0xf29d78(0x20c)](_0x576dc7[_0xf29d78(0x193)]['serviceType'][_0xf29d78(0x23b)]())),_0x1dd883=new Map(),_0x2c524e=new Map(),_0x3e92b8=new Map(),_0x316799=new Map(),_0x3f9d81=new Map(),_0x58d4fb=new Map(),_0x77f6d0=new Map();for(const _0x4a9c6f of _0x3c27bc){_0x1dd883['set'](_0x4a9c6f['id'],_0x4a9c6f['attributes'][_0xf29d78(0x1da)]);}for(const _0x4330cd of _0x126dfc){_0x2c524e[_0xf29d78(0x26f)](_0x4330cd['id'],_0x4330cd[_0xf29d78(0x193)][_0xf29d78(0x1da)]);}for(const _0x1941f9 of _0x3d9472){_0x3e92b8[_0xf29d78(0x26f)](_0x1941f9['id'],_0x1941f9[_0xf29d78(0x193)][_0xf29d78(0x1da)]);}for(const _0x3dab6c of _0x5ccf34){_0x316799[_0xf29d78(0x26f)](_0x3dab6c['id'],_0x3dab6c[_0xf29d78(0x193)]['name']);}for(const _0xe36575 of _0x1c8100){_0x3f9d81[_0xf29d78(0x26f)](_0xe36575['id'],_0xe36575[_0xf29d78(0x193)][_0xf29d78(0x1da)]);}for(const _0x2f336b of _0x43e05c){_0x58d4fb[_0xf29d78(0x26f)](_0x2f336b['id'],_0x2f336b['attributes'][_0xf29d78(0x1da)]);}for(const _0x5d6452 of _0x1c730b){_0x77f6d0['set'](_0x5d6452['id'],_0x5d6452[_0xf29d78(0x193)][_0xf29d78(0x1da)]);}const _0x241aab={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x2c524e,'TextKnowledgeBase':_0x3e92b8,'Agent':_0x1dd883,'WebSearchTool':_0x3f9d81,'ImageGenerator':_0x316799,'ExperimentalKnowledgeBase':_0x77f6d0}),'resolvePromptName':async _0x42488e=>_0x58d4fb['get'](_0x42488e),'onWarning':_0xd1161b=>this['logger'][_0xf29d78(0x1eb)](_0xd1161b)},_0x2ca305={'projectName':_0x14b4cd,'outputDir':_0xdfd7dd,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'knowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'textKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'prompts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'integrations':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalArtifacts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'formInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'chatInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0x2d2735=[],_0x4fa164=[];for(const _0x103eab of _0x3c27bc){const _0x1284c9=getSanitizedPathWithMigration(_0xdfd7dd,_0x103eab[_0xf29d78(0x193)][_0xf29d78(0x1da)]);_0x1284c9[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x1a1)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x1284c9['oldPath'])+'\x20→\x20'+a134_0xb4a0ec['basename'](_0x1284c9[_0xf29d78(0x19a)]));const _0x4b39aa=_0x1284c9[_0xf29d78(0x19a)],_0x5808e5=a134_0xb4a0ec['join'](_0x4b39aa,'prompt.md'),_0x5d2561=a134_0xb4a0ec[_0xf29d78(0x271)](_0x4b39aa,_0xf29d78(0x17c)),_0x12acb1=a134_0xb4a0ec['join'](_0x4b39aa,_0xf29d78(0x22f)),{yaml:_0x4ef23c,systemPrompt:_0x1d967e,starterMessage:_0x4854cb}=await agentResponseToDef(_0x103eab,_0x241aab),_0x1c6cf6=toAgentYamlString(_0x4ef23c),_0x245fea=!a134_0x4f3caa[_0xf29d78(0x273)](_0x5d2561);let _0x336f3c=_0x245fea,_0x11fadd;if(!_0x245fea){const _0x22fc26=a134_0x4f3caa[_0xf29d78(0x273)](_0x5808e5)?a134_0x4f3caa[_0xf29d78(0x186)](_0x5808e5,_0xf29d78(0x1a7)):'',_0x184fee=a134_0x4f3caa[_0xf29d78(0x186)](_0x5d2561,_0xf29d78(0x1a7)),_0x1c129c=_0xf29d78(0x1ac)+_0x22fc26+_0xf29d78(0x206)+_0x184fee,_0x122b7b='#\x20prompt.md\x0a'+_0x1d967e+_0xf29d78(0x206)+_0x1c6cf6,_0x33849b=generateDiff(_0x1c129c,_0x122b7b);_0x336f3c=hasChanges(_0x33849b),_0x336f3c&&(_0x11fadd=formatDiffWithColors(_0x33849b));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x4b39aa,'content':'','isDir':!![]}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x5808e5,'content':_0x1d967e}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x5d2561,'content':_0x1c6cf6});_0x4854cb&&_0x4854cb['includes']('\x0a')&&_0x2d2735[_0xf29d78(0x277)]({'path':_0x12acb1,'content':_0x4854cb});_0x2ca305[_0xf29d78(0x1bc)][_0xf29d78(0x277)]({'agentName':_0x103eab[_0xf29d78(0x193)][_0xf29d78(0x1da)],'outputPath':_0x4b39aa,'isNew':_0x245fea,'hasChanges':_0x336f3c,'diff':_0x11fadd}),_0x2ca305[_0xf29d78(0x1f6)]['agents'][_0xf29d78(0x17f)]++;if(_0x245fea)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1bc)]['new']++;else{if(_0x336f3c)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1bc)][_0xf29d78(0x232)]++;else _0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1bc)][_0xf29d78(0x23a)]++;}}for(const _0x2d7671 of _0x126dfc){if(_0x2d7671[_0xf29d78(0x193)][_0xf29d78(0x1c4)])continue;const _0x432268=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0xdfd7dd),_0x2d7671[_0xf29d78(0x193)][_0xf29d78(0x1da)],'.yml');_0x432268['renamed']&&this[_0xf29d78(0x1b4)]['info'](_0xf29d78(0x1bd)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x432268[_0xf29d78(0x254)])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x432268[_0xf29d78(0x19a)]));const _0x5a7efa=_0x432268['path'],_0x140838=apiKnowledgeBaseToYaml(_0x2d7671),_0x43bb72=toKnowledgeBaseYamlString(_0x140838),_0x2cdcc2=!a134_0x4f3caa[_0xf29d78(0x273)](_0x5a7efa);let _0x20ee22=_0x2cdcc2,_0x4bc67e;if(!_0x2cdcc2){const _0x40de0c=a134_0x4f3caa[_0xf29d78(0x186)](_0x5a7efa,_0xf29d78(0x1a7)),_0x3bebfb=generateDiff(_0x40de0c,_0x43bb72);_0x20ee22=hasChanges(_0x3bebfb),_0x20ee22&&(_0x4bc67e=formatDiffWithColors(_0x3bebfb));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x5a7efa,'content':_0x43bb72}),_0x2ca305[_0xf29d78(0x1e5)]['push']({'name':_0x2d7671[_0xf29d78(0x193)]['name'],'outputPath':_0x5a7efa,'isNew':_0x2cdcc2,'hasChanges':_0x20ee22,'diff':_0x4bc67e}),_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1e5)][_0xf29d78(0x17f)]++;if(_0x2cdcc2)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1e5)][_0xf29d78(0x1f5)]++;else{if(_0x20ee22)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1e5)][_0xf29d78(0x232)]++;else _0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1e5)]['unchanged']++;}}for(const _0x51b885 of _0x3d9472){if(_0x51b885[_0xf29d78(0x193)][_0xf29d78(0x1c4)])continue;const _0x5d8a7e=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0xdfd7dd),_0x51b885[_0xf29d78(0x193)][_0xf29d78(0x1da)],_0xf29d78(0x1e9));_0x5d8a7e[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x1cc)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x5d8a7e[_0xf29d78(0x254)])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x5d8a7e[_0xf29d78(0x19a)]));const _0x199ab2=_0x5d8a7e[_0xf29d78(0x19a)],_0x1d4664=toTextKnowledgeBaseMd(_0x51b885['attributes'][_0xf29d78(0x1da)],_0x51b885[_0xf29d78(0x193)][_0xf29d78(0x230)]),_0x5b353b=!a134_0x4f3caa['existsSync'](_0x199ab2);let _0x4c3744=_0x5b353b,_0x3de15a;if(!_0x5b353b){const _0x974709=a134_0x4f3caa[_0xf29d78(0x186)](_0x199ab2,_0xf29d78(0x1a7)),_0x1a0b04=generateDiff(_0x974709,_0x1d4664);_0x4c3744=hasChanges(_0x1a0b04),_0x4c3744&&(_0x3de15a=formatDiffWithColors(_0x1a0b04));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x199ab2,'content':_0x1d4664}),_0x2ca305[_0xf29d78(0x25f)]['push']({'name':_0x51b885['attributes'][_0xf29d78(0x1da)],'outputPath':_0x199ab2,'isNew':_0x5b353b,'hasChanges':_0x4c3744,'diff':_0x3de15a}),_0x2ca305[_0xf29d78(0x1f6)]['textKnowledgeBases']['total']++;if(_0x5b353b)_0x2ca305[_0xf29d78(0x1f6)]['textKnowledgeBases'][_0xf29d78(0x1f5)]++;else{if(_0x4c3744)_0x2ca305['counts'][_0xf29d78(0x25f)][_0xf29d78(0x232)]++;else _0x2ca305[_0xf29d78(0x1f6)]['textKnowledgeBases'][_0xf29d78(0x23a)]++;}}for(const _0x54ee17 of _0x43e05c){if(_0x54ee17[_0xf29d78(0x193)]['isManaged'])continue;const _0x5cff93=getSanitizedPathWithMigration(getPromptsDir(_0xdfd7dd),_0x54ee17['attributes']['name'],_0xf29d78(0x1c7));_0x5cff93['renamed']&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x237)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x5cff93['oldPath'])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x5cff93[_0xf29d78(0x19a)]));const _0x569639=_0x5cff93[_0xf29d78(0x19a)],_0x29760c=await apiPromptToYaml(_0x54ee17,_0x241aab);if(!_0x29760c)continue;const _0x5ca7a2=toPromptYamlString(_0x29760c),_0x3a014c=!a134_0x4f3caa[_0xf29d78(0x273)](_0x569639);let _0x2f8478=_0x3a014c,_0x153636;if(!_0x3a014c){const _0x31096c=a134_0x4f3caa[_0xf29d78(0x186)](_0x569639,_0xf29d78(0x1a7)),_0x179d54=generateDiff(_0x31096c,_0x5ca7a2);_0x2f8478=hasChanges(_0x179d54),_0x2f8478&&(_0x153636=formatDiffWithColors(_0x179d54));}_0x2d2735['push']({'path':_0x569639,'content':_0x5ca7a2}),_0x2ca305[_0xf29d78(0x25d)][_0xf29d78(0x277)]({'name':_0x54ee17[_0xf29d78(0x193)][_0xf29d78(0x1da)],'outputPath':_0x569639,'isNew':_0x3a014c,'hasChanges':_0x2f8478,'diff':_0x153636}),_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x25d)][_0xf29d78(0x17f)]++;if(_0x3a014c)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x25d)]['new']++;else{if(_0x2f8478)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x25d)][_0xf29d78(0x232)]++;else _0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x25d)][_0xf29d78(0x23a)]++;}}for(const _0x4d6dcd of _0x1de2e9){const _0x259ca4=_0x4d6dcd[_0xf29d78(0x193)]['serviceType'][_0xf29d78(0x23b)](),_0x2492c5=getSanitizedPathWithMigration(getIntegrationsDir(_0xdfd7dd),_0x259ca4,'.yml');_0x2492c5[_0xf29d78(0x234)]&&this['logger'][_0xf29d78(0x183)](_0xf29d78(0x19d)+a134_0xb4a0ec['basename'](_0x2492c5[_0xf29d78(0x254)])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x2492c5[_0xf29d78(0x19a)]));const _0x2aba39=_0x2492c5[_0xf29d78(0x19a)],_0x2a36fe=await apiIntegrationToYaml(_0x4d6dcd,_0x241aab),_0x5de757=toIntegrationYamlString(_0x2a36fe),_0x52fce5=!a134_0x4f3caa[_0xf29d78(0x273)](_0x2aba39);let _0x5d85a5=_0x52fce5,_0x1e6f10;if(!_0x52fce5){const _0x4abacb=a134_0x4f3caa['readFileSync'](_0x2aba39,'utf-8'),_0x101093=generateDiff(_0x4abacb,_0x5de757);_0x5d85a5=hasChanges(_0x101093),_0x5d85a5&&(_0x1e6f10=formatDiffWithColors(_0x101093));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x2aba39,'content':_0x5de757}),_0x2ca305[_0xf29d78(0x180)]['push']({'name':_0x259ca4,'outputPath':_0x2aba39,'isNew':_0x52fce5,'hasChanges':_0x5d85a5,'diff':_0x1e6f10}),_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x180)]['total']++;if(_0x52fce5)_0x2ca305[_0xf29d78(0x1f6)]['integrations']['new']++;else{if(_0x5d85a5)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x180)]['updated']++;else _0x2ca305['counts'][_0xf29d78(0x180)]['unchanged']++;}}for(const _0x2cf992 of _0x1c730b){if(_0x2cf992[_0xf29d78(0x193)][_0xf29d78(0x1c4)])continue;const _0x402e4e=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0xdfd7dd),_0x2cf992['attributes'][_0xf29d78(0x1da)]);_0x402e4e[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x279)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x402e4e['oldPath'])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x402e4e[_0xf29d78(0x19a)]));const _0x42adba=_0x402e4e['path'],_0x33248e=a134_0xb4a0ec[_0xf29d78(0x271)](_0x42adba,sanitizeForFilesystem(_0x2cf992[_0xf29d78(0x193)][_0xf29d78(0x1da)])+_0xf29d78(0x1c7)),_0x566ed4=a134_0xb4a0ec[_0xf29d78(0x271)](_0x42adba,_0xf29d78(0x24f)),_0x230a99=apiExperimentalKnowledgeBaseToYaml(_0x2cf992),_0x2fbb73=toExperimentalKnowledgeBaseYamlString(_0x230a99),_0x4b2d43=!a134_0x4f3caa[_0xf29d78(0x273)](_0x42adba);let _0x3a7007=_0x4b2d43,_0x390a74,_0x163d51=_0x2fbb73;const _0x4cb1a6=[..._0x230a99['functions']][_0xf29d78(0x23e)]((_0x20c907,_0x20da0e)=>_0x20c907[_0xf29d78(0x1da)][_0xf29d78(0x1ab)](_0x20da0e[_0xf29d78(0x1da)]));for(const _0x38a296 of _0x4cb1a6){_0x163d51+='\x0a---\x20function:\x20'+_0x38a296['name']+_0xf29d78(0x1a2)+_0x38a296[_0xf29d78(0x28a)]+_0xf29d78(0x224)+_0x38a296[_0xf29d78(0x1da)]+'\x20---\x0a'+_0x38a296[_0xf29d78(0x197)]+'\x0a';}if(!_0x4b2d43){let _0x382981='';a134_0x4f3caa[_0xf29d78(0x273)](_0x33248e)&&(_0x382981=a134_0x4f3caa[_0xf29d78(0x186)](_0x33248e,_0xf29d78(0x1a7)));if(a134_0x4f3caa['existsSync'](_0x566ed4)){const _0x478fca=a134_0x4f3caa['readdirSync'](_0x566ed4,{'withFileTypes':!![]}),_0x420565=_0x478fca[_0xf29d78(0x18a)](_0x362e2e=>_0x362e2e[_0xf29d78(0x27e)]())[_0xf29d78(0x23e)]((_0x35aeeb,_0x353f3d)=>_0x35aeeb[_0xf29d78(0x1da)][_0xf29d78(0x1ab)](_0x353f3d[_0xf29d78(0x1da)]));for(const _0x196fb6 of _0x420565){const _0x464e26=a134_0xb4a0ec[_0xf29d78(0x271)](_0x566ed4,_0x196fb6[_0xf29d78(0x1da)],'code.js'),_0x114826=a134_0xb4a0ec['join'](_0x566ed4,_0x196fb6[_0xf29d78(0x1da)],_0xf29d78(0x1c8));a134_0x4f3caa[_0xf29d78(0x273)](_0x464e26)&&(_0x382981+=_0xf29d78(0x226)+_0x196fb6[_0xf29d78(0x1da)]+'\x20---\x0a'+a134_0x4f3caa[_0xf29d78(0x186)](_0x464e26,_0xf29d78(0x1a7))+'\x0a'),a134_0x4f3caa[_0xf29d78(0x273)](_0x114826)&&(_0x382981+=_0xf29d78(0x217)+_0x196fb6[_0xf29d78(0x1da)]+_0xf29d78(0x1a2)+a134_0x4f3caa['readFileSync'](_0x114826,_0xf29d78(0x1a7))+'\x0a');}}const _0x3eae3d=generateDiff(_0x382981,_0x163d51);_0x3a7007=hasChanges(_0x3eae3d),_0x3a7007&&(_0x390a74=formatDiffWithColors(_0x3eae3d));}_0x2d2735['push']({'path':_0x42adba,'content':'','isDir':!![]}),_0x2d2735['push']({'path':_0x33248e,'content':_0x2fbb73}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x566ed4,'content':'','isDir':!![]});for(const _0x2325c6 of _0x230a99[_0xf29d78(0x24f)]){const _0x4202c3=a134_0xb4a0ec[_0xf29d78(0x271)](_0x566ed4,sanitizeForFilesystem(_0x2325c6[_0xf29d78(0x1da)])),_0x6e604b=a134_0xb4a0ec[_0xf29d78(0x271)](_0x4202c3,_0xf29d78(0x212)),_0x11779c=a134_0xb4a0ec['join'](_0x4202c3,_0xf29d78(0x1c8));_0x2d2735[_0xf29d78(0x277)]({'path':_0x4202c3,'content':'','isDir':!![]}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x6e604b,'content':_0x2325c6[_0xf29d78(0x28a)]}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x11779c,'content':_0x2325c6['json_schema']});}if(a134_0x4f3caa['existsSync'](_0x566ed4)){const _0xad1dec=a134_0x4f3caa[_0xf29d78(0x249)](_0x566ed4,{'withFileTypes':!![]}),_0x2f388e=new Set(_0x230a99[_0xf29d78(0x24f)][_0xf29d78(0x1ca)](_0x5867fb=>sanitizeForFilesystem(_0x5867fb[_0xf29d78(0x1da)])));for(const _0x40f7b6 of _0xad1dec){if(_0x40f7b6[_0xf29d78(0x27e)]()&&!_0x2f388e['has'](_0x40f7b6[_0xf29d78(0x1da)])){const _0x1562e3=a134_0xb4a0ec[_0xf29d78(0x271)](_0x566ed4,_0x40f7b6[_0xf29d78(0x1da)]);_0x4fa164[_0xf29d78(0x277)]({'path':_0x1562e3,'isDir':!![]});}}}_0x2ca305[_0xf29d78(0x1cb)][_0xf29d78(0x277)]({'name':_0x2cf992[_0xf29d78(0x193)]['name'],'outputPath':_0x42adba,'isNew':_0x4b2d43,'hasChanges':_0x3a7007,'diff':_0x390a74}),_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1cb)][_0xf29d78(0x17f)]++;if(_0x4b2d43)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1cb)][_0xf29d78(0x1f5)]++;else{if(_0x3a7007)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1cb)][_0xf29d78(0x232)]++;else _0x2ca305['counts'][_0xf29d78(0x1cb)][_0xf29d78(0x23a)]++;}}for(const _0x5b2201 of _0x993f1c){if(_0x5b2201[_0xf29d78(0x193)][_0xf29d78(0x1c4)])continue;const _0x2bfaab=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0xdfd7dd),_0x5b2201['attributes'][_0xf29d78(0x1da)]);_0x2bfaab[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x244)+a134_0xb4a0ec['basename'](_0x2bfaab[_0xf29d78(0x254)])+'\x20→\x20'+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x2bfaab[_0xf29d78(0x19a)]));const _0x1cad31=_0x2bfaab[_0xf29d78(0x19a)],_0x55c133=a134_0xb4a0ec[_0xf29d78(0x271)](_0x1cad31,sanitizeForFilesystem(_0x5b2201[_0xf29d78(0x193)][_0xf29d78(0x1da)])+_0xf29d78(0x1c7)),_0x3c834b=a134_0xb4a0ec[_0xf29d78(0x271)](_0x1cad31,_0xf29d78(0x212)),_0x2d5e54=a134_0xb4a0ec['join'](_0x1cad31,_0xf29d78(0x200)),_0x3867ec=apiExperimentalArtifactToYaml(_0x5b2201),_0x1e9f5d=toExperimentalArtifactYamlString(_0x3867ec),_0x33d6a2=!a134_0x4f3caa[_0xf29d78(0x273)](_0x1cad31);let _0x4bc959=_0x33d6a2,_0x301806,_0x37dbd7=_0x1e9f5d+(_0xf29d78(0x18e)+_0x3867ec[_0xf29d78(0x28a)]+'\x0a');const _0x538a27=[..._0x3867ec[_0xf29d78(0x200)]]['sort']((_0xa2e0e4,_0x495715)=>_0xa2e0e4[_0xf29d78(0x295)]['localeCompare'](_0x495715['file_name']));for(const _0x587708 of _0x538a27){_0x37dbd7+=_0xf29d78(0x1be)+_0x587708[_0xf29d78(0x295)]+_0xf29d78(0x1a2)+_0x587708[_0xf29d78(0x296)]+'\x0a';}if(!_0x33d6a2){let _0x1fe6fe='';a134_0x4f3caa['existsSync'](_0x55c133)&&(_0x1fe6fe=a134_0x4f3caa[_0xf29d78(0x186)](_0x55c133,_0xf29d78(0x1a7)));a134_0x4f3caa[_0xf29d78(0x273)](_0x3c834b)&&(_0x1fe6fe+=_0xf29d78(0x18e)+a134_0x4f3caa['readFileSync'](_0x3c834b,'utf-8')+'\x0a');if(a134_0x4f3caa[_0xf29d78(0x273)](_0x2d5e54)){const _0x300fe1=a134_0x4f3caa['readdirSync'](_0x2d5e54),_0x1358d1=_0x300fe1[_0xf29d78(0x18a)](_0x6730f3=>{const _0x21d8c0=_0xf29d78,_0x20f754=a134_0xb4a0ec[_0x21d8c0(0x271)](_0x2d5e54,_0x6730f3);return a134_0x4f3caa[_0x21d8c0(0x268)](_0x20f754)[_0x21d8c0(0x205)]();})['sort']((_0x4ea3f9,_0x485089)=>_0x4ea3f9[_0xf29d78(0x1ab)](_0x485089));for(const _0x5f3357 of _0x1358d1){const _0x888580=a134_0xb4a0ec['join'](_0x2d5e54,_0x5f3357);_0x1fe6fe+=_0xf29d78(0x1be)+_0x5f3357+_0xf29d78(0x1a2)+a134_0x4f3caa[_0xf29d78(0x186)](_0x888580,_0xf29d78(0x1a7))+'\x0a';}}const _0x412aa7=generateDiff(_0x1fe6fe,_0x37dbd7);_0x4bc959=hasChanges(_0x412aa7),_0x4bc959&&(_0x301806=formatDiffWithColors(_0x412aa7));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x1cad31,'content':'','isDir':!![]}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x55c133,'content':_0x1e9f5d}),_0x2d2735['push']({'path':_0x3c834b,'content':_0x3867ec[_0xf29d78(0x28a)]});if(_0x3867ec[_0xf29d78(0x200)][_0xf29d78(0x189)]>0x0){_0x2d2735[_0xf29d78(0x277)]({'path':_0x2d5e54,'content':'','isDir':!![]});for(const _0x48a1c7 of _0x3867ec[_0xf29d78(0x200)]){const _0x4c3410=a134_0xb4a0ec[_0xf29d78(0x271)](_0x2d5e54,_0x48a1c7['file_name']);_0x2d2735[_0xf29d78(0x277)]({'path':_0x4c3410,'content':_0x48a1c7[_0xf29d78(0x296)]});}}if(a134_0x4f3caa[_0xf29d78(0x273)](_0x2d5e54)){const _0x390861=a134_0x4f3caa[_0xf29d78(0x249)](_0x2d5e54),_0x1551c0=new Set(_0x3867ec[_0xf29d78(0x200)][_0xf29d78(0x1ca)](_0x1800aa=>_0x1800aa['file_name']));for(const _0x205ae3 of _0x390861){const _0x20147c=a134_0xb4a0ec[_0xf29d78(0x271)](_0x2d5e54,_0x205ae3);a134_0x4f3caa[_0xf29d78(0x268)](_0x20147c)[_0xf29d78(0x205)]()&&!_0x1551c0[_0xf29d78(0x17b)](_0x205ae3)&&_0x4fa164['push']({'path':_0x20147c});}}_0x2ca305['experimentalArtifacts']['push']({'name':_0x5b2201[_0xf29d78(0x193)]['name'],'outputPath':_0x1cad31,'isNew':_0x33d6a2,'hasChanges':_0x4bc959,'diff':_0x301806}),_0x2ca305['counts'][_0xf29d78(0x20a)]['total']++;if(_0x33d6a2)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x20a)][_0xf29d78(0x1f5)]++;else{if(_0x4bc959)_0x2ca305[_0xf29d78(0x1f6)]['experimentalArtifacts'][_0xf29d78(0x232)]++;else _0x2ca305['counts']['experimentalArtifacts']['unchanged']++;}}for(const _0x33334 of _0x265ea1){const _0x48ea4d=getSanitizedPathWithMigration(getFormInterfacesDir(_0xdfd7dd),_0x33334[_0xf29d78(0x193)][_0xf29d78(0x1da)],_0xf29d78(0x1c7));_0x48ea4d[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x187)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x48ea4d[_0xf29d78(0x254)])+'\x20→\x20'+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x48ea4d[_0xf29d78(0x19a)]));const _0x29c772=_0x48ea4d['path'],_0x38a3ee=await apiFormInterfaceToYaml(_0x33334,_0x241aab),_0x13ca79=toFormInterfaceYamlString(_0x38a3ee),_0x2b2706=!a134_0x4f3caa[_0xf29d78(0x273)](_0x29c772);let _0x595c80=_0x2b2706,_0x1f147b;if(!_0x2b2706){const _0x4461e8=a134_0x4f3caa[_0xf29d78(0x186)](_0x29c772,_0xf29d78(0x1a7)),_0x1e8377=generateDiff(_0x4461e8,_0x13ca79);_0x595c80=hasChanges(_0x1e8377),_0x595c80&&(_0x1f147b=formatDiffWithColors(_0x1e8377));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x29c772,'content':_0x13ca79}),_0x2ca305['formInterfaces'][_0xf29d78(0x277)]({'name':_0x33334[_0xf29d78(0x193)][_0xf29d78(0x1da)],'outputPath':_0x29c772,'isNew':_0x2b2706,'hasChanges':_0x595c80,'diff':_0x1f147b}),_0x2ca305[_0xf29d78(0x1f6)]['formInterfaces'][_0xf29d78(0x17f)]++;if(_0x2b2706)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x194)]['new']++;else{if(_0x595c80)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x194)][_0xf29d78(0x232)]++;else _0x2ca305['counts'][_0xf29d78(0x194)]['unchanged']++;}}for(const _0x3a1b37 of _0x5de67f){if(_0x3a1b37[_0xf29d78(0x193)][_0xf29d78(0x1c4)])continue;const _0x2fb407=getSanitizedPathWithMigration(getChatInterfacesDir(_0xdfd7dd),_0x3a1b37['attributes']['name'],_0xf29d78(0x1c7));_0x2fb407[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x1e7)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x2fb407[_0xf29d78(0x254)])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x2fb407[_0xf29d78(0x19a)]));const _0x166b5a=_0x2fb407[_0xf29d78(0x19a)],_0x2cdf15=await apiChatInterfaceToYaml(_0x3a1b37,_0x241aab),_0xbc08f=toChatInterfaceYamlString(_0x2cdf15),_0x36d2db=!a134_0x4f3caa[_0xf29d78(0x273)](_0x166b5a);let _0x5837ad=_0x36d2db,_0x550b52;if(!_0x36d2db){const _0x23c990=a134_0x4f3caa['readFileSync'](_0x166b5a,_0xf29d78(0x1a7)),_0x5ca427=generateDiff(_0x23c990,_0xbc08f);_0x5837ad=hasChanges(_0x5ca427),_0x5837ad&&(_0x550b52=formatDiffWithColors(_0x5ca427));}_0x2d2735['push']({'path':_0x166b5a,'content':_0xbc08f}),_0x2ca305[_0xf29d78(0x266)][_0xf29d78(0x277)]({'name':_0x3a1b37[_0xf29d78(0x193)][_0xf29d78(0x1da)],'outputPath':_0x166b5a,'isNew':_0x36d2db,'hasChanges':_0x5837ad,'diff':_0x550b52}),_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x266)][_0xf29d78(0x17f)]++;if(_0x36d2db)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x266)][_0xf29d78(0x1f5)]++;else{if(_0x5837ad)_0x2ca305['counts']['chatInterfaces'][_0xf29d78(0x232)]++;else _0x2ca305[_0xf29d78(0x1f6)]['chatInterfaces'][_0xf29d78(0x23a)]++;}}if(_0x34d44e?.[_0xf29d78(0x248)])return _0x2ca305;a134_0x4f3caa[_0xf29d78(0x20f)](_0xdfd7dd,{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x20f)](getKnowledgeBasesDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa['mkdirSync'](getPromptsDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x20f)](getIntegrationsDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x20f)](getExperimentalKnowledgeBasesDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa['mkdirSync'](getExperimentalArtifactsDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x20f)](getFormInterfacesDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x20f)](getChatInterfacesDir(_0xdfd7dd),{'recursive':!![]});const _0x52d1a7=a134_0xb4a0ec['join'](_0xdfd7dd,_0xf29d78(0x1f8));a134_0x4f3caa['writeFileSync'](_0x52d1a7,createAgentConfigContent(_0x14b4cd));for(const _0x16848e of _0x2d2735){if(_0x16848e[_0xf29d78(0x1ee)])a134_0x4f3caa[_0xf29d78(0x20f)](_0x16848e[_0xf29d78(0x19a)],{'recursive':!![]});else{const _0xce03cd=a134_0xb4a0ec['dirname'](_0x16848e['path']);!a134_0x4f3caa['existsSync'](_0xce03cd)&&a134_0x4f3caa[_0xf29d78(0x20f)](_0xce03cd,{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x188)](_0x16848e[_0xf29d78(0x19a)],_0x16848e[_0xf29d78(0x27d)]);}}for(const _0xdc8710 of _0x4fa164){_0xdc8710['isDir']?(a134_0x4f3caa[_0xf29d78(0x218)](_0xdc8710[_0xf29d78(0x19a)],{'recursive':!![],'force':!![]}),this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x1e4)+a134_0xb4a0ec[_0xf29d78(0x23c)](a134_0xb4a0ec['dirname'](_0xdc8710['path']))+'/'+a134_0xb4a0ec[_0xf29d78(0x23c)](_0xdc8710[_0xf29d78(0x19a)]))):(a134_0x4f3caa[_0xf29d78(0x218)](_0xdc8710[_0xf29d78(0x19a)],{'force':!![]}),this[_0xf29d78(0x1b4)]['info'](_0xf29d78(0x21a)+a134_0xb4a0ec[_0xf29d78(0x23c)](a134_0xb4a0ec[_0xf29d78(0x284)](_0xdc8710[_0xf29d78(0x19a)]))+'/'+a134_0xb4a0ec[_0xf29d78(0x23c)](_0xdc8710[_0xf29d78(0x19a)])));}return _0x2ca305;}async['pushProject'](_0x49eda2,_0xa08415){const _0x23ebf3=a134_0x1280fc,_0x404ebb=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x49eda2,_0x23ebf3(0x1f8));if(!a134_0x4f3caa[_0x23ebf3(0x273)](_0x404ebb))throw new SDKError(ErrorCode[_0x23ebf3(0x207)],'No\x20tdx.json\x20found\x20in\x20'+_0x49eda2,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x38878e=loadAgentConfig(_0x404ebb),_0xe54f73=await this['resolveProjectId'](_0x38878e[_0x23ebf3(0x280)]),_0x3d2ae7=await this[_0x23ebf3(0x203)]['getProject'](_0xe54f73),_0x519d5f=_0x3d2ae7[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0xd109b3={'projectName':_0x519d5f,'projectId':_0xe54f73,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x2fe103=[],_0x28d482=[],_0x45a269=[],_0x2bd3f5=[],_0x36233a=[],_0x122fc5=[],_0x5e71c8=a134_0x4f3caa[_0x23ebf3(0x249)](_0x49eda2,{'withFileTypes':!![]});for(const _0x64ddb6 of _0x5e71c8){if(!_0x64ddb6[_0x23ebf3(0x27e)]())continue;if([_0x23ebf3(0x20d),_0x23ebf3(0x25d),_0x23ebf3(0x180),_0x23ebf3(0x283),_0x23ebf3(0x213),_0x23ebf3(0x223),_0x23ebf3(0x1c1)][_0x23ebf3(0x20c)](_0x64ddb6[_0x23ebf3(0x1da)]))continue;const _0x513d7b=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x49eda2,_0x64ddb6['name']);if(isAgentDir(_0x513d7b)){const _0x30cc7d=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x513d7b,'agent.yml'),_0x4253ae=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x513d7b,_0x23ebf3(0x214)),_0x4c01ae=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x513d7b,_0x23ebf3(0x22f)),_0x26a75c=parseAgentYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x30cc7d,_0x23ebf3(0x1a7)),_0x30cc7d),_0x65bea9=a134_0x4f3caa[_0x23ebf3(0x273)](_0x4253ae)?a134_0x4f3caa[_0x23ebf3(0x186)](_0x4253ae,_0x23ebf3(0x1a7)):'',_0x5e3e9d=a134_0x4f3caa[_0x23ebf3(0x273)](_0x4c01ae)?a134_0x4f3caa[_0x23ebf3(0x186)](_0x4c01ae,_0x23ebf3(0x1a7)):_0x26a75c[_0x23ebf3(0x1ec)];_0x2fe103['push']({'name':_0x26a75c[_0x23ebf3(0x1da)],'dir':_0x513d7b,'yaml':_0x26a75c,'systemPrompt':_0x65bea9,'starterMessage':_0x5e3e9d});}}const _0x5420eb=getKnowledgeBasesDir(_0x49eda2);if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x5420eb)){const _0x811129=a134_0x4f3caa[_0x23ebf3(0x249)](_0x5420eb);for(const _0x1dc257 of _0x811129){const _0x311e0a=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x5420eb,_0x1dc257);if(_0x1dc257[_0x23ebf3(0x1e6)](_0x23ebf3(0x1c7))){const _0x5bdf81=parseKnowledgeBaseYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x311e0a,_0x23ebf3(0x1a7)),_0x311e0a);_0x28d482[_0x23ebf3(0x277)]({'name':_0x5bdf81[_0x23ebf3(0x1da)],'path':_0x311e0a,'yaml':_0x5bdf81});}else{if(_0x1dc257[_0x23ebf3(0x1e6)]('.md')){const _0x15c10d=a134_0x4f3caa[_0x23ebf3(0x186)](_0x311e0a,_0x23ebf3(0x1a7)),{name:_0x4c67ce,text:_0x3dc2bd}=parseTextKnowledgeBaseMd(_0x15c10d,_0x1dc257);_0x45a269[_0x23ebf3(0x277)]({'name':_0x4c67ce,'path':_0x311e0a,'text':_0x3dc2bd});}}}}const _0xc68f93=getPromptsDir(_0x49eda2);if(a134_0x4f3caa['existsSync'](_0xc68f93)){const _0x30030e=a134_0x4f3caa['readdirSync'](_0xc68f93)[_0x23ebf3(0x18a)](_0x104be1=>_0x104be1[_0x23ebf3(0x1e6)](_0x23ebf3(0x1c7)));for(const _0x2ce7a8 of _0x30030e){const _0x481757=a134_0xb4a0ec[_0x23ebf3(0x271)](_0xc68f93,_0x2ce7a8),_0x2f9672=parsePromptYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x481757,_0x23ebf3(0x1a7)),_0x481757);_0x2bd3f5[_0x23ebf3(0x277)]({'name':_0x2f9672[_0x23ebf3(0x1da)],'path':_0x481757,'yaml':_0x2f9672});}}const _0x13d6c4=[],_0x2ef806=getIntegrationsDir(_0x49eda2);if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x2ef806)){const _0x11853f=a134_0x4f3caa[_0x23ebf3(0x249)](_0x2ef806)[_0x23ebf3(0x18a)](_0x4822e3=>_0x4822e3[_0x23ebf3(0x1e6)](_0x23ebf3(0x1c7)));for(const _0x3103c6 of _0x11853f){const _0x9e5e1e=a134_0xb4a0ec['join'](_0x2ef806,_0x3103c6),_0x315028=parseIntegrationYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x9e5e1e,_0x23ebf3(0x1a7)),_0x9e5e1e);if(!SAFE_INTEGRATION_TYPES['includes'](_0x315028[_0x23ebf3(0x1b8)][_0x23ebf3(0x23b)]())){this[_0x23ebf3(0x1b4)][_0x23ebf3(0x1eb)](_0x23ebf3(0x209)+_0x315028['name']+_0x23ebf3(0x21d)+_0x315028['service_type']+'):\x20'+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES[_0x23ebf3(0x271)](',\x20')+_0x23ebf3(0x1ed))+_0x23ebf3(0x184));continue;}_0x13d6c4[_0x23ebf3(0x277)]({'name':_0x315028[_0x23ebf3(0x1da)],'path':_0x9e5e1e,'yaml':_0x315028});}}const _0x30c51a=getExperimentalKnowledgeBasesDir(_0x49eda2);if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x30c51a)){const _0x4bc792=a134_0x4f3caa['readdirSync'](_0x30c51a,{'withFileTypes':!![]});for(const _0x43b673 of _0x4bc792){if(!_0x43b673[_0x23ebf3(0x27e)]())continue;const _0x443d2a=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x30c51a,_0x43b673[_0x23ebf3(0x1da)]),_0x3dbc96=a134_0xb4a0ec['join'](_0x443d2a,_0x43b673[_0x23ebf3(0x1da)]+_0x23ebf3(0x1c7)),_0x2dcffd=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x443d2a,'functions');if(!a134_0x4f3caa[_0x23ebf3(0x273)](_0x3dbc96))continue;const _0x202459=parseExperimentalKnowledgeBaseYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x3dbc96,'utf-8'),_0x3dbc96),_0x398e02=[];if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x2dcffd)){const _0x2d7415=a134_0x4f3caa[_0x23ebf3(0x249)](_0x2dcffd,{'withFileTypes':!![]});for(const _0x3136d6 of _0x2d7415){if(!_0x3136d6[_0x23ebf3(0x27e)]())continue;const _0x93ea58=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x2dcffd,_0x3136d6[_0x23ebf3(0x1da)]),_0x1ce00d=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x93ea58,_0x23ebf3(0x212)),_0x353f33=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x93ea58,_0x23ebf3(0x1c8));a134_0x4f3caa[_0x23ebf3(0x273)](_0x1ce00d)&&a134_0x4f3caa[_0x23ebf3(0x273)](_0x353f33)&&_0x398e02['push']({'name':_0x3136d6[_0x23ebf3(0x1da)],'code':a134_0x4f3caa[_0x23ebf3(0x186)](_0x1ce00d,_0x23ebf3(0x1a7)),'json_schema':a134_0x4f3caa[_0x23ebf3(0x186)](_0x353f33,_0x23ebf3(0x1a7))});}}const _0x14192c={..._0x202459,'variables':_0x202459['variables']||[],'functions':_0x398e02};_0x36233a[_0x23ebf3(0x277)]({'name':_0x202459['name'],'dir':_0x443d2a,'def':_0x14192c});}}const _0x4332de=getExperimentalArtifactsDir(_0x49eda2);if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x4332de)){const _0x231b2b=a134_0x4f3caa[_0x23ebf3(0x249)](_0x4332de,{'withFileTypes':!![]});for(const _0x439bc7 of _0x231b2b){if(!_0x439bc7['isDirectory']())continue;const _0x564b73=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x4332de,_0x439bc7[_0x23ebf3(0x1da)]),_0x4a7fcd=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x564b73,_0x439bc7['name']+'.yml'),_0x55297a=a134_0xb4a0ec['join'](_0x564b73,_0x23ebf3(0x212)),_0x49a3a3=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x564b73,'files');if(!a134_0x4f3caa[_0x23ebf3(0x273)](_0x4a7fcd)||!a134_0x4f3caa[_0x23ebf3(0x273)](_0x55297a))continue;const _0x4cf2e3=parseExperimentalArtifactYaml(a134_0x4f3caa['readFileSync'](_0x4a7fcd,'utf-8'),_0x4a7fcd),_0x17d2e7=a134_0x4f3caa[_0x23ebf3(0x186)](_0x55297a,'utf-8'),_0x47c17f=[];if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x49a3a3)){const _0x3e9d1d=a134_0x4f3caa[_0x23ebf3(0x249)](_0x49a3a3);for(const _0x55f40c of _0x3e9d1d){const _0x27174c=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x49a3a3,_0x55f40c);a134_0x4f3caa[_0x23ebf3(0x268)](_0x27174c)[_0x23ebf3(0x205)]()&&_0x47c17f['push']({'file_name':_0x55f40c,'text_content':a134_0x4f3caa['readFileSync'](_0x27174c,_0x23ebf3(0x1a7))});}}const _0xebba13={..._0x4cf2e3,'code':_0x17d2e7,'files':_0x47c17f};_0x122fc5[_0x23ebf3(0x277)]({'name':_0x4cf2e3['name'],'dir':_0x564b73,'def':_0xebba13});}}const _0x29f193=[],_0x92e15e=getFormInterfacesDir(_0x49eda2);if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x92e15e)){const _0x30de2e=a134_0x4f3caa[_0x23ebf3(0x249)](_0x92e15e)[_0x23ebf3(0x18a)](_0x4e011a=>_0x4e011a['endsWith']('.yml'));for(const _0x245afd of _0x30de2e){const _0x3abf82=a134_0xb4a0ec['join'](_0x92e15e,_0x245afd),_0x3c9a19=parseFormInterfaceYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x3abf82,_0x23ebf3(0x1a7)),_0x3abf82);_0x29f193[_0x23ebf3(0x277)]({'name':_0x3c9a19[_0x23ebf3(0x1da)],'path':_0x3abf82,'yaml':_0x3c9a19});}}const _0x108c54=[],_0x7d3da6=getChatInterfacesDir(_0x49eda2);if(a134_0x4f3caa['existsSync'](_0x7d3da6)){const _0x1a4e50=a134_0x4f3caa[_0x23ebf3(0x249)](_0x7d3da6)[_0x23ebf3(0x18a)](_0x365e35=>_0x365e35[_0x23ebf3(0x1e6)](_0x23ebf3(0x1c7)));for(const _0x12adf7 of _0x1a4e50){const _0x44595b=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x7d3da6,_0x12adf7),_0x3da76a=parseChatInterfaceYaml(a134_0x4f3caa['readFileSync'](_0x44595b,_0x23ebf3(0x1a7)),_0x44595b);_0x108c54[_0x23ebf3(0x277)]({'name':_0x3da76a['name'],'path':_0x44595b,'yaml':_0x3da76a});}}const _0x3e3d02=await this[_0x23ebf3(0x203)][_0x23ebf3(0x1e1)](_0xe54f73),_0x1a26f0=await this['client'][_0x23ebf3(0x247)](_0xe54f73),_0xae9c3e=await this['client'][_0x23ebf3(0x190)](_0xe54f73),_0x5c80a2=await this[_0x23ebf3(0x203)][_0x23ebf3(0x18b)](_0xe54f73),_0x118ad1=await this[_0x23ebf3(0x203)]['listIntegrations'](_0xe54f73),_0x159b8f=await safeListOrEmpty(()=>this[_0x23ebf3(0x203)][_0x23ebf3(0x1dd)](_0xe54f73)),_0x169577=await safeListOrEmpty(()=>this[_0x23ebf3(0x203)]['listExperimentalArtifacts'](_0xe54f73)),_0x20d24d=await safeListOrEmpty(()=>this[_0x23ebf3(0x203)][_0x23ebf3(0x22a)](_0xe54f73)),_0x1a2b4a=await safeListOrEmpty(()=>this[_0x23ebf3(0x203)][_0x23ebf3(0x1bb)](_0xe54f73)),_0x5ea292=await fetchAllToolTargetMaps((_0x3c0774,_0x2141d6)=>this[_0x23ebf3(0x203)][_0x23ebf3(0x24c)](_0x3c0774,_0x2141d6),_0xe54f73),_0x4969ef=new Map(),_0x470d3e=new Map(),_0x4ea27b=new Map(),_0x530c8c=new Map(),_0x49e608=new Map(),_0x2fa7fe=new Map(),_0x3a6ab3=new Map();for(const _0x1ca8f2 of _0x3e3d02){_0x4969ef[_0x23ebf3(0x26f)](_0x1ca8f2[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x1ca8f2);}for(const _0x31a11d of _0x1a26f0){_0x470d3e[_0x23ebf3(0x26f)](_0x31a11d[_0x23ebf3(0x193)]['name'],_0x31a11d);}for(const _0x14ac4c of _0xae9c3e){_0x4ea27b[_0x23ebf3(0x26f)](_0x14ac4c['attributes'][_0x23ebf3(0x1da)],_0x14ac4c);}for(const _0x30053e of _0x5c80a2){_0x530c8c['set'](_0x30053e[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x30053e);}for(const _0x5c953c of _0x118ad1){_0x49e608[_0x23ebf3(0x26f)](_0x5c953c['attributes'][_0x23ebf3(0x28f)]['toLowerCase'](),_0x5c953c);}for(const _0x8defda of _0x159b8f){_0x2fa7fe['set'](_0x8defda[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x8defda);}for(const _0xe5838f of _0x169577){_0x3a6ab3[_0x23ebf3(0x26f)](_0xe5838f[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0xe5838f);}const _0x4d167e=new Map(),_0x226e44=new Map();for(const _0x53fc47 of _0x20d24d){_0x4d167e[_0x23ebf3(0x26f)](_0x53fc47[_0x23ebf3(0x193)]['name'],_0x53fc47);}for(const _0x3cf412 of _0x1a2b4a){_0x226e44[_0x23ebf3(0x26f)](_0x3cf412[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x3cf412);}const _0x3acc7d=new Map(),_0x3d3ae7=new Map();for(const _0x3df1ec of _0x3e3d02){_0x3acc7d[_0x23ebf3(0x26f)](_0x3df1ec[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x3df1ec['id']),_0x3d3ae7[_0x23ebf3(0x26f)](_0x3df1ec['id'],_0x3df1ec[_0x23ebf3(0x193)][_0x23ebf3(0x1da)]);}const _0x51dea4=new Map(),_0x42fdc8=new Map();for(const _0x53ed04 of _0x5c80a2){_0x51dea4['set'](_0x53ed04[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x53ed04['id']),_0x42fdc8[_0x23ebf3(0x26f)](_0x53ed04['id'],_0x53ed04[_0x23ebf3(0x193)]['name']);}const _0xd25b66=_0x5ea292['nameToId'][_0x23ebf3(0x219)]||new Map(),_0x553293=_0x5ea292['nameToId'][_0x23ebf3(0x282)]||new Map(),_0x5753f5=_0x5ea292[_0x23ebf3(0x288)]['ExperimentalKnowledgeBase']||new Map(),_0xadf01f=new Map(),_0x1286b9={'resolveToolTargetName':buildNameResolver({..._0x5ea292[_0x23ebf3(0x292)],'Agent':_0x3d3ae7}),'resolvePromptName':async _0xf32e83=>_0x42fdc8['get'](_0xf32e83),'onWarning':_0x4b12c2=>this[_0x23ebf3(0x1b4)][_0x23ebf3(0x1eb)](_0x4b12c2)};let _0x1dafc5=[];const _0x23718f={'projectId':_0xe54f73,'resolveToolTargetId':buildIdResolver({..._0x5ea292[_0x23ebf3(0x288)],'Agent':_0x3acc7d}),'resolvePromptId':async _0x1bf33c=>_0x51dea4[_0x23ebf3(0x1c0)](_0x1bf33c),'onWarning':_0x44b937=>{const _0x802bd=_0x23ebf3;this[_0x802bd(0x1b4)]['warn'](_0x44b937),_0x1dafc5[_0x802bd(0x277)](_0x44b937);}},{resolved:_0xa14eff,unresolved:_0x259343}=resolveAgentDependencies(_0x2fe103,new Set(_0x4969ef[_0x23ebf3(0x1a4)]()));for(const {agent:_0x10d6a1,missingDeps:_0x3d0e4b}of _0x259343){_0xd109b3['agents']['push']({'agentName':_0x10d6a1[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x23ebf3(0x253)+_0x3d0e4b[_0x23ebf3(0x271)](',\x20')+_0x23ebf3(0x211)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1bc)][_0x23ebf3(0x1a5)]++;}for(const _0x2e227c of _0x28d482){const _0x749a1f=_0x470d3e[_0x23ebf3(0x1c0)](_0x2e227c[_0x23ebf3(0x28b)]['name']),_0x1d4328=a134_0x4f3caa['readFileSync'](_0x2e227c[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x749a1f){const _0x7564fe=apiKnowledgeBaseToYaml(_0x749a1f),_0x13a9bf=toKnowledgeBaseYamlString(_0x7564fe),_0x2688f3=generateDiff(_0x13a9bf,_0x1d4328),_0x29e89a=hasChanges(_0x2688f3);_0x29e89a?(_0xd109b3[_0x23ebf3(0x1e5)][_0x23ebf3(0x277)]({'name':_0x2e227c[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x749a1f['id'],'diff':formatDiffWithColors(_0x2688f3)}),_0xd109b3[_0x23ebf3(0x1f6)]['knowledgeBases'][_0x23ebf3(0x232)]++):(_0xd109b3['knowledgeBases'][_0x23ebf3(0x277)]({'name':_0x2e227c['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x23a),'id':_0x749a1f['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['knowledgeBases'][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x1e5)][_0x23ebf3(0x277)]({'name':_0x2e227c['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b)}),_0xd109b3['counts']['knowledgeBases'][_0x23ebf3(0x27b)]++;}for(const _0x920566 of _0x45a269){const _0x5456a5=_0x4ea27b[_0x23ebf3(0x1c0)](_0x920566[_0x23ebf3(0x1da)]),_0x5b45a0=a134_0x4f3caa[_0x23ebf3(0x186)](_0x920566[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x5456a5){const _0x379e31=toTextKnowledgeBaseMd(_0x5456a5['attributes'][_0x23ebf3(0x1da)],_0x5456a5['attributes'][_0x23ebf3(0x230)]),_0x1d59c2=generateDiff(_0x379e31,_0x5b45a0),_0x2f69bc=hasChanges(_0x1d59c2);_0x2f69bc?(_0xd109b3[_0x23ebf3(0x25f)]['push']({'name':_0x920566[_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x5456a5['id'],'diff':formatDiffWithColors(_0x1d59c2)}),_0xd109b3['counts']['textKnowledgeBases'][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x25f)]['push']({'name':_0x920566['name'],'action':_0x23ebf3(0x23a),'id':_0x5456a5['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25f)][_0x23ebf3(0x23a)]++);}else _0xd109b3['textKnowledgeBases'][_0x23ebf3(0x277)]({'name':_0x920566[_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b)}),_0xd109b3[_0x23ebf3(0x1f6)]['textKnowledgeBases'][_0x23ebf3(0x27b)]++;}for(const _0x33574d of _0xa14eff){const _0x3c4922=_0x4969ef[_0x23ebf3(0x1c0)](_0x33574d[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)]),_0x5e98d6=a134_0xb4a0ec['join'](_0x33574d[_0x23ebf3(0x227)],_0x23ebf3(0x17c)),_0x147159=a134_0x4f3caa['readFileSync'](_0x5e98d6,'utf-8'),_0x1c46b7=_0x33574d['systemPrompt'],_0x37e0e8=_0x23ebf3(0x1ac)+_0x1c46b7+'\x0a\x0a#\x20agent.yml\x0a'+_0x147159;if(_0x3c4922){const {yaml:_0x2018db,systemPrompt:_0x4b15fb}=await agentResponseToDef(_0x3c4922,_0x1286b9),_0x220780=toAgentYamlString(_0x2018db),_0x114bb7='#\x20prompt.md\x0a'+_0x4b15fb+_0x23ebf3(0x206)+_0x220780,_0x32cd47=generateDiff(_0x114bb7,_0x37e0e8),_0x25cfa1=hasChanges(_0x32cd47);_0x25cfa1?(_0xd109b3[_0x23ebf3(0x1bc)][_0x23ebf3(0x277)]({'agentName':_0x33574d[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'agentId':_0x3c4922['id'],'diff':formatDiffWithColors(_0x32cd47)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1bc)][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x1bc)][_0x23ebf3(0x277)]({'agentName':_0x33574d[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':'unchanged','agentId':_0x3c4922['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['agents']['unchanged']++);}else _0xd109b3[_0x23ebf3(0x1bc)][_0x23ebf3(0x277)]({'agentName':_0x33574d[_0x23ebf3(0x28b)]['name'],'action':'created'}),_0xd109b3['counts'][_0x23ebf3(0x1bc)][_0x23ebf3(0x27b)]++;}for(const _0x4753d9 of _0x2bd3f5){const _0x56e391=_0x530c8c[_0x23ebf3(0x1c0)](_0x4753d9[_0x23ebf3(0x28b)]['name']),_0x1b0409=a134_0x4f3caa['readFileSync'](_0x4753d9[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x56e391){const _0x5407b5=await apiPromptToYaml(_0x56e391,_0x1286b9);if(!_0x5407b5){_0xd109b3['prompts'][_0x23ebf3(0x277)]({'name':_0x4753d9[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':'updated','id':_0x56e391['id']}),_0xd109b3['counts']['prompts'][_0x23ebf3(0x232)]++;continue;}const _0x5749b6=toPromptYamlString(_0x5407b5),_0x50675b=generateDiff(_0x5749b6,_0x1b0409),_0x2c2954=hasChanges(_0x50675b);_0x2c2954?(_0xd109b3['prompts'][_0x23ebf3(0x277)]({'name':_0x4753d9[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':'updated','id':_0x56e391['id'],'diff':formatDiffWithColors(_0x50675b)}),_0xd109b3['counts'][_0x23ebf3(0x25d)][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x25d)][_0x23ebf3(0x277)]({'name':_0x4753d9[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x23a),'id':_0x56e391['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25d)][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x25d)]['push']({'name':_0x4753d9[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b)}),_0xd109b3['counts'][_0x23ebf3(0x25d)][_0x23ebf3(0x27b)]++;}for(const _0x1a807f of _0x13d6c4){const _0x33f188=_0x49e608[_0x23ebf3(0x1c0)](_0x1a807f[_0x23ebf3(0x28b)][_0x23ebf3(0x1b8)]),_0x271892=a134_0x4f3caa['readFileSync'](_0x1a807f[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x33f188){const _0x3a88c1=await apiIntegrationToYaml(_0x33f188,_0x1286b9),_0x598afe=toIntegrationYamlString(_0x3a88c1),_0x41c900=generateDiff(_0x598afe,_0x271892),_0x224b5f=hasChanges(_0x41c900);_0x224b5f?(_0xd109b3[_0x23ebf3(0x180)][_0x23ebf3(0x277)]({'name':_0x1a807f['yaml'][_0x23ebf3(0x1b8)],'action':_0x23ebf3(0x232),'id':_0x33f188['id'],'diff':formatDiffWithColors(_0x41c900)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x180)][_0x23ebf3(0x232)]++):(_0xd109b3['integrations']['push']({'name':_0x1a807f['yaml']['service_type'],'action':_0x23ebf3(0x23a),'id':_0x33f188['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['integrations'][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x180)][_0x23ebf3(0x277)]({'name':_0x1a807f[_0x23ebf3(0x28b)]['service_type'],'action':_0x23ebf3(0x27b)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x180)][_0x23ebf3(0x27b)]++;}for(const _0x4fa755 of _0x36233a){const _0x1271b7=_0x2fa7fe[_0x23ebf3(0x1c0)](_0x4fa755[_0x23ebf3(0x290)]['name']),_0x355194=toExperimentalKnowledgeBaseYamlString(_0x4fa755[_0x23ebf3(0x290)]);let _0x5db6f8=_0x355194;for(const _0x1c9075 of _0x4fa755['def'][_0x23ebf3(0x24f)]){_0x5db6f8+='\x0a---\x20function:\x20'+_0x1c9075[_0x23ebf3(0x1da)]+_0x23ebf3(0x1a2)+_0x1c9075[_0x23ebf3(0x28a)]+'\x0a---\x20schema:\x20'+_0x1c9075[_0x23ebf3(0x1da)]+'\x20---\x0a'+_0x1c9075[_0x23ebf3(0x197)]+'\x0a';}if(_0x1271b7){const _0x289a88=apiExperimentalKnowledgeBaseToYaml(_0x1271b7),_0x30159f=toExperimentalKnowledgeBaseYamlString(_0x289a88);let _0x7dd604=_0x30159f;for(const _0x35512d of _0x289a88[_0x23ebf3(0x24f)]){_0x7dd604+=_0x23ebf3(0x226)+_0x35512d[_0x23ebf3(0x1da)]+_0x23ebf3(0x1a2)+_0x35512d[_0x23ebf3(0x28a)]+'\x0a---\x20schema:\x20'+_0x35512d['name']+_0x23ebf3(0x1a2)+_0x35512d[_0x23ebf3(0x197)]+'\x0a';}const _0x187eea=generateDiff(_0x7dd604,_0x5db6f8),_0xbb142f=hasChanges(_0x187eea);_0xbb142f?(_0xd109b3[_0x23ebf3(0x1cb)]['push']({'name':_0x4fa755['def'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x1271b7['id'],'diff':formatDiffWithColors(_0x187eea)}),_0xd109b3[_0x23ebf3(0x1f6)]['experimentalKnowledgeBases'][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x1cb)][_0x23ebf3(0x277)]({'name':_0x4fa755[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x23a),'id':_0x1271b7['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1cb)][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x1cb)][_0x23ebf3(0x277)]({'name':_0x4fa755[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b)}),_0xd109b3['counts'][_0x23ebf3(0x1cb)][_0x23ebf3(0x27b)]++;}for(const _0x40fb9f of _0x122fc5){const _0x1745fd=_0x3a6ab3[_0x23ebf3(0x1c0)](_0x40fb9f['def'][_0x23ebf3(0x1da)]),_0x4e7e3b=toExperimentalArtifactYamlString(_0x40fb9f[_0x23ebf3(0x290)]);let _0x54a778=_0x4e7e3b+(_0x23ebf3(0x18e)+_0x40fb9f['def'][_0x23ebf3(0x28a)]+'\x0a');for(const _0x33da11 of _0x40fb9f[_0x23ebf3(0x290)][_0x23ebf3(0x200)]){_0x54a778+='---\x20file:\x20'+_0x33da11[_0x23ebf3(0x295)]+_0x23ebf3(0x1a2)+_0x33da11[_0x23ebf3(0x296)]+'\x0a';}if(_0x1745fd){const _0x42487d=apiExperimentalArtifactToYaml(_0x1745fd),_0x2f51c4=toExperimentalArtifactYamlString(_0x42487d);let _0x451d6e=_0x2f51c4+(_0x23ebf3(0x18e)+_0x42487d[_0x23ebf3(0x28a)]+'\x0a');for(const _0x444943 of _0x42487d['files']){_0x451d6e+='---\x20file:\x20'+_0x444943[_0x23ebf3(0x295)]+'\x20---\x0a'+_0x444943[_0x23ebf3(0x296)]+'\x0a';}const _0x2087fb=generateDiff(_0x451d6e,_0x54a778),_0x550572=hasChanges(_0x2087fb);_0x550572?(_0xd109b3[_0x23ebf3(0x20a)][_0x23ebf3(0x277)]({'name':_0x40fb9f['def'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x1745fd['id'],'diff':formatDiffWithColors(_0x2087fb)}),_0xd109b3['counts'][_0x23ebf3(0x20a)][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x20a)]['push']({'name':_0x40fb9f[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x23a),'id':_0x1745fd['id']}),_0xd109b3['counts'][_0x23ebf3(0x20a)][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x20a)]['push']({'name':_0x40fb9f[_0x23ebf3(0x290)]['name'],'action':'created'}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x20a)][_0x23ebf3(0x27b)]++;}for(const _0x33a29c of _0x29f193){const _0x560459=_0x4d167e['get'](_0x33a29c[_0x23ebf3(0x28b)]['name']),_0x1e1139=a134_0x4f3caa['readFileSync'](_0x33a29c[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x560459){const _0x5385ae=await apiFormInterfaceToYaml(_0x560459,_0x1286b9),_0x234d78=toFormInterfaceYamlString(_0x5385ae),_0x16a6c8=generateDiff(_0x234d78,_0x1e1139),_0x659bdf=hasChanges(_0x16a6c8);_0x659bdf?(_0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x33a29c[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x560459['id'],'diff':formatDiffWithColors(_0x16a6c8)}),_0xd109b3[_0x23ebf3(0x1f6)]['formInterfaces'][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x33a29c[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x23a),'id':_0x560459['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x194)]['unchanged']++);}else _0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x33a29c['yaml']['name'],'action':_0x23ebf3(0x27b)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x194)][_0x23ebf3(0x27b)]++;}for(const _0x5d7b8d of _0x108c54){const _0x52c001=_0x226e44[_0x23ebf3(0x1c0)](_0x5d7b8d['yaml'][_0x23ebf3(0x1da)]),_0x1270e9=a134_0x4f3caa[_0x23ebf3(0x186)](_0x5d7b8d[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x52c001){const _0x36a111=await apiChatInterfaceToYaml(_0x52c001,_0x1286b9),_0x907a0b=toChatInterfaceYamlString(_0x36a111),_0x37d01c=generateDiff(_0x907a0b,_0x1270e9),_0x573d62=hasChanges(_0x37d01c);_0x573d62?(_0xd109b3[_0x23ebf3(0x266)][_0x23ebf3(0x277)]({'name':_0x5d7b8d[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x52c001['id'],'diff':formatDiffWithColors(_0x37d01c)}),_0xd109b3['counts'][_0x23ebf3(0x266)]['updated']++):(_0xd109b3[_0x23ebf3(0x266)][_0x23ebf3(0x277)]({'name':_0x5d7b8d[_0x23ebf3(0x28b)]['name'],'action':_0x23ebf3(0x23a),'id':_0x52c001['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x266)][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x266)][_0x23ebf3(0x277)]({'name':_0x5d7b8d['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b)}),_0xd109b3['counts'][_0x23ebf3(0x266)][_0x23ebf3(0x27b)]++;}if(_0xa08415?.['dryRun'])return _0xd109b3;_0xd109b3[_0x23ebf3(0x1e5)]=[],_0xd109b3[_0x23ebf3(0x25f)]=[],_0xd109b3[_0x23ebf3(0x25d)]=[],_0xd109b3[_0x23ebf3(0x180)]=[],_0xd109b3[_0x23ebf3(0x1cb)]=[],_0xd109b3[_0x23ebf3(0x20a)]=[],_0xd109b3[_0x23ebf3(0x194)]=[],_0xd109b3[_0x23ebf3(0x266)]=[];const _0xec9582=_0xd109b3[_0x23ebf3(0x1bc)]['filter'](_0x5b7ca0=>_0x5b7ca0[_0x23ebf3(0x215)]==='error');_0xd109b3[_0x23ebf3(0x1bc)]=_0xec9582,_0xd109b3[_0x23ebf3(0x1f6)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0xec9582[_0x23ebf3(0x189)]},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x2a0e2d of _0x28d482){try{const _0x4c7e81=_0x470d3e[_0x23ebf3(0x1c0)](_0x2a0e2d['yaml'][_0x23ebf3(0x1da)]),_0x105a2e=yamlKnowledgeBaseToApi(_0x2a0e2d[_0x23ebf3(0x28b)],_0xe54f73);if(_0x4c7e81)await this[_0x23ebf3(0x203)][_0x23ebf3(0x26a)](_0x4c7e81['id'],_0x105a2e),_0xd25b66[_0x23ebf3(0x26f)](_0x2a0e2d[_0x23ebf3(0x28b)]['name'],_0x4c7e81['id']),_0xd109b3[_0x23ebf3(0x1e5)]['push']({'name':_0x2a0e2d['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x4c7e81['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['knowledgeBases'][_0x23ebf3(0x232)]++;else{const _0x4c782b=await this['client']['createKnowledgeBase'](_0x105a2e);_0xd25b66[_0x23ebf3(0x26f)](_0x2a0e2d['yaml']['name'],_0x4c782b['id']),_0xd109b3[_0x23ebf3(0x1e5)][_0x23ebf3(0x277)]({'name':_0x2a0e2d[_0x23ebf3(0x28b)]['name'],'action':'created','id':_0x4c782b['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1e5)][_0x23ebf3(0x27b)]++;}}catch(_0x34867f){_0xd109b3[_0x23ebf3(0x1e5)][_0x23ebf3(0x277)]({'name':_0x2a0e2d[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x34867f[_0x23ebf3(0x1af)]}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1e5)][_0x23ebf3(0x1a5)]++;}}for(const _0x442d17 of _0x45a269){try{const _0x276e18=_0x4ea27b[_0x23ebf3(0x1c0)](_0x442d17['name']),_0x2e5c04=yamlTextKnowledgeBaseToApi({'name':_0x442d17['name'],'text':_0x442d17[_0x23ebf3(0x230)]},_0xe54f73);if(_0x276e18)await this['client'][_0x23ebf3(0x1d4)](_0x276e18['id'],_0x2e5c04),_0x553293['set'](_0x442d17[_0x23ebf3(0x1da)],_0x276e18['id']),_0xd109b3[_0x23ebf3(0x25f)]['push']({'name':_0x442d17[_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x276e18['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['textKnowledgeBases']['updated']++;else{const _0x29313b=await this[_0x23ebf3(0x203)][_0x23ebf3(0x1b0)](_0x2e5c04);_0x553293['set'](_0x442d17[_0x23ebf3(0x1da)],_0x29313b['id']),_0xd109b3[_0x23ebf3(0x25f)][_0x23ebf3(0x277)]({'name':_0x442d17['name'],'action':_0x23ebf3(0x27b),'id':_0x29313b['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25f)]['created']++;}}catch(_0x2d6a4d){_0xd109b3[_0x23ebf3(0x25f)]['push']({'name':_0x442d17[_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x2d6a4d[_0x23ebf3(0x1af)]}),_0xd109b3[_0x23ebf3(0x1f6)]['textKnowledgeBases'][_0x23ebf3(0x1a5)]++;}}for(const _0x112968 of _0x36233a){try{const _0x47f80d=_0x2fa7fe[_0x23ebf3(0x1c0)](_0x112968[_0x23ebf3(0x290)][_0x23ebf3(0x1da)]),_0x19dc9a=yamlExperimentalKnowledgeBaseToApi(_0x112968['def'],_0xe54f73);if(_0x47f80d)await this[_0x23ebf3(0x203)][_0x23ebf3(0x192)](_0x47f80d['id'],_0x19dc9a),_0x5753f5[_0x23ebf3(0x26f)](_0x112968[_0x23ebf3(0x290)]['name'],_0x47f80d['id']),_0xd109b3[_0x23ebf3(0x1cb)][_0x23ebf3(0x277)]({'name':_0x112968[_0x23ebf3(0x290)]['name'],'action':'updated','id':_0x47f80d['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1cb)]['updated']++;else{const _0x499865=await this[_0x23ebf3(0x203)][_0x23ebf3(0x208)](_0x19dc9a);_0x5753f5[_0x23ebf3(0x26f)](_0x112968[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],_0x499865['id']),_0xd109b3[_0x23ebf3(0x1cb)][_0x23ebf3(0x277)]({'name':_0x112968[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b),'id':_0x499865['id']}),_0xd109b3['counts'][_0x23ebf3(0x1cb)]['created']++;}}catch(_0x26e25b){_0xd109b3[_0x23ebf3(0x1cb)][_0x23ebf3(0x277)]({'name':_0x112968[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x26e25b[_0x23ebf3(0x1af)]}),_0xd109b3['counts']['experimentalKnowledgeBases']['errors']++;}}for(const _0x3a47f4 of _0x122fc5){try{const _0x5b1db8=_0x3a6ab3[_0x23ebf3(0x1c0)](_0x3a47f4[_0x23ebf3(0x290)][_0x23ebf3(0x1da)]),_0x21cc3f=yamlExperimentalArtifactToApi(_0x3a47f4[_0x23ebf3(0x290)],_0xe54f73);if(_0x5b1db8)await this[_0x23ebf3(0x203)][_0x23ebf3(0x281)](_0x5b1db8['id'],_0x21cc3f),_0xadf01f['set'](_0x3a47f4[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],_0x5b1db8['id']),_0xd109b3[_0x23ebf3(0x20a)][_0x23ebf3(0x277)]({'name':_0x3a47f4['def'][_0x23ebf3(0x1da)],'action':'updated','id':_0x5b1db8['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x20a)][_0x23ebf3(0x232)]++;else{const _0x1dacfc=await this[_0x23ebf3(0x203)][_0x23ebf3(0x21b)](_0x21cc3f);_0xadf01f['set'](_0x3a47f4['def'][_0x23ebf3(0x1da)],_0x1dacfc['id']),_0xd109b3['experimentalArtifacts'][_0x23ebf3(0x277)]({'name':_0x3a47f4[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b),'id':_0x1dacfc['id']}),_0xd109b3['counts'][_0x23ebf3(0x20a)][_0x23ebf3(0x27b)]++;}}catch(_0x288992){_0xd109b3[_0x23ebf3(0x20a)][_0x23ebf3(0x277)]({'name':_0x3a47f4['def'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x288992['message']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x20a)][_0x23ebf3(0x1a5)]++;}}for(const _0x2180f6 of _0xa14eff){_0x1dafc5=[];try{const _0x5ac498=_0x4969ef[_0x23ebf3(0x1c0)](_0x2180f6[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)]),_0x4f8554=await agentDefToRequest(_0x2180f6['yaml'],_0x2180f6[_0x23ebf3(0x1fc)],_0x2180f6[_0x23ebf3(0x1d0)],_0x23718f);if(_0x5ac498)await this[_0x23ebf3(0x203)][_0x23ebf3(0x1dc)](_0x5ac498['id'],_0x4f8554),_0x3acc7d[_0x23ebf3(0x26f)](_0x2180f6[_0x23ebf3(0x28b)]['name'],_0x5ac498['id']),_0xd109b3[_0x23ebf3(0x1bc)][_0x23ebf3(0x277)]({'agentName':_0x2180f6['yaml'][_0x23ebf3(0x1da)],'action':'updated','agentId':_0x5ac498['id'],'warnings':_0x1dafc5['length']>0x0?_0x1dafc5:undefined}),_0xd109b3['counts'][_0x23ebf3(0x1bc)][_0x23ebf3(0x232)]++;else{const _0x39f40e=await this[_0x23ebf3(0x203)][_0x23ebf3(0x1d1)](_0x4f8554);_0x3acc7d[_0x23ebf3(0x26f)](_0x2180f6['yaml'][_0x23ebf3(0x1da)],_0x39f40e['id']),_0xd109b3[_0x23ebf3(0x1bc)]['push']({'agentName':_0x2180f6[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b),'agentId':_0x39f40e['id'],'warnings':_0x1dafc5[_0x23ebf3(0x189)]>0x0?_0x1dafc5:undefined}),_0xd109b3['counts'][_0x23ebf3(0x1bc)][_0x23ebf3(0x27b)]++;}}catch(_0x549d70){_0xd109b3['agents']['push']({'agentName':_0x2180f6[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x549d70[_0x23ebf3(0x1af)],'warnings':_0x1dafc5['length']>0x0?_0x1dafc5:undefined}),_0xd109b3[_0x23ebf3(0x1f6)]['agents'][_0x23ebf3(0x1a5)]++;}}for(const _0x11a7de of _0x2bd3f5){try{const _0x4ddbf4=_0x530c8c[_0x23ebf3(0x1c0)](_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)]),_0x2d6c5b=await yamlPromptToApi(_0x11a7de[_0x23ebf3(0x28b)],_0xe54f73,_0x23718f);if(!_0x2d6c5b){_0xd109b3[_0x23ebf3(0x25d)][_0x23ebf3(0x277)]({'name':_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x23ebf3(0x1ae)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25d)][_0x23ebf3(0x1a5)]++;continue;}if(_0x4ddbf4)await this[_0x23ebf3(0x203)][_0x23ebf3(0x1df)](_0x4ddbf4['id'],_0x2d6c5b),_0x51dea4['set'](_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],_0x4ddbf4['id']),_0xd109b3[_0x23ebf3(0x25d)][_0x23ebf3(0x277)]({'name':_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x4ddbf4['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25d)][_0x23ebf3(0x232)]++;else{const _0x7b5bd=await this[_0x23ebf3(0x203)][_0x23ebf3(0x256)](_0x2d6c5b);_0x51dea4[_0x23ebf3(0x26f)](_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],_0x7b5bd['id']),_0xd109b3[_0x23ebf3(0x25d)][_0x23ebf3(0x277)]({'name':_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':'created','id':_0x7b5bd['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25d)][_0x23ebf3(0x27b)]++;}}catch(_0x307cd6){_0xd109b3['prompts'][_0x23ebf3(0x277)]({'name':_0x11a7de['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x307cd6['message']}),_0xd109b3[_0x23ebf3(0x1f6)]['prompts'][_0x23ebf3(0x1a5)]++;}}for(const _0x330703 of _0x13d6c4){try{const _0x5f2086=_0x49e608[_0x23ebf3(0x1c0)](_0x330703[_0x23ebf3(0x28b)][_0x23ebf3(0x1b8)]),_0x196d87=await yamlIntegrationToApi(_0x330703[_0x23ebf3(0x28b)],_0xe54f73,_0x23718f);if(_0x5f2086){await this[_0x23ebf3(0x203)][_0x23ebf3(0x27a)](_0x5f2086['id']);const _0xed109f=await this['client'][_0x23ebf3(0x1a9)](_0x196d87);_0xd109b3[_0x23ebf3(0x180)][_0x23ebf3(0x277)]({'name':_0x330703['yaml'][_0x23ebf3(0x1b8)],'action':_0x23ebf3(0x232),'id':_0xed109f['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x180)][_0x23ebf3(0x232)]++;}else{const _0x3f2b2f=await this[_0x23ebf3(0x203)][_0x23ebf3(0x1a9)](_0x196d87);_0xd109b3[_0x23ebf3(0x180)][_0x23ebf3(0x277)]({'name':_0x330703[_0x23ebf3(0x28b)][_0x23ebf3(0x1b8)],'action':_0x23ebf3(0x27b),'id':_0x3f2b2f['id']}),_0xd109b3['counts'][_0x23ebf3(0x180)][_0x23ebf3(0x27b)]++;}}catch(_0x36abb1){_0xd109b3['integrations']['push']({'name':_0x330703['yaml'][_0x23ebf3(0x1b8)],'action':_0x23ebf3(0x1ba),'error':_0x36abb1['message']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x180)][_0x23ebf3(0x1a5)]++;}}for(const _0x410382 of _0x29f193){try{const _0x30d7fa=_0x4d167e[_0x23ebf3(0x1c0)](_0x410382[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)]),_0x1e4d46=await yamlFormInterfaceToApi(_0x410382[_0x23ebf3(0x28b)],_0xe54f73,_0x23718f);if(!_0x1e4d46){_0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x410382[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x23ebf3(0x26c)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x194)][_0x23ebf3(0x1a5)]++;continue;}if(_0x30d7fa){const _0x182ad6=await this[_0x23ebf3(0x203)][_0x23ebf3(0x1d9)](_0x30d7fa['id'],_0x1e4d46);_0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x410382['yaml'][_0x23ebf3(0x1da)],'action':'updated','id':_0x182ad6['id']}),_0xd109b3['counts'][_0x23ebf3(0x194)]['updated']++;}else{const _0x17ddf1=await this['client'][_0x23ebf3(0x1a3)](_0x1e4d46);_0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x410382['yaml']['name'],'action':_0x23ebf3(0x27b),'id':_0x17ddf1['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x194)]['created']++;}}catch(_0x3aa51f){_0xd109b3['formInterfaces'][_0x23ebf3(0x277)]({'name':_0x410382[_0x23ebf3(0x28b)]['name'],'action':'error','error':_0x3aa51f['message']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x194)][_0x23ebf3(0x1a5)]++;}}for(const _0x3fe349 of _0x108c54){try{const _0xf2146c=_0x226e44[_0x23ebf3(0x1c0)](_0x3fe349[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)]),_0x49dc8f=await yamlChatInterfaceToApi(_0x3fe349['yaml'],_0xe54f73,_0x23718f);if(_0xf2146c){const _0x3da358=await this['client']['updateChatInterface'](_0xf2146c['id'],_0x49dc8f);_0xd109b3['chatInterfaces'][_0x23ebf3(0x277)]({'name':_0x3fe349[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x3da358['id']}),_0xd109b3['counts']['chatInterfaces']['updated']++;}else{const _0x3a5a89=await this[_0x23ebf3(0x203)][_0x23ebf3(0x24a)](_0x49dc8f);_0xd109b3[_0x23ebf3(0x266)]['push']({'name':_0x3fe349[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b),'id':_0x3a5a89['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['chatInterfaces'][_0x23ebf3(0x27b)]++;}}catch(_0x1b1d91){_0xd109b3[_0x23ebf3(0x266)][_0x23ebf3(0x277)]({'name':_0x3fe349['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x1b1d91['message']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x266)][_0x23ebf3(0x1a5)]++;}}return _0xd109b3;}async['pullAgent'](_0x37cf9f,_0x16004f,_0x4aea3a,_0x8b8500){const _0xe2c72b=a134_0x1280fc,{projectId:_0x2e2a22,project:_0x44472a}=await this['resolveProjectName'](_0x37cf9f),_0x268df7=_0x44472a['attributes'][_0xe2c72b(0x1da)],_0x322e93=await this[_0xe2c72b(0x203)][_0xe2c72b(0x1e1)](_0x2e2a22),_0x34e1e3=_0x322e93[_0xe2c72b(0x1ef)](_0x144997=>_0x144997['attributes'][_0xe2c72b(0x1da)]===_0x16004f);if(!_0x34e1e3)throw new SDKError(ErrorCode[_0xe2c72b(0x1a0)],'Agent\x20not\x20found:\x20'+_0x16004f,undefined,{'helpText':_0xe2c72b(0x222)+_0x322e93[_0xe2c72b(0x1ca)](_0x254989=>_0x254989[_0xe2c72b(0x193)][_0xe2c72b(0x1da)])[_0xe2c72b(0x271)](',\x20')});let _0x581fa1;if(_0x4aea3a)_0x581fa1=_0x4aea3a;else{const _0x5d86f7=a134_0xb4a0ec[_0xe2c72b(0x271)](process['cwd'](),_0xe2c72b(0x1bc)),_0x54fc3c=getSanitizedPathWithMigration(_0x5d86f7,_0x268df7);_0x54fc3c[_0xe2c72b(0x234)]&&this[_0xe2c72b(0x1b4)][_0xe2c72b(0x183)](_0xe2c72b(0x276)+a134_0xb4a0ec['basename'](_0x54fc3c[_0xe2c72b(0x254)])+_0xe2c72b(0x28d)+a134_0xb4a0ec[_0xe2c72b(0x23c)](_0x54fc3c['path'])),_0x581fa1=_0x54fc3c['path'];}const _0xb1dcf4=getSanitizedPathWithMigration(_0x581fa1,_0x16004f);_0xb1dcf4['renamed']&&this[_0xe2c72b(0x1b4)]['info'](_0xe2c72b(0x1a1)+a134_0xb4a0ec[_0xe2c72b(0x23c)](_0xb1dcf4[_0xe2c72b(0x254)])+'\x20→\x20'+a134_0xb4a0ec[_0xe2c72b(0x23c)](_0xb1dcf4[_0xe2c72b(0x19a)]));const _0x1662e7=_0xb1dcf4['path'],_0x5d2631=new Map(),_0x4bdff1=new Map(),_0x1560eb=await this[_0xe2c72b(0x203)][_0xe2c72b(0x247)](_0x2e2a22),_0x4f0d46=await this[_0xe2c72b(0x203)]['listTextKnowledgeBases'](_0x2e2a22),_0x400e60=await safeListOrEmpty(()=>this['client']['listExperimentalKnowledgeBases'](_0x2e2a22)),_0xe50afc=new Map(),_0x5eb2d3=new Map();for(const _0x239418 of _0x1560eb){_0x5d2631[_0xe2c72b(0x26f)](_0x239418['id'],_0x239418[_0xe2c72b(0x193)]['name']);}for(const _0x36ed46 of _0x4f0d46){_0xe50afc[_0xe2c72b(0x26f)](_0x36ed46['id'],_0x36ed46[_0xe2c72b(0x193)][_0xe2c72b(0x1da)]);}for(const _0x21b599 of _0x400e60){_0x5eb2d3['set'](_0x21b599['id'],_0x21b599['attributes'][_0xe2c72b(0x1da)]);}for(const _0x495719 of _0x322e93){_0x4bdff1[_0xe2c72b(0x26f)](_0x495719['id'],_0x495719['attributes'][_0xe2c72b(0x1da)]);}const _0xdccfcb={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x5d2631,'TextKnowledgeBase':_0xe50afc,'Agent':_0x4bdff1,'ExperimentalKnowledgeBase':_0x5eb2d3}),'resolvePromptName':async()=>undefined,'onWarning':_0x1c2132=>this[_0xe2c72b(0x1b4)]['warn'](_0x1c2132)},_0x39813b=a134_0xb4a0ec[_0xe2c72b(0x271)](_0x1662e7,_0xe2c72b(0x214)),_0x5afb5b=a134_0xb4a0ec[_0xe2c72b(0x271)](_0x1662e7,'agent.yml'),_0x237ad2=a134_0xb4a0ec[_0xe2c72b(0x271)](_0x1662e7,_0xe2c72b(0x22f)),_0x49d000=!a134_0x4f3caa['existsSync'](_0x5afb5b);if(_0x8b8500?.[_0xe2c72b(0x248)])return{'agentName':_0x16004f,'outputPath':_0x1662e7,'isNew':_0x49d000,'hasChanges':!![]};a134_0x4f3caa[_0xe2c72b(0x20f)](_0x581fa1,{'recursive':!![]}),a134_0x4f3caa[_0xe2c72b(0x20f)](_0x1662e7,{'recursive':!![]});const _0x31d8a3=a134_0xb4a0ec[_0xe2c72b(0x271)](_0x581fa1,'tdx.json');!a134_0x4f3caa[_0xe2c72b(0x273)](_0x31d8a3)&&a134_0x4f3caa[_0xe2c72b(0x188)](_0x31d8a3,createAgentConfigContent(_0x37cf9f));const {yaml:_0x245659,systemPrompt:_0x392c4b,starterMessage:_0x520eef}=await agentResponseToDef(_0x34e1e3,_0xdccfcb);let _0xfe9587=_0x49d000;if(!_0x49d000){const _0x514cb3=a134_0x4f3caa[_0xe2c72b(0x273)](_0x39813b)?a134_0x4f3caa[_0xe2c72b(0x186)](_0x39813b,_0xe2c72b(0x1a7)):'',_0x273645=a134_0x4f3caa[_0xe2c72b(0x186)](_0x5afb5b,'utf-8');_0xfe9587=_0x514cb3!==_0x392c4b||_0x273645!==toAgentYamlString(_0x245659);}a134_0x4f3caa['writeFileSync'](_0x39813b,_0x392c4b),a134_0x4f3caa[_0xe2c72b(0x188)](_0x5afb5b,toAgentYamlString(_0x245659));if(_0x520eef&&_0x520eef[_0xe2c72b(0x20c)]('\x0a'))a134_0x4f3caa['writeFileSync'](_0x237ad2,_0x520eef);else a134_0x4f3caa[_0xe2c72b(0x273)](_0x237ad2)&&a134_0x4f3caa[_0xe2c72b(0x231)](_0x237ad2);return{'agentName':_0x16004f,'outputPath':_0x1662e7,'isNew':_0x49d000,'hasChanges':_0xfe9587};}async[a134_0x1280fc(0x182)](_0x10601e,_0xc3c24){const _0x37e604=a134_0x1280fc;let _0x3c3779;isAgentYamlPath(_0x10601e)?_0x3c3779=getAgentDirFromYamlPath(_0x10601e):_0x3c3779=_0x10601e;const {config:_0x9348ae}=findAgentConfig(_0x3c3779),_0x57236d=await this[_0x37e604(0x1ea)](_0x9348ae[_0x37e604(0x280)]),_0x43284e=a134_0xb4a0ec['join'](_0x3c3779,'agent.yml'),_0x4b1dda=a134_0xb4a0ec[_0x37e604(0x271)](_0x3c3779,_0x37e604(0x214)),_0x2b94e4=a134_0xb4a0ec['join'](_0x3c3779,'starter_message.md');if(!a134_0x4f3caa[_0x37e604(0x273)](_0x43284e))throw new SDKError(ErrorCode['NOT_FOUND'],'agent.yml\x20not\x20found\x20in\x20'+_0x3c3779,undefined,{'helpText':_0x37e604(0x221)});const _0x3097ea=parseAgentYaml(a134_0x4f3caa[_0x37e604(0x186)](_0x43284e,_0x37e604(0x1a7)),_0x43284e),_0x1cc1e0=a134_0x4f3caa[_0x37e604(0x273)](_0x4b1dda)?a134_0x4f3caa[_0x37e604(0x186)](_0x4b1dda,_0x37e604(0x1a7)):'',_0xe98055=a134_0x4f3caa[_0x37e604(0x273)](_0x2b94e4)?a134_0x4f3caa[_0x37e604(0x186)](_0x2b94e4,_0x37e604(0x1a7)):_0x3097ea[_0x37e604(0x1ec)];if(_0xc3c24?.[_0x37e604(0x248)])return{'agentName':_0x3097ea[_0x37e604(0x1da)],'action':_0x37e604(0x27b),'projectId':_0x57236d};const _0x4fa599=await this[_0x37e604(0x203)][_0x37e604(0x1e1)](_0x57236d),_0x4d302a=await fetchAllToolTargetMaps((_0x1a4f71,_0x114816)=>this[_0x37e604(0x203)][_0x37e604(0x24c)](_0x1a4f71,_0x114816),_0x57236d),_0x373bb5=new Map();for(const _0x18fd93 of _0x4fa599){_0x373bb5[_0x37e604(0x26f)](_0x18fd93['attributes']['name'],_0x18fd93['id']);}const _0x1b56fd=[],_0x1db545={'projectId':_0x57236d,'resolveToolTargetId':buildIdResolver({..._0x4d302a['nameToId'],'Agent':_0x373bb5}),'resolvePromptId':async()=>undefined,'onWarning':_0x1808bf=>{const _0x55e331=_0x37e604;this['logger'][_0x55e331(0x1eb)](_0x1808bf),_0x1b56fd[_0x55e331(0x277)](_0x1808bf);}};try{const _0x2e60b8=_0x4fa599[_0x37e604(0x1ef)](_0x3ea2f7=>_0x3ea2f7[_0x37e604(0x193)][_0x37e604(0x1da)]===_0x3097ea[_0x37e604(0x1da)]),_0x189f70=await agentDefToRequest(_0x3097ea,_0x1cc1e0,_0xe98055,_0x1db545);if(_0x2e60b8)return await this['client'][_0x37e604(0x1dc)](_0x2e60b8['id'],_0x189f70),{'agentName':_0x3097ea[_0x37e604(0x1da)],'action':_0x37e604(0x232),'projectId':_0x57236d,'agentId':_0x2e60b8['id'],'warnings':_0x1b56fd[_0x37e604(0x189)]>0x0?_0x1b56fd:undefined};else{const _0x15d1b2=await this['client'][_0x37e604(0x1d1)](_0x189f70);return{'agentName':_0x3097ea[_0x37e604(0x1da)],'action':_0x37e604(0x27b),'projectId':_0x57236d,'agentId':_0x15d1b2['id'],'warnings':_0x1b56fd['length']>0x0?_0x1b56fd:undefined};}}catch(_0x2e1611){return{'agentName':_0x3097ea['name'],'action':_0x37e604(0x1ba),'projectId':_0x57236d,'error':_0x2e1611[_0x37e604(0x1af)],'warnings':_0x1b56fd[_0x37e604(0x189)]>0x0?_0x1b56fd:undefined};}}async[a134_0x1280fc(0x1b9)](_0x39af0f,_0x41565c,_0x1e875e){const _0x347fc7=a134_0x1280fc,_0x890f50=a134_0x4f3caa['existsSync'](_0x39af0f)&&a134_0x4f3caa['existsSync'](a134_0xb4a0ec[_0x347fc7(0x271)](_0x39af0f,_0x347fc7(0x1f8)));let _0x4ebeb8;const _0x9cd1b=[],_0x5db401=[],_0x2cec3b=[],_0x19013c=[],_0x4e691a=[],_0x1a3e3b=[],_0x42c6c2=[],_0x358682=[],_0x52b041=[];if(_0x890f50){const _0x26b076=loadAgentConfig(a134_0xb4a0ec[_0x347fc7(0x271)](_0x39af0f,_0x347fc7(0x1f8)));_0x4ebeb8=_0x26b076[_0x347fc7(0x280)];const _0x45d470=a134_0x4f3caa['readdirSync'](_0x39af0f,{'withFileTypes':!![]});for(const _0x9feb2d of _0x45d470){if(!_0x9feb2d['isDirectory']())continue;if(['knowledge_bases',_0x347fc7(0x283),'experimental_artifacts',_0x347fc7(0x25d),_0x347fc7(0x180),_0x347fc7(0x223),_0x347fc7(0x1c1)]['includes'](_0x9feb2d[_0x347fc7(0x1da)]))continue;const _0x75b221=a134_0xb4a0ec[_0x347fc7(0x271)](_0x39af0f,_0x9feb2d[_0x347fc7(0x1da)]);if(isAgentDir(_0x75b221)){const _0x3d94ad=a134_0xb4a0ec[_0x347fc7(0x271)](_0x75b221,'agent.yml'),_0x50a95c=a134_0xb4a0ec[_0x347fc7(0x271)](_0x75b221,_0x347fc7(0x214)),_0x43a50c=a134_0xb4a0ec[_0x347fc7(0x271)](_0x75b221,_0x347fc7(0x22f)),_0x114c8f=parseAgentYaml(a134_0x4f3caa['readFileSync'](_0x3d94ad,'utf-8'),_0x3d94ad),_0x47f93d=a134_0x4f3caa[_0x347fc7(0x273)](_0x50a95c)?a134_0x4f3caa[_0x347fc7(0x186)](_0x50a95c,'utf-8'):'',_0x498299=a134_0x4f3caa[_0x347fc7(0x273)](_0x43a50c)?a134_0x4f3caa[_0x347fc7(0x186)](_0x43a50c,'utf-8'):_0x114c8f[_0x347fc7(0x1ec)];_0x9cd1b['push']({'name':_0x114c8f['name'],'dir':_0x75b221,'yaml':_0x114c8f,'systemPrompt':_0x47f93d,'starterMessage':_0x498299});}}const _0x19d19b=getKnowledgeBasesDir(_0x39af0f);if(a134_0x4f3caa[_0x347fc7(0x273)](_0x19d19b)){const _0x9b615c=a134_0x4f3caa[_0x347fc7(0x249)](_0x19d19b);for(const _0x595790 of _0x9b615c){const _0x18893b=a134_0xb4a0ec['join'](_0x19d19b,_0x595790);if(_0x595790['endsWith'](_0x347fc7(0x1c7))){const _0x4d1a75=parseKnowledgeBaseYaml(a134_0x4f3caa['readFileSync'](_0x18893b,_0x347fc7(0x1a7)),_0x18893b);_0x5db401['push']({'name':_0x4d1a75[_0x347fc7(0x1da)],'path':_0x18893b,'yaml':_0x4d1a75});}else{if(_0x595790[_0x347fc7(0x1e6)](_0x347fc7(0x1e9))){const _0x5da31f=a134_0x4f3caa['readFileSync'](_0x18893b,'utf-8'),{name:_0x481086,text:_0xe73e23}=parseTextKnowledgeBaseMd(_0x5da31f,_0x595790);_0x2cec3b[_0x347fc7(0x277)]({'name':_0x481086,'path':_0x18893b,'text':_0xe73e23});}}}}const _0x247afe=getPromptsDir(_0x39af0f);if(a134_0x4f3caa['existsSync'](_0x247afe)){const _0x433c79=a134_0x4f3caa[_0x347fc7(0x249)](_0x247afe)[_0x347fc7(0x18a)](_0x54da1b=>_0x54da1b[_0x347fc7(0x1e6)](_0x347fc7(0x1c7)));for(const _0x4b1450 of _0x433c79){const _0xc39a80=a134_0xb4a0ec['join'](_0x247afe,_0x4b1450),_0x202938=parsePromptYaml(a134_0x4f3caa[_0x347fc7(0x186)](_0xc39a80,_0x347fc7(0x1a7)),_0xc39a80);_0x19013c[_0x347fc7(0x277)]({'name':_0x202938[_0x347fc7(0x1da)],'path':_0xc39a80,'yaml':_0x202938});}}const _0x48f6a0=getIntegrationsDir(_0x39af0f);if(a134_0x4f3caa[_0x347fc7(0x273)](_0x48f6a0)){const _0x2ddffb=a134_0x4f3caa[_0x347fc7(0x249)](_0x48f6a0)[_0x347fc7(0x18a)](_0x218eb5=>_0x218eb5['endsWith'](_0x347fc7(0x1c7)));for(const _0x26f5d1 of _0x2ddffb){const _0x5a5838=a134_0xb4a0ec['join'](_0x48f6a0,_0x26f5d1),_0x409c63=parseIntegrationYaml(a134_0x4f3caa['readFileSync'](_0x5a5838,'utf-8'),_0x5a5838);SAFE_INTEGRATION_TYPES[_0x347fc7(0x20c)](_0x409c63[_0x347fc7(0x1b8)][_0x347fc7(0x23b)]())?_0x4e691a[_0x347fc7(0x277)]({'name':_0x409c63[_0x347fc7(0x1da)],'path':_0x5a5838,'yaml':_0x409c63}):this[_0x347fc7(0x1b4)][_0x347fc7(0x1eb)](_0x347fc7(0x209)+_0x409c63[_0x347fc7(0x1da)]+_0x347fc7(0x21d)+_0x409c63[_0x347fc7(0x1b8)]+_0x347fc7(0x1d5)+(_0x347fc7(0x1e0)+SAFE_INTEGRATION_TYPES[_0x347fc7(0x271)](',\x20')+_0x347fc7(0x23d)));}}const _0x35271d=getExperimentalKnowledgeBasesDir(_0x39af0f);if(a134_0x4f3caa[_0x347fc7(0x273)](_0x35271d)){const _0x4187ab=a134_0x4f3caa[_0x347fc7(0x249)](_0x35271d,{'withFileTypes':!![]});for(const _0x4c4ea1 of _0x4187ab){if(!_0x4c4ea1[_0x347fc7(0x27e)]())continue;const _0x480439=a134_0xb4a0ec['join'](_0x35271d,_0x4c4ea1[_0x347fc7(0x1da)]),_0x21caf3=a134_0xb4a0ec[_0x347fc7(0x271)](_0x480439,_0x4c4ea1[_0x347fc7(0x1da)]+_0x347fc7(0x1c7));if(a134_0x4f3caa[_0x347fc7(0x273)](_0x21caf3)){const _0x51334b=parseExperimentalKnowledgeBaseYaml(a134_0x4f3caa[_0x347fc7(0x186)](_0x21caf3,_0x347fc7(0x1a7)),_0x21caf3),_0x1fb73=a134_0xb4a0ec[_0x347fc7(0x271)](_0x480439,'functions'),_0x19806e=[];if(a134_0x4f3caa[_0x347fc7(0x273)](_0x1fb73)){const _0x2a03d3=a134_0x4f3caa[_0x347fc7(0x249)](_0x1fb73,{'withFileTypes':!![]});for(const _0x1509cb of _0x2a03d3){if(!_0x1509cb[_0x347fc7(0x27e)]())continue;const _0x58e583=a134_0xb4a0ec[_0x347fc7(0x271)](_0x1fb73,_0x1509cb['name']),_0x9d8323=a134_0xb4a0ec[_0x347fc7(0x271)](_0x58e583,'code.js'),_0x4fff1e=a134_0xb4a0ec[_0x347fc7(0x271)](_0x58e583,_0x347fc7(0x1c8));if(a134_0x4f3caa[_0x347fc7(0x273)](_0x9d8323)&&a134_0x4f3caa[_0x347fc7(0x273)](_0x4fff1e)){const _0x7a3302=a134_0x4f3caa[_0x347fc7(0x186)](_0x9d8323,_0x347fc7(0x1a7)),_0x4643f6=a134_0x4f3caa[_0x347fc7(0x186)](_0x4fff1e,_0x347fc7(0x1a7));_0x19806e[_0x347fc7(0x277)]({'name':_0x1509cb[_0x347fc7(0x1da)],'code':_0x7a3302,'json_schema':_0x4643f6});}}}const _0x57c463={..._0x51334b,'functions':_0x19806e};_0x1a3e3b[_0x347fc7(0x277)]({'name':_0x51334b[_0x347fc7(0x1da)],'path':_0x480439,'def':_0x57c463});}}}const _0xcd2d54=getExperimentalArtifactsDir(_0x39af0f);if(a134_0x4f3caa[_0x347fc7(0x273)](_0xcd2d54)){const _0xd81fcc=a134_0x4f3caa[_0x347fc7(0x249)](_0xcd2d54,{'withFileTypes':!![]});for(const _0x3eefd9 of _0xd81fcc){if(!_0x3eefd9['isDirectory']())continue;const _0x4fed3b=a134_0xb4a0ec['join'](_0xcd2d54,_0x3eefd9[_0x347fc7(0x1da)]),_0x41d49b=a134_0xb4a0ec['join'](_0x4fed3b,_0x3eefd9['name']+'.yml');if(a134_0x4f3caa[_0x347fc7(0x273)](_0x41d49b)){const _0x4291d2=parseExperimentalArtifactYaml(a134_0x4f3caa[_0x347fc7(0x186)](_0x41d49b,'utf-8'),_0x41d49b),_0x551f8f=a134_0xb4a0ec[_0x347fc7(0x271)](_0x4fed3b,_0x347fc7(0x212)),_0x31676a=a134_0x4f3caa['existsSync'](_0x551f8f)?a134_0x4f3caa[_0x347fc7(0x186)](_0x551f8f,_0x347fc7(0x1a7)):'',_0x821505=a134_0xb4a0ec[_0x347fc7(0x271)](_0x4fed3b,'files'),_0x459076=[];if(a134_0x4f3caa[_0x347fc7(0x273)](_0x821505)){const _0x38f092=a134_0x4f3caa[_0x347fc7(0x249)](_0x821505);for(const _0x49eefe of _0x38f092){const _0x35ba8a=a134_0xb4a0ec['join'](_0x821505,_0x49eefe);if(a134_0x4f3caa[_0x347fc7(0x268)](_0x35ba8a)[_0x347fc7(0x205)]()){const _0x25e1b0=a134_0x4f3caa[_0x347fc7(0x186)](_0x35ba8a,_0x347fc7(0x1a7));_0x459076[_0x347fc7(0x277)]({'file_name':_0x49eefe,'text_content':_0x25e1b0});}}}const _0x26a6e1={..._0x4291d2,'code':_0x31676a,'files':_0x459076};_0x42c6c2[_0x347fc7(0x277)]({'name':_0x4291d2[_0x347fc7(0x1da)],'path':_0x4fed3b,'def':_0x26a6e1});}}}const _0x4f17ca=getFormInterfacesDir(_0x39af0f);if(a134_0x4f3caa[_0x347fc7(0x273)](_0x4f17ca)){const _0x8ea91c=a134_0x4f3caa[_0x347fc7(0x249)](_0x4f17ca)[_0x347fc7(0x18a)](_0x1fc08f=>_0x1fc08f[_0x347fc7(0x1e6)](_0x347fc7(0x1c7)));for(const _0x296a79 of _0x8ea91c){const _0xaa7362=a134_0xb4a0ec[_0x347fc7(0x271)](_0x4f17ca,_0x296a79),_0x4dca4c=parseFormInterfaceYaml(a134_0x4f3caa[_0x347fc7(0x186)](_0xaa7362,'utf-8'),_0xaa7362);_0x358682[_0x347fc7(0x277)]({'name':_0x4dca4c[_0x347fc7(0x1da)],'path':_0xaa7362,'yaml':_0x4dca4c});}}const _0x15ad82=getChatInterfacesDir(_0x39af0f);if(a134_0x4f3caa['existsSync'](_0x15ad82)){const _0x44fbc9=a134_0x4f3caa[_0x347fc7(0x249)](_0x15ad82)['filter'](_0x18001c=>_0x18001c[_0x347fc7(0x1e6)](_0x347fc7(0x1c7)));for(const _0x5e8f62 of _0x44fbc9){const _0x3ae5e2=a134_0xb4a0ec[_0x347fc7(0x271)](_0x15ad82,_0x5e8f62),_0x15dff0=parseChatInterfaceYaml(a134_0x4f3caa[_0x347fc7(0x186)](_0x3ae5e2,'utf-8'),_0x3ae5e2);_0x52b041['push']({'name':_0x15dff0['name'],'path':_0x3ae5e2,'yaml':_0x15dff0});}}}else{const _0x5c4a0c=await this[_0x347fc7(0x1ea)](_0x39af0f),_0x53179a=await this['client'][_0x347fc7(0x1f0)](_0x5c4a0c);_0x4ebeb8=_0x53179a['attributes'][_0x347fc7(0x1da)];const _0x4359dc=await this[_0x347fc7(0x203)]['listAgentsFull'](_0x5c4a0c),_0x4f32ab=await this[_0x347fc7(0x203)][_0x347fc7(0x247)](_0x5c4a0c),_0xfebee6=await this[_0x347fc7(0x203)][_0x347fc7(0x190)](_0x5c4a0c),_0xd188aa=await this[_0x347fc7(0x203)][_0x347fc7(0x18b)](_0x5c4a0c),_0x242099=await this[_0x347fc7(0x203)][_0x347fc7(0x1db)](_0x5c4a0c),_0x5cd944=await safeListOrEmpty(()=>this[_0x347fc7(0x203)]['listExperimentalKnowledgeBases'](_0x5c4a0c)),_0x4c5c4c=await safeListOrEmpty(()=>this['client']['listExperimentalArtifacts'](_0x5c4a0c)),_0x188ea2=new Map(),_0xe21d3=new Map(),_0x229bba=new Map(),_0x50b9c1=new Map(),_0x463b64=new Map(),_0x135855=new Map();for(const _0x5a07df of _0x4f32ab){_0x188ea2['set'](_0x5a07df['id'],_0x5a07df[_0x347fc7(0x193)]['name']);}for(const _0x420476 of _0xfebee6){_0xe21d3[_0x347fc7(0x26f)](_0x420476['id'],_0x420476[_0x347fc7(0x193)]['name']);}for(const _0x324f91 of _0x4359dc){_0x229bba[_0x347fc7(0x26f)](_0x324f91['id'],_0x324f91[_0x347fc7(0x193)][_0x347fc7(0x1da)]);}for(const _0x4a4f6b of _0xd188aa){_0x50b9c1[_0x347fc7(0x26f)](_0x4a4f6b['id'],_0x4a4f6b[_0x347fc7(0x193)][_0x347fc7(0x1da)]);}for(const _0x3043c8 of _0x5cd944){_0x463b64[_0x347fc7(0x26f)](_0x3043c8['id'],_0x3043c8['attributes']['name']);}for(const _0x3dbc68 of _0x4c5c4c){_0x135855[_0x347fc7(0x26f)](_0x3dbc68['id'],_0x3dbc68['attributes'][_0x347fc7(0x1da)]);}const _0x2854d3={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x188ea2,'TextKnowledgeBase':_0xe21d3,'Agent':_0x229bba,'ExperimentalKnowledgeBase':_0x463b64}),'resolvePromptName':async _0x3fb5c6=>_0x50b9c1[_0x347fc7(0x1c0)](_0x3fb5c6),'onWarning':_0x5e8bdd=>this[_0x347fc7(0x1b4)][_0x347fc7(0x1eb)](_0x5e8bdd)};for(const _0x625917 of _0x4359dc){const _0x43c0e7=await agentResponseToDef(_0x625917,_0x2854d3),{yaml:_0x261161,systemPrompt:_0x1956c9,starterMessage:_0x3853c1}=_0x43c0e7;_0x9cd1b['push']({'name':_0x261161[_0x347fc7(0x1da)],'dir':'','yaml':_0x261161,'systemPrompt':_0x1956c9,'starterMessage':_0x3853c1});}for(const _0x3ebdba of _0x4f32ab){const _0x535d41=apiKnowledgeBaseToYaml(_0x3ebdba);_0x5db401[_0x347fc7(0x277)]({'name':_0x535d41[_0x347fc7(0x1da)],'path':'','yaml':_0x535d41});}for(const _0x54c450 of _0xfebee6){_0x2cec3b[_0x347fc7(0x277)]({'name':_0x54c450[_0x347fc7(0x193)][_0x347fc7(0x1da)],'path':'','text':_0x54c450['attributes'][_0x347fc7(0x230)]});}for(const _0x12f5e8 of _0xd188aa){const _0x38aef1=await apiPromptToYaml(_0x12f5e8,_0x2854d3);_0x38aef1&&_0x19013c[_0x347fc7(0x277)]({'name':_0x38aef1[_0x347fc7(0x1da)],'path':'','yaml':_0x38aef1});}for(const _0x387f51 of _0x242099){if(!_0x387f51[_0x347fc7(0x193)][_0x347fc7(0x1c4)]&&SAFE_INTEGRATION_TYPES['includes'](_0x387f51[_0x347fc7(0x193)][_0x347fc7(0x28f)][_0x347fc7(0x23b)]())){const _0x16ee09=await apiIntegrationToYaml(_0x387f51,_0x2854d3);_0x4e691a['push']({'name':_0x387f51[_0x347fc7(0x193)][_0x347fc7(0x28f)][_0x347fc7(0x23b)](),'path':'','yaml':_0x16ee09});}}for(const _0x3f05af of _0x5cd944){const _0x5b32b7=apiExperimentalKnowledgeBaseToYaml(_0x3f05af);_0x1a3e3b['push']({'name':_0x5b32b7[_0x347fc7(0x1da)],'path':'','def':_0x5b32b7});}for(const _0xf7c544 of _0x4c5c4c){const _0x350e4c=apiExperimentalArtifactToYaml(_0xf7c544);_0x42c6c2[_0x347fc7(0x277)]({'name':_0x350e4c[_0x347fc7(0x1da)],'path':'','def':_0x350e4c});}const _0x365c37=await safeListOrEmpty(()=>this[_0x347fc7(0x203)][_0x347fc7(0x22a)](_0x5c4a0c));for(const _0x292711 of _0x365c37){const _0x5daace=await apiFormInterfaceToYaml(_0x292711,_0x2854d3);_0x358682[_0x347fc7(0x277)]({'name':_0x5daace[_0x347fc7(0x1da)],'path':'','yaml':_0x5daace});}const _0x509c19=await safeListOrEmpty(()=>this[_0x347fc7(0x203)][_0x347fc7(0x1bb)](_0x5c4a0c));for(const _0x35ba40 of _0x509c19){if(_0x35ba40['attributes']['isManaged'])continue;const _0x6326d2=await apiChatInterfaceToYaml(_0x35ba40,_0x2854d3);_0x52b041[_0x347fc7(0x277)]({'name':_0x6326d2[_0x347fc7(0x1da)],'path':'','yaml':_0x6326d2});}}const _0x8b72ab={'sourceProjectName':_0x4ebeb8,'newProjectName':_0x41565c,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'imageGenerators':{'created':0x0,'errors':0x0},'webSearchTools':{'created':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'errors':0x0}}},_0x130ea1=await this['client'][_0x347fc7(0x1b2)](),_0x55df98=_0x130ea1[_0x347fc7(0x1ef)](_0x26cfd3=>_0x26cfd3[_0x347fc7(0x193)]['name']===_0x41565c);if(_0x55df98)throw new SDKError(ErrorCode[_0x347fc7(0x250)],_0x347fc7(0x1d3)+_0x41565c+'\x22\x20already\x20exists',undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x1e875e?.[_0x347fc7(0x248)])return _0x8b72ab['counts']['agents'][_0x347fc7(0x27b)]=_0x9cd1b[_0x347fc7(0x189)],_0x8b72ab['counts']['knowledgeBases'][_0x347fc7(0x27b)]=_0x5db401['length'],_0x8b72ab[_0x347fc7(0x1f6)]['textKnowledgeBases']['created']=_0x2cec3b[_0x347fc7(0x189)],_0x8b72ab[_0x347fc7(0x1f6)]['experimentalKnowledgeBases'][_0x347fc7(0x27b)]=_0x1a3e3b[_0x347fc7(0x189)],_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x20a)][_0x347fc7(0x27b)]=_0x42c6c2[_0x347fc7(0x189)],_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x25d)]['created']=_0x19013c[_0x347fc7(0x189)],_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x180)][_0x347fc7(0x27b)]=_0x4e691a['length'],_0x8b72ab;const _0x776bc4=await this[_0x347fc7(0x203)][_0x347fc7(0x1f7)]({'name':_0x41565c}),_0x49ac2a=_0x776bc4['id'];_0x8b72ab[_0x347fc7(0x1a6)]=_0x49ac2a;const _0x3aabec=new Map(),_0x1fe7b8=new Map(),_0x1bad79=new Map(),_0x12b430=new Map(),_0x1b9391=new Map(),_0x1c9acc=new Map(),_0x3faaf5=new Map(),_0x62f5c7=new Map(),_0x5af7ec=new Set(),_0x139e67=new Set();for(const _0x5aa219 of _0x9cd1b){for(const _0x574313 of _0x5aa219['yaml'][_0x347fc7(0x17e)]||[]){if(_0x574313[_0x347fc7(0x216)]===_0x347fc7(0x225)&&_0x574313[_0x347fc7(0x1d7)]){const _0x211020=parseRef(_0x574313[_0x347fc7(0x1d7)]);if(_0x211020)_0x5af7ec[_0x347fc7(0x246)](_0x211020[_0x347fc7(0x1da)]);}else{if(_0x574313[_0x347fc7(0x216)]===_0x347fc7(0x19f)&&_0x574313['target']){const _0x378066=parseRef(_0x574313[_0x347fc7(0x1d7)]);if(_0x378066)_0x139e67[_0x347fc7(0x246)](_0x378066[_0x347fc7(0x1da)]);}}}}for(const _0x5dcd6c of _0x5af7ec){try{const _0x5c7e26=await this[_0x347fc7(0x203)][_0x347fc7(0x269)]({'projectId':_0x49ac2a,'name':_0x5dcd6c});_0x1b9391[_0x347fc7(0x26f)](_0x5dcd6c,_0x5c7e26['id']),_0x8b72ab[_0x347fc7(0x245)][_0x347fc7(0x277)]({'name':_0x5dcd6c,'action':_0x347fc7(0x27b),'id':_0x5c7e26['id']}),_0x8b72ab[_0x347fc7(0x1f6)]['imageGenerators'][_0x347fc7(0x27b)]++;}catch(_0xfd41d7){_0x8b72ab['imageGenerators'][_0x347fc7(0x277)]({'name':_0x5dcd6c,'action':_0x347fc7(0x1ba),'error':_0xfd41d7[_0x347fc7(0x1af)]}),_0x8b72ab[_0x347fc7(0x1f6)]['imageGenerators'][_0x347fc7(0x1a5)]++;}}for(const _0x2c8a9f of _0x139e67){try{const _0x14d8d8=await this[_0x347fc7(0x203)][_0x347fc7(0x238)]({'projectId':_0x49ac2a,'name':_0x2c8a9f});_0x1c9acc[_0x347fc7(0x26f)](_0x2c8a9f,_0x14d8d8['id']),_0x8b72ab[_0x347fc7(0x220)][_0x347fc7(0x277)]({'name':_0x2c8a9f,'action':_0x347fc7(0x27b),'id':_0x14d8d8['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x220)][_0x347fc7(0x27b)]++;}catch(_0x3a3c52){_0x8b72ab[_0x347fc7(0x220)][_0x347fc7(0x277)]({'name':_0x2c8a9f,'action':_0x347fc7(0x1ba),'error':_0x3a3c52[_0x347fc7(0x1af)]}),_0x8b72ab['counts'][_0x347fc7(0x220)][_0x347fc7(0x1a5)]++;}}const _0x113577=await fetchAllToolTargetMaps((_0xa56550,_0x15827a)=>this[_0x347fc7(0x203)][_0x347fc7(0x24c)](_0xa56550,_0x15827a),_0x49ac2a);let _0x373869=[];const _0x4d31ba={'projectId':_0x49ac2a,'resolveToolTargetId':buildIdResolver({..._0x113577[_0x347fc7(0x288)],'KnowledgeBase':_0x3aabec,'TextKnowledgeBase':_0x1fe7b8,'ExperimentalKnowledgeBase':_0x3faaf5,'Agent':_0x1bad79,'WebSearchTool':_0x1c9acc,'ImageGenerator':_0x1b9391}),'resolvePromptId':async _0x8b3c2=>_0x12b430[_0x347fc7(0x1c0)](_0x8b3c2),'onWarning':_0x2e8078=>{const _0x536451=_0x347fc7;this[_0x536451(0x1b4)]['warn'](_0x2e8078),_0x373869[_0x536451(0x277)](_0x2e8078);}};for(const _0x23aa9c of _0x5db401){try{const _0x4a43a4=yamlKnowledgeBaseToApi(_0x23aa9c['yaml'],_0x49ac2a),_0x586cce=await this[_0x347fc7(0x203)][_0x347fc7(0x264)](_0x4a43a4);_0x3aabec[_0x347fc7(0x26f)](_0x23aa9c['yaml'][_0x347fc7(0x1da)],_0x586cce['id']),_0x8b72ab[_0x347fc7(0x1e5)][_0x347fc7(0x277)]({'name':_0x23aa9c['yaml'][_0x347fc7(0x1da)],'action':_0x347fc7(0x27b),'id':_0x586cce['id']}),_0x8b72ab['counts'][_0x347fc7(0x1e5)][_0x347fc7(0x27b)]++;}catch(_0x193660){_0x8b72ab[_0x347fc7(0x1e5)][_0x347fc7(0x277)]({'name':_0x23aa9c[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x193660[_0x347fc7(0x1af)]}),_0x8b72ab['counts'][_0x347fc7(0x1e5)][_0x347fc7(0x1a5)]++;}}for(const _0x45474d of _0x2cec3b){try{const _0x342891=yamlTextKnowledgeBaseToApi({'name':_0x45474d[_0x347fc7(0x1da)],'text':_0x45474d[_0x347fc7(0x230)]},_0x49ac2a),_0x1ee9b9=await this[_0x347fc7(0x203)][_0x347fc7(0x1b0)](_0x342891);_0x1fe7b8[_0x347fc7(0x26f)](_0x45474d[_0x347fc7(0x1da)],_0x1ee9b9['id']),_0x8b72ab[_0x347fc7(0x25f)]['push']({'name':_0x45474d[_0x347fc7(0x1da)],'action':_0x347fc7(0x27b),'id':_0x1ee9b9['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x25f)][_0x347fc7(0x27b)]++;}catch(_0x4c4168){_0x8b72ab[_0x347fc7(0x25f)][_0x347fc7(0x277)]({'name':_0x45474d[_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x4c4168['message']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x25f)][_0x347fc7(0x1a5)]++;}}for(const _0x2e86c9 of _0x42c6c2){try{const _0x18feea=yamlExperimentalArtifactToApi(_0x2e86c9[_0x347fc7(0x290)],_0x49ac2a),_0x51c1de=await this[_0x347fc7(0x203)][_0x347fc7(0x21b)](_0x18feea);_0x62f5c7[_0x347fc7(0x26f)](_0x2e86c9[_0x347fc7(0x290)][_0x347fc7(0x1da)],_0x51c1de['id']),_0x8b72ab[_0x347fc7(0x20a)]['push']({'name':_0x2e86c9['def'][_0x347fc7(0x1da)],'action':_0x347fc7(0x27b),'id':_0x51c1de['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x20a)][_0x347fc7(0x27b)]++;}catch(_0x242e15){_0x8b72ab[_0x347fc7(0x20a)][_0x347fc7(0x277)]({'name':_0x2e86c9[_0x347fc7(0x290)]['name'],'action':_0x347fc7(0x1ba),'error':_0x242e15['message']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x20a)]['errors']++;}}for(const _0x276859 of _0x1a3e3b){try{const _0x27bacf=yamlExperimentalKnowledgeBaseToApi(_0x276859[_0x347fc7(0x290)],_0x49ac2a),_0x1e0f82=await this[_0x347fc7(0x203)]['createExperimentalKnowledgeBase'](_0x27bacf);_0x3faaf5[_0x347fc7(0x26f)](_0x276859[_0x347fc7(0x290)][_0x347fc7(0x1da)],_0x1e0f82['id']),_0x8b72ab[_0x347fc7(0x1cb)][_0x347fc7(0x277)]({'name':_0x276859[_0x347fc7(0x290)][_0x347fc7(0x1da)],'action':'created','id':_0x1e0f82['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x1cb)][_0x347fc7(0x27b)]++;}catch(_0x52b5f8){_0x8b72ab[_0x347fc7(0x1cb)][_0x347fc7(0x277)]({'name':_0x276859['def'][_0x347fc7(0x1da)],'action':'error','error':_0x52b5f8['message']}),_0x8b72ab['counts'][_0x347fc7(0x1cb)][_0x347fc7(0x1a5)]++;}}const _0x4a37cb=[..._0x9cd1b][_0x347fc7(0x23e)]((_0x5cde3e,_0x36fa2b)=>{const _0x10ced8=_0x347fc7,_0x5bc9e6=_0x5cde3e[_0x10ced8(0x28b)]['tools']?.['some'](_0x1f73a6=>_0x1f73a6['type']===_0x10ced8(0x1b7))??![],_0x1430bb=_0x36fa2b[_0x10ced8(0x28b)][_0x10ced8(0x17e)]?.[_0x10ced8(0x258)](_0x54281b=>_0x54281b['type']==='agent')??![];if(_0x5bc9e6&&!_0x1430bb)return 0x1;if(!_0x5bc9e6&&_0x1430bb)return-0x1;return 0x0;});for(const _0x201f07 of _0x4a37cb){_0x373869=[];try{const _0x461af6=_0x201f07[_0x347fc7(0x28b)]['tools']?.[_0x347fc7(0x18a)](_0x40b059=>{const _0x24b7d8=_0x347fc7;if(_0x40b059[_0x24b7d8(0x216)]==='agent'&&_0x40b059[_0x24b7d8(0x1d7)]){const _0x335e4c=parseRef(_0x40b059[_0x24b7d8(0x1d7)]);return _0x335e4c?.['name']===_0x201f07[_0x24b7d8(0x28b)][_0x24b7d8(0x1da)];}return![];})??[];if(_0x461af6[_0x347fc7(0x189)]>0x0){const _0x2367e5=_0x347fc7(0x25b)+_0x201f07[_0x347fc7(0x28b)][_0x347fc7(0x1da)]+_0x347fc7(0x1b3)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this[_0x347fc7(0x1b4)][_0x347fc7(0x1eb)](_0x2367e5),_0x373869[_0x347fc7(0x277)](_0x2367e5);}const _0x1842dc=await agentDefToRequest(_0x201f07['yaml'],_0x201f07['systemPrompt'],_0x201f07[_0x347fc7(0x1d0)],_0x4d31ba),_0x3740b2=await this[_0x347fc7(0x203)][_0x347fc7(0x1d1)](_0x1842dc);_0x1bad79['set'](_0x201f07['yaml'][_0x347fc7(0x1da)],_0x3740b2['id']),_0x8b72ab['agents'][_0x347fc7(0x277)]({'agentName':_0x201f07[_0x347fc7(0x28b)]['name'],'action':_0x347fc7(0x27b),'agentId':_0x3740b2['id'],'warnings':_0x373869[_0x347fc7(0x189)]>0x0?_0x373869:undefined}),_0x8b72ab[_0x347fc7(0x1f6)]['agents']['created']++;}catch(_0x4869b8){_0x8b72ab[_0x347fc7(0x1bc)][_0x347fc7(0x277)]({'agentName':_0x201f07['yaml'][_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x4869b8[_0x347fc7(0x1af)],'warnings':_0x373869['length']>0x0?_0x373869:undefined}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x1bc)][_0x347fc7(0x1a5)]++;}}for(const _0x3adfd0 of _0x19013c){try{const _0x33cafe=await yamlPromptToApi(_0x3adfd0[_0x347fc7(0x28b)],_0x49ac2a,_0x4d31ba);if(!_0x33cafe){_0x8b72ab[_0x347fc7(0x25d)][_0x347fc7(0x277)]({'name':_0x3adfd0[_0x347fc7(0x28b)]['name'],'action':'error','error':'Agent\x20reference\x20not\x20found'}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x25d)][_0x347fc7(0x1a5)]++;continue;}const _0x522e97=await this['client'][_0x347fc7(0x256)](_0x33cafe);_0x12b430[_0x347fc7(0x26f)](_0x3adfd0[_0x347fc7(0x28b)][_0x347fc7(0x1da)],_0x522e97['id']),_0x8b72ab[_0x347fc7(0x25d)][_0x347fc7(0x277)]({'name':_0x3adfd0[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':_0x347fc7(0x27b),'id':_0x522e97['id']}),_0x8b72ab['counts'][_0x347fc7(0x25d)][_0x347fc7(0x27b)]++;}catch(_0x1f3508){_0x8b72ab[_0x347fc7(0x25d)][_0x347fc7(0x277)]({'name':_0x3adfd0[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x1f3508[_0x347fc7(0x1af)]}),_0x8b72ab['counts'][_0x347fc7(0x25d)]['errors']++;}}for(const _0x54e76d of _0x4e691a){try{const _0x4390a3=await yamlIntegrationToApi(_0x54e76d[_0x347fc7(0x28b)],_0x49ac2a,_0x4d31ba),_0xd69e1f=await this[_0x347fc7(0x203)][_0x347fc7(0x1a9)](_0x4390a3);_0x8b72ab[_0x347fc7(0x180)]['push']({'name':_0x54e76d[_0x347fc7(0x28b)]['service_type'],'action':_0x347fc7(0x27b),'id':_0xd69e1f['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x180)][_0x347fc7(0x27b)]++;}catch(_0x3b7983){_0x8b72ab[_0x347fc7(0x180)][_0x347fc7(0x277)]({'name':_0x54e76d[_0x347fc7(0x28b)]['service_type'],'action':_0x347fc7(0x1ba),'error':_0x3b7983[_0x347fc7(0x1af)]}),_0x8b72ab[_0x347fc7(0x1f6)]['integrations']['errors']++;}}for(const _0x17a24d of _0x358682){try{const _0x2d886b=await yamlFormInterfaceToApi(_0x17a24d[_0x347fc7(0x28b)],_0x49ac2a,_0x4d31ba);if(!_0x2d886b){_0x8b72ab[_0x347fc7(0x194)][_0x347fc7(0x277)]({'name':_0x17a24d[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x347fc7(0x26c)}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x194)][_0x347fc7(0x1a5)]++;continue;}const _0x7404d8=await this['client'][_0x347fc7(0x1a3)](_0x2d886b);_0x8b72ab[_0x347fc7(0x194)][_0x347fc7(0x277)]({'name':_0x17a24d[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':_0x347fc7(0x27b),'id':_0x7404d8['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x194)][_0x347fc7(0x27b)]++;}catch(_0x13cbdb){_0x8b72ab[_0x347fc7(0x194)][_0x347fc7(0x277)]({'name':_0x17a24d[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':'error','error':_0x13cbdb['message']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x194)][_0x347fc7(0x1a5)]++;}}for(const _0x3a2357 of _0x52b041){try{const _0x17f7d6=await yamlChatInterfaceToApi(_0x3a2357['yaml'],_0x49ac2a,_0x4d31ba),_0x21ee0d=await this['client']['createChatInterface'](_0x17f7d6);_0x8b72ab[_0x347fc7(0x266)][_0x347fc7(0x277)]({'name':_0x3a2357[_0x347fc7(0x28b)]['name'],'action':_0x347fc7(0x27b),'id':_0x21ee0d['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x266)]['created']++;}catch(_0x3fd4a7){_0x8b72ab[_0x347fc7(0x266)]['push']({'name':_0x3a2357['yaml'][_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x3fd4a7['message']}),_0x8b72ab['counts'][_0x347fc7(0x266)][_0x347fc7(0x1a5)]++;}}return _0x8b72ab;}}
1
+ function a135_0x5999(_0x2ff02e,_0x5cbef3){_0x2ff02e=_0x2ff02e-0xeb;const _0x490818=a135_0x4908();let _0x5999a0=_0x490818[_0x2ff02e];return _0x5999a0;}const a135_0x10eab9=a135_0x5999;(function(_0x13a156,_0x556bb5){const _0x4b96e4=a135_0x5999,_0x19fe24=_0x13a156();while(!![]){try{const _0xadcd75=parseInt(_0x4b96e4(0x1fd))/0x1*(parseInt(_0x4b96e4(0x1b9))/0x2)+-parseInt(_0x4b96e4(0x18a))/0x3+parseInt(_0x4b96e4(0x127))/0x4+parseInt(_0x4b96e4(0x1c3))/0x5*(-parseInt(_0x4b96e4(0x1ab))/0x6)+parseInt(_0x4b96e4(0x1d6))/0x7*(parseInt(_0x4b96e4(0x199))/0x8)+parseInt(_0x4b96e4(0x10d))/0x9+-parseInt(_0x4b96e4(0x13f))/0xa;if(_0xadcd75===_0x556bb5)break;else _0x19fe24['push'](_0x19fe24['shift']());}catch(_0x5c9a85){_0x19fe24['push'](_0x19fe24['shift']());}}}(a135_0x4908,0x37986));import{LLMApiClient}from'../client/llm-api-client.js';import*as a135_0x4da327 from'node:fs';import*as a135_0x57e5bb 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=[a135_0x10eab9(0x171),a135_0x10eab9(0x1d7),'chat_parent_segment'];async function safeListOrEmpty(_0x4a247){const _0x410eca=a135_0x10eab9;try{return await _0x4a247();}catch(_0xeae2b5){if(_0xeae2b5 instanceof HTTPClientError&&_0xeae2b5[_0x410eca(0x155)]===0x194)return[];throw _0xeae2b5;}}function a135_0x4908(){const _0xa5079e=['chat_generic','setCurrentProject','text','agents','dryRun','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','createExperimentalKnowledgeBase','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','getChatHistory','experimentalArtifacts','llm_project','updated','createIntegration','stringify','utf-8','actions','listToolTargets','toISOString','description','prompt.md','.llm','---\x20file:\x20','context','site','57153iRwXQm','sdk.llm','Unsupported\x20backup\x20version:\x20','integrations.json','pullProject','modelType','INVALID_ARGUMENT','isDirectory','claude-4.5-sonnet','updateChatInterface','total','knowledgeBases','.yml','clearDefaultAgent','profile','52792jOLFsj','Available\x20agents:\x20','createProject','\x0a---\x20function:\x20','starterMessage','metadata','map','createAgent','tdDatabaseName','projectName','AGENT_NOT_FOUND','Renamed\x20form\x20interface\x20file:\x20','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','event','experimental_artifacts','Multiple\x20projects\x20found\x20with\x20name\x20\x27','writeFileSync','chat','66aEetBb','length','\x20→\x20','listProjects','LLM_PROJECT_NOT_FOUND','created','starter_message.md','Backup\x20folder\x20not\x20found:\x20','listExperimentalArtifacts','updateAgent','tools','push','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','join','26584DSjQfY','template','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.','updatePrompt','code','chatIgnoreManagedActions','Renamed\x20agent\x20folder:\x20','createChatInterface','Renamed\x20chat\x20interface\x20file:\x20','agentId','67385NCiNrj','nameToId','getDefaultProjectName','Removed\x20deleted\x20file:\x20','dry-run-','getAgent','createPrompt','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','\x0a\x0a#\x20agent.yml\x0a','\x20---\x0a','sort','textKnowledgeBases','deleteProject','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','Renamed\x20experimental\x20artifact\x20directory:\x20','readdirSync','isDir','dirname','updateAgentResponse','217snnMIR','chat_agent_console','json_schema.json','json_schema','Skipping\x20integration\x20\x27','Removed\x20deleted\x20directory:\x20','project.json','warn','listIntegrations','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','readFileSync','KnowledgeBase','existsSync','formInterfaces','tdx_','knowledge_bases','listChats','experimentalKnowledgeBases','jsonSchemaHint','prompts','Could\x20not\x20resolve\x20agent\x20reference','\x27\x20(','Output\x20directory\x20already\x20exists:\x20','resolveAgentId','size','version','Project\x20\x22','name','low','getOrCreateDefaultProject','listAgentsFull','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','loadJsonFile','\x0a---\x20code\x20---\x0a','updateExperimentalArtifact','form_interfaces','history','getOrCreateDefaultAgent','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','5jRnfVG','content','ALREADY_EXISTS','resolveProjectId','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','get','find','Unresolved\x20dependencies:\x20','UNAUTHENTICATED','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','imageGenerators','Renamed\x20prompt\x20file:\x20','No\x20tdx.json\x20found\x20in\x20','target','Agent\x20reference\x20not\x20found','unchanged','isFile','filter','createFormInterface','attributes','signal','toLowerCase','yaml','listKnowledgeBases',')\x20can\x20be\x20pushed.\x20','resolveProjectName','cwd','new','endsWith','reasoningEffort','updateKnowledgeBase','set','none','basename','exportedFrom','updateExperimentalKnowledgeBase','createExperimentalArtifact','Renamed\x20text\x20KB\x20file:\x20','\x22\x20already\x20exists','starter_message','statSync','error','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','systemPrompt','agentsFull','path','def','PERMISSION_DENIED','2744748wMEdHW','info','unlinkSync','Only\x20safe\x20types\x20(','listChatInterfaces','pushProject','createAgentResponse','serviceType','listExperimentalKnowledgeBases','files','webhookCorsOrigins','deleteAgent','.md','message',')\x20can\x20be\x20cloned.','integrations','action','agent.yml','includes','client','text_content','oldPath','pushAgent','agent.yml\x20not\x20found\x20in\x20','createImageGenerator','listTextKnowledgeBases','1650408UdocBA','listPrompts','listImageGenerators','backupProject','maxToolIterations','models','updateTextKnowledgeBase','localeCompare','outputs','mkdirSync','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','file_name','prompts.json','NOT_FOUND','Renamed\x20KB\x20file:\x20','code.js','temperature','isManaged','continueChat','\x27.\x20This\x20should\x20not\x20happen.','renamed','TextKnowledgeBase','chatInterfaces','errors','5935870fnMGJb','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','getBackupMetadata','currentProjectId','\x20attempts\x20due\x20to\x20name\x20conflicts.','type','):\x20','#\x20prompt.md\x0a','agents.json','getProject','add','project','chat_interfaces','webSearchTools','---\x20schema:\x20','listAgents','promptId','Agent\x20\x27','tdx_default_','listFormInterfaces','setDefaultAgent','status','ExperimentalKnowledgeBase','split','knowledgebases.json','experimental_knowledge_bases','agent','INTERNAL','\x20in\x20project\x20','tdx.json','getCurrentProject','startChat','has','Renamed\x20folder:\x20','deleteIntegration','idToName','Project\x20not\x20found:\x20','logger','getChatLog','service_type','counts','projects','Renamed\x20integration\x20file:\x20','createKnowledgeBase','\x0a---\x20schema:\x20','conflict','Agent\x20not\x20found:\x20','functions','some'];a135_0x4908=function(){return _0xa5079e;};return a135_0x4908();}export class LLMSDK{['currentProjectId'];[a135_0x10eab9(0x120)];[a135_0x10eab9(0x188)];['logger']=Logger['of'](a135_0x10eab9(0x18b));constructor(_0x1b8b62){const _0x4f7626=a135_0x10eab9;this['client']=new LLMApiClient(_0x1b8b62),this[_0x4f7626(0x188)]=_0x1b8b62;}[a135_0x10eab9(0x1c5)](){const _0x5e5dea=a135_0x10eab9,_0x31ba01=getSanitizedUsername();return _0x5e5dea(0x152)+_0x31ba01;}async[a135_0x10eab9(0x172)](_0x252d46){const _0x1a6bf0=a135_0x10eab9,{projectId:_0x3a129b}=await this[_0x1a6bf0(0xf6)](_0x252d46);this['currentProjectId']=_0x3a129b;}[a135_0x10eab9(0x15e)](){const _0x1fb0f2=a135_0x10eab9;return this[_0x1fb0f2(0x143)];}async[a135_0x10eab9(0x154)](_0x2abad4){const _0x495f96=a135_0x10eab9,_0x39af18=this[_0x495f96(0x188)]['profile'];let _0x1a7afb,_0x4505c6;if(_0x2abad4[_0x495f96(0x11f)]('/')){const _0x90690a=_0x2abad4[_0x495f96(0x157)]('/');if(_0x90690a[_0x495f96(0x1ac)]!==0x2)throw new SDKError(ErrorCode[_0x495f96(0x190)],'Invalid\x20agent\x20reference\x20format:\x20'+_0x2abad4,undefined,{'helpText':_0x495f96(0x141)});const [_0x4de047,_0xc7ab80]=_0x90690a;_0x1a7afb=await this['resolveProjectId'](_0x4de047),_0x4505c6=_0xc7ab80;}else _0x1a7afb=this[_0x495f96(0x143)]||(await this['getOrCreateDefaultProject']())['id'],_0x4505c6=_0x2abad4;const _0x37d621=await this['resolveAgentId'](_0x4505c6,_0x1a7afb),_0x1323ea=await this[_0x495f96(0x120)][_0x495f96(0x1c8)](_0x37d621);writeCachedLLMAgent(_0x1323ea[_0x495f96(0xf0)][_0x495f96(0x1f1)],_0x37d621,_0x1a7afb,_0x39af18);}['getDefaultAgent'](){const _0x5eefd5=a135_0x10eab9,_0x1b61bc=this['context'][_0x5eefd5(0x198)];return readCachedLLMAgent(_0x1b61bc)||undefined;}[a135_0x10eab9(0x197)](){const _0xc6d30f=a135_0x10eab9,_0xac4f93=this['context'][_0xc6d30f(0x198)];clearCachedLLMAgent(_0xac4f93);}async[a135_0x10eab9(0x12c)](){const _0x4fcef7=a135_0x10eab9,_0x34169b=await this[_0x4fcef7(0x120)]['getUserSettings']();return toModelInfos(_0x34169b);}async[a135_0x10eab9(0x19b)](_0x3e24db){const _0x5b066d=a135_0x10eab9;return await this['client'][_0x5b066d(0x19b)](_0x3e24db);}async[a135_0x10eab9(0x1cf)](_0x39c805){const _0x5da0c6=a135_0x10eab9,{projectId:_0x22cb0f}=await this[_0x5da0c6(0xf6)](_0x39c805);await this['client'][_0x5da0c6(0x1cf)](_0x22cb0f);}async[a135_0x10eab9(0x169)](_0x48954b=0x32){const _0x4a85b2=a135_0x10eab9;return await this[_0x4a85b2(0x120)][_0x4a85b2(0x1ae)](_0x48954b);}async[a135_0x10eab9(0x1f3)](_0x29df35){const _0x254c44=a135_0x10eab9,_0x159a6f=_0x29df35||this[_0x254c44(0x1c5)](),_0x9d1a3=this['context']['profile'];if(!_0x29df35){const _0x30ec0a=readCachedLLMProject(_0x9d1a3);if(_0x30ec0a&&_0x30ec0a[_0x254c44(0x1f1)]===_0x159a6f)try{const _0x488bdd=await this[_0x254c44(0x120)][_0x254c44(0x149)](_0x30ec0a['id']);if(_0x488bdd['attributes'][_0x254c44(0x1f1)]===_0x159a6f)return _0x488bdd;}catch{}}const _0x2c670a=await this[_0x254c44(0x120)][_0x254c44(0x1ae)](),_0x41e78f=_0x2c670a[_0x254c44(0x203)](_0x41e8f1=>_0x41e8f1[_0x254c44(0xf0)][_0x254c44(0x1f1)]===_0x159a6f);if(_0x41e78f)return!_0x29df35&&writeCachedLLMProject(_0x159a6f,_0x41e78f['id'],_0x9d1a3),_0x41e78f;const _0x283c5d=await this[_0x254c44(0x120)][_0x254c44(0x19b)]({'name':_0x159a6f,'description':_0x254c44(0x178)+getSanitizedUsername()+')'});return!_0x29df35&&writeCachedLLMProject(_0x159a6f,_0x283c5d['id'],_0x9d1a3),_0x283c5d;}async[a135_0x10eab9(0x200)](_0x1765a1){const _0x413d9b=a135_0x10eab9,_0xb56140=await this[_0x413d9b(0x120)][_0x413d9b(0x1ae)](),_0x2104ef=_0xb56140[_0x413d9b(0xee)](_0x533ea9=>_0x533ea9[_0x413d9b(0xf0)][_0x413d9b(0x1f1)]===_0x1765a1);if(_0x2104ef['length']===0x0)throw new SDKError(ErrorCode[_0x413d9b(0x1af)],_0x413d9b(0x164)+_0x1765a1,undefined,{'helpText':_0x413d9b(0x131)});if(_0x2104ef[_0x413d9b(0x1ac)]>0x1)throw new SDKError(ErrorCode[_0x413d9b(0x15b)],_0x413d9b(0x1a8)+_0x1765a1+_0x413d9b(0x13a));return _0x2104ef[0x0]['id'];}async[a135_0x10eab9(0xf6)](_0x30506a){const _0x190046=a135_0x10eab9,_0x5e1540=await this[_0x190046(0x120)][_0x190046(0x1ae)](),_0x297978=_0x5e1540['find'](_0x59b85d=>_0x59b85d[_0x190046(0xf0)][_0x190046(0x1f1)]===_0x30506a);if(_0x297978)return{'projectId':_0x297978['id'],'project':_0x297978};throw new SDKError(ErrorCode[_0x190046(0x1af)],_0x190046(0x164)+_0x30506a,undefined,{'helpText':_0x190046(0x131)});}async[a135_0x10eab9(0x1fb)](_0x420ac0=a135_0x10eab9(0x192),_0x309fc2=0x0,_0x468bdc){const _0x6989d4=a135_0x10eab9,_0x21c9a8=0xa;let _0x453c81=0x0,_0x33b04a;while(_0x453c81<_0x21c9a8){try{const _0x460270=await this[_0x6989d4(0x1f3)](_0x33b04a),_0x4e6950=_0x460270['id'],_0xf1d230=[_0x6989d4(0xfd),'minimal',_0x6989d4(0x1f2),'medium','high'],_0x327cb0=_0x309fc2===0x0?_0x6989d4(0x1e4)+_0x420ac0:_0x6989d4(0x1e4)+_0x420ac0+'_reasoning_'+_0xf1d230[_0x309fc2],_0x3ee316=await this[_0x6989d4(0x120)]['listAgents'](_0x4e6950),_0x1f4a7f=_0x3ee316['find'](_0x4d3d89=>_0x4d3d89['attributes'][_0x6989d4(0x1f1)]===_0x327cb0);if(_0x1f4a7f)return _0x1f4a7f;const _0x1f77b0=_0x309fc2>0x0?0x1:_0x468bdc;return await this[_0x6989d4(0x120)][_0x6989d4(0x1a0)]({'name':_0x327cb0,'projectId':_0x4e6950,'modelType':_0x420ac0,'systemPrompt':'','temperature':_0x1f77b0,'reasoningEffort':_0x309fc2>0x0?_0x309fc2:undefined});}catch(_0x50dbbc){if(_0x50dbbc instanceof HTTPClientError){const _0x1b9d12=_0x50dbbc[_0x6989d4(0x155)];if(_0x1b9d12>=0x190&&_0x1b9d12<0x1f4){if(_0x1b9d12===0x191)throw new SDKError(ErrorCode[_0x6989d4(0x205)],'Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.',_0x50dbbc);else{if(_0x1b9d12===0x193)throw new SDKError(ErrorCode[_0x6989d4(0x10c)],_0x6989d4(0x176),_0x50dbbc);}throw _0x50dbbc;}}if(errorContains(_0x50dbbc,'already\x20exists','duplicate',_0x6989d4(0x16d))){_0x453c81++;if(_0x453c81>=_0x21c9a8)throw new SDKError(ErrorCode['ALREADY_EXISTS'],'Unable\x20to\x20create\x20project\x20after\x20'+_0x21c9a8+_0x6989d4(0x144),_0x50dbbc);const _0x4584ad=this['getDefaultProjectName']();_0x33b04a=_0x4584ad+'_'+generateRandomHex();continue;}throw _0x50dbbc;}}throw new SDKError(ErrorCode[_0x6989d4(0x15b)],_0x6989d4(0x1f5));}async[a135_0x10eab9(0x1ed)](_0x3b3749,_0x43f43e){const _0x3bed69=a135_0x10eab9,_0x19c6c2=_0x43f43e||this['currentProjectId'],_0x4d302a=await this['client'][_0x3bed69(0x14f)](_0x19c6c2),_0x12f142=_0x4d302a[_0x3bed69(0xee)](_0x1395b5=>_0x1395b5['attributes'][_0x3bed69(0x1f1)]===_0x3b3749);if(_0x12f142[_0x3bed69(0x1ac)]===0x0){const _0x31043c=_0x19c6c2?_0x3bed69(0x15c)+_0x19c6c2:'';throw new SDKError(ErrorCode[_0x3bed69(0x1a3)],_0x3bed69(0x16e)+_0x3b3749+_0x31043c,undefined,{'helpText':_0x19c6c2?_0x3bed69(0x1a5):_0x3bed69(0x1bb)});}if(_0x12f142['length']>0x1)throw new SDKError(ErrorCode[_0x3bed69(0x15b)],'Multiple\x20agents\x20found\x20with\x20name\x20\x27'+_0x3b3749+_0x3bed69(0x13a));return _0x12f142[0x0]['id'];}async['agents'](_0x52f3b5){const _0x5a6fa2=a135_0x10eab9,_0x7b6daa=_0x52f3b5||this['currentProjectId'];return await this['client'][_0x5a6fa2(0x14f)](_0x7b6daa);}async[a135_0x10eab9(0x109)](_0x358e32){const _0x1e2084=a135_0x10eab9;return await this[_0x1e2084(0x120)]['listAgentsFull'](_0x358e32);}async[a135_0x10eab9(0x15a)](_0x2002b2){const _0xf56e64=a135_0x10eab9;return await this[_0xf56e64(0x120)]['getAgent'](_0x2002b2);}async[a135_0x10eab9(0x1a0)](_0x57fe57){const _0x51e3ee=a135_0x10eab9;return await this[_0x51e3ee(0x120)][_0x51e3ee(0x1a0)](_0x57fe57);}async[a135_0x10eab9(0x1b4)](_0xfe3d03,_0x3b09d2){return await this['client']['updateAgent'](_0xfe3d03,_0x3b09d2);}async[a135_0x10eab9(0x118)](_0x143d9a){const _0x4ed4ad=a135_0x10eab9;await this[_0x4ed4ad(0x120)][_0x4ed4ad(0x118)](_0x143d9a);}async[a135_0x10eab9(0x15f)](_0x5d3680){const _0x1a4688=a135_0x10eab9;return await this[_0x1a4688(0x120)][_0x1a4688(0x15f)]({'agentId':_0x5d3680});}async*[a135_0x10eab9(0x1aa)](_0x174c6e,_0x43841d){const _0x3df6e7=a135_0x10eab9;let _0x14ac64=_0x43841d?.['chatId'];const _0x18dc44=_0x43841d?.[_0x3df6e7(0x1c2)];if(!_0x14ac64){if(!_0x18dc44)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x55bd50=await this[_0x3df6e7(0x120)][_0x3df6e7(0x15f)]({'agentId':_0x18dc44});_0x14ac64=_0x55bd50['id'],yield{'type':_0x3df6e7(0x19e),'data':{'chatId':_0x14ac64,'agentId':_0x18dc44,'projectId':_0x55bd50[_0x3df6e7(0xf0)]['projectId']}};}for await(const _0x1fab30 of this[_0x3df6e7(0x120)][_0x3df6e7(0x139)](_0x14ac64,_0x174c6e,_0x43841d?.[_0x3df6e7(0xf1)])){yield{'type':_0x3df6e7(0x1a6),'data':_0x1fab30};}}async['chats'](_0x363273=0x32){const _0x55039c=a135_0x10eab9;return await this[_0x55039c(0x120)][_0x55039c(0x1e6)](_0x363273);}async[a135_0x10eab9(0x1fa)](_0x4d7a7b){const _0x1c4b0b=a135_0x10eab9;return await this[_0x1c4b0b(0x120)][_0x1c4b0b(0x17a)](_0x4d7a7b);}async[a135_0x10eab9(0x166)](_0x2ff633){const _0x1fb763=a135_0x10eab9;return await this[_0x1fb763(0x120)][_0x1fb763(0x166)](_0x2ff633);}async['chatInfo'](_0xb33ba8){const _0x446c4d=a135_0x10eab9;return await this[_0x446c4d(0x120)]['getChatInfo'](_0xb33ba8);}async[a135_0x10eab9(0x12a)](_0x1b1863,_0x3137b5,_0x2bfa54){const _0x3d1178=a135_0x10eab9,_0x409d28=_0x2bfa54?.[_0x3d1178(0x175)]??![],{projectId:_0x507b4a,project:_0x3c1deb}=await this[_0x3d1178(0xf6)](_0x1b1863),_0x13f896=_0x3c1deb['attributes'][_0x3d1178(0x1f1)],_0x287b4f=_0x3137b5||_0x13f896+_0x3d1178(0x186);if(a135_0x4da327[_0x3d1178(0x1e2)](_0x287b4f)&&!_0x409d28)throw new SDKError(ErrorCode[_0x3d1178(0x1ff)],_0x3d1178(0x1ec)+_0x287b4f,undefined,{'helpText':_0x3d1178(0x179)});const _0x3d884a=await this[_0x3d1178(0x120)][_0x3d1178(0x1f4)](_0x507b4a),_0x5afb6f=await this['client'][_0x3d1178(0xf4)](_0x507b4a),_0x371432=await this[_0x3d1178(0x120)][_0x3d1178(0x128)](_0x507b4a),_0x2af379=await this[_0x3d1178(0x120)][_0x3d1178(0x1de)](_0x507b4a);if(!_0x409d28){a135_0x4da327[_0x3d1178(0x130)](_0x287b4f,{'recursive':!![]});const _0x4ebd6a={'version':'1.0','exportedAt':new Date()[_0x3d1178(0x183)](),'exportedFrom':{'site':this['context'][_0x3d1178(0x189)],'projectId':_0x507b4a,'projectName':_0x13f896},'project':_0x3c1deb};a135_0x4da327[_0x3d1178(0x1a9)](a135_0x57e5bb[_0x3d1178(0x1b8)](_0x287b4f,_0x3d1178(0x1dc)),JSON[_0x3d1178(0x17f)](_0x4ebd6a,null,0x2)),a135_0x4da327[_0x3d1178(0x1a9)](a135_0x57e5bb[_0x3d1178(0x1b8)](_0x287b4f,_0x3d1178(0x148)),JSON[_0x3d1178(0x17f)](_0x3d884a,null,0x2)),a135_0x4da327[_0x3d1178(0x1a9)](a135_0x57e5bb[_0x3d1178(0x1b8)](_0x287b4f,_0x3d1178(0x158)),JSON[_0x3d1178(0x17f)](_0x5afb6f,null,0x2)),a135_0x4da327[_0x3d1178(0x1a9)](a135_0x57e5bb[_0x3d1178(0x1b8)](_0x287b4f,_0x3d1178(0x133)),JSON[_0x3d1178(0x17f)](_0x371432,null,0x2)),a135_0x4da327[_0x3d1178(0x1a9)](a135_0x57e5bb[_0x3d1178(0x1b8)](_0x287b4f,_0x3d1178(0x18d)),JSON['stringify'](_0x2af379,null,0x2));}return{'projectName':_0x13f896,'outputDir':_0x287b4f,'counts':{'agents':_0x3d884a[_0x3d1178(0x1ac)],'knowledgeBases':_0x5afb6f[_0x3d1178(0x1ac)],'prompts':_0x371432['length'],'integrations':_0x2af379[_0x3d1178(0x1ac)]}};}async['restoreProject'](_0x7958b5,_0xa356cd){const _0x102b23=a135_0x10eab9,_0x9565ec=_0xa356cd?.[_0x102b23(0x175)]??![],_0x487bd4=this[_0x102b23(0x142)](_0x7958b5),_0x4094f4=_0x487bd4[_0x102b23(0xff)][_0x102b23(0x189)],_0x3e4b79=this[_0x102b23(0x188)][_0x102b23(0x189)],_0x201e85=_0x4094f4!==_0x3e4b79?_0x4094f4:undefined,_0x4160d6=this[_0x102b23(0x1f6)](a135_0x57e5bb[_0x102b23(0x1b8)](_0x7958b5,_0x102b23(0x148)),[]),_0x594b1f=this[_0x102b23(0x1f6)](a135_0x57e5bb[_0x102b23(0x1b8)](_0x7958b5,_0x102b23(0x158)),[]),_0x38c075=this[_0x102b23(0x1f6)](a135_0x57e5bb['join'](_0x7958b5,'prompts.json'),[]),_0x356040=this['loadJsonFile'](a135_0x57e5bb[_0x102b23(0x1b8)](_0x7958b5,_0x102b23(0x18d)),[]),_0x588bd1=_0xa356cd?.[_0x102b23(0x1f1)]||_0x487bd4[_0x102b23(0xff)][_0x102b23(0x1a2)];if(_0x9565ec){const _0x3c0d9d=new Map(),_0x1caaf2=[..._0x4160d6],_0xa7e515=_0x4160d6[_0x102b23(0x1ac)]+0x1;let _0x4a0259=0x0;while(_0x1caaf2[_0x102b23(0x1ac)]>0x0&&_0x4a0259<_0xa7e515){_0x4a0259++;const _0x50e3f4=[];for(const _0x7e2137 of _0x1caaf2){canCreateAgent(_0x7e2137,_0x3c0d9d)?_0x3c0d9d[_0x102b23(0xfc)](_0x7e2137['id'],_0x102b23(0x1c7)+_0x7e2137['id']):_0x50e3f4[_0x102b23(0x1b6)](_0x7e2137);}if(_0x50e3f4[_0x102b23(0x1ac)]===_0x1caaf2[_0x102b23(0x1ac)])throw new SDKError(ErrorCode['INTERNAL'],_0x102b23(0x107),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x1caaf2['length']=0x0,_0x1caaf2[_0x102b23(0x1b6)](..._0x50e3f4);}const _0x2d4189=_0x38c075[_0x102b23(0xee)](_0x21bae5=>_0x3c0d9d[_0x102b23(0x160)](_0x21bae5[_0x102b23(0xf0)]['agentId']))[_0x102b23(0x1ac)];return{'projectName':_0x588bd1,'projectId':'(dry-run)','counts':{'agents':_0x4160d6['length'],'knowledgeBases':_0x594b1f[_0x102b23(0x1ac)],'prompts':_0x2d4189,'integrations':_0x356040[_0x102b23(0x1ac)]},'sourceSite':_0x201e85};}const _0x366d4e=await this[_0x102b23(0x120)][_0x102b23(0x19b)]({'name':_0x588bd1,'description':_0x487bd4[_0x102b23(0x14b)][_0x102b23(0xf0)][_0x102b23(0x184)]}),_0x4ff718=_0x366d4e['id'],_0x56bdf1=new Map(),_0xeabbf4=new Map(),_0x3b6faa=new Map();for(const _0x5e1dbc of _0x594b1f){const _0x262e94=await this[_0x102b23(0x120)][_0x102b23(0x16b)]({'projectId':_0x4ff718,'name':_0x5e1dbc[_0x102b23(0xf0)]['name'],'tdDatabaseName':_0x5e1dbc['attributes'][_0x102b23(0x1a1)],'tables':_0x5e1dbc[_0x102b23(0xf0)]['tables']});_0x56bdf1[_0x102b23(0xfc)](_0x5e1dbc['id'],_0x262e94['id']);}const _0x40ec62=[..._0x4160d6],_0x22c29a=_0x4160d6[_0x102b23(0x1ac)]+0x1;let _0xc60f6b=0x0;while(_0x40ec62['length']>0x0&&_0xc60f6b<_0x22c29a){_0xc60f6b++;const _0x4eef1b=[];for(const _0x58262c of _0x40ec62){if(canCreateAgent(_0x58262c,_0xeabbf4)){const _0x43b05a=remapToolIds(_0x58262c[_0x102b23(0xf0)][_0x102b23(0x1b5)],_0x56bdf1,_0xeabbf4),_0x390cbd=remapVariableIds(_0x58262c[_0x102b23(0xf0)]['variables'],_0x56bdf1),_0x245a83=await this[_0x102b23(0x120)][_0x102b23(0x113)]({'name':_0x58262c[_0x102b23(0xf0)][_0x102b23(0x1f1)],'projectId':_0x4ff718,'systemPrompt':_0x58262c[_0x102b23(0xf0)][_0x102b23(0x108)],'starterMessage':_0x58262c[_0x102b23(0xf0)][_0x102b23(0x19d)],'modelType':migrateModelType(_0x58262c[_0x102b23(0xf0)][_0x102b23(0x18f)]),'maxToolIterations':_0x58262c[_0x102b23(0xf0)][_0x102b23(0x12b)],'temperature':_0x58262c[_0x102b23(0xf0)][_0x102b23(0x137)],'reasoningEffort':_0x58262c[_0x102b23(0xf0)][_0x102b23(0xfa)],'outputs':_0x58262c['attributes'][_0x102b23(0x12f)],'tools':_0x43b05a,'variables':_0x390cbd});_0xeabbf4[_0x102b23(0xfc)](_0x58262c['id'],_0x245a83['id']);}else _0x4eef1b[_0x102b23(0x1b6)](_0x58262c);}if(_0x4eef1b[_0x102b23(0x1ac)]===_0x40ec62[_0x102b23(0x1ac)])throw new SDKError(ErrorCode[_0x102b23(0x15b)],_0x102b23(0x107),undefined,{'helpText':_0x102b23(0x206)});_0x40ec62[_0x102b23(0x1ac)]=0x0,_0x40ec62[_0x102b23(0x1b6)](..._0x4eef1b);}for(const _0x24e6f2 of _0x38c075){const _0x52f8fa=_0xeabbf4['get'](_0x24e6f2['attributes']['agentId']);if(!_0x52f8fa)continue;const _0x30e581=await this[_0x102b23(0x120)]['createPrompt']({'projectId':_0x4ff718,'agentId':_0x52f8fa,'name':_0x24e6f2[_0x102b23(0xf0)][_0x102b23(0x1f1)],'systemPrompt':_0x24e6f2[_0x102b23(0xf0)]['systemPrompt'],'template':_0x24e6f2[_0x102b23(0xf0)][_0x102b23(0x1ba)],'jsonSchemaHint':_0x24e6f2[_0x102b23(0xf0)][_0x102b23(0x1e8)]});_0x3b6faa[_0x102b23(0xfc)](_0x24e6f2['id'],_0x30e581['id']);}for(const _0x4fb3fb of _0x356040){const _0x28a01c=_0x4fb3fb[_0x102b23(0xf0)][_0x102b23(0x181)][_0x102b23(0x19f)](_0x339bce=>({..._0x339bce,'promptId':_0x3b6faa['get'](_0x339bce[_0x102b23(0x150)])||_0x339bce['promptId']}));await this[_0x102b23(0x120)][_0x102b23(0x17e)]({'projectId':_0x4ff718,'serviceType':_0x4fb3fb[_0x102b23(0xf0)]['serviceType'],'actions':_0x28a01c,'slackMessageMode':_0x4fb3fb[_0x102b23(0xf0)]['slackMessageMode'],'chatIgnoreManagedActions':_0x4fb3fb['attributes'][_0x102b23(0x1be)],'chatWelcomeMessage':_0x4fb3fb[_0x102b23(0xf0)]['chatWelcomeMessage'],'webhookCorsOrigins':_0x4fb3fb['attributes'][_0x102b23(0x117)]});}return{'projectName':_0x588bd1,'projectId':_0x4ff718,'counts':{'agents':_0xeabbf4[_0x102b23(0x1ee)],'knowledgeBases':_0x56bdf1[_0x102b23(0x1ee)],'prompts':_0x3b6faa[_0x102b23(0x1ee)],'integrations':_0x356040[_0x102b23(0x1ac)]},'sourceSite':_0x201e85};}[a135_0x10eab9(0x1f6)](_0x5772fe,_0x1c49ae){const _0x49253a=a135_0x10eab9;if(!a135_0x4da327[_0x49253a(0x1e2)](_0x5772fe))return _0x1c49ae;return JSON['parse'](a135_0x4da327[_0x49253a(0x1e0)](_0x5772fe,_0x49253a(0x180)));}[a135_0x10eab9(0x142)](_0x120b0a){const _0x1e3d82=a135_0x10eab9;if(!a135_0x4da327[_0x1e3d82(0x1e2)](_0x120b0a))throw new SDKError(ErrorCode[_0x1e3d82(0x134)],_0x1e3d82(0x1b2)+_0x120b0a,undefined,{'helpText':_0x1e3d82(0x140)});const _0x4911e3=a135_0x57e5bb[_0x1e3d82(0x1b8)](_0x120b0a,_0x1e3d82(0x1dc));if(!a135_0x4da327[_0x1e3d82(0x1e2)](_0x4911e3))throw new SDKError(ErrorCode[_0x1e3d82(0x190)],_0x1e3d82(0x1d0)+_0x120b0a,undefined,{'helpText':_0x1e3d82(0x201)});const _0x333014=JSON['parse'](a135_0x4da327[_0x1e3d82(0x1e0)](_0x4911e3,_0x1e3d82(0x180)));if(!isSupportedBackupVersion(_0x333014[_0x1e3d82(0x1ef)]))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1e3d82(0x18c)+_0x333014['version'],undefined,{'helpText':_0x1e3d82(0x1fc)});return _0x333014;}async[a135_0x10eab9(0x18e)](_0x25bc30,_0x3fe759,_0x3e037f){const _0x57c0ea=a135_0x10eab9,{projectId:_0x1b398f,project:_0x5485c6}=await this['resolveProjectName'](_0x25bc30),_0x21f266=_0x5485c6['attributes']['name'];let _0x2a6576;if(_0x3fe759)_0x2a6576=_0x3fe759;else{const _0x5338da=a135_0x57e5bb['join'](process[_0x57c0ea(0xf7)](),_0x57c0ea(0x174)),_0x5d7b44=getSanitizedPathWithMigration(_0x5338da,_0x21f266);_0x5d7b44[_0x57c0ea(0x13b)]&&this[_0x57c0ea(0x165)][_0x57c0ea(0x10e)](_0x57c0ea(0x161)+a135_0x57e5bb['basename'](_0x5d7b44['oldPath'])+_0x57c0ea(0x1ad)+a135_0x57e5bb[_0x57c0ea(0xfe)](_0x5d7b44[_0x57c0ea(0x10a)])),_0x2a6576=_0x5d7b44['path'];}const _0x54aee0=await this['client'][_0x57c0ea(0x1f4)](_0x1b398f),_0x533935=await this[_0x57c0ea(0x120)][_0x57c0ea(0xf4)](_0x1b398f),_0x8a0226=await this[_0x57c0ea(0x120)][_0x57c0ea(0x126)](_0x1b398f),_0x36d914=await safeListOrEmpty(()=>this[_0x57c0ea(0x120)][_0x57c0ea(0x129)](_0x1b398f)),_0x4750d0=await safeListOrEmpty(()=>this[_0x57c0ea(0x120)]['listWebSearchTools'](_0x1b398f)),_0x1d1cbd=await this['client'][_0x57c0ea(0x128)](_0x1b398f),_0x8eab6b=await this[_0x57c0ea(0x120)]['listIntegrations'](_0x1b398f),_0x5e2278=await safeListOrEmpty(()=>this[_0x57c0ea(0x120)]['listExperimentalKnowledgeBases'](_0x1b398f)),_0x41d889=await safeListOrEmpty(()=>this[_0x57c0ea(0x120)][_0x57c0ea(0x1b3)](_0x1b398f)),_0x5e9b60=await safeListOrEmpty(()=>this[_0x57c0ea(0x120)][_0x57c0ea(0x153)](_0x1b398f)),_0x292f80=await safeListOrEmpty(()=>this['client'][_0x57c0ea(0x111)](_0x1b398f)),_0x564840=_0x8eab6b[_0x57c0ea(0xee)](_0x157141=>!_0x157141[_0x57c0ea(0xf0)][_0x57c0ea(0x138)]&&SAFE_INTEGRATION_TYPES[_0x57c0ea(0x11f)](_0x157141[_0x57c0ea(0xf0)]['serviceType'][_0x57c0ea(0xf2)]())),_0x34fef4=new Map(),_0x545ef6=new Map(),_0x28f279=new Map(),_0x4af424=new Map(),_0x39f894=new Map(),_0x519c77=new Map(),_0xb3a2a1=new Map();for(const _0x4a955d of _0x54aee0){_0x34fef4[_0x57c0ea(0xfc)](_0x4a955d['id'],_0x4a955d[_0x57c0ea(0xf0)][_0x57c0ea(0x1f1)]);}for(const _0xe51bdc of _0x533935){_0x545ef6[_0x57c0ea(0xfc)](_0xe51bdc['id'],_0xe51bdc[_0x57c0ea(0xf0)][_0x57c0ea(0x1f1)]);}for(const _0x240ce6 of _0x8a0226){_0x28f279[_0x57c0ea(0xfc)](_0x240ce6['id'],_0x240ce6[_0x57c0ea(0xf0)][_0x57c0ea(0x1f1)]);}for(const _0x32f3dd of _0x36d914){_0x4af424[_0x57c0ea(0xfc)](_0x32f3dd['id'],_0x32f3dd['attributes'][_0x57c0ea(0x1f1)]);}for(const _0x5c95cf of _0x4750d0){_0x39f894[_0x57c0ea(0xfc)](_0x5c95cf['id'],_0x5c95cf['attributes']['name']);}for(const _0x12fdcd of _0x1d1cbd){_0x519c77['set'](_0x12fdcd['id'],_0x12fdcd[_0x57c0ea(0xf0)][_0x57c0ea(0x1f1)]);}for(const _0x3cb570 of _0x5e2278){_0xb3a2a1[_0x57c0ea(0xfc)](_0x3cb570['id'],_0x3cb570[_0x57c0ea(0xf0)][_0x57c0ea(0x1f1)]);}const _0xf1b9f4={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x545ef6,'TextKnowledgeBase':_0x28f279,'Agent':_0x34fef4,'WebSearchTool':_0x39f894,'ImageGenerator':_0x4af424,'ExperimentalKnowledgeBase':_0xb3a2a1}),'resolvePromptName':async _0x288b72=>_0x519c77[_0x57c0ea(0x202)](_0x288b72),'onWarning':_0x439be5=>this['logger'][_0x57c0ea(0x1dd)](_0x439be5)},_0x15c478={'projectName':_0x21f266,'outputDir':_0x2a6576,'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}}},_0x1f3a1a=[],_0x25fd2c=[];for(const _0x11045c of _0x54aee0){const _0x1e1baf=getSanitizedPathWithMigration(_0x2a6576,_0x11045c['attributes'][_0x57c0ea(0x1f1)]);_0x1e1baf[_0x57c0ea(0x13b)]&&this[_0x57c0ea(0x165)][_0x57c0ea(0x10e)](_0x57c0ea(0x1bf)+a135_0x57e5bb[_0x57c0ea(0xfe)](_0x1e1baf[_0x57c0ea(0x122)])+'\x20→\x20'+a135_0x57e5bb[_0x57c0ea(0xfe)](_0x1e1baf[_0x57c0ea(0x10a)]));const _0x106ec4=_0x1e1baf[_0x57c0ea(0x10a)],_0x24550f=a135_0x57e5bb['join'](_0x106ec4,'prompt.md'),_0x5db8ee=a135_0x57e5bb[_0x57c0ea(0x1b8)](_0x106ec4,_0x57c0ea(0x11e)),_0x14cb20=a135_0x57e5bb[_0x57c0ea(0x1b8)](_0x106ec4,_0x57c0ea(0x1b1)),{yaml:_0x58bdc3,systemPrompt:_0x1b38fe,starterMessage:_0x218195}=await agentResponseToDef(_0x11045c,_0xf1b9f4),_0x539f8c=toAgentYamlString(_0x58bdc3),_0x9b204=!a135_0x4da327[_0x57c0ea(0x1e2)](_0x5db8ee);let _0xf31ad0=_0x9b204,_0x579ba3;if(!_0x9b204){const _0x55e75b=a135_0x4da327[_0x57c0ea(0x1e2)](_0x24550f)?a135_0x4da327['readFileSync'](_0x24550f,_0x57c0ea(0x180)):'',_0x1bce6b=a135_0x4da327[_0x57c0ea(0x1e0)](_0x5db8ee,_0x57c0ea(0x180)),_0x57eedd=_0x57c0ea(0x147)+_0x55e75b+_0x57c0ea(0x1cb)+_0x1bce6b,_0x59219b=_0x57c0ea(0x147)+_0x1b38fe+_0x57c0ea(0x1cb)+_0x539f8c,_0x4d3204=generateDiff(_0x57eedd,_0x59219b);_0xf31ad0=hasChanges(_0x4d3204),_0xf31ad0&&(_0x579ba3=formatDiffWithColors(_0x4d3204));}_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0x106ec4,'content':'','isDir':!![]}),_0x1f3a1a['push']({'path':_0x24550f,'content':_0x1b38fe}),_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0x5db8ee,'content':_0x539f8c});_0x218195&&_0x218195[_0x57c0ea(0x11f)]('\x0a')&&_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0x14cb20,'content':_0x218195});_0x15c478[_0x57c0ea(0x174)][_0x57c0ea(0x1b6)]({'agentName':_0x11045c[_0x57c0ea(0xf0)][_0x57c0ea(0x1f1)],'outputPath':_0x106ec4,'isNew':_0x9b204,'hasChanges':_0xf31ad0,'diff':_0x579ba3}),_0x15c478['counts']['agents']['total']++;if(_0x9b204)_0x15c478['counts']['agents'][_0x57c0ea(0xf8)]++;else{if(_0xf31ad0)_0x15c478[_0x57c0ea(0x168)]['agents'][_0x57c0ea(0x17d)]++;else _0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x174)][_0x57c0ea(0xec)]++;}}for(const _0x34a4dc of _0x533935){if(_0x34a4dc['attributes']['isManaged'])continue;const _0x4ef5d5=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x2a6576),_0x34a4dc[_0x57c0ea(0xf0)][_0x57c0ea(0x1f1)],_0x57c0ea(0x196));_0x4ef5d5[_0x57c0ea(0x13b)]&&this[_0x57c0ea(0x165)][_0x57c0ea(0x10e)](_0x57c0ea(0x135)+a135_0x57e5bb[_0x57c0ea(0xfe)](_0x4ef5d5[_0x57c0ea(0x122)])+'\x20→\x20'+a135_0x57e5bb[_0x57c0ea(0xfe)](_0x4ef5d5['path']));const _0x173b5f=_0x4ef5d5[_0x57c0ea(0x10a)],_0x363446=apiKnowledgeBaseToYaml(_0x34a4dc),_0x221a13=toKnowledgeBaseYamlString(_0x363446),_0x5c9b10=!a135_0x4da327['existsSync'](_0x173b5f);let _0x4ffe36=_0x5c9b10,_0x43fd30;if(!_0x5c9b10){const _0xaaf6a9=a135_0x4da327['readFileSync'](_0x173b5f,'utf-8'),_0x392939=generateDiff(_0xaaf6a9,_0x221a13);_0x4ffe36=hasChanges(_0x392939),_0x4ffe36&&(_0x43fd30=formatDiffWithColors(_0x392939));}_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0x173b5f,'content':_0x221a13}),_0x15c478[_0x57c0ea(0x195)]['push']({'name':_0x34a4dc[_0x57c0ea(0xf0)][_0x57c0ea(0x1f1)],'outputPath':_0x173b5f,'isNew':_0x5c9b10,'hasChanges':_0x4ffe36,'diff':_0x43fd30}),_0x15c478[_0x57c0ea(0x168)]['knowledgeBases'][_0x57c0ea(0x194)]++;if(_0x5c9b10)_0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x195)]['new']++;else{if(_0x4ffe36)_0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x195)]['updated']++;else _0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x195)][_0x57c0ea(0xec)]++;}}for(const _0x26e4ad of _0x8a0226){if(_0x26e4ad['attributes'][_0x57c0ea(0x138)])continue;const _0xd10c25=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x2a6576),_0x26e4ad['attributes']['name'],_0x57c0ea(0x119));_0xd10c25['renamed']&&this['logger']['info'](_0x57c0ea(0x102)+a135_0x57e5bb[_0x57c0ea(0xfe)](_0xd10c25[_0x57c0ea(0x122)])+_0x57c0ea(0x1ad)+a135_0x57e5bb[_0x57c0ea(0xfe)](_0xd10c25[_0x57c0ea(0x10a)]));const _0x348142=_0xd10c25[_0x57c0ea(0x10a)],_0x34413f=toTextKnowledgeBaseMd(_0x26e4ad[_0x57c0ea(0xf0)]['name'],_0x26e4ad[_0x57c0ea(0xf0)][_0x57c0ea(0x173)]),_0x7a4d1=!a135_0x4da327['existsSync'](_0x348142);let _0x5999ee=_0x7a4d1,_0x3f4093;if(!_0x7a4d1){const _0x1fceae=a135_0x4da327[_0x57c0ea(0x1e0)](_0x348142,_0x57c0ea(0x180)),_0xca3d0e=generateDiff(_0x1fceae,_0x34413f);_0x5999ee=hasChanges(_0xca3d0e),_0x5999ee&&(_0x3f4093=formatDiffWithColors(_0xca3d0e));}_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0x348142,'content':_0x34413f}),_0x15c478[_0x57c0ea(0x1ce)][_0x57c0ea(0x1b6)]({'name':_0x26e4ad['attributes'][_0x57c0ea(0x1f1)],'outputPath':_0x348142,'isNew':_0x7a4d1,'hasChanges':_0x5999ee,'diff':_0x3f4093}),_0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x1ce)][_0x57c0ea(0x194)]++;if(_0x7a4d1)_0x15c478['counts'][_0x57c0ea(0x1ce)]['new']++;else{if(_0x5999ee)_0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x1ce)][_0x57c0ea(0x17d)]++;else _0x15c478['counts']['textKnowledgeBases']['unchanged']++;}}for(const _0xe0eaf2 of _0x1d1cbd){if(_0xe0eaf2[_0x57c0ea(0xf0)][_0x57c0ea(0x138)])continue;const _0x173854=getSanitizedPathWithMigration(getPromptsDir(_0x2a6576),_0xe0eaf2[_0x57c0ea(0xf0)][_0x57c0ea(0x1f1)],_0x57c0ea(0x196));_0x173854[_0x57c0ea(0x13b)]&&this['logger'][_0x57c0ea(0x10e)](_0x57c0ea(0x208)+a135_0x57e5bb['basename'](_0x173854[_0x57c0ea(0x122)])+_0x57c0ea(0x1ad)+a135_0x57e5bb[_0x57c0ea(0xfe)](_0x173854[_0x57c0ea(0x10a)]));const _0x30df58=_0x173854['path'],_0x5259b1=await apiPromptToYaml(_0xe0eaf2,_0xf1b9f4);if(!_0x5259b1)continue;const _0x1c52eb=toPromptYamlString(_0x5259b1),_0x94ed6c=!a135_0x4da327[_0x57c0ea(0x1e2)](_0x30df58);let _0x401f0e=_0x94ed6c,_0x52735c;if(!_0x94ed6c){const _0x5fac72=a135_0x4da327['readFileSync'](_0x30df58,_0x57c0ea(0x180)),_0x351156=generateDiff(_0x5fac72,_0x1c52eb);_0x401f0e=hasChanges(_0x351156),_0x401f0e&&(_0x52735c=formatDiffWithColors(_0x351156));}_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0x30df58,'content':_0x1c52eb}),_0x15c478[_0x57c0ea(0x1e9)]['push']({'name':_0xe0eaf2[_0x57c0ea(0xf0)][_0x57c0ea(0x1f1)],'outputPath':_0x30df58,'isNew':_0x94ed6c,'hasChanges':_0x401f0e,'diff':_0x52735c}),_0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x1e9)][_0x57c0ea(0x194)]++;if(_0x94ed6c)_0x15c478['counts']['prompts'][_0x57c0ea(0xf8)]++;else{if(_0x401f0e)_0x15c478['counts'][_0x57c0ea(0x1e9)][_0x57c0ea(0x17d)]++;else _0x15c478['counts'][_0x57c0ea(0x1e9)][_0x57c0ea(0xec)]++;}}for(const _0x226bfa of _0x564840){const _0x44ec0a=_0x226bfa[_0x57c0ea(0xf0)]['serviceType'][_0x57c0ea(0xf2)](),_0x1132db=getSanitizedPathWithMigration(getIntegrationsDir(_0x2a6576),_0x44ec0a,'.yml');_0x1132db[_0x57c0ea(0x13b)]&&this['logger'][_0x57c0ea(0x10e)](_0x57c0ea(0x16a)+a135_0x57e5bb['basename'](_0x1132db[_0x57c0ea(0x122)])+_0x57c0ea(0x1ad)+a135_0x57e5bb[_0x57c0ea(0xfe)](_0x1132db[_0x57c0ea(0x10a)]));const _0x462c8f=_0x1132db[_0x57c0ea(0x10a)],_0x5243df=await apiIntegrationToYaml(_0x226bfa,_0xf1b9f4),_0x2c7090=toIntegrationYamlString(_0x5243df),_0x5c06bb=!a135_0x4da327['existsSync'](_0x462c8f);let _0x4b8dad=_0x5c06bb,_0x13fae0;if(!_0x5c06bb){const _0x3434d1=a135_0x4da327[_0x57c0ea(0x1e0)](_0x462c8f,'utf-8'),_0x20757b=generateDiff(_0x3434d1,_0x2c7090);_0x4b8dad=hasChanges(_0x20757b),_0x4b8dad&&(_0x13fae0=formatDiffWithColors(_0x20757b));}_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0x462c8f,'content':_0x2c7090}),_0x15c478[_0x57c0ea(0x11c)][_0x57c0ea(0x1b6)]({'name':_0x44ec0a,'outputPath':_0x462c8f,'isNew':_0x5c06bb,'hasChanges':_0x4b8dad,'diff':_0x13fae0}),_0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x11c)]['total']++;if(_0x5c06bb)_0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x11c)][_0x57c0ea(0xf8)]++;else{if(_0x4b8dad)_0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x11c)][_0x57c0ea(0x17d)]++;else _0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x11c)]['unchanged']++;}}for(const _0x49b769 of _0x5e2278){if(_0x49b769['attributes'][_0x57c0ea(0x138)])continue;const _0x2400d0=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x2a6576),_0x49b769['attributes'][_0x57c0ea(0x1f1)]);_0x2400d0['renamed']&&this[_0x57c0ea(0x165)][_0x57c0ea(0x10e)]('Renamed\x20experimental\x20KB\x20directory:\x20'+a135_0x57e5bb['basename'](_0x2400d0[_0x57c0ea(0x122)])+_0x57c0ea(0x1ad)+a135_0x57e5bb[_0x57c0ea(0xfe)](_0x2400d0['path']));const _0x4dd8ab=_0x2400d0[_0x57c0ea(0x10a)],_0x57dafd=a135_0x57e5bb['join'](_0x4dd8ab,sanitizeForFilesystem(_0x49b769[_0x57c0ea(0xf0)][_0x57c0ea(0x1f1)])+'.yml'),_0x44c6b5=a135_0x57e5bb[_0x57c0ea(0x1b8)](_0x4dd8ab,_0x57c0ea(0x16f)),_0x77cb2a=apiExperimentalKnowledgeBaseToYaml(_0x49b769),_0x56c796=toExperimentalKnowledgeBaseYamlString(_0x77cb2a),_0x821f6=!a135_0x4da327[_0x57c0ea(0x1e2)](_0x4dd8ab);let _0x406ae2=_0x821f6,_0x3cfd33,_0x52166c=_0x56c796;const _0x40a1eb=[..._0x77cb2a[_0x57c0ea(0x16f)]][_0x57c0ea(0x1cd)]((_0x5d10f8,_0x4ad26b)=>_0x5d10f8['name'][_0x57c0ea(0x12e)](_0x4ad26b[_0x57c0ea(0x1f1)]));for(const _0x5045a6 of _0x40a1eb){_0x52166c+=_0x57c0ea(0x19c)+_0x5045a6[_0x57c0ea(0x1f1)]+'\x20---\x0a'+_0x5045a6[_0x57c0ea(0x1bd)]+_0x57c0ea(0x16c)+_0x5045a6[_0x57c0ea(0x1f1)]+_0x57c0ea(0x1cc)+_0x5045a6['json_schema']+'\x0a';}if(!_0x821f6){let _0x50a2a9='';a135_0x4da327[_0x57c0ea(0x1e2)](_0x57dafd)&&(_0x50a2a9=a135_0x4da327[_0x57c0ea(0x1e0)](_0x57dafd,_0x57c0ea(0x180)));if(a135_0x4da327[_0x57c0ea(0x1e2)](_0x44c6b5)){const _0x46432d=a135_0x4da327[_0x57c0ea(0x1d2)](_0x44c6b5,{'withFileTypes':!![]}),_0xcc890a=_0x46432d[_0x57c0ea(0xee)](_0x1564b4=>_0x1564b4[_0x57c0ea(0x191)]())[_0x57c0ea(0x1cd)]((_0xb5e847,_0x46dca4)=>_0xb5e847[_0x57c0ea(0x1f1)]['localeCompare'](_0x46dca4[_0x57c0ea(0x1f1)]));for(const _0x3c8153 of _0xcc890a){const _0x3898e9=a135_0x57e5bb[_0x57c0ea(0x1b8)](_0x44c6b5,_0x3c8153[_0x57c0ea(0x1f1)],_0x57c0ea(0x136)),_0x4109b1=a135_0x57e5bb[_0x57c0ea(0x1b8)](_0x44c6b5,_0x3c8153[_0x57c0ea(0x1f1)],_0x57c0ea(0x1d8));a135_0x4da327[_0x57c0ea(0x1e2)](_0x3898e9)&&(_0x50a2a9+=_0x57c0ea(0x19c)+_0x3c8153[_0x57c0ea(0x1f1)]+'\x20---\x0a'+a135_0x4da327[_0x57c0ea(0x1e0)](_0x3898e9,_0x57c0ea(0x180))+'\x0a'),a135_0x4da327[_0x57c0ea(0x1e2)](_0x4109b1)&&(_0x50a2a9+=_0x57c0ea(0x14e)+_0x3c8153[_0x57c0ea(0x1f1)]+_0x57c0ea(0x1cc)+a135_0x4da327[_0x57c0ea(0x1e0)](_0x4109b1,'utf-8')+'\x0a');}}const _0x1af767=generateDiff(_0x50a2a9,_0x52166c);_0x406ae2=hasChanges(_0x1af767),_0x406ae2&&(_0x3cfd33=formatDiffWithColors(_0x1af767));}_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0x4dd8ab,'content':'','isDir':!![]}),_0x1f3a1a['push']({'path':_0x57dafd,'content':_0x56c796}),_0x1f3a1a['push']({'path':_0x44c6b5,'content':'','isDir':!![]});for(const _0x91b742 of _0x77cb2a[_0x57c0ea(0x16f)]){const _0x2216e9=a135_0x57e5bb[_0x57c0ea(0x1b8)](_0x44c6b5,sanitizeForFilesystem(_0x91b742[_0x57c0ea(0x1f1)])),_0x37eb98=a135_0x57e5bb[_0x57c0ea(0x1b8)](_0x2216e9,_0x57c0ea(0x136)),_0x1bd328=a135_0x57e5bb['join'](_0x2216e9,'json_schema.json');_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0x2216e9,'content':'','isDir':!![]}),_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0x37eb98,'content':_0x91b742[_0x57c0ea(0x1bd)]}),_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0x1bd328,'content':_0x91b742['json_schema']});}if(a135_0x4da327['existsSync'](_0x44c6b5)){const _0x1aa660=a135_0x4da327[_0x57c0ea(0x1d2)](_0x44c6b5,{'withFileTypes':!![]}),_0x4a6226=new Set(_0x77cb2a[_0x57c0ea(0x16f)][_0x57c0ea(0x19f)](_0x386dde=>sanitizeForFilesystem(_0x386dde[_0x57c0ea(0x1f1)])));for(const _0xeb7267 of _0x1aa660){if(_0xeb7267['isDirectory']()&&!_0x4a6226[_0x57c0ea(0x160)](_0xeb7267['name'])){const _0x38ec9f=a135_0x57e5bb[_0x57c0ea(0x1b8)](_0x44c6b5,_0xeb7267[_0x57c0ea(0x1f1)]);_0x25fd2c[_0x57c0ea(0x1b6)]({'path':_0x38ec9f,'isDir':!![]});}}}_0x15c478[_0x57c0ea(0x1e7)][_0x57c0ea(0x1b6)]({'name':_0x49b769['attributes'][_0x57c0ea(0x1f1)],'outputPath':_0x4dd8ab,'isNew':_0x821f6,'hasChanges':_0x406ae2,'diff':_0x3cfd33}),_0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x1e7)][_0x57c0ea(0x194)]++;if(_0x821f6)_0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x1e7)][_0x57c0ea(0xf8)]++;else{if(_0x406ae2)_0x15c478['counts'][_0x57c0ea(0x1e7)][_0x57c0ea(0x17d)]++;else _0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x1e7)][_0x57c0ea(0xec)]++;}}for(const _0x3b3d21 of _0x41d889){if(_0x3b3d21['attributes'][_0x57c0ea(0x138)])continue;const _0x26b9ba=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x2a6576),_0x3b3d21[_0x57c0ea(0xf0)][_0x57c0ea(0x1f1)]);_0x26b9ba[_0x57c0ea(0x13b)]&&this[_0x57c0ea(0x165)][_0x57c0ea(0x10e)](_0x57c0ea(0x1d1)+a135_0x57e5bb['basename'](_0x26b9ba[_0x57c0ea(0x122)])+_0x57c0ea(0x1ad)+a135_0x57e5bb[_0x57c0ea(0xfe)](_0x26b9ba[_0x57c0ea(0x10a)]));const _0x483f3f=_0x26b9ba['path'],_0x6217ec=a135_0x57e5bb[_0x57c0ea(0x1b8)](_0x483f3f,sanitizeForFilesystem(_0x3b3d21['attributes'][_0x57c0ea(0x1f1)])+_0x57c0ea(0x196)),_0x5bf138=a135_0x57e5bb['join'](_0x483f3f,_0x57c0ea(0x136)),_0x332b32=a135_0x57e5bb[_0x57c0ea(0x1b8)](_0x483f3f,_0x57c0ea(0x116)),_0x3bf147=apiExperimentalArtifactToYaml(_0x3b3d21),_0x567a85=toExperimentalArtifactYamlString(_0x3bf147),_0x3111e3=!a135_0x4da327['existsSync'](_0x483f3f);let _0x1618bf=_0x3111e3,_0x1c4947,_0x154c7f=_0x567a85+(_0x57c0ea(0x1f7)+_0x3bf147[_0x57c0ea(0x1bd)]+'\x0a');const _0x225433=[..._0x3bf147[_0x57c0ea(0x116)]][_0x57c0ea(0x1cd)]((_0x1d188d,_0x1a5921)=>_0x1d188d[_0x57c0ea(0x132)]['localeCompare'](_0x1a5921[_0x57c0ea(0x132)]));for(const _0x6d105c of _0x225433){_0x154c7f+=_0x57c0ea(0x187)+_0x6d105c[_0x57c0ea(0x132)]+_0x57c0ea(0x1cc)+_0x6d105c[_0x57c0ea(0x121)]+'\x0a';}if(!_0x3111e3){let _0x5845b6='';a135_0x4da327['existsSync'](_0x6217ec)&&(_0x5845b6=a135_0x4da327[_0x57c0ea(0x1e0)](_0x6217ec,_0x57c0ea(0x180)));a135_0x4da327[_0x57c0ea(0x1e2)](_0x5bf138)&&(_0x5845b6+='\x0a---\x20code\x20---\x0a'+a135_0x4da327['readFileSync'](_0x5bf138,_0x57c0ea(0x180))+'\x0a');if(a135_0x4da327[_0x57c0ea(0x1e2)](_0x332b32)){const _0x13025b=a135_0x4da327[_0x57c0ea(0x1d2)](_0x332b32),_0x2d4b17=_0x13025b[_0x57c0ea(0xee)](_0x2ed72f=>{const _0xe31ff1=_0x57c0ea,_0x1587d9=a135_0x57e5bb['join'](_0x332b32,_0x2ed72f);return a135_0x4da327[_0xe31ff1(0x105)](_0x1587d9)[_0xe31ff1(0xed)]();})[_0x57c0ea(0x1cd)]((_0x13d465,_0x5e6bb9)=>_0x13d465[_0x57c0ea(0x12e)](_0x5e6bb9));for(const _0x4743b6 of _0x2d4b17){const _0x545f60=a135_0x57e5bb[_0x57c0ea(0x1b8)](_0x332b32,_0x4743b6);_0x5845b6+=_0x57c0ea(0x187)+_0x4743b6+_0x57c0ea(0x1cc)+a135_0x4da327[_0x57c0ea(0x1e0)](_0x545f60,'utf-8')+'\x0a';}}const _0x422bca=generateDiff(_0x5845b6,_0x154c7f);_0x1618bf=hasChanges(_0x422bca),_0x1618bf&&(_0x1c4947=formatDiffWithColors(_0x422bca));}_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0x483f3f,'content':'','isDir':!![]}),_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0x6217ec,'content':_0x567a85}),_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0x5bf138,'content':_0x3bf147[_0x57c0ea(0x1bd)]});if(_0x3bf147[_0x57c0ea(0x116)][_0x57c0ea(0x1ac)]>0x0){_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0x332b32,'content':'','isDir':!![]});for(const _0x29af2c of _0x3bf147[_0x57c0ea(0x116)]){const _0xa0161c=a135_0x57e5bb[_0x57c0ea(0x1b8)](_0x332b32,_0x29af2c[_0x57c0ea(0x132)]);_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0xa0161c,'content':_0x29af2c['text_content']});}}if(a135_0x4da327[_0x57c0ea(0x1e2)](_0x332b32)){const _0x305def=a135_0x4da327[_0x57c0ea(0x1d2)](_0x332b32),_0x3706bc=new Set(_0x3bf147['files'][_0x57c0ea(0x19f)](_0x844624=>_0x844624[_0x57c0ea(0x132)]));for(const _0x7453b1 of _0x305def){const _0x587b74=a135_0x57e5bb[_0x57c0ea(0x1b8)](_0x332b32,_0x7453b1);a135_0x4da327['statSync'](_0x587b74)[_0x57c0ea(0xed)]()&&!_0x3706bc[_0x57c0ea(0x160)](_0x7453b1)&&_0x25fd2c[_0x57c0ea(0x1b6)]({'path':_0x587b74});}}_0x15c478[_0x57c0ea(0x17b)][_0x57c0ea(0x1b6)]({'name':_0x3b3d21['attributes'][_0x57c0ea(0x1f1)],'outputPath':_0x483f3f,'isNew':_0x3111e3,'hasChanges':_0x1618bf,'diff':_0x1c4947}),_0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x17b)][_0x57c0ea(0x194)]++;if(_0x3111e3)_0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x17b)][_0x57c0ea(0xf8)]++;else{if(_0x1618bf)_0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x17b)]['updated']++;else _0x15c478['counts'][_0x57c0ea(0x17b)][_0x57c0ea(0xec)]++;}}for(const _0x3fc731 of _0x5e9b60){const _0x14fc80=getSanitizedPathWithMigration(getFormInterfacesDir(_0x2a6576),_0x3fc731[_0x57c0ea(0xf0)][_0x57c0ea(0x1f1)],'.yml');_0x14fc80[_0x57c0ea(0x13b)]&&this['logger'][_0x57c0ea(0x10e)](_0x57c0ea(0x1a4)+a135_0x57e5bb['basename'](_0x14fc80[_0x57c0ea(0x122)])+_0x57c0ea(0x1ad)+a135_0x57e5bb[_0x57c0ea(0xfe)](_0x14fc80['path']));const _0x3af8ac=_0x14fc80[_0x57c0ea(0x10a)],_0x5825d4=await apiFormInterfaceToYaml(_0x3fc731,_0xf1b9f4),_0x680208=toFormInterfaceYamlString(_0x5825d4),_0x5b3b54=!a135_0x4da327[_0x57c0ea(0x1e2)](_0x3af8ac);let _0x174208=_0x5b3b54,_0x34511a;if(!_0x5b3b54){const _0x299c7a=a135_0x4da327['readFileSync'](_0x3af8ac,_0x57c0ea(0x180)),_0x983c82=generateDiff(_0x299c7a,_0x680208);_0x174208=hasChanges(_0x983c82),_0x174208&&(_0x34511a=formatDiffWithColors(_0x983c82));}_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0x3af8ac,'content':_0x680208}),_0x15c478[_0x57c0ea(0x1e3)][_0x57c0ea(0x1b6)]({'name':_0x3fc731[_0x57c0ea(0xf0)][_0x57c0ea(0x1f1)],'outputPath':_0x3af8ac,'isNew':_0x5b3b54,'hasChanges':_0x174208,'diff':_0x34511a}),_0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x1e3)]['total']++;if(_0x5b3b54)_0x15c478['counts'][_0x57c0ea(0x1e3)][_0x57c0ea(0xf8)]++;else{if(_0x174208)_0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x1e3)]['updated']++;else _0x15c478[_0x57c0ea(0x168)]['formInterfaces'][_0x57c0ea(0xec)]++;}}for(const _0x1df296 of _0x292f80){if(_0x1df296[_0x57c0ea(0xf0)][_0x57c0ea(0x138)])continue;const _0x4e181f=getSanitizedPathWithMigration(getChatInterfacesDir(_0x2a6576),_0x1df296['attributes'][_0x57c0ea(0x1f1)],_0x57c0ea(0x196));_0x4e181f[_0x57c0ea(0x13b)]&&this[_0x57c0ea(0x165)][_0x57c0ea(0x10e)](_0x57c0ea(0x1c1)+a135_0x57e5bb[_0x57c0ea(0xfe)](_0x4e181f['oldPath'])+'\x20→\x20'+a135_0x57e5bb[_0x57c0ea(0xfe)](_0x4e181f[_0x57c0ea(0x10a)]));const _0x1c8018=_0x4e181f['path'],_0x3b2b9e=await apiChatInterfaceToYaml(_0x1df296,_0xf1b9f4),_0x5536ca=toChatInterfaceYamlString(_0x3b2b9e),_0x1c551f=!a135_0x4da327[_0x57c0ea(0x1e2)](_0x1c8018);let _0x4f9d39=_0x1c551f,_0x3262f2;if(!_0x1c551f){const _0x1e1bd0=a135_0x4da327[_0x57c0ea(0x1e0)](_0x1c8018,_0x57c0ea(0x180)),_0x1ff694=generateDiff(_0x1e1bd0,_0x5536ca);_0x4f9d39=hasChanges(_0x1ff694),_0x4f9d39&&(_0x3262f2=formatDiffWithColors(_0x1ff694));}_0x1f3a1a[_0x57c0ea(0x1b6)]({'path':_0x1c8018,'content':_0x5536ca}),_0x15c478[_0x57c0ea(0x13d)][_0x57c0ea(0x1b6)]({'name':_0x1df296['attributes']['name'],'outputPath':_0x1c8018,'isNew':_0x1c551f,'hasChanges':_0x4f9d39,'diff':_0x3262f2}),_0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x13d)][_0x57c0ea(0x194)]++;if(_0x1c551f)_0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x13d)][_0x57c0ea(0xf8)]++;else{if(_0x4f9d39)_0x15c478[_0x57c0ea(0x168)]['chatInterfaces'][_0x57c0ea(0x17d)]++;else _0x15c478[_0x57c0ea(0x168)][_0x57c0ea(0x13d)]['unchanged']++;}}if(_0x3e037f?.[_0x57c0ea(0x175)])return _0x15c478;a135_0x4da327[_0x57c0ea(0x130)](_0x2a6576,{'recursive':!![]}),a135_0x4da327[_0x57c0ea(0x130)](getKnowledgeBasesDir(_0x2a6576),{'recursive':!![]}),a135_0x4da327[_0x57c0ea(0x130)](getPromptsDir(_0x2a6576),{'recursive':!![]}),a135_0x4da327['mkdirSync'](getIntegrationsDir(_0x2a6576),{'recursive':!![]}),a135_0x4da327[_0x57c0ea(0x130)](getExperimentalKnowledgeBasesDir(_0x2a6576),{'recursive':!![]}),a135_0x4da327[_0x57c0ea(0x130)](getExperimentalArtifactsDir(_0x2a6576),{'recursive':!![]}),a135_0x4da327[_0x57c0ea(0x130)](getFormInterfacesDir(_0x2a6576),{'recursive':!![]}),a135_0x4da327[_0x57c0ea(0x130)](getChatInterfacesDir(_0x2a6576),{'recursive':!![]});const _0x19d530=a135_0x57e5bb[_0x57c0ea(0x1b8)](_0x2a6576,_0x57c0ea(0x15d));a135_0x4da327[_0x57c0ea(0x1a9)](_0x19d530,createAgentConfigContent(_0x21f266));for(const _0x34119f of _0x1f3a1a){if(_0x34119f[_0x57c0ea(0x1d3)])a135_0x4da327['mkdirSync'](_0x34119f[_0x57c0ea(0x10a)],{'recursive':!![]});else{const _0xdd0822=a135_0x57e5bb[_0x57c0ea(0x1d4)](_0x34119f[_0x57c0ea(0x10a)]);!a135_0x4da327[_0x57c0ea(0x1e2)](_0xdd0822)&&a135_0x4da327['mkdirSync'](_0xdd0822,{'recursive':!![]}),a135_0x4da327[_0x57c0ea(0x1a9)](_0x34119f['path'],_0x34119f[_0x57c0ea(0x1fe)]);}}for(const _0x542b63 of _0x25fd2c){_0x542b63[_0x57c0ea(0x1d3)]?(a135_0x4da327['rmSync'](_0x542b63[_0x57c0ea(0x10a)],{'recursive':!![],'force':!![]}),this[_0x57c0ea(0x165)][_0x57c0ea(0x10e)](_0x57c0ea(0x1db)+a135_0x57e5bb[_0x57c0ea(0xfe)](a135_0x57e5bb[_0x57c0ea(0x1d4)](_0x542b63['path']))+'/'+a135_0x57e5bb[_0x57c0ea(0xfe)](_0x542b63[_0x57c0ea(0x10a)]))):(a135_0x4da327['rmSync'](_0x542b63['path'],{'force':!![]}),this[_0x57c0ea(0x165)][_0x57c0ea(0x10e)](_0x57c0ea(0x1c6)+a135_0x57e5bb['basename'](a135_0x57e5bb[_0x57c0ea(0x1d4)](_0x542b63[_0x57c0ea(0x10a)]))+'/'+a135_0x57e5bb[_0x57c0ea(0xfe)](_0x542b63[_0x57c0ea(0x10a)])));}return _0x15c478;}async[a135_0x10eab9(0x112)](_0x18b5e3,_0x4722c9){const _0x555373=a135_0x10eab9,_0x592533=a135_0x57e5bb[_0x555373(0x1b8)](_0x18b5e3,_0x555373(0x15d));if(!a135_0x4da327['existsSync'](_0x592533))throw new SDKError(ErrorCode[_0x555373(0x190)],_0x555373(0x209)+_0x18b5e3,undefined,{'helpText':_0x555373(0x1df)});const _0x2ae81d=loadAgentConfig(_0x592533),_0xbbd9ec=await this[_0x555373(0x200)](_0x2ae81d['llm_project']),_0x52cb63=await this['client'][_0x555373(0x149)](_0xbbd9ec),_0x1b5f99=_0x52cb63[_0x555373(0xf0)]['name'],_0x193d5c={'projectName':_0x1b5f99,'projectId':_0xbbd9ec,'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}}},_0x231827=[],_0x247825=[],_0x3019e8=[],_0x53756e=[],_0x4c5bec=[],_0x49ff35=[],_0x97471b=a135_0x4da327[_0x555373(0x1d2)](_0x18b5e3,{'withFileTypes':!![]});for(const _0x5e4d35 of _0x97471b){if(!_0x5e4d35['isDirectory']())continue;if([_0x555373(0x1e5),_0x555373(0x1e9),'integrations',_0x555373(0x159),_0x555373(0x1a7),_0x555373(0x1f9),_0x555373(0x14c)][_0x555373(0x11f)](_0x5e4d35[_0x555373(0x1f1)]))continue;const _0x18b5f2=a135_0x57e5bb['join'](_0x18b5e3,_0x5e4d35[_0x555373(0x1f1)]);if(isAgentDir(_0x18b5f2)){const _0x10a4f7=a135_0x57e5bb['join'](_0x18b5f2,_0x555373(0x11e)),_0x2bbc26=a135_0x57e5bb[_0x555373(0x1b8)](_0x18b5f2,_0x555373(0x185)),_0x3251d9=a135_0x57e5bb[_0x555373(0x1b8)](_0x18b5f2,_0x555373(0x1b1)),_0x4233c8=parseAgentYaml(a135_0x4da327['readFileSync'](_0x10a4f7,_0x555373(0x180)),_0x10a4f7),_0x5b69cc=a135_0x4da327[_0x555373(0x1e2)](_0x2bbc26)?a135_0x4da327[_0x555373(0x1e0)](_0x2bbc26,_0x555373(0x180)):'',_0x3a60ab=a135_0x4da327['existsSync'](_0x3251d9)?a135_0x4da327['readFileSync'](_0x3251d9,_0x555373(0x180)):_0x4233c8['starter_message'];_0x231827[_0x555373(0x1b6)]({'name':_0x4233c8[_0x555373(0x1f1)],'dir':_0x18b5f2,'yaml':_0x4233c8,'systemPrompt':_0x5b69cc,'starterMessage':_0x3a60ab});}}const _0x61368=getKnowledgeBasesDir(_0x18b5e3);if(a135_0x4da327[_0x555373(0x1e2)](_0x61368)){const _0x3366c3=a135_0x4da327[_0x555373(0x1d2)](_0x61368);for(const _0x249c7b of _0x3366c3){const _0xb30d41=a135_0x57e5bb[_0x555373(0x1b8)](_0x61368,_0x249c7b);if(_0x249c7b['endsWith'](_0x555373(0x196))){const _0x226649=parseKnowledgeBaseYaml(a135_0x4da327[_0x555373(0x1e0)](_0xb30d41,_0x555373(0x180)),_0xb30d41);_0x247825[_0x555373(0x1b6)]({'name':_0x226649['name'],'path':_0xb30d41,'yaml':_0x226649});}else{if(_0x249c7b[_0x555373(0xf9)](_0x555373(0x119))){const _0x1139e4=a135_0x4da327[_0x555373(0x1e0)](_0xb30d41,_0x555373(0x180)),{name:_0x1bfca5,text:_0x1981f1}=parseTextKnowledgeBaseMd(_0x1139e4,_0x249c7b);_0x3019e8['push']({'name':_0x1bfca5,'path':_0xb30d41,'text':_0x1981f1});}}}}const _0x2cfa1d=getPromptsDir(_0x18b5e3);if(a135_0x4da327[_0x555373(0x1e2)](_0x2cfa1d)){const _0x3b5c98=a135_0x4da327[_0x555373(0x1d2)](_0x2cfa1d)['filter'](_0x4c500a=>_0x4c500a[_0x555373(0xf9)](_0x555373(0x196)));for(const _0x3b29d1 of _0x3b5c98){const _0x1de1c4=a135_0x57e5bb[_0x555373(0x1b8)](_0x2cfa1d,_0x3b29d1),_0x33d47e=parsePromptYaml(a135_0x4da327[_0x555373(0x1e0)](_0x1de1c4,_0x555373(0x180)),_0x1de1c4);_0x53756e[_0x555373(0x1b6)]({'name':_0x33d47e[_0x555373(0x1f1)],'path':_0x1de1c4,'yaml':_0x33d47e});}}const _0x8bacf0=[],_0x13c3fa=getIntegrationsDir(_0x18b5e3);if(a135_0x4da327[_0x555373(0x1e2)](_0x13c3fa)){const _0x15a1da=a135_0x4da327[_0x555373(0x1d2)](_0x13c3fa)[_0x555373(0xee)](_0x37c2b5=>_0x37c2b5['endsWith'](_0x555373(0x196)));for(const _0x2e4f97 of _0x15a1da){const _0x5e2c24=a135_0x57e5bb[_0x555373(0x1b8)](_0x13c3fa,_0x2e4f97),_0x119786=parseIntegrationYaml(a135_0x4da327[_0x555373(0x1e0)](_0x5e2c24,_0x555373(0x180)),_0x5e2c24);if(!SAFE_INTEGRATION_TYPES['includes'](_0x119786['service_type'][_0x555373(0xf2)]())){this[_0x555373(0x165)]['warn']('Skipping\x20integration\x20\x27'+_0x119786['name']+_0x555373(0x1eb)+_0x119786[_0x555373(0x167)]+'):\x20'+(_0x555373(0x110)+SAFE_INTEGRATION_TYPES[_0x555373(0x1b8)](',\x20')+_0x555373(0xf5))+'Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.');continue;}_0x8bacf0[_0x555373(0x1b6)]({'name':_0x119786['name'],'path':_0x5e2c24,'yaml':_0x119786});}}const _0xdc4dee=getExperimentalKnowledgeBasesDir(_0x18b5e3);if(a135_0x4da327[_0x555373(0x1e2)](_0xdc4dee)){const _0x3333c0=a135_0x4da327[_0x555373(0x1d2)](_0xdc4dee,{'withFileTypes':!![]});for(const _0x4237e5 of _0x3333c0){if(!_0x4237e5[_0x555373(0x191)]())continue;const _0x310325=a135_0x57e5bb[_0x555373(0x1b8)](_0xdc4dee,_0x4237e5[_0x555373(0x1f1)]),_0x1962fe=a135_0x57e5bb[_0x555373(0x1b8)](_0x310325,_0x4237e5[_0x555373(0x1f1)]+_0x555373(0x196)),_0x3ab7b3=a135_0x57e5bb[_0x555373(0x1b8)](_0x310325,'functions');if(!a135_0x4da327[_0x555373(0x1e2)](_0x1962fe))continue;const _0x933b29=parseExperimentalKnowledgeBaseYaml(a135_0x4da327[_0x555373(0x1e0)](_0x1962fe,_0x555373(0x180)),_0x1962fe),_0x4a56b4=[];if(a135_0x4da327['existsSync'](_0x3ab7b3)){const _0x29890c=a135_0x4da327['readdirSync'](_0x3ab7b3,{'withFileTypes':!![]});for(const _0x2ccca8 of _0x29890c){if(!_0x2ccca8['isDirectory']())continue;const _0x2bd528=a135_0x57e5bb[_0x555373(0x1b8)](_0x3ab7b3,_0x2ccca8[_0x555373(0x1f1)]),_0x28f40f=a135_0x57e5bb[_0x555373(0x1b8)](_0x2bd528,_0x555373(0x136)),_0x23c65c=a135_0x57e5bb[_0x555373(0x1b8)](_0x2bd528,_0x555373(0x1d8));a135_0x4da327[_0x555373(0x1e2)](_0x28f40f)&&a135_0x4da327[_0x555373(0x1e2)](_0x23c65c)&&_0x4a56b4['push']({'name':_0x2ccca8[_0x555373(0x1f1)],'code':a135_0x4da327['readFileSync'](_0x28f40f,'utf-8'),'json_schema':a135_0x4da327[_0x555373(0x1e0)](_0x23c65c,_0x555373(0x180))});}}const _0x353097={..._0x933b29,'variables':_0x933b29['variables']||[],'functions':_0x4a56b4};_0x4c5bec[_0x555373(0x1b6)]({'name':_0x933b29[_0x555373(0x1f1)],'dir':_0x310325,'def':_0x353097});}}const _0x42326d=getExperimentalArtifactsDir(_0x18b5e3);if(a135_0x4da327[_0x555373(0x1e2)](_0x42326d)){const _0x24146c=a135_0x4da327[_0x555373(0x1d2)](_0x42326d,{'withFileTypes':!![]});for(const _0x2d8988 of _0x24146c){if(!_0x2d8988[_0x555373(0x191)]())continue;const _0x379540=a135_0x57e5bb[_0x555373(0x1b8)](_0x42326d,_0x2d8988[_0x555373(0x1f1)]),_0xb93cfa=a135_0x57e5bb[_0x555373(0x1b8)](_0x379540,_0x2d8988[_0x555373(0x1f1)]+_0x555373(0x196)),_0x229612=a135_0x57e5bb['join'](_0x379540,_0x555373(0x136)),_0x406a31=a135_0x57e5bb[_0x555373(0x1b8)](_0x379540,_0x555373(0x116));if(!a135_0x4da327[_0x555373(0x1e2)](_0xb93cfa)||!a135_0x4da327[_0x555373(0x1e2)](_0x229612))continue;const _0x20a7cd=parseExperimentalArtifactYaml(a135_0x4da327[_0x555373(0x1e0)](_0xb93cfa,_0x555373(0x180)),_0xb93cfa),_0x1439d3=a135_0x4da327[_0x555373(0x1e0)](_0x229612,_0x555373(0x180)),_0x5cd489=[];if(a135_0x4da327[_0x555373(0x1e2)](_0x406a31)){const _0x29d1f6=a135_0x4da327[_0x555373(0x1d2)](_0x406a31);for(const _0x3a0d63 of _0x29d1f6){const _0x2e9492=a135_0x57e5bb[_0x555373(0x1b8)](_0x406a31,_0x3a0d63);a135_0x4da327['statSync'](_0x2e9492)[_0x555373(0xed)]()&&_0x5cd489[_0x555373(0x1b6)]({'file_name':_0x3a0d63,'text_content':a135_0x4da327[_0x555373(0x1e0)](_0x2e9492,_0x555373(0x180))});}}const _0x52984f={..._0x20a7cd,'code':_0x1439d3,'files':_0x5cd489};_0x49ff35['push']({'name':_0x20a7cd[_0x555373(0x1f1)],'dir':_0x379540,'def':_0x52984f});}}const _0x321751=[],_0x419c4b=getFormInterfacesDir(_0x18b5e3);if(a135_0x4da327[_0x555373(0x1e2)](_0x419c4b)){const _0x1acc1c=a135_0x4da327[_0x555373(0x1d2)](_0x419c4b)[_0x555373(0xee)](_0x36efdc=>_0x36efdc[_0x555373(0xf9)](_0x555373(0x196)));for(const _0x3cc538 of _0x1acc1c){const _0x373a56=a135_0x57e5bb[_0x555373(0x1b8)](_0x419c4b,_0x3cc538),_0xc8d3bb=parseFormInterfaceYaml(a135_0x4da327['readFileSync'](_0x373a56,'utf-8'),_0x373a56);_0x321751['push']({'name':_0xc8d3bb[_0x555373(0x1f1)],'path':_0x373a56,'yaml':_0xc8d3bb});}}const _0x31b865=[],_0x14a249=getChatInterfacesDir(_0x18b5e3);if(a135_0x4da327[_0x555373(0x1e2)](_0x14a249)){const _0x3a1374=a135_0x4da327[_0x555373(0x1d2)](_0x14a249)[_0x555373(0xee)](_0x30b137=>_0x30b137[_0x555373(0xf9)](_0x555373(0x196)));for(const _0x30bd66 of _0x3a1374){const _0x108c39=a135_0x57e5bb['join'](_0x14a249,_0x30bd66),_0x375ebd=parseChatInterfaceYaml(a135_0x4da327[_0x555373(0x1e0)](_0x108c39,'utf-8'),_0x108c39);_0x31b865[_0x555373(0x1b6)]({'name':_0x375ebd['name'],'path':_0x108c39,'yaml':_0x375ebd});}}const _0x37b399=await this[_0x555373(0x120)][_0x555373(0x1f4)](_0xbbd9ec),_0x270a78=await this[_0x555373(0x120)][_0x555373(0xf4)](_0xbbd9ec),_0x54d7a3=await this[_0x555373(0x120)][_0x555373(0x126)](_0xbbd9ec),_0x122c8e=await this[_0x555373(0x120)][_0x555373(0x128)](_0xbbd9ec),_0x5568e4=await this[_0x555373(0x120)][_0x555373(0x1de)](_0xbbd9ec),_0x5938b2=await safeListOrEmpty(()=>this['client']['listExperimentalKnowledgeBases'](_0xbbd9ec)),_0x564024=await safeListOrEmpty(()=>this['client']['listExperimentalArtifacts'](_0xbbd9ec)),_0x8d7cf9=await safeListOrEmpty(()=>this[_0x555373(0x120)][_0x555373(0x153)](_0xbbd9ec)),_0x510cea=await safeListOrEmpty(()=>this[_0x555373(0x120)][_0x555373(0x111)](_0xbbd9ec)),_0x163ec6=await fetchAllToolTargetMaps((_0x3ef623,_0x190dc3)=>this[_0x555373(0x120)][_0x555373(0x182)](_0x3ef623,_0x190dc3),_0xbbd9ec),_0x35e835=new Map(),_0x554484=new Map(),_0x274dab=new Map(),_0x2a17db=new Map(),_0x4fab11=new Map(),_0x1de75a=new Map(),_0x4f22a8=new Map();for(const _0x41614c of _0x37b399){_0x35e835[_0x555373(0xfc)](_0x41614c[_0x555373(0xf0)][_0x555373(0x1f1)],_0x41614c);}for(const _0x2dbc52 of _0x270a78){_0x554484['set'](_0x2dbc52[_0x555373(0xf0)][_0x555373(0x1f1)],_0x2dbc52);}for(const _0x1a6e29 of _0x54d7a3){_0x274dab[_0x555373(0xfc)](_0x1a6e29['attributes'][_0x555373(0x1f1)],_0x1a6e29);}for(const _0x509bd1 of _0x122c8e){_0x2a17db[_0x555373(0xfc)](_0x509bd1['attributes'][_0x555373(0x1f1)],_0x509bd1);}for(const _0x400d20 of _0x5568e4){_0x4fab11[_0x555373(0xfc)](_0x400d20['attributes']['serviceType'][_0x555373(0xf2)](),_0x400d20);}for(const _0x479599 of _0x5938b2){_0x1de75a[_0x555373(0xfc)](_0x479599[_0x555373(0xf0)][_0x555373(0x1f1)],_0x479599);}for(const _0x4b85af of _0x564024){_0x4f22a8['set'](_0x4b85af[_0x555373(0xf0)][_0x555373(0x1f1)],_0x4b85af);}const _0xb601d1=new Map(),_0x3ab76b=new Map();for(const _0xdca83 of _0x8d7cf9){_0xb601d1[_0x555373(0xfc)](_0xdca83['attributes'][_0x555373(0x1f1)],_0xdca83);}for(const _0x2da0f8 of _0x510cea){_0x3ab76b['set'](_0x2da0f8['attributes'][_0x555373(0x1f1)],_0x2da0f8);}const _0x452576=new Map(),_0x5b0d1f=new Map();for(const _0xcb541d of _0x37b399){_0x452576[_0x555373(0xfc)](_0xcb541d[_0x555373(0xf0)]['name'],_0xcb541d['id']),_0x5b0d1f[_0x555373(0xfc)](_0xcb541d['id'],_0xcb541d['attributes']['name']);}const _0x2bad36=new Map(),_0x3f812b=new Map();for(const _0x1f7ad0 of _0x122c8e){_0x2bad36[_0x555373(0xfc)](_0x1f7ad0[_0x555373(0xf0)]['name'],_0x1f7ad0['id']),_0x3f812b['set'](_0x1f7ad0['id'],_0x1f7ad0[_0x555373(0xf0)][_0x555373(0x1f1)]);}const _0x5e9651=_0x163ec6[_0x555373(0x1c4)][_0x555373(0x1e1)]||new Map(),_0x18a4a0=_0x163ec6[_0x555373(0x1c4)][_0x555373(0x13c)]||new Map(),_0x46c29d=_0x163ec6['nameToId'][_0x555373(0x156)]||new Map(),_0x7cb4f8=new Map(),_0x5452ad={'resolveToolTargetName':buildNameResolver({..._0x163ec6[_0x555373(0x163)],'Agent':_0x5b0d1f}),'resolvePromptName':async _0x5bf8bb=>_0x3f812b[_0x555373(0x202)](_0x5bf8bb),'onWarning':_0x172cfa=>this[_0x555373(0x165)][_0x555373(0x1dd)](_0x172cfa)};let _0x142d3a=[];const _0x37bd1a={'projectId':_0xbbd9ec,'resolveToolTargetId':buildIdResolver({..._0x163ec6[_0x555373(0x1c4)],'Agent':_0x452576}),'resolvePromptId':async _0x813c76=>_0x2bad36['get'](_0x813c76),'onWarning':_0x4d1b2c=>{const _0x40977b=_0x555373;this[_0x40977b(0x165)][_0x40977b(0x1dd)](_0x4d1b2c),_0x142d3a[_0x40977b(0x1b6)](_0x4d1b2c);}},{resolved:_0x41d4d1,unresolved:_0x437e0b}=resolveAgentDependencies(_0x231827,new Set(_0x35e835['keys']()));for(const {agent:_0x481d42,missingDeps:_0x25c9ea}of _0x437e0b){_0x193d5c[_0x555373(0x174)][_0x555373(0x1b6)]({'agentName':_0x481d42['yaml']['name'],'action':'error','error':_0x555373(0x204)+_0x25c9ea[_0x555373(0x1b8)](',\x20')+'.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.'}),_0x193d5c[_0x555373(0x168)][_0x555373(0x174)][_0x555373(0x13e)]++;}for(const _0x49a299 of _0x247825){const _0x2122e4=_0x554484[_0x555373(0x202)](_0x49a299[_0x555373(0xf3)][_0x555373(0x1f1)]),_0x41908d=a135_0x4da327[_0x555373(0x1e0)](_0x49a299[_0x555373(0x10a)],'utf-8');if(_0x2122e4){const _0x1c48eb=apiKnowledgeBaseToYaml(_0x2122e4),_0x381e78=toKnowledgeBaseYamlString(_0x1c48eb),_0x4c51cf=generateDiff(_0x381e78,_0x41908d),_0x3a63df=hasChanges(_0x4c51cf);_0x3a63df?(_0x193d5c[_0x555373(0x195)][_0x555373(0x1b6)]({'name':_0x49a299[_0x555373(0xf3)][_0x555373(0x1f1)],'action':_0x555373(0x17d),'id':_0x2122e4['id'],'diff':formatDiffWithColors(_0x4c51cf)}),_0x193d5c['counts'][_0x555373(0x195)][_0x555373(0x17d)]++):(_0x193d5c[_0x555373(0x195)][_0x555373(0x1b6)]({'name':_0x49a299['yaml'][_0x555373(0x1f1)],'action':_0x555373(0xec),'id':_0x2122e4['id']}),_0x193d5c[_0x555373(0x168)][_0x555373(0x195)]['unchanged']++);}else _0x193d5c[_0x555373(0x195)][_0x555373(0x1b6)]({'name':_0x49a299[_0x555373(0xf3)][_0x555373(0x1f1)],'action':_0x555373(0x1b0)}),_0x193d5c[_0x555373(0x168)][_0x555373(0x195)][_0x555373(0x1b0)]++;}for(const _0x541b01 of _0x3019e8){const _0x52e4b7=_0x274dab[_0x555373(0x202)](_0x541b01[_0x555373(0x1f1)]),_0x4dec6a=a135_0x4da327[_0x555373(0x1e0)](_0x541b01[_0x555373(0x10a)],_0x555373(0x180));if(_0x52e4b7){const _0x22b9a9=toTextKnowledgeBaseMd(_0x52e4b7[_0x555373(0xf0)]['name'],_0x52e4b7[_0x555373(0xf0)][_0x555373(0x173)]),_0x552116=generateDiff(_0x22b9a9,_0x4dec6a),_0x13641c=hasChanges(_0x552116);_0x13641c?(_0x193d5c[_0x555373(0x1ce)][_0x555373(0x1b6)]({'name':_0x541b01[_0x555373(0x1f1)],'action':_0x555373(0x17d),'id':_0x52e4b7['id'],'diff':formatDiffWithColors(_0x552116)}),_0x193d5c['counts']['textKnowledgeBases']['updated']++):(_0x193d5c[_0x555373(0x1ce)][_0x555373(0x1b6)]({'name':_0x541b01[_0x555373(0x1f1)],'action':_0x555373(0xec),'id':_0x52e4b7['id']}),_0x193d5c[_0x555373(0x168)][_0x555373(0x1ce)]['unchanged']++);}else _0x193d5c[_0x555373(0x1ce)][_0x555373(0x1b6)]({'name':_0x541b01['name'],'action':_0x555373(0x1b0)}),_0x193d5c[_0x555373(0x168)][_0x555373(0x1ce)][_0x555373(0x1b0)]++;}for(const _0x3b379f of _0x41d4d1){const _0x3580ad=_0x35e835[_0x555373(0x202)](_0x3b379f[_0x555373(0xf3)][_0x555373(0x1f1)]),_0x3e2644=a135_0x57e5bb[_0x555373(0x1b8)](_0x3b379f['dir'],'agent.yml'),_0x146c6c=a135_0x4da327[_0x555373(0x1e0)](_0x3e2644,_0x555373(0x180)),_0x3d967f=_0x3b379f[_0x555373(0x108)],_0x5e034f=_0x555373(0x147)+_0x3d967f+'\x0a\x0a#\x20agent.yml\x0a'+_0x146c6c;if(_0x3580ad){const {yaml:_0x4d3378,systemPrompt:_0x4ce742}=await agentResponseToDef(_0x3580ad,_0x5452ad),_0x7cfe4b=toAgentYamlString(_0x4d3378),_0x356d52=_0x555373(0x147)+_0x4ce742+'\x0a\x0a#\x20agent.yml\x0a'+_0x7cfe4b,_0x962663=generateDiff(_0x356d52,_0x5e034f),_0x58b17e=hasChanges(_0x962663);_0x58b17e?(_0x193d5c['agents'][_0x555373(0x1b6)]({'agentName':_0x3b379f[_0x555373(0xf3)][_0x555373(0x1f1)],'action':_0x555373(0x17d),'agentId':_0x3580ad['id'],'diff':formatDiffWithColors(_0x962663)}),_0x193d5c[_0x555373(0x168)][_0x555373(0x174)]['updated']++):(_0x193d5c[_0x555373(0x174)][_0x555373(0x1b6)]({'agentName':_0x3b379f[_0x555373(0xf3)][_0x555373(0x1f1)],'action':_0x555373(0xec),'agentId':_0x3580ad['id']}),_0x193d5c[_0x555373(0x168)][_0x555373(0x174)][_0x555373(0xec)]++);}else _0x193d5c['agents'][_0x555373(0x1b6)]({'agentName':_0x3b379f['yaml'][_0x555373(0x1f1)],'action':'created'}),_0x193d5c['counts'][_0x555373(0x174)][_0x555373(0x1b0)]++;}for(const _0x410712 of _0x53756e){const _0x3c4b0d=_0x2a17db[_0x555373(0x202)](_0x410712['yaml'][_0x555373(0x1f1)]),_0xfd731d=a135_0x4da327[_0x555373(0x1e0)](_0x410712['path'],_0x555373(0x180));if(_0x3c4b0d){const _0x5b8cce=await apiPromptToYaml(_0x3c4b0d,_0x5452ad);if(!_0x5b8cce){_0x193d5c[_0x555373(0x1e9)][_0x555373(0x1b6)]({'name':_0x410712[_0x555373(0xf3)][_0x555373(0x1f1)],'action':'updated','id':_0x3c4b0d['id']}),_0x193d5c['counts'][_0x555373(0x1e9)]['updated']++;continue;}const _0x585797=toPromptYamlString(_0x5b8cce),_0x1d3b47=generateDiff(_0x585797,_0xfd731d),_0x590559=hasChanges(_0x1d3b47);_0x590559?(_0x193d5c[_0x555373(0x1e9)]['push']({'name':_0x410712[_0x555373(0xf3)][_0x555373(0x1f1)],'action':'updated','id':_0x3c4b0d['id'],'diff':formatDiffWithColors(_0x1d3b47)}),_0x193d5c[_0x555373(0x168)]['prompts'][_0x555373(0x17d)]++):(_0x193d5c[_0x555373(0x1e9)][_0x555373(0x1b6)]({'name':_0x410712['yaml'][_0x555373(0x1f1)],'action':_0x555373(0xec),'id':_0x3c4b0d['id']}),_0x193d5c[_0x555373(0x168)]['prompts'][_0x555373(0xec)]++);}else _0x193d5c[_0x555373(0x1e9)][_0x555373(0x1b6)]({'name':_0x410712[_0x555373(0xf3)][_0x555373(0x1f1)],'action':_0x555373(0x1b0)}),_0x193d5c[_0x555373(0x168)][_0x555373(0x1e9)]['created']++;}for(const _0xe827d of _0x8bacf0){const _0x212727=_0x4fab11['get'](_0xe827d['yaml'][_0x555373(0x167)]),_0x576d06=a135_0x4da327[_0x555373(0x1e0)](_0xe827d[_0x555373(0x10a)],'utf-8');if(_0x212727){const _0x3ceaf9=await apiIntegrationToYaml(_0x212727,_0x5452ad),_0x33a029=toIntegrationYamlString(_0x3ceaf9),_0x374783=generateDiff(_0x33a029,_0x576d06),_0x4050bb=hasChanges(_0x374783);_0x4050bb?(_0x193d5c[_0x555373(0x11c)][_0x555373(0x1b6)]({'name':_0xe827d[_0x555373(0xf3)][_0x555373(0x167)],'action':_0x555373(0x17d),'id':_0x212727['id'],'diff':formatDiffWithColors(_0x374783)}),_0x193d5c['counts'][_0x555373(0x11c)][_0x555373(0x17d)]++):(_0x193d5c[_0x555373(0x11c)][_0x555373(0x1b6)]({'name':_0xe827d[_0x555373(0xf3)][_0x555373(0x167)],'action':_0x555373(0xec),'id':_0x212727['id']}),_0x193d5c[_0x555373(0x168)][_0x555373(0x11c)][_0x555373(0xec)]++);}else _0x193d5c[_0x555373(0x11c)][_0x555373(0x1b6)]({'name':_0xe827d[_0x555373(0xf3)][_0x555373(0x167)],'action':_0x555373(0x1b0)}),_0x193d5c[_0x555373(0x168)]['integrations'][_0x555373(0x1b0)]++;}for(const _0x71cb32 of _0x4c5bec){const _0x4b1cc4=_0x1de75a['get'](_0x71cb32['def'][_0x555373(0x1f1)]),_0x431c82=toExperimentalKnowledgeBaseYamlString(_0x71cb32[_0x555373(0x10b)]);let _0x3a0ff8=_0x431c82;for(const _0x111ec8 of _0x71cb32[_0x555373(0x10b)]['functions']){_0x3a0ff8+=_0x555373(0x19c)+_0x111ec8[_0x555373(0x1f1)]+'\x20---\x0a'+_0x111ec8[_0x555373(0x1bd)]+_0x555373(0x16c)+_0x111ec8[_0x555373(0x1f1)]+'\x20---\x0a'+_0x111ec8[_0x555373(0x1d9)]+'\x0a';}if(_0x4b1cc4){const _0x1cd880=apiExperimentalKnowledgeBaseToYaml(_0x4b1cc4),_0x413d3f=toExperimentalKnowledgeBaseYamlString(_0x1cd880);let _0x5cd615=_0x413d3f;for(const _0x2b6491 of _0x1cd880[_0x555373(0x16f)]){_0x5cd615+=_0x555373(0x19c)+_0x2b6491[_0x555373(0x1f1)]+_0x555373(0x1cc)+_0x2b6491['code']+'\x0a---\x20schema:\x20'+_0x2b6491[_0x555373(0x1f1)]+_0x555373(0x1cc)+_0x2b6491[_0x555373(0x1d9)]+'\x0a';}const _0x47178e=generateDiff(_0x5cd615,_0x3a0ff8),_0x345b66=hasChanges(_0x47178e);_0x345b66?(_0x193d5c[_0x555373(0x1e7)][_0x555373(0x1b6)]({'name':_0x71cb32[_0x555373(0x10b)][_0x555373(0x1f1)],'action':'updated','id':_0x4b1cc4['id'],'diff':formatDiffWithColors(_0x47178e)}),_0x193d5c[_0x555373(0x168)]['experimentalKnowledgeBases']['updated']++):(_0x193d5c[_0x555373(0x1e7)]['push']({'name':_0x71cb32[_0x555373(0x10b)][_0x555373(0x1f1)],'action':_0x555373(0xec),'id':_0x4b1cc4['id']}),_0x193d5c[_0x555373(0x168)]['experimentalKnowledgeBases'][_0x555373(0xec)]++);}else _0x193d5c[_0x555373(0x1e7)][_0x555373(0x1b6)]({'name':_0x71cb32[_0x555373(0x10b)][_0x555373(0x1f1)],'action':_0x555373(0x1b0)}),_0x193d5c['counts']['experimentalKnowledgeBases'][_0x555373(0x1b0)]++;}for(const _0x396e45 of _0x49ff35){const _0x1639a3=_0x4f22a8[_0x555373(0x202)](_0x396e45[_0x555373(0x10b)][_0x555373(0x1f1)]),_0x4732f5=toExperimentalArtifactYamlString(_0x396e45['def']);let _0xdbe80c=_0x4732f5+(_0x555373(0x1f7)+_0x396e45[_0x555373(0x10b)][_0x555373(0x1bd)]+'\x0a');for(const _0xf75a13 of _0x396e45[_0x555373(0x10b)][_0x555373(0x116)]){_0xdbe80c+='---\x20file:\x20'+_0xf75a13[_0x555373(0x132)]+_0x555373(0x1cc)+_0xf75a13[_0x555373(0x121)]+'\x0a';}if(_0x1639a3){const _0x42be90=apiExperimentalArtifactToYaml(_0x1639a3),_0x2a4ece=toExperimentalArtifactYamlString(_0x42be90);let _0x4e8312=_0x2a4ece+(_0x555373(0x1f7)+_0x42be90['code']+'\x0a');for(const _0x7b4778 of _0x42be90[_0x555373(0x116)]){_0x4e8312+=_0x555373(0x187)+_0x7b4778[_0x555373(0x132)]+'\x20---\x0a'+_0x7b4778['text_content']+'\x0a';}const _0xa864b8=generateDiff(_0x4e8312,_0xdbe80c),_0x14697d=hasChanges(_0xa864b8);_0x14697d?(_0x193d5c['experimentalArtifacts']['push']({'name':_0x396e45[_0x555373(0x10b)][_0x555373(0x1f1)],'action':_0x555373(0x17d),'id':_0x1639a3['id'],'diff':formatDiffWithColors(_0xa864b8)}),_0x193d5c[_0x555373(0x168)][_0x555373(0x17b)][_0x555373(0x17d)]++):(_0x193d5c['experimentalArtifacts'][_0x555373(0x1b6)]({'name':_0x396e45[_0x555373(0x10b)]['name'],'action':_0x555373(0xec),'id':_0x1639a3['id']}),_0x193d5c['counts'][_0x555373(0x17b)]['unchanged']++);}else _0x193d5c[_0x555373(0x17b)][_0x555373(0x1b6)]({'name':_0x396e45[_0x555373(0x10b)]['name'],'action':_0x555373(0x1b0)}),_0x193d5c[_0x555373(0x168)][_0x555373(0x17b)][_0x555373(0x1b0)]++;}for(const _0x1312bb of _0x321751){const _0x1e1e40=_0xb601d1['get'](_0x1312bb['yaml']['name']),_0x52fc30=a135_0x4da327[_0x555373(0x1e0)](_0x1312bb[_0x555373(0x10a)],_0x555373(0x180));if(_0x1e1e40){const _0x41d200=await apiFormInterfaceToYaml(_0x1e1e40,_0x5452ad),_0x124061=toFormInterfaceYamlString(_0x41d200),_0x1d00aa=generateDiff(_0x124061,_0x52fc30),_0x422dcd=hasChanges(_0x1d00aa);_0x422dcd?(_0x193d5c[_0x555373(0x1e3)][_0x555373(0x1b6)]({'name':_0x1312bb[_0x555373(0xf3)][_0x555373(0x1f1)],'action':_0x555373(0x17d),'id':_0x1e1e40['id'],'diff':formatDiffWithColors(_0x1d00aa)}),_0x193d5c[_0x555373(0x168)][_0x555373(0x1e3)][_0x555373(0x17d)]++):(_0x193d5c[_0x555373(0x1e3)][_0x555373(0x1b6)]({'name':_0x1312bb['yaml'][_0x555373(0x1f1)],'action':_0x555373(0xec),'id':_0x1e1e40['id']}),_0x193d5c[_0x555373(0x168)][_0x555373(0x1e3)]['unchanged']++);}else _0x193d5c[_0x555373(0x1e3)][_0x555373(0x1b6)]({'name':_0x1312bb[_0x555373(0xf3)][_0x555373(0x1f1)],'action':_0x555373(0x1b0)}),_0x193d5c['counts'][_0x555373(0x1e3)]['created']++;}for(const _0x1519b7 of _0x31b865){const _0x567b2e=_0x3ab76b[_0x555373(0x202)](_0x1519b7[_0x555373(0xf3)][_0x555373(0x1f1)]),_0x412d66=a135_0x4da327[_0x555373(0x1e0)](_0x1519b7[_0x555373(0x10a)],_0x555373(0x180));if(_0x567b2e){const _0x363421=await apiChatInterfaceToYaml(_0x567b2e,_0x5452ad),_0x3ac293=toChatInterfaceYamlString(_0x363421),_0x404c5f=generateDiff(_0x3ac293,_0x412d66),_0x44f7ef=hasChanges(_0x404c5f);_0x44f7ef?(_0x193d5c[_0x555373(0x13d)][_0x555373(0x1b6)]({'name':_0x1519b7[_0x555373(0xf3)]['name'],'action':_0x555373(0x17d),'id':_0x567b2e['id'],'diff':formatDiffWithColors(_0x404c5f)}),_0x193d5c[_0x555373(0x168)][_0x555373(0x13d)]['updated']++):(_0x193d5c['chatInterfaces'][_0x555373(0x1b6)]({'name':_0x1519b7[_0x555373(0xf3)][_0x555373(0x1f1)],'action':_0x555373(0xec),'id':_0x567b2e['id']}),_0x193d5c['counts'][_0x555373(0x13d)][_0x555373(0xec)]++);}else _0x193d5c['chatInterfaces'][_0x555373(0x1b6)]({'name':_0x1519b7[_0x555373(0xf3)][_0x555373(0x1f1)],'action':_0x555373(0x1b0)}),_0x193d5c['counts'][_0x555373(0x13d)][_0x555373(0x1b0)]++;}if(_0x4722c9?.[_0x555373(0x175)])return _0x193d5c;_0x193d5c['knowledgeBases']=[],_0x193d5c[_0x555373(0x1ce)]=[],_0x193d5c['prompts']=[],_0x193d5c[_0x555373(0x11c)]=[],_0x193d5c['experimentalKnowledgeBases']=[],_0x193d5c[_0x555373(0x17b)]=[],_0x193d5c['formInterfaces']=[],_0x193d5c[_0x555373(0x13d)]=[];const _0x5a0634=_0x193d5c[_0x555373(0x174)][_0x555373(0xee)](_0x2e5248=>_0x2e5248[_0x555373(0x11d)]==='error');_0x193d5c[_0x555373(0x174)]=_0x5a0634,_0x193d5c[_0x555373(0x168)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x5a0634[_0x555373(0x1ac)]},'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 _0x461c74 of _0x247825){try{const _0x55fa0f=_0x554484[_0x555373(0x202)](_0x461c74[_0x555373(0xf3)]['name']),_0x3934f1=yamlKnowledgeBaseToApi(_0x461c74[_0x555373(0xf3)],_0xbbd9ec);if(_0x55fa0f)await this['client'][_0x555373(0xfb)](_0x55fa0f['id'],_0x3934f1),_0x5e9651['set'](_0x461c74[_0x555373(0xf3)][_0x555373(0x1f1)],_0x55fa0f['id']),_0x193d5c[_0x555373(0x195)][_0x555373(0x1b6)]({'name':_0x461c74[_0x555373(0xf3)]['name'],'action':_0x555373(0x17d),'id':_0x55fa0f['id']}),_0x193d5c[_0x555373(0x168)]['knowledgeBases']['updated']++;else{const _0x4e9e04=await this[_0x555373(0x120)]['createKnowledgeBase'](_0x3934f1);_0x5e9651[_0x555373(0xfc)](_0x461c74[_0x555373(0xf3)][_0x555373(0x1f1)],_0x4e9e04['id']),_0x193d5c[_0x555373(0x195)][_0x555373(0x1b6)]({'name':_0x461c74['yaml'][_0x555373(0x1f1)],'action':_0x555373(0x1b0),'id':_0x4e9e04['id']}),_0x193d5c[_0x555373(0x168)][_0x555373(0x195)][_0x555373(0x1b0)]++;}}catch(_0x416c2d){_0x193d5c[_0x555373(0x195)][_0x555373(0x1b6)]({'name':_0x461c74['yaml'][_0x555373(0x1f1)],'action':'error','error':_0x416c2d[_0x555373(0x11a)]}),_0x193d5c[_0x555373(0x168)][_0x555373(0x195)][_0x555373(0x13e)]++;}}for(const _0x18637d of _0x3019e8){try{const _0x51ab80=_0x274dab[_0x555373(0x202)](_0x18637d[_0x555373(0x1f1)]),_0x3e6609=yamlTextKnowledgeBaseToApi({'name':_0x18637d['name'],'text':_0x18637d['text']},_0xbbd9ec);if(_0x51ab80)await this['client'][_0x555373(0x12d)](_0x51ab80['id'],_0x3e6609),_0x18a4a0[_0x555373(0xfc)](_0x18637d['name'],_0x51ab80['id']),_0x193d5c[_0x555373(0x1ce)][_0x555373(0x1b6)]({'name':_0x18637d[_0x555373(0x1f1)],'action':_0x555373(0x17d),'id':_0x51ab80['id']}),_0x193d5c[_0x555373(0x168)][_0x555373(0x1ce)][_0x555373(0x17d)]++;else{const _0x2c539e=await this[_0x555373(0x120)]['createTextKnowledgeBase'](_0x3e6609);_0x18a4a0['set'](_0x18637d[_0x555373(0x1f1)],_0x2c539e['id']),_0x193d5c['textKnowledgeBases'][_0x555373(0x1b6)]({'name':_0x18637d[_0x555373(0x1f1)],'action':'created','id':_0x2c539e['id']}),_0x193d5c['counts'][_0x555373(0x1ce)]['created']++;}}catch(_0x99bd0c){_0x193d5c['textKnowledgeBases'][_0x555373(0x1b6)]({'name':_0x18637d['name'],'action':_0x555373(0x106),'error':_0x99bd0c[_0x555373(0x11a)]}),_0x193d5c[_0x555373(0x168)][_0x555373(0x1ce)][_0x555373(0x13e)]++;}}for(const _0x162b15 of _0x4c5bec){try{const _0x26821e=_0x1de75a[_0x555373(0x202)](_0x162b15['def'][_0x555373(0x1f1)]),_0x472216=yamlExperimentalKnowledgeBaseToApi(_0x162b15[_0x555373(0x10b)],_0xbbd9ec);if(_0x26821e)await this[_0x555373(0x120)][_0x555373(0x100)](_0x26821e['id'],_0x472216),_0x46c29d['set'](_0x162b15[_0x555373(0x10b)][_0x555373(0x1f1)],_0x26821e['id']),_0x193d5c['experimentalKnowledgeBases']['push']({'name':_0x162b15[_0x555373(0x10b)][_0x555373(0x1f1)],'action':'updated','id':_0x26821e['id']}),_0x193d5c[_0x555373(0x168)][_0x555373(0x1e7)]['updated']++;else{const _0xb54fc1=await this[_0x555373(0x120)]['createExperimentalKnowledgeBase'](_0x472216);_0x46c29d['set'](_0x162b15[_0x555373(0x10b)][_0x555373(0x1f1)],_0xb54fc1['id']),_0x193d5c[_0x555373(0x1e7)][_0x555373(0x1b6)]({'name':_0x162b15[_0x555373(0x10b)][_0x555373(0x1f1)],'action':'created','id':_0xb54fc1['id']}),_0x193d5c['counts']['experimentalKnowledgeBases']['created']++;}}catch(_0x3efc87){_0x193d5c[_0x555373(0x1e7)][_0x555373(0x1b6)]({'name':_0x162b15[_0x555373(0x10b)][_0x555373(0x1f1)],'action':_0x555373(0x106),'error':_0x3efc87[_0x555373(0x11a)]}),_0x193d5c['counts'][_0x555373(0x1e7)][_0x555373(0x13e)]++;}}for(const _0x5ed0dd of _0x49ff35){try{const _0x57478f=_0x4f22a8[_0x555373(0x202)](_0x5ed0dd['def'][_0x555373(0x1f1)]),_0x1e68f1=yamlExperimentalArtifactToApi(_0x5ed0dd[_0x555373(0x10b)],_0xbbd9ec);if(_0x57478f)await this[_0x555373(0x120)][_0x555373(0x1f8)](_0x57478f['id'],_0x1e68f1),_0x7cb4f8['set'](_0x5ed0dd[_0x555373(0x10b)]['name'],_0x57478f['id']),_0x193d5c[_0x555373(0x17b)][_0x555373(0x1b6)]({'name':_0x5ed0dd[_0x555373(0x10b)][_0x555373(0x1f1)],'action':_0x555373(0x17d),'id':_0x57478f['id']}),_0x193d5c[_0x555373(0x168)][_0x555373(0x17b)][_0x555373(0x17d)]++;else{const _0x5344e7=await this[_0x555373(0x120)][_0x555373(0x101)](_0x1e68f1);_0x7cb4f8[_0x555373(0xfc)](_0x5ed0dd['def']['name'],_0x5344e7['id']),_0x193d5c[_0x555373(0x17b)][_0x555373(0x1b6)]({'name':_0x5ed0dd[_0x555373(0x10b)][_0x555373(0x1f1)],'action':_0x555373(0x1b0),'id':_0x5344e7['id']}),_0x193d5c[_0x555373(0x168)][_0x555373(0x17b)]['created']++;}}catch(_0x36e58e){_0x193d5c[_0x555373(0x17b)][_0x555373(0x1b6)]({'name':_0x5ed0dd[_0x555373(0x10b)][_0x555373(0x1f1)],'action':_0x555373(0x106),'error':_0x36e58e[_0x555373(0x11a)]}),_0x193d5c[_0x555373(0x168)][_0x555373(0x17b)][_0x555373(0x13e)]++;}}for(const _0x402838 of _0x41d4d1){_0x142d3a=[];try{const _0x3173ac=_0x35e835[_0x555373(0x202)](_0x402838[_0x555373(0xf3)]['name']),_0x506213=await agentDefToRequest(_0x402838['yaml'],_0x402838[_0x555373(0x108)],_0x402838['starterMessage'],_0x37bd1a);if(_0x3173ac)await this[_0x555373(0x120)][_0x555373(0x1d5)](_0x3173ac['id'],_0x506213),_0x452576[_0x555373(0xfc)](_0x402838[_0x555373(0xf3)][_0x555373(0x1f1)],_0x3173ac['id']),_0x193d5c[_0x555373(0x174)][_0x555373(0x1b6)]({'agentName':_0x402838[_0x555373(0xf3)][_0x555373(0x1f1)],'action':_0x555373(0x17d),'agentId':_0x3173ac['id'],'warnings':_0x142d3a['length']>0x0?_0x142d3a:undefined}),_0x193d5c['counts'][_0x555373(0x174)]['updated']++;else{const _0x13fc73=await this[_0x555373(0x120)][_0x555373(0x113)](_0x506213);_0x452576[_0x555373(0xfc)](_0x402838['yaml']['name'],_0x13fc73['id']),_0x193d5c[_0x555373(0x174)][_0x555373(0x1b6)]({'agentName':_0x402838['yaml'][_0x555373(0x1f1)],'action':'created','agentId':_0x13fc73['id'],'warnings':_0x142d3a['length']>0x0?_0x142d3a:undefined}),_0x193d5c[_0x555373(0x168)][_0x555373(0x174)][_0x555373(0x1b0)]++;}}catch(_0x29db71){_0x193d5c[_0x555373(0x174)][_0x555373(0x1b6)]({'agentName':_0x402838['yaml'][_0x555373(0x1f1)],'action':_0x555373(0x106),'error':_0x29db71[_0x555373(0x11a)],'warnings':_0x142d3a[_0x555373(0x1ac)]>0x0?_0x142d3a:undefined}),_0x193d5c['counts'][_0x555373(0x174)][_0x555373(0x13e)]++;}}for(const _0xa29195 of _0x53756e){try{const _0xe5bdb9=_0x2a17db[_0x555373(0x202)](_0xa29195[_0x555373(0xf3)][_0x555373(0x1f1)]),_0x556ab5=await yamlPromptToApi(_0xa29195[_0x555373(0xf3)],_0xbbd9ec,_0x37bd1a);if(!_0x556ab5){_0x193d5c[_0x555373(0x1e9)]['push']({'name':_0xa29195[_0x555373(0xf3)][_0x555373(0x1f1)],'action':_0x555373(0x106),'error':_0x555373(0xeb)}),_0x193d5c[_0x555373(0x168)][_0x555373(0x1e9)]['errors']++;continue;}if(_0xe5bdb9)await this[_0x555373(0x120)][_0x555373(0x1bc)](_0xe5bdb9['id'],_0x556ab5),_0x2bad36[_0x555373(0xfc)](_0xa29195[_0x555373(0xf3)]['name'],_0xe5bdb9['id']),_0x193d5c['prompts'][_0x555373(0x1b6)]({'name':_0xa29195[_0x555373(0xf3)][_0x555373(0x1f1)],'action':_0x555373(0x17d),'id':_0xe5bdb9['id']}),_0x193d5c[_0x555373(0x168)][_0x555373(0x1e9)][_0x555373(0x17d)]++;else{const _0x181d42=await this['client'][_0x555373(0x1c9)](_0x556ab5);_0x2bad36[_0x555373(0xfc)](_0xa29195['yaml'][_0x555373(0x1f1)],_0x181d42['id']),_0x193d5c[_0x555373(0x1e9)]['push']({'name':_0xa29195[_0x555373(0xf3)][_0x555373(0x1f1)],'action':_0x555373(0x1b0),'id':_0x181d42['id']}),_0x193d5c['counts'][_0x555373(0x1e9)][_0x555373(0x1b0)]++;}}catch(_0x14caa2){_0x193d5c['prompts'][_0x555373(0x1b6)]({'name':_0xa29195[_0x555373(0xf3)][_0x555373(0x1f1)],'action':'error','error':_0x14caa2['message']}),_0x193d5c[_0x555373(0x168)][_0x555373(0x1e9)][_0x555373(0x13e)]++;}}for(const _0x2c6c86 of _0x8bacf0){try{const _0x2e4f9e=_0x4fab11[_0x555373(0x202)](_0x2c6c86['yaml']['service_type']),_0x38f531=await yamlIntegrationToApi(_0x2c6c86[_0x555373(0xf3)],_0xbbd9ec,_0x37bd1a);if(_0x2e4f9e){await this[_0x555373(0x120)][_0x555373(0x162)](_0x2e4f9e['id']);const _0x3546ef=await this['client']['createIntegration'](_0x38f531);_0x193d5c['integrations']['push']({'name':_0x2c6c86['yaml'][_0x555373(0x167)],'action':_0x555373(0x17d),'id':_0x3546ef['id']}),_0x193d5c[_0x555373(0x168)][_0x555373(0x11c)][_0x555373(0x17d)]++;}else{const _0x544d2e=await this[_0x555373(0x120)][_0x555373(0x17e)](_0x38f531);_0x193d5c['integrations']['push']({'name':_0x2c6c86[_0x555373(0xf3)]['service_type'],'action':_0x555373(0x1b0),'id':_0x544d2e['id']}),_0x193d5c['counts'][_0x555373(0x11c)][_0x555373(0x1b0)]++;}}catch(_0x184e5b){_0x193d5c[_0x555373(0x11c)][_0x555373(0x1b6)]({'name':_0x2c6c86[_0x555373(0xf3)][_0x555373(0x167)],'action':_0x555373(0x106),'error':_0x184e5b[_0x555373(0x11a)]}),_0x193d5c[_0x555373(0x168)][_0x555373(0x11c)]['errors']++;}}for(const _0x45d6dd of _0x321751){try{const _0x22f840=_0xb601d1['get'](_0x45d6dd[_0x555373(0xf3)][_0x555373(0x1f1)]),_0x575574=await yamlFormInterfaceToApi(_0x45d6dd['yaml'],_0xbbd9ec,_0x37bd1a);if(!_0x575574){_0x193d5c[_0x555373(0x1e3)][_0x555373(0x1b6)]({'name':_0x45d6dd[_0x555373(0xf3)][_0x555373(0x1f1)],'action':_0x555373(0x106),'error':_0x555373(0x1ea)}),_0x193d5c[_0x555373(0x168)][_0x555373(0x1e3)]['errors']++;continue;}if(_0x22f840){const _0x3d2efb=await this['client']['updateFormInterface'](_0x22f840['id'],_0x575574);_0x193d5c[_0x555373(0x1e3)][_0x555373(0x1b6)]({'name':_0x45d6dd[_0x555373(0xf3)]['name'],'action':'updated','id':_0x3d2efb['id']}),_0x193d5c['counts'][_0x555373(0x1e3)][_0x555373(0x17d)]++;}else{const _0x2ff32c=await this[_0x555373(0x120)]['createFormInterface'](_0x575574);_0x193d5c[_0x555373(0x1e3)][_0x555373(0x1b6)]({'name':_0x45d6dd[_0x555373(0xf3)][_0x555373(0x1f1)],'action':_0x555373(0x1b0),'id':_0x2ff32c['id']}),_0x193d5c[_0x555373(0x168)][_0x555373(0x1e3)][_0x555373(0x1b0)]++;}}catch(_0x6cf907){_0x193d5c[_0x555373(0x1e3)][_0x555373(0x1b6)]({'name':_0x45d6dd[_0x555373(0xf3)]['name'],'action':'error','error':_0x6cf907[_0x555373(0x11a)]}),_0x193d5c[_0x555373(0x168)][_0x555373(0x1e3)][_0x555373(0x13e)]++;}}for(const _0x532c57 of _0x31b865){try{const _0x2bdd63=_0x3ab76b[_0x555373(0x202)](_0x532c57[_0x555373(0xf3)][_0x555373(0x1f1)]),_0x27cf9e=await yamlChatInterfaceToApi(_0x532c57['yaml'],_0xbbd9ec,_0x37bd1a);if(_0x2bdd63){const _0x1f3c65=await this[_0x555373(0x120)][_0x555373(0x193)](_0x2bdd63['id'],_0x27cf9e);_0x193d5c[_0x555373(0x13d)]['push']({'name':_0x532c57[_0x555373(0xf3)][_0x555373(0x1f1)],'action':_0x555373(0x17d),'id':_0x1f3c65['id']}),_0x193d5c[_0x555373(0x168)][_0x555373(0x13d)][_0x555373(0x17d)]++;}else{const _0x3dbf7e=await this[_0x555373(0x120)][_0x555373(0x1c0)](_0x27cf9e);_0x193d5c[_0x555373(0x13d)][_0x555373(0x1b6)]({'name':_0x532c57[_0x555373(0xf3)][_0x555373(0x1f1)],'action':_0x555373(0x1b0),'id':_0x3dbf7e['id']}),_0x193d5c[_0x555373(0x168)]['chatInterfaces'][_0x555373(0x1b0)]++;}}catch(_0x48431e){_0x193d5c[_0x555373(0x13d)][_0x555373(0x1b6)]({'name':_0x532c57[_0x555373(0xf3)][_0x555373(0x1f1)],'action':'error','error':_0x48431e[_0x555373(0x11a)]}),_0x193d5c[_0x555373(0x168)][_0x555373(0x13d)][_0x555373(0x13e)]++;}}return _0x193d5c;}async['pullAgent'](_0x5efe8,_0x47f3d8,_0x5e74db,_0xa122b4){const _0x55e861=a135_0x10eab9,{projectId:_0x4eb589,project:_0x2190f1}=await this['resolveProjectName'](_0x5efe8),_0x364569=_0x2190f1[_0x55e861(0xf0)][_0x55e861(0x1f1)],_0x471424=await this[_0x55e861(0x120)][_0x55e861(0x1f4)](_0x4eb589),_0x37d642=_0x471424[_0x55e861(0x203)](_0x5a6b91=>_0x5a6b91['attributes'][_0x55e861(0x1f1)]===_0x47f3d8);if(!_0x37d642)throw new SDKError(ErrorCode[_0x55e861(0x1a3)],_0x55e861(0x16e)+_0x47f3d8,undefined,{'helpText':_0x55e861(0x19a)+_0x471424['map'](_0x46603e=>_0x46603e['attributes'][_0x55e861(0x1f1)])[_0x55e861(0x1b8)](',\x20')});let _0x13f3f2;if(_0x5e74db)_0x13f3f2=_0x5e74db;else{const _0x12b176=a135_0x57e5bb[_0x55e861(0x1b8)](process[_0x55e861(0xf7)](),_0x55e861(0x174)),_0x1aedc2=getSanitizedPathWithMigration(_0x12b176,_0x364569);_0x1aedc2[_0x55e861(0x13b)]&&this[_0x55e861(0x165)]['info'](_0x55e861(0x161)+a135_0x57e5bb[_0x55e861(0xfe)](_0x1aedc2['oldPath'])+_0x55e861(0x1ad)+a135_0x57e5bb[_0x55e861(0xfe)](_0x1aedc2[_0x55e861(0x10a)])),_0x13f3f2=_0x1aedc2[_0x55e861(0x10a)];}const _0x90c919=getSanitizedPathWithMigration(_0x13f3f2,_0x47f3d8);_0x90c919[_0x55e861(0x13b)]&&this['logger'][_0x55e861(0x10e)](_0x55e861(0x1bf)+a135_0x57e5bb[_0x55e861(0xfe)](_0x90c919[_0x55e861(0x122)])+_0x55e861(0x1ad)+a135_0x57e5bb[_0x55e861(0xfe)](_0x90c919['path']));const _0x34d0a5=_0x90c919[_0x55e861(0x10a)],_0x391b20=new Map(),_0x576b8c=new Map(),_0x4c59de=await this[_0x55e861(0x120)]['listKnowledgeBases'](_0x4eb589),_0x12237d=await this[_0x55e861(0x120)]['listTextKnowledgeBases'](_0x4eb589),_0x5a5fe2=await safeListOrEmpty(()=>this['client'][_0x55e861(0x115)](_0x4eb589)),_0x5eb487=new Map(),_0x444751=new Map();for(const _0x16fce1 of _0x4c59de){_0x391b20[_0x55e861(0xfc)](_0x16fce1['id'],_0x16fce1[_0x55e861(0xf0)][_0x55e861(0x1f1)]);}for(const _0x478023 of _0x12237d){_0x5eb487[_0x55e861(0xfc)](_0x478023['id'],_0x478023[_0x55e861(0xf0)][_0x55e861(0x1f1)]);}for(const _0x1ab831 of _0x5a5fe2){_0x444751[_0x55e861(0xfc)](_0x1ab831['id'],_0x1ab831[_0x55e861(0xf0)][_0x55e861(0x1f1)]);}for(const _0x41acb9 of _0x471424){_0x576b8c[_0x55e861(0xfc)](_0x41acb9['id'],_0x41acb9[_0x55e861(0xf0)][_0x55e861(0x1f1)]);}const _0x3b20e3={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x391b20,'TextKnowledgeBase':_0x5eb487,'Agent':_0x576b8c,'ExperimentalKnowledgeBase':_0x444751}),'resolvePromptName':async()=>undefined,'onWarning':_0x96c23e=>this[_0x55e861(0x165)][_0x55e861(0x1dd)](_0x96c23e)},_0x5ccc44=a135_0x57e5bb[_0x55e861(0x1b8)](_0x34d0a5,_0x55e861(0x185)),_0x485676=a135_0x57e5bb['join'](_0x34d0a5,'agent.yml'),_0x299b55=a135_0x57e5bb[_0x55e861(0x1b8)](_0x34d0a5,_0x55e861(0x1b1)),_0x5ae3a5=!a135_0x4da327[_0x55e861(0x1e2)](_0x485676);if(_0xa122b4?.[_0x55e861(0x175)])return{'agentName':_0x47f3d8,'outputPath':_0x34d0a5,'isNew':_0x5ae3a5,'hasChanges':!![]};a135_0x4da327['mkdirSync'](_0x13f3f2,{'recursive':!![]}),a135_0x4da327['mkdirSync'](_0x34d0a5,{'recursive':!![]});const _0x301e92=a135_0x57e5bb['join'](_0x13f3f2,_0x55e861(0x15d));!a135_0x4da327[_0x55e861(0x1e2)](_0x301e92)&&a135_0x4da327['writeFileSync'](_0x301e92,createAgentConfigContent(_0x5efe8));const {yaml:_0x344e5b,systemPrompt:_0x34b429,starterMessage:_0x38c734}=await agentResponseToDef(_0x37d642,_0x3b20e3);let _0x4ca706=_0x5ae3a5;if(!_0x5ae3a5){const _0xd7561f=a135_0x4da327[_0x55e861(0x1e2)](_0x5ccc44)?a135_0x4da327['readFileSync'](_0x5ccc44,_0x55e861(0x180)):'',_0x33d760=a135_0x4da327['readFileSync'](_0x485676,'utf-8');_0x4ca706=_0xd7561f!==_0x34b429||_0x33d760!==toAgentYamlString(_0x344e5b);}a135_0x4da327[_0x55e861(0x1a9)](_0x5ccc44,_0x34b429),a135_0x4da327['writeFileSync'](_0x485676,toAgentYamlString(_0x344e5b));if(_0x38c734&&_0x38c734[_0x55e861(0x11f)]('\x0a'))a135_0x4da327[_0x55e861(0x1a9)](_0x299b55,_0x38c734);else a135_0x4da327[_0x55e861(0x1e2)](_0x299b55)&&a135_0x4da327[_0x55e861(0x10f)](_0x299b55);return{'agentName':_0x47f3d8,'outputPath':_0x34d0a5,'isNew':_0x5ae3a5,'hasChanges':_0x4ca706};}async[a135_0x10eab9(0x123)](_0xb30b32,_0x39b9e6){const _0x2e6f94=a135_0x10eab9;let _0x2b20be;isAgentYamlPath(_0xb30b32)?_0x2b20be=getAgentDirFromYamlPath(_0xb30b32):_0x2b20be=_0xb30b32;const {config:_0x599c0f}=findAgentConfig(_0x2b20be),_0x476c21=await this['resolveProjectId'](_0x599c0f[_0x2e6f94(0x17c)]),_0x32b3f4=a135_0x57e5bb[_0x2e6f94(0x1b8)](_0x2b20be,_0x2e6f94(0x11e)),_0x38e26a=a135_0x57e5bb[_0x2e6f94(0x1b8)](_0x2b20be,'prompt.md'),_0x23144c=a135_0x57e5bb[_0x2e6f94(0x1b8)](_0x2b20be,'starter_message.md');if(!a135_0x4da327[_0x2e6f94(0x1e2)](_0x32b3f4))throw new SDKError(ErrorCode[_0x2e6f94(0x134)],_0x2e6f94(0x124)+_0x2b20be,undefined,{'helpText':'Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.'});const _0x3a78c2=parseAgentYaml(a135_0x4da327['readFileSync'](_0x32b3f4,'utf-8'),_0x32b3f4),_0x1eaa1d=a135_0x4da327[_0x2e6f94(0x1e2)](_0x38e26a)?a135_0x4da327[_0x2e6f94(0x1e0)](_0x38e26a,'utf-8'):'',_0x505f9d=a135_0x4da327[_0x2e6f94(0x1e2)](_0x23144c)?a135_0x4da327[_0x2e6f94(0x1e0)](_0x23144c,_0x2e6f94(0x180)):_0x3a78c2[_0x2e6f94(0x104)];if(_0x39b9e6?.['dryRun'])return{'agentName':_0x3a78c2['name'],'action':'created','projectId':_0x476c21};const _0x104c88=await this['client'][_0x2e6f94(0x1f4)](_0x476c21),_0x26f03d=await fetchAllToolTargetMaps((_0x1b5161,_0x522d99)=>this['client']['listToolTargets'](_0x1b5161,_0x522d99),_0x476c21),_0x199f12=new Map();for(const _0x253acc of _0x104c88){_0x199f12[_0x2e6f94(0xfc)](_0x253acc[_0x2e6f94(0xf0)][_0x2e6f94(0x1f1)],_0x253acc['id']);}const _0x7515f3=[],_0x5f9a0b={'projectId':_0x476c21,'resolveToolTargetId':buildIdResolver({..._0x26f03d[_0x2e6f94(0x1c4)],'Agent':_0x199f12}),'resolvePromptId':async()=>undefined,'onWarning':_0x27fa25=>{const _0xcdb9d5=_0x2e6f94;this[_0xcdb9d5(0x165)][_0xcdb9d5(0x1dd)](_0x27fa25),_0x7515f3[_0xcdb9d5(0x1b6)](_0x27fa25);}};try{const _0x4d192f=_0x104c88[_0x2e6f94(0x203)](_0x5b19d4=>_0x5b19d4[_0x2e6f94(0xf0)][_0x2e6f94(0x1f1)]===_0x3a78c2[_0x2e6f94(0x1f1)]),_0x162ade=await agentDefToRequest(_0x3a78c2,_0x1eaa1d,_0x505f9d,_0x5f9a0b);if(_0x4d192f)return await this['client'][_0x2e6f94(0x1d5)](_0x4d192f['id'],_0x162ade),{'agentName':_0x3a78c2[_0x2e6f94(0x1f1)],'action':'updated','projectId':_0x476c21,'agentId':_0x4d192f['id'],'warnings':_0x7515f3[_0x2e6f94(0x1ac)]>0x0?_0x7515f3:undefined};else{const _0x2199de=await this[_0x2e6f94(0x120)]['createAgentResponse'](_0x162ade);return{'agentName':_0x3a78c2[_0x2e6f94(0x1f1)],'action':_0x2e6f94(0x1b0),'projectId':_0x476c21,'agentId':_0x2199de['id'],'warnings':_0x7515f3[_0x2e6f94(0x1ac)]>0x0?_0x7515f3:undefined};}}catch(_0x92b3b8){return{'agentName':_0x3a78c2['name'],'action':_0x2e6f94(0x106),'projectId':_0x476c21,'error':_0x92b3b8['message'],'warnings':_0x7515f3[_0x2e6f94(0x1ac)]>0x0?_0x7515f3:undefined};}}async['cloneProject'](_0x5c700d,_0x499537,_0x58b95b){const _0x1c381b=a135_0x10eab9,_0x457db5=a135_0x4da327['existsSync'](_0x5c700d)&&a135_0x4da327[_0x1c381b(0x1e2)](a135_0x57e5bb[_0x1c381b(0x1b8)](_0x5c700d,'tdx.json'));let _0x56beb0;const _0xdc7f48=[],_0x3969ba=[],_0x4aa339=[],_0x579b89=[],_0x3d3e03=[],_0x6087ed=[],_0x3a0f00=[],_0x527673=[],_0x1d2aae=[];if(_0x457db5){const _0x3a79cc=loadAgentConfig(a135_0x57e5bb[_0x1c381b(0x1b8)](_0x5c700d,'tdx.json'));_0x56beb0=_0x3a79cc[_0x1c381b(0x17c)];const _0x295702=a135_0x4da327['readdirSync'](_0x5c700d,{'withFileTypes':!![]});for(const _0x377333 of _0x295702){if(!_0x377333['isDirectory']())continue;if([_0x1c381b(0x1e5),'experimental_knowledge_bases','experimental_artifacts',_0x1c381b(0x1e9),_0x1c381b(0x11c),_0x1c381b(0x1f9),_0x1c381b(0x14c)][_0x1c381b(0x11f)](_0x377333['name']))continue;const _0x40fc57=a135_0x57e5bb[_0x1c381b(0x1b8)](_0x5c700d,_0x377333[_0x1c381b(0x1f1)]);if(isAgentDir(_0x40fc57)){const _0x521a6f=a135_0x57e5bb[_0x1c381b(0x1b8)](_0x40fc57,'agent.yml'),_0x476783=a135_0x57e5bb[_0x1c381b(0x1b8)](_0x40fc57,_0x1c381b(0x185)),_0xeb9296=a135_0x57e5bb[_0x1c381b(0x1b8)](_0x40fc57,_0x1c381b(0x1b1)),_0x546184=parseAgentYaml(a135_0x4da327[_0x1c381b(0x1e0)](_0x521a6f,_0x1c381b(0x180)),_0x521a6f),_0xd7058a=a135_0x4da327[_0x1c381b(0x1e2)](_0x476783)?a135_0x4da327['readFileSync'](_0x476783,'utf-8'):'',_0x1b4395=a135_0x4da327[_0x1c381b(0x1e2)](_0xeb9296)?a135_0x4da327[_0x1c381b(0x1e0)](_0xeb9296,_0x1c381b(0x180)):_0x546184[_0x1c381b(0x104)];_0xdc7f48[_0x1c381b(0x1b6)]({'name':_0x546184[_0x1c381b(0x1f1)],'dir':_0x40fc57,'yaml':_0x546184,'systemPrompt':_0xd7058a,'starterMessage':_0x1b4395});}}const _0x465d76=getKnowledgeBasesDir(_0x5c700d);if(a135_0x4da327[_0x1c381b(0x1e2)](_0x465d76)){const _0x9fc02d=a135_0x4da327[_0x1c381b(0x1d2)](_0x465d76);for(const _0x1c7b9b of _0x9fc02d){const _0x2407cf=a135_0x57e5bb[_0x1c381b(0x1b8)](_0x465d76,_0x1c7b9b);if(_0x1c7b9b['endsWith'](_0x1c381b(0x196))){const _0x19ef06=parseKnowledgeBaseYaml(a135_0x4da327[_0x1c381b(0x1e0)](_0x2407cf,_0x1c381b(0x180)),_0x2407cf);_0x3969ba['push']({'name':_0x19ef06[_0x1c381b(0x1f1)],'path':_0x2407cf,'yaml':_0x19ef06});}else{if(_0x1c7b9b['endsWith'](_0x1c381b(0x119))){const _0xb6277b=a135_0x4da327['readFileSync'](_0x2407cf,_0x1c381b(0x180)),{name:_0x3bd79b,text:_0x471ee6}=parseTextKnowledgeBaseMd(_0xb6277b,_0x1c7b9b);_0x4aa339['push']({'name':_0x3bd79b,'path':_0x2407cf,'text':_0x471ee6});}}}}const _0x14181d=getPromptsDir(_0x5c700d);if(a135_0x4da327[_0x1c381b(0x1e2)](_0x14181d)){const _0x32680b=a135_0x4da327[_0x1c381b(0x1d2)](_0x14181d)['filter'](_0x2926e2=>_0x2926e2[_0x1c381b(0xf9)]('.yml'));for(const _0x57c5f7 of _0x32680b){const _0x2c928b=a135_0x57e5bb['join'](_0x14181d,_0x57c5f7),_0x294550=parsePromptYaml(a135_0x4da327[_0x1c381b(0x1e0)](_0x2c928b,_0x1c381b(0x180)),_0x2c928b);_0x579b89[_0x1c381b(0x1b6)]({'name':_0x294550['name'],'path':_0x2c928b,'yaml':_0x294550});}}const _0x311eb8=getIntegrationsDir(_0x5c700d);if(a135_0x4da327[_0x1c381b(0x1e2)](_0x311eb8)){const _0x632f9c=a135_0x4da327[_0x1c381b(0x1d2)](_0x311eb8)[_0x1c381b(0xee)](_0x5b2fb8=>_0x5b2fb8[_0x1c381b(0xf9)]('.yml'));for(const _0x103447 of _0x632f9c){const _0x5783ce=a135_0x57e5bb['join'](_0x311eb8,_0x103447),_0x5a2cdc=parseIntegrationYaml(a135_0x4da327['readFileSync'](_0x5783ce,_0x1c381b(0x180)),_0x5783ce);SAFE_INTEGRATION_TYPES[_0x1c381b(0x11f)](_0x5a2cdc[_0x1c381b(0x167)][_0x1c381b(0xf2)]())?_0x3d3e03[_0x1c381b(0x1b6)]({'name':_0x5a2cdc['name'],'path':_0x5783ce,'yaml':_0x5a2cdc}):this['logger'][_0x1c381b(0x1dd)](_0x1c381b(0x1da)+_0x5a2cdc['name']+_0x1c381b(0x1eb)+_0x5a2cdc[_0x1c381b(0x167)]+_0x1c381b(0x146)+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x1c381b(0x11b)));}}const _0x51573b=getExperimentalKnowledgeBasesDir(_0x5c700d);if(a135_0x4da327[_0x1c381b(0x1e2)](_0x51573b)){const _0x532497=a135_0x4da327['readdirSync'](_0x51573b,{'withFileTypes':!![]});for(const _0x23a985 of _0x532497){if(!_0x23a985[_0x1c381b(0x191)]())continue;const _0x30b6c7=a135_0x57e5bb['join'](_0x51573b,_0x23a985[_0x1c381b(0x1f1)]),_0x3fd05b=a135_0x57e5bb[_0x1c381b(0x1b8)](_0x30b6c7,_0x23a985[_0x1c381b(0x1f1)]+'.yml');if(a135_0x4da327['existsSync'](_0x3fd05b)){const _0x4f8172=parseExperimentalKnowledgeBaseYaml(a135_0x4da327['readFileSync'](_0x3fd05b,_0x1c381b(0x180)),_0x3fd05b),_0x318e4d=a135_0x57e5bb[_0x1c381b(0x1b8)](_0x30b6c7,_0x1c381b(0x16f)),_0x241eaa=[];if(a135_0x4da327[_0x1c381b(0x1e2)](_0x318e4d)){const _0x269e43=a135_0x4da327[_0x1c381b(0x1d2)](_0x318e4d,{'withFileTypes':!![]});for(const _0x45ea89 of _0x269e43){if(!_0x45ea89['isDirectory']())continue;const _0x2adef5=a135_0x57e5bb['join'](_0x318e4d,_0x45ea89[_0x1c381b(0x1f1)]),_0x107b31=a135_0x57e5bb[_0x1c381b(0x1b8)](_0x2adef5,_0x1c381b(0x136)),_0x53ecc5=a135_0x57e5bb['join'](_0x2adef5,_0x1c381b(0x1d8));if(a135_0x4da327[_0x1c381b(0x1e2)](_0x107b31)&&a135_0x4da327[_0x1c381b(0x1e2)](_0x53ecc5)){const _0x22254c=a135_0x4da327[_0x1c381b(0x1e0)](_0x107b31,_0x1c381b(0x180)),_0x42dc0c=a135_0x4da327[_0x1c381b(0x1e0)](_0x53ecc5,_0x1c381b(0x180));_0x241eaa[_0x1c381b(0x1b6)]({'name':_0x45ea89[_0x1c381b(0x1f1)],'code':_0x22254c,'json_schema':_0x42dc0c});}}}const _0x112760={..._0x4f8172,'functions':_0x241eaa};_0x6087ed[_0x1c381b(0x1b6)]({'name':_0x4f8172['name'],'path':_0x30b6c7,'def':_0x112760});}}}const _0x2fec20=getExperimentalArtifactsDir(_0x5c700d);if(a135_0x4da327['existsSync'](_0x2fec20)){const _0x4cb55e=a135_0x4da327[_0x1c381b(0x1d2)](_0x2fec20,{'withFileTypes':!![]});for(const _0x5bf580 of _0x4cb55e){if(!_0x5bf580[_0x1c381b(0x191)]())continue;const _0x1149cb=a135_0x57e5bb[_0x1c381b(0x1b8)](_0x2fec20,_0x5bf580[_0x1c381b(0x1f1)]),_0x272811=a135_0x57e5bb['join'](_0x1149cb,_0x5bf580['name']+'.yml');if(a135_0x4da327[_0x1c381b(0x1e2)](_0x272811)){const _0x116702=parseExperimentalArtifactYaml(a135_0x4da327[_0x1c381b(0x1e0)](_0x272811,'utf-8'),_0x272811),_0x18e558=a135_0x57e5bb[_0x1c381b(0x1b8)](_0x1149cb,'code.js'),_0xad5809=a135_0x4da327[_0x1c381b(0x1e2)](_0x18e558)?a135_0x4da327[_0x1c381b(0x1e0)](_0x18e558,_0x1c381b(0x180)):'',_0x3c3ab1=a135_0x57e5bb[_0x1c381b(0x1b8)](_0x1149cb,_0x1c381b(0x116)),_0x165a15=[];if(a135_0x4da327['existsSync'](_0x3c3ab1)){const _0x186696=a135_0x4da327[_0x1c381b(0x1d2)](_0x3c3ab1);for(const _0xba9b8b of _0x186696){const _0x533098=a135_0x57e5bb[_0x1c381b(0x1b8)](_0x3c3ab1,_0xba9b8b);if(a135_0x4da327[_0x1c381b(0x105)](_0x533098)[_0x1c381b(0xed)]()){const _0x25acb5=a135_0x4da327['readFileSync'](_0x533098,'utf-8');_0x165a15[_0x1c381b(0x1b6)]({'file_name':_0xba9b8b,'text_content':_0x25acb5});}}}const _0xcc863b={..._0x116702,'code':_0xad5809,'files':_0x165a15};_0x3a0f00[_0x1c381b(0x1b6)]({'name':_0x116702[_0x1c381b(0x1f1)],'path':_0x1149cb,'def':_0xcc863b});}}}const _0x3eb94e=getFormInterfacesDir(_0x5c700d);if(a135_0x4da327[_0x1c381b(0x1e2)](_0x3eb94e)){const _0x8e307c=a135_0x4da327[_0x1c381b(0x1d2)](_0x3eb94e)[_0x1c381b(0xee)](_0x50756c=>_0x50756c['endsWith']('.yml'));for(const _0x173341 of _0x8e307c){const _0xfa17b=a135_0x57e5bb[_0x1c381b(0x1b8)](_0x3eb94e,_0x173341),_0x164f46=parseFormInterfaceYaml(a135_0x4da327[_0x1c381b(0x1e0)](_0xfa17b,'utf-8'),_0xfa17b);_0x527673[_0x1c381b(0x1b6)]({'name':_0x164f46[_0x1c381b(0x1f1)],'path':_0xfa17b,'yaml':_0x164f46});}}const _0x1dd387=getChatInterfacesDir(_0x5c700d);if(a135_0x4da327[_0x1c381b(0x1e2)](_0x1dd387)){const _0x272fc6=a135_0x4da327[_0x1c381b(0x1d2)](_0x1dd387)[_0x1c381b(0xee)](_0x2cce83=>_0x2cce83[_0x1c381b(0xf9)]('.yml'));for(const _0x240ea1 of _0x272fc6){const _0x10a663=a135_0x57e5bb[_0x1c381b(0x1b8)](_0x1dd387,_0x240ea1),_0x1f66e2=parseChatInterfaceYaml(a135_0x4da327['readFileSync'](_0x10a663,_0x1c381b(0x180)),_0x10a663);_0x1d2aae[_0x1c381b(0x1b6)]({'name':_0x1f66e2[_0x1c381b(0x1f1)],'path':_0x10a663,'yaml':_0x1f66e2});}}}else{const _0x132586=await this[_0x1c381b(0x200)](_0x5c700d),_0x5dedd3=await this[_0x1c381b(0x120)][_0x1c381b(0x149)](_0x132586);_0x56beb0=_0x5dedd3[_0x1c381b(0xf0)][_0x1c381b(0x1f1)];const _0x54de60=await this[_0x1c381b(0x120)]['listAgentsFull'](_0x132586),_0x48efa0=await this[_0x1c381b(0x120)][_0x1c381b(0xf4)](_0x132586),_0x530b06=await this['client']['listTextKnowledgeBases'](_0x132586),_0x264120=await this['client'][_0x1c381b(0x128)](_0x132586),_0x39f926=await this[_0x1c381b(0x120)][_0x1c381b(0x1de)](_0x132586),_0x357778=await safeListOrEmpty(()=>this['client'][_0x1c381b(0x115)](_0x132586)),_0x562de9=await safeListOrEmpty(()=>this[_0x1c381b(0x120)]['listExperimentalArtifacts'](_0x132586)),_0x129b77=new Map(),_0x4dd626=new Map(),_0x3f1c22=new Map(),_0x2e32da=new Map(),_0x2a295d=new Map(),_0x56e958=new Map();for(const _0x5c90dc of _0x48efa0){_0x129b77[_0x1c381b(0xfc)](_0x5c90dc['id'],_0x5c90dc[_0x1c381b(0xf0)][_0x1c381b(0x1f1)]);}for(const _0x3a8daa of _0x530b06){_0x4dd626[_0x1c381b(0xfc)](_0x3a8daa['id'],_0x3a8daa[_0x1c381b(0xf0)][_0x1c381b(0x1f1)]);}for(const _0x1c9868 of _0x54de60){_0x3f1c22[_0x1c381b(0xfc)](_0x1c9868['id'],_0x1c9868[_0x1c381b(0xf0)]['name']);}for(const _0x5cb5e9 of _0x264120){_0x2e32da['set'](_0x5cb5e9['id'],_0x5cb5e9[_0x1c381b(0xf0)]['name']);}for(const _0x2f2c32 of _0x357778){_0x2a295d[_0x1c381b(0xfc)](_0x2f2c32['id'],_0x2f2c32[_0x1c381b(0xf0)][_0x1c381b(0x1f1)]);}for(const _0x323cbd of _0x562de9){_0x56e958['set'](_0x323cbd['id'],_0x323cbd[_0x1c381b(0xf0)][_0x1c381b(0x1f1)]);}const _0x4cba15={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x129b77,'TextKnowledgeBase':_0x4dd626,'Agent':_0x3f1c22,'ExperimentalKnowledgeBase':_0x2a295d}),'resolvePromptName':async _0x159295=>_0x2e32da[_0x1c381b(0x202)](_0x159295),'onWarning':_0x2ca689=>this['logger']['warn'](_0x2ca689)};for(const _0x139bce of _0x54de60){const _0x29577e=await agentResponseToDef(_0x139bce,_0x4cba15),{yaml:_0x4c3fe8,systemPrompt:_0x2c922f,starterMessage:_0x513dda}=_0x29577e;_0xdc7f48[_0x1c381b(0x1b6)]({'name':_0x4c3fe8[_0x1c381b(0x1f1)],'dir':'','yaml':_0x4c3fe8,'systemPrompt':_0x2c922f,'starterMessage':_0x513dda});}for(const _0x6f5402 of _0x48efa0){const _0x2953ed=apiKnowledgeBaseToYaml(_0x6f5402);_0x3969ba[_0x1c381b(0x1b6)]({'name':_0x2953ed[_0x1c381b(0x1f1)],'path':'','yaml':_0x2953ed});}for(const _0x3618e2 of _0x530b06){_0x4aa339[_0x1c381b(0x1b6)]({'name':_0x3618e2[_0x1c381b(0xf0)][_0x1c381b(0x1f1)],'path':'','text':_0x3618e2[_0x1c381b(0xf0)]['text']});}for(const _0xee34d9 of _0x264120){const _0xfe7a96=await apiPromptToYaml(_0xee34d9,_0x4cba15);_0xfe7a96&&_0x579b89[_0x1c381b(0x1b6)]({'name':_0xfe7a96[_0x1c381b(0x1f1)],'path':'','yaml':_0xfe7a96});}for(const _0x56e65e of _0x39f926){if(!_0x56e65e[_0x1c381b(0xf0)][_0x1c381b(0x138)]&&SAFE_INTEGRATION_TYPES[_0x1c381b(0x11f)](_0x56e65e[_0x1c381b(0xf0)][_0x1c381b(0x114)][_0x1c381b(0xf2)]())){const _0x1590cb=await apiIntegrationToYaml(_0x56e65e,_0x4cba15);_0x3d3e03['push']({'name':_0x56e65e[_0x1c381b(0xf0)][_0x1c381b(0x114)]['toLowerCase'](),'path':'','yaml':_0x1590cb});}}for(const _0x17c7ed of _0x357778){const _0x565dc2=apiExperimentalKnowledgeBaseToYaml(_0x17c7ed);_0x6087ed[_0x1c381b(0x1b6)]({'name':_0x565dc2[_0x1c381b(0x1f1)],'path':'','def':_0x565dc2});}for(const _0x4345e2 of _0x562de9){const _0x285d80=apiExperimentalArtifactToYaml(_0x4345e2);_0x3a0f00['push']({'name':_0x285d80[_0x1c381b(0x1f1)],'path':'','def':_0x285d80});}const _0x13d9bc=await safeListOrEmpty(()=>this['client'][_0x1c381b(0x153)](_0x132586));for(const _0x559ba0 of _0x13d9bc){const _0x442ea0=await apiFormInterfaceToYaml(_0x559ba0,_0x4cba15);_0x527673[_0x1c381b(0x1b6)]({'name':_0x442ea0[_0x1c381b(0x1f1)],'path':'','yaml':_0x442ea0});}const _0x39d3e4=await safeListOrEmpty(()=>this[_0x1c381b(0x120)]['listChatInterfaces'](_0x132586));for(const _0x6f12fa of _0x39d3e4){if(_0x6f12fa[_0x1c381b(0xf0)][_0x1c381b(0x138)])continue;const _0xb9aa67=await apiChatInterfaceToYaml(_0x6f12fa,_0x4cba15);_0x1d2aae['push']({'name':_0xb9aa67['name'],'path':'','yaml':_0xb9aa67});}}const _0x59170b={'sourceProjectName':_0x56beb0,'newProjectName':_0x499537,'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}}},_0x4c2a72=await this[_0x1c381b(0x120)][_0x1c381b(0x1ae)](),_0x359ec2=_0x4c2a72[_0x1c381b(0x203)](_0x2e4a2f=>_0x2e4a2f[_0x1c381b(0xf0)][_0x1c381b(0x1f1)]===_0x499537);if(_0x359ec2)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x1c381b(0x1f0)+_0x499537+_0x1c381b(0x103),undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x58b95b?.[_0x1c381b(0x175)])return _0x59170b[_0x1c381b(0x168)]['agents'][_0x1c381b(0x1b0)]=_0xdc7f48[_0x1c381b(0x1ac)],_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x195)][_0x1c381b(0x1b0)]=_0x3969ba['length'],_0x59170b['counts'][_0x1c381b(0x1ce)][_0x1c381b(0x1b0)]=_0x4aa339[_0x1c381b(0x1ac)],_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x1e7)][_0x1c381b(0x1b0)]=_0x6087ed[_0x1c381b(0x1ac)],_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x17b)][_0x1c381b(0x1b0)]=_0x3a0f00[_0x1c381b(0x1ac)],_0x59170b[_0x1c381b(0x168)]['prompts'][_0x1c381b(0x1b0)]=_0x579b89['length'],_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x11c)]['created']=_0x3d3e03[_0x1c381b(0x1ac)],_0x59170b;const _0x4cb5cb=await this[_0x1c381b(0x120)][_0x1c381b(0x19b)]({'name':_0x499537}),_0x1b3fb1=_0x4cb5cb['id'];_0x59170b['newProjectId']=_0x1b3fb1;const _0x2bdd48=new Map(),_0x1d482d=new Map(),_0x4a403d=new Map(),_0x1c4c25=new Map(),_0x2bdf45=new Map(),_0xa82f89=new Map(),_0x496c13=new Map(),_0x48f7cc=new Map(),_0x5f51c6=new Set(),_0x5c672c=new Set();for(const _0x193fa7 of _0xdc7f48){for(const _0x38b424 of _0x193fa7['yaml'][_0x1c381b(0x1b5)]||[]){if(_0x38b424[_0x1c381b(0x145)]==='image_gen'&&_0x38b424[_0x1c381b(0x20a)]){const _0x1e788a=parseRef(_0x38b424[_0x1c381b(0x20a)]);if(_0x1e788a)_0x5f51c6[_0x1c381b(0x14a)](_0x1e788a['name']);}else{if(_0x38b424[_0x1c381b(0x145)]==='web_search'&&_0x38b424[_0x1c381b(0x20a)]){const _0x55b2f8=parseRef(_0x38b424[_0x1c381b(0x20a)]);if(_0x55b2f8)_0x5c672c[_0x1c381b(0x14a)](_0x55b2f8[_0x1c381b(0x1f1)]);}}}}for(const _0x3e692c of _0x5f51c6){try{const _0x3158cc=await this[_0x1c381b(0x120)][_0x1c381b(0x125)]({'projectId':_0x1b3fb1,'name':_0x3e692c});_0x2bdf45[_0x1c381b(0xfc)](_0x3e692c,_0x3158cc['id']),_0x59170b[_0x1c381b(0x207)][_0x1c381b(0x1b6)]({'name':_0x3e692c,'action':'created','id':_0x3158cc['id']}),_0x59170b[_0x1c381b(0x168)]['imageGenerators'][_0x1c381b(0x1b0)]++;}catch(_0x1cc9a9){_0x59170b[_0x1c381b(0x207)][_0x1c381b(0x1b6)]({'name':_0x3e692c,'action':_0x1c381b(0x106),'error':_0x1cc9a9[_0x1c381b(0x11a)]}),_0x59170b['counts'][_0x1c381b(0x207)][_0x1c381b(0x13e)]++;}}for(const _0x5d34e5 of _0x5c672c){try{const _0x16add0=await this[_0x1c381b(0x120)]['createWebSearchTool']({'projectId':_0x1b3fb1,'name':_0x5d34e5});_0xa82f89[_0x1c381b(0xfc)](_0x5d34e5,_0x16add0['id']),_0x59170b[_0x1c381b(0x14d)][_0x1c381b(0x1b6)]({'name':_0x5d34e5,'action':'created','id':_0x16add0['id']}),_0x59170b['counts'][_0x1c381b(0x14d)]['created']++;}catch(_0x538f2b){_0x59170b['webSearchTools'][_0x1c381b(0x1b6)]({'name':_0x5d34e5,'action':'error','error':_0x538f2b[_0x1c381b(0x11a)]}),_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x14d)][_0x1c381b(0x13e)]++;}}const _0xa71746=await fetchAllToolTargetMaps((_0x5abca9,_0x2f4fa8)=>this[_0x1c381b(0x120)][_0x1c381b(0x182)](_0x5abca9,_0x2f4fa8),_0x1b3fb1);let _0x2350b8=[];const _0x5aa3a3={'projectId':_0x1b3fb1,'resolveToolTargetId':buildIdResolver({..._0xa71746['nameToId'],'KnowledgeBase':_0x2bdd48,'TextKnowledgeBase':_0x1d482d,'ExperimentalKnowledgeBase':_0x496c13,'Agent':_0x4a403d,'WebSearchTool':_0xa82f89,'ImageGenerator':_0x2bdf45}),'resolvePromptId':async _0x27cd52=>_0x1c4c25[_0x1c381b(0x202)](_0x27cd52),'onWarning':_0x3037e7=>{const _0x411190=_0x1c381b;this['logger'][_0x411190(0x1dd)](_0x3037e7),_0x2350b8[_0x411190(0x1b6)](_0x3037e7);}};for(const _0x245d74 of _0x3969ba){try{const _0x327aac=yamlKnowledgeBaseToApi(_0x245d74[_0x1c381b(0xf3)],_0x1b3fb1),_0x57c78d=await this[_0x1c381b(0x120)]['createKnowledgeBase'](_0x327aac);_0x2bdd48[_0x1c381b(0xfc)](_0x245d74[_0x1c381b(0xf3)][_0x1c381b(0x1f1)],_0x57c78d['id']),_0x59170b[_0x1c381b(0x195)][_0x1c381b(0x1b6)]({'name':_0x245d74['yaml'][_0x1c381b(0x1f1)],'action':'created','id':_0x57c78d['id']}),_0x59170b['counts'][_0x1c381b(0x195)][_0x1c381b(0x1b0)]++;}catch(_0x2ea3f3){_0x59170b[_0x1c381b(0x195)][_0x1c381b(0x1b6)]({'name':_0x245d74[_0x1c381b(0xf3)][_0x1c381b(0x1f1)],'action':_0x1c381b(0x106),'error':_0x2ea3f3[_0x1c381b(0x11a)]}),_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x195)][_0x1c381b(0x13e)]++;}}for(const _0x36e2a7 of _0x4aa339){try{const _0x11649c=yamlTextKnowledgeBaseToApi({'name':_0x36e2a7[_0x1c381b(0x1f1)],'text':_0x36e2a7[_0x1c381b(0x173)]},_0x1b3fb1),_0x31fca8=await this[_0x1c381b(0x120)]['createTextKnowledgeBase'](_0x11649c);_0x1d482d['set'](_0x36e2a7[_0x1c381b(0x1f1)],_0x31fca8['id']),_0x59170b[_0x1c381b(0x1ce)]['push']({'name':_0x36e2a7['name'],'action':_0x1c381b(0x1b0),'id':_0x31fca8['id']}),_0x59170b[_0x1c381b(0x168)]['textKnowledgeBases'][_0x1c381b(0x1b0)]++;}catch(_0x140435){_0x59170b[_0x1c381b(0x1ce)][_0x1c381b(0x1b6)]({'name':_0x36e2a7[_0x1c381b(0x1f1)],'action':_0x1c381b(0x106),'error':_0x140435[_0x1c381b(0x11a)]}),_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x1ce)][_0x1c381b(0x13e)]++;}}for(const _0x429c8f of _0x3a0f00){try{const _0x5c21a9=yamlExperimentalArtifactToApi(_0x429c8f[_0x1c381b(0x10b)],_0x1b3fb1),_0x1201d1=await this[_0x1c381b(0x120)][_0x1c381b(0x101)](_0x5c21a9);_0x48f7cc[_0x1c381b(0xfc)](_0x429c8f['def'][_0x1c381b(0x1f1)],_0x1201d1['id']),_0x59170b['experimentalArtifacts'][_0x1c381b(0x1b6)]({'name':_0x429c8f[_0x1c381b(0x10b)][_0x1c381b(0x1f1)],'action':_0x1c381b(0x1b0),'id':_0x1201d1['id']}),_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x17b)][_0x1c381b(0x1b0)]++;}catch(_0x2e14a8){_0x59170b['experimentalArtifacts']['push']({'name':_0x429c8f[_0x1c381b(0x10b)][_0x1c381b(0x1f1)],'action':_0x1c381b(0x106),'error':_0x2e14a8[_0x1c381b(0x11a)]}),_0x59170b[_0x1c381b(0x168)]['experimentalArtifacts'][_0x1c381b(0x13e)]++;}}for(const _0x43c078 of _0x6087ed){try{const _0x100882=yamlExperimentalKnowledgeBaseToApi(_0x43c078[_0x1c381b(0x10b)],_0x1b3fb1),_0x1620dd=await this[_0x1c381b(0x120)][_0x1c381b(0x177)](_0x100882);_0x496c13[_0x1c381b(0xfc)](_0x43c078[_0x1c381b(0x10b)][_0x1c381b(0x1f1)],_0x1620dd['id']),_0x59170b[_0x1c381b(0x1e7)][_0x1c381b(0x1b6)]({'name':_0x43c078[_0x1c381b(0x10b)][_0x1c381b(0x1f1)],'action':_0x1c381b(0x1b0),'id':_0x1620dd['id']}),_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x1e7)]['created']++;}catch(_0x4d59aa){_0x59170b['experimentalKnowledgeBases'][_0x1c381b(0x1b6)]({'name':_0x43c078['def'][_0x1c381b(0x1f1)],'action':'error','error':_0x4d59aa['message']}),_0x59170b[_0x1c381b(0x168)]['experimentalKnowledgeBases']['errors']++;}}const _0x3eb309=[..._0xdc7f48][_0x1c381b(0x1cd)]((_0x259139,_0x2af1bc)=>{const _0x10fc6a=_0x1c381b,_0x46cb4c=_0x259139[_0x10fc6a(0xf3)][_0x10fc6a(0x1b5)]?.[_0x10fc6a(0x170)](_0x1a363e=>_0x1a363e['type']===_0x10fc6a(0x15a))??![],_0x53056a=_0x2af1bc[_0x10fc6a(0xf3)][_0x10fc6a(0x1b5)]?.['some'](_0x59fff2=>_0x59fff2[_0x10fc6a(0x145)]===_0x10fc6a(0x15a))??![];if(_0x46cb4c&&!_0x53056a)return 0x1;if(!_0x46cb4c&&_0x53056a)return-0x1;return 0x0;});for(const _0x491f40 of _0x3eb309){_0x2350b8=[];try{const _0x15db7a=_0x491f40['yaml'][_0x1c381b(0x1b5)]?.[_0x1c381b(0xee)](_0x48171e=>{const _0x557883=_0x1c381b;if(_0x48171e['type']===_0x557883(0x15a)&&_0x48171e[_0x557883(0x20a)]){const _0x52a4c0=parseRef(_0x48171e[_0x557883(0x20a)]);return _0x52a4c0?.[_0x557883(0x1f1)]===_0x491f40[_0x557883(0xf3)][_0x557883(0x1f1)];}return![];})??[];if(_0x15db7a['length']>0x0){const _0x43ec44=_0x1c381b(0x151)+_0x491f40['yaml'][_0x1c381b(0x1f1)]+_0x1c381b(0x1ca)+_0x1c381b(0x1b7);this[_0x1c381b(0x165)][_0x1c381b(0x1dd)](_0x43ec44),_0x2350b8['push'](_0x43ec44);}const _0x4487e4=await agentDefToRequest(_0x491f40[_0x1c381b(0xf3)],_0x491f40[_0x1c381b(0x108)],_0x491f40['starterMessage'],_0x5aa3a3),_0x867eb=await this[_0x1c381b(0x120)]['createAgentResponse'](_0x4487e4);_0x4a403d[_0x1c381b(0xfc)](_0x491f40[_0x1c381b(0xf3)][_0x1c381b(0x1f1)],_0x867eb['id']),_0x59170b['agents'][_0x1c381b(0x1b6)]({'agentName':_0x491f40[_0x1c381b(0xf3)]['name'],'action':_0x1c381b(0x1b0),'agentId':_0x867eb['id'],'warnings':_0x2350b8[_0x1c381b(0x1ac)]>0x0?_0x2350b8:undefined}),_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x174)][_0x1c381b(0x1b0)]++;}catch(_0xf32f65){_0x59170b[_0x1c381b(0x174)]['push']({'agentName':_0x491f40[_0x1c381b(0xf3)][_0x1c381b(0x1f1)],'action':_0x1c381b(0x106),'error':_0xf32f65[_0x1c381b(0x11a)],'warnings':_0x2350b8['length']>0x0?_0x2350b8:undefined}),_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x174)][_0x1c381b(0x13e)]++;}}for(const _0x1702cf of _0x579b89){try{const _0x218214=await yamlPromptToApi(_0x1702cf[_0x1c381b(0xf3)],_0x1b3fb1,_0x5aa3a3);if(!_0x218214){_0x59170b[_0x1c381b(0x1e9)][_0x1c381b(0x1b6)]({'name':_0x1702cf[_0x1c381b(0xf3)][_0x1c381b(0x1f1)],'action':_0x1c381b(0x106),'error':'Agent\x20reference\x20not\x20found'}),_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x1e9)][_0x1c381b(0x13e)]++;continue;}const _0x3abc85=await this[_0x1c381b(0x120)]['createPrompt'](_0x218214);_0x1c4c25['set'](_0x1702cf[_0x1c381b(0xf3)]['name'],_0x3abc85['id']),_0x59170b[_0x1c381b(0x1e9)][_0x1c381b(0x1b6)]({'name':_0x1702cf['yaml'][_0x1c381b(0x1f1)],'action':'created','id':_0x3abc85['id']}),_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x1e9)]['created']++;}catch(_0x555d43){_0x59170b[_0x1c381b(0x1e9)][_0x1c381b(0x1b6)]({'name':_0x1702cf['yaml'][_0x1c381b(0x1f1)],'action':_0x1c381b(0x106),'error':_0x555d43[_0x1c381b(0x11a)]}),_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x1e9)][_0x1c381b(0x13e)]++;}}for(const _0x2b5d29 of _0x3d3e03){try{const _0x420d04=await yamlIntegrationToApi(_0x2b5d29[_0x1c381b(0xf3)],_0x1b3fb1,_0x5aa3a3),_0x45ed7e=await this[_0x1c381b(0x120)]['createIntegration'](_0x420d04);_0x59170b['integrations'][_0x1c381b(0x1b6)]({'name':_0x2b5d29[_0x1c381b(0xf3)][_0x1c381b(0x167)],'action':'created','id':_0x45ed7e['id']}),_0x59170b['counts'][_0x1c381b(0x11c)][_0x1c381b(0x1b0)]++;}catch(_0x5ce8ab){_0x59170b['integrations'][_0x1c381b(0x1b6)]({'name':_0x2b5d29[_0x1c381b(0xf3)]['service_type'],'action':_0x1c381b(0x106),'error':_0x5ce8ab[_0x1c381b(0x11a)]}),_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x11c)][_0x1c381b(0x13e)]++;}}for(const _0x56785c of _0x527673){try{const _0xa285e0=await yamlFormInterfaceToApi(_0x56785c[_0x1c381b(0xf3)],_0x1b3fb1,_0x5aa3a3);if(!_0xa285e0){_0x59170b['formInterfaces'][_0x1c381b(0x1b6)]({'name':_0x56785c[_0x1c381b(0xf3)][_0x1c381b(0x1f1)],'action':_0x1c381b(0x106),'error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x1e3)]['errors']++;continue;}const _0x875177=await this[_0x1c381b(0x120)][_0x1c381b(0xef)](_0xa285e0);_0x59170b['formInterfaces'][_0x1c381b(0x1b6)]({'name':_0x56785c[_0x1c381b(0xf3)][_0x1c381b(0x1f1)],'action':_0x1c381b(0x1b0),'id':_0x875177['id']}),_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x1e3)][_0x1c381b(0x1b0)]++;}catch(_0x5ea5be){_0x59170b['formInterfaces'][_0x1c381b(0x1b6)]({'name':_0x56785c[_0x1c381b(0xf3)][_0x1c381b(0x1f1)],'action':_0x1c381b(0x106),'error':_0x5ea5be['message']}),_0x59170b['counts'][_0x1c381b(0x1e3)][_0x1c381b(0x13e)]++;}}for(const _0x46c3db of _0x1d2aae){try{const _0x4a885e=await yamlChatInterfaceToApi(_0x46c3db[_0x1c381b(0xf3)],_0x1b3fb1,_0x5aa3a3),_0x1ea2af=await this[_0x1c381b(0x120)]['createChatInterface'](_0x4a885e);_0x59170b[_0x1c381b(0x13d)][_0x1c381b(0x1b6)]({'name':_0x46c3db[_0x1c381b(0xf3)]['name'],'action':_0x1c381b(0x1b0),'id':_0x1ea2af['id']}),_0x59170b['counts'][_0x1c381b(0x13d)][_0x1c381b(0x1b0)]++;}catch(_0x4214a6){_0x59170b[_0x1c381b(0x13d)][_0x1c381b(0x1b6)]({'name':_0x46c3db[_0x1c381b(0xf3)][_0x1c381b(0x1f1)],'action':_0x1c381b(0x106),'error':_0x4214a6['message']}),_0x59170b[_0x1c381b(0x168)][_0x1c381b(0x13d)]['errors']++;}}return _0x59170b;}}