@treasuredata/tdx 2026.3.33 → 2026.3.34

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 (253) 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/auth-login-command.js +1 -1
  13. package/dist/commands/cas-command.js +1 -1
  14. package/dist/commands/cas-segment-command.js +1 -1
  15. package/dist/commands/chat-command.js +1 -1
  16. package/dist/commands/claude-command.js +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/tables.js +1 -1
  54. package/dist/commands/unset-command.js +1 -1
  55. package/dist/commands/upgrade-command.js +1 -1
  56. package/dist/commands/use-command.js +1 -1
  57. package/dist/commands/user-command.js +1 -1
  58. package/dist/commands/work-command.js +1 -1
  59. package/dist/commands/workflow-command.js +1 -1
  60. package/dist/core/auth.js +1 -1
  61. package/dist/core/command-output.js +1 -1
  62. package/dist/core/config.js +1 -1
  63. package/dist/core/connection-cache.js +1 -1
  64. package/dist/core/constants.js +1 -1
  65. package/dist/core/credential-cache.js +1 -1
  66. package/dist/core/global-context.js +1 -1
  67. package/dist/core/keychain.js +1 -1
  68. package/dist/core/oauth-keychain.js +1 -1
  69. package/dist/core/oauth.js +1 -1
  70. package/dist/core/profile.js +1 -1
  71. package/dist/core/project-config.js +1 -1
  72. package/dist/core/session.js +1 -1
  73. package/dist/core/user-cache.js +1 -1
  74. package/dist/core/version.js +1 -1
  75. package/dist/index.js +1 -1
  76. package/dist/mcp/server.js +1 -1
  77. package/dist/mcp/tools/index.js +1 -1
  78. package/dist/mcp/tools/tdx-run.js +1 -1
  79. package/dist/mcp/tools/tdx-search.js +1 -1
  80. package/dist/mcp/utils.js +1 -1
  81. package/dist/proxy/claude-usage-tracker.js +1 -1
  82. package/dist/proxy/passthrough-server.js +1 -1
  83. package/dist/proxy/sse-usage-parser.js +1 -1
  84. package/dist/sdk/agent/agent-config.js +1 -1
  85. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  86. package/dist/sdk/agent/agent-yaml.js +1 -1
  87. package/dist/sdk/agent/test/evaluator.js +1 -1
  88. package/dist/sdk/agent/test/executor.js +1 -1
  89. package/dist/sdk/agent/test/index.js +1 -1
  90. package/dist/sdk/agent/test/output.js +1 -1
  91. package/dist/sdk/agent/test/parser.js +1 -1
  92. package/dist/sdk/agent/tool-target-registry.js +1 -1
  93. package/dist/sdk/api.d.ts.map +1 -1
  94. package/dist/sdk/api.js +1 -1
  95. package/dist/sdk/api.js.map +1 -1
  96. package/dist/sdk/cas/cas-api-client.d.ts.map +1 -1
  97. package/dist/sdk/cas/cas-api-client.js +1 -1
  98. package/dist/sdk/cas/cas-api-client.js.map +1 -1
  99. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  100. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  101. package/dist/sdk/cas/index.js +1 -1
  102. package/dist/sdk/cas/pull-workflow.js +1 -1
  103. package/dist/sdk/cas/push-workflow.js +1 -1
  104. package/dist/sdk/client/cdp-api-client.d.ts.map +1 -1
  105. package/dist/sdk/client/cdp-api-client.js +1 -1
  106. package/dist/sdk/client/cdp-api-client.js.map +1 -1
  107. package/dist/sdk/client/delivery-api-client.d.ts.map +1 -1
  108. package/dist/sdk/client/delivery-api-client.js +1 -1
  109. package/dist/sdk/client/delivery-api-client.js.map +1 -1
  110. package/dist/sdk/client/endpoints.js +1 -1
  111. package/dist/sdk/client/engage-api-client.d.ts.map +1 -1
  112. package/dist/sdk/client/engage-api-client.js +1 -1
  113. package/dist/sdk/client/engage-api-client.js.map +1 -1
  114. package/dist/sdk/client/http-client.d.ts +7 -0
  115. package/dist/sdk/client/http-client.d.ts.map +1 -1
  116. package/dist/sdk/client/http-client.js +1 -1
  117. package/dist/sdk/client/http-client.js.map +1 -1
  118. package/dist/sdk/client/llm-api-client.d.ts.map +1 -1
  119. package/dist/sdk/client/llm-api-client.js +1 -1
  120. package/dist/sdk/client/llm-api-client.js.map +1 -1
  121. package/dist/sdk/client/oauth-refresh.js +1 -1
  122. package/dist/sdk/client/rate-limiter.js +1 -1
  123. package/dist/sdk/client/td-api-client.d.ts.map +1 -1
  124. package/dist/sdk/client/td-api-client.js +1 -1
  125. package/dist/sdk/client/td-api-client.js.map +1 -1
  126. package/dist/sdk/client/trino-api-client.d.ts.map +1 -1
  127. package/dist/sdk/client/trino-api-client.js +1 -1
  128. package/dist/sdk/client/trino-api-client.js.map +1 -1
  129. package/dist/sdk/client/workflow-client.d.ts.map +1 -1
  130. package/dist/sdk/client/workflow-client.js +1 -1
  131. package/dist/sdk/client/workflow-client.js.map +1 -1
  132. package/dist/sdk/connection-validator.js +1 -1
  133. package/dist/sdk/connection.js +1 -1
  134. package/dist/sdk/delivery.js +1 -1
  135. package/dist/sdk/engage/campaign-pull.js +1 -1
  136. package/dist/sdk/engage/campaign-push.js +1 -1
  137. package/dist/sdk/engage/campaign-validator.js +1 -1
  138. package/dist/sdk/engage/campaign-yaml.js +1 -1
  139. package/dist/sdk/engage/template-pull.js +1 -1
  140. package/dist/sdk/engage/template-push.js +1 -1
  141. package/dist/sdk/engage/template-validator.js +1 -1
  142. package/dist/sdk/engage/template-yaml.js +1 -1
  143. package/dist/sdk/engage/types/campaign-def.js +1 -1
  144. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  145. package/dist/sdk/engage/types/template-schema.js +1 -1
  146. package/dist/sdk/engage.js +1 -1
  147. package/dist/sdk/errors.js +1 -1
  148. package/dist/sdk/index.d.ts +12 -0
  149. package/dist/sdk/index.d.ts.map +1 -1
  150. package/dist/sdk/index.js +1 -1
  151. package/dist/sdk/index.js.map +1 -1
  152. package/dist/sdk/io/index.js +1 -1
  153. package/dist/sdk/io/node-filesystem.js +1 -1
  154. package/dist/sdk/job.js +1 -1
  155. package/dist/sdk/journey.js +1 -1
  156. package/dist/sdk/llm/chat-cache.js +1 -1
  157. package/dist/sdk/llm/index.js +1 -1
  158. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  159. package/dist/sdk/llm/model-factors.js +1 -1
  160. package/dist/sdk/personalization.d.ts.map +1 -1
  161. package/dist/sdk/personalization.js +1 -1
  162. package/dist/sdk/personalization.js.map +1 -1
  163. package/dist/sdk/policy.d.ts.map +1 -1
  164. package/dist/sdk/policy.js +1 -1
  165. package/dist/sdk/policy.js.map +1 -1
  166. package/dist/sdk/query/index.js +1 -1
  167. package/dist/sdk/query/sql-parser.js +1 -1
  168. package/dist/sdk/realtime.d.ts.map +1 -1
  169. package/dist/sdk/realtime.js +1 -1
  170. package/dist/sdk/realtime.js.map +1 -1
  171. package/dist/sdk/schedule.js +1 -1
  172. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  173. package/dist/sdk/segment/fields-display.js +1 -1
  174. package/dist/sdk/segment/file-discovery.js +1 -1
  175. package/dist/sdk/segment/journey-utils.js +1 -1
  176. package/dist/sdk/segment/journey-validator.js +1 -1
  177. package/dist/sdk/segment/journey-yaml.js +1 -1
  178. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  179. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  180. package/dist/sdk/segment/pull-workflow.js +1 -1
  181. package/dist/sdk/segment/push-recovery.js +1 -1
  182. package/dist/sdk/segment/push-workflow.js +1 -1
  183. package/dist/sdk/segment/resolution-context.js +1 -1
  184. package/dist/sdk/segment/segment-path-parser.js +1 -1
  185. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  186. package/dist/sdk/segment/segment-validator.js +1 -1
  187. package/dist/sdk/segment/target-resolution.js +1 -1
  188. package/dist/sdk/segment/tdx-config.js +1 -1
  189. package/dist/sdk/segment/types/activation-schema.js +1 -1
  190. package/dist/sdk/segment/types/journey-def.js +1 -1
  191. package/dist/sdk/segment/types/journey-schema.js +1 -1
  192. package/dist/sdk/segment/types/segment-def.js +1 -1
  193. package/dist/sdk/segment/types/segment-schema.js +1 -1
  194. package/dist/sdk/segment/validate-files.js +1 -1
  195. package/dist/sdk/segment/yaml-validator.js +1 -1
  196. package/dist/sdk/segment.js +1 -1
  197. package/dist/sdk/types/index.js +1 -1
  198. package/dist/sdk/types/progress.js +1 -1
  199. package/dist/sdk/types/workspace.d.ts +1 -0
  200. package/dist/sdk/types/workspace.d.ts.map +1 -1
  201. package/dist/sdk/types/workspace.js +1 -1
  202. package/dist/sdk/user.js +1 -1
  203. package/dist/sdk/util/format-detector.js +1 -1
  204. package/dist/sdk/util/formatters.js +1 -1
  205. package/dist/sdk/util/index.js +1 -1
  206. package/dist/sdk/util/paginate.js +1 -1
  207. package/dist/sdk/util/tree-formatter.js +1 -1
  208. package/dist/sdk/workflow/archive-validation.js +1 -1
  209. package/dist/sdk/workflow/clone-workflow.js +1 -1
  210. package/dist/sdk/workflow/index.js +1 -1
  211. package/dist/sdk/workflow/pull-workflow.js +1 -1
  212. package/dist/sdk/workflow/push-workflow.js +1 -1
  213. package/dist/sdk/workflow/tdx-config.js +1 -1
  214. package/dist/sdk/workflow/workflow-utils.js +1 -1
  215. package/dist/sdk/workspace/frontmatter.js +1 -1
  216. package/dist/sdk/workspace/git.js +1 -1
  217. package/dist/sdk/workspace/index.js +1 -1
  218. package/dist/sdk/workspace/templates.js +1 -1
  219. package/dist/sdk/workspace/weekly.js +1 -1
  220. package/dist/sdk/workspace/wikilinks.js +1 -1
  221. package/dist/test-utils/command-runner.js +1 -1
  222. package/dist/test-utils/factories.js +1 -1
  223. package/dist/test-utils/fixtures.js +1 -1
  224. package/dist/test-utils/http-mock.js +1 -1
  225. package/dist/test-utils/index.js +1 -1
  226. package/dist/utils/async.js +1 -1
  227. package/dist/utils/colors.js +1 -1
  228. package/dist/utils/diff.js +1 -1
  229. package/dist/utils/file-permissions.js +1 -1
  230. package/dist/utils/file-reader.js +1 -1
  231. package/dist/utils/github-releases.js +1 -1
  232. package/dist/utils/global-cache.js +1 -1
  233. package/dist/utils/json-loader.js +1 -1
  234. package/dist/utils/local-cache.js +1 -1
  235. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  236. package/dist/utils/logger/formatters/index.js +1 -1
  237. package/dist/utils/logger/handlers/console-handler.js +1 -1
  238. package/dist/utils/logger/handlers/file-handler.js +1 -1
  239. package/dist/utils/logger/handlers/index.js +1 -1
  240. package/dist/utils/logger/handlers/null-handler.js +1 -1
  241. package/dist/utils/logger/index.js +1 -1
  242. package/dist/utils/logger/logger.js +1 -1
  243. package/dist/utils/logger/types.js +1 -1
  244. package/dist/utils/option-validation.js +1 -1
  245. package/dist/utils/process.js +1 -1
  246. package/dist/utils/prompt.js +1 -1
  247. package/dist/utils/spinner.js +1 -1
  248. package/dist/utils/sse-parser.js +1 -1
  249. package/dist/utils/string-utils.js +1 -1
  250. package/dist/utils/table-ref-parser.js +1 -1
  251. package/dist/utils/tdx-logger.js +1 -1
  252. package/dist/utils/version-check.js +1 -1
  253. package/package.json +1 -1
@@ -1 +1 @@
1
- const a133_0x496960=a133_0x4f46;(function(_0x5a5460,_0x1d6c72){const _0x5bc275=a133_0x4f46,_0x10f378=_0x5a5460();while(!![]){try{const _0x4cd7ae=-parseInt(_0x5bc275(0x1db))/0x1*(-parseInt(_0x5bc275(0x252))/0x2)+-parseInt(_0x5bc275(0x221))/0x3*(-parseInt(_0x5bc275(0x1e1))/0x4)+-parseInt(_0x5bc275(0x23c))/0x5+parseInt(_0x5bc275(0x2a8))/0x6*(-parseInt(_0x5bc275(0x218))/0x7)+parseInt(_0x5bc275(0x21b))/0x8*(-parseInt(_0x5bc275(0x227))/0x9)+-parseInt(_0x5bc275(0x199))/0xa*(-parseInt(_0x5bc275(0x295))/0xb)+parseInt(_0x5bc275(0x1d7))/0xc*(parseInt(_0x5bc275(0x1ee))/0xd);if(_0x4cd7ae===_0x1d6c72)break;else _0x10f378['push'](_0x10f378['shift']());}catch(_0x28a733){_0x10f378['push'](_0x10f378['shift']());}}}(a133_0x28b5,0xe7d9a));import{LLMApiClient}from'../client/llm-api-client.js';import*as a133_0x1343de from'node:fs';import*as a133_0x4bef80 from'node:path';function a133_0x4f46(_0x4ba0a6,_0x3f42db){_0x4ba0a6=_0x4ba0a6-0x195;const _0x28b55f=a133_0x28b5();let _0x4f467c=_0x28b55f[_0x4ba0a6];return _0x4f467c;}import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir}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';function a133_0x28b5(){const _0x35f640=['set','createProject','createIntegration','updated','createTextKnowledgeBase','createAgent','\x0a---\x20code\x20---\x0a','setCurrentProject','getChatHistory','serviceType','21719269tKNjHP','Renamed\x20folder:\x20','template','endsWith','resolveAgentId','experimentalKnowledgeBases','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','getBackupMetadata','type','info','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','No\x20tdx.json\x20found\x20in\x20','listIntegrations','newProjectId','readdirSync','signal','Multiple\x20projects\x20found\x20with\x20name\x20\x27','listKnowledgeBases','dry-run-','knowledgeBases','tdx.json','medium','error','availableModels','ALREADY_EXISTS','loadJsonFile','\x20in\x20project\x20','getDefaultAgent','webSearchTools','knowledgebases.json','variables','getOrCreateDefaultProject','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','files','prompts.json','temperature','getUserSettings','listPrompts','.md','pushAgent','rmSync','1623636SkeZhJ','unchanged','isDirectory','3410432GXWQdu','prompt.md','add','toISOString','warn','actions','2469bkBSuL','yaml','listWebSearchTools','updateTextKnowledgeBase','createPrompt','dirname','18ypktCs','availableModelNames','AGENT_NOT_FOUND','chatIgnoreManagedActions','exportedFrom','dryRun','code','tdx_','llm_project','Invalid\x20agent\x20reference\x20format:\x20','version','localeCompare',')\x20can\x20be\x20cloned.','nameToId','high','isFile','\x0a---\x20schema:\x20','webhookCorsOrigins','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','isDir','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','8240575CzCDaS','mkdirSync','json_schema.json','updateExperimentalArtifact','idToName','chatWelcomeMessage','agentId','KnowledgeBase','getProject','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','---\x20file:\x20','includes','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','1.0','experimental_artifacts','deleteAgent','conflict','):\x20','errors','agent','length','\x0a---\x20function:\x20','56chVvBj','NOT_FOUND','new','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','Renamed\x20text\x20KB\x20file:\x20','textKnowledgeBases','profile','tdx_default_','filter','Removed\x20deleted\x20directory:\x20','getOrCreateDefaultAgent','push','Project\x20\x22','Renamed\x20agent\x20folder:\x20','isManaged','counts','pullAgent','listProjects','client','Agent\x20not\x20found:\x20','metadata','\x22\x20already\x20exists','.llm','def','action','projects','integrations','restoreProject','agents.json','cwd','Removed\x20deleted\x20file:\x20','promptId','createExperimentalArtifact','some','maxToolIterations','displayName','Renamed\x20integration\x20file:\x20','toLowerCase','existsSync','INVALID_ARGUMENT','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.','Skipping\x20integration\x20\x27','Unsupported\x20backup\x20version:\x20','.yml','agentsFull','clearDefaultAgent','backupProject','get','split','ExperimentalKnowledgeBase','chat_generic','chat','Project\x20not\x20found:\x20','history','createAgentResponse','unlinkSync','Renamed\x20prompt\x20file:\x20','claude-4.5-sonnet','getDefaultProjectName','INTERNAL','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','text_content','getAgent','getChatInfo','updateKnowledgeBase','basename','resolveProjectName','100474UuAcGU','TextKnowledgeBase','Output\x20directory\x20already\x20exists:\x20','status','modelType','startChat','listAgentsFull','\x0a\x0a#\x20agent.yml\x0a','listExperimentalArtifacts','project','target','context','resolveProjectId','getChatLog','updateAgentResponse','path','duplicate','projectId','code.js','18iJlKCa','\x20---\x0a','cloneProject','listToolTargets','statSync','site','writeFileSync','parse','experimentalArtifacts','starterMessage','chatId','PERMISSION_DENIED','join','_reasoning_','UNAUTHENTICATED','#\x20prompt.md\x0a','functions','Unresolved\x20dependencies:\x20','1810AAPIdj','utf-8','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','project.json','updateAgent','content','prompts','oldPath','low','Renamed\x20experimental\x20KB\x20directory:\x20','currentProjectId','file_name','map','agent.yml','keys','slackMessageMode','integrations.json','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','Only\x20safe\x20types\x20(','getCurrentProject','\x20attempts\x20due\x20to\x20name\x20conflicts.','setDefaultAgent','projectName','\x20→\x20','Agent\x20reference\x20not\x20found','starter_message.md','pushProject','listChats','renamed','tools','created','\x27\x20(',')\x20can\x20be\x20pushed.\x20','createExperimentalKnowledgeBase','outputs','total','message','Agent\x20\x27','chat_parent_segment','attributes','updateExperimentalKnowledgeBase','updatePrompt','systemPrompt','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','stringify','listImageGenerators','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','image_gen','knowledge_bases','listTextKnowledgeBases','readFileSync','agent.yml\x20not\x20found\x20in\x20','service_type','size','listAgents','has','minimal','listExperimentalKnowledgeBases','find','starter_message','text','12nRknBg','sort','name','LLM_PROJECT_NOT_FOUND','27544SruMON','imageGenerators','dir','agents','createKnowledgeBase','tables','248HUsAUb','logger','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.'];a133_0x28b5=function(){return _0x35f640;};return a133_0x28b5();}export const SAFE_INTEGRATION_TYPES=[a133_0x496960(0x284),'chat_agent_console',a133_0x496960(0x1c0)];async function safeListOrEmpty(_0xc9f1cf){const _0x375f7c=a133_0x496960;try{return await _0xc9f1cf();}catch(_0x40f239){if(_0x40f239 instanceof HTTPClientError&&_0x40f239[_0x375f7c(0x298)]===0x194)return[];throw _0x40f239;}}export class LLMSDK{['currentProjectId'];[a133_0x496960(0x264)];[a133_0x496960(0x2a0)];[a133_0x496960(0x1e2)]=Logger['of']('sdk.llm');constructor(_0x519f53){const _0x23220b=a133_0x496960;this[_0x23220b(0x264)]=new LLMApiClient(_0x519f53),this[_0x23220b(0x2a0)]=_0x519f53;}[a133_0x496960(0x28c)](){const _0x386dd3=a133_0x496960,_0x39b0a2=getSanitizedUsername();return _0x386dd3(0x259)+_0x39b0a2;}async[a133_0x496960(0x1eb)](_0x3615bb){const {projectId:_0x4d9aec}=await this['resolveProjectName'](_0x3615bb);this['currentProjectId']=_0x4d9aec;}[a133_0x496960(0x1ad)](){const _0x1c80d0=a133_0x496960;return this[_0x1c80d0(0x1a4)];}async[a133_0x496960(0x1af)](_0x2e8812){const _0x90fafc=a133_0x496960,_0x4953e1=this['context'][_0x90fafc(0x258)];let _0x5a8086,_0x2cd63e;if(_0x2e8812[_0x90fafc(0x247)]('/')){const _0x5c2eab=_0x2e8812[_0x90fafc(0x282)]('/');if(_0x5c2eab[_0x90fafc(0x250)]!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x90fafc(0x230)+_0x2e8812,undefined,{'helpText':'Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22'});const [_0x114673,_0x416d32]=_0x5c2eab;_0x5a8086=await this['resolveProjectId'](_0x114673),_0x2cd63e=_0x416d32;}else _0x5a8086=this['currentProjectId']||(await this[_0x90fafc(0x20d)]())['id'],_0x2cd63e=_0x2e8812;const _0x1f054a=await this[_0x90fafc(0x1f2)](_0x2cd63e,_0x5a8086),_0x38a6de=await this[_0x90fafc(0x264)][_0x90fafc(0x290)](_0x1f054a);writeCachedLLMAgent(_0x38a6de['attributes'][_0x90fafc(0x1d9)],_0x1f054a,_0x5a8086,_0x4953e1);}[a133_0x496960(0x209)](){const _0x33be2b=a133_0x496960,_0x89a02e=this[_0x33be2b(0x2a0)]['profile'];return readCachedLLMAgent(_0x89a02e)||undefined;}[a133_0x496960(0x27f)](){const _0x7ac178=this['context']['profile'];clearCachedLLMAgent(_0x7ac178);}async['models'](){const _0x314574=a133_0x496960,_0x32408d=await this['client'][_0x314574(0x213)](),_0x25c4cb=[];for(const _0x5961df of _0x32408d[_0x314574(0x228)]){const _0x31f4c0=_0x32408d[_0x314574(0x205)][_0x5961df];_0x31f4c0&&_0x25c4cb['push']({'name':_0x5961df,'displayName':_0x31f4c0[_0x314574(0x275)]});}return _0x25c4cb;}async[a133_0x496960(0x1e5)](_0x29521a){const _0x4d68eb=a133_0x496960;return await this[_0x4d68eb(0x264)][_0x4d68eb(0x1e5)](_0x29521a);}async['deleteProject'](_0x478d6c){const _0x3b099b=a133_0x496960,{projectId:_0x3558ed}=await this[_0x3b099b(0x294)](_0x478d6c);await this['client']['deleteProject'](_0x3558ed);}async[a133_0x496960(0x26b)](_0x2ffc4c=0x32){const _0x295992=a133_0x496960;return await this[_0x295992(0x264)][_0x295992(0x263)](_0x2ffc4c);}async[a133_0x496960(0x20d)](_0x425e8b){const _0x13acd9=a133_0x496960,_0x75b820=_0x425e8b||this[_0x13acd9(0x28c)](),_0x51dc2d=this[_0x13acd9(0x2a0)][_0x13acd9(0x258)];if(!_0x425e8b){const _0x1e092b=readCachedLLMProject(_0x51dc2d);if(_0x1e092b&&_0x1e092b[_0x13acd9(0x1d9)]===_0x75b820)try{const _0x4e84fc=await this[_0x13acd9(0x264)][_0x13acd9(0x244)](_0x1e092b['id']);if(_0x4e84fc['attributes'][_0x13acd9(0x1d9)]===_0x75b820)return _0x4e84fc;}catch{}}const _0x49a245=await this[_0x13acd9(0x264)][_0x13acd9(0x263)](),_0xf99654=_0x49a245[_0x13acd9(0x1d4)](_0x166575=>_0x166575[_0x13acd9(0x1c1)][_0x13acd9(0x1d9)]===_0x75b820);if(_0xf99654)return!_0x425e8b&&writeCachedLLMProject(_0x75b820,_0xf99654['id'],_0x51dc2d),_0xf99654;const _0x4da35b=await this[_0x13acd9(0x264)][_0x13acd9(0x1e5)]({'name':_0x75b820,'description':_0x13acd9(0x1ab)+getSanitizedUsername()+')'});return!_0x425e8b&&writeCachedLLMProject(_0x75b820,_0x4da35b['id'],_0x51dc2d),_0x4da35b;}async[a133_0x496960(0x2a1)](_0x5affe8){const _0x3199a7=a133_0x496960,_0x5a97dd=await this[_0x3199a7(0x264)][_0x3199a7(0x263)](),_0x14b0c9=_0x5a97dd[_0x3199a7(0x25a)](_0x395d11=>_0x395d11[_0x3199a7(0x1c1)][_0x3199a7(0x1d9)]===_0x5affe8);if(_0x14b0c9[_0x3199a7(0x250)]===0x0)throw new SDKError(ErrorCode[_0x3199a7(0x1da)],_0x3199a7(0x286)+_0x5affe8,undefined,{'helpText':_0x3199a7(0x19c)});if(_0x14b0c9[_0x3199a7(0x250)]>0x1)throw new SDKError(ErrorCode[_0x3199a7(0x28d)],_0x3199a7(0x1fe)+_0x5affe8+'\x27.\x20This\x20should\x20not\x20happen.');return _0x14b0c9[0x0]['id'];}async[a133_0x496960(0x294)](_0x422bdc){const _0x345ede=a133_0x496960,_0x447a7d=await this[_0x345ede(0x264)]['listProjects'](),_0x39d108=_0x447a7d[_0x345ede(0x1d4)](_0x5d1971=>_0x5d1971[_0x345ede(0x1c1)][_0x345ede(0x1d9)]===_0x422bdc);if(_0x39d108)return{'projectId':_0x39d108['id'],'project':_0x39d108};throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x345ede(0x286)+_0x422bdc,undefined,{'helpText':_0x345ede(0x19c)});}async[a133_0x496960(0x25c)](_0xb60e62=a133_0x496960(0x28b),_0x4d996e=0x0,_0x5e029a){const _0x4c78de=a133_0x496960,_0x1f0910=0xa;let _0x327b3a=0x0,_0x4f37c9;while(_0x327b3a<_0x1f0910){try{const _0x5bec5f=await this[_0x4c78de(0x20d)](_0x4f37c9),_0x43385c=_0x5bec5f['id'],_0x4310cb=['none',_0x4c78de(0x1d2),_0x4c78de(0x1a2),_0x4c78de(0x203),_0x4c78de(0x235)],_0x16d397=_0x4d996e===0x0?'tdx_'+_0xb60e62:_0x4c78de(0x22e)+_0xb60e62+_0x4c78de(0x2b5)+_0x4310cb[_0x4d996e],_0x334181=await this['client'][_0x4c78de(0x1d0)](_0x43385c),_0x36f6f1=_0x334181['find'](_0x4c25b0=>_0x4c25b0['attributes']['name']===_0x16d397);if(_0x36f6f1)return _0x36f6f1;const _0x1fa170=_0x4d996e>0x0?0x1:_0x5e029a;return await this['client'][_0x4c78de(0x1e9)]({'name':_0x16d397,'projectId':_0x43385c,'modelType':_0xb60e62,'systemPrompt':'','temperature':_0x1fa170,'reasoningEffort':_0x4d996e>0x0?_0x4d996e:undefined});}catch(_0x1597cd){if(_0x1597cd instanceof HTTPClientError){const _0x13e461=_0x1597cd[_0x4c78de(0x298)];if(_0x13e461>=0x190&&_0x13e461<0x1f4){if(_0x13e461===0x191)throw new SDKError(ErrorCode[_0x4c78de(0x195)],'Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.',_0x1597cd);else{if(_0x13e461===0x193)throw new SDKError(ErrorCode[_0x4c78de(0x2b3)],_0x4c78de(0x20e),_0x1597cd);}throw _0x1597cd;}}if(errorContains(_0x1597cd,'already\x20exists',_0x4c78de(0x2a5),_0x4c78de(0x24c))){_0x327b3a++;if(_0x327b3a>=_0x1f0910)throw new SDKError(ErrorCode[_0x4c78de(0x206)],'Unable\x20to\x20create\x20project\x20after\x20'+_0x1f0910+_0x4c78de(0x1ae),_0x1597cd);const _0x584647=this[_0x4c78de(0x28c)]();_0x4f37c9=_0x584647+'_'+generateRandomHex();continue;}throw _0x1597cd;}}throw new SDKError(ErrorCode['INTERNAL'],_0x4c78de(0x239));}async[a133_0x496960(0x1f2)](_0x44f714,_0x313ce3){const _0x3d2cf9=a133_0x496960,_0x3de211=_0x313ce3||this[_0x3d2cf9(0x1a4)],_0x262de2=await this[_0x3d2cf9(0x264)][_0x3d2cf9(0x1d0)](_0x3de211),_0x485520=_0x262de2[_0x3d2cf9(0x25a)](_0x5dfc74=>_0x5dfc74['attributes'][_0x3d2cf9(0x1d9)]===_0x44f714);if(_0x485520[_0x3d2cf9(0x250)]===0x0){const _0x506258=_0x3de211?_0x3d2cf9(0x208)+_0x3de211:'';throw new SDKError(ErrorCode[_0x3d2cf9(0x229)],'Agent\x20not\x20found:\x20'+_0x44f714+_0x506258,undefined,{'helpText':_0x3de211?_0x3d2cf9(0x23b):_0x3d2cf9(0x27a)});}if(_0x485520['length']>0x1)throw new SDKError(ErrorCode['INTERNAL'],'Multiple\x20agents\x20found\x20with\x20name\x20\x27'+_0x44f714+'\x27.\x20This\x20should\x20not\x20happen.');return _0x485520[0x0]['id'];}async[a133_0x496960(0x1de)](_0x18bf5f){const _0x2d8d95=a133_0x496960,_0x1d8b2d=_0x18bf5f||this[_0x2d8d95(0x1a4)];return await this['client']['listAgents'](_0x1d8b2d);}async[a133_0x496960(0x27e)](_0x58d335){const _0x4fc382=a133_0x496960;return await this[_0x4fc382(0x264)]['listAgentsFull'](_0x58d335);}async['agent'](_0x46fc6b){const _0x5b166a=a133_0x496960;return await this['client'][_0x5b166a(0x290)](_0x46fc6b);}async['createAgent'](_0x50f8a4){const _0x1b0cd6=a133_0x496960;return await this[_0x1b0cd6(0x264)][_0x1b0cd6(0x1e9)](_0x50f8a4);}async['updateAgent'](_0x5b66a7,_0x3156b4){const _0x361424=a133_0x496960;return await this[_0x361424(0x264)][_0x361424(0x19e)](_0x5b66a7,_0x3156b4);}async[a133_0x496960(0x24b)](_0x2d177d){await this['client']['deleteAgent'](_0x2d177d);}async[a133_0x496960(0x29a)](_0x104a3c){const _0x45d28c=a133_0x496960;return await this[_0x45d28c(0x264)][_0x45d28c(0x29a)]({'agentId':_0x104a3c});}async*[a133_0x496960(0x285)](_0x53aefc,_0x2d0c11){const _0x2ae2e6=a133_0x496960;let _0x27bd7f=_0x2d0c11?.[_0x2ae2e6(0x2b2)];const _0x4f0203=_0x2d0c11?.[_0x2ae2e6(0x242)];if(!_0x27bd7f){if(!_0x4f0203)throw new Error(_0x2ae2e6(0x20f));const _0x16c525=await this['client'][_0x2ae2e6(0x29a)]({'agentId':_0x4f0203});_0x27bd7f=_0x16c525['id'],yield{'type':_0x2ae2e6(0x266),'data':{'chatId':_0x27bd7f,'agentId':_0x4f0203,'projectId':_0x16c525[_0x2ae2e6(0x1c1)][_0x2ae2e6(0x2a6)]}};}for await(const _0x54dd81 of this[_0x2ae2e6(0x264)]['continueChat'](_0x27bd7f,_0x53aefc,_0x2d0c11?.[_0x2ae2e6(0x1fd)])){yield{'type':'event','data':_0x54dd81};}}async['chats'](_0x8b75cf=0x32){const _0x598e07=a133_0x496960;return await this[_0x598e07(0x264)][_0x598e07(0x1b5)](_0x8b75cf);}async[a133_0x496960(0x287)](_0x11afca){const _0x187f4d=a133_0x496960;return await this[_0x187f4d(0x264)][_0x187f4d(0x1ec)](_0x11afca);}async[a133_0x496960(0x2a2)](_0x4d35cb){return await this['client']['getChatLog'](_0x4d35cb);}async['chatInfo'](_0x3b33d4){const _0x397e46=a133_0x496960;return await this[_0x397e46(0x264)][_0x397e46(0x291)](_0x3b33d4);}async[a133_0x496960(0x280)](_0x3d1485,_0x1ff3a4,_0x1b116c){const _0x33a576=a133_0x496960,_0x579929=_0x1b116c?.[_0x33a576(0x22c)]??![],{projectId:_0x49cb6d,project:_0x40ef38}=await this[_0x33a576(0x294)](_0x3d1485),_0x34be3d=_0x40ef38['attributes'][_0x33a576(0x1d9)],_0x42c14f=_0x1ff3a4||_0x34be3d+_0x33a576(0x268);if(a133_0x1343de[_0x33a576(0x278)](_0x42c14f)&&!_0x579929)throw new SDKError(ErrorCode[_0x33a576(0x206)],_0x33a576(0x297)+_0x42c14f,undefined,{'helpText':_0x33a576(0x245)});const _0x398e56=await this['client'][_0x33a576(0x29b)](_0x49cb6d),_0xe9f416=await this['client'][_0x33a576(0x1ff)](_0x49cb6d),_0x3858dd=await this['client'][_0x33a576(0x214)](_0x49cb6d),_0x1d0f76=await this[_0x33a576(0x264)]['listIntegrations'](_0x49cb6d);if(!_0x579929){a133_0x1343de[_0x33a576(0x23d)](_0x42c14f,{'recursive':!![]});const _0x2f2944={'version':_0x33a576(0x249),'exportedAt':new Date()[_0x33a576(0x21e)](),'exportedFrom':{'site':this[_0x33a576(0x2a0)]['site'],'projectId':_0x49cb6d,'projectName':_0x34be3d},'project':_0x40ef38};a133_0x1343de[_0x33a576(0x2ae)](a133_0x4bef80[_0x33a576(0x2b4)](_0x42c14f,'project.json'),JSON[_0x33a576(0x1c6)](_0x2f2944,null,0x2)),a133_0x1343de[_0x33a576(0x2ae)](a133_0x4bef80[_0x33a576(0x2b4)](_0x42c14f,_0x33a576(0x26e)),JSON['stringify'](_0x398e56,null,0x2)),a133_0x1343de[_0x33a576(0x2ae)](a133_0x4bef80[_0x33a576(0x2b4)](_0x42c14f,_0x33a576(0x20b)),JSON[_0x33a576(0x1c6)](_0xe9f416,null,0x2)),a133_0x1343de[_0x33a576(0x2ae)](a133_0x4bef80[_0x33a576(0x2b4)](_0x42c14f,_0x33a576(0x211)),JSON[_0x33a576(0x1c6)](_0x3858dd,null,0x2)),a133_0x1343de[_0x33a576(0x2ae)](a133_0x4bef80[_0x33a576(0x2b4)](_0x42c14f,_0x33a576(0x1aa)),JSON[_0x33a576(0x1c6)](_0x1d0f76,null,0x2));}return{'projectName':_0x34be3d,'outputDir':_0x42c14f,'counts':{'agents':_0x398e56[_0x33a576(0x250)],'knowledgeBases':_0xe9f416[_0x33a576(0x250)],'prompts':_0x3858dd[_0x33a576(0x250)],'integrations':_0x1d0f76[_0x33a576(0x250)]}};}async[a133_0x496960(0x26d)](_0x54e935,_0xdbce60){const _0x1f3121=a133_0x496960,_0x26da05=_0xdbce60?.[_0x1f3121(0x22c)]??![],_0x80df24=this[_0x1f3121(0x1f5)](_0x54e935),_0x25d4bd=_0x80df24[_0x1f3121(0x22b)][_0x1f3121(0x2ad)],_0x28efe4=this['context'][_0x1f3121(0x2ad)],_0x20741f=_0x25d4bd!==_0x28efe4?_0x25d4bd:undefined,_0x350840=this['loadJsonFile'](a133_0x4bef80[_0x1f3121(0x2b4)](_0x54e935,'agents.json'),[]),_0x499dcc=this['loadJsonFile'](a133_0x4bef80[_0x1f3121(0x2b4)](_0x54e935,_0x1f3121(0x20b)),[]),_0x2c39fe=this[_0x1f3121(0x207)](a133_0x4bef80[_0x1f3121(0x2b4)](_0x54e935,_0x1f3121(0x211)),[]),_0x1866d2=this['loadJsonFile'](a133_0x4bef80[_0x1f3121(0x2b4)](_0x54e935,'integrations.json'),[]),_0x26e70d=_0xdbce60?.['name']||_0x80df24[_0x1f3121(0x22b)][_0x1f3121(0x1b0)];if(_0x26da05){const _0x36d9a7=new Map(),_0x5a9c2c=[..._0x350840],_0x5b0c9b=_0x350840[_0x1f3121(0x250)]+0x1;let _0x27a577=0x0;while(_0x5a9c2c[_0x1f3121(0x250)]>0x0&&_0x27a577<_0x5b0c9b){_0x27a577++;const _0x482961=[];for(const _0x2c5c9b of _0x5a9c2c){canCreateAgent(_0x2c5c9b,_0x36d9a7)?_0x36d9a7[_0x1f3121(0x1e4)](_0x2c5c9b['id'],_0x1f3121(0x200)+_0x2c5c9b['id']):_0x482961[_0x1f3121(0x25d)](_0x2c5c9b);}if(_0x482961['length']===_0x5a9c2c['length'])throw new SDKError(ErrorCode[_0x1f3121(0x28d)],_0x1f3121(0x255),undefined,{'helpText':_0x1f3121(0x1c8)});_0x5a9c2c['length']=0x0,_0x5a9c2c['push'](..._0x482961);}const _0x1a71ef=_0x2c39fe[_0x1f3121(0x25a)](_0x248782=>_0x36d9a7[_0x1f3121(0x1d1)](_0x248782[_0x1f3121(0x1c1)][_0x1f3121(0x242)]))[_0x1f3121(0x250)];return{'projectName':_0x26e70d,'projectId':'(dry-run)','counts':{'agents':_0x350840[_0x1f3121(0x250)],'knowledgeBases':_0x499dcc[_0x1f3121(0x250)],'prompts':_0x1a71ef,'integrations':_0x1866d2['length']},'sourceSite':_0x20741f};}const _0x26b3ef=await this[_0x1f3121(0x264)][_0x1f3121(0x1e5)]({'name':_0x26e70d,'description':_0x80df24[_0x1f3121(0x29e)]['attributes']['description']}),_0x1419d4=_0x26b3ef['id'],_0x8f48b=new Map(),_0x48b8ad=new Map(),_0x4c8510=new Map();for(const _0x57eb6c of _0x499dcc){const _0x2e4789=await this[_0x1f3121(0x264)][_0x1f3121(0x1df)]({'projectId':_0x1419d4,'name':_0x57eb6c['attributes'][_0x1f3121(0x1d9)],'tdDatabaseName':_0x57eb6c[_0x1f3121(0x1c1)]['tdDatabaseName'],'tables':_0x57eb6c[_0x1f3121(0x1c1)][_0x1f3121(0x1e0)]});_0x8f48b[_0x1f3121(0x1e4)](_0x57eb6c['id'],_0x2e4789['id']);}const _0x4f4cd7=[..._0x350840],_0x2f9830=_0x350840[_0x1f3121(0x250)]+0x1;let _0x173cea=0x0;while(_0x4f4cd7[_0x1f3121(0x250)]>0x0&&_0x173cea<_0x2f9830){_0x173cea++;const _0x314be9=[];for(const _0x5857da of _0x4f4cd7){if(canCreateAgent(_0x5857da,_0x48b8ad)){const _0x3e778d=remapToolIds(_0x5857da[_0x1f3121(0x1c1)][_0x1f3121(0x1b7)],_0x8f48b,_0x48b8ad),_0x6440a3=remapVariableIds(_0x5857da['attributes'][_0x1f3121(0x20c)],_0x8f48b),_0x312c79=await this[_0x1f3121(0x264)][_0x1f3121(0x288)]({'name':_0x5857da['attributes'][_0x1f3121(0x1d9)],'projectId':_0x1419d4,'systemPrompt':_0x5857da[_0x1f3121(0x1c1)]['systemPrompt'],'starterMessage':_0x5857da[_0x1f3121(0x1c1)][_0x1f3121(0x2b1)],'modelType':migrateModelType(_0x5857da[_0x1f3121(0x1c1)][_0x1f3121(0x299)]),'maxToolIterations':_0x5857da['attributes'][_0x1f3121(0x274)],'temperature':_0x5857da['attributes'][_0x1f3121(0x212)],'reasoningEffort':_0x5857da[_0x1f3121(0x1c1)]['reasoningEffort'],'outputs':_0x5857da['attributes'][_0x1f3121(0x1bc)],'tools':_0x3e778d,'variables':_0x6440a3});_0x48b8ad[_0x1f3121(0x1e4)](_0x5857da['id'],_0x312c79['id']);}else _0x314be9[_0x1f3121(0x25d)](_0x5857da);}if(_0x314be9['length']===_0x4f4cd7['length'])throw new SDKError(ErrorCode['INTERNAL'],_0x1f3121(0x255),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x4f4cd7['length']=0x0,_0x4f4cd7[_0x1f3121(0x25d)](..._0x314be9);}for(const _0x933a2c of _0x2c39fe){const _0x568ef5=_0x48b8ad['get'](_0x933a2c[_0x1f3121(0x1c1)][_0x1f3121(0x242)]);if(!_0x568ef5)continue;const _0x1e3dd3=await this[_0x1f3121(0x264)][_0x1f3121(0x225)]({'projectId':_0x1419d4,'agentId':_0x568ef5,'name':_0x933a2c['attributes'][_0x1f3121(0x1d9)],'systemPrompt':_0x933a2c[_0x1f3121(0x1c1)][_0x1f3121(0x1c4)],'template':_0x933a2c[_0x1f3121(0x1c1)][_0x1f3121(0x1f0)],'jsonSchemaHint':_0x933a2c[_0x1f3121(0x1c1)]['jsonSchemaHint']});_0x4c8510[_0x1f3121(0x1e4)](_0x933a2c['id'],_0x1e3dd3['id']);}for(const _0x3076f9 of _0x1866d2){const _0x46d3b7=_0x3076f9['attributes'][_0x1f3121(0x220)][_0x1f3121(0x1a6)](_0x4a18e4=>({..._0x4a18e4,'promptId':_0x4c8510[_0x1f3121(0x281)](_0x4a18e4['promptId'])||_0x4a18e4[_0x1f3121(0x271)]}));await this[_0x1f3121(0x264)][_0x1f3121(0x1e6)]({'projectId':_0x1419d4,'serviceType':_0x3076f9[_0x1f3121(0x1c1)][_0x1f3121(0x1ed)],'actions':_0x46d3b7,'slackMessageMode':_0x3076f9['attributes'][_0x1f3121(0x1a9)],'chatIgnoreManagedActions':_0x3076f9[_0x1f3121(0x1c1)][_0x1f3121(0x22a)],'chatWelcomeMessage':_0x3076f9[_0x1f3121(0x1c1)][_0x1f3121(0x241)],'webhookCorsOrigins':_0x3076f9[_0x1f3121(0x1c1)][_0x1f3121(0x238)]});}return{'projectName':_0x26e70d,'projectId':_0x1419d4,'counts':{'agents':_0x48b8ad[_0x1f3121(0x1cf)],'knowledgeBases':_0x8f48b['size'],'prompts':_0x4c8510[_0x1f3121(0x1cf)],'integrations':_0x1866d2[_0x1f3121(0x250)]},'sourceSite':_0x20741f};}[a133_0x496960(0x207)](_0xf16578,_0x149fda){const _0x458d36=a133_0x496960;if(!a133_0x1343de['existsSync'](_0xf16578))return _0x149fda;return JSON[_0x458d36(0x2af)](a133_0x1343de[_0x458d36(0x1cc)](_0xf16578,_0x458d36(0x19a)));}[a133_0x496960(0x1f5)](_0x50cd53){const _0x49f066=a133_0x496960;if(!a133_0x1343de[_0x49f066(0x278)](_0x50cd53))throw new SDKError(ErrorCode[_0x49f066(0x253)],'Backup\x20folder\x20not\x20found:\x20'+_0x50cd53,undefined,{'helpText':_0x49f066(0x1c5)});const _0x5e68e8=a133_0x4bef80[_0x49f066(0x2b4)](_0x50cd53,_0x49f066(0x19d));if(!a133_0x1343de['existsSync'](_0x5e68e8))throw new SDKError(ErrorCode[_0x49f066(0x279)],_0x49f066(0x19b)+_0x50cd53,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x476838=JSON['parse'](a133_0x1343de[_0x49f066(0x1cc)](_0x5e68e8,_0x49f066(0x19a)));if(!isSupportedBackupVersion(_0x476838[_0x49f066(0x231)]))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x49f066(0x27c)+_0x476838[_0x49f066(0x231)],undefined,{'helpText':_0x49f066(0x248)});return _0x476838;}async['pullProject'](_0x41174e,_0x3a3a28,_0xebfaaf){const _0x2c4b86=a133_0x496960,{projectId:_0x34ca53,project:_0x165bf7}=await this[_0x2c4b86(0x294)](_0x41174e),_0x36c27e=_0x165bf7[_0x2c4b86(0x1c1)][_0x2c4b86(0x1d9)];let _0x5249e8;if(_0x3a3a28)_0x5249e8=_0x3a3a28;else{const _0x3c1acb=a133_0x4bef80[_0x2c4b86(0x2b4)](process['cwd'](),'agents'),_0x317fe2=getSanitizedPathWithMigration(_0x3c1acb,_0x36c27e);_0x317fe2[_0x2c4b86(0x1b6)]&&this['logger'][_0x2c4b86(0x1f7)](_0x2c4b86(0x1ef)+a133_0x4bef80[_0x2c4b86(0x293)](_0x317fe2['oldPath'])+'\x20→\x20'+a133_0x4bef80[_0x2c4b86(0x293)](_0x317fe2['path'])),_0x5249e8=_0x317fe2['path'];}const _0x47e571=await this['client'][_0x2c4b86(0x29b)](_0x34ca53),_0x14862d=await this[_0x2c4b86(0x264)][_0x2c4b86(0x1ff)](_0x34ca53),_0x2fbb96=await this[_0x2c4b86(0x264)][_0x2c4b86(0x1cb)](_0x34ca53),_0x2f3737=await safeListOrEmpty(()=>this[_0x2c4b86(0x264)][_0x2c4b86(0x1c7)](_0x34ca53)),_0x41b750=await safeListOrEmpty(()=>this[_0x2c4b86(0x264)][_0x2c4b86(0x223)](_0x34ca53)),_0x4dc2fb=await this[_0x2c4b86(0x264)][_0x2c4b86(0x214)](_0x34ca53),_0x57e04d=await this['client'][_0x2c4b86(0x1fa)](_0x34ca53),_0x1bcfe1=await safeListOrEmpty(()=>this['client'][_0x2c4b86(0x1d3)](_0x34ca53)),_0x60ef9a=await safeListOrEmpty(()=>this['client'][_0x2c4b86(0x29d)](_0x34ca53)),_0x32b7c9=_0x57e04d[_0x2c4b86(0x25a)](_0x33d382=>!_0x33d382[_0x2c4b86(0x1c1)][_0x2c4b86(0x260)]&&SAFE_INTEGRATION_TYPES[_0x2c4b86(0x247)](_0x33d382['attributes']['serviceType'][_0x2c4b86(0x277)]())),_0x1f824d=new Map(),_0x277a5a=new Map(),_0x245941=new Map(),_0x2b4d38=new Map(),_0x29e636=new Map(),_0x14bfe0=new Map(),_0x2322dc=new Map();for(const _0x1228db of _0x47e571){_0x1f824d['set'](_0x1228db['id'],_0x1228db[_0x2c4b86(0x1c1)]['name']);}for(const _0xef2a15 of _0x14862d){_0x277a5a['set'](_0xef2a15['id'],_0xef2a15[_0x2c4b86(0x1c1)][_0x2c4b86(0x1d9)]);}for(const _0x1b8682 of _0x2fbb96){_0x245941[_0x2c4b86(0x1e4)](_0x1b8682['id'],_0x1b8682[_0x2c4b86(0x1c1)][_0x2c4b86(0x1d9)]);}for(const _0x289ef5 of _0x2f3737){_0x2b4d38[_0x2c4b86(0x1e4)](_0x289ef5['id'],_0x289ef5[_0x2c4b86(0x1c1)]['name']);}for(const _0x2de3c of _0x41b750){_0x29e636['set'](_0x2de3c['id'],_0x2de3c[_0x2c4b86(0x1c1)][_0x2c4b86(0x1d9)]);}for(const _0x52eb3d of _0x4dc2fb){_0x14bfe0[_0x2c4b86(0x1e4)](_0x52eb3d['id'],_0x52eb3d[_0x2c4b86(0x1c1)][_0x2c4b86(0x1d9)]);}for(const _0x1155f1 of _0x1bcfe1){_0x2322dc['set'](_0x1155f1['id'],_0x1155f1[_0x2c4b86(0x1c1)][_0x2c4b86(0x1d9)]);}const _0x48a048={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x277a5a,'TextKnowledgeBase':_0x245941,'Agent':_0x1f824d,'WebSearchTool':_0x29e636,'ImageGenerator':_0x2b4d38,'ExperimentalKnowledgeBase':_0x2322dc}),'resolvePromptName':async _0x5abeda=>_0x14bfe0[_0x2c4b86(0x281)](_0x5abeda),'onWarning':_0xf9760c=>this[_0x2c4b86(0x1e2)][_0x2c4b86(0x21f)](_0xf9760c)},_0x46b644={'projectName':_0x36c27e,'outputDir':_0x5249e8,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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}}},_0x4ed8c8=[],_0x12b1a4=[];for(const _0x27f6cf of _0x47e571){const _0x362104=getSanitizedPathWithMigration(_0x5249e8,_0x27f6cf[_0x2c4b86(0x1c1)][_0x2c4b86(0x1d9)]);_0x362104[_0x2c4b86(0x1b6)]&&this[_0x2c4b86(0x1e2)][_0x2c4b86(0x1f7)](_0x2c4b86(0x25f)+a133_0x4bef80[_0x2c4b86(0x293)](_0x362104[_0x2c4b86(0x1a1)])+_0x2c4b86(0x1b1)+a133_0x4bef80[_0x2c4b86(0x293)](_0x362104[_0x2c4b86(0x2a4)]));const _0x33c42d=_0x362104['path'],_0x2327b9=a133_0x4bef80[_0x2c4b86(0x2b4)](_0x33c42d,_0x2c4b86(0x21c)),_0x8f0a77=a133_0x4bef80[_0x2c4b86(0x2b4)](_0x33c42d,_0x2c4b86(0x1a7)),_0x1a3b7d=a133_0x4bef80[_0x2c4b86(0x2b4)](_0x33c42d,_0x2c4b86(0x1b3)),{yaml:_0xb9faea,systemPrompt:_0x5d9396,starterMessage:_0x4c443d}=await agentResponseToDef(_0x27f6cf,_0x48a048),_0xc4af4e=toAgentYamlString(_0xb9faea),_0x1c19f3=!a133_0x1343de['existsSync'](_0x8f0a77);let _0x32129b=_0x1c19f3,_0x2f3cff;if(!_0x1c19f3){const _0xc55e44=a133_0x1343de[_0x2c4b86(0x278)](_0x2327b9)?a133_0x1343de[_0x2c4b86(0x1cc)](_0x2327b9,'utf-8'):'',_0xf9b271=a133_0x1343de[_0x2c4b86(0x1cc)](_0x8f0a77,_0x2c4b86(0x19a)),_0xa86a0b='#\x20prompt.md\x0a'+_0xc55e44+_0x2c4b86(0x29c)+_0xf9b271,_0x412733=_0x2c4b86(0x196)+_0x5d9396+_0x2c4b86(0x29c)+_0xc4af4e,_0x9cb9d0=generateDiff(_0xa86a0b,_0x412733);_0x32129b=hasChanges(_0x9cb9d0),_0x32129b&&(_0x2f3cff=formatDiffWithColors(_0x9cb9d0));}_0x4ed8c8[_0x2c4b86(0x25d)]({'path':_0x33c42d,'content':'','isDir':!![]}),_0x4ed8c8[_0x2c4b86(0x25d)]({'path':_0x2327b9,'content':_0x5d9396}),_0x4ed8c8[_0x2c4b86(0x25d)]({'path':_0x8f0a77,'content':_0xc4af4e});_0x4c443d&&_0x4c443d['includes']('\x0a')&&_0x4ed8c8[_0x2c4b86(0x25d)]({'path':_0x1a3b7d,'content':_0x4c443d});_0x46b644[_0x2c4b86(0x1de)][_0x2c4b86(0x25d)]({'agentName':_0x27f6cf[_0x2c4b86(0x1c1)][_0x2c4b86(0x1d9)],'outputPath':_0x33c42d,'isNew':_0x1c19f3,'hasChanges':_0x32129b,'diff':_0x2f3cff}),_0x46b644[_0x2c4b86(0x261)]['agents'][_0x2c4b86(0x1bd)]++;if(_0x1c19f3)_0x46b644['counts'][_0x2c4b86(0x1de)][_0x2c4b86(0x254)]++;else{if(_0x32129b)_0x46b644['counts'][_0x2c4b86(0x1de)][_0x2c4b86(0x1e7)]++;else _0x46b644['counts'][_0x2c4b86(0x1de)][_0x2c4b86(0x219)]++;}}for(const _0x129191 of _0x14862d){if(_0x129191[_0x2c4b86(0x1c1)][_0x2c4b86(0x260)])continue;const _0x531ca1=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x5249e8),_0x129191['attributes']['name'],_0x2c4b86(0x27d));_0x531ca1['renamed']&&this[_0x2c4b86(0x1e2)][_0x2c4b86(0x1f7)]('Renamed\x20KB\x20file:\x20'+a133_0x4bef80[_0x2c4b86(0x293)](_0x531ca1[_0x2c4b86(0x1a1)])+_0x2c4b86(0x1b1)+a133_0x4bef80['basename'](_0x531ca1[_0x2c4b86(0x2a4)]));const _0x3041bf=_0x531ca1[_0x2c4b86(0x2a4)],_0x5e3db8=apiKnowledgeBaseToYaml(_0x129191),_0x308e58=toKnowledgeBaseYamlString(_0x5e3db8),_0x1b51bd=!a133_0x1343de['existsSync'](_0x3041bf);let _0x213dba=_0x1b51bd,_0x5dab20;if(!_0x1b51bd){const _0x3d2280=a133_0x1343de[_0x2c4b86(0x1cc)](_0x3041bf,_0x2c4b86(0x19a)),_0x379f77=generateDiff(_0x3d2280,_0x308e58);_0x213dba=hasChanges(_0x379f77),_0x213dba&&(_0x5dab20=formatDiffWithColors(_0x379f77));}_0x4ed8c8['push']({'path':_0x3041bf,'content':_0x308e58}),_0x46b644[_0x2c4b86(0x201)][_0x2c4b86(0x25d)]({'name':_0x129191[_0x2c4b86(0x1c1)][_0x2c4b86(0x1d9)],'outputPath':_0x3041bf,'isNew':_0x1b51bd,'hasChanges':_0x213dba,'diff':_0x5dab20}),_0x46b644[_0x2c4b86(0x261)]['knowledgeBases'][_0x2c4b86(0x1bd)]++;if(_0x1b51bd)_0x46b644['counts'][_0x2c4b86(0x201)][_0x2c4b86(0x254)]++;else{if(_0x213dba)_0x46b644[_0x2c4b86(0x261)]['knowledgeBases'][_0x2c4b86(0x1e7)]++;else _0x46b644[_0x2c4b86(0x261)]['knowledgeBases'][_0x2c4b86(0x219)]++;}}for(const _0x5b00a0 of _0x2fbb96){if(_0x5b00a0[_0x2c4b86(0x1c1)][_0x2c4b86(0x260)])continue;const _0xaf2895=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x5249e8),_0x5b00a0[_0x2c4b86(0x1c1)][_0x2c4b86(0x1d9)],'.md');_0xaf2895[_0x2c4b86(0x1b6)]&&this[_0x2c4b86(0x1e2)][_0x2c4b86(0x1f7)](_0x2c4b86(0x256)+a133_0x4bef80[_0x2c4b86(0x293)](_0xaf2895[_0x2c4b86(0x1a1)])+'\x20→\x20'+a133_0x4bef80[_0x2c4b86(0x293)](_0xaf2895[_0x2c4b86(0x2a4)]));const _0x314598=_0xaf2895[_0x2c4b86(0x2a4)],_0x20660d=toTextKnowledgeBaseMd(_0x5b00a0[_0x2c4b86(0x1c1)][_0x2c4b86(0x1d9)],_0x5b00a0[_0x2c4b86(0x1c1)][_0x2c4b86(0x1d6)]),_0x4f1a7e=!a133_0x1343de['existsSync'](_0x314598);let _0x53d8d9=_0x4f1a7e,_0x18abb5;if(!_0x4f1a7e){const _0x2aca49=a133_0x1343de['readFileSync'](_0x314598,_0x2c4b86(0x19a)),_0x57ee02=generateDiff(_0x2aca49,_0x20660d);_0x53d8d9=hasChanges(_0x57ee02),_0x53d8d9&&(_0x18abb5=formatDiffWithColors(_0x57ee02));}_0x4ed8c8[_0x2c4b86(0x25d)]({'path':_0x314598,'content':_0x20660d}),_0x46b644[_0x2c4b86(0x257)][_0x2c4b86(0x25d)]({'name':_0x5b00a0[_0x2c4b86(0x1c1)][_0x2c4b86(0x1d9)],'outputPath':_0x314598,'isNew':_0x4f1a7e,'hasChanges':_0x53d8d9,'diff':_0x18abb5}),_0x46b644['counts'][_0x2c4b86(0x257)]['total']++;if(_0x4f1a7e)_0x46b644[_0x2c4b86(0x261)][_0x2c4b86(0x257)]['new']++;else{if(_0x53d8d9)_0x46b644['counts']['textKnowledgeBases'][_0x2c4b86(0x1e7)]++;else _0x46b644['counts']['textKnowledgeBases'][_0x2c4b86(0x219)]++;}}for(const _0x557338 of _0x4dc2fb){if(_0x557338[_0x2c4b86(0x1c1)]['isManaged'])continue;const _0x5ad7c8=getSanitizedPathWithMigration(getPromptsDir(_0x5249e8),_0x557338[_0x2c4b86(0x1c1)]['name'],'.yml');_0x5ad7c8['renamed']&&this['logger']['info'](_0x2c4b86(0x28a)+a133_0x4bef80[_0x2c4b86(0x293)](_0x5ad7c8[_0x2c4b86(0x1a1)])+_0x2c4b86(0x1b1)+a133_0x4bef80['basename'](_0x5ad7c8[_0x2c4b86(0x2a4)]));const _0x5aa5c2=_0x5ad7c8[_0x2c4b86(0x2a4)],_0xdcc96b=await apiPromptToYaml(_0x557338,_0x48a048);if(!_0xdcc96b)continue;const _0x3c6106=toPromptYamlString(_0xdcc96b),_0x3f41f7=!a133_0x1343de[_0x2c4b86(0x278)](_0x5aa5c2);let _0x3025a0=_0x3f41f7,_0x27db38;if(!_0x3f41f7){const _0x238ae2=a133_0x1343de['readFileSync'](_0x5aa5c2,_0x2c4b86(0x19a)),_0x57f93d=generateDiff(_0x238ae2,_0x3c6106);_0x3025a0=hasChanges(_0x57f93d),_0x3025a0&&(_0x27db38=formatDiffWithColors(_0x57f93d));}_0x4ed8c8[_0x2c4b86(0x25d)]({'path':_0x5aa5c2,'content':_0x3c6106}),_0x46b644[_0x2c4b86(0x1a0)][_0x2c4b86(0x25d)]({'name':_0x557338[_0x2c4b86(0x1c1)][_0x2c4b86(0x1d9)],'outputPath':_0x5aa5c2,'isNew':_0x3f41f7,'hasChanges':_0x3025a0,'diff':_0x27db38}),_0x46b644['counts'][_0x2c4b86(0x1a0)][_0x2c4b86(0x1bd)]++;if(_0x3f41f7)_0x46b644[_0x2c4b86(0x261)][_0x2c4b86(0x1a0)][_0x2c4b86(0x254)]++;else{if(_0x3025a0)_0x46b644[_0x2c4b86(0x261)][_0x2c4b86(0x1a0)]['updated']++;else _0x46b644[_0x2c4b86(0x261)]['prompts'][_0x2c4b86(0x219)]++;}}for(const _0x25d736 of _0x32b7c9){const _0x5cc660=_0x25d736[_0x2c4b86(0x1c1)]['serviceType'][_0x2c4b86(0x277)](),_0x29f2e2=getSanitizedPathWithMigration(getIntegrationsDir(_0x5249e8),_0x5cc660,'.yml');_0x29f2e2['renamed']&&this[_0x2c4b86(0x1e2)][_0x2c4b86(0x1f7)](_0x2c4b86(0x276)+a133_0x4bef80['basename'](_0x29f2e2[_0x2c4b86(0x1a1)])+_0x2c4b86(0x1b1)+a133_0x4bef80['basename'](_0x29f2e2[_0x2c4b86(0x2a4)]));const _0x119bec=_0x29f2e2[_0x2c4b86(0x2a4)],_0x4a6ce8=await apiIntegrationToYaml(_0x25d736,_0x48a048),_0x3ce28a=toIntegrationYamlString(_0x4a6ce8),_0x642479=!a133_0x1343de[_0x2c4b86(0x278)](_0x119bec);let _0x2d9314=_0x642479,_0x346a70;if(!_0x642479){const _0x28c000=a133_0x1343de[_0x2c4b86(0x1cc)](_0x119bec,'utf-8'),_0x7c11fe=generateDiff(_0x28c000,_0x3ce28a);_0x2d9314=hasChanges(_0x7c11fe),_0x2d9314&&(_0x346a70=formatDiffWithColors(_0x7c11fe));}_0x4ed8c8[_0x2c4b86(0x25d)]({'path':_0x119bec,'content':_0x3ce28a}),_0x46b644[_0x2c4b86(0x26c)][_0x2c4b86(0x25d)]({'name':_0x5cc660,'outputPath':_0x119bec,'isNew':_0x642479,'hasChanges':_0x2d9314,'diff':_0x346a70}),_0x46b644[_0x2c4b86(0x261)][_0x2c4b86(0x26c)][_0x2c4b86(0x1bd)]++;if(_0x642479)_0x46b644[_0x2c4b86(0x261)][_0x2c4b86(0x26c)][_0x2c4b86(0x254)]++;else{if(_0x2d9314)_0x46b644[_0x2c4b86(0x261)][_0x2c4b86(0x26c)][_0x2c4b86(0x1e7)]++;else _0x46b644[_0x2c4b86(0x261)][_0x2c4b86(0x26c)][_0x2c4b86(0x219)]++;}}for(const _0x4b6659 of _0x1bcfe1){if(_0x4b6659[_0x2c4b86(0x1c1)]['isManaged'])continue;const _0xe6c607=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x5249e8),_0x4b6659[_0x2c4b86(0x1c1)][_0x2c4b86(0x1d9)]);_0xe6c607[_0x2c4b86(0x1b6)]&&this['logger'][_0x2c4b86(0x1f7)](_0x2c4b86(0x1a3)+a133_0x4bef80[_0x2c4b86(0x293)](_0xe6c607[_0x2c4b86(0x1a1)])+_0x2c4b86(0x1b1)+a133_0x4bef80[_0x2c4b86(0x293)](_0xe6c607['path']));const _0x35025d=_0xe6c607[_0x2c4b86(0x2a4)],_0x681201=a133_0x4bef80[_0x2c4b86(0x2b4)](_0x35025d,sanitizeForFilesystem(_0x4b6659[_0x2c4b86(0x1c1)][_0x2c4b86(0x1d9)])+_0x2c4b86(0x27d)),_0x190e14=a133_0x4bef80['join'](_0x35025d,_0x2c4b86(0x197)),_0x44f66a=apiExperimentalKnowledgeBaseToYaml(_0x4b6659),_0x3e9310=toExperimentalKnowledgeBaseYamlString(_0x44f66a),_0x230586=!a133_0x1343de['existsSync'](_0x35025d);let _0x537c76=_0x230586,_0x435cc0,_0x1bb177=_0x3e9310;const _0x11c176=[..._0x44f66a['functions']][_0x2c4b86(0x1d8)]((_0x10adb3,_0x7e36d1)=>_0x10adb3['name'][_0x2c4b86(0x232)](_0x7e36d1[_0x2c4b86(0x1d9)]));for(const _0x5f2c69 of _0x11c176){_0x1bb177+=_0x2c4b86(0x251)+_0x5f2c69[_0x2c4b86(0x1d9)]+'\x20---\x0a'+_0x5f2c69['code']+_0x2c4b86(0x237)+_0x5f2c69['name']+_0x2c4b86(0x2a9)+_0x5f2c69['json_schema']+'\x0a';}if(!_0x230586){let _0x447a74='';a133_0x1343de['existsSync'](_0x681201)&&(_0x447a74=a133_0x1343de[_0x2c4b86(0x1cc)](_0x681201,_0x2c4b86(0x19a)));if(a133_0x1343de['existsSync'](_0x190e14)){const _0x11a704=a133_0x1343de[_0x2c4b86(0x1fc)](_0x190e14,{'withFileTypes':!![]}),_0x2c3c04=_0x11a704[_0x2c4b86(0x25a)](_0x499503=>_0x499503[_0x2c4b86(0x21a)]())[_0x2c4b86(0x1d8)]((_0x529f39,_0x225369)=>_0x529f39[_0x2c4b86(0x1d9)][_0x2c4b86(0x232)](_0x225369['name']));for(const _0x3b81bd of _0x2c3c04){const _0x18a644=a133_0x4bef80[_0x2c4b86(0x2b4)](_0x190e14,_0x3b81bd[_0x2c4b86(0x1d9)],_0x2c4b86(0x2a7)),_0x5a4dd7=a133_0x4bef80[_0x2c4b86(0x2b4)](_0x190e14,_0x3b81bd[_0x2c4b86(0x1d9)],_0x2c4b86(0x23e));a133_0x1343de[_0x2c4b86(0x278)](_0x18a644)&&(_0x447a74+=_0x2c4b86(0x251)+_0x3b81bd[_0x2c4b86(0x1d9)]+_0x2c4b86(0x2a9)+a133_0x1343de[_0x2c4b86(0x1cc)](_0x18a644,_0x2c4b86(0x19a))+'\x0a'),a133_0x1343de[_0x2c4b86(0x278)](_0x5a4dd7)&&(_0x447a74+='---\x20schema:\x20'+_0x3b81bd[_0x2c4b86(0x1d9)]+_0x2c4b86(0x2a9)+a133_0x1343de[_0x2c4b86(0x1cc)](_0x5a4dd7,_0x2c4b86(0x19a))+'\x0a');}}const _0x208097=generateDiff(_0x447a74,_0x1bb177);_0x537c76=hasChanges(_0x208097),_0x537c76&&(_0x435cc0=formatDiffWithColors(_0x208097));}_0x4ed8c8[_0x2c4b86(0x25d)]({'path':_0x35025d,'content':'','isDir':!![]}),_0x4ed8c8['push']({'path':_0x681201,'content':_0x3e9310}),_0x4ed8c8['push']({'path':_0x190e14,'content':'','isDir':!![]});for(const _0x2f90ea of _0x44f66a[_0x2c4b86(0x197)]){const _0x1dfb25=a133_0x4bef80['join'](_0x190e14,sanitizeForFilesystem(_0x2f90ea[_0x2c4b86(0x1d9)])),_0x4fd33c=a133_0x4bef80[_0x2c4b86(0x2b4)](_0x1dfb25,'code.js'),_0x35e34a=a133_0x4bef80['join'](_0x1dfb25,'json_schema.json');_0x4ed8c8['push']({'path':_0x1dfb25,'content':'','isDir':!![]}),_0x4ed8c8[_0x2c4b86(0x25d)]({'path':_0x4fd33c,'content':_0x2f90ea['code']}),_0x4ed8c8['push']({'path':_0x35e34a,'content':_0x2f90ea['json_schema']});}if(a133_0x1343de['existsSync'](_0x190e14)){const _0xddfc7a=a133_0x1343de['readdirSync'](_0x190e14,{'withFileTypes':!![]}),_0x577666=new Set(_0x44f66a[_0x2c4b86(0x197)][_0x2c4b86(0x1a6)](_0x54febc=>sanitizeForFilesystem(_0x54febc[_0x2c4b86(0x1d9)])));for(const _0x12abe6 of _0xddfc7a){if(_0x12abe6[_0x2c4b86(0x21a)]()&&!_0x577666[_0x2c4b86(0x1d1)](_0x12abe6['name'])){const _0x5bf627=a133_0x4bef80['join'](_0x190e14,_0x12abe6[_0x2c4b86(0x1d9)]);_0x12b1a4['push']({'path':_0x5bf627,'isDir':!![]});}}}_0x46b644[_0x2c4b86(0x1f3)][_0x2c4b86(0x25d)]({'name':_0x4b6659[_0x2c4b86(0x1c1)][_0x2c4b86(0x1d9)],'outputPath':_0x35025d,'isNew':_0x230586,'hasChanges':_0x537c76,'diff':_0x435cc0}),_0x46b644[_0x2c4b86(0x261)][_0x2c4b86(0x1f3)]['total']++;if(_0x230586)_0x46b644[_0x2c4b86(0x261)][_0x2c4b86(0x1f3)][_0x2c4b86(0x254)]++;else{if(_0x537c76)_0x46b644[_0x2c4b86(0x261)][_0x2c4b86(0x1f3)]['updated']++;else _0x46b644[_0x2c4b86(0x261)][_0x2c4b86(0x1f3)]['unchanged']++;}}for(const _0x15faf6 of _0x60ef9a){if(_0x15faf6['attributes'][_0x2c4b86(0x260)])continue;const _0x5ed5a7=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x5249e8),_0x15faf6['attributes'][_0x2c4b86(0x1d9)]);_0x5ed5a7[_0x2c4b86(0x1b6)]&&this[_0x2c4b86(0x1e2)][_0x2c4b86(0x1f7)]('Renamed\x20experimental\x20artifact\x20directory:\x20'+a133_0x4bef80[_0x2c4b86(0x293)](_0x5ed5a7[_0x2c4b86(0x1a1)])+_0x2c4b86(0x1b1)+a133_0x4bef80['basename'](_0x5ed5a7[_0x2c4b86(0x2a4)]));const _0x45ed4f=_0x5ed5a7[_0x2c4b86(0x2a4)],_0x23eb39=a133_0x4bef80[_0x2c4b86(0x2b4)](_0x45ed4f,sanitizeForFilesystem(_0x15faf6['attributes'][_0x2c4b86(0x1d9)])+'.yml'),_0x51685c=a133_0x4bef80[_0x2c4b86(0x2b4)](_0x45ed4f,_0x2c4b86(0x2a7)),_0xba9e74=a133_0x4bef80[_0x2c4b86(0x2b4)](_0x45ed4f,'files'),_0x2a2469=apiExperimentalArtifactToYaml(_0x15faf6),_0x329f53=toExperimentalArtifactYamlString(_0x2a2469),_0xe1c0ca=!a133_0x1343de[_0x2c4b86(0x278)](_0x45ed4f);let _0x3f9917=_0xe1c0ca,_0xa06e6e,_0x2f7446=_0x329f53+('\x0a---\x20code\x20---\x0a'+_0x2a2469[_0x2c4b86(0x22d)]+'\x0a');const _0x1efbd2=[..._0x2a2469[_0x2c4b86(0x210)]][_0x2c4b86(0x1d8)]((_0xa6b4be,_0x3ec250)=>_0xa6b4be[_0x2c4b86(0x1a5)]['localeCompare'](_0x3ec250[_0x2c4b86(0x1a5)]));for(const _0x5852d8 of _0x1efbd2){_0x2f7446+='---\x20file:\x20'+_0x5852d8[_0x2c4b86(0x1a5)]+_0x2c4b86(0x2a9)+_0x5852d8[_0x2c4b86(0x28f)]+'\x0a';}if(!_0xe1c0ca){let _0x1d3df='';a133_0x1343de[_0x2c4b86(0x278)](_0x23eb39)&&(_0x1d3df=a133_0x1343de[_0x2c4b86(0x1cc)](_0x23eb39,_0x2c4b86(0x19a)));a133_0x1343de[_0x2c4b86(0x278)](_0x51685c)&&(_0x1d3df+='\x0a---\x20code\x20---\x0a'+a133_0x1343de[_0x2c4b86(0x1cc)](_0x51685c,_0x2c4b86(0x19a))+'\x0a');if(a133_0x1343de[_0x2c4b86(0x278)](_0xba9e74)){const _0x4271e4=a133_0x1343de[_0x2c4b86(0x1fc)](_0xba9e74),_0x29b507=_0x4271e4['filter'](_0x1fd368=>{const _0x3d77d9=_0x2c4b86,_0x3b2aec=a133_0x4bef80[_0x3d77d9(0x2b4)](_0xba9e74,_0x1fd368);return a133_0x1343de['statSync'](_0x3b2aec)[_0x3d77d9(0x236)]();})[_0x2c4b86(0x1d8)]((_0x289dd6,_0x132e51)=>_0x289dd6[_0x2c4b86(0x232)](_0x132e51));for(const _0x82b0b6 of _0x29b507){const _0x42c6e2=a133_0x4bef80[_0x2c4b86(0x2b4)](_0xba9e74,_0x82b0b6);_0x1d3df+=_0x2c4b86(0x246)+_0x82b0b6+_0x2c4b86(0x2a9)+a133_0x1343de[_0x2c4b86(0x1cc)](_0x42c6e2,'utf-8')+'\x0a';}}const _0x138dae=generateDiff(_0x1d3df,_0x2f7446);_0x3f9917=hasChanges(_0x138dae),_0x3f9917&&(_0xa06e6e=formatDiffWithColors(_0x138dae));}_0x4ed8c8['push']({'path':_0x45ed4f,'content':'','isDir':!![]}),_0x4ed8c8[_0x2c4b86(0x25d)]({'path':_0x23eb39,'content':_0x329f53}),_0x4ed8c8[_0x2c4b86(0x25d)]({'path':_0x51685c,'content':_0x2a2469[_0x2c4b86(0x22d)]});if(_0x2a2469['files'][_0x2c4b86(0x250)]>0x0){_0x4ed8c8[_0x2c4b86(0x25d)]({'path':_0xba9e74,'content':'','isDir':!![]});for(const _0x1f613e of _0x2a2469[_0x2c4b86(0x210)]){const _0x5242e3=a133_0x4bef80['join'](_0xba9e74,_0x1f613e[_0x2c4b86(0x1a5)]);_0x4ed8c8[_0x2c4b86(0x25d)]({'path':_0x5242e3,'content':_0x1f613e[_0x2c4b86(0x28f)]});}}if(a133_0x1343de[_0x2c4b86(0x278)](_0xba9e74)){const _0x6d292c=a133_0x1343de['readdirSync'](_0xba9e74),_0x56b471=new Set(_0x2a2469[_0x2c4b86(0x210)][_0x2c4b86(0x1a6)](_0x3cc3a8=>_0x3cc3a8[_0x2c4b86(0x1a5)]));for(const _0x2e01d5 of _0x6d292c){const _0x228dea=a133_0x4bef80['join'](_0xba9e74,_0x2e01d5);a133_0x1343de[_0x2c4b86(0x2ac)](_0x228dea)[_0x2c4b86(0x236)]()&&!_0x56b471['has'](_0x2e01d5)&&_0x12b1a4['push']({'path':_0x228dea});}}_0x46b644[_0x2c4b86(0x2b0)][_0x2c4b86(0x25d)]({'name':_0x15faf6[_0x2c4b86(0x1c1)]['name'],'outputPath':_0x45ed4f,'isNew':_0xe1c0ca,'hasChanges':_0x3f9917,'diff':_0xa06e6e}),_0x46b644[_0x2c4b86(0x261)][_0x2c4b86(0x2b0)][_0x2c4b86(0x1bd)]++;if(_0xe1c0ca)_0x46b644[_0x2c4b86(0x261)][_0x2c4b86(0x2b0)][_0x2c4b86(0x254)]++;else{if(_0x3f9917)_0x46b644['counts']['experimentalArtifacts'][_0x2c4b86(0x1e7)]++;else _0x46b644[_0x2c4b86(0x261)]['experimentalArtifacts']['unchanged']++;}}if(_0xebfaaf?.[_0x2c4b86(0x22c)])return _0x46b644;a133_0x1343de['mkdirSync'](_0x5249e8,{'recursive':!![]}),a133_0x1343de[_0x2c4b86(0x23d)](getKnowledgeBasesDir(_0x5249e8),{'recursive':!![]}),a133_0x1343de[_0x2c4b86(0x23d)](getPromptsDir(_0x5249e8),{'recursive':!![]}),a133_0x1343de['mkdirSync'](getIntegrationsDir(_0x5249e8),{'recursive':!![]}),a133_0x1343de[_0x2c4b86(0x23d)](getExperimentalKnowledgeBasesDir(_0x5249e8),{'recursive':!![]}),a133_0x1343de[_0x2c4b86(0x23d)](getExperimentalArtifactsDir(_0x5249e8),{'recursive':!![]});const _0x349167=a133_0x4bef80[_0x2c4b86(0x2b4)](_0x5249e8,'tdx.json');a133_0x1343de['writeFileSync'](_0x349167,createAgentConfigContent(_0x36c27e));for(const _0x20fb08 of _0x4ed8c8){if(_0x20fb08[_0x2c4b86(0x23a)])a133_0x1343de['mkdirSync'](_0x20fb08['path'],{'recursive':!![]});else{const _0x24337c=a133_0x4bef80['dirname'](_0x20fb08[_0x2c4b86(0x2a4)]);!a133_0x1343de[_0x2c4b86(0x278)](_0x24337c)&&a133_0x1343de[_0x2c4b86(0x23d)](_0x24337c,{'recursive':!![]}),a133_0x1343de[_0x2c4b86(0x2ae)](_0x20fb08[_0x2c4b86(0x2a4)],_0x20fb08[_0x2c4b86(0x19f)]);}}for(const _0x13676c of _0x12b1a4){_0x13676c['isDir']?(a133_0x1343de['rmSync'](_0x13676c[_0x2c4b86(0x2a4)],{'recursive':!![],'force':!![]}),this['logger']['info'](_0x2c4b86(0x25b)+a133_0x4bef80[_0x2c4b86(0x293)](a133_0x4bef80[_0x2c4b86(0x226)](_0x13676c[_0x2c4b86(0x2a4)]))+'/'+a133_0x4bef80[_0x2c4b86(0x293)](_0x13676c[_0x2c4b86(0x2a4)]))):(a133_0x1343de[_0x2c4b86(0x217)](_0x13676c[_0x2c4b86(0x2a4)],{'force':!![]}),this[_0x2c4b86(0x1e2)][_0x2c4b86(0x1f7)](_0x2c4b86(0x270)+a133_0x4bef80['basename'](a133_0x4bef80[_0x2c4b86(0x226)](_0x13676c[_0x2c4b86(0x2a4)]))+'/'+a133_0x4bef80['basename'](_0x13676c[_0x2c4b86(0x2a4)])));}return _0x46b644;}async[a133_0x496960(0x1b4)](_0x1b9e4d,_0x4af6fa){const _0x2e10c2=a133_0x496960,_0x4bc627=a133_0x4bef80['join'](_0x1b9e4d,_0x2e10c2(0x202));if(!a133_0x1343de[_0x2e10c2(0x278)](_0x4bc627))throw new SDKError(ErrorCode[_0x2e10c2(0x279)],_0x2e10c2(0x1f9)+_0x1b9e4d,undefined,{'helpText':_0x2e10c2(0x1f8)});const _0x170f4f=loadAgentConfig(_0x4bc627),_0xb69d11=await this['resolveProjectId'](_0x170f4f[_0x2e10c2(0x22f)]),_0xd342d5=await this[_0x2e10c2(0x264)][_0x2e10c2(0x244)](_0xb69d11),_0x27e997=_0xd342d5[_0x2e10c2(0x1c1)][_0x2e10c2(0x1d9)],_0x28fbd1={'projectName':_0x27e997,'projectId':_0xb69d11,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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}}},_0x27a775=[],_0xf6afb7=[],_0x39ff32=[],_0x5f4b52=[],_0x8e7e02=[],_0x8cbeec=[],_0x33bebd=a133_0x1343de['readdirSync'](_0x1b9e4d,{'withFileTypes':!![]});for(const _0x518bc4 of _0x33bebd){if(!_0x518bc4[_0x2e10c2(0x21a)]())continue;if([_0x2e10c2(0x1ca),_0x2e10c2(0x1a0),_0x2e10c2(0x26c),'experimental_knowledge_bases',_0x2e10c2(0x24a)][_0x2e10c2(0x247)](_0x518bc4[_0x2e10c2(0x1d9)]))continue;const _0x388855=a133_0x4bef80[_0x2e10c2(0x2b4)](_0x1b9e4d,_0x518bc4[_0x2e10c2(0x1d9)]);if(isAgentDir(_0x388855)){const _0x5c8788=a133_0x4bef80[_0x2e10c2(0x2b4)](_0x388855,_0x2e10c2(0x1a7)),_0x322597=a133_0x4bef80[_0x2e10c2(0x2b4)](_0x388855,_0x2e10c2(0x21c)),_0x3ead8f=a133_0x4bef80[_0x2e10c2(0x2b4)](_0x388855,_0x2e10c2(0x1b3)),_0x539f65=parseAgentYaml(a133_0x1343de[_0x2e10c2(0x1cc)](_0x5c8788,'utf-8'),_0x5c8788),_0x1de252=a133_0x1343de[_0x2e10c2(0x278)](_0x322597)?a133_0x1343de[_0x2e10c2(0x1cc)](_0x322597,_0x2e10c2(0x19a)):'',_0x37e34e=a133_0x1343de['existsSync'](_0x3ead8f)?a133_0x1343de[_0x2e10c2(0x1cc)](_0x3ead8f,_0x2e10c2(0x19a)):_0x539f65[_0x2e10c2(0x1d5)];_0x27a775[_0x2e10c2(0x25d)]({'name':_0x539f65[_0x2e10c2(0x1d9)],'dir':_0x388855,'yaml':_0x539f65,'systemPrompt':_0x1de252,'starterMessage':_0x37e34e});}}const _0x4aedd9=getKnowledgeBasesDir(_0x1b9e4d);if(a133_0x1343de[_0x2e10c2(0x278)](_0x4aedd9)){const _0x8597db=a133_0x1343de['readdirSync'](_0x4aedd9);for(const _0x21df31 of _0x8597db){const _0x50639d=a133_0x4bef80[_0x2e10c2(0x2b4)](_0x4aedd9,_0x21df31);if(_0x21df31[_0x2e10c2(0x1f1)](_0x2e10c2(0x27d))){const _0x22506f=parseKnowledgeBaseYaml(a133_0x1343de[_0x2e10c2(0x1cc)](_0x50639d,_0x2e10c2(0x19a)),_0x50639d);_0xf6afb7[_0x2e10c2(0x25d)]({'name':_0x22506f[_0x2e10c2(0x1d9)],'path':_0x50639d,'yaml':_0x22506f});}else{if(_0x21df31[_0x2e10c2(0x1f1)](_0x2e10c2(0x215))){const _0x5258b6=a133_0x1343de['readFileSync'](_0x50639d,_0x2e10c2(0x19a)),{name:_0x239fae,text:_0x476eca}=parseTextKnowledgeBaseMd(_0x5258b6,_0x21df31);_0x39ff32['push']({'name':_0x239fae,'path':_0x50639d,'text':_0x476eca});}}}}const _0x24c83d=getPromptsDir(_0x1b9e4d);if(a133_0x1343de[_0x2e10c2(0x278)](_0x24c83d)){const _0x64a0f=a133_0x1343de[_0x2e10c2(0x1fc)](_0x24c83d)['filter'](_0x2dce8f=>_0x2dce8f[_0x2e10c2(0x1f1)]('.yml'));for(const _0xbb08b of _0x64a0f){const _0x4c6cea=a133_0x4bef80[_0x2e10c2(0x2b4)](_0x24c83d,_0xbb08b),_0x2169c8=parsePromptYaml(a133_0x1343de[_0x2e10c2(0x1cc)](_0x4c6cea,_0x2e10c2(0x19a)),_0x4c6cea);_0x5f4b52['push']({'name':_0x2169c8['name'],'path':_0x4c6cea,'yaml':_0x2169c8});}}const _0x1370d2=[],_0x20bd45=getIntegrationsDir(_0x1b9e4d);if(a133_0x1343de['existsSync'](_0x20bd45)){const _0x5900ee=a133_0x1343de[_0x2e10c2(0x1fc)](_0x20bd45)['filter'](_0x508354=>_0x508354[_0x2e10c2(0x1f1)](_0x2e10c2(0x27d)));for(const _0x29afde of _0x5900ee){const _0x511a62=a133_0x4bef80[_0x2e10c2(0x2b4)](_0x20bd45,_0x29afde),_0x175769=parseIntegrationYaml(a133_0x1343de['readFileSync'](_0x511a62,_0x2e10c2(0x19a)),_0x511a62);if(!SAFE_INTEGRATION_TYPES[_0x2e10c2(0x247)](_0x175769[_0x2e10c2(0x1ce)][_0x2e10c2(0x277)]())){this['logger'][_0x2e10c2(0x21f)](_0x2e10c2(0x27b)+_0x175769[_0x2e10c2(0x1d9)]+_0x2e10c2(0x1b9)+_0x175769[_0x2e10c2(0x1ce)]+_0x2e10c2(0x24d)+(_0x2e10c2(0x1ac)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x2e10c2(0x1ba))+_0x2e10c2(0x28e));continue;}_0x1370d2[_0x2e10c2(0x25d)]({'name':_0x175769[_0x2e10c2(0x1d9)],'path':_0x511a62,'yaml':_0x175769});}}const _0x59ec2f=getExperimentalKnowledgeBasesDir(_0x1b9e4d);if(a133_0x1343de[_0x2e10c2(0x278)](_0x59ec2f)){const _0x393fa5=a133_0x1343de[_0x2e10c2(0x1fc)](_0x59ec2f,{'withFileTypes':!![]});for(const _0x574837 of _0x393fa5){if(!_0x574837[_0x2e10c2(0x21a)]())continue;const _0x18a1e0=a133_0x4bef80['join'](_0x59ec2f,_0x574837[_0x2e10c2(0x1d9)]),_0x54641a=a133_0x4bef80[_0x2e10c2(0x2b4)](_0x18a1e0,_0x574837['name']+_0x2e10c2(0x27d)),_0x48b5e3=a133_0x4bef80['join'](_0x18a1e0,_0x2e10c2(0x197));if(!a133_0x1343de[_0x2e10c2(0x278)](_0x54641a))continue;const _0x40e62a=parseExperimentalKnowledgeBaseYaml(a133_0x1343de[_0x2e10c2(0x1cc)](_0x54641a,'utf-8'),_0x54641a),_0x13dc35=[];if(a133_0x1343de[_0x2e10c2(0x278)](_0x48b5e3)){const _0x52b20e=a133_0x1343de[_0x2e10c2(0x1fc)](_0x48b5e3,{'withFileTypes':!![]});for(const _0x19e472 of _0x52b20e){if(!_0x19e472[_0x2e10c2(0x21a)]())continue;const _0x4d2230=a133_0x4bef80['join'](_0x48b5e3,_0x19e472['name']),_0xb9e35f=a133_0x4bef80[_0x2e10c2(0x2b4)](_0x4d2230,_0x2e10c2(0x2a7)),_0x57d55e=a133_0x4bef80['join'](_0x4d2230,_0x2e10c2(0x23e));a133_0x1343de['existsSync'](_0xb9e35f)&&a133_0x1343de['existsSync'](_0x57d55e)&&_0x13dc35[_0x2e10c2(0x25d)]({'name':_0x19e472[_0x2e10c2(0x1d9)],'code':a133_0x1343de['readFileSync'](_0xb9e35f,'utf-8'),'json_schema':a133_0x1343de[_0x2e10c2(0x1cc)](_0x57d55e,_0x2e10c2(0x19a))});}}const _0x5dcd21={..._0x40e62a,'variables':_0x40e62a[_0x2e10c2(0x20c)]||[],'functions':_0x13dc35};_0x8e7e02[_0x2e10c2(0x25d)]({'name':_0x40e62a[_0x2e10c2(0x1d9)],'dir':_0x18a1e0,'def':_0x5dcd21});}}const _0xb85ead=getExperimentalArtifactsDir(_0x1b9e4d);if(a133_0x1343de['existsSync'](_0xb85ead)){const _0x541560=a133_0x1343de[_0x2e10c2(0x1fc)](_0xb85ead,{'withFileTypes':!![]});for(const _0x56f02f of _0x541560){if(!_0x56f02f[_0x2e10c2(0x21a)]())continue;const _0xe3c869=a133_0x4bef80[_0x2e10c2(0x2b4)](_0xb85ead,_0x56f02f[_0x2e10c2(0x1d9)]),_0x7659ac=a133_0x4bef80['join'](_0xe3c869,_0x56f02f[_0x2e10c2(0x1d9)]+_0x2e10c2(0x27d)),_0x5ca25f=a133_0x4bef80[_0x2e10c2(0x2b4)](_0xe3c869,'code.js'),_0x240623=a133_0x4bef80[_0x2e10c2(0x2b4)](_0xe3c869,_0x2e10c2(0x210));if(!a133_0x1343de[_0x2e10c2(0x278)](_0x7659ac)||!a133_0x1343de['existsSync'](_0x5ca25f))continue;const _0x437332=parseExperimentalArtifactYaml(a133_0x1343de[_0x2e10c2(0x1cc)](_0x7659ac,_0x2e10c2(0x19a)),_0x7659ac),_0x40c57b=a133_0x1343de[_0x2e10c2(0x1cc)](_0x5ca25f,_0x2e10c2(0x19a)),_0x484250=[];if(a133_0x1343de[_0x2e10c2(0x278)](_0x240623)){const _0x52b687=a133_0x1343de[_0x2e10c2(0x1fc)](_0x240623);for(const _0xb485dc of _0x52b687){const _0x5ea761=a133_0x4bef80[_0x2e10c2(0x2b4)](_0x240623,_0xb485dc);a133_0x1343de[_0x2e10c2(0x2ac)](_0x5ea761)[_0x2e10c2(0x236)]()&&_0x484250[_0x2e10c2(0x25d)]({'file_name':_0xb485dc,'text_content':a133_0x1343de[_0x2e10c2(0x1cc)](_0x5ea761,_0x2e10c2(0x19a))});}}const _0x4e3499={..._0x437332,'code':_0x40c57b,'files':_0x484250};_0x8cbeec[_0x2e10c2(0x25d)]({'name':_0x437332[_0x2e10c2(0x1d9)],'dir':_0xe3c869,'def':_0x4e3499});}}const _0x1ccda9=await this[_0x2e10c2(0x264)][_0x2e10c2(0x29b)](_0xb69d11),_0x2d0b11=await this[_0x2e10c2(0x264)][_0x2e10c2(0x1ff)](_0xb69d11),_0xe6668=await this[_0x2e10c2(0x264)]['listTextKnowledgeBases'](_0xb69d11),_0x3952ae=await this[_0x2e10c2(0x264)]['listPrompts'](_0xb69d11),_0x33bf57=await this['client'][_0x2e10c2(0x1fa)](_0xb69d11),_0x14fe4a=await safeListOrEmpty(()=>this[_0x2e10c2(0x264)][_0x2e10c2(0x1d3)](_0xb69d11)),_0x87a5e2=await safeListOrEmpty(()=>this['client'][_0x2e10c2(0x29d)](_0xb69d11)),_0x2e2e17=await fetchAllToolTargetMaps((_0x2fabcf,_0x2a2d71)=>this['client'][_0x2e10c2(0x2ab)](_0x2fabcf,_0x2a2d71),_0xb69d11),_0x2e26b3=new Map(),_0xe5237d=new Map(),_0x5c5216=new Map(),_0x59ae73=new Map(),_0x173e87=new Map(),_0x421550=new Map(),_0x3195c5=new Map();for(const _0x2a3e36 of _0x1ccda9){_0x2e26b3[_0x2e10c2(0x1e4)](_0x2a3e36[_0x2e10c2(0x1c1)]['name'],_0x2a3e36);}for(const _0x2da923 of _0x2d0b11){_0xe5237d[_0x2e10c2(0x1e4)](_0x2da923[_0x2e10c2(0x1c1)]['name'],_0x2da923);}for(const _0x40a52e of _0xe6668){_0x5c5216[_0x2e10c2(0x1e4)](_0x40a52e[_0x2e10c2(0x1c1)][_0x2e10c2(0x1d9)],_0x40a52e);}for(const _0x5e86d0 of _0x3952ae){_0x59ae73[_0x2e10c2(0x1e4)](_0x5e86d0[_0x2e10c2(0x1c1)]['name'],_0x5e86d0);}for(const _0x52dfaf of _0x33bf57){_0x173e87[_0x2e10c2(0x1e4)](_0x52dfaf['attributes']['serviceType'][_0x2e10c2(0x277)](),_0x52dfaf);}for(const _0x13a8e2 of _0x14fe4a){_0x421550['set'](_0x13a8e2[_0x2e10c2(0x1c1)]['name'],_0x13a8e2);}for(const _0x39d7a9 of _0x87a5e2){_0x3195c5[_0x2e10c2(0x1e4)](_0x39d7a9['attributes'][_0x2e10c2(0x1d9)],_0x39d7a9);}const _0x3ae4cd=new Map(),_0x26d238=new Map();for(const _0x38fc4c of _0x1ccda9){_0x3ae4cd['set'](_0x38fc4c[_0x2e10c2(0x1c1)][_0x2e10c2(0x1d9)],_0x38fc4c['id']),_0x26d238['set'](_0x38fc4c['id'],_0x38fc4c[_0x2e10c2(0x1c1)][_0x2e10c2(0x1d9)]);}const _0x24c3d5=new Map(),_0x3811e5=new Map();for(const _0x4ab0fc of _0x3952ae){_0x24c3d5[_0x2e10c2(0x1e4)](_0x4ab0fc[_0x2e10c2(0x1c1)][_0x2e10c2(0x1d9)],_0x4ab0fc['id']),_0x3811e5['set'](_0x4ab0fc['id'],_0x4ab0fc[_0x2e10c2(0x1c1)][_0x2e10c2(0x1d9)]);}const _0xed41ae=_0x2e2e17[_0x2e10c2(0x234)][_0x2e10c2(0x243)]||new Map(),_0x193c45=_0x2e2e17[_0x2e10c2(0x234)][_0x2e10c2(0x296)]||new Map(),_0x268da4=_0x2e2e17[_0x2e10c2(0x234)][_0x2e10c2(0x283)]||new Map(),_0x4053a2=new Map(),_0x2fb679={'resolveToolTargetName':buildNameResolver({..._0x2e2e17[_0x2e10c2(0x240)],'Agent':_0x26d238}),'resolvePromptName':async _0x2cee33=>_0x3811e5[_0x2e10c2(0x281)](_0x2cee33),'onWarning':_0x14b14b=>this[_0x2e10c2(0x1e2)][_0x2e10c2(0x21f)](_0x14b14b)};let _0x7273e7=[];const _0x26a2ec={'projectId':_0xb69d11,'resolveToolTargetId':buildIdResolver({..._0x2e2e17[_0x2e10c2(0x234)],'Agent':_0x3ae4cd}),'resolvePromptId':async _0x31447f=>_0x24c3d5['get'](_0x31447f),'onWarning':_0x1b43e0=>{const _0x1131ae=_0x2e10c2;this[_0x1131ae(0x1e2)][_0x1131ae(0x21f)](_0x1b43e0),_0x7273e7['push'](_0x1b43e0);}},{resolved:_0xed2ba1,unresolved:_0x28d6be}=resolveAgentDependencies(_0x27a775,new Set(_0x2e26b3[_0x2e10c2(0x1a8)]()));for(const {agent:_0x5bf62a,missingDeps:_0x7539b9}of _0x28d6be){_0x28fbd1[_0x2e10c2(0x1de)][_0x2e10c2(0x25d)]({'agentName':_0x5bf62a[_0x2e10c2(0x222)]['name'],'action':_0x2e10c2(0x204),'error':_0x2e10c2(0x198)+_0x7539b9[_0x2e10c2(0x2b4)](',\x20')+_0x2e10c2(0x1f4)}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x1de)]['errors']++;}for(const _0x17c806 of _0xf6afb7){const _0x63c78d=_0xe5237d[_0x2e10c2(0x281)](_0x17c806[_0x2e10c2(0x222)][_0x2e10c2(0x1d9)]),_0x3cdef2=a133_0x1343de[_0x2e10c2(0x1cc)](_0x17c806[_0x2e10c2(0x2a4)],'utf-8');if(_0x63c78d){const _0x273cca=apiKnowledgeBaseToYaml(_0x63c78d),_0x5ab7e2=toKnowledgeBaseYamlString(_0x273cca),_0x52d79a=generateDiff(_0x5ab7e2,_0x3cdef2),_0x8f84cc=hasChanges(_0x52d79a);_0x8f84cc?(_0x28fbd1['knowledgeBases'][_0x2e10c2(0x25d)]({'name':_0x17c806[_0x2e10c2(0x222)][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x1e7),'id':_0x63c78d['id'],'diff':formatDiffWithColors(_0x52d79a)}),_0x28fbd1['counts'][_0x2e10c2(0x201)][_0x2e10c2(0x1e7)]++):(_0x28fbd1[_0x2e10c2(0x201)][_0x2e10c2(0x25d)]({'name':_0x17c806['yaml'][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x219),'id':_0x63c78d['id']}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x201)][_0x2e10c2(0x219)]++);}else _0x28fbd1[_0x2e10c2(0x201)][_0x2e10c2(0x25d)]({'name':_0x17c806[_0x2e10c2(0x222)][_0x2e10c2(0x1d9)],'action':'created'}),_0x28fbd1[_0x2e10c2(0x261)]['knowledgeBases']['created']++;}for(const _0x588299 of _0x39ff32){const _0x4bf1b7=_0x5c5216[_0x2e10c2(0x281)](_0x588299['name']),_0x3bf0a7=a133_0x1343de[_0x2e10c2(0x1cc)](_0x588299[_0x2e10c2(0x2a4)],_0x2e10c2(0x19a));if(_0x4bf1b7){const _0x3bcf60=toTextKnowledgeBaseMd(_0x4bf1b7[_0x2e10c2(0x1c1)][_0x2e10c2(0x1d9)],_0x4bf1b7[_0x2e10c2(0x1c1)][_0x2e10c2(0x1d6)]),_0x33bb9d=generateDiff(_0x3bcf60,_0x3bf0a7),_0x47db11=hasChanges(_0x33bb9d);_0x47db11?(_0x28fbd1[_0x2e10c2(0x257)][_0x2e10c2(0x25d)]({'name':_0x588299['name'],'action':'updated','id':_0x4bf1b7['id'],'diff':formatDiffWithColors(_0x33bb9d)}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x257)][_0x2e10c2(0x1e7)]++):(_0x28fbd1[_0x2e10c2(0x257)][_0x2e10c2(0x25d)]({'name':_0x588299[_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x219),'id':_0x4bf1b7['id']}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x257)][_0x2e10c2(0x219)]++);}else _0x28fbd1[_0x2e10c2(0x257)][_0x2e10c2(0x25d)]({'name':_0x588299[_0x2e10c2(0x1d9)],'action':'created'}),_0x28fbd1[_0x2e10c2(0x261)]['textKnowledgeBases'][_0x2e10c2(0x1b8)]++;}for(const _0x1b3c5f of _0xed2ba1){const _0x12a1c1=_0x2e26b3[_0x2e10c2(0x281)](_0x1b3c5f['yaml'][_0x2e10c2(0x1d9)]),_0x3029e6=a133_0x4bef80[_0x2e10c2(0x2b4)](_0x1b3c5f[_0x2e10c2(0x1dd)],_0x2e10c2(0x1a7)),_0x3d1157=a133_0x1343de[_0x2e10c2(0x1cc)](_0x3029e6,_0x2e10c2(0x19a)),_0x27682a=_0x1b3c5f['systemPrompt'],_0x5b2b48=_0x2e10c2(0x196)+_0x27682a+_0x2e10c2(0x29c)+_0x3d1157;if(_0x12a1c1){const {yaml:_0x27081e,systemPrompt:_0x2ae296}=await agentResponseToDef(_0x12a1c1,_0x2fb679),_0x238086=toAgentYamlString(_0x27081e),_0x3fddd5=_0x2e10c2(0x196)+_0x2ae296+_0x2e10c2(0x29c)+_0x238086,_0x236dbc=generateDiff(_0x3fddd5,_0x5b2b48),_0x2a321f=hasChanges(_0x236dbc);_0x2a321f?(_0x28fbd1['agents'][_0x2e10c2(0x25d)]({'agentName':_0x1b3c5f[_0x2e10c2(0x222)]['name'],'action':'updated','agentId':_0x12a1c1['id'],'diff':formatDiffWithColors(_0x236dbc)}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x1de)][_0x2e10c2(0x1e7)]++):(_0x28fbd1[_0x2e10c2(0x1de)][_0x2e10c2(0x25d)]({'agentName':_0x1b3c5f[_0x2e10c2(0x222)][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x219),'agentId':_0x12a1c1['id']}),_0x28fbd1['counts']['agents'][_0x2e10c2(0x219)]++);}else _0x28fbd1[_0x2e10c2(0x1de)]['push']({'agentName':_0x1b3c5f['yaml'][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x1b8)}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x1de)][_0x2e10c2(0x1b8)]++;}for(const _0xf5eaa0 of _0x5f4b52){const _0x524018=_0x59ae73[_0x2e10c2(0x281)](_0xf5eaa0['yaml'][_0x2e10c2(0x1d9)]),_0x877ff0=a133_0x1343de['readFileSync'](_0xf5eaa0[_0x2e10c2(0x2a4)],_0x2e10c2(0x19a));if(_0x524018){const _0x44aa2f=await apiPromptToYaml(_0x524018,_0x2fb679);if(!_0x44aa2f){_0x28fbd1[_0x2e10c2(0x1a0)][_0x2e10c2(0x25d)]({'name':_0xf5eaa0[_0x2e10c2(0x222)][_0x2e10c2(0x1d9)],'action':'updated','id':_0x524018['id']}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x1a0)][_0x2e10c2(0x1e7)]++;continue;}const _0x36873a=toPromptYamlString(_0x44aa2f),_0x1b639a=generateDiff(_0x36873a,_0x877ff0),_0x2e4395=hasChanges(_0x1b639a);_0x2e4395?(_0x28fbd1[_0x2e10c2(0x1a0)][_0x2e10c2(0x25d)]({'name':_0xf5eaa0[_0x2e10c2(0x222)]['name'],'action':'updated','id':_0x524018['id'],'diff':formatDiffWithColors(_0x1b639a)}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x1a0)]['updated']++):(_0x28fbd1[_0x2e10c2(0x1a0)][_0x2e10c2(0x25d)]({'name':_0xf5eaa0[_0x2e10c2(0x222)]['name'],'action':_0x2e10c2(0x219),'id':_0x524018['id']}),_0x28fbd1[_0x2e10c2(0x261)]['prompts'][_0x2e10c2(0x219)]++);}else _0x28fbd1[_0x2e10c2(0x1a0)][_0x2e10c2(0x25d)]({'name':_0xf5eaa0[_0x2e10c2(0x222)][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x1b8)}),_0x28fbd1['counts'][_0x2e10c2(0x1a0)][_0x2e10c2(0x1b8)]++;}for(const _0x35c396 of _0x1370d2){const _0x398e53=_0x173e87['get'](_0x35c396[_0x2e10c2(0x222)][_0x2e10c2(0x1ce)]),_0x24090c=a133_0x1343de[_0x2e10c2(0x1cc)](_0x35c396[_0x2e10c2(0x2a4)],_0x2e10c2(0x19a));if(_0x398e53){const _0x6a3f34=await apiIntegrationToYaml(_0x398e53,_0x2fb679),_0x58a62d=toIntegrationYamlString(_0x6a3f34),_0x5d7dbb=generateDiff(_0x58a62d,_0x24090c),_0x3c09d2=hasChanges(_0x5d7dbb);_0x3c09d2?(_0x28fbd1[_0x2e10c2(0x26c)]['push']({'name':_0x35c396[_0x2e10c2(0x222)][_0x2e10c2(0x1ce)],'action':_0x2e10c2(0x1e7),'id':_0x398e53['id'],'diff':formatDiffWithColors(_0x5d7dbb)}),_0x28fbd1['counts'][_0x2e10c2(0x26c)][_0x2e10c2(0x1e7)]++):(_0x28fbd1[_0x2e10c2(0x26c)]['push']({'name':_0x35c396[_0x2e10c2(0x222)][_0x2e10c2(0x1ce)],'action':_0x2e10c2(0x219),'id':_0x398e53['id']}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x26c)]['unchanged']++);}else _0x28fbd1[_0x2e10c2(0x26c)][_0x2e10c2(0x25d)]({'name':_0x35c396[_0x2e10c2(0x222)][_0x2e10c2(0x1ce)],'action':_0x2e10c2(0x1b8)}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x26c)]['created']++;}for(const _0x248096 of _0x8e7e02){const _0x1037f1=_0x421550[_0x2e10c2(0x281)](_0x248096[_0x2e10c2(0x269)][_0x2e10c2(0x1d9)]),_0x137de9=toExperimentalKnowledgeBaseYamlString(_0x248096[_0x2e10c2(0x269)]);let _0x51504f=_0x137de9;for(const _0x3fad64 of _0x248096[_0x2e10c2(0x269)]['functions']){_0x51504f+=_0x2e10c2(0x251)+_0x3fad64[_0x2e10c2(0x1d9)]+_0x2e10c2(0x2a9)+_0x3fad64['code']+_0x2e10c2(0x237)+_0x3fad64['name']+_0x2e10c2(0x2a9)+_0x3fad64['json_schema']+'\x0a';}if(_0x1037f1){const _0x444bd0=apiExperimentalKnowledgeBaseToYaml(_0x1037f1),_0x32f1a9=toExperimentalKnowledgeBaseYamlString(_0x444bd0);let _0x469f7e=_0x32f1a9;for(const _0x168f09 of _0x444bd0[_0x2e10c2(0x197)]){_0x469f7e+=_0x2e10c2(0x251)+_0x168f09[_0x2e10c2(0x1d9)]+_0x2e10c2(0x2a9)+_0x168f09[_0x2e10c2(0x22d)]+_0x2e10c2(0x237)+_0x168f09[_0x2e10c2(0x1d9)]+_0x2e10c2(0x2a9)+_0x168f09['json_schema']+'\x0a';}const _0x2ccb22=generateDiff(_0x469f7e,_0x51504f),_0xc689ac=hasChanges(_0x2ccb22);_0xc689ac?(_0x28fbd1[_0x2e10c2(0x1f3)][_0x2e10c2(0x25d)]({'name':_0x248096[_0x2e10c2(0x269)][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x1e7),'id':_0x1037f1['id'],'diff':formatDiffWithColors(_0x2ccb22)}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x1f3)][_0x2e10c2(0x1e7)]++):(_0x28fbd1[_0x2e10c2(0x1f3)][_0x2e10c2(0x25d)]({'name':_0x248096[_0x2e10c2(0x269)][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x219),'id':_0x1037f1['id']}),_0x28fbd1[_0x2e10c2(0x261)]['experimentalKnowledgeBases'][_0x2e10c2(0x219)]++);}else _0x28fbd1[_0x2e10c2(0x1f3)][_0x2e10c2(0x25d)]({'name':_0x248096['def']['name'],'action':'created'}),_0x28fbd1['counts'][_0x2e10c2(0x1f3)]['created']++;}for(const _0xe371f4 of _0x8cbeec){const _0x3d2c47=_0x3195c5[_0x2e10c2(0x281)](_0xe371f4[_0x2e10c2(0x269)][_0x2e10c2(0x1d9)]),_0x304538=toExperimentalArtifactYamlString(_0xe371f4[_0x2e10c2(0x269)]);let _0x2da6b9=_0x304538+('\x0a---\x20code\x20---\x0a'+_0xe371f4[_0x2e10c2(0x269)][_0x2e10c2(0x22d)]+'\x0a');for(const _0xa153c6 of _0xe371f4[_0x2e10c2(0x269)]['files']){_0x2da6b9+='---\x20file:\x20'+_0xa153c6['file_name']+_0x2e10c2(0x2a9)+_0xa153c6[_0x2e10c2(0x28f)]+'\x0a';}if(_0x3d2c47){const _0x1eb168=apiExperimentalArtifactToYaml(_0x3d2c47),_0x37f7b8=toExperimentalArtifactYamlString(_0x1eb168);let _0x73a133=_0x37f7b8+(_0x2e10c2(0x1ea)+_0x1eb168['code']+'\x0a');for(const _0x33a2ed of _0x1eb168[_0x2e10c2(0x210)]){_0x73a133+=_0x2e10c2(0x246)+_0x33a2ed[_0x2e10c2(0x1a5)]+_0x2e10c2(0x2a9)+_0x33a2ed[_0x2e10c2(0x28f)]+'\x0a';}const _0x32a3d7=generateDiff(_0x73a133,_0x2da6b9),_0x5661a7=hasChanges(_0x32a3d7);_0x5661a7?(_0x28fbd1[_0x2e10c2(0x2b0)][_0x2e10c2(0x25d)]({'name':_0xe371f4[_0x2e10c2(0x269)][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x1e7),'id':_0x3d2c47['id'],'diff':formatDiffWithColors(_0x32a3d7)}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x2b0)][_0x2e10c2(0x1e7)]++):(_0x28fbd1['experimentalArtifacts'][_0x2e10c2(0x25d)]({'name':_0xe371f4[_0x2e10c2(0x269)][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x219),'id':_0x3d2c47['id']}),_0x28fbd1[_0x2e10c2(0x261)]['experimentalArtifacts'][_0x2e10c2(0x219)]++);}else _0x28fbd1[_0x2e10c2(0x2b0)][_0x2e10c2(0x25d)]({'name':_0xe371f4['def']['name'],'action':_0x2e10c2(0x1b8)}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x2b0)]['created']++;}if(_0x4af6fa?.['dryRun'])return _0x28fbd1;_0x28fbd1[_0x2e10c2(0x201)]=[],_0x28fbd1[_0x2e10c2(0x257)]=[],_0x28fbd1[_0x2e10c2(0x1a0)]=[],_0x28fbd1[_0x2e10c2(0x26c)]=[],_0x28fbd1[_0x2e10c2(0x1f3)]=[],_0x28fbd1['experimentalArtifacts']=[];const _0xcb1574=_0x28fbd1[_0x2e10c2(0x1de)][_0x2e10c2(0x25a)](_0x413f26=>_0x413f26[_0x2e10c2(0x26a)]===_0x2e10c2(0x204));_0x28fbd1[_0x2e10c2(0x1de)]=_0xcb1574,_0x28fbd1[_0x2e10c2(0x261)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0xcb1574[_0x2e10c2(0x250)]},'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}};for(const _0x33fa3c of _0xf6afb7){try{const _0x3e590f=_0xe5237d[_0x2e10c2(0x281)](_0x33fa3c[_0x2e10c2(0x222)][_0x2e10c2(0x1d9)]),_0x19740d=yamlKnowledgeBaseToApi(_0x33fa3c[_0x2e10c2(0x222)],_0xb69d11);if(_0x3e590f)await this[_0x2e10c2(0x264)][_0x2e10c2(0x292)](_0x3e590f['id'],_0x19740d),_0xed41ae[_0x2e10c2(0x1e4)](_0x33fa3c[_0x2e10c2(0x222)][_0x2e10c2(0x1d9)],_0x3e590f['id']),_0x28fbd1[_0x2e10c2(0x201)][_0x2e10c2(0x25d)]({'name':_0x33fa3c[_0x2e10c2(0x222)][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x1e7),'id':_0x3e590f['id']}),_0x28fbd1[_0x2e10c2(0x261)]['knowledgeBases'][_0x2e10c2(0x1e7)]++;else{const _0x211a6b=await this[_0x2e10c2(0x264)][_0x2e10c2(0x1df)](_0x19740d);_0xed41ae['set'](_0x33fa3c[_0x2e10c2(0x222)]['name'],_0x211a6b['id']),_0x28fbd1[_0x2e10c2(0x201)][_0x2e10c2(0x25d)]({'name':_0x33fa3c[_0x2e10c2(0x222)][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x1b8),'id':_0x211a6b['id']}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x201)][_0x2e10c2(0x1b8)]++;}}catch(_0x294806){_0x28fbd1[_0x2e10c2(0x201)][_0x2e10c2(0x25d)]({'name':_0x33fa3c[_0x2e10c2(0x222)][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x204),'error':_0x294806[_0x2e10c2(0x1be)]}),_0x28fbd1[_0x2e10c2(0x261)]['knowledgeBases'][_0x2e10c2(0x24e)]++;}}for(const _0x1d28bc of _0x39ff32){try{const _0xec3ea3=_0x5c5216['get'](_0x1d28bc['name']),_0x351770=yamlTextKnowledgeBaseToApi({'name':_0x1d28bc['name'],'text':_0x1d28bc['text']},_0xb69d11);if(_0xec3ea3)await this[_0x2e10c2(0x264)][_0x2e10c2(0x224)](_0xec3ea3['id'],_0x351770),_0x193c45[_0x2e10c2(0x1e4)](_0x1d28bc[_0x2e10c2(0x1d9)],_0xec3ea3['id']),_0x28fbd1['textKnowledgeBases'][_0x2e10c2(0x25d)]({'name':_0x1d28bc[_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x1e7),'id':_0xec3ea3['id']}),_0x28fbd1['counts'][_0x2e10c2(0x257)][_0x2e10c2(0x1e7)]++;else{const _0x43309c=await this[_0x2e10c2(0x264)]['createTextKnowledgeBase'](_0x351770);_0x193c45[_0x2e10c2(0x1e4)](_0x1d28bc['name'],_0x43309c['id']),_0x28fbd1['textKnowledgeBases'][_0x2e10c2(0x25d)]({'name':_0x1d28bc['name'],'action':_0x2e10c2(0x1b8),'id':_0x43309c['id']}),_0x28fbd1['counts']['textKnowledgeBases'][_0x2e10c2(0x1b8)]++;}}catch(_0x4de3a8){_0x28fbd1[_0x2e10c2(0x257)]['push']({'name':_0x1d28bc[_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x204),'error':_0x4de3a8[_0x2e10c2(0x1be)]}),_0x28fbd1[_0x2e10c2(0x261)]['textKnowledgeBases'][_0x2e10c2(0x24e)]++;}}for(const _0x1f3314 of _0x8e7e02){try{const _0x54d1e4=_0x421550['get'](_0x1f3314[_0x2e10c2(0x269)]['name']),_0x3466d3=yamlExperimentalKnowledgeBaseToApi(_0x1f3314[_0x2e10c2(0x269)],_0xb69d11);if(_0x54d1e4)await this['client'][_0x2e10c2(0x1c2)](_0x54d1e4['id'],_0x3466d3),_0x268da4[_0x2e10c2(0x1e4)](_0x1f3314[_0x2e10c2(0x269)][_0x2e10c2(0x1d9)],_0x54d1e4['id']),_0x28fbd1[_0x2e10c2(0x1f3)][_0x2e10c2(0x25d)]({'name':_0x1f3314['def'][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x1e7),'id':_0x54d1e4['id']}),_0x28fbd1[_0x2e10c2(0x261)]['experimentalKnowledgeBases']['updated']++;else{const _0x2e7e17=await this[_0x2e10c2(0x264)][_0x2e10c2(0x1bb)](_0x3466d3);_0x268da4[_0x2e10c2(0x1e4)](_0x1f3314[_0x2e10c2(0x269)][_0x2e10c2(0x1d9)],_0x2e7e17['id']),_0x28fbd1['experimentalKnowledgeBases'][_0x2e10c2(0x25d)]({'name':_0x1f3314[_0x2e10c2(0x269)][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x1b8),'id':_0x2e7e17['id']}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x1f3)][_0x2e10c2(0x1b8)]++;}}catch(_0x1c3db0){_0x28fbd1[_0x2e10c2(0x1f3)][_0x2e10c2(0x25d)]({'name':_0x1f3314[_0x2e10c2(0x269)][_0x2e10c2(0x1d9)],'action':'error','error':_0x1c3db0[_0x2e10c2(0x1be)]}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x1f3)]['errors']++;}}for(const _0x5d273d of _0x8cbeec){try{const _0x1f4f56=_0x3195c5[_0x2e10c2(0x281)](_0x5d273d[_0x2e10c2(0x269)]['name']),_0x37dbaa=yamlExperimentalArtifactToApi(_0x5d273d[_0x2e10c2(0x269)],_0xb69d11);if(_0x1f4f56)await this[_0x2e10c2(0x264)][_0x2e10c2(0x23f)](_0x1f4f56['id'],_0x37dbaa),_0x4053a2[_0x2e10c2(0x1e4)](_0x5d273d['def'][_0x2e10c2(0x1d9)],_0x1f4f56['id']),_0x28fbd1[_0x2e10c2(0x2b0)]['push']({'name':_0x5d273d[_0x2e10c2(0x269)][_0x2e10c2(0x1d9)],'action':'updated','id':_0x1f4f56['id']}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x2b0)][_0x2e10c2(0x1e7)]++;else{const _0x302a76=await this[_0x2e10c2(0x264)][_0x2e10c2(0x272)](_0x37dbaa);_0x4053a2[_0x2e10c2(0x1e4)](_0x5d273d['def'][_0x2e10c2(0x1d9)],_0x302a76['id']),_0x28fbd1['experimentalArtifacts']['push']({'name':_0x5d273d[_0x2e10c2(0x269)]['name'],'action':'created','id':_0x302a76['id']}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x2b0)][_0x2e10c2(0x1b8)]++;}}catch(_0x172c97){_0x28fbd1[_0x2e10c2(0x2b0)][_0x2e10c2(0x25d)]({'name':_0x5d273d[_0x2e10c2(0x269)][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x204),'error':_0x172c97['message']}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x2b0)][_0x2e10c2(0x24e)]++;}}for(const _0x43bb68 of _0xed2ba1){_0x7273e7=[];try{const _0x168b8f=_0x2e26b3[_0x2e10c2(0x281)](_0x43bb68['yaml'][_0x2e10c2(0x1d9)]),_0x5ebafa=await agentDefToRequest(_0x43bb68[_0x2e10c2(0x222)],_0x43bb68[_0x2e10c2(0x1c4)],_0x43bb68[_0x2e10c2(0x2b1)],_0x26a2ec);if(_0x168b8f)await this['client'][_0x2e10c2(0x2a3)](_0x168b8f['id'],_0x5ebafa),_0x3ae4cd[_0x2e10c2(0x1e4)](_0x43bb68[_0x2e10c2(0x222)][_0x2e10c2(0x1d9)],_0x168b8f['id']),_0x28fbd1[_0x2e10c2(0x1de)][_0x2e10c2(0x25d)]({'agentName':_0x43bb68['yaml'][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x1e7),'agentId':_0x168b8f['id'],'warnings':_0x7273e7[_0x2e10c2(0x250)]>0x0?_0x7273e7:undefined}),_0x28fbd1[_0x2e10c2(0x261)]['agents'][_0x2e10c2(0x1e7)]++;else{const _0x327b06=await this[_0x2e10c2(0x264)][_0x2e10c2(0x288)](_0x5ebafa);_0x3ae4cd[_0x2e10c2(0x1e4)](_0x43bb68['yaml'][_0x2e10c2(0x1d9)],_0x327b06['id']),_0x28fbd1[_0x2e10c2(0x1de)]['push']({'agentName':_0x43bb68[_0x2e10c2(0x222)][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x1b8),'agentId':_0x327b06['id'],'warnings':_0x7273e7[_0x2e10c2(0x250)]>0x0?_0x7273e7:undefined}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x1de)]['created']++;}}catch(_0x39163c){_0x28fbd1['agents']['push']({'agentName':_0x43bb68[_0x2e10c2(0x222)][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x204),'error':_0x39163c[_0x2e10c2(0x1be)],'warnings':_0x7273e7[_0x2e10c2(0x250)]>0x0?_0x7273e7:undefined}),_0x28fbd1[_0x2e10c2(0x261)]['agents']['errors']++;}}for(const _0x397694 of _0x5f4b52){try{const _0x258e2f=_0x59ae73['get'](_0x397694['yaml'][_0x2e10c2(0x1d9)]),_0x386cb0=await yamlPromptToApi(_0x397694[_0x2e10c2(0x222)],_0xb69d11,_0x26a2ec);if(!_0x386cb0){_0x28fbd1[_0x2e10c2(0x1a0)][_0x2e10c2(0x25d)]({'name':_0x397694[_0x2e10c2(0x222)][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x204),'error':_0x2e10c2(0x1b2)}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x1a0)][_0x2e10c2(0x24e)]++;continue;}if(_0x258e2f)await this[_0x2e10c2(0x264)][_0x2e10c2(0x1c3)](_0x258e2f['id'],_0x386cb0),_0x24c3d5[_0x2e10c2(0x1e4)](_0x397694[_0x2e10c2(0x222)][_0x2e10c2(0x1d9)],_0x258e2f['id']),_0x28fbd1[_0x2e10c2(0x1a0)][_0x2e10c2(0x25d)]({'name':_0x397694['yaml']['name'],'action':_0x2e10c2(0x1e7),'id':_0x258e2f['id']}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x1a0)][_0x2e10c2(0x1e7)]++;else{const _0x526c48=await this[_0x2e10c2(0x264)]['createPrompt'](_0x386cb0);_0x24c3d5[_0x2e10c2(0x1e4)](_0x397694['yaml'][_0x2e10c2(0x1d9)],_0x526c48['id']),_0x28fbd1[_0x2e10c2(0x1a0)][_0x2e10c2(0x25d)]({'name':_0x397694[_0x2e10c2(0x222)]['name'],'action':_0x2e10c2(0x1b8),'id':_0x526c48['id']}),_0x28fbd1[_0x2e10c2(0x261)]['prompts'][_0x2e10c2(0x1b8)]++;}}catch(_0x125fd2){_0x28fbd1[_0x2e10c2(0x1a0)][_0x2e10c2(0x25d)]({'name':_0x397694[_0x2e10c2(0x222)][_0x2e10c2(0x1d9)],'action':_0x2e10c2(0x204),'error':_0x125fd2['message']}),_0x28fbd1['counts'][_0x2e10c2(0x1a0)][_0x2e10c2(0x24e)]++;}}for(const _0x42c944 of _0x1370d2){try{const _0x44e791=_0x173e87[_0x2e10c2(0x281)](_0x42c944['yaml'][_0x2e10c2(0x1ce)]),_0x573e6c=await yamlIntegrationToApi(_0x42c944['yaml'],_0xb69d11,_0x26a2ec);if(_0x44e791){await this[_0x2e10c2(0x264)]['deleteIntegration'](_0x44e791['id']);const _0x369b8c=await this[_0x2e10c2(0x264)][_0x2e10c2(0x1e6)](_0x573e6c);_0x28fbd1['integrations'][_0x2e10c2(0x25d)]({'name':_0x42c944[_0x2e10c2(0x222)]['service_type'],'action':_0x2e10c2(0x1e7),'id':_0x369b8c['id']}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x26c)][_0x2e10c2(0x1e7)]++;}else{const _0x5aa99d=await this['client'][_0x2e10c2(0x1e6)](_0x573e6c);_0x28fbd1[_0x2e10c2(0x26c)]['push']({'name':_0x42c944[_0x2e10c2(0x222)][_0x2e10c2(0x1ce)],'action':'created','id':_0x5aa99d['id']}),_0x28fbd1[_0x2e10c2(0x261)]['integrations']['created']++;}}catch(_0x360e96){_0x28fbd1[_0x2e10c2(0x26c)][_0x2e10c2(0x25d)]({'name':_0x42c944['yaml']['service_type'],'action':_0x2e10c2(0x204),'error':_0x360e96[_0x2e10c2(0x1be)]}),_0x28fbd1[_0x2e10c2(0x261)][_0x2e10c2(0x26c)][_0x2e10c2(0x24e)]++;}}return _0x28fbd1;}async[a133_0x496960(0x262)](_0x41182e,_0x132c78,_0x47d239,_0x4f3845){const _0x265b9f=a133_0x496960,{projectId:_0x387a2e,project:_0x1670f3}=await this[_0x265b9f(0x294)](_0x41182e),_0x444c38=_0x1670f3[_0x265b9f(0x1c1)][_0x265b9f(0x1d9)],_0x3b93f3=await this[_0x265b9f(0x264)][_0x265b9f(0x29b)](_0x387a2e),_0x296cdd=_0x3b93f3[_0x265b9f(0x1d4)](_0x59c6fc=>_0x59c6fc[_0x265b9f(0x1c1)]['name']===_0x132c78);if(!_0x296cdd)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x265b9f(0x265)+_0x132c78,undefined,{'helpText':'Available\x20agents:\x20'+_0x3b93f3['map'](_0x200da8=>_0x200da8[_0x265b9f(0x1c1)][_0x265b9f(0x1d9)])[_0x265b9f(0x2b4)](',\x20')});let _0x3f823a;if(_0x47d239)_0x3f823a=_0x47d239;else{const _0x1df19b=a133_0x4bef80[_0x265b9f(0x2b4)](process[_0x265b9f(0x26f)](),_0x265b9f(0x1de)),_0x421daa=getSanitizedPathWithMigration(_0x1df19b,_0x444c38);_0x421daa[_0x265b9f(0x1b6)]&&this[_0x265b9f(0x1e2)][_0x265b9f(0x1f7)]('Renamed\x20folder:\x20'+a133_0x4bef80[_0x265b9f(0x293)](_0x421daa['oldPath'])+_0x265b9f(0x1b1)+a133_0x4bef80[_0x265b9f(0x293)](_0x421daa[_0x265b9f(0x2a4)])),_0x3f823a=_0x421daa[_0x265b9f(0x2a4)];}const _0x3e18b5=getSanitizedPathWithMigration(_0x3f823a,_0x132c78);_0x3e18b5[_0x265b9f(0x1b6)]&&this['logger'][_0x265b9f(0x1f7)]('Renamed\x20agent\x20folder:\x20'+a133_0x4bef80[_0x265b9f(0x293)](_0x3e18b5[_0x265b9f(0x1a1)])+_0x265b9f(0x1b1)+a133_0x4bef80[_0x265b9f(0x293)](_0x3e18b5[_0x265b9f(0x2a4)]));const _0x654591=_0x3e18b5[_0x265b9f(0x2a4)],_0x142755=new Map(),_0x4ab53f=new Map(),_0x2478f8=await this['client'][_0x265b9f(0x1ff)](_0x387a2e),_0x35672a=await this[_0x265b9f(0x264)][_0x265b9f(0x1cb)](_0x387a2e),_0x29ce68=await safeListOrEmpty(()=>this[_0x265b9f(0x264)][_0x265b9f(0x1d3)](_0x387a2e)),_0x2b8922=new Map(),_0x2f51e9=new Map();for(const _0xbe2a12 of _0x2478f8){_0x142755[_0x265b9f(0x1e4)](_0xbe2a12['id'],_0xbe2a12['attributes'][_0x265b9f(0x1d9)]);}for(const _0x4707b7 of _0x35672a){_0x2b8922[_0x265b9f(0x1e4)](_0x4707b7['id'],_0x4707b7['attributes']['name']);}for(const _0x25dfd6 of _0x29ce68){_0x2f51e9['set'](_0x25dfd6['id'],_0x25dfd6['attributes'][_0x265b9f(0x1d9)]);}for(const _0x5772ab of _0x3b93f3){_0x4ab53f[_0x265b9f(0x1e4)](_0x5772ab['id'],_0x5772ab[_0x265b9f(0x1c1)][_0x265b9f(0x1d9)]);}const _0x1b1826={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x142755,'TextKnowledgeBase':_0x2b8922,'Agent':_0x4ab53f,'ExperimentalKnowledgeBase':_0x2f51e9}),'resolvePromptName':async()=>undefined,'onWarning':_0x190788=>this[_0x265b9f(0x1e2)][_0x265b9f(0x21f)](_0x190788)},_0x1bd51a=a133_0x4bef80[_0x265b9f(0x2b4)](_0x654591,_0x265b9f(0x21c)),_0x45d014=a133_0x4bef80[_0x265b9f(0x2b4)](_0x654591,_0x265b9f(0x1a7)),_0x329fec=a133_0x4bef80[_0x265b9f(0x2b4)](_0x654591,_0x265b9f(0x1b3)),_0x3e6c35=!a133_0x1343de[_0x265b9f(0x278)](_0x45d014);if(_0x4f3845?.[_0x265b9f(0x22c)])return{'agentName':_0x132c78,'outputPath':_0x654591,'isNew':_0x3e6c35,'hasChanges':!![]};a133_0x1343de[_0x265b9f(0x23d)](_0x3f823a,{'recursive':!![]}),a133_0x1343de[_0x265b9f(0x23d)](_0x654591,{'recursive':!![]});const _0x101b85=a133_0x4bef80[_0x265b9f(0x2b4)](_0x3f823a,_0x265b9f(0x202));!a133_0x1343de[_0x265b9f(0x278)](_0x101b85)&&a133_0x1343de[_0x265b9f(0x2ae)](_0x101b85,createAgentConfigContent(_0x41182e));const {yaml:_0x101856,systemPrompt:_0x14fbc0,starterMessage:_0x154a24}=await agentResponseToDef(_0x296cdd,_0x1b1826);let _0xcaf345=_0x3e6c35;if(!_0x3e6c35){const _0x33d433=a133_0x1343de['existsSync'](_0x1bd51a)?a133_0x1343de[_0x265b9f(0x1cc)](_0x1bd51a,'utf-8'):'',_0x3cfe6d=a133_0x1343de[_0x265b9f(0x1cc)](_0x45d014,'utf-8');_0xcaf345=_0x33d433!==_0x14fbc0||_0x3cfe6d!==toAgentYamlString(_0x101856);}a133_0x1343de[_0x265b9f(0x2ae)](_0x1bd51a,_0x14fbc0),a133_0x1343de[_0x265b9f(0x2ae)](_0x45d014,toAgentYamlString(_0x101856));if(_0x154a24&&_0x154a24[_0x265b9f(0x247)]('\x0a'))a133_0x1343de['writeFileSync'](_0x329fec,_0x154a24);else a133_0x1343de[_0x265b9f(0x278)](_0x329fec)&&a133_0x1343de[_0x265b9f(0x289)](_0x329fec);return{'agentName':_0x132c78,'outputPath':_0x654591,'isNew':_0x3e6c35,'hasChanges':_0xcaf345};}async[a133_0x496960(0x216)](_0x37d91b,_0x141c95){const _0x5e5846=a133_0x496960;let _0x37f11b;isAgentYamlPath(_0x37d91b)?_0x37f11b=getAgentDirFromYamlPath(_0x37d91b):_0x37f11b=_0x37d91b;const {config:_0x5076a7}=findAgentConfig(_0x37f11b),_0x52c8ed=await this[_0x5e5846(0x2a1)](_0x5076a7[_0x5e5846(0x22f)]),_0x8322d5=a133_0x4bef80[_0x5e5846(0x2b4)](_0x37f11b,_0x5e5846(0x1a7)),_0x2eb5d8=a133_0x4bef80[_0x5e5846(0x2b4)](_0x37f11b,'prompt.md'),_0x1e0ad4=a133_0x4bef80[_0x5e5846(0x2b4)](_0x37f11b,'starter_message.md');if(!a133_0x1343de[_0x5e5846(0x278)](_0x8322d5))throw new SDKError(ErrorCode[_0x5e5846(0x253)],_0x5e5846(0x1cd)+_0x37f11b,undefined,{'helpText':_0x5e5846(0x1e3)});const _0x2e30d7=parseAgentYaml(a133_0x1343de[_0x5e5846(0x1cc)](_0x8322d5,_0x5e5846(0x19a)),_0x8322d5),_0x1cb0bd=a133_0x1343de[_0x5e5846(0x278)](_0x2eb5d8)?a133_0x1343de[_0x5e5846(0x1cc)](_0x2eb5d8,_0x5e5846(0x19a)):'',_0x2357d7=a133_0x1343de['existsSync'](_0x1e0ad4)?a133_0x1343de[_0x5e5846(0x1cc)](_0x1e0ad4,'utf-8'):_0x2e30d7[_0x5e5846(0x1d5)];if(_0x141c95?.[_0x5e5846(0x22c)])return{'agentName':_0x2e30d7['name'],'action':'created','projectId':_0x52c8ed};const _0x192cbe=await this[_0x5e5846(0x264)][_0x5e5846(0x29b)](_0x52c8ed),_0x5ea924=await fetchAllToolTargetMaps((_0x5c86e3,_0x11ad68)=>this[_0x5e5846(0x264)][_0x5e5846(0x2ab)](_0x5c86e3,_0x11ad68),_0x52c8ed),_0x24be87=new Map();for(const _0x2077de of _0x192cbe){_0x24be87[_0x5e5846(0x1e4)](_0x2077de[_0x5e5846(0x1c1)][_0x5e5846(0x1d9)],_0x2077de['id']);}const _0x4bfcec=[],_0x52da93={'projectId':_0x52c8ed,'resolveToolTargetId':buildIdResolver({..._0x5ea924[_0x5e5846(0x234)],'Agent':_0x24be87}),'resolvePromptId':async()=>undefined,'onWarning':_0x49e971=>{const _0x14b8b2=_0x5e5846;this[_0x14b8b2(0x1e2)][_0x14b8b2(0x21f)](_0x49e971),_0x4bfcec[_0x14b8b2(0x25d)](_0x49e971);}};try{const _0x59ba13=_0x192cbe[_0x5e5846(0x1d4)](_0x2078b3=>_0x2078b3[_0x5e5846(0x1c1)][_0x5e5846(0x1d9)]===_0x2e30d7[_0x5e5846(0x1d9)]),_0x247897=await agentDefToRequest(_0x2e30d7,_0x1cb0bd,_0x2357d7,_0x52da93);if(_0x59ba13)return await this['client'][_0x5e5846(0x2a3)](_0x59ba13['id'],_0x247897),{'agentName':_0x2e30d7['name'],'action':_0x5e5846(0x1e7),'projectId':_0x52c8ed,'agentId':_0x59ba13['id'],'warnings':_0x4bfcec['length']>0x0?_0x4bfcec:undefined};else{const _0x58ad30=await this[_0x5e5846(0x264)]['createAgentResponse'](_0x247897);return{'agentName':_0x2e30d7[_0x5e5846(0x1d9)],'action':_0x5e5846(0x1b8),'projectId':_0x52c8ed,'agentId':_0x58ad30['id'],'warnings':_0x4bfcec['length']>0x0?_0x4bfcec:undefined};}}catch(_0x5edf83){return{'agentName':_0x2e30d7[_0x5e5846(0x1d9)],'action':_0x5e5846(0x204),'projectId':_0x52c8ed,'error':_0x5edf83[_0x5e5846(0x1be)],'warnings':_0x4bfcec['length']>0x0?_0x4bfcec:undefined};}}async[a133_0x496960(0x2aa)](_0x5c0732,_0x4a41aa,_0x436833){const _0x14983f=a133_0x496960,_0x5c04af=a133_0x1343de[_0x14983f(0x278)](_0x5c0732)&&a133_0x1343de['existsSync'](a133_0x4bef80[_0x14983f(0x2b4)](_0x5c0732,'tdx.json'));let _0x2d936f;const _0x4ee2a8=[],_0x29c613=[],_0xb7c05f=[],_0x33f194=[],_0x1c9e15=[],_0x3ba798=[],_0x252174=[];if(_0x5c04af){const _0x547061=loadAgentConfig(a133_0x4bef80[_0x14983f(0x2b4)](_0x5c0732,_0x14983f(0x202)));_0x2d936f=_0x547061[_0x14983f(0x22f)];const _0x234713=a133_0x1343de[_0x14983f(0x1fc)](_0x5c0732,{'withFileTypes':!![]});for(const _0x5bb334 of _0x234713){if(!_0x5bb334[_0x14983f(0x21a)]())continue;if([_0x14983f(0x1ca),'experimental_knowledge_bases',_0x14983f(0x24a),_0x14983f(0x1a0),_0x14983f(0x26c)][_0x14983f(0x247)](_0x5bb334[_0x14983f(0x1d9)]))continue;const _0x2d2dd8=a133_0x4bef80[_0x14983f(0x2b4)](_0x5c0732,_0x5bb334[_0x14983f(0x1d9)]);if(isAgentDir(_0x2d2dd8)){const _0x587310=a133_0x4bef80['join'](_0x2d2dd8,_0x14983f(0x1a7)),_0x4c9a7d=a133_0x4bef80['join'](_0x2d2dd8,'prompt.md'),_0x384e43=a133_0x4bef80['join'](_0x2d2dd8,_0x14983f(0x1b3)),_0x23fa18=parseAgentYaml(a133_0x1343de[_0x14983f(0x1cc)](_0x587310,_0x14983f(0x19a)),_0x587310),_0x361152=a133_0x1343de[_0x14983f(0x278)](_0x4c9a7d)?a133_0x1343de[_0x14983f(0x1cc)](_0x4c9a7d,'utf-8'):'',_0x4a4a87=a133_0x1343de[_0x14983f(0x278)](_0x384e43)?a133_0x1343de[_0x14983f(0x1cc)](_0x384e43,'utf-8'):_0x23fa18[_0x14983f(0x1d5)];_0x4ee2a8[_0x14983f(0x25d)]({'name':_0x23fa18[_0x14983f(0x1d9)],'dir':_0x2d2dd8,'yaml':_0x23fa18,'systemPrompt':_0x361152,'starterMessage':_0x4a4a87});}}const _0x42e7f0=getKnowledgeBasesDir(_0x5c0732);if(a133_0x1343de[_0x14983f(0x278)](_0x42e7f0)){const _0x2756df=a133_0x1343de[_0x14983f(0x1fc)](_0x42e7f0);for(const _0x27b707 of _0x2756df){const _0x37b3b3=a133_0x4bef80[_0x14983f(0x2b4)](_0x42e7f0,_0x27b707);if(_0x27b707[_0x14983f(0x1f1)](_0x14983f(0x27d))){const _0xb3f5a0=parseKnowledgeBaseYaml(a133_0x1343de[_0x14983f(0x1cc)](_0x37b3b3,'utf-8'),_0x37b3b3);_0x29c613['push']({'name':_0xb3f5a0['name'],'path':_0x37b3b3,'yaml':_0xb3f5a0});}else{if(_0x27b707['endsWith']('.md')){const _0x385c8e=a133_0x1343de['readFileSync'](_0x37b3b3,_0x14983f(0x19a)),{name:_0x3b5cc3,text:_0x469d46}=parseTextKnowledgeBaseMd(_0x385c8e,_0x27b707);_0xb7c05f[_0x14983f(0x25d)]({'name':_0x3b5cc3,'path':_0x37b3b3,'text':_0x469d46});}}}}const _0x5e26e7=getPromptsDir(_0x5c0732);if(a133_0x1343de['existsSync'](_0x5e26e7)){const _0x355a5a=a133_0x1343de['readdirSync'](_0x5e26e7)['filter'](_0x37c648=>_0x37c648['endsWith'](_0x14983f(0x27d)));for(const _0x243d99 of _0x355a5a){const _0xa1ba1e=a133_0x4bef80['join'](_0x5e26e7,_0x243d99),_0x2ab00d=parsePromptYaml(a133_0x1343de[_0x14983f(0x1cc)](_0xa1ba1e,'utf-8'),_0xa1ba1e);_0x33f194['push']({'name':_0x2ab00d[_0x14983f(0x1d9)],'path':_0xa1ba1e,'yaml':_0x2ab00d});}}const _0x16396a=getIntegrationsDir(_0x5c0732);if(a133_0x1343de['existsSync'](_0x16396a)){const _0xcc1e6d=a133_0x1343de[_0x14983f(0x1fc)](_0x16396a)[_0x14983f(0x25a)](_0x418a48=>_0x418a48[_0x14983f(0x1f1)](_0x14983f(0x27d)));for(const _0x1b118b of _0xcc1e6d){const _0x4aaec2=a133_0x4bef80[_0x14983f(0x2b4)](_0x16396a,_0x1b118b),_0x16328a=parseIntegrationYaml(a133_0x1343de[_0x14983f(0x1cc)](_0x4aaec2,_0x14983f(0x19a)),_0x4aaec2);SAFE_INTEGRATION_TYPES['includes'](_0x16328a[_0x14983f(0x1ce)][_0x14983f(0x277)]())?_0x1c9e15['push']({'name':_0x16328a['name'],'path':_0x4aaec2,'yaml':_0x16328a}):this[_0x14983f(0x1e2)][_0x14983f(0x21f)]('Skipping\x20integration\x20\x27'+_0x16328a[_0x14983f(0x1d9)]+_0x14983f(0x1b9)+_0x16328a[_0x14983f(0x1ce)]+_0x14983f(0x24d)+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES[_0x14983f(0x2b4)](',\x20')+_0x14983f(0x233)));}}const _0x196306=getExperimentalKnowledgeBasesDir(_0x5c0732);if(a133_0x1343de['existsSync'](_0x196306)){const _0xac417b=a133_0x1343de[_0x14983f(0x1fc)](_0x196306,{'withFileTypes':!![]});for(const _0x5697e0 of _0xac417b){if(!_0x5697e0[_0x14983f(0x21a)]())continue;const _0x1b91f5=a133_0x4bef80[_0x14983f(0x2b4)](_0x196306,_0x5697e0[_0x14983f(0x1d9)]),_0x21e33d=a133_0x4bef80[_0x14983f(0x2b4)](_0x1b91f5,_0x5697e0[_0x14983f(0x1d9)]+_0x14983f(0x27d));if(a133_0x1343de['existsSync'](_0x21e33d)){const _0x48c41b=parseExperimentalKnowledgeBaseYaml(a133_0x1343de[_0x14983f(0x1cc)](_0x21e33d,_0x14983f(0x19a)),_0x21e33d),_0xdcc2bd=a133_0x4bef80[_0x14983f(0x2b4)](_0x1b91f5,_0x14983f(0x197)),_0x6f358=[];if(a133_0x1343de[_0x14983f(0x278)](_0xdcc2bd)){const _0x4f7088=a133_0x1343de['readdirSync'](_0xdcc2bd,{'withFileTypes':!![]});for(const _0xbb351b of _0x4f7088){if(!_0xbb351b[_0x14983f(0x21a)]())continue;const _0x1c4a94=a133_0x4bef80[_0x14983f(0x2b4)](_0xdcc2bd,_0xbb351b[_0x14983f(0x1d9)]),_0x28298b=a133_0x4bef80['join'](_0x1c4a94,_0x14983f(0x2a7)),_0x5e106f=a133_0x4bef80['join'](_0x1c4a94,_0x14983f(0x23e));if(a133_0x1343de['existsSync'](_0x28298b)&&a133_0x1343de[_0x14983f(0x278)](_0x5e106f)){const _0xc92ded=a133_0x1343de[_0x14983f(0x1cc)](_0x28298b,_0x14983f(0x19a)),_0x4b062a=a133_0x1343de['readFileSync'](_0x5e106f,'utf-8');_0x6f358[_0x14983f(0x25d)]({'name':_0xbb351b[_0x14983f(0x1d9)],'code':_0xc92ded,'json_schema':_0x4b062a});}}}const _0x3d6a5a={..._0x48c41b,'functions':_0x6f358};_0x3ba798[_0x14983f(0x25d)]({'name':_0x48c41b[_0x14983f(0x1d9)],'path':_0x1b91f5,'def':_0x3d6a5a});}}}const _0x1e0d5f=getExperimentalArtifactsDir(_0x5c0732);if(a133_0x1343de['existsSync'](_0x1e0d5f)){const _0x549575=a133_0x1343de[_0x14983f(0x1fc)](_0x1e0d5f,{'withFileTypes':!![]});for(const _0x55dcbf of _0x549575){if(!_0x55dcbf['isDirectory']())continue;const _0x3e43c1=a133_0x4bef80['join'](_0x1e0d5f,_0x55dcbf['name']),_0x2fcfb4=a133_0x4bef80['join'](_0x3e43c1,_0x55dcbf['name']+'.yml');if(a133_0x1343de['existsSync'](_0x2fcfb4)){const _0x5db846=parseExperimentalArtifactYaml(a133_0x1343de['readFileSync'](_0x2fcfb4,_0x14983f(0x19a)),_0x2fcfb4),_0x26f2c5=a133_0x4bef80[_0x14983f(0x2b4)](_0x3e43c1,_0x14983f(0x2a7)),_0xebde22=a133_0x1343de[_0x14983f(0x278)](_0x26f2c5)?a133_0x1343de[_0x14983f(0x1cc)](_0x26f2c5,_0x14983f(0x19a)):'',_0x4d9e38=a133_0x4bef80[_0x14983f(0x2b4)](_0x3e43c1,_0x14983f(0x210)),_0x53b650=[];if(a133_0x1343de[_0x14983f(0x278)](_0x4d9e38)){const _0x4c6e89=a133_0x1343de[_0x14983f(0x1fc)](_0x4d9e38);for(const _0x38c22f of _0x4c6e89){const _0xac0b2c=a133_0x4bef80[_0x14983f(0x2b4)](_0x4d9e38,_0x38c22f);if(a133_0x1343de[_0x14983f(0x2ac)](_0xac0b2c)[_0x14983f(0x236)]()){const _0x319c66=a133_0x1343de[_0x14983f(0x1cc)](_0xac0b2c,_0x14983f(0x19a));_0x53b650[_0x14983f(0x25d)]({'file_name':_0x38c22f,'text_content':_0x319c66});}}}const _0xfb58fd={..._0x5db846,'code':_0xebde22,'files':_0x53b650};_0x252174[_0x14983f(0x25d)]({'name':_0x5db846[_0x14983f(0x1d9)],'path':_0x3e43c1,'def':_0xfb58fd});}}}}else{const _0x4b19f7=await this[_0x14983f(0x2a1)](_0x5c0732),_0x11c85c=await this[_0x14983f(0x264)][_0x14983f(0x244)](_0x4b19f7);_0x2d936f=_0x11c85c[_0x14983f(0x1c1)][_0x14983f(0x1d9)];const _0xb04b14=await this[_0x14983f(0x264)]['listAgentsFull'](_0x4b19f7),_0x38dedb=await this[_0x14983f(0x264)]['listKnowledgeBases'](_0x4b19f7),_0x1c271f=await this[_0x14983f(0x264)]['listTextKnowledgeBases'](_0x4b19f7),_0x49e9e7=await this[_0x14983f(0x264)]['listPrompts'](_0x4b19f7),_0xeb7eb2=await this['client'][_0x14983f(0x1fa)](_0x4b19f7),_0x4b9867=await safeListOrEmpty(()=>this[_0x14983f(0x264)][_0x14983f(0x1d3)](_0x4b19f7)),_0x38ff5e=await safeListOrEmpty(()=>this['client'][_0x14983f(0x29d)](_0x4b19f7)),_0x568e5f=new Map(),_0x5b8823=new Map(),_0x1df512=new Map(),_0x24b86f=new Map(),_0x5e25e0=new Map(),_0x596fc6=new Map();for(const _0x264356 of _0x38dedb){_0x568e5f[_0x14983f(0x1e4)](_0x264356['id'],_0x264356[_0x14983f(0x1c1)][_0x14983f(0x1d9)]);}for(const _0x28fba5 of _0x1c271f){_0x5b8823[_0x14983f(0x1e4)](_0x28fba5['id'],_0x28fba5[_0x14983f(0x1c1)]['name']);}for(const _0x199a73 of _0xb04b14){_0x1df512[_0x14983f(0x1e4)](_0x199a73['id'],_0x199a73[_0x14983f(0x1c1)]['name']);}for(const _0x248659 of _0x49e9e7){_0x24b86f['set'](_0x248659['id'],_0x248659[_0x14983f(0x1c1)][_0x14983f(0x1d9)]);}for(const _0x55dc3e of _0x4b9867){_0x5e25e0[_0x14983f(0x1e4)](_0x55dc3e['id'],_0x55dc3e[_0x14983f(0x1c1)][_0x14983f(0x1d9)]);}for(const _0x11d847 of _0x38ff5e){_0x596fc6[_0x14983f(0x1e4)](_0x11d847['id'],_0x11d847['attributes'][_0x14983f(0x1d9)]);}const _0xab3d0c={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x568e5f,'TextKnowledgeBase':_0x5b8823,'Agent':_0x1df512,'ExperimentalKnowledgeBase':_0x5e25e0}),'resolvePromptName':async _0x2321e8=>_0x24b86f[_0x14983f(0x281)](_0x2321e8),'onWarning':_0x6d24dd=>this[_0x14983f(0x1e2)][_0x14983f(0x21f)](_0x6d24dd)};for(const _0x3ba111 of _0xb04b14){const _0x4b341e=await agentResponseToDef(_0x3ba111,_0xab3d0c),{yaml:_0x3ea80d,systemPrompt:_0x1b52b1,starterMessage:_0x3ee4ee}=_0x4b341e;_0x4ee2a8['push']({'name':_0x3ea80d[_0x14983f(0x1d9)],'dir':'','yaml':_0x3ea80d,'systemPrompt':_0x1b52b1,'starterMessage':_0x3ee4ee});}for(const _0x50d831 of _0x38dedb){const _0x284d99=apiKnowledgeBaseToYaml(_0x50d831);_0x29c613[_0x14983f(0x25d)]({'name':_0x284d99[_0x14983f(0x1d9)],'path':'','yaml':_0x284d99});}for(const _0x20dd41 of _0x1c271f){_0xb7c05f['push']({'name':_0x20dd41[_0x14983f(0x1c1)][_0x14983f(0x1d9)],'path':'','text':_0x20dd41[_0x14983f(0x1c1)][_0x14983f(0x1d6)]});}for(const _0x12abfb of _0x49e9e7){const _0x547302=await apiPromptToYaml(_0x12abfb,_0xab3d0c);_0x547302&&_0x33f194['push']({'name':_0x547302['name'],'path':'','yaml':_0x547302});}for(const _0x26292c of _0xeb7eb2){if(!_0x26292c['attributes'][_0x14983f(0x260)]&&SAFE_INTEGRATION_TYPES['includes'](_0x26292c[_0x14983f(0x1c1)]['serviceType'][_0x14983f(0x277)]())){const _0x212b60=await apiIntegrationToYaml(_0x26292c,_0xab3d0c);_0x1c9e15['push']({'name':_0x26292c[_0x14983f(0x1c1)][_0x14983f(0x1ed)][_0x14983f(0x277)](),'path':'','yaml':_0x212b60});}}for(const _0x5cf4b6 of _0x4b9867){const _0x4a4d3c=apiExperimentalKnowledgeBaseToYaml(_0x5cf4b6);_0x3ba798[_0x14983f(0x25d)]({'name':_0x4a4d3c[_0x14983f(0x1d9)],'path':'','def':_0x4a4d3c});}for(const _0x1e1a9d of _0x38ff5e){const _0x5c204e=apiExperimentalArtifactToYaml(_0x1e1a9d);_0x252174['push']({'name':_0x5c204e[_0x14983f(0x1d9)],'path':'','def':_0x5c204e});}}const _0x587c09={'sourceProjectName':_0x2d936f,'newProjectName':_0x4a41aa,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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}}},_0x5f4e83=await this[_0x14983f(0x264)][_0x14983f(0x263)](),_0x4ea83d=_0x5f4e83[_0x14983f(0x1d4)](_0x1d5131=>_0x1d5131[_0x14983f(0x1c1)][_0x14983f(0x1d9)]===_0x4a41aa);if(_0x4ea83d)throw new SDKError(ErrorCode[_0x14983f(0x206)],_0x14983f(0x25e)+_0x4a41aa+_0x14983f(0x267),undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x436833?.[_0x14983f(0x22c)])return _0x587c09[_0x14983f(0x261)][_0x14983f(0x1de)][_0x14983f(0x1b8)]=_0x4ee2a8[_0x14983f(0x250)],_0x587c09['counts'][_0x14983f(0x201)][_0x14983f(0x1b8)]=_0x29c613['length'],_0x587c09['counts'][_0x14983f(0x257)]['created']=_0xb7c05f[_0x14983f(0x250)],_0x587c09[_0x14983f(0x261)][_0x14983f(0x1f3)][_0x14983f(0x1b8)]=_0x3ba798['length'],_0x587c09[_0x14983f(0x261)][_0x14983f(0x2b0)]['created']=_0x252174[_0x14983f(0x250)],_0x587c09[_0x14983f(0x261)][_0x14983f(0x1a0)][_0x14983f(0x1b8)]=_0x33f194[_0x14983f(0x250)],_0x587c09[_0x14983f(0x261)][_0x14983f(0x26c)]['created']=_0x1c9e15[_0x14983f(0x250)],_0x587c09;const _0x805175=await this['client'][_0x14983f(0x1e5)]({'name':_0x4a41aa}),_0x406887=_0x805175['id'];_0x587c09[_0x14983f(0x1fb)]=_0x406887;const _0x490718=new Map(),_0x3528ff=new Map(),_0xdbff2=new Map(),_0x6a91cd=new Map(),_0x3fe369=new Map(),_0x26d00c=new Map(),_0x2b664e=new Map(),_0x23aa8f=new Map(),_0x5f1fe8=new Set(),_0x5909a1=new Set();for(const _0x5d1f6b of _0x4ee2a8){for(const _0x1fc815 of _0x5d1f6b['yaml'][_0x14983f(0x1b7)]||[]){if(_0x1fc815[_0x14983f(0x1f6)]===_0x14983f(0x1c9)&&_0x1fc815[_0x14983f(0x29f)]){const _0x361563=parseRef(_0x1fc815[_0x14983f(0x29f)]);if(_0x361563)_0x5f1fe8[_0x14983f(0x21d)](_0x361563['name']);}else{if(_0x1fc815['type']==='web_search'&&_0x1fc815[_0x14983f(0x29f)]){const _0x286339=parseRef(_0x1fc815[_0x14983f(0x29f)]);if(_0x286339)_0x5909a1[_0x14983f(0x21d)](_0x286339['name']);}}}}for(const _0x16314b of _0x5f1fe8){try{const _0x43dee=await this[_0x14983f(0x264)]['createImageGenerator']({'projectId':_0x406887,'name':_0x16314b});_0x3fe369[_0x14983f(0x1e4)](_0x16314b,_0x43dee['id']),_0x587c09[_0x14983f(0x1dc)][_0x14983f(0x25d)]({'name':_0x16314b,'action':_0x14983f(0x1b8),'id':_0x43dee['id']}),_0x587c09[_0x14983f(0x261)]['imageGenerators']['created']++;}catch(_0x1870ec){_0x587c09[_0x14983f(0x1dc)]['push']({'name':_0x16314b,'action':_0x14983f(0x204),'error':_0x1870ec[_0x14983f(0x1be)]}),_0x587c09[_0x14983f(0x261)]['imageGenerators'][_0x14983f(0x24e)]++;}}for(const _0x43d285 of _0x5909a1){try{const _0x20d34d=await this['client']['createWebSearchTool']({'projectId':_0x406887,'name':_0x43d285});_0x26d00c['set'](_0x43d285,_0x20d34d['id']),_0x587c09[_0x14983f(0x20a)]['push']({'name':_0x43d285,'action':'created','id':_0x20d34d['id']}),_0x587c09[_0x14983f(0x261)][_0x14983f(0x20a)][_0x14983f(0x1b8)]++;}catch(_0x8e2ed7){_0x587c09[_0x14983f(0x20a)][_0x14983f(0x25d)]({'name':_0x43d285,'action':_0x14983f(0x204),'error':_0x8e2ed7[_0x14983f(0x1be)]}),_0x587c09[_0x14983f(0x261)][_0x14983f(0x20a)][_0x14983f(0x24e)]++;}}const _0x22d9cd=await fetchAllToolTargetMaps((_0x48a78d,_0x2d6de2)=>this[_0x14983f(0x264)][_0x14983f(0x2ab)](_0x48a78d,_0x2d6de2),_0x406887);let _0x13d919=[];const _0x27c5ab={'projectId':_0x406887,'resolveToolTargetId':buildIdResolver({..._0x22d9cd[_0x14983f(0x234)],'KnowledgeBase':_0x490718,'TextKnowledgeBase':_0x3528ff,'ExperimentalKnowledgeBase':_0x2b664e,'Agent':_0xdbff2,'WebSearchTool':_0x26d00c,'ImageGenerator':_0x3fe369}),'resolvePromptId':async _0x5b8f08=>_0x6a91cd['get'](_0x5b8f08),'onWarning':_0x1441da=>{const _0x7c1d04=_0x14983f;this[_0x7c1d04(0x1e2)][_0x7c1d04(0x21f)](_0x1441da),_0x13d919[_0x7c1d04(0x25d)](_0x1441da);}};for(const _0x6ec1e of _0x29c613){try{const _0x48b246=yamlKnowledgeBaseToApi(_0x6ec1e[_0x14983f(0x222)],_0x406887),_0x618161=await this['client'][_0x14983f(0x1df)](_0x48b246);_0x490718[_0x14983f(0x1e4)](_0x6ec1e[_0x14983f(0x222)][_0x14983f(0x1d9)],_0x618161['id']),_0x587c09[_0x14983f(0x201)][_0x14983f(0x25d)]({'name':_0x6ec1e[_0x14983f(0x222)][_0x14983f(0x1d9)],'action':_0x14983f(0x1b8),'id':_0x618161['id']}),_0x587c09[_0x14983f(0x261)][_0x14983f(0x201)][_0x14983f(0x1b8)]++;}catch(_0x430f0b){_0x587c09[_0x14983f(0x201)]['push']({'name':_0x6ec1e[_0x14983f(0x222)][_0x14983f(0x1d9)],'action':_0x14983f(0x204),'error':_0x430f0b[_0x14983f(0x1be)]}),_0x587c09[_0x14983f(0x261)]['knowledgeBases'][_0x14983f(0x24e)]++;}}for(const _0x2c8aaa of _0xb7c05f){try{const _0x2de783=yamlTextKnowledgeBaseToApi({'name':_0x2c8aaa[_0x14983f(0x1d9)],'text':_0x2c8aaa[_0x14983f(0x1d6)]},_0x406887),_0x1860e2=await this[_0x14983f(0x264)][_0x14983f(0x1e8)](_0x2de783);_0x3528ff[_0x14983f(0x1e4)](_0x2c8aaa['name'],_0x1860e2['id']),_0x587c09[_0x14983f(0x257)][_0x14983f(0x25d)]({'name':_0x2c8aaa[_0x14983f(0x1d9)],'action':_0x14983f(0x1b8),'id':_0x1860e2['id']}),_0x587c09[_0x14983f(0x261)][_0x14983f(0x257)][_0x14983f(0x1b8)]++;}catch(_0x276ddb){_0x587c09[_0x14983f(0x257)][_0x14983f(0x25d)]({'name':_0x2c8aaa['name'],'action':_0x14983f(0x204),'error':_0x276ddb[_0x14983f(0x1be)]}),_0x587c09[_0x14983f(0x261)][_0x14983f(0x257)][_0x14983f(0x24e)]++;}}for(const _0x4365b7 of _0x252174){try{const _0x30ef98=yamlExperimentalArtifactToApi(_0x4365b7['def'],_0x406887),_0xe9307=await this[_0x14983f(0x264)][_0x14983f(0x272)](_0x30ef98);_0x23aa8f[_0x14983f(0x1e4)](_0x4365b7[_0x14983f(0x269)][_0x14983f(0x1d9)],_0xe9307['id']),_0x587c09[_0x14983f(0x2b0)][_0x14983f(0x25d)]({'name':_0x4365b7[_0x14983f(0x269)][_0x14983f(0x1d9)],'action':_0x14983f(0x1b8),'id':_0xe9307['id']}),_0x587c09['counts'][_0x14983f(0x2b0)]['created']++;}catch(_0x4b25d9){_0x587c09['experimentalArtifacts'][_0x14983f(0x25d)]({'name':_0x4365b7[_0x14983f(0x269)][_0x14983f(0x1d9)],'action':_0x14983f(0x204),'error':_0x4b25d9[_0x14983f(0x1be)]}),_0x587c09[_0x14983f(0x261)]['experimentalArtifacts']['errors']++;}}for(const _0x170fad of _0x3ba798){try{const _0x57c0f5=yamlExperimentalKnowledgeBaseToApi(_0x170fad['def'],_0x406887),_0x25a32d=await this[_0x14983f(0x264)][_0x14983f(0x1bb)](_0x57c0f5);_0x2b664e[_0x14983f(0x1e4)](_0x170fad[_0x14983f(0x269)]['name'],_0x25a32d['id']),_0x587c09[_0x14983f(0x1f3)]['push']({'name':_0x170fad[_0x14983f(0x269)][_0x14983f(0x1d9)],'action':_0x14983f(0x1b8),'id':_0x25a32d['id']}),_0x587c09[_0x14983f(0x261)][_0x14983f(0x1f3)][_0x14983f(0x1b8)]++;}catch(_0x111655){_0x587c09[_0x14983f(0x1f3)]['push']({'name':_0x170fad[_0x14983f(0x269)][_0x14983f(0x1d9)],'action':_0x14983f(0x204),'error':_0x111655[_0x14983f(0x1be)]}),_0x587c09[_0x14983f(0x261)][_0x14983f(0x1f3)][_0x14983f(0x24e)]++;}}const _0x2d76df=[..._0x4ee2a8][_0x14983f(0x1d8)]((_0x32fccb,_0x30bae1)=>{const _0x46f42f=_0x14983f,_0x29509f=_0x32fccb[_0x46f42f(0x222)][_0x46f42f(0x1b7)]?.['some'](_0x55b1ab=>_0x55b1ab['type']===_0x46f42f(0x24f))??![],_0x4c98bc=_0x30bae1[_0x46f42f(0x222)]['tools']?.[_0x46f42f(0x273)](_0x5b0a9f=>_0x5b0a9f[_0x46f42f(0x1f6)]==='agent')??![];if(_0x29509f&&!_0x4c98bc)return 0x1;if(!_0x29509f&&_0x4c98bc)return-0x1;return 0x0;});for(const _0x21e1ea of _0x2d76df){_0x13d919=[];try{const _0x380372=_0x21e1ea[_0x14983f(0x222)]['tools']?.[_0x14983f(0x25a)](_0x3bf52d=>{const _0x1ef80c=_0x14983f;if(_0x3bf52d[_0x1ef80c(0x1f6)]===_0x1ef80c(0x24f)&&_0x3bf52d[_0x1ef80c(0x29f)]){const _0x1bcf70=parseRef(_0x3bf52d[_0x1ef80c(0x29f)]);return _0x1bcf70?.[_0x1ef80c(0x1d9)]===_0x21e1ea[_0x1ef80c(0x222)][_0x1ef80c(0x1d9)];}return![];})??[];if(_0x380372[_0x14983f(0x250)]>0x0){const _0x4b9d66=_0x14983f(0x1bf)+_0x21e1ea['yaml'][_0x14983f(0x1d9)]+'\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20'+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this[_0x14983f(0x1e2)]['warn'](_0x4b9d66),_0x13d919[_0x14983f(0x25d)](_0x4b9d66);}const _0x2c6e20=await agentDefToRequest(_0x21e1ea[_0x14983f(0x222)],_0x21e1ea[_0x14983f(0x1c4)],_0x21e1ea['starterMessage'],_0x27c5ab),_0xa00e94=await this[_0x14983f(0x264)][_0x14983f(0x288)](_0x2c6e20);_0xdbff2[_0x14983f(0x1e4)](_0x21e1ea['yaml']['name'],_0xa00e94['id']),_0x587c09[_0x14983f(0x1de)][_0x14983f(0x25d)]({'agentName':_0x21e1ea[_0x14983f(0x222)]['name'],'action':_0x14983f(0x1b8),'agentId':_0xa00e94['id'],'warnings':_0x13d919[_0x14983f(0x250)]>0x0?_0x13d919:undefined}),_0x587c09[_0x14983f(0x261)][_0x14983f(0x1de)]['created']++;}catch(_0xae9b34){_0x587c09[_0x14983f(0x1de)][_0x14983f(0x25d)]({'agentName':_0x21e1ea[_0x14983f(0x222)][_0x14983f(0x1d9)],'action':_0x14983f(0x204),'error':_0xae9b34['message'],'warnings':_0x13d919[_0x14983f(0x250)]>0x0?_0x13d919:undefined}),_0x587c09[_0x14983f(0x261)]['agents'][_0x14983f(0x24e)]++;}}for(const _0x361d57 of _0x33f194){try{const _0x263143=await yamlPromptToApi(_0x361d57[_0x14983f(0x222)],_0x406887,_0x27c5ab);if(!_0x263143){_0x587c09['prompts']['push']({'name':_0x361d57[_0x14983f(0x222)][_0x14983f(0x1d9)],'action':_0x14983f(0x204),'error':_0x14983f(0x1b2)}),_0x587c09[_0x14983f(0x261)]['prompts'][_0x14983f(0x24e)]++;continue;}const _0x3873bd=await this[_0x14983f(0x264)][_0x14983f(0x225)](_0x263143);_0x6a91cd[_0x14983f(0x1e4)](_0x361d57[_0x14983f(0x222)][_0x14983f(0x1d9)],_0x3873bd['id']),_0x587c09['prompts']['push']({'name':_0x361d57['yaml'][_0x14983f(0x1d9)],'action':_0x14983f(0x1b8),'id':_0x3873bd['id']}),_0x587c09[_0x14983f(0x261)][_0x14983f(0x1a0)]['created']++;}catch(_0x309c6f){_0x587c09[_0x14983f(0x1a0)]['push']({'name':_0x361d57['yaml']['name'],'action':_0x14983f(0x204),'error':_0x309c6f[_0x14983f(0x1be)]}),_0x587c09['counts']['prompts'][_0x14983f(0x24e)]++;}}for(const _0x5de0f4 of _0x1c9e15){try{const _0x5ed93b=await yamlIntegrationToApi(_0x5de0f4[_0x14983f(0x222)],_0x406887,_0x27c5ab),_0xa5e173=await this[_0x14983f(0x264)][_0x14983f(0x1e6)](_0x5ed93b);_0x587c09[_0x14983f(0x26c)][_0x14983f(0x25d)]({'name':_0x5de0f4[_0x14983f(0x222)][_0x14983f(0x1ce)],'action':_0x14983f(0x1b8),'id':_0xa5e173['id']}),_0x587c09[_0x14983f(0x261)][_0x14983f(0x26c)]['created']++;}catch(_0x592831){_0x587c09[_0x14983f(0x26c)][_0x14983f(0x25d)]({'name':_0x5de0f4['yaml']['service_type'],'action':_0x14983f(0x204),'error':_0x592831[_0x14983f(0x1be)]}),_0x587c09[_0x14983f(0x261)][_0x14983f(0x26c)]['errors']++;}}return _0x587c09;}}
1
+ const a133_0x2792c7=a133_0x23a3;(function(_0x337049,_0x1a6e5b){const _0xfe6372=a133_0x23a3,_0x534cde=_0x337049();while(!![]){try{const _0x292dcc=parseInt(_0xfe6372(0x20d))/0x1+parseInt(_0xfe6372(0x288))/0x2+-parseInt(_0xfe6372(0x217))/0x3*(parseInt(_0xfe6372(0x285))/0x4)+parseInt(_0xfe6372(0x2af))/0x5+-parseInt(_0xfe6372(0x257))/0x6*(parseInt(_0xfe6372(0x23f))/0x7)+parseInt(_0xfe6372(0x2aa))/0x8+-parseInt(_0xfe6372(0x2de))/0x9*(parseInt(_0xfe6372(0x2d6))/0xa);if(_0x292dcc===_0x1a6e5b)break;else _0x534cde['push'](_0x534cde['shift']());}catch(_0x5535be){_0x534cde['push'](_0x534cde['shift']());}}}(a133_0x35fa,0xc3a30));import{LLMApiClient}from'../client/llm-api-client.js';import*as a133_0x12a532 from'node:fs';import*as a133_0x5df1f2 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir}from'../agent/agent-config.js';function a133_0x35fa(){const _0x2a4cb8=['version','models','path','#\x20prompt.md\x0a','1.0','parse','\x27.\x20This\x20should\x20not\x20happen.','signal','12jxSHEh','prompt.md','createAgent','1587446PaoPBD','createTextKnowledgeBase','updatePrompt','tdx.json','createImageGenerator','webSearchTools','prompts.json','updateAgentResponse',')\x20can\x20be\x20pushed.\x20','service_type','chat','ALREADY_EXISTS','sort','---\x20file:\x20','listProjects','readdirSync','listKnowledgeBases','restoreProject','tdx_','isDirectory','status','find','Unresolved\x20dependencies:\x20','files','TextKnowledgeBase','\x0a---\x20function:\x20','getChatHistory','claude-4.5-sonnet','agentId','attributes','\x20in\x20project\x20','mkdirSync','listPrompts','errors','919088jXcqlS','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','chats','agents.json','6479790lkALCX','llm_project','isManaged','updateAgent','writeFileSync','json_schema.json','get','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','none','textKnowledgeBases','chatId','\x0a\x0a#\x20agent.yml\x0a','createPrompt','KnowledgeBase','projects','\x20---\x0a','startChat','existsSync','oldPath','warn','maxToolIterations','filter','serviceType','listAgentsFull','project.json','action','experimentalArtifacts','variables','.yml','tools','starter_message','Renamed\x20agent\x20folder:\x20','unlinkSync','map','slackMessageMode','starter_message.md','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','image_gen','10peUgYI','text_content','resolveAgentId','deleteAgent','def','renamed','nameToId','cwd','6437097PChEHS','systemPrompt','listIntegrations','deleteProject','temperature','low','promptId','updateExperimentalKnowledgeBase','experimentalKnowledgeBases','toISOString','context','updateKnowledgeBase','site','name','stringify','agent','pushAgent','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','\x27\x20(','statSync','INTERNAL','agent.yml','dry-run-','Renamed\x20integration\x20file:\x20','resolveProjectName','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','Backup\x20folder\x20not\x20found:\x20','conflict','actions','localeCompare','includes','Agent\x20\x27','\x0a---\x20schema:\x20','LLM_PROJECT_NOT_FOUND','unchanged','Removed\x20deleted\x20file:\x20','text','NOT_FOUND','listExperimentalKnowledgeBases','getChatLog','setDefaultAgent','projectName','logger','has','\x22\x20already\x20exists','getUserSettings','agents','INVALID_ARGUMENT','endsWith','getDefaultProjectName','template','AGENT_NOT_FOUND','listExperimentalArtifacts','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','listWebSearchTools','createExperimentalKnowledgeBase','json_schema','chat_generic','listAgents','getProject','.llm','knowledgebases.json','file_name','1185256IpGacu','size','---\x20schema:\x20','exportedFrom','type','(dry-run)','high','pushProject','Renamed\x20text\x20KB\x20file:\x20','getDefaultAgent','505371tIYRtI','code','medium','Unsupported\x20backup\x20version:\x20','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','updateExperimentalArtifact','_reasoning_','keys','updated','readFileSync','Available\x20agents:\x20','code.js','utf-8','getOrCreateDefaultProject','\x20→\x20','agent.yml\x20not\x20found\x20in\x20','set','tdDatabaseName','Output\x20directory\x20already\x20exists:\x20','knowledge_bases','add','Invalid\x20agent\x20reference\x20format:\x20','\x0a---\x20code\x20---\x0a','length','Removed\x20deleted\x20directory:\x20','toLowerCase','imageGenerators','No\x20tdx.json\x20found\x20in\x20','.md','minimal','target','error','tables','setCurrentProject','chatWelcomeMessage','reasoningEffort','modelType','Skipping\x20integration\x20\x27','client','getBackupMetadata','49EbXZlC','Only\x20safe\x20types\x20(','description','dir','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','pullAgent','chatInfo','loadJsonFile','created','createExperimentalArtifact','message','info','createKnowledgeBase','some','isDir','sdk.llm','Project\x20\x22','profile','tdx_default_','dirname','total','functions','duplicate','listTextKnowledgeBases','1172478wUDjkW','availableModelNames','counts','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','dryRun','agentsFull','integrations.json','clearDefaultAgent','Multiple\x20agents\x20found\x20with\x20name\x20\x27','chatIgnoreManagedActions','starterMessage','currentProjectId','createIntegration','createWebSearchTool','already\x20exists','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','metadata','createProject','push','Renamed\x20folder:\x20','join','new','integrations','idToName','getAgent','listToolTargets','isFile','prompts','createAgentResponse','history','chat_parent_segment','basename','chat_agent_console','knowledgeBases','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','resolveProjectId','yaml','displayName'];a133_0x35fa=function(){return _0x2a4cb8;};return a133_0x35fa();}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';function a133_0x23a3(_0x165b67,_0x2a6afb){_0x165b67=_0x165b67-0x1f1;const _0x35fad1=a133_0x35fa();let _0x23a320=_0x35fad1[_0x165b67];return _0x23a320;}export const SAFE_INTEGRATION_TYPES=[a133_0x2792c7(0x207),a133_0x2792c7(0x277),a133_0x2792c7(0x275)];async function safeListOrEmpty(_0x4521e6){try{return await _0x4521e6();}catch(_0x2bbf80){if(_0x2bbf80 instanceof HTTPClientError&&_0x2bbf80['status']===0x194)return[];throw _0x2bbf80;}}export class LLMSDK{['currentProjectId'];['client'];[a133_0x2792c7(0x2e8)];[a133_0x2792c7(0x1f8)]=Logger['of'](a133_0x2792c7(0x24e));constructor(_0x22d19d){const _0x358223=a133_0x2792c7;this[_0x358223(0x23d)]=new LLMApiClient(_0x22d19d),this[_0x358223(0x2e8)]=_0x22d19d;}[a133_0x2792c7(0x1ff)](){const _0x15cbb7=a133_0x2792c7,_0x30663a=getSanitizedUsername();return _0x15cbb7(0x251)+_0x30663a;}async[a133_0x2792c7(0x238)](_0x2c63e1){const _0x249d60=a133_0x2792c7,{projectId:_0x255c28}=await this['resolveProjectName'](_0x2c63e1);this[_0x249d60(0x262)]=_0x255c28;}['getCurrentProject'](){const _0x9d63d1=a133_0x2792c7;return this[_0x9d63d1(0x262)];}async[a133_0x2792c7(0x1f6)](_0x5b4206){const _0xb6f5f4=a133_0x2792c7,_0x2fdefb=this[_0xb6f5f4(0x2e8)]['profile'];let _0x1bc969,_0x3ff787;if(_0x5b4206[_0xb6f5f4(0x2fd)]('/')){const _0x35279e=_0x5b4206['split']('/');if(_0x35279e[_0xb6f5f4(0x22e)]!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0xb6f5f4(0x22c)+_0x5b4206,undefined,{'helpText':'Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22'});const [_0x16c386,_0x358521]=_0x35279e;_0x1bc969=await this[_0xb6f5f4(0x27a)](_0x16c386),_0x3ff787=_0x358521;}else _0x1bc969=this[_0xb6f5f4(0x262)]||(await this[_0xb6f5f4(0x224)]())['id'],_0x3ff787=_0x5b4206;const _0x1a193b=await this[_0xb6f5f4(0x2d8)](_0x3ff787,_0x1bc969),_0xca7470=await this['client'][_0xb6f5f4(0x26f)](_0x1a193b);writeCachedLLMAgent(_0xca7470[_0xb6f5f4(0x2a5)][_0xb6f5f4(0x2eb)],_0x1a193b,_0x1bc969,_0x2fdefb);}[a133_0x2792c7(0x216)](){const _0x6cb127=a133_0x2792c7,_0x137492=this['context'][_0x6cb127(0x250)];return readCachedLLMAgent(_0x137492)||undefined;}[a133_0x2792c7(0x25e)](){const _0x412007=a133_0x2792c7,_0x5e1bb=this[_0x412007(0x2e8)][_0x412007(0x250)];clearCachedLLMAgent(_0x5e1bb);}async[a133_0x2792c7(0x27e)](){const _0x4a1767=a133_0x2792c7,_0x722d80=await this[_0x4a1767(0x23d)][_0x4a1767(0x1fb)](),_0x340272=[];for(const _0x4c0ab2 of _0x722d80[_0x4a1767(0x258)]){const _0x4d3258=_0x722d80['availableModels'][_0x4c0ab2];_0x4d3258&&_0x340272['push']({'name':_0x4c0ab2,'displayName':_0x4d3258[_0x4a1767(0x27c)]});}return _0x340272;}async[a133_0x2792c7(0x268)](_0x17d2e6){const _0x398ada=a133_0x2792c7;return await this[_0x398ada(0x23d)]['createProject'](_0x17d2e6);}async[a133_0x2792c7(0x2e1)](_0x292abb){const _0x314a3e=a133_0x2792c7,{projectId:_0x460ee4}=await this[_0x314a3e(0x2f7)](_0x292abb);await this[_0x314a3e(0x23d)][_0x314a3e(0x2e1)](_0x460ee4);}async[a133_0x2792c7(0x2be)](_0x5afba3=0x32){const _0x109106=a133_0x2792c7;return await this[_0x109106(0x23d)][_0x109106(0x296)](_0x5afba3);}async[a133_0x2792c7(0x224)](_0x454859){const _0x309e66=a133_0x2792c7,_0x10a0c2=_0x454859||this[_0x309e66(0x1ff)](),_0x18668a=this[_0x309e66(0x2e8)]['profile'];if(!_0x454859){const _0x484e46=readCachedLLMProject(_0x18668a);if(_0x484e46&&_0x484e46[_0x309e66(0x2eb)]===_0x10a0c2)try{const _0x533d9d=await this[_0x309e66(0x23d)][_0x309e66(0x209)](_0x484e46['id']);if(_0x533d9d[_0x309e66(0x2a5)][_0x309e66(0x2eb)]===_0x10a0c2)return _0x533d9d;}catch{}}const _0x57ba20=await this[_0x309e66(0x23d)][_0x309e66(0x296)](),_0x4be652=_0x57ba20[_0x309e66(0x29d)](_0x371f86=>_0x371f86[_0x309e66(0x2a5)]['name']===_0x10a0c2);if(_0x4be652)return!_0x454859&&writeCachedLLMProject(_0x10a0c2,_0x4be652['id'],_0x18668a),_0x4be652;const _0x12fbc6=await this[_0x309e66(0x23d)][_0x309e66(0x268)]({'name':_0x10a0c2,'description':_0x309e66(0x243)+getSanitizedUsername()+')'});return!_0x454859&&writeCachedLLMProject(_0x10a0c2,_0x12fbc6['id'],_0x18668a),_0x12fbc6;}async[a133_0x2792c7(0x27a)](_0xaded73){const _0x435efa=a133_0x2792c7,_0x5ca1e0=await this['client'][_0x435efa(0x296)](),_0x59be08=_0x5ca1e0[_0x435efa(0x2c5)](_0x4dfff8=>_0x4dfff8[_0x435efa(0x2a5)]['name']===_0xaded73);if(_0x59be08[_0x435efa(0x22e)]===0x0)throw new SDKError(ErrorCode[_0x435efa(0x300)],'Project\x20not\x20found:\x20'+_0xaded73,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x59be08[_0x435efa(0x22e)]>0x1)throw new SDKError(ErrorCode[_0x435efa(0x2f3)],'Multiple\x20projects\x20found\x20with\x20name\x20\x27'+_0xaded73+'\x27.\x20This\x20should\x20not\x20happen.');return _0x59be08[0x0]['id'];}async[a133_0x2792c7(0x2f7)](_0x5cbd3f){const _0x40d8b6=a133_0x2792c7,_0x4ff74=await this[_0x40d8b6(0x23d)]['listProjects'](),_0x672161=_0x4ff74['find'](_0x27a284=>_0x27a284[_0x40d8b6(0x2a5)][_0x40d8b6(0x2eb)]===_0x5cbd3f);if(_0x672161)return{'projectId':_0x672161['id'],'project':_0x672161};throw new SDKError(ErrorCode[_0x40d8b6(0x300)],'Project\x20not\x20found:\x20'+_0x5cbd3f,undefined,{'helpText':_0x40d8b6(0x25a)});}async['getOrCreateDefaultAgent'](_0x225aa3=a133_0x2792c7(0x2a3),_0x293156=0x0,_0x4c5916){const _0x47f941=a133_0x2792c7,_0x94fa34=0xa;let _0x360785=0x0,_0x5e7224;while(_0x360785<_0x94fa34){try{const _0x2b550a=await this[_0x47f941(0x224)](_0x5e7224),_0x165958=_0x2b550a['id'],_0x14104d=[_0x47f941(0x2b8),_0x47f941(0x234),_0x47f941(0x2e3),_0x47f941(0x219),_0x47f941(0x213)],_0x5138e6=_0x293156===0x0?_0x47f941(0x29a)+_0x225aa3:_0x47f941(0x29a)+_0x225aa3+_0x47f941(0x21d)+_0x14104d[_0x293156],_0x220afc=await this[_0x47f941(0x23d)][_0x47f941(0x208)](_0x165958),_0x3c87cb=_0x220afc[_0x47f941(0x29d)](_0x1b4ac6=>_0x1b4ac6[_0x47f941(0x2a5)][_0x47f941(0x2eb)]===_0x5138e6);if(_0x3c87cb)return _0x3c87cb;const _0x486d07=_0x293156>0x0?0x1:_0x4c5916;return await this[_0x47f941(0x23d)]['createAgent']({'name':_0x5138e6,'projectId':_0x165958,'modelType':_0x225aa3,'systemPrompt':'','temperature':_0x486d07,'reasoningEffort':_0x293156>0x0?_0x293156:undefined});}catch(_0x15d951){if(_0x15d951 instanceof HTTPClientError){const _0x53d14d=_0x15d951[_0x47f941(0x29c)];if(_0x53d14d>=0x190&&_0x53d14d<0x1f4){if(_0x53d14d===0x191)throw new SDKError(ErrorCode['UNAUTHENTICATED'],_0x47f941(0x266),_0x15d951);else{if(_0x53d14d===0x193)throw new SDKError(ErrorCode['PERMISSION_DENIED'],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x15d951);}throw _0x15d951;}}if(errorContains(_0x15d951,_0x47f941(0x265),_0x47f941(0x255),_0x47f941(0x2fa))){_0x360785++;if(_0x360785>=_0x94fa34)throw new SDKError(ErrorCode[_0x47f941(0x293)],'Unable\x20to\x20create\x20project\x20after\x20'+_0x94fa34+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x15d951);const _0x5d89f0=this['getDefaultProjectName']();_0x5e7224=_0x5d89f0+'_'+generateRandomHex();continue;}throw _0x15d951;}}throw new SDKError(ErrorCode['INTERNAL'],_0x47f941(0x2b7));}async[a133_0x2792c7(0x2d8)](_0x5a1263,_0x22bd53){const _0x2c0f66=a133_0x2792c7,_0x4cf5f3=_0x22bd53||this[_0x2c0f66(0x262)],_0x421118=await this[_0x2c0f66(0x23d)][_0x2c0f66(0x208)](_0x4cf5f3),_0x146c2f=_0x421118[_0x2c0f66(0x2c5)](_0x57bb9f=>_0x57bb9f['attributes'][_0x2c0f66(0x2eb)]===_0x5a1263);if(_0x146c2f[_0x2c0f66(0x22e)]===0x0){const _0x1aa19d=_0x4cf5f3?_0x2c0f66(0x2a6)+_0x4cf5f3:'';throw new SDKError(ErrorCode[_0x2c0f66(0x201)],'Agent\x20not\x20found:\x20'+_0x5a1263+_0x1aa19d,undefined,{'helpText':_0x4cf5f3?_0x2c0f66(0x21b):'Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.'});}if(_0x146c2f[_0x2c0f66(0x22e)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x2c0f66(0x25f)+_0x5a1263+_0x2c0f66(0x283));return _0x146c2f[0x0]['id'];}async['agents'](_0x5b1e93){const _0xa659dc=a133_0x2792c7,_0x4eba43=_0x5b1e93||this[_0xa659dc(0x262)];return await this[_0xa659dc(0x23d)][_0xa659dc(0x208)](_0x4eba43);}async[a133_0x2792c7(0x25c)](_0x13bfd8){const _0x316c84=a133_0x2792c7;return await this['client'][_0x316c84(0x2c7)](_0x13bfd8);}async[a133_0x2792c7(0x2ed)](_0xc459bf){const _0x4aa181=a133_0x2792c7;return await this[_0x4aa181(0x23d)][_0x4aa181(0x26f)](_0xc459bf);}async['createAgent'](_0x113f5e){const _0x9bff18=a133_0x2792c7;return await this[_0x9bff18(0x23d)][_0x9bff18(0x287)](_0x113f5e);}async[a133_0x2792c7(0x2b2)](_0xc6b6d9,_0x2cc82c){const _0x2f980f=a133_0x2792c7;return await this[_0x2f980f(0x23d)][_0x2f980f(0x2b2)](_0xc6b6d9,_0x2cc82c);}async[a133_0x2792c7(0x2d9)](_0x1cae3b){const _0x5c75e8=a133_0x2792c7;await this[_0x5c75e8(0x23d)][_0x5c75e8(0x2d9)](_0x1cae3b);}async['startChat'](_0x33aefc){const _0x2a16e2=a133_0x2792c7;return await this[_0x2a16e2(0x23d)][_0x2a16e2(0x2c0)]({'agentId':_0x33aefc});}async*[a133_0x2792c7(0x292)](_0x2c943a,_0x12d1c9){const _0x44e1c2=a133_0x2792c7;let _0x18b29c=_0x12d1c9?.[_0x44e1c2(0x2ba)];const _0x4b44d7=_0x12d1c9?.[_0x44e1c2(0x2a4)];if(!_0x18b29c){if(!_0x4b44d7)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x2d4503=await this[_0x44e1c2(0x23d)][_0x44e1c2(0x2c0)]({'agentId':_0x4b44d7});_0x18b29c=_0x2d4503['id'],yield{'type':_0x44e1c2(0x267),'data':{'chatId':_0x18b29c,'agentId':_0x4b44d7,'projectId':_0x2d4503[_0x44e1c2(0x2a5)]['projectId']}};}for await(const _0x4dac29 of this[_0x44e1c2(0x23d)]['continueChat'](_0x18b29c,_0x2c943a,_0x12d1c9?.[_0x44e1c2(0x284)])){yield{'type':'event','data':_0x4dac29};}}async[a133_0x2792c7(0x2ad)](_0x38c0bf=0x32){const _0x16a278=a133_0x2792c7;return await this[_0x16a278(0x23d)]['listChats'](_0x38c0bf);}async[a133_0x2792c7(0x274)](_0x5a442b){const _0x316e4a=a133_0x2792c7;return await this[_0x316e4a(0x23d)][_0x316e4a(0x2a2)](_0x5a442b);}async[a133_0x2792c7(0x1f5)](_0x412721){const _0x910887=a133_0x2792c7;return await this[_0x910887(0x23d)][_0x910887(0x1f5)](_0x412721);}async[a133_0x2792c7(0x245)](_0x3268ed){const _0x32fc13=a133_0x2792c7;return await this[_0x32fc13(0x23d)]['getChatInfo'](_0x3268ed);}async['backupProject'](_0x400e72,_0x24c94,_0x5c6ff8){const _0x2102f2=a133_0x2792c7,_0x3c7e20=_0x5c6ff8?.[_0x2102f2(0x25b)]??![],{projectId:_0x3be935,project:_0x3f53c3}=await this[_0x2102f2(0x2f7)](_0x400e72),_0x541c40=_0x3f53c3[_0x2102f2(0x2a5)]['name'],_0x4863e9=_0x24c94||_0x541c40+_0x2102f2(0x20a);if(a133_0x12a532[_0x2102f2(0x2c1)](_0x4863e9)&&!_0x3c7e20)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x2102f2(0x229)+_0x4863e9,undefined,{'helpText':_0x2102f2(0x2d4)});const _0x1403e2=await this[_0x2102f2(0x23d)][_0x2102f2(0x2c7)](_0x3be935),_0x410de5=await this[_0x2102f2(0x23d)]['listKnowledgeBases'](_0x3be935),_0x3cda31=await this[_0x2102f2(0x23d)]['listPrompts'](_0x3be935),_0x4b18b4=await this['client'][_0x2102f2(0x2e0)](_0x3be935);if(!_0x3c7e20){a133_0x12a532[_0x2102f2(0x2a7)](_0x4863e9,{'recursive':!![]});const _0x29c512={'version':_0x2102f2(0x281),'exportedAt':new Date()[_0x2102f2(0x2e7)](),'exportedFrom':{'site':this[_0x2102f2(0x2e8)][_0x2102f2(0x2ea)],'projectId':_0x3be935,'projectName':_0x541c40},'project':_0x3f53c3};a133_0x12a532[_0x2102f2(0x2b3)](a133_0x5df1f2[_0x2102f2(0x26b)](_0x4863e9,'project.json'),JSON[_0x2102f2(0x2ec)](_0x29c512,null,0x2)),a133_0x12a532[_0x2102f2(0x2b3)](a133_0x5df1f2[_0x2102f2(0x26b)](_0x4863e9,_0x2102f2(0x2ae)),JSON[_0x2102f2(0x2ec)](_0x1403e2,null,0x2)),a133_0x12a532[_0x2102f2(0x2b3)](a133_0x5df1f2[_0x2102f2(0x26b)](_0x4863e9,'knowledgebases.json'),JSON[_0x2102f2(0x2ec)](_0x410de5,null,0x2)),a133_0x12a532[_0x2102f2(0x2b3)](a133_0x5df1f2[_0x2102f2(0x26b)](_0x4863e9,_0x2102f2(0x28e)),JSON[_0x2102f2(0x2ec)](_0x3cda31,null,0x2)),a133_0x12a532[_0x2102f2(0x2b3)](a133_0x5df1f2[_0x2102f2(0x26b)](_0x4863e9,_0x2102f2(0x25d)),JSON[_0x2102f2(0x2ec)](_0x4b18b4,null,0x2));}return{'projectName':_0x541c40,'outputDir':_0x4863e9,'counts':{'agents':_0x1403e2[_0x2102f2(0x22e)],'knowledgeBases':_0x410de5[_0x2102f2(0x22e)],'prompts':_0x3cda31[_0x2102f2(0x22e)],'integrations':_0x4b18b4['length']}};}async[a133_0x2792c7(0x299)](_0xa324d5,_0x3c2f5a){const _0x37b1c5=a133_0x2792c7,_0x1e0607=_0x3c2f5a?.[_0x37b1c5(0x25b)]??![],_0x5245c7=this[_0x37b1c5(0x23e)](_0xa324d5),_0x221079=_0x5245c7[_0x37b1c5(0x210)][_0x37b1c5(0x2ea)],_0xfdd201=this[_0x37b1c5(0x2e8)][_0x37b1c5(0x2ea)],_0x1d4c79=_0x221079!==_0xfdd201?_0x221079:undefined,_0x41edee=this[_0x37b1c5(0x246)](a133_0x5df1f2[_0x37b1c5(0x26b)](_0xa324d5,_0x37b1c5(0x2ae)),[]),_0x5f1fa8=this['loadJsonFile'](a133_0x5df1f2[_0x37b1c5(0x26b)](_0xa324d5,_0x37b1c5(0x20b)),[]),_0x590c05=this['loadJsonFile'](a133_0x5df1f2[_0x37b1c5(0x26b)](_0xa324d5,_0x37b1c5(0x28e)),[]),_0x4aaaab=this['loadJsonFile'](a133_0x5df1f2['join'](_0xa324d5,_0x37b1c5(0x25d)),[]),_0x4e8081=_0x3c2f5a?.[_0x37b1c5(0x2eb)]||_0x5245c7[_0x37b1c5(0x210)][_0x37b1c5(0x1f7)];if(_0x1e0607){const _0x26c458=new Map(),_0x5f4bce=[..._0x41edee],_0x79c898=_0x41edee[_0x37b1c5(0x22e)]+0x1;let _0x6bc998=0x0;while(_0x5f4bce[_0x37b1c5(0x22e)]>0x0&&_0x6bc998<_0x79c898){_0x6bc998++;const _0xe4642a=[];for(const _0x13fba3 of _0x5f4bce){canCreateAgent(_0x13fba3,_0x26c458)?_0x26c458[_0x37b1c5(0x227)](_0x13fba3['id'],_0x37b1c5(0x2f5)+_0x13fba3['id']):_0xe4642a[_0x37b1c5(0x269)](_0x13fba3);}if(_0xe4642a['length']===_0x5f4bce['length'])throw new SDKError(ErrorCode[_0x37b1c5(0x2f3)],_0x37b1c5(0x2f8),undefined,{'helpText':_0x37b1c5(0x2b6)});_0x5f4bce[_0x37b1c5(0x22e)]=0x0,_0x5f4bce[_0x37b1c5(0x269)](..._0xe4642a);}const _0x2472a1=_0x590c05['filter'](_0x4af296=>_0x26c458[_0x37b1c5(0x1f9)](_0x4af296[_0x37b1c5(0x2a5)][_0x37b1c5(0x2a4)]))[_0x37b1c5(0x22e)];return{'projectName':_0x4e8081,'projectId':_0x37b1c5(0x212),'counts':{'agents':_0x41edee['length'],'knowledgeBases':_0x5f1fa8[_0x37b1c5(0x22e)],'prompts':_0x2472a1,'integrations':_0x4aaaab[_0x37b1c5(0x22e)]},'sourceSite':_0x1d4c79};}const _0x9df11d=await this['client']['createProject']({'name':_0x4e8081,'description':_0x5245c7['project'][_0x37b1c5(0x2a5)][_0x37b1c5(0x241)]}),_0x5c999e=_0x9df11d['id'],_0x2a62d9=new Map(),_0x312bb2=new Map(),_0x327f68=new Map();for(const _0x1fe6d5 of _0x5f1fa8){const _0x216850=await this['client'][_0x37b1c5(0x24b)]({'projectId':_0x5c999e,'name':_0x1fe6d5[_0x37b1c5(0x2a5)][_0x37b1c5(0x2eb)],'tdDatabaseName':_0x1fe6d5['attributes'][_0x37b1c5(0x228)],'tables':_0x1fe6d5[_0x37b1c5(0x2a5)][_0x37b1c5(0x237)]});_0x2a62d9[_0x37b1c5(0x227)](_0x1fe6d5['id'],_0x216850['id']);}const _0x3ec047=[..._0x41edee],_0x28553a=_0x41edee[_0x37b1c5(0x22e)]+0x1;let _0x22c593=0x0;while(_0x3ec047[_0x37b1c5(0x22e)]>0x0&&_0x22c593<_0x28553a){_0x22c593++;const _0x190e08=[];for(const _0x5c17cd of _0x3ec047){if(canCreateAgent(_0x5c17cd,_0x312bb2)){const _0x1a955c=remapToolIds(_0x5c17cd[_0x37b1c5(0x2a5)][_0x37b1c5(0x2cd)],_0x2a62d9,_0x312bb2),_0x10529e=remapVariableIds(_0x5c17cd[_0x37b1c5(0x2a5)][_0x37b1c5(0x2cb)],_0x2a62d9),_0xefe428=await this['client'][_0x37b1c5(0x273)]({'name':_0x5c17cd[_0x37b1c5(0x2a5)][_0x37b1c5(0x2eb)],'projectId':_0x5c999e,'systemPrompt':_0x5c17cd[_0x37b1c5(0x2a5)]['systemPrompt'],'starterMessage':_0x5c17cd[_0x37b1c5(0x2a5)][_0x37b1c5(0x261)],'modelType':migrateModelType(_0x5c17cd[_0x37b1c5(0x2a5)][_0x37b1c5(0x23b)]),'maxToolIterations':_0x5c17cd['attributes'][_0x37b1c5(0x2c4)],'temperature':_0x5c17cd['attributes'][_0x37b1c5(0x2e2)],'reasoningEffort':_0x5c17cd[_0x37b1c5(0x2a5)][_0x37b1c5(0x23a)],'outputs':_0x5c17cd[_0x37b1c5(0x2a5)]['outputs'],'tools':_0x1a955c,'variables':_0x10529e});_0x312bb2[_0x37b1c5(0x227)](_0x5c17cd['id'],_0xefe428['id']);}else _0x190e08[_0x37b1c5(0x269)](_0x5c17cd);}if(_0x190e08[_0x37b1c5(0x22e)]===_0x3ec047[_0x37b1c5(0x22e)])throw new SDKError(ErrorCode[_0x37b1c5(0x2f3)],_0x37b1c5(0x2f8),undefined,{'helpText':_0x37b1c5(0x2b6)});_0x3ec047[_0x37b1c5(0x22e)]=0x0,_0x3ec047[_0x37b1c5(0x269)](..._0x190e08);}for(const _0x55dbe5 of _0x590c05){const _0x179db7=_0x312bb2[_0x37b1c5(0x2b5)](_0x55dbe5[_0x37b1c5(0x2a5)][_0x37b1c5(0x2a4)]);if(!_0x179db7)continue;const _0x3ed96e=await this[_0x37b1c5(0x23d)][_0x37b1c5(0x2bc)]({'projectId':_0x5c999e,'agentId':_0x179db7,'name':_0x55dbe5[_0x37b1c5(0x2a5)][_0x37b1c5(0x2eb)],'systemPrompt':_0x55dbe5[_0x37b1c5(0x2a5)][_0x37b1c5(0x2df)],'template':_0x55dbe5['attributes'][_0x37b1c5(0x200)],'jsonSchemaHint':_0x55dbe5[_0x37b1c5(0x2a5)]['jsonSchemaHint']});_0x327f68[_0x37b1c5(0x227)](_0x55dbe5['id'],_0x3ed96e['id']);}for(const _0x5df060 of _0x4aaaab){const _0x24b35a=_0x5df060['attributes'][_0x37b1c5(0x2fb)][_0x37b1c5(0x2d1)](_0x6117a=>({..._0x6117a,'promptId':_0x327f68['get'](_0x6117a[_0x37b1c5(0x2e4)])||_0x6117a[_0x37b1c5(0x2e4)]}));await this[_0x37b1c5(0x23d)][_0x37b1c5(0x263)]({'projectId':_0x5c999e,'serviceType':_0x5df060['attributes'][_0x37b1c5(0x2c6)],'actions':_0x24b35a,'slackMessageMode':_0x5df060[_0x37b1c5(0x2a5)][_0x37b1c5(0x2d2)],'chatIgnoreManagedActions':_0x5df060['attributes'][_0x37b1c5(0x260)],'chatWelcomeMessage':_0x5df060[_0x37b1c5(0x2a5)][_0x37b1c5(0x239)],'webhookCorsOrigins':_0x5df060[_0x37b1c5(0x2a5)]['webhookCorsOrigins']});}return{'projectName':_0x4e8081,'projectId':_0x5c999e,'counts':{'agents':_0x312bb2[_0x37b1c5(0x20e)],'knowledgeBases':_0x2a62d9[_0x37b1c5(0x20e)],'prompts':_0x327f68[_0x37b1c5(0x20e)],'integrations':_0x4aaaab[_0x37b1c5(0x22e)]},'sourceSite':_0x1d4c79};}['loadJsonFile'](_0x365202,_0xffc473){const _0x5e397a=a133_0x2792c7;if(!a133_0x12a532[_0x5e397a(0x2c1)](_0x365202))return _0xffc473;return JSON['parse'](a133_0x12a532[_0x5e397a(0x220)](_0x365202,_0x5e397a(0x223)));}[a133_0x2792c7(0x23e)](_0xdb91af){const _0x26d7ad=a133_0x2792c7;if(!a133_0x12a532[_0x26d7ad(0x2c1)](_0xdb91af))throw new SDKError(ErrorCode[_0x26d7ad(0x1f3)],_0x26d7ad(0x2f9)+_0xdb91af,undefined,{'helpText':_0x26d7ad(0x2ab)});const _0x4e5a7c=a133_0x5df1f2[_0x26d7ad(0x26b)](_0xdb91af,_0x26d7ad(0x2c8));if(!a133_0x12a532[_0x26d7ad(0x2c1)](_0x4e5a7c))throw new SDKError(ErrorCode[_0x26d7ad(0x1fd)],'Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20'+_0xdb91af,undefined,{'helpText':_0x26d7ad(0x2ef)});const _0x513703=JSON[_0x26d7ad(0x282)](a133_0x12a532[_0x26d7ad(0x220)](_0x4e5a7c,_0x26d7ad(0x223)));if(!isSupportedBackupVersion(_0x513703[_0x26d7ad(0x27d)]))throw new SDKError(ErrorCode[_0x26d7ad(0x1fd)],_0x26d7ad(0x21a)+_0x513703[_0x26d7ad(0x27d)],undefined,{'helpText':'This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.'});return _0x513703;}async['pullProject'](_0x49568b,_0x3e4618,_0x266c8d){const _0x5ec165=a133_0x2792c7,{projectId:_0x38ce8b,project:_0x42c87a}=await this[_0x5ec165(0x2f7)](_0x49568b),_0x14a0c9=_0x42c87a[_0x5ec165(0x2a5)][_0x5ec165(0x2eb)];let _0x29dfd9;if(_0x3e4618)_0x29dfd9=_0x3e4618;else{const _0x14b59=a133_0x5df1f2['join'](process[_0x5ec165(0x2dd)](),'agents'),_0x3ae2f8=getSanitizedPathWithMigration(_0x14b59,_0x14a0c9);_0x3ae2f8[_0x5ec165(0x2db)]&&this[_0x5ec165(0x1f8)][_0x5ec165(0x24a)]('Renamed\x20folder:\x20'+a133_0x5df1f2[_0x5ec165(0x276)](_0x3ae2f8['oldPath'])+'\x20→\x20'+a133_0x5df1f2[_0x5ec165(0x276)](_0x3ae2f8[_0x5ec165(0x27f)])),_0x29dfd9=_0x3ae2f8['path'];}const _0x52eab1=await this[_0x5ec165(0x23d)][_0x5ec165(0x2c7)](_0x38ce8b),_0x535934=await this[_0x5ec165(0x23d)][_0x5ec165(0x298)](_0x38ce8b),_0x7e29ef=await this['client'][_0x5ec165(0x256)](_0x38ce8b),_0x1f5ecd=await safeListOrEmpty(()=>this[_0x5ec165(0x23d)]['listImageGenerators'](_0x38ce8b)),_0x1f02b5=await safeListOrEmpty(()=>this[_0x5ec165(0x23d)][_0x5ec165(0x204)](_0x38ce8b)),_0x3704b5=await this[_0x5ec165(0x23d)]['listPrompts'](_0x38ce8b),_0x21e075=await this[_0x5ec165(0x23d)]['listIntegrations'](_0x38ce8b),_0x639ea2=await safeListOrEmpty(()=>this['client'][_0x5ec165(0x1f4)](_0x38ce8b)),_0x5771ad=await safeListOrEmpty(()=>this[_0x5ec165(0x23d)][_0x5ec165(0x202)](_0x38ce8b)),_0x30d46e=_0x21e075[_0x5ec165(0x2c5)](_0x5c3839=>!_0x5c3839['attributes'][_0x5ec165(0x2b1)]&&SAFE_INTEGRATION_TYPES[_0x5ec165(0x2fd)](_0x5c3839[_0x5ec165(0x2a5)]['serviceType'][_0x5ec165(0x230)]())),_0x4eaf1f=new Map(),_0x17ef76=new Map(),_0x13b769=new Map(),_0x4dc455=new Map(),_0x12bd31=new Map(),_0x47ce40=new Map(),_0x5c7810=new Map();for(const _0x561eb7 of _0x52eab1){_0x4eaf1f[_0x5ec165(0x227)](_0x561eb7['id'],_0x561eb7[_0x5ec165(0x2a5)][_0x5ec165(0x2eb)]);}for(const _0x2f601a of _0x535934){_0x17ef76[_0x5ec165(0x227)](_0x2f601a['id'],_0x2f601a[_0x5ec165(0x2a5)]['name']);}for(const _0x4921d0 of _0x7e29ef){_0x13b769[_0x5ec165(0x227)](_0x4921d0['id'],_0x4921d0[_0x5ec165(0x2a5)][_0x5ec165(0x2eb)]);}for(const _0x76cac7 of _0x1f5ecd){_0x4dc455[_0x5ec165(0x227)](_0x76cac7['id'],_0x76cac7['attributes'][_0x5ec165(0x2eb)]);}for(const _0x4c244b of _0x1f02b5){_0x12bd31[_0x5ec165(0x227)](_0x4c244b['id'],_0x4c244b[_0x5ec165(0x2a5)][_0x5ec165(0x2eb)]);}for(const _0x276643 of _0x3704b5){_0x47ce40['set'](_0x276643['id'],_0x276643[_0x5ec165(0x2a5)]['name']);}for(const _0x565723 of _0x639ea2){_0x5c7810[_0x5ec165(0x227)](_0x565723['id'],_0x565723[_0x5ec165(0x2a5)][_0x5ec165(0x2eb)]);}const _0x5ed9f4={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x17ef76,'TextKnowledgeBase':_0x13b769,'Agent':_0x4eaf1f,'WebSearchTool':_0x12bd31,'ImageGenerator':_0x4dc455,'ExperimentalKnowledgeBase':_0x5c7810}),'resolvePromptName':async _0xb45080=>_0x47ce40[_0x5ec165(0x2b5)](_0xb45080),'onWarning':_0x11eb7e=>this[_0x5ec165(0x1f8)]['warn'](_0x11eb7e)},_0x555575={'projectName':_0x14a0c9,'outputDir':_0x29dfd9,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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}}},_0x231d07=[],_0x35a063=[];for(const _0x581fc5 of _0x52eab1){const _0x3e63ba=getSanitizedPathWithMigration(_0x29dfd9,_0x581fc5['attributes'][_0x5ec165(0x2eb)]);_0x3e63ba['renamed']&&this[_0x5ec165(0x1f8)][_0x5ec165(0x24a)](_0x5ec165(0x2cf)+a133_0x5df1f2['basename'](_0x3e63ba[_0x5ec165(0x2c2)])+'\x20→\x20'+a133_0x5df1f2['basename'](_0x3e63ba[_0x5ec165(0x27f)]));const _0x4f5e19=_0x3e63ba['path'],_0x13b1ff=a133_0x5df1f2[_0x5ec165(0x26b)](_0x4f5e19,'prompt.md'),_0x5c5e78=a133_0x5df1f2[_0x5ec165(0x26b)](_0x4f5e19,_0x5ec165(0x2f4)),_0x3358f5=a133_0x5df1f2[_0x5ec165(0x26b)](_0x4f5e19,_0x5ec165(0x2d3)),{yaml:_0x439410,systemPrompt:_0x2de557,starterMessage:_0x544cf7}=await agentResponseToDef(_0x581fc5,_0x5ed9f4),_0x34b44c=toAgentYamlString(_0x439410),_0x59cf88=!a133_0x12a532[_0x5ec165(0x2c1)](_0x5c5e78);let _0x3aae3b=_0x59cf88,_0x2b3448;if(!_0x59cf88){const _0x18cbd1=a133_0x12a532[_0x5ec165(0x2c1)](_0x13b1ff)?a133_0x12a532['readFileSync'](_0x13b1ff,'utf-8'):'',_0x423fb0=a133_0x12a532[_0x5ec165(0x220)](_0x5c5e78,_0x5ec165(0x223)),_0x2b9304='#\x20prompt.md\x0a'+_0x18cbd1+_0x5ec165(0x2bb)+_0x423fb0,_0x56bd3a=_0x5ec165(0x280)+_0x2de557+'\x0a\x0a#\x20agent.yml\x0a'+_0x34b44c,_0x434f34=generateDiff(_0x2b9304,_0x56bd3a);_0x3aae3b=hasChanges(_0x434f34),_0x3aae3b&&(_0x2b3448=formatDiffWithColors(_0x434f34));}_0x231d07[_0x5ec165(0x269)]({'path':_0x4f5e19,'content':'','isDir':!![]}),_0x231d07[_0x5ec165(0x269)]({'path':_0x13b1ff,'content':_0x2de557}),_0x231d07[_0x5ec165(0x269)]({'path':_0x5c5e78,'content':_0x34b44c});_0x544cf7&&_0x544cf7['includes']('\x0a')&&_0x231d07[_0x5ec165(0x269)]({'path':_0x3358f5,'content':_0x544cf7});_0x555575[_0x5ec165(0x1fc)][_0x5ec165(0x269)]({'agentName':_0x581fc5['attributes'][_0x5ec165(0x2eb)],'outputPath':_0x4f5e19,'isNew':_0x59cf88,'hasChanges':_0x3aae3b,'diff':_0x2b3448}),_0x555575[_0x5ec165(0x259)][_0x5ec165(0x1fc)][_0x5ec165(0x253)]++;if(_0x59cf88)_0x555575[_0x5ec165(0x259)][_0x5ec165(0x1fc)][_0x5ec165(0x26c)]++;else{if(_0x3aae3b)_0x555575[_0x5ec165(0x259)][_0x5ec165(0x1fc)][_0x5ec165(0x21f)]++;else _0x555575[_0x5ec165(0x259)]['agents'][_0x5ec165(0x301)]++;}}for(const _0x337191 of _0x535934){if(_0x337191[_0x5ec165(0x2a5)][_0x5ec165(0x2b1)])continue;const _0x5dadef=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x29dfd9),_0x337191[_0x5ec165(0x2a5)]['name'],_0x5ec165(0x2cc));_0x5dadef[_0x5ec165(0x2db)]&&this[_0x5ec165(0x1f8)]['info']('Renamed\x20KB\x20file:\x20'+a133_0x5df1f2[_0x5ec165(0x276)](_0x5dadef[_0x5ec165(0x2c2)])+'\x20→\x20'+a133_0x5df1f2[_0x5ec165(0x276)](_0x5dadef[_0x5ec165(0x27f)]));const _0x4903f9=_0x5dadef[_0x5ec165(0x27f)],_0x3394d7=apiKnowledgeBaseToYaml(_0x337191),_0x251bfc=toKnowledgeBaseYamlString(_0x3394d7),_0x232070=!a133_0x12a532['existsSync'](_0x4903f9);let _0x201294=_0x232070,_0x2681ef;if(!_0x232070){const _0x173885=a133_0x12a532[_0x5ec165(0x220)](_0x4903f9,_0x5ec165(0x223)),_0x506a36=generateDiff(_0x173885,_0x251bfc);_0x201294=hasChanges(_0x506a36),_0x201294&&(_0x2681ef=formatDiffWithColors(_0x506a36));}_0x231d07['push']({'path':_0x4903f9,'content':_0x251bfc}),_0x555575[_0x5ec165(0x278)]['push']({'name':_0x337191['attributes'][_0x5ec165(0x2eb)],'outputPath':_0x4903f9,'isNew':_0x232070,'hasChanges':_0x201294,'diff':_0x2681ef}),_0x555575[_0x5ec165(0x259)][_0x5ec165(0x278)][_0x5ec165(0x253)]++;if(_0x232070)_0x555575['counts'][_0x5ec165(0x278)][_0x5ec165(0x26c)]++;else{if(_0x201294)_0x555575[_0x5ec165(0x259)][_0x5ec165(0x278)][_0x5ec165(0x21f)]++;else _0x555575[_0x5ec165(0x259)]['knowledgeBases']['unchanged']++;}}for(const _0x150f5e of _0x7e29ef){if(_0x150f5e[_0x5ec165(0x2a5)][_0x5ec165(0x2b1)])continue;const _0x236a35=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x29dfd9),_0x150f5e[_0x5ec165(0x2a5)][_0x5ec165(0x2eb)],'.md');_0x236a35[_0x5ec165(0x2db)]&&this[_0x5ec165(0x1f8)][_0x5ec165(0x24a)](_0x5ec165(0x215)+a133_0x5df1f2[_0x5ec165(0x276)](_0x236a35[_0x5ec165(0x2c2)])+_0x5ec165(0x225)+a133_0x5df1f2[_0x5ec165(0x276)](_0x236a35[_0x5ec165(0x27f)]));const _0x409423=_0x236a35[_0x5ec165(0x27f)],_0x3a5d57=toTextKnowledgeBaseMd(_0x150f5e['attributes'][_0x5ec165(0x2eb)],_0x150f5e[_0x5ec165(0x2a5)]['text']),_0x4fd828=!a133_0x12a532[_0x5ec165(0x2c1)](_0x409423);let _0x26a7de=_0x4fd828,_0x15cba5;if(!_0x4fd828){const _0x179659=a133_0x12a532['readFileSync'](_0x409423,'utf-8'),_0x127d49=generateDiff(_0x179659,_0x3a5d57);_0x26a7de=hasChanges(_0x127d49),_0x26a7de&&(_0x15cba5=formatDiffWithColors(_0x127d49));}_0x231d07[_0x5ec165(0x269)]({'path':_0x409423,'content':_0x3a5d57}),_0x555575[_0x5ec165(0x2b9)]['push']({'name':_0x150f5e[_0x5ec165(0x2a5)][_0x5ec165(0x2eb)],'outputPath':_0x409423,'isNew':_0x4fd828,'hasChanges':_0x26a7de,'diff':_0x15cba5}),_0x555575[_0x5ec165(0x259)][_0x5ec165(0x2b9)][_0x5ec165(0x253)]++;if(_0x4fd828)_0x555575[_0x5ec165(0x259)][_0x5ec165(0x2b9)]['new']++;else{if(_0x26a7de)_0x555575[_0x5ec165(0x259)][_0x5ec165(0x2b9)][_0x5ec165(0x21f)]++;else _0x555575['counts'][_0x5ec165(0x2b9)][_0x5ec165(0x301)]++;}}for(const _0x47e8b2 of _0x3704b5){if(_0x47e8b2[_0x5ec165(0x2a5)][_0x5ec165(0x2b1)])continue;const _0xd38d8d=getSanitizedPathWithMigration(getPromptsDir(_0x29dfd9),_0x47e8b2['attributes'][_0x5ec165(0x2eb)],'.yml');_0xd38d8d[_0x5ec165(0x2db)]&&this[_0x5ec165(0x1f8)][_0x5ec165(0x24a)]('Renamed\x20prompt\x20file:\x20'+a133_0x5df1f2[_0x5ec165(0x276)](_0xd38d8d[_0x5ec165(0x2c2)])+_0x5ec165(0x225)+a133_0x5df1f2[_0x5ec165(0x276)](_0xd38d8d[_0x5ec165(0x27f)]));const _0x4aa462=_0xd38d8d['path'],_0x3a22ec=await apiPromptToYaml(_0x47e8b2,_0x5ed9f4);if(!_0x3a22ec)continue;const _0x3b1cb9=toPromptYamlString(_0x3a22ec),_0x260d64=!a133_0x12a532[_0x5ec165(0x2c1)](_0x4aa462);let _0x906c47=_0x260d64,_0x246782;if(!_0x260d64){const _0x34c050=a133_0x12a532[_0x5ec165(0x220)](_0x4aa462,_0x5ec165(0x223)),_0x5f21bf=generateDiff(_0x34c050,_0x3b1cb9);_0x906c47=hasChanges(_0x5f21bf),_0x906c47&&(_0x246782=formatDiffWithColors(_0x5f21bf));}_0x231d07[_0x5ec165(0x269)]({'path':_0x4aa462,'content':_0x3b1cb9}),_0x555575[_0x5ec165(0x272)]['push']({'name':_0x47e8b2[_0x5ec165(0x2a5)][_0x5ec165(0x2eb)],'outputPath':_0x4aa462,'isNew':_0x260d64,'hasChanges':_0x906c47,'diff':_0x246782}),_0x555575[_0x5ec165(0x259)][_0x5ec165(0x272)][_0x5ec165(0x253)]++;if(_0x260d64)_0x555575['counts'][_0x5ec165(0x272)]['new']++;else{if(_0x906c47)_0x555575[_0x5ec165(0x259)][_0x5ec165(0x272)][_0x5ec165(0x21f)]++;else _0x555575[_0x5ec165(0x259)]['prompts'][_0x5ec165(0x301)]++;}}for(const _0x16c998 of _0x30d46e){const _0x573b14=_0x16c998[_0x5ec165(0x2a5)][_0x5ec165(0x2c6)][_0x5ec165(0x230)](),_0x140198=getSanitizedPathWithMigration(getIntegrationsDir(_0x29dfd9),_0x573b14,_0x5ec165(0x2cc));_0x140198['renamed']&&this['logger'][_0x5ec165(0x24a)](_0x5ec165(0x2f6)+a133_0x5df1f2[_0x5ec165(0x276)](_0x140198[_0x5ec165(0x2c2)])+_0x5ec165(0x225)+a133_0x5df1f2[_0x5ec165(0x276)](_0x140198[_0x5ec165(0x27f)]));const _0x4cb5c6=_0x140198[_0x5ec165(0x27f)],_0x5dcbad=await apiIntegrationToYaml(_0x16c998,_0x5ed9f4),_0x662c53=toIntegrationYamlString(_0x5dcbad),_0x2f8b68=!a133_0x12a532[_0x5ec165(0x2c1)](_0x4cb5c6);let _0x6bc4a1=_0x2f8b68,_0x4bd238;if(!_0x2f8b68){const _0x1a39d2=a133_0x12a532[_0x5ec165(0x220)](_0x4cb5c6,'utf-8'),_0x817f8=generateDiff(_0x1a39d2,_0x662c53);_0x6bc4a1=hasChanges(_0x817f8),_0x6bc4a1&&(_0x4bd238=formatDiffWithColors(_0x817f8));}_0x231d07[_0x5ec165(0x269)]({'path':_0x4cb5c6,'content':_0x662c53}),_0x555575[_0x5ec165(0x26d)][_0x5ec165(0x269)]({'name':_0x573b14,'outputPath':_0x4cb5c6,'isNew':_0x2f8b68,'hasChanges':_0x6bc4a1,'diff':_0x4bd238}),_0x555575[_0x5ec165(0x259)][_0x5ec165(0x26d)]['total']++;if(_0x2f8b68)_0x555575[_0x5ec165(0x259)][_0x5ec165(0x26d)]['new']++;else{if(_0x6bc4a1)_0x555575[_0x5ec165(0x259)][_0x5ec165(0x26d)][_0x5ec165(0x21f)]++;else _0x555575[_0x5ec165(0x259)][_0x5ec165(0x26d)][_0x5ec165(0x301)]++;}}for(const _0x33556e of _0x639ea2){if(_0x33556e[_0x5ec165(0x2a5)][_0x5ec165(0x2b1)])continue;const _0x1a0665=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x29dfd9),_0x33556e['attributes'][_0x5ec165(0x2eb)]);_0x1a0665['renamed']&&this[_0x5ec165(0x1f8)]['info']('Renamed\x20experimental\x20KB\x20directory:\x20'+a133_0x5df1f2[_0x5ec165(0x276)](_0x1a0665[_0x5ec165(0x2c2)])+_0x5ec165(0x225)+a133_0x5df1f2[_0x5ec165(0x276)](_0x1a0665[_0x5ec165(0x27f)]));const _0x43b69a=_0x1a0665[_0x5ec165(0x27f)],_0x2f1524=a133_0x5df1f2['join'](_0x43b69a,sanitizeForFilesystem(_0x33556e['attributes'][_0x5ec165(0x2eb)])+'.yml'),_0x7b1152=a133_0x5df1f2[_0x5ec165(0x26b)](_0x43b69a,'functions'),_0x32a6a3=apiExperimentalKnowledgeBaseToYaml(_0x33556e),_0x2d642b=toExperimentalKnowledgeBaseYamlString(_0x32a6a3),_0x3d391a=!a133_0x12a532[_0x5ec165(0x2c1)](_0x43b69a);let _0x50531f=_0x3d391a,_0x176a9a,_0x5a2418=_0x2d642b;const _0x48af47=[..._0x32a6a3['functions']][_0x5ec165(0x294)]((_0x318769,_0x560ebc)=>_0x318769[_0x5ec165(0x2eb)][_0x5ec165(0x2fc)](_0x560ebc[_0x5ec165(0x2eb)]));for(const _0x9dba59 of _0x48af47){_0x5a2418+='\x0a---\x20function:\x20'+_0x9dba59[_0x5ec165(0x2eb)]+'\x20---\x0a'+_0x9dba59[_0x5ec165(0x218)]+_0x5ec165(0x2ff)+_0x9dba59[_0x5ec165(0x2eb)]+_0x5ec165(0x2bf)+_0x9dba59[_0x5ec165(0x206)]+'\x0a';}if(!_0x3d391a){let _0x4957bd='';a133_0x12a532[_0x5ec165(0x2c1)](_0x2f1524)&&(_0x4957bd=a133_0x12a532['readFileSync'](_0x2f1524,_0x5ec165(0x223)));if(a133_0x12a532['existsSync'](_0x7b1152)){const _0x53b4d2=a133_0x12a532['readdirSync'](_0x7b1152,{'withFileTypes':!![]}),_0x4dc276=_0x53b4d2['filter'](_0x370f2b=>_0x370f2b[_0x5ec165(0x29b)]())[_0x5ec165(0x294)]((_0x6ca2b7,_0x4c6a5d)=>_0x6ca2b7[_0x5ec165(0x2eb)]['localeCompare'](_0x4c6a5d[_0x5ec165(0x2eb)]));for(const _0x55ca69 of _0x4dc276){const _0x13f8ad=a133_0x5df1f2[_0x5ec165(0x26b)](_0x7b1152,_0x55ca69['name'],_0x5ec165(0x222)),_0x19be17=a133_0x5df1f2['join'](_0x7b1152,_0x55ca69[_0x5ec165(0x2eb)],_0x5ec165(0x2b4));a133_0x12a532['existsSync'](_0x13f8ad)&&(_0x4957bd+=_0x5ec165(0x2a1)+_0x55ca69[_0x5ec165(0x2eb)]+_0x5ec165(0x2bf)+a133_0x12a532[_0x5ec165(0x220)](_0x13f8ad,_0x5ec165(0x223))+'\x0a'),a133_0x12a532[_0x5ec165(0x2c1)](_0x19be17)&&(_0x4957bd+=_0x5ec165(0x20f)+_0x55ca69['name']+'\x20---\x0a'+a133_0x12a532['readFileSync'](_0x19be17,_0x5ec165(0x223))+'\x0a');}}const _0x4784ed=generateDiff(_0x4957bd,_0x5a2418);_0x50531f=hasChanges(_0x4784ed),_0x50531f&&(_0x176a9a=formatDiffWithColors(_0x4784ed));}_0x231d07[_0x5ec165(0x269)]({'path':_0x43b69a,'content':'','isDir':!![]}),_0x231d07[_0x5ec165(0x269)]({'path':_0x2f1524,'content':_0x2d642b}),_0x231d07[_0x5ec165(0x269)]({'path':_0x7b1152,'content':'','isDir':!![]});for(const _0xd670eb of _0x32a6a3[_0x5ec165(0x254)]){const _0x105607=a133_0x5df1f2[_0x5ec165(0x26b)](_0x7b1152,sanitizeForFilesystem(_0xd670eb[_0x5ec165(0x2eb)])),_0x225173=a133_0x5df1f2['join'](_0x105607,_0x5ec165(0x222)),_0x2ce241=a133_0x5df1f2[_0x5ec165(0x26b)](_0x105607,_0x5ec165(0x2b4));_0x231d07['push']({'path':_0x105607,'content':'','isDir':!![]}),_0x231d07['push']({'path':_0x225173,'content':_0xd670eb[_0x5ec165(0x218)]}),_0x231d07['push']({'path':_0x2ce241,'content':_0xd670eb[_0x5ec165(0x206)]});}if(a133_0x12a532[_0x5ec165(0x2c1)](_0x7b1152)){const _0x5afbd8=a133_0x12a532['readdirSync'](_0x7b1152,{'withFileTypes':!![]}),_0x2efa43=new Set(_0x32a6a3['functions'][_0x5ec165(0x2d1)](_0x14a21b=>sanitizeForFilesystem(_0x14a21b['name'])));for(const _0x28de33 of _0x5afbd8){if(_0x28de33[_0x5ec165(0x29b)]()&&!_0x2efa43[_0x5ec165(0x1f9)](_0x28de33[_0x5ec165(0x2eb)])){const _0x1b07fc=a133_0x5df1f2[_0x5ec165(0x26b)](_0x7b1152,_0x28de33[_0x5ec165(0x2eb)]);_0x35a063['push']({'path':_0x1b07fc,'isDir':!![]});}}}_0x555575[_0x5ec165(0x2e6)][_0x5ec165(0x269)]({'name':_0x33556e[_0x5ec165(0x2a5)]['name'],'outputPath':_0x43b69a,'isNew':_0x3d391a,'hasChanges':_0x50531f,'diff':_0x176a9a}),_0x555575[_0x5ec165(0x259)][_0x5ec165(0x2e6)][_0x5ec165(0x253)]++;if(_0x3d391a)_0x555575[_0x5ec165(0x259)]['experimentalKnowledgeBases'][_0x5ec165(0x26c)]++;else{if(_0x50531f)_0x555575[_0x5ec165(0x259)][_0x5ec165(0x2e6)][_0x5ec165(0x21f)]++;else _0x555575[_0x5ec165(0x259)][_0x5ec165(0x2e6)][_0x5ec165(0x301)]++;}}for(const _0x3f05ec of _0x5771ad){if(_0x3f05ec['attributes']['isManaged'])continue;const _0x176064=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x29dfd9),_0x3f05ec[_0x5ec165(0x2a5)][_0x5ec165(0x2eb)]);_0x176064['renamed']&&this['logger']['info']('Renamed\x20experimental\x20artifact\x20directory:\x20'+a133_0x5df1f2['basename'](_0x176064[_0x5ec165(0x2c2)])+_0x5ec165(0x225)+a133_0x5df1f2['basename'](_0x176064[_0x5ec165(0x27f)]));const _0x50722c=_0x176064[_0x5ec165(0x27f)],_0x3d308e=a133_0x5df1f2[_0x5ec165(0x26b)](_0x50722c,sanitizeForFilesystem(_0x3f05ec[_0x5ec165(0x2a5)][_0x5ec165(0x2eb)])+_0x5ec165(0x2cc)),_0x2e5b20=a133_0x5df1f2[_0x5ec165(0x26b)](_0x50722c,_0x5ec165(0x222)),_0x424a56=a133_0x5df1f2[_0x5ec165(0x26b)](_0x50722c,_0x5ec165(0x29f)),_0x4771ab=apiExperimentalArtifactToYaml(_0x3f05ec),_0x4d0412=toExperimentalArtifactYamlString(_0x4771ab),_0x4b76bb=!a133_0x12a532[_0x5ec165(0x2c1)](_0x50722c);let _0x29a9ec=_0x4b76bb,_0x5d557c,_0x297051=_0x4d0412+(_0x5ec165(0x22d)+_0x4771ab[_0x5ec165(0x218)]+'\x0a');const _0x480564=[..._0x4771ab[_0x5ec165(0x29f)]][_0x5ec165(0x294)]((_0xd8fab,_0x44ceb0)=>_0xd8fab[_0x5ec165(0x20c)][_0x5ec165(0x2fc)](_0x44ceb0[_0x5ec165(0x20c)]));for(const _0x1ba7bf of _0x480564){_0x297051+=_0x5ec165(0x295)+_0x1ba7bf[_0x5ec165(0x20c)]+_0x5ec165(0x2bf)+_0x1ba7bf[_0x5ec165(0x2d7)]+'\x0a';}if(!_0x4b76bb){let _0xc2d7b0='';a133_0x12a532[_0x5ec165(0x2c1)](_0x3d308e)&&(_0xc2d7b0=a133_0x12a532[_0x5ec165(0x220)](_0x3d308e,_0x5ec165(0x223)));a133_0x12a532[_0x5ec165(0x2c1)](_0x2e5b20)&&(_0xc2d7b0+=_0x5ec165(0x22d)+a133_0x12a532[_0x5ec165(0x220)](_0x2e5b20,_0x5ec165(0x223))+'\x0a');if(a133_0x12a532[_0x5ec165(0x2c1)](_0x424a56)){const _0x3f9fb7=a133_0x12a532[_0x5ec165(0x297)](_0x424a56),_0x57eecf=_0x3f9fb7[_0x5ec165(0x2c5)](_0x2e9c6f=>{const _0x2b3d59=_0x5ec165,_0x25ba21=a133_0x5df1f2[_0x2b3d59(0x26b)](_0x424a56,_0x2e9c6f);return a133_0x12a532[_0x2b3d59(0x2f2)](_0x25ba21)[_0x2b3d59(0x271)]();})[_0x5ec165(0x294)]((_0x44b288,_0x5a599f)=>_0x44b288['localeCompare'](_0x5a599f));for(const _0x5b8df7 of _0x57eecf){const _0x14ec94=a133_0x5df1f2['join'](_0x424a56,_0x5b8df7);_0xc2d7b0+=_0x5ec165(0x295)+_0x5b8df7+'\x20---\x0a'+a133_0x12a532[_0x5ec165(0x220)](_0x14ec94,_0x5ec165(0x223))+'\x0a';}}const _0x1bd451=generateDiff(_0xc2d7b0,_0x297051);_0x29a9ec=hasChanges(_0x1bd451),_0x29a9ec&&(_0x5d557c=formatDiffWithColors(_0x1bd451));}_0x231d07[_0x5ec165(0x269)]({'path':_0x50722c,'content':'','isDir':!![]}),_0x231d07['push']({'path':_0x3d308e,'content':_0x4d0412}),_0x231d07[_0x5ec165(0x269)]({'path':_0x2e5b20,'content':_0x4771ab[_0x5ec165(0x218)]});if(_0x4771ab[_0x5ec165(0x29f)][_0x5ec165(0x22e)]>0x0){_0x231d07[_0x5ec165(0x269)]({'path':_0x424a56,'content':'','isDir':!![]});for(const _0x2130a6 of _0x4771ab[_0x5ec165(0x29f)]){const _0x41cbb1=a133_0x5df1f2[_0x5ec165(0x26b)](_0x424a56,_0x2130a6[_0x5ec165(0x20c)]);_0x231d07[_0x5ec165(0x269)]({'path':_0x41cbb1,'content':_0x2130a6['text_content']});}}if(a133_0x12a532[_0x5ec165(0x2c1)](_0x424a56)){const _0x2ce551=a133_0x12a532[_0x5ec165(0x297)](_0x424a56),_0x55755e=new Set(_0x4771ab[_0x5ec165(0x29f)][_0x5ec165(0x2d1)](_0x4f7374=>_0x4f7374[_0x5ec165(0x20c)]));for(const _0x151377 of _0x2ce551){const _0x11a0c8=a133_0x5df1f2[_0x5ec165(0x26b)](_0x424a56,_0x151377);a133_0x12a532['statSync'](_0x11a0c8)[_0x5ec165(0x271)]()&&!_0x55755e['has'](_0x151377)&&_0x35a063[_0x5ec165(0x269)]({'path':_0x11a0c8});}}_0x555575['experimentalArtifacts'][_0x5ec165(0x269)]({'name':_0x3f05ec[_0x5ec165(0x2a5)][_0x5ec165(0x2eb)],'outputPath':_0x50722c,'isNew':_0x4b76bb,'hasChanges':_0x29a9ec,'diff':_0x5d557c}),_0x555575[_0x5ec165(0x259)]['experimentalArtifacts'][_0x5ec165(0x253)]++;if(_0x4b76bb)_0x555575[_0x5ec165(0x259)][_0x5ec165(0x2ca)][_0x5ec165(0x26c)]++;else{if(_0x29a9ec)_0x555575['counts'][_0x5ec165(0x2ca)][_0x5ec165(0x21f)]++;else _0x555575[_0x5ec165(0x259)][_0x5ec165(0x2ca)][_0x5ec165(0x301)]++;}}if(_0x266c8d?.[_0x5ec165(0x25b)])return _0x555575;a133_0x12a532[_0x5ec165(0x2a7)](_0x29dfd9,{'recursive':!![]}),a133_0x12a532[_0x5ec165(0x2a7)](getKnowledgeBasesDir(_0x29dfd9),{'recursive':!![]}),a133_0x12a532['mkdirSync'](getPromptsDir(_0x29dfd9),{'recursive':!![]}),a133_0x12a532[_0x5ec165(0x2a7)](getIntegrationsDir(_0x29dfd9),{'recursive':!![]}),a133_0x12a532['mkdirSync'](getExperimentalKnowledgeBasesDir(_0x29dfd9),{'recursive':!![]}),a133_0x12a532['mkdirSync'](getExperimentalArtifactsDir(_0x29dfd9),{'recursive':!![]});const _0x2dfa21=a133_0x5df1f2[_0x5ec165(0x26b)](_0x29dfd9,_0x5ec165(0x28b));a133_0x12a532['writeFileSync'](_0x2dfa21,createAgentConfigContent(_0x14a0c9));for(const _0x52a461 of _0x231d07){if(_0x52a461['isDir'])a133_0x12a532['mkdirSync'](_0x52a461['path'],{'recursive':!![]});else{const _0x23e8e2=a133_0x5df1f2['dirname'](_0x52a461[_0x5ec165(0x27f)]);!a133_0x12a532['existsSync'](_0x23e8e2)&&a133_0x12a532['mkdirSync'](_0x23e8e2,{'recursive':!![]}),a133_0x12a532[_0x5ec165(0x2b3)](_0x52a461['path'],_0x52a461['content']);}}for(const _0x268adc of _0x35a063){_0x268adc[_0x5ec165(0x24d)]?(a133_0x12a532['rmSync'](_0x268adc[_0x5ec165(0x27f)],{'recursive':!![],'force':!![]}),this['logger'][_0x5ec165(0x24a)](_0x5ec165(0x22f)+a133_0x5df1f2['basename'](a133_0x5df1f2[_0x5ec165(0x252)](_0x268adc[_0x5ec165(0x27f)]))+'/'+a133_0x5df1f2['basename'](_0x268adc[_0x5ec165(0x27f)]))):(a133_0x12a532['rmSync'](_0x268adc[_0x5ec165(0x27f)],{'force':!![]}),this['logger'][_0x5ec165(0x24a)](_0x5ec165(0x1f1)+a133_0x5df1f2[_0x5ec165(0x276)](a133_0x5df1f2['dirname'](_0x268adc[_0x5ec165(0x27f)]))+'/'+a133_0x5df1f2['basename'](_0x268adc['path'])));}return _0x555575;}async[a133_0x2792c7(0x214)](_0x1d1c0a,_0x1ac474){const _0x410c56=a133_0x2792c7,_0x34e747=a133_0x5df1f2[_0x410c56(0x26b)](_0x1d1c0a,_0x410c56(0x28b));if(!a133_0x12a532[_0x410c56(0x2c1)](_0x34e747))throw new SDKError(ErrorCode[_0x410c56(0x1fd)],_0x410c56(0x232)+_0x1d1c0a,undefined,{'helpText':_0x410c56(0x279)});const _0xceb831=loadAgentConfig(_0x34e747),_0x353036=await this['resolveProjectId'](_0xceb831['llm_project']),_0x4cdd17=await this['client'][_0x410c56(0x209)](_0x353036),_0x5edbf9=_0x4cdd17[_0x410c56(0x2a5)][_0x410c56(0x2eb)],_0xe8e365={'projectName':_0x5edbf9,'projectId':_0x353036,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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}}},_0x232d7d=[],_0x677c88=[],_0x26fb55=[],_0x48555e=[],_0x87b41e=[],_0x33a246=[],_0x303af8=a133_0x12a532[_0x410c56(0x297)](_0x1d1c0a,{'withFileTypes':!![]});for(const _0xbca8b1 of _0x303af8){if(!_0xbca8b1[_0x410c56(0x29b)]())continue;if([_0x410c56(0x22a),_0x410c56(0x272),_0x410c56(0x26d),'experimental_knowledge_bases','experimental_artifacts']['includes'](_0xbca8b1[_0x410c56(0x2eb)]))continue;const _0x17ee46=a133_0x5df1f2[_0x410c56(0x26b)](_0x1d1c0a,_0xbca8b1['name']);if(isAgentDir(_0x17ee46)){const _0xf869d5=a133_0x5df1f2[_0x410c56(0x26b)](_0x17ee46,_0x410c56(0x2f4)),_0x4ae510=a133_0x5df1f2['join'](_0x17ee46,'prompt.md'),_0x41a51e=a133_0x5df1f2[_0x410c56(0x26b)](_0x17ee46,_0x410c56(0x2d3)),_0x1904a9=parseAgentYaml(a133_0x12a532['readFileSync'](_0xf869d5,_0x410c56(0x223)),_0xf869d5),_0xc215e0=a133_0x12a532[_0x410c56(0x2c1)](_0x4ae510)?a133_0x12a532['readFileSync'](_0x4ae510,_0x410c56(0x223)):'',_0x3551cf=a133_0x12a532[_0x410c56(0x2c1)](_0x41a51e)?a133_0x12a532[_0x410c56(0x220)](_0x41a51e,_0x410c56(0x223)):_0x1904a9['starter_message'];_0x232d7d[_0x410c56(0x269)]({'name':_0x1904a9[_0x410c56(0x2eb)],'dir':_0x17ee46,'yaml':_0x1904a9,'systemPrompt':_0xc215e0,'starterMessage':_0x3551cf});}}const _0x3edda8=getKnowledgeBasesDir(_0x1d1c0a);if(a133_0x12a532[_0x410c56(0x2c1)](_0x3edda8)){const _0x3925d1=a133_0x12a532[_0x410c56(0x297)](_0x3edda8);for(const _0x34e8b8 of _0x3925d1){const _0x157b45=a133_0x5df1f2['join'](_0x3edda8,_0x34e8b8);if(_0x34e8b8[_0x410c56(0x1fe)](_0x410c56(0x2cc))){const _0x319e97=parseKnowledgeBaseYaml(a133_0x12a532[_0x410c56(0x220)](_0x157b45,_0x410c56(0x223)),_0x157b45);_0x677c88[_0x410c56(0x269)]({'name':_0x319e97[_0x410c56(0x2eb)],'path':_0x157b45,'yaml':_0x319e97});}else{if(_0x34e8b8['endsWith'](_0x410c56(0x233))){const _0x54a54c=a133_0x12a532[_0x410c56(0x220)](_0x157b45,_0x410c56(0x223)),{name:_0x1457b2,text:_0x367c13}=parseTextKnowledgeBaseMd(_0x54a54c,_0x34e8b8);_0x26fb55[_0x410c56(0x269)]({'name':_0x1457b2,'path':_0x157b45,'text':_0x367c13});}}}}const _0x29175b=getPromptsDir(_0x1d1c0a);if(a133_0x12a532[_0x410c56(0x2c1)](_0x29175b)){const _0x55c8e2=a133_0x12a532['readdirSync'](_0x29175b)[_0x410c56(0x2c5)](_0x5333eb=>_0x5333eb['endsWith'](_0x410c56(0x2cc)));for(const _0x41457f of _0x55c8e2){const _0x56b35a=a133_0x5df1f2[_0x410c56(0x26b)](_0x29175b,_0x41457f),_0x3c772e=parsePromptYaml(a133_0x12a532[_0x410c56(0x220)](_0x56b35a,'utf-8'),_0x56b35a);_0x48555e[_0x410c56(0x269)]({'name':_0x3c772e[_0x410c56(0x2eb)],'path':_0x56b35a,'yaml':_0x3c772e});}}const _0x3e45fd=[],_0x42aa63=getIntegrationsDir(_0x1d1c0a);if(a133_0x12a532['existsSync'](_0x42aa63)){const _0x1f240d=a133_0x12a532['readdirSync'](_0x42aa63)[_0x410c56(0x2c5)](_0x1c3c1d=>_0x1c3c1d[_0x410c56(0x1fe)]('.yml'));for(const _0x5394de of _0x1f240d){const _0xc85ff4=a133_0x5df1f2[_0x410c56(0x26b)](_0x42aa63,_0x5394de),_0x2fc1da=parseIntegrationYaml(a133_0x12a532[_0x410c56(0x220)](_0xc85ff4,_0x410c56(0x223)),_0xc85ff4);if(!SAFE_INTEGRATION_TYPES['includes'](_0x2fc1da['service_type'][_0x410c56(0x230)]())){this['logger']['warn']('Skipping\x20integration\x20\x27'+_0x2fc1da[_0x410c56(0x2eb)]+_0x410c56(0x2f1)+_0x2fc1da[_0x410c56(0x291)]+'):\x20'+(_0x410c56(0x240)+SAFE_INTEGRATION_TYPES[_0x410c56(0x26b)](',\x20')+_0x410c56(0x290))+'Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.');continue;}_0x3e45fd['push']({'name':_0x2fc1da[_0x410c56(0x2eb)],'path':_0xc85ff4,'yaml':_0x2fc1da});}}const _0x2c889f=getExperimentalKnowledgeBasesDir(_0x1d1c0a);if(a133_0x12a532[_0x410c56(0x2c1)](_0x2c889f)){const _0x454b99=a133_0x12a532['readdirSync'](_0x2c889f,{'withFileTypes':!![]});for(const _0x3f3366 of _0x454b99){if(!_0x3f3366[_0x410c56(0x29b)]())continue;const _0x3a2288=a133_0x5df1f2[_0x410c56(0x26b)](_0x2c889f,_0x3f3366[_0x410c56(0x2eb)]),_0x5e53c4=a133_0x5df1f2[_0x410c56(0x26b)](_0x3a2288,_0x3f3366['name']+_0x410c56(0x2cc)),_0x52a770=a133_0x5df1f2[_0x410c56(0x26b)](_0x3a2288,_0x410c56(0x254));if(!a133_0x12a532[_0x410c56(0x2c1)](_0x5e53c4))continue;const _0x1ac487=parseExperimentalKnowledgeBaseYaml(a133_0x12a532['readFileSync'](_0x5e53c4,_0x410c56(0x223)),_0x5e53c4),_0x289224=[];if(a133_0x12a532[_0x410c56(0x2c1)](_0x52a770)){const _0x1f1e22=a133_0x12a532['readdirSync'](_0x52a770,{'withFileTypes':!![]});for(const _0x1fa2f0 of _0x1f1e22){if(!_0x1fa2f0[_0x410c56(0x29b)]())continue;const _0xc24b68=a133_0x5df1f2[_0x410c56(0x26b)](_0x52a770,_0x1fa2f0[_0x410c56(0x2eb)]),_0x3737d7=a133_0x5df1f2[_0x410c56(0x26b)](_0xc24b68,_0x410c56(0x222)),_0x3c4303=a133_0x5df1f2['join'](_0xc24b68,_0x410c56(0x2b4));a133_0x12a532[_0x410c56(0x2c1)](_0x3737d7)&&a133_0x12a532['existsSync'](_0x3c4303)&&_0x289224['push']({'name':_0x1fa2f0[_0x410c56(0x2eb)],'code':a133_0x12a532[_0x410c56(0x220)](_0x3737d7,_0x410c56(0x223)),'json_schema':a133_0x12a532[_0x410c56(0x220)](_0x3c4303,'utf-8')});}}const _0x1554c0={..._0x1ac487,'variables':_0x1ac487[_0x410c56(0x2cb)]||[],'functions':_0x289224};_0x87b41e[_0x410c56(0x269)]({'name':_0x1ac487[_0x410c56(0x2eb)],'dir':_0x3a2288,'def':_0x1554c0});}}const _0xcb79ea=getExperimentalArtifactsDir(_0x1d1c0a);if(a133_0x12a532[_0x410c56(0x2c1)](_0xcb79ea)){const _0x3aec0c=a133_0x12a532[_0x410c56(0x297)](_0xcb79ea,{'withFileTypes':!![]});for(const _0x1e4e41 of _0x3aec0c){if(!_0x1e4e41[_0x410c56(0x29b)]())continue;const _0x2938c3=a133_0x5df1f2[_0x410c56(0x26b)](_0xcb79ea,_0x1e4e41[_0x410c56(0x2eb)]),_0x140b61=a133_0x5df1f2[_0x410c56(0x26b)](_0x2938c3,_0x1e4e41[_0x410c56(0x2eb)]+'.yml'),_0x34d985=a133_0x5df1f2['join'](_0x2938c3,_0x410c56(0x222)),_0x2c661f=a133_0x5df1f2[_0x410c56(0x26b)](_0x2938c3,'files');if(!a133_0x12a532[_0x410c56(0x2c1)](_0x140b61)||!a133_0x12a532[_0x410c56(0x2c1)](_0x34d985))continue;const _0x414149=parseExperimentalArtifactYaml(a133_0x12a532['readFileSync'](_0x140b61,'utf-8'),_0x140b61),_0x1a3d7d=a133_0x12a532[_0x410c56(0x220)](_0x34d985,_0x410c56(0x223)),_0x93cca9=[];if(a133_0x12a532[_0x410c56(0x2c1)](_0x2c661f)){const _0x1588f5=a133_0x12a532[_0x410c56(0x297)](_0x2c661f);for(const _0x25d753 of _0x1588f5){const _0x540b8a=a133_0x5df1f2[_0x410c56(0x26b)](_0x2c661f,_0x25d753);a133_0x12a532['statSync'](_0x540b8a)[_0x410c56(0x271)]()&&_0x93cca9[_0x410c56(0x269)]({'file_name':_0x25d753,'text_content':a133_0x12a532[_0x410c56(0x220)](_0x540b8a,_0x410c56(0x223))});}}const _0x30e35a={..._0x414149,'code':_0x1a3d7d,'files':_0x93cca9};_0x33a246[_0x410c56(0x269)]({'name':_0x414149[_0x410c56(0x2eb)],'dir':_0x2938c3,'def':_0x30e35a});}}const _0x20b5f6=await this['client']['listAgentsFull'](_0x353036),_0x3af3e6=await this['client']['listKnowledgeBases'](_0x353036),_0x147e3f=await this[_0x410c56(0x23d)]['listTextKnowledgeBases'](_0x353036),_0x1c41bc=await this[_0x410c56(0x23d)][_0x410c56(0x2a8)](_0x353036),_0x52add0=await this[_0x410c56(0x23d)][_0x410c56(0x2e0)](_0x353036),_0x4fef9f=await safeListOrEmpty(()=>this['client'][_0x410c56(0x1f4)](_0x353036)),_0xe850e2=await safeListOrEmpty(()=>this[_0x410c56(0x23d)][_0x410c56(0x202)](_0x353036)),_0x1964e4=await fetchAllToolTargetMaps((_0x5997ef,_0x4fd099)=>this['client']['listToolTargets'](_0x5997ef,_0x4fd099),_0x353036),_0x39d474=new Map(),_0x4cb1b9=new Map(),_0x4673d4=new Map(),_0x281b47=new Map(),_0x5a789d=new Map(),_0x2d820d=new Map(),_0x26a1e4=new Map();for(const _0x5831a3 of _0x20b5f6){_0x39d474[_0x410c56(0x227)](_0x5831a3['attributes'][_0x410c56(0x2eb)],_0x5831a3);}for(const _0x467869 of _0x3af3e6){_0x4cb1b9[_0x410c56(0x227)](_0x467869[_0x410c56(0x2a5)][_0x410c56(0x2eb)],_0x467869);}for(const _0xbbe84d of _0x147e3f){_0x4673d4['set'](_0xbbe84d[_0x410c56(0x2a5)][_0x410c56(0x2eb)],_0xbbe84d);}for(const _0x5b32ba of _0x1c41bc){_0x281b47[_0x410c56(0x227)](_0x5b32ba[_0x410c56(0x2a5)][_0x410c56(0x2eb)],_0x5b32ba);}for(const _0x43d51f of _0x52add0){_0x5a789d[_0x410c56(0x227)](_0x43d51f['attributes'][_0x410c56(0x2c6)][_0x410c56(0x230)](),_0x43d51f);}for(const _0x10a16c of _0x4fef9f){_0x2d820d[_0x410c56(0x227)](_0x10a16c[_0x410c56(0x2a5)][_0x410c56(0x2eb)],_0x10a16c);}for(const _0x206c8f of _0xe850e2){_0x26a1e4[_0x410c56(0x227)](_0x206c8f[_0x410c56(0x2a5)][_0x410c56(0x2eb)],_0x206c8f);}const _0x1ce04c=new Map(),_0x13890a=new Map();for(const _0x2085cb of _0x20b5f6){_0x1ce04c[_0x410c56(0x227)](_0x2085cb[_0x410c56(0x2a5)]['name'],_0x2085cb['id']),_0x13890a['set'](_0x2085cb['id'],_0x2085cb[_0x410c56(0x2a5)][_0x410c56(0x2eb)]);}const _0x13dedc=new Map(),_0x3b3470=new Map();for(const _0x1b7419 of _0x1c41bc){_0x13dedc[_0x410c56(0x227)](_0x1b7419['attributes'][_0x410c56(0x2eb)],_0x1b7419['id']),_0x3b3470[_0x410c56(0x227)](_0x1b7419['id'],_0x1b7419[_0x410c56(0x2a5)]['name']);}const _0x2e27ec=_0x1964e4[_0x410c56(0x2dc)][_0x410c56(0x2bd)]||new Map(),_0x998d29=_0x1964e4['nameToId'][_0x410c56(0x2a0)]||new Map(),_0x23c49b=_0x1964e4[_0x410c56(0x2dc)]['ExperimentalKnowledgeBase']||new Map(),_0x660362=new Map(),_0xbbf69a={'resolveToolTargetName':buildNameResolver({..._0x1964e4[_0x410c56(0x26e)],'Agent':_0x13890a}),'resolvePromptName':async _0x1cd726=>_0x3b3470[_0x410c56(0x2b5)](_0x1cd726),'onWarning':_0x5f4e59=>this[_0x410c56(0x1f8)][_0x410c56(0x2c3)](_0x5f4e59)};let _0x1bcaef=[];const _0x2906d={'projectId':_0x353036,'resolveToolTargetId':buildIdResolver({..._0x1964e4[_0x410c56(0x2dc)],'Agent':_0x1ce04c}),'resolvePromptId':async _0xb76818=>_0x13dedc[_0x410c56(0x2b5)](_0xb76818),'onWarning':_0x5508f5=>{const _0x19e9bf=_0x410c56;this[_0x19e9bf(0x1f8)][_0x19e9bf(0x2c3)](_0x5508f5),_0x1bcaef[_0x19e9bf(0x269)](_0x5508f5);}},{resolved:_0x232b7f,unresolved:_0xe07259}=resolveAgentDependencies(_0x232d7d,new Set(_0x39d474[_0x410c56(0x21e)]()));for(const {agent:_0x28cb03,missingDeps:_0x355a64}of _0xe07259){_0xe8e365[_0x410c56(0x1fc)][_0x410c56(0x269)]({'agentName':_0x28cb03['yaml'][_0x410c56(0x2eb)],'action':_0x410c56(0x236),'error':_0x410c56(0x29e)+_0x355a64[_0x410c56(0x26b)](',\x20')+_0x410c56(0x203)}),_0xe8e365['counts'][_0x410c56(0x1fc)][_0x410c56(0x2a9)]++;}for(const _0x426fe7 of _0x677c88){const _0x123d67=_0x4cb1b9[_0x410c56(0x2b5)](_0x426fe7[_0x410c56(0x27b)]['name']),_0x441e7c=a133_0x12a532[_0x410c56(0x220)](_0x426fe7[_0x410c56(0x27f)],'utf-8');if(_0x123d67){const _0x248bae=apiKnowledgeBaseToYaml(_0x123d67),_0x254f26=toKnowledgeBaseYamlString(_0x248bae),_0x68dc7=generateDiff(_0x254f26,_0x441e7c),_0x2b94d8=hasChanges(_0x68dc7);_0x2b94d8?(_0xe8e365['knowledgeBases'][_0x410c56(0x269)]({'name':_0x426fe7['yaml']['name'],'action':_0x410c56(0x21f),'id':_0x123d67['id'],'diff':formatDiffWithColors(_0x68dc7)}),_0xe8e365['counts'][_0x410c56(0x278)][_0x410c56(0x21f)]++):(_0xe8e365[_0x410c56(0x278)][_0x410c56(0x269)]({'name':_0x426fe7[_0x410c56(0x27b)][_0x410c56(0x2eb)],'action':_0x410c56(0x301),'id':_0x123d67['id']}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x278)][_0x410c56(0x301)]++);}else _0xe8e365[_0x410c56(0x278)][_0x410c56(0x269)]({'name':_0x426fe7[_0x410c56(0x27b)][_0x410c56(0x2eb)],'action':'created'}),_0xe8e365[_0x410c56(0x259)]['knowledgeBases']['created']++;}for(const _0x1c2dfa of _0x26fb55){const _0x2d099c=_0x4673d4['get'](_0x1c2dfa[_0x410c56(0x2eb)]),_0x5e726e=a133_0x12a532[_0x410c56(0x220)](_0x1c2dfa['path'],_0x410c56(0x223));if(_0x2d099c){const _0x56fec3=toTextKnowledgeBaseMd(_0x2d099c[_0x410c56(0x2a5)]['name'],_0x2d099c[_0x410c56(0x2a5)][_0x410c56(0x1f2)]),_0x278567=generateDiff(_0x56fec3,_0x5e726e),_0x513f85=hasChanges(_0x278567);_0x513f85?(_0xe8e365[_0x410c56(0x2b9)][_0x410c56(0x269)]({'name':_0x1c2dfa['name'],'action':'updated','id':_0x2d099c['id'],'diff':formatDiffWithColors(_0x278567)}),_0xe8e365['counts'][_0x410c56(0x2b9)]['updated']++):(_0xe8e365[_0x410c56(0x2b9)][_0x410c56(0x269)]({'name':_0x1c2dfa[_0x410c56(0x2eb)],'action':_0x410c56(0x301),'id':_0x2d099c['id']}),_0xe8e365[_0x410c56(0x259)]['textKnowledgeBases'][_0x410c56(0x301)]++);}else _0xe8e365[_0x410c56(0x2b9)][_0x410c56(0x269)]({'name':_0x1c2dfa[_0x410c56(0x2eb)],'action':'created'}),_0xe8e365[_0x410c56(0x259)]['textKnowledgeBases']['created']++;}for(const _0xcec2fb of _0x232b7f){const _0x28dadc=_0x39d474['get'](_0xcec2fb[_0x410c56(0x27b)][_0x410c56(0x2eb)]),_0x46c39a=a133_0x5df1f2[_0x410c56(0x26b)](_0xcec2fb[_0x410c56(0x242)],_0x410c56(0x2f4)),_0xf55cb2=a133_0x12a532[_0x410c56(0x220)](_0x46c39a,_0x410c56(0x223)),_0x4757f9=_0xcec2fb[_0x410c56(0x2df)],_0x4b7499=_0x410c56(0x280)+_0x4757f9+_0x410c56(0x2bb)+_0xf55cb2;if(_0x28dadc){const {yaml:_0x2c6f56,systemPrompt:_0x1ac28c}=await agentResponseToDef(_0x28dadc,_0xbbf69a),_0x200694=toAgentYamlString(_0x2c6f56),_0x3b8598=_0x410c56(0x280)+_0x1ac28c+_0x410c56(0x2bb)+_0x200694,_0xa69fc5=generateDiff(_0x3b8598,_0x4b7499),_0x4b6786=hasChanges(_0xa69fc5);_0x4b6786?(_0xe8e365[_0x410c56(0x1fc)][_0x410c56(0x269)]({'agentName':_0xcec2fb[_0x410c56(0x27b)][_0x410c56(0x2eb)],'action':_0x410c56(0x21f),'agentId':_0x28dadc['id'],'diff':formatDiffWithColors(_0xa69fc5)}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x1fc)][_0x410c56(0x21f)]++):(_0xe8e365[_0x410c56(0x1fc)]['push']({'agentName':_0xcec2fb[_0x410c56(0x27b)]['name'],'action':_0x410c56(0x301),'agentId':_0x28dadc['id']}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x1fc)][_0x410c56(0x301)]++);}else _0xe8e365[_0x410c56(0x1fc)][_0x410c56(0x269)]({'agentName':_0xcec2fb[_0x410c56(0x27b)][_0x410c56(0x2eb)],'action':_0x410c56(0x247)}),_0xe8e365['counts'][_0x410c56(0x1fc)][_0x410c56(0x247)]++;}for(const _0x524468 of _0x48555e){const _0x61ea21=_0x281b47[_0x410c56(0x2b5)](_0x524468[_0x410c56(0x27b)][_0x410c56(0x2eb)]),_0x23ace4=a133_0x12a532[_0x410c56(0x220)](_0x524468[_0x410c56(0x27f)],_0x410c56(0x223));if(_0x61ea21){const _0x9333=await apiPromptToYaml(_0x61ea21,_0xbbf69a);if(!_0x9333){_0xe8e365[_0x410c56(0x272)][_0x410c56(0x269)]({'name':_0x524468['yaml'][_0x410c56(0x2eb)],'action':_0x410c56(0x21f),'id':_0x61ea21['id']}),_0xe8e365[_0x410c56(0x259)]['prompts'][_0x410c56(0x21f)]++;continue;}const _0x5be721=toPromptYamlString(_0x9333),_0x1cca94=generateDiff(_0x5be721,_0x23ace4),_0x1d7284=hasChanges(_0x1cca94);_0x1d7284?(_0xe8e365['prompts']['push']({'name':_0x524468[_0x410c56(0x27b)]['name'],'action':'updated','id':_0x61ea21['id'],'diff':formatDiffWithColors(_0x1cca94)}),_0xe8e365['counts'][_0x410c56(0x272)][_0x410c56(0x21f)]++):(_0xe8e365[_0x410c56(0x272)][_0x410c56(0x269)]({'name':_0x524468[_0x410c56(0x27b)][_0x410c56(0x2eb)],'action':'unchanged','id':_0x61ea21['id']}),_0xe8e365['counts'][_0x410c56(0x272)]['unchanged']++);}else _0xe8e365[_0x410c56(0x272)][_0x410c56(0x269)]({'name':_0x524468['yaml'][_0x410c56(0x2eb)],'action':_0x410c56(0x247)}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x272)]['created']++;}for(const _0x436e18 of _0x3e45fd){const _0x2d1540=_0x5a789d[_0x410c56(0x2b5)](_0x436e18[_0x410c56(0x27b)][_0x410c56(0x291)]),_0x551c91=a133_0x12a532[_0x410c56(0x220)](_0x436e18[_0x410c56(0x27f)],_0x410c56(0x223));if(_0x2d1540){const _0x194912=await apiIntegrationToYaml(_0x2d1540,_0xbbf69a),_0x2d6501=toIntegrationYamlString(_0x194912),_0x795b53=generateDiff(_0x2d6501,_0x551c91),_0xaef8c5=hasChanges(_0x795b53);_0xaef8c5?(_0xe8e365[_0x410c56(0x26d)][_0x410c56(0x269)]({'name':_0x436e18[_0x410c56(0x27b)][_0x410c56(0x291)],'action':_0x410c56(0x21f),'id':_0x2d1540['id'],'diff':formatDiffWithColors(_0x795b53)}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x26d)][_0x410c56(0x21f)]++):(_0xe8e365['integrations'][_0x410c56(0x269)]({'name':_0x436e18[_0x410c56(0x27b)][_0x410c56(0x291)],'action':_0x410c56(0x301),'id':_0x2d1540['id']}),_0xe8e365['counts'][_0x410c56(0x26d)][_0x410c56(0x301)]++);}else _0xe8e365[_0x410c56(0x26d)][_0x410c56(0x269)]({'name':_0x436e18[_0x410c56(0x27b)][_0x410c56(0x291)],'action':_0x410c56(0x247)}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x26d)][_0x410c56(0x247)]++;}for(const _0x30331f of _0x87b41e){const _0x3002a2=_0x2d820d[_0x410c56(0x2b5)](_0x30331f[_0x410c56(0x2da)][_0x410c56(0x2eb)]),_0x3247b0=toExperimentalKnowledgeBaseYamlString(_0x30331f['def']);let _0x498fb9=_0x3247b0;for(const _0x276b93 of _0x30331f[_0x410c56(0x2da)][_0x410c56(0x254)]){_0x498fb9+=_0x410c56(0x2a1)+_0x276b93[_0x410c56(0x2eb)]+_0x410c56(0x2bf)+_0x276b93[_0x410c56(0x218)]+_0x410c56(0x2ff)+_0x276b93[_0x410c56(0x2eb)]+'\x20---\x0a'+_0x276b93[_0x410c56(0x206)]+'\x0a';}if(_0x3002a2){const _0xd1f4c9=apiExperimentalKnowledgeBaseToYaml(_0x3002a2),_0x3bb0a2=toExperimentalKnowledgeBaseYamlString(_0xd1f4c9);let _0x59e28b=_0x3bb0a2;for(const _0x40e2d2 of _0xd1f4c9[_0x410c56(0x254)]){_0x59e28b+=_0x410c56(0x2a1)+_0x40e2d2[_0x410c56(0x2eb)]+'\x20---\x0a'+_0x40e2d2[_0x410c56(0x218)]+'\x0a---\x20schema:\x20'+_0x40e2d2[_0x410c56(0x2eb)]+_0x410c56(0x2bf)+_0x40e2d2['json_schema']+'\x0a';}const _0x4a079a=generateDiff(_0x59e28b,_0x498fb9),_0x2b2571=hasChanges(_0x4a079a);_0x2b2571?(_0xe8e365[_0x410c56(0x2e6)][_0x410c56(0x269)]({'name':_0x30331f[_0x410c56(0x2da)][_0x410c56(0x2eb)],'action':_0x410c56(0x21f),'id':_0x3002a2['id'],'diff':formatDiffWithColors(_0x4a079a)}),_0xe8e365[_0x410c56(0x259)]['experimentalKnowledgeBases'][_0x410c56(0x21f)]++):(_0xe8e365[_0x410c56(0x2e6)]['push']({'name':_0x30331f[_0x410c56(0x2da)][_0x410c56(0x2eb)],'action':_0x410c56(0x301),'id':_0x3002a2['id']}),_0xe8e365[_0x410c56(0x259)]['experimentalKnowledgeBases'][_0x410c56(0x301)]++);}else _0xe8e365[_0x410c56(0x2e6)]['push']({'name':_0x30331f[_0x410c56(0x2da)]['name'],'action':'created'}),_0xe8e365['counts']['experimentalKnowledgeBases'][_0x410c56(0x247)]++;}for(const _0x3438b3 of _0x33a246){const _0x9e71b2=_0x26a1e4['get'](_0x3438b3['def'][_0x410c56(0x2eb)]),_0x16f060=toExperimentalArtifactYamlString(_0x3438b3[_0x410c56(0x2da)]);let _0x288f4b=_0x16f060+(_0x410c56(0x22d)+_0x3438b3[_0x410c56(0x2da)]['code']+'\x0a');for(const _0x26160c of _0x3438b3[_0x410c56(0x2da)][_0x410c56(0x29f)]){_0x288f4b+=_0x410c56(0x295)+_0x26160c['file_name']+_0x410c56(0x2bf)+_0x26160c[_0x410c56(0x2d7)]+'\x0a';}if(_0x9e71b2){const _0x59b46b=apiExperimentalArtifactToYaml(_0x9e71b2),_0x421009=toExperimentalArtifactYamlString(_0x59b46b);let _0x33ad70=_0x421009+('\x0a---\x20code\x20---\x0a'+_0x59b46b[_0x410c56(0x218)]+'\x0a');for(const _0x24aebd of _0x59b46b[_0x410c56(0x29f)]){_0x33ad70+=_0x410c56(0x295)+_0x24aebd[_0x410c56(0x20c)]+_0x410c56(0x2bf)+_0x24aebd[_0x410c56(0x2d7)]+'\x0a';}const _0x5788df=generateDiff(_0x33ad70,_0x288f4b),_0x51dbf5=hasChanges(_0x5788df);_0x51dbf5?(_0xe8e365[_0x410c56(0x2ca)]['push']({'name':_0x3438b3[_0x410c56(0x2da)][_0x410c56(0x2eb)],'action':_0x410c56(0x21f),'id':_0x9e71b2['id'],'diff':formatDiffWithColors(_0x5788df)}),_0xe8e365['counts'][_0x410c56(0x2ca)][_0x410c56(0x21f)]++):(_0xe8e365[_0x410c56(0x2ca)]['push']({'name':_0x3438b3['def'][_0x410c56(0x2eb)],'action':_0x410c56(0x301),'id':_0x9e71b2['id']}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x2ca)][_0x410c56(0x301)]++);}else _0xe8e365[_0x410c56(0x2ca)][_0x410c56(0x269)]({'name':_0x3438b3[_0x410c56(0x2da)][_0x410c56(0x2eb)],'action':_0x410c56(0x247)}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x2ca)][_0x410c56(0x247)]++;}if(_0x1ac474?.[_0x410c56(0x25b)])return _0xe8e365;_0xe8e365['knowledgeBases']=[],_0xe8e365[_0x410c56(0x2b9)]=[],_0xe8e365['prompts']=[],_0xe8e365[_0x410c56(0x26d)]=[],_0xe8e365[_0x410c56(0x2e6)]=[],_0xe8e365[_0x410c56(0x2ca)]=[];const _0x22f5e2=_0xe8e365['agents'][_0x410c56(0x2c5)](_0x114384=>_0x114384[_0x410c56(0x2c9)]===_0x410c56(0x236));_0xe8e365[_0x410c56(0x1fc)]=_0x22f5e2,_0xe8e365[_0x410c56(0x259)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x22f5e2['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}};for(const _0x17a6c of _0x677c88){try{const _0x2d197b=_0x4cb1b9[_0x410c56(0x2b5)](_0x17a6c[_0x410c56(0x27b)]['name']),_0x3669d3=yamlKnowledgeBaseToApi(_0x17a6c['yaml'],_0x353036);if(_0x2d197b)await this[_0x410c56(0x23d)][_0x410c56(0x2e9)](_0x2d197b['id'],_0x3669d3),_0x2e27ec['set'](_0x17a6c['yaml']['name'],_0x2d197b['id']),_0xe8e365[_0x410c56(0x278)][_0x410c56(0x269)]({'name':_0x17a6c[_0x410c56(0x27b)][_0x410c56(0x2eb)],'action':_0x410c56(0x21f),'id':_0x2d197b['id']}),_0xe8e365['counts']['knowledgeBases'][_0x410c56(0x21f)]++;else{const _0x41e078=await this[_0x410c56(0x23d)][_0x410c56(0x24b)](_0x3669d3);_0x2e27ec[_0x410c56(0x227)](_0x17a6c[_0x410c56(0x27b)][_0x410c56(0x2eb)],_0x41e078['id']),_0xe8e365[_0x410c56(0x278)][_0x410c56(0x269)]({'name':_0x17a6c[_0x410c56(0x27b)][_0x410c56(0x2eb)],'action':'created','id':_0x41e078['id']}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x278)]['created']++;}}catch(_0x1fb9a5){_0xe8e365[_0x410c56(0x278)]['push']({'name':_0x17a6c[_0x410c56(0x27b)][_0x410c56(0x2eb)],'action':_0x410c56(0x236),'error':_0x1fb9a5[_0x410c56(0x249)]}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x278)][_0x410c56(0x2a9)]++;}}for(const _0x2148ad of _0x26fb55){try{const _0x4e2e00=_0x4673d4[_0x410c56(0x2b5)](_0x2148ad[_0x410c56(0x2eb)]),_0x21fbbe=yamlTextKnowledgeBaseToApi({'name':_0x2148ad['name'],'text':_0x2148ad[_0x410c56(0x1f2)]},_0x353036);if(_0x4e2e00)await this[_0x410c56(0x23d)]['updateTextKnowledgeBase'](_0x4e2e00['id'],_0x21fbbe),_0x998d29[_0x410c56(0x227)](_0x2148ad[_0x410c56(0x2eb)],_0x4e2e00['id']),_0xe8e365[_0x410c56(0x2b9)][_0x410c56(0x269)]({'name':_0x2148ad[_0x410c56(0x2eb)],'action':_0x410c56(0x21f),'id':_0x4e2e00['id']}),_0xe8e365['counts'][_0x410c56(0x2b9)][_0x410c56(0x21f)]++;else{const _0x4433df=await this[_0x410c56(0x23d)][_0x410c56(0x289)](_0x21fbbe);_0x998d29[_0x410c56(0x227)](_0x2148ad[_0x410c56(0x2eb)],_0x4433df['id']),_0xe8e365[_0x410c56(0x2b9)][_0x410c56(0x269)]({'name':_0x2148ad[_0x410c56(0x2eb)],'action':_0x410c56(0x247),'id':_0x4433df['id']}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x2b9)][_0x410c56(0x247)]++;}}catch(_0x1d74c6){_0xe8e365['textKnowledgeBases']['push']({'name':_0x2148ad[_0x410c56(0x2eb)],'action':_0x410c56(0x236),'error':_0x1d74c6[_0x410c56(0x249)]}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x2b9)][_0x410c56(0x2a9)]++;}}for(const _0xee9d23 of _0x87b41e){try{const _0x1df528=_0x2d820d[_0x410c56(0x2b5)](_0xee9d23[_0x410c56(0x2da)][_0x410c56(0x2eb)]),_0x3106ad=yamlExperimentalKnowledgeBaseToApi(_0xee9d23['def'],_0x353036);if(_0x1df528)await this[_0x410c56(0x23d)][_0x410c56(0x2e5)](_0x1df528['id'],_0x3106ad),_0x23c49b[_0x410c56(0x227)](_0xee9d23[_0x410c56(0x2da)][_0x410c56(0x2eb)],_0x1df528['id']),_0xe8e365[_0x410c56(0x2e6)][_0x410c56(0x269)]({'name':_0xee9d23[_0x410c56(0x2da)][_0x410c56(0x2eb)],'action':_0x410c56(0x21f),'id':_0x1df528['id']}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x2e6)][_0x410c56(0x21f)]++;else{const _0x2b85d7=await this[_0x410c56(0x23d)][_0x410c56(0x205)](_0x3106ad);_0x23c49b['set'](_0xee9d23[_0x410c56(0x2da)][_0x410c56(0x2eb)],_0x2b85d7['id']),_0xe8e365[_0x410c56(0x2e6)]['push']({'name':_0xee9d23[_0x410c56(0x2da)]['name'],'action':_0x410c56(0x247),'id':_0x2b85d7['id']}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x2e6)][_0x410c56(0x247)]++;}}catch(_0x470038){_0xe8e365[_0x410c56(0x2e6)][_0x410c56(0x269)]({'name':_0xee9d23[_0x410c56(0x2da)][_0x410c56(0x2eb)],'action':_0x410c56(0x236),'error':_0x470038[_0x410c56(0x249)]}),_0xe8e365['counts'][_0x410c56(0x2e6)][_0x410c56(0x2a9)]++;}}for(const _0x48f1e2 of _0x33a246){try{const _0x1410d2=_0x26a1e4['get'](_0x48f1e2[_0x410c56(0x2da)]['name']),_0x521fde=yamlExperimentalArtifactToApi(_0x48f1e2[_0x410c56(0x2da)],_0x353036);if(_0x1410d2)await this[_0x410c56(0x23d)][_0x410c56(0x21c)](_0x1410d2['id'],_0x521fde),_0x660362['set'](_0x48f1e2['def'][_0x410c56(0x2eb)],_0x1410d2['id']),_0xe8e365[_0x410c56(0x2ca)]['push']({'name':_0x48f1e2['def']['name'],'action':_0x410c56(0x21f),'id':_0x1410d2['id']}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x2ca)][_0x410c56(0x21f)]++;else{const _0x5a1e85=await this[_0x410c56(0x23d)][_0x410c56(0x248)](_0x521fde);_0x660362[_0x410c56(0x227)](_0x48f1e2[_0x410c56(0x2da)][_0x410c56(0x2eb)],_0x5a1e85['id']),_0xe8e365[_0x410c56(0x2ca)]['push']({'name':_0x48f1e2['def'][_0x410c56(0x2eb)],'action':'created','id':_0x5a1e85['id']}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x2ca)][_0x410c56(0x247)]++;}}catch(_0x489191){_0xe8e365['experimentalArtifacts'][_0x410c56(0x269)]({'name':_0x48f1e2[_0x410c56(0x2da)][_0x410c56(0x2eb)],'action':_0x410c56(0x236),'error':_0x489191[_0x410c56(0x249)]}),_0xe8e365['counts'][_0x410c56(0x2ca)]['errors']++;}}for(const _0x251e67 of _0x232b7f){_0x1bcaef=[];try{const _0x404c16=_0x39d474[_0x410c56(0x2b5)](_0x251e67[_0x410c56(0x27b)][_0x410c56(0x2eb)]),_0x49eb91=await agentDefToRequest(_0x251e67[_0x410c56(0x27b)],_0x251e67[_0x410c56(0x2df)],_0x251e67[_0x410c56(0x261)],_0x2906d);if(_0x404c16)await this[_0x410c56(0x23d)][_0x410c56(0x28f)](_0x404c16['id'],_0x49eb91),_0x1ce04c[_0x410c56(0x227)](_0x251e67['yaml']['name'],_0x404c16['id']),_0xe8e365[_0x410c56(0x1fc)][_0x410c56(0x269)]({'agentName':_0x251e67[_0x410c56(0x27b)][_0x410c56(0x2eb)],'action':'updated','agentId':_0x404c16['id'],'warnings':_0x1bcaef[_0x410c56(0x22e)]>0x0?_0x1bcaef:undefined}),_0xe8e365[_0x410c56(0x259)]['agents'][_0x410c56(0x21f)]++;else{const _0x438af9=await this['client'][_0x410c56(0x273)](_0x49eb91);_0x1ce04c[_0x410c56(0x227)](_0x251e67[_0x410c56(0x27b)][_0x410c56(0x2eb)],_0x438af9['id']),_0xe8e365[_0x410c56(0x1fc)][_0x410c56(0x269)]({'agentName':_0x251e67['yaml'][_0x410c56(0x2eb)],'action':'created','agentId':_0x438af9['id'],'warnings':_0x1bcaef[_0x410c56(0x22e)]>0x0?_0x1bcaef:undefined}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x1fc)][_0x410c56(0x247)]++;}}catch(_0x4e8884){_0xe8e365['agents'][_0x410c56(0x269)]({'agentName':_0x251e67[_0x410c56(0x27b)]['name'],'action':_0x410c56(0x236),'error':_0x4e8884['message'],'warnings':_0x1bcaef[_0x410c56(0x22e)]>0x0?_0x1bcaef:undefined}),_0xe8e365['counts'][_0x410c56(0x1fc)][_0x410c56(0x2a9)]++;}}for(const _0x1d8cfd of _0x48555e){try{const _0x413385=_0x281b47['get'](_0x1d8cfd[_0x410c56(0x27b)][_0x410c56(0x2eb)]),_0x3d67b2=await yamlPromptToApi(_0x1d8cfd['yaml'],_0x353036,_0x2906d);if(!_0x3d67b2){_0xe8e365[_0x410c56(0x272)][_0x410c56(0x269)]({'name':_0x1d8cfd[_0x410c56(0x27b)][_0x410c56(0x2eb)],'action':_0x410c56(0x236),'error':'Agent\x20reference\x20not\x20found'}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x272)][_0x410c56(0x2a9)]++;continue;}if(_0x413385)await this[_0x410c56(0x23d)][_0x410c56(0x28a)](_0x413385['id'],_0x3d67b2),_0x13dedc[_0x410c56(0x227)](_0x1d8cfd[_0x410c56(0x27b)]['name'],_0x413385['id']),_0xe8e365[_0x410c56(0x272)][_0x410c56(0x269)]({'name':_0x1d8cfd['yaml'][_0x410c56(0x2eb)],'action':_0x410c56(0x21f),'id':_0x413385['id']}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x272)][_0x410c56(0x21f)]++;else{const _0xe4b7b5=await this[_0x410c56(0x23d)]['createPrompt'](_0x3d67b2);_0x13dedc['set'](_0x1d8cfd[_0x410c56(0x27b)][_0x410c56(0x2eb)],_0xe4b7b5['id']),_0xe8e365[_0x410c56(0x272)][_0x410c56(0x269)]({'name':_0x1d8cfd[_0x410c56(0x27b)]['name'],'action':'created','id':_0xe4b7b5['id']}),_0xe8e365[_0x410c56(0x259)]['prompts'][_0x410c56(0x247)]++;}}catch(_0x1114d0){_0xe8e365[_0x410c56(0x272)]['push']({'name':_0x1d8cfd['yaml'][_0x410c56(0x2eb)],'action':'error','error':_0x1114d0['message']}),_0xe8e365['counts']['prompts'][_0x410c56(0x2a9)]++;}}for(const _0x53e3bb of _0x3e45fd){try{const _0x46223e=_0x5a789d[_0x410c56(0x2b5)](_0x53e3bb[_0x410c56(0x27b)]['service_type']),_0x41d9da=await yamlIntegrationToApi(_0x53e3bb[_0x410c56(0x27b)],_0x353036,_0x2906d);if(_0x46223e){await this[_0x410c56(0x23d)]['deleteIntegration'](_0x46223e['id']);const _0x5b7fcd=await this[_0x410c56(0x23d)][_0x410c56(0x263)](_0x41d9da);_0xe8e365[_0x410c56(0x26d)][_0x410c56(0x269)]({'name':_0x53e3bb['yaml']['service_type'],'action':'updated','id':_0x5b7fcd['id']}),_0xe8e365['counts'][_0x410c56(0x26d)][_0x410c56(0x21f)]++;}else{const _0x3107a8=await this[_0x410c56(0x23d)]['createIntegration'](_0x41d9da);_0xe8e365[_0x410c56(0x26d)][_0x410c56(0x269)]({'name':_0x53e3bb['yaml'][_0x410c56(0x291)],'action':_0x410c56(0x247),'id':_0x3107a8['id']}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x26d)]['created']++;}}catch(_0xd12bd){_0xe8e365[_0x410c56(0x26d)][_0x410c56(0x269)]({'name':_0x53e3bb[_0x410c56(0x27b)][_0x410c56(0x291)],'action':'error','error':_0xd12bd[_0x410c56(0x249)]}),_0xe8e365[_0x410c56(0x259)][_0x410c56(0x26d)][_0x410c56(0x2a9)]++;}}return _0xe8e365;}async[a133_0x2792c7(0x244)](_0x55c4e6,_0x29fcae,_0x4a2ed9,_0xdf3734){const _0x34141e=a133_0x2792c7,{projectId:_0x98414c,project:_0x1dd334}=await this['resolveProjectName'](_0x55c4e6),_0x1b95bb=_0x1dd334['attributes']['name'],_0x35ab15=await this[_0x34141e(0x23d)][_0x34141e(0x2c7)](_0x98414c),_0x361762=_0x35ab15['find'](_0x49725b=>_0x49725b[_0x34141e(0x2a5)][_0x34141e(0x2eb)]===_0x29fcae);if(!_0x361762)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],'Agent\x20not\x20found:\x20'+_0x29fcae,undefined,{'helpText':_0x34141e(0x221)+_0x35ab15[_0x34141e(0x2d1)](_0x17cbca=>_0x17cbca[_0x34141e(0x2a5)]['name'])[_0x34141e(0x26b)](',\x20')});let _0x14b6f6;if(_0x4a2ed9)_0x14b6f6=_0x4a2ed9;else{const _0x1af9a6=a133_0x5df1f2[_0x34141e(0x26b)](process[_0x34141e(0x2dd)](),_0x34141e(0x1fc)),_0x3dc8cb=getSanitizedPathWithMigration(_0x1af9a6,_0x1b95bb);_0x3dc8cb[_0x34141e(0x2db)]&&this[_0x34141e(0x1f8)][_0x34141e(0x24a)](_0x34141e(0x26a)+a133_0x5df1f2['basename'](_0x3dc8cb[_0x34141e(0x2c2)])+'\x20→\x20'+a133_0x5df1f2[_0x34141e(0x276)](_0x3dc8cb['path'])),_0x14b6f6=_0x3dc8cb[_0x34141e(0x27f)];}const _0x5da140=getSanitizedPathWithMigration(_0x14b6f6,_0x29fcae);_0x5da140[_0x34141e(0x2db)]&&this[_0x34141e(0x1f8)][_0x34141e(0x24a)]('Renamed\x20agent\x20folder:\x20'+a133_0x5df1f2[_0x34141e(0x276)](_0x5da140['oldPath'])+_0x34141e(0x225)+a133_0x5df1f2['basename'](_0x5da140[_0x34141e(0x27f)]));const _0x432468=_0x5da140['path'],_0x43bb8d=new Map(),_0x33df15=new Map(),_0x5b9fa4=await this[_0x34141e(0x23d)][_0x34141e(0x298)](_0x98414c),_0x463708=await this[_0x34141e(0x23d)]['listTextKnowledgeBases'](_0x98414c),_0x2a446c=await safeListOrEmpty(()=>this[_0x34141e(0x23d)]['listExperimentalKnowledgeBases'](_0x98414c)),_0x234492=new Map(),_0x4e9d35=new Map();for(const _0x3dcc3f of _0x5b9fa4){_0x43bb8d['set'](_0x3dcc3f['id'],_0x3dcc3f['attributes'][_0x34141e(0x2eb)]);}for(const _0x49e508 of _0x463708){_0x234492[_0x34141e(0x227)](_0x49e508['id'],_0x49e508['attributes'][_0x34141e(0x2eb)]);}for(const _0x1f16e8 of _0x2a446c){_0x4e9d35['set'](_0x1f16e8['id'],_0x1f16e8[_0x34141e(0x2a5)][_0x34141e(0x2eb)]);}for(const _0x5098be of _0x35ab15){_0x33df15[_0x34141e(0x227)](_0x5098be['id'],_0x5098be[_0x34141e(0x2a5)][_0x34141e(0x2eb)]);}const _0x56a54f={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x43bb8d,'TextKnowledgeBase':_0x234492,'Agent':_0x33df15,'ExperimentalKnowledgeBase':_0x4e9d35}),'resolvePromptName':async()=>undefined,'onWarning':_0x17c3dd=>this[_0x34141e(0x1f8)][_0x34141e(0x2c3)](_0x17c3dd)},_0x47f392=a133_0x5df1f2['join'](_0x432468,_0x34141e(0x286)),_0x253435=a133_0x5df1f2[_0x34141e(0x26b)](_0x432468,_0x34141e(0x2f4)),_0x52a82f=a133_0x5df1f2[_0x34141e(0x26b)](_0x432468,_0x34141e(0x2d3)),_0x4764c8=!a133_0x12a532['existsSync'](_0x253435);if(_0xdf3734?.[_0x34141e(0x25b)])return{'agentName':_0x29fcae,'outputPath':_0x432468,'isNew':_0x4764c8,'hasChanges':!![]};a133_0x12a532[_0x34141e(0x2a7)](_0x14b6f6,{'recursive':!![]}),a133_0x12a532[_0x34141e(0x2a7)](_0x432468,{'recursive':!![]});const _0x1dc1f9=a133_0x5df1f2[_0x34141e(0x26b)](_0x14b6f6,_0x34141e(0x28b));!a133_0x12a532[_0x34141e(0x2c1)](_0x1dc1f9)&&a133_0x12a532['writeFileSync'](_0x1dc1f9,createAgentConfigContent(_0x55c4e6));const {yaml:_0x198240,systemPrompt:_0x16f609,starterMessage:_0xdf8efd}=await agentResponseToDef(_0x361762,_0x56a54f);let _0x1bd9d5=_0x4764c8;if(!_0x4764c8){const _0x23e149=a133_0x12a532['existsSync'](_0x47f392)?a133_0x12a532['readFileSync'](_0x47f392,_0x34141e(0x223)):'',_0x57ccca=a133_0x12a532[_0x34141e(0x220)](_0x253435,_0x34141e(0x223));_0x1bd9d5=_0x23e149!==_0x16f609||_0x57ccca!==toAgentYamlString(_0x198240);}a133_0x12a532[_0x34141e(0x2b3)](_0x47f392,_0x16f609),a133_0x12a532[_0x34141e(0x2b3)](_0x253435,toAgentYamlString(_0x198240));if(_0xdf8efd&&_0xdf8efd['includes']('\x0a'))a133_0x12a532[_0x34141e(0x2b3)](_0x52a82f,_0xdf8efd);else a133_0x12a532[_0x34141e(0x2c1)](_0x52a82f)&&a133_0x12a532[_0x34141e(0x2d0)](_0x52a82f);return{'agentName':_0x29fcae,'outputPath':_0x432468,'isNew':_0x4764c8,'hasChanges':_0x1bd9d5};}async[a133_0x2792c7(0x2ee)](_0x2a7636,_0x14590d){const _0x2b321b=a133_0x2792c7;let _0x385a86;isAgentYamlPath(_0x2a7636)?_0x385a86=getAgentDirFromYamlPath(_0x2a7636):_0x385a86=_0x2a7636;const {config:_0x29aea0}=findAgentConfig(_0x385a86),_0x4d2511=await this['resolveProjectId'](_0x29aea0[_0x2b321b(0x2b0)]),_0x4eddd9=a133_0x5df1f2[_0x2b321b(0x26b)](_0x385a86,_0x2b321b(0x2f4)),_0x1d7c3e=a133_0x5df1f2[_0x2b321b(0x26b)](_0x385a86,_0x2b321b(0x286)),_0x334ea9=a133_0x5df1f2[_0x2b321b(0x26b)](_0x385a86,'starter_message.md');if(!a133_0x12a532['existsSync'](_0x4eddd9))throw new SDKError(ErrorCode[_0x2b321b(0x1f3)],_0x2b321b(0x226)+_0x385a86,undefined,{'helpText':_0x2b321b(0x2f0)});const _0x5da5c7=parseAgentYaml(a133_0x12a532[_0x2b321b(0x220)](_0x4eddd9,_0x2b321b(0x223)),_0x4eddd9),_0x56b204=a133_0x12a532[_0x2b321b(0x2c1)](_0x1d7c3e)?a133_0x12a532[_0x2b321b(0x220)](_0x1d7c3e,_0x2b321b(0x223)):'',_0x372a20=a133_0x12a532[_0x2b321b(0x2c1)](_0x334ea9)?a133_0x12a532['readFileSync'](_0x334ea9,'utf-8'):_0x5da5c7['starter_message'];if(_0x14590d?.[_0x2b321b(0x25b)])return{'agentName':_0x5da5c7[_0x2b321b(0x2eb)],'action':_0x2b321b(0x247),'projectId':_0x4d2511};const _0x128ff2=await this[_0x2b321b(0x23d)][_0x2b321b(0x2c7)](_0x4d2511),_0x544b17=await fetchAllToolTargetMaps((_0x2c928e,_0x2e01e9)=>this[_0x2b321b(0x23d)][_0x2b321b(0x270)](_0x2c928e,_0x2e01e9),_0x4d2511),_0x2a1a4a=new Map();for(const _0x32b9b7 of _0x128ff2){_0x2a1a4a[_0x2b321b(0x227)](_0x32b9b7[_0x2b321b(0x2a5)][_0x2b321b(0x2eb)],_0x32b9b7['id']);}const _0x347f1f=[],_0x5cd1a6={'projectId':_0x4d2511,'resolveToolTargetId':buildIdResolver({..._0x544b17[_0x2b321b(0x2dc)],'Agent':_0x2a1a4a}),'resolvePromptId':async()=>undefined,'onWarning':_0x427d3e=>{const _0x2e4c62=_0x2b321b;this[_0x2e4c62(0x1f8)][_0x2e4c62(0x2c3)](_0x427d3e),_0x347f1f['push'](_0x427d3e);}};try{const _0x194290=_0x128ff2[_0x2b321b(0x29d)](_0x50734d=>_0x50734d[_0x2b321b(0x2a5)]['name']===_0x5da5c7[_0x2b321b(0x2eb)]),_0x2144a3=await agentDefToRequest(_0x5da5c7,_0x56b204,_0x372a20,_0x5cd1a6);if(_0x194290)return await this[_0x2b321b(0x23d)][_0x2b321b(0x28f)](_0x194290['id'],_0x2144a3),{'agentName':_0x5da5c7['name'],'action':_0x2b321b(0x21f),'projectId':_0x4d2511,'agentId':_0x194290['id'],'warnings':_0x347f1f[_0x2b321b(0x22e)]>0x0?_0x347f1f:undefined};else{const _0x43de06=await this[_0x2b321b(0x23d)][_0x2b321b(0x273)](_0x2144a3);return{'agentName':_0x5da5c7[_0x2b321b(0x2eb)],'action':_0x2b321b(0x247),'projectId':_0x4d2511,'agentId':_0x43de06['id'],'warnings':_0x347f1f[_0x2b321b(0x22e)]>0x0?_0x347f1f:undefined};}}catch(_0x4cb076){return{'agentName':_0x5da5c7['name'],'action':_0x2b321b(0x236),'projectId':_0x4d2511,'error':_0x4cb076[_0x2b321b(0x249)],'warnings':_0x347f1f[_0x2b321b(0x22e)]>0x0?_0x347f1f:undefined};}}async['cloneProject'](_0xbfdf37,_0x5846a6,_0x54ec7c){const _0x5b79fb=a133_0x2792c7,_0x20a9a4=a133_0x12a532['existsSync'](_0xbfdf37)&&a133_0x12a532[_0x5b79fb(0x2c1)](a133_0x5df1f2[_0x5b79fb(0x26b)](_0xbfdf37,_0x5b79fb(0x28b)));let _0x1ffbd0;const _0x5a5ce6=[],_0x31ebb1=[],_0x22f90b=[],_0x45ceed=[],_0x78d811=[],_0x81e12e=[],_0x245150=[];if(_0x20a9a4){const _0x12491b=loadAgentConfig(a133_0x5df1f2[_0x5b79fb(0x26b)](_0xbfdf37,_0x5b79fb(0x28b)));_0x1ffbd0=_0x12491b[_0x5b79fb(0x2b0)];const _0x2f5e0e=a133_0x12a532[_0x5b79fb(0x297)](_0xbfdf37,{'withFileTypes':!![]});for(const _0x26ed88 of _0x2f5e0e){if(!_0x26ed88['isDirectory']())continue;if([_0x5b79fb(0x22a),'experimental_knowledge_bases','experimental_artifacts',_0x5b79fb(0x272),_0x5b79fb(0x26d)]['includes'](_0x26ed88['name']))continue;const _0x1fd88c=a133_0x5df1f2['join'](_0xbfdf37,_0x26ed88[_0x5b79fb(0x2eb)]);if(isAgentDir(_0x1fd88c)){const _0x44b163=a133_0x5df1f2['join'](_0x1fd88c,_0x5b79fb(0x2f4)),_0x4f36d9=a133_0x5df1f2[_0x5b79fb(0x26b)](_0x1fd88c,_0x5b79fb(0x286)),_0xee0f3=a133_0x5df1f2['join'](_0x1fd88c,_0x5b79fb(0x2d3)),_0x38e5cd=parseAgentYaml(a133_0x12a532[_0x5b79fb(0x220)](_0x44b163,_0x5b79fb(0x223)),_0x44b163),_0x325595=a133_0x12a532[_0x5b79fb(0x2c1)](_0x4f36d9)?a133_0x12a532['readFileSync'](_0x4f36d9,_0x5b79fb(0x223)):'',_0x2fc48a=a133_0x12a532[_0x5b79fb(0x2c1)](_0xee0f3)?a133_0x12a532[_0x5b79fb(0x220)](_0xee0f3,_0x5b79fb(0x223)):_0x38e5cd[_0x5b79fb(0x2ce)];_0x5a5ce6[_0x5b79fb(0x269)]({'name':_0x38e5cd[_0x5b79fb(0x2eb)],'dir':_0x1fd88c,'yaml':_0x38e5cd,'systemPrompt':_0x325595,'starterMessage':_0x2fc48a});}}const _0x5e23cf=getKnowledgeBasesDir(_0xbfdf37);if(a133_0x12a532['existsSync'](_0x5e23cf)){const _0x30eed2=a133_0x12a532['readdirSync'](_0x5e23cf);for(const _0x266009 of _0x30eed2){const _0x2c7953=a133_0x5df1f2[_0x5b79fb(0x26b)](_0x5e23cf,_0x266009);if(_0x266009[_0x5b79fb(0x1fe)](_0x5b79fb(0x2cc))){const _0x201d51=parseKnowledgeBaseYaml(a133_0x12a532[_0x5b79fb(0x220)](_0x2c7953,_0x5b79fb(0x223)),_0x2c7953);_0x31ebb1['push']({'name':_0x201d51[_0x5b79fb(0x2eb)],'path':_0x2c7953,'yaml':_0x201d51});}else{if(_0x266009[_0x5b79fb(0x1fe)](_0x5b79fb(0x233))){const _0x2b7329=a133_0x12a532[_0x5b79fb(0x220)](_0x2c7953,'utf-8'),{name:_0x1bc1d2,text:_0x46c2a4}=parseTextKnowledgeBaseMd(_0x2b7329,_0x266009);_0x22f90b['push']({'name':_0x1bc1d2,'path':_0x2c7953,'text':_0x46c2a4});}}}}const _0x1a9418=getPromptsDir(_0xbfdf37);if(a133_0x12a532[_0x5b79fb(0x2c1)](_0x1a9418)){const _0x27fdc5=a133_0x12a532[_0x5b79fb(0x297)](_0x1a9418)['filter'](_0x1c7c53=>_0x1c7c53[_0x5b79fb(0x1fe)](_0x5b79fb(0x2cc)));for(const _0x416f8f of _0x27fdc5){const _0x378044=a133_0x5df1f2[_0x5b79fb(0x26b)](_0x1a9418,_0x416f8f),_0x7f8b2=parsePromptYaml(a133_0x12a532[_0x5b79fb(0x220)](_0x378044,_0x5b79fb(0x223)),_0x378044);_0x45ceed[_0x5b79fb(0x269)]({'name':_0x7f8b2[_0x5b79fb(0x2eb)],'path':_0x378044,'yaml':_0x7f8b2});}}const _0x223864=getIntegrationsDir(_0xbfdf37);if(a133_0x12a532[_0x5b79fb(0x2c1)](_0x223864)){const _0x301d51=a133_0x12a532[_0x5b79fb(0x297)](_0x223864)[_0x5b79fb(0x2c5)](_0x294cef=>_0x294cef[_0x5b79fb(0x1fe)](_0x5b79fb(0x2cc)));for(const _0x9cad46 of _0x301d51){const _0x4a0969=a133_0x5df1f2['join'](_0x223864,_0x9cad46),_0x437939=parseIntegrationYaml(a133_0x12a532['readFileSync'](_0x4a0969,_0x5b79fb(0x223)),_0x4a0969);SAFE_INTEGRATION_TYPES[_0x5b79fb(0x2fd)](_0x437939['service_type'][_0x5b79fb(0x230)]())?_0x78d811[_0x5b79fb(0x269)]({'name':_0x437939[_0x5b79fb(0x2eb)],'path':_0x4a0969,'yaml':_0x437939}):this['logger'][_0x5b79fb(0x2c3)](_0x5b79fb(0x23c)+_0x437939[_0x5b79fb(0x2eb)]+_0x5b79fb(0x2f1)+_0x437939[_0x5b79fb(0x291)]+'):\x20'+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES[_0x5b79fb(0x26b)](',\x20')+')\x20can\x20be\x20cloned.'));}}const _0x532b58=getExperimentalKnowledgeBasesDir(_0xbfdf37);if(a133_0x12a532[_0x5b79fb(0x2c1)](_0x532b58)){const _0x54c975=a133_0x12a532[_0x5b79fb(0x297)](_0x532b58,{'withFileTypes':!![]});for(const _0x2c96a8 of _0x54c975){if(!_0x2c96a8[_0x5b79fb(0x29b)]())continue;const _0x130f07=a133_0x5df1f2[_0x5b79fb(0x26b)](_0x532b58,_0x2c96a8[_0x5b79fb(0x2eb)]),_0x209c1b=a133_0x5df1f2[_0x5b79fb(0x26b)](_0x130f07,_0x2c96a8[_0x5b79fb(0x2eb)]+'.yml');if(a133_0x12a532[_0x5b79fb(0x2c1)](_0x209c1b)){const _0x50b82c=parseExperimentalKnowledgeBaseYaml(a133_0x12a532['readFileSync'](_0x209c1b,_0x5b79fb(0x223)),_0x209c1b),_0x16b200=a133_0x5df1f2['join'](_0x130f07,_0x5b79fb(0x254)),_0x1a5fa7=[];if(a133_0x12a532[_0x5b79fb(0x2c1)](_0x16b200)){const _0x31cbcb=a133_0x12a532[_0x5b79fb(0x297)](_0x16b200,{'withFileTypes':!![]});for(const _0x407aa0 of _0x31cbcb){if(!_0x407aa0['isDirectory']())continue;const _0x1e92d9=a133_0x5df1f2[_0x5b79fb(0x26b)](_0x16b200,_0x407aa0['name']),_0xabfdb0=a133_0x5df1f2[_0x5b79fb(0x26b)](_0x1e92d9,_0x5b79fb(0x222)),_0x1a8716=a133_0x5df1f2['join'](_0x1e92d9,_0x5b79fb(0x2b4));if(a133_0x12a532[_0x5b79fb(0x2c1)](_0xabfdb0)&&a133_0x12a532['existsSync'](_0x1a8716)){const _0x3555b2=a133_0x12a532[_0x5b79fb(0x220)](_0xabfdb0,_0x5b79fb(0x223)),_0x218226=a133_0x12a532[_0x5b79fb(0x220)](_0x1a8716,_0x5b79fb(0x223));_0x1a5fa7['push']({'name':_0x407aa0[_0x5b79fb(0x2eb)],'code':_0x3555b2,'json_schema':_0x218226});}}}const _0x14a649={..._0x50b82c,'functions':_0x1a5fa7};_0x81e12e[_0x5b79fb(0x269)]({'name':_0x50b82c[_0x5b79fb(0x2eb)],'path':_0x130f07,'def':_0x14a649});}}}const _0x15ed7e=getExperimentalArtifactsDir(_0xbfdf37);if(a133_0x12a532[_0x5b79fb(0x2c1)](_0x15ed7e)){const _0x5bcbfd=a133_0x12a532[_0x5b79fb(0x297)](_0x15ed7e,{'withFileTypes':!![]});for(const _0x22a5c5 of _0x5bcbfd){if(!_0x22a5c5[_0x5b79fb(0x29b)]())continue;const _0x372128=a133_0x5df1f2['join'](_0x15ed7e,_0x22a5c5[_0x5b79fb(0x2eb)]),_0x2eae7a=a133_0x5df1f2[_0x5b79fb(0x26b)](_0x372128,_0x22a5c5['name']+_0x5b79fb(0x2cc));if(a133_0x12a532[_0x5b79fb(0x2c1)](_0x2eae7a)){const _0x2eca44=parseExperimentalArtifactYaml(a133_0x12a532[_0x5b79fb(0x220)](_0x2eae7a,_0x5b79fb(0x223)),_0x2eae7a),_0x5298ac=a133_0x5df1f2[_0x5b79fb(0x26b)](_0x372128,_0x5b79fb(0x222)),_0x11c1ef=a133_0x12a532[_0x5b79fb(0x2c1)](_0x5298ac)?a133_0x12a532[_0x5b79fb(0x220)](_0x5298ac,'utf-8'):'',_0x2e94c0=a133_0x5df1f2[_0x5b79fb(0x26b)](_0x372128,'files'),_0x402ef6=[];if(a133_0x12a532[_0x5b79fb(0x2c1)](_0x2e94c0)){const _0x56e7f5=a133_0x12a532[_0x5b79fb(0x297)](_0x2e94c0);for(const _0x260a9b of _0x56e7f5){const _0x16710c=a133_0x5df1f2[_0x5b79fb(0x26b)](_0x2e94c0,_0x260a9b);if(a133_0x12a532[_0x5b79fb(0x2f2)](_0x16710c)[_0x5b79fb(0x271)]()){const _0x5642f5=a133_0x12a532[_0x5b79fb(0x220)](_0x16710c,'utf-8');_0x402ef6[_0x5b79fb(0x269)]({'file_name':_0x260a9b,'text_content':_0x5642f5});}}}const _0x4efd98={..._0x2eca44,'code':_0x11c1ef,'files':_0x402ef6};_0x245150['push']({'name':_0x2eca44[_0x5b79fb(0x2eb)],'path':_0x372128,'def':_0x4efd98});}}}}else{const _0x4a5b55=await this[_0x5b79fb(0x27a)](_0xbfdf37),_0x58d725=await this[_0x5b79fb(0x23d)][_0x5b79fb(0x209)](_0x4a5b55);_0x1ffbd0=_0x58d725[_0x5b79fb(0x2a5)][_0x5b79fb(0x2eb)];const _0x3c5a4a=await this[_0x5b79fb(0x23d)][_0x5b79fb(0x2c7)](_0x4a5b55),_0xc969ab=await this[_0x5b79fb(0x23d)][_0x5b79fb(0x298)](_0x4a5b55),_0x18f184=await this[_0x5b79fb(0x23d)][_0x5b79fb(0x256)](_0x4a5b55),_0x2baa94=await this[_0x5b79fb(0x23d)][_0x5b79fb(0x2a8)](_0x4a5b55),_0x52fea5=await this[_0x5b79fb(0x23d)][_0x5b79fb(0x2e0)](_0x4a5b55),_0xed4ca2=await safeListOrEmpty(()=>this[_0x5b79fb(0x23d)][_0x5b79fb(0x1f4)](_0x4a5b55)),_0x3716d0=await safeListOrEmpty(()=>this[_0x5b79fb(0x23d)][_0x5b79fb(0x202)](_0x4a5b55)),_0x1e0a0c=new Map(),_0x4a69a4=new Map(),_0x4b18d8=new Map(),_0xbe14c0=new Map(),_0x2cb531=new Map(),_0x2c014b=new Map();for(const _0x2f6145 of _0xc969ab){_0x1e0a0c[_0x5b79fb(0x227)](_0x2f6145['id'],_0x2f6145[_0x5b79fb(0x2a5)]['name']);}for(const _0x50a28f of _0x18f184){_0x4a69a4[_0x5b79fb(0x227)](_0x50a28f['id'],_0x50a28f[_0x5b79fb(0x2a5)][_0x5b79fb(0x2eb)]);}for(const _0x5bdeaf of _0x3c5a4a){_0x4b18d8[_0x5b79fb(0x227)](_0x5bdeaf['id'],_0x5bdeaf[_0x5b79fb(0x2a5)][_0x5b79fb(0x2eb)]);}for(const _0xc2b0d of _0x2baa94){_0xbe14c0[_0x5b79fb(0x227)](_0xc2b0d['id'],_0xc2b0d['attributes'][_0x5b79fb(0x2eb)]);}for(const _0x223ebd of _0xed4ca2){_0x2cb531[_0x5b79fb(0x227)](_0x223ebd['id'],_0x223ebd['attributes'][_0x5b79fb(0x2eb)]);}for(const _0x42c6fd of _0x3716d0){_0x2c014b['set'](_0x42c6fd['id'],_0x42c6fd[_0x5b79fb(0x2a5)]['name']);}const _0x277ed9={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x1e0a0c,'TextKnowledgeBase':_0x4a69a4,'Agent':_0x4b18d8,'ExperimentalKnowledgeBase':_0x2cb531}),'resolvePromptName':async _0x2ef4f3=>_0xbe14c0[_0x5b79fb(0x2b5)](_0x2ef4f3),'onWarning':_0x5cb0b6=>this['logger'][_0x5b79fb(0x2c3)](_0x5cb0b6)};for(const _0x49982b of _0x3c5a4a){const _0x5dea69=await agentResponseToDef(_0x49982b,_0x277ed9),{yaml:_0x520b3c,systemPrompt:_0x2cfbae,starterMessage:_0x5e5dd6}=_0x5dea69;_0x5a5ce6[_0x5b79fb(0x269)]({'name':_0x520b3c['name'],'dir':'','yaml':_0x520b3c,'systemPrompt':_0x2cfbae,'starterMessage':_0x5e5dd6});}for(const _0x4d7f83 of _0xc969ab){const _0x3e1ee8=apiKnowledgeBaseToYaml(_0x4d7f83);_0x31ebb1[_0x5b79fb(0x269)]({'name':_0x3e1ee8[_0x5b79fb(0x2eb)],'path':'','yaml':_0x3e1ee8});}for(const _0x83ecae of _0x18f184){_0x22f90b[_0x5b79fb(0x269)]({'name':_0x83ecae[_0x5b79fb(0x2a5)][_0x5b79fb(0x2eb)],'path':'','text':_0x83ecae[_0x5b79fb(0x2a5)][_0x5b79fb(0x1f2)]});}for(const _0xc57e5f of _0x2baa94){const _0x35cbe7=await apiPromptToYaml(_0xc57e5f,_0x277ed9);_0x35cbe7&&_0x45ceed['push']({'name':_0x35cbe7[_0x5b79fb(0x2eb)],'path':'','yaml':_0x35cbe7});}for(const _0x1d7e0f of _0x52fea5){if(!_0x1d7e0f[_0x5b79fb(0x2a5)][_0x5b79fb(0x2b1)]&&SAFE_INTEGRATION_TYPES[_0x5b79fb(0x2fd)](_0x1d7e0f[_0x5b79fb(0x2a5)][_0x5b79fb(0x2c6)]['toLowerCase']())){const _0xf65030=await apiIntegrationToYaml(_0x1d7e0f,_0x277ed9);_0x78d811['push']({'name':_0x1d7e0f[_0x5b79fb(0x2a5)]['serviceType'][_0x5b79fb(0x230)](),'path':'','yaml':_0xf65030});}}for(const _0x4054a6 of _0xed4ca2){const _0x42e11d=apiExperimentalKnowledgeBaseToYaml(_0x4054a6);_0x81e12e['push']({'name':_0x42e11d[_0x5b79fb(0x2eb)],'path':'','def':_0x42e11d});}for(const _0x2e100a of _0x3716d0){const _0x2e6fd5=apiExperimentalArtifactToYaml(_0x2e100a);_0x245150[_0x5b79fb(0x269)]({'name':_0x2e6fd5['name'],'path':'','def':_0x2e6fd5});}}const _0x1696f0={'sourceProjectName':_0x1ffbd0,'newProjectName':_0x5846a6,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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}}},_0x67a8cf=await this[_0x5b79fb(0x23d)][_0x5b79fb(0x296)](),_0x3e76b0=_0x67a8cf[_0x5b79fb(0x29d)](_0x30fb4e=>_0x30fb4e['attributes'][_0x5b79fb(0x2eb)]===_0x5846a6);if(_0x3e76b0)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x5b79fb(0x24f)+_0x5846a6+_0x5b79fb(0x1fa),undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x54ec7c?.[_0x5b79fb(0x25b)])return _0x1696f0[_0x5b79fb(0x259)]['agents'][_0x5b79fb(0x247)]=_0x5a5ce6[_0x5b79fb(0x22e)],_0x1696f0['counts'][_0x5b79fb(0x278)][_0x5b79fb(0x247)]=_0x31ebb1[_0x5b79fb(0x22e)],_0x1696f0[_0x5b79fb(0x259)][_0x5b79fb(0x2b9)][_0x5b79fb(0x247)]=_0x22f90b['length'],_0x1696f0[_0x5b79fb(0x259)]['experimentalKnowledgeBases']['created']=_0x81e12e[_0x5b79fb(0x22e)],_0x1696f0[_0x5b79fb(0x259)]['experimentalArtifacts'][_0x5b79fb(0x247)]=_0x245150[_0x5b79fb(0x22e)],_0x1696f0[_0x5b79fb(0x259)]['prompts'][_0x5b79fb(0x247)]=_0x45ceed[_0x5b79fb(0x22e)],_0x1696f0[_0x5b79fb(0x259)]['integrations']['created']=_0x78d811[_0x5b79fb(0x22e)],_0x1696f0;const _0x3eb352=await this[_0x5b79fb(0x23d)][_0x5b79fb(0x268)]({'name':_0x5846a6}),_0x2edad1=_0x3eb352['id'];_0x1696f0['newProjectId']=_0x2edad1;const _0x2dce4d=new Map(),_0x45feaa=new Map(),_0x4b38a7=new Map(),_0x54db10=new Map(),_0x566950=new Map(),_0x33f94b=new Map(),_0x7f6782=new Map(),_0x14288c=new Map(),_0x266f66=new Set(),_0x2009d6=new Set();for(const _0x382621 of _0x5a5ce6){for(const _0x1f9258 of _0x382621['yaml'][_0x5b79fb(0x2cd)]||[]){if(_0x1f9258[_0x5b79fb(0x211)]===_0x5b79fb(0x2d5)&&_0x1f9258[_0x5b79fb(0x235)]){const _0x186705=parseRef(_0x1f9258[_0x5b79fb(0x235)]);if(_0x186705)_0x266f66['add'](_0x186705[_0x5b79fb(0x2eb)]);}else{if(_0x1f9258[_0x5b79fb(0x211)]==='web_search'&&_0x1f9258[_0x5b79fb(0x235)]){const _0x322a92=parseRef(_0x1f9258['target']);if(_0x322a92)_0x2009d6[_0x5b79fb(0x22b)](_0x322a92[_0x5b79fb(0x2eb)]);}}}}for(const _0x5d48cc of _0x266f66){try{const _0x3f9cd2=await this[_0x5b79fb(0x23d)][_0x5b79fb(0x28c)]({'projectId':_0x2edad1,'name':_0x5d48cc});_0x566950['set'](_0x5d48cc,_0x3f9cd2['id']),_0x1696f0[_0x5b79fb(0x231)]['push']({'name':_0x5d48cc,'action':'created','id':_0x3f9cd2['id']}),_0x1696f0[_0x5b79fb(0x259)][_0x5b79fb(0x231)][_0x5b79fb(0x247)]++;}catch(_0xb35911){_0x1696f0[_0x5b79fb(0x231)][_0x5b79fb(0x269)]({'name':_0x5d48cc,'action':_0x5b79fb(0x236),'error':_0xb35911['message']}),_0x1696f0[_0x5b79fb(0x259)]['imageGenerators']['errors']++;}}for(const _0x428698 of _0x2009d6){try{const _0x277b0b=await this[_0x5b79fb(0x23d)][_0x5b79fb(0x264)]({'projectId':_0x2edad1,'name':_0x428698});_0x33f94b[_0x5b79fb(0x227)](_0x428698,_0x277b0b['id']),_0x1696f0['webSearchTools'][_0x5b79fb(0x269)]({'name':_0x428698,'action':_0x5b79fb(0x247),'id':_0x277b0b['id']}),_0x1696f0['counts']['webSearchTools'][_0x5b79fb(0x247)]++;}catch(_0x3a7483){_0x1696f0[_0x5b79fb(0x28d)][_0x5b79fb(0x269)]({'name':_0x428698,'action':_0x5b79fb(0x236),'error':_0x3a7483[_0x5b79fb(0x249)]}),_0x1696f0[_0x5b79fb(0x259)][_0x5b79fb(0x28d)]['errors']++;}}const _0x5e1dba=await fetchAllToolTargetMaps((_0x333e5a,_0x551ad2)=>this['client'][_0x5b79fb(0x270)](_0x333e5a,_0x551ad2),_0x2edad1);let _0x571fd1=[];const _0x1177ce={'projectId':_0x2edad1,'resolveToolTargetId':buildIdResolver({..._0x5e1dba[_0x5b79fb(0x2dc)],'KnowledgeBase':_0x2dce4d,'TextKnowledgeBase':_0x45feaa,'ExperimentalKnowledgeBase':_0x7f6782,'Agent':_0x4b38a7,'WebSearchTool':_0x33f94b,'ImageGenerator':_0x566950}),'resolvePromptId':async _0x380aec=>_0x54db10[_0x5b79fb(0x2b5)](_0x380aec),'onWarning':_0x259239=>{const _0x1dd46b=_0x5b79fb;this['logger'][_0x1dd46b(0x2c3)](_0x259239),_0x571fd1['push'](_0x259239);}};for(const _0x4f7322 of _0x31ebb1){try{const _0x433f48=yamlKnowledgeBaseToApi(_0x4f7322[_0x5b79fb(0x27b)],_0x2edad1),_0x526a35=await this[_0x5b79fb(0x23d)][_0x5b79fb(0x24b)](_0x433f48);_0x2dce4d[_0x5b79fb(0x227)](_0x4f7322[_0x5b79fb(0x27b)][_0x5b79fb(0x2eb)],_0x526a35['id']),_0x1696f0[_0x5b79fb(0x278)][_0x5b79fb(0x269)]({'name':_0x4f7322[_0x5b79fb(0x27b)]['name'],'action':_0x5b79fb(0x247),'id':_0x526a35['id']}),_0x1696f0[_0x5b79fb(0x259)][_0x5b79fb(0x278)][_0x5b79fb(0x247)]++;}catch(_0x36a60a){_0x1696f0[_0x5b79fb(0x278)][_0x5b79fb(0x269)]({'name':_0x4f7322[_0x5b79fb(0x27b)][_0x5b79fb(0x2eb)],'action':_0x5b79fb(0x236),'error':_0x36a60a[_0x5b79fb(0x249)]}),_0x1696f0[_0x5b79fb(0x259)][_0x5b79fb(0x278)][_0x5b79fb(0x2a9)]++;}}for(const _0x2a480c of _0x22f90b){try{const _0x4e4dca=yamlTextKnowledgeBaseToApi({'name':_0x2a480c['name'],'text':_0x2a480c[_0x5b79fb(0x1f2)]},_0x2edad1),_0x2b4725=await this['client'][_0x5b79fb(0x289)](_0x4e4dca);_0x45feaa[_0x5b79fb(0x227)](_0x2a480c['name'],_0x2b4725['id']),_0x1696f0[_0x5b79fb(0x2b9)][_0x5b79fb(0x269)]({'name':_0x2a480c[_0x5b79fb(0x2eb)],'action':_0x5b79fb(0x247),'id':_0x2b4725['id']}),_0x1696f0[_0x5b79fb(0x259)]['textKnowledgeBases'][_0x5b79fb(0x247)]++;}catch(_0x23136b){_0x1696f0[_0x5b79fb(0x2b9)][_0x5b79fb(0x269)]({'name':_0x2a480c[_0x5b79fb(0x2eb)],'action':'error','error':_0x23136b['message']}),_0x1696f0['counts'][_0x5b79fb(0x2b9)]['errors']++;}}for(const _0x3187c8 of _0x245150){try{const _0x4d645c=yamlExperimentalArtifactToApi(_0x3187c8[_0x5b79fb(0x2da)],_0x2edad1),_0x9ae475=await this[_0x5b79fb(0x23d)][_0x5b79fb(0x248)](_0x4d645c);_0x14288c[_0x5b79fb(0x227)](_0x3187c8['def'][_0x5b79fb(0x2eb)],_0x9ae475['id']),_0x1696f0[_0x5b79fb(0x2ca)]['push']({'name':_0x3187c8['def'][_0x5b79fb(0x2eb)],'action':_0x5b79fb(0x247),'id':_0x9ae475['id']}),_0x1696f0[_0x5b79fb(0x259)][_0x5b79fb(0x2ca)][_0x5b79fb(0x247)]++;}catch(_0x2dd492){_0x1696f0[_0x5b79fb(0x2ca)][_0x5b79fb(0x269)]({'name':_0x3187c8['def'][_0x5b79fb(0x2eb)],'action':_0x5b79fb(0x236),'error':_0x2dd492['message']}),_0x1696f0[_0x5b79fb(0x259)][_0x5b79fb(0x2ca)]['errors']++;}}for(const _0x31dea8 of _0x81e12e){try{const _0x44bfaf=yamlExperimentalKnowledgeBaseToApi(_0x31dea8[_0x5b79fb(0x2da)],_0x2edad1),_0x53c3c7=await this['client']['createExperimentalKnowledgeBase'](_0x44bfaf);_0x7f6782[_0x5b79fb(0x227)](_0x31dea8['def']['name'],_0x53c3c7['id']),_0x1696f0[_0x5b79fb(0x2e6)][_0x5b79fb(0x269)]({'name':_0x31dea8[_0x5b79fb(0x2da)][_0x5b79fb(0x2eb)],'action':_0x5b79fb(0x247),'id':_0x53c3c7['id']}),_0x1696f0['counts'][_0x5b79fb(0x2e6)][_0x5b79fb(0x247)]++;}catch(_0x1d2f3b){_0x1696f0[_0x5b79fb(0x2e6)][_0x5b79fb(0x269)]({'name':_0x31dea8[_0x5b79fb(0x2da)][_0x5b79fb(0x2eb)],'action':'error','error':_0x1d2f3b[_0x5b79fb(0x249)]}),_0x1696f0[_0x5b79fb(0x259)][_0x5b79fb(0x2e6)][_0x5b79fb(0x2a9)]++;}}const _0x59b3e7=[..._0x5a5ce6][_0x5b79fb(0x294)]((_0x34aa5e,_0x29b09b)=>{const _0x1e8d1b=_0x5b79fb,_0x1744f2=_0x34aa5e['yaml'][_0x1e8d1b(0x2cd)]?.[_0x1e8d1b(0x24c)](_0x457804=>_0x457804[_0x1e8d1b(0x211)]===_0x1e8d1b(0x2ed))??![],_0x451665=_0x29b09b[_0x1e8d1b(0x27b)][_0x1e8d1b(0x2cd)]?.[_0x1e8d1b(0x24c)](_0x2ace8b=>_0x2ace8b[_0x1e8d1b(0x211)]===_0x1e8d1b(0x2ed))??![];if(_0x1744f2&&!_0x451665)return 0x1;if(!_0x1744f2&&_0x451665)return-0x1;return 0x0;});for(const _0x2595c8 of _0x59b3e7){_0x571fd1=[];try{const _0x20a78d=_0x2595c8[_0x5b79fb(0x27b)][_0x5b79fb(0x2cd)]?.[_0x5b79fb(0x2c5)](_0x55cc0e=>{const _0x5b22d1=_0x5b79fb;if(_0x55cc0e[_0x5b22d1(0x211)]==='agent'&&_0x55cc0e[_0x5b22d1(0x235)]){const _0x27af68=parseRef(_0x55cc0e[_0x5b22d1(0x235)]);return _0x27af68?.[_0x5b22d1(0x2eb)]===_0x2595c8[_0x5b22d1(0x27b)][_0x5b22d1(0x2eb)];}return![];})??[];if(_0x20a78d[_0x5b79fb(0x22e)]>0x0){const _0x48b566=_0x5b79fb(0x2fe)+_0x2595c8[_0x5b79fb(0x27b)][_0x5b79fb(0x2eb)]+'\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20'+_0x5b79fb(0x2ac);this['logger']['warn'](_0x48b566),_0x571fd1[_0x5b79fb(0x269)](_0x48b566);}const _0x185f43=await agentDefToRequest(_0x2595c8[_0x5b79fb(0x27b)],_0x2595c8['systemPrompt'],_0x2595c8[_0x5b79fb(0x261)],_0x1177ce),_0x3f60de=await this[_0x5b79fb(0x23d)][_0x5b79fb(0x273)](_0x185f43);_0x4b38a7[_0x5b79fb(0x227)](_0x2595c8[_0x5b79fb(0x27b)][_0x5b79fb(0x2eb)],_0x3f60de['id']),_0x1696f0[_0x5b79fb(0x1fc)][_0x5b79fb(0x269)]({'agentName':_0x2595c8[_0x5b79fb(0x27b)]['name'],'action':'created','agentId':_0x3f60de['id'],'warnings':_0x571fd1[_0x5b79fb(0x22e)]>0x0?_0x571fd1:undefined}),_0x1696f0[_0x5b79fb(0x259)][_0x5b79fb(0x1fc)][_0x5b79fb(0x247)]++;}catch(_0x5efc05){_0x1696f0[_0x5b79fb(0x1fc)][_0x5b79fb(0x269)]({'agentName':_0x2595c8[_0x5b79fb(0x27b)]['name'],'action':_0x5b79fb(0x236),'error':_0x5efc05['message'],'warnings':_0x571fd1['length']>0x0?_0x571fd1:undefined}),_0x1696f0['counts'][_0x5b79fb(0x1fc)]['errors']++;}}for(const _0x533ec8 of _0x45ceed){try{const _0x53da2b=await yamlPromptToApi(_0x533ec8[_0x5b79fb(0x27b)],_0x2edad1,_0x1177ce);if(!_0x53da2b){_0x1696f0['prompts']['push']({'name':_0x533ec8[_0x5b79fb(0x27b)][_0x5b79fb(0x2eb)],'action':'error','error':'Agent\x20reference\x20not\x20found'}),_0x1696f0[_0x5b79fb(0x259)][_0x5b79fb(0x272)][_0x5b79fb(0x2a9)]++;continue;}const _0x5c2f88=await this[_0x5b79fb(0x23d)]['createPrompt'](_0x53da2b);_0x54db10[_0x5b79fb(0x227)](_0x533ec8[_0x5b79fb(0x27b)][_0x5b79fb(0x2eb)],_0x5c2f88['id']),_0x1696f0['prompts'][_0x5b79fb(0x269)]({'name':_0x533ec8[_0x5b79fb(0x27b)]['name'],'action':'created','id':_0x5c2f88['id']}),_0x1696f0[_0x5b79fb(0x259)][_0x5b79fb(0x272)][_0x5b79fb(0x247)]++;}catch(_0x322ead){_0x1696f0['prompts'][_0x5b79fb(0x269)]({'name':_0x533ec8[_0x5b79fb(0x27b)][_0x5b79fb(0x2eb)],'action':_0x5b79fb(0x236),'error':_0x322ead[_0x5b79fb(0x249)]}),_0x1696f0[_0x5b79fb(0x259)][_0x5b79fb(0x272)][_0x5b79fb(0x2a9)]++;}}for(const _0x31022d of _0x78d811){try{const _0x169b48=await yamlIntegrationToApi(_0x31022d[_0x5b79fb(0x27b)],_0x2edad1,_0x1177ce),_0x5c44e9=await this[_0x5b79fb(0x23d)][_0x5b79fb(0x263)](_0x169b48);_0x1696f0['integrations'][_0x5b79fb(0x269)]({'name':_0x31022d[_0x5b79fb(0x27b)][_0x5b79fb(0x291)],'action':_0x5b79fb(0x247),'id':_0x5c44e9['id']}),_0x1696f0[_0x5b79fb(0x259)][_0x5b79fb(0x26d)]['created']++;}catch(_0x4c12d9){_0x1696f0[_0x5b79fb(0x26d)][_0x5b79fb(0x269)]({'name':_0x31022d[_0x5b79fb(0x27b)]['service_type'],'action':_0x5b79fb(0x236),'error':_0x4c12d9[_0x5b79fb(0x249)]}),_0x1696f0[_0x5b79fb(0x259)]['integrations'][_0x5b79fb(0x2a9)]++;}}return _0x1696f0;}}
@@ -1 +1 @@
1
- function a134_0x111e(){const _0x1dcb58=['126kEDeMB','tools','3416110Pohgyq','map','937656uTLndr','43869zuajMW','attributes','37738ERnCRv','194844aBMYkI','1193110AJpkFi','2uMZFRB','targetAgentId','1.0','16njlMcV','get','targetKnowledgeBaseId','258255MWsQCE'];a134_0x111e=function(){return _0x1dcb58;};return a134_0x111e();}(function(_0x3578f2,_0x3a000b){const _0x3beddc=a134_0x1bbc,_0xd32201=_0x3578f2();while(!![]){try{const _0x3d07e0=-parseInt(_0x3beddc(0x6e))/0x1*(-parseInt(_0x3beddc(0x6b))/0x2)+parseInt(_0x3beddc(0x74))/0x3+parseInt(_0x3beddc(0x6c))/0x4+parseInt(_0x3beddc(0x6d))/0x5+-parseInt(_0x3beddc(0x75))/0x6*(parseInt(_0x3beddc(0x7a))/0x7)+-parseInt(_0x3beddc(0x71))/0x8*(-parseInt(_0x3beddc(0x79))/0x9)+-parseInt(_0x3beddc(0x77))/0xa;if(_0x3d07e0===_0x3a000b)break;else _0xd32201['push'](_0xd32201['shift']());}catch(_0x2bf492){_0xd32201['push'](_0xd32201['shift']());}}}(a134_0x111e,0x23b82));export function canCreateAgent(_0x28f6ca,_0xb8de89){const _0x5f26be=a134_0x1bbc;for(const _0x414788 of _0x28f6ca[_0x5f26be(0x7b)][_0x5f26be(0x76)]){if(_0x414788['targetAgentId']&&!_0xb8de89['has'](_0x414788[_0x5f26be(0x6f)]))return![];}return!![];}export function remapToolIds(_0x54853b,_0x12a072,_0x4f74de){const _0x5942c2=a134_0x1bbc;return _0x54853b[_0x5942c2(0x78)](_0x423a83=>({..._0x423a83,'targetKnowledgeBaseId':_0x423a83[_0x5942c2(0x73)]?_0x12a072[_0x5942c2(0x72)](_0x423a83[_0x5942c2(0x73)])||_0x423a83[_0x5942c2(0x73)]:undefined,'targetAgentId':_0x423a83[_0x5942c2(0x6f)]?_0x4f74de[_0x5942c2(0x72)](_0x423a83[_0x5942c2(0x6f)])||_0x423a83['targetAgentId']:undefined}));}function a134_0x1bbc(_0x29772d,_0x4fe96a){_0x29772d=_0x29772d-0x6b;const _0x111e9b=a134_0x111e();let _0x1bbc5e=_0x111e9b[_0x29772d];return _0x1bbc5e;}export function remapVariableIds(_0x5d3d28,_0x5af3bc){const _0x472669=a134_0x1bbc;return _0x5d3d28['map'](_0x53fd7a=>({..._0x53fd7a,'targetKnowledgeBaseId':_0x5af3bc[_0x472669(0x72)](_0x53fd7a[_0x472669(0x73)])||_0x53fd7a[_0x472669(0x73)]}));}export function isSupportedBackupVersion(_0x425aed){const _0x1d5c4a=a134_0x1bbc;return _0x425aed===_0x1d5c4a(0x70);}
1
+ (function(_0xc4b493,_0x3d72f7){const _0x50e65c=a134_0x501e,_0x18694b=_0xc4b493();while(!![]){try{const _0xc84596=-parseInt(_0x50e65c(0x16b))/0x1*(parseInt(_0x50e65c(0x173))/0x2)+parseInt(_0x50e65c(0x16c))/0x3+parseInt(_0x50e65c(0x177))/0x4+parseInt(_0x50e65c(0x170))/0x5+parseInt(_0x50e65c(0x16f))/0x6*(-parseInt(_0x50e65c(0x169))/0x7)+-parseInt(_0x50e65c(0x16d))/0x8+-parseInt(_0x50e65c(0x178))/0x9*(-parseInt(_0x50e65c(0x171))/0xa);if(_0xc84596===_0x3d72f7)break;else _0x18694b['push'](_0x18694b['shift']());}catch(_0x57bdb2){_0x18694b['push'](_0x18694b['shift']());}}}(a134_0x4c55,0x62920));function a134_0x4c55(){const _0x8cbbb4=['tools','targetKnowledgeBaseId','2653628bhHjkY','54rJYAGn','7FstKRw','map','8WTfdBc','1761918UFnDUm','6436960PuoISd','1.0','3714066eUkXmK','2901220hdVqWi','926990OHkXez','get','139944EYpgID','targetAgentId'];a134_0x4c55=function(){return _0x8cbbb4;};return a134_0x4c55();}export function canCreateAgent(_0x280537,_0x2d51fc){const _0x130e16=a134_0x501e;for(const _0x384db0 of _0x280537['attributes'][_0x130e16(0x175)]){if(_0x384db0['targetAgentId']&&!_0x2d51fc['has'](_0x384db0[_0x130e16(0x174)]))return![];}return!![];}export function remapToolIds(_0x768050,_0x3f298b,_0x501946){const _0x21b96c=a134_0x501e;return _0x768050[_0x21b96c(0x16a)](_0x20f4ef=>({..._0x20f4ef,'targetKnowledgeBaseId':_0x20f4ef['targetKnowledgeBaseId']?_0x3f298b[_0x21b96c(0x172)](_0x20f4ef[_0x21b96c(0x176)])||_0x20f4ef[_0x21b96c(0x176)]:undefined,'targetAgentId':_0x20f4ef['targetAgentId']?_0x501946[_0x21b96c(0x172)](_0x20f4ef['targetAgentId'])||_0x20f4ef[_0x21b96c(0x174)]:undefined}));}export function remapVariableIds(_0x19a33c,_0x5d9d0f){const _0x2ff1b3=a134_0x501e;return _0x19a33c[_0x2ff1b3(0x16a)](_0x11ce09=>({..._0x11ce09,'targetKnowledgeBaseId':_0x5d9d0f[_0x2ff1b3(0x172)](_0x11ce09[_0x2ff1b3(0x176)])||_0x11ce09[_0x2ff1b3(0x176)]}));}function a134_0x501e(_0x40b901,_0x87580b){_0x40b901=_0x40b901-0x169;const _0x4c558c=a134_0x4c55();let _0x501eeb=_0x4c558c[_0x40b901];return _0x501eeb;}export function isSupportedBackupVersion(_0x464710){const _0x3f0df6=a134_0x501e;return _0x464710===_0x3f0df6(0x16e);}