@treasuredata/tdx 2026.6.1 → 2026.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/cas-command.js +1 -1
  13. package/dist/commands/cas-segment-command.js +1 -1
  14. package/dist/commands/chat-command.js +1 -1
  15. package/dist/commands/claude-command.js +1 -1
  16. package/dist/commands/claude-command.js.map +1 -1
  17. package/dist/commands/claude-statusline-command.js +1 -1
  18. package/dist/commands/claude-usage-command.js +1 -1
  19. package/dist/commands/command.js +1 -1
  20. package/dist/commands/connection-command.js +1 -1
  21. package/dist/commands/databases.js +1 -1
  22. package/dist/commands/delivery-command.js +1 -1
  23. package/dist/commands/describe.js +1 -1
  24. package/dist/commands/engage-campaign-pull-command.js +1 -1
  25. package/dist/commands/engage-campaign-push-command.js +1 -1
  26. package/dist/commands/engage-campaign-validate-command.js +1 -1
  27. package/dist/commands/engage-command.js +1 -1
  28. package/dist/commands/engage-template-pull-command.js +1 -1
  29. package/dist/commands/engage-template-push-command.js +1 -1
  30. package/dist/commands/engage-template-validate-command.js +1 -1
  31. package/dist/commands/job-command.js +1 -1
  32. package/dist/commands/journey-command.js +1 -1
  33. package/dist/commands/journey-validate-command.js +1 -1
  34. package/dist/commands/llm-command.js +1 -1
  35. package/dist/commands/mcp-command.js +1 -1
  36. package/dist/commands/parent-segment-command.js +1 -1
  37. package/dist/commands/policy-command.js +1 -1
  38. package/dist/commands/profile-command.js +1 -1
  39. package/dist/commands/profiles-command.js +1 -1
  40. package/dist/commands/query-command.js +1 -1
  41. package/dist/commands/schedule-command.js +1 -1
  42. package/dist/commands/segment-command.js +1 -1
  43. package/dist/commands/segment-create-command.js +1 -1
  44. package/dist/commands/segment-fields-command.js +1 -1
  45. package/dist/commands/segment-pull-command.js +1 -1
  46. package/dist/commands/segment-push-command.js +1 -1
  47. package/dist/commands/segment-update-command.js +1 -1
  48. package/dist/commands/segment-use-command.js +1 -1
  49. package/dist/commands/segment-validate-command.js +1 -1
  50. package/dist/commands/segments.js +1 -1
  51. package/dist/commands/show.js +1 -1
  52. package/dist/commands/status-command.js +1 -1
  53. package/dist/commands/table-deleted.js +1 -1
  54. package/dist/commands/tables.js +1 -1
  55. package/dist/commands/unset-command.js +1 -1
  56. package/dist/commands/upgrade-command.js +1 -1
  57. package/dist/commands/use-command.js +1 -1
  58. package/dist/commands/user-command.js +1 -1
  59. package/dist/commands/work-command.js +1 -1
  60. package/dist/commands/workflow-command.d.ts +2 -2
  61. package/dist/commands/workflow-command.d.ts.map +1 -1
  62. package/dist/commands/workflow-command.js +1 -1
  63. package/dist/commands/workflow-command.js.map +1 -1
  64. package/dist/core/auth.js +1 -1
  65. package/dist/core/command-output.js +1 -1
  66. package/dist/core/config.js +1 -1
  67. package/dist/core/connection-cache.js +1 -1
  68. package/dist/core/constants.js +1 -1
  69. package/dist/core/credential-cache.js +1 -1
  70. package/dist/core/global-context.js +1 -1
  71. package/dist/core/keychain.js +1 -1
  72. package/dist/core/oauth-keychain.js +1 -1
  73. package/dist/core/oauth.js +1 -1
  74. package/dist/core/profile.js +1 -1
  75. package/dist/core/project-config.js +1 -1
  76. package/dist/core/session.js +1 -1
  77. package/dist/core/user-cache.js +1 -1
  78. package/dist/core/version.js +1 -1
  79. package/dist/index.js +1 -1
  80. package/dist/mcp/server.js +1 -1
  81. package/dist/mcp/tools/index.js +1 -1
  82. package/dist/mcp/tools/tdx-run.js +1 -1
  83. package/dist/mcp/tools/tdx-search.js +1 -1
  84. package/dist/mcp/tools/work-create-item.js +1 -1
  85. package/dist/mcp/utils.js +1 -1
  86. package/dist/proxy/claude-usage-tracker.js +1 -1
  87. package/dist/proxy/passthrough-server.js +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.d.ts +23 -1
  116. package/dist/sdk/client/workflow-client.d.ts.map +1 -1
  117. package/dist/sdk/client/workflow-client.js +1 -1
  118. package/dist/sdk/client/workflow-client.js.map +1 -1
  119. package/dist/sdk/connection-validator.js +1 -1
  120. package/dist/sdk/connection.js +1 -1
  121. package/dist/sdk/delivery.js +1 -1
  122. package/dist/sdk/engage/campaign-pull.js +1 -1
  123. package/dist/sdk/engage/campaign-push.js +1 -1
  124. package/dist/sdk/engage/campaign-validator.js +1 -1
  125. package/dist/sdk/engage/campaign-yaml.js +1 -1
  126. package/dist/sdk/engage/template-pull.js +1 -1
  127. package/dist/sdk/engage/template-push.js +1 -1
  128. package/dist/sdk/engage/template-validator.js +1 -1
  129. package/dist/sdk/engage/template-yaml.js +1 -1
  130. package/dist/sdk/engage/types/campaign-def.js +1 -1
  131. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  132. package/dist/sdk/engage/types/template-schema.js +1 -1
  133. package/dist/sdk/engage.js +1 -1
  134. package/dist/sdk/errors.js +1 -1
  135. package/dist/sdk/index.js +1 -1
  136. package/dist/sdk/io/index.js +1 -1
  137. package/dist/sdk/io/node-filesystem.js +1 -1
  138. package/dist/sdk/job.js +1 -1
  139. package/dist/sdk/journey.js +1 -1
  140. package/dist/sdk/llm/chat-cache.js +1 -1
  141. package/dist/sdk/llm/index.js +1 -1
  142. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  143. package/dist/sdk/llm/model-factors.js +1 -1
  144. package/dist/sdk/llm/user-settings.js +1 -1
  145. package/dist/sdk/personalization.js +1 -1
  146. package/dist/sdk/policy.js +1 -1
  147. package/dist/sdk/query/deleted-table-validation.js +1 -1
  148. package/dist/sdk/query/index.js +1 -1
  149. package/dist/sdk/query/sql-parser.js +1 -1
  150. package/dist/sdk/realtime.js +1 -1
  151. package/dist/sdk/schedule.js +1 -1
  152. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  153. package/dist/sdk/segment/fields-display.js +1 -1
  154. package/dist/sdk/segment/file-discovery.js +1 -1
  155. package/dist/sdk/segment/journey-utils.js +1 -1
  156. package/dist/sdk/segment/journey-validator.js +1 -1
  157. package/dist/sdk/segment/journey-yaml.js +1 -1
  158. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  159. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  160. package/dist/sdk/segment/pull-workflow.js +1 -1
  161. package/dist/sdk/segment/push-recovery.js +1 -1
  162. package/dist/sdk/segment/push-workflow.js +1 -1
  163. package/dist/sdk/segment/resolution-context.js +1 -1
  164. package/dist/sdk/segment/segment-path-parser.js +1 -1
  165. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  166. package/dist/sdk/segment/segment-validator.js +1 -1
  167. package/dist/sdk/segment/target-resolution.js +1 -1
  168. package/dist/sdk/segment/tdx-config.js +1 -1
  169. package/dist/sdk/segment/types/activation-schema.js +1 -1
  170. package/dist/sdk/segment/types/journey-def.js +1 -1
  171. package/dist/sdk/segment/types/journey-schema.js +1 -1
  172. package/dist/sdk/segment/types/segment-def.js +1 -1
  173. package/dist/sdk/segment/types/segment-schema.js +1 -1
  174. package/dist/sdk/segment/validate-files.js +1 -1
  175. package/dist/sdk/segment/yaml-validator.js +1 -1
  176. package/dist/sdk/segment.js +1 -1
  177. package/dist/sdk/types/index.js +1 -1
  178. package/dist/sdk/types/progress.js +1 -1
  179. package/dist/sdk/types/workflow.d.ts +1 -1
  180. package/dist/sdk/types/workflow.d.ts.map +1 -1
  181. package/dist/sdk/types/workspace.js +1 -1
  182. package/dist/sdk/user.js +1 -1
  183. package/dist/sdk/util/format-detector.js +1 -1
  184. package/dist/sdk/util/formatters.js +1 -1
  185. package/dist/sdk/util/index.js +1 -1
  186. package/dist/sdk/util/paginate.js +1 -1
  187. package/dist/sdk/util/tree-formatter.js +1 -1
  188. package/dist/sdk/workflow/archive-validation.js +1 -1
  189. package/dist/sdk/workflow/clone-workflow.js +1 -1
  190. package/dist/sdk/workflow/index.d.ts +23 -2
  191. package/dist/sdk/workflow/index.d.ts.map +1 -1
  192. package/dist/sdk/workflow/index.js +1 -1
  193. package/dist/sdk/workflow/index.js.map +1 -1
  194. package/dist/sdk/workflow/pull-workflow.js +1 -1
  195. package/dist/sdk/workflow/push-workflow.d.ts +4 -0
  196. package/dist/sdk/workflow/push-workflow.d.ts.map +1 -1
  197. package/dist/sdk/workflow/push-workflow.js +1 -1
  198. package/dist/sdk/workflow/push-workflow.js.map +1 -1
  199. package/dist/sdk/workflow/task-graph.js +1 -1
  200. package/dist/sdk/workflow/tdx-config.js +1 -1
  201. package/dist/sdk/workflow/workflow-utils.js +1 -1
  202. package/dist/sdk/workspace/access-tracker.js +1 -1
  203. package/dist/sdk/workspace/frontmatter.js +1 -1
  204. package/dist/sdk/workspace/git.js +1 -1
  205. package/dist/sdk/workspace/index.js +1 -1
  206. package/dist/sdk/workspace/templates.js +1 -1
  207. package/dist/sdk/workspace/weekly.js +1 -1
  208. package/dist/sdk/workspace/wikilinks.js +1 -1
  209. package/dist/test-utils/command-runner.js +1 -1
  210. package/dist/test-utils/factories.js +1 -1
  211. package/dist/test-utils/fixtures.js +1 -1
  212. package/dist/test-utils/http-mock.js +1 -1
  213. package/dist/test-utils/index.js +1 -1
  214. package/dist/utils/async.js +1 -1
  215. package/dist/utils/colors.js +1 -1
  216. package/dist/utils/diff.js +1 -1
  217. package/dist/utils/file-permissions.js +1 -1
  218. package/dist/utils/file-reader.js +1 -1
  219. package/dist/utils/github-releases.js +1 -1
  220. package/dist/utils/global-cache.js +1 -1
  221. package/dist/utils/json-loader.js +1 -1
  222. package/dist/utils/local-cache.js +1 -1
  223. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  224. package/dist/utils/logger/formatters/index.js +1 -1
  225. package/dist/utils/logger/handlers/console-handler.js +1 -1
  226. package/dist/utils/logger/handlers/file-handler.js +1 -1
  227. package/dist/utils/logger/handlers/index.js +1 -1
  228. package/dist/utils/logger/handlers/null-handler.js +1 -1
  229. package/dist/utils/logger/index.js +1 -1
  230. package/dist/utils/logger/logger.js +1 -1
  231. package/dist/utils/logger/types.js +1 -1
  232. package/dist/utils/option-validation.js +1 -1
  233. package/dist/utils/process.js +1 -1
  234. package/dist/utils/prompt.js +1 -1
  235. package/dist/utils/spinner.js +1 -1
  236. package/dist/utils/sse-parser.js +1 -1
  237. package/dist/utils/string-utils.js +1 -1
  238. package/dist/utils/table-ref-parser.js +1 -1
  239. package/dist/utils/tdx-logger.js +1 -1
  240. package/dist/utils/version-check.js +1 -1
  241. package/package.json +1 -1
@@ -1 +1 @@
1
- const a134_0x5ec437=a134_0x2de3;(function(_0x589373,_0x2e91e4){const _0x764bea=a134_0x2de3,_0x19d80d=_0x589373();while(!![]){try{const _0x269f0d=parseInt(_0x764bea(0x24d))/0x1*(parseInt(_0x764bea(0x1b4))/0x2)+parseInt(_0x764bea(0x242))/0x3+parseInt(_0x764bea(0x274))/0x4+-parseInt(_0x764bea(0x1bb))/0x5+-parseInt(_0x764bea(0x270))/0x6*(-parseInt(_0x764bea(0x221))/0x7)+-parseInt(_0x764bea(0x25d))/0x8*(-parseInt(_0x764bea(0x17f))/0x9)+-parseInt(_0x764bea(0x17e))/0xa;if(_0x269f0d===_0x2e91e4)break;else _0x19d80d['push'](_0x19d80d['shift']());}catch(_0x4e3887){_0x19d80d['push'](_0x19d80d['shift']());}}}(a134_0x13da,0xb1012));import{LLMApiClient}from'../client/llm-api-client.js';import*as a134_0x2f02d2 from'node:fs';import*as a134_0x591fe4 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{toModelInfos}from'./user-settings.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';function a134_0x13da(){const _0x470b6d=['message','listFormInterfaces','listExperimentalArtifacts','none','new','\x0a---\x20schema:\x20','Renamed\x20agent\x20folder:\x20','info','17547620MdiEdJ','681507hzSXPf','text','setDefaultAgent','_reasoning_','getOrCreateDefaultAgent','chatWelcomeMessage','parse','createAgentResponse','chat_generic','Project\x20not\x20found:\x20','pullProject','getChatLog','experimental_artifacts','prompts.json','toLowerCase','AGENT_NOT_FOUND','Renamed\x20chat\x20interface\x20file:\x20','renamed','\x0a\x0a#\x20agent.yml\x0a','mkdirSync','claude-4.5-sonnet','\x20---\x0a','\x0a---\x20code\x20---\x0a','integrations','isDirectory','slackMessageMode','createIntegration','\x27\x20(','integrations.json','startChat','createTextKnowledgeBase','promptId','warn','No\x20tdx.json\x20found\x20in\x20','basename','Removed\x20deleted\x20directory:\x20','site','projectId','llm_project','TextKnowledgeBase','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','ALREADY_EXISTS','history','pushProject','tdDatabaseName','imageGenerators','tdx_default_','agentId','dryRun','Multiple\x20agents\x20found\x20with\x20name\x20\x27','form_interfaces','length',')\x20can\x20be\x20pushed.\x20','104354ZMyUQB','models','pullAgent','cwd','signal','chatId','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','6860495wYrlYf','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','total','Project\x20\x22','actions','createWebSearchTool','Only\x20safe\x20types\x20(','listKnowledgeBases','modelType','already\x20exists','pushAgent','prompt.md','name','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','continueChat','attributes','status','getOrCreateDefaultProject','listTextKnowledgeBases','INVALID_ARGUMENT','starter_message.md','existsSync','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','files','createFormInterface','type','createKnowledgeBase','listImageGenerators','createExperimentalKnowledgeBase','template','tdx.json','minimal','Renamed\x20form\x20interface\x20file:\x20','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','readdirSync','error','createProject',')\x20can\x20be\x20cloned.','size','tdx_','Agent\x20reference\x20not\x20found','resolveAgentId','deleteAgent','(dry-run)','LLM_PROJECT_NOT_FOUND','errors','Backup\x20folder\x20not\x20found:\x20','updateKnowledgeBase','exportedFrom','medium','includes','---\x20schema:\x20','web_search','getUserSettings','split','map','getDefaultProjectName','knowledge_bases','deleteProject','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','Unresolved\x20dependencies:\x20','chatInfo','Unable\x20to\x20create\x20project\x20after\x20','agent','agents','high','Could\x20not\x20resolve\x20agent\x20reference','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','logger','listExperimentalKnowledgeBases','target','utf-8','sdk.llm','listToolTargets','conflict','.llm','Agent\x20\x27','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','agentsFull','starterMessage','writeFileSync','counts','backupProject','Renamed\x20prompt\x20file:\x20','isFile','profile','INTERNAL','version','chats','maxToolIterations','createExperimentalArtifact','currentProjectId','project','listAgents','\x20→\x20','---\x20file:\x20','join','resolveProjectId','chat_interfaces','prompts','readFileSync','.yml','14WXvNXR','add','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','some','restoreProject','Available\x20agents:\x20','Renamed\x20folder:\x20','service_type','experimentalArtifacts','PERMISSION_DENIED','tools','getAgent','formInterfaces','path','createImageGenerator','isDir','nameToId','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','dirname','file_name','code','listChatInterfaces','clearDefaultAgent','cloneProject','jsonSchemaHint','\x0a---\x20function:\x20','updateFormInterface','updateTextKnowledgeBase','unchanged','serviceType','deleteIntegration','push','Renamed\x20experimental\x20KB\x20directory:\x20','3135045SyyxhD','webSearchTools','listWebSearchTools','Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.','listProjects','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','toISOString','updateExperimentalArtifact','updateAgent','outputs','1.0','2cZKQjT','stringify','#\x20prompt.md\x0a','agent.yml\x20not\x20found\x20in\x20','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','def','knowledgeBases','text_content','):\x20','listIntegrations','isManaged','created','dry-run-','endsWith','\x27.\x20This\x20should\x20not\x20happen.','systemPrompt','24hLSZtL','metadata','Agent\x20not\x20found:\x20','textKnowledgeBases','find','yaml','oldPath','experimentalKnowledgeBases','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','idToName','Renamed\x20integration\x20file:\x20','context','Skipping\x20integration\x20\x27','setCurrentProject','filter','tables','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','.md','get','3472656nMoHcP','has','\x22\x20already\x20exists','getBackupMetadata','5271124zqhYMA','NOT_FOUND','client','\x20attempts\x20due\x20to\x20name\x20conflicts.','code.js','set','Invalid\x20agent\x20reference\x20format:\x20','createAgent','Unsupported\x20backup\x20version:\x20','localeCompare','listPrompts','agent.yml','rmSync','Renamed\x20KB\x20file:\x20','chatIgnoreManagedActions','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','loadJsonFile','statSync','createPrompt','functions','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','listAgentsFull','json_schema.json','knowledgebases.json','variables','chatInterfaces','sort','json_schema','agents.json','starter_message','chat_agent_console','getProject','updated','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','chat','resolveProjectName','project.json','low'];a134_0x13da=function(){return _0x470b6d;};return a134_0x13da();}import{Logger}from'../../utils/logger/index.js';function a134_0x2de3(_0xbba90,_0x480be6){_0xbba90=_0xbba90-0x159;const _0x13dac4=a134_0x13da();let _0x2de32b=_0x13dac4[_0xbba90];return _0x2de32b;}export const SAFE_INTEGRATION_TYPES=[a134_0x5ec437(0x187),a134_0x5ec437(0x16e),'chat_parent_segment'];async function safeListOrEmpty(_0x4c5551){const _0x2ec974=a134_0x5ec437;try{return await _0x4c5551();}catch(_0x241c36){if(_0x241c36 instanceof HTTPClientError&&_0x241c36[_0x2ec974(0x1cb)]===0x194)return[];throw _0x241c36;}}export class LLMSDK{[a134_0x5ec437(0x216)];[a134_0x5ec437(0x276)];[a134_0x5ec437(0x268)];[a134_0x5ec437(0x1ff)]=Logger['of'](a134_0x5ec437(0x203));constructor(_0xcb73ce){const _0x4422ac=a134_0x5ec437;this['client']=new LLMApiClient(_0xcb73ce),this[_0x4422ac(0x268)]=_0xcb73ce;}[a134_0x5ec437(0x1f3)](){const _0x23f410=a134_0x5ec437,_0x1bab55=getSanitizedUsername();return _0x23f410(0x1ad)+_0x1bab55;}async[a134_0x5ec437(0x26a)](_0x32edb8){const _0x838833=a134_0x5ec437,{projectId:_0x45177a}=await this[_0x838833(0x173)](_0x32edb8);this['currentProjectId']=_0x45177a;}['getCurrentProject'](){return this['currentProjectId'];}async[a134_0x5ec437(0x181)](_0x18f7d6){const _0xc0d333=a134_0x5ec437,_0x3de942=this['context'][_0xc0d333(0x210)];let _0xaba9ee,_0x474389;if(_0x18f7d6[_0xc0d333(0x1ed)]('/')){const _0x1f145d=_0x18f7d6[_0xc0d333(0x1f1)]('/');if(_0x1f145d[_0xc0d333(0x1b2)]!==0x2)throw new SDKError(ErrorCode[_0xc0d333(0x1ce)],_0xc0d333(0x27a)+_0x18f7d6,undefined,{'helpText':_0xc0d333(0x1ba)});const [_0x3593f3,_0x4feeca]=_0x1f145d;_0xaba9ee=await this[_0xc0d333(0x21c)](_0x3593f3),_0x474389=_0x4feeca;}else _0xaba9ee=this[_0xc0d333(0x216)]||(await this[_0xc0d333(0x1cc)]())['id'],_0x474389=_0x18f7d6;const _0x389915=await this[_0xc0d333(0x1e4)](_0x474389,_0xaba9ee),_0x360fb4=await this[_0xc0d333(0x276)][_0xc0d333(0x22c)](_0x389915);writeCachedLLMAgent(_0x360fb4[_0xc0d333(0x1ca)][_0xc0d333(0x1c7)],_0x389915,_0xaba9ee,_0x3de942);}['getDefaultAgent'](){const _0x4798f4=a134_0x5ec437,_0x53717f=this[_0x4798f4(0x268)][_0x4798f4(0x210)];return readCachedLLMAgent(_0x53717f)||undefined;}[a134_0x5ec437(0x237)](){const _0xafd5a5=a134_0x5ec437,_0x416d98=this[_0xafd5a5(0x268)][_0xafd5a5(0x210)];clearCachedLLMAgent(_0x416d98);}async[a134_0x5ec437(0x1b5)](){const _0x684fd=a134_0x5ec437,_0xae9b03=await this['client'][_0x684fd(0x1f0)]();return toModelInfos(_0xae9b03);}async[a134_0x5ec437(0x1df)](_0x457d14){const _0x1d2dbd=a134_0x5ec437;return await this['client'][_0x1d2dbd(0x1df)](_0x457d14);}async[a134_0x5ec437(0x1f5)](_0x54e7f7){const _0x2bfdf6=a134_0x5ec437,{projectId:_0x331462}=await this[_0x2bfdf6(0x173)](_0x54e7f7);await this[_0x2bfdf6(0x276)][_0x2bfdf6(0x1f5)](_0x331462);}async['projects'](_0x587af0=0x32){const _0x4be010=a134_0x5ec437;return await this['client'][_0x4be010(0x246)](_0x587af0);}async['getOrCreateDefaultProject'](_0x434ea0){const _0x301055=a134_0x5ec437,_0x1fbb3f=_0x434ea0||this[_0x301055(0x1f3)](),_0x4eab88=this[_0x301055(0x268)][_0x301055(0x210)];if(!_0x434ea0){const _0x2cdb42=readCachedLLMProject(_0x4eab88);if(_0x2cdb42&&_0x2cdb42[_0x301055(0x1c7)]===_0x1fbb3f)try{const _0x43f26b=await this[_0x301055(0x276)][_0x301055(0x16f)](_0x2cdb42['id']);if(_0x43f26b['attributes']['name']===_0x1fbb3f)return _0x43f26b;}catch{}}const _0x4a0c89=await this['client'][_0x301055(0x246)](),_0x451c4d=_0x4a0c89[_0x301055(0x261)](_0x49548a=>_0x49548a[_0x301055(0x1ca)][_0x301055(0x1c7)]===_0x1fbb3f);if(_0x451c4d)return!_0x434ea0&&writeCachedLLMProject(_0x1fbb3f,_0x451c4d['id'],_0x4eab88),_0x451c4d;const _0x1167ca=await this[_0x301055(0x276)][_0x301055(0x1df)]({'name':_0x1fbb3f,'description':'Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20'+getSanitizedUsername()+')'});return!_0x434ea0&&writeCachedLLMProject(_0x1fbb3f,_0x1167ca['id'],_0x4eab88),_0x1167ca;}async['resolveProjectId'](_0x2976e9){const _0x2005b8=a134_0x5ec437,_0x4ec51c=await this[_0x2005b8(0x276)]['listProjects'](),_0xcddae2=_0x4ec51c['filter'](_0x47c5a3=>_0x47c5a3[_0x2005b8(0x1ca)][_0x2005b8(0x1c7)]===_0x2976e9);if(_0xcddae2[_0x2005b8(0x1b2)]===0x0)throw new SDKError(ErrorCode[_0x2005b8(0x1e7)],_0x2005b8(0x188)+_0x2976e9,undefined,{'helpText':_0x2005b8(0x1dc)});if(_0xcddae2[_0x2005b8(0x1b2)]>0x1)throw new SDKError(ErrorCode[_0x2005b8(0x211)],'Multiple\x20projects\x20found\x20with\x20name\x20\x27'+_0x2976e9+_0x2005b8(0x25b));return _0xcddae2[0x0]['id'];}async[a134_0x5ec437(0x173)](_0x358195){const _0x145367=a134_0x5ec437,_0x3f06da=await this[_0x145367(0x276)]['listProjects'](),_0x2c15e1=_0x3f06da[_0x145367(0x261)](_0x53aa58=>_0x53aa58['attributes'][_0x145367(0x1c7)]===_0x358195);if(_0x2c15e1)return{'projectId':_0x2c15e1['id'],'project':_0x2c15e1};throw new SDKError(ErrorCode[_0x145367(0x1e7)],_0x145367(0x188)+_0x358195,undefined,{'helpText':_0x145367(0x1dc)});}async[a134_0x5ec437(0x183)](_0xb23203=a134_0x5ec437(0x193),_0x283a3b=0x0,_0x42df3b){const _0x2ea816=a134_0x5ec437,_0x15672b=0xa;let _0x6f458b=0x0,_0x2b98e1;while(_0x6f458b<_0x15672b){try{const _0x2044b9=await this[_0x2ea816(0x1cc)](_0x2b98e1),_0x322294=_0x2044b9['id'],_0x3fceb7=[_0x2ea816(0x179),_0x2ea816(0x1da),_0x2ea816(0x175),_0x2ea816(0x1ec),_0x2ea816(0x1fc)],_0x3fc54b=_0x283a3b===0x0?_0x2ea816(0x1e2)+_0xb23203:_0x2ea816(0x1e2)+_0xb23203+_0x2ea816(0x182)+_0x3fceb7[_0x283a3b],_0x5d3f1e=await this[_0x2ea816(0x276)]['listAgents'](_0x322294),_0x2df64b=_0x5d3f1e[_0x2ea816(0x261)](_0x24e468=>_0x24e468['attributes'][_0x2ea816(0x1c7)]===_0x3fc54b);if(_0x2df64b)return _0x2df64b;const _0x1aa846=_0x283a3b>0x0?0x1:_0x42df3b;return await this[_0x2ea816(0x276)]['createAgent']({'name':_0x3fc54b,'projectId':_0x322294,'modelType':_0xb23203,'systemPrompt':'','temperature':_0x1aa846,'reasoningEffort':_0x283a3b>0x0?_0x283a3b:undefined});}catch(_0x1a2e23){if(_0x1a2e23 instanceof HTTPClientError){const _0x5a81e4=_0x1a2e23['status'];if(_0x5a81e4>=0x190&&_0x5a81e4<0x1f4){if(_0x5a81e4===0x191)throw new SDKError(ErrorCode['UNAUTHENTICATED'],_0x2ea816(0x251),_0x1a2e23);else{if(_0x5a81e4===0x193)throw new SDKError(ErrorCode[_0x2ea816(0x22a)],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x1a2e23);}throw _0x1a2e23;}}if(errorContains(_0x1a2e23,_0x2ea816(0x1c4),'duplicate',_0x2ea816(0x205))){_0x6f458b++;if(_0x6f458b>=_0x15672b)throw new SDKError(ErrorCode[_0x2ea816(0x1a8)],_0x2ea816(0x1f9)+_0x15672b+_0x2ea816(0x277),_0x1a2e23);const _0x5082e5=this[_0x2ea816(0x1f3)]();_0x2b98e1=_0x5082e5+'_'+generateRandomHex();continue;}throw _0x1a2e23;}}throw new SDKError(ErrorCode[_0x2ea816(0x211)],_0x2ea816(0x208));}async[a134_0x5ec437(0x1e4)](_0x52784b,_0x421298){const _0x4e2ffa=a134_0x5ec437,_0x4a0cc2=_0x421298||this[_0x4e2ffa(0x216)],_0x5d518f=await this[_0x4e2ffa(0x276)][_0x4e2ffa(0x218)](_0x4a0cc2),_0x5f2d5a=_0x5d518f['filter'](_0x4960ba=>_0x4960ba[_0x4e2ffa(0x1ca)][_0x4e2ffa(0x1c7)]===_0x52784b);if(_0x5f2d5a['length']===0x0){const _0x339a52=_0x4a0cc2?'\x20in\x20project\x20'+_0x4a0cc2:'';throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],'Agent\x20not\x20found:\x20'+_0x52784b+_0x339a52,undefined,{'helpText':_0x4a0cc2?_0x4e2ffa(0x232):_0x4e2ffa(0x245)});}if(_0x5f2d5a[_0x4e2ffa(0x1b2)]>0x1)throw new SDKError(ErrorCode[_0x4e2ffa(0x211)],_0x4e2ffa(0x1b0)+_0x52784b+'\x27.\x20This\x20should\x20not\x20happen.');return _0x5f2d5a[0x0]['id'];}async['agents'](_0x63c254){const _0x361e66=a134_0x5ec437,_0x2c384e=_0x63c254||this[_0x361e66(0x216)];return await this[_0x361e66(0x276)]['listAgents'](_0x2c384e);}async[a134_0x5ec437(0x209)](_0x5dc2bd){const _0x542c79=a134_0x5ec437;return await this['client'][_0x542c79(0x165)](_0x5dc2bd);}async['agent'](_0x28c790){const _0x573d11=a134_0x5ec437;return await this['client'][_0x573d11(0x22c)](_0x28c790);}async[a134_0x5ec437(0x27b)](_0x238589){const _0x27d7e8=a134_0x5ec437;return await this[_0x27d7e8(0x276)]['createAgent'](_0x238589);}async[a134_0x5ec437(0x24a)](_0x42dc28,_0x4e0eb8){const _0x57ff0e=a134_0x5ec437;return await this[_0x57ff0e(0x276)][_0x57ff0e(0x24a)](_0x42dc28,_0x4e0eb8);}async[a134_0x5ec437(0x1e5)](_0x18d7cb){const _0x580080=a134_0x5ec437;await this[_0x580080(0x276)]['deleteAgent'](_0x18d7cb);}async[a134_0x5ec437(0x19c)](_0x387216){const _0x5586fc=a134_0x5ec437;return await this[_0x5586fc(0x276)]['startChat']({'agentId':_0x387216});}async*[a134_0x5ec437(0x172)](_0x3b62c8,_0x24efaf){const _0x224e0e=a134_0x5ec437;let _0x27ad2b=_0x24efaf?.[_0x224e0e(0x1b9)];const _0x58e5fd=_0x24efaf?.[_0x224e0e(0x1ae)];if(!_0x27ad2b){if(!_0x58e5fd)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x4427e1=await this[_0x224e0e(0x276)][_0x224e0e(0x19c)]({'agentId':_0x58e5fd});_0x27ad2b=_0x4427e1['id'],yield{'type':_0x224e0e(0x25e),'data':{'chatId':_0x27ad2b,'agentId':_0x58e5fd,'projectId':_0x4427e1[_0x224e0e(0x1ca)][_0x224e0e(0x1a4)]}};}for await(const _0x5687a6 of this['client'][_0x224e0e(0x1c9)](_0x27ad2b,_0x3b62c8,_0x24efaf?.[_0x224e0e(0x1b8)])){yield{'type':'event','data':_0x5687a6};}}async[a134_0x5ec437(0x213)](_0x10b9d9=0x32){return await this['client']['listChats'](_0x10b9d9);}async[a134_0x5ec437(0x1a9)](_0xb17056){const _0x3a98c9=a134_0x5ec437;return await this[_0x3a98c9(0x276)]['getChatHistory'](_0xb17056);}async[a134_0x5ec437(0x18a)](_0x447312){const _0x262c2b=a134_0x5ec437;return await this[_0x262c2b(0x276)][_0x262c2b(0x18a)](_0x447312);}async[a134_0x5ec437(0x1f8)](_0xfd8ff2){return await this['client']['getChatInfo'](_0xfd8ff2);}async[a134_0x5ec437(0x20d)](_0xbc93a1,_0x3aaa56,_0x24a38d){const _0x34daae=a134_0x5ec437,_0x335062=_0x24a38d?.[_0x34daae(0x1af)]??![],{projectId:_0x3264fe,project:_0x799962}=await this[_0x34daae(0x173)](_0xbc93a1),_0x2ecd5a=_0x799962['attributes'][_0x34daae(0x1c7)],_0x394b36=_0x3aaa56||_0x2ecd5a+_0x34daae(0x206);if(a134_0x2f02d2['existsSync'](_0x394b36)&&!_0x335062)throw new SDKError(ErrorCode[_0x34daae(0x1a8)],'Output\x20directory\x20already\x20exists:\x20'+_0x394b36,undefined,{'helpText':_0x34daae(0x1c8)});const _0x25d3cd=await this['client'][_0x34daae(0x165)](_0x3264fe),_0x5868de=await this[_0x34daae(0x276)][_0x34daae(0x1c2)](_0x3264fe),_0x159a08=await this[_0x34daae(0x276)]['listPrompts'](_0x3264fe),_0x3f17ea=await this[_0x34daae(0x276)][_0x34daae(0x256)](_0x3264fe);if(!_0x335062){a134_0x2f02d2[_0x34daae(0x192)](_0x394b36,{'recursive':!![]});const _0xc9b682={'version':_0x34daae(0x24c),'exportedAt':new Date()[_0x34daae(0x248)](),'exportedFrom':{'site':this['context'][_0x34daae(0x1a3)],'projectId':_0x3264fe,'projectName':_0x2ecd5a},'project':_0x799962};a134_0x2f02d2[_0x34daae(0x20b)](a134_0x591fe4['join'](_0x394b36,_0x34daae(0x174)),JSON[_0x34daae(0x24e)](_0xc9b682,null,0x2)),a134_0x2f02d2['writeFileSync'](a134_0x591fe4[_0x34daae(0x21b)](_0x394b36,_0x34daae(0x16c)),JSON[_0x34daae(0x24e)](_0x25d3cd,null,0x2)),a134_0x2f02d2['writeFileSync'](a134_0x591fe4[_0x34daae(0x21b)](_0x394b36,_0x34daae(0x167)),JSON[_0x34daae(0x24e)](_0x5868de,null,0x2)),a134_0x2f02d2[_0x34daae(0x20b)](a134_0x591fe4[_0x34daae(0x21b)](_0x394b36,_0x34daae(0x18c)),JSON['stringify'](_0x159a08,null,0x2)),a134_0x2f02d2[_0x34daae(0x20b)](a134_0x591fe4[_0x34daae(0x21b)](_0x394b36,'integrations.json'),JSON[_0x34daae(0x24e)](_0x3f17ea,null,0x2));}return{'projectName':_0x2ecd5a,'outputDir':_0x394b36,'counts':{'agents':_0x25d3cd[_0x34daae(0x1b2)],'knowledgeBases':_0x5868de[_0x34daae(0x1b2)],'prompts':_0x159a08[_0x34daae(0x1b2)],'integrations':_0x3f17ea[_0x34daae(0x1b2)]}};}async[a134_0x5ec437(0x225)](_0x4cd972,_0x1731fa){const _0x5af096=a134_0x5ec437,_0x3e486f=_0x1731fa?.[_0x5af096(0x1af)]??![],_0x2bbd6d=this[_0x5af096(0x273)](_0x4cd972),_0x46a1c0=_0x2bbd6d[_0x5af096(0x1eb)]['site'],_0x306502=this[_0x5af096(0x268)][_0x5af096(0x1a3)],_0x5ca251=_0x46a1c0!==_0x306502?_0x46a1c0:undefined,_0x768cfa=this['loadJsonFile'](a134_0x591fe4['join'](_0x4cd972,_0x5af096(0x16c)),[]),_0x31926c=this[_0x5af096(0x160)](a134_0x591fe4['join'](_0x4cd972,_0x5af096(0x167)),[]),_0x3d8867=this[_0x5af096(0x160)](a134_0x591fe4[_0x5af096(0x21b)](_0x4cd972,_0x5af096(0x18c)),[]),_0x40acbc=this[_0x5af096(0x160)](a134_0x591fe4[_0x5af096(0x21b)](_0x4cd972,_0x5af096(0x19b)),[]),_0x220ef8=_0x1731fa?.['name']||_0x2bbd6d['exportedFrom']['projectName'];if(_0x3e486f){const _0x158a68=new Map(),_0x1d1325=[..._0x768cfa],_0x29d63c=_0x768cfa[_0x5af096(0x1b2)]+0x1;let _0x1ab954=0x0;while(_0x1d1325[_0x5af096(0x1b2)]>0x0&&_0x1ab954<_0x29d63c){_0x1ab954++;const _0x5ecee9=[];for(const _0x49ce6e of _0x1d1325){canCreateAgent(_0x49ce6e,_0x158a68)?_0x158a68[_0x5af096(0x279)](_0x49ce6e['id'],_0x5af096(0x259)+_0x49ce6e['id']):_0x5ecee9['push'](_0x49ce6e);}if(_0x5ecee9[_0x5af096(0x1b2)]===_0x1d1325[_0x5af096(0x1b2)])throw new SDKError(ErrorCode[_0x5af096(0x211)],_0x5af096(0x1d1),undefined,{'helpText':_0x5af096(0x171)});_0x1d1325['length']=0x0,_0x1d1325[_0x5af096(0x240)](..._0x5ecee9);}const _0x2234a2=_0x3d8867[_0x5af096(0x26b)](_0x3b512f=>_0x158a68['has'](_0x3b512f['attributes']['agentId']))[_0x5af096(0x1b2)];return{'projectName':_0x220ef8,'projectId':_0x5af096(0x1e6),'counts':{'agents':_0x768cfa['length'],'knowledgeBases':_0x31926c[_0x5af096(0x1b2)],'prompts':_0x2234a2,'integrations':_0x40acbc[_0x5af096(0x1b2)]},'sourceSite':_0x5ca251};}const _0x28975f=await this[_0x5af096(0x276)][_0x5af096(0x1df)]({'name':_0x220ef8,'description':_0x2bbd6d[_0x5af096(0x217)][_0x5af096(0x1ca)]['description']}),_0x5c2b69=_0x28975f['id'],_0x239a2d=new Map(),_0x10fff2=new Map(),_0x3fb68c=new Map();for(const _0x493213 of _0x31926c){const _0x4ecba6=await this[_0x5af096(0x276)][_0x5af096(0x1d5)]({'projectId':_0x5c2b69,'name':_0x493213[_0x5af096(0x1ca)][_0x5af096(0x1c7)],'tdDatabaseName':_0x493213[_0x5af096(0x1ca)][_0x5af096(0x1ab)],'tables':_0x493213[_0x5af096(0x1ca)][_0x5af096(0x26c)]});_0x239a2d['set'](_0x493213['id'],_0x4ecba6['id']);}const _0xc46486=[..._0x768cfa],_0xf51ad6=_0x768cfa['length']+0x1;let _0x10b985=0x0;while(_0xc46486[_0x5af096(0x1b2)]>0x0&&_0x10b985<_0xf51ad6){_0x10b985++;const _0x3731e1=[];for(const _0x14f826 of _0xc46486){if(canCreateAgent(_0x14f826,_0x10fff2)){const _0xaaaaf1=remapToolIds(_0x14f826[_0x5af096(0x1ca)][_0x5af096(0x22b)],_0x239a2d,_0x10fff2),_0x53216b=remapVariableIds(_0x14f826[_0x5af096(0x1ca)]['variables'],_0x239a2d),_0x173648=await this[_0x5af096(0x276)][_0x5af096(0x186)]({'name':_0x14f826[_0x5af096(0x1ca)]['name'],'projectId':_0x5c2b69,'systemPrompt':_0x14f826[_0x5af096(0x1ca)][_0x5af096(0x25c)],'starterMessage':_0x14f826[_0x5af096(0x1ca)][_0x5af096(0x20a)],'modelType':migrateModelType(_0x14f826[_0x5af096(0x1ca)][_0x5af096(0x1c3)]),'maxToolIterations':_0x14f826['attributes'][_0x5af096(0x214)],'temperature':_0x14f826[_0x5af096(0x1ca)]['temperature'],'reasoningEffort':_0x14f826[_0x5af096(0x1ca)]['reasoningEffort'],'outputs':_0x14f826['attributes'][_0x5af096(0x24b)],'tools':_0xaaaaf1,'variables':_0x53216b});_0x10fff2[_0x5af096(0x279)](_0x14f826['id'],_0x173648['id']);}else _0x3731e1[_0x5af096(0x240)](_0x14f826);}if(_0x3731e1[_0x5af096(0x1b2)]===_0xc46486[_0x5af096(0x1b2)])throw new SDKError(ErrorCode[_0x5af096(0x211)],_0x5af096(0x1d1),undefined,{'helpText':_0x5af096(0x171)});_0xc46486['length']=0x0,_0xc46486[_0x5af096(0x240)](..._0x3731e1);}for(const _0x2184d4 of _0x3d8867){const _0x39ac21=_0x10fff2[_0x5af096(0x26f)](_0x2184d4[_0x5af096(0x1ca)][_0x5af096(0x1ae)]);if(!_0x39ac21)continue;const _0x3c254a=await this[_0x5af096(0x276)][_0x5af096(0x162)]({'projectId':_0x5c2b69,'agentId':_0x39ac21,'name':_0x2184d4['attributes']['name'],'systemPrompt':_0x2184d4[_0x5af096(0x1ca)][_0x5af096(0x25c)],'template':_0x2184d4[_0x5af096(0x1ca)][_0x5af096(0x1d8)],'jsonSchemaHint':_0x2184d4[_0x5af096(0x1ca)][_0x5af096(0x239)]});_0x3fb68c[_0x5af096(0x279)](_0x2184d4['id'],_0x3c254a['id']);}for(const _0x2ee5ac of _0x40acbc){const _0x2c25d0=_0x2ee5ac[_0x5af096(0x1ca)][_0x5af096(0x1bf)]['map'](_0x1282a5=>({..._0x1282a5,'promptId':_0x3fb68c['get'](_0x1282a5[_0x5af096(0x19e)])||_0x1282a5[_0x5af096(0x19e)]}));await this['client']['createIntegration']({'projectId':_0x5c2b69,'serviceType':_0x2ee5ac['attributes'][_0x5af096(0x23e)],'actions':_0x2c25d0,'slackMessageMode':_0x2ee5ac[_0x5af096(0x1ca)][_0x5af096(0x198)],'chatIgnoreManagedActions':_0x2ee5ac[_0x5af096(0x1ca)][_0x5af096(0x15e)],'chatWelcomeMessage':_0x2ee5ac[_0x5af096(0x1ca)][_0x5af096(0x184)],'webhookCorsOrigins':_0x2ee5ac[_0x5af096(0x1ca)]['webhookCorsOrigins']});}return{'projectName':_0x220ef8,'projectId':_0x5c2b69,'counts':{'agents':_0x10fff2[_0x5af096(0x1e1)],'knowledgeBases':_0x239a2d[_0x5af096(0x1e1)],'prompts':_0x3fb68c[_0x5af096(0x1e1)],'integrations':_0x40acbc['length']},'sourceSite':_0x5ca251};}[a134_0x5ec437(0x160)](_0x34c839,_0x445c53){const _0x138389=a134_0x5ec437;if(!a134_0x2f02d2[_0x138389(0x1d0)](_0x34c839))return _0x445c53;return JSON[_0x138389(0x185)](a134_0x2f02d2[_0x138389(0x21f)](_0x34c839,'utf-8'));}[a134_0x5ec437(0x273)](_0x2ac813){const _0x19c010=a134_0x5ec437;if(!a134_0x2f02d2[_0x19c010(0x1d0)](_0x2ac813))throw new SDKError(ErrorCode[_0x19c010(0x275)],_0x19c010(0x1e9)+_0x2ac813,undefined,{'helpText':_0x19c010(0x247)});const _0x455d54=a134_0x591fe4[_0x19c010(0x21b)](_0x2ac813,_0x19c010(0x174));if(!a134_0x2f02d2[_0x19c010(0x1d0)](_0x455d54))throw new SDKError(ErrorCode[_0x19c010(0x1ce)],_0x19c010(0x223)+_0x2ac813,undefined,{'helpText':_0x19c010(0x265)});const _0x54b1fa=JSON[_0x19c010(0x185)](a134_0x2f02d2['readFileSync'](_0x455d54,_0x19c010(0x202)));if(!isSupportedBackupVersion(_0x54b1fa[_0x19c010(0x212)]))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x19c010(0x27c)+_0x54b1fa[_0x19c010(0x212)],undefined,{'helpText':_0x19c010(0x26d)});return _0x54b1fa;}async[a134_0x5ec437(0x189)](_0x2ff3ba,_0x565f57,_0xfa2d1e){const _0x362963=a134_0x5ec437,{projectId:_0xd72561,project:_0x46530d}=await this[_0x362963(0x173)](_0x2ff3ba),_0x1ba0d4=_0x46530d[_0x362963(0x1ca)][_0x362963(0x1c7)];let _0x2cdb00;if(_0x565f57)_0x2cdb00=_0x565f57;else{const _0x386749=a134_0x591fe4[_0x362963(0x21b)](process['cwd'](),'agents'),_0x45aed7=getSanitizedPathWithMigration(_0x386749,_0x1ba0d4);_0x45aed7[_0x362963(0x190)]&&this[_0x362963(0x1ff)][_0x362963(0x17d)](_0x362963(0x227)+a134_0x591fe4['basename'](_0x45aed7[_0x362963(0x263)])+'\x20→\x20'+a134_0x591fe4[_0x362963(0x1a1)](_0x45aed7[_0x362963(0x22e)])),_0x2cdb00=_0x45aed7['path'];}const _0x336736=await this[_0x362963(0x276)]['listAgentsFull'](_0xd72561),_0x51c959=await this[_0x362963(0x276)][_0x362963(0x1c2)](_0xd72561),_0x444cce=await this[_0x362963(0x276)][_0x362963(0x1cd)](_0xd72561),_0x4c6712=await safeListOrEmpty(()=>this['client'][_0x362963(0x1d6)](_0xd72561)),_0x46d1e6=await safeListOrEmpty(()=>this['client'][_0x362963(0x244)](_0xd72561)),_0x3539d6=await this['client']['listPrompts'](_0xd72561),_0x50ffbf=await this[_0x362963(0x276)][_0x362963(0x256)](_0xd72561),_0xbb3291=await safeListOrEmpty(()=>this[_0x362963(0x276)]['listExperimentalKnowledgeBases'](_0xd72561)),_0x4fbd37=await safeListOrEmpty(()=>this[_0x362963(0x276)][_0x362963(0x178)](_0xd72561)),_0x45b6a0=await safeListOrEmpty(()=>this['client'][_0x362963(0x177)](_0xd72561)),_0x19406f=await safeListOrEmpty(()=>this[_0x362963(0x276)][_0x362963(0x236)](_0xd72561)),_0x5b08c1=_0x50ffbf[_0x362963(0x26b)](_0x16c3f0=>!_0x16c3f0['attributes'][_0x362963(0x257)]&&SAFE_INTEGRATION_TYPES[_0x362963(0x1ed)](_0x16c3f0['attributes'][_0x362963(0x23e)][_0x362963(0x18d)]())),_0x45dfae=new Map(),_0x485c1d=new Map(),_0x35715d=new Map(),_0x3b035f=new Map(),_0x412afa=new Map(),_0x541aa3=new Map(),_0x5d70ea=new Map();for(const _0xf1f2fa of _0x336736){_0x45dfae[_0x362963(0x279)](_0xf1f2fa['id'],_0xf1f2fa[_0x362963(0x1ca)][_0x362963(0x1c7)]);}for(const _0x359e2c of _0x51c959){_0x485c1d[_0x362963(0x279)](_0x359e2c['id'],_0x359e2c[_0x362963(0x1ca)]['name']);}for(const _0x2e5bbe of _0x444cce){_0x35715d[_0x362963(0x279)](_0x2e5bbe['id'],_0x2e5bbe[_0x362963(0x1ca)][_0x362963(0x1c7)]);}for(const _0x529e01 of _0x4c6712){_0x3b035f[_0x362963(0x279)](_0x529e01['id'],_0x529e01[_0x362963(0x1ca)][_0x362963(0x1c7)]);}for(const _0x82aeb9 of _0x46d1e6){_0x412afa['set'](_0x82aeb9['id'],_0x82aeb9[_0x362963(0x1ca)][_0x362963(0x1c7)]);}for(const _0x2b8457 of _0x3539d6){_0x541aa3['set'](_0x2b8457['id'],_0x2b8457['attributes'][_0x362963(0x1c7)]);}for(const _0x5c1085 of _0xbb3291){_0x5d70ea[_0x362963(0x279)](_0x5c1085['id'],_0x5c1085[_0x362963(0x1ca)][_0x362963(0x1c7)]);}const _0x2bb10c={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x485c1d,'TextKnowledgeBase':_0x35715d,'Agent':_0x45dfae,'WebSearchTool':_0x412afa,'ImageGenerator':_0x3b035f,'ExperimentalKnowledgeBase':_0x5d70ea}),'resolvePromptName':async _0x3b9fb9=>_0x541aa3['get'](_0x3b9fb9),'onWarning':_0x57b1e7=>this['logger'][_0x362963(0x19f)](_0x57b1e7)},_0x448873={'projectName':_0x1ba0d4,'outputDir':_0x2cdb00,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'knowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'textKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'prompts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'integrations':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalArtifacts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'formInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'chatInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0x13fe81=[],_0x5c12e0=[];for(const _0x5b9aab of _0x336736){const _0x4a347d=getSanitizedPathWithMigration(_0x2cdb00,_0x5b9aab['attributes'][_0x362963(0x1c7)]);_0x4a347d['renamed']&&this[_0x362963(0x1ff)]['info'](_0x362963(0x17c)+a134_0x591fe4[_0x362963(0x1a1)](_0x4a347d['oldPath'])+_0x362963(0x219)+a134_0x591fe4[_0x362963(0x1a1)](_0x4a347d['path']));const _0x180a8d=_0x4a347d[_0x362963(0x22e)],_0x12c99c=a134_0x591fe4[_0x362963(0x21b)](_0x180a8d,_0x362963(0x1c6)),_0x1e9a06=a134_0x591fe4['join'](_0x180a8d,'agent.yml'),_0x3d9763=a134_0x591fe4[_0x362963(0x21b)](_0x180a8d,'starter_message.md'),{yaml:_0x58dca8,systemPrompt:_0x289e71,starterMessage:_0x4b4e69}=await agentResponseToDef(_0x5b9aab,_0x2bb10c),_0x4be093=toAgentYamlString(_0x58dca8),_0x22a41d=!a134_0x2f02d2[_0x362963(0x1d0)](_0x1e9a06);let _0x480b8a=_0x22a41d,_0x4619d7;if(!_0x22a41d){const _0x366a40=a134_0x2f02d2['existsSync'](_0x12c99c)?a134_0x2f02d2[_0x362963(0x21f)](_0x12c99c,'utf-8'):'',_0x26048c=a134_0x2f02d2[_0x362963(0x21f)](_0x1e9a06,'utf-8'),_0xbe9000=_0x362963(0x24f)+_0x366a40+_0x362963(0x191)+_0x26048c,_0x3486da=_0x362963(0x24f)+_0x289e71+_0x362963(0x191)+_0x4be093,_0x595b37=generateDiff(_0xbe9000,_0x3486da);_0x480b8a=hasChanges(_0x595b37),_0x480b8a&&(_0x4619d7=formatDiffWithColors(_0x595b37));}_0x13fe81[_0x362963(0x240)]({'path':_0x180a8d,'content':'','isDir':!![]}),_0x13fe81[_0x362963(0x240)]({'path':_0x12c99c,'content':_0x289e71}),_0x13fe81['push']({'path':_0x1e9a06,'content':_0x4be093});_0x4b4e69&&_0x4b4e69[_0x362963(0x1ed)]('\x0a')&&_0x13fe81[_0x362963(0x240)]({'path':_0x3d9763,'content':_0x4b4e69});_0x448873[_0x362963(0x1fb)][_0x362963(0x240)]({'agentName':_0x5b9aab[_0x362963(0x1ca)][_0x362963(0x1c7)],'outputPath':_0x180a8d,'isNew':_0x22a41d,'hasChanges':_0x480b8a,'diff':_0x4619d7}),_0x448873['counts']['agents']['total']++;if(_0x22a41d)_0x448873[_0x362963(0x20c)][_0x362963(0x1fb)][_0x362963(0x17a)]++;else{if(_0x480b8a)_0x448873[_0x362963(0x20c)]['agents']['updated']++;else _0x448873[_0x362963(0x20c)][_0x362963(0x1fb)]['unchanged']++;}}for(const _0x493121 of _0x51c959){if(_0x493121['attributes'][_0x362963(0x257)])continue;const _0x2148a2=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x2cdb00),_0x493121[_0x362963(0x1ca)]['name'],'.yml');_0x2148a2['renamed']&&this[_0x362963(0x1ff)][_0x362963(0x17d)](_0x362963(0x15d)+a134_0x591fe4[_0x362963(0x1a1)](_0x2148a2[_0x362963(0x263)])+_0x362963(0x219)+a134_0x591fe4[_0x362963(0x1a1)](_0x2148a2[_0x362963(0x22e)]));const _0x321f99=_0x2148a2[_0x362963(0x22e)],_0x2506f4=apiKnowledgeBaseToYaml(_0x493121),_0x586b72=toKnowledgeBaseYamlString(_0x2506f4),_0x340adc=!a134_0x2f02d2['existsSync'](_0x321f99);let _0xd3e90d=_0x340adc,_0x1de90e;if(!_0x340adc){const _0x258f97=a134_0x2f02d2[_0x362963(0x21f)](_0x321f99,_0x362963(0x202)),_0x4e3820=generateDiff(_0x258f97,_0x586b72);_0xd3e90d=hasChanges(_0x4e3820),_0xd3e90d&&(_0x1de90e=formatDiffWithColors(_0x4e3820));}_0x13fe81[_0x362963(0x240)]({'path':_0x321f99,'content':_0x586b72}),_0x448873[_0x362963(0x253)]['push']({'name':_0x493121[_0x362963(0x1ca)][_0x362963(0x1c7)],'outputPath':_0x321f99,'isNew':_0x340adc,'hasChanges':_0xd3e90d,'diff':_0x1de90e}),_0x448873[_0x362963(0x20c)][_0x362963(0x253)][_0x362963(0x1bd)]++;if(_0x340adc)_0x448873[_0x362963(0x20c)][_0x362963(0x253)]['new']++;else{if(_0xd3e90d)_0x448873[_0x362963(0x20c)][_0x362963(0x253)][_0x362963(0x170)]++;else _0x448873[_0x362963(0x20c)][_0x362963(0x253)][_0x362963(0x23d)]++;}}for(const _0x4a2e03 of _0x444cce){if(_0x4a2e03[_0x362963(0x1ca)][_0x362963(0x257)])continue;const _0x3e1fd8=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x2cdb00),_0x4a2e03[_0x362963(0x1ca)][_0x362963(0x1c7)],_0x362963(0x26e));_0x3e1fd8['renamed']&&this[_0x362963(0x1ff)][_0x362963(0x17d)]('Renamed\x20text\x20KB\x20file:\x20'+a134_0x591fe4[_0x362963(0x1a1)](_0x3e1fd8['oldPath'])+'\x20→\x20'+a134_0x591fe4['basename'](_0x3e1fd8['path']));const _0x2c06fb=_0x3e1fd8[_0x362963(0x22e)],_0x4655ab=toTextKnowledgeBaseMd(_0x4a2e03[_0x362963(0x1ca)][_0x362963(0x1c7)],_0x4a2e03[_0x362963(0x1ca)][_0x362963(0x180)]),_0x26b74e=!a134_0x2f02d2[_0x362963(0x1d0)](_0x2c06fb);let _0x301210=_0x26b74e,_0x2442c8;if(!_0x26b74e){const _0x3a3ece=a134_0x2f02d2[_0x362963(0x21f)](_0x2c06fb,_0x362963(0x202)),_0x5467db=generateDiff(_0x3a3ece,_0x4655ab);_0x301210=hasChanges(_0x5467db),_0x301210&&(_0x2442c8=formatDiffWithColors(_0x5467db));}_0x13fe81['push']({'path':_0x2c06fb,'content':_0x4655ab}),_0x448873[_0x362963(0x260)][_0x362963(0x240)]({'name':_0x4a2e03[_0x362963(0x1ca)]['name'],'outputPath':_0x2c06fb,'isNew':_0x26b74e,'hasChanges':_0x301210,'diff':_0x2442c8}),_0x448873[_0x362963(0x20c)][_0x362963(0x260)][_0x362963(0x1bd)]++;if(_0x26b74e)_0x448873['counts'][_0x362963(0x260)][_0x362963(0x17a)]++;else{if(_0x301210)_0x448873[_0x362963(0x20c)][_0x362963(0x260)][_0x362963(0x170)]++;else _0x448873['counts']['textKnowledgeBases'][_0x362963(0x23d)]++;}}for(const _0x1dd3a9 of _0x3539d6){if(_0x1dd3a9['attributes'][_0x362963(0x257)])continue;const _0x4d2f25=getSanitizedPathWithMigration(getPromptsDir(_0x2cdb00),_0x1dd3a9[_0x362963(0x1ca)]['name'],_0x362963(0x220));_0x4d2f25['renamed']&&this[_0x362963(0x1ff)][_0x362963(0x17d)](_0x362963(0x20e)+a134_0x591fe4['basename'](_0x4d2f25[_0x362963(0x263)])+_0x362963(0x219)+a134_0x591fe4[_0x362963(0x1a1)](_0x4d2f25['path']));const _0xe2897=_0x4d2f25['path'],_0x1e0867=await apiPromptToYaml(_0x1dd3a9,_0x2bb10c);if(!_0x1e0867)continue;const _0x4f1b8b=toPromptYamlString(_0x1e0867),_0x262508=!a134_0x2f02d2['existsSync'](_0xe2897);let _0x3d6e44=_0x262508,_0x1e7634;if(!_0x262508){const _0x47aef9=a134_0x2f02d2[_0x362963(0x21f)](_0xe2897,_0x362963(0x202)),_0x42bc01=generateDiff(_0x47aef9,_0x4f1b8b);_0x3d6e44=hasChanges(_0x42bc01),_0x3d6e44&&(_0x1e7634=formatDiffWithColors(_0x42bc01));}_0x13fe81[_0x362963(0x240)]({'path':_0xe2897,'content':_0x4f1b8b}),_0x448873[_0x362963(0x21e)][_0x362963(0x240)]({'name':_0x1dd3a9['attributes']['name'],'outputPath':_0xe2897,'isNew':_0x262508,'hasChanges':_0x3d6e44,'diff':_0x1e7634}),_0x448873['counts'][_0x362963(0x21e)][_0x362963(0x1bd)]++;if(_0x262508)_0x448873[_0x362963(0x20c)][_0x362963(0x21e)]['new']++;else{if(_0x3d6e44)_0x448873['counts'][_0x362963(0x21e)][_0x362963(0x170)]++;else _0x448873['counts'][_0x362963(0x21e)][_0x362963(0x23d)]++;}}for(const _0x2ef1f8 of _0x5b08c1){const _0x17c4dc=_0x2ef1f8[_0x362963(0x1ca)][_0x362963(0x23e)][_0x362963(0x18d)](),_0x5b1c6d=getSanitizedPathWithMigration(getIntegrationsDir(_0x2cdb00),_0x17c4dc,_0x362963(0x220));_0x5b1c6d[_0x362963(0x190)]&&this['logger'][_0x362963(0x17d)](_0x362963(0x267)+a134_0x591fe4[_0x362963(0x1a1)](_0x5b1c6d[_0x362963(0x263)])+'\x20→\x20'+a134_0x591fe4[_0x362963(0x1a1)](_0x5b1c6d[_0x362963(0x22e)]));const _0x3526c4=_0x5b1c6d[_0x362963(0x22e)],_0x485664=await apiIntegrationToYaml(_0x2ef1f8,_0x2bb10c),_0x417ae5=toIntegrationYamlString(_0x485664),_0x575815=!a134_0x2f02d2[_0x362963(0x1d0)](_0x3526c4);let _0x18c04c=_0x575815,_0x36abdc;if(!_0x575815){const _0x191214=a134_0x2f02d2[_0x362963(0x21f)](_0x3526c4,_0x362963(0x202)),_0x5f5be1=generateDiff(_0x191214,_0x417ae5);_0x18c04c=hasChanges(_0x5f5be1),_0x18c04c&&(_0x36abdc=formatDiffWithColors(_0x5f5be1));}_0x13fe81[_0x362963(0x240)]({'path':_0x3526c4,'content':_0x417ae5}),_0x448873[_0x362963(0x196)]['push']({'name':_0x17c4dc,'outputPath':_0x3526c4,'isNew':_0x575815,'hasChanges':_0x18c04c,'diff':_0x36abdc}),_0x448873[_0x362963(0x20c)][_0x362963(0x196)][_0x362963(0x1bd)]++;if(_0x575815)_0x448873[_0x362963(0x20c)][_0x362963(0x196)][_0x362963(0x17a)]++;else{if(_0x18c04c)_0x448873[_0x362963(0x20c)][_0x362963(0x196)][_0x362963(0x170)]++;else _0x448873[_0x362963(0x20c)][_0x362963(0x196)][_0x362963(0x23d)]++;}}for(const _0x144111 of _0xbb3291){if(_0x144111[_0x362963(0x1ca)][_0x362963(0x257)])continue;const _0xaa0800=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x2cdb00),_0x144111['attributes']['name']);_0xaa0800[_0x362963(0x190)]&&this['logger'][_0x362963(0x17d)](_0x362963(0x241)+a134_0x591fe4[_0x362963(0x1a1)](_0xaa0800[_0x362963(0x263)])+'\x20→\x20'+a134_0x591fe4[_0x362963(0x1a1)](_0xaa0800[_0x362963(0x22e)]));const _0x522a74=_0xaa0800['path'],_0xcd7486=a134_0x591fe4[_0x362963(0x21b)](_0x522a74,sanitizeForFilesystem(_0x144111[_0x362963(0x1ca)][_0x362963(0x1c7)])+_0x362963(0x220)),_0x65d983=a134_0x591fe4['join'](_0x522a74,'functions'),_0x4c2139=apiExperimentalKnowledgeBaseToYaml(_0x144111),_0x278a76=toExperimentalKnowledgeBaseYamlString(_0x4c2139),_0x53485e=!a134_0x2f02d2[_0x362963(0x1d0)](_0x522a74);let _0x2d8f5f=_0x53485e,_0x39b1c7,_0x2add71=_0x278a76;const _0x560248=[..._0x4c2139['functions']][_0x362963(0x16a)]((_0x261f42,_0x410177)=>_0x261f42[_0x362963(0x1c7)][_0x362963(0x159)](_0x410177[_0x362963(0x1c7)]));for(const _0x231e32 of _0x560248){_0x2add71+=_0x362963(0x23a)+_0x231e32[_0x362963(0x1c7)]+_0x362963(0x194)+_0x231e32[_0x362963(0x235)]+'\x0a---\x20schema:\x20'+_0x231e32[_0x362963(0x1c7)]+_0x362963(0x194)+_0x231e32['json_schema']+'\x0a';}if(!_0x53485e){let _0x514018='';a134_0x2f02d2[_0x362963(0x1d0)](_0xcd7486)&&(_0x514018=a134_0x2f02d2['readFileSync'](_0xcd7486,'utf-8'));if(a134_0x2f02d2[_0x362963(0x1d0)](_0x65d983)){const _0x27ceba=a134_0x2f02d2[_0x362963(0x1dd)](_0x65d983,{'withFileTypes':!![]}),_0x2f1952=_0x27ceba[_0x362963(0x26b)](_0x25b516=>_0x25b516[_0x362963(0x197)]())[_0x362963(0x16a)]((_0x4580cb,_0x58fd20)=>_0x4580cb[_0x362963(0x1c7)][_0x362963(0x159)](_0x58fd20[_0x362963(0x1c7)]));for(const _0x9f8ae5 of _0x2f1952){const _0x5d363b=a134_0x591fe4[_0x362963(0x21b)](_0x65d983,_0x9f8ae5[_0x362963(0x1c7)],_0x362963(0x278)),_0x197f12=a134_0x591fe4[_0x362963(0x21b)](_0x65d983,_0x9f8ae5[_0x362963(0x1c7)],'json_schema.json');a134_0x2f02d2[_0x362963(0x1d0)](_0x5d363b)&&(_0x514018+=_0x362963(0x23a)+_0x9f8ae5['name']+_0x362963(0x194)+a134_0x2f02d2['readFileSync'](_0x5d363b,'utf-8')+'\x0a'),a134_0x2f02d2[_0x362963(0x1d0)](_0x197f12)&&(_0x514018+=_0x362963(0x1ee)+_0x9f8ae5['name']+'\x20---\x0a'+a134_0x2f02d2[_0x362963(0x21f)](_0x197f12,_0x362963(0x202))+'\x0a');}}const _0x5626a6=generateDiff(_0x514018,_0x2add71);_0x2d8f5f=hasChanges(_0x5626a6),_0x2d8f5f&&(_0x39b1c7=formatDiffWithColors(_0x5626a6));}_0x13fe81['push']({'path':_0x522a74,'content':'','isDir':!![]}),_0x13fe81[_0x362963(0x240)]({'path':_0xcd7486,'content':_0x278a76}),_0x13fe81[_0x362963(0x240)]({'path':_0x65d983,'content':'','isDir':!![]});for(const _0x56b12f of _0x4c2139['functions']){const _0x572b5c=a134_0x591fe4[_0x362963(0x21b)](_0x65d983,sanitizeForFilesystem(_0x56b12f[_0x362963(0x1c7)])),_0xba3d7c=a134_0x591fe4[_0x362963(0x21b)](_0x572b5c,_0x362963(0x278)),_0x4604d7=a134_0x591fe4[_0x362963(0x21b)](_0x572b5c,_0x362963(0x166));_0x13fe81[_0x362963(0x240)]({'path':_0x572b5c,'content':'','isDir':!![]}),_0x13fe81['push']({'path':_0xba3d7c,'content':_0x56b12f[_0x362963(0x235)]}),_0x13fe81[_0x362963(0x240)]({'path':_0x4604d7,'content':_0x56b12f[_0x362963(0x16b)]});}if(a134_0x2f02d2['existsSync'](_0x65d983)){const _0x30ef3a=a134_0x2f02d2[_0x362963(0x1dd)](_0x65d983,{'withFileTypes':!![]}),_0x18eee6=new Set(_0x4c2139[_0x362963(0x163)]['map'](_0x1c3178=>sanitizeForFilesystem(_0x1c3178[_0x362963(0x1c7)])));for(const _0x222d74 of _0x30ef3a){if(_0x222d74[_0x362963(0x197)]()&&!_0x18eee6[_0x362963(0x271)](_0x222d74[_0x362963(0x1c7)])){const _0x8c4fa8=a134_0x591fe4['join'](_0x65d983,_0x222d74[_0x362963(0x1c7)]);_0x5c12e0[_0x362963(0x240)]({'path':_0x8c4fa8,'isDir':!![]});}}}_0x448873['experimentalKnowledgeBases']['push']({'name':_0x144111['attributes'][_0x362963(0x1c7)],'outputPath':_0x522a74,'isNew':_0x53485e,'hasChanges':_0x2d8f5f,'diff':_0x39b1c7}),_0x448873[_0x362963(0x20c)][_0x362963(0x264)][_0x362963(0x1bd)]++;if(_0x53485e)_0x448873[_0x362963(0x20c)][_0x362963(0x264)][_0x362963(0x17a)]++;else{if(_0x2d8f5f)_0x448873[_0x362963(0x20c)]['experimentalKnowledgeBases'][_0x362963(0x170)]++;else _0x448873['counts'][_0x362963(0x264)][_0x362963(0x23d)]++;}}for(const _0x4ab690 of _0x4fbd37){if(_0x4ab690[_0x362963(0x1ca)][_0x362963(0x257)])continue;const _0x51e90f=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x2cdb00),_0x4ab690[_0x362963(0x1ca)][_0x362963(0x1c7)]);_0x51e90f[_0x362963(0x190)]&&this[_0x362963(0x1ff)][_0x362963(0x17d)]('Renamed\x20experimental\x20artifact\x20directory:\x20'+a134_0x591fe4['basename'](_0x51e90f[_0x362963(0x263)])+_0x362963(0x219)+a134_0x591fe4[_0x362963(0x1a1)](_0x51e90f[_0x362963(0x22e)]));const _0x27d82e=_0x51e90f[_0x362963(0x22e)],_0xc008f3=a134_0x591fe4[_0x362963(0x21b)](_0x27d82e,sanitizeForFilesystem(_0x4ab690[_0x362963(0x1ca)][_0x362963(0x1c7)])+_0x362963(0x220)),_0x1ad3cf=a134_0x591fe4[_0x362963(0x21b)](_0x27d82e,'code.js'),_0x534208=a134_0x591fe4[_0x362963(0x21b)](_0x27d82e,_0x362963(0x1d2)),_0x1e1843=apiExperimentalArtifactToYaml(_0x4ab690),_0x2eb194=toExperimentalArtifactYamlString(_0x1e1843),_0x13857e=!a134_0x2f02d2[_0x362963(0x1d0)](_0x27d82e);let _0x29f406=_0x13857e,_0x590542,_0x399029=_0x2eb194+(_0x362963(0x195)+_0x1e1843[_0x362963(0x235)]+'\x0a');const _0x3b4e2b=[..._0x1e1843['files']]['sort']((_0xa99e9,_0x1f8762)=>_0xa99e9[_0x362963(0x234)][_0x362963(0x159)](_0x1f8762[_0x362963(0x234)]));for(const _0x271f07 of _0x3b4e2b){_0x399029+=_0x362963(0x21a)+_0x271f07[_0x362963(0x234)]+_0x362963(0x194)+_0x271f07['text_content']+'\x0a';}if(!_0x13857e){let _0x272f02='';a134_0x2f02d2['existsSync'](_0xc008f3)&&(_0x272f02=a134_0x2f02d2['readFileSync'](_0xc008f3,_0x362963(0x202)));a134_0x2f02d2['existsSync'](_0x1ad3cf)&&(_0x272f02+=_0x362963(0x195)+a134_0x2f02d2[_0x362963(0x21f)](_0x1ad3cf,_0x362963(0x202))+'\x0a');if(a134_0x2f02d2[_0x362963(0x1d0)](_0x534208)){const _0x50e756=a134_0x2f02d2[_0x362963(0x1dd)](_0x534208),_0x7bac1f=_0x50e756[_0x362963(0x26b)](_0x3b2d62=>{const _0x6efae0=_0x362963,_0x4c92e2=a134_0x591fe4[_0x6efae0(0x21b)](_0x534208,_0x3b2d62);return a134_0x2f02d2[_0x6efae0(0x161)](_0x4c92e2)[_0x6efae0(0x20f)]();})[_0x362963(0x16a)]((_0x364ba1,_0x369c45)=>_0x364ba1[_0x362963(0x159)](_0x369c45));for(const _0x4721e8 of _0x7bac1f){const _0xdfe2cf=a134_0x591fe4[_0x362963(0x21b)](_0x534208,_0x4721e8);_0x272f02+=_0x362963(0x21a)+_0x4721e8+_0x362963(0x194)+a134_0x2f02d2[_0x362963(0x21f)](_0xdfe2cf,_0x362963(0x202))+'\x0a';}}const _0x1f90bd=generateDiff(_0x272f02,_0x399029);_0x29f406=hasChanges(_0x1f90bd),_0x29f406&&(_0x590542=formatDiffWithColors(_0x1f90bd));}_0x13fe81[_0x362963(0x240)]({'path':_0x27d82e,'content':'','isDir':!![]}),_0x13fe81[_0x362963(0x240)]({'path':_0xc008f3,'content':_0x2eb194}),_0x13fe81['push']({'path':_0x1ad3cf,'content':_0x1e1843[_0x362963(0x235)]});if(_0x1e1843[_0x362963(0x1d2)]['length']>0x0){_0x13fe81['push']({'path':_0x534208,'content':'','isDir':!![]});for(const _0x2357ce of _0x1e1843['files']){const _0x355360=a134_0x591fe4[_0x362963(0x21b)](_0x534208,_0x2357ce['file_name']);_0x13fe81[_0x362963(0x240)]({'path':_0x355360,'content':_0x2357ce[_0x362963(0x254)]});}}if(a134_0x2f02d2['existsSync'](_0x534208)){const _0x774396=a134_0x2f02d2[_0x362963(0x1dd)](_0x534208),_0x369c09=new Set(_0x1e1843['files'][_0x362963(0x1f2)](_0x23eeb5=>_0x23eeb5['file_name']));for(const _0x1e3b48 of _0x774396){const _0x45dddd=a134_0x591fe4[_0x362963(0x21b)](_0x534208,_0x1e3b48);a134_0x2f02d2[_0x362963(0x161)](_0x45dddd)[_0x362963(0x20f)]()&&!_0x369c09[_0x362963(0x271)](_0x1e3b48)&&_0x5c12e0[_0x362963(0x240)]({'path':_0x45dddd});}}_0x448873[_0x362963(0x229)][_0x362963(0x240)]({'name':_0x4ab690['attributes'][_0x362963(0x1c7)],'outputPath':_0x27d82e,'isNew':_0x13857e,'hasChanges':_0x29f406,'diff':_0x590542}),_0x448873[_0x362963(0x20c)]['experimentalArtifacts'][_0x362963(0x1bd)]++;if(_0x13857e)_0x448873[_0x362963(0x20c)][_0x362963(0x229)][_0x362963(0x17a)]++;else{if(_0x29f406)_0x448873[_0x362963(0x20c)][_0x362963(0x229)][_0x362963(0x170)]++;else _0x448873[_0x362963(0x20c)]['experimentalArtifacts'][_0x362963(0x23d)]++;}}for(const _0xc35474 of _0x45b6a0){const _0xee100a=getSanitizedPathWithMigration(getFormInterfacesDir(_0x2cdb00),_0xc35474[_0x362963(0x1ca)]['name'],_0x362963(0x220));_0xee100a[_0x362963(0x190)]&&this[_0x362963(0x1ff)]['info'](_0x362963(0x1db)+a134_0x591fe4[_0x362963(0x1a1)](_0xee100a[_0x362963(0x263)])+'\x20→\x20'+a134_0x591fe4[_0x362963(0x1a1)](_0xee100a[_0x362963(0x22e)]));const _0x3003f7=_0xee100a[_0x362963(0x22e)],_0x3a272c=await apiFormInterfaceToYaml(_0xc35474,_0x2bb10c),_0x57b760=toFormInterfaceYamlString(_0x3a272c),_0x3d4a6e=!a134_0x2f02d2[_0x362963(0x1d0)](_0x3003f7);let _0x1f33ce=_0x3d4a6e,_0x2abf24;if(!_0x3d4a6e){const _0xb9ebcb=a134_0x2f02d2[_0x362963(0x21f)](_0x3003f7,'utf-8'),_0x2b556c=generateDiff(_0xb9ebcb,_0x57b760);_0x1f33ce=hasChanges(_0x2b556c),_0x1f33ce&&(_0x2abf24=formatDiffWithColors(_0x2b556c));}_0x13fe81[_0x362963(0x240)]({'path':_0x3003f7,'content':_0x57b760}),_0x448873[_0x362963(0x22d)][_0x362963(0x240)]({'name':_0xc35474[_0x362963(0x1ca)][_0x362963(0x1c7)],'outputPath':_0x3003f7,'isNew':_0x3d4a6e,'hasChanges':_0x1f33ce,'diff':_0x2abf24}),_0x448873['counts']['formInterfaces'][_0x362963(0x1bd)]++;if(_0x3d4a6e)_0x448873[_0x362963(0x20c)][_0x362963(0x22d)][_0x362963(0x17a)]++;else{if(_0x1f33ce)_0x448873[_0x362963(0x20c)][_0x362963(0x22d)]['updated']++;else _0x448873[_0x362963(0x20c)][_0x362963(0x22d)][_0x362963(0x23d)]++;}}for(const _0x265025 of _0x19406f){if(_0x265025['attributes'][_0x362963(0x257)])continue;const _0x6f2eff=getSanitizedPathWithMigration(getChatInterfacesDir(_0x2cdb00),_0x265025['attributes'][_0x362963(0x1c7)],'.yml');_0x6f2eff[_0x362963(0x190)]&&this[_0x362963(0x1ff)]['info'](_0x362963(0x18f)+a134_0x591fe4[_0x362963(0x1a1)](_0x6f2eff[_0x362963(0x263)])+_0x362963(0x219)+a134_0x591fe4[_0x362963(0x1a1)](_0x6f2eff[_0x362963(0x22e)]));const _0x12f6d1=_0x6f2eff[_0x362963(0x22e)],_0x447a2a=await apiChatInterfaceToYaml(_0x265025,_0x2bb10c),_0x32b38b=toChatInterfaceYamlString(_0x447a2a),_0x4771a8=!a134_0x2f02d2[_0x362963(0x1d0)](_0x12f6d1);let _0x421c16=_0x4771a8,_0x1b048e;if(!_0x4771a8){const _0x456227=a134_0x2f02d2[_0x362963(0x21f)](_0x12f6d1,_0x362963(0x202)),_0x2c6f69=generateDiff(_0x456227,_0x32b38b);_0x421c16=hasChanges(_0x2c6f69),_0x421c16&&(_0x1b048e=formatDiffWithColors(_0x2c6f69));}_0x13fe81['push']({'path':_0x12f6d1,'content':_0x32b38b}),_0x448873[_0x362963(0x169)][_0x362963(0x240)]({'name':_0x265025[_0x362963(0x1ca)][_0x362963(0x1c7)],'outputPath':_0x12f6d1,'isNew':_0x4771a8,'hasChanges':_0x421c16,'diff':_0x1b048e}),_0x448873[_0x362963(0x20c)]['chatInterfaces'][_0x362963(0x1bd)]++;if(_0x4771a8)_0x448873[_0x362963(0x20c)][_0x362963(0x169)][_0x362963(0x17a)]++;else{if(_0x421c16)_0x448873[_0x362963(0x20c)][_0x362963(0x169)][_0x362963(0x170)]++;else _0x448873[_0x362963(0x20c)]['chatInterfaces']['unchanged']++;}}if(_0xfa2d1e?.[_0x362963(0x1af)])return _0x448873;a134_0x2f02d2['mkdirSync'](_0x2cdb00,{'recursive':!![]}),a134_0x2f02d2['mkdirSync'](getKnowledgeBasesDir(_0x2cdb00),{'recursive':!![]}),a134_0x2f02d2[_0x362963(0x192)](getPromptsDir(_0x2cdb00),{'recursive':!![]}),a134_0x2f02d2[_0x362963(0x192)](getIntegrationsDir(_0x2cdb00),{'recursive':!![]}),a134_0x2f02d2[_0x362963(0x192)](getExperimentalKnowledgeBasesDir(_0x2cdb00),{'recursive':!![]}),a134_0x2f02d2['mkdirSync'](getExperimentalArtifactsDir(_0x2cdb00),{'recursive':!![]}),a134_0x2f02d2[_0x362963(0x192)](getFormInterfacesDir(_0x2cdb00),{'recursive':!![]}),a134_0x2f02d2[_0x362963(0x192)](getChatInterfacesDir(_0x2cdb00),{'recursive':!![]});const _0x312ae2=a134_0x591fe4[_0x362963(0x21b)](_0x2cdb00,'tdx.json');a134_0x2f02d2[_0x362963(0x20b)](_0x312ae2,createAgentConfigContent(_0x1ba0d4));for(const _0x1f83e5 of _0x13fe81){if(_0x1f83e5['isDir'])a134_0x2f02d2[_0x362963(0x192)](_0x1f83e5['path'],{'recursive':!![]});else{const _0x44669d=a134_0x591fe4[_0x362963(0x233)](_0x1f83e5['path']);!a134_0x2f02d2[_0x362963(0x1d0)](_0x44669d)&&a134_0x2f02d2['mkdirSync'](_0x44669d,{'recursive':!![]}),a134_0x2f02d2[_0x362963(0x20b)](_0x1f83e5[_0x362963(0x22e)],_0x1f83e5['content']);}}for(const _0x2bd70a of _0x5c12e0){_0x2bd70a[_0x362963(0x230)]?(a134_0x2f02d2[_0x362963(0x15c)](_0x2bd70a[_0x362963(0x22e)],{'recursive':!![],'force':!![]}),this['logger'][_0x362963(0x17d)](_0x362963(0x1a2)+a134_0x591fe4[_0x362963(0x1a1)](a134_0x591fe4[_0x362963(0x233)](_0x2bd70a[_0x362963(0x22e)]))+'/'+a134_0x591fe4[_0x362963(0x1a1)](_0x2bd70a['path']))):(a134_0x2f02d2[_0x362963(0x15c)](_0x2bd70a[_0x362963(0x22e)],{'force':!![]}),this['logger'][_0x362963(0x17d)]('Removed\x20deleted\x20file:\x20'+a134_0x591fe4[_0x362963(0x1a1)](a134_0x591fe4[_0x362963(0x233)](_0x2bd70a[_0x362963(0x22e)]))+'/'+a134_0x591fe4[_0x362963(0x1a1)](_0x2bd70a[_0x362963(0x22e)])));}return _0x448873;}async[a134_0x5ec437(0x1aa)](_0x65b390,_0x3597be){const _0x1171ff=a134_0x5ec437,_0x204342=a134_0x591fe4[_0x1171ff(0x21b)](_0x65b390,'tdx.json');if(!a134_0x2f02d2['existsSync'](_0x204342))throw new SDKError(ErrorCode[_0x1171ff(0x1ce)],_0x1171ff(0x1a0)+_0x65b390,undefined,{'helpText':_0x1171ff(0x1f6)});const _0x782835=loadAgentConfig(_0x204342),_0x42a8ce=await this[_0x1171ff(0x21c)](_0x782835[_0x1171ff(0x1a5)]),_0x31d62e=await this['client']['getProject'](_0x42a8ce),_0x20cc22=_0x31d62e[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0x375a38={'projectName':_0x20cc22,'projectId':_0x42a8ce,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x346895=[],_0x1f8ad7=[],_0x8ddca4=[],_0x5c9b1e=[],_0x55fb3f=[],_0x3c3ee8=[],_0x5ceed0=a134_0x2f02d2[_0x1171ff(0x1dd)](_0x65b390,{'withFileTypes':!![]});for(const _0xf1e15b of _0x5ceed0){if(!_0xf1e15b[_0x1171ff(0x197)]())continue;if([_0x1171ff(0x1f4),_0x1171ff(0x21e),_0x1171ff(0x196),'experimental_knowledge_bases',_0x1171ff(0x18b),_0x1171ff(0x1b1),_0x1171ff(0x21d)]['includes'](_0xf1e15b[_0x1171ff(0x1c7)]))continue;const _0x4a9cfd=a134_0x591fe4[_0x1171ff(0x21b)](_0x65b390,_0xf1e15b[_0x1171ff(0x1c7)]);if(isAgentDir(_0x4a9cfd)){const _0x59a09c=a134_0x591fe4[_0x1171ff(0x21b)](_0x4a9cfd,_0x1171ff(0x15b)),_0x39ee71=a134_0x591fe4[_0x1171ff(0x21b)](_0x4a9cfd,_0x1171ff(0x1c6)),_0x56a6fd=a134_0x591fe4['join'](_0x4a9cfd,_0x1171ff(0x1cf)),_0x34d9f7=parseAgentYaml(a134_0x2f02d2['readFileSync'](_0x59a09c,_0x1171ff(0x202)),_0x59a09c),_0x29e4f7=a134_0x2f02d2['existsSync'](_0x39ee71)?a134_0x2f02d2[_0x1171ff(0x21f)](_0x39ee71,_0x1171ff(0x202)):'',_0xef6209=a134_0x2f02d2[_0x1171ff(0x1d0)](_0x56a6fd)?a134_0x2f02d2['readFileSync'](_0x56a6fd,_0x1171ff(0x202)):_0x34d9f7[_0x1171ff(0x16d)];_0x346895[_0x1171ff(0x240)]({'name':_0x34d9f7['name'],'dir':_0x4a9cfd,'yaml':_0x34d9f7,'systemPrompt':_0x29e4f7,'starterMessage':_0xef6209});}}const _0x6ca5ad=getKnowledgeBasesDir(_0x65b390);if(a134_0x2f02d2[_0x1171ff(0x1d0)](_0x6ca5ad)){const _0xac2281=a134_0x2f02d2[_0x1171ff(0x1dd)](_0x6ca5ad);for(const _0x38e25e of _0xac2281){const _0x5473f5=a134_0x591fe4['join'](_0x6ca5ad,_0x38e25e);if(_0x38e25e[_0x1171ff(0x25a)](_0x1171ff(0x220))){const _0x26a95d=parseKnowledgeBaseYaml(a134_0x2f02d2[_0x1171ff(0x21f)](_0x5473f5,_0x1171ff(0x202)),_0x5473f5);_0x1f8ad7[_0x1171ff(0x240)]({'name':_0x26a95d[_0x1171ff(0x1c7)],'path':_0x5473f5,'yaml':_0x26a95d});}else{if(_0x38e25e[_0x1171ff(0x25a)](_0x1171ff(0x26e))){const _0x2552d1=a134_0x2f02d2[_0x1171ff(0x21f)](_0x5473f5,_0x1171ff(0x202)),{name:_0x431dc3,text:_0x354a2e}=parseTextKnowledgeBaseMd(_0x2552d1,_0x38e25e);_0x8ddca4[_0x1171ff(0x240)]({'name':_0x431dc3,'path':_0x5473f5,'text':_0x354a2e});}}}}const _0x28b3fb=getPromptsDir(_0x65b390);if(a134_0x2f02d2[_0x1171ff(0x1d0)](_0x28b3fb)){const _0x57d668=a134_0x2f02d2[_0x1171ff(0x1dd)](_0x28b3fb)[_0x1171ff(0x26b)](_0x5774fc=>_0x5774fc['endsWith'](_0x1171ff(0x220)));for(const _0x1d1936 of _0x57d668){const _0x57f4da=a134_0x591fe4[_0x1171ff(0x21b)](_0x28b3fb,_0x1d1936),_0x4345db=parsePromptYaml(a134_0x2f02d2[_0x1171ff(0x21f)](_0x57f4da,_0x1171ff(0x202)),_0x57f4da);_0x5c9b1e[_0x1171ff(0x240)]({'name':_0x4345db[_0x1171ff(0x1c7)],'path':_0x57f4da,'yaml':_0x4345db});}}const _0x374b80=[],_0x3e2bfb=getIntegrationsDir(_0x65b390);if(a134_0x2f02d2['existsSync'](_0x3e2bfb)){const _0xa31256=a134_0x2f02d2[_0x1171ff(0x1dd)](_0x3e2bfb)['filter'](_0x2a43f2=>_0x2a43f2[_0x1171ff(0x25a)](_0x1171ff(0x220)));for(const _0xce9c4d of _0xa31256){const _0x4fe8cf=a134_0x591fe4[_0x1171ff(0x21b)](_0x3e2bfb,_0xce9c4d),_0x51bbc9=parseIntegrationYaml(a134_0x2f02d2[_0x1171ff(0x21f)](_0x4fe8cf,_0x1171ff(0x202)),_0x4fe8cf);if(!SAFE_INTEGRATION_TYPES[_0x1171ff(0x1ed)](_0x51bbc9['service_type']['toLowerCase']())){this[_0x1171ff(0x1ff)][_0x1171ff(0x19f)](_0x1171ff(0x269)+_0x51bbc9[_0x1171ff(0x1c7)]+_0x1171ff(0x19a)+_0x51bbc9[_0x1171ff(0x228)]+_0x1171ff(0x255)+(_0x1171ff(0x1c1)+SAFE_INTEGRATION_TYPES[_0x1171ff(0x21b)](',\x20')+_0x1171ff(0x1b3))+'Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.');continue;}_0x374b80['push']({'name':_0x51bbc9[_0x1171ff(0x1c7)],'path':_0x4fe8cf,'yaml':_0x51bbc9});}}const _0x2ae9cf=getExperimentalKnowledgeBasesDir(_0x65b390);if(a134_0x2f02d2[_0x1171ff(0x1d0)](_0x2ae9cf)){const _0x7feb1=a134_0x2f02d2[_0x1171ff(0x1dd)](_0x2ae9cf,{'withFileTypes':!![]});for(const _0x38cc0c of _0x7feb1){if(!_0x38cc0c[_0x1171ff(0x197)]())continue;const _0x542072=a134_0x591fe4[_0x1171ff(0x21b)](_0x2ae9cf,_0x38cc0c['name']),_0x3a1470=a134_0x591fe4[_0x1171ff(0x21b)](_0x542072,_0x38cc0c[_0x1171ff(0x1c7)]+_0x1171ff(0x220)),_0x725e=a134_0x591fe4['join'](_0x542072,_0x1171ff(0x163));if(!a134_0x2f02d2[_0x1171ff(0x1d0)](_0x3a1470))continue;const _0x3c2c2a=parseExperimentalKnowledgeBaseYaml(a134_0x2f02d2[_0x1171ff(0x21f)](_0x3a1470,_0x1171ff(0x202)),_0x3a1470),_0x2c43df=[];if(a134_0x2f02d2[_0x1171ff(0x1d0)](_0x725e)){const _0x57898f=a134_0x2f02d2['readdirSync'](_0x725e,{'withFileTypes':!![]});for(const _0x94f827 of _0x57898f){if(!_0x94f827['isDirectory']())continue;const _0x333357=a134_0x591fe4[_0x1171ff(0x21b)](_0x725e,_0x94f827['name']),_0x108d9=a134_0x591fe4['join'](_0x333357,_0x1171ff(0x278)),_0x2dd686=a134_0x591fe4[_0x1171ff(0x21b)](_0x333357,_0x1171ff(0x166));a134_0x2f02d2[_0x1171ff(0x1d0)](_0x108d9)&&a134_0x2f02d2['existsSync'](_0x2dd686)&&_0x2c43df[_0x1171ff(0x240)]({'name':_0x94f827['name'],'code':a134_0x2f02d2[_0x1171ff(0x21f)](_0x108d9,'utf-8'),'json_schema':a134_0x2f02d2[_0x1171ff(0x21f)](_0x2dd686,_0x1171ff(0x202))});}}const _0x3843d8={..._0x3c2c2a,'variables':_0x3c2c2a[_0x1171ff(0x168)]||[],'functions':_0x2c43df};_0x55fb3f['push']({'name':_0x3c2c2a[_0x1171ff(0x1c7)],'dir':_0x542072,'def':_0x3843d8});}}const _0x51dcdc=getExperimentalArtifactsDir(_0x65b390);if(a134_0x2f02d2['existsSync'](_0x51dcdc)){const _0x1647f5=a134_0x2f02d2[_0x1171ff(0x1dd)](_0x51dcdc,{'withFileTypes':!![]});for(const _0x1664e4 of _0x1647f5){if(!_0x1664e4[_0x1171ff(0x197)]())continue;const _0x2da609=a134_0x591fe4[_0x1171ff(0x21b)](_0x51dcdc,_0x1664e4['name']),_0x2daa7d=a134_0x591fe4['join'](_0x2da609,_0x1664e4[_0x1171ff(0x1c7)]+_0x1171ff(0x220)),_0x507f23=a134_0x591fe4['join'](_0x2da609,'code.js'),_0x112353=a134_0x591fe4['join'](_0x2da609,_0x1171ff(0x1d2));if(!a134_0x2f02d2['existsSync'](_0x2daa7d)||!a134_0x2f02d2[_0x1171ff(0x1d0)](_0x507f23))continue;const _0x191730=parseExperimentalArtifactYaml(a134_0x2f02d2['readFileSync'](_0x2daa7d,_0x1171ff(0x202)),_0x2daa7d),_0x57e095=a134_0x2f02d2[_0x1171ff(0x21f)](_0x507f23,_0x1171ff(0x202)),_0x272b4e=[];if(a134_0x2f02d2[_0x1171ff(0x1d0)](_0x112353)){const _0x4837ba=a134_0x2f02d2[_0x1171ff(0x1dd)](_0x112353);for(const _0x44c83e of _0x4837ba){const _0x1a72ad=a134_0x591fe4[_0x1171ff(0x21b)](_0x112353,_0x44c83e);a134_0x2f02d2[_0x1171ff(0x161)](_0x1a72ad)['isFile']()&&_0x272b4e['push']({'file_name':_0x44c83e,'text_content':a134_0x2f02d2[_0x1171ff(0x21f)](_0x1a72ad,_0x1171ff(0x202))});}}const _0xe4ad24={..._0x191730,'code':_0x57e095,'files':_0x272b4e};_0x3c3ee8[_0x1171ff(0x240)]({'name':_0x191730[_0x1171ff(0x1c7)],'dir':_0x2da609,'def':_0xe4ad24});}}const _0x29ac09=[],_0x2514b7=getFormInterfacesDir(_0x65b390);if(a134_0x2f02d2[_0x1171ff(0x1d0)](_0x2514b7)){const _0x55ec61=a134_0x2f02d2[_0x1171ff(0x1dd)](_0x2514b7)[_0x1171ff(0x26b)](_0x5778ac=>_0x5778ac[_0x1171ff(0x25a)]('.yml'));for(const _0x13966c of _0x55ec61){const _0x1c6bba=a134_0x591fe4[_0x1171ff(0x21b)](_0x2514b7,_0x13966c),_0x484f6f=parseFormInterfaceYaml(a134_0x2f02d2[_0x1171ff(0x21f)](_0x1c6bba,_0x1171ff(0x202)),_0x1c6bba);_0x29ac09[_0x1171ff(0x240)]({'name':_0x484f6f[_0x1171ff(0x1c7)],'path':_0x1c6bba,'yaml':_0x484f6f});}}const _0x5349c5=[],_0xdeb071=getChatInterfacesDir(_0x65b390);if(a134_0x2f02d2['existsSync'](_0xdeb071)){const _0x27166c=a134_0x2f02d2[_0x1171ff(0x1dd)](_0xdeb071)['filter'](_0x528acc=>_0x528acc[_0x1171ff(0x25a)](_0x1171ff(0x220)));for(const _0x3e8e0d of _0x27166c){const _0x4798e0=a134_0x591fe4[_0x1171ff(0x21b)](_0xdeb071,_0x3e8e0d),_0x5dc8ae=parseChatInterfaceYaml(a134_0x2f02d2[_0x1171ff(0x21f)](_0x4798e0,_0x1171ff(0x202)),_0x4798e0);_0x5349c5['push']({'name':_0x5dc8ae[_0x1171ff(0x1c7)],'path':_0x4798e0,'yaml':_0x5dc8ae});}}const _0x29b840=await this[_0x1171ff(0x276)][_0x1171ff(0x165)](_0x42a8ce),_0x551789=await this['client'][_0x1171ff(0x1c2)](_0x42a8ce),_0x23acaa=await this[_0x1171ff(0x276)][_0x1171ff(0x1cd)](_0x42a8ce),_0x4dc6c1=await this['client'][_0x1171ff(0x15a)](_0x42a8ce),_0x3a82d0=await this[_0x1171ff(0x276)]['listIntegrations'](_0x42a8ce),_0x77e0bf=await safeListOrEmpty(()=>this['client'][_0x1171ff(0x200)](_0x42a8ce)),_0x568ba7=await safeListOrEmpty(()=>this[_0x1171ff(0x276)][_0x1171ff(0x178)](_0x42a8ce)),_0x4f617b=await safeListOrEmpty(()=>this[_0x1171ff(0x276)][_0x1171ff(0x177)](_0x42a8ce)),_0x1d04c4=await safeListOrEmpty(()=>this[_0x1171ff(0x276)][_0x1171ff(0x236)](_0x42a8ce)),_0xf28aac=await fetchAllToolTargetMaps((_0x4adc02,_0x39975b)=>this[_0x1171ff(0x276)][_0x1171ff(0x204)](_0x4adc02,_0x39975b),_0x42a8ce),_0x52a933=new Map(),_0x101860=new Map(),_0x2e5598=new Map(),_0x1cc255=new Map(),_0x533398=new Map(),_0x27213a=new Map(),_0x427307=new Map();for(const _0x56f254 of _0x29b840){_0x52a933['set'](_0x56f254[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0x56f254);}for(const _0x521616 of _0x551789){_0x101860['set'](_0x521616['attributes'][_0x1171ff(0x1c7)],_0x521616);}for(const _0x232827 of _0x23acaa){_0x2e5598[_0x1171ff(0x279)](_0x232827['attributes'][_0x1171ff(0x1c7)],_0x232827);}for(const _0x22f700 of _0x4dc6c1){_0x1cc255['set'](_0x22f700[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0x22f700);}for(const _0x5016b5 of _0x3a82d0){_0x533398[_0x1171ff(0x279)](_0x5016b5[_0x1171ff(0x1ca)]['serviceType']['toLowerCase'](),_0x5016b5);}for(const _0x53da53 of _0x77e0bf){_0x27213a[_0x1171ff(0x279)](_0x53da53[_0x1171ff(0x1ca)]['name'],_0x53da53);}for(const _0x53890d of _0x568ba7){_0x427307[_0x1171ff(0x279)](_0x53890d[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0x53890d);}const _0x512509=new Map(),_0x10298d=new Map();for(const _0xaa79ef of _0x4f617b){_0x512509[_0x1171ff(0x279)](_0xaa79ef[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0xaa79ef);}for(const _0x527fb1 of _0x1d04c4){_0x10298d[_0x1171ff(0x279)](_0x527fb1[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0x527fb1);}const _0x53830a=new Map(),_0x5a76b0=new Map();for(const _0x47b43d of _0x29b840){_0x53830a[_0x1171ff(0x279)](_0x47b43d[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0x47b43d['id']),_0x5a76b0['set'](_0x47b43d['id'],_0x47b43d['attributes']['name']);}const _0xc59cab=new Map(),_0xd13d0d=new Map();for(const _0x5df4d6 of _0x4dc6c1){_0xc59cab[_0x1171ff(0x279)](_0x5df4d6[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0x5df4d6['id']),_0xd13d0d[_0x1171ff(0x279)](_0x5df4d6['id'],_0x5df4d6['attributes'][_0x1171ff(0x1c7)]);}const _0x3679ad=_0xf28aac[_0x1171ff(0x231)]['KnowledgeBase']||new Map(),_0x65f67=_0xf28aac[_0x1171ff(0x231)][_0x1171ff(0x1a6)]||new Map(),_0x3692c8=_0xf28aac[_0x1171ff(0x231)]['ExperimentalKnowledgeBase']||new Map(),_0x3658c8=new Map(),_0x575d39={'resolveToolTargetName':buildNameResolver({..._0xf28aac[_0x1171ff(0x266)],'Agent':_0x5a76b0}),'resolvePromptName':async _0x598bee=>_0xd13d0d[_0x1171ff(0x26f)](_0x598bee),'onWarning':_0x50e992=>this[_0x1171ff(0x1ff)][_0x1171ff(0x19f)](_0x50e992)};let _0x38c400=[];const _0x39e7d2={'projectId':_0x42a8ce,'resolveToolTargetId':buildIdResolver({..._0xf28aac['nameToId'],'Agent':_0x53830a}),'resolvePromptId':async _0x20a4ee=>_0xc59cab[_0x1171ff(0x26f)](_0x20a4ee),'onWarning':_0x23c851=>{this['logger']['warn'](_0x23c851),_0x38c400['push'](_0x23c851);}},{resolved:_0x4aeab1,unresolved:_0x1a2860}=resolveAgentDependencies(_0x346895,new Set(_0x52a933['keys']()));for(const {agent:_0x442fa6,missingDeps:_0x630f87}of _0x1a2860){_0x375a38[_0x1171ff(0x1fb)]['push']({'agentName':_0x442fa6[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':'error','error':_0x1171ff(0x1f7)+_0x630f87[_0x1171ff(0x21b)](',\x20')+_0x1171ff(0x1fe)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x1fb)][_0x1171ff(0x1e8)]++;}for(const _0x351846 of _0x1f8ad7){const _0x2a072f=_0x101860[_0x1171ff(0x26f)](_0x351846[_0x1171ff(0x262)][_0x1171ff(0x1c7)]),_0x632e6f=a134_0x2f02d2['readFileSync'](_0x351846['path'],_0x1171ff(0x202));if(_0x2a072f){const _0x5bad39=apiKnowledgeBaseToYaml(_0x2a072f),_0x5f0a3b=toKnowledgeBaseYamlString(_0x5bad39),_0x34efad=generateDiff(_0x5f0a3b,_0x632e6f),_0x49827f=hasChanges(_0x34efad);_0x49827f?(_0x375a38[_0x1171ff(0x253)][_0x1171ff(0x240)]({'name':_0x351846[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':'updated','id':_0x2a072f['id'],'diff':formatDiffWithColors(_0x34efad)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x253)][_0x1171ff(0x170)]++):(_0x375a38[_0x1171ff(0x253)][_0x1171ff(0x240)]({'name':_0x351846[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x23d),'id':_0x2a072f['id']}),_0x375a38[_0x1171ff(0x20c)]['knowledgeBases']['unchanged']++);}else _0x375a38[_0x1171ff(0x253)]['push']({'name':_0x351846['yaml']['name'],'action':'created'}),_0x375a38['counts'][_0x1171ff(0x253)][_0x1171ff(0x258)]++;}for(const _0x1970ac of _0x8ddca4){const _0x104d6a=_0x2e5598[_0x1171ff(0x26f)](_0x1970ac[_0x1171ff(0x1c7)]),_0x55a00b=a134_0x2f02d2[_0x1171ff(0x21f)](_0x1970ac[_0x1171ff(0x22e)],_0x1171ff(0x202));if(_0x104d6a){const _0x5b647b=toTextKnowledgeBaseMd(_0x104d6a[_0x1171ff(0x1ca)][_0x1171ff(0x1c7)],_0x104d6a['attributes'][_0x1171ff(0x180)]),_0x416ce5=generateDiff(_0x5b647b,_0x55a00b),_0x48b4ab=hasChanges(_0x416ce5);_0x48b4ab?(_0x375a38[_0x1171ff(0x260)]['push']({'name':_0x1970ac[_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x104d6a['id'],'diff':formatDiffWithColors(_0x416ce5)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x260)]['updated']++):(_0x375a38['textKnowledgeBases'][_0x1171ff(0x240)]({'name':_0x1970ac[_0x1171ff(0x1c7)],'action':'unchanged','id':_0x104d6a['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x260)]['unchanged']++);}else _0x375a38[_0x1171ff(0x260)][_0x1171ff(0x240)]({'name':_0x1970ac[_0x1171ff(0x1c7)],'action':_0x1171ff(0x258)}),_0x375a38['counts'][_0x1171ff(0x260)][_0x1171ff(0x258)]++;}for(const _0xae7766 of _0x4aeab1){const _0x682ed5=_0x52a933['get'](_0xae7766[_0x1171ff(0x262)][_0x1171ff(0x1c7)]),_0x4ad64b=a134_0x591fe4['join'](_0xae7766['dir'],_0x1171ff(0x15b)),_0x207d8a=a134_0x2f02d2[_0x1171ff(0x21f)](_0x4ad64b,_0x1171ff(0x202)),_0x4d64c3=_0xae7766[_0x1171ff(0x25c)],_0xed8a2c=_0x1171ff(0x24f)+_0x4d64c3+_0x1171ff(0x191)+_0x207d8a;if(_0x682ed5){const {yaml:_0x426164,systemPrompt:_0x64ccd2}=await agentResponseToDef(_0x682ed5,_0x575d39),_0x4de8c5=toAgentYamlString(_0x426164),_0x1e89c5=_0x1171ff(0x24f)+_0x64ccd2+'\x0a\x0a#\x20agent.yml\x0a'+_0x4de8c5,_0x3cc1eb=generateDiff(_0x1e89c5,_0xed8a2c),_0x3b05cc=hasChanges(_0x3cc1eb);_0x3b05cc?(_0x375a38[_0x1171ff(0x1fb)][_0x1171ff(0x240)]({'agentName':_0xae7766[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'agentId':_0x682ed5['id'],'diff':formatDiffWithColors(_0x3cc1eb)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x1fb)][_0x1171ff(0x170)]++):(_0x375a38[_0x1171ff(0x1fb)][_0x1171ff(0x240)]({'agentName':_0xae7766[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x23d),'agentId':_0x682ed5['id']}),_0x375a38[_0x1171ff(0x20c)]['agents'][_0x1171ff(0x23d)]++);}else _0x375a38[_0x1171ff(0x1fb)]['push']({'agentName':_0xae7766[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x1fb)]['created']++;}for(const _0x56f626 of _0x5c9b1e){const _0x596c76=_0x1cc255[_0x1171ff(0x26f)](_0x56f626[_0x1171ff(0x262)]['name']),_0x5d45b2=a134_0x2f02d2[_0x1171ff(0x21f)](_0x56f626['path'],_0x1171ff(0x202));if(_0x596c76){const _0x311a77=await apiPromptToYaml(_0x596c76,_0x575d39);if(!_0x311a77){_0x375a38[_0x1171ff(0x21e)][_0x1171ff(0x240)]({'name':_0x56f626[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':'updated','id':_0x596c76['id']}),_0x375a38['counts'][_0x1171ff(0x21e)][_0x1171ff(0x170)]++;continue;}const _0xd4183a=toPromptYamlString(_0x311a77),_0x278739=generateDiff(_0xd4183a,_0x5d45b2),_0x83c4c9=hasChanges(_0x278739);_0x83c4c9?(_0x375a38[_0x1171ff(0x21e)][_0x1171ff(0x240)]({'name':_0x56f626[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x596c76['id'],'diff':formatDiffWithColors(_0x278739)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x21e)]['updated']++):(_0x375a38[_0x1171ff(0x21e)]['push']({'name':_0x56f626[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x23d),'id':_0x596c76['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x21e)]['unchanged']++);}else _0x375a38[_0x1171ff(0x21e)][_0x1171ff(0x240)]({'name':_0x56f626[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x21e)][_0x1171ff(0x258)]++;}for(const _0x56a708 of _0x374b80){const _0x2a07f8=_0x533398[_0x1171ff(0x26f)](_0x56a708[_0x1171ff(0x262)][_0x1171ff(0x228)]),_0x7ee16f=a134_0x2f02d2['readFileSync'](_0x56a708[_0x1171ff(0x22e)],_0x1171ff(0x202));if(_0x2a07f8){const _0x2aafdf=await apiIntegrationToYaml(_0x2a07f8,_0x575d39),_0x557442=toIntegrationYamlString(_0x2aafdf),_0x139a0e=generateDiff(_0x557442,_0x7ee16f),_0x8aa495=hasChanges(_0x139a0e);_0x8aa495?(_0x375a38[_0x1171ff(0x196)]['push']({'name':_0x56a708[_0x1171ff(0x262)][_0x1171ff(0x228)],'action':'updated','id':_0x2a07f8['id'],'diff':formatDiffWithColors(_0x139a0e)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x196)][_0x1171ff(0x170)]++):(_0x375a38[_0x1171ff(0x196)][_0x1171ff(0x240)]({'name':_0x56a708['yaml'][_0x1171ff(0x228)],'action':'unchanged','id':_0x2a07f8['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x196)][_0x1171ff(0x23d)]++);}else _0x375a38[_0x1171ff(0x196)][_0x1171ff(0x240)]({'name':_0x56a708['yaml'][_0x1171ff(0x228)],'action':_0x1171ff(0x258)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x196)][_0x1171ff(0x258)]++;}for(const _0x35c775 of _0x55fb3f){const _0x3f0212=_0x27213a[_0x1171ff(0x26f)](_0x35c775[_0x1171ff(0x252)]['name']),_0x2cc246=toExperimentalKnowledgeBaseYamlString(_0x35c775[_0x1171ff(0x252)]);let _0x37f992=_0x2cc246;for(const _0x3b370b of _0x35c775[_0x1171ff(0x252)][_0x1171ff(0x163)]){_0x37f992+=_0x1171ff(0x23a)+_0x3b370b[_0x1171ff(0x1c7)]+_0x1171ff(0x194)+_0x3b370b['code']+'\x0a---\x20schema:\x20'+_0x3b370b[_0x1171ff(0x1c7)]+_0x1171ff(0x194)+_0x3b370b[_0x1171ff(0x16b)]+'\x0a';}if(_0x3f0212){const _0x5f0b5c=apiExperimentalKnowledgeBaseToYaml(_0x3f0212),_0x28965a=toExperimentalKnowledgeBaseYamlString(_0x5f0b5c);let _0xaaa84d=_0x28965a;for(const _0x4b3852 of _0x5f0b5c[_0x1171ff(0x163)]){_0xaaa84d+=_0x1171ff(0x23a)+_0x4b3852[_0x1171ff(0x1c7)]+_0x1171ff(0x194)+_0x4b3852[_0x1171ff(0x235)]+_0x1171ff(0x17b)+_0x4b3852[_0x1171ff(0x1c7)]+'\x20---\x0a'+_0x4b3852['json_schema']+'\x0a';}const _0x3a7403=generateDiff(_0xaaa84d,_0x37f992),_0xc0703e=hasChanges(_0x3a7403);_0xc0703e?(_0x375a38['experimentalKnowledgeBases'][_0x1171ff(0x240)]({'name':_0x35c775['def'][_0x1171ff(0x1c7)],'action':'updated','id':_0x3f0212['id'],'diff':formatDiffWithColors(_0x3a7403)}),_0x375a38[_0x1171ff(0x20c)]['experimentalKnowledgeBases'][_0x1171ff(0x170)]++):(_0x375a38[_0x1171ff(0x264)][_0x1171ff(0x240)]({'name':_0x35c775['def'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x23d),'id':_0x3f0212['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x264)][_0x1171ff(0x23d)]++);}else _0x375a38[_0x1171ff(0x264)][_0x1171ff(0x240)]({'name':_0x35c775[_0x1171ff(0x252)]['name'],'action':_0x1171ff(0x258)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x264)]['created']++;}for(const _0x283f79 of _0x3c3ee8){const _0x329d42=_0x427307[_0x1171ff(0x26f)](_0x283f79['def'][_0x1171ff(0x1c7)]),_0x498cbf=toExperimentalArtifactYamlString(_0x283f79['def']);let _0x42cb30=_0x498cbf+(_0x1171ff(0x195)+_0x283f79[_0x1171ff(0x252)][_0x1171ff(0x235)]+'\x0a');for(const _0x48345d of _0x283f79[_0x1171ff(0x252)][_0x1171ff(0x1d2)]){_0x42cb30+='---\x20file:\x20'+_0x48345d[_0x1171ff(0x234)]+_0x1171ff(0x194)+_0x48345d['text_content']+'\x0a';}if(_0x329d42){const _0xcce8ec=apiExperimentalArtifactToYaml(_0x329d42),_0x139196=toExperimentalArtifactYamlString(_0xcce8ec);let _0x87bec3=_0x139196+(_0x1171ff(0x195)+_0xcce8ec['code']+'\x0a');for(const _0x3e4ddb of _0xcce8ec[_0x1171ff(0x1d2)]){_0x87bec3+=_0x1171ff(0x21a)+_0x3e4ddb[_0x1171ff(0x234)]+_0x1171ff(0x194)+_0x3e4ddb[_0x1171ff(0x254)]+'\x0a';}const _0xc75201=generateDiff(_0x87bec3,_0x42cb30),_0x7172a6=hasChanges(_0xc75201);_0x7172a6?(_0x375a38['experimentalArtifacts'][_0x1171ff(0x240)]({'name':_0x283f79[_0x1171ff(0x252)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x329d42['id'],'diff':formatDiffWithColors(_0xc75201)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x229)]['updated']++):(_0x375a38[_0x1171ff(0x229)][_0x1171ff(0x240)]({'name':_0x283f79[_0x1171ff(0x252)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x23d),'id':_0x329d42['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x229)]['unchanged']++);}else _0x375a38[_0x1171ff(0x229)][_0x1171ff(0x240)]({'name':_0x283f79['def'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x229)][_0x1171ff(0x258)]++;}for(const _0x5d89a9 of _0x29ac09){const _0x121292=_0x512509[_0x1171ff(0x26f)](_0x5d89a9[_0x1171ff(0x262)]['name']),_0x3440df=a134_0x2f02d2['readFileSync'](_0x5d89a9[_0x1171ff(0x22e)],_0x1171ff(0x202));if(_0x121292){const _0x513304=await apiFormInterfaceToYaml(_0x121292,_0x575d39),_0x380afd=toFormInterfaceYamlString(_0x513304),_0x34c48f=generateDiff(_0x380afd,_0x3440df),_0x3c80f6=hasChanges(_0x34c48f);_0x3c80f6?(_0x375a38['formInterfaces'][_0x1171ff(0x240)]({'name':_0x5d89a9[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x121292['id'],'diff':formatDiffWithColors(_0x34c48f)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x22d)][_0x1171ff(0x170)]++):(_0x375a38['formInterfaces'][_0x1171ff(0x240)]({'name':_0x5d89a9[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':'unchanged','id':_0x121292['id']}),_0x375a38[_0x1171ff(0x20c)]['formInterfaces']['unchanged']++);}else _0x375a38[_0x1171ff(0x22d)][_0x1171ff(0x240)]({'name':_0x5d89a9[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':'created'}),_0x375a38[_0x1171ff(0x20c)]['formInterfaces']['created']++;}for(const _0x48574a of _0x5349c5){const _0x259c8f=_0x10298d['get'](_0x48574a['yaml'][_0x1171ff(0x1c7)]),_0x2dc0da=a134_0x2f02d2[_0x1171ff(0x21f)](_0x48574a[_0x1171ff(0x22e)],_0x1171ff(0x202));if(_0x259c8f){const _0x45f57c=await apiChatInterfaceToYaml(_0x259c8f,_0x575d39),_0x119b3c=toChatInterfaceYamlString(_0x45f57c),_0x4b4cc4=generateDiff(_0x119b3c,_0x2dc0da),_0x40901a=hasChanges(_0x4b4cc4);_0x40901a?(_0x375a38['chatInterfaces'][_0x1171ff(0x240)]({'name':_0x48574a[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':'updated','id':_0x259c8f['id'],'diff':formatDiffWithColors(_0x4b4cc4)}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x169)][_0x1171ff(0x170)]++):(_0x375a38[_0x1171ff(0x169)][_0x1171ff(0x240)]({'name':_0x48574a[_0x1171ff(0x262)]['name'],'action':'unchanged','id':_0x259c8f['id']}),_0x375a38[_0x1171ff(0x20c)]['chatInterfaces']['unchanged']++);}else _0x375a38[_0x1171ff(0x169)]['push']({'name':_0x48574a[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258)}),_0x375a38[_0x1171ff(0x20c)]['chatInterfaces'][_0x1171ff(0x258)]++;}if(_0x3597be?.[_0x1171ff(0x1af)])return _0x375a38;_0x375a38[_0x1171ff(0x253)]=[],_0x375a38[_0x1171ff(0x260)]=[],_0x375a38['prompts']=[],_0x375a38[_0x1171ff(0x196)]=[],_0x375a38[_0x1171ff(0x264)]=[],_0x375a38[_0x1171ff(0x229)]=[],_0x375a38[_0x1171ff(0x22d)]=[],_0x375a38[_0x1171ff(0x169)]=[];const _0x39ca7e=_0x375a38[_0x1171ff(0x1fb)][_0x1171ff(0x26b)](_0x15cbe9=>_0x15cbe9['action']==='error');_0x375a38[_0x1171ff(0x1fb)]=_0x39ca7e,_0x375a38['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x39ca7e['length']},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x223336 of _0x1f8ad7){try{const _0xb72b0e=_0x101860['get'](_0x223336[_0x1171ff(0x262)][_0x1171ff(0x1c7)]),_0x3117fc=yamlKnowledgeBaseToApi(_0x223336[_0x1171ff(0x262)],_0x42a8ce);if(_0xb72b0e)await this[_0x1171ff(0x276)][_0x1171ff(0x1ea)](_0xb72b0e['id'],_0x3117fc),_0x3679ad[_0x1171ff(0x279)](_0x223336['yaml']['name'],_0xb72b0e['id']),_0x375a38[_0x1171ff(0x253)][_0x1171ff(0x240)]({'name':_0x223336['yaml'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0xb72b0e['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x253)][_0x1171ff(0x170)]++;else{const _0x115b1b=await this['client'][_0x1171ff(0x1d5)](_0x3117fc);_0x3679ad[_0x1171ff(0x279)](_0x223336[_0x1171ff(0x262)][_0x1171ff(0x1c7)],_0x115b1b['id']),_0x375a38[_0x1171ff(0x253)]['push']({'name':_0x223336[_0x1171ff(0x262)]['name'],'action':_0x1171ff(0x258),'id':_0x115b1b['id']}),_0x375a38[_0x1171ff(0x20c)]['knowledgeBases'][_0x1171ff(0x258)]++;}}catch(_0x302bba){_0x375a38[_0x1171ff(0x253)][_0x1171ff(0x240)]({'name':_0x223336['yaml']['name'],'action':_0x1171ff(0x1de),'error':_0x302bba[_0x1171ff(0x176)]}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x253)]['errors']++;}}for(const _0x166ab9 of _0x8ddca4){try{const _0x5d4e9c=_0x2e5598[_0x1171ff(0x26f)](_0x166ab9[_0x1171ff(0x1c7)]),_0x55eb0c=yamlTextKnowledgeBaseToApi({'name':_0x166ab9[_0x1171ff(0x1c7)],'text':_0x166ab9['text']},_0x42a8ce);if(_0x5d4e9c)await this[_0x1171ff(0x276)][_0x1171ff(0x23c)](_0x5d4e9c['id'],_0x55eb0c),_0x65f67[_0x1171ff(0x279)](_0x166ab9[_0x1171ff(0x1c7)],_0x5d4e9c['id']),_0x375a38[_0x1171ff(0x260)][_0x1171ff(0x240)]({'name':_0x166ab9[_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x5d4e9c['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x260)]['updated']++;else{const _0x3cb241=await this[_0x1171ff(0x276)][_0x1171ff(0x19d)](_0x55eb0c);_0x65f67[_0x1171ff(0x279)](_0x166ab9[_0x1171ff(0x1c7)],_0x3cb241['id']),_0x375a38[_0x1171ff(0x260)][_0x1171ff(0x240)]({'name':_0x166ab9[_0x1171ff(0x1c7)],'action':_0x1171ff(0x258),'id':_0x3cb241['id']}),_0x375a38['counts']['textKnowledgeBases'][_0x1171ff(0x258)]++;}}catch(_0xd81e9c){_0x375a38[_0x1171ff(0x260)][_0x1171ff(0x240)]({'name':_0x166ab9['name'],'action':_0x1171ff(0x1de),'error':_0xd81e9c[_0x1171ff(0x176)]}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x260)]['errors']++;}}for(const _0x23afab of _0x55fb3f){try{const _0x3d8825=_0x27213a['get'](_0x23afab[_0x1171ff(0x252)][_0x1171ff(0x1c7)]),_0x35fc39=yamlExperimentalKnowledgeBaseToApi(_0x23afab[_0x1171ff(0x252)],_0x42a8ce);if(_0x3d8825)await this[_0x1171ff(0x276)]['updateExperimentalKnowledgeBase'](_0x3d8825['id'],_0x35fc39),_0x3692c8[_0x1171ff(0x279)](_0x23afab[_0x1171ff(0x252)][_0x1171ff(0x1c7)],_0x3d8825['id']),_0x375a38[_0x1171ff(0x264)][_0x1171ff(0x240)]({'name':_0x23afab[_0x1171ff(0x252)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x3d8825['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x264)][_0x1171ff(0x170)]++;else{const _0x3a60f9=await this['client']['createExperimentalKnowledgeBase'](_0x35fc39);_0x3692c8[_0x1171ff(0x279)](_0x23afab[_0x1171ff(0x252)][_0x1171ff(0x1c7)],_0x3a60f9['id']),_0x375a38[_0x1171ff(0x264)][_0x1171ff(0x240)]({'name':_0x23afab['def'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258),'id':_0x3a60f9['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x264)]['created']++;}}catch(_0x50b3a8){_0x375a38[_0x1171ff(0x264)]['push']({'name':_0x23afab[_0x1171ff(0x252)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x1de),'error':_0x50b3a8[_0x1171ff(0x176)]}),_0x375a38[_0x1171ff(0x20c)]['experimentalKnowledgeBases'][_0x1171ff(0x1e8)]++;}}for(const _0x10c5bf of _0x3c3ee8){try{const _0x24e7d1=_0x427307[_0x1171ff(0x26f)](_0x10c5bf['def'][_0x1171ff(0x1c7)]),_0x3074fc=yamlExperimentalArtifactToApi(_0x10c5bf[_0x1171ff(0x252)],_0x42a8ce);if(_0x24e7d1)await this[_0x1171ff(0x276)][_0x1171ff(0x249)](_0x24e7d1['id'],_0x3074fc),_0x3658c8[_0x1171ff(0x279)](_0x10c5bf[_0x1171ff(0x252)]['name'],_0x24e7d1['id']),_0x375a38[_0x1171ff(0x229)][_0x1171ff(0x240)]({'name':_0x10c5bf['def'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x24e7d1['id']}),_0x375a38[_0x1171ff(0x20c)]['experimentalArtifacts'][_0x1171ff(0x170)]++;else{const _0x35ea7b=await this[_0x1171ff(0x276)][_0x1171ff(0x215)](_0x3074fc);_0x3658c8[_0x1171ff(0x279)](_0x10c5bf[_0x1171ff(0x252)]['name'],_0x35ea7b['id']),_0x375a38[_0x1171ff(0x229)][_0x1171ff(0x240)]({'name':_0x10c5bf['def'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258),'id':_0x35ea7b['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x229)]['created']++;}}catch(_0x5c1da9){_0x375a38[_0x1171ff(0x229)]['push']({'name':_0x10c5bf['def'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x1de),'error':_0x5c1da9['message']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x229)][_0x1171ff(0x1e8)]++;}}for(const _0x4d584f of _0x4aeab1){_0x38c400=[];try{const _0x1e475d=_0x52a933[_0x1171ff(0x26f)](_0x4d584f[_0x1171ff(0x262)]['name']),_0x695e7e=await agentDefToRequest(_0x4d584f['yaml'],_0x4d584f[_0x1171ff(0x25c)],_0x4d584f[_0x1171ff(0x20a)],_0x39e7d2);if(_0x1e475d)await this[_0x1171ff(0x276)]['updateAgentResponse'](_0x1e475d['id'],_0x695e7e),_0x53830a['set'](_0x4d584f[_0x1171ff(0x262)][_0x1171ff(0x1c7)],_0x1e475d['id']),_0x375a38['agents']['push']({'agentName':_0x4d584f['yaml']['name'],'action':_0x1171ff(0x170),'agentId':_0x1e475d['id'],'warnings':_0x38c400['length']>0x0?_0x38c400:undefined}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x1fb)][_0x1171ff(0x170)]++;else{const _0x106c16=await this[_0x1171ff(0x276)][_0x1171ff(0x186)](_0x695e7e);_0x53830a[_0x1171ff(0x279)](_0x4d584f['yaml'][_0x1171ff(0x1c7)],_0x106c16['id']),_0x375a38[_0x1171ff(0x1fb)]['push']({'agentName':_0x4d584f[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258),'agentId':_0x106c16['id'],'warnings':_0x38c400['length']>0x0?_0x38c400:undefined}),_0x375a38[_0x1171ff(0x20c)]['agents'][_0x1171ff(0x258)]++;}}catch(_0x4f6dd8){_0x375a38[_0x1171ff(0x1fb)]['push']({'agentName':_0x4d584f[_0x1171ff(0x262)]['name'],'action':_0x1171ff(0x1de),'error':_0x4f6dd8[_0x1171ff(0x176)],'warnings':_0x38c400['length']>0x0?_0x38c400:undefined}),_0x375a38[_0x1171ff(0x20c)]['agents'][_0x1171ff(0x1e8)]++;}}for(const _0x5f3896 of _0x5c9b1e){try{const _0x13c439=_0x1cc255['get'](_0x5f3896['yaml']['name']),_0x1aa075=await yamlPromptToApi(_0x5f3896[_0x1171ff(0x262)],_0x42a8ce,_0x39e7d2);if(!_0x1aa075){_0x375a38['prompts'][_0x1171ff(0x240)]({'name':_0x5f3896[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x1de),'error':_0x1171ff(0x1e3)}),_0x375a38[_0x1171ff(0x20c)]['prompts'][_0x1171ff(0x1e8)]++;continue;}if(_0x13c439)await this[_0x1171ff(0x276)]['updatePrompt'](_0x13c439['id'],_0x1aa075),_0xc59cab[_0x1171ff(0x279)](_0x5f3896[_0x1171ff(0x262)][_0x1171ff(0x1c7)],_0x13c439['id']),_0x375a38[_0x1171ff(0x21e)][_0x1171ff(0x240)]({'name':_0x5f3896[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x13c439['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x21e)][_0x1171ff(0x170)]++;else{const _0x1b68d3=await this[_0x1171ff(0x276)]['createPrompt'](_0x1aa075);_0xc59cab[_0x1171ff(0x279)](_0x5f3896[_0x1171ff(0x262)][_0x1171ff(0x1c7)],_0x1b68d3['id']),_0x375a38[_0x1171ff(0x21e)]['push']({'name':_0x5f3896['yaml'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258),'id':_0x1b68d3['id']}),_0x375a38[_0x1171ff(0x20c)]['prompts'][_0x1171ff(0x258)]++;}}catch(_0x174efb){_0x375a38[_0x1171ff(0x21e)][_0x1171ff(0x240)]({'name':_0x5f3896[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':'error','error':_0x174efb[_0x1171ff(0x176)]}),_0x375a38[_0x1171ff(0x20c)]['prompts'][_0x1171ff(0x1e8)]++;}}for(const _0x133bac of _0x374b80){try{const _0x22dedd=_0x533398[_0x1171ff(0x26f)](_0x133bac['yaml'][_0x1171ff(0x228)]),_0x27e129=await yamlIntegrationToApi(_0x133bac[_0x1171ff(0x262)],_0x42a8ce,_0x39e7d2);if(_0x22dedd){await this['client'][_0x1171ff(0x23f)](_0x22dedd['id']);const _0x1e82f1=await this['client'][_0x1171ff(0x199)](_0x27e129);_0x375a38['integrations'][_0x1171ff(0x240)]({'name':_0x133bac[_0x1171ff(0x262)]['service_type'],'action':_0x1171ff(0x170),'id':_0x1e82f1['id']}),_0x375a38['counts'][_0x1171ff(0x196)]['updated']++;}else{const _0x388a63=await this[_0x1171ff(0x276)][_0x1171ff(0x199)](_0x27e129);_0x375a38[_0x1171ff(0x196)][_0x1171ff(0x240)]({'name':_0x133bac['yaml'][_0x1171ff(0x228)],'action':_0x1171ff(0x258),'id':_0x388a63['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x196)][_0x1171ff(0x258)]++;}}catch(_0x5f8a65){_0x375a38[_0x1171ff(0x196)]['push']({'name':_0x133bac[_0x1171ff(0x262)][_0x1171ff(0x228)],'action':_0x1171ff(0x1de),'error':_0x5f8a65[_0x1171ff(0x176)]}),_0x375a38[_0x1171ff(0x20c)]['integrations']['errors']++;}}for(const _0x576403 of _0x29ac09){try{const _0x29f31a=_0x512509[_0x1171ff(0x26f)](_0x576403['yaml'][_0x1171ff(0x1c7)]),_0x34b8e6=await yamlFormInterfaceToApi(_0x576403[_0x1171ff(0x262)],_0x42a8ce,_0x39e7d2);if(!_0x34b8e6){_0x375a38[_0x1171ff(0x22d)][_0x1171ff(0x240)]({'name':_0x576403[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x1de),'error':_0x1171ff(0x1fd)}),_0x375a38['counts'][_0x1171ff(0x22d)]['errors']++;continue;}if(_0x29f31a){const _0xa420b7=await this[_0x1171ff(0x276)][_0x1171ff(0x23b)](_0x29f31a['id'],_0x34b8e6);_0x375a38[_0x1171ff(0x22d)]['push']({'name':_0x576403[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0xa420b7['id']}),_0x375a38[_0x1171ff(0x20c)]['formInterfaces'][_0x1171ff(0x170)]++;}else{const _0x5e548d=await this[_0x1171ff(0x276)]['createFormInterface'](_0x34b8e6);_0x375a38[_0x1171ff(0x22d)][_0x1171ff(0x240)]({'name':_0x576403[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258),'id':_0x5e548d['id']}),_0x375a38['counts'][_0x1171ff(0x22d)][_0x1171ff(0x258)]++;}}catch(_0x253fb){_0x375a38[_0x1171ff(0x22d)][_0x1171ff(0x240)]({'name':_0x576403[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x1de),'error':_0x253fb[_0x1171ff(0x176)]}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x22d)][_0x1171ff(0x1e8)]++;}}for(const _0xd86119 of _0x5349c5){try{const _0x1f9bd6=_0x10298d[_0x1171ff(0x26f)](_0xd86119[_0x1171ff(0x262)][_0x1171ff(0x1c7)]),_0x8db940=await yamlChatInterfaceToApi(_0xd86119[_0x1171ff(0x262)],_0x42a8ce,_0x39e7d2);if(_0x1f9bd6){const _0x5857c9=await this['client']['updateChatInterface'](_0x1f9bd6['id'],_0x8db940);_0x375a38[_0x1171ff(0x169)][_0x1171ff(0x240)]({'name':_0xd86119['yaml'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x170),'id':_0x5857c9['id']}),_0x375a38[_0x1171ff(0x20c)][_0x1171ff(0x169)][_0x1171ff(0x170)]++;}else{const _0x116fc7=await this['client']['createChatInterface'](_0x8db940);_0x375a38[_0x1171ff(0x169)][_0x1171ff(0x240)]({'name':_0xd86119['yaml'][_0x1171ff(0x1c7)],'action':_0x1171ff(0x258),'id':_0x116fc7['id']}),_0x375a38['counts']['chatInterfaces'][_0x1171ff(0x258)]++;}}catch(_0x200ce9){_0x375a38['chatInterfaces']['push']({'name':_0xd86119[_0x1171ff(0x262)][_0x1171ff(0x1c7)],'action':_0x1171ff(0x1de),'error':_0x200ce9['message']}),_0x375a38['counts'][_0x1171ff(0x169)][_0x1171ff(0x1e8)]++;}}return _0x375a38;}async[a134_0x5ec437(0x1b6)](_0x13724a,_0x3954f6,_0x69aded,_0x566c09){const _0x205df6=a134_0x5ec437,{projectId:_0x213d30,project:_0x3f9f21}=await this[_0x205df6(0x173)](_0x13724a),_0x558766=_0x3f9f21['attributes'][_0x205df6(0x1c7)],_0x2d1d95=await this[_0x205df6(0x276)][_0x205df6(0x165)](_0x213d30),_0x515d09=_0x2d1d95[_0x205df6(0x261)](_0x39d12d=>_0x39d12d[_0x205df6(0x1ca)]['name']===_0x3954f6);if(!_0x515d09)throw new SDKError(ErrorCode[_0x205df6(0x18e)],_0x205df6(0x25f)+_0x3954f6,undefined,{'helpText':_0x205df6(0x226)+_0x2d1d95[_0x205df6(0x1f2)](_0x51082d=>_0x51082d['attributes'][_0x205df6(0x1c7)])[_0x205df6(0x21b)](',\x20')});let _0x1a4092;if(_0x69aded)_0x1a4092=_0x69aded;else{const _0x387909=a134_0x591fe4[_0x205df6(0x21b)](process[_0x205df6(0x1b7)](),_0x205df6(0x1fb)),_0x143294=getSanitizedPathWithMigration(_0x387909,_0x558766);_0x143294[_0x205df6(0x190)]&&this[_0x205df6(0x1ff)][_0x205df6(0x17d)](_0x205df6(0x227)+a134_0x591fe4[_0x205df6(0x1a1)](_0x143294[_0x205df6(0x263)])+_0x205df6(0x219)+a134_0x591fe4[_0x205df6(0x1a1)](_0x143294[_0x205df6(0x22e)])),_0x1a4092=_0x143294[_0x205df6(0x22e)];}const _0x2e4a70=getSanitizedPathWithMigration(_0x1a4092,_0x3954f6);_0x2e4a70[_0x205df6(0x190)]&&this[_0x205df6(0x1ff)]['info'](_0x205df6(0x17c)+a134_0x591fe4[_0x205df6(0x1a1)](_0x2e4a70[_0x205df6(0x263)])+_0x205df6(0x219)+a134_0x591fe4['basename'](_0x2e4a70['path']));const _0x4699a4=_0x2e4a70[_0x205df6(0x22e)],_0x1cd8b5=new Map(),_0x477cc6=new Map(),_0x524c9a=await this[_0x205df6(0x276)][_0x205df6(0x1c2)](_0x213d30),_0x1257df=await this[_0x205df6(0x276)][_0x205df6(0x1cd)](_0x213d30),_0x3e969c=await safeListOrEmpty(()=>this[_0x205df6(0x276)][_0x205df6(0x200)](_0x213d30)),_0x31e779=new Map(),_0x21e75a=new Map();for(const _0x5b0485 of _0x524c9a){_0x1cd8b5[_0x205df6(0x279)](_0x5b0485['id'],_0x5b0485[_0x205df6(0x1ca)][_0x205df6(0x1c7)]);}for(const _0x3b0a46 of _0x1257df){_0x31e779['set'](_0x3b0a46['id'],_0x3b0a46[_0x205df6(0x1ca)][_0x205df6(0x1c7)]);}for(const _0x34282d of _0x3e969c){_0x21e75a[_0x205df6(0x279)](_0x34282d['id'],_0x34282d[_0x205df6(0x1ca)][_0x205df6(0x1c7)]);}for(const _0x4ba1c7 of _0x2d1d95){_0x477cc6[_0x205df6(0x279)](_0x4ba1c7['id'],_0x4ba1c7[_0x205df6(0x1ca)][_0x205df6(0x1c7)]);}const _0x5f5bf5={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x1cd8b5,'TextKnowledgeBase':_0x31e779,'Agent':_0x477cc6,'ExperimentalKnowledgeBase':_0x21e75a}),'resolvePromptName':async()=>undefined,'onWarning':_0x49d744=>this[_0x205df6(0x1ff)][_0x205df6(0x19f)](_0x49d744)},_0x57b2b1=a134_0x591fe4['join'](_0x4699a4,_0x205df6(0x1c6)),_0x5518c5=a134_0x591fe4[_0x205df6(0x21b)](_0x4699a4,'agent.yml'),_0x465d58=a134_0x591fe4[_0x205df6(0x21b)](_0x4699a4,_0x205df6(0x1cf)),_0x2a43e2=!a134_0x2f02d2[_0x205df6(0x1d0)](_0x5518c5);if(_0x566c09?.[_0x205df6(0x1af)])return{'agentName':_0x3954f6,'outputPath':_0x4699a4,'isNew':_0x2a43e2,'hasChanges':!![]};a134_0x2f02d2['mkdirSync'](_0x1a4092,{'recursive':!![]}),a134_0x2f02d2[_0x205df6(0x192)](_0x4699a4,{'recursive':!![]});const _0x1c2b6f=a134_0x591fe4[_0x205df6(0x21b)](_0x1a4092,'tdx.json');!a134_0x2f02d2[_0x205df6(0x1d0)](_0x1c2b6f)&&a134_0x2f02d2[_0x205df6(0x20b)](_0x1c2b6f,createAgentConfigContent(_0x13724a));const {yaml:_0x3d7dc6,systemPrompt:_0x5e199f,starterMessage:_0x50ec18}=await agentResponseToDef(_0x515d09,_0x5f5bf5);let _0x413847=_0x2a43e2;if(!_0x2a43e2){const _0x83a4be=a134_0x2f02d2[_0x205df6(0x1d0)](_0x57b2b1)?a134_0x2f02d2[_0x205df6(0x21f)](_0x57b2b1,_0x205df6(0x202)):'',_0x216b70=a134_0x2f02d2[_0x205df6(0x21f)](_0x5518c5,'utf-8');_0x413847=_0x83a4be!==_0x5e199f||_0x216b70!==toAgentYamlString(_0x3d7dc6);}a134_0x2f02d2[_0x205df6(0x20b)](_0x57b2b1,_0x5e199f),a134_0x2f02d2[_0x205df6(0x20b)](_0x5518c5,toAgentYamlString(_0x3d7dc6));if(_0x50ec18&&_0x50ec18[_0x205df6(0x1ed)]('\x0a'))a134_0x2f02d2[_0x205df6(0x20b)](_0x465d58,_0x50ec18);else a134_0x2f02d2[_0x205df6(0x1d0)](_0x465d58)&&a134_0x2f02d2['unlinkSync'](_0x465d58);return{'agentName':_0x3954f6,'outputPath':_0x4699a4,'isNew':_0x2a43e2,'hasChanges':_0x413847};}async[a134_0x5ec437(0x1c5)](_0x122ecf,_0x35638b){const _0xf5c15a=a134_0x5ec437;let _0x5b448d;isAgentYamlPath(_0x122ecf)?_0x5b448d=getAgentDirFromYamlPath(_0x122ecf):_0x5b448d=_0x122ecf;const {config:_0x1f37f2}=findAgentConfig(_0x5b448d),_0x192ded=await this[_0xf5c15a(0x21c)](_0x1f37f2['llm_project']),_0x305e17=a134_0x591fe4[_0xf5c15a(0x21b)](_0x5b448d,_0xf5c15a(0x15b)),_0x2efe71=a134_0x591fe4[_0xf5c15a(0x21b)](_0x5b448d,_0xf5c15a(0x1c6)),_0x5075cb=a134_0x591fe4['join'](_0x5b448d,_0xf5c15a(0x1cf));if(!a134_0x2f02d2[_0xf5c15a(0x1d0)](_0x305e17))throw new SDKError(ErrorCode[_0xf5c15a(0x275)],_0xf5c15a(0x250)+_0x5b448d,undefined,{'helpText':_0xf5c15a(0x15f)});const _0xd4f841=parseAgentYaml(a134_0x2f02d2[_0xf5c15a(0x21f)](_0x305e17,'utf-8'),_0x305e17),_0x4b1537=a134_0x2f02d2[_0xf5c15a(0x1d0)](_0x2efe71)?a134_0x2f02d2[_0xf5c15a(0x21f)](_0x2efe71,_0xf5c15a(0x202)):'',_0x20e7e9=a134_0x2f02d2[_0xf5c15a(0x1d0)](_0x5075cb)?a134_0x2f02d2[_0xf5c15a(0x21f)](_0x5075cb,_0xf5c15a(0x202)):_0xd4f841[_0xf5c15a(0x16d)];if(_0x35638b?.[_0xf5c15a(0x1af)])return{'agentName':_0xd4f841[_0xf5c15a(0x1c7)],'action':'created','projectId':_0x192ded};const _0x5587fa=await this[_0xf5c15a(0x276)][_0xf5c15a(0x165)](_0x192ded),_0x43607a=await fetchAllToolTargetMaps((_0x4dfa70,_0x165a51)=>this[_0xf5c15a(0x276)][_0xf5c15a(0x204)](_0x4dfa70,_0x165a51),_0x192ded),_0x2e9afd=new Map();for(const _0x42ec0e of _0x5587fa){_0x2e9afd['set'](_0x42ec0e[_0xf5c15a(0x1ca)][_0xf5c15a(0x1c7)],_0x42ec0e['id']);}const _0x2449bb=[],_0x507cfa={'projectId':_0x192ded,'resolveToolTargetId':buildIdResolver({..._0x43607a[_0xf5c15a(0x231)],'Agent':_0x2e9afd}),'resolvePromptId':async()=>undefined,'onWarning':_0x914588=>{const _0x17e160=_0xf5c15a;this['logger'][_0x17e160(0x19f)](_0x914588),_0x2449bb['push'](_0x914588);}};try{const _0x1f2b2b=_0x5587fa[_0xf5c15a(0x261)](_0x1ac6c9=>_0x1ac6c9[_0xf5c15a(0x1ca)]['name']===_0xd4f841[_0xf5c15a(0x1c7)]),_0x245c11=await agentDefToRequest(_0xd4f841,_0x4b1537,_0x20e7e9,_0x507cfa);if(_0x1f2b2b)return await this[_0xf5c15a(0x276)]['updateAgentResponse'](_0x1f2b2b['id'],_0x245c11),{'agentName':_0xd4f841[_0xf5c15a(0x1c7)],'action':_0xf5c15a(0x170),'projectId':_0x192ded,'agentId':_0x1f2b2b['id'],'warnings':_0x2449bb[_0xf5c15a(0x1b2)]>0x0?_0x2449bb:undefined};else{const _0xc2cdbf=await this[_0xf5c15a(0x276)][_0xf5c15a(0x186)](_0x245c11);return{'agentName':_0xd4f841[_0xf5c15a(0x1c7)],'action':_0xf5c15a(0x258),'projectId':_0x192ded,'agentId':_0xc2cdbf['id'],'warnings':_0x2449bb[_0xf5c15a(0x1b2)]>0x0?_0x2449bb:undefined};}}catch(_0x4b319b){return{'agentName':_0xd4f841['name'],'action':_0xf5c15a(0x1de),'projectId':_0x192ded,'error':_0x4b319b[_0xf5c15a(0x176)],'warnings':_0x2449bb[_0xf5c15a(0x1b2)]>0x0?_0x2449bb:undefined};}}async[a134_0x5ec437(0x238)](_0x3587e9,_0x3d8a1a,_0x15c30e){const _0x3d0bb1=a134_0x5ec437,_0x4bd856=a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x3587e9)&&a134_0x2f02d2[_0x3d0bb1(0x1d0)](a134_0x591fe4['join'](_0x3587e9,_0x3d0bb1(0x1d9)));let _0x2e9e8d;const _0xe1ef58=[],_0x5d457c=[],_0x2a39e4=[],_0x4c3cd3=[],_0x15af29=[],_0x373611=[],_0x1d1d12=[],_0x5ebac6=[],_0xe97f0a=[];if(_0x4bd856){const _0x2d3372=loadAgentConfig(a134_0x591fe4[_0x3d0bb1(0x21b)](_0x3587e9,_0x3d0bb1(0x1d9)));_0x2e9e8d=_0x2d3372[_0x3d0bb1(0x1a5)];const _0x4b3227=a134_0x2f02d2[_0x3d0bb1(0x1dd)](_0x3587e9,{'withFileTypes':!![]});for(const _0x5874f3 of _0x4b3227){if(!_0x5874f3[_0x3d0bb1(0x197)]())continue;if(['knowledge_bases','experimental_knowledge_bases','experimental_artifacts','prompts','integrations',_0x3d0bb1(0x1b1),_0x3d0bb1(0x21d)][_0x3d0bb1(0x1ed)](_0x5874f3[_0x3d0bb1(0x1c7)]))continue;const _0x79e473=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x3587e9,_0x5874f3[_0x3d0bb1(0x1c7)]);if(isAgentDir(_0x79e473)){const _0x3277eb=a134_0x591fe4['join'](_0x79e473,_0x3d0bb1(0x15b)),_0x3954dc=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x79e473,'prompt.md'),_0x24c872=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x79e473,_0x3d0bb1(0x1cf)),_0x4866a8=parseAgentYaml(a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x3277eb,_0x3d0bb1(0x202)),_0x3277eb),_0x48de45=a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x3954dc)?a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x3954dc,_0x3d0bb1(0x202)):'',_0x2d67e2=a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x24c872)?a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x24c872,_0x3d0bb1(0x202)):_0x4866a8[_0x3d0bb1(0x16d)];_0xe1ef58[_0x3d0bb1(0x240)]({'name':_0x4866a8[_0x3d0bb1(0x1c7)],'dir':_0x79e473,'yaml':_0x4866a8,'systemPrompt':_0x48de45,'starterMessage':_0x2d67e2});}}const _0x434cae=getKnowledgeBasesDir(_0x3587e9);if(a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x434cae)){const _0x536bf6=a134_0x2f02d2[_0x3d0bb1(0x1dd)](_0x434cae);for(const _0x177d7e of _0x536bf6){const _0x1c2200=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x434cae,_0x177d7e);if(_0x177d7e[_0x3d0bb1(0x25a)]('.yml')){const _0x38718b=parseKnowledgeBaseYaml(a134_0x2f02d2['readFileSync'](_0x1c2200,_0x3d0bb1(0x202)),_0x1c2200);_0x5d457c[_0x3d0bb1(0x240)]({'name':_0x38718b[_0x3d0bb1(0x1c7)],'path':_0x1c2200,'yaml':_0x38718b});}else{if(_0x177d7e[_0x3d0bb1(0x25a)](_0x3d0bb1(0x26e))){const _0x730446=a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x1c2200,'utf-8'),{name:_0x5a27bd,text:_0x40a7a1}=parseTextKnowledgeBaseMd(_0x730446,_0x177d7e);_0x2a39e4['push']({'name':_0x5a27bd,'path':_0x1c2200,'text':_0x40a7a1});}}}}const _0x49f59b=getPromptsDir(_0x3587e9);if(a134_0x2f02d2['existsSync'](_0x49f59b)){const _0x43cc2d=a134_0x2f02d2['readdirSync'](_0x49f59b)['filter'](_0x56a55f=>_0x56a55f[_0x3d0bb1(0x25a)]('.yml'));for(const _0x499fd6 of _0x43cc2d){const _0x14cb57=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x49f59b,_0x499fd6),_0x2a93a6=parsePromptYaml(a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x14cb57,_0x3d0bb1(0x202)),_0x14cb57);_0x4c3cd3[_0x3d0bb1(0x240)]({'name':_0x2a93a6[_0x3d0bb1(0x1c7)],'path':_0x14cb57,'yaml':_0x2a93a6});}}const _0x1b2d69=getIntegrationsDir(_0x3587e9);if(a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x1b2d69)){const _0xdcedcc=a134_0x2f02d2[_0x3d0bb1(0x1dd)](_0x1b2d69)['filter'](_0x2c3b8b=>_0x2c3b8b[_0x3d0bb1(0x25a)](_0x3d0bb1(0x220)));for(const _0x2bdb02 of _0xdcedcc){const _0x58b4a1=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x1b2d69,_0x2bdb02),_0x3f7dd6=parseIntegrationYaml(a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x58b4a1,_0x3d0bb1(0x202)),_0x58b4a1);SAFE_INTEGRATION_TYPES[_0x3d0bb1(0x1ed)](_0x3f7dd6[_0x3d0bb1(0x228)][_0x3d0bb1(0x18d)]())?_0x15af29[_0x3d0bb1(0x240)]({'name':_0x3f7dd6['name'],'path':_0x58b4a1,'yaml':_0x3f7dd6}):this[_0x3d0bb1(0x1ff)][_0x3d0bb1(0x19f)](_0x3d0bb1(0x269)+_0x3f7dd6[_0x3d0bb1(0x1c7)]+_0x3d0bb1(0x19a)+_0x3f7dd6[_0x3d0bb1(0x228)]+_0x3d0bb1(0x255)+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES[_0x3d0bb1(0x21b)](',\x20')+_0x3d0bb1(0x1e0)));}}const _0x3ecb43=getExperimentalKnowledgeBasesDir(_0x3587e9);if(a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x3ecb43)){const _0x4e7177=a134_0x2f02d2['readdirSync'](_0x3ecb43,{'withFileTypes':!![]});for(const _0x31159c of _0x4e7177){if(!_0x31159c['isDirectory']())continue;const _0x53f14a=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x3ecb43,_0x31159c[_0x3d0bb1(0x1c7)]),_0x177f14=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x53f14a,_0x31159c[_0x3d0bb1(0x1c7)]+_0x3d0bb1(0x220));if(a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x177f14)){const _0x13c764=parseExperimentalKnowledgeBaseYaml(a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x177f14,_0x3d0bb1(0x202)),_0x177f14),_0x5747e4=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x53f14a,'functions'),_0x4e7431=[];if(a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x5747e4)){const _0x5c55d5=a134_0x2f02d2[_0x3d0bb1(0x1dd)](_0x5747e4,{'withFileTypes':!![]});for(const _0x435b93 of _0x5c55d5){if(!_0x435b93['isDirectory']())continue;const _0x2e6a0c=a134_0x591fe4['join'](_0x5747e4,_0x435b93[_0x3d0bb1(0x1c7)]),_0x2e4862=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x2e6a0c,_0x3d0bb1(0x278)),_0x21f064=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x2e6a0c,_0x3d0bb1(0x166));if(a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x2e4862)&&a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x21f064)){const _0x729e30=a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x2e4862,_0x3d0bb1(0x202)),_0x5c3581=a134_0x2f02d2['readFileSync'](_0x21f064,'utf-8');_0x4e7431['push']({'name':_0x435b93[_0x3d0bb1(0x1c7)],'code':_0x729e30,'json_schema':_0x5c3581});}}}const _0x326003={..._0x13c764,'functions':_0x4e7431};_0x373611[_0x3d0bb1(0x240)]({'name':_0x13c764['name'],'path':_0x53f14a,'def':_0x326003});}}}const _0x4e10eb=getExperimentalArtifactsDir(_0x3587e9);if(a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x4e10eb)){const _0x457b63=a134_0x2f02d2['readdirSync'](_0x4e10eb,{'withFileTypes':!![]});for(const _0x1caf1d of _0x457b63){if(!_0x1caf1d[_0x3d0bb1(0x197)]())continue;const _0x3ea646=a134_0x591fe4['join'](_0x4e10eb,_0x1caf1d[_0x3d0bb1(0x1c7)]),_0x2e107e=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x3ea646,_0x1caf1d[_0x3d0bb1(0x1c7)]+_0x3d0bb1(0x220));if(a134_0x2f02d2['existsSync'](_0x2e107e)){const _0xf270a4=parseExperimentalArtifactYaml(a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x2e107e,'utf-8'),_0x2e107e),_0x216cf6=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x3ea646,_0x3d0bb1(0x278)),_0x3bec17=a134_0x2f02d2['existsSync'](_0x216cf6)?a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x216cf6,_0x3d0bb1(0x202)):'',_0x4e702e=a134_0x591fe4['join'](_0x3ea646,'files'),_0x4db3c3=[];if(a134_0x2f02d2[_0x3d0bb1(0x1d0)](_0x4e702e)){const _0xe1a619=a134_0x2f02d2[_0x3d0bb1(0x1dd)](_0x4e702e);for(const _0x4dea50 of _0xe1a619){const _0x4b4b11=a134_0x591fe4['join'](_0x4e702e,_0x4dea50);if(a134_0x2f02d2[_0x3d0bb1(0x161)](_0x4b4b11)[_0x3d0bb1(0x20f)]()){const _0x441378=a134_0x2f02d2[_0x3d0bb1(0x21f)](_0x4b4b11,_0x3d0bb1(0x202));_0x4db3c3[_0x3d0bb1(0x240)]({'file_name':_0x4dea50,'text_content':_0x441378});}}}const _0x29298c={..._0xf270a4,'code':_0x3bec17,'files':_0x4db3c3};_0x1d1d12[_0x3d0bb1(0x240)]({'name':_0xf270a4[_0x3d0bb1(0x1c7)],'path':_0x3ea646,'def':_0x29298c});}}}const _0x66fa2d=getFormInterfacesDir(_0x3587e9);if(a134_0x2f02d2['existsSync'](_0x66fa2d)){const _0x2af751=a134_0x2f02d2[_0x3d0bb1(0x1dd)](_0x66fa2d)['filter'](_0x5babee=>_0x5babee[_0x3d0bb1(0x25a)]('.yml'));for(const _0x3328a8 of _0x2af751){const _0x2340a6=a134_0x591fe4[_0x3d0bb1(0x21b)](_0x66fa2d,_0x3328a8),_0x12b821=parseFormInterfaceYaml(a134_0x2f02d2['readFileSync'](_0x2340a6,_0x3d0bb1(0x202)),_0x2340a6);_0x5ebac6[_0x3d0bb1(0x240)]({'name':_0x12b821['name'],'path':_0x2340a6,'yaml':_0x12b821});}}const _0x25f932=getChatInterfacesDir(_0x3587e9);if(a134_0x2f02d2['existsSync'](_0x25f932)){const _0xd79acf=a134_0x2f02d2[_0x3d0bb1(0x1dd)](_0x25f932)['filter'](_0x2c8e44=>_0x2c8e44[_0x3d0bb1(0x25a)](_0x3d0bb1(0x220)));for(const _0xf9a0d4 of _0xd79acf){const _0x3a8409=a134_0x591fe4['join'](_0x25f932,_0xf9a0d4),_0xff9343=parseChatInterfaceYaml(a134_0x2f02d2['readFileSync'](_0x3a8409,_0x3d0bb1(0x202)),_0x3a8409);_0xe97f0a[_0x3d0bb1(0x240)]({'name':_0xff9343[_0x3d0bb1(0x1c7)],'path':_0x3a8409,'yaml':_0xff9343});}}}else{const _0x5774c5=await this[_0x3d0bb1(0x21c)](_0x3587e9),_0x595ff4=await this[_0x3d0bb1(0x276)]['getProject'](_0x5774c5);_0x2e9e8d=_0x595ff4[_0x3d0bb1(0x1ca)][_0x3d0bb1(0x1c7)];const _0xb3b207=await this['client']['listAgentsFull'](_0x5774c5),_0x5dc0ec=await this[_0x3d0bb1(0x276)]['listKnowledgeBases'](_0x5774c5),_0x26e151=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x1cd)](_0x5774c5),_0x4b4c67=await this[_0x3d0bb1(0x276)]['listPrompts'](_0x5774c5),_0x2c594f=await this[_0x3d0bb1(0x276)]['listIntegrations'](_0x5774c5),_0x507b42=await safeListOrEmpty(()=>this['client'][_0x3d0bb1(0x200)](_0x5774c5)),_0x1aa5dc=await safeListOrEmpty(()=>this['client'][_0x3d0bb1(0x178)](_0x5774c5)),_0x42b62a=new Map(),_0x30597a=new Map(),_0x431ffd=new Map(),_0x1a4f70=new Map(),_0xc87e4c=new Map(),_0x58cebf=new Map();for(const _0x2bdde9 of _0x5dc0ec){_0x42b62a[_0x3d0bb1(0x279)](_0x2bdde9['id'],_0x2bdde9['attributes'][_0x3d0bb1(0x1c7)]);}for(const _0x37a3b5 of _0x26e151){_0x30597a[_0x3d0bb1(0x279)](_0x37a3b5['id'],_0x37a3b5[_0x3d0bb1(0x1ca)][_0x3d0bb1(0x1c7)]);}for(const _0x19b4fe of _0xb3b207){_0x431ffd['set'](_0x19b4fe['id'],_0x19b4fe[_0x3d0bb1(0x1ca)][_0x3d0bb1(0x1c7)]);}for(const _0x2b203a of _0x4b4c67){_0x1a4f70[_0x3d0bb1(0x279)](_0x2b203a['id'],_0x2b203a[_0x3d0bb1(0x1ca)][_0x3d0bb1(0x1c7)]);}for(const _0x4db3d5 of _0x507b42){_0xc87e4c[_0x3d0bb1(0x279)](_0x4db3d5['id'],_0x4db3d5[_0x3d0bb1(0x1ca)]['name']);}for(const _0x10f004 of _0x1aa5dc){_0x58cebf[_0x3d0bb1(0x279)](_0x10f004['id'],_0x10f004['attributes'][_0x3d0bb1(0x1c7)]);}const _0x2afc90={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x42b62a,'TextKnowledgeBase':_0x30597a,'Agent':_0x431ffd,'ExperimentalKnowledgeBase':_0xc87e4c}),'resolvePromptName':async _0x15d9cf=>_0x1a4f70[_0x3d0bb1(0x26f)](_0x15d9cf),'onWarning':_0x31e923=>this[_0x3d0bb1(0x1ff)]['warn'](_0x31e923)};for(const _0x201f05 of _0xb3b207){const _0x3fdbce=await agentResponseToDef(_0x201f05,_0x2afc90),{yaml:_0x27c134,systemPrompt:_0x2b3d40,starterMessage:_0x4beb12}=_0x3fdbce;_0xe1ef58['push']({'name':_0x27c134[_0x3d0bb1(0x1c7)],'dir':'','yaml':_0x27c134,'systemPrompt':_0x2b3d40,'starterMessage':_0x4beb12});}for(const _0x5a3a93 of _0x5dc0ec){const _0x535127=apiKnowledgeBaseToYaml(_0x5a3a93);_0x5d457c[_0x3d0bb1(0x240)]({'name':_0x535127[_0x3d0bb1(0x1c7)],'path':'','yaml':_0x535127});}for(const _0x5bd397 of _0x26e151){_0x2a39e4[_0x3d0bb1(0x240)]({'name':_0x5bd397[_0x3d0bb1(0x1ca)][_0x3d0bb1(0x1c7)],'path':'','text':_0x5bd397['attributes'][_0x3d0bb1(0x180)]});}for(const _0x472f70 of _0x4b4c67){const _0x322c83=await apiPromptToYaml(_0x472f70,_0x2afc90);_0x322c83&&_0x4c3cd3[_0x3d0bb1(0x240)]({'name':_0x322c83[_0x3d0bb1(0x1c7)],'path':'','yaml':_0x322c83});}for(const _0x259a76 of _0x2c594f){if(!_0x259a76[_0x3d0bb1(0x1ca)][_0x3d0bb1(0x257)]&&SAFE_INTEGRATION_TYPES[_0x3d0bb1(0x1ed)](_0x259a76[_0x3d0bb1(0x1ca)]['serviceType'][_0x3d0bb1(0x18d)]())){const _0x43a54e=await apiIntegrationToYaml(_0x259a76,_0x2afc90);_0x15af29[_0x3d0bb1(0x240)]({'name':_0x259a76[_0x3d0bb1(0x1ca)][_0x3d0bb1(0x23e)]['toLowerCase'](),'path':'','yaml':_0x43a54e});}}for(const _0x12e4d2 of _0x507b42){const _0x4310c8=apiExperimentalKnowledgeBaseToYaml(_0x12e4d2);_0x373611[_0x3d0bb1(0x240)]({'name':_0x4310c8[_0x3d0bb1(0x1c7)],'path':'','def':_0x4310c8});}for(const _0x3d72b7 of _0x1aa5dc){const _0x4621b7=apiExperimentalArtifactToYaml(_0x3d72b7);_0x1d1d12[_0x3d0bb1(0x240)]({'name':_0x4621b7[_0x3d0bb1(0x1c7)],'path':'','def':_0x4621b7});}const _0x1440be=await safeListOrEmpty(()=>this[_0x3d0bb1(0x276)][_0x3d0bb1(0x177)](_0x5774c5));for(const _0x5274fe of _0x1440be){const _0x1d22e9=await apiFormInterfaceToYaml(_0x5274fe,_0x2afc90);_0x5ebac6[_0x3d0bb1(0x240)]({'name':_0x1d22e9[_0x3d0bb1(0x1c7)],'path':'','yaml':_0x1d22e9});}const _0x3b742f=await safeListOrEmpty(()=>this[_0x3d0bb1(0x276)][_0x3d0bb1(0x236)](_0x5774c5));for(const _0x17566b of _0x3b742f){if(_0x17566b['attributes'][_0x3d0bb1(0x257)])continue;const _0x189171=await apiChatInterfaceToYaml(_0x17566b,_0x2afc90);_0xe97f0a['push']({'name':_0x189171['name'],'path':'','yaml':_0x189171});}}const _0x53f636={'sourceProjectName':_0x2e9e8d,'newProjectName':_0x3d8a1a,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'imageGenerators':{'created':0x0,'errors':0x0},'webSearchTools':{'created':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'errors':0x0}}},_0x49081b=await this['client']['listProjects'](),_0x227a45=_0x49081b[_0x3d0bb1(0x261)](_0x1154a7=>_0x1154a7[_0x3d0bb1(0x1ca)]['name']===_0x3d8a1a);if(_0x227a45)throw new SDKError(ErrorCode[_0x3d0bb1(0x1a8)],_0x3d0bb1(0x1be)+_0x3d8a1a+_0x3d0bb1(0x272),undefined,{'helpText':_0x3d0bb1(0x164)});if(_0x15c30e?.[_0x3d0bb1(0x1af)])return _0x53f636[_0x3d0bb1(0x20c)]['agents'][_0x3d0bb1(0x258)]=_0xe1ef58[_0x3d0bb1(0x1b2)],_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x253)][_0x3d0bb1(0x258)]=_0x5d457c['length'],_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x260)][_0x3d0bb1(0x258)]=_0x2a39e4[_0x3d0bb1(0x1b2)],_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x264)][_0x3d0bb1(0x258)]=_0x373611[_0x3d0bb1(0x1b2)],_0x53f636[_0x3d0bb1(0x20c)]['experimentalArtifacts']['created']=_0x1d1d12[_0x3d0bb1(0x1b2)],_0x53f636['counts']['prompts']['created']=_0x4c3cd3[_0x3d0bb1(0x1b2)],_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x196)][_0x3d0bb1(0x258)]=_0x15af29[_0x3d0bb1(0x1b2)],_0x53f636;const _0x2a042a=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x1df)]({'name':_0x3d8a1a}),_0xe6233=_0x2a042a['id'];_0x53f636['newProjectId']=_0xe6233;const _0x512677=new Map(),_0x2c4133=new Map(),_0x1c589f=new Map(),_0x102b9f=new Map(),_0x10741b=new Map(),_0x941e82=new Map(),_0x213e4f=new Map(),_0x222706=new Map(),_0x230bdc=new Set(),_0x5e9f00=new Set();for(const _0x523668 of _0xe1ef58){for(const _0xf3419d of _0x523668[_0x3d0bb1(0x262)][_0x3d0bb1(0x22b)]||[]){if(_0xf3419d['type']==='image_gen'&&_0xf3419d['target']){const _0x45ee15=parseRef(_0xf3419d[_0x3d0bb1(0x201)]);if(_0x45ee15)_0x230bdc['add'](_0x45ee15['name']);}else{if(_0xf3419d[_0x3d0bb1(0x1d4)]===_0x3d0bb1(0x1ef)&&_0xf3419d[_0x3d0bb1(0x201)]){const _0x3624dd=parseRef(_0xf3419d[_0x3d0bb1(0x201)]);if(_0x3624dd)_0x5e9f00[_0x3d0bb1(0x222)](_0x3624dd[_0x3d0bb1(0x1c7)]);}}}}for(const _0x2b92d7 of _0x230bdc){try{const _0x2f2282=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x22f)]({'projectId':_0xe6233,'name':_0x2b92d7});_0x10741b[_0x3d0bb1(0x279)](_0x2b92d7,_0x2f2282['id']),_0x53f636[_0x3d0bb1(0x1ac)][_0x3d0bb1(0x240)]({'name':_0x2b92d7,'action':_0x3d0bb1(0x258),'id':_0x2f2282['id']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x1ac)][_0x3d0bb1(0x258)]++;}catch(_0xdaf246){_0x53f636[_0x3d0bb1(0x1ac)][_0x3d0bb1(0x240)]({'name':_0x2b92d7,'action':_0x3d0bb1(0x1de),'error':_0xdaf246['message']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x1ac)][_0x3d0bb1(0x1e8)]++;}}for(const _0x59643f of _0x5e9f00){try{const _0x48c149=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x1c0)]({'projectId':_0xe6233,'name':_0x59643f});_0x941e82[_0x3d0bb1(0x279)](_0x59643f,_0x48c149['id']),_0x53f636[_0x3d0bb1(0x243)][_0x3d0bb1(0x240)]({'name':_0x59643f,'action':_0x3d0bb1(0x258),'id':_0x48c149['id']}),_0x53f636['counts'][_0x3d0bb1(0x243)][_0x3d0bb1(0x258)]++;}catch(_0x428467){_0x53f636['webSearchTools'][_0x3d0bb1(0x240)]({'name':_0x59643f,'action':_0x3d0bb1(0x1de),'error':_0x428467[_0x3d0bb1(0x176)]}),_0x53f636[_0x3d0bb1(0x20c)]['webSearchTools'][_0x3d0bb1(0x1e8)]++;}}const _0x5be236=await fetchAllToolTargetMaps((_0x5ef782,_0x91f50)=>this[_0x3d0bb1(0x276)][_0x3d0bb1(0x204)](_0x5ef782,_0x91f50),_0xe6233);let _0x170ae9=[];const _0x3dbbd4={'projectId':_0xe6233,'resolveToolTargetId':buildIdResolver({..._0x5be236[_0x3d0bb1(0x231)],'KnowledgeBase':_0x512677,'TextKnowledgeBase':_0x2c4133,'ExperimentalKnowledgeBase':_0x213e4f,'Agent':_0x1c589f,'WebSearchTool':_0x941e82,'ImageGenerator':_0x10741b}),'resolvePromptId':async _0x5b6d5b=>_0x102b9f[_0x3d0bb1(0x26f)](_0x5b6d5b),'onWarning':_0xf92c54=>{const _0x5468b4=_0x3d0bb1;this[_0x5468b4(0x1ff)]['warn'](_0xf92c54),_0x170ae9[_0x5468b4(0x240)](_0xf92c54);}};for(const _0x235624 of _0x5d457c){try{const _0x38952d=yamlKnowledgeBaseToApi(_0x235624[_0x3d0bb1(0x262)],_0xe6233),_0x4d94e1=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x1d5)](_0x38952d);_0x512677[_0x3d0bb1(0x279)](_0x235624[_0x3d0bb1(0x262)][_0x3d0bb1(0x1c7)],_0x4d94e1['id']),_0x53f636[_0x3d0bb1(0x253)][_0x3d0bb1(0x240)]({'name':_0x235624[_0x3d0bb1(0x262)][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x258),'id':_0x4d94e1['id']}),_0x53f636[_0x3d0bb1(0x20c)]['knowledgeBases'][_0x3d0bb1(0x258)]++;}catch(_0x3d1a23){_0x53f636[_0x3d0bb1(0x253)][_0x3d0bb1(0x240)]({'name':_0x235624[_0x3d0bb1(0x262)]['name'],'action':'error','error':_0x3d1a23[_0x3d0bb1(0x176)]}),_0x53f636[_0x3d0bb1(0x20c)]['knowledgeBases'][_0x3d0bb1(0x1e8)]++;}}for(const _0x1c780a of _0x2a39e4){try{const _0x758497=yamlTextKnowledgeBaseToApi({'name':_0x1c780a[_0x3d0bb1(0x1c7)],'text':_0x1c780a['text']},_0xe6233),_0xc0996d=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x19d)](_0x758497);_0x2c4133['set'](_0x1c780a['name'],_0xc0996d['id']),_0x53f636[_0x3d0bb1(0x260)][_0x3d0bb1(0x240)]({'name':_0x1c780a[_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x258),'id':_0xc0996d['id']}),_0x53f636[_0x3d0bb1(0x20c)]['textKnowledgeBases'][_0x3d0bb1(0x258)]++;}catch(_0x2b0ec1){_0x53f636['textKnowledgeBases'][_0x3d0bb1(0x240)]({'name':_0x1c780a[_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x1de),'error':_0x2b0ec1['message']}),_0x53f636[_0x3d0bb1(0x20c)]['textKnowledgeBases'][_0x3d0bb1(0x1e8)]++;}}for(const _0x199d4c of _0x1d1d12){try{const _0x29790b=yamlExperimentalArtifactToApi(_0x199d4c[_0x3d0bb1(0x252)],_0xe6233),_0x37569a=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x215)](_0x29790b);_0x222706[_0x3d0bb1(0x279)](_0x199d4c['def'][_0x3d0bb1(0x1c7)],_0x37569a['id']),_0x53f636['experimentalArtifacts'][_0x3d0bb1(0x240)]({'name':_0x199d4c[_0x3d0bb1(0x252)][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x258),'id':_0x37569a['id']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x229)][_0x3d0bb1(0x258)]++;}catch(_0x59dcfa){_0x53f636[_0x3d0bb1(0x229)]['push']({'name':_0x199d4c['def'][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x1de),'error':_0x59dcfa[_0x3d0bb1(0x176)]}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x229)]['errors']++;}}for(const _0x2e3edc of _0x373611){try{const _0x2e08dd=yamlExperimentalKnowledgeBaseToApi(_0x2e3edc['def'],_0xe6233),_0x4b9aa1=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x1d7)](_0x2e08dd);_0x213e4f[_0x3d0bb1(0x279)](_0x2e3edc[_0x3d0bb1(0x252)][_0x3d0bb1(0x1c7)],_0x4b9aa1['id']),_0x53f636[_0x3d0bb1(0x264)]['push']({'name':_0x2e3edc[_0x3d0bb1(0x252)][_0x3d0bb1(0x1c7)],'action':'created','id':_0x4b9aa1['id']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x264)][_0x3d0bb1(0x258)]++;}catch(_0x191838){_0x53f636['experimentalKnowledgeBases'][_0x3d0bb1(0x240)]({'name':_0x2e3edc['def'][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x1de),'error':_0x191838[_0x3d0bb1(0x176)]}),_0x53f636[_0x3d0bb1(0x20c)]['experimentalKnowledgeBases'][_0x3d0bb1(0x1e8)]++;}}const _0x326dbe=[..._0xe1ef58][_0x3d0bb1(0x16a)]((_0xf19875,_0x30c42d)=>{const _0x4964b9=_0x3d0bb1,_0x8ea90a=_0xf19875[_0x4964b9(0x262)]['tools']?.[_0x4964b9(0x224)](_0x420a75=>_0x420a75['type']===_0x4964b9(0x1fa))??![],_0x9d6a62=_0x30c42d['yaml'][_0x4964b9(0x22b)]?.[_0x4964b9(0x224)](_0x5b93e7=>_0x5b93e7['type']==='agent')??![];if(_0x8ea90a&&!_0x9d6a62)return 0x1;if(!_0x8ea90a&&_0x9d6a62)return-0x1;return 0x0;});for(const _0x2c8b78 of _0x326dbe){_0x170ae9=[];try{const _0x4baee3=_0x2c8b78['yaml'][_0x3d0bb1(0x22b)]?.[_0x3d0bb1(0x26b)](_0x4eb5db=>{const _0x45619b=_0x3d0bb1;if(_0x4eb5db['type']===_0x45619b(0x1fa)&&_0x4eb5db['target']){const _0x3af507=parseRef(_0x4eb5db[_0x45619b(0x201)]);return _0x3af507?.[_0x45619b(0x1c7)]===_0x2c8b78['yaml'][_0x45619b(0x1c7)];}return![];})??[];if(_0x4baee3[_0x3d0bb1(0x1b2)]>0x0){const _0x2b4b20=_0x3d0bb1(0x207)+_0x2c8b78[_0x3d0bb1(0x262)]['name']+_0x3d0bb1(0x1bc)+_0x3d0bb1(0x1a7);this[_0x3d0bb1(0x1ff)][_0x3d0bb1(0x19f)](_0x2b4b20),_0x170ae9[_0x3d0bb1(0x240)](_0x2b4b20);}const _0x4aa29c=await agentDefToRequest(_0x2c8b78[_0x3d0bb1(0x262)],_0x2c8b78[_0x3d0bb1(0x25c)],_0x2c8b78[_0x3d0bb1(0x20a)],_0x3dbbd4),_0x1c5352=await this['client'][_0x3d0bb1(0x186)](_0x4aa29c);_0x1c589f[_0x3d0bb1(0x279)](_0x2c8b78[_0x3d0bb1(0x262)][_0x3d0bb1(0x1c7)],_0x1c5352['id']),_0x53f636[_0x3d0bb1(0x1fb)][_0x3d0bb1(0x240)]({'agentName':_0x2c8b78['yaml'][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x258),'agentId':_0x1c5352['id'],'warnings':_0x170ae9['length']>0x0?_0x170ae9:undefined}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x1fb)][_0x3d0bb1(0x258)]++;}catch(_0x13d417){_0x53f636['agents'][_0x3d0bb1(0x240)]({'agentName':_0x2c8b78[_0x3d0bb1(0x262)][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x1de),'error':_0x13d417['message'],'warnings':_0x170ae9[_0x3d0bb1(0x1b2)]>0x0?_0x170ae9:undefined}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x1fb)][_0x3d0bb1(0x1e8)]++;}}for(const _0x18055e of _0x4c3cd3){try{const _0x38dace=await yamlPromptToApi(_0x18055e['yaml'],_0xe6233,_0x3dbbd4);if(!_0x38dace){_0x53f636[_0x3d0bb1(0x21e)]['push']({'name':_0x18055e['yaml'][_0x3d0bb1(0x1c7)],'action':'error','error':_0x3d0bb1(0x1e3)}),_0x53f636['counts']['prompts'][_0x3d0bb1(0x1e8)]++;continue;}const _0x28b666=await this['client'][_0x3d0bb1(0x162)](_0x38dace);_0x102b9f[_0x3d0bb1(0x279)](_0x18055e[_0x3d0bb1(0x262)][_0x3d0bb1(0x1c7)],_0x28b666['id']),_0x53f636[_0x3d0bb1(0x21e)][_0x3d0bb1(0x240)]({'name':_0x18055e[_0x3d0bb1(0x262)]['name'],'action':'created','id':_0x28b666['id']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x21e)][_0x3d0bb1(0x258)]++;}catch(_0x3789d0){_0x53f636['prompts'][_0x3d0bb1(0x240)]({'name':_0x18055e[_0x3d0bb1(0x262)][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x1de),'error':_0x3789d0['message']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x21e)][_0x3d0bb1(0x1e8)]++;}}for(const _0x3e3459 of _0x15af29){try{const _0x47e01c=await yamlIntegrationToApi(_0x3e3459[_0x3d0bb1(0x262)],_0xe6233,_0x3dbbd4),_0x254f96=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x199)](_0x47e01c);_0x53f636['integrations'][_0x3d0bb1(0x240)]({'name':_0x3e3459[_0x3d0bb1(0x262)]['service_type'],'action':'created','id':_0x254f96['id']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x196)][_0x3d0bb1(0x258)]++;}catch(_0x310ef5){_0x53f636['integrations'][_0x3d0bb1(0x240)]({'name':_0x3e3459['yaml'][_0x3d0bb1(0x228)],'action':_0x3d0bb1(0x1de),'error':_0x310ef5[_0x3d0bb1(0x176)]}),_0x53f636[_0x3d0bb1(0x20c)]['integrations']['errors']++;}}for(const _0x31237f of _0x5ebac6){try{const _0x494f60=await yamlFormInterfaceToApi(_0x31237f[_0x3d0bb1(0x262)],_0xe6233,_0x3dbbd4);if(!_0x494f60){_0x53f636['formInterfaces'][_0x3d0bb1(0x240)]({'name':_0x31237f['yaml'][_0x3d0bb1(0x1c7)],'action':'error','error':_0x3d0bb1(0x1fd)}),_0x53f636['counts'][_0x3d0bb1(0x22d)][_0x3d0bb1(0x1e8)]++;continue;}const _0x22c381=await this[_0x3d0bb1(0x276)][_0x3d0bb1(0x1d3)](_0x494f60);_0x53f636[_0x3d0bb1(0x22d)][_0x3d0bb1(0x240)]({'name':_0x31237f[_0x3d0bb1(0x262)][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x258),'id':_0x22c381['id']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x22d)][_0x3d0bb1(0x258)]++;}catch(_0x262739){_0x53f636['formInterfaces'][_0x3d0bb1(0x240)]({'name':_0x31237f[_0x3d0bb1(0x262)]['name'],'action':_0x3d0bb1(0x1de),'error':_0x262739['message']}),_0x53f636['counts'][_0x3d0bb1(0x22d)][_0x3d0bb1(0x1e8)]++;}}for(const _0x1b770f of _0xe97f0a){try{const _0x5792c9=await yamlChatInterfaceToApi(_0x1b770f[_0x3d0bb1(0x262)],_0xe6233,_0x3dbbd4),_0x9477ae=await this['client']['createChatInterface'](_0x5792c9);_0x53f636['chatInterfaces']['push']({'name':_0x1b770f['yaml'][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x258),'id':_0x9477ae['id']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x169)]['created']++;}catch(_0x139d55){_0x53f636['chatInterfaces']['push']({'name':_0x1b770f['yaml'][_0x3d0bb1(0x1c7)],'action':_0x3d0bb1(0x1de),'error':_0x139d55['message']}),_0x53f636[_0x3d0bb1(0x20c)][_0x3d0bb1(0x169)][_0x3d0bb1(0x1e8)]++;}}return _0x53f636;}}
1
+ const a134_0x1280fc=a134_0x357b;(function(_0x63f38c,_0x406e75){const _0x6ec7af=a134_0x357b,_0x513051=_0x63f38c();while(!![]){try{const _0x46d4ca=-parseInt(_0x6ec7af(0x21c))/0x1+-parseInt(_0x6ec7af(0x294))/0x2+parseInt(_0x6ec7af(0x27f))/0x3+-parseInt(_0x6ec7af(0x274))/0x4*(parseInt(_0x6ec7af(0x278))/0x5)+parseInt(_0x6ec7af(0x20b))/0x6+parseInt(_0x6ec7af(0x23f))/0x7+parseInt(_0x6ec7af(0x26e))/0x8;if(_0x46d4ca===_0x406e75)break;else _0x513051['push'](_0x513051['shift']());}catch(_0x2b0c31){_0x513051['push'](_0x513051['shift']());}}}(a134_0x4cab,0xa1272));import{LLMApiClient}from'../client/llm-api-client.js';import*as a134_0x4f3caa from'node:fs';import*as a134_0xb4a0ec from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{toModelInfos}from'./user-settings.js';function a134_0x4cab(){const _0x44d521=['def','tdDatabaseName','idToName','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','1059546dmjcns','file_name','text_content','currentProjectId','chatIgnoreManagedActions','\x27.\x20This\x20should\x20not\x20happen.','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','has','agent.yml','toISOString','tools','total','integrations','loadJsonFile','pushAgent','info','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','low','readFileSync','Renamed\x20form\x20interface\x20file:\x20','writeFileSync','length','filter','listPrompts','project.json','duplicate','\x0a---\x20code\x20---\x0a','backupProject','listTextKnowledgeBases','setCurrentProject','updateExperimentalKnowledgeBase','attributes','formInterfaces','template','webhookCorsOrigins','json_schema','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','chat','path','listImageGenerators','deleteProject','Renamed\x20integration\x20file:\x20','getDefaultAgent','web_search','AGENT_NOT_FOUND','Renamed\x20agent\x20folder:\x20','\x20---\x0a','createFormInterface','keys','errors','newProjectId','utf-8','context','createIntegration','event','localeCompare','#\x20prompt.md\x0a','site','Agent\x20reference\x20not\x20found','message','createTextKnowledgeBase','maxToolIterations','listProjects','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','logger','listAgents','NOT_FOUND','agent','service_type','cloneProject','error','listChatInterfaces','agents','Renamed\x20KB\x20file:\x20','---\x20file:\x20','already\x20exists','get','chat_interfaces','dry-run-','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','isManaged','claude-4.5-sonnet','temperature','.yml','json_schema.json','deleteAgent','map','experimentalKnowledgeBases','Renamed\x20text\x20KB\x20file:\x20','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','parse','tdx_default_','starterMessage','createAgentResponse','getDefaultProjectName','Project\x20\x22','updateTextKnowledgeBase','):\x20','getChatInfo','target','Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.','updateFormInterface','name','listIntegrations','updateAgentResponse','listExperimentalKnowledgeBases','chat_parent_segment','updatePrompt','Only\x20safe\x20types\x20(','listAgentsFull','Agent\x20not\x20found:\x20','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','Removed\x20deleted\x20directory:\x20','knowledgeBases','endsWith','Renamed\x20chat\x20interface\x20file:\x20','getCurrentProject','.md','resolveProjectId','warn','starter_message',')\x20can\x20be\x20pushed.\x20','isDir','find','getProject','history','setDefaultAgent','size','integrations.json','new','counts','createProject','tdx.json','(dry-run)','slackMessageMode','split','systemPrompt','project','stringify','getAgent','files','getOrCreateDefaultProject','getOrCreateDefaultAgent','client','signal','isFile','\x0a\x0a#\x20agent.yml\x0a','INVALID_ARGUMENT','createExperimentalKnowledgeBase','Skipping\x20integration\x20\x27','experimentalArtifacts','1464300ZQLiye','includes','knowledge_bases','clearDefaultAgent','mkdirSync','.llm','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','code.js','experimental_artifacts','prompt.md','action','type','---\x20schema:\x20','rmSync','KnowledgeBase','Removed\x20deleted\x20file:\x20','createExperimentalArtifact','1010302QLNVhq','\x27\x20(','listWebSearchTools','medium','webSearchTools','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','Available\x20agents:\x20','form_interfaces','\x0a---\x20schema:\x20','image_gen','\x0a---\x20function:\x20','dir','description','profile','listFormInterfaces','Unable\x20to\x20create\x20project\x20after\x20','INTERNAL','Multiple\x20agents\x20found\x20with\x20name\x20\x27','chat_generic','starter_message.md','text','unlinkSync','updated','chats','renamed','Invalid\x20agent\x20reference\x20format:\x20','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','Renamed\x20prompt\x20file:\x20','createWebSearchTool','UNAUTHENTICATED','unchanged','toLowerCase','basename',')\x20can\x20be\x20cloned.','sort','7508333QHcWeA','_reasoning_','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','\x20in\x20project\x20','Unsupported\x20backup\x20version:\x20','Renamed\x20experimental\x20artifact\x20directory:\x20','imageGenerators','add','listKnowledgeBases','dryRun','readdirSync','createChatInterface','resolveAgentId','listToolTargets','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','projectName','functions','ALREADY_EXISTS','updateAgent','getBackupMetadata','Unresolved\x20dependencies:\x20','oldPath','agentId','createPrompt','projects','some','resolveProjectName','createAgent','Agent\x20\x27','tdx_','prompts','chat_agent_console','textKnowledgeBases','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','getChatHistory','Multiple\x20projects\x20found\x20with\x20name\x20\x27','startChat','createKnowledgeBase','Project\x20not\x20found:\x20','chatInterfaces','agents.json','statSync','createImageGenerator','updateKnowledgeBase','status','Could\x20not\x20resolve\x20agent\x20reference','agentsFull','8267528GQWDan','set','exportedFrom','join','high','existsSync','1203692UZXpWj','chatWelcomeMessage','Renamed\x20folder:\x20','push','15AYequa','Renamed\x20experimental\x20KB\x20directory:\x20','deleteIntegration','created','LLM_PROJECT_NOT_FOUND','content','isDirectory','2258448reErHG','llm_project','updateExperimentalArtifact','TextKnowledgeBase','experimental_knowledge_bases','dirname','promptId','chatId','variables','nameToId','sdk.llm','code','yaml','getChatLog','\x20→\x20','knowledgebases.json','serviceType'];a134_0x4cab=function(){return _0x44d521;};return a134_0x4cab();}import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';function a134_0x357b(_0x109b72,_0x1f7db6){_0x109b72=_0x109b72-0x177;const _0x4cab85=a134_0x4cab();let _0x357b4e=_0x4cab85[_0x109b72];return _0x357b4e;}import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a134_0x1280fc(0x22e),a134_0x1280fc(0x25e),a134_0x1280fc(0x1de)];async function safeListOrEmpty(_0xd223a1){const _0x340b6b=a134_0x1280fc;try{return await _0xd223a1();}catch(_0x92bddf){if(_0x92bddf instanceof HTTPClientError&&_0x92bddf[_0x340b6b(0x26b)]===0x194)return[];throw _0x92bddf;}}export class LLMSDK{[a134_0x1280fc(0x177)];[a134_0x1280fc(0x203)];[a134_0x1280fc(0x1a8)];[a134_0x1280fc(0x1b4)]=Logger['of'](a134_0x1280fc(0x289));constructor(_0x1c2211){const _0x121c8a=a134_0x1280fc;this[_0x121c8a(0x203)]=new LLMApiClient(_0x1c2211),this[_0x121c8a(0x1a8)]=_0x1c2211;}[a134_0x1280fc(0x1d2)](){const _0x377ad2=a134_0x1280fc,_0x4e3a50=getSanitizedUsername();return _0x377ad2(0x1cf)+_0x4e3a50;}async[a134_0x1280fc(0x191)](_0x5b9528){const _0xe1dafb=a134_0x1280fc,{projectId:_0x341be9}=await this[_0xe1dafb(0x259)](_0x5b9528);this[_0xe1dafb(0x177)]=_0x341be9;}[a134_0x1280fc(0x1e8)](){const _0x22dff4=a134_0x1280fc;return this[_0x22dff4(0x177)];}async[a134_0x1280fc(0x1f2)](_0x2585d1){const _0x29cf3a=a134_0x1280fc,_0x1f8f75=this[_0x29cf3a(0x1a8)][_0x29cf3a(0x229)];let _0x18cc46,_0x177271;if(_0x2585d1[_0x29cf3a(0x20c)]('/')){const _0x4fa31e=_0x2585d1[_0x29cf3a(0x1fb)]('/');if(_0x4fa31e['length']!==0x2)throw new SDKError(ErrorCode[_0x29cf3a(0x207)],_0x29cf3a(0x235)+_0x2585d1,undefined,{'helpText':_0x29cf3a(0x260)});const [_0x5234cc,_0x124f13]=_0x4fa31e;_0x18cc46=await this['resolveProjectId'](_0x5234cc),_0x177271=_0x124f13;}else _0x18cc46=this[_0x29cf3a(0x177)]||(await this[_0x29cf3a(0x201)]())['id'],_0x177271=_0x2585d1;const _0x1bfff9=await this[_0x29cf3a(0x24b)](_0x177271,_0x18cc46),_0xbaa63d=await this[_0x29cf3a(0x203)][_0x29cf3a(0x1ff)](_0x1bfff9);writeCachedLLMAgent(_0xbaa63d['attributes'][_0x29cf3a(0x1da)],_0x1bfff9,_0x18cc46,_0x1f8f75);}[a134_0x1280fc(0x19e)](){const _0x3fd463=a134_0x1280fc,_0x2c7dab=this[_0x3fd463(0x1a8)][_0x3fd463(0x229)];return readCachedLLMAgent(_0x2c7dab)||undefined;}[a134_0x1280fc(0x20e)](){const _0x2f588b=a134_0x1280fc,_0x76e640=this[_0x2f588b(0x1a8)]['profile'];clearCachedLLMAgent(_0x76e640);}async['models'](){const _0xa9529d=a134_0x1280fc,_0x11f351=await this[_0xa9529d(0x203)]['getUserSettings']();return toModelInfos(_0x11f351);}async[a134_0x1280fc(0x1f7)](_0x544ef7){const _0x32046a=a134_0x1280fc;return await this['client'][_0x32046a(0x1f7)](_0x544ef7);}async[a134_0x1280fc(0x19c)](_0x17c524){const _0x40d0e4=a134_0x1280fc,{projectId:_0x1bb6d1}=await this[_0x40d0e4(0x259)](_0x17c524);await this[_0x40d0e4(0x203)][_0x40d0e4(0x19c)](_0x1bb6d1);}async[a134_0x1280fc(0x257)](_0x2f4163=0x32){const _0x114099=a134_0x1280fc;return await this[_0x114099(0x203)][_0x114099(0x1b2)](_0x2f4163);}async[a134_0x1280fc(0x201)](_0xe0d31c){const _0x57a985=a134_0x1280fc,_0x3bfd42=_0xe0d31c||this[_0x57a985(0x1d2)](),_0x514561=this[_0x57a985(0x1a8)]['profile'];if(!_0xe0d31c){const _0x1415f5=readCachedLLMProject(_0x514561);if(_0x1415f5&&_0x1415f5['name']===_0x3bfd42)try{const _0x2d5914=await this['client'][_0x57a985(0x1f0)](_0x1415f5['id']);if(_0x2d5914['attributes'][_0x57a985(0x1da)]===_0x3bfd42)return _0x2d5914;}catch{}}const _0x443a59=await this['client']['listProjects'](),_0xfd4988=_0x443a59[_0x57a985(0x1ef)](_0x1945f3=>_0x1945f3[_0x57a985(0x193)][_0x57a985(0x1da)]===_0x3bfd42);if(_0xfd4988)return!_0xe0d31c&&writeCachedLLMProject(_0x3bfd42,_0xfd4988['id'],_0x514561),_0xfd4988;const _0x2c5057=await this[_0x57a985(0x203)][_0x57a985(0x1f7)]({'name':_0x3bfd42,'description':'Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20'+getSanitizedUsername()+')'});return!_0xe0d31c&&writeCachedLLMProject(_0x3bfd42,_0x2c5057['id'],_0x514561),_0x2c5057;}async['resolveProjectId'](_0x5971d4){const _0x3f98f6=a134_0x1280fc,_0x1b1112=await this[_0x3f98f6(0x203)][_0x3f98f6(0x1b2)](),_0x5a6279=_0x1b1112[_0x3f98f6(0x18a)](_0x5bf322=>_0x5bf322[_0x3f98f6(0x193)]['name']===_0x5971d4);if(_0x5a6279[_0x3f98f6(0x189)]===0x0)throw new SDKError(ErrorCode[_0x3f98f6(0x27c)],'Project\x20not\x20found:\x20'+_0x5971d4,undefined,{'helpText':_0x3f98f6(0x17a)});if(_0x5a6279[_0x3f98f6(0x189)]>0x1)throw new SDKError(ErrorCode[_0x3f98f6(0x22c)],_0x3f98f6(0x262)+_0x5971d4+_0x3f98f6(0x179));return _0x5a6279[0x0]['id'];}async['resolveProjectName'](_0x2e3f74){const _0x2cb3d5=a134_0x1280fc,_0x2a20f0=await this[_0x2cb3d5(0x203)][_0x2cb3d5(0x1b2)](),_0x4255f7=_0x2a20f0[_0x2cb3d5(0x1ef)](_0x61c3a4=>_0x61c3a4[_0x2cb3d5(0x193)][_0x2cb3d5(0x1da)]===_0x2e3f74);if(_0x4255f7)return{'projectId':_0x4255f7['id'],'project':_0x4255f7};throw new SDKError(ErrorCode[_0x2cb3d5(0x27c)],_0x2cb3d5(0x265)+_0x2e3f74,undefined,{'helpText':_0x2cb3d5(0x17a)});}async[a134_0x1280fc(0x202)](_0x5a29a9=a134_0x1280fc(0x1c5),_0x4b1f6c=0x0,_0x5a66a8){const _0x58873a=a134_0x1280fc,_0x531552=0xa;let _0x3ca027=0x0,_0xe9d189;while(_0x3ca027<_0x531552){try{const _0x4d75bf=await this[_0x58873a(0x201)](_0xe9d189),_0x58b344=_0x4d75bf['id'],_0x496833=['none','minimal',_0x58873a(0x185),_0x58873a(0x21f),_0x58873a(0x272)],_0x1258e2=_0x4b1f6c===0x0?'tdx_'+_0x5a29a9:_0x58873a(0x25c)+_0x5a29a9+_0x58873a(0x240)+_0x496833[_0x4b1f6c],_0x3febf3=await this[_0x58873a(0x203)][_0x58873a(0x1b5)](_0x58b344),_0x389a81=_0x3febf3[_0x58873a(0x1ef)](_0x38685e=>_0x38685e[_0x58873a(0x193)][_0x58873a(0x1da)]===_0x1258e2);if(_0x389a81)return _0x389a81;const _0x27b363=_0x4b1f6c>0x0?0x1:_0x5a66a8;return await this[_0x58873a(0x203)][_0x58873a(0x25a)]({'name':_0x1258e2,'projectId':_0x58b344,'modelType':_0x5a29a9,'systemPrompt':'','temperature':_0x27b363,'reasoningEffort':_0x4b1f6c>0x0?_0x4b1f6c:undefined});}catch(_0x312132){if(_0x312132 instanceof HTTPClientError){const _0x3f3659=_0x312132['status'];if(_0x3f3659>=0x190&&_0x3f3659<0x1f4){if(_0x3f3659===0x191)throw new SDKError(ErrorCode[_0x58873a(0x239)],_0x58873a(0x293),_0x312132);else{if(_0x3f3659===0x193)throw new SDKError(ErrorCode['PERMISSION_DENIED'],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x312132);}throw _0x312132;}}if(errorContains(_0x312132,_0x58873a(0x1bf),_0x58873a(0x18d),'conflict')){_0x3ca027++;if(_0x3ca027>=_0x531552)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x58873a(0x22b)+_0x531552+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x312132);const _0x3a1017=this['getDefaultProjectName']();_0xe9d189=_0x3a1017+'_'+generateRandomHex();continue;}throw _0x312132;}}throw new SDKError(ErrorCode[_0x58873a(0x22c)],_0x58873a(0x198));}async[a134_0x1280fc(0x24b)](_0x8457e,_0x574791){const _0x355e5f=a134_0x1280fc,_0x19c86b=_0x574791||this['currentProjectId'],_0x45fd8e=await this['client'][_0x355e5f(0x1b5)](_0x19c86b),_0x54f14e=_0x45fd8e[_0x355e5f(0x18a)](_0x322f54=>_0x322f54['attributes'][_0x355e5f(0x1da)]===_0x8457e);if(_0x54f14e[_0x355e5f(0x189)]===0x0){const _0x47072a=_0x19c86b?_0x355e5f(0x242)+_0x19c86b:'';throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x355e5f(0x1e2)+_0x8457e+_0x47072a,undefined,{'helpText':_0x19c86b?_0x355e5f(0x1e3):_0x355e5f(0x1d8)});}if(_0x54f14e[_0x355e5f(0x189)]>0x1)throw new SDKError(ErrorCode[_0x355e5f(0x22c)],_0x355e5f(0x22d)+_0x8457e+'\x27.\x20This\x20should\x20not\x20happen.');return _0x54f14e[0x0]['id'];}async[a134_0x1280fc(0x1bc)](_0x7cac48){const _0x5d6957=a134_0x1280fc,_0x5ba806=_0x7cac48||this[_0x5d6957(0x177)];return await this[_0x5d6957(0x203)][_0x5d6957(0x1b5)](_0x5ba806);}async[a134_0x1280fc(0x26d)](_0x388d9c){const _0x24c189=a134_0x1280fc;return await this[_0x24c189(0x203)][_0x24c189(0x1e1)](_0x388d9c);}async[a134_0x1280fc(0x1b7)](_0x39ac7c){const _0x50831f=a134_0x1280fc;return await this[_0x50831f(0x203)][_0x50831f(0x1ff)](_0x39ac7c);}async[a134_0x1280fc(0x25a)](_0x503a65){const _0x2688ee=a134_0x1280fc;return await this['client'][_0x2688ee(0x25a)](_0x503a65);}async[a134_0x1280fc(0x251)](_0x32fff1,_0x4513c5){const _0x480e9a=a134_0x1280fc;return await this[_0x480e9a(0x203)][_0x480e9a(0x251)](_0x32fff1,_0x4513c5);}async[a134_0x1280fc(0x1c9)](_0xcc19d2){const _0x2a7d20=a134_0x1280fc;await this[_0x2a7d20(0x203)][_0x2a7d20(0x1c9)](_0xcc19d2);}async[a134_0x1280fc(0x263)](_0x39fafd){const _0x5db47b=a134_0x1280fc;return await this['client'][_0x5db47b(0x263)]({'agentId':_0x39fafd});}async*[a134_0x1280fc(0x199)](_0x4201cb,_0x115932){const _0x317bef=a134_0x1280fc;let _0x5b5927=_0x115932?.[_0x317bef(0x286)];const _0xd6bca6=_0x115932?.['agentId'];if(!_0x5b5927){if(!_0xd6bca6)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x36c9ee=await this[_0x317bef(0x203)][_0x317bef(0x263)]({'agentId':_0xd6bca6});_0x5b5927=_0x36c9ee['id'],yield{'type':'metadata','data':{'chatId':_0x5b5927,'agentId':_0xd6bca6,'projectId':_0x36c9ee[_0x317bef(0x193)]['projectId']}};}for await(const _0x13b782 of this['client']['continueChat'](_0x5b5927,_0x4201cb,_0x115932?.[_0x317bef(0x204)])){yield{'type':_0x317bef(0x1aa),'data':_0x13b782};}}async[a134_0x1280fc(0x233)](_0x1cab66=0x32){const _0x180bba=a134_0x1280fc;return await this[_0x180bba(0x203)]['listChats'](_0x1cab66);}async[a134_0x1280fc(0x1f1)](_0x23282c){const _0x34aacb=a134_0x1280fc;return await this['client'][_0x34aacb(0x261)](_0x23282c);}async['getChatLog'](_0x325b22){const _0x684de5=a134_0x1280fc;return await this[_0x684de5(0x203)][_0x684de5(0x28c)](_0x325b22);}async['chatInfo'](_0x1cc3f8){const _0x5223a8=a134_0x1280fc;return await this[_0x5223a8(0x203)][_0x5223a8(0x1d6)](_0x1cc3f8);}async[a134_0x1280fc(0x18f)](_0x6c5116,_0x3e4af5,_0x1c71d0){const _0x8cc1ad=a134_0x1280fc,_0x4516dc=_0x1c71d0?.[_0x8cc1ad(0x248)]??![],{projectId:_0x5d501b,project:_0xcaebd3}=await this[_0x8cc1ad(0x259)](_0x6c5116),_0x58ab9b=_0xcaebd3['attributes'][_0x8cc1ad(0x1da)],_0xd1ea7e=_0x3e4af5||_0x58ab9b+_0x8cc1ad(0x210);if(a134_0x4f3caa[_0x8cc1ad(0x273)](_0xd1ea7e)&&!_0x4516dc)throw new SDKError(ErrorCode[_0x8cc1ad(0x250)],'Output\x20directory\x20already\x20exists:\x20'+_0xd1ea7e,undefined,{'helpText':_0x8cc1ad(0x1c3)});const _0x52df8f=await this[_0x8cc1ad(0x203)][_0x8cc1ad(0x1e1)](_0x5d501b),_0x5b5124=await this[_0x8cc1ad(0x203)]['listKnowledgeBases'](_0x5d501b),_0x3eb08c=await this['client'][_0x8cc1ad(0x18b)](_0x5d501b),_0x4dbc26=await this[_0x8cc1ad(0x203)]['listIntegrations'](_0x5d501b);if(!_0x4516dc){a134_0x4f3caa['mkdirSync'](_0xd1ea7e,{'recursive':!![]});const _0xa671e1={'version':'1.0','exportedAt':new Date()[_0x8cc1ad(0x17d)](),'exportedFrom':{'site':this['context'][_0x8cc1ad(0x1ad)],'projectId':_0x5d501b,'projectName':_0x58ab9b},'project':_0xcaebd3};a134_0x4f3caa[_0x8cc1ad(0x188)](a134_0xb4a0ec['join'](_0xd1ea7e,_0x8cc1ad(0x18c)),JSON[_0x8cc1ad(0x1fe)](_0xa671e1,null,0x2)),a134_0x4f3caa[_0x8cc1ad(0x188)](a134_0xb4a0ec[_0x8cc1ad(0x271)](_0xd1ea7e,_0x8cc1ad(0x267)),JSON[_0x8cc1ad(0x1fe)](_0x52df8f,null,0x2)),a134_0x4f3caa[_0x8cc1ad(0x188)](a134_0xb4a0ec[_0x8cc1ad(0x271)](_0xd1ea7e,_0x8cc1ad(0x28e)),JSON[_0x8cc1ad(0x1fe)](_0x5b5124,null,0x2)),a134_0x4f3caa[_0x8cc1ad(0x188)](a134_0xb4a0ec['join'](_0xd1ea7e,'prompts.json'),JSON[_0x8cc1ad(0x1fe)](_0x3eb08c,null,0x2)),a134_0x4f3caa['writeFileSync'](a134_0xb4a0ec[_0x8cc1ad(0x271)](_0xd1ea7e,_0x8cc1ad(0x1f4)),JSON[_0x8cc1ad(0x1fe)](_0x4dbc26,null,0x2));}return{'projectName':_0x58ab9b,'outputDir':_0xd1ea7e,'counts':{'agents':_0x52df8f['length'],'knowledgeBases':_0x5b5124[_0x8cc1ad(0x189)],'prompts':_0x3eb08c['length'],'integrations':_0x4dbc26['length']}};}async['restoreProject'](_0x44e4f8,_0x31834e){const _0x4146ae=a134_0x1280fc,_0x16fa56=_0x31834e?.[_0x4146ae(0x248)]??![],_0x47189f=this['getBackupMetadata'](_0x44e4f8),_0x211d8d=_0x47189f[_0x4146ae(0x270)][_0x4146ae(0x1ad)],_0x11b4b1=this['context'][_0x4146ae(0x1ad)],_0x3e7ea7=_0x211d8d!==_0x11b4b1?_0x211d8d:undefined,_0x29892a=this['loadJsonFile'](a134_0xb4a0ec['join'](_0x44e4f8,_0x4146ae(0x267)),[]),_0x20c693=this['loadJsonFile'](a134_0xb4a0ec[_0x4146ae(0x271)](_0x44e4f8,_0x4146ae(0x28e)),[]),_0x26301c=this[_0x4146ae(0x181)](a134_0xb4a0ec[_0x4146ae(0x271)](_0x44e4f8,'prompts.json'),[]),_0x5b3292=this[_0x4146ae(0x181)](a134_0xb4a0ec[_0x4146ae(0x271)](_0x44e4f8,_0x4146ae(0x1f4)),[]),_0x301bea=_0x31834e?.[_0x4146ae(0x1da)]||_0x47189f[_0x4146ae(0x270)][_0x4146ae(0x24e)];if(_0x16fa56){const _0x1910ca=new Map(),_0x355432=[..._0x29892a],_0x357ae3=_0x29892a[_0x4146ae(0x189)]+0x1;let _0xf389f5=0x0;while(_0x355432[_0x4146ae(0x189)]>0x0&&_0xf389f5<_0x357ae3){_0xf389f5++;const _0xbf866a=[];for(const _0x13d7fa of _0x355432){canCreateAgent(_0x13d7fa,_0x1910ca)?_0x1910ca[_0x4146ae(0x26f)](_0x13d7fa['id'],_0x4146ae(0x1c2)+_0x13d7fa['id']):_0xbf866a[_0x4146ae(0x277)](_0x13d7fa);}if(_0xbf866a['length']===_0x355432['length'])throw new SDKError(ErrorCode[_0x4146ae(0x22c)],_0x4146ae(0x241),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x355432[_0x4146ae(0x189)]=0x0,_0x355432[_0x4146ae(0x277)](..._0xbf866a);}const _0x3b2c47=_0x26301c[_0x4146ae(0x18a)](_0x203edc=>_0x1910ca['has'](_0x203edc[_0x4146ae(0x193)][_0x4146ae(0x255)]))[_0x4146ae(0x189)];return{'projectName':_0x301bea,'projectId':_0x4146ae(0x1f9),'counts':{'agents':_0x29892a['length'],'knowledgeBases':_0x20c693['length'],'prompts':_0x3b2c47,'integrations':_0x5b3292[_0x4146ae(0x189)]},'sourceSite':_0x3e7ea7};}const _0x1dc163=await this[_0x4146ae(0x203)][_0x4146ae(0x1f7)]({'name':_0x301bea,'description':_0x47189f[_0x4146ae(0x1fd)][_0x4146ae(0x193)][_0x4146ae(0x228)]}),_0x15aa2e=_0x1dc163['id'],_0x5f2bf4=new Map(),_0x3eea21=new Map(),_0x4f5b55=new Map();for(const _0x1c9cb8 of _0x20c693){const _0x59a1c0=await this[_0x4146ae(0x203)]['createKnowledgeBase']({'projectId':_0x15aa2e,'name':_0x1c9cb8[_0x4146ae(0x193)][_0x4146ae(0x1da)],'tdDatabaseName':_0x1c9cb8[_0x4146ae(0x193)][_0x4146ae(0x291)],'tables':_0x1c9cb8[_0x4146ae(0x193)]['tables']});_0x5f2bf4['set'](_0x1c9cb8['id'],_0x59a1c0['id']);}const _0x2b3625=[..._0x29892a],_0x24173d=_0x29892a[_0x4146ae(0x189)]+0x1;let _0x14fd77=0x0;while(_0x2b3625[_0x4146ae(0x189)]>0x0&&_0x14fd77<_0x24173d){_0x14fd77++;const _0x5c3f84=[];for(const _0x530e31 of _0x2b3625){if(canCreateAgent(_0x530e31,_0x3eea21)){const _0x35d53a=remapToolIds(_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x17e)],_0x5f2bf4,_0x3eea21),_0x430c13=remapVariableIds(_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x287)],_0x5f2bf4),_0x4102fd=await this[_0x4146ae(0x203)][_0x4146ae(0x1d1)]({'name':_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x1da)],'projectId':_0x15aa2e,'systemPrompt':_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x1fc)],'starterMessage':_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x1d0)],'modelType':migrateModelType(_0x530e31[_0x4146ae(0x193)]['modelType']),'maxToolIterations':_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x1b1)],'temperature':_0x530e31[_0x4146ae(0x193)][_0x4146ae(0x1c6)],'reasoningEffort':_0x530e31[_0x4146ae(0x193)]['reasoningEffort'],'outputs':_0x530e31[_0x4146ae(0x193)]['outputs'],'tools':_0x35d53a,'variables':_0x430c13});_0x3eea21['set'](_0x530e31['id'],_0x4102fd['id']);}else _0x5c3f84[_0x4146ae(0x277)](_0x530e31);}if(_0x5c3f84['length']===_0x2b3625[_0x4146ae(0x189)])throw new SDKError(ErrorCode[_0x4146ae(0x22c)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x4146ae(0x1cd)});_0x2b3625['length']=0x0,_0x2b3625['push'](..._0x5c3f84);}for(const _0x4a911c of _0x26301c){const _0x1de4e7=_0x3eea21[_0x4146ae(0x1c0)](_0x4a911c[_0x4146ae(0x193)][_0x4146ae(0x255)]);if(!_0x1de4e7)continue;const _0x4f34c9=await this[_0x4146ae(0x203)][_0x4146ae(0x256)]({'projectId':_0x15aa2e,'agentId':_0x1de4e7,'name':_0x4a911c['attributes'][_0x4146ae(0x1da)],'systemPrompt':_0x4a911c['attributes'][_0x4146ae(0x1fc)],'template':_0x4a911c['attributes'][_0x4146ae(0x195)],'jsonSchemaHint':_0x4a911c[_0x4146ae(0x193)]['jsonSchemaHint']});_0x4f5b55['set'](_0x4a911c['id'],_0x4f34c9['id']);}for(const _0x214ee1 of _0x5b3292){const _0x37ef99=_0x214ee1[_0x4146ae(0x193)]['actions']['map'](_0x333d35=>({..._0x333d35,'promptId':_0x4f5b55['get'](_0x333d35['promptId'])||_0x333d35[_0x4146ae(0x285)]}));await this[_0x4146ae(0x203)]['createIntegration']({'projectId':_0x15aa2e,'serviceType':_0x214ee1[_0x4146ae(0x193)][_0x4146ae(0x28f)],'actions':_0x37ef99,'slackMessageMode':_0x214ee1[_0x4146ae(0x193)][_0x4146ae(0x1fa)],'chatIgnoreManagedActions':_0x214ee1[_0x4146ae(0x193)][_0x4146ae(0x178)],'chatWelcomeMessage':_0x214ee1[_0x4146ae(0x193)][_0x4146ae(0x275)],'webhookCorsOrigins':_0x214ee1[_0x4146ae(0x193)][_0x4146ae(0x196)]});}return{'projectName':_0x301bea,'projectId':_0x15aa2e,'counts':{'agents':_0x3eea21[_0x4146ae(0x1f3)],'knowledgeBases':_0x5f2bf4[_0x4146ae(0x1f3)],'prompts':_0x4f5b55['size'],'integrations':_0x5b3292['length']},'sourceSite':_0x3e7ea7};}[a134_0x1280fc(0x181)](_0x225a88,_0x3cb6ed){const _0x1ff26e=a134_0x1280fc;if(!a134_0x4f3caa[_0x1ff26e(0x273)](_0x225a88))return _0x3cb6ed;return JSON[_0x1ff26e(0x1ce)](a134_0x4f3caa['readFileSync'](_0x225a88,_0x1ff26e(0x1a7)));}[a134_0x1280fc(0x252)](_0x255b33){const _0x297597=a134_0x1280fc;if(!a134_0x4f3caa['existsSync'](_0x255b33))throw new SDKError(ErrorCode[_0x297597(0x1b6)],'Backup\x20folder\x20not\x20found:\x20'+_0x255b33,undefined,{'helpText':'Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.'});const _0x3c1d8d=a134_0xb4a0ec[_0x297597(0x271)](_0x255b33,_0x297597(0x18c));if(!a134_0x4f3caa[_0x297597(0x273)](_0x3c1d8d))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x297597(0x236)+_0x255b33,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x5c91c4=JSON[_0x297597(0x1ce)](a134_0x4f3caa['readFileSync'](_0x3c1d8d,_0x297597(0x1a7)));if(!isSupportedBackupVersion(_0x5c91c4['version']))throw new SDKError(ErrorCode[_0x297597(0x207)],_0x297597(0x243)+_0x5c91c4['version'],undefined,{'helpText':_0x297597(0x24d)});return _0x5c91c4;}async['pullProject'](_0x3c1847,_0x487078,_0x34d44e){const _0xf29d78=a134_0x1280fc,{projectId:_0x352944,project:_0x347a6b}=await this[_0xf29d78(0x259)](_0x3c1847),_0x14b4cd=_0x347a6b[_0xf29d78(0x193)][_0xf29d78(0x1da)];let _0xdfd7dd;if(_0x487078)_0xdfd7dd=_0x487078;else{const _0x1a2ab0=a134_0xb4a0ec[_0xf29d78(0x271)](process['cwd'](),_0xf29d78(0x1bc)),_0x3c5d46=getSanitizedPathWithMigration(_0x1a2ab0,_0x14b4cd);_0x3c5d46[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x276)+a134_0xb4a0ec['basename'](_0x3c5d46['oldPath'])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x3c5d46[_0xf29d78(0x19a)])),_0xdfd7dd=_0x3c5d46[_0xf29d78(0x19a)];}const _0x3c27bc=await this[_0xf29d78(0x203)][_0xf29d78(0x1e1)](_0x352944),_0x126dfc=await this['client'][_0xf29d78(0x247)](_0x352944),_0x3d9472=await this['client'][_0xf29d78(0x190)](_0x352944),_0x5ccf34=await safeListOrEmpty(()=>this['client'][_0xf29d78(0x19b)](_0x352944)),_0x1c8100=await safeListOrEmpty(()=>this[_0xf29d78(0x203)][_0xf29d78(0x21e)](_0x352944)),_0x43e05c=await this['client'][_0xf29d78(0x18b)](_0x352944),_0x51b02b=await this['client']['listIntegrations'](_0x352944),_0x1c730b=await safeListOrEmpty(()=>this['client'][_0xf29d78(0x1dd)](_0x352944)),_0x993f1c=await safeListOrEmpty(()=>this[_0xf29d78(0x203)]['listExperimentalArtifacts'](_0x352944)),_0x265ea1=await safeListOrEmpty(()=>this[_0xf29d78(0x203)]['listFormInterfaces'](_0x352944)),_0x5de67f=await safeListOrEmpty(()=>this[_0xf29d78(0x203)][_0xf29d78(0x1bb)](_0x352944)),_0x1de2e9=_0x51b02b[_0xf29d78(0x18a)](_0x576dc7=>!_0x576dc7[_0xf29d78(0x193)][_0xf29d78(0x1c4)]&&SAFE_INTEGRATION_TYPES[_0xf29d78(0x20c)](_0x576dc7[_0xf29d78(0x193)]['serviceType'][_0xf29d78(0x23b)]())),_0x1dd883=new Map(),_0x2c524e=new Map(),_0x3e92b8=new Map(),_0x316799=new Map(),_0x3f9d81=new Map(),_0x58d4fb=new Map(),_0x77f6d0=new Map();for(const _0x4a9c6f of _0x3c27bc){_0x1dd883['set'](_0x4a9c6f['id'],_0x4a9c6f['attributes'][_0xf29d78(0x1da)]);}for(const _0x4330cd of _0x126dfc){_0x2c524e[_0xf29d78(0x26f)](_0x4330cd['id'],_0x4330cd[_0xf29d78(0x193)][_0xf29d78(0x1da)]);}for(const _0x1941f9 of _0x3d9472){_0x3e92b8[_0xf29d78(0x26f)](_0x1941f9['id'],_0x1941f9[_0xf29d78(0x193)][_0xf29d78(0x1da)]);}for(const _0x3dab6c of _0x5ccf34){_0x316799[_0xf29d78(0x26f)](_0x3dab6c['id'],_0x3dab6c[_0xf29d78(0x193)]['name']);}for(const _0xe36575 of _0x1c8100){_0x3f9d81[_0xf29d78(0x26f)](_0xe36575['id'],_0xe36575[_0xf29d78(0x193)][_0xf29d78(0x1da)]);}for(const _0x2f336b of _0x43e05c){_0x58d4fb[_0xf29d78(0x26f)](_0x2f336b['id'],_0x2f336b['attributes'][_0xf29d78(0x1da)]);}for(const _0x5d6452 of _0x1c730b){_0x77f6d0['set'](_0x5d6452['id'],_0x5d6452[_0xf29d78(0x193)][_0xf29d78(0x1da)]);}const _0x241aab={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x2c524e,'TextKnowledgeBase':_0x3e92b8,'Agent':_0x1dd883,'WebSearchTool':_0x3f9d81,'ImageGenerator':_0x316799,'ExperimentalKnowledgeBase':_0x77f6d0}),'resolvePromptName':async _0x42488e=>_0x58d4fb['get'](_0x42488e),'onWarning':_0xd1161b=>this['logger'][_0xf29d78(0x1eb)](_0xd1161b)},_0x2ca305={'projectName':_0x14b4cd,'outputDir':_0xdfd7dd,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'knowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'textKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'prompts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'integrations':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalArtifacts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'formInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'chatInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0x2d2735=[],_0x4fa164=[];for(const _0x103eab of _0x3c27bc){const _0x1284c9=getSanitizedPathWithMigration(_0xdfd7dd,_0x103eab[_0xf29d78(0x193)][_0xf29d78(0x1da)]);_0x1284c9[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x1a1)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x1284c9['oldPath'])+'\x20→\x20'+a134_0xb4a0ec['basename'](_0x1284c9[_0xf29d78(0x19a)]));const _0x4b39aa=_0x1284c9[_0xf29d78(0x19a)],_0x5808e5=a134_0xb4a0ec['join'](_0x4b39aa,'prompt.md'),_0x5d2561=a134_0xb4a0ec[_0xf29d78(0x271)](_0x4b39aa,_0xf29d78(0x17c)),_0x12acb1=a134_0xb4a0ec['join'](_0x4b39aa,_0xf29d78(0x22f)),{yaml:_0x4ef23c,systemPrompt:_0x1d967e,starterMessage:_0x4854cb}=await agentResponseToDef(_0x103eab,_0x241aab),_0x1c6cf6=toAgentYamlString(_0x4ef23c),_0x245fea=!a134_0x4f3caa[_0xf29d78(0x273)](_0x5d2561);let _0x336f3c=_0x245fea,_0x11fadd;if(!_0x245fea){const _0x22fc26=a134_0x4f3caa[_0xf29d78(0x273)](_0x5808e5)?a134_0x4f3caa[_0xf29d78(0x186)](_0x5808e5,_0xf29d78(0x1a7)):'',_0x184fee=a134_0x4f3caa[_0xf29d78(0x186)](_0x5d2561,_0xf29d78(0x1a7)),_0x1c129c=_0xf29d78(0x1ac)+_0x22fc26+_0xf29d78(0x206)+_0x184fee,_0x122b7b='#\x20prompt.md\x0a'+_0x1d967e+_0xf29d78(0x206)+_0x1c6cf6,_0x33849b=generateDiff(_0x1c129c,_0x122b7b);_0x336f3c=hasChanges(_0x33849b),_0x336f3c&&(_0x11fadd=formatDiffWithColors(_0x33849b));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x4b39aa,'content':'','isDir':!![]}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x5808e5,'content':_0x1d967e}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x5d2561,'content':_0x1c6cf6});_0x4854cb&&_0x4854cb['includes']('\x0a')&&_0x2d2735[_0xf29d78(0x277)]({'path':_0x12acb1,'content':_0x4854cb});_0x2ca305[_0xf29d78(0x1bc)][_0xf29d78(0x277)]({'agentName':_0x103eab[_0xf29d78(0x193)][_0xf29d78(0x1da)],'outputPath':_0x4b39aa,'isNew':_0x245fea,'hasChanges':_0x336f3c,'diff':_0x11fadd}),_0x2ca305[_0xf29d78(0x1f6)]['agents'][_0xf29d78(0x17f)]++;if(_0x245fea)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1bc)]['new']++;else{if(_0x336f3c)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1bc)][_0xf29d78(0x232)]++;else _0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1bc)][_0xf29d78(0x23a)]++;}}for(const _0x2d7671 of _0x126dfc){if(_0x2d7671[_0xf29d78(0x193)][_0xf29d78(0x1c4)])continue;const _0x432268=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0xdfd7dd),_0x2d7671[_0xf29d78(0x193)][_0xf29d78(0x1da)],'.yml');_0x432268['renamed']&&this[_0xf29d78(0x1b4)]['info'](_0xf29d78(0x1bd)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x432268[_0xf29d78(0x254)])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x432268[_0xf29d78(0x19a)]));const _0x5a7efa=_0x432268['path'],_0x140838=apiKnowledgeBaseToYaml(_0x2d7671),_0x43bb72=toKnowledgeBaseYamlString(_0x140838),_0x2cdcc2=!a134_0x4f3caa[_0xf29d78(0x273)](_0x5a7efa);let _0x20ee22=_0x2cdcc2,_0x4bc67e;if(!_0x2cdcc2){const _0x40de0c=a134_0x4f3caa[_0xf29d78(0x186)](_0x5a7efa,_0xf29d78(0x1a7)),_0x3bebfb=generateDiff(_0x40de0c,_0x43bb72);_0x20ee22=hasChanges(_0x3bebfb),_0x20ee22&&(_0x4bc67e=formatDiffWithColors(_0x3bebfb));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x5a7efa,'content':_0x43bb72}),_0x2ca305[_0xf29d78(0x1e5)]['push']({'name':_0x2d7671[_0xf29d78(0x193)]['name'],'outputPath':_0x5a7efa,'isNew':_0x2cdcc2,'hasChanges':_0x20ee22,'diff':_0x4bc67e}),_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1e5)][_0xf29d78(0x17f)]++;if(_0x2cdcc2)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1e5)][_0xf29d78(0x1f5)]++;else{if(_0x20ee22)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1e5)][_0xf29d78(0x232)]++;else _0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1e5)]['unchanged']++;}}for(const _0x51b885 of _0x3d9472){if(_0x51b885[_0xf29d78(0x193)][_0xf29d78(0x1c4)])continue;const _0x5d8a7e=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0xdfd7dd),_0x51b885[_0xf29d78(0x193)][_0xf29d78(0x1da)],_0xf29d78(0x1e9));_0x5d8a7e[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x1cc)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x5d8a7e[_0xf29d78(0x254)])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x5d8a7e[_0xf29d78(0x19a)]));const _0x199ab2=_0x5d8a7e[_0xf29d78(0x19a)],_0x1d4664=toTextKnowledgeBaseMd(_0x51b885['attributes'][_0xf29d78(0x1da)],_0x51b885[_0xf29d78(0x193)][_0xf29d78(0x230)]),_0x5b353b=!a134_0x4f3caa['existsSync'](_0x199ab2);let _0x4c3744=_0x5b353b,_0x3de15a;if(!_0x5b353b){const _0x974709=a134_0x4f3caa[_0xf29d78(0x186)](_0x199ab2,_0xf29d78(0x1a7)),_0x1a0b04=generateDiff(_0x974709,_0x1d4664);_0x4c3744=hasChanges(_0x1a0b04),_0x4c3744&&(_0x3de15a=formatDiffWithColors(_0x1a0b04));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x199ab2,'content':_0x1d4664}),_0x2ca305[_0xf29d78(0x25f)]['push']({'name':_0x51b885['attributes'][_0xf29d78(0x1da)],'outputPath':_0x199ab2,'isNew':_0x5b353b,'hasChanges':_0x4c3744,'diff':_0x3de15a}),_0x2ca305[_0xf29d78(0x1f6)]['textKnowledgeBases']['total']++;if(_0x5b353b)_0x2ca305[_0xf29d78(0x1f6)]['textKnowledgeBases'][_0xf29d78(0x1f5)]++;else{if(_0x4c3744)_0x2ca305['counts'][_0xf29d78(0x25f)][_0xf29d78(0x232)]++;else _0x2ca305[_0xf29d78(0x1f6)]['textKnowledgeBases'][_0xf29d78(0x23a)]++;}}for(const _0x54ee17 of _0x43e05c){if(_0x54ee17[_0xf29d78(0x193)]['isManaged'])continue;const _0x5cff93=getSanitizedPathWithMigration(getPromptsDir(_0xdfd7dd),_0x54ee17['attributes']['name'],_0xf29d78(0x1c7));_0x5cff93['renamed']&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x237)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x5cff93['oldPath'])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x5cff93[_0xf29d78(0x19a)]));const _0x569639=_0x5cff93[_0xf29d78(0x19a)],_0x29760c=await apiPromptToYaml(_0x54ee17,_0x241aab);if(!_0x29760c)continue;const _0x5ca7a2=toPromptYamlString(_0x29760c),_0x3a014c=!a134_0x4f3caa[_0xf29d78(0x273)](_0x569639);let _0x2f8478=_0x3a014c,_0x153636;if(!_0x3a014c){const _0x31096c=a134_0x4f3caa[_0xf29d78(0x186)](_0x569639,_0xf29d78(0x1a7)),_0x179d54=generateDiff(_0x31096c,_0x5ca7a2);_0x2f8478=hasChanges(_0x179d54),_0x2f8478&&(_0x153636=formatDiffWithColors(_0x179d54));}_0x2d2735['push']({'path':_0x569639,'content':_0x5ca7a2}),_0x2ca305[_0xf29d78(0x25d)][_0xf29d78(0x277)]({'name':_0x54ee17[_0xf29d78(0x193)][_0xf29d78(0x1da)],'outputPath':_0x569639,'isNew':_0x3a014c,'hasChanges':_0x2f8478,'diff':_0x153636}),_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x25d)][_0xf29d78(0x17f)]++;if(_0x3a014c)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x25d)]['new']++;else{if(_0x2f8478)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x25d)][_0xf29d78(0x232)]++;else _0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x25d)][_0xf29d78(0x23a)]++;}}for(const _0x4d6dcd of _0x1de2e9){const _0x259ca4=_0x4d6dcd[_0xf29d78(0x193)]['serviceType'][_0xf29d78(0x23b)](),_0x2492c5=getSanitizedPathWithMigration(getIntegrationsDir(_0xdfd7dd),_0x259ca4,'.yml');_0x2492c5[_0xf29d78(0x234)]&&this['logger'][_0xf29d78(0x183)](_0xf29d78(0x19d)+a134_0xb4a0ec['basename'](_0x2492c5[_0xf29d78(0x254)])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x2492c5[_0xf29d78(0x19a)]));const _0x2aba39=_0x2492c5[_0xf29d78(0x19a)],_0x2a36fe=await apiIntegrationToYaml(_0x4d6dcd,_0x241aab),_0x5de757=toIntegrationYamlString(_0x2a36fe),_0x52fce5=!a134_0x4f3caa[_0xf29d78(0x273)](_0x2aba39);let _0x5d85a5=_0x52fce5,_0x1e6f10;if(!_0x52fce5){const _0x4abacb=a134_0x4f3caa['readFileSync'](_0x2aba39,'utf-8'),_0x101093=generateDiff(_0x4abacb,_0x5de757);_0x5d85a5=hasChanges(_0x101093),_0x5d85a5&&(_0x1e6f10=formatDiffWithColors(_0x101093));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x2aba39,'content':_0x5de757}),_0x2ca305[_0xf29d78(0x180)]['push']({'name':_0x259ca4,'outputPath':_0x2aba39,'isNew':_0x52fce5,'hasChanges':_0x5d85a5,'diff':_0x1e6f10}),_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x180)]['total']++;if(_0x52fce5)_0x2ca305[_0xf29d78(0x1f6)]['integrations']['new']++;else{if(_0x5d85a5)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x180)]['updated']++;else _0x2ca305['counts'][_0xf29d78(0x180)]['unchanged']++;}}for(const _0x2cf992 of _0x1c730b){if(_0x2cf992[_0xf29d78(0x193)][_0xf29d78(0x1c4)])continue;const _0x402e4e=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0xdfd7dd),_0x2cf992['attributes'][_0xf29d78(0x1da)]);_0x402e4e[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x279)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x402e4e['oldPath'])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x402e4e[_0xf29d78(0x19a)]));const _0x42adba=_0x402e4e['path'],_0x33248e=a134_0xb4a0ec[_0xf29d78(0x271)](_0x42adba,sanitizeForFilesystem(_0x2cf992[_0xf29d78(0x193)][_0xf29d78(0x1da)])+_0xf29d78(0x1c7)),_0x566ed4=a134_0xb4a0ec[_0xf29d78(0x271)](_0x42adba,_0xf29d78(0x24f)),_0x230a99=apiExperimentalKnowledgeBaseToYaml(_0x2cf992),_0x2fbb73=toExperimentalKnowledgeBaseYamlString(_0x230a99),_0x4b2d43=!a134_0x4f3caa[_0xf29d78(0x273)](_0x42adba);let _0x3a7007=_0x4b2d43,_0x390a74,_0x163d51=_0x2fbb73;const _0x4cb1a6=[..._0x230a99['functions']][_0xf29d78(0x23e)]((_0x20c907,_0x20da0e)=>_0x20c907[_0xf29d78(0x1da)][_0xf29d78(0x1ab)](_0x20da0e[_0xf29d78(0x1da)]));for(const _0x38a296 of _0x4cb1a6){_0x163d51+='\x0a---\x20function:\x20'+_0x38a296['name']+_0xf29d78(0x1a2)+_0x38a296[_0xf29d78(0x28a)]+_0xf29d78(0x224)+_0x38a296[_0xf29d78(0x1da)]+'\x20---\x0a'+_0x38a296[_0xf29d78(0x197)]+'\x0a';}if(!_0x4b2d43){let _0x382981='';a134_0x4f3caa[_0xf29d78(0x273)](_0x33248e)&&(_0x382981=a134_0x4f3caa[_0xf29d78(0x186)](_0x33248e,_0xf29d78(0x1a7)));if(a134_0x4f3caa['existsSync'](_0x566ed4)){const _0x478fca=a134_0x4f3caa['readdirSync'](_0x566ed4,{'withFileTypes':!![]}),_0x420565=_0x478fca[_0xf29d78(0x18a)](_0x362e2e=>_0x362e2e[_0xf29d78(0x27e)]())[_0xf29d78(0x23e)]((_0x35aeeb,_0x353f3d)=>_0x35aeeb[_0xf29d78(0x1da)][_0xf29d78(0x1ab)](_0x353f3d[_0xf29d78(0x1da)]));for(const _0x196fb6 of _0x420565){const _0x464e26=a134_0xb4a0ec[_0xf29d78(0x271)](_0x566ed4,_0x196fb6[_0xf29d78(0x1da)],'code.js'),_0x114826=a134_0xb4a0ec['join'](_0x566ed4,_0x196fb6[_0xf29d78(0x1da)],_0xf29d78(0x1c8));a134_0x4f3caa[_0xf29d78(0x273)](_0x464e26)&&(_0x382981+=_0xf29d78(0x226)+_0x196fb6[_0xf29d78(0x1da)]+'\x20---\x0a'+a134_0x4f3caa[_0xf29d78(0x186)](_0x464e26,_0xf29d78(0x1a7))+'\x0a'),a134_0x4f3caa[_0xf29d78(0x273)](_0x114826)&&(_0x382981+=_0xf29d78(0x217)+_0x196fb6[_0xf29d78(0x1da)]+_0xf29d78(0x1a2)+a134_0x4f3caa['readFileSync'](_0x114826,_0xf29d78(0x1a7))+'\x0a');}}const _0x3eae3d=generateDiff(_0x382981,_0x163d51);_0x3a7007=hasChanges(_0x3eae3d),_0x3a7007&&(_0x390a74=formatDiffWithColors(_0x3eae3d));}_0x2d2735['push']({'path':_0x42adba,'content':'','isDir':!![]}),_0x2d2735['push']({'path':_0x33248e,'content':_0x2fbb73}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x566ed4,'content':'','isDir':!![]});for(const _0x2325c6 of _0x230a99[_0xf29d78(0x24f)]){const _0x4202c3=a134_0xb4a0ec[_0xf29d78(0x271)](_0x566ed4,sanitizeForFilesystem(_0x2325c6[_0xf29d78(0x1da)])),_0x6e604b=a134_0xb4a0ec[_0xf29d78(0x271)](_0x4202c3,_0xf29d78(0x212)),_0x11779c=a134_0xb4a0ec['join'](_0x4202c3,_0xf29d78(0x1c8));_0x2d2735[_0xf29d78(0x277)]({'path':_0x4202c3,'content':'','isDir':!![]}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x6e604b,'content':_0x2325c6[_0xf29d78(0x28a)]}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x11779c,'content':_0x2325c6['json_schema']});}if(a134_0x4f3caa['existsSync'](_0x566ed4)){const _0xad1dec=a134_0x4f3caa[_0xf29d78(0x249)](_0x566ed4,{'withFileTypes':!![]}),_0x2f388e=new Set(_0x230a99[_0xf29d78(0x24f)][_0xf29d78(0x1ca)](_0x5867fb=>sanitizeForFilesystem(_0x5867fb[_0xf29d78(0x1da)])));for(const _0x40f7b6 of _0xad1dec){if(_0x40f7b6[_0xf29d78(0x27e)]()&&!_0x2f388e['has'](_0x40f7b6[_0xf29d78(0x1da)])){const _0x1562e3=a134_0xb4a0ec[_0xf29d78(0x271)](_0x566ed4,_0x40f7b6[_0xf29d78(0x1da)]);_0x4fa164[_0xf29d78(0x277)]({'path':_0x1562e3,'isDir':!![]});}}}_0x2ca305[_0xf29d78(0x1cb)][_0xf29d78(0x277)]({'name':_0x2cf992[_0xf29d78(0x193)]['name'],'outputPath':_0x42adba,'isNew':_0x4b2d43,'hasChanges':_0x3a7007,'diff':_0x390a74}),_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1cb)][_0xf29d78(0x17f)]++;if(_0x4b2d43)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1cb)][_0xf29d78(0x1f5)]++;else{if(_0x3a7007)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x1cb)][_0xf29d78(0x232)]++;else _0x2ca305['counts'][_0xf29d78(0x1cb)][_0xf29d78(0x23a)]++;}}for(const _0x5b2201 of _0x993f1c){if(_0x5b2201[_0xf29d78(0x193)][_0xf29d78(0x1c4)])continue;const _0x2bfaab=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0xdfd7dd),_0x5b2201['attributes'][_0xf29d78(0x1da)]);_0x2bfaab[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x244)+a134_0xb4a0ec['basename'](_0x2bfaab[_0xf29d78(0x254)])+'\x20→\x20'+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x2bfaab[_0xf29d78(0x19a)]));const _0x1cad31=_0x2bfaab[_0xf29d78(0x19a)],_0x55c133=a134_0xb4a0ec[_0xf29d78(0x271)](_0x1cad31,sanitizeForFilesystem(_0x5b2201[_0xf29d78(0x193)][_0xf29d78(0x1da)])+_0xf29d78(0x1c7)),_0x3c834b=a134_0xb4a0ec[_0xf29d78(0x271)](_0x1cad31,_0xf29d78(0x212)),_0x2d5e54=a134_0xb4a0ec['join'](_0x1cad31,_0xf29d78(0x200)),_0x3867ec=apiExperimentalArtifactToYaml(_0x5b2201),_0x1e9f5d=toExperimentalArtifactYamlString(_0x3867ec),_0x33d6a2=!a134_0x4f3caa[_0xf29d78(0x273)](_0x1cad31);let _0x4bc959=_0x33d6a2,_0x301806,_0x37dbd7=_0x1e9f5d+(_0xf29d78(0x18e)+_0x3867ec[_0xf29d78(0x28a)]+'\x0a');const _0x538a27=[..._0x3867ec[_0xf29d78(0x200)]]['sort']((_0xa2e0e4,_0x495715)=>_0xa2e0e4[_0xf29d78(0x295)]['localeCompare'](_0x495715['file_name']));for(const _0x587708 of _0x538a27){_0x37dbd7+=_0xf29d78(0x1be)+_0x587708[_0xf29d78(0x295)]+_0xf29d78(0x1a2)+_0x587708[_0xf29d78(0x296)]+'\x0a';}if(!_0x33d6a2){let _0x1fe6fe='';a134_0x4f3caa['existsSync'](_0x55c133)&&(_0x1fe6fe=a134_0x4f3caa[_0xf29d78(0x186)](_0x55c133,_0xf29d78(0x1a7)));a134_0x4f3caa[_0xf29d78(0x273)](_0x3c834b)&&(_0x1fe6fe+=_0xf29d78(0x18e)+a134_0x4f3caa['readFileSync'](_0x3c834b,'utf-8')+'\x0a');if(a134_0x4f3caa[_0xf29d78(0x273)](_0x2d5e54)){const _0x300fe1=a134_0x4f3caa['readdirSync'](_0x2d5e54),_0x1358d1=_0x300fe1[_0xf29d78(0x18a)](_0x6730f3=>{const _0x21d8c0=_0xf29d78,_0x20f754=a134_0xb4a0ec[_0x21d8c0(0x271)](_0x2d5e54,_0x6730f3);return a134_0x4f3caa[_0x21d8c0(0x268)](_0x20f754)[_0x21d8c0(0x205)]();})['sort']((_0x4ea3f9,_0x485089)=>_0x4ea3f9[_0xf29d78(0x1ab)](_0x485089));for(const _0x5f3357 of _0x1358d1){const _0x888580=a134_0xb4a0ec['join'](_0x2d5e54,_0x5f3357);_0x1fe6fe+=_0xf29d78(0x1be)+_0x5f3357+_0xf29d78(0x1a2)+a134_0x4f3caa[_0xf29d78(0x186)](_0x888580,_0xf29d78(0x1a7))+'\x0a';}}const _0x412aa7=generateDiff(_0x1fe6fe,_0x37dbd7);_0x4bc959=hasChanges(_0x412aa7),_0x4bc959&&(_0x301806=formatDiffWithColors(_0x412aa7));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x1cad31,'content':'','isDir':!![]}),_0x2d2735[_0xf29d78(0x277)]({'path':_0x55c133,'content':_0x1e9f5d}),_0x2d2735['push']({'path':_0x3c834b,'content':_0x3867ec[_0xf29d78(0x28a)]});if(_0x3867ec[_0xf29d78(0x200)][_0xf29d78(0x189)]>0x0){_0x2d2735[_0xf29d78(0x277)]({'path':_0x2d5e54,'content':'','isDir':!![]});for(const _0x48a1c7 of _0x3867ec[_0xf29d78(0x200)]){const _0x4c3410=a134_0xb4a0ec[_0xf29d78(0x271)](_0x2d5e54,_0x48a1c7['file_name']);_0x2d2735[_0xf29d78(0x277)]({'path':_0x4c3410,'content':_0x48a1c7[_0xf29d78(0x296)]});}}if(a134_0x4f3caa[_0xf29d78(0x273)](_0x2d5e54)){const _0x390861=a134_0x4f3caa[_0xf29d78(0x249)](_0x2d5e54),_0x1551c0=new Set(_0x3867ec[_0xf29d78(0x200)][_0xf29d78(0x1ca)](_0x1800aa=>_0x1800aa['file_name']));for(const _0x205ae3 of _0x390861){const _0x20147c=a134_0xb4a0ec[_0xf29d78(0x271)](_0x2d5e54,_0x205ae3);a134_0x4f3caa[_0xf29d78(0x268)](_0x20147c)[_0xf29d78(0x205)]()&&!_0x1551c0[_0xf29d78(0x17b)](_0x205ae3)&&_0x4fa164['push']({'path':_0x20147c});}}_0x2ca305['experimentalArtifacts']['push']({'name':_0x5b2201[_0xf29d78(0x193)]['name'],'outputPath':_0x1cad31,'isNew':_0x33d6a2,'hasChanges':_0x4bc959,'diff':_0x301806}),_0x2ca305['counts'][_0xf29d78(0x20a)]['total']++;if(_0x33d6a2)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x20a)][_0xf29d78(0x1f5)]++;else{if(_0x4bc959)_0x2ca305[_0xf29d78(0x1f6)]['experimentalArtifacts'][_0xf29d78(0x232)]++;else _0x2ca305['counts']['experimentalArtifacts']['unchanged']++;}}for(const _0x33334 of _0x265ea1){const _0x48ea4d=getSanitizedPathWithMigration(getFormInterfacesDir(_0xdfd7dd),_0x33334[_0xf29d78(0x193)][_0xf29d78(0x1da)],_0xf29d78(0x1c7));_0x48ea4d[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x187)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x48ea4d[_0xf29d78(0x254)])+'\x20→\x20'+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x48ea4d[_0xf29d78(0x19a)]));const _0x29c772=_0x48ea4d['path'],_0x38a3ee=await apiFormInterfaceToYaml(_0x33334,_0x241aab),_0x13ca79=toFormInterfaceYamlString(_0x38a3ee),_0x2b2706=!a134_0x4f3caa[_0xf29d78(0x273)](_0x29c772);let _0x595c80=_0x2b2706,_0x1f147b;if(!_0x2b2706){const _0x4461e8=a134_0x4f3caa[_0xf29d78(0x186)](_0x29c772,_0xf29d78(0x1a7)),_0x1e8377=generateDiff(_0x4461e8,_0x13ca79);_0x595c80=hasChanges(_0x1e8377),_0x595c80&&(_0x1f147b=formatDiffWithColors(_0x1e8377));}_0x2d2735[_0xf29d78(0x277)]({'path':_0x29c772,'content':_0x13ca79}),_0x2ca305['formInterfaces'][_0xf29d78(0x277)]({'name':_0x33334[_0xf29d78(0x193)][_0xf29d78(0x1da)],'outputPath':_0x29c772,'isNew':_0x2b2706,'hasChanges':_0x595c80,'diff':_0x1f147b}),_0x2ca305[_0xf29d78(0x1f6)]['formInterfaces'][_0xf29d78(0x17f)]++;if(_0x2b2706)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x194)]['new']++;else{if(_0x595c80)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x194)][_0xf29d78(0x232)]++;else _0x2ca305['counts'][_0xf29d78(0x194)]['unchanged']++;}}for(const _0x3a1b37 of _0x5de67f){if(_0x3a1b37[_0xf29d78(0x193)][_0xf29d78(0x1c4)])continue;const _0x2fb407=getSanitizedPathWithMigration(getChatInterfacesDir(_0xdfd7dd),_0x3a1b37['attributes']['name'],_0xf29d78(0x1c7));_0x2fb407[_0xf29d78(0x234)]&&this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x1e7)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x2fb407[_0xf29d78(0x254)])+_0xf29d78(0x28d)+a134_0xb4a0ec[_0xf29d78(0x23c)](_0x2fb407[_0xf29d78(0x19a)]));const _0x166b5a=_0x2fb407[_0xf29d78(0x19a)],_0x2cdf15=await apiChatInterfaceToYaml(_0x3a1b37,_0x241aab),_0xbc08f=toChatInterfaceYamlString(_0x2cdf15),_0x36d2db=!a134_0x4f3caa[_0xf29d78(0x273)](_0x166b5a);let _0x5837ad=_0x36d2db,_0x550b52;if(!_0x36d2db){const _0x23c990=a134_0x4f3caa['readFileSync'](_0x166b5a,_0xf29d78(0x1a7)),_0x5ca427=generateDiff(_0x23c990,_0xbc08f);_0x5837ad=hasChanges(_0x5ca427),_0x5837ad&&(_0x550b52=formatDiffWithColors(_0x5ca427));}_0x2d2735['push']({'path':_0x166b5a,'content':_0xbc08f}),_0x2ca305[_0xf29d78(0x266)][_0xf29d78(0x277)]({'name':_0x3a1b37[_0xf29d78(0x193)][_0xf29d78(0x1da)],'outputPath':_0x166b5a,'isNew':_0x36d2db,'hasChanges':_0x5837ad,'diff':_0x550b52}),_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x266)][_0xf29d78(0x17f)]++;if(_0x36d2db)_0x2ca305[_0xf29d78(0x1f6)][_0xf29d78(0x266)][_0xf29d78(0x1f5)]++;else{if(_0x5837ad)_0x2ca305['counts']['chatInterfaces'][_0xf29d78(0x232)]++;else _0x2ca305[_0xf29d78(0x1f6)]['chatInterfaces'][_0xf29d78(0x23a)]++;}}if(_0x34d44e?.[_0xf29d78(0x248)])return _0x2ca305;a134_0x4f3caa[_0xf29d78(0x20f)](_0xdfd7dd,{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x20f)](getKnowledgeBasesDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa['mkdirSync'](getPromptsDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x20f)](getIntegrationsDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x20f)](getExperimentalKnowledgeBasesDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa['mkdirSync'](getExperimentalArtifactsDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x20f)](getFormInterfacesDir(_0xdfd7dd),{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x20f)](getChatInterfacesDir(_0xdfd7dd),{'recursive':!![]});const _0x52d1a7=a134_0xb4a0ec['join'](_0xdfd7dd,_0xf29d78(0x1f8));a134_0x4f3caa['writeFileSync'](_0x52d1a7,createAgentConfigContent(_0x14b4cd));for(const _0x16848e of _0x2d2735){if(_0x16848e[_0xf29d78(0x1ee)])a134_0x4f3caa[_0xf29d78(0x20f)](_0x16848e[_0xf29d78(0x19a)],{'recursive':!![]});else{const _0xce03cd=a134_0xb4a0ec['dirname'](_0x16848e['path']);!a134_0x4f3caa['existsSync'](_0xce03cd)&&a134_0x4f3caa[_0xf29d78(0x20f)](_0xce03cd,{'recursive':!![]}),a134_0x4f3caa[_0xf29d78(0x188)](_0x16848e[_0xf29d78(0x19a)],_0x16848e[_0xf29d78(0x27d)]);}}for(const _0xdc8710 of _0x4fa164){_0xdc8710['isDir']?(a134_0x4f3caa[_0xf29d78(0x218)](_0xdc8710[_0xf29d78(0x19a)],{'recursive':!![],'force':!![]}),this[_0xf29d78(0x1b4)][_0xf29d78(0x183)](_0xf29d78(0x1e4)+a134_0xb4a0ec[_0xf29d78(0x23c)](a134_0xb4a0ec['dirname'](_0xdc8710['path']))+'/'+a134_0xb4a0ec[_0xf29d78(0x23c)](_0xdc8710[_0xf29d78(0x19a)]))):(a134_0x4f3caa[_0xf29d78(0x218)](_0xdc8710[_0xf29d78(0x19a)],{'force':!![]}),this[_0xf29d78(0x1b4)]['info'](_0xf29d78(0x21a)+a134_0xb4a0ec[_0xf29d78(0x23c)](a134_0xb4a0ec[_0xf29d78(0x284)](_0xdc8710[_0xf29d78(0x19a)]))+'/'+a134_0xb4a0ec[_0xf29d78(0x23c)](_0xdc8710[_0xf29d78(0x19a)])));}return _0x2ca305;}async['pushProject'](_0x49eda2,_0xa08415){const _0x23ebf3=a134_0x1280fc,_0x404ebb=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x49eda2,_0x23ebf3(0x1f8));if(!a134_0x4f3caa[_0x23ebf3(0x273)](_0x404ebb))throw new SDKError(ErrorCode[_0x23ebf3(0x207)],'No\x20tdx.json\x20found\x20in\x20'+_0x49eda2,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x38878e=loadAgentConfig(_0x404ebb),_0xe54f73=await this['resolveProjectId'](_0x38878e[_0x23ebf3(0x280)]),_0x3d2ae7=await this[_0x23ebf3(0x203)]['getProject'](_0xe54f73),_0x519d5f=_0x3d2ae7[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0xd109b3={'projectName':_0x519d5f,'projectId':_0xe54f73,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x2fe103=[],_0x28d482=[],_0x45a269=[],_0x2bd3f5=[],_0x36233a=[],_0x122fc5=[],_0x5e71c8=a134_0x4f3caa[_0x23ebf3(0x249)](_0x49eda2,{'withFileTypes':!![]});for(const _0x64ddb6 of _0x5e71c8){if(!_0x64ddb6[_0x23ebf3(0x27e)]())continue;if([_0x23ebf3(0x20d),_0x23ebf3(0x25d),_0x23ebf3(0x180),_0x23ebf3(0x283),_0x23ebf3(0x213),_0x23ebf3(0x223),_0x23ebf3(0x1c1)][_0x23ebf3(0x20c)](_0x64ddb6[_0x23ebf3(0x1da)]))continue;const _0x513d7b=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x49eda2,_0x64ddb6['name']);if(isAgentDir(_0x513d7b)){const _0x30cc7d=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x513d7b,'agent.yml'),_0x4253ae=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x513d7b,_0x23ebf3(0x214)),_0x4c01ae=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x513d7b,_0x23ebf3(0x22f)),_0x26a75c=parseAgentYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x30cc7d,_0x23ebf3(0x1a7)),_0x30cc7d),_0x65bea9=a134_0x4f3caa[_0x23ebf3(0x273)](_0x4253ae)?a134_0x4f3caa[_0x23ebf3(0x186)](_0x4253ae,_0x23ebf3(0x1a7)):'',_0x5e3e9d=a134_0x4f3caa[_0x23ebf3(0x273)](_0x4c01ae)?a134_0x4f3caa[_0x23ebf3(0x186)](_0x4c01ae,_0x23ebf3(0x1a7)):_0x26a75c[_0x23ebf3(0x1ec)];_0x2fe103['push']({'name':_0x26a75c[_0x23ebf3(0x1da)],'dir':_0x513d7b,'yaml':_0x26a75c,'systemPrompt':_0x65bea9,'starterMessage':_0x5e3e9d});}}const _0x5420eb=getKnowledgeBasesDir(_0x49eda2);if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x5420eb)){const _0x811129=a134_0x4f3caa[_0x23ebf3(0x249)](_0x5420eb);for(const _0x1dc257 of _0x811129){const _0x311e0a=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x5420eb,_0x1dc257);if(_0x1dc257[_0x23ebf3(0x1e6)](_0x23ebf3(0x1c7))){const _0x5bdf81=parseKnowledgeBaseYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x311e0a,_0x23ebf3(0x1a7)),_0x311e0a);_0x28d482[_0x23ebf3(0x277)]({'name':_0x5bdf81[_0x23ebf3(0x1da)],'path':_0x311e0a,'yaml':_0x5bdf81});}else{if(_0x1dc257[_0x23ebf3(0x1e6)]('.md')){const _0x15c10d=a134_0x4f3caa[_0x23ebf3(0x186)](_0x311e0a,_0x23ebf3(0x1a7)),{name:_0x4c67ce,text:_0x3dc2bd}=parseTextKnowledgeBaseMd(_0x15c10d,_0x1dc257);_0x45a269[_0x23ebf3(0x277)]({'name':_0x4c67ce,'path':_0x311e0a,'text':_0x3dc2bd});}}}}const _0xc68f93=getPromptsDir(_0x49eda2);if(a134_0x4f3caa['existsSync'](_0xc68f93)){const _0x30030e=a134_0x4f3caa['readdirSync'](_0xc68f93)[_0x23ebf3(0x18a)](_0x104be1=>_0x104be1[_0x23ebf3(0x1e6)](_0x23ebf3(0x1c7)));for(const _0x2ce7a8 of _0x30030e){const _0x481757=a134_0xb4a0ec[_0x23ebf3(0x271)](_0xc68f93,_0x2ce7a8),_0x2f9672=parsePromptYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x481757,_0x23ebf3(0x1a7)),_0x481757);_0x2bd3f5[_0x23ebf3(0x277)]({'name':_0x2f9672[_0x23ebf3(0x1da)],'path':_0x481757,'yaml':_0x2f9672});}}const _0x13d6c4=[],_0x2ef806=getIntegrationsDir(_0x49eda2);if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x2ef806)){const _0x11853f=a134_0x4f3caa[_0x23ebf3(0x249)](_0x2ef806)[_0x23ebf3(0x18a)](_0x4822e3=>_0x4822e3[_0x23ebf3(0x1e6)](_0x23ebf3(0x1c7)));for(const _0x3103c6 of _0x11853f){const _0x9e5e1e=a134_0xb4a0ec['join'](_0x2ef806,_0x3103c6),_0x315028=parseIntegrationYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x9e5e1e,_0x23ebf3(0x1a7)),_0x9e5e1e);if(!SAFE_INTEGRATION_TYPES['includes'](_0x315028[_0x23ebf3(0x1b8)][_0x23ebf3(0x23b)]())){this[_0x23ebf3(0x1b4)][_0x23ebf3(0x1eb)](_0x23ebf3(0x209)+_0x315028['name']+_0x23ebf3(0x21d)+_0x315028['service_type']+'):\x20'+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES[_0x23ebf3(0x271)](',\x20')+_0x23ebf3(0x1ed))+_0x23ebf3(0x184));continue;}_0x13d6c4[_0x23ebf3(0x277)]({'name':_0x315028[_0x23ebf3(0x1da)],'path':_0x9e5e1e,'yaml':_0x315028});}}const _0x30c51a=getExperimentalKnowledgeBasesDir(_0x49eda2);if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x30c51a)){const _0x4bc792=a134_0x4f3caa['readdirSync'](_0x30c51a,{'withFileTypes':!![]});for(const _0x43b673 of _0x4bc792){if(!_0x43b673[_0x23ebf3(0x27e)]())continue;const _0x443d2a=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x30c51a,_0x43b673[_0x23ebf3(0x1da)]),_0x3dbc96=a134_0xb4a0ec['join'](_0x443d2a,_0x43b673[_0x23ebf3(0x1da)]+_0x23ebf3(0x1c7)),_0x2dcffd=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x443d2a,'functions');if(!a134_0x4f3caa[_0x23ebf3(0x273)](_0x3dbc96))continue;const _0x202459=parseExperimentalKnowledgeBaseYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x3dbc96,'utf-8'),_0x3dbc96),_0x398e02=[];if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x2dcffd)){const _0x2d7415=a134_0x4f3caa[_0x23ebf3(0x249)](_0x2dcffd,{'withFileTypes':!![]});for(const _0x3136d6 of _0x2d7415){if(!_0x3136d6[_0x23ebf3(0x27e)]())continue;const _0x93ea58=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x2dcffd,_0x3136d6[_0x23ebf3(0x1da)]),_0x1ce00d=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x93ea58,_0x23ebf3(0x212)),_0x353f33=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x93ea58,_0x23ebf3(0x1c8));a134_0x4f3caa[_0x23ebf3(0x273)](_0x1ce00d)&&a134_0x4f3caa[_0x23ebf3(0x273)](_0x353f33)&&_0x398e02['push']({'name':_0x3136d6[_0x23ebf3(0x1da)],'code':a134_0x4f3caa[_0x23ebf3(0x186)](_0x1ce00d,_0x23ebf3(0x1a7)),'json_schema':a134_0x4f3caa[_0x23ebf3(0x186)](_0x353f33,_0x23ebf3(0x1a7))});}}const _0x14192c={..._0x202459,'variables':_0x202459['variables']||[],'functions':_0x398e02};_0x36233a[_0x23ebf3(0x277)]({'name':_0x202459['name'],'dir':_0x443d2a,'def':_0x14192c});}}const _0x4332de=getExperimentalArtifactsDir(_0x49eda2);if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x4332de)){const _0x231b2b=a134_0x4f3caa[_0x23ebf3(0x249)](_0x4332de,{'withFileTypes':!![]});for(const _0x439bc7 of _0x231b2b){if(!_0x439bc7['isDirectory']())continue;const _0x564b73=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x4332de,_0x439bc7[_0x23ebf3(0x1da)]),_0x4a7fcd=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x564b73,_0x439bc7['name']+'.yml'),_0x55297a=a134_0xb4a0ec['join'](_0x564b73,_0x23ebf3(0x212)),_0x49a3a3=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x564b73,'files');if(!a134_0x4f3caa[_0x23ebf3(0x273)](_0x4a7fcd)||!a134_0x4f3caa[_0x23ebf3(0x273)](_0x55297a))continue;const _0x4cf2e3=parseExperimentalArtifactYaml(a134_0x4f3caa['readFileSync'](_0x4a7fcd,'utf-8'),_0x4a7fcd),_0x17d2e7=a134_0x4f3caa[_0x23ebf3(0x186)](_0x55297a,'utf-8'),_0x47c17f=[];if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x49a3a3)){const _0x3e9d1d=a134_0x4f3caa[_0x23ebf3(0x249)](_0x49a3a3);for(const _0x55f40c of _0x3e9d1d){const _0x27174c=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x49a3a3,_0x55f40c);a134_0x4f3caa[_0x23ebf3(0x268)](_0x27174c)[_0x23ebf3(0x205)]()&&_0x47c17f['push']({'file_name':_0x55f40c,'text_content':a134_0x4f3caa['readFileSync'](_0x27174c,_0x23ebf3(0x1a7))});}}const _0xebba13={..._0x4cf2e3,'code':_0x17d2e7,'files':_0x47c17f};_0x122fc5[_0x23ebf3(0x277)]({'name':_0x4cf2e3['name'],'dir':_0x564b73,'def':_0xebba13});}}const _0x29f193=[],_0x92e15e=getFormInterfacesDir(_0x49eda2);if(a134_0x4f3caa[_0x23ebf3(0x273)](_0x92e15e)){const _0x30de2e=a134_0x4f3caa[_0x23ebf3(0x249)](_0x92e15e)[_0x23ebf3(0x18a)](_0x4e011a=>_0x4e011a['endsWith']('.yml'));for(const _0x245afd of _0x30de2e){const _0x3abf82=a134_0xb4a0ec['join'](_0x92e15e,_0x245afd),_0x3c9a19=parseFormInterfaceYaml(a134_0x4f3caa[_0x23ebf3(0x186)](_0x3abf82,_0x23ebf3(0x1a7)),_0x3abf82);_0x29f193[_0x23ebf3(0x277)]({'name':_0x3c9a19[_0x23ebf3(0x1da)],'path':_0x3abf82,'yaml':_0x3c9a19});}}const _0x108c54=[],_0x7d3da6=getChatInterfacesDir(_0x49eda2);if(a134_0x4f3caa['existsSync'](_0x7d3da6)){const _0x1a4e50=a134_0x4f3caa[_0x23ebf3(0x249)](_0x7d3da6)[_0x23ebf3(0x18a)](_0x365e35=>_0x365e35[_0x23ebf3(0x1e6)](_0x23ebf3(0x1c7)));for(const _0x12adf7 of _0x1a4e50){const _0x44595b=a134_0xb4a0ec[_0x23ebf3(0x271)](_0x7d3da6,_0x12adf7),_0x3da76a=parseChatInterfaceYaml(a134_0x4f3caa['readFileSync'](_0x44595b,_0x23ebf3(0x1a7)),_0x44595b);_0x108c54[_0x23ebf3(0x277)]({'name':_0x3da76a['name'],'path':_0x44595b,'yaml':_0x3da76a});}}const _0x3e3d02=await this[_0x23ebf3(0x203)][_0x23ebf3(0x1e1)](_0xe54f73),_0x1a26f0=await this['client'][_0x23ebf3(0x247)](_0xe54f73),_0xae9c3e=await this['client'][_0x23ebf3(0x190)](_0xe54f73),_0x5c80a2=await this[_0x23ebf3(0x203)][_0x23ebf3(0x18b)](_0xe54f73),_0x118ad1=await this[_0x23ebf3(0x203)]['listIntegrations'](_0xe54f73),_0x159b8f=await safeListOrEmpty(()=>this[_0x23ebf3(0x203)][_0x23ebf3(0x1dd)](_0xe54f73)),_0x169577=await safeListOrEmpty(()=>this[_0x23ebf3(0x203)]['listExperimentalArtifacts'](_0xe54f73)),_0x20d24d=await safeListOrEmpty(()=>this[_0x23ebf3(0x203)][_0x23ebf3(0x22a)](_0xe54f73)),_0x1a2b4a=await safeListOrEmpty(()=>this[_0x23ebf3(0x203)][_0x23ebf3(0x1bb)](_0xe54f73)),_0x5ea292=await fetchAllToolTargetMaps((_0x3c0774,_0x2141d6)=>this[_0x23ebf3(0x203)][_0x23ebf3(0x24c)](_0x3c0774,_0x2141d6),_0xe54f73),_0x4969ef=new Map(),_0x470d3e=new Map(),_0x4ea27b=new Map(),_0x530c8c=new Map(),_0x49e608=new Map(),_0x2fa7fe=new Map(),_0x3a6ab3=new Map();for(const _0x1ca8f2 of _0x3e3d02){_0x4969ef[_0x23ebf3(0x26f)](_0x1ca8f2[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x1ca8f2);}for(const _0x31a11d of _0x1a26f0){_0x470d3e[_0x23ebf3(0x26f)](_0x31a11d[_0x23ebf3(0x193)]['name'],_0x31a11d);}for(const _0x14ac4c of _0xae9c3e){_0x4ea27b[_0x23ebf3(0x26f)](_0x14ac4c['attributes'][_0x23ebf3(0x1da)],_0x14ac4c);}for(const _0x30053e of _0x5c80a2){_0x530c8c['set'](_0x30053e[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x30053e);}for(const _0x5c953c of _0x118ad1){_0x49e608[_0x23ebf3(0x26f)](_0x5c953c['attributes'][_0x23ebf3(0x28f)]['toLowerCase'](),_0x5c953c);}for(const _0x8defda of _0x159b8f){_0x2fa7fe['set'](_0x8defda[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x8defda);}for(const _0xe5838f of _0x169577){_0x3a6ab3[_0x23ebf3(0x26f)](_0xe5838f[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0xe5838f);}const _0x4d167e=new Map(),_0x226e44=new Map();for(const _0x53fc47 of _0x20d24d){_0x4d167e[_0x23ebf3(0x26f)](_0x53fc47[_0x23ebf3(0x193)]['name'],_0x53fc47);}for(const _0x3cf412 of _0x1a2b4a){_0x226e44[_0x23ebf3(0x26f)](_0x3cf412[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x3cf412);}const _0x3acc7d=new Map(),_0x3d3ae7=new Map();for(const _0x3df1ec of _0x3e3d02){_0x3acc7d[_0x23ebf3(0x26f)](_0x3df1ec[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x3df1ec['id']),_0x3d3ae7[_0x23ebf3(0x26f)](_0x3df1ec['id'],_0x3df1ec[_0x23ebf3(0x193)][_0x23ebf3(0x1da)]);}const _0x51dea4=new Map(),_0x42fdc8=new Map();for(const _0x53ed04 of _0x5c80a2){_0x51dea4['set'](_0x53ed04[_0x23ebf3(0x193)][_0x23ebf3(0x1da)],_0x53ed04['id']),_0x42fdc8[_0x23ebf3(0x26f)](_0x53ed04['id'],_0x53ed04[_0x23ebf3(0x193)]['name']);}const _0xd25b66=_0x5ea292['nameToId'][_0x23ebf3(0x219)]||new Map(),_0x553293=_0x5ea292['nameToId'][_0x23ebf3(0x282)]||new Map(),_0x5753f5=_0x5ea292[_0x23ebf3(0x288)]['ExperimentalKnowledgeBase']||new Map(),_0xadf01f=new Map(),_0x1286b9={'resolveToolTargetName':buildNameResolver({..._0x5ea292[_0x23ebf3(0x292)],'Agent':_0x3d3ae7}),'resolvePromptName':async _0xf32e83=>_0x42fdc8['get'](_0xf32e83),'onWarning':_0x4b12c2=>this[_0x23ebf3(0x1b4)][_0x23ebf3(0x1eb)](_0x4b12c2)};let _0x1dafc5=[];const _0x23718f={'projectId':_0xe54f73,'resolveToolTargetId':buildIdResolver({..._0x5ea292[_0x23ebf3(0x288)],'Agent':_0x3acc7d}),'resolvePromptId':async _0x1bf33c=>_0x51dea4[_0x23ebf3(0x1c0)](_0x1bf33c),'onWarning':_0x44b937=>{const _0x802bd=_0x23ebf3;this[_0x802bd(0x1b4)]['warn'](_0x44b937),_0x1dafc5[_0x802bd(0x277)](_0x44b937);}},{resolved:_0xa14eff,unresolved:_0x259343}=resolveAgentDependencies(_0x2fe103,new Set(_0x4969ef[_0x23ebf3(0x1a4)]()));for(const {agent:_0x10d6a1,missingDeps:_0x3d0e4b}of _0x259343){_0xd109b3['agents']['push']({'agentName':_0x10d6a1[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x23ebf3(0x253)+_0x3d0e4b[_0x23ebf3(0x271)](',\x20')+_0x23ebf3(0x211)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1bc)][_0x23ebf3(0x1a5)]++;}for(const _0x2e227c of _0x28d482){const _0x749a1f=_0x470d3e[_0x23ebf3(0x1c0)](_0x2e227c[_0x23ebf3(0x28b)]['name']),_0x1d4328=a134_0x4f3caa['readFileSync'](_0x2e227c[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x749a1f){const _0x7564fe=apiKnowledgeBaseToYaml(_0x749a1f),_0x13a9bf=toKnowledgeBaseYamlString(_0x7564fe),_0x2688f3=generateDiff(_0x13a9bf,_0x1d4328),_0x29e89a=hasChanges(_0x2688f3);_0x29e89a?(_0xd109b3[_0x23ebf3(0x1e5)][_0x23ebf3(0x277)]({'name':_0x2e227c[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x749a1f['id'],'diff':formatDiffWithColors(_0x2688f3)}),_0xd109b3[_0x23ebf3(0x1f6)]['knowledgeBases'][_0x23ebf3(0x232)]++):(_0xd109b3['knowledgeBases'][_0x23ebf3(0x277)]({'name':_0x2e227c['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x23a),'id':_0x749a1f['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['knowledgeBases'][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x1e5)][_0x23ebf3(0x277)]({'name':_0x2e227c['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b)}),_0xd109b3['counts']['knowledgeBases'][_0x23ebf3(0x27b)]++;}for(const _0x920566 of _0x45a269){const _0x5456a5=_0x4ea27b[_0x23ebf3(0x1c0)](_0x920566[_0x23ebf3(0x1da)]),_0x5b45a0=a134_0x4f3caa[_0x23ebf3(0x186)](_0x920566[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x5456a5){const _0x379e31=toTextKnowledgeBaseMd(_0x5456a5['attributes'][_0x23ebf3(0x1da)],_0x5456a5['attributes'][_0x23ebf3(0x230)]),_0x1d59c2=generateDiff(_0x379e31,_0x5b45a0),_0x2f69bc=hasChanges(_0x1d59c2);_0x2f69bc?(_0xd109b3[_0x23ebf3(0x25f)]['push']({'name':_0x920566[_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x5456a5['id'],'diff':formatDiffWithColors(_0x1d59c2)}),_0xd109b3['counts']['textKnowledgeBases'][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x25f)]['push']({'name':_0x920566['name'],'action':_0x23ebf3(0x23a),'id':_0x5456a5['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25f)][_0x23ebf3(0x23a)]++);}else _0xd109b3['textKnowledgeBases'][_0x23ebf3(0x277)]({'name':_0x920566[_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b)}),_0xd109b3[_0x23ebf3(0x1f6)]['textKnowledgeBases'][_0x23ebf3(0x27b)]++;}for(const _0x33574d of _0xa14eff){const _0x3c4922=_0x4969ef[_0x23ebf3(0x1c0)](_0x33574d[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)]),_0x5e98d6=a134_0xb4a0ec['join'](_0x33574d[_0x23ebf3(0x227)],_0x23ebf3(0x17c)),_0x147159=a134_0x4f3caa['readFileSync'](_0x5e98d6,'utf-8'),_0x1c46b7=_0x33574d['systemPrompt'],_0x37e0e8=_0x23ebf3(0x1ac)+_0x1c46b7+'\x0a\x0a#\x20agent.yml\x0a'+_0x147159;if(_0x3c4922){const {yaml:_0x2018db,systemPrompt:_0x4b15fb}=await agentResponseToDef(_0x3c4922,_0x1286b9),_0x220780=toAgentYamlString(_0x2018db),_0x114bb7='#\x20prompt.md\x0a'+_0x4b15fb+_0x23ebf3(0x206)+_0x220780,_0x32cd47=generateDiff(_0x114bb7,_0x37e0e8),_0x25cfa1=hasChanges(_0x32cd47);_0x25cfa1?(_0xd109b3[_0x23ebf3(0x1bc)][_0x23ebf3(0x277)]({'agentName':_0x33574d[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'agentId':_0x3c4922['id'],'diff':formatDiffWithColors(_0x32cd47)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1bc)][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x1bc)][_0x23ebf3(0x277)]({'agentName':_0x33574d[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':'unchanged','agentId':_0x3c4922['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['agents']['unchanged']++);}else _0xd109b3[_0x23ebf3(0x1bc)][_0x23ebf3(0x277)]({'agentName':_0x33574d[_0x23ebf3(0x28b)]['name'],'action':'created'}),_0xd109b3['counts'][_0x23ebf3(0x1bc)][_0x23ebf3(0x27b)]++;}for(const _0x4753d9 of _0x2bd3f5){const _0x56e391=_0x530c8c[_0x23ebf3(0x1c0)](_0x4753d9[_0x23ebf3(0x28b)]['name']),_0x1b0409=a134_0x4f3caa['readFileSync'](_0x4753d9[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x56e391){const _0x5407b5=await apiPromptToYaml(_0x56e391,_0x1286b9);if(!_0x5407b5){_0xd109b3['prompts'][_0x23ebf3(0x277)]({'name':_0x4753d9[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':'updated','id':_0x56e391['id']}),_0xd109b3['counts']['prompts'][_0x23ebf3(0x232)]++;continue;}const _0x5749b6=toPromptYamlString(_0x5407b5),_0x50675b=generateDiff(_0x5749b6,_0x1b0409),_0x2c2954=hasChanges(_0x50675b);_0x2c2954?(_0xd109b3['prompts'][_0x23ebf3(0x277)]({'name':_0x4753d9[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':'updated','id':_0x56e391['id'],'diff':formatDiffWithColors(_0x50675b)}),_0xd109b3['counts'][_0x23ebf3(0x25d)][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x25d)][_0x23ebf3(0x277)]({'name':_0x4753d9[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x23a),'id':_0x56e391['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25d)][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x25d)]['push']({'name':_0x4753d9[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b)}),_0xd109b3['counts'][_0x23ebf3(0x25d)][_0x23ebf3(0x27b)]++;}for(const _0x1a807f of _0x13d6c4){const _0x33f188=_0x49e608[_0x23ebf3(0x1c0)](_0x1a807f[_0x23ebf3(0x28b)][_0x23ebf3(0x1b8)]),_0x271892=a134_0x4f3caa['readFileSync'](_0x1a807f[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x33f188){const _0x3a88c1=await apiIntegrationToYaml(_0x33f188,_0x1286b9),_0x598afe=toIntegrationYamlString(_0x3a88c1),_0x41c900=generateDiff(_0x598afe,_0x271892),_0x224b5f=hasChanges(_0x41c900);_0x224b5f?(_0xd109b3[_0x23ebf3(0x180)][_0x23ebf3(0x277)]({'name':_0x1a807f['yaml'][_0x23ebf3(0x1b8)],'action':_0x23ebf3(0x232),'id':_0x33f188['id'],'diff':formatDiffWithColors(_0x41c900)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x180)][_0x23ebf3(0x232)]++):(_0xd109b3['integrations']['push']({'name':_0x1a807f['yaml']['service_type'],'action':_0x23ebf3(0x23a),'id':_0x33f188['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['integrations'][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x180)][_0x23ebf3(0x277)]({'name':_0x1a807f[_0x23ebf3(0x28b)]['service_type'],'action':_0x23ebf3(0x27b)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x180)][_0x23ebf3(0x27b)]++;}for(const _0x4fa755 of _0x36233a){const _0x1271b7=_0x2fa7fe[_0x23ebf3(0x1c0)](_0x4fa755[_0x23ebf3(0x290)]['name']),_0x355194=toExperimentalKnowledgeBaseYamlString(_0x4fa755[_0x23ebf3(0x290)]);let _0x5db6f8=_0x355194;for(const _0x1c9075 of _0x4fa755['def'][_0x23ebf3(0x24f)]){_0x5db6f8+='\x0a---\x20function:\x20'+_0x1c9075[_0x23ebf3(0x1da)]+_0x23ebf3(0x1a2)+_0x1c9075[_0x23ebf3(0x28a)]+'\x0a---\x20schema:\x20'+_0x1c9075[_0x23ebf3(0x1da)]+'\x20---\x0a'+_0x1c9075[_0x23ebf3(0x197)]+'\x0a';}if(_0x1271b7){const _0x289a88=apiExperimentalKnowledgeBaseToYaml(_0x1271b7),_0x30159f=toExperimentalKnowledgeBaseYamlString(_0x289a88);let _0x7dd604=_0x30159f;for(const _0x35512d of _0x289a88[_0x23ebf3(0x24f)]){_0x7dd604+=_0x23ebf3(0x226)+_0x35512d[_0x23ebf3(0x1da)]+_0x23ebf3(0x1a2)+_0x35512d[_0x23ebf3(0x28a)]+'\x0a---\x20schema:\x20'+_0x35512d['name']+_0x23ebf3(0x1a2)+_0x35512d[_0x23ebf3(0x197)]+'\x0a';}const _0x187eea=generateDiff(_0x7dd604,_0x5db6f8),_0xbb142f=hasChanges(_0x187eea);_0xbb142f?(_0xd109b3[_0x23ebf3(0x1cb)]['push']({'name':_0x4fa755['def'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x1271b7['id'],'diff':formatDiffWithColors(_0x187eea)}),_0xd109b3[_0x23ebf3(0x1f6)]['experimentalKnowledgeBases'][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x1cb)][_0x23ebf3(0x277)]({'name':_0x4fa755[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x23a),'id':_0x1271b7['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1cb)][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x1cb)][_0x23ebf3(0x277)]({'name':_0x4fa755[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b)}),_0xd109b3['counts'][_0x23ebf3(0x1cb)][_0x23ebf3(0x27b)]++;}for(const _0x40fb9f of _0x122fc5){const _0x1745fd=_0x3a6ab3[_0x23ebf3(0x1c0)](_0x40fb9f['def'][_0x23ebf3(0x1da)]),_0x4e7e3b=toExperimentalArtifactYamlString(_0x40fb9f[_0x23ebf3(0x290)]);let _0x54a778=_0x4e7e3b+(_0x23ebf3(0x18e)+_0x40fb9f['def'][_0x23ebf3(0x28a)]+'\x0a');for(const _0x33da11 of _0x40fb9f[_0x23ebf3(0x290)][_0x23ebf3(0x200)]){_0x54a778+='---\x20file:\x20'+_0x33da11[_0x23ebf3(0x295)]+_0x23ebf3(0x1a2)+_0x33da11[_0x23ebf3(0x296)]+'\x0a';}if(_0x1745fd){const _0x42487d=apiExperimentalArtifactToYaml(_0x1745fd),_0x2f51c4=toExperimentalArtifactYamlString(_0x42487d);let _0x451d6e=_0x2f51c4+(_0x23ebf3(0x18e)+_0x42487d[_0x23ebf3(0x28a)]+'\x0a');for(const _0x444943 of _0x42487d['files']){_0x451d6e+='---\x20file:\x20'+_0x444943[_0x23ebf3(0x295)]+'\x20---\x0a'+_0x444943[_0x23ebf3(0x296)]+'\x0a';}const _0x2087fb=generateDiff(_0x451d6e,_0x54a778),_0x550572=hasChanges(_0x2087fb);_0x550572?(_0xd109b3[_0x23ebf3(0x20a)][_0x23ebf3(0x277)]({'name':_0x40fb9f['def'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x1745fd['id'],'diff':formatDiffWithColors(_0x2087fb)}),_0xd109b3['counts'][_0x23ebf3(0x20a)][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x20a)]['push']({'name':_0x40fb9f[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x23a),'id':_0x1745fd['id']}),_0xd109b3['counts'][_0x23ebf3(0x20a)][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x20a)]['push']({'name':_0x40fb9f[_0x23ebf3(0x290)]['name'],'action':'created'}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x20a)][_0x23ebf3(0x27b)]++;}for(const _0x33a29c of _0x29f193){const _0x560459=_0x4d167e['get'](_0x33a29c[_0x23ebf3(0x28b)]['name']),_0x1e1139=a134_0x4f3caa['readFileSync'](_0x33a29c[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x560459){const _0x5385ae=await apiFormInterfaceToYaml(_0x560459,_0x1286b9),_0x234d78=toFormInterfaceYamlString(_0x5385ae),_0x16a6c8=generateDiff(_0x234d78,_0x1e1139),_0x659bdf=hasChanges(_0x16a6c8);_0x659bdf?(_0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x33a29c[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x560459['id'],'diff':formatDiffWithColors(_0x16a6c8)}),_0xd109b3[_0x23ebf3(0x1f6)]['formInterfaces'][_0x23ebf3(0x232)]++):(_0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x33a29c[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x23a),'id':_0x560459['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x194)]['unchanged']++);}else _0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x33a29c['yaml']['name'],'action':_0x23ebf3(0x27b)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x194)][_0x23ebf3(0x27b)]++;}for(const _0x5d7b8d of _0x108c54){const _0x52c001=_0x226e44[_0x23ebf3(0x1c0)](_0x5d7b8d['yaml'][_0x23ebf3(0x1da)]),_0x1270e9=a134_0x4f3caa[_0x23ebf3(0x186)](_0x5d7b8d[_0x23ebf3(0x19a)],_0x23ebf3(0x1a7));if(_0x52c001){const _0x36a111=await apiChatInterfaceToYaml(_0x52c001,_0x1286b9),_0x907a0b=toChatInterfaceYamlString(_0x36a111),_0x37d01c=generateDiff(_0x907a0b,_0x1270e9),_0x573d62=hasChanges(_0x37d01c);_0x573d62?(_0xd109b3[_0x23ebf3(0x266)][_0x23ebf3(0x277)]({'name':_0x5d7b8d[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x52c001['id'],'diff':formatDiffWithColors(_0x37d01c)}),_0xd109b3['counts'][_0x23ebf3(0x266)]['updated']++):(_0xd109b3[_0x23ebf3(0x266)][_0x23ebf3(0x277)]({'name':_0x5d7b8d[_0x23ebf3(0x28b)]['name'],'action':_0x23ebf3(0x23a),'id':_0x52c001['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x266)][_0x23ebf3(0x23a)]++);}else _0xd109b3[_0x23ebf3(0x266)][_0x23ebf3(0x277)]({'name':_0x5d7b8d['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b)}),_0xd109b3['counts'][_0x23ebf3(0x266)][_0x23ebf3(0x27b)]++;}if(_0xa08415?.['dryRun'])return _0xd109b3;_0xd109b3[_0x23ebf3(0x1e5)]=[],_0xd109b3[_0x23ebf3(0x25f)]=[],_0xd109b3[_0x23ebf3(0x25d)]=[],_0xd109b3[_0x23ebf3(0x180)]=[],_0xd109b3[_0x23ebf3(0x1cb)]=[],_0xd109b3[_0x23ebf3(0x20a)]=[],_0xd109b3[_0x23ebf3(0x194)]=[],_0xd109b3[_0x23ebf3(0x266)]=[];const _0xec9582=_0xd109b3[_0x23ebf3(0x1bc)]['filter'](_0x5b7ca0=>_0x5b7ca0[_0x23ebf3(0x215)]==='error');_0xd109b3[_0x23ebf3(0x1bc)]=_0xec9582,_0xd109b3[_0x23ebf3(0x1f6)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0xec9582[_0x23ebf3(0x189)]},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x2a0e2d of _0x28d482){try{const _0x4c7e81=_0x470d3e[_0x23ebf3(0x1c0)](_0x2a0e2d['yaml'][_0x23ebf3(0x1da)]),_0x105a2e=yamlKnowledgeBaseToApi(_0x2a0e2d[_0x23ebf3(0x28b)],_0xe54f73);if(_0x4c7e81)await this[_0x23ebf3(0x203)][_0x23ebf3(0x26a)](_0x4c7e81['id'],_0x105a2e),_0xd25b66[_0x23ebf3(0x26f)](_0x2a0e2d[_0x23ebf3(0x28b)]['name'],_0x4c7e81['id']),_0xd109b3[_0x23ebf3(0x1e5)]['push']({'name':_0x2a0e2d['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x4c7e81['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['knowledgeBases'][_0x23ebf3(0x232)]++;else{const _0x4c782b=await this['client']['createKnowledgeBase'](_0x105a2e);_0xd25b66[_0x23ebf3(0x26f)](_0x2a0e2d['yaml']['name'],_0x4c782b['id']),_0xd109b3[_0x23ebf3(0x1e5)][_0x23ebf3(0x277)]({'name':_0x2a0e2d[_0x23ebf3(0x28b)]['name'],'action':'created','id':_0x4c782b['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1e5)][_0x23ebf3(0x27b)]++;}}catch(_0x34867f){_0xd109b3[_0x23ebf3(0x1e5)][_0x23ebf3(0x277)]({'name':_0x2a0e2d[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x34867f[_0x23ebf3(0x1af)]}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1e5)][_0x23ebf3(0x1a5)]++;}}for(const _0x442d17 of _0x45a269){try{const _0x276e18=_0x4ea27b[_0x23ebf3(0x1c0)](_0x442d17['name']),_0x2e5c04=yamlTextKnowledgeBaseToApi({'name':_0x442d17['name'],'text':_0x442d17[_0x23ebf3(0x230)]},_0xe54f73);if(_0x276e18)await this['client'][_0x23ebf3(0x1d4)](_0x276e18['id'],_0x2e5c04),_0x553293['set'](_0x442d17[_0x23ebf3(0x1da)],_0x276e18['id']),_0xd109b3[_0x23ebf3(0x25f)]['push']({'name':_0x442d17[_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x276e18['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['textKnowledgeBases']['updated']++;else{const _0x29313b=await this[_0x23ebf3(0x203)][_0x23ebf3(0x1b0)](_0x2e5c04);_0x553293['set'](_0x442d17[_0x23ebf3(0x1da)],_0x29313b['id']),_0xd109b3[_0x23ebf3(0x25f)][_0x23ebf3(0x277)]({'name':_0x442d17['name'],'action':_0x23ebf3(0x27b),'id':_0x29313b['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25f)]['created']++;}}catch(_0x2d6a4d){_0xd109b3[_0x23ebf3(0x25f)]['push']({'name':_0x442d17[_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x2d6a4d[_0x23ebf3(0x1af)]}),_0xd109b3[_0x23ebf3(0x1f6)]['textKnowledgeBases'][_0x23ebf3(0x1a5)]++;}}for(const _0x112968 of _0x36233a){try{const _0x47f80d=_0x2fa7fe[_0x23ebf3(0x1c0)](_0x112968[_0x23ebf3(0x290)][_0x23ebf3(0x1da)]),_0x19dc9a=yamlExperimentalKnowledgeBaseToApi(_0x112968['def'],_0xe54f73);if(_0x47f80d)await this[_0x23ebf3(0x203)][_0x23ebf3(0x192)](_0x47f80d['id'],_0x19dc9a),_0x5753f5[_0x23ebf3(0x26f)](_0x112968[_0x23ebf3(0x290)]['name'],_0x47f80d['id']),_0xd109b3[_0x23ebf3(0x1cb)][_0x23ebf3(0x277)]({'name':_0x112968[_0x23ebf3(0x290)]['name'],'action':'updated','id':_0x47f80d['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x1cb)]['updated']++;else{const _0x499865=await this[_0x23ebf3(0x203)][_0x23ebf3(0x208)](_0x19dc9a);_0x5753f5[_0x23ebf3(0x26f)](_0x112968[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],_0x499865['id']),_0xd109b3[_0x23ebf3(0x1cb)][_0x23ebf3(0x277)]({'name':_0x112968[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b),'id':_0x499865['id']}),_0xd109b3['counts'][_0x23ebf3(0x1cb)]['created']++;}}catch(_0x26e25b){_0xd109b3[_0x23ebf3(0x1cb)][_0x23ebf3(0x277)]({'name':_0x112968[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x26e25b[_0x23ebf3(0x1af)]}),_0xd109b3['counts']['experimentalKnowledgeBases']['errors']++;}}for(const _0x3a47f4 of _0x122fc5){try{const _0x5b1db8=_0x3a6ab3[_0x23ebf3(0x1c0)](_0x3a47f4[_0x23ebf3(0x290)][_0x23ebf3(0x1da)]),_0x21cc3f=yamlExperimentalArtifactToApi(_0x3a47f4[_0x23ebf3(0x290)],_0xe54f73);if(_0x5b1db8)await this[_0x23ebf3(0x203)][_0x23ebf3(0x281)](_0x5b1db8['id'],_0x21cc3f),_0xadf01f['set'](_0x3a47f4[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],_0x5b1db8['id']),_0xd109b3[_0x23ebf3(0x20a)][_0x23ebf3(0x277)]({'name':_0x3a47f4['def'][_0x23ebf3(0x1da)],'action':'updated','id':_0x5b1db8['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x20a)][_0x23ebf3(0x232)]++;else{const _0x1dacfc=await this[_0x23ebf3(0x203)][_0x23ebf3(0x21b)](_0x21cc3f);_0xadf01f['set'](_0x3a47f4['def'][_0x23ebf3(0x1da)],_0x1dacfc['id']),_0xd109b3['experimentalArtifacts'][_0x23ebf3(0x277)]({'name':_0x3a47f4[_0x23ebf3(0x290)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b),'id':_0x1dacfc['id']}),_0xd109b3['counts'][_0x23ebf3(0x20a)][_0x23ebf3(0x27b)]++;}}catch(_0x288992){_0xd109b3[_0x23ebf3(0x20a)][_0x23ebf3(0x277)]({'name':_0x3a47f4['def'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x288992['message']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x20a)][_0x23ebf3(0x1a5)]++;}}for(const _0x2180f6 of _0xa14eff){_0x1dafc5=[];try{const _0x5ac498=_0x4969ef[_0x23ebf3(0x1c0)](_0x2180f6[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)]),_0x4f8554=await agentDefToRequest(_0x2180f6['yaml'],_0x2180f6[_0x23ebf3(0x1fc)],_0x2180f6[_0x23ebf3(0x1d0)],_0x23718f);if(_0x5ac498)await this[_0x23ebf3(0x203)][_0x23ebf3(0x1dc)](_0x5ac498['id'],_0x4f8554),_0x3acc7d[_0x23ebf3(0x26f)](_0x2180f6[_0x23ebf3(0x28b)]['name'],_0x5ac498['id']),_0xd109b3[_0x23ebf3(0x1bc)][_0x23ebf3(0x277)]({'agentName':_0x2180f6['yaml'][_0x23ebf3(0x1da)],'action':'updated','agentId':_0x5ac498['id'],'warnings':_0x1dafc5['length']>0x0?_0x1dafc5:undefined}),_0xd109b3['counts'][_0x23ebf3(0x1bc)][_0x23ebf3(0x232)]++;else{const _0x39f40e=await this[_0x23ebf3(0x203)][_0x23ebf3(0x1d1)](_0x4f8554);_0x3acc7d[_0x23ebf3(0x26f)](_0x2180f6['yaml'][_0x23ebf3(0x1da)],_0x39f40e['id']),_0xd109b3[_0x23ebf3(0x1bc)]['push']({'agentName':_0x2180f6[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b),'agentId':_0x39f40e['id'],'warnings':_0x1dafc5[_0x23ebf3(0x189)]>0x0?_0x1dafc5:undefined}),_0xd109b3['counts'][_0x23ebf3(0x1bc)][_0x23ebf3(0x27b)]++;}}catch(_0x549d70){_0xd109b3['agents']['push']({'agentName':_0x2180f6[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x549d70[_0x23ebf3(0x1af)],'warnings':_0x1dafc5['length']>0x0?_0x1dafc5:undefined}),_0xd109b3[_0x23ebf3(0x1f6)]['agents'][_0x23ebf3(0x1a5)]++;}}for(const _0x11a7de of _0x2bd3f5){try{const _0x4ddbf4=_0x530c8c[_0x23ebf3(0x1c0)](_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)]),_0x2d6c5b=await yamlPromptToApi(_0x11a7de[_0x23ebf3(0x28b)],_0xe54f73,_0x23718f);if(!_0x2d6c5b){_0xd109b3[_0x23ebf3(0x25d)][_0x23ebf3(0x277)]({'name':_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x23ebf3(0x1ae)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25d)][_0x23ebf3(0x1a5)]++;continue;}if(_0x4ddbf4)await this[_0x23ebf3(0x203)][_0x23ebf3(0x1df)](_0x4ddbf4['id'],_0x2d6c5b),_0x51dea4['set'](_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],_0x4ddbf4['id']),_0xd109b3[_0x23ebf3(0x25d)][_0x23ebf3(0x277)]({'name':_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x4ddbf4['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25d)][_0x23ebf3(0x232)]++;else{const _0x7b5bd=await this[_0x23ebf3(0x203)][_0x23ebf3(0x256)](_0x2d6c5b);_0x51dea4[_0x23ebf3(0x26f)](_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],_0x7b5bd['id']),_0xd109b3[_0x23ebf3(0x25d)][_0x23ebf3(0x277)]({'name':_0x11a7de[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':'created','id':_0x7b5bd['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x25d)][_0x23ebf3(0x27b)]++;}}catch(_0x307cd6){_0xd109b3['prompts'][_0x23ebf3(0x277)]({'name':_0x11a7de['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x307cd6['message']}),_0xd109b3[_0x23ebf3(0x1f6)]['prompts'][_0x23ebf3(0x1a5)]++;}}for(const _0x330703 of _0x13d6c4){try{const _0x5f2086=_0x49e608[_0x23ebf3(0x1c0)](_0x330703[_0x23ebf3(0x28b)][_0x23ebf3(0x1b8)]),_0x196d87=await yamlIntegrationToApi(_0x330703[_0x23ebf3(0x28b)],_0xe54f73,_0x23718f);if(_0x5f2086){await this[_0x23ebf3(0x203)][_0x23ebf3(0x27a)](_0x5f2086['id']);const _0xed109f=await this['client'][_0x23ebf3(0x1a9)](_0x196d87);_0xd109b3[_0x23ebf3(0x180)][_0x23ebf3(0x277)]({'name':_0x330703['yaml'][_0x23ebf3(0x1b8)],'action':_0x23ebf3(0x232),'id':_0xed109f['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x180)][_0x23ebf3(0x232)]++;}else{const _0x3f2b2f=await this[_0x23ebf3(0x203)][_0x23ebf3(0x1a9)](_0x196d87);_0xd109b3[_0x23ebf3(0x180)][_0x23ebf3(0x277)]({'name':_0x330703[_0x23ebf3(0x28b)][_0x23ebf3(0x1b8)],'action':_0x23ebf3(0x27b),'id':_0x3f2b2f['id']}),_0xd109b3['counts'][_0x23ebf3(0x180)][_0x23ebf3(0x27b)]++;}}catch(_0x36abb1){_0xd109b3['integrations']['push']({'name':_0x330703['yaml'][_0x23ebf3(0x1b8)],'action':_0x23ebf3(0x1ba),'error':_0x36abb1['message']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x180)][_0x23ebf3(0x1a5)]++;}}for(const _0x410382 of _0x29f193){try{const _0x30d7fa=_0x4d167e[_0x23ebf3(0x1c0)](_0x410382[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)]),_0x1e4d46=await yamlFormInterfaceToApi(_0x410382[_0x23ebf3(0x28b)],_0xe54f73,_0x23718f);if(!_0x1e4d46){_0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x410382[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x23ebf3(0x26c)}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x194)][_0x23ebf3(0x1a5)]++;continue;}if(_0x30d7fa){const _0x182ad6=await this[_0x23ebf3(0x203)][_0x23ebf3(0x1d9)](_0x30d7fa['id'],_0x1e4d46);_0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x410382['yaml'][_0x23ebf3(0x1da)],'action':'updated','id':_0x182ad6['id']}),_0xd109b3['counts'][_0x23ebf3(0x194)]['updated']++;}else{const _0x17ddf1=await this['client'][_0x23ebf3(0x1a3)](_0x1e4d46);_0xd109b3[_0x23ebf3(0x194)][_0x23ebf3(0x277)]({'name':_0x410382['yaml']['name'],'action':_0x23ebf3(0x27b),'id':_0x17ddf1['id']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x194)]['created']++;}}catch(_0x3aa51f){_0xd109b3['formInterfaces'][_0x23ebf3(0x277)]({'name':_0x410382[_0x23ebf3(0x28b)]['name'],'action':'error','error':_0x3aa51f['message']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x194)][_0x23ebf3(0x1a5)]++;}}for(const _0x3fe349 of _0x108c54){try{const _0xf2146c=_0x226e44[_0x23ebf3(0x1c0)](_0x3fe349[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)]),_0x49dc8f=await yamlChatInterfaceToApi(_0x3fe349['yaml'],_0xe54f73,_0x23718f);if(_0xf2146c){const _0x3da358=await this['client']['updateChatInterface'](_0xf2146c['id'],_0x49dc8f);_0xd109b3['chatInterfaces'][_0x23ebf3(0x277)]({'name':_0x3fe349[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x232),'id':_0x3da358['id']}),_0xd109b3['counts']['chatInterfaces']['updated']++;}else{const _0x3a5a89=await this[_0x23ebf3(0x203)][_0x23ebf3(0x24a)](_0x49dc8f);_0xd109b3[_0x23ebf3(0x266)]['push']({'name':_0x3fe349[_0x23ebf3(0x28b)][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x27b),'id':_0x3a5a89['id']}),_0xd109b3[_0x23ebf3(0x1f6)]['chatInterfaces'][_0x23ebf3(0x27b)]++;}}catch(_0x1b1d91){_0xd109b3[_0x23ebf3(0x266)][_0x23ebf3(0x277)]({'name':_0x3fe349['yaml'][_0x23ebf3(0x1da)],'action':_0x23ebf3(0x1ba),'error':_0x1b1d91['message']}),_0xd109b3[_0x23ebf3(0x1f6)][_0x23ebf3(0x266)][_0x23ebf3(0x1a5)]++;}}return _0xd109b3;}async['pullAgent'](_0x37cf9f,_0x16004f,_0x4aea3a,_0x8b8500){const _0xe2c72b=a134_0x1280fc,{projectId:_0x2e2a22,project:_0x44472a}=await this['resolveProjectName'](_0x37cf9f),_0x268df7=_0x44472a['attributes'][_0xe2c72b(0x1da)],_0x322e93=await this[_0xe2c72b(0x203)][_0xe2c72b(0x1e1)](_0x2e2a22),_0x34e1e3=_0x322e93[_0xe2c72b(0x1ef)](_0x144997=>_0x144997['attributes'][_0xe2c72b(0x1da)]===_0x16004f);if(!_0x34e1e3)throw new SDKError(ErrorCode[_0xe2c72b(0x1a0)],'Agent\x20not\x20found:\x20'+_0x16004f,undefined,{'helpText':_0xe2c72b(0x222)+_0x322e93[_0xe2c72b(0x1ca)](_0x254989=>_0x254989[_0xe2c72b(0x193)][_0xe2c72b(0x1da)])[_0xe2c72b(0x271)](',\x20')});let _0x581fa1;if(_0x4aea3a)_0x581fa1=_0x4aea3a;else{const _0x5d86f7=a134_0xb4a0ec[_0xe2c72b(0x271)](process['cwd'](),_0xe2c72b(0x1bc)),_0x54fc3c=getSanitizedPathWithMigration(_0x5d86f7,_0x268df7);_0x54fc3c[_0xe2c72b(0x234)]&&this[_0xe2c72b(0x1b4)][_0xe2c72b(0x183)](_0xe2c72b(0x276)+a134_0xb4a0ec['basename'](_0x54fc3c[_0xe2c72b(0x254)])+_0xe2c72b(0x28d)+a134_0xb4a0ec[_0xe2c72b(0x23c)](_0x54fc3c['path'])),_0x581fa1=_0x54fc3c['path'];}const _0xb1dcf4=getSanitizedPathWithMigration(_0x581fa1,_0x16004f);_0xb1dcf4['renamed']&&this[_0xe2c72b(0x1b4)]['info'](_0xe2c72b(0x1a1)+a134_0xb4a0ec[_0xe2c72b(0x23c)](_0xb1dcf4[_0xe2c72b(0x254)])+'\x20→\x20'+a134_0xb4a0ec[_0xe2c72b(0x23c)](_0xb1dcf4[_0xe2c72b(0x19a)]));const _0x1662e7=_0xb1dcf4['path'],_0x5d2631=new Map(),_0x4bdff1=new Map(),_0x1560eb=await this[_0xe2c72b(0x203)][_0xe2c72b(0x247)](_0x2e2a22),_0x4f0d46=await this[_0xe2c72b(0x203)]['listTextKnowledgeBases'](_0x2e2a22),_0x400e60=await safeListOrEmpty(()=>this['client']['listExperimentalKnowledgeBases'](_0x2e2a22)),_0xe50afc=new Map(),_0x5eb2d3=new Map();for(const _0x239418 of _0x1560eb){_0x5d2631[_0xe2c72b(0x26f)](_0x239418['id'],_0x239418[_0xe2c72b(0x193)]['name']);}for(const _0x36ed46 of _0x4f0d46){_0xe50afc[_0xe2c72b(0x26f)](_0x36ed46['id'],_0x36ed46[_0xe2c72b(0x193)][_0xe2c72b(0x1da)]);}for(const _0x21b599 of _0x400e60){_0x5eb2d3['set'](_0x21b599['id'],_0x21b599['attributes'][_0xe2c72b(0x1da)]);}for(const _0x495719 of _0x322e93){_0x4bdff1[_0xe2c72b(0x26f)](_0x495719['id'],_0x495719['attributes'][_0xe2c72b(0x1da)]);}const _0xdccfcb={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x5d2631,'TextKnowledgeBase':_0xe50afc,'Agent':_0x4bdff1,'ExperimentalKnowledgeBase':_0x5eb2d3}),'resolvePromptName':async()=>undefined,'onWarning':_0x1c2132=>this[_0xe2c72b(0x1b4)]['warn'](_0x1c2132)},_0x39813b=a134_0xb4a0ec[_0xe2c72b(0x271)](_0x1662e7,_0xe2c72b(0x214)),_0x5afb5b=a134_0xb4a0ec[_0xe2c72b(0x271)](_0x1662e7,'agent.yml'),_0x237ad2=a134_0xb4a0ec[_0xe2c72b(0x271)](_0x1662e7,_0xe2c72b(0x22f)),_0x49d000=!a134_0x4f3caa['existsSync'](_0x5afb5b);if(_0x8b8500?.[_0xe2c72b(0x248)])return{'agentName':_0x16004f,'outputPath':_0x1662e7,'isNew':_0x49d000,'hasChanges':!![]};a134_0x4f3caa[_0xe2c72b(0x20f)](_0x581fa1,{'recursive':!![]}),a134_0x4f3caa[_0xe2c72b(0x20f)](_0x1662e7,{'recursive':!![]});const _0x31d8a3=a134_0xb4a0ec[_0xe2c72b(0x271)](_0x581fa1,'tdx.json');!a134_0x4f3caa[_0xe2c72b(0x273)](_0x31d8a3)&&a134_0x4f3caa[_0xe2c72b(0x188)](_0x31d8a3,createAgentConfigContent(_0x37cf9f));const {yaml:_0x245659,systemPrompt:_0x392c4b,starterMessage:_0x520eef}=await agentResponseToDef(_0x34e1e3,_0xdccfcb);let _0xfe9587=_0x49d000;if(!_0x49d000){const _0x514cb3=a134_0x4f3caa[_0xe2c72b(0x273)](_0x39813b)?a134_0x4f3caa[_0xe2c72b(0x186)](_0x39813b,_0xe2c72b(0x1a7)):'',_0x273645=a134_0x4f3caa[_0xe2c72b(0x186)](_0x5afb5b,'utf-8');_0xfe9587=_0x514cb3!==_0x392c4b||_0x273645!==toAgentYamlString(_0x245659);}a134_0x4f3caa['writeFileSync'](_0x39813b,_0x392c4b),a134_0x4f3caa[_0xe2c72b(0x188)](_0x5afb5b,toAgentYamlString(_0x245659));if(_0x520eef&&_0x520eef[_0xe2c72b(0x20c)]('\x0a'))a134_0x4f3caa['writeFileSync'](_0x237ad2,_0x520eef);else a134_0x4f3caa[_0xe2c72b(0x273)](_0x237ad2)&&a134_0x4f3caa[_0xe2c72b(0x231)](_0x237ad2);return{'agentName':_0x16004f,'outputPath':_0x1662e7,'isNew':_0x49d000,'hasChanges':_0xfe9587};}async[a134_0x1280fc(0x182)](_0x10601e,_0xc3c24){const _0x37e604=a134_0x1280fc;let _0x3c3779;isAgentYamlPath(_0x10601e)?_0x3c3779=getAgentDirFromYamlPath(_0x10601e):_0x3c3779=_0x10601e;const {config:_0x9348ae}=findAgentConfig(_0x3c3779),_0x57236d=await this[_0x37e604(0x1ea)](_0x9348ae[_0x37e604(0x280)]),_0x43284e=a134_0xb4a0ec['join'](_0x3c3779,'agent.yml'),_0x4b1dda=a134_0xb4a0ec[_0x37e604(0x271)](_0x3c3779,_0x37e604(0x214)),_0x2b94e4=a134_0xb4a0ec['join'](_0x3c3779,'starter_message.md');if(!a134_0x4f3caa[_0x37e604(0x273)](_0x43284e))throw new SDKError(ErrorCode['NOT_FOUND'],'agent.yml\x20not\x20found\x20in\x20'+_0x3c3779,undefined,{'helpText':_0x37e604(0x221)});const _0x3097ea=parseAgentYaml(a134_0x4f3caa[_0x37e604(0x186)](_0x43284e,_0x37e604(0x1a7)),_0x43284e),_0x1cc1e0=a134_0x4f3caa[_0x37e604(0x273)](_0x4b1dda)?a134_0x4f3caa[_0x37e604(0x186)](_0x4b1dda,_0x37e604(0x1a7)):'',_0xe98055=a134_0x4f3caa[_0x37e604(0x273)](_0x2b94e4)?a134_0x4f3caa[_0x37e604(0x186)](_0x2b94e4,_0x37e604(0x1a7)):_0x3097ea[_0x37e604(0x1ec)];if(_0xc3c24?.[_0x37e604(0x248)])return{'agentName':_0x3097ea[_0x37e604(0x1da)],'action':_0x37e604(0x27b),'projectId':_0x57236d};const _0x4fa599=await this[_0x37e604(0x203)][_0x37e604(0x1e1)](_0x57236d),_0x4d302a=await fetchAllToolTargetMaps((_0x1a4f71,_0x114816)=>this[_0x37e604(0x203)][_0x37e604(0x24c)](_0x1a4f71,_0x114816),_0x57236d),_0x373bb5=new Map();for(const _0x18fd93 of _0x4fa599){_0x373bb5[_0x37e604(0x26f)](_0x18fd93['attributes']['name'],_0x18fd93['id']);}const _0x1b56fd=[],_0x1db545={'projectId':_0x57236d,'resolveToolTargetId':buildIdResolver({..._0x4d302a['nameToId'],'Agent':_0x373bb5}),'resolvePromptId':async()=>undefined,'onWarning':_0x1808bf=>{const _0x55e331=_0x37e604;this['logger'][_0x55e331(0x1eb)](_0x1808bf),_0x1b56fd[_0x55e331(0x277)](_0x1808bf);}};try{const _0x2e60b8=_0x4fa599[_0x37e604(0x1ef)](_0x3ea2f7=>_0x3ea2f7[_0x37e604(0x193)][_0x37e604(0x1da)]===_0x3097ea[_0x37e604(0x1da)]),_0x189f70=await agentDefToRequest(_0x3097ea,_0x1cc1e0,_0xe98055,_0x1db545);if(_0x2e60b8)return await this['client'][_0x37e604(0x1dc)](_0x2e60b8['id'],_0x189f70),{'agentName':_0x3097ea[_0x37e604(0x1da)],'action':_0x37e604(0x232),'projectId':_0x57236d,'agentId':_0x2e60b8['id'],'warnings':_0x1b56fd[_0x37e604(0x189)]>0x0?_0x1b56fd:undefined};else{const _0x15d1b2=await this['client'][_0x37e604(0x1d1)](_0x189f70);return{'agentName':_0x3097ea[_0x37e604(0x1da)],'action':_0x37e604(0x27b),'projectId':_0x57236d,'agentId':_0x15d1b2['id'],'warnings':_0x1b56fd['length']>0x0?_0x1b56fd:undefined};}}catch(_0x2e1611){return{'agentName':_0x3097ea['name'],'action':_0x37e604(0x1ba),'projectId':_0x57236d,'error':_0x2e1611[_0x37e604(0x1af)],'warnings':_0x1b56fd[_0x37e604(0x189)]>0x0?_0x1b56fd:undefined};}}async[a134_0x1280fc(0x1b9)](_0x39af0f,_0x41565c,_0x1e875e){const _0x347fc7=a134_0x1280fc,_0x890f50=a134_0x4f3caa['existsSync'](_0x39af0f)&&a134_0x4f3caa['existsSync'](a134_0xb4a0ec[_0x347fc7(0x271)](_0x39af0f,_0x347fc7(0x1f8)));let _0x4ebeb8;const _0x9cd1b=[],_0x5db401=[],_0x2cec3b=[],_0x19013c=[],_0x4e691a=[],_0x1a3e3b=[],_0x42c6c2=[],_0x358682=[],_0x52b041=[];if(_0x890f50){const _0x26b076=loadAgentConfig(a134_0xb4a0ec[_0x347fc7(0x271)](_0x39af0f,_0x347fc7(0x1f8)));_0x4ebeb8=_0x26b076[_0x347fc7(0x280)];const _0x45d470=a134_0x4f3caa['readdirSync'](_0x39af0f,{'withFileTypes':!![]});for(const _0x9feb2d of _0x45d470){if(!_0x9feb2d['isDirectory']())continue;if(['knowledge_bases',_0x347fc7(0x283),'experimental_artifacts',_0x347fc7(0x25d),_0x347fc7(0x180),_0x347fc7(0x223),_0x347fc7(0x1c1)]['includes'](_0x9feb2d[_0x347fc7(0x1da)]))continue;const _0x75b221=a134_0xb4a0ec[_0x347fc7(0x271)](_0x39af0f,_0x9feb2d[_0x347fc7(0x1da)]);if(isAgentDir(_0x75b221)){const _0x3d94ad=a134_0xb4a0ec[_0x347fc7(0x271)](_0x75b221,'agent.yml'),_0x50a95c=a134_0xb4a0ec[_0x347fc7(0x271)](_0x75b221,_0x347fc7(0x214)),_0x43a50c=a134_0xb4a0ec[_0x347fc7(0x271)](_0x75b221,_0x347fc7(0x22f)),_0x114c8f=parseAgentYaml(a134_0x4f3caa['readFileSync'](_0x3d94ad,'utf-8'),_0x3d94ad),_0x47f93d=a134_0x4f3caa[_0x347fc7(0x273)](_0x50a95c)?a134_0x4f3caa[_0x347fc7(0x186)](_0x50a95c,'utf-8'):'',_0x498299=a134_0x4f3caa[_0x347fc7(0x273)](_0x43a50c)?a134_0x4f3caa[_0x347fc7(0x186)](_0x43a50c,'utf-8'):_0x114c8f[_0x347fc7(0x1ec)];_0x9cd1b['push']({'name':_0x114c8f['name'],'dir':_0x75b221,'yaml':_0x114c8f,'systemPrompt':_0x47f93d,'starterMessage':_0x498299});}}const _0x19d19b=getKnowledgeBasesDir(_0x39af0f);if(a134_0x4f3caa[_0x347fc7(0x273)](_0x19d19b)){const _0x9b615c=a134_0x4f3caa[_0x347fc7(0x249)](_0x19d19b);for(const _0x595790 of _0x9b615c){const _0x18893b=a134_0xb4a0ec['join'](_0x19d19b,_0x595790);if(_0x595790['endsWith'](_0x347fc7(0x1c7))){const _0x4d1a75=parseKnowledgeBaseYaml(a134_0x4f3caa['readFileSync'](_0x18893b,_0x347fc7(0x1a7)),_0x18893b);_0x5db401['push']({'name':_0x4d1a75[_0x347fc7(0x1da)],'path':_0x18893b,'yaml':_0x4d1a75});}else{if(_0x595790[_0x347fc7(0x1e6)](_0x347fc7(0x1e9))){const _0x5da31f=a134_0x4f3caa['readFileSync'](_0x18893b,'utf-8'),{name:_0x481086,text:_0xe73e23}=parseTextKnowledgeBaseMd(_0x5da31f,_0x595790);_0x2cec3b[_0x347fc7(0x277)]({'name':_0x481086,'path':_0x18893b,'text':_0xe73e23});}}}}const _0x247afe=getPromptsDir(_0x39af0f);if(a134_0x4f3caa['existsSync'](_0x247afe)){const _0x433c79=a134_0x4f3caa[_0x347fc7(0x249)](_0x247afe)[_0x347fc7(0x18a)](_0x54da1b=>_0x54da1b[_0x347fc7(0x1e6)](_0x347fc7(0x1c7)));for(const _0x4b1450 of _0x433c79){const _0xc39a80=a134_0xb4a0ec['join'](_0x247afe,_0x4b1450),_0x202938=parsePromptYaml(a134_0x4f3caa[_0x347fc7(0x186)](_0xc39a80,_0x347fc7(0x1a7)),_0xc39a80);_0x19013c[_0x347fc7(0x277)]({'name':_0x202938[_0x347fc7(0x1da)],'path':_0xc39a80,'yaml':_0x202938});}}const _0x48f6a0=getIntegrationsDir(_0x39af0f);if(a134_0x4f3caa[_0x347fc7(0x273)](_0x48f6a0)){const _0x2ddffb=a134_0x4f3caa[_0x347fc7(0x249)](_0x48f6a0)[_0x347fc7(0x18a)](_0x218eb5=>_0x218eb5['endsWith'](_0x347fc7(0x1c7)));for(const _0x26f5d1 of _0x2ddffb){const _0x5a5838=a134_0xb4a0ec['join'](_0x48f6a0,_0x26f5d1),_0x409c63=parseIntegrationYaml(a134_0x4f3caa['readFileSync'](_0x5a5838,'utf-8'),_0x5a5838);SAFE_INTEGRATION_TYPES[_0x347fc7(0x20c)](_0x409c63[_0x347fc7(0x1b8)][_0x347fc7(0x23b)]())?_0x4e691a[_0x347fc7(0x277)]({'name':_0x409c63[_0x347fc7(0x1da)],'path':_0x5a5838,'yaml':_0x409c63}):this[_0x347fc7(0x1b4)][_0x347fc7(0x1eb)](_0x347fc7(0x209)+_0x409c63[_0x347fc7(0x1da)]+_0x347fc7(0x21d)+_0x409c63[_0x347fc7(0x1b8)]+_0x347fc7(0x1d5)+(_0x347fc7(0x1e0)+SAFE_INTEGRATION_TYPES[_0x347fc7(0x271)](',\x20')+_0x347fc7(0x23d)));}}const _0x35271d=getExperimentalKnowledgeBasesDir(_0x39af0f);if(a134_0x4f3caa[_0x347fc7(0x273)](_0x35271d)){const _0x4187ab=a134_0x4f3caa[_0x347fc7(0x249)](_0x35271d,{'withFileTypes':!![]});for(const _0x4c4ea1 of _0x4187ab){if(!_0x4c4ea1[_0x347fc7(0x27e)]())continue;const _0x480439=a134_0xb4a0ec['join'](_0x35271d,_0x4c4ea1[_0x347fc7(0x1da)]),_0x21caf3=a134_0xb4a0ec[_0x347fc7(0x271)](_0x480439,_0x4c4ea1[_0x347fc7(0x1da)]+_0x347fc7(0x1c7));if(a134_0x4f3caa[_0x347fc7(0x273)](_0x21caf3)){const _0x51334b=parseExperimentalKnowledgeBaseYaml(a134_0x4f3caa[_0x347fc7(0x186)](_0x21caf3,_0x347fc7(0x1a7)),_0x21caf3),_0x1fb73=a134_0xb4a0ec[_0x347fc7(0x271)](_0x480439,'functions'),_0x19806e=[];if(a134_0x4f3caa[_0x347fc7(0x273)](_0x1fb73)){const _0x2a03d3=a134_0x4f3caa[_0x347fc7(0x249)](_0x1fb73,{'withFileTypes':!![]});for(const _0x1509cb of _0x2a03d3){if(!_0x1509cb[_0x347fc7(0x27e)]())continue;const _0x58e583=a134_0xb4a0ec[_0x347fc7(0x271)](_0x1fb73,_0x1509cb['name']),_0x9d8323=a134_0xb4a0ec[_0x347fc7(0x271)](_0x58e583,'code.js'),_0x4fff1e=a134_0xb4a0ec[_0x347fc7(0x271)](_0x58e583,_0x347fc7(0x1c8));if(a134_0x4f3caa[_0x347fc7(0x273)](_0x9d8323)&&a134_0x4f3caa[_0x347fc7(0x273)](_0x4fff1e)){const _0x7a3302=a134_0x4f3caa[_0x347fc7(0x186)](_0x9d8323,_0x347fc7(0x1a7)),_0x4643f6=a134_0x4f3caa[_0x347fc7(0x186)](_0x4fff1e,_0x347fc7(0x1a7));_0x19806e[_0x347fc7(0x277)]({'name':_0x1509cb[_0x347fc7(0x1da)],'code':_0x7a3302,'json_schema':_0x4643f6});}}}const _0x57c463={..._0x51334b,'functions':_0x19806e};_0x1a3e3b[_0x347fc7(0x277)]({'name':_0x51334b[_0x347fc7(0x1da)],'path':_0x480439,'def':_0x57c463});}}}const _0xcd2d54=getExperimentalArtifactsDir(_0x39af0f);if(a134_0x4f3caa[_0x347fc7(0x273)](_0xcd2d54)){const _0xd81fcc=a134_0x4f3caa[_0x347fc7(0x249)](_0xcd2d54,{'withFileTypes':!![]});for(const _0x3eefd9 of _0xd81fcc){if(!_0x3eefd9['isDirectory']())continue;const _0x4fed3b=a134_0xb4a0ec['join'](_0xcd2d54,_0x3eefd9[_0x347fc7(0x1da)]),_0x41d49b=a134_0xb4a0ec['join'](_0x4fed3b,_0x3eefd9['name']+'.yml');if(a134_0x4f3caa[_0x347fc7(0x273)](_0x41d49b)){const _0x4291d2=parseExperimentalArtifactYaml(a134_0x4f3caa[_0x347fc7(0x186)](_0x41d49b,'utf-8'),_0x41d49b),_0x551f8f=a134_0xb4a0ec[_0x347fc7(0x271)](_0x4fed3b,_0x347fc7(0x212)),_0x31676a=a134_0x4f3caa['existsSync'](_0x551f8f)?a134_0x4f3caa[_0x347fc7(0x186)](_0x551f8f,_0x347fc7(0x1a7)):'',_0x821505=a134_0xb4a0ec[_0x347fc7(0x271)](_0x4fed3b,'files'),_0x459076=[];if(a134_0x4f3caa[_0x347fc7(0x273)](_0x821505)){const _0x38f092=a134_0x4f3caa[_0x347fc7(0x249)](_0x821505);for(const _0x49eefe of _0x38f092){const _0x35ba8a=a134_0xb4a0ec['join'](_0x821505,_0x49eefe);if(a134_0x4f3caa[_0x347fc7(0x268)](_0x35ba8a)[_0x347fc7(0x205)]()){const _0x25e1b0=a134_0x4f3caa[_0x347fc7(0x186)](_0x35ba8a,_0x347fc7(0x1a7));_0x459076[_0x347fc7(0x277)]({'file_name':_0x49eefe,'text_content':_0x25e1b0});}}}const _0x26a6e1={..._0x4291d2,'code':_0x31676a,'files':_0x459076};_0x42c6c2[_0x347fc7(0x277)]({'name':_0x4291d2[_0x347fc7(0x1da)],'path':_0x4fed3b,'def':_0x26a6e1});}}}const _0x4f17ca=getFormInterfacesDir(_0x39af0f);if(a134_0x4f3caa[_0x347fc7(0x273)](_0x4f17ca)){const _0x8ea91c=a134_0x4f3caa[_0x347fc7(0x249)](_0x4f17ca)[_0x347fc7(0x18a)](_0x1fc08f=>_0x1fc08f[_0x347fc7(0x1e6)](_0x347fc7(0x1c7)));for(const _0x296a79 of _0x8ea91c){const _0xaa7362=a134_0xb4a0ec[_0x347fc7(0x271)](_0x4f17ca,_0x296a79),_0x4dca4c=parseFormInterfaceYaml(a134_0x4f3caa[_0x347fc7(0x186)](_0xaa7362,'utf-8'),_0xaa7362);_0x358682[_0x347fc7(0x277)]({'name':_0x4dca4c[_0x347fc7(0x1da)],'path':_0xaa7362,'yaml':_0x4dca4c});}}const _0x15ad82=getChatInterfacesDir(_0x39af0f);if(a134_0x4f3caa['existsSync'](_0x15ad82)){const _0x44fbc9=a134_0x4f3caa[_0x347fc7(0x249)](_0x15ad82)['filter'](_0x18001c=>_0x18001c[_0x347fc7(0x1e6)](_0x347fc7(0x1c7)));for(const _0x5e8f62 of _0x44fbc9){const _0x3ae5e2=a134_0xb4a0ec[_0x347fc7(0x271)](_0x15ad82,_0x5e8f62),_0x15dff0=parseChatInterfaceYaml(a134_0x4f3caa[_0x347fc7(0x186)](_0x3ae5e2,'utf-8'),_0x3ae5e2);_0x52b041['push']({'name':_0x15dff0['name'],'path':_0x3ae5e2,'yaml':_0x15dff0});}}}else{const _0x5c4a0c=await this[_0x347fc7(0x1ea)](_0x39af0f),_0x53179a=await this['client'][_0x347fc7(0x1f0)](_0x5c4a0c);_0x4ebeb8=_0x53179a['attributes'][_0x347fc7(0x1da)];const _0x4359dc=await this[_0x347fc7(0x203)]['listAgentsFull'](_0x5c4a0c),_0x4f32ab=await this[_0x347fc7(0x203)][_0x347fc7(0x247)](_0x5c4a0c),_0xfebee6=await this[_0x347fc7(0x203)][_0x347fc7(0x190)](_0x5c4a0c),_0xd188aa=await this[_0x347fc7(0x203)][_0x347fc7(0x18b)](_0x5c4a0c),_0x242099=await this[_0x347fc7(0x203)][_0x347fc7(0x1db)](_0x5c4a0c),_0x5cd944=await safeListOrEmpty(()=>this[_0x347fc7(0x203)]['listExperimentalKnowledgeBases'](_0x5c4a0c)),_0x4c5c4c=await safeListOrEmpty(()=>this['client']['listExperimentalArtifacts'](_0x5c4a0c)),_0x188ea2=new Map(),_0xe21d3=new Map(),_0x229bba=new Map(),_0x50b9c1=new Map(),_0x463b64=new Map(),_0x135855=new Map();for(const _0x5a07df of _0x4f32ab){_0x188ea2['set'](_0x5a07df['id'],_0x5a07df[_0x347fc7(0x193)]['name']);}for(const _0x420476 of _0xfebee6){_0xe21d3[_0x347fc7(0x26f)](_0x420476['id'],_0x420476[_0x347fc7(0x193)]['name']);}for(const _0x324f91 of _0x4359dc){_0x229bba[_0x347fc7(0x26f)](_0x324f91['id'],_0x324f91[_0x347fc7(0x193)][_0x347fc7(0x1da)]);}for(const _0x4a4f6b of _0xd188aa){_0x50b9c1[_0x347fc7(0x26f)](_0x4a4f6b['id'],_0x4a4f6b[_0x347fc7(0x193)][_0x347fc7(0x1da)]);}for(const _0x3043c8 of _0x5cd944){_0x463b64[_0x347fc7(0x26f)](_0x3043c8['id'],_0x3043c8['attributes']['name']);}for(const _0x3dbc68 of _0x4c5c4c){_0x135855[_0x347fc7(0x26f)](_0x3dbc68['id'],_0x3dbc68['attributes'][_0x347fc7(0x1da)]);}const _0x2854d3={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x188ea2,'TextKnowledgeBase':_0xe21d3,'Agent':_0x229bba,'ExperimentalKnowledgeBase':_0x463b64}),'resolvePromptName':async _0x3fb5c6=>_0x50b9c1[_0x347fc7(0x1c0)](_0x3fb5c6),'onWarning':_0x5e8bdd=>this[_0x347fc7(0x1b4)][_0x347fc7(0x1eb)](_0x5e8bdd)};for(const _0x625917 of _0x4359dc){const _0x43c0e7=await agentResponseToDef(_0x625917,_0x2854d3),{yaml:_0x261161,systemPrompt:_0x1956c9,starterMessage:_0x3853c1}=_0x43c0e7;_0x9cd1b['push']({'name':_0x261161[_0x347fc7(0x1da)],'dir':'','yaml':_0x261161,'systemPrompt':_0x1956c9,'starterMessage':_0x3853c1});}for(const _0x3ebdba of _0x4f32ab){const _0x535d41=apiKnowledgeBaseToYaml(_0x3ebdba);_0x5db401[_0x347fc7(0x277)]({'name':_0x535d41[_0x347fc7(0x1da)],'path':'','yaml':_0x535d41});}for(const _0x54c450 of _0xfebee6){_0x2cec3b[_0x347fc7(0x277)]({'name':_0x54c450[_0x347fc7(0x193)][_0x347fc7(0x1da)],'path':'','text':_0x54c450['attributes'][_0x347fc7(0x230)]});}for(const _0x12f5e8 of _0xd188aa){const _0x38aef1=await apiPromptToYaml(_0x12f5e8,_0x2854d3);_0x38aef1&&_0x19013c[_0x347fc7(0x277)]({'name':_0x38aef1[_0x347fc7(0x1da)],'path':'','yaml':_0x38aef1});}for(const _0x387f51 of _0x242099){if(!_0x387f51[_0x347fc7(0x193)][_0x347fc7(0x1c4)]&&SAFE_INTEGRATION_TYPES['includes'](_0x387f51[_0x347fc7(0x193)][_0x347fc7(0x28f)][_0x347fc7(0x23b)]())){const _0x16ee09=await apiIntegrationToYaml(_0x387f51,_0x2854d3);_0x4e691a['push']({'name':_0x387f51[_0x347fc7(0x193)][_0x347fc7(0x28f)][_0x347fc7(0x23b)](),'path':'','yaml':_0x16ee09});}}for(const _0x3f05af of _0x5cd944){const _0x5b32b7=apiExperimentalKnowledgeBaseToYaml(_0x3f05af);_0x1a3e3b['push']({'name':_0x5b32b7[_0x347fc7(0x1da)],'path':'','def':_0x5b32b7});}for(const _0xf7c544 of _0x4c5c4c){const _0x350e4c=apiExperimentalArtifactToYaml(_0xf7c544);_0x42c6c2[_0x347fc7(0x277)]({'name':_0x350e4c[_0x347fc7(0x1da)],'path':'','def':_0x350e4c});}const _0x365c37=await safeListOrEmpty(()=>this[_0x347fc7(0x203)][_0x347fc7(0x22a)](_0x5c4a0c));for(const _0x292711 of _0x365c37){const _0x5daace=await apiFormInterfaceToYaml(_0x292711,_0x2854d3);_0x358682[_0x347fc7(0x277)]({'name':_0x5daace[_0x347fc7(0x1da)],'path':'','yaml':_0x5daace});}const _0x509c19=await safeListOrEmpty(()=>this[_0x347fc7(0x203)][_0x347fc7(0x1bb)](_0x5c4a0c));for(const _0x35ba40 of _0x509c19){if(_0x35ba40['attributes']['isManaged'])continue;const _0x6326d2=await apiChatInterfaceToYaml(_0x35ba40,_0x2854d3);_0x52b041[_0x347fc7(0x277)]({'name':_0x6326d2[_0x347fc7(0x1da)],'path':'','yaml':_0x6326d2});}}const _0x8b72ab={'sourceProjectName':_0x4ebeb8,'newProjectName':_0x41565c,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'imageGenerators':{'created':0x0,'errors':0x0},'webSearchTools':{'created':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'errors':0x0}}},_0x130ea1=await this['client'][_0x347fc7(0x1b2)](),_0x55df98=_0x130ea1[_0x347fc7(0x1ef)](_0x26cfd3=>_0x26cfd3[_0x347fc7(0x193)]['name']===_0x41565c);if(_0x55df98)throw new SDKError(ErrorCode[_0x347fc7(0x250)],_0x347fc7(0x1d3)+_0x41565c+'\x22\x20already\x20exists',undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x1e875e?.[_0x347fc7(0x248)])return _0x8b72ab['counts']['agents'][_0x347fc7(0x27b)]=_0x9cd1b[_0x347fc7(0x189)],_0x8b72ab['counts']['knowledgeBases'][_0x347fc7(0x27b)]=_0x5db401['length'],_0x8b72ab[_0x347fc7(0x1f6)]['textKnowledgeBases']['created']=_0x2cec3b[_0x347fc7(0x189)],_0x8b72ab[_0x347fc7(0x1f6)]['experimentalKnowledgeBases'][_0x347fc7(0x27b)]=_0x1a3e3b[_0x347fc7(0x189)],_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x20a)][_0x347fc7(0x27b)]=_0x42c6c2[_0x347fc7(0x189)],_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x25d)]['created']=_0x19013c[_0x347fc7(0x189)],_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x180)][_0x347fc7(0x27b)]=_0x4e691a['length'],_0x8b72ab;const _0x776bc4=await this[_0x347fc7(0x203)][_0x347fc7(0x1f7)]({'name':_0x41565c}),_0x49ac2a=_0x776bc4['id'];_0x8b72ab[_0x347fc7(0x1a6)]=_0x49ac2a;const _0x3aabec=new Map(),_0x1fe7b8=new Map(),_0x1bad79=new Map(),_0x12b430=new Map(),_0x1b9391=new Map(),_0x1c9acc=new Map(),_0x3faaf5=new Map(),_0x62f5c7=new Map(),_0x5af7ec=new Set(),_0x139e67=new Set();for(const _0x5aa219 of _0x9cd1b){for(const _0x574313 of _0x5aa219['yaml'][_0x347fc7(0x17e)]||[]){if(_0x574313[_0x347fc7(0x216)]===_0x347fc7(0x225)&&_0x574313[_0x347fc7(0x1d7)]){const _0x211020=parseRef(_0x574313[_0x347fc7(0x1d7)]);if(_0x211020)_0x5af7ec[_0x347fc7(0x246)](_0x211020[_0x347fc7(0x1da)]);}else{if(_0x574313[_0x347fc7(0x216)]===_0x347fc7(0x19f)&&_0x574313['target']){const _0x378066=parseRef(_0x574313[_0x347fc7(0x1d7)]);if(_0x378066)_0x139e67[_0x347fc7(0x246)](_0x378066[_0x347fc7(0x1da)]);}}}}for(const _0x5dcd6c of _0x5af7ec){try{const _0x5c7e26=await this[_0x347fc7(0x203)][_0x347fc7(0x269)]({'projectId':_0x49ac2a,'name':_0x5dcd6c});_0x1b9391[_0x347fc7(0x26f)](_0x5dcd6c,_0x5c7e26['id']),_0x8b72ab[_0x347fc7(0x245)][_0x347fc7(0x277)]({'name':_0x5dcd6c,'action':_0x347fc7(0x27b),'id':_0x5c7e26['id']}),_0x8b72ab[_0x347fc7(0x1f6)]['imageGenerators'][_0x347fc7(0x27b)]++;}catch(_0xfd41d7){_0x8b72ab['imageGenerators'][_0x347fc7(0x277)]({'name':_0x5dcd6c,'action':_0x347fc7(0x1ba),'error':_0xfd41d7[_0x347fc7(0x1af)]}),_0x8b72ab[_0x347fc7(0x1f6)]['imageGenerators'][_0x347fc7(0x1a5)]++;}}for(const _0x2c8a9f of _0x139e67){try{const _0x14d8d8=await this[_0x347fc7(0x203)][_0x347fc7(0x238)]({'projectId':_0x49ac2a,'name':_0x2c8a9f});_0x1c9acc[_0x347fc7(0x26f)](_0x2c8a9f,_0x14d8d8['id']),_0x8b72ab[_0x347fc7(0x220)][_0x347fc7(0x277)]({'name':_0x2c8a9f,'action':_0x347fc7(0x27b),'id':_0x14d8d8['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x220)][_0x347fc7(0x27b)]++;}catch(_0x3a3c52){_0x8b72ab[_0x347fc7(0x220)][_0x347fc7(0x277)]({'name':_0x2c8a9f,'action':_0x347fc7(0x1ba),'error':_0x3a3c52[_0x347fc7(0x1af)]}),_0x8b72ab['counts'][_0x347fc7(0x220)][_0x347fc7(0x1a5)]++;}}const _0x113577=await fetchAllToolTargetMaps((_0xa56550,_0x15827a)=>this[_0x347fc7(0x203)][_0x347fc7(0x24c)](_0xa56550,_0x15827a),_0x49ac2a);let _0x373869=[];const _0x4d31ba={'projectId':_0x49ac2a,'resolveToolTargetId':buildIdResolver({..._0x113577[_0x347fc7(0x288)],'KnowledgeBase':_0x3aabec,'TextKnowledgeBase':_0x1fe7b8,'ExperimentalKnowledgeBase':_0x3faaf5,'Agent':_0x1bad79,'WebSearchTool':_0x1c9acc,'ImageGenerator':_0x1b9391}),'resolvePromptId':async _0x8b3c2=>_0x12b430[_0x347fc7(0x1c0)](_0x8b3c2),'onWarning':_0x2e8078=>{const _0x536451=_0x347fc7;this[_0x536451(0x1b4)]['warn'](_0x2e8078),_0x373869[_0x536451(0x277)](_0x2e8078);}};for(const _0x23aa9c of _0x5db401){try{const _0x4a43a4=yamlKnowledgeBaseToApi(_0x23aa9c['yaml'],_0x49ac2a),_0x586cce=await this[_0x347fc7(0x203)][_0x347fc7(0x264)](_0x4a43a4);_0x3aabec[_0x347fc7(0x26f)](_0x23aa9c['yaml'][_0x347fc7(0x1da)],_0x586cce['id']),_0x8b72ab[_0x347fc7(0x1e5)][_0x347fc7(0x277)]({'name':_0x23aa9c['yaml'][_0x347fc7(0x1da)],'action':_0x347fc7(0x27b),'id':_0x586cce['id']}),_0x8b72ab['counts'][_0x347fc7(0x1e5)][_0x347fc7(0x27b)]++;}catch(_0x193660){_0x8b72ab[_0x347fc7(0x1e5)][_0x347fc7(0x277)]({'name':_0x23aa9c[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x193660[_0x347fc7(0x1af)]}),_0x8b72ab['counts'][_0x347fc7(0x1e5)][_0x347fc7(0x1a5)]++;}}for(const _0x45474d of _0x2cec3b){try{const _0x342891=yamlTextKnowledgeBaseToApi({'name':_0x45474d[_0x347fc7(0x1da)],'text':_0x45474d[_0x347fc7(0x230)]},_0x49ac2a),_0x1ee9b9=await this[_0x347fc7(0x203)][_0x347fc7(0x1b0)](_0x342891);_0x1fe7b8[_0x347fc7(0x26f)](_0x45474d[_0x347fc7(0x1da)],_0x1ee9b9['id']),_0x8b72ab[_0x347fc7(0x25f)]['push']({'name':_0x45474d[_0x347fc7(0x1da)],'action':_0x347fc7(0x27b),'id':_0x1ee9b9['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x25f)][_0x347fc7(0x27b)]++;}catch(_0x4c4168){_0x8b72ab[_0x347fc7(0x25f)][_0x347fc7(0x277)]({'name':_0x45474d[_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x4c4168['message']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x25f)][_0x347fc7(0x1a5)]++;}}for(const _0x2e86c9 of _0x42c6c2){try{const _0x18feea=yamlExperimentalArtifactToApi(_0x2e86c9[_0x347fc7(0x290)],_0x49ac2a),_0x51c1de=await this[_0x347fc7(0x203)][_0x347fc7(0x21b)](_0x18feea);_0x62f5c7[_0x347fc7(0x26f)](_0x2e86c9[_0x347fc7(0x290)][_0x347fc7(0x1da)],_0x51c1de['id']),_0x8b72ab[_0x347fc7(0x20a)]['push']({'name':_0x2e86c9['def'][_0x347fc7(0x1da)],'action':_0x347fc7(0x27b),'id':_0x51c1de['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x20a)][_0x347fc7(0x27b)]++;}catch(_0x242e15){_0x8b72ab[_0x347fc7(0x20a)][_0x347fc7(0x277)]({'name':_0x2e86c9[_0x347fc7(0x290)]['name'],'action':_0x347fc7(0x1ba),'error':_0x242e15['message']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x20a)]['errors']++;}}for(const _0x276859 of _0x1a3e3b){try{const _0x27bacf=yamlExperimentalKnowledgeBaseToApi(_0x276859[_0x347fc7(0x290)],_0x49ac2a),_0x1e0f82=await this[_0x347fc7(0x203)]['createExperimentalKnowledgeBase'](_0x27bacf);_0x3faaf5[_0x347fc7(0x26f)](_0x276859[_0x347fc7(0x290)][_0x347fc7(0x1da)],_0x1e0f82['id']),_0x8b72ab[_0x347fc7(0x1cb)][_0x347fc7(0x277)]({'name':_0x276859[_0x347fc7(0x290)][_0x347fc7(0x1da)],'action':'created','id':_0x1e0f82['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x1cb)][_0x347fc7(0x27b)]++;}catch(_0x52b5f8){_0x8b72ab[_0x347fc7(0x1cb)][_0x347fc7(0x277)]({'name':_0x276859['def'][_0x347fc7(0x1da)],'action':'error','error':_0x52b5f8['message']}),_0x8b72ab['counts'][_0x347fc7(0x1cb)][_0x347fc7(0x1a5)]++;}}const _0x4a37cb=[..._0x9cd1b][_0x347fc7(0x23e)]((_0x5cde3e,_0x36fa2b)=>{const _0x10ced8=_0x347fc7,_0x5bc9e6=_0x5cde3e[_0x10ced8(0x28b)]['tools']?.['some'](_0x1f73a6=>_0x1f73a6['type']===_0x10ced8(0x1b7))??![],_0x1430bb=_0x36fa2b[_0x10ced8(0x28b)][_0x10ced8(0x17e)]?.[_0x10ced8(0x258)](_0x54281b=>_0x54281b['type']==='agent')??![];if(_0x5bc9e6&&!_0x1430bb)return 0x1;if(!_0x5bc9e6&&_0x1430bb)return-0x1;return 0x0;});for(const _0x201f07 of _0x4a37cb){_0x373869=[];try{const _0x461af6=_0x201f07[_0x347fc7(0x28b)]['tools']?.[_0x347fc7(0x18a)](_0x40b059=>{const _0x24b7d8=_0x347fc7;if(_0x40b059[_0x24b7d8(0x216)]==='agent'&&_0x40b059[_0x24b7d8(0x1d7)]){const _0x335e4c=parseRef(_0x40b059[_0x24b7d8(0x1d7)]);return _0x335e4c?.['name']===_0x201f07[_0x24b7d8(0x28b)][_0x24b7d8(0x1da)];}return![];})??[];if(_0x461af6[_0x347fc7(0x189)]>0x0){const _0x2367e5=_0x347fc7(0x25b)+_0x201f07[_0x347fc7(0x28b)][_0x347fc7(0x1da)]+_0x347fc7(0x1b3)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this[_0x347fc7(0x1b4)][_0x347fc7(0x1eb)](_0x2367e5),_0x373869[_0x347fc7(0x277)](_0x2367e5);}const _0x1842dc=await agentDefToRequest(_0x201f07['yaml'],_0x201f07['systemPrompt'],_0x201f07[_0x347fc7(0x1d0)],_0x4d31ba),_0x3740b2=await this[_0x347fc7(0x203)][_0x347fc7(0x1d1)](_0x1842dc);_0x1bad79['set'](_0x201f07['yaml'][_0x347fc7(0x1da)],_0x3740b2['id']),_0x8b72ab['agents'][_0x347fc7(0x277)]({'agentName':_0x201f07[_0x347fc7(0x28b)]['name'],'action':_0x347fc7(0x27b),'agentId':_0x3740b2['id'],'warnings':_0x373869[_0x347fc7(0x189)]>0x0?_0x373869:undefined}),_0x8b72ab[_0x347fc7(0x1f6)]['agents']['created']++;}catch(_0x4869b8){_0x8b72ab[_0x347fc7(0x1bc)][_0x347fc7(0x277)]({'agentName':_0x201f07['yaml'][_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x4869b8[_0x347fc7(0x1af)],'warnings':_0x373869['length']>0x0?_0x373869:undefined}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x1bc)][_0x347fc7(0x1a5)]++;}}for(const _0x3adfd0 of _0x19013c){try{const _0x33cafe=await yamlPromptToApi(_0x3adfd0[_0x347fc7(0x28b)],_0x49ac2a,_0x4d31ba);if(!_0x33cafe){_0x8b72ab[_0x347fc7(0x25d)][_0x347fc7(0x277)]({'name':_0x3adfd0[_0x347fc7(0x28b)]['name'],'action':'error','error':'Agent\x20reference\x20not\x20found'}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x25d)][_0x347fc7(0x1a5)]++;continue;}const _0x522e97=await this['client'][_0x347fc7(0x256)](_0x33cafe);_0x12b430[_0x347fc7(0x26f)](_0x3adfd0[_0x347fc7(0x28b)][_0x347fc7(0x1da)],_0x522e97['id']),_0x8b72ab[_0x347fc7(0x25d)][_0x347fc7(0x277)]({'name':_0x3adfd0[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':_0x347fc7(0x27b),'id':_0x522e97['id']}),_0x8b72ab['counts'][_0x347fc7(0x25d)][_0x347fc7(0x27b)]++;}catch(_0x1f3508){_0x8b72ab[_0x347fc7(0x25d)][_0x347fc7(0x277)]({'name':_0x3adfd0[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x1f3508[_0x347fc7(0x1af)]}),_0x8b72ab['counts'][_0x347fc7(0x25d)]['errors']++;}}for(const _0x54e76d of _0x4e691a){try{const _0x4390a3=await yamlIntegrationToApi(_0x54e76d[_0x347fc7(0x28b)],_0x49ac2a,_0x4d31ba),_0xd69e1f=await this[_0x347fc7(0x203)][_0x347fc7(0x1a9)](_0x4390a3);_0x8b72ab[_0x347fc7(0x180)]['push']({'name':_0x54e76d[_0x347fc7(0x28b)]['service_type'],'action':_0x347fc7(0x27b),'id':_0xd69e1f['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x180)][_0x347fc7(0x27b)]++;}catch(_0x3b7983){_0x8b72ab[_0x347fc7(0x180)][_0x347fc7(0x277)]({'name':_0x54e76d[_0x347fc7(0x28b)]['service_type'],'action':_0x347fc7(0x1ba),'error':_0x3b7983[_0x347fc7(0x1af)]}),_0x8b72ab[_0x347fc7(0x1f6)]['integrations']['errors']++;}}for(const _0x17a24d of _0x358682){try{const _0x2d886b=await yamlFormInterfaceToApi(_0x17a24d[_0x347fc7(0x28b)],_0x49ac2a,_0x4d31ba);if(!_0x2d886b){_0x8b72ab[_0x347fc7(0x194)][_0x347fc7(0x277)]({'name':_0x17a24d[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x347fc7(0x26c)}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x194)][_0x347fc7(0x1a5)]++;continue;}const _0x7404d8=await this['client'][_0x347fc7(0x1a3)](_0x2d886b);_0x8b72ab[_0x347fc7(0x194)][_0x347fc7(0x277)]({'name':_0x17a24d[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':_0x347fc7(0x27b),'id':_0x7404d8['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x194)][_0x347fc7(0x27b)]++;}catch(_0x13cbdb){_0x8b72ab[_0x347fc7(0x194)][_0x347fc7(0x277)]({'name':_0x17a24d[_0x347fc7(0x28b)][_0x347fc7(0x1da)],'action':'error','error':_0x13cbdb['message']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x194)][_0x347fc7(0x1a5)]++;}}for(const _0x3a2357 of _0x52b041){try{const _0x17f7d6=await yamlChatInterfaceToApi(_0x3a2357['yaml'],_0x49ac2a,_0x4d31ba),_0x21ee0d=await this['client']['createChatInterface'](_0x17f7d6);_0x8b72ab[_0x347fc7(0x266)][_0x347fc7(0x277)]({'name':_0x3a2357[_0x347fc7(0x28b)]['name'],'action':_0x347fc7(0x27b),'id':_0x21ee0d['id']}),_0x8b72ab[_0x347fc7(0x1f6)][_0x347fc7(0x266)]['created']++;}catch(_0x3fd4a7){_0x8b72ab[_0x347fc7(0x266)]['push']({'name':_0x3a2357['yaml'][_0x347fc7(0x1da)],'action':_0x347fc7(0x1ba),'error':_0x3fd4a7['message']}),_0x8b72ab['counts'][_0x347fc7(0x266)][_0x347fc7(0x1a5)]++;}}return _0x8b72ab;}}