@treasuredata/tdx 2026.6.0 → 2026.6.1

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 (232) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/cas-command.js +1 -1
  11. package/dist/commands/cas-segment-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/policy-command.js +1 -1
  35. package/dist/commands/profile-command.js +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/query-command.js +1 -1
  38. package/dist/commands/schedule-command.js +1 -1
  39. package/dist/commands/segment-command.js +1 -1
  40. package/dist/commands/segment-create-command.js +1 -1
  41. package/dist/commands/segment-fields-command.js +1 -1
  42. package/dist/commands/segment-pull-command.js +1 -1
  43. package/dist/commands/segment-push-command.js +1 -1
  44. package/dist/commands/segment-update-command.js +1 -1
  45. package/dist/commands/segment-use-command.js +1 -1
  46. package/dist/commands/segment-validate-command.js +1 -1
  47. package/dist/commands/segments.js +1 -1
  48. package/dist/commands/show.js +1 -1
  49. package/dist/commands/status-command.js +1 -1
  50. package/dist/commands/table-deleted.js +1 -1
  51. package/dist/commands/tables.js +1 -1
  52. package/dist/commands/unset-command.js +1 -1
  53. package/dist/commands/upgrade-command.js +1 -1
  54. package/dist/commands/use-command.js +1 -1
  55. package/dist/commands/user-command.js +1 -1
  56. package/dist/commands/work-command.js +1 -1
  57. package/dist/commands/workflow-command.js +1 -1
  58. package/dist/core/auth.js +1 -1
  59. package/dist/core/command-output.js +1 -1
  60. package/dist/core/config.js +1 -1
  61. package/dist/core/connection-cache.js +1 -1
  62. package/dist/core/constants.js +1 -1
  63. package/dist/core/credential-cache.js +1 -1
  64. package/dist/core/global-context.js +1 -1
  65. package/dist/core/keychain.js +1 -1
  66. package/dist/core/oauth-keychain.js +1 -1
  67. package/dist/core/oauth.js +1 -1
  68. package/dist/core/profile.js +1 -1
  69. package/dist/core/project-config.js +1 -1
  70. package/dist/core/session.js +1 -1
  71. package/dist/core/user-cache.js +1 -1
  72. package/dist/core/version.js +1 -1
  73. package/dist/index.js +1 -1
  74. package/dist/mcp/server.js +1 -1
  75. package/dist/mcp/tools/index.js +1 -1
  76. package/dist/mcp/tools/tdx-run.js +1 -1
  77. package/dist/mcp/tools/tdx-search.js +1 -1
  78. package/dist/mcp/tools/work-create-item.js +1 -1
  79. package/dist/mcp/utils.js +1 -1
  80. package/dist/proxy/claude-usage-tracker.js +1 -1
  81. package/dist/proxy/passthrough-server.js +1 -1
  82. package/dist/proxy/sse-usage-parser.js +1 -1
  83. package/dist/sdk/agent/agent-config.js +1 -1
  84. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  85. package/dist/sdk/agent/agent-yaml.js +1 -1
  86. package/dist/sdk/agent/test/evaluator.js +1 -1
  87. package/dist/sdk/agent/test/executor.js +1 -1
  88. package/dist/sdk/agent/test/index.js +1 -1
  89. package/dist/sdk/agent/test/output.js +1 -1
  90. package/dist/sdk/agent/test/parser.js +1 -1
  91. package/dist/sdk/agent/tool-target-registry.js +1 -1
  92. package/dist/sdk/api.js +1 -1
  93. package/dist/sdk/cas/cas-api-client.js +1 -1
  94. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  95. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  96. package/dist/sdk/cas/index.js +1 -1
  97. package/dist/sdk/cas/pull-workflow.js +1 -1
  98. package/dist/sdk/cas/push-workflow.js +1 -1
  99. package/dist/sdk/client/cdp-api-client.js +1 -1
  100. package/dist/sdk/client/cdp-api-client.js.map +1 -1
  101. package/dist/sdk/client/delivery-api-client.js +1 -1
  102. package/dist/sdk/client/endpoints.js +1 -1
  103. package/dist/sdk/client/engage-api-client.js +1 -1
  104. package/dist/sdk/client/http-client.js +1 -1
  105. package/dist/sdk/client/llm-api-client.js +1 -1
  106. package/dist/sdk/client/oauth-refresh.js +1 -1
  107. package/dist/sdk/client/rate-limiter.js +1 -1
  108. package/dist/sdk/client/td-api-client.js +1 -1
  109. package/dist/sdk/client/trino-api-client.js +1 -1
  110. package/dist/sdk/client/workflow-client.js +1 -1
  111. package/dist/sdk/connection-validator.js +1 -1
  112. package/dist/sdk/connection.js +1 -1
  113. package/dist/sdk/delivery.js +1 -1
  114. package/dist/sdk/engage/campaign-pull.js +1 -1
  115. package/dist/sdk/engage/campaign-push.js +1 -1
  116. package/dist/sdk/engage/campaign-validator.js +1 -1
  117. package/dist/sdk/engage/campaign-yaml.js +1 -1
  118. package/dist/sdk/engage/template-pull.js +1 -1
  119. package/dist/sdk/engage/template-push.js +1 -1
  120. package/dist/sdk/engage/template-validator.js +1 -1
  121. package/dist/sdk/engage/template-yaml.js +1 -1
  122. package/dist/sdk/engage/types/campaign-def.js +1 -1
  123. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  124. package/dist/sdk/engage/types/template-schema.js +1 -1
  125. package/dist/sdk/engage.js +1 -1
  126. package/dist/sdk/errors.js +1 -1
  127. package/dist/sdk/index.js +1 -1
  128. package/dist/sdk/io/index.js +1 -1
  129. package/dist/sdk/io/node-filesystem.js +1 -1
  130. package/dist/sdk/job.js +1 -1
  131. package/dist/sdk/journey.js +1 -1
  132. package/dist/sdk/llm/chat-cache.js +1 -1
  133. package/dist/sdk/llm/index.js +1 -1
  134. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  135. package/dist/sdk/llm/model-factors.d.ts +8 -4
  136. package/dist/sdk/llm/model-factors.d.ts.map +1 -1
  137. package/dist/sdk/llm/model-factors.js +1 -1
  138. package/dist/sdk/llm/model-factors.js.map +1 -1
  139. package/dist/sdk/llm/user-settings.js +1 -1
  140. package/dist/sdk/personalization.js +1 -1
  141. package/dist/sdk/policy.js +1 -1
  142. package/dist/sdk/query/deleted-table-validation.js +1 -1
  143. package/dist/sdk/query/index.js +1 -1
  144. package/dist/sdk/query/sql-parser.js +1 -1
  145. package/dist/sdk/realtime.js +1 -1
  146. package/dist/sdk/schedule.js +1 -1
  147. package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
  148. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  149. package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
  150. package/dist/sdk/segment/fields-display.js +1 -1
  151. package/dist/sdk/segment/file-discovery.js +1 -1
  152. package/dist/sdk/segment/journey-utils.js +1 -1
  153. package/dist/sdk/segment/journey-validator.js +1 -1
  154. package/dist/sdk/segment/journey-yaml.js +1 -1
  155. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  156. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  157. package/dist/sdk/segment/pull-workflow.js +1 -1
  158. package/dist/sdk/segment/push-recovery.js +1 -1
  159. package/dist/sdk/segment/push-workflow.js +1 -1
  160. package/dist/sdk/segment/resolution-context.js +1 -1
  161. package/dist/sdk/segment/segment-path-parser.js +1 -1
  162. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  163. package/dist/sdk/segment/segment-validator.js +1 -1
  164. package/dist/sdk/segment/target-resolution.js +1 -1
  165. package/dist/sdk/segment/tdx-config.js +1 -1
  166. package/dist/sdk/segment/types/activation-schema.js +1 -1
  167. package/dist/sdk/segment/types/journey-def.js +1 -1
  168. package/dist/sdk/segment/types/journey-schema.js +1 -1
  169. package/dist/sdk/segment/types/segment-def.js +1 -1
  170. package/dist/sdk/segment/types/segment-schema.js +1 -1
  171. package/dist/sdk/segment/validate-files.js +1 -1
  172. package/dist/sdk/segment/yaml-validator.js +1 -1
  173. package/dist/sdk/segment.js +1 -1
  174. package/dist/sdk/types/cdp.d.ts +4 -3
  175. package/dist/sdk/types/cdp.d.ts.map +1 -1
  176. package/dist/sdk/types/index.js +1 -1
  177. package/dist/sdk/types/progress.js +1 -1
  178. package/dist/sdk/types/workspace.js +1 -1
  179. package/dist/sdk/user.js +1 -1
  180. package/dist/sdk/util/format-detector.js +1 -1
  181. package/dist/sdk/util/formatters.js +1 -1
  182. package/dist/sdk/util/index.js +1 -1
  183. package/dist/sdk/util/paginate.js +1 -1
  184. package/dist/sdk/util/tree-formatter.js +1 -1
  185. package/dist/sdk/workflow/archive-validation.js +1 -1
  186. package/dist/sdk/workflow/clone-workflow.js +1 -1
  187. package/dist/sdk/workflow/index.js +1 -1
  188. package/dist/sdk/workflow/pull-workflow.js +1 -1
  189. package/dist/sdk/workflow/push-workflow.js +1 -1
  190. package/dist/sdk/workflow/task-graph.js +1 -1
  191. package/dist/sdk/workflow/tdx-config.js +1 -1
  192. package/dist/sdk/workflow/workflow-utils.js +1 -1
  193. package/dist/sdk/workspace/access-tracker.js +1 -1
  194. package/dist/sdk/workspace/frontmatter.js +1 -1
  195. package/dist/sdk/workspace/git.js +1 -1
  196. package/dist/sdk/workspace/index.js +1 -1
  197. package/dist/sdk/workspace/templates.js +1 -1
  198. package/dist/sdk/workspace/weekly.js +1 -1
  199. package/dist/sdk/workspace/wikilinks.js +1 -1
  200. package/dist/test-utils/command-runner.js +1 -1
  201. package/dist/test-utils/factories.js +1 -1
  202. package/dist/test-utils/fixtures.js +1 -1
  203. package/dist/test-utils/http-mock.js +1 -1
  204. package/dist/test-utils/index.js +1 -1
  205. package/dist/utils/async.js +1 -1
  206. package/dist/utils/colors.js +1 -1
  207. package/dist/utils/diff.js +1 -1
  208. package/dist/utils/file-permissions.js +1 -1
  209. package/dist/utils/file-reader.js +1 -1
  210. package/dist/utils/github-releases.js +1 -1
  211. package/dist/utils/global-cache.js +1 -1
  212. package/dist/utils/json-loader.js +1 -1
  213. package/dist/utils/local-cache.js +1 -1
  214. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  215. package/dist/utils/logger/formatters/index.js +1 -1
  216. package/dist/utils/logger/handlers/console-handler.js +1 -1
  217. package/dist/utils/logger/handlers/file-handler.js +1 -1
  218. package/dist/utils/logger/handlers/index.js +1 -1
  219. package/dist/utils/logger/handlers/null-handler.js +1 -1
  220. package/dist/utils/logger/index.js +1 -1
  221. package/dist/utils/logger/logger.js +1 -1
  222. package/dist/utils/logger/types.js +1 -1
  223. package/dist/utils/option-validation.js +1 -1
  224. package/dist/utils/process.js +1 -1
  225. package/dist/utils/prompt.js +1 -1
  226. package/dist/utils/spinner.js +1 -1
  227. package/dist/utils/sse-parser.js +1 -1
  228. package/dist/utils/string-utils.js +1 -1
  229. package/dist/utils/table-ref-parser.js +1 -1
  230. package/dist/utils/tdx-logger.js +1 -1
  231. package/dist/utils/version-check.js +1 -1
  232. package/package.json +1 -1
@@ -1 +1 @@
1
- const a134_0x2792fe=a134_0x3a00;(function(_0x250bf1,_0x19cd59){const _0x1b468e=a134_0x3a00,_0x5def8f=_0x250bf1();while(!![]){try{const _0x1b4cb7=parseInt(_0x1b468e(0x203))/0x1+-parseInt(_0x1b468e(0x28f))/0x2+parseInt(_0x1b468e(0x28a))/0x3+parseInt(_0x1b468e(0x234))/0x4*(-parseInt(_0x1b468e(0x1f6))/0x5)+-parseInt(_0x1b468e(0x1ba))/0x6+-parseInt(_0x1b468e(0x20a))/0x7*(parseInt(_0x1b468e(0x244))/0x8)+parseInt(_0x1b468e(0x1c6))/0x9;if(_0x1b4cb7===_0x19cd59)break;else _0x5def8f['push'](_0x5def8f['shift']());}catch(_0x37428c){_0x5def8f['push'](_0x5def8f['shift']());}}}(a134_0x4385,0x8ed7a));import{LLMApiClient}from'../client/llm-api-client.js';import*as a134_0x52ac94 from'node:fs';import*as a134_0x5b5f34 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';function a134_0x4385(){const _0xc8d1df=['Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','updateChatInterface','listIntegrations','Agent\x20not\x20found:\x20','createChatInterface','Skipping\x20integration\x20\x27','status','service_type','LLM_PROJECT_NOT_FOUND','nameToId','agent.yml\x20not\x20found\x20in\x20','json_schema.json','getProject','dryRun','get','listAgentsFull','cloneProject','Backup\x20folder\x20not\x20found:\x20','createWebSearchTool','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','listExperimentalArtifacts','metadata','duplicate','getOrCreateDefaultProject','experimentalKnowledgeBases','194244GcwfGh','pullAgent','Multiple\x20projects\x20found\x20with\x20name\x20\x27','actions','web_search','sdk.llm','experimental_artifacts','some','Could\x20not\x20resolve\x20agent\x20reference','updateKnowledgeBase','find','temperature','getCurrentProject','Agent\x20reference\x20not\x20found','createAgent','listChatInterfaces','8pIJwup','keys','clearDefaultAgent','add','\x20in\x20project\x20','existsSync','listChats','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.','listExperimentalKnowledgeBases','path','map','\x20→\x20','chatInterfaces','Only\x20safe\x20types\x20(','starterMessage','integrations','utf-8','exportedFrom','endsWith','starter_message.md','agents','cwd','getChatHistory','warn','INTERNAL','mkdirSync','starter_message','updateTextKnowledgeBase','readFileSync','readdirSync','\x22\x20already\x20exists','project.json','deleteAgent','):\x20','listWebSearchTools','promptId','basename','createExperimentalArtifact','name','createAgentResponse','createIntegration','target','json_schema','knowledgebases.json','Renamed\x20experimental\x20artifact\x20directory:\x20','getDefaultProjectName','pushAgent','chatId','Unable\x20to\x20create\x20project\x20after\x20','PERMISSION_DENIED','isDir','isDirectory','def','error','KnowledgeBase','event','Renamed\x20folder:\x20','textKnowledgeBases','maxToolIterations','startChat','knowledgeBases','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','conflict','webSearchTools','updateAgent','idToName','size','chat_generic','set','1526952PjrMKY','context','includes','tdx_','chatInfo','441184BDSzYF','prompts','already\x20exists','type','toLowerCase','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','claude-4.5-sonnet','createPrompt','serviceType','experimentalArtifacts','deleteProject','deleteIntegration','files','.yml','formInterfaces','agentId','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','1.0','getChatLog','webhookCorsOrigins','agentsFull','updateFormInterface','file_name','none','prompts.json','resolveAgentId','loadJsonFile','newProjectId','statSync','form_interfaces','logger','\x0a---\x20schema:\x20','minimal','prompt.md','image_gen','#\x20prompt.md\x0a','stringify','info','message','outputs','Available\x20agents:\x20','tools','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','updateAgentResponse','isManaged','attributes','updated','code.js','client','counts','join','getBackupMetadata','chats','INVALID_ARGUMENT','toISOString','parse','ALREADY_EXISTS','listAgents','\x20---\x0a','site','chat_interfaces','filter','Renamed\x20agent\x20folder:\x20','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','llm_project','resolveProjectId','reasoningEffort','---\x20file:\x20','tdx.json','agent','listPrompts','dirname','agent.yml','rmSync','6705156fjYNxl','agents.json','writeFileSync','getUserSettings','sort','unlinkSync','systemPrompt','createImageGenerator','listTextKnowledgeBases','split','\x0a\x0a#\x20agent.yml\x0a','length','7764066zItvnT','listProjects','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','Renamed\x20KB\x20file:\x20','AGENT_NOT_FOUND','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','NOT_FOUND','renamed','isFile','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','total','chatIgnoreManagedActions','continueChat','.llm','createFormInterface','push','dry-run-','localeCompare','createProject','backupProject','currentProjectId','profile','listFormInterfaces','projectId','errors','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','functions','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','knowledge_bases','template','text_content','listKnowledgeBases','getOrCreateDefaultAgent','oldPath','imageGenerators','resolveProjectName','listToolTargets','pullProject','unchanged','Renamed\x20chat\x20interface\x20file:\x20','experimental_knowledge_bases','dir','createExperimentalKnowledgeBase','createTextKnowledgeBase',')\x20can\x20be\x20pushed.\x20','ExperimentalKnowledgeBase','Renamed\x20text\x20KB\x20file:\x20','.md','5jOLUle','text','slackMessageMode','version','projectName','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','setDefaultAgent','createKnowledgeBase','variables','\x27\x20(','new','content','\x0a---\x20function:\x20','959897CyeRim','Renamed\x20experimental\x20KB\x20directory:\x20','has','\x20attempts\x20due\x20to\x20name\x20conflicts.','\x27.\x20This\x20should\x20not\x20happen.','integrations.json','setCurrentProject','2518558rPHAMu','yaml','---\x20schema:\x20','code','\x0a---\x20code\x20---\x0a','modelType','models','UNAUTHENTICATED','chatWelcomeMessage','project','getAgent','updatePrompt','Project\x20not\x20found:\x20','pushProject','created','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.'];a134_0x4385=function(){return _0xc8d1df;};return a134_0x4385();}function a134_0x3a00(_0x491460,_0x188091){_0x491460=_0x491460-0x185;const _0x4385b4=a134_0x4385();let _0x3a0027=_0x4385b4[_0x491460];return _0x3a0027;}import{toModelInfos}from'./user-settings.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a134_0x2792fe(0x288),'chat_agent_console','chat_parent_segment'];async function safeListOrEmpty(_0x3360a9){try{return await _0x3360a9();}catch(_0xdb2a82){if(_0xdb2a82 instanceof HTTPClientError&&_0xdb2a82['status']===0x194)return[];throw _0xdb2a82;}}export class LLMSDK{[a134_0x2792fe(0x1da)];[a134_0x2792fe(0x1a0)];[a134_0x2792fe(0x28b)];[a134_0x2792fe(0x18e)]=Logger['of'](a134_0x2792fe(0x239));constructor(_0x46727c){const _0x31d9de=a134_0x2792fe;this[_0x31d9de(0x1a0)]=new LLMApiClient(_0x46727c),this[_0x31d9de(0x28b)]=_0x46727c;}['getDefaultProjectName'](){const _0x47e8ed=getSanitizedUsername();return'tdx_default_'+_0x47e8ed;}async[a134_0x2792fe(0x209)](_0x566b4c){const _0x20d422=a134_0x2792fe,{projectId:_0x5b5888}=await this[_0x20d422(0x1e9)](_0x566b4c);this[_0x20d422(0x1da)]=_0x5b5888;}[a134_0x2792fe(0x240)](){const _0x5c842c=a134_0x2792fe;return this[_0x5c842c(0x1da)];}async[a134_0x2792fe(0x1fc)](_0x1f4c2f){const _0x1543fa=a134_0x2792fe,_0xaa3b40=this[_0x1543fa(0x28b)][_0x1543fa(0x1db)];let _0x4d0e16,_0x1e69c8;if(_0x1f4c2f[_0x1543fa(0x28c)]('/')){const _0x3e7415=_0x1f4c2f[_0x1543fa(0x1c3)]('/');if(_0x3e7415['length']!==0x2)throw new SDKError(ErrorCode[_0x1543fa(0x1a5)],'Invalid\x20agent\x20reference\x20format:\x20'+_0x1f4c2f,undefined,{'helpText':'Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22'});const [_0x27bff3,_0x500da3]=_0x3e7415;_0x4d0e16=await this[_0x1543fa(0x1b1)](_0x27bff3),_0x1e69c8=_0x500da3;}else _0x4d0e16=this[_0x1543fa(0x1da)]||(await this[_0x1543fa(0x232)]())['id'],_0x1e69c8=_0x1f4c2f;const _0x522e0d=await this[_0x1543fa(0x189)](_0x1e69c8,_0x4d0e16),_0x1e6351=await this[_0x1543fa(0x1a0)]['getAgent'](_0x522e0d);writeCachedLLMAgent(_0x1e6351['attributes'][_0x1543fa(0x26a)],_0x522e0d,_0x4d0e16,_0xaa3b40);}['getDefaultAgent'](){const _0x187b69=a134_0x2792fe,_0x43938c=this[_0x187b69(0x28b)][_0x187b69(0x1db)];return readCachedLLMAgent(_0x43938c)||undefined;}[a134_0x2792fe(0x246)](){const _0x33d707=a134_0x2792fe,_0x19ad5a=this[_0x33d707(0x28b)][_0x33d707(0x1db)];clearCachedLLMAgent(_0x19ad5a);}async[a134_0x2792fe(0x210)](){const _0xe8b0c1=a134_0x2792fe,_0x2058e7=await this[_0xe8b0c1(0x1a0)][_0xe8b0c1(0x1bd)]();return toModelInfos(_0x2058e7);}async[a134_0x2792fe(0x1d8)](_0x5b1ec4){const _0x325cd9=a134_0x2792fe;return await this[_0x325cd9(0x1a0)][_0x325cd9(0x1d8)](_0x5b1ec4);}async[a134_0x2792fe(0x299)](_0x51c529){const _0x116dfe=a134_0x2792fe,{projectId:_0x3c82b0}=await this['resolveProjectName'](_0x51c529);await this['client'][_0x116dfe(0x299)](_0x3c82b0);}async['projects'](_0x278506=0x32){const _0x2b8cf0=a134_0x2792fe;return await this[_0x2b8cf0(0x1a0)][_0x2b8cf0(0x1c7)](_0x278506);}async[a134_0x2792fe(0x232)](_0xce428f){const _0x57510e=a134_0x2792fe,_0x8bf7d5=_0xce428f||this['getDefaultProjectName'](),_0x20ef95=this[_0x57510e(0x28b)][_0x57510e(0x1db)];if(!_0xce428f){const _0x5b5392=readCachedLLMProject(_0x20ef95);if(_0x5b5392&&_0x5b5392[_0x57510e(0x26a)]===_0x8bf7d5)try{const _0x106186=await this[_0x57510e(0x1a0)][_0x57510e(0x227)](_0x5b5392['id']);if(_0x106186[_0x57510e(0x19d)][_0x57510e(0x26a)]===_0x8bf7d5)return _0x106186;}catch{}}const _0x4586f7=await this[_0x57510e(0x1a0)][_0x57510e(0x1c7)](),_0x3b5697=_0x4586f7['find'](_0x7a6dc8=>_0x7a6dc8[_0x57510e(0x19d)][_0x57510e(0x26a)]===_0x8bf7d5);if(_0x3b5697)return!_0xce428f&&writeCachedLLMProject(_0x8bf7d5,_0x3b5697['id'],_0x20ef95),_0x3b5697;const _0x15d6d6=await this[_0x57510e(0x1a0)][_0x57510e(0x1d8)]({'name':_0x8bf7d5,'description':_0x57510e(0x1fb)+getSanitizedUsername()+')'});return!_0xce428f&&writeCachedLLMProject(_0x8bf7d5,_0x15d6d6['id'],_0x20ef95),_0x15d6d6;}async[a134_0x2792fe(0x1b1)](_0x4e9723){const _0x28f01e=a134_0x2792fe,_0x512c1f=await this[_0x28f01e(0x1a0)][_0x28f01e(0x1c7)](),_0x45467c=_0x512c1f['filter'](_0x1e3dbb=>_0x1e3dbb[_0x28f01e(0x19d)]['name']===_0x4e9723);if(_0x45467c[_0x28f01e(0x1c5)]===0x0)throw new SDKError(ErrorCode[_0x28f01e(0x223)],_0x28f01e(0x216)+_0x4e9723,undefined,{'helpText':_0x28f01e(0x19a)});if(_0x45467c[_0x28f01e(0x1c5)]>0x1)throw new SDKError(ErrorCode[_0x28f01e(0x25c)],_0x28f01e(0x236)+_0x4e9723+_0x28f01e(0x207));return _0x45467c[0x0]['id'];}async['resolveProjectName'](_0x4efd49){const _0xb0a71d=a134_0x2792fe,_0x2b1d2b=await this['client']['listProjects'](),_0x5817e9=_0x2b1d2b[_0xb0a71d(0x23e)](_0x1e1ee9=>_0x1e1ee9[_0xb0a71d(0x19d)]['name']===_0x4efd49);if(_0x5817e9)return{'projectId':_0x5817e9['id'],'project':_0x5817e9};throw new SDKError(ErrorCode[_0xb0a71d(0x223)],_0xb0a71d(0x216)+_0x4efd49,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async[a134_0x2792fe(0x1e6)](_0x4b987c=a134_0x2792fe(0x295),_0x169772=0x0,_0x277e16){const _0x1087e1=a134_0x2792fe,_0x95be0e=0xa;let _0x3f2c9b=0x0,_0x29886e;while(_0x3f2c9b<_0x95be0e){try{const _0x1daaca=await this['getOrCreateDefaultProject'](_0x29886e),_0x15a5bf=_0x1daaca['id'],_0x1e038c=[_0x1087e1(0x187),_0x1087e1(0x190),'low','medium','high'],_0x3e1b97=_0x169772===0x0?'tdx_'+_0x4b987c:_0x1087e1(0x28d)+_0x4b987c+'_reasoning_'+_0x1e038c[_0x169772],_0x3d2fd9=await this['client'][_0x1087e1(0x1a9)](_0x15a5bf),_0x2dcd36=_0x3d2fd9[_0x1087e1(0x23e)](_0x4a48a8=>_0x4a48a8[_0x1087e1(0x19d)]['name']===_0x3e1b97);if(_0x2dcd36)return _0x2dcd36;const _0x3080fa=_0x169772>0x0?0x1:_0x277e16;return await this['client'][_0x1087e1(0x242)]({'name':_0x3e1b97,'projectId':_0x15a5bf,'modelType':_0x4b987c,'systemPrompt':'','temperature':_0x3080fa,'reasoningEffort':_0x169772>0x0?_0x169772:undefined});}catch(_0x441dbe){if(_0x441dbe instanceof HTTPClientError){const _0x5897de=_0x441dbe[_0x1087e1(0x221)];if(_0x5897de>=0x190&&_0x5897de<0x1f4){if(_0x5897de===0x191)throw new SDKError(ErrorCode[_0x1087e1(0x211)],_0x1087e1(0x1cf),_0x441dbe);else{if(_0x5897de===0x193)throw new SDKError(ErrorCode[_0x1087e1(0x275)],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x441dbe);}throw _0x441dbe;}}if(errorContains(_0x441dbe,_0x1087e1(0x291),_0x1087e1(0x231),_0x1087e1(0x283))){_0x3f2c9b++;if(_0x3f2c9b>=_0x95be0e)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x1087e1(0x274)+_0x95be0e+_0x1087e1(0x206),_0x441dbe);const _0x4ee7c9=this[_0x1087e1(0x271)]();_0x29886e=_0x4ee7c9+'_'+generateRandomHex();continue;}throw _0x441dbe;}}throw new SDKError(ErrorCode[_0x1087e1(0x25c)],_0x1087e1(0x1e1));}async['resolveAgentId'](_0x1e0928,_0x3763d7){const _0x47dfec=a134_0x2792fe,_0x445ace=_0x3763d7||this[_0x47dfec(0x1da)],_0x2e618d=await this['client']['listAgents'](_0x445ace),_0x522741=_0x2e618d[_0x47dfec(0x1ad)](_0x4d062c=>_0x4d062c[_0x47dfec(0x19d)]['name']===_0x1e0928);if(_0x522741['length']===0x0){const _0x3bce18=_0x445ace?_0x47dfec(0x248)+_0x445ace:'';throw new SDKError(ErrorCode[_0x47dfec(0x1ca)],_0x47dfec(0x21e)+_0x1e0928+_0x3bce18,undefined,{'helpText':_0x445ace?_0x47dfec(0x282):_0x47dfec(0x24b)});}if(_0x522741['length']>0x1)throw new SDKError(ErrorCode[_0x47dfec(0x25c)],'Multiple\x20agents\x20found\x20with\x20name\x20\x27'+_0x1e0928+'\x27.\x20This\x20should\x20not\x20happen.');return _0x522741[0x0]['id'];}async['agents'](_0x53232c){const _0x354250=a134_0x2792fe,_0x35b877=_0x53232c||this[_0x354250(0x1da)];return await this['client'][_0x354250(0x1a9)](_0x35b877);}async[a134_0x2792fe(0x2a3)](_0x1bab29){const _0x2d5228=a134_0x2792fe;return await this['client'][_0x2d5228(0x22a)](_0x1bab29);}async[a134_0x2792fe(0x1b5)](_0x342356){const _0x20cd8c=a134_0x2792fe;return await this[_0x20cd8c(0x1a0)][_0x20cd8c(0x214)](_0x342356);}async[a134_0x2792fe(0x242)](_0x177bca){const _0x14e0d2=a134_0x2792fe;return await this['client'][_0x14e0d2(0x242)](_0x177bca);}async['updateAgent'](_0x4b3185,_0x5c0fd1){const _0x2f1f19=a134_0x2792fe;return await this[_0x2f1f19(0x1a0)][_0x2f1f19(0x285)](_0x4b3185,_0x5c0fd1);}async['deleteAgent'](_0xc0d9aa){const _0x59fc3a=a134_0x2792fe;await this[_0x59fc3a(0x1a0)][_0x59fc3a(0x264)](_0xc0d9aa);}async[a134_0x2792fe(0x27f)](_0x28f2b2){const _0x2663b9=a134_0x2792fe;return await this['client'][_0x2663b9(0x27f)]({'agentId':_0x28f2b2});}async*['chat'](_0x11e044,_0x2c5efb){const _0xdcafa1=a134_0x2792fe;let _0x26bba2=_0x2c5efb?.[_0xdcafa1(0x273)];const _0x2de3bd=_0x2c5efb?.[_0xdcafa1(0x29e)];if(!_0x26bba2){if(!_0x2de3bd)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0xd28997=await this[_0xdcafa1(0x1a0)]['startChat']({'agentId':_0x2de3bd});_0x26bba2=_0xd28997['id'],yield{'type':_0xdcafa1(0x230),'data':{'chatId':_0x26bba2,'agentId':_0x2de3bd,'projectId':_0xd28997['attributes'][_0xdcafa1(0x1dd)]}};}for await(const _0x4ced1c of this[_0xdcafa1(0x1a0)][_0xdcafa1(0x1d2)](_0x26bba2,_0x11e044,_0x2c5efb?.['signal'])){yield{'type':_0xdcafa1(0x27b),'data':_0x4ced1c};}}async[a134_0x2792fe(0x1a4)](_0x2dbcc4=0x32){const _0xe514b8=a134_0x2792fe;return await this[_0xe514b8(0x1a0)][_0xe514b8(0x24a)](_0x2dbcc4);}async['history'](_0x28d131){const _0x522fec=a134_0x2792fe;return await this[_0x522fec(0x1a0)][_0x522fec(0x25a)](_0x28d131);}async[a134_0x2792fe(0x2a1)](_0x3c33de){const _0x40b967=a134_0x2792fe;return await this[_0x40b967(0x1a0)][_0x40b967(0x2a1)](_0x3c33de);}async[a134_0x2792fe(0x28e)](_0x5a7e2c){const _0x3f8151=a134_0x2792fe;return await this[_0x3f8151(0x1a0)]['getChatInfo'](_0x5a7e2c);}async[a134_0x2792fe(0x1d9)](_0x381005,_0x2546c4,_0x421b7f){const _0x57050d=a134_0x2792fe,_0x440002=_0x421b7f?.['dryRun']??![],{projectId:_0x2debf2,project:_0x5622e2}=await this['resolveProjectName'](_0x381005),_0x154d6d=_0x5622e2[_0x57050d(0x19d)][_0x57050d(0x26a)],_0x235b4d=_0x2546c4||_0x154d6d+_0x57050d(0x1d3);if(a134_0x52ac94[_0x57050d(0x249)](_0x235b4d)&&!_0x440002)throw new SDKError(ErrorCode['ALREADY_EXISTS'],'Output\x20directory\x20already\x20exists:\x20'+_0x235b4d,undefined,{'helpText':_0x57050d(0x29f)});const _0x89ba31=await this[_0x57050d(0x1a0)][_0x57050d(0x22a)](_0x2debf2),_0x1ec89f=await this['client'][_0x57050d(0x1e5)](_0x2debf2),_0xb7baa7=await this['client'][_0x57050d(0x1b6)](_0x2debf2),_0x3747ef=await this[_0x57050d(0x1a0)]['listIntegrations'](_0x2debf2);if(!_0x440002){a134_0x52ac94[_0x57050d(0x25d)](_0x235b4d,{'recursive':!![]});const _0x40cb07={'version':_0x57050d(0x2a0),'exportedAt':new Date()[_0x57050d(0x1a6)](),'exportedFrom':{'site':this[_0x57050d(0x28b)][_0x57050d(0x1ab)],'projectId':_0x2debf2,'projectName':_0x154d6d},'project':_0x5622e2};a134_0x52ac94[_0x57050d(0x1bc)](a134_0x5b5f34[_0x57050d(0x1a2)](_0x235b4d,_0x57050d(0x263)),JSON[_0x57050d(0x194)](_0x40cb07,null,0x2)),a134_0x52ac94[_0x57050d(0x1bc)](a134_0x5b5f34[_0x57050d(0x1a2)](_0x235b4d,_0x57050d(0x1bb)),JSON['stringify'](_0x89ba31,null,0x2)),a134_0x52ac94[_0x57050d(0x1bc)](a134_0x5b5f34[_0x57050d(0x1a2)](_0x235b4d,_0x57050d(0x26f)),JSON[_0x57050d(0x194)](_0x1ec89f,null,0x2)),a134_0x52ac94['writeFileSync'](a134_0x5b5f34[_0x57050d(0x1a2)](_0x235b4d,_0x57050d(0x188)),JSON[_0x57050d(0x194)](_0xb7baa7,null,0x2)),a134_0x52ac94[_0x57050d(0x1bc)](a134_0x5b5f34[_0x57050d(0x1a2)](_0x235b4d,'integrations.json'),JSON[_0x57050d(0x194)](_0x3747ef,null,0x2));}return{'projectName':_0x154d6d,'outputDir':_0x235b4d,'counts':{'agents':_0x89ba31[_0x57050d(0x1c5)],'knowledgeBases':_0x1ec89f[_0x57050d(0x1c5)],'prompts':_0xb7baa7[_0x57050d(0x1c5)],'integrations':_0x3747ef[_0x57050d(0x1c5)]}};}async['restoreProject'](_0x44afc2,_0x3551fd){const _0x5f4259=a134_0x2792fe,_0x37d19e=_0x3551fd?.[_0x5f4259(0x228)]??![],_0x230b36=this[_0x5f4259(0x1a3)](_0x44afc2),_0x1345ef=_0x230b36[_0x5f4259(0x255)][_0x5f4259(0x1ab)],_0x535834=this[_0x5f4259(0x28b)][_0x5f4259(0x1ab)],_0x2ff4e1=_0x1345ef!==_0x535834?_0x1345ef:undefined,_0x302f4a=this[_0x5f4259(0x18a)](a134_0x5b5f34['join'](_0x44afc2,_0x5f4259(0x1bb)),[]),_0x3e4762=this[_0x5f4259(0x18a)](a134_0x5b5f34[_0x5f4259(0x1a2)](_0x44afc2,_0x5f4259(0x26f)),[]),_0x983edd=this[_0x5f4259(0x18a)](a134_0x5b5f34[_0x5f4259(0x1a2)](_0x44afc2,_0x5f4259(0x188)),[]),_0x100d3f=this[_0x5f4259(0x18a)](a134_0x5b5f34[_0x5f4259(0x1a2)](_0x44afc2,_0x5f4259(0x208)),[]),_0x82ff7=_0x3551fd?.[_0x5f4259(0x26a)]||_0x230b36['exportedFrom'][_0x5f4259(0x1fa)];if(_0x37d19e){const _0x339b5a=new Map(),_0x193151=[..._0x302f4a],_0x6fa1da=_0x302f4a[_0x5f4259(0x1c5)]+0x1;let _0x6b3399=0x0;while(_0x193151[_0x5f4259(0x1c5)]>0x0&&_0x6b3399<_0x6fa1da){_0x6b3399++;const _0x5b06fd=[];for(const _0x2bb28f of _0x193151){canCreateAgent(_0x2bb28f,_0x339b5a)?_0x339b5a['set'](_0x2bb28f['id'],_0x5f4259(0x1d6)+_0x2bb28f['id']):_0x5b06fd['push'](_0x2bb28f);}if(_0x5b06fd['length']===_0x193151[_0x5f4259(0x1c5)])throw new SDKError(ErrorCode[_0x5f4259(0x25c)],_0x5f4259(0x21a),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x193151[_0x5f4259(0x1c5)]=0x0,_0x193151[_0x5f4259(0x1d5)](..._0x5b06fd);}const _0x572ca7=_0x983edd[_0x5f4259(0x1ad)](_0x103fe4=>_0x339b5a[_0x5f4259(0x205)](_0x103fe4[_0x5f4259(0x19d)][_0x5f4259(0x29e)]))[_0x5f4259(0x1c5)];return{'projectName':_0x82ff7,'projectId':'(dry-run)','counts':{'agents':_0x302f4a['length'],'knowledgeBases':_0x3e4762[_0x5f4259(0x1c5)],'prompts':_0x572ca7,'integrations':_0x100d3f['length']},'sourceSite':_0x2ff4e1};}const _0x448e71=await this[_0x5f4259(0x1a0)][_0x5f4259(0x1d8)]({'name':_0x82ff7,'description':_0x230b36[_0x5f4259(0x213)][_0x5f4259(0x19d)]['description']}),_0x13df17=_0x448e71['id'],_0x6306a5=new Map(),_0x20beaf=new Map(),_0xf52954=new Map();for(const _0x2e90cf of _0x3e4762){const _0x127e96=await this[_0x5f4259(0x1a0)]['createKnowledgeBase']({'projectId':_0x13df17,'name':_0x2e90cf[_0x5f4259(0x19d)][_0x5f4259(0x26a)],'tdDatabaseName':_0x2e90cf[_0x5f4259(0x19d)]['tdDatabaseName'],'tables':_0x2e90cf[_0x5f4259(0x19d)]['tables']});_0x6306a5[_0x5f4259(0x289)](_0x2e90cf['id'],_0x127e96['id']);}const _0x4e509f=[..._0x302f4a],_0x49ea7e=_0x302f4a[_0x5f4259(0x1c5)]+0x1;let _0x42e1bc=0x0;while(_0x4e509f[_0x5f4259(0x1c5)]>0x0&&_0x42e1bc<_0x49ea7e){_0x42e1bc++;const _0x4eb11c=[];for(const _0x561bab of _0x4e509f){if(canCreateAgent(_0x561bab,_0x20beaf)){const _0x499ec8=remapToolIds(_0x561bab[_0x5f4259(0x19d)][_0x5f4259(0x199)],_0x6306a5,_0x20beaf),_0xfc0c46=remapVariableIds(_0x561bab[_0x5f4259(0x19d)][_0x5f4259(0x1fe)],_0x6306a5),_0x5e7c07=await this[_0x5f4259(0x1a0)]['createAgentResponse']({'name':_0x561bab[_0x5f4259(0x19d)][_0x5f4259(0x26a)],'projectId':_0x13df17,'systemPrompt':_0x561bab['attributes'][_0x5f4259(0x1c0)],'starterMessage':_0x561bab[_0x5f4259(0x19d)][_0x5f4259(0x252)],'modelType':migrateModelType(_0x561bab[_0x5f4259(0x19d)][_0x5f4259(0x20f)]),'maxToolIterations':_0x561bab[_0x5f4259(0x19d)][_0x5f4259(0x27e)],'temperature':_0x561bab[_0x5f4259(0x19d)][_0x5f4259(0x23f)],'reasoningEffort':_0x561bab[_0x5f4259(0x19d)][_0x5f4259(0x1b2)],'outputs':_0x561bab[_0x5f4259(0x19d)][_0x5f4259(0x197)],'tools':_0x499ec8,'variables':_0xfc0c46});_0x20beaf[_0x5f4259(0x289)](_0x561bab['id'],_0x5e7c07['id']);}else _0x4eb11c[_0x5f4259(0x1d5)](_0x561bab);}if(_0x4eb11c[_0x5f4259(0x1c5)]===_0x4e509f[_0x5f4259(0x1c5)])throw new SDKError(ErrorCode[_0x5f4259(0x25c)],_0x5f4259(0x21a),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x4e509f[_0x5f4259(0x1c5)]=0x0,_0x4e509f[_0x5f4259(0x1d5)](..._0x4eb11c);}for(const _0x5467cf of _0x983edd){const _0x55d051=_0x20beaf[_0x5f4259(0x229)](_0x5467cf['attributes'][_0x5f4259(0x29e)]);if(!_0x55d051)continue;const _0x3bc90e=await this[_0x5f4259(0x1a0)][_0x5f4259(0x296)]({'projectId':_0x13df17,'agentId':_0x55d051,'name':_0x5467cf[_0x5f4259(0x19d)]['name'],'systemPrompt':_0x5467cf[_0x5f4259(0x19d)]['systemPrompt'],'template':_0x5467cf['attributes'][_0x5f4259(0x1e3)],'jsonSchemaHint':_0x5467cf[_0x5f4259(0x19d)]['jsonSchemaHint']});_0xf52954['set'](_0x5467cf['id'],_0x3bc90e['id']);}for(const _0x32825f of _0x100d3f){const _0x3b7041=_0x32825f['attributes'][_0x5f4259(0x237)][_0x5f4259(0x24e)](_0x1a1c48=>({..._0x1a1c48,'promptId':_0xf52954[_0x5f4259(0x229)](_0x1a1c48[_0x5f4259(0x267)])||_0x1a1c48[_0x5f4259(0x267)]}));await this[_0x5f4259(0x1a0)][_0x5f4259(0x26c)]({'projectId':_0x13df17,'serviceType':_0x32825f[_0x5f4259(0x19d)]['serviceType'],'actions':_0x3b7041,'slackMessageMode':_0x32825f[_0x5f4259(0x19d)][_0x5f4259(0x1f8)],'chatIgnoreManagedActions':_0x32825f[_0x5f4259(0x19d)][_0x5f4259(0x1d1)],'chatWelcomeMessage':_0x32825f[_0x5f4259(0x19d)][_0x5f4259(0x212)],'webhookCorsOrigins':_0x32825f['attributes'][_0x5f4259(0x2a2)]});}return{'projectName':_0x82ff7,'projectId':_0x13df17,'counts':{'agents':_0x20beaf[_0x5f4259(0x287)],'knowledgeBases':_0x6306a5[_0x5f4259(0x287)],'prompts':_0xf52954[_0x5f4259(0x287)],'integrations':_0x100d3f['length']},'sourceSite':_0x2ff4e1};}[a134_0x2792fe(0x18a)](_0xcdfd12,_0x1dfe62){const _0x5348a5=a134_0x2792fe;if(!a134_0x52ac94[_0x5348a5(0x249)](_0xcdfd12))return _0x1dfe62;return JSON[_0x5348a5(0x1a7)](a134_0x52ac94['readFileSync'](_0xcdfd12,_0x5348a5(0x254)));}[a134_0x2792fe(0x1a3)](_0x3d162d){const _0x46ac28=a134_0x2792fe;if(!a134_0x52ac94['existsSync'](_0x3d162d))throw new SDKError(ErrorCode[_0x46ac28(0x1cc)],_0x46ac28(0x22c)+_0x3d162d,undefined,{'helpText':_0x46ac28(0x1df)});const _0x2fc428=a134_0x5b5f34[_0x46ac28(0x1a2)](_0x3d162d,_0x46ac28(0x263));if(!a134_0x52ac94[_0x46ac28(0x249)](_0x2fc428))throw new SDKError(ErrorCode[_0x46ac28(0x1a5)],_0x46ac28(0x21b)+_0x3d162d,undefined,{'helpText':_0x46ac28(0x1cb)});const _0x53e426=JSON[_0x46ac28(0x1a7)](a134_0x52ac94['readFileSync'](_0x2fc428,_0x46ac28(0x254)));if(!isSupportedBackupVersion(_0x53e426['version']))throw new SDKError(ErrorCode[_0x46ac28(0x1a5)],'Unsupported\x20backup\x20version:\x20'+_0x53e426[_0x46ac28(0x1f9)],undefined,{'helpText':_0x46ac28(0x219)});return _0x53e426;}async[a134_0x2792fe(0x1eb)](_0x39b8d1,_0x8305e7,_0x294a25){const _0x1e193f=a134_0x2792fe,{projectId:_0x2beb3f,project:_0x1a2429}=await this[_0x1e193f(0x1e9)](_0x39b8d1),_0x3dd585=_0x1a2429[_0x1e193f(0x19d)][_0x1e193f(0x26a)];let _0x49ac9b;if(_0x8305e7)_0x49ac9b=_0x8305e7;else{const _0x2ee91a=a134_0x5b5f34[_0x1e193f(0x1a2)](process['cwd'](),_0x1e193f(0x258)),_0x96da0d=getSanitizedPathWithMigration(_0x2ee91a,_0x3dd585);_0x96da0d['renamed']&&this[_0x1e193f(0x18e)][_0x1e193f(0x195)](_0x1e193f(0x27c)+a134_0x5b5f34[_0x1e193f(0x268)](_0x96da0d[_0x1e193f(0x1e7)])+_0x1e193f(0x24f)+a134_0x5b5f34['basename'](_0x96da0d[_0x1e193f(0x24d)])),_0x49ac9b=_0x96da0d[_0x1e193f(0x24d)];}const _0x9077d5=await this[_0x1e193f(0x1a0)][_0x1e193f(0x22a)](_0x2beb3f),_0x169435=await this[_0x1e193f(0x1a0)]['listKnowledgeBases'](_0x2beb3f),_0x242463=await this[_0x1e193f(0x1a0)][_0x1e193f(0x1c2)](_0x2beb3f),_0x54299b=await safeListOrEmpty(()=>this[_0x1e193f(0x1a0)]['listImageGenerators'](_0x2beb3f)),_0x5658a8=await safeListOrEmpty(()=>this[_0x1e193f(0x1a0)][_0x1e193f(0x266)](_0x2beb3f)),_0x88b4b9=await this[_0x1e193f(0x1a0)][_0x1e193f(0x1b6)](_0x2beb3f),_0x515f30=await this[_0x1e193f(0x1a0)][_0x1e193f(0x21d)](_0x2beb3f),_0x27f5dc=await safeListOrEmpty(()=>this['client']['listExperimentalKnowledgeBases'](_0x2beb3f)),_0x3cbc50=await safeListOrEmpty(()=>this[_0x1e193f(0x1a0)][_0x1e193f(0x22f)](_0x2beb3f)),_0x1e4693=await safeListOrEmpty(()=>this[_0x1e193f(0x1a0)]['listFormInterfaces'](_0x2beb3f)),_0x4037ca=await safeListOrEmpty(()=>this[_0x1e193f(0x1a0)][_0x1e193f(0x243)](_0x2beb3f)),_0x1d40cc=_0x515f30[_0x1e193f(0x1ad)](_0x2da976=>!_0x2da976[_0x1e193f(0x19d)][_0x1e193f(0x19c)]&&SAFE_INTEGRATION_TYPES[_0x1e193f(0x28c)](_0x2da976[_0x1e193f(0x19d)][_0x1e193f(0x297)]['toLowerCase']())),_0x153a82=new Map(),_0x1c1747=new Map(),_0x47c3de=new Map(),_0x25d79c=new Map(),_0x391690=new Map(),_0x3e7b70=new Map(),_0x138f91=new Map();for(const _0x432d18 of _0x9077d5){_0x153a82[_0x1e193f(0x289)](_0x432d18['id'],_0x432d18[_0x1e193f(0x19d)]['name']);}for(const _0x24c800 of _0x169435){_0x1c1747['set'](_0x24c800['id'],_0x24c800[_0x1e193f(0x19d)][_0x1e193f(0x26a)]);}for(const _0x52e31d of _0x242463){_0x47c3de[_0x1e193f(0x289)](_0x52e31d['id'],_0x52e31d[_0x1e193f(0x19d)][_0x1e193f(0x26a)]);}for(const _0x434c2d of _0x54299b){_0x25d79c[_0x1e193f(0x289)](_0x434c2d['id'],_0x434c2d[_0x1e193f(0x19d)][_0x1e193f(0x26a)]);}for(const _0x278831 of _0x5658a8){_0x391690[_0x1e193f(0x289)](_0x278831['id'],_0x278831[_0x1e193f(0x19d)][_0x1e193f(0x26a)]);}for(const _0x4532a5 of _0x88b4b9){_0x3e7b70[_0x1e193f(0x289)](_0x4532a5['id'],_0x4532a5[_0x1e193f(0x19d)][_0x1e193f(0x26a)]);}for(const _0x5f58f2 of _0x27f5dc){_0x138f91[_0x1e193f(0x289)](_0x5f58f2['id'],_0x5f58f2[_0x1e193f(0x19d)][_0x1e193f(0x26a)]);}const _0x397b34={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x1c1747,'TextKnowledgeBase':_0x47c3de,'Agent':_0x153a82,'WebSearchTool':_0x391690,'ImageGenerator':_0x25d79c,'ExperimentalKnowledgeBase':_0x138f91}),'resolvePromptName':async _0x5f1590=>_0x3e7b70[_0x1e193f(0x229)](_0x5f1590),'onWarning':_0x5d6080=>this[_0x1e193f(0x18e)][_0x1e193f(0x25b)](_0x5d6080)},_0x4fb122={'projectName':_0x3dd585,'outputDir':_0x49ac9b,'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}}},_0x5692dc=[],_0x2bab7e=[];for(const _0x4dcc20 of _0x9077d5){const _0x5ec231=getSanitizedPathWithMigration(_0x49ac9b,_0x4dcc20[_0x1e193f(0x19d)][_0x1e193f(0x26a)]);_0x5ec231[_0x1e193f(0x1cd)]&&this[_0x1e193f(0x18e)]['info']('Renamed\x20agent\x20folder:\x20'+a134_0x5b5f34[_0x1e193f(0x268)](_0x5ec231['oldPath'])+_0x1e193f(0x24f)+a134_0x5b5f34[_0x1e193f(0x268)](_0x5ec231['path']));const _0x467af7=_0x5ec231[_0x1e193f(0x24d)],_0x563b02=a134_0x5b5f34['join'](_0x467af7,_0x1e193f(0x191)),_0x314465=a134_0x5b5f34['join'](_0x467af7,_0x1e193f(0x1b8)),_0x4cccd1=a134_0x5b5f34['join'](_0x467af7,_0x1e193f(0x257)),{yaml:_0xc7ca1a,systemPrompt:_0x56d51d,starterMessage:_0x14a1cd}=await agentResponseToDef(_0x4dcc20,_0x397b34),_0x43d558=toAgentYamlString(_0xc7ca1a),_0x265bf1=!a134_0x52ac94[_0x1e193f(0x249)](_0x314465);let _0x1a847d=_0x265bf1,_0x24b23e;if(!_0x265bf1){const _0x56b549=a134_0x52ac94[_0x1e193f(0x249)](_0x563b02)?a134_0x52ac94[_0x1e193f(0x260)](_0x563b02,_0x1e193f(0x254)):'',_0xd03518=a134_0x52ac94['readFileSync'](_0x314465,_0x1e193f(0x254)),_0x7d1211=_0x1e193f(0x193)+_0x56b549+_0x1e193f(0x1c4)+_0xd03518,_0x43f32='#\x20prompt.md\x0a'+_0x56d51d+'\x0a\x0a#\x20agent.yml\x0a'+_0x43d558,_0x6001ca=generateDiff(_0x7d1211,_0x43f32);_0x1a847d=hasChanges(_0x6001ca),_0x1a847d&&(_0x24b23e=formatDiffWithColors(_0x6001ca));}_0x5692dc['push']({'path':_0x467af7,'content':'','isDir':!![]}),_0x5692dc[_0x1e193f(0x1d5)]({'path':_0x563b02,'content':_0x56d51d}),_0x5692dc[_0x1e193f(0x1d5)]({'path':_0x314465,'content':_0x43d558});_0x14a1cd&&_0x14a1cd[_0x1e193f(0x28c)]('\x0a')&&_0x5692dc[_0x1e193f(0x1d5)]({'path':_0x4cccd1,'content':_0x14a1cd});_0x4fb122[_0x1e193f(0x258)][_0x1e193f(0x1d5)]({'agentName':_0x4dcc20[_0x1e193f(0x19d)][_0x1e193f(0x26a)],'outputPath':_0x467af7,'isNew':_0x265bf1,'hasChanges':_0x1a847d,'diff':_0x24b23e}),_0x4fb122[_0x1e193f(0x1a1)]['agents'][_0x1e193f(0x1d0)]++;if(_0x265bf1)_0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x258)][_0x1e193f(0x200)]++;else{if(_0x1a847d)_0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x258)][_0x1e193f(0x19e)]++;else _0x4fb122[_0x1e193f(0x1a1)]['agents'][_0x1e193f(0x1ec)]++;}}for(const _0x5ce93f of _0x169435){if(_0x5ce93f[_0x1e193f(0x19d)][_0x1e193f(0x19c)])continue;const _0x1004d2=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x49ac9b),_0x5ce93f[_0x1e193f(0x19d)][_0x1e193f(0x26a)],_0x1e193f(0x29c));_0x1004d2[_0x1e193f(0x1cd)]&&this['logger'][_0x1e193f(0x195)](_0x1e193f(0x1c9)+a134_0x5b5f34[_0x1e193f(0x268)](_0x1004d2[_0x1e193f(0x1e7)])+_0x1e193f(0x24f)+a134_0x5b5f34[_0x1e193f(0x268)](_0x1004d2[_0x1e193f(0x24d)]));const _0xc425d0=_0x1004d2[_0x1e193f(0x24d)],_0x544b6f=apiKnowledgeBaseToYaml(_0x5ce93f),_0x43810e=toKnowledgeBaseYamlString(_0x544b6f),_0x1a5c63=!a134_0x52ac94['existsSync'](_0xc425d0);let _0x51fff1=_0x1a5c63,_0x2cc1d4;if(!_0x1a5c63){const _0x594cb2=a134_0x52ac94['readFileSync'](_0xc425d0,'utf-8'),_0x319588=generateDiff(_0x594cb2,_0x43810e);_0x51fff1=hasChanges(_0x319588),_0x51fff1&&(_0x2cc1d4=formatDiffWithColors(_0x319588));}_0x5692dc['push']({'path':_0xc425d0,'content':_0x43810e}),_0x4fb122[_0x1e193f(0x280)][_0x1e193f(0x1d5)]({'name':_0x5ce93f['attributes'][_0x1e193f(0x26a)],'outputPath':_0xc425d0,'isNew':_0x1a5c63,'hasChanges':_0x51fff1,'diff':_0x2cc1d4}),_0x4fb122['counts']['knowledgeBases'][_0x1e193f(0x1d0)]++;if(_0x1a5c63)_0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x280)][_0x1e193f(0x200)]++;else{if(_0x51fff1)_0x4fb122['counts'][_0x1e193f(0x280)][_0x1e193f(0x19e)]++;else _0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x280)][_0x1e193f(0x1ec)]++;}}for(const _0x90d1b0 of _0x242463){if(_0x90d1b0[_0x1e193f(0x19d)][_0x1e193f(0x19c)])continue;const _0x24f5c5=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x49ac9b),_0x90d1b0[_0x1e193f(0x19d)]['name'],_0x1e193f(0x1f5));_0x24f5c5['renamed']&&this[_0x1e193f(0x18e)][_0x1e193f(0x195)](_0x1e193f(0x1f4)+a134_0x5b5f34[_0x1e193f(0x268)](_0x24f5c5[_0x1e193f(0x1e7)])+_0x1e193f(0x24f)+a134_0x5b5f34['basename'](_0x24f5c5['path']));const _0xd9ff10=_0x24f5c5[_0x1e193f(0x24d)],_0x154d39=toTextKnowledgeBaseMd(_0x90d1b0[_0x1e193f(0x19d)]['name'],_0x90d1b0[_0x1e193f(0x19d)][_0x1e193f(0x1f7)]),_0xe57752=!a134_0x52ac94['existsSync'](_0xd9ff10);let _0x2b451e=_0xe57752,_0x2ee1d2;if(!_0xe57752){const _0x38b384=a134_0x52ac94['readFileSync'](_0xd9ff10,_0x1e193f(0x254)),_0x171d07=generateDiff(_0x38b384,_0x154d39);_0x2b451e=hasChanges(_0x171d07),_0x2b451e&&(_0x2ee1d2=formatDiffWithColors(_0x171d07));}_0x5692dc[_0x1e193f(0x1d5)]({'path':_0xd9ff10,'content':_0x154d39}),_0x4fb122[_0x1e193f(0x27d)][_0x1e193f(0x1d5)]({'name':_0x90d1b0[_0x1e193f(0x19d)]['name'],'outputPath':_0xd9ff10,'isNew':_0xe57752,'hasChanges':_0x2b451e,'diff':_0x2ee1d2}),_0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x27d)][_0x1e193f(0x1d0)]++;if(_0xe57752)_0x4fb122['counts']['textKnowledgeBases'][_0x1e193f(0x200)]++;else{if(_0x2b451e)_0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x27d)][_0x1e193f(0x19e)]++;else _0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x27d)][_0x1e193f(0x1ec)]++;}}for(const _0x24777c of _0x88b4b9){if(_0x24777c[_0x1e193f(0x19d)][_0x1e193f(0x19c)])continue;const _0x258875=getSanitizedPathWithMigration(getPromptsDir(_0x49ac9b),_0x24777c[_0x1e193f(0x19d)][_0x1e193f(0x26a)],_0x1e193f(0x29c));_0x258875[_0x1e193f(0x1cd)]&&this['logger'][_0x1e193f(0x195)]('Renamed\x20prompt\x20file:\x20'+a134_0x5b5f34[_0x1e193f(0x268)](_0x258875[_0x1e193f(0x1e7)])+_0x1e193f(0x24f)+a134_0x5b5f34[_0x1e193f(0x268)](_0x258875['path']));const _0x549b04=_0x258875[_0x1e193f(0x24d)],_0x178572=await apiPromptToYaml(_0x24777c,_0x397b34);if(!_0x178572)continue;const _0x521dd8=toPromptYamlString(_0x178572),_0x22c31a=!a134_0x52ac94['existsSync'](_0x549b04);let _0x221a25=_0x22c31a,_0xb2000b;if(!_0x22c31a){const _0x2ec59f=a134_0x52ac94[_0x1e193f(0x260)](_0x549b04,_0x1e193f(0x254)),_0x333a1f=generateDiff(_0x2ec59f,_0x521dd8);_0x221a25=hasChanges(_0x333a1f),_0x221a25&&(_0xb2000b=formatDiffWithColors(_0x333a1f));}_0x5692dc[_0x1e193f(0x1d5)]({'path':_0x549b04,'content':_0x521dd8}),_0x4fb122[_0x1e193f(0x290)][_0x1e193f(0x1d5)]({'name':_0x24777c[_0x1e193f(0x19d)][_0x1e193f(0x26a)],'outputPath':_0x549b04,'isNew':_0x22c31a,'hasChanges':_0x221a25,'diff':_0xb2000b}),_0x4fb122['counts'][_0x1e193f(0x290)][_0x1e193f(0x1d0)]++;if(_0x22c31a)_0x4fb122['counts'][_0x1e193f(0x290)][_0x1e193f(0x200)]++;else{if(_0x221a25)_0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x290)][_0x1e193f(0x19e)]++;else _0x4fb122[_0x1e193f(0x1a1)]['prompts']['unchanged']++;}}for(const _0x258636 of _0x1d40cc){const _0x296efc=_0x258636[_0x1e193f(0x19d)]['serviceType'][_0x1e193f(0x293)](),_0x4fc386=getSanitizedPathWithMigration(getIntegrationsDir(_0x49ac9b),_0x296efc,_0x1e193f(0x29c));_0x4fc386[_0x1e193f(0x1cd)]&&this['logger'][_0x1e193f(0x195)]('Renamed\x20integration\x20file:\x20'+a134_0x5b5f34[_0x1e193f(0x268)](_0x4fc386['oldPath'])+_0x1e193f(0x24f)+a134_0x5b5f34[_0x1e193f(0x268)](_0x4fc386['path']));const _0x5c2495=_0x4fc386[_0x1e193f(0x24d)],_0x25310a=await apiIntegrationToYaml(_0x258636,_0x397b34),_0x4a9893=toIntegrationYamlString(_0x25310a),_0x3f6f31=!a134_0x52ac94['existsSync'](_0x5c2495);let _0x53ad72=_0x3f6f31,_0xe81004;if(!_0x3f6f31){const _0x117271=a134_0x52ac94[_0x1e193f(0x260)](_0x5c2495,_0x1e193f(0x254)),_0x458340=generateDiff(_0x117271,_0x4a9893);_0x53ad72=hasChanges(_0x458340),_0x53ad72&&(_0xe81004=formatDiffWithColors(_0x458340));}_0x5692dc[_0x1e193f(0x1d5)]({'path':_0x5c2495,'content':_0x4a9893}),_0x4fb122[_0x1e193f(0x253)][_0x1e193f(0x1d5)]({'name':_0x296efc,'outputPath':_0x5c2495,'isNew':_0x3f6f31,'hasChanges':_0x53ad72,'diff':_0xe81004}),_0x4fb122[_0x1e193f(0x1a1)]['integrations'][_0x1e193f(0x1d0)]++;if(_0x3f6f31)_0x4fb122[_0x1e193f(0x1a1)]['integrations']['new']++;else{if(_0x53ad72)_0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x253)][_0x1e193f(0x19e)]++;else _0x4fb122[_0x1e193f(0x1a1)]['integrations'][_0x1e193f(0x1ec)]++;}}for(const _0x70d36f of _0x27f5dc){if(_0x70d36f[_0x1e193f(0x19d)][_0x1e193f(0x19c)])continue;const _0x3f7d4b=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x49ac9b),_0x70d36f[_0x1e193f(0x19d)]['name']);_0x3f7d4b['renamed']&&this[_0x1e193f(0x18e)][_0x1e193f(0x195)](_0x1e193f(0x204)+a134_0x5b5f34[_0x1e193f(0x268)](_0x3f7d4b[_0x1e193f(0x1e7)])+_0x1e193f(0x24f)+a134_0x5b5f34[_0x1e193f(0x268)](_0x3f7d4b[_0x1e193f(0x24d)]));const _0x2dbf99=_0x3f7d4b[_0x1e193f(0x24d)],_0x539c72=a134_0x5b5f34[_0x1e193f(0x1a2)](_0x2dbf99,sanitizeForFilesystem(_0x70d36f[_0x1e193f(0x19d)][_0x1e193f(0x26a)])+_0x1e193f(0x29c)),_0x4ac471=a134_0x5b5f34[_0x1e193f(0x1a2)](_0x2dbf99,_0x1e193f(0x1e0)),_0x4092e8=apiExperimentalKnowledgeBaseToYaml(_0x70d36f),_0x402513=toExperimentalKnowledgeBaseYamlString(_0x4092e8),_0x2792cb=!a134_0x52ac94['existsSync'](_0x2dbf99);let _0x242bb6=_0x2792cb,_0x15795d,_0x2bb80b=_0x402513;const _0x4a81b6=[..._0x4092e8['functions']][_0x1e193f(0x1be)]((_0x42178e,_0x2a5c5d)=>_0x42178e[_0x1e193f(0x26a)][_0x1e193f(0x1d7)](_0x2a5c5d[_0x1e193f(0x26a)]));for(const _0x1179dd of _0x4a81b6){_0x2bb80b+='\x0a---\x20function:\x20'+_0x1179dd[_0x1e193f(0x26a)]+_0x1e193f(0x1aa)+_0x1179dd[_0x1e193f(0x20d)]+_0x1e193f(0x18f)+_0x1179dd[_0x1e193f(0x26a)]+_0x1e193f(0x1aa)+_0x1179dd[_0x1e193f(0x26e)]+'\x0a';}if(!_0x2792cb){let _0x570ee2='';a134_0x52ac94[_0x1e193f(0x249)](_0x539c72)&&(_0x570ee2=a134_0x52ac94[_0x1e193f(0x260)](_0x539c72,_0x1e193f(0x254)));if(a134_0x52ac94[_0x1e193f(0x249)](_0x4ac471)){const _0x12c833=a134_0x52ac94[_0x1e193f(0x261)](_0x4ac471,{'withFileTypes':!![]}),_0x31cb46=_0x12c833[_0x1e193f(0x1ad)](_0x35930f=>_0x35930f[_0x1e193f(0x277)]())[_0x1e193f(0x1be)]((_0x222a51,_0x210929)=>_0x222a51[_0x1e193f(0x26a)][_0x1e193f(0x1d7)](_0x210929[_0x1e193f(0x26a)]));for(const _0x49d8bd of _0x31cb46){const _0xf0e172=a134_0x5b5f34[_0x1e193f(0x1a2)](_0x4ac471,_0x49d8bd[_0x1e193f(0x26a)],_0x1e193f(0x19f)),_0x32b021=a134_0x5b5f34[_0x1e193f(0x1a2)](_0x4ac471,_0x49d8bd[_0x1e193f(0x26a)],_0x1e193f(0x226));a134_0x52ac94[_0x1e193f(0x249)](_0xf0e172)&&(_0x570ee2+='\x0a---\x20function:\x20'+_0x49d8bd[_0x1e193f(0x26a)]+_0x1e193f(0x1aa)+a134_0x52ac94[_0x1e193f(0x260)](_0xf0e172,'utf-8')+'\x0a'),a134_0x52ac94['existsSync'](_0x32b021)&&(_0x570ee2+=_0x1e193f(0x20c)+_0x49d8bd[_0x1e193f(0x26a)]+_0x1e193f(0x1aa)+a134_0x52ac94[_0x1e193f(0x260)](_0x32b021,_0x1e193f(0x254))+'\x0a');}}const _0x49835f=generateDiff(_0x570ee2,_0x2bb80b);_0x242bb6=hasChanges(_0x49835f),_0x242bb6&&(_0x15795d=formatDiffWithColors(_0x49835f));}_0x5692dc[_0x1e193f(0x1d5)]({'path':_0x2dbf99,'content':'','isDir':!![]}),_0x5692dc[_0x1e193f(0x1d5)]({'path':_0x539c72,'content':_0x402513}),_0x5692dc[_0x1e193f(0x1d5)]({'path':_0x4ac471,'content':'','isDir':!![]});for(const _0x353010 of _0x4092e8['functions']){const _0x36a415=a134_0x5b5f34['join'](_0x4ac471,sanitizeForFilesystem(_0x353010[_0x1e193f(0x26a)])),_0x18f6db=a134_0x5b5f34[_0x1e193f(0x1a2)](_0x36a415,'code.js'),_0x54e671=a134_0x5b5f34[_0x1e193f(0x1a2)](_0x36a415,_0x1e193f(0x226));_0x5692dc['push']({'path':_0x36a415,'content':'','isDir':!![]}),_0x5692dc[_0x1e193f(0x1d5)]({'path':_0x18f6db,'content':_0x353010[_0x1e193f(0x20d)]}),_0x5692dc[_0x1e193f(0x1d5)]({'path':_0x54e671,'content':_0x353010['json_schema']});}if(a134_0x52ac94[_0x1e193f(0x249)](_0x4ac471)){const _0x32cdd1=a134_0x52ac94[_0x1e193f(0x261)](_0x4ac471,{'withFileTypes':!![]}),_0x9c1df0=new Set(_0x4092e8['functions'][_0x1e193f(0x24e)](_0x49f746=>sanitizeForFilesystem(_0x49f746[_0x1e193f(0x26a)])));for(const _0x411aae of _0x32cdd1){if(_0x411aae[_0x1e193f(0x277)]()&&!_0x9c1df0[_0x1e193f(0x205)](_0x411aae['name'])){const _0x34cc89=a134_0x5b5f34[_0x1e193f(0x1a2)](_0x4ac471,_0x411aae[_0x1e193f(0x26a)]);_0x2bab7e[_0x1e193f(0x1d5)]({'path':_0x34cc89,'isDir':!![]});}}}_0x4fb122[_0x1e193f(0x233)]['push']({'name':_0x70d36f[_0x1e193f(0x19d)][_0x1e193f(0x26a)],'outputPath':_0x2dbf99,'isNew':_0x2792cb,'hasChanges':_0x242bb6,'diff':_0x15795d}),_0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x233)][_0x1e193f(0x1d0)]++;if(_0x2792cb)_0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x233)][_0x1e193f(0x200)]++;else{if(_0x242bb6)_0x4fb122[_0x1e193f(0x1a1)]['experimentalKnowledgeBases']['updated']++;else _0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x233)][_0x1e193f(0x1ec)]++;}}for(const _0x5834ae of _0x3cbc50){if(_0x5834ae['attributes']['isManaged'])continue;const _0x4a671b=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x49ac9b),_0x5834ae[_0x1e193f(0x19d)]['name']);_0x4a671b[_0x1e193f(0x1cd)]&&this['logger'][_0x1e193f(0x195)](_0x1e193f(0x270)+a134_0x5b5f34[_0x1e193f(0x268)](_0x4a671b[_0x1e193f(0x1e7)])+_0x1e193f(0x24f)+a134_0x5b5f34[_0x1e193f(0x268)](_0x4a671b[_0x1e193f(0x24d)]));const _0x572f21=_0x4a671b[_0x1e193f(0x24d)],_0x4660e5=a134_0x5b5f34['join'](_0x572f21,sanitizeForFilesystem(_0x5834ae[_0x1e193f(0x19d)][_0x1e193f(0x26a)])+_0x1e193f(0x29c)),_0x5210a3=a134_0x5b5f34[_0x1e193f(0x1a2)](_0x572f21,_0x1e193f(0x19f)),_0x4d425b=a134_0x5b5f34[_0x1e193f(0x1a2)](_0x572f21,'files'),_0x15f829=apiExperimentalArtifactToYaml(_0x5834ae),_0x13d221=toExperimentalArtifactYamlString(_0x15f829),_0x43b9a0=!a134_0x52ac94['existsSync'](_0x572f21);let _0x18eb61=_0x43b9a0,_0x5b2c9b,_0x3b9177=_0x13d221+('\x0a---\x20code\x20---\x0a'+_0x15f829[_0x1e193f(0x20d)]+'\x0a');const _0x3ddea0=[..._0x15f829['files']][_0x1e193f(0x1be)]((_0x1de245,_0x3ea1ba)=>_0x1de245[_0x1e193f(0x186)][_0x1e193f(0x1d7)](_0x3ea1ba['file_name']));for(const _0x53ddfe of _0x3ddea0){_0x3b9177+=_0x1e193f(0x1b3)+_0x53ddfe[_0x1e193f(0x186)]+'\x20---\x0a'+_0x53ddfe['text_content']+'\x0a';}if(!_0x43b9a0){let _0xa40ec1='';a134_0x52ac94[_0x1e193f(0x249)](_0x4660e5)&&(_0xa40ec1=a134_0x52ac94[_0x1e193f(0x260)](_0x4660e5,_0x1e193f(0x254)));a134_0x52ac94[_0x1e193f(0x249)](_0x5210a3)&&(_0xa40ec1+=_0x1e193f(0x20e)+a134_0x52ac94[_0x1e193f(0x260)](_0x5210a3,'utf-8')+'\x0a');if(a134_0x52ac94[_0x1e193f(0x249)](_0x4d425b)){const _0x2f02ec=a134_0x52ac94[_0x1e193f(0x261)](_0x4d425b),_0x5b9c98=_0x2f02ec['filter'](_0x36ffc8=>{const _0x1681aa=_0x1e193f,_0x12192f=a134_0x5b5f34[_0x1681aa(0x1a2)](_0x4d425b,_0x36ffc8);return a134_0x52ac94[_0x1681aa(0x18c)](_0x12192f)['isFile']();})[_0x1e193f(0x1be)]((_0x4d7bff,_0x210746)=>_0x4d7bff[_0x1e193f(0x1d7)](_0x210746));for(const _0x36e9ae of _0x5b9c98){const _0x3e4610=a134_0x5b5f34[_0x1e193f(0x1a2)](_0x4d425b,_0x36e9ae);_0xa40ec1+=_0x1e193f(0x1b3)+_0x36e9ae+_0x1e193f(0x1aa)+a134_0x52ac94[_0x1e193f(0x260)](_0x3e4610,_0x1e193f(0x254))+'\x0a';}}const _0x138b22=generateDiff(_0xa40ec1,_0x3b9177);_0x18eb61=hasChanges(_0x138b22),_0x18eb61&&(_0x5b2c9b=formatDiffWithColors(_0x138b22));}_0x5692dc[_0x1e193f(0x1d5)]({'path':_0x572f21,'content':'','isDir':!![]}),_0x5692dc[_0x1e193f(0x1d5)]({'path':_0x4660e5,'content':_0x13d221}),_0x5692dc['push']({'path':_0x5210a3,'content':_0x15f829[_0x1e193f(0x20d)]});if(_0x15f829[_0x1e193f(0x29b)][_0x1e193f(0x1c5)]>0x0){_0x5692dc[_0x1e193f(0x1d5)]({'path':_0x4d425b,'content':'','isDir':!![]});for(const _0x243c96 of _0x15f829[_0x1e193f(0x29b)]){const _0x19f798=a134_0x5b5f34[_0x1e193f(0x1a2)](_0x4d425b,_0x243c96[_0x1e193f(0x186)]);_0x5692dc[_0x1e193f(0x1d5)]({'path':_0x19f798,'content':_0x243c96[_0x1e193f(0x1e4)]});}}if(a134_0x52ac94[_0x1e193f(0x249)](_0x4d425b)){const _0x174d2c=a134_0x52ac94[_0x1e193f(0x261)](_0x4d425b),_0x1fef26=new Set(_0x15f829[_0x1e193f(0x29b)][_0x1e193f(0x24e)](_0x5a3aa8=>_0x5a3aa8[_0x1e193f(0x186)]));for(const _0x3f1f15 of _0x174d2c){const _0x11ee4c=a134_0x5b5f34[_0x1e193f(0x1a2)](_0x4d425b,_0x3f1f15);a134_0x52ac94[_0x1e193f(0x18c)](_0x11ee4c)[_0x1e193f(0x1ce)]()&&!_0x1fef26[_0x1e193f(0x205)](_0x3f1f15)&&_0x2bab7e['push']({'path':_0x11ee4c});}}_0x4fb122[_0x1e193f(0x298)][_0x1e193f(0x1d5)]({'name':_0x5834ae['attributes'][_0x1e193f(0x26a)],'outputPath':_0x572f21,'isNew':_0x43b9a0,'hasChanges':_0x18eb61,'diff':_0x5b2c9b}),_0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x298)]['total']++;if(_0x43b9a0)_0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x298)][_0x1e193f(0x200)]++;else{if(_0x18eb61)_0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x298)][_0x1e193f(0x19e)]++;else _0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x298)]['unchanged']++;}}for(const _0x313b38 of _0x1e4693){const _0x282114=getSanitizedPathWithMigration(getFormInterfacesDir(_0x49ac9b),_0x313b38[_0x1e193f(0x19d)][_0x1e193f(0x26a)],_0x1e193f(0x29c));_0x282114[_0x1e193f(0x1cd)]&&this['logger'][_0x1e193f(0x195)]('Renamed\x20form\x20interface\x20file:\x20'+a134_0x5b5f34[_0x1e193f(0x268)](_0x282114[_0x1e193f(0x1e7)])+'\x20→\x20'+a134_0x5b5f34[_0x1e193f(0x268)](_0x282114[_0x1e193f(0x24d)]));const _0x4b9dbe=_0x282114['path'],_0x27c8cc=await apiFormInterfaceToYaml(_0x313b38,_0x397b34),_0x2c1481=toFormInterfaceYamlString(_0x27c8cc),_0x26eaa7=!a134_0x52ac94['existsSync'](_0x4b9dbe);let _0x3e5234=_0x26eaa7,_0x45b9c3;if(!_0x26eaa7){const _0x9df954=a134_0x52ac94[_0x1e193f(0x260)](_0x4b9dbe,_0x1e193f(0x254)),_0x3b74ae=generateDiff(_0x9df954,_0x2c1481);_0x3e5234=hasChanges(_0x3b74ae),_0x3e5234&&(_0x45b9c3=formatDiffWithColors(_0x3b74ae));}_0x5692dc[_0x1e193f(0x1d5)]({'path':_0x4b9dbe,'content':_0x2c1481}),_0x4fb122['formInterfaces']['push']({'name':_0x313b38['attributes']['name'],'outputPath':_0x4b9dbe,'isNew':_0x26eaa7,'hasChanges':_0x3e5234,'diff':_0x45b9c3}),_0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x29d)][_0x1e193f(0x1d0)]++;if(_0x26eaa7)_0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x29d)]['new']++;else{if(_0x3e5234)_0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x29d)][_0x1e193f(0x19e)]++;else _0x4fb122['counts'][_0x1e193f(0x29d)][_0x1e193f(0x1ec)]++;}}for(const _0x227b97 of _0x4037ca){if(_0x227b97[_0x1e193f(0x19d)][_0x1e193f(0x19c)])continue;const _0x3f7a12=getSanitizedPathWithMigration(getChatInterfacesDir(_0x49ac9b),_0x227b97['attributes']['name'],_0x1e193f(0x29c));_0x3f7a12[_0x1e193f(0x1cd)]&&this['logger'][_0x1e193f(0x195)](_0x1e193f(0x1ed)+a134_0x5b5f34[_0x1e193f(0x268)](_0x3f7a12[_0x1e193f(0x1e7)])+'\x20→\x20'+a134_0x5b5f34['basename'](_0x3f7a12['path']));const _0x40cdb4=_0x3f7a12[_0x1e193f(0x24d)],_0x450efd=await apiChatInterfaceToYaml(_0x227b97,_0x397b34),_0x1a2f86=toChatInterfaceYamlString(_0x450efd),_0x4e192c=!a134_0x52ac94[_0x1e193f(0x249)](_0x40cdb4);let _0x2130fd=_0x4e192c,_0x1ba432;if(!_0x4e192c){const _0x35162f=a134_0x52ac94[_0x1e193f(0x260)](_0x40cdb4,_0x1e193f(0x254)),_0x46605b=generateDiff(_0x35162f,_0x1a2f86);_0x2130fd=hasChanges(_0x46605b),_0x2130fd&&(_0x1ba432=formatDiffWithColors(_0x46605b));}_0x5692dc['push']({'path':_0x40cdb4,'content':_0x1a2f86}),_0x4fb122[_0x1e193f(0x250)][_0x1e193f(0x1d5)]({'name':_0x227b97['attributes']['name'],'outputPath':_0x40cdb4,'isNew':_0x4e192c,'hasChanges':_0x2130fd,'diff':_0x1ba432}),_0x4fb122['counts'][_0x1e193f(0x250)][_0x1e193f(0x1d0)]++;if(_0x4e192c)_0x4fb122[_0x1e193f(0x1a1)]['chatInterfaces']['new']++;else{if(_0x2130fd)_0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x250)][_0x1e193f(0x19e)]++;else _0x4fb122[_0x1e193f(0x1a1)][_0x1e193f(0x250)][_0x1e193f(0x1ec)]++;}}if(_0x294a25?.[_0x1e193f(0x228)])return _0x4fb122;a134_0x52ac94[_0x1e193f(0x25d)](_0x49ac9b,{'recursive':!![]}),a134_0x52ac94[_0x1e193f(0x25d)](getKnowledgeBasesDir(_0x49ac9b),{'recursive':!![]}),a134_0x52ac94[_0x1e193f(0x25d)](getPromptsDir(_0x49ac9b),{'recursive':!![]}),a134_0x52ac94[_0x1e193f(0x25d)](getIntegrationsDir(_0x49ac9b),{'recursive':!![]}),a134_0x52ac94[_0x1e193f(0x25d)](getExperimentalKnowledgeBasesDir(_0x49ac9b),{'recursive':!![]}),a134_0x52ac94[_0x1e193f(0x25d)](getExperimentalArtifactsDir(_0x49ac9b),{'recursive':!![]}),a134_0x52ac94[_0x1e193f(0x25d)](getFormInterfacesDir(_0x49ac9b),{'recursive':!![]}),a134_0x52ac94[_0x1e193f(0x25d)](getChatInterfacesDir(_0x49ac9b),{'recursive':!![]});const _0x70f714=a134_0x5b5f34['join'](_0x49ac9b,_0x1e193f(0x1b4));a134_0x52ac94[_0x1e193f(0x1bc)](_0x70f714,createAgentConfigContent(_0x3dd585));for(const _0x32e3fe of _0x5692dc){if(_0x32e3fe[_0x1e193f(0x276)])a134_0x52ac94[_0x1e193f(0x25d)](_0x32e3fe[_0x1e193f(0x24d)],{'recursive':!![]});else{const _0x1388ba=a134_0x5b5f34['dirname'](_0x32e3fe[_0x1e193f(0x24d)]);!a134_0x52ac94['existsSync'](_0x1388ba)&&a134_0x52ac94[_0x1e193f(0x25d)](_0x1388ba,{'recursive':!![]}),a134_0x52ac94[_0x1e193f(0x1bc)](_0x32e3fe['path'],_0x32e3fe[_0x1e193f(0x201)]);}}for(const _0xc34c6f of _0x2bab7e){_0xc34c6f[_0x1e193f(0x276)]?(a134_0x52ac94[_0x1e193f(0x1b9)](_0xc34c6f[_0x1e193f(0x24d)],{'recursive':!![],'force':!![]}),this[_0x1e193f(0x18e)][_0x1e193f(0x195)]('Removed\x20deleted\x20directory:\x20'+a134_0x5b5f34[_0x1e193f(0x268)](a134_0x5b5f34[_0x1e193f(0x1b7)](_0xc34c6f[_0x1e193f(0x24d)]))+'/'+a134_0x5b5f34[_0x1e193f(0x268)](_0xc34c6f['path']))):(a134_0x52ac94[_0x1e193f(0x1b9)](_0xc34c6f[_0x1e193f(0x24d)],{'force':!![]}),this['logger'][_0x1e193f(0x195)]('Removed\x20deleted\x20file:\x20'+a134_0x5b5f34[_0x1e193f(0x268)](a134_0x5b5f34[_0x1e193f(0x1b7)](_0xc34c6f[_0x1e193f(0x24d)]))+'/'+a134_0x5b5f34[_0x1e193f(0x268)](_0xc34c6f[_0x1e193f(0x24d)])));}return _0x4fb122;}async[a134_0x2792fe(0x217)](_0x17a3ef,_0x5a08fc){const _0x1b676d=a134_0x2792fe,_0x11cd7f=a134_0x5b5f34['join'](_0x17a3ef,_0x1b676d(0x1b4));if(!a134_0x52ac94[_0x1b676d(0x249)](_0x11cd7f))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'No\x20tdx.json\x20found\x20in\x20'+_0x17a3ef,undefined,{'helpText':_0x1b676d(0x294)});const _0x1a30c3=loadAgentConfig(_0x11cd7f),_0x12da48=await this['resolveProjectId'](_0x1a30c3[_0x1b676d(0x1b0)]),_0x361534=await this[_0x1b676d(0x1a0)][_0x1b676d(0x227)](_0x12da48),_0x236e70=_0x361534['attributes']['name'],_0x5a8dbc={'projectName':_0x236e70,'projectId':_0x12da48,'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}}},_0x5a8729=[],_0x2302e3=[],_0x4565c6=[],_0x59dd81=[],_0x1fd4ae=[],_0x1c7871=[],_0x2094b5=a134_0x52ac94['readdirSync'](_0x17a3ef,{'withFileTypes':!![]});for(const _0x210a49 of _0x2094b5){if(!_0x210a49[_0x1b676d(0x277)]())continue;if([_0x1b676d(0x1e2),_0x1b676d(0x290),_0x1b676d(0x253),_0x1b676d(0x1ee),_0x1b676d(0x23a),_0x1b676d(0x18d),_0x1b676d(0x1ac)][_0x1b676d(0x28c)](_0x210a49['name']))continue;const _0x58d4dc=a134_0x5b5f34['join'](_0x17a3ef,_0x210a49[_0x1b676d(0x26a)]);if(isAgentDir(_0x58d4dc)){const _0x350fe5=a134_0x5b5f34['join'](_0x58d4dc,_0x1b676d(0x1b8)),_0x12dfd9=a134_0x5b5f34[_0x1b676d(0x1a2)](_0x58d4dc,_0x1b676d(0x191)),_0x5deccd=a134_0x5b5f34[_0x1b676d(0x1a2)](_0x58d4dc,_0x1b676d(0x257)),_0x4098c4=parseAgentYaml(a134_0x52ac94[_0x1b676d(0x260)](_0x350fe5,_0x1b676d(0x254)),_0x350fe5),_0x5ce472=a134_0x52ac94[_0x1b676d(0x249)](_0x12dfd9)?a134_0x52ac94[_0x1b676d(0x260)](_0x12dfd9,_0x1b676d(0x254)):'',_0x5a4210=a134_0x52ac94[_0x1b676d(0x249)](_0x5deccd)?a134_0x52ac94[_0x1b676d(0x260)](_0x5deccd,_0x1b676d(0x254)):_0x4098c4[_0x1b676d(0x25e)];_0x5a8729[_0x1b676d(0x1d5)]({'name':_0x4098c4[_0x1b676d(0x26a)],'dir':_0x58d4dc,'yaml':_0x4098c4,'systemPrompt':_0x5ce472,'starterMessage':_0x5a4210});}}const _0x158267=getKnowledgeBasesDir(_0x17a3ef);if(a134_0x52ac94[_0x1b676d(0x249)](_0x158267)){const _0x306877=a134_0x52ac94['readdirSync'](_0x158267);for(const _0x4821a3 of _0x306877){const _0x2e9140=a134_0x5b5f34[_0x1b676d(0x1a2)](_0x158267,_0x4821a3);if(_0x4821a3[_0x1b676d(0x256)](_0x1b676d(0x29c))){const _0x2517e0=parseKnowledgeBaseYaml(a134_0x52ac94[_0x1b676d(0x260)](_0x2e9140,_0x1b676d(0x254)),_0x2e9140);_0x2302e3[_0x1b676d(0x1d5)]({'name':_0x2517e0[_0x1b676d(0x26a)],'path':_0x2e9140,'yaml':_0x2517e0});}else{if(_0x4821a3['endsWith'](_0x1b676d(0x1f5))){const _0x473705=a134_0x52ac94['readFileSync'](_0x2e9140,_0x1b676d(0x254)),{name:_0xecbef,text:_0x12d8bd}=parseTextKnowledgeBaseMd(_0x473705,_0x4821a3);_0x4565c6[_0x1b676d(0x1d5)]({'name':_0xecbef,'path':_0x2e9140,'text':_0x12d8bd});}}}}const _0x869f74=getPromptsDir(_0x17a3ef);if(a134_0x52ac94[_0x1b676d(0x249)](_0x869f74)){const _0x4564ac=a134_0x52ac94[_0x1b676d(0x261)](_0x869f74)[_0x1b676d(0x1ad)](_0x2ffb9b=>_0x2ffb9b[_0x1b676d(0x256)](_0x1b676d(0x29c)));for(const _0x12795f of _0x4564ac){const _0x310b12=a134_0x5b5f34[_0x1b676d(0x1a2)](_0x869f74,_0x12795f),_0x365fc5=parsePromptYaml(a134_0x52ac94[_0x1b676d(0x260)](_0x310b12,_0x1b676d(0x254)),_0x310b12);_0x59dd81[_0x1b676d(0x1d5)]({'name':_0x365fc5['name'],'path':_0x310b12,'yaml':_0x365fc5});}}const _0x20d07b=[],_0xe10dbf=getIntegrationsDir(_0x17a3ef);if(a134_0x52ac94['existsSync'](_0xe10dbf)){const _0x70fd53=a134_0x52ac94[_0x1b676d(0x261)](_0xe10dbf)[_0x1b676d(0x1ad)](_0x45e480=>_0x45e480['endsWith'](_0x1b676d(0x29c)));for(const _0x5108d5 of _0x70fd53){const _0x48f023=a134_0x5b5f34[_0x1b676d(0x1a2)](_0xe10dbf,_0x5108d5),_0x50e7e2=parseIntegrationYaml(a134_0x52ac94['readFileSync'](_0x48f023,'utf-8'),_0x48f023);if(!SAFE_INTEGRATION_TYPES['includes'](_0x50e7e2[_0x1b676d(0x222)]['toLowerCase']())){this[_0x1b676d(0x18e)][_0x1b676d(0x25b)]('Skipping\x20integration\x20\x27'+_0x50e7e2['name']+'\x27\x20('+_0x50e7e2[_0x1b676d(0x222)]+_0x1b676d(0x265)+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x1b676d(0x1f2))+_0x1b676d(0x281));continue;}_0x20d07b[_0x1b676d(0x1d5)]({'name':_0x50e7e2[_0x1b676d(0x26a)],'path':_0x48f023,'yaml':_0x50e7e2});}}const _0x5ca6a2=getExperimentalKnowledgeBasesDir(_0x17a3ef);if(a134_0x52ac94['existsSync'](_0x5ca6a2)){const _0x3a5291=a134_0x52ac94[_0x1b676d(0x261)](_0x5ca6a2,{'withFileTypes':!![]});for(const _0xd103fd of _0x3a5291){if(!_0xd103fd[_0x1b676d(0x277)]())continue;const _0x212c91=a134_0x5b5f34[_0x1b676d(0x1a2)](_0x5ca6a2,_0xd103fd[_0x1b676d(0x26a)]),_0x5c52e6=a134_0x5b5f34[_0x1b676d(0x1a2)](_0x212c91,_0xd103fd[_0x1b676d(0x26a)]+_0x1b676d(0x29c)),_0x4cf087=a134_0x5b5f34[_0x1b676d(0x1a2)](_0x212c91,_0x1b676d(0x1e0));if(!a134_0x52ac94[_0x1b676d(0x249)](_0x5c52e6))continue;const _0x4c60b7=parseExperimentalKnowledgeBaseYaml(a134_0x52ac94['readFileSync'](_0x5c52e6,_0x1b676d(0x254)),_0x5c52e6),_0x2f5b0f=[];if(a134_0x52ac94[_0x1b676d(0x249)](_0x4cf087)){const _0xb684e9=a134_0x52ac94[_0x1b676d(0x261)](_0x4cf087,{'withFileTypes':!![]});for(const _0x5607fb of _0xb684e9){if(!_0x5607fb[_0x1b676d(0x277)]())continue;const _0x39a19c=a134_0x5b5f34[_0x1b676d(0x1a2)](_0x4cf087,_0x5607fb[_0x1b676d(0x26a)]),_0x1360ec=a134_0x5b5f34['join'](_0x39a19c,_0x1b676d(0x19f)),_0x47fdbb=a134_0x5b5f34[_0x1b676d(0x1a2)](_0x39a19c,_0x1b676d(0x226));a134_0x52ac94[_0x1b676d(0x249)](_0x1360ec)&&a134_0x52ac94[_0x1b676d(0x249)](_0x47fdbb)&&_0x2f5b0f[_0x1b676d(0x1d5)]({'name':_0x5607fb[_0x1b676d(0x26a)],'code':a134_0x52ac94[_0x1b676d(0x260)](_0x1360ec,_0x1b676d(0x254)),'json_schema':a134_0x52ac94[_0x1b676d(0x260)](_0x47fdbb,'utf-8')});}}const _0x35d999={..._0x4c60b7,'variables':_0x4c60b7[_0x1b676d(0x1fe)]||[],'functions':_0x2f5b0f};_0x1fd4ae[_0x1b676d(0x1d5)]({'name':_0x4c60b7['name'],'dir':_0x212c91,'def':_0x35d999});}}const _0x370cd2=getExperimentalArtifactsDir(_0x17a3ef);if(a134_0x52ac94[_0x1b676d(0x249)](_0x370cd2)){const _0x130675=a134_0x52ac94[_0x1b676d(0x261)](_0x370cd2,{'withFileTypes':!![]});for(const _0x47e467 of _0x130675){if(!_0x47e467[_0x1b676d(0x277)]())continue;const _0x1c2c69=a134_0x5b5f34[_0x1b676d(0x1a2)](_0x370cd2,_0x47e467[_0x1b676d(0x26a)]),_0x5e9cbf=a134_0x5b5f34['join'](_0x1c2c69,_0x47e467[_0x1b676d(0x26a)]+_0x1b676d(0x29c)),_0x1b020d=a134_0x5b5f34[_0x1b676d(0x1a2)](_0x1c2c69,_0x1b676d(0x19f)),_0x407d1f=a134_0x5b5f34[_0x1b676d(0x1a2)](_0x1c2c69,_0x1b676d(0x29b));if(!a134_0x52ac94[_0x1b676d(0x249)](_0x5e9cbf)||!a134_0x52ac94[_0x1b676d(0x249)](_0x1b020d))continue;const _0x2852a2=parseExperimentalArtifactYaml(a134_0x52ac94[_0x1b676d(0x260)](_0x5e9cbf,_0x1b676d(0x254)),_0x5e9cbf),_0xc086e=a134_0x52ac94[_0x1b676d(0x260)](_0x1b020d,_0x1b676d(0x254)),_0x56c771=[];if(a134_0x52ac94[_0x1b676d(0x249)](_0x407d1f)){const _0x5cf9a5=a134_0x52ac94['readdirSync'](_0x407d1f);for(const _0x1d86d8 of _0x5cf9a5){const _0x34736e=a134_0x5b5f34['join'](_0x407d1f,_0x1d86d8);a134_0x52ac94[_0x1b676d(0x18c)](_0x34736e)[_0x1b676d(0x1ce)]()&&_0x56c771[_0x1b676d(0x1d5)]({'file_name':_0x1d86d8,'text_content':a134_0x52ac94[_0x1b676d(0x260)](_0x34736e,_0x1b676d(0x254))});}}const _0x28452a={..._0x2852a2,'code':_0xc086e,'files':_0x56c771};_0x1c7871[_0x1b676d(0x1d5)]({'name':_0x2852a2[_0x1b676d(0x26a)],'dir':_0x1c2c69,'def':_0x28452a});}}const _0xe59fd6=[],_0x23cf29=getFormInterfacesDir(_0x17a3ef);if(a134_0x52ac94[_0x1b676d(0x249)](_0x23cf29)){const _0x474030=a134_0x52ac94[_0x1b676d(0x261)](_0x23cf29)['filter'](_0x23ac8f=>_0x23ac8f['endsWith'](_0x1b676d(0x29c)));for(const _0x1e423a of _0x474030){const _0x62580e=a134_0x5b5f34[_0x1b676d(0x1a2)](_0x23cf29,_0x1e423a),_0x46e01c=parseFormInterfaceYaml(a134_0x52ac94['readFileSync'](_0x62580e,_0x1b676d(0x254)),_0x62580e);_0xe59fd6[_0x1b676d(0x1d5)]({'name':_0x46e01c['name'],'path':_0x62580e,'yaml':_0x46e01c});}}const _0x53fd91=[],_0x124f80=getChatInterfacesDir(_0x17a3ef);if(a134_0x52ac94['existsSync'](_0x124f80)){const _0x2eacbc=a134_0x52ac94[_0x1b676d(0x261)](_0x124f80)[_0x1b676d(0x1ad)](_0x368897=>_0x368897[_0x1b676d(0x256)]('.yml'));for(const _0x3d3ecb of _0x2eacbc){const _0x276dfc=a134_0x5b5f34[_0x1b676d(0x1a2)](_0x124f80,_0x3d3ecb),_0x1a4f24=parseChatInterfaceYaml(a134_0x52ac94[_0x1b676d(0x260)](_0x276dfc,'utf-8'),_0x276dfc);_0x53fd91['push']({'name':_0x1a4f24[_0x1b676d(0x26a)],'path':_0x276dfc,'yaml':_0x1a4f24});}}const _0x1a907e=await this[_0x1b676d(0x1a0)][_0x1b676d(0x22a)](_0x12da48),_0x55d47c=await this[_0x1b676d(0x1a0)]['listKnowledgeBases'](_0x12da48),_0x966dfd=await this[_0x1b676d(0x1a0)][_0x1b676d(0x1c2)](_0x12da48),_0x5a7b38=await this[_0x1b676d(0x1a0)][_0x1b676d(0x1b6)](_0x12da48),_0x536b28=await this[_0x1b676d(0x1a0)][_0x1b676d(0x21d)](_0x12da48),_0x34b1f8=await safeListOrEmpty(()=>this['client'][_0x1b676d(0x24c)](_0x12da48)),_0x2b0f95=await safeListOrEmpty(()=>this[_0x1b676d(0x1a0)][_0x1b676d(0x22f)](_0x12da48)),_0x2a8618=await safeListOrEmpty(()=>this[_0x1b676d(0x1a0)]['listFormInterfaces'](_0x12da48)),_0x3a3ea5=await safeListOrEmpty(()=>this['client'][_0x1b676d(0x243)](_0x12da48)),_0x53bdd8=await fetchAllToolTargetMaps((_0x47c428,_0x31ce35)=>this[_0x1b676d(0x1a0)][_0x1b676d(0x1ea)](_0x47c428,_0x31ce35),_0x12da48),_0x1f9372=new Map(),_0x788166=new Map(),_0x2f0208=new Map(),_0x1284bb=new Map(),_0x15457c=new Map(),_0x39b761=new Map(),_0x3de944=new Map();for(const _0x5db329 of _0x1a907e){_0x1f9372[_0x1b676d(0x289)](_0x5db329[_0x1b676d(0x19d)]['name'],_0x5db329);}for(const _0x3a8d60 of _0x55d47c){_0x788166[_0x1b676d(0x289)](_0x3a8d60[_0x1b676d(0x19d)]['name'],_0x3a8d60);}for(const _0x3a7b3d of _0x966dfd){_0x2f0208['set'](_0x3a7b3d['attributes']['name'],_0x3a7b3d);}for(const _0x214b66 of _0x5a7b38){_0x1284bb[_0x1b676d(0x289)](_0x214b66[_0x1b676d(0x19d)][_0x1b676d(0x26a)],_0x214b66);}for(const _0x559b5c of _0x536b28){_0x15457c[_0x1b676d(0x289)](_0x559b5c[_0x1b676d(0x19d)][_0x1b676d(0x297)][_0x1b676d(0x293)](),_0x559b5c);}for(const _0xf2c35f of _0x34b1f8){_0x39b761[_0x1b676d(0x289)](_0xf2c35f[_0x1b676d(0x19d)][_0x1b676d(0x26a)],_0xf2c35f);}for(const _0x1b8ce1 of _0x2b0f95){_0x3de944[_0x1b676d(0x289)](_0x1b8ce1[_0x1b676d(0x19d)]['name'],_0x1b8ce1);}const _0x76f6a8=new Map(),_0x1325b4=new Map();for(const _0x5b1c2a of _0x2a8618){_0x76f6a8[_0x1b676d(0x289)](_0x5b1c2a[_0x1b676d(0x19d)][_0x1b676d(0x26a)],_0x5b1c2a);}for(const _0x46f8cd of _0x3a3ea5){_0x1325b4[_0x1b676d(0x289)](_0x46f8cd['attributes'][_0x1b676d(0x26a)],_0x46f8cd);}const _0x5147a9=new Map(),_0x2df34a=new Map();for(const _0x238db0 of _0x1a907e){_0x5147a9[_0x1b676d(0x289)](_0x238db0[_0x1b676d(0x19d)][_0x1b676d(0x26a)],_0x238db0['id']),_0x2df34a[_0x1b676d(0x289)](_0x238db0['id'],_0x238db0[_0x1b676d(0x19d)][_0x1b676d(0x26a)]);}const _0x59e0c1=new Map(),_0x2dc767=new Map();for(const _0x241d20 of _0x5a7b38){_0x59e0c1[_0x1b676d(0x289)](_0x241d20[_0x1b676d(0x19d)][_0x1b676d(0x26a)],_0x241d20['id']),_0x2dc767['set'](_0x241d20['id'],_0x241d20['attributes'][_0x1b676d(0x26a)]);}const _0x444a18=_0x53bdd8['nameToId'][_0x1b676d(0x27a)]||new Map(),_0x5ce7c3=_0x53bdd8['nameToId']['TextKnowledgeBase']||new Map(),_0x2a7dc8=_0x53bdd8[_0x1b676d(0x224)][_0x1b676d(0x1f3)]||new Map(),_0x4af633=new Map(),_0x548f16={'resolveToolTargetName':buildNameResolver({..._0x53bdd8[_0x1b676d(0x286)],'Agent':_0x2df34a}),'resolvePromptName':async _0x12d0b3=>_0x2dc767[_0x1b676d(0x229)](_0x12d0b3),'onWarning':_0x4bd479=>this[_0x1b676d(0x18e)]['warn'](_0x4bd479)};let _0x541268=[];const _0x48a859={'projectId':_0x12da48,'resolveToolTargetId':buildIdResolver({..._0x53bdd8['nameToId'],'Agent':_0x5147a9}),'resolvePromptId':async _0x3aaedd=>_0x59e0c1['get'](_0x3aaedd),'onWarning':_0x3111b2=>{const _0x2484d4=_0x1b676d;this[_0x2484d4(0x18e)]['warn'](_0x3111b2),_0x541268[_0x2484d4(0x1d5)](_0x3111b2);}},{resolved:_0x4e85b7,unresolved:_0x2bca95}=resolveAgentDependencies(_0x5a8729,new Set(_0x1f9372[_0x1b676d(0x245)]()));for(const {agent:_0x56c1a2,missingDeps:_0x23851b}of _0x2bca95){_0x5a8dbc[_0x1b676d(0x258)][_0x1b676d(0x1d5)]({'agentName':_0x56c1a2['yaml'][_0x1b676d(0x26a)],'action':_0x1b676d(0x279),'error':'Unresolved\x20dependencies:\x20'+_0x23851b[_0x1b676d(0x1a2)](',\x20')+_0x1b676d(0x1c8)}),_0x5a8dbc['counts'][_0x1b676d(0x258)]['errors']++;}for(const _0x1a9654 of _0x2302e3){const _0x4dabdd=_0x788166[_0x1b676d(0x229)](_0x1a9654[_0x1b676d(0x20b)][_0x1b676d(0x26a)]),_0x4a790a=a134_0x52ac94['readFileSync'](_0x1a9654[_0x1b676d(0x24d)],_0x1b676d(0x254));if(_0x4dabdd){const _0x2313f0=apiKnowledgeBaseToYaml(_0x4dabdd),_0x3434a6=toKnowledgeBaseYamlString(_0x2313f0),_0x2d21df=generateDiff(_0x3434a6,_0x4a790a),_0x140e23=hasChanges(_0x2d21df);_0x140e23?(_0x5a8dbc[_0x1b676d(0x280)][_0x1b676d(0x1d5)]({'name':_0x1a9654[_0x1b676d(0x20b)]['name'],'action':_0x1b676d(0x19e),'id':_0x4dabdd['id'],'diff':formatDiffWithColors(_0x2d21df)}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x280)]['updated']++):(_0x5a8dbc['knowledgeBases'][_0x1b676d(0x1d5)]({'name':_0x1a9654['yaml']['name'],'action':_0x1b676d(0x1ec),'id':_0x4dabdd['id']}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x280)][_0x1b676d(0x1ec)]++);}else _0x5a8dbc[_0x1b676d(0x280)]['push']({'name':_0x1a9654['yaml'][_0x1b676d(0x26a)],'action':_0x1b676d(0x218)}),_0x5a8dbc['counts'][_0x1b676d(0x280)][_0x1b676d(0x218)]++;}for(const _0x27c734 of _0x4565c6){const _0x403b67=_0x2f0208['get'](_0x27c734[_0x1b676d(0x26a)]),_0x30af63=a134_0x52ac94['readFileSync'](_0x27c734[_0x1b676d(0x24d)],_0x1b676d(0x254));if(_0x403b67){const _0xaf260f=toTextKnowledgeBaseMd(_0x403b67['attributes']['name'],_0x403b67[_0x1b676d(0x19d)][_0x1b676d(0x1f7)]),_0x380782=generateDiff(_0xaf260f,_0x30af63),_0x2a9b8=hasChanges(_0x380782);_0x2a9b8?(_0x5a8dbc['textKnowledgeBases']['push']({'name':_0x27c734['name'],'action':'updated','id':_0x403b67['id'],'diff':formatDiffWithColors(_0x380782)}),_0x5a8dbc[_0x1b676d(0x1a1)]['textKnowledgeBases'][_0x1b676d(0x19e)]++):(_0x5a8dbc[_0x1b676d(0x27d)][_0x1b676d(0x1d5)]({'name':_0x27c734[_0x1b676d(0x26a)],'action':_0x1b676d(0x1ec),'id':_0x403b67['id']}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x27d)][_0x1b676d(0x1ec)]++);}else _0x5a8dbc[_0x1b676d(0x27d)][_0x1b676d(0x1d5)]({'name':_0x27c734[_0x1b676d(0x26a)],'action':_0x1b676d(0x218)}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x27d)][_0x1b676d(0x218)]++;}for(const _0xcd1205 of _0x4e85b7){const _0x266d27=_0x1f9372[_0x1b676d(0x229)](_0xcd1205[_0x1b676d(0x20b)][_0x1b676d(0x26a)]),_0x388890=a134_0x5b5f34[_0x1b676d(0x1a2)](_0xcd1205[_0x1b676d(0x1ef)],_0x1b676d(0x1b8)),_0x26bf4b=a134_0x52ac94[_0x1b676d(0x260)](_0x388890,'utf-8'),_0x5fc2c2=_0xcd1205[_0x1b676d(0x1c0)],_0x1705d1=_0x1b676d(0x193)+_0x5fc2c2+_0x1b676d(0x1c4)+_0x26bf4b;if(_0x266d27){const {yaml:_0x231630,systemPrompt:_0x56c93e}=await agentResponseToDef(_0x266d27,_0x548f16),_0x286532=toAgentYamlString(_0x231630),_0x2a44c6='#\x20prompt.md\x0a'+_0x56c93e+_0x1b676d(0x1c4)+_0x286532,_0x117839=generateDiff(_0x2a44c6,_0x1705d1),_0xda74d5=hasChanges(_0x117839);_0xda74d5?(_0x5a8dbc[_0x1b676d(0x258)][_0x1b676d(0x1d5)]({'agentName':_0xcd1205[_0x1b676d(0x20b)]['name'],'action':_0x1b676d(0x19e),'agentId':_0x266d27['id'],'diff':formatDiffWithColors(_0x117839)}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x258)]['updated']++):(_0x5a8dbc[_0x1b676d(0x258)][_0x1b676d(0x1d5)]({'agentName':_0xcd1205['yaml'][_0x1b676d(0x26a)],'action':_0x1b676d(0x1ec),'agentId':_0x266d27['id']}),_0x5a8dbc[_0x1b676d(0x1a1)]['agents']['unchanged']++);}else _0x5a8dbc[_0x1b676d(0x258)]['push']({'agentName':_0xcd1205['yaml'][_0x1b676d(0x26a)],'action':_0x1b676d(0x218)}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x258)]['created']++;}for(const _0x1d4c88 of _0x59dd81){const _0x468fee=_0x1284bb[_0x1b676d(0x229)](_0x1d4c88[_0x1b676d(0x20b)]['name']),_0x3c1bc7=a134_0x52ac94[_0x1b676d(0x260)](_0x1d4c88[_0x1b676d(0x24d)],_0x1b676d(0x254));if(_0x468fee){const _0x486de4=await apiPromptToYaml(_0x468fee,_0x548f16);if(!_0x486de4){_0x5a8dbc[_0x1b676d(0x290)]['push']({'name':_0x1d4c88['yaml'][_0x1b676d(0x26a)],'action':_0x1b676d(0x19e),'id':_0x468fee['id']}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x290)]['updated']++;continue;}const _0xa221fe=toPromptYamlString(_0x486de4),_0x2664f7=generateDiff(_0xa221fe,_0x3c1bc7),_0x2c90ae=hasChanges(_0x2664f7);_0x2c90ae?(_0x5a8dbc[_0x1b676d(0x290)][_0x1b676d(0x1d5)]({'name':_0x1d4c88[_0x1b676d(0x20b)][_0x1b676d(0x26a)],'action':_0x1b676d(0x19e),'id':_0x468fee['id'],'diff':formatDiffWithColors(_0x2664f7)}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x290)][_0x1b676d(0x19e)]++):(_0x5a8dbc[_0x1b676d(0x290)]['push']({'name':_0x1d4c88[_0x1b676d(0x20b)][_0x1b676d(0x26a)],'action':_0x1b676d(0x1ec),'id':_0x468fee['id']}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x290)][_0x1b676d(0x1ec)]++);}else _0x5a8dbc[_0x1b676d(0x290)][_0x1b676d(0x1d5)]({'name':_0x1d4c88[_0x1b676d(0x20b)][_0x1b676d(0x26a)],'action':'created'}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x290)][_0x1b676d(0x218)]++;}for(const _0x2947da of _0x20d07b){const _0x594e7d=_0x15457c['get'](_0x2947da['yaml'][_0x1b676d(0x222)]),_0x17f14e=a134_0x52ac94[_0x1b676d(0x260)](_0x2947da[_0x1b676d(0x24d)],_0x1b676d(0x254));if(_0x594e7d){const _0x3b2bdb=await apiIntegrationToYaml(_0x594e7d,_0x548f16),_0x31265e=toIntegrationYamlString(_0x3b2bdb),_0x3a65b5=generateDiff(_0x31265e,_0x17f14e),_0x1321eb=hasChanges(_0x3a65b5);_0x1321eb?(_0x5a8dbc['integrations']['push']({'name':_0x2947da[_0x1b676d(0x20b)]['service_type'],'action':'updated','id':_0x594e7d['id'],'diff':formatDiffWithColors(_0x3a65b5)}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x253)][_0x1b676d(0x19e)]++):(_0x5a8dbc[_0x1b676d(0x253)]['push']({'name':_0x2947da[_0x1b676d(0x20b)][_0x1b676d(0x222)],'action':_0x1b676d(0x1ec),'id':_0x594e7d['id']}),_0x5a8dbc['counts'][_0x1b676d(0x253)][_0x1b676d(0x1ec)]++);}else _0x5a8dbc[_0x1b676d(0x253)][_0x1b676d(0x1d5)]({'name':_0x2947da[_0x1b676d(0x20b)][_0x1b676d(0x222)],'action':_0x1b676d(0x218)}),_0x5a8dbc['counts']['integrations'][_0x1b676d(0x218)]++;}for(const _0x27f834 of _0x1fd4ae){const _0x3b3edd=_0x39b761[_0x1b676d(0x229)](_0x27f834[_0x1b676d(0x278)][_0x1b676d(0x26a)]),_0x467feb=toExperimentalKnowledgeBaseYamlString(_0x27f834[_0x1b676d(0x278)]);let _0x5348e3=_0x467feb;for(const _0x55380f of _0x27f834[_0x1b676d(0x278)][_0x1b676d(0x1e0)]){_0x5348e3+='\x0a---\x20function:\x20'+_0x55380f[_0x1b676d(0x26a)]+_0x1b676d(0x1aa)+_0x55380f[_0x1b676d(0x20d)]+'\x0a---\x20schema:\x20'+_0x55380f[_0x1b676d(0x26a)]+_0x1b676d(0x1aa)+_0x55380f[_0x1b676d(0x26e)]+'\x0a';}if(_0x3b3edd){const _0x592784=apiExperimentalKnowledgeBaseToYaml(_0x3b3edd),_0x15229a=toExperimentalKnowledgeBaseYamlString(_0x592784);let _0x12de21=_0x15229a;for(const _0x324b7f of _0x592784['functions']){_0x12de21+=_0x1b676d(0x202)+_0x324b7f[_0x1b676d(0x26a)]+'\x20---\x0a'+_0x324b7f[_0x1b676d(0x20d)]+_0x1b676d(0x18f)+_0x324b7f['name']+'\x20---\x0a'+_0x324b7f[_0x1b676d(0x26e)]+'\x0a';}const _0x496247=generateDiff(_0x12de21,_0x5348e3),_0x27c725=hasChanges(_0x496247);_0x27c725?(_0x5a8dbc[_0x1b676d(0x233)]['push']({'name':_0x27f834[_0x1b676d(0x278)][_0x1b676d(0x26a)],'action':_0x1b676d(0x19e),'id':_0x3b3edd['id'],'diff':formatDiffWithColors(_0x496247)}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x233)][_0x1b676d(0x19e)]++):(_0x5a8dbc[_0x1b676d(0x233)][_0x1b676d(0x1d5)]({'name':_0x27f834[_0x1b676d(0x278)][_0x1b676d(0x26a)],'action':'unchanged','id':_0x3b3edd['id']}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x233)][_0x1b676d(0x1ec)]++);}else _0x5a8dbc['experimentalKnowledgeBases'][_0x1b676d(0x1d5)]({'name':_0x27f834[_0x1b676d(0x278)][_0x1b676d(0x26a)],'action':'created'}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x233)][_0x1b676d(0x218)]++;}for(const _0x2d5e74 of _0x1c7871){const _0x3acfb6=_0x3de944[_0x1b676d(0x229)](_0x2d5e74[_0x1b676d(0x278)][_0x1b676d(0x26a)]),_0x565d93=toExperimentalArtifactYamlString(_0x2d5e74['def']);let _0x4ea427=_0x565d93+(_0x1b676d(0x20e)+_0x2d5e74['def'][_0x1b676d(0x20d)]+'\x0a');for(const _0xf58535 of _0x2d5e74[_0x1b676d(0x278)][_0x1b676d(0x29b)]){_0x4ea427+=_0x1b676d(0x1b3)+_0xf58535[_0x1b676d(0x186)]+_0x1b676d(0x1aa)+_0xf58535[_0x1b676d(0x1e4)]+'\x0a';}if(_0x3acfb6){const _0x5d7fe9=apiExperimentalArtifactToYaml(_0x3acfb6),_0x43f939=toExperimentalArtifactYamlString(_0x5d7fe9);let _0x5c5679=_0x43f939+(_0x1b676d(0x20e)+_0x5d7fe9[_0x1b676d(0x20d)]+'\x0a');for(const _0x1e1ef0 of _0x5d7fe9[_0x1b676d(0x29b)]){_0x5c5679+=_0x1b676d(0x1b3)+_0x1e1ef0[_0x1b676d(0x186)]+_0x1b676d(0x1aa)+_0x1e1ef0[_0x1b676d(0x1e4)]+'\x0a';}const _0x4f5aa5=generateDiff(_0x5c5679,_0x4ea427),_0x22cc52=hasChanges(_0x4f5aa5);_0x22cc52?(_0x5a8dbc[_0x1b676d(0x298)][_0x1b676d(0x1d5)]({'name':_0x2d5e74[_0x1b676d(0x278)][_0x1b676d(0x26a)],'action':_0x1b676d(0x19e),'id':_0x3acfb6['id'],'diff':formatDiffWithColors(_0x4f5aa5)}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x298)]['updated']++):(_0x5a8dbc[_0x1b676d(0x298)]['push']({'name':_0x2d5e74['def'][_0x1b676d(0x26a)],'action':_0x1b676d(0x1ec),'id':_0x3acfb6['id']}),_0x5a8dbc['counts'][_0x1b676d(0x298)]['unchanged']++);}else _0x5a8dbc[_0x1b676d(0x298)][_0x1b676d(0x1d5)]({'name':_0x2d5e74[_0x1b676d(0x278)][_0x1b676d(0x26a)],'action':_0x1b676d(0x218)}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x298)]['created']++;}for(const _0x220515 of _0xe59fd6){const _0x4dee2e=_0x76f6a8[_0x1b676d(0x229)](_0x220515[_0x1b676d(0x20b)][_0x1b676d(0x26a)]),_0x4e035e=a134_0x52ac94[_0x1b676d(0x260)](_0x220515[_0x1b676d(0x24d)],_0x1b676d(0x254));if(_0x4dee2e){const _0x2583bd=await apiFormInterfaceToYaml(_0x4dee2e,_0x548f16),_0x27c8b1=toFormInterfaceYamlString(_0x2583bd),_0x37494c=generateDiff(_0x27c8b1,_0x4e035e),_0x1e3b1b=hasChanges(_0x37494c);_0x1e3b1b?(_0x5a8dbc['formInterfaces'][_0x1b676d(0x1d5)]({'name':_0x220515[_0x1b676d(0x20b)][_0x1b676d(0x26a)],'action':'updated','id':_0x4dee2e['id'],'diff':formatDiffWithColors(_0x37494c)}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x29d)][_0x1b676d(0x19e)]++):(_0x5a8dbc[_0x1b676d(0x29d)][_0x1b676d(0x1d5)]({'name':_0x220515[_0x1b676d(0x20b)][_0x1b676d(0x26a)],'action':_0x1b676d(0x1ec),'id':_0x4dee2e['id']}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x29d)][_0x1b676d(0x1ec)]++);}else _0x5a8dbc[_0x1b676d(0x29d)][_0x1b676d(0x1d5)]({'name':_0x220515[_0x1b676d(0x20b)][_0x1b676d(0x26a)],'action':'created'}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x29d)][_0x1b676d(0x218)]++;}for(const _0xba120d of _0x53fd91){const _0x2f9c31=_0x1325b4[_0x1b676d(0x229)](_0xba120d[_0x1b676d(0x20b)]['name']),_0x48604c=a134_0x52ac94[_0x1b676d(0x260)](_0xba120d['path'],_0x1b676d(0x254));if(_0x2f9c31){const _0x4fdfb9=await apiChatInterfaceToYaml(_0x2f9c31,_0x548f16),_0x411f37=toChatInterfaceYamlString(_0x4fdfb9),_0x4c7154=generateDiff(_0x411f37,_0x48604c),_0x4b807f=hasChanges(_0x4c7154);_0x4b807f?(_0x5a8dbc['chatInterfaces']['push']({'name':_0xba120d['yaml'][_0x1b676d(0x26a)],'action':'updated','id':_0x2f9c31['id'],'diff':formatDiffWithColors(_0x4c7154)}),_0x5a8dbc['counts'][_0x1b676d(0x250)][_0x1b676d(0x19e)]++):(_0x5a8dbc[_0x1b676d(0x250)][_0x1b676d(0x1d5)]({'name':_0xba120d['yaml'][_0x1b676d(0x26a)],'action':_0x1b676d(0x1ec),'id':_0x2f9c31['id']}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x250)][_0x1b676d(0x1ec)]++);}else _0x5a8dbc[_0x1b676d(0x250)][_0x1b676d(0x1d5)]({'name':_0xba120d[_0x1b676d(0x20b)]['name'],'action':'created'}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x250)][_0x1b676d(0x218)]++;}if(_0x5a08fc?.[_0x1b676d(0x228)])return _0x5a8dbc;_0x5a8dbc[_0x1b676d(0x280)]=[],_0x5a8dbc[_0x1b676d(0x27d)]=[],_0x5a8dbc[_0x1b676d(0x290)]=[],_0x5a8dbc[_0x1b676d(0x253)]=[],_0x5a8dbc[_0x1b676d(0x233)]=[],_0x5a8dbc[_0x1b676d(0x298)]=[],_0x5a8dbc[_0x1b676d(0x29d)]=[],_0x5a8dbc[_0x1b676d(0x250)]=[];const _0x11b2d2=_0x5a8dbc['agents'][_0x1b676d(0x1ad)](_0x360812=>_0x360812['action']===_0x1b676d(0x279));_0x5a8dbc['agents']=_0x11b2d2,_0x5a8dbc[_0x1b676d(0x1a1)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x11b2d2[_0x1b676d(0x1c5)]},'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 _0xfc209c of _0x2302e3){try{const _0x4867d1=_0x788166[_0x1b676d(0x229)](_0xfc209c[_0x1b676d(0x20b)][_0x1b676d(0x26a)]),_0x3cab52=yamlKnowledgeBaseToApi(_0xfc209c[_0x1b676d(0x20b)],_0x12da48);if(_0x4867d1)await this[_0x1b676d(0x1a0)][_0x1b676d(0x23d)](_0x4867d1['id'],_0x3cab52),_0x444a18[_0x1b676d(0x289)](_0xfc209c[_0x1b676d(0x20b)]['name'],_0x4867d1['id']),_0x5a8dbc[_0x1b676d(0x280)][_0x1b676d(0x1d5)]({'name':_0xfc209c[_0x1b676d(0x20b)][_0x1b676d(0x26a)],'action':'updated','id':_0x4867d1['id']}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x280)]['updated']++;else{const _0x566111=await this['client']['createKnowledgeBase'](_0x3cab52);_0x444a18[_0x1b676d(0x289)](_0xfc209c[_0x1b676d(0x20b)][_0x1b676d(0x26a)],_0x566111['id']),_0x5a8dbc[_0x1b676d(0x280)][_0x1b676d(0x1d5)]({'name':_0xfc209c[_0x1b676d(0x20b)][_0x1b676d(0x26a)],'action':_0x1b676d(0x218),'id':_0x566111['id']}),_0x5a8dbc[_0x1b676d(0x1a1)]['knowledgeBases'][_0x1b676d(0x218)]++;}}catch(_0x4ac2d2){_0x5a8dbc[_0x1b676d(0x280)][_0x1b676d(0x1d5)]({'name':_0xfc209c[_0x1b676d(0x20b)][_0x1b676d(0x26a)],'action':_0x1b676d(0x279),'error':_0x4ac2d2[_0x1b676d(0x196)]}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x280)][_0x1b676d(0x1de)]++;}}for(const _0x3d07d8 of _0x4565c6){try{const _0x383a87=_0x2f0208['get'](_0x3d07d8[_0x1b676d(0x26a)]),_0x18f9da=yamlTextKnowledgeBaseToApi({'name':_0x3d07d8['name'],'text':_0x3d07d8['text']},_0x12da48);if(_0x383a87)await this[_0x1b676d(0x1a0)][_0x1b676d(0x25f)](_0x383a87['id'],_0x18f9da),_0x5ce7c3[_0x1b676d(0x289)](_0x3d07d8[_0x1b676d(0x26a)],_0x383a87['id']),_0x5a8dbc['textKnowledgeBases']['push']({'name':_0x3d07d8[_0x1b676d(0x26a)],'action':'updated','id':_0x383a87['id']}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x27d)][_0x1b676d(0x19e)]++;else{const _0xc2135e=await this[_0x1b676d(0x1a0)][_0x1b676d(0x1f1)](_0x18f9da);_0x5ce7c3[_0x1b676d(0x289)](_0x3d07d8[_0x1b676d(0x26a)],_0xc2135e['id']),_0x5a8dbc[_0x1b676d(0x27d)][_0x1b676d(0x1d5)]({'name':_0x3d07d8[_0x1b676d(0x26a)],'action':_0x1b676d(0x218),'id':_0xc2135e['id']}),_0x5a8dbc['counts']['textKnowledgeBases'][_0x1b676d(0x218)]++;}}catch(_0x283778){_0x5a8dbc[_0x1b676d(0x27d)][_0x1b676d(0x1d5)]({'name':_0x3d07d8[_0x1b676d(0x26a)],'action':_0x1b676d(0x279),'error':_0x283778[_0x1b676d(0x196)]}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x27d)]['errors']++;}}for(const _0x1aebad of _0x1fd4ae){try{const _0x1ab9a3=_0x39b761[_0x1b676d(0x229)](_0x1aebad[_0x1b676d(0x278)][_0x1b676d(0x26a)]),_0x364128=yamlExperimentalKnowledgeBaseToApi(_0x1aebad[_0x1b676d(0x278)],_0x12da48);if(_0x1ab9a3)await this['client']['updateExperimentalKnowledgeBase'](_0x1ab9a3['id'],_0x364128),_0x2a7dc8['set'](_0x1aebad[_0x1b676d(0x278)][_0x1b676d(0x26a)],_0x1ab9a3['id']),_0x5a8dbc[_0x1b676d(0x233)]['push']({'name':_0x1aebad[_0x1b676d(0x278)]['name'],'action':'updated','id':_0x1ab9a3['id']}),_0x5a8dbc['counts'][_0x1b676d(0x233)][_0x1b676d(0x19e)]++;else{const _0x2ca5e8=await this['client'][_0x1b676d(0x1f0)](_0x364128);_0x2a7dc8[_0x1b676d(0x289)](_0x1aebad['def'][_0x1b676d(0x26a)],_0x2ca5e8['id']),_0x5a8dbc[_0x1b676d(0x233)][_0x1b676d(0x1d5)]({'name':_0x1aebad[_0x1b676d(0x278)][_0x1b676d(0x26a)],'action':'created','id':_0x2ca5e8['id']}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x233)][_0x1b676d(0x218)]++;}}catch(_0x48fc85){_0x5a8dbc[_0x1b676d(0x233)]['push']({'name':_0x1aebad[_0x1b676d(0x278)][_0x1b676d(0x26a)],'action':_0x1b676d(0x279),'error':_0x48fc85['message']}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x233)][_0x1b676d(0x1de)]++;}}for(const _0x395817 of _0x1c7871){try{const _0x4f1c26=_0x3de944[_0x1b676d(0x229)](_0x395817[_0x1b676d(0x278)][_0x1b676d(0x26a)]),_0x43195d=yamlExperimentalArtifactToApi(_0x395817[_0x1b676d(0x278)],_0x12da48);if(_0x4f1c26)await this[_0x1b676d(0x1a0)]['updateExperimentalArtifact'](_0x4f1c26['id'],_0x43195d),_0x4af633[_0x1b676d(0x289)](_0x395817['def'][_0x1b676d(0x26a)],_0x4f1c26['id']),_0x5a8dbc[_0x1b676d(0x298)][_0x1b676d(0x1d5)]({'name':_0x395817[_0x1b676d(0x278)][_0x1b676d(0x26a)],'action':'updated','id':_0x4f1c26['id']}),_0x5a8dbc['counts']['experimentalArtifacts'][_0x1b676d(0x19e)]++;else{const _0x5e9402=await this[_0x1b676d(0x1a0)][_0x1b676d(0x269)](_0x43195d);_0x4af633[_0x1b676d(0x289)](_0x395817[_0x1b676d(0x278)][_0x1b676d(0x26a)],_0x5e9402['id']),_0x5a8dbc[_0x1b676d(0x298)][_0x1b676d(0x1d5)]({'name':_0x395817[_0x1b676d(0x278)][_0x1b676d(0x26a)],'action':'created','id':_0x5e9402['id']}),_0x5a8dbc['counts'][_0x1b676d(0x298)]['created']++;}}catch(_0x13b74b){_0x5a8dbc['experimentalArtifacts'][_0x1b676d(0x1d5)]({'name':_0x395817['def']['name'],'action':'error','error':_0x13b74b[_0x1b676d(0x196)]}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x298)][_0x1b676d(0x1de)]++;}}for(const _0x1b0d50 of _0x4e85b7){_0x541268=[];try{const _0x4a2890=_0x1f9372[_0x1b676d(0x229)](_0x1b0d50[_0x1b676d(0x20b)][_0x1b676d(0x26a)]),_0x25d24e=await agentDefToRequest(_0x1b0d50[_0x1b676d(0x20b)],_0x1b0d50[_0x1b676d(0x1c0)],_0x1b0d50['starterMessage'],_0x48a859);if(_0x4a2890)await this[_0x1b676d(0x1a0)]['updateAgentResponse'](_0x4a2890['id'],_0x25d24e),_0x5147a9[_0x1b676d(0x289)](_0x1b0d50[_0x1b676d(0x20b)][_0x1b676d(0x26a)],_0x4a2890['id']),_0x5a8dbc[_0x1b676d(0x258)][_0x1b676d(0x1d5)]({'agentName':_0x1b0d50[_0x1b676d(0x20b)][_0x1b676d(0x26a)],'action':'updated','agentId':_0x4a2890['id'],'warnings':_0x541268[_0x1b676d(0x1c5)]>0x0?_0x541268:undefined}),_0x5a8dbc['counts']['agents']['updated']++;else{const _0x1e6b6f=await this['client'][_0x1b676d(0x26b)](_0x25d24e);_0x5147a9[_0x1b676d(0x289)](_0x1b0d50['yaml']['name'],_0x1e6b6f['id']),_0x5a8dbc[_0x1b676d(0x258)][_0x1b676d(0x1d5)]({'agentName':_0x1b0d50['yaml'][_0x1b676d(0x26a)],'action':_0x1b676d(0x218),'agentId':_0x1e6b6f['id'],'warnings':_0x541268['length']>0x0?_0x541268:undefined}),_0x5a8dbc['counts']['agents'][_0x1b676d(0x218)]++;}}catch(_0x28e7da){_0x5a8dbc[_0x1b676d(0x258)]['push']({'agentName':_0x1b0d50['yaml'][_0x1b676d(0x26a)],'action':_0x1b676d(0x279),'error':_0x28e7da[_0x1b676d(0x196)],'warnings':_0x541268[_0x1b676d(0x1c5)]>0x0?_0x541268:undefined}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x258)]['errors']++;}}for(const _0x2acc57 of _0x59dd81){try{const _0x179b9f=_0x1284bb['get'](_0x2acc57[_0x1b676d(0x20b)][_0x1b676d(0x26a)]),_0x878b2=await yamlPromptToApi(_0x2acc57[_0x1b676d(0x20b)],_0x12da48,_0x48a859);if(!_0x878b2){_0x5a8dbc['prompts'][_0x1b676d(0x1d5)]({'name':_0x2acc57[_0x1b676d(0x20b)][_0x1b676d(0x26a)],'action':'error','error':'Agent\x20reference\x20not\x20found'}),_0x5a8dbc['counts'][_0x1b676d(0x290)][_0x1b676d(0x1de)]++;continue;}if(_0x179b9f)await this[_0x1b676d(0x1a0)][_0x1b676d(0x215)](_0x179b9f['id'],_0x878b2),_0x59e0c1[_0x1b676d(0x289)](_0x2acc57[_0x1b676d(0x20b)][_0x1b676d(0x26a)],_0x179b9f['id']),_0x5a8dbc[_0x1b676d(0x290)][_0x1b676d(0x1d5)]({'name':_0x2acc57['yaml']['name'],'action':'updated','id':_0x179b9f['id']}),_0x5a8dbc[_0x1b676d(0x1a1)]['prompts'][_0x1b676d(0x19e)]++;else{const _0x2b875d=await this[_0x1b676d(0x1a0)][_0x1b676d(0x296)](_0x878b2);_0x59e0c1[_0x1b676d(0x289)](_0x2acc57[_0x1b676d(0x20b)][_0x1b676d(0x26a)],_0x2b875d['id']),_0x5a8dbc['prompts'][_0x1b676d(0x1d5)]({'name':_0x2acc57[_0x1b676d(0x20b)][_0x1b676d(0x26a)],'action':_0x1b676d(0x218),'id':_0x2b875d['id']}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x290)][_0x1b676d(0x218)]++;}}catch(_0x58a3f3){_0x5a8dbc[_0x1b676d(0x290)][_0x1b676d(0x1d5)]({'name':_0x2acc57['yaml'][_0x1b676d(0x26a)],'action':_0x1b676d(0x279),'error':_0x58a3f3[_0x1b676d(0x196)]}),_0x5a8dbc['counts'][_0x1b676d(0x290)][_0x1b676d(0x1de)]++;}}for(const _0x2cbf51 of _0x20d07b){try{const _0x13539e=_0x15457c[_0x1b676d(0x229)](_0x2cbf51[_0x1b676d(0x20b)][_0x1b676d(0x222)]),_0x5c41fe=await yamlIntegrationToApi(_0x2cbf51['yaml'],_0x12da48,_0x48a859);if(_0x13539e){await this[_0x1b676d(0x1a0)][_0x1b676d(0x29a)](_0x13539e['id']);const _0x20b09d=await this[_0x1b676d(0x1a0)][_0x1b676d(0x26c)](_0x5c41fe);_0x5a8dbc[_0x1b676d(0x253)][_0x1b676d(0x1d5)]({'name':_0x2cbf51[_0x1b676d(0x20b)][_0x1b676d(0x222)],'action':_0x1b676d(0x19e),'id':_0x20b09d['id']}),_0x5a8dbc[_0x1b676d(0x1a1)]['integrations'][_0x1b676d(0x19e)]++;}else{const _0x44ef52=await this[_0x1b676d(0x1a0)]['createIntegration'](_0x5c41fe);_0x5a8dbc[_0x1b676d(0x253)][_0x1b676d(0x1d5)]({'name':_0x2cbf51[_0x1b676d(0x20b)][_0x1b676d(0x222)],'action':_0x1b676d(0x218),'id':_0x44ef52['id']}),_0x5a8dbc[_0x1b676d(0x1a1)]['integrations'][_0x1b676d(0x218)]++;}}catch(_0x24f548){_0x5a8dbc['integrations'][_0x1b676d(0x1d5)]({'name':_0x2cbf51[_0x1b676d(0x20b)][_0x1b676d(0x222)],'action':_0x1b676d(0x279),'error':_0x24f548[_0x1b676d(0x196)]}),_0x5a8dbc['counts'][_0x1b676d(0x253)]['errors']++;}}for(const _0x3742b1 of _0xe59fd6){try{const _0x4b6248=_0x76f6a8['get'](_0x3742b1[_0x1b676d(0x20b)][_0x1b676d(0x26a)]),_0x3bb011=await yamlFormInterfaceToApi(_0x3742b1[_0x1b676d(0x20b)],_0x12da48,_0x48a859);if(!_0x3bb011){_0x5a8dbc[_0x1b676d(0x29d)][_0x1b676d(0x1d5)]({'name':_0x3742b1[_0x1b676d(0x20b)][_0x1b676d(0x26a)],'action':_0x1b676d(0x279),'error':_0x1b676d(0x23c)}),_0x5a8dbc[_0x1b676d(0x1a1)]['formInterfaces'][_0x1b676d(0x1de)]++;continue;}if(_0x4b6248){const _0x37e1f9=await this[_0x1b676d(0x1a0)][_0x1b676d(0x185)](_0x4b6248['id'],_0x3bb011);_0x5a8dbc[_0x1b676d(0x29d)][_0x1b676d(0x1d5)]({'name':_0x3742b1['yaml'][_0x1b676d(0x26a)],'action':'updated','id':_0x37e1f9['id']}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x29d)]['updated']++;}else{const _0x36ba48=await this['client'][_0x1b676d(0x1d4)](_0x3bb011);_0x5a8dbc[_0x1b676d(0x29d)]['push']({'name':_0x3742b1[_0x1b676d(0x20b)]['name'],'action':_0x1b676d(0x218),'id':_0x36ba48['id']}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x29d)][_0x1b676d(0x218)]++;}}catch(_0x4c72e){_0x5a8dbc[_0x1b676d(0x29d)][_0x1b676d(0x1d5)]({'name':_0x3742b1[_0x1b676d(0x20b)][_0x1b676d(0x26a)],'action':_0x1b676d(0x279),'error':_0x4c72e[_0x1b676d(0x196)]}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x29d)]['errors']++;}}for(const _0x4e1429 of _0x53fd91){try{const _0x48ea6b=_0x1325b4[_0x1b676d(0x229)](_0x4e1429[_0x1b676d(0x20b)]['name']),_0x26225c=await yamlChatInterfaceToApi(_0x4e1429[_0x1b676d(0x20b)],_0x12da48,_0x48a859);if(_0x48ea6b){const _0x2ebe08=await this['client'][_0x1b676d(0x21c)](_0x48ea6b['id'],_0x26225c);_0x5a8dbc['chatInterfaces'][_0x1b676d(0x1d5)]({'name':_0x4e1429[_0x1b676d(0x20b)]['name'],'action':'updated','id':_0x2ebe08['id']}),_0x5a8dbc['counts']['chatInterfaces']['updated']++;}else{const _0x3a3d74=await this[_0x1b676d(0x1a0)][_0x1b676d(0x21f)](_0x26225c);_0x5a8dbc[_0x1b676d(0x250)][_0x1b676d(0x1d5)]({'name':_0x4e1429[_0x1b676d(0x20b)][_0x1b676d(0x26a)],'action':'created','id':_0x3a3d74['id']}),_0x5a8dbc[_0x1b676d(0x1a1)]['chatInterfaces'][_0x1b676d(0x218)]++;}}catch(_0x559716){_0x5a8dbc[_0x1b676d(0x250)]['push']({'name':_0x4e1429[_0x1b676d(0x20b)]['name'],'action':_0x1b676d(0x279),'error':_0x559716['message']}),_0x5a8dbc[_0x1b676d(0x1a1)][_0x1b676d(0x250)]['errors']++;}}return _0x5a8dbc;}async[a134_0x2792fe(0x235)](_0x1f70c3,_0x33866a,_0x1f2263,_0x55884e){const _0x3ae372=a134_0x2792fe,{projectId:_0x503623,project:_0x371d90}=await this[_0x3ae372(0x1e9)](_0x1f70c3),_0x2111ff=_0x371d90[_0x3ae372(0x19d)][_0x3ae372(0x26a)],_0x4c3c8b=await this[_0x3ae372(0x1a0)][_0x3ae372(0x22a)](_0x503623),_0x3d8406=_0x4c3c8b[_0x3ae372(0x23e)](_0x527b59=>_0x527b59[_0x3ae372(0x19d)][_0x3ae372(0x26a)]===_0x33866a);if(!_0x3d8406)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],'Agent\x20not\x20found:\x20'+_0x33866a,undefined,{'helpText':_0x3ae372(0x198)+_0x4c3c8b[_0x3ae372(0x24e)](_0x336a7d=>_0x336a7d[_0x3ae372(0x19d)][_0x3ae372(0x26a)])[_0x3ae372(0x1a2)](',\x20')});let _0x471b9c;if(_0x1f2263)_0x471b9c=_0x1f2263;else{const _0xbd9990=a134_0x5b5f34[_0x3ae372(0x1a2)](process[_0x3ae372(0x259)](),_0x3ae372(0x258)),_0x3d7502=getSanitizedPathWithMigration(_0xbd9990,_0x2111ff);_0x3d7502[_0x3ae372(0x1cd)]&&this[_0x3ae372(0x18e)][_0x3ae372(0x195)]('Renamed\x20folder:\x20'+a134_0x5b5f34[_0x3ae372(0x268)](_0x3d7502[_0x3ae372(0x1e7)])+_0x3ae372(0x24f)+a134_0x5b5f34['basename'](_0x3d7502[_0x3ae372(0x24d)])),_0x471b9c=_0x3d7502['path'];}const _0x35adf9=getSanitizedPathWithMigration(_0x471b9c,_0x33866a);_0x35adf9['renamed']&&this[_0x3ae372(0x18e)][_0x3ae372(0x195)](_0x3ae372(0x1ae)+a134_0x5b5f34[_0x3ae372(0x268)](_0x35adf9[_0x3ae372(0x1e7)])+_0x3ae372(0x24f)+a134_0x5b5f34[_0x3ae372(0x268)](_0x35adf9[_0x3ae372(0x24d)]));const _0x13a430=_0x35adf9['path'],_0xe688f1=new Map(),_0x3a5167=new Map(),_0x2b68e0=await this[_0x3ae372(0x1a0)][_0x3ae372(0x1e5)](_0x503623),_0x39879d=await this[_0x3ae372(0x1a0)][_0x3ae372(0x1c2)](_0x503623),_0x1ed9fd=await safeListOrEmpty(()=>this[_0x3ae372(0x1a0)][_0x3ae372(0x24c)](_0x503623)),_0x248c11=new Map(),_0x4cf59b=new Map();for(const _0x2f8b57 of _0x2b68e0){_0xe688f1[_0x3ae372(0x289)](_0x2f8b57['id'],_0x2f8b57[_0x3ae372(0x19d)][_0x3ae372(0x26a)]);}for(const _0x3863e9 of _0x39879d){_0x248c11['set'](_0x3863e9['id'],_0x3863e9['attributes']['name']);}for(const _0x53451d of _0x1ed9fd){_0x4cf59b['set'](_0x53451d['id'],_0x53451d[_0x3ae372(0x19d)][_0x3ae372(0x26a)]);}for(const _0xffb4cf of _0x4c3c8b){_0x3a5167[_0x3ae372(0x289)](_0xffb4cf['id'],_0xffb4cf[_0x3ae372(0x19d)][_0x3ae372(0x26a)]);}const _0xcfd1ad={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0xe688f1,'TextKnowledgeBase':_0x248c11,'Agent':_0x3a5167,'ExperimentalKnowledgeBase':_0x4cf59b}),'resolvePromptName':async()=>undefined,'onWarning':_0x33d1ec=>this['logger'][_0x3ae372(0x25b)](_0x33d1ec)},_0x1990ae=a134_0x5b5f34[_0x3ae372(0x1a2)](_0x13a430,_0x3ae372(0x191)),_0x4183c8=a134_0x5b5f34['join'](_0x13a430,_0x3ae372(0x1b8)),_0x46b873=a134_0x5b5f34[_0x3ae372(0x1a2)](_0x13a430,_0x3ae372(0x257)),_0x438bd2=!a134_0x52ac94[_0x3ae372(0x249)](_0x4183c8);if(_0x55884e?.[_0x3ae372(0x228)])return{'agentName':_0x33866a,'outputPath':_0x13a430,'isNew':_0x438bd2,'hasChanges':!![]};a134_0x52ac94[_0x3ae372(0x25d)](_0x471b9c,{'recursive':!![]}),a134_0x52ac94[_0x3ae372(0x25d)](_0x13a430,{'recursive':!![]});const _0x13f8bc=a134_0x5b5f34[_0x3ae372(0x1a2)](_0x471b9c,_0x3ae372(0x1b4));!a134_0x52ac94[_0x3ae372(0x249)](_0x13f8bc)&&a134_0x52ac94['writeFileSync'](_0x13f8bc,createAgentConfigContent(_0x1f70c3));const {yaml:_0x47fccf,systemPrompt:_0x5360f6,starterMessage:_0x2520ab}=await agentResponseToDef(_0x3d8406,_0xcfd1ad);let _0x4bf212=_0x438bd2;if(!_0x438bd2){const _0x2aa89e=a134_0x52ac94[_0x3ae372(0x249)](_0x1990ae)?a134_0x52ac94['readFileSync'](_0x1990ae,'utf-8'):'',_0x3cffe3=a134_0x52ac94[_0x3ae372(0x260)](_0x4183c8,_0x3ae372(0x254));_0x4bf212=_0x2aa89e!==_0x5360f6||_0x3cffe3!==toAgentYamlString(_0x47fccf);}a134_0x52ac94[_0x3ae372(0x1bc)](_0x1990ae,_0x5360f6),a134_0x52ac94[_0x3ae372(0x1bc)](_0x4183c8,toAgentYamlString(_0x47fccf));if(_0x2520ab&&_0x2520ab[_0x3ae372(0x28c)]('\x0a'))a134_0x52ac94[_0x3ae372(0x1bc)](_0x46b873,_0x2520ab);else a134_0x52ac94[_0x3ae372(0x249)](_0x46b873)&&a134_0x52ac94[_0x3ae372(0x1bf)](_0x46b873);return{'agentName':_0x33866a,'outputPath':_0x13a430,'isNew':_0x438bd2,'hasChanges':_0x4bf212};}async[a134_0x2792fe(0x272)](_0x5ca4ca,_0xbf16e0){const _0x4b0b6d=a134_0x2792fe;let _0x5a89cf;isAgentYamlPath(_0x5ca4ca)?_0x5a89cf=getAgentDirFromYamlPath(_0x5ca4ca):_0x5a89cf=_0x5ca4ca;const {config:_0x3facd6}=findAgentConfig(_0x5a89cf),_0x414b6a=await this['resolveProjectId'](_0x3facd6['llm_project']),_0x452d18=a134_0x5b5f34[_0x4b0b6d(0x1a2)](_0x5a89cf,_0x4b0b6d(0x1b8)),_0x395f4d=a134_0x5b5f34[_0x4b0b6d(0x1a2)](_0x5a89cf,_0x4b0b6d(0x191)),_0x44f773=a134_0x5b5f34['join'](_0x5a89cf,_0x4b0b6d(0x257));if(!a134_0x52ac94[_0x4b0b6d(0x249)](_0x452d18))throw new SDKError(ErrorCode['NOT_FOUND'],_0x4b0b6d(0x225)+_0x5a89cf,undefined,{'helpText':'Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.'});const _0x5052c5=parseAgentYaml(a134_0x52ac94[_0x4b0b6d(0x260)](_0x452d18,'utf-8'),_0x452d18),_0x2ab3e=a134_0x52ac94[_0x4b0b6d(0x249)](_0x395f4d)?a134_0x52ac94[_0x4b0b6d(0x260)](_0x395f4d,_0x4b0b6d(0x254)):'',_0x25607a=a134_0x52ac94['existsSync'](_0x44f773)?a134_0x52ac94[_0x4b0b6d(0x260)](_0x44f773,_0x4b0b6d(0x254)):_0x5052c5['starter_message'];if(_0xbf16e0?.[_0x4b0b6d(0x228)])return{'agentName':_0x5052c5[_0x4b0b6d(0x26a)],'action':_0x4b0b6d(0x218),'projectId':_0x414b6a};const _0x142fc0=await this[_0x4b0b6d(0x1a0)][_0x4b0b6d(0x22a)](_0x414b6a),_0x731644=await fetchAllToolTargetMaps((_0x54cab4,_0x500fcd)=>this[_0x4b0b6d(0x1a0)][_0x4b0b6d(0x1ea)](_0x54cab4,_0x500fcd),_0x414b6a),_0x267afb=new Map();for(const _0xcdce8b of _0x142fc0){_0x267afb[_0x4b0b6d(0x289)](_0xcdce8b[_0x4b0b6d(0x19d)][_0x4b0b6d(0x26a)],_0xcdce8b['id']);}const _0x5ed4d2=[],_0x11aa62={'projectId':_0x414b6a,'resolveToolTargetId':buildIdResolver({..._0x731644[_0x4b0b6d(0x224)],'Agent':_0x267afb}),'resolvePromptId':async()=>undefined,'onWarning':_0x1445d5=>{const _0x10a580=_0x4b0b6d;this[_0x10a580(0x18e)][_0x10a580(0x25b)](_0x1445d5),_0x5ed4d2[_0x10a580(0x1d5)](_0x1445d5);}};try{const _0x1ac863=_0x142fc0['find'](_0x446cef=>_0x446cef[_0x4b0b6d(0x19d)]['name']===_0x5052c5['name']),_0x13b0ae=await agentDefToRequest(_0x5052c5,_0x2ab3e,_0x25607a,_0x11aa62);if(_0x1ac863)return await this[_0x4b0b6d(0x1a0)][_0x4b0b6d(0x19b)](_0x1ac863['id'],_0x13b0ae),{'agentName':_0x5052c5[_0x4b0b6d(0x26a)],'action':_0x4b0b6d(0x19e),'projectId':_0x414b6a,'agentId':_0x1ac863['id'],'warnings':_0x5ed4d2['length']>0x0?_0x5ed4d2:undefined};else{const _0x1b87ee=await this[_0x4b0b6d(0x1a0)][_0x4b0b6d(0x26b)](_0x13b0ae);return{'agentName':_0x5052c5[_0x4b0b6d(0x26a)],'action':_0x4b0b6d(0x218),'projectId':_0x414b6a,'agentId':_0x1b87ee['id'],'warnings':_0x5ed4d2[_0x4b0b6d(0x1c5)]>0x0?_0x5ed4d2:undefined};}}catch(_0x5a391e){return{'agentName':_0x5052c5[_0x4b0b6d(0x26a)],'action':_0x4b0b6d(0x279),'projectId':_0x414b6a,'error':_0x5a391e['message'],'warnings':_0x5ed4d2[_0x4b0b6d(0x1c5)]>0x0?_0x5ed4d2:undefined};}}async[a134_0x2792fe(0x22b)](_0x5a6a82,_0x50bdc0,_0x337ed0){const _0xf0877f=a134_0x2792fe,_0x52a227=a134_0x52ac94[_0xf0877f(0x249)](_0x5a6a82)&&a134_0x52ac94[_0xf0877f(0x249)](a134_0x5b5f34[_0xf0877f(0x1a2)](_0x5a6a82,_0xf0877f(0x1b4)));let _0x34a2f0;const _0x45c2a3=[],_0xa0095b=[],_0x1385a5=[],_0x37b87c=[],_0x552f4f=[],_0x45f0e9=[],_0x592512=[],_0x3d6a2d=[],_0x33942a=[];if(_0x52a227){const _0x21c5e4=loadAgentConfig(a134_0x5b5f34[_0xf0877f(0x1a2)](_0x5a6a82,_0xf0877f(0x1b4)));_0x34a2f0=_0x21c5e4[_0xf0877f(0x1b0)];const _0x252879=a134_0x52ac94[_0xf0877f(0x261)](_0x5a6a82,{'withFileTypes':!![]});for(const _0x37c0dc of _0x252879){if(!_0x37c0dc[_0xf0877f(0x277)]())continue;if([_0xf0877f(0x1e2),_0xf0877f(0x1ee),_0xf0877f(0x23a),_0xf0877f(0x290),_0xf0877f(0x253),_0xf0877f(0x18d),_0xf0877f(0x1ac)][_0xf0877f(0x28c)](_0x37c0dc[_0xf0877f(0x26a)]))continue;const _0x2eee09=a134_0x5b5f34['join'](_0x5a6a82,_0x37c0dc[_0xf0877f(0x26a)]);if(isAgentDir(_0x2eee09)){const _0x1fc926=a134_0x5b5f34[_0xf0877f(0x1a2)](_0x2eee09,'agent.yml'),_0x987104=a134_0x5b5f34['join'](_0x2eee09,_0xf0877f(0x191)),_0x478c96=a134_0x5b5f34[_0xf0877f(0x1a2)](_0x2eee09,'starter_message.md'),_0x2a7966=parseAgentYaml(a134_0x52ac94[_0xf0877f(0x260)](_0x1fc926,_0xf0877f(0x254)),_0x1fc926),_0x21dc25=a134_0x52ac94[_0xf0877f(0x249)](_0x987104)?a134_0x52ac94[_0xf0877f(0x260)](_0x987104,_0xf0877f(0x254)):'',_0x39607d=a134_0x52ac94[_0xf0877f(0x249)](_0x478c96)?a134_0x52ac94['readFileSync'](_0x478c96,_0xf0877f(0x254)):_0x2a7966[_0xf0877f(0x25e)];_0x45c2a3[_0xf0877f(0x1d5)]({'name':_0x2a7966[_0xf0877f(0x26a)],'dir':_0x2eee09,'yaml':_0x2a7966,'systemPrompt':_0x21dc25,'starterMessage':_0x39607d});}}const _0x46beb=getKnowledgeBasesDir(_0x5a6a82);if(a134_0x52ac94[_0xf0877f(0x249)](_0x46beb)){const _0x54d7dd=a134_0x52ac94[_0xf0877f(0x261)](_0x46beb);for(const _0x361b44 of _0x54d7dd){const _0x5ccb36=a134_0x5b5f34['join'](_0x46beb,_0x361b44);if(_0x361b44[_0xf0877f(0x256)](_0xf0877f(0x29c))){const _0x63e202=parseKnowledgeBaseYaml(a134_0x52ac94[_0xf0877f(0x260)](_0x5ccb36,_0xf0877f(0x254)),_0x5ccb36);_0xa0095b['push']({'name':_0x63e202['name'],'path':_0x5ccb36,'yaml':_0x63e202});}else{if(_0x361b44[_0xf0877f(0x256)](_0xf0877f(0x1f5))){const _0x1ab1b2=a134_0x52ac94[_0xf0877f(0x260)](_0x5ccb36,'utf-8'),{name:_0x5b2bad,text:_0xe5c956}=parseTextKnowledgeBaseMd(_0x1ab1b2,_0x361b44);_0x1385a5['push']({'name':_0x5b2bad,'path':_0x5ccb36,'text':_0xe5c956});}}}}const _0x58d83a=getPromptsDir(_0x5a6a82);if(a134_0x52ac94[_0xf0877f(0x249)](_0x58d83a)){const _0x30fa88=a134_0x52ac94[_0xf0877f(0x261)](_0x58d83a)[_0xf0877f(0x1ad)](_0x87fd4a=>_0x87fd4a[_0xf0877f(0x256)](_0xf0877f(0x29c)));for(const _0x5ea416 of _0x30fa88){const _0x247607=a134_0x5b5f34['join'](_0x58d83a,_0x5ea416),_0x320cad=parsePromptYaml(a134_0x52ac94[_0xf0877f(0x260)](_0x247607,_0xf0877f(0x254)),_0x247607);_0x37b87c[_0xf0877f(0x1d5)]({'name':_0x320cad['name'],'path':_0x247607,'yaml':_0x320cad});}}const _0x207c44=getIntegrationsDir(_0x5a6a82);if(a134_0x52ac94[_0xf0877f(0x249)](_0x207c44)){const _0x5cf989=a134_0x52ac94[_0xf0877f(0x261)](_0x207c44)[_0xf0877f(0x1ad)](_0x4c868d=>_0x4c868d[_0xf0877f(0x256)](_0xf0877f(0x29c)));for(const _0x429018 of _0x5cf989){const _0x10f08a=a134_0x5b5f34['join'](_0x207c44,_0x429018),_0x1a0c7b=parseIntegrationYaml(a134_0x52ac94['readFileSync'](_0x10f08a,_0xf0877f(0x254)),_0x10f08a);SAFE_INTEGRATION_TYPES[_0xf0877f(0x28c)](_0x1a0c7b[_0xf0877f(0x222)][_0xf0877f(0x293)]())?_0x552f4f['push']({'name':_0x1a0c7b[_0xf0877f(0x26a)],'path':_0x10f08a,'yaml':_0x1a0c7b}):this['logger'][_0xf0877f(0x25b)](_0xf0877f(0x220)+_0x1a0c7b['name']+_0xf0877f(0x1ff)+_0x1a0c7b['service_type']+_0xf0877f(0x265)+(_0xf0877f(0x251)+SAFE_INTEGRATION_TYPES[_0xf0877f(0x1a2)](',\x20')+')\x20can\x20be\x20cloned.'));}}const _0xc322f8=getExperimentalKnowledgeBasesDir(_0x5a6a82);if(a134_0x52ac94[_0xf0877f(0x249)](_0xc322f8)){const _0x1e9b3e=a134_0x52ac94[_0xf0877f(0x261)](_0xc322f8,{'withFileTypes':!![]});for(const _0x8e8cdb of _0x1e9b3e){if(!_0x8e8cdb['isDirectory']())continue;const _0x5220f2=a134_0x5b5f34[_0xf0877f(0x1a2)](_0xc322f8,_0x8e8cdb['name']),_0x181d4d=a134_0x5b5f34[_0xf0877f(0x1a2)](_0x5220f2,_0x8e8cdb[_0xf0877f(0x26a)]+'.yml');if(a134_0x52ac94[_0xf0877f(0x249)](_0x181d4d)){const _0xfd35d9=parseExperimentalKnowledgeBaseYaml(a134_0x52ac94['readFileSync'](_0x181d4d,_0xf0877f(0x254)),_0x181d4d),_0x20b7a7=a134_0x5b5f34[_0xf0877f(0x1a2)](_0x5220f2,_0xf0877f(0x1e0)),_0x2cb0e1=[];if(a134_0x52ac94[_0xf0877f(0x249)](_0x20b7a7)){const _0x1807de=a134_0x52ac94[_0xf0877f(0x261)](_0x20b7a7,{'withFileTypes':!![]});for(const _0x100ddf of _0x1807de){if(!_0x100ddf[_0xf0877f(0x277)]())continue;const _0x39f02c=a134_0x5b5f34[_0xf0877f(0x1a2)](_0x20b7a7,_0x100ddf[_0xf0877f(0x26a)]),_0x33af28=a134_0x5b5f34[_0xf0877f(0x1a2)](_0x39f02c,_0xf0877f(0x19f)),_0x1a790c=a134_0x5b5f34[_0xf0877f(0x1a2)](_0x39f02c,_0xf0877f(0x226));if(a134_0x52ac94['existsSync'](_0x33af28)&&a134_0x52ac94[_0xf0877f(0x249)](_0x1a790c)){const _0x535246=a134_0x52ac94[_0xf0877f(0x260)](_0x33af28,'utf-8'),_0x4f2503=a134_0x52ac94[_0xf0877f(0x260)](_0x1a790c,_0xf0877f(0x254));_0x2cb0e1[_0xf0877f(0x1d5)]({'name':_0x100ddf[_0xf0877f(0x26a)],'code':_0x535246,'json_schema':_0x4f2503});}}}const _0x1e0731={..._0xfd35d9,'functions':_0x2cb0e1};_0x45f0e9[_0xf0877f(0x1d5)]({'name':_0xfd35d9[_0xf0877f(0x26a)],'path':_0x5220f2,'def':_0x1e0731});}}}const _0x5c79d7=getExperimentalArtifactsDir(_0x5a6a82);if(a134_0x52ac94[_0xf0877f(0x249)](_0x5c79d7)){const _0x2ba771=a134_0x52ac94['readdirSync'](_0x5c79d7,{'withFileTypes':!![]});for(const _0x20c8f8 of _0x2ba771){if(!_0x20c8f8[_0xf0877f(0x277)]())continue;const _0x2fc850=a134_0x5b5f34[_0xf0877f(0x1a2)](_0x5c79d7,_0x20c8f8['name']),_0x3bf676=a134_0x5b5f34[_0xf0877f(0x1a2)](_0x2fc850,_0x20c8f8['name']+_0xf0877f(0x29c));if(a134_0x52ac94[_0xf0877f(0x249)](_0x3bf676)){const _0x8d6019=parseExperimentalArtifactYaml(a134_0x52ac94['readFileSync'](_0x3bf676,_0xf0877f(0x254)),_0x3bf676),_0x1e2049=a134_0x5b5f34[_0xf0877f(0x1a2)](_0x2fc850,_0xf0877f(0x19f)),_0xa62548=a134_0x52ac94['existsSync'](_0x1e2049)?a134_0x52ac94[_0xf0877f(0x260)](_0x1e2049,_0xf0877f(0x254)):'',_0x53e106=a134_0x5b5f34[_0xf0877f(0x1a2)](_0x2fc850,_0xf0877f(0x29b)),_0x3dcfe8=[];if(a134_0x52ac94[_0xf0877f(0x249)](_0x53e106)){const _0x1092d0=a134_0x52ac94['readdirSync'](_0x53e106);for(const _0x1ce1e6 of _0x1092d0){const _0x511e51=a134_0x5b5f34[_0xf0877f(0x1a2)](_0x53e106,_0x1ce1e6);if(a134_0x52ac94[_0xf0877f(0x18c)](_0x511e51)[_0xf0877f(0x1ce)]()){const _0xb9bfa6=a134_0x52ac94[_0xf0877f(0x260)](_0x511e51,'utf-8');_0x3dcfe8[_0xf0877f(0x1d5)]({'file_name':_0x1ce1e6,'text_content':_0xb9bfa6});}}}const _0x486960={..._0x8d6019,'code':_0xa62548,'files':_0x3dcfe8};_0x592512[_0xf0877f(0x1d5)]({'name':_0x8d6019[_0xf0877f(0x26a)],'path':_0x2fc850,'def':_0x486960});}}}const _0x23dcf0=getFormInterfacesDir(_0x5a6a82);if(a134_0x52ac94[_0xf0877f(0x249)](_0x23dcf0)){const _0x2806b6=a134_0x52ac94[_0xf0877f(0x261)](_0x23dcf0)[_0xf0877f(0x1ad)](_0xf11b98=>_0xf11b98['endsWith'](_0xf0877f(0x29c)));for(const _0x301be3 of _0x2806b6){const _0x1e0541=a134_0x5b5f34['join'](_0x23dcf0,_0x301be3),_0x10ba77=parseFormInterfaceYaml(a134_0x52ac94['readFileSync'](_0x1e0541,'utf-8'),_0x1e0541);_0x3d6a2d[_0xf0877f(0x1d5)]({'name':_0x10ba77[_0xf0877f(0x26a)],'path':_0x1e0541,'yaml':_0x10ba77});}}const _0xb4ab28=getChatInterfacesDir(_0x5a6a82);if(a134_0x52ac94[_0xf0877f(0x249)](_0xb4ab28)){const _0x32355b=a134_0x52ac94[_0xf0877f(0x261)](_0xb4ab28)[_0xf0877f(0x1ad)](_0x1b776a=>_0x1b776a['endsWith'](_0xf0877f(0x29c)));for(const _0x41fd19 of _0x32355b){const _0x8c5398=a134_0x5b5f34[_0xf0877f(0x1a2)](_0xb4ab28,_0x41fd19),_0x1a8d8e=parseChatInterfaceYaml(a134_0x52ac94[_0xf0877f(0x260)](_0x8c5398,_0xf0877f(0x254)),_0x8c5398);_0x33942a[_0xf0877f(0x1d5)]({'name':_0x1a8d8e[_0xf0877f(0x26a)],'path':_0x8c5398,'yaml':_0x1a8d8e});}}}else{const _0x1b1410=await this[_0xf0877f(0x1b1)](_0x5a6a82),_0xc2850e=await this[_0xf0877f(0x1a0)][_0xf0877f(0x227)](_0x1b1410);_0x34a2f0=_0xc2850e[_0xf0877f(0x19d)]['name'];const _0x2ae7a1=await this[_0xf0877f(0x1a0)][_0xf0877f(0x22a)](_0x1b1410),_0x3ed963=await this['client'][_0xf0877f(0x1e5)](_0x1b1410),_0x28fdf2=await this[_0xf0877f(0x1a0)][_0xf0877f(0x1c2)](_0x1b1410),_0x8ad2b3=await this[_0xf0877f(0x1a0)]['listPrompts'](_0x1b1410),_0x42e1cb=await this[_0xf0877f(0x1a0)]['listIntegrations'](_0x1b1410),_0x385f65=await safeListOrEmpty(()=>this[_0xf0877f(0x1a0)]['listExperimentalKnowledgeBases'](_0x1b1410)),_0x525993=await safeListOrEmpty(()=>this['client'][_0xf0877f(0x22f)](_0x1b1410)),_0x22156f=new Map(),_0x25ee9e=new Map(),_0x1d5619=new Map(),_0x2a2f52=new Map(),_0x3daa11=new Map(),_0x2f298b=new Map();for(const _0x16f4f of _0x3ed963){_0x22156f['set'](_0x16f4f['id'],_0x16f4f[_0xf0877f(0x19d)][_0xf0877f(0x26a)]);}for(const _0x30f7a8 of _0x28fdf2){_0x25ee9e[_0xf0877f(0x289)](_0x30f7a8['id'],_0x30f7a8[_0xf0877f(0x19d)][_0xf0877f(0x26a)]);}for(const _0x1b3a8a of _0x2ae7a1){_0x1d5619[_0xf0877f(0x289)](_0x1b3a8a['id'],_0x1b3a8a[_0xf0877f(0x19d)][_0xf0877f(0x26a)]);}for(const _0x2c1b04 of _0x8ad2b3){_0x2a2f52['set'](_0x2c1b04['id'],_0x2c1b04['attributes']['name']);}for(const _0x311981 of _0x385f65){_0x3daa11[_0xf0877f(0x289)](_0x311981['id'],_0x311981[_0xf0877f(0x19d)]['name']);}for(const _0x3791dc of _0x525993){_0x2f298b[_0xf0877f(0x289)](_0x3791dc['id'],_0x3791dc[_0xf0877f(0x19d)][_0xf0877f(0x26a)]);}const _0x2f5465={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x22156f,'TextKnowledgeBase':_0x25ee9e,'Agent':_0x1d5619,'ExperimentalKnowledgeBase':_0x3daa11}),'resolvePromptName':async _0x92a491=>_0x2a2f52[_0xf0877f(0x229)](_0x92a491),'onWarning':_0xd07204=>this['logger'][_0xf0877f(0x25b)](_0xd07204)};for(const _0x70e57c of _0x2ae7a1){const _0x2db76f=await agentResponseToDef(_0x70e57c,_0x2f5465),{yaml:_0x14ef95,systemPrompt:_0x1092ac,starterMessage:_0x49e3e0}=_0x2db76f;_0x45c2a3[_0xf0877f(0x1d5)]({'name':_0x14ef95[_0xf0877f(0x26a)],'dir':'','yaml':_0x14ef95,'systemPrompt':_0x1092ac,'starterMessage':_0x49e3e0});}for(const _0x305bc9 of _0x3ed963){const _0x54088d=apiKnowledgeBaseToYaml(_0x305bc9);_0xa0095b[_0xf0877f(0x1d5)]({'name':_0x54088d[_0xf0877f(0x26a)],'path':'','yaml':_0x54088d});}for(const _0x4363a4 of _0x28fdf2){_0x1385a5[_0xf0877f(0x1d5)]({'name':_0x4363a4[_0xf0877f(0x19d)]['name'],'path':'','text':_0x4363a4[_0xf0877f(0x19d)][_0xf0877f(0x1f7)]});}for(const _0x43d7d0 of _0x8ad2b3){const _0x13eed6=await apiPromptToYaml(_0x43d7d0,_0x2f5465);_0x13eed6&&_0x37b87c['push']({'name':_0x13eed6[_0xf0877f(0x26a)],'path':'','yaml':_0x13eed6});}for(const _0x4334d1 of _0x42e1cb){if(!_0x4334d1[_0xf0877f(0x19d)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0xf0877f(0x28c)](_0x4334d1[_0xf0877f(0x19d)]['serviceType'][_0xf0877f(0x293)]())){const _0x272134=await apiIntegrationToYaml(_0x4334d1,_0x2f5465);_0x552f4f[_0xf0877f(0x1d5)]({'name':_0x4334d1['attributes'][_0xf0877f(0x297)]['toLowerCase'](),'path':'','yaml':_0x272134});}}for(const _0x43e8b5 of _0x385f65){const _0x3737fd=apiExperimentalKnowledgeBaseToYaml(_0x43e8b5);_0x45f0e9['push']({'name':_0x3737fd[_0xf0877f(0x26a)],'path':'','def':_0x3737fd});}for(const _0x2c4f97 of _0x525993){const _0x41a61d=apiExperimentalArtifactToYaml(_0x2c4f97);_0x592512[_0xf0877f(0x1d5)]({'name':_0x41a61d[_0xf0877f(0x26a)],'path':'','def':_0x41a61d});}const _0x3cb9c0=await safeListOrEmpty(()=>this[_0xf0877f(0x1a0)][_0xf0877f(0x1dc)](_0x1b1410));for(const _0x32a35f of _0x3cb9c0){const _0x867db=await apiFormInterfaceToYaml(_0x32a35f,_0x2f5465);_0x3d6a2d[_0xf0877f(0x1d5)]({'name':_0x867db[_0xf0877f(0x26a)],'path':'','yaml':_0x867db});}const _0x5ca04b=await safeListOrEmpty(()=>this[_0xf0877f(0x1a0)][_0xf0877f(0x243)](_0x1b1410));for(const _0x5400fa of _0x5ca04b){if(_0x5400fa[_0xf0877f(0x19d)]['isManaged'])continue;const _0x47e81f=await apiChatInterfaceToYaml(_0x5400fa,_0x2f5465);_0x33942a[_0xf0877f(0x1d5)]({'name':_0x47e81f[_0xf0877f(0x26a)],'path':'','yaml':_0x47e81f});}}const _0x1afab4={'sourceProjectName':_0x34a2f0,'newProjectName':_0x50bdc0,'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}}},_0x1714df=await this[_0xf0877f(0x1a0)][_0xf0877f(0x1c7)](),_0x453f62=_0x1714df['find'](_0x33d79a=>_0x33d79a['attributes']['name']===_0x50bdc0);if(_0x453f62)throw new SDKError(ErrorCode[_0xf0877f(0x1a8)],'Project\x20\x22'+_0x50bdc0+_0xf0877f(0x262),undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x337ed0?.[_0xf0877f(0x228)])return _0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x258)]['created']=_0x45c2a3[_0xf0877f(0x1c5)],_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x280)]['created']=_0xa0095b['length'],_0x1afab4['counts']['textKnowledgeBases'][_0xf0877f(0x218)]=_0x1385a5[_0xf0877f(0x1c5)],_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x233)][_0xf0877f(0x218)]=_0x45f0e9[_0xf0877f(0x1c5)],_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x298)][_0xf0877f(0x218)]=_0x592512[_0xf0877f(0x1c5)],_0x1afab4[_0xf0877f(0x1a1)]['prompts']['created']=_0x37b87c[_0xf0877f(0x1c5)],_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x253)][_0xf0877f(0x218)]=_0x552f4f[_0xf0877f(0x1c5)],_0x1afab4;const _0x28878f=await this[_0xf0877f(0x1a0)][_0xf0877f(0x1d8)]({'name':_0x50bdc0}),_0x1f96a6=_0x28878f['id'];_0x1afab4[_0xf0877f(0x18b)]=_0x1f96a6;const _0x402138=new Map(),_0x385977=new Map(),_0x106d51=new Map(),_0x936f10=new Map(),_0x29a8ae=new Map(),_0x4d9dcd=new Map(),_0x44ba59=new Map(),_0x430e82=new Map(),_0x9cee5e=new Set(),_0x1df106=new Set();for(const _0x299350 of _0x45c2a3){for(const _0x586c69 of _0x299350['yaml'][_0xf0877f(0x199)]||[]){if(_0x586c69['type']===_0xf0877f(0x192)&&_0x586c69[_0xf0877f(0x26d)]){const _0xd4ca96=parseRef(_0x586c69[_0xf0877f(0x26d)]);if(_0xd4ca96)_0x9cee5e['add'](_0xd4ca96[_0xf0877f(0x26a)]);}else{if(_0x586c69[_0xf0877f(0x292)]===_0xf0877f(0x238)&&_0x586c69['target']){const _0x4d733f=parseRef(_0x586c69[_0xf0877f(0x26d)]);if(_0x4d733f)_0x1df106[_0xf0877f(0x247)](_0x4d733f[_0xf0877f(0x26a)]);}}}}for(const _0x50931d of _0x9cee5e){try{const _0x37f3d6=await this[_0xf0877f(0x1a0)][_0xf0877f(0x1c1)]({'projectId':_0x1f96a6,'name':_0x50931d});_0x29a8ae[_0xf0877f(0x289)](_0x50931d,_0x37f3d6['id']),_0x1afab4[_0xf0877f(0x1e8)][_0xf0877f(0x1d5)]({'name':_0x50931d,'action':_0xf0877f(0x218),'id':_0x37f3d6['id']}),_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x1e8)][_0xf0877f(0x218)]++;}catch(_0x3325a0){_0x1afab4[_0xf0877f(0x1e8)][_0xf0877f(0x1d5)]({'name':_0x50931d,'action':_0xf0877f(0x279),'error':_0x3325a0[_0xf0877f(0x196)]}),_0x1afab4['counts'][_0xf0877f(0x1e8)][_0xf0877f(0x1de)]++;}}for(const _0x33a1b0 of _0x1df106){try{const _0x348d55=await this['client'][_0xf0877f(0x22d)]({'projectId':_0x1f96a6,'name':_0x33a1b0});_0x4d9dcd[_0xf0877f(0x289)](_0x33a1b0,_0x348d55['id']),_0x1afab4['webSearchTools'][_0xf0877f(0x1d5)]({'name':_0x33a1b0,'action':_0xf0877f(0x218),'id':_0x348d55['id']}),_0x1afab4[_0xf0877f(0x1a1)]['webSearchTools']['created']++;}catch(_0x24ad07){_0x1afab4[_0xf0877f(0x284)]['push']({'name':_0x33a1b0,'action':_0xf0877f(0x279),'error':_0x24ad07[_0xf0877f(0x196)]}),_0x1afab4['counts'][_0xf0877f(0x284)]['errors']++;}}const _0x4c45a3=await fetchAllToolTargetMaps((_0x570845,_0x2bfdec)=>this[_0xf0877f(0x1a0)][_0xf0877f(0x1ea)](_0x570845,_0x2bfdec),_0x1f96a6);let _0x53603c=[];const _0x4f2e48={'projectId':_0x1f96a6,'resolveToolTargetId':buildIdResolver({..._0x4c45a3[_0xf0877f(0x224)],'KnowledgeBase':_0x402138,'TextKnowledgeBase':_0x385977,'ExperimentalKnowledgeBase':_0x44ba59,'Agent':_0x106d51,'WebSearchTool':_0x4d9dcd,'ImageGenerator':_0x29a8ae}),'resolvePromptId':async _0x3050d8=>_0x936f10[_0xf0877f(0x229)](_0x3050d8),'onWarning':_0xf2e3cf=>{const _0x608dc1=_0xf0877f;this[_0x608dc1(0x18e)][_0x608dc1(0x25b)](_0xf2e3cf),_0x53603c[_0x608dc1(0x1d5)](_0xf2e3cf);}};for(const _0xf52a9b of _0xa0095b){try{const _0x3bdafa=yamlKnowledgeBaseToApi(_0xf52a9b[_0xf0877f(0x20b)],_0x1f96a6),_0x564f31=await this[_0xf0877f(0x1a0)][_0xf0877f(0x1fd)](_0x3bdafa);_0x402138[_0xf0877f(0x289)](_0xf52a9b[_0xf0877f(0x20b)][_0xf0877f(0x26a)],_0x564f31['id']),_0x1afab4[_0xf0877f(0x280)][_0xf0877f(0x1d5)]({'name':_0xf52a9b['yaml'][_0xf0877f(0x26a)],'action':_0xf0877f(0x218),'id':_0x564f31['id']}),_0x1afab4['counts']['knowledgeBases']['created']++;}catch(_0x3b7344){_0x1afab4['knowledgeBases'][_0xf0877f(0x1d5)]({'name':_0xf52a9b['yaml']['name'],'action':_0xf0877f(0x279),'error':_0x3b7344['message']}),_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x280)][_0xf0877f(0x1de)]++;}}for(const _0x490421 of _0x1385a5){try{const _0x243264=yamlTextKnowledgeBaseToApi({'name':_0x490421['name'],'text':_0x490421[_0xf0877f(0x1f7)]},_0x1f96a6),_0x10ec68=await this[_0xf0877f(0x1a0)][_0xf0877f(0x1f1)](_0x243264);_0x385977[_0xf0877f(0x289)](_0x490421[_0xf0877f(0x26a)],_0x10ec68['id']),_0x1afab4['textKnowledgeBases'][_0xf0877f(0x1d5)]({'name':_0x490421[_0xf0877f(0x26a)],'action':_0xf0877f(0x218),'id':_0x10ec68['id']}),_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x27d)][_0xf0877f(0x218)]++;}catch(_0x4ae5e4){_0x1afab4['textKnowledgeBases'][_0xf0877f(0x1d5)]({'name':_0x490421[_0xf0877f(0x26a)],'action':'error','error':_0x4ae5e4[_0xf0877f(0x196)]}),_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x27d)][_0xf0877f(0x1de)]++;}}for(const _0x2bb986 of _0x592512){try{const _0x5016c4=yamlExperimentalArtifactToApi(_0x2bb986[_0xf0877f(0x278)],_0x1f96a6),_0x13ee38=await this[_0xf0877f(0x1a0)]['createExperimentalArtifact'](_0x5016c4);_0x430e82[_0xf0877f(0x289)](_0x2bb986[_0xf0877f(0x278)][_0xf0877f(0x26a)],_0x13ee38['id']),_0x1afab4[_0xf0877f(0x298)][_0xf0877f(0x1d5)]({'name':_0x2bb986[_0xf0877f(0x278)][_0xf0877f(0x26a)],'action':'created','id':_0x13ee38['id']}),_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x298)][_0xf0877f(0x218)]++;}catch(_0x27e349){_0x1afab4[_0xf0877f(0x298)][_0xf0877f(0x1d5)]({'name':_0x2bb986[_0xf0877f(0x278)][_0xf0877f(0x26a)],'action':_0xf0877f(0x279),'error':_0x27e349[_0xf0877f(0x196)]}),_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x298)][_0xf0877f(0x1de)]++;}}for(const _0xa701c8 of _0x45f0e9){try{const _0x5d6b0d=yamlExperimentalKnowledgeBaseToApi(_0xa701c8[_0xf0877f(0x278)],_0x1f96a6),_0x10de74=await this[_0xf0877f(0x1a0)][_0xf0877f(0x1f0)](_0x5d6b0d);_0x44ba59[_0xf0877f(0x289)](_0xa701c8['def'][_0xf0877f(0x26a)],_0x10de74['id']),_0x1afab4[_0xf0877f(0x233)][_0xf0877f(0x1d5)]({'name':_0xa701c8[_0xf0877f(0x278)][_0xf0877f(0x26a)],'action':_0xf0877f(0x218),'id':_0x10de74['id']}),_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x233)]['created']++;}catch(_0x3037d6){_0x1afab4[_0xf0877f(0x233)][_0xf0877f(0x1d5)]({'name':_0xa701c8[_0xf0877f(0x278)]['name'],'action':_0xf0877f(0x279),'error':_0x3037d6[_0xf0877f(0x196)]}),_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x233)][_0xf0877f(0x1de)]++;}}const _0x362a33=[..._0x45c2a3][_0xf0877f(0x1be)]((_0x49dee0,_0xbb0f78)=>{const _0x4ab35f=_0xf0877f,_0x36bb86=_0x49dee0[_0x4ab35f(0x20b)][_0x4ab35f(0x199)]?.[_0x4ab35f(0x23b)](_0x517d36=>_0x517d36['type']===_0x4ab35f(0x1b5))??![],_0x527c5f=_0xbb0f78['yaml'][_0x4ab35f(0x199)]?.[_0x4ab35f(0x23b)](_0x55ea70=>_0x55ea70[_0x4ab35f(0x292)]==='agent')??![];if(_0x36bb86&&!_0x527c5f)return 0x1;if(!_0x36bb86&&_0x527c5f)return-0x1;return 0x0;});for(const _0x299ea7 of _0x362a33){_0x53603c=[];try{const _0x341ffc=_0x299ea7[_0xf0877f(0x20b)][_0xf0877f(0x199)]?.[_0xf0877f(0x1ad)](_0x11cef8=>{const _0x2151dc=_0xf0877f;if(_0x11cef8[_0x2151dc(0x292)]===_0x2151dc(0x1b5)&&_0x11cef8[_0x2151dc(0x26d)]){const _0x33ec18=parseRef(_0x11cef8[_0x2151dc(0x26d)]);return _0x33ec18?.[_0x2151dc(0x26a)]===_0x299ea7[_0x2151dc(0x20b)][_0x2151dc(0x26a)];}return![];})??[];if(_0x341ffc[_0xf0877f(0x1c5)]>0x0){const _0x4cc036='Agent\x20\x27'+_0x299ea7[_0xf0877f(0x20b)][_0xf0877f(0x26a)]+_0xf0877f(0x1af)+_0xf0877f(0x22e);this['logger'][_0xf0877f(0x25b)](_0x4cc036),_0x53603c[_0xf0877f(0x1d5)](_0x4cc036);}const _0x52fae6=await agentDefToRequest(_0x299ea7[_0xf0877f(0x20b)],_0x299ea7[_0xf0877f(0x1c0)],_0x299ea7[_0xf0877f(0x252)],_0x4f2e48),_0x165e9a=await this[_0xf0877f(0x1a0)][_0xf0877f(0x26b)](_0x52fae6);_0x106d51['set'](_0x299ea7[_0xf0877f(0x20b)][_0xf0877f(0x26a)],_0x165e9a['id']),_0x1afab4[_0xf0877f(0x258)][_0xf0877f(0x1d5)]({'agentName':_0x299ea7[_0xf0877f(0x20b)][_0xf0877f(0x26a)],'action':_0xf0877f(0x218),'agentId':_0x165e9a['id'],'warnings':_0x53603c['length']>0x0?_0x53603c:undefined}),_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x258)][_0xf0877f(0x218)]++;}catch(_0x5b047f){_0x1afab4['agents'][_0xf0877f(0x1d5)]({'agentName':_0x299ea7['yaml']['name'],'action':_0xf0877f(0x279),'error':_0x5b047f[_0xf0877f(0x196)],'warnings':_0x53603c[_0xf0877f(0x1c5)]>0x0?_0x53603c:undefined}),_0x1afab4['counts']['agents'][_0xf0877f(0x1de)]++;}}for(const _0x29f07b of _0x37b87c){try{const _0x544466=await yamlPromptToApi(_0x29f07b[_0xf0877f(0x20b)],_0x1f96a6,_0x4f2e48);if(!_0x544466){_0x1afab4[_0xf0877f(0x290)][_0xf0877f(0x1d5)]({'name':_0x29f07b['yaml']['name'],'action':'error','error':_0xf0877f(0x241)}),_0x1afab4[_0xf0877f(0x1a1)]['prompts'][_0xf0877f(0x1de)]++;continue;}const _0x3031fc=await this[_0xf0877f(0x1a0)][_0xf0877f(0x296)](_0x544466);_0x936f10[_0xf0877f(0x289)](_0x29f07b[_0xf0877f(0x20b)]['name'],_0x3031fc['id']),_0x1afab4[_0xf0877f(0x290)][_0xf0877f(0x1d5)]({'name':_0x29f07b[_0xf0877f(0x20b)]['name'],'action':_0xf0877f(0x218),'id':_0x3031fc['id']}),_0x1afab4['counts'][_0xf0877f(0x290)][_0xf0877f(0x218)]++;}catch(_0x245028){_0x1afab4[_0xf0877f(0x290)][_0xf0877f(0x1d5)]({'name':_0x29f07b['yaml'][_0xf0877f(0x26a)],'action':'error','error':_0x245028['message']}),_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x290)][_0xf0877f(0x1de)]++;}}for(const _0xb81df of _0x552f4f){try{const _0x165023=await yamlIntegrationToApi(_0xb81df[_0xf0877f(0x20b)],_0x1f96a6,_0x4f2e48),_0x15102f=await this['client']['createIntegration'](_0x165023);_0x1afab4[_0xf0877f(0x253)][_0xf0877f(0x1d5)]({'name':_0xb81df[_0xf0877f(0x20b)]['service_type'],'action':_0xf0877f(0x218),'id':_0x15102f['id']}),_0x1afab4['counts'][_0xf0877f(0x253)][_0xf0877f(0x218)]++;}catch(_0x214030){_0x1afab4[_0xf0877f(0x253)][_0xf0877f(0x1d5)]({'name':_0xb81df[_0xf0877f(0x20b)][_0xf0877f(0x222)],'action':_0xf0877f(0x279),'error':_0x214030[_0xf0877f(0x196)]}),_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x253)][_0xf0877f(0x1de)]++;}}for(const _0x594a96 of _0x3d6a2d){try{const _0x5c602b=await yamlFormInterfaceToApi(_0x594a96[_0xf0877f(0x20b)],_0x1f96a6,_0x4f2e48);if(!_0x5c602b){_0x1afab4['formInterfaces'][_0xf0877f(0x1d5)]({'name':_0x594a96[_0xf0877f(0x20b)][_0xf0877f(0x26a)],'action':_0xf0877f(0x279),'error':_0xf0877f(0x23c)}),_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x29d)]['errors']++;continue;}const _0x508d7e=await this[_0xf0877f(0x1a0)][_0xf0877f(0x1d4)](_0x5c602b);_0x1afab4[_0xf0877f(0x29d)]['push']({'name':_0x594a96[_0xf0877f(0x20b)]['name'],'action':_0xf0877f(0x218),'id':_0x508d7e['id']}),_0x1afab4['counts'][_0xf0877f(0x29d)][_0xf0877f(0x218)]++;}catch(_0x3d95a1){_0x1afab4[_0xf0877f(0x29d)][_0xf0877f(0x1d5)]({'name':_0x594a96[_0xf0877f(0x20b)][_0xf0877f(0x26a)],'action':'error','error':_0x3d95a1['message']}),_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x29d)][_0xf0877f(0x1de)]++;}}for(const _0x4ea477 of _0x33942a){try{const _0x3df074=await yamlChatInterfaceToApi(_0x4ea477[_0xf0877f(0x20b)],_0x1f96a6,_0x4f2e48),_0x130e9e=await this['client'][_0xf0877f(0x21f)](_0x3df074);_0x1afab4[_0xf0877f(0x250)][_0xf0877f(0x1d5)]({'name':_0x4ea477[_0xf0877f(0x20b)]['name'],'action':_0xf0877f(0x218),'id':_0x130e9e['id']}),_0x1afab4[_0xf0877f(0x1a1)][_0xf0877f(0x250)][_0xf0877f(0x218)]++;}catch(_0x5c6559){_0x1afab4['chatInterfaces'][_0xf0877f(0x1d5)]({'name':_0x4ea477[_0xf0877f(0x20b)]['name'],'action':_0xf0877f(0x279),'error':_0x5c6559[_0xf0877f(0x196)]}),_0x1afab4['counts'][_0xf0877f(0x250)][_0xf0877f(0x1de)]++;}}return _0x1afab4;}}
1
+ const a134_0x5ec437=a134_0x2de3;(function(_0x589373,_0x2e91e4){const _0x764bea=a134_0x2de3,_0x19d80d=_0x589373();while(!![]){try{const _0x269f0d=parseInt(_0x764bea(0x24d))/0x1*(parseInt(_0x764bea(0x1b4))/0x2)+parseInt(_0x764bea(0x242))/0x3+parseInt(_0x764bea(0x274))/0x4+-parseInt(_0x764bea(0x1bb))/0x5+-parseInt(_0x764bea(0x270))/0x6*(-parseInt(_0x764bea(0x221))/0x7)+-parseInt(_0x764bea(0x25d))/0x8*(-parseInt(_0x764bea(0x17f))/0x9)+-parseInt(_0x764bea(0x17e))/0xa;if(_0x269f0d===_0x2e91e4)break;else _0x19d80d['push'](_0x19d80d['shift']());}catch(_0x4e3887){_0x19d80d['push'](_0x19d80d['shift']());}}}(a134_0x13da,0xb1012));import{LLMApiClient}from'../client/llm-api-client.js';import*as a134_0x2f02d2 from'node:fs';import*as a134_0x591fe4 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{toModelInfos}from'./user-settings.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';function a134_0x13da(){const _0x470b6d=['message','listFormInterfaces','listExperimentalArtifacts','none','new','\x0a---\x20schema:\x20','Renamed\x20agent\x20folder:\x20','info','17547620MdiEdJ','681507hzSXPf','text','setDefaultAgent','_reasoning_','getOrCreateDefaultAgent','chatWelcomeMessage','parse','createAgentResponse','chat_generic','Project\x20not\x20found:\x20','pullProject','getChatLog','experimental_artifacts','prompts.json','toLowerCase','AGENT_NOT_FOUND','Renamed\x20chat\x20interface\x20file:\x20','renamed','\x0a\x0a#\x20agent.yml\x0a','mkdirSync','claude-4.5-sonnet','\x20---\x0a','\x0a---\x20code\x20---\x0a','integrations','isDirectory','slackMessageMode','createIntegration','\x27\x20(','integrations.json','startChat','createTextKnowledgeBase','promptId','warn','No\x20tdx.json\x20found\x20in\x20','basename','Removed\x20deleted\x20directory:\x20','site','projectId','llm_project','TextKnowledgeBase','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','ALREADY_EXISTS','history','pushProject','tdDatabaseName','imageGenerators','tdx_default_','agentId','dryRun','Multiple\x20agents\x20found\x20with\x20name\x20\x27','form_interfaces','length',')\x20can\x20be\x20pushed.\x20','104354ZMyUQB','models','pullAgent','cwd','signal','chatId','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','6860495wYrlYf','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','total','Project\x20\x22','actions','createWebSearchTool','Only\x20safe\x20types\x20(','listKnowledgeBases','modelType','already\x20exists','pushAgent','prompt.md','name','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','continueChat','attributes','status','getOrCreateDefaultProject','listTextKnowledgeBases','INVALID_ARGUMENT','starter_message.md','existsSync','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','files','createFormInterface','type','createKnowledgeBase','listImageGenerators','createExperimentalKnowledgeBase','template','tdx.json','minimal','Renamed\x20form\x20interface\x20file:\x20','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','readdirSync','error','createProject',')\x20can\x20be\x20cloned.','size','tdx_','Agent\x20reference\x20not\x20found','resolveAgentId','deleteAgent','(dry-run)','LLM_PROJECT_NOT_FOUND','errors','Backup\x20folder\x20not\x20found:\x20','updateKnowledgeBase','exportedFrom','medium','includes','---\x20schema:\x20','web_search','getUserSettings','split','map','getDefaultProjectName','knowledge_bases','deleteProject','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','Unresolved\x20dependencies:\x20','chatInfo','Unable\x20to\x20create\x20project\x20after\x20','agent','agents','high','Could\x20not\x20resolve\x20agent\x20reference','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','logger','listExperimentalKnowledgeBases','target','utf-8','sdk.llm','listToolTargets','conflict','.llm','Agent\x20\x27','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','agentsFull','starterMessage','writeFileSync','counts','backupProject','Renamed\x20prompt\x20file:\x20','isFile','profile','INTERNAL','version','chats','maxToolIterations','createExperimentalArtifact','currentProjectId','project','listAgents','\x20→\x20','---\x20file:\x20','join','resolveProjectId','chat_interfaces','prompts','readFileSync','.yml','14WXvNXR','add','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','some','restoreProject','Available\x20agents:\x20','Renamed\x20folder:\x20','service_type','experimentalArtifacts','PERMISSION_DENIED','tools','getAgent','formInterfaces','path','createImageGenerator','isDir','nameToId','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','dirname','file_name','code','listChatInterfaces','clearDefaultAgent','cloneProject','jsonSchemaHint','\x0a---\x20function:\x20','updateFormInterface','updateTextKnowledgeBase','unchanged','serviceType','deleteIntegration','push','Renamed\x20experimental\x20KB\x20directory:\x20','3135045SyyxhD','webSearchTools','listWebSearchTools','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.','listProjects','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','toISOString','updateExperimentalArtifact','updateAgent','outputs','1.0','2cZKQjT','stringify','#\x20prompt.md\x0a','agent.yml\x20not\x20found\x20in\x20','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','def','knowledgeBases','text_content','):\x20','listIntegrations','isManaged','created','dry-run-','endsWith','\x27.\x20This\x20should\x20not\x20happen.','systemPrompt','24hLSZtL','metadata','Agent\x20not\x20found:\x20','textKnowledgeBases','find','yaml','oldPath','experimentalKnowledgeBases','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','idToName','Renamed\x20integration\x20file:\x20','context','Skipping\x20integration\x20\x27','setCurrentProject','filter','tables','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','.md','get','3472656nMoHcP','has','\x22\x20already\x20exists','getBackupMetadata','5271124zqhYMA','NOT_FOUND','client','\x20attempts\x20due\x20to\x20name\x20conflicts.','code.js','set','Invalid\x20agent\x20reference\x20format:\x20','createAgent','Unsupported\x20backup\x20version:\x20','localeCompare','listPrompts','agent.yml','rmSync','Renamed\x20KB\x20file:\x20','chatIgnoreManagedActions','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','loadJsonFile','statSync','createPrompt','functions','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','listAgentsFull','json_schema.json','knowledgebases.json','variables','chatInterfaces','sort','json_schema','agents.json','starter_message','chat_agent_console','getProject','updated','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','chat','resolveProjectName','project.json','low'];a134_0x13da=function(){return _0x470b6d;};return a134_0x13da();}import{Logger}from'../../utils/logger/index.js';function a134_0x2de3(_0xbba90,_0x480be6){_0xbba90=_0xbba90-0x159;const _0x13dac4=a134_0x13da();let _0x2de32b=_0x13dac4[_0xbba90];return _0x2de32b;}export const SAFE_INTEGRATION_TYPES=[a134_0x5ec437(0x187),a134_0x5ec437(0x16e),'chat_parent_segment'];async function safeListOrEmpty(_0x4c5551){const _0x2ec974=a134_0x5ec437;try{return await _0x4c5551();}catch(_0x241c36){if(_0x241c36 instanceof HTTPClientError&&_0x241c36[_0x2ec974(0x1cb)]===0x194)return[];throw _0x241c36;}}export class LLMSDK{[a134_0x5ec437(0x216)];[a134_0x5ec437(0x276)];[a134_0x5ec437(0x268)];[a134_0x5ec437(0x1ff)]=Logger['of'](a134_0x5ec437(0x203));constructor(_0xcb73ce){const _0x4422ac=a134_0x5ec437;this['client']=new LLMApiClient(_0xcb73ce),this[_0x4422ac(0x268)]=_0xcb73ce;}[a134_0x5ec437(0x1f3)](){const _0x23f410=a134_0x5ec437,_0x1bab55=getSanitizedUsername();return _0x23f410(0x1ad)+_0x1bab55;}async[a134_0x5ec437(0x26a)](_0x32edb8){const _0x838833=a134_0x5ec437,{projectId:_0x45177a}=await this[_0x838833(0x173)](_0x32edb8);this['currentProjectId']=_0x45177a;}['getCurrentProject'](){return this['currentProjectId'];}async[a134_0x5ec437(0x181)](_0x18f7d6){const _0xc0d333=a134_0x5ec437,_0x3de942=this['context'][_0xc0d333(0x210)];let _0xaba9ee,_0x474389;if(_0x18f7d6[_0xc0d333(0x1ed)]('/')){const _0x1f145d=_0x18f7d6[_0xc0d333(0x1f1)]('/');if(_0x1f145d[_0xc0d333(0x1b2)]!==0x2)throw new SDKError(ErrorCode[_0xc0d333(0x1ce)],_0xc0d333(0x27a)+_0x18f7d6,undefined,{'helpText':_0xc0d333(0x1ba)});const [_0x3593f3,_0x4feeca]=_0x1f145d;_0xaba9ee=await this[_0xc0d333(0x21c)](_0x3593f3),_0x474389=_0x4feeca;}else _0xaba9ee=this[_0xc0d333(0x216)]||(await this[_0xc0d333(0x1cc)]())['id'],_0x474389=_0x18f7d6;const _0x389915=await this[_0xc0d333(0x1e4)](_0x474389,_0xaba9ee),_0x360fb4=await this[_0xc0d333(0x276)][_0xc0d333(0x22c)](_0x389915);writeCachedLLMAgent(_0x360fb4[_0xc0d333(0x1ca)][_0xc0d333(0x1c7)],_0x389915,_0xaba9ee,_0x3de942);}['getDefaultAgent'](){const _0x4798f4=a134_0x5ec437,_0x53717f=this[_0x4798f4(0x268)][_0x4798f4(0x210)];return readCachedLLMAgent(_0x53717f)||undefined;}[a134_0x5ec437(0x237)](){const _0xafd5a5=a134_0x5ec437,_0x416d98=this[_0xafd5a5(0x268)][_0xafd5a5(0x210)];clearCachedLLMAgent(_0x416d98);}async[a134_0x5ec437(0x1b5)](){const _0x684fd=a134_0x5ec437,_0xae9b03=await this['client'][_0x684fd(0x1f0)]();return toModelInfos(_0xae9b03);}async[a134_0x5ec437(0x1df)](_0x457d14){const _0x1d2dbd=a134_0x5ec437;return await this['client'][_0x1d2dbd(0x1df)](_0x457d14);}async[a134_0x5ec437(0x1f5)](_0x54e7f7){const _0x2bfdf6=a134_0x5ec437,{projectId:_0x331462}=await this[_0x2bfdf6(0x173)](_0x54e7f7);await this[_0x2bfdf6(0x276)][_0x2bfdf6(0x1f5)](_0x331462);}async['projects'](_0x587af0=0x32){const _0x4be010=a134_0x5ec437;return await this['client'][_0x4be010(0x246)](_0x587af0);}async['getOrCreateDefaultProject'](_0x434ea0){const _0x301055=a134_0x5ec437,_0x1fbb3f=_0x434ea0||this[_0x301055(0x1f3)](),_0x4eab88=this[_0x301055(0x268)][_0x301055(0x210)];if(!_0x434ea0){const _0x2cdb42=readCachedLLMProject(_0x4eab88);if(_0x2cdb42&&_0x2cdb42[_0x301055(0x1c7)]===_0x1fbb3f)try{const _0x43f26b=await this[_0x301055(0x276)][_0x301055(0x16f)](_0x2cdb42['id']);if(_0x43f26b['attributes']['name']===_0x1fbb3f)return _0x43f26b;}catch{}}const _0x4a0c89=await this['client'][_0x301055(0x246)](),_0x451c4d=_0x4a0c89[_0x301055(0x261)](_0x49548a=>_0x49548a[_0x301055(0x1ca)][_0x301055(0x1c7)]===_0x1fbb3f);if(_0x451c4d)return!_0x434ea0&&writeCachedLLMProject(_0x1fbb3f,_0x451c4d['id'],_0x4eab88),_0x451c4d;const _0x1167ca=await this[_0x301055(0x276)][_0x301055(0x1df)]({'name':_0x1fbb3f,'description':'Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20'+getSanitizedUsername()+')'});return!_0x434ea0&&writeCachedLLMProject(_0x1fbb3f,_0x1167ca['id'],_0x4eab88),_0x1167ca;}async['resolveProjectId'](_0x2976e9){const _0x2005b8=a134_0x5ec437,_0x4ec51c=await this[_0x2005b8(0x276)]['listProjects'](),_0xcddae2=_0x4ec51c['filter'](_0x47c5a3=>_0x47c5a3[_0x2005b8(0x1ca)][_0x2005b8(0x1c7)]===_0x2976e9);if(_0xcddae2[_0x2005b8(0x1b2)]===0x0)throw new SDKError(ErrorCode[_0x2005b8(0x1e7)],_0x2005b8(0x188)+_0x2976e9,undefined,{'helpText':_0x2005b8(0x1dc)});if(_0xcddae2[_0x2005b8(0x1b2)]>0x1)throw new SDKError(ErrorCode[_0x2005b8(0x211)],'Multiple\x20projects\x20found\x20with\x20name\x20\x27'+_0x2976e9+_0x2005b8(0x25b));return _0xcddae2[0x0]['id'];}async[a134_0x5ec437(0x173)](_0x358195){const _0x145367=a134_0x5ec437,_0x3f06da=await this[_0x145367(0x276)]['listProjects'](),_0x2c15e1=_0x3f06da[_0x145367(0x261)](_0x53aa58=>_0x53aa58['attributes'][_0x145367(0x1c7)]===_0x358195);if(_0x2c15e1)return{'projectId':_0x2c15e1['id'],'project':_0x2c15e1};throw new SDKError(ErrorCode[_0x145367(0x1e7)],_0x145367(0x188)+_0x358195,undefined,{'helpText':_0x145367(0x1dc)});}async[a134_0x5ec437(0x183)](_0xb23203=a134_0x5ec437(0x193),_0x283a3b=0x0,_0x42df3b){const _0x2ea816=a134_0x5ec437,_0x15672b=0xa;let _0x6f458b=0x0,_0x2b98e1;while(_0x6f458b<_0x15672b){try{const _0x2044b9=await this[_0x2ea816(0x1cc)](_0x2b98e1),_0x322294=_0x2044b9['id'],_0x3fceb7=[_0x2ea816(0x179),_0x2ea816(0x1da),_0x2ea816(0x175),_0x2ea816(0x1ec),_0x2ea816(0x1fc)],_0x3fc54b=_0x283a3b===0x0?_0x2ea816(0x1e2)+_0xb23203:_0x2ea816(0x1e2)+_0xb23203+_0x2ea816(0x182)+_0x3fceb7[_0x283a3b],_0x5d3f1e=await this[_0x2ea816(0x276)]['listAgents'](_0x322294),_0x2df64b=_0x5d3f1e[_0x2ea816(0x261)](_0x24e468=>_0x24e468['attributes'][_0x2ea816(0x1c7)]===_0x3fc54b);if(_0x2df64b)return _0x2df64b;const _0x1aa846=_0x283a3b>0x0?0x1:_0x42df3b;return await this[_0x2ea816(0x276)]['createAgent']({'name':_0x3fc54b,'projectId':_0x322294,'modelType':_0xb23203,'systemPrompt':'','temperature':_0x1aa846,'reasoningEffort':_0x283a3b>0x0?_0x283a3b:undefined});}catch(_0x1a2e23){if(_0x1a2e23 instanceof HTTPClientError){const _0x5a81e4=_0x1a2e23['status'];if(_0x5a81e4>=0x190&&_0x5a81e4<0x1f4){if(_0x5a81e4===0x191)throw new SDKError(ErrorCode['UNAUTHENTICATED'],_0x2ea816(0x251),_0x1a2e23);else{if(_0x5a81e4===0x193)throw new SDKError(ErrorCode[_0x2ea816(0x22a)],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x1a2e23);}throw _0x1a2e23;}}if(errorContains(_0x1a2e23,_0x2ea816(0x1c4),'duplicate',_0x2ea816(0x205))){_0x6f458b++;if(_0x6f458b>=_0x15672b)throw new SDKError(ErrorCode[_0x2ea816(0x1a8)],_0x2ea816(0x1f9)+_0x15672b+_0x2ea816(0x277),_0x1a2e23);const _0x5082e5=this[_0x2ea816(0x1f3)]();_0x2b98e1=_0x5082e5+'_'+generateRandomHex();continue;}throw _0x1a2e23;}}throw new SDKError(ErrorCode[_0x2ea816(0x211)],_0x2ea816(0x208));}async[a134_0x5ec437(0x1e4)](_0x52784b,_0x421298){const _0x4e2ffa=a134_0x5ec437,_0x4a0cc2=_0x421298||this[_0x4e2ffa(0x216)],_0x5d518f=await this[_0x4e2ffa(0x276)][_0x4e2ffa(0x218)](_0x4a0cc2),_0x5f2d5a=_0x5d518f['filter'](_0x4960ba=>_0x4960ba[_0x4e2ffa(0x1ca)][_0x4e2ffa(0x1c7)]===_0x52784b);if(_0x5f2d5a['length']===0x0){const _0x339a52=_0x4a0cc2?'\x20in\x20project\x20'+_0x4a0cc2:'';throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],'Agent\x20not\x20found:\x20'+_0x52784b+_0x339a52,undefined,{'helpText':_0x4a0cc2?_0x4e2ffa(0x232):_0x4e2ffa(0x245)});}if(_0x5f2d5a[_0x4e2ffa(0x1b2)]>0x1)throw new SDKError(ErrorCode[_0x4e2ffa(0x211)],_0x4e2ffa(0x1b0)+_0x52784b+'\x27.\x20This\x20should\x20not\x20happen.');return _0x5f2d5a[0x0]['id'];}async['agents'](_0x63c254){const _0x361e66=a134_0x5ec437,_0x2c384e=_0x63c254||this[_0x361e66(0x216)];return await this[_0x361e66(0x276)]['listAgents'](_0x2c384e);}async[a134_0x5ec437(0x209)](_0x5dc2bd){const _0x542c79=a134_0x5ec437;return await this['client'][_0x542c79(0x165)](_0x5dc2bd);}async['agent'](_0x28c790){const _0x573d11=a134_0x5ec437;return await this['client'][_0x573d11(0x22c)](_0x28c790);}async[a134_0x5ec437(0x27b)](_0x238589){const _0x27d7e8=a134_0x5ec437;return await this[_0x27d7e8(0x276)]['createAgent'](_0x238589);}async[a134_0x5ec437(0x24a)](_0x42dc28,_0x4e0eb8){const _0x57ff0e=a134_0x5ec437;return await this[_0x57ff0e(0x276)][_0x57ff0e(0x24a)](_0x42dc28,_0x4e0eb8);}async[a134_0x5ec437(0x1e5)](_0x18d7cb){const _0x580080=a134_0x5ec437;await this[_0x580080(0x276)]['deleteAgent'](_0x18d7cb);}async[a134_0x5ec437(0x19c)](_0x387216){const _0x5586fc=a134_0x5ec437;return await this[_0x5586fc(0x276)]['startChat']({'agentId':_0x387216});}async*[a134_0x5ec437(0x172)](_0x3b62c8,_0x24efaf){const _0x224e0e=a134_0x5ec437;let _0x27ad2b=_0x24efaf?.[_0x224e0e(0x1b9)];const _0x58e5fd=_0x24efaf?.[_0x224e0e(0x1ae)];if(!_0x27ad2b){if(!_0x58e5fd)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x4427e1=await this[_0x224e0e(0x276)][_0x224e0e(0x19c)]({'agentId':_0x58e5fd});_0x27ad2b=_0x4427e1['id'],yield{'type':_0x224e0e(0x25e),'data':{'chatId':_0x27ad2b,'agentId':_0x58e5fd,'projectId':_0x4427e1[_0x224e0e(0x1ca)][_0x224e0e(0x1a4)]}};}for await(const _0x5687a6 of this['client'][_0x224e0e(0x1c9)](_0x27ad2b,_0x3b62c8,_0x24efaf?.[_0x224e0e(0x1b8)])){yield{'type':'event','data':_0x5687a6};}}async[a134_0x5ec437(0x213)](_0x10b9d9=0x32){return await this['client']['listChats'](_0x10b9d9);}async[a134_0x5ec437(0x1a9)](_0xb17056){const _0x3a98c9=a134_0x5ec437;return await this[_0x3a98c9(0x276)]['getChatHistory'](_0xb17056);}async[a134_0x5ec437(0x18a)](_0x447312){const _0x262c2b=a134_0x5ec437;return await this[_0x262c2b(0x276)][_0x262c2b(0x18a)](_0x447312);}async[a134_0x5ec437(0x1f8)](_0xfd8ff2){return await this['client']['getChatInfo'](_0xfd8ff2);}async[a134_0x5ec437(0x20d)](_0xbc93a1,_0x3aaa56,_0x24a38d){const _0x34daae=a134_0x5ec437,_0x335062=_0x24a38d?.[_0x34daae(0x1af)]??![],{projectId:_0x3264fe,project:_0x799962}=await this[_0x34daae(0x173)](_0xbc93a1),_0x2ecd5a=_0x799962['attributes'][_0x34daae(0x1c7)],_0x394b36=_0x3aaa56||_0x2ecd5a+_0x34daae(0x206);if(a134_0x2f02d2['existsSync'](_0x394b36)&&!_0x335062)throw new SDKError(ErrorCode[_0x34daae(0x1a8)],'Output\x20directory\x20already\x20exists:\x20'+_0x394b36,undefined,{'helpText':_0x34daae(0x1c8)});const _0x25d3cd=await this['client'][_0x34daae(0x165)](_0x3264fe),_0x5868de=await this[_0x34daae(0x276)][_0x34daae(0x1c2)](_0x3264fe),_0x159a08=await this[_0x34daae(0x276)]['listPrompts'](_0x3264fe),_0x3f17ea=await this[_0x34daae(0x276)][_0x34daae(0x256)](_0x3264fe);if(!_0x335062){a134_0x2f02d2[_0x34daae(0x192)](_0x394b36,{'recursive':!![]});const _0xc9b682={'version':_0x34daae(0x24c),'exportedAt':new Date()[_0x34daae(0x248)](),'exportedFrom':{'site':this['context'][_0x34daae(0x1a3)],'projectId':_0x3264fe,'projectName':_0x2ecd5a},'project':_0x799962};a134_0x2f02d2[_0x34daae(0x20b)](a134_0x591fe4['join'](_0x394b36,_0x34daae(0x174)),JSON[_0x34daae(0x24e)](_0xc9b682,null,0x2)),a134_0x2f02d2['writeFileSync'](a134_0x591fe4[_0x34daae(0x21b)](_0x394b36,_0x34daae(0x16c)),JSON[_0x34daae(0x24e)](_0x25d3cd,null,0x2)),a134_0x2f02d2['writeFileSync'](a134_0x591fe4[_0x34daae(0x21b)](_0x394b36,_0x34daae(0x167)),JSON[_0x34daae(0x24e)](_0x5868de,null,0x2)),a134_0x2f02d2[_0x34daae(0x20b)](a134_0x591fe4[_0x34daae(0x21b)](_0x394b36,_0x34daae(0x18c)),JSON['stringify'](_0x159a08,null,0x2)),a134_0x2f02d2[_0x34daae(0x20b)](a134_0x591fe4[_0x34daae(0x21b)](_0x394b36,'integrations.json'),JSON[_0x34daae(0x24e)](_0x3f17ea,null,0x2));}return{'projectName':_0x2ecd5a,'outputDir':_0x394b36,'counts':{'agents':_0x25d3cd[_0x34daae(0x1b2)],'knowledgeBases':_0x5868de[_0x34daae(0x1b2)],'prompts':_0x159a08[_0x34daae(0x1b2)],'integrations':_0x3f17ea[_0x34daae(0x1b2)]}};}async[a134_0x5ec437(0x225)](_0x4cd972,_0x1731fa){const _0x5af096=a134_0x5ec437,_0x3e486f=_0x1731fa?.[_0x5af096(0x1af)]??![],_0x2bbd6d=this[_0x5af096(0x273)](_0x4cd972),_0x46a1c0=_0x2bbd6d[_0x5af096(0x1eb)]['site'],_0x306502=this[_0x5af096(0x268)][_0x5af096(0x1a3)],_0x5ca251=_0x46a1c0!==_0x306502?_0x46a1c0:undefined,_0x768cfa=this['loadJsonFile'](a134_0x591fe4['join'](_0x4cd972,_0x5af096(0x16c)),[]),_0x31926c=this[_0x5af096(0x160)](a134_0x591fe4['join'](_0x4cd972,_0x5af096(0x167)),[]),_0x3d8867=this[_0x5af096(0x160)](a134_0x591fe4[_0x5af096(0x21b)](_0x4cd972,_0x5af096(0x18c)),[]),_0x40acbc=this[_0x5af096(0x160)](a134_0x591fe4[_0x5af096(0x21b)](_0x4cd972,_0x5af096(0x19b)),[]),_0x220ef8=_0x1731fa?.['name']||_0x2bbd6d['exportedFrom']['projectName'];if(_0x3e486f){const _0x158a68=new Map(),_0x1d1325=[..._0x768cfa],_0x29d63c=_0x768cfa[_0x5af096(0x1b2)]+0x1;let _0x1ab954=0x0;while(_0x1d1325[_0x5af096(0x1b2)]>0x0&&_0x1ab954<_0x29d63c){_0x1ab954++;const _0x5ecee9=[];for(const _0x49ce6e of _0x1d1325){canCreateAgent(_0x49ce6e,_0x158a68)?_0x158a68[_0x5af096(0x279)](_0x49ce6e['id'],_0x5af096(0x259)+_0x49ce6e['id']):_0x5ecee9['push'](_0x49ce6e);}if(_0x5ecee9[_0x5af096(0x1b2)]===_0x1d1325[_0x5af096(0x1b2)])throw new SDKError(ErrorCode[_0x5af096(0x211)],_0x5af096(0x1d1),undefined,{'helpText':_0x5af096(0x171)});_0x1d1325['length']=0x0,_0x1d1325[_0x5af096(0x240)](..._0x5ecee9);}const _0x2234a2=_0x3d8867[_0x5af096(0x26b)](_0x3b512f=>_0x158a68['has'](_0x3b512f['attributes']['agentId']))[_0x5af096(0x1b2)];return{'projectName':_0x220ef8,'projectId':_0x5af096(0x1e6),'counts':{'agents':_0x768cfa['length'],'knowledgeBases':_0x31926c[_0x5af096(0x1b2)],'prompts':_0x2234a2,'integrations':_0x40acbc[_0x5af096(0x1b2)]},'sourceSite':_0x5ca251};}const _0x28975f=await this[_0x5af096(0x276)][_0x5af096(0x1df)]({'name':_0x220ef8,'description':_0x2bbd6d[_0x5af096(0x217)][_0x5af096(0x1ca)]['description']}),_0x5c2b69=_0x28975f['id'],_0x239a2d=new Map(),_0x10fff2=new Map(),_0x3fb68c=new Map();for(const _0x493213 of _0x31926c){const _0x4ecba6=await this[_0x5af096(0x276)][_0x5af096(0x1d5)]({'projectId':_0x5c2b69,'name':_0x493213[_0x5af096(0x1ca)][_0x5af096(0x1c7)],'tdDatabaseName':_0x493213[_0x5af096(0x1ca)][_0x5af096(0x1ab)],'tables':_0x493213[_0x5af096(0x1ca)][_0x5af096(0x26c)]});_0x239a2d['set'](_0x493213['id'],_0x4ecba6['id']);}const _0xc46486=[..._0x768cfa],_0xf51ad6=_0x768cfa['length']+0x1;let _0x10b985=0x0;while(_0xc46486[_0x5af096(0x1b2)]>0x0&&_0x10b985<_0xf51ad6){_0x10b985++;const _0x3731e1=[];for(const _0x14f826 of _0xc46486){if(canCreateAgent(_0x14f826,_0x10fff2)){const _0xaaaaf1=remapToolIds(_0x14f826[_0x5af096(0x1ca)][_0x5af096(0x22b)],_0x239a2d,_0x10fff2),_0x53216b=remapVariableIds(_0x14f826[_0x5af096(0x1ca)]['variables'],_0x239a2d),_0x173648=await this[_0x5af096(0x276)][_0x5af096(0x186)]({'name':_0x14f826[_0x5af096(0x1ca)]['name'],'projectId':_0x5c2b69,'systemPrompt':_0x14f826[_0x5af096(0x1ca)][_0x5af096(0x25c)],'starterMessage':_0x14f826[_0x5af096(0x1ca)][_0x5af096(0x20a)],'modelType':migrateModelType(_0x14f826[_0x5af096(0x1ca)][_0x5af096(0x1c3)]),'maxToolIterations':_0x14f826['attributes'][_0x5af096(0x214)],'temperature':_0x14f826[_0x5af096(0x1ca)]['temperature'],'reasoningEffort':_0x14f826[_0x5af096(0x1ca)]['reasoningEffort'],'outputs':_0x14f826['attributes'][_0x5af096(0x24b)],'tools':_0xaaaaf1,'variables':_0x53216b});_0x10fff2[_0x5af096(0x279)](_0x14f826['id'],_0x173648['id']);}else _0x3731e1[_0x5af096(0x240)](_0x14f826);}if(_0x3731e1[_0x5af096(0x1b2)]===_0xc46486[_0x5af096(0x1b2)])throw new SDKError(ErrorCode[_0x5af096(0x211)],_0x5af096(0x1d1),undefined,{'helpText':_0x5af096(0x171)});_0xc46486['length']=0x0,_0xc46486[_0x5af096(0x240)](..._0x3731e1);}for(const _0x2184d4 of _0x3d8867){const _0x39ac21=_0x10fff2[_0x5af096(0x26f)](_0x2184d4[_0x5af096(0x1ca)][_0x5af096(0x1ae)]);if(!_0x39ac21)continue;const _0x3c254a=await this[_0x5af096(0x276)][_0x5af096(0x162)]({'projectId':_0x5c2b69,'agentId':_0x39ac21,'name':_0x2184d4['attributes']['name'],'systemPrompt':_0x2184d4[_0x5af096(0x1ca)][_0x5af096(0x25c)],'template':_0x2184d4[_0x5af096(0x1ca)][_0x5af096(0x1d8)],'jsonSchemaHint':_0x2184d4[_0x5af096(0x1ca)][_0x5af096(0x239)]});_0x3fb68c[_0x5af096(0x279)](_0x2184d4['id'],_0x3c254a['id']);}for(const _0x2ee5ac of _0x40acbc){const _0x2c25d0=_0x2ee5ac[_0x5af096(0x1ca)][_0x5af096(0x1bf)]['map'](_0x1282a5=>({..._0x1282a5,'promptId':_0x3fb68c['get'](_0x1282a5[_0x5af096(0x19e)])||_0x1282a5[_0x5af096(0x19e)]}));await this['client']['createIntegration']({'projectId':_0x5c2b69,'serviceType':_0x2ee5ac['attributes'][_0x5af096(0x23e)],'actions':_0x2c25d0,'slackMessageMode':_0x2ee5ac[_0x5af096(0x1ca)][_0x5af096(0x198)],'chatIgnoreManagedActions':_0x2ee5ac[_0x5af096(0x1ca)][_0x5af096(0x15e)],'chatWelcomeMessage':_0x2ee5ac[_0x5af096(0x1ca)][_0x5af096(0x184)],'webhookCorsOrigins':_0x2ee5ac[_0x5af096(0x1ca)]['webhookCorsOrigins']});}return{'projectName':_0x220ef8,'projectId':_0x5c2b69,'counts':{'agents':_0x10fff2[_0x5af096(0x1e1)],'knowledgeBases':_0x239a2d[_0x5af096(0x1e1)],'prompts':_0x3fb68c[_0x5af096(0x1e1)],'integrations':_0x40acbc['length']},'sourceSite':_0x5ca251};}[a134_0x5ec437(0x160)](_0x34c839,_0x445c53){const _0x138389=a134_0x5ec437;if(!a134_0x2f02d2[_0x138389(0x1d0)](_0x34c839))return _0x445c53;return JSON[_0x138389(0x185)](a134_0x2f02d2[_0x138389(0x21f)](_0x34c839,'utf-8'));}[a134_0x5ec437(0x273)](_0x2ac813){const _0x19c010=a134_0x5ec437;if(!a134_0x2f02d2[_0x19c010(0x1d0)](_0x2ac813))throw new SDKError(ErrorCode[_0x19c010(0x275)],_0x19c010(0x1e9)+_0x2ac813,undefined,{'helpText':_0x19c010(0x247)});const _0x455d54=a134_0x591fe4[_0x19c010(0x21b)](_0x2ac813,_0x19c010(0x174));if(!a134_0x2f02d2[_0x19c010(0x1d0)](_0x455d54))throw new SDKError(ErrorCode[_0x19c010(0x1ce)],_0x19c010(0x223)+_0x2ac813,undefined,{'helpText':_0x19c010(0x265)});const _0x54b1fa=JSON[_0x19c010(0x185)](a134_0x2f02d2['readFileSync'](_0x455d54,_0x19c010(0x202)));if(!isSupportedBackupVersion(_0x54b1fa[_0x19c010(0x212)]))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x19c010(0x27c)+_0x54b1fa[_0x19c010(0x212)],undefined,{'helpText':_0x19c010(0x26d)});return _0x54b1fa;}async[a134_0x5ec437(0x189)](_0x2ff3ba,_0x565f57,_0xfa2d1e){const _0x362963=a134_0x5ec437,{projectId:_0xd72561,project:_0x46530d}=await this[_0x362963(0x173)](_0x2ff3ba),_0x1ba0d4=_0x46530d[_0x362963(0x1ca)][_0x362963(0x1c7)];let _0x2cdb00;if(_0x565f57)_0x2cdb00=_0x565f57;else{const _0x386749=a134_0x591fe4[_0x362963(0x21b)](process['cwd'](),'agents'),_0x45aed7=getSanitizedPathWithMigration(_0x386749,_0x1ba0d4);_0x45aed7[_0x362963(0x190)]&&this[_0x362963(0x1ff)][_0x362963(0x17d)](_0x362963(0x227)+a134_0x591fe4['basename'](_0x45aed7[_0x362963(0x263)])+'\x20→\x20'+a134_0x591fe4[_0x362963(0x1a1)](_0x45aed7[_0x362963(0x22e)])),_0x2cdb00=_0x45aed7['path'];}const _0x336736=await this[_0x362963(0x276)]['listAgentsFull'](_0xd72561),_0x51c959=await this[_0x362963(0x276)][_0x362963(0x1c2)](_0xd72561),_0x444cce=await this[_0x362963(0x276)][_0x362963(0x1cd)](_0xd72561),_0x4c6712=await safeListOrEmpty(()=>this['client'][_0x362963(0x1d6)](_0xd72561)),_0x46d1e6=await safeListOrEmpty(()=>this['client'][_0x362963(0x244)](_0xd72561)),_0x3539d6=await this['client']['listPrompts'](_0xd72561),_0x50ffbf=await this[_0x362963(0x276)][_0x362963(0x256)](_0xd72561),_0xbb3291=await safeListOrEmpty(()=>this[_0x362963(0x276)]['listExperimentalKnowledgeBases'](_0xd72561)),_0x4fbd37=await safeListOrEmpty(()=>this[_0x362963(0x276)][_0x362963(0x178)](_0xd72561)),_0x45b6a0=await safeListOrEmpty(()=>this['client'][_0x362963(0x177)](_0xd72561)),_0x19406f=await safeListOrEmpty(()=>this[_0x362963(0x276)][_0x362963(0x236)](_0xd72561)),_0x5b08c1=_0x50ffbf[_0x362963(0x26b)](_0x16c3f0=>!_0x16c3f0['attributes'][_0x362963(0x257)]&&SAFE_INTEGRATION_TYPES[_0x362963(0x1ed)](_0x16c3f0['attributes'][_0x362963(0x23e)][_0x362963(0x18d)]())),_0x45dfae=new Map(),_0x485c1d=new Map(),_0x35715d=new Map(),_0x3b035f=new Map(),_0x412afa=new Map(),_0x541aa3=new Map(),_0x5d70ea=new Map();for(const _0xf1f2fa of _0x336736){_0x45dfae[_0x362963(0x279)](_0xf1f2fa['id'],_0xf1f2fa[_0x362963(0x1ca)][_0x362963(0x1c7)]);}for(const _0x359e2c of _0x51c959){_0x485c1d[_0x362963(0x279)](_0x359e2c['id'],_0x359e2c[_0x362963(0x1ca)]['name']);}for(const _0x2e5bbe of _0x444cce){_0x35715d[_0x362963(0x279)](_0x2e5bbe['id'],_0x2e5bbe[_0x362963(0x1ca)][_0x362963(0x1c7)]);}for(const _0x529e01 of _0x4c6712){_0x3b035f[_0x362963(0x279)](_0x529e01['id'],_0x529e01[_0x362963(0x1ca)][_0x362963(0x1c7)]);}for(const _0x82aeb9 of _0x46d1e6){_0x412afa['set'](_0x82aeb9['id'],_0x82aeb9[_0x362963(0x1ca)][_0x362963(0x1c7)]);}for(const _0x2b8457 of _0x3539d6){_0x541aa3['set'](_0x2b8457['id'],_0x2b8457['attributes'][_0x362963(0x1c7)]);}for(const _0x5c1085 of _0xbb3291){_0x5d70ea[_0x362963(0x279)](_0x5c1085['id'],_0x5c1085[_0x362963(0x1ca)][_0x362963(0x1c7)]);}const _0x2bb10c={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x485c1d,'TextKnowledgeBase':_0x35715d,'Agent':_0x45dfae,'WebSearchTool':_0x412afa,'ImageGenerator':_0x3b035f,'ExperimentalKnowledgeBase':_0x5d70ea}),'resolvePromptName':async _0x3b9fb9=>_0x541aa3['get'](_0x3b9fb9),'onWarning':_0x57b1e7=>this['logger'][_0x362963(0x19f)](_0x57b1e7)},_0x448873={'projectName':_0x1ba0d4,'outputDir':_0x2cdb00,'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}}},_0x13fe81=[],_0x5c12e0=[];for(const _0x5b9aab of _0x336736){const _0x4a347d=getSanitizedPathWithMigration(_0x2cdb00,_0x5b9aab['attributes'][_0x362963(0x1c7)]);_0x4a347d['renamed']&&this[_0x362963(0x1ff)]['info'](_0x362963(0x17c)+a134_0x591fe4[_0x362963(0x1a1)](_0x4a347d['oldPath'])+_0x362963(0x219)+a134_0x591fe4[_0x362963(0x1a1)](_0x4a347d['path']));const _0x180a8d=_0x4a347d[_0x362963(0x22e)],_0x12c99c=a134_0x591fe4[_0x362963(0x21b)](_0x180a8d,_0x362963(0x1c6)),_0x1e9a06=a134_0x591fe4['join'](_0x180a8d,'agent.yml'),_0x3d9763=a134_0x591fe4[_0x362963(0x21b)](_0x180a8d,'starter_message.md'),{yaml:_0x58dca8,systemPrompt:_0x289e71,starterMessage:_0x4b4e69}=await agentResponseToDef(_0x5b9aab,_0x2bb10c),_0x4be093=toAgentYamlString(_0x58dca8),_0x22a41d=!a134_0x2f02d2[_0x362963(0x1d0)](_0x1e9a06);let _0x480b8a=_0x22a41d,_0x4619d7;if(!_0x22a41d){const _0x366a40=a134_0x2f02d2['existsSync'](_0x12c99c)?a134_0x2f02d2[_0x362963(0x21f)](_0x12c99c,'utf-8'):'',_0x26048c=a134_0x2f02d2[_0x362963(0x21f)](_0x1e9a06,'utf-8'),_0xbe9000=_0x362963(0x24f)+_0x366a40+_0x362963(0x191)+_0x26048c,_0x3486da=_0x362963(0x24f)+_0x289e71+_0x362963(0x191)+_0x4be093,_0x595b37=generateDiff(_0xbe9000,_0x3486da);_0x480b8a=hasChanges(_0x595b37),_0x480b8a&&(_0x4619d7=formatDiffWithColors(_0x595b37));}_0x13fe81[_0x362963(0x240)]({'path':_0x180a8d,'content':'','isDir':!![]}),_0x13fe81[_0x362963(0x240)]({'path':_0x12c99c,'content':_0x289e71}),_0x13fe81['push']({'path':_0x1e9a06,'content':_0x4be093});_0x4b4e69&&_0x4b4e69[_0x362963(0x1ed)]('\x0a')&&_0x13fe81[_0x362963(0x240)]({'path':_0x3d9763,'content':_0x4b4e69});_0x448873[_0x362963(0x1fb)][_0x362963(0x240)]({'agentName':_0x5b9aab[_0x362963(0x1ca)][_0x362963(0x1c7)],'outputPath':_0x180a8d,'isNew':_0x22a41d,'hasChanges':_0x480b8a,'diff':_0x4619d7}),_0x448873['counts']['agents']['total']++;if(_0x22a41d)_0x448873[_0x362963(0x20c)][_0x362963(0x1fb)][_0x362963(0x17a)]++;else{if(_0x480b8a)_0x448873[_0x362963(0x20c)]['agents']['updated']++;else _0x448873[_0x362963(0x20c)][_0x362963(0x1fb)]['unchanged']++;}}for(const _0x493121 of _0x51c959){if(_0x493121['attributes'][_0x362963(0x257)])continue;const _0x2148a2=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x2cdb00),_0x493121[_0x362963(0x1ca)]['name'],'.yml');_0x2148a2['renamed']&&this[_0x362963(0x1ff)][_0x362963(0x17d)](_0x362963(0x15d)+a134_0x591fe4[_0x362963(0x1a1)](_0x2148a2[_0x362963(0x263)])+_0x362963(0x219)+a134_0x591fe4[_0x362963(0x1a1)](_0x2148a2[_0x362963(0x22e)]));const _0x321f99=_0x2148a2[_0x362963(0x22e)],_0x2506f4=apiKnowledgeBaseToYaml(_0x493121),_0x586b72=toKnowledgeBaseYamlString(_0x2506f4),_0x340adc=!a134_0x2f02d2['existsSync'](_0x321f99);let _0xd3e90d=_0x340adc,_0x1de90e;if(!_0x340adc){const _0x258f97=a134_0x2f02d2[_0x362963(0x21f)](_0x321f99,_0x362963(0x202)),_0x4e3820=generateDiff(_0x258f97,_0x586b72);_0xd3e90d=hasChanges(_0x4e3820),_0xd3e90d&&(_0x1de90e=formatDiffWithColors(_0x4e3820));}_0x13fe81[_0x362963(0x240)]({'path':_0x321f99,'content':_0x586b72}),_0x448873[_0x362963(0x253)]['push']({'name':_0x493121[_0x362963(0x1ca)][_0x362963(0x1c7)],'outputPath':_0x321f99,'isNew':_0x340adc,'hasChanges':_0xd3e90d,'diff':_0x1de90e}),_0x448873[_0x362963(0x20c)][_0x362963(0x253)][_0x362963(0x1bd)]++;if(_0x340adc)_0x448873[_0x362963(0x20c)][_0x362963(0x253)]['new']++;else{if(_0xd3e90d)_0x448873[_0x362963(0x20c)][_0x362963(0x253)][_0x362963(0x170)]++;else _0x448873[_0x362963(0x20c)][_0x362963(0x253)][_0x362963(0x23d)]++;}}for(const _0x4a2e03 of _0x444cce){if(_0x4a2e03[_0x362963(0x1ca)][_0x362963(0x257)])continue;const _0x3e1fd8=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x2cdb00),_0x4a2e03[_0x362963(0x1ca)][_0x362963(0x1c7)],_0x362963(0x26e));_0x3e1fd8['renamed']&&this[_0x362963(0x1ff)][_0x362963(0x17d)]('Renamed\x20text\x20KB\x20file:\x20'+a134_0x591fe4[_0x362963(0x1a1)](_0x3e1fd8['oldPath'])+'\x20→\x20'+a134_0x591fe4['basename'](_0x3e1fd8['path']));const _0x2c06fb=_0x3e1fd8[_0x362963(0x22e)],_0x4655ab=toTextKnowledgeBaseMd(_0x4a2e03[_0x362963(0x1ca)][_0x362963(0x1c7)],_0x4a2e03[_0x362963(0x1ca)][_0x362963(0x180)]),_0x26b74e=!a134_0x2f02d2[_0x362963(0x1d0)](_0x2c06fb);let _0x301210=_0x26b74e,_0x2442c8;if(!_0x26b74e){const _0x3a3ece=a134_0x2f02d2[_0x362963(0x21f)](_0x2c06fb,_0x362963(0x202)),_0x5467db=generateDiff(_0x3a3ece,_0x4655ab);_0x301210=hasChanges(_0x5467db),_0x301210&&(_0x2442c8=formatDiffWithColors(_0x5467db));}_0x13fe81['push']({'path':_0x2c06fb,'content':_0x4655ab}),_0x448873[_0x362963(0x260)][_0x362963(0x240)]({'name':_0x4a2e03[_0x362963(0x1ca)]['name'],'outputPath':_0x2c06fb,'isNew':_0x26b74e,'hasChanges':_0x301210,'diff':_0x2442c8}),_0x448873[_0x362963(0x20c)][_0x362963(0x260)][_0x362963(0x1bd)]++;if(_0x26b74e)_0x448873['counts'][_0x362963(0x260)][_0x362963(0x17a)]++;else{if(_0x301210)_0x448873[_0x362963(0x20c)][_0x362963(0x260)][_0x362963(0x170)]++;else _0x448873['counts']['textKnowledgeBases'][_0x362963(0x23d)]++;}}for(const _0x1dd3a9 of _0x3539d6){if(_0x1dd3a9['attributes'][_0x362963(0x257)])continue;const _0x4d2f25=getSanitizedPathWithMigration(getPromptsDir(_0x2cdb00),_0x1dd3a9[_0x362963(0x1ca)]['name'],_0x362963(0x220));_0x4d2f25['renamed']&&this[_0x362963(0x1ff)][_0x362963(0x17d)](_0x362963(0x20e)+a134_0x591fe4['basename'](_0x4d2f25[_0x362963(0x263)])+_0x362963(0x219)+a134_0x591fe4[_0x362963(0x1a1)](_0x4d2f25['path']));const _0xe2897=_0x4d2f25['path'],_0x1e0867=await apiPromptToYaml(_0x1dd3a9,_0x2bb10c);if(!_0x1e0867)continue;const _0x4f1b8b=toPromptYamlString(_0x1e0867),_0x262508=!a134_0x2f02d2['existsSync'](_0xe2897);let _0x3d6e44=_0x262508,_0x1e7634;if(!_0x262508){const _0x47aef9=a134_0x2f02d2[_0x362963(0x21f)](_0xe2897,_0x362963(0x202)),_0x42bc01=generateDiff(_0x47aef9,_0x4f1b8b);_0x3d6e44=hasChanges(_0x42bc01),_0x3d6e44&&(_0x1e7634=formatDiffWithColors(_0x42bc01));}_0x13fe81[_0x362963(0x240)]({'path':_0xe2897,'content':_0x4f1b8b}),_0x448873[_0x362963(0x21e)][_0x362963(0x240)]({'name':_0x1dd3a9['attributes']['name'],'outputPath':_0xe2897,'isNew':_0x262508,'hasChanges':_0x3d6e44,'diff':_0x1e7634}),_0x448873['counts'][_0x362963(0x21e)][_0x362963(0x1bd)]++;if(_0x262508)_0x448873[_0x362963(0x20c)][_0x362963(0x21e)]['new']++;else{if(_0x3d6e44)_0x448873['counts'][_0x362963(0x21e)][_0x362963(0x170)]++;else _0x448873['counts'][_0x362963(0x21e)][_0x362963(0x23d)]++;}}for(const _0x2ef1f8 of _0x5b08c1){const _0x17c4dc=_0x2ef1f8[_0x362963(0x1ca)][_0x362963(0x23e)][_0x362963(0x18d)](),_0x5b1c6d=getSanitizedPathWithMigration(getIntegrationsDir(_0x2cdb00),_0x17c4dc,_0x362963(0x220));_0x5b1c6d[_0x362963(0x190)]&&this['logger'][_0x362963(0x17d)](_0x362963(0x267)+a134_0x591fe4[_0x362963(0x1a1)](_0x5b1c6d[_0x362963(0x263)])+'\x20→\x20'+a134_0x591fe4[_0x362963(0x1a1)](_0x5b1c6d[_0x362963(0x22e)]));const _0x3526c4=_0x5b1c6d[_0x362963(0x22e)],_0x485664=await apiIntegrationToYaml(_0x2ef1f8,_0x2bb10c),_0x417ae5=toIntegrationYamlString(_0x485664),_0x575815=!a134_0x2f02d2[_0x362963(0x1d0)](_0x3526c4);let _0x18c04c=_0x575815,_0x36abdc;if(!_0x575815){const _0x191214=a134_0x2f02d2[_0x362963(0x21f)](_0x3526c4,_0x362963(0x202)),_0x5f5be1=generateDiff(_0x191214,_0x417ae5);_0x18c04c=hasChanges(_0x5f5be1),_0x18c04c&&(_0x36abdc=formatDiffWithColors(_0x5f5be1));}_0x13fe81[_0x362963(0x240)]({'path':_0x3526c4,'content':_0x417ae5}),_0x448873[_0x362963(0x196)]['push']({'name':_0x17c4dc,'outputPath':_0x3526c4,'isNew':_0x575815,'hasChanges':_0x18c04c,'diff':_0x36abdc}),_0x448873[_0x362963(0x20c)][_0x362963(0x196)][_0x362963(0x1bd)]++;if(_0x575815)_0x448873[_0x362963(0x20c)][_0x362963(0x196)][_0x362963(0x17a)]++;else{if(_0x18c04c)_0x448873[_0x362963(0x20c)][_0x362963(0x196)][_0x362963(0x170)]++;else _0x448873[_0x362963(0x20c)][_0x362963(0x196)][_0x362963(0x23d)]++;}}for(const _0x144111 of _0xbb3291){if(_0x144111[_0x362963(0x1ca)][_0x362963(0x257)])continue;const _0xaa0800=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x2cdb00),_0x144111['attributes']['name']);_0xaa0800[_0x362963(0x190)]&&this['logger'][_0x362963(0x17d)](_0x362963(0x241)+a134_0x591fe4[_0x362963(0x1a1)](_0xaa0800[_0x362963(0x263)])+'\x20→\x20'+a134_0x591fe4[_0x362963(0x1a1)](_0xaa0800[_0x362963(0x22e)]));const _0x522a74=_0xaa0800['path'],_0xcd7486=a134_0x591fe4[_0x362963(0x21b)](_0x522a74,sanitizeForFilesystem(_0x144111[_0x362963(0x1ca)][_0x362963(0x1c7)])+_0x362963(0x220)),_0x65d983=a134_0x591fe4['join'](_0x522a74,'functions'),_0x4c2139=apiExperimentalKnowledgeBaseToYaml(_0x144111),_0x278a76=toExperimentalKnowledgeBaseYamlString(_0x4c2139),_0x53485e=!a134_0x2f02d2[_0x362963(0x1d0)](_0x522a74);let _0x2d8f5f=_0x53485e,_0x39b1c7,_0x2add71=_0x278a76;const _0x560248=[..._0x4c2139['functions']][_0x362963(0x16a)]((_0x261f42,_0x410177)=>_0x261f42[_0x362963(0x1c7)][_0x362963(0x159)](_0x410177[_0x362963(0x1c7)]));for(const _0x231e32 of _0x560248){_0x2add71+=_0x362963(0x23a)+_0x231e32[_0x362963(0x1c7)]+_0x362963(0x194)+_0x231e32[_0x362963(0x235)]+'\x0a---\x20schema:\x20'+_0x231e32[_0x362963(0x1c7)]+_0x362963(0x194)+_0x231e32['json_schema']+'\x0a';}if(!_0x53485e){let _0x514018='';a134_0x2f02d2[_0x362963(0x1d0)](_0xcd7486)&&(_0x514018=a134_0x2f02d2['readFileSync'](_0xcd7486,'utf-8'));if(a134_0x2f02d2[_0x362963(0x1d0)](_0x65d983)){const _0x27ceba=a134_0x2f02d2[_0x362963(0x1dd)](_0x65d983,{'withFileTypes':!![]}),_0x2f1952=_0x27ceba[_0x362963(0x26b)](_0x25b516=>_0x25b516[_0x362963(0x197)]())[_0x362963(0x16a)]((_0x4580cb,_0x58fd20)=>_0x4580cb[_0x362963(0x1c7)][_0x362963(0x159)](_0x58fd20[_0x362963(0x1c7)]));for(const _0x9f8ae5 of _0x2f1952){const _0x5d363b=a134_0x591fe4[_0x362963(0x21b)](_0x65d983,_0x9f8ae5[_0x362963(0x1c7)],_0x362963(0x278)),_0x197f12=a134_0x591fe4[_0x362963(0x21b)](_0x65d983,_0x9f8ae5[_0x362963(0x1c7)],'json_schema.json');a134_0x2f02d2[_0x362963(0x1d0)](_0x5d363b)&&(_0x514018+=_0x362963(0x23a)+_0x9f8ae5['name']+_0x362963(0x194)+a134_0x2f02d2['readFileSync'](_0x5d363b,'utf-8')+'\x0a'),a134_0x2f02d2[_0x362963(0x1d0)](_0x197f12)&&(_0x514018+=_0x362963(0x1ee)+_0x9f8ae5['name']+'\x20---\x0a'+a134_0x2f02d2[_0x362963(0x21f)](_0x197f12,_0x362963(0x202))+'\x0a');}}const _0x5626a6=generateDiff(_0x514018,_0x2add71);_0x2d8f5f=hasChanges(_0x5626a6),_0x2d8f5f&&(_0x39b1c7=formatDiffWithColors(_0x5626a6));}_0x13fe81['push']({'path':_0x522a74,'content':'','isDir':!![]}),_0x13fe81[_0x362963(0x240)]({'path':_0xcd7486,'content':_0x278a76}),_0x13fe81[_0x362963(0x240)]({'path':_0x65d983,'content':'','isDir':!![]});for(const _0x56b12f of _0x4c2139['functions']){const _0x572b5c=a134_0x591fe4[_0x362963(0x21b)](_0x65d983,sanitizeForFilesystem(_0x56b12f[_0x362963(0x1c7)])),_0xba3d7c=a134_0x591fe4[_0x362963(0x21b)](_0x572b5c,_0x362963(0x278)),_0x4604d7=a134_0x591fe4[_0x362963(0x21b)](_0x572b5c,_0x362963(0x166));_0x13fe81[_0x362963(0x240)]({'path':_0x572b5c,'content':'','isDir':!![]}),_0x13fe81['push']({'path':_0xba3d7c,'content':_0x56b12f[_0x362963(0x235)]}),_0x13fe81[_0x362963(0x240)]({'path':_0x4604d7,'content':_0x56b12f[_0x362963(0x16b)]});}if(a134_0x2f02d2['existsSync'](_0x65d983)){const _0x30ef3a=a134_0x2f02d2[_0x362963(0x1dd)](_0x65d983,{'withFileTypes':!![]}),_0x18eee6=new Set(_0x4c2139[_0x362963(0x163)]['map'](_0x1c3178=>sanitizeForFilesystem(_0x1c3178[_0x362963(0x1c7)])));for(const _0x222d74 of _0x30ef3a){if(_0x222d74[_0x362963(0x197)]()&&!_0x18eee6[_0x362963(0x271)](_0x222d74[_0x362963(0x1c7)])){const _0x8c4fa8=a134_0x591fe4['join'](_0x65d983,_0x222d74[_0x362963(0x1c7)]);_0x5c12e0[_0x362963(0x240)]({'path':_0x8c4fa8,'isDir':!![]});}}}_0x448873['experimentalKnowledgeBases']['push']({'name':_0x144111['attributes'][_0x362963(0x1c7)],'outputPath':_0x522a74,'isNew':_0x53485e,'hasChanges':_0x2d8f5f,'diff':_0x39b1c7}),_0x448873[_0x362963(0x20c)][_0x362963(0x264)][_0x362963(0x1bd)]++;if(_0x53485e)_0x448873[_0x362963(0x20c)][_0x362963(0x264)][_0x362963(0x17a)]++;else{if(_0x2d8f5f)_0x448873[_0x362963(0x20c)]['experimentalKnowledgeBases'][_0x362963(0x170)]++;else _0x448873['counts'][_0x362963(0x264)][_0x362963(0x23d)]++;}}for(const _0x4ab690 of _0x4fbd37){if(_0x4ab690[_0x362963(0x1ca)][_0x362963(0x257)])continue;const _0x51e90f=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x2cdb00),_0x4ab690[_0x362963(0x1ca)][_0x362963(0x1c7)]);_0x51e90f[_0x362963(0x190)]&&this[_0x362963(0x1ff)][_0x362963(0x17d)]('Renamed\x20experimental\x20artifact\x20directory:\x20'+a134_0x591fe4['basename'](_0x51e90f[_0x362963(0x263)])+_0x362963(0x219)+a134_0x591fe4[_0x362963(0x1a1)](_0x51e90f[_0x362963(0x22e)]));const _0x27d82e=_0x51e90f[_0x362963(0x22e)],_0xc008f3=a134_0x591fe4[_0x362963(0x21b)](_0x27d82e,sanitizeForFilesystem(_0x4ab690[_0x362963(0x1ca)][_0x362963(0x1c7)])+_0x362963(0x220)),_0x1ad3cf=a134_0x591fe4[_0x362963(0x21b)](_0x27d82e,'code.js'),_0x534208=a134_0x591fe4[_0x362963(0x21b)](_0x27d82e,_0x362963(0x1d2)),_0x1e1843=apiExperimentalArtifactToYaml(_0x4ab690),_0x2eb194=toExperimentalArtifactYamlString(_0x1e1843),_0x13857e=!a134_0x2f02d2[_0x362963(0x1d0)](_0x27d82e);let _0x29f406=_0x13857e,_0x590542,_0x399029=_0x2eb194+(_0x362963(0x195)+_0x1e1843[_0x362963(0x235)]+'\x0a');const _0x3b4e2b=[..._0x1e1843['files']]['sort']((_0xa99e9,_0x1f8762)=>_0xa99e9[_0x362963(0x234)][_0x362963(0x159)](_0x1f8762[_0x362963(0x234)]));for(const _0x271f07 of _0x3b4e2b){_0x399029+=_0x362963(0x21a)+_0x271f07[_0x362963(0x234)]+_0x362963(0x194)+_0x271f07['text_content']+'\x0a';}if(!_0x13857e){let _0x272f02='';a134_0x2f02d2['existsSync'](_0xc008f3)&&(_0x272f02=a134_0x2f02d2['readFileSync'](_0xc008f3,_0x362963(0x202)));a134_0x2f02d2['existsSync'](_0x1ad3cf)&&(_0x272f02+=_0x362963(0x195)+a134_0x2f02d2[_0x362963(0x21f)](_0x1ad3cf,_0x362963(0x202))+'\x0a');if(a134_0x2f02d2[_0x362963(0x1d0)](_0x534208)){const _0x50e756=a134_0x2f02d2[_0x362963(0x1dd)](_0x534208),_0x7bac1f=_0x50e756[_0x362963(0x26b)](_0x3b2d62=>{const _0x6efae0=_0x362963,_0x4c92e2=a134_0x591fe4[_0x6efae0(0x21b)](_0x534208,_0x3b2d62);return a134_0x2f02d2[_0x6efae0(0x161)](_0x4c92e2)[_0x6efae0(0x20f)]();})[_0x362963(0x16a)]((_0x364ba1,_0x369c45)=>_0x364ba1[_0x362963(0x159)](_0x369c45));for(const _0x4721e8 of _0x7bac1f){const _0xdfe2cf=a134_0x591fe4[_0x362963(0x21b)](_0x534208,_0x4721e8);_0x272f02+=_0x362963(0x21a)+_0x4721e8+_0x362963(0x194)+a134_0x2f02d2[_0x362963(0x21f)](_0xdfe2cf,_0x362963(0x202))+'\x0a';}}const _0x1f90bd=generateDiff(_0x272f02,_0x399029);_0x29f406=hasChanges(_0x1f90bd),_0x29f406&&(_0x590542=formatDiffWithColors(_0x1f90bd));}_0x13fe81[_0x362963(0x240)]({'path':_0x27d82e,'content':'','isDir':!![]}),_0x13fe81[_0x362963(0x240)]({'path':_0xc008f3,'content':_0x2eb194}),_0x13fe81['push']({'path':_0x1ad3cf,'content':_0x1e1843[_0x362963(0x235)]});if(_0x1e1843[_0x362963(0x1d2)]['length']>0x0){_0x13fe81['push']({'path':_0x534208,'content':'','isDir':!![]});for(const _0x2357ce of _0x1e1843['files']){const _0x355360=a134_0x591fe4[_0x362963(0x21b)](_0x534208,_0x2357ce['file_name']);_0x13fe81[_0x362963(0x240)]({'path':_0x355360,'content':_0x2357ce[_0x362963(0x254)]});}}if(a134_0x2f02d2['existsSync'](_0x534208)){const _0x774396=a134_0x2f02d2[_0x362963(0x1dd)](_0x534208),_0x369c09=new Set(_0x1e1843['files'][_0x362963(0x1f2)](_0x23eeb5=>_0x23eeb5['file_name']));for(const _0x1e3b48 of _0x774396){const _0x45dddd=a134_0x591fe4[_0x362963(0x21b)](_0x534208,_0x1e3b48);a134_0x2f02d2[_0x362963(0x161)](_0x45dddd)[_0x362963(0x20f)]()&&!_0x369c09[_0x362963(0x271)](_0x1e3b48)&&_0x5c12e0[_0x362963(0x240)]({'path':_0x45dddd});}}_0x448873[_0x362963(0x229)][_0x362963(0x240)]({'name':_0x4ab690['attributes'][_0x362963(0x1c7)],'outputPath':_0x27d82e,'isNew':_0x13857e,'hasChanges':_0x29f406,'diff':_0x590542}),_0x448873[_0x362963(0x20c)]['experimentalArtifacts'][_0x362963(0x1bd)]++;if(_0x13857e)_0x448873[_0x362963(0x20c)][_0x362963(0x229)][_0x362963(0x17a)]++;else{if(_0x29f406)_0x448873[_0x362963(0x20c)][_0x362963(0x229)][_0x362963(0x170)]++;else _0x448873[_0x362963(0x20c)]['experimentalArtifacts'][_0x362963(0x23d)]++;}}for(const _0xc35474 of _0x45b6a0){const _0xee100a=getSanitizedPathWithMigration(getFormInterfacesDir(_0x2cdb00),_0xc35474[_0x362963(0x1ca)]['name'],_0x362963(0x220));_0xee100a[_0x362963(0x190)]&&this[_0x362963(0x1ff)]['info'](_0x362963(0x1db)+a134_0x591fe4[_0x362963(0x1a1)](_0xee100a[_0x362963(0x263)])+'\x20→\x20'+a134_0x591fe4[_0x362963(0x1a1)](_0xee100a[_0x362963(0x22e)]));const _0x3003f7=_0xee100a[_0x362963(0x22e)],_0x3a272c=await apiFormInterfaceToYaml(_0xc35474,_0x2bb10c),_0x57b760=toFormInterfaceYamlString(_0x3a272c),_0x3d4a6e=!a134_0x2f02d2[_0x362963(0x1d0)](_0x3003f7);let _0x1f33ce=_0x3d4a6e,_0x2abf24;if(!_0x3d4a6e){const _0xb9ebcb=a134_0x2f02d2[_0x362963(0x21f)](_0x3003f7,'utf-8'),_0x2b556c=generateDiff(_0xb9ebcb,_0x57b760);_0x1f33ce=hasChanges(_0x2b556c),_0x1f33ce&&(_0x2abf24=formatDiffWithColors(_0x2b556c));}_0x13fe81[_0x362963(0x240)]({'path':_0x3003f7,'content':_0x57b760}),_0x448873[_0x362963(0x22d)][_0x362963(0x240)]({'name':_0xc35474[_0x362963(0x1ca)][_0x362963(0x1c7)],'outputPath':_0x3003f7,'isNew':_0x3d4a6e,'hasChanges':_0x1f33ce,'diff':_0x2abf24}),_0x448873['counts']['formInterfaces'][_0x362963(0x1bd)]++;if(_0x3d4a6e)_0x448873[_0x362963(0x20c)][_0x362963(0x22d)][_0x362963(0x17a)]++;else{if(_0x1f33ce)_0x448873[_0x362963(0x20c)][_0x362963(0x22d)]['updated']++;else _0x448873[_0x362963(0x20c)][_0x362963(0x22d)][_0x362963(0x23d)]++;}}for(const _0x265025 of _0x19406f){if(_0x265025['attributes'][_0x362963(0x257)])continue;const _0x6f2eff=getSanitizedPathWithMigration(getChatInterfacesDir(_0x2cdb00),_0x265025['attributes'][_0x362963(0x1c7)],'.yml');_0x6f2eff[_0x362963(0x190)]&&this[_0x362963(0x1ff)]['info'](_0x362963(0x18f)+a134_0x591fe4[_0x362963(0x1a1)](_0x6f2eff[_0x362963(0x263)])+_0x362963(0x219)+a134_0x591fe4[_0x362963(0x1a1)](_0x6f2eff[_0x362963(0x22e)]));const _0x12f6d1=_0x6f2eff[_0x362963(0x22e)],_0x447a2a=await apiChatInterfaceToYaml(_0x265025,_0x2bb10c),_0x32b38b=toChatInterfaceYamlString(_0x447a2a),_0x4771a8=!a134_0x2f02d2[_0x362963(0x1d0)](_0x12f6d1);let _0x421c16=_0x4771a8,_0x1b048e;if(!_0x4771a8){const _0x456227=a134_0x2f02d2[_0x362963(0x21f)](_0x12f6d1,_0x362963(0x202)),_0x2c6f69=generateDiff(_0x456227,_0x32b38b);_0x421c16=hasChanges(_0x2c6f69),_0x421c16&&(_0x1b048e=formatDiffWithColors(_0x2c6f69));}_0x13fe81['push']({'path':_0x12f6d1,'content':_0x32b38b}),_0x448873[_0x362963(0x169)][_0x362963(0x240)]({'name':_0x265025[_0x362963(0x1ca)][_0x362963(0x1c7)],'outputPath':_0x12f6d1,'isNew':_0x4771a8,'hasChanges':_0x421c16,'diff':_0x1b048e}),_0x448873[_0x362963(0x20c)]['chatInterfaces'][_0x362963(0x1bd)]++;if(_0x4771a8)_0x448873[_0x362963(0x20c)][_0x362963(0x169)][_0x362963(0x17a)]++;else{if(_0x421c16)_0x448873[_0x362963(0x20c)][_0x362963(0x169)][_0x362963(0x170)]++;else _0x448873[_0x362963(0x20c)]['chatInterfaces']['unchanged']++;}}if(_0xfa2d1e?.[_0x362963(0x1af)])return _0x448873;a134_0x2f02d2['mkdirSync'](_0x2cdb00,{'recursive':!![]}),a134_0x2f02d2['mkdirSync'](getKnowledgeBasesDir(_0x2cdb00),{'recursive':!![]}),a134_0x2f02d2[_0x362963(0x192)](getPromptsDir(_0x2cdb00),{'recursive':!![]}),a134_0x2f02d2[_0x362963(0x192)](getIntegrationsDir(_0x2cdb00),{'recursive':!![]}),a134_0x2f02d2[_0x362963(0x192)](getExperimentalKnowledgeBasesDir(_0x2cdb00),{'recursive':!![]}),a134_0x2f02d2['mkdirSync'](getExperimentalArtifactsDir(_0x2cdb00),{'recursive':!![]}),a134_0x2f02d2[_0x362963(0x192)](getFormInterfacesDir(_0x2cdb00),{'recursive':!![]}),a134_0x2f02d2[_0x362963(0x192)](getChatInterfacesDir(_0x2cdb00),{'recursive':!![]});const _0x312ae2=a134_0x591fe4[_0x362963(0x21b)](_0x2cdb00,'tdx.json');a134_0x2f02d2[_0x362963(0x20b)](_0x312ae2,createAgentConfigContent(_0x1ba0d4));for(const _0x1f83e5 of _0x13fe81){if(_0x1f83e5['isDir'])a134_0x2f02d2[_0x362963(0x192)](_0x1f83e5['path'],{'recursive':!![]});else{const _0x44669d=a134_0x591fe4[_0x362963(0x233)](_0x1f83e5['path']);!a134_0x2f02d2[_0x362963(0x1d0)](_0x44669d)&&a134_0x2f02d2['mkdirSync'](_0x44669d,{'recursive':!![]}),a134_0x2f02d2[_0x362963(0x20b)](_0x1f83e5[_0x362963(0x22e)],_0x1f83e5['content']);}}for(const _0x2bd70a of _0x5c12e0){_0x2bd70a[_0x362963(0x230)]?(a134_0x2f02d2[_0x362963(0x15c)](_0x2bd70a[_0x362963(0x22e)],{'recursive':!![],'force':!![]}),this['logger'][_0x362963(0x17d)](_0x362963(0x1a2)+a134_0x591fe4[_0x362963(0x1a1)](a134_0x591fe4[_0x362963(0x233)](_0x2bd70a[_0x362963(0x22e)]))+'/'+a134_0x591fe4[_0x362963(0x1a1)](_0x2bd70a['path']))):(a134_0x2f02d2[_0x362963(0x15c)](_0x2bd70a[_0x362963(0x22e)],{'force':!![]}),this['logger'][_0x362963(0x17d)]('Removed\x20deleted\x20file:\x20'+a134_0x591fe4[_0x362963(0x1a1)](a134_0x591fe4[_0x362963(0x233)](_0x2bd70a[_0x362963(0x22e)]))+'/'+a134_0x591fe4[_0x362963(0x1a1)](_0x2bd70a[_0x362963(0x22e)])));}return _0x448873;}async[a134_0x5ec437(0x1aa)](_0x65b390,_0x3597be){const _0x1171ff=a134_0x5ec437,_0x204342=a134_0x591fe4[_0x1171ff(0x21b)](_0x65b390,'tdx.json');if(!a134_0x2f02d2['existsSync'](_0x204342))throw new SDKError(ErrorCode[_0x1171ff(0x1ce)],_0x1171ff(0x1a0)+_0x65b390,undefined,{'helpText':_0x1171ff(0x1f6)});const _0x782835=loadAgentConfig(_0x204342),_0x42a8ce=await this[_0x1171ff(0x21c)](_0x782835[_0x1171ff(0x1a5)]),_0x31d62e=await this['client']['getProject'](_0x42a8ce),_0x20cc22=_0x31d62e[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0x375a38={'projectName':_0x20cc22,'projectId':_0x42a8ce,'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}}},_0x346895=[],_0x1f8ad7=[],_0x8ddca4=[],_0x5c9b1e=[],_0x55fb3f=[],_0x3c3ee8=[],_0x5ceed0=a134_0x2f02d2[_0x1171ff(0x1dd)](_0x65b390,{'withFileTypes':!![]});for(const _0xf1e15b of _0x5ceed0){if(!_0xf1e15b[_0x1171ff(0x197)]())continue;if([_0x1171ff(0x1f4),_0x1171ff(0x21e),_0x1171ff(0x196),'experimental_knowledge_bases',_0x1171ff(0x18b),_0x1171ff(0x1b1),_0x1171ff(0x21d)]['includes'](_0xf1e15b[_0x1171ff(0x1c7)]))continue;const _0x4a9cfd=a134_0x591fe4[_0x1171ff(0x21b)](_0x65b390,_0xf1e15b[_0x1171ff(0x1c7)]);if(isAgentDir(_0x4a9cfd)){const _0x59a09c=a134_0x591fe4[_0x1171ff(0x21b)](_0x4a9cfd,_0x1171ff(0x15b)),_0x39ee71=a134_0x591fe4[_0x1171ff(0x21b)](_0x4a9cfd,_0x1171ff(0x1c6)),_0x56a6fd=a134_0x591fe4['join'](_0x4a9cfd,_0x1171ff(0x1cf)),_0x34d9f7=parseAgentYaml(a134_0x2f02d2['readFileSync'](_0x59a09c,_0x1171ff(0x202)),_0x59a09c),_0x29e4f7=a134_0x2f02d2['existsSync'](_0x39ee71)?a134_0x2f02d2[_0x1171ff(0x21f)](_0x39ee71,_0x1171ff(0x202)):'',_0xef6209=a134_0x2f02d2[_0x1171ff(0x1d0)](_0x56a6fd)?a134_0x2f02d2['readFileSync'](_0x56a6fd,_0x1171ff(0x202)):_0x34d9f7[_0x1171ff(0x16d)];_0x346895[_0x1171ff(0x240)]({'name':_0x34d9f7['name'],'dir':_0x4a9cfd,'yaml':_0x34d9f7,'systemPrompt':_0x29e4f7,'starterMessage':_0xef6209});}}const _0x6ca5ad=getKnowledgeBasesDir(_0x65b390);if(a134_0x2f02d2[_0x1171ff(0x1d0)](_0x6ca5ad)){const _0xac2281=a134_0x2f02d2[_0x1171ff(0x1dd)](_0x6ca5ad);for(const _0x38e25e of _0xac2281){const _0x5473f5=a134_0x591fe4['join'](_0x6ca5ad,_0x38e25e);if(_0x38e25e[_0x1171ff(0x25a)](_0x1171ff(0x220))){const _0x26a95d=parseKnowledgeBaseYaml(a134_0x2f02d2[_0x1171ff(0x21f)](_0x5473f5,_0x1171ff(0x202)),_0x5473f5);_0x1f8ad7[_0x1171ff(0x240)]({'name':_0x26a95d[_0x1171ff(0x1c7)],'path':_0x5473f5,'yaml':_0x26a95d});}else{if(_0x38e25e[_0x1171ff(0x25a)](_0x1171ff(0x26e))){const _0x2552d1=a134_0x2f02d2[_0x1171ff(0x21f)](_0x5473f5,_0x1171ff(0x202)),{name:_0x431dc3,text:_0x354a2e}=parseTextKnowledgeBaseMd(_0x2552d1,_0x38e25e);_0x8ddca4[_0x1171ff(0x240)]({'name':_0x431dc3,'path':_0x5473f5,'text':_0x354a2e});}}}}const _0x28b3fb=getPromptsDir(_0x65b390);if(a134_0x2f02d2[_0x1171ff(0x1d0)](_0x28b3fb)){const _0x57d668=a134_0x2f02d2[_0x1171ff(0x1dd)](_0x28b3fb)[_0x1171ff(0x26b)](_0x5774fc=>_0x5774fc['endsWith'](_0x1171ff(0x220)));for(const _0x1d1936 of _0x57d668){const _0x57f4da=a134_0x591fe4[_0x1171ff(0x21b)](_0x28b3fb,_0x1d1936),_0x4345db=parsePromptYaml(a134_0x2f02d2[_0x1171ff(0x21f)](_0x57f4da,_0x1171ff(0x202)),_0x57f4da);_0x5c9b1e[_0x1171ff(0x240)]({'name':_0x4345db[_0x1171ff(0x1c7)],'path':_0x57f4da,'yaml':_0x4345db});}}const _0x374b80=[],_0x3e2bfb=getIntegrationsDir(_0x65b390);if(a134_0x2f02d2['existsSync'](_0x3e2bfb)){const _0xa31256=a134_0x2f02d2[_0x1171ff(0x1dd)](_0x3e2bfb)['filter'](_0x2a43f2=>_0x2a43f2[_0x1171ff(0x25a)](_0x1171ff(0x220)));for(const _0xce9c4d of _0xa31256){const _0x4fe8cf=a134_0x591fe4[_0x1171ff(0x21b)](_0x3e2bfb,_0xce9c4d),_0x51bbc9=parseIntegrationYaml(a134_0x2f02d2[_0x1171ff(0x21f)](_0x4fe8cf,_0x1171ff(0x202)),_0x4fe8cf);if(!SAFE_INTEGRATION_TYPES[_0x1171ff(0x1ed)](_0x51bbc9['service_type']['toLowerCase']())){this[_0x1171ff(0x1ff)][_0x1171ff(0x19f)](_0x1171ff(0x269)+_0x51bbc9[_0x1171ff(0x1c7)]+_0x1171ff(0x19a)+_0x51bbc9[_0x1171ff(0x228)]+_0x1171ff(0x255)+(_0x1171ff(0x1c1)+SAFE_INTEGRATION_TYPES[_0x1171ff(0x21b)](',\x20')+_0x1171ff(0x1b3))+'Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.');continue;}_0x374b80['push']({'name':_0x51bbc9[_0x1171ff(0x1c7)],'path':_0x4fe8cf,'yaml':_0x51bbc9});}}const _0x2ae9cf=getExperimentalKnowledgeBasesDir(_0x65b390);if(a134_0x2f02d2[_0x1171ff(0x1d0)](_0x2ae9cf)){const _0x7feb1=a134_0x2f02d2[_0x1171ff(0x1dd)](_0x2ae9cf,{'withFileTypes':!![]});for(const _0x38cc0c of _0x7feb1){if(!_0x38cc0c[_0x1171ff(0x197)]())continue;const _0x542072=a134_0x591fe4[_0x1171ff(0x21b)](_0x2ae9cf,_0x38cc0c['name']),_0x3a1470=a134_0x591fe4[_0x1171ff(0x21b)](_0x542072,_0x38cc0c[_0x1171ff(0x1c7)]+_0x1171ff(0x220)),_0x725e=a134_0x591fe4['join'](_0x542072,_0x1171ff(0x163));if(!a134_0x2f02d2[_0x1171ff(0x1d0)](_0x3a1470))continue;const _0x3c2c2a=parseExperimentalKnowledgeBaseYaml(a134_0x2f02d2[_0x1171ff(0x21f)](_0x3a1470,_0x1171ff(0x202)),_0x3a1470),_0x2c43df=[];if(a134_0x2f02d2[_0x1171ff(0x1d0)](_0x725e)){const _0x57898f=a134_0x2f02d2['readdirSync'](_0x725e,{'withFileTypes':!![]});for(const _0x94f827 of _0x57898f){if(!_0x94f827['isDirectory']())continue;const _0x333357=a134_0x591fe4[_0x1171ff(0x21b)](_0x725e,_0x94f827['name']),_0x108d9=a134_0x591fe4['join'](_0x333357,_0x1171ff(0x278)),_0x2dd686=a134_0x591fe4[_0x1171ff(0x21b)](_0x333357,_0x1171ff(0x166));a134_0x2f02d2[_0x1171ff(0x1d0)](_0x108d9)&&a134_0x2f02d2['existsSync'](_0x2dd686)&&_0x2c43df[_0x1171ff(0x240)]({'name':_0x94f827['name'],'code':a134_0x2f02d2[_0x1171ff(0x21f)](_0x108d9,'utf-8'),'json_schema':a134_0x2f02d2[_0x1171ff(0x21f)](_0x2dd686,_0x1171ff(0x202))});}}const _0x3843d8={..._0x3c2c2a,'variables':_0x3c2c2a[_0x1171ff(0x168)]||[],'functions':_0x2c43df};_0x55fb3f['push']({'name':_0x3c2c2a[_0x1171ff(0x1c7)],'dir':_0x542072,'def':_0x3843d8});}}const _0x51dcdc=getExperimentalArtifactsDir(_0x65b390);if(a134_0x2f02d2['existsSync'](_0x51dcdc)){const _0x1647f5=a134_0x2f02d2[_0x1171ff(0x1dd)](_0x51dcdc,{'withFileTypes':!![]});for(const _0x1664e4 of _0x1647f5){if(!_0x1664e4[_0x1171ff(0x197)]())continue;const _0x2da609=a134_0x591fe4[_0x1171ff(0x21b)](_0x51dcdc,_0x1664e4['name']),_0x2daa7d=a134_0x591fe4['join'](_0x2da609,_0x1664e4[_0x1171ff(0x1c7)]+_0x1171ff(0x220)),_0x507f23=a134_0x591fe4['join'](_0x2da609,'code.js'),_0x112353=a134_0x591fe4['join'](_0x2da609,_0x1171ff(0x1d2));if(!a134_0x2f02d2['existsSync'](_0x2daa7d)||!a134_0x2f02d2[_0x1171ff(0x1d0)](_0x507f23))continue;const _0x191730=parseExperimentalArtifactYaml(a134_0x2f02d2['readFileSync'](_0x2daa7d,_0x1171ff(0x202)),_0x2daa7d),_0x57e095=a134_0x2f02d2[_0x1171ff(0x21f)](_0x507f23,_0x1171ff(0x202)),_0x272b4e=[];if(a134_0x2f02d2[_0x1171ff(0x1d0)](_0x112353)){const _0x4837ba=a134_0x2f02d2[_0x1171ff(0x1dd)](_0x112353);for(const _0x44c83e of _0x4837ba){const _0x1a72ad=a134_0x591fe4[_0x1171ff(0x21b)](_0x112353,_0x44c83e);a134_0x2f02d2[_0x1171ff(0x161)](_0x1a72ad)['isFile']()&&_0x272b4e['push']({'file_name':_0x44c83e,'text_content':a134_0x2f02d2[_0x1171ff(0x21f)](_0x1a72ad,_0x1171ff(0x202))});}}const _0xe4ad24={..._0x191730,'code':_0x57e095,'files':_0x272b4e};_0x3c3ee8[_0x1171ff(0x240)]({'name':_0x191730[_0x1171ff(0x1c7)],'dir':_0x2da609,'def':_0xe4ad24});}}const _0x29ac09=[],_0x2514b7=getFormInterfacesDir(_0x65b390);if(a134_0x2f02d2[_0x1171ff(0x1d0)](_0x2514b7)){const _0x55ec61=a134_0x2f02d2[_0x1171ff(0x1dd)](_0x2514b7)[_0x1171ff(0x26b)](_0x5778ac=>_0x5778ac[_0x1171ff(0x25a)]('.yml'));for(const _0x13966c of _0x55ec61){const _0x1c6bba=a134_0x591fe4[_0x1171ff(0x21b)](_0x2514b7,_0x13966c),_0x484f6f=parseFormInterfaceYaml(a134_0x2f02d2[_0x1171ff(0x21f)](_0x1c6bba,_0x1171ff(0x202)),_0x1c6bba);_0x29ac09[_0x1171ff(0x240)]({'name':_0x484f6f[_0x1171ff(0x1c7)],'path':_0x1c6bba,'yaml':_0x484f6f});}}const _0x5349c5=[],_0xdeb071=getChatInterfacesDir(_0x65b390);if(a134_0x2f02d2['existsSync'](_0xdeb071)){const _0x27166c=a134_0x2f02d2[_0x1171ff(0x1dd)](_0xdeb071)['filter'](_0x528acc=>_0x528acc[_0x1171ff(0x25a)](_0x1171ff(0x220)));for(const _0x3e8e0d of _0x27166c){const _0x4798e0=a134_0x591fe4[_0x1171ff(0x21b)](_0xdeb071,_0x3e8e0d),_0x5dc8ae=parseChatInterfaceYaml(a134_0x2f02d2[_0x1171ff(0x21f)](_0x4798e0,_0x1171ff(0x202)),_0x4798e0);_0x5349c5['push']({'name':_0x5dc8ae[_0x1171ff(0x1c7)],'path':_0x4798e0,'yaml':_0x5dc8ae});}}const _0x29b840=await this[_0x1171ff(0x276)][_0x1171ff(0x165)](_0x42a8ce),_0x551789=await this['client'][_0x1171ff(0x1c2)](_0x42a8ce),_0x23acaa=await this[_0x1171ff(0x276)][_0x1171ff(0x1cd)](_0x42a8ce),_0x4dc6c1=await this['client'][_0x1171ff(0x15a)](_0x42a8ce),_0x3a82d0=await this[_0x1171ff(0x276)]['listIntegrations'](_0x42a8ce),_0x77e0bf=await safeListOrEmpty(()=>this['client'][_0x1171ff(0x200)](_0x42a8ce)),_0x568ba7=await safeListOrEmpty(()=>this[_0x1171ff(0x276)][_0x1171ff(0x178)](_0x42a8ce)),_0x4f617b=await safeListOrEmpty(()=>this[_0x1171ff(0x276)][_0x1171ff(0x177)](_0x42a8ce)),_0x1d04c4=await safeListOrEmpty(()=>this[_0x1171ff(0x276)][_0x1171ff(0x236)](_0x42a8ce)),_0xf28aac=await fetchAllToolTargetMaps((_0x4adc02,_0x39975b)=>this[_0x1171ff(0x276)][_0x1171ff(0x204)](_0x4adc02,_0x39975b),_0x42a8ce),_0x52a933=new Map(),_0x101860=new Map(),_0x2e5598=new Map(),_0x1cc255=new Map(),_0x533398=new Map(),_0x27213a=new Map(),_0x427307=new Map();for(const _0x56f254 of _0x29b840){_0x52a933['set'](_0x56f254[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0x56f254);}for(const _0x521616 of _0x551789){_0x101860['set'](_0x521616['attributes'][_0x1171ff(0x1c7)],_0x521616);}for(const _0x232827 of _0x23acaa){_0x2e5598[_0x1171ff(0x279)](_0x232827['attributes'][_0x1171ff(0x1c7)],_0x232827);}for(const _0x22f700 of _0x4dc6c1){_0x1cc255['set'](_0x22f700[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0x22f700);}for(const _0x5016b5 of _0x3a82d0){_0x533398[_0x1171ff(0x279)](_0x5016b5[_0x1171ff(0x1ca)]['serviceType']['toLowerCase'](),_0x5016b5);}for(const _0x53da53 of _0x77e0bf){_0x27213a[_0x1171ff(0x279)](_0x53da53[_0x1171ff(0x1ca)]['name'],_0x53da53);}for(const _0x53890d of _0x568ba7){_0x427307[_0x1171ff(0x279)](_0x53890d[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0x53890d);}const _0x512509=new Map(),_0x10298d=new Map();for(const _0xaa79ef of _0x4f617b){_0x512509[_0x1171ff(0x279)](_0xaa79ef[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0xaa79ef);}for(const _0x527fb1 of _0x1d04c4){_0x10298d[_0x1171ff(0x279)](_0x527fb1[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0x527fb1);}const _0x53830a=new Map(),_0x5a76b0=new Map();for(const _0x47b43d of _0x29b840){_0x53830a[_0x1171ff(0x279)](_0x47b43d[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0x47b43d['id']),_0x5a76b0['set'](_0x47b43d['id'],_0x47b43d['attributes']['name']);}const _0xc59cab=new Map(),_0xd13d0d=new Map();for(const _0x5df4d6 of _0x4dc6c1){_0xc59cab[_0x1171ff(0x279)](_0x5df4d6[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0x5df4d6['id']),_0xd13d0d[_0x1171ff(0x279)](_0x5df4d6['id'],_0x5df4d6['attributes'][_0x1171ff(0x1c7)]);}const _0x3679ad=_0xf28aac[_0x1171ff(0x231)]['KnowledgeBase']||new Map(),_0x65f67=_0xf28aac[_0x1171ff(0x231)][_0x1171ff(0x1a6)]||new Map(),_0x3692c8=_0xf28aac[_0x1171ff(0x231)]['ExperimentalKnowledgeBase']||new Map(),_0x3658c8=new Map(),_0x575d39={'resolveToolTargetName':buildNameResolver({..._0xf28aac[_0x1171ff(0x266)],'Agent':_0x5a76b0}),'resolvePromptName':async _0x598bee=>_0xd13d0d[_0x1171ff(0x26f)](_0x598bee),'onWarning':_0x50e992=>this[_0x1171ff(0x1ff)][_0x1171ff(0x19f)](_0x50e992)};let _0x38c400=[];const _0x39e7d2={'projectId':_0x42a8ce,'resolveToolTargetId':buildIdResolver({..._0xf28aac['nameToId'],'Agent':_0x53830a}),'resolvePromptId':async _0x20a4ee=>_0xc59cab[_0x1171ff(0x26f)](_0x20a4ee),'onWarning':_0x23c851=>{this['logger']['warn'](_0x23c851),_0x38c400['push'](_0x23c851);}},{resolved:_0x4aeab1,unresolved:_0x1a2860}=resolveAgentDependencies(_0x346895,new Set(_0x52a933['keys']()));for(const {agent:_0x442fa6,missingDeps:_0x630f87}of _0x1a2860){_0x375a38[_0x1171ff(0x1fb)]['push']({'agentName':_0x442fa6[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':'error','error':_0x1171ff(0x1f7)+_0x630f87[_0x1171ff(0x21b)](',\x20')+_0x1171ff(0x1fe)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x1fb)][_0x1171ff(0x1e8)]++;}for(const _0x351846 of _0x1f8ad7){const _0x2a072f=_0x101860[_0x1171ff(0x26f)](_0x351846[_0x1171ff(0x262)][_0x1171ff(0x1c7)]),_0x632e6f=a134_0x2f02d2['readFileSync'](_0x351846['path'],_0x1171ff(0x202));if(_0x2a072f){const _0x5bad39=apiKnowledgeBaseToYaml(_0x2a072f),_0x5f0a3b=toKnowledgeBaseYamlString(_0x5bad39),_0x34efad=generateDiff(_0x5f0a3b,_0x632e6f),_0x49827f=hasChanges(_0x34efad);_0x49827f?(_0x375a38[_0x1171ff(0x253)][_0x1171ff(0x240)]({'name':_0x351846[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':'updated','id':_0x2a072f['id'],'diff':formatDiffWithColors(_0x34efad)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x253)][_0x1171ff(0x170)]++):(_0x375a38[_0x1171ff(0x253)][_0x1171ff(0x240)]({'name':_0x351846[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x23d),'id':_0x2a072f['id']}),_0x375a38[_0x1171ff(0x20c)]['knowledgeBases']['unchanged']++);}else _0x375a38[_0x1171ff(0x253)]['push']({'name':_0x351846['yaml']['name'],'action':'created'}),_0x375a38['counts'][_0x1171ff(0x253)][_0x1171ff(0x258)]++;}for(const _0x1970ac of _0x8ddca4){const _0x104d6a=_0x2e5598[_0x1171ff(0x26f)](_0x1970ac[_0x1171ff(0x1c7)]),_0x55a00b=a134_0x2f02d2[_0x1171ff(0x21f)](_0x1970ac[_0x1171ff(0x22e)],_0x1171ff(0x202));if(_0x104d6a){const _0x5b647b=toTextKnowledgeBaseMd(_0x104d6a[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0x104d6a['attributes'][_0x1171ff(0x180)]),_0x416ce5=generateDiff(_0x5b647b,_0x55a00b),_0x48b4ab=hasChanges(_0x416ce5);_0x48b4ab?(_0x375a38[_0x1171ff(0x260)]['push']({'name':_0x1970ac[_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x104d6a['id'],'diff':formatDiffWithColors(_0x416ce5)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x260)]['updated']++):(_0x375a38['textKnowledgeBases'][_0x1171ff(0x240)]({'name':_0x1970ac[_0x1171ff(0x1c7)],'action':'unchanged','id':_0x104d6a['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x260)]['unchanged']++);}else _0x375a38[_0x1171ff(0x260)][_0x1171ff(0x240)]({'name':_0x1970ac[_0x1171ff(0x1c7)],'action':_0x1171ff(0x258)}),_0x375a38['counts'][_0x1171ff(0x260)][_0x1171ff(0x258)]++;}for(const _0xae7766 of _0x4aeab1){const _0x682ed5=_0x52a933['get'](_0xae7766[_0x1171ff(0x262)][_0x1171ff(0x1c7)]),_0x4ad64b=a134_0x591fe4['join'](_0xae7766['dir'],_0x1171ff(0x15b)),_0x207d8a=a134_0x2f02d2[_0x1171ff(0x21f)](_0x4ad64b,_0x1171ff(0x202)),_0x4d64c3=_0xae7766[_0x1171ff(0x25c)],_0xed8a2c=_0x1171ff(0x24f)+_0x4d64c3+_0x1171ff(0x191)+_0x207d8a;if(_0x682ed5){const {yaml:_0x426164,systemPrompt:_0x64ccd2}=await agentResponseToDef(_0x682ed5,_0x575d39),_0x4de8c5=toAgentYamlString(_0x426164),_0x1e89c5=_0x1171ff(0x24f)+_0x64ccd2+'\x0a\x0a#\x20agent.yml\x0a'+_0x4de8c5,_0x3cc1eb=generateDiff(_0x1e89c5,_0xed8a2c),_0x3b05cc=hasChanges(_0x3cc1eb);_0x3b05cc?(_0x375a38[_0x1171ff(0x1fb)][_0x1171ff(0x240)]({'agentName':_0xae7766[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'agentId':_0x682ed5['id'],'diff':formatDiffWithColors(_0x3cc1eb)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x1fb)][_0x1171ff(0x170)]++):(_0x375a38[_0x1171ff(0x1fb)][_0x1171ff(0x240)]({'agentName':_0xae7766[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x23d),'agentId':_0x682ed5['id']}),_0x375a38[_0x1171ff(0x20c)]['agents'][_0x1171ff(0x23d)]++);}else _0x375a38[_0x1171ff(0x1fb)]['push']({'agentName':_0xae7766[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x1fb)]['created']++;}for(const _0x56f626 of _0x5c9b1e){const _0x596c76=_0x1cc255[_0x1171ff(0x26f)](_0x56f626[_0x1171ff(0x262)]['name']),_0x5d45b2=a134_0x2f02d2[_0x1171ff(0x21f)](_0x56f626['path'],_0x1171ff(0x202));if(_0x596c76){const _0x311a77=await apiPromptToYaml(_0x596c76,_0x575d39);if(!_0x311a77){_0x375a38[_0x1171ff(0x21e)][_0x1171ff(0x240)]({'name':_0x56f626[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':'updated','id':_0x596c76['id']}),_0x375a38['counts'][_0x1171ff(0x21e)][_0x1171ff(0x170)]++;continue;}const _0xd4183a=toPromptYamlString(_0x311a77),_0x278739=generateDiff(_0xd4183a,_0x5d45b2),_0x83c4c9=hasChanges(_0x278739);_0x83c4c9?(_0x375a38[_0x1171ff(0x21e)][_0x1171ff(0x240)]({'name':_0x56f626[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x596c76['id'],'diff':formatDiffWithColors(_0x278739)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x21e)]['updated']++):(_0x375a38[_0x1171ff(0x21e)]['push']({'name':_0x56f626[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x23d),'id':_0x596c76['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x21e)]['unchanged']++);}else _0x375a38[_0x1171ff(0x21e)][_0x1171ff(0x240)]({'name':_0x56f626[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x21e)][_0x1171ff(0x258)]++;}for(const _0x56a708 of _0x374b80){const _0x2a07f8=_0x533398[_0x1171ff(0x26f)](_0x56a708[_0x1171ff(0x262)][_0x1171ff(0x228)]),_0x7ee16f=a134_0x2f02d2['readFileSync'](_0x56a708[_0x1171ff(0x22e)],_0x1171ff(0x202));if(_0x2a07f8){const _0x2aafdf=await apiIntegrationToYaml(_0x2a07f8,_0x575d39),_0x557442=toIntegrationYamlString(_0x2aafdf),_0x139a0e=generateDiff(_0x557442,_0x7ee16f),_0x8aa495=hasChanges(_0x139a0e);_0x8aa495?(_0x375a38[_0x1171ff(0x196)]['push']({'name':_0x56a708[_0x1171ff(0x262)][_0x1171ff(0x228)],'action':'updated','id':_0x2a07f8['id'],'diff':formatDiffWithColors(_0x139a0e)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x196)][_0x1171ff(0x170)]++):(_0x375a38[_0x1171ff(0x196)][_0x1171ff(0x240)]({'name':_0x56a708['yaml'][_0x1171ff(0x228)],'action':'unchanged','id':_0x2a07f8['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x196)][_0x1171ff(0x23d)]++);}else _0x375a38[_0x1171ff(0x196)][_0x1171ff(0x240)]({'name':_0x56a708['yaml'][_0x1171ff(0x228)],'action':_0x1171ff(0x258)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x196)][_0x1171ff(0x258)]++;}for(const _0x35c775 of _0x55fb3f){const _0x3f0212=_0x27213a[_0x1171ff(0x26f)](_0x35c775[_0x1171ff(0x252)]['name']),_0x2cc246=toExperimentalKnowledgeBaseYamlString(_0x35c775[_0x1171ff(0x252)]);let _0x37f992=_0x2cc246;for(const _0x3b370b of _0x35c775[_0x1171ff(0x252)][_0x1171ff(0x163)]){_0x37f992+=_0x1171ff(0x23a)+_0x3b370b[_0x1171ff(0x1c7)]+_0x1171ff(0x194)+_0x3b370b['code']+'\x0a---\x20schema:\x20'+_0x3b370b[_0x1171ff(0x1c7)]+_0x1171ff(0x194)+_0x3b370b[_0x1171ff(0x16b)]+'\x0a';}if(_0x3f0212){const _0x5f0b5c=apiExperimentalKnowledgeBaseToYaml(_0x3f0212),_0x28965a=toExperimentalKnowledgeBaseYamlString(_0x5f0b5c);let _0xaaa84d=_0x28965a;for(const _0x4b3852 of _0x5f0b5c[_0x1171ff(0x163)]){_0xaaa84d+=_0x1171ff(0x23a)+_0x4b3852[_0x1171ff(0x1c7)]+_0x1171ff(0x194)+_0x4b3852[_0x1171ff(0x235)]+_0x1171ff(0x17b)+_0x4b3852[_0x1171ff(0x1c7)]+'\x20---\x0a'+_0x4b3852['json_schema']+'\x0a';}const _0x3a7403=generateDiff(_0xaaa84d,_0x37f992),_0xc0703e=hasChanges(_0x3a7403);_0xc0703e?(_0x375a38['experimentalKnowledgeBases'][_0x1171ff(0x240)]({'name':_0x35c775['def'][_0x1171ff(0x1c7)],'action':'updated','id':_0x3f0212['id'],'diff':formatDiffWithColors(_0x3a7403)}),_0x375a38[_0x1171ff(0x20c)]['experimentalKnowledgeBases'][_0x1171ff(0x170)]++):(_0x375a38[_0x1171ff(0x264)][_0x1171ff(0x240)]({'name':_0x35c775['def'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x23d),'id':_0x3f0212['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x264)][_0x1171ff(0x23d)]++);}else _0x375a38[_0x1171ff(0x264)][_0x1171ff(0x240)]({'name':_0x35c775[_0x1171ff(0x252)]['name'],'action':_0x1171ff(0x258)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x264)]['created']++;}for(const _0x283f79 of _0x3c3ee8){const _0x329d42=_0x427307[_0x1171ff(0x26f)](_0x283f79['def'][_0x1171ff(0x1c7)]),_0x498cbf=toExperimentalArtifactYamlString(_0x283f79['def']);let _0x42cb30=_0x498cbf+(_0x1171ff(0x195)+_0x283f79[_0x1171ff(0x252)][_0x1171ff(0x235)]+'\x0a');for(const _0x48345d of _0x283f79[_0x1171ff(0x252)][_0x1171ff(0x1d2)]){_0x42cb30+='---\x20file:\x20'+_0x48345d[_0x1171ff(0x234)]+_0x1171ff(0x194)+_0x48345d['text_content']+'\x0a';}if(_0x329d42){const _0xcce8ec=apiExperimentalArtifactToYaml(_0x329d42),_0x139196=toExperimentalArtifactYamlString(_0xcce8ec);let _0x87bec3=_0x139196+(_0x1171ff(0x195)+_0xcce8ec['code']+'\x0a');for(const _0x3e4ddb of _0xcce8ec[_0x1171ff(0x1d2)]){_0x87bec3+=_0x1171ff(0x21a)+_0x3e4ddb[_0x1171ff(0x234)]+_0x1171ff(0x194)+_0x3e4ddb[_0x1171ff(0x254)]+'\x0a';}const _0xc75201=generateDiff(_0x87bec3,_0x42cb30),_0x7172a6=hasChanges(_0xc75201);_0x7172a6?(_0x375a38['experimentalArtifacts'][_0x1171ff(0x240)]({'name':_0x283f79[_0x1171ff(0x252)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x329d42['id'],'diff':formatDiffWithColors(_0xc75201)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x229)]['updated']++):(_0x375a38[_0x1171ff(0x229)][_0x1171ff(0x240)]({'name':_0x283f79[_0x1171ff(0x252)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x23d),'id':_0x329d42['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x229)]['unchanged']++);}else _0x375a38[_0x1171ff(0x229)][_0x1171ff(0x240)]({'name':_0x283f79['def'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x229)][_0x1171ff(0x258)]++;}for(const _0x5d89a9 of _0x29ac09){const _0x121292=_0x512509[_0x1171ff(0x26f)](_0x5d89a9[_0x1171ff(0x262)]['name']),_0x3440df=a134_0x2f02d2['readFileSync'](_0x5d89a9[_0x1171ff(0x22e)],_0x1171ff(0x202));if(_0x121292){const _0x513304=await apiFormInterfaceToYaml(_0x121292,_0x575d39),_0x380afd=toFormInterfaceYamlString(_0x513304),_0x34c48f=generateDiff(_0x380afd,_0x3440df),_0x3c80f6=hasChanges(_0x34c48f);_0x3c80f6?(_0x375a38['formInterfaces'][_0x1171ff(0x240)]({'name':_0x5d89a9[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x121292['id'],'diff':formatDiffWithColors(_0x34c48f)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x22d)][_0x1171ff(0x170)]++):(_0x375a38['formInterfaces'][_0x1171ff(0x240)]({'name':_0x5d89a9[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':'unchanged','id':_0x121292['id']}),_0x375a38[_0x1171ff(0x20c)]['formInterfaces']['unchanged']++);}else _0x375a38[_0x1171ff(0x22d)][_0x1171ff(0x240)]({'name':_0x5d89a9[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':'created'}),_0x375a38[_0x1171ff(0x20c)]['formInterfaces']['created']++;}for(const _0x48574a of _0x5349c5){const _0x259c8f=_0x10298d['get'](_0x48574a['yaml'][_0x1171ff(0x1c7)]),_0x2dc0da=a134_0x2f02d2[_0x1171ff(0x21f)](_0x48574a[_0x1171ff(0x22e)],_0x1171ff(0x202));if(_0x259c8f){const _0x45f57c=await apiChatInterfaceToYaml(_0x259c8f,_0x575d39),_0x119b3c=toChatInterfaceYamlString(_0x45f57c),_0x4b4cc4=generateDiff(_0x119b3c,_0x2dc0da),_0x40901a=hasChanges(_0x4b4cc4);_0x40901a?(_0x375a38['chatInterfaces'][_0x1171ff(0x240)]({'name':_0x48574a[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':'updated','id':_0x259c8f['id'],'diff':formatDiffWithColors(_0x4b4cc4)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x169)][_0x1171ff(0x170)]++):(_0x375a38[_0x1171ff(0x169)][_0x1171ff(0x240)]({'name':_0x48574a[_0x1171ff(0x262)]['name'],'action':'unchanged','id':_0x259c8f['id']}),_0x375a38[_0x1171ff(0x20c)]['chatInterfaces']['unchanged']++);}else _0x375a38[_0x1171ff(0x169)]['push']({'name':_0x48574a[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258)}),_0x375a38[_0x1171ff(0x20c)]['chatInterfaces'][_0x1171ff(0x258)]++;}if(_0x3597be?.[_0x1171ff(0x1af)])return _0x375a38;_0x375a38[_0x1171ff(0x253)]=[],_0x375a38[_0x1171ff(0x260)]=[],_0x375a38['prompts']=[],_0x375a38[_0x1171ff(0x196)]=[],_0x375a38[_0x1171ff(0x264)]=[],_0x375a38[_0x1171ff(0x229)]=[],_0x375a38[_0x1171ff(0x22d)]=[],_0x375a38[_0x1171ff(0x169)]=[];const _0x39ca7e=_0x375a38[_0x1171ff(0x1fb)][_0x1171ff(0x26b)](_0x15cbe9=>_0x15cbe9['action']==='error');_0x375a38[_0x1171ff(0x1fb)]=_0x39ca7e,_0x375a38['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x39ca7e['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 _0x223336 of _0x1f8ad7){try{const _0xb72b0e=_0x101860['get'](_0x223336[_0x1171ff(0x262)][_0x1171ff(0x1c7)]),_0x3117fc=yamlKnowledgeBaseToApi(_0x223336[_0x1171ff(0x262)],_0x42a8ce);if(_0xb72b0e)await this[_0x1171ff(0x276)][_0x1171ff(0x1ea)](_0xb72b0e['id'],_0x3117fc),_0x3679ad[_0x1171ff(0x279)](_0x223336['yaml']['name'],_0xb72b0e['id']),_0x375a38[_0x1171ff(0x253)][_0x1171ff(0x240)]({'name':_0x223336['yaml'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0xb72b0e['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x253)][_0x1171ff(0x170)]++;else{const _0x115b1b=await this['client'][_0x1171ff(0x1d5)](_0x3117fc);_0x3679ad[_0x1171ff(0x279)](_0x223336[_0x1171ff(0x262)][_0x1171ff(0x1c7)],_0x115b1b['id']),_0x375a38[_0x1171ff(0x253)]['push']({'name':_0x223336[_0x1171ff(0x262)]['name'],'action':_0x1171ff(0x258),'id':_0x115b1b['id']}),_0x375a38[_0x1171ff(0x20c)]['knowledgeBases'][_0x1171ff(0x258)]++;}}catch(_0x302bba){_0x375a38[_0x1171ff(0x253)][_0x1171ff(0x240)]({'name':_0x223336['yaml']['name'],'action':_0x1171ff(0x1de),'error':_0x302bba[_0x1171ff(0x176)]}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x253)]['errors']++;}}for(const _0x166ab9 of _0x8ddca4){try{const _0x5d4e9c=_0x2e5598[_0x1171ff(0x26f)](_0x166ab9[_0x1171ff(0x1c7)]),_0x55eb0c=yamlTextKnowledgeBaseToApi({'name':_0x166ab9[_0x1171ff(0x1c7)],'text':_0x166ab9['text']},_0x42a8ce);if(_0x5d4e9c)await this[_0x1171ff(0x276)][_0x1171ff(0x23c)](_0x5d4e9c['id'],_0x55eb0c),_0x65f67[_0x1171ff(0x279)](_0x166ab9[_0x1171ff(0x1c7)],_0x5d4e9c['id']),_0x375a38[_0x1171ff(0x260)][_0x1171ff(0x240)]({'name':_0x166ab9[_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x5d4e9c['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x260)]['updated']++;else{const _0x3cb241=await this[_0x1171ff(0x276)][_0x1171ff(0x19d)](_0x55eb0c);_0x65f67[_0x1171ff(0x279)](_0x166ab9[_0x1171ff(0x1c7)],_0x3cb241['id']),_0x375a38[_0x1171ff(0x260)][_0x1171ff(0x240)]({'name':_0x166ab9[_0x1171ff(0x1c7)],'action':_0x1171ff(0x258),'id':_0x3cb241['id']}),_0x375a38['counts']['textKnowledgeBases'][_0x1171ff(0x258)]++;}}catch(_0xd81e9c){_0x375a38[_0x1171ff(0x260)][_0x1171ff(0x240)]({'name':_0x166ab9['name'],'action':_0x1171ff(0x1de),'error':_0xd81e9c[_0x1171ff(0x176)]}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x260)]['errors']++;}}for(const _0x23afab of _0x55fb3f){try{const _0x3d8825=_0x27213a['get'](_0x23afab[_0x1171ff(0x252)][_0x1171ff(0x1c7)]),_0x35fc39=yamlExperimentalKnowledgeBaseToApi(_0x23afab[_0x1171ff(0x252)],_0x42a8ce);if(_0x3d8825)await this[_0x1171ff(0x276)]['updateExperimentalKnowledgeBase'](_0x3d8825['id'],_0x35fc39),_0x3692c8[_0x1171ff(0x279)](_0x23afab[_0x1171ff(0x252)][_0x1171ff(0x1c7)],_0x3d8825['id']),_0x375a38[_0x1171ff(0x264)][_0x1171ff(0x240)]({'name':_0x23afab[_0x1171ff(0x252)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x3d8825['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x264)][_0x1171ff(0x170)]++;else{const _0x3a60f9=await this['client']['createExperimentalKnowledgeBase'](_0x35fc39);_0x3692c8[_0x1171ff(0x279)](_0x23afab[_0x1171ff(0x252)][_0x1171ff(0x1c7)],_0x3a60f9['id']),_0x375a38[_0x1171ff(0x264)][_0x1171ff(0x240)]({'name':_0x23afab['def'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258),'id':_0x3a60f9['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x264)]['created']++;}}catch(_0x50b3a8){_0x375a38[_0x1171ff(0x264)]['push']({'name':_0x23afab[_0x1171ff(0x252)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x1de),'error':_0x50b3a8[_0x1171ff(0x176)]}),_0x375a38[_0x1171ff(0x20c)]['experimentalKnowledgeBases'][_0x1171ff(0x1e8)]++;}}for(const _0x10c5bf of _0x3c3ee8){try{const _0x24e7d1=_0x427307[_0x1171ff(0x26f)](_0x10c5bf['def'][_0x1171ff(0x1c7)]),_0x3074fc=yamlExperimentalArtifactToApi(_0x10c5bf[_0x1171ff(0x252)],_0x42a8ce);if(_0x24e7d1)await this[_0x1171ff(0x276)][_0x1171ff(0x249)](_0x24e7d1['id'],_0x3074fc),_0x3658c8[_0x1171ff(0x279)](_0x10c5bf[_0x1171ff(0x252)]['name'],_0x24e7d1['id']),_0x375a38[_0x1171ff(0x229)][_0x1171ff(0x240)]({'name':_0x10c5bf['def'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x24e7d1['id']}),_0x375a38[_0x1171ff(0x20c)]['experimentalArtifacts'][_0x1171ff(0x170)]++;else{const _0x35ea7b=await this[_0x1171ff(0x276)][_0x1171ff(0x215)](_0x3074fc);_0x3658c8[_0x1171ff(0x279)](_0x10c5bf[_0x1171ff(0x252)]['name'],_0x35ea7b['id']),_0x375a38[_0x1171ff(0x229)][_0x1171ff(0x240)]({'name':_0x10c5bf['def'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258),'id':_0x35ea7b['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x229)]['created']++;}}catch(_0x5c1da9){_0x375a38[_0x1171ff(0x229)]['push']({'name':_0x10c5bf['def'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x1de),'error':_0x5c1da9['message']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x229)][_0x1171ff(0x1e8)]++;}}for(const _0x4d584f of _0x4aeab1){_0x38c400=[];try{const _0x1e475d=_0x52a933[_0x1171ff(0x26f)](_0x4d584f[_0x1171ff(0x262)]['name']),_0x695e7e=await agentDefToRequest(_0x4d584f['yaml'],_0x4d584f[_0x1171ff(0x25c)],_0x4d584f[_0x1171ff(0x20a)],_0x39e7d2);if(_0x1e475d)await this[_0x1171ff(0x276)]['updateAgentResponse'](_0x1e475d['id'],_0x695e7e),_0x53830a['set'](_0x4d584f[_0x1171ff(0x262)][_0x1171ff(0x1c7)],_0x1e475d['id']),_0x375a38['agents']['push']({'agentName':_0x4d584f['yaml']['name'],'action':_0x1171ff(0x170),'agentId':_0x1e475d['id'],'warnings':_0x38c400['length']>0x0?_0x38c400:undefined}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x1fb)][_0x1171ff(0x170)]++;else{const _0x106c16=await this[_0x1171ff(0x276)][_0x1171ff(0x186)](_0x695e7e);_0x53830a[_0x1171ff(0x279)](_0x4d584f['yaml'][_0x1171ff(0x1c7)],_0x106c16['id']),_0x375a38[_0x1171ff(0x1fb)]['push']({'agentName':_0x4d584f[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258),'agentId':_0x106c16['id'],'warnings':_0x38c400['length']>0x0?_0x38c400:undefined}),_0x375a38[_0x1171ff(0x20c)]['agents'][_0x1171ff(0x258)]++;}}catch(_0x4f6dd8){_0x375a38[_0x1171ff(0x1fb)]['push']({'agentName':_0x4d584f[_0x1171ff(0x262)]['name'],'action':_0x1171ff(0x1de),'error':_0x4f6dd8[_0x1171ff(0x176)],'warnings':_0x38c400['length']>0x0?_0x38c400:undefined}),_0x375a38[_0x1171ff(0x20c)]['agents'][_0x1171ff(0x1e8)]++;}}for(const _0x5f3896 of _0x5c9b1e){try{const _0x13c439=_0x1cc255['get'](_0x5f3896['yaml']['name']),_0x1aa075=await yamlPromptToApi(_0x5f3896[_0x1171ff(0x262)],_0x42a8ce,_0x39e7d2);if(!_0x1aa075){_0x375a38['prompts'][_0x1171ff(0x240)]({'name':_0x5f3896[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x1de),'error':_0x1171ff(0x1e3)}),_0x375a38[_0x1171ff(0x20c)]['prompts'][_0x1171ff(0x1e8)]++;continue;}if(_0x13c439)await this[_0x1171ff(0x276)]['updatePrompt'](_0x13c439['id'],_0x1aa075),_0xc59cab[_0x1171ff(0x279)](_0x5f3896[_0x1171ff(0x262)][_0x1171ff(0x1c7)],_0x13c439['id']),_0x375a38[_0x1171ff(0x21e)][_0x1171ff(0x240)]({'name':_0x5f3896[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x13c439['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x21e)][_0x1171ff(0x170)]++;else{const _0x1b68d3=await this[_0x1171ff(0x276)]['createPrompt'](_0x1aa075);_0xc59cab[_0x1171ff(0x279)](_0x5f3896[_0x1171ff(0x262)][_0x1171ff(0x1c7)],_0x1b68d3['id']),_0x375a38[_0x1171ff(0x21e)]['push']({'name':_0x5f3896['yaml'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258),'id':_0x1b68d3['id']}),_0x375a38[_0x1171ff(0x20c)]['prompts'][_0x1171ff(0x258)]++;}}catch(_0x174efb){_0x375a38[_0x1171ff(0x21e)][_0x1171ff(0x240)]({'name':_0x5f3896[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':'error','error':_0x174efb[_0x1171ff(0x176)]}),_0x375a38[_0x1171ff(0x20c)]['prompts'][_0x1171ff(0x1e8)]++;}}for(const _0x133bac of _0x374b80){try{const _0x22dedd=_0x533398[_0x1171ff(0x26f)](_0x133bac['yaml'][_0x1171ff(0x228)]),_0x27e129=await yamlIntegrationToApi(_0x133bac[_0x1171ff(0x262)],_0x42a8ce,_0x39e7d2);if(_0x22dedd){await this['client'][_0x1171ff(0x23f)](_0x22dedd['id']);const _0x1e82f1=await this['client'][_0x1171ff(0x199)](_0x27e129);_0x375a38['integrations'][_0x1171ff(0x240)]({'name':_0x133bac[_0x1171ff(0x262)]['service_type'],'action':_0x1171ff(0x170),'id':_0x1e82f1['id']}),_0x375a38['counts'][_0x1171ff(0x196)]['updated']++;}else{const _0x388a63=await this[_0x1171ff(0x276)][_0x1171ff(0x199)](_0x27e129);_0x375a38[_0x1171ff(0x196)][_0x1171ff(0x240)]({'name':_0x133bac['yaml'][_0x1171ff(0x228)],'action':_0x1171ff(0x258),'id':_0x388a63['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x196)][_0x1171ff(0x258)]++;}}catch(_0x5f8a65){_0x375a38[_0x1171ff(0x196)]['push']({'name':_0x133bac[_0x1171ff(0x262)][_0x1171ff(0x228)],'action':_0x1171ff(0x1de),'error':_0x5f8a65[_0x1171ff(0x176)]}),_0x375a38[_0x1171ff(0x20c)]['integrations']['errors']++;}}for(const _0x576403 of _0x29ac09){try{const _0x29f31a=_0x512509[_0x1171ff(0x26f)](_0x576403['yaml'][_0x1171ff(0x1c7)]),_0x34b8e6=await yamlFormInterfaceToApi(_0x576403[_0x1171ff(0x262)],_0x42a8ce,_0x39e7d2);if(!_0x34b8e6){_0x375a38[_0x1171ff(0x22d)][_0x1171ff(0x240)]({'name':_0x576403[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x1de),'error':_0x1171ff(0x1fd)}),_0x375a38['counts'][_0x1171ff(0x22d)]['errors']++;continue;}if(_0x29f31a){const _0xa420b7=await this[_0x1171ff(0x276)][_0x1171ff(0x23b)](_0x29f31a['id'],_0x34b8e6);_0x375a38[_0x1171ff(0x22d)]['push']({'name':_0x576403[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0xa420b7['id']}),_0x375a38[_0x1171ff(0x20c)]['formInterfaces'][_0x1171ff(0x170)]++;}else{const _0x5e548d=await this[_0x1171ff(0x276)]['createFormInterface'](_0x34b8e6);_0x375a38[_0x1171ff(0x22d)][_0x1171ff(0x240)]({'name':_0x576403[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258),'id':_0x5e548d['id']}),_0x375a38['counts'][_0x1171ff(0x22d)][_0x1171ff(0x258)]++;}}catch(_0x253fb){_0x375a38[_0x1171ff(0x22d)][_0x1171ff(0x240)]({'name':_0x576403[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x1de),'error':_0x253fb[_0x1171ff(0x176)]}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x22d)][_0x1171ff(0x1e8)]++;}}for(const _0xd86119 of _0x5349c5){try{const _0x1f9bd6=_0x10298d[_0x1171ff(0x26f)](_0xd86119[_0x1171ff(0x262)][_0x1171ff(0x1c7)]),_0x8db940=await yamlChatInterfaceToApi(_0xd86119[_0x1171ff(0x262)],_0x42a8ce,_0x39e7d2);if(_0x1f9bd6){const _0x5857c9=await this['client']['updateChatInterface'](_0x1f9bd6['id'],_0x8db940);_0x375a38[_0x1171ff(0x169)][_0x1171ff(0x240)]({'name':_0xd86119['yaml'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x5857c9['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x169)][_0x1171ff(0x170)]++;}else{const _0x116fc7=await this['client']['createChatInterface'](_0x8db940);_0x375a38[_0x1171ff(0x169)][_0x1171ff(0x240)]({'name':_0xd86119['yaml'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258),'id':_0x116fc7['id']}),_0x375a38['counts']['chatInterfaces'][_0x1171ff(0x258)]++;}}catch(_0x200ce9){_0x375a38['chatInterfaces']['push']({'name':_0xd86119[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x1de),'error':_0x200ce9['message']}),_0x375a38['counts'][_0x1171ff(0x169)][_0x1171ff(0x1e8)]++;}}return _0x375a38;}async[a134_0x5ec437(0x1b6)](_0x13724a,_0x3954f6,_0x69aded,_0x566c09){const _0x205df6=a134_0x5ec437,{projectId:_0x213d30,project:_0x3f9f21}=await this[_0x205df6(0x173)](_0x13724a),_0x558766=_0x3f9f21['attributes'][_0x205df6(0x1c7)],_0x2d1d95=await this[_0x205df6(0x276)][_0x205df6(0x165)](_0x213d30),_0x515d09=_0x2d1d95[_0x205df6(0x261)](_0x39d12d=>_0x39d12d[_0x205df6(0x1ca)]['name']===_0x3954f6);if(!_0x515d09)throw new SDKError(ErrorCode[_0x205df6(0x18e)],_0x205df6(0x25f)+_0x3954f6,undefined,{'helpText':_0x205df6(0x226)+_0x2d1d95[_0x205df6(0x1f2)](_0x51082d=>_0x51082d['attributes'][_0x205df6(0x1c7)])[_0x205df6(0x21b)](',\x20')});let _0x1a4092;if(_0x69aded)_0x1a4092=_0x69aded;else{const _0x387909=a134_0x591fe4[_0x205df6(0x21b)](process[_0x205df6(0x1b7)](),_0x205df6(0x1fb)),_0x143294=getSanitizedPathWithMigration(_0x387909,_0x558766);_0x143294[_0x205df6(0x190)]&&this[_0x205df6(0x1ff)][_0x205df6(0x17d)](_0x205df6(0x227)+a134_0x591fe4[_0x205df6(0x1a1)](_0x143294[_0x205df6(0x263)])+_0x205df6(0x219)+a134_0x591fe4[_0x205df6(0x1a1)](_0x143294[_0x205df6(0x22e)])),_0x1a4092=_0x143294[_0x205df6(0x22e)];}const _0x2e4a70=getSanitizedPathWithMigration(_0x1a4092,_0x3954f6);_0x2e4a70[_0x205df6(0x190)]&&this[_0x205df6(0x1ff)]['info'](_0x205df6(0x17c)+a134_0x591fe4[_0x205df6(0x1a1)](_0x2e4a70[_0x205df6(0x263)])+_0x205df6(0x219)+a134_0x591fe4['basename'](_0x2e4a70['path']));const _0x4699a4=_0x2e4a70[_0x205df6(0x22e)],_0x1cd8b5=new Map(),_0x477cc6=new Map(),_0x524c9a=await this[_0x205df6(0x276)][_0x205df6(0x1c2)](_0x213d30),_0x1257df=await this[_0x205df6(0x276)][_0x205df6(0x1cd)](_0x213d30),_0x3e969c=await safeListOrEmpty(()=>this[_0x205df6(0x276)][_0x205df6(0x200)](_0x213d30)),_0x31e779=new Map(),_0x21e75a=new Map();for(const _0x5b0485 of _0x524c9a){_0x1cd8b5[_0x205df6(0x279)](_0x5b0485['id'],_0x5b0485[_0x205df6(0x1ca)][_0x205df6(0x1c7)]);}for(const _0x3b0a46 of _0x1257df){_0x31e779['set'](_0x3b0a46['id'],_0x3b0a46[_0x205df6(0x1ca)][_0x205df6(0x1c7)]);}for(const _0x34282d of _0x3e969c){_0x21e75a[_0x205df6(0x279)](_0x34282d['id'],_0x34282d[_0x205df6(0x1ca)][_0x205df6(0x1c7)]);}for(const _0x4ba1c7 of _0x2d1d95){_0x477cc6[_0x205df6(0x279)](_0x4ba1c7['id'],_0x4ba1c7[_0x205df6(0x1ca)][_0x205df6(0x1c7)]);}const _0x5f5bf5={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x1cd8b5,'TextKnowledgeBase':_0x31e779,'Agent':_0x477cc6,'ExperimentalKnowledgeBase':_0x21e75a}),'resolvePromptName':async()=>undefined,'onWarning':_0x49d744=>this[_0x205df6(0x1ff)][_0x205df6(0x19f)](_0x49d744)},_0x57b2b1=a134_0x591fe4['join'](_0x4699a4,_0x205df6(0x1c6)),_0x5518c5=a134_0x591fe4[_0x205df6(0x21b)](_0x4699a4,'agent.yml'),_0x465d58=a134_0x591fe4[_0x205df6(0x21b)](_0x4699a4,_0x205df6(0x1cf)),_0x2a43e2=!a134_0x2f02d2[_0x205df6(0x1d0)](_0x5518c5);if(_0x566c09?.[_0x205df6(0x1af)])return{'agentName':_0x3954f6,'outputPath':_0x4699a4,'isNew':_0x2a43e2,'hasChanges':!![]};a134_0x2f02d2['mkdirSync'](_0x1a4092,{'recursive':!![]}),a134_0x2f02d2[_0x205df6(0x192)](_0x4699a4,{'recursive':!![]});const _0x1c2b6f=a134_0x591fe4[_0x205df6(0x21b)](_0x1a4092,'tdx.json');!a134_0x2f02d2[_0x205df6(0x1d0)](_0x1c2b6f)&&a134_0x2f02d2[_0x205df6(0x20b)](_0x1c2b6f,createAgentConfigContent(_0x13724a));const {yaml:_0x3d7dc6,systemPrompt:_0x5e199f,starterMessage:_0x50ec18}=await agentResponseToDef(_0x515d09,_0x5f5bf5);let _0x413847=_0x2a43e2;if(!_0x2a43e2){const _0x83a4be=a134_0x2f02d2[_0x205df6(0x1d0)](_0x57b2b1)?a134_0x2f02d2[_0x205df6(0x21f)](_0x57b2b1,_0x205df6(0x202)):'',_0x216b70=a134_0x2f02d2[_0x205df6(0x21f)](_0x5518c5,'utf-8');_0x413847=_0x83a4be!==_0x5e199f||_0x216b70!==toAgentYamlString(_0x3d7dc6);}a134_0x2f02d2[_0x205df6(0x20b)](_0x57b2b1,_0x5e199f),a134_0x2f02d2[_0x205df6(0x20b)](_0x5518c5,toAgentYamlString(_0x3d7dc6));if(_0x50ec18&&_0x50ec18[_0x205df6(0x1ed)]('\x0a'))a134_0x2f02d2[_0x205df6(0x20b)](_0x465d58,_0x50ec18);else a134_0x2f02d2[_0x205df6(0x1d0)](_0x465d58)&&a134_0x2f02d2['unlinkSync'](_0x465d58);return{'agentName':_0x3954f6,'outputPath':_0x4699a4,'isNew':_0x2a43e2,'hasChanges':_0x413847};}async[a134_0x5ec437(0x1c5)](_0x122ecf,_0x35638b){const _0xf5c15a=a134_0x5ec437;let _0x5b448d;isAgentYamlPath(_0x122ecf)?_0x5b448d=getAgentDirFromYamlPath(_0x122ecf):_0x5b448d=_0x122ecf;const {config:_0x1f37f2}=findAgentConfig(_0x5b448d),_0x192ded=await this[_0xf5c15a(0x21c)](_0x1f37f2['llm_project']),_0x305e17=a134_0x591fe4[_0xf5c15a(0x21b)](_0x5b448d,_0xf5c15a(0x15b)),_0x2efe71=a134_0x591fe4[_0xf5c15a(0x21b)](_0x5b448d,_0xf5c15a(0x1c6)),_0x5075cb=a134_0x591fe4['join'](_0x5b448d,_0xf5c15a(0x1cf));if(!a134_0x2f02d2[_0xf5c15a(0x1d0)](_0x305e17))throw new SDKError(ErrorCode[_0xf5c15a(0x275)],_0xf5c15a(0x250)+_0x5b448d,undefined,{'helpText':_0xf5c15a(0x15f)});const _0xd4f841=parseAgentYaml(a134_0x2f02d2[_0xf5c15a(0x21f)](_0x305e17,'utf-8'),_0x305e17),_0x4b1537=a134_0x2f02d2[_0xf5c15a(0x1d0)](_0x2efe71)?a134_0x2f02d2[_0xf5c15a(0x21f)](_0x2efe71,_0xf5c15a(0x202)):'',_0x20e7e9=a134_0x2f02d2[_0xf5c15a(0x1d0)](_0x5075cb)?a134_0x2f02d2[_0xf5c15a(0x21f)](_0x5075cb,_0xf5c15a(0x202)):_0xd4f841[_0xf5c15a(0x16d)];if(_0x35638b?.[_0xf5c15a(0x1af)])return{'agentName':_0xd4f841[_0xf5c15a(0x1c7)],'action':'created','projectId':_0x192ded};const _0x5587fa=await this[_0xf5c15a(0x276)][_0xf5c15a(0x165)](_0x192ded),_0x43607a=await fetchAllToolTargetMaps((_0x4dfa70,_0x165a51)=>this[_0xf5c15a(0x276)][_0xf5c15a(0x204)](_0x4dfa70,_0x165a51),_0x192ded),_0x2e9afd=new Map();for(const _0x42ec0e of _0x5587fa){_0x2e9afd['set'](_0x42ec0e[_0xf5c15a(0x1ca)][_0xf5c15a(0x1c7)],_0x42ec0e['id']);}const _0x2449bb=[],_0x507cfa={'projectId':_0x192ded,'resolveToolTargetId':buildIdResolver({..._0x43607a[_0xf5c15a(0x231)],'Agent':_0x2e9afd}),'resolvePromptId':async()=>undefined,'onWarning':_0x914588=>{const _0x17e160=_0xf5c15a;this['logger'][_0x17e160(0x19f)](_0x914588),_0x2449bb['push'](_0x914588);}};try{const _0x1f2b2b=_0x5587fa[_0xf5c15a(0x261)](_0x1ac6c9=>_0x1ac6c9[_0xf5c15a(0x1ca)]['name']===_0xd4f841[_0xf5c15a(0x1c7)]),_0x245c11=await agentDefToRequest(_0xd4f841,_0x4b1537,_0x20e7e9,_0x507cfa);if(_0x1f2b2b)return await this[_0xf5c15a(0x276)]['updateAgentResponse'](_0x1f2b2b['id'],_0x245c11),{'agentName':_0xd4f841[_0xf5c15a(0x1c7)],'action':_0xf5c15a(0x170),'projectId':_0x192ded,'agentId':_0x1f2b2b['id'],'warnings':_0x2449bb[_0xf5c15a(0x1b2)]>0x0?_0x2449bb:undefined};else{const _0xc2cdbf=await this[_0xf5c15a(0x276)][_0xf5c15a(0x186)](_0x245c11);return{'agentName':_0xd4f841[_0xf5c15a(0x1c7)],'action':_0xf5c15a(0x258),'projectId':_0x192ded,'agentId':_0xc2cdbf['id'],'warnings':_0x2449bb[_0xf5c15a(0x1b2)]>0x0?_0x2449bb:undefined};}}catch(_0x4b319b){return{'agentName':_0xd4f841['name'],'action':_0xf5c15a(0x1de),'projectId':_0x192ded,'error':_0x4b319b[_0xf5c15a(0x176)],'warnings':_0x2449bb[_0xf5c15a(0x1b2)]>0x0?_0x2449bb:undefined};}}async[a134_0x5ec437(0x238)](_0x3587e9,_0x3d8a1a,_0x15c30e){const _0x3d0bb1=a134_0x5ec437,_0x4bd856=a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x3587e9)&&a134_0x2f02d2[_0x3d0bb1(0x1d0)](a134_0x591fe4['join'](_0x3587e9,_0x3d0bb1(0x1d9)));let _0x2e9e8d;const _0xe1ef58=[],_0x5d457c=[],_0x2a39e4=[],_0x4c3cd3=[],_0x15af29=[],_0x373611=[],_0x1d1d12=[],_0x5ebac6=[],_0xe97f0a=[];if(_0x4bd856){const _0x2d3372=loadAgentConfig(a134_0x591fe4[_0x3d0bb1(0x21b)](_0x3587e9,_0x3d0bb1(0x1d9)));_0x2e9e8d=_0x2d3372[_0x3d0bb1(0x1a5)];const _0x4b3227=a134_0x2f02d2[_0x3d0bb1(0x1dd)](_0x3587e9,{'withFileTypes':!![]});for(const _0x5874f3 of _0x4b3227){if(!_0x5874f3[_0x3d0bb1(0x197)]())continue;if(['knowledge_bases','experimental_knowledge_bases','experimental_artifacts','prompts','integrations',_0x3d0bb1(0x1b1),_0x3d0bb1(0x21d)][_0x3d0bb1(0x1ed)](_0x5874f3[_0x3d0bb1(0x1c7)]))continue;const _0x79e473=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x3587e9,_0x5874f3[_0x3d0bb1(0x1c7)]);if(isAgentDir(_0x79e473)){const _0x3277eb=a134_0x591fe4['join'](_0x79e473,_0x3d0bb1(0x15b)),_0x3954dc=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x79e473,'prompt.md'),_0x24c872=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x79e473,_0x3d0bb1(0x1cf)),_0x4866a8=parseAgentYaml(a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x3277eb,_0x3d0bb1(0x202)),_0x3277eb),_0x48de45=a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x3954dc)?a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x3954dc,_0x3d0bb1(0x202)):'',_0x2d67e2=a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x24c872)?a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x24c872,_0x3d0bb1(0x202)):_0x4866a8[_0x3d0bb1(0x16d)];_0xe1ef58[_0x3d0bb1(0x240)]({'name':_0x4866a8[_0x3d0bb1(0x1c7)],'dir':_0x79e473,'yaml':_0x4866a8,'systemPrompt':_0x48de45,'starterMessage':_0x2d67e2});}}const _0x434cae=getKnowledgeBasesDir(_0x3587e9);if(a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x434cae)){const _0x536bf6=a134_0x2f02d2[_0x3d0bb1(0x1dd)](_0x434cae);for(const _0x177d7e of _0x536bf6){const _0x1c2200=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x434cae,_0x177d7e);if(_0x177d7e[_0x3d0bb1(0x25a)]('.yml')){const _0x38718b=parseKnowledgeBaseYaml(a134_0x2f02d2['readFileSync'](_0x1c2200,_0x3d0bb1(0x202)),_0x1c2200);_0x5d457c[_0x3d0bb1(0x240)]({'name':_0x38718b[_0x3d0bb1(0x1c7)],'path':_0x1c2200,'yaml':_0x38718b});}else{if(_0x177d7e[_0x3d0bb1(0x25a)](_0x3d0bb1(0x26e))){const _0x730446=a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x1c2200,'utf-8'),{name:_0x5a27bd,text:_0x40a7a1}=parseTextKnowledgeBaseMd(_0x730446,_0x177d7e);_0x2a39e4['push']({'name':_0x5a27bd,'path':_0x1c2200,'text':_0x40a7a1});}}}}const _0x49f59b=getPromptsDir(_0x3587e9);if(a134_0x2f02d2['existsSync'](_0x49f59b)){const _0x43cc2d=a134_0x2f02d2['readdirSync'](_0x49f59b)['filter'](_0x56a55f=>_0x56a55f[_0x3d0bb1(0x25a)]('.yml'));for(const _0x499fd6 of _0x43cc2d){const _0x14cb57=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x49f59b,_0x499fd6),_0x2a93a6=parsePromptYaml(a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x14cb57,_0x3d0bb1(0x202)),_0x14cb57);_0x4c3cd3[_0x3d0bb1(0x240)]({'name':_0x2a93a6[_0x3d0bb1(0x1c7)],'path':_0x14cb57,'yaml':_0x2a93a6});}}const _0x1b2d69=getIntegrationsDir(_0x3587e9);if(a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x1b2d69)){const _0xdcedcc=a134_0x2f02d2[_0x3d0bb1(0x1dd)](_0x1b2d69)['filter'](_0x2c3b8b=>_0x2c3b8b[_0x3d0bb1(0x25a)](_0x3d0bb1(0x220)));for(const _0x2bdb02 of _0xdcedcc){const _0x58b4a1=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x1b2d69,_0x2bdb02),_0x3f7dd6=parseIntegrationYaml(a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x58b4a1,_0x3d0bb1(0x202)),_0x58b4a1);SAFE_INTEGRATION_TYPES[_0x3d0bb1(0x1ed)](_0x3f7dd6[_0x3d0bb1(0x228)][_0x3d0bb1(0x18d)]())?_0x15af29[_0x3d0bb1(0x240)]({'name':_0x3f7dd6['name'],'path':_0x58b4a1,'yaml':_0x3f7dd6}):this[_0x3d0bb1(0x1ff)][_0x3d0bb1(0x19f)](_0x3d0bb1(0x269)+_0x3f7dd6[_0x3d0bb1(0x1c7)]+_0x3d0bb1(0x19a)+_0x3f7dd6[_0x3d0bb1(0x228)]+_0x3d0bb1(0x255)+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES[_0x3d0bb1(0x21b)](',\x20')+_0x3d0bb1(0x1e0)));}}const _0x3ecb43=getExperimentalKnowledgeBasesDir(_0x3587e9);if(a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x3ecb43)){const _0x4e7177=a134_0x2f02d2['readdirSync'](_0x3ecb43,{'withFileTypes':!![]});for(const _0x31159c of _0x4e7177){if(!_0x31159c['isDirectory']())continue;const _0x53f14a=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x3ecb43,_0x31159c[_0x3d0bb1(0x1c7)]),_0x177f14=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x53f14a,_0x31159c[_0x3d0bb1(0x1c7)]+_0x3d0bb1(0x220));if(a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x177f14)){const _0x13c764=parseExperimentalKnowledgeBaseYaml(a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x177f14,_0x3d0bb1(0x202)),_0x177f14),_0x5747e4=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x53f14a,'functions'),_0x4e7431=[];if(a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x5747e4)){const _0x5c55d5=a134_0x2f02d2[_0x3d0bb1(0x1dd)](_0x5747e4,{'withFileTypes':!![]});for(const _0x435b93 of _0x5c55d5){if(!_0x435b93['isDirectory']())continue;const _0x2e6a0c=a134_0x591fe4['join'](_0x5747e4,_0x435b93[_0x3d0bb1(0x1c7)]),_0x2e4862=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x2e6a0c,_0x3d0bb1(0x278)),_0x21f064=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x2e6a0c,_0x3d0bb1(0x166));if(a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x2e4862)&&a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x21f064)){const _0x729e30=a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x2e4862,_0x3d0bb1(0x202)),_0x5c3581=a134_0x2f02d2['readFileSync'](_0x21f064,'utf-8');_0x4e7431['push']({'name':_0x435b93[_0x3d0bb1(0x1c7)],'code':_0x729e30,'json_schema':_0x5c3581});}}}const _0x326003={..._0x13c764,'functions':_0x4e7431};_0x373611[_0x3d0bb1(0x240)]({'name':_0x13c764['name'],'path':_0x53f14a,'def':_0x326003});}}}const _0x4e10eb=getExperimentalArtifactsDir(_0x3587e9);if(a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x4e10eb)){const _0x457b63=a134_0x2f02d2['readdirSync'](_0x4e10eb,{'withFileTypes':!![]});for(const _0x1caf1d of _0x457b63){if(!_0x1caf1d[_0x3d0bb1(0x197)]())continue;const _0x3ea646=a134_0x591fe4['join'](_0x4e10eb,_0x1caf1d[_0x3d0bb1(0x1c7)]),_0x2e107e=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x3ea646,_0x1caf1d[_0x3d0bb1(0x1c7)]+_0x3d0bb1(0x220));if(a134_0x2f02d2['existsSync'](_0x2e107e)){const _0xf270a4=parseExperimentalArtifactYaml(a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x2e107e,'utf-8'),_0x2e107e),_0x216cf6=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x3ea646,_0x3d0bb1(0x278)),_0x3bec17=a134_0x2f02d2['existsSync'](_0x216cf6)?a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x216cf6,_0x3d0bb1(0x202)):'',_0x4e702e=a134_0x591fe4['join'](_0x3ea646,'files'),_0x4db3c3=[];if(a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x4e702e)){const _0xe1a619=a134_0x2f02d2[_0x3d0bb1(0x1dd)](_0x4e702e);for(const _0x4dea50 of _0xe1a619){const _0x4b4b11=a134_0x591fe4['join'](_0x4e702e,_0x4dea50);if(a134_0x2f02d2[_0x3d0bb1(0x161)](_0x4b4b11)[_0x3d0bb1(0x20f)]()){const _0x441378=a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x4b4b11,_0x3d0bb1(0x202));_0x4db3c3[_0x3d0bb1(0x240)]({'file_name':_0x4dea50,'text_content':_0x441378});}}}const _0x29298c={..._0xf270a4,'code':_0x3bec17,'files':_0x4db3c3};_0x1d1d12[_0x3d0bb1(0x240)]({'name':_0xf270a4[_0x3d0bb1(0x1c7)],'path':_0x3ea646,'def':_0x29298c});}}}const _0x66fa2d=getFormInterfacesDir(_0x3587e9);if(a134_0x2f02d2['existsSync'](_0x66fa2d)){const _0x2af751=a134_0x2f02d2[_0x3d0bb1(0x1dd)](_0x66fa2d)['filter'](_0x5babee=>_0x5babee[_0x3d0bb1(0x25a)]('.yml'));for(const _0x3328a8 of _0x2af751){const _0x2340a6=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x66fa2d,_0x3328a8),_0x12b821=parseFormInterfaceYaml(a134_0x2f02d2['readFileSync'](_0x2340a6,_0x3d0bb1(0x202)),_0x2340a6);_0x5ebac6[_0x3d0bb1(0x240)]({'name':_0x12b821['name'],'path':_0x2340a6,'yaml':_0x12b821});}}const _0x25f932=getChatInterfacesDir(_0x3587e9);if(a134_0x2f02d2['existsSync'](_0x25f932)){const _0xd79acf=a134_0x2f02d2[_0x3d0bb1(0x1dd)](_0x25f932)['filter'](_0x2c8e44=>_0x2c8e44[_0x3d0bb1(0x25a)](_0x3d0bb1(0x220)));for(const _0xf9a0d4 of _0xd79acf){const _0x3a8409=a134_0x591fe4['join'](_0x25f932,_0xf9a0d4),_0xff9343=parseChatInterfaceYaml(a134_0x2f02d2['readFileSync'](_0x3a8409,_0x3d0bb1(0x202)),_0x3a8409);_0xe97f0a[_0x3d0bb1(0x240)]({'name':_0xff9343[_0x3d0bb1(0x1c7)],'path':_0x3a8409,'yaml':_0xff9343});}}}else{const _0x5774c5=await this[_0x3d0bb1(0x21c)](_0x3587e9),_0x595ff4=await this[_0x3d0bb1(0x276)]['getProject'](_0x5774c5);_0x2e9e8d=_0x595ff4[_0x3d0bb1(0x1ca)][_0x3d0bb1(0x1c7)];const _0xb3b207=await this['client']['listAgentsFull'](_0x5774c5),_0x5dc0ec=await this[_0x3d0bb1(0x276)]['listKnowledgeBases'](_0x5774c5),_0x26e151=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x1cd)](_0x5774c5),_0x4b4c67=await this[_0x3d0bb1(0x276)]['listPrompts'](_0x5774c5),_0x2c594f=await this[_0x3d0bb1(0x276)]['listIntegrations'](_0x5774c5),_0x507b42=await safeListOrEmpty(()=>this['client'][_0x3d0bb1(0x200)](_0x5774c5)),_0x1aa5dc=await safeListOrEmpty(()=>this['client'][_0x3d0bb1(0x178)](_0x5774c5)),_0x42b62a=new Map(),_0x30597a=new Map(),_0x431ffd=new Map(),_0x1a4f70=new Map(),_0xc87e4c=new Map(),_0x58cebf=new Map();for(const _0x2bdde9 of _0x5dc0ec){_0x42b62a[_0x3d0bb1(0x279)](_0x2bdde9['id'],_0x2bdde9['attributes'][_0x3d0bb1(0x1c7)]);}for(const _0x37a3b5 of _0x26e151){_0x30597a[_0x3d0bb1(0x279)](_0x37a3b5['id'],_0x37a3b5[_0x3d0bb1(0x1ca)][_0x3d0bb1(0x1c7)]);}for(const _0x19b4fe of _0xb3b207){_0x431ffd['set'](_0x19b4fe['id'],_0x19b4fe[_0x3d0bb1(0x1ca)][_0x3d0bb1(0x1c7)]);}for(const _0x2b203a of _0x4b4c67){_0x1a4f70[_0x3d0bb1(0x279)](_0x2b203a['id'],_0x2b203a[_0x3d0bb1(0x1ca)][_0x3d0bb1(0x1c7)]);}for(const _0x4db3d5 of _0x507b42){_0xc87e4c[_0x3d0bb1(0x279)](_0x4db3d5['id'],_0x4db3d5[_0x3d0bb1(0x1ca)]['name']);}for(const _0x10f004 of _0x1aa5dc){_0x58cebf[_0x3d0bb1(0x279)](_0x10f004['id'],_0x10f004['attributes'][_0x3d0bb1(0x1c7)]);}const _0x2afc90={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x42b62a,'TextKnowledgeBase':_0x30597a,'Agent':_0x431ffd,'ExperimentalKnowledgeBase':_0xc87e4c}),'resolvePromptName':async _0x15d9cf=>_0x1a4f70[_0x3d0bb1(0x26f)](_0x15d9cf),'onWarning':_0x31e923=>this[_0x3d0bb1(0x1ff)]['warn'](_0x31e923)};for(const _0x201f05 of _0xb3b207){const _0x3fdbce=await agentResponseToDef(_0x201f05,_0x2afc90),{yaml:_0x27c134,systemPrompt:_0x2b3d40,starterMessage:_0x4beb12}=_0x3fdbce;_0xe1ef58['push']({'name':_0x27c134[_0x3d0bb1(0x1c7)],'dir':'','yaml':_0x27c134,'systemPrompt':_0x2b3d40,'starterMessage':_0x4beb12});}for(const _0x5a3a93 of _0x5dc0ec){const _0x535127=apiKnowledgeBaseToYaml(_0x5a3a93);_0x5d457c[_0x3d0bb1(0x240)]({'name':_0x535127[_0x3d0bb1(0x1c7)],'path':'','yaml':_0x535127});}for(const _0x5bd397 of _0x26e151){_0x2a39e4[_0x3d0bb1(0x240)]({'name':_0x5bd397[_0x3d0bb1(0x1ca)][_0x3d0bb1(0x1c7)],'path':'','text':_0x5bd397['attributes'][_0x3d0bb1(0x180)]});}for(const _0x472f70 of _0x4b4c67){const _0x322c83=await apiPromptToYaml(_0x472f70,_0x2afc90);_0x322c83&&_0x4c3cd3[_0x3d0bb1(0x240)]({'name':_0x322c83[_0x3d0bb1(0x1c7)],'path':'','yaml':_0x322c83});}for(const _0x259a76 of _0x2c594f){if(!_0x259a76[_0x3d0bb1(0x1ca)][_0x3d0bb1(0x257)]&&SAFE_INTEGRATION_TYPES[_0x3d0bb1(0x1ed)](_0x259a76[_0x3d0bb1(0x1ca)]['serviceType'][_0x3d0bb1(0x18d)]())){const _0x43a54e=await apiIntegrationToYaml(_0x259a76,_0x2afc90);_0x15af29[_0x3d0bb1(0x240)]({'name':_0x259a76[_0x3d0bb1(0x1ca)][_0x3d0bb1(0x23e)]['toLowerCase'](),'path':'','yaml':_0x43a54e});}}for(const _0x12e4d2 of _0x507b42){const _0x4310c8=apiExperimentalKnowledgeBaseToYaml(_0x12e4d2);_0x373611[_0x3d0bb1(0x240)]({'name':_0x4310c8[_0x3d0bb1(0x1c7)],'path':'','def':_0x4310c8});}for(const _0x3d72b7 of _0x1aa5dc){const _0x4621b7=apiExperimentalArtifactToYaml(_0x3d72b7);_0x1d1d12[_0x3d0bb1(0x240)]({'name':_0x4621b7[_0x3d0bb1(0x1c7)],'path':'','def':_0x4621b7});}const _0x1440be=await safeListOrEmpty(()=>this[_0x3d0bb1(0x276)][_0x3d0bb1(0x177)](_0x5774c5));for(const _0x5274fe of _0x1440be){const _0x1d22e9=await apiFormInterfaceToYaml(_0x5274fe,_0x2afc90);_0x5ebac6[_0x3d0bb1(0x240)]({'name':_0x1d22e9[_0x3d0bb1(0x1c7)],'path':'','yaml':_0x1d22e9});}const _0x3b742f=await safeListOrEmpty(()=>this[_0x3d0bb1(0x276)][_0x3d0bb1(0x236)](_0x5774c5));for(const _0x17566b of _0x3b742f){if(_0x17566b['attributes'][_0x3d0bb1(0x257)])continue;const _0x189171=await apiChatInterfaceToYaml(_0x17566b,_0x2afc90);_0xe97f0a['push']({'name':_0x189171['name'],'path':'','yaml':_0x189171});}}const _0x53f636={'sourceProjectName':_0x2e9e8d,'newProjectName':_0x3d8a1a,'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}}},_0x49081b=await this['client']['listProjects'](),_0x227a45=_0x49081b[_0x3d0bb1(0x261)](_0x1154a7=>_0x1154a7[_0x3d0bb1(0x1ca)]['name']===_0x3d8a1a);if(_0x227a45)throw new SDKError(ErrorCode[_0x3d0bb1(0x1a8)],_0x3d0bb1(0x1be)+_0x3d8a1a+_0x3d0bb1(0x272),undefined,{'helpText':_0x3d0bb1(0x164)});if(_0x15c30e?.[_0x3d0bb1(0x1af)])return _0x53f636[_0x3d0bb1(0x20c)]['agents'][_0x3d0bb1(0x258)]=_0xe1ef58[_0x3d0bb1(0x1b2)],_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x253)][_0x3d0bb1(0x258)]=_0x5d457c['length'],_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x260)][_0x3d0bb1(0x258)]=_0x2a39e4[_0x3d0bb1(0x1b2)],_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x264)][_0x3d0bb1(0x258)]=_0x373611[_0x3d0bb1(0x1b2)],_0x53f636[_0x3d0bb1(0x20c)]['experimentalArtifacts']['created']=_0x1d1d12[_0x3d0bb1(0x1b2)],_0x53f636['counts']['prompts']['created']=_0x4c3cd3[_0x3d0bb1(0x1b2)],_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x196)][_0x3d0bb1(0x258)]=_0x15af29[_0x3d0bb1(0x1b2)],_0x53f636;const _0x2a042a=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x1df)]({'name':_0x3d8a1a}),_0xe6233=_0x2a042a['id'];_0x53f636['newProjectId']=_0xe6233;const _0x512677=new Map(),_0x2c4133=new Map(),_0x1c589f=new Map(),_0x102b9f=new Map(),_0x10741b=new Map(),_0x941e82=new Map(),_0x213e4f=new Map(),_0x222706=new Map(),_0x230bdc=new Set(),_0x5e9f00=new Set();for(const _0x523668 of _0xe1ef58){for(const _0xf3419d of _0x523668[_0x3d0bb1(0x262)][_0x3d0bb1(0x22b)]||[]){if(_0xf3419d['type']==='image_gen'&&_0xf3419d['target']){const _0x45ee15=parseRef(_0xf3419d[_0x3d0bb1(0x201)]);if(_0x45ee15)_0x230bdc['add'](_0x45ee15['name']);}else{if(_0xf3419d[_0x3d0bb1(0x1d4)]===_0x3d0bb1(0x1ef)&&_0xf3419d[_0x3d0bb1(0x201)]){const _0x3624dd=parseRef(_0xf3419d[_0x3d0bb1(0x201)]);if(_0x3624dd)_0x5e9f00[_0x3d0bb1(0x222)](_0x3624dd[_0x3d0bb1(0x1c7)]);}}}}for(const _0x2b92d7 of _0x230bdc){try{const _0x2f2282=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x22f)]({'projectId':_0xe6233,'name':_0x2b92d7});_0x10741b[_0x3d0bb1(0x279)](_0x2b92d7,_0x2f2282['id']),_0x53f636[_0x3d0bb1(0x1ac)][_0x3d0bb1(0x240)]({'name':_0x2b92d7,'action':_0x3d0bb1(0x258),'id':_0x2f2282['id']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x1ac)][_0x3d0bb1(0x258)]++;}catch(_0xdaf246){_0x53f636[_0x3d0bb1(0x1ac)][_0x3d0bb1(0x240)]({'name':_0x2b92d7,'action':_0x3d0bb1(0x1de),'error':_0xdaf246['message']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x1ac)][_0x3d0bb1(0x1e8)]++;}}for(const _0x59643f of _0x5e9f00){try{const _0x48c149=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x1c0)]({'projectId':_0xe6233,'name':_0x59643f});_0x941e82[_0x3d0bb1(0x279)](_0x59643f,_0x48c149['id']),_0x53f636[_0x3d0bb1(0x243)][_0x3d0bb1(0x240)]({'name':_0x59643f,'action':_0x3d0bb1(0x258),'id':_0x48c149['id']}),_0x53f636['counts'][_0x3d0bb1(0x243)][_0x3d0bb1(0x258)]++;}catch(_0x428467){_0x53f636['webSearchTools'][_0x3d0bb1(0x240)]({'name':_0x59643f,'action':_0x3d0bb1(0x1de),'error':_0x428467[_0x3d0bb1(0x176)]}),_0x53f636[_0x3d0bb1(0x20c)]['webSearchTools'][_0x3d0bb1(0x1e8)]++;}}const _0x5be236=await fetchAllToolTargetMaps((_0x5ef782,_0x91f50)=>this[_0x3d0bb1(0x276)][_0x3d0bb1(0x204)](_0x5ef782,_0x91f50),_0xe6233);let _0x170ae9=[];const _0x3dbbd4={'projectId':_0xe6233,'resolveToolTargetId':buildIdResolver({..._0x5be236[_0x3d0bb1(0x231)],'KnowledgeBase':_0x512677,'TextKnowledgeBase':_0x2c4133,'ExperimentalKnowledgeBase':_0x213e4f,'Agent':_0x1c589f,'WebSearchTool':_0x941e82,'ImageGenerator':_0x10741b}),'resolvePromptId':async _0x5b6d5b=>_0x102b9f[_0x3d0bb1(0x26f)](_0x5b6d5b),'onWarning':_0xf92c54=>{const _0x5468b4=_0x3d0bb1;this[_0x5468b4(0x1ff)]['warn'](_0xf92c54),_0x170ae9[_0x5468b4(0x240)](_0xf92c54);}};for(const _0x235624 of _0x5d457c){try{const _0x38952d=yamlKnowledgeBaseToApi(_0x235624[_0x3d0bb1(0x262)],_0xe6233),_0x4d94e1=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x1d5)](_0x38952d);_0x512677[_0x3d0bb1(0x279)](_0x235624[_0x3d0bb1(0x262)][_0x3d0bb1(0x1c7)],_0x4d94e1['id']),_0x53f636[_0x3d0bb1(0x253)][_0x3d0bb1(0x240)]({'name':_0x235624[_0x3d0bb1(0x262)][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x258),'id':_0x4d94e1['id']}),_0x53f636[_0x3d0bb1(0x20c)]['knowledgeBases'][_0x3d0bb1(0x258)]++;}catch(_0x3d1a23){_0x53f636[_0x3d0bb1(0x253)][_0x3d0bb1(0x240)]({'name':_0x235624[_0x3d0bb1(0x262)]['name'],'action':'error','error':_0x3d1a23[_0x3d0bb1(0x176)]}),_0x53f636[_0x3d0bb1(0x20c)]['knowledgeBases'][_0x3d0bb1(0x1e8)]++;}}for(const _0x1c780a of _0x2a39e4){try{const _0x758497=yamlTextKnowledgeBaseToApi({'name':_0x1c780a[_0x3d0bb1(0x1c7)],'text':_0x1c780a['text']},_0xe6233),_0xc0996d=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x19d)](_0x758497);_0x2c4133['set'](_0x1c780a['name'],_0xc0996d['id']),_0x53f636[_0x3d0bb1(0x260)][_0x3d0bb1(0x240)]({'name':_0x1c780a[_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x258),'id':_0xc0996d['id']}),_0x53f636[_0x3d0bb1(0x20c)]['textKnowledgeBases'][_0x3d0bb1(0x258)]++;}catch(_0x2b0ec1){_0x53f636['textKnowledgeBases'][_0x3d0bb1(0x240)]({'name':_0x1c780a[_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x1de),'error':_0x2b0ec1['message']}),_0x53f636[_0x3d0bb1(0x20c)]['textKnowledgeBases'][_0x3d0bb1(0x1e8)]++;}}for(const _0x199d4c of _0x1d1d12){try{const _0x29790b=yamlExperimentalArtifactToApi(_0x199d4c[_0x3d0bb1(0x252)],_0xe6233),_0x37569a=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x215)](_0x29790b);_0x222706[_0x3d0bb1(0x279)](_0x199d4c['def'][_0x3d0bb1(0x1c7)],_0x37569a['id']),_0x53f636['experimentalArtifacts'][_0x3d0bb1(0x240)]({'name':_0x199d4c[_0x3d0bb1(0x252)][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x258),'id':_0x37569a['id']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x229)][_0x3d0bb1(0x258)]++;}catch(_0x59dcfa){_0x53f636[_0x3d0bb1(0x229)]['push']({'name':_0x199d4c['def'][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x1de),'error':_0x59dcfa[_0x3d0bb1(0x176)]}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x229)]['errors']++;}}for(const _0x2e3edc of _0x373611){try{const _0x2e08dd=yamlExperimentalKnowledgeBaseToApi(_0x2e3edc['def'],_0xe6233),_0x4b9aa1=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x1d7)](_0x2e08dd);_0x213e4f[_0x3d0bb1(0x279)](_0x2e3edc[_0x3d0bb1(0x252)][_0x3d0bb1(0x1c7)],_0x4b9aa1['id']),_0x53f636[_0x3d0bb1(0x264)]['push']({'name':_0x2e3edc[_0x3d0bb1(0x252)][_0x3d0bb1(0x1c7)],'action':'created','id':_0x4b9aa1['id']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x264)][_0x3d0bb1(0x258)]++;}catch(_0x191838){_0x53f636['experimentalKnowledgeBases'][_0x3d0bb1(0x240)]({'name':_0x2e3edc['def'][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x1de),'error':_0x191838[_0x3d0bb1(0x176)]}),_0x53f636[_0x3d0bb1(0x20c)]['experimentalKnowledgeBases'][_0x3d0bb1(0x1e8)]++;}}const _0x326dbe=[..._0xe1ef58][_0x3d0bb1(0x16a)]((_0xf19875,_0x30c42d)=>{const _0x4964b9=_0x3d0bb1,_0x8ea90a=_0xf19875[_0x4964b9(0x262)]['tools']?.[_0x4964b9(0x224)](_0x420a75=>_0x420a75['type']===_0x4964b9(0x1fa))??![],_0x9d6a62=_0x30c42d['yaml'][_0x4964b9(0x22b)]?.[_0x4964b9(0x224)](_0x5b93e7=>_0x5b93e7['type']==='agent')??![];if(_0x8ea90a&&!_0x9d6a62)return 0x1;if(!_0x8ea90a&&_0x9d6a62)return-0x1;return 0x0;});for(const _0x2c8b78 of _0x326dbe){_0x170ae9=[];try{const _0x4baee3=_0x2c8b78['yaml'][_0x3d0bb1(0x22b)]?.[_0x3d0bb1(0x26b)](_0x4eb5db=>{const _0x45619b=_0x3d0bb1;if(_0x4eb5db['type']===_0x45619b(0x1fa)&&_0x4eb5db['target']){const _0x3af507=parseRef(_0x4eb5db[_0x45619b(0x201)]);return _0x3af507?.[_0x45619b(0x1c7)]===_0x2c8b78['yaml'][_0x45619b(0x1c7)];}return![];})??[];if(_0x4baee3[_0x3d0bb1(0x1b2)]>0x0){const _0x2b4b20=_0x3d0bb1(0x207)+_0x2c8b78[_0x3d0bb1(0x262)]['name']+_0x3d0bb1(0x1bc)+_0x3d0bb1(0x1a7);this[_0x3d0bb1(0x1ff)][_0x3d0bb1(0x19f)](_0x2b4b20),_0x170ae9[_0x3d0bb1(0x240)](_0x2b4b20);}const _0x4aa29c=await agentDefToRequest(_0x2c8b78[_0x3d0bb1(0x262)],_0x2c8b78[_0x3d0bb1(0x25c)],_0x2c8b78[_0x3d0bb1(0x20a)],_0x3dbbd4),_0x1c5352=await this['client'][_0x3d0bb1(0x186)](_0x4aa29c);_0x1c589f[_0x3d0bb1(0x279)](_0x2c8b78[_0x3d0bb1(0x262)][_0x3d0bb1(0x1c7)],_0x1c5352['id']),_0x53f636[_0x3d0bb1(0x1fb)][_0x3d0bb1(0x240)]({'agentName':_0x2c8b78['yaml'][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x258),'agentId':_0x1c5352['id'],'warnings':_0x170ae9['length']>0x0?_0x170ae9:undefined}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x1fb)][_0x3d0bb1(0x258)]++;}catch(_0x13d417){_0x53f636['agents'][_0x3d0bb1(0x240)]({'agentName':_0x2c8b78[_0x3d0bb1(0x262)][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x1de),'error':_0x13d417['message'],'warnings':_0x170ae9[_0x3d0bb1(0x1b2)]>0x0?_0x170ae9:undefined}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x1fb)][_0x3d0bb1(0x1e8)]++;}}for(const _0x18055e of _0x4c3cd3){try{const _0x38dace=await yamlPromptToApi(_0x18055e['yaml'],_0xe6233,_0x3dbbd4);if(!_0x38dace){_0x53f636[_0x3d0bb1(0x21e)]['push']({'name':_0x18055e['yaml'][_0x3d0bb1(0x1c7)],'action':'error','error':_0x3d0bb1(0x1e3)}),_0x53f636['counts']['prompts'][_0x3d0bb1(0x1e8)]++;continue;}const _0x28b666=await this['client'][_0x3d0bb1(0x162)](_0x38dace);_0x102b9f[_0x3d0bb1(0x279)](_0x18055e[_0x3d0bb1(0x262)][_0x3d0bb1(0x1c7)],_0x28b666['id']),_0x53f636[_0x3d0bb1(0x21e)][_0x3d0bb1(0x240)]({'name':_0x18055e[_0x3d0bb1(0x262)]['name'],'action':'created','id':_0x28b666['id']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x21e)][_0x3d0bb1(0x258)]++;}catch(_0x3789d0){_0x53f636['prompts'][_0x3d0bb1(0x240)]({'name':_0x18055e[_0x3d0bb1(0x262)][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x1de),'error':_0x3789d0['message']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x21e)][_0x3d0bb1(0x1e8)]++;}}for(const _0x3e3459 of _0x15af29){try{const _0x47e01c=await yamlIntegrationToApi(_0x3e3459[_0x3d0bb1(0x262)],_0xe6233,_0x3dbbd4),_0x254f96=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x199)](_0x47e01c);_0x53f636['integrations'][_0x3d0bb1(0x240)]({'name':_0x3e3459[_0x3d0bb1(0x262)]['service_type'],'action':'created','id':_0x254f96['id']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x196)][_0x3d0bb1(0x258)]++;}catch(_0x310ef5){_0x53f636['integrations'][_0x3d0bb1(0x240)]({'name':_0x3e3459['yaml'][_0x3d0bb1(0x228)],'action':_0x3d0bb1(0x1de),'error':_0x310ef5[_0x3d0bb1(0x176)]}),_0x53f636[_0x3d0bb1(0x20c)]['integrations']['errors']++;}}for(const _0x31237f of _0x5ebac6){try{const _0x494f60=await yamlFormInterfaceToApi(_0x31237f[_0x3d0bb1(0x262)],_0xe6233,_0x3dbbd4);if(!_0x494f60){_0x53f636['formInterfaces'][_0x3d0bb1(0x240)]({'name':_0x31237f['yaml'][_0x3d0bb1(0x1c7)],'action':'error','error':_0x3d0bb1(0x1fd)}),_0x53f636['counts'][_0x3d0bb1(0x22d)][_0x3d0bb1(0x1e8)]++;continue;}const _0x22c381=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x1d3)](_0x494f60);_0x53f636[_0x3d0bb1(0x22d)][_0x3d0bb1(0x240)]({'name':_0x31237f[_0x3d0bb1(0x262)][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x258),'id':_0x22c381['id']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x22d)][_0x3d0bb1(0x258)]++;}catch(_0x262739){_0x53f636['formInterfaces'][_0x3d0bb1(0x240)]({'name':_0x31237f[_0x3d0bb1(0x262)]['name'],'action':_0x3d0bb1(0x1de),'error':_0x262739['message']}),_0x53f636['counts'][_0x3d0bb1(0x22d)][_0x3d0bb1(0x1e8)]++;}}for(const _0x1b770f of _0xe97f0a){try{const _0x5792c9=await yamlChatInterfaceToApi(_0x1b770f[_0x3d0bb1(0x262)],_0xe6233,_0x3dbbd4),_0x9477ae=await this['client']['createChatInterface'](_0x5792c9);_0x53f636['chatInterfaces']['push']({'name':_0x1b770f['yaml'][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x258),'id':_0x9477ae['id']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x169)]['created']++;}catch(_0x139d55){_0x53f636['chatInterfaces']['push']({'name':_0x1b770f['yaml'][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x1de),'error':_0x139d55['message']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x169)][_0x3d0bb1(0x1e8)]++;}}return _0x53f636;}}