@treasuredata/tdx 2026.4.21 → 2026.4.22

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 (231) 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.d.ts.map +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-command.js.map +1 -1
  16. package/dist/commands/claude-statusline-command.js +1 -1
  17. package/dist/commands/claude-usage-command.js +1 -1
  18. package/dist/commands/command.js +1 -1
  19. package/dist/commands/connection-command.js +1 -1
  20. package/dist/commands/databases.js +1 -1
  21. package/dist/commands/delivery-command.js +1 -1
  22. package/dist/commands/describe.js +1 -1
  23. package/dist/commands/engage-campaign-pull-command.js +1 -1
  24. package/dist/commands/engage-campaign-push-command.js +1 -1
  25. package/dist/commands/engage-campaign-validate-command.js +1 -1
  26. package/dist/commands/engage-command.js +1 -1
  27. package/dist/commands/engage-template-pull-command.js +1 -1
  28. package/dist/commands/engage-template-push-command.js +1 -1
  29. package/dist/commands/engage-template-validate-command.js +1 -1
  30. package/dist/commands/job-command.js +1 -1
  31. package/dist/commands/journey-command.js +1 -1
  32. package/dist/commands/journey-validate-command.js +1 -1
  33. package/dist/commands/llm-command.js +1 -1
  34. package/dist/commands/mcp-command.js +1 -1
  35. package/dist/commands/parent-segment-command.js +1 -1
  36. package/dist/commands/policy-command.js +1 -1
  37. package/dist/commands/profile-command.js +1 -1
  38. package/dist/commands/profiles-command.js +1 -1
  39. package/dist/commands/query-command.js +1 -1
  40. package/dist/commands/schedule-command.js +1 -1
  41. package/dist/commands/segment-command.js +1 -1
  42. package/dist/commands/segment-create-command.js +1 -1
  43. package/dist/commands/segment-fields-command.js +1 -1
  44. package/dist/commands/segment-pull-command.js +1 -1
  45. package/dist/commands/segment-push-command.js +1 -1
  46. package/dist/commands/segment-update-command.js +1 -1
  47. package/dist/commands/segment-use-command.js +1 -1
  48. package/dist/commands/segment-validate-command.js +1 -1
  49. package/dist/commands/segments.js +1 -1
  50. package/dist/commands/show.js +1 -1
  51. package/dist/commands/status-command.js +1 -1
  52. package/dist/commands/tables.js +1 -1
  53. package/dist/commands/unset-command.js +1 -1
  54. package/dist/commands/upgrade-command.js +1 -1
  55. package/dist/commands/use-command.js +1 -1
  56. package/dist/commands/user-command.js +1 -1
  57. package/dist/commands/work-command.js +1 -1
  58. package/dist/commands/workflow-command.js +1 -1
  59. package/dist/core/auth.js +1 -1
  60. package/dist/core/command-output.js +1 -1
  61. package/dist/core/config.js +1 -1
  62. package/dist/core/connection-cache.js +1 -1
  63. package/dist/core/constants.js +1 -1
  64. package/dist/core/credential-cache.js +1 -1
  65. package/dist/core/global-context.js +1 -1
  66. package/dist/core/keychain.js +1 -1
  67. package/dist/core/oauth-keychain.js +1 -1
  68. package/dist/core/oauth.js +1 -1
  69. package/dist/core/profile.js +1 -1
  70. package/dist/core/project-config.js +1 -1
  71. package/dist/core/session.js +1 -1
  72. package/dist/core/user-cache.js +1 -1
  73. package/dist/core/version.js +1 -1
  74. package/dist/index.js +1 -1
  75. package/dist/mcp/server.js +1 -1
  76. package/dist/mcp/tools/index.js +1 -1
  77. package/dist/mcp/tools/tdx-run.js +1 -1
  78. package/dist/mcp/tools/tdx-search.js +1 -1
  79. package/dist/mcp/tools/work-create-item.js +1 -1
  80. package/dist/mcp/utils.js +1 -1
  81. package/dist/proxy/claude-usage-tracker.d.ts.map +1 -1
  82. package/dist/proxy/claude-usage-tracker.js +1 -1
  83. package/dist/proxy/claude-usage-tracker.js.map +1 -1
  84. package/dist/proxy/passthrough-server.d.ts +10 -0
  85. package/dist/proxy/passthrough-server.d.ts.map +1 -1
  86. package/dist/proxy/passthrough-server.js +1 -1
  87. package/dist/proxy/passthrough-server.js.map +1 -1
  88. package/dist/proxy/sse-usage-parser.js +1 -1
  89. package/dist/sdk/agent/agent-config.js +1 -1
  90. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  91. package/dist/sdk/agent/agent-yaml.js +1 -1
  92. package/dist/sdk/agent/test/evaluator.js +1 -1
  93. package/dist/sdk/agent/test/executor.js +1 -1
  94. package/dist/sdk/agent/test/index.js +1 -1
  95. package/dist/sdk/agent/test/output.js +1 -1
  96. package/dist/sdk/agent/test/parser.js +1 -1
  97. package/dist/sdk/agent/tool-target-registry.js +1 -1
  98. package/dist/sdk/api.js +1 -1
  99. package/dist/sdk/cas/cas-api-client.js +1 -1
  100. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  101. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  102. package/dist/sdk/cas/index.js +1 -1
  103. package/dist/sdk/cas/pull-workflow.js +1 -1
  104. package/dist/sdk/cas/push-workflow.js +1 -1
  105. package/dist/sdk/client/cdp-api-client.js +1 -1
  106. package/dist/sdk/client/delivery-api-client.js +1 -1
  107. package/dist/sdk/client/endpoints.js +1 -1
  108. package/dist/sdk/client/engage-api-client.js +1 -1
  109. package/dist/sdk/client/http-client.js +1 -1
  110. package/dist/sdk/client/llm-api-client.js +1 -1
  111. package/dist/sdk/client/oauth-refresh.js +1 -1
  112. package/dist/sdk/client/rate-limiter.js +1 -1
  113. package/dist/sdk/client/td-api-client.js +1 -1
  114. package/dist/sdk/client/trino-api-client.js +1 -1
  115. package/dist/sdk/client/workflow-client.js +1 -1
  116. package/dist/sdk/connection-validator.js +1 -1
  117. package/dist/sdk/connection.js +1 -1
  118. package/dist/sdk/delivery.js +1 -1
  119. package/dist/sdk/engage/campaign-pull.js +1 -1
  120. package/dist/sdk/engage/campaign-push.js +1 -1
  121. package/dist/sdk/engage/campaign-validator.js +1 -1
  122. package/dist/sdk/engage/campaign-yaml.js +1 -1
  123. package/dist/sdk/engage/template-pull.js +1 -1
  124. package/dist/sdk/engage/template-push.js +1 -1
  125. package/dist/sdk/engage/template-validator.js +1 -1
  126. package/dist/sdk/engage/template-yaml.js +1 -1
  127. package/dist/sdk/engage/types/campaign-def.js +1 -1
  128. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  129. package/dist/sdk/engage/types/template-schema.js +1 -1
  130. package/dist/sdk/engage.js +1 -1
  131. package/dist/sdk/errors.js +1 -1
  132. package/dist/sdk/index.js +1 -1
  133. package/dist/sdk/io/index.js +1 -1
  134. package/dist/sdk/io/node-filesystem.js +1 -1
  135. package/dist/sdk/job.js +1 -1
  136. package/dist/sdk/journey.js +1 -1
  137. package/dist/sdk/llm/chat-cache.js +1 -1
  138. package/dist/sdk/llm/index.js +1 -1
  139. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  140. package/dist/sdk/llm/model-factors.d.ts +33 -9
  141. package/dist/sdk/llm/model-factors.d.ts.map +1 -1
  142. package/dist/sdk/llm/model-factors.js +1 -1
  143. package/dist/sdk/llm/model-factors.js.map +1 -1
  144. package/dist/sdk/personalization.js +1 -1
  145. package/dist/sdk/policy.js +1 -1
  146. package/dist/sdk/query/index.js +1 -1
  147. package/dist/sdk/query/sql-parser.js +1 -1
  148. package/dist/sdk/realtime.js +1 -1
  149. package/dist/sdk/schedule.js +1 -1
  150. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  151. package/dist/sdk/segment/fields-display.js +1 -1
  152. package/dist/sdk/segment/file-discovery.js +1 -1
  153. package/dist/sdk/segment/journey-utils.js +1 -1
  154. package/dist/sdk/segment/journey-validator.js +1 -1
  155. package/dist/sdk/segment/journey-yaml.js +1 -1
  156. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  157. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  158. package/dist/sdk/segment/pull-workflow.js +1 -1
  159. package/dist/sdk/segment/push-recovery.js +1 -1
  160. package/dist/sdk/segment/push-workflow.js +1 -1
  161. package/dist/sdk/segment/resolution-context.js +1 -1
  162. package/dist/sdk/segment/segment-path-parser.js +1 -1
  163. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  164. package/dist/sdk/segment/segment-validator.js +1 -1
  165. package/dist/sdk/segment/target-resolution.js +1 -1
  166. package/dist/sdk/segment/tdx-config.js +1 -1
  167. package/dist/sdk/segment/types/activation-schema.js +1 -1
  168. package/dist/sdk/segment/types/journey-def.js +1 -1
  169. package/dist/sdk/segment/types/journey-schema.js +1 -1
  170. package/dist/sdk/segment/types/segment-def.js +1 -1
  171. package/dist/sdk/segment/types/segment-schema.js +1 -1
  172. package/dist/sdk/segment/validate-files.js +1 -1
  173. package/dist/sdk/segment/yaml-validator.js +1 -1
  174. package/dist/sdk/segment.js +1 -1
  175. package/dist/sdk/types/index.js +1 -1
  176. package/dist/sdk/types/progress.js +1 -1
  177. package/dist/sdk/types/workspace.js +1 -1
  178. package/dist/sdk/user.js +1 -1
  179. package/dist/sdk/util/format-detector.js +1 -1
  180. package/dist/sdk/util/formatters.js +1 -1
  181. package/dist/sdk/util/index.js +1 -1
  182. package/dist/sdk/util/paginate.js +1 -1
  183. package/dist/sdk/util/tree-formatter.js +1 -1
  184. package/dist/sdk/workflow/archive-validation.js +1 -1
  185. package/dist/sdk/workflow/clone-workflow.js +1 -1
  186. package/dist/sdk/workflow/index.js +1 -1
  187. package/dist/sdk/workflow/pull-workflow.js +1 -1
  188. package/dist/sdk/workflow/push-workflow.js +1 -1
  189. package/dist/sdk/workflow/task-graph.js +1 -1
  190. package/dist/sdk/workflow/tdx-config.js +1 -1
  191. package/dist/sdk/workflow/workflow-utils.js +1 -1
  192. package/dist/sdk/workspace/access-tracker.js +1 -1
  193. package/dist/sdk/workspace/frontmatter.js +1 -1
  194. package/dist/sdk/workspace/git.js +1 -1
  195. package/dist/sdk/workspace/index.js +1 -1
  196. package/dist/sdk/workspace/templates.js +1 -1
  197. package/dist/sdk/workspace/weekly.js +1 -1
  198. package/dist/sdk/workspace/wikilinks.js +1 -1
  199. package/dist/test-utils/command-runner.js +1 -1
  200. package/dist/test-utils/factories.js +1 -1
  201. package/dist/test-utils/fixtures.js +1 -1
  202. package/dist/test-utils/http-mock.js +1 -1
  203. package/dist/test-utils/index.js +1 -1
  204. package/dist/utils/async.js +1 -1
  205. package/dist/utils/colors.js +1 -1
  206. package/dist/utils/diff.js +1 -1
  207. package/dist/utils/file-permissions.js +1 -1
  208. package/dist/utils/file-reader.js +1 -1
  209. package/dist/utils/github-releases.js +1 -1
  210. package/dist/utils/global-cache.js +1 -1
  211. package/dist/utils/json-loader.js +1 -1
  212. package/dist/utils/local-cache.js +1 -1
  213. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  214. package/dist/utils/logger/formatters/index.js +1 -1
  215. package/dist/utils/logger/handlers/console-handler.js +1 -1
  216. package/dist/utils/logger/handlers/file-handler.js +1 -1
  217. package/dist/utils/logger/handlers/index.js +1 -1
  218. package/dist/utils/logger/handlers/null-handler.js +1 -1
  219. package/dist/utils/logger/index.js +1 -1
  220. package/dist/utils/logger/logger.js +1 -1
  221. package/dist/utils/logger/types.js +1 -1
  222. package/dist/utils/option-validation.js +1 -1
  223. package/dist/utils/process.js +1 -1
  224. package/dist/utils/prompt.js +1 -1
  225. package/dist/utils/spinner.js +1 -1
  226. package/dist/utils/sse-parser.js +1 -1
  227. package/dist/utils/string-utils.js +1 -1
  228. package/dist/utils/table-ref-parser.js +1 -1
  229. package/dist/utils/tdx-logger.js +1 -1
  230. package/dist/utils/version-check.js +1 -1
  231. package/package.json +1 -1
@@ -1 +1 @@
1
- const a133_0xbc8366=a133_0x159c;function a133_0x159c(_0x192827,_0xfe181){_0x192827=_0x192827-0x1ac;const _0x347899=a133_0x3478();let _0x159c4f=_0x347899[_0x192827];return _0x159c4f;}(function(_0x13ff1f,_0x1d5e7a){const _0x313918=a133_0x159c,_0x42e449=_0x13ff1f();while(!![]){try{const _0x2d164b=-parseInt(_0x313918(0x2ca))/0x1*(parseInt(_0x313918(0x1fb))/0x2)+-parseInt(_0x313918(0x1da))/0x3+-parseInt(_0x313918(0x215))/0x4+parseInt(_0x313918(0x1b1))/0x5*(parseInt(_0x313918(0x229))/0x6)+parseInt(_0x313918(0x1ff))/0x7*(parseInt(_0x313918(0x29d))/0x8)+-parseInt(_0x313918(0x1b2))/0x9+parseInt(_0x313918(0x29f))/0xa;if(_0x2d164b===_0x1d5e7a)break;else _0x42e449['push'](_0x42e449['shift']());}catch(_0x3df752){_0x42e449['push'](_0x42e449['shift']());}}}(a133_0x3478,0xc6c7c));import{LLMApiClient}from'../client/llm-api-client.js';import*as a133_0x483289 from'node:fs';import*as a133_0x43ada2 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.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';function a133_0x3478(){const _0x3d253b=['basename','createAgent','agentsFull','createPrompt','updateExperimentalArtifact','idToName','reasoningEffort','medium','NOT_FOUND','tdx.json','createIntegration','experimentalArtifacts','split','listTextKnowledgeBases','length','availableModels','knowledge_bases','image_gen','getChatLog','endsWith','\x20---\x0a','created','Only\x20safe\x20types\x20(','description','tdx_','experimental_knowledge_bases','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','yaml','getOrCreateDefaultProject','\x20in\x20project\x20','low','tables','ExperimentalKnowledgeBase','dry-run-','47niGLah','listAgentsFull','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','some','chatIgnoreManagedActions','mkdirSync','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','warn','total','clearDefaultAgent','isDir','minimal','cloneProject','agent','set','formInterfaces','Renamed\x20experimental\x20artifact\x20directory:\x20','loadJsonFile','includes','error','670Azwcgq','3641724ZCFWwc','listImageGenerators','status','updateExperimentalKnowledgeBase','Renamed\x20chat\x20interface\x20file:\x20','service_type','createKnowledgeBase','currentProjectId','message','web_search','get','signal','pushAgent','chatWelcomeMessage',')\x20can\x20be\x20pushed.\x20','projectName','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','new','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','rmSync','createWebSearchTool','\x20→\x20','statSync','modelType','textKnowledgeBases','serviceType','chat','starter_message','experimental_artifacts','---\x20file:\x20','form_interfaces','Could\x20not\x20resolve\x20agent\x20reference','Renamed\x20prompt\x20file:\x20','Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.','getDefaultProjectName','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','profile','Unresolved\x20dependencies:\x20','createAgentResponse','742758oPZHAK','knowledgeBases','createExperimentalArtifact','jsonSchemaHint','project.json','getProject','agents','has','utf-8','updateTextKnowledgeBase','integrations.json','action','prompts','LLM_PROJECT_NOT_FOUND',')\x20can\x20be\x20cloned.','stringify','listToolTargets','claude-4.5-sonnet','unchanged','deleteAgent','prompt.md','chatInfo','chat_interfaces','counts','getChatInfo','\x0a---\x20schema:\x20','Renamed\x20KB\x20file:\x20','deleteProject','functions','target','getDefaultAgent','updateKnowledgeBase','client','5486cTdfRt','slackMessageMode','listIntegrations','.yml','6797jNEGBg','text','KnowledgeBase','createExperimentalKnowledgeBase','already\x20exists','\x0a\x0a#\x20agent.yml\x0a','nameToId','systemPrompt','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','restoreProject','def','site','Agent\x20reference\x20not\x20found','Renamed\x20form\x20interface\x20file:\x20','Unsupported\x20backup\x20version:\x20','agent.yml','json_schema.json','listChats','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','\x27.\x20This\x20should\x20not\x20happen.','sort','version','3103236LhGTPq','code.js','resolveProjectId','deleteIntegration','actions','listWebSearchTools','join','info','Project\x20\x22','PERMISSION_DENIED','tools','agent.yml\x20not\x20found\x20in\x20','experimentalKnowledgeBases','project','tdx_default_','existsSync','template','Backup\x20folder\x20not\x20found:\x20','isDirectory','Skipping\x20integration\x20\x27','32268HwtfPb','chats','pullProject','path','imageGenerators','\x0a---\x20code\x20---\x0a','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','getAgent','conflict','updated','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','promptId','updatePrompt','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','size','_reasoning_','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','readdirSync','createChatInterface','.llm','exportedFrom','getBackupMetadata','filter','backupProject','outputs','listAgents','listExperimentalArtifacts','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','chat_agent_console','---\x20schema:\x20','listFormInterfaces','listExperimentalKnowledgeBases','\x27\x20(','updateAgent','Agent\x20not\x20found:\x20','createFormInterface','push','maxToolIterations','isFile','knowledgebases.json','setDefaultAgent','getCurrentProject','Agent\x20\x27','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','createTextKnowledgeBase','Multiple\x20projects\x20found\x20with\x20name\x20\x27','webSearchTools','models','type','json_schema','errors','toISOString','map','agentId','resolveAgentId','Removed\x20deleted\x20directory:\x20','starterMessage','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','.md','code','INTERNAL','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','event','text_content','find','writeFileSync','renamed','unlinkSync','Unable\x20to\x20create\x20project\x20after\x20','isManaged','projects','resolveProjectName','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','context','listPrompts','tdDatabaseName','chatInterfaces','startChat','listChatInterfaces','integrations','attributes','dir','getUserSettings','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','dirname','parse','\x0a---\x20function:\x20','Project\x20not\x20found:\x20','\x22\x20already\x20exists','variables','UNAUTHENTICATED','starter_message.md','setCurrentProject','metadata','(dry-run)','files','Renamed\x20agent\x20folder:\x20','projectId','agents.json','logger','#\x20prompt.md\x0a','content','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','llm_project','Renamed\x20folder:\x20','):\x20','toLowerCase','dryRun','createProject','localeCompare','getChatHistory','name','webhookCorsOrigins','file_name','oldPath','listKnowledgeBases','6760lVtGva','prompts.json','8300090yKCxRZ','chat_generic','INVALID_ARGUMENT','ALREADY_EXISTS','listProjects','cwd','add','high','readFileSync'];a133_0x3478=function(){return _0x3d253b;};return a133_0x3478();}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=[a133_0xbc8366(0x2a0),a133_0xbc8366(0x245),'chat_parent_segment'];async function safeListOrEmpty(_0x467866){try{return await _0x467866();}catch(_0x22bfe4){if(_0x22bfe4 instanceof HTTPClientError&&_0x22bfe4['status']===0x194)return[];throw _0x22bfe4;}}export class LLMSDK{['currentProjectId'];[a133_0xbc8366(0x1fa)];[a133_0xbc8366(0x272)];['logger']=Logger['of']('sdk.llm');constructor(_0x52cf8f){const _0x3c61ed=a133_0xbc8366;this[_0x3c61ed(0x1fa)]=new LLMApiClient(_0x52cf8f),this['context']=_0x52cf8f;}[a133_0xbc8366(0x1d5)](){const _0x3fc258=a133_0xbc8366,_0x4164e5=getSanitizedUsername();return _0x3fc258(0x223)+_0x4164e5;}async[a133_0xbc8366(0x285)](_0x551f18){const _0x312ace=a133_0xbc8366,{projectId:_0x1ffde6}=await this[_0x312ace(0x270)](_0x551f18);this[_0x312ace(0x1b9)]=_0x1ffde6;}[a133_0xbc8366(0x252)](){const _0x1998cb=a133_0xbc8366;return this[_0x1998cb(0x1b9)];}async[a133_0xbc8366(0x251)](_0x18acee){const _0x532e57=a133_0xbc8366,_0x170e94=this[_0x532e57(0x272)][_0x532e57(0x1d7)];let _0x271ea5,_0xa756fa;if(_0x18acee[_0x532e57(0x1af)]('/')){const _0x5aff43=_0x18acee[_0x532e57(0x2b4)]('/');if(_0x5aff43[_0x532e57(0x2b6)]!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Invalid\x20agent\x20reference\x20format:\x20'+_0x18acee,undefined,{'helpText':_0x532e57(0x239)});const [_0x19f960,_0xee3aa7]=_0x5aff43;_0x271ea5=await this[_0x532e57(0x217)](_0x19f960),_0xa756fa=_0xee3aa7;}else _0x271ea5=this[_0x532e57(0x1b9)]||(await this[_0x532e57(0x2c4)]())['id'],_0xa756fa=_0x18acee;const _0x1e4371=await this['resolveAgentId'](_0xa756fa,_0x271ea5),_0xfd53a0=await this[_0x532e57(0x1fa)][_0x532e57(0x230)](_0x1e4371);writeCachedLLMAgent(_0xfd53a0[_0x532e57(0x279)][_0x532e57(0x298)],_0x1e4371,_0x271ea5,_0x170e94);}[a133_0xbc8366(0x1f8)](){const _0x551ae3=a133_0xbc8366,_0x1db9b9=this['context'][_0x551ae3(0x1d7)];return readCachedLLMAgent(_0x1db9b9)||undefined;}[a133_0xbc8366(0x2d3)](){const _0x476218=a133_0xbc8366,_0x2864d2=this[_0x476218(0x272)][_0x476218(0x1d7)];clearCachedLLMAgent(_0x2864d2);}async[a133_0xbc8366(0x258)](){const _0x1f9607=a133_0xbc8366,_0x4c16fe=await this['client'][_0x1f9607(0x27b)](),_0x19791f=[];for(const _0x286795 of _0x4c16fe['availableModelNames']){const _0x54a60a=_0x4c16fe[_0x1f9607(0x2b7)][_0x286795];_0x54a60a&&_0x19791f['push']({'name':_0x286795,'displayName':_0x54a60a['displayName']});}return _0x19791f;}async['createProject'](_0x304499){const _0x4dd4d4=a133_0xbc8366;return await this[_0x4dd4d4(0x1fa)][_0x4dd4d4(0x295)](_0x304499);}async[a133_0xbc8366(0x1f5)](_0x39e88c){const _0x579563=a133_0xbc8366,{projectId:_0x426155}=await this[_0x579563(0x270)](_0x39e88c);await this[_0x579563(0x1fa)]['deleteProject'](_0x426155);}async[a133_0xbc8366(0x26f)](_0x3fa872=0x32){const _0x1c852d=a133_0xbc8366;return await this[_0x1c852d(0x1fa)][_0x1c852d(0x2a3)](_0x3fa872);}async[a133_0xbc8366(0x2c4)](_0x230586){const _0x1fbac4=a133_0xbc8366,_0x166d63=_0x230586||this[_0x1fbac4(0x1d5)](),_0x4d62a0=this[_0x1fbac4(0x272)][_0x1fbac4(0x1d7)];if(!_0x230586){const _0x480f70=readCachedLLMProject(_0x4d62a0);if(_0x480f70&&_0x480f70[_0x1fbac4(0x298)]===_0x166d63)try{const _0x23e5c7=await this[_0x1fbac4(0x1fa)]['getProject'](_0x480f70['id']);if(_0x23e5c7[_0x1fbac4(0x279)][_0x1fbac4(0x298)]===_0x166d63)return _0x23e5c7;}catch{}}const _0x32f9d7=await this['client'][_0x1fbac4(0x2a3)](),_0x4df939=_0x32f9d7[_0x1fbac4(0x269)](_0x1ad68d=>_0x1ad68d[_0x1fbac4(0x279)][_0x1fbac4(0x298)]===_0x166d63);if(_0x4df939)return!_0x230586&&writeCachedLLMProject(_0x166d63,_0x4df939['id'],_0x4d62a0),_0x4df939;const _0x831902=await this[_0x1fbac4(0x1fa)]['createProject']({'name':_0x166d63,'description':_0x1fbac4(0x254)+getSanitizedUsername()+')'});return!_0x230586&&writeCachedLLMProject(_0x166d63,_0x831902['id'],_0x4d62a0),_0x831902;}async['resolveProjectId'](_0x60241){const _0x496be6=a133_0xbc8366,_0x1f21d0=await this[_0x496be6(0x1fa)][_0x496be6(0x2a3)](),_0x1eecbd=_0x1f21d0[_0x496be6(0x23f)](_0x337f1a=>_0x337f1a[_0x496be6(0x279)][_0x496be6(0x298)]===_0x60241);if(_0x1eecbd[_0x496be6(0x2b6)]===0x0)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0x60241,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x1eecbd[_0x496be6(0x2b6)]>0x1)throw new SDKError(ErrorCode[_0x496be6(0x265)],_0x496be6(0x256)+_0x60241+_0x496be6(0x212));return _0x1eecbd[0x0]['id'];}async['resolveProjectName'](_0xcf14b9){const _0x420680=a133_0xbc8366,_0x4e6021=await this[_0x420680(0x1fa)][_0x420680(0x2a3)](),_0x21e697=_0x4e6021[_0x420680(0x269)](_0x329744=>_0x329744[_0x420680(0x279)]['name']===_0xcf14b9);if(_0x21e697)return{'projectId':_0x21e697['id'],'project':_0x21e697};throw new SDKError(ErrorCode[_0x420680(0x1e7)],_0x420680(0x280)+_0xcf14b9,undefined,{'helpText':_0x420680(0x2d0)});}async['getOrCreateDefaultAgent'](_0x28cdee=a133_0xbc8366(0x1eb),_0x11a660=0x0,_0x5be18b){const _0x911f96=a133_0xbc8366,_0xa45153=0xa;let _0x4c1a6b=0x0,_0x363d22;while(_0x4c1a6b<_0xa45153){try{const _0x14883e=await this[_0x911f96(0x2c4)](_0x363d22),_0x16801b=_0x14883e['id'],_0x42e499=['none',_0x911f96(0x2d5),_0x911f96(0x2c6),_0x911f96(0x2af),_0x911f96(0x2a6)],_0x444811=_0x11a660===0x0?'tdx_'+_0x28cdee:_0x911f96(0x2c0)+_0x28cdee+_0x911f96(0x238)+_0x42e499[_0x11a660],_0x5beba1=await this[_0x911f96(0x1fa)][_0x911f96(0x242)](_0x16801b),_0x4031ff=_0x5beba1['find'](_0x53a9de=>_0x53a9de[_0x911f96(0x279)][_0x911f96(0x298)]===_0x444811);if(_0x4031ff)return _0x4031ff;const _0x4a9637=_0x11a660>0x0?0x1:_0x5be18b;return await this['client'][_0x911f96(0x2a9)]({'name':_0x444811,'projectId':_0x16801b,'modelType':_0x28cdee,'systemPrompt':'','temperature':_0x4a9637,'reasoningEffort':_0x11a660>0x0?_0x11a660:undefined});}catch(_0x5a8fef){if(_0x5a8fef instanceof HTTPClientError){const _0x8590f2=_0x5a8fef[_0x911f96(0x1b4)];if(_0x8590f2>=0x190&&_0x8590f2<0x1f4){if(_0x8590f2===0x191)throw new SDKError(ErrorCode[_0x911f96(0x283)],_0x911f96(0x244),_0x5a8fef);else{if(_0x8590f2===0x193)throw new SDKError(ErrorCode[_0x911f96(0x21e)],_0x911f96(0x28f),_0x5a8fef);}throw _0x5a8fef;}}if(errorContains(_0x5a8fef,_0x911f96(0x203),'duplicate',_0x911f96(0x231))){_0x4c1a6b++;if(_0x4c1a6b>=_0xa45153)throw new SDKError(ErrorCode[_0x911f96(0x2a2)],_0x911f96(0x26d)+_0xa45153+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x5a8fef);const _0x2bbf96=this[_0x911f96(0x1d5)]();_0x363d22=_0x2bbf96+'_'+generateRandomHex();continue;}throw _0x5a8fef;}}throw new SDKError(ErrorCode[_0x911f96(0x265)],_0x911f96(0x22f));}async[a133_0xbc8366(0x25f)](_0x4b8726,_0x3daa58){const _0x2d139d=a133_0xbc8366,_0x503bed=_0x3daa58||this[_0x2d139d(0x1b9)],_0x23ea0e=await this[_0x2d139d(0x1fa)][_0x2d139d(0x242)](_0x503bed),_0x323b12=_0x23ea0e[_0x2d139d(0x23f)](_0x4b9956=>_0x4b9956['attributes'][_0x2d139d(0x298)]===_0x4b8726);if(_0x323b12[_0x2d139d(0x2b6)]===0x0){const _0x5e561e=_0x503bed?_0x2d139d(0x2c5)+_0x503bed:'';throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x2d139d(0x24b)+_0x4b8726+_0x5e561e,undefined,{'helpText':_0x503bed?_0x2d139d(0x2cc):_0x2d139d(0x1d4)});}if(_0x323b12[_0x2d139d(0x2b6)]>0x1)throw new SDKError(ErrorCode[_0x2d139d(0x265)],'Multiple\x20agents\x20found\x20with\x20name\x20\x27'+_0x4b8726+_0x2d139d(0x212));return _0x323b12[0x0]['id'];}async[a133_0xbc8366(0x1e0)](_0x14dfb6){const _0x52fa03=a133_0xbc8366,_0x521ba6=_0x14dfb6||this[_0x52fa03(0x1b9)];return await this[_0x52fa03(0x1fa)][_0x52fa03(0x242)](_0x521ba6);}async[a133_0xbc8366(0x2aa)](_0x5a807e){const _0x322be0=a133_0xbc8366;return await this['client'][_0x322be0(0x2cb)](_0x5a807e);}async[a133_0xbc8366(0x2d7)](_0x544d64){const _0x2876dd=a133_0xbc8366;return await this[_0x2876dd(0x1fa)]['getAgent'](_0x544d64);}async[a133_0xbc8366(0x2a9)](_0x51d73a){const _0x5718ba=a133_0xbc8366;return await this['client'][_0x5718ba(0x2a9)](_0x51d73a);}async[a133_0xbc8366(0x24a)](_0x2bdcf8,_0x480a6c){const _0x341c1b=a133_0xbc8366;return await this[_0x341c1b(0x1fa)][_0x341c1b(0x24a)](_0x2bdcf8,_0x480a6c);}async[a133_0xbc8366(0x1ed)](_0x1590f9){const _0x458ac5=a133_0xbc8366;await this['client'][_0x458ac5(0x1ed)](_0x1590f9);}async[a133_0xbc8366(0x276)](_0x16c122){const _0x69528a=a133_0xbc8366;return await this['client'][_0x69528a(0x276)]({'agentId':_0x16c122});}async*[a133_0xbc8366(0x1cd)](_0x58e440,_0x9d1dd6){const _0x1c6b1b=a133_0xbc8366;let _0x409b20=_0x9d1dd6?.['chatId'];const _0x42c029=_0x9d1dd6?.[_0x1c6b1b(0x25e)];if(!_0x409b20){if(!_0x42c029)throw new Error(_0x1c6b1b(0x1c5));const _0x292e83=await this['client']['startChat']({'agentId':_0x42c029});_0x409b20=_0x292e83['id'],yield{'type':_0x1c6b1b(0x286),'data':{'chatId':_0x409b20,'agentId':_0x42c029,'projectId':_0x292e83[_0x1c6b1b(0x279)][_0x1c6b1b(0x28a)]}};}for await(const _0x1e3e7f of this[_0x1c6b1b(0x1fa)]['continueChat'](_0x409b20,_0x58e440,_0x9d1dd6?.[_0x1c6b1b(0x1bd)])){yield{'type':_0x1c6b1b(0x267),'data':_0x1e3e7f};}}async[a133_0xbc8366(0x22a)](_0x48b807=0x32){const _0x5cddce=a133_0xbc8366;return await this[_0x5cddce(0x1fa)][_0x5cddce(0x210)](_0x48b807);}async['history'](_0x35e3a1){const _0x2d5816=a133_0xbc8366;return await this['client'][_0x2d5816(0x297)](_0x35e3a1);}async[a133_0xbc8366(0x2ba)](_0x56d2ea){const _0x3bf6aa=a133_0xbc8366;return await this['client'][_0x3bf6aa(0x2ba)](_0x56d2ea);}async[a133_0xbc8366(0x1ef)](_0x563401){const _0xaa47e=a133_0xbc8366;return await this['client'][_0xaa47e(0x1f2)](_0x563401);}async[a133_0xbc8366(0x240)](_0x57a1f9,_0x571ffb,_0x2a697e){const _0x273bc3=a133_0xbc8366,_0x3948c0=_0x2a697e?.[_0x273bc3(0x294)]??![],{projectId:_0x57431c,project:_0x464bf8}=await this[_0x273bc3(0x270)](_0x57a1f9),_0xef315c=_0x464bf8[_0x273bc3(0x279)][_0x273bc3(0x298)],_0x34ff9e=_0x571ffb||_0xef315c+_0x273bc3(0x23c);if(a133_0x483289['existsSync'](_0x34ff9e)&&!_0x3948c0)throw new SDKError(ErrorCode[_0x273bc3(0x2a2)],'Output\x20directory\x20already\x20exists:\x20'+_0x34ff9e,undefined,{'helpText':_0x273bc3(0x266)});const _0x467525=await this[_0x273bc3(0x1fa)]['listAgentsFull'](_0x57431c),_0x4cf1a5=await this[_0x273bc3(0x1fa)]['listKnowledgeBases'](_0x57431c),_0x5dda5f=await this[_0x273bc3(0x1fa)][_0x273bc3(0x273)](_0x57431c),_0x41420d=await this[_0x273bc3(0x1fa)][_0x273bc3(0x1fd)](_0x57431c);if(!_0x3948c0){a133_0x483289[_0x273bc3(0x2cf)](_0x34ff9e,{'recursive':!![]});const _0x2809b8={'version':'1.0','exportedAt':new Date()[_0x273bc3(0x25c)](),'exportedFrom':{'site':this[_0x273bc3(0x272)][_0x273bc3(0x20a)],'projectId':_0x57431c,'projectName':_0xef315c},'project':_0x464bf8};a133_0x483289[_0x273bc3(0x26a)](a133_0x43ada2['join'](_0x34ff9e,_0x273bc3(0x1de)),JSON[_0x273bc3(0x1e9)](_0x2809b8,null,0x2)),a133_0x483289['writeFileSync'](a133_0x43ada2[_0x273bc3(0x21b)](_0x34ff9e,_0x273bc3(0x28b)),JSON[_0x273bc3(0x1e9)](_0x467525,null,0x2)),a133_0x483289['writeFileSync'](a133_0x43ada2[_0x273bc3(0x21b)](_0x34ff9e,_0x273bc3(0x250)),JSON[_0x273bc3(0x1e9)](_0x4cf1a5,null,0x2)),a133_0x483289[_0x273bc3(0x26a)](a133_0x43ada2[_0x273bc3(0x21b)](_0x34ff9e,_0x273bc3(0x29e)),JSON[_0x273bc3(0x1e9)](_0x5dda5f,null,0x2)),a133_0x483289[_0x273bc3(0x26a)](a133_0x43ada2['join'](_0x34ff9e,_0x273bc3(0x1e4)),JSON[_0x273bc3(0x1e9)](_0x41420d,null,0x2));}return{'projectName':_0xef315c,'outputDir':_0x34ff9e,'counts':{'agents':_0x467525[_0x273bc3(0x2b6)],'knowledgeBases':_0x4cf1a5[_0x273bc3(0x2b6)],'prompts':_0x5dda5f[_0x273bc3(0x2b6)],'integrations':_0x41420d['length']}};}async[a133_0xbc8366(0x208)](_0x3133d4,_0x216485){const _0x5b5d3f=a133_0xbc8366,_0x1cce8a=_0x216485?.['dryRun']??![],_0x44d643=this[_0x5b5d3f(0x23e)](_0x3133d4),_0x39dff7=_0x44d643[_0x5b5d3f(0x23d)][_0x5b5d3f(0x20a)],_0x1be237=this[_0x5b5d3f(0x272)]['site'],_0x4dec8b=_0x39dff7!==_0x1be237?_0x39dff7:undefined,_0xc88796=this['loadJsonFile'](a133_0x43ada2[_0x5b5d3f(0x21b)](_0x3133d4,'agents.json'),[]),_0x1f2e3a=this[_0x5b5d3f(0x1ae)](a133_0x43ada2[_0x5b5d3f(0x21b)](_0x3133d4,_0x5b5d3f(0x250)),[]),_0x499cb5=this[_0x5b5d3f(0x1ae)](a133_0x43ada2[_0x5b5d3f(0x21b)](_0x3133d4,_0x5b5d3f(0x29e)),[]),_0x506b52=this[_0x5b5d3f(0x1ae)](a133_0x43ada2[_0x5b5d3f(0x21b)](_0x3133d4,'integrations.json'),[]),_0x2c1b0a=_0x216485?.[_0x5b5d3f(0x298)]||_0x44d643[_0x5b5d3f(0x23d)][_0x5b5d3f(0x1c1)];if(_0x1cce8a){const _0x296d8f=new Map(),_0xa4a1f1=[..._0xc88796],_0x4d8ea9=_0xc88796[_0x5b5d3f(0x2b6)]+0x1;let _0x1939e0=0x0;while(_0xa4a1f1[_0x5b5d3f(0x2b6)]>0x0&&_0x1939e0<_0x4d8ea9){_0x1939e0++;const _0x834407=[];for(const _0x442548 of _0xa4a1f1){canCreateAgent(_0x442548,_0x296d8f)?_0x296d8f[_0x5b5d3f(0x2d8)](_0x442548['id'],_0x5b5d3f(0x2c9)+_0x442548['id']):_0x834407['push'](_0x442548);}if(_0x834407[_0x5b5d3f(0x2b6)]===_0xa4a1f1['length'])throw new SDKError(ErrorCode[_0x5b5d3f(0x265)],_0x5b5d3f(0x1d6),undefined,{'helpText':_0x5b5d3f(0x207)});_0xa4a1f1[_0x5b5d3f(0x2b6)]=0x0,_0xa4a1f1[_0x5b5d3f(0x24d)](..._0x834407);}const _0x4c9262=_0x499cb5[_0x5b5d3f(0x23f)](_0x1f2146=>_0x296d8f[_0x5b5d3f(0x1e1)](_0x1f2146['attributes'][_0x5b5d3f(0x25e)]))[_0x5b5d3f(0x2b6)];return{'projectName':_0x2c1b0a,'projectId':_0x5b5d3f(0x287),'counts':{'agents':_0xc88796['length'],'knowledgeBases':_0x1f2e3a[_0x5b5d3f(0x2b6)],'prompts':_0x4c9262,'integrations':_0x506b52[_0x5b5d3f(0x2b6)]},'sourceSite':_0x4dec8b};}const _0x431aba=await this[_0x5b5d3f(0x1fa)][_0x5b5d3f(0x295)]({'name':_0x2c1b0a,'description':_0x44d643[_0x5b5d3f(0x222)][_0x5b5d3f(0x279)][_0x5b5d3f(0x2bf)]}),_0x39eeb6=_0x431aba['id'],_0x317df4=new Map(),_0x1f6375=new Map(),_0x12af44=new Map();for(const _0x14fb3f of _0x1f2e3a){const _0x46ff4e=await this['client'][_0x5b5d3f(0x1b8)]({'projectId':_0x39eeb6,'name':_0x14fb3f['attributes']['name'],'tdDatabaseName':_0x14fb3f[_0x5b5d3f(0x279)][_0x5b5d3f(0x274)],'tables':_0x14fb3f[_0x5b5d3f(0x279)][_0x5b5d3f(0x2c7)]});_0x317df4[_0x5b5d3f(0x2d8)](_0x14fb3f['id'],_0x46ff4e['id']);}const _0x1b88fe=[..._0xc88796],_0x339da7=_0xc88796[_0x5b5d3f(0x2b6)]+0x1;let _0x53df21=0x0;while(_0x1b88fe[_0x5b5d3f(0x2b6)]>0x0&&_0x53df21<_0x339da7){_0x53df21++;const _0x41c850=[];for(const _0x2d59bf of _0x1b88fe){if(canCreateAgent(_0x2d59bf,_0x1f6375)){const _0x730115=remapToolIds(_0x2d59bf[_0x5b5d3f(0x279)][_0x5b5d3f(0x21f)],_0x317df4,_0x1f6375),_0x27bd62=remapVariableIds(_0x2d59bf['attributes'][_0x5b5d3f(0x282)],_0x317df4),_0x3c8381=await this['client'][_0x5b5d3f(0x1d9)]({'name':_0x2d59bf['attributes'][_0x5b5d3f(0x298)],'projectId':_0x39eeb6,'systemPrompt':_0x2d59bf[_0x5b5d3f(0x279)][_0x5b5d3f(0x206)],'starterMessage':_0x2d59bf['attributes']['starterMessage'],'modelType':migrateModelType(_0x2d59bf[_0x5b5d3f(0x279)][_0x5b5d3f(0x1ca)]),'maxToolIterations':_0x2d59bf[_0x5b5d3f(0x279)][_0x5b5d3f(0x24e)],'temperature':_0x2d59bf[_0x5b5d3f(0x279)]['temperature'],'reasoningEffort':_0x2d59bf[_0x5b5d3f(0x279)][_0x5b5d3f(0x2ae)],'outputs':_0x2d59bf['attributes'][_0x5b5d3f(0x241)],'tools':_0x730115,'variables':_0x27bd62});_0x1f6375[_0x5b5d3f(0x2d8)](_0x2d59bf['id'],_0x3c8381['id']);}else _0x41c850[_0x5b5d3f(0x24d)](_0x2d59bf);}if(_0x41c850[_0x5b5d3f(0x2b6)]===_0x1b88fe[_0x5b5d3f(0x2b6)])throw new SDKError(ErrorCode[_0x5b5d3f(0x265)],_0x5b5d3f(0x1d6),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x1b88fe[_0x5b5d3f(0x2b6)]=0x0,_0x1b88fe[_0x5b5d3f(0x24d)](..._0x41c850);}for(const _0x16fc4b of _0x499cb5){const _0x2bb3be=_0x1f6375['get'](_0x16fc4b['attributes']['agentId']);if(!_0x2bb3be)continue;const _0x5f2318=await this[_0x5b5d3f(0x1fa)]['createPrompt']({'projectId':_0x39eeb6,'agentId':_0x2bb3be,'name':_0x16fc4b[_0x5b5d3f(0x279)][_0x5b5d3f(0x298)],'systemPrompt':_0x16fc4b[_0x5b5d3f(0x279)]['systemPrompt'],'template':_0x16fc4b[_0x5b5d3f(0x279)][_0x5b5d3f(0x225)],'jsonSchemaHint':_0x16fc4b[_0x5b5d3f(0x279)][_0x5b5d3f(0x1dd)]});_0x12af44['set'](_0x16fc4b['id'],_0x5f2318['id']);}for(const _0x56756c of _0x506b52){const _0x5f34f7=_0x56756c[_0x5b5d3f(0x279)][_0x5b5d3f(0x219)][_0x5b5d3f(0x25d)](_0x5e1891=>({..._0x5e1891,'promptId':_0x12af44[_0x5b5d3f(0x1bc)](_0x5e1891['promptId'])||_0x5e1891[_0x5b5d3f(0x234)]}));await this[_0x5b5d3f(0x1fa)][_0x5b5d3f(0x2b2)]({'projectId':_0x39eeb6,'serviceType':_0x56756c[_0x5b5d3f(0x279)]['serviceType'],'actions':_0x5f34f7,'slackMessageMode':_0x56756c[_0x5b5d3f(0x279)][_0x5b5d3f(0x1fc)],'chatIgnoreManagedActions':_0x56756c[_0x5b5d3f(0x279)][_0x5b5d3f(0x2ce)],'chatWelcomeMessage':_0x56756c[_0x5b5d3f(0x279)][_0x5b5d3f(0x1bf)],'webhookCorsOrigins':_0x56756c['attributes'][_0x5b5d3f(0x299)]});}return{'projectName':_0x2c1b0a,'projectId':_0x39eeb6,'counts':{'agents':_0x1f6375['size'],'knowledgeBases':_0x317df4[_0x5b5d3f(0x237)],'prompts':_0x12af44['size'],'integrations':_0x506b52[_0x5b5d3f(0x2b6)]},'sourceSite':_0x4dec8b};}[a133_0xbc8366(0x1ae)](_0x39e291,_0x427567){const _0x27b11e=a133_0xbc8366;if(!a133_0x483289[_0x27b11e(0x224)](_0x39e291))return _0x427567;return JSON[_0x27b11e(0x27e)](a133_0x483289[_0x27b11e(0x2a7)](_0x39e291,'utf-8'));}[a133_0xbc8366(0x23e)](_0x1b65b9){const _0x266004=a133_0xbc8366;if(!a133_0x483289['existsSync'](_0x1b65b9))throw new SDKError(ErrorCode[_0x266004(0x2b0)],_0x266004(0x226)+_0x1b65b9,undefined,{'helpText':'Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.'});const _0x266234=a133_0x43ada2[_0x266004(0x21b)](_0x1b65b9,'project.json');if(!a133_0x483289[_0x266004(0x224)](_0x266234))throw new SDKError(ErrorCode[_0x266004(0x2a1)],_0x266004(0x236)+_0x1b65b9,undefined,{'helpText':_0x266004(0x27c)});const _0x278857=JSON[_0x266004(0x27e)](a133_0x483289[_0x266004(0x2a7)](_0x266234,_0x266004(0x1e2)));if(!isSupportedBackupVersion(_0x278857[_0x266004(0x214)]))throw new SDKError(ErrorCode[_0x266004(0x2a1)],_0x266004(0x20d)+_0x278857[_0x266004(0x214)],undefined,{'helpText':_0x266004(0x1c3)});return _0x278857;}async[a133_0xbc8366(0x22b)](_0x2d1159,_0x5aadb9,_0x3c6b3a){const _0x2b0a88=a133_0xbc8366,{projectId:_0x58aa84,project:_0x5666ee}=await this[_0x2b0a88(0x270)](_0x2d1159),_0x261762=_0x5666ee[_0x2b0a88(0x279)][_0x2b0a88(0x298)];let _0x3e45c1;if(_0x5aadb9)_0x3e45c1=_0x5aadb9;else{const _0x5107a6=a133_0x43ada2[_0x2b0a88(0x21b)](process[_0x2b0a88(0x2a4)](),_0x2b0a88(0x1e0)),_0x35e4ba=getSanitizedPathWithMigration(_0x5107a6,_0x261762);_0x35e4ba['renamed']&&this['logger'][_0x2b0a88(0x21c)]('Renamed\x20folder:\x20'+a133_0x43ada2['basename'](_0x35e4ba[_0x2b0a88(0x29b)])+_0x2b0a88(0x1c8)+a133_0x43ada2[_0x2b0a88(0x2a8)](_0x35e4ba[_0x2b0a88(0x22c)])),_0x3e45c1=_0x35e4ba['path'];}const _0x4add17=await this[_0x2b0a88(0x1fa)][_0x2b0a88(0x2cb)](_0x58aa84),_0x51a00a=await this[_0x2b0a88(0x1fa)][_0x2b0a88(0x29c)](_0x58aa84),_0x5d2c3e=await this[_0x2b0a88(0x1fa)][_0x2b0a88(0x2b5)](_0x58aa84),_0x30a64d=await safeListOrEmpty(()=>this[_0x2b0a88(0x1fa)][_0x2b0a88(0x1b3)](_0x58aa84)),_0x24580b=await safeListOrEmpty(()=>this[_0x2b0a88(0x1fa)][_0x2b0a88(0x21a)](_0x58aa84)),_0x3b8525=await this['client'][_0x2b0a88(0x273)](_0x58aa84),_0x5ce214=await this[_0x2b0a88(0x1fa)][_0x2b0a88(0x1fd)](_0x58aa84),_0x3908c7=await safeListOrEmpty(()=>this[_0x2b0a88(0x1fa)][_0x2b0a88(0x248)](_0x58aa84)),_0x2ee7d7=await safeListOrEmpty(()=>this[_0x2b0a88(0x1fa)][_0x2b0a88(0x243)](_0x58aa84)),_0x191b23=await safeListOrEmpty(()=>this['client'][_0x2b0a88(0x247)](_0x58aa84)),_0x1cb1ca=await safeListOrEmpty(()=>this['client'][_0x2b0a88(0x277)](_0x58aa84)),_0x57faeb=_0x5ce214[_0x2b0a88(0x23f)](_0x34d50e=>!_0x34d50e['attributes']['isManaged']&&SAFE_INTEGRATION_TYPES['includes'](_0x34d50e[_0x2b0a88(0x279)]['serviceType']['toLowerCase']())),_0x241931=new Map(),_0x5c5207=new Map(),_0x52ac39=new Map(),_0x4a3fce=new Map(),_0x273f87=new Map(),_0x1a45a1=new Map(),_0x10ffb2=new Map();for(const _0x4a1ae8 of _0x4add17){_0x241931[_0x2b0a88(0x2d8)](_0x4a1ae8['id'],_0x4a1ae8[_0x2b0a88(0x279)][_0x2b0a88(0x298)]);}for(const _0x11d93a of _0x51a00a){_0x5c5207[_0x2b0a88(0x2d8)](_0x11d93a['id'],_0x11d93a[_0x2b0a88(0x279)][_0x2b0a88(0x298)]);}for(const _0x50b4dc of _0x5d2c3e){_0x52ac39['set'](_0x50b4dc['id'],_0x50b4dc['attributes'][_0x2b0a88(0x298)]);}for(const _0x957cad of _0x30a64d){_0x4a3fce['set'](_0x957cad['id'],_0x957cad['attributes'][_0x2b0a88(0x298)]);}for(const _0x545b2b of _0x24580b){_0x273f87['set'](_0x545b2b['id'],_0x545b2b['attributes']['name']);}for(const _0x43e2f6 of _0x3b8525){_0x1a45a1[_0x2b0a88(0x2d8)](_0x43e2f6['id'],_0x43e2f6[_0x2b0a88(0x279)]['name']);}for(const _0x1d88a6 of _0x3908c7){_0x10ffb2[_0x2b0a88(0x2d8)](_0x1d88a6['id'],_0x1d88a6[_0x2b0a88(0x279)]['name']);}const _0x3766ab={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x5c5207,'TextKnowledgeBase':_0x52ac39,'Agent':_0x241931,'WebSearchTool':_0x273f87,'ImageGenerator':_0x4a3fce,'ExperimentalKnowledgeBase':_0x10ffb2}),'resolvePromptName':async _0x2b31f1=>_0x1a45a1[_0x2b0a88(0x1bc)](_0x2b31f1),'onWarning':_0x4e6a8e=>this[_0x2b0a88(0x28c)][_0x2b0a88(0x2d1)](_0x4e6a8e)},_0x4a2171={'projectName':_0x261762,'outputDir':_0x3e45c1,'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}}},_0x22e759=[],_0x5d8016=[];for(const _0x5e337a of _0x4add17){const _0x3cb98f=getSanitizedPathWithMigration(_0x3e45c1,_0x5e337a[_0x2b0a88(0x279)][_0x2b0a88(0x298)]);_0x3cb98f[_0x2b0a88(0x26b)]&&this[_0x2b0a88(0x28c)][_0x2b0a88(0x21c)](_0x2b0a88(0x289)+a133_0x43ada2[_0x2b0a88(0x2a8)](_0x3cb98f[_0x2b0a88(0x29b)])+'\x20→\x20'+a133_0x43ada2[_0x2b0a88(0x2a8)](_0x3cb98f[_0x2b0a88(0x22c)]));const _0x235697=_0x3cb98f[_0x2b0a88(0x22c)],_0x31941c=a133_0x43ada2[_0x2b0a88(0x21b)](_0x235697,_0x2b0a88(0x1ee)),_0x52832d=a133_0x43ada2[_0x2b0a88(0x21b)](_0x235697,_0x2b0a88(0x20e)),_0x282d57=a133_0x43ada2[_0x2b0a88(0x21b)](_0x235697,'starter_message.md'),{yaml:_0x2605f9,systemPrompt:_0x46c790,starterMessage:_0x4d2a66}=await agentResponseToDef(_0x5e337a,_0x3766ab),_0x2fbeb0=toAgentYamlString(_0x2605f9),_0x559214=!a133_0x483289[_0x2b0a88(0x224)](_0x52832d);let _0x261d0e=_0x559214,_0x2f1c6f;if(!_0x559214){const _0x3d3937=a133_0x483289[_0x2b0a88(0x224)](_0x31941c)?a133_0x483289[_0x2b0a88(0x2a7)](_0x31941c,_0x2b0a88(0x1e2)):'',_0x14350f=a133_0x483289['readFileSync'](_0x52832d,_0x2b0a88(0x1e2)),_0x5781cb=_0x2b0a88(0x28d)+_0x3d3937+_0x2b0a88(0x204)+_0x14350f,_0x1c973c=_0x2b0a88(0x28d)+_0x46c790+_0x2b0a88(0x204)+_0x2fbeb0,_0x2eb024=generateDiff(_0x5781cb,_0x1c973c);_0x261d0e=hasChanges(_0x2eb024),_0x261d0e&&(_0x2f1c6f=formatDiffWithColors(_0x2eb024));}_0x22e759[_0x2b0a88(0x24d)]({'path':_0x235697,'content':'','isDir':!![]}),_0x22e759[_0x2b0a88(0x24d)]({'path':_0x31941c,'content':_0x46c790}),_0x22e759['push']({'path':_0x52832d,'content':_0x2fbeb0});_0x4d2a66&&_0x4d2a66['includes']('\x0a')&&_0x22e759[_0x2b0a88(0x24d)]({'path':_0x282d57,'content':_0x4d2a66});_0x4a2171[_0x2b0a88(0x1e0)][_0x2b0a88(0x24d)]({'agentName':_0x5e337a['attributes']['name'],'outputPath':_0x235697,'isNew':_0x559214,'hasChanges':_0x261d0e,'diff':_0x2f1c6f}),_0x4a2171['counts']['agents'][_0x2b0a88(0x2d2)]++;if(_0x559214)_0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x1e0)][_0x2b0a88(0x1c4)]++;else{if(_0x261d0e)_0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x1e0)]['updated']++;else _0x4a2171[_0x2b0a88(0x1f1)]['agents'][_0x2b0a88(0x1ec)]++;}}for(const _0x357794 of _0x51a00a){if(_0x357794[_0x2b0a88(0x279)]['isManaged'])continue;const _0x1b0dd6=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x3e45c1),_0x357794[_0x2b0a88(0x279)][_0x2b0a88(0x298)],_0x2b0a88(0x1fe));_0x1b0dd6['renamed']&&this[_0x2b0a88(0x28c)][_0x2b0a88(0x21c)](_0x2b0a88(0x1f4)+a133_0x43ada2['basename'](_0x1b0dd6[_0x2b0a88(0x29b)])+_0x2b0a88(0x1c8)+a133_0x43ada2[_0x2b0a88(0x2a8)](_0x1b0dd6['path']));const _0x1fded8=_0x1b0dd6[_0x2b0a88(0x22c)],_0x1ae296=apiKnowledgeBaseToYaml(_0x357794),_0x298d4f=toKnowledgeBaseYamlString(_0x1ae296),_0x2043cf=!a133_0x483289['existsSync'](_0x1fded8);let _0x5a7c60=_0x2043cf,_0x3b6d4a;if(!_0x2043cf){const _0x4e39ff=a133_0x483289['readFileSync'](_0x1fded8,_0x2b0a88(0x1e2)),_0x28f0cc=generateDiff(_0x4e39ff,_0x298d4f);_0x5a7c60=hasChanges(_0x28f0cc),_0x5a7c60&&(_0x3b6d4a=formatDiffWithColors(_0x28f0cc));}_0x22e759[_0x2b0a88(0x24d)]({'path':_0x1fded8,'content':_0x298d4f}),_0x4a2171[_0x2b0a88(0x1db)][_0x2b0a88(0x24d)]({'name':_0x357794['attributes']['name'],'outputPath':_0x1fded8,'isNew':_0x2043cf,'hasChanges':_0x5a7c60,'diff':_0x3b6d4a}),_0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x1db)]['total']++;if(_0x2043cf)_0x4a2171['counts']['knowledgeBases'][_0x2b0a88(0x1c4)]++;else{if(_0x5a7c60)_0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x1db)][_0x2b0a88(0x232)]++;else _0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x1db)][_0x2b0a88(0x1ec)]++;}}for(const _0x5bd4fe of _0x5d2c3e){if(_0x5bd4fe[_0x2b0a88(0x279)][_0x2b0a88(0x26e)])continue;const _0x3a995a=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x3e45c1),_0x5bd4fe[_0x2b0a88(0x279)][_0x2b0a88(0x298)],_0x2b0a88(0x263));_0x3a995a[_0x2b0a88(0x26b)]&&this[_0x2b0a88(0x28c)][_0x2b0a88(0x21c)]('Renamed\x20text\x20KB\x20file:\x20'+a133_0x43ada2[_0x2b0a88(0x2a8)](_0x3a995a[_0x2b0a88(0x29b)])+_0x2b0a88(0x1c8)+a133_0x43ada2[_0x2b0a88(0x2a8)](_0x3a995a[_0x2b0a88(0x22c)]));const _0x597f81=_0x3a995a[_0x2b0a88(0x22c)],_0x2036d1=toTextKnowledgeBaseMd(_0x5bd4fe[_0x2b0a88(0x279)][_0x2b0a88(0x298)],_0x5bd4fe['attributes']['text']),_0xd8ec57=!a133_0x483289[_0x2b0a88(0x224)](_0x597f81);let _0x20157b=_0xd8ec57,_0x42dcf7;if(!_0xd8ec57){const _0x444fb1=a133_0x483289[_0x2b0a88(0x2a7)](_0x597f81,_0x2b0a88(0x1e2)),_0xfdc8df=generateDiff(_0x444fb1,_0x2036d1);_0x20157b=hasChanges(_0xfdc8df),_0x20157b&&(_0x42dcf7=formatDiffWithColors(_0xfdc8df));}_0x22e759[_0x2b0a88(0x24d)]({'path':_0x597f81,'content':_0x2036d1}),_0x4a2171['textKnowledgeBases']['push']({'name':_0x5bd4fe[_0x2b0a88(0x279)]['name'],'outputPath':_0x597f81,'isNew':_0xd8ec57,'hasChanges':_0x20157b,'diff':_0x42dcf7}),_0x4a2171['counts'][_0x2b0a88(0x1cb)]['total']++;if(_0xd8ec57)_0x4a2171['counts']['textKnowledgeBases'][_0x2b0a88(0x1c4)]++;else{if(_0x20157b)_0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x1cb)][_0x2b0a88(0x232)]++;else _0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x1cb)][_0x2b0a88(0x1ec)]++;}}for(const _0x5ba824 of _0x3b8525){if(_0x5ba824['attributes'][_0x2b0a88(0x26e)])continue;const _0x25b2b4=getSanitizedPathWithMigration(getPromptsDir(_0x3e45c1),_0x5ba824[_0x2b0a88(0x279)]['name'],_0x2b0a88(0x1fe));_0x25b2b4[_0x2b0a88(0x26b)]&&this['logger'][_0x2b0a88(0x21c)](_0x2b0a88(0x1d3)+a133_0x43ada2[_0x2b0a88(0x2a8)](_0x25b2b4[_0x2b0a88(0x29b)])+'\x20→\x20'+a133_0x43ada2['basename'](_0x25b2b4[_0x2b0a88(0x22c)]));const _0x51ac1a=_0x25b2b4[_0x2b0a88(0x22c)],_0x45aa20=await apiPromptToYaml(_0x5ba824,_0x3766ab);if(!_0x45aa20)continue;const _0x2e66d7=toPromptYamlString(_0x45aa20),_0x34f4da=!a133_0x483289[_0x2b0a88(0x224)](_0x51ac1a);let _0x43bcd8=_0x34f4da,_0x27f5cd;if(!_0x34f4da){const _0x39656e=a133_0x483289[_0x2b0a88(0x2a7)](_0x51ac1a,_0x2b0a88(0x1e2)),_0x460833=generateDiff(_0x39656e,_0x2e66d7);_0x43bcd8=hasChanges(_0x460833),_0x43bcd8&&(_0x27f5cd=formatDiffWithColors(_0x460833));}_0x22e759[_0x2b0a88(0x24d)]({'path':_0x51ac1a,'content':_0x2e66d7}),_0x4a2171[_0x2b0a88(0x1e6)][_0x2b0a88(0x24d)]({'name':_0x5ba824[_0x2b0a88(0x279)][_0x2b0a88(0x298)],'outputPath':_0x51ac1a,'isNew':_0x34f4da,'hasChanges':_0x43bcd8,'diff':_0x27f5cd}),_0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x1e6)][_0x2b0a88(0x2d2)]++;if(_0x34f4da)_0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x1e6)][_0x2b0a88(0x1c4)]++;else{if(_0x43bcd8)_0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x1e6)][_0x2b0a88(0x232)]++;else _0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x1e6)][_0x2b0a88(0x1ec)]++;}}for(const _0x3faba5 of _0x57faeb){const _0x173ce0=_0x3faba5['attributes']['serviceType'][_0x2b0a88(0x293)](),_0x2763dc=getSanitizedPathWithMigration(getIntegrationsDir(_0x3e45c1),_0x173ce0,_0x2b0a88(0x1fe));_0x2763dc['renamed']&&this[_0x2b0a88(0x28c)][_0x2b0a88(0x21c)]('Renamed\x20integration\x20file:\x20'+a133_0x43ada2['basename'](_0x2763dc[_0x2b0a88(0x29b)])+'\x20→\x20'+a133_0x43ada2[_0x2b0a88(0x2a8)](_0x2763dc['path']));const _0x25cff0=_0x2763dc[_0x2b0a88(0x22c)],_0x5d3c29=await apiIntegrationToYaml(_0x3faba5,_0x3766ab),_0x50a963=toIntegrationYamlString(_0x5d3c29),_0x4e2e8f=!a133_0x483289[_0x2b0a88(0x224)](_0x25cff0);let _0x352f79=_0x4e2e8f,_0x197e48;if(!_0x4e2e8f){const _0xf4015e=a133_0x483289['readFileSync'](_0x25cff0,_0x2b0a88(0x1e2)),_0x3f85f0=generateDiff(_0xf4015e,_0x50a963);_0x352f79=hasChanges(_0x3f85f0),_0x352f79&&(_0x197e48=formatDiffWithColors(_0x3f85f0));}_0x22e759[_0x2b0a88(0x24d)]({'path':_0x25cff0,'content':_0x50a963}),_0x4a2171[_0x2b0a88(0x278)][_0x2b0a88(0x24d)]({'name':_0x173ce0,'outputPath':_0x25cff0,'isNew':_0x4e2e8f,'hasChanges':_0x352f79,'diff':_0x197e48}),_0x4a2171[_0x2b0a88(0x1f1)]['integrations']['total']++;if(_0x4e2e8f)_0x4a2171[_0x2b0a88(0x1f1)]['integrations'][_0x2b0a88(0x1c4)]++;else{if(_0x352f79)_0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x278)][_0x2b0a88(0x232)]++;else _0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x278)]['unchanged']++;}}for(const _0x1c7c7c of _0x3908c7){if(_0x1c7c7c[_0x2b0a88(0x279)][_0x2b0a88(0x26e)])continue;const _0x1ba105=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x3e45c1),_0x1c7c7c[_0x2b0a88(0x279)][_0x2b0a88(0x298)]);_0x1ba105[_0x2b0a88(0x26b)]&&this[_0x2b0a88(0x28c)][_0x2b0a88(0x21c)]('Renamed\x20experimental\x20KB\x20directory:\x20'+a133_0x43ada2[_0x2b0a88(0x2a8)](_0x1ba105['oldPath'])+'\x20→\x20'+a133_0x43ada2[_0x2b0a88(0x2a8)](_0x1ba105[_0x2b0a88(0x22c)]));const _0x1e5f2d=_0x1ba105['path'],_0x4b2396=a133_0x43ada2[_0x2b0a88(0x21b)](_0x1e5f2d,sanitizeForFilesystem(_0x1c7c7c[_0x2b0a88(0x279)]['name'])+'.yml'),_0x4bfba2=a133_0x43ada2[_0x2b0a88(0x21b)](_0x1e5f2d,'functions'),_0x492845=apiExperimentalKnowledgeBaseToYaml(_0x1c7c7c),_0x353398=toExperimentalKnowledgeBaseYamlString(_0x492845),_0x3e6890=!a133_0x483289['existsSync'](_0x1e5f2d);let _0x140dae=_0x3e6890,_0x3a67bf,_0x1bec1a=_0x353398;const _0x221802=[..._0x492845[_0x2b0a88(0x1f6)]]['sort']((_0x53ccf4,_0x5e7227)=>_0x53ccf4[_0x2b0a88(0x298)][_0x2b0a88(0x296)](_0x5e7227['name']));for(const _0x4e03d4 of _0x221802){_0x1bec1a+='\x0a---\x20function:\x20'+_0x4e03d4[_0x2b0a88(0x298)]+_0x2b0a88(0x2bc)+_0x4e03d4[_0x2b0a88(0x264)]+_0x2b0a88(0x1f3)+_0x4e03d4[_0x2b0a88(0x298)]+'\x20---\x0a'+_0x4e03d4[_0x2b0a88(0x25a)]+'\x0a';}if(!_0x3e6890){let _0x338e07='';a133_0x483289[_0x2b0a88(0x224)](_0x4b2396)&&(_0x338e07=a133_0x483289['readFileSync'](_0x4b2396,_0x2b0a88(0x1e2)));if(a133_0x483289[_0x2b0a88(0x224)](_0x4bfba2)){const _0x2c33e8=a133_0x483289[_0x2b0a88(0x23a)](_0x4bfba2,{'withFileTypes':!![]}),_0xd88817=_0x2c33e8['filter'](_0x4f1bfe=>_0x4f1bfe['isDirectory']())[_0x2b0a88(0x213)]((_0x54ef36,_0x1d8cd9)=>_0x54ef36['name'][_0x2b0a88(0x296)](_0x1d8cd9[_0x2b0a88(0x298)]));for(const _0x462a8b of _0xd88817){const _0x5b8280=a133_0x43ada2[_0x2b0a88(0x21b)](_0x4bfba2,_0x462a8b[_0x2b0a88(0x298)],'code.js'),_0x353891=a133_0x43ada2[_0x2b0a88(0x21b)](_0x4bfba2,_0x462a8b[_0x2b0a88(0x298)],_0x2b0a88(0x20f));a133_0x483289[_0x2b0a88(0x224)](_0x5b8280)&&(_0x338e07+='\x0a---\x20function:\x20'+_0x462a8b[_0x2b0a88(0x298)]+_0x2b0a88(0x2bc)+a133_0x483289['readFileSync'](_0x5b8280,_0x2b0a88(0x1e2))+'\x0a'),a133_0x483289['existsSync'](_0x353891)&&(_0x338e07+=_0x2b0a88(0x246)+_0x462a8b[_0x2b0a88(0x298)]+_0x2b0a88(0x2bc)+a133_0x483289[_0x2b0a88(0x2a7)](_0x353891,_0x2b0a88(0x1e2))+'\x0a');}}const _0x115281=generateDiff(_0x338e07,_0x1bec1a);_0x140dae=hasChanges(_0x115281),_0x140dae&&(_0x3a67bf=formatDiffWithColors(_0x115281));}_0x22e759['push']({'path':_0x1e5f2d,'content':'','isDir':!![]}),_0x22e759[_0x2b0a88(0x24d)]({'path':_0x4b2396,'content':_0x353398}),_0x22e759['push']({'path':_0x4bfba2,'content':'','isDir':!![]});for(const _0x55c3bd of _0x492845[_0x2b0a88(0x1f6)]){const _0x12598f=a133_0x43ada2[_0x2b0a88(0x21b)](_0x4bfba2,sanitizeForFilesystem(_0x55c3bd[_0x2b0a88(0x298)])),_0x221c46=a133_0x43ada2[_0x2b0a88(0x21b)](_0x12598f,'code.js'),_0x5c07e5=a133_0x43ada2[_0x2b0a88(0x21b)](_0x12598f,_0x2b0a88(0x20f));_0x22e759[_0x2b0a88(0x24d)]({'path':_0x12598f,'content':'','isDir':!![]}),_0x22e759[_0x2b0a88(0x24d)]({'path':_0x221c46,'content':_0x55c3bd[_0x2b0a88(0x264)]}),_0x22e759['push']({'path':_0x5c07e5,'content':_0x55c3bd[_0x2b0a88(0x25a)]});}if(a133_0x483289['existsSync'](_0x4bfba2)){const _0x5125fe=a133_0x483289[_0x2b0a88(0x23a)](_0x4bfba2,{'withFileTypes':!![]}),_0x203a00=new Set(_0x492845['functions'][_0x2b0a88(0x25d)](_0x20a9ce=>sanitizeForFilesystem(_0x20a9ce[_0x2b0a88(0x298)])));for(const _0x590006 of _0x5125fe){if(_0x590006[_0x2b0a88(0x227)]()&&!_0x203a00[_0x2b0a88(0x1e1)](_0x590006[_0x2b0a88(0x298)])){const _0xb31f70=a133_0x43ada2['join'](_0x4bfba2,_0x590006[_0x2b0a88(0x298)]);_0x5d8016[_0x2b0a88(0x24d)]({'path':_0xb31f70,'isDir':!![]});}}}_0x4a2171['experimentalKnowledgeBases'][_0x2b0a88(0x24d)]({'name':_0x1c7c7c[_0x2b0a88(0x279)][_0x2b0a88(0x298)],'outputPath':_0x1e5f2d,'isNew':_0x3e6890,'hasChanges':_0x140dae,'diff':_0x3a67bf}),_0x4a2171['counts']['experimentalKnowledgeBases'][_0x2b0a88(0x2d2)]++;if(_0x3e6890)_0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x221)][_0x2b0a88(0x1c4)]++;else{if(_0x140dae)_0x4a2171['counts'][_0x2b0a88(0x221)][_0x2b0a88(0x232)]++;else _0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x221)][_0x2b0a88(0x1ec)]++;}}for(const _0x4d8899 of _0x2ee7d7){if(_0x4d8899[_0x2b0a88(0x279)][_0x2b0a88(0x26e)])continue;const _0x38e8d5=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x3e45c1),_0x4d8899[_0x2b0a88(0x279)][_0x2b0a88(0x298)]);_0x38e8d5['renamed']&&this['logger'][_0x2b0a88(0x21c)](_0x2b0a88(0x1ad)+a133_0x43ada2[_0x2b0a88(0x2a8)](_0x38e8d5['oldPath'])+_0x2b0a88(0x1c8)+a133_0x43ada2['basename'](_0x38e8d5[_0x2b0a88(0x22c)]));const _0x453b6d=_0x38e8d5[_0x2b0a88(0x22c)],_0xead19e=a133_0x43ada2[_0x2b0a88(0x21b)](_0x453b6d,sanitizeForFilesystem(_0x4d8899['attributes'][_0x2b0a88(0x298)])+_0x2b0a88(0x1fe)),_0x2f991b=a133_0x43ada2['join'](_0x453b6d,_0x2b0a88(0x216)),_0xceced=a133_0x43ada2[_0x2b0a88(0x21b)](_0x453b6d,_0x2b0a88(0x288)),_0x5cc547=apiExperimentalArtifactToYaml(_0x4d8899),_0x5cf257=toExperimentalArtifactYamlString(_0x5cc547),_0x199521=!a133_0x483289[_0x2b0a88(0x224)](_0x453b6d);let _0xa05679=_0x199521,_0x4a28dc,_0x129ddf=_0x5cf257+(_0x2b0a88(0x22e)+_0x5cc547[_0x2b0a88(0x264)]+'\x0a');const _0x706d59=[..._0x5cc547[_0x2b0a88(0x288)]]['sort']((_0x317c1d,_0x128711)=>_0x317c1d[_0x2b0a88(0x29a)][_0x2b0a88(0x296)](_0x128711[_0x2b0a88(0x29a)]));for(const _0x4908fc of _0x706d59){_0x129ddf+=_0x2b0a88(0x1d0)+_0x4908fc['file_name']+_0x2b0a88(0x2bc)+_0x4908fc[_0x2b0a88(0x268)]+'\x0a';}if(!_0x199521){let _0x565f10='';a133_0x483289['existsSync'](_0xead19e)&&(_0x565f10=a133_0x483289['readFileSync'](_0xead19e,_0x2b0a88(0x1e2)));a133_0x483289[_0x2b0a88(0x224)](_0x2f991b)&&(_0x565f10+=_0x2b0a88(0x22e)+a133_0x483289[_0x2b0a88(0x2a7)](_0x2f991b,'utf-8')+'\x0a');if(a133_0x483289[_0x2b0a88(0x224)](_0xceced)){const _0x5087d9=a133_0x483289[_0x2b0a88(0x23a)](_0xceced),_0x408441=_0x5087d9[_0x2b0a88(0x23f)](_0x1f65ac=>{const _0x1eb409=_0x2b0a88,_0x149e13=a133_0x43ada2[_0x1eb409(0x21b)](_0xceced,_0x1f65ac);return a133_0x483289[_0x1eb409(0x1c9)](_0x149e13)['isFile']();})['sort']((_0x53e692,_0x1dd745)=>_0x53e692[_0x2b0a88(0x296)](_0x1dd745));for(const _0x44445e of _0x408441){const _0x2c0404=a133_0x43ada2['join'](_0xceced,_0x44445e);_0x565f10+=_0x2b0a88(0x1d0)+_0x44445e+_0x2b0a88(0x2bc)+a133_0x483289[_0x2b0a88(0x2a7)](_0x2c0404,'utf-8')+'\x0a';}}const _0x341815=generateDiff(_0x565f10,_0x129ddf);_0xa05679=hasChanges(_0x341815),_0xa05679&&(_0x4a28dc=formatDiffWithColors(_0x341815));}_0x22e759[_0x2b0a88(0x24d)]({'path':_0x453b6d,'content':'','isDir':!![]}),_0x22e759[_0x2b0a88(0x24d)]({'path':_0xead19e,'content':_0x5cf257}),_0x22e759['push']({'path':_0x2f991b,'content':_0x5cc547[_0x2b0a88(0x264)]});if(_0x5cc547[_0x2b0a88(0x288)]['length']>0x0){_0x22e759[_0x2b0a88(0x24d)]({'path':_0xceced,'content':'','isDir':!![]});for(const _0x4c46e1 of _0x5cc547[_0x2b0a88(0x288)]){const _0x36a588=a133_0x43ada2[_0x2b0a88(0x21b)](_0xceced,_0x4c46e1[_0x2b0a88(0x29a)]);_0x22e759['push']({'path':_0x36a588,'content':_0x4c46e1[_0x2b0a88(0x268)]});}}if(a133_0x483289[_0x2b0a88(0x224)](_0xceced)){const _0x433726=a133_0x483289[_0x2b0a88(0x23a)](_0xceced),_0x23b7e6=new Set(_0x5cc547[_0x2b0a88(0x288)][_0x2b0a88(0x25d)](_0x1f7832=>_0x1f7832[_0x2b0a88(0x29a)]));for(const _0x13bd07 of _0x433726){const _0x351194=a133_0x43ada2[_0x2b0a88(0x21b)](_0xceced,_0x13bd07);a133_0x483289[_0x2b0a88(0x1c9)](_0x351194)['isFile']()&&!_0x23b7e6[_0x2b0a88(0x1e1)](_0x13bd07)&&_0x5d8016[_0x2b0a88(0x24d)]({'path':_0x351194});}}_0x4a2171[_0x2b0a88(0x2b3)][_0x2b0a88(0x24d)]({'name':_0x4d8899['attributes']['name'],'outputPath':_0x453b6d,'isNew':_0x199521,'hasChanges':_0xa05679,'diff':_0x4a28dc}),_0x4a2171['counts']['experimentalArtifacts'][_0x2b0a88(0x2d2)]++;if(_0x199521)_0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x2b3)]['new']++;else{if(_0xa05679)_0x4a2171['counts']['experimentalArtifacts']['updated']++;else _0x4a2171[_0x2b0a88(0x1f1)]['experimentalArtifacts'][_0x2b0a88(0x1ec)]++;}}for(const _0x587636 of _0x191b23){const _0x4c765b=getSanitizedPathWithMigration(getFormInterfacesDir(_0x3e45c1),_0x587636[_0x2b0a88(0x279)][_0x2b0a88(0x298)],_0x2b0a88(0x1fe));_0x4c765b[_0x2b0a88(0x26b)]&&this[_0x2b0a88(0x28c)][_0x2b0a88(0x21c)](_0x2b0a88(0x20c)+a133_0x43ada2[_0x2b0a88(0x2a8)](_0x4c765b[_0x2b0a88(0x29b)])+_0x2b0a88(0x1c8)+a133_0x43ada2[_0x2b0a88(0x2a8)](_0x4c765b[_0x2b0a88(0x22c)]));const _0x56c3b5=_0x4c765b[_0x2b0a88(0x22c)],_0x1cfc4d=await apiFormInterfaceToYaml(_0x587636,_0x3766ab),_0x38a317=toFormInterfaceYamlString(_0x1cfc4d),_0x5918cb=!a133_0x483289['existsSync'](_0x56c3b5);let _0x1be21e=_0x5918cb,_0x352d86;if(!_0x5918cb){const _0x28cb5c=a133_0x483289[_0x2b0a88(0x2a7)](_0x56c3b5,'utf-8'),_0x2179e0=generateDiff(_0x28cb5c,_0x38a317);_0x1be21e=hasChanges(_0x2179e0),_0x1be21e&&(_0x352d86=formatDiffWithColors(_0x2179e0));}_0x22e759[_0x2b0a88(0x24d)]({'path':_0x56c3b5,'content':_0x38a317}),_0x4a2171[_0x2b0a88(0x1ac)][_0x2b0a88(0x24d)]({'name':_0x587636['attributes'][_0x2b0a88(0x298)],'outputPath':_0x56c3b5,'isNew':_0x5918cb,'hasChanges':_0x1be21e,'diff':_0x352d86}),_0x4a2171[_0x2b0a88(0x1f1)]['formInterfaces']['total']++;if(_0x5918cb)_0x4a2171[_0x2b0a88(0x1f1)]['formInterfaces']['new']++;else{if(_0x1be21e)_0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x1ac)]['updated']++;else _0x4a2171[_0x2b0a88(0x1f1)]['formInterfaces'][_0x2b0a88(0x1ec)]++;}}for(const _0x58f8fa of _0x1cb1ca){if(_0x58f8fa[_0x2b0a88(0x279)]['isManaged'])continue;const _0x22e743=getSanitizedPathWithMigration(getChatInterfacesDir(_0x3e45c1),_0x58f8fa[_0x2b0a88(0x279)][_0x2b0a88(0x298)],_0x2b0a88(0x1fe));_0x22e743[_0x2b0a88(0x26b)]&&this[_0x2b0a88(0x28c)][_0x2b0a88(0x21c)](_0x2b0a88(0x1b6)+a133_0x43ada2[_0x2b0a88(0x2a8)](_0x22e743[_0x2b0a88(0x29b)])+'\x20→\x20'+a133_0x43ada2[_0x2b0a88(0x2a8)](_0x22e743[_0x2b0a88(0x22c)]));const _0x71744b=_0x22e743['path'],_0x154c69=await apiChatInterfaceToYaml(_0x58f8fa,_0x3766ab),_0x35bb34=toChatInterfaceYamlString(_0x154c69),_0x2a1032=!a133_0x483289[_0x2b0a88(0x224)](_0x71744b);let _0x2dbcf1=_0x2a1032,_0xc9c286;if(!_0x2a1032){const _0x4dcf06=a133_0x483289[_0x2b0a88(0x2a7)](_0x71744b,_0x2b0a88(0x1e2)),_0x580ede=generateDiff(_0x4dcf06,_0x35bb34);_0x2dbcf1=hasChanges(_0x580ede),_0x2dbcf1&&(_0xc9c286=formatDiffWithColors(_0x580ede));}_0x22e759['push']({'path':_0x71744b,'content':_0x35bb34}),_0x4a2171[_0x2b0a88(0x275)][_0x2b0a88(0x24d)]({'name':_0x58f8fa['attributes'][_0x2b0a88(0x298)],'outputPath':_0x71744b,'isNew':_0x2a1032,'hasChanges':_0x2dbcf1,'diff':_0xc9c286}),_0x4a2171['counts']['chatInterfaces'][_0x2b0a88(0x2d2)]++;if(_0x2a1032)_0x4a2171[_0x2b0a88(0x1f1)]['chatInterfaces']['new']++;else{if(_0x2dbcf1)_0x4a2171['counts'][_0x2b0a88(0x275)][_0x2b0a88(0x232)]++;else _0x4a2171[_0x2b0a88(0x1f1)][_0x2b0a88(0x275)][_0x2b0a88(0x1ec)]++;}}if(_0x3c6b3a?.['dryRun'])return _0x4a2171;a133_0x483289[_0x2b0a88(0x2cf)](_0x3e45c1,{'recursive':!![]}),a133_0x483289[_0x2b0a88(0x2cf)](getKnowledgeBasesDir(_0x3e45c1),{'recursive':!![]}),a133_0x483289[_0x2b0a88(0x2cf)](getPromptsDir(_0x3e45c1),{'recursive':!![]}),a133_0x483289[_0x2b0a88(0x2cf)](getIntegrationsDir(_0x3e45c1),{'recursive':!![]}),a133_0x483289[_0x2b0a88(0x2cf)](getExperimentalKnowledgeBasesDir(_0x3e45c1),{'recursive':!![]}),a133_0x483289[_0x2b0a88(0x2cf)](getExperimentalArtifactsDir(_0x3e45c1),{'recursive':!![]}),a133_0x483289[_0x2b0a88(0x2cf)](getFormInterfacesDir(_0x3e45c1),{'recursive':!![]}),a133_0x483289['mkdirSync'](getChatInterfacesDir(_0x3e45c1),{'recursive':!![]});const _0x5d3474=a133_0x43ada2['join'](_0x3e45c1,_0x2b0a88(0x2b1));a133_0x483289['writeFileSync'](_0x5d3474,createAgentConfigContent(_0x261762));for(const _0x1f2d05 of _0x22e759){if(_0x1f2d05[_0x2b0a88(0x2d4)])a133_0x483289[_0x2b0a88(0x2cf)](_0x1f2d05[_0x2b0a88(0x22c)],{'recursive':!![]});else{const _0x5b8a6e=a133_0x43ada2[_0x2b0a88(0x27d)](_0x1f2d05[_0x2b0a88(0x22c)]);!a133_0x483289[_0x2b0a88(0x224)](_0x5b8a6e)&&a133_0x483289['mkdirSync'](_0x5b8a6e,{'recursive':!![]}),a133_0x483289['writeFileSync'](_0x1f2d05[_0x2b0a88(0x22c)],_0x1f2d05[_0x2b0a88(0x28e)]);}}for(const _0x16f735 of _0x5d8016){_0x16f735[_0x2b0a88(0x2d4)]?(a133_0x483289[_0x2b0a88(0x1c6)](_0x16f735[_0x2b0a88(0x22c)],{'recursive':!![],'force':!![]}),this['logger']['info'](_0x2b0a88(0x260)+a133_0x43ada2[_0x2b0a88(0x2a8)](a133_0x43ada2['dirname'](_0x16f735['path']))+'/'+a133_0x43ada2[_0x2b0a88(0x2a8)](_0x16f735[_0x2b0a88(0x22c)]))):(a133_0x483289['rmSync'](_0x16f735[_0x2b0a88(0x22c)],{'force':!![]}),this['logger']['info']('Removed\x20deleted\x20file:\x20'+a133_0x43ada2['basename'](a133_0x43ada2[_0x2b0a88(0x27d)](_0x16f735[_0x2b0a88(0x22c)]))+'/'+a133_0x43ada2[_0x2b0a88(0x2a8)](_0x16f735[_0x2b0a88(0x22c)])));}return _0x4a2171;}async['pushProject'](_0x11971a,_0x8f9fcf){const _0x4ba205=a133_0xbc8366,_0x44140e=a133_0x43ada2[_0x4ba205(0x21b)](_0x11971a,_0x4ba205(0x2b1));if(!a133_0x483289[_0x4ba205(0x224)](_0x44140e))throw new SDKError(ErrorCode[_0x4ba205(0x2a1)],'No\x20tdx.json\x20found\x20in\x20'+_0x11971a,undefined,{'helpText':_0x4ba205(0x262)});const _0x3375d7=loadAgentConfig(_0x44140e),_0x52b474=await this[_0x4ba205(0x217)](_0x3375d7[_0x4ba205(0x290)]),_0x547d28=await this[_0x4ba205(0x1fa)][_0x4ba205(0x1df)](_0x52b474),_0x8d750=_0x547d28[_0x4ba205(0x279)][_0x4ba205(0x298)],_0x25d884={'projectName':_0x8d750,'projectId':_0x52b474,'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}}},_0xca2398=[],_0x48247d=[],_0xd1821a=[],_0x12fd32=[],_0x10db67=[],_0x239807=[],_0x16d179=a133_0x483289[_0x4ba205(0x23a)](_0x11971a,{'withFileTypes':!![]});for(const _0x58af4b of _0x16d179){if(!_0x58af4b[_0x4ba205(0x227)]())continue;if([_0x4ba205(0x2b8),_0x4ba205(0x1e6),_0x4ba205(0x278),_0x4ba205(0x2c1),'experimental_artifacts',_0x4ba205(0x1d1),_0x4ba205(0x1f0)]['includes'](_0x58af4b[_0x4ba205(0x298)]))continue;const _0x2215ea=a133_0x43ada2[_0x4ba205(0x21b)](_0x11971a,_0x58af4b[_0x4ba205(0x298)]);if(isAgentDir(_0x2215ea)){const _0x392d8a=a133_0x43ada2['join'](_0x2215ea,_0x4ba205(0x20e)),_0x280cd3=a133_0x43ada2[_0x4ba205(0x21b)](_0x2215ea,_0x4ba205(0x1ee)),_0x5a5e1c=a133_0x43ada2['join'](_0x2215ea,_0x4ba205(0x284)),_0x3a14de=parseAgentYaml(a133_0x483289[_0x4ba205(0x2a7)](_0x392d8a,_0x4ba205(0x1e2)),_0x392d8a),_0x34c6d1=a133_0x483289[_0x4ba205(0x224)](_0x280cd3)?a133_0x483289[_0x4ba205(0x2a7)](_0x280cd3,_0x4ba205(0x1e2)):'',_0xa879ec=a133_0x483289[_0x4ba205(0x224)](_0x5a5e1c)?a133_0x483289[_0x4ba205(0x2a7)](_0x5a5e1c,_0x4ba205(0x1e2)):_0x3a14de[_0x4ba205(0x1ce)];_0xca2398[_0x4ba205(0x24d)]({'name':_0x3a14de[_0x4ba205(0x298)],'dir':_0x2215ea,'yaml':_0x3a14de,'systemPrompt':_0x34c6d1,'starterMessage':_0xa879ec});}}const _0x56a27e=getKnowledgeBasesDir(_0x11971a);if(a133_0x483289['existsSync'](_0x56a27e)){const _0x30bd33=a133_0x483289[_0x4ba205(0x23a)](_0x56a27e);for(const _0x3ae0e1 of _0x30bd33){const _0x75d2de=a133_0x43ada2[_0x4ba205(0x21b)](_0x56a27e,_0x3ae0e1);if(_0x3ae0e1[_0x4ba205(0x2bb)]('.yml')){const _0x27c339=parseKnowledgeBaseYaml(a133_0x483289[_0x4ba205(0x2a7)](_0x75d2de,_0x4ba205(0x1e2)),_0x75d2de);_0x48247d[_0x4ba205(0x24d)]({'name':_0x27c339[_0x4ba205(0x298)],'path':_0x75d2de,'yaml':_0x27c339});}else{if(_0x3ae0e1['endsWith'](_0x4ba205(0x263))){const _0x1bb9db=a133_0x483289[_0x4ba205(0x2a7)](_0x75d2de,_0x4ba205(0x1e2)),{name:_0x19aff0,text:_0x5b8084}=parseTextKnowledgeBaseMd(_0x1bb9db,_0x3ae0e1);_0xd1821a['push']({'name':_0x19aff0,'path':_0x75d2de,'text':_0x5b8084});}}}}const _0x45967c=getPromptsDir(_0x11971a);if(a133_0x483289[_0x4ba205(0x224)](_0x45967c)){const _0x54e356=a133_0x483289['readdirSync'](_0x45967c)[_0x4ba205(0x23f)](_0x94be11=>_0x94be11[_0x4ba205(0x2bb)](_0x4ba205(0x1fe)));for(const _0x389b5f of _0x54e356){const _0x247f57=a133_0x43ada2['join'](_0x45967c,_0x389b5f),_0x22178c=parsePromptYaml(a133_0x483289[_0x4ba205(0x2a7)](_0x247f57,_0x4ba205(0x1e2)),_0x247f57);_0x12fd32['push']({'name':_0x22178c[_0x4ba205(0x298)],'path':_0x247f57,'yaml':_0x22178c});}}const _0x1459ed=[],_0x30757a=getIntegrationsDir(_0x11971a);if(a133_0x483289[_0x4ba205(0x224)](_0x30757a)){const _0x1ae6b6=a133_0x483289['readdirSync'](_0x30757a)[_0x4ba205(0x23f)](_0x1e4c96=>_0x1e4c96[_0x4ba205(0x2bb)](_0x4ba205(0x1fe)));for(const _0x284d43 of _0x1ae6b6){const _0x4fe46a=a133_0x43ada2[_0x4ba205(0x21b)](_0x30757a,_0x284d43),_0x35f147=parseIntegrationYaml(a133_0x483289[_0x4ba205(0x2a7)](_0x4fe46a,'utf-8'),_0x4fe46a);if(!SAFE_INTEGRATION_TYPES[_0x4ba205(0x1af)](_0x35f147[_0x4ba205(0x1b7)][_0x4ba205(0x293)]())){this['logger'][_0x4ba205(0x2d1)](_0x4ba205(0x228)+_0x35f147[_0x4ba205(0x298)]+_0x4ba205(0x249)+_0x35f147[_0x4ba205(0x1b7)]+_0x4ba205(0x292)+(_0x4ba205(0x2be)+SAFE_INTEGRATION_TYPES[_0x4ba205(0x21b)](',\x20')+_0x4ba205(0x1c0))+_0x4ba205(0x2c2));continue;}_0x1459ed[_0x4ba205(0x24d)]({'name':_0x35f147[_0x4ba205(0x298)],'path':_0x4fe46a,'yaml':_0x35f147});}}const _0x1e43f1=getExperimentalKnowledgeBasesDir(_0x11971a);if(a133_0x483289['existsSync'](_0x1e43f1)){const _0x4781a1=a133_0x483289[_0x4ba205(0x23a)](_0x1e43f1,{'withFileTypes':!![]});for(const _0x2a0f6a of _0x4781a1){if(!_0x2a0f6a[_0x4ba205(0x227)]())continue;const _0x3415fe=a133_0x43ada2[_0x4ba205(0x21b)](_0x1e43f1,_0x2a0f6a[_0x4ba205(0x298)]),_0x2cab5c=a133_0x43ada2[_0x4ba205(0x21b)](_0x3415fe,_0x2a0f6a[_0x4ba205(0x298)]+_0x4ba205(0x1fe)),_0xa9ecf4=a133_0x43ada2[_0x4ba205(0x21b)](_0x3415fe,_0x4ba205(0x1f6));if(!a133_0x483289[_0x4ba205(0x224)](_0x2cab5c))continue;const _0x2fa5a9=parseExperimentalKnowledgeBaseYaml(a133_0x483289[_0x4ba205(0x2a7)](_0x2cab5c,_0x4ba205(0x1e2)),_0x2cab5c),_0x4b868b=[];if(a133_0x483289[_0x4ba205(0x224)](_0xa9ecf4)){const _0x2b0972=a133_0x483289['readdirSync'](_0xa9ecf4,{'withFileTypes':!![]});for(const _0x43346b of _0x2b0972){if(!_0x43346b[_0x4ba205(0x227)]())continue;const _0x291d6d=a133_0x43ada2['join'](_0xa9ecf4,_0x43346b[_0x4ba205(0x298)]),_0x313eaa=a133_0x43ada2['join'](_0x291d6d,_0x4ba205(0x216)),_0x3eb926=a133_0x43ada2[_0x4ba205(0x21b)](_0x291d6d,_0x4ba205(0x20f));a133_0x483289[_0x4ba205(0x224)](_0x313eaa)&&a133_0x483289['existsSync'](_0x3eb926)&&_0x4b868b['push']({'name':_0x43346b[_0x4ba205(0x298)],'code':a133_0x483289[_0x4ba205(0x2a7)](_0x313eaa,_0x4ba205(0x1e2)),'json_schema':a133_0x483289['readFileSync'](_0x3eb926,_0x4ba205(0x1e2))});}}const _0x4a541b={..._0x2fa5a9,'variables':_0x2fa5a9[_0x4ba205(0x282)]||[],'functions':_0x4b868b};_0x10db67['push']({'name':_0x2fa5a9[_0x4ba205(0x298)],'dir':_0x3415fe,'def':_0x4a541b});}}const _0x23405f=getExperimentalArtifactsDir(_0x11971a);if(a133_0x483289[_0x4ba205(0x224)](_0x23405f)){const _0xc11ae1=a133_0x483289[_0x4ba205(0x23a)](_0x23405f,{'withFileTypes':!![]});for(const _0x2376cf of _0xc11ae1){if(!_0x2376cf['isDirectory']())continue;const _0x5627c2=a133_0x43ada2[_0x4ba205(0x21b)](_0x23405f,_0x2376cf['name']),_0x21b2c2=a133_0x43ada2[_0x4ba205(0x21b)](_0x5627c2,_0x2376cf['name']+'.yml'),_0x4f5afe=a133_0x43ada2['join'](_0x5627c2,_0x4ba205(0x216)),_0xce757d=a133_0x43ada2[_0x4ba205(0x21b)](_0x5627c2,_0x4ba205(0x288));if(!a133_0x483289[_0x4ba205(0x224)](_0x21b2c2)||!a133_0x483289[_0x4ba205(0x224)](_0x4f5afe))continue;const _0x3db8e6=parseExperimentalArtifactYaml(a133_0x483289[_0x4ba205(0x2a7)](_0x21b2c2,'utf-8'),_0x21b2c2),_0x28fb4b=a133_0x483289[_0x4ba205(0x2a7)](_0x4f5afe,_0x4ba205(0x1e2)),_0x4770e7=[];if(a133_0x483289[_0x4ba205(0x224)](_0xce757d)){const _0x1db0fe=a133_0x483289[_0x4ba205(0x23a)](_0xce757d);for(const _0x53ce83 of _0x1db0fe){const _0x4f6bc4=a133_0x43ada2[_0x4ba205(0x21b)](_0xce757d,_0x53ce83);a133_0x483289[_0x4ba205(0x1c9)](_0x4f6bc4)[_0x4ba205(0x24f)]()&&_0x4770e7[_0x4ba205(0x24d)]({'file_name':_0x53ce83,'text_content':a133_0x483289[_0x4ba205(0x2a7)](_0x4f6bc4,_0x4ba205(0x1e2))});}}const _0x35ae44={..._0x3db8e6,'code':_0x28fb4b,'files':_0x4770e7};_0x239807[_0x4ba205(0x24d)]({'name':_0x3db8e6[_0x4ba205(0x298)],'dir':_0x5627c2,'def':_0x35ae44});}}const _0x21945f=[],_0x2bb2fd=getFormInterfacesDir(_0x11971a);if(a133_0x483289[_0x4ba205(0x224)](_0x2bb2fd)){const _0x556c76=a133_0x483289[_0x4ba205(0x23a)](_0x2bb2fd)['filter'](_0x3ed464=>_0x3ed464[_0x4ba205(0x2bb)](_0x4ba205(0x1fe)));for(const _0x2edb76 of _0x556c76){const _0x4bfdff=a133_0x43ada2[_0x4ba205(0x21b)](_0x2bb2fd,_0x2edb76),_0x29d47a=parseFormInterfaceYaml(a133_0x483289[_0x4ba205(0x2a7)](_0x4bfdff,'utf-8'),_0x4bfdff);_0x21945f['push']({'name':_0x29d47a[_0x4ba205(0x298)],'path':_0x4bfdff,'yaml':_0x29d47a});}}const _0x44bb57=[],_0xf0eacf=getChatInterfacesDir(_0x11971a);if(a133_0x483289[_0x4ba205(0x224)](_0xf0eacf)){const _0x40effa=a133_0x483289['readdirSync'](_0xf0eacf)[_0x4ba205(0x23f)](_0x4ddf3e=>_0x4ddf3e[_0x4ba205(0x2bb)]('.yml'));for(const _0x443e61 of _0x40effa){const _0xb04042=a133_0x43ada2[_0x4ba205(0x21b)](_0xf0eacf,_0x443e61),_0x475270=parseChatInterfaceYaml(a133_0x483289[_0x4ba205(0x2a7)](_0xb04042,'utf-8'),_0xb04042);_0x44bb57['push']({'name':_0x475270[_0x4ba205(0x298)],'path':_0xb04042,'yaml':_0x475270});}}const _0x4323ea=await this[_0x4ba205(0x1fa)][_0x4ba205(0x2cb)](_0x52b474),_0x348fb7=await this[_0x4ba205(0x1fa)]['listKnowledgeBases'](_0x52b474),_0x440852=await this[_0x4ba205(0x1fa)][_0x4ba205(0x2b5)](_0x52b474),_0x1589b6=await this['client'][_0x4ba205(0x273)](_0x52b474),_0x5ab4e6=await this[_0x4ba205(0x1fa)][_0x4ba205(0x1fd)](_0x52b474),_0x438ee3=await safeListOrEmpty(()=>this[_0x4ba205(0x1fa)]['listExperimentalKnowledgeBases'](_0x52b474)),_0x5933e7=await safeListOrEmpty(()=>this[_0x4ba205(0x1fa)][_0x4ba205(0x243)](_0x52b474)),_0x176789=await safeListOrEmpty(()=>this[_0x4ba205(0x1fa)][_0x4ba205(0x247)](_0x52b474)),_0x140d7f=await safeListOrEmpty(()=>this[_0x4ba205(0x1fa)]['listChatInterfaces'](_0x52b474)),_0x4e6724=await fetchAllToolTargetMaps((_0x237c92,_0x530e1a)=>this[_0x4ba205(0x1fa)]['listToolTargets'](_0x237c92,_0x530e1a),_0x52b474),_0x46d34c=new Map(),_0x4e0537=new Map(),_0x4119ab=new Map(),_0xce6e2a=new Map(),_0x2391d5=new Map(),_0x489a60=new Map(),_0x21d32e=new Map();for(const _0x55ad3c of _0x4323ea){_0x46d34c['set'](_0x55ad3c[_0x4ba205(0x279)][_0x4ba205(0x298)],_0x55ad3c);}for(const _0x1a2533 of _0x348fb7){_0x4e0537[_0x4ba205(0x2d8)](_0x1a2533[_0x4ba205(0x279)]['name'],_0x1a2533);}for(const _0x392943 of _0x440852){_0x4119ab[_0x4ba205(0x2d8)](_0x392943['attributes'][_0x4ba205(0x298)],_0x392943);}for(const _0x14fc75 of _0x1589b6){_0xce6e2a['set'](_0x14fc75[_0x4ba205(0x279)][_0x4ba205(0x298)],_0x14fc75);}for(const _0x20ddb7 of _0x5ab4e6){_0x2391d5[_0x4ba205(0x2d8)](_0x20ddb7[_0x4ba205(0x279)][_0x4ba205(0x1cc)][_0x4ba205(0x293)](),_0x20ddb7);}for(const _0x3b599a of _0x438ee3){_0x489a60[_0x4ba205(0x2d8)](_0x3b599a['attributes'][_0x4ba205(0x298)],_0x3b599a);}for(const _0x1e075c of _0x5933e7){_0x21d32e[_0x4ba205(0x2d8)](_0x1e075c['attributes'][_0x4ba205(0x298)],_0x1e075c);}const _0x44ae33=new Map(),_0xea0216=new Map();for(const _0x297e2f of _0x176789){_0x44ae33[_0x4ba205(0x2d8)](_0x297e2f[_0x4ba205(0x279)][_0x4ba205(0x298)],_0x297e2f);}for(const _0x447bf5 of _0x140d7f){_0xea0216['set'](_0x447bf5[_0x4ba205(0x279)]['name'],_0x447bf5);}const _0x55eec7=new Map(),_0x166289=new Map();for(const _0x2ec0cb of _0x4323ea){_0x55eec7[_0x4ba205(0x2d8)](_0x2ec0cb[_0x4ba205(0x279)][_0x4ba205(0x298)],_0x2ec0cb['id']),_0x166289[_0x4ba205(0x2d8)](_0x2ec0cb['id'],_0x2ec0cb[_0x4ba205(0x279)][_0x4ba205(0x298)]);}const _0x41517d=new Map(),_0x354120=new Map();for(const _0x231186 of _0x1589b6){_0x41517d[_0x4ba205(0x2d8)](_0x231186['attributes'][_0x4ba205(0x298)],_0x231186['id']),_0x354120['set'](_0x231186['id'],_0x231186[_0x4ba205(0x279)][_0x4ba205(0x298)]);}const _0x165761=_0x4e6724['nameToId'][_0x4ba205(0x201)]||new Map(),_0x762416=_0x4e6724[_0x4ba205(0x205)]['TextKnowledgeBase']||new Map(),_0x3f21e3=_0x4e6724[_0x4ba205(0x205)][_0x4ba205(0x2c8)]||new Map(),_0x10e36c=new Map(),_0x1bc3ac={'resolveToolTargetName':buildNameResolver({..._0x4e6724[_0x4ba205(0x2ad)],'Agent':_0x166289}),'resolvePromptName':async _0x585e1f=>_0x354120[_0x4ba205(0x1bc)](_0x585e1f),'onWarning':_0x35ab1b=>this['logger'][_0x4ba205(0x2d1)](_0x35ab1b)};let _0x1de5ad=[];const _0x542e80={'projectId':_0x52b474,'resolveToolTargetId':buildIdResolver({..._0x4e6724[_0x4ba205(0x205)],'Agent':_0x55eec7}),'resolvePromptId':async _0xc92bd7=>_0x41517d[_0x4ba205(0x1bc)](_0xc92bd7),'onWarning':_0x5e7652=>{const _0x3a6e47=_0x4ba205;this[_0x3a6e47(0x28c)]['warn'](_0x5e7652),_0x1de5ad[_0x3a6e47(0x24d)](_0x5e7652);}},{resolved:_0x2cb5e7,unresolved:_0xced8c8}=resolveAgentDependencies(_0xca2398,new Set(_0x46d34c['keys']()));for(const {agent:_0x14536c,missingDeps:_0x32d365}of _0xced8c8){_0x25d884[_0x4ba205(0x1e0)][_0x4ba205(0x24d)]({'agentName':_0x14536c[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x1b0),'error':_0x4ba205(0x1d8)+_0x32d365[_0x4ba205(0x21b)](',\x20')+'.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.'}),_0x25d884[_0x4ba205(0x1f1)]['agents']['errors']++;}for(const _0x7615c2 of _0x48247d){const _0x42c3ed=_0x4e0537[_0x4ba205(0x1bc)](_0x7615c2[_0x4ba205(0x2c3)]['name']),_0x12e85f=a133_0x483289[_0x4ba205(0x2a7)](_0x7615c2[_0x4ba205(0x22c)],_0x4ba205(0x1e2));if(_0x42c3ed){const _0x367850=apiKnowledgeBaseToYaml(_0x42c3ed),_0x59aaea=toKnowledgeBaseYamlString(_0x367850),_0x313f05=generateDiff(_0x59aaea,_0x12e85f),_0x4d5529=hasChanges(_0x313f05);_0x4d5529?(_0x25d884[_0x4ba205(0x1db)][_0x4ba205(0x24d)]({'name':_0x7615c2[_0x4ba205(0x2c3)]['name'],'action':_0x4ba205(0x232),'id':_0x42c3ed['id'],'diff':formatDiffWithColors(_0x313f05)}),_0x25d884[_0x4ba205(0x1f1)]['knowledgeBases'][_0x4ba205(0x232)]++):(_0x25d884[_0x4ba205(0x1db)][_0x4ba205(0x24d)]({'name':_0x7615c2[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x1ec),'id':_0x42c3ed['id']}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1db)][_0x4ba205(0x1ec)]++);}else _0x25d884['knowledgeBases'][_0x4ba205(0x24d)]({'name':_0x7615c2[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x2bd)}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1db)][_0x4ba205(0x2bd)]++;}for(const _0x2c64c9 of _0xd1821a){const _0x147e78=_0x4119ab['get'](_0x2c64c9['name']),_0x5d5f7b=a133_0x483289[_0x4ba205(0x2a7)](_0x2c64c9[_0x4ba205(0x22c)],'utf-8');if(_0x147e78){const _0x31cfc1=toTextKnowledgeBaseMd(_0x147e78[_0x4ba205(0x279)]['name'],_0x147e78[_0x4ba205(0x279)][_0x4ba205(0x200)]),_0x2c37a7=generateDiff(_0x31cfc1,_0x5d5f7b),_0x374278=hasChanges(_0x2c37a7);_0x374278?(_0x25d884[_0x4ba205(0x1cb)]['push']({'name':_0x2c64c9['name'],'action':_0x4ba205(0x232),'id':_0x147e78['id'],'diff':formatDiffWithColors(_0x2c37a7)}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1cb)][_0x4ba205(0x232)]++):(_0x25d884[_0x4ba205(0x1cb)]['push']({'name':_0x2c64c9['name'],'action':_0x4ba205(0x1ec),'id':_0x147e78['id']}),_0x25d884[_0x4ba205(0x1f1)]['textKnowledgeBases'][_0x4ba205(0x1ec)]++);}else _0x25d884['textKnowledgeBases'][_0x4ba205(0x24d)]({'name':_0x2c64c9[_0x4ba205(0x298)],'action':_0x4ba205(0x2bd)}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1cb)][_0x4ba205(0x2bd)]++;}for(const _0x2e27aa of _0x2cb5e7){const _0x3c0a63=_0x46d34c['get'](_0x2e27aa[_0x4ba205(0x2c3)]['name']),_0x5a8297=a133_0x43ada2[_0x4ba205(0x21b)](_0x2e27aa[_0x4ba205(0x27a)],_0x4ba205(0x20e)),_0xe3721b=a133_0x483289['readFileSync'](_0x5a8297,_0x4ba205(0x1e2)),_0x268551=_0x2e27aa[_0x4ba205(0x206)],_0x10e25d='#\x20prompt.md\x0a'+_0x268551+_0x4ba205(0x204)+_0xe3721b;if(_0x3c0a63){const {yaml:_0x2202f7,systemPrompt:_0x15e186}=await agentResponseToDef(_0x3c0a63,_0x1bc3ac),_0x5549cc=toAgentYamlString(_0x2202f7),_0x3a99eb=_0x4ba205(0x28d)+_0x15e186+'\x0a\x0a#\x20agent.yml\x0a'+_0x5549cc,_0x5e136c=generateDiff(_0x3a99eb,_0x10e25d),_0x4dcc45=hasChanges(_0x5e136c);_0x4dcc45?(_0x25d884[_0x4ba205(0x1e0)][_0x4ba205(0x24d)]({'agentName':_0x2e27aa['yaml'][_0x4ba205(0x298)],'action':_0x4ba205(0x232),'agentId':_0x3c0a63['id'],'diff':formatDiffWithColors(_0x5e136c)}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1e0)][_0x4ba205(0x232)]++):(_0x25d884[_0x4ba205(0x1e0)][_0x4ba205(0x24d)]({'agentName':_0x2e27aa['yaml'][_0x4ba205(0x298)],'action':_0x4ba205(0x1ec),'agentId':_0x3c0a63['id']}),_0x25d884['counts'][_0x4ba205(0x1e0)]['unchanged']++);}else _0x25d884[_0x4ba205(0x1e0)][_0x4ba205(0x24d)]({'agentName':_0x2e27aa[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x2bd)}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1e0)][_0x4ba205(0x2bd)]++;}for(const _0x15cc21 of _0x12fd32){const _0x35f5e4=_0xce6e2a['get'](_0x15cc21['yaml'][_0x4ba205(0x298)]),_0x1a0e0d=a133_0x483289[_0x4ba205(0x2a7)](_0x15cc21[_0x4ba205(0x22c)],_0x4ba205(0x1e2));if(_0x35f5e4){const _0x498c84=await apiPromptToYaml(_0x35f5e4,_0x1bc3ac);if(!_0x498c84){_0x25d884[_0x4ba205(0x1e6)][_0x4ba205(0x24d)]({'name':_0x15cc21[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x232),'id':_0x35f5e4['id']}),_0x25d884['counts'][_0x4ba205(0x1e6)][_0x4ba205(0x232)]++;continue;}const _0x4c06b5=toPromptYamlString(_0x498c84),_0x466682=generateDiff(_0x4c06b5,_0x1a0e0d),_0x29feda=hasChanges(_0x466682);_0x29feda?(_0x25d884[_0x4ba205(0x1e6)][_0x4ba205(0x24d)]({'name':_0x15cc21[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x232),'id':_0x35f5e4['id'],'diff':formatDiffWithColors(_0x466682)}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1e6)][_0x4ba205(0x232)]++):(_0x25d884[_0x4ba205(0x1e6)][_0x4ba205(0x24d)]({'name':_0x15cc21[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':'unchanged','id':_0x35f5e4['id']}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1e6)][_0x4ba205(0x1ec)]++);}else _0x25d884[_0x4ba205(0x1e6)][_0x4ba205(0x24d)]({'name':_0x15cc21[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x2bd)}),_0x25d884['counts'][_0x4ba205(0x1e6)]['created']++;}for(const _0x2c7483 of _0x1459ed){const _0x4a7817=_0x2391d5[_0x4ba205(0x1bc)](_0x2c7483['yaml']['service_type']),_0x318d4d=a133_0x483289[_0x4ba205(0x2a7)](_0x2c7483['path'],_0x4ba205(0x1e2));if(_0x4a7817){const _0xf622e4=await apiIntegrationToYaml(_0x4a7817,_0x1bc3ac),_0x3edaa0=toIntegrationYamlString(_0xf622e4),_0x2fb6d0=generateDiff(_0x3edaa0,_0x318d4d),_0x2722cb=hasChanges(_0x2fb6d0);_0x2722cb?(_0x25d884[_0x4ba205(0x278)][_0x4ba205(0x24d)]({'name':_0x2c7483[_0x4ba205(0x2c3)][_0x4ba205(0x1b7)],'action':_0x4ba205(0x232),'id':_0x4a7817['id'],'diff':formatDiffWithColors(_0x2fb6d0)}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x278)][_0x4ba205(0x232)]++):(_0x25d884[_0x4ba205(0x278)]['push']({'name':_0x2c7483[_0x4ba205(0x2c3)]['service_type'],'action':'unchanged','id':_0x4a7817['id']}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x278)]['unchanged']++);}else _0x25d884[_0x4ba205(0x278)][_0x4ba205(0x24d)]({'name':_0x2c7483[_0x4ba205(0x2c3)][_0x4ba205(0x1b7)],'action':_0x4ba205(0x2bd)}),_0x25d884['counts'][_0x4ba205(0x278)]['created']++;}for(const _0x587059 of _0x10db67){const _0x2e578f=_0x489a60[_0x4ba205(0x1bc)](_0x587059[_0x4ba205(0x209)][_0x4ba205(0x298)]),_0xb940f=toExperimentalKnowledgeBaseYamlString(_0x587059[_0x4ba205(0x209)]);let _0x3c457a=_0xb940f;for(const _0x55dff8 of _0x587059[_0x4ba205(0x209)][_0x4ba205(0x1f6)]){_0x3c457a+=_0x4ba205(0x27f)+_0x55dff8['name']+_0x4ba205(0x2bc)+_0x55dff8[_0x4ba205(0x264)]+_0x4ba205(0x1f3)+_0x55dff8[_0x4ba205(0x298)]+_0x4ba205(0x2bc)+_0x55dff8[_0x4ba205(0x25a)]+'\x0a';}if(_0x2e578f){const _0x20d039=apiExperimentalKnowledgeBaseToYaml(_0x2e578f),_0x5addf9=toExperimentalKnowledgeBaseYamlString(_0x20d039);let _0x4387b9=_0x5addf9;for(const _0x3fc655 of _0x20d039[_0x4ba205(0x1f6)]){_0x4387b9+='\x0a---\x20function:\x20'+_0x3fc655[_0x4ba205(0x298)]+'\x20---\x0a'+_0x3fc655['code']+_0x4ba205(0x1f3)+_0x3fc655['name']+_0x4ba205(0x2bc)+_0x3fc655['json_schema']+'\x0a';}const _0x3a1952=generateDiff(_0x4387b9,_0x3c457a),_0x24be41=hasChanges(_0x3a1952);_0x24be41?(_0x25d884[_0x4ba205(0x221)][_0x4ba205(0x24d)]({'name':_0x587059[_0x4ba205(0x209)][_0x4ba205(0x298)],'action':_0x4ba205(0x232),'id':_0x2e578f['id'],'diff':formatDiffWithColors(_0x3a1952)}),_0x25d884['counts'][_0x4ba205(0x221)][_0x4ba205(0x232)]++):(_0x25d884[_0x4ba205(0x221)][_0x4ba205(0x24d)]({'name':_0x587059[_0x4ba205(0x209)][_0x4ba205(0x298)],'action':'unchanged','id':_0x2e578f['id']}),_0x25d884[_0x4ba205(0x1f1)]['experimentalKnowledgeBases']['unchanged']++);}else _0x25d884['experimentalKnowledgeBases'][_0x4ba205(0x24d)]({'name':_0x587059[_0x4ba205(0x209)][_0x4ba205(0x298)],'action':_0x4ba205(0x2bd)}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x221)][_0x4ba205(0x2bd)]++;}for(const _0x1cf7bc of _0x239807){const _0x2e18d3=_0x21d32e[_0x4ba205(0x1bc)](_0x1cf7bc[_0x4ba205(0x209)][_0x4ba205(0x298)]),_0x30bec5=toExperimentalArtifactYamlString(_0x1cf7bc[_0x4ba205(0x209)]);let _0x36ce2c=_0x30bec5+(_0x4ba205(0x22e)+_0x1cf7bc['def'][_0x4ba205(0x264)]+'\x0a');for(const _0x5e93b1 of _0x1cf7bc[_0x4ba205(0x209)][_0x4ba205(0x288)]){_0x36ce2c+=_0x4ba205(0x1d0)+_0x5e93b1[_0x4ba205(0x29a)]+_0x4ba205(0x2bc)+_0x5e93b1[_0x4ba205(0x268)]+'\x0a';}if(_0x2e18d3){const _0x29949b=apiExperimentalArtifactToYaml(_0x2e18d3),_0xddf29a=toExperimentalArtifactYamlString(_0x29949b);let _0x52ffd5=_0xddf29a+('\x0a---\x20code\x20---\x0a'+_0x29949b[_0x4ba205(0x264)]+'\x0a');for(const _0x112920 of _0x29949b[_0x4ba205(0x288)]){_0x52ffd5+=_0x4ba205(0x1d0)+_0x112920[_0x4ba205(0x29a)]+_0x4ba205(0x2bc)+_0x112920[_0x4ba205(0x268)]+'\x0a';}const _0x124f33=generateDiff(_0x52ffd5,_0x36ce2c),_0x38e0a4=hasChanges(_0x124f33);_0x38e0a4?(_0x25d884[_0x4ba205(0x2b3)]['push']({'name':_0x1cf7bc['def']['name'],'action':_0x4ba205(0x232),'id':_0x2e18d3['id'],'diff':formatDiffWithColors(_0x124f33)}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x2b3)][_0x4ba205(0x232)]++):(_0x25d884[_0x4ba205(0x2b3)]['push']({'name':_0x1cf7bc[_0x4ba205(0x209)][_0x4ba205(0x298)],'action':_0x4ba205(0x1ec),'id':_0x2e18d3['id']}),_0x25d884['counts'][_0x4ba205(0x2b3)]['unchanged']++);}else _0x25d884[_0x4ba205(0x2b3)][_0x4ba205(0x24d)]({'name':_0x1cf7bc[_0x4ba205(0x209)][_0x4ba205(0x298)],'action':_0x4ba205(0x2bd)}),_0x25d884['counts']['experimentalArtifacts']['created']++;}for(const _0x1df8fc of _0x21945f){const _0x462415=_0x44ae33['get'](_0x1df8fc[_0x4ba205(0x2c3)][_0x4ba205(0x298)]),_0xc43626=a133_0x483289[_0x4ba205(0x2a7)](_0x1df8fc[_0x4ba205(0x22c)],_0x4ba205(0x1e2));if(_0x462415){const _0x25c599=await apiFormInterfaceToYaml(_0x462415,_0x1bc3ac),_0x21ae1f=toFormInterfaceYamlString(_0x25c599),_0x4a489c=generateDiff(_0x21ae1f,_0xc43626),_0x1db16d=hasChanges(_0x4a489c);_0x1db16d?(_0x25d884['formInterfaces']['push']({'name':_0x1df8fc[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x232),'id':_0x462415['id'],'diff':formatDiffWithColors(_0x4a489c)}),_0x25d884['counts'][_0x4ba205(0x1ac)]['updated']++):(_0x25d884[_0x4ba205(0x1ac)][_0x4ba205(0x24d)]({'name':_0x1df8fc[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x1ec),'id':_0x462415['id']}),_0x25d884[_0x4ba205(0x1f1)]['formInterfaces'][_0x4ba205(0x1ec)]++);}else _0x25d884['formInterfaces'][_0x4ba205(0x24d)]({'name':_0x1df8fc[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x2bd)}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1ac)][_0x4ba205(0x2bd)]++;}for(const _0x29f937 of _0x44bb57){const _0x2fb3a4=_0xea0216[_0x4ba205(0x1bc)](_0x29f937[_0x4ba205(0x2c3)]['name']),_0x563768=a133_0x483289[_0x4ba205(0x2a7)](_0x29f937[_0x4ba205(0x22c)],_0x4ba205(0x1e2));if(_0x2fb3a4){const _0x8becae=await apiChatInterfaceToYaml(_0x2fb3a4,_0x1bc3ac),_0x5bc37a=toChatInterfaceYamlString(_0x8becae),_0x5694dc=generateDiff(_0x5bc37a,_0x563768),_0x41337e=hasChanges(_0x5694dc);_0x41337e?(_0x25d884['chatInterfaces'][_0x4ba205(0x24d)]({'name':_0x29f937[_0x4ba205(0x2c3)]['name'],'action':_0x4ba205(0x232),'id':_0x2fb3a4['id'],'diff':formatDiffWithColors(_0x5694dc)}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x275)]['updated']++):(_0x25d884[_0x4ba205(0x275)][_0x4ba205(0x24d)]({'name':_0x29f937[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x1ec),'id':_0x2fb3a4['id']}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x275)][_0x4ba205(0x1ec)]++);}else _0x25d884[_0x4ba205(0x275)][_0x4ba205(0x24d)]({'name':_0x29f937['yaml'][_0x4ba205(0x298)],'action':'created'}),_0x25d884['counts'][_0x4ba205(0x275)][_0x4ba205(0x2bd)]++;}if(_0x8f9fcf?.[_0x4ba205(0x294)])return _0x25d884;_0x25d884[_0x4ba205(0x1db)]=[],_0x25d884[_0x4ba205(0x1cb)]=[],_0x25d884[_0x4ba205(0x1e6)]=[],_0x25d884[_0x4ba205(0x278)]=[],_0x25d884[_0x4ba205(0x221)]=[],_0x25d884['experimentalArtifacts']=[],_0x25d884[_0x4ba205(0x1ac)]=[],_0x25d884[_0x4ba205(0x275)]=[];const _0x442658=_0x25d884[_0x4ba205(0x1e0)][_0x4ba205(0x23f)](_0x1398e0=>_0x1398e0[_0x4ba205(0x1e5)]===_0x4ba205(0x1b0));_0x25d884[_0x4ba205(0x1e0)]=_0x442658,_0x25d884['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x442658[_0x4ba205(0x2b6)]},'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 _0x36ef52 of _0x48247d){try{const _0x4d408e=_0x4e0537[_0x4ba205(0x1bc)](_0x36ef52[_0x4ba205(0x2c3)]['name']),_0xbd2227=yamlKnowledgeBaseToApi(_0x36ef52[_0x4ba205(0x2c3)],_0x52b474);if(_0x4d408e)await this[_0x4ba205(0x1fa)][_0x4ba205(0x1f9)](_0x4d408e['id'],_0xbd2227),_0x165761['set'](_0x36ef52[_0x4ba205(0x2c3)][_0x4ba205(0x298)],_0x4d408e['id']),_0x25d884[_0x4ba205(0x1db)][_0x4ba205(0x24d)]({'name':_0x36ef52[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x232),'id':_0x4d408e['id']}),_0x25d884[_0x4ba205(0x1f1)]['knowledgeBases']['updated']++;else{const _0x1fabc3=await this[_0x4ba205(0x1fa)][_0x4ba205(0x1b8)](_0xbd2227);_0x165761[_0x4ba205(0x2d8)](_0x36ef52['yaml'][_0x4ba205(0x298)],_0x1fabc3['id']),_0x25d884[_0x4ba205(0x1db)]['push']({'name':_0x36ef52['yaml'][_0x4ba205(0x298)],'action':_0x4ba205(0x2bd),'id':_0x1fabc3['id']}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1db)][_0x4ba205(0x2bd)]++;}}catch(_0x14c4b1){_0x25d884[_0x4ba205(0x1db)][_0x4ba205(0x24d)]({'name':_0x36ef52[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':'error','error':_0x14c4b1[_0x4ba205(0x1ba)]}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1db)][_0x4ba205(0x25b)]++;}}for(const _0x3f7e96 of _0xd1821a){try{const _0x27a712=_0x4119ab[_0x4ba205(0x1bc)](_0x3f7e96['name']),_0x536dec=yamlTextKnowledgeBaseToApi({'name':_0x3f7e96[_0x4ba205(0x298)],'text':_0x3f7e96['text']},_0x52b474);if(_0x27a712)await this[_0x4ba205(0x1fa)][_0x4ba205(0x1e3)](_0x27a712['id'],_0x536dec),_0x762416[_0x4ba205(0x2d8)](_0x3f7e96['name'],_0x27a712['id']),_0x25d884[_0x4ba205(0x1cb)][_0x4ba205(0x24d)]({'name':_0x3f7e96[_0x4ba205(0x298)],'action':_0x4ba205(0x232),'id':_0x27a712['id']}),_0x25d884['counts'][_0x4ba205(0x1cb)][_0x4ba205(0x232)]++;else{const _0x5f21d8=await this[_0x4ba205(0x1fa)][_0x4ba205(0x255)](_0x536dec);_0x762416[_0x4ba205(0x2d8)](_0x3f7e96[_0x4ba205(0x298)],_0x5f21d8['id']),_0x25d884[_0x4ba205(0x1cb)]['push']({'name':_0x3f7e96[_0x4ba205(0x298)],'action':_0x4ba205(0x2bd),'id':_0x5f21d8['id']}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1cb)][_0x4ba205(0x2bd)]++;}}catch(_0xed1b8b){_0x25d884['textKnowledgeBases'][_0x4ba205(0x24d)]({'name':_0x3f7e96[_0x4ba205(0x298)],'action':'error','error':_0xed1b8b['message']}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1cb)][_0x4ba205(0x25b)]++;}}for(const _0x58f09e of _0x10db67){try{const _0x4cf993=_0x489a60['get'](_0x58f09e['def']['name']),_0x3ef984=yamlExperimentalKnowledgeBaseToApi(_0x58f09e[_0x4ba205(0x209)],_0x52b474);if(_0x4cf993)await this[_0x4ba205(0x1fa)][_0x4ba205(0x1b5)](_0x4cf993['id'],_0x3ef984),_0x3f21e3['set'](_0x58f09e[_0x4ba205(0x209)][_0x4ba205(0x298)],_0x4cf993['id']),_0x25d884[_0x4ba205(0x221)][_0x4ba205(0x24d)]({'name':_0x58f09e['def'][_0x4ba205(0x298)],'action':_0x4ba205(0x232),'id':_0x4cf993['id']}),_0x25d884['counts'][_0x4ba205(0x221)]['updated']++;else{const _0x3e85d0=await this[_0x4ba205(0x1fa)][_0x4ba205(0x202)](_0x3ef984);_0x3f21e3[_0x4ba205(0x2d8)](_0x58f09e[_0x4ba205(0x209)]['name'],_0x3e85d0['id']),_0x25d884[_0x4ba205(0x221)][_0x4ba205(0x24d)]({'name':_0x58f09e[_0x4ba205(0x209)][_0x4ba205(0x298)],'action':_0x4ba205(0x2bd),'id':_0x3e85d0['id']}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x221)][_0x4ba205(0x2bd)]++;}}catch(_0xbfb06){_0x25d884[_0x4ba205(0x221)][_0x4ba205(0x24d)]({'name':_0x58f09e['def']['name'],'action':_0x4ba205(0x1b0),'error':_0xbfb06[_0x4ba205(0x1ba)]}),_0x25d884[_0x4ba205(0x1f1)]['experimentalKnowledgeBases'][_0x4ba205(0x25b)]++;}}for(const _0x374b6e of _0x239807){try{const _0x430d81=_0x21d32e[_0x4ba205(0x1bc)](_0x374b6e['def'][_0x4ba205(0x298)]),_0x32d4df=yamlExperimentalArtifactToApi(_0x374b6e[_0x4ba205(0x209)],_0x52b474);if(_0x430d81)await this['client'][_0x4ba205(0x2ac)](_0x430d81['id'],_0x32d4df),_0x10e36c['set'](_0x374b6e[_0x4ba205(0x209)][_0x4ba205(0x298)],_0x430d81['id']),_0x25d884[_0x4ba205(0x2b3)][_0x4ba205(0x24d)]({'name':_0x374b6e['def']['name'],'action':_0x4ba205(0x232),'id':_0x430d81['id']}),_0x25d884['counts'][_0x4ba205(0x2b3)][_0x4ba205(0x232)]++;else{const _0x4a2a3a=await this[_0x4ba205(0x1fa)][_0x4ba205(0x1dc)](_0x32d4df);_0x10e36c[_0x4ba205(0x2d8)](_0x374b6e['def'][_0x4ba205(0x298)],_0x4a2a3a['id']),_0x25d884[_0x4ba205(0x2b3)][_0x4ba205(0x24d)]({'name':_0x374b6e[_0x4ba205(0x209)][_0x4ba205(0x298)],'action':_0x4ba205(0x2bd),'id':_0x4a2a3a['id']}),_0x25d884[_0x4ba205(0x1f1)]['experimentalArtifacts'][_0x4ba205(0x2bd)]++;}}catch(_0x161464){_0x25d884[_0x4ba205(0x2b3)]['push']({'name':_0x374b6e[_0x4ba205(0x209)]['name'],'action':_0x4ba205(0x1b0),'error':_0x161464[_0x4ba205(0x1ba)]}),_0x25d884['counts'][_0x4ba205(0x2b3)][_0x4ba205(0x25b)]++;}}for(const _0x37fb87 of _0x2cb5e7){_0x1de5ad=[];try{const _0x179780=_0x46d34c['get'](_0x37fb87[_0x4ba205(0x2c3)][_0x4ba205(0x298)]),_0xc6d5b=await agentDefToRequest(_0x37fb87['yaml'],_0x37fb87[_0x4ba205(0x206)],_0x37fb87[_0x4ba205(0x261)],_0x542e80);if(_0x179780)await this['client']['updateAgentResponse'](_0x179780['id'],_0xc6d5b),_0x55eec7['set'](_0x37fb87[_0x4ba205(0x2c3)][_0x4ba205(0x298)],_0x179780['id']),_0x25d884[_0x4ba205(0x1e0)]['push']({'agentName':_0x37fb87['yaml'][_0x4ba205(0x298)],'action':_0x4ba205(0x232),'agentId':_0x179780['id'],'warnings':_0x1de5ad[_0x4ba205(0x2b6)]>0x0?_0x1de5ad:undefined}),_0x25d884['counts']['agents'][_0x4ba205(0x232)]++;else{const _0x1934e5=await this[_0x4ba205(0x1fa)][_0x4ba205(0x1d9)](_0xc6d5b);_0x55eec7[_0x4ba205(0x2d8)](_0x37fb87[_0x4ba205(0x2c3)]['name'],_0x1934e5['id']),_0x25d884[_0x4ba205(0x1e0)][_0x4ba205(0x24d)]({'agentName':_0x37fb87[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x2bd),'agentId':_0x1934e5['id'],'warnings':_0x1de5ad[_0x4ba205(0x2b6)]>0x0?_0x1de5ad:undefined}),_0x25d884['counts']['agents'][_0x4ba205(0x2bd)]++;}}catch(_0xe531c5){_0x25d884[_0x4ba205(0x1e0)]['push']({'agentName':_0x37fb87[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x1b0),'error':_0xe531c5['message'],'warnings':_0x1de5ad[_0x4ba205(0x2b6)]>0x0?_0x1de5ad:undefined}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1e0)][_0x4ba205(0x25b)]++;}}for(const _0x196126 of _0x12fd32){try{const _0x42d7d5=_0xce6e2a[_0x4ba205(0x1bc)](_0x196126[_0x4ba205(0x2c3)][_0x4ba205(0x298)]),_0xf23e4f=await yamlPromptToApi(_0x196126['yaml'],_0x52b474,_0x542e80);if(!_0xf23e4f){_0x25d884[_0x4ba205(0x1e6)][_0x4ba205(0x24d)]({'name':_0x196126[_0x4ba205(0x2c3)]['name'],'action':'error','error':'Agent\x20reference\x20not\x20found'}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1e6)]['errors']++;continue;}if(_0x42d7d5)await this[_0x4ba205(0x1fa)][_0x4ba205(0x235)](_0x42d7d5['id'],_0xf23e4f),_0x41517d['set'](_0x196126[_0x4ba205(0x2c3)][_0x4ba205(0x298)],_0x42d7d5['id']),_0x25d884[_0x4ba205(0x1e6)][_0x4ba205(0x24d)]({'name':_0x196126[_0x4ba205(0x2c3)]['name'],'action':'updated','id':_0x42d7d5['id']}),_0x25d884[_0x4ba205(0x1f1)]['prompts'][_0x4ba205(0x232)]++;else{const _0x23c3fc=await this[_0x4ba205(0x1fa)][_0x4ba205(0x2ab)](_0xf23e4f);_0x41517d[_0x4ba205(0x2d8)](_0x196126['yaml'][_0x4ba205(0x298)],_0x23c3fc['id']),_0x25d884[_0x4ba205(0x1e6)][_0x4ba205(0x24d)]({'name':_0x196126[_0x4ba205(0x2c3)]['name'],'action':_0x4ba205(0x2bd),'id':_0x23c3fc['id']}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1e6)][_0x4ba205(0x2bd)]++;}}catch(_0x73d797){_0x25d884[_0x4ba205(0x1e6)]['push']({'name':_0x196126['yaml']['name'],'action':_0x4ba205(0x1b0),'error':_0x73d797[_0x4ba205(0x1ba)]}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1e6)]['errors']++;}}for(const _0x1b80df of _0x1459ed){try{const _0x20ea14=_0x2391d5[_0x4ba205(0x1bc)](_0x1b80df[_0x4ba205(0x2c3)][_0x4ba205(0x1b7)]),_0x47308a=await yamlIntegrationToApi(_0x1b80df['yaml'],_0x52b474,_0x542e80);if(_0x20ea14){await this[_0x4ba205(0x1fa)][_0x4ba205(0x218)](_0x20ea14['id']);const _0x4960dd=await this[_0x4ba205(0x1fa)][_0x4ba205(0x2b2)](_0x47308a);_0x25d884[_0x4ba205(0x278)][_0x4ba205(0x24d)]({'name':_0x1b80df[_0x4ba205(0x2c3)][_0x4ba205(0x1b7)],'action':_0x4ba205(0x232),'id':_0x4960dd['id']}),_0x25d884['counts'][_0x4ba205(0x278)][_0x4ba205(0x232)]++;}else{const _0x5d046d=await this[_0x4ba205(0x1fa)]['createIntegration'](_0x47308a);_0x25d884[_0x4ba205(0x278)][_0x4ba205(0x24d)]({'name':_0x1b80df['yaml'][_0x4ba205(0x1b7)],'action':_0x4ba205(0x2bd),'id':_0x5d046d['id']}),_0x25d884[_0x4ba205(0x1f1)]['integrations']['created']++;}}catch(_0x144943){_0x25d884[_0x4ba205(0x278)][_0x4ba205(0x24d)]({'name':_0x1b80df[_0x4ba205(0x2c3)][_0x4ba205(0x1b7)],'action':'error','error':_0x144943[_0x4ba205(0x1ba)]}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x278)][_0x4ba205(0x25b)]++;}}for(const _0x489819 of _0x21945f){try{const _0x2722d9=_0x44ae33['get'](_0x489819['yaml'][_0x4ba205(0x298)]),_0xba009b=await yamlFormInterfaceToApi(_0x489819['yaml'],_0x52b474,_0x542e80);if(!_0xba009b){_0x25d884['formInterfaces'][_0x4ba205(0x24d)]({'name':_0x489819[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x1b0),'error':_0x4ba205(0x1d2)}),_0x25d884[_0x4ba205(0x1f1)]['formInterfaces'][_0x4ba205(0x25b)]++;continue;}if(_0x2722d9){const _0xdf8fae=await this[_0x4ba205(0x1fa)]['updateFormInterface'](_0x2722d9['id'],_0xba009b);_0x25d884[_0x4ba205(0x1ac)][_0x4ba205(0x24d)]({'name':_0x489819[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x232),'id':_0xdf8fae['id']}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1ac)][_0x4ba205(0x232)]++;}else{const _0x1655b7=await this[_0x4ba205(0x1fa)][_0x4ba205(0x24c)](_0xba009b);_0x25d884['formInterfaces']['push']({'name':_0x489819[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x2bd),'id':_0x1655b7['id']}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1ac)][_0x4ba205(0x2bd)]++;}}catch(_0x3cfebf){_0x25d884['formInterfaces']['push']({'name':_0x489819['yaml'][_0x4ba205(0x298)],'action':_0x4ba205(0x1b0),'error':_0x3cfebf[_0x4ba205(0x1ba)]}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x1ac)][_0x4ba205(0x25b)]++;}}for(const _0x3437b8 of _0x44bb57){try{const _0x235a76=_0xea0216[_0x4ba205(0x1bc)](_0x3437b8[_0x4ba205(0x2c3)][_0x4ba205(0x298)]),_0xd89694=await yamlChatInterfaceToApi(_0x3437b8[_0x4ba205(0x2c3)],_0x52b474,_0x542e80);if(_0x235a76){const _0x4a4f97=await this[_0x4ba205(0x1fa)]['updateChatInterface'](_0x235a76['id'],_0xd89694);_0x25d884[_0x4ba205(0x275)][_0x4ba205(0x24d)]({'name':_0x3437b8[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':_0x4ba205(0x232),'id':_0x4a4f97['id']}),_0x25d884['counts'][_0x4ba205(0x275)][_0x4ba205(0x232)]++;}else{const _0x336e36=await this[_0x4ba205(0x1fa)][_0x4ba205(0x23b)](_0xd89694);_0x25d884[_0x4ba205(0x275)][_0x4ba205(0x24d)]({'name':_0x3437b8[_0x4ba205(0x2c3)]['name'],'action':_0x4ba205(0x2bd),'id':_0x336e36['id']}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x275)][_0x4ba205(0x2bd)]++;}}catch(_0x48c6d9){_0x25d884[_0x4ba205(0x275)]['push']({'name':_0x3437b8[_0x4ba205(0x2c3)][_0x4ba205(0x298)],'action':'error','error':_0x48c6d9[_0x4ba205(0x1ba)]}),_0x25d884[_0x4ba205(0x1f1)][_0x4ba205(0x275)][_0x4ba205(0x25b)]++;}}return _0x25d884;}async['pullAgent'](_0x24009d,_0x16b888,_0x7714d2,_0x2b6e53){const _0x54036b=a133_0xbc8366,{projectId:_0x34e432,project:_0x1c2ab5}=await this['resolveProjectName'](_0x24009d),_0x2ac546=_0x1c2ab5[_0x54036b(0x279)][_0x54036b(0x298)],_0x60be6a=await this[_0x54036b(0x1fa)][_0x54036b(0x2cb)](_0x34e432),_0x3ed034=_0x60be6a['find'](_0x57f183=>_0x57f183['attributes'][_0x54036b(0x298)]===_0x16b888);if(!_0x3ed034)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x54036b(0x24b)+_0x16b888,undefined,{'helpText':'Available\x20agents:\x20'+_0x60be6a[_0x54036b(0x25d)](_0x424b61=>_0x424b61[_0x54036b(0x279)]['name'])[_0x54036b(0x21b)](',\x20')});let _0x1c7e60;if(_0x7714d2)_0x1c7e60=_0x7714d2;else{const _0x219d4f=a133_0x43ada2[_0x54036b(0x21b)](process[_0x54036b(0x2a4)](),_0x54036b(0x1e0)),_0x196e44=getSanitizedPathWithMigration(_0x219d4f,_0x2ac546);_0x196e44[_0x54036b(0x26b)]&&this[_0x54036b(0x28c)]['info'](_0x54036b(0x291)+a133_0x43ada2[_0x54036b(0x2a8)](_0x196e44['oldPath'])+'\x20→\x20'+a133_0x43ada2['basename'](_0x196e44[_0x54036b(0x22c)])),_0x1c7e60=_0x196e44[_0x54036b(0x22c)];}const _0xe66235=getSanitizedPathWithMigration(_0x1c7e60,_0x16b888);_0xe66235[_0x54036b(0x26b)]&&this[_0x54036b(0x28c)][_0x54036b(0x21c)](_0x54036b(0x289)+a133_0x43ada2[_0x54036b(0x2a8)](_0xe66235[_0x54036b(0x29b)])+_0x54036b(0x1c8)+a133_0x43ada2[_0x54036b(0x2a8)](_0xe66235[_0x54036b(0x22c)]));const _0x143a3f=_0xe66235['path'],_0x2f82d9=new Map(),_0x400185=new Map(),_0x281b7d=await this[_0x54036b(0x1fa)][_0x54036b(0x29c)](_0x34e432),_0x5ae5ed=await this[_0x54036b(0x1fa)]['listTextKnowledgeBases'](_0x34e432),_0x249c2f=await safeListOrEmpty(()=>this[_0x54036b(0x1fa)][_0x54036b(0x248)](_0x34e432)),_0x4ae63d=new Map(),_0x266cc2=new Map();for(const _0x3f0858 of _0x281b7d){_0x2f82d9[_0x54036b(0x2d8)](_0x3f0858['id'],_0x3f0858['attributes'][_0x54036b(0x298)]);}for(const _0x535ace of _0x5ae5ed){_0x4ae63d['set'](_0x535ace['id'],_0x535ace['attributes'][_0x54036b(0x298)]);}for(const _0x48fc99 of _0x249c2f){_0x266cc2[_0x54036b(0x2d8)](_0x48fc99['id'],_0x48fc99[_0x54036b(0x279)][_0x54036b(0x298)]);}for(const _0x163177 of _0x60be6a){_0x400185[_0x54036b(0x2d8)](_0x163177['id'],_0x163177[_0x54036b(0x279)][_0x54036b(0x298)]);}const _0x3bd76e={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x2f82d9,'TextKnowledgeBase':_0x4ae63d,'Agent':_0x400185,'ExperimentalKnowledgeBase':_0x266cc2}),'resolvePromptName':async()=>undefined,'onWarning':_0x10870e=>this[_0x54036b(0x28c)][_0x54036b(0x2d1)](_0x10870e)},_0x27a27f=a133_0x43ada2[_0x54036b(0x21b)](_0x143a3f,_0x54036b(0x1ee)),_0x584b4e=a133_0x43ada2['join'](_0x143a3f,_0x54036b(0x20e)),_0x1f2355=a133_0x43ada2['join'](_0x143a3f,_0x54036b(0x284)),_0x5e3396=!a133_0x483289['existsSync'](_0x584b4e);if(_0x2b6e53?.['dryRun'])return{'agentName':_0x16b888,'outputPath':_0x143a3f,'isNew':_0x5e3396,'hasChanges':!![]};a133_0x483289[_0x54036b(0x2cf)](_0x1c7e60,{'recursive':!![]}),a133_0x483289[_0x54036b(0x2cf)](_0x143a3f,{'recursive':!![]});const _0x37bee7=a133_0x43ada2[_0x54036b(0x21b)](_0x1c7e60,_0x54036b(0x2b1));!a133_0x483289['existsSync'](_0x37bee7)&&a133_0x483289['writeFileSync'](_0x37bee7,createAgentConfigContent(_0x24009d));const {yaml:_0xb87e0c,systemPrompt:_0x1194c1,starterMessage:_0x40bbc4}=await agentResponseToDef(_0x3ed034,_0x3bd76e);let _0x35a773=_0x5e3396;if(!_0x5e3396){const _0x2fa96d=a133_0x483289[_0x54036b(0x224)](_0x27a27f)?a133_0x483289['readFileSync'](_0x27a27f,_0x54036b(0x1e2)):'',_0x419b1a=a133_0x483289[_0x54036b(0x2a7)](_0x584b4e,_0x54036b(0x1e2));_0x35a773=_0x2fa96d!==_0x1194c1||_0x419b1a!==toAgentYamlString(_0xb87e0c);}a133_0x483289[_0x54036b(0x26a)](_0x27a27f,_0x1194c1),a133_0x483289[_0x54036b(0x26a)](_0x584b4e,toAgentYamlString(_0xb87e0c));if(_0x40bbc4&&_0x40bbc4[_0x54036b(0x1af)]('\x0a'))a133_0x483289[_0x54036b(0x26a)](_0x1f2355,_0x40bbc4);else a133_0x483289[_0x54036b(0x224)](_0x1f2355)&&a133_0x483289[_0x54036b(0x26c)](_0x1f2355);return{'agentName':_0x16b888,'outputPath':_0x143a3f,'isNew':_0x5e3396,'hasChanges':_0x35a773};}async[a133_0xbc8366(0x1be)](_0x25efd4,_0x48b851){const _0xe60fb8=a133_0xbc8366;let _0x4fb402;isAgentYamlPath(_0x25efd4)?_0x4fb402=getAgentDirFromYamlPath(_0x25efd4):_0x4fb402=_0x25efd4;const {config:_0x370ccc}=findAgentConfig(_0x4fb402),_0x96caec=await this[_0xe60fb8(0x217)](_0x370ccc[_0xe60fb8(0x290)]),_0x416939=a133_0x43ada2[_0xe60fb8(0x21b)](_0x4fb402,_0xe60fb8(0x20e)),_0x2692e7=a133_0x43ada2[_0xe60fb8(0x21b)](_0x4fb402,_0xe60fb8(0x1ee)),_0x5c6daf=a133_0x43ada2[_0xe60fb8(0x21b)](_0x4fb402,'starter_message.md');if(!a133_0x483289['existsSync'](_0x416939))throw new SDKError(ErrorCode[_0xe60fb8(0x2b0)],_0xe60fb8(0x220)+_0x4fb402,undefined,{'helpText':_0xe60fb8(0x1c2)});const _0x17347f=parseAgentYaml(a133_0x483289[_0xe60fb8(0x2a7)](_0x416939,_0xe60fb8(0x1e2)),_0x416939),_0x58f499=a133_0x483289[_0xe60fb8(0x224)](_0x2692e7)?a133_0x483289[_0xe60fb8(0x2a7)](_0x2692e7,_0xe60fb8(0x1e2)):'',_0x5c767d=a133_0x483289[_0xe60fb8(0x224)](_0x5c6daf)?a133_0x483289[_0xe60fb8(0x2a7)](_0x5c6daf,'utf-8'):_0x17347f[_0xe60fb8(0x1ce)];if(_0x48b851?.[_0xe60fb8(0x294)])return{'agentName':_0x17347f['name'],'action':_0xe60fb8(0x2bd),'projectId':_0x96caec};const _0x104c14=await this[_0xe60fb8(0x1fa)][_0xe60fb8(0x2cb)](_0x96caec),_0x5a93d0=await fetchAllToolTargetMaps((_0x207ce8,_0x196e87)=>this[_0xe60fb8(0x1fa)][_0xe60fb8(0x1ea)](_0x207ce8,_0x196e87),_0x96caec),_0x4f67b3=new Map();for(const _0x428367 of _0x104c14){_0x4f67b3[_0xe60fb8(0x2d8)](_0x428367[_0xe60fb8(0x279)][_0xe60fb8(0x298)],_0x428367['id']);}const _0x3dcd1d=[],_0x217410={'projectId':_0x96caec,'resolveToolTargetId':buildIdResolver({..._0x5a93d0['nameToId'],'Agent':_0x4f67b3}),'resolvePromptId':async()=>undefined,'onWarning':_0x1f2d8f=>{const _0x3835a5=_0xe60fb8;this['logger'][_0x3835a5(0x2d1)](_0x1f2d8f),_0x3dcd1d[_0x3835a5(0x24d)](_0x1f2d8f);}};try{const _0x4cbee1=_0x104c14['find'](_0x21864d=>_0x21864d[_0xe60fb8(0x279)][_0xe60fb8(0x298)]===_0x17347f[_0xe60fb8(0x298)]),_0x2dd9e6=await agentDefToRequest(_0x17347f,_0x58f499,_0x5c767d,_0x217410);if(_0x4cbee1)return await this[_0xe60fb8(0x1fa)]['updateAgentResponse'](_0x4cbee1['id'],_0x2dd9e6),{'agentName':_0x17347f['name'],'action':_0xe60fb8(0x232),'projectId':_0x96caec,'agentId':_0x4cbee1['id'],'warnings':_0x3dcd1d[_0xe60fb8(0x2b6)]>0x0?_0x3dcd1d:undefined};else{const _0xea3941=await this[_0xe60fb8(0x1fa)][_0xe60fb8(0x1d9)](_0x2dd9e6);return{'agentName':_0x17347f[_0xe60fb8(0x298)],'action':_0xe60fb8(0x2bd),'projectId':_0x96caec,'agentId':_0xea3941['id'],'warnings':_0x3dcd1d[_0xe60fb8(0x2b6)]>0x0?_0x3dcd1d:undefined};}}catch(_0x53d5e0){return{'agentName':_0x17347f[_0xe60fb8(0x298)],'action':'error','projectId':_0x96caec,'error':_0x53d5e0[_0xe60fb8(0x1ba)],'warnings':_0x3dcd1d[_0xe60fb8(0x2b6)]>0x0?_0x3dcd1d:undefined};}}async[a133_0xbc8366(0x2d6)](_0x544e0a,_0xfb9df2,_0x569c77){const _0x57f1e1=a133_0xbc8366,_0x3cfcdc=a133_0x483289[_0x57f1e1(0x224)](_0x544e0a)&&a133_0x483289['existsSync'](a133_0x43ada2['join'](_0x544e0a,'tdx.json'));let _0x8061c1;const _0x10da87=[],_0x1828ee=[],_0x3085b2=[],_0x384d03=[],_0x15a6c7=[],_0x192a84=[],_0x199364=[],_0x3c635c=[],_0x5f1794=[];if(_0x3cfcdc){const _0x2ea762=loadAgentConfig(a133_0x43ada2[_0x57f1e1(0x21b)](_0x544e0a,_0x57f1e1(0x2b1)));_0x8061c1=_0x2ea762['llm_project'];const _0x1ecb04=a133_0x483289['readdirSync'](_0x544e0a,{'withFileTypes':!![]});for(const _0x498353 of _0x1ecb04){if(!_0x498353[_0x57f1e1(0x227)]())continue;if(['knowledge_bases',_0x57f1e1(0x2c1),_0x57f1e1(0x1cf),_0x57f1e1(0x1e6),_0x57f1e1(0x278),_0x57f1e1(0x1d1),_0x57f1e1(0x1f0)][_0x57f1e1(0x1af)](_0x498353['name']))continue;const _0x3754c6=a133_0x43ada2[_0x57f1e1(0x21b)](_0x544e0a,_0x498353['name']);if(isAgentDir(_0x3754c6)){const _0x1a2119=a133_0x43ada2[_0x57f1e1(0x21b)](_0x3754c6,'agent.yml'),_0x186d04=a133_0x43ada2[_0x57f1e1(0x21b)](_0x3754c6,_0x57f1e1(0x1ee)),_0x15bed2=a133_0x43ada2[_0x57f1e1(0x21b)](_0x3754c6,_0x57f1e1(0x284)),_0xb2a428=parseAgentYaml(a133_0x483289[_0x57f1e1(0x2a7)](_0x1a2119,_0x57f1e1(0x1e2)),_0x1a2119),_0x634f2d=a133_0x483289[_0x57f1e1(0x224)](_0x186d04)?a133_0x483289[_0x57f1e1(0x2a7)](_0x186d04,'utf-8'):'',_0x42cc73=a133_0x483289[_0x57f1e1(0x224)](_0x15bed2)?a133_0x483289['readFileSync'](_0x15bed2,_0x57f1e1(0x1e2)):_0xb2a428[_0x57f1e1(0x1ce)];_0x10da87[_0x57f1e1(0x24d)]({'name':_0xb2a428[_0x57f1e1(0x298)],'dir':_0x3754c6,'yaml':_0xb2a428,'systemPrompt':_0x634f2d,'starterMessage':_0x42cc73});}}const _0x424fff=getKnowledgeBasesDir(_0x544e0a);if(a133_0x483289['existsSync'](_0x424fff)){const _0xd77d1d=a133_0x483289[_0x57f1e1(0x23a)](_0x424fff);for(const _0x361b57 of _0xd77d1d){const _0x2ede76=a133_0x43ada2[_0x57f1e1(0x21b)](_0x424fff,_0x361b57);if(_0x361b57['endsWith'](_0x57f1e1(0x1fe))){const _0x9b109e=parseKnowledgeBaseYaml(a133_0x483289[_0x57f1e1(0x2a7)](_0x2ede76,_0x57f1e1(0x1e2)),_0x2ede76);_0x1828ee[_0x57f1e1(0x24d)]({'name':_0x9b109e[_0x57f1e1(0x298)],'path':_0x2ede76,'yaml':_0x9b109e});}else{if(_0x361b57[_0x57f1e1(0x2bb)](_0x57f1e1(0x263))){const _0x5ed566=a133_0x483289[_0x57f1e1(0x2a7)](_0x2ede76,'utf-8'),{name:_0x469b70,text:_0x4c99ca}=parseTextKnowledgeBaseMd(_0x5ed566,_0x361b57);_0x3085b2['push']({'name':_0x469b70,'path':_0x2ede76,'text':_0x4c99ca});}}}}const _0x4741bb=getPromptsDir(_0x544e0a);if(a133_0x483289['existsSync'](_0x4741bb)){const _0x21dadf=a133_0x483289[_0x57f1e1(0x23a)](_0x4741bb)[_0x57f1e1(0x23f)](_0x32c4ca=>_0x32c4ca[_0x57f1e1(0x2bb)](_0x57f1e1(0x1fe)));for(const _0x5c4195 of _0x21dadf){const _0x14f9ca=a133_0x43ada2['join'](_0x4741bb,_0x5c4195),_0x7746ca=parsePromptYaml(a133_0x483289['readFileSync'](_0x14f9ca,_0x57f1e1(0x1e2)),_0x14f9ca);_0x384d03[_0x57f1e1(0x24d)]({'name':_0x7746ca['name'],'path':_0x14f9ca,'yaml':_0x7746ca});}}const _0x18b147=getIntegrationsDir(_0x544e0a);if(a133_0x483289[_0x57f1e1(0x224)](_0x18b147)){const _0x2c73dd=a133_0x483289[_0x57f1e1(0x23a)](_0x18b147)[_0x57f1e1(0x23f)](_0x1b338e=>_0x1b338e[_0x57f1e1(0x2bb)]('.yml'));for(const _0x418998 of _0x2c73dd){const _0x151044=a133_0x43ada2[_0x57f1e1(0x21b)](_0x18b147,_0x418998),_0x3e9df1=parseIntegrationYaml(a133_0x483289[_0x57f1e1(0x2a7)](_0x151044,_0x57f1e1(0x1e2)),_0x151044);SAFE_INTEGRATION_TYPES[_0x57f1e1(0x1af)](_0x3e9df1[_0x57f1e1(0x1b7)][_0x57f1e1(0x293)]())?_0x15a6c7[_0x57f1e1(0x24d)]({'name':_0x3e9df1[_0x57f1e1(0x298)],'path':_0x151044,'yaml':_0x3e9df1}):this[_0x57f1e1(0x28c)][_0x57f1e1(0x2d1)](_0x57f1e1(0x228)+_0x3e9df1['name']+_0x57f1e1(0x249)+_0x3e9df1[_0x57f1e1(0x1b7)]+_0x57f1e1(0x292)+(_0x57f1e1(0x2be)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x57f1e1(0x1e8)));}}const _0x4f96c0=getExperimentalKnowledgeBasesDir(_0x544e0a);if(a133_0x483289['existsSync'](_0x4f96c0)){const _0x5bab98=a133_0x483289[_0x57f1e1(0x23a)](_0x4f96c0,{'withFileTypes':!![]});for(const _0x51fa16 of _0x5bab98){if(!_0x51fa16[_0x57f1e1(0x227)]())continue;const _0x4f4543=a133_0x43ada2[_0x57f1e1(0x21b)](_0x4f96c0,_0x51fa16[_0x57f1e1(0x298)]),_0xd7fd3b=a133_0x43ada2[_0x57f1e1(0x21b)](_0x4f4543,_0x51fa16[_0x57f1e1(0x298)]+_0x57f1e1(0x1fe));if(a133_0x483289['existsSync'](_0xd7fd3b)){const _0x10e93a=parseExperimentalKnowledgeBaseYaml(a133_0x483289[_0x57f1e1(0x2a7)](_0xd7fd3b,_0x57f1e1(0x1e2)),_0xd7fd3b),_0x638cab=a133_0x43ada2['join'](_0x4f4543,_0x57f1e1(0x1f6)),_0x2586e6=[];if(a133_0x483289[_0x57f1e1(0x224)](_0x638cab)){const _0x304469=a133_0x483289[_0x57f1e1(0x23a)](_0x638cab,{'withFileTypes':!![]});for(const _0x446753 of _0x304469){if(!_0x446753['isDirectory']())continue;const _0x31d361=a133_0x43ada2[_0x57f1e1(0x21b)](_0x638cab,_0x446753[_0x57f1e1(0x298)]),_0x46368c=a133_0x43ada2[_0x57f1e1(0x21b)](_0x31d361,_0x57f1e1(0x216)),_0x4c2ab9=a133_0x43ada2[_0x57f1e1(0x21b)](_0x31d361,'json_schema.json');if(a133_0x483289[_0x57f1e1(0x224)](_0x46368c)&&a133_0x483289[_0x57f1e1(0x224)](_0x4c2ab9)){const _0x7a765=a133_0x483289['readFileSync'](_0x46368c,_0x57f1e1(0x1e2)),_0x4a5807=a133_0x483289[_0x57f1e1(0x2a7)](_0x4c2ab9,_0x57f1e1(0x1e2));_0x2586e6[_0x57f1e1(0x24d)]({'name':_0x446753[_0x57f1e1(0x298)],'code':_0x7a765,'json_schema':_0x4a5807});}}}const _0x499ee6={..._0x10e93a,'functions':_0x2586e6};_0x192a84[_0x57f1e1(0x24d)]({'name':_0x10e93a[_0x57f1e1(0x298)],'path':_0x4f4543,'def':_0x499ee6});}}}const _0xc769c7=getExperimentalArtifactsDir(_0x544e0a);if(a133_0x483289[_0x57f1e1(0x224)](_0xc769c7)){const _0x5a13d8=a133_0x483289[_0x57f1e1(0x23a)](_0xc769c7,{'withFileTypes':!![]});for(const _0x5e307f of _0x5a13d8){if(!_0x5e307f['isDirectory']())continue;const _0x53c49a=a133_0x43ada2['join'](_0xc769c7,_0x5e307f[_0x57f1e1(0x298)]),_0x3af0bc=a133_0x43ada2['join'](_0x53c49a,_0x5e307f[_0x57f1e1(0x298)]+_0x57f1e1(0x1fe));if(a133_0x483289[_0x57f1e1(0x224)](_0x3af0bc)){const _0x3728ed=parseExperimentalArtifactYaml(a133_0x483289[_0x57f1e1(0x2a7)](_0x3af0bc,'utf-8'),_0x3af0bc),_0x3cfc41=a133_0x43ada2[_0x57f1e1(0x21b)](_0x53c49a,_0x57f1e1(0x216)),_0x40f803=a133_0x483289[_0x57f1e1(0x224)](_0x3cfc41)?a133_0x483289[_0x57f1e1(0x2a7)](_0x3cfc41,_0x57f1e1(0x1e2)):'',_0x288d72=a133_0x43ada2[_0x57f1e1(0x21b)](_0x53c49a,_0x57f1e1(0x288)),_0x26cfdf=[];if(a133_0x483289['existsSync'](_0x288d72)){const _0x3303c6=a133_0x483289[_0x57f1e1(0x23a)](_0x288d72);for(const _0x3dfe9d of _0x3303c6){const _0x36d6b7=a133_0x43ada2[_0x57f1e1(0x21b)](_0x288d72,_0x3dfe9d);if(a133_0x483289[_0x57f1e1(0x1c9)](_0x36d6b7)['isFile']()){const _0x2e9137=a133_0x483289[_0x57f1e1(0x2a7)](_0x36d6b7,_0x57f1e1(0x1e2));_0x26cfdf[_0x57f1e1(0x24d)]({'file_name':_0x3dfe9d,'text_content':_0x2e9137});}}}const _0xfddc4e={..._0x3728ed,'code':_0x40f803,'files':_0x26cfdf};_0x199364['push']({'name':_0x3728ed['name'],'path':_0x53c49a,'def':_0xfddc4e});}}}const _0x53ddd3=getFormInterfacesDir(_0x544e0a);if(a133_0x483289[_0x57f1e1(0x224)](_0x53ddd3)){const _0x2e0dd0=a133_0x483289['readdirSync'](_0x53ddd3)[_0x57f1e1(0x23f)](_0x4184b8=>_0x4184b8[_0x57f1e1(0x2bb)](_0x57f1e1(0x1fe)));for(const _0x112c1a of _0x2e0dd0){const _0x56ec23=a133_0x43ada2[_0x57f1e1(0x21b)](_0x53ddd3,_0x112c1a),_0x21e76f=parseFormInterfaceYaml(a133_0x483289[_0x57f1e1(0x2a7)](_0x56ec23,_0x57f1e1(0x1e2)),_0x56ec23);_0x3c635c['push']({'name':_0x21e76f[_0x57f1e1(0x298)],'path':_0x56ec23,'yaml':_0x21e76f});}}const _0x1cca73=getChatInterfacesDir(_0x544e0a);if(a133_0x483289[_0x57f1e1(0x224)](_0x1cca73)){const _0x19698b=a133_0x483289[_0x57f1e1(0x23a)](_0x1cca73)[_0x57f1e1(0x23f)](_0x1937f5=>_0x1937f5[_0x57f1e1(0x2bb)](_0x57f1e1(0x1fe)));for(const _0x4c53d2 of _0x19698b){const _0x3467d3=a133_0x43ada2['join'](_0x1cca73,_0x4c53d2),_0x16380a=parseChatInterfaceYaml(a133_0x483289[_0x57f1e1(0x2a7)](_0x3467d3,_0x57f1e1(0x1e2)),_0x3467d3);_0x5f1794[_0x57f1e1(0x24d)]({'name':_0x16380a['name'],'path':_0x3467d3,'yaml':_0x16380a});}}}else{const _0x34c7ae=await this[_0x57f1e1(0x217)](_0x544e0a),_0x232665=await this['client'][_0x57f1e1(0x1df)](_0x34c7ae);_0x8061c1=_0x232665['attributes'][_0x57f1e1(0x298)];const _0x2b730a=await this[_0x57f1e1(0x1fa)][_0x57f1e1(0x2cb)](_0x34c7ae),_0x455e4f=await this[_0x57f1e1(0x1fa)][_0x57f1e1(0x29c)](_0x34c7ae),_0x46fda6=await this[_0x57f1e1(0x1fa)][_0x57f1e1(0x2b5)](_0x34c7ae),_0x39ef06=await this['client']['listPrompts'](_0x34c7ae),_0x200ca7=await this['client']['listIntegrations'](_0x34c7ae),_0xbfca10=await safeListOrEmpty(()=>this[_0x57f1e1(0x1fa)]['listExperimentalKnowledgeBases'](_0x34c7ae)),_0x2496ab=await safeListOrEmpty(()=>this[_0x57f1e1(0x1fa)][_0x57f1e1(0x243)](_0x34c7ae)),_0x592d8c=new Map(),_0x8cf75e=new Map(),_0x10c99a=new Map(),_0x20b672=new Map(),_0x3dcb27=new Map(),_0xc0a6ee=new Map();for(const _0x7cec15 of _0x455e4f){_0x592d8c[_0x57f1e1(0x2d8)](_0x7cec15['id'],_0x7cec15[_0x57f1e1(0x279)][_0x57f1e1(0x298)]);}for(const _0x3f7dbd of _0x46fda6){_0x8cf75e[_0x57f1e1(0x2d8)](_0x3f7dbd['id'],_0x3f7dbd[_0x57f1e1(0x279)][_0x57f1e1(0x298)]);}for(const _0x385e8b of _0x2b730a){_0x10c99a['set'](_0x385e8b['id'],_0x385e8b['attributes']['name']);}for(const _0x2ed49f of _0x39ef06){_0x20b672[_0x57f1e1(0x2d8)](_0x2ed49f['id'],_0x2ed49f['attributes'][_0x57f1e1(0x298)]);}for(const _0x9844d2 of _0xbfca10){_0x3dcb27[_0x57f1e1(0x2d8)](_0x9844d2['id'],_0x9844d2[_0x57f1e1(0x279)]['name']);}for(const _0x4515a9 of _0x2496ab){_0xc0a6ee[_0x57f1e1(0x2d8)](_0x4515a9['id'],_0x4515a9[_0x57f1e1(0x279)][_0x57f1e1(0x298)]);}const _0x1406a0={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x592d8c,'TextKnowledgeBase':_0x8cf75e,'Agent':_0x10c99a,'ExperimentalKnowledgeBase':_0x3dcb27}),'resolvePromptName':async _0x24fa7b=>_0x20b672[_0x57f1e1(0x1bc)](_0x24fa7b),'onWarning':_0x39992b=>this[_0x57f1e1(0x28c)][_0x57f1e1(0x2d1)](_0x39992b)};for(const _0x1f8c25 of _0x2b730a){const _0x243f8b=await agentResponseToDef(_0x1f8c25,_0x1406a0),{yaml:_0x5b5926,systemPrompt:_0xc537cb,starterMessage:_0x1f9046}=_0x243f8b;_0x10da87[_0x57f1e1(0x24d)]({'name':_0x5b5926[_0x57f1e1(0x298)],'dir':'','yaml':_0x5b5926,'systemPrompt':_0xc537cb,'starterMessage':_0x1f9046});}for(const _0x403a5c of _0x455e4f){const _0x561f9d=apiKnowledgeBaseToYaml(_0x403a5c);_0x1828ee[_0x57f1e1(0x24d)]({'name':_0x561f9d[_0x57f1e1(0x298)],'path':'','yaml':_0x561f9d});}for(const _0x4c007f of _0x46fda6){_0x3085b2['push']({'name':_0x4c007f[_0x57f1e1(0x279)][_0x57f1e1(0x298)],'path':'','text':_0x4c007f[_0x57f1e1(0x279)][_0x57f1e1(0x200)]});}for(const _0x111b56 of _0x39ef06){const _0x490589=await apiPromptToYaml(_0x111b56,_0x1406a0);_0x490589&&_0x384d03['push']({'name':_0x490589[_0x57f1e1(0x298)],'path':'','yaml':_0x490589});}for(const _0x72b28f of _0x200ca7){if(!_0x72b28f[_0x57f1e1(0x279)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x57f1e1(0x1af)](_0x72b28f[_0x57f1e1(0x279)]['serviceType'][_0x57f1e1(0x293)]())){const _0x4abeff=await apiIntegrationToYaml(_0x72b28f,_0x1406a0);_0x15a6c7[_0x57f1e1(0x24d)]({'name':_0x72b28f[_0x57f1e1(0x279)][_0x57f1e1(0x1cc)]['toLowerCase'](),'path':'','yaml':_0x4abeff});}}for(const _0x322155 of _0xbfca10){const _0x4abaef=apiExperimentalKnowledgeBaseToYaml(_0x322155);_0x192a84[_0x57f1e1(0x24d)]({'name':_0x4abaef[_0x57f1e1(0x298)],'path':'','def':_0x4abaef});}for(const _0x2b6a04 of _0x2496ab){const _0x58f5a5=apiExperimentalArtifactToYaml(_0x2b6a04);_0x199364['push']({'name':_0x58f5a5[_0x57f1e1(0x298)],'path':'','def':_0x58f5a5});}const _0x5a6057=await safeListOrEmpty(()=>this[_0x57f1e1(0x1fa)][_0x57f1e1(0x247)](_0x34c7ae));for(const _0x117fd3 of _0x5a6057){const _0x1ae6d9=await apiFormInterfaceToYaml(_0x117fd3,_0x1406a0);_0x3c635c[_0x57f1e1(0x24d)]({'name':_0x1ae6d9['name'],'path':'','yaml':_0x1ae6d9});}const _0x477e6d=await safeListOrEmpty(()=>this[_0x57f1e1(0x1fa)][_0x57f1e1(0x277)](_0x34c7ae));for(const _0x3bcb9c of _0x477e6d){if(_0x3bcb9c[_0x57f1e1(0x279)][_0x57f1e1(0x26e)])continue;const _0x37116f=await apiChatInterfaceToYaml(_0x3bcb9c,_0x1406a0);_0x5f1794['push']({'name':_0x37116f[_0x57f1e1(0x298)],'path':'','yaml':_0x37116f});}}const _0x30912c={'sourceProjectName':_0x8061c1,'newProjectName':_0xfb9df2,'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}}},_0x529c34=await this[_0x57f1e1(0x1fa)][_0x57f1e1(0x2a3)](),_0x34a785=_0x529c34['find'](_0x305a8d=>_0x305a8d[_0x57f1e1(0x279)]['name']===_0xfb9df2);if(_0x34a785)throw new SDKError(ErrorCode[_0x57f1e1(0x2a2)],_0x57f1e1(0x21d)+_0xfb9df2+_0x57f1e1(0x281),undefined,{'helpText':_0x57f1e1(0x211)});if(_0x569c77?.[_0x57f1e1(0x294)])return _0x30912c['counts']['agents'][_0x57f1e1(0x2bd)]=_0x10da87[_0x57f1e1(0x2b6)],_0x30912c[_0x57f1e1(0x1f1)]['knowledgeBases']['created']=_0x1828ee[_0x57f1e1(0x2b6)],_0x30912c[_0x57f1e1(0x1f1)][_0x57f1e1(0x1cb)][_0x57f1e1(0x2bd)]=_0x3085b2[_0x57f1e1(0x2b6)],_0x30912c[_0x57f1e1(0x1f1)]['experimentalKnowledgeBases'][_0x57f1e1(0x2bd)]=_0x192a84[_0x57f1e1(0x2b6)],_0x30912c[_0x57f1e1(0x1f1)][_0x57f1e1(0x2b3)][_0x57f1e1(0x2bd)]=_0x199364[_0x57f1e1(0x2b6)],_0x30912c['counts'][_0x57f1e1(0x1e6)][_0x57f1e1(0x2bd)]=_0x384d03[_0x57f1e1(0x2b6)],_0x30912c[_0x57f1e1(0x1f1)]['integrations']['created']=_0x15a6c7[_0x57f1e1(0x2b6)],_0x30912c;const _0x71d236=await this[_0x57f1e1(0x1fa)][_0x57f1e1(0x295)]({'name':_0xfb9df2}),_0x4384f1=_0x71d236['id'];_0x30912c['newProjectId']=_0x4384f1;const _0x4444a8=new Map(),_0x43b293=new Map(),_0x20418f=new Map(),_0x149668=new Map(),_0x3a02a4=new Map(),_0x49b804=new Map(),_0x519332=new Map(),_0x11ad46=new Map(),_0x1f456f=new Set(),_0x522d46=new Set();for(const _0x1d0d93 of _0x10da87){for(const _0x456b1e of _0x1d0d93[_0x57f1e1(0x2c3)][_0x57f1e1(0x21f)]||[]){if(_0x456b1e[_0x57f1e1(0x259)]===_0x57f1e1(0x2b9)&&_0x456b1e[_0x57f1e1(0x1f7)]){const _0x1962e8=parseRef(_0x456b1e[_0x57f1e1(0x1f7)]);if(_0x1962e8)_0x1f456f['add'](_0x1962e8[_0x57f1e1(0x298)]);}else{if(_0x456b1e['type']===_0x57f1e1(0x1bb)&&_0x456b1e[_0x57f1e1(0x1f7)]){const _0x1d65ab=parseRef(_0x456b1e[_0x57f1e1(0x1f7)]);if(_0x1d65ab)_0x522d46[_0x57f1e1(0x2a5)](_0x1d65ab['name']);}}}}for(const _0xa44a2c of _0x1f456f){try{const _0x37de5e=await this[_0x57f1e1(0x1fa)]['createImageGenerator']({'projectId':_0x4384f1,'name':_0xa44a2c});_0x3a02a4[_0x57f1e1(0x2d8)](_0xa44a2c,_0x37de5e['id']),_0x30912c[_0x57f1e1(0x22d)][_0x57f1e1(0x24d)]({'name':_0xa44a2c,'action':_0x57f1e1(0x2bd),'id':_0x37de5e['id']}),_0x30912c[_0x57f1e1(0x1f1)]['imageGenerators']['created']++;}catch(_0x7e8d4){_0x30912c['imageGenerators'][_0x57f1e1(0x24d)]({'name':_0xa44a2c,'action':_0x57f1e1(0x1b0),'error':_0x7e8d4[_0x57f1e1(0x1ba)]}),_0x30912c['counts'][_0x57f1e1(0x22d)][_0x57f1e1(0x25b)]++;}}for(const _0x9abdc of _0x522d46){try{const _0x4a5ec9=await this[_0x57f1e1(0x1fa)][_0x57f1e1(0x1c7)]({'projectId':_0x4384f1,'name':_0x9abdc});_0x49b804[_0x57f1e1(0x2d8)](_0x9abdc,_0x4a5ec9['id']),_0x30912c[_0x57f1e1(0x257)][_0x57f1e1(0x24d)]({'name':_0x9abdc,'action':_0x57f1e1(0x2bd),'id':_0x4a5ec9['id']}),_0x30912c[_0x57f1e1(0x1f1)][_0x57f1e1(0x257)][_0x57f1e1(0x2bd)]++;}catch(_0x402a2c){_0x30912c['webSearchTools'][_0x57f1e1(0x24d)]({'name':_0x9abdc,'action':_0x57f1e1(0x1b0),'error':_0x402a2c[_0x57f1e1(0x1ba)]}),_0x30912c[_0x57f1e1(0x1f1)]['webSearchTools'][_0x57f1e1(0x25b)]++;}}const _0x511a8e=await fetchAllToolTargetMaps((_0x5b786b,_0xee42f2)=>this[_0x57f1e1(0x1fa)][_0x57f1e1(0x1ea)](_0x5b786b,_0xee42f2),_0x4384f1);let _0x173acc=[];const _0x1c5b55={'projectId':_0x4384f1,'resolveToolTargetId':buildIdResolver({..._0x511a8e['nameToId'],'KnowledgeBase':_0x4444a8,'TextKnowledgeBase':_0x43b293,'ExperimentalKnowledgeBase':_0x519332,'Agent':_0x20418f,'WebSearchTool':_0x49b804,'ImageGenerator':_0x3a02a4}),'resolvePromptId':async _0x4d7fd6=>_0x149668[_0x57f1e1(0x1bc)](_0x4d7fd6),'onWarning':_0x589713=>{const _0x34ff2=_0x57f1e1;this[_0x34ff2(0x28c)][_0x34ff2(0x2d1)](_0x589713),_0x173acc[_0x34ff2(0x24d)](_0x589713);}};for(const _0x1e8821 of _0x1828ee){try{const _0x345090=yamlKnowledgeBaseToApi(_0x1e8821['yaml'],_0x4384f1),_0xe93293=await this[_0x57f1e1(0x1fa)]['createKnowledgeBase'](_0x345090);_0x4444a8[_0x57f1e1(0x2d8)](_0x1e8821[_0x57f1e1(0x2c3)][_0x57f1e1(0x298)],_0xe93293['id']),_0x30912c[_0x57f1e1(0x1db)][_0x57f1e1(0x24d)]({'name':_0x1e8821[_0x57f1e1(0x2c3)][_0x57f1e1(0x298)],'action':'created','id':_0xe93293['id']}),_0x30912c[_0x57f1e1(0x1f1)][_0x57f1e1(0x1db)][_0x57f1e1(0x2bd)]++;}catch(_0xf207b9){_0x30912c[_0x57f1e1(0x1db)][_0x57f1e1(0x24d)]({'name':_0x1e8821[_0x57f1e1(0x2c3)][_0x57f1e1(0x298)],'action':_0x57f1e1(0x1b0),'error':_0xf207b9[_0x57f1e1(0x1ba)]}),_0x30912c['counts']['knowledgeBases'][_0x57f1e1(0x25b)]++;}}for(const _0x3cc096 of _0x3085b2){try{const _0x119755=yamlTextKnowledgeBaseToApi({'name':_0x3cc096[_0x57f1e1(0x298)],'text':_0x3cc096[_0x57f1e1(0x200)]},_0x4384f1),_0x307653=await this[_0x57f1e1(0x1fa)][_0x57f1e1(0x255)](_0x119755);_0x43b293[_0x57f1e1(0x2d8)](_0x3cc096[_0x57f1e1(0x298)],_0x307653['id']),_0x30912c[_0x57f1e1(0x1cb)][_0x57f1e1(0x24d)]({'name':_0x3cc096['name'],'action':_0x57f1e1(0x2bd),'id':_0x307653['id']}),_0x30912c['counts']['textKnowledgeBases']['created']++;}catch(_0x1d5d6b){_0x30912c[_0x57f1e1(0x1cb)][_0x57f1e1(0x24d)]({'name':_0x3cc096['name'],'action':_0x57f1e1(0x1b0),'error':_0x1d5d6b[_0x57f1e1(0x1ba)]}),_0x30912c['counts'][_0x57f1e1(0x1cb)][_0x57f1e1(0x25b)]++;}}for(const _0x1da7a9 of _0x199364){try{const _0x284615=yamlExperimentalArtifactToApi(_0x1da7a9[_0x57f1e1(0x209)],_0x4384f1),_0xac1263=await this[_0x57f1e1(0x1fa)][_0x57f1e1(0x1dc)](_0x284615);_0x11ad46[_0x57f1e1(0x2d8)](_0x1da7a9['def'][_0x57f1e1(0x298)],_0xac1263['id']),_0x30912c['experimentalArtifacts'][_0x57f1e1(0x24d)]({'name':_0x1da7a9[_0x57f1e1(0x209)][_0x57f1e1(0x298)],'action':'created','id':_0xac1263['id']}),_0x30912c[_0x57f1e1(0x1f1)][_0x57f1e1(0x2b3)][_0x57f1e1(0x2bd)]++;}catch(_0x22b34c){_0x30912c[_0x57f1e1(0x2b3)][_0x57f1e1(0x24d)]({'name':_0x1da7a9[_0x57f1e1(0x209)][_0x57f1e1(0x298)],'action':_0x57f1e1(0x1b0),'error':_0x22b34c[_0x57f1e1(0x1ba)]}),_0x30912c[_0x57f1e1(0x1f1)][_0x57f1e1(0x2b3)]['errors']++;}}for(const _0x1145ef of _0x192a84){try{const _0x49b6e5=yamlExperimentalKnowledgeBaseToApi(_0x1145ef[_0x57f1e1(0x209)],_0x4384f1),_0x5f1507=await this['client'][_0x57f1e1(0x202)](_0x49b6e5);_0x519332['set'](_0x1145ef[_0x57f1e1(0x209)][_0x57f1e1(0x298)],_0x5f1507['id']),_0x30912c[_0x57f1e1(0x221)]['push']({'name':_0x1145ef[_0x57f1e1(0x209)]['name'],'action':_0x57f1e1(0x2bd),'id':_0x5f1507['id']}),_0x30912c['counts'][_0x57f1e1(0x221)][_0x57f1e1(0x2bd)]++;}catch(_0x8dc5c6){_0x30912c[_0x57f1e1(0x221)][_0x57f1e1(0x24d)]({'name':_0x1145ef['def']['name'],'action':'error','error':_0x8dc5c6['message']}),_0x30912c[_0x57f1e1(0x1f1)][_0x57f1e1(0x221)][_0x57f1e1(0x25b)]++;}}const _0x3fd376=[..._0x10da87][_0x57f1e1(0x213)]((_0x4cccf8,_0x35319a)=>{const _0x1760f3=_0x57f1e1,_0x4be9ca=_0x4cccf8[_0x1760f3(0x2c3)]['tools']?.[_0x1760f3(0x2cd)](_0x1b07d6=>_0x1b07d6[_0x1760f3(0x259)]===_0x1760f3(0x2d7))??![],_0x30860e=_0x35319a[_0x1760f3(0x2c3)][_0x1760f3(0x21f)]?.[_0x1760f3(0x2cd)](_0x14f209=>_0x14f209[_0x1760f3(0x259)]===_0x1760f3(0x2d7))??![];if(_0x4be9ca&&!_0x30860e)return 0x1;if(!_0x4be9ca&&_0x30860e)return-0x1;return 0x0;});for(const _0x248343 of _0x3fd376){_0x173acc=[];try{const _0x3c49be=_0x248343['yaml'][_0x57f1e1(0x21f)]?.[_0x57f1e1(0x23f)](_0x4b8bda=>{const _0x55250a=_0x57f1e1;if(_0x4b8bda['type']===_0x55250a(0x2d7)&&_0x4b8bda['target']){const _0x150e97=parseRef(_0x4b8bda[_0x55250a(0x1f7)]);return _0x150e97?.['name']===_0x248343[_0x55250a(0x2c3)][_0x55250a(0x298)];}return![];})??[];if(_0x3c49be[_0x57f1e1(0x2b6)]>0x0){const _0x2e9d80=_0x57f1e1(0x253)+_0x248343['yaml']['name']+_0x57f1e1(0x233)+_0x57f1e1(0x271);this[_0x57f1e1(0x28c)][_0x57f1e1(0x2d1)](_0x2e9d80),_0x173acc[_0x57f1e1(0x24d)](_0x2e9d80);}const _0x1dd8e4=await agentDefToRequest(_0x248343[_0x57f1e1(0x2c3)],_0x248343[_0x57f1e1(0x206)],_0x248343[_0x57f1e1(0x261)],_0x1c5b55),_0x12b3ea=await this[_0x57f1e1(0x1fa)][_0x57f1e1(0x1d9)](_0x1dd8e4);_0x20418f[_0x57f1e1(0x2d8)](_0x248343[_0x57f1e1(0x2c3)][_0x57f1e1(0x298)],_0x12b3ea['id']),_0x30912c[_0x57f1e1(0x1e0)]['push']({'agentName':_0x248343[_0x57f1e1(0x2c3)][_0x57f1e1(0x298)],'action':_0x57f1e1(0x2bd),'agentId':_0x12b3ea['id'],'warnings':_0x173acc[_0x57f1e1(0x2b6)]>0x0?_0x173acc:undefined}),_0x30912c['counts'][_0x57f1e1(0x1e0)][_0x57f1e1(0x2bd)]++;}catch(_0x428102){_0x30912c[_0x57f1e1(0x1e0)][_0x57f1e1(0x24d)]({'agentName':_0x248343['yaml'][_0x57f1e1(0x298)],'action':_0x57f1e1(0x1b0),'error':_0x428102[_0x57f1e1(0x1ba)],'warnings':_0x173acc[_0x57f1e1(0x2b6)]>0x0?_0x173acc:undefined}),_0x30912c[_0x57f1e1(0x1f1)][_0x57f1e1(0x1e0)]['errors']++;}}for(const _0x3013f7 of _0x384d03){try{const _0x2b16d0=await yamlPromptToApi(_0x3013f7['yaml'],_0x4384f1,_0x1c5b55);if(!_0x2b16d0){_0x30912c[_0x57f1e1(0x1e6)]['push']({'name':_0x3013f7['yaml']['name'],'action':_0x57f1e1(0x1b0),'error':_0x57f1e1(0x20b)}),_0x30912c['counts'][_0x57f1e1(0x1e6)][_0x57f1e1(0x25b)]++;continue;}const _0x12de6c=await this[_0x57f1e1(0x1fa)]['createPrompt'](_0x2b16d0);_0x149668[_0x57f1e1(0x2d8)](_0x3013f7[_0x57f1e1(0x2c3)]['name'],_0x12de6c['id']),_0x30912c[_0x57f1e1(0x1e6)][_0x57f1e1(0x24d)]({'name':_0x3013f7[_0x57f1e1(0x2c3)]['name'],'action':_0x57f1e1(0x2bd),'id':_0x12de6c['id']}),_0x30912c[_0x57f1e1(0x1f1)][_0x57f1e1(0x1e6)]['created']++;}catch(_0x443f1e){_0x30912c[_0x57f1e1(0x1e6)][_0x57f1e1(0x24d)]({'name':_0x3013f7[_0x57f1e1(0x2c3)][_0x57f1e1(0x298)],'action':_0x57f1e1(0x1b0),'error':_0x443f1e[_0x57f1e1(0x1ba)]}),_0x30912c['counts']['prompts'][_0x57f1e1(0x25b)]++;}}for(const _0x2b5c52 of _0x15a6c7){try{const _0x828aa0=await yamlIntegrationToApi(_0x2b5c52[_0x57f1e1(0x2c3)],_0x4384f1,_0x1c5b55),_0x5a017c=await this[_0x57f1e1(0x1fa)]['createIntegration'](_0x828aa0);_0x30912c[_0x57f1e1(0x278)][_0x57f1e1(0x24d)]({'name':_0x2b5c52[_0x57f1e1(0x2c3)][_0x57f1e1(0x1b7)],'action':_0x57f1e1(0x2bd),'id':_0x5a017c['id']}),_0x30912c[_0x57f1e1(0x1f1)]['integrations'][_0x57f1e1(0x2bd)]++;}catch(_0x46df22){_0x30912c[_0x57f1e1(0x278)][_0x57f1e1(0x24d)]({'name':_0x2b5c52[_0x57f1e1(0x2c3)][_0x57f1e1(0x1b7)],'action':_0x57f1e1(0x1b0),'error':_0x46df22[_0x57f1e1(0x1ba)]}),_0x30912c['counts'][_0x57f1e1(0x278)][_0x57f1e1(0x25b)]++;}}for(const _0x30593c of _0x3c635c){try{const _0x4feb12=await yamlFormInterfaceToApi(_0x30593c[_0x57f1e1(0x2c3)],_0x4384f1,_0x1c5b55);if(!_0x4feb12){_0x30912c['formInterfaces']['push']({'name':_0x30593c[_0x57f1e1(0x2c3)][_0x57f1e1(0x298)],'action':_0x57f1e1(0x1b0),'error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x30912c[_0x57f1e1(0x1f1)][_0x57f1e1(0x1ac)][_0x57f1e1(0x25b)]++;continue;}const _0xb8772d=await this['client'][_0x57f1e1(0x24c)](_0x4feb12);_0x30912c[_0x57f1e1(0x1ac)][_0x57f1e1(0x24d)]({'name':_0x30593c[_0x57f1e1(0x2c3)]['name'],'action':'created','id':_0xb8772d['id']}),_0x30912c[_0x57f1e1(0x1f1)]['formInterfaces']['created']++;}catch(_0x5074fe){_0x30912c[_0x57f1e1(0x1ac)]['push']({'name':_0x30593c[_0x57f1e1(0x2c3)][_0x57f1e1(0x298)],'action':_0x57f1e1(0x1b0),'error':_0x5074fe[_0x57f1e1(0x1ba)]}),_0x30912c[_0x57f1e1(0x1f1)][_0x57f1e1(0x1ac)][_0x57f1e1(0x25b)]++;}}for(const _0x288461 of _0x5f1794){try{const _0x303a24=await yamlChatInterfaceToApi(_0x288461[_0x57f1e1(0x2c3)],_0x4384f1,_0x1c5b55),_0x244421=await this['client'][_0x57f1e1(0x23b)](_0x303a24);_0x30912c[_0x57f1e1(0x275)]['push']({'name':_0x288461[_0x57f1e1(0x2c3)][_0x57f1e1(0x298)],'action':'created','id':_0x244421['id']}),_0x30912c[_0x57f1e1(0x1f1)]['chatInterfaces'][_0x57f1e1(0x2bd)]++;}catch(_0x121653){_0x30912c[_0x57f1e1(0x275)][_0x57f1e1(0x24d)]({'name':_0x288461[_0x57f1e1(0x2c3)]['name'],'action':'error','error':_0x121653[_0x57f1e1(0x1ba)]}),_0x30912c['counts'][_0x57f1e1(0x275)][_0x57f1e1(0x25b)]++;}}return _0x30912c;}}
1
+ const a133_0xe8af3=a133_0x209e;(function(_0x1a4351,_0x12afba){const _0x565c81=a133_0x209e,_0x54de5e=_0x1a4351();while(!![]){try{const _0x58add2=parseInt(_0x565c81(0x182))/0x1+-parseInt(_0x565c81(0x1c6))/0x2+parseInt(_0x565c81(0x13c))/0x3*(-parseInt(_0x565c81(0x215))/0x4)+parseInt(_0x565c81(0x20d))/0x5*(parseInt(_0x565c81(0x232))/0x6)+parseInt(_0x565c81(0x15c))/0x7*(-parseInt(_0x565c81(0x179))/0x8)+parseInt(_0x565c81(0x256))/0x9+-parseInt(_0x565c81(0x17c))/0xa*(-parseInt(_0x565c81(0x1bc))/0xb);if(_0x58add2===_0x12afba)break;else _0x54de5e['push'](_0x54de5e['shift']());}catch(_0x3dec16){_0x54de5e['push'](_0x54de5e['shift']());}}}(a133_0x5894,0xdfa55));import{LLMApiClient}from'../client/llm-api-client.js';import*as a133_0x8c5550 from'node:fs';import*as a133_0xcf5d58 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';function a133_0x5894(){const _0x3fe49f=['file_name','basename','TextKnowledgeBase','No\x20tdx.json\x20found\x20in\x20','getOrCreateDefaultAgent','createImageGenerator','variables','listChats','maxToolIterations','getBackupMetadata','files','getDefaultProjectName','yaml','getProject','prompt.md','Project\x20\x22','renamed','listAgentsFull','promptId','push','none','Project\x20not\x20found:\x20','statSync','site','web_search','\x0a\x0a#\x20agent.yml\x0a','deleteIntegration','Output\x20directory\x20already\x20exists:\x20','\x20→\x20','mkdirSync','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','join','agents','resolveAgentId','(dry-run)','total','createAgentResponse','projects','info','readdirSync','clearDefaultAgent','some','INTERNAL','createKnowledgeBase','createWebSearchTool','availableModels','localeCompare','new','Multiple\x20agents\x20found\x20with\x20name\x20\x27','.llm','integrations.json','already\x20exists','.md','restoreProject','starter_message.md','createAgent','unchanged','updateAgent','metadata','duplicate','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','has','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','\x22\x20already\x20exists','counts','text_content','knowledgebases.json','code.js','Renamed\x20agent\x20folder:\x20','continueChat','75025SeyQhf','json_schema','createExperimentalKnowledgeBase','tdx_default_','Multiple\x20projects\x20found\x20with\x20name\x20\x27','length','chat_agent_console','\x20in\x20project\x20','101624GRTHNG','medium','experimentalKnowledgeBases','.yml','createTextKnowledgeBase','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','Backup\x20folder\x20not\x20found:\x20','sdk.llm','service_type','listPrompts','knowledge_bases','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','webSearchTools','attributes','listChatInterfaces','tdx_','code','action','\x27\x20(','add','existsSync','loadJsonFile','def','createFormInterface','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','INVALID_ARGUMENT','writeFileSync','updateKnowledgeBase','toISOString','654RboODf','agentsFull','dryRun','createProject','prompts','updateAgentResponse','history','listTextKnowledgeBases','sort','type','deleteProject','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.','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','nameToId','parse','minimal','imageGenerators','tdx.json','Removed\x20deleted\x20directory:\x20','\x0a---\x20code\x20---\x0a','getOrCreateDefaultProject','chatInterfaces','text','get','Invalid\x20agent\x20reference\x20format:\x20','listToolTargets','isDirectory','dirname','keys','actions','message','oldPath','knowledgeBases','getAgent','serviceType','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','3733731EEmNKa','chatId','pullProject','profile','integrations','createIntegration','created','path','agent','_reasoning_','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','low','207URnrwL','createChatInterface','LLM_PROJECT_NOT_FOUND','pullAgent','cloneProject','chat_generic','listFormInterfaces','availableModelNames','getChatLog','json_schema.json','filter','\x0a---\x20schema:\x20','prompts.json','NOT_FOUND','setCurrentProject','warn','Skipping\x20integration\x20\x27','size','resolveProjectName',')\x20can\x20be\x20cloned.','map','---\x20file:\x20','rmSync','toLowerCase','currentProjectId','project.json','errors','logger','agents.json','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','ALREADY_EXISTS','starter_message','3175809IhLOKY','cwd','stringify','chat','dry-run-','chats','setDefaultAgent','project','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','Renamed\x20chat\x20interface\x20file:\x20','isFile','getUserSettings','Removed\x20deleted\x20file:\x20','Renamed\x20experimental\x20artifact\x20directory:\x20','includes','---\x20schema:\x20','\x0a---\x20function:\x20','AGENT_NOT_FOUND','deleteAgent','systemPrompt','template','error','exportedFrom','isDir','form_interfaces','experimental_artifacts','Only\x20safe\x20types\x20(','agent.yml\x20not\x20found\x20in\x20','formInterfaces','24EoutwO','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','split','310ZAozbe','agentId','createPrompt','slackMessageMode','event','llm_project','721999ldnRAU','listKnowledgeBases','Renamed\x20prompt\x20file:\x20','Agent\x20not\x20found:\x20','Unsupported\x20backup\x20version:\x20','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','tools','utf-8','client','isManaged',')\x20can\x20be\x20pushed.\x20','#\x20prompt.md\x0a','ExperimentalKnowledgeBase','idToName','version','listAgents','chatIgnoreManagedActions','updateExperimentalArtifact','pushProject','outputs','experimental_knowledge_bases','context','agent.yml','set','dir','listImageGenerators','signal','Renamed\x20form\x20interface\x20file:\x20','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','models','listExperimentalKnowledgeBases','chat_interfaces','find','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','UNAUTHENTICATED','Agent\x20reference\x20not\x20found','createExperimentalArtifact','listProjects','Could\x20not\x20resolve\x20agent\x20reference','textKnowledgeBases','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','content','status','):\x20','starterMessage','displayName','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','readFileSync','\x27.\x20This\x20should\x20not\x20happen.','experimentalArtifacts','description','\x20---\x0a','startChat','target','functions','endsWith','listIntegrations','chat_parent_segment','650353QpoIdu','chatInfo','updated','backupProject','tdDatabaseName','unlinkSync','Agent\x20\x27','name','image_gen','resolveProjectId','1150176kdcTuj'];a133_0x5894=function(){return _0x3fe49f;};return a133_0x5894();}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=[a133_0xe8af3(0x141),a133_0xe8af3(0x213),a133_0xe8af3(0x1bb)];async function safeListOrEmpty(_0x5cef04){const _0x5f2691=a133_0xe8af3;try{return await _0x5cef04();}catch(_0xcd11b5){if(_0xcd11b5 instanceof HTTPClientError&&_0xcd11b5[_0x5f2691(0x1ac)]===0x194)return[];throw _0xcd11b5;}}function a133_0x209e(_0x433423,_0x45c153){_0x433423=_0x433423-0x139;const _0x5894cb=a133_0x5894();let _0x209e6e=_0x5894cb[_0x433423];return _0x209e6e;}export class LLMSDK{[a133_0xe8af3(0x154)];[a133_0xe8af3(0x18a)];[a133_0xe8af3(0x197)];[a133_0xe8af3(0x157)]=Logger['of'](a133_0xe8af3(0x21c));constructor(_0x261808){const _0x168863=a133_0xe8af3;this['client']=new LLMApiClient(_0x261808),this[_0x168863(0x197)]=_0x261808;}[a133_0xe8af3(0x1d2)](){const _0x5a46ef=a133_0xe8af3,_0x18dcf7=getSanitizedUsername();return _0x5a46ef(0x210)+_0x18dcf7;}async[a133_0xe8af3(0x14a)](_0x5bf612){const _0x374360=a133_0xe8af3,{projectId:_0x5e7076}=await this[_0x374360(0x14e)](_0x5bf612);this[_0x374360(0x154)]=_0x5e7076;}['getCurrentProject'](){const _0x3d89df=a133_0xe8af3;return this[_0x3d89df(0x154)];}async[a133_0xe8af3(0x162)](_0x4caf73){const _0x3c4ae7=a133_0xe8af3,_0x55fda2=this[_0x3c4ae7(0x197)]['profile'];let _0x405122,_0x451fe6;if(_0x4caf73['includes']('/')){const _0x39aa43=_0x4caf73[_0x3c4ae7(0x17b)]('/');if(_0x39aa43[_0x3c4ae7(0x212)]!==0x2)throw new SDKError(ErrorCode[_0x3c4ae7(0x22e)],_0x3c4ae7(0x24a)+_0x4caf73,undefined,{'helpText':_0x3c4ae7(0x205)});const [_0x1e0f9e,_0xb92849]=_0x39aa43;_0x405122=await this[_0x3c4ae7(0x1c5)](_0x1e0f9e),_0x451fe6=_0xb92849;}else _0x405122=this[_0x3c4ae7(0x154)]||(await this[_0x3c4ae7(0x246)]())['id'],_0x451fe6=_0x4caf73;const _0x59714b=await this[_0x3c4ae7(0x1e8)](_0x451fe6,_0x405122),_0x1fc718=await this[_0x3c4ae7(0x18a)][_0x3c4ae7(0x253)](_0x59714b);writeCachedLLMAgent(_0x1fc718[_0x3c4ae7(0x222)][_0x3c4ae7(0x1c3)],_0x59714b,_0x405122,_0x55fda2);}['getDefaultAgent'](){const _0x15baac=a133_0xe8af3,_0x332341=this[_0x15baac(0x197)]['profile'];return readCachedLLMAgent(_0x332341)||undefined;}[a133_0xe8af3(0x1ef)](){const _0x7c9e85=a133_0xe8af3,_0x1a01fb=this[_0x7c9e85(0x197)]['profile'];clearCachedLLMAgent(_0x1a01fb);}async[a133_0xe8af3(0x19f)](){const _0x4c9851=a133_0xe8af3,_0x359638=await this[_0x4c9851(0x18a)][_0x4c9851(0x167)](),_0x377b73=[];for(const _0x33f485 of _0x359638[_0x4c9851(0x143)]){const _0x18fb77=_0x359638[_0x4c9851(0x1f4)][_0x33f485];_0x18fb77&&_0x377b73['push']({'name':_0x33f485,'displayName':_0x18fb77[_0x4c9851(0x1af)]});}return _0x377b73;}async[a133_0xe8af3(0x235)](_0x4269ad){const _0x207671=a133_0xe8af3;return await this['client'][_0x207671(0x235)](_0x4269ad);}async[a133_0xe8af3(0x23c)](_0x459b32){const _0x59151f=a133_0xe8af3,{projectId:_0x15a8ac}=await this[_0x59151f(0x14e)](_0x459b32);await this[_0x59151f(0x18a)][_0x59151f(0x23c)](_0x15a8ac);}async[a133_0xe8af3(0x1ec)](_0x7ae99d=0x32){const _0x3b41ce=a133_0xe8af3;return await this[_0x3b41ce(0x18a)][_0x3b41ce(0x1a7)](_0x7ae99d);}async[a133_0xe8af3(0x246)](_0x2c0364){const _0x412a63=a133_0xe8af3,_0x42f742=_0x2c0364||this[_0x412a63(0x1d2)](),_0x3177fa=this[_0x412a63(0x197)][_0x412a63(0x259)];if(!_0x2c0364){const _0x52c0b4=readCachedLLMProject(_0x3177fa);if(_0x52c0b4&&_0x52c0b4[_0x412a63(0x1c3)]===_0x42f742)try{const _0x3f3b57=await this[_0x412a63(0x18a)]['getProject'](_0x52c0b4['id']);if(_0x3f3b57[_0x412a63(0x222)]['name']===_0x42f742)return _0x3f3b57;}catch{}}const _0x2bfa49=await this['client'][_0x412a63(0x1a7)](),_0xa30987=_0x2bfa49[_0x412a63(0x1a2)](_0xd267b3=>_0xd267b3[_0x412a63(0x222)][_0x412a63(0x1c3)]===_0x42f742);if(_0xa30987)return!_0x2c0364&&writeCachedLLMProject(_0x42f742,_0xa30987['id'],_0x3177fa),_0xa30987;const _0x5bedfb=await this[_0x412a63(0x18a)][_0x412a63(0x235)]({'name':_0x42f742,'description':_0x412a63(0x1aa)+getSanitizedUsername()+')'});return!_0x2c0364&&writeCachedLLMProject(_0x42f742,_0x5bedfb['id'],_0x3177fa),_0x5bedfb;}async[a133_0xe8af3(0x1c5)](_0x7c39e4){const _0x17b015=a133_0xe8af3,_0x213b74=await this['client'][_0x17b015(0x1a7)](),_0x48f911=_0x213b74['filter'](_0x305acb=>_0x305acb['attributes'][_0x17b015(0x1c3)]===_0x7c39e4);if(_0x48f911[_0x17b015(0x212)]===0x0)throw new SDKError(ErrorCode[_0x17b015(0x13e)],_0x17b015(0x1dc)+_0x7c39e4,undefined,{'helpText':_0x17b015(0x203)});if(_0x48f911['length']>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x17b015(0x211)+_0x7c39e4+_0x17b015(0x1b2));return _0x48f911[0x0]['id'];}async['resolveProjectName'](_0x4142c9){const _0x547f81=a133_0xe8af3,_0x1ef30d=await this[_0x547f81(0x18a)][_0x547f81(0x1a7)](),_0x5169c6=_0x1ef30d[_0x547f81(0x1a2)](_0x264091=>_0x264091[_0x547f81(0x222)][_0x547f81(0x1c3)]===_0x4142c9);if(_0x5169c6)return{'projectId':_0x5169c6['id'],'project':_0x5169c6};throw new SDKError(ErrorCode[_0x547f81(0x13e)],_0x547f81(0x1dc)+_0x4142c9,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async[a133_0xe8af3(0x1cb)](_0x5eb7c7='claude-4.5-sonnet',_0x230f2b=0x0,_0x46832d){const _0x5528aa=a133_0xe8af3,_0x3fa0d3=0xa;let _0x60d5d5=0x0,_0x240c4d;while(_0x60d5d5<_0x3fa0d3){try{const _0x1629cc=await this['getOrCreateDefaultProject'](_0x240c4d),_0x467451=_0x1629cc['id'],_0x3315dc=[_0x5528aa(0x1db),_0x5528aa(0x241),_0x5528aa(0x13b),_0x5528aa(0x216),'high'],_0x38a6d0=_0x230f2b===0x0?_0x5528aa(0x224)+_0x5eb7c7:_0x5528aa(0x224)+_0x5eb7c7+_0x5528aa(0x139)+_0x3315dc[_0x230f2b],_0x3fc813=await this['client'][_0x5528aa(0x191)](_0x467451),_0x1f6584=_0x3fc813[_0x5528aa(0x1a2)](_0x268594=>_0x268594['attributes'][_0x5528aa(0x1c3)]===_0x38a6d0);if(_0x1f6584)return _0x1f6584;const _0x9ed5a9=_0x230f2b>0x0?0x1:_0x46832d;return await this[_0x5528aa(0x18a)][_0x5528aa(0x1fe)]({'name':_0x38a6d0,'projectId':_0x467451,'modelType':_0x5eb7c7,'systemPrompt':'','temperature':_0x9ed5a9,'reasoningEffort':_0x230f2b>0x0?_0x230f2b:undefined});}catch(_0x2d7ed3){if(_0x2d7ed3 instanceof HTTPClientError){const _0x22b175=_0x2d7ed3[_0x5528aa(0x1ac)];if(_0x22b175>=0x190&&_0x22b175<0x1f4){if(_0x22b175===0x191)throw new SDKError(ErrorCode[_0x5528aa(0x1a4)],'Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.',_0x2d7ed3);else{if(_0x22b175===0x193)throw new SDKError(ErrorCode['PERMISSION_DENIED'],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x2d7ed3);}throw _0x2d7ed3;}}if(errorContains(_0x2d7ed3,_0x5528aa(0x1fa),_0x5528aa(0x202),'conflict')){_0x60d5d5++;if(_0x60d5d5>=_0x3fa0d3)throw new SDKError(ErrorCode[_0x5528aa(0x15a)],'Unable\x20to\x20create\x20project\x20after\x20'+_0x3fa0d3+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x2d7ed3);const _0xe2a22d=this[_0x5528aa(0x1d2)]();_0x240c4d=_0xe2a22d+'_'+generateRandomHex();continue;}throw _0x2d7ed3;}}throw new SDKError(ErrorCode[_0x5528aa(0x1f1)],_0x5528aa(0x220));}async['resolveAgentId'](_0x3df2d8,_0x43d0f8){const _0x2bc73b=a133_0xe8af3,_0x17ea65=_0x43d0f8||this[_0x2bc73b(0x154)],_0xc270c3=await this[_0x2bc73b(0x18a)][_0x2bc73b(0x191)](_0x17ea65),_0xfc4f9=_0xc270c3[_0x2bc73b(0x146)](_0x2fd6bf=>_0x2fd6bf[_0x2bc73b(0x222)][_0x2bc73b(0x1c3)]===_0x3df2d8);if(_0xfc4f9[_0x2bc73b(0x212)]===0x0){const _0x35ebe8=_0x17ea65?_0x2bc73b(0x214)+_0x17ea65:'';throw new SDKError(ErrorCode[_0x2bc73b(0x16d)],'Agent\x20not\x20found:\x20'+_0x3df2d8+_0x35ebe8,undefined,{'helpText':_0x17ea65?_0x2bc73b(0x23e):_0x2bc73b(0x23d)});}if(_0xfc4f9[_0x2bc73b(0x212)]>0x1)throw new SDKError(ErrorCode[_0x2bc73b(0x1f1)],_0x2bc73b(0x1f7)+_0x3df2d8+_0x2bc73b(0x1b2));return _0xfc4f9[0x0]['id'];}async[a133_0xe8af3(0x1e7)](_0x430f9e){const _0x464acd=a133_0xe8af3,_0x1080d7=_0x430f9e||this[_0x464acd(0x154)];return await this[_0x464acd(0x18a)][_0x464acd(0x191)](_0x1080d7);}async[a133_0xe8af3(0x233)](_0x409b0c){const _0x2ba5d2=a133_0xe8af3;return await this[_0x2ba5d2(0x18a)][_0x2ba5d2(0x1d8)](_0x409b0c);}async['agent'](_0xad62b0){const _0x81dcfe=a133_0xe8af3;return await this[_0x81dcfe(0x18a)][_0x81dcfe(0x253)](_0xad62b0);}async[a133_0xe8af3(0x1fe)](_0x287702){const _0x13c812=a133_0xe8af3;return await this[_0x13c812(0x18a)][_0x13c812(0x1fe)](_0x287702);}async[a133_0xe8af3(0x200)](_0x53d616,_0x3cd11d){const _0x13e4ca=a133_0xe8af3;return await this[_0x13e4ca(0x18a)][_0x13e4ca(0x200)](_0x53d616,_0x3cd11d);}async['deleteAgent'](_0x6a739){const _0x47576a=a133_0xe8af3;await this['client'][_0x47576a(0x16e)](_0x6a739);}async[a133_0xe8af3(0x1b6)](_0x1a6e36){const _0x228924=a133_0xe8af3;return await this['client'][_0x228924(0x1b6)]({'agentId':_0x1a6e36});}async*[a133_0xe8af3(0x15f)](_0x2f1b35,_0xfcbc41){const _0x126f54=a133_0xe8af3;let _0x4c179b=_0xfcbc41?.[_0x126f54(0x257)];const _0x16e765=_0xfcbc41?.['agentId'];if(!_0x4c179b){if(!_0x16e765)throw new Error(_0x126f54(0x187));const _0x5830b5=await this[_0x126f54(0x18a)][_0x126f54(0x1b6)]({'agentId':_0x16e765});_0x4c179b=_0x5830b5['id'],yield{'type':_0x126f54(0x201),'data':{'chatId':_0x4c179b,'agentId':_0x16e765,'projectId':_0x5830b5[_0x126f54(0x222)]['projectId']}};}for await(const _0x347eb3 of this['client'][_0x126f54(0x20c)](_0x4c179b,_0x2f1b35,_0xfcbc41?.[_0x126f54(0x19c)])){yield{'type':_0x126f54(0x180),'data':_0x347eb3};}}async[a133_0xe8af3(0x161)](_0x9b7490=0x32){const _0x15100e=a133_0xe8af3;return await this[_0x15100e(0x18a)][_0x15100e(0x1ce)](_0x9b7490);}async[a133_0xe8af3(0x238)](_0x11aea4){const _0x5d6d85=a133_0xe8af3;return await this[_0x5d6d85(0x18a)]['getChatHistory'](_0x11aea4);}async[a133_0xe8af3(0x144)](_0x14a384){const _0x4cab3a=a133_0xe8af3;return await this[_0x4cab3a(0x18a)]['getChatLog'](_0x14a384);}async[a133_0xe8af3(0x1bd)](_0x1ff2b2){const _0x24977c=a133_0xe8af3;return await this[_0x24977c(0x18a)]['getChatInfo'](_0x1ff2b2);}async[a133_0xe8af3(0x1bf)](_0x1ff354,_0x535f15,_0x5c34d5){const _0x2f9ec3=a133_0xe8af3,_0x53ebab=_0x5c34d5?.[_0x2f9ec3(0x234)]??![],{projectId:_0x57ea87,project:_0x5096aa}=await this[_0x2f9ec3(0x14e)](_0x1ff354),_0x77e078=_0x5096aa['attributes'][_0x2f9ec3(0x1c3)],_0x439a43=_0x535f15||_0x77e078+_0x2f9ec3(0x1f8);if(a133_0x8c5550[_0x2f9ec3(0x229)](_0x439a43)&&!_0x53ebab)throw new SDKError(ErrorCode[_0x2f9ec3(0x15a)],_0x2f9ec3(0x1e2)+_0x439a43,undefined,{'helpText':_0x2f9ec3(0x17a)});const _0x1b0de8=await this['client'][_0x2f9ec3(0x1d8)](_0x57ea87),_0x30f314=await this['client'][_0x2f9ec3(0x183)](_0x57ea87),_0x2cc619=await this[_0x2f9ec3(0x18a)][_0x2f9ec3(0x21e)](_0x57ea87),_0x487b68=await this[_0x2f9ec3(0x18a)][_0x2f9ec3(0x1ba)](_0x57ea87);if(!_0x53ebab){a133_0x8c5550[_0x2f9ec3(0x1e4)](_0x439a43,{'recursive':!![]});const _0x5dcbc3={'version':'1.0','exportedAt':new Date()[_0x2f9ec3(0x231)](),'exportedFrom':{'site':this[_0x2f9ec3(0x197)]['site'],'projectId':_0x57ea87,'projectName':_0x77e078},'project':_0x5096aa};a133_0x8c5550[_0x2f9ec3(0x22f)](a133_0xcf5d58[_0x2f9ec3(0x1e6)](_0x439a43,_0x2f9ec3(0x155)),JSON[_0x2f9ec3(0x15e)](_0x5dcbc3,null,0x2)),a133_0x8c5550[_0x2f9ec3(0x22f)](a133_0xcf5d58['join'](_0x439a43,_0x2f9ec3(0x158)),JSON[_0x2f9ec3(0x15e)](_0x1b0de8,null,0x2)),a133_0x8c5550['writeFileSync'](a133_0xcf5d58[_0x2f9ec3(0x1e6)](_0x439a43,_0x2f9ec3(0x209)),JSON['stringify'](_0x30f314,null,0x2)),a133_0x8c5550['writeFileSync'](a133_0xcf5d58[_0x2f9ec3(0x1e6)](_0x439a43,_0x2f9ec3(0x148)),JSON[_0x2f9ec3(0x15e)](_0x2cc619,null,0x2)),a133_0x8c5550[_0x2f9ec3(0x22f)](a133_0xcf5d58[_0x2f9ec3(0x1e6)](_0x439a43,_0x2f9ec3(0x1f9)),JSON[_0x2f9ec3(0x15e)](_0x487b68,null,0x2));}return{'projectName':_0x77e078,'outputDir':_0x439a43,'counts':{'agents':_0x1b0de8[_0x2f9ec3(0x212)],'knowledgeBases':_0x30f314[_0x2f9ec3(0x212)],'prompts':_0x2cc619[_0x2f9ec3(0x212)],'integrations':_0x487b68[_0x2f9ec3(0x212)]}};}async[a133_0xe8af3(0x1fc)](_0x466508,_0x293051){const _0x417a58=a133_0xe8af3,_0x47c50d=_0x293051?.['dryRun']??![],_0x92acfb=this[_0x417a58(0x1d0)](_0x466508),_0x5aeda8=_0x92acfb[_0x417a58(0x172)][_0x417a58(0x1de)],_0x6af44a=this[_0x417a58(0x197)][_0x417a58(0x1de)],_0x4aaf23=_0x5aeda8!==_0x6af44a?_0x5aeda8:undefined,_0x5ec7b0=this[_0x417a58(0x22a)](a133_0xcf5d58[_0x417a58(0x1e6)](_0x466508,_0x417a58(0x158)),[]),_0x3db85f=this[_0x417a58(0x22a)](a133_0xcf5d58[_0x417a58(0x1e6)](_0x466508,_0x417a58(0x209)),[]),_0x35daa6=this[_0x417a58(0x22a)](a133_0xcf5d58['join'](_0x466508,_0x417a58(0x148)),[]),_0x3740b3=this[_0x417a58(0x22a)](a133_0xcf5d58[_0x417a58(0x1e6)](_0x466508,_0x417a58(0x1f9)),[]),_0x23910a=_0x293051?.[_0x417a58(0x1c3)]||_0x92acfb[_0x417a58(0x172)]['projectName'];if(_0x47c50d){const _0x5aefd7=new Map(),_0x340a5f=[..._0x5ec7b0],_0x3824e0=_0x5ec7b0['length']+0x1;let _0x196162=0x0;while(_0x340a5f[_0x417a58(0x212)]>0x0&&_0x196162<_0x3824e0){_0x196162++;const _0x4410af=[];for(const _0x13ae48 of _0x340a5f){canCreateAgent(_0x13ae48,_0x5aefd7)?_0x5aefd7['set'](_0x13ae48['id'],_0x417a58(0x160)+_0x13ae48['id']):_0x4410af[_0x417a58(0x1da)](_0x13ae48);}if(_0x4410af[_0x417a58(0x212)]===_0x340a5f[_0x417a58(0x212)])throw new SDKError(ErrorCode[_0x417a58(0x1f1)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x417a58(0x164)});_0x340a5f['length']=0x0,_0x340a5f[_0x417a58(0x1da)](..._0x4410af);}const _0x3be5da=_0x35daa6[_0x417a58(0x146)](_0x2c1964=>_0x5aefd7[_0x417a58(0x204)](_0x2c1964[_0x417a58(0x222)]['agentId']))['length'];return{'projectName':_0x23910a,'projectId':_0x417a58(0x1e9),'counts':{'agents':_0x5ec7b0['length'],'knowledgeBases':_0x3db85f['length'],'prompts':_0x3be5da,'integrations':_0x3740b3['length']},'sourceSite':_0x4aaf23};}const _0x22c18c=await this['client'][_0x417a58(0x235)]({'name':_0x23910a,'description':_0x92acfb[_0x417a58(0x163)]['attributes'][_0x417a58(0x1b4)]}),_0x29216b=_0x22c18c['id'],_0x8a2302=new Map(),_0x3dbf45=new Map(),_0x51a192=new Map();for(const _0x370a58 of _0x3db85f){const _0x5c6f86=await this[_0x417a58(0x18a)][_0x417a58(0x1f2)]({'projectId':_0x29216b,'name':_0x370a58[_0x417a58(0x222)][_0x417a58(0x1c3)],'tdDatabaseName':_0x370a58['attributes'][_0x417a58(0x1c0)],'tables':_0x370a58[_0x417a58(0x222)]['tables']});_0x8a2302['set'](_0x370a58['id'],_0x5c6f86['id']);}const _0x2dec0e=[..._0x5ec7b0],_0x5aaf50=_0x5ec7b0['length']+0x1;let _0x1136eb=0x0;while(_0x2dec0e['length']>0x0&&_0x1136eb<_0x5aaf50){_0x1136eb++;const _0x119ba3=[];for(const _0x46800d of _0x2dec0e){if(canCreateAgent(_0x46800d,_0x3dbf45)){const _0x3cbe0c=remapToolIds(_0x46800d[_0x417a58(0x222)][_0x417a58(0x188)],_0x8a2302,_0x3dbf45),_0x55f0f3=remapVariableIds(_0x46800d[_0x417a58(0x222)]['variables'],_0x8a2302),_0x5b2675=await this[_0x417a58(0x18a)][_0x417a58(0x1eb)]({'name':_0x46800d[_0x417a58(0x222)][_0x417a58(0x1c3)],'projectId':_0x29216b,'systemPrompt':_0x46800d[_0x417a58(0x222)][_0x417a58(0x16f)],'starterMessage':_0x46800d[_0x417a58(0x222)][_0x417a58(0x1ae)],'modelType':migrateModelType(_0x46800d[_0x417a58(0x222)]['modelType']),'maxToolIterations':_0x46800d[_0x417a58(0x222)][_0x417a58(0x1cf)],'temperature':_0x46800d[_0x417a58(0x222)]['temperature'],'reasoningEffort':_0x46800d[_0x417a58(0x222)]['reasoningEffort'],'outputs':_0x46800d[_0x417a58(0x222)][_0x417a58(0x195)],'tools':_0x3cbe0c,'variables':_0x55f0f3});_0x3dbf45[_0x417a58(0x199)](_0x46800d['id'],_0x5b2675['id']);}else _0x119ba3[_0x417a58(0x1da)](_0x46800d);}if(_0x119ba3[_0x417a58(0x212)]===_0x2dec0e['length'])throw new SDKError(ErrorCode[_0x417a58(0x1f1)],_0x417a58(0x1b0),undefined,{'helpText':_0x417a58(0x164)});_0x2dec0e['length']=0x0,_0x2dec0e[_0x417a58(0x1da)](..._0x119ba3);}for(const _0x2db6db of _0x35daa6){const _0x2eefb4=_0x3dbf45[_0x417a58(0x249)](_0x2db6db[_0x417a58(0x222)][_0x417a58(0x17d)]);if(!_0x2eefb4)continue;const _0x2a490f=await this[_0x417a58(0x18a)][_0x417a58(0x17e)]({'projectId':_0x29216b,'agentId':_0x2eefb4,'name':_0x2db6db[_0x417a58(0x222)][_0x417a58(0x1c3)],'systemPrompt':_0x2db6db[_0x417a58(0x222)][_0x417a58(0x16f)],'template':_0x2db6db[_0x417a58(0x222)][_0x417a58(0x170)],'jsonSchemaHint':_0x2db6db['attributes']['jsonSchemaHint']});_0x51a192[_0x417a58(0x199)](_0x2db6db['id'],_0x2a490f['id']);}for(const _0x3b09a8 of _0x3740b3){const _0x403399=_0x3b09a8[_0x417a58(0x222)][_0x417a58(0x24f)][_0x417a58(0x150)](_0x20f488=>({..._0x20f488,'promptId':_0x51a192['get'](_0x20f488['promptId'])||_0x20f488[_0x417a58(0x1d9)]}));await this['client'][_0x417a58(0x25b)]({'projectId':_0x29216b,'serviceType':_0x3b09a8[_0x417a58(0x222)][_0x417a58(0x254)],'actions':_0x403399,'slackMessageMode':_0x3b09a8['attributes'][_0x417a58(0x17f)],'chatIgnoreManagedActions':_0x3b09a8[_0x417a58(0x222)][_0x417a58(0x192)],'chatWelcomeMessage':_0x3b09a8[_0x417a58(0x222)]['chatWelcomeMessage'],'webhookCorsOrigins':_0x3b09a8['attributes']['webhookCorsOrigins']});}return{'projectName':_0x23910a,'projectId':_0x29216b,'counts':{'agents':_0x3dbf45[_0x417a58(0x14d)],'knowledgeBases':_0x8a2302[_0x417a58(0x14d)],'prompts':_0x51a192['size'],'integrations':_0x3740b3[_0x417a58(0x212)]},'sourceSite':_0x4aaf23};}['loadJsonFile'](_0x1225e0,_0x4d8348){const _0x8fcaf=a133_0xe8af3;if(!a133_0x8c5550[_0x8fcaf(0x229)](_0x1225e0))return _0x4d8348;return JSON['parse'](a133_0x8c5550['readFileSync'](_0x1225e0,_0x8fcaf(0x189)));}[a133_0xe8af3(0x1d0)](_0x2efd2f){const _0x3945d8=a133_0xe8af3;if(!a133_0x8c5550[_0x3945d8(0x229)](_0x2efd2f))throw new SDKError(ErrorCode[_0x3945d8(0x149)],_0x3945d8(0x21b)+_0x2efd2f,undefined,{'helpText':_0x3945d8(0x159)});const _0x38a5fa=a133_0xcf5d58[_0x3945d8(0x1e6)](_0x2efd2f,_0x3945d8(0x155));if(!a133_0x8c5550[_0x3945d8(0x229)](_0x38a5fa))throw new SDKError(ErrorCode[_0x3945d8(0x22e)],'Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20'+_0x2efd2f,undefined,{'helpText':_0x3945d8(0x1e5)});const _0x5745b6=JSON[_0x3945d8(0x240)](a133_0x8c5550['readFileSync'](_0x38a5fa,_0x3945d8(0x189)));if(!isSupportedBackupVersion(_0x5745b6[_0x3945d8(0x190)]))throw new SDKError(ErrorCode[_0x3945d8(0x22e)],_0x3945d8(0x186)+_0x5745b6[_0x3945d8(0x190)],undefined,{'helpText':_0x3945d8(0x255)});return _0x5745b6;}async[a133_0xe8af3(0x258)](_0x53fbda,_0x438e00,_0x3fc515){const _0x196854=a133_0xe8af3,{projectId:_0x522fee,project:_0x9621db}=await this[_0x196854(0x14e)](_0x53fbda),_0x5338c2=_0x9621db[_0x196854(0x222)][_0x196854(0x1c3)];let _0x1f5970;if(_0x438e00)_0x1f5970=_0x438e00;else{const _0x20192b=a133_0xcf5d58[_0x196854(0x1e6)](process[_0x196854(0x15d)](),'agents'),_0x4cf9a6=getSanitizedPathWithMigration(_0x20192b,_0x5338c2);_0x4cf9a6['renamed']&&this[_0x196854(0x157)][_0x196854(0x1ed)]('Renamed\x20folder:\x20'+a133_0xcf5d58['basename'](_0x4cf9a6['oldPath'])+'\x20→\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x4cf9a6['path'])),_0x1f5970=_0x4cf9a6['path'];}const _0x7c53d4=await this['client']['listAgentsFull'](_0x522fee),_0x596646=await this[_0x196854(0x18a)]['listKnowledgeBases'](_0x522fee),_0x5dfb06=await this['client'][_0x196854(0x239)](_0x522fee),_0x5bcfc6=await safeListOrEmpty(()=>this[_0x196854(0x18a)][_0x196854(0x19b)](_0x522fee)),_0x52a214=await safeListOrEmpty(()=>this[_0x196854(0x18a)]['listWebSearchTools'](_0x522fee)),_0x5ebac2=await this[_0x196854(0x18a)][_0x196854(0x21e)](_0x522fee),_0x282a1a=await this[_0x196854(0x18a)][_0x196854(0x1ba)](_0x522fee),_0x242497=await safeListOrEmpty(()=>this[_0x196854(0x18a)][_0x196854(0x1a0)](_0x522fee)),_0x19b5f8=await safeListOrEmpty(()=>this[_0x196854(0x18a)]['listExperimentalArtifacts'](_0x522fee)),_0x2f8851=await safeListOrEmpty(()=>this['client'][_0x196854(0x142)](_0x522fee)),_0x2ad0db=await safeListOrEmpty(()=>this['client']['listChatInterfaces'](_0x522fee)),_0x5cc8a7=_0x282a1a[_0x196854(0x146)](_0x2e7112=>!_0x2e7112['attributes'][_0x196854(0x18b)]&&SAFE_INTEGRATION_TYPES[_0x196854(0x16a)](_0x2e7112[_0x196854(0x222)]['serviceType'][_0x196854(0x153)]())),_0x49ab34=new Map(),_0x2bcb53=new Map(),_0x424139=new Map(),_0x55cd8b=new Map(),_0x194dea=new Map(),_0x52a268=new Map(),_0x11d134=new Map();for(const _0x35e963 of _0x7c53d4){_0x49ab34[_0x196854(0x199)](_0x35e963['id'],_0x35e963[_0x196854(0x222)][_0x196854(0x1c3)]);}for(const _0x5b1d8b of _0x596646){_0x2bcb53[_0x196854(0x199)](_0x5b1d8b['id'],_0x5b1d8b['attributes'][_0x196854(0x1c3)]);}for(const _0x43ec74 of _0x5dfb06){_0x424139[_0x196854(0x199)](_0x43ec74['id'],_0x43ec74[_0x196854(0x222)][_0x196854(0x1c3)]);}for(const _0x37d8bd of _0x5bcfc6){_0x55cd8b['set'](_0x37d8bd['id'],_0x37d8bd[_0x196854(0x222)][_0x196854(0x1c3)]);}for(const _0x41d72 of _0x52a214){_0x194dea[_0x196854(0x199)](_0x41d72['id'],_0x41d72[_0x196854(0x222)][_0x196854(0x1c3)]);}for(const _0x2867b4 of _0x5ebac2){_0x52a268['set'](_0x2867b4['id'],_0x2867b4[_0x196854(0x222)]['name']);}for(const _0x552c23 of _0x242497){_0x11d134[_0x196854(0x199)](_0x552c23['id'],_0x552c23[_0x196854(0x222)][_0x196854(0x1c3)]);}const _0x14d5d5={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x2bcb53,'TextKnowledgeBase':_0x424139,'Agent':_0x49ab34,'WebSearchTool':_0x194dea,'ImageGenerator':_0x55cd8b,'ExperimentalKnowledgeBase':_0x11d134}),'resolvePromptName':async _0xecc55f=>_0x52a268[_0x196854(0x249)](_0xecc55f),'onWarning':_0x3c96ae=>this[_0x196854(0x157)][_0x196854(0x14b)](_0x3c96ae)},_0x25e5dd={'projectName':_0x5338c2,'outputDir':_0x1f5970,'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}}},_0x38a668=[],_0x18832a=[];for(const _0xd9d19 of _0x7c53d4){const _0x487e92=getSanitizedPathWithMigration(_0x1f5970,_0xd9d19[_0x196854(0x222)][_0x196854(0x1c3)]);_0x487e92[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)]('Renamed\x20agent\x20folder:\x20'+a133_0xcf5d58['basename'](_0x487e92[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58['basename'](_0x487e92[_0x196854(0x25d)]));const _0x47e94b=_0x487e92['path'],_0x54dec1=a133_0xcf5d58[_0x196854(0x1e6)](_0x47e94b,'prompt.md'),_0x195b7f=a133_0xcf5d58[_0x196854(0x1e6)](_0x47e94b,'agent.yml'),_0x3c0099=a133_0xcf5d58[_0x196854(0x1e6)](_0x47e94b,_0x196854(0x1fd)),{yaml:_0x454df0,systemPrompt:_0x3c4122,starterMessage:_0x5a32f4}=await agentResponseToDef(_0xd9d19,_0x14d5d5),_0x399c1d=toAgentYamlString(_0x454df0),_0x5be526=!a133_0x8c5550[_0x196854(0x229)](_0x195b7f);let _0x533ac8=_0x5be526,_0x55054b;if(!_0x5be526){const _0x29b56b=a133_0x8c5550[_0x196854(0x229)](_0x54dec1)?a133_0x8c5550[_0x196854(0x1b1)](_0x54dec1,'utf-8'):'',_0x11c0f8=a133_0x8c5550['readFileSync'](_0x195b7f,_0x196854(0x189)),_0x36e5e0='#\x20prompt.md\x0a'+_0x29b56b+_0x196854(0x1e0)+_0x11c0f8,_0x2513af=_0x196854(0x18d)+_0x3c4122+_0x196854(0x1e0)+_0x399c1d,_0x3052ae=generateDiff(_0x36e5e0,_0x2513af);_0x533ac8=hasChanges(_0x3052ae),_0x533ac8&&(_0x55054b=formatDiffWithColors(_0x3052ae));}_0x38a668[_0x196854(0x1da)]({'path':_0x47e94b,'content':'','isDir':!![]}),_0x38a668[_0x196854(0x1da)]({'path':_0x54dec1,'content':_0x3c4122}),_0x38a668[_0x196854(0x1da)]({'path':_0x195b7f,'content':_0x399c1d});_0x5a32f4&&_0x5a32f4[_0x196854(0x16a)]('\x0a')&&_0x38a668[_0x196854(0x1da)]({'path':_0x3c0099,'content':_0x5a32f4});_0x25e5dd[_0x196854(0x1e7)]['push']({'agentName':_0xd9d19[_0x196854(0x222)]['name'],'outputPath':_0x47e94b,'isNew':_0x5be526,'hasChanges':_0x533ac8,'diff':_0x55054b}),_0x25e5dd['counts']['agents'][_0x196854(0x1ea)]++;if(_0x5be526)_0x25e5dd['counts'][_0x196854(0x1e7)]['new']++;else{if(_0x533ac8)_0x25e5dd['counts']['agents'][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)]['agents'][_0x196854(0x1ff)]++;}}for(const _0x439210 of _0x596646){if(_0x439210[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x47cc09=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x1f5970),_0x439210[_0x196854(0x222)][_0x196854(0x1c3)],_0x196854(0x218));_0x47cc09[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)]('Renamed\x20KB\x20file:\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x47cc09[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58['basename'](_0x47cc09[_0x196854(0x25d)]));const _0x44cc57=_0x47cc09['path'],_0x48e1a2=apiKnowledgeBaseToYaml(_0x439210),_0x9ba083=toKnowledgeBaseYamlString(_0x48e1a2),_0x16d41d=!a133_0x8c5550[_0x196854(0x229)](_0x44cc57);let _0xa6b42f=_0x16d41d,_0x23be03;if(!_0x16d41d){const _0xd66e0=a133_0x8c5550['readFileSync'](_0x44cc57,_0x196854(0x189)),_0x219aed=generateDiff(_0xd66e0,_0x9ba083);_0xa6b42f=hasChanges(_0x219aed),_0xa6b42f&&(_0x23be03=formatDiffWithColors(_0x219aed));}_0x38a668['push']({'path':_0x44cc57,'content':_0x9ba083}),_0x25e5dd[_0x196854(0x252)][_0x196854(0x1da)]({'name':_0x439210[_0x196854(0x222)][_0x196854(0x1c3)],'outputPath':_0x44cc57,'isNew':_0x16d41d,'hasChanges':_0xa6b42f,'diff':_0x23be03}),_0x25e5dd['counts'][_0x196854(0x252)]['total']++;if(_0x16d41d)_0x25e5dd[_0x196854(0x207)][_0x196854(0x252)][_0x196854(0x1f6)]++;else{if(_0xa6b42f)_0x25e5dd[_0x196854(0x207)][_0x196854(0x252)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)]['knowledgeBases'][_0x196854(0x1ff)]++;}}for(const _0x4357c7 of _0x5dfb06){if(_0x4357c7[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x13a371=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x1f5970),_0x4357c7[_0x196854(0x222)][_0x196854(0x1c3)],_0x196854(0x1fb));_0x13a371[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)]('Renamed\x20text\x20KB\x20file:\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x13a371[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58[_0x196854(0x1c8)](_0x13a371[_0x196854(0x25d)]));const _0xafa196=_0x13a371['path'],_0x18ecd9=toTextKnowledgeBaseMd(_0x4357c7['attributes'][_0x196854(0x1c3)],_0x4357c7[_0x196854(0x222)][_0x196854(0x248)]),_0x52ef99=!a133_0x8c5550[_0x196854(0x229)](_0xafa196);let _0x356da8=_0x52ef99,_0x21beb6;if(!_0x52ef99){const _0x11edc3=a133_0x8c5550[_0x196854(0x1b1)](_0xafa196,_0x196854(0x189)),_0x22b584=generateDiff(_0x11edc3,_0x18ecd9);_0x356da8=hasChanges(_0x22b584),_0x356da8&&(_0x21beb6=formatDiffWithColors(_0x22b584));}_0x38a668[_0x196854(0x1da)]({'path':_0xafa196,'content':_0x18ecd9}),_0x25e5dd[_0x196854(0x1a9)][_0x196854(0x1da)]({'name':_0x4357c7['attributes'][_0x196854(0x1c3)],'outputPath':_0xafa196,'isNew':_0x52ef99,'hasChanges':_0x356da8,'diff':_0x21beb6}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x1a9)][_0x196854(0x1ea)]++;if(_0x52ef99)_0x25e5dd[_0x196854(0x207)][_0x196854(0x1a9)]['new']++;else{if(_0x356da8)_0x25e5dd['counts']['textKnowledgeBases'][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)][_0x196854(0x1a9)][_0x196854(0x1ff)]++;}}for(const _0x410a75 of _0x5ebac2){if(_0x410a75[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x447688=getSanitizedPathWithMigration(getPromptsDir(_0x1f5970),_0x410a75[_0x196854(0x222)]['name'],_0x196854(0x218));_0x447688['renamed']&&this[_0x196854(0x157)][_0x196854(0x1ed)](_0x196854(0x184)+a133_0xcf5d58[_0x196854(0x1c8)](_0x447688['oldPath'])+_0x196854(0x1e3)+a133_0xcf5d58['basename'](_0x447688[_0x196854(0x25d)]));const _0x14151a=_0x447688['path'],_0xbc0aa0=await apiPromptToYaml(_0x410a75,_0x14d5d5);if(!_0xbc0aa0)continue;const _0x35c1ea=toPromptYamlString(_0xbc0aa0),_0x6c8e8f=!a133_0x8c5550[_0x196854(0x229)](_0x14151a);let _0x3c8d69=_0x6c8e8f,_0x15deab;if(!_0x6c8e8f){const _0x1d9f40=a133_0x8c5550[_0x196854(0x1b1)](_0x14151a,'utf-8'),_0x5b34c5=generateDiff(_0x1d9f40,_0x35c1ea);_0x3c8d69=hasChanges(_0x5b34c5),_0x3c8d69&&(_0x15deab=formatDiffWithColors(_0x5b34c5));}_0x38a668['push']({'path':_0x14151a,'content':_0x35c1ea}),_0x25e5dd['prompts'][_0x196854(0x1da)]({'name':_0x410a75[_0x196854(0x222)][_0x196854(0x1c3)],'outputPath':_0x14151a,'isNew':_0x6c8e8f,'hasChanges':_0x3c8d69,'diff':_0x15deab}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x236)][_0x196854(0x1ea)]++;if(_0x6c8e8f)_0x25e5dd['counts']['prompts']['new']++;else{if(_0x3c8d69)_0x25e5dd[_0x196854(0x207)][_0x196854(0x236)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)]['prompts'][_0x196854(0x1ff)]++;}}for(const _0x30a5c4 of _0x5cc8a7){const _0x5b7bd9=_0x30a5c4[_0x196854(0x222)][_0x196854(0x254)][_0x196854(0x153)](),_0x40928e=getSanitizedPathWithMigration(getIntegrationsDir(_0x1f5970),_0x5b7bd9,_0x196854(0x218));_0x40928e['renamed']&&this[_0x196854(0x157)]['info']('Renamed\x20integration\x20file:\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x40928e[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58[_0x196854(0x1c8)](_0x40928e[_0x196854(0x25d)]));const _0x11d526=_0x40928e['path'],_0x3cfd46=await apiIntegrationToYaml(_0x30a5c4,_0x14d5d5),_0xedef54=toIntegrationYamlString(_0x3cfd46),_0x276093=!a133_0x8c5550[_0x196854(0x229)](_0x11d526);let _0x1fe2ec=_0x276093,_0x5df350;if(!_0x276093){const _0x3193f2=a133_0x8c5550[_0x196854(0x1b1)](_0x11d526,_0x196854(0x189)),_0x4aea39=generateDiff(_0x3193f2,_0xedef54);_0x1fe2ec=hasChanges(_0x4aea39),_0x1fe2ec&&(_0x5df350=formatDiffWithColors(_0x4aea39));}_0x38a668['push']({'path':_0x11d526,'content':_0xedef54}),_0x25e5dd[_0x196854(0x25a)]['push']({'name':_0x5b7bd9,'outputPath':_0x11d526,'isNew':_0x276093,'hasChanges':_0x1fe2ec,'diff':_0x5df350}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x25a)]['total']++;if(_0x276093)_0x25e5dd[_0x196854(0x207)][_0x196854(0x25a)][_0x196854(0x1f6)]++;else{if(_0x1fe2ec)_0x25e5dd[_0x196854(0x207)][_0x196854(0x25a)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)][_0x196854(0x25a)][_0x196854(0x1ff)]++;}}for(const _0x48efc9 of _0x242497){if(_0x48efc9[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x4f3eed=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x1f5970),_0x48efc9[_0x196854(0x222)][_0x196854(0x1c3)]);_0x4f3eed[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)]('Renamed\x20experimental\x20KB\x20directory:\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x4f3eed[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58[_0x196854(0x1c8)](_0x4f3eed['path']));const _0x50cf1c=_0x4f3eed[_0x196854(0x25d)],_0x16ca9d=a133_0xcf5d58[_0x196854(0x1e6)](_0x50cf1c,sanitizeForFilesystem(_0x48efc9[_0x196854(0x222)]['name'])+_0x196854(0x218)),_0x11bcec=a133_0xcf5d58['join'](_0x50cf1c,_0x196854(0x1b8)),_0xfc0eeb=apiExperimentalKnowledgeBaseToYaml(_0x48efc9),_0x5128d1=toExperimentalKnowledgeBaseYamlString(_0xfc0eeb),_0xb778bd=!a133_0x8c5550['existsSync'](_0x50cf1c);let _0x354a2c=_0xb778bd,_0x3a5787,_0x5c153a=_0x5128d1;const _0x5a0a58=[..._0xfc0eeb[_0x196854(0x1b8)]][_0x196854(0x23a)]((_0x45a9df,_0x1e918b)=>_0x45a9df['name'][_0x196854(0x1f5)](_0x1e918b['name']));for(const _0x56c77c of _0x5a0a58){_0x5c153a+=_0x196854(0x16c)+_0x56c77c['name']+'\x20---\x0a'+_0x56c77c['code']+_0x196854(0x147)+_0x56c77c['name']+'\x20---\x0a'+_0x56c77c[_0x196854(0x20e)]+'\x0a';}if(!_0xb778bd){let _0x2f2b50='';a133_0x8c5550[_0x196854(0x229)](_0x16ca9d)&&(_0x2f2b50=a133_0x8c5550['readFileSync'](_0x16ca9d,'utf-8'));if(a133_0x8c5550[_0x196854(0x229)](_0x11bcec)){const _0x4ae141=a133_0x8c5550[_0x196854(0x1ee)](_0x11bcec,{'withFileTypes':!![]}),_0x163307=_0x4ae141[_0x196854(0x146)](_0x574ce2=>_0x574ce2[_0x196854(0x24c)]())[_0x196854(0x23a)]((_0x3f679b,_0x4162d2)=>_0x3f679b[_0x196854(0x1c3)][_0x196854(0x1f5)](_0x4162d2[_0x196854(0x1c3)]));for(const _0x4d87e3 of _0x163307){const _0x22620e=a133_0xcf5d58[_0x196854(0x1e6)](_0x11bcec,_0x4d87e3[_0x196854(0x1c3)],'code.js'),_0x526d89=a133_0xcf5d58[_0x196854(0x1e6)](_0x11bcec,_0x4d87e3['name'],_0x196854(0x145));a133_0x8c5550[_0x196854(0x229)](_0x22620e)&&(_0x2f2b50+=_0x196854(0x16c)+_0x4d87e3[_0x196854(0x1c3)]+_0x196854(0x1b5)+a133_0x8c5550['readFileSync'](_0x22620e,'utf-8')+'\x0a'),a133_0x8c5550[_0x196854(0x229)](_0x526d89)&&(_0x2f2b50+=_0x196854(0x16b)+_0x4d87e3[_0x196854(0x1c3)]+'\x20---\x0a'+a133_0x8c5550['readFileSync'](_0x526d89,_0x196854(0x189))+'\x0a');}}const _0xe9dc14=generateDiff(_0x2f2b50,_0x5c153a);_0x354a2c=hasChanges(_0xe9dc14),_0x354a2c&&(_0x3a5787=formatDiffWithColors(_0xe9dc14));}_0x38a668[_0x196854(0x1da)]({'path':_0x50cf1c,'content':'','isDir':!![]}),_0x38a668['push']({'path':_0x16ca9d,'content':_0x5128d1}),_0x38a668[_0x196854(0x1da)]({'path':_0x11bcec,'content':'','isDir':!![]});for(const _0x4bf828 of _0xfc0eeb['functions']){const _0x2e3a59=a133_0xcf5d58[_0x196854(0x1e6)](_0x11bcec,sanitizeForFilesystem(_0x4bf828[_0x196854(0x1c3)])),_0x19d9d2=a133_0xcf5d58[_0x196854(0x1e6)](_0x2e3a59,_0x196854(0x20a)),_0x376f92=a133_0xcf5d58[_0x196854(0x1e6)](_0x2e3a59,_0x196854(0x145));_0x38a668[_0x196854(0x1da)]({'path':_0x2e3a59,'content':'','isDir':!![]}),_0x38a668[_0x196854(0x1da)]({'path':_0x19d9d2,'content':_0x4bf828[_0x196854(0x225)]}),_0x38a668[_0x196854(0x1da)]({'path':_0x376f92,'content':_0x4bf828['json_schema']});}if(a133_0x8c5550['existsSync'](_0x11bcec)){const _0x20c807=a133_0x8c5550[_0x196854(0x1ee)](_0x11bcec,{'withFileTypes':!![]}),_0x3aeba1=new Set(_0xfc0eeb['functions'][_0x196854(0x150)](_0x1e58a8=>sanitizeForFilesystem(_0x1e58a8[_0x196854(0x1c3)])));for(const _0x17ec98 of _0x20c807){if(_0x17ec98[_0x196854(0x24c)]()&&!_0x3aeba1[_0x196854(0x204)](_0x17ec98[_0x196854(0x1c3)])){const _0x17f839=a133_0xcf5d58['join'](_0x11bcec,_0x17ec98[_0x196854(0x1c3)]);_0x18832a[_0x196854(0x1da)]({'path':_0x17f839,'isDir':!![]});}}}_0x25e5dd[_0x196854(0x217)][_0x196854(0x1da)]({'name':_0x48efc9[_0x196854(0x222)][_0x196854(0x1c3)],'outputPath':_0x50cf1c,'isNew':_0xb778bd,'hasChanges':_0x354a2c,'diff':_0x3a5787}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x217)][_0x196854(0x1ea)]++;if(_0xb778bd)_0x25e5dd[_0x196854(0x207)][_0x196854(0x217)][_0x196854(0x1f6)]++;else{if(_0x354a2c)_0x25e5dd[_0x196854(0x207)][_0x196854(0x217)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)][_0x196854(0x217)][_0x196854(0x1ff)]++;}}for(const _0x4212fc of _0x19b5f8){if(_0x4212fc[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x9fdadc=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x1f5970),_0x4212fc[_0x196854(0x222)]['name']);_0x9fdadc['renamed']&&this['logger'][_0x196854(0x1ed)](_0x196854(0x169)+a133_0xcf5d58['basename'](_0x9fdadc[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58[_0x196854(0x1c8)](_0x9fdadc[_0x196854(0x25d)]));const _0x1f67ae=_0x9fdadc['path'],_0x34175c=a133_0xcf5d58[_0x196854(0x1e6)](_0x1f67ae,sanitizeForFilesystem(_0x4212fc[_0x196854(0x222)][_0x196854(0x1c3)])+_0x196854(0x218)),_0x1c3c3e=a133_0xcf5d58[_0x196854(0x1e6)](_0x1f67ae,'code.js'),_0x5c97e5=a133_0xcf5d58[_0x196854(0x1e6)](_0x1f67ae,_0x196854(0x1d1)),_0x48a468=apiExperimentalArtifactToYaml(_0x4212fc),_0x380e48=toExperimentalArtifactYamlString(_0x48a468),_0x130f16=!a133_0x8c5550[_0x196854(0x229)](_0x1f67ae);let _0x57530f=_0x130f16,_0x23fd40,_0x5b8bda=_0x380e48+('\x0a---\x20code\x20---\x0a'+_0x48a468['code']+'\x0a');const _0x56ce45=[..._0x48a468[_0x196854(0x1d1)]][_0x196854(0x23a)]((_0x216617,_0x3b88e1)=>_0x216617[_0x196854(0x1c7)][_0x196854(0x1f5)](_0x3b88e1[_0x196854(0x1c7)]));for(const _0x1c5ca7 of _0x56ce45){_0x5b8bda+=_0x196854(0x151)+_0x1c5ca7[_0x196854(0x1c7)]+'\x20---\x0a'+_0x1c5ca7['text_content']+'\x0a';}if(!_0x130f16){let _0x299a43='';a133_0x8c5550['existsSync'](_0x34175c)&&(_0x299a43=a133_0x8c5550[_0x196854(0x1b1)](_0x34175c,'utf-8'));a133_0x8c5550[_0x196854(0x229)](_0x1c3c3e)&&(_0x299a43+=_0x196854(0x245)+a133_0x8c5550['readFileSync'](_0x1c3c3e,_0x196854(0x189))+'\x0a');if(a133_0x8c5550[_0x196854(0x229)](_0x5c97e5)){const _0x204a66=a133_0x8c5550[_0x196854(0x1ee)](_0x5c97e5),_0x12288e=_0x204a66[_0x196854(0x146)](_0x4dd730=>{const _0x373cbc=_0x196854,_0x3205ff=a133_0xcf5d58[_0x373cbc(0x1e6)](_0x5c97e5,_0x4dd730);return a133_0x8c5550[_0x373cbc(0x1dd)](_0x3205ff)[_0x373cbc(0x166)]();})[_0x196854(0x23a)]((_0x4ca103,_0x358518)=>_0x4ca103[_0x196854(0x1f5)](_0x358518));for(const _0x5bec9e of _0x12288e){const _0x158016=a133_0xcf5d58[_0x196854(0x1e6)](_0x5c97e5,_0x5bec9e);_0x299a43+=_0x196854(0x151)+_0x5bec9e+_0x196854(0x1b5)+a133_0x8c5550[_0x196854(0x1b1)](_0x158016,_0x196854(0x189))+'\x0a';}}const _0x512723=generateDiff(_0x299a43,_0x5b8bda);_0x57530f=hasChanges(_0x512723),_0x57530f&&(_0x23fd40=formatDiffWithColors(_0x512723));}_0x38a668[_0x196854(0x1da)]({'path':_0x1f67ae,'content':'','isDir':!![]}),_0x38a668[_0x196854(0x1da)]({'path':_0x34175c,'content':_0x380e48}),_0x38a668[_0x196854(0x1da)]({'path':_0x1c3c3e,'content':_0x48a468[_0x196854(0x225)]});if(_0x48a468[_0x196854(0x1d1)][_0x196854(0x212)]>0x0){_0x38a668[_0x196854(0x1da)]({'path':_0x5c97e5,'content':'','isDir':!![]});for(const _0x4a1e48 of _0x48a468[_0x196854(0x1d1)]){const _0x4ea1a4=a133_0xcf5d58[_0x196854(0x1e6)](_0x5c97e5,_0x4a1e48[_0x196854(0x1c7)]);_0x38a668[_0x196854(0x1da)]({'path':_0x4ea1a4,'content':_0x4a1e48[_0x196854(0x208)]});}}if(a133_0x8c5550[_0x196854(0x229)](_0x5c97e5)){const _0x2d46ce=a133_0x8c5550[_0x196854(0x1ee)](_0x5c97e5),_0x1cda98=new Set(_0x48a468[_0x196854(0x1d1)][_0x196854(0x150)](_0x2e0674=>_0x2e0674['file_name']));for(const _0x539f84 of _0x2d46ce){const _0x3ff999=a133_0xcf5d58['join'](_0x5c97e5,_0x539f84);a133_0x8c5550[_0x196854(0x1dd)](_0x3ff999)['isFile']()&&!_0x1cda98['has'](_0x539f84)&&_0x18832a['push']({'path':_0x3ff999});}}_0x25e5dd[_0x196854(0x1b3)][_0x196854(0x1da)]({'name':_0x4212fc['attributes'][_0x196854(0x1c3)],'outputPath':_0x1f67ae,'isNew':_0x130f16,'hasChanges':_0x57530f,'diff':_0x23fd40}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x1b3)]['total']++;if(_0x130f16)_0x25e5dd['counts'][_0x196854(0x1b3)]['new']++;else{if(_0x57530f)_0x25e5dd[_0x196854(0x207)][_0x196854(0x1b3)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)][_0x196854(0x1b3)][_0x196854(0x1ff)]++;}}for(const _0x4194c9 of _0x2f8851){const _0x40ca1d=getSanitizedPathWithMigration(getFormInterfacesDir(_0x1f5970),_0x4194c9[_0x196854(0x222)][_0x196854(0x1c3)],_0x196854(0x218));_0x40ca1d[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)](_0x196854(0x19d)+a133_0xcf5d58[_0x196854(0x1c8)](_0x40ca1d[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58['basename'](_0x40ca1d[_0x196854(0x25d)]));const _0x568ed7=_0x40ca1d[_0x196854(0x25d)],_0x55be96=await apiFormInterfaceToYaml(_0x4194c9,_0x14d5d5),_0x382fcf=toFormInterfaceYamlString(_0x55be96),_0x482a16=!a133_0x8c5550[_0x196854(0x229)](_0x568ed7);let _0x39c4fd=_0x482a16,_0x4ee646;if(!_0x482a16){const _0x4a42e4=a133_0x8c5550[_0x196854(0x1b1)](_0x568ed7,_0x196854(0x189)),_0x17f3cd=generateDiff(_0x4a42e4,_0x382fcf);_0x39c4fd=hasChanges(_0x17f3cd),_0x39c4fd&&(_0x4ee646=formatDiffWithColors(_0x17f3cd));}_0x38a668[_0x196854(0x1da)]({'path':_0x568ed7,'content':_0x382fcf}),_0x25e5dd[_0x196854(0x178)][_0x196854(0x1da)]({'name':_0x4194c9['attributes'][_0x196854(0x1c3)],'outputPath':_0x568ed7,'isNew':_0x482a16,'hasChanges':_0x39c4fd,'diff':_0x4ee646}),_0x25e5dd[_0x196854(0x207)]['formInterfaces'][_0x196854(0x1ea)]++;if(_0x482a16)_0x25e5dd[_0x196854(0x207)][_0x196854(0x178)][_0x196854(0x1f6)]++;else{if(_0x39c4fd)_0x25e5dd[_0x196854(0x207)][_0x196854(0x178)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)][_0x196854(0x178)][_0x196854(0x1ff)]++;}}for(const _0x2338ae of _0x2ad0db){if(_0x2338ae[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x1eca7f=getSanitizedPathWithMigration(getChatInterfacesDir(_0x1f5970),_0x2338ae['attributes'][_0x196854(0x1c3)],_0x196854(0x218));_0x1eca7f[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)](_0x196854(0x165)+a133_0xcf5d58[_0x196854(0x1c8)](_0x1eca7f[_0x196854(0x251)])+'\x20→\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x1eca7f[_0x196854(0x25d)]));const _0x40af0c=_0x1eca7f[_0x196854(0x25d)],_0x619084=await apiChatInterfaceToYaml(_0x2338ae,_0x14d5d5),_0x4ce3d0=toChatInterfaceYamlString(_0x619084),_0x2148c6=!a133_0x8c5550[_0x196854(0x229)](_0x40af0c);let _0x538b62=_0x2148c6,_0x2d932a;if(!_0x2148c6){const _0x146d28=a133_0x8c5550[_0x196854(0x1b1)](_0x40af0c,'utf-8'),_0x58b91c=generateDiff(_0x146d28,_0x4ce3d0);_0x538b62=hasChanges(_0x58b91c),_0x538b62&&(_0x2d932a=formatDiffWithColors(_0x58b91c));}_0x38a668['push']({'path':_0x40af0c,'content':_0x4ce3d0}),_0x25e5dd[_0x196854(0x247)][_0x196854(0x1da)]({'name':_0x2338ae[_0x196854(0x222)][_0x196854(0x1c3)],'outputPath':_0x40af0c,'isNew':_0x2148c6,'hasChanges':_0x538b62,'diff':_0x2d932a}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x247)][_0x196854(0x1ea)]++;if(_0x2148c6)_0x25e5dd[_0x196854(0x207)]['chatInterfaces'][_0x196854(0x1f6)]++;else{if(_0x538b62)_0x25e5dd[_0x196854(0x207)][_0x196854(0x247)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)]['chatInterfaces'][_0x196854(0x1ff)]++;}}if(_0x3fc515?.[_0x196854(0x234)])return _0x25e5dd;a133_0x8c5550[_0x196854(0x1e4)](_0x1f5970,{'recursive':!![]}),a133_0x8c5550['mkdirSync'](getKnowledgeBasesDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550[_0x196854(0x1e4)](getPromptsDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550[_0x196854(0x1e4)](getIntegrationsDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550[_0x196854(0x1e4)](getExperimentalKnowledgeBasesDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550['mkdirSync'](getExperimentalArtifactsDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550[_0x196854(0x1e4)](getFormInterfacesDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550[_0x196854(0x1e4)](getChatInterfacesDir(_0x1f5970),{'recursive':!![]});const _0x186bb9=a133_0xcf5d58['join'](_0x1f5970,_0x196854(0x243));a133_0x8c5550[_0x196854(0x22f)](_0x186bb9,createAgentConfigContent(_0x5338c2));for(const _0x46bd0d of _0x38a668){if(_0x46bd0d['isDir'])a133_0x8c5550[_0x196854(0x1e4)](_0x46bd0d[_0x196854(0x25d)],{'recursive':!![]});else{const _0x3d0d29=a133_0xcf5d58[_0x196854(0x24d)](_0x46bd0d[_0x196854(0x25d)]);!a133_0x8c5550[_0x196854(0x229)](_0x3d0d29)&&a133_0x8c5550[_0x196854(0x1e4)](_0x3d0d29,{'recursive':!![]}),a133_0x8c5550[_0x196854(0x22f)](_0x46bd0d[_0x196854(0x25d)],_0x46bd0d[_0x196854(0x1ab)]);}}for(const _0x55d736 of _0x18832a){_0x55d736[_0x196854(0x173)]?(a133_0x8c5550[_0x196854(0x152)](_0x55d736[_0x196854(0x25d)],{'recursive':!![],'force':!![]}),this[_0x196854(0x157)]['info'](_0x196854(0x244)+a133_0xcf5d58[_0x196854(0x1c8)](a133_0xcf5d58[_0x196854(0x24d)](_0x55d736['path']))+'/'+a133_0xcf5d58[_0x196854(0x1c8)](_0x55d736[_0x196854(0x25d)]))):(a133_0x8c5550[_0x196854(0x152)](_0x55d736[_0x196854(0x25d)],{'force':!![]}),this['logger'][_0x196854(0x1ed)](_0x196854(0x168)+a133_0xcf5d58['basename'](a133_0xcf5d58['dirname'](_0x55d736[_0x196854(0x25d)]))+'/'+a133_0xcf5d58[_0x196854(0x1c8)](_0x55d736[_0x196854(0x25d)])));}return _0x25e5dd;}async[a133_0xe8af3(0x194)](_0x11347e,_0x4407a8){const _0x48fc7b=a133_0xe8af3,_0x39c7fc=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x11347e,'tdx.json');if(!a133_0x8c5550[_0x48fc7b(0x229)](_0x39c7fc))throw new SDKError(ErrorCode[_0x48fc7b(0x22e)],_0x48fc7b(0x1ca)+_0x11347e,undefined,{'helpText':_0x48fc7b(0x1a3)});const _0x563cd8=loadAgentConfig(_0x39c7fc),_0x23e555=await this[_0x48fc7b(0x1c5)](_0x563cd8[_0x48fc7b(0x181)]),_0x3517e0=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x1d4)](_0x23e555),_0x9db351=_0x3517e0['attributes']['name'],_0x3b18f5={'projectName':_0x9db351,'projectId':_0x23e555,'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}}},_0xf8fab8=[],_0x269704=[],_0x5bf5de=[],_0x262d1a=[],_0x3cf0ae=[],_0x66f9a5=[],_0x1ec36e=a133_0x8c5550['readdirSync'](_0x11347e,{'withFileTypes':!![]});for(const _0x5256b3 of _0x1ec36e){if(!_0x5256b3[_0x48fc7b(0x24c)]())continue;if([_0x48fc7b(0x21f),_0x48fc7b(0x236),_0x48fc7b(0x25a),_0x48fc7b(0x196),_0x48fc7b(0x175),_0x48fc7b(0x174),'chat_interfaces'][_0x48fc7b(0x16a)](_0x5256b3[_0x48fc7b(0x1c3)]))continue;const _0x161ad5=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x11347e,_0x5256b3[_0x48fc7b(0x1c3)]);if(isAgentDir(_0x161ad5)){const _0x2625b1=a133_0xcf5d58['join'](_0x161ad5,_0x48fc7b(0x198)),_0x3fc129=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x161ad5,_0x48fc7b(0x1d5)),_0x30506c=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x161ad5,'starter_message.md'),_0x236316=parseAgentYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x2625b1,_0x48fc7b(0x189)),_0x2625b1),_0xd4086a=a133_0x8c5550[_0x48fc7b(0x229)](_0x3fc129)?a133_0x8c5550[_0x48fc7b(0x1b1)](_0x3fc129,_0x48fc7b(0x189)):'',_0x2a8507=a133_0x8c5550[_0x48fc7b(0x229)](_0x30506c)?a133_0x8c5550[_0x48fc7b(0x1b1)](_0x30506c,_0x48fc7b(0x189)):_0x236316[_0x48fc7b(0x15b)];_0xf8fab8[_0x48fc7b(0x1da)]({'name':_0x236316[_0x48fc7b(0x1c3)],'dir':_0x161ad5,'yaml':_0x236316,'systemPrompt':_0xd4086a,'starterMessage':_0x2a8507});}}const _0x106325=getKnowledgeBasesDir(_0x11347e);if(a133_0x8c5550[_0x48fc7b(0x229)](_0x106325)){const _0x58e12e=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x106325);for(const _0x305738 of _0x58e12e){const _0x325345=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x106325,_0x305738);if(_0x305738[_0x48fc7b(0x1b9)](_0x48fc7b(0x218))){const _0x1b1116=parseKnowledgeBaseYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x325345,'utf-8'),_0x325345);_0x269704[_0x48fc7b(0x1da)]({'name':_0x1b1116[_0x48fc7b(0x1c3)],'path':_0x325345,'yaml':_0x1b1116});}else{if(_0x305738[_0x48fc7b(0x1b9)](_0x48fc7b(0x1fb))){const _0x4ab55e=a133_0x8c5550['readFileSync'](_0x325345,_0x48fc7b(0x189)),{name:_0x191634,text:_0x5b2c7d}=parseTextKnowledgeBaseMd(_0x4ab55e,_0x305738);_0x5bf5de[_0x48fc7b(0x1da)]({'name':_0x191634,'path':_0x325345,'text':_0x5b2c7d});}}}}const _0x1f5e99=getPromptsDir(_0x11347e);if(a133_0x8c5550['existsSync'](_0x1f5e99)){const _0x442758=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x1f5e99)[_0x48fc7b(0x146)](_0x2a22e7=>_0x2a22e7[_0x48fc7b(0x1b9)](_0x48fc7b(0x218)));for(const _0x13b902 of _0x442758){const _0x235849=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x1f5e99,_0x13b902),_0x27ada3=parsePromptYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x235849,_0x48fc7b(0x189)),_0x235849);_0x262d1a[_0x48fc7b(0x1da)]({'name':_0x27ada3[_0x48fc7b(0x1c3)],'path':_0x235849,'yaml':_0x27ada3});}}const _0x2d98be=[],_0xaa282a=getIntegrationsDir(_0x11347e);if(a133_0x8c5550[_0x48fc7b(0x229)](_0xaa282a)){const _0x4de8c5=a133_0x8c5550[_0x48fc7b(0x1ee)](_0xaa282a)[_0x48fc7b(0x146)](_0x1c6b83=>_0x1c6b83[_0x48fc7b(0x1b9)](_0x48fc7b(0x218)));for(const _0x409768 of _0x4de8c5){const _0x207233=a133_0xcf5d58['join'](_0xaa282a,_0x409768),_0x4aa949=parseIntegrationYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x207233,_0x48fc7b(0x189)),_0x207233);if(!SAFE_INTEGRATION_TYPES[_0x48fc7b(0x16a)](_0x4aa949[_0x48fc7b(0x21d)][_0x48fc7b(0x153)]())){this[_0x48fc7b(0x157)][_0x48fc7b(0x14b)](_0x48fc7b(0x14c)+_0x4aa949[_0x48fc7b(0x1c3)]+_0x48fc7b(0x227)+_0x4aa949['service_type']+_0x48fc7b(0x1ad)+(_0x48fc7b(0x176)+SAFE_INTEGRATION_TYPES[_0x48fc7b(0x1e6)](',\x20')+_0x48fc7b(0x18c))+_0x48fc7b(0x19e));continue;}_0x2d98be[_0x48fc7b(0x1da)]({'name':_0x4aa949['name'],'path':_0x207233,'yaml':_0x4aa949});}}const _0x21af66=getExperimentalKnowledgeBasesDir(_0x11347e);if(a133_0x8c5550[_0x48fc7b(0x229)](_0x21af66)){const _0x50e781=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x21af66,{'withFileTypes':!![]});for(const _0x1724d7 of _0x50e781){if(!_0x1724d7[_0x48fc7b(0x24c)]())continue;const _0x211166=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x21af66,_0x1724d7[_0x48fc7b(0x1c3)]),_0x521f46=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x211166,_0x1724d7[_0x48fc7b(0x1c3)]+'.yml'),_0x2a94bb=a133_0xcf5d58['join'](_0x211166,_0x48fc7b(0x1b8));if(!a133_0x8c5550['existsSync'](_0x521f46))continue;const _0x4ab0a4=parseExperimentalKnowledgeBaseYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x521f46,'utf-8'),_0x521f46),_0x1abd2d=[];if(a133_0x8c5550['existsSync'](_0x2a94bb)){const _0x25d102=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x2a94bb,{'withFileTypes':!![]});for(const _0x2f07ee of _0x25d102){if(!_0x2f07ee['isDirectory']())continue;const _0x167746=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x2a94bb,_0x2f07ee[_0x48fc7b(0x1c3)]),_0x3ef05a=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x167746,'code.js'),_0x3bd766=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x167746,_0x48fc7b(0x145));a133_0x8c5550['existsSync'](_0x3ef05a)&&a133_0x8c5550[_0x48fc7b(0x229)](_0x3bd766)&&_0x1abd2d['push']({'name':_0x2f07ee[_0x48fc7b(0x1c3)],'code':a133_0x8c5550[_0x48fc7b(0x1b1)](_0x3ef05a,'utf-8'),'json_schema':a133_0x8c5550[_0x48fc7b(0x1b1)](_0x3bd766,_0x48fc7b(0x189))});}}const _0x3d6f99={..._0x4ab0a4,'variables':_0x4ab0a4[_0x48fc7b(0x1cd)]||[],'functions':_0x1abd2d};_0x3cf0ae[_0x48fc7b(0x1da)]({'name':_0x4ab0a4[_0x48fc7b(0x1c3)],'dir':_0x211166,'def':_0x3d6f99});}}const _0x43d9a9=getExperimentalArtifactsDir(_0x11347e);if(a133_0x8c5550[_0x48fc7b(0x229)](_0x43d9a9)){const _0x533853=a133_0x8c5550['readdirSync'](_0x43d9a9,{'withFileTypes':!![]});for(const _0x604938 of _0x533853){if(!_0x604938['isDirectory']())continue;const _0x19ed67=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x43d9a9,_0x604938[_0x48fc7b(0x1c3)]),_0xd3345a=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x19ed67,_0x604938[_0x48fc7b(0x1c3)]+_0x48fc7b(0x218)),_0x1b1387=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x19ed67,_0x48fc7b(0x20a)),_0x3be67b=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x19ed67,_0x48fc7b(0x1d1));if(!a133_0x8c5550[_0x48fc7b(0x229)](_0xd3345a)||!a133_0x8c5550[_0x48fc7b(0x229)](_0x1b1387))continue;const _0x1899d1=parseExperimentalArtifactYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0xd3345a,_0x48fc7b(0x189)),_0xd3345a),_0x1faf55=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x1b1387,'utf-8'),_0x427d72=[];if(a133_0x8c5550[_0x48fc7b(0x229)](_0x3be67b)){const _0xf10d50=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x3be67b);for(const _0x129674 of _0xf10d50){const _0x2c408b=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x3be67b,_0x129674);a133_0x8c5550[_0x48fc7b(0x1dd)](_0x2c408b)['isFile']()&&_0x427d72[_0x48fc7b(0x1da)]({'file_name':_0x129674,'text_content':a133_0x8c5550['readFileSync'](_0x2c408b,_0x48fc7b(0x189))});}}const _0x3ee7d3={..._0x1899d1,'code':_0x1faf55,'files':_0x427d72};_0x66f9a5['push']({'name':_0x1899d1[_0x48fc7b(0x1c3)],'dir':_0x19ed67,'def':_0x3ee7d3});}}const _0x40e69d=[],_0x48382d=getFormInterfacesDir(_0x11347e);if(a133_0x8c5550[_0x48fc7b(0x229)](_0x48382d)){const _0xca0c08=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x48382d)[_0x48fc7b(0x146)](_0x5cb0aa=>_0x5cb0aa[_0x48fc7b(0x1b9)]('.yml'));for(const _0x2ad8e3 of _0xca0c08){const _0x23a6e0=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x48382d,_0x2ad8e3),_0x47ae21=parseFormInterfaceYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x23a6e0,_0x48fc7b(0x189)),_0x23a6e0);_0x40e69d[_0x48fc7b(0x1da)]({'name':_0x47ae21['name'],'path':_0x23a6e0,'yaml':_0x47ae21});}}const _0x35e986=[],_0x2b0b40=getChatInterfacesDir(_0x11347e);if(a133_0x8c5550['existsSync'](_0x2b0b40)){const _0x5932d7=a133_0x8c5550['readdirSync'](_0x2b0b40)[_0x48fc7b(0x146)](_0x3f940c=>_0x3f940c[_0x48fc7b(0x1b9)](_0x48fc7b(0x218)));for(const _0x47e1ce of _0x5932d7){const _0x259956=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x2b0b40,_0x47e1ce),_0x23434b=parseChatInterfaceYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x259956,_0x48fc7b(0x189)),_0x259956);_0x35e986['push']({'name':_0x23434b['name'],'path':_0x259956,'yaml':_0x23434b});}}const _0x44132b=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x1d8)](_0x23e555),_0x20373f=await this['client'][_0x48fc7b(0x183)](_0x23e555),_0x2053f8=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x239)](_0x23e555),_0x36d8bd=await this[_0x48fc7b(0x18a)]['listPrompts'](_0x23e555),_0x1b6a25=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x1ba)](_0x23e555),_0x280003=await safeListOrEmpty(()=>this[_0x48fc7b(0x18a)]['listExperimentalKnowledgeBases'](_0x23e555)),_0x2043c8=await safeListOrEmpty(()=>this[_0x48fc7b(0x18a)]['listExperimentalArtifacts'](_0x23e555)),_0x6bc0c0=await safeListOrEmpty(()=>this[_0x48fc7b(0x18a)][_0x48fc7b(0x142)](_0x23e555)),_0x1d2763=await safeListOrEmpty(()=>this['client'][_0x48fc7b(0x223)](_0x23e555)),_0x3b6030=await fetchAllToolTargetMaps((_0xafb6ba,_0x209ce8)=>this['client'][_0x48fc7b(0x24b)](_0xafb6ba,_0x209ce8),_0x23e555),_0x4ce081=new Map(),_0x4b6e1a=new Map(),_0x2d4773=new Map(),_0x4f9c4c=new Map(),_0x3439ff=new Map(),_0x428f0f=new Map(),_0x4b7fed=new Map();for(const _0x406294 of _0x44132b){_0x4ce081[_0x48fc7b(0x199)](_0x406294[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0x406294);}for(const _0x55cf00 of _0x20373f){_0x4b6e1a[_0x48fc7b(0x199)](_0x55cf00[_0x48fc7b(0x222)]['name'],_0x55cf00);}for(const _0xcf8ff1 of _0x2053f8){_0x2d4773[_0x48fc7b(0x199)](_0xcf8ff1['attributes'][_0x48fc7b(0x1c3)],_0xcf8ff1);}for(const _0xf30c6f of _0x36d8bd){_0x4f9c4c['set'](_0xf30c6f[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0xf30c6f);}for(const _0x1220b1 of _0x1b6a25){_0x3439ff[_0x48fc7b(0x199)](_0x1220b1['attributes']['serviceType'][_0x48fc7b(0x153)](),_0x1220b1);}for(const _0x586bd5 of _0x280003){_0x428f0f[_0x48fc7b(0x199)](_0x586bd5[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0x586bd5);}for(const _0x5dead4 of _0x2043c8){_0x4b7fed['set'](_0x5dead4[_0x48fc7b(0x222)]['name'],_0x5dead4);}const _0x115cca=new Map(),_0x1480a0=new Map();for(const _0xe6dc76 of _0x6bc0c0){_0x115cca['set'](_0xe6dc76['attributes'][_0x48fc7b(0x1c3)],_0xe6dc76);}for(const _0x1ffe5b of _0x1d2763){_0x1480a0[_0x48fc7b(0x199)](_0x1ffe5b[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0x1ffe5b);}const _0x4315f6=new Map(),_0x83c28=new Map();for(const _0x174197 of _0x44132b){_0x4315f6['set'](_0x174197[_0x48fc7b(0x222)]['name'],_0x174197['id']),_0x83c28[_0x48fc7b(0x199)](_0x174197['id'],_0x174197[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)]);}const _0x167009=new Map(),_0x1da7b4=new Map();for(const _0x556707 of _0x36d8bd){_0x167009[_0x48fc7b(0x199)](_0x556707[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0x556707['id']),_0x1da7b4[_0x48fc7b(0x199)](_0x556707['id'],_0x556707[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)]);}const _0x3035cf=_0x3b6030[_0x48fc7b(0x23f)]['KnowledgeBase']||new Map(),_0x14c757=_0x3b6030[_0x48fc7b(0x23f)][_0x48fc7b(0x1c9)]||new Map(),_0x139ed9=_0x3b6030[_0x48fc7b(0x23f)][_0x48fc7b(0x18e)]||new Map(),_0x17ecfc=new Map(),_0x6e038c={'resolveToolTargetName':buildNameResolver({..._0x3b6030[_0x48fc7b(0x18f)],'Agent':_0x83c28}),'resolvePromptName':async _0x5b595d=>_0x1da7b4['get'](_0x5b595d),'onWarning':_0x27d1cd=>this[_0x48fc7b(0x157)][_0x48fc7b(0x14b)](_0x27d1cd)};let _0x288a85=[];const _0x50df6e={'projectId':_0x23e555,'resolveToolTargetId':buildIdResolver({..._0x3b6030[_0x48fc7b(0x23f)],'Agent':_0x4315f6}),'resolvePromptId':async _0x2cf882=>_0x167009[_0x48fc7b(0x249)](_0x2cf882),'onWarning':_0x41b297=>{const _0x1d6284=_0x48fc7b;this[_0x1d6284(0x157)][_0x1d6284(0x14b)](_0x41b297),_0x288a85[_0x1d6284(0x1da)](_0x41b297);}},{resolved:_0x5d561a,unresolved:_0x473353}=resolveAgentDependencies(_0xf8fab8,new Set(_0x4ce081[_0x48fc7b(0x24e)]()));for(const {agent:_0x75b24,missingDeps:_0x3ffab8}of _0x473353){_0x3b18f5[_0x48fc7b(0x1e7)][_0x48fc7b(0x1da)]({'agentName':_0x75b24[_0x48fc7b(0x1d3)]['name'],'action':'error','error':'Unresolved\x20dependencies:\x20'+_0x3ffab8['join'](',\x20')+'.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.'}),_0x3b18f5['counts']['agents']['errors']++;}for(const _0xadefdd of _0x269704){const _0x5418ff=_0x4b6e1a['get'](_0xadefdd['yaml'][_0x48fc7b(0x1c3)]),_0x15467d=a133_0x8c5550[_0x48fc7b(0x1b1)](_0xadefdd[_0x48fc7b(0x25d)],_0x48fc7b(0x189));if(_0x5418ff){const _0x15001c=apiKnowledgeBaseToYaml(_0x5418ff),_0x21af92=toKnowledgeBaseYamlString(_0x15001c),_0x11e359=generateDiff(_0x21af92,_0x15467d),_0x27357e=hasChanges(_0x11e359);_0x27357e?(_0x3b18f5['knowledgeBases'][_0x48fc7b(0x1da)]({'name':_0xadefdd[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x5418ff['id'],'diff':formatDiffWithColors(_0x11e359)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x252)]['updated']++):(_0x3b18f5['knowledgeBases'][_0x48fc7b(0x1da)]({'name':_0xadefdd[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x5418ff['id']}),_0x3b18f5[_0x48fc7b(0x207)]['knowledgeBases'][_0x48fc7b(0x1ff)]++);}else _0x3b18f5[_0x48fc7b(0x252)]['push']({'name':_0xadefdd[_0x48fc7b(0x1d3)]['name'],'action':_0x48fc7b(0x25c)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x252)][_0x48fc7b(0x25c)]++;}for(const _0x4ade0b of _0x5bf5de){const _0x2020a1=_0x2d4773[_0x48fc7b(0x249)](_0x4ade0b[_0x48fc7b(0x1c3)]),_0x3e24f4=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x4ade0b[_0x48fc7b(0x25d)],_0x48fc7b(0x189));if(_0x2020a1){const _0x4273e9=toTextKnowledgeBaseMd(_0x2020a1[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0x2020a1[_0x48fc7b(0x222)][_0x48fc7b(0x248)]),_0x226f6f=generateDiff(_0x4273e9,_0x3e24f4),_0x3521cc=hasChanges(_0x226f6f);_0x3521cc?(_0x3b18f5[_0x48fc7b(0x1a9)][_0x48fc7b(0x1da)]({'name':_0x4ade0b[_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x2020a1['id'],'diff':formatDiffWithColors(_0x226f6f)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1a9)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x1a9)]['push']({'name':_0x4ade0b[_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x2020a1['id']}),_0x3b18f5['counts'][_0x48fc7b(0x1a9)][_0x48fc7b(0x1ff)]++);}else _0x3b18f5[_0x48fc7b(0x1a9)][_0x48fc7b(0x1da)]({'name':_0x4ade0b[_0x48fc7b(0x1c3)],'action':'created'}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1a9)][_0x48fc7b(0x25c)]++;}for(const _0x463c76 of _0x5d561a){const _0x45f3f4=_0x4ce081[_0x48fc7b(0x249)](_0x463c76['yaml'][_0x48fc7b(0x1c3)]),_0x547168=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x463c76[_0x48fc7b(0x19a)],_0x48fc7b(0x198)),_0x37dc73=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x547168,'utf-8'),_0x1bed72=_0x463c76[_0x48fc7b(0x16f)],_0x25a957=_0x48fc7b(0x18d)+_0x1bed72+'\x0a\x0a#\x20agent.yml\x0a'+_0x37dc73;if(_0x45f3f4){const {yaml:_0xa231a5,systemPrompt:_0x4cf85a}=await agentResponseToDef(_0x45f3f4,_0x6e038c),_0x19969d=toAgentYamlString(_0xa231a5),_0x5eef8d='#\x20prompt.md\x0a'+_0x4cf85a+_0x48fc7b(0x1e0)+_0x19969d,_0x3b14d4=generateDiff(_0x5eef8d,_0x25a957),_0x1bc203=hasChanges(_0x3b14d4);_0x1bc203?(_0x3b18f5[_0x48fc7b(0x1e7)][_0x48fc7b(0x1da)]({'agentName':_0x463c76[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'agentId':_0x45f3f4['id'],'diff':formatDiffWithColors(_0x3b14d4)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1e7)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x1e7)][_0x48fc7b(0x1da)]({'agentName':_0x463c76[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'agentId':_0x45f3f4['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1e7)][_0x48fc7b(0x1ff)]++);}else _0x3b18f5[_0x48fc7b(0x1e7)]['push']({'agentName':_0x463c76[_0x48fc7b(0x1d3)]['name'],'action':_0x48fc7b(0x25c)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1e7)][_0x48fc7b(0x25c)]++;}for(const _0x405159 of _0x262d1a){const _0x249210=_0x4f9c4c[_0x48fc7b(0x249)](_0x405159[_0x48fc7b(0x1d3)]['name']),_0x5745d0=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x405159[_0x48fc7b(0x25d)],_0x48fc7b(0x189));if(_0x249210){const _0x1b5876=await apiPromptToYaml(_0x249210,_0x6e038c);if(!_0x1b5876){_0x3b18f5[_0x48fc7b(0x236)][_0x48fc7b(0x1da)]({'name':_0x405159['yaml'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x249210['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)][_0x48fc7b(0x1be)]++;continue;}const _0x3db53b=toPromptYamlString(_0x1b5876),_0x122d15=generateDiff(_0x3db53b,_0x5745d0),_0x2e1cec=hasChanges(_0x122d15);_0x2e1cec?(_0x3b18f5[_0x48fc7b(0x236)][_0x48fc7b(0x1da)]({'name':_0x405159[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x249210['id'],'diff':formatDiffWithColors(_0x122d15)}),_0x3b18f5['counts'][_0x48fc7b(0x236)]['updated']++):(_0x3b18f5['prompts']['push']({'name':_0x405159[_0x48fc7b(0x1d3)]['name'],'action':_0x48fc7b(0x1ff),'id':_0x249210['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)][_0x48fc7b(0x1ff)]++);}else _0x3b18f5['prompts'][_0x48fc7b(0x1da)]({'name':_0x405159[_0x48fc7b(0x1d3)]['name'],'action':_0x48fc7b(0x25c)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)][_0x48fc7b(0x25c)]++;}for(const _0x57d0d3 of _0x2d98be){const _0x1922ec=_0x3439ff['get'](_0x57d0d3[_0x48fc7b(0x1d3)][_0x48fc7b(0x21d)]),_0xd9bbc6=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x57d0d3['path'],'utf-8');if(_0x1922ec){const _0x28d6ea=await apiIntegrationToYaml(_0x1922ec,_0x6e038c),_0x494be1=toIntegrationYamlString(_0x28d6ea),_0x54a647=generateDiff(_0x494be1,_0xd9bbc6),_0x34f8fe=hasChanges(_0x54a647);_0x34f8fe?(_0x3b18f5[_0x48fc7b(0x25a)][_0x48fc7b(0x1da)]({'name':_0x57d0d3[_0x48fc7b(0x1d3)]['service_type'],'action':_0x48fc7b(0x1be),'id':_0x1922ec['id'],'diff':formatDiffWithColors(_0x54a647)}),_0x3b18f5['counts'][_0x48fc7b(0x25a)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x25a)]['push']({'name':_0x57d0d3['yaml'][_0x48fc7b(0x21d)],'action':_0x48fc7b(0x1ff),'id':_0x1922ec['id']}),_0x3b18f5[_0x48fc7b(0x207)]['integrations'][_0x48fc7b(0x1ff)]++);}else _0x3b18f5['integrations'][_0x48fc7b(0x1da)]({'name':_0x57d0d3['yaml'][_0x48fc7b(0x21d)],'action':_0x48fc7b(0x25c)}),_0x3b18f5['counts'][_0x48fc7b(0x25a)][_0x48fc7b(0x25c)]++;}for(const _0x493992 of _0x3cf0ae){const _0x2498a4=_0x428f0f[_0x48fc7b(0x249)](_0x493992[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)]),_0x386b15=toExperimentalKnowledgeBaseYamlString(_0x493992[_0x48fc7b(0x22b)]);let _0x53e361=_0x386b15;for(const _0x113d28 of _0x493992['def'][_0x48fc7b(0x1b8)]){_0x53e361+=_0x48fc7b(0x16c)+_0x113d28[_0x48fc7b(0x1c3)]+_0x48fc7b(0x1b5)+_0x113d28[_0x48fc7b(0x225)]+'\x0a---\x20schema:\x20'+_0x113d28['name']+_0x48fc7b(0x1b5)+_0x113d28[_0x48fc7b(0x20e)]+'\x0a';}if(_0x2498a4){const _0x4ac92f=apiExperimentalKnowledgeBaseToYaml(_0x2498a4),_0x52bbde=toExperimentalKnowledgeBaseYamlString(_0x4ac92f);let _0x1b35c9=_0x52bbde;for(const _0x24f710 of _0x4ac92f[_0x48fc7b(0x1b8)]){_0x1b35c9+='\x0a---\x20function:\x20'+_0x24f710['name']+'\x20---\x0a'+_0x24f710[_0x48fc7b(0x225)]+_0x48fc7b(0x147)+_0x24f710[_0x48fc7b(0x1c3)]+_0x48fc7b(0x1b5)+_0x24f710[_0x48fc7b(0x20e)]+'\x0a';}const _0x6c38c7=generateDiff(_0x1b35c9,_0x53e361),_0x5e1e69=hasChanges(_0x6c38c7);_0x5e1e69?(_0x3b18f5['experimentalKnowledgeBases'][_0x48fc7b(0x1da)]({'name':_0x493992[_0x48fc7b(0x22b)]['name'],'action':'updated','id':_0x2498a4['id'],'diff':formatDiffWithColors(_0x6c38c7)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x217)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x217)]['push']({'name':_0x493992[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x2498a4['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x217)]['unchanged']++);}else _0x3b18f5[_0x48fc7b(0x217)][_0x48fc7b(0x1da)]({'name':_0x493992[_0x48fc7b(0x22b)]['name'],'action':'created'}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x217)][_0x48fc7b(0x25c)]++;}for(const _0x51389d of _0x66f9a5){const _0x5e44a6=_0x4b7fed[_0x48fc7b(0x249)](_0x51389d[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)]),_0x6b5191=toExperimentalArtifactYamlString(_0x51389d[_0x48fc7b(0x22b)]);let _0x37843c=_0x6b5191+(_0x48fc7b(0x245)+_0x51389d[_0x48fc7b(0x22b)]['code']+'\x0a');for(const _0x4e1b5d of _0x51389d[_0x48fc7b(0x22b)][_0x48fc7b(0x1d1)]){_0x37843c+=_0x48fc7b(0x151)+_0x4e1b5d[_0x48fc7b(0x1c7)]+_0x48fc7b(0x1b5)+_0x4e1b5d['text_content']+'\x0a';}if(_0x5e44a6){const _0x4399d1=apiExperimentalArtifactToYaml(_0x5e44a6),_0x4a6c16=toExperimentalArtifactYamlString(_0x4399d1);let _0x4a7d5b=_0x4a6c16+('\x0a---\x20code\x20---\x0a'+_0x4399d1[_0x48fc7b(0x225)]+'\x0a');for(const _0x10d662 of _0x4399d1[_0x48fc7b(0x1d1)]){_0x4a7d5b+=_0x48fc7b(0x151)+_0x10d662[_0x48fc7b(0x1c7)]+'\x20---\x0a'+_0x10d662[_0x48fc7b(0x208)]+'\x0a';}const _0x44f0db=generateDiff(_0x4a7d5b,_0x37843c),_0x26e93a=hasChanges(_0x44f0db);_0x26e93a?(_0x3b18f5[_0x48fc7b(0x1b3)][_0x48fc7b(0x1da)]({'name':_0x51389d[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':'updated','id':_0x5e44a6['id'],'diff':formatDiffWithColors(_0x44f0db)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1b3)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x1b3)][_0x48fc7b(0x1da)]({'name':_0x51389d['def'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x5e44a6['id']}),_0x3b18f5['counts'][_0x48fc7b(0x1b3)]['unchanged']++);}else _0x3b18f5[_0x48fc7b(0x1b3)][_0x48fc7b(0x1da)]({'name':_0x51389d[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c)}),_0x3b18f5['counts']['experimentalArtifacts'][_0x48fc7b(0x25c)]++;}for(const _0x746f55 of _0x40e69d){const _0x471bcb=_0x115cca['get'](_0x746f55[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)]),_0x54b9b8=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x746f55[_0x48fc7b(0x25d)],_0x48fc7b(0x189));if(_0x471bcb){const _0xecf7be=await apiFormInterfaceToYaml(_0x471bcb,_0x6e038c),_0x34a467=toFormInterfaceYamlString(_0xecf7be),_0x451821=generateDiff(_0x34a467,_0x54b9b8),_0x26f404=hasChanges(_0x451821);_0x26f404?(_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x746f55['yaml'][_0x48fc7b(0x1c3)],'action':'updated','id':_0x471bcb['id'],'diff':formatDiffWithColors(_0x451821)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x178)]['updated']++):(_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x746f55['yaml'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x471bcb['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x178)][_0x48fc7b(0x1ff)]++);}else _0x3b18f5['formInterfaces'][_0x48fc7b(0x1da)]({'name':_0x746f55['yaml'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c)}),_0x3b18f5['counts'][_0x48fc7b(0x178)][_0x48fc7b(0x25c)]++;}for(const _0x25ec3a of _0x35e986){const _0x1b89c3=_0x1480a0[_0x48fc7b(0x249)](_0x25ec3a[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)]),_0x12f4fd=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x25ec3a[_0x48fc7b(0x25d)],_0x48fc7b(0x189));if(_0x1b89c3){const _0x1f127e=await apiChatInterfaceToYaml(_0x1b89c3,_0x6e038c),_0x3b02f9=toChatInterfaceYamlString(_0x1f127e),_0x3da0d9=generateDiff(_0x3b02f9,_0x12f4fd),_0x351e5a=hasChanges(_0x3da0d9);_0x351e5a?(_0x3b18f5['chatInterfaces'][_0x48fc7b(0x1da)]({'name':_0x25ec3a['yaml']['name'],'action':'updated','id':_0x1b89c3['id'],'diff':formatDiffWithColors(_0x3da0d9)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x247)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x247)][_0x48fc7b(0x1da)]({'name':_0x25ec3a[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x1b89c3['id']}),_0x3b18f5[_0x48fc7b(0x207)]['chatInterfaces'][_0x48fc7b(0x1ff)]++);}else _0x3b18f5[_0x48fc7b(0x247)]['push']({'name':_0x25ec3a[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x247)][_0x48fc7b(0x25c)]++;}if(_0x4407a8?.[_0x48fc7b(0x234)])return _0x3b18f5;_0x3b18f5['knowledgeBases']=[],_0x3b18f5['textKnowledgeBases']=[],_0x3b18f5[_0x48fc7b(0x236)]=[],_0x3b18f5[_0x48fc7b(0x25a)]=[],_0x3b18f5[_0x48fc7b(0x217)]=[],_0x3b18f5[_0x48fc7b(0x1b3)]=[],_0x3b18f5[_0x48fc7b(0x178)]=[],_0x3b18f5[_0x48fc7b(0x247)]=[];const _0x8da56b=_0x3b18f5[_0x48fc7b(0x1e7)][_0x48fc7b(0x146)](_0x30d38b=>_0x30d38b[_0x48fc7b(0x226)]===_0x48fc7b(0x171));_0x3b18f5['agents']=_0x8da56b,_0x3b18f5['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x8da56b[_0x48fc7b(0x212)]},'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 _0x4bd44e of _0x269704){try{const _0x11be39=_0x4b6e1a[_0x48fc7b(0x249)](_0x4bd44e[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)]),_0x407c4c=yamlKnowledgeBaseToApi(_0x4bd44e[_0x48fc7b(0x1d3)],_0x23e555);if(_0x11be39)await this[_0x48fc7b(0x18a)][_0x48fc7b(0x230)](_0x11be39['id'],_0x407c4c),_0x3035cf[_0x48fc7b(0x199)](_0x4bd44e[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],_0x11be39['id']),_0x3b18f5['knowledgeBases']['push']({'name':_0x4bd44e['yaml']['name'],'action':_0x48fc7b(0x1be),'id':_0x11be39['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x252)][_0x48fc7b(0x1be)]++;else{const _0x422197=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x1f2)](_0x407c4c);_0x3035cf[_0x48fc7b(0x199)](_0x4bd44e[_0x48fc7b(0x1d3)]['name'],_0x422197['id']),_0x3b18f5[_0x48fc7b(0x252)][_0x48fc7b(0x1da)]({'name':_0x4bd44e[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c),'id':_0x422197['id']}),_0x3b18f5[_0x48fc7b(0x207)]['knowledgeBases'][_0x48fc7b(0x25c)]++;}}catch(_0x238a8d){_0x3b18f5[_0x48fc7b(0x252)][_0x48fc7b(0x1da)]({'name':_0x4bd44e[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0x238a8d['message']}),_0x3b18f5[_0x48fc7b(0x207)]['knowledgeBases'][_0x48fc7b(0x156)]++;}}for(const _0xf1a01e of _0x5bf5de){try{const _0x5c0da7=_0x2d4773[_0x48fc7b(0x249)](_0xf1a01e[_0x48fc7b(0x1c3)]),_0x1e56e6=yamlTextKnowledgeBaseToApi({'name':_0xf1a01e[_0x48fc7b(0x1c3)],'text':_0xf1a01e[_0x48fc7b(0x248)]},_0x23e555);if(_0x5c0da7)await this[_0x48fc7b(0x18a)]['updateTextKnowledgeBase'](_0x5c0da7['id'],_0x1e56e6),_0x14c757[_0x48fc7b(0x199)](_0xf1a01e[_0x48fc7b(0x1c3)],_0x5c0da7['id']),_0x3b18f5['textKnowledgeBases'][_0x48fc7b(0x1da)]({'name':_0xf1a01e[_0x48fc7b(0x1c3)],'action':'updated','id':_0x5c0da7['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1a9)][_0x48fc7b(0x1be)]++;else{const _0x223376=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x219)](_0x1e56e6);_0x14c757[_0x48fc7b(0x199)](_0xf1a01e[_0x48fc7b(0x1c3)],_0x223376['id']),_0x3b18f5['textKnowledgeBases'][_0x48fc7b(0x1da)]({'name':_0xf1a01e[_0x48fc7b(0x1c3)],'action':'created','id':_0x223376['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1a9)][_0x48fc7b(0x25c)]++;}}catch(_0x2e5710){_0x3b18f5[_0x48fc7b(0x1a9)][_0x48fc7b(0x1da)]({'name':_0xf1a01e[_0x48fc7b(0x1c3)],'action':'error','error':_0x2e5710[_0x48fc7b(0x250)]}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1a9)]['errors']++;}}for(const _0x27f4b8 of _0x3cf0ae){try{const _0x19da63=_0x428f0f[_0x48fc7b(0x249)](_0x27f4b8[_0x48fc7b(0x22b)]['name']),_0x123b27=yamlExperimentalKnowledgeBaseToApi(_0x27f4b8['def'],_0x23e555);if(_0x19da63)await this[_0x48fc7b(0x18a)]['updateExperimentalKnowledgeBase'](_0x19da63['id'],_0x123b27),_0x139ed9[_0x48fc7b(0x199)](_0x27f4b8[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],_0x19da63['id']),_0x3b18f5[_0x48fc7b(0x217)]['push']({'name':_0x27f4b8[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x19da63['id']}),_0x3b18f5[_0x48fc7b(0x207)]['experimentalKnowledgeBases'][_0x48fc7b(0x1be)]++;else{const _0x6951b8=await this[_0x48fc7b(0x18a)]['createExperimentalKnowledgeBase'](_0x123b27);_0x139ed9[_0x48fc7b(0x199)](_0x27f4b8[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],_0x6951b8['id']),_0x3b18f5['experimentalKnowledgeBases'][_0x48fc7b(0x1da)]({'name':_0x27f4b8[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c),'id':_0x6951b8['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x217)][_0x48fc7b(0x25c)]++;}}catch(_0x52ca62){_0x3b18f5[_0x48fc7b(0x217)][_0x48fc7b(0x1da)]({'name':_0x27f4b8[_0x48fc7b(0x22b)]['name'],'action':_0x48fc7b(0x171),'error':_0x52ca62[_0x48fc7b(0x250)]}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x217)]['errors']++;}}for(const _0xb0b1d4 of _0x66f9a5){try{const _0x57df91=_0x4b7fed[_0x48fc7b(0x249)](_0xb0b1d4[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)]),_0x497a89=yamlExperimentalArtifactToApi(_0xb0b1d4[_0x48fc7b(0x22b)],_0x23e555);if(_0x57df91)await this[_0x48fc7b(0x18a)][_0x48fc7b(0x193)](_0x57df91['id'],_0x497a89),_0x17ecfc[_0x48fc7b(0x199)](_0xb0b1d4[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],_0x57df91['id']),_0x3b18f5['experimentalArtifacts']['push']({'name':_0xb0b1d4['def'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x57df91['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1b3)][_0x48fc7b(0x1be)]++;else{const _0x54d124=await this['client'][_0x48fc7b(0x1a6)](_0x497a89);_0x17ecfc[_0x48fc7b(0x199)](_0xb0b1d4[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],_0x54d124['id']),_0x3b18f5[_0x48fc7b(0x1b3)][_0x48fc7b(0x1da)]({'name':_0xb0b1d4[_0x48fc7b(0x22b)]['name'],'action':_0x48fc7b(0x25c),'id':_0x54d124['id']}),_0x3b18f5['counts'][_0x48fc7b(0x1b3)][_0x48fc7b(0x25c)]++;}}catch(_0x4afc51){_0x3b18f5[_0x48fc7b(0x1b3)][_0x48fc7b(0x1da)]({'name':_0xb0b1d4[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0x4afc51[_0x48fc7b(0x250)]}),_0x3b18f5[_0x48fc7b(0x207)]['experimentalArtifacts'][_0x48fc7b(0x156)]++;}}for(const _0x319ec1 of _0x5d561a){_0x288a85=[];try{const _0xa8626a=_0x4ce081[_0x48fc7b(0x249)](_0x319ec1[_0x48fc7b(0x1d3)]['name']),_0x4b4ce4=await agentDefToRequest(_0x319ec1[_0x48fc7b(0x1d3)],_0x319ec1[_0x48fc7b(0x16f)],_0x319ec1['starterMessage'],_0x50df6e);if(_0xa8626a)await this['client'][_0x48fc7b(0x237)](_0xa8626a['id'],_0x4b4ce4),_0x4315f6['set'](_0x319ec1['yaml'][_0x48fc7b(0x1c3)],_0xa8626a['id']),_0x3b18f5[_0x48fc7b(0x1e7)][_0x48fc7b(0x1da)]({'agentName':_0x319ec1['yaml'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'agentId':_0xa8626a['id'],'warnings':_0x288a85[_0x48fc7b(0x212)]>0x0?_0x288a85:undefined}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1e7)][_0x48fc7b(0x1be)]++;else{const _0x27e519=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x1eb)](_0x4b4ce4);_0x4315f6['set'](_0x319ec1[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],_0x27e519['id']),_0x3b18f5[_0x48fc7b(0x1e7)]['push']({'agentName':_0x319ec1[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c),'agentId':_0x27e519['id'],'warnings':_0x288a85[_0x48fc7b(0x212)]>0x0?_0x288a85:undefined}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1e7)][_0x48fc7b(0x25c)]++;}}catch(_0x2a40f0){_0x3b18f5[_0x48fc7b(0x1e7)]['push']({'agentName':_0x319ec1[_0x48fc7b(0x1d3)]['name'],'action':'error','error':_0x2a40f0[_0x48fc7b(0x250)],'warnings':_0x288a85[_0x48fc7b(0x212)]>0x0?_0x288a85:undefined}),_0x3b18f5[_0x48fc7b(0x207)]['agents']['errors']++;}}for(const _0x3317c7 of _0x262d1a){try{const _0x5d66fa=_0x4f9c4c[_0x48fc7b(0x249)](_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)]),_0x53cd1e=await yamlPromptToApi(_0x3317c7[_0x48fc7b(0x1d3)],_0x23e555,_0x50df6e);if(!_0x53cd1e){_0x3b18f5[_0x48fc7b(0x236)]['push']({'name':_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0x48fc7b(0x1a5)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)]['errors']++;continue;}if(_0x5d66fa)await this['client']['updatePrompt'](_0x5d66fa['id'],_0x53cd1e),_0x167009[_0x48fc7b(0x199)](_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],_0x5d66fa['id']),_0x3b18f5['prompts'][_0x48fc7b(0x1da)]({'name':_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x5d66fa['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)][_0x48fc7b(0x1be)]++;else{const _0x1d2bde=await this['client'][_0x48fc7b(0x17e)](_0x53cd1e);_0x167009[_0x48fc7b(0x199)](_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],_0x1d2bde['id']),_0x3b18f5[_0x48fc7b(0x236)][_0x48fc7b(0x1da)]({'name':_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c),'id':_0x1d2bde['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)]['created']++;}}catch(_0x1361fc){_0x3b18f5[_0x48fc7b(0x236)][_0x48fc7b(0x1da)]({'name':_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0x1361fc[_0x48fc7b(0x250)]}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)][_0x48fc7b(0x156)]++;}}for(const _0x27c536 of _0x2d98be){try{const _0x4fb67c=_0x3439ff[_0x48fc7b(0x249)](_0x27c536[_0x48fc7b(0x1d3)][_0x48fc7b(0x21d)]),_0x3302bc=await yamlIntegrationToApi(_0x27c536[_0x48fc7b(0x1d3)],_0x23e555,_0x50df6e);if(_0x4fb67c){await this['client'][_0x48fc7b(0x1e1)](_0x4fb67c['id']);const _0x1069bd=await this['client'][_0x48fc7b(0x25b)](_0x3302bc);_0x3b18f5[_0x48fc7b(0x25a)][_0x48fc7b(0x1da)]({'name':_0x27c536[_0x48fc7b(0x1d3)]['service_type'],'action':_0x48fc7b(0x1be),'id':_0x1069bd['id']}),_0x3b18f5['counts'][_0x48fc7b(0x25a)][_0x48fc7b(0x1be)]++;}else{const _0x496302=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x25b)](_0x3302bc);_0x3b18f5['integrations'][_0x48fc7b(0x1da)]({'name':_0x27c536[_0x48fc7b(0x1d3)][_0x48fc7b(0x21d)],'action':_0x48fc7b(0x25c),'id':_0x496302['id']}),_0x3b18f5[_0x48fc7b(0x207)]['integrations'][_0x48fc7b(0x25c)]++;}}catch(_0x2fbbf1){_0x3b18f5[_0x48fc7b(0x25a)]['push']({'name':_0x27c536[_0x48fc7b(0x1d3)]['service_type'],'action':_0x48fc7b(0x171),'error':_0x2fbbf1[_0x48fc7b(0x250)]}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x25a)][_0x48fc7b(0x156)]++;}}for(const _0x269fb6 of _0x40e69d){try{const _0x310fb9=_0x115cca[_0x48fc7b(0x249)](_0x269fb6[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)]),_0x4fee2b=await yamlFormInterfaceToApi(_0x269fb6[_0x48fc7b(0x1d3)],_0x23e555,_0x50df6e);if(!_0x4fee2b){_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x269fb6[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':'error','error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x3b18f5['counts'][_0x48fc7b(0x178)]['errors']++;continue;}if(_0x310fb9){const _0x52fa09=await this['client']['updateFormInterface'](_0x310fb9['id'],_0x4fee2b);_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x269fb6[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x52fa09['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x178)][_0x48fc7b(0x1be)]++;}else{const _0x550dce=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x22c)](_0x4fee2b);_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x269fb6['yaml']['name'],'action':'created','id':_0x550dce['id']}),_0x3b18f5['counts'][_0x48fc7b(0x178)]['created']++;}}catch(_0xb12a2d){_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x269fb6[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0xb12a2d['message']}),_0x3b18f5[_0x48fc7b(0x207)]['formInterfaces']['errors']++;}}for(const _0x560795 of _0x35e986){try{const _0x19e4f5=_0x1480a0[_0x48fc7b(0x249)](_0x560795['yaml']['name']),_0x13f636=await yamlChatInterfaceToApi(_0x560795[_0x48fc7b(0x1d3)],_0x23e555,_0x50df6e);if(_0x19e4f5){const _0x2355a7=await this[_0x48fc7b(0x18a)]['updateChatInterface'](_0x19e4f5['id'],_0x13f636);_0x3b18f5['chatInterfaces'][_0x48fc7b(0x1da)]({'name':_0x560795[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x2355a7['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x247)][_0x48fc7b(0x1be)]++;}else{const _0x16de73=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x13d)](_0x13f636);_0x3b18f5[_0x48fc7b(0x247)][_0x48fc7b(0x1da)]({'name':_0x560795['yaml'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c),'id':_0x16de73['id']}),_0x3b18f5['counts'][_0x48fc7b(0x247)][_0x48fc7b(0x25c)]++;}}catch(_0x450958){_0x3b18f5['chatInterfaces'][_0x48fc7b(0x1da)]({'name':_0x560795[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0x450958[_0x48fc7b(0x250)]}),_0x3b18f5['counts'][_0x48fc7b(0x247)][_0x48fc7b(0x156)]++;}}return _0x3b18f5;}async[a133_0xe8af3(0x13f)](_0x4e8bb6,_0x53d3cb,_0x4bc397,_0x5ca258){const _0x22ac66=a133_0xe8af3,{projectId:_0x2d7ab8,project:_0x50d93a}=await this[_0x22ac66(0x14e)](_0x4e8bb6),_0x34b0f5=_0x50d93a['attributes'][_0x22ac66(0x1c3)],_0x36c30c=await this[_0x22ac66(0x18a)][_0x22ac66(0x1d8)](_0x2d7ab8),_0x5b085c=_0x36c30c[_0x22ac66(0x1a2)](_0x45a593=>_0x45a593['attributes']['name']===_0x53d3cb);if(!_0x5b085c)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x22ac66(0x185)+_0x53d3cb,undefined,{'helpText':'Available\x20agents:\x20'+_0x36c30c[_0x22ac66(0x150)](_0x8aa71=>_0x8aa71['attributes'][_0x22ac66(0x1c3)])[_0x22ac66(0x1e6)](',\x20')});let _0x18151f;if(_0x4bc397)_0x18151f=_0x4bc397;else{const _0x574463=a133_0xcf5d58[_0x22ac66(0x1e6)](process[_0x22ac66(0x15d)](),'agents'),_0x21f35b=getSanitizedPathWithMigration(_0x574463,_0x34b0f5);_0x21f35b[_0x22ac66(0x1d7)]&&this[_0x22ac66(0x157)][_0x22ac66(0x1ed)]('Renamed\x20folder:\x20'+a133_0xcf5d58['basename'](_0x21f35b[_0x22ac66(0x251)])+'\x20→\x20'+a133_0xcf5d58[_0x22ac66(0x1c8)](_0x21f35b[_0x22ac66(0x25d)])),_0x18151f=_0x21f35b['path'];}const _0x4d8e2e=getSanitizedPathWithMigration(_0x18151f,_0x53d3cb);_0x4d8e2e[_0x22ac66(0x1d7)]&&this[_0x22ac66(0x157)][_0x22ac66(0x1ed)](_0x22ac66(0x20b)+a133_0xcf5d58[_0x22ac66(0x1c8)](_0x4d8e2e[_0x22ac66(0x251)])+'\x20→\x20'+a133_0xcf5d58[_0x22ac66(0x1c8)](_0x4d8e2e['path']));const _0x402a28=_0x4d8e2e[_0x22ac66(0x25d)],_0x164f5a=new Map(),_0x51013d=new Map(),_0x49691d=await this[_0x22ac66(0x18a)]['listKnowledgeBases'](_0x2d7ab8),_0x40ea9d=await this[_0x22ac66(0x18a)][_0x22ac66(0x239)](_0x2d7ab8),_0xb93d55=await safeListOrEmpty(()=>this[_0x22ac66(0x18a)]['listExperimentalKnowledgeBases'](_0x2d7ab8)),_0x5d8e68=new Map(),_0x2df07f=new Map();for(const _0x51a528 of _0x49691d){_0x164f5a['set'](_0x51a528['id'],_0x51a528[_0x22ac66(0x222)][_0x22ac66(0x1c3)]);}for(const _0x2b2eae of _0x40ea9d){_0x5d8e68[_0x22ac66(0x199)](_0x2b2eae['id'],_0x2b2eae[_0x22ac66(0x222)]['name']);}for(const _0x520639 of _0xb93d55){_0x2df07f[_0x22ac66(0x199)](_0x520639['id'],_0x520639['attributes']['name']);}for(const _0x5a808a of _0x36c30c){_0x51013d['set'](_0x5a808a['id'],_0x5a808a[_0x22ac66(0x222)][_0x22ac66(0x1c3)]);}const _0x3a4b8f={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x164f5a,'TextKnowledgeBase':_0x5d8e68,'Agent':_0x51013d,'ExperimentalKnowledgeBase':_0x2df07f}),'resolvePromptName':async()=>undefined,'onWarning':_0x2081d1=>this[_0x22ac66(0x157)]['warn'](_0x2081d1)},_0x119e38=a133_0xcf5d58[_0x22ac66(0x1e6)](_0x402a28,_0x22ac66(0x1d5)),_0x24c7a9=a133_0xcf5d58['join'](_0x402a28,'agent.yml'),_0x3a6119=a133_0xcf5d58[_0x22ac66(0x1e6)](_0x402a28,_0x22ac66(0x1fd)),_0x7dfd80=!a133_0x8c5550['existsSync'](_0x24c7a9);if(_0x5ca258?.[_0x22ac66(0x234)])return{'agentName':_0x53d3cb,'outputPath':_0x402a28,'isNew':_0x7dfd80,'hasChanges':!![]};a133_0x8c5550['mkdirSync'](_0x18151f,{'recursive':!![]}),a133_0x8c5550[_0x22ac66(0x1e4)](_0x402a28,{'recursive':!![]});const _0x2cb5dc=a133_0xcf5d58[_0x22ac66(0x1e6)](_0x18151f,'tdx.json');!a133_0x8c5550[_0x22ac66(0x229)](_0x2cb5dc)&&a133_0x8c5550[_0x22ac66(0x22f)](_0x2cb5dc,createAgentConfigContent(_0x4e8bb6));const {yaml:_0x16021d,systemPrompt:_0x1ba8fa,starterMessage:_0x10fea5}=await agentResponseToDef(_0x5b085c,_0x3a4b8f);let _0x31ea9a=_0x7dfd80;if(!_0x7dfd80){const _0x2d9c4c=a133_0x8c5550[_0x22ac66(0x229)](_0x119e38)?a133_0x8c5550[_0x22ac66(0x1b1)](_0x119e38,_0x22ac66(0x189)):'',_0x3bfb5e=a133_0x8c5550['readFileSync'](_0x24c7a9,'utf-8');_0x31ea9a=_0x2d9c4c!==_0x1ba8fa||_0x3bfb5e!==toAgentYamlString(_0x16021d);}a133_0x8c5550[_0x22ac66(0x22f)](_0x119e38,_0x1ba8fa),a133_0x8c5550[_0x22ac66(0x22f)](_0x24c7a9,toAgentYamlString(_0x16021d));if(_0x10fea5&&_0x10fea5[_0x22ac66(0x16a)]('\x0a'))a133_0x8c5550['writeFileSync'](_0x3a6119,_0x10fea5);else a133_0x8c5550[_0x22ac66(0x229)](_0x3a6119)&&a133_0x8c5550[_0x22ac66(0x1c1)](_0x3a6119);return{'agentName':_0x53d3cb,'outputPath':_0x402a28,'isNew':_0x7dfd80,'hasChanges':_0x31ea9a};}async['pushAgent'](_0x469145,_0x505b5c){const _0x2cb9e1=a133_0xe8af3;let _0x2f2b8e;isAgentYamlPath(_0x469145)?_0x2f2b8e=getAgentDirFromYamlPath(_0x469145):_0x2f2b8e=_0x469145;const {config:_0x291bae}=findAgentConfig(_0x2f2b8e),_0x5b1084=await this[_0x2cb9e1(0x1c5)](_0x291bae[_0x2cb9e1(0x181)]),_0x103dea=a133_0xcf5d58[_0x2cb9e1(0x1e6)](_0x2f2b8e,_0x2cb9e1(0x198)),_0x1b8c72=a133_0xcf5d58[_0x2cb9e1(0x1e6)](_0x2f2b8e,_0x2cb9e1(0x1d5)),_0x4c3a32=a133_0xcf5d58[_0x2cb9e1(0x1e6)](_0x2f2b8e,_0x2cb9e1(0x1fd));if(!a133_0x8c5550[_0x2cb9e1(0x229)](_0x103dea))throw new SDKError(ErrorCode['NOT_FOUND'],_0x2cb9e1(0x177)+_0x2f2b8e,undefined,{'helpText':_0x2cb9e1(0x13a)});const _0x3343b4=parseAgentYaml(a133_0x8c5550[_0x2cb9e1(0x1b1)](_0x103dea,_0x2cb9e1(0x189)),_0x103dea),_0x3e0972=a133_0x8c5550[_0x2cb9e1(0x229)](_0x1b8c72)?a133_0x8c5550['readFileSync'](_0x1b8c72,_0x2cb9e1(0x189)):'',_0x58bd2e=a133_0x8c5550[_0x2cb9e1(0x229)](_0x4c3a32)?a133_0x8c5550[_0x2cb9e1(0x1b1)](_0x4c3a32,_0x2cb9e1(0x189)):_0x3343b4['starter_message'];if(_0x505b5c?.[_0x2cb9e1(0x234)])return{'agentName':_0x3343b4[_0x2cb9e1(0x1c3)],'action':'created','projectId':_0x5b1084};const _0x7ff6a3=await this[_0x2cb9e1(0x18a)]['listAgentsFull'](_0x5b1084),_0x521d82=await fetchAllToolTargetMaps((_0xd7d10f,_0xc4acad)=>this[_0x2cb9e1(0x18a)][_0x2cb9e1(0x24b)](_0xd7d10f,_0xc4acad),_0x5b1084),_0x21cca7=new Map();for(const _0x2567fc of _0x7ff6a3){_0x21cca7[_0x2cb9e1(0x199)](_0x2567fc['attributes'][_0x2cb9e1(0x1c3)],_0x2567fc['id']);}const _0x34fd76=[],_0x4d7370={'projectId':_0x5b1084,'resolveToolTargetId':buildIdResolver({..._0x521d82[_0x2cb9e1(0x23f)],'Agent':_0x21cca7}),'resolvePromptId':async()=>undefined,'onWarning':_0x46c8d1=>{const _0x1b0a45=_0x2cb9e1;this['logger']['warn'](_0x46c8d1),_0x34fd76[_0x1b0a45(0x1da)](_0x46c8d1);}};try{const _0x258cf8=_0x7ff6a3[_0x2cb9e1(0x1a2)](_0xa4cf73=>_0xa4cf73[_0x2cb9e1(0x222)]['name']===_0x3343b4[_0x2cb9e1(0x1c3)]),_0x49b267=await agentDefToRequest(_0x3343b4,_0x3e0972,_0x58bd2e,_0x4d7370);if(_0x258cf8)return await this[_0x2cb9e1(0x18a)][_0x2cb9e1(0x237)](_0x258cf8['id'],_0x49b267),{'agentName':_0x3343b4['name'],'action':_0x2cb9e1(0x1be),'projectId':_0x5b1084,'agentId':_0x258cf8['id'],'warnings':_0x34fd76[_0x2cb9e1(0x212)]>0x0?_0x34fd76:undefined};else{const _0xa96a75=await this['client'][_0x2cb9e1(0x1eb)](_0x49b267);return{'agentName':_0x3343b4[_0x2cb9e1(0x1c3)],'action':'created','projectId':_0x5b1084,'agentId':_0xa96a75['id'],'warnings':_0x34fd76['length']>0x0?_0x34fd76:undefined};}}catch(_0x1b218e){return{'agentName':_0x3343b4[_0x2cb9e1(0x1c3)],'action':_0x2cb9e1(0x171),'projectId':_0x5b1084,'error':_0x1b218e[_0x2cb9e1(0x250)],'warnings':_0x34fd76['length']>0x0?_0x34fd76:undefined};}}async[a133_0xe8af3(0x140)](_0x87f541,_0x266a35,_0x85bd8f){const _0x48f258=a133_0xe8af3,_0x33b353=a133_0x8c5550['existsSync'](_0x87f541)&&a133_0x8c5550[_0x48f258(0x229)](a133_0xcf5d58[_0x48f258(0x1e6)](_0x87f541,_0x48f258(0x243)));let _0x3f88d0;const _0x7c8a5=[],_0x2513fd=[],_0x3cc725=[],_0x526bdd=[],_0x9fd8b5=[],_0x1355c9=[],_0x451242=[],_0x40622e=[],_0x2b92c6=[];if(_0x33b353){const _0x40c67c=loadAgentConfig(a133_0xcf5d58[_0x48f258(0x1e6)](_0x87f541,_0x48f258(0x243)));_0x3f88d0=_0x40c67c[_0x48f258(0x181)];const _0x34ace1=a133_0x8c5550[_0x48f258(0x1ee)](_0x87f541,{'withFileTypes':!![]});for(const _0x311755 of _0x34ace1){if(!_0x311755[_0x48f258(0x24c)]())continue;if([_0x48f258(0x21f),_0x48f258(0x196),_0x48f258(0x175),_0x48f258(0x236),_0x48f258(0x25a),_0x48f258(0x174),_0x48f258(0x1a1)][_0x48f258(0x16a)](_0x311755[_0x48f258(0x1c3)]))continue;const _0x318afa=a133_0xcf5d58[_0x48f258(0x1e6)](_0x87f541,_0x311755[_0x48f258(0x1c3)]);if(isAgentDir(_0x318afa)){const _0x246237=a133_0xcf5d58[_0x48f258(0x1e6)](_0x318afa,'agent.yml'),_0x453ce9=a133_0xcf5d58[_0x48f258(0x1e6)](_0x318afa,_0x48f258(0x1d5)),_0x7e19c4=a133_0xcf5d58['join'](_0x318afa,_0x48f258(0x1fd)),_0x33e91f=parseAgentYaml(a133_0x8c5550['readFileSync'](_0x246237,_0x48f258(0x189)),_0x246237),_0x5da86a=a133_0x8c5550[_0x48f258(0x229)](_0x453ce9)?a133_0x8c5550[_0x48f258(0x1b1)](_0x453ce9,_0x48f258(0x189)):'',_0x2b6a3e=a133_0x8c5550[_0x48f258(0x229)](_0x7e19c4)?a133_0x8c5550[_0x48f258(0x1b1)](_0x7e19c4,_0x48f258(0x189)):_0x33e91f['starter_message'];_0x7c8a5[_0x48f258(0x1da)]({'name':_0x33e91f[_0x48f258(0x1c3)],'dir':_0x318afa,'yaml':_0x33e91f,'systemPrompt':_0x5da86a,'starterMessage':_0x2b6a3e});}}const _0x58fd86=getKnowledgeBasesDir(_0x87f541);if(a133_0x8c5550['existsSync'](_0x58fd86)){const _0x55485b=a133_0x8c5550[_0x48f258(0x1ee)](_0x58fd86);for(const _0x328417 of _0x55485b){const _0x584b4b=a133_0xcf5d58['join'](_0x58fd86,_0x328417);if(_0x328417['endsWith']('.yml')){const _0x2cb780=parseKnowledgeBaseYaml(a133_0x8c5550['readFileSync'](_0x584b4b,_0x48f258(0x189)),_0x584b4b);_0x2513fd['push']({'name':_0x2cb780[_0x48f258(0x1c3)],'path':_0x584b4b,'yaml':_0x2cb780});}else{if(_0x328417[_0x48f258(0x1b9)](_0x48f258(0x1fb))){const _0x5edcb4=a133_0x8c5550[_0x48f258(0x1b1)](_0x584b4b,'utf-8'),{name:_0x450474,text:_0x59e86c}=parseTextKnowledgeBaseMd(_0x5edcb4,_0x328417);_0x3cc725['push']({'name':_0x450474,'path':_0x584b4b,'text':_0x59e86c});}}}}const _0x329c92=getPromptsDir(_0x87f541);if(a133_0x8c5550['existsSync'](_0x329c92)){const _0x223aff=a133_0x8c5550[_0x48f258(0x1ee)](_0x329c92)[_0x48f258(0x146)](_0x11433e=>_0x11433e[_0x48f258(0x1b9)](_0x48f258(0x218)));for(const _0x16fdd5 of _0x223aff){const _0x240ccd=a133_0xcf5d58[_0x48f258(0x1e6)](_0x329c92,_0x16fdd5),_0x5b668e=parsePromptYaml(a133_0x8c5550['readFileSync'](_0x240ccd,_0x48f258(0x189)),_0x240ccd);_0x526bdd[_0x48f258(0x1da)]({'name':_0x5b668e['name'],'path':_0x240ccd,'yaml':_0x5b668e});}}const _0x457af0=getIntegrationsDir(_0x87f541);if(a133_0x8c5550[_0x48f258(0x229)](_0x457af0)){const _0x4320bc=a133_0x8c5550['readdirSync'](_0x457af0)[_0x48f258(0x146)](_0x5309a9=>_0x5309a9[_0x48f258(0x1b9)]('.yml'));for(const _0x34e212 of _0x4320bc){const _0x5b0e11=a133_0xcf5d58['join'](_0x457af0,_0x34e212),_0x2453b9=parseIntegrationYaml(a133_0x8c5550[_0x48f258(0x1b1)](_0x5b0e11,'utf-8'),_0x5b0e11);SAFE_INTEGRATION_TYPES[_0x48f258(0x16a)](_0x2453b9['service_type'][_0x48f258(0x153)]())?_0x9fd8b5[_0x48f258(0x1da)]({'name':_0x2453b9[_0x48f258(0x1c3)],'path':_0x5b0e11,'yaml':_0x2453b9}):this[_0x48f258(0x157)][_0x48f258(0x14b)](_0x48f258(0x14c)+_0x2453b9[_0x48f258(0x1c3)]+_0x48f258(0x227)+_0x2453b9['service_type']+_0x48f258(0x1ad)+(_0x48f258(0x176)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x48f258(0x14f)));}}const _0x399898=getExperimentalKnowledgeBasesDir(_0x87f541);if(a133_0x8c5550['existsSync'](_0x399898)){const _0x1dae39=a133_0x8c5550[_0x48f258(0x1ee)](_0x399898,{'withFileTypes':!![]});for(const _0x385f10 of _0x1dae39){if(!_0x385f10[_0x48f258(0x24c)]())continue;const _0xba7d3=a133_0xcf5d58[_0x48f258(0x1e6)](_0x399898,_0x385f10['name']),_0x4f5d31=a133_0xcf5d58[_0x48f258(0x1e6)](_0xba7d3,_0x385f10[_0x48f258(0x1c3)]+_0x48f258(0x218));if(a133_0x8c5550['existsSync'](_0x4f5d31)){const _0x1329a7=parseExperimentalKnowledgeBaseYaml(a133_0x8c5550[_0x48f258(0x1b1)](_0x4f5d31,_0x48f258(0x189)),_0x4f5d31),_0x548f1c=a133_0xcf5d58[_0x48f258(0x1e6)](_0xba7d3,_0x48f258(0x1b8)),_0x171782=[];if(a133_0x8c5550[_0x48f258(0x229)](_0x548f1c)){const _0x152a62=a133_0x8c5550[_0x48f258(0x1ee)](_0x548f1c,{'withFileTypes':!![]});for(const _0x43bb0a of _0x152a62){if(!_0x43bb0a['isDirectory']())continue;const _0x1b011f=a133_0xcf5d58['join'](_0x548f1c,_0x43bb0a[_0x48f258(0x1c3)]),_0x1dd559=a133_0xcf5d58[_0x48f258(0x1e6)](_0x1b011f,_0x48f258(0x20a)),_0x415eaf=a133_0xcf5d58[_0x48f258(0x1e6)](_0x1b011f,_0x48f258(0x145));if(a133_0x8c5550[_0x48f258(0x229)](_0x1dd559)&&a133_0x8c5550[_0x48f258(0x229)](_0x415eaf)){const _0x44d0f5=a133_0x8c5550[_0x48f258(0x1b1)](_0x1dd559,_0x48f258(0x189)),_0xde0610=a133_0x8c5550[_0x48f258(0x1b1)](_0x415eaf,_0x48f258(0x189));_0x171782['push']({'name':_0x43bb0a[_0x48f258(0x1c3)],'code':_0x44d0f5,'json_schema':_0xde0610});}}}const _0x20eb07={..._0x1329a7,'functions':_0x171782};_0x1355c9['push']({'name':_0x1329a7[_0x48f258(0x1c3)],'path':_0xba7d3,'def':_0x20eb07});}}}const _0x2a0adb=getExperimentalArtifactsDir(_0x87f541);if(a133_0x8c5550['existsSync'](_0x2a0adb)){const _0xeb351e=a133_0x8c5550[_0x48f258(0x1ee)](_0x2a0adb,{'withFileTypes':!![]});for(const _0x3c2a62 of _0xeb351e){if(!_0x3c2a62['isDirectory']())continue;const _0x3ebafd=a133_0xcf5d58['join'](_0x2a0adb,_0x3c2a62['name']),_0x5ea449=a133_0xcf5d58['join'](_0x3ebafd,_0x3c2a62['name']+_0x48f258(0x218));if(a133_0x8c5550['existsSync'](_0x5ea449)){const _0x509c95=parseExperimentalArtifactYaml(a133_0x8c5550[_0x48f258(0x1b1)](_0x5ea449,_0x48f258(0x189)),_0x5ea449),_0x54d9cb=a133_0xcf5d58['join'](_0x3ebafd,_0x48f258(0x20a)),_0xb845d9=a133_0x8c5550['existsSync'](_0x54d9cb)?a133_0x8c5550[_0x48f258(0x1b1)](_0x54d9cb,_0x48f258(0x189)):'',_0x42c387=a133_0xcf5d58[_0x48f258(0x1e6)](_0x3ebafd,_0x48f258(0x1d1)),_0x2a4d50=[];if(a133_0x8c5550[_0x48f258(0x229)](_0x42c387)){const _0x704865=a133_0x8c5550[_0x48f258(0x1ee)](_0x42c387);for(const _0x38ca1c of _0x704865){const _0x307ef8=a133_0xcf5d58[_0x48f258(0x1e6)](_0x42c387,_0x38ca1c);if(a133_0x8c5550['statSync'](_0x307ef8)[_0x48f258(0x166)]()){const _0x55e221=a133_0x8c5550[_0x48f258(0x1b1)](_0x307ef8,_0x48f258(0x189));_0x2a4d50[_0x48f258(0x1da)]({'file_name':_0x38ca1c,'text_content':_0x55e221});}}}const _0x13bb0d={..._0x509c95,'code':_0xb845d9,'files':_0x2a4d50};_0x451242[_0x48f258(0x1da)]({'name':_0x509c95[_0x48f258(0x1c3)],'path':_0x3ebafd,'def':_0x13bb0d});}}}const _0x225705=getFormInterfacesDir(_0x87f541);if(a133_0x8c5550[_0x48f258(0x229)](_0x225705)){const _0x225202=a133_0x8c5550['readdirSync'](_0x225705)[_0x48f258(0x146)](_0x16817d=>_0x16817d['endsWith'](_0x48f258(0x218)));for(const _0x1c5a9a of _0x225202){const _0x760055=a133_0xcf5d58[_0x48f258(0x1e6)](_0x225705,_0x1c5a9a),_0x3b56c8=parseFormInterfaceYaml(a133_0x8c5550[_0x48f258(0x1b1)](_0x760055,_0x48f258(0x189)),_0x760055);_0x40622e[_0x48f258(0x1da)]({'name':_0x3b56c8[_0x48f258(0x1c3)],'path':_0x760055,'yaml':_0x3b56c8});}}const _0x44192c=getChatInterfacesDir(_0x87f541);if(a133_0x8c5550[_0x48f258(0x229)](_0x44192c)){const _0x25594f=a133_0x8c5550[_0x48f258(0x1ee)](_0x44192c)[_0x48f258(0x146)](_0x1e397b=>_0x1e397b[_0x48f258(0x1b9)](_0x48f258(0x218)));for(const _0x85b321 of _0x25594f){const _0xa3e8d6=a133_0xcf5d58['join'](_0x44192c,_0x85b321),_0x15ce7e=parseChatInterfaceYaml(a133_0x8c5550[_0x48f258(0x1b1)](_0xa3e8d6,'utf-8'),_0xa3e8d6);_0x2b92c6[_0x48f258(0x1da)]({'name':_0x15ce7e['name'],'path':_0xa3e8d6,'yaml':_0x15ce7e});}}}else{const _0x52b9e1=await this[_0x48f258(0x1c5)](_0x87f541),_0x105ae9=await this[_0x48f258(0x18a)][_0x48f258(0x1d4)](_0x52b9e1);_0x3f88d0=_0x105ae9[_0x48f258(0x222)][_0x48f258(0x1c3)];const _0x5bf0a0=await this[_0x48f258(0x18a)][_0x48f258(0x1d8)](_0x52b9e1),_0x18f8b9=await this[_0x48f258(0x18a)][_0x48f258(0x183)](_0x52b9e1),_0x31908e=await this['client'][_0x48f258(0x239)](_0x52b9e1),_0x5e4226=await this['client'][_0x48f258(0x21e)](_0x52b9e1),_0x3fdd9d=await this['client']['listIntegrations'](_0x52b9e1),_0x3a32e0=await safeListOrEmpty(()=>this['client'][_0x48f258(0x1a0)](_0x52b9e1)),_0x44cb2b=await safeListOrEmpty(()=>this[_0x48f258(0x18a)]['listExperimentalArtifacts'](_0x52b9e1)),_0x148fb2=new Map(),_0x15e18c=new Map(),_0x5e7706=new Map(),_0x38c672=new Map(),_0x383a93=new Map(),_0x3c66dc=new Map();for(const _0x38d1e1 of _0x18f8b9){_0x148fb2[_0x48f258(0x199)](_0x38d1e1['id'],_0x38d1e1['attributes'][_0x48f258(0x1c3)]);}for(const _0x54c6c1 of _0x31908e){_0x15e18c[_0x48f258(0x199)](_0x54c6c1['id'],_0x54c6c1[_0x48f258(0x222)][_0x48f258(0x1c3)]);}for(const _0x2bbc0c of _0x5bf0a0){_0x5e7706[_0x48f258(0x199)](_0x2bbc0c['id'],_0x2bbc0c[_0x48f258(0x222)]['name']);}for(const _0x179256 of _0x5e4226){_0x38c672['set'](_0x179256['id'],_0x179256[_0x48f258(0x222)]['name']);}for(const _0x1d238f of _0x3a32e0){_0x383a93[_0x48f258(0x199)](_0x1d238f['id'],_0x1d238f[_0x48f258(0x222)][_0x48f258(0x1c3)]);}for(const _0x24ba4e of _0x44cb2b){_0x3c66dc[_0x48f258(0x199)](_0x24ba4e['id'],_0x24ba4e['attributes'][_0x48f258(0x1c3)]);}const _0x4c7cfd={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x148fb2,'TextKnowledgeBase':_0x15e18c,'Agent':_0x5e7706,'ExperimentalKnowledgeBase':_0x383a93}),'resolvePromptName':async _0x32521f=>_0x38c672[_0x48f258(0x249)](_0x32521f),'onWarning':_0x2d143c=>this[_0x48f258(0x157)][_0x48f258(0x14b)](_0x2d143c)};for(const _0x340920 of _0x5bf0a0){const _0x2eda91=await agentResponseToDef(_0x340920,_0x4c7cfd),{yaml:_0x22641c,systemPrompt:_0x3083b4,starterMessage:_0x398ea0}=_0x2eda91;_0x7c8a5['push']({'name':_0x22641c[_0x48f258(0x1c3)],'dir':'','yaml':_0x22641c,'systemPrompt':_0x3083b4,'starterMessage':_0x398ea0});}for(const _0x422332 of _0x18f8b9){const _0x16aa24=apiKnowledgeBaseToYaml(_0x422332);_0x2513fd[_0x48f258(0x1da)]({'name':_0x16aa24[_0x48f258(0x1c3)],'path':'','yaml':_0x16aa24});}for(const _0x5679fe of _0x31908e){_0x3cc725[_0x48f258(0x1da)]({'name':_0x5679fe['attributes'][_0x48f258(0x1c3)],'path':'','text':_0x5679fe['attributes'][_0x48f258(0x248)]});}for(const _0x30a779 of _0x5e4226){const _0x1d7011=await apiPromptToYaml(_0x30a779,_0x4c7cfd);_0x1d7011&&_0x526bdd[_0x48f258(0x1da)]({'name':_0x1d7011[_0x48f258(0x1c3)],'path':'','yaml':_0x1d7011});}for(const _0x3c162a of _0x3fdd9d){if(!_0x3c162a[_0x48f258(0x222)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x48f258(0x16a)](_0x3c162a['attributes']['serviceType'][_0x48f258(0x153)]())){const _0x5c8d4d=await apiIntegrationToYaml(_0x3c162a,_0x4c7cfd);_0x9fd8b5['push']({'name':_0x3c162a['attributes']['serviceType'][_0x48f258(0x153)](),'path':'','yaml':_0x5c8d4d});}}for(const _0x35b075 of _0x3a32e0){const _0x55cccb=apiExperimentalKnowledgeBaseToYaml(_0x35b075);_0x1355c9[_0x48f258(0x1da)]({'name':_0x55cccb[_0x48f258(0x1c3)],'path':'','def':_0x55cccb});}for(const _0x133677 of _0x44cb2b){const _0x1319b4=apiExperimentalArtifactToYaml(_0x133677);_0x451242['push']({'name':_0x1319b4[_0x48f258(0x1c3)],'path':'','def':_0x1319b4});}const _0x273eb2=await safeListOrEmpty(()=>this['client'][_0x48f258(0x142)](_0x52b9e1));for(const _0x581d6e of _0x273eb2){const _0x18b6a1=await apiFormInterfaceToYaml(_0x581d6e,_0x4c7cfd);_0x40622e[_0x48f258(0x1da)]({'name':_0x18b6a1[_0x48f258(0x1c3)],'path':'','yaml':_0x18b6a1});}const _0x50804e=await safeListOrEmpty(()=>this['client'][_0x48f258(0x223)](_0x52b9e1));for(const _0x265218 of _0x50804e){if(_0x265218[_0x48f258(0x222)][_0x48f258(0x18b)])continue;const _0x57a75b=await apiChatInterfaceToYaml(_0x265218,_0x4c7cfd);_0x2b92c6[_0x48f258(0x1da)]({'name':_0x57a75b[_0x48f258(0x1c3)],'path':'','yaml':_0x57a75b});}}const _0x383e61={'sourceProjectName':_0x3f88d0,'newProjectName':_0x266a35,'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}}},_0x4bfa28=await this[_0x48f258(0x18a)]['listProjects'](),_0x4474c8=_0x4bfa28['find'](_0x56a727=>_0x56a727[_0x48f258(0x222)][_0x48f258(0x1c3)]===_0x266a35);if(_0x4474c8)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x48f258(0x1d6)+_0x266a35+_0x48f258(0x206),undefined,{'helpText':_0x48f258(0x22d)});if(_0x85bd8f?.[_0x48f258(0x234)])return _0x383e61[_0x48f258(0x207)]['agents'][_0x48f258(0x25c)]=_0x7c8a5[_0x48f258(0x212)],_0x383e61[_0x48f258(0x207)][_0x48f258(0x252)][_0x48f258(0x25c)]=_0x2513fd[_0x48f258(0x212)],_0x383e61['counts'][_0x48f258(0x1a9)][_0x48f258(0x25c)]=_0x3cc725[_0x48f258(0x212)],_0x383e61[_0x48f258(0x207)][_0x48f258(0x217)]['created']=_0x1355c9[_0x48f258(0x212)],_0x383e61[_0x48f258(0x207)][_0x48f258(0x1b3)]['created']=_0x451242[_0x48f258(0x212)],_0x383e61[_0x48f258(0x207)]['prompts'][_0x48f258(0x25c)]=_0x526bdd[_0x48f258(0x212)],_0x383e61['counts']['integrations'][_0x48f258(0x25c)]=_0x9fd8b5[_0x48f258(0x212)],_0x383e61;const _0x570503=await this[_0x48f258(0x18a)][_0x48f258(0x235)]({'name':_0x266a35}),_0x159ed9=_0x570503['id'];_0x383e61['newProjectId']=_0x159ed9;const _0x4aeb84=new Map(),_0x1e7ddc=new Map(),_0x2ab314=new Map(),_0x5d145b=new Map(),_0x2672f1=new Map(),_0x1fdfff=new Map(),_0x31756e=new Map(),_0x534df5=new Map(),_0x499be1=new Set(),_0x335729=new Set();for(const _0x36f665 of _0x7c8a5){for(const _0x19b239 of _0x36f665[_0x48f258(0x1d3)][_0x48f258(0x188)]||[]){if(_0x19b239[_0x48f258(0x23b)]===_0x48f258(0x1c4)&&_0x19b239[_0x48f258(0x1b7)]){const _0x532b9a=parseRef(_0x19b239[_0x48f258(0x1b7)]);if(_0x532b9a)_0x499be1[_0x48f258(0x228)](_0x532b9a[_0x48f258(0x1c3)]);}else{if(_0x19b239[_0x48f258(0x23b)]===_0x48f258(0x1df)&&_0x19b239[_0x48f258(0x1b7)]){const _0x21c661=parseRef(_0x19b239[_0x48f258(0x1b7)]);if(_0x21c661)_0x335729[_0x48f258(0x228)](_0x21c661[_0x48f258(0x1c3)]);}}}}for(const _0x46519a of _0x499be1){try{const _0x599118=await this['client'][_0x48f258(0x1cc)]({'projectId':_0x159ed9,'name':_0x46519a});_0x2672f1[_0x48f258(0x199)](_0x46519a,_0x599118['id']),_0x383e61[_0x48f258(0x242)][_0x48f258(0x1da)]({'name':_0x46519a,'action':_0x48f258(0x25c),'id':_0x599118['id']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x242)][_0x48f258(0x25c)]++;}catch(_0x41da4f){_0x383e61[_0x48f258(0x242)][_0x48f258(0x1da)]({'name':_0x46519a,'action':'error','error':_0x41da4f[_0x48f258(0x250)]}),_0x383e61[_0x48f258(0x207)]['imageGenerators'][_0x48f258(0x156)]++;}}for(const _0xee1ae4 of _0x335729){try{const _0x916a2f=await this[_0x48f258(0x18a)][_0x48f258(0x1f3)]({'projectId':_0x159ed9,'name':_0xee1ae4});_0x1fdfff[_0x48f258(0x199)](_0xee1ae4,_0x916a2f['id']),_0x383e61[_0x48f258(0x221)][_0x48f258(0x1da)]({'name':_0xee1ae4,'action':_0x48f258(0x25c),'id':_0x916a2f['id']}),_0x383e61[_0x48f258(0x207)]['webSearchTools'][_0x48f258(0x25c)]++;}catch(_0x466570){_0x383e61[_0x48f258(0x221)][_0x48f258(0x1da)]({'name':_0xee1ae4,'action':_0x48f258(0x171),'error':_0x466570[_0x48f258(0x250)]}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x221)][_0x48f258(0x156)]++;}}const _0x60542=await fetchAllToolTargetMaps((_0x32aa25,_0x4724ff)=>this[_0x48f258(0x18a)][_0x48f258(0x24b)](_0x32aa25,_0x4724ff),_0x159ed9);let _0x4b17e2=[];const _0x238954={'projectId':_0x159ed9,'resolveToolTargetId':buildIdResolver({..._0x60542[_0x48f258(0x23f)],'KnowledgeBase':_0x4aeb84,'TextKnowledgeBase':_0x1e7ddc,'ExperimentalKnowledgeBase':_0x31756e,'Agent':_0x2ab314,'WebSearchTool':_0x1fdfff,'ImageGenerator':_0x2672f1}),'resolvePromptId':async _0x143719=>_0x5d145b['get'](_0x143719),'onWarning':_0xb73f5e=>{const _0x5b4e5e=_0x48f258;this[_0x5b4e5e(0x157)][_0x5b4e5e(0x14b)](_0xb73f5e),_0x4b17e2[_0x5b4e5e(0x1da)](_0xb73f5e);}};for(const _0x3dc971 of _0x2513fd){try{const _0x372c18=yamlKnowledgeBaseToApi(_0x3dc971[_0x48f258(0x1d3)],_0x159ed9),_0x4483c5=await this[_0x48f258(0x18a)][_0x48f258(0x1f2)](_0x372c18);_0x4aeb84[_0x48f258(0x199)](_0x3dc971[_0x48f258(0x1d3)]['name'],_0x4483c5['id']),_0x383e61[_0x48f258(0x252)]['push']({'name':_0x3dc971[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':_0x48f258(0x25c),'id':_0x4483c5['id']}),_0x383e61['counts'][_0x48f258(0x252)][_0x48f258(0x25c)]++;}catch(_0xd47e21){_0x383e61[_0x48f258(0x252)][_0x48f258(0x1da)]({'name':_0x3dc971[_0x48f258(0x1d3)]['name'],'action':_0x48f258(0x171),'error':_0xd47e21[_0x48f258(0x250)]}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x252)][_0x48f258(0x156)]++;}}for(const _0x4e6f05 of _0x3cc725){try{const _0x54b005=yamlTextKnowledgeBaseToApi({'name':_0x4e6f05[_0x48f258(0x1c3)],'text':_0x4e6f05['text']},_0x159ed9),_0x19f324=await this[_0x48f258(0x18a)]['createTextKnowledgeBase'](_0x54b005);_0x1e7ddc[_0x48f258(0x199)](_0x4e6f05['name'],_0x19f324['id']),_0x383e61[_0x48f258(0x1a9)][_0x48f258(0x1da)]({'name':_0x4e6f05[_0x48f258(0x1c3)],'action':_0x48f258(0x25c),'id':_0x19f324['id']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x1a9)][_0x48f258(0x25c)]++;}catch(_0x5793e7){_0x383e61[_0x48f258(0x1a9)]['push']({'name':_0x4e6f05[_0x48f258(0x1c3)],'action':_0x48f258(0x171),'error':_0x5793e7[_0x48f258(0x250)]}),_0x383e61['counts'][_0x48f258(0x1a9)][_0x48f258(0x156)]++;}}for(const _0x1c0d6f of _0x451242){try{const _0xf5f8df=yamlExperimentalArtifactToApi(_0x1c0d6f[_0x48f258(0x22b)],_0x159ed9),_0x265a5e=await this[_0x48f258(0x18a)][_0x48f258(0x1a6)](_0xf5f8df);_0x534df5[_0x48f258(0x199)](_0x1c0d6f[_0x48f258(0x22b)]['name'],_0x265a5e['id']),_0x383e61[_0x48f258(0x1b3)][_0x48f258(0x1da)]({'name':_0x1c0d6f[_0x48f258(0x22b)]['name'],'action':_0x48f258(0x25c),'id':_0x265a5e['id']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x1b3)]['created']++;}catch(_0x4765e1){_0x383e61['experimentalArtifacts'][_0x48f258(0x1da)]({'name':_0x1c0d6f[_0x48f258(0x22b)]['name'],'action':'error','error':_0x4765e1['message']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x1b3)][_0x48f258(0x156)]++;}}for(const _0x3075ad of _0x1355c9){try{const _0x1ffb57=yamlExperimentalKnowledgeBaseToApi(_0x3075ad[_0x48f258(0x22b)],_0x159ed9),_0x287828=await this[_0x48f258(0x18a)][_0x48f258(0x20f)](_0x1ffb57);_0x31756e[_0x48f258(0x199)](_0x3075ad[_0x48f258(0x22b)]['name'],_0x287828['id']),_0x383e61['experimentalKnowledgeBases'][_0x48f258(0x1da)]({'name':_0x3075ad[_0x48f258(0x22b)][_0x48f258(0x1c3)],'action':_0x48f258(0x25c),'id':_0x287828['id']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x217)][_0x48f258(0x25c)]++;}catch(_0x2ff152){_0x383e61[_0x48f258(0x217)][_0x48f258(0x1da)]({'name':_0x3075ad[_0x48f258(0x22b)][_0x48f258(0x1c3)],'action':_0x48f258(0x171),'error':_0x2ff152['message']}),_0x383e61[_0x48f258(0x207)]['experimentalKnowledgeBases'][_0x48f258(0x156)]++;}}const _0x94f891=[..._0x7c8a5][_0x48f258(0x23a)]((_0x47a8b2,_0x25f837)=>{const _0x2a79af=_0x48f258,_0x260d71=_0x47a8b2[_0x2a79af(0x1d3)][_0x2a79af(0x188)]?.[_0x2a79af(0x1f0)](_0x14e857=>_0x14e857[_0x2a79af(0x23b)]==='agent')??![],_0x19b886=_0x25f837[_0x2a79af(0x1d3)]['tools']?.[_0x2a79af(0x1f0)](_0xba3f2d=>_0xba3f2d[_0x2a79af(0x23b)]===_0x2a79af(0x25e))??![];if(_0x260d71&&!_0x19b886)return 0x1;if(!_0x260d71&&_0x19b886)return-0x1;return 0x0;});for(const _0x4d215b of _0x94f891){_0x4b17e2=[];try{const _0x3ce3de=_0x4d215b[_0x48f258(0x1d3)][_0x48f258(0x188)]?.[_0x48f258(0x146)](_0x3338bb=>{const _0x47b06b=_0x48f258;if(_0x3338bb[_0x47b06b(0x23b)]==='agent'&&_0x3338bb['target']){const _0x5c0ff0=parseRef(_0x3338bb[_0x47b06b(0x1b7)]);return _0x5c0ff0?.[_0x47b06b(0x1c3)]===_0x4d215b[_0x47b06b(0x1d3)][_0x47b06b(0x1c3)];}return![];})??[];if(_0x3ce3de['length']>0x0){const _0x52f9c0=_0x48f258(0x1c2)+_0x4d215b[_0x48f258(0x1d3)][_0x48f258(0x1c3)]+_0x48f258(0x21a)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this['logger'][_0x48f258(0x14b)](_0x52f9c0),_0x4b17e2[_0x48f258(0x1da)](_0x52f9c0);}const _0x2bad42=await agentDefToRequest(_0x4d215b[_0x48f258(0x1d3)],_0x4d215b[_0x48f258(0x16f)],_0x4d215b[_0x48f258(0x1ae)],_0x238954),_0x38254b=await this[_0x48f258(0x18a)][_0x48f258(0x1eb)](_0x2bad42);_0x2ab314[_0x48f258(0x199)](_0x4d215b[_0x48f258(0x1d3)][_0x48f258(0x1c3)],_0x38254b['id']),_0x383e61[_0x48f258(0x1e7)][_0x48f258(0x1da)]({'agentName':_0x4d215b[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':'created','agentId':_0x38254b['id'],'warnings':_0x4b17e2['length']>0x0?_0x4b17e2:undefined}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x1e7)][_0x48f258(0x25c)]++;}catch(_0x100623){_0x383e61[_0x48f258(0x1e7)][_0x48f258(0x1da)]({'agentName':_0x4d215b[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':_0x48f258(0x171),'error':_0x100623[_0x48f258(0x250)],'warnings':_0x4b17e2[_0x48f258(0x212)]>0x0?_0x4b17e2:undefined}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x1e7)][_0x48f258(0x156)]++;}}for(const _0x268c63 of _0x526bdd){try{const _0x3625b5=await yamlPromptToApi(_0x268c63['yaml'],_0x159ed9,_0x238954);if(!_0x3625b5){_0x383e61[_0x48f258(0x236)]['push']({'name':_0x268c63[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':'error','error':'Agent\x20reference\x20not\x20found'}),_0x383e61[_0x48f258(0x207)]['prompts'][_0x48f258(0x156)]++;continue;}const _0x1dd4d5=await this['client']['createPrompt'](_0x3625b5);_0x5d145b[_0x48f258(0x199)](_0x268c63[_0x48f258(0x1d3)][_0x48f258(0x1c3)],_0x1dd4d5['id']),_0x383e61[_0x48f258(0x236)][_0x48f258(0x1da)]({'name':_0x268c63[_0x48f258(0x1d3)]['name'],'action':'created','id':_0x1dd4d5['id']}),_0x383e61[_0x48f258(0x207)]['prompts'][_0x48f258(0x25c)]++;}catch(_0x24d1d3){_0x383e61[_0x48f258(0x236)]['push']({'name':_0x268c63[_0x48f258(0x1d3)]['name'],'action':_0x48f258(0x171),'error':_0x24d1d3['message']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x236)][_0x48f258(0x156)]++;}}for(const _0x10d3cf of _0x9fd8b5){try{const _0x3a0ca9=await yamlIntegrationToApi(_0x10d3cf[_0x48f258(0x1d3)],_0x159ed9,_0x238954),_0x3f8999=await this[_0x48f258(0x18a)][_0x48f258(0x25b)](_0x3a0ca9);_0x383e61[_0x48f258(0x25a)][_0x48f258(0x1da)]({'name':_0x10d3cf[_0x48f258(0x1d3)][_0x48f258(0x21d)],'action':_0x48f258(0x25c),'id':_0x3f8999['id']}),_0x383e61[_0x48f258(0x207)]['integrations'][_0x48f258(0x25c)]++;}catch(_0x2fd664){_0x383e61[_0x48f258(0x25a)][_0x48f258(0x1da)]({'name':_0x10d3cf['yaml'][_0x48f258(0x21d)],'action':_0x48f258(0x171),'error':_0x2fd664[_0x48f258(0x250)]}),_0x383e61[_0x48f258(0x207)]['integrations'][_0x48f258(0x156)]++;}}for(const _0x4078c5 of _0x40622e){try{const _0x5dec43=await yamlFormInterfaceToApi(_0x4078c5[_0x48f258(0x1d3)],_0x159ed9,_0x238954);if(!_0x5dec43){_0x383e61[_0x48f258(0x178)][_0x48f258(0x1da)]({'name':_0x4078c5[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':'error','error':_0x48f258(0x1a8)}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x178)][_0x48f258(0x156)]++;continue;}const _0x3b335a=await this['client'][_0x48f258(0x22c)](_0x5dec43);_0x383e61[_0x48f258(0x178)][_0x48f258(0x1da)]({'name':_0x4078c5['yaml']['name'],'action':_0x48f258(0x25c),'id':_0x3b335a['id']}),_0x383e61['counts'][_0x48f258(0x178)][_0x48f258(0x25c)]++;}catch(_0x410266){_0x383e61['formInterfaces']['push']({'name':_0x4078c5[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':_0x48f258(0x171),'error':_0x410266['message']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x178)]['errors']++;}}for(const _0x569b06 of _0x2b92c6){try{const _0x458ec5=await yamlChatInterfaceToApi(_0x569b06[_0x48f258(0x1d3)],_0x159ed9,_0x238954),_0x2bb149=await this[_0x48f258(0x18a)][_0x48f258(0x13d)](_0x458ec5);_0x383e61[_0x48f258(0x247)][_0x48f258(0x1da)]({'name':_0x569b06['yaml'][_0x48f258(0x1c3)],'action':_0x48f258(0x25c),'id':_0x2bb149['id']}),_0x383e61['counts'][_0x48f258(0x247)][_0x48f258(0x25c)]++;}catch(_0x4439c7){_0x383e61[_0x48f258(0x247)][_0x48f258(0x1da)]({'name':_0x569b06[_0x48f258(0x1d3)]['name'],'action':_0x48f258(0x171),'error':_0x4439c7[_0x48f258(0x250)]}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x247)]['errors']++;}}return _0x383e61;}}