@treasuredata/tdx 2026.3.36 → 2026.3.37

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 (219) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/auth-login-command.js +1 -1
  11. package/dist/commands/cas-command.js +1 -1
  12. package/dist/commands/cas-segment-command.js +1 -1
  13. package/dist/commands/chat-command.js +1 -1
  14. package/dist/commands/claude-command.js +1 -1
  15. package/dist/commands/claude-statusline-command.js +1 -1
  16. package/dist/commands/claude-usage-command.js +1 -1
  17. package/dist/commands/command.js +1 -1
  18. package/dist/commands/connection-command.js +1 -1
  19. package/dist/commands/databases.js +1 -1
  20. package/dist/commands/delivery-command.js +1 -1
  21. package/dist/commands/describe.js +1 -1
  22. package/dist/commands/engage-campaign-pull-command.js +1 -1
  23. package/dist/commands/engage-campaign-push-command.js +1 -1
  24. package/dist/commands/engage-campaign-validate-command.js +1 -1
  25. package/dist/commands/engage-command.js +1 -1
  26. package/dist/commands/engage-template-pull-command.js +1 -1
  27. package/dist/commands/engage-template-push-command.js +1 -1
  28. package/dist/commands/engage-template-validate-command.js +1 -1
  29. package/dist/commands/job-command.js +1 -1
  30. package/dist/commands/journey-command.js +1 -1
  31. package/dist/commands/journey-validate-command.js +1 -1
  32. package/dist/commands/llm-command.js +1 -1
  33. package/dist/commands/mcp-command.js +1 -1
  34. package/dist/commands/parent-segment-command.js +1 -1
  35. package/dist/commands/policy-command.js +1 -1
  36. package/dist/commands/profile-command.js +1 -1
  37. package/dist/commands/profiles-command.js +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/schedule-command.js +1 -1
  40. package/dist/commands/segment-command.js +1 -1
  41. package/dist/commands/segment-create-command.js +1 -1
  42. package/dist/commands/segment-fields-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-push-command.js +1 -1
  45. package/dist/commands/segment-update-command.js +1 -1
  46. package/dist/commands/segment-use-command.js +1 -1
  47. package/dist/commands/segment-validate-command.js +1 -1
  48. package/dist/commands/segments.js +1 -1
  49. package/dist/commands/show.js +1 -1
  50. package/dist/commands/status-command.js +1 -1
  51. package/dist/commands/tables.js +1 -1
  52. package/dist/commands/unset-command.js +1 -1
  53. package/dist/commands/upgrade-command.js +1 -1
  54. package/dist/commands/use-command.js +1 -1
  55. package/dist/commands/user-command.js +1 -1
  56. package/dist/commands/work-command.js +1 -1
  57. package/dist/commands/workflow-command.js +1 -1
  58. package/dist/core/auth.js +1 -1
  59. package/dist/core/command-output.js +1 -1
  60. package/dist/core/config.js +1 -1
  61. package/dist/core/connection-cache.js +1 -1
  62. package/dist/core/constants.js +1 -1
  63. package/dist/core/credential-cache.js +1 -1
  64. package/dist/core/global-context.js +1 -1
  65. package/dist/core/keychain.js +1 -1
  66. package/dist/core/oauth-keychain.js +1 -1
  67. package/dist/core/oauth.js +1 -1
  68. package/dist/core/profile.js +1 -1
  69. package/dist/core/project-config.js +1 -1
  70. package/dist/core/session.js +1 -1
  71. package/dist/core/user-cache.js +1 -1
  72. package/dist/core/version.js +1 -1
  73. package/dist/index.js +1 -1
  74. package/dist/mcp/server.js +1 -1
  75. package/dist/mcp/tools/index.js +1 -1
  76. package/dist/mcp/tools/tdx-run.js +1 -1
  77. package/dist/mcp/tools/tdx-search.js +1 -1
  78. package/dist/mcp/utils.js +1 -1
  79. package/dist/proxy/claude-usage-tracker.js +1 -1
  80. package/dist/proxy/passthrough-server.js +1 -1
  81. package/dist/proxy/sse-usage-parser.js +1 -1
  82. package/dist/sdk/agent/agent-config.js +1 -1
  83. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  84. package/dist/sdk/agent/agent-yaml.js +1 -1
  85. package/dist/sdk/agent/test/evaluator.js +1 -1
  86. package/dist/sdk/agent/test/executor.js +1 -1
  87. package/dist/sdk/agent/test/index.js +1 -1
  88. package/dist/sdk/agent/test/output.js +1 -1
  89. package/dist/sdk/agent/test/parser.js +1 -1
  90. package/dist/sdk/agent/tool-target-registry.js +1 -1
  91. package/dist/sdk/api.js +1 -1
  92. package/dist/sdk/cas/cas-api-client.js +1 -1
  93. package/dist/sdk/cas/cas-audience-yaml.js +1 -1
  94. package/dist/sdk/cas/cas-segment-yaml.js +1 -1
  95. package/dist/sdk/cas/index.js +1 -1
  96. package/dist/sdk/cas/pull-workflow.js +1 -1
  97. package/dist/sdk/cas/push-workflow.js +1 -1
  98. package/dist/sdk/client/cdp-api-client.js +1 -1
  99. package/dist/sdk/client/delivery-api-client.js +1 -1
  100. package/dist/sdk/client/endpoints.js +1 -1
  101. package/dist/sdk/client/engage-api-client.js +1 -1
  102. package/dist/sdk/client/http-client.js +1 -1
  103. package/dist/sdk/client/llm-api-client.js +1 -1
  104. package/dist/sdk/client/oauth-refresh.js +1 -1
  105. package/dist/sdk/client/rate-limiter.js +1 -1
  106. package/dist/sdk/client/td-api-client.js +1 -1
  107. package/dist/sdk/client/trino-api-client.js +1 -1
  108. package/dist/sdk/client/workflow-client.js +1 -1
  109. package/dist/sdk/connection-validator.js +1 -1
  110. package/dist/sdk/connection.js +1 -1
  111. package/dist/sdk/delivery.js +1 -1
  112. package/dist/sdk/engage/campaign-pull.js +1 -1
  113. package/dist/sdk/engage/campaign-push.js +1 -1
  114. package/dist/sdk/engage/campaign-validator.js +1 -1
  115. package/dist/sdk/engage/campaign-yaml.js +1 -1
  116. package/dist/sdk/engage/template-pull.js +1 -1
  117. package/dist/sdk/engage/template-push.js +1 -1
  118. package/dist/sdk/engage/template-validator.js +1 -1
  119. package/dist/sdk/engage/template-yaml.js +1 -1
  120. package/dist/sdk/engage/types/campaign-def.js +1 -1
  121. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  122. package/dist/sdk/engage/types/template-schema.js +1 -1
  123. package/dist/sdk/engage.js +1 -1
  124. package/dist/sdk/errors.js +1 -1
  125. package/dist/sdk/index.js +1 -1
  126. package/dist/sdk/io/index.js +1 -1
  127. package/dist/sdk/io/node-filesystem.js +1 -1
  128. package/dist/sdk/job.js +1 -1
  129. package/dist/sdk/journey.js +1 -1
  130. package/dist/sdk/llm/chat-cache.js +1 -1
  131. package/dist/sdk/llm/index.js +1 -1
  132. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  133. package/dist/sdk/llm/model-factors.js +1 -1
  134. package/dist/sdk/personalization.js +1 -1
  135. package/dist/sdk/policy.js +1 -1
  136. package/dist/sdk/query/index.js +1 -1
  137. package/dist/sdk/query/sql-parser.js +1 -1
  138. package/dist/sdk/realtime.js +1 -1
  139. package/dist/sdk/schedule.js +1 -1
  140. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  141. package/dist/sdk/segment/fields-display.js +1 -1
  142. package/dist/sdk/segment/file-discovery.js +1 -1
  143. package/dist/sdk/segment/journey-utils.js +1 -1
  144. package/dist/sdk/segment/journey-validator.js +1 -1
  145. package/dist/sdk/segment/journey-yaml.js +1 -1
  146. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  147. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  148. package/dist/sdk/segment/pull-workflow.js +1 -1
  149. package/dist/sdk/segment/push-recovery.js +1 -1
  150. package/dist/sdk/segment/push-workflow.js +1 -1
  151. package/dist/sdk/segment/resolution-context.js +1 -1
  152. package/dist/sdk/segment/segment-path-parser.js +1 -1
  153. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  154. package/dist/sdk/segment/segment-validator.js +1 -1
  155. package/dist/sdk/segment/target-resolution.js +1 -1
  156. package/dist/sdk/segment/tdx-config.js +1 -1
  157. package/dist/sdk/segment/types/activation-schema.js +1 -1
  158. package/dist/sdk/segment/types/journey-def.js +1 -1
  159. package/dist/sdk/segment/types/journey-schema.js +1 -1
  160. package/dist/sdk/segment/types/segment-def.js +1 -1
  161. package/dist/sdk/segment/types/segment-schema.js +1 -1
  162. package/dist/sdk/segment/validate-files.js +1 -1
  163. package/dist/sdk/segment/yaml-validator.js +1 -1
  164. package/dist/sdk/segment.js +1 -1
  165. package/dist/sdk/types/index.js +1 -1
  166. package/dist/sdk/types/progress.js +1 -1
  167. package/dist/sdk/types/workspace.js +1 -1
  168. package/dist/sdk/user.js +1 -1
  169. package/dist/sdk/util/format-detector.js +1 -1
  170. package/dist/sdk/util/formatters.js +1 -1
  171. package/dist/sdk/util/index.js +1 -1
  172. package/dist/sdk/util/paginate.js +1 -1
  173. package/dist/sdk/util/tree-formatter.js +1 -1
  174. package/dist/sdk/workflow/archive-validation.js +1 -1
  175. package/dist/sdk/workflow/clone-workflow.js +1 -1
  176. package/dist/sdk/workflow/index.js +1 -1
  177. package/dist/sdk/workflow/pull-workflow.js +1 -1
  178. package/dist/sdk/workflow/push-workflow.js +1 -1
  179. package/dist/sdk/workflow/tdx-config.js +1 -1
  180. package/dist/sdk/workflow/workflow-utils.js +1 -1
  181. package/dist/sdk/workspace/frontmatter.js +1 -1
  182. package/dist/sdk/workspace/git.js +1 -1
  183. package/dist/sdk/workspace/index.js +1 -1
  184. package/dist/sdk/workspace/templates.js +1 -1
  185. package/dist/sdk/workspace/weekly.js +1 -1
  186. package/dist/sdk/workspace/wikilinks.js +1 -1
  187. package/dist/test-utils/command-runner.js +1 -1
  188. package/dist/test-utils/factories.js +1 -1
  189. package/dist/test-utils/fixtures.js +1 -1
  190. package/dist/test-utils/http-mock.js +1 -1
  191. package/dist/test-utils/index.js +1 -1
  192. package/dist/utils/async.js +1 -1
  193. package/dist/utils/colors.js +1 -1
  194. package/dist/utils/diff.js +1 -1
  195. package/dist/utils/file-permissions.js +1 -1
  196. package/dist/utils/file-reader.js +1 -1
  197. package/dist/utils/github-releases.js +1 -1
  198. package/dist/utils/global-cache.js +1 -1
  199. package/dist/utils/json-loader.js +1 -1
  200. package/dist/utils/local-cache.js +1 -1
  201. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  202. package/dist/utils/logger/formatters/index.js +1 -1
  203. package/dist/utils/logger/handlers/console-handler.js +1 -1
  204. package/dist/utils/logger/handlers/file-handler.js +1 -1
  205. package/dist/utils/logger/handlers/index.js +1 -1
  206. package/dist/utils/logger/handlers/null-handler.js +1 -1
  207. package/dist/utils/logger/index.js +1 -1
  208. package/dist/utils/logger/logger.js +1 -1
  209. package/dist/utils/logger/types.js +1 -1
  210. package/dist/utils/option-validation.js +1 -1
  211. package/dist/utils/process.js +1 -1
  212. package/dist/utils/prompt.js +1 -1
  213. package/dist/utils/spinner.js +1 -1
  214. package/dist/utils/sse-parser.js +1 -1
  215. package/dist/utils/string-utils.js +1 -1
  216. package/dist/utils/table-ref-parser.js +1 -1
  217. package/dist/utils/tdx-logger.js +1 -1
  218. package/dist/utils/version-check.js +1 -1
  219. package/package.json +1 -1
@@ -1 +1 @@
1
- const a133_0x552b25=a133_0x4944;(function(_0x45c954,_0x434cfb){const _0x36dee0=a133_0x4944,_0x3b473f=_0x45c954();while(!![]){try{const _0x2a377a=-parseInt(_0x36dee0(0x1ef))/0x1+parseInt(_0x36dee0(0x1ab))/0x2+parseInt(_0x36dee0(0x16a))/0x3*(-parseInt(_0x36dee0(0x24e))/0x4)+-parseInt(_0x36dee0(0x221))/0x5*(-parseInt(_0x36dee0(0x234))/0x6)+-parseInt(_0x36dee0(0x184))/0x7*(parseInt(_0x36dee0(0x1d6))/0x8)+parseInt(_0x36dee0(0x15c))/0x9+parseInt(_0x36dee0(0x197))/0xa;if(_0x2a377a===_0x434cfb)break;else _0x3b473f['push'](_0x3b473f['shift']());}catch(_0x2c27c0){_0x3b473f['push'](_0x3b473f['shift']());}}}(a133_0x4703,0xe8c08));import{LLMApiClient}from'../client/llm-api-client.js';function a133_0x4703(){const _0x59acb8=['getOrCreateDefaultAgent','file_name','idToName','\x20attempts\x20due\x20to\x20name\x20conflicts.','setDefaultAgent','pullAgent','slackMessageMode','Available\x20agents:\x20','context','client','getOrCreateDefaultProject','updated','find','INVALID_ARGUMENT','status','size','reasoningEffort','Output\x20directory\x20already\x20exists:\x20','Project\x20\x22','exportedFrom','toLowerCase','imageGenerators','INTERNAL','target','listExperimentalArtifacts','1.0','createExperimentalKnowledgeBase','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','attributes','deleteProject','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','deleteIntegration','duplicate','sort','12457503syERfA','Renamed\x20prompt\x20file:\x20','Removed\x20deleted\x20file:\x20','action','#\x20prompt.md\x0a','knowledgebases.json','isFile','getDefaultAgent','prompts','updateKnowledgeBase','some','unlinkSync',')\x20can\x20be\x20pushed.\x20','.yml','1890PdumWz','backupProject','basename','counts','text','resolveProjectId','signal','starterMessage','has','Project\x20not\x20found:\x20','text_content','createAgentResponse','functions','chat_generic','getUserSettings','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','createIntegration','chatIgnoreManagedActions','\x0a---\x20schema:\x20','none','chatWelcomeMessage','listExperimentalKnowledgeBases','textKnowledgeBases','getChatLog','tdx_default_','high','12061LKyyoQ','availableModels','logger','LLM_PROJECT_NOT_FOUND','dry-run-','updateExperimentalKnowledgeBase','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','dir','dirname','errors','clearDefaultAgent','knowledgeBases','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','Removed\x20deleted\x20directory:\x20','site','models','currentProjectId','agents','tdx.json','13928310ShJdAR','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','created','restoreProject','.md','getChatInfo','Unsupported\x20backup\x20version:\x20','updatePrompt','experimentalKnowledgeBases','warn','\x20---\x0a','isDir','code.js','info','llm_project','total','\x20→\x20','newProjectId','outputs','get','3009990WuVBfe','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','oldPath','integrations','.llm','writeFileSync','listProjects','agent.yml','chat','path','history','NOT_FOUND','deleteAgent','updateExperimentalArtifact','continueChat','Renamed\x20experimental\x20KB\x20directory:\x20','listPrompts','---\x20file:\x20','variables','AGENT_NOT_FOUND','listTextKnowledgeBases','description','profile','nameToId','json_schema','getAgent','resolveAgentId','experimentalArtifacts','displayName','add','\x0a\x0a#\x20agent.yml\x0a','No\x20tdx.json\x20found\x20in\x20','push','projectId','Renamed\x20folder:\x20','temperature','listIntegrations','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','tables','renamed','join','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','Agent\x20reference\x20not\x20found','4328kensbp','agent','updateAgent','stringify','tdx_','Backup\x20folder\x20not\x20found:\x20','content','projects','jsonSchemaHint','knowledge_bases','yaml','prompts.json','createPrompt','error','filter','systemPrompt','serviceType','integrations.json','listWebSearchTools','low','agents.json','type','files','chatId','listAgentsFull','1628579TcLVEG','TextKnowledgeBase','rmSync','includes','def','isDirectory','isManaged','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','Renamed\x20experimental\x20artifact\x20directory:\x20','updateTextKnowledgeBase','endsWith','statSync',')\x20can\x20be\x20cloned.','listToolTargets','resolveProjectName','maxToolIterations','promptId','localeCompare','utf-8','sdk.llm','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','Renamed\x20text\x20KB\x20file:\x20','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','set','(dry-run)','code','cwd','listKnowledgeBases','\x27\x20(','readFileSync','loadJsonFile','\x27.\x20This\x20should\x20not\x20happen.','experimental_knowledge_bases','createTextKnowledgeBase','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','json_schema.json','Multiple\x20projects\x20found\x20with\x20name\x20\x27','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','webhookCorsOrigins','agentsFull','createKnowledgeBase','):\x20','service_type','name','readdirSync','chats','getCurrentProject','conflict','createProject','1568955YSvtCv','actions','getProject','chat_agent_console','tools','getBackupMetadata','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.','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','metadata','claude-4.5-sonnet','unchanged','UNAUTHENTICATED','new','parse','getChatHistory','starter_message.md','pushAgent','starter_message','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','6dUDgKp','length','ExperimentalKnowledgeBase','image_gen','\x0a---\x20code\x20---\x0a','chatInfo','mkdirSync','createAgent','Only\x20safe\x20types\x20(','getDefaultProjectName','template','startChat','pullProject','agentId','keys','webSearchTools','dryRun','Skipping\x20integration\x20\x27','Renamed\x20KB\x20file:\x20','Agent\x20not\x20found:\x20','ALREADY_EXISTS','map','\x22\x20already\x20exists','message','updateAgentResponse','\x0a---\x20function:\x20','6868IHOCaM','listAgents','prompt.md','existsSync','PERMISSION_DENIED'];a133_0x4703=function(){return _0x59acb8;};return a133_0x4703();}import*as a133_0x4e6e65 from'node:fs';import*as a133_0x3ebff7 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';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a133_0x552b25(0x177),a133_0x552b25(0x224),'chat_parent_segment'];function a133_0x4944(_0x2effb9,_0x3a1c98){_0x2effb9=_0x2effb9-0x149;const _0x47036e=a133_0x4703();let _0x494479=_0x47036e[_0x2effb9];return _0x494479;}async function safeListOrEmpty(_0x37231d){const _0x34cc96=a133_0x552b25;try{return await _0x37231d();}catch(_0x3c47cc){if(_0x3c47cc instanceof HTTPClientError&&_0x3c47cc[_0x34cc96(0x261)]===0x194)return[];throw _0x3c47cc;}}export class LLMSDK{[a133_0x552b25(0x194)];[a133_0x552b25(0x25c)];['context'];[a133_0x552b25(0x186)]=Logger['of'](a133_0x552b25(0x203));constructor(_0x17603a){const _0x123111=a133_0x552b25;this[_0x123111(0x25c)]=new LLMApiClient(_0x17603a),this[_0x123111(0x25b)]=_0x17603a;}[a133_0x552b25(0x23d)](){const _0x4f9ab5=a133_0x552b25,_0x4413f9=getSanitizedUsername();return _0x4f9ab5(0x182)+_0x4413f9;}async['setCurrentProject'](_0x19d083){const _0x50f47f=a133_0x552b25,{projectId:_0x45a551}=await this[_0x50f47f(0x1fe)](_0x19d083);this[_0x50f47f(0x194)]=_0x45a551;}[a133_0x552b25(0x21e)](){return this['currentProjectId'];}async[a133_0x552b25(0x257)](_0x52cc4b){const _0xdf1181=a133_0x552b25,_0x3fb56e=this[_0xdf1181(0x25b)][_0xdf1181(0x1c1)];let _0x59025b,_0x414f1f;if(_0x52cc4b[_0xdf1181(0x1f2)]('/')){const _0x34054b=_0x52cc4b['split']('/');if(_0x34054b[_0xdf1181(0x235)]!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Invalid\x20agent\x20reference\x20format:\x20'+_0x52cc4b,undefined,{'helpText':_0xdf1181(0x212)});const [_0x10c2f1,_0x3b4706]=_0x34054b;_0x59025b=await this['resolveProjectId'](_0x10c2f1),_0x414f1f=_0x3b4706;}else _0x59025b=this[_0xdf1181(0x194)]||(await this[_0xdf1181(0x25d)]())['id'],_0x414f1f=_0x52cc4b;const _0x392252=await this[_0xdf1181(0x1c5)](_0x414f1f,_0x59025b),_0x151a21=await this[_0xdf1181(0x25c)][_0xdf1181(0x1c4)](_0x392252);writeCachedLLMAgent(_0x151a21[_0xdf1181(0x156)]['name'],_0x392252,_0x59025b,_0x3fb56e);}[a133_0x552b25(0x163)](){const _0x807818=this['context']['profile'];return readCachedLLMAgent(_0x807818)||undefined;}[a133_0x552b25(0x18e)](){const _0xa574d7=a133_0x552b25,_0x3eecd5=this[_0xa574d7(0x25b)][_0xa574d7(0x1c1)];clearCachedLLMAgent(_0x3eecd5);}async[a133_0x552b25(0x193)](){const _0xbb5d88=a133_0x552b25,_0x1ad525=await this[_0xbb5d88(0x25c)][_0xbb5d88(0x178)](),_0x148f58=[];for(const _0x49ec62 of _0x1ad525['availableModelNames']){const _0x3659dc=_0x1ad525[_0xbb5d88(0x185)][_0x49ec62];_0x3659dc&&_0x148f58[_0xbb5d88(0x1cb)]({'name':_0x49ec62,'displayName':_0x3659dc[_0xbb5d88(0x1c7)]});}return _0x148f58;}async[a133_0x552b25(0x220)](_0x4ddaa5){const _0x43941d=a133_0x552b25;return await this[_0x43941d(0x25c)][_0x43941d(0x220)](_0x4ddaa5);}async[a133_0x552b25(0x157)](_0x26f42c){const _0x5b2594=a133_0x552b25,{projectId:_0x53f66e}=await this['resolveProjectName'](_0x26f42c);await this['client'][_0x5b2594(0x157)](_0x53f66e);}async[a133_0x552b25(0x1dd)](_0x404b5=0x32){const _0x3ec80c=a133_0x552b25;return await this[_0x3ec80c(0x25c)][_0x3ec80c(0x1b1)](_0x404b5);}async[a133_0x552b25(0x25d)](_0x23f20a){const _0x51ead8=a133_0x552b25,_0x3c4d23=_0x23f20a||this[_0x51ead8(0x23d)](),_0x3fd037=this['context'][_0x51ead8(0x1c1)];if(!_0x23f20a){const _0x5279e0=readCachedLLMProject(_0x3fd037);if(_0x5279e0&&_0x5279e0['name']===_0x3c4d23)try{const _0x4cdf38=await this[_0x51ead8(0x25c)][_0x51ead8(0x223)](_0x5279e0['id']);if(_0x4cdf38[_0x51ead8(0x156)][_0x51ead8(0x21b)]===_0x3c4d23)return _0x4cdf38;}catch{}}const _0x1a7727=await this[_0x51ead8(0x25c)][_0x51ead8(0x1b1)](),_0x3f9167=_0x1a7727['find'](_0x480a7d=>_0x480a7d['attributes'][_0x51ead8(0x21b)]===_0x3c4d23);if(_0x3f9167)return!_0x23f20a&&writeCachedLLMProject(_0x3c4d23,_0x3f9167['id'],_0x3fd037),_0x3f9167;const _0x38b11c=await this[_0x51ead8(0x25c)]['createProject']({'name':_0x3c4d23,'description':'Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20'+getSanitizedUsername()+')'});return!_0x23f20a&&writeCachedLLMProject(_0x3c4d23,_0x38b11c['id'],_0x3fd037),_0x38b11c;}async[a133_0x552b25(0x16f)](_0x586a74){const _0x2d032d=a133_0x552b25,_0x3005c5=await this['client'][_0x2d032d(0x1b1)](),_0x28b6f3=_0x3005c5[_0x2d032d(0x1e4)](_0x23e27d=>_0x23e27d[_0x2d032d(0x156)][_0x2d032d(0x21b)]===_0x586a74);if(_0x28b6f3[_0x2d032d(0x235)]===0x0)throw new SDKError(ErrorCode[_0x2d032d(0x187)],_0x2d032d(0x173)+_0x586a74,undefined,{'helpText':_0x2d032d(0x1f6)});if(_0x28b6f3[_0x2d032d(0x235)]>0x1)throw new SDKError(ErrorCode[_0x2d032d(0x150)],_0x2d032d(0x214)+_0x586a74+_0x2d032d(0x20f));return _0x28b6f3[0x0]['id'];}async[a133_0x552b25(0x1fe)](_0x559abb){const _0x2a955b=a133_0x552b25,_0x37c3e5=await this[_0x2a955b(0x25c)][_0x2a955b(0x1b1)](),_0x5bd97e=_0x37c3e5['find'](_0x3ad283=>_0x3ad283[_0x2a955b(0x156)]['name']===_0x559abb);if(_0x5bd97e)return{'projectId':_0x5bd97e['id'],'project':_0x5bd97e};throw new SDKError(ErrorCode[_0x2a955b(0x187)],_0x2a955b(0x173)+_0x559abb,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async[a133_0x552b25(0x253)](_0x2f2404=a133_0x552b25(0x22a),_0x4aca5f=0x0,_0x5cc5c3){const _0x16ac48=a133_0x552b25,_0x5b7b8d=0xa;let _0x169820=0x0,_0x3d8505;while(_0x169820<_0x5b7b8d){try{const _0x5ef83e=await this['getOrCreateDefaultProject'](_0x3d8505),_0xe4d31c=_0x5ef83e['id'],_0x1b109b=[_0x16ac48(0x17d),'minimal',_0x16ac48(0x1e9),'medium',_0x16ac48(0x183)],_0x3bbe72=_0x4aca5f===0x0?_0x16ac48(0x1da)+_0x2f2404:_0x16ac48(0x1da)+_0x2f2404+'_reasoning_'+_0x1b109b[_0x4aca5f],_0x3173d1=await this[_0x16ac48(0x25c)][_0x16ac48(0x24f)](_0xe4d31c),_0x3edfcd=_0x3173d1[_0x16ac48(0x25f)](_0x80b425=>_0x80b425['attributes']['name']===_0x3bbe72);if(_0x3edfcd)return _0x3edfcd;const _0x38b266=_0x4aca5f>0x0?0x1:_0x5cc5c3;return await this[_0x16ac48(0x25c)][_0x16ac48(0x23b)]({'name':_0x3bbe72,'projectId':_0xe4d31c,'modelType':_0x2f2404,'systemPrompt':'','temperature':_0x38b266,'reasoningEffort':_0x4aca5f>0x0?_0x4aca5f:undefined});}catch(_0x17158c){if(_0x17158c instanceof HTTPClientError){const _0x96c1a3=_0x17158c['status'];if(_0x96c1a3>=0x190&&_0x96c1a3<0x1f4){if(_0x96c1a3===0x191)throw new SDKError(ErrorCode[_0x16ac48(0x22c)],_0x16ac48(0x206),_0x17158c);else{if(_0x96c1a3===0x193)throw new SDKError(ErrorCode[_0x16ac48(0x252)],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x17158c);}throw _0x17158c;}}if(errorContains(_0x17158c,'already\x20exists',_0x16ac48(0x15a),_0x16ac48(0x21f))){_0x169820++;if(_0x169820>=_0x5b7b8d)throw new SDKError(ErrorCode[_0x16ac48(0x248)],'Unable\x20to\x20create\x20project\x20after\x20'+_0x5b7b8d+_0x16ac48(0x256),_0x17158c);const _0x25e886=this[_0x16ac48(0x23d)]();_0x3d8505=_0x25e886+'_'+generateRandomHex();continue;}throw _0x17158c;}}throw new SDKError(ErrorCode[_0x16ac48(0x150)],_0x16ac48(0x155));}async[a133_0x552b25(0x1c5)](_0x11c989,_0x39bb16){const _0x248e51=a133_0x552b25,_0x57c3f8=_0x39bb16||this[_0x248e51(0x194)],_0x91fb69=await this['client']['listAgents'](_0x57c3f8),_0x2c96fb=_0x91fb69['filter'](_0x3d4fc7=>_0x3d4fc7['attributes'][_0x248e51(0x21b)]===_0x11c989);if(_0x2c96fb[_0x248e51(0x235)]===0x0){const _0x50c869=_0x57c3f8?'\x20in\x20project\x20'+_0x57c3f8:'';throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x248e51(0x247)+_0x11c989+_0x50c869,undefined,{'helpText':_0x57c3f8?'Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.':_0x248e51(0x227)});}if(_0x2c96fb[_0x248e51(0x235)]>0x1)throw new SDKError(ErrorCode[_0x248e51(0x150)],'Multiple\x20agents\x20found\x20with\x20name\x20\x27'+_0x11c989+_0x248e51(0x20f));return _0x2c96fb[0x0]['id'];}async[a133_0x552b25(0x195)](_0xc523b5){const _0x2449c7=a133_0x552b25,_0x5199a7=_0xc523b5||this[_0x2449c7(0x194)];return await this[_0x2449c7(0x25c)][_0x2449c7(0x24f)](_0x5199a7);}async[a133_0x552b25(0x217)](_0xff31cb){const _0x2f5374=a133_0x552b25;return await this[_0x2f5374(0x25c)][_0x2f5374(0x1ee)](_0xff31cb);}async[a133_0x552b25(0x1d7)](_0x4977d3){const _0x5a8772=a133_0x552b25;return await this[_0x5a8772(0x25c)][_0x5a8772(0x1c4)](_0x4977d3);}async[a133_0x552b25(0x23b)](_0x41465e){const _0x5acf75=a133_0x552b25;return await this[_0x5acf75(0x25c)][_0x5acf75(0x23b)](_0x41465e);}async[a133_0x552b25(0x1d8)](_0x1cd007,_0x3446f2){const _0x29fa90=a133_0x552b25;return await this[_0x29fa90(0x25c)][_0x29fa90(0x1d8)](_0x1cd007,_0x3446f2);}async['deleteAgent'](_0x3d88ca){const _0x5760b0=a133_0x552b25;await this['client'][_0x5760b0(0x1b7)](_0x3d88ca);}async['startChat'](_0x2518ca){const _0x581240=a133_0x552b25;return await this[_0x581240(0x25c)][_0x581240(0x23f)]({'agentId':_0x2518ca});}async*[a133_0x552b25(0x1b3)](_0x52624e,_0x57976d){const _0x14c622=a133_0x552b25;let _0x188ead=_0x57976d?.[_0x14c622(0x1ed)];const _0x10f82d=_0x57976d?.[_0x14c622(0x241)];if(!_0x188ead){if(!_0x10f82d)throw new Error(_0x14c622(0x228));const _0x4cb31b=await this[_0x14c622(0x25c)]['startChat']({'agentId':_0x10f82d});_0x188ead=_0x4cb31b['id'],yield{'type':_0x14c622(0x229),'data':{'chatId':_0x188ead,'agentId':_0x10f82d,'projectId':_0x4cb31b[_0x14c622(0x156)][_0x14c622(0x1cc)]}};}for await(const _0x448ec2 of this[_0x14c622(0x25c)][_0x14c622(0x1b9)](_0x188ead,_0x52624e,_0x57976d?.[_0x14c622(0x170)])){yield{'type':'event','data':_0x448ec2};}}async[a133_0x552b25(0x21d)](_0x379e8e=0x32){const _0x34b1cd=a133_0x552b25;return await this[_0x34b1cd(0x25c)]['listChats'](_0x379e8e);}async[a133_0x552b25(0x1b5)](_0x72d8e7){const _0x296460=a133_0x552b25;return await this[_0x296460(0x25c)][_0x296460(0x22f)](_0x72d8e7);}async[a133_0x552b25(0x181)](_0x477581){const _0x4ce2c4=a133_0x552b25;return await this[_0x4ce2c4(0x25c)][_0x4ce2c4(0x181)](_0x477581);}async[a133_0x552b25(0x239)](_0x3625dd){const _0x5bde05=a133_0x552b25;return await this['client'][_0x5bde05(0x19c)](_0x3625dd);}async[a133_0x552b25(0x16b)](_0x47b0d2,_0x399f76,_0x58b910){const _0x74bfd8=a133_0x552b25,_0x16b93d=_0x58b910?.[_0x74bfd8(0x244)]??![],{projectId:_0x402145,project:_0x20017b}=await this[_0x74bfd8(0x1fe)](_0x47b0d2),_0x2cd1c4=_0x20017b['attributes']['name'],_0x276074=_0x399f76||_0x2cd1c4+_0x74bfd8(0x1af);if(a133_0x4e6e65['existsSync'](_0x276074)&&!_0x16b93d)throw new SDKError(ErrorCode[_0x74bfd8(0x248)],_0x74bfd8(0x14b)+_0x276074,undefined,{'helpText':_0x74bfd8(0x1f7)});const _0x416084=await this[_0x74bfd8(0x25c)]['listAgentsFull'](_0x402145),_0x31652d=await this['client'][_0x74bfd8(0x20b)](_0x402145),_0x2280ff=await this['client'][_0x74bfd8(0x1bb)](_0x402145),_0x244baa=await this[_0x74bfd8(0x25c)]['listIntegrations'](_0x402145);if(!_0x16b93d){a133_0x4e6e65[_0x74bfd8(0x23a)](_0x276074,{'recursive':!![]});const _0x42b94b={'version':_0x74bfd8(0x153),'exportedAt':new Date()['toISOString'](),'exportedFrom':{'site':this[_0x74bfd8(0x25b)][_0x74bfd8(0x192)],'projectId':_0x402145,'projectName':_0x2cd1c4},'project':_0x20017b};a133_0x4e6e65[_0x74bfd8(0x1b0)](a133_0x3ebff7['join'](_0x276074,'project.json'),JSON[_0x74bfd8(0x1d9)](_0x42b94b,null,0x2)),a133_0x4e6e65[_0x74bfd8(0x1b0)](a133_0x3ebff7[_0x74bfd8(0x1d3)](_0x276074,'agents.json'),JSON[_0x74bfd8(0x1d9)](_0x416084,null,0x2)),a133_0x4e6e65['writeFileSync'](a133_0x3ebff7['join'](_0x276074,'knowledgebases.json'),JSON[_0x74bfd8(0x1d9)](_0x31652d,null,0x2)),a133_0x4e6e65['writeFileSync'](a133_0x3ebff7[_0x74bfd8(0x1d3)](_0x276074,_0x74bfd8(0x1e1)),JSON[_0x74bfd8(0x1d9)](_0x2280ff,null,0x2)),a133_0x4e6e65[_0x74bfd8(0x1b0)](a133_0x3ebff7[_0x74bfd8(0x1d3)](_0x276074,_0x74bfd8(0x1e7)),JSON['stringify'](_0x244baa,null,0x2));}return{'projectName':_0x2cd1c4,'outputDir':_0x276074,'counts':{'agents':_0x416084[_0x74bfd8(0x235)],'knowledgeBases':_0x31652d[_0x74bfd8(0x235)],'prompts':_0x2280ff[_0x74bfd8(0x235)],'integrations':_0x244baa[_0x74bfd8(0x235)]}};}async[a133_0x552b25(0x19a)](_0x453a78,_0x25b28c){const _0x768aec=a133_0x552b25,_0x526174=_0x25b28c?.['dryRun']??![],_0x5c2ee4=this[_0x768aec(0x226)](_0x453a78),_0x3b2607=_0x5c2ee4[_0x768aec(0x14d)][_0x768aec(0x192)],_0x121766=this[_0x768aec(0x25b)]['site'],_0x52c6fa=_0x3b2607!==_0x121766?_0x3b2607:undefined,_0x125d93=this[_0x768aec(0x20e)](a133_0x3ebff7[_0x768aec(0x1d3)](_0x453a78,_0x768aec(0x1ea)),[]),_0x35fcb6=this[_0x768aec(0x20e)](a133_0x3ebff7[_0x768aec(0x1d3)](_0x453a78,_0x768aec(0x161)),[]),_0x2e06aa=this[_0x768aec(0x20e)](a133_0x3ebff7[_0x768aec(0x1d3)](_0x453a78,_0x768aec(0x1e1)),[]),_0x2ecc6e=this['loadJsonFile'](a133_0x3ebff7[_0x768aec(0x1d3)](_0x453a78,_0x768aec(0x1e7)),[]),_0x59a2d2=_0x25b28c?.['name']||_0x5c2ee4[_0x768aec(0x14d)]['projectName'];if(_0x526174){const _0x21a2ab=new Map(),_0x45b83e=[..._0x125d93],_0x26182a=_0x125d93['length']+0x1;let _0x2798b0=0x0;while(_0x45b83e[_0x768aec(0x235)]>0x0&&_0x2798b0<_0x26182a){_0x2798b0++;const _0x4860cf=[];for(const _0x4d5d1e of _0x45b83e){canCreateAgent(_0x4d5d1e,_0x21a2ab)?_0x21a2ab[_0x768aec(0x207)](_0x4d5d1e['id'],_0x768aec(0x188)+_0x4d5d1e['id']):_0x4860cf[_0x768aec(0x1cb)](_0x4d5d1e);}if(_0x4860cf[_0x768aec(0x235)]===_0x45b83e[_0x768aec(0x235)])throw new SDKError(ErrorCode[_0x768aec(0x150)],_0x768aec(0x18a),undefined,{'helpText':_0x768aec(0x158)});_0x45b83e[_0x768aec(0x235)]=0x0,_0x45b83e[_0x768aec(0x1cb)](..._0x4860cf);}const _0xa870fe=_0x2e06aa[_0x768aec(0x1e4)](_0x4e95b0=>_0x21a2ab[_0x768aec(0x172)](_0x4e95b0[_0x768aec(0x156)]['agentId']))['length'];return{'projectName':_0x59a2d2,'projectId':_0x768aec(0x208),'counts':{'agents':_0x125d93[_0x768aec(0x235)],'knowledgeBases':_0x35fcb6[_0x768aec(0x235)],'prompts':_0xa870fe,'integrations':_0x2ecc6e[_0x768aec(0x235)]},'sourceSite':_0x52c6fa};}const _0x188076=await this[_0x768aec(0x25c)][_0x768aec(0x220)]({'name':_0x59a2d2,'description':_0x5c2ee4['project']['attributes'][_0x768aec(0x1c0)]}),_0x4f263d=_0x188076['id'],_0x1b03bc=new Map(),_0xbcf112=new Map(),_0x3ee5d7=new Map();for(const _0x5a59fe of _0x35fcb6){const _0x142015=await this[_0x768aec(0x25c)]['createKnowledgeBase']({'projectId':_0x4f263d,'name':_0x5a59fe[_0x768aec(0x156)][_0x768aec(0x21b)],'tdDatabaseName':_0x5a59fe[_0x768aec(0x156)]['tdDatabaseName'],'tables':_0x5a59fe[_0x768aec(0x156)][_0x768aec(0x1d1)]});_0x1b03bc[_0x768aec(0x207)](_0x5a59fe['id'],_0x142015['id']);}const _0x37468f=[..._0x125d93],_0x3bb9eb=_0x125d93['length']+0x1;let _0x270a29=0x0;while(_0x37468f[_0x768aec(0x235)]>0x0&&_0x270a29<_0x3bb9eb){_0x270a29++;const _0x38cbfc=[];for(const _0x54d1f5 of _0x37468f){if(canCreateAgent(_0x54d1f5,_0xbcf112)){const _0x49b109=remapToolIds(_0x54d1f5[_0x768aec(0x156)][_0x768aec(0x225)],_0x1b03bc,_0xbcf112),_0x47575c=remapVariableIds(_0x54d1f5[_0x768aec(0x156)][_0x768aec(0x1bd)],_0x1b03bc),_0x5c302c=await this[_0x768aec(0x25c)][_0x768aec(0x175)]({'name':_0x54d1f5[_0x768aec(0x156)]['name'],'projectId':_0x4f263d,'systemPrompt':_0x54d1f5[_0x768aec(0x156)][_0x768aec(0x1e5)],'starterMessage':_0x54d1f5['attributes'][_0x768aec(0x171)],'modelType':migrateModelType(_0x54d1f5[_0x768aec(0x156)]['modelType']),'maxToolIterations':_0x54d1f5[_0x768aec(0x156)][_0x768aec(0x1ff)],'temperature':_0x54d1f5['attributes'][_0x768aec(0x1ce)],'reasoningEffort':_0x54d1f5[_0x768aec(0x156)][_0x768aec(0x14a)],'outputs':_0x54d1f5[_0x768aec(0x156)][_0x768aec(0x1a9)],'tools':_0x49b109,'variables':_0x47575c});_0xbcf112[_0x768aec(0x207)](_0x54d1f5['id'],_0x5c302c['id']);}else _0x38cbfc[_0x768aec(0x1cb)](_0x54d1f5);}if(_0x38cbfc[_0x768aec(0x235)]===_0x37468f[_0x768aec(0x235)])throw new SDKError(ErrorCode[_0x768aec(0x150)],_0x768aec(0x18a),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x37468f['length']=0x0,_0x37468f[_0x768aec(0x1cb)](..._0x38cbfc);}for(const _0x5b61d7 of _0x2e06aa){const _0x5b3578=_0xbcf112[_0x768aec(0x1aa)](_0x5b61d7['attributes'][_0x768aec(0x241)]);if(!_0x5b3578)continue;const _0x3a8256=await this[_0x768aec(0x25c)][_0x768aec(0x1e2)]({'projectId':_0x4f263d,'agentId':_0x5b3578,'name':_0x5b61d7[_0x768aec(0x156)][_0x768aec(0x21b)],'systemPrompt':_0x5b61d7[_0x768aec(0x156)][_0x768aec(0x1e5)],'template':_0x5b61d7[_0x768aec(0x156)][_0x768aec(0x23e)],'jsonSchemaHint':_0x5b61d7[_0x768aec(0x156)][_0x768aec(0x1de)]});_0x3ee5d7[_0x768aec(0x207)](_0x5b61d7['id'],_0x3a8256['id']);}for(const _0x4f2201 of _0x2ecc6e){const _0x24a9bd=_0x4f2201['attributes'][_0x768aec(0x222)][_0x768aec(0x249)](_0x444e53=>({..._0x444e53,'promptId':_0x3ee5d7[_0x768aec(0x1aa)](_0x444e53[_0x768aec(0x200)])||_0x444e53[_0x768aec(0x200)]}));await this[_0x768aec(0x25c)][_0x768aec(0x17a)]({'projectId':_0x4f263d,'serviceType':_0x4f2201['attributes']['serviceType'],'actions':_0x24a9bd,'slackMessageMode':_0x4f2201[_0x768aec(0x156)][_0x768aec(0x259)],'chatIgnoreManagedActions':_0x4f2201[_0x768aec(0x156)][_0x768aec(0x17b)],'chatWelcomeMessage':_0x4f2201['attributes'][_0x768aec(0x17e)],'webhookCorsOrigins':_0x4f2201['attributes'][_0x768aec(0x216)]});}return{'projectName':_0x59a2d2,'projectId':_0x4f263d,'counts':{'agents':_0xbcf112[_0x768aec(0x149)],'knowledgeBases':_0x1b03bc[_0x768aec(0x149)],'prompts':_0x3ee5d7[_0x768aec(0x149)],'integrations':_0x2ecc6e[_0x768aec(0x235)]},'sourceSite':_0x52c6fa};}[a133_0x552b25(0x20e)](_0x397e87,_0x56ff24){const _0x4c7068=a133_0x552b25;if(!a133_0x4e6e65[_0x4c7068(0x251)](_0x397e87))return _0x56ff24;return JSON[_0x4c7068(0x22e)](a133_0x4e6e65[_0x4c7068(0x20d)](_0x397e87,_0x4c7068(0x202)));}[a133_0x552b25(0x226)](_0x25a4ad){const _0x62c14=a133_0x552b25;if(!a133_0x4e6e65[_0x62c14(0x251)](_0x25a4ad))throw new SDKError(ErrorCode['NOT_FOUND'],_0x62c14(0x1db)+_0x25a4ad,undefined,{'helpText':_0x62c14(0x179)});const _0x3e2f3f=a133_0x3ebff7[_0x62c14(0x1d3)](_0x25a4ad,'project.json');if(!a133_0x4e6e65['existsSync'](_0x3e2f3f))throw new SDKError(ErrorCode[_0x62c14(0x260)],_0x62c14(0x233)+_0x25a4ad,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x242c57=JSON[_0x62c14(0x22e)](a133_0x4e6e65[_0x62c14(0x20d)](_0x3e2f3f,_0x62c14(0x202)));if(!isSupportedBackupVersion(_0x242c57['version']))throw new SDKError(ErrorCode[_0x62c14(0x260)],_0x62c14(0x19d)+_0x242c57['version'],undefined,{'helpText':_0x62c14(0x190)});return _0x242c57;}async[a133_0x552b25(0x240)](_0x72c7bd,_0x1f9bae,_0x4dbfa5){const _0x5a3aba=a133_0x552b25,{projectId:_0x291898,project:_0x19268d}=await this[_0x5a3aba(0x1fe)](_0x72c7bd),_0x54f872=_0x19268d[_0x5a3aba(0x156)][_0x5a3aba(0x21b)];let _0x8804b9;if(_0x1f9bae)_0x8804b9=_0x1f9bae;else{const _0x2809f0=a133_0x3ebff7['join'](process[_0x5a3aba(0x20a)](),_0x5a3aba(0x195)),_0x622751=getSanitizedPathWithMigration(_0x2809f0,_0x54f872);_0x622751['renamed']&&this[_0x5a3aba(0x186)][_0x5a3aba(0x1a4)]('Renamed\x20folder:\x20'+a133_0x3ebff7['basename'](_0x622751[_0x5a3aba(0x1ad)])+_0x5a3aba(0x1a7)+a133_0x3ebff7[_0x5a3aba(0x16c)](_0x622751[_0x5a3aba(0x1b4)])),_0x8804b9=_0x622751['path'];}const _0x1f7b16=await this[_0x5a3aba(0x25c)][_0x5a3aba(0x1ee)](_0x291898),_0x13e095=await this['client'][_0x5a3aba(0x20b)](_0x291898),_0x186900=await this['client'][_0x5a3aba(0x1bf)](_0x291898),_0xd9ed9b=await safeListOrEmpty(()=>this[_0x5a3aba(0x25c)]['listImageGenerators'](_0x291898)),_0x563346=await safeListOrEmpty(()=>this['client'][_0x5a3aba(0x1e8)](_0x291898)),_0x445d70=await this[_0x5a3aba(0x25c)][_0x5a3aba(0x1bb)](_0x291898),_0x31f3ca=await this[_0x5a3aba(0x25c)][_0x5a3aba(0x1cf)](_0x291898),_0x254691=await safeListOrEmpty(()=>this['client'][_0x5a3aba(0x17f)](_0x291898)),_0x3bf1da=await safeListOrEmpty(()=>this[_0x5a3aba(0x25c)][_0x5a3aba(0x152)](_0x291898)),_0x532efe=_0x31f3ca['filter'](_0x13799d=>!_0x13799d['attributes'][_0x5a3aba(0x1f5)]&&SAFE_INTEGRATION_TYPES[_0x5a3aba(0x1f2)](_0x13799d[_0x5a3aba(0x156)][_0x5a3aba(0x1e6)][_0x5a3aba(0x14e)]())),_0x22bba7=new Map(),_0x4a69a4=new Map(),_0x4cb58b=new Map(),_0x3a0461=new Map(),_0x1ed368=new Map(),_0x1f27f1=new Map(),_0x2faa67=new Map();for(const _0x10c999 of _0x1f7b16){_0x22bba7[_0x5a3aba(0x207)](_0x10c999['id'],_0x10c999[_0x5a3aba(0x156)][_0x5a3aba(0x21b)]);}for(const _0x1db41f of _0x13e095){_0x4a69a4['set'](_0x1db41f['id'],_0x1db41f[_0x5a3aba(0x156)][_0x5a3aba(0x21b)]);}for(const _0x4cf97f of _0x186900){_0x4cb58b[_0x5a3aba(0x207)](_0x4cf97f['id'],_0x4cf97f[_0x5a3aba(0x156)][_0x5a3aba(0x21b)]);}for(const _0x30f46f of _0xd9ed9b){_0x3a0461[_0x5a3aba(0x207)](_0x30f46f['id'],_0x30f46f['attributes'][_0x5a3aba(0x21b)]);}for(const _0xc3e8ed of _0x563346){_0x1ed368[_0x5a3aba(0x207)](_0xc3e8ed['id'],_0xc3e8ed['attributes'][_0x5a3aba(0x21b)]);}for(const _0x54174a of _0x445d70){_0x1f27f1['set'](_0x54174a['id'],_0x54174a[_0x5a3aba(0x156)][_0x5a3aba(0x21b)]);}for(const _0x1c92b2 of _0x254691){_0x2faa67['set'](_0x1c92b2['id'],_0x1c92b2[_0x5a3aba(0x156)]['name']);}const _0x4361e1={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x4a69a4,'TextKnowledgeBase':_0x4cb58b,'Agent':_0x22bba7,'WebSearchTool':_0x1ed368,'ImageGenerator':_0x3a0461,'ExperimentalKnowledgeBase':_0x2faa67}),'resolvePromptName':async _0x49aa8c=>_0x1f27f1[_0x5a3aba(0x1aa)](_0x49aa8c),'onWarning':_0x42344d=>this[_0x5a3aba(0x186)][_0x5a3aba(0x1a0)](_0x42344d)},_0x37714e={'projectName':_0x54f872,'outputDir':_0x8804b9,'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}}},_0x186ac0=[],_0x24a174=[];for(const _0x1148d5 of _0x1f7b16){const _0x3f6cf2=getSanitizedPathWithMigration(_0x8804b9,_0x1148d5['attributes'][_0x5a3aba(0x21b)]);_0x3f6cf2[_0x5a3aba(0x1d2)]&&this[_0x5a3aba(0x186)]['info']('Renamed\x20agent\x20folder:\x20'+a133_0x3ebff7['basename'](_0x3f6cf2[_0x5a3aba(0x1ad)])+_0x5a3aba(0x1a7)+a133_0x3ebff7[_0x5a3aba(0x16c)](_0x3f6cf2['path']));const _0x28e2a5=_0x3f6cf2[_0x5a3aba(0x1b4)],_0x46efc7=a133_0x3ebff7[_0x5a3aba(0x1d3)](_0x28e2a5,_0x5a3aba(0x250)),_0x6ee5d7=a133_0x3ebff7[_0x5a3aba(0x1d3)](_0x28e2a5,_0x5a3aba(0x1b2)),_0x113dcd=a133_0x3ebff7[_0x5a3aba(0x1d3)](_0x28e2a5,'starter_message.md'),{yaml:_0x48ac04,systemPrompt:_0x1236c3,starterMessage:_0x14a04c}=await agentResponseToDef(_0x1148d5,_0x4361e1),_0x2be3cb=toAgentYamlString(_0x48ac04),_0x515e0d=!a133_0x4e6e65[_0x5a3aba(0x251)](_0x6ee5d7);let _0x58f8a7=_0x515e0d,_0x385239;if(!_0x515e0d){const _0x41af8c=a133_0x4e6e65['existsSync'](_0x46efc7)?a133_0x4e6e65[_0x5a3aba(0x20d)](_0x46efc7,'utf-8'):'',_0x52e99c=a133_0x4e6e65[_0x5a3aba(0x20d)](_0x6ee5d7,_0x5a3aba(0x202)),_0x353d7f=_0x5a3aba(0x160)+_0x41af8c+_0x5a3aba(0x1c9)+_0x52e99c,_0x534c8d=_0x5a3aba(0x160)+_0x1236c3+'\x0a\x0a#\x20agent.yml\x0a'+_0x2be3cb,_0x4afbac=generateDiff(_0x353d7f,_0x534c8d);_0x58f8a7=hasChanges(_0x4afbac),_0x58f8a7&&(_0x385239=formatDiffWithColors(_0x4afbac));}_0x186ac0[_0x5a3aba(0x1cb)]({'path':_0x28e2a5,'content':'','isDir':!![]}),_0x186ac0[_0x5a3aba(0x1cb)]({'path':_0x46efc7,'content':_0x1236c3}),_0x186ac0[_0x5a3aba(0x1cb)]({'path':_0x6ee5d7,'content':_0x2be3cb});_0x14a04c&&_0x14a04c[_0x5a3aba(0x1f2)]('\x0a')&&_0x186ac0[_0x5a3aba(0x1cb)]({'path':_0x113dcd,'content':_0x14a04c});_0x37714e['agents'][_0x5a3aba(0x1cb)]({'agentName':_0x1148d5[_0x5a3aba(0x156)]['name'],'outputPath':_0x28e2a5,'isNew':_0x515e0d,'hasChanges':_0x58f8a7,'diff':_0x385239}),_0x37714e[_0x5a3aba(0x16d)]['agents']['total']++;if(_0x515e0d)_0x37714e[_0x5a3aba(0x16d)]['agents'][_0x5a3aba(0x22d)]++;else{if(_0x58f8a7)_0x37714e[_0x5a3aba(0x16d)][_0x5a3aba(0x195)]['updated']++;else _0x37714e['counts'][_0x5a3aba(0x195)][_0x5a3aba(0x22b)]++;}}for(const _0x2ba98c of _0x13e095){if(_0x2ba98c[_0x5a3aba(0x156)][_0x5a3aba(0x1f5)])continue;const _0x16a9c2=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x8804b9),_0x2ba98c[_0x5a3aba(0x156)][_0x5a3aba(0x21b)],'.yml');_0x16a9c2['renamed']&&this[_0x5a3aba(0x186)][_0x5a3aba(0x1a4)](_0x5a3aba(0x246)+a133_0x3ebff7[_0x5a3aba(0x16c)](_0x16a9c2[_0x5a3aba(0x1ad)])+_0x5a3aba(0x1a7)+a133_0x3ebff7[_0x5a3aba(0x16c)](_0x16a9c2[_0x5a3aba(0x1b4)]));const _0x58566c=_0x16a9c2['path'],_0x9e4dce=apiKnowledgeBaseToYaml(_0x2ba98c),_0x5d8f70=toKnowledgeBaseYamlString(_0x9e4dce),_0x33e763=!a133_0x4e6e65['existsSync'](_0x58566c);let _0x262654=_0x33e763,_0xa6cebe;if(!_0x33e763){const _0x12641c=a133_0x4e6e65[_0x5a3aba(0x20d)](_0x58566c,_0x5a3aba(0x202)),_0x26e9ac=generateDiff(_0x12641c,_0x5d8f70);_0x262654=hasChanges(_0x26e9ac),_0x262654&&(_0xa6cebe=formatDiffWithColors(_0x26e9ac));}_0x186ac0[_0x5a3aba(0x1cb)]({'path':_0x58566c,'content':_0x5d8f70}),_0x37714e[_0x5a3aba(0x18f)][_0x5a3aba(0x1cb)]({'name':_0x2ba98c[_0x5a3aba(0x156)][_0x5a3aba(0x21b)],'outputPath':_0x58566c,'isNew':_0x33e763,'hasChanges':_0x262654,'diff':_0xa6cebe}),_0x37714e['counts'][_0x5a3aba(0x18f)][_0x5a3aba(0x1a6)]++;if(_0x33e763)_0x37714e[_0x5a3aba(0x16d)][_0x5a3aba(0x18f)][_0x5a3aba(0x22d)]++;else{if(_0x262654)_0x37714e['counts']['knowledgeBases'][_0x5a3aba(0x25e)]++;else _0x37714e[_0x5a3aba(0x16d)][_0x5a3aba(0x18f)][_0x5a3aba(0x22b)]++;}}for(const _0x3717a5 of _0x186900){if(_0x3717a5[_0x5a3aba(0x156)]['isManaged'])continue;const _0x50b1b1=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x8804b9),_0x3717a5['attributes'][_0x5a3aba(0x21b)],_0x5a3aba(0x19b));_0x50b1b1['renamed']&&this[_0x5a3aba(0x186)][_0x5a3aba(0x1a4)](_0x5a3aba(0x205)+a133_0x3ebff7[_0x5a3aba(0x16c)](_0x50b1b1['oldPath'])+_0x5a3aba(0x1a7)+a133_0x3ebff7['basename'](_0x50b1b1[_0x5a3aba(0x1b4)]));const _0x1270d1=_0x50b1b1[_0x5a3aba(0x1b4)],_0x54e50e=toTextKnowledgeBaseMd(_0x3717a5[_0x5a3aba(0x156)][_0x5a3aba(0x21b)],_0x3717a5[_0x5a3aba(0x156)][_0x5a3aba(0x16e)]),_0x480b52=!a133_0x4e6e65[_0x5a3aba(0x251)](_0x1270d1);let _0x3c57e8=_0x480b52,_0x96431e;if(!_0x480b52){const _0x1097d5=a133_0x4e6e65[_0x5a3aba(0x20d)](_0x1270d1,'utf-8'),_0x52e152=generateDiff(_0x1097d5,_0x54e50e);_0x3c57e8=hasChanges(_0x52e152),_0x3c57e8&&(_0x96431e=formatDiffWithColors(_0x52e152));}_0x186ac0[_0x5a3aba(0x1cb)]({'path':_0x1270d1,'content':_0x54e50e}),_0x37714e['textKnowledgeBases'][_0x5a3aba(0x1cb)]({'name':_0x3717a5[_0x5a3aba(0x156)][_0x5a3aba(0x21b)],'outputPath':_0x1270d1,'isNew':_0x480b52,'hasChanges':_0x3c57e8,'diff':_0x96431e}),_0x37714e['counts'][_0x5a3aba(0x180)]['total']++;if(_0x480b52)_0x37714e['counts'][_0x5a3aba(0x180)][_0x5a3aba(0x22d)]++;else{if(_0x3c57e8)_0x37714e['counts'][_0x5a3aba(0x180)][_0x5a3aba(0x25e)]++;else _0x37714e[_0x5a3aba(0x16d)][_0x5a3aba(0x180)][_0x5a3aba(0x22b)]++;}}for(const _0x1eff95 of _0x445d70){if(_0x1eff95[_0x5a3aba(0x156)][_0x5a3aba(0x1f5)])continue;const _0xbc84f1=getSanitizedPathWithMigration(getPromptsDir(_0x8804b9),_0x1eff95[_0x5a3aba(0x156)][_0x5a3aba(0x21b)],'.yml');_0xbc84f1[_0x5a3aba(0x1d2)]&&this['logger'][_0x5a3aba(0x1a4)](_0x5a3aba(0x15d)+a133_0x3ebff7[_0x5a3aba(0x16c)](_0xbc84f1[_0x5a3aba(0x1ad)])+_0x5a3aba(0x1a7)+a133_0x3ebff7[_0x5a3aba(0x16c)](_0xbc84f1['path']));const _0x244919=_0xbc84f1['path'],_0x1fa35d=await apiPromptToYaml(_0x1eff95,_0x4361e1);if(!_0x1fa35d)continue;const _0x608324=toPromptYamlString(_0x1fa35d),_0x547d78=!a133_0x4e6e65[_0x5a3aba(0x251)](_0x244919);let _0xcffdbc=_0x547d78,_0xc1c5e8;if(!_0x547d78){const _0x147cbb=a133_0x4e6e65['readFileSync'](_0x244919,_0x5a3aba(0x202)),_0x22670c=generateDiff(_0x147cbb,_0x608324);_0xcffdbc=hasChanges(_0x22670c),_0xcffdbc&&(_0xc1c5e8=formatDiffWithColors(_0x22670c));}_0x186ac0['push']({'path':_0x244919,'content':_0x608324}),_0x37714e['prompts'][_0x5a3aba(0x1cb)]({'name':_0x1eff95[_0x5a3aba(0x156)]['name'],'outputPath':_0x244919,'isNew':_0x547d78,'hasChanges':_0xcffdbc,'diff':_0xc1c5e8}),_0x37714e[_0x5a3aba(0x16d)][_0x5a3aba(0x164)][_0x5a3aba(0x1a6)]++;if(_0x547d78)_0x37714e['counts'][_0x5a3aba(0x164)][_0x5a3aba(0x22d)]++;else{if(_0xcffdbc)_0x37714e['counts'][_0x5a3aba(0x164)][_0x5a3aba(0x25e)]++;else _0x37714e[_0x5a3aba(0x16d)][_0x5a3aba(0x164)]['unchanged']++;}}for(const _0xce747a of _0x532efe){const _0x3582a7=_0xce747a['attributes'][_0x5a3aba(0x1e6)][_0x5a3aba(0x14e)](),_0x57826d=getSanitizedPathWithMigration(getIntegrationsDir(_0x8804b9),_0x3582a7,_0x5a3aba(0x169));_0x57826d[_0x5a3aba(0x1d2)]&&this[_0x5a3aba(0x186)][_0x5a3aba(0x1a4)]('Renamed\x20integration\x20file:\x20'+a133_0x3ebff7['basename'](_0x57826d[_0x5a3aba(0x1ad)])+_0x5a3aba(0x1a7)+a133_0x3ebff7['basename'](_0x57826d[_0x5a3aba(0x1b4)]));const _0x3b5037=_0x57826d['path'],_0x5eb9b1=await apiIntegrationToYaml(_0xce747a,_0x4361e1),_0x373e9e=toIntegrationYamlString(_0x5eb9b1),_0x2a47e8=!a133_0x4e6e65[_0x5a3aba(0x251)](_0x3b5037);let _0x283573=_0x2a47e8,_0x2a899f;if(!_0x2a47e8){const _0xcbd6cc=a133_0x4e6e65[_0x5a3aba(0x20d)](_0x3b5037,_0x5a3aba(0x202)),_0x77d8b4=generateDiff(_0xcbd6cc,_0x373e9e);_0x283573=hasChanges(_0x77d8b4),_0x283573&&(_0x2a899f=formatDiffWithColors(_0x77d8b4));}_0x186ac0[_0x5a3aba(0x1cb)]({'path':_0x3b5037,'content':_0x373e9e}),_0x37714e[_0x5a3aba(0x1ae)][_0x5a3aba(0x1cb)]({'name':_0x3582a7,'outputPath':_0x3b5037,'isNew':_0x2a47e8,'hasChanges':_0x283573,'diff':_0x2a899f}),_0x37714e['counts'][_0x5a3aba(0x1ae)][_0x5a3aba(0x1a6)]++;if(_0x2a47e8)_0x37714e[_0x5a3aba(0x16d)][_0x5a3aba(0x1ae)]['new']++;else{if(_0x283573)_0x37714e['counts'][_0x5a3aba(0x1ae)][_0x5a3aba(0x25e)]++;else _0x37714e['counts'][_0x5a3aba(0x1ae)]['unchanged']++;}}for(const _0x33d447 of _0x254691){if(_0x33d447[_0x5a3aba(0x156)]['isManaged'])continue;const _0x194cbc=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x8804b9),_0x33d447['attributes']['name']);_0x194cbc['renamed']&&this['logger']['info'](_0x5a3aba(0x1ba)+a133_0x3ebff7[_0x5a3aba(0x16c)](_0x194cbc[_0x5a3aba(0x1ad)])+_0x5a3aba(0x1a7)+a133_0x3ebff7['basename'](_0x194cbc[_0x5a3aba(0x1b4)]));const _0x150f31=_0x194cbc['path'],_0x469603=a133_0x3ebff7[_0x5a3aba(0x1d3)](_0x150f31,sanitizeForFilesystem(_0x33d447[_0x5a3aba(0x156)][_0x5a3aba(0x21b)])+_0x5a3aba(0x169)),_0x3ace76=a133_0x3ebff7[_0x5a3aba(0x1d3)](_0x150f31,_0x5a3aba(0x176)),_0x7b52e1=apiExperimentalKnowledgeBaseToYaml(_0x33d447),_0x5d69f3=toExperimentalKnowledgeBaseYamlString(_0x7b52e1),_0x18573f=!a133_0x4e6e65[_0x5a3aba(0x251)](_0x150f31);let _0x10f767=_0x18573f,_0x386595,_0x2c10cd=_0x5d69f3;const _0x4a0d0c=[..._0x7b52e1[_0x5a3aba(0x176)]][_0x5a3aba(0x15b)]((_0x852e75,_0x5e6c6c)=>_0x852e75[_0x5a3aba(0x21b)][_0x5a3aba(0x201)](_0x5e6c6c[_0x5a3aba(0x21b)]));for(const _0x114a81 of _0x4a0d0c){_0x2c10cd+=_0x5a3aba(0x24d)+_0x114a81[_0x5a3aba(0x21b)]+_0x5a3aba(0x1a1)+_0x114a81[_0x5a3aba(0x209)]+_0x5a3aba(0x17c)+_0x114a81[_0x5a3aba(0x21b)]+_0x5a3aba(0x1a1)+_0x114a81[_0x5a3aba(0x1c3)]+'\x0a';}if(!_0x18573f){let _0x4e4698='';a133_0x4e6e65[_0x5a3aba(0x251)](_0x469603)&&(_0x4e4698=a133_0x4e6e65[_0x5a3aba(0x20d)](_0x469603,_0x5a3aba(0x202)));if(a133_0x4e6e65[_0x5a3aba(0x251)](_0x3ace76)){const _0x8b8968=a133_0x4e6e65['readdirSync'](_0x3ace76,{'withFileTypes':!![]}),_0x1fd333=_0x8b8968['filter'](_0x1d0e8c=>_0x1d0e8c['isDirectory']())[_0x5a3aba(0x15b)]((_0x31c2fc,_0x5b428c)=>_0x31c2fc[_0x5a3aba(0x21b)][_0x5a3aba(0x201)](_0x5b428c[_0x5a3aba(0x21b)]));for(const _0x404801 of _0x1fd333){const _0x1ee789=a133_0x3ebff7[_0x5a3aba(0x1d3)](_0x3ace76,_0x404801[_0x5a3aba(0x21b)],_0x5a3aba(0x1a3)),_0x2a1ebe=a133_0x3ebff7[_0x5a3aba(0x1d3)](_0x3ace76,_0x404801[_0x5a3aba(0x21b)],_0x5a3aba(0x213));a133_0x4e6e65[_0x5a3aba(0x251)](_0x1ee789)&&(_0x4e4698+=_0x5a3aba(0x24d)+_0x404801[_0x5a3aba(0x21b)]+_0x5a3aba(0x1a1)+a133_0x4e6e65[_0x5a3aba(0x20d)](_0x1ee789,'utf-8')+'\x0a'),a133_0x4e6e65[_0x5a3aba(0x251)](_0x2a1ebe)&&(_0x4e4698+='---\x20schema:\x20'+_0x404801['name']+_0x5a3aba(0x1a1)+a133_0x4e6e65[_0x5a3aba(0x20d)](_0x2a1ebe,_0x5a3aba(0x202))+'\x0a');}}const _0x3a4ccb=generateDiff(_0x4e4698,_0x2c10cd);_0x10f767=hasChanges(_0x3a4ccb),_0x10f767&&(_0x386595=formatDiffWithColors(_0x3a4ccb));}_0x186ac0['push']({'path':_0x150f31,'content':'','isDir':!![]}),_0x186ac0[_0x5a3aba(0x1cb)]({'path':_0x469603,'content':_0x5d69f3}),_0x186ac0[_0x5a3aba(0x1cb)]({'path':_0x3ace76,'content':'','isDir':!![]});for(const _0x3cd775 of _0x7b52e1[_0x5a3aba(0x176)]){const _0x236af5=a133_0x3ebff7[_0x5a3aba(0x1d3)](_0x3ace76,sanitizeForFilesystem(_0x3cd775[_0x5a3aba(0x21b)])),_0x4c80d6=a133_0x3ebff7[_0x5a3aba(0x1d3)](_0x236af5,_0x5a3aba(0x1a3)),_0x420348=a133_0x3ebff7[_0x5a3aba(0x1d3)](_0x236af5,_0x5a3aba(0x213));_0x186ac0['push']({'path':_0x236af5,'content':'','isDir':!![]}),_0x186ac0[_0x5a3aba(0x1cb)]({'path':_0x4c80d6,'content':_0x3cd775[_0x5a3aba(0x209)]}),_0x186ac0[_0x5a3aba(0x1cb)]({'path':_0x420348,'content':_0x3cd775[_0x5a3aba(0x1c3)]});}if(a133_0x4e6e65[_0x5a3aba(0x251)](_0x3ace76)){const _0x46627d=a133_0x4e6e65[_0x5a3aba(0x21c)](_0x3ace76,{'withFileTypes':!![]}),_0x6ce2a2=new Set(_0x7b52e1[_0x5a3aba(0x176)][_0x5a3aba(0x249)](_0x1f946f=>sanitizeForFilesystem(_0x1f946f[_0x5a3aba(0x21b)])));for(const _0x5a1a5a of _0x46627d){if(_0x5a1a5a[_0x5a3aba(0x1f4)]()&&!_0x6ce2a2[_0x5a3aba(0x172)](_0x5a1a5a[_0x5a3aba(0x21b)])){const _0x42b4d4=a133_0x3ebff7[_0x5a3aba(0x1d3)](_0x3ace76,_0x5a1a5a['name']);_0x24a174[_0x5a3aba(0x1cb)]({'path':_0x42b4d4,'isDir':!![]});}}}_0x37714e[_0x5a3aba(0x19f)][_0x5a3aba(0x1cb)]({'name':_0x33d447[_0x5a3aba(0x156)][_0x5a3aba(0x21b)],'outputPath':_0x150f31,'isNew':_0x18573f,'hasChanges':_0x10f767,'diff':_0x386595}),_0x37714e[_0x5a3aba(0x16d)][_0x5a3aba(0x19f)][_0x5a3aba(0x1a6)]++;if(_0x18573f)_0x37714e[_0x5a3aba(0x16d)][_0x5a3aba(0x19f)][_0x5a3aba(0x22d)]++;else{if(_0x10f767)_0x37714e[_0x5a3aba(0x16d)][_0x5a3aba(0x19f)][_0x5a3aba(0x25e)]++;else _0x37714e[_0x5a3aba(0x16d)]['experimentalKnowledgeBases'][_0x5a3aba(0x22b)]++;}}for(const _0x3016cc of _0x3bf1da){if(_0x3016cc['attributes']['isManaged'])continue;const _0x4d9e4b=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x8804b9),_0x3016cc[_0x5a3aba(0x156)][_0x5a3aba(0x21b)]);_0x4d9e4b['renamed']&&this[_0x5a3aba(0x186)][_0x5a3aba(0x1a4)](_0x5a3aba(0x1f8)+a133_0x3ebff7[_0x5a3aba(0x16c)](_0x4d9e4b[_0x5a3aba(0x1ad)])+_0x5a3aba(0x1a7)+a133_0x3ebff7['basename'](_0x4d9e4b[_0x5a3aba(0x1b4)]));const _0x4144aa=_0x4d9e4b[_0x5a3aba(0x1b4)],_0xa8e054=a133_0x3ebff7[_0x5a3aba(0x1d3)](_0x4144aa,sanitizeForFilesystem(_0x3016cc['attributes'][_0x5a3aba(0x21b)])+_0x5a3aba(0x169)),_0x198a99=a133_0x3ebff7['join'](_0x4144aa,_0x5a3aba(0x1a3)),_0x13eb97=a133_0x3ebff7[_0x5a3aba(0x1d3)](_0x4144aa,'files'),_0x3ce2bc=apiExperimentalArtifactToYaml(_0x3016cc),_0x20472d=toExperimentalArtifactYamlString(_0x3ce2bc),_0x5d6df9=!a133_0x4e6e65[_0x5a3aba(0x251)](_0x4144aa);let _0x1d3c2a=_0x5d6df9,_0x37a56a,_0x38985c=_0x20472d+('\x0a---\x20code\x20---\x0a'+_0x3ce2bc[_0x5a3aba(0x209)]+'\x0a');const _0xa93e97=[..._0x3ce2bc[_0x5a3aba(0x1ec)]][_0x5a3aba(0x15b)]((_0x48ba71,_0x310f80)=>_0x48ba71[_0x5a3aba(0x254)][_0x5a3aba(0x201)](_0x310f80[_0x5a3aba(0x254)]));for(const _0x2b4ed5 of _0xa93e97){_0x38985c+=_0x5a3aba(0x1bc)+_0x2b4ed5[_0x5a3aba(0x254)]+_0x5a3aba(0x1a1)+_0x2b4ed5[_0x5a3aba(0x174)]+'\x0a';}if(!_0x5d6df9){let _0x5b62b3='';a133_0x4e6e65[_0x5a3aba(0x251)](_0xa8e054)&&(_0x5b62b3=a133_0x4e6e65[_0x5a3aba(0x20d)](_0xa8e054,_0x5a3aba(0x202)));a133_0x4e6e65['existsSync'](_0x198a99)&&(_0x5b62b3+=_0x5a3aba(0x238)+a133_0x4e6e65[_0x5a3aba(0x20d)](_0x198a99,'utf-8')+'\x0a');if(a133_0x4e6e65['existsSync'](_0x13eb97)){const _0x111604=a133_0x4e6e65[_0x5a3aba(0x21c)](_0x13eb97),_0x71ec56=_0x111604[_0x5a3aba(0x1e4)](_0x231c72=>{const _0x59a8b1=_0x5a3aba,_0x2fb897=a133_0x3ebff7['join'](_0x13eb97,_0x231c72);return a133_0x4e6e65[_0x59a8b1(0x1fb)](_0x2fb897)['isFile']();})[_0x5a3aba(0x15b)]((_0x1d2ba9,_0x25f300)=>_0x1d2ba9[_0x5a3aba(0x201)](_0x25f300));for(const _0x5ec8b4 of _0x71ec56){const _0x2c15a2=a133_0x3ebff7[_0x5a3aba(0x1d3)](_0x13eb97,_0x5ec8b4);_0x5b62b3+=_0x5a3aba(0x1bc)+_0x5ec8b4+'\x20---\x0a'+a133_0x4e6e65[_0x5a3aba(0x20d)](_0x2c15a2,_0x5a3aba(0x202))+'\x0a';}}const _0x3c9a73=generateDiff(_0x5b62b3,_0x38985c);_0x1d3c2a=hasChanges(_0x3c9a73),_0x1d3c2a&&(_0x37a56a=formatDiffWithColors(_0x3c9a73));}_0x186ac0[_0x5a3aba(0x1cb)]({'path':_0x4144aa,'content':'','isDir':!![]}),_0x186ac0['push']({'path':_0xa8e054,'content':_0x20472d}),_0x186ac0[_0x5a3aba(0x1cb)]({'path':_0x198a99,'content':_0x3ce2bc[_0x5a3aba(0x209)]});if(_0x3ce2bc[_0x5a3aba(0x1ec)][_0x5a3aba(0x235)]>0x0){_0x186ac0[_0x5a3aba(0x1cb)]({'path':_0x13eb97,'content':'','isDir':!![]});for(const _0x408466 of _0x3ce2bc[_0x5a3aba(0x1ec)]){const _0x13ad19=a133_0x3ebff7[_0x5a3aba(0x1d3)](_0x13eb97,_0x408466[_0x5a3aba(0x254)]);_0x186ac0['push']({'path':_0x13ad19,'content':_0x408466[_0x5a3aba(0x174)]});}}if(a133_0x4e6e65[_0x5a3aba(0x251)](_0x13eb97)){const _0x8e36f2=a133_0x4e6e65[_0x5a3aba(0x21c)](_0x13eb97),_0x94459f=new Set(_0x3ce2bc['files'][_0x5a3aba(0x249)](_0x31f4ed=>_0x31f4ed[_0x5a3aba(0x254)]));for(const _0x500594 of _0x8e36f2){const _0x45e651=a133_0x3ebff7[_0x5a3aba(0x1d3)](_0x13eb97,_0x500594);a133_0x4e6e65[_0x5a3aba(0x1fb)](_0x45e651)[_0x5a3aba(0x162)]()&&!_0x94459f[_0x5a3aba(0x172)](_0x500594)&&_0x24a174[_0x5a3aba(0x1cb)]({'path':_0x45e651});}}_0x37714e[_0x5a3aba(0x1c6)][_0x5a3aba(0x1cb)]({'name':_0x3016cc[_0x5a3aba(0x156)][_0x5a3aba(0x21b)],'outputPath':_0x4144aa,'isNew':_0x5d6df9,'hasChanges':_0x1d3c2a,'diff':_0x37a56a}),_0x37714e[_0x5a3aba(0x16d)][_0x5a3aba(0x1c6)][_0x5a3aba(0x1a6)]++;if(_0x5d6df9)_0x37714e[_0x5a3aba(0x16d)][_0x5a3aba(0x1c6)][_0x5a3aba(0x22d)]++;else{if(_0x1d3c2a)_0x37714e['counts'][_0x5a3aba(0x1c6)][_0x5a3aba(0x25e)]++;else _0x37714e[_0x5a3aba(0x16d)]['experimentalArtifacts']['unchanged']++;}}if(_0x4dbfa5?.[_0x5a3aba(0x244)])return _0x37714e;a133_0x4e6e65[_0x5a3aba(0x23a)](_0x8804b9,{'recursive':!![]}),a133_0x4e6e65[_0x5a3aba(0x23a)](getKnowledgeBasesDir(_0x8804b9),{'recursive':!![]}),a133_0x4e6e65[_0x5a3aba(0x23a)](getPromptsDir(_0x8804b9),{'recursive':!![]}),a133_0x4e6e65[_0x5a3aba(0x23a)](getIntegrationsDir(_0x8804b9),{'recursive':!![]}),a133_0x4e6e65[_0x5a3aba(0x23a)](getExperimentalKnowledgeBasesDir(_0x8804b9),{'recursive':!![]}),a133_0x4e6e65[_0x5a3aba(0x23a)](getExperimentalArtifactsDir(_0x8804b9),{'recursive':!![]});const _0x305eae=a133_0x3ebff7[_0x5a3aba(0x1d3)](_0x8804b9,_0x5a3aba(0x196));a133_0x4e6e65['writeFileSync'](_0x305eae,createAgentConfigContent(_0x54f872));for(const _0x42832e of _0x186ac0){if(_0x42832e['isDir'])a133_0x4e6e65[_0x5a3aba(0x23a)](_0x42832e[_0x5a3aba(0x1b4)],{'recursive':!![]});else{const _0x739cfe=a133_0x3ebff7[_0x5a3aba(0x18c)](_0x42832e['path']);!a133_0x4e6e65[_0x5a3aba(0x251)](_0x739cfe)&&a133_0x4e6e65[_0x5a3aba(0x23a)](_0x739cfe,{'recursive':!![]}),a133_0x4e6e65[_0x5a3aba(0x1b0)](_0x42832e[_0x5a3aba(0x1b4)],_0x42832e[_0x5a3aba(0x1dc)]);}}for(const _0xffafd7 of _0x24a174){_0xffafd7[_0x5a3aba(0x1a2)]?(a133_0x4e6e65[_0x5a3aba(0x1f1)](_0xffafd7[_0x5a3aba(0x1b4)],{'recursive':!![],'force':!![]}),this[_0x5a3aba(0x186)][_0x5a3aba(0x1a4)](_0x5a3aba(0x191)+a133_0x3ebff7[_0x5a3aba(0x16c)](a133_0x3ebff7[_0x5a3aba(0x18c)](_0xffafd7[_0x5a3aba(0x1b4)]))+'/'+a133_0x3ebff7[_0x5a3aba(0x16c)](_0xffafd7[_0x5a3aba(0x1b4)]))):(a133_0x4e6e65[_0x5a3aba(0x1f1)](_0xffafd7[_0x5a3aba(0x1b4)],{'force':!![]}),this[_0x5a3aba(0x186)][_0x5a3aba(0x1a4)](_0x5a3aba(0x15e)+a133_0x3ebff7[_0x5a3aba(0x16c)](a133_0x3ebff7[_0x5a3aba(0x18c)](_0xffafd7[_0x5a3aba(0x1b4)]))+'/'+a133_0x3ebff7[_0x5a3aba(0x16c)](_0xffafd7[_0x5a3aba(0x1b4)])));}return _0x37714e;}async['pushProject'](_0x4ff2cf,_0x22ecee){const _0x26e9bc=a133_0x552b25,_0x2e2b64=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x4ff2cf,_0x26e9bc(0x196));if(!a133_0x4e6e65['existsSync'](_0x2e2b64))throw new SDKError(ErrorCode[_0x26e9bc(0x260)],_0x26e9bc(0x1ca)+_0x4ff2cf,undefined,{'helpText':_0x26e9bc(0x215)});const _0x105430=loadAgentConfig(_0x2e2b64),_0x52e65e=await this[_0x26e9bc(0x16f)](_0x105430[_0x26e9bc(0x1a5)]),_0x378979=await this[_0x26e9bc(0x25c)][_0x26e9bc(0x223)](_0x52e65e),_0x1533f7=_0x378979[_0x26e9bc(0x156)][_0x26e9bc(0x21b)],_0x4a8714={'projectName':_0x1533f7,'projectId':_0x52e65e,'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}}},_0x1ae956=[],_0xda6e84=[],_0x59167a=[],_0x21d35b=[],_0x49ee51=[],_0x54fd81=[],_0xade63d=a133_0x4e6e65[_0x26e9bc(0x21c)](_0x4ff2cf,{'withFileTypes':!![]});for(const _0x1caf17 of _0xade63d){if(!_0x1caf17[_0x26e9bc(0x1f4)]())continue;if(['knowledge_bases',_0x26e9bc(0x164),_0x26e9bc(0x1ae),_0x26e9bc(0x210),'experimental_artifacts'][_0x26e9bc(0x1f2)](_0x1caf17[_0x26e9bc(0x21b)]))continue;const _0x10e6d2=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x4ff2cf,_0x1caf17[_0x26e9bc(0x21b)]);if(isAgentDir(_0x10e6d2)){const _0x279303=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x10e6d2,_0x26e9bc(0x1b2)),_0xd959c7=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x10e6d2,_0x26e9bc(0x250)),_0x4d1371=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x10e6d2,_0x26e9bc(0x230)),_0x3b51cf=parseAgentYaml(a133_0x4e6e65[_0x26e9bc(0x20d)](_0x279303,_0x26e9bc(0x202)),_0x279303),_0x9469d1=a133_0x4e6e65[_0x26e9bc(0x251)](_0xd959c7)?a133_0x4e6e65[_0x26e9bc(0x20d)](_0xd959c7,'utf-8'):'',_0x4d5bc6=a133_0x4e6e65[_0x26e9bc(0x251)](_0x4d1371)?a133_0x4e6e65[_0x26e9bc(0x20d)](_0x4d1371,_0x26e9bc(0x202)):_0x3b51cf[_0x26e9bc(0x232)];_0x1ae956[_0x26e9bc(0x1cb)]({'name':_0x3b51cf['name'],'dir':_0x10e6d2,'yaml':_0x3b51cf,'systemPrompt':_0x9469d1,'starterMessage':_0x4d5bc6});}}const _0x5097bf=getKnowledgeBasesDir(_0x4ff2cf);if(a133_0x4e6e65[_0x26e9bc(0x251)](_0x5097bf)){const _0x38b220=a133_0x4e6e65[_0x26e9bc(0x21c)](_0x5097bf);for(const _0x8680a1 of _0x38b220){const _0x470a32=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x5097bf,_0x8680a1);if(_0x8680a1[_0x26e9bc(0x1fa)](_0x26e9bc(0x169))){const _0x36c638=parseKnowledgeBaseYaml(a133_0x4e6e65[_0x26e9bc(0x20d)](_0x470a32,_0x26e9bc(0x202)),_0x470a32);_0xda6e84[_0x26e9bc(0x1cb)]({'name':_0x36c638[_0x26e9bc(0x21b)],'path':_0x470a32,'yaml':_0x36c638});}else{if(_0x8680a1[_0x26e9bc(0x1fa)](_0x26e9bc(0x19b))){const _0x287a2c=a133_0x4e6e65[_0x26e9bc(0x20d)](_0x470a32,_0x26e9bc(0x202)),{name:_0x542a77,text:_0x552343}=parseTextKnowledgeBaseMd(_0x287a2c,_0x8680a1);_0x59167a[_0x26e9bc(0x1cb)]({'name':_0x542a77,'path':_0x470a32,'text':_0x552343});}}}}const _0x49b276=getPromptsDir(_0x4ff2cf);if(a133_0x4e6e65['existsSync'](_0x49b276)){const _0x5eb485=a133_0x4e6e65[_0x26e9bc(0x21c)](_0x49b276)[_0x26e9bc(0x1e4)](_0x41c2b3=>_0x41c2b3[_0x26e9bc(0x1fa)](_0x26e9bc(0x169)));for(const _0x308585 of _0x5eb485){const _0x1c4563=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x49b276,_0x308585),_0x499581=parsePromptYaml(a133_0x4e6e65[_0x26e9bc(0x20d)](_0x1c4563,_0x26e9bc(0x202)),_0x1c4563);_0x21d35b[_0x26e9bc(0x1cb)]({'name':_0x499581[_0x26e9bc(0x21b)],'path':_0x1c4563,'yaml':_0x499581});}}const _0x4a101c=[],_0x53df4e=getIntegrationsDir(_0x4ff2cf);if(a133_0x4e6e65[_0x26e9bc(0x251)](_0x53df4e)){const _0x2c4b3a=a133_0x4e6e65[_0x26e9bc(0x21c)](_0x53df4e)[_0x26e9bc(0x1e4)](_0x48caab=>_0x48caab[_0x26e9bc(0x1fa)](_0x26e9bc(0x169)));for(const _0x59d64c of _0x2c4b3a){const _0x2f068f=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x53df4e,_0x59d64c),_0x4a9e5a=parseIntegrationYaml(a133_0x4e6e65[_0x26e9bc(0x20d)](_0x2f068f,_0x26e9bc(0x202)),_0x2f068f);if(!SAFE_INTEGRATION_TYPES[_0x26e9bc(0x1f2)](_0x4a9e5a[_0x26e9bc(0x21a)]['toLowerCase']())){this[_0x26e9bc(0x186)][_0x26e9bc(0x1a0)](_0x26e9bc(0x245)+_0x4a9e5a[_0x26e9bc(0x21b)]+_0x26e9bc(0x20c)+_0x4a9e5a['service_type']+_0x26e9bc(0x219)+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x26e9bc(0x168))+_0x26e9bc(0x1d0));continue;}_0x4a101c[_0x26e9bc(0x1cb)]({'name':_0x4a9e5a[_0x26e9bc(0x21b)],'path':_0x2f068f,'yaml':_0x4a9e5a});}}const _0x334920=getExperimentalKnowledgeBasesDir(_0x4ff2cf);if(a133_0x4e6e65['existsSync'](_0x334920)){const _0x2a6dc2=a133_0x4e6e65[_0x26e9bc(0x21c)](_0x334920,{'withFileTypes':!![]});for(const _0xb129a6 of _0x2a6dc2){if(!_0xb129a6['isDirectory']())continue;const _0x3545e3=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x334920,_0xb129a6[_0x26e9bc(0x21b)]),_0x4c4624=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x3545e3,_0xb129a6[_0x26e9bc(0x21b)]+_0x26e9bc(0x169)),_0x1ae55c=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x3545e3,_0x26e9bc(0x176));if(!a133_0x4e6e65['existsSync'](_0x4c4624))continue;const _0x263425=parseExperimentalKnowledgeBaseYaml(a133_0x4e6e65[_0x26e9bc(0x20d)](_0x4c4624,_0x26e9bc(0x202)),_0x4c4624),_0xfc17cf=[];if(a133_0x4e6e65[_0x26e9bc(0x251)](_0x1ae55c)){const _0x19819e=a133_0x4e6e65[_0x26e9bc(0x21c)](_0x1ae55c,{'withFileTypes':!![]});for(const _0x45e8bb of _0x19819e){if(!_0x45e8bb['isDirectory']())continue;const _0x5cec86=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x1ae55c,_0x45e8bb[_0x26e9bc(0x21b)]),_0x56b976=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x5cec86,'code.js'),_0x284b02=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x5cec86,_0x26e9bc(0x213));a133_0x4e6e65[_0x26e9bc(0x251)](_0x56b976)&&a133_0x4e6e65[_0x26e9bc(0x251)](_0x284b02)&&_0xfc17cf['push']({'name':_0x45e8bb[_0x26e9bc(0x21b)],'code':a133_0x4e6e65[_0x26e9bc(0x20d)](_0x56b976,'utf-8'),'json_schema':a133_0x4e6e65[_0x26e9bc(0x20d)](_0x284b02,_0x26e9bc(0x202))});}}const _0x435b20={..._0x263425,'variables':_0x263425[_0x26e9bc(0x1bd)]||[],'functions':_0xfc17cf};_0x49ee51[_0x26e9bc(0x1cb)]({'name':_0x263425[_0x26e9bc(0x21b)],'dir':_0x3545e3,'def':_0x435b20});}}const _0x33f22e=getExperimentalArtifactsDir(_0x4ff2cf);if(a133_0x4e6e65[_0x26e9bc(0x251)](_0x33f22e)){const _0x2115eb=a133_0x4e6e65[_0x26e9bc(0x21c)](_0x33f22e,{'withFileTypes':!![]});for(const _0xb30350 of _0x2115eb){if(!_0xb30350['isDirectory']())continue;const _0x4bcd8d=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x33f22e,_0xb30350[_0x26e9bc(0x21b)]),_0x32d2db=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x4bcd8d,_0xb30350[_0x26e9bc(0x21b)]+_0x26e9bc(0x169)),_0x1e4337=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x4bcd8d,_0x26e9bc(0x1a3)),_0x53504d=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x4bcd8d,'files');if(!a133_0x4e6e65['existsSync'](_0x32d2db)||!a133_0x4e6e65[_0x26e9bc(0x251)](_0x1e4337))continue;const _0x2c98b0=parseExperimentalArtifactYaml(a133_0x4e6e65['readFileSync'](_0x32d2db,_0x26e9bc(0x202)),_0x32d2db),_0xbf164=a133_0x4e6e65[_0x26e9bc(0x20d)](_0x1e4337,_0x26e9bc(0x202)),_0x59c776=[];if(a133_0x4e6e65['existsSync'](_0x53504d)){const _0x4d9ab5=a133_0x4e6e65['readdirSync'](_0x53504d);for(const _0x23243c of _0x4d9ab5){const _0x17500d=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x53504d,_0x23243c);a133_0x4e6e65['statSync'](_0x17500d)[_0x26e9bc(0x162)]()&&_0x59c776[_0x26e9bc(0x1cb)]({'file_name':_0x23243c,'text_content':a133_0x4e6e65[_0x26e9bc(0x20d)](_0x17500d,_0x26e9bc(0x202))});}}const _0x44c43f={..._0x2c98b0,'code':_0xbf164,'files':_0x59c776};_0x54fd81[_0x26e9bc(0x1cb)]({'name':_0x2c98b0[_0x26e9bc(0x21b)],'dir':_0x4bcd8d,'def':_0x44c43f});}}const _0x5e23ac=await this[_0x26e9bc(0x25c)][_0x26e9bc(0x1ee)](_0x52e65e),_0x564797=await this[_0x26e9bc(0x25c)][_0x26e9bc(0x20b)](_0x52e65e),_0x577e27=await this[_0x26e9bc(0x25c)]['listTextKnowledgeBases'](_0x52e65e),_0x279449=await this[_0x26e9bc(0x25c)][_0x26e9bc(0x1bb)](_0x52e65e),_0x36ada0=await this['client']['listIntegrations'](_0x52e65e),_0x360778=await safeListOrEmpty(()=>this['client']['listExperimentalKnowledgeBases'](_0x52e65e)),_0x2300a7=await safeListOrEmpty(()=>this[_0x26e9bc(0x25c)]['listExperimentalArtifacts'](_0x52e65e)),_0x5bbabd=await fetchAllToolTargetMaps((_0x2d49a0,_0xd861e)=>this[_0x26e9bc(0x25c)][_0x26e9bc(0x1fd)](_0x2d49a0,_0xd861e),_0x52e65e),_0x1bb535=new Map(),_0x3815af=new Map(),_0x9eac61=new Map(),_0x4d84de=new Map(),_0x30c759=new Map(),_0x404b7d=new Map(),_0x412e7e=new Map();for(const _0x243a31 of _0x5e23ac){_0x1bb535[_0x26e9bc(0x207)](_0x243a31[_0x26e9bc(0x156)][_0x26e9bc(0x21b)],_0x243a31);}for(const _0x184ee9 of _0x564797){_0x3815af['set'](_0x184ee9[_0x26e9bc(0x156)][_0x26e9bc(0x21b)],_0x184ee9);}for(const _0x5a6e30 of _0x577e27){_0x9eac61[_0x26e9bc(0x207)](_0x5a6e30['attributes'][_0x26e9bc(0x21b)],_0x5a6e30);}for(const _0x187c46 of _0x279449){_0x4d84de[_0x26e9bc(0x207)](_0x187c46[_0x26e9bc(0x156)]['name'],_0x187c46);}for(const _0x12923c of _0x36ada0){_0x30c759['set'](_0x12923c[_0x26e9bc(0x156)]['serviceType'][_0x26e9bc(0x14e)](),_0x12923c);}for(const _0x5d4a95 of _0x360778){_0x404b7d[_0x26e9bc(0x207)](_0x5d4a95[_0x26e9bc(0x156)][_0x26e9bc(0x21b)],_0x5d4a95);}for(const _0x110f84 of _0x2300a7){_0x412e7e[_0x26e9bc(0x207)](_0x110f84['attributes'][_0x26e9bc(0x21b)],_0x110f84);}const _0x5f3b76=new Map(),_0x366a97=new Map();for(const _0x28dc77 of _0x5e23ac){_0x5f3b76[_0x26e9bc(0x207)](_0x28dc77[_0x26e9bc(0x156)][_0x26e9bc(0x21b)],_0x28dc77['id']),_0x366a97[_0x26e9bc(0x207)](_0x28dc77['id'],_0x28dc77[_0x26e9bc(0x156)][_0x26e9bc(0x21b)]);}const _0x2e8b30=new Map(),_0x225361=new Map();for(const _0x2c3d0a of _0x279449){_0x2e8b30['set'](_0x2c3d0a[_0x26e9bc(0x156)][_0x26e9bc(0x21b)],_0x2c3d0a['id']),_0x225361[_0x26e9bc(0x207)](_0x2c3d0a['id'],_0x2c3d0a['attributes']['name']);}const _0x3968bc=_0x5bbabd['nameToId']['KnowledgeBase']||new Map(),_0x7448c2=_0x5bbabd[_0x26e9bc(0x1c2)][_0x26e9bc(0x1f0)]||new Map(),_0x204f33=_0x5bbabd[_0x26e9bc(0x1c2)][_0x26e9bc(0x236)]||new Map(),_0x348a5a=new Map(),_0x254a3a={'resolveToolTargetName':buildNameResolver({..._0x5bbabd[_0x26e9bc(0x255)],'Agent':_0x366a97}),'resolvePromptName':async _0x3dd4c2=>_0x225361['get'](_0x3dd4c2),'onWarning':_0x38cf06=>this[_0x26e9bc(0x186)][_0x26e9bc(0x1a0)](_0x38cf06)};let _0x3df83f=[];const _0x55df8c={'projectId':_0x52e65e,'resolveToolTargetId':buildIdResolver({..._0x5bbabd[_0x26e9bc(0x1c2)],'Agent':_0x5f3b76}),'resolvePromptId':async _0xe573d8=>_0x2e8b30[_0x26e9bc(0x1aa)](_0xe573d8),'onWarning':_0x4b054e=>{const _0x3f4ef4=_0x26e9bc;this[_0x3f4ef4(0x186)][_0x3f4ef4(0x1a0)](_0x4b054e),_0x3df83f[_0x3f4ef4(0x1cb)](_0x4b054e);}},{resolved:_0x13f336,unresolved:_0x5809ed}=resolveAgentDependencies(_0x1ae956,new Set(_0x1bb535[_0x26e9bc(0x242)]()));for(const {agent:_0x1585ad,missingDeps:_0x516152}of _0x5809ed){_0x4a8714[_0x26e9bc(0x195)][_0x26e9bc(0x1cb)]({'agentName':_0x1585ad[_0x26e9bc(0x1e0)][_0x26e9bc(0x21b)],'action':'error','error':'Unresolved\x20dependencies:\x20'+_0x516152[_0x26e9bc(0x1d3)](',\x20')+_0x26e9bc(0x1d4)}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x195)][_0x26e9bc(0x18d)]++;}for(const _0x1a212d of _0xda6e84){const _0x5a61c3=_0x3815af[_0x26e9bc(0x1aa)](_0x1a212d[_0x26e9bc(0x1e0)][_0x26e9bc(0x21b)]),_0x542329=a133_0x4e6e65[_0x26e9bc(0x20d)](_0x1a212d['path'],'utf-8');if(_0x5a61c3){const _0x357921=apiKnowledgeBaseToYaml(_0x5a61c3),_0x5360c0=toKnowledgeBaseYamlString(_0x357921),_0x591803=generateDiff(_0x5360c0,_0x542329),_0x47713a=hasChanges(_0x591803);_0x47713a?(_0x4a8714[_0x26e9bc(0x18f)][_0x26e9bc(0x1cb)]({'name':_0x1a212d[_0x26e9bc(0x1e0)][_0x26e9bc(0x21b)],'action':'updated','id':_0x5a61c3['id'],'diff':formatDiffWithColors(_0x591803)}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x18f)][_0x26e9bc(0x25e)]++):(_0x4a8714['knowledgeBases'][_0x26e9bc(0x1cb)]({'name':_0x1a212d[_0x26e9bc(0x1e0)]['name'],'action':_0x26e9bc(0x22b),'id':_0x5a61c3['id']}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x18f)][_0x26e9bc(0x22b)]++);}else _0x4a8714[_0x26e9bc(0x18f)][_0x26e9bc(0x1cb)]({'name':_0x1a212d[_0x26e9bc(0x1e0)][_0x26e9bc(0x21b)],'action':_0x26e9bc(0x199)}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x18f)][_0x26e9bc(0x199)]++;}for(const _0x118e31 of _0x59167a){const _0x51a7f5=_0x9eac61[_0x26e9bc(0x1aa)](_0x118e31['name']),_0x44d7d5=a133_0x4e6e65[_0x26e9bc(0x20d)](_0x118e31[_0x26e9bc(0x1b4)],_0x26e9bc(0x202));if(_0x51a7f5){const _0x45bb79=toTextKnowledgeBaseMd(_0x51a7f5['attributes'][_0x26e9bc(0x21b)],_0x51a7f5[_0x26e9bc(0x156)][_0x26e9bc(0x16e)]),_0x35cb72=generateDiff(_0x45bb79,_0x44d7d5),_0x1a2095=hasChanges(_0x35cb72);_0x1a2095?(_0x4a8714['textKnowledgeBases'][_0x26e9bc(0x1cb)]({'name':_0x118e31['name'],'action':_0x26e9bc(0x25e),'id':_0x51a7f5['id'],'diff':formatDiffWithColors(_0x35cb72)}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x180)]['updated']++):(_0x4a8714['textKnowledgeBases']['push']({'name':_0x118e31[_0x26e9bc(0x21b)],'action':'unchanged','id':_0x51a7f5['id']}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x180)]['unchanged']++);}else _0x4a8714[_0x26e9bc(0x180)][_0x26e9bc(0x1cb)]({'name':_0x118e31['name'],'action':_0x26e9bc(0x199)}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x180)][_0x26e9bc(0x199)]++;}for(const _0x979b0c of _0x13f336){const _0x1a6384=_0x1bb535[_0x26e9bc(0x1aa)](_0x979b0c[_0x26e9bc(0x1e0)][_0x26e9bc(0x21b)]),_0x5b6e2a=a133_0x3ebff7[_0x26e9bc(0x1d3)](_0x979b0c[_0x26e9bc(0x18b)],_0x26e9bc(0x1b2)),_0x3bcc94=a133_0x4e6e65['readFileSync'](_0x5b6e2a,_0x26e9bc(0x202)),_0x47362c=_0x979b0c['systemPrompt'],_0x11ce2e=_0x26e9bc(0x160)+_0x47362c+_0x26e9bc(0x1c9)+_0x3bcc94;if(_0x1a6384){const {yaml:_0x3d05d8,systemPrompt:_0x35f431}=await agentResponseToDef(_0x1a6384,_0x254a3a),_0x2c7c7a=toAgentYamlString(_0x3d05d8),_0x602f81=_0x26e9bc(0x160)+_0x35f431+'\x0a\x0a#\x20agent.yml\x0a'+_0x2c7c7a,_0x38046e=generateDiff(_0x602f81,_0x11ce2e),_0x544e51=hasChanges(_0x38046e);_0x544e51?(_0x4a8714['agents'][_0x26e9bc(0x1cb)]({'agentName':_0x979b0c[_0x26e9bc(0x1e0)]['name'],'action':_0x26e9bc(0x25e),'agentId':_0x1a6384['id'],'diff':formatDiffWithColors(_0x38046e)}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x195)][_0x26e9bc(0x25e)]++):(_0x4a8714[_0x26e9bc(0x195)][_0x26e9bc(0x1cb)]({'agentName':_0x979b0c['yaml'][_0x26e9bc(0x21b)],'action':_0x26e9bc(0x22b),'agentId':_0x1a6384['id']}),_0x4a8714['counts'][_0x26e9bc(0x195)][_0x26e9bc(0x22b)]++);}else _0x4a8714[_0x26e9bc(0x195)][_0x26e9bc(0x1cb)]({'agentName':_0x979b0c[_0x26e9bc(0x1e0)][_0x26e9bc(0x21b)],'action':_0x26e9bc(0x199)}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x195)]['created']++;}for(const _0x17ce9 of _0x21d35b){const _0x26a68a=_0x4d84de[_0x26e9bc(0x1aa)](_0x17ce9[_0x26e9bc(0x1e0)][_0x26e9bc(0x21b)]),_0x76476e=a133_0x4e6e65['readFileSync'](_0x17ce9[_0x26e9bc(0x1b4)],_0x26e9bc(0x202));if(_0x26a68a){const _0x3d3090=await apiPromptToYaml(_0x26a68a,_0x254a3a);if(!_0x3d3090){_0x4a8714[_0x26e9bc(0x164)][_0x26e9bc(0x1cb)]({'name':_0x17ce9['yaml']['name'],'action':'updated','id':_0x26a68a['id']}),_0x4a8714['counts'][_0x26e9bc(0x164)][_0x26e9bc(0x25e)]++;continue;}const _0x4adf7a=toPromptYamlString(_0x3d3090),_0x23fe27=generateDiff(_0x4adf7a,_0x76476e),_0x164721=hasChanges(_0x23fe27);_0x164721?(_0x4a8714[_0x26e9bc(0x164)][_0x26e9bc(0x1cb)]({'name':_0x17ce9[_0x26e9bc(0x1e0)][_0x26e9bc(0x21b)],'action':'updated','id':_0x26a68a['id'],'diff':formatDiffWithColors(_0x23fe27)}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x164)][_0x26e9bc(0x25e)]++):(_0x4a8714[_0x26e9bc(0x164)]['push']({'name':_0x17ce9[_0x26e9bc(0x1e0)]['name'],'action':'unchanged','id':_0x26a68a['id']}),_0x4a8714[_0x26e9bc(0x16d)]['prompts']['unchanged']++);}else _0x4a8714[_0x26e9bc(0x164)][_0x26e9bc(0x1cb)]({'name':_0x17ce9[_0x26e9bc(0x1e0)]['name'],'action':'created'}),_0x4a8714['counts'][_0x26e9bc(0x164)]['created']++;}for(const _0x5782dd of _0x4a101c){const _0x4a1008=_0x30c759['get'](_0x5782dd['yaml'][_0x26e9bc(0x21a)]),_0x2a9588=a133_0x4e6e65['readFileSync'](_0x5782dd[_0x26e9bc(0x1b4)],_0x26e9bc(0x202));if(_0x4a1008){const _0x7fce3=await apiIntegrationToYaml(_0x4a1008,_0x254a3a),_0x8b0840=toIntegrationYamlString(_0x7fce3),_0x482478=generateDiff(_0x8b0840,_0x2a9588),_0x470014=hasChanges(_0x482478);_0x470014?(_0x4a8714[_0x26e9bc(0x1ae)][_0x26e9bc(0x1cb)]({'name':_0x5782dd[_0x26e9bc(0x1e0)]['service_type'],'action':_0x26e9bc(0x25e),'id':_0x4a1008['id'],'diff':formatDiffWithColors(_0x482478)}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x1ae)][_0x26e9bc(0x25e)]++):(_0x4a8714[_0x26e9bc(0x1ae)][_0x26e9bc(0x1cb)]({'name':_0x5782dd[_0x26e9bc(0x1e0)][_0x26e9bc(0x21a)],'action':_0x26e9bc(0x22b),'id':_0x4a1008['id']}),_0x4a8714[_0x26e9bc(0x16d)]['integrations'][_0x26e9bc(0x22b)]++);}else _0x4a8714['integrations'][_0x26e9bc(0x1cb)]({'name':_0x5782dd[_0x26e9bc(0x1e0)][_0x26e9bc(0x21a)],'action':'created'}),_0x4a8714['counts'][_0x26e9bc(0x1ae)][_0x26e9bc(0x199)]++;}for(const _0x1dbe94 of _0x49ee51){const _0x23c9d5=_0x404b7d[_0x26e9bc(0x1aa)](_0x1dbe94['def'][_0x26e9bc(0x21b)]),_0x43fa06=toExperimentalKnowledgeBaseYamlString(_0x1dbe94['def']);let _0x400e43=_0x43fa06;for(const _0x5495a6 of _0x1dbe94[_0x26e9bc(0x1f3)]['functions']){_0x400e43+=_0x26e9bc(0x24d)+_0x5495a6[_0x26e9bc(0x21b)]+_0x26e9bc(0x1a1)+_0x5495a6['code']+_0x26e9bc(0x17c)+_0x5495a6['name']+_0x26e9bc(0x1a1)+_0x5495a6['json_schema']+'\x0a';}if(_0x23c9d5){const _0x49abc1=apiExperimentalKnowledgeBaseToYaml(_0x23c9d5),_0x37870f=toExperimentalKnowledgeBaseYamlString(_0x49abc1);let _0x874242=_0x37870f;for(const _0x1e1a9c of _0x49abc1[_0x26e9bc(0x176)]){_0x874242+=_0x26e9bc(0x24d)+_0x1e1a9c[_0x26e9bc(0x21b)]+_0x26e9bc(0x1a1)+_0x1e1a9c[_0x26e9bc(0x209)]+_0x26e9bc(0x17c)+_0x1e1a9c[_0x26e9bc(0x21b)]+_0x26e9bc(0x1a1)+_0x1e1a9c[_0x26e9bc(0x1c3)]+'\x0a';}const _0x39fbfb=generateDiff(_0x874242,_0x400e43),_0x34035e=hasChanges(_0x39fbfb);_0x34035e?(_0x4a8714[_0x26e9bc(0x19f)][_0x26e9bc(0x1cb)]({'name':_0x1dbe94[_0x26e9bc(0x1f3)]['name'],'action':_0x26e9bc(0x25e),'id':_0x23c9d5['id'],'diff':formatDiffWithColors(_0x39fbfb)}),_0x4a8714['counts'][_0x26e9bc(0x19f)]['updated']++):(_0x4a8714[_0x26e9bc(0x19f)][_0x26e9bc(0x1cb)]({'name':_0x1dbe94[_0x26e9bc(0x1f3)][_0x26e9bc(0x21b)],'action':'unchanged','id':_0x23c9d5['id']}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x19f)][_0x26e9bc(0x22b)]++);}else _0x4a8714[_0x26e9bc(0x19f)][_0x26e9bc(0x1cb)]({'name':_0x1dbe94[_0x26e9bc(0x1f3)]['name'],'action':_0x26e9bc(0x199)}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x19f)][_0x26e9bc(0x199)]++;}for(const _0x3cff66 of _0x54fd81){const _0x20362=_0x412e7e[_0x26e9bc(0x1aa)](_0x3cff66[_0x26e9bc(0x1f3)][_0x26e9bc(0x21b)]),_0x217e7f=toExperimentalArtifactYamlString(_0x3cff66[_0x26e9bc(0x1f3)]);let _0x22d024=_0x217e7f+(_0x26e9bc(0x238)+_0x3cff66[_0x26e9bc(0x1f3)]['code']+'\x0a');for(const _0x216081 of _0x3cff66['def'][_0x26e9bc(0x1ec)]){_0x22d024+=_0x26e9bc(0x1bc)+_0x216081[_0x26e9bc(0x254)]+_0x26e9bc(0x1a1)+_0x216081[_0x26e9bc(0x174)]+'\x0a';}if(_0x20362){const _0x5195e5=apiExperimentalArtifactToYaml(_0x20362),_0x12fcae=toExperimentalArtifactYamlString(_0x5195e5);let _0x5bdadd=_0x12fcae+(_0x26e9bc(0x238)+_0x5195e5['code']+'\x0a');for(const _0xe7fc39 of _0x5195e5[_0x26e9bc(0x1ec)]){_0x5bdadd+=_0x26e9bc(0x1bc)+_0xe7fc39[_0x26e9bc(0x254)]+_0x26e9bc(0x1a1)+_0xe7fc39[_0x26e9bc(0x174)]+'\x0a';}const _0x308f70=generateDiff(_0x5bdadd,_0x22d024),_0x4ed9f7=hasChanges(_0x308f70);_0x4ed9f7?(_0x4a8714[_0x26e9bc(0x1c6)][_0x26e9bc(0x1cb)]({'name':_0x3cff66[_0x26e9bc(0x1f3)][_0x26e9bc(0x21b)],'action':_0x26e9bc(0x25e),'id':_0x20362['id'],'diff':formatDiffWithColors(_0x308f70)}),_0x4a8714[_0x26e9bc(0x16d)]['experimentalArtifacts'][_0x26e9bc(0x25e)]++):(_0x4a8714['experimentalArtifacts']['push']({'name':_0x3cff66[_0x26e9bc(0x1f3)][_0x26e9bc(0x21b)],'action':_0x26e9bc(0x22b),'id':_0x20362['id']}),_0x4a8714[_0x26e9bc(0x16d)]['experimentalArtifacts']['unchanged']++);}else _0x4a8714[_0x26e9bc(0x1c6)]['push']({'name':_0x3cff66[_0x26e9bc(0x1f3)][_0x26e9bc(0x21b)],'action':'created'}),_0x4a8714['counts']['experimentalArtifacts']['created']++;}if(_0x22ecee?.['dryRun'])return _0x4a8714;_0x4a8714['knowledgeBases']=[],_0x4a8714[_0x26e9bc(0x180)]=[],_0x4a8714[_0x26e9bc(0x164)]=[],_0x4a8714[_0x26e9bc(0x1ae)]=[],_0x4a8714[_0x26e9bc(0x19f)]=[],_0x4a8714[_0x26e9bc(0x1c6)]=[];const _0xc756bb=_0x4a8714[_0x26e9bc(0x195)][_0x26e9bc(0x1e4)](_0x5a9540=>_0x5a9540[_0x26e9bc(0x15f)]===_0x26e9bc(0x1e3));_0x4a8714[_0x26e9bc(0x195)]=_0xc756bb,_0x4a8714['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0xc756bb[_0x26e9bc(0x235)]},'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 _0x3ba713 of _0xda6e84){try{const _0x46118e=_0x3815af[_0x26e9bc(0x1aa)](_0x3ba713['yaml'][_0x26e9bc(0x21b)]),_0x5218f8=yamlKnowledgeBaseToApi(_0x3ba713[_0x26e9bc(0x1e0)],_0x52e65e);if(_0x46118e)await this[_0x26e9bc(0x25c)][_0x26e9bc(0x165)](_0x46118e['id'],_0x5218f8),_0x3968bc[_0x26e9bc(0x207)](_0x3ba713[_0x26e9bc(0x1e0)][_0x26e9bc(0x21b)],_0x46118e['id']),_0x4a8714['knowledgeBases'][_0x26e9bc(0x1cb)]({'name':_0x3ba713['yaml']['name'],'action':_0x26e9bc(0x25e),'id':_0x46118e['id']}),_0x4a8714[_0x26e9bc(0x16d)]['knowledgeBases'][_0x26e9bc(0x25e)]++;else{const _0x91a491=await this[_0x26e9bc(0x25c)][_0x26e9bc(0x218)](_0x5218f8);_0x3968bc[_0x26e9bc(0x207)](_0x3ba713['yaml'][_0x26e9bc(0x21b)],_0x91a491['id']),_0x4a8714[_0x26e9bc(0x18f)][_0x26e9bc(0x1cb)]({'name':_0x3ba713['yaml']['name'],'action':_0x26e9bc(0x199),'id':_0x91a491['id']}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x18f)]['created']++;}}catch(_0x23d0d3){_0x4a8714[_0x26e9bc(0x18f)][_0x26e9bc(0x1cb)]({'name':_0x3ba713[_0x26e9bc(0x1e0)][_0x26e9bc(0x21b)],'action':_0x26e9bc(0x1e3),'error':_0x23d0d3['message']}),_0x4a8714['counts']['knowledgeBases'][_0x26e9bc(0x18d)]++;}}for(const _0x3469c6 of _0x59167a){try{const _0x3228a9=_0x9eac61[_0x26e9bc(0x1aa)](_0x3469c6[_0x26e9bc(0x21b)]),_0x38d516=yamlTextKnowledgeBaseToApi({'name':_0x3469c6[_0x26e9bc(0x21b)],'text':_0x3469c6[_0x26e9bc(0x16e)]},_0x52e65e);if(_0x3228a9)await this['client'][_0x26e9bc(0x1f9)](_0x3228a9['id'],_0x38d516),_0x7448c2[_0x26e9bc(0x207)](_0x3469c6[_0x26e9bc(0x21b)],_0x3228a9['id']),_0x4a8714['textKnowledgeBases'][_0x26e9bc(0x1cb)]({'name':_0x3469c6[_0x26e9bc(0x21b)],'action':_0x26e9bc(0x25e),'id':_0x3228a9['id']}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x180)][_0x26e9bc(0x25e)]++;else{const _0x14bebe=await this[_0x26e9bc(0x25c)][_0x26e9bc(0x211)](_0x38d516);_0x7448c2[_0x26e9bc(0x207)](_0x3469c6[_0x26e9bc(0x21b)],_0x14bebe['id']),_0x4a8714[_0x26e9bc(0x180)][_0x26e9bc(0x1cb)]({'name':_0x3469c6['name'],'action':_0x26e9bc(0x199),'id':_0x14bebe['id']}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x180)][_0x26e9bc(0x199)]++;}}catch(_0x1882c9){_0x4a8714['textKnowledgeBases'][_0x26e9bc(0x1cb)]({'name':_0x3469c6[_0x26e9bc(0x21b)],'action':_0x26e9bc(0x1e3),'error':_0x1882c9[_0x26e9bc(0x24b)]}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x180)][_0x26e9bc(0x18d)]++;}}for(const _0x1d13bd of _0x49ee51){try{const _0x46f2e6=_0x404b7d[_0x26e9bc(0x1aa)](_0x1d13bd[_0x26e9bc(0x1f3)][_0x26e9bc(0x21b)]),_0x48c6e3=yamlExperimentalKnowledgeBaseToApi(_0x1d13bd['def'],_0x52e65e);if(_0x46f2e6)await this[_0x26e9bc(0x25c)][_0x26e9bc(0x189)](_0x46f2e6['id'],_0x48c6e3),_0x204f33[_0x26e9bc(0x207)](_0x1d13bd['def'][_0x26e9bc(0x21b)],_0x46f2e6['id']),_0x4a8714[_0x26e9bc(0x19f)][_0x26e9bc(0x1cb)]({'name':_0x1d13bd[_0x26e9bc(0x1f3)][_0x26e9bc(0x21b)],'action':_0x26e9bc(0x25e),'id':_0x46f2e6['id']}),_0x4a8714[_0x26e9bc(0x16d)]['experimentalKnowledgeBases'][_0x26e9bc(0x25e)]++;else{const _0x2a4c89=await this[_0x26e9bc(0x25c)][_0x26e9bc(0x154)](_0x48c6e3);_0x204f33['set'](_0x1d13bd['def'][_0x26e9bc(0x21b)],_0x2a4c89['id']),_0x4a8714[_0x26e9bc(0x19f)][_0x26e9bc(0x1cb)]({'name':_0x1d13bd[_0x26e9bc(0x1f3)][_0x26e9bc(0x21b)],'action':_0x26e9bc(0x199),'id':_0x2a4c89['id']}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x19f)][_0x26e9bc(0x199)]++;}}catch(_0x41fbc1){_0x4a8714[_0x26e9bc(0x19f)][_0x26e9bc(0x1cb)]({'name':_0x1d13bd[_0x26e9bc(0x1f3)][_0x26e9bc(0x21b)],'action':_0x26e9bc(0x1e3),'error':_0x41fbc1[_0x26e9bc(0x24b)]}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x19f)][_0x26e9bc(0x18d)]++;}}for(const _0x257905 of _0x54fd81){try{const _0x445c3a=_0x412e7e[_0x26e9bc(0x1aa)](_0x257905[_0x26e9bc(0x1f3)][_0x26e9bc(0x21b)]),_0x37f6b1=yamlExperimentalArtifactToApi(_0x257905['def'],_0x52e65e);if(_0x445c3a)await this[_0x26e9bc(0x25c)][_0x26e9bc(0x1b8)](_0x445c3a['id'],_0x37f6b1),_0x348a5a[_0x26e9bc(0x207)](_0x257905[_0x26e9bc(0x1f3)][_0x26e9bc(0x21b)],_0x445c3a['id']),_0x4a8714['experimentalArtifacts'][_0x26e9bc(0x1cb)]({'name':_0x257905[_0x26e9bc(0x1f3)]['name'],'action':'updated','id':_0x445c3a['id']}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x1c6)][_0x26e9bc(0x25e)]++;else{const _0xeb2324=await this[_0x26e9bc(0x25c)]['createExperimentalArtifact'](_0x37f6b1);_0x348a5a[_0x26e9bc(0x207)](_0x257905[_0x26e9bc(0x1f3)][_0x26e9bc(0x21b)],_0xeb2324['id']),_0x4a8714['experimentalArtifacts'][_0x26e9bc(0x1cb)]({'name':_0x257905[_0x26e9bc(0x1f3)][_0x26e9bc(0x21b)],'action':_0x26e9bc(0x199),'id':_0xeb2324['id']}),_0x4a8714['counts']['experimentalArtifacts'][_0x26e9bc(0x199)]++;}}catch(_0x2bbbb7){_0x4a8714[_0x26e9bc(0x1c6)]['push']({'name':_0x257905['def'][_0x26e9bc(0x21b)],'action':'error','error':_0x2bbbb7[_0x26e9bc(0x24b)]}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x1c6)]['errors']++;}}for(const _0x1a6346 of _0x13f336){_0x3df83f=[];try{const _0x342b8a=_0x1bb535[_0x26e9bc(0x1aa)](_0x1a6346[_0x26e9bc(0x1e0)][_0x26e9bc(0x21b)]),_0x40123e=await agentDefToRequest(_0x1a6346[_0x26e9bc(0x1e0)],_0x1a6346[_0x26e9bc(0x1e5)],_0x1a6346[_0x26e9bc(0x171)],_0x55df8c);if(_0x342b8a)await this['client']['updateAgentResponse'](_0x342b8a['id'],_0x40123e),_0x5f3b76[_0x26e9bc(0x207)](_0x1a6346[_0x26e9bc(0x1e0)][_0x26e9bc(0x21b)],_0x342b8a['id']),_0x4a8714[_0x26e9bc(0x195)]['push']({'agentName':_0x1a6346[_0x26e9bc(0x1e0)][_0x26e9bc(0x21b)],'action':'updated','agentId':_0x342b8a['id'],'warnings':_0x3df83f[_0x26e9bc(0x235)]>0x0?_0x3df83f:undefined}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x195)][_0x26e9bc(0x25e)]++;else{const _0x1b9e0f=await this[_0x26e9bc(0x25c)][_0x26e9bc(0x175)](_0x40123e);_0x5f3b76['set'](_0x1a6346[_0x26e9bc(0x1e0)][_0x26e9bc(0x21b)],_0x1b9e0f['id']),_0x4a8714[_0x26e9bc(0x195)][_0x26e9bc(0x1cb)]({'agentName':_0x1a6346[_0x26e9bc(0x1e0)][_0x26e9bc(0x21b)],'action':_0x26e9bc(0x199),'agentId':_0x1b9e0f['id'],'warnings':_0x3df83f['length']>0x0?_0x3df83f:undefined}),_0x4a8714[_0x26e9bc(0x16d)]['agents']['created']++;}}catch(_0x5ad08f){_0x4a8714[_0x26e9bc(0x195)][_0x26e9bc(0x1cb)]({'agentName':_0x1a6346[_0x26e9bc(0x1e0)]['name'],'action':_0x26e9bc(0x1e3),'error':_0x5ad08f['message'],'warnings':_0x3df83f[_0x26e9bc(0x235)]>0x0?_0x3df83f:undefined}),_0x4a8714['counts'][_0x26e9bc(0x195)]['errors']++;}}for(const _0x236d6e of _0x21d35b){try{const _0x56cd3b=_0x4d84de[_0x26e9bc(0x1aa)](_0x236d6e[_0x26e9bc(0x1e0)]['name']),_0x3c4100=await yamlPromptToApi(_0x236d6e['yaml'],_0x52e65e,_0x55df8c);if(!_0x3c4100){_0x4a8714['prompts'][_0x26e9bc(0x1cb)]({'name':_0x236d6e[_0x26e9bc(0x1e0)]['name'],'action':_0x26e9bc(0x1e3),'error':_0x26e9bc(0x1d5)}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x164)][_0x26e9bc(0x18d)]++;continue;}if(_0x56cd3b)await this['client'][_0x26e9bc(0x19e)](_0x56cd3b['id'],_0x3c4100),_0x2e8b30[_0x26e9bc(0x207)](_0x236d6e['yaml'][_0x26e9bc(0x21b)],_0x56cd3b['id']),_0x4a8714['prompts'][_0x26e9bc(0x1cb)]({'name':_0x236d6e[_0x26e9bc(0x1e0)][_0x26e9bc(0x21b)],'action':'updated','id':_0x56cd3b['id']}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x164)][_0x26e9bc(0x25e)]++;else{const _0x58c2df=await this[_0x26e9bc(0x25c)][_0x26e9bc(0x1e2)](_0x3c4100);_0x2e8b30[_0x26e9bc(0x207)](_0x236d6e[_0x26e9bc(0x1e0)][_0x26e9bc(0x21b)],_0x58c2df['id']),_0x4a8714['prompts']['push']({'name':_0x236d6e[_0x26e9bc(0x1e0)]['name'],'action':_0x26e9bc(0x199),'id':_0x58c2df['id']}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x164)][_0x26e9bc(0x199)]++;}}catch(_0x448a68){_0x4a8714[_0x26e9bc(0x164)][_0x26e9bc(0x1cb)]({'name':_0x236d6e['yaml'][_0x26e9bc(0x21b)],'action':_0x26e9bc(0x1e3),'error':_0x448a68[_0x26e9bc(0x24b)]}),_0x4a8714['counts'][_0x26e9bc(0x164)][_0x26e9bc(0x18d)]++;}}for(const _0x5f249e of _0x4a101c){try{const _0x3ef55b=_0x30c759['get'](_0x5f249e[_0x26e9bc(0x1e0)][_0x26e9bc(0x21a)]),_0x841e1b=await yamlIntegrationToApi(_0x5f249e['yaml'],_0x52e65e,_0x55df8c);if(_0x3ef55b){await this['client'][_0x26e9bc(0x159)](_0x3ef55b['id']);const _0x37a9c6=await this[_0x26e9bc(0x25c)][_0x26e9bc(0x17a)](_0x841e1b);_0x4a8714[_0x26e9bc(0x1ae)][_0x26e9bc(0x1cb)]({'name':_0x5f249e['yaml'][_0x26e9bc(0x21a)],'action':'updated','id':_0x37a9c6['id']}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x1ae)][_0x26e9bc(0x25e)]++;}else{const _0x6dde4f=await this[_0x26e9bc(0x25c)][_0x26e9bc(0x17a)](_0x841e1b);_0x4a8714[_0x26e9bc(0x1ae)]['push']({'name':_0x5f249e[_0x26e9bc(0x1e0)][_0x26e9bc(0x21a)],'action':_0x26e9bc(0x199),'id':_0x6dde4f['id']}),_0x4a8714[_0x26e9bc(0x16d)][_0x26e9bc(0x1ae)][_0x26e9bc(0x199)]++;}}catch(_0x35fc9e){_0x4a8714['integrations']['push']({'name':_0x5f249e[_0x26e9bc(0x1e0)][_0x26e9bc(0x21a)],'action':'error','error':_0x35fc9e[_0x26e9bc(0x24b)]}),_0x4a8714[_0x26e9bc(0x16d)]['integrations']['errors']++;}}return _0x4a8714;}async[a133_0x552b25(0x258)](_0x1d55de,_0x593d98,_0x431a50,_0x36513a){const _0x29456a=a133_0x552b25,{projectId:_0x56154b,project:_0x2abbeb}=await this[_0x29456a(0x1fe)](_0x1d55de),_0x537475=_0x2abbeb[_0x29456a(0x156)][_0x29456a(0x21b)],_0x292c20=await this[_0x29456a(0x25c)][_0x29456a(0x1ee)](_0x56154b),_0x42b338=_0x292c20[_0x29456a(0x25f)](_0x38c68f=>_0x38c68f[_0x29456a(0x156)][_0x29456a(0x21b)]===_0x593d98);if(!_0x42b338)throw new SDKError(ErrorCode[_0x29456a(0x1be)],_0x29456a(0x247)+_0x593d98,undefined,{'helpText':_0x29456a(0x25a)+_0x292c20[_0x29456a(0x249)](_0x996741=>_0x996741['attributes']['name'])[_0x29456a(0x1d3)](',\x20')});let _0x33c84e;if(_0x431a50)_0x33c84e=_0x431a50;else{const _0x1034ec=a133_0x3ebff7[_0x29456a(0x1d3)](process[_0x29456a(0x20a)](),_0x29456a(0x195)),_0x1c48e9=getSanitizedPathWithMigration(_0x1034ec,_0x537475);_0x1c48e9[_0x29456a(0x1d2)]&&this['logger'][_0x29456a(0x1a4)](_0x29456a(0x1cd)+a133_0x3ebff7['basename'](_0x1c48e9['oldPath'])+_0x29456a(0x1a7)+a133_0x3ebff7[_0x29456a(0x16c)](_0x1c48e9[_0x29456a(0x1b4)])),_0x33c84e=_0x1c48e9[_0x29456a(0x1b4)];}const _0x4542b5=getSanitizedPathWithMigration(_0x33c84e,_0x593d98);_0x4542b5[_0x29456a(0x1d2)]&&this[_0x29456a(0x186)]['info']('Renamed\x20agent\x20folder:\x20'+a133_0x3ebff7['basename'](_0x4542b5[_0x29456a(0x1ad)])+_0x29456a(0x1a7)+a133_0x3ebff7[_0x29456a(0x16c)](_0x4542b5[_0x29456a(0x1b4)]));const _0x466bf4=_0x4542b5['path'],_0x4fba29=new Map(),_0x1d371d=new Map(),_0x240f9b=await this['client']['listKnowledgeBases'](_0x56154b),_0x176b13=await this[_0x29456a(0x25c)]['listTextKnowledgeBases'](_0x56154b),_0x2391f4=await safeListOrEmpty(()=>this[_0x29456a(0x25c)]['listExperimentalKnowledgeBases'](_0x56154b)),_0xdbda5d=new Map(),_0x4db662=new Map();for(const _0x1c3098 of _0x240f9b){_0x4fba29[_0x29456a(0x207)](_0x1c3098['id'],_0x1c3098[_0x29456a(0x156)][_0x29456a(0x21b)]);}for(const _0x50d4fa of _0x176b13){_0xdbda5d[_0x29456a(0x207)](_0x50d4fa['id'],_0x50d4fa[_0x29456a(0x156)][_0x29456a(0x21b)]);}for(const _0xc21730 of _0x2391f4){_0x4db662['set'](_0xc21730['id'],_0xc21730[_0x29456a(0x156)][_0x29456a(0x21b)]);}for(const _0x35e2d2 of _0x292c20){_0x1d371d[_0x29456a(0x207)](_0x35e2d2['id'],_0x35e2d2[_0x29456a(0x156)][_0x29456a(0x21b)]);}const _0x3b1351={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x4fba29,'TextKnowledgeBase':_0xdbda5d,'Agent':_0x1d371d,'ExperimentalKnowledgeBase':_0x4db662}),'resolvePromptName':async()=>undefined,'onWarning':_0x3f681d=>this[_0x29456a(0x186)]['warn'](_0x3f681d)},_0x16475c=a133_0x3ebff7[_0x29456a(0x1d3)](_0x466bf4,_0x29456a(0x250)),_0x55f933=a133_0x3ebff7[_0x29456a(0x1d3)](_0x466bf4,_0x29456a(0x1b2)),_0x185a95=a133_0x3ebff7[_0x29456a(0x1d3)](_0x466bf4,_0x29456a(0x230)),_0x8ba54f=!a133_0x4e6e65[_0x29456a(0x251)](_0x55f933);if(_0x36513a?.[_0x29456a(0x244)])return{'agentName':_0x593d98,'outputPath':_0x466bf4,'isNew':_0x8ba54f,'hasChanges':!![]};a133_0x4e6e65['mkdirSync'](_0x33c84e,{'recursive':!![]}),a133_0x4e6e65[_0x29456a(0x23a)](_0x466bf4,{'recursive':!![]});const _0x1e0143=a133_0x3ebff7[_0x29456a(0x1d3)](_0x33c84e,_0x29456a(0x196));!a133_0x4e6e65['existsSync'](_0x1e0143)&&a133_0x4e6e65[_0x29456a(0x1b0)](_0x1e0143,createAgentConfigContent(_0x1d55de));const {yaml:_0xb8c833,systemPrompt:_0x3ee204,starterMessage:_0x3cf6eb}=await agentResponseToDef(_0x42b338,_0x3b1351);let _0x30b20d=_0x8ba54f;if(!_0x8ba54f){const _0x978c84=a133_0x4e6e65[_0x29456a(0x251)](_0x16475c)?a133_0x4e6e65[_0x29456a(0x20d)](_0x16475c,_0x29456a(0x202)):'',_0x3955d5=a133_0x4e6e65['readFileSync'](_0x55f933,'utf-8');_0x30b20d=_0x978c84!==_0x3ee204||_0x3955d5!==toAgentYamlString(_0xb8c833);}a133_0x4e6e65[_0x29456a(0x1b0)](_0x16475c,_0x3ee204),a133_0x4e6e65['writeFileSync'](_0x55f933,toAgentYamlString(_0xb8c833));if(_0x3cf6eb&&_0x3cf6eb[_0x29456a(0x1f2)]('\x0a'))a133_0x4e6e65['writeFileSync'](_0x185a95,_0x3cf6eb);else a133_0x4e6e65[_0x29456a(0x251)](_0x185a95)&&a133_0x4e6e65[_0x29456a(0x167)](_0x185a95);return{'agentName':_0x593d98,'outputPath':_0x466bf4,'isNew':_0x8ba54f,'hasChanges':_0x30b20d};}async[a133_0x552b25(0x231)](_0x105e90,_0x37d175){const _0x866f40=a133_0x552b25;let _0x2de1fa;isAgentYamlPath(_0x105e90)?_0x2de1fa=getAgentDirFromYamlPath(_0x105e90):_0x2de1fa=_0x105e90;const {config:_0x16f9f5}=findAgentConfig(_0x2de1fa),_0xf7994a=await this[_0x866f40(0x16f)](_0x16f9f5['llm_project']),_0x1f0d74=a133_0x3ebff7['join'](_0x2de1fa,_0x866f40(0x1b2)),_0x2d861c=a133_0x3ebff7[_0x866f40(0x1d3)](_0x2de1fa,_0x866f40(0x250)),_0x2bf428=a133_0x3ebff7[_0x866f40(0x1d3)](_0x2de1fa,_0x866f40(0x230));if(!a133_0x4e6e65[_0x866f40(0x251)](_0x1f0d74))throw new SDKError(ErrorCode[_0x866f40(0x1b6)],'agent.yml\x20not\x20found\x20in\x20'+_0x2de1fa,undefined,{'helpText':'Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.'});const _0x552ccf=parseAgentYaml(a133_0x4e6e65[_0x866f40(0x20d)](_0x1f0d74,'utf-8'),_0x1f0d74),_0x4b4621=a133_0x4e6e65[_0x866f40(0x251)](_0x2d861c)?a133_0x4e6e65[_0x866f40(0x20d)](_0x2d861c,'utf-8'):'',_0x437257=a133_0x4e6e65[_0x866f40(0x251)](_0x2bf428)?a133_0x4e6e65[_0x866f40(0x20d)](_0x2bf428,'utf-8'):_0x552ccf['starter_message'];if(_0x37d175?.[_0x866f40(0x244)])return{'agentName':_0x552ccf['name'],'action':_0x866f40(0x199),'projectId':_0xf7994a};const _0x358f5e=await this['client']['listAgentsFull'](_0xf7994a),_0x3c0d49=await fetchAllToolTargetMaps((_0xceada9,_0x3336d8)=>this['client'][_0x866f40(0x1fd)](_0xceada9,_0x3336d8),_0xf7994a),_0x11c241=new Map();for(const _0x2f2be2 of _0x358f5e){_0x11c241[_0x866f40(0x207)](_0x2f2be2[_0x866f40(0x156)][_0x866f40(0x21b)],_0x2f2be2['id']);}const _0x50da06=[],_0x3d8bcf={'projectId':_0xf7994a,'resolveToolTargetId':buildIdResolver({..._0x3c0d49[_0x866f40(0x1c2)],'Agent':_0x11c241}),'resolvePromptId':async()=>undefined,'onWarning':_0x2ac4ac=>{const _0x3bce45=_0x866f40;this[_0x3bce45(0x186)]['warn'](_0x2ac4ac),_0x50da06['push'](_0x2ac4ac);}};try{const _0x59a735=_0x358f5e[_0x866f40(0x25f)](_0x274b36=>_0x274b36['attributes'][_0x866f40(0x21b)]===_0x552ccf[_0x866f40(0x21b)]),_0x4b57c1=await agentDefToRequest(_0x552ccf,_0x4b4621,_0x437257,_0x3d8bcf);if(_0x59a735)return await this[_0x866f40(0x25c)][_0x866f40(0x24c)](_0x59a735['id'],_0x4b57c1),{'agentName':_0x552ccf[_0x866f40(0x21b)],'action':_0x866f40(0x25e),'projectId':_0xf7994a,'agentId':_0x59a735['id'],'warnings':_0x50da06['length']>0x0?_0x50da06:undefined};else{const _0x28ae6a=await this['client']['createAgentResponse'](_0x4b57c1);return{'agentName':_0x552ccf[_0x866f40(0x21b)],'action':_0x866f40(0x199),'projectId':_0xf7994a,'agentId':_0x28ae6a['id'],'warnings':_0x50da06[_0x866f40(0x235)]>0x0?_0x50da06:undefined};}}catch(_0x27820a){return{'agentName':_0x552ccf[_0x866f40(0x21b)],'action':_0x866f40(0x1e3),'projectId':_0xf7994a,'error':_0x27820a[_0x866f40(0x24b)],'warnings':_0x50da06[_0x866f40(0x235)]>0x0?_0x50da06:undefined};}}async['cloneProject'](_0x4a1341,_0x1dfcbd,_0x1c882d){const _0x371a86=a133_0x552b25,_0x43b364=a133_0x4e6e65[_0x371a86(0x251)](_0x4a1341)&&a133_0x4e6e65['existsSync'](a133_0x3ebff7[_0x371a86(0x1d3)](_0x4a1341,_0x371a86(0x196)));let _0xb5daa;const _0x58dd8e=[],_0x5f52f8=[],_0x148393=[],_0x49c340=[],_0x41a333=[],_0x2af0a1=[],_0x2f552f=[];if(_0x43b364){const _0xe2bb21=loadAgentConfig(a133_0x3ebff7[_0x371a86(0x1d3)](_0x4a1341,'tdx.json'));_0xb5daa=_0xe2bb21['llm_project'];const _0x924f20=a133_0x4e6e65['readdirSync'](_0x4a1341,{'withFileTypes':!![]});for(const _0x43a586 of _0x924f20){if(!_0x43a586[_0x371a86(0x1f4)]())continue;if([_0x371a86(0x1df),_0x371a86(0x210),'experimental_artifacts','prompts',_0x371a86(0x1ae)][_0x371a86(0x1f2)](_0x43a586[_0x371a86(0x21b)]))continue;const _0x3003c2=a133_0x3ebff7[_0x371a86(0x1d3)](_0x4a1341,_0x43a586[_0x371a86(0x21b)]);if(isAgentDir(_0x3003c2)){const _0x536100=a133_0x3ebff7[_0x371a86(0x1d3)](_0x3003c2,_0x371a86(0x1b2)),_0x41fd4e=a133_0x3ebff7[_0x371a86(0x1d3)](_0x3003c2,_0x371a86(0x250)),_0x4b7c8f=a133_0x3ebff7[_0x371a86(0x1d3)](_0x3003c2,'starter_message.md'),_0x4ba2bb=parseAgentYaml(a133_0x4e6e65[_0x371a86(0x20d)](_0x536100,'utf-8'),_0x536100),_0x4cffe5=a133_0x4e6e65[_0x371a86(0x251)](_0x41fd4e)?a133_0x4e6e65[_0x371a86(0x20d)](_0x41fd4e,'utf-8'):'',_0x3cc369=a133_0x4e6e65[_0x371a86(0x251)](_0x4b7c8f)?a133_0x4e6e65[_0x371a86(0x20d)](_0x4b7c8f,'utf-8'):_0x4ba2bb[_0x371a86(0x232)];_0x58dd8e['push']({'name':_0x4ba2bb[_0x371a86(0x21b)],'dir':_0x3003c2,'yaml':_0x4ba2bb,'systemPrompt':_0x4cffe5,'starterMessage':_0x3cc369});}}const _0x34559e=getKnowledgeBasesDir(_0x4a1341);if(a133_0x4e6e65[_0x371a86(0x251)](_0x34559e)){const _0x36ac7c=a133_0x4e6e65['readdirSync'](_0x34559e);for(const _0x5afa85 of _0x36ac7c){const _0x263535=a133_0x3ebff7[_0x371a86(0x1d3)](_0x34559e,_0x5afa85);if(_0x5afa85[_0x371a86(0x1fa)]('.yml')){const _0x3d1b96=parseKnowledgeBaseYaml(a133_0x4e6e65['readFileSync'](_0x263535,_0x371a86(0x202)),_0x263535);_0x5f52f8['push']({'name':_0x3d1b96['name'],'path':_0x263535,'yaml':_0x3d1b96});}else{if(_0x5afa85[_0x371a86(0x1fa)]('.md')){const _0x35e853=a133_0x4e6e65['readFileSync'](_0x263535,_0x371a86(0x202)),{name:_0x3ef6da,text:_0x558a7c}=parseTextKnowledgeBaseMd(_0x35e853,_0x5afa85);_0x148393[_0x371a86(0x1cb)]({'name':_0x3ef6da,'path':_0x263535,'text':_0x558a7c});}}}}const _0x64fdb9=getPromptsDir(_0x4a1341);if(a133_0x4e6e65[_0x371a86(0x251)](_0x64fdb9)){const _0x287571=a133_0x4e6e65[_0x371a86(0x21c)](_0x64fdb9)[_0x371a86(0x1e4)](_0x4b95b6=>_0x4b95b6[_0x371a86(0x1fa)](_0x371a86(0x169)));for(const _0x23e6f7 of _0x287571){const _0x5ee6d1=a133_0x3ebff7[_0x371a86(0x1d3)](_0x64fdb9,_0x23e6f7),_0x20f3b9=parsePromptYaml(a133_0x4e6e65[_0x371a86(0x20d)](_0x5ee6d1,_0x371a86(0x202)),_0x5ee6d1);_0x49c340['push']({'name':_0x20f3b9['name'],'path':_0x5ee6d1,'yaml':_0x20f3b9});}}const _0x44a3ca=getIntegrationsDir(_0x4a1341);if(a133_0x4e6e65[_0x371a86(0x251)](_0x44a3ca)){const _0x1b9703=a133_0x4e6e65[_0x371a86(0x21c)](_0x44a3ca)[_0x371a86(0x1e4)](_0x57cf17=>_0x57cf17[_0x371a86(0x1fa)]('.yml'));for(const _0x282a79 of _0x1b9703){const _0x52c3b5=a133_0x3ebff7[_0x371a86(0x1d3)](_0x44a3ca,_0x282a79),_0x97848d=parseIntegrationYaml(a133_0x4e6e65[_0x371a86(0x20d)](_0x52c3b5,_0x371a86(0x202)),_0x52c3b5);SAFE_INTEGRATION_TYPES['includes'](_0x97848d[_0x371a86(0x21a)][_0x371a86(0x14e)]())?_0x41a333[_0x371a86(0x1cb)]({'name':_0x97848d[_0x371a86(0x21b)],'path':_0x52c3b5,'yaml':_0x97848d}):this[_0x371a86(0x186)][_0x371a86(0x1a0)](_0x371a86(0x245)+_0x97848d['name']+_0x371a86(0x20c)+_0x97848d['service_type']+_0x371a86(0x219)+(_0x371a86(0x23c)+SAFE_INTEGRATION_TYPES[_0x371a86(0x1d3)](',\x20')+_0x371a86(0x1fc)));}}const _0x2b11e6=getExperimentalKnowledgeBasesDir(_0x4a1341);if(a133_0x4e6e65['existsSync'](_0x2b11e6)){const _0x2ca4d0=a133_0x4e6e65[_0x371a86(0x21c)](_0x2b11e6,{'withFileTypes':!![]});for(const _0x14425e of _0x2ca4d0){if(!_0x14425e[_0x371a86(0x1f4)]())continue;const _0x537002=a133_0x3ebff7['join'](_0x2b11e6,_0x14425e['name']),_0x2f897a=a133_0x3ebff7['join'](_0x537002,_0x14425e[_0x371a86(0x21b)]+_0x371a86(0x169));if(a133_0x4e6e65['existsSync'](_0x2f897a)){const _0x39af9f=parseExperimentalKnowledgeBaseYaml(a133_0x4e6e65[_0x371a86(0x20d)](_0x2f897a,_0x371a86(0x202)),_0x2f897a),_0x2f3c20=a133_0x3ebff7[_0x371a86(0x1d3)](_0x537002,_0x371a86(0x176)),_0x5b794d=[];if(a133_0x4e6e65[_0x371a86(0x251)](_0x2f3c20)){const _0x438642=a133_0x4e6e65[_0x371a86(0x21c)](_0x2f3c20,{'withFileTypes':!![]});for(const _0x2d341e of _0x438642){if(!_0x2d341e[_0x371a86(0x1f4)]())continue;const _0x1d97d2=a133_0x3ebff7[_0x371a86(0x1d3)](_0x2f3c20,_0x2d341e['name']),_0x1732b1=a133_0x3ebff7[_0x371a86(0x1d3)](_0x1d97d2,_0x371a86(0x1a3)),_0x5b31f7=a133_0x3ebff7[_0x371a86(0x1d3)](_0x1d97d2,_0x371a86(0x213));if(a133_0x4e6e65[_0x371a86(0x251)](_0x1732b1)&&a133_0x4e6e65[_0x371a86(0x251)](_0x5b31f7)){const _0x4a7263=a133_0x4e6e65[_0x371a86(0x20d)](_0x1732b1,_0x371a86(0x202)),_0x23d2b7=a133_0x4e6e65[_0x371a86(0x20d)](_0x5b31f7,_0x371a86(0x202));_0x5b794d[_0x371a86(0x1cb)]({'name':_0x2d341e[_0x371a86(0x21b)],'code':_0x4a7263,'json_schema':_0x23d2b7});}}}const _0x88559f={..._0x39af9f,'functions':_0x5b794d};_0x2af0a1[_0x371a86(0x1cb)]({'name':_0x39af9f[_0x371a86(0x21b)],'path':_0x537002,'def':_0x88559f});}}}const _0x4a4c2f=getExperimentalArtifactsDir(_0x4a1341);if(a133_0x4e6e65[_0x371a86(0x251)](_0x4a4c2f)){const _0x43ef07=a133_0x4e6e65[_0x371a86(0x21c)](_0x4a4c2f,{'withFileTypes':!![]});for(const _0xd44553 of _0x43ef07){if(!_0xd44553['isDirectory']())continue;const _0x4b6f19=a133_0x3ebff7[_0x371a86(0x1d3)](_0x4a4c2f,_0xd44553[_0x371a86(0x21b)]),_0x4b1f77=a133_0x3ebff7['join'](_0x4b6f19,_0xd44553['name']+_0x371a86(0x169));if(a133_0x4e6e65[_0x371a86(0x251)](_0x4b1f77)){const _0xa305ff=parseExperimentalArtifactYaml(a133_0x4e6e65[_0x371a86(0x20d)](_0x4b1f77,_0x371a86(0x202)),_0x4b1f77),_0x3e349f=a133_0x3ebff7[_0x371a86(0x1d3)](_0x4b6f19,_0x371a86(0x1a3)),_0xf922d4=a133_0x4e6e65[_0x371a86(0x251)](_0x3e349f)?a133_0x4e6e65['readFileSync'](_0x3e349f,_0x371a86(0x202)):'',_0x34ab06=a133_0x3ebff7[_0x371a86(0x1d3)](_0x4b6f19,_0x371a86(0x1ec)),_0x2e0179=[];if(a133_0x4e6e65[_0x371a86(0x251)](_0x34ab06)){const _0x644a47=a133_0x4e6e65['readdirSync'](_0x34ab06);for(const _0x3cb32b of _0x644a47){const _0x4fcb03=a133_0x3ebff7[_0x371a86(0x1d3)](_0x34ab06,_0x3cb32b);if(a133_0x4e6e65['statSync'](_0x4fcb03)[_0x371a86(0x162)]()){const _0x3271c3=a133_0x4e6e65[_0x371a86(0x20d)](_0x4fcb03,_0x371a86(0x202));_0x2e0179[_0x371a86(0x1cb)]({'file_name':_0x3cb32b,'text_content':_0x3271c3});}}}const _0x477c39={..._0xa305ff,'code':_0xf922d4,'files':_0x2e0179};_0x2f552f[_0x371a86(0x1cb)]({'name':_0xa305ff[_0x371a86(0x21b)],'path':_0x4b6f19,'def':_0x477c39});}}}}else{const _0x19cb58=await this['resolveProjectId'](_0x4a1341),_0x50cd77=await this[_0x371a86(0x25c)][_0x371a86(0x223)](_0x19cb58);_0xb5daa=_0x50cd77[_0x371a86(0x156)][_0x371a86(0x21b)];const _0x4c204d=await this['client'][_0x371a86(0x1ee)](_0x19cb58),_0x161baf=await this[_0x371a86(0x25c)][_0x371a86(0x20b)](_0x19cb58),_0x5957d8=await this['client'][_0x371a86(0x1bf)](_0x19cb58),_0x3725c8=await this[_0x371a86(0x25c)]['listPrompts'](_0x19cb58),_0x4a72e2=await this[_0x371a86(0x25c)][_0x371a86(0x1cf)](_0x19cb58),_0x25dc2f=await safeListOrEmpty(()=>this['client'][_0x371a86(0x17f)](_0x19cb58)),_0x3077c6=await safeListOrEmpty(()=>this[_0x371a86(0x25c)][_0x371a86(0x152)](_0x19cb58)),_0x1fa1b5=new Map(),_0xc8c708=new Map(),_0x33c34a=new Map(),_0x559f02=new Map(),_0x15bf0f=new Map(),_0x9c9061=new Map();for(const _0x269feb of _0x161baf){_0x1fa1b5[_0x371a86(0x207)](_0x269feb['id'],_0x269feb[_0x371a86(0x156)][_0x371a86(0x21b)]);}for(const _0x56b28b of _0x5957d8){_0xc8c708[_0x371a86(0x207)](_0x56b28b['id'],_0x56b28b[_0x371a86(0x156)][_0x371a86(0x21b)]);}for(const _0x14a574 of _0x4c204d){_0x33c34a[_0x371a86(0x207)](_0x14a574['id'],_0x14a574[_0x371a86(0x156)][_0x371a86(0x21b)]);}for(const _0x2d6466 of _0x3725c8){_0x559f02[_0x371a86(0x207)](_0x2d6466['id'],_0x2d6466['attributes'][_0x371a86(0x21b)]);}for(const _0x23ec2d of _0x25dc2f){_0x15bf0f[_0x371a86(0x207)](_0x23ec2d['id'],_0x23ec2d[_0x371a86(0x156)][_0x371a86(0x21b)]);}for(const _0x12d83e of _0x3077c6){_0x9c9061[_0x371a86(0x207)](_0x12d83e['id'],_0x12d83e[_0x371a86(0x156)]['name']);}const _0x3a3eab={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x1fa1b5,'TextKnowledgeBase':_0xc8c708,'Agent':_0x33c34a,'ExperimentalKnowledgeBase':_0x15bf0f}),'resolvePromptName':async _0x4ebe02=>_0x559f02[_0x371a86(0x1aa)](_0x4ebe02),'onWarning':_0x2a29df=>this[_0x371a86(0x186)][_0x371a86(0x1a0)](_0x2a29df)};for(const _0x3d0cde of _0x4c204d){const _0x566bdd=await agentResponseToDef(_0x3d0cde,_0x3a3eab),{yaml:_0x5388d4,systemPrompt:_0x749862,starterMessage:_0x58ea5f}=_0x566bdd;_0x58dd8e[_0x371a86(0x1cb)]({'name':_0x5388d4[_0x371a86(0x21b)],'dir':'','yaml':_0x5388d4,'systemPrompt':_0x749862,'starterMessage':_0x58ea5f});}for(const _0x3d0e85 of _0x161baf){const _0x446e4a=apiKnowledgeBaseToYaml(_0x3d0e85);_0x5f52f8[_0x371a86(0x1cb)]({'name':_0x446e4a[_0x371a86(0x21b)],'path':'','yaml':_0x446e4a});}for(const _0x3dc4ee of _0x5957d8){_0x148393[_0x371a86(0x1cb)]({'name':_0x3dc4ee['attributes'][_0x371a86(0x21b)],'path':'','text':_0x3dc4ee[_0x371a86(0x156)][_0x371a86(0x16e)]});}for(const _0x2edce8 of _0x3725c8){const _0x245d8e=await apiPromptToYaml(_0x2edce8,_0x3a3eab);_0x245d8e&&_0x49c340[_0x371a86(0x1cb)]({'name':_0x245d8e[_0x371a86(0x21b)],'path':'','yaml':_0x245d8e});}for(const _0x7e8b0e of _0x4a72e2){if(!_0x7e8b0e[_0x371a86(0x156)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x371a86(0x1f2)](_0x7e8b0e['attributes'][_0x371a86(0x1e6)][_0x371a86(0x14e)]())){const _0x21dd44=await apiIntegrationToYaml(_0x7e8b0e,_0x3a3eab);_0x41a333[_0x371a86(0x1cb)]({'name':_0x7e8b0e[_0x371a86(0x156)][_0x371a86(0x1e6)][_0x371a86(0x14e)](),'path':'','yaml':_0x21dd44});}}for(const _0x52ad13 of _0x25dc2f){const _0x4d5078=apiExperimentalKnowledgeBaseToYaml(_0x52ad13);_0x2af0a1[_0x371a86(0x1cb)]({'name':_0x4d5078[_0x371a86(0x21b)],'path':'','def':_0x4d5078});}for(const _0x47d50d of _0x3077c6){const _0x20f50c=apiExperimentalArtifactToYaml(_0x47d50d);_0x2f552f[_0x371a86(0x1cb)]({'name':_0x20f50c[_0x371a86(0x21b)],'path':'','def':_0x20f50c});}}const _0x397323={'sourceProjectName':_0xb5daa,'newProjectName':_0x1dfcbd,'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}}},_0x573017=await this[_0x371a86(0x25c)][_0x371a86(0x1b1)](),_0x2ea099=_0x573017[_0x371a86(0x25f)](_0x58e42f=>_0x58e42f[_0x371a86(0x156)][_0x371a86(0x21b)]===_0x1dfcbd);if(_0x2ea099)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x371a86(0x14c)+_0x1dfcbd+_0x371a86(0x24a),undefined,{'helpText':_0x371a86(0x204)});if(_0x1c882d?.[_0x371a86(0x244)])return _0x397323[_0x371a86(0x16d)][_0x371a86(0x195)][_0x371a86(0x199)]=_0x58dd8e[_0x371a86(0x235)],_0x397323[_0x371a86(0x16d)][_0x371a86(0x18f)]['created']=_0x5f52f8[_0x371a86(0x235)],_0x397323[_0x371a86(0x16d)][_0x371a86(0x180)]['created']=_0x148393[_0x371a86(0x235)],_0x397323['counts']['experimentalKnowledgeBases'][_0x371a86(0x199)]=_0x2af0a1[_0x371a86(0x235)],_0x397323[_0x371a86(0x16d)]['experimentalArtifacts'][_0x371a86(0x199)]=_0x2f552f[_0x371a86(0x235)],_0x397323[_0x371a86(0x16d)][_0x371a86(0x164)][_0x371a86(0x199)]=_0x49c340[_0x371a86(0x235)],_0x397323[_0x371a86(0x16d)][_0x371a86(0x1ae)][_0x371a86(0x199)]=_0x41a333['length'],_0x397323;const _0x260856=await this['client'][_0x371a86(0x220)]({'name':_0x1dfcbd}),_0x523431=_0x260856['id'];_0x397323[_0x371a86(0x1a8)]=_0x523431;const _0x3641a7=new Map(),_0x34b801=new Map(),_0x12e226=new Map(),_0x36d83d=new Map(),_0x214587=new Map(),_0x3f5c83=new Map(),_0x335329=new Map(),_0x327f8f=new Map(),_0x311e6d=new Set(),_0x3b3e42=new Set();for(const _0x336ec6 of _0x58dd8e){for(const _0x1ef2fc of _0x336ec6[_0x371a86(0x1e0)][_0x371a86(0x225)]||[]){if(_0x1ef2fc[_0x371a86(0x1eb)]===_0x371a86(0x237)&&_0x1ef2fc[_0x371a86(0x151)]){const _0x4023c5=parseRef(_0x1ef2fc[_0x371a86(0x151)]);if(_0x4023c5)_0x311e6d[_0x371a86(0x1c8)](_0x4023c5[_0x371a86(0x21b)]);}else{if(_0x1ef2fc[_0x371a86(0x1eb)]==='web_search'&&_0x1ef2fc[_0x371a86(0x151)]){const _0x76ab55=parseRef(_0x1ef2fc[_0x371a86(0x151)]);if(_0x76ab55)_0x3b3e42[_0x371a86(0x1c8)](_0x76ab55[_0x371a86(0x21b)]);}}}}for(const _0x45a505 of _0x311e6d){try{const _0x258ce4=await this['client']['createImageGenerator']({'projectId':_0x523431,'name':_0x45a505});_0x214587[_0x371a86(0x207)](_0x45a505,_0x258ce4['id']),_0x397323['imageGenerators']['push']({'name':_0x45a505,'action':'created','id':_0x258ce4['id']}),_0x397323[_0x371a86(0x16d)][_0x371a86(0x14f)]['created']++;}catch(_0x2e4a36){_0x397323['imageGenerators']['push']({'name':_0x45a505,'action':_0x371a86(0x1e3),'error':_0x2e4a36[_0x371a86(0x24b)]}),_0x397323[_0x371a86(0x16d)][_0x371a86(0x14f)][_0x371a86(0x18d)]++;}}for(const _0x1e4f7b of _0x3b3e42){try{const _0x57551c=await this[_0x371a86(0x25c)]['createWebSearchTool']({'projectId':_0x523431,'name':_0x1e4f7b});_0x3f5c83[_0x371a86(0x207)](_0x1e4f7b,_0x57551c['id']),_0x397323['webSearchTools'][_0x371a86(0x1cb)]({'name':_0x1e4f7b,'action':'created','id':_0x57551c['id']}),_0x397323[_0x371a86(0x16d)][_0x371a86(0x243)]['created']++;}catch(_0x2fc5ba){_0x397323[_0x371a86(0x243)][_0x371a86(0x1cb)]({'name':_0x1e4f7b,'action':'error','error':_0x2fc5ba['message']}),_0x397323[_0x371a86(0x16d)]['webSearchTools'][_0x371a86(0x18d)]++;}}const _0x5b233e=await fetchAllToolTargetMaps((_0x5f02d5,_0x340219)=>this['client'][_0x371a86(0x1fd)](_0x5f02d5,_0x340219),_0x523431);let _0x1b8f8e=[];const _0xaf25da={'projectId':_0x523431,'resolveToolTargetId':buildIdResolver({..._0x5b233e[_0x371a86(0x1c2)],'KnowledgeBase':_0x3641a7,'TextKnowledgeBase':_0x34b801,'ExperimentalKnowledgeBase':_0x335329,'Agent':_0x12e226,'WebSearchTool':_0x3f5c83,'ImageGenerator':_0x214587}),'resolvePromptId':async _0x542244=>_0x36d83d['get'](_0x542244),'onWarning':_0x39157a=>{const _0x430f7f=_0x371a86;this[_0x430f7f(0x186)][_0x430f7f(0x1a0)](_0x39157a),_0x1b8f8e[_0x430f7f(0x1cb)](_0x39157a);}};for(const _0x28e0c5 of _0x5f52f8){try{const _0x351a5f=yamlKnowledgeBaseToApi(_0x28e0c5[_0x371a86(0x1e0)],_0x523431),_0x4f15f7=await this[_0x371a86(0x25c)][_0x371a86(0x218)](_0x351a5f);_0x3641a7[_0x371a86(0x207)](_0x28e0c5[_0x371a86(0x1e0)][_0x371a86(0x21b)],_0x4f15f7['id']),_0x397323[_0x371a86(0x18f)][_0x371a86(0x1cb)]({'name':_0x28e0c5[_0x371a86(0x1e0)][_0x371a86(0x21b)],'action':_0x371a86(0x199),'id':_0x4f15f7['id']}),_0x397323['counts'][_0x371a86(0x18f)][_0x371a86(0x199)]++;}catch(_0x36b610){_0x397323['knowledgeBases'][_0x371a86(0x1cb)]({'name':_0x28e0c5[_0x371a86(0x1e0)][_0x371a86(0x21b)],'action':_0x371a86(0x1e3),'error':_0x36b610['message']}),_0x397323['counts'][_0x371a86(0x18f)][_0x371a86(0x18d)]++;}}for(const _0x164c9f of _0x148393){try{const _0xe5f9c4=yamlTextKnowledgeBaseToApi({'name':_0x164c9f[_0x371a86(0x21b)],'text':_0x164c9f[_0x371a86(0x16e)]},_0x523431),_0x400279=await this[_0x371a86(0x25c)]['createTextKnowledgeBase'](_0xe5f9c4);_0x34b801[_0x371a86(0x207)](_0x164c9f[_0x371a86(0x21b)],_0x400279['id']),_0x397323[_0x371a86(0x180)][_0x371a86(0x1cb)]({'name':_0x164c9f[_0x371a86(0x21b)],'action':_0x371a86(0x199),'id':_0x400279['id']}),_0x397323[_0x371a86(0x16d)][_0x371a86(0x180)]['created']++;}catch(_0x23c961){_0x397323[_0x371a86(0x180)][_0x371a86(0x1cb)]({'name':_0x164c9f[_0x371a86(0x21b)],'action':_0x371a86(0x1e3),'error':_0x23c961[_0x371a86(0x24b)]}),_0x397323['counts'][_0x371a86(0x180)][_0x371a86(0x18d)]++;}}for(const _0x13af32 of _0x2f552f){try{const _0x418525=yamlExperimentalArtifactToApi(_0x13af32[_0x371a86(0x1f3)],_0x523431),_0x47b8ca=await this[_0x371a86(0x25c)]['createExperimentalArtifact'](_0x418525);_0x327f8f['set'](_0x13af32[_0x371a86(0x1f3)][_0x371a86(0x21b)],_0x47b8ca['id']),_0x397323[_0x371a86(0x1c6)][_0x371a86(0x1cb)]({'name':_0x13af32[_0x371a86(0x1f3)][_0x371a86(0x21b)],'action':'created','id':_0x47b8ca['id']}),_0x397323[_0x371a86(0x16d)]['experimentalArtifacts'][_0x371a86(0x199)]++;}catch(_0xf84cb){_0x397323[_0x371a86(0x1c6)]['push']({'name':_0x13af32[_0x371a86(0x1f3)]['name'],'action':'error','error':_0xf84cb[_0x371a86(0x24b)]}),_0x397323[_0x371a86(0x16d)][_0x371a86(0x1c6)][_0x371a86(0x18d)]++;}}for(const _0x19e293 of _0x2af0a1){try{const _0x5b0ec=yamlExperimentalKnowledgeBaseToApi(_0x19e293['def'],_0x523431),_0x1458d1=await this[_0x371a86(0x25c)]['createExperimentalKnowledgeBase'](_0x5b0ec);_0x335329[_0x371a86(0x207)](_0x19e293['def'][_0x371a86(0x21b)],_0x1458d1['id']),_0x397323[_0x371a86(0x19f)][_0x371a86(0x1cb)]({'name':_0x19e293['def'][_0x371a86(0x21b)],'action':_0x371a86(0x199),'id':_0x1458d1['id']}),_0x397323[_0x371a86(0x16d)][_0x371a86(0x19f)][_0x371a86(0x199)]++;}catch(_0x42fb00){_0x397323[_0x371a86(0x19f)][_0x371a86(0x1cb)]({'name':_0x19e293[_0x371a86(0x1f3)][_0x371a86(0x21b)],'action':'error','error':_0x42fb00[_0x371a86(0x24b)]}),_0x397323[_0x371a86(0x16d)][_0x371a86(0x19f)][_0x371a86(0x18d)]++;}}const _0x295fff=[..._0x58dd8e]['sort']((_0x4c635d,_0x2b1a77)=>{const _0x1c834a=_0x371a86,_0x138c8b=_0x4c635d['yaml']['tools']?.[_0x1c834a(0x166)](_0xc0ef57=>_0xc0ef57[_0x1c834a(0x1eb)]===_0x1c834a(0x1d7))??![],_0x33f43b=_0x2b1a77[_0x1c834a(0x1e0)]['tools']?.[_0x1c834a(0x166)](_0x3b21eb=>_0x3b21eb[_0x1c834a(0x1eb)]===_0x1c834a(0x1d7))??![];if(_0x138c8b&&!_0x33f43b)return 0x1;if(!_0x138c8b&&_0x33f43b)return-0x1;return 0x0;});for(const _0x1afaee of _0x295fff){_0x1b8f8e=[];try{const _0x355a69=_0x1afaee[_0x371a86(0x1e0)]['tools']?.[_0x371a86(0x1e4)](_0x646485=>{const _0x1c53f8=_0x371a86;if(_0x646485[_0x1c53f8(0x1eb)]==='agent'&&_0x646485[_0x1c53f8(0x151)]){const _0x35f292=parseRef(_0x646485[_0x1c53f8(0x151)]);return _0x35f292?.[_0x1c53f8(0x21b)]===_0x1afaee[_0x1c53f8(0x1e0)]['name'];}return![];})??[];if(_0x355a69[_0x371a86(0x235)]>0x0){const _0x3b1c02='Agent\x20\x27'+_0x1afaee['yaml']['name']+_0x371a86(0x198)+_0x371a86(0x1ac);this[_0x371a86(0x186)][_0x371a86(0x1a0)](_0x3b1c02),_0x1b8f8e[_0x371a86(0x1cb)](_0x3b1c02);}const _0x4d074f=await agentDefToRequest(_0x1afaee[_0x371a86(0x1e0)],_0x1afaee[_0x371a86(0x1e5)],_0x1afaee['starterMessage'],_0xaf25da),_0x360dff=await this[_0x371a86(0x25c)][_0x371a86(0x175)](_0x4d074f);_0x12e226[_0x371a86(0x207)](_0x1afaee[_0x371a86(0x1e0)][_0x371a86(0x21b)],_0x360dff['id']),_0x397323[_0x371a86(0x195)][_0x371a86(0x1cb)]({'agentName':_0x1afaee['yaml']['name'],'action':_0x371a86(0x199),'agentId':_0x360dff['id'],'warnings':_0x1b8f8e[_0x371a86(0x235)]>0x0?_0x1b8f8e:undefined}),_0x397323[_0x371a86(0x16d)][_0x371a86(0x195)][_0x371a86(0x199)]++;}catch(_0x3a1bcb){_0x397323[_0x371a86(0x195)][_0x371a86(0x1cb)]({'agentName':_0x1afaee['yaml'][_0x371a86(0x21b)],'action':'error','error':_0x3a1bcb[_0x371a86(0x24b)],'warnings':_0x1b8f8e[_0x371a86(0x235)]>0x0?_0x1b8f8e:undefined}),_0x397323[_0x371a86(0x16d)]['agents'][_0x371a86(0x18d)]++;}}for(const _0x533647 of _0x49c340){try{const _0x4bea05=await yamlPromptToApi(_0x533647[_0x371a86(0x1e0)],_0x523431,_0xaf25da);if(!_0x4bea05){_0x397323[_0x371a86(0x164)][_0x371a86(0x1cb)]({'name':_0x533647['yaml']['name'],'action':'error','error':_0x371a86(0x1d5)}),_0x397323[_0x371a86(0x16d)][_0x371a86(0x164)][_0x371a86(0x18d)]++;continue;}const _0x238a93=await this['client'][_0x371a86(0x1e2)](_0x4bea05);_0x36d83d[_0x371a86(0x207)](_0x533647[_0x371a86(0x1e0)][_0x371a86(0x21b)],_0x238a93['id']),_0x397323[_0x371a86(0x164)]['push']({'name':_0x533647[_0x371a86(0x1e0)][_0x371a86(0x21b)],'action':_0x371a86(0x199),'id':_0x238a93['id']}),_0x397323[_0x371a86(0x16d)]['prompts']['created']++;}catch(_0x418b5b){_0x397323[_0x371a86(0x164)][_0x371a86(0x1cb)]({'name':_0x533647[_0x371a86(0x1e0)][_0x371a86(0x21b)],'action':_0x371a86(0x1e3),'error':_0x418b5b[_0x371a86(0x24b)]}),_0x397323[_0x371a86(0x16d)]['prompts'][_0x371a86(0x18d)]++;}}for(const _0x18b95f of _0x41a333){try{const _0x4ac72a=await yamlIntegrationToApi(_0x18b95f[_0x371a86(0x1e0)],_0x523431,_0xaf25da),_0x3b0ddc=await this[_0x371a86(0x25c)]['createIntegration'](_0x4ac72a);_0x397323[_0x371a86(0x1ae)][_0x371a86(0x1cb)]({'name':_0x18b95f[_0x371a86(0x1e0)][_0x371a86(0x21a)],'action':_0x371a86(0x199),'id':_0x3b0ddc['id']}),_0x397323['counts'][_0x371a86(0x1ae)][_0x371a86(0x199)]++;}catch(_0x14fcb0){_0x397323[_0x371a86(0x1ae)][_0x371a86(0x1cb)]({'name':_0x18b95f[_0x371a86(0x1e0)][_0x371a86(0x21a)],'action':'error','error':_0x14fcb0[_0x371a86(0x24b)]}),_0x397323[_0x371a86(0x16d)][_0x371a86(0x1ae)]['errors']++;}}return _0x397323;}}
1
+ const a133_0x333ebb=a133_0x2f4d;(function(_0x46fcff,_0x2d44ba){const _0x51287d=a133_0x2f4d,_0x38031f=_0x46fcff();while(!![]){try{const _0x54901c=-parseInt(_0x51287d(0x1dc))/0x1+parseInt(_0x51287d(0x1b9))/0x2+parseInt(_0x51287d(0x12d))/0x3+-parseInt(_0x51287d(0x14e))/0x4+-parseInt(_0x51287d(0x17f))/0x5+parseInt(_0x51287d(0x205))/0x6+parseInt(_0x51287d(0x1c8))/0x7;if(_0x54901c===_0x2d44ba)break;else _0x38031f['push'](_0x38031f['shift']());}catch(_0x3f6f99){_0x38031f['push'](_0x38031f['shift']());}}}(a133_0x8e2e,0x6b2e9));import{LLMApiClient}from'../client/llm-api-client.js';import*as a133_0x4b9de3 from'node:fs';import*as a133_0x1a611e 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';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';function a133_0x2f4d(_0x81bd2e,_0x14c53){_0x81bd2e=_0x81bd2e-0x105;const _0x8e2e8d=a133_0x8e2e();let _0x2f4db5=_0x8e2e8d[_0x81bd2e];return _0x2f4db5;}import{Logger}from'../../utils/logger/index.js';function a133_0x8e2e(){const _0x439077=['createKnowledgeBase','path','updateExperimentalArtifact','sort','updated','tdx.json','length','ExperimentalKnowledgeBase','agentId','Project\x20\x22','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','.yml','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','functions','currentProjectId','getOrCreateDefaultProject','statSync','Renamed\x20KB\x20file:\x20','webhookCorsOrigins','tdx_','1905204VFmlFI','error','duplicate','startChat','\x20in\x20project\x20','\x0a---\x20function:\x20','Renamed\x20text\x20KB\x20file:\x20','image_gen','textKnowledgeBases','KnowledgeBase','chatIgnoreManagedActions','unlinkSync','isDir','set','deleteProject','mkdirSync','file_name','prompts.json','size','json_schema.json','writeFileSync','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','listKnowledgeBases','models','chat','getProject','def','warn','jsonSchemaHint','history','split','variables','createTextKnowledgeBase','1601728LFTmrV','Output\x20directory\x20already\x20exists:\x20','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','listPrompts','context','Invalid\x20agent\x20reference\x20format:\x20','getAgent','loadJsonFile','service_type','systemPrompt','\x27.\x20This\x20should\x20not\x20happen.','webSearchTools','outputs','listIntegrations','project','isFile','listExperimentalKnowledgeBases','1.0','template','Renamed\x20prompt\x20file:\x20','modelType','add','createProject','getDefaultProjectName','listAgentsFull','updateAgentResponse','listToolTargets','getChatHistory','tools','getChatInfo','projectId','starter_message','prompts','experimental_knowledge_bases','description','availableModelNames','total','Renamed\x20experimental\x20KB\x20directory:\x20','UNAUTHENTICATED','maxToolIterations','Unresolved\x20dependencies:\x20','nameToId','(dry-run)','map','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','isManaged','tdx_default_','listAgents','agent.yml','2173930KWjyOO','):\x20','slackMessageMode','Renamed\x20folder:\x20','dry-run-','event','resolveAgentId','unchanged','\x27\x20(','Renamed\x20experimental\x20artifact\x20directory:\x20','projects','version','---\x20file:\x20','getUserSettings','high','updateKnowledgeBase','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','logger','yaml','getChatLog','Unable\x20to\x20create\x20project\x20after\x20','push','createWebSearchTool','setDefaultAgent','getBackupMetadata','prompt.md','keys','listProjects','availableModels','signal','agents','stringify','chatWelcomeMessage','experimentalKnowledgeBases','name','tables','createPrompt','existsSync','isDirectory','\x0a---\x20code\x20---\x0a','listExperimentalArtifacts','code.js','experimental_artifacts','includes','chatId','files','createAgent','AGENT_NOT_FOUND','\x0a---\x20schema:\x20','web_search','createIntegration','chats','LLM_PROJECT_NOT_FOUND','Available\x20agents:\x20','setCurrentProject','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','deleteIntegration','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','401528raTpok','pullAgent','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','Only\x20safe\x20types\x20(','resolveProjectName','project.json','site','attributes','find','resolveProjectId','serviceType','readdirSync','basename','imageGenerators','getOrCreateDefaultAgent','3516590kmXJvq','updateTextKnowledgeBase','endsWith','profile','counts','info','integrations.json','localeCompare','llm_project','has','utf-8','---\x20schema:\x20','NOT_FOUND','starterMessage','updatePrompt','created','conflict','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.','renamed','\x0a\x0a#\x20agent.yml\x0a','440826vbNuPr','INTERNAL','integrations','rmSync','_reasoning_','clearDefaultAgent','starter_message.md','some','filter','metadata','none','oldPath','client','new','Renamed\x20integration\x20file:\x20','exportedFrom','get','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','type','knowledgebases.json','\x20attempts\x20due\x20to\x20name\x20conflicts.','medium','createAgentResponse','pullProject','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','PERMISSION_DENIED','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','\x20---\x0a','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','json_schema','join','createExperimentalKnowledgeBase','chat_generic','\x20→\x20','code','chat_parent_segment','projectName','knowledge_bases','backupProject','INVALID_ARGUMENT','2261154dJlLPb','No\x20tdx.json\x20found\x20in\x20','readFileSync','Project\x20not\x20found:\x20','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','errors','#\x20prompt.md\x0a','createExperimentalArtifact','ALREADY_EXISTS','newProjectId','createImageGenerator','message','toLowerCase','low','text','Renamed\x20agent\x20folder:\x20','target','agent','dryRun','getDefaultAgent','deleteAgent','restoreProject','experimentalArtifacts','.md','text_content','cloneProject','cwd','status','knowledgeBases'];a133_0x8e2e=function(){return _0x439077;};return a133_0x8e2e();}export const SAFE_INTEGRATION_TYPES=[a133_0x333ebb(0x1fd),'chat_agent_console',a133_0x333ebb(0x200)];async function safeListOrEmpty(_0xf4650e){const _0x10873a=a133_0x333ebb;try{return await _0xf4650e();}catch(_0x3b1209){if(_0x3b1209 instanceof HTTPClientError&&_0x3b1209[_0x10873a(0x117)]===0x194)return[];throw _0x3b1209;}}export class LLMSDK{['currentProjectId'];[a133_0x333ebb(0x1e8)];[a133_0x333ebb(0x152)];['logger']=Logger['of']('sdk.llm');constructor(_0x39162f){const _0x293b19=a133_0x333ebb;this[_0x293b19(0x1e8)]=new LLMApiClient(_0x39162f),this['context']=_0x39162f;}[a133_0x333ebb(0x165)](){const _0x47987a=a133_0x333ebb,_0x30eab7=getSanitizedUsername();return _0x47987a(0x17c)+_0x30eab7;}async[a133_0x333ebb(0x1b5)](_0x18a9a0){const _0x5b042b=a133_0x333ebb,{projectId:_0x184254}=await this['resolveProjectName'](_0x18a9a0);this[_0x5b042b(0x127)]=_0x184254;}['getCurrentProject'](){const _0x9ff885=a133_0x333ebb;return this[_0x9ff885(0x127)];}async[a133_0x333ebb(0x196)](_0x2e3b21){const _0x4b8116=a133_0x333ebb,_0x4abe2a=this[_0x4b8116(0x152)][_0x4b8116(0x1cb)];let _0x48129f,_0x5e8df4;if(_0x2e3b21[_0x4b8116(0x1aa)]('/')){const _0x4b7336=_0x2e3b21[_0x4b8116(0x14b)]('/');if(_0x4b7336[_0x4b8116(0x11f)]!==0x2)throw new SDKError(ErrorCode[_0x4b8116(0x204)],_0x4b8116(0x153)+_0x2e3b21,undefined,{'helpText':_0x4b8116(0x1ed)});const [_0x147e2f,_0x48cc73]=_0x4b7336;_0x48129f=await this[_0x4b8116(0x1c2)](_0x147e2f),_0x5e8df4=_0x48cc73;}else _0x48129f=this['currentProjectId']||(await this[_0x4b8116(0x128)]())['id'],_0x5e8df4=_0x2e3b21;const _0x352232=await this[_0x4b8116(0x185)](_0x5e8df4,_0x48129f),_0x30cd1f=await this[_0x4b8116(0x1e8)][_0x4b8116(0x154)](_0x352232);writeCachedLLMAgent(_0x30cd1f[_0x4b8116(0x1c0)][_0x4b8116(0x1a1)],_0x352232,_0x48129f,_0x4abe2a);}[a133_0x333ebb(0x10f)](){const _0x41c4c9=a133_0x333ebb,_0x36a304=this[_0x41c4c9(0x152)][_0x41c4c9(0x1cb)];return readCachedLLMAgent(_0x36a304)||undefined;}[a133_0x333ebb(0x1e1)](){const _0x57a561=this['context']['profile'];clearCachedLLMAgent(_0x57a561);}async[a133_0x333ebb(0x144)](){const _0x21a937=a133_0x333ebb,_0x42d799=await this[_0x21a937(0x1e8)][_0x21a937(0x18c)](),_0x43f80f=[];for(const _0x2b7288 of _0x42d799[_0x21a937(0x171)]){const _0x5f3a9f=_0x42d799[_0x21a937(0x19b)][_0x2b7288];_0x5f3a9f&&_0x43f80f[_0x21a937(0x194)]({'name':_0x2b7288,'displayName':_0x5f3a9f['displayName']});}return _0x43f80f;}async[a133_0x333ebb(0x164)](_0x56c28b){const _0x43cd84=a133_0x333ebb;return await this[_0x43cd84(0x1e8)][_0x43cd84(0x164)](_0x56c28b);}async[a133_0x333ebb(0x13b)](_0x3d1027){const _0x5e6b9e=a133_0x333ebb,{projectId:_0x4ebfcf}=await this[_0x5e6b9e(0x1bd)](_0x3d1027);await this[_0x5e6b9e(0x1e8)]['deleteProject'](_0x4ebfcf);}async[a133_0x333ebb(0x189)](_0x1c1c58=0x32){const _0x162f90=a133_0x333ebb;return await this['client'][_0x162f90(0x19a)](_0x1c1c58);}async[a133_0x333ebb(0x128)](_0x36fe6b){const _0x419c70=a133_0x333ebb,_0x58617f=_0x36fe6b||this[_0x419c70(0x165)](),_0x585981=this[_0x419c70(0x152)][_0x419c70(0x1cb)];if(!_0x36fe6b){const _0x2f81f0=readCachedLLMProject(_0x585981);if(_0x2f81f0&&_0x2f81f0['name']===_0x58617f)try{const _0x396e77=await this[_0x419c70(0x1e8)][_0x419c70(0x146)](_0x2f81f0['id']);if(_0x396e77[_0x419c70(0x1c0)][_0x419c70(0x1a1)]===_0x58617f)return _0x396e77;}catch{}}const _0x154e53=await this[_0x419c70(0x1e8)][_0x419c70(0x19a)](),_0x1bb8f9=_0x154e53[_0x419c70(0x1c1)](_0x33f5a3=>_0x33f5a3[_0x419c70(0x1c0)][_0x419c70(0x1a1)]===_0x58617f);if(_0x1bb8f9)return!_0x36fe6b&&writeCachedLLMProject(_0x58617f,_0x1bb8f9['id'],_0x585981),_0x1bb8f9;const _0x2700db=await this[_0x419c70(0x1e8)][_0x419c70(0x164)]({'name':_0x58617f,'description':'Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20'+getSanitizedUsername()+')'});return!_0x36fe6b&&writeCachedLLMProject(_0x58617f,_0x2700db['id'],_0x585981),_0x2700db;}async[a133_0x333ebb(0x1c2)](_0x359ada){const _0x226423=a133_0x333ebb,_0x2a7799=await this['client'][_0x226423(0x19a)](),_0x3d17dd=_0x2a7799['filter'](_0x383e71=>_0x383e71[_0x226423(0x1c0)][_0x226423(0x1a1)]===_0x359ada);if(_0x3d17dd[_0x226423(0x11f)]===0x0)throw new SDKError(ErrorCode[_0x226423(0x1b3)],_0x226423(0x208)+_0x359ada,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x3d17dd[_0x226423(0x11f)]>0x1)throw new SDKError(ErrorCode[_0x226423(0x1dd)],'Multiple\x20projects\x20found\x20with\x20name\x20\x27'+_0x359ada+_0x226423(0x158));return _0x3d17dd[0x0]['id'];}async[a133_0x333ebb(0x1bd)](_0xb89bc3){const _0x33733c=a133_0x333ebb,_0x39fcdf=await this[_0x33733c(0x1e8)][_0x33733c(0x19a)](),_0x3f8678=_0x39fcdf[_0x33733c(0x1c1)](_0x5de335=>_0x5de335[_0x33733c(0x1c0)][_0x33733c(0x1a1)]===_0xb89bc3);if(_0x3f8678)return{'projectId':_0x3f8678['id'],'project':_0x3f8678};throw new SDKError(ErrorCode[_0x33733c(0x1b3)],'Project\x20not\x20found:\x20'+_0xb89bc3,undefined,{'helpText':_0x33733c(0x17a)});}async[a133_0x333ebb(0x1c7)](_0x4b6a67='claude-4.5-sonnet',_0x4b3bee=0x0,_0x1ddcd9){const _0xb33168=a133_0x333ebb,_0x567cf0=0xa;let _0x12ffdf=0x0,_0x130b93;while(_0x12ffdf<_0x567cf0){try{const _0x3f8e08=await this[_0xb33168(0x128)](_0x130b93),_0x4fa6bf=_0x3f8e08['id'],_0x16af08=[_0xb33168(0x1e6),'minimal',_0xb33168(0x109),_0xb33168(0x1f1),_0xb33168(0x18d)],_0x262a09=_0x4b3bee===0x0?_0xb33168(0x12c)+_0x4b6a67:'tdx_'+_0x4b6a67+_0xb33168(0x1e0)+_0x16af08[_0x4b3bee],_0x378741=await this['client'][_0xb33168(0x17d)](_0x4fa6bf),_0x3c915e=_0x378741[_0xb33168(0x1c1)](_0x17ec84=>_0x17ec84[_0xb33168(0x1c0)]['name']===_0x262a09);if(_0x3c915e)return _0x3c915e;const _0x3ce156=_0x4b3bee>0x0?0x1:_0x1ddcd9;return await this[_0xb33168(0x1e8)]['createAgent']({'name':_0x262a09,'projectId':_0x4fa6bf,'modelType':_0x4b6a67,'systemPrompt':'','temperature':_0x3ce156,'reasoningEffort':_0x4b3bee>0x0?_0x4b3bee:undefined});}catch(_0x5c80e5){if(_0x5c80e5 instanceof HTTPClientError){const _0x567794=_0x5c80e5[_0xb33168(0x117)];if(_0x567794>=0x190&&_0x567794<0x1f4){if(_0x567794===0x191)throw new SDKError(ErrorCode[_0xb33168(0x174)],'Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.',_0x5c80e5);else{if(_0x567794===0x193)throw new SDKError(ErrorCode[_0xb33168(0x1f5)],_0xb33168(0x150),_0x5c80e5);}throw _0x5c80e5;}}if(errorContains(_0x5c80e5,'already\x20exists',_0xb33168(0x12f),_0xb33168(0x1d8))){_0x12ffdf++;if(_0x12ffdf>=_0x567cf0)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0xb33168(0x193)+_0x567cf0+_0xb33168(0x1f0),_0x5c80e5);const _0x27f529=this['getDefaultProjectName']();_0x130b93=_0x27f529+'_'+generateRandomHex();continue;}throw _0x5c80e5;}}throw new SDKError(ErrorCode[_0xb33168(0x1dd)],_0xb33168(0x209));}async[a133_0x333ebb(0x185)](_0x2790a3,_0x5bd2ba){const _0x506399=a133_0x333ebb,_0x4792a2=_0x5bd2ba||this[_0x506399(0x127)],_0xc39240=await this[_0x506399(0x1e8)][_0x506399(0x17d)](_0x4792a2),_0x1baa4c=_0xc39240['filter'](_0x31e896=>_0x31e896[_0x506399(0x1c0)][_0x506399(0x1a1)]===_0x2790a3);if(_0x1baa4c[_0x506399(0x11f)]===0x0){const _0x1c0989=_0x4792a2?_0x506399(0x131)+_0x4792a2:'';throw new SDKError(ErrorCode[_0x506399(0x1ae)],'Agent\x20not\x20found:\x20'+_0x2790a3+_0x1c0989,undefined,{'helpText':_0x4792a2?'Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.':_0x506399(0x1d9)});}if(_0x1baa4c['length']>0x1)throw new SDKError(ErrorCode[_0x506399(0x1dd)],'Multiple\x20agents\x20found\x20with\x20name\x20\x27'+_0x2790a3+'\x27.\x20This\x20should\x20not\x20happen.');return _0x1baa4c[0x0]['id'];}async[a133_0x333ebb(0x19d)](_0xf7c15f){const _0x2dadbb=a133_0x333ebb,_0x3bbcf9=_0xf7c15f||this['currentProjectId'];return await this['client'][_0x2dadbb(0x17d)](_0x3bbcf9);}async['agentsFull'](_0x4ab9ba){const _0x232036=a133_0x333ebb;return await this[_0x232036(0x1e8)][_0x232036(0x166)](_0x4ab9ba);}async['agent'](_0x543578){const _0x3dfc9b=a133_0x333ebb;return await this[_0x3dfc9b(0x1e8)][_0x3dfc9b(0x154)](_0x543578);}async[a133_0x333ebb(0x1ad)](_0x585103){const _0x1efaca=a133_0x333ebb;return await this[_0x1efaca(0x1e8)][_0x1efaca(0x1ad)](_0x585103);}async['updateAgent'](_0x37d3c6,_0x23ed2e){const _0x9d832f=a133_0x333ebb;return await this[_0x9d832f(0x1e8)]['updateAgent'](_0x37d3c6,_0x23ed2e);}async['deleteAgent'](_0x14a33d){const _0x177a61=a133_0x333ebb;await this[_0x177a61(0x1e8)][_0x177a61(0x110)](_0x14a33d);}async[a133_0x333ebb(0x130)](_0xe618ae){const _0x4ac16f=a133_0x333ebb;return await this['client'][_0x4ac16f(0x130)]({'agentId':_0xe618ae});}async*[a133_0x333ebb(0x145)](_0x31ac09,_0x13bb42){const _0x8aa5cc=a133_0x333ebb;let _0x46809c=_0x13bb42?.[_0x8aa5cc(0x1ab)];const _0x3f9d9e=_0x13bb42?.['agentId'];if(!_0x46809c){if(!_0x3f9d9e)throw new Error(_0x8aa5cc(0x1f6));const _0x14e3f7=await this[_0x8aa5cc(0x1e8)]['startChat']({'agentId':_0x3f9d9e});_0x46809c=_0x14e3f7['id'],yield{'type':_0x8aa5cc(0x1e5),'data':{'chatId':_0x46809c,'agentId':_0x3f9d9e,'projectId':_0x14e3f7[_0x8aa5cc(0x1c0)][_0x8aa5cc(0x16c)]}};}for await(const _0x2720a9 of this['client']['continueChat'](_0x46809c,_0x31ac09,_0x13bb42?.[_0x8aa5cc(0x19c)])){yield{'type':_0x8aa5cc(0x184),'data':_0x2720a9};}}async[a133_0x333ebb(0x1b2)](_0x3336df=0x32){const _0x10794c=a133_0x333ebb;return await this[_0x10794c(0x1e8)]['listChats'](_0x3336df);}async[a133_0x333ebb(0x14a)](_0x191f2){const _0x388ef5=a133_0x333ebb;return await this[_0x388ef5(0x1e8)][_0x388ef5(0x169)](_0x191f2);}async['getChatLog'](_0x1b089a){const _0x1ed106=a133_0x333ebb;return await this[_0x1ed106(0x1e8)][_0x1ed106(0x192)](_0x1b089a);}async['chatInfo'](_0x413f02){const _0x12dc78=a133_0x333ebb;return await this[_0x12dc78(0x1e8)][_0x12dc78(0x16b)](_0x413f02);}async[a133_0x333ebb(0x203)](_0x326929,_0x216d20,_0xa2a9f4){const _0x72183=a133_0x333ebb,_0x358e68=_0xa2a9f4?.['dryRun']??![],{projectId:_0x8d1a62,project:_0x4da4ba}=await this[_0x72183(0x1bd)](_0x326929),_0x36168d=_0x4da4ba[_0x72183(0x1c0)][_0x72183(0x1a1)],_0x1d9761=_0x216d20||_0x36168d+'.llm';if(a133_0x4b9de3[_0x72183(0x1a4)](_0x1d9761)&&!_0x358e68)throw new SDKError(ErrorCode[_0x72183(0x20e)],_0x72183(0x14f)+_0x1d9761,undefined,{'helpText':'Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.'});const _0x44d5d9=await this[_0x72183(0x1e8)][_0x72183(0x166)](_0x8d1a62),_0x11f114=await this['client']['listKnowledgeBases'](_0x8d1a62),_0x5d6b28=await this[_0x72183(0x1e8)][_0x72183(0x151)](_0x8d1a62),_0x2f5963=await this['client']['listIntegrations'](_0x8d1a62);if(!_0x358e68){a133_0x4b9de3[_0x72183(0x13c)](_0x1d9761,{'recursive':!![]});const _0x401525={'version':_0x72183(0x15f),'exportedAt':new Date()['toISOString'](),'exportedFrom':{'site':this[_0x72183(0x152)][_0x72183(0x1bf)],'projectId':_0x8d1a62,'projectName':_0x36168d},'project':_0x4da4ba};a133_0x4b9de3[_0x72183(0x141)](a133_0x1a611e['join'](_0x1d9761,_0x72183(0x1be)),JSON[_0x72183(0x19e)](_0x401525,null,0x2)),a133_0x4b9de3[_0x72183(0x141)](a133_0x1a611e[_0x72183(0x1fb)](_0x1d9761,'agents.json'),JSON['stringify'](_0x44d5d9,null,0x2)),a133_0x4b9de3['writeFileSync'](a133_0x1a611e[_0x72183(0x1fb)](_0x1d9761,_0x72183(0x1ef)),JSON[_0x72183(0x19e)](_0x11f114,null,0x2)),a133_0x4b9de3[_0x72183(0x141)](a133_0x1a611e[_0x72183(0x1fb)](_0x1d9761,_0x72183(0x13e)),JSON[_0x72183(0x19e)](_0x5d6b28,null,0x2)),a133_0x4b9de3[_0x72183(0x141)](a133_0x1a611e[_0x72183(0x1fb)](_0x1d9761,'integrations.json'),JSON[_0x72183(0x19e)](_0x2f5963,null,0x2));}return{'projectName':_0x36168d,'outputDir':_0x1d9761,'counts':{'agents':_0x44d5d9[_0x72183(0x11f)],'knowledgeBases':_0x11f114['length'],'prompts':_0x5d6b28[_0x72183(0x11f)],'integrations':_0x2f5963[_0x72183(0x11f)]}};}async[a133_0x333ebb(0x111)](_0x5c6b8a,_0x1fdec2){const _0xa39b3b=a133_0x333ebb,_0x321d4a=_0x1fdec2?.[_0xa39b3b(0x10e)]??![],_0x54432d=this[_0xa39b3b(0x197)](_0x5c6b8a),_0x1eae4f=_0x54432d['exportedFrom']['site'],_0x883624=this[_0xa39b3b(0x152)][_0xa39b3b(0x1bf)],_0x42b64f=_0x1eae4f!==_0x883624?_0x1eae4f:undefined,_0x4b4c9f=this[_0xa39b3b(0x155)](a133_0x1a611e['join'](_0x5c6b8a,'agents.json'),[]),_0x114b05=this[_0xa39b3b(0x155)](a133_0x1a611e[_0xa39b3b(0x1fb)](_0x5c6b8a,'knowledgebases.json'),[]),_0x2b9fa2=this[_0xa39b3b(0x155)](a133_0x1a611e[_0xa39b3b(0x1fb)](_0x5c6b8a,_0xa39b3b(0x13e)),[]),_0x4215e0=this[_0xa39b3b(0x155)](a133_0x1a611e[_0xa39b3b(0x1fb)](_0x5c6b8a,_0xa39b3b(0x1ce)),[]),_0x1d5d57=_0x1fdec2?.[_0xa39b3b(0x1a1)]||_0x54432d[_0xa39b3b(0x1eb)][_0xa39b3b(0x201)];if(_0x321d4a){const _0xe4bcfa=new Map(),_0x6bc1d6=[..._0x4b4c9f],_0x2be8b0=_0x4b4c9f['length']+0x1;let _0x30a980=0x0;while(_0x6bc1d6[_0xa39b3b(0x11f)]>0x0&&_0x30a980<_0x2be8b0){_0x30a980++;const _0x392e55=[];for(const _0x42c329 of _0x6bc1d6){canCreateAgent(_0x42c329,_0xe4bcfa)?_0xe4bcfa[_0xa39b3b(0x13a)](_0x42c329['id'],_0xa39b3b(0x183)+_0x42c329['id']):_0x392e55[_0xa39b3b(0x194)](_0x42c329);}if(_0x392e55[_0xa39b3b(0x11f)]===_0x6bc1d6['length'])throw new SDKError(ErrorCode['INTERNAL'],_0xa39b3b(0x18f),undefined,{'helpText':_0xa39b3b(0x142)});_0x6bc1d6[_0xa39b3b(0x11f)]=0x0,_0x6bc1d6[_0xa39b3b(0x194)](..._0x392e55);}const _0x142637=_0x2b9fa2[_0xa39b3b(0x1e4)](_0x4f26ea=>_0xe4bcfa['has'](_0x4f26ea[_0xa39b3b(0x1c0)][_0xa39b3b(0x121)]))[_0xa39b3b(0x11f)];return{'projectName':_0x1d5d57,'projectId':_0xa39b3b(0x178),'counts':{'agents':_0x4b4c9f[_0xa39b3b(0x11f)],'knowledgeBases':_0x114b05['length'],'prompts':_0x142637,'integrations':_0x4215e0['length']},'sourceSite':_0x42b64f};}const _0x1cb04b=await this['client']['createProject']({'name':_0x1d5d57,'description':_0x54432d[_0xa39b3b(0x15c)][_0xa39b3b(0x1c0)][_0xa39b3b(0x170)]}),_0x2974b=_0x1cb04b['id'],_0x14fc51=new Map(),_0x421a2d=new Map(),_0x220d35=new Map();for(const _0xc71803 of _0x114b05){const _0x4bc15f=await this['client'][_0xa39b3b(0x119)]({'projectId':_0x2974b,'name':_0xc71803['attributes'][_0xa39b3b(0x1a1)],'tdDatabaseName':_0xc71803[_0xa39b3b(0x1c0)]['tdDatabaseName'],'tables':_0xc71803[_0xa39b3b(0x1c0)][_0xa39b3b(0x1a2)]});_0x14fc51['set'](_0xc71803['id'],_0x4bc15f['id']);}const _0x44b406=[..._0x4b4c9f],_0xfd62ab=_0x4b4c9f[_0xa39b3b(0x11f)]+0x1;let _0x2ff625=0x0;while(_0x44b406[_0xa39b3b(0x11f)]>0x0&&_0x2ff625<_0xfd62ab){_0x2ff625++;const _0x246731=[];for(const _0x20b930 of _0x44b406){if(canCreateAgent(_0x20b930,_0x421a2d)){const _0x36ee48=remapToolIds(_0x20b930[_0xa39b3b(0x1c0)][_0xa39b3b(0x16a)],_0x14fc51,_0x421a2d),_0x3452a8=remapVariableIds(_0x20b930[_0xa39b3b(0x1c0)]['variables'],_0x14fc51),_0x4ad8c6=await this[_0xa39b3b(0x1e8)][_0xa39b3b(0x1f2)]({'name':_0x20b930[_0xa39b3b(0x1c0)][_0xa39b3b(0x1a1)],'projectId':_0x2974b,'systemPrompt':_0x20b930[_0xa39b3b(0x1c0)][_0xa39b3b(0x157)],'starterMessage':_0x20b930[_0xa39b3b(0x1c0)][_0xa39b3b(0x1d5)],'modelType':migrateModelType(_0x20b930[_0xa39b3b(0x1c0)][_0xa39b3b(0x162)]),'maxToolIterations':_0x20b930[_0xa39b3b(0x1c0)][_0xa39b3b(0x175)],'temperature':_0x20b930[_0xa39b3b(0x1c0)]['temperature'],'reasoningEffort':_0x20b930[_0xa39b3b(0x1c0)]['reasoningEffort'],'outputs':_0x20b930[_0xa39b3b(0x1c0)][_0xa39b3b(0x15a)],'tools':_0x36ee48,'variables':_0x3452a8});_0x421a2d['set'](_0x20b930['id'],_0x4ad8c6['id']);}else _0x246731[_0xa39b3b(0x194)](_0x20b930);}if(_0x246731[_0xa39b3b(0x11f)]===_0x44b406[_0xa39b3b(0x11f)])throw new SDKError(ErrorCode[_0xa39b3b(0x1dd)],_0xa39b3b(0x18f),undefined,{'helpText':_0xa39b3b(0x142)});_0x44b406[_0xa39b3b(0x11f)]=0x0,_0x44b406[_0xa39b3b(0x194)](..._0x246731);}for(const _0x510746 of _0x2b9fa2){const _0x429856=_0x421a2d['get'](_0x510746[_0xa39b3b(0x1c0)][_0xa39b3b(0x121)]);if(!_0x429856)continue;const _0x2ac2e4=await this[_0xa39b3b(0x1e8)][_0xa39b3b(0x1a3)]({'projectId':_0x2974b,'agentId':_0x429856,'name':_0x510746[_0xa39b3b(0x1c0)]['name'],'systemPrompt':_0x510746[_0xa39b3b(0x1c0)][_0xa39b3b(0x157)],'template':_0x510746['attributes'][_0xa39b3b(0x160)],'jsonSchemaHint':_0x510746[_0xa39b3b(0x1c0)][_0xa39b3b(0x149)]});_0x220d35[_0xa39b3b(0x13a)](_0x510746['id'],_0x2ac2e4['id']);}for(const _0x2015e4 of _0x4215e0){const _0x12904c=_0x2015e4[_0xa39b3b(0x1c0)]['actions']['map'](_0x4af19c=>({..._0x4af19c,'promptId':_0x220d35[_0xa39b3b(0x1ec)](_0x4af19c['promptId'])||_0x4af19c['promptId']}));await this[_0xa39b3b(0x1e8)][_0xa39b3b(0x1b1)]({'projectId':_0x2974b,'serviceType':_0x2015e4['attributes'][_0xa39b3b(0x1c3)],'actions':_0x12904c,'slackMessageMode':_0x2015e4[_0xa39b3b(0x1c0)][_0xa39b3b(0x181)],'chatIgnoreManagedActions':_0x2015e4[_0xa39b3b(0x1c0)][_0xa39b3b(0x137)],'chatWelcomeMessage':_0x2015e4[_0xa39b3b(0x1c0)][_0xa39b3b(0x19f)],'webhookCorsOrigins':_0x2015e4[_0xa39b3b(0x1c0)][_0xa39b3b(0x12b)]});}return{'projectName':_0x1d5d57,'projectId':_0x2974b,'counts':{'agents':_0x421a2d[_0xa39b3b(0x13f)],'knowledgeBases':_0x14fc51[_0xa39b3b(0x13f)],'prompts':_0x220d35[_0xa39b3b(0x13f)],'integrations':_0x4215e0[_0xa39b3b(0x11f)]},'sourceSite':_0x42b64f};}[a133_0x333ebb(0x155)](_0x15144a,_0x545978){const _0x3ec93a=a133_0x333ebb;if(!a133_0x4b9de3[_0x3ec93a(0x1a4)](_0x15144a))return _0x545978;return JSON['parse'](a133_0x4b9de3[_0x3ec93a(0x207)](_0x15144a,_0x3ec93a(0x1d2)));}['getBackupMetadata'](_0x9e4b48){const _0x4eb997=a133_0x333ebb;if(!a133_0x4b9de3[_0x4eb997(0x1a4)](_0x9e4b48))throw new SDKError(ErrorCode[_0x4eb997(0x1d4)],'Backup\x20folder\x20not\x20found:\x20'+_0x9e4b48,undefined,{'helpText':_0x4eb997(0x1f9)});const _0x599226=a133_0x1a611e['join'](_0x9e4b48,_0x4eb997(0x1be));if(!a133_0x4b9de3['existsSync'](_0x599226))throw new SDKError(ErrorCode[_0x4eb997(0x204)],_0x4eb997(0x1f4)+_0x9e4b48,undefined,{'helpText':_0x4eb997(0x1f8)});const _0x49475a=JSON['parse'](a133_0x4b9de3[_0x4eb997(0x207)](_0x599226,_0x4eb997(0x1d2)));if(!isSupportedBackupVersion(_0x49475a[_0x4eb997(0x18a)]))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Unsupported\x20backup\x20version:\x20'+_0x49475a[_0x4eb997(0x18a)],undefined,{'helpText':_0x4eb997(0x123)});return _0x49475a;}async[a133_0x333ebb(0x1f3)](_0x50ca16,_0x395590,_0x4dba81){const _0x62d5bc=a133_0x333ebb,{projectId:_0x44638e,project:_0x15ec50}=await this[_0x62d5bc(0x1bd)](_0x50ca16),_0x510e14=_0x15ec50['attributes'][_0x62d5bc(0x1a1)];let _0x24aadc;if(_0x395590)_0x24aadc=_0x395590;else{const _0xbca348=a133_0x1a611e[_0x62d5bc(0x1fb)](process[_0x62d5bc(0x116)](),_0x62d5bc(0x19d)),_0x28998d=getSanitizedPathWithMigration(_0xbca348,_0x510e14);_0x28998d['renamed']&&this['logger'][_0x62d5bc(0x1cd)]('Renamed\x20folder:\x20'+a133_0x1a611e[_0x62d5bc(0x1c5)](_0x28998d[_0x62d5bc(0x1e7)])+'\x20→\x20'+a133_0x1a611e[_0x62d5bc(0x1c5)](_0x28998d[_0x62d5bc(0x11a)])),_0x24aadc=_0x28998d[_0x62d5bc(0x11a)];}const _0x341512=await this[_0x62d5bc(0x1e8)][_0x62d5bc(0x166)](_0x44638e),_0xcee70a=await this[_0x62d5bc(0x1e8)][_0x62d5bc(0x143)](_0x44638e),_0xbc26f7=await this['client']['listTextKnowledgeBases'](_0x44638e),_0x49c149=await safeListOrEmpty(()=>this[_0x62d5bc(0x1e8)]['listImageGenerators'](_0x44638e)),_0x11f1fe=await safeListOrEmpty(()=>this['client']['listWebSearchTools'](_0x44638e)),_0xcf96fd=await this[_0x62d5bc(0x1e8)][_0x62d5bc(0x151)](_0x44638e),_0x495b2a=await this['client'][_0x62d5bc(0x15b)](_0x44638e),_0x238567=await safeListOrEmpty(()=>this[_0x62d5bc(0x1e8)][_0x62d5bc(0x15e)](_0x44638e)),_0x45337d=await safeListOrEmpty(()=>this['client'][_0x62d5bc(0x1a7)](_0x44638e)),_0x3ce2a7=_0x495b2a[_0x62d5bc(0x1e4)](_0x50e1bf=>!_0x50e1bf[_0x62d5bc(0x1c0)][_0x62d5bc(0x17b)]&&SAFE_INTEGRATION_TYPES['includes'](_0x50e1bf[_0x62d5bc(0x1c0)]['serviceType']['toLowerCase']())),_0x333635=new Map(),_0xe0dffa=new Map(),_0xd510d9=new Map(),_0x1d949d=new Map(),_0x49fc50=new Map(),_0x305c4d=new Map(),_0xdbae5=new Map();for(const _0x295199 of _0x341512){_0x333635['set'](_0x295199['id'],_0x295199[_0x62d5bc(0x1c0)][_0x62d5bc(0x1a1)]);}for(const _0x148d4f of _0xcee70a){_0xe0dffa['set'](_0x148d4f['id'],_0x148d4f['attributes'][_0x62d5bc(0x1a1)]);}for(const _0x301bd5 of _0xbc26f7){_0xd510d9[_0x62d5bc(0x13a)](_0x301bd5['id'],_0x301bd5[_0x62d5bc(0x1c0)][_0x62d5bc(0x1a1)]);}for(const _0x2cd2e1 of _0x49c149){_0x1d949d[_0x62d5bc(0x13a)](_0x2cd2e1['id'],_0x2cd2e1['attributes'][_0x62d5bc(0x1a1)]);}for(const _0x17cf57 of _0x11f1fe){_0x49fc50[_0x62d5bc(0x13a)](_0x17cf57['id'],_0x17cf57[_0x62d5bc(0x1c0)][_0x62d5bc(0x1a1)]);}for(const _0xc475dd of _0xcf96fd){_0x305c4d['set'](_0xc475dd['id'],_0xc475dd[_0x62d5bc(0x1c0)][_0x62d5bc(0x1a1)]);}for(const _0xc26da0 of _0x238567){_0xdbae5[_0x62d5bc(0x13a)](_0xc26da0['id'],_0xc26da0[_0x62d5bc(0x1c0)][_0x62d5bc(0x1a1)]);}const _0x1a35b2={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0xe0dffa,'TextKnowledgeBase':_0xd510d9,'Agent':_0x333635,'WebSearchTool':_0x49fc50,'ImageGenerator':_0x1d949d,'ExperimentalKnowledgeBase':_0xdbae5}),'resolvePromptName':async _0x3db36d=>_0x305c4d[_0x62d5bc(0x1ec)](_0x3db36d),'onWarning':_0x272051=>this[_0x62d5bc(0x190)]['warn'](_0x272051)},_0x20291d={'projectName':_0x510e14,'outputDir':_0x24aadc,'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}}},_0x5916e8=[],_0x92301=[];for(const _0x1b1a3e of _0x341512){const _0x47c054=getSanitizedPathWithMigration(_0x24aadc,_0x1b1a3e[_0x62d5bc(0x1c0)]['name']);_0x47c054[_0x62d5bc(0x1da)]&&this['logger']['info'](_0x62d5bc(0x10b)+a133_0x1a611e[_0x62d5bc(0x1c5)](_0x47c054[_0x62d5bc(0x1e7)])+'\x20→\x20'+a133_0x1a611e[_0x62d5bc(0x1c5)](_0x47c054[_0x62d5bc(0x11a)]));const _0xe0325b=_0x47c054[_0x62d5bc(0x11a)],_0x3c19a0=a133_0x1a611e[_0x62d5bc(0x1fb)](_0xe0325b,_0x62d5bc(0x198)),_0x5958fd=a133_0x1a611e[_0x62d5bc(0x1fb)](_0xe0325b,'agent.yml'),_0x3f2b33=a133_0x1a611e[_0x62d5bc(0x1fb)](_0xe0325b,_0x62d5bc(0x1e2)),{yaml:_0xd36b59,systemPrompt:_0x332575,starterMessage:_0x431c57}=await agentResponseToDef(_0x1b1a3e,_0x1a35b2),_0x96b820=toAgentYamlString(_0xd36b59),_0x320ea0=!a133_0x4b9de3['existsSync'](_0x5958fd);let _0x468811=_0x320ea0,_0x11ffb8;if(!_0x320ea0){const _0x14a060=a133_0x4b9de3[_0x62d5bc(0x1a4)](_0x3c19a0)?a133_0x4b9de3[_0x62d5bc(0x207)](_0x3c19a0,_0x62d5bc(0x1d2)):'',_0x17aa24=a133_0x4b9de3[_0x62d5bc(0x207)](_0x5958fd,'utf-8'),_0x21a30f=_0x62d5bc(0x20c)+_0x14a060+_0x62d5bc(0x1db)+_0x17aa24,_0x3af8a2=_0x62d5bc(0x20c)+_0x332575+'\x0a\x0a#\x20agent.yml\x0a'+_0x96b820,_0x3e185a=generateDiff(_0x21a30f,_0x3af8a2);_0x468811=hasChanges(_0x3e185a),_0x468811&&(_0x11ffb8=formatDiffWithColors(_0x3e185a));}_0x5916e8[_0x62d5bc(0x194)]({'path':_0xe0325b,'content':'','isDir':!![]}),_0x5916e8['push']({'path':_0x3c19a0,'content':_0x332575}),_0x5916e8[_0x62d5bc(0x194)]({'path':_0x5958fd,'content':_0x96b820});_0x431c57&&_0x431c57[_0x62d5bc(0x1aa)]('\x0a')&&_0x5916e8[_0x62d5bc(0x194)]({'path':_0x3f2b33,'content':_0x431c57});_0x20291d[_0x62d5bc(0x19d)]['push']({'agentName':_0x1b1a3e['attributes']['name'],'outputPath':_0xe0325b,'isNew':_0x320ea0,'hasChanges':_0x468811,'diff':_0x11ffb8}),_0x20291d[_0x62d5bc(0x1cc)]['agents'][_0x62d5bc(0x172)]++;if(_0x320ea0)_0x20291d['counts'][_0x62d5bc(0x19d)][_0x62d5bc(0x1e9)]++;else{if(_0x468811)_0x20291d[_0x62d5bc(0x1cc)]['agents'][_0x62d5bc(0x11d)]++;else _0x20291d[_0x62d5bc(0x1cc)][_0x62d5bc(0x19d)][_0x62d5bc(0x186)]++;}}for(const _0x5c0f50 of _0xcee70a){if(_0x5c0f50['attributes'][_0x62d5bc(0x17b)])continue;const _0x4c9f61=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x24aadc),_0x5c0f50[_0x62d5bc(0x1c0)][_0x62d5bc(0x1a1)],_0x62d5bc(0x124));_0x4c9f61[_0x62d5bc(0x1da)]&&this[_0x62d5bc(0x190)][_0x62d5bc(0x1cd)](_0x62d5bc(0x12a)+a133_0x1a611e[_0x62d5bc(0x1c5)](_0x4c9f61[_0x62d5bc(0x1e7)])+_0x62d5bc(0x1fe)+a133_0x1a611e[_0x62d5bc(0x1c5)](_0x4c9f61[_0x62d5bc(0x11a)]));const _0x334de0=_0x4c9f61['path'],_0x557e7f=apiKnowledgeBaseToYaml(_0x5c0f50),_0x290f33=toKnowledgeBaseYamlString(_0x557e7f),_0x1be5ff=!a133_0x4b9de3[_0x62d5bc(0x1a4)](_0x334de0);let _0x4ab199=_0x1be5ff,_0x267548;if(!_0x1be5ff){const _0x4f78aa=a133_0x4b9de3['readFileSync'](_0x334de0,_0x62d5bc(0x1d2)),_0x49fe8f=generateDiff(_0x4f78aa,_0x290f33);_0x4ab199=hasChanges(_0x49fe8f),_0x4ab199&&(_0x267548=formatDiffWithColors(_0x49fe8f));}_0x5916e8['push']({'path':_0x334de0,'content':_0x290f33}),_0x20291d['knowledgeBases'][_0x62d5bc(0x194)]({'name':_0x5c0f50[_0x62d5bc(0x1c0)]['name'],'outputPath':_0x334de0,'isNew':_0x1be5ff,'hasChanges':_0x4ab199,'diff':_0x267548}),_0x20291d[_0x62d5bc(0x1cc)][_0x62d5bc(0x118)]['total']++;if(_0x1be5ff)_0x20291d[_0x62d5bc(0x1cc)][_0x62d5bc(0x118)][_0x62d5bc(0x1e9)]++;else{if(_0x4ab199)_0x20291d[_0x62d5bc(0x1cc)][_0x62d5bc(0x118)][_0x62d5bc(0x11d)]++;else _0x20291d[_0x62d5bc(0x1cc)][_0x62d5bc(0x118)]['unchanged']++;}}for(const _0x4afac3 of _0xbc26f7){if(_0x4afac3[_0x62d5bc(0x1c0)][_0x62d5bc(0x17b)])continue;const _0x1008dc=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x24aadc),_0x4afac3['attributes']['name'],'.md');_0x1008dc['renamed']&&this['logger'][_0x62d5bc(0x1cd)](_0x62d5bc(0x133)+a133_0x1a611e[_0x62d5bc(0x1c5)](_0x1008dc[_0x62d5bc(0x1e7)])+_0x62d5bc(0x1fe)+a133_0x1a611e['basename'](_0x1008dc[_0x62d5bc(0x11a)]));const _0x3fcd53=_0x1008dc[_0x62d5bc(0x11a)],_0x5251be=toTextKnowledgeBaseMd(_0x4afac3[_0x62d5bc(0x1c0)]['name'],_0x4afac3['attributes'][_0x62d5bc(0x10a)]),_0x1122fb=!a133_0x4b9de3[_0x62d5bc(0x1a4)](_0x3fcd53);let _0x5964ab=_0x1122fb,_0x57593b;if(!_0x1122fb){const _0x2672ac=a133_0x4b9de3[_0x62d5bc(0x207)](_0x3fcd53,_0x62d5bc(0x1d2)),_0x39912f=generateDiff(_0x2672ac,_0x5251be);_0x5964ab=hasChanges(_0x39912f),_0x5964ab&&(_0x57593b=formatDiffWithColors(_0x39912f));}_0x5916e8[_0x62d5bc(0x194)]({'path':_0x3fcd53,'content':_0x5251be}),_0x20291d['textKnowledgeBases'][_0x62d5bc(0x194)]({'name':_0x4afac3['attributes'][_0x62d5bc(0x1a1)],'outputPath':_0x3fcd53,'isNew':_0x1122fb,'hasChanges':_0x5964ab,'diff':_0x57593b}),_0x20291d[_0x62d5bc(0x1cc)]['textKnowledgeBases'][_0x62d5bc(0x172)]++;if(_0x1122fb)_0x20291d[_0x62d5bc(0x1cc)][_0x62d5bc(0x135)][_0x62d5bc(0x1e9)]++;else{if(_0x5964ab)_0x20291d[_0x62d5bc(0x1cc)][_0x62d5bc(0x135)][_0x62d5bc(0x11d)]++;else _0x20291d[_0x62d5bc(0x1cc)][_0x62d5bc(0x135)]['unchanged']++;}}for(const _0x360246 of _0xcf96fd){if(_0x360246['attributes'][_0x62d5bc(0x17b)])continue;const _0x777508=getSanitizedPathWithMigration(getPromptsDir(_0x24aadc),_0x360246[_0x62d5bc(0x1c0)][_0x62d5bc(0x1a1)],_0x62d5bc(0x124));_0x777508[_0x62d5bc(0x1da)]&&this[_0x62d5bc(0x190)][_0x62d5bc(0x1cd)](_0x62d5bc(0x161)+a133_0x1a611e[_0x62d5bc(0x1c5)](_0x777508[_0x62d5bc(0x1e7)])+_0x62d5bc(0x1fe)+a133_0x1a611e[_0x62d5bc(0x1c5)](_0x777508[_0x62d5bc(0x11a)]));const _0x268095=_0x777508[_0x62d5bc(0x11a)],_0x16b2b9=await apiPromptToYaml(_0x360246,_0x1a35b2);if(!_0x16b2b9)continue;const _0x3c0edd=toPromptYamlString(_0x16b2b9),_0x37a533=!a133_0x4b9de3[_0x62d5bc(0x1a4)](_0x268095);let _0x1fef6f=_0x37a533,_0x2b9cc7;if(!_0x37a533){const _0x994b7e=a133_0x4b9de3[_0x62d5bc(0x207)](_0x268095,_0x62d5bc(0x1d2)),_0x4e2c15=generateDiff(_0x994b7e,_0x3c0edd);_0x1fef6f=hasChanges(_0x4e2c15),_0x1fef6f&&(_0x2b9cc7=formatDiffWithColors(_0x4e2c15));}_0x5916e8['push']({'path':_0x268095,'content':_0x3c0edd}),_0x20291d[_0x62d5bc(0x16e)][_0x62d5bc(0x194)]({'name':_0x360246['attributes'][_0x62d5bc(0x1a1)],'outputPath':_0x268095,'isNew':_0x37a533,'hasChanges':_0x1fef6f,'diff':_0x2b9cc7}),_0x20291d[_0x62d5bc(0x1cc)]['prompts'][_0x62d5bc(0x172)]++;if(_0x37a533)_0x20291d['counts'][_0x62d5bc(0x16e)][_0x62d5bc(0x1e9)]++;else{if(_0x1fef6f)_0x20291d[_0x62d5bc(0x1cc)][_0x62d5bc(0x16e)][_0x62d5bc(0x11d)]++;else _0x20291d[_0x62d5bc(0x1cc)]['prompts'][_0x62d5bc(0x186)]++;}}for(const _0x3fb123 of _0x3ce2a7){const _0x570f73=_0x3fb123[_0x62d5bc(0x1c0)][_0x62d5bc(0x1c3)][_0x62d5bc(0x108)](),_0x57bc8f=getSanitizedPathWithMigration(getIntegrationsDir(_0x24aadc),_0x570f73,_0x62d5bc(0x124));_0x57bc8f[_0x62d5bc(0x1da)]&&this[_0x62d5bc(0x190)][_0x62d5bc(0x1cd)](_0x62d5bc(0x1ea)+a133_0x1a611e[_0x62d5bc(0x1c5)](_0x57bc8f[_0x62d5bc(0x1e7)])+_0x62d5bc(0x1fe)+a133_0x1a611e[_0x62d5bc(0x1c5)](_0x57bc8f[_0x62d5bc(0x11a)]));const _0x245730=_0x57bc8f['path'],_0x310f75=await apiIntegrationToYaml(_0x3fb123,_0x1a35b2),_0x294e16=toIntegrationYamlString(_0x310f75),_0x2b69dd=!a133_0x4b9de3[_0x62d5bc(0x1a4)](_0x245730);let _0x78a9c9=_0x2b69dd,_0x1abeb1;if(!_0x2b69dd){const _0x237d79=a133_0x4b9de3[_0x62d5bc(0x207)](_0x245730,_0x62d5bc(0x1d2)),_0x15b242=generateDiff(_0x237d79,_0x294e16);_0x78a9c9=hasChanges(_0x15b242),_0x78a9c9&&(_0x1abeb1=formatDiffWithColors(_0x15b242));}_0x5916e8[_0x62d5bc(0x194)]({'path':_0x245730,'content':_0x294e16}),_0x20291d[_0x62d5bc(0x1de)]['push']({'name':_0x570f73,'outputPath':_0x245730,'isNew':_0x2b69dd,'hasChanges':_0x78a9c9,'diff':_0x1abeb1}),_0x20291d[_0x62d5bc(0x1cc)]['integrations'][_0x62d5bc(0x172)]++;if(_0x2b69dd)_0x20291d[_0x62d5bc(0x1cc)][_0x62d5bc(0x1de)][_0x62d5bc(0x1e9)]++;else{if(_0x78a9c9)_0x20291d[_0x62d5bc(0x1cc)][_0x62d5bc(0x1de)][_0x62d5bc(0x11d)]++;else _0x20291d['counts']['integrations']['unchanged']++;}}for(const _0x28f183 of _0x238567){if(_0x28f183[_0x62d5bc(0x1c0)][_0x62d5bc(0x17b)])continue;const _0x26f439=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x24aadc),_0x28f183['attributes'][_0x62d5bc(0x1a1)]);_0x26f439[_0x62d5bc(0x1da)]&&this[_0x62d5bc(0x190)][_0x62d5bc(0x1cd)](_0x62d5bc(0x173)+a133_0x1a611e[_0x62d5bc(0x1c5)](_0x26f439[_0x62d5bc(0x1e7)])+_0x62d5bc(0x1fe)+a133_0x1a611e[_0x62d5bc(0x1c5)](_0x26f439[_0x62d5bc(0x11a)]));const _0x32956c=_0x26f439['path'],_0x855a02=a133_0x1a611e[_0x62d5bc(0x1fb)](_0x32956c,sanitizeForFilesystem(_0x28f183['attributes'][_0x62d5bc(0x1a1)])+_0x62d5bc(0x124)),_0x17dd94=a133_0x1a611e[_0x62d5bc(0x1fb)](_0x32956c,_0x62d5bc(0x126)),_0x338f01=apiExperimentalKnowledgeBaseToYaml(_0x28f183),_0x32a38d=toExperimentalKnowledgeBaseYamlString(_0x338f01),_0x486d0b=!a133_0x4b9de3[_0x62d5bc(0x1a4)](_0x32956c);let _0x763a7=_0x486d0b,_0xf1c115,_0x2e1117=_0x32a38d;const _0x4d8237=[..._0x338f01[_0x62d5bc(0x126)]][_0x62d5bc(0x11c)]((_0x3482f1,_0x6d54f3)=>_0x3482f1['name'][_0x62d5bc(0x1cf)](_0x6d54f3[_0x62d5bc(0x1a1)]));for(const _0x596c40 of _0x4d8237){_0x2e1117+=_0x62d5bc(0x132)+_0x596c40['name']+_0x62d5bc(0x1f7)+_0x596c40[_0x62d5bc(0x1ff)]+_0x62d5bc(0x1af)+_0x596c40[_0x62d5bc(0x1a1)]+'\x20---\x0a'+_0x596c40['json_schema']+'\x0a';}if(!_0x486d0b){let _0x3d1bb='';a133_0x4b9de3['existsSync'](_0x855a02)&&(_0x3d1bb=a133_0x4b9de3[_0x62d5bc(0x207)](_0x855a02,_0x62d5bc(0x1d2)));if(a133_0x4b9de3['existsSync'](_0x17dd94)){const _0x2d38a2=a133_0x4b9de3[_0x62d5bc(0x1c4)](_0x17dd94,{'withFileTypes':!![]}),_0x4aebed=_0x2d38a2[_0x62d5bc(0x1e4)](_0x228caa=>_0x228caa['isDirectory']())[_0x62d5bc(0x11c)]((_0x274926,_0x9e0a5a)=>_0x274926['name'][_0x62d5bc(0x1cf)](_0x9e0a5a[_0x62d5bc(0x1a1)]));for(const _0x3f437f of _0x4aebed){const _0x49d5cb=a133_0x1a611e['join'](_0x17dd94,_0x3f437f[_0x62d5bc(0x1a1)],'code.js'),_0x4123c3=a133_0x1a611e[_0x62d5bc(0x1fb)](_0x17dd94,_0x3f437f[_0x62d5bc(0x1a1)],_0x62d5bc(0x140));a133_0x4b9de3['existsSync'](_0x49d5cb)&&(_0x3d1bb+=_0x62d5bc(0x132)+_0x3f437f[_0x62d5bc(0x1a1)]+_0x62d5bc(0x1f7)+a133_0x4b9de3[_0x62d5bc(0x207)](_0x49d5cb,_0x62d5bc(0x1d2))+'\x0a'),a133_0x4b9de3[_0x62d5bc(0x1a4)](_0x4123c3)&&(_0x3d1bb+=_0x62d5bc(0x1d3)+_0x3f437f[_0x62d5bc(0x1a1)]+'\x20---\x0a'+a133_0x4b9de3[_0x62d5bc(0x207)](_0x4123c3,_0x62d5bc(0x1d2))+'\x0a');}}const _0x49c33f=generateDiff(_0x3d1bb,_0x2e1117);_0x763a7=hasChanges(_0x49c33f),_0x763a7&&(_0xf1c115=formatDiffWithColors(_0x49c33f));}_0x5916e8[_0x62d5bc(0x194)]({'path':_0x32956c,'content':'','isDir':!![]}),_0x5916e8['push']({'path':_0x855a02,'content':_0x32a38d}),_0x5916e8['push']({'path':_0x17dd94,'content':'','isDir':!![]});for(const _0x533950 of _0x338f01[_0x62d5bc(0x126)]){const _0x29611c=a133_0x1a611e[_0x62d5bc(0x1fb)](_0x17dd94,sanitizeForFilesystem(_0x533950[_0x62d5bc(0x1a1)])),_0x333cb0=a133_0x1a611e['join'](_0x29611c,_0x62d5bc(0x1a8)),_0x3fd83f=a133_0x1a611e[_0x62d5bc(0x1fb)](_0x29611c,_0x62d5bc(0x140));_0x5916e8[_0x62d5bc(0x194)]({'path':_0x29611c,'content':'','isDir':!![]}),_0x5916e8['push']({'path':_0x333cb0,'content':_0x533950[_0x62d5bc(0x1ff)]}),_0x5916e8[_0x62d5bc(0x194)]({'path':_0x3fd83f,'content':_0x533950[_0x62d5bc(0x1fa)]});}if(a133_0x4b9de3[_0x62d5bc(0x1a4)](_0x17dd94)){const _0x31e90e=a133_0x4b9de3[_0x62d5bc(0x1c4)](_0x17dd94,{'withFileTypes':!![]}),_0x1ceb62=new Set(_0x338f01['functions']['map'](_0x334b84=>sanitizeForFilesystem(_0x334b84['name'])));for(const _0x1edd0e of _0x31e90e){if(_0x1edd0e['isDirectory']()&&!_0x1ceb62['has'](_0x1edd0e['name'])){const _0x5bc2bd=a133_0x1a611e[_0x62d5bc(0x1fb)](_0x17dd94,_0x1edd0e[_0x62d5bc(0x1a1)]);_0x92301[_0x62d5bc(0x194)]({'path':_0x5bc2bd,'isDir':!![]});}}}_0x20291d[_0x62d5bc(0x1a0)][_0x62d5bc(0x194)]({'name':_0x28f183[_0x62d5bc(0x1c0)][_0x62d5bc(0x1a1)],'outputPath':_0x32956c,'isNew':_0x486d0b,'hasChanges':_0x763a7,'diff':_0xf1c115}),_0x20291d[_0x62d5bc(0x1cc)][_0x62d5bc(0x1a0)][_0x62d5bc(0x172)]++;if(_0x486d0b)_0x20291d['counts']['experimentalKnowledgeBases'][_0x62d5bc(0x1e9)]++;else{if(_0x763a7)_0x20291d[_0x62d5bc(0x1cc)][_0x62d5bc(0x1a0)]['updated']++;else _0x20291d[_0x62d5bc(0x1cc)][_0x62d5bc(0x1a0)][_0x62d5bc(0x186)]++;}}for(const _0x21f9e2 of _0x45337d){if(_0x21f9e2[_0x62d5bc(0x1c0)][_0x62d5bc(0x17b)])continue;const _0x5ef702=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x24aadc),_0x21f9e2[_0x62d5bc(0x1c0)]['name']);_0x5ef702[_0x62d5bc(0x1da)]&&this[_0x62d5bc(0x190)][_0x62d5bc(0x1cd)](_0x62d5bc(0x188)+a133_0x1a611e['basename'](_0x5ef702['oldPath'])+_0x62d5bc(0x1fe)+a133_0x1a611e[_0x62d5bc(0x1c5)](_0x5ef702[_0x62d5bc(0x11a)]));const _0x824b17=_0x5ef702[_0x62d5bc(0x11a)],_0x927446=a133_0x1a611e[_0x62d5bc(0x1fb)](_0x824b17,sanitizeForFilesystem(_0x21f9e2[_0x62d5bc(0x1c0)][_0x62d5bc(0x1a1)])+'.yml'),_0x106fdc=a133_0x1a611e[_0x62d5bc(0x1fb)](_0x824b17,_0x62d5bc(0x1a8)),_0x16b85d=a133_0x1a611e[_0x62d5bc(0x1fb)](_0x824b17,_0x62d5bc(0x1ac)),_0x3ba8b4=apiExperimentalArtifactToYaml(_0x21f9e2),_0xc34221=toExperimentalArtifactYamlString(_0x3ba8b4),_0x228dcb=!a133_0x4b9de3['existsSync'](_0x824b17);let _0x449bf2=_0x228dcb,_0x50a16c,_0x4f968a=_0xc34221+(_0x62d5bc(0x1a6)+_0x3ba8b4[_0x62d5bc(0x1ff)]+'\x0a');const _0x2d26c8=[..._0x3ba8b4['files']]['sort']((_0x2d41e6,_0x36a71d)=>_0x2d41e6[_0x62d5bc(0x13d)]['localeCompare'](_0x36a71d['file_name']));for(const _0x57bd12 of _0x2d26c8){_0x4f968a+=_0x62d5bc(0x18b)+_0x57bd12['file_name']+_0x62d5bc(0x1f7)+_0x57bd12[_0x62d5bc(0x114)]+'\x0a';}if(!_0x228dcb){let _0x5c3eb2='';a133_0x4b9de3[_0x62d5bc(0x1a4)](_0x927446)&&(_0x5c3eb2=a133_0x4b9de3[_0x62d5bc(0x207)](_0x927446,'utf-8'));a133_0x4b9de3['existsSync'](_0x106fdc)&&(_0x5c3eb2+='\x0a---\x20code\x20---\x0a'+a133_0x4b9de3[_0x62d5bc(0x207)](_0x106fdc,_0x62d5bc(0x1d2))+'\x0a');if(a133_0x4b9de3['existsSync'](_0x16b85d)){const _0x23a48b=a133_0x4b9de3[_0x62d5bc(0x1c4)](_0x16b85d),_0x54342a=_0x23a48b[_0x62d5bc(0x1e4)](_0x22c28e=>{const _0x147fe1=_0x62d5bc,_0xf885a4=a133_0x1a611e[_0x147fe1(0x1fb)](_0x16b85d,_0x22c28e);return a133_0x4b9de3[_0x147fe1(0x129)](_0xf885a4)['isFile']();})[_0x62d5bc(0x11c)]((_0x13c5ed,_0x36bbd5)=>_0x13c5ed[_0x62d5bc(0x1cf)](_0x36bbd5));for(const _0x43ed09 of _0x54342a){const _0x21cc59=a133_0x1a611e[_0x62d5bc(0x1fb)](_0x16b85d,_0x43ed09);_0x5c3eb2+='---\x20file:\x20'+_0x43ed09+_0x62d5bc(0x1f7)+a133_0x4b9de3[_0x62d5bc(0x207)](_0x21cc59,'utf-8')+'\x0a';}}const _0x56ce9a=generateDiff(_0x5c3eb2,_0x4f968a);_0x449bf2=hasChanges(_0x56ce9a),_0x449bf2&&(_0x50a16c=formatDiffWithColors(_0x56ce9a));}_0x5916e8['push']({'path':_0x824b17,'content':'','isDir':!![]}),_0x5916e8[_0x62d5bc(0x194)]({'path':_0x927446,'content':_0xc34221}),_0x5916e8[_0x62d5bc(0x194)]({'path':_0x106fdc,'content':_0x3ba8b4['code']});if(_0x3ba8b4[_0x62d5bc(0x1ac)][_0x62d5bc(0x11f)]>0x0){_0x5916e8[_0x62d5bc(0x194)]({'path':_0x16b85d,'content':'','isDir':!![]});for(const _0x238bd7 of _0x3ba8b4['files']){const _0x54518f=a133_0x1a611e[_0x62d5bc(0x1fb)](_0x16b85d,_0x238bd7['file_name']);_0x5916e8[_0x62d5bc(0x194)]({'path':_0x54518f,'content':_0x238bd7[_0x62d5bc(0x114)]});}}if(a133_0x4b9de3[_0x62d5bc(0x1a4)](_0x16b85d)){const _0x21a8e3=a133_0x4b9de3[_0x62d5bc(0x1c4)](_0x16b85d),_0x3380ea=new Set(_0x3ba8b4[_0x62d5bc(0x1ac)][_0x62d5bc(0x179)](_0x4e6a7e=>_0x4e6a7e[_0x62d5bc(0x13d)]));for(const _0x548f8c of _0x21a8e3){const _0x322f0f=a133_0x1a611e['join'](_0x16b85d,_0x548f8c);a133_0x4b9de3[_0x62d5bc(0x129)](_0x322f0f)['isFile']()&&!_0x3380ea[_0x62d5bc(0x1d1)](_0x548f8c)&&_0x92301[_0x62d5bc(0x194)]({'path':_0x322f0f});}}_0x20291d['experimentalArtifacts'][_0x62d5bc(0x194)]({'name':_0x21f9e2[_0x62d5bc(0x1c0)][_0x62d5bc(0x1a1)],'outputPath':_0x824b17,'isNew':_0x228dcb,'hasChanges':_0x449bf2,'diff':_0x50a16c}),_0x20291d[_0x62d5bc(0x1cc)][_0x62d5bc(0x112)][_0x62d5bc(0x172)]++;if(_0x228dcb)_0x20291d[_0x62d5bc(0x1cc)][_0x62d5bc(0x112)][_0x62d5bc(0x1e9)]++;else{if(_0x449bf2)_0x20291d[_0x62d5bc(0x1cc)][_0x62d5bc(0x112)][_0x62d5bc(0x11d)]++;else _0x20291d['counts'][_0x62d5bc(0x112)][_0x62d5bc(0x186)]++;}}if(_0x4dba81?.[_0x62d5bc(0x10e)])return _0x20291d;a133_0x4b9de3[_0x62d5bc(0x13c)](_0x24aadc,{'recursive':!![]}),a133_0x4b9de3[_0x62d5bc(0x13c)](getKnowledgeBasesDir(_0x24aadc),{'recursive':!![]}),a133_0x4b9de3[_0x62d5bc(0x13c)](getPromptsDir(_0x24aadc),{'recursive':!![]}),a133_0x4b9de3[_0x62d5bc(0x13c)](getIntegrationsDir(_0x24aadc),{'recursive':!![]}),a133_0x4b9de3[_0x62d5bc(0x13c)](getExperimentalKnowledgeBasesDir(_0x24aadc),{'recursive':!![]}),a133_0x4b9de3[_0x62d5bc(0x13c)](getExperimentalArtifactsDir(_0x24aadc),{'recursive':!![]});const _0x491e77=a133_0x1a611e[_0x62d5bc(0x1fb)](_0x24aadc,_0x62d5bc(0x11e));a133_0x4b9de3[_0x62d5bc(0x141)](_0x491e77,createAgentConfigContent(_0x510e14));for(const _0x375a4b of _0x5916e8){if(_0x375a4b[_0x62d5bc(0x139)])a133_0x4b9de3['mkdirSync'](_0x375a4b['path'],{'recursive':!![]});else{const _0x232a14=a133_0x1a611e['dirname'](_0x375a4b[_0x62d5bc(0x11a)]);!a133_0x4b9de3[_0x62d5bc(0x1a4)](_0x232a14)&&a133_0x4b9de3['mkdirSync'](_0x232a14,{'recursive':!![]}),a133_0x4b9de3[_0x62d5bc(0x141)](_0x375a4b[_0x62d5bc(0x11a)],_0x375a4b['content']);}}for(const _0xb5687d of _0x92301){_0xb5687d['isDir']?(a133_0x4b9de3[_0x62d5bc(0x1df)](_0xb5687d[_0x62d5bc(0x11a)],{'recursive':!![],'force':!![]}),this['logger']['info']('Removed\x20deleted\x20directory:\x20'+a133_0x1a611e[_0x62d5bc(0x1c5)](a133_0x1a611e['dirname'](_0xb5687d['path']))+'/'+a133_0x1a611e[_0x62d5bc(0x1c5)](_0xb5687d['path']))):(a133_0x4b9de3[_0x62d5bc(0x1df)](_0xb5687d[_0x62d5bc(0x11a)],{'force':!![]}),this[_0x62d5bc(0x190)][_0x62d5bc(0x1cd)]('Removed\x20deleted\x20file:\x20'+a133_0x1a611e[_0x62d5bc(0x1c5)](a133_0x1a611e['dirname'](_0xb5687d[_0x62d5bc(0x11a)]))+'/'+a133_0x1a611e[_0x62d5bc(0x1c5)](_0xb5687d[_0x62d5bc(0x11a)])));}return _0x20291d;}async['pushProject'](_0x2eca00,_0x5a3f86){const _0x36ba09=a133_0x333ebb,_0x1cdab8=a133_0x1a611e[_0x36ba09(0x1fb)](_0x2eca00,_0x36ba09(0x11e));if(!a133_0x4b9de3[_0x36ba09(0x1a4)](_0x1cdab8))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x36ba09(0x206)+_0x2eca00,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x135348=loadAgentConfig(_0x1cdab8),_0x4e36a2=await this[_0x36ba09(0x1c2)](_0x135348[_0x36ba09(0x1d0)]),_0x1cd9db=await this[_0x36ba09(0x1e8)][_0x36ba09(0x146)](_0x4e36a2),_0x4301fb=_0x1cd9db['attributes'][_0x36ba09(0x1a1)],_0x2387ae={'projectName':_0x4301fb,'projectId':_0x4e36a2,'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}}},_0x25cdd5=[],_0x177cc0=[],_0x51c88e=[],_0x563277=[],_0x2d8261=[],_0x19363d=[],_0x9af7ae=a133_0x4b9de3[_0x36ba09(0x1c4)](_0x2eca00,{'withFileTypes':!![]});for(const _0xa087e6 of _0x9af7ae){if(!_0xa087e6[_0x36ba09(0x1a5)]())continue;if([_0x36ba09(0x202),_0x36ba09(0x16e),_0x36ba09(0x1de),_0x36ba09(0x16f),_0x36ba09(0x1a9)]['includes'](_0xa087e6[_0x36ba09(0x1a1)]))continue;const _0x1e6d75=a133_0x1a611e['join'](_0x2eca00,_0xa087e6[_0x36ba09(0x1a1)]);if(isAgentDir(_0x1e6d75)){const _0x5351f9=a133_0x1a611e['join'](_0x1e6d75,'agent.yml'),_0x20dcc1=a133_0x1a611e[_0x36ba09(0x1fb)](_0x1e6d75,_0x36ba09(0x198)),_0x4b59e6=a133_0x1a611e['join'](_0x1e6d75,_0x36ba09(0x1e2)),_0x250aff=parseAgentYaml(a133_0x4b9de3[_0x36ba09(0x207)](_0x5351f9,_0x36ba09(0x1d2)),_0x5351f9),_0x57e39f=a133_0x4b9de3[_0x36ba09(0x1a4)](_0x20dcc1)?a133_0x4b9de3['readFileSync'](_0x20dcc1,_0x36ba09(0x1d2)):'',_0x39336c=a133_0x4b9de3[_0x36ba09(0x1a4)](_0x4b59e6)?a133_0x4b9de3[_0x36ba09(0x207)](_0x4b59e6,_0x36ba09(0x1d2)):_0x250aff[_0x36ba09(0x16d)];_0x25cdd5[_0x36ba09(0x194)]({'name':_0x250aff['name'],'dir':_0x1e6d75,'yaml':_0x250aff,'systemPrompt':_0x57e39f,'starterMessage':_0x39336c});}}const _0x5b7669=getKnowledgeBasesDir(_0x2eca00);if(a133_0x4b9de3[_0x36ba09(0x1a4)](_0x5b7669)){const _0x4473ba=a133_0x4b9de3[_0x36ba09(0x1c4)](_0x5b7669);for(const _0x1d6f51 of _0x4473ba){const _0x365221=a133_0x1a611e['join'](_0x5b7669,_0x1d6f51);if(_0x1d6f51['endsWith']('.yml')){const _0x4aad1e=parseKnowledgeBaseYaml(a133_0x4b9de3[_0x36ba09(0x207)](_0x365221,_0x36ba09(0x1d2)),_0x365221);_0x177cc0[_0x36ba09(0x194)]({'name':_0x4aad1e[_0x36ba09(0x1a1)],'path':_0x365221,'yaml':_0x4aad1e});}else{if(_0x1d6f51[_0x36ba09(0x1ca)](_0x36ba09(0x113))){const _0x196e6a=a133_0x4b9de3[_0x36ba09(0x207)](_0x365221,_0x36ba09(0x1d2)),{name:_0x55661f,text:_0x1a838d}=parseTextKnowledgeBaseMd(_0x196e6a,_0x1d6f51);_0x51c88e['push']({'name':_0x55661f,'path':_0x365221,'text':_0x1a838d});}}}}const _0x49fe3e=getPromptsDir(_0x2eca00);if(a133_0x4b9de3[_0x36ba09(0x1a4)](_0x49fe3e)){const _0x582f20=a133_0x4b9de3[_0x36ba09(0x1c4)](_0x49fe3e)[_0x36ba09(0x1e4)](_0x3612d3=>_0x3612d3[_0x36ba09(0x1ca)](_0x36ba09(0x124)));for(const _0x753a5b of _0x582f20){const _0x32f82e=a133_0x1a611e[_0x36ba09(0x1fb)](_0x49fe3e,_0x753a5b),_0x31f7f6=parsePromptYaml(a133_0x4b9de3['readFileSync'](_0x32f82e,'utf-8'),_0x32f82e);_0x563277[_0x36ba09(0x194)]({'name':_0x31f7f6[_0x36ba09(0x1a1)],'path':_0x32f82e,'yaml':_0x31f7f6});}}const _0x49d04e=[],_0x42e52f=getIntegrationsDir(_0x2eca00);if(a133_0x4b9de3['existsSync'](_0x42e52f)){const _0x59285a=a133_0x4b9de3[_0x36ba09(0x1c4)](_0x42e52f)[_0x36ba09(0x1e4)](_0x4fd172=>_0x4fd172[_0x36ba09(0x1ca)](_0x36ba09(0x124)));for(const _0x8d7612 of _0x59285a){const _0x5cae80=a133_0x1a611e['join'](_0x42e52f,_0x8d7612),_0x36675c=parseIntegrationYaml(a133_0x4b9de3[_0x36ba09(0x207)](_0x5cae80,_0x36ba09(0x1d2)),_0x5cae80);if(!SAFE_INTEGRATION_TYPES[_0x36ba09(0x1aa)](_0x36675c[_0x36ba09(0x156)][_0x36ba09(0x108)]())){this[_0x36ba09(0x190)][_0x36ba09(0x148)]('Skipping\x20integration\x20\x27'+_0x36675c[_0x36ba09(0x1a1)]+'\x27\x20('+_0x36675c[_0x36ba09(0x156)]+_0x36ba09(0x180)+(_0x36ba09(0x1bc)+SAFE_INTEGRATION_TYPES[_0x36ba09(0x1fb)](',\x20')+')\x20can\x20be\x20pushed.\x20')+_0x36ba09(0x1b6));continue;}_0x49d04e['push']({'name':_0x36675c[_0x36ba09(0x1a1)],'path':_0x5cae80,'yaml':_0x36675c});}}const _0x15a07a=getExperimentalKnowledgeBasesDir(_0x2eca00);if(a133_0x4b9de3['existsSync'](_0x15a07a)){const _0x15e0da=a133_0x4b9de3[_0x36ba09(0x1c4)](_0x15a07a,{'withFileTypes':!![]});for(const _0xbbf82d of _0x15e0da){if(!_0xbbf82d[_0x36ba09(0x1a5)]())continue;const _0x2c10ea=a133_0x1a611e[_0x36ba09(0x1fb)](_0x15a07a,_0xbbf82d[_0x36ba09(0x1a1)]),_0x234809=a133_0x1a611e['join'](_0x2c10ea,_0xbbf82d[_0x36ba09(0x1a1)]+_0x36ba09(0x124)),_0x13731b=a133_0x1a611e[_0x36ba09(0x1fb)](_0x2c10ea,_0x36ba09(0x126));if(!a133_0x4b9de3[_0x36ba09(0x1a4)](_0x234809))continue;const _0x4e101b=parseExperimentalKnowledgeBaseYaml(a133_0x4b9de3[_0x36ba09(0x207)](_0x234809,_0x36ba09(0x1d2)),_0x234809),_0x9a6b53=[];if(a133_0x4b9de3[_0x36ba09(0x1a4)](_0x13731b)){const _0x24566c=a133_0x4b9de3[_0x36ba09(0x1c4)](_0x13731b,{'withFileTypes':!![]});for(const _0x344b02 of _0x24566c){if(!_0x344b02[_0x36ba09(0x1a5)]())continue;const _0x34a2fe=a133_0x1a611e[_0x36ba09(0x1fb)](_0x13731b,_0x344b02[_0x36ba09(0x1a1)]),_0x49e08e=a133_0x1a611e[_0x36ba09(0x1fb)](_0x34a2fe,'code.js'),_0x1bba73=a133_0x1a611e[_0x36ba09(0x1fb)](_0x34a2fe,_0x36ba09(0x140));a133_0x4b9de3[_0x36ba09(0x1a4)](_0x49e08e)&&a133_0x4b9de3[_0x36ba09(0x1a4)](_0x1bba73)&&_0x9a6b53[_0x36ba09(0x194)]({'name':_0x344b02['name'],'code':a133_0x4b9de3['readFileSync'](_0x49e08e,_0x36ba09(0x1d2)),'json_schema':a133_0x4b9de3['readFileSync'](_0x1bba73,_0x36ba09(0x1d2))});}}const _0x4133df={..._0x4e101b,'variables':_0x4e101b[_0x36ba09(0x14c)]||[],'functions':_0x9a6b53};_0x2d8261[_0x36ba09(0x194)]({'name':_0x4e101b[_0x36ba09(0x1a1)],'dir':_0x2c10ea,'def':_0x4133df});}}const _0x26b161=getExperimentalArtifactsDir(_0x2eca00);if(a133_0x4b9de3[_0x36ba09(0x1a4)](_0x26b161)){const _0x19f950=a133_0x4b9de3[_0x36ba09(0x1c4)](_0x26b161,{'withFileTypes':!![]});for(const _0x174468 of _0x19f950){if(!_0x174468['isDirectory']())continue;const _0x2b8439=a133_0x1a611e[_0x36ba09(0x1fb)](_0x26b161,_0x174468[_0x36ba09(0x1a1)]),_0x301261=a133_0x1a611e['join'](_0x2b8439,_0x174468[_0x36ba09(0x1a1)]+_0x36ba09(0x124)),_0x5dcc7b=a133_0x1a611e[_0x36ba09(0x1fb)](_0x2b8439,'code.js'),_0x584396=a133_0x1a611e[_0x36ba09(0x1fb)](_0x2b8439,_0x36ba09(0x1ac));if(!a133_0x4b9de3['existsSync'](_0x301261)||!a133_0x4b9de3[_0x36ba09(0x1a4)](_0x5dcc7b))continue;const _0x44712e=parseExperimentalArtifactYaml(a133_0x4b9de3[_0x36ba09(0x207)](_0x301261,'utf-8'),_0x301261),_0x185e4c=a133_0x4b9de3[_0x36ba09(0x207)](_0x5dcc7b,_0x36ba09(0x1d2)),_0x27a6ae=[];if(a133_0x4b9de3[_0x36ba09(0x1a4)](_0x584396)){const _0x1a3f97=a133_0x4b9de3['readdirSync'](_0x584396);for(const _0x5883d2 of _0x1a3f97){const _0x45f060=a133_0x1a611e[_0x36ba09(0x1fb)](_0x584396,_0x5883d2);a133_0x4b9de3[_0x36ba09(0x129)](_0x45f060)[_0x36ba09(0x15d)]()&&_0x27a6ae['push']({'file_name':_0x5883d2,'text_content':a133_0x4b9de3[_0x36ba09(0x207)](_0x45f060,'utf-8')});}}const _0x251d20={..._0x44712e,'code':_0x185e4c,'files':_0x27a6ae};_0x19363d[_0x36ba09(0x194)]({'name':_0x44712e[_0x36ba09(0x1a1)],'dir':_0x2b8439,'def':_0x251d20});}}const _0xf097cd=await this[_0x36ba09(0x1e8)][_0x36ba09(0x166)](_0x4e36a2),_0x9b7909=await this[_0x36ba09(0x1e8)]['listKnowledgeBases'](_0x4e36a2),_0x1f0749=await this[_0x36ba09(0x1e8)]['listTextKnowledgeBases'](_0x4e36a2),_0xc1b26d=await this[_0x36ba09(0x1e8)]['listPrompts'](_0x4e36a2),_0xa06901=await this['client'][_0x36ba09(0x15b)](_0x4e36a2),_0x40bffb=await safeListOrEmpty(()=>this['client'][_0x36ba09(0x15e)](_0x4e36a2)),_0x75b2ac=await safeListOrEmpty(()=>this[_0x36ba09(0x1e8)][_0x36ba09(0x1a7)](_0x4e36a2)),_0x51b122=await fetchAllToolTargetMaps((_0x4093ac,_0xbc132b)=>this['client']['listToolTargets'](_0x4093ac,_0xbc132b),_0x4e36a2),_0x1dce98=new Map(),_0x415135=new Map(),_0x1d64a9=new Map(),_0x28daf8=new Map(),_0x1f4b03=new Map(),_0x535019=new Map(),_0x34d601=new Map();for(const _0x2929e7 of _0xf097cd){_0x1dce98[_0x36ba09(0x13a)](_0x2929e7['attributes']['name'],_0x2929e7);}for(const _0x407664 of _0x9b7909){_0x415135[_0x36ba09(0x13a)](_0x407664['attributes'][_0x36ba09(0x1a1)],_0x407664);}for(const _0x6ac594 of _0x1f0749){_0x1d64a9[_0x36ba09(0x13a)](_0x6ac594[_0x36ba09(0x1c0)][_0x36ba09(0x1a1)],_0x6ac594);}for(const _0x2e544a of _0xc1b26d){_0x28daf8[_0x36ba09(0x13a)](_0x2e544a[_0x36ba09(0x1c0)][_0x36ba09(0x1a1)],_0x2e544a);}for(const _0x45bfb5 of _0xa06901){_0x1f4b03[_0x36ba09(0x13a)](_0x45bfb5[_0x36ba09(0x1c0)][_0x36ba09(0x1c3)]['toLowerCase'](),_0x45bfb5);}for(const _0x5d4785 of _0x40bffb){_0x535019[_0x36ba09(0x13a)](_0x5d4785['attributes'][_0x36ba09(0x1a1)],_0x5d4785);}for(const _0x3ec9d1 of _0x75b2ac){_0x34d601['set'](_0x3ec9d1[_0x36ba09(0x1c0)][_0x36ba09(0x1a1)],_0x3ec9d1);}const _0x2b8769=new Map(),_0x161174=new Map();for(const _0x4b08f1 of _0xf097cd){_0x2b8769[_0x36ba09(0x13a)](_0x4b08f1['attributes'][_0x36ba09(0x1a1)],_0x4b08f1['id']),_0x161174[_0x36ba09(0x13a)](_0x4b08f1['id'],_0x4b08f1[_0x36ba09(0x1c0)][_0x36ba09(0x1a1)]);}const _0x46f375=new Map(),_0x64da28=new Map();for(const _0x34195c of _0xc1b26d){_0x46f375[_0x36ba09(0x13a)](_0x34195c[_0x36ba09(0x1c0)][_0x36ba09(0x1a1)],_0x34195c['id']),_0x64da28[_0x36ba09(0x13a)](_0x34195c['id'],_0x34195c[_0x36ba09(0x1c0)]['name']);}const _0xc62e20=_0x51b122[_0x36ba09(0x177)][_0x36ba09(0x136)]||new Map(),_0x21bf0d=_0x51b122['nameToId']['TextKnowledgeBase']||new Map(),_0x3d09b8=_0x51b122[_0x36ba09(0x177)][_0x36ba09(0x120)]||new Map(),_0x521e47=new Map(),_0x440202={'resolveToolTargetName':buildNameResolver({..._0x51b122['idToName'],'Agent':_0x161174}),'resolvePromptName':async _0x5d8cfd=>_0x64da28[_0x36ba09(0x1ec)](_0x5d8cfd),'onWarning':_0x1ea08e=>this[_0x36ba09(0x190)][_0x36ba09(0x148)](_0x1ea08e)};let _0x5ae597=[];const _0x2836c3={'projectId':_0x4e36a2,'resolveToolTargetId':buildIdResolver({..._0x51b122['nameToId'],'Agent':_0x2b8769}),'resolvePromptId':async _0x36e811=>_0x46f375[_0x36ba09(0x1ec)](_0x36e811),'onWarning':_0x5843a9=>{const _0x47042e=_0x36ba09;this[_0x47042e(0x190)]['warn'](_0x5843a9),_0x5ae597[_0x47042e(0x194)](_0x5843a9);}},{resolved:_0x375c25,unresolved:_0x37a7b2}=resolveAgentDependencies(_0x25cdd5,new Set(_0x1dce98[_0x36ba09(0x199)]()));for(const {agent:_0xc8815f,missingDeps:_0x20dc2c}of _0x37a7b2){_0x2387ae[_0x36ba09(0x19d)]['push']({'agentName':_0xc8815f[_0x36ba09(0x191)][_0x36ba09(0x1a1)],'action':'error','error':_0x36ba09(0x176)+_0x20dc2c[_0x36ba09(0x1fb)](',\x20')+_0x36ba09(0x1bb)}),_0x2387ae['counts'][_0x36ba09(0x19d)]['errors']++;}for(const _0x416ce6 of _0x177cc0){const _0x27fa1d=_0x415135[_0x36ba09(0x1ec)](_0x416ce6[_0x36ba09(0x191)][_0x36ba09(0x1a1)]),_0x4a8b62=a133_0x4b9de3[_0x36ba09(0x207)](_0x416ce6[_0x36ba09(0x11a)],_0x36ba09(0x1d2));if(_0x27fa1d){const _0xbc617f=apiKnowledgeBaseToYaml(_0x27fa1d),_0x592a14=toKnowledgeBaseYamlString(_0xbc617f),_0x41947b=generateDiff(_0x592a14,_0x4a8b62),_0x2c8523=hasChanges(_0x41947b);_0x2c8523?(_0x2387ae[_0x36ba09(0x118)]['push']({'name':_0x416ce6[_0x36ba09(0x191)]['name'],'action':'updated','id':_0x27fa1d['id'],'diff':formatDiffWithColors(_0x41947b)}),_0x2387ae[_0x36ba09(0x1cc)]['knowledgeBases'][_0x36ba09(0x11d)]++):(_0x2387ae['knowledgeBases']['push']({'name':_0x416ce6[_0x36ba09(0x191)][_0x36ba09(0x1a1)],'action':_0x36ba09(0x186),'id':_0x27fa1d['id']}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x118)][_0x36ba09(0x186)]++);}else _0x2387ae[_0x36ba09(0x118)][_0x36ba09(0x194)]({'name':_0x416ce6['yaml'][_0x36ba09(0x1a1)],'action':'created'}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x118)][_0x36ba09(0x1d7)]++;}for(const _0x1826d7 of _0x51c88e){const _0x4b9752=_0x1d64a9[_0x36ba09(0x1ec)](_0x1826d7[_0x36ba09(0x1a1)]),_0x3afeeb=a133_0x4b9de3[_0x36ba09(0x207)](_0x1826d7[_0x36ba09(0x11a)],_0x36ba09(0x1d2));if(_0x4b9752){const _0x2a6a70=toTextKnowledgeBaseMd(_0x4b9752[_0x36ba09(0x1c0)][_0x36ba09(0x1a1)],_0x4b9752[_0x36ba09(0x1c0)][_0x36ba09(0x10a)]),_0x5d85cc=generateDiff(_0x2a6a70,_0x3afeeb),_0x4f15b4=hasChanges(_0x5d85cc);_0x4f15b4?(_0x2387ae[_0x36ba09(0x135)][_0x36ba09(0x194)]({'name':_0x1826d7['name'],'action':_0x36ba09(0x11d),'id':_0x4b9752['id'],'diff':formatDiffWithColors(_0x5d85cc)}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x135)][_0x36ba09(0x11d)]++):(_0x2387ae[_0x36ba09(0x135)][_0x36ba09(0x194)]({'name':_0x1826d7['name'],'action':_0x36ba09(0x186),'id':_0x4b9752['id']}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x135)][_0x36ba09(0x186)]++);}else _0x2387ae[_0x36ba09(0x135)][_0x36ba09(0x194)]({'name':_0x1826d7[_0x36ba09(0x1a1)],'action':_0x36ba09(0x1d7)}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x135)][_0x36ba09(0x1d7)]++;}for(const _0x5e929d of _0x375c25){const _0x146ae2=_0x1dce98[_0x36ba09(0x1ec)](_0x5e929d[_0x36ba09(0x191)]['name']),_0x4bb14d=a133_0x1a611e[_0x36ba09(0x1fb)](_0x5e929d['dir'],'agent.yml'),_0x565a8a=a133_0x4b9de3['readFileSync'](_0x4bb14d,_0x36ba09(0x1d2)),_0x318746=_0x5e929d[_0x36ba09(0x157)],_0x45fed7=_0x36ba09(0x20c)+_0x318746+_0x36ba09(0x1db)+_0x565a8a;if(_0x146ae2){const {yaml:_0x557636,systemPrompt:_0x4c3964}=await agentResponseToDef(_0x146ae2,_0x440202),_0x2269f0=toAgentYamlString(_0x557636),_0x10c7a0='#\x20prompt.md\x0a'+_0x4c3964+_0x36ba09(0x1db)+_0x2269f0,_0x52ae94=generateDiff(_0x10c7a0,_0x45fed7),_0x3f12fe=hasChanges(_0x52ae94);_0x3f12fe?(_0x2387ae[_0x36ba09(0x19d)][_0x36ba09(0x194)]({'agentName':_0x5e929d[_0x36ba09(0x191)]['name'],'action':_0x36ba09(0x11d),'agentId':_0x146ae2['id'],'diff':formatDiffWithColors(_0x52ae94)}),_0x2387ae[_0x36ba09(0x1cc)]['agents'][_0x36ba09(0x11d)]++):(_0x2387ae[_0x36ba09(0x19d)][_0x36ba09(0x194)]({'agentName':_0x5e929d[_0x36ba09(0x191)][_0x36ba09(0x1a1)],'action':'unchanged','agentId':_0x146ae2['id']}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x19d)][_0x36ba09(0x186)]++);}else _0x2387ae['agents'][_0x36ba09(0x194)]({'agentName':_0x5e929d[_0x36ba09(0x191)][_0x36ba09(0x1a1)],'action':_0x36ba09(0x1d7)}),_0x2387ae['counts']['agents'][_0x36ba09(0x1d7)]++;}for(const _0x44d701 of _0x563277){const _0x56ba43=_0x28daf8[_0x36ba09(0x1ec)](_0x44d701[_0x36ba09(0x191)]['name']),_0x210074=a133_0x4b9de3[_0x36ba09(0x207)](_0x44d701[_0x36ba09(0x11a)],_0x36ba09(0x1d2));if(_0x56ba43){const _0x4e6fbf=await apiPromptToYaml(_0x56ba43,_0x440202);if(!_0x4e6fbf){_0x2387ae[_0x36ba09(0x16e)][_0x36ba09(0x194)]({'name':_0x44d701['yaml'][_0x36ba09(0x1a1)],'action':'updated','id':_0x56ba43['id']}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x16e)][_0x36ba09(0x11d)]++;continue;}const _0x324708=toPromptYamlString(_0x4e6fbf),_0x1e0191=generateDiff(_0x324708,_0x210074),_0x489623=hasChanges(_0x1e0191);_0x489623?(_0x2387ae[_0x36ba09(0x16e)]['push']({'name':_0x44d701[_0x36ba09(0x191)][_0x36ba09(0x1a1)],'action':_0x36ba09(0x11d),'id':_0x56ba43['id'],'diff':formatDiffWithColors(_0x1e0191)}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x16e)][_0x36ba09(0x11d)]++):(_0x2387ae[_0x36ba09(0x16e)][_0x36ba09(0x194)]({'name':_0x44d701[_0x36ba09(0x191)]['name'],'action':_0x36ba09(0x186),'id':_0x56ba43['id']}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x16e)]['unchanged']++);}else _0x2387ae[_0x36ba09(0x16e)][_0x36ba09(0x194)]({'name':_0x44d701[_0x36ba09(0x191)][_0x36ba09(0x1a1)],'action':'created'}),_0x2387ae[_0x36ba09(0x1cc)]['prompts']['created']++;}for(const _0x9d4fb7 of _0x49d04e){const _0x273145=_0x1f4b03['get'](_0x9d4fb7['yaml'][_0x36ba09(0x156)]),_0x3f90ac=a133_0x4b9de3[_0x36ba09(0x207)](_0x9d4fb7[_0x36ba09(0x11a)],_0x36ba09(0x1d2));if(_0x273145){const _0x49bc63=await apiIntegrationToYaml(_0x273145,_0x440202),_0x20dd78=toIntegrationYamlString(_0x49bc63),_0x3f2427=generateDiff(_0x20dd78,_0x3f90ac),_0x2e4233=hasChanges(_0x3f2427);_0x2e4233?(_0x2387ae[_0x36ba09(0x1de)][_0x36ba09(0x194)]({'name':_0x9d4fb7[_0x36ba09(0x191)]['service_type'],'action':_0x36ba09(0x11d),'id':_0x273145['id'],'diff':formatDiffWithColors(_0x3f2427)}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x1de)][_0x36ba09(0x11d)]++):(_0x2387ae[_0x36ba09(0x1de)][_0x36ba09(0x194)]({'name':_0x9d4fb7['yaml']['service_type'],'action':'unchanged','id':_0x273145['id']}),_0x2387ae[_0x36ba09(0x1cc)]['integrations'][_0x36ba09(0x186)]++);}else _0x2387ae[_0x36ba09(0x1de)][_0x36ba09(0x194)]({'name':_0x9d4fb7[_0x36ba09(0x191)][_0x36ba09(0x156)],'action':_0x36ba09(0x1d7)}),_0x2387ae['counts'][_0x36ba09(0x1de)][_0x36ba09(0x1d7)]++;}for(const _0x2be751 of _0x2d8261){const _0x590a65=_0x535019['get'](_0x2be751['def'][_0x36ba09(0x1a1)]),_0x553ff1=toExperimentalKnowledgeBaseYamlString(_0x2be751[_0x36ba09(0x147)]);let _0xd6db56=_0x553ff1;for(const _0x97c65a of _0x2be751[_0x36ba09(0x147)][_0x36ba09(0x126)]){_0xd6db56+='\x0a---\x20function:\x20'+_0x97c65a['name']+_0x36ba09(0x1f7)+_0x97c65a[_0x36ba09(0x1ff)]+_0x36ba09(0x1af)+_0x97c65a[_0x36ba09(0x1a1)]+'\x20---\x0a'+_0x97c65a[_0x36ba09(0x1fa)]+'\x0a';}if(_0x590a65){const _0x279cf3=apiExperimentalKnowledgeBaseToYaml(_0x590a65),_0x4f0902=toExperimentalKnowledgeBaseYamlString(_0x279cf3);let _0x247a0d=_0x4f0902;for(const _0x4e73d9 of _0x279cf3['functions']){_0x247a0d+='\x0a---\x20function:\x20'+_0x4e73d9['name']+_0x36ba09(0x1f7)+_0x4e73d9[_0x36ba09(0x1ff)]+_0x36ba09(0x1af)+_0x4e73d9[_0x36ba09(0x1a1)]+_0x36ba09(0x1f7)+_0x4e73d9[_0x36ba09(0x1fa)]+'\x0a';}const _0x139c1f=generateDiff(_0x247a0d,_0xd6db56),_0x13a628=hasChanges(_0x139c1f);_0x13a628?(_0x2387ae['experimentalKnowledgeBases'][_0x36ba09(0x194)]({'name':_0x2be751[_0x36ba09(0x147)][_0x36ba09(0x1a1)],'action':_0x36ba09(0x11d),'id':_0x590a65['id'],'diff':formatDiffWithColors(_0x139c1f)}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x1a0)][_0x36ba09(0x11d)]++):(_0x2387ae[_0x36ba09(0x1a0)][_0x36ba09(0x194)]({'name':_0x2be751[_0x36ba09(0x147)]['name'],'action':'unchanged','id':_0x590a65['id']}),_0x2387ae['counts']['experimentalKnowledgeBases'][_0x36ba09(0x186)]++);}else _0x2387ae[_0x36ba09(0x1a0)][_0x36ba09(0x194)]({'name':_0x2be751[_0x36ba09(0x147)][_0x36ba09(0x1a1)],'action':_0x36ba09(0x1d7)}),_0x2387ae[_0x36ba09(0x1cc)]['experimentalKnowledgeBases'][_0x36ba09(0x1d7)]++;}for(const _0xb7ae46 of _0x19363d){const _0x17ddf9=_0x34d601[_0x36ba09(0x1ec)](_0xb7ae46[_0x36ba09(0x147)][_0x36ba09(0x1a1)]),_0x15c435=toExperimentalArtifactYamlString(_0xb7ae46[_0x36ba09(0x147)]);let _0x21d3fd=_0x15c435+(_0x36ba09(0x1a6)+_0xb7ae46[_0x36ba09(0x147)][_0x36ba09(0x1ff)]+'\x0a');for(const _0xf4fbb5 of _0xb7ae46[_0x36ba09(0x147)][_0x36ba09(0x1ac)]){_0x21d3fd+=_0x36ba09(0x18b)+_0xf4fbb5[_0x36ba09(0x13d)]+_0x36ba09(0x1f7)+_0xf4fbb5[_0x36ba09(0x114)]+'\x0a';}if(_0x17ddf9){const _0x3e33e1=apiExperimentalArtifactToYaml(_0x17ddf9),_0x5d721b=toExperimentalArtifactYamlString(_0x3e33e1);let _0x2e9ecb=_0x5d721b+(_0x36ba09(0x1a6)+_0x3e33e1['code']+'\x0a');for(const _0x5b0913 of _0x3e33e1[_0x36ba09(0x1ac)]){_0x2e9ecb+='---\x20file:\x20'+_0x5b0913[_0x36ba09(0x13d)]+_0x36ba09(0x1f7)+_0x5b0913[_0x36ba09(0x114)]+'\x0a';}const _0x4dee33=generateDiff(_0x2e9ecb,_0x21d3fd),_0xaeebb3=hasChanges(_0x4dee33);_0xaeebb3?(_0x2387ae[_0x36ba09(0x112)][_0x36ba09(0x194)]({'name':_0xb7ae46[_0x36ba09(0x147)][_0x36ba09(0x1a1)],'action':_0x36ba09(0x11d),'id':_0x17ddf9['id'],'diff':formatDiffWithColors(_0x4dee33)}),_0x2387ae['counts'][_0x36ba09(0x112)][_0x36ba09(0x11d)]++):(_0x2387ae[_0x36ba09(0x112)][_0x36ba09(0x194)]({'name':_0xb7ae46['def']['name'],'action':_0x36ba09(0x186),'id':_0x17ddf9['id']}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x112)][_0x36ba09(0x186)]++);}else _0x2387ae['experimentalArtifacts']['push']({'name':_0xb7ae46[_0x36ba09(0x147)][_0x36ba09(0x1a1)],'action':_0x36ba09(0x1d7)}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x112)]['created']++;}if(_0x5a3f86?.['dryRun'])return _0x2387ae;_0x2387ae[_0x36ba09(0x118)]=[],_0x2387ae[_0x36ba09(0x135)]=[],_0x2387ae[_0x36ba09(0x16e)]=[],_0x2387ae[_0x36ba09(0x1de)]=[],_0x2387ae[_0x36ba09(0x1a0)]=[],_0x2387ae['experimentalArtifacts']=[];const _0x4dcb40=_0x2387ae['agents'][_0x36ba09(0x1e4)](_0x104f1f=>_0x104f1f['action']===_0x36ba09(0x12e));_0x2387ae[_0x36ba09(0x19d)]=_0x4dcb40,_0x2387ae['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x4dcb40['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 _0x20a57d of _0x177cc0){try{const _0x5c90be=_0x415135[_0x36ba09(0x1ec)](_0x20a57d[_0x36ba09(0x191)][_0x36ba09(0x1a1)]),_0x5d6244=yamlKnowledgeBaseToApi(_0x20a57d[_0x36ba09(0x191)],_0x4e36a2);if(_0x5c90be)await this[_0x36ba09(0x1e8)][_0x36ba09(0x18e)](_0x5c90be['id'],_0x5d6244),_0xc62e20[_0x36ba09(0x13a)](_0x20a57d[_0x36ba09(0x191)][_0x36ba09(0x1a1)],_0x5c90be['id']),_0x2387ae['knowledgeBases'][_0x36ba09(0x194)]({'name':_0x20a57d[_0x36ba09(0x191)][_0x36ba09(0x1a1)],'action':'updated','id':_0x5c90be['id']}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x118)][_0x36ba09(0x11d)]++;else{const _0x48e576=await this['client'][_0x36ba09(0x119)](_0x5d6244);_0xc62e20[_0x36ba09(0x13a)](_0x20a57d[_0x36ba09(0x191)][_0x36ba09(0x1a1)],_0x48e576['id']),_0x2387ae[_0x36ba09(0x118)][_0x36ba09(0x194)]({'name':_0x20a57d[_0x36ba09(0x191)]['name'],'action':_0x36ba09(0x1d7),'id':_0x48e576['id']}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x118)][_0x36ba09(0x1d7)]++;}}catch(_0x139cff){_0x2387ae['knowledgeBases'][_0x36ba09(0x194)]({'name':_0x20a57d['yaml']['name'],'action':_0x36ba09(0x12e),'error':_0x139cff[_0x36ba09(0x107)]}),_0x2387ae[_0x36ba09(0x1cc)]['knowledgeBases'][_0x36ba09(0x20b)]++;}}for(const _0x39a5e7 of _0x51c88e){try{const _0x10a716=_0x1d64a9['get'](_0x39a5e7[_0x36ba09(0x1a1)]),_0x357ea9=yamlTextKnowledgeBaseToApi({'name':_0x39a5e7[_0x36ba09(0x1a1)],'text':_0x39a5e7['text']},_0x4e36a2);if(_0x10a716)await this[_0x36ba09(0x1e8)][_0x36ba09(0x1c9)](_0x10a716['id'],_0x357ea9),_0x21bf0d[_0x36ba09(0x13a)](_0x39a5e7[_0x36ba09(0x1a1)],_0x10a716['id']),_0x2387ae[_0x36ba09(0x135)][_0x36ba09(0x194)]({'name':_0x39a5e7[_0x36ba09(0x1a1)],'action':_0x36ba09(0x11d),'id':_0x10a716['id']}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x135)][_0x36ba09(0x11d)]++;else{const _0x53c992=await this[_0x36ba09(0x1e8)][_0x36ba09(0x14d)](_0x357ea9);_0x21bf0d['set'](_0x39a5e7[_0x36ba09(0x1a1)],_0x53c992['id']),_0x2387ae[_0x36ba09(0x135)][_0x36ba09(0x194)]({'name':_0x39a5e7['name'],'action':_0x36ba09(0x1d7),'id':_0x53c992['id']}),_0x2387ae['counts']['textKnowledgeBases'][_0x36ba09(0x1d7)]++;}}catch(_0x1f3932){_0x2387ae[_0x36ba09(0x135)]['push']({'name':_0x39a5e7[_0x36ba09(0x1a1)],'action':_0x36ba09(0x12e),'error':_0x1f3932[_0x36ba09(0x107)]}),_0x2387ae[_0x36ba09(0x1cc)]['textKnowledgeBases'][_0x36ba09(0x20b)]++;}}for(const _0x175336 of _0x2d8261){try{const _0x1efc20=_0x535019[_0x36ba09(0x1ec)](_0x175336[_0x36ba09(0x147)]['name']),_0x1d88f7=yamlExperimentalKnowledgeBaseToApi(_0x175336['def'],_0x4e36a2);if(_0x1efc20)await this[_0x36ba09(0x1e8)]['updateExperimentalKnowledgeBase'](_0x1efc20['id'],_0x1d88f7),_0x3d09b8[_0x36ba09(0x13a)](_0x175336['def'][_0x36ba09(0x1a1)],_0x1efc20['id']),_0x2387ae[_0x36ba09(0x1a0)][_0x36ba09(0x194)]({'name':_0x175336[_0x36ba09(0x147)][_0x36ba09(0x1a1)],'action':'updated','id':_0x1efc20['id']}),_0x2387ae[_0x36ba09(0x1cc)]['experimentalKnowledgeBases'][_0x36ba09(0x11d)]++;else{const _0x1d95bb=await this[_0x36ba09(0x1e8)]['createExperimentalKnowledgeBase'](_0x1d88f7);_0x3d09b8[_0x36ba09(0x13a)](_0x175336[_0x36ba09(0x147)]['name'],_0x1d95bb['id']),_0x2387ae[_0x36ba09(0x1a0)][_0x36ba09(0x194)]({'name':_0x175336[_0x36ba09(0x147)][_0x36ba09(0x1a1)],'action':_0x36ba09(0x1d7),'id':_0x1d95bb['id']}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x1a0)][_0x36ba09(0x1d7)]++;}}catch(_0x5050a8){_0x2387ae[_0x36ba09(0x1a0)][_0x36ba09(0x194)]({'name':_0x175336['def']['name'],'action':'error','error':_0x5050a8[_0x36ba09(0x107)]}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x1a0)][_0x36ba09(0x20b)]++;}}for(const _0x5c1762 of _0x19363d){try{const _0x13e66f=_0x34d601[_0x36ba09(0x1ec)](_0x5c1762[_0x36ba09(0x147)][_0x36ba09(0x1a1)]),_0x46a73a=yamlExperimentalArtifactToApi(_0x5c1762['def'],_0x4e36a2);if(_0x13e66f)await this[_0x36ba09(0x1e8)][_0x36ba09(0x11b)](_0x13e66f['id'],_0x46a73a),_0x521e47[_0x36ba09(0x13a)](_0x5c1762[_0x36ba09(0x147)]['name'],_0x13e66f['id']),_0x2387ae[_0x36ba09(0x112)]['push']({'name':_0x5c1762[_0x36ba09(0x147)][_0x36ba09(0x1a1)],'action':'updated','id':_0x13e66f['id']}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x112)][_0x36ba09(0x11d)]++;else{const _0x2bb170=await this['client'][_0x36ba09(0x20d)](_0x46a73a);_0x521e47[_0x36ba09(0x13a)](_0x5c1762['def'][_0x36ba09(0x1a1)],_0x2bb170['id']),_0x2387ae[_0x36ba09(0x112)]['push']({'name':_0x5c1762[_0x36ba09(0x147)][_0x36ba09(0x1a1)],'action':_0x36ba09(0x1d7),'id':_0x2bb170['id']}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x112)][_0x36ba09(0x1d7)]++;}}catch(_0x1395d0){_0x2387ae['experimentalArtifacts']['push']({'name':_0x5c1762['def']['name'],'action':_0x36ba09(0x12e),'error':_0x1395d0[_0x36ba09(0x107)]}),_0x2387ae[_0x36ba09(0x1cc)]['experimentalArtifacts'][_0x36ba09(0x20b)]++;}}for(const _0x2a520e of _0x375c25){_0x5ae597=[];try{const _0x22e19d=_0x1dce98[_0x36ba09(0x1ec)](_0x2a520e[_0x36ba09(0x191)]['name']),_0x339be1=await agentDefToRequest(_0x2a520e[_0x36ba09(0x191)],_0x2a520e['systemPrompt'],_0x2a520e[_0x36ba09(0x1d5)],_0x2836c3);if(_0x22e19d)await this['client'][_0x36ba09(0x167)](_0x22e19d['id'],_0x339be1),_0x2b8769['set'](_0x2a520e[_0x36ba09(0x191)][_0x36ba09(0x1a1)],_0x22e19d['id']),_0x2387ae[_0x36ba09(0x19d)][_0x36ba09(0x194)]({'agentName':_0x2a520e['yaml'][_0x36ba09(0x1a1)],'action':_0x36ba09(0x11d),'agentId':_0x22e19d['id'],'warnings':_0x5ae597[_0x36ba09(0x11f)]>0x0?_0x5ae597:undefined}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x19d)][_0x36ba09(0x11d)]++;else{const _0x565468=await this['client'][_0x36ba09(0x1f2)](_0x339be1);_0x2b8769[_0x36ba09(0x13a)](_0x2a520e[_0x36ba09(0x191)][_0x36ba09(0x1a1)],_0x565468['id']),_0x2387ae['agents']['push']({'agentName':_0x2a520e[_0x36ba09(0x191)][_0x36ba09(0x1a1)],'action':'created','agentId':_0x565468['id'],'warnings':_0x5ae597[_0x36ba09(0x11f)]>0x0?_0x5ae597:undefined}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x19d)][_0x36ba09(0x1d7)]++;}}catch(_0x10c8cd){_0x2387ae[_0x36ba09(0x19d)]['push']({'agentName':_0x2a520e[_0x36ba09(0x191)]['name'],'action':_0x36ba09(0x12e),'error':_0x10c8cd[_0x36ba09(0x107)],'warnings':_0x5ae597[_0x36ba09(0x11f)]>0x0?_0x5ae597:undefined}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x19d)][_0x36ba09(0x20b)]++;}}for(const _0xc32b52 of _0x563277){try{const _0x122a6c=_0x28daf8['get'](_0xc32b52[_0x36ba09(0x191)][_0x36ba09(0x1a1)]),_0x18f2de=await yamlPromptToApi(_0xc32b52['yaml'],_0x4e36a2,_0x2836c3);if(!_0x18f2de){_0x2387ae[_0x36ba09(0x16e)][_0x36ba09(0x194)]({'name':_0xc32b52[_0x36ba09(0x191)][_0x36ba09(0x1a1)],'action':_0x36ba09(0x12e),'error':'Agent\x20reference\x20not\x20found'}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x16e)]['errors']++;continue;}if(_0x122a6c)await this['client'][_0x36ba09(0x1d6)](_0x122a6c['id'],_0x18f2de),_0x46f375[_0x36ba09(0x13a)](_0xc32b52[_0x36ba09(0x191)][_0x36ba09(0x1a1)],_0x122a6c['id']),_0x2387ae[_0x36ba09(0x16e)][_0x36ba09(0x194)]({'name':_0xc32b52[_0x36ba09(0x191)][_0x36ba09(0x1a1)],'action':'updated','id':_0x122a6c['id']}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x16e)]['updated']++;else{const _0x13e18d=await this[_0x36ba09(0x1e8)][_0x36ba09(0x1a3)](_0x18f2de);_0x46f375['set'](_0xc32b52[_0x36ba09(0x191)]['name'],_0x13e18d['id']),_0x2387ae['prompts']['push']({'name':_0xc32b52['yaml'][_0x36ba09(0x1a1)],'action':_0x36ba09(0x1d7),'id':_0x13e18d['id']}),_0x2387ae[_0x36ba09(0x1cc)]['prompts'][_0x36ba09(0x1d7)]++;}}catch(_0x12de5e){_0x2387ae[_0x36ba09(0x16e)]['push']({'name':_0xc32b52[_0x36ba09(0x191)]['name'],'action':_0x36ba09(0x12e),'error':_0x12de5e['message']}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x16e)][_0x36ba09(0x20b)]++;}}for(const _0x5c657f of _0x49d04e){try{const _0x129696=_0x1f4b03[_0x36ba09(0x1ec)](_0x5c657f[_0x36ba09(0x191)][_0x36ba09(0x156)]),_0x371363=await yamlIntegrationToApi(_0x5c657f[_0x36ba09(0x191)],_0x4e36a2,_0x2836c3);if(_0x129696){await this['client'][_0x36ba09(0x1b7)](_0x129696['id']);const _0x2376a7=await this['client'][_0x36ba09(0x1b1)](_0x371363);_0x2387ae[_0x36ba09(0x1de)]['push']({'name':_0x5c657f[_0x36ba09(0x191)][_0x36ba09(0x156)],'action':_0x36ba09(0x11d),'id':_0x2376a7['id']}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x1de)]['updated']++;}else{const _0x993f73=await this[_0x36ba09(0x1e8)][_0x36ba09(0x1b1)](_0x371363);_0x2387ae['integrations']['push']({'name':_0x5c657f[_0x36ba09(0x191)][_0x36ba09(0x156)],'action':'created','id':_0x993f73['id']}),_0x2387ae['counts'][_0x36ba09(0x1de)][_0x36ba09(0x1d7)]++;}}catch(_0x312022){_0x2387ae[_0x36ba09(0x1de)][_0x36ba09(0x194)]({'name':_0x5c657f[_0x36ba09(0x191)][_0x36ba09(0x156)],'action':_0x36ba09(0x12e),'error':_0x312022[_0x36ba09(0x107)]}),_0x2387ae[_0x36ba09(0x1cc)][_0x36ba09(0x1de)][_0x36ba09(0x20b)]++;}}return _0x2387ae;}async[a133_0x333ebb(0x1ba)](_0x42c61a,_0x4a3060,_0x4ecf02,_0x2cdb9f){const _0x115a53=a133_0x333ebb,{projectId:_0x281249,project:_0x5b253f}=await this['resolveProjectName'](_0x42c61a),_0x172509=_0x5b253f[_0x115a53(0x1c0)][_0x115a53(0x1a1)],_0x30dc8a=await this[_0x115a53(0x1e8)][_0x115a53(0x166)](_0x281249),_0x102595=_0x30dc8a[_0x115a53(0x1c1)](_0x3b8e3e=>_0x3b8e3e['attributes']['name']===_0x4a3060);if(!_0x102595)throw new SDKError(ErrorCode[_0x115a53(0x1ae)],'Agent\x20not\x20found:\x20'+_0x4a3060,undefined,{'helpText':_0x115a53(0x1b4)+_0x30dc8a[_0x115a53(0x179)](_0x4a40a6=>_0x4a40a6[_0x115a53(0x1c0)]['name'])[_0x115a53(0x1fb)](',\x20')});let _0x1f40f;if(_0x4ecf02)_0x1f40f=_0x4ecf02;else{const _0x23e823=a133_0x1a611e['join'](process[_0x115a53(0x116)](),'agents'),_0x2d8fab=getSanitizedPathWithMigration(_0x23e823,_0x172509);_0x2d8fab['renamed']&&this['logger'][_0x115a53(0x1cd)](_0x115a53(0x182)+a133_0x1a611e[_0x115a53(0x1c5)](_0x2d8fab[_0x115a53(0x1e7)])+'\x20→\x20'+a133_0x1a611e['basename'](_0x2d8fab[_0x115a53(0x11a)])),_0x1f40f=_0x2d8fab[_0x115a53(0x11a)];}const _0xebebe5=getSanitizedPathWithMigration(_0x1f40f,_0x4a3060);_0xebebe5[_0x115a53(0x1da)]&&this[_0x115a53(0x190)][_0x115a53(0x1cd)](_0x115a53(0x10b)+a133_0x1a611e[_0x115a53(0x1c5)](_0xebebe5[_0x115a53(0x1e7)])+'\x20→\x20'+a133_0x1a611e[_0x115a53(0x1c5)](_0xebebe5[_0x115a53(0x11a)]));const _0x2797b0=_0xebebe5[_0x115a53(0x11a)],_0x5d4c3e=new Map(),_0x400c9b=new Map(),_0x419992=await this[_0x115a53(0x1e8)][_0x115a53(0x143)](_0x281249),_0x2a7f3c=await this['client']['listTextKnowledgeBases'](_0x281249),_0x2b4042=await safeListOrEmpty(()=>this['client'][_0x115a53(0x15e)](_0x281249)),_0x2d445c=new Map(),_0x24feb6=new Map();for(const _0x448173 of _0x419992){_0x5d4c3e[_0x115a53(0x13a)](_0x448173['id'],_0x448173[_0x115a53(0x1c0)][_0x115a53(0x1a1)]);}for(const _0x479fa7 of _0x2a7f3c){_0x2d445c[_0x115a53(0x13a)](_0x479fa7['id'],_0x479fa7[_0x115a53(0x1c0)][_0x115a53(0x1a1)]);}for(const _0x36bab4 of _0x2b4042){_0x24feb6[_0x115a53(0x13a)](_0x36bab4['id'],_0x36bab4[_0x115a53(0x1c0)][_0x115a53(0x1a1)]);}for(const _0x3ec7fb of _0x30dc8a){_0x400c9b['set'](_0x3ec7fb['id'],_0x3ec7fb[_0x115a53(0x1c0)][_0x115a53(0x1a1)]);}const _0x354d55={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x5d4c3e,'TextKnowledgeBase':_0x2d445c,'Agent':_0x400c9b,'ExperimentalKnowledgeBase':_0x24feb6}),'resolvePromptName':async()=>undefined,'onWarning':_0x433ba6=>this[_0x115a53(0x190)][_0x115a53(0x148)](_0x433ba6)},_0x10f423=a133_0x1a611e[_0x115a53(0x1fb)](_0x2797b0,_0x115a53(0x198)),_0x1864ca=a133_0x1a611e['join'](_0x2797b0,_0x115a53(0x17e)),_0x267fdb=a133_0x1a611e[_0x115a53(0x1fb)](_0x2797b0,_0x115a53(0x1e2)),_0x4b025b=!a133_0x4b9de3[_0x115a53(0x1a4)](_0x1864ca);if(_0x2cdb9f?.['dryRun'])return{'agentName':_0x4a3060,'outputPath':_0x2797b0,'isNew':_0x4b025b,'hasChanges':!![]};a133_0x4b9de3[_0x115a53(0x13c)](_0x1f40f,{'recursive':!![]}),a133_0x4b9de3['mkdirSync'](_0x2797b0,{'recursive':!![]});const _0x47e5f9=a133_0x1a611e[_0x115a53(0x1fb)](_0x1f40f,'tdx.json');!a133_0x4b9de3[_0x115a53(0x1a4)](_0x47e5f9)&&a133_0x4b9de3[_0x115a53(0x141)](_0x47e5f9,createAgentConfigContent(_0x42c61a));const {yaml:_0x3526ee,systemPrompt:_0x4e2b05,starterMessage:_0x1cf806}=await agentResponseToDef(_0x102595,_0x354d55);let _0x46d2ef=_0x4b025b;if(!_0x4b025b){const _0x3e5ff3=a133_0x4b9de3[_0x115a53(0x1a4)](_0x10f423)?a133_0x4b9de3[_0x115a53(0x207)](_0x10f423,_0x115a53(0x1d2)):'',_0xeae08e=a133_0x4b9de3[_0x115a53(0x207)](_0x1864ca,_0x115a53(0x1d2));_0x46d2ef=_0x3e5ff3!==_0x4e2b05||_0xeae08e!==toAgentYamlString(_0x3526ee);}a133_0x4b9de3[_0x115a53(0x141)](_0x10f423,_0x4e2b05),a133_0x4b9de3['writeFileSync'](_0x1864ca,toAgentYamlString(_0x3526ee));if(_0x1cf806&&_0x1cf806[_0x115a53(0x1aa)]('\x0a'))a133_0x4b9de3[_0x115a53(0x141)](_0x267fdb,_0x1cf806);else a133_0x4b9de3[_0x115a53(0x1a4)](_0x267fdb)&&a133_0x4b9de3[_0x115a53(0x138)](_0x267fdb);return{'agentName':_0x4a3060,'outputPath':_0x2797b0,'isNew':_0x4b025b,'hasChanges':_0x46d2ef};}async['pushAgent'](_0x20087d,_0x5f368c){const _0x2ec9fc=a133_0x333ebb;let _0x6e0336;isAgentYamlPath(_0x20087d)?_0x6e0336=getAgentDirFromYamlPath(_0x20087d):_0x6e0336=_0x20087d;const {config:_0x159221}=findAgentConfig(_0x6e0336),_0x426651=await this['resolveProjectId'](_0x159221['llm_project']),_0x2d5f10=a133_0x1a611e[_0x2ec9fc(0x1fb)](_0x6e0336,_0x2ec9fc(0x17e)),_0x52df9e=a133_0x1a611e[_0x2ec9fc(0x1fb)](_0x6e0336,'prompt.md'),_0x4e341e=a133_0x1a611e[_0x2ec9fc(0x1fb)](_0x6e0336,_0x2ec9fc(0x1e2));if(!a133_0x4b9de3[_0x2ec9fc(0x1a4)](_0x2d5f10))throw new SDKError(ErrorCode[_0x2ec9fc(0x1d4)],'agent.yml\x20not\x20found\x20in\x20'+_0x6e0336,undefined,{'helpText':_0x2ec9fc(0x20a)});const _0x560e71=parseAgentYaml(a133_0x4b9de3['readFileSync'](_0x2d5f10,_0x2ec9fc(0x1d2)),_0x2d5f10),_0x4a1c91=a133_0x4b9de3[_0x2ec9fc(0x1a4)](_0x52df9e)?a133_0x4b9de3[_0x2ec9fc(0x207)](_0x52df9e,'utf-8'):'',_0x251f96=a133_0x4b9de3['existsSync'](_0x4e341e)?a133_0x4b9de3[_0x2ec9fc(0x207)](_0x4e341e,'utf-8'):_0x560e71[_0x2ec9fc(0x16d)];if(_0x5f368c?.[_0x2ec9fc(0x10e)])return{'agentName':_0x560e71[_0x2ec9fc(0x1a1)],'action':_0x2ec9fc(0x1d7),'projectId':_0x426651};const _0xb9d7a2=await this[_0x2ec9fc(0x1e8)]['listAgentsFull'](_0x426651),_0x34ce4b=await fetchAllToolTargetMaps((_0x1ec349,_0x177217)=>this[_0x2ec9fc(0x1e8)][_0x2ec9fc(0x168)](_0x1ec349,_0x177217),_0x426651),_0xcfbd08=new Map();for(const _0x5c24d7 of _0xb9d7a2){_0xcfbd08[_0x2ec9fc(0x13a)](_0x5c24d7[_0x2ec9fc(0x1c0)][_0x2ec9fc(0x1a1)],_0x5c24d7['id']);}const _0x547ccf=[],_0x5a51fa={'projectId':_0x426651,'resolveToolTargetId':buildIdResolver({..._0x34ce4b[_0x2ec9fc(0x177)],'Agent':_0xcfbd08}),'resolvePromptId':async()=>undefined,'onWarning':_0x42d850=>{const _0x420fa1=_0x2ec9fc;this['logger'][_0x420fa1(0x148)](_0x42d850),_0x547ccf[_0x420fa1(0x194)](_0x42d850);}};try{const _0x25995f=_0xb9d7a2[_0x2ec9fc(0x1c1)](_0x163238=>_0x163238[_0x2ec9fc(0x1c0)][_0x2ec9fc(0x1a1)]===_0x560e71[_0x2ec9fc(0x1a1)]),_0x1dfaab=await agentDefToRequest(_0x560e71,_0x4a1c91,_0x251f96,_0x5a51fa);if(_0x25995f)return await this['client'][_0x2ec9fc(0x167)](_0x25995f['id'],_0x1dfaab),{'agentName':_0x560e71[_0x2ec9fc(0x1a1)],'action':_0x2ec9fc(0x11d),'projectId':_0x426651,'agentId':_0x25995f['id'],'warnings':_0x547ccf[_0x2ec9fc(0x11f)]>0x0?_0x547ccf:undefined};else{const _0x706244=await this[_0x2ec9fc(0x1e8)][_0x2ec9fc(0x1f2)](_0x1dfaab);return{'agentName':_0x560e71['name'],'action':_0x2ec9fc(0x1d7),'projectId':_0x426651,'agentId':_0x706244['id'],'warnings':_0x547ccf[_0x2ec9fc(0x11f)]>0x0?_0x547ccf:undefined};}}catch(_0x1195e7){return{'agentName':_0x560e71[_0x2ec9fc(0x1a1)],'action':_0x2ec9fc(0x12e),'projectId':_0x426651,'error':_0x1195e7[_0x2ec9fc(0x107)],'warnings':_0x547ccf[_0x2ec9fc(0x11f)]>0x0?_0x547ccf:undefined};}}async[a133_0x333ebb(0x115)](_0x3d96e7,_0x41ba70,_0x926daf){const _0xaeadff=a133_0x333ebb,_0x24e9e9=a133_0x4b9de3[_0xaeadff(0x1a4)](_0x3d96e7)&&a133_0x4b9de3[_0xaeadff(0x1a4)](a133_0x1a611e[_0xaeadff(0x1fb)](_0x3d96e7,'tdx.json'));let _0x265b71;const _0x4fbe01=[],_0x49339f=[],_0x44dd73=[],_0x3b46bd=[],_0x427c75=[],_0x334d15=[],_0x4b1963=[];if(_0x24e9e9){const _0x5eede2=loadAgentConfig(a133_0x1a611e[_0xaeadff(0x1fb)](_0x3d96e7,_0xaeadff(0x11e)));_0x265b71=_0x5eede2[_0xaeadff(0x1d0)];const _0x24d620=a133_0x4b9de3['readdirSync'](_0x3d96e7,{'withFileTypes':!![]});for(const _0xd99390 of _0x24d620){if(!_0xd99390[_0xaeadff(0x1a5)]())continue;if(['knowledge_bases',_0xaeadff(0x16f),_0xaeadff(0x1a9),_0xaeadff(0x16e),_0xaeadff(0x1de)][_0xaeadff(0x1aa)](_0xd99390[_0xaeadff(0x1a1)]))continue;const _0x4f7d34=a133_0x1a611e[_0xaeadff(0x1fb)](_0x3d96e7,_0xd99390[_0xaeadff(0x1a1)]);if(isAgentDir(_0x4f7d34)){const _0x5896ce=a133_0x1a611e[_0xaeadff(0x1fb)](_0x4f7d34,_0xaeadff(0x17e)),_0x233d15=a133_0x1a611e[_0xaeadff(0x1fb)](_0x4f7d34,_0xaeadff(0x198)),_0x18c2e4=a133_0x1a611e[_0xaeadff(0x1fb)](_0x4f7d34,'starter_message.md'),_0x95cbd6=parseAgentYaml(a133_0x4b9de3[_0xaeadff(0x207)](_0x5896ce,'utf-8'),_0x5896ce),_0x4f3fd2=a133_0x4b9de3[_0xaeadff(0x1a4)](_0x233d15)?a133_0x4b9de3[_0xaeadff(0x207)](_0x233d15,_0xaeadff(0x1d2)):'',_0x3d14a3=a133_0x4b9de3[_0xaeadff(0x1a4)](_0x18c2e4)?a133_0x4b9de3[_0xaeadff(0x207)](_0x18c2e4,_0xaeadff(0x1d2)):_0x95cbd6[_0xaeadff(0x16d)];_0x4fbe01[_0xaeadff(0x194)]({'name':_0x95cbd6[_0xaeadff(0x1a1)],'dir':_0x4f7d34,'yaml':_0x95cbd6,'systemPrompt':_0x4f3fd2,'starterMessage':_0x3d14a3});}}const _0x26e145=getKnowledgeBasesDir(_0x3d96e7);if(a133_0x4b9de3[_0xaeadff(0x1a4)](_0x26e145)){const _0xc99a31=a133_0x4b9de3[_0xaeadff(0x1c4)](_0x26e145);for(const _0x3c6256 of _0xc99a31){const _0x376cc3=a133_0x1a611e[_0xaeadff(0x1fb)](_0x26e145,_0x3c6256);if(_0x3c6256[_0xaeadff(0x1ca)](_0xaeadff(0x124))){const _0x1aa03a=parseKnowledgeBaseYaml(a133_0x4b9de3[_0xaeadff(0x207)](_0x376cc3,_0xaeadff(0x1d2)),_0x376cc3);_0x49339f[_0xaeadff(0x194)]({'name':_0x1aa03a[_0xaeadff(0x1a1)],'path':_0x376cc3,'yaml':_0x1aa03a});}else{if(_0x3c6256[_0xaeadff(0x1ca)](_0xaeadff(0x113))){const _0x1c6b6c=a133_0x4b9de3[_0xaeadff(0x207)](_0x376cc3,_0xaeadff(0x1d2)),{name:_0x91a192,text:_0x281327}=parseTextKnowledgeBaseMd(_0x1c6b6c,_0x3c6256);_0x44dd73[_0xaeadff(0x194)]({'name':_0x91a192,'path':_0x376cc3,'text':_0x281327});}}}}const _0x51b269=getPromptsDir(_0x3d96e7);if(a133_0x4b9de3[_0xaeadff(0x1a4)](_0x51b269)){const _0x570361=a133_0x4b9de3[_0xaeadff(0x1c4)](_0x51b269)[_0xaeadff(0x1e4)](_0x536053=>_0x536053[_0xaeadff(0x1ca)](_0xaeadff(0x124)));for(const _0x184fd5 of _0x570361){const _0x303305=a133_0x1a611e[_0xaeadff(0x1fb)](_0x51b269,_0x184fd5),_0x36ed1e=parsePromptYaml(a133_0x4b9de3[_0xaeadff(0x207)](_0x303305,_0xaeadff(0x1d2)),_0x303305);_0x3b46bd['push']({'name':_0x36ed1e[_0xaeadff(0x1a1)],'path':_0x303305,'yaml':_0x36ed1e});}}const _0x30e2b0=getIntegrationsDir(_0x3d96e7);if(a133_0x4b9de3['existsSync'](_0x30e2b0)){const _0x248ee0=a133_0x4b9de3[_0xaeadff(0x1c4)](_0x30e2b0)[_0xaeadff(0x1e4)](_0x2a8ea0=>_0x2a8ea0[_0xaeadff(0x1ca)](_0xaeadff(0x124)));for(const _0x4b2264 of _0x248ee0){const _0x411879=a133_0x1a611e[_0xaeadff(0x1fb)](_0x30e2b0,_0x4b2264),_0xe8b93d=parseIntegrationYaml(a133_0x4b9de3[_0xaeadff(0x207)](_0x411879,_0xaeadff(0x1d2)),_0x411879);SAFE_INTEGRATION_TYPES[_0xaeadff(0x1aa)](_0xe8b93d['service_type'][_0xaeadff(0x108)]())?_0x427c75[_0xaeadff(0x194)]({'name':_0xe8b93d[_0xaeadff(0x1a1)],'path':_0x411879,'yaml':_0xe8b93d}):this[_0xaeadff(0x190)]['warn']('Skipping\x20integration\x20\x27'+_0xe8b93d[_0xaeadff(0x1a1)]+_0xaeadff(0x187)+_0xe8b93d[_0xaeadff(0x156)]+_0xaeadff(0x180)+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES[_0xaeadff(0x1fb)](',\x20')+')\x20can\x20be\x20cloned.'));}}const _0x250c92=getExperimentalKnowledgeBasesDir(_0x3d96e7);if(a133_0x4b9de3[_0xaeadff(0x1a4)](_0x250c92)){const _0x140809=a133_0x4b9de3['readdirSync'](_0x250c92,{'withFileTypes':!![]});for(const _0x3ca333 of _0x140809){if(!_0x3ca333[_0xaeadff(0x1a5)]())continue;const _0x2c1882=a133_0x1a611e[_0xaeadff(0x1fb)](_0x250c92,_0x3ca333[_0xaeadff(0x1a1)]),_0x427be1=a133_0x1a611e[_0xaeadff(0x1fb)](_0x2c1882,_0x3ca333[_0xaeadff(0x1a1)]+'.yml');if(a133_0x4b9de3[_0xaeadff(0x1a4)](_0x427be1)){const _0x30ffee=parseExperimentalKnowledgeBaseYaml(a133_0x4b9de3[_0xaeadff(0x207)](_0x427be1,_0xaeadff(0x1d2)),_0x427be1),_0xde093b=a133_0x1a611e[_0xaeadff(0x1fb)](_0x2c1882,_0xaeadff(0x126)),_0x2dbd61=[];if(a133_0x4b9de3[_0xaeadff(0x1a4)](_0xde093b)){const _0x495f2c=a133_0x4b9de3[_0xaeadff(0x1c4)](_0xde093b,{'withFileTypes':!![]});for(const _0x2b0fa6 of _0x495f2c){if(!_0x2b0fa6['isDirectory']())continue;const _0x303483=a133_0x1a611e[_0xaeadff(0x1fb)](_0xde093b,_0x2b0fa6[_0xaeadff(0x1a1)]),_0x4d250e=a133_0x1a611e[_0xaeadff(0x1fb)](_0x303483,'code.js'),_0x218b04=a133_0x1a611e[_0xaeadff(0x1fb)](_0x303483,_0xaeadff(0x140));if(a133_0x4b9de3['existsSync'](_0x4d250e)&&a133_0x4b9de3[_0xaeadff(0x1a4)](_0x218b04)){const _0x141d3a=a133_0x4b9de3[_0xaeadff(0x207)](_0x4d250e,'utf-8'),_0x32891a=a133_0x4b9de3['readFileSync'](_0x218b04,_0xaeadff(0x1d2));_0x2dbd61['push']({'name':_0x2b0fa6[_0xaeadff(0x1a1)],'code':_0x141d3a,'json_schema':_0x32891a});}}}const _0x4d29ff={..._0x30ffee,'functions':_0x2dbd61};_0x334d15[_0xaeadff(0x194)]({'name':_0x30ffee[_0xaeadff(0x1a1)],'path':_0x2c1882,'def':_0x4d29ff});}}}const _0x45b016=getExperimentalArtifactsDir(_0x3d96e7);if(a133_0x4b9de3[_0xaeadff(0x1a4)](_0x45b016)){const _0x10ac67=a133_0x4b9de3[_0xaeadff(0x1c4)](_0x45b016,{'withFileTypes':!![]});for(const _0x3ca77b of _0x10ac67){if(!_0x3ca77b[_0xaeadff(0x1a5)]())continue;const _0x2e488a=a133_0x1a611e[_0xaeadff(0x1fb)](_0x45b016,_0x3ca77b[_0xaeadff(0x1a1)]),_0xcfb71d=a133_0x1a611e['join'](_0x2e488a,_0x3ca77b[_0xaeadff(0x1a1)]+_0xaeadff(0x124));if(a133_0x4b9de3[_0xaeadff(0x1a4)](_0xcfb71d)){const _0x5f29fc=parseExperimentalArtifactYaml(a133_0x4b9de3['readFileSync'](_0xcfb71d,_0xaeadff(0x1d2)),_0xcfb71d),_0x3a55b5=a133_0x1a611e[_0xaeadff(0x1fb)](_0x2e488a,'code.js'),_0x3b978f=a133_0x4b9de3['existsSync'](_0x3a55b5)?a133_0x4b9de3[_0xaeadff(0x207)](_0x3a55b5,'utf-8'):'',_0x201acb=a133_0x1a611e[_0xaeadff(0x1fb)](_0x2e488a,_0xaeadff(0x1ac)),_0x3f188d=[];if(a133_0x4b9de3['existsSync'](_0x201acb)){const _0x382ec0=a133_0x4b9de3[_0xaeadff(0x1c4)](_0x201acb);for(const _0x3eacb4 of _0x382ec0){const _0x64005b=a133_0x1a611e[_0xaeadff(0x1fb)](_0x201acb,_0x3eacb4);if(a133_0x4b9de3[_0xaeadff(0x129)](_0x64005b)[_0xaeadff(0x15d)]()){const _0x37b006=a133_0x4b9de3[_0xaeadff(0x207)](_0x64005b,_0xaeadff(0x1d2));_0x3f188d[_0xaeadff(0x194)]({'file_name':_0x3eacb4,'text_content':_0x37b006});}}}const _0x2403a8={..._0x5f29fc,'code':_0x3b978f,'files':_0x3f188d};_0x4b1963['push']({'name':_0x5f29fc['name'],'path':_0x2e488a,'def':_0x2403a8});}}}}else{const _0x39a032=await this[_0xaeadff(0x1c2)](_0x3d96e7),_0x48ef0a=await this[_0xaeadff(0x1e8)][_0xaeadff(0x146)](_0x39a032);_0x265b71=_0x48ef0a['attributes'][_0xaeadff(0x1a1)];const _0x17f03e=await this['client'][_0xaeadff(0x166)](_0x39a032),_0x111246=await this[_0xaeadff(0x1e8)]['listKnowledgeBases'](_0x39a032),_0x5b3f28=await this[_0xaeadff(0x1e8)]['listTextKnowledgeBases'](_0x39a032),_0x5865a6=await this[_0xaeadff(0x1e8)]['listPrompts'](_0x39a032),_0x29bf9a=await this[_0xaeadff(0x1e8)][_0xaeadff(0x15b)](_0x39a032),_0x4d574a=await safeListOrEmpty(()=>this[_0xaeadff(0x1e8)][_0xaeadff(0x15e)](_0x39a032)),_0x534879=await safeListOrEmpty(()=>this[_0xaeadff(0x1e8)][_0xaeadff(0x1a7)](_0x39a032)),_0x5e3e54=new Map(),_0x318f42=new Map(),_0x382c0f=new Map(),_0x41cf60=new Map(),_0x20ec20=new Map(),_0x142971=new Map();for(const _0x396af2 of _0x111246){_0x5e3e54['set'](_0x396af2['id'],_0x396af2[_0xaeadff(0x1c0)][_0xaeadff(0x1a1)]);}for(const _0x31426a of _0x5b3f28){_0x318f42[_0xaeadff(0x13a)](_0x31426a['id'],_0x31426a['attributes']['name']);}for(const _0x4fa32d of _0x17f03e){_0x382c0f[_0xaeadff(0x13a)](_0x4fa32d['id'],_0x4fa32d[_0xaeadff(0x1c0)]['name']);}for(const _0x2f7ff5 of _0x5865a6){_0x41cf60[_0xaeadff(0x13a)](_0x2f7ff5['id'],_0x2f7ff5[_0xaeadff(0x1c0)][_0xaeadff(0x1a1)]);}for(const _0x411006 of _0x4d574a){_0x20ec20['set'](_0x411006['id'],_0x411006[_0xaeadff(0x1c0)]['name']);}for(const _0x4db066 of _0x534879){_0x142971[_0xaeadff(0x13a)](_0x4db066['id'],_0x4db066[_0xaeadff(0x1c0)][_0xaeadff(0x1a1)]);}const _0x54ee0b={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x5e3e54,'TextKnowledgeBase':_0x318f42,'Agent':_0x382c0f,'ExperimentalKnowledgeBase':_0x20ec20}),'resolvePromptName':async _0x166a66=>_0x41cf60[_0xaeadff(0x1ec)](_0x166a66),'onWarning':_0xcee230=>this[_0xaeadff(0x190)]['warn'](_0xcee230)};for(const _0xf6a898 of _0x17f03e){const _0x160d74=await agentResponseToDef(_0xf6a898,_0x54ee0b),{yaml:_0x1b742d,systemPrompt:_0x251b60,starterMessage:_0x54d79d}=_0x160d74;_0x4fbe01[_0xaeadff(0x194)]({'name':_0x1b742d[_0xaeadff(0x1a1)],'dir':'','yaml':_0x1b742d,'systemPrompt':_0x251b60,'starterMessage':_0x54d79d});}for(const _0x778304 of _0x111246){const _0x2ec800=apiKnowledgeBaseToYaml(_0x778304);_0x49339f[_0xaeadff(0x194)]({'name':_0x2ec800[_0xaeadff(0x1a1)],'path':'','yaml':_0x2ec800});}for(const _0x11a360 of _0x5b3f28){_0x44dd73[_0xaeadff(0x194)]({'name':_0x11a360['attributes'][_0xaeadff(0x1a1)],'path':'','text':_0x11a360[_0xaeadff(0x1c0)]['text']});}for(const _0x3ce48b of _0x5865a6){const _0x56d3cb=await apiPromptToYaml(_0x3ce48b,_0x54ee0b);_0x56d3cb&&_0x3b46bd[_0xaeadff(0x194)]({'name':_0x56d3cb['name'],'path':'','yaml':_0x56d3cb});}for(const _0x37cf8b of _0x29bf9a){if(!_0x37cf8b[_0xaeadff(0x1c0)]['isManaged']&&SAFE_INTEGRATION_TYPES['includes'](_0x37cf8b['attributes'][_0xaeadff(0x1c3)][_0xaeadff(0x108)]())){const _0x54c88f=await apiIntegrationToYaml(_0x37cf8b,_0x54ee0b);_0x427c75[_0xaeadff(0x194)]({'name':_0x37cf8b[_0xaeadff(0x1c0)][_0xaeadff(0x1c3)]['toLowerCase'](),'path':'','yaml':_0x54c88f});}}for(const _0x2cb620 of _0x4d574a){const _0x335b9b=apiExperimentalKnowledgeBaseToYaml(_0x2cb620);_0x334d15['push']({'name':_0x335b9b[_0xaeadff(0x1a1)],'path':'','def':_0x335b9b});}for(const _0x16f73c of _0x534879){const _0x5505be=apiExperimentalArtifactToYaml(_0x16f73c);_0x4b1963[_0xaeadff(0x194)]({'name':_0x5505be[_0xaeadff(0x1a1)],'path':'','def':_0x5505be});}}const _0x571c1b={'sourceProjectName':_0x265b71,'newProjectName':_0x41ba70,'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}}},_0x148b96=await this[_0xaeadff(0x1e8)]['listProjects'](),_0x5522df=_0x148b96['find'](_0x339027=>_0x339027[_0xaeadff(0x1c0)]['name']===_0x41ba70);if(_0x5522df)throw new SDKError(ErrorCode[_0xaeadff(0x20e)],_0xaeadff(0x122)+_0x41ba70+'\x22\x20already\x20exists',undefined,{'helpText':_0xaeadff(0x125)});if(_0x926daf?.[_0xaeadff(0x10e)])return _0x571c1b[_0xaeadff(0x1cc)][_0xaeadff(0x19d)][_0xaeadff(0x1d7)]=_0x4fbe01['length'],_0x571c1b[_0xaeadff(0x1cc)][_0xaeadff(0x118)][_0xaeadff(0x1d7)]=_0x49339f['length'],_0x571c1b['counts'][_0xaeadff(0x135)]['created']=_0x44dd73[_0xaeadff(0x11f)],_0x571c1b['counts']['experimentalKnowledgeBases'][_0xaeadff(0x1d7)]=_0x334d15[_0xaeadff(0x11f)],_0x571c1b[_0xaeadff(0x1cc)][_0xaeadff(0x112)][_0xaeadff(0x1d7)]=_0x4b1963[_0xaeadff(0x11f)],_0x571c1b[_0xaeadff(0x1cc)][_0xaeadff(0x16e)][_0xaeadff(0x1d7)]=_0x3b46bd[_0xaeadff(0x11f)],_0x571c1b['counts'][_0xaeadff(0x1de)][_0xaeadff(0x1d7)]=_0x427c75[_0xaeadff(0x11f)],_0x571c1b;const _0x3a879c=await this[_0xaeadff(0x1e8)][_0xaeadff(0x164)]({'name':_0x41ba70}),_0x3677f3=_0x3a879c['id'];_0x571c1b[_0xaeadff(0x105)]=_0x3677f3;const _0xcb1020=new Map(),_0x2ccfb3=new Map(),_0x558cc8=new Map(),_0x119f17=new Map(),_0x27100c=new Map(),_0x365656=new Map(),_0x3cee98=new Map(),_0x316db3=new Map(),_0x3935bf=new Set(),_0x352cc3=new Set();for(const _0x2a7647 of _0x4fbe01){for(const _0x21678e of _0x2a7647['yaml'][_0xaeadff(0x16a)]||[]){if(_0x21678e[_0xaeadff(0x1ee)]===_0xaeadff(0x134)&&_0x21678e[_0xaeadff(0x10c)]){const _0x24f063=parseRef(_0x21678e[_0xaeadff(0x10c)]);if(_0x24f063)_0x3935bf[_0xaeadff(0x163)](_0x24f063[_0xaeadff(0x1a1)]);}else{if(_0x21678e['type']===_0xaeadff(0x1b0)&&_0x21678e[_0xaeadff(0x10c)]){const _0x5364c1=parseRef(_0x21678e[_0xaeadff(0x10c)]);if(_0x5364c1)_0x352cc3[_0xaeadff(0x163)](_0x5364c1['name']);}}}}for(const _0x7abbce of _0x3935bf){try{const _0x203104=await this[_0xaeadff(0x1e8)][_0xaeadff(0x106)]({'projectId':_0x3677f3,'name':_0x7abbce});_0x27100c[_0xaeadff(0x13a)](_0x7abbce,_0x203104['id']),_0x571c1b[_0xaeadff(0x1c6)][_0xaeadff(0x194)]({'name':_0x7abbce,'action':_0xaeadff(0x1d7),'id':_0x203104['id']}),_0x571c1b[_0xaeadff(0x1cc)]['imageGenerators'][_0xaeadff(0x1d7)]++;}catch(_0x38b65d){_0x571c1b[_0xaeadff(0x1c6)]['push']({'name':_0x7abbce,'action':'error','error':_0x38b65d[_0xaeadff(0x107)]}),_0x571c1b[_0xaeadff(0x1cc)][_0xaeadff(0x1c6)][_0xaeadff(0x20b)]++;}}for(const _0x37e7ab of _0x352cc3){try{const _0x517fb5=await this['client'][_0xaeadff(0x195)]({'projectId':_0x3677f3,'name':_0x37e7ab});_0x365656[_0xaeadff(0x13a)](_0x37e7ab,_0x517fb5['id']),_0x571c1b[_0xaeadff(0x159)]['push']({'name':_0x37e7ab,'action':_0xaeadff(0x1d7),'id':_0x517fb5['id']}),_0x571c1b[_0xaeadff(0x1cc)]['webSearchTools'][_0xaeadff(0x1d7)]++;}catch(_0x321ed5){_0x571c1b[_0xaeadff(0x159)][_0xaeadff(0x194)]({'name':_0x37e7ab,'action':_0xaeadff(0x12e),'error':_0x321ed5[_0xaeadff(0x107)]}),_0x571c1b[_0xaeadff(0x1cc)][_0xaeadff(0x159)][_0xaeadff(0x20b)]++;}}const _0x139277=await fetchAllToolTargetMaps((_0x4aa71b,_0x225567)=>this[_0xaeadff(0x1e8)][_0xaeadff(0x168)](_0x4aa71b,_0x225567),_0x3677f3);let _0x46ebaf=[];const _0x220216={'projectId':_0x3677f3,'resolveToolTargetId':buildIdResolver({..._0x139277[_0xaeadff(0x177)],'KnowledgeBase':_0xcb1020,'TextKnowledgeBase':_0x2ccfb3,'ExperimentalKnowledgeBase':_0x3cee98,'Agent':_0x558cc8,'WebSearchTool':_0x365656,'ImageGenerator':_0x27100c}),'resolvePromptId':async _0x80e785=>_0x119f17[_0xaeadff(0x1ec)](_0x80e785),'onWarning':_0x7e39ac=>{const _0x3eacbb=_0xaeadff;this[_0x3eacbb(0x190)][_0x3eacbb(0x148)](_0x7e39ac),_0x46ebaf['push'](_0x7e39ac);}};for(const _0x47ba29 of _0x49339f){try{const _0x28260c=yamlKnowledgeBaseToApi(_0x47ba29[_0xaeadff(0x191)],_0x3677f3),_0xd60dfc=await this[_0xaeadff(0x1e8)][_0xaeadff(0x119)](_0x28260c);_0xcb1020[_0xaeadff(0x13a)](_0x47ba29['yaml'][_0xaeadff(0x1a1)],_0xd60dfc['id']),_0x571c1b[_0xaeadff(0x118)][_0xaeadff(0x194)]({'name':_0x47ba29[_0xaeadff(0x191)]['name'],'action':'created','id':_0xd60dfc['id']}),_0x571c1b[_0xaeadff(0x1cc)][_0xaeadff(0x118)][_0xaeadff(0x1d7)]++;}catch(_0x35ee34){_0x571c1b['knowledgeBases'][_0xaeadff(0x194)]({'name':_0x47ba29[_0xaeadff(0x191)]['name'],'action':'error','error':_0x35ee34[_0xaeadff(0x107)]}),_0x571c1b[_0xaeadff(0x1cc)][_0xaeadff(0x118)][_0xaeadff(0x20b)]++;}}for(const _0x32c879 of _0x44dd73){try{const _0x5e6325=yamlTextKnowledgeBaseToApi({'name':_0x32c879[_0xaeadff(0x1a1)],'text':_0x32c879['text']},_0x3677f3),_0x2dd3db=await this['client'][_0xaeadff(0x14d)](_0x5e6325);_0x2ccfb3[_0xaeadff(0x13a)](_0x32c879['name'],_0x2dd3db['id']),_0x571c1b[_0xaeadff(0x135)][_0xaeadff(0x194)]({'name':_0x32c879[_0xaeadff(0x1a1)],'action':'created','id':_0x2dd3db['id']}),_0x571c1b[_0xaeadff(0x1cc)][_0xaeadff(0x135)][_0xaeadff(0x1d7)]++;}catch(_0x48788f){_0x571c1b[_0xaeadff(0x135)]['push']({'name':_0x32c879[_0xaeadff(0x1a1)],'action':_0xaeadff(0x12e),'error':_0x48788f[_0xaeadff(0x107)]}),_0x571c1b[_0xaeadff(0x1cc)][_0xaeadff(0x135)][_0xaeadff(0x20b)]++;}}for(const _0x1992ec of _0x4b1963){try{const _0x5238cb=yamlExperimentalArtifactToApi(_0x1992ec[_0xaeadff(0x147)],_0x3677f3),_0x3a6e2e=await this[_0xaeadff(0x1e8)]['createExperimentalArtifact'](_0x5238cb);_0x316db3[_0xaeadff(0x13a)](_0x1992ec[_0xaeadff(0x147)]['name'],_0x3a6e2e['id']),_0x571c1b[_0xaeadff(0x112)][_0xaeadff(0x194)]({'name':_0x1992ec[_0xaeadff(0x147)][_0xaeadff(0x1a1)],'action':_0xaeadff(0x1d7),'id':_0x3a6e2e['id']}),_0x571c1b[_0xaeadff(0x1cc)][_0xaeadff(0x112)][_0xaeadff(0x1d7)]++;}catch(_0x1397eb){_0x571c1b[_0xaeadff(0x112)][_0xaeadff(0x194)]({'name':_0x1992ec[_0xaeadff(0x147)][_0xaeadff(0x1a1)],'action':_0xaeadff(0x12e),'error':_0x1397eb[_0xaeadff(0x107)]}),_0x571c1b[_0xaeadff(0x1cc)][_0xaeadff(0x112)][_0xaeadff(0x20b)]++;}}for(const _0x462691 of _0x334d15){try{const _0x46a740=yamlExperimentalKnowledgeBaseToApi(_0x462691[_0xaeadff(0x147)],_0x3677f3),_0x299597=await this[_0xaeadff(0x1e8)][_0xaeadff(0x1fc)](_0x46a740);_0x3cee98['set'](_0x462691['def']['name'],_0x299597['id']),_0x571c1b[_0xaeadff(0x1a0)][_0xaeadff(0x194)]({'name':_0x462691[_0xaeadff(0x147)][_0xaeadff(0x1a1)],'action':'created','id':_0x299597['id']}),_0x571c1b['counts'][_0xaeadff(0x1a0)]['created']++;}catch(_0x37b2d9){_0x571c1b[_0xaeadff(0x1a0)][_0xaeadff(0x194)]({'name':_0x462691[_0xaeadff(0x147)][_0xaeadff(0x1a1)],'action':'error','error':_0x37b2d9['message']}),_0x571c1b[_0xaeadff(0x1cc)][_0xaeadff(0x1a0)][_0xaeadff(0x20b)]++;}}const _0x1af7d7=[..._0x4fbe01]['sort']((_0x225657,_0x436186)=>{const _0x43647c=_0xaeadff,_0xa68bd8=_0x225657[_0x43647c(0x191)][_0x43647c(0x16a)]?.[_0x43647c(0x1e3)](_0x58a640=>_0x58a640[_0x43647c(0x1ee)]==='agent')??![],_0x4ef202=_0x436186[_0x43647c(0x191)][_0x43647c(0x16a)]?.[_0x43647c(0x1e3)](_0x3f8f33=>_0x3f8f33[_0x43647c(0x1ee)]===_0x43647c(0x10d))??![];if(_0xa68bd8&&!_0x4ef202)return 0x1;if(!_0xa68bd8&&_0x4ef202)return-0x1;return 0x0;});for(const _0x1908f6 of _0x1af7d7){_0x46ebaf=[];try{const _0x533d3e=_0x1908f6[_0xaeadff(0x191)]['tools']?.[_0xaeadff(0x1e4)](_0x386913=>{const _0x5285aa=_0xaeadff;if(_0x386913[_0x5285aa(0x1ee)]===_0x5285aa(0x10d)&&_0x386913[_0x5285aa(0x10c)]){const _0x5642b3=parseRef(_0x386913[_0x5285aa(0x10c)]);return _0x5642b3?.['name']===_0x1908f6[_0x5285aa(0x191)]['name'];}return![];})??[];if(_0x533d3e[_0xaeadff(0x11f)]>0x0){const _0x374670='Agent\x20\x27'+_0x1908f6[_0xaeadff(0x191)][_0xaeadff(0x1a1)]+_0xaeadff(0x1b8)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this[_0xaeadff(0x190)]['warn'](_0x374670),_0x46ebaf[_0xaeadff(0x194)](_0x374670);}const _0x23c8b4=await agentDefToRequest(_0x1908f6[_0xaeadff(0x191)],_0x1908f6[_0xaeadff(0x157)],_0x1908f6[_0xaeadff(0x1d5)],_0x220216),_0x3b6530=await this[_0xaeadff(0x1e8)]['createAgentResponse'](_0x23c8b4);_0x558cc8[_0xaeadff(0x13a)](_0x1908f6[_0xaeadff(0x191)][_0xaeadff(0x1a1)],_0x3b6530['id']),_0x571c1b['agents'][_0xaeadff(0x194)]({'agentName':_0x1908f6[_0xaeadff(0x191)][_0xaeadff(0x1a1)],'action':_0xaeadff(0x1d7),'agentId':_0x3b6530['id'],'warnings':_0x46ebaf[_0xaeadff(0x11f)]>0x0?_0x46ebaf:undefined}),_0x571c1b[_0xaeadff(0x1cc)]['agents'][_0xaeadff(0x1d7)]++;}catch(_0x3c09d2){_0x571c1b[_0xaeadff(0x19d)]['push']({'agentName':_0x1908f6[_0xaeadff(0x191)][_0xaeadff(0x1a1)],'action':_0xaeadff(0x12e),'error':_0x3c09d2['message'],'warnings':_0x46ebaf[_0xaeadff(0x11f)]>0x0?_0x46ebaf:undefined}),_0x571c1b[_0xaeadff(0x1cc)][_0xaeadff(0x19d)]['errors']++;}}for(const _0x2a1064 of _0x3b46bd){try{const _0x5c18ae=await yamlPromptToApi(_0x2a1064[_0xaeadff(0x191)],_0x3677f3,_0x220216);if(!_0x5c18ae){_0x571c1b[_0xaeadff(0x16e)][_0xaeadff(0x194)]({'name':_0x2a1064['yaml'][_0xaeadff(0x1a1)],'action':'error','error':'Agent\x20reference\x20not\x20found'}),_0x571c1b['counts'][_0xaeadff(0x16e)]['errors']++;continue;}const _0x463f46=await this[_0xaeadff(0x1e8)][_0xaeadff(0x1a3)](_0x5c18ae);_0x119f17[_0xaeadff(0x13a)](_0x2a1064[_0xaeadff(0x191)][_0xaeadff(0x1a1)],_0x463f46['id']),_0x571c1b['prompts'][_0xaeadff(0x194)]({'name':_0x2a1064[_0xaeadff(0x191)]['name'],'action':_0xaeadff(0x1d7),'id':_0x463f46['id']}),_0x571c1b['counts'][_0xaeadff(0x16e)]['created']++;}catch(_0x48f34b){_0x571c1b[_0xaeadff(0x16e)][_0xaeadff(0x194)]({'name':_0x2a1064['yaml'][_0xaeadff(0x1a1)],'action':_0xaeadff(0x12e),'error':_0x48f34b[_0xaeadff(0x107)]}),_0x571c1b[_0xaeadff(0x1cc)]['prompts']['errors']++;}}for(const _0x400a2e of _0x427c75){try{const _0x2f8456=await yamlIntegrationToApi(_0x400a2e['yaml'],_0x3677f3,_0x220216),_0xd73f50=await this[_0xaeadff(0x1e8)]['createIntegration'](_0x2f8456);_0x571c1b[_0xaeadff(0x1de)][_0xaeadff(0x194)]({'name':_0x400a2e[_0xaeadff(0x191)][_0xaeadff(0x156)],'action':_0xaeadff(0x1d7),'id':_0xd73f50['id']}),_0x571c1b[_0xaeadff(0x1cc)][_0xaeadff(0x1de)][_0xaeadff(0x1d7)]++;}catch(_0x7d0b3c){_0x571c1b['integrations'][_0xaeadff(0x194)]({'name':_0x400a2e[_0xaeadff(0x191)]['service_type'],'action':_0xaeadff(0x12e),'error':_0x7d0b3c[_0xaeadff(0x107)]}),_0x571c1b[_0xaeadff(0x1cc)][_0xaeadff(0x1de)][_0xaeadff(0x20b)]++;}}return _0x571c1b;}}
@@ -1 +1 @@
1
- (function(_0x30836,_0x5cffa1){const _0x1224fe=a134_0x2a55,_0x5988c5=_0x30836();while(!![]){try{const _0x1cc32e=parseInt(_0x1224fe(0x98))/0x1*(-parseInt(_0x1224fe(0xa0))/0x2)+-parseInt(_0x1224fe(0x9f))/0x3*(-parseInt(_0x1224fe(0xa3))/0x4)+-parseInt(_0x1224fe(0xa5))/0x5*(-parseInt(_0x1224fe(0xa1))/0x6)+parseInt(_0x1224fe(0xa2))/0x7*(-parseInt(_0x1224fe(0x96))/0x8)+-parseInt(_0x1224fe(0xa6))/0x9*(-parseInt(_0x1224fe(0x94))/0xa)+parseInt(_0x1224fe(0x97))/0xb*(-parseInt(_0x1224fe(0x9a))/0xc)+parseInt(_0x1224fe(0xa7))/0xd;if(_0x1cc32e===_0x5cffa1)break;else _0x5988c5['push'](_0x5988c5['shift']());}catch(_0x51de28){_0x5988c5['push'](_0x5988c5['shift']());}}}(a134_0x1c80,0xb9bb8));function a134_0x2a55(_0x25864e,_0x14f3b8){_0x25864e=_0x25864e-0x94;const _0x1c8013=a134_0x1c80();let _0x2a5595=_0x1c8013[_0x25864e];return _0x2a5595;}function a134_0x1c80(){const _0x15ff9d=['1.0','5HZmWop','8685RLzlzb','31949554caBiQd','attributes','2220dsJifd','get','4602440znRvse','13569193xvIDeI','10743TaoOku','targetAgentId','12BoQkwV','map','targetKnowledgeBaseId','tools','has','2514bthTFk','276ZaEywt','5657028eipXpU','7HtSNqg','2088NUwlOs'];a134_0x1c80=function(){return _0x15ff9d;};return a134_0x1c80();}export function canCreateAgent(_0x1d1099,_0x424397){const _0x3feb2f=a134_0x2a55;for(const _0x400030 of _0x1d1099[_0x3feb2f(0xa8)][_0x3feb2f(0x9d)]){if(_0x400030[_0x3feb2f(0x99)]&&!_0x424397[_0x3feb2f(0x9e)](_0x400030[_0x3feb2f(0x99)]))return![];}return!![];}export function remapToolIds(_0x4c2ac3,_0x197f27,_0x3043b3){const _0x38b701=a134_0x2a55;return _0x4c2ac3[_0x38b701(0x9b)](_0x35bf21=>({..._0x35bf21,'targetKnowledgeBaseId':_0x35bf21[_0x38b701(0x9c)]?_0x197f27[_0x38b701(0x95)](_0x35bf21[_0x38b701(0x9c)])||_0x35bf21[_0x38b701(0x9c)]:undefined,'targetAgentId':_0x35bf21[_0x38b701(0x99)]?_0x3043b3[_0x38b701(0x95)](_0x35bf21['targetAgentId'])||_0x35bf21['targetAgentId']:undefined}));}export function remapVariableIds(_0x287ec7,_0x131c38){const _0x3d5266=a134_0x2a55;return _0x287ec7[_0x3d5266(0x9b)](_0x203dc3=>({..._0x203dc3,'targetKnowledgeBaseId':_0x131c38[_0x3d5266(0x95)](_0x203dc3[_0x3d5266(0x9c)])||_0x203dc3['targetKnowledgeBaseId']}));}export function isSupportedBackupVersion(_0x21bf5c){const _0xf6c277=a134_0x2a55;return _0x21bf5c===_0xf6c277(0xa4);}
1
+ function a134_0x22e1(_0x4e3dde,_0x3c8c7d){_0x4e3dde=_0x4e3dde-0xbd;const _0x5631a5=a134_0x5631();let _0x22e138=_0x5631a5[_0x4e3dde];return _0x22e138;}(function(_0x2d533f,_0x579db8){const _0x21c675=a134_0x22e1,_0x2ae198=_0x2d533f();while(!![]){try{const _0x51a498=parseInt(_0x21c675(0xc6))/0x1*(parseInt(_0x21c675(0xc8))/0x2)+parseInt(_0x21c675(0xc3))/0x3*(-parseInt(_0x21c675(0xbf))/0x4)+-parseInt(_0x21c675(0xc2))/0x5+-parseInt(_0x21c675(0xcb))/0x6+parseInt(_0x21c675(0xbe))/0x7+-parseInt(_0x21c675(0xcd))/0x8*(-parseInt(_0x21c675(0xc0))/0x9)+parseInt(_0x21c675(0xc7))/0xa;if(_0x51a498===_0x579db8)break;else _0x2ae198['push'](_0x2ae198['shift']());}catch(_0x59070c){_0x2ae198['push'](_0x2ae198['shift']());}}}(a134_0x5631,0x7ede0));export function canCreateAgent(_0x1c01ac,_0x46b91b){const _0x34bf16=a134_0x22e1;for(const _0x4734f5 of _0x1c01ac['attributes'][_0x34bf16(0xcc)]){if(_0x4734f5[_0x34bf16(0xc9)]&&!_0x46b91b[_0x34bf16(0xc1)](_0x4734f5[_0x34bf16(0xc9)]))return![];}return!![];}export function remapToolIds(_0x9f6816,_0xf5a60c,_0x449bfe){const _0x3c6c31=a134_0x22e1;return _0x9f6816[_0x3c6c31(0xbd)](_0x16eadd=>({..._0x16eadd,'targetKnowledgeBaseId':_0x16eadd[_0x3c6c31(0xca)]?_0xf5a60c['get'](_0x16eadd[_0x3c6c31(0xca)])||_0x16eadd['targetKnowledgeBaseId']:undefined,'targetAgentId':_0x16eadd[_0x3c6c31(0xc9)]?_0x449bfe[_0x3c6c31(0xc4)](_0x16eadd['targetAgentId'])||_0x16eadd[_0x3c6c31(0xc9)]:undefined}));}function a134_0x5631(){const _0x4533ab=['1.0','1jejKDh','4043230cgnLDn','617656EdPIrO','targetAgentId','targetKnowledgeBaseId','5806122vpmNlW','tools','8DXjoUH','map','5035758rcRCiP','166308efBZyb','5150160TdaVsR','has','2171480ZmRchO','6XLZfZG','get'];a134_0x5631=function(){return _0x4533ab;};return a134_0x5631();}export function remapVariableIds(_0x322b6c,_0x2189f6){const _0x1988c5=a134_0x22e1;return _0x322b6c[_0x1988c5(0xbd)](_0x2208ec=>({..._0x2208ec,'targetKnowledgeBaseId':_0x2189f6[_0x1988c5(0xc4)](_0x2208ec[_0x1988c5(0xca)])||_0x2208ec[_0x1988c5(0xca)]}));}export function isSupportedBackupVersion(_0x552a68){const _0x1d2f7c=a134_0x22e1;return _0x552a68===_0x1d2f7c(0xc5);}