@treasuredata/tdx 2026.7.5 → 2026.7.6

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 (250) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/policy-command.js +1 -1
  35. package/dist/commands/profile-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/schedule-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-move-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-push-command.js +1 -1
  45. package/dist/commands/segment-update-command.js +1 -1
  46. package/dist/commands/segment-use-command.js +1 -1
  47. package/dist/commands/segment-validate-command.js +1 -1
  48. package/dist/commands/segments.js +1 -1
  49. package/dist/commands/show.js +1 -1
  50. package/dist/commands/status-command.js +1 -1
  51. package/dist/commands/table-deleted.js +1 -1
  52. package/dist/commands/tables.js +1 -1
  53. package/dist/commands/unset-command.js +1 -1
  54. package/dist/commands/upgrade-command.js +1 -1
  55. package/dist/commands/use-command.js +1 -1
  56. package/dist/commands/user-command.js +1 -1
  57. package/dist/commands/work-command.js +1 -1
  58. package/dist/commands/workflow-command.js +1 -1
  59. package/dist/core/auth.js +1 -1
  60. package/dist/core/command-output.js +1 -1
  61. package/dist/core/config.js +1 -1
  62. package/dist/core/connection-cache.js +1 -1
  63. package/dist/core/constants.js +1 -1
  64. package/dist/core/credential-cache.js +1 -1
  65. package/dist/core/global-context.js +1 -1
  66. package/dist/core/keychain.js +1 -1
  67. package/dist/core/oauth-keychain.js +1 -1
  68. package/dist/core/oauth.js +1 -1
  69. package/dist/core/profile.js +1 -1
  70. package/dist/core/project-config.js +1 -1
  71. package/dist/core/session.js +1 -1
  72. package/dist/core/user-cache.js +1 -1
  73. package/dist/core/version.js +1 -1
  74. package/dist/index.js +1 -1
  75. package/dist/mcp/server.js +1 -1
  76. package/dist/mcp/tools/index.js +1 -1
  77. package/dist/mcp/tools/tdx-run.js +1 -1
  78. package/dist/mcp/tools/tdx-search.js +1 -1
  79. package/dist/mcp/tools/work-create-item.js +1 -1
  80. package/dist/mcp/utils.js +1 -1
  81. package/dist/proxy/claude-usage-tracker.js +1 -1
  82. package/dist/proxy/passthrough-server.js +1 -1
  83. package/dist/proxy/sse-usage-parser.js +1 -1
  84. package/dist/sdk/agent/agent-config.js +1 -1
  85. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  86. package/dist/sdk/agent/agent-yaml.js +1 -1
  87. package/dist/sdk/agent/test/evaluator.js +1 -1
  88. package/dist/sdk/agent/test/executor.js +1 -1
  89. package/dist/sdk/agent/test/index.js +1 -1
  90. package/dist/sdk/agent/test/output.js +1 -1
  91. package/dist/sdk/agent/test/parser.js +1 -1
  92. package/dist/sdk/agent/tool-target-registry.js +1 -1
  93. package/dist/sdk/api.js +1 -1
  94. package/dist/sdk/cas/cas-api-client.js +1 -1
  95. package/dist/sdk/cas/cas-audience-schema.js +1 -1
  96. package/dist/sdk/cas/cas-audience-validator.js +1 -1
  97. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  98. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  99. package/dist/sdk/cas/index.js +1 -1
  100. package/dist/sdk/cas/pull-workflow.js +1 -1
  101. package/dist/sdk/cas/push-workflow.js +1 -1
  102. package/dist/sdk/cas/validate-files.js +1 -1
  103. package/dist/sdk/client/cdp-api-client.d.ts +6 -6
  104. package/dist/sdk/client/cdp-api-client.d.ts.map +1 -1
  105. package/dist/sdk/client/cdp-api-client.js +1 -1
  106. package/dist/sdk/client/cdp-api-client.js.map +1 -1
  107. package/dist/sdk/client/delivery-api-client.js +1 -1
  108. package/dist/sdk/client/endpoints.js +1 -1
  109. package/dist/sdk/client/engage-api-client.js +1 -1
  110. package/dist/sdk/client/http-client.js +1 -1
  111. package/dist/sdk/client/llm-api-client.js +1 -1
  112. package/dist/sdk/client/oauth-refresh.js +1 -1
  113. package/dist/sdk/client/rate-limiter.js +1 -1
  114. package/dist/sdk/client/td-api-client.js +1 -1
  115. package/dist/sdk/client/trino-api-client.js +1 -1
  116. package/dist/sdk/client/workflow-client.js +1 -1
  117. package/dist/sdk/connection-validator.js +1 -1
  118. package/dist/sdk/connection.js +1 -1
  119. package/dist/sdk/delivery.js +1 -1
  120. package/dist/sdk/engage/campaign-pull.js +1 -1
  121. package/dist/sdk/engage/campaign-push.js +1 -1
  122. package/dist/sdk/engage/campaign-validator.js +1 -1
  123. package/dist/sdk/engage/campaign-yaml.js +1 -1
  124. package/dist/sdk/engage/template-pull.js +1 -1
  125. package/dist/sdk/engage/template-push.js +1 -1
  126. package/dist/sdk/engage/template-validator.js +1 -1
  127. package/dist/sdk/engage/template-yaml.js +1 -1
  128. package/dist/sdk/engage/types/campaign-def.js +1 -1
  129. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  130. package/dist/sdk/engage/types/template-schema.js +1 -1
  131. package/dist/sdk/engage.js +1 -1
  132. package/dist/sdk/errors.js +1 -1
  133. package/dist/sdk/index.js +1 -1
  134. package/dist/sdk/io/index.js +1 -1
  135. package/dist/sdk/io/node-filesystem.js +1 -1
  136. package/dist/sdk/job.js +1 -1
  137. package/dist/sdk/journey.js +1 -1
  138. package/dist/sdk/llm/chat-cache.js +1 -1
  139. package/dist/sdk/llm/index.js +1 -1
  140. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  141. package/dist/sdk/llm/model-factors.js +1 -1
  142. package/dist/sdk/llm/user-settings.js +1 -1
  143. package/dist/sdk/personalization.js +1 -1
  144. package/dist/sdk/policy.js +1 -1
  145. package/dist/sdk/query/deleted-table-validation.js +1 -1
  146. package/dist/sdk/query/index.js +1 -1
  147. package/dist/sdk/query/sql-parser.js +1 -1
  148. package/dist/sdk/realtime.js +1 -1
  149. package/dist/sdk/schedule.js +1 -1
  150. package/dist/sdk/segment/child-segment-yaml.d.ts +0 -8
  151. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  152. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  153. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  154. package/dist/sdk/segment/fields-display.js +1 -1
  155. package/dist/sdk/segment/file-discovery.js +1 -1
  156. package/dist/sdk/segment/journey-utils.js +1 -1
  157. package/dist/sdk/segment/journey-validator.js +1 -1
  158. package/dist/sdk/segment/journey-yaml.js +1 -1
  159. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  160. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  161. package/dist/sdk/segment/pull-workflow.js +1 -1
  162. package/dist/sdk/segment/push-recovery.js +1 -1
  163. package/dist/sdk/segment/push-workflow.d.ts.map +1 -1
  164. package/dist/sdk/segment/push-workflow.js +1 -1
  165. package/dist/sdk/segment/push-workflow.js.map +1 -1
  166. package/dist/sdk/segment/resolution-context.js +1 -1
  167. package/dist/sdk/segment/segment-path-parser.js +1 -1
  168. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  169. package/dist/sdk/segment/segment-validator.js +1 -1
  170. package/dist/sdk/segment/target-resolution.js +1 -1
  171. package/dist/sdk/segment/tdx-config.js +1 -1
  172. package/dist/sdk/segment/types/activation-schema.d.ts +66 -7
  173. package/dist/sdk/segment/types/activation-schema.d.ts.map +1 -1
  174. package/dist/sdk/segment/types/activation-schema.js +1 -1
  175. package/dist/sdk/segment/types/activation-schema.js.map +1 -1
  176. package/dist/sdk/segment/types/journey-def.js +1 -1
  177. package/dist/sdk/segment/types/journey-schema.js +1 -1
  178. package/dist/sdk/segment/types/segment-def.d.ts +1 -1
  179. package/dist/sdk/segment/types/segment-def.d.ts.map +1 -1
  180. package/dist/sdk/segment/types/segment-def.js +1 -1
  181. package/dist/sdk/segment/types/segment-def.js.map +1 -1
  182. package/dist/sdk/segment/types/segment-schema.d.ts +110 -1
  183. package/dist/sdk/segment/types/segment-schema.d.ts.map +1 -1
  184. package/dist/sdk/segment/types/segment-schema.js +1 -1
  185. package/dist/sdk/segment/types/segment-schema.js.map +1 -1
  186. package/dist/sdk/segment/validate-files.js +1 -1
  187. package/dist/sdk/segment/yaml-validator.js +1 -1
  188. package/dist/sdk/segment.js +1 -1
  189. package/dist/sdk/types/cdp.d.ts +7 -3
  190. package/dist/sdk/types/cdp.d.ts.map +1 -1
  191. package/dist/sdk/types/index.js +1 -1
  192. package/dist/sdk/types/progress.js +1 -1
  193. package/dist/sdk/types/workspace.js +1 -1
  194. package/dist/sdk/user.js +1 -1
  195. package/dist/sdk/util/format-detector.js +1 -1
  196. package/dist/sdk/util/formatters.js +1 -1
  197. package/dist/sdk/util/index.js +1 -1
  198. package/dist/sdk/util/paginate.js +1 -1
  199. package/dist/sdk/util/tree-formatter.js +1 -1
  200. package/dist/sdk/util/tree-search.js +1 -1
  201. package/dist/sdk/workflow/archive-validation.js +1 -1
  202. package/dist/sdk/workflow/clone-workflow.js +1 -1
  203. package/dist/sdk/workflow/index.js +1 -1
  204. package/dist/sdk/workflow/pull-workflow.js +1 -1
  205. package/dist/sdk/workflow/push-workflow.js +1 -1
  206. package/dist/sdk/workflow/task-graph.js +1 -1
  207. package/dist/sdk/workflow/tdx-config.js +1 -1
  208. package/dist/sdk/workflow/workflow-utils.js +1 -1
  209. package/dist/sdk/workspace/access-tracker.js +1 -1
  210. package/dist/sdk/workspace/frontmatter.js +1 -1
  211. package/dist/sdk/workspace/git.js +1 -1
  212. package/dist/sdk/workspace/index.js +1 -1
  213. package/dist/sdk/workspace/templates.js +1 -1
  214. package/dist/sdk/workspace/weekly.js +1 -1
  215. package/dist/sdk/workspace/wikilinks.js +1 -1
  216. package/dist/test-utils/command-runner.js +1 -1
  217. package/dist/test-utils/factories.js +1 -1
  218. package/dist/test-utils/fixtures.js +1 -1
  219. package/dist/test-utils/http-mock.js +1 -1
  220. package/dist/test-utils/index.js +1 -1
  221. package/dist/utils/async.js +1 -1
  222. package/dist/utils/claude-code-state.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/proxy-fetch.js +1 -1
  244. package/dist/utils/spinner.js +1 -1
  245. package/dist/utils/sse-parser.js +1 -1
  246. package/dist/utils/string-utils.js +1 -1
  247. package/dist/utils/table-ref-parser.js +1 -1
  248. package/dist/utils/tdx-logger.js +1 -1
  249. package/dist/utils/version-check.js +1 -1
  250. package/package.json +1 -1
@@ -1 +1 @@
1
- const a138_0x192cb2=a138_0x43ed;(function(_0xc0c409,_0x42b3f7){const _0x5a0f11=a138_0x43ed,_0x31923a=_0xc0c409();while(!![]){try{const _0x11aab2=parseInt(_0x5a0f11(0x1f6))/0x1*(parseInt(_0x5a0f11(0x1cd))/0x2)+parseInt(_0x5a0f11(0x20f))/0x3+parseInt(_0x5a0f11(0x1ef))/0x4*(parseInt(_0x5a0f11(0x19f))/0x5)+-parseInt(_0x5a0f11(0x23f))/0x6+parseInt(_0x5a0f11(0x25a))/0x7+parseInt(_0x5a0f11(0x207))/0x8*(parseInt(_0x5a0f11(0x28c))/0x9)+-parseInt(_0x5a0f11(0x1a7))/0xa*(parseInt(_0x5a0f11(0x1c7))/0xb);if(_0x11aab2===_0x42b3f7)break;else _0x31923a['push'](_0x31923a['shift']());}catch(_0x5c1c30){_0x31923a['push'](_0x31923a['shift']());}}}(a138_0x345a,0x39c84));import{LLMApiClient}from'../client/llm-api-client.js';import*as a138_0x181126 from'node:fs';import*as a138_0x3bc761 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 a138_0x345a(){const _0x595047=['AGENT_NOT_FOUND','path','content','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','rmSync','Available\x20agents:\x20','getUserSettings','starter_message.md',')\x20can\x20be\x20pushed.\x20','systemPrompt','Renamed\x20agent\x20folder:\x20','createAgent','createExperimentalKnowledgeBase','attributes','newProjectId','Agent\x20not\x20found:\x20','isDir','experimental_knowledge_bases','Renamed\x20experimental\x20KB\x20directory:\x20','sort','join','already\x20exists','clearDefaultAgent','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','KnowledgeBase','unlinkSync','add','Could\x20not\x20resolve\x20agent\x20reference','INVALID_ARGUMENT','createPrompt','NOT_FOUND','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','project','exportedFrom','updateAgent','ExperimentalKnowledgeBase','No\x20tdx.json\x20found\x20in\x20','files','file_name','utf-8','context','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','profile','setCurrentProject','dry-run-','image_gen','claude-4.5-sonnet','2726496xdpCyH','\x0a---\x20code\x20---\x0a','listChatInterfaces','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','chat_generic','Skipping\x20integration\x20\x27','getChatLog','agent.yml\x20not\x20found\x20in\x20','project.json','agent.yml','.md','has','get','pullProject','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','renamed','getChatHistory','toISOString','deleteIntegration','jsonSchemaHint','):\x20','listExperimentalKnowledgeBases','integrations','find','experimental_artifacts','updateKnowledgeBase','3034927oxIaRL','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','loadJsonFile','map','imageGenerators','Renamed\x20text\x20KB\x20file:\x20','currentProjectId','_reasoning_','listExperimentalArtifacts','startChat','stringify','low','updated','knowledgebases.json','chat_parent_segment','variables','Removed\x20deleted\x20file:\x20','.llm','agentId','\x20→\x20','minimal','endsWith','setDefaultAgent','size','createTextKnowledgeBase','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','set','getDefaultProjectName','experimentalKnowledgeBases','unchanged','pullAgent','site','created','text','serviceType','getBackupMetadata','pushAgent','ALREADY_EXISTS','text_content','resolveAgentId','listAgentsFull','prompts.json','createKnowledgeBase','updatePrompt','getDefaultAgent','code.js','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','Renamed\x20folder:\x20','\x27.\x20This\x20should\x20not\x20happen.','temperature','126iyoqeO','getCurrentProject','template','listFormInterfaces','statSync','listProjects','agents.json','integrations.json','\x20in\x20project\x20','toLowerCase','tdx_','restoreProject','dryRun','modelType','createExperimentalArtifact','Renamed\x20prompt\x20file:\x20','tdx_default_','backupProject','listAgents','Renamed\x20KB\x20file:\x20','Unable\x20to\x20create\x20project\x20after\x20','writeFileSync','updateTextKnowledgeBase','conflict','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','target','\x0a---\x20schema:\x20','json_schema.json','Renamed\x20chat\x20interface\x20file:\x20','parse','reasoningEffort','none','\x20---\x0a','textKnowledgeBases','LLM_PROJECT_NOT_FOUND','message','createChatInterface','createAgentResponse','Renamed\x20form\x20interface\x20file:\x20','logger','llm_project','tables','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.','starterMessage','status','dir','Invalid\x20agent\x20reference\x20format:\x20','Unsupported\x20backup\x20version:\x20','code','client','existsSync','duplicate','Output\x20directory\x20already\x20exists:\x20','chat_interfaces','Agent\x20reference\x20not\x20found','yaml','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','createIntegration','deleteAgent','4985pnsevv','chatId','isDirectory','info','resolveProjectId','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','new','event','10ZfwwSz','createImageGenerator','agentsFull','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','filter','Unresolved\x20dependencies:\x20','formInterfaces','service_type','oldPath','def','---\x20file:\x20','version','tools','signal','Multiple\x20agents\x20found\x20with\x20name\x20\x27','.yml','---\x20schema:\x20','listIntegrations','localeCompare','experimentalArtifacts','readFileSync','mkdirSync','\x0a---\x20function:\x20','chatInterfaces','PERMISSION_DENIED','sdk.llm','type','updateAgentResponse','name','starter_message','webSearchTools','getProject','8164607CBmgmX','form_interfaces','#\x20prompt.md\x0a','includes','slackMessageMode','pushProject','176LpkdsW','Project\x20\x22','Multiple\x20projects\x20found\x20with\x20name\x20\x27','listPrompts','total','keys','idToName','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','INTERNAL','functions','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','Renamed\x20integration\x20file:\x20','nameToId','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','chats','chatInfo','chatWelcomeMessage','agents','listToolTargets','Only\x20safe\x20types\x20(','createWebSearchTool','getAgent','prompt.md','knowledge_bases','errors','agent','metadata','outputs','updateExperimentalArtifact','TextKnowledgeBase','prompts','cwd','json_schema','292UfVqvo','readdirSync','counts','history','isManaged','listTextKnowledgeBases','chat_agent_console','1849KLXekg','createFormInterface','\x27\x20(','warn','isFile','(dry-run)','knowledgeBases','deleteProject','\x0a\x0a#\x20agent.yml\x0a','tdx.json','listKnowledgeBases','chat','promptId','dirname','push','error','basename','172352iFEGnQ','createProject','getOrCreateDefaultProject','some','resolveProjectName','UNAUTHENTICATED','length','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','1387977LZKYrs'];a138_0x345a=function(){return _0x595047;};return a138_0x345a();}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';function a138_0x43ed(_0x5ef85c,_0xb41ebd){_0x5ef85c=_0x5ef85c-0x17f;const _0x345adb=a138_0x345a();let _0x43ed50=_0x345adb[_0x5ef85c];return _0x43ed50;}import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a138_0x192cb2(0x243),a138_0x192cb2(0x1f5),a138_0x192cb2(0x268)];async function safeListOrEmpty(_0x5a5119){const _0x24c678=a138_0x192cb2;try{return await _0x5a5119();}catch(_0x2cbea3){if(_0x2cbea3 instanceof HTTPClientError&&_0x2cbea3[_0x24c678(0x190)]===0x194)return[];throw _0x2cbea3;}}export class LLMSDK{[a138_0x192cb2(0x260)];[a138_0x192cb2(0x195)];[a138_0x192cb2(0x238)];[a138_0x192cb2(0x18b)]=Logger['of'](a138_0x192cb2(0x1c0));constructor(_0x2e8b31){const _0x49002a=a138_0x192cb2;this[_0x49002a(0x195)]=new LLMApiClient(_0x2e8b31),this[_0x49002a(0x238)]=_0x2e8b31;}[a138_0x192cb2(0x275)](){const _0x4fcc18=a138_0x192cb2,_0x3cfec2=getSanitizedUsername();return _0x4fcc18(0x29c)+_0x3cfec2;}async[a138_0x192cb2(0x23b)](_0x663c48){const _0x1679c1=a138_0x192cb2,{projectId:_0x41ba6a}=await this[_0x1679c1(0x20b)](_0x663c48);this[_0x1679c1(0x260)]=_0x41ba6a;}[a138_0x192cb2(0x28d)](){const _0x127147=a138_0x192cb2;return this[_0x127147(0x260)];}async[a138_0x192cb2(0x270)](_0x545f3c){const _0x14e73f=a138_0x192cb2,_0x34ebc6=this[_0x14e73f(0x238)][_0x14e73f(0x23a)];let _0x8e8862,_0x965f0d;if(_0x545f3c['includes']('/')){const _0x47d855=_0x545f3c['split']('/');if(_0x47d855['length']!==0x2)throw new SDKError(ErrorCode[_0x14e73f(0x22c)],_0x14e73f(0x192)+_0x545f3c,undefined,{'helpText':'Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22'});const [_0x4f2b2c,_0x1ff48e]=_0x47d855;_0x8e8862=await this[_0x14e73f(0x1a3)](_0x4f2b2c),_0x965f0d=_0x1ff48e;}else _0x8e8862=this[_0x14e73f(0x260)]||(await this[_0x14e73f(0x209)]())['id'],_0x965f0d=_0x545f3c;const _0x2dbaab=await this[_0x14e73f(0x281)](_0x965f0d,_0x8e8862),_0x2e6d0d=await this['client'][_0x14e73f(0x1e3)](_0x2dbaab);writeCachedLLMAgent(_0x2e6d0d[_0x14e73f(0x21d)][_0x14e73f(0x1c3)],_0x2dbaab,_0x8e8862,_0x34ebc6);}[a138_0x192cb2(0x286)](){const _0x8f4045=a138_0x192cb2,_0x3bd234=this[_0x8f4045(0x238)]['profile'];return readCachedLLMAgent(_0x3bd234)||undefined;}[a138_0x192cb2(0x226)](){const _0x28a26d=a138_0x192cb2,_0x1030da=this[_0x28a26d(0x238)][_0x28a26d(0x23a)];clearCachedLLMAgent(_0x1030da);}async['models'](){const _0x3020d7=a138_0x192cb2,_0x25d9d4=await this['client'][_0x3020d7(0x216)]();return toModelInfos(_0x25d9d4);}async[a138_0x192cb2(0x208)](_0x5da99f){const _0x609c75=a138_0x192cb2;return await this[_0x609c75(0x195)]['createProject'](_0x5da99f);}async['deleteProject'](_0x6e4ab1){const _0x2fe1d3=a138_0x192cb2,{projectId:_0x475548}=await this[_0x2fe1d3(0x20b)](_0x6e4ab1);await this[_0x2fe1d3(0x195)][_0x2fe1d3(0x1fd)](_0x475548);}async['projects'](_0x388398=0x32){const _0x255838=a138_0x192cb2;return await this[_0x255838(0x195)][_0x255838(0x291)](_0x388398);}async[a138_0x192cb2(0x209)](_0x18630f){const _0x5480ba=a138_0x192cb2,_0x21bc37=_0x18630f||this[_0x5480ba(0x275)](),_0x4ac24c=this[_0x5480ba(0x238)][_0x5480ba(0x23a)];if(!_0x18630f){const _0x1d9770=readCachedLLMProject(_0x4ac24c);if(_0x1d9770&&_0x1d9770[_0x5480ba(0x1c3)]===_0x21bc37)try{const _0x159afe=await this[_0x5480ba(0x195)][_0x5480ba(0x1c6)](_0x1d9770['id']);if(_0x159afe[_0x5480ba(0x21d)][_0x5480ba(0x1c3)]===_0x21bc37)return _0x159afe;}catch{}}const _0x6808d7=await this[_0x5480ba(0x195)]['listProjects'](),_0x56f4f3=_0x6808d7[_0x5480ba(0x257)](_0x4dffd4=>_0x4dffd4['attributes']['name']===_0x21bc37);if(_0x56f4f3)return!_0x18630f&&writeCachedLLMProject(_0x21bc37,_0x56f4f3['id'],_0x4ac24c),_0x56f4f3;const _0x4f4cb9=await this[_0x5480ba(0x195)][_0x5480ba(0x208)]({'name':_0x21bc37,'description':_0x5480ba(0x242)+getSanitizedUsername()+')'});return!_0x18630f&&writeCachedLLMProject(_0x21bc37,_0x4f4cb9['id'],_0x4ac24c),_0x4f4cb9;}async[a138_0x192cb2(0x1a3)](_0x222acc){const _0x595ac5=a138_0x192cb2,_0x1d5630=await this[_0x595ac5(0x195)][_0x595ac5(0x291)](),_0x3b9e5d=_0x1d5630[_0x595ac5(0x1ab)](_0xd1fcea=>_0xd1fcea[_0x595ac5(0x21d)]['name']===_0x222acc);if(_0x3b9e5d[_0x595ac5(0x20d)]===0x0)throw new SDKError(ErrorCode[_0x595ac5(0x186)],'Project\x20not\x20found:\x20'+_0x222acc,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x3b9e5d[_0x595ac5(0x20d)]>0x1)throw new SDKError(ErrorCode[_0x595ac5(0x1d5)],_0x595ac5(0x1cf)+_0x222acc+_0x595ac5(0x28a));return _0x3b9e5d[0x0]['id'];}async[a138_0x192cb2(0x20b)](_0x41b1ca){const _0x51377e=a138_0x192cb2,_0xf8555b=await this[_0x51377e(0x195)][_0x51377e(0x291)](),_0x1b7eaf=_0xf8555b['find'](_0x214043=>_0x214043['attributes'][_0x51377e(0x1c3)]===_0x41b1ca);if(_0x1b7eaf)return{'projectId':_0x1b7eaf['id'],'project':_0x1b7eaf};throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0x41b1ca,undefined,{'helpText':_0x51377e(0x213)});}async['getOrCreateDefaultAgent'](_0x61dbce=a138_0x192cb2(0x23e),_0x4b4a58=0x0,_0x240ffe){const _0x18eb10=a138_0x192cb2,_0x3eaf74=0xa;let _0x538d16=0x0,_0x3694bf;while(_0x538d16<_0x3eaf74){try{const _0x38596b=await this[_0x18eb10(0x209)](_0x3694bf),_0x49a762=_0x38596b['id'],_0x47734d=[_0x18eb10(0x183),_0x18eb10(0x26e),_0x18eb10(0x265),'medium','high'],_0x1b84f3=_0x4b4a58===0x0?_0x18eb10(0x296)+_0x61dbce:_0x18eb10(0x296)+_0x61dbce+_0x18eb10(0x261)+_0x47734d[_0x4b4a58],_0x16b25d=await this['client'][_0x18eb10(0x29e)](_0x49a762),_0x178a57=_0x16b25d[_0x18eb10(0x257)](_0x4c0b16=>_0x4c0b16[_0x18eb10(0x21d)][_0x18eb10(0x1c3)]===_0x1b84f3);if(_0x178a57)return _0x178a57;const _0x2c8824=_0x4b4a58>0x0?0x1:_0x240ffe;return await this['client'][_0x18eb10(0x21b)]({'name':_0x1b84f3,'projectId':_0x49a762,'modelType':_0x61dbce,'systemPrompt':'','temperature':_0x2c8824,'reasoningEffort':_0x4b4a58>0x0?_0x4b4a58:undefined});}catch(_0x4e809d){if(_0x4e809d instanceof HTTPClientError){const _0x57b7db=_0x4e809d[_0x18eb10(0x190)];if(_0x57b7db>=0x190&&_0x57b7db<0x1f4){if(_0x57b7db===0x191)throw new SDKError(ErrorCode[_0x18eb10(0x20c)],_0x18eb10(0x19c),_0x4e809d);else{if(_0x57b7db===0x193)throw new SDKError(ErrorCode[_0x18eb10(0x1bf)],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x4e809d);}throw _0x4e809d;}}if(errorContains(_0x4e809d,_0x18eb10(0x225),_0x18eb10(0x197),_0x18eb10(0x2a3))){_0x538d16++;if(_0x538d16>=_0x3eaf74)throw new SDKError(ErrorCode[_0x18eb10(0x27f)],_0x18eb10(0x2a0)+_0x3eaf74+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x4e809d);const _0x19d5e9=this[_0x18eb10(0x275)]();_0x3694bf=_0x19d5e9+'_'+generateRandomHex();continue;}throw _0x4e809d;}}throw new SDKError(ErrorCode[_0x18eb10(0x1d5)],_0x18eb10(0x1d4));}async[a138_0x192cb2(0x281)](_0xa4957f,_0x4cc6a0){const _0x31361b=a138_0x192cb2,_0x37bed9=_0x4cc6a0||this[_0x31361b(0x260)],_0x1f5fe1=await this[_0x31361b(0x195)]['listAgents'](_0x37bed9),_0x212453=_0x1f5fe1[_0x31361b(0x1ab)](_0x126cb8=>_0x126cb8[_0x31361b(0x21d)][_0x31361b(0x1c3)]===_0xa4957f);if(_0x212453[_0x31361b(0x20d)]===0x0){const _0x4f7abd=_0x37bed9?_0x31361b(0x294)+_0x37bed9:'';throw new SDKError(ErrorCode[_0x31361b(0x210)],_0x31361b(0x21f)+_0xa4957f+_0x4f7abd,undefined,{'helpText':_0x37bed9?_0x31361b(0x1a4):_0x31361b(0x18e)});}if(_0x212453[_0x31361b(0x20d)]>0x1)throw new SDKError(ErrorCode[_0x31361b(0x1d5)],_0x31361b(0x1b5)+_0xa4957f+_0x31361b(0x28a));return _0x212453[0x0]['id'];}async[a138_0x192cb2(0x1df)](_0x4d0390){const _0x5cf610=a138_0x192cb2,_0x465a61=_0x4d0390||this[_0x5cf610(0x260)];return await this[_0x5cf610(0x195)][_0x5cf610(0x29e)](_0x465a61);}async[a138_0x192cb2(0x1a9)](_0x23bb5c){const _0x5d0051=a138_0x192cb2;return await this['client'][_0x5d0051(0x282)](_0x23bb5c);}async[a138_0x192cb2(0x1e7)](_0x4c7f7f){const _0x135564=a138_0x192cb2;return await this[_0x135564(0x195)][_0x135564(0x1e3)](_0x4c7f7f);}async[a138_0x192cb2(0x21b)](_0x5272e3){const _0x34b35c=a138_0x192cb2;return await this['client'][_0x34b35c(0x21b)](_0x5272e3);}async[a138_0x192cb2(0x232)](_0x358bf4,_0x58630b){const _0x58a19f=a138_0x192cb2;return await this[_0x58a19f(0x195)][_0x58a19f(0x232)](_0x358bf4,_0x58630b);}async[a138_0x192cb2(0x19e)](_0x4e0eae){const _0x2d023d=a138_0x192cb2;await this[_0x2d023d(0x195)][_0x2d023d(0x19e)](_0x4e0eae);}async['startChat'](_0xc4958){const _0x32ec79=a138_0x192cb2;return await this[_0x32ec79(0x195)][_0x32ec79(0x263)]({'agentId':_0xc4958});}async*[a138_0x192cb2(0x201)](_0x2c61e7,_0x26c14f){const _0x1aa969=a138_0x192cb2;let _0x52be4c=_0x26c14f?.[_0x1aa969(0x1a0)];const _0xe14017=_0x26c14f?.['agentId'];if(!_0x52be4c){if(!_0xe14017)throw new Error(_0x1aa969(0x239));const _0x193186=await this['client'][_0x1aa969(0x263)]({'agentId':_0xe14017});_0x52be4c=_0x193186['id'],yield{'type':_0x1aa969(0x1e8),'data':{'chatId':_0x52be4c,'agentId':_0xe14017,'projectId':_0x193186['attributes']['projectId']}};}for await(const _0x59d939 of this[_0x1aa969(0x195)]['continueChat'](_0x52be4c,_0x2c61e7,_0x26c14f?.[_0x1aa969(0x1b4)])){yield{'type':_0x1aa969(0x1a6),'data':_0x59d939};}}async[a138_0x192cb2(0x1dc)](_0x484824=0x32){const _0x32dc99=a138_0x192cb2;return await this[_0x32dc99(0x195)]['listChats'](_0x484824);}async[a138_0x192cb2(0x1f2)](_0x1319ef){const _0x214cd7=a138_0x192cb2;return await this[_0x214cd7(0x195)][_0x214cd7(0x250)](_0x1319ef);}async[a138_0x192cb2(0x245)](_0x36d88b){const _0x153deb=a138_0x192cb2;return await this[_0x153deb(0x195)][_0x153deb(0x245)](_0x36d88b);}async[a138_0x192cb2(0x1dd)](_0x5a42d0){const _0x2865f0=a138_0x192cb2;return await this[_0x2865f0(0x195)]['getChatInfo'](_0x5a42d0);}async[a138_0x192cb2(0x29d)](_0x2a6979,_0x5fcf97,_0x49d2c6){const _0x34d18a=a138_0x192cb2,_0x2487d7=_0x49d2c6?.[_0x34d18a(0x298)]??![],{projectId:_0x3d6a11,project:_0x15660b}=await this[_0x34d18a(0x20b)](_0x2a6979),_0x59bb93=_0x15660b[_0x34d18a(0x21d)][_0x34d18a(0x1c3)],_0x1adc78=_0x5fcf97||_0x59bb93+_0x34d18a(0x26b);if(a138_0x181126[_0x34d18a(0x196)](_0x1adc78)&&!_0x2487d7)throw new SDKError(ErrorCode[_0x34d18a(0x27f)],_0x34d18a(0x198)+_0x1adc78,undefined,{'helpText':_0x34d18a(0x273)});const _0x5d566b=await this['client'][_0x34d18a(0x282)](_0x3d6a11),_0x2cd3b3=await this[_0x34d18a(0x195)][_0x34d18a(0x200)](_0x3d6a11),_0x2111b6=await this[_0x34d18a(0x195)]['listPrompts'](_0x3d6a11),_0x46089a=await this[_0x34d18a(0x195)][_0x34d18a(0x1b8)](_0x3d6a11);if(!_0x2487d7){a138_0x181126[_0x34d18a(0x1bc)](_0x1adc78,{'recursive':!![]});const _0x9dc7ba={'version':'1.0','exportedAt':new Date()[_0x34d18a(0x251)](),'exportedFrom':{'site':this['context'][_0x34d18a(0x279)],'projectId':_0x3d6a11,'projectName':_0x59bb93},'project':_0x15660b};a138_0x181126[_0x34d18a(0x2a1)](a138_0x3bc761[_0x34d18a(0x224)](_0x1adc78,'project.json'),JSON['stringify'](_0x9dc7ba,null,0x2)),a138_0x181126[_0x34d18a(0x2a1)](a138_0x3bc761[_0x34d18a(0x224)](_0x1adc78,'agents.json'),JSON[_0x34d18a(0x264)](_0x5d566b,null,0x2)),a138_0x181126[_0x34d18a(0x2a1)](a138_0x3bc761[_0x34d18a(0x224)](_0x1adc78,_0x34d18a(0x267)),JSON[_0x34d18a(0x264)](_0x2cd3b3,null,0x2)),a138_0x181126[_0x34d18a(0x2a1)](a138_0x3bc761['join'](_0x1adc78,_0x34d18a(0x283)),JSON[_0x34d18a(0x264)](_0x2111b6,null,0x2)),a138_0x181126[_0x34d18a(0x2a1)](a138_0x3bc761[_0x34d18a(0x224)](_0x1adc78,_0x34d18a(0x293)),JSON['stringify'](_0x46089a,null,0x2));}return{'projectName':_0x59bb93,'outputDir':_0x1adc78,'counts':{'agents':_0x5d566b[_0x34d18a(0x20d)],'knowledgeBases':_0x2cd3b3[_0x34d18a(0x20d)],'prompts':_0x2111b6[_0x34d18a(0x20d)],'integrations':_0x46089a[_0x34d18a(0x20d)]}};}async[a138_0x192cb2(0x297)](_0x564527,_0x37e37c){const _0x5d673f=a138_0x192cb2,_0x302fc5=_0x37e37c?.[_0x5d673f(0x298)]??![],_0x3e7ce7=this[_0x5d673f(0x27d)](_0x564527),_0x5b17a6=_0x3e7ce7[_0x5d673f(0x231)][_0x5d673f(0x279)],_0x2b4db2=this[_0x5d673f(0x238)]['site'],_0x537ef1=_0x5b17a6!==_0x2b4db2?_0x5b17a6:undefined,_0x3757de=this['loadJsonFile'](a138_0x3bc761[_0x5d673f(0x224)](_0x564527,_0x5d673f(0x292)),[]),_0x285d09=this['loadJsonFile'](a138_0x3bc761[_0x5d673f(0x224)](_0x564527,_0x5d673f(0x267)),[]),_0x27bd87=this['loadJsonFile'](a138_0x3bc761[_0x5d673f(0x224)](_0x564527,_0x5d673f(0x283)),[]),_0xe6dde5=this[_0x5d673f(0x25c)](a138_0x3bc761['join'](_0x564527,_0x5d673f(0x293)),[]),_0x33983f=_0x37e37c?.[_0x5d673f(0x1c3)]||_0x3e7ce7[_0x5d673f(0x231)]['projectName'];if(_0x302fc5){const _0x362ea5=new Map(),_0x202c30=[..._0x3757de],_0x2503c2=_0x3757de['length']+0x1;let _0x49f436=0x0;while(_0x202c30['length']>0x0&&_0x49f436<_0x2503c2){_0x49f436++;const _0x573aa4=[];for(const _0x3df101 of _0x202c30){canCreateAgent(_0x3df101,_0x362ea5)?_0x362ea5['set'](_0x3df101['id'],_0x5d673f(0x23c)+_0x3df101['id']):_0x573aa4['push'](_0x3df101);}if(_0x573aa4[_0x5d673f(0x20d)]===_0x202c30[_0x5d673f(0x20d)])throw new SDKError(ErrorCode['INTERNAL'],_0x5d673f(0x1d7),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x202c30[_0x5d673f(0x20d)]=0x0,_0x202c30[_0x5d673f(0x204)](..._0x573aa4);}const _0x56866d=_0x27bd87['filter'](_0x642992=>_0x362ea5['has'](_0x642992[_0x5d673f(0x21d)][_0x5d673f(0x26c)]))[_0x5d673f(0x20d)];return{'projectName':_0x33983f,'projectId':_0x5d673f(0x1fb),'counts':{'agents':_0x3757de[_0x5d673f(0x20d)],'knowledgeBases':_0x285d09[_0x5d673f(0x20d)],'prompts':_0x56866d,'integrations':_0xe6dde5['length']},'sourceSite':_0x537ef1};}const _0x120b0e=await this['client'][_0x5d673f(0x208)]({'name':_0x33983f,'description':_0x3e7ce7[_0x5d673f(0x230)][_0x5d673f(0x21d)]['description']}),_0x2d98a3=_0x120b0e['id'],_0x92eec0=new Map(),_0x258630=new Map(),_0x430862=new Map();for(const _0x58a097 of _0x285d09){const _0x173036=await this[_0x5d673f(0x195)]['createKnowledgeBase']({'projectId':_0x2d98a3,'name':_0x58a097[_0x5d673f(0x21d)][_0x5d673f(0x1c3)],'tdDatabaseName':_0x58a097['attributes']['tdDatabaseName'],'tables':_0x58a097[_0x5d673f(0x21d)][_0x5d673f(0x18d)]});_0x92eec0[_0x5d673f(0x274)](_0x58a097['id'],_0x173036['id']);}const _0x5ec703=[..._0x3757de],_0x3cab6d=_0x3757de[_0x5d673f(0x20d)]+0x1;let _0x47e463=0x0;while(_0x5ec703[_0x5d673f(0x20d)]>0x0&&_0x47e463<_0x3cab6d){_0x47e463++;const _0x50ce1e=[];for(const _0x6355d of _0x5ec703){if(canCreateAgent(_0x6355d,_0x258630)){const _0x2fc233=remapToolIds(_0x6355d['attributes'][_0x5d673f(0x1b3)],_0x92eec0,_0x258630),_0x1fd44a=remapVariableIds(_0x6355d['attributes'][_0x5d673f(0x269)],_0x92eec0),_0x26ba55=await this[_0x5d673f(0x195)][_0x5d673f(0x189)]({'name':_0x6355d[_0x5d673f(0x21d)][_0x5d673f(0x1c3)],'projectId':_0x2d98a3,'systemPrompt':_0x6355d[_0x5d673f(0x21d)][_0x5d673f(0x219)],'starterMessage':_0x6355d[_0x5d673f(0x21d)][_0x5d673f(0x18f)],'modelType':migrateModelType(_0x6355d[_0x5d673f(0x21d)][_0x5d673f(0x299)]),'maxToolIterations':_0x6355d[_0x5d673f(0x21d)]['maxToolIterations'],'temperature':_0x6355d['attributes'][_0x5d673f(0x28b)],'reasoningEffort':_0x6355d[_0x5d673f(0x21d)][_0x5d673f(0x182)],'outputs':_0x6355d['attributes'][_0x5d673f(0x1e9)],'tools':_0x2fc233,'variables':_0x1fd44a});_0x258630[_0x5d673f(0x274)](_0x6355d['id'],_0x26ba55['id']);}else _0x50ce1e['push'](_0x6355d);}if(_0x50ce1e['length']===_0x5ec703[_0x5d673f(0x20d)])throw new SDKError(ErrorCode[_0x5d673f(0x1d5)],_0x5d673f(0x1d7),undefined,{'helpText':_0x5d673f(0x24d)});_0x5ec703[_0x5d673f(0x20d)]=0x0,_0x5ec703[_0x5d673f(0x204)](..._0x50ce1e);}for(const _0x3059df of _0x27bd87){const _0x3862ce=_0x258630[_0x5d673f(0x24b)](_0x3059df[_0x5d673f(0x21d)][_0x5d673f(0x26c)]);if(!_0x3862ce)continue;const _0x225999=await this['client'][_0x5d673f(0x22d)]({'projectId':_0x2d98a3,'agentId':_0x3862ce,'name':_0x3059df[_0x5d673f(0x21d)][_0x5d673f(0x1c3)],'systemPrompt':_0x3059df[_0x5d673f(0x21d)]['systemPrompt'],'template':_0x3059df[_0x5d673f(0x21d)][_0x5d673f(0x28e)],'jsonSchemaHint':_0x3059df[_0x5d673f(0x21d)][_0x5d673f(0x253)]});_0x430862[_0x5d673f(0x274)](_0x3059df['id'],_0x225999['id']);}for(const _0x4d582f of _0xe6dde5){const _0x736b53=_0x4d582f[_0x5d673f(0x21d)]['actions'][_0x5d673f(0x25d)](_0x52c588=>({..._0x52c588,'promptId':_0x430862['get'](_0x52c588[_0x5d673f(0x202)])||_0x52c588[_0x5d673f(0x202)]}));await this[_0x5d673f(0x195)][_0x5d673f(0x19d)]({'projectId':_0x2d98a3,'serviceType':_0x4d582f['attributes']['serviceType'],'actions':_0x736b53,'slackMessageMode':_0x4d582f['attributes'][_0x5d673f(0x1cb)],'chatIgnoreManagedActions':_0x4d582f[_0x5d673f(0x21d)]['chatIgnoreManagedActions'],'chatWelcomeMessage':_0x4d582f['attributes'][_0x5d673f(0x1de)],'webhookCorsOrigins':_0x4d582f[_0x5d673f(0x21d)]['webhookCorsOrigins']});}return{'projectName':_0x33983f,'projectId':_0x2d98a3,'counts':{'agents':_0x258630[_0x5d673f(0x271)],'knowledgeBases':_0x92eec0[_0x5d673f(0x271)],'prompts':_0x430862[_0x5d673f(0x271)],'integrations':_0xe6dde5[_0x5d673f(0x20d)]},'sourceSite':_0x537ef1};}[a138_0x192cb2(0x25c)](_0x4a053c,_0x331aa2){const _0x470fe4=a138_0x192cb2;if(!a138_0x181126['existsSync'](_0x4a053c))return _0x331aa2;return JSON[_0x470fe4(0x181)](a138_0x181126[_0x470fe4(0x1bb)](_0x4a053c,'utf-8'));}['getBackupMetadata'](_0x563c0c){const _0x46cba5=a138_0x192cb2;if(!a138_0x181126[_0x46cba5(0x196)](_0x563c0c))throw new SDKError(ErrorCode[_0x46cba5(0x22e)],'Backup\x20folder\x20not\x20found:\x20'+_0x563c0c,undefined,{'helpText':_0x46cba5(0x1aa)});const _0x266a21=a138_0x3bc761['join'](_0x563c0c,_0x46cba5(0x247));if(!a138_0x181126[_0x46cba5(0x196)](_0x266a21))throw new SDKError(ErrorCode[_0x46cba5(0x22c)],_0x46cba5(0x1db)+_0x563c0c,undefined,{'helpText':_0x46cba5(0x2a4)});const _0x150c11=JSON[_0x46cba5(0x181)](a138_0x181126[_0x46cba5(0x1bb)](_0x266a21,'utf-8'));if(!isSupportedBackupVersion(_0x150c11[_0x46cba5(0x1b2)]))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x46cba5(0x193)+_0x150c11[_0x46cba5(0x1b2)],undefined,{'helpText':_0x46cba5(0x1d8)});return _0x150c11;}async[a138_0x192cb2(0x24c)](_0x2b362d,_0x528231,_0x443b11){const _0xe26d45=a138_0x192cb2,{projectId:_0x3a90ca,project:_0x5f2032}=await this[_0xe26d45(0x20b)](_0x2b362d),_0x1f2269=_0x5f2032['attributes'][_0xe26d45(0x1c3)];let _0x22b336;if(_0x528231)_0x22b336=_0x528231;else{const _0x28bbf6=a138_0x3bc761[_0xe26d45(0x224)](process[_0xe26d45(0x1ed)](),'agents'),_0x28eb80=getSanitizedPathWithMigration(_0x28bbf6,_0x1f2269);_0x28eb80[_0xe26d45(0x24f)]&&this[_0xe26d45(0x18b)]['info'](_0xe26d45(0x289)+a138_0x3bc761[_0xe26d45(0x206)](_0x28eb80[_0xe26d45(0x1af)])+_0xe26d45(0x26d)+a138_0x3bc761[_0xe26d45(0x206)](_0x28eb80[_0xe26d45(0x211)])),_0x22b336=_0x28eb80[_0xe26d45(0x211)];}const _0x20e8df=await this[_0xe26d45(0x195)][_0xe26d45(0x282)](_0x3a90ca),_0x41ccb3=await this[_0xe26d45(0x195)][_0xe26d45(0x200)](_0x3a90ca),_0x369a04=await this[_0xe26d45(0x195)][_0xe26d45(0x1f4)](_0x3a90ca),_0x1073ab=await safeListOrEmpty(()=>this['client']['listImageGenerators'](_0x3a90ca)),_0x41edd4=await safeListOrEmpty(()=>this[_0xe26d45(0x195)]['listWebSearchTools'](_0x3a90ca)),_0x536532=await this[_0xe26d45(0x195)]['listPrompts'](_0x3a90ca),_0x20b922=await this[_0xe26d45(0x195)][_0xe26d45(0x1b8)](_0x3a90ca),_0x29cc4e=await safeListOrEmpty(()=>this[_0xe26d45(0x195)][_0xe26d45(0x255)](_0x3a90ca)),_0x1c09db=await safeListOrEmpty(()=>this[_0xe26d45(0x195)][_0xe26d45(0x262)](_0x3a90ca)),_0x2aae00=await safeListOrEmpty(()=>this[_0xe26d45(0x195)][_0xe26d45(0x28f)](_0x3a90ca)),_0x2787ac=await safeListOrEmpty(()=>this[_0xe26d45(0x195)][_0xe26d45(0x241)](_0x3a90ca)),_0x38f3cd=_0x20b922['filter'](_0x466c1b=>!_0x466c1b[_0xe26d45(0x21d)][_0xe26d45(0x1f3)]&&SAFE_INTEGRATION_TYPES[_0xe26d45(0x1ca)](_0x466c1b[_0xe26d45(0x21d)][_0xe26d45(0x27c)]['toLowerCase']())),_0x243516=new Map(),_0x27c117=new Map(),_0x2a38db=new Map(),_0x4f7b41=new Map(),_0x5b19d0=new Map(),_0x2e1f49=new Map(),_0x108909=new Map();for(const _0x4babd1 of _0x20e8df){_0x243516[_0xe26d45(0x274)](_0x4babd1['id'],_0x4babd1['attributes'][_0xe26d45(0x1c3)]);}for(const _0x5ade6d of _0x41ccb3){_0x27c117['set'](_0x5ade6d['id'],_0x5ade6d[_0xe26d45(0x21d)]['name']);}for(const _0x112bae of _0x369a04){_0x2a38db[_0xe26d45(0x274)](_0x112bae['id'],_0x112bae[_0xe26d45(0x21d)][_0xe26d45(0x1c3)]);}for(const _0x44c126 of _0x1073ab){_0x4f7b41[_0xe26d45(0x274)](_0x44c126['id'],_0x44c126['attributes']['name']);}for(const _0x43dddc of _0x41edd4){_0x5b19d0[_0xe26d45(0x274)](_0x43dddc['id'],_0x43dddc[_0xe26d45(0x21d)][_0xe26d45(0x1c3)]);}for(const _0x37d95f of _0x536532){_0x2e1f49[_0xe26d45(0x274)](_0x37d95f['id'],_0x37d95f[_0xe26d45(0x21d)]['name']);}for(const _0x3cbcd6 of _0x29cc4e){_0x108909[_0xe26d45(0x274)](_0x3cbcd6['id'],_0x3cbcd6[_0xe26d45(0x21d)][_0xe26d45(0x1c3)]);}const _0x446be6={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x27c117,'TextKnowledgeBase':_0x2a38db,'Agent':_0x243516,'WebSearchTool':_0x5b19d0,'ImageGenerator':_0x4f7b41,'ExperimentalKnowledgeBase':_0x108909}),'resolvePromptName':async _0x558154=>_0x2e1f49['get'](_0x558154),'onWarning':_0x571986=>this[_0xe26d45(0x18b)][_0xe26d45(0x1f9)](_0x571986)},_0x5d7cb1={'projectName':_0x1f2269,'outputDir':_0x22b336,'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}}},_0x337c89=[],_0x50dd34=[];for(const _0x448572 of _0x20e8df){const _0x2f78bf=getSanitizedPathWithMigration(_0x22b336,_0x448572[_0xe26d45(0x21d)][_0xe26d45(0x1c3)]);_0x2f78bf[_0xe26d45(0x24f)]&&this[_0xe26d45(0x18b)]['info'](_0xe26d45(0x21a)+a138_0x3bc761[_0xe26d45(0x206)](_0x2f78bf['oldPath'])+'\x20→\x20'+a138_0x3bc761[_0xe26d45(0x206)](_0x2f78bf[_0xe26d45(0x211)]));const _0x17e20d=_0x2f78bf['path'],_0x32c4ac=a138_0x3bc761['join'](_0x17e20d,_0xe26d45(0x1e4)),_0x44a543=a138_0x3bc761['join'](_0x17e20d,'agent.yml'),_0x5922cd=a138_0x3bc761[_0xe26d45(0x224)](_0x17e20d,_0xe26d45(0x217)),{yaml:_0x5b10b7,systemPrompt:_0x4dca8e,starterMessage:_0x4b5bf6}=await agentResponseToDef(_0x448572,_0x446be6),_0x21f10d=toAgentYamlString(_0x5b10b7),_0x22a8d6=!a138_0x181126['existsSync'](_0x44a543);let _0x5e0238=_0x22a8d6,_0x769f45;if(!_0x22a8d6){const _0x2b9585=a138_0x181126[_0xe26d45(0x196)](_0x32c4ac)?a138_0x181126[_0xe26d45(0x1bb)](_0x32c4ac,_0xe26d45(0x237)):'',_0x43cd3b=a138_0x181126['readFileSync'](_0x44a543,'utf-8'),_0x804108=_0xe26d45(0x1c9)+_0x2b9585+_0xe26d45(0x1fe)+_0x43cd3b,_0x1b46d9=_0xe26d45(0x1c9)+_0x4dca8e+'\x0a\x0a#\x20agent.yml\x0a'+_0x21f10d,_0x4ce768=generateDiff(_0x804108,_0x1b46d9);_0x5e0238=hasChanges(_0x4ce768),_0x5e0238&&(_0x769f45=formatDiffWithColors(_0x4ce768));}_0x337c89[_0xe26d45(0x204)]({'path':_0x17e20d,'content':'','isDir':!![]}),_0x337c89['push']({'path':_0x32c4ac,'content':_0x4dca8e}),_0x337c89[_0xe26d45(0x204)]({'path':_0x44a543,'content':_0x21f10d});_0x4b5bf6&&_0x4b5bf6[_0xe26d45(0x1ca)]('\x0a')&&_0x337c89['push']({'path':_0x5922cd,'content':_0x4b5bf6});_0x5d7cb1[_0xe26d45(0x1df)]['push']({'agentName':_0x448572[_0xe26d45(0x21d)]['name'],'outputPath':_0x17e20d,'isNew':_0x22a8d6,'hasChanges':_0x5e0238,'diff':_0x769f45}),_0x5d7cb1[_0xe26d45(0x1f1)]['agents']['total']++;if(_0x22a8d6)_0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x1df)][_0xe26d45(0x1a5)]++;else{if(_0x5e0238)_0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x1df)][_0xe26d45(0x266)]++;else _0x5d7cb1['counts']['agents'][_0xe26d45(0x277)]++;}}for(const _0x224b0e of _0x41ccb3){if(_0x224b0e[_0xe26d45(0x21d)][_0xe26d45(0x1f3)])continue;const _0x2683bc=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x22b336),_0x224b0e[_0xe26d45(0x21d)][_0xe26d45(0x1c3)],_0xe26d45(0x1b6));_0x2683bc[_0xe26d45(0x24f)]&&this['logger'][_0xe26d45(0x1a2)](_0xe26d45(0x29f)+a138_0x3bc761[_0xe26d45(0x206)](_0x2683bc[_0xe26d45(0x1af)])+_0xe26d45(0x26d)+a138_0x3bc761[_0xe26d45(0x206)](_0x2683bc[_0xe26d45(0x211)]));const _0x5d0dfc=_0x2683bc['path'],_0x26787c=apiKnowledgeBaseToYaml(_0x224b0e),_0x18f690=toKnowledgeBaseYamlString(_0x26787c),_0x2b95fd=!a138_0x181126[_0xe26d45(0x196)](_0x5d0dfc);let _0x1ccdc9=_0x2b95fd,_0x3af1c7;if(!_0x2b95fd){const _0x55c134=a138_0x181126['readFileSync'](_0x5d0dfc,_0xe26d45(0x237)),_0x1d59e1=generateDiff(_0x55c134,_0x18f690);_0x1ccdc9=hasChanges(_0x1d59e1),_0x1ccdc9&&(_0x3af1c7=formatDiffWithColors(_0x1d59e1));}_0x337c89[_0xe26d45(0x204)]({'path':_0x5d0dfc,'content':_0x18f690}),_0x5d7cb1[_0xe26d45(0x1fc)][_0xe26d45(0x204)]({'name':_0x224b0e[_0xe26d45(0x21d)][_0xe26d45(0x1c3)],'outputPath':_0x5d0dfc,'isNew':_0x2b95fd,'hasChanges':_0x1ccdc9,'diff':_0x3af1c7}),_0x5d7cb1[_0xe26d45(0x1f1)]['knowledgeBases']['total']++;if(_0x2b95fd)_0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x1fc)][_0xe26d45(0x1a5)]++;else{if(_0x1ccdc9)_0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x1fc)]['updated']++;else _0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x1fc)][_0xe26d45(0x277)]++;}}for(const _0x19cebf of _0x369a04){if(_0x19cebf[_0xe26d45(0x21d)][_0xe26d45(0x1f3)])continue;const _0x23f09e=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x22b336),_0x19cebf[_0xe26d45(0x21d)][_0xe26d45(0x1c3)],_0xe26d45(0x249));_0x23f09e[_0xe26d45(0x24f)]&&this[_0xe26d45(0x18b)][_0xe26d45(0x1a2)](_0xe26d45(0x25f)+a138_0x3bc761[_0xe26d45(0x206)](_0x23f09e[_0xe26d45(0x1af)])+_0xe26d45(0x26d)+a138_0x3bc761[_0xe26d45(0x206)](_0x23f09e[_0xe26d45(0x211)]));const _0x40131b=_0x23f09e[_0xe26d45(0x211)],_0x281872=toTextKnowledgeBaseMd(_0x19cebf[_0xe26d45(0x21d)][_0xe26d45(0x1c3)],_0x19cebf[_0xe26d45(0x21d)][_0xe26d45(0x27b)]),_0x589935=!a138_0x181126[_0xe26d45(0x196)](_0x40131b);let _0x16f9e8=_0x589935,_0x4b9dc4;if(!_0x589935){const _0xad14c5=a138_0x181126[_0xe26d45(0x1bb)](_0x40131b,_0xe26d45(0x237)),_0x1599c3=generateDiff(_0xad14c5,_0x281872);_0x16f9e8=hasChanges(_0x1599c3),_0x16f9e8&&(_0x4b9dc4=formatDiffWithColors(_0x1599c3));}_0x337c89['push']({'path':_0x40131b,'content':_0x281872}),_0x5d7cb1[_0xe26d45(0x185)]['push']({'name':_0x19cebf[_0xe26d45(0x21d)][_0xe26d45(0x1c3)],'outputPath':_0x40131b,'isNew':_0x589935,'hasChanges':_0x16f9e8,'diff':_0x4b9dc4}),_0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x185)][_0xe26d45(0x1d1)]++;if(_0x589935)_0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x185)][_0xe26d45(0x1a5)]++;else{if(_0x16f9e8)_0x5d7cb1[_0xe26d45(0x1f1)]['textKnowledgeBases'][_0xe26d45(0x266)]++;else _0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x185)]['unchanged']++;}}for(const _0x5212d3 of _0x536532){if(_0x5212d3[_0xe26d45(0x21d)]['isManaged'])continue;const _0x4c7bff=getSanitizedPathWithMigration(getPromptsDir(_0x22b336),_0x5212d3[_0xe26d45(0x21d)][_0xe26d45(0x1c3)],'.yml');_0x4c7bff['renamed']&&this['logger'][_0xe26d45(0x1a2)](_0xe26d45(0x29b)+a138_0x3bc761['basename'](_0x4c7bff[_0xe26d45(0x1af)])+'\x20→\x20'+a138_0x3bc761[_0xe26d45(0x206)](_0x4c7bff['path']));const _0x1edd0f=_0x4c7bff[_0xe26d45(0x211)],_0x54b806=await apiPromptToYaml(_0x5212d3,_0x446be6);if(!_0x54b806)continue;const _0x10c369=toPromptYamlString(_0x54b806),_0x2cae7c=!a138_0x181126[_0xe26d45(0x196)](_0x1edd0f);let _0x388d47=_0x2cae7c,_0x1c8b14;if(!_0x2cae7c){const _0x427da7=a138_0x181126[_0xe26d45(0x1bb)](_0x1edd0f,'utf-8'),_0x77ace8=generateDiff(_0x427da7,_0x10c369);_0x388d47=hasChanges(_0x77ace8),_0x388d47&&(_0x1c8b14=formatDiffWithColors(_0x77ace8));}_0x337c89['push']({'path':_0x1edd0f,'content':_0x10c369}),_0x5d7cb1['prompts'][_0xe26d45(0x204)]({'name':_0x5212d3[_0xe26d45(0x21d)][_0xe26d45(0x1c3)],'outputPath':_0x1edd0f,'isNew':_0x2cae7c,'hasChanges':_0x388d47,'diff':_0x1c8b14}),_0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x1ec)]['total']++;if(_0x2cae7c)_0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x1ec)]['new']++;else{if(_0x388d47)_0x5d7cb1[_0xe26d45(0x1f1)]['prompts'][_0xe26d45(0x266)]++;else _0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x1ec)][_0xe26d45(0x277)]++;}}for(const _0xa68c82 of _0x38f3cd){const _0x3cd0f0=_0xa68c82[_0xe26d45(0x21d)]['serviceType'][_0xe26d45(0x295)](),_0x2a1d15=getSanitizedPathWithMigration(getIntegrationsDir(_0x22b336),_0x3cd0f0,_0xe26d45(0x1b6));_0x2a1d15[_0xe26d45(0x24f)]&&this[_0xe26d45(0x18b)][_0xe26d45(0x1a2)](_0xe26d45(0x1d9)+a138_0x3bc761['basename'](_0x2a1d15[_0xe26d45(0x1af)])+_0xe26d45(0x26d)+a138_0x3bc761[_0xe26d45(0x206)](_0x2a1d15[_0xe26d45(0x211)]));const _0x5ae711=_0x2a1d15['path'],_0xe1f012=await apiIntegrationToYaml(_0xa68c82,_0x446be6),_0x241abd=toIntegrationYamlString(_0xe1f012),_0x17a2b0=!a138_0x181126[_0xe26d45(0x196)](_0x5ae711);let _0x4c05cc=_0x17a2b0,_0x3f8f52;if(!_0x17a2b0){const _0x2776ce=a138_0x181126[_0xe26d45(0x1bb)](_0x5ae711,_0xe26d45(0x237)),_0x1a6a5b=generateDiff(_0x2776ce,_0x241abd);_0x4c05cc=hasChanges(_0x1a6a5b),_0x4c05cc&&(_0x3f8f52=formatDiffWithColors(_0x1a6a5b));}_0x337c89[_0xe26d45(0x204)]({'path':_0x5ae711,'content':_0x241abd}),_0x5d7cb1['integrations'][_0xe26d45(0x204)]({'name':_0x3cd0f0,'outputPath':_0x5ae711,'isNew':_0x17a2b0,'hasChanges':_0x4c05cc,'diff':_0x3f8f52}),_0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x256)][_0xe26d45(0x1d1)]++;if(_0x17a2b0)_0x5d7cb1['counts'][_0xe26d45(0x256)]['new']++;else{if(_0x4c05cc)_0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x256)][_0xe26d45(0x266)]++;else _0x5d7cb1['counts'][_0xe26d45(0x256)]['unchanged']++;}}for(const _0x5f39b6 of _0x29cc4e){if(_0x5f39b6[_0xe26d45(0x21d)]['isManaged'])continue;const _0x157379=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x22b336),_0x5f39b6[_0xe26d45(0x21d)][_0xe26d45(0x1c3)]);_0x157379[_0xe26d45(0x24f)]&&this[_0xe26d45(0x18b)][_0xe26d45(0x1a2)](_0xe26d45(0x222)+a138_0x3bc761['basename'](_0x157379[_0xe26d45(0x1af)])+'\x20→\x20'+a138_0x3bc761[_0xe26d45(0x206)](_0x157379[_0xe26d45(0x211)]));const _0x3bdeb3=_0x157379[_0xe26d45(0x211)],_0x866267=a138_0x3bc761['join'](_0x3bdeb3,sanitizeForFilesystem(_0x5f39b6[_0xe26d45(0x21d)]['name'])+'.yml'),_0x371f03=a138_0x3bc761[_0xe26d45(0x224)](_0x3bdeb3,'functions'),_0x512d74=apiExperimentalKnowledgeBaseToYaml(_0x5f39b6),_0x2b1ad7=toExperimentalKnowledgeBaseYamlString(_0x512d74),_0x2807a5=!a138_0x181126['existsSync'](_0x3bdeb3);let _0x257fbe=_0x2807a5,_0x550718,_0x108772=_0x2b1ad7;const _0x2c12a1=[..._0x512d74[_0xe26d45(0x1d6)]][_0xe26d45(0x223)]((_0x5d5359,_0x12c002)=>_0x5d5359[_0xe26d45(0x1c3)][_0xe26d45(0x1b9)](_0x12c002['name']));for(const _0x3ee273 of _0x2c12a1){_0x108772+=_0xe26d45(0x1bd)+_0x3ee273[_0xe26d45(0x1c3)]+_0xe26d45(0x184)+_0x3ee273[_0xe26d45(0x194)]+_0xe26d45(0x2a6)+_0x3ee273['name']+'\x20---\x0a'+_0x3ee273[_0xe26d45(0x1ee)]+'\x0a';}if(!_0x2807a5){let _0x29f29d='';a138_0x181126[_0xe26d45(0x196)](_0x866267)&&(_0x29f29d=a138_0x181126[_0xe26d45(0x1bb)](_0x866267,_0xe26d45(0x237)));if(a138_0x181126[_0xe26d45(0x196)](_0x371f03)){const _0x4ae5c2=a138_0x181126[_0xe26d45(0x1f0)](_0x371f03,{'withFileTypes':!![]}),_0x306220=_0x4ae5c2[_0xe26d45(0x1ab)](_0x346c96=>_0x346c96['isDirectory']())[_0xe26d45(0x223)]((_0x225fca,_0x34ad4f)=>_0x225fca[_0xe26d45(0x1c3)]['localeCompare'](_0x34ad4f[_0xe26d45(0x1c3)]));for(const _0x44cd10 of _0x306220){const _0x55d339=a138_0x3bc761['join'](_0x371f03,_0x44cd10[_0xe26d45(0x1c3)],'code.js'),_0x412a8c=a138_0x3bc761[_0xe26d45(0x224)](_0x371f03,_0x44cd10['name'],_0xe26d45(0x17f));a138_0x181126[_0xe26d45(0x196)](_0x55d339)&&(_0x29f29d+=_0xe26d45(0x1bd)+_0x44cd10['name']+_0xe26d45(0x184)+a138_0x181126[_0xe26d45(0x1bb)](_0x55d339,_0xe26d45(0x237))+'\x0a'),a138_0x181126[_0xe26d45(0x196)](_0x412a8c)&&(_0x29f29d+=_0xe26d45(0x1b7)+_0x44cd10[_0xe26d45(0x1c3)]+_0xe26d45(0x184)+a138_0x181126[_0xe26d45(0x1bb)](_0x412a8c,_0xe26d45(0x237))+'\x0a');}}const _0x385a75=generateDiff(_0x29f29d,_0x108772);_0x257fbe=hasChanges(_0x385a75),_0x257fbe&&(_0x550718=formatDiffWithColors(_0x385a75));}_0x337c89['push']({'path':_0x3bdeb3,'content':'','isDir':!![]}),_0x337c89[_0xe26d45(0x204)]({'path':_0x866267,'content':_0x2b1ad7}),_0x337c89['push']({'path':_0x371f03,'content':'','isDir':!![]});for(const _0x4d4042 of _0x512d74[_0xe26d45(0x1d6)]){const _0x3d9d7e=a138_0x3bc761[_0xe26d45(0x224)](_0x371f03,sanitizeForFilesystem(_0x4d4042[_0xe26d45(0x1c3)])),_0x92be2c=a138_0x3bc761['join'](_0x3d9d7e,_0xe26d45(0x287)),_0x259593=a138_0x3bc761[_0xe26d45(0x224)](_0x3d9d7e,_0xe26d45(0x17f));_0x337c89[_0xe26d45(0x204)]({'path':_0x3d9d7e,'content':'','isDir':!![]}),_0x337c89[_0xe26d45(0x204)]({'path':_0x92be2c,'content':_0x4d4042[_0xe26d45(0x194)]}),_0x337c89['push']({'path':_0x259593,'content':_0x4d4042['json_schema']});}if(a138_0x181126[_0xe26d45(0x196)](_0x371f03)){const _0x134e66=a138_0x181126[_0xe26d45(0x1f0)](_0x371f03,{'withFileTypes':!![]}),_0x5bde2d=new Set(_0x512d74[_0xe26d45(0x1d6)][_0xe26d45(0x25d)](_0x49c98c=>sanitizeForFilesystem(_0x49c98c['name'])));for(const _0xd05b21 of _0x134e66){if(_0xd05b21[_0xe26d45(0x1a1)]()&&!_0x5bde2d[_0xe26d45(0x24a)](_0xd05b21[_0xe26d45(0x1c3)])){const _0x1a4f93=a138_0x3bc761[_0xe26d45(0x224)](_0x371f03,_0xd05b21['name']);_0x50dd34[_0xe26d45(0x204)]({'path':_0x1a4f93,'isDir':!![]});}}}_0x5d7cb1[_0xe26d45(0x276)][_0xe26d45(0x204)]({'name':_0x5f39b6[_0xe26d45(0x21d)]['name'],'outputPath':_0x3bdeb3,'isNew':_0x2807a5,'hasChanges':_0x257fbe,'diff':_0x550718}),_0x5d7cb1[_0xe26d45(0x1f1)]['experimentalKnowledgeBases']['total']++;if(_0x2807a5)_0x5d7cb1['counts'][_0xe26d45(0x276)][_0xe26d45(0x1a5)]++;else{if(_0x257fbe)_0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x276)][_0xe26d45(0x266)]++;else _0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x276)][_0xe26d45(0x277)]++;}}for(const _0x224261 of _0x1c09db){if(_0x224261[_0xe26d45(0x21d)][_0xe26d45(0x1f3)])continue;const _0x1d24dd=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x22b336),_0x224261['attributes'][_0xe26d45(0x1c3)]);_0x1d24dd[_0xe26d45(0x24f)]&&this[_0xe26d45(0x18b)][_0xe26d45(0x1a2)]('Renamed\x20experimental\x20artifact\x20directory:\x20'+a138_0x3bc761['basename'](_0x1d24dd['oldPath'])+_0xe26d45(0x26d)+a138_0x3bc761[_0xe26d45(0x206)](_0x1d24dd[_0xe26d45(0x211)]));const _0x4130a1=_0x1d24dd['path'],_0xfaf21a=a138_0x3bc761[_0xe26d45(0x224)](_0x4130a1,sanitizeForFilesystem(_0x224261[_0xe26d45(0x21d)][_0xe26d45(0x1c3)])+_0xe26d45(0x1b6)),_0x338518=a138_0x3bc761[_0xe26d45(0x224)](_0x4130a1,_0xe26d45(0x287)),_0x59fec9=a138_0x3bc761[_0xe26d45(0x224)](_0x4130a1,_0xe26d45(0x235)),_0x5dff56=apiExperimentalArtifactToYaml(_0x224261),_0x272433=toExperimentalArtifactYamlString(_0x5dff56),_0x4e7ad9=!a138_0x181126[_0xe26d45(0x196)](_0x4130a1);let _0x3fc3b1=_0x4e7ad9,_0x4e18dd,_0x4dd171=_0x272433+(_0xe26d45(0x240)+_0x5dff56[_0xe26d45(0x194)]+'\x0a');const _0x384045=[..._0x5dff56[_0xe26d45(0x235)]]['sort']((_0x375a45,_0x20351f)=>_0x375a45[_0xe26d45(0x236)][_0xe26d45(0x1b9)](_0x20351f[_0xe26d45(0x236)]));for(const _0xf1a700 of _0x384045){_0x4dd171+=_0xe26d45(0x1b1)+_0xf1a700[_0xe26d45(0x236)]+_0xe26d45(0x184)+_0xf1a700[_0xe26d45(0x280)]+'\x0a';}if(!_0x4e7ad9){let _0x43fac4='';a138_0x181126[_0xe26d45(0x196)](_0xfaf21a)&&(_0x43fac4=a138_0x181126[_0xe26d45(0x1bb)](_0xfaf21a,_0xe26d45(0x237)));a138_0x181126['existsSync'](_0x338518)&&(_0x43fac4+='\x0a---\x20code\x20---\x0a'+a138_0x181126[_0xe26d45(0x1bb)](_0x338518,_0xe26d45(0x237))+'\x0a');if(a138_0x181126['existsSync'](_0x59fec9)){const _0x4bf61c=a138_0x181126[_0xe26d45(0x1f0)](_0x59fec9),_0x127628=_0x4bf61c[_0xe26d45(0x1ab)](_0x3f0d08=>{const _0x9fd08a=_0xe26d45,_0x9569c0=a138_0x3bc761[_0x9fd08a(0x224)](_0x59fec9,_0x3f0d08);return a138_0x181126[_0x9fd08a(0x290)](_0x9569c0)[_0x9fd08a(0x1fa)]();})['sort']((_0x5e6f4d,_0x470bdd)=>_0x5e6f4d[_0xe26d45(0x1b9)](_0x470bdd));for(const _0x561910 of _0x127628){const _0x5c71d7=a138_0x3bc761[_0xe26d45(0x224)](_0x59fec9,_0x561910);_0x43fac4+=_0xe26d45(0x1b1)+_0x561910+_0xe26d45(0x184)+a138_0x181126[_0xe26d45(0x1bb)](_0x5c71d7,_0xe26d45(0x237))+'\x0a';}}const _0x165996=generateDiff(_0x43fac4,_0x4dd171);_0x3fc3b1=hasChanges(_0x165996),_0x3fc3b1&&(_0x4e18dd=formatDiffWithColors(_0x165996));}_0x337c89['push']({'path':_0x4130a1,'content':'','isDir':!![]}),_0x337c89[_0xe26d45(0x204)]({'path':_0xfaf21a,'content':_0x272433}),_0x337c89[_0xe26d45(0x204)]({'path':_0x338518,'content':_0x5dff56[_0xe26d45(0x194)]});if(_0x5dff56['files'][_0xe26d45(0x20d)]>0x0){_0x337c89[_0xe26d45(0x204)]({'path':_0x59fec9,'content':'','isDir':!![]});for(const _0x143ed0 of _0x5dff56[_0xe26d45(0x235)]){const _0x49126f=a138_0x3bc761['join'](_0x59fec9,_0x143ed0['file_name']);_0x337c89[_0xe26d45(0x204)]({'path':_0x49126f,'content':_0x143ed0[_0xe26d45(0x280)]});}}if(a138_0x181126['existsSync'](_0x59fec9)){const _0x40ecad=a138_0x181126[_0xe26d45(0x1f0)](_0x59fec9),_0x18e0be=new Set(_0x5dff56[_0xe26d45(0x235)][_0xe26d45(0x25d)](_0xbf71b3=>_0xbf71b3[_0xe26d45(0x236)]));for(const _0x49b8f4 of _0x40ecad){const _0x344254=a138_0x3bc761[_0xe26d45(0x224)](_0x59fec9,_0x49b8f4);a138_0x181126['statSync'](_0x344254)['isFile']()&&!_0x18e0be[_0xe26d45(0x24a)](_0x49b8f4)&&_0x50dd34[_0xe26d45(0x204)]({'path':_0x344254});}}_0x5d7cb1[_0xe26d45(0x1ba)][_0xe26d45(0x204)]({'name':_0x224261[_0xe26d45(0x21d)][_0xe26d45(0x1c3)],'outputPath':_0x4130a1,'isNew':_0x4e7ad9,'hasChanges':_0x3fc3b1,'diff':_0x4e18dd}),_0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x1ba)][_0xe26d45(0x1d1)]++;if(_0x4e7ad9)_0x5d7cb1['counts'][_0xe26d45(0x1ba)]['new']++;else{if(_0x3fc3b1)_0x5d7cb1['counts']['experimentalArtifacts'][_0xe26d45(0x266)]++;else _0x5d7cb1['counts'][_0xe26d45(0x1ba)]['unchanged']++;}}for(const _0x1b5215 of _0x2aae00){const _0xf8b660=getSanitizedPathWithMigration(getFormInterfacesDir(_0x22b336),_0x1b5215[_0xe26d45(0x21d)][_0xe26d45(0x1c3)],_0xe26d45(0x1b6));_0xf8b660[_0xe26d45(0x24f)]&&this[_0xe26d45(0x18b)][_0xe26d45(0x1a2)](_0xe26d45(0x18a)+a138_0x3bc761[_0xe26d45(0x206)](_0xf8b660[_0xe26d45(0x1af)])+_0xe26d45(0x26d)+a138_0x3bc761[_0xe26d45(0x206)](_0xf8b660[_0xe26d45(0x211)]));const _0x5acbd3=_0xf8b660[_0xe26d45(0x211)],_0xbcc0c8=await apiFormInterfaceToYaml(_0x1b5215,_0x446be6),_0x5bc593=toFormInterfaceYamlString(_0xbcc0c8),_0x3a7bd8=!a138_0x181126[_0xe26d45(0x196)](_0x5acbd3);let _0x3bcf43=_0x3a7bd8,_0x2d4330;if(!_0x3a7bd8){const _0x5b9726=a138_0x181126[_0xe26d45(0x1bb)](_0x5acbd3,_0xe26d45(0x237)),_0x38577f=generateDiff(_0x5b9726,_0x5bc593);_0x3bcf43=hasChanges(_0x38577f),_0x3bcf43&&(_0x2d4330=formatDiffWithColors(_0x38577f));}_0x337c89[_0xe26d45(0x204)]({'path':_0x5acbd3,'content':_0x5bc593}),_0x5d7cb1[_0xe26d45(0x1ad)][_0xe26d45(0x204)]({'name':_0x1b5215['attributes'][_0xe26d45(0x1c3)],'outputPath':_0x5acbd3,'isNew':_0x3a7bd8,'hasChanges':_0x3bcf43,'diff':_0x2d4330}),_0x5d7cb1['counts'][_0xe26d45(0x1ad)][_0xe26d45(0x1d1)]++;if(_0x3a7bd8)_0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x1ad)][_0xe26d45(0x1a5)]++;else{if(_0x3bcf43)_0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x1ad)][_0xe26d45(0x266)]++;else _0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x1ad)]['unchanged']++;}}for(const _0x20e888 of _0x2787ac){if(_0x20e888[_0xe26d45(0x21d)][_0xe26d45(0x1f3)])continue;const _0x1f4488=getSanitizedPathWithMigration(getChatInterfacesDir(_0x22b336),_0x20e888[_0xe26d45(0x21d)][_0xe26d45(0x1c3)],_0xe26d45(0x1b6));_0x1f4488[_0xe26d45(0x24f)]&&this[_0xe26d45(0x18b)]['info'](_0xe26d45(0x180)+a138_0x3bc761[_0xe26d45(0x206)](_0x1f4488[_0xe26d45(0x1af)])+_0xe26d45(0x26d)+a138_0x3bc761[_0xe26d45(0x206)](_0x1f4488[_0xe26d45(0x211)]));const _0x8de500=_0x1f4488[_0xe26d45(0x211)],_0x60920d=await apiChatInterfaceToYaml(_0x20e888,_0x446be6),_0x2bd335=toChatInterfaceYamlString(_0x60920d),_0x28f483=!a138_0x181126[_0xe26d45(0x196)](_0x8de500);let _0x444ad8=_0x28f483,_0xd9201f;if(!_0x28f483){const _0x2c6c91=a138_0x181126[_0xe26d45(0x1bb)](_0x8de500,_0xe26d45(0x237)),_0x11fe8f=generateDiff(_0x2c6c91,_0x2bd335);_0x444ad8=hasChanges(_0x11fe8f),_0x444ad8&&(_0xd9201f=formatDiffWithColors(_0x11fe8f));}_0x337c89['push']({'path':_0x8de500,'content':_0x2bd335}),_0x5d7cb1[_0xe26d45(0x1be)][_0xe26d45(0x204)]({'name':_0x20e888[_0xe26d45(0x21d)]['name'],'outputPath':_0x8de500,'isNew':_0x28f483,'hasChanges':_0x444ad8,'diff':_0xd9201f}),_0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x1be)][_0xe26d45(0x1d1)]++;if(_0x28f483)_0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x1be)][_0xe26d45(0x1a5)]++;else{if(_0x444ad8)_0x5d7cb1[_0xe26d45(0x1f1)][_0xe26d45(0x1be)][_0xe26d45(0x266)]++;else _0x5d7cb1[_0xe26d45(0x1f1)]['chatInterfaces'][_0xe26d45(0x277)]++;}}if(_0x443b11?.[_0xe26d45(0x298)])return _0x5d7cb1;a138_0x181126[_0xe26d45(0x1bc)](_0x22b336,{'recursive':!![]}),a138_0x181126[_0xe26d45(0x1bc)](getKnowledgeBasesDir(_0x22b336),{'recursive':!![]}),a138_0x181126[_0xe26d45(0x1bc)](getPromptsDir(_0x22b336),{'recursive':!![]}),a138_0x181126[_0xe26d45(0x1bc)](getIntegrationsDir(_0x22b336),{'recursive':!![]}),a138_0x181126['mkdirSync'](getExperimentalKnowledgeBasesDir(_0x22b336),{'recursive':!![]}),a138_0x181126[_0xe26d45(0x1bc)](getExperimentalArtifactsDir(_0x22b336),{'recursive':!![]}),a138_0x181126[_0xe26d45(0x1bc)](getFormInterfacesDir(_0x22b336),{'recursive':!![]}),a138_0x181126[_0xe26d45(0x1bc)](getChatInterfacesDir(_0x22b336),{'recursive':!![]});const _0x13f5de=a138_0x3bc761['join'](_0x22b336,_0xe26d45(0x1ff));a138_0x181126['writeFileSync'](_0x13f5de,createAgentConfigContent(_0x1f2269));for(const _0x371003 of _0x337c89){if(_0x371003[_0xe26d45(0x220)])a138_0x181126[_0xe26d45(0x1bc)](_0x371003[_0xe26d45(0x211)],{'recursive':!![]});else{const _0x3f139c=a138_0x3bc761[_0xe26d45(0x203)](_0x371003[_0xe26d45(0x211)]);!a138_0x181126['existsSync'](_0x3f139c)&&a138_0x181126[_0xe26d45(0x1bc)](_0x3f139c,{'recursive':!![]}),a138_0x181126[_0xe26d45(0x2a1)](_0x371003['path'],_0x371003[_0xe26d45(0x212)]);}}for(const _0xe29c38 of _0x50dd34){_0xe29c38[_0xe26d45(0x220)]?(a138_0x181126[_0xe26d45(0x214)](_0xe29c38['path'],{'recursive':!![],'force':!![]}),this['logger'][_0xe26d45(0x1a2)]('Removed\x20deleted\x20directory:\x20'+a138_0x3bc761[_0xe26d45(0x206)](a138_0x3bc761[_0xe26d45(0x203)](_0xe29c38[_0xe26d45(0x211)]))+'/'+a138_0x3bc761[_0xe26d45(0x206)](_0xe29c38[_0xe26d45(0x211)]))):(a138_0x181126[_0xe26d45(0x214)](_0xe29c38[_0xe26d45(0x211)],{'force':!![]}),this[_0xe26d45(0x18b)][_0xe26d45(0x1a2)](_0xe26d45(0x26a)+a138_0x3bc761['basename'](a138_0x3bc761['dirname'](_0xe29c38['path']))+'/'+a138_0x3bc761[_0xe26d45(0x206)](_0xe29c38[_0xe26d45(0x211)])));}return _0x5d7cb1;}async[a138_0x192cb2(0x1cc)](_0x35be5b,_0x153220){const _0x2a5d7f=a138_0x192cb2,_0x1d1f05=a138_0x3bc761['join'](_0x35be5b,_0x2a5d7f(0x1ff));if(!a138_0x181126['existsSync'](_0x1d1f05))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2a5d7f(0x234)+_0x35be5b,undefined,{'helpText':_0x2a5d7f(0x25b)});const _0x452fc7=loadAgentConfig(_0x1d1f05),_0x18fd6a=await this['resolveProjectId'](_0x452fc7[_0x2a5d7f(0x18c)]),_0x358b77=await this[_0x2a5d7f(0x195)]['getProject'](_0x18fd6a),_0x3701b1=_0x358b77[_0x2a5d7f(0x21d)][_0x2a5d7f(0x1c3)],_0x26a176={'projectName':_0x3701b1,'projectId':_0x18fd6a,'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}}},_0xdf80b9=[],_0x5546c6=[],_0x1137a0=[],_0x27f1f1=[],_0x11cd0b=[],_0x30139f=[],_0x315cda=a138_0x181126[_0x2a5d7f(0x1f0)](_0x35be5b,{'withFileTypes':!![]});for(const _0x52c63b of _0x315cda){if(!_0x52c63b[_0x2a5d7f(0x1a1)]())continue;if([_0x2a5d7f(0x1e5),_0x2a5d7f(0x1ec),_0x2a5d7f(0x256),'experimental_knowledge_bases','experimental_artifacts',_0x2a5d7f(0x1c8),'chat_interfaces']['includes'](_0x52c63b[_0x2a5d7f(0x1c3)]))continue;const _0x1f3f8a=a138_0x3bc761[_0x2a5d7f(0x224)](_0x35be5b,_0x52c63b[_0x2a5d7f(0x1c3)]);if(isAgentDir(_0x1f3f8a)){const _0x399696=a138_0x3bc761[_0x2a5d7f(0x224)](_0x1f3f8a,'agent.yml'),_0xc0eba6=a138_0x3bc761[_0x2a5d7f(0x224)](_0x1f3f8a,_0x2a5d7f(0x1e4)),_0x45abdb=a138_0x3bc761[_0x2a5d7f(0x224)](_0x1f3f8a,'starter_message.md'),_0x150f86=parseAgentYaml(a138_0x181126[_0x2a5d7f(0x1bb)](_0x399696,_0x2a5d7f(0x237)),_0x399696),_0x48778b=a138_0x181126[_0x2a5d7f(0x196)](_0xc0eba6)?a138_0x181126[_0x2a5d7f(0x1bb)](_0xc0eba6,'utf-8'):'',_0x97b43f=a138_0x181126[_0x2a5d7f(0x196)](_0x45abdb)?a138_0x181126[_0x2a5d7f(0x1bb)](_0x45abdb,_0x2a5d7f(0x237)):_0x150f86[_0x2a5d7f(0x1c4)];_0xdf80b9['push']({'name':_0x150f86[_0x2a5d7f(0x1c3)],'dir':_0x1f3f8a,'yaml':_0x150f86,'systemPrompt':_0x48778b,'starterMessage':_0x97b43f});}}const _0x3e485f=getKnowledgeBasesDir(_0x35be5b);if(a138_0x181126[_0x2a5d7f(0x196)](_0x3e485f)){const _0xa19503=a138_0x181126[_0x2a5d7f(0x1f0)](_0x3e485f);for(const _0x3d3670 of _0xa19503){const _0x2f3b73=a138_0x3bc761[_0x2a5d7f(0x224)](_0x3e485f,_0x3d3670);if(_0x3d3670[_0x2a5d7f(0x26f)]('.yml')){const _0x4fd6f9=parseKnowledgeBaseYaml(a138_0x181126[_0x2a5d7f(0x1bb)](_0x2f3b73,_0x2a5d7f(0x237)),_0x2f3b73);_0x5546c6[_0x2a5d7f(0x204)]({'name':_0x4fd6f9[_0x2a5d7f(0x1c3)],'path':_0x2f3b73,'yaml':_0x4fd6f9});}else{if(_0x3d3670[_0x2a5d7f(0x26f)](_0x2a5d7f(0x249))){const _0x4e865=a138_0x181126[_0x2a5d7f(0x1bb)](_0x2f3b73,_0x2a5d7f(0x237)),{name:_0x40f9d7,text:_0x2d3224}=parseTextKnowledgeBaseMd(_0x4e865,_0x3d3670);_0x1137a0[_0x2a5d7f(0x204)]({'name':_0x40f9d7,'path':_0x2f3b73,'text':_0x2d3224});}}}}const _0x37959e=getPromptsDir(_0x35be5b);if(a138_0x181126['existsSync'](_0x37959e)){const _0x4fd5e8=a138_0x181126['readdirSync'](_0x37959e)[_0x2a5d7f(0x1ab)](_0xaad193=>_0xaad193[_0x2a5d7f(0x26f)](_0x2a5d7f(0x1b6)));for(const _0x5c5e00 of _0x4fd5e8){const _0x206bcb=a138_0x3bc761[_0x2a5d7f(0x224)](_0x37959e,_0x5c5e00),_0x5b143b=parsePromptYaml(a138_0x181126['readFileSync'](_0x206bcb,_0x2a5d7f(0x237)),_0x206bcb);_0x27f1f1[_0x2a5d7f(0x204)]({'name':_0x5b143b[_0x2a5d7f(0x1c3)],'path':_0x206bcb,'yaml':_0x5b143b});}}const _0x586176=[],_0x429901=getIntegrationsDir(_0x35be5b);if(a138_0x181126['existsSync'](_0x429901)){const _0x4e6ffd=a138_0x181126['readdirSync'](_0x429901)['filter'](_0x10ab1b=>_0x10ab1b[_0x2a5d7f(0x26f)](_0x2a5d7f(0x1b6)));for(const _0x5015e7 of _0x4e6ffd){const _0x3860a2=a138_0x3bc761[_0x2a5d7f(0x224)](_0x429901,_0x5015e7),_0x22b2a6=parseIntegrationYaml(a138_0x181126['readFileSync'](_0x3860a2,_0x2a5d7f(0x237)),_0x3860a2);if(!SAFE_INTEGRATION_TYPES[_0x2a5d7f(0x1ca)](_0x22b2a6[_0x2a5d7f(0x1ae)][_0x2a5d7f(0x295)]())){this[_0x2a5d7f(0x18b)]['warn'](_0x2a5d7f(0x244)+_0x22b2a6[_0x2a5d7f(0x1c3)]+_0x2a5d7f(0x1f8)+_0x22b2a6[_0x2a5d7f(0x1ae)]+_0x2a5d7f(0x254)+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES[_0x2a5d7f(0x224)](',\x20')+_0x2a5d7f(0x218))+_0x2a5d7f(0x227));continue;}_0x586176['push']({'name':_0x22b2a6[_0x2a5d7f(0x1c3)],'path':_0x3860a2,'yaml':_0x22b2a6});}}const _0x224013=getExperimentalKnowledgeBasesDir(_0x35be5b);if(a138_0x181126['existsSync'](_0x224013)){const _0x1a6c56=a138_0x181126[_0x2a5d7f(0x1f0)](_0x224013,{'withFileTypes':!![]});for(const _0x4e07e8 of _0x1a6c56){if(!_0x4e07e8[_0x2a5d7f(0x1a1)]())continue;const _0x50aa54=a138_0x3bc761[_0x2a5d7f(0x224)](_0x224013,_0x4e07e8['name']),_0x23d734=a138_0x3bc761[_0x2a5d7f(0x224)](_0x50aa54,_0x4e07e8[_0x2a5d7f(0x1c3)]+_0x2a5d7f(0x1b6)),_0x4af64a=a138_0x3bc761[_0x2a5d7f(0x224)](_0x50aa54,'functions');if(!a138_0x181126['existsSync'](_0x23d734))continue;const _0x499d92=parseExperimentalKnowledgeBaseYaml(a138_0x181126[_0x2a5d7f(0x1bb)](_0x23d734,_0x2a5d7f(0x237)),_0x23d734),_0x153f05=[];if(a138_0x181126[_0x2a5d7f(0x196)](_0x4af64a)){const _0x10a760=a138_0x181126[_0x2a5d7f(0x1f0)](_0x4af64a,{'withFileTypes':!![]});for(const _0x480e24 of _0x10a760){if(!_0x480e24[_0x2a5d7f(0x1a1)]())continue;const _0x427d1e=a138_0x3bc761[_0x2a5d7f(0x224)](_0x4af64a,_0x480e24[_0x2a5d7f(0x1c3)]),_0x25bfb0=a138_0x3bc761[_0x2a5d7f(0x224)](_0x427d1e,_0x2a5d7f(0x287)),_0x154ab8=a138_0x3bc761['join'](_0x427d1e,'json_schema.json');a138_0x181126['existsSync'](_0x25bfb0)&&a138_0x181126[_0x2a5d7f(0x196)](_0x154ab8)&&_0x153f05[_0x2a5d7f(0x204)]({'name':_0x480e24['name'],'code':a138_0x181126[_0x2a5d7f(0x1bb)](_0x25bfb0,_0x2a5d7f(0x237)),'json_schema':a138_0x181126[_0x2a5d7f(0x1bb)](_0x154ab8,_0x2a5d7f(0x237))});}}const _0x4f4b60={..._0x499d92,'variables':_0x499d92[_0x2a5d7f(0x269)]||[],'functions':_0x153f05};_0x11cd0b[_0x2a5d7f(0x204)]({'name':_0x499d92[_0x2a5d7f(0x1c3)],'dir':_0x50aa54,'def':_0x4f4b60});}}const _0x5d8078=getExperimentalArtifactsDir(_0x35be5b);if(a138_0x181126[_0x2a5d7f(0x196)](_0x5d8078)){const _0x330ade=a138_0x181126[_0x2a5d7f(0x1f0)](_0x5d8078,{'withFileTypes':!![]});for(const _0x273dc0 of _0x330ade){if(!_0x273dc0[_0x2a5d7f(0x1a1)]())continue;const _0x2b1868=a138_0x3bc761['join'](_0x5d8078,_0x273dc0['name']),_0x242441=a138_0x3bc761['join'](_0x2b1868,_0x273dc0[_0x2a5d7f(0x1c3)]+_0x2a5d7f(0x1b6)),_0x386e7d=a138_0x3bc761[_0x2a5d7f(0x224)](_0x2b1868,_0x2a5d7f(0x287)),_0x4217d9=a138_0x3bc761[_0x2a5d7f(0x224)](_0x2b1868,_0x2a5d7f(0x235));if(!a138_0x181126['existsSync'](_0x242441)||!a138_0x181126[_0x2a5d7f(0x196)](_0x386e7d))continue;const _0x298e85=parseExperimentalArtifactYaml(a138_0x181126[_0x2a5d7f(0x1bb)](_0x242441,'utf-8'),_0x242441),_0x53138e=a138_0x181126['readFileSync'](_0x386e7d,_0x2a5d7f(0x237)),_0x5a6c66=[];if(a138_0x181126[_0x2a5d7f(0x196)](_0x4217d9)){const _0x38521d=a138_0x181126['readdirSync'](_0x4217d9);for(const _0xa8122b of _0x38521d){const _0x161572=a138_0x3bc761[_0x2a5d7f(0x224)](_0x4217d9,_0xa8122b);a138_0x181126[_0x2a5d7f(0x290)](_0x161572)['isFile']()&&_0x5a6c66[_0x2a5d7f(0x204)]({'file_name':_0xa8122b,'text_content':a138_0x181126['readFileSync'](_0x161572,_0x2a5d7f(0x237))});}}const _0x495ed6={..._0x298e85,'code':_0x53138e,'files':_0x5a6c66};_0x30139f[_0x2a5d7f(0x204)]({'name':_0x298e85['name'],'dir':_0x2b1868,'def':_0x495ed6});}}const _0x1f56bd=[],_0x166b7e=getFormInterfacesDir(_0x35be5b);if(a138_0x181126[_0x2a5d7f(0x196)](_0x166b7e)){const _0x106d10=a138_0x181126['readdirSync'](_0x166b7e)[_0x2a5d7f(0x1ab)](_0xcea403=>_0xcea403[_0x2a5d7f(0x26f)](_0x2a5d7f(0x1b6)));for(const _0x4e885e of _0x106d10){const _0x3359a4=a138_0x3bc761[_0x2a5d7f(0x224)](_0x166b7e,_0x4e885e),_0xed10a5=parseFormInterfaceYaml(a138_0x181126[_0x2a5d7f(0x1bb)](_0x3359a4,_0x2a5d7f(0x237)),_0x3359a4);_0x1f56bd[_0x2a5d7f(0x204)]({'name':_0xed10a5[_0x2a5d7f(0x1c3)],'path':_0x3359a4,'yaml':_0xed10a5});}}const _0x12ef65=[],_0x2dbd38=getChatInterfacesDir(_0x35be5b);if(a138_0x181126['existsSync'](_0x2dbd38)){const _0x514d77=a138_0x181126[_0x2a5d7f(0x1f0)](_0x2dbd38)[_0x2a5d7f(0x1ab)](_0x3ddbcc=>_0x3ddbcc['endsWith'](_0x2a5d7f(0x1b6)));for(const _0x5b81ed of _0x514d77){const _0x566836=a138_0x3bc761[_0x2a5d7f(0x224)](_0x2dbd38,_0x5b81ed),_0x373399=parseChatInterfaceYaml(a138_0x181126[_0x2a5d7f(0x1bb)](_0x566836,'utf-8'),_0x566836);_0x12ef65['push']({'name':_0x373399[_0x2a5d7f(0x1c3)],'path':_0x566836,'yaml':_0x373399});}}const _0x385c5a=await this['client'][_0x2a5d7f(0x282)](_0x18fd6a),_0x1f676e=await this[_0x2a5d7f(0x195)][_0x2a5d7f(0x200)](_0x18fd6a),_0x52c396=await this[_0x2a5d7f(0x195)][_0x2a5d7f(0x1f4)](_0x18fd6a),_0x462cca=await this['client'][_0x2a5d7f(0x1d0)](_0x18fd6a),_0x11fe4b=await this[_0x2a5d7f(0x195)][_0x2a5d7f(0x1b8)](_0x18fd6a),_0x30dcd8=await safeListOrEmpty(()=>this[_0x2a5d7f(0x195)]['listExperimentalKnowledgeBases'](_0x18fd6a)),_0x130b69=await safeListOrEmpty(()=>this[_0x2a5d7f(0x195)][_0x2a5d7f(0x262)](_0x18fd6a)),_0x383f56=await safeListOrEmpty(()=>this['client'][_0x2a5d7f(0x28f)](_0x18fd6a)),_0xd5b7a5=await safeListOrEmpty(()=>this[_0x2a5d7f(0x195)][_0x2a5d7f(0x241)](_0x18fd6a)),_0x5e612b=await fetchAllToolTargetMaps((_0x3f5ebf,_0x3519d8)=>this[_0x2a5d7f(0x195)]['listToolTargets'](_0x3f5ebf,_0x3519d8),_0x18fd6a),_0x1a5b43=new Map(),_0x4dea56=new Map(),_0x4d1b31=new Map(),_0x2d22c5=new Map(),_0x29c668=new Map(),_0x2fb344=new Map(),_0xa7c1f7=new Map();for(const _0x530bd3 of _0x385c5a){_0x1a5b43[_0x2a5d7f(0x274)](_0x530bd3[_0x2a5d7f(0x21d)]['name'],_0x530bd3);}for(const _0x333404 of _0x1f676e){_0x4dea56[_0x2a5d7f(0x274)](_0x333404[_0x2a5d7f(0x21d)][_0x2a5d7f(0x1c3)],_0x333404);}for(const _0x26fe1c of _0x52c396){_0x4d1b31[_0x2a5d7f(0x274)](_0x26fe1c['attributes'][_0x2a5d7f(0x1c3)],_0x26fe1c);}for(const _0x4cd26e of _0x462cca){_0x2d22c5[_0x2a5d7f(0x274)](_0x4cd26e[_0x2a5d7f(0x21d)][_0x2a5d7f(0x1c3)],_0x4cd26e);}for(const _0x35b41b of _0x11fe4b){_0x29c668[_0x2a5d7f(0x274)](_0x35b41b[_0x2a5d7f(0x21d)][_0x2a5d7f(0x27c)][_0x2a5d7f(0x295)](),_0x35b41b);}for(const _0x46650c of _0x30dcd8){_0x2fb344[_0x2a5d7f(0x274)](_0x46650c[_0x2a5d7f(0x21d)][_0x2a5d7f(0x1c3)],_0x46650c);}for(const _0x2b02a3 of _0x130b69){_0xa7c1f7[_0x2a5d7f(0x274)](_0x2b02a3[_0x2a5d7f(0x21d)][_0x2a5d7f(0x1c3)],_0x2b02a3);}const _0x1ce34b=new Map(),_0x103b12=new Map();for(const _0x35f22e of _0x383f56){_0x1ce34b[_0x2a5d7f(0x274)](_0x35f22e['attributes'][_0x2a5d7f(0x1c3)],_0x35f22e);}for(const _0x557ed0 of _0xd5b7a5){_0x103b12[_0x2a5d7f(0x274)](_0x557ed0[_0x2a5d7f(0x21d)][_0x2a5d7f(0x1c3)],_0x557ed0);}const _0x3096b5=new Map(),_0x56a4d2=new Map();for(const _0x563390 of _0x385c5a){_0x3096b5[_0x2a5d7f(0x274)](_0x563390[_0x2a5d7f(0x21d)][_0x2a5d7f(0x1c3)],_0x563390['id']),_0x56a4d2['set'](_0x563390['id'],_0x563390[_0x2a5d7f(0x21d)]['name']);}const _0x1dad40=new Map(),_0x17e550=new Map();for(const _0x4514d8 of _0x462cca){_0x1dad40['set'](_0x4514d8[_0x2a5d7f(0x21d)][_0x2a5d7f(0x1c3)],_0x4514d8['id']),_0x17e550['set'](_0x4514d8['id'],_0x4514d8[_0x2a5d7f(0x21d)][_0x2a5d7f(0x1c3)]);}const _0x8ade21=_0x5e612b[_0x2a5d7f(0x1da)][_0x2a5d7f(0x228)]||new Map(),_0x2a4dfe=_0x5e612b[_0x2a5d7f(0x1da)][_0x2a5d7f(0x1eb)]||new Map(),_0x376389=_0x5e612b[_0x2a5d7f(0x1da)][_0x2a5d7f(0x233)]||new Map(),_0x293538=new Map(),_0x11626f={'resolveToolTargetName':buildNameResolver({..._0x5e612b[_0x2a5d7f(0x1d3)],'Agent':_0x56a4d2}),'resolvePromptName':async _0x2a98f2=>_0x17e550[_0x2a5d7f(0x24b)](_0x2a98f2),'onWarning':_0xc446e8=>this[_0x2a5d7f(0x18b)][_0x2a5d7f(0x1f9)](_0xc446e8)};let _0x1845df=[];const _0x420a10={'projectId':_0x18fd6a,'resolveToolTargetId':buildIdResolver({..._0x5e612b['nameToId'],'Agent':_0x3096b5}),'resolvePromptId':async _0x15b306=>_0x1dad40['get'](_0x15b306),'onWarning':_0x157755=>{const _0x326dde=_0x2a5d7f;this[_0x326dde(0x18b)][_0x326dde(0x1f9)](_0x157755),_0x1845df[_0x326dde(0x204)](_0x157755);}},{resolved:_0x1e9b93,unresolved:_0x1202b0}=resolveAgentDependencies(_0xdf80b9,new Set(_0x1a5b43[_0x2a5d7f(0x1d2)]()));for(const {agent:_0x13ebe8,missingDeps:_0x36108a}of _0x1202b0){_0x26a176[_0x2a5d7f(0x1df)]['push']({'agentName':_0x13ebe8[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x205),'error':_0x2a5d7f(0x1ac)+_0x36108a[_0x2a5d7f(0x224)](',\x20')+_0x2a5d7f(0x20e)}),_0x26a176['counts'][_0x2a5d7f(0x1df)]['errors']++;}for(const _0x48ccab of _0x5546c6){const _0x576b22=_0x4dea56[_0x2a5d7f(0x24b)](_0x48ccab[_0x2a5d7f(0x19b)]['name']),_0x76ad1c=a138_0x181126[_0x2a5d7f(0x1bb)](_0x48ccab[_0x2a5d7f(0x211)],_0x2a5d7f(0x237));if(_0x576b22){const _0x5caa26=apiKnowledgeBaseToYaml(_0x576b22),_0x4869d6=toKnowledgeBaseYamlString(_0x5caa26),_0x51021c=generateDiff(_0x4869d6,_0x76ad1c),_0x460849=hasChanges(_0x51021c);_0x460849?(_0x26a176[_0x2a5d7f(0x1fc)]['push']({'name':_0x48ccab['yaml'][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x266),'id':_0x576b22['id'],'diff':formatDiffWithColors(_0x51021c)}),_0x26a176['counts'][_0x2a5d7f(0x1fc)][_0x2a5d7f(0x266)]++):(_0x26a176[_0x2a5d7f(0x1fc)][_0x2a5d7f(0x204)]({'name':_0x48ccab[_0x2a5d7f(0x19b)]['name'],'action':'unchanged','id':_0x576b22['id']}),_0x26a176[_0x2a5d7f(0x1f1)]['knowledgeBases'][_0x2a5d7f(0x277)]++);}else _0x26a176[_0x2a5d7f(0x1fc)][_0x2a5d7f(0x204)]({'name':_0x48ccab['yaml'][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x27a)}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1fc)][_0x2a5d7f(0x27a)]++;}for(const _0x23ac8b of _0x1137a0){const _0x456d5f=_0x4d1b31[_0x2a5d7f(0x24b)](_0x23ac8b[_0x2a5d7f(0x1c3)]),_0x2fc519=a138_0x181126[_0x2a5d7f(0x1bb)](_0x23ac8b[_0x2a5d7f(0x211)],_0x2a5d7f(0x237));if(_0x456d5f){const _0x1475b9=toTextKnowledgeBaseMd(_0x456d5f[_0x2a5d7f(0x21d)][_0x2a5d7f(0x1c3)],_0x456d5f[_0x2a5d7f(0x21d)][_0x2a5d7f(0x27b)]),_0xa3fddf=generateDiff(_0x1475b9,_0x2fc519),_0x273afc=hasChanges(_0xa3fddf);_0x273afc?(_0x26a176['textKnowledgeBases'][_0x2a5d7f(0x204)]({'name':_0x23ac8b[_0x2a5d7f(0x1c3)],'action':'updated','id':_0x456d5f['id'],'diff':formatDiffWithColors(_0xa3fddf)}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x185)][_0x2a5d7f(0x266)]++):(_0x26a176['textKnowledgeBases'][_0x2a5d7f(0x204)]({'name':_0x23ac8b[_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x277),'id':_0x456d5f['id']}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x185)][_0x2a5d7f(0x277)]++);}else _0x26a176[_0x2a5d7f(0x185)][_0x2a5d7f(0x204)]({'name':_0x23ac8b[_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x27a)}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x185)]['created']++;}for(const _0x49d5fa of _0x1e9b93){const _0x56927d=_0x1a5b43['get'](_0x49d5fa[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)]),_0x4d4e02=a138_0x3bc761[_0x2a5d7f(0x224)](_0x49d5fa[_0x2a5d7f(0x191)],_0x2a5d7f(0x248)),_0x2d31d6=a138_0x181126[_0x2a5d7f(0x1bb)](_0x4d4e02,'utf-8'),_0x5847e5=_0x49d5fa[_0x2a5d7f(0x219)],_0x3d746d='#\x20prompt.md\x0a'+_0x5847e5+_0x2a5d7f(0x1fe)+_0x2d31d6;if(_0x56927d){const {yaml:_0x4e5bd8,systemPrompt:_0x1a6426}=await agentResponseToDef(_0x56927d,_0x11626f),_0x377e58=toAgentYamlString(_0x4e5bd8),_0x137d33=_0x2a5d7f(0x1c9)+_0x1a6426+_0x2a5d7f(0x1fe)+_0x377e58,_0x10053f=generateDiff(_0x137d33,_0x3d746d),_0xdcfcb0=hasChanges(_0x10053f);_0xdcfcb0?(_0x26a176[_0x2a5d7f(0x1df)][_0x2a5d7f(0x204)]({'agentName':_0x49d5fa[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x266),'agentId':_0x56927d['id'],'diff':formatDiffWithColors(_0x10053f)}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1df)][_0x2a5d7f(0x266)]++):(_0x26a176[_0x2a5d7f(0x1df)][_0x2a5d7f(0x204)]({'agentName':_0x49d5fa[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x277),'agentId':_0x56927d['id']}),_0x26a176['counts'][_0x2a5d7f(0x1df)][_0x2a5d7f(0x277)]++);}else _0x26a176[_0x2a5d7f(0x1df)][_0x2a5d7f(0x204)]({'agentName':_0x49d5fa[_0x2a5d7f(0x19b)]['name'],'action':_0x2a5d7f(0x27a)}),_0x26a176[_0x2a5d7f(0x1f1)]['agents'][_0x2a5d7f(0x27a)]++;}for(const _0x44cf06 of _0x27f1f1){const _0x55dd81=_0x2d22c5[_0x2a5d7f(0x24b)](_0x44cf06[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)]),_0x51386f=a138_0x181126[_0x2a5d7f(0x1bb)](_0x44cf06['path'],_0x2a5d7f(0x237));if(_0x55dd81){const _0xbf8891=await apiPromptToYaml(_0x55dd81,_0x11626f);if(!_0xbf8891){_0x26a176[_0x2a5d7f(0x1ec)][_0x2a5d7f(0x204)]({'name':_0x44cf06[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x266),'id':_0x55dd81['id']}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1ec)]['updated']++;continue;}const _0xc78179=toPromptYamlString(_0xbf8891),_0x4a661e=generateDiff(_0xc78179,_0x51386f),_0x26b557=hasChanges(_0x4a661e);_0x26b557?(_0x26a176[_0x2a5d7f(0x1ec)][_0x2a5d7f(0x204)]({'name':_0x44cf06[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x266),'id':_0x55dd81['id'],'diff':formatDiffWithColors(_0x4a661e)}),_0x26a176['counts'][_0x2a5d7f(0x1ec)]['updated']++):(_0x26a176[_0x2a5d7f(0x1ec)]['push']({'name':_0x44cf06['yaml'][_0x2a5d7f(0x1c3)],'action':'unchanged','id':_0x55dd81['id']}),_0x26a176['counts'][_0x2a5d7f(0x1ec)][_0x2a5d7f(0x277)]++);}else _0x26a176[_0x2a5d7f(0x1ec)][_0x2a5d7f(0x204)]({'name':_0x44cf06[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],'action':'created'}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1ec)][_0x2a5d7f(0x27a)]++;}for(const _0x4729da of _0x586176){const _0x50ffba=_0x29c668[_0x2a5d7f(0x24b)](_0x4729da[_0x2a5d7f(0x19b)]['service_type']),_0x1ef226=a138_0x181126[_0x2a5d7f(0x1bb)](_0x4729da[_0x2a5d7f(0x211)],_0x2a5d7f(0x237));if(_0x50ffba){const _0x54d196=await apiIntegrationToYaml(_0x50ffba,_0x11626f),_0x24d691=toIntegrationYamlString(_0x54d196),_0x3623e8=generateDiff(_0x24d691,_0x1ef226),_0x4b4b7b=hasChanges(_0x3623e8);_0x4b4b7b?(_0x26a176[_0x2a5d7f(0x256)][_0x2a5d7f(0x204)]({'name':_0x4729da[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1ae)],'action':'updated','id':_0x50ffba['id'],'diff':formatDiffWithColors(_0x3623e8)}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x256)][_0x2a5d7f(0x266)]++):(_0x26a176['integrations'][_0x2a5d7f(0x204)]({'name':_0x4729da[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1ae)],'action':'unchanged','id':_0x50ffba['id']}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x256)]['unchanged']++);}else _0x26a176[_0x2a5d7f(0x256)][_0x2a5d7f(0x204)]({'name':_0x4729da[_0x2a5d7f(0x19b)]['service_type'],'action':_0x2a5d7f(0x27a)}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x256)]['created']++;}for(const _0x5bb9ef of _0x11cd0b){const _0x4e3c7e=_0x2fb344[_0x2a5d7f(0x24b)](_0x5bb9ef[_0x2a5d7f(0x1b0)][_0x2a5d7f(0x1c3)]),_0x121c4f=toExperimentalKnowledgeBaseYamlString(_0x5bb9ef['def']);let _0x39bd68=_0x121c4f;for(const _0x24e111 of _0x5bb9ef[_0x2a5d7f(0x1b0)][_0x2a5d7f(0x1d6)]){_0x39bd68+=_0x2a5d7f(0x1bd)+_0x24e111['name']+'\x20---\x0a'+_0x24e111[_0x2a5d7f(0x194)]+'\x0a---\x20schema:\x20'+_0x24e111[_0x2a5d7f(0x1c3)]+_0x2a5d7f(0x184)+_0x24e111[_0x2a5d7f(0x1ee)]+'\x0a';}if(_0x4e3c7e){const _0x2025ac=apiExperimentalKnowledgeBaseToYaml(_0x4e3c7e),_0x52591a=toExperimentalKnowledgeBaseYamlString(_0x2025ac);let _0x58e6a6=_0x52591a;for(const _0x42ab92 of _0x2025ac[_0x2a5d7f(0x1d6)]){_0x58e6a6+=_0x2a5d7f(0x1bd)+_0x42ab92['name']+'\x20---\x0a'+_0x42ab92['code']+'\x0a---\x20schema:\x20'+_0x42ab92[_0x2a5d7f(0x1c3)]+_0x2a5d7f(0x184)+_0x42ab92[_0x2a5d7f(0x1ee)]+'\x0a';}const _0x597141=generateDiff(_0x58e6a6,_0x39bd68),_0x413526=hasChanges(_0x597141);_0x413526?(_0x26a176[_0x2a5d7f(0x276)]['push']({'name':_0x5bb9ef[_0x2a5d7f(0x1b0)][_0x2a5d7f(0x1c3)],'action':'updated','id':_0x4e3c7e['id'],'diff':formatDiffWithColors(_0x597141)}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x276)]['updated']++):(_0x26a176['experimentalKnowledgeBases'][_0x2a5d7f(0x204)]({'name':_0x5bb9ef[_0x2a5d7f(0x1b0)][_0x2a5d7f(0x1c3)],'action':'unchanged','id':_0x4e3c7e['id']}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x276)]['unchanged']++);}else _0x26a176[_0x2a5d7f(0x276)][_0x2a5d7f(0x204)]({'name':_0x5bb9ef[_0x2a5d7f(0x1b0)]['name'],'action':_0x2a5d7f(0x27a)}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x276)]['created']++;}for(const _0x106c4b of _0x30139f){const _0xeb1fe=_0xa7c1f7['get'](_0x106c4b[_0x2a5d7f(0x1b0)]['name']),_0x1200cb=toExperimentalArtifactYamlString(_0x106c4b['def']);let _0x261512=_0x1200cb+(_0x2a5d7f(0x240)+_0x106c4b[_0x2a5d7f(0x1b0)]['code']+'\x0a');for(const _0x53fed9 of _0x106c4b[_0x2a5d7f(0x1b0)][_0x2a5d7f(0x235)]){_0x261512+='---\x20file:\x20'+_0x53fed9[_0x2a5d7f(0x236)]+_0x2a5d7f(0x184)+_0x53fed9[_0x2a5d7f(0x280)]+'\x0a';}if(_0xeb1fe){const _0x2f03ea=apiExperimentalArtifactToYaml(_0xeb1fe),_0x1f752b=toExperimentalArtifactYamlString(_0x2f03ea);let _0x37eb13=_0x1f752b+(_0x2a5d7f(0x240)+_0x2f03ea[_0x2a5d7f(0x194)]+'\x0a');for(const _0x25b276 of _0x2f03ea[_0x2a5d7f(0x235)]){_0x37eb13+=_0x2a5d7f(0x1b1)+_0x25b276[_0x2a5d7f(0x236)]+_0x2a5d7f(0x184)+_0x25b276[_0x2a5d7f(0x280)]+'\x0a';}const _0x263c7f=generateDiff(_0x37eb13,_0x261512),_0x4d8c1a=hasChanges(_0x263c7f);_0x4d8c1a?(_0x26a176[_0x2a5d7f(0x1ba)]['push']({'name':_0x106c4b['def'][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x266),'id':_0xeb1fe['id'],'diff':formatDiffWithColors(_0x263c7f)}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1ba)][_0x2a5d7f(0x266)]++):(_0x26a176[_0x2a5d7f(0x1ba)][_0x2a5d7f(0x204)]({'name':_0x106c4b[_0x2a5d7f(0x1b0)]['name'],'action':_0x2a5d7f(0x277),'id':_0xeb1fe['id']}),_0x26a176[_0x2a5d7f(0x1f1)]['experimentalArtifacts'][_0x2a5d7f(0x277)]++);}else _0x26a176['experimentalArtifacts']['push']({'name':_0x106c4b['def'][_0x2a5d7f(0x1c3)],'action':'created'}),_0x26a176['counts'][_0x2a5d7f(0x1ba)]['created']++;}for(const _0x64b629 of _0x1f56bd){const _0x1656eb=_0x1ce34b[_0x2a5d7f(0x24b)](_0x64b629[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)]),_0x5b2a7c=a138_0x181126[_0x2a5d7f(0x1bb)](_0x64b629[_0x2a5d7f(0x211)],_0x2a5d7f(0x237));if(_0x1656eb){const _0x3c5eab=await apiFormInterfaceToYaml(_0x1656eb,_0x11626f),_0x254652=toFormInterfaceYamlString(_0x3c5eab),_0x3ba906=generateDiff(_0x254652,_0x5b2a7c),_0x12062c=hasChanges(_0x3ba906);_0x12062c?(_0x26a176['formInterfaces'][_0x2a5d7f(0x204)]({'name':_0x64b629[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x266),'id':_0x1656eb['id'],'diff':formatDiffWithColors(_0x3ba906)}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1ad)]['updated']++):(_0x26a176[_0x2a5d7f(0x1ad)][_0x2a5d7f(0x204)]({'name':_0x64b629[_0x2a5d7f(0x19b)]['name'],'action':_0x2a5d7f(0x277),'id':_0x1656eb['id']}),_0x26a176['counts']['formInterfaces'][_0x2a5d7f(0x277)]++);}else _0x26a176[_0x2a5d7f(0x1ad)][_0x2a5d7f(0x204)]({'name':_0x64b629[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x27a)}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1ad)]['created']++;}for(const _0xfe0340 of _0x12ef65){const _0x19ecc3=_0x103b12[_0x2a5d7f(0x24b)](_0xfe0340[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)]),_0x1adb96=a138_0x181126[_0x2a5d7f(0x1bb)](_0xfe0340['path'],_0x2a5d7f(0x237));if(_0x19ecc3){const _0x2a3ecc=await apiChatInterfaceToYaml(_0x19ecc3,_0x11626f),_0x3174d7=toChatInterfaceYamlString(_0x2a3ecc),_0x355559=generateDiff(_0x3174d7,_0x1adb96),_0x5dde4b=hasChanges(_0x355559);_0x5dde4b?(_0x26a176[_0x2a5d7f(0x1be)]['push']({'name':_0xfe0340[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],'action':'updated','id':_0x19ecc3['id'],'diff':formatDiffWithColors(_0x355559)}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1be)][_0x2a5d7f(0x266)]++):(_0x26a176[_0x2a5d7f(0x1be)][_0x2a5d7f(0x204)]({'name':_0xfe0340['yaml']['name'],'action':_0x2a5d7f(0x277),'id':_0x19ecc3['id']}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1be)]['unchanged']++);}else _0x26a176['chatInterfaces']['push']({'name':_0xfe0340[_0x2a5d7f(0x19b)]['name'],'action':'created'}),_0x26a176[_0x2a5d7f(0x1f1)]['chatInterfaces'][_0x2a5d7f(0x27a)]++;}if(_0x153220?.[_0x2a5d7f(0x298)])return _0x26a176;_0x26a176[_0x2a5d7f(0x1fc)]=[],_0x26a176[_0x2a5d7f(0x185)]=[],_0x26a176['prompts']=[],_0x26a176['integrations']=[],_0x26a176[_0x2a5d7f(0x276)]=[],_0x26a176[_0x2a5d7f(0x1ba)]=[],_0x26a176[_0x2a5d7f(0x1ad)]=[],_0x26a176['chatInterfaces']=[];const _0x3022bc=_0x26a176[_0x2a5d7f(0x1df)][_0x2a5d7f(0x1ab)](_0x637107=>_0x637107['action']===_0x2a5d7f(0x205));_0x26a176[_0x2a5d7f(0x1df)]=_0x3022bc,_0x26a176[_0x2a5d7f(0x1f1)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x3022bc[_0x2a5d7f(0x20d)]},'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 _0x3d7ac0 of _0x5546c6){try{const _0xc3419f=_0x4dea56[_0x2a5d7f(0x24b)](_0x3d7ac0[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)]),_0x2a4b98=yamlKnowledgeBaseToApi(_0x3d7ac0[_0x2a5d7f(0x19b)],_0x18fd6a);if(_0xc3419f)await this['client'][_0x2a5d7f(0x259)](_0xc3419f['id'],_0x2a4b98),_0x8ade21[_0x2a5d7f(0x274)](_0x3d7ac0[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],_0xc3419f['id']),_0x26a176['knowledgeBases'][_0x2a5d7f(0x204)]({'name':_0x3d7ac0[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x266),'id':_0xc3419f['id']}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1fc)]['updated']++;else{const _0x39cf80=await this[_0x2a5d7f(0x195)]['createKnowledgeBase'](_0x2a4b98);_0x8ade21[_0x2a5d7f(0x274)](_0x3d7ac0[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],_0x39cf80['id']),_0x26a176['knowledgeBases'][_0x2a5d7f(0x204)]({'name':_0x3d7ac0['yaml'][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x27a),'id':_0x39cf80['id']}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1fc)]['created']++;}}catch(_0xedc1be){_0x26a176[_0x2a5d7f(0x1fc)][_0x2a5d7f(0x204)]({'name':_0x3d7ac0[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x205),'error':_0xedc1be[_0x2a5d7f(0x187)]}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1fc)]['errors']++;}}for(const _0x212c60 of _0x1137a0){try{const _0x4bc1fa=_0x4d1b31[_0x2a5d7f(0x24b)](_0x212c60[_0x2a5d7f(0x1c3)]),_0x2cf648=yamlTextKnowledgeBaseToApi({'name':_0x212c60[_0x2a5d7f(0x1c3)],'text':_0x212c60[_0x2a5d7f(0x27b)]},_0x18fd6a);if(_0x4bc1fa)await this[_0x2a5d7f(0x195)][_0x2a5d7f(0x2a2)](_0x4bc1fa['id'],_0x2cf648),_0x2a4dfe['set'](_0x212c60[_0x2a5d7f(0x1c3)],_0x4bc1fa['id']),_0x26a176[_0x2a5d7f(0x185)][_0x2a5d7f(0x204)]({'name':_0x212c60[_0x2a5d7f(0x1c3)],'action':'updated','id':_0x4bc1fa['id']}),_0x26a176['counts']['textKnowledgeBases'][_0x2a5d7f(0x266)]++;else{const _0x584a89=await this[_0x2a5d7f(0x195)]['createTextKnowledgeBase'](_0x2cf648);_0x2a4dfe[_0x2a5d7f(0x274)](_0x212c60[_0x2a5d7f(0x1c3)],_0x584a89['id']),_0x26a176[_0x2a5d7f(0x185)][_0x2a5d7f(0x204)]({'name':_0x212c60[_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x27a),'id':_0x584a89['id']}),_0x26a176[_0x2a5d7f(0x1f1)]['textKnowledgeBases'][_0x2a5d7f(0x27a)]++;}}catch(_0x244a9c){_0x26a176[_0x2a5d7f(0x185)]['push']({'name':_0x212c60[_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x205),'error':_0x244a9c['message']}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x185)][_0x2a5d7f(0x1e6)]++;}}for(const _0x1eed9a of _0x11cd0b){try{const _0x133efd=_0x2fb344[_0x2a5d7f(0x24b)](_0x1eed9a[_0x2a5d7f(0x1b0)]['name']),_0x30b1eb=yamlExperimentalKnowledgeBaseToApi(_0x1eed9a[_0x2a5d7f(0x1b0)],_0x18fd6a);if(_0x133efd)await this['client']['updateExperimentalKnowledgeBase'](_0x133efd['id'],_0x30b1eb),_0x376389[_0x2a5d7f(0x274)](_0x1eed9a[_0x2a5d7f(0x1b0)]['name'],_0x133efd['id']),_0x26a176[_0x2a5d7f(0x276)][_0x2a5d7f(0x204)]({'name':_0x1eed9a[_0x2a5d7f(0x1b0)][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x266),'id':_0x133efd['id']}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x276)][_0x2a5d7f(0x266)]++;else{const _0x38c04a=await this[_0x2a5d7f(0x195)][_0x2a5d7f(0x21c)](_0x30b1eb);_0x376389[_0x2a5d7f(0x274)](_0x1eed9a[_0x2a5d7f(0x1b0)][_0x2a5d7f(0x1c3)],_0x38c04a['id']),_0x26a176[_0x2a5d7f(0x276)][_0x2a5d7f(0x204)]({'name':_0x1eed9a['def'][_0x2a5d7f(0x1c3)],'action':'created','id':_0x38c04a['id']}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x276)][_0x2a5d7f(0x27a)]++;}}catch(_0x187836){_0x26a176[_0x2a5d7f(0x276)][_0x2a5d7f(0x204)]({'name':_0x1eed9a[_0x2a5d7f(0x1b0)][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x205),'error':_0x187836[_0x2a5d7f(0x187)]}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x276)][_0x2a5d7f(0x1e6)]++;}}for(const _0x283129 of _0x30139f){try{const _0x39d201=_0xa7c1f7[_0x2a5d7f(0x24b)](_0x283129[_0x2a5d7f(0x1b0)][_0x2a5d7f(0x1c3)]),_0x5c5f2d=yamlExperimentalArtifactToApi(_0x283129[_0x2a5d7f(0x1b0)],_0x18fd6a);if(_0x39d201)await this['client'][_0x2a5d7f(0x1ea)](_0x39d201['id'],_0x5c5f2d),_0x293538[_0x2a5d7f(0x274)](_0x283129[_0x2a5d7f(0x1b0)][_0x2a5d7f(0x1c3)],_0x39d201['id']),_0x26a176['experimentalArtifacts'][_0x2a5d7f(0x204)]({'name':_0x283129['def'][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x266),'id':_0x39d201['id']}),_0x26a176['counts'][_0x2a5d7f(0x1ba)]['updated']++;else{const _0x503888=await this[_0x2a5d7f(0x195)][_0x2a5d7f(0x29a)](_0x5c5f2d);_0x293538[_0x2a5d7f(0x274)](_0x283129['def'][_0x2a5d7f(0x1c3)],_0x503888['id']),_0x26a176[_0x2a5d7f(0x1ba)][_0x2a5d7f(0x204)]({'name':_0x283129[_0x2a5d7f(0x1b0)][_0x2a5d7f(0x1c3)],'action':'created','id':_0x503888['id']}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1ba)][_0x2a5d7f(0x27a)]++;}}catch(_0x18b726){_0x26a176[_0x2a5d7f(0x1ba)][_0x2a5d7f(0x204)]({'name':_0x283129[_0x2a5d7f(0x1b0)]['name'],'action':_0x2a5d7f(0x205),'error':_0x18b726[_0x2a5d7f(0x187)]}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1ba)][_0x2a5d7f(0x1e6)]++;}}for(const _0x4a271e of _0x1e9b93){_0x1845df=[];try{const _0x160e6f=_0x1a5b43['get'](_0x4a271e['yaml'][_0x2a5d7f(0x1c3)]),_0x1f0d55=await agentDefToRequest(_0x4a271e[_0x2a5d7f(0x19b)],_0x4a271e[_0x2a5d7f(0x219)],_0x4a271e[_0x2a5d7f(0x18f)],_0x420a10);if(_0x160e6f)await this[_0x2a5d7f(0x195)][_0x2a5d7f(0x1c2)](_0x160e6f['id'],_0x1f0d55),_0x3096b5[_0x2a5d7f(0x274)](_0x4a271e['yaml'][_0x2a5d7f(0x1c3)],_0x160e6f['id']),_0x26a176['agents']['push']({'agentName':_0x4a271e[_0x2a5d7f(0x19b)]['name'],'action':_0x2a5d7f(0x266),'agentId':_0x160e6f['id'],'warnings':_0x1845df[_0x2a5d7f(0x20d)]>0x0?_0x1845df:undefined}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1df)]['updated']++;else{const _0x452e3b=await this['client'][_0x2a5d7f(0x189)](_0x1f0d55);_0x3096b5['set'](_0x4a271e[_0x2a5d7f(0x19b)]['name'],_0x452e3b['id']),_0x26a176[_0x2a5d7f(0x1df)][_0x2a5d7f(0x204)]({'agentName':_0x4a271e[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x27a),'agentId':_0x452e3b['id'],'warnings':_0x1845df[_0x2a5d7f(0x20d)]>0x0?_0x1845df:undefined}),_0x26a176[_0x2a5d7f(0x1f1)]['agents'][_0x2a5d7f(0x27a)]++;}}catch(_0x2e6981){_0x26a176[_0x2a5d7f(0x1df)][_0x2a5d7f(0x204)]({'agentName':_0x4a271e['yaml']['name'],'action':'error','error':_0x2e6981['message'],'warnings':_0x1845df[_0x2a5d7f(0x20d)]>0x0?_0x1845df:undefined}),_0x26a176[_0x2a5d7f(0x1f1)]['agents']['errors']++;}}for(const _0xdfcf3f of _0x27f1f1){try{const _0x5d5ba8=_0x2d22c5[_0x2a5d7f(0x24b)](_0xdfcf3f[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)]),_0x2e3840=await yamlPromptToApi(_0xdfcf3f[_0x2a5d7f(0x19b)],_0x18fd6a,_0x420a10);if(!_0x2e3840){_0x26a176['prompts'][_0x2a5d7f(0x204)]({'name':_0xdfcf3f['yaml']['name'],'action':_0x2a5d7f(0x205),'error':_0x2a5d7f(0x19a)}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1ec)]['errors']++;continue;}if(_0x5d5ba8)await this[_0x2a5d7f(0x195)][_0x2a5d7f(0x285)](_0x5d5ba8['id'],_0x2e3840),_0x1dad40[_0x2a5d7f(0x274)](_0xdfcf3f[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],_0x5d5ba8['id']),_0x26a176['prompts']['push']({'name':_0xdfcf3f[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x266),'id':_0x5d5ba8['id']}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1ec)][_0x2a5d7f(0x266)]++;else{const _0x3ee605=await this['client'][_0x2a5d7f(0x22d)](_0x2e3840);_0x1dad40[_0x2a5d7f(0x274)](_0xdfcf3f[_0x2a5d7f(0x19b)]['name'],_0x3ee605['id']),_0x26a176['prompts'][_0x2a5d7f(0x204)]({'name':_0xdfcf3f['yaml'][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x27a),'id':_0x3ee605['id']}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1ec)][_0x2a5d7f(0x27a)]++;}}catch(_0x4b384e){_0x26a176[_0x2a5d7f(0x1ec)]['push']({'name':_0xdfcf3f[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x205),'error':_0x4b384e[_0x2a5d7f(0x187)]}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1ec)][_0x2a5d7f(0x1e6)]++;}}for(const _0x17cd4c of _0x586176){try{const _0x4eba90=_0x29c668[_0x2a5d7f(0x24b)](_0x17cd4c[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1ae)]),_0x3e4818=await yamlIntegrationToApi(_0x17cd4c[_0x2a5d7f(0x19b)],_0x18fd6a,_0x420a10);if(_0x4eba90){await this['client'][_0x2a5d7f(0x252)](_0x4eba90['id']);const _0x3a2c37=await this[_0x2a5d7f(0x195)]['createIntegration'](_0x3e4818);_0x26a176[_0x2a5d7f(0x256)][_0x2a5d7f(0x204)]({'name':_0x17cd4c['yaml'][_0x2a5d7f(0x1ae)],'action':'updated','id':_0x3a2c37['id']}),_0x26a176['counts'][_0x2a5d7f(0x256)][_0x2a5d7f(0x266)]++;}else{const _0x52faa3=await this['client'][_0x2a5d7f(0x19d)](_0x3e4818);_0x26a176[_0x2a5d7f(0x256)][_0x2a5d7f(0x204)]({'name':_0x17cd4c['yaml'][_0x2a5d7f(0x1ae)],'action':_0x2a5d7f(0x27a),'id':_0x52faa3['id']}),_0x26a176['counts']['integrations'][_0x2a5d7f(0x27a)]++;}}catch(_0x2c05e6){_0x26a176[_0x2a5d7f(0x256)][_0x2a5d7f(0x204)]({'name':_0x17cd4c[_0x2a5d7f(0x19b)]['service_type'],'action':_0x2a5d7f(0x205),'error':_0x2c05e6['message']}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x256)][_0x2a5d7f(0x1e6)]++;}}for(const _0x585424 of _0x1f56bd){try{const _0x22dc34=_0x1ce34b['get'](_0x585424['yaml'][_0x2a5d7f(0x1c3)]),_0x3f748d=await yamlFormInterfaceToApi(_0x585424[_0x2a5d7f(0x19b)],_0x18fd6a,_0x420a10);if(!_0x3f748d){_0x26a176[_0x2a5d7f(0x1ad)]['push']({'name':_0x585424[_0x2a5d7f(0x19b)]['name'],'action':_0x2a5d7f(0x205),'error':_0x2a5d7f(0x22b)}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1ad)][_0x2a5d7f(0x1e6)]++;continue;}if(_0x22dc34){const _0x4f9f25=await this[_0x2a5d7f(0x195)]['updateFormInterface'](_0x22dc34['id'],_0x3f748d);_0x26a176[_0x2a5d7f(0x1ad)]['push']({'name':_0x585424[_0x2a5d7f(0x19b)]['name'],'action':_0x2a5d7f(0x266),'id':_0x4f9f25['id']}),_0x26a176['counts'][_0x2a5d7f(0x1ad)]['updated']++;}else{const _0x198e0a=await this[_0x2a5d7f(0x195)][_0x2a5d7f(0x1f7)](_0x3f748d);_0x26a176['formInterfaces'][_0x2a5d7f(0x204)]({'name':_0x585424[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x27a),'id':_0x198e0a['id']}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1ad)][_0x2a5d7f(0x27a)]++;}}catch(_0x29215c){_0x26a176[_0x2a5d7f(0x1ad)][_0x2a5d7f(0x204)]({'name':_0x585424[_0x2a5d7f(0x19b)]['name'],'action':_0x2a5d7f(0x205),'error':_0x29215c[_0x2a5d7f(0x187)]}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1ad)]['errors']++;}}for(const _0xdede5d of _0x12ef65){try{const _0x19ab69=_0x103b12[_0x2a5d7f(0x24b)](_0xdede5d[_0x2a5d7f(0x19b)]['name']),_0x2da706=await yamlChatInterfaceToApi(_0xdede5d['yaml'],_0x18fd6a,_0x420a10);if(_0x19ab69){const _0x2fee4d=await this[_0x2a5d7f(0x195)]['updateChatInterface'](_0x19ab69['id'],_0x2da706);_0x26a176[_0x2a5d7f(0x1be)]['push']({'name':_0xdede5d[_0x2a5d7f(0x19b)][_0x2a5d7f(0x1c3)],'action':'updated','id':_0x2fee4d['id']}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1be)][_0x2a5d7f(0x266)]++;}else{const _0x543031=await this['client'][_0x2a5d7f(0x188)](_0x2da706);_0x26a176[_0x2a5d7f(0x1be)][_0x2a5d7f(0x204)]({'name':_0xdede5d['yaml']['name'],'action':_0x2a5d7f(0x27a),'id':_0x543031['id']}),_0x26a176['counts']['chatInterfaces'][_0x2a5d7f(0x27a)]++;}}catch(_0x1088d8){_0x26a176[_0x2a5d7f(0x1be)]['push']({'name':_0xdede5d['yaml'][_0x2a5d7f(0x1c3)],'action':_0x2a5d7f(0x205),'error':_0x1088d8[_0x2a5d7f(0x187)]}),_0x26a176[_0x2a5d7f(0x1f1)][_0x2a5d7f(0x1be)][_0x2a5d7f(0x1e6)]++;}}return _0x26a176;}async[a138_0x192cb2(0x278)](_0x5caff3,_0x2cdc96,_0x37b291,_0x21e0fe){const _0x2bbca0=a138_0x192cb2,{projectId:_0x490ce5,project:_0x214864}=await this[_0x2bbca0(0x20b)](_0x5caff3),_0x2c1a76=_0x214864[_0x2bbca0(0x21d)][_0x2bbca0(0x1c3)],_0x347307=await this[_0x2bbca0(0x195)][_0x2bbca0(0x282)](_0x490ce5),_0x14b21c=_0x347307['find'](_0x1853dd=>_0x1853dd[_0x2bbca0(0x21d)][_0x2bbca0(0x1c3)]===_0x2cdc96);if(!_0x14b21c)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x2bbca0(0x21f)+_0x2cdc96,undefined,{'helpText':_0x2bbca0(0x215)+_0x347307['map'](_0x2d1ab1=>_0x2d1ab1[_0x2bbca0(0x21d)]['name'])['join'](',\x20')});let _0x26555e;if(_0x37b291)_0x26555e=_0x37b291;else{const _0x1d8f54=a138_0x3bc761[_0x2bbca0(0x224)](process['cwd'](),_0x2bbca0(0x1df)),_0x1450fe=getSanitizedPathWithMigration(_0x1d8f54,_0x2c1a76);_0x1450fe[_0x2bbca0(0x24f)]&&this['logger'][_0x2bbca0(0x1a2)](_0x2bbca0(0x289)+a138_0x3bc761[_0x2bbca0(0x206)](_0x1450fe['oldPath'])+_0x2bbca0(0x26d)+a138_0x3bc761[_0x2bbca0(0x206)](_0x1450fe[_0x2bbca0(0x211)])),_0x26555e=_0x1450fe[_0x2bbca0(0x211)];}const _0x410033=getSanitizedPathWithMigration(_0x26555e,_0x2cdc96);_0x410033['renamed']&&this[_0x2bbca0(0x18b)][_0x2bbca0(0x1a2)](_0x2bbca0(0x21a)+a138_0x3bc761['basename'](_0x410033[_0x2bbca0(0x1af)])+_0x2bbca0(0x26d)+a138_0x3bc761['basename'](_0x410033['path']));const _0x2c9f2b=_0x410033[_0x2bbca0(0x211)],_0x17d1ca=new Map(),_0x6f5add=new Map(),_0x478bbb=await this[_0x2bbca0(0x195)][_0x2bbca0(0x200)](_0x490ce5),_0xe1e608=await this[_0x2bbca0(0x195)][_0x2bbca0(0x1f4)](_0x490ce5),_0x50f0d2=await safeListOrEmpty(()=>this[_0x2bbca0(0x195)][_0x2bbca0(0x255)](_0x490ce5)),_0x4d3daa=new Map(),_0x172c15=new Map();for(const _0x3980d3 of _0x478bbb){_0x17d1ca[_0x2bbca0(0x274)](_0x3980d3['id'],_0x3980d3['attributes']['name']);}for(const _0x309542 of _0xe1e608){_0x4d3daa[_0x2bbca0(0x274)](_0x309542['id'],_0x309542[_0x2bbca0(0x21d)][_0x2bbca0(0x1c3)]);}for(const _0x14301f of _0x50f0d2){_0x172c15[_0x2bbca0(0x274)](_0x14301f['id'],_0x14301f['attributes']['name']);}for(const _0x43b29a of _0x347307){_0x6f5add[_0x2bbca0(0x274)](_0x43b29a['id'],_0x43b29a['attributes'][_0x2bbca0(0x1c3)]);}const _0x32089a={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x17d1ca,'TextKnowledgeBase':_0x4d3daa,'Agent':_0x6f5add,'ExperimentalKnowledgeBase':_0x172c15}),'resolvePromptName':async()=>undefined,'onWarning':_0x4047fb=>this[_0x2bbca0(0x18b)][_0x2bbca0(0x1f9)](_0x4047fb)},_0xd8f5d8=a138_0x3bc761[_0x2bbca0(0x224)](_0x2c9f2b,_0x2bbca0(0x1e4)),_0x5654ee=a138_0x3bc761[_0x2bbca0(0x224)](_0x2c9f2b,_0x2bbca0(0x248)),_0x536f5f=a138_0x3bc761[_0x2bbca0(0x224)](_0x2c9f2b,_0x2bbca0(0x217)),_0xbeb747=!a138_0x181126['existsSync'](_0x5654ee);if(_0x21e0fe?.['dryRun'])return{'agentName':_0x2cdc96,'outputPath':_0x2c9f2b,'isNew':_0xbeb747,'hasChanges':!![]};a138_0x181126['mkdirSync'](_0x26555e,{'recursive':!![]}),a138_0x181126[_0x2bbca0(0x1bc)](_0x2c9f2b,{'recursive':!![]});const _0x225b41=a138_0x3bc761[_0x2bbca0(0x224)](_0x26555e,'tdx.json');!a138_0x181126[_0x2bbca0(0x196)](_0x225b41)&&a138_0x181126['writeFileSync'](_0x225b41,createAgentConfigContent(_0x5caff3));const {yaml:_0x247b5a,systemPrompt:_0x5ee113,starterMessage:_0x1b2d6f}=await agentResponseToDef(_0x14b21c,_0x32089a);let _0x2d9880=_0xbeb747;if(!_0xbeb747){const _0x218f5f=a138_0x181126[_0x2bbca0(0x196)](_0xd8f5d8)?a138_0x181126[_0x2bbca0(0x1bb)](_0xd8f5d8,_0x2bbca0(0x237)):'',_0x1151f9=a138_0x181126[_0x2bbca0(0x1bb)](_0x5654ee,_0x2bbca0(0x237));_0x2d9880=_0x218f5f!==_0x5ee113||_0x1151f9!==toAgentYamlString(_0x247b5a);}a138_0x181126['writeFileSync'](_0xd8f5d8,_0x5ee113),a138_0x181126[_0x2bbca0(0x2a1)](_0x5654ee,toAgentYamlString(_0x247b5a));if(_0x1b2d6f&&_0x1b2d6f[_0x2bbca0(0x1ca)]('\x0a'))a138_0x181126['writeFileSync'](_0x536f5f,_0x1b2d6f);else a138_0x181126[_0x2bbca0(0x196)](_0x536f5f)&&a138_0x181126[_0x2bbca0(0x229)](_0x536f5f);return{'agentName':_0x2cdc96,'outputPath':_0x2c9f2b,'isNew':_0xbeb747,'hasChanges':_0x2d9880};}async[a138_0x192cb2(0x27e)](_0x51fce0,_0x48e6f8){const _0x10e289=a138_0x192cb2;let _0x15a077;isAgentYamlPath(_0x51fce0)?_0x15a077=getAgentDirFromYamlPath(_0x51fce0):_0x15a077=_0x51fce0;const {config:_0x570e66}=findAgentConfig(_0x15a077),_0x2fe466=await this[_0x10e289(0x1a3)](_0x570e66['llm_project']),_0x12a6f2=a138_0x3bc761[_0x10e289(0x224)](_0x15a077,_0x10e289(0x248)),_0x308703=a138_0x3bc761[_0x10e289(0x224)](_0x15a077,_0x10e289(0x1e4)),_0x322783=a138_0x3bc761[_0x10e289(0x224)](_0x15a077,_0x10e289(0x217));if(!a138_0x181126['existsSync'](_0x12a6f2))throw new SDKError(ErrorCode['NOT_FOUND'],_0x10e289(0x246)+_0x15a077,undefined,{'helpText':_0x10e289(0x288)});const _0xb92c02=parseAgentYaml(a138_0x181126[_0x10e289(0x1bb)](_0x12a6f2,_0x10e289(0x237)),_0x12a6f2),_0x5c69b1=a138_0x181126[_0x10e289(0x196)](_0x308703)?a138_0x181126[_0x10e289(0x1bb)](_0x308703,_0x10e289(0x237)):'',_0x29e926=a138_0x181126[_0x10e289(0x196)](_0x322783)?a138_0x181126[_0x10e289(0x1bb)](_0x322783,_0x10e289(0x237)):_0xb92c02[_0x10e289(0x1c4)];if(_0x48e6f8?.[_0x10e289(0x298)])return{'agentName':_0xb92c02['name'],'action':_0x10e289(0x27a),'projectId':_0x2fe466};const _0x312f5f=await this['client'][_0x10e289(0x282)](_0x2fe466),_0x2128af=await fetchAllToolTargetMaps((_0x2cd9aa,_0x213102)=>this[_0x10e289(0x195)][_0x10e289(0x1e0)](_0x2cd9aa,_0x213102),_0x2fe466),_0x533940=new Map();for(const _0x71c1f5 of _0x312f5f){_0x533940[_0x10e289(0x274)](_0x71c1f5[_0x10e289(0x21d)]['name'],_0x71c1f5['id']);}const _0x69492e=[],_0x38d2c7={'projectId':_0x2fe466,'resolveToolTargetId':buildIdResolver({..._0x2128af[_0x10e289(0x1da)],'Agent':_0x533940}),'resolvePromptId':async()=>undefined,'onWarning':_0x528f50=>{const _0x14fa9e=_0x10e289;this[_0x14fa9e(0x18b)][_0x14fa9e(0x1f9)](_0x528f50),_0x69492e['push'](_0x528f50);}};try{const _0x50ea9c=_0x312f5f[_0x10e289(0x257)](_0x158b3a=>_0x158b3a[_0x10e289(0x21d)][_0x10e289(0x1c3)]===_0xb92c02[_0x10e289(0x1c3)]),_0x54b308=await agentDefToRequest(_0xb92c02,_0x5c69b1,_0x29e926,_0x38d2c7);if(_0x50ea9c)return await this[_0x10e289(0x195)][_0x10e289(0x1c2)](_0x50ea9c['id'],_0x54b308),{'agentName':_0xb92c02['name'],'action':_0x10e289(0x266),'projectId':_0x2fe466,'agentId':_0x50ea9c['id'],'warnings':_0x69492e[_0x10e289(0x20d)]>0x0?_0x69492e:undefined};else{const _0x5c71a7=await this[_0x10e289(0x195)][_0x10e289(0x189)](_0x54b308);return{'agentName':_0xb92c02['name'],'action':'created','projectId':_0x2fe466,'agentId':_0x5c71a7['id'],'warnings':_0x69492e[_0x10e289(0x20d)]>0x0?_0x69492e:undefined};}}catch(_0x4e2f85){return{'agentName':_0xb92c02[_0x10e289(0x1c3)],'action':_0x10e289(0x205),'projectId':_0x2fe466,'error':_0x4e2f85[_0x10e289(0x187)],'warnings':_0x69492e[_0x10e289(0x20d)]>0x0?_0x69492e:undefined};}}async['cloneProject'](_0x5370ba,_0x39f256,_0x1821d7){const _0x431060=a138_0x192cb2,_0x5dbf33=a138_0x181126[_0x431060(0x196)](_0x5370ba)&&a138_0x181126[_0x431060(0x196)](a138_0x3bc761[_0x431060(0x224)](_0x5370ba,_0x431060(0x1ff)));let _0x3bc7b4;const _0x1227b0=[],_0x49c789=[],_0x43b769=[],_0x3379e9=[],_0x2e21da=[],_0x1e46f1=[],_0x5f4aba=[],_0x2ae90e=[],_0x1374c3=[];if(_0x5dbf33){const _0x261d2b=loadAgentConfig(a138_0x3bc761['join'](_0x5370ba,_0x431060(0x1ff)));_0x3bc7b4=_0x261d2b[_0x431060(0x18c)];const _0x3226bc=a138_0x181126[_0x431060(0x1f0)](_0x5370ba,{'withFileTypes':!![]});for(const _0x3240e8 of _0x3226bc){if(!_0x3240e8[_0x431060(0x1a1)]())continue;if([_0x431060(0x1e5),_0x431060(0x221),_0x431060(0x258),_0x431060(0x1ec),'integrations','form_interfaces',_0x431060(0x199)][_0x431060(0x1ca)](_0x3240e8[_0x431060(0x1c3)]))continue;const _0x3ac0fd=a138_0x3bc761['join'](_0x5370ba,_0x3240e8[_0x431060(0x1c3)]);if(isAgentDir(_0x3ac0fd)){const _0x2b2d03=a138_0x3bc761['join'](_0x3ac0fd,_0x431060(0x248)),_0x373893=a138_0x3bc761['join'](_0x3ac0fd,_0x431060(0x1e4)),_0x419eeb=a138_0x3bc761['join'](_0x3ac0fd,_0x431060(0x217)),_0x5440e6=parseAgentYaml(a138_0x181126['readFileSync'](_0x2b2d03,_0x431060(0x237)),_0x2b2d03),_0x3bef3f=a138_0x181126[_0x431060(0x196)](_0x373893)?a138_0x181126['readFileSync'](_0x373893,_0x431060(0x237)):'',_0x7f5a19=a138_0x181126[_0x431060(0x196)](_0x419eeb)?a138_0x181126[_0x431060(0x1bb)](_0x419eeb,_0x431060(0x237)):_0x5440e6[_0x431060(0x1c4)];_0x1227b0[_0x431060(0x204)]({'name':_0x5440e6[_0x431060(0x1c3)],'dir':_0x3ac0fd,'yaml':_0x5440e6,'systemPrompt':_0x3bef3f,'starterMessage':_0x7f5a19});}}const _0x162850=getKnowledgeBasesDir(_0x5370ba);if(a138_0x181126[_0x431060(0x196)](_0x162850)){const _0x2e47f3=a138_0x181126[_0x431060(0x1f0)](_0x162850);for(const _0x370bab of _0x2e47f3){const _0x1ccb9d=a138_0x3bc761[_0x431060(0x224)](_0x162850,_0x370bab);if(_0x370bab[_0x431060(0x26f)](_0x431060(0x1b6))){const _0x4b0443=parseKnowledgeBaseYaml(a138_0x181126[_0x431060(0x1bb)](_0x1ccb9d,_0x431060(0x237)),_0x1ccb9d);_0x49c789[_0x431060(0x204)]({'name':_0x4b0443[_0x431060(0x1c3)],'path':_0x1ccb9d,'yaml':_0x4b0443});}else{if(_0x370bab[_0x431060(0x26f)]('.md')){const _0x4f0b9c=a138_0x181126[_0x431060(0x1bb)](_0x1ccb9d,_0x431060(0x237)),{name:_0x1ddd0b,text:_0x30c330}=parseTextKnowledgeBaseMd(_0x4f0b9c,_0x370bab);_0x43b769[_0x431060(0x204)]({'name':_0x1ddd0b,'path':_0x1ccb9d,'text':_0x30c330});}}}}const _0x4d4c2c=getPromptsDir(_0x5370ba);if(a138_0x181126[_0x431060(0x196)](_0x4d4c2c)){const _0x48f1df=a138_0x181126[_0x431060(0x1f0)](_0x4d4c2c)[_0x431060(0x1ab)](_0x2567ed=>_0x2567ed[_0x431060(0x26f)](_0x431060(0x1b6)));for(const _0x512a6c of _0x48f1df){const _0x371d21=a138_0x3bc761[_0x431060(0x224)](_0x4d4c2c,_0x512a6c),_0x1eea7f=parsePromptYaml(a138_0x181126[_0x431060(0x1bb)](_0x371d21,_0x431060(0x237)),_0x371d21);_0x3379e9[_0x431060(0x204)]({'name':_0x1eea7f[_0x431060(0x1c3)],'path':_0x371d21,'yaml':_0x1eea7f});}}const _0x298070=getIntegrationsDir(_0x5370ba);if(a138_0x181126[_0x431060(0x196)](_0x298070)){const _0x2c392d=a138_0x181126[_0x431060(0x1f0)](_0x298070)[_0x431060(0x1ab)](_0x606cd9=>_0x606cd9[_0x431060(0x26f)]('.yml'));for(const _0x31199b of _0x2c392d){const _0x21b29d=a138_0x3bc761[_0x431060(0x224)](_0x298070,_0x31199b),_0x2598c4=parseIntegrationYaml(a138_0x181126[_0x431060(0x1bb)](_0x21b29d,_0x431060(0x237)),_0x21b29d);SAFE_INTEGRATION_TYPES[_0x431060(0x1ca)](_0x2598c4[_0x431060(0x1ae)][_0x431060(0x295)]())?_0x2e21da[_0x431060(0x204)]({'name':_0x2598c4['name'],'path':_0x21b29d,'yaml':_0x2598c4}):this[_0x431060(0x18b)][_0x431060(0x1f9)](_0x431060(0x244)+_0x2598c4[_0x431060(0x1c3)]+_0x431060(0x1f8)+_0x2598c4['service_type']+_0x431060(0x254)+(_0x431060(0x1e1)+SAFE_INTEGRATION_TYPES[_0x431060(0x224)](',\x20')+')\x20can\x20be\x20cloned.'));}}const _0x9d63f2=getExperimentalKnowledgeBasesDir(_0x5370ba);if(a138_0x181126[_0x431060(0x196)](_0x9d63f2)){const _0x4c5783=a138_0x181126['readdirSync'](_0x9d63f2,{'withFileTypes':!![]});for(const _0x59465a of _0x4c5783){if(!_0x59465a['isDirectory']())continue;const _0x49fdcd=a138_0x3bc761[_0x431060(0x224)](_0x9d63f2,_0x59465a['name']),_0x5dd2a9=a138_0x3bc761['join'](_0x49fdcd,_0x59465a[_0x431060(0x1c3)]+_0x431060(0x1b6));if(a138_0x181126[_0x431060(0x196)](_0x5dd2a9)){const _0x4de45b=parseExperimentalKnowledgeBaseYaml(a138_0x181126[_0x431060(0x1bb)](_0x5dd2a9,'utf-8'),_0x5dd2a9),_0x398271=a138_0x3bc761[_0x431060(0x224)](_0x49fdcd,'functions'),_0x240678=[];if(a138_0x181126[_0x431060(0x196)](_0x398271)){const _0x591fc3=a138_0x181126[_0x431060(0x1f0)](_0x398271,{'withFileTypes':!![]});for(const _0x33f976 of _0x591fc3){if(!_0x33f976['isDirectory']())continue;const _0x116c17=a138_0x3bc761[_0x431060(0x224)](_0x398271,_0x33f976[_0x431060(0x1c3)]),_0xe66749=a138_0x3bc761[_0x431060(0x224)](_0x116c17,_0x431060(0x287)),_0x2151b7=a138_0x3bc761[_0x431060(0x224)](_0x116c17,'json_schema.json');if(a138_0x181126[_0x431060(0x196)](_0xe66749)&&a138_0x181126[_0x431060(0x196)](_0x2151b7)){const _0x1b33af=a138_0x181126[_0x431060(0x1bb)](_0xe66749,_0x431060(0x237)),_0x231154=a138_0x181126['readFileSync'](_0x2151b7,_0x431060(0x237));_0x240678[_0x431060(0x204)]({'name':_0x33f976[_0x431060(0x1c3)],'code':_0x1b33af,'json_schema':_0x231154});}}}const _0xbf358e={..._0x4de45b,'functions':_0x240678};_0x1e46f1['push']({'name':_0x4de45b['name'],'path':_0x49fdcd,'def':_0xbf358e});}}}const _0x185863=getExperimentalArtifactsDir(_0x5370ba);if(a138_0x181126[_0x431060(0x196)](_0x185863)){const _0x379b7b=a138_0x181126['readdirSync'](_0x185863,{'withFileTypes':!![]});for(const _0x142231 of _0x379b7b){if(!_0x142231[_0x431060(0x1a1)]())continue;const _0x5b7784=a138_0x3bc761['join'](_0x185863,_0x142231[_0x431060(0x1c3)]),_0x13b304=a138_0x3bc761['join'](_0x5b7784,_0x142231[_0x431060(0x1c3)]+_0x431060(0x1b6));if(a138_0x181126[_0x431060(0x196)](_0x13b304)){const _0x64ccc7=parseExperimentalArtifactYaml(a138_0x181126[_0x431060(0x1bb)](_0x13b304,_0x431060(0x237)),_0x13b304),_0x4d5df7=a138_0x3bc761[_0x431060(0x224)](_0x5b7784,_0x431060(0x287)),_0x5258ea=a138_0x181126[_0x431060(0x196)](_0x4d5df7)?a138_0x181126['readFileSync'](_0x4d5df7,'utf-8'):'',_0x8c7897=a138_0x3bc761[_0x431060(0x224)](_0x5b7784,_0x431060(0x235)),_0x2a30e4=[];if(a138_0x181126[_0x431060(0x196)](_0x8c7897)){const _0x50f302=a138_0x181126[_0x431060(0x1f0)](_0x8c7897);for(const _0x547a4e of _0x50f302){const _0x14fe46=a138_0x3bc761[_0x431060(0x224)](_0x8c7897,_0x547a4e);if(a138_0x181126[_0x431060(0x290)](_0x14fe46)['isFile']()){const _0x38ce02=a138_0x181126[_0x431060(0x1bb)](_0x14fe46,_0x431060(0x237));_0x2a30e4[_0x431060(0x204)]({'file_name':_0x547a4e,'text_content':_0x38ce02});}}}const _0x323c79={..._0x64ccc7,'code':_0x5258ea,'files':_0x2a30e4};_0x5f4aba['push']({'name':_0x64ccc7['name'],'path':_0x5b7784,'def':_0x323c79});}}}const _0x271d21=getFormInterfacesDir(_0x5370ba);if(a138_0x181126[_0x431060(0x196)](_0x271d21)){const _0x2a83c3=a138_0x181126[_0x431060(0x1f0)](_0x271d21)[_0x431060(0x1ab)](_0x1ca6a0=>_0x1ca6a0[_0x431060(0x26f)](_0x431060(0x1b6)));for(const _0x4d4481 of _0x2a83c3){const _0x35018a=a138_0x3bc761['join'](_0x271d21,_0x4d4481),_0x186191=parseFormInterfaceYaml(a138_0x181126['readFileSync'](_0x35018a,_0x431060(0x237)),_0x35018a);_0x2ae90e['push']({'name':_0x186191['name'],'path':_0x35018a,'yaml':_0x186191});}}const _0x4f6aee=getChatInterfacesDir(_0x5370ba);if(a138_0x181126[_0x431060(0x196)](_0x4f6aee)){const _0x469f0b=a138_0x181126[_0x431060(0x1f0)](_0x4f6aee)[_0x431060(0x1ab)](_0x19a6ab=>_0x19a6ab['endsWith'](_0x431060(0x1b6)));for(const _0x3a8b59 of _0x469f0b){const _0x15e9d7=a138_0x3bc761[_0x431060(0x224)](_0x4f6aee,_0x3a8b59),_0x457816=parseChatInterfaceYaml(a138_0x181126[_0x431060(0x1bb)](_0x15e9d7,'utf-8'),_0x15e9d7);_0x1374c3[_0x431060(0x204)]({'name':_0x457816[_0x431060(0x1c3)],'path':_0x15e9d7,'yaml':_0x457816});}}}else{const _0x2a6c5e=await this[_0x431060(0x1a3)](_0x5370ba),_0x14bf61=await this[_0x431060(0x195)][_0x431060(0x1c6)](_0x2a6c5e);_0x3bc7b4=_0x14bf61[_0x431060(0x21d)]['name'];const _0x4fb3c5=await this[_0x431060(0x195)][_0x431060(0x282)](_0x2a6c5e),_0x1f96e9=await this[_0x431060(0x195)]['listKnowledgeBases'](_0x2a6c5e),_0x2fb901=await this[_0x431060(0x195)]['listTextKnowledgeBases'](_0x2a6c5e),_0x2148ca=await this['client'][_0x431060(0x1d0)](_0x2a6c5e),_0x315758=await this[_0x431060(0x195)][_0x431060(0x1b8)](_0x2a6c5e),_0x567f0b=await safeListOrEmpty(()=>this['client'][_0x431060(0x255)](_0x2a6c5e)),_0x22e5aa=await safeListOrEmpty(()=>this[_0x431060(0x195)]['listExperimentalArtifacts'](_0x2a6c5e)),_0xd9a9ea=new Map(),_0x4acc96=new Map(),_0x488c7e=new Map(),_0x1eac4a=new Map(),_0x227fef=new Map(),_0x5e0926=new Map();for(const _0x532784 of _0x1f96e9){_0xd9a9ea['set'](_0x532784['id'],_0x532784[_0x431060(0x21d)][_0x431060(0x1c3)]);}for(const _0x5acd81 of _0x2fb901){_0x4acc96[_0x431060(0x274)](_0x5acd81['id'],_0x5acd81[_0x431060(0x21d)][_0x431060(0x1c3)]);}for(const _0x28af53 of _0x4fb3c5){_0x488c7e[_0x431060(0x274)](_0x28af53['id'],_0x28af53[_0x431060(0x21d)][_0x431060(0x1c3)]);}for(const _0x1c7d99 of _0x2148ca){_0x1eac4a[_0x431060(0x274)](_0x1c7d99['id'],_0x1c7d99[_0x431060(0x21d)][_0x431060(0x1c3)]);}for(const _0x16781b of _0x567f0b){_0x227fef[_0x431060(0x274)](_0x16781b['id'],_0x16781b[_0x431060(0x21d)]['name']);}for(const _0x1dd3d0 of _0x22e5aa){_0x5e0926[_0x431060(0x274)](_0x1dd3d0['id'],_0x1dd3d0[_0x431060(0x21d)]['name']);}const _0x582307={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0xd9a9ea,'TextKnowledgeBase':_0x4acc96,'Agent':_0x488c7e,'ExperimentalKnowledgeBase':_0x227fef}),'resolvePromptName':async _0x1d2d42=>_0x1eac4a[_0x431060(0x24b)](_0x1d2d42),'onWarning':_0xb3273f=>this[_0x431060(0x18b)][_0x431060(0x1f9)](_0xb3273f)};for(const _0x21b2af of _0x4fb3c5){const _0x157f1e=await agentResponseToDef(_0x21b2af,_0x582307),{yaml:_0x39f877,systemPrompt:_0x28472f,starterMessage:_0x5b753e}=_0x157f1e;_0x1227b0[_0x431060(0x204)]({'name':_0x39f877['name'],'dir':'','yaml':_0x39f877,'systemPrompt':_0x28472f,'starterMessage':_0x5b753e});}for(const _0x5ae90e of _0x1f96e9){const _0x146d6b=apiKnowledgeBaseToYaml(_0x5ae90e);_0x49c789[_0x431060(0x204)]({'name':_0x146d6b[_0x431060(0x1c3)],'path':'','yaml':_0x146d6b});}for(const _0x509ed8 of _0x2fb901){_0x43b769[_0x431060(0x204)]({'name':_0x509ed8['attributes'][_0x431060(0x1c3)],'path':'','text':_0x509ed8['attributes']['text']});}for(const _0x3ebad0 of _0x2148ca){const _0x2efe12=await apiPromptToYaml(_0x3ebad0,_0x582307);_0x2efe12&&_0x3379e9[_0x431060(0x204)]({'name':_0x2efe12[_0x431060(0x1c3)],'path':'','yaml':_0x2efe12});}for(const _0x53cc97 of _0x315758){if(!_0x53cc97[_0x431060(0x21d)][_0x431060(0x1f3)]&&SAFE_INTEGRATION_TYPES[_0x431060(0x1ca)](_0x53cc97[_0x431060(0x21d)][_0x431060(0x27c)][_0x431060(0x295)]())){const _0x223edc=await apiIntegrationToYaml(_0x53cc97,_0x582307);_0x2e21da[_0x431060(0x204)]({'name':_0x53cc97[_0x431060(0x21d)]['serviceType'][_0x431060(0x295)](),'path':'','yaml':_0x223edc});}}for(const _0x14f5e1 of _0x567f0b){const _0x42a495=apiExperimentalKnowledgeBaseToYaml(_0x14f5e1);_0x1e46f1[_0x431060(0x204)]({'name':_0x42a495[_0x431060(0x1c3)],'path':'','def':_0x42a495});}for(const _0x538d10 of _0x22e5aa){const _0x41e399=apiExperimentalArtifactToYaml(_0x538d10);_0x5f4aba['push']({'name':_0x41e399[_0x431060(0x1c3)],'path':'','def':_0x41e399});}const _0x102e82=await safeListOrEmpty(()=>this[_0x431060(0x195)][_0x431060(0x28f)](_0x2a6c5e));for(const _0xa9fd6b of _0x102e82){const _0xb3a3fe=await apiFormInterfaceToYaml(_0xa9fd6b,_0x582307);_0x2ae90e[_0x431060(0x204)]({'name':_0xb3a3fe[_0x431060(0x1c3)],'path':'','yaml':_0xb3a3fe});}const _0x39b190=await safeListOrEmpty(()=>this[_0x431060(0x195)][_0x431060(0x241)](_0x2a6c5e));for(const _0x1af6ad of _0x39b190){if(_0x1af6ad[_0x431060(0x21d)][_0x431060(0x1f3)])continue;const _0x4d2b6f=await apiChatInterfaceToYaml(_0x1af6ad,_0x582307);_0x1374c3['push']({'name':_0x4d2b6f[_0x431060(0x1c3)],'path':'','yaml':_0x4d2b6f});}}const _0x2e9672={'sourceProjectName':_0x3bc7b4,'newProjectName':_0x39f256,'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}}},_0x3df579=await this[_0x431060(0x195)][_0x431060(0x291)](),_0x571492=_0x3df579[_0x431060(0x257)](_0x417004=>_0x417004[_0x431060(0x21d)][_0x431060(0x1c3)]===_0x39f256);if(_0x571492)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x431060(0x1ce)+_0x39f256+'\x22\x20already\x20exists',undefined,{'helpText':_0x431060(0x24e)});if(_0x1821d7?.[_0x431060(0x298)])return _0x2e9672[_0x431060(0x1f1)][_0x431060(0x1df)][_0x431060(0x27a)]=_0x1227b0[_0x431060(0x20d)],_0x2e9672[_0x431060(0x1f1)][_0x431060(0x1fc)][_0x431060(0x27a)]=_0x49c789[_0x431060(0x20d)],_0x2e9672['counts'][_0x431060(0x185)]['created']=_0x43b769[_0x431060(0x20d)],_0x2e9672[_0x431060(0x1f1)][_0x431060(0x276)][_0x431060(0x27a)]=_0x1e46f1[_0x431060(0x20d)],_0x2e9672[_0x431060(0x1f1)][_0x431060(0x1ba)][_0x431060(0x27a)]=_0x5f4aba[_0x431060(0x20d)],_0x2e9672[_0x431060(0x1f1)][_0x431060(0x1ec)][_0x431060(0x27a)]=_0x3379e9[_0x431060(0x20d)],_0x2e9672[_0x431060(0x1f1)]['integrations'][_0x431060(0x27a)]=_0x2e21da[_0x431060(0x20d)],_0x2e9672;const _0xd1b1a9=await this[_0x431060(0x195)][_0x431060(0x208)]({'name':_0x39f256}),_0x493973=_0xd1b1a9['id'];_0x2e9672[_0x431060(0x21e)]=_0x493973;const _0x14b0f1=new Map(),_0x3b6227=new Map(),_0x18cb53=new Map(),_0x2e8ddc=new Map(),_0x2a0d2f=new Map(),_0x8e22e6=new Map(),_0x17e44e=new Map(),_0x2957af=new Map(),_0x404996=new Set(),_0x4499c8=new Set();for(const _0x2f9910 of _0x1227b0){for(const _0x2da4b4 of _0x2f9910['yaml'][_0x431060(0x1b3)]||[]){if(_0x2da4b4[_0x431060(0x1c1)]===_0x431060(0x23d)&&_0x2da4b4[_0x431060(0x2a5)]){const _0x7ac035=parseRef(_0x2da4b4[_0x431060(0x2a5)]);if(_0x7ac035)_0x404996[_0x431060(0x22a)](_0x7ac035[_0x431060(0x1c3)]);}else{if(_0x2da4b4[_0x431060(0x1c1)]==='web_search'&&_0x2da4b4['target']){const _0x4dec4d=parseRef(_0x2da4b4[_0x431060(0x2a5)]);if(_0x4dec4d)_0x4499c8[_0x431060(0x22a)](_0x4dec4d[_0x431060(0x1c3)]);}}}}for(const _0x10d9ca of _0x404996){try{const _0x167a1a=await this[_0x431060(0x195)][_0x431060(0x1a8)]({'projectId':_0x493973,'name':_0x10d9ca});_0x2a0d2f[_0x431060(0x274)](_0x10d9ca,_0x167a1a['id']),_0x2e9672['imageGenerators']['push']({'name':_0x10d9ca,'action':_0x431060(0x27a),'id':_0x167a1a['id']}),_0x2e9672[_0x431060(0x1f1)][_0x431060(0x25e)]['created']++;}catch(_0x31f834){_0x2e9672['imageGenerators']['push']({'name':_0x10d9ca,'action':_0x431060(0x205),'error':_0x31f834['message']}),_0x2e9672[_0x431060(0x1f1)][_0x431060(0x25e)][_0x431060(0x1e6)]++;}}for(const _0x2b47cd of _0x4499c8){try{const _0x5a3b58=await this[_0x431060(0x195)][_0x431060(0x1e2)]({'projectId':_0x493973,'name':_0x2b47cd});_0x8e22e6[_0x431060(0x274)](_0x2b47cd,_0x5a3b58['id']),_0x2e9672[_0x431060(0x1c5)][_0x431060(0x204)]({'name':_0x2b47cd,'action':_0x431060(0x27a),'id':_0x5a3b58['id']}),_0x2e9672[_0x431060(0x1f1)]['webSearchTools'][_0x431060(0x27a)]++;}catch(_0x3ee9d3){_0x2e9672[_0x431060(0x1c5)][_0x431060(0x204)]({'name':_0x2b47cd,'action':_0x431060(0x205),'error':_0x3ee9d3[_0x431060(0x187)]}),_0x2e9672[_0x431060(0x1f1)]['webSearchTools'][_0x431060(0x1e6)]++;}}const _0x266433=await fetchAllToolTargetMaps((_0x2cd755,_0x9628e5)=>this[_0x431060(0x195)][_0x431060(0x1e0)](_0x2cd755,_0x9628e5),_0x493973);let _0x1e908e=[];const _0x56ec0d={'projectId':_0x493973,'resolveToolTargetId':buildIdResolver({..._0x266433['nameToId'],'KnowledgeBase':_0x14b0f1,'TextKnowledgeBase':_0x3b6227,'ExperimentalKnowledgeBase':_0x17e44e,'Agent':_0x18cb53,'WebSearchTool':_0x8e22e6,'ImageGenerator':_0x2a0d2f}),'resolvePromptId':async _0xb87b9d=>_0x2e8ddc[_0x431060(0x24b)](_0xb87b9d),'onWarning':_0x27d241=>{const _0x26eee3=_0x431060;this['logger']['warn'](_0x27d241),_0x1e908e[_0x26eee3(0x204)](_0x27d241);}};for(const _0x4e515c of _0x49c789){try{const _0x16462f=yamlKnowledgeBaseToApi(_0x4e515c[_0x431060(0x19b)],_0x493973),_0x53f68c=await this['client'][_0x431060(0x284)](_0x16462f);_0x14b0f1[_0x431060(0x274)](_0x4e515c[_0x431060(0x19b)][_0x431060(0x1c3)],_0x53f68c['id']),_0x2e9672[_0x431060(0x1fc)]['push']({'name':_0x4e515c[_0x431060(0x19b)]['name'],'action':_0x431060(0x27a),'id':_0x53f68c['id']}),_0x2e9672[_0x431060(0x1f1)]['knowledgeBases'][_0x431060(0x27a)]++;}catch(_0x39c09e){_0x2e9672[_0x431060(0x1fc)][_0x431060(0x204)]({'name':_0x4e515c[_0x431060(0x19b)][_0x431060(0x1c3)],'action':'error','error':_0x39c09e['message']}),_0x2e9672[_0x431060(0x1f1)][_0x431060(0x1fc)][_0x431060(0x1e6)]++;}}for(const _0x6a1d6d of _0x43b769){try{const _0x4987bd=yamlTextKnowledgeBaseToApi({'name':_0x6a1d6d[_0x431060(0x1c3)],'text':_0x6a1d6d[_0x431060(0x27b)]},_0x493973),_0x1f4950=await this[_0x431060(0x195)][_0x431060(0x272)](_0x4987bd);_0x3b6227[_0x431060(0x274)](_0x6a1d6d['name'],_0x1f4950['id']),_0x2e9672['textKnowledgeBases'][_0x431060(0x204)]({'name':_0x6a1d6d[_0x431060(0x1c3)],'action':_0x431060(0x27a),'id':_0x1f4950['id']}),_0x2e9672['counts'][_0x431060(0x185)][_0x431060(0x27a)]++;}catch(_0x235cf7){_0x2e9672['textKnowledgeBases'][_0x431060(0x204)]({'name':_0x6a1d6d['name'],'action':_0x431060(0x205),'error':_0x235cf7[_0x431060(0x187)]}),_0x2e9672['counts'][_0x431060(0x185)][_0x431060(0x1e6)]++;}}for(const _0x39e2f9 of _0x5f4aba){try{const _0xee8bc8=yamlExperimentalArtifactToApi(_0x39e2f9['def'],_0x493973),_0x66d6b9=await this[_0x431060(0x195)][_0x431060(0x29a)](_0xee8bc8);_0x2957af[_0x431060(0x274)](_0x39e2f9[_0x431060(0x1b0)][_0x431060(0x1c3)],_0x66d6b9['id']),_0x2e9672['experimentalArtifacts'][_0x431060(0x204)]({'name':_0x39e2f9[_0x431060(0x1b0)][_0x431060(0x1c3)],'action':_0x431060(0x27a),'id':_0x66d6b9['id']}),_0x2e9672[_0x431060(0x1f1)][_0x431060(0x1ba)]['created']++;}catch(_0x1b2a8d){_0x2e9672[_0x431060(0x1ba)]['push']({'name':_0x39e2f9[_0x431060(0x1b0)][_0x431060(0x1c3)],'action':_0x431060(0x205),'error':_0x1b2a8d[_0x431060(0x187)]}),_0x2e9672[_0x431060(0x1f1)]['experimentalArtifacts'][_0x431060(0x1e6)]++;}}for(const _0x1e8a0a of _0x1e46f1){try{const _0x513a3c=yamlExperimentalKnowledgeBaseToApi(_0x1e8a0a[_0x431060(0x1b0)],_0x493973),_0x3431ec=await this['client'][_0x431060(0x21c)](_0x513a3c);_0x17e44e['set'](_0x1e8a0a['def']['name'],_0x3431ec['id']),_0x2e9672['experimentalKnowledgeBases']['push']({'name':_0x1e8a0a[_0x431060(0x1b0)]['name'],'action':_0x431060(0x27a),'id':_0x3431ec['id']}),_0x2e9672[_0x431060(0x1f1)][_0x431060(0x276)][_0x431060(0x27a)]++;}catch(_0x13002b){_0x2e9672[_0x431060(0x276)][_0x431060(0x204)]({'name':_0x1e8a0a[_0x431060(0x1b0)]['name'],'action':_0x431060(0x205),'error':_0x13002b[_0x431060(0x187)]}),_0x2e9672['counts'][_0x431060(0x276)][_0x431060(0x1e6)]++;}}const _0x15b988=[..._0x1227b0][_0x431060(0x223)]((_0x321351,_0x27fee1)=>{const _0x1c99f1=_0x431060,_0x5d2022=_0x321351[_0x1c99f1(0x19b)][_0x1c99f1(0x1b3)]?.['some'](_0x120b5d=>_0x120b5d[_0x1c99f1(0x1c1)]==='agent')??![],_0x2bb41f=_0x27fee1[_0x1c99f1(0x19b)][_0x1c99f1(0x1b3)]?.[_0x1c99f1(0x20a)](_0x57ae22=>_0x57ae22['type']===_0x1c99f1(0x1e7))??![];if(_0x5d2022&&!_0x2bb41f)return 0x1;if(!_0x5d2022&&_0x2bb41f)return-0x1;return 0x0;});for(const _0x3bc19e of _0x15b988){_0x1e908e=[];try{const _0x430d4c=_0x3bc19e['yaml'][_0x431060(0x1b3)]?.[_0x431060(0x1ab)](_0x13eaf6=>{const _0x239ecd=_0x431060;if(_0x13eaf6[_0x239ecd(0x1c1)]==='agent'&&_0x13eaf6['target']){const _0x255b4d=parseRef(_0x13eaf6[_0x239ecd(0x2a5)]);return _0x255b4d?.[_0x239ecd(0x1c3)]===_0x3bc19e[_0x239ecd(0x19b)]['name'];}return![];})??[];if(_0x430d4c[_0x431060(0x20d)]>0x0){const _0x867d41='Agent\x20\x27'+_0x3bc19e[_0x431060(0x19b)][_0x431060(0x1c3)]+_0x431060(0x22f)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this[_0x431060(0x18b)]['warn'](_0x867d41),_0x1e908e[_0x431060(0x204)](_0x867d41);}const _0x51b95a=await agentDefToRequest(_0x3bc19e['yaml'],_0x3bc19e[_0x431060(0x219)],_0x3bc19e[_0x431060(0x18f)],_0x56ec0d),_0x760bb4=await this[_0x431060(0x195)][_0x431060(0x189)](_0x51b95a);_0x18cb53['set'](_0x3bc19e[_0x431060(0x19b)][_0x431060(0x1c3)],_0x760bb4['id']),_0x2e9672['agents'][_0x431060(0x204)]({'agentName':_0x3bc19e[_0x431060(0x19b)][_0x431060(0x1c3)],'action':_0x431060(0x27a),'agentId':_0x760bb4['id'],'warnings':_0x1e908e['length']>0x0?_0x1e908e:undefined}),_0x2e9672[_0x431060(0x1f1)][_0x431060(0x1df)][_0x431060(0x27a)]++;}catch(_0x1472d8){_0x2e9672[_0x431060(0x1df)]['push']({'agentName':_0x3bc19e[_0x431060(0x19b)]['name'],'action':'error','error':_0x1472d8[_0x431060(0x187)],'warnings':_0x1e908e['length']>0x0?_0x1e908e:undefined}),_0x2e9672[_0x431060(0x1f1)][_0x431060(0x1df)][_0x431060(0x1e6)]++;}}for(const _0x797946 of _0x3379e9){try{const _0xb9cba4=await yamlPromptToApi(_0x797946[_0x431060(0x19b)],_0x493973,_0x56ec0d);if(!_0xb9cba4){_0x2e9672['prompts'][_0x431060(0x204)]({'name':_0x797946['yaml'][_0x431060(0x1c3)],'action':'error','error':_0x431060(0x19a)}),_0x2e9672[_0x431060(0x1f1)][_0x431060(0x1ec)][_0x431060(0x1e6)]++;continue;}const _0x49b572=await this[_0x431060(0x195)]['createPrompt'](_0xb9cba4);_0x2e8ddc[_0x431060(0x274)](_0x797946[_0x431060(0x19b)][_0x431060(0x1c3)],_0x49b572['id']),_0x2e9672[_0x431060(0x1ec)]['push']({'name':_0x797946['yaml'][_0x431060(0x1c3)],'action':'created','id':_0x49b572['id']}),_0x2e9672[_0x431060(0x1f1)][_0x431060(0x1ec)][_0x431060(0x27a)]++;}catch(_0x928bf6){_0x2e9672[_0x431060(0x1ec)][_0x431060(0x204)]({'name':_0x797946[_0x431060(0x19b)][_0x431060(0x1c3)],'action':'error','error':_0x928bf6[_0x431060(0x187)]}),_0x2e9672[_0x431060(0x1f1)][_0x431060(0x1ec)]['errors']++;}}for(const _0x85f0d5 of _0x2e21da){try{const _0x57983c=await yamlIntegrationToApi(_0x85f0d5[_0x431060(0x19b)],_0x493973,_0x56ec0d),_0x218e18=await this[_0x431060(0x195)][_0x431060(0x19d)](_0x57983c);_0x2e9672[_0x431060(0x256)][_0x431060(0x204)]({'name':_0x85f0d5[_0x431060(0x19b)][_0x431060(0x1ae)],'action':'created','id':_0x218e18['id']}),_0x2e9672[_0x431060(0x1f1)]['integrations'][_0x431060(0x27a)]++;}catch(_0x29213c){_0x2e9672[_0x431060(0x256)]['push']({'name':_0x85f0d5[_0x431060(0x19b)][_0x431060(0x1ae)],'action':_0x431060(0x205),'error':_0x29213c['message']}),_0x2e9672[_0x431060(0x1f1)]['integrations'][_0x431060(0x1e6)]++;}}for(const _0x1ecd3e of _0x2ae90e){try{const _0x5c4793=await yamlFormInterfaceToApi(_0x1ecd3e[_0x431060(0x19b)],_0x493973,_0x56ec0d);if(!_0x5c4793){_0x2e9672[_0x431060(0x1ad)][_0x431060(0x204)]({'name':_0x1ecd3e['yaml']['name'],'action':'error','error':_0x431060(0x22b)}),_0x2e9672['counts'][_0x431060(0x1ad)][_0x431060(0x1e6)]++;continue;}const _0x35d544=await this[_0x431060(0x195)][_0x431060(0x1f7)](_0x5c4793);_0x2e9672[_0x431060(0x1ad)][_0x431060(0x204)]({'name':_0x1ecd3e['yaml'][_0x431060(0x1c3)],'action':_0x431060(0x27a),'id':_0x35d544['id']}),_0x2e9672[_0x431060(0x1f1)]['formInterfaces'][_0x431060(0x27a)]++;}catch(_0x9db72c){_0x2e9672[_0x431060(0x1ad)][_0x431060(0x204)]({'name':_0x1ecd3e[_0x431060(0x19b)][_0x431060(0x1c3)],'action':'error','error':_0x9db72c[_0x431060(0x187)]}),_0x2e9672[_0x431060(0x1f1)][_0x431060(0x1ad)][_0x431060(0x1e6)]++;}}for(const _0x3a82ea of _0x1374c3){try{const _0x3b261c=await yamlChatInterfaceToApi(_0x3a82ea[_0x431060(0x19b)],_0x493973,_0x56ec0d),_0x301c88=await this[_0x431060(0x195)][_0x431060(0x188)](_0x3b261c);_0x2e9672[_0x431060(0x1be)][_0x431060(0x204)]({'name':_0x3a82ea[_0x431060(0x19b)][_0x431060(0x1c3)],'action':_0x431060(0x27a),'id':_0x301c88['id']}),_0x2e9672[_0x431060(0x1f1)]['chatInterfaces'][_0x431060(0x27a)]++;}catch(_0x1f3a40){_0x2e9672[_0x431060(0x1be)][_0x431060(0x204)]({'name':_0x3a82ea[_0x431060(0x19b)]['name'],'action':_0x431060(0x205),'error':_0x1f3a40['message']}),_0x2e9672[_0x431060(0x1f1)][_0x431060(0x1be)][_0x431060(0x1e6)]++;}}return _0x2e9672;}}
1
+ const a138_0x262c49=a138_0x90ab;(function(_0x2bb8f0,_0x56f5e1){const _0xf7fa8b=a138_0x90ab,_0x3a164c=_0x2bb8f0();while(!![]){try{const _0x1d7a83=-parseInt(_0xf7fa8b(0x17a))/0x1+parseInt(_0xf7fa8b(0x1b2))/0x2*(-parseInt(_0xf7fa8b(0x1c7))/0x3)+parseInt(_0xf7fa8b(0x196))/0x4+parseInt(_0xf7fa8b(0x21e))/0x5*(-parseInt(_0xf7fa8b(0x21c))/0x6)+-parseInt(_0xf7fa8b(0x15e))/0x7+-parseInt(_0xf7fa8b(0x155))/0x8*(-parseInt(_0xf7fa8b(0x1c9))/0x9)+-parseInt(_0xf7fa8b(0x191))/0xa*(-parseInt(_0xf7fa8b(0x1c2))/0xb);if(_0x1d7a83===_0x56f5e1)break;else _0x3a164c['push'](_0x3a164c['shift']());}catch(_0x1f8bc1){_0x3a164c['push'](_0x3a164c['shift']());}}}(a138_0x160e,0x9d02a));import{LLMApiClient}from'../client/llm-api-client.js';import*as a138_0x406b9a from'node:fs';import*as a138_0x3662d8 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';function a138_0x90ab(_0x11da91,_0x61b681){_0x11da91=_0x11da91-0xf6;const _0x160e45=a138_0x160e();let _0x90aba=_0x160e45[_0x11da91];return _0x90aba;}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';function a138_0x160e(){const _0x22eba3=['content','experimental_knowledge_bases','listImageGenerators','files','nameToId','unchanged','history','updatePrompt','.llm','metadata','chats','LLM_PROJECT_NOT_FOUND','prompts.json','modelType','listPrompts','Renamed\x20KB\x20file:\x20','readFileSync','chatInterfaces','size','endsWith','UNAUTHENTICATED','agent.yml','INTERNAL','knowledgeBases','chat_generic','---\x20schema:\x20','.yml','counts','unlinkSync','listTextKnowledgeBases','integrations','filter','updateFormInterface','listChatInterfaces','textKnowledgeBases','Renamed\x20integration\x20file:\x20','conflict','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','agents.json','Removed\x20deleted\x20directory:\x20','448nWOcEg','Only\x20safe\x20types\x20(','Backup\x20folder\x20not\x20found:\x20','sort','includes','text_content','resolveAgentId','listAgents','restoreProject','1795941BRtKUJ','site','1.0','parse','claude-4.5-sonnet','createExperimentalKnowledgeBase','backupProject','listFormInterfaces','none','pullProject','isDir','imageGenerators','Unsupported\x20backup\x20version:\x20','loadJsonFile','chatInfo','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','errors','writeFileSync','Renamed\x20prompt\x20file:\x20','webhookCorsOrigins','Project\x20not\x20found:\x20','setDefaultAgent','ALREADY_EXISTS','localeCompare','listIntegrations','pullAgent','Output\x20directory\x20already\x20exists:\x20','starter_message','369032ecwHAk','get','getOrCreateDefaultAgent','map','version','tdx.json','tables','temperature','basename','Renamed\x20chat\x20interface\x20file:\x20','getProject',')\x20can\x20be\x20cloned.','medium','readdirSync','Renamed\x20agent\x20folder:\x20','getAgent','NOT_FOUND','variables','webSearchTools','already\x20exists','createAgentResponse','description','#\x20prompt.md\x0a','14900710ZGPHrh','isManaged','updateExperimentalKnowledgeBase','message','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','2768352spNMwf','_reasoning_','starterMessage','dryRun','createTextKnowledgeBase','getChatInfo','ExperimentalKnowledgeBase','models','listKnowledgeBases','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','createFormInterface','createKnowledgeBase','deleteProject','form_interfaces','chat_agent_console','status','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','\x20attempts\x20due\x20to\x20name\x20conflicts.','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','toLowerCase','push','yaml','Invalid\x20agent\x20reference\x20format:\x20','experimentalArtifacts','knowledgebases.json','created','Renamed\x20form\x20interface\x20file:\x20','chat_interfaces','2TAJxcL','Agent\x20not\x20found:\x20','dry-run-','\x0a---\x20code\x20---\x0a','getBackupMetadata','llm_project','\x22\x20already\x20exists','agentId','systemPrompt','resolveProjectName','):\x20','maxToolIterations','text','keys','\x27\x20(','tdx_','11iENzbu','Multiple\x20agents\x20found\x20with\x20name\x20\x27','listExperimentalKnowledgeBases','pushProject','project.json','1300137ZfvKiL','json_schema','84654iMHbUN','TextKnowledgeBase','deleteAgent','tools','serviceType','actions','Renamed\x20text\x20KB\x20file:\x20','KnowledgeBase','total','isDirectory','utf-8','client','continueChat','updateExperimentalArtifact','low','\x20---\x0a','exportedFrom','updateAgent','updated','experimentalKnowledgeBases','\x0a\x0a#\x20agent.yml\x0a','service_type','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','\x0a---\x20schema:\x20','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','integrations.json','jsonSchemaHint','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','attributes','createPrompt','oldPath','deleteIntegration','agent','length','getDefaultProjectName','mkdirSync','startChat','createAgent','dir','projects','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','path','profile','getCurrentProject','tdx_default_','name','logger','chat_parent_segment','createProject','json_schema.json','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','setCurrentProject','listWebSearchTools','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','formInterfaces','web_search','listProjects','split','dirname','code','find','knowledge_bases','experimental_artifacts','Project\x20\x22','Renamed\x20folder:\x20','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','---\x20file:\x20','existsSync','code.js','error','rmSync','info','Agent\x20reference\x20not\x20found','statSync','listChats','context','slackMessageMode','listToolTargets','Unable\x20to\x20create\x20project\x20after\x20','Renamed\x20experimental\x20KB\x20directory:\x20','chatIgnoreManagedActions','renamed','6040842ffHkHn','Skipping\x20integration\x20\x27','5fraijC','target','AGENT_NOT_FOUND','sdk.llm','pushAgent','\x27.\x20This\x20should\x20not\x20happen.','resolveProjectId','prompt.md','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','idToName','newProjectId','prompts','new','signal','currentProjectId','getOrCreateDefaultProject','.md','\x20→\x20','file_name','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','reasoningEffort','createIntegration','listAgentsFull','Available\x20agents:\x20','has','agent.yml\x20not\x20found\x20in\x20','Multiple\x20projects\x20found\x20with\x20name\x20\x27','getUserSettings','toISOString','Unresolved\x20dependencies:\x20','set','some','createChatInterface','stringify','getChatLog','listExperimentalArtifacts','def','isFile','join','starter_message.md','updateAgentResponse','add','chat','clearDefaultAgent','functions','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','action','INVALID_ARGUMENT','type','agents','cwd','createExperimentalArtifact','\x0a---\x20function:\x20','updateKnowledgeBase','warn','chatWelcomeMessage','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'];a138_0x160e=function(){return _0x22eba3;};return a138_0x160e();}import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a138_0x262c49(0x145),a138_0x262c49(0x1a4),a138_0x262c49(0x1f9)];async function safeListOrEmpty(_0x3f2e81){const _0x507173=a138_0x262c49;try{return await _0x3f2e81();}catch(_0x5948ba){if(_0x5948ba instanceof HTTPClientError&&_0x5948ba[_0x507173(0x1a5)]===0x194)return[];throw _0x5948ba;}}export class LLMSDK{[a138_0x262c49(0x102)];['client'];['context'];[a138_0x262c49(0x1f8)]=Logger['of'](a138_0x262c49(0xf7));constructor(_0x2ec58f){const _0x2860e7=a138_0x262c49;this[_0x2860e7(0x1d4)]=new LLMApiClient(_0x2ec58f),this['context']=_0x2ec58f;}[a138_0x262c49(0x1ec)](){const _0x4d9b60=a138_0x262c49,_0x2a9728=getSanitizedUsername();return _0x4d9b60(0x1f6)+_0x2a9728;}async[a138_0x262c49(0x1fd)](_0x91642c){const _0x554dc3=a138_0x262c49,{projectId:_0x5375cd}=await this[_0x554dc3(0x1bb)](_0x91642c);this[_0x554dc3(0x102)]=_0x5375cd;}[a138_0x262c49(0x1f5)](){const _0x432415=a138_0x262c49;return this[_0x432415(0x102)];}async[a138_0x262c49(0x173)](_0x305e0c){const _0x4b21b9=a138_0x262c49,_0x1bc0ad=this[_0x4b21b9(0x215)][_0x4b21b9(0x1f4)];let _0x5e4488,_0x5c4f20;if(_0x305e0c['includes']('/')){const _0x2ac7d7=_0x305e0c[_0x4b21b9(0x203)]('/');if(_0x2ac7d7[_0x4b21b9(0x1eb)]!==0x2)throw new SDKError(ErrorCode[_0x4b21b9(0x123)],_0x4b21b9(0x1ac)+_0x305e0c,undefined,{'helpText':_0x4b21b9(0x195)});const [_0x2ff304,_0x2d295b]=_0x2ac7d7;_0x5e4488=await this[_0x4b21b9(0xfa)](_0x2ff304),_0x5c4f20=_0x2d295b;}else _0x5e4488=this['currentProjectId']||(await this[_0x4b21b9(0x103)]())['id'],_0x5c4f20=_0x305e0c;const _0x55dcdf=await this[_0x4b21b9(0x15b)](_0x5c4f20,_0x5e4488),_0x13ed23=await this[_0x4b21b9(0x1d4)][_0x4b21b9(0x189)](_0x55dcdf);writeCachedLLMAgent(_0x13ed23[_0x4b21b9(0x1e6)]['name'],_0x55dcdf,_0x5e4488,_0x1bc0ad);}['getDefaultAgent'](){const _0x152651=a138_0x262c49,_0x3da618=this[_0x152651(0x215)]['profile'];return readCachedLLMAgent(_0x3da618)||undefined;}[a138_0x262c49(0x11f)](){const _0x50d697=a138_0x262c49,_0x59f8e1=this[_0x50d697(0x215)]['profile'];clearCachedLLMAgent(_0x59f8e1);}async[a138_0x262c49(0x19d)](){const _0x310e29=a138_0x262c49,_0xc5d969=await this[_0x310e29(0x1d4)][_0x310e29(0x10f)]();return toModelInfos(_0xc5d969);}async[a138_0x262c49(0x1fa)](_0xee7fd){const _0x490950=a138_0x262c49;return await this[_0x490950(0x1d4)][_0x490950(0x1fa)](_0xee7fd);}async[a138_0x262c49(0x1a2)](_0xcc00ad){const _0x5d8805=a138_0x262c49,{projectId:_0xb29db6}=await this['resolveProjectName'](_0xcc00ad);await this[_0x5d8805(0x1d4)]['deleteProject'](_0xb29db6);}async[a138_0x262c49(0x1f1)](_0xcc097c=0x32){const _0x461c0e=a138_0x262c49;return await this[_0x461c0e(0x1d4)]['listProjects'](_0xcc097c);}async[a138_0x262c49(0x103)](_0x513551){const _0x1c7244=a138_0x262c49,_0x40f8f7=_0x513551||this['getDefaultProjectName'](),_0x43b403=this['context'][_0x1c7244(0x1f4)];if(!_0x513551){const _0x5d9b57=readCachedLLMProject(_0x43b403);if(_0x5d9b57&&_0x5d9b57[_0x1c7244(0x1f7)]===_0x40f8f7)try{const _0x4b4cb9=await this[_0x1c7244(0x1d4)][_0x1c7244(0x184)](_0x5d9b57['id']);if(_0x4b4cb9['attributes']['name']===_0x40f8f7)return _0x4b4cb9;}catch{}}const _0x2a9a35=await this[_0x1c7244(0x1d4)][_0x1c7244(0x202)](),_0x46c2d8=_0x2a9a35['find'](_0x4fb528=>_0x4fb528[_0x1c7244(0x1e6)]['name']===_0x40f8f7);if(_0x46c2d8)return!_0x513551&&writeCachedLLMProject(_0x40f8f7,_0x46c2d8['id'],_0x43b403),_0x46c2d8;const _0x5d5578=await this[_0x1c7244(0x1d4)][_0x1c7244(0x1fa)]({'name':_0x40f8f7,'description':_0x1c7244(0x1e5)+getSanitizedUsername()+')'});return!_0x513551&&writeCachedLLMProject(_0x40f8f7,_0x5d5578['id'],_0x43b403),_0x5d5578;}async[a138_0x262c49(0xfa)](_0x3580d0){const _0xd549f=a138_0x262c49,_0x26e649=await this[_0xd549f(0x1d4)]['listProjects'](),_0x33337f=_0x26e649[_0xd549f(0x14c)](_0x27bcfb=>_0x27bcfb['attributes'][_0xd549f(0x1f7)]===_0x3580d0);if(_0x33337f[_0xd549f(0x1eb)]===0x0)throw new SDKError(ErrorCode[_0xd549f(0x138)],_0xd549f(0x172)+_0x3580d0,undefined,{'helpText':_0xd549f(0x12c)});if(_0x33337f['length']>0x1)throw new SDKError(ErrorCode[_0xd549f(0x143)],_0xd549f(0x10e)+_0x3580d0+_0xd549f(0xf9));return _0x33337f[0x0]['id'];}async[a138_0x262c49(0x1bb)](_0x413ce2){const _0x2653e1=a138_0x262c49,_0x158123=await this[_0x2653e1(0x1d4)]['listProjects'](),_0x7bf9f3=_0x158123[_0x2653e1(0x206)](_0x37c938=>_0x37c938[_0x2653e1(0x1e6)][_0x2653e1(0x1f7)]===_0x413ce2);if(_0x7bf9f3)return{'projectId':_0x7bf9f3['id'],'project':_0x7bf9f3};throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x2653e1(0x172)+_0x413ce2,undefined,{'helpText':_0x2653e1(0x12c)});}async[a138_0x262c49(0x17c)](_0x1e9e9b=a138_0x262c49(0x162),_0x358ec6=0x0,_0xa059cf){const _0x153754=a138_0x262c49,_0x4ef987=0xa;let _0x2b6051=0x0,_0x3f0526;while(_0x2b6051<_0x4ef987){try{const _0x307d71=await this[_0x153754(0x103)](_0x3f0526),_0x3d4365=_0x307d71['id'],_0x4d1765=[_0x153754(0x166),'minimal',_0x153754(0x1d7),_0x153754(0x186),'high'],_0x369dc5=_0x358ec6===0x0?_0x153754(0x1c1)+_0x1e9e9b:_0x153754(0x1c1)+_0x1e9e9b+_0x153754(0x197)+_0x4d1765[_0x358ec6],_0x1c0ab0=await this[_0x153754(0x1d4)][_0x153754(0x15c)](_0x3d4365),_0xebef81=_0x1c0ab0[_0x153754(0x206)](_0x19e658=>_0x19e658['attributes'][_0x153754(0x1f7)]===_0x369dc5);if(_0xebef81)return _0xebef81;const _0x5cd822=_0x358ec6>0x0?0x1:_0xa059cf;return await this[_0x153754(0x1d4)][_0x153754(0x1ef)]({'name':_0x369dc5,'projectId':_0x3d4365,'modelType':_0x1e9e9b,'systemPrompt':'','temperature':_0x5cd822,'reasoningEffort':_0x358ec6>0x0?_0x358ec6:undefined});}catch(_0x4acb47){if(_0x4acb47 instanceof HTTPClientError){const _0x472c4b=_0x4acb47[_0x153754(0x1a5)];if(_0x472c4b>=0x190&&_0x472c4b<0x1f4){if(_0x472c4b===0x191)throw new SDKError(ErrorCode[_0x153754(0x141)],_0x153754(0x1df),_0x4acb47);else{if(_0x472c4b===0x193)throw new SDKError(ErrorCode['PERMISSION_DENIED'],_0x153754(0x20b),_0x4acb47);}throw _0x4acb47;}}if(errorContains(_0x4acb47,_0x153754(0x18d),'duplicate',_0x153754(0x151))){_0x2b6051++;if(_0x2b6051>=_0x4ef987)throw new SDKError(ErrorCode[_0x153754(0x174)],_0x153754(0x218)+_0x4ef987+_0x153754(0x1a7),_0x4acb47);const _0x54e0e2=this[_0x153754(0x1ec)]();_0x3f0526=_0x54e0e2+'_'+generateRandomHex();continue;}throw _0x4acb47;}}throw new SDKError(ErrorCode[_0x153754(0x143)],_0x153754(0x16d));}async[a138_0x262c49(0x15b)](_0x9fab91,_0x3cda3e){const _0x38023f=a138_0x262c49,_0x150842=_0x3cda3e||this['currentProjectId'],_0x4d16fc=await this['client'][_0x38023f(0x15c)](_0x150842),_0xaeaa7c=_0x4d16fc[_0x38023f(0x14c)](_0x1fd2c5=>_0x1fd2c5['attributes'][_0x38023f(0x1f7)]===_0x9fab91);if(_0xaeaa7c[_0x38023f(0x1eb)]===0x0){const _0xa0e2b7=_0x150842?'\x20in\x20project\x20'+_0x150842:'';throw new SDKError(ErrorCode[_0x38023f(0xf6)],_0x38023f(0x1b3)+_0x9fab91+_0xa0e2b7,undefined,{'helpText':_0x150842?'Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.':'Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.'});}if(_0xaeaa7c['length']>0x1)throw new SDKError(ErrorCode[_0x38023f(0x143)],_0x38023f(0x1c3)+_0x9fab91+_0x38023f(0xf9));return _0xaeaa7c[0x0]['id'];}async['agents'](_0x42d145){const _0xa7a035=a138_0x262c49,_0x320056=_0x42d145||this[_0xa7a035(0x102)];return await this[_0xa7a035(0x1d4)][_0xa7a035(0x15c)](_0x320056);}async['agentsFull'](_0x323c40){const _0x110d93=a138_0x262c49;return await this[_0x110d93(0x1d4)]['listAgentsFull'](_0x323c40);}async['agent'](_0x47cc0b){const _0x27c26e=a138_0x262c49;return await this[_0x27c26e(0x1d4)][_0x27c26e(0x189)](_0x47cc0b);}async['createAgent'](_0x1ff7b1){const _0x5911f4=a138_0x262c49;return await this[_0x5911f4(0x1d4)][_0x5911f4(0x1ef)](_0x1ff7b1);}async['updateAgent'](_0x33e776,_0x16915f){const _0x315516=a138_0x262c49;return await this[_0x315516(0x1d4)][_0x315516(0x1da)](_0x33e776,_0x16915f);}async[a138_0x262c49(0x1cb)](_0x1bcf68){const _0x593455=a138_0x262c49;await this[_0x593455(0x1d4)][_0x593455(0x1cb)](_0x1bcf68);}async[a138_0x262c49(0x1ee)](_0x1ae7ce){const _0x441bbc=a138_0x262c49;return await this[_0x441bbc(0x1d4)][_0x441bbc(0x1ee)]({'agentId':_0x1ae7ce});}async*[a138_0x262c49(0x11e)](_0x44cda5,_0x3fb5c4){const _0x11f6c7=a138_0x262c49;let _0x2c2235=_0x3fb5c4?.['chatId'];const _0x545f9f=_0x3fb5c4?.[_0x11f6c7(0x1b9)];if(!_0x2c2235){if(!_0x545f9f)throw new Error(_0x11f6c7(0x1a8));const _0xa14403=await this[_0x11f6c7(0x1d4)][_0x11f6c7(0x1ee)]({'agentId':_0x545f9f});_0x2c2235=_0xa14403['id'],yield{'type':_0x11f6c7(0x136),'data':{'chatId':_0x2c2235,'agentId':_0x545f9f,'projectId':_0xa14403[_0x11f6c7(0x1e6)]['projectId']}};}for await(const _0x269c5e of this['client'][_0x11f6c7(0x1d5)](_0x2c2235,_0x44cda5,_0x3fb5c4?.[_0x11f6c7(0x101)])){yield{'type':'event','data':_0x269c5e};}}async[a138_0x262c49(0x137)](_0xa37b7a=0x32){const _0x130ae2=a138_0x262c49;return await this[_0x130ae2(0x1d4)][_0x130ae2(0x214)](_0xa37b7a);}async[a138_0x262c49(0x133)](_0x56bc72){const _0x4a0490=a138_0x262c49;return await this[_0x4a0490(0x1d4)]['getChatHistory'](_0x56bc72);}async[a138_0x262c49(0x116)](_0x1de41c){const _0x36e51e=a138_0x262c49;return await this[_0x36e51e(0x1d4)][_0x36e51e(0x116)](_0x1de41c);}async[a138_0x262c49(0x16c)](_0x81bf8b){const _0x16ef01=a138_0x262c49;return await this['client'][_0x16ef01(0x19b)](_0x81bf8b);}async[a138_0x262c49(0x164)](_0x32b75f,_0x40aca8,_0x3016af){const _0x93b1cc=a138_0x262c49,_0x54fa17=_0x3016af?.[_0x93b1cc(0x199)]??![],{projectId:_0x18bf7c,project:_0x4af900}=await this[_0x93b1cc(0x1bb)](_0x32b75f),_0x514c93=_0x4af900[_0x93b1cc(0x1e6)][_0x93b1cc(0x1f7)],_0x4abee7=_0x40aca8||_0x514c93+_0x93b1cc(0x135);if(a138_0x406b9a[_0x93b1cc(0x20d)](_0x4abee7)&&!_0x54fa17)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x93b1cc(0x178)+_0x4abee7,undefined,{'helpText':_0x93b1cc(0x121)});const _0xd2bb46=await this[_0x93b1cc(0x1d4)][_0x93b1cc(0x10a)](_0x18bf7c),_0x4cd437=await this['client'][_0x93b1cc(0x19e)](_0x18bf7c),_0x528ce3=await this['client']['listPrompts'](_0x18bf7c),_0x5513fb=await this[_0x93b1cc(0x1d4)][_0x93b1cc(0x176)](_0x18bf7c);if(!_0x54fa17){a138_0x406b9a[_0x93b1cc(0x1ed)](_0x4abee7,{'recursive':!![]});const _0x2c576f={'version':_0x93b1cc(0x160),'exportedAt':new Date()[_0x93b1cc(0x110)](),'exportedFrom':{'site':this[_0x93b1cc(0x215)][_0x93b1cc(0x15f)],'projectId':_0x18bf7c,'projectName':_0x514c93},'project':_0x4af900};a138_0x406b9a['writeFileSync'](a138_0x3662d8[_0x93b1cc(0x11a)](_0x4abee7,_0x93b1cc(0x1c6)),JSON['stringify'](_0x2c576f,null,0x2)),a138_0x406b9a[_0x93b1cc(0x16f)](a138_0x3662d8[_0x93b1cc(0x11a)](_0x4abee7,'agents.json'),JSON['stringify'](_0xd2bb46,null,0x2)),a138_0x406b9a[_0x93b1cc(0x16f)](a138_0x3662d8[_0x93b1cc(0x11a)](_0x4abee7,_0x93b1cc(0x1ae)),JSON[_0x93b1cc(0x115)](_0x4cd437,null,0x2)),a138_0x406b9a[_0x93b1cc(0x16f)](a138_0x3662d8[_0x93b1cc(0x11a)](_0x4abee7,'prompts.json'),JSON[_0x93b1cc(0x115)](_0x528ce3,null,0x2)),a138_0x406b9a[_0x93b1cc(0x16f)](a138_0x3662d8[_0x93b1cc(0x11a)](_0x4abee7,_0x93b1cc(0x1e3)),JSON[_0x93b1cc(0x115)](_0x5513fb,null,0x2));}return{'projectName':_0x514c93,'outputDir':_0x4abee7,'counts':{'agents':_0xd2bb46[_0x93b1cc(0x1eb)],'knowledgeBases':_0x4cd437[_0x93b1cc(0x1eb)],'prompts':_0x528ce3[_0x93b1cc(0x1eb)],'integrations':_0x5513fb[_0x93b1cc(0x1eb)]}};}async[a138_0x262c49(0x15d)](_0x54a32c,_0x3c7808){const _0x477cca=a138_0x262c49,_0x3f9866=_0x3c7808?.[_0x477cca(0x199)]??![],_0x579f70=this[_0x477cca(0x1b6)](_0x54a32c),_0x10919d=_0x579f70['exportedFrom'][_0x477cca(0x15f)],_0x5eee95=this[_0x477cca(0x215)]['site'],_0xb33a83=_0x10919d!==_0x5eee95?_0x10919d:undefined,_0xb46437=this[_0x477cca(0x16b)](a138_0x3662d8['join'](_0x54a32c,_0x477cca(0x153)),[]),_0x447cec=this['loadJsonFile'](a138_0x3662d8[_0x477cca(0x11a)](_0x54a32c,'knowledgebases.json'),[]),_0x3ef58e=this[_0x477cca(0x16b)](a138_0x3662d8[_0x477cca(0x11a)](_0x54a32c,_0x477cca(0x139)),[]),_0x310262=this[_0x477cca(0x16b)](a138_0x3662d8['join'](_0x54a32c,'integrations.json'),[]),_0x5e045c=_0x3c7808?.[_0x477cca(0x1f7)]||_0x579f70[_0x477cca(0x1d9)]['projectName'];if(_0x3f9866){const _0x534650=new Map(),_0x5e2377=[..._0xb46437],_0x598500=_0xb46437[_0x477cca(0x1eb)]+0x1;let _0x1f4370=0x0;while(_0x5e2377[_0x477cca(0x1eb)]>0x0&&_0x1f4370<_0x598500){_0x1f4370++;const _0x5d9f64=[];for(const _0x358936 of _0x5e2377){canCreateAgent(_0x358936,_0x534650)?_0x534650[_0x477cca(0x112)](_0x358936['id'],_0x477cca(0x1b4)+_0x358936['id']):_0x5d9f64[_0x477cca(0x1aa)](_0x358936);}if(_0x5d9f64['length']===_0x5e2377[_0x477cca(0x1eb)])throw new SDKError(ErrorCode[_0x477cca(0x143)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x5e2377['length']=0x0,_0x5e2377['push'](..._0x5d9f64);}const _0x2a7721=_0x3ef58e['filter'](_0x4ff305=>_0x534650[_0x477cca(0x10c)](_0x4ff305[_0x477cca(0x1e6)][_0x477cca(0x1b9)]))[_0x477cca(0x1eb)];return{'projectName':_0x5e045c,'projectId':'(dry-run)','counts':{'agents':_0xb46437[_0x477cca(0x1eb)],'knowledgeBases':_0x447cec[_0x477cca(0x1eb)],'prompts':_0x2a7721,'integrations':_0x310262['length']},'sourceSite':_0xb33a83};}const _0x2d10c9=await this[_0x477cca(0x1d4)]['createProject']({'name':_0x5e045c,'description':_0x579f70['project'][_0x477cca(0x1e6)][_0x477cca(0x18f)]}),_0x321374=_0x2d10c9['id'],_0x55347f=new Map(),_0x125342=new Map(),_0x26a34f=new Map();for(const _0xfe7f6 of _0x447cec){const _0x4e6f74=await this[_0x477cca(0x1d4)][_0x477cca(0x1a1)]({'projectId':_0x321374,'name':_0xfe7f6[_0x477cca(0x1e6)][_0x477cca(0x1f7)],'tdDatabaseName':_0xfe7f6[_0x477cca(0x1e6)]['tdDatabaseName'],'tables':_0xfe7f6['attributes'][_0x477cca(0x180)]});_0x55347f[_0x477cca(0x112)](_0xfe7f6['id'],_0x4e6f74['id']);}const _0x2d8424=[..._0xb46437],_0x4320ff=_0xb46437[_0x477cca(0x1eb)]+0x1;let _0x4336ca=0x0;while(_0x2d8424[_0x477cca(0x1eb)]>0x0&&_0x4336ca<_0x4320ff){_0x4336ca++;const _0x35c30c=[];for(const _0x517488 of _0x2d8424){if(canCreateAgent(_0x517488,_0x125342)){const _0x280de8=remapToolIds(_0x517488[_0x477cca(0x1e6)]['tools'],_0x55347f,_0x125342),_0x26f7eb=remapVariableIds(_0x517488[_0x477cca(0x1e6)][_0x477cca(0x18b)],_0x55347f),_0x136913=await this[_0x477cca(0x1d4)][_0x477cca(0x18e)]({'name':_0x517488['attributes'][_0x477cca(0x1f7)],'projectId':_0x321374,'systemPrompt':_0x517488['attributes']['systemPrompt'],'starterMessage':_0x517488[_0x477cca(0x1e6)][_0x477cca(0x198)],'modelType':migrateModelType(_0x517488[_0x477cca(0x1e6)][_0x477cca(0x13a)]),'maxToolIterations':_0x517488[_0x477cca(0x1e6)][_0x477cca(0x1bd)],'temperature':_0x517488[_0x477cca(0x1e6)][_0x477cca(0x181)],'reasoningEffort':_0x517488['attributes'][_0x477cca(0x108)],'outputs':_0x517488[_0x477cca(0x1e6)]['outputs'],'tools':_0x280de8,'variables':_0x26f7eb});_0x125342[_0x477cca(0x112)](_0x517488['id'],_0x136913['id']);}else _0x35c30c[_0x477cca(0x1aa)](_0x517488);}if(_0x35c30c[_0x477cca(0x1eb)]===_0x2d8424['length'])throw new SDKError(ErrorCode[_0x477cca(0x143)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x477cca(0x107)});_0x2d8424[_0x477cca(0x1eb)]=0x0,_0x2d8424[_0x477cca(0x1aa)](..._0x35c30c);}for(const _0x26fa54 of _0x3ef58e){const _0x4f967d=_0x125342[_0x477cca(0x17b)](_0x26fa54[_0x477cca(0x1e6)]['agentId']);if(!_0x4f967d)continue;const _0x10d2dd=await this['client']['createPrompt']({'projectId':_0x321374,'agentId':_0x4f967d,'name':_0x26fa54[_0x477cca(0x1e6)][_0x477cca(0x1f7)],'systemPrompt':_0x26fa54[_0x477cca(0x1e6)]['systemPrompt'],'template':_0x26fa54[_0x477cca(0x1e6)]['template'],'jsonSchemaHint':_0x26fa54['attributes'][_0x477cca(0x1e4)]});_0x26a34f[_0x477cca(0x112)](_0x26fa54['id'],_0x10d2dd['id']);}for(const _0x347ed5 of _0x310262){const _0x189e29=_0x347ed5[_0x477cca(0x1e6)][_0x477cca(0x1ce)][_0x477cca(0x17d)](_0x3224c0=>({..._0x3224c0,'promptId':_0x26a34f[_0x477cca(0x17b)](_0x3224c0['promptId'])||_0x3224c0['promptId']}));await this['client'][_0x477cca(0x109)]({'projectId':_0x321374,'serviceType':_0x347ed5['attributes'][_0x477cca(0x1cd)],'actions':_0x189e29,'slackMessageMode':_0x347ed5[_0x477cca(0x1e6)][_0x477cca(0x216)],'chatIgnoreManagedActions':_0x347ed5[_0x477cca(0x1e6)][_0x477cca(0x21a)],'chatWelcomeMessage':_0x347ed5[_0x477cca(0x1e6)][_0x477cca(0x12b)],'webhookCorsOrigins':_0x347ed5['attributes'][_0x477cca(0x171)]});}return{'projectName':_0x5e045c,'projectId':_0x321374,'counts':{'agents':_0x125342['size'],'knowledgeBases':_0x55347f[_0x477cca(0x13f)],'prompts':_0x26a34f['size'],'integrations':_0x310262[_0x477cca(0x1eb)]},'sourceSite':_0xb33a83};}[a138_0x262c49(0x16b)](_0x2391ef,_0x479a58){const _0x1bde27=a138_0x262c49;if(!a138_0x406b9a[_0x1bde27(0x20d)](_0x2391ef))return _0x479a58;return JSON['parse'](a138_0x406b9a[_0x1bde27(0x13d)](_0x2391ef,'utf-8'));}['getBackupMetadata'](_0x857f4e){const _0x1e1774=a138_0x262c49;if(!a138_0x406b9a[_0x1e1774(0x20d)](_0x857f4e))throw new SDKError(ErrorCode[_0x1e1774(0x18a)],_0x1e1774(0x157)+_0x857f4e,undefined,{'helpText':_0x1e1774(0x1ff)});const _0x5d2cd0=a138_0x3662d8[_0x1e1774(0x11a)](_0x857f4e,'project.json');if(!a138_0x406b9a[_0x1e1774(0x20d)](_0x5d2cd0))throw new SDKError(ErrorCode[_0x1e1774(0x123)],_0x1e1774(0x1f2)+_0x857f4e,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x87db96=JSON[_0x1e1774(0x161)](a138_0x406b9a[_0x1e1774(0x13d)](_0x5d2cd0,_0x1e1774(0x1d3)));if(!isSupportedBackupVersion(_0x87db96['version']))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x1e1774(0x16a)+_0x87db96[_0x1e1774(0x17e)],undefined,{'helpText':_0x1e1774(0x1a6)});return _0x87db96;}async[a138_0x262c49(0x167)](_0x4fc32d,_0x478d90,_0x8135a3){const _0x3f9af4=a138_0x262c49,{projectId:_0x308b2c,project:_0x2e1f57}=await this[_0x3f9af4(0x1bb)](_0x4fc32d),_0x2b2858=_0x2e1f57[_0x3f9af4(0x1e6)][_0x3f9af4(0x1f7)];let _0x586fc3;if(_0x478d90)_0x586fc3=_0x478d90;else{const _0x19e109=a138_0x3662d8[_0x3f9af4(0x11a)](process[_0x3f9af4(0x126)](),'agents'),_0x9fbb69=getSanitizedPathWithMigration(_0x19e109,_0x2b2858);_0x9fbb69[_0x3f9af4(0x21b)]&&this[_0x3f9af4(0x1f8)][_0x3f9af4(0x211)](_0x3f9af4(0x20a)+a138_0x3662d8[_0x3f9af4(0x182)](_0x9fbb69[_0x3f9af4(0x1e8)])+'\x20→\x20'+a138_0x3662d8['basename'](_0x9fbb69['path'])),_0x586fc3=_0x9fbb69[_0x3f9af4(0x1f3)];}const _0x54c09c=await this[_0x3f9af4(0x1d4)]['listAgentsFull'](_0x308b2c),_0xeb518d=await this[_0x3f9af4(0x1d4)][_0x3f9af4(0x19e)](_0x308b2c),_0x137675=await this['client']['listTextKnowledgeBases'](_0x308b2c),_0x53a4a9=await safeListOrEmpty(()=>this[_0x3f9af4(0x1d4)][_0x3f9af4(0x12f)](_0x308b2c)),_0x59bf63=await safeListOrEmpty(()=>this[_0x3f9af4(0x1d4)][_0x3f9af4(0x1fe)](_0x308b2c)),_0x46b9d1=await this[_0x3f9af4(0x1d4)][_0x3f9af4(0x13b)](_0x308b2c),_0x514087=await this['client'][_0x3f9af4(0x176)](_0x308b2c),_0x3612d3=await safeListOrEmpty(()=>this[_0x3f9af4(0x1d4)][_0x3f9af4(0x1c4)](_0x308b2c)),_0x104308=await safeListOrEmpty(()=>this[_0x3f9af4(0x1d4)]['listExperimentalArtifacts'](_0x308b2c)),_0x1981af=await safeListOrEmpty(()=>this['client']['listFormInterfaces'](_0x308b2c)),_0x52d00a=await safeListOrEmpty(()=>this['client'][_0x3f9af4(0x14e)](_0x308b2c)),_0x25fba8=_0x514087[_0x3f9af4(0x14c)](_0x133f9e=>!_0x133f9e[_0x3f9af4(0x1e6)][_0x3f9af4(0x192)]&&SAFE_INTEGRATION_TYPES[_0x3f9af4(0x159)](_0x133f9e['attributes']['serviceType'][_0x3f9af4(0x1a9)]())),_0x22e9fe=new Map(),_0x28ed1c=new Map(),_0x141eee=new Map(),_0x1fc17c=new Map(),_0xa5650f=new Map(),_0x1fcdad=new Map(),_0x8fefe9=new Map();for(const _0x38b990 of _0x54c09c){_0x22e9fe['set'](_0x38b990['id'],_0x38b990[_0x3f9af4(0x1e6)][_0x3f9af4(0x1f7)]);}for(const _0x59eb5a of _0xeb518d){_0x28ed1c[_0x3f9af4(0x112)](_0x59eb5a['id'],_0x59eb5a[_0x3f9af4(0x1e6)][_0x3f9af4(0x1f7)]);}for(const _0x58dff4 of _0x137675){_0x141eee[_0x3f9af4(0x112)](_0x58dff4['id'],_0x58dff4['attributes'][_0x3f9af4(0x1f7)]);}for(const _0x2f9776 of _0x53a4a9){_0x1fc17c[_0x3f9af4(0x112)](_0x2f9776['id'],_0x2f9776['attributes']['name']);}for(const _0x41ac12 of _0x59bf63){_0xa5650f[_0x3f9af4(0x112)](_0x41ac12['id'],_0x41ac12[_0x3f9af4(0x1e6)][_0x3f9af4(0x1f7)]);}for(const _0x58add3 of _0x46b9d1){_0x1fcdad['set'](_0x58add3['id'],_0x58add3['attributes']['name']);}for(const _0x2f8cfa of _0x3612d3){_0x8fefe9[_0x3f9af4(0x112)](_0x2f8cfa['id'],_0x2f8cfa[_0x3f9af4(0x1e6)][_0x3f9af4(0x1f7)]);}const _0x4d565a={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x28ed1c,'TextKnowledgeBase':_0x141eee,'Agent':_0x22e9fe,'WebSearchTool':_0xa5650f,'ImageGenerator':_0x1fc17c,'ExperimentalKnowledgeBase':_0x8fefe9}),'resolvePromptName':async _0x2b39d7=>_0x1fcdad[_0x3f9af4(0x17b)](_0x2b39d7),'onWarning':_0xbf381=>this[_0x3f9af4(0x1f8)]['warn'](_0xbf381)},_0x404161={'projectName':_0x2b2858,'outputDir':_0x586fc3,'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}}},_0x4c0e73=[],_0x54ba72=[];for(const _0x4d1a56 of _0x54c09c){const _0x3ccb5f=getSanitizedPathWithMigration(_0x586fc3,_0x4d1a56['attributes'][_0x3f9af4(0x1f7)]);_0x3ccb5f[_0x3f9af4(0x21b)]&&this['logger']['info'](_0x3f9af4(0x188)+a138_0x3662d8[_0x3f9af4(0x182)](_0x3ccb5f[_0x3f9af4(0x1e8)])+_0x3f9af4(0x105)+a138_0x3662d8[_0x3f9af4(0x182)](_0x3ccb5f[_0x3f9af4(0x1f3)]));const _0x5d1fbe=_0x3ccb5f['path'],_0x255a97=a138_0x3662d8[_0x3f9af4(0x11a)](_0x5d1fbe,'prompt.md'),_0x5e842e=a138_0x3662d8[_0x3f9af4(0x11a)](_0x5d1fbe,_0x3f9af4(0x142)),_0x520bea=a138_0x3662d8[_0x3f9af4(0x11a)](_0x5d1fbe,_0x3f9af4(0x11b)),{yaml:_0x4b0e48,systemPrompt:_0x9bafdc,starterMessage:_0x3a6429}=await agentResponseToDef(_0x4d1a56,_0x4d565a),_0x37bdf0=toAgentYamlString(_0x4b0e48),_0x10698d=!a138_0x406b9a[_0x3f9af4(0x20d)](_0x5e842e);let _0x48ff46=_0x10698d,_0x5d144f;if(!_0x10698d){const _0x2b632f=a138_0x406b9a[_0x3f9af4(0x20d)](_0x255a97)?a138_0x406b9a[_0x3f9af4(0x13d)](_0x255a97,_0x3f9af4(0x1d3)):'',_0xf96043=a138_0x406b9a[_0x3f9af4(0x13d)](_0x5e842e,'utf-8'),_0x1a0e25=_0x3f9af4(0x190)+_0x2b632f+_0x3f9af4(0x1dd)+_0xf96043,_0x12b68f='#\x20prompt.md\x0a'+_0x9bafdc+_0x3f9af4(0x1dd)+_0x37bdf0,_0x410211=generateDiff(_0x1a0e25,_0x12b68f);_0x48ff46=hasChanges(_0x410211),_0x48ff46&&(_0x5d144f=formatDiffWithColors(_0x410211));}_0x4c0e73[_0x3f9af4(0x1aa)]({'path':_0x5d1fbe,'content':'','isDir':!![]}),_0x4c0e73[_0x3f9af4(0x1aa)]({'path':_0x255a97,'content':_0x9bafdc}),_0x4c0e73[_0x3f9af4(0x1aa)]({'path':_0x5e842e,'content':_0x37bdf0});_0x3a6429&&_0x3a6429['includes']('\x0a')&&_0x4c0e73[_0x3f9af4(0x1aa)]({'path':_0x520bea,'content':_0x3a6429});_0x404161[_0x3f9af4(0x125)][_0x3f9af4(0x1aa)]({'agentName':_0x4d1a56[_0x3f9af4(0x1e6)]['name'],'outputPath':_0x5d1fbe,'isNew':_0x10698d,'hasChanges':_0x48ff46,'diff':_0x5d144f}),_0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x125)][_0x3f9af4(0x1d1)]++;if(_0x10698d)_0x404161['counts'][_0x3f9af4(0x125)]['new']++;else{if(_0x48ff46)_0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x125)][_0x3f9af4(0x1db)]++;else _0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x125)]['unchanged']++;}}for(const _0x4fc856 of _0xeb518d){if(_0x4fc856['attributes']['isManaged'])continue;const _0x33e8f7=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x586fc3),_0x4fc856['attributes'][_0x3f9af4(0x1f7)],_0x3f9af4(0x147));_0x33e8f7[_0x3f9af4(0x21b)]&&this['logger'][_0x3f9af4(0x211)](_0x3f9af4(0x13c)+a138_0x3662d8[_0x3f9af4(0x182)](_0x33e8f7[_0x3f9af4(0x1e8)])+_0x3f9af4(0x105)+a138_0x3662d8['basename'](_0x33e8f7[_0x3f9af4(0x1f3)]));const _0x6d91d8=_0x33e8f7[_0x3f9af4(0x1f3)],_0x263795=apiKnowledgeBaseToYaml(_0x4fc856),_0x24e35f=toKnowledgeBaseYamlString(_0x263795),_0x4bc190=!a138_0x406b9a[_0x3f9af4(0x20d)](_0x6d91d8);let _0x321cfc=_0x4bc190,_0x3f4038;if(!_0x4bc190){const _0x160939=a138_0x406b9a[_0x3f9af4(0x13d)](_0x6d91d8,_0x3f9af4(0x1d3)),_0x4d248e=generateDiff(_0x160939,_0x24e35f);_0x321cfc=hasChanges(_0x4d248e),_0x321cfc&&(_0x3f4038=formatDiffWithColors(_0x4d248e));}_0x4c0e73[_0x3f9af4(0x1aa)]({'path':_0x6d91d8,'content':_0x24e35f}),_0x404161[_0x3f9af4(0x144)][_0x3f9af4(0x1aa)]({'name':_0x4fc856[_0x3f9af4(0x1e6)][_0x3f9af4(0x1f7)],'outputPath':_0x6d91d8,'isNew':_0x4bc190,'hasChanges':_0x321cfc,'diff':_0x3f4038}),_0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x144)][_0x3f9af4(0x1d1)]++;if(_0x4bc190)_0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x144)][_0x3f9af4(0x100)]++;else{if(_0x321cfc)_0x404161[_0x3f9af4(0x148)]['knowledgeBases'][_0x3f9af4(0x1db)]++;else _0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x144)][_0x3f9af4(0x132)]++;}}for(const _0x4222c0 of _0x137675){if(_0x4222c0[_0x3f9af4(0x1e6)][_0x3f9af4(0x192)])continue;const _0x51457d=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x586fc3),_0x4222c0[_0x3f9af4(0x1e6)][_0x3f9af4(0x1f7)],'.md');_0x51457d[_0x3f9af4(0x21b)]&&this[_0x3f9af4(0x1f8)][_0x3f9af4(0x211)](_0x3f9af4(0x1cf)+a138_0x3662d8[_0x3f9af4(0x182)](_0x51457d['oldPath'])+_0x3f9af4(0x105)+a138_0x3662d8[_0x3f9af4(0x182)](_0x51457d[_0x3f9af4(0x1f3)]));const _0x2d1555=_0x51457d[_0x3f9af4(0x1f3)],_0x231704=toTextKnowledgeBaseMd(_0x4222c0[_0x3f9af4(0x1e6)][_0x3f9af4(0x1f7)],_0x4222c0['attributes'][_0x3f9af4(0x1be)]),_0x3f1742=!a138_0x406b9a['existsSync'](_0x2d1555);let _0xf2f544=_0x3f1742,_0x2cb318;if(!_0x3f1742){const _0x111cae=a138_0x406b9a['readFileSync'](_0x2d1555,_0x3f9af4(0x1d3)),_0x12994a=generateDiff(_0x111cae,_0x231704);_0xf2f544=hasChanges(_0x12994a),_0xf2f544&&(_0x2cb318=formatDiffWithColors(_0x12994a));}_0x4c0e73[_0x3f9af4(0x1aa)]({'path':_0x2d1555,'content':_0x231704}),_0x404161[_0x3f9af4(0x14f)][_0x3f9af4(0x1aa)]({'name':_0x4222c0['attributes'][_0x3f9af4(0x1f7)],'outputPath':_0x2d1555,'isNew':_0x3f1742,'hasChanges':_0xf2f544,'diff':_0x2cb318}),_0x404161['counts'][_0x3f9af4(0x14f)]['total']++;if(_0x3f1742)_0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x14f)]['new']++;else{if(_0xf2f544)_0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x14f)][_0x3f9af4(0x1db)]++;else _0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x14f)][_0x3f9af4(0x132)]++;}}for(const _0x59e955 of _0x46b9d1){if(_0x59e955[_0x3f9af4(0x1e6)][_0x3f9af4(0x192)])continue;const _0x410040=getSanitizedPathWithMigration(getPromptsDir(_0x586fc3),_0x59e955[_0x3f9af4(0x1e6)][_0x3f9af4(0x1f7)],_0x3f9af4(0x147));_0x410040[_0x3f9af4(0x21b)]&&this[_0x3f9af4(0x1f8)][_0x3f9af4(0x211)](_0x3f9af4(0x170)+a138_0x3662d8[_0x3f9af4(0x182)](_0x410040['oldPath'])+'\x20→\x20'+a138_0x3662d8[_0x3f9af4(0x182)](_0x410040['path']));const _0x54fd52=_0x410040['path'],_0x4d5406=await apiPromptToYaml(_0x59e955,_0x4d565a);if(!_0x4d5406)continue;const _0xe60b6a=toPromptYamlString(_0x4d5406),_0x5ee545=!a138_0x406b9a[_0x3f9af4(0x20d)](_0x54fd52);let _0x4ae7f5=_0x5ee545,_0x377f8b;if(!_0x5ee545){const _0x917e04=a138_0x406b9a['readFileSync'](_0x54fd52,_0x3f9af4(0x1d3)),_0xef711d=generateDiff(_0x917e04,_0xe60b6a);_0x4ae7f5=hasChanges(_0xef711d),_0x4ae7f5&&(_0x377f8b=formatDiffWithColors(_0xef711d));}_0x4c0e73[_0x3f9af4(0x1aa)]({'path':_0x54fd52,'content':_0xe60b6a}),_0x404161[_0x3f9af4(0xff)][_0x3f9af4(0x1aa)]({'name':_0x59e955[_0x3f9af4(0x1e6)][_0x3f9af4(0x1f7)],'outputPath':_0x54fd52,'isNew':_0x5ee545,'hasChanges':_0x4ae7f5,'diff':_0x377f8b}),_0x404161[_0x3f9af4(0x148)]['prompts'][_0x3f9af4(0x1d1)]++;if(_0x5ee545)_0x404161[_0x3f9af4(0x148)][_0x3f9af4(0xff)][_0x3f9af4(0x100)]++;else{if(_0x4ae7f5)_0x404161[_0x3f9af4(0x148)][_0x3f9af4(0xff)][_0x3f9af4(0x1db)]++;else _0x404161[_0x3f9af4(0x148)][_0x3f9af4(0xff)][_0x3f9af4(0x132)]++;}}for(const _0x245260 of _0x25fba8){const _0x16a730=_0x245260['attributes']['serviceType']['toLowerCase'](),_0x3d38ca=getSanitizedPathWithMigration(getIntegrationsDir(_0x586fc3),_0x16a730,'.yml');_0x3d38ca[_0x3f9af4(0x21b)]&&this[_0x3f9af4(0x1f8)][_0x3f9af4(0x211)](_0x3f9af4(0x150)+a138_0x3662d8[_0x3f9af4(0x182)](_0x3d38ca[_0x3f9af4(0x1e8)])+_0x3f9af4(0x105)+a138_0x3662d8['basename'](_0x3d38ca['path']));const _0x3d6fb8=_0x3d38ca[_0x3f9af4(0x1f3)],_0x183cfe=await apiIntegrationToYaml(_0x245260,_0x4d565a),_0x3116d7=toIntegrationYamlString(_0x183cfe),_0x5487ea=!a138_0x406b9a[_0x3f9af4(0x20d)](_0x3d6fb8);let _0x440c2b=_0x5487ea,_0x3f285b;if(!_0x5487ea){const _0x247c4a=a138_0x406b9a[_0x3f9af4(0x13d)](_0x3d6fb8,_0x3f9af4(0x1d3)),_0x289309=generateDiff(_0x247c4a,_0x3116d7);_0x440c2b=hasChanges(_0x289309),_0x440c2b&&(_0x3f285b=formatDiffWithColors(_0x289309));}_0x4c0e73[_0x3f9af4(0x1aa)]({'path':_0x3d6fb8,'content':_0x3116d7}),_0x404161[_0x3f9af4(0x14b)][_0x3f9af4(0x1aa)]({'name':_0x16a730,'outputPath':_0x3d6fb8,'isNew':_0x5487ea,'hasChanges':_0x440c2b,'diff':_0x3f285b}),_0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x14b)][_0x3f9af4(0x1d1)]++;if(_0x5487ea)_0x404161['counts'][_0x3f9af4(0x14b)][_0x3f9af4(0x100)]++;else{if(_0x440c2b)_0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x14b)]['updated']++;else _0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x14b)][_0x3f9af4(0x132)]++;}}for(const _0x3ff3ee of _0x3612d3){if(_0x3ff3ee[_0x3f9af4(0x1e6)][_0x3f9af4(0x192)])continue;const _0x47531f=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x586fc3),_0x3ff3ee['attributes'][_0x3f9af4(0x1f7)]);_0x47531f[_0x3f9af4(0x21b)]&&this['logger'][_0x3f9af4(0x211)](_0x3f9af4(0x219)+a138_0x3662d8[_0x3f9af4(0x182)](_0x47531f[_0x3f9af4(0x1e8)])+_0x3f9af4(0x105)+a138_0x3662d8[_0x3f9af4(0x182)](_0x47531f[_0x3f9af4(0x1f3)]));const _0x23c2c3=_0x47531f[_0x3f9af4(0x1f3)],_0x1c0219=a138_0x3662d8[_0x3f9af4(0x11a)](_0x23c2c3,sanitizeForFilesystem(_0x3ff3ee[_0x3f9af4(0x1e6)][_0x3f9af4(0x1f7)])+_0x3f9af4(0x147)),_0x434f60=a138_0x3662d8[_0x3f9af4(0x11a)](_0x23c2c3,'functions'),_0x44b82f=apiExperimentalKnowledgeBaseToYaml(_0x3ff3ee),_0x5ab403=toExperimentalKnowledgeBaseYamlString(_0x44b82f),_0x3c1edc=!a138_0x406b9a['existsSync'](_0x23c2c3);let _0x391163=_0x3c1edc,_0xff3724,_0x1e1aef=_0x5ab403;const _0x5bb684=[..._0x44b82f[_0x3f9af4(0x120)]][_0x3f9af4(0x158)]((_0x2f9ea5,_0x521cf7)=>_0x2f9ea5[_0x3f9af4(0x1f7)][_0x3f9af4(0x175)](_0x521cf7[_0x3f9af4(0x1f7)]));for(const _0x47bb39 of _0x5bb684){_0x1e1aef+=_0x3f9af4(0x128)+_0x47bb39[_0x3f9af4(0x1f7)]+_0x3f9af4(0x1d8)+_0x47bb39[_0x3f9af4(0x205)]+'\x0a---\x20schema:\x20'+_0x47bb39['name']+_0x3f9af4(0x1d8)+_0x47bb39[_0x3f9af4(0x1c8)]+'\x0a';}if(!_0x3c1edc){let _0x5b3770='';a138_0x406b9a['existsSync'](_0x1c0219)&&(_0x5b3770=a138_0x406b9a[_0x3f9af4(0x13d)](_0x1c0219,'utf-8'));if(a138_0x406b9a[_0x3f9af4(0x20d)](_0x434f60)){const _0x2697b3=a138_0x406b9a['readdirSync'](_0x434f60,{'withFileTypes':!![]}),_0x3c0c4c=_0x2697b3[_0x3f9af4(0x14c)](_0x201fc3=>_0x201fc3[_0x3f9af4(0x1d2)]())[_0x3f9af4(0x158)]((_0x376906,_0x4cf78c)=>_0x376906[_0x3f9af4(0x1f7)][_0x3f9af4(0x175)](_0x4cf78c[_0x3f9af4(0x1f7)]));for(const _0x20783f of _0x3c0c4c){const _0x118d57=a138_0x3662d8['join'](_0x434f60,_0x20783f['name'],'code.js'),_0x17ca2a=a138_0x3662d8[_0x3f9af4(0x11a)](_0x434f60,_0x20783f[_0x3f9af4(0x1f7)],_0x3f9af4(0x1fb));a138_0x406b9a[_0x3f9af4(0x20d)](_0x118d57)&&(_0x5b3770+='\x0a---\x20function:\x20'+_0x20783f['name']+_0x3f9af4(0x1d8)+a138_0x406b9a[_0x3f9af4(0x13d)](_0x118d57,_0x3f9af4(0x1d3))+'\x0a'),a138_0x406b9a[_0x3f9af4(0x20d)](_0x17ca2a)&&(_0x5b3770+=_0x3f9af4(0x146)+_0x20783f[_0x3f9af4(0x1f7)]+_0x3f9af4(0x1d8)+a138_0x406b9a['readFileSync'](_0x17ca2a,_0x3f9af4(0x1d3))+'\x0a');}}const _0xc77ea1=generateDiff(_0x5b3770,_0x1e1aef);_0x391163=hasChanges(_0xc77ea1),_0x391163&&(_0xff3724=formatDiffWithColors(_0xc77ea1));}_0x4c0e73['push']({'path':_0x23c2c3,'content':'','isDir':!![]}),_0x4c0e73[_0x3f9af4(0x1aa)]({'path':_0x1c0219,'content':_0x5ab403}),_0x4c0e73['push']({'path':_0x434f60,'content':'','isDir':!![]});for(const _0x152a36 of _0x44b82f['functions']){const _0x4a0fb9=a138_0x3662d8[_0x3f9af4(0x11a)](_0x434f60,sanitizeForFilesystem(_0x152a36['name'])),_0x5b22e2=a138_0x3662d8['join'](_0x4a0fb9,'code.js'),_0x497ab5=a138_0x3662d8[_0x3f9af4(0x11a)](_0x4a0fb9,_0x3f9af4(0x1fb));_0x4c0e73[_0x3f9af4(0x1aa)]({'path':_0x4a0fb9,'content':'','isDir':!![]}),_0x4c0e73[_0x3f9af4(0x1aa)]({'path':_0x5b22e2,'content':_0x152a36[_0x3f9af4(0x205)]}),_0x4c0e73[_0x3f9af4(0x1aa)]({'path':_0x497ab5,'content':_0x152a36['json_schema']});}if(a138_0x406b9a[_0x3f9af4(0x20d)](_0x434f60)){const _0x2816a9=a138_0x406b9a[_0x3f9af4(0x187)](_0x434f60,{'withFileTypes':!![]}),_0x3846c5=new Set(_0x44b82f['functions']['map'](_0x309cda=>sanitizeForFilesystem(_0x309cda['name'])));for(const _0xd01332 of _0x2816a9){if(_0xd01332[_0x3f9af4(0x1d2)]()&&!_0x3846c5[_0x3f9af4(0x10c)](_0xd01332[_0x3f9af4(0x1f7)])){const _0x5524aa=a138_0x3662d8['join'](_0x434f60,_0xd01332[_0x3f9af4(0x1f7)]);_0x54ba72[_0x3f9af4(0x1aa)]({'path':_0x5524aa,'isDir':!![]});}}}_0x404161[_0x3f9af4(0x1dc)][_0x3f9af4(0x1aa)]({'name':_0x3ff3ee[_0x3f9af4(0x1e6)][_0x3f9af4(0x1f7)],'outputPath':_0x23c2c3,'isNew':_0x3c1edc,'hasChanges':_0x391163,'diff':_0xff3724}),_0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x1dc)][_0x3f9af4(0x1d1)]++;if(_0x3c1edc)_0x404161[_0x3f9af4(0x148)]['experimentalKnowledgeBases'][_0x3f9af4(0x100)]++;else{if(_0x391163)_0x404161['counts'][_0x3f9af4(0x1dc)]['updated']++;else _0x404161[_0x3f9af4(0x148)]['experimentalKnowledgeBases'][_0x3f9af4(0x132)]++;}}for(const _0x32c11f of _0x104308){if(_0x32c11f[_0x3f9af4(0x1e6)][_0x3f9af4(0x192)])continue;const _0x41d5e0=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x586fc3),_0x32c11f[_0x3f9af4(0x1e6)][_0x3f9af4(0x1f7)]);_0x41d5e0[_0x3f9af4(0x21b)]&&this[_0x3f9af4(0x1f8)][_0x3f9af4(0x211)]('Renamed\x20experimental\x20artifact\x20directory:\x20'+a138_0x3662d8['basename'](_0x41d5e0['oldPath'])+_0x3f9af4(0x105)+a138_0x3662d8[_0x3f9af4(0x182)](_0x41d5e0[_0x3f9af4(0x1f3)]));const _0x16e3f8=_0x41d5e0[_0x3f9af4(0x1f3)],_0x454a34=a138_0x3662d8[_0x3f9af4(0x11a)](_0x16e3f8,sanitizeForFilesystem(_0x32c11f[_0x3f9af4(0x1e6)]['name'])+'.yml'),_0x26154a=a138_0x3662d8['join'](_0x16e3f8,'code.js'),_0x2cac22=a138_0x3662d8['join'](_0x16e3f8,_0x3f9af4(0x130)),_0x27f6fd=apiExperimentalArtifactToYaml(_0x32c11f),_0xba4b11=toExperimentalArtifactYamlString(_0x27f6fd),_0x37a680=!a138_0x406b9a['existsSync'](_0x16e3f8);let _0x24727b=_0x37a680,_0x420baf,_0xfa4757=_0xba4b11+(_0x3f9af4(0x1b5)+_0x27f6fd['code']+'\x0a');const _0x4ab492=[..._0x27f6fd['files']][_0x3f9af4(0x158)]((_0xeab592,_0x93d5d5)=>_0xeab592[_0x3f9af4(0x106)][_0x3f9af4(0x175)](_0x93d5d5[_0x3f9af4(0x106)]));for(const _0x299093 of _0x4ab492){_0xfa4757+='---\x20file:\x20'+_0x299093[_0x3f9af4(0x106)]+_0x3f9af4(0x1d8)+_0x299093[_0x3f9af4(0x15a)]+'\x0a';}if(!_0x37a680){let _0x4e733e='';a138_0x406b9a[_0x3f9af4(0x20d)](_0x454a34)&&(_0x4e733e=a138_0x406b9a[_0x3f9af4(0x13d)](_0x454a34,'utf-8'));a138_0x406b9a['existsSync'](_0x26154a)&&(_0x4e733e+=_0x3f9af4(0x1b5)+a138_0x406b9a[_0x3f9af4(0x13d)](_0x26154a,_0x3f9af4(0x1d3))+'\x0a');if(a138_0x406b9a[_0x3f9af4(0x20d)](_0x2cac22)){const _0x3c5e4b=a138_0x406b9a[_0x3f9af4(0x187)](_0x2cac22),_0x49b487=_0x3c5e4b[_0x3f9af4(0x14c)](_0x1253e3=>{const _0x128a59=_0x3f9af4,_0x1ed141=a138_0x3662d8[_0x128a59(0x11a)](_0x2cac22,_0x1253e3);return a138_0x406b9a['statSync'](_0x1ed141)[_0x128a59(0x119)]();})['sort']((_0x512339,_0xdd60f3)=>_0x512339[_0x3f9af4(0x175)](_0xdd60f3));for(const _0x3743fa of _0x49b487){const _0x5782d4=a138_0x3662d8['join'](_0x2cac22,_0x3743fa);_0x4e733e+=_0x3f9af4(0x20c)+_0x3743fa+'\x20---\x0a'+a138_0x406b9a[_0x3f9af4(0x13d)](_0x5782d4,'utf-8')+'\x0a';}}const _0x4422b4=generateDiff(_0x4e733e,_0xfa4757);_0x24727b=hasChanges(_0x4422b4),_0x24727b&&(_0x420baf=formatDiffWithColors(_0x4422b4));}_0x4c0e73[_0x3f9af4(0x1aa)]({'path':_0x16e3f8,'content':'','isDir':!![]}),_0x4c0e73['push']({'path':_0x454a34,'content':_0xba4b11}),_0x4c0e73[_0x3f9af4(0x1aa)]({'path':_0x26154a,'content':_0x27f6fd[_0x3f9af4(0x205)]});if(_0x27f6fd[_0x3f9af4(0x130)][_0x3f9af4(0x1eb)]>0x0){_0x4c0e73[_0x3f9af4(0x1aa)]({'path':_0x2cac22,'content':'','isDir':!![]});for(const _0x45bdac of _0x27f6fd['files']){const _0x134989=a138_0x3662d8['join'](_0x2cac22,_0x45bdac[_0x3f9af4(0x106)]);_0x4c0e73[_0x3f9af4(0x1aa)]({'path':_0x134989,'content':_0x45bdac[_0x3f9af4(0x15a)]});}}if(a138_0x406b9a[_0x3f9af4(0x20d)](_0x2cac22)){const _0x41429e=a138_0x406b9a[_0x3f9af4(0x187)](_0x2cac22),_0x3a85e4=new Set(_0x27f6fd['files'][_0x3f9af4(0x17d)](_0x4727f0=>_0x4727f0[_0x3f9af4(0x106)]));for(const _0xbfb315 of _0x41429e){const _0xc83496=a138_0x3662d8[_0x3f9af4(0x11a)](_0x2cac22,_0xbfb315);a138_0x406b9a['statSync'](_0xc83496)[_0x3f9af4(0x119)]()&&!_0x3a85e4['has'](_0xbfb315)&&_0x54ba72[_0x3f9af4(0x1aa)]({'path':_0xc83496});}}_0x404161[_0x3f9af4(0x1ad)][_0x3f9af4(0x1aa)]({'name':_0x32c11f['attributes']['name'],'outputPath':_0x16e3f8,'isNew':_0x37a680,'hasChanges':_0x24727b,'diff':_0x420baf}),_0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x1ad)]['total']++;if(_0x37a680)_0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x1ad)][_0x3f9af4(0x100)]++;else{if(_0x24727b)_0x404161[_0x3f9af4(0x148)]['experimentalArtifacts'][_0x3f9af4(0x1db)]++;else _0x404161[_0x3f9af4(0x148)]['experimentalArtifacts'][_0x3f9af4(0x132)]++;}}for(const _0x3e4e39 of _0x1981af){const _0x4691d9=getSanitizedPathWithMigration(getFormInterfacesDir(_0x586fc3),_0x3e4e39[_0x3f9af4(0x1e6)][_0x3f9af4(0x1f7)],'.yml');_0x4691d9['renamed']&&this[_0x3f9af4(0x1f8)][_0x3f9af4(0x211)](_0x3f9af4(0x1b0)+a138_0x3662d8[_0x3f9af4(0x182)](_0x4691d9[_0x3f9af4(0x1e8)])+'\x20→\x20'+a138_0x3662d8[_0x3f9af4(0x182)](_0x4691d9[_0x3f9af4(0x1f3)]));const _0x2d19f5=_0x4691d9[_0x3f9af4(0x1f3)],_0x574ecd=await apiFormInterfaceToYaml(_0x3e4e39,_0x4d565a),_0x57a990=toFormInterfaceYamlString(_0x574ecd),_0x5e39b2=!a138_0x406b9a[_0x3f9af4(0x20d)](_0x2d19f5);let _0x1177ac=_0x5e39b2,_0x626cb8;if(!_0x5e39b2){const _0xf295cd=a138_0x406b9a['readFileSync'](_0x2d19f5,_0x3f9af4(0x1d3)),_0xb392b6=generateDiff(_0xf295cd,_0x57a990);_0x1177ac=hasChanges(_0xb392b6),_0x1177ac&&(_0x626cb8=formatDiffWithColors(_0xb392b6));}_0x4c0e73['push']({'path':_0x2d19f5,'content':_0x57a990}),_0x404161['formInterfaces'][_0x3f9af4(0x1aa)]({'name':_0x3e4e39[_0x3f9af4(0x1e6)][_0x3f9af4(0x1f7)],'outputPath':_0x2d19f5,'isNew':_0x5e39b2,'hasChanges':_0x1177ac,'diff':_0x626cb8}),_0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x200)][_0x3f9af4(0x1d1)]++;if(_0x5e39b2)_0x404161[_0x3f9af4(0x148)]['formInterfaces'][_0x3f9af4(0x100)]++;else{if(_0x1177ac)_0x404161['counts'][_0x3f9af4(0x200)][_0x3f9af4(0x1db)]++;else _0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x200)][_0x3f9af4(0x132)]++;}}for(const _0x522749 of _0x52d00a){if(_0x522749[_0x3f9af4(0x1e6)][_0x3f9af4(0x192)])continue;const _0x503604=getSanitizedPathWithMigration(getChatInterfacesDir(_0x586fc3),_0x522749[_0x3f9af4(0x1e6)][_0x3f9af4(0x1f7)],_0x3f9af4(0x147));_0x503604[_0x3f9af4(0x21b)]&&this[_0x3f9af4(0x1f8)]['info'](_0x3f9af4(0x183)+a138_0x3662d8[_0x3f9af4(0x182)](_0x503604[_0x3f9af4(0x1e8)])+'\x20→\x20'+a138_0x3662d8['basename'](_0x503604['path']));const _0x168cfb=_0x503604[_0x3f9af4(0x1f3)],_0x23909b=await apiChatInterfaceToYaml(_0x522749,_0x4d565a),_0x51efc5=toChatInterfaceYamlString(_0x23909b),_0x30b6fe=!a138_0x406b9a[_0x3f9af4(0x20d)](_0x168cfb);let _0x26236a=_0x30b6fe,_0x5602b1;if(!_0x30b6fe){const _0x4d23f2=a138_0x406b9a[_0x3f9af4(0x13d)](_0x168cfb,_0x3f9af4(0x1d3)),_0x5d32cc=generateDiff(_0x4d23f2,_0x51efc5);_0x26236a=hasChanges(_0x5d32cc),_0x26236a&&(_0x5602b1=formatDiffWithColors(_0x5d32cc));}_0x4c0e73[_0x3f9af4(0x1aa)]({'path':_0x168cfb,'content':_0x51efc5}),_0x404161[_0x3f9af4(0x13e)]['push']({'name':_0x522749['attributes']['name'],'outputPath':_0x168cfb,'isNew':_0x30b6fe,'hasChanges':_0x26236a,'diff':_0x5602b1}),_0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x13e)][_0x3f9af4(0x1d1)]++;if(_0x30b6fe)_0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x13e)][_0x3f9af4(0x100)]++;else{if(_0x26236a)_0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x13e)][_0x3f9af4(0x1db)]++;else _0x404161[_0x3f9af4(0x148)][_0x3f9af4(0x13e)][_0x3f9af4(0x132)]++;}}if(_0x8135a3?.[_0x3f9af4(0x199)])return _0x404161;a138_0x406b9a['mkdirSync'](_0x586fc3,{'recursive':!![]}),a138_0x406b9a[_0x3f9af4(0x1ed)](getKnowledgeBasesDir(_0x586fc3),{'recursive':!![]}),a138_0x406b9a[_0x3f9af4(0x1ed)](getPromptsDir(_0x586fc3),{'recursive':!![]}),a138_0x406b9a[_0x3f9af4(0x1ed)](getIntegrationsDir(_0x586fc3),{'recursive':!![]}),a138_0x406b9a[_0x3f9af4(0x1ed)](getExperimentalKnowledgeBasesDir(_0x586fc3),{'recursive':!![]}),a138_0x406b9a['mkdirSync'](getExperimentalArtifactsDir(_0x586fc3),{'recursive':!![]}),a138_0x406b9a[_0x3f9af4(0x1ed)](getFormInterfacesDir(_0x586fc3),{'recursive':!![]}),a138_0x406b9a['mkdirSync'](getChatInterfacesDir(_0x586fc3),{'recursive':!![]});const _0x2c17e7=a138_0x3662d8[_0x3f9af4(0x11a)](_0x586fc3,'tdx.json');a138_0x406b9a['writeFileSync'](_0x2c17e7,createAgentConfigContent(_0x2b2858));for(const _0x145f9d of _0x4c0e73){if(_0x145f9d[_0x3f9af4(0x168)])a138_0x406b9a[_0x3f9af4(0x1ed)](_0x145f9d[_0x3f9af4(0x1f3)],{'recursive':!![]});else{const _0x1633d9=a138_0x3662d8[_0x3f9af4(0x204)](_0x145f9d[_0x3f9af4(0x1f3)]);!a138_0x406b9a[_0x3f9af4(0x20d)](_0x1633d9)&&a138_0x406b9a['mkdirSync'](_0x1633d9,{'recursive':!![]}),a138_0x406b9a[_0x3f9af4(0x16f)](_0x145f9d[_0x3f9af4(0x1f3)],_0x145f9d[_0x3f9af4(0x12d)]);}}for(const _0x5cb211 of _0x54ba72){_0x5cb211['isDir']?(a138_0x406b9a[_0x3f9af4(0x210)](_0x5cb211['path'],{'recursive':!![],'force':!![]}),this['logger'][_0x3f9af4(0x211)](_0x3f9af4(0x154)+a138_0x3662d8[_0x3f9af4(0x182)](a138_0x3662d8[_0x3f9af4(0x204)](_0x5cb211['path']))+'/'+a138_0x3662d8['basename'](_0x5cb211[_0x3f9af4(0x1f3)]))):(a138_0x406b9a[_0x3f9af4(0x210)](_0x5cb211[_0x3f9af4(0x1f3)],{'force':!![]}),this[_0x3f9af4(0x1f8)][_0x3f9af4(0x211)]('Removed\x20deleted\x20file:\x20'+a138_0x3662d8['basename'](a138_0x3662d8[_0x3f9af4(0x204)](_0x5cb211[_0x3f9af4(0x1f3)]))+'/'+a138_0x3662d8['basename'](_0x5cb211[_0x3f9af4(0x1f3)])));}return _0x404161;}async[a138_0x262c49(0x1c5)](_0x294617,_0x551e1a){const _0x5d7780=a138_0x262c49,_0x1a3c20=a138_0x3662d8['join'](_0x294617,'tdx.json');if(!a138_0x406b9a['existsSync'](_0x1a3c20))throw new SDKError(ErrorCode[_0x5d7780(0x123)],'No\x20tdx.json\x20found\x20in\x20'+_0x294617,undefined,{'helpText':_0x5d7780(0xfc)});const _0x202ccb=loadAgentConfig(_0x1a3c20),_0x6ea14b=await this[_0x5d7780(0xfa)](_0x202ccb['llm_project']),_0x49a8e1=await this[_0x5d7780(0x1d4)][_0x5d7780(0x184)](_0x6ea14b),_0x22491d=_0x49a8e1[_0x5d7780(0x1e6)][_0x5d7780(0x1f7)],_0x79f757={'projectName':_0x22491d,'projectId':_0x6ea14b,'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}}},_0x4ec243=[],_0x9e8f2f=[],_0x4cf973=[],_0x14416d=[],_0x22dce6=[],_0xf20956=[],_0x3099b2=a138_0x406b9a[_0x5d7780(0x187)](_0x294617,{'withFileTypes':!![]});for(const _0xc849c1 of _0x3099b2){if(!_0xc849c1[_0x5d7780(0x1d2)]())continue;if([_0x5d7780(0x207),_0x5d7780(0xff),_0x5d7780(0x14b),_0x5d7780(0x12e),_0x5d7780(0x208),_0x5d7780(0x1a3),_0x5d7780(0x1b1)]['includes'](_0xc849c1[_0x5d7780(0x1f7)]))continue;const _0x233304=a138_0x3662d8[_0x5d7780(0x11a)](_0x294617,_0xc849c1[_0x5d7780(0x1f7)]);if(isAgentDir(_0x233304)){const _0x4bfd23=a138_0x3662d8[_0x5d7780(0x11a)](_0x233304,_0x5d7780(0x142)),_0x542416=a138_0x3662d8['join'](_0x233304,_0x5d7780(0xfb)),_0x5edc00=a138_0x3662d8[_0x5d7780(0x11a)](_0x233304,_0x5d7780(0x11b)),_0x45e6fc=parseAgentYaml(a138_0x406b9a[_0x5d7780(0x13d)](_0x4bfd23,_0x5d7780(0x1d3)),_0x4bfd23),_0x4fda7f=a138_0x406b9a[_0x5d7780(0x20d)](_0x542416)?a138_0x406b9a[_0x5d7780(0x13d)](_0x542416,_0x5d7780(0x1d3)):'',_0x21fb30=a138_0x406b9a['existsSync'](_0x5edc00)?a138_0x406b9a[_0x5d7780(0x13d)](_0x5edc00,_0x5d7780(0x1d3)):_0x45e6fc[_0x5d7780(0x179)];_0x4ec243[_0x5d7780(0x1aa)]({'name':_0x45e6fc[_0x5d7780(0x1f7)],'dir':_0x233304,'yaml':_0x45e6fc,'systemPrompt':_0x4fda7f,'starterMessage':_0x21fb30});}}const _0x2730a4=getKnowledgeBasesDir(_0x294617);if(a138_0x406b9a[_0x5d7780(0x20d)](_0x2730a4)){const _0x4a4d5d=a138_0x406b9a[_0x5d7780(0x187)](_0x2730a4);for(const _0x3181f8 of _0x4a4d5d){const _0x2b39fd=a138_0x3662d8[_0x5d7780(0x11a)](_0x2730a4,_0x3181f8);if(_0x3181f8[_0x5d7780(0x140)](_0x5d7780(0x147))){const _0x242afc=parseKnowledgeBaseYaml(a138_0x406b9a[_0x5d7780(0x13d)](_0x2b39fd,_0x5d7780(0x1d3)),_0x2b39fd);_0x9e8f2f[_0x5d7780(0x1aa)]({'name':_0x242afc[_0x5d7780(0x1f7)],'path':_0x2b39fd,'yaml':_0x242afc});}else{if(_0x3181f8[_0x5d7780(0x140)](_0x5d7780(0x104))){const _0x42f89f=a138_0x406b9a[_0x5d7780(0x13d)](_0x2b39fd,_0x5d7780(0x1d3)),{name:_0x4be84c,text:_0xa5fa34}=parseTextKnowledgeBaseMd(_0x42f89f,_0x3181f8);_0x4cf973[_0x5d7780(0x1aa)]({'name':_0x4be84c,'path':_0x2b39fd,'text':_0xa5fa34});}}}}const _0x22661f=getPromptsDir(_0x294617);if(a138_0x406b9a[_0x5d7780(0x20d)](_0x22661f)){const _0x8b1da2=a138_0x406b9a['readdirSync'](_0x22661f)[_0x5d7780(0x14c)](_0x573197=>_0x573197[_0x5d7780(0x140)](_0x5d7780(0x147)));for(const _0x30b6d4 of _0x8b1da2){const _0x13241f=a138_0x3662d8[_0x5d7780(0x11a)](_0x22661f,_0x30b6d4),_0x2fb789=parsePromptYaml(a138_0x406b9a['readFileSync'](_0x13241f,'utf-8'),_0x13241f);_0x14416d[_0x5d7780(0x1aa)]({'name':_0x2fb789['name'],'path':_0x13241f,'yaml':_0x2fb789});}}const _0x30fc7a=[],_0x10fbf0=getIntegrationsDir(_0x294617);if(a138_0x406b9a[_0x5d7780(0x20d)](_0x10fbf0)){const _0x412636=a138_0x406b9a['readdirSync'](_0x10fbf0)[_0x5d7780(0x14c)](_0x1bd3d9=>_0x1bd3d9[_0x5d7780(0x140)](_0x5d7780(0x147)));for(const _0x5f49f1 of _0x412636){const _0xfa3b34=a138_0x3662d8[_0x5d7780(0x11a)](_0x10fbf0,_0x5f49f1),_0x4b8f13=parseIntegrationYaml(a138_0x406b9a[_0x5d7780(0x13d)](_0xfa3b34,_0x5d7780(0x1d3)),_0xfa3b34);if(!SAFE_INTEGRATION_TYPES[_0x5d7780(0x159)](_0x4b8f13[_0x5d7780(0x1de)]['toLowerCase']())){this[_0x5d7780(0x1f8)][_0x5d7780(0x12a)]('Skipping\x20integration\x20\x27'+_0x4b8f13[_0x5d7780(0x1f7)]+_0x5d7780(0x1c0)+_0x4b8f13[_0x5d7780(0x1de)]+'):\x20'+(_0x5d7780(0x156)+SAFE_INTEGRATION_TYPES[_0x5d7780(0x11a)](',\x20')+')\x20can\x20be\x20pushed.\x20')+_0x5d7780(0x1fc));continue;}_0x30fc7a[_0x5d7780(0x1aa)]({'name':_0x4b8f13['name'],'path':_0xfa3b34,'yaml':_0x4b8f13});}}const _0xe97360=getExperimentalKnowledgeBasesDir(_0x294617);if(a138_0x406b9a[_0x5d7780(0x20d)](_0xe97360)){const _0x54febe=a138_0x406b9a[_0x5d7780(0x187)](_0xe97360,{'withFileTypes':!![]});for(const _0x2871cc of _0x54febe){if(!_0x2871cc[_0x5d7780(0x1d2)]())continue;const _0x1c781e=a138_0x3662d8[_0x5d7780(0x11a)](_0xe97360,_0x2871cc[_0x5d7780(0x1f7)]),_0x5aa5b4=a138_0x3662d8['join'](_0x1c781e,_0x2871cc[_0x5d7780(0x1f7)]+_0x5d7780(0x147)),_0x49ab62=a138_0x3662d8['join'](_0x1c781e,_0x5d7780(0x120));if(!a138_0x406b9a[_0x5d7780(0x20d)](_0x5aa5b4))continue;const _0x1ec35a=parseExperimentalKnowledgeBaseYaml(a138_0x406b9a[_0x5d7780(0x13d)](_0x5aa5b4,_0x5d7780(0x1d3)),_0x5aa5b4),_0x2d4eab=[];if(a138_0x406b9a[_0x5d7780(0x20d)](_0x49ab62)){const _0x33fcbd=a138_0x406b9a[_0x5d7780(0x187)](_0x49ab62,{'withFileTypes':!![]});for(const _0x1e8c19 of _0x33fcbd){if(!_0x1e8c19[_0x5d7780(0x1d2)]())continue;const _0x564391=a138_0x3662d8['join'](_0x49ab62,_0x1e8c19[_0x5d7780(0x1f7)]),_0x3038e5=a138_0x3662d8[_0x5d7780(0x11a)](_0x564391,_0x5d7780(0x20e)),_0xeac95e=a138_0x3662d8[_0x5d7780(0x11a)](_0x564391,_0x5d7780(0x1fb));a138_0x406b9a[_0x5d7780(0x20d)](_0x3038e5)&&a138_0x406b9a[_0x5d7780(0x20d)](_0xeac95e)&&_0x2d4eab[_0x5d7780(0x1aa)]({'name':_0x1e8c19['name'],'code':a138_0x406b9a[_0x5d7780(0x13d)](_0x3038e5,_0x5d7780(0x1d3)),'json_schema':a138_0x406b9a['readFileSync'](_0xeac95e,_0x5d7780(0x1d3))});}}const _0x4522ef={..._0x1ec35a,'variables':_0x1ec35a[_0x5d7780(0x18b)]||[],'functions':_0x2d4eab};_0x22dce6['push']({'name':_0x1ec35a[_0x5d7780(0x1f7)],'dir':_0x1c781e,'def':_0x4522ef});}}const _0x54eb2c=getExperimentalArtifactsDir(_0x294617);if(a138_0x406b9a['existsSync'](_0x54eb2c)){const _0x790040=a138_0x406b9a[_0x5d7780(0x187)](_0x54eb2c,{'withFileTypes':!![]});for(const _0x57ade2 of _0x790040){if(!_0x57ade2['isDirectory']())continue;const _0x2678ae=a138_0x3662d8['join'](_0x54eb2c,_0x57ade2['name']),_0x583bdd=a138_0x3662d8[_0x5d7780(0x11a)](_0x2678ae,_0x57ade2[_0x5d7780(0x1f7)]+'.yml'),_0x12a281=a138_0x3662d8[_0x5d7780(0x11a)](_0x2678ae,_0x5d7780(0x20e)),_0x59e92c=a138_0x3662d8[_0x5d7780(0x11a)](_0x2678ae,_0x5d7780(0x130));if(!a138_0x406b9a[_0x5d7780(0x20d)](_0x583bdd)||!a138_0x406b9a['existsSync'](_0x12a281))continue;const _0x458124=parseExperimentalArtifactYaml(a138_0x406b9a[_0x5d7780(0x13d)](_0x583bdd,_0x5d7780(0x1d3)),_0x583bdd),_0x3ff78f=a138_0x406b9a[_0x5d7780(0x13d)](_0x12a281,_0x5d7780(0x1d3)),_0x54b213=[];if(a138_0x406b9a[_0x5d7780(0x20d)](_0x59e92c)){const _0x2f4d90=a138_0x406b9a[_0x5d7780(0x187)](_0x59e92c);for(const _0x2d16d5 of _0x2f4d90){const _0x552c8f=a138_0x3662d8[_0x5d7780(0x11a)](_0x59e92c,_0x2d16d5);a138_0x406b9a['statSync'](_0x552c8f)[_0x5d7780(0x119)]()&&_0x54b213[_0x5d7780(0x1aa)]({'file_name':_0x2d16d5,'text_content':a138_0x406b9a[_0x5d7780(0x13d)](_0x552c8f,_0x5d7780(0x1d3))});}}const _0x51d094={..._0x458124,'code':_0x3ff78f,'files':_0x54b213};_0xf20956['push']({'name':_0x458124[_0x5d7780(0x1f7)],'dir':_0x2678ae,'def':_0x51d094});}}const _0x4caa50=[],_0x4e73ec=getFormInterfacesDir(_0x294617);if(a138_0x406b9a[_0x5d7780(0x20d)](_0x4e73ec)){const _0x1b6d10=a138_0x406b9a[_0x5d7780(0x187)](_0x4e73ec)[_0x5d7780(0x14c)](_0x3f9153=>_0x3f9153['endsWith'](_0x5d7780(0x147)));for(const _0x3e7dd5 of _0x1b6d10){const _0x43060b=a138_0x3662d8[_0x5d7780(0x11a)](_0x4e73ec,_0x3e7dd5),_0x511fd4=parseFormInterfaceYaml(a138_0x406b9a[_0x5d7780(0x13d)](_0x43060b,_0x5d7780(0x1d3)),_0x43060b);_0x4caa50['push']({'name':_0x511fd4['name'],'path':_0x43060b,'yaml':_0x511fd4});}}const _0x54e00f=[],_0x57147c=getChatInterfacesDir(_0x294617);if(a138_0x406b9a['existsSync'](_0x57147c)){const _0x42da93=a138_0x406b9a['readdirSync'](_0x57147c)[_0x5d7780(0x14c)](_0x51bf6f=>_0x51bf6f['endsWith'](_0x5d7780(0x147)));for(const _0x10fdf1 of _0x42da93){const _0x57af3a=a138_0x3662d8[_0x5d7780(0x11a)](_0x57147c,_0x10fdf1),_0x4f15d7=parseChatInterfaceYaml(a138_0x406b9a[_0x5d7780(0x13d)](_0x57af3a,_0x5d7780(0x1d3)),_0x57af3a);_0x54e00f[_0x5d7780(0x1aa)]({'name':_0x4f15d7[_0x5d7780(0x1f7)],'path':_0x57af3a,'yaml':_0x4f15d7});}}const _0x1e7714=await this['client']['listAgentsFull'](_0x6ea14b),_0x1de380=await this[_0x5d7780(0x1d4)]['listKnowledgeBases'](_0x6ea14b),_0x439079=await this[_0x5d7780(0x1d4)][_0x5d7780(0x14a)](_0x6ea14b),_0x10fd5f=await this['client']['listPrompts'](_0x6ea14b),_0x392419=await this[_0x5d7780(0x1d4)][_0x5d7780(0x176)](_0x6ea14b),_0x1f3e7e=await safeListOrEmpty(()=>this[_0x5d7780(0x1d4)][_0x5d7780(0x1c4)](_0x6ea14b)),_0x57afa2=await safeListOrEmpty(()=>this['client'][_0x5d7780(0x117)](_0x6ea14b)),_0x53833d=await safeListOrEmpty(()=>this[_0x5d7780(0x1d4)][_0x5d7780(0x165)](_0x6ea14b)),_0x758d2=await safeListOrEmpty(()=>this[_0x5d7780(0x1d4)]['listChatInterfaces'](_0x6ea14b)),_0x2bb111=await fetchAllToolTargetMaps((_0x1c59f4,_0x2fcd99)=>this[_0x5d7780(0x1d4)][_0x5d7780(0x217)](_0x1c59f4,_0x2fcd99),_0x6ea14b),_0x53d234=new Map(),_0x5369d3=new Map(),_0x3f64fc=new Map(),_0x538725=new Map(),_0x25b93b=new Map(),_0x271f25=new Map(),_0x40c197=new Map();for(const _0x52996f of _0x1e7714){_0x53d234[_0x5d7780(0x112)](_0x52996f['attributes'][_0x5d7780(0x1f7)],_0x52996f);}for(const _0x80a029 of _0x1de380){_0x5369d3['set'](_0x80a029[_0x5d7780(0x1e6)]['name'],_0x80a029);}for(const _0x5ee8cb of _0x439079){_0x3f64fc[_0x5d7780(0x112)](_0x5ee8cb[_0x5d7780(0x1e6)][_0x5d7780(0x1f7)],_0x5ee8cb);}for(const _0x6573ed of _0x10fd5f){_0x538725[_0x5d7780(0x112)](_0x6573ed[_0x5d7780(0x1e6)][_0x5d7780(0x1f7)],_0x6573ed);}for(const _0x12ccd7 of _0x392419){_0x25b93b[_0x5d7780(0x112)](_0x12ccd7[_0x5d7780(0x1e6)][_0x5d7780(0x1cd)][_0x5d7780(0x1a9)](),_0x12ccd7);}for(const _0x2a0b0f of _0x1f3e7e){_0x271f25[_0x5d7780(0x112)](_0x2a0b0f['attributes'][_0x5d7780(0x1f7)],_0x2a0b0f);}for(const _0x55480a of _0x57afa2){_0x40c197[_0x5d7780(0x112)](_0x55480a[_0x5d7780(0x1e6)][_0x5d7780(0x1f7)],_0x55480a);}const _0x28480a=new Map(),_0x41977b=new Map();for(const _0x159f50 of _0x53833d){_0x28480a['set'](_0x159f50[_0x5d7780(0x1e6)][_0x5d7780(0x1f7)],_0x159f50);}for(const _0x58a732 of _0x758d2){_0x41977b['set'](_0x58a732['attributes'][_0x5d7780(0x1f7)],_0x58a732);}const _0x12fd05=new Map(),_0x3b98e2=new Map();for(const _0x51e33e of _0x1e7714){_0x12fd05[_0x5d7780(0x112)](_0x51e33e[_0x5d7780(0x1e6)][_0x5d7780(0x1f7)],_0x51e33e['id']),_0x3b98e2['set'](_0x51e33e['id'],_0x51e33e[_0x5d7780(0x1e6)][_0x5d7780(0x1f7)]);}const _0x40b412=new Map(),_0x4a1ada=new Map();for(const _0x5293cc of _0x10fd5f){_0x40b412[_0x5d7780(0x112)](_0x5293cc[_0x5d7780(0x1e6)]['name'],_0x5293cc['id']),_0x4a1ada['set'](_0x5293cc['id'],_0x5293cc[_0x5d7780(0x1e6)][_0x5d7780(0x1f7)]);}const _0x43fdfa=_0x2bb111[_0x5d7780(0x131)][_0x5d7780(0x1d0)]||new Map(),_0x431e3b=_0x2bb111[_0x5d7780(0x131)][_0x5d7780(0x1ca)]||new Map(),_0x36867e=_0x2bb111['nameToId'][_0x5d7780(0x19c)]||new Map(),_0x1d5632=new Map(),_0x1def54={'resolveToolTargetName':buildNameResolver({..._0x2bb111[_0x5d7780(0xfd)],'Agent':_0x3b98e2}),'resolvePromptName':async _0x521c29=>_0x4a1ada[_0x5d7780(0x17b)](_0x521c29),'onWarning':_0x1073d6=>this[_0x5d7780(0x1f8)][_0x5d7780(0x12a)](_0x1073d6)};let _0x3a4dae=[];const _0xff9619={'projectId':_0x6ea14b,'resolveToolTargetId':buildIdResolver({..._0x2bb111['nameToId'],'Agent':_0x12fd05}),'resolvePromptId':async _0x18e742=>_0x40b412[_0x5d7780(0x17b)](_0x18e742),'onWarning':_0x40ac92=>{const _0x3ee561=_0x5d7780;this['logger'][_0x3ee561(0x12a)](_0x40ac92),_0x3a4dae['push'](_0x40ac92);}},{resolved:_0x532911,unresolved:_0x5590fc}=resolveAgentDependencies(_0x4ec243,new Set(_0x53d234[_0x5d7780(0x1bf)]()));for(const {agent:_0x3bb77f,missingDeps:_0x8e5a82}of _0x5590fc){_0x79f757[_0x5d7780(0x125)][_0x5d7780(0x1aa)]({'agentName':_0x3bb77f[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x20f),'error':_0x5d7780(0x111)+_0x8e5a82[_0x5d7780(0x11a)](',\x20')+'.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.'}),_0x79f757[_0x5d7780(0x148)]['agents'][_0x5d7780(0x16e)]++;}for(const _0x335ea8 of _0x9e8f2f){const _0x4ecb84=_0x5369d3['get'](_0x335ea8[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)]),_0x1c9d7b=a138_0x406b9a['readFileSync'](_0x335ea8[_0x5d7780(0x1f3)],'utf-8');if(_0x4ecb84){const _0x45867c=apiKnowledgeBaseToYaml(_0x4ecb84),_0x55cf1d=toKnowledgeBaseYamlString(_0x45867c),_0x509f89=generateDiff(_0x55cf1d,_0x1c9d7b),_0x19d245=hasChanges(_0x509f89);_0x19d245?(_0x79f757[_0x5d7780(0x144)][_0x5d7780(0x1aa)]({'name':_0x335ea8[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1db),'id':_0x4ecb84['id'],'diff':formatDiffWithColors(_0x509f89)}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x144)]['updated']++):(_0x79f757[_0x5d7780(0x144)]['push']({'name':_0x335ea8['yaml'][_0x5d7780(0x1f7)],'action':_0x5d7780(0x132),'id':_0x4ecb84['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x144)][_0x5d7780(0x132)]++);}else _0x79f757['knowledgeBases'][_0x5d7780(0x1aa)]({'name':_0x335ea8[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1af)}),_0x79f757[_0x5d7780(0x148)]['knowledgeBases'][_0x5d7780(0x1af)]++;}for(const _0x57ab20 of _0x4cf973){const _0x38d63d=_0x3f64fc[_0x5d7780(0x17b)](_0x57ab20[_0x5d7780(0x1f7)]),_0xd20c2d=a138_0x406b9a['readFileSync'](_0x57ab20['path'],'utf-8');if(_0x38d63d){const _0x4bd877=toTextKnowledgeBaseMd(_0x38d63d[_0x5d7780(0x1e6)]['name'],_0x38d63d[_0x5d7780(0x1e6)]['text']),_0x5d89a4=generateDiff(_0x4bd877,_0xd20c2d),_0x136687=hasChanges(_0x5d89a4);_0x136687?(_0x79f757['textKnowledgeBases'][_0x5d7780(0x1aa)]({'name':_0x57ab20[_0x5d7780(0x1f7)],'action':'updated','id':_0x38d63d['id'],'diff':formatDiffWithColors(_0x5d89a4)}),_0x79f757[_0x5d7780(0x148)]['textKnowledgeBases'][_0x5d7780(0x1db)]++):(_0x79f757[_0x5d7780(0x14f)][_0x5d7780(0x1aa)]({'name':_0x57ab20[_0x5d7780(0x1f7)],'action':'unchanged','id':_0x38d63d['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x14f)]['unchanged']++);}else _0x79f757[_0x5d7780(0x14f)]['push']({'name':_0x57ab20[_0x5d7780(0x1f7)],'action':_0x5d7780(0x1af)}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x14f)][_0x5d7780(0x1af)]++;}for(const _0x39fb49 of _0x532911){const _0x42ea1f=_0x53d234[_0x5d7780(0x17b)](_0x39fb49[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)]),_0x1faf31=a138_0x3662d8['join'](_0x39fb49[_0x5d7780(0x1f0)],_0x5d7780(0x142)),_0x57bd56=a138_0x406b9a['readFileSync'](_0x1faf31,_0x5d7780(0x1d3)),_0x17f5bb=_0x39fb49[_0x5d7780(0x1ba)],_0x1c628d='#\x20prompt.md\x0a'+_0x17f5bb+_0x5d7780(0x1dd)+_0x57bd56;if(_0x42ea1f){const {yaml:_0x2c994a,systemPrompt:_0x24c5d8}=await agentResponseToDef(_0x42ea1f,_0x1def54),_0x4f3dfd=toAgentYamlString(_0x2c994a),_0x588a71=_0x5d7780(0x190)+_0x24c5d8+_0x5d7780(0x1dd)+_0x4f3dfd,_0x587860=generateDiff(_0x588a71,_0x1c628d),_0x147fb6=hasChanges(_0x587860);_0x147fb6?(_0x79f757[_0x5d7780(0x125)][_0x5d7780(0x1aa)]({'agentName':_0x39fb49[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':'updated','agentId':_0x42ea1f['id'],'diff':formatDiffWithColors(_0x587860)}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x125)][_0x5d7780(0x1db)]++):(_0x79f757[_0x5d7780(0x125)][_0x5d7780(0x1aa)]({'agentName':_0x39fb49['yaml'][_0x5d7780(0x1f7)],'action':_0x5d7780(0x132),'agentId':_0x42ea1f['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x125)][_0x5d7780(0x132)]++);}else _0x79f757[_0x5d7780(0x125)][_0x5d7780(0x1aa)]({'agentName':_0x39fb49[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1af)}),_0x79f757['counts'][_0x5d7780(0x125)]['created']++;}for(const _0x4cdff1 of _0x14416d){const _0x4ab6d3=_0x538725[_0x5d7780(0x17b)](_0x4cdff1[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)]),_0x56a3a6=a138_0x406b9a[_0x5d7780(0x13d)](_0x4cdff1[_0x5d7780(0x1f3)],_0x5d7780(0x1d3));if(_0x4ab6d3){const _0x45462f=await apiPromptToYaml(_0x4ab6d3,_0x1def54);if(!_0x45462f){_0x79f757[_0x5d7780(0xff)][_0x5d7780(0x1aa)]({'name':_0x4cdff1[_0x5d7780(0x1ab)]['name'],'action':_0x5d7780(0x1db),'id':_0x4ab6d3['id']}),_0x79f757['counts'][_0x5d7780(0xff)]['updated']++;continue;}const _0x480b3f=toPromptYamlString(_0x45462f),_0x412c93=generateDiff(_0x480b3f,_0x56a3a6),_0x560f10=hasChanges(_0x412c93);_0x560f10?(_0x79f757[_0x5d7780(0xff)][_0x5d7780(0x1aa)]({'name':_0x4cdff1[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1db),'id':_0x4ab6d3['id'],'diff':formatDiffWithColors(_0x412c93)}),_0x79f757['counts'][_0x5d7780(0xff)][_0x5d7780(0x1db)]++):(_0x79f757[_0x5d7780(0xff)][_0x5d7780(0x1aa)]({'name':_0x4cdff1[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':'unchanged','id':_0x4ab6d3['id']}),_0x79f757['counts'][_0x5d7780(0xff)][_0x5d7780(0x132)]++);}else _0x79f757[_0x5d7780(0xff)]['push']({'name':_0x4cdff1[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1af)}),_0x79f757['counts']['prompts'][_0x5d7780(0x1af)]++;}for(const _0x16a383 of _0x30fc7a){const _0x1503c8=_0x25b93b[_0x5d7780(0x17b)](_0x16a383[_0x5d7780(0x1ab)][_0x5d7780(0x1de)]),_0x17390b=a138_0x406b9a[_0x5d7780(0x13d)](_0x16a383[_0x5d7780(0x1f3)],_0x5d7780(0x1d3));if(_0x1503c8){const _0x2bdaf2=await apiIntegrationToYaml(_0x1503c8,_0x1def54),_0x371141=toIntegrationYamlString(_0x2bdaf2),_0x597c8c=generateDiff(_0x371141,_0x17390b),_0x4ece33=hasChanges(_0x597c8c);_0x4ece33?(_0x79f757[_0x5d7780(0x14b)][_0x5d7780(0x1aa)]({'name':_0x16a383['yaml'][_0x5d7780(0x1de)],'action':_0x5d7780(0x1db),'id':_0x1503c8['id'],'diff':formatDiffWithColors(_0x597c8c)}),_0x79f757[_0x5d7780(0x148)]['integrations'][_0x5d7780(0x1db)]++):(_0x79f757[_0x5d7780(0x14b)][_0x5d7780(0x1aa)]({'name':_0x16a383[_0x5d7780(0x1ab)]['service_type'],'action':_0x5d7780(0x132),'id':_0x1503c8['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x14b)]['unchanged']++);}else _0x79f757[_0x5d7780(0x14b)]['push']({'name':_0x16a383[_0x5d7780(0x1ab)][_0x5d7780(0x1de)],'action':'created'}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x14b)][_0x5d7780(0x1af)]++;}for(const _0x4cd6df of _0x22dce6){const _0x3441f7=_0x271f25[_0x5d7780(0x17b)](_0x4cd6df[_0x5d7780(0x118)][_0x5d7780(0x1f7)]),_0x6c2910=toExperimentalKnowledgeBaseYamlString(_0x4cd6df[_0x5d7780(0x118)]);let _0x1b0f61=_0x6c2910;for(const _0x2a62e3 of _0x4cd6df['def'][_0x5d7780(0x120)]){_0x1b0f61+=_0x5d7780(0x128)+_0x2a62e3[_0x5d7780(0x1f7)]+_0x5d7780(0x1d8)+_0x2a62e3[_0x5d7780(0x205)]+_0x5d7780(0x1e0)+_0x2a62e3[_0x5d7780(0x1f7)]+_0x5d7780(0x1d8)+_0x2a62e3[_0x5d7780(0x1c8)]+'\x0a';}if(_0x3441f7){const _0x155b00=apiExperimentalKnowledgeBaseToYaml(_0x3441f7),_0x29b326=toExperimentalKnowledgeBaseYamlString(_0x155b00);let _0x4f935f=_0x29b326;for(const _0x5ea52f of _0x155b00[_0x5d7780(0x120)]){_0x4f935f+=_0x5d7780(0x128)+_0x5ea52f[_0x5d7780(0x1f7)]+_0x5d7780(0x1d8)+_0x5ea52f[_0x5d7780(0x205)]+'\x0a---\x20schema:\x20'+_0x5ea52f['name']+_0x5d7780(0x1d8)+_0x5ea52f['json_schema']+'\x0a';}const _0x3cfc4c=generateDiff(_0x4f935f,_0x1b0f61),_0x319245=hasChanges(_0x3cfc4c);_0x319245?(_0x79f757['experimentalKnowledgeBases']['push']({'name':_0x4cd6df['def'][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1db),'id':_0x3441f7['id'],'diff':formatDiffWithColors(_0x3cfc4c)}),_0x79f757['counts'][_0x5d7780(0x1dc)][_0x5d7780(0x1db)]++):(_0x79f757[_0x5d7780(0x1dc)][_0x5d7780(0x1aa)]({'name':_0x4cd6df[_0x5d7780(0x118)][_0x5d7780(0x1f7)],'action':'unchanged','id':_0x3441f7['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x1dc)][_0x5d7780(0x132)]++);}else _0x79f757[_0x5d7780(0x1dc)][_0x5d7780(0x1aa)]({'name':_0x4cd6df[_0x5d7780(0x118)][_0x5d7780(0x1f7)],'action':'created'}),_0x79f757[_0x5d7780(0x148)]['experimentalKnowledgeBases'][_0x5d7780(0x1af)]++;}for(const _0x5409c4 of _0xf20956){const _0x4f2c97=_0x40c197[_0x5d7780(0x17b)](_0x5409c4['def'][_0x5d7780(0x1f7)]),_0x150d54=toExperimentalArtifactYamlString(_0x5409c4[_0x5d7780(0x118)]);let _0x49aaf0=_0x150d54+(_0x5d7780(0x1b5)+_0x5409c4[_0x5d7780(0x118)]['code']+'\x0a');for(const _0x3f85f0 of _0x5409c4[_0x5d7780(0x118)][_0x5d7780(0x130)]){_0x49aaf0+=_0x5d7780(0x20c)+_0x3f85f0[_0x5d7780(0x106)]+_0x5d7780(0x1d8)+_0x3f85f0['text_content']+'\x0a';}if(_0x4f2c97){const _0x4076a6=apiExperimentalArtifactToYaml(_0x4f2c97),_0x32f130=toExperimentalArtifactYamlString(_0x4076a6);let _0x1a02fc=_0x32f130+('\x0a---\x20code\x20---\x0a'+_0x4076a6[_0x5d7780(0x205)]+'\x0a');for(const _0x24a37c of _0x4076a6[_0x5d7780(0x130)]){_0x1a02fc+=_0x5d7780(0x20c)+_0x24a37c['file_name']+_0x5d7780(0x1d8)+_0x24a37c[_0x5d7780(0x15a)]+'\x0a';}const _0xe59b96=generateDiff(_0x1a02fc,_0x49aaf0),_0x33d066=hasChanges(_0xe59b96);_0x33d066?(_0x79f757['experimentalArtifacts'][_0x5d7780(0x1aa)]({'name':_0x5409c4[_0x5d7780(0x118)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1db),'id':_0x4f2c97['id'],'diff':formatDiffWithColors(_0xe59b96)}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x1ad)][_0x5d7780(0x1db)]++):(_0x79f757[_0x5d7780(0x1ad)][_0x5d7780(0x1aa)]({'name':_0x5409c4['def'][_0x5d7780(0x1f7)],'action':'unchanged','id':_0x4f2c97['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x1ad)][_0x5d7780(0x132)]++);}else _0x79f757[_0x5d7780(0x1ad)][_0x5d7780(0x1aa)]({'name':_0x5409c4['def'][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1af)}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x1ad)]['created']++;}for(const _0x1fde42 of _0x4caa50){const _0x338af3=_0x28480a[_0x5d7780(0x17b)](_0x1fde42['yaml']['name']),_0x4b0071=a138_0x406b9a['readFileSync'](_0x1fde42[_0x5d7780(0x1f3)],_0x5d7780(0x1d3));if(_0x338af3){const _0xee478f=await apiFormInterfaceToYaml(_0x338af3,_0x1def54),_0x13e6c2=toFormInterfaceYamlString(_0xee478f),_0x4157f3=generateDiff(_0x13e6c2,_0x4b0071),_0x21f643=hasChanges(_0x4157f3);_0x21f643?(_0x79f757['formInterfaces']['push']({'name':_0x1fde42['yaml']['name'],'action':_0x5d7780(0x1db),'id':_0x338af3['id'],'diff':formatDiffWithColors(_0x4157f3)}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x200)]['updated']++):(_0x79f757['formInterfaces']['push']({'name':_0x1fde42[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x132),'id':_0x338af3['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x200)][_0x5d7780(0x132)]++);}else _0x79f757['formInterfaces']['push']({'name':_0x1fde42[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':'created'}),_0x79f757['counts'][_0x5d7780(0x200)][_0x5d7780(0x1af)]++;}for(const _0x459a36 of _0x54e00f){const _0x5e78f4=_0x41977b['get'](_0x459a36[_0x5d7780(0x1ab)]['name']),_0xc59659=a138_0x406b9a['readFileSync'](_0x459a36['path'],_0x5d7780(0x1d3));if(_0x5e78f4){const _0xddb310=await apiChatInterfaceToYaml(_0x5e78f4,_0x1def54),_0x264c0d=toChatInterfaceYamlString(_0xddb310),_0x32bad2=generateDiff(_0x264c0d,_0xc59659),_0x2c950f=hasChanges(_0x32bad2);_0x2c950f?(_0x79f757[_0x5d7780(0x13e)]['push']({'name':_0x459a36['yaml'][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1db),'id':_0x5e78f4['id'],'diff':formatDiffWithColors(_0x32bad2)}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x13e)][_0x5d7780(0x1db)]++):(_0x79f757[_0x5d7780(0x13e)]['push']({'name':_0x459a36[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x132),'id':_0x5e78f4['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x13e)][_0x5d7780(0x132)]++);}else _0x79f757[_0x5d7780(0x13e)]['push']({'name':_0x459a36[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1af)}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x13e)][_0x5d7780(0x1af)]++;}if(_0x551e1a?.[_0x5d7780(0x199)])return _0x79f757;_0x79f757[_0x5d7780(0x144)]=[],_0x79f757[_0x5d7780(0x14f)]=[],_0x79f757[_0x5d7780(0xff)]=[],_0x79f757[_0x5d7780(0x14b)]=[],_0x79f757[_0x5d7780(0x1dc)]=[],_0x79f757['experimentalArtifacts']=[],_0x79f757['formInterfaces']=[],_0x79f757[_0x5d7780(0x13e)]=[];const _0x10a71d=_0x79f757[_0x5d7780(0x125)][_0x5d7780(0x14c)](_0x3e66d0=>_0x3e66d0[_0x5d7780(0x122)]==='error');_0x79f757[_0x5d7780(0x125)]=_0x10a71d,_0x79f757['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x10a71d['length']},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x18e1e8 of _0x9e8f2f){try{const _0x1ac2eb=_0x5369d3[_0x5d7780(0x17b)](_0x18e1e8[_0x5d7780(0x1ab)]['name']),_0x4126c0=yamlKnowledgeBaseToApi(_0x18e1e8[_0x5d7780(0x1ab)],_0x6ea14b);if(_0x1ac2eb)await this[_0x5d7780(0x1d4)][_0x5d7780(0x129)](_0x1ac2eb['id'],_0x4126c0),_0x43fdfa[_0x5d7780(0x112)](_0x18e1e8[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],_0x1ac2eb['id']),_0x79f757[_0x5d7780(0x144)][_0x5d7780(0x1aa)]({'name':_0x18e1e8['yaml']['name'],'action':'updated','id':_0x1ac2eb['id']}),_0x79f757['counts'][_0x5d7780(0x144)][_0x5d7780(0x1db)]++;else{const _0x3930e4=await this['client'][_0x5d7780(0x1a1)](_0x4126c0);_0x43fdfa['set'](_0x18e1e8['yaml'][_0x5d7780(0x1f7)],_0x3930e4['id']),_0x79f757[_0x5d7780(0x144)]['push']({'name':_0x18e1e8['yaml'][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1af),'id':_0x3930e4['id']}),_0x79f757['counts'][_0x5d7780(0x144)][_0x5d7780(0x1af)]++;}}catch(_0x5f0a97){_0x79f757[_0x5d7780(0x144)]['push']({'name':_0x18e1e8['yaml'][_0x5d7780(0x1f7)],'action':'error','error':_0x5f0a97['message']}),_0x79f757[_0x5d7780(0x148)]['knowledgeBases'][_0x5d7780(0x16e)]++;}}for(const _0x3b76a2 of _0x4cf973){try{const _0x2671f4=_0x3f64fc[_0x5d7780(0x17b)](_0x3b76a2[_0x5d7780(0x1f7)]),_0xb19f01=yamlTextKnowledgeBaseToApi({'name':_0x3b76a2[_0x5d7780(0x1f7)],'text':_0x3b76a2[_0x5d7780(0x1be)]},_0x6ea14b);if(_0x2671f4)await this[_0x5d7780(0x1d4)]['updateTextKnowledgeBase'](_0x2671f4['id'],_0xb19f01),_0x431e3b[_0x5d7780(0x112)](_0x3b76a2[_0x5d7780(0x1f7)],_0x2671f4['id']),_0x79f757[_0x5d7780(0x14f)][_0x5d7780(0x1aa)]({'name':_0x3b76a2[_0x5d7780(0x1f7)],'action':_0x5d7780(0x1db),'id':_0x2671f4['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x14f)]['updated']++;else{const _0x572370=await this['client'][_0x5d7780(0x19a)](_0xb19f01);_0x431e3b[_0x5d7780(0x112)](_0x3b76a2[_0x5d7780(0x1f7)],_0x572370['id']),_0x79f757[_0x5d7780(0x14f)][_0x5d7780(0x1aa)]({'name':_0x3b76a2[_0x5d7780(0x1f7)],'action':_0x5d7780(0x1af),'id':_0x572370['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x14f)][_0x5d7780(0x1af)]++;}}catch(_0x2fbda4){_0x79f757[_0x5d7780(0x14f)][_0x5d7780(0x1aa)]({'name':_0x3b76a2[_0x5d7780(0x1f7)],'action':_0x5d7780(0x20f),'error':_0x2fbda4[_0x5d7780(0x194)]}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x14f)][_0x5d7780(0x16e)]++;}}for(const _0x23a198 of _0x22dce6){try{const _0x2ce4fa=_0x271f25[_0x5d7780(0x17b)](_0x23a198[_0x5d7780(0x118)]['name']),_0x203894=yamlExperimentalKnowledgeBaseToApi(_0x23a198['def'],_0x6ea14b);if(_0x2ce4fa)await this[_0x5d7780(0x1d4)][_0x5d7780(0x193)](_0x2ce4fa['id'],_0x203894),_0x36867e[_0x5d7780(0x112)](_0x23a198[_0x5d7780(0x118)][_0x5d7780(0x1f7)],_0x2ce4fa['id']),_0x79f757['experimentalKnowledgeBases'][_0x5d7780(0x1aa)]({'name':_0x23a198[_0x5d7780(0x118)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1db),'id':_0x2ce4fa['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x1dc)][_0x5d7780(0x1db)]++;else{const _0x39cef5=await this[_0x5d7780(0x1d4)][_0x5d7780(0x163)](_0x203894);_0x36867e[_0x5d7780(0x112)](_0x23a198[_0x5d7780(0x118)]['name'],_0x39cef5['id']),_0x79f757[_0x5d7780(0x1dc)]['push']({'name':_0x23a198[_0x5d7780(0x118)][_0x5d7780(0x1f7)],'action':'created','id':_0x39cef5['id']}),_0x79f757['counts']['experimentalKnowledgeBases']['created']++;}}catch(_0x26fa4b){_0x79f757['experimentalKnowledgeBases'][_0x5d7780(0x1aa)]({'name':_0x23a198[_0x5d7780(0x118)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x20f),'error':_0x26fa4b[_0x5d7780(0x194)]}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x1dc)]['errors']++;}}for(const _0x4912d6 of _0xf20956){try{const _0x4c0920=_0x40c197[_0x5d7780(0x17b)](_0x4912d6[_0x5d7780(0x118)][_0x5d7780(0x1f7)]),_0x1eb47c=yamlExperimentalArtifactToApi(_0x4912d6['def'],_0x6ea14b);if(_0x4c0920)await this[_0x5d7780(0x1d4)][_0x5d7780(0x1d6)](_0x4c0920['id'],_0x1eb47c),_0x1d5632[_0x5d7780(0x112)](_0x4912d6[_0x5d7780(0x118)]['name'],_0x4c0920['id']),_0x79f757[_0x5d7780(0x1ad)][_0x5d7780(0x1aa)]({'name':_0x4912d6['def'][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1db),'id':_0x4c0920['id']}),_0x79f757[_0x5d7780(0x148)]['experimentalArtifacts'][_0x5d7780(0x1db)]++;else{const _0x200c58=await this[_0x5d7780(0x1d4)][_0x5d7780(0x127)](_0x1eb47c);_0x1d5632[_0x5d7780(0x112)](_0x4912d6['def'][_0x5d7780(0x1f7)],_0x200c58['id']),_0x79f757[_0x5d7780(0x1ad)][_0x5d7780(0x1aa)]({'name':_0x4912d6['def']['name'],'action':_0x5d7780(0x1af),'id':_0x200c58['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x1ad)][_0x5d7780(0x1af)]++;}}catch(_0x4a81bd){_0x79f757[_0x5d7780(0x1ad)][_0x5d7780(0x1aa)]({'name':_0x4912d6[_0x5d7780(0x118)][_0x5d7780(0x1f7)],'action':'error','error':_0x4a81bd['message']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x1ad)][_0x5d7780(0x16e)]++;}}for(const _0x2abd75 of _0x532911){_0x3a4dae=[];try{const _0x10e1b1=_0x53d234[_0x5d7780(0x17b)](_0x2abd75[_0x5d7780(0x1ab)]['name']),_0x5b44ce=await agentDefToRequest(_0x2abd75[_0x5d7780(0x1ab)],_0x2abd75['systemPrompt'],_0x2abd75['starterMessage'],_0xff9619);if(_0x10e1b1)await this[_0x5d7780(0x1d4)][_0x5d7780(0x11c)](_0x10e1b1['id'],_0x5b44ce),_0x12fd05['set'](_0x2abd75['yaml'][_0x5d7780(0x1f7)],_0x10e1b1['id']),_0x79f757[_0x5d7780(0x125)][_0x5d7780(0x1aa)]({'agentName':_0x2abd75[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1db),'agentId':_0x10e1b1['id'],'warnings':_0x3a4dae[_0x5d7780(0x1eb)]>0x0?_0x3a4dae:undefined}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x125)][_0x5d7780(0x1db)]++;else{const _0x839858=await this[_0x5d7780(0x1d4)][_0x5d7780(0x18e)](_0x5b44ce);_0x12fd05[_0x5d7780(0x112)](_0x2abd75['yaml'][_0x5d7780(0x1f7)],_0x839858['id']),_0x79f757[_0x5d7780(0x125)]['push']({'agentName':_0x2abd75['yaml'][_0x5d7780(0x1f7)],'action':'created','agentId':_0x839858['id'],'warnings':_0x3a4dae['length']>0x0?_0x3a4dae:undefined}),_0x79f757['counts']['agents'][_0x5d7780(0x1af)]++;}}catch(_0x5a6db4){_0x79f757[_0x5d7780(0x125)][_0x5d7780(0x1aa)]({'agentName':_0x2abd75[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':'error','error':_0x5a6db4[_0x5d7780(0x194)],'warnings':_0x3a4dae['length']>0x0?_0x3a4dae:undefined}),_0x79f757[_0x5d7780(0x148)]['agents']['errors']++;}}for(const _0x5eb1a2 of _0x14416d){try{const _0x1c9aed=_0x538725['get'](_0x5eb1a2['yaml'][_0x5d7780(0x1f7)]),_0x1c97d7=await yamlPromptToApi(_0x5eb1a2[_0x5d7780(0x1ab)],_0x6ea14b,_0xff9619);if(!_0x1c97d7){_0x79f757[_0x5d7780(0xff)][_0x5d7780(0x1aa)]({'name':_0x5eb1a2[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x20f),'error':_0x5d7780(0x212)}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0xff)]['errors']++;continue;}if(_0x1c9aed)await this[_0x5d7780(0x1d4)][_0x5d7780(0x134)](_0x1c9aed['id'],_0x1c97d7),_0x40b412[_0x5d7780(0x112)](_0x5eb1a2[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],_0x1c9aed['id']),_0x79f757[_0x5d7780(0xff)]['push']({'name':_0x5eb1a2[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1db),'id':_0x1c9aed['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0xff)][_0x5d7780(0x1db)]++;else{const _0x2ed54b=await this[_0x5d7780(0x1d4)][_0x5d7780(0x1e7)](_0x1c97d7);_0x40b412[_0x5d7780(0x112)](_0x5eb1a2[_0x5d7780(0x1ab)]['name'],_0x2ed54b['id']),_0x79f757['prompts'][_0x5d7780(0x1aa)]({'name':_0x5eb1a2['yaml'][_0x5d7780(0x1f7)],'action':'created','id':_0x2ed54b['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0xff)][_0x5d7780(0x1af)]++;}}catch(_0x153395){_0x79f757[_0x5d7780(0xff)]['push']({'name':_0x5eb1a2[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x20f),'error':_0x153395[_0x5d7780(0x194)]}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0xff)][_0x5d7780(0x16e)]++;}}for(const _0x5405bb of _0x30fc7a){try{const _0x5a7c13=_0x25b93b['get'](_0x5405bb['yaml'][_0x5d7780(0x1de)]),_0x28e8e6=await yamlIntegrationToApi(_0x5405bb[_0x5d7780(0x1ab)],_0x6ea14b,_0xff9619);if(_0x5a7c13){await this[_0x5d7780(0x1d4)][_0x5d7780(0x1e9)](_0x5a7c13['id']);const _0x3a096c=await this[_0x5d7780(0x1d4)]['createIntegration'](_0x28e8e6);_0x79f757[_0x5d7780(0x14b)][_0x5d7780(0x1aa)]({'name':_0x5405bb[_0x5d7780(0x1ab)][_0x5d7780(0x1de)],'action':_0x5d7780(0x1db),'id':_0x3a096c['id']}),_0x79f757['counts'][_0x5d7780(0x14b)][_0x5d7780(0x1db)]++;}else{const _0x2d450a=await this[_0x5d7780(0x1d4)][_0x5d7780(0x109)](_0x28e8e6);_0x79f757['integrations'][_0x5d7780(0x1aa)]({'name':_0x5405bb['yaml']['service_type'],'action':'created','id':_0x2d450a['id']}),_0x79f757['counts'][_0x5d7780(0x14b)][_0x5d7780(0x1af)]++;}}catch(_0x344e7e){_0x79f757[_0x5d7780(0x14b)][_0x5d7780(0x1aa)]({'name':_0x5405bb[_0x5d7780(0x1ab)][_0x5d7780(0x1de)],'action':'error','error':_0x344e7e['message']}),_0x79f757['counts'][_0x5d7780(0x14b)][_0x5d7780(0x16e)]++;}}for(const _0x5db3df of _0x4caa50){try{const _0x4cc187=_0x28480a['get'](_0x5db3df['yaml'][_0x5d7780(0x1f7)]),_0x3d899e=await yamlFormInterfaceToApi(_0x5db3df['yaml'],_0x6ea14b,_0xff9619);if(!_0x3d899e){_0x79f757['formInterfaces'][_0x5d7780(0x1aa)]({'name':_0x5db3df[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x20f),'error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x200)][_0x5d7780(0x16e)]++;continue;}if(_0x4cc187){const _0x426d2b=await this[_0x5d7780(0x1d4)][_0x5d7780(0x14d)](_0x4cc187['id'],_0x3d899e);_0x79f757[_0x5d7780(0x200)]['push']({'name':_0x5db3df[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1db),'id':_0x426d2b['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x200)]['updated']++;}else{const _0x416a6c=await this['client'][_0x5d7780(0x1a0)](_0x3d899e);_0x79f757[_0x5d7780(0x200)][_0x5d7780(0x1aa)]({'name':_0x5db3df[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1af),'id':_0x416a6c['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x200)]['created']++;}}catch(_0xbd6821){_0x79f757[_0x5d7780(0x200)][_0x5d7780(0x1aa)]({'name':_0x5db3df[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x20f),'error':_0xbd6821['message']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x200)][_0x5d7780(0x16e)]++;}}for(const _0x59c4ed of _0x54e00f){try{const _0x2b8a6f=_0x41977b['get'](_0x59c4ed['yaml'][_0x5d7780(0x1f7)]),_0x5ce55b=await yamlChatInterfaceToApi(_0x59c4ed['yaml'],_0x6ea14b,_0xff9619);if(_0x2b8a6f){const _0x8c5ff4=await this['client']['updateChatInterface'](_0x2b8a6f['id'],_0x5ce55b);_0x79f757[_0x5d7780(0x13e)][_0x5d7780(0x1aa)]({'name':_0x59c4ed['yaml'][_0x5d7780(0x1f7)],'action':_0x5d7780(0x1db),'id':_0x8c5ff4['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x13e)]['updated']++;}else{const _0x187a01=await this['client'][_0x5d7780(0x114)](_0x5ce55b);_0x79f757['chatInterfaces']['push']({'name':_0x59c4ed[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':'created','id':_0x187a01['id']}),_0x79f757[_0x5d7780(0x148)][_0x5d7780(0x13e)][_0x5d7780(0x1af)]++;}}catch(_0x5c7292){_0x79f757['chatInterfaces'][_0x5d7780(0x1aa)]({'name':_0x59c4ed[_0x5d7780(0x1ab)][_0x5d7780(0x1f7)],'action':_0x5d7780(0x20f),'error':_0x5c7292[_0x5d7780(0x194)]}),_0x79f757['counts'][_0x5d7780(0x13e)][_0x5d7780(0x16e)]++;}}return _0x79f757;}async[a138_0x262c49(0x177)](_0x585a83,_0x218489,_0x5b4792,_0x3754f4){const _0x48373b=a138_0x262c49,{projectId:_0x2e71e5,project:_0x3a458c}=await this[_0x48373b(0x1bb)](_0x585a83),_0x2dea3b=_0x3a458c[_0x48373b(0x1e6)][_0x48373b(0x1f7)],_0xcaea8d=await this[_0x48373b(0x1d4)][_0x48373b(0x10a)](_0x2e71e5),_0x42dfb9=_0xcaea8d[_0x48373b(0x206)](_0x1574eb=>_0x1574eb['attributes'][_0x48373b(0x1f7)]===_0x218489);if(!_0x42dfb9)throw new SDKError(ErrorCode[_0x48373b(0xf6)],'Agent\x20not\x20found:\x20'+_0x218489,undefined,{'helpText':_0x48373b(0x10b)+_0xcaea8d[_0x48373b(0x17d)](_0x2011bf=>_0x2011bf[_0x48373b(0x1e6)][_0x48373b(0x1f7)])[_0x48373b(0x11a)](',\x20')});let _0x56d889;if(_0x5b4792)_0x56d889=_0x5b4792;else{const _0x450ae4=a138_0x3662d8[_0x48373b(0x11a)](process[_0x48373b(0x126)](),_0x48373b(0x125)),_0x3c9f25=getSanitizedPathWithMigration(_0x450ae4,_0x2dea3b);_0x3c9f25[_0x48373b(0x21b)]&&this[_0x48373b(0x1f8)][_0x48373b(0x211)](_0x48373b(0x20a)+a138_0x3662d8[_0x48373b(0x182)](_0x3c9f25[_0x48373b(0x1e8)])+_0x48373b(0x105)+a138_0x3662d8[_0x48373b(0x182)](_0x3c9f25[_0x48373b(0x1f3)])),_0x56d889=_0x3c9f25[_0x48373b(0x1f3)];}const _0x3e70e3=getSanitizedPathWithMigration(_0x56d889,_0x218489);_0x3e70e3[_0x48373b(0x21b)]&&this[_0x48373b(0x1f8)][_0x48373b(0x211)]('Renamed\x20agent\x20folder:\x20'+a138_0x3662d8[_0x48373b(0x182)](_0x3e70e3[_0x48373b(0x1e8)])+_0x48373b(0x105)+a138_0x3662d8[_0x48373b(0x182)](_0x3e70e3['path']));const _0x299466=_0x3e70e3[_0x48373b(0x1f3)],_0x1ce45b=new Map(),_0xcb25c2=new Map(),_0x497ae5=await this[_0x48373b(0x1d4)][_0x48373b(0x19e)](_0x2e71e5),_0x2335fe=await this['client'][_0x48373b(0x14a)](_0x2e71e5),_0x2f7d33=await safeListOrEmpty(()=>this[_0x48373b(0x1d4)]['listExperimentalKnowledgeBases'](_0x2e71e5)),_0xb6b210=new Map(),_0x59de69=new Map();for(const _0x27b529 of _0x497ae5){_0x1ce45b[_0x48373b(0x112)](_0x27b529['id'],_0x27b529[_0x48373b(0x1e6)][_0x48373b(0x1f7)]);}for(const _0x33e5e9 of _0x2335fe){_0xb6b210['set'](_0x33e5e9['id'],_0x33e5e9['attributes'][_0x48373b(0x1f7)]);}for(const _0xd388c5 of _0x2f7d33){_0x59de69[_0x48373b(0x112)](_0xd388c5['id'],_0xd388c5[_0x48373b(0x1e6)]['name']);}for(const _0x4e73a0 of _0xcaea8d){_0xcb25c2[_0x48373b(0x112)](_0x4e73a0['id'],_0x4e73a0['attributes']['name']);}const _0x351a6c={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x1ce45b,'TextKnowledgeBase':_0xb6b210,'Agent':_0xcb25c2,'ExperimentalKnowledgeBase':_0x59de69}),'resolvePromptName':async()=>undefined,'onWarning':_0x12a120=>this[_0x48373b(0x1f8)][_0x48373b(0x12a)](_0x12a120)},_0x1243f1=a138_0x3662d8[_0x48373b(0x11a)](_0x299466,_0x48373b(0xfb)),_0x283bd7=a138_0x3662d8['join'](_0x299466,'agent.yml'),_0x2b673a=a138_0x3662d8['join'](_0x299466,_0x48373b(0x11b)),_0x55cda5=!a138_0x406b9a[_0x48373b(0x20d)](_0x283bd7);if(_0x3754f4?.['dryRun'])return{'agentName':_0x218489,'outputPath':_0x299466,'isNew':_0x55cda5,'hasChanges':!![]};a138_0x406b9a[_0x48373b(0x1ed)](_0x56d889,{'recursive':!![]}),a138_0x406b9a[_0x48373b(0x1ed)](_0x299466,{'recursive':!![]});const _0x3e5e52=a138_0x3662d8['join'](_0x56d889,'tdx.json');!a138_0x406b9a['existsSync'](_0x3e5e52)&&a138_0x406b9a[_0x48373b(0x16f)](_0x3e5e52,createAgentConfigContent(_0x585a83));const {yaml:_0x2f6e96,systemPrompt:_0x47dfc2,starterMessage:_0x2d39aa}=await agentResponseToDef(_0x42dfb9,_0x351a6c);let _0xb02543=_0x55cda5;if(!_0x55cda5){const _0x11c24c=a138_0x406b9a[_0x48373b(0x20d)](_0x1243f1)?a138_0x406b9a[_0x48373b(0x13d)](_0x1243f1,_0x48373b(0x1d3)):'',_0x405ace=a138_0x406b9a[_0x48373b(0x13d)](_0x283bd7,_0x48373b(0x1d3));_0xb02543=_0x11c24c!==_0x47dfc2||_0x405ace!==toAgentYamlString(_0x2f6e96);}a138_0x406b9a[_0x48373b(0x16f)](_0x1243f1,_0x47dfc2),a138_0x406b9a[_0x48373b(0x16f)](_0x283bd7,toAgentYamlString(_0x2f6e96));if(_0x2d39aa&&_0x2d39aa['includes']('\x0a'))a138_0x406b9a[_0x48373b(0x16f)](_0x2b673a,_0x2d39aa);else a138_0x406b9a['existsSync'](_0x2b673a)&&a138_0x406b9a[_0x48373b(0x149)](_0x2b673a);return{'agentName':_0x218489,'outputPath':_0x299466,'isNew':_0x55cda5,'hasChanges':_0xb02543};}async[a138_0x262c49(0xf8)](_0x14ea3d,_0x48993a){const _0x22b5ac=a138_0x262c49;let _0x579e7a;isAgentYamlPath(_0x14ea3d)?_0x579e7a=getAgentDirFromYamlPath(_0x14ea3d):_0x579e7a=_0x14ea3d;const {config:_0x4b400f}=findAgentConfig(_0x579e7a),_0x1026c4=await this[_0x22b5ac(0xfa)](_0x4b400f[_0x22b5ac(0x1b7)]),_0x12135a=a138_0x3662d8[_0x22b5ac(0x11a)](_0x579e7a,_0x22b5ac(0x142)),_0x43917c=a138_0x3662d8[_0x22b5ac(0x11a)](_0x579e7a,_0x22b5ac(0xfb)),_0x1740b8=a138_0x3662d8[_0x22b5ac(0x11a)](_0x579e7a,'starter_message.md');if(!a138_0x406b9a[_0x22b5ac(0x20d)](_0x12135a))throw new SDKError(ErrorCode[_0x22b5ac(0x18a)],_0x22b5ac(0x10d)+_0x579e7a,undefined,{'helpText':_0x22b5ac(0x1e2)});const _0x3630a3=parseAgentYaml(a138_0x406b9a[_0x22b5ac(0x13d)](_0x12135a,'utf-8'),_0x12135a),_0x1d1cf1=a138_0x406b9a[_0x22b5ac(0x20d)](_0x43917c)?a138_0x406b9a[_0x22b5ac(0x13d)](_0x43917c,_0x22b5ac(0x1d3)):'',_0x1d59bd=a138_0x406b9a[_0x22b5ac(0x20d)](_0x1740b8)?a138_0x406b9a[_0x22b5ac(0x13d)](_0x1740b8,'utf-8'):_0x3630a3[_0x22b5ac(0x179)];if(_0x48993a?.[_0x22b5ac(0x199)])return{'agentName':_0x3630a3[_0x22b5ac(0x1f7)],'action':_0x22b5ac(0x1af),'projectId':_0x1026c4};const _0x52a22b=await this[_0x22b5ac(0x1d4)][_0x22b5ac(0x10a)](_0x1026c4),_0x327918=await fetchAllToolTargetMaps((_0x3928e0,_0x48ed36)=>this[_0x22b5ac(0x1d4)]['listToolTargets'](_0x3928e0,_0x48ed36),_0x1026c4),_0x2351dc=new Map();for(const _0x17b5e2 of _0x52a22b){_0x2351dc['set'](_0x17b5e2['attributes'][_0x22b5ac(0x1f7)],_0x17b5e2['id']);}const _0x5570ee=[],_0x18474f={'projectId':_0x1026c4,'resolveToolTargetId':buildIdResolver({..._0x327918[_0x22b5ac(0x131)],'Agent':_0x2351dc}),'resolvePromptId':async()=>undefined,'onWarning':_0x32c87d=>{const _0x2e961a=_0x22b5ac;this[_0x2e961a(0x1f8)][_0x2e961a(0x12a)](_0x32c87d),_0x5570ee[_0x2e961a(0x1aa)](_0x32c87d);}};try{const _0x2b2ec0=_0x52a22b[_0x22b5ac(0x206)](_0x138eed=>_0x138eed[_0x22b5ac(0x1e6)]['name']===_0x3630a3['name']),_0x25055d=await agentDefToRequest(_0x3630a3,_0x1d1cf1,_0x1d59bd,_0x18474f);if(_0x2b2ec0)return await this[_0x22b5ac(0x1d4)][_0x22b5ac(0x11c)](_0x2b2ec0['id'],_0x25055d),{'agentName':_0x3630a3[_0x22b5ac(0x1f7)],'action':'updated','projectId':_0x1026c4,'agentId':_0x2b2ec0['id'],'warnings':_0x5570ee[_0x22b5ac(0x1eb)]>0x0?_0x5570ee:undefined};else{const _0x45ab90=await this['client'][_0x22b5ac(0x18e)](_0x25055d);return{'agentName':_0x3630a3[_0x22b5ac(0x1f7)],'action':_0x22b5ac(0x1af),'projectId':_0x1026c4,'agentId':_0x45ab90['id'],'warnings':_0x5570ee['length']>0x0?_0x5570ee:undefined};}}catch(_0x5a293e){return{'agentName':_0x3630a3[_0x22b5ac(0x1f7)],'action':_0x22b5ac(0x20f),'projectId':_0x1026c4,'error':_0x5a293e[_0x22b5ac(0x194)],'warnings':_0x5570ee[_0x22b5ac(0x1eb)]>0x0?_0x5570ee:undefined};}}async['cloneProject'](_0x44c72e,_0x20d2a7,_0x54c25f){const _0x10f571=a138_0x262c49,_0x5826a8=a138_0x406b9a[_0x10f571(0x20d)](_0x44c72e)&&a138_0x406b9a['existsSync'](a138_0x3662d8[_0x10f571(0x11a)](_0x44c72e,'tdx.json'));let _0x18d3b7;const _0x36b22c=[],_0x166cdd=[],_0x550663=[],_0x53a612=[],_0x44799c=[],_0x5d8d41=[],_0x232a61=[],_0x1ac3ac=[],_0xd1603c=[];if(_0x5826a8){const _0x219be2=loadAgentConfig(a138_0x3662d8[_0x10f571(0x11a)](_0x44c72e,_0x10f571(0x17f)));_0x18d3b7=_0x219be2['llm_project'];const _0xa75fce=a138_0x406b9a[_0x10f571(0x187)](_0x44c72e,{'withFileTypes':!![]});for(const _0x5edfb1 of _0xa75fce){if(!_0x5edfb1[_0x10f571(0x1d2)]())continue;if([_0x10f571(0x207),_0x10f571(0x12e),'experimental_artifacts',_0x10f571(0xff),_0x10f571(0x14b),'form_interfaces','chat_interfaces'][_0x10f571(0x159)](_0x5edfb1[_0x10f571(0x1f7)]))continue;const _0x1e3266=a138_0x3662d8[_0x10f571(0x11a)](_0x44c72e,_0x5edfb1[_0x10f571(0x1f7)]);if(isAgentDir(_0x1e3266)){const _0x198f30=a138_0x3662d8[_0x10f571(0x11a)](_0x1e3266,_0x10f571(0x142)),_0x12c009=a138_0x3662d8[_0x10f571(0x11a)](_0x1e3266,_0x10f571(0xfb)),_0x39f96e=a138_0x3662d8[_0x10f571(0x11a)](_0x1e3266,_0x10f571(0x11b)),_0x5c3fe1=parseAgentYaml(a138_0x406b9a[_0x10f571(0x13d)](_0x198f30,_0x10f571(0x1d3)),_0x198f30),_0x661cf7=a138_0x406b9a['existsSync'](_0x12c009)?a138_0x406b9a['readFileSync'](_0x12c009,'utf-8'):'',_0x460a0d=a138_0x406b9a[_0x10f571(0x20d)](_0x39f96e)?a138_0x406b9a[_0x10f571(0x13d)](_0x39f96e,'utf-8'):_0x5c3fe1[_0x10f571(0x179)];_0x36b22c['push']({'name':_0x5c3fe1[_0x10f571(0x1f7)],'dir':_0x1e3266,'yaml':_0x5c3fe1,'systemPrompt':_0x661cf7,'starterMessage':_0x460a0d});}}const _0x1f5fab=getKnowledgeBasesDir(_0x44c72e);if(a138_0x406b9a[_0x10f571(0x20d)](_0x1f5fab)){const _0x55fcd9=a138_0x406b9a[_0x10f571(0x187)](_0x1f5fab);for(const _0x1e227e of _0x55fcd9){const _0x33ae56=a138_0x3662d8['join'](_0x1f5fab,_0x1e227e);if(_0x1e227e[_0x10f571(0x140)](_0x10f571(0x147))){const _0x4b1476=parseKnowledgeBaseYaml(a138_0x406b9a[_0x10f571(0x13d)](_0x33ae56,_0x10f571(0x1d3)),_0x33ae56);_0x166cdd['push']({'name':_0x4b1476['name'],'path':_0x33ae56,'yaml':_0x4b1476});}else{if(_0x1e227e[_0x10f571(0x140)](_0x10f571(0x104))){const _0x430560=a138_0x406b9a[_0x10f571(0x13d)](_0x33ae56,_0x10f571(0x1d3)),{name:_0x487bd4,text:_0x16ebce}=parseTextKnowledgeBaseMd(_0x430560,_0x1e227e);_0x550663['push']({'name':_0x487bd4,'path':_0x33ae56,'text':_0x16ebce});}}}}const _0x1fa6d0=getPromptsDir(_0x44c72e);if(a138_0x406b9a[_0x10f571(0x20d)](_0x1fa6d0)){const _0xa7621c=a138_0x406b9a[_0x10f571(0x187)](_0x1fa6d0)['filter'](_0x5b2790=>_0x5b2790[_0x10f571(0x140)](_0x10f571(0x147)));for(const _0xf8d518 of _0xa7621c){const _0x5cc31f=a138_0x3662d8[_0x10f571(0x11a)](_0x1fa6d0,_0xf8d518),_0x3f6f4e=parsePromptYaml(a138_0x406b9a['readFileSync'](_0x5cc31f,_0x10f571(0x1d3)),_0x5cc31f);_0x53a612[_0x10f571(0x1aa)]({'name':_0x3f6f4e['name'],'path':_0x5cc31f,'yaml':_0x3f6f4e});}}const _0x13fe9d=getIntegrationsDir(_0x44c72e);if(a138_0x406b9a['existsSync'](_0x13fe9d)){const _0x23dcf0=a138_0x406b9a[_0x10f571(0x187)](_0x13fe9d)[_0x10f571(0x14c)](_0x4c18c0=>_0x4c18c0[_0x10f571(0x140)](_0x10f571(0x147)));for(const _0x214176 of _0x23dcf0){const _0x3f2170=a138_0x3662d8[_0x10f571(0x11a)](_0x13fe9d,_0x214176),_0x56ff6b=parseIntegrationYaml(a138_0x406b9a[_0x10f571(0x13d)](_0x3f2170,_0x10f571(0x1d3)),_0x3f2170);SAFE_INTEGRATION_TYPES[_0x10f571(0x159)](_0x56ff6b['service_type']['toLowerCase']())?_0x44799c[_0x10f571(0x1aa)]({'name':_0x56ff6b[_0x10f571(0x1f7)],'path':_0x3f2170,'yaml':_0x56ff6b}):this[_0x10f571(0x1f8)]['warn'](_0x10f571(0x21d)+_0x56ff6b[_0x10f571(0x1f7)]+_0x10f571(0x1c0)+_0x56ff6b[_0x10f571(0x1de)]+_0x10f571(0x1bc)+(_0x10f571(0x156)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x10f571(0x185)));}}const _0x4beb64=getExperimentalKnowledgeBasesDir(_0x44c72e);if(a138_0x406b9a['existsSync'](_0x4beb64)){const _0x32e673=a138_0x406b9a[_0x10f571(0x187)](_0x4beb64,{'withFileTypes':!![]});for(const _0x17db24 of _0x32e673){if(!_0x17db24[_0x10f571(0x1d2)]())continue;const _0x456066=a138_0x3662d8['join'](_0x4beb64,_0x17db24[_0x10f571(0x1f7)]),_0x38e8e0=a138_0x3662d8[_0x10f571(0x11a)](_0x456066,_0x17db24[_0x10f571(0x1f7)]+_0x10f571(0x147));if(a138_0x406b9a[_0x10f571(0x20d)](_0x38e8e0)){const _0x278b75=parseExperimentalKnowledgeBaseYaml(a138_0x406b9a[_0x10f571(0x13d)](_0x38e8e0,'utf-8'),_0x38e8e0),_0x210317=a138_0x3662d8[_0x10f571(0x11a)](_0x456066,'functions'),_0x3808e8=[];if(a138_0x406b9a[_0x10f571(0x20d)](_0x210317)){const _0x58df0d=a138_0x406b9a[_0x10f571(0x187)](_0x210317,{'withFileTypes':!![]});for(const _0x884b77 of _0x58df0d){if(!_0x884b77['isDirectory']())continue;const _0xc92745=a138_0x3662d8[_0x10f571(0x11a)](_0x210317,_0x884b77['name']),_0x265b61=a138_0x3662d8[_0x10f571(0x11a)](_0xc92745,'code.js'),_0x3d96c5=a138_0x3662d8[_0x10f571(0x11a)](_0xc92745,_0x10f571(0x1fb));if(a138_0x406b9a[_0x10f571(0x20d)](_0x265b61)&&a138_0x406b9a[_0x10f571(0x20d)](_0x3d96c5)){const _0x26444d=a138_0x406b9a[_0x10f571(0x13d)](_0x265b61,'utf-8'),_0x3c100d=a138_0x406b9a[_0x10f571(0x13d)](_0x3d96c5,_0x10f571(0x1d3));_0x3808e8[_0x10f571(0x1aa)]({'name':_0x884b77[_0x10f571(0x1f7)],'code':_0x26444d,'json_schema':_0x3c100d});}}}const _0xc06a81={..._0x278b75,'functions':_0x3808e8};_0x5d8d41[_0x10f571(0x1aa)]({'name':_0x278b75['name'],'path':_0x456066,'def':_0xc06a81});}}}const _0x2ee14b=getExperimentalArtifactsDir(_0x44c72e);if(a138_0x406b9a['existsSync'](_0x2ee14b)){const _0x4f34d3=a138_0x406b9a[_0x10f571(0x187)](_0x2ee14b,{'withFileTypes':!![]});for(const _0x154a1e of _0x4f34d3){if(!_0x154a1e[_0x10f571(0x1d2)]())continue;const _0x291c0c=a138_0x3662d8[_0x10f571(0x11a)](_0x2ee14b,_0x154a1e[_0x10f571(0x1f7)]),_0x2c470c=a138_0x3662d8['join'](_0x291c0c,_0x154a1e[_0x10f571(0x1f7)]+_0x10f571(0x147));if(a138_0x406b9a[_0x10f571(0x20d)](_0x2c470c)){const _0x3ab2b7=parseExperimentalArtifactYaml(a138_0x406b9a[_0x10f571(0x13d)](_0x2c470c,_0x10f571(0x1d3)),_0x2c470c),_0x18b561=a138_0x3662d8[_0x10f571(0x11a)](_0x291c0c,_0x10f571(0x20e)),_0x34cc0c=a138_0x406b9a['existsSync'](_0x18b561)?a138_0x406b9a['readFileSync'](_0x18b561,_0x10f571(0x1d3)):'',_0x461fb2=a138_0x3662d8[_0x10f571(0x11a)](_0x291c0c,_0x10f571(0x130)),_0x475893=[];if(a138_0x406b9a[_0x10f571(0x20d)](_0x461fb2)){const _0x39c073=a138_0x406b9a[_0x10f571(0x187)](_0x461fb2);for(const _0x49c8fd of _0x39c073){const _0x45db6c=a138_0x3662d8['join'](_0x461fb2,_0x49c8fd);if(a138_0x406b9a[_0x10f571(0x213)](_0x45db6c)[_0x10f571(0x119)]()){const _0x5c8a7d=a138_0x406b9a[_0x10f571(0x13d)](_0x45db6c,_0x10f571(0x1d3));_0x475893[_0x10f571(0x1aa)]({'file_name':_0x49c8fd,'text_content':_0x5c8a7d});}}}const _0x171a1d={..._0x3ab2b7,'code':_0x34cc0c,'files':_0x475893};_0x232a61[_0x10f571(0x1aa)]({'name':_0x3ab2b7[_0x10f571(0x1f7)],'path':_0x291c0c,'def':_0x171a1d});}}}const _0x1c09fe=getFormInterfacesDir(_0x44c72e);if(a138_0x406b9a['existsSync'](_0x1c09fe)){const _0x268144=a138_0x406b9a[_0x10f571(0x187)](_0x1c09fe)[_0x10f571(0x14c)](_0x398d07=>_0x398d07[_0x10f571(0x140)]('.yml'));for(const _0x1e708a of _0x268144){const _0x385061=a138_0x3662d8[_0x10f571(0x11a)](_0x1c09fe,_0x1e708a),_0x2bf7ec=parseFormInterfaceYaml(a138_0x406b9a['readFileSync'](_0x385061,_0x10f571(0x1d3)),_0x385061);_0x1ac3ac[_0x10f571(0x1aa)]({'name':_0x2bf7ec[_0x10f571(0x1f7)],'path':_0x385061,'yaml':_0x2bf7ec});}}const _0x49ee3d=getChatInterfacesDir(_0x44c72e);if(a138_0x406b9a['existsSync'](_0x49ee3d)){const _0x132702=a138_0x406b9a[_0x10f571(0x187)](_0x49ee3d)[_0x10f571(0x14c)](_0xd2bdf8=>_0xd2bdf8['endsWith'](_0x10f571(0x147)));for(const _0x14efb2 of _0x132702){const _0x58d5fc=a138_0x3662d8[_0x10f571(0x11a)](_0x49ee3d,_0x14efb2),_0x55dadb=parseChatInterfaceYaml(a138_0x406b9a['readFileSync'](_0x58d5fc,_0x10f571(0x1d3)),_0x58d5fc);_0xd1603c[_0x10f571(0x1aa)]({'name':_0x55dadb[_0x10f571(0x1f7)],'path':_0x58d5fc,'yaml':_0x55dadb});}}}else{const _0x2907b6=await this[_0x10f571(0xfa)](_0x44c72e),_0x55fa6e=await this[_0x10f571(0x1d4)][_0x10f571(0x184)](_0x2907b6);_0x18d3b7=_0x55fa6e[_0x10f571(0x1e6)]['name'];const _0x20cf0c=await this['client']['listAgentsFull'](_0x2907b6),_0x3e7ed4=await this[_0x10f571(0x1d4)]['listKnowledgeBases'](_0x2907b6),_0x25e088=await this[_0x10f571(0x1d4)][_0x10f571(0x14a)](_0x2907b6),_0xedc0b1=await this[_0x10f571(0x1d4)][_0x10f571(0x13b)](_0x2907b6),_0x95eda3=await this['client'][_0x10f571(0x176)](_0x2907b6),_0x3501fb=await safeListOrEmpty(()=>this['client'][_0x10f571(0x1c4)](_0x2907b6)),_0x5c7c96=await safeListOrEmpty(()=>this[_0x10f571(0x1d4)][_0x10f571(0x117)](_0x2907b6)),_0x465332=new Map(),_0x20df7d=new Map(),_0x6636f4=new Map(),_0x1f1794=new Map(),_0x410299=new Map(),_0x3ab5cb=new Map();for(const _0xa42067 of _0x3e7ed4){_0x465332[_0x10f571(0x112)](_0xa42067['id'],_0xa42067[_0x10f571(0x1e6)][_0x10f571(0x1f7)]);}for(const _0x14e1f4 of _0x25e088){_0x20df7d[_0x10f571(0x112)](_0x14e1f4['id'],_0x14e1f4[_0x10f571(0x1e6)][_0x10f571(0x1f7)]);}for(const _0x31f3b8 of _0x20cf0c){_0x6636f4[_0x10f571(0x112)](_0x31f3b8['id'],_0x31f3b8[_0x10f571(0x1e6)][_0x10f571(0x1f7)]);}for(const _0x232b75 of _0xedc0b1){_0x1f1794['set'](_0x232b75['id'],_0x232b75[_0x10f571(0x1e6)][_0x10f571(0x1f7)]);}for(const _0x5d49fe of _0x3501fb){_0x410299[_0x10f571(0x112)](_0x5d49fe['id'],_0x5d49fe[_0x10f571(0x1e6)]['name']);}for(const _0x9b15f0 of _0x5c7c96){_0x3ab5cb['set'](_0x9b15f0['id'],_0x9b15f0[_0x10f571(0x1e6)][_0x10f571(0x1f7)]);}const _0x1663eb={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x465332,'TextKnowledgeBase':_0x20df7d,'Agent':_0x6636f4,'ExperimentalKnowledgeBase':_0x410299}),'resolvePromptName':async _0x470005=>_0x1f1794[_0x10f571(0x17b)](_0x470005),'onWarning':_0x2e18d2=>this[_0x10f571(0x1f8)][_0x10f571(0x12a)](_0x2e18d2)};for(const _0xbb47c0 of _0x20cf0c){const _0x4bd987=await agentResponseToDef(_0xbb47c0,_0x1663eb),{yaml:_0x5b6283,systemPrompt:_0x301d70,starterMessage:_0xc93a5f}=_0x4bd987;_0x36b22c[_0x10f571(0x1aa)]({'name':_0x5b6283[_0x10f571(0x1f7)],'dir':'','yaml':_0x5b6283,'systemPrompt':_0x301d70,'starterMessage':_0xc93a5f});}for(const _0x58be96 of _0x3e7ed4){const _0x3984ef=apiKnowledgeBaseToYaml(_0x58be96);_0x166cdd[_0x10f571(0x1aa)]({'name':_0x3984ef[_0x10f571(0x1f7)],'path':'','yaml':_0x3984ef});}for(const _0xfa93a0 of _0x25e088){_0x550663[_0x10f571(0x1aa)]({'name':_0xfa93a0[_0x10f571(0x1e6)][_0x10f571(0x1f7)],'path':'','text':_0xfa93a0['attributes'][_0x10f571(0x1be)]});}for(const _0x3e8687 of _0xedc0b1){const _0x2af2bb=await apiPromptToYaml(_0x3e8687,_0x1663eb);_0x2af2bb&&_0x53a612[_0x10f571(0x1aa)]({'name':_0x2af2bb[_0x10f571(0x1f7)],'path':'','yaml':_0x2af2bb});}for(const _0x457bd4 of _0x95eda3){if(!_0x457bd4['attributes'][_0x10f571(0x192)]&&SAFE_INTEGRATION_TYPES[_0x10f571(0x159)](_0x457bd4[_0x10f571(0x1e6)][_0x10f571(0x1cd)][_0x10f571(0x1a9)]())){const _0x247b55=await apiIntegrationToYaml(_0x457bd4,_0x1663eb);_0x44799c[_0x10f571(0x1aa)]({'name':_0x457bd4[_0x10f571(0x1e6)]['serviceType'][_0x10f571(0x1a9)](),'path':'','yaml':_0x247b55});}}for(const _0x573349 of _0x3501fb){const _0x1ed317=apiExperimentalKnowledgeBaseToYaml(_0x573349);_0x5d8d41[_0x10f571(0x1aa)]({'name':_0x1ed317['name'],'path':'','def':_0x1ed317});}for(const _0x1069ab of _0x5c7c96){const _0x725df0=apiExperimentalArtifactToYaml(_0x1069ab);_0x232a61['push']({'name':_0x725df0['name'],'path':'','def':_0x725df0});}const _0x5208bb=await safeListOrEmpty(()=>this[_0x10f571(0x1d4)][_0x10f571(0x165)](_0x2907b6));for(const _0x320ccf of _0x5208bb){const _0x1e7ca1=await apiFormInterfaceToYaml(_0x320ccf,_0x1663eb);_0x1ac3ac[_0x10f571(0x1aa)]({'name':_0x1e7ca1[_0x10f571(0x1f7)],'path':'','yaml':_0x1e7ca1});}const _0x170eda=await safeListOrEmpty(()=>this[_0x10f571(0x1d4)][_0x10f571(0x14e)](_0x2907b6));for(const _0x51976a of _0x170eda){if(_0x51976a[_0x10f571(0x1e6)]['isManaged'])continue;const _0x3b6ba2=await apiChatInterfaceToYaml(_0x51976a,_0x1663eb);_0xd1603c[_0x10f571(0x1aa)]({'name':_0x3b6ba2[_0x10f571(0x1f7)],'path':'','yaml':_0x3b6ba2});}}const _0xa7c0ad={'sourceProjectName':_0x18d3b7,'newProjectName':_0x20d2a7,'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}}},_0x3755b4=await this[_0x10f571(0x1d4)]['listProjects'](),_0x404c4d=_0x3755b4[_0x10f571(0x206)](_0x588855=>_0x588855['attributes']['name']===_0x20d2a7);if(_0x404c4d)throw new SDKError(ErrorCode[_0x10f571(0x174)],_0x10f571(0x209)+_0x20d2a7+_0x10f571(0x1b8),undefined,{'helpText':_0x10f571(0x1e1)});if(_0x54c25f?.[_0x10f571(0x199)])return _0xa7c0ad[_0x10f571(0x148)][_0x10f571(0x125)][_0x10f571(0x1af)]=_0x36b22c['length'],_0xa7c0ad[_0x10f571(0x148)]['knowledgeBases'][_0x10f571(0x1af)]=_0x166cdd[_0x10f571(0x1eb)],_0xa7c0ad[_0x10f571(0x148)]['textKnowledgeBases'][_0x10f571(0x1af)]=_0x550663[_0x10f571(0x1eb)],_0xa7c0ad['counts'][_0x10f571(0x1dc)][_0x10f571(0x1af)]=_0x5d8d41[_0x10f571(0x1eb)],_0xa7c0ad[_0x10f571(0x148)]['experimentalArtifacts']['created']=_0x232a61[_0x10f571(0x1eb)],_0xa7c0ad[_0x10f571(0x148)][_0x10f571(0xff)][_0x10f571(0x1af)]=_0x53a612['length'],_0xa7c0ad[_0x10f571(0x148)][_0x10f571(0x14b)][_0x10f571(0x1af)]=_0x44799c['length'],_0xa7c0ad;const _0x45b63c=await this[_0x10f571(0x1d4)]['createProject']({'name':_0x20d2a7}),_0x1f5358=_0x45b63c['id'];_0xa7c0ad[_0x10f571(0xfe)]=_0x1f5358;const _0x2275c6=new Map(),_0x40e720=new Map(),_0x4fd06a=new Map(),_0x53c4f0=new Map(),_0x4947da=new Map(),_0x318873=new Map(),_0x479f96=new Map(),_0x3b7159=new Map(),_0x535bff=new Set(),_0x4a42b5=new Set();for(const _0x12df48 of _0x36b22c){for(const _0x109a3e of _0x12df48[_0x10f571(0x1ab)][_0x10f571(0x1cc)]||[]){if(_0x109a3e[_0x10f571(0x124)]==='image_gen'&&_0x109a3e[_0x10f571(0x21f)]){const _0x50ea0b=parseRef(_0x109a3e[_0x10f571(0x21f)]);if(_0x50ea0b)_0x535bff['add'](_0x50ea0b[_0x10f571(0x1f7)]);}else{if(_0x109a3e['type']===_0x10f571(0x201)&&_0x109a3e['target']){const _0x510585=parseRef(_0x109a3e[_0x10f571(0x21f)]);if(_0x510585)_0x4a42b5[_0x10f571(0x11d)](_0x510585['name']);}}}}for(const _0x2e2579 of _0x535bff){try{const _0x228594=await this[_0x10f571(0x1d4)]['createImageGenerator']({'projectId':_0x1f5358,'name':_0x2e2579});_0x4947da[_0x10f571(0x112)](_0x2e2579,_0x228594['id']),_0xa7c0ad[_0x10f571(0x169)][_0x10f571(0x1aa)]({'name':_0x2e2579,'action':_0x10f571(0x1af),'id':_0x228594['id']}),_0xa7c0ad[_0x10f571(0x148)][_0x10f571(0x169)][_0x10f571(0x1af)]++;}catch(_0x4a67f4){_0xa7c0ad['imageGenerators']['push']({'name':_0x2e2579,'action':_0x10f571(0x20f),'error':_0x4a67f4[_0x10f571(0x194)]}),_0xa7c0ad[_0x10f571(0x148)][_0x10f571(0x169)]['errors']++;}}for(const _0x50c51b of _0x4a42b5){try{const _0x519898=await this[_0x10f571(0x1d4)]['createWebSearchTool']({'projectId':_0x1f5358,'name':_0x50c51b});_0x318873[_0x10f571(0x112)](_0x50c51b,_0x519898['id']),_0xa7c0ad[_0x10f571(0x18c)][_0x10f571(0x1aa)]({'name':_0x50c51b,'action':_0x10f571(0x1af),'id':_0x519898['id']}),_0xa7c0ad['counts'][_0x10f571(0x18c)][_0x10f571(0x1af)]++;}catch(_0x1a26ea){_0xa7c0ad['webSearchTools'][_0x10f571(0x1aa)]({'name':_0x50c51b,'action':'error','error':_0x1a26ea['message']}),_0xa7c0ad[_0x10f571(0x148)][_0x10f571(0x18c)][_0x10f571(0x16e)]++;}}const _0x260119=await fetchAllToolTargetMaps((_0x1b2f07,_0x207c3a)=>this[_0x10f571(0x1d4)][_0x10f571(0x217)](_0x1b2f07,_0x207c3a),_0x1f5358);let _0x435c8e=[];const _0x4f8144={'projectId':_0x1f5358,'resolveToolTargetId':buildIdResolver({..._0x260119[_0x10f571(0x131)],'KnowledgeBase':_0x2275c6,'TextKnowledgeBase':_0x40e720,'ExperimentalKnowledgeBase':_0x479f96,'Agent':_0x4fd06a,'WebSearchTool':_0x318873,'ImageGenerator':_0x4947da}),'resolvePromptId':async _0x2953df=>_0x53c4f0[_0x10f571(0x17b)](_0x2953df),'onWarning':_0x5a45fe=>{const _0x5dd59f=_0x10f571;this[_0x5dd59f(0x1f8)]['warn'](_0x5a45fe),_0x435c8e[_0x5dd59f(0x1aa)](_0x5a45fe);}};for(const _0x576e4f of _0x166cdd){try{const _0x8f9bf8=yamlKnowledgeBaseToApi(_0x576e4f[_0x10f571(0x1ab)],_0x1f5358),_0x492db1=await this[_0x10f571(0x1d4)]['createKnowledgeBase'](_0x8f9bf8);_0x2275c6['set'](_0x576e4f[_0x10f571(0x1ab)][_0x10f571(0x1f7)],_0x492db1['id']),_0xa7c0ad[_0x10f571(0x144)][_0x10f571(0x1aa)]({'name':_0x576e4f['yaml'][_0x10f571(0x1f7)],'action':_0x10f571(0x1af),'id':_0x492db1['id']}),_0xa7c0ad[_0x10f571(0x148)]['knowledgeBases']['created']++;}catch(_0x41ac22){_0xa7c0ad[_0x10f571(0x144)][_0x10f571(0x1aa)]({'name':_0x576e4f[_0x10f571(0x1ab)][_0x10f571(0x1f7)],'action':_0x10f571(0x20f),'error':_0x41ac22[_0x10f571(0x194)]}),_0xa7c0ad[_0x10f571(0x148)][_0x10f571(0x144)][_0x10f571(0x16e)]++;}}for(const _0x7918eb of _0x550663){try{const _0x37c1bf=yamlTextKnowledgeBaseToApi({'name':_0x7918eb[_0x10f571(0x1f7)],'text':_0x7918eb['text']},_0x1f5358),_0x1733d9=await this[_0x10f571(0x1d4)]['createTextKnowledgeBase'](_0x37c1bf);_0x40e720[_0x10f571(0x112)](_0x7918eb[_0x10f571(0x1f7)],_0x1733d9['id']),_0xa7c0ad[_0x10f571(0x14f)][_0x10f571(0x1aa)]({'name':_0x7918eb[_0x10f571(0x1f7)],'action':_0x10f571(0x1af),'id':_0x1733d9['id']}),_0xa7c0ad[_0x10f571(0x148)][_0x10f571(0x14f)][_0x10f571(0x1af)]++;}catch(_0x1e01b6){_0xa7c0ad[_0x10f571(0x14f)][_0x10f571(0x1aa)]({'name':_0x7918eb[_0x10f571(0x1f7)],'action':'error','error':_0x1e01b6['message']}),_0xa7c0ad['counts'][_0x10f571(0x14f)][_0x10f571(0x16e)]++;}}for(const _0x29d041 of _0x232a61){try{const _0x22cb11=yamlExperimentalArtifactToApi(_0x29d041['def'],_0x1f5358),_0x211f16=await this['client'][_0x10f571(0x127)](_0x22cb11);_0x3b7159[_0x10f571(0x112)](_0x29d041['def'][_0x10f571(0x1f7)],_0x211f16['id']),_0xa7c0ad['experimentalArtifacts'][_0x10f571(0x1aa)]({'name':_0x29d041[_0x10f571(0x118)]['name'],'action':_0x10f571(0x1af),'id':_0x211f16['id']}),_0xa7c0ad[_0x10f571(0x148)][_0x10f571(0x1ad)]['created']++;}catch(_0x501c53){_0xa7c0ad['experimentalArtifacts'][_0x10f571(0x1aa)]({'name':_0x29d041[_0x10f571(0x118)][_0x10f571(0x1f7)],'action':'error','error':_0x501c53['message']}),_0xa7c0ad['counts'][_0x10f571(0x1ad)]['errors']++;}}for(const _0x48490e of _0x5d8d41){try{const _0x30e305=yamlExperimentalKnowledgeBaseToApi(_0x48490e[_0x10f571(0x118)],_0x1f5358),_0x1bc0da=await this[_0x10f571(0x1d4)][_0x10f571(0x163)](_0x30e305);_0x479f96[_0x10f571(0x112)](_0x48490e[_0x10f571(0x118)][_0x10f571(0x1f7)],_0x1bc0da['id']),_0xa7c0ad[_0x10f571(0x1dc)][_0x10f571(0x1aa)]({'name':_0x48490e[_0x10f571(0x118)][_0x10f571(0x1f7)],'action':_0x10f571(0x1af),'id':_0x1bc0da['id']}),_0xa7c0ad['counts']['experimentalKnowledgeBases']['created']++;}catch(_0x435494){_0xa7c0ad[_0x10f571(0x1dc)][_0x10f571(0x1aa)]({'name':_0x48490e[_0x10f571(0x118)]['name'],'action':'error','error':_0x435494[_0x10f571(0x194)]}),_0xa7c0ad[_0x10f571(0x148)][_0x10f571(0x1dc)][_0x10f571(0x16e)]++;}}const _0x3109fa=[..._0x36b22c][_0x10f571(0x158)]((_0xe8063b,_0x17dbc4)=>{const _0x221f13=_0x10f571,_0x5f38d1=_0xe8063b[_0x221f13(0x1ab)][_0x221f13(0x1cc)]?.[_0x221f13(0x113)](_0xb8f0d9=>_0xb8f0d9[_0x221f13(0x124)]===_0x221f13(0x1ea))??![],_0x1ba2e7=_0x17dbc4[_0x221f13(0x1ab)]['tools']?.[_0x221f13(0x113)](_0x5a93c6=>_0x5a93c6[_0x221f13(0x124)]===_0x221f13(0x1ea))??![];if(_0x5f38d1&&!_0x1ba2e7)return 0x1;if(!_0x5f38d1&&_0x1ba2e7)return-0x1;return 0x0;});for(const _0x4c3e1f of _0x3109fa){_0x435c8e=[];try{const _0x3abc12=_0x4c3e1f[_0x10f571(0x1ab)][_0x10f571(0x1cc)]?.[_0x10f571(0x14c)](_0x29f0bd=>{const _0x5e1b43=_0x10f571;if(_0x29f0bd['type']===_0x5e1b43(0x1ea)&&_0x29f0bd['target']){const _0x1810a9=parseRef(_0x29f0bd[_0x5e1b43(0x21f)]);return _0x1810a9?.[_0x5e1b43(0x1f7)]===_0x4c3e1f[_0x5e1b43(0x1ab)][_0x5e1b43(0x1f7)];}return![];})??[];if(_0x3abc12[_0x10f571(0x1eb)]>0x0){const _0x531475='Agent\x20\x27'+_0x4c3e1f['yaml'][_0x10f571(0x1f7)]+_0x10f571(0x19f)+_0x10f571(0x152);this['logger'][_0x10f571(0x12a)](_0x531475),_0x435c8e[_0x10f571(0x1aa)](_0x531475);}const _0x28f2c6=await agentDefToRequest(_0x4c3e1f[_0x10f571(0x1ab)],_0x4c3e1f['systemPrompt'],_0x4c3e1f[_0x10f571(0x198)],_0x4f8144),_0xec3a90=await this['client']['createAgentResponse'](_0x28f2c6);_0x4fd06a[_0x10f571(0x112)](_0x4c3e1f[_0x10f571(0x1ab)][_0x10f571(0x1f7)],_0xec3a90['id']),_0xa7c0ad[_0x10f571(0x125)]['push']({'agentName':_0x4c3e1f[_0x10f571(0x1ab)]['name'],'action':_0x10f571(0x1af),'agentId':_0xec3a90['id'],'warnings':_0x435c8e[_0x10f571(0x1eb)]>0x0?_0x435c8e:undefined}),_0xa7c0ad[_0x10f571(0x148)]['agents']['created']++;}catch(_0x5aba48){_0xa7c0ad[_0x10f571(0x125)]['push']({'agentName':_0x4c3e1f[_0x10f571(0x1ab)][_0x10f571(0x1f7)],'action':_0x10f571(0x20f),'error':_0x5aba48[_0x10f571(0x194)],'warnings':_0x435c8e[_0x10f571(0x1eb)]>0x0?_0x435c8e:undefined}),_0xa7c0ad['counts']['agents'][_0x10f571(0x16e)]++;}}for(const _0xd51bbe of _0x53a612){try{const _0x3363f8=await yamlPromptToApi(_0xd51bbe[_0x10f571(0x1ab)],_0x1f5358,_0x4f8144);if(!_0x3363f8){_0xa7c0ad[_0x10f571(0xff)][_0x10f571(0x1aa)]({'name':_0xd51bbe['yaml'][_0x10f571(0x1f7)],'action':_0x10f571(0x20f),'error':_0x10f571(0x212)}),_0xa7c0ad['counts'][_0x10f571(0xff)]['errors']++;continue;}const _0x2fa580=await this[_0x10f571(0x1d4)][_0x10f571(0x1e7)](_0x3363f8);_0x53c4f0[_0x10f571(0x112)](_0xd51bbe['yaml'][_0x10f571(0x1f7)],_0x2fa580['id']),_0xa7c0ad[_0x10f571(0xff)][_0x10f571(0x1aa)]({'name':_0xd51bbe[_0x10f571(0x1ab)][_0x10f571(0x1f7)],'action':_0x10f571(0x1af),'id':_0x2fa580['id']}),_0xa7c0ad['counts'][_0x10f571(0xff)]['created']++;}catch(_0xe4eb62){_0xa7c0ad[_0x10f571(0xff)][_0x10f571(0x1aa)]({'name':_0xd51bbe['yaml'][_0x10f571(0x1f7)],'action':_0x10f571(0x20f),'error':_0xe4eb62[_0x10f571(0x194)]}),_0xa7c0ad[_0x10f571(0x148)][_0x10f571(0xff)][_0x10f571(0x16e)]++;}}for(const _0x5dcee6 of _0x44799c){try{const _0x4a7936=await yamlIntegrationToApi(_0x5dcee6[_0x10f571(0x1ab)],_0x1f5358,_0x4f8144),_0x3f0988=await this[_0x10f571(0x1d4)][_0x10f571(0x109)](_0x4a7936);_0xa7c0ad[_0x10f571(0x14b)]['push']({'name':_0x5dcee6[_0x10f571(0x1ab)]['service_type'],'action':_0x10f571(0x1af),'id':_0x3f0988['id']}),_0xa7c0ad['counts'][_0x10f571(0x14b)][_0x10f571(0x1af)]++;}catch(_0x3d9a26){_0xa7c0ad['integrations'][_0x10f571(0x1aa)]({'name':_0x5dcee6[_0x10f571(0x1ab)][_0x10f571(0x1de)],'action':_0x10f571(0x20f),'error':_0x3d9a26['message']}),_0xa7c0ad['counts'][_0x10f571(0x14b)]['errors']++;}}for(const _0xc1b268 of _0x1ac3ac){try{const _0x66fb22=await yamlFormInterfaceToApi(_0xc1b268[_0x10f571(0x1ab)],_0x1f5358,_0x4f8144);if(!_0x66fb22){_0xa7c0ad[_0x10f571(0x200)][_0x10f571(0x1aa)]({'name':_0xc1b268['yaml']['name'],'action':_0x10f571(0x20f),'error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0xa7c0ad[_0x10f571(0x148)]['formInterfaces'][_0x10f571(0x16e)]++;continue;}const _0x49b63d=await this[_0x10f571(0x1d4)][_0x10f571(0x1a0)](_0x66fb22);_0xa7c0ad['formInterfaces'][_0x10f571(0x1aa)]({'name':_0xc1b268['yaml'][_0x10f571(0x1f7)],'action':_0x10f571(0x1af),'id':_0x49b63d['id']}),_0xa7c0ad[_0x10f571(0x148)]['formInterfaces']['created']++;}catch(_0x1783c6){_0xa7c0ad[_0x10f571(0x200)][_0x10f571(0x1aa)]({'name':_0xc1b268[_0x10f571(0x1ab)]['name'],'action':_0x10f571(0x20f),'error':_0x1783c6[_0x10f571(0x194)]}),_0xa7c0ad[_0x10f571(0x148)]['formInterfaces'][_0x10f571(0x16e)]++;}}for(const _0x5a663f of _0xd1603c){try{const _0x2af053=await yamlChatInterfaceToApi(_0x5a663f['yaml'],_0x1f5358,_0x4f8144),_0x1f35fc=await this[_0x10f571(0x1d4)]['createChatInterface'](_0x2af053);_0xa7c0ad[_0x10f571(0x13e)][_0x10f571(0x1aa)]({'name':_0x5a663f[_0x10f571(0x1ab)][_0x10f571(0x1f7)],'action':_0x10f571(0x1af),'id':_0x1f35fc['id']}),_0xa7c0ad[_0x10f571(0x148)][_0x10f571(0x13e)][_0x10f571(0x1af)]++;}catch(_0x1d5f73){_0xa7c0ad[_0x10f571(0x13e)][_0x10f571(0x1aa)]({'name':_0x5a663f[_0x10f571(0x1ab)]['name'],'action':_0x10f571(0x20f),'error':_0x1d5f73[_0x10f571(0x194)]}),_0xa7c0ad[_0x10f571(0x148)][_0x10f571(0x13e)][_0x10f571(0x16e)]++;}}return _0xa7c0ad;}}