@treasuredata/tdx 2026.3.24 → 2026.3.26

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 (206) 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/chat-command.js +1 -1
  12. package/dist/commands/claude-command.js +1 -1
  13. package/dist/commands/claude-statusline-command.js +1 -1
  14. package/dist/commands/claude-usage-command.js +1 -1
  15. package/dist/commands/command.js +1 -1
  16. package/dist/commands/connection-command.js +1 -1
  17. package/dist/commands/databases.js +1 -1
  18. package/dist/commands/delivery-command.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-campaign-pull-command.js +1 -1
  21. package/dist/commands/engage-campaign-push-command.js +1 -1
  22. package/dist/commands/engage-campaign-validate-command.js +1 -1
  23. package/dist/commands/engage-command.js +1 -1
  24. package/dist/commands/engage-template-pull-command.js +1 -1
  25. package/dist/commands/engage-template-push-command.js +1 -1
  26. package/dist/commands/engage-template-validate-command.js +1 -1
  27. package/dist/commands/job-command.js +1 -1
  28. package/dist/commands/journey-command.js +1 -1
  29. package/dist/commands/journey-validate-command.js +1 -1
  30. package/dist/commands/llm-command.js +1 -1
  31. package/dist/commands/mcp-command.js +1 -1
  32. package/dist/commands/parent-segment-command.js +1 -1
  33. package/dist/commands/policy-command.js +1 -1
  34. package/dist/commands/profile-command.js +1 -1
  35. package/dist/commands/profiles-command.js +1 -1
  36. package/dist/commands/query-command.js +1 -1
  37. package/dist/commands/schedule-command.js +1 -1
  38. package/dist/commands/segment-command.js +1 -1
  39. package/dist/commands/segment-create-command.js +1 -1
  40. package/dist/commands/segment-fields-command.js +1 -1
  41. package/dist/commands/segment-pull-command.js +1 -1
  42. package/dist/commands/segment-push-command.js +1 -1
  43. package/dist/commands/segment-update-command.js +1 -1
  44. package/dist/commands/segment-use-command.js +1 -1
  45. package/dist/commands/segment-validate-command.js +1 -1
  46. package/dist/commands/segments.js +1 -1
  47. package/dist/commands/show.js +1 -1
  48. package/dist/commands/status-command.js +1 -1
  49. package/dist/commands/tables.js +1 -1
  50. package/dist/commands/unset-command.js +1 -1
  51. package/dist/commands/upgrade-command.js +1 -1
  52. package/dist/commands/use-command.js +1 -1
  53. package/dist/commands/user-command.js +1 -1
  54. package/dist/commands/workflow-command.js +1 -1
  55. package/dist/core/auth.js +1 -1
  56. package/dist/core/command-output.js +1 -1
  57. package/dist/core/config.js +1 -1
  58. package/dist/core/connection-cache.js +1 -1
  59. package/dist/core/constants.js +1 -1
  60. package/dist/core/credential-cache.js +1 -1
  61. package/dist/core/global-context.js +1 -1
  62. package/dist/core/keychain.js +1 -1
  63. package/dist/core/oauth-keychain.js +1 -1
  64. package/dist/core/oauth.js +1 -1
  65. package/dist/core/profile.js +1 -1
  66. package/dist/core/project-config.js +1 -1
  67. package/dist/core/session.js +1 -1
  68. package/dist/core/user-cache.js +1 -1
  69. package/dist/core/version.js +1 -1
  70. package/dist/index.js +1 -1
  71. package/dist/mcp/server.js +1 -1
  72. package/dist/mcp/tools/index.js +1 -1
  73. package/dist/mcp/tools/tdx-run.js +1 -1
  74. package/dist/mcp/tools/tdx-search.js +1 -1
  75. package/dist/mcp/utils.js +1 -1
  76. package/dist/proxy/claude-usage-tracker.js +1 -1
  77. package/dist/proxy/passthrough-server.js +1 -1
  78. package/dist/proxy/sse-usage-parser.js +1 -1
  79. package/dist/sdk/agent/agent-config.js +1 -1
  80. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  81. package/dist/sdk/agent/agent-yaml.js +1 -1
  82. package/dist/sdk/agent/test/evaluator.js +1 -1
  83. package/dist/sdk/agent/test/executor.js +1 -1
  84. package/dist/sdk/agent/test/index.js +1 -1
  85. package/dist/sdk/agent/test/output.js +1 -1
  86. package/dist/sdk/agent/test/parser.js +1 -1
  87. package/dist/sdk/agent/tool-target-registry.js +1 -1
  88. package/dist/sdk/api.js +1 -1
  89. package/dist/sdk/client/cdp-api-client.js +1 -1
  90. package/dist/sdk/client/delivery-api-client.js +1 -1
  91. package/dist/sdk/client/endpoints.js +1 -1
  92. package/dist/sdk/client/engage-api-client.js +1 -1
  93. package/dist/sdk/client/http-client.js +1 -1
  94. package/dist/sdk/client/llm-api-client.js +1 -1
  95. package/dist/sdk/client/oauth-refresh.js +1 -1
  96. package/dist/sdk/client/rate-limiter.js +1 -1
  97. package/dist/sdk/client/td-api-client.js +1 -1
  98. package/dist/sdk/client/trino-api-client.js +1 -1
  99. package/dist/sdk/client/workflow-client.js +1 -1
  100. package/dist/sdk/connection-validator.js +1 -1
  101. package/dist/sdk/connection.js +1 -1
  102. package/dist/sdk/delivery.js +1 -1
  103. package/dist/sdk/engage/campaign-pull.js +1 -1
  104. package/dist/sdk/engage/campaign-push.js +1 -1
  105. package/dist/sdk/engage/campaign-validator.js +1 -1
  106. package/dist/sdk/engage/campaign-yaml.js +1 -1
  107. package/dist/sdk/engage/template-pull.js +1 -1
  108. package/dist/sdk/engage/template-push.js +1 -1
  109. package/dist/sdk/engage/template-validator.js +1 -1
  110. package/dist/sdk/engage/template-yaml.js +1 -1
  111. package/dist/sdk/engage/types/campaign-def.js +1 -1
  112. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  113. package/dist/sdk/engage/types/template-schema.js +1 -1
  114. package/dist/sdk/engage.js +1 -1
  115. package/dist/sdk/errors.js +1 -1
  116. package/dist/sdk/index.js +1 -1
  117. package/dist/sdk/io/index.js +1 -1
  118. package/dist/sdk/io/node-filesystem.js +1 -1
  119. package/dist/sdk/job.js +1 -1
  120. package/dist/sdk/journey.js +1 -1
  121. package/dist/sdk/llm/chat-cache.js +1 -1
  122. package/dist/sdk/llm/index.js +1 -1
  123. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  124. package/dist/sdk/llm/model-factors.js +1 -1
  125. package/dist/sdk/personalization.js +1 -1
  126. package/dist/sdk/policy.js +1 -1
  127. package/dist/sdk/query/index.js +1 -1
  128. package/dist/sdk/query/sql-parser.js +1 -1
  129. package/dist/sdk/realtime.js +1 -1
  130. package/dist/sdk/schedule.js +1 -1
  131. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  132. package/dist/sdk/segment/fields-display.js +1 -1
  133. package/dist/sdk/segment/file-discovery.js +1 -1
  134. package/dist/sdk/segment/journey-utils.js +1 -1
  135. package/dist/sdk/segment/journey-validator.js +1 -1
  136. package/dist/sdk/segment/journey-yaml.js +1 -1
  137. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  138. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  139. package/dist/sdk/segment/pull-workflow.js +1 -1
  140. package/dist/sdk/segment/push-recovery.js +1 -1
  141. package/dist/sdk/segment/push-workflow.js +1 -1
  142. package/dist/sdk/segment/resolution-context.js +1 -1
  143. package/dist/sdk/segment/segment-path-parser.js +1 -1
  144. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  145. package/dist/sdk/segment/segment-validator.js +1 -1
  146. package/dist/sdk/segment/target-resolution.js +1 -1
  147. package/dist/sdk/segment/tdx-config.js +1 -1
  148. package/dist/sdk/segment/types/activation-schema.js +1 -1
  149. package/dist/sdk/segment/types/journey-def.js +1 -1
  150. package/dist/sdk/segment/types/journey-schema.js +1 -1
  151. package/dist/sdk/segment/types/segment-def.js +1 -1
  152. package/dist/sdk/segment/types/segment-schema.js +1 -1
  153. package/dist/sdk/segment/validate-files.js +1 -1
  154. package/dist/sdk/segment/yaml-validator.js +1 -1
  155. package/dist/sdk/segment.d.ts +5 -0
  156. package/dist/sdk/segment.d.ts.map +1 -1
  157. package/dist/sdk/segment.js +1 -1
  158. package/dist/sdk/segment.js.map +1 -1
  159. package/dist/sdk/types/index.js +1 -1
  160. package/dist/sdk/types/progress.js +1 -1
  161. package/dist/sdk/user.js +1 -1
  162. package/dist/sdk/util/format-detector.js +1 -1
  163. package/dist/sdk/util/formatters.js +1 -1
  164. package/dist/sdk/util/index.js +1 -1
  165. package/dist/sdk/util/paginate.js +1 -1
  166. package/dist/sdk/util/tree-formatter.js +1 -1
  167. package/dist/sdk/workflow/archive-validation.js +1 -1
  168. package/dist/sdk/workflow/clone-workflow.js +1 -1
  169. package/dist/sdk/workflow/index.js +1 -1
  170. package/dist/sdk/workflow/pull-workflow.js +1 -1
  171. package/dist/sdk/workflow/push-workflow.js +1 -1
  172. package/dist/sdk/workflow/tdx-config.js +1 -1
  173. package/dist/sdk/workflow/workflow-utils.js +1 -1
  174. package/dist/test-utils/command-runner.js +1 -1
  175. package/dist/test-utils/factories.js +1 -1
  176. package/dist/test-utils/fixtures.js +1 -1
  177. package/dist/test-utils/http-mock.js +1 -1
  178. package/dist/test-utils/index.js +1 -1
  179. package/dist/utils/async.js +1 -1
  180. package/dist/utils/colors.js +1 -1
  181. package/dist/utils/diff.js +1 -1
  182. package/dist/utils/file-permissions.js +1 -1
  183. package/dist/utils/file-reader.js +1 -1
  184. package/dist/utils/github-releases.js +1 -1
  185. package/dist/utils/global-cache.js +1 -1
  186. package/dist/utils/json-loader.js +1 -1
  187. package/dist/utils/local-cache.js +1 -1
  188. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  189. package/dist/utils/logger/formatters/index.js +1 -1
  190. package/dist/utils/logger/handlers/console-handler.js +1 -1
  191. package/dist/utils/logger/handlers/file-handler.js +1 -1
  192. package/dist/utils/logger/handlers/index.js +1 -1
  193. package/dist/utils/logger/handlers/null-handler.js +1 -1
  194. package/dist/utils/logger/index.js +1 -1
  195. package/dist/utils/logger/logger.js +1 -1
  196. package/dist/utils/logger/types.js +1 -1
  197. package/dist/utils/option-validation.js +1 -1
  198. package/dist/utils/process.js +1 -1
  199. package/dist/utils/prompt.js +1 -1
  200. package/dist/utils/spinner.js +1 -1
  201. package/dist/utils/sse-parser.js +1 -1
  202. package/dist/utils/string-utils.js +1 -1
  203. package/dist/utils/table-ref-parser.js +1 -1
  204. package/dist/utils/tdx-logger.js +1 -1
  205. package/dist/utils/version-check.js +1 -1
  206. package/package.json +1 -1
@@ -1 +1 @@
1
- function a123_0x3d9e(){const _0x70fb5a=['chatIgnoreManagedActions','content','LLM_PROJECT_NOT_FOUND','prompts.json','webSearchTools','UNAUTHENTICATED','getAgent','version','Available\x20agents:\x20','Renamed\x20KB\x20file:\x20','toLowerCase','Agent\x20\x27','2525456FwxKYq','Renamed\x20text\x20KB\x20file:\x20','signal','text_content','KnowledgeBase','listExperimentalArtifacts','site','profile','getProject','agentsFull','Project\x20not\x20found:\x20','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','set','Agent\x20reference\x20not\x20found','files','readdirSync','createAgentResponse','getOrCreateDefaultAgent','createKnowledgeBase','json_schema','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','webhookCorsOrigins','event','knowledgebases.json','metadata','integrations.json','Renamed\x20agent\x20folder:\x20','dryRun','experimentalKnowledgeBases','cloneProject','sort','#\x20prompt.md\x0a','duplicate','history','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','14iArqbE','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','No\x20tdx.json\x20found\x20in\x20','updateExperimentalArtifact','type','endsWith','isDir','claude-4.5-sonnet','already\x20exists','Backup\x20folder\x20not\x20found:\x20','length','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','models','unchanged','createTextKnowledgeBase','Invalid\x20agent\x20reference\x20format:\x20','deleteIntegration','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','new','yaml','low','knowledge_bases','Renamed\x20prompt\x20file:\x20','description','promptId','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','getOrCreateDefaultProject','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','.yml','1131830qgczPd','starter_message.md','some','integrations','\x0a---\x20schema:\x20','\x20attempts\x20due\x20to\x20name\x20conflicts.','file_name','Removed\x20deleted\x20file:\x20','web_search','createIntegration','Renamed\x20folder:\x20','---\x20schema:\x20','service_type','Unresolved\x20dependencies:\x20','chats','chat_generic','createImageGenerator','nameToId','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','Only\x20safe\x20types\x20(','conflict','llm_project','updatePrompt','loadJsonFile','variables','5080528cUfvMg','tables','experimentalArtifacts','979099RLkbFy','listExperimentalKnowledgeBases','Unsupported\x20backup\x20version:\x20','tdx.json','getChatHistory','NOT_FOUND','---\x20file:\x20','project.json','jsonSchemaHint','listIntegrations','chat_parent_segment','code.js','localeCompare','cwd','393DciHcX','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','stringify','156jnwiqL','11436pFklui','agent','):\x20','Agent\x20not\x20found:\x20','\x0a---\x20function:\x20','context','name','displayName','prompt.md','listImageGenerators','statSync','json_schema.json','startChat','actions','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','mkdirSync','resolveAgentId','listToolTargets','restoreProject','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','15479610qIjrHV','has','readFileSync','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','path','action','agentId','\x0a\x0a#\x20agent.yml\x0a','ALREADY_EXISTS','\x27.\x20This\x20should\x20not\x20happen.','map','\x27\x20(','createPrompt','resolveProjectId','\x20→\x20','projects','size','text','tdx_default_','clearDefaultAgent','attributes','prompts','join','.md','logger','imageGenerators','45urDzWS','agents.json','pullProject','chatId','\x20---\x0a','dir','Renamed\x20experimental\x20KB\x20directory:\x20','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','push','TextKnowledgeBase','listPrompts','dirname','existsSync','split','modelType','rmSync','Project\x20\x22','getUserSettings','project','.llm','PERMISSION_DENIED','target','\x20in\x20project\x20','minimal','isFile','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','filter','renamed','info','pullAgent','getBackupMetadata','Output\x20directory\x20already\x20exists:\x20','agent.yml','continueChat','experimental_artifacts','add','basename','getChatLog','pushProject','isManaged','chatWelcomeMessage','updated','toISOString','\x22\x20already\x20exists','updateAgent','created','AGENT_NOT_FOUND','updateExperimentalKnowledgeBase',')\x20can\x20be\x20cloned.','systemPrompt','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','pushAgent','listKnowledgeBases','projectName','Unable\x20to\x20create\x20project\x20after\x20','knowledgeBases','setCurrentProject','agents','warn','exportedFrom','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','backupProject','projectId','image_gen','isDirectory','status','createExperimentalKnowledgeBase','dry-run-','deleteAgent','INVALID_ARGUMENT','client','listAgents','none','availableModels','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','listProjects','starterMessage','resolveProjectName','5xgUlDW','INTERNAL','getChatInfo','deleteProject','errors','listTextKnowledgeBases','code','error','find','template','getCurrentProject','message','def','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','functions','Removed\x20deleted\x20directory:\x20','total','includes','createExperimentalArtifact','availableModelNames','1.0','utf-8','updateTextKnowledgeBase','counts','createAgent','listWebSearchTools','writeFileSync','parse','oldPath','medium','createProject','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.','sdk.llm','\x0a---\x20code\x20---\x0a','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','textKnowledgeBases','listAgentsFull','get','maxToolIterations','experimental_knowledge_bases','starter_message','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','idToName','Skipping\x20integration\x20\x27','getDefaultProjectName','Renamed\x20integration\x20file:\x20','tools','currentProjectId','serviceType','5070vOzARX','agent.yml\x20not\x20found\x20in\x20','chatInfo'];a123_0x3d9e=function(){return _0x70fb5a;};return a123_0x3d9e();}const a123_0x44cb81=a123_0x1092;(function(_0x305287,_0x1f3519){const _0x390354=a123_0x1092,_0x5d62bc=_0x305287();while(!![]){try{const _0x20b2b0=-parseInt(_0x390354(0xa5))/0x1+-parseInt(_0x390354(0x180))/0x2*(parseInt(_0x390354(0xcf))/0x3)+-parseInt(_0x390354(0xbe))/0x4*(-parseInt(_0x390354(0x14f))/0x5)+parseInt(_0x390354(0xd3))/0x6*(-parseInt(_0x390354(0x1b2))/0x7)+parseInt(_0x390354(0x18f))/0x8*(parseInt(_0x390354(0x101))/0x9)+-parseInt(_0x390354(0xe7))/0xa+parseInt(_0x390354(0xc1))/0xb*(parseInt(_0x390354(0xd2))/0xc);if(_0x20b2b0===_0x1f3519)break;else _0x5d62bc['push'](_0x5d62bc['shift']());}catch(_0x215abf){_0x5d62bc['push'](_0x5d62bc['shift']());}}}(a123_0x3d9e,0xf1b13));import{LLMApiClient}from'../client/llm-api-client.js';import*as a123_0xbdc0df from'node:fs';import*as a123_0xe6e455 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';function a123_0x1092(_0x22a56d,_0x1f7f7e){_0x22a56d=_0x22a56d-0xa5;const _0x3d9eaa=a123_0x3d9e();let _0x1092e0=_0x3d9eaa[_0x22a56d];return _0x1092e0;}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=[a123_0x44cb81(0xb4),'chat_agent_console',a123_0x44cb81(0xcb)];async function safeListOrEmpty(_0x8c6f4d){const _0xe624ed=a123_0x44cb81;try{return await _0x8c6f4d();}catch(_0x1ef8c4){if(_0x1ef8c4 instanceof HTTPClientError&&_0x1ef8c4[_0xe624ed(0x142)]===0x194)return[];throw _0x1ef8c4;}}export class LLMSDK{[a123_0x44cb81(0x17e)];[a123_0x44cb81(0x147)];['context'];['logger']=Logger['of'](a123_0x44cb81(0x16f));constructor(_0xc54731){const _0x3b9ba2=a123_0x44cb81;this[_0x3b9ba2(0x147)]=new LLMApiClient(_0xc54731),this['context']=_0xc54731;}[a123_0x44cb81(0x17b)](){const _0x5b2215=a123_0x44cb81,_0x35d6d8=getSanitizedUsername();return _0x5b2215(0xf9)+_0x35d6d8;}async[a123_0x44cb81(0x139)](_0x5d973a){const _0x37840e=a123_0x44cb81,{projectId:_0x36f6cf}=await this[_0x37840e(0x14e)](_0x5d973a);this['currentProjectId']=_0x36f6cf;}[a123_0x44cb81(0x159)](){const _0x7885ad=a123_0x44cb81;return this[_0x7885ad(0x17e)];}async['setDefaultAgent'](_0x1f1192){const _0x52a6b4=a123_0x44cb81,_0x1f9ff6=this[_0x52a6b4(0xd8)][_0x52a6b4(0x196)];let _0x4fd981,_0x27dde1;if(_0x1f1192[_0x52a6b4(0x160)]('/')){const _0x216d8c=_0x1f1192[_0x52a6b4(0x10e)]('/');if(_0x216d8c['length']!==0x2)throw new SDKError(ErrorCode[_0x52a6b4(0x146)],_0x52a6b4(0x1c1)+_0x1f1192,undefined,{'helpText':'Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22'});const [_0xefe5b9,_0x337f37]=_0x216d8c;_0x4fd981=await this[_0x52a6b4(0xf4)](_0xefe5b9),_0x27dde1=_0x337f37;}else _0x4fd981=this[_0x52a6b4(0x17e)]||(await this['getOrCreateDefaultProject']())['id'],_0x27dde1=_0x1f1192;const _0x366144=await this[_0x52a6b4(0xe3)](_0x27dde1,_0x4fd981),_0x54c03b=await this[_0x52a6b4(0x147)][_0x52a6b4(0x189)](_0x366144);writeCachedLLMAgent(_0x54c03b['attributes'][_0x52a6b4(0xd9)],_0x366144,_0x4fd981,_0x1f9ff6);}['getDefaultAgent'](){const _0x54ddf7=a123_0x44cb81,_0x54abcd=this[_0x54ddf7(0xd8)][_0x54ddf7(0x196)];return readCachedLLMAgent(_0x54abcd)||undefined;}[a123_0x44cb81(0xfa)](){const _0x3c6a26=a123_0x44cb81,_0x353cbb=this[_0x3c6a26(0xd8)][_0x3c6a26(0x196)];clearCachedLLMAgent(_0x353cbb);}async[a123_0x44cb81(0x1be)](){const _0x9326a0=a123_0x44cb81,_0x40008f=await this[_0x9326a0(0x147)][_0x9326a0(0x112)](),_0x23518b=[];for(const _0x5d5b60 of _0x40008f[_0x9326a0(0x162)]){const _0x1542e6=_0x40008f[_0x9326a0(0x14a)][_0x5d5b60];_0x1542e6&&_0x23518b['push']({'name':_0x5d5b60,'displayName':_0x1542e6[_0x9326a0(0xda)]});}return _0x23518b;}async['createProject'](_0x1650f3){const _0x296146=a123_0x44cb81;return await this[_0x296146(0x147)][_0x296146(0x16d)](_0x1650f3);}async[a123_0x44cb81(0x152)](_0x58a706){const _0x41b877=a123_0x44cb81,{projectId:_0x31dad2}=await this[_0x41b877(0x14e)](_0x58a706);await this[_0x41b877(0x147)][_0x41b877(0x152)](_0x31dad2);}async[a123_0x44cb81(0xf6)](_0xcd26ac=0x32){const _0x10f944=a123_0x44cb81;return await this[_0x10f944(0x147)]['listProjects'](_0xcd26ac);}async[a123_0x44cb81(0x1cc)](_0x3c3356){const _0x12cf54=a123_0x44cb81,_0x5b4f08=_0x3c3356||this[_0x12cf54(0x17b)](),_0x42656b=this[_0x12cf54(0xd8)][_0x12cf54(0x196)];if(!_0x3c3356){const _0x1412b4=readCachedLLMProject(_0x42656b);if(_0x1412b4&&_0x1412b4[_0x12cf54(0xd9)]===_0x5b4f08)try{const _0x463fdf=await this['client']['getProject'](_0x1412b4['id']);if(_0x463fdf[_0x12cf54(0xfb)][_0x12cf54(0xd9)]===_0x5b4f08)return _0x463fdf;}catch{}}const _0x14abb9=await this[_0x12cf54(0x147)]['listProjects'](),_0x2299e5=_0x14abb9[_0x12cf54(0x157)](_0xbcad0e=>_0xbcad0e[_0x12cf54(0xfb)][_0x12cf54(0xd9)]===_0x5b4f08);if(_0x2299e5)return!_0x3c3356&&writeCachedLLMProject(_0x5b4f08,_0x2299e5['id'],_0x42656b),_0x2299e5;const _0x180a4e=await this[_0x12cf54(0x147)][_0x12cf54(0x16d)]({'name':_0x5b4f08,'description':_0x12cf54(0xea)+getSanitizedUsername()+')'});return!_0x3c3356&&writeCachedLLMProject(_0x5b4f08,_0x180a4e['id'],_0x42656b),_0x180a4e;}async[a123_0x44cb81(0xf4)](_0x5ee041){const _0x2f032e=a123_0x44cb81,_0x51fb05=await this[_0x2f032e(0x147)][_0x2f032e(0x14c)](),_0x24cab1=_0x51fb05['filter'](_0x5055d6=>_0x5055d6[_0x2f032e(0xfb)][_0x2f032e(0xd9)]===_0x5ee041);if(_0x24cab1['length']===0x0)throw new SDKError(ErrorCode[_0x2f032e(0x185)],_0x2f032e(0x199)+_0x5ee041,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x24cab1[_0x2f032e(0x1bc)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],'Multiple\x20projects\x20found\x20with\x20name\x20\x27'+_0x5ee041+'\x27.\x20This\x20should\x20not\x20happen.');return _0x24cab1[0x0]['id'];}async['resolveProjectName'](_0x3c7230){const _0x1f0dd=a123_0x44cb81,_0x3e52a9=await this[_0x1f0dd(0x147)][_0x1f0dd(0x14c)](),_0xb31b78=_0x3e52a9[_0x1f0dd(0x157)](_0x492aed=>_0x492aed[_0x1f0dd(0xfb)][_0x1f0dd(0xd9)]===_0x3c7230);if(_0xb31b78)return{'projectId':_0xb31b78['id'],'project':_0xb31b78};throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0x3c7230,undefined,{'helpText':_0x1f0dd(0x14b)});}async[a123_0x44cb81(0x1a0)](_0x57a84c=a123_0x44cb81(0x1b9),_0x24799e=0x0,_0x2c8c68){const _0x273583=a123_0x44cb81,_0x523c53=0xa;let _0x57c0ea=0x0,_0x5340f0;while(_0x57c0ea<_0x523c53){try{const _0x390587=await this[_0x273583(0x1cc)](_0x5340f0),_0x3b53c6=_0x390587['id'],_0x24c511=[_0x273583(0x149),_0x273583(0x118),_0x273583(0x1c6),_0x273583(0x16c),'high'],_0x1b0e60=_0x24799e===0x0?'tdx_'+_0x57a84c:'tdx_'+_0x57a84c+'_reasoning_'+_0x24c511[_0x24799e],_0x1e0ffe=await this[_0x273583(0x147)][_0x273583(0x148)](_0x3b53c6),_0x4c4241=_0x1e0ffe[_0x273583(0x157)](_0x158dcf=>_0x158dcf['attributes'][_0x273583(0xd9)]===_0x1b0e60);if(_0x4c4241)return _0x4c4241;const _0x3db51b=_0x24799e>0x0?0x1:_0x2c8c68;return await this['client'][_0x273583(0x167)]({'name':_0x1b0e60,'projectId':_0x3b53c6,'modelType':_0x57a84c,'systemPrompt':'','temperature':_0x3db51b,'reasoningEffort':_0x24799e>0x0?_0x24799e:undefined});}catch(_0x210a90){if(_0x210a90 instanceof HTTPClientError){const _0x5811aa=_0x210a90[_0x273583(0x142)];if(_0x5811aa>=0x190&&_0x5811aa<0x1f4){if(_0x5811aa===0x191)throw new SDKError(ErrorCode[_0x273583(0x188)],_0x273583(0x1cd),_0x210a90);else{if(_0x5811aa===0x193)throw new SDKError(ErrorCode[_0x273583(0x115)],_0x273583(0xb7),_0x210a90);}throw _0x210a90;}}if(errorContains(_0x210a90,_0x273583(0x1ba),_0x273583(0x1af),_0x273583(0xb9))){_0x57c0ea++;if(_0x57c0ea>=_0x523c53)throw new SDKError(ErrorCode[_0x273583(0xef)],_0x273583(0x137)+_0x523c53+_0x273583(0xaa),_0x210a90);const _0x5e313d=this[_0x273583(0x17b)]();_0x5340f0=_0x5e313d+'_'+generateRandomHex();continue;}throw _0x210a90;}}throw new SDKError(ErrorCode['INTERNAL'],_0x273583(0x11a));}async[a123_0x44cb81(0xe3)](_0x412c25,_0x5d5a12){const _0x1d26f5=a123_0x44cb81,_0x11eb50=_0x5d5a12||this['currentProjectId'],_0x526d6b=await this[_0x1d26f5(0x147)][_0x1d26f5(0x148)](_0x11eb50),_0x523932=_0x526d6b[_0x1d26f5(0x11b)](_0x38e495=>_0x38e495[_0x1d26f5(0xfb)][_0x1d26f5(0xd9)]===_0x412c25);if(_0x523932['length']===0x0){const _0x5a3aca=_0x11eb50?_0x1d26f5(0x117)+_0x11eb50:'';throw new SDKError(ErrorCode[_0x1d26f5(0x12f)],_0x1d26f5(0xd6)+_0x412c25+_0x5a3aca,undefined,{'helpText':_0x11eb50?_0x1d26f5(0x13d):_0x1d26f5(0x16e)});}if(_0x523932['length']>0x1)throw new SDKError(ErrorCode['INTERNAL'],'Multiple\x20agents\x20found\x20with\x20name\x20\x27'+_0x412c25+_0x1d26f5(0xf0));return _0x523932[0x0]['id'];}async[a123_0x44cb81(0x13a)](_0x3ec8c9){const _0x3ab9f5=a123_0x44cb81,_0x48e265=_0x3ec8c9||this[_0x3ab9f5(0x17e)];return await this['client']['listAgents'](_0x48e265);}async[a123_0x44cb81(0x198)](_0x12b4e7){const _0x58b0f4=a123_0x44cb81;return await this[_0x58b0f4(0x147)][_0x58b0f4(0x173)](_0x12b4e7);}async['agent'](_0x1f762f){const _0x3dc884=a123_0x44cb81;return await this[_0x3dc884(0x147)][_0x3dc884(0x189)](_0x1f762f);}async[a123_0x44cb81(0x167)](_0x359ffd){const _0x3b618f=a123_0x44cb81;return await this[_0x3b618f(0x147)][_0x3b618f(0x167)](_0x359ffd);}async[a123_0x44cb81(0x12d)](_0xde444a,_0x3e6b20){const _0x4aff26=a123_0x44cb81;return await this[_0x4aff26(0x147)][_0x4aff26(0x12d)](_0xde444a,_0x3e6b20);}async[a123_0x44cb81(0x145)](_0x5b3635){const _0x21297f=a123_0x44cb81;await this['client'][_0x21297f(0x145)](_0x5b3635);}async[a123_0x44cb81(0xdf)](_0xd79615){const _0xacf4ae=a123_0x44cb81;return await this[_0xacf4ae(0x147)]['startChat']({'agentId':_0xd79615});}async*['chat'](_0x223292,_0x2c06e1){const _0x4b1f3=a123_0x44cb81;let _0xa91bbc=_0x2c06e1?.[_0x4b1f3(0x104)];const _0x2831a7=_0x2c06e1?.[_0x4b1f3(0xed)];if(!_0xa91bbc){if(!_0x2831a7)throw new Error(_0x4b1f3(0xe6));const _0x3959f2=await this[_0x4b1f3(0x147)][_0x4b1f3(0xdf)]({'agentId':_0x2831a7});_0xa91bbc=_0x3959f2['id'],yield{'type':_0x4b1f3(0x1a7),'data':{'chatId':_0xa91bbc,'agentId':_0x2831a7,'projectId':_0x3959f2['attributes'][_0x4b1f3(0x13f)]}};}for await(const _0x307f7d of this[_0x4b1f3(0x147)][_0x4b1f3(0x122)](_0xa91bbc,_0x223292,_0x2c06e1?.[_0x4b1f3(0x191)])){yield{'type':_0x4b1f3(0x1a5),'data':_0x307f7d};}}async[a123_0x44cb81(0xb3)](_0x5c7e43=0x32){const _0x5f2617=a123_0x44cb81;return await this[_0x5f2617(0x147)]['listChats'](_0x5c7e43);}async[a123_0x44cb81(0x1b0)](_0x3d04cf){const _0x1e0fbc=a123_0x44cb81;return await this[_0x1e0fbc(0x147)][_0x1e0fbc(0xc5)](_0x3d04cf);}async['getChatLog'](_0x3730c0){const _0x5257a0=a123_0x44cb81;return await this[_0x5257a0(0x147)][_0x5257a0(0x126)](_0x3730c0);}async[a123_0x44cb81(0x182)](_0x439580){const _0x14fea3=a123_0x44cb81;return await this['client'][_0x14fea3(0x151)](_0x439580);}async[a123_0x44cb81(0x13e)](_0xf596b3,_0x155c0a,_0x1cb3fd){const _0x42f003=a123_0x44cb81,_0x480acc=_0x1cb3fd?.[_0x42f003(0x1aa)]??![],{projectId:_0x56a4bf,project:_0x3c11c8}=await this[_0x42f003(0x14e)](_0xf596b3),_0x242dd4=_0x3c11c8[_0x42f003(0xfb)][_0x42f003(0xd9)],_0x10a9c6=_0x155c0a||_0x242dd4+_0x42f003(0x114);if(a123_0xbdc0df[_0x42f003(0x10d)](_0x10a9c6)&&!_0x480acc)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x42f003(0x120)+_0x10a9c6,undefined,{'helpText':_0x42f003(0x1b1)});const _0x3b6401=await this[_0x42f003(0x147)][_0x42f003(0x173)](_0x56a4bf),_0x3fe43f=await this['client']['listKnowledgeBases'](_0x56a4bf),_0x5a613f=await this[_0x42f003(0x147)][_0x42f003(0x10b)](_0x56a4bf),_0x2a1386=await this[_0x42f003(0x147)]['listIntegrations'](_0x56a4bf);if(!_0x480acc){a123_0xbdc0df['mkdirSync'](_0x10a9c6,{'recursive':!![]});const _0x4f0cae={'version':_0x42f003(0x163),'exportedAt':new Date()[_0x42f003(0x12b)](),'exportedFrom':{'site':this['context'][_0x42f003(0x195)],'projectId':_0x56a4bf,'projectName':_0x242dd4},'project':_0x3c11c8};a123_0xbdc0df[_0x42f003(0x169)](a123_0xe6e455['join'](_0x10a9c6,_0x42f003(0xc8)),JSON[_0x42f003(0xd1)](_0x4f0cae,null,0x2)),a123_0xbdc0df[_0x42f003(0x169)](a123_0xe6e455[_0x42f003(0xfd)](_0x10a9c6,'agents.json'),JSON[_0x42f003(0xd1)](_0x3b6401,null,0x2)),a123_0xbdc0df[_0x42f003(0x169)](a123_0xe6e455[_0x42f003(0xfd)](_0x10a9c6,_0x42f003(0x1a6)),JSON['stringify'](_0x3fe43f,null,0x2)),a123_0xbdc0df['writeFileSync'](a123_0xe6e455[_0x42f003(0xfd)](_0x10a9c6,_0x42f003(0x186)),JSON['stringify'](_0x5a613f,null,0x2)),a123_0xbdc0df[_0x42f003(0x169)](a123_0xe6e455[_0x42f003(0xfd)](_0x10a9c6,_0x42f003(0x1a8)),JSON[_0x42f003(0xd1)](_0x2a1386,null,0x2));}return{'projectName':_0x242dd4,'outputDir':_0x10a9c6,'counts':{'agents':_0x3b6401[_0x42f003(0x1bc)],'knowledgeBases':_0x3fe43f[_0x42f003(0x1bc)],'prompts':_0x5a613f[_0x42f003(0x1bc)],'integrations':_0x2a1386['length']}};}async[a123_0x44cb81(0xe5)](_0x56324e,_0x59961a){const _0x5e115=a123_0x44cb81,_0x4189da=_0x59961a?.[_0x5e115(0x1aa)]??![],_0x2bf2ae=this['getBackupMetadata'](_0x56324e),_0x48c10d=_0x2bf2ae[_0x5e115(0x13c)]['site'],_0x594688=this[_0x5e115(0xd8)][_0x5e115(0x195)],_0x3c67fd=_0x48c10d!==_0x594688?_0x48c10d:undefined,_0x501867=this[_0x5e115(0xbc)](a123_0xe6e455['join'](_0x56324e,_0x5e115(0x102)),[]),_0x15903d=this[_0x5e115(0xbc)](a123_0xe6e455[_0x5e115(0xfd)](_0x56324e,'knowledgebases.json'),[]),_0x380d45=this['loadJsonFile'](a123_0xe6e455[_0x5e115(0xfd)](_0x56324e,_0x5e115(0x186)),[]),_0x3b5d61=this[_0x5e115(0xbc)](a123_0xe6e455[_0x5e115(0xfd)](_0x56324e,_0x5e115(0x1a8)),[]),_0x1963d7=_0x59961a?.[_0x5e115(0xd9)]||_0x2bf2ae['exportedFrom'][_0x5e115(0x136)];if(_0x4189da){const _0x17f12b=new Map(),_0x550e6a=[..._0x501867],_0x5b02ca=_0x501867['length']+0x1;let _0x3b969a=0x0;while(_0x550e6a[_0x5e115(0x1bc)]>0x0&&_0x3b969a<_0x5b02ca){_0x3b969a++;const _0x1e4edc=[];for(const _0x1e4cce of _0x550e6a){canCreateAgent(_0x1e4cce,_0x17f12b)?_0x17f12b['set'](_0x1e4cce['id'],_0x5e115(0x144)+_0x1e4cce['id']):_0x1e4edc[_0x5e115(0x109)](_0x1e4cce);}if(_0x1e4edc[_0x5e115(0x1bc)]===_0x550e6a['length'])throw new SDKError(ErrorCode[_0x5e115(0x150)],_0x5e115(0x178),undefined,{'helpText':_0x5e115(0x19a)});_0x550e6a[_0x5e115(0x1bc)]=0x0,_0x550e6a[_0x5e115(0x109)](..._0x1e4edc);}const _0x380a82=_0x380d45[_0x5e115(0x11b)](_0x389f11=>_0x17f12b[_0x5e115(0xe8)](_0x389f11['attributes'][_0x5e115(0xed)]))['length'];return{'projectName':_0x1963d7,'projectId':'(dry-run)','counts':{'agents':_0x501867[_0x5e115(0x1bc)],'knowledgeBases':_0x15903d[_0x5e115(0x1bc)],'prompts':_0x380a82,'integrations':_0x3b5d61[_0x5e115(0x1bc)]},'sourceSite':_0x3c67fd};}const _0x362ff9=await this['client']['createProject']({'name':_0x1963d7,'description':_0x2bf2ae[_0x5e115(0x113)][_0x5e115(0xfb)][_0x5e115(0x1c9)]}),_0x4b5ab8=_0x362ff9['id'],_0x4a409d=new Map(),_0x23fa09=new Map(),_0x4e5bd5=new Map();for(const _0x292192 of _0x15903d){const _0x88af9e=await this[_0x5e115(0x147)][_0x5e115(0x1a1)]({'projectId':_0x4b5ab8,'name':_0x292192[_0x5e115(0xfb)]['name'],'tdDatabaseName':_0x292192['attributes']['tdDatabaseName'],'tables':_0x292192[_0x5e115(0xfb)][_0x5e115(0xbf)]});_0x4a409d['set'](_0x292192['id'],_0x88af9e['id']);}const _0x113dc4=[..._0x501867],_0x5c9e0c=_0x501867[_0x5e115(0x1bc)]+0x1;let _0xc5d36a=0x0;while(_0x113dc4['length']>0x0&&_0xc5d36a<_0x5c9e0c){_0xc5d36a++;const _0x271439=[];for(const _0xbba985 of _0x113dc4){if(canCreateAgent(_0xbba985,_0x23fa09)){const _0x19c845=remapToolIds(_0xbba985[_0x5e115(0xfb)][_0x5e115(0x17d)],_0x4a409d,_0x23fa09),_0x2ed7e0=remapVariableIds(_0xbba985[_0x5e115(0xfb)]['variables'],_0x4a409d),_0x552f0d=await this[_0x5e115(0x147)][_0x5e115(0x19f)]({'name':_0xbba985['attributes'][_0x5e115(0xd9)],'projectId':_0x4b5ab8,'systemPrompt':_0xbba985['attributes'][_0x5e115(0x132)],'starterMessage':_0xbba985[_0x5e115(0xfb)][_0x5e115(0x14d)],'modelType':migrateModelType(_0xbba985[_0x5e115(0xfb)][_0x5e115(0x10f)]),'maxToolIterations':_0xbba985['attributes'][_0x5e115(0x175)],'temperature':_0xbba985[_0x5e115(0xfb)]['temperature'],'reasoningEffort':_0xbba985[_0x5e115(0xfb)]['reasoningEffort'],'outputs':_0xbba985[_0x5e115(0xfb)]['outputs'],'tools':_0x19c845,'variables':_0x2ed7e0});_0x23fa09[_0x5e115(0x19b)](_0xbba985['id'],_0x552f0d['id']);}else _0x271439[_0x5e115(0x109)](_0xbba985);}if(_0x271439[_0x5e115(0x1bc)]===_0x113dc4[_0x5e115(0x1bc)])throw new SDKError(ErrorCode[_0x5e115(0x150)],_0x5e115(0x178),undefined,{'helpText':_0x5e115(0x19a)});_0x113dc4[_0x5e115(0x1bc)]=0x0,_0x113dc4[_0x5e115(0x109)](..._0x271439);}for(const _0x12954a of _0x380d45){const _0x4e564f=_0x23fa09[_0x5e115(0x174)](_0x12954a['attributes']['agentId']);if(!_0x4e564f)continue;const _0x562e74=await this[_0x5e115(0x147)]['createPrompt']({'projectId':_0x4b5ab8,'agentId':_0x4e564f,'name':_0x12954a[_0x5e115(0xfb)]['name'],'systemPrompt':_0x12954a[_0x5e115(0xfb)][_0x5e115(0x132)],'template':_0x12954a[_0x5e115(0xfb)][_0x5e115(0x158)],'jsonSchemaHint':_0x12954a[_0x5e115(0xfb)][_0x5e115(0xc9)]});_0x4e5bd5[_0x5e115(0x19b)](_0x12954a['id'],_0x562e74['id']);}for(const _0x294806 of _0x3b5d61){const _0x3dc650=_0x294806[_0x5e115(0xfb)][_0x5e115(0xe0)]['map'](_0xfe43e8=>({..._0xfe43e8,'promptId':_0x4e5bd5[_0x5e115(0x174)](_0xfe43e8['promptId'])||_0xfe43e8[_0x5e115(0x1ca)]}));await this[_0x5e115(0x147)][_0x5e115(0xae)]({'projectId':_0x4b5ab8,'serviceType':_0x294806[_0x5e115(0xfb)][_0x5e115(0x17f)],'actions':_0x3dc650,'slackMessageMode':_0x294806[_0x5e115(0xfb)]['slackMessageMode'],'chatIgnoreManagedActions':_0x294806['attributes'][_0x5e115(0x183)],'chatWelcomeMessage':_0x294806[_0x5e115(0xfb)][_0x5e115(0x129)],'webhookCorsOrigins':_0x294806[_0x5e115(0xfb)][_0x5e115(0x1a4)]});}return{'projectName':_0x1963d7,'projectId':_0x4b5ab8,'counts':{'agents':_0x23fa09[_0x5e115(0xf7)],'knowledgeBases':_0x4a409d[_0x5e115(0xf7)],'prompts':_0x4e5bd5[_0x5e115(0xf7)],'integrations':_0x3b5d61[_0x5e115(0x1bc)]},'sourceSite':_0x3c67fd};}[a123_0x44cb81(0xbc)](_0x4c4212,_0x155c8e){const _0x118c8d=a123_0x44cb81;if(!a123_0xbdc0df[_0x118c8d(0x10d)](_0x4c4212))return _0x155c8e;return JSON[_0x118c8d(0x16a)](a123_0xbdc0df[_0x118c8d(0xe9)](_0x4c4212,_0x118c8d(0x164)));}[a123_0x44cb81(0x11f)](_0x4c3079){const _0x14601c=a123_0x44cb81;if(!a123_0xbdc0df[_0x14601c(0x10d)](_0x4c3079))throw new SDKError(ErrorCode['NOT_FOUND'],_0x14601c(0x1bb)+_0x4c3079,undefined,{'helpText':_0x14601c(0x108)});const _0x4d7e88=a123_0xe6e455[_0x14601c(0xfd)](_0x4c3079,_0x14601c(0xc8));if(!a123_0xbdc0df[_0x14601c(0x10d)](_0x4d7e88))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x14601c(0x1b3)+_0x4c3079,undefined,{'helpText':_0x14601c(0x1a3)});const _0x4d7fd2=JSON['parse'](a123_0xbdc0df[_0x14601c(0xe9)](_0x4d7e88,_0x14601c(0x164)));if(!isSupportedBackupVersion(_0x4d7fd2[_0x14601c(0x18a)]))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x14601c(0xc3)+_0x4d7fd2[_0x14601c(0x18a)],undefined,{'helpText':_0x14601c(0x133)});return _0x4d7fd2;}async[a123_0x44cb81(0x103)](_0x3dafd1,_0x17efac,_0x27c9fa){const _0x5e0c91=a123_0x44cb81,{projectId:_0x156340,project:_0x53c302}=await this[_0x5e0c91(0x14e)](_0x3dafd1),_0x21681a=_0x53c302['attributes'][_0x5e0c91(0xd9)];let _0x194cc4;if(_0x17efac)_0x194cc4=_0x17efac;else{const _0x192f0d=a123_0xe6e455[_0x5e0c91(0xfd)](process[_0x5e0c91(0xce)](),'agents'),_0x108052=getSanitizedPathWithMigration(_0x192f0d,_0x21681a);_0x108052[_0x5e0c91(0x11c)]&&this[_0x5e0c91(0xff)][_0x5e0c91(0x11d)]('Renamed\x20folder:\x20'+a123_0xe6e455[_0x5e0c91(0x125)](_0x108052[_0x5e0c91(0x16b)])+_0x5e0c91(0xf5)+a123_0xe6e455[_0x5e0c91(0x125)](_0x108052[_0x5e0c91(0xeb)])),_0x194cc4=_0x108052[_0x5e0c91(0xeb)];}const _0x1fac5d=await this[_0x5e0c91(0x147)]['listAgentsFull'](_0x156340),_0x3b805f=await this[_0x5e0c91(0x147)]['listKnowledgeBases'](_0x156340),_0x111f7c=await this[_0x5e0c91(0x147)][_0x5e0c91(0x154)](_0x156340),_0x292c78=await safeListOrEmpty(()=>this['client'][_0x5e0c91(0xdc)](_0x156340)),_0x259c5a=await safeListOrEmpty(()=>this[_0x5e0c91(0x147)][_0x5e0c91(0x168)](_0x156340)),_0x22c57c=await this[_0x5e0c91(0x147)][_0x5e0c91(0x10b)](_0x156340),_0x3310f3=await this[_0x5e0c91(0x147)]['listIntegrations'](_0x156340),_0x2bfd74=await safeListOrEmpty(()=>this[_0x5e0c91(0x147)][_0x5e0c91(0xc2)](_0x156340)),_0x2d18ca=await safeListOrEmpty(()=>this[_0x5e0c91(0x147)][_0x5e0c91(0x194)](_0x156340)),_0xbffe0=_0x3310f3[_0x5e0c91(0x11b)](_0x16e985=>!_0x16e985[_0x5e0c91(0xfb)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x5e0c91(0x160)](_0x16e985[_0x5e0c91(0xfb)]['serviceType'][_0x5e0c91(0x18d)]())),_0x41d219=new Map(),_0x31823a=new Map(),_0x90f650=new Map(),_0x4be19a=new Map(),_0x31604c=new Map(),_0x5c984d=new Map(),_0x4d9394=new Map();for(const _0x1b1bb3 of _0x1fac5d){_0x41d219[_0x5e0c91(0x19b)](_0x1b1bb3['id'],_0x1b1bb3['attributes']['name']);}for(const _0x3998ed of _0x3b805f){_0x31823a[_0x5e0c91(0x19b)](_0x3998ed['id'],_0x3998ed['attributes'][_0x5e0c91(0xd9)]);}for(const _0x196298 of _0x111f7c){_0x90f650[_0x5e0c91(0x19b)](_0x196298['id'],_0x196298[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)]);}for(const _0x32a866 of _0x292c78){_0x4be19a['set'](_0x32a866['id'],_0x32a866[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)]);}for(const _0x15a212 of _0x259c5a){_0x31604c[_0x5e0c91(0x19b)](_0x15a212['id'],_0x15a212[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)]);}for(const _0x1b3654 of _0x22c57c){_0x5c984d[_0x5e0c91(0x19b)](_0x1b3654['id'],_0x1b3654['attributes']['name']);}for(const _0x1aba0f of _0x2bfd74){_0x4d9394[_0x5e0c91(0x19b)](_0x1aba0f['id'],_0x1aba0f[_0x5e0c91(0xfb)]['name']);}const _0x545455={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x31823a,'TextKnowledgeBase':_0x90f650,'Agent':_0x41d219,'WebSearchTool':_0x31604c,'ImageGenerator':_0x4be19a,'ExperimentalKnowledgeBase':_0x4d9394}),'resolvePromptName':async _0x19bbd4=>_0x5c984d[_0x5e0c91(0x174)](_0x19bbd4),'onWarning':_0x119372=>this['logger'][_0x5e0c91(0x13b)](_0x119372)},_0x1e511a={'projectName':_0x21681a,'outputDir':_0x194cc4,'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}}},_0x22f9e3=[],_0x3855a5=[];for(const _0x10dbd1 of _0x1fac5d){const _0x1f958f=getSanitizedPathWithMigration(_0x194cc4,_0x10dbd1['attributes']['name']);_0x1f958f[_0x5e0c91(0x11c)]&&this[_0x5e0c91(0xff)][_0x5e0c91(0x11d)](_0x5e0c91(0x1a9)+a123_0xe6e455[_0x5e0c91(0x125)](_0x1f958f[_0x5e0c91(0x16b)])+'\x20→\x20'+a123_0xe6e455[_0x5e0c91(0x125)](_0x1f958f[_0x5e0c91(0xeb)]));const _0xdf0e5b=_0x1f958f[_0x5e0c91(0xeb)],_0x45f626=a123_0xe6e455[_0x5e0c91(0xfd)](_0xdf0e5b,'prompt.md'),_0x3492e6=a123_0xe6e455['join'](_0xdf0e5b,'agent.yml'),_0x2e756a=a123_0xe6e455[_0x5e0c91(0xfd)](_0xdf0e5b,'starter_message.md'),{yaml:_0x81b709,systemPrompt:_0x512e94,starterMessage:_0x5ea633}=await agentResponseToDef(_0x10dbd1,_0x545455),_0x34cddc=toAgentYamlString(_0x81b709),_0x434a28=!a123_0xbdc0df[_0x5e0c91(0x10d)](_0x3492e6);let _0x556000=_0x434a28,_0x2d844d;if(!_0x434a28){const _0x517a4e=a123_0xbdc0df[_0x5e0c91(0x10d)](_0x45f626)?a123_0xbdc0df[_0x5e0c91(0xe9)](_0x45f626,_0x5e0c91(0x164)):'',_0x17125c=a123_0xbdc0df['readFileSync'](_0x3492e6,_0x5e0c91(0x164)),_0x171b42=_0x5e0c91(0x1ae)+_0x517a4e+_0x5e0c91(0xee)+_0x17125c,_0x1f76d7='#\x20prompt.md\x0a'+_0x512e94+_0x5e0c91(0xee)+_0x34cddc,_0x57c89f=generateDiff(_0x171b42,_0x1f76d7);_0x556000=hasChanges(_0x57c89f),_0x556000&&(_0x2d844d=formatDiffWithColors(_0x57c89f));}_0x22f9e3['push']({'path':_0xdf0e5b,'content':'','isDir':!![]}),_0x22f9e3['push']({'path':_0x45f626,'content':_0x512e94}),_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x3492e6,'content':_0x34cddc});_0x5ea633&&_0x5ea633[_0x5e0c91(0x160)]('\x0a')&&_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x2e756a,'content':_0x5ea633});_0x1e511a['agents']['push']({'agentName':_0x10dbd1[_0x5e0c91(0xfb)]['name'],'outputPath':_0xdf0e5b,'isNew':_0x434a28,'hasChanges':_0x556000,'diff':_0x2d844d}),_0x1e511a[_0x5e0c91(0x166)]['agents'][_0x5e0c91(0x15f)]++;if(_0x434a28)_0x1e511a[_0x5e0c91(0x166)]['agents'][_0x5e0c91(0x1c4)]++;else{if(_0x556000)_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0x13a)][_0x5e0c91(0x12a)]++;else _0x1e511a['counts']['agents']['unchanged']++;}}for(const _0x584449 of _0x3b805f){if(_0x584449[_0x5e0c91(0xfb)]['isManaged'])continue;const _0x4ef257=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x194cc4),_0x584449[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)],_0x5e0c91(0x1ce));_0x4ef257['renamed']&&this[_0x5e0c91(0xff)][_0x5e0c91(0x11d)](_0x5e0c91(0x18c)+a123_0xe6e455[_0x5e0c91(0x125)](_0x4ef257[_0x5e0c91(0x16b)])+'\x20→\x20'+a123_0xe6e455[_0x5e0c91(0x125)](_0x4ef257[_0x5e0c91(0xeb)]));const _0x52186f=_0x4ef257['path'],_0x26cb5d=apiKnowledgeBaseToYaml(_0x584449),_0xda1901=toKnowledgeBaseYamlString(_0x26cb5d),_0x139a03=!a123_0xbdc0df[_0x5e0c91(0x10d)](_0x52186f);let _0x15ff47=_0x139a03,_0xd2b0e0;if(!_0x139a03){const _0x223870=a123_0xbdc0df[_0x5e0c91(0xe9)](_0x52186f,'utf-8'),_0x2ebc0f=generateDiff(_0x223870,_0xda1901);_0x15ff47=hasChanges(_0x2ebc0f),_0x15ff47&&(_0xd2b0e0=formatDiffWithColors(_0x2ebc0f));}_0x22f9e3['push']({'path':_0x52186f,'content':_0xda1901}),_0x1e511a[_0x5e0c91(0x138)][_0x5e0c91(0x109)]({'name':_0x584449['attributes'][_0x5e0c91(0xd9)],'outputPath':_0x52186f,'isNew':_0x139a03,'hasChanges':_0x15ff47,'diff':_0xd2b0e0}),_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0x138)][_0x5e0c91(0x15f)]++;if(_0x139a03)_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0x138)][_0x5e0c91(0x1c4)]++;else{if(_0x15ff47)_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0x138)][_0x5e0c91(0x12a)]++;else _0x1e511a[_0x5e0c91(0x166)]['knowledgeBases'][_0x5e0c91(0x1bf)]++;}}for(const _0x392501 of _0x111f7c){if(_0x392501['attributes']['isManaged'])continue;const _0x5f5234=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x194cc4),_0x392501['attributes']['name'],_0x5e0c91(0xfe));_0x5f5234[_0x5e0c91(0x11c)]&&this[_0x5e0c91(0xff)][_0x5e0c91(0x11d)](_0x5e0c91(0x190)+a123_0xe6e455[_0x5e0c91(0x125)](_0x5f5234[_0x5e0c91(0x16b)])+_0x5e0c91(0xf5)+a123_0xe6e455[_0x5e0c91(0x125)](_0x5f5234[_0x5e0c91(0xeb)]));const _0x2561a1=_0x5f5234[_0x5e0c91(0xeb)],_0x1c3815=toTextKnowledgeBaseMd(_0x392501[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)],_0x392501[_0x5e0c91(0xfb)][_0x5e0c91(0xf8)]),_0x3d2c67=!a123_0xbdc0df[_0x5e0c91(0x10d)](_0x2561a1);let _0x1009f8=_0x3d2c67,_0x3b0411;if(!_0x3d2c67){const _0x4f9d34=a123_0xbdc0df[_0x5e0c91(0xe9)](_0x2561a1,_0x5e0c91(0x164)),_0x9901a3=generateDiff(_0x4f9d34,_0x1c3815);_0x1009f8=hasChanges(_0x9901a3),_0x1009f8&&(_0x3b0411=formatDiffWithColors(_0x9901a3));}_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x2561a1,'content':_0x1c3815}),_0x1e511a[_0x5e0c91(0x172)][_0x5e0c91(0x109)]({'name':_0x392501[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)],'outputPath':_0x2561a1,'isNew':_0x3d2c67,'hasChanges':_0x1009f8,'diff':_0x3b0411}),_0x1e511a[_0x5e0c91(0x166)]['textKnowledgeBases'][_0x5e0c91(0x15f)]++;if(_0x3d2c67)_0x1e511a[_0x5e0c91(0x166)]['textKnowledgeBases']['new']++;else{if(_0x1009f8)_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0x172)]['updated']++;else _0x1e511a[_0x5e0c91(0x166)]['textKnowledgeBases'][_0x5e0c91(0x1bf)]++;}}for(const _0x34bd87 of _0x22c57c){if(_0x34bd87[_0x5e0c91(0xfb)][_0x5e0c91(0x128)])continue;const _0x196742=getSanitizedPathWithMigration(getPromptsDir(_0x194cc4),_0x34bd87[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)],_0x5e0c91(0x1ce));_0x196742[_0x5e0c91(0x11c)]&&this[_0x5e0c91(0xff)][_0x5e0c91(0x11d)](_0x5e0c91(0x1c8)+a123_0xe6e455[_0x5e0c91(0x125)](_0x196742[_0x5e0c91(0x16b)])+'\x20→\x20'+a123_0xe6e455[_0x5e0c91(0x125)](_0x196742[_0x5e0c91(0xeb)]));const _0x23950d=_0x196742[_0x5e0c91(0xeb)],_0x56ee9d=await apiPromptToYaml(_0x34bd87,_0x545455);if(!_0x56ee9d)continue;const _0x4fac8f=toPromptYamlString(_0x56ee9d),_0x48a7f8=!a123_0xbdc0df[_0x5e0c91(0x10d)](_0x23950d);let _0x24a6ac=_0x48a7f8,_0x3c365c;if(!_0x48a7f8){const _0x2af7e8=a123_0xbdc0df[_0x5e0c91(0xe9)](_0x23950d,_0x5e0c91(0x164)),_0x41cd6c=generateDiff(_0x2af7e8,_0x4fac8f);_0x24a6ac=hasChanges(_0x41cd6c),_0x24a6ac&&(_0x3c365c=formatDiffWithColors(_0x41cd6c));}_0x22f9e3['push']({'path':_0x23950d,'content':_0x4fac8f}),_0x1e511a['prompts'][_0x5e0c91(0x109)]({'name':_0x34bd87[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)],'outputPath':_0x23950d,'isNew':_0x48a7f8,'hasChanges':_0x24a6ac,'diff':_0x3c365c}),_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0xfc)]['total']++;if(_0x48a7f8)_0x1e511a['counts'][_0x5e0c91(0xfc)][_0x5e0c91(0x1c4)]++;else{if(_0x24a6ac)_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0xfc)][_0x5e0c91(0x12a)]++;else _0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0xfc)][_0x5e0c91(0x1bf)]++;}}for(const _0x54b8f2 of _0xbffe0){const _0x39f6ab=_0x54b8f2[_0x5e0c91(0xfb)][_0x5e0c91(0x17f)][_0x5e0c91(0x18d)](),_0x3f6be2=getSanitizedPathWithMigration(getIntegrationsDir(_0x194cc4),_0x39f6ab,_0x5e0c91(0x1ce));_0x3f6be2['renamed']&&this[_0x5e0c91(0xff)][_0x5e0c91(0x11d)](_0x5e0c91(0x17c)+a123_0xe6e455['basename'](_0x3f6be2[_0x5e0c91(0x16b)])+_0x5e0c91(0xf5)+a123_0xe6e455[_0x5e0c91(0x125)](_0x3f6be2['path']));const _0x662a7f=_0x3f6be2[_0x5e0c91(0xeb)],_0x1bf8f8=await apiIntegrationToYaml(_0x54b8f2,_0x545455),_0x59dc66=toIntegrationYamlString(_0x1bf8f8),_0x4c5a98=!a123_0xbdc0df['existsSync'](_0x662a7f);let _0x264866=_0x4c5a98,_0xf5d6c0;if(!_0x4c5a98){const _0x13f900=a123_0xbdc0df[_0x5e0c91(0xe9)](_0x662a7f,_0x5e0c91(0x164)),_0x1216ae=generateDiff(_0x13f900,_0x59dc66);_0x264866=hasChanges(_0x1216ae),_0x264866&&(_0xf5d6c0=formatDiffWithColors(_0x1216ae));}_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x662a7f,'content':_0x59dc66}),_0x1e511a[_0x5e0c91(0xa8)][_0x5e0c91(0x109)]({'name':_0x39f6ab,'outputPath':_0x662a7f,'isNew':_0x4c5a98,'hasChanges':_0x264866,'diff':_0xf5d6c0}),_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0xa8)][_0x5e0c91(0x15f)]++;if(_0x4c5a98)_0x1e511a['counts'][_0x5e0c91(0xa8)][_0x5e0c91(0x1c4)]++;else{if(_0x264866)_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0xa8)][_0x5e0c91(0x12a)]++;else _0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0xa8)][_0x5e0c91(0x1bf)]++;}}for(const _0x3cae47 of _0x2bfd74){if(_0x3cae47[_0x5e0c91(0xfb)]['isManaged'])continue;const _0x529730=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x194cc4),_0x3cae47[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)]);_0x529730[_0x5e0c91(0x11c)]&&this[_0x5e0c91(0xff)][_0x5e0c91(0x11d)](_0x5e0c91(0x107)+a123_0xe6e455['basename'](_0x529730['oldPath'])+'\x20→\x20'+a123_0xe6e455['basename'](_0x529730[_0x5e0c91(0xeb)]));const _0x30701c=_0x529730[_0x5e0c91(0xeb)],_0x5d3f4a=a123_0xe6e455[_0x5e0c91(0xfd)](_0x30701c,sanitizeForFilesystem(_0x3cae47[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)])+'.yml'),_0x30b4da=a123_0xe6e455[_0x5e0c91(0xfd)](_0x30701c,_0x5e0c91(0x15d)),_0x53e32d=apiExperimentalKnowledgeBaseToYaml(_0x3cae47),_0x16b9b8=toExperimentalKnowledgeBaseYamlString(_0x53e32d),_0x2bfa72=!a123_0xbdc0df[_0x5e0c91(0x10d)](_0x30701c);let _0x453910=_0x2bfa72,_0x3d7402,_0x51d7de=_0x16b9b8;const _0x5714fe=[..._0x53e32d['functions']][_0x5e0c91(0x1ad)]((_0x548184,_0x416aad)=>_0x548184[_0x5e0c91(0xd9)]['localeCompare'](_0x416aad[_0x5e0c91(0xd9)]));for(const _0x43bfad of _0x5714fe){_0x51d7de+=_0x5e0c91(0xd7)+_0x43bfad[_0x5e0c91(0xd9)]+_0x5e0c91(0x105)+_0x43bfad[_0x5e0c91(0x155)]+_0x5e0c91(0xa9)+_0x43bfad[_0x5e0c91(0xd9)]+'\x20---\x0a'+_0x43bfad[_0x5e0c91(0x1a2)]+'\x0a';}if(!_0x2bfa72){let _0xd065ad='';a123_0xbdc0df['existsSync'](_0x5d3f4a)&&(_0xd065ad=a123_0xbdc0df[_0x5e0c91(0xe9)](_0x5d3f4a,_0x5e0c91(0x164)));if(a123_0xbdc0df[_0x5e0c91(0x10d)](_0x30b4da)){const _0x2e4b93=a123_0xbdc0df[_0x5e0c91(0x19e)](_0x30b4da,{'withFileTypes':!![]}),_0x488fa0=_0x2e4b93[_0x5e0c91(0x11b)](_0x14488f=>_0x14488f[_0x5e0c91(0x141)]())[_0x5e0c91(0x1ad)]((_0x26b4b9,_0x28c4f0)=>_0x26b4b9[_0x5e0c91(0xd9)][_0x5e0c91(0xcd)](_0x28c4f0[_0x5e0c91(0xd9)]));for(const _0x440dc1 of _0x488fa0){const _0x51896e=a123_0xe6e455['join'](_0x30b4da,_0x440dc1[_0x5e0c91(0xd9)],_0x5e0c91(0xcc)),_0x3d0a71=a123_0xe6e455[_0x5e0c91(0xfd)](_0x30b4da,_0x440dc1[_0x5e0c91(0xd9)],_0x5e0c91(0xde));a123_0xbdc0df[_0x5e0c91(0x10d)](_0x51896e)&&(_0xd065ad+=_0x5e0c91(0xd7)+_0x440dc1['name']+'\x20---\x0a'+a123_0xbdc0df[_0x5e0c91(0xe9)](_0x51896e,_0x5e0c91(0x164))+'\x0a'),a123_0xbdc0df[_0x5e0c91(0x10d)](_0x3d0a71)&&(_0xd065ad+=_0x5e0c91(0xb0)+_0x440dc1[_0x5e0c91(0xd9)]+'\x20---\x0a'+a123_0xbdc0df[_0x5e0c91(0xe9)](_0x3d0a71,_0x5e0c91(0x164))+'\x0a');}}const _0x5769ff=generateDiff(_0xd065ad,_0x51d7de);_0x453910=hasChanges(_0x5769ff),_0x453910&&(_0x3d7402=formatDiffWithColors(_0x5769ff));}_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x30701c,'content':'','isDir':!![]}),_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x5d3f4a,'content':_0x16b9b8}),_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x30b4da,'content':'','isDir':!![]});for(const _0x8b4aed of _0x53e32d[_0x5e0c91(0x15d)]){const _0x134844=a123_0xe6e455['join'](_0x30b4da,sanitizeForFilesystem(_0x8b4aed[_0x5e0c91(0xd9)])),_0x2a6a3d=a123_0xe6e455[_0x5e0c91(0xfd)](_0x134844,'code.js'),_0x1f58fa=a123_0xe6e455[_0x5e0c91(0xfd)](_0x134844,_0x5e0c91(0xde));_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x134844,'content':'','isDir':!![]}),_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x2a6a3d,'content':_0x8b4aed[_0x5e0c91(0x155)]}),_0x22f9e3['push']({'path':_0x1f58fa,'content':_0x8b4aed[_0x5e0c91(0x1a2)]});}if(a123_0xbdc0df['existsSync'](_0x30b4da)){const _0x4370f7=a123_0xbdc0df[_0x5e0c91(0x19e)](_0x30b4da,{'withFileTypes':!![]}),_0x543ca1=new Set(_0x53e32d['functions'][_0x5e0c91(0xf1)](_0xbb8505=>sanitizeForFilesystem(_0xbb8505[_0x5e0c91(0xd9)])));for(const _0xecfb2d of _0x4370f7){if(_0xecfb2d[_0x5e0c91(0x141)]()&&!_0x543ca1[_0x5e0c91(0xe8)](_0xecfb2d[_0x5e0c91(0xd9)])){const _0x4e6f09=a123_0xe6e455[_0x5e0c91(0xfd)](_0x30b4da,_0xecfb2d[_0x5e0c91(0xd9)]);_0x3855a5[_0x5e0c91(0x109)]({'path':_0x4e6f09,'isDir':!![]});}}}_0x1e511a[_0x5e0c91(0x1ab)][_0x5e0c91(0x109)]({'name':_0x3cae47[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)],'outputPath':_0x30701c,'isNew':_0x2bfa72,'hasChanges':_0x453910,'diff':_0x3d7402}),_0x1e511a[_0x5e0c91(0x166)]['experimentalKnowledgeBases']['total']++;if(_0x2bfa72)_0x1e511a[_0x5e0c91(0x166)]['experimentalKnowledgeBases'][_0x5e0c91(0x1c4)]++;else{if(_0x453910)_0x1e511a['counts'][_0x5e0c91(0x1ab)][_0x5e0c91(0x12a)]++;else _0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0x1ab)]['unchanged']++;}}for(const _0x4626b0 of _0x2d18ca){if(_0x4626b0[_0x5e0c91(0xfb)][_0x5e0c91(0x128)])continue;const _0x3f7c20=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x194cc4),_0x4626b0['attributes']['name']);_0x3f7c20[_0x5e0c91(0x11c)]&&this[_0x5e0c91(0xff)]['info']('Renamed\x20experimental\x20artifact\x20directory:\x20'+a123_0xe6e455[_0x5e0c91(0x125)](_0x3f7c20[_0x5e0c91(0x16b)])+'\x20→\x20'+a123_0xe6e455[_0x5e0c91(0x125)](_0x3f7c20[_0x5e0c91(0xeb)]));const _0x182e0f=_0x3f7c20[_0x5e0c91(0xeb)],_0x2e400f=a123_0xe6e455[_0x5e0c91(0xfd)](_0x182e0f,sanitizeForFilesystem(_0x4626b0[_0x5e0c91(0xfb)][_0x5e0c91(0xd9)])+_0x5e0c91(0x1ce)),_0x514ecd=a123_0xe6e455[_0x5e0c91(0xfd)](_0x182e0f,_0x5e0c91(0xcc)),_0x35fc8c=a123_0xe6e455[_0x5e0c91(0xfd)](_0x182e0f,_0x5e0c91(0x19d)),_0xd22bf5=apiExperimentalArtifactToYaml(_0x4626b0),_0x41c148=toExperimentalArtifactYamlString(_0xd22bf5),_0x37d237=!a123_0xbdc0df['existsSync'](_0x182e0f);let _0x740c95=_0x37d237,_0x422889,_0x1db121=_0x41c148+(_0x5e0c91(0x170)+_0xd22bf5[_0x5e0c91(0x155)]+'\x0a');const _0x43eab8=[..._0xd22bf5[_0x5e0c91(0x19d)]][_0x5e0c91(0x1ad)]((_0x348af0,_0x1012b8)=>_0x348af0['file_name'][_0x5e0c91(0xcd)](_0x1012b8[_0x5e0c91(0xab)]));for(const _0x1c679f of _0x43eab8){_0x1db121+=_0x5e0c91(0xc7)+_0x1c679f['file_name']+'\x20---\x0a'+_0x1c679f[_0x5e0c91(0x192)]+'\x0a';}if(!_0x37d237){let _0x2f557b='';a123_0xbdc0df[_0x5e0c91(0x10d)](_0x2e400f)&&(_0x2f557b=a123_0xbdc0df[_0x5e0c91(0xe9)](_0x2e400f,_0x5e0c91(0x164)));a123_0xbdc0df['existsSync'](_0x514ecd)&&(_0x2f557b+=_0x5e0c91(0x170)+a123_0xbdc0df[_0x5e0c91(0xe9)](_0x514ecd,'utf-8')+'\x0a');if(a123_0xbdc0df[_0x5e0c91(0x10d)](_0x35fc8c)){const _0x4a2395=a123_0xbdc0df[_0x5e0c91(0x19e)](_0x35fc8c),_0x56a759=_0x4a2395['filter'](_0x3856db=>{const _0xc6a646=_0x5e0c91,_0x2632b5=a123_0xe6e455['join'](_0x35fc8c,_0x3856db);return a123_0xbdc0df[_0xc6a646(0xdd)](_0x2632b5)[_0xc6a646(0x119)]();})[_0x5e0c91(0x1ad)]((_0x538da0,_0x4cb96c)=>_0x538da0[_0x5e0c91(0xcd)](_0x4cb96c));for(const _0x544c23 of _0x56a759){const _0x1cbc39=a123_0xe6e455[_0x5e0c91(0xfd)](_0x35fc8c,_0x544c23);_0x2f557b+=_0x5e0c91(0xc7)+_0x544c23+_0x5e0c91(0x105)+a123_0xbdc0df[_0x5e0c91(0xe9)](_0x1cbc39,'utf-8')+'\x0a';}}const _0x498992=generateDiff(_0x2f557b,_0x1db121);_0x740c95=hasChanges(_0x498992),_0x740c95&&(_0x422889=formatDiffWithColors(_0x498992));}_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x182e0f,'content':'','isDir':!![]}),_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x2e400f,'content':_0x41c148}),_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x514ecd,'content':_0xd22bf5[_0x5e0c91(0x155)]});if(_0xd22bf5[_0x5e0c91(0x19d)]['length']>0x0){_0x22f9e3['push']({'path':_0x35fc8c,'content':'','isDir':!![]});for(const _0x3a5470 of _0xd22bf5[_0x5e0c91(0x19d)]){const _0x53c63d=a123_0xe6e455[_0x5e0c91(0xfd)](_0x35fc8c,_0x3a5470[_0x5e0c91(0xab)]);_0x22f9e3[_0x5e0c91(0x109)]({'path':_0x53c63d,'content':_0x3a5470[_0x5e0c91(0x192)]});}}if(a123_0xbdc0df[_0x5e0c91(0x10d)](_0x35fc8c)){const _0x4b3617=a123_0xbdc0df[_0x5e0c91(0x19e)](_0x35fc8c),_0x2beb13=new Set(_0xd22bf5[_0x5e0c91(0x19d)][_0x5e0c91(0xf1)](_0x22cd90=>_0x22cd90[_0x5e0c91(0xab)]));for(const _0x42f997 of _0x4b3617){const _0x3af0e6=a123_0xe6e455[_0x5e0c91(0xfd)](_0x35fc8c,_0x42f997);a123_0xbdc0df[_0x5e0c91(0xdd)](_0x3af0e6)[_0x5e0c91(0x119)]()&&!_0x2beb13['has'](_0x42f997)&&_0x3855a5[_0x5e0c91(0x109)]({'path':_0x3af0e6});}}_0x1e511a['experimentalArtifacts'][_0x5e0c91(0x109)]({'name':_0x4626b0['attributes']['name'],'outputPath':_0x182e0f,'isNew':_0x37d237,'hasChanges':_0x740c95,'diff':_0x422889}),_0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0xc0)][_0x5e0c91(0x15f)]++;if(_0x37d237)_0x1e511a[_0x5e0c91(0x166)]['experimentalArtifacts']['new']++;else{if(_0x740c95)_0x1e511a[_0x5e0c91(0x166)]['experimentalArtifacts'][_0x5e0c91(0x12a)]++;else _0x1e511a[_0x5e0c91(0x166)][_0x5e0c91(0xc0)][_0x5e0c91(0x1bf)]++;}}if(_0x27c9fa?.[_0x5e0c91(0x1aa)])return _0x1e511a;a123_0xbdc0df[_0x5e0c91(0xe2)](_0x194cc4,{'recursive':!![]}),a123_0xbdc0df[_0x5e0c91(0xe2)](getKnowledgeBasesDir(_0x194cc4),{'recursive':!![]}),a123_0xbdc0df['mkdirSync'](getPromptsDir(_0x194cc4),{'recursive':!![]}),a123_0xbdc0df[_0x5e0c91(0xe2)](getIntegrationsDir(_0x194cc4),{'recursive':!![]}),a123_0xbdc0df['mkdirSync'](getExperimentalKnowledgeBasesDir(_0x194cc4),{'recursive':!![]}),a123_0xbdc0df[_0x5e0c91(0xe2)](getExperimentalArtifactsDir(_0x194cc4),{'recursive':!![]});const _0x14f76b=a123_0xe6e455[_0x5e0c91(0xfd)](_0x194cc4,_0x5e0c91(0xc4));a123_0xbdc0df[_0x5e0c91(0x169)](_0x14f76b,createAgentConfigContent(_0x21681a));for(const _0x10a17d of _0x22f9e3){if(_0x10a17d[_0x5e0c91(0x1b8)])a123_0xbdc0df[_0x5e0c91(0xe2)](_0x10a17d[_0x5e0c91(0xeb)],{'recursive':!![]});else{const _0x460ce9=a123_0xe6e455[_0x5e0c91(0x10c)](_0x10a17d[_0x5e0c91(0xeb)]);!a123_0xbdc0df['existsSync'](_0x460ce9)&&a123_0xbdc0df[_0x5e0c91(0xe2)](_0x460ce9,{'recursive':!![]}),a123_0xbdc0df[_0x5e0c91(0x169)](_0x10a17d[_0x5e0c91(0xeb)],_0x10a17d[_0x5e0c91(0x184)]);}}for(const _0x2925f3 of _0x3855a5){_0x2925f3['isDir']?(a123_0xbdc0df[_0x5e0c91(0x110)](_0x2925f3[_0x5e0c91(0xeb)],{'recursive':!![],'force':!![]}),this[_0x5e0c91(0xff)]['info'](_0x5e0c91(0x15e)+a123_0xe6e455[_0x5e0c91(0x125)](a123_0xe6e455['dirname'](_0x2925f3['path']))+'/'+a123_0xe6e455[_0x5e0c91(0x125)](_0x2925f3[_0x5e0c91(0xeb)]))):(a123_0xbdc0df['rmSync'](_0x2925f3[_0x5e0c91(0xeb)],{'force':!![]}),this[_0x5e0c91(0xff)][_0x5e0c91(0x11d)](_0x5e0c91(0xac)+a123_0xe6e455[_0x5e0c91(0x125)](a123_0xe6e455[_0x5e0c91(0x10c)](_0x2925f3[_0x5e0c91(0xeb)]))+'/'+a123_0xe6e455[_0x5e0c91(0x125)](_0x2925f3[_0x5e0c91(0xeb)])));}return _0x1e511a;}async[a123_0x44cb81(0x127)](_0x1bcaa4,_0x48d7be){const _0x339701=a123_0x44cb81,_0x43b93f=a123_0xe6e455['join'](_0x1bcaa4,_0x339701(0xc4));if(!a123_0xbdc0df[_0x339701(0x10d)](_0x43b93f))throw new SDKError(ErrorCode[_0x339701(0x146)],_0x339701(0x1b4)+_0x1bcaa4,undefined,{'helpText':_0x339701(0x1cb)});const _0x15448b=loadAgentConfig(_0x43b93f),_0x15f1ee=await this[_0x339701(0xf4)](_0x15448b[_0x339701(0xba)]),_0x4c750e=await this[_0x339701(0x147)][_0x339701(0x197)](_0x15f1ee),_0x420db2=_0x4c750e[_0x339701(0xfb)][_0x339701(0xd9)],_0x38f469={'projectName':_0x420db2,'projectId':_0x15f1ee,'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}}},_0x39961d=[],_0x5add69=[],_0x1d4e9c=[],_0x28ca99=[],_0x568323=[],_0x7f36bd=[],_0x497a21=a123_0xbdc0df[_0x339701(0x19e)](_0x1bcaa4,{'withFileTypes':!![]});for(const _0x5d33b6 of _0x497a21){if(!_0x5d33b6[_0x339701(0x141)]())continue;if([_0x339701(0x1c7),_0x339701(0xfc),_0x339701(0xa8),_0x339701(0x176),_0x339701(0x123)][_0x339701(0x160)](_0x5d33b6[_0x339701(0xd9)]))continue;const _0x3089d7=a123_0xe6e455[_0x339701(0xfd)](_0x1bcaa4,_0x5d33b6[_0x339701(0xd9)]);if(isAgentDir(_0x3089d7)){const _0xa5afe9=a123_0xe6e455[_0x339701(0xfd)](_0x3089d7,'agent.yml'),_0x42d391=a123_0xe6e455['join'](_0x3089d7,_0x339701(0xdb)),_0x4bf550=a123_0xe6e455[_0x339701(0xfd)](_0x3089d7,_0x339701(0xa6)),_0x51c02c=parseAgentYaml(a123_0xbdc0df[_0x339701(0xe9)](_0xa5afe9,_0x339701(0x164)),_0xa5afe9),_0x43f15e=a123_0xbdc0df[_0x339701(0x10d)](_0x42d391)?a123_0xbdc0df[_0x339701(0xe9)](_0x42d391,_0x339701(0x164)):'',_0x2c351b=a123_0xbdc0df[_0x339701(0x10d)](_0x4bf550)?a123_0xbdc0df['readFileSync'](_0x4bf550,'utf-8'):_0x51c02c['starter_message'];_0x39961d['push']({'name':_0x51c02c[_0x339701(0xd9)],'dir':_0x3089d7,'yaml':_0x51c02c,'systemPrompt':_0x43f15e,'starterMessage':_0x2c351b});}}const _0x3d9415=getKnowledgeBasesDir(_0x1bcaa4);if(a123_0xbdc0df[_0x339701(0x10d)](_0x3d9415)){const _0x1df24c=a123_0xbdc0df[_0x339701(0x19e)](_0x3d9415);for(const _0x23659f of _0x1df24c){const _0x486b3a=a123_0xe6e455[_0x339701(0xfd)](_0x3d9415,_0x23659f);if(_0x23659f[_0x339701(0x1b7)](_0x339701(0x1ce))){const _0x5dc814=parseKnowledgeBaseYaml(a123_0xbdc0df['readFileSync'](_0x486b3a,_0x339701(0x164)),_0x486b3a);_0x5add69['push']({'name':_0x5dc814[_0x339701(0xd9)],'path':_0x486b3a,'yaml':_0x5dc814});}else{if(_0x23659f[_0x339701(0x1b7)](_0x339701(0xfe))){const _0x251bff=a123_0xbdc0df[_0x339701(0xe9)](_0x486b3a,_0x339701(0x164)),{name:_0x5d685c,text:_0x423e94}=parseTextKnowledgeBaseMd(_0x251bff,_0x23659f);_0x1d4e9c[_0x339701(0x109)]({'name':_0x5d685c,'path':_0x486b3a,'text':_0x423e94});}}}}const _0x2c4405=getPromptsDir(_0x1bcaa4);if(a123_0xbdc0df[_0x339701(0x10d)](_0x2c4405)){const _0x14109e=a123_0xbdc0df['readdirSync'](_0x2c4405)[_0x339701(0x11b)](_0x27d74b=>_0x27d74b[_0x339701(0x1b7)]('.yml'));for(const _0x473ffa of _0x14109e){const _0x572c79=a123_0xe6e455[_0x339701(0xfd)](_0x2c4405,_0x473ffa),_0xf6931e=parsePromptYaml(a123_0xbdc0df[_0x339701(0xe9)](_0x572c79,_0x339701(0x164)),_0x572c79);_0x28ca99[_0x339701(0x109)]({'name':_0xf6931e['name'],'path':_0x572c79,'yaml':_0xf6931e});}}const _0x4a89dd=[],_0x443571=getIntegrationsDir(_0x1bcaa4);if(a123_0xbdc0df[_0x339701(0x10d)](_0x443571)){const _0x27746b=a123_0xbdc0df['readdirSync'](_0x443571)[_0x339701(0x11b)](_0x5cf667=>_0x5cf667[_0x339701(0x1b7)]('.yml'));for(const _0x507a6d of _0x27746b){const _0x738fef=a123_0xe6e455['join'](_0x443571,_0x507a6d),_0x4b3785=parseIntegrationYaml(a123_0xbdc0df[_0x339701(0xe9)](_0x738fef,_0x339701(0x164)),_0x738fef);if(!SAFE_INTEGRATION_TYPES[_0x339701(0x160)](_0x4b3785[_0x339701(0xb1)][_0x339701(0x18d)]())){this[_0x339701(0xff)]['warn'](_0x339701(0x17a)+_0x4b3785[_0x339701(0xd9)]+_0x339701(0xf2)+_0x4b3785[_0x339701(0xb1)]+'):\x20'+(_0x339701(0xb8)+SAFE_INTEGRATION_TYPES[_0x339701(0xfd)](',\x20')+')\x20can\x20be\x20pushed.\x20')+_0x339701(0x171));continue;}_0x4a89dd[_0x339701(0x109)]({'name':_0x4b3785[_0x339701(0xd9)],'path':_0x738fef,'yaml':_0x4b3785});}}const _0x2666b1=getExperimentalKnowledgeBasesDir(_0x1bcaa4);if(a123_0xbdc0df[_0x339701(0x10d)](_0x2666b1)){const _0x33653e=a123_0xbdc0df[_0x339701(0x19e)](_0x2666b1,{'withFileTypes':!![]});for(const _0x48cc2a of _0x33653e){if(!_0x48cc2a[_0x339701(0x141)]())continue;const _0x529c1c=a123_0xe6e455['join'](_0x2666b1,_0x48cc2a[_0x339701(0xd9)]),_0x63bbb1=a123_0xe6e455['join'](_0x529c1c,_0x48cc2a[_0x339701(0xd9)]+_0x339701(0x1ce)),_0x3665c6=a123_0xe6e455['join'](_0x529c1c,_0x339701(0x15d));if(!a123_0xbdc0df[_0x339701(0x10d)](_0x63bbb1))continue;const _0x4e3e9c=parseExperimentalKnowledgeBaseYaml(a123_0xbdc0df[_0x339701(0xe9)](_0x63bbb1,_0x339701(0x164)),_0x63bbb1),_0x69968a=[];if(a123_0xbdc0df[_0x339701(0x10d)](_0x3665c6)){const _0x327c38=a123_0xbdc0df[_0x339701(0x19e)](_0x3665c6,{'withFileTypes':!![]});for(const _0x48795c of _0x327c38){if(!_0x48795c['isDirectory']())continue;const _0x1498a5=a123_0xe6e455[_0x339701(0xfd)](_0x3665c6,_0x48795c[_0x339701(0xd9)]),_0x39e005=a123_0xe6e455[_0x339701(0xfd)](_0x1498a5,_0x339701(0xcc)),_0x4b01c9=a123_0xe6e455[_0x339701(0xfd)](_0x1498a5,_0x339701(0xde));a123_0xbdc0df['existsSync'](_0x39e005)&&a123_0xbdc0df[_0x339701(0x10d)](_0x4b01c9)&&_0x69968a[_0x339701(0x109)]({'name':_0x48795c[_0x339701(0xd9)],'code':a123_0xbdc0df['readFileSync'](_0x39e005,'utf-8'),'json_schema':a123_0xbdc0df[_0x339701(0xe9)](_0x4b01c9,_0x339701(0x164))});}}const _0x489256={..._0x4e3e9c,'variables':_0x4e3e9c[_0x339701(0xbd)]||[],'functions':_0x69968a};_0x568323['push']({'name':_0x4e3e9c[_0x339701(0xd9)],'dir':_0x529c1c,'def':_0x489256});}}const _0x1a79a3=getExperimentalArtifactsDir(_0x1bcaa4);if(a123_0xbdc0df[_0x339701(0x10d)](_0x1a79a3)){const _0x2c92e6=a123_0xbdc0df[_0x339701(0x19e)](_0x1a79a3,{'withFileTypes':!![]});for(const _0x4cf353 of _0x2c92e6){if(!_0x4cf353[_0x339701(0x141)]())continue;const _0x159b8c=a123_0xe6e455[_0x339701(0xfd)](_0x1a79a3,_0x4cf353['name']),_0x14a97f=a123_0xe6e455[_0x339701(0xfd)](_0x159b8c,_0x4cf353[_0x339701(0xd9)]+_0x339701(0x1ce)),_0x414912=a123_0xe6e455[_0x339701(0xfd)](_0x159b8c,'code.js'),_0x3d9509=a123_0xe6e455['join'](_0x159b8c,_0x339701(0x19d));if(!a123_0xbdc0df[_0x339701(0x10d)](_0x14a97f)||!a123_0xbdc0df[_0x339701(0x10d)](_0x414912))continue;const _0x507e0f=parseExperimentalArtifactYaml(a123_0xbdc0df[_0x339701(0xe9)](_0x14a97f,_0x339701(0x164)),_0x14a97f),_0x10be6c=a123_0xbdc0df[_0x339701(0xe9)](_0x414912,'utf-8'),_0x3bdaeb=[];if(a123_0xbdc0df['existsSync'](_0x3d9509)){const _0x255427=a123_0xbdc0df['readdirSync'](_0x3d9509);for(const _0x15733e of _0x255427){const _0x216343=a123_0xe6e455[_0x339701(0xfd)](_0x3d9509,_0x15733e);a123_0xbdc0df[_0x339701(0xdd)](_0x216343)[_0x339701(0x119)]()&&_0x3bdaeb['push']({'file_name':_0x15733e,'text_content':a123_0xbdc0df[_0x339701(0xe9)](_0x216343,_0x339701(0x164))});}}const _0x322dcf={..._0x507e0f,'code':_0x10be6c,'files':_0x3bdaeb};_0x7f36bd['push']({'name':_0x507e0f['name'],'dir':_0x159b8c,'def':_0x322dcf});}}const _0x3ac46e=await this[_0x339701(0x147)]['listAgentsFull'](_0x15f1ee),_0x71f371=await this[_0x339701(0x147)][_0x339701(0x135)](_0x15f1ee),_0x219f91=await this[_0x339701(0x147)][_0x339701(0x154)](_0x15f1ee),_0x2cc4f6=await this['client']['listPrompts'](_0x15f1ee),_0x2cca72=await this[_0x339701(0x147)][_0x339701(0xca)](_0x15f1ee),_0x5e2f5a=await safeListOrEmpty(()=>this[_0x339701(0x147)][_0x339701(0xc2)](_0x15f1ee)),_0x35f153=await safeListOrEmpty(()=>this['client']['listExperimentalArtifacts'](_0x15f1ee)),_0x5ea31f=await fetchAllToolTargetMaps((_0x4358ac,_0x6ea999)=>this['client'][_0x339701(0xe4)](_0x4358ac,_0x6ea999),_0x15f1ee),_0x16f481=new Map(),_0x395e6b=new Map(),_0x32109e=new Map(),_0x2c1e56=new Map(),_0x434b4a=new Map(),_0x27d9aa=new Map(),_0x4a4a1c=new Map();for(const _0x454dbb of _0x3ac46e){_0x16f481[_0x339701(0x19b)](_0x454dbb[_0x339701(0xfb)][_0x339701(0xd9)],_0x454dbb);}for(const _0x288422 of _0x71f371){_0x395e6b[_0x339701(0x19b)](_0x288422['attributes'][_0x339701(0xd9)],_0x288422);}for(const _0x3702c1 of _0x219f91){_0x32109e[_0x339701(0x19b)](_0x3702c1[_0x339701(0xfb)][_0x339701(0xd9)],_0x3702c1);}for(const _0x5aaad0 of _0x2cc4f6){_0x2c1e56[_0x339701(0x19b)](_0x5aaad0[_0x339701(0xfb)][_0x339701(0xd9)],_0x5aaad0);}for(const _0x234311 of _0x2cca72){_0x434b4a[_0x339701(0x19b)](_0x234311[_0x339701(0xfb)][_0x339701(0x17f)][_0x339701(0x18d)](),_0x234311);}for(const _0x29005b of _0x5e2f5a){_0x27d9aa[_0x339701(0x19b)](_0x29005b[_0x339701(0xfb)][_0x339701(0xd9)],_0x29005b);}for(const _0x2efee8 of _0x35f153){_0x4a4a1c['set'](_0x2efee8[_0x339701(0xfb)][_0x339701(0xd9)],_0x2efee8);}const _0x582a36=new Map(),_0x461eba=new Map();for(const _0xca49a7 of _0x3ac46e){_0x582a36[_0x339701(0x19b)](_0xca49a7[_0x339701(0xfb)]['name'],_0xca49a7['id']),_0x461eba['set'](_0xca49a7['id'],_0xca49a7['attributes'][_0x339701(0xd9)]);}const _0x5be9fa=new Map(),_0x391778=new Map();for(const _0x5f4ee5 of _0x2cc4f6){_0x5be9fa[_0x339701(0x19b)](_0x5f4ee5[_0x339701(0xfb)][_0x339701(0xd9)],_0x5f4ee5['id']),_0x391778['set'](_0x5f4ee5['id'],_0x5f4ee5[_0x339701(0xfb)][_0x339701(0xd9)]);}const _0x4490a4=_0x5ea31f[_0x339701(0xb6)][_0x339701(0x193)]||new Map(),_0x1f3b8e=_0x5ea31f['nameToId'][_0x339701(0x10a)]||new Map(),_0x5b4c3a=_0x5ea31f['nameToId']['ExperimentalKnowledgeBase']||new Map(),_0x2c126d=new Map(),_0x23de3e={'resolveToolTargetName':buildNameResolver({..._0x5ea31f[_0x339701(0x179)],'Agent':_0x461eba}),'resolvePromptName':async _0x26a4c2=>_0x391778[_0x339701(0x174)](_0x26a4c2),'onWarning':_0x4a0b26=>this[_0x339701(0xff)][_0x339701(0x13b)](_0x4a0b26)};let _0xe34015=[];const _0x4ece={'projectId':_0x15f1ee,'resolveToolTargetId':buildIdResolver({..._0x5ea31f[_0x339701(0xb6)],'Agent':_0x582a36}),'resolvePromptId':async _0x34088e=>_0x5be9fa[_0x339701(0x174)](_0x34088e),'onWarning':_0x4a2266=>{const _0x238c4f=_0x339701;this[_0x238c4f(0xff)]['warn'](_0x4a2266),_0xe34015['push'](_0x4a2266);}},{resolved:_0x16610d,unresolved:_0x15fcdd}=resolveAgentDependencies(_0x39961d,new Set(_0x16f481['keys']()));for(const {agent:_0x5a2161,missingDeps:_0xb5e05}of _0x15fcdd){_0x38f469['agents'][_0x339701(0x109)]({'agentName':_0x5a2161[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x156),'error':_0x339701(0xb2)+_0xb5e05['join'](',\x20')+_0x339701(0xe1)}),_0x38f469[_0x339701(0x166)][_0x339701(0x13a)]['errors']++;}for(const _0x31c2a6 of _0x5add69){const _0x37d3dc=_0x395e6b[_0x339701(0x174)](_0x31c2a6[_0x339701(0x1c5)][_0x339701(0xd9)]),_0x272975=a123_0xbdc0df[_0x339701(0xe9)](_0x31c2a6['path'],_0x339701(0x164));if(_0x37d3dc){const _0x5e2e60=apiKnowledgeBaseToYaml(_0x37d3dc),_0x21d66f=toKnowledgeBaseYamlString(_0x5e2e60),_0x33b319=generateDiff(_0x21d66f,_0x272975),_0x6debfc=hasChanges(_0x33b319);_0x6debfc?(_0x38f469[_0x339701(0x138)][_0x339701(0x109)]({'name':_0x31c2a6[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x12a),'id':_0x37d3dc['id'],'diff':formatDiffWithColors(_0x33b319)}),_0x38f469[_0x339701(0x166)][_0x339701(0x138)][_0x339701(0x12a)]++):(_0x38f469[_0x339701(0x138)][_0x339701(0x109)]({'name':_0x31c2a6[_0x339701(0x1c5)]['name'],'action':_0x339701(0x1bf),'id':_0x37d3dc['id']}),_0x38f469['counts'][_0x339701(0x138)][_0x339701(0x1bf)]++);}else _0x38f469[_0x339701(0x138)][_0x339701(0x109)]({'name':_0x31c2a6[_0x339701(0x1c5)][_0x339701(0xd9)],'action':'created'}),_0x38f469[_0x339701(0x166)][_0x339701(0x138)]['created']++;}for(const _0x376558 of _0x1d4e9c){const _0x5093d9=_0x32109e[_0x339701(0x174)](_0x376558[_0x339701(0xd9)]),_0x46b990=a123_0xbdc0df[_0x339701(0xe9)](_0x376558[_0x339701(0xeb)],'utf-8');if(_0x5093d9){const _0x2fba52=toTextKnowledgeBaseMd(_0x5093d9[_0x339701(0xfb)]['name'],_0x5093d9['attributes']['text']),_0x504d90=generateDiff(_0x2fba52,_0x46b990),_0x2154d5=hasChanges(_0x504d90);_0x2154d5?(_0x38f469[_0x339701(0x172)][_0x339701(0x109)]({'name':_0x376558[_0x339701(0xd9)],'action':_0x339701(0x12a),'id':_0x5093d9['id'],'diff':formatDiffWithColors(_0x504d90)}),_0x38f469[_0x339701(0x166)][_0x339701(0x172)][_0x339701(0x12a)]++):(_0x38f469['textKnowledgeBases'][_0x339701(0x109)]({'name':_0x376558[_0x339701(0xd9)],'action':'unchanged','id':_0x5093d9['id']}),_0x38f469['counts'][_0x339701(0x172)]['unchanged']++);}else _0x38f469[_0x339701(0x172)]['push']({'name':_0x376558[_0x339701(0xd9)],'action':'created'}),_0x38f469[_0x339701(0x166)][_0x339701(0x172)][_0x339701(0x12e)]++;}for(const _0x349f01 of _0x16610d){const _0x3ca56f=_0x16f481[_0x339701(0x174)](_0x349f01[_0x339701(0x1c5)][_0x339701(0xd9)]),_0xfc78b6=a123_0xe6e455['join'](_0x349f01[_0x339701(0x106)],_0x339701(0x121)),_0x49699e=a123_0xbdc0df['readFileSync'](_0xfc78b6,'utf-8'),_0x13e2c0=_0x349f01[_0x339701(0x132)],_0x114cc8=_0x339701(0x1ae)+_0x13e2c0+_0x339701(0xee)+_0x49699e;if(_0x3ca56f){const {yaml:_0x5744d5,systemPrompt:_0x322d6e}=await agentResponseToDef(_0x3ca56f,_0x23de3e),_0x2059aa=toAgentYamlString(_0x5744d5),_0x112f32=_0x339701(0x1ae)+_0x322d6e+'\x0a\x0a#\x20agent.yml\x0a'+_0x2059aa,_0x814989=generateDiff(_0x112f32,_0x114cc8),_0x15f0ba=hasChanges(_0x814989);_0x15f0ba?(_0x38f469[_0x339701(0x13a)][_0x339701(0x109)]({'agentName':_0x349f01[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x12a),'agentId':_0x3ca56f['id'],'diff':formatDiffWithColors(_0x814989)}),_0x38f469[_0x339701(0x166)]['agents'][_0x339701(0x12a)]++):(_0x38f469['agents'][_0x339701(0x109)]({'agentName':_0x349f01[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x1bf),'agentId':_0x3ca56f['id']}),_0x38f469['counts'][_0x339701(0x13a)]['unchanged']++);}else _0x38f469[_0x339701(0x13a)][_0x339701(0x109)]({'agentName':_0x349f01['yaml'][_0x339701(0xd9)],'action':'created'}),_0x38f469[_0x339701(0x166)][_0x339701(0x13a)]['created']++;}for(const _0x416184 of _0x28ca99){const _0x28db90=_0x2c1e56['get'](_0x416184[_0x339701(0x1c5)]['name']),_0x5ce76d=a123_0xbdc0df[_0x339701(0xe9)](_0x416184[_0x339701(0xeb)],_0x339701(0x164));if(_0x28db90){const _0x31ba56=await apiPromptToYaml(_0x28db90,_0x23de3e);if(!_0x31ba56){_0x38f469['prompts']['push']({'name':_0x416184['yaml']['name'],'action':_0x339701(0x12a),'id':_0x28db90['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0xfc)][_0x339701(0x12a)]++;continue;}const _0x30f822=toPromptYamlString(_0x31ba56),_0x2b310c=generateDiff(_0x30f822,_0x5ce76d),_0x3f5af9=hasChanges(_0x2b310c);_0x3f5af9?(_0x38f469[_0x339701(0xfc)][_0x339701(0x109)]({'name':_0x416184['yaml'][_0x339701(0xd9)],'action':'updated','id':_0x28db90['id'],'diff':formatDiffWithColors(_0x2b310c)}),_0x38f469[_0x339701(0x166)][_0x339701(0xfc)][_0x339701(0x12a)]++):(_0x38f469['prompts']['push']({'name':_0x416184['yaml'][_0x339701(0xd9)],'action':_0x339701(0x1bf),'id':_0x28db90['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0xfc)][_0x339701(0x1bf)]++);}else _0x38f469['prompts']['push']({'name':_0x416184['yaml'][_0x339701(0xd9)],'action':_0x339701(0x12e)}),_0x38f469[_0x339701(0x166)]['prompts'][_0x339701(0x12e)]++;}for(const _0x51eb27 of _0x4a89dd){const _0xdefba3=_0x434b4a['get'](_0x51eb27[_0x339701(0x1c5)][_0x339701(0xb1)]),_0xc78618=a123_0xbdc0df[_0x339701(0xe9)](_0x51eb27[_0x339701(0xeb)],'utf-8');if(_0xdefba3){const _0x56b76b=await apiIntegrationToYaml(_0xdefba3,_0x23de3e),_0x468584=toIntegrationYamlString(_0x56b76b),_0x216067=generateDiff(_0x468584,_0xc78618),_0x2b43b4=hasChanges(_0x216067);_0x2b43b4?(_0x38f469['integrations']['push']({'name':_0x51eb27[_0x339701(0x1c5)][_0x339701(0xb1)],'action':_0x339701(0x12a),'id':_0xdefba3['id'],'diff':formatDiffWithColors(_0x216067)}),_0x38f469['counts'][_0x339701(0xa8)][_0x339701(0x12a)]++):(_0x38f469[_0x339701(0xa8)][_0x339701(0x109)]({'name':_0x51eb27['yaml'][_0x339701(0xb1)],'action':_0x339701(0x1bf),'id':_0xdefba3['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0xa8)][_0x339701(0x1bf)]++);}else _0x38f469['integrations']['push']({'name':_0x51eb27['yaml'][_0x339701(0xb1)],'action':_0x339701(0x12e)}),_0x38f469[_0x339701(0x166)][_0x339701(0xa8)][_0x339701(0x12e)]++;}for(const _0x2a0ff8 of _0x568323){const _0x5b41bc=_0x27d9aa['get'](_0x2a0ff8[_0x339701(0x15b)][_0x339701(0xd9)]),_0x3f3bc8=toExperimentalKnowledgeBaseYamlString(_0x2a0ff8[_0x339701(0x15b)]);let _0x114ee5=_0x3f3bc8;for(const _0x3650d5 of _0x2a0ff8[_0x339701(0x15b)][_0x339701(0x15d)]){_0x114ee5+='\x0a---\x20function:\x20'+_0x3650d5[_0x339701(0xd9)]+_0x339701(0x105)+_0x3650d5[_0x339701(0x155)]+_0x339701(0xa9)+_0x3650d5[_0x339701(0xd9)]+'\x20---\x0a'+_0x3650d5[_0x339701(0x1a2)]+'\x0a';}if(_0x5b41bc){const _0x4be41c=apiExperimentalKnowledgeBaseToYaml(_0x5b41bc),_0x2a3916=toExperimentalKnowledgeBaseYamlString(_0x4be41c);let _0x2eaf1f=_0x2a3916;for(const _0x4ef173 of _0x4be41c[_0x339701(0x15d)]){_0x2eaf1f+='\x0a---\x20function:\x20'+_0x4ef173[_0x339701(0xd9)]+_0x339701(0x105)+_0x4ef173['code']+_0x339701(0xa9)+_0x4ef173[_0x339701(0xd9)]+_0x339701(0x105)+_0x4ef173[_0x339701(0x1a2)]+'\x0a';}const _0x47deda=generateDiff(_0x2eaf1f,_0x114ee5),_0x2fd8d5=hasChanges(_0x47deda);_0x2fd8d5?(_0x38f469[_0x339701(0x1ab)]['push']({'name':_0x2a0ff8[_0x339701(0x15b)][_0x339701(0xd9)],'action':'updated','id':_0x5b41bc['id'],'diff':formatDiffWithColors(_0x47deda)}),_0x38f469['counts']['experimentalKnowledgeBases'][_0x339701(0x12a)]++):(_0x38f469[_0x339701(0x1ab)][_0x339701(0x109)]({'name':_0x2a0ff8[_0x339701(0x15b)]['name'],'action':_0x339701(0x1bf),'id':_0x5b41bc['id']}),_0x38f469['counts'][_0x339701(0x1ab)]['unchanged']++);}else _0x38f469[_0x339701(0x1ab)][_0x339701(0x109)]({'name':_0x2a0ff8[_0x339701(0x15b)][_0x339701(0xd9)],'action':_0x339701(0x12e)}),_0x38f469[_0x339701(0x166)][_0x339701(0x1ab)][_0x339701(0x12e)]++;}for(const _0x3a678e of _0x7f36bd){const _0x5273cc=_0x4a4a1c[_0x339701(0x174)](_0x3a678e[_0x339701(0x15b)][_0x339701(0xd9)]),_0x9482e9=toExperimentalArtifactYamlString(_0x3a678e[_0x339701(0x15b)]);let _0x28e498=_0x9482e9+('\x0a---\x20code\x20---\x0a'+_0x3a678e['def']['code']+'\x0a');for(const _0x5d6ef3 of _0x3a678e[_0x339701(0x15b)][_0x339701(0x19d)]){_0x28e498+=_0x339701(0xc7)+_0x5d6ef3['file_name']+_0x339701(0x105)+_0x5d6ef3['text_content']+'\x0a';}if(_0x5273cc){const _0x2df91a=apiExperimentalArtifactToYaml(_0x5273cc),_0x3621cd=toExperimentalArtifactYamlString(_0x2df91a);let _0x582cf4=_0x3621cd+(_0x339701(0x170)+_0x2df91a[_0x339701(0x155)]+'\x0a');for(const _0x58398d of _0x2df91a[_0x339701(0x19d)]){_0x582cf4+=_0x339701(0xc7)+_0x58398d[_0x339701(0xab)]+_0x339701(0x105)+_0x58398d[_0x339701(0x192)]+'\x0a';}const _0x4e53a2=generateDiff(_0x582cf4,_0x28e498),_0x10a462=hasChanges(_0x4e53a2);_0x10a462?(_0x38f469['experimentalArtifacts'][_0x339701(0x109)]({'name':_0x3a678e[_0x339701(0x15b)][_0x339701(0xd9)],'action':_0x339701(0x12a),'id':_0x5273cc['id'],'diff':formatDiffWithColors(_0x4e53a2)}),_0x38f469[_0x339701(0x166)][_0x339701(0xc0)][_0x339701(0x12a)]++):(_0x38f469['experimentalArtifacts'][_0x339701(0x109)]({'name':_0x3a678e[_0x339701(0x15b)][_0x339701(0xd9)],'action':'unchanged','id':_0x5273cc['id']}),_0x38f469['counts']['experimentalArtifacts'][_0x339701(0x1bf)]++);}else _0x38f469['experimentalArtifacts'][_0x339701(0x109)]({'name':_0x3a678e[_0x339701(0x15b)][_0x339701(0xd9)],'action':'created'}),_0x38f469[_0x339701(0x166)]['experimentalArtifacts']['created']++;}if(_0x48d7be?.[_0x339701(0x1aa)])return _0x38f469;_0x38f469['knowledgeBases']=[],_0x38f469[_0x339701(0x172)]=[],_0x38f469[_0x339701(0xfc)]=[],_0x38f469[_0x339701(0xa8)]=[],_0x38f469['experimentalKnowledgeBases']=[],_0x38f469[_0x339701(0xc0)]=[];const _0x26fbe0=_0x38f469[_0x339701(0x13a)][_0x339701(0x11b)](_0x928389=>_0x928389[_0x339701(0xec)]===_0x339701(0x156));_0x38f469[_0x339701(0x13a)]=_0x26fbe0,_0x38f469[_0x339701(0x166)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x26fbe0[_0x339701(0x1bc)]},'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 _0x46275b of _0x5add69){try{const _0x554e74=_0x395e6b[_0x339701(0x174)](_0x46275b[_0x339701(0x1c5)][_0x339701(0xd9)]),_0x24d8ec=yamlKnowledgeBaseToApi(_0x46275b[_0x339701(0x1c5)],_0x15f1ee);if(_0x554e74)await this['client']['updateKnowledgeBase'](_0x554e74['id'],_0x24d8ec),_0x4490a4[_0x339701(0x19b)](_0x46275b[_0x339701(0x1c5)][_0x339701(0xd9)],_0x554e74['id']),_0x38f469[_0x339701(0x138)]['push']({'name':_0x46275b[_0x339701(0x1c5)][_0x339701(0xd9)],'action':'updated','id':_0x554e74['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0x138)]['updated']++;else{const _0x223370=await this[_0x339701(0x147)][_0x339701(0x1a1)](_0x24d8ec);_0x4490a4[_0x339701(0x19b)](_0x46275b['yaml'][_0x339701(0xd9)],_0x223370['id']),_0x38f469[_0x339701(0x138)][_0x339701(0x109)]({'name':_0x46275b[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x12e),'id':_0x223370['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0x138)][_0x339701(0x12e)]++;}}catch(_0x4f0434){_0x38f469[_0x339701(0x138)]['push']({'name':_0x46275b[_0x339701(0x1c5)][_0x339701(0xd9)],'action':'error','error':_0x4f0434[_0x339701(0x15a)]}),_0x38f469[_0x339701(0x166)][_0x339701(0x138)]['errors']++;}}for(const _0x2e6eec of _0x1d4e9c){try{const _0x21bd23=_0x32109e[_0x339701(0x174)](_0x2e6eec[_0x339701(0xd9)]),_0x195950=yamlTextKnowledgeBaseToApi({'name':_0x2e6eec[_0x339701(0xd9)],'text':_0x2e6eec[_0x339701(0xf8)]},_0x15f1ee);if(_0x21bd23)await this[_0x339701(0x147)][_0x339701(0x165)](_0x21bd23['id'],_0x195950),_0x1f3b8e['set'](_0x2e6eec[_0x339701(0xd9)],_0x21bd23['id']),_0x38f469[_0x339701(0x172)][_0x339701(0x109)]({'name':_0x2e6eec[_0x339701(0xd9)],'action':'updated','id':_0x21bd23['id']}),_0x38f469['counts'][_0x339701(0x172)][_0x339701(0x12a)]++;else{const _0x40bc87=await this['client'][_0x339701(0x1c0)](_0x195950);_0x1f3b8e[_0x339701(0x19b)](_0x2e6eec[_0x339701(0xd9)],_0x40bc87['id']),_0x38f469['textKnowledgeBases'][_0x339701(0x109)]({'name':_0x2e6eec[_0x339701(0xd9)],'action':_0x339701(0x12e),'id':_0x40bc87['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0x172)][_0x339701(0x12e)]++;}}catch(_0x3ea747){_0x38f469[_0x339701(0x172)][_0x339701(0x109)]({'name':_0x2e6eec[_0x339701(0xd9)],'action':_0x339701(0x156),'error':_0x3ea747[_0x339701(0x15a)]}),_0x38f469[_0x339701(0x166)][_0x339701(0x172)][_0x339701(0x153)]++;}}for(const _0x5d91ec of _0x568323){try{const _0x4c644a=_0x27d9aa[_0x339701(0x174)](_0x5d91ec[_0x339701(0x15b)]['name']),_0x3fa821=yamlExperimentalKnowledgeBaseToApi(_0x5d91ec[_0x339701(0x15b)],_0x15f1ee);if(_0x4c644a)await this['client'][_0x339701(0x130)](_0x4c644a['id'],_0x3fa821),_0x5b4c3a[_0x339701(0x19b)](_0x5d91ec['def'][_0x339701(0xd9)],_0x4c644a['id']),_0x38f469[_0x339701(0x1ab)][_0x339701(0x109)]({'name':_0x5d91ec[_0x339701(0x15b)]['name'],'action':_0x339701(0x12a),'id':_0x4c644a['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0x1ab)][_0x339701(0x12a)]++;else{const _0x523ca5=await this[_0x339701(0x147)][_0x339701(0x143)](_0x3fa821);_0x5b4c3a[_0x339701(0x19b)](_0x5d91ec['def'][_0x339701(0xd9)],_0x523ca5['id']),_0x38f469[_0x339701(0x1ab)][_0x339701(0x109)]({'name':_0x5d91ec[_0x339701(0x15b)][_0x339701(0xd9)],'action':'created','id':_0x523ca5['id']}),_0x38f469['counts'][_0x339701(0x1ab)][_0x339701(0x12e)]++;}}catch(_0xf6a6df){_0x38f469[_0x339701(0x1ab)][_0x339701(0x109)]({'name':_0x5d91ec['def'][_0x339701(0xd9)],'action':_0x339701(0x156),'error':_0xf6a6df[_0x339701(0x15a)]}),_0x38f469[_0x339701(0x166)]['experimentalKnowledgeBases'][_0x339701(0x153)]++;}}for(const _0x82844f of _0x7f36bd){try{const _0xa8af99=_0x4a4a1c[_0x339701(0x174)](_0x82844f[_0x339701(0x15b)]['name']),_0x432817=yamlExperimentalArtifactToApi(_0x82844f['def'],_0x15f1ee);if(_0xa8af99)await this[_0x339701(0x147)][_0x339701(0x1b5)](_0xa8af99['id'],_0x432817),_0x2c126d[_0x339701(0x19b)](_0x82844f['def'][_0x339701(0xd9)],_0xa8af99['id']),_0x38f469[_0x339701(0xc0)][_0x339701(0x109)]({'name':_0x82844f['def'][_0x339701(0xd9)],'action':_0x339701(0x12a),'id':_0xa8af99['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0xc0)][_0x339701(0x12a)]++;else{const _0x12ffe4=await this['client']['createExperimentalArtifact'](_0x432817);_0x2c126d[_0x339701(0x19b)](_0x82844f['def']['name'],_0x12ffe4['id']),_0x38f469[_0x339701(0xc0)]['push']({'name':_0x82844f[_0x339701(0x15b)][_0x339701(0xd9)],'action':'created','id':_0x12ffe4['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0xc0)][_0x339701(0x12e)]++;}}catch(_0xc62d2e){_0x38f469[_0x339701(0xc0)][_0x339701(0x109)]({'name':_0x82844f[_0x339701(0x15b)][_0x339701(0xd9)],'action':'error','error':_0xc62d2e['message']}),_0x38f469[_0x339701(0x166)][_0x339701(0xc0)]['errors']++;}}for(const _0x18fe8a of _0x16610d){_0xe34015=[];try{const _0x4a24b0=_0x16f481[_0x339701(0x174)](_0x18fe8a['yaml'][_0x339701(0xd9)]),_0x1411b6=await agentDefToRequest(_0x18fe8a['yaml'],_0x18fe8a['systemPrompt'],_0x18fe8a[_0x339701(0x14d)],_0x4ece);if(_0x4a24b0)await this[_0x339701(0x147)]['updateAgentResponse'](_0x4a24b0['id'],_0x1411b6),_0x582a36[_0x339701(0x19b)](_0x18fe8a[_0x339701(0x1c5)]['name'],_0x4a24b0['id']),_0x38f469['agents'][_0x339701(0x109)]({'agentName':_0x18fe8a[_0x339701(0x1c5)]['name'],'action':'updated','agentId':_0x4a24b0['id'],'warnings':_0xe34015['length']>0x0?_0xe34015:undefined}),_0x38f469[_0x339701(0x166)][_0x339701(0x13a)][_0x339701(0x12a)]++;else{const _0x11dfc6=await this[_0x339701(0x147)][_0x339701(0x19f)](_0x1411b6);_0x582a36[_0x339701(0x19b)](_0x18fe8a[_0x339701(0x1c5)][_0x339701(0xd9)],_0x11dfc6['id']),_0x38f469['agents'][_0x339701(0x109)]({'agentName':_0x18fe8a[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x12e),'agentId':_0x11dfc6['id'],'warnings':_0xe34015['length']>0x0?_0xe34015:undefined}),_0x38f469[_0x339701(0x166)][_0x339701(0x13a)]['created']++;}}catch(_0xc43b01){_0x38f469[_0x339701(0x13a)][_0x339701(0x109)]({'agentName':_0x18fe8a[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x156),'error':_0xc43b01[_0x339701(0x15a)],'warnings':_0xe34015['length']>0x0?_0xe34015:undefined}),_0x38f469[_0x339701(0x166)][_0x339701(0x13a)]['errors']++;}}for(const _0x109196 of _0x28ca99){try{const _0x4cf911=_0x2c1e56['get'](_0x109196[_0x339701(0x1c5)][_0x339701(0xd9)]),_0x32f80b=await yamlPromptToApi(_0x109196['yaml'],_0x15f1ee,_0x4ece);if(!_0x32f80b){_0x38f469['prompts']['push']({'name':_0x109196[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x156),'error':_0x339701(0x19c)}),_0x38f469[_0x339701(0x166)][_0x339701(0xfc)][_0x339701(0x153)]++;continue;}if(_0x4cf911)await this[_0x339701(0x147)][_0x339701(0xbb)](_0x4cf911['id'],_0x32f80b),_0x5be9fa['set'](_0x109196[_0x339701(0x1c5)][_0x339701(0xd9)],_0x4cf911['id']),_0x38f469['prompts'][_0x339701(0x109)]({'name':_0x109196['yaml']['name'],'action':'updated','id':_0x4cf911['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0xfc)][_0x339701(0x12a)]++;else{const _0x4f5553=await this[_0x339701(0x147)][_0x339701(0xf3)](_0x32f80b);_0x5be9fa[_0x339701(0x19b)](_0x109196[_0x339701(0x1c5)][_0x339701(0xd9)],_0x4f5553['id']),_0x38f469['prompts'][_0x339701(0x109)]({'name':_0x109196[_0x339701(0x1c5)][_0x339701(0xd9)],'action':_0x339701(0x12e),'id':_0x4f5553['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0xfc)][_0x339701(0x12e)]++;}}catch(_0x4991ad){_0x38f469[_0x339701(0xfc)][_0x339701(0x109)]({'name':_0x109196[_0x339701(0x1c5)][_0x339701(0xd9)],'action':'error','error':_0x4991ad[_0x339701(0x15a)]}),_0x38f469['counts'][_0x339701(0xfc)][_0x339701(0x153)]++;}}for(const _0x56b47b of _0x4a89dd){try{const _0x1c0aaf=_0x434b4a['get'](_0x56b47b[_0x339701(0x1c5)][_0x339701(0xb1)]),_0x29ece1=await yamlIntegrationToApi(_0x56b47b[_0x339701(0x1c5)],_0x15f1ee,_0x4ece);if(_0x1c0aaf){await this[_0x339701(0x147)][_0x339701(0x1c2)](_0x1c0aaf['id']);const _0x5c03de=await this['client'][_0x339701(0xae)](_0x29ece1);_0x38f469[_0x339701(0xa8)]['push']({'name':_0x56b47b['yaml']['service_type'],'action':_0x339701(0x12a),'id':_0x5c03de['id']}),_0x38f469['counts'][_0x339701(0xa8)][_0x339701(0x12a)]++;}else{const _0x271672=await this['client'][_0x339701(0xae)](_0x29ece1);_0x38f469['integrations'][_0x339701(0x109)]({'name':_0x56b47b[_0x339701(0x1c5)][_0x339701(0xb1)],'action':_0x339701(0x12e),'id':_0x271672['id']}),_0x38f469[_0x339701(0x166)][_0x339701(0xa8)]['created']++;}}catch(_0x3f153b){_0x38f469[_0x339701(0xa8)]['push']({'name':_0x56b47b['yaml'][_0x339701(0xb1)],'action':_0x339701(0x156),'error':_0x3f153b[_0x339701(0x15a)]}),_0x38f469[_0x339701(0x166)][_0x339701(0xa8)][_0x339701(0x153)]++;}}return _0x38f469;}async[a123_0x44cb81(0x11e)](_0x14164d,_0x422cf2,_0x2c5b8e,_0x35ec6d){const _0x32feba=a123_0x44cb81,{projectId:_0x575957,project:_0x2e1348}=await this['resolveProjectName'](_0x14164d),_0x270426=_0x2e1348[_0x32feba(0xfb)][_0x32feba(0xd9)],_0x433c48=await this[_0x32feba(0x147)][_0x32feba(0x173)](_0x575957),_0x125ba6=_0x433c48[_0x32feba(0x157)](_0x7235d7=>_0x7235d7['attributes']['name']===_0x422cf2);if(!_0x125ba6)throw new SDKError(ErrorCode[_0x32feba(0x12f)],_0x32feba(0xd6)+_0x422cf2,undefined,{'helpText':_0x32feba(0x18b)+_0x433c48[_0x32feba(0xf1)](_0x45dd6f=>_0x45dd6f['attributes'][_0x32feba(0xd9)])[_0x32feba(0xfd)](',\x20')});let _0x2dbf02;if(_0x2c5b8e)_0x2dbf02=_0x2c5b8e;else{const _0xd8ddec=a123_0xe6e455[_0x32feba(0xfd)](process[_0x32feba(0xce)](),_0x32feba(0x13a)),_0x2ee09e=getSanitizedPathWithMigration(_0xd8ddec,_0x270426);_0x2ee09e[_0x32feba(0x11c)]&&this[_0x32feba(0xff)]['info'](_0x32feba(0xaf)+a123_0xe6e455['basename'](_0x2ee09e[_0x32feba(0x16b)])+'\x20→\x20'+a123_0xe6e455[_0x32feba(0x125)](_0x2ee09e[_0x32feba(0xeb)])),_0x2dbf02=_0x2ee09e[_0x32feba(0xeb)];}const _0x2bba8e=getSanitizedPathWithMigration(_0x2dbf02,_0x422cf2);_0x2bba8e[_0x32feba(0x11c)]&&this[_0x32feba(0xff)][_0x32feba(0x11d)](_0x32feba(0x1a9)+a123_0xe6e455[_0x32feba(0x125)](_0x2bba8e['oldPath'])+_0x32feba(0xf5)+a123_0xe6e455['basename'](_0x2bba8e[_0x32feba(0xeb)]));const _0x152ed0=_0x2bba8e['path'],_0x4a4cdd=new Map(),_0x2246a3=new Map(),_0x380d88=await this[_0x32feba(0x147)][_0x32feba(0x135)](_0x575957),_0x1538d3=await this[_0x32feba(0x147)][_0x32feba(0x154)](_0x575957),_0x2346c5=await safeListOrEmpty(()=>this[_0x32feba(0x147)]['listExperimentalKnowledgeBases'](_0x575957)),_0x3e26f3=new Map(),_0x2bacbf=new Map();for(const _0x5a7ec3 of _0x380d88){_0x4a4cdd[_0x32feba(0x19b)](_0x5a7ec3['id'],_0x5a7ec3[_0x32feba(0xfb)]['name']);}for(const _0x54a606 of _0x1538d3){_0x3e26f3['set'](_0x54a606['id'],_0x54a606['attributes'][_0x32feba(0xd9)]);}for(const _0x4bc102 of _0x2346c5){_0x2bacbf[_0x32feba(0x19b)](_0x4bc102['id'],_0x4bc102[_0x32feba(0xfb)][_0x32feba(0xd9)]);}for(const _0x3ea198 of _0x433c48){_0x2246a3['set'](_0x3ea198['id'],_0x3ea198['attributes'][_0x32feba(0xd9)]);}const _0x24a456={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x4a4cdd,'TextKnowledgeBase':_0x3e26f3,'Agent':_0x2246a3,'ExperimentalKnowledgeBase':_0x2bacbf}),'resolvePromptName':async()=>undefined,'onWarning':_0x47c002=>this[_0x32feba(0xff)][_0x32feba(0x13b)](_0x47c002)},_0xfed664=a123_0xe6e455[_0x32feba(0xfd)](_0x152ed0,_0x32feba(0xdb)),_0x4a5649=a123_0xe6e455['join'](_0x152ed0,_0x32feba(0x121)),_0x49e20b=a123_0xe6e455[_0x32feba(0xfd)](_0x152ed0,_0x32feba(0xa6)),_0x1827b3=!a123_0xbdc0df['existsSync'](_0x4a5649);if(_0x35ec6d?.[_0x32feba(0x1aa)])return{'agentName':_0x422cf2,'outputPath':_0x152ed0,'isNew':_0x1827b3,'hasChanges':!![]};a123_0xbdc0df[_0x32feba(0xe2)](_0x2dbf02,{'recursive':!![]}),a123_0xbdc0df[_0x32feba(0xe2)](_0x152ed0,{'recursive':!![]});const _0x17f2f8=a123_0xe6e455[_0x32feba(0xfd)](_0x2dbf02,_0x32feba(0xc4));!a123_0xbdc0df[_0x32feba(0x10d)](_0x17f2f8)&&a123_0xbdc0df['writeFileSync'](_0x17f2f8,createAgentConfigContent(_0x14164d));const {yaml:_0x59aeb6,systemPrompt:_0x4e0fba,starterMessage:_0x397940}=await agentResponseToDef(_0x125ba6,_0x24a456);let _0x380d62=_0x1827b3;if(!_0x1827b3){const _0x36f52d=a123_0xbdc0df['existsSync'](_0xfed664)?a123_0xbdc0df[_0x32feba(0xe9)](_0xfed664,_0x32feba(0x164)):'',_0x3f354b=a123_0xbdc0df['readFileSync'](_0x4a5649,_0x32feba(0x164));_0x380d62=_0x36f52d!==_0x4e0fba||_0x3f354b!==toAgentYamlString(_0x59aeb6);}a123_0xbdc0df[_0x32feba(0x169)](_0xfed664,_0x4e0fba),a123_0xbdc0df[_0x32feba(0x169)](_0x4a5649,toAgentYamlString(_0x59aeb6));if(_0x397940&&_0x397940[_0x32feba(0x160)]('\x0a'))a123_0xbdc0df['writeFileSync'](_0x49e20b,_0x397940);else a123_0xbdc0df[_0x32feba(0x10d)](_0x49e20b)&&a123_0xbdc0df['unlinkSync'](_0x49e20b);return{'agentName':_0x422cf2,'outputPath':_0x152ed0,'isNew':_0x1827b3,'hasChanges':_0x380d62};}async[a123_0x44cb81(0x134)](_0x5d84e6,_0x160bee){const _0x6695eb=a123_0x44cb81;let _0x34988b;isAgentYamlPath(_0x5d84e6)?_0x34988b=getAgentDirFromYamlPath(_0x5d84e6):_0x34988b=_0x5d84e6;const {config:_0x297d53}=findAgentConfig(_0x34988b),_0x54f3ad=await this[_0x6695eb(0xf4)](_0x297d53[_0x6695eb(0xba)]),_0x28b40f=a123_0xe6e455[_0x6695eb(0xfd)](_0x34988b,_0x6695eb(0x121)),_0x1c501a=a123_0xe6e455[_0x6695eb(0xfd)](_0x34988b,_0x6695eb(0xdb)),_0x4a1fb4=a123_0xe6e455[_0x6695eb(0xfd)](_0x34988b,_0x6695eb(0xa6));if(!a123_0xbdc0df[_0x6695eb(0x10d)](_0x28b40f))throw new SDKError(ErrorCode[_0x6695eb(0xc6)],_0x6695eb(0x181)+_0x34988b,undefined,{'helpText':_0x6695eb(0x1bd)});const _0x1feda0=parseAgentYaml(a123_0xbdc0df[_0x6695eb(0xe9)](_0x28b40f,_0x6695eb(0x164)),_0x28b40f),_0x4b150d=a123_0xbdc0df[_0x6695eb(0x10d)](_0x1c501a)?a123_0xbdc0df[_0x6695eb(0xe9)](_0x1c501a,_0x6695eb(0x164)):'',_0x2c238c=a123_0xbdc0df['existsSync'](_0x4a1fb4)?a123_0xbdc0df[_0x6695eb(0xe9)](_0x4a1fb4,_0x6695eb(0x164)):_0x1feda0[_0x6695eb(0x177)];if(_0x160bee?.[_0x6695eb(0x1aa)])return{'agentName':_0x1feda0[_0x6695eb(0xd9)],'action':_0x6695eb(0x12e),'projectId':_0x54f3ad};const _0x515669=await this['client']['listAgentsFull'](_0x54f3ad),_0x19a732=await fetchAllToolTargetMaps((_0x3b2bc3,_0x47e076)=>this[_0x6695eb(0x147)][_0x6695eb(0xe4)](_0x3b2bc3,_0x47e076),_0x54f3ad),_0x297d8c=new Map();for(const _0x20ce7b of _0x515669){_0x297d8c['set'](_0x20ce7b[_0x6695eb(0xfb)][_0x6695eb(0xd9)],_0x20ce7b['id']);}const _0x1646d5=[],_0x29233d={'projectId':_0x54f3ad,'resolveToolTargetId':buildIdResolver({..._0x19a732[_0x6695eb(0xb6)],'Agent':_0x297d8c}),'resolvePromptId':async()=>undefined,'onWarning':_0xc81a9c=>{const _0x3ff735=_0x6695eb;this['logger'][_0x3ff735(0x13b)](_0xc81a9c),_0x1646d5[_0x3ff735(0x109)](_0xc81a9c);}};try{const _0x272d3c=_0x515669[_0x6695eb(0x157)](_0x103908=>_0x103908[_0x6695eb(0xfb)][_0x6695eb(0xd9)]===_0x1feda0[_0x6695eb(0xd9)]),_0xbf41dd=await agentDefToRequest(_0x1feda0,_0x4b150d,_0x2c238c,_0x29233d);if(_0x272d3c)return await this[_0x6695eb(0x147)]['updateAgentResponse'](_0x272d3c['id'],_0xbf41dd),{'agentName':_0x1feda0[_0x6695eb(0xd9)],'action':'updated','projectId':_0x54f3ad,'agentId':_0x272d3c['id'],'warnings':_0x1646d5[_0x6695eb(0x1bc)]>0x0?_0x1646d5:undefined};else{const _0x4914dd=await this[_0x6695eb(0x147)]['createAgentResponse'](_0xbf41dd);return{'agentName':_0x1feda0[_0x6695eb(0xd9)],'action':'created','projectId':_0x54f3ad,'agentId':_0x4914dd['id'],'warnings':_0x1646d5[_0x6695eb(0x1bc)]>0x0?_0x1646d5:undefined};}}catch(_0x3bf5e1){return{'agentName':_0x1feda0[_0x6695eb(0xd9)],'action':'error','projectId':_0x54f3ad,'error':_0x3bf5e1['message'],'warnings':_0x1646d5[_0x6695eb(0x1bc)]>0x0?_0x1646d5:undefined};}}async[a123_0x44cb81(0x1ac)](_0x18d74f,_0x42a5ba,_0x32db7a){const _0x44fa74=a123_0x44cb81,_0x2fd17d=a123_0xbdc0df[_0x44fa74(0x10d)](_0x18d74f)&&a123_0xbdc0df['existsSync'](a123_0xe6e455['join'](_0x18d74f,_0x44fa74(0xc4)));let _0x24602c;const _0x4550b5=[],_0x192b27=[],_0x47724d=[],_0x45a20a=[],_0x1e1bd4=[],_0x2348e1=[],_0x428d13=[];if(_0x2fd17d){const _0x26ad2c=loadAgentConfig(a123_0xe6e455[_0x44fa74(0xfd)](_0x18d74f,'tdx.json'));_0x24602c=_0x26ad2c[_0x44fa74(0xba)];const _0x4f5143=a123_0xbdc0df[_0x44fa74(0x19e)](_0x18d74f,{'withFileTypes':!![]});for(const _0x1f00f7 of _0x4f5143){if(!_0x1f00f7[_0x44fa74(0x141)]())continue;if([_0x44fa74(0x1c7),_0x44fa74(0x176),_0x44fa74(0x123),_0x44fa74(0xfc),_0x44fa74(0xa8)][_0x44fa74(0x160)](_0x1f00f7[_0x44fa74(0xd9)]))continue;const _0x2b2450=a123_0xe6e455[_0x44fa74(0xfd)](_0x18d74f,_0x1f00f7[_0x44fa74(0xd9)]);if(isAgentDir(_0x2b2450)){const _0x55e0e0=a123_0xe6e455[_0x44fa74(0xfd)](_0x2b2450,_0x44fa74(0x121)),_0x304bb9=a123_0xe6e455[_0x44fa74(0xfd)](_0x2b2450,_0x44fa74(0xdb)),_0x1b0754=a123_0xe6e455[_0x44fa74(0xfd)](_0x2b2450,_0x44fa74(0xa6)),_0x1095c9=parseAgentYaml(a123_0xbdc0df[_0x44fa74(0xe9)](_0x55e0e0,_0x44fa74(0x164)),_0x55e0e0),_0x448bec=a123_0xbdc0df[_0x44fa74(0x10d)](_0x304bb9)?a123_0xbdc0df['readFileSync'](_0x304bb9,_0x44fa74(0x164)):'',_0x2df408=a123_0xbdc0df['existsSync'](_0x1b0754)?a123_0xbdc0df['readFileSync'](_0x1b0754,_0x44fa74(0x164)):_0x1095c9[_0x44fa74(0x177)];_0x4550b5[_0x44fa74(0x109)]({'name':_0x1095c9[_0x44fa74(0xd9)],'dir':_0x2b2450,'yaml':_0x1095c9,'systemPrompt':_0x448bec,'starterMessage':_0x2df408});}}const _0x3a9967=getKnowledgeBasesDir(_0x18d74f);if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x3a9967)){const _0x206d1b=a123_0xbdc0df['readdirSync'](_0x3a9967);for(const _0x5cfbcf of _0x206d1b){const _0x3d4e83=a123_0xe6e455[_0x44fa74(0xfd)](_0x3a9967,_0x5cfbcf);if(_0x5cfbcf['endsWith'](_0x44fa74(0x1ce))){const _0x5df75c=parseKnowledgeBaseYaml(a123_0xbdc0df['readFileSync'](_0x3d4e83,_0x44fa74(0x164)),_0x3d4e83);_0x192b27['push']({'name':_0x5df75c[_0x44fa74(0xd9)],'path':_0x3d4e83,'yaml':_0x5df75c});}else{if(_0x5cfbcf[_0x44fa74(0x1b7)](_0x44fa74(0xfe))){const _0x4c0ded=a123_0xbdc0df[_0x44fa74(0xe9)](_0x3d4e83,'utf-8'),{name:_0x3c2b9f,text:_0x311fba}=parseTextKnowledgeBaseMd(_0x4c0ded,_0x5cfbcf);_0x47724d['push']({'name':_0x3c2b9f,'path':_0x3d4e83,'text':_0x311fba});}}}}const _0x4232a3=getPromptsDir(_0x18d74f);if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x4232a3)){const _0xe64b1c=a123_0xbdc0df[_0x44fa74(0x19e)](_0x4232a3)[_0x44fa74(0x11b)](_0x35728a=>_0x35728a[_0x44fa74(0x1b7)](_0x44fa74(0x1ce)));for(const _0x59b4b7 of _0xe64b1c){const _0x5682ec=a123_0xe6e455[_0x44fa74(0xfd)](_0x4232a3,_0x59b4b7),_0x25e7d2=parsePromptYaml(a123_0xbdc0df['readFileSync'](_0x5682ec,_0x44fa74(0x164)),_0x5682ec);_0x45a20a[_0x44fa74(0x109)]({'name':_0x25e7d2['name'],'path':_0x5682ec,'yaml':_0x25e7d2});}}const _0x43a1f6=getIntegrationsDir(_0x18d74f);if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x43a1f6)){const _0x3c3d5e=a123_0xbdc0df[_0x44fa74(0x19e)](_0x43a1f6)[_0x44fa74(0x11b)](_0x5c6c44=>_0x5c6c44[_0x44fa74(0x1b7)](_0x44fa74(0x1ce)));for(const _0x196f24 of _0x3c3d5e){const _0x2375fa=a123_0xe6e455[_0x44fa74(0xfd)](_0x43a1f6,_0x196f24),_0x78c0ef=parseIntegrationYaml(a123_0xbdc0df[_0x44fa74(0xe9)](_0x2375fa,'utf-8'),_0x2375fa);SAFE_INTEGRATION_TYPES['includes'](_0x78c0ef[_0x44fa74(0xb1)][_0x44fa74(0x18d)]())?_0x1e1bd4['push']({'name':_0x78c0ef['name'],'path':_0x2375fa,'yaml':_0x78c0ef}):this['logger'][_0x44fa74(0x13b)]('Skipping\x20integration\x20\x27'+_0x78c0ef[_0x44fa74(0xd9)]+_0x44fa74(0xf2)+_0x78c0ef[_0x44fa74(0xb1)]+_0x44fa74(0xd5)+(_0x44fa74(0xb8)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x44fa74(0x131)));}}const _0x1869cd=getExperimentalKnowledgeBasesDir(_0x18d74f);if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x1869cd)){const _0x140793=a123_0xbdc0df[_0x44fa74(0x19e)](_0x1869cd,{'withFileTypes':!![]});for(const _0xe41366 of _0x140793){if(!_0xe41366[_0x44fa74(0x141)]())continue;const _0x5c9eae=a123_0xe6e455['join'](_0x1869cd,_0xe41366[_0x44fa74(0xd9)]),_0x559757=a123_0xe6e455['join'](_0x5c9eae,_0xe41366[_0x44fa74(0xd9)]+_0x44fa74(0x1ce));if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x559757)){const _0x33ab39=parseExperimentalKnowledgeBaseYaml(a123_0xbdc0df[_0x44fa74(0xe9)](_0x559757,_0x44fa74(0x164)),_0x559757),_0x4d6faf=a123_0xe6e455[_0x44fa74(0xfd)](_0x5c9eae,_0x44fa74(0x15d)),_0xa3de2=[];if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x4d6faf)){const _0x3cd774=a123_0xbdc0df[_0x44fa74(0x19e)](_0x4d6faf,{'withFileTypes':!![]});for(const _0x1a1ca3 of _0x3cd774){if(!_0x1a1ca3['isDirectory']())continue;const _0x40b2b4=a123_0xe6e455['join'](_0x4d6faf,_0x1a1ca3[_0x44fa74(0xd9)]),_0x2b2cfe=a123_0xe6e455['join'](_0x40b2b4,'code.js'),_0x437d7d=a123_0xe6e455[_0x44fa74(0xfd)](_0x40b2b4,_0x44fa74(0xde));if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x2b2cfe)&&a123_0xbdc0df[_0x44fa74(0x10d)](_0x437d7d)){const _0x472297=a123_0xbdc0df[_0x44fa74(0xe9)](_0x2b2cfe,'utf-8'),_0x3dd3b8=a123_0xbdc0df[_0x44fa74(0xe9)](_0x437d7d,'utf-8');_0xa3de2['push']({'name':_0x1a1ca3['name'],'code':_0x472297,'json_schema':_0x3dd3b8});}}}const _0x5fb55a={..._0x33ab39,'functions':_0xa3de2};_0x2348e1[_0x44fa74(0x109)]({'name':_0x33ab39[_0x44fa74(0xd9)],'path':_0x5c9eae,'def':_0x5fb55a});}}}const _0x32638b=getExperimentalArtifactsDir(_0x18d74f);if(a123_0xbdc0df['existsSync'](_0x32638b)){const _0x1b082a=a123_0xbdc0df[_0x44fa74(0x19e)](_0x32638b,{'withFileTypes':!![]});for(const _0x66f19f of _0x1b082a){if(!_0x66f19f[_0x44fa74(0x141)]())continue;const _0x28a683=a123_0xe6e455['join'](_0x32638b,_0x66f19f[_0x44fa74(0xd9)]),_0x46bfa2=a123_0xe6e455[_0x44fa74(0xfd)](_0x28a683,_0x66f19f['name']+_0x44fa74(0x1ce));if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x46bfa2)){const _0x253101=parseExperimentalArtifactYaml(a123_0xbdc0df[_0x44fa74(0xe9)](_0x46bfa2,_0x44fa74(0x164)),_0x46bfa2),_0x413bec=a123_0xe6e455[_0x44fa74(0xfd)](_0x28a683,_0x44fa74(0xcc)),_0x20f4ec=a123_0xbdc0df[_0x44fa74(0x10d)](_0x413bec)?a123_0xbdc0df[_0x44fa74(0xe9)](_0x413bec,_0x44fa74(0x164)):'',_0x50671a=a123_0xe6e455[_0x44fa74(0xfd)](_0x28a683,_0x44fa74(0x19d)),_0x65ff03=[];if(a123_0xbdc0df[_0x44fa74(0x10d)](_0x50671a)){const _0x1295b9=a123_0xbdc0df[_0x44fa74(0x19e)](_0x50671a);for(const _0x1886fc of _0x1295b9){const _0x513ac4=a123_0xe6e455[_0x44fa74(0xfd)](_0x50671a,_0x1886fc);if(a123_0xbdc0df[_0x44fa74(0xdd)](_0x513ac4)[_0x44fa74(0x119)]()){const _0xbf4902=a123_0xbdc0df[_0x44fa74(0xe9)](_0x513ac4,_0x44fa74(0x164));_0x65ff03[_0x44fa74(0x109)]({'file_name':_0x1886fc,'text_content':_0xbf4902});}}}const _0x3895ec={..._0x253101,'code':_0x20f4ec,'files':_0x65ff03};_0x428d13['push']({'name':_0x253101[_0x44fa74(0xd9)],'path':_0x28a683,'def':_0x3895ec});}}}}else{const _0x2f72ee=await this[_0x44fa74(0xf4)](_0x18d74f),_0x53f8fa=await this[_0x44fa74(0x147)]['getProject'](_0x2f72ee);_0x24602c=_0x53f8fa[_0x44fa74(0xfb)][_0x44fa74(0xd9)];const _0x249bb1=await this[_0x44fa74(0x147)][_0x44fa74(0x173)](_0x2f72ee),_0x419f7d=await this['client'][_0x44fa74(0x135)](_0x2f72ee),_0x57e594=await this[_0x44fa74(0x147)][_0x44fa74(0x154)](_0x2f72ee),_0x43f550=await this[_0x44fa74(0x147)]['listPrompts'](_0x2f72ee),_0x4c0368=await this['client'][_0x44fa74(0xca)](_0x2f72ee),_0x529566=await safeListOrEmpty(()=>this[_0x44fa74(0x147)][_0x44fa74(0xc2)](_0x2f72ee)),_0x1b5629=await safeListOrEmpty(()=>this[_0x44fa74(0x147)][_0x44fa74(0x194)](_0x2f72ee)),_0x37991d=new Map(),_0xa067aa=new Map(),_0x52bd00=new Map(),_0x2c6b7a=new Map(),_0x244f69=new Map(),_0x44fd8b=new Map();for(const _0x157df4 of _0x419f7d){_0x37991d['set'](_0x157df4['id'],_0x157df4['attributes']['name']);}for(const _0x5d49c4 of _0x57e594){_0xa067aa['set'](_0x5d49c4['id'],_0x5d49c4[_0x44fa74(0xfb)]['name']);}for(const _0x371921 of _0x249bb1){_0x52bd00['set'](_0x371921['id'],_0x371921['attributes'][_0x44fa74(0xd9)]);}for(const _0x2c71cc of _0x43f550){_0x2c6b7a['set'](_0x2c71cc['id'],_0x2c71cc[_0x44fa74(0xfb)][_0x44fa74(0xd9)]);}for(const _0x249de7 of _0x529566){_0x244f69[_0x44fa74(0x19b)](_0x249de7['id'],_0x249de7[_0x44fa74(0xfb)][_0x44fa74(0xd9)]);}for(const _0x3b6f10 of _0x1b5629){_0x44fd8b[_0x44fa74(0x19b)](_0x3b6f10['id'],_0x3b6f10[_0x44fa74(0xfb)][_0x44fa74(0xd9)]);}const _0x29dc15={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x37991d,'TextKnowledgeBase':_0xa067aa,'Agent':_0x52bd00,'ExperimentalKnowledgeBase':_0x244f69}),'resolvePromptName':async _0x52a71c=>_0x2c6b7a[_0x44fa74(0x174)](_0x52a71c),'onWarning':_0x18c9b=>this['logger'][_0x44fa74(0x13b)](_0x18c9b)};for(const _0x227528 of _0x249bb1){const _0x4623f6=await agentResponseToDef(_0x227528,_0x29dc15),{yaml:_0x78677d,systemPrompt:_0x5d9b3d,starterMessage:_0x12e77c}=_0x4623f6;_0x4550b5[_0x44fa74(0x109)]({'name':_0x78677d[_0x44fa74(0xd9)],'dir':'','yaml':_0x78677d,'systemPrompt':_0x5d9b3d,'starterMessage':_0x12e77c});}for(const _0x5d0f3a of _0x419f7d){const _0x406eb2=apiKnowledgeBaseToYaml(_0x5d0f3a);_0x192b27['push']({'name':_0x406eb2[_0x44fa74(0xd9)],'path':'','yaml':_0x406eb2});}for(const _0xbf87b2 of _0x57e594){_0x47724d[_0x44fa74(0x109)]({'name':_0xbf87b2[_0x44fa74(0xfb)][_0x44fa74(0xd9)],'path':'','text':_0xbf87b2['attributes']['text']});}for(const _0x104bdb of _0x43f550){const _0x3b8c8f=await apiPromptToYaml(_0x104bdb,_0x29dc15);_0x3b8c8f&&_0x45a20a[_0x44fa74(0x109)]({'name':_0x3b8c8f[_0x44fa74(0xd9)],'path':'','yaml':_0x3b8c8f});}for(const _0x3eb7d9 of _0x4c0368){if(!_0x3eb7d9[_0x44fa74(0xfb)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x44fa74(0x160)](_0x3eb7d9[_0x44fa74(0xfb)][_0x44fa74(0x17f)][_0x44fa74(0x18d)]())){const _0x47ee47=await apiIntegrationToYaml(_0x3eb7d9,_0x29dc15);_0x1e1bd4[_0x44fa74(0x109)]({'name':_0x3eb7d9['attributes'][_0x44fa74(0x17f)]['toLowerCase'](),'path':'','yaml':_0x47ee47});}}for(const _0xe2a006 of _0x529566){const _0x46f679=apiExperimentalKnowledgeBaseToYaml(_0xe2a006);_0x2348e1[_0x44fa74(0x109)]({'name':_0x46f679[_0x44fa74(0xd9)],'path':'','def':_0x46f679});}for(const _0x4238e3 of _0x1b5629){const _0x23d043=apiExperimentalArtifactToYaml(_0x4238e3);_0x428d13[_0x44fa74(0x109)]({'name':_0x23d043[_0x44fa74(0xd9)],'path':'','def':_0x23d043});}}const _0x5acc94={'sourceProjectName':_0x24602c,'newProjectName':_0x42a5ba,'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}}},_0x1510d9=await this[_0x44fa74(0x147)][_0x44fa74(0x14c)](),_0x394c17=_0x1510d9[_0x44fa74(0x157)](_0x3953a0=>_0x3953a0[_0x44fa74(0xfb)][_0x44fa74(0xd9)]===_0x42a5ba);if(_0x394c17)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x44fa74(0x111)+_0x42a5ba+_0x44fa74(0x12c),undefined,{'helpText':_0x44fa74(0xd0)});if(_0x32db7a?.[_0x44fa74(0x1aa)])return _0x5acc94['counts']['agents'][_0x44fa74(0x12e)]=_0x4550b5[_0x44fa74(0x1bc)],_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x138)][_0x44fa74(0x12e)]=_0x192b27[_0x44fa74(0x1bc)],_0x5acc94[_0x44fa74(0x166)]['textKnowledgeBases'][_0x44fa74(0x12e)]=_0x47724d[_0x44fa74(0x1bc)],_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x1ab)][_0x44fa74(0x12e)]=_0x2348e1['length'],_0x5acc94['counts']['experimentalArtifacts']['created']=_0x428d13[_0x44fa74(0x1bc)],_0x5acc94['counts'][_0x44fa74(0xfc)][_0x44fa74(0x12e)]=_0x45a20a[_0x44fa74(0x1bc)],_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0xa8)]['created']=_0x1e1bd4[_0x44fa74(0x1bc)],_0x5acc94;const _0x434e54=await this[_0x44fa74(0x147)][_0x44fa74(0x16d)]({'name':_0x42a5ba}),_0x18deb6=_0x434e54['id'];_0x5acc94['newProjectId']=_0x18deb6;const _0x2a3311=new Map(),_0x259067=new Map(),_0x2f8d1a=new Map(),_0x3eac33=new Map(),_0x57bc73=new Map(),_0x4c9524=new Map(),_0xa8b739=new Map(),_0x49da45=new Map(),_0x127088=new Set(),_0x2372fd=new Set();for(const _0x4b213c of _0x4550b5){for(const _0x37eb75 of _0x4b213c[_0x44fa74(0x1c5)][_0x44fa74(0x17d)]||[]){if(_0x37eb75[_0x44fa74(0x1b6)]===_0x44fa74(0x140)&&_0x37eb75[_0x44fa74(0x116)]){const _0x47d327=parseRef(_0x37eb75['target']);if(_0x47d327)_0x127088['add'](_0x47d327[_0x44fa74(0xd9)]);}else{if(_0x37eb75[_0x44fa74(0x1b6)]===_0x44fa74(0xad)&&_0x37eb75[_0x44fa74(0x116)]){const _0x485bb4=parseRef(_0x37eb75[_0x44fa74(0x116)]);if(_0x485bb4)_0x2372fd[_0x44fa74(0x124)](_0x485bb4['name']);}}}}for(const _0x7e63e8 of _0x127088){try{const _0x100b22=await this['client'][_0x44fa74(0xb5)]({'projectId':_0x18deb6,'name':_0x7e63e8});_0x57bc73[_0x44fa74(0x19b)](_0x7e63e8,_0x100b22['id']),_0x5acc94['imageGenerators'][_0x44fa74(0x109)]({'name':_0x7e63e8,'action':_0x44fa74(0x12e),'id':_0x100b22['id']}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x100)][_0x44fa74(0x12e)]++;}catch(_0x1753d6){_0x5acc94[_0x44fa74(0x100)][_0x44fa74(0x109)]({'name':_0x7e63e8,'action':_0x44fa74(0x156),'error':_0x1753d6['message']}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x100)][_0x44fa74(0x153)]++;}}for(const _0x3a6d5c of _0x2372fd){try{const _0x2bcc4c=await this[_0x44fa74(0x147)]['createWebSearchTool']({'projectId':_0x18deb6,'name':_0x3a6d5c});_0x4c9524['set'](_0x3a6d5c,_0x2bcc4c['id']),_0x5acc94['webSearchTools']['push']({'name':_0x3a6d5c,'action':_0x44fa74(0x12e),'id':_0x2bcc4c['id']}),_0x5acc94[_0x44fa74(0x166)]['webSearchTools']['created']++;}catch(_0x5763e0){_0x5acc94['webSearchTools']['push']({'name':_0x3a6d5c,'action':_0x44fa74(0x156),'error':_0x5763e0['message']}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x187)][_0x44fa74(0x153)]++;}}const _0x453c85=await fetchAllToolTargetMaps((_0x56f3f5,_0x37cccd)=>this[_0x44fa74(0x147)]['listToolTargets'](_0x56f3f5,_0x37cccd),_0x18deb6);let _0x3c3243=[];const _0x226871={'projectId':_0x18deb6,'resolveToolTargetId':buildIdResolver({..._0x453c85[_0x44fa74(0xb6)],'KnowledgeBase':_0x2a3311,'TextKnowledgeBase':_0x259067,'ExperimentalKnowledgeBase':_0xa8b739,'Agent':_0x2f8d1a,'WebSearchTool':_0x4c9524,'ImageGenerator':_0x57bc73}),'resolvePromptId':async _0x281d0b=>_0x3eac33[_0x44fa74(0x174)](_0x281d0b),'onWarning':_0x571432=>{const _0x4dc4a8=_0x44fa74;this[_0x4dc4a8(0xff)][_0x4dc4a8(0x13b)](_0x571432),_0x3c3243[_0x4dc4a8(0x109)](_0x571432);}};for(const _0x507c5e of _0x192b27){try{const _0x44d4e0=yamlKnowledgeBaseToApi(_0x507c5e[_0x44fa74(0x1c5)],_0x18deb6),_0x33f522=await this[_0x44fa74(0x147)][_0x44fa74(0x1a1)](_0x44d4e0);_0x2a3311[_0x44fa74(0x19b)](_0x507c5e[_0x44fa74(0x1c5)]['name'],_0x33f522['id']),_0x5acc94[_0x44fa74(0x138)][_0x44fa74(0x109)]({'name':_0x507c5e['yaml'][_0x44fa74(0xd9)],'action':_0x44fa74(0x12e),'id':_0x33f522['id']}),_0x5acc94['counts'][_0x44fa74(0x138)][_0x44fa74(0x12e)]++;}catch(_0x5cbe96){_0x5acc94['knowledgeBases'][_0x44fa74(0x109)]({'name':_0x507c5e[_0x44fa74(0x1c5)][_0x44fa74(0xd9)],'action':_0x44fa74(0x156),'error':_0x5cbe96[_0x44fa74(0x15a)]}),_0x5acc94[_0x44fa74(0x166)]['knowledgeBases'][_0x44fa74(0x153)]++;}}for(const _0x389039 of _0x47724d){try{const _0x39093d=yamlTextKnowledgeBaseToApi({'name':_0x389039[_0x44fa74(0xd9)],'text':_0x389039[_0x44fa74(0xf8)]},_0x18deb6),_0x416637=await this[_0x44fa74(0x147)][_0x44fa74(0x1c0)](_0x39093d);_0x259067[_0x44fa74(0x19b)](_0x389039['name'],_0x416637['id']),_0x5acc94[_0x44fa74(0x172)]['push']({'name':_0x389039[_0x44fa74(0xd9)],'action':'created','id':_0x416637['id']}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x172)][_0x44fa74(0x12e)]++;}catch(_0x125adc){_0x5acc94['textKnowledgeBases'][_0x44fa74(0x109)]({'name':_0x389039[_0x44fa74(0xd9)],'action':'error','error':_0x125adc[_0x44fa74(0x15a)]}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x172)][_0x44fa74(0x153)]++;}}for(const _0x1823a9 of _0x428d13){try{const _0x37e07e=yamlExperimentalArtifactToApi(_0x1823a9[_0x44fa74(0x15b)],_0x18deb6),_0x5163d1=await this[_0x44fa74(0x147)][_0x44fa74(0x161)](_0x37e07e);_0x49da45['set'](_0x1823a9['def'][_0x44fa74(0xd9)],_0x5163d1['id']),_0x5acc94['experimentalArtifacts'][_0x44fa74(0x109)]({'name':_0x1823a9[_0x44fa74(0x15b)][_0x44fa74(0xd9)],'action':'created','id':_0x5163d1['id']}),_0x5acc94['counts'][_0x44fa74(0xc0)][_0x44fa74(0x12e)]++;}catch(_0x26f7de){_0x5acc94[_0x44fa74(0xc0)][_0x44fa74(0x109)]({'name':_0x1823a9['def'][_0x44fa74(0xd9)],'action':'error','error':_0x26f7de[_0x44fa74(0x15a)]}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0xc0)][_0x44fa74(0x153)]++;}}for(const _0x339625 of _0x2348e1){try{const _0x2cd59f=yamlExperimentalKnowledgeBaseToApi(_0x339625[_0x44fa74(0x15b)],_0x18deb6),_0x3958ea=await this[_0x44fa74(0x147)][_0x44fa74(0x143)](_0x2cd59f);_0xa8b739['set'](_0x339625[_0x44fa74(0x15b)]['name'],_0x3958ea['id']),_0x5acc94[_0x44fa74(0x1ab)][_0x44fa74(0x109)]({'name':_0x339625['def'][_0x44fa74(0xd9)],'action':_0x44fa74(0x12e),'id':_0x3958ea['id']}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x1ab)][_0x44fa74(0x12e)]++;}catch(_0x5cddb4){_0x5acc94[_0x44fa74(0x1ab)][_0x44fa74(0x109)]({'name':_0x339625[_0x44fa74(0x15b)]['name'],'action':_0x44fa74(0x156),'error':_0x5cddb4[_0x44fa74(0x15a)]}),_0x5acc94[_0x44fa74(0x166)]['experimentalKnowledgeBases'][_0x44fa74(0x153)]++;}}const _0x442146=[..._0x4550b5][_0x44fa74(0x1ad)]((_0x4b6ce1,_0x1635ac)=>{const _0x5ee3da=_0x44fa74,_0x341357=_0x4b6ce1[_0x5ee3da(0x1c5)][_0x5ee3da(0x17d)]?.[_0x5ee3da(0xa7)](_0x129926=>_0x129926['type']===_0x5ee3da(0xd4))??![],_0x3d094d=_0x1635ac[_0x5ee3da(0x1c5)][_0x5ee3da(0x17d)]?.[_0x5ee3da(0xa7)](_0x5cbbfa=>_0x5cbbfa['type']==='agent')??![];if(_0x341357&&!_0x3d094d)return 0x1;if(!_0x341357&&_0x3d094d)return-0x1;return 0x0;});for(const _0x51c5f4 of _0x442146){_0x3c3243=[];try{const _0x4b54fa=_0x51c5f4[_0x44fa74(0x1c5)][_0x44fa74(0x17d)]?.[_0x44fa74(0x11b)](_0x50b6b9=>{const _0xc93000=_0x44fa74;if(_0x50b6b9['type']==='agent'&&_0x50b6b9[_0xc93000(0x116)]){const _0x3ea0a3=parseRef(_0x50b6b9['target']);return _0x3ea0a3?.[_0xc93000(0xd9)]===_0x51c5f4[_0xc93000(0x1c5)][_0xc93000(0xd9)];}return![];})??[];if(_0x4b54fa['length']>0x0){const _0x1e77dc=_0x44fa74(0x18e)+_0x51c5f4[_0x44fa74(0x1c5)][_0x44fa74(0xd9)]+_0x44fa74(0x1c3)+_0x44fa74(0x15c);this['logger']['warn'](_0x1e77dc),_0x3c3243['push'](_0x1e77dc);}const _0x129753=await agentDefToRequest(_0x51c5f4[_0x44fa74(0x1c5)],_0x51c5f4[_0x44fa74(0x132)],_0x51c5f4[_0x44fa74(0x14d)],_0x226871),_0x42ac9=await this[_0x44fa74(0x147)][_0x44fa74(0x19f)](_0x129753);_0x2f8d1a[_0x44fa74(0x19b)](_0x51c5f4[_0x44fa74(0x1c5)][_0x44fa74(0xd9)],_0x42ac9['id']),_0x5acc94[_0x44fa74(0x13a)][_0x44fa74(0x109)]({'agentName':_0x51c5f4['yaml'][_0x44fa74(0xd9)],'action':'created','agentId':_0x42ac9['id'],'warnings':_0x3c3243['length']>0x0?_0x3c3243:undefined}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x13a)]['created']++;}catch(_0x4c6dcb){_0x5acc94[_0x44fa74(0x13a)][_0x44fa74(0x109)]({'agentName':_0x51c5f4[_0x44fa74(0x1c5)]['name'],'action':'error','error':_0x4c6dcb['message'],'warnings':_0x3c3243[_0x44fa74(0x1bc)]>0x0?_0x3c3243:undefined}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0x13a)]['errors']++;}}for(const _0x200c7f of _0x45a20a){try{const _0x2d2f82=await yamlPromptToApi(_0x200c7f[_0x44fa74(0x1c5)],_0x18deb6,_0x226871);if(!_0x2d2f82){_0x5acc94[_0x44fa74(0xfc)][_0x44fa74(0x109)]({'name':_0x200c7f[_0x44fa74(0x1c5)][_0x44fa74(0xd9)],'action':_0x44fa74(0x156),'error':_0x44fa74(0x19c)}),_0x5acc94['counts']['prompts'][_0x44fa74(0x153)]++;continue;}const _0x17a157=await this[_0x44fa74(0x147)][_0x44fa74(0xf3)](_0x2d2f82);_0x3eac33[_0x44fa74(0x19b)](_0x200c7f['yaml']['name'],_0x17a157['id']),_0x5acc94[_0x44fa74(0xfc)]['push']({'name':_0x200c7f['yaml'][_0x44fa74(0xd9)],'action':_0x44fa74(0x12e),'id':_0x17a157['id']}),_0x5acc94[_0x44fa74(0x166)]['prompts'][_0x44fa74(0x12e)]++;}catch(_0x86c33e){_0x5acc94[_0x44fa74(0xfc)][_0x44fa74(0x109)]({'name':_0x200c7f[_0x44fa74(0x1c5)][_0x44fa74(0xd9)],'action':_0x44fa74(0x156),'error':_0x86c33e[_0x44fa74(0x15a)]}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0xfc)][_0x44fa74(0x153)]++;}}for(const _0x4025fd of _0x1e1bd4){try{const _0x478703=await yamlIntegrationToApi(_0x4025fd[_0x44fa74(0x1c5)],_0x18deb6,_0x226871),_0x44d56e=await this[_0x44fa74(0x147)][_0x44fa74(0xae)](_0x478703);_0x5acc94[_0x44fa74(0xa8)][_0x44fa74(0x109)]({'name':_0x4025fd['yaml'][_0x44fa74(0xb1)],'action':'created','id':_0x44d56e['id']}),_0x5acc94['counts'][_0x44fa74(0xa8)][_0x44fa74(0x12e)]++;}catch(_0x9ad254){_0x5acc94['integrations'][_0x44fa74(0x109)]({'name':_0x4025fd[_0x44fa74(0x1c5)][_0x44fa74(0xb1)],'action':_0x44fa74(0x156),'error':_0x9ad254[_0x44fa74(0x15a)]}),_0x5acc94[_0x44fa74(0x166)][_0x44fa74(0xa8)]['errors']++;}}return _0x5acc94;}}
1
+ const a123_0x3243df=a123_0x26b9;(function(_0x5ddc18,_0x2062fe){const _0x29bb71=a123_0x26b9,_0x17dade=_0x5ddc18();while(!![]){try{const _0x6de407=-parseInt(_0x29bb71(0x192))/0x1+-parseInt(_0x29bb71(0x132))/0x2+-parseInt(_0x29bb71(0x1da))/0x3*(-parseInt(_0x29bb71(0x1d9))/0x4)+parseInt(_0x29bb71(0x19b))/0x5+-parseInt(_0x29bb71(0x1fa))/0x6*(parseInt(_0x29bb71(0x170))/0x7)+-parseInt(_0x29bb71(0x191))/0x8+parseInt(_0x29bb71(0x17b))/0x9;if(_0x6de407===_0x2062fe)break;else _0x17dade['push'](_0x17dade['shift']());}catch(_0x595a7e){_0x17dade['push'](_0x17dade['shift']());}}}(a123_0x23f3,0x59cec));import{LLMApiClient}from'../client/llm-api-client.js';import*as a123_0x2527de from'node:fs';import*as a123_0x48aad4 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';function a123_0x23f3(){const _0x51c08a=['getChatLog','endsWith','resolveProjectId','readFileSync','description','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','get','updateExperimentalKnowledgeBase','Multiple\x20projects\x20found\x20with\x20name\x20\x27','NOT_FOUND','sort','getUserSettings','warn','variables','listPrompts','Renamed\x20experimental\x20artifact\x20directory:\x20','parse','exportedFrom','getDefaultProjectName','listIntegrations','keys','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','isFile','updateAgentResponse','\x22\x20already\x20exists','filter','sdk.llm','metadata','cloneProject','setDefaultAgent','\x0a\x0a#\x20agent.yml\x0a','add','knowledgebases.json','agent.yml\x20not\x20found\x20in\x20','created','No\x20tdx.json\x20found\x20in\x20','profile','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','agent','low','LLM_PROJECT_NOT_FOUND','projectName','claude-4.5-sonnet','action','project.json','pushAgent','size','writeFileSync','listAgents','push','image_gen','chat_parent_segment','1276562dmNJNT','\x20→\x20','isManaged','json_schema','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','Removed\x20deleted\x20file:\x20','deleteIntegration','prompts','Agent\x20reference\x20not\x20found','projectId','basename','experimentalKnowledgeBases','availableModels','imageGenerators','existsSync','service_type','\x20attempts\x20due\x20to\x20name\x20conflicts.','\x20in\x20project\x20','createExperimentalKnowledgeBase','mkdirSync','history','listAgentsFull','includes','errors','Multiple\x20agents\x20found\x20with\x20name\x20\x27','outputs','listTextKnowledgeBases','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','updatePrompt','join','pullAgent','createIntegration','starter_message.md','agent.yml','agentsFull','AGENT_NOT_FOUND','knowledgeBases','getOrCreateDefaultProject','starterMessage','continueChat','getCurrentProject','map','logger','---\x20schema:\x20','file_name','createAgent','):\x20','deleteProject','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','updateAgent','already\x20exists','Renamed\x20prompt\x20file:\x20','restoreProject','1.0','utf-8','getBackupMetadata','some','chat','dryRun','name','webSearchTools','actions','49399dofQnQ','project','target','availableModelNames','text_content','agents.json','knowledge_bases','Output\x20directory\x20already\x20exists:\x20','tools','updateKnowledgeBase','slackMessageMode','13295025lpAuHX','type','listExperimentalArtifacts','Removed\x20deleted\x20directory:\x20','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','Renamed\x20experimental\x20KB\x20directory:\x20','INTERNAL','resolveAgentId','web_search','serviceType','getAgent','.md','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','duplicate','jsonSchemaHint','createWebSearchTool','agentId','listWebSearchTools','readdirSync','integrations.json','def','prompt.md','698208tOOSyL','601062jNtcCN','modelType','counts','updated','info','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','systemPrompt','Project\x20not\x20found:\x20','set','2563980gDadHs','pullProject','Unable\x20to\x20create\x20project\x20after\x20','deleteAgent','tdx_default_','statSync','version','tables','startChat','\x20---\x0a','template','starter_message','code.js','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','tdx_','Only\x20safe\x20types\x20(','ExperimentalKnowledgeBase','client','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','message','agents','length','status','prompts.json','toLowerCase','isDirectory','models','text','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','#\x20prompt.md\x0a',')\x20can\x20be\x20cloned.','experimentalArtifacts','\x0a---\x20schema:\x20','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','error','nameToId','context','loadJsonFile','updateExperimentalArtifact','promptId','\x27.\x20This\x20should\x20not\x20happen.','createExperimentalArtifact','unchanged','ALREADY_EXISTS','find','listToolTargets','maxToolIterations','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','\x0a---\x20code\x20---\x0a','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','idToName','yaml','files','event','getDefaultAgent','\x0a---\x20function:\x20','dir','integrations','code',')\x20can\x20be\x20pushed.\x20','tdDatabaseName','createProject','1224MqhNCa','1392FHoVpv','resolveProjectName','createAgentResponse','_reasoning_','rmSync','Renamed\x20folder:\x20','tdx.json','new','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','cwd','TextKnowledgeBase','json_schema.json','llm_project','localeCompare','listChats','Agent\x20\x27','site','total','functions','listKnowledgeBases','chatWelcomeMessage','listExperimentalKnowledgeBases','\x27\x20(','chatInfo','has','updateTextKnowledgeBase','textKnowledgeBases','clearDefaultAgent','.yml','---\x20file:\x20','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','372fghfvl','createImageGenerator','experimental_artifacts','high','setCurrentProject','getOrCreateDefaultAgent','currentProjectId','dirname','INVALID_ARGUMENT','toISOString','listProjects','Renamed\x20agent\x20folder:\x20','createTextKnowledgeBase','isDir','temperature','getProject','renamed','attributes','stringify','path','minimal','newProjectId','PERMISSION_DENIED','experimental_knowledge_bases','split','Renamed\x20integration\x20file:\x20','chatIgnoreManagedActions','createKnowledgeBase','oldPath','createPrompt'];a123_0x23f3=function(){return _0x51c08a;};return a123_0x23f3();}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=['chat_generic','chat_agent_console',a123_0x3243df(0x131)];function a123_0x26b9(_0x8fd3fe,_0x49614a){_0x8fd3fe=_0x8fd3fe-0xe2;const _0x23f336=a123_0x23f3();let _0x26b912=_0x23f336[_0x8fd3fe];return _0x26b912;}async function safeListOrEmpty(_0x4e938e){try{return await _0x4e938e();}catch(_0x141e50){if(_0x141e50 instanceof HTTPClientError&&_0x141e50['status']===0x194)return[];throw _0x141e50;}}export class LLMSDK{['currentProjectId'];[a123_0x3243df(0x1ac)];[a123_0x3243df(0x1bf)];[a123_0x3243df(0x15c)]=Logger['of'](a123_0x3243df(0x118));constructor(_0x4843b1){const _0x4febdb=a123_0x3243df;this[_0x4febdb(0x1ac)]=new LLMApiClient(_0x4843b1),this[_0x4febdb(0x1bf)]=_0x4843b1;}[a123_0x3243df(0x110)](){const _0x47800c=a123_0x3243df,_0x4e1e3e=getSanitizedUsername();return _0x47800c(0x19f)+_0x4e1e3e;}async[a123_0x3243df(0xe4)](_0x108102){const _0x4e5c56=a123_0x3243df,{projectId:_0x456506}=await this[_0x4e5c56(0x1db)](_0x108102);this['currentProjectId']=_0x456506;}[a123_0x3243df(0x15a)](){const _0x44243c=a123_0x3243df;return this[_0x44243c(0xe6)];}async[a123_0x3243df(0x11b)](_0x104819){const _0x4ab06f=a123_0x3243df,_0x4dfae2=this[_0x4ab06f(0x1bf)][_0x4ab06f(0x122)];let _0x3c9dc5,_0x4e3463;if(_0x104819[_0x4ab06f(0x148)]('/')){const _0x1db8c1=_0x104819[_0x4ab06f(0xf8)]('/');if(_0x1db8c1[_0x4ab06f(0x1b0)]!==0x2)throw new SDKError(ErrorCode[_0x4ab06f(0xe8)],'Invalid\x20agent\x20reference\x20format:\x20'+_0x104819,undefined,{'helpText':_0x4ab06f(0x1b7)});const [_0x8b4dcb,_0x54c125]=_0x1db8c1;_0x3c9dc5=await this[_0x4ab06f(0x100)](_0x8b4dcb),_0x4e3463=_0x54c125;}else _0x3c9dc5=this[_0x4ab06f(0xe6)]||(await this[_0x4ab06f(0x157)]())['id'],_0x4e3463=_0x104819;const _0xf503a0=await this[_0x4ab06f(0x182)](_0x4e3463,_0x3c9dc5),_0x3a4a96=await this[_0x4ab06f(0x1ac)][_0x4ab06f(0x185)](_0xf503a0);writeCachedLLMAgent(_0x3a4a96[_0x4ab06f(0xf1)][_0x4ab06f(0x16d)],_0xf503a0,_0x3c9dc5,_0x4dfae2);}[a123_0x3243df(0x1d1)](){const _0x264488=a123_0x3243df,_0x3cb94a=this['context'][_0x264488(0x122)];return readCachedLLMAgent(_0x3cb94a)||undefined;}[a123_0x3243df(0x1f6)](){const _0x375c7a=a123_0x3243df,_0x530f3=this[_0x375c7a(0x1bf)][_0x375c7a(0x122)];clearCachedLLMAgent(_0x530f3);}async[a123_0x3243df(0x1b5)](){const _0x953046=a123_0x3243df,_0x33e495=await this['client'][_0x953046(0x109)](),_0x2f0786=[];for(const _0x37dc59 of _0x33e495[_0x953046(0x173)]){const _0x4214d4=_0x33e495[_0x953046(0x13e)][_0x37dc59];_0x4214d4&&_0x2f0786[_0x953046(0x12f)]({'name':_0x37dc59,'displayName':_0x4214d4['displayName']});}return _0x2f0786;}async[a123_0x3243df(0x1d8)](_0x528ba5){const _0x495acb=a123_0x3243df;return await this[_0x495acb(0x1ac)]['createProject'](_0x528ba5);}async[a123_0x3243df(0x161)](_0x2ff023){const _0x5c1cf0=a123_0x3243df,{projectId:_0x124c49}=await this['resolveProjectName'](_0x2ff023);await this[_0x5c1cf0(0x1ac)]['deleteProject'](_0x124c49);}async['projects'](_0x152c4d=0x32){const _0x4c70fa=a123_0x3243df;return await this[_0x4c70fa(0x1ac)][_0x4c70fa(0xea)](_0x152c4d);}async['getOrCreateDefaultProject'](_0x140028){const _0x4d0638=a123_0x3243df,_0x55d936=_0x140028||this[_0x4d0638(0x110)](),_0x1419ce=this[_0x4d0638(0x1bf)][_0x4d0638(0x122)];if(!_0x140028){const _0xc523d3=readCachedLLMProject(_0x1419ce);if(_0xc523d3&&_0xc523d3['name']===_0x55d936)try{const _0x1d4d89=await this[_0x4d0638(0x1ac)][_0x4d0638(0xef)](_0xc523d3['id']);if(_0x1d4d89[_0x4d0638(0xf1)][_0x4d0638(0x16d)]===_0x55d936)return _0x1d4d89;}catch{}}const _0xf0ce1c=await this[_0x4d0638(0x1ac)][_0x4d0638(0xea)](),_0x311ddc=_0xf0ce1c[_0x4d0638(0x1c7)](_0x4ab792=>_0x4ab792[_0x4d0638(0xf1)]['name']===_0x55d936);if(_0x311ddc)return!_0x140028&&writeCachedLLMProject(_0x55d936,_0x311ddc['id'],_0x1419ce),_0x311ddc;const _0x3802d7=await this['client']['createProject']({'name':_0x55d936,'description':'Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20'+getSanitizedUsername()+')'});return!_0x140028&&writeCachedLLMProject(_0x55d936,_0x3802d7['id'],_0x1419ce),_0x3802d7;}async['resolveProjectId'](_0x42422e){const _0x4068b=a123_0x3243df,_0x195975=await this[_0x4068b(0x1ac)]['listProjects'](),_0xe8409e=_0x195975['filter'](_0x253c5e=>_0x253c5e[_0x4068b(0xf1)]['name']===_0x42422e);if(_0xe8409e[_0x4068b(0x1b0)]===0x0)throw new SDKError(ErrorCode[_0x4068b(0x126)],'Project\x20not\x20found:\x20'+_0x42422e,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0xe8409e[_0x4068b(0x1b0)]>0x1)throw new SDKError(ErrorCode[_0x4068b(0x181)],_0x4068b(0x106)+_0x42422e+_0x4068b(0x1c3));return _0xe8409e[0x0]['id'];}async[a123_0x3243df(0x1db)](_0x57ad90){const _0x2bbad6=a123_0x3243df,_0x3c856d=await this['client'][_0x2bbad6(0xea)](),_0xa8f28=_0x3c856d['find'](_0x56597d=>_0x56597d['attributes'][_0x2bbad6(0x16d)]===_0x57ad90);if(_0xa8f28)return{'projectId':_0xa8f28['id'],'project':_0xa8f28};throw new SDKError(ErrorCode[_0x2bbad6(0x126)],_0x2bbad6(0x199)+_0x57ad90,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async[a123_0x3243df(0xe5)](_0x157f59=a123_0x3243df(0x128),_0x1fc5ca=0x0,_0x120e2a){const _0x3a04e3=a123_0x3243df,_0x155ecf=0xa;let _0x3d4c72=0x0,_0x1326a5;while(_0x3d4c72<_0x155ecf){try{const _0x3dcadf=await this['getOrCreateDefaultProject'](_0x1326a5),_0x204848=_0x3dcadf['id'],_0x43e3b5=['none',_0x3a04e3(0xf4),_0x3a04e3(0x125),'medium',_0x3a04e3(0xe3)],_0x4cc70d=_0x1fc5ca===0x0?_0x3a04e3(0x1a9)+_0x157f59:_0x3a04e3(0x1a9)+_0x157f59+_0x3a04e3(0x1dd)+_0x43e3b5[_0x1fc5ca],_0x284cbf=await this[_0x3a04e3(0x1ac)]['listAgents'](_0x204848),_0x1b1ea9=_0x284cbf[_0x3a04e3(0x1c7)](_0x252418=>_0x252418[_0x3a04e3(0xf1)][_0x3a04e3(0x16d)]===_0x4cc70d);if(_0x1b1ea9)return _0x1b1ea9;const _0x19b4bc=_0x1fc5ca>0x0?0x1:_0x120e2a;return await this[_0x3a04e3(0x1ac)][_0x3a04e3(0x15f)]({'name':_0x4cc70d,'projectId':_0x204848,'modelType':_0x157f59,'systemPrompt':'','temperature':_0x19b4bc,'reasoningEffort':_0x1fc5ca>0x0?_0x1fc5ca:undefined});}catch(_0x1d3622){if(_0x1d3622 instanceof HTTPClientError){const _0x47a72d=_0x1d3622[_0x3a04e3(0x1b1)];if(_0x47a72d>=0x190&&_0x47a72d<0x1f4){if(_0x47a72d===0x191)throw new SDKError(ErrorCode['UNAUTHENTICATED'],_0x3a04e3(0x1a8),_0x1d3622);else{if(_0x47a72d===0x193)throw new SDKError(ErrorCode[_0x3a04e3(0xf6)],_0x3a04e3(0x123),_0x1d3622);}throw _0x1d3622;}}if(errorContains(_0x1d3622,_0x3a04e3(0x164),_0x3a04e3(0x188),'conflict')){_0x3d4c72++;if(_0x3d4c72>=_0x155ecf)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x3a04e3(0x19d)+_0x155ecf+_0x3a04e3(0x142),_0x1d3622);const _0x1a6ac5=this[_0x3a04e3(0x110)]();_0x1326a5=_0x1a6ac5+'_'+generateRandomHex();continue;}throw _0x1d3622;}}throw new SDKError(ErrorCode[_0x3a04e3(0x181)],_0x3a04e3(0x1cc));}async[a123_0x3243df(0x182)](_0x42dce4,_0x505982){const _0xfeb96e=a123_0x3243df,_0xb89988=_0x505982||this[_0xfeb96e(0xe6)],_0x286281=await this['client'][_0xfeb96e(0x12e)](_0xb89988),_0x43aa7b=_0x286281['filter'](_0x326d13=>_0x326d13['attributes'][_0xfeb96e(0x16d)]===_0x42dce4);if(_0x43aa7b[_0xfeb96e(0x1b0)]===0x0){const _0x420475=_0xb89988?_0xfeb96e(0x143)+_0xb89988:'';throw new SDKError(ErrorCode[_0xfeb96e(0x155)],'Agent\x20not\x20found:\x20'+_0x42dce4+_0x420475,undefined,{'helpText':_0xb89988?_0xfeb96e(0x1ca):'Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.'});}if(_0x43aa7b['length']>0x1)throw new SDKError(ErrorCode[_0xfeb96e(0x181)],_0xfeb96e(0x14a)+_0x42dce4+'\x27.\x20This\x20should\x20not\x20happen.');return _0x43aa7b[0x0]['id'];}async[a123_0x3243df(0x1af)](_0x494320){const _0x334c9a=_0x494320||this['currentProjectId'];return await this['client']['listAgents'](_0x334c9a);}async[a123_0x3243df(0x154)](_0x5a5c63){const _0xde8713=a123_0x3243df;return await this[_0xde8713(0x1ac)][_0xde8713(0x147)](_0x5a5c63);}async[a123_0x3243df(0x124)](_0x5c3570){const _0xa283f=a123_0x3243df;return await this[_0xa283f(0x1ac)]['getAgent'](_0x5c3570);}async[a123_0x3243df(0x15f)](_0x1e5bf7){const _0x936133=a123_0x3243df;return await this[_0x936133(0x1ac)][_0x936133(0x15f)](_0x1e5bf7);}async[a123_0x3243df(0x163)](_0x44c26d,_0x852dad){const _0x1f22d9=a123_0x3243df;return await this['client'][_0x1f22d9(0x163)](_0x44c26d,_0x852dad);}async[a123_0x3243df(0x19e)](_0x46a838){const _0x5da770=a123_0x3243df;await this[_0x5da770(0x1ac)][_0x5da770(0x19e)](_0x46a838);}async['startChat'](_0x11194a){const _0x2d29ce=a123_0x3243df;return await this[_0x2d29ce(0x1ac)][_0x2d29ce(0x1a3)]({'agentId':_0x11194a});}async*[a123_0x3243df(0x16b)](_0x8909c9,_0x3e6881){const _0x5ce412=a123_0x3243df;let _0x3f8e87=_0x3e6881?.['chatId'];const _0x13298a=_0x3e6881?.[_0x5ce412(0x18b)];if(!_0x3f8e87){if(!_0x13298a)throw new Error(_0x5ce412(0x136));const _0x5d43a9=await this[_0x5ce412(0x1ac)][_0x5ce412(0x1a3)]({'agentId':_0x13298a});_0x3f8e87=_0x5d43a9['id'],yield{'type':_0x5ce412(0x119),'data':{'chatId':_0x3f8e87,'agentId':_0x13298a,'projectId':_0x5d43a9[_0x5ce412(0xf1)][_0x5ce412(0x13b)]}};}for await(const _0x3cc0f7 of this[_0x5ce412(0x1ac)][_0x5ce412(0x159)](_0x3f8e87,_0x8909c9,_0x3e6881?.['signal'])){yield{'type':_0x5ce412(0x1d0),'data':_0x3cc0f7};}}async['chats'](_0x5bf9ac=0x32){const _0x1c5251=a123_0x3243df;return await this[_0x1c5251(0x1ac)][_0x1c5251(0x1e9)](_0x5bf9ac);}async[a123_0x3243df(0x146)](_0xa7e71b){return await this['client']['getChatHistory'](_0xa7e71b);}async[a123_0x3243df(0xfe)](_0x2bcd87){const _0x942eb=a123_0x3243df;return await this['client'][_0x942eb(0xfe)](_0x2bcd87);}async[a123_0x3243df(0x1f2)](_0x2fc89b){const _0x2f1d8a=a123_0x3243df;return await this[_0x2f1d8a(0x1ac)]['getChatInfo'](_0x2fc89b);}async['backupProject'](_0x73a25a,_0x17ea0c,_0x5c5491){const _0x5df953=a123_0x3243df,_0x5a49e8=_0x5c5491?.[_0x5df953(0x16c)]??![],{projectId:_0x2ea186,project:_0x50caee}=await this[_0x5df953(0x1db)](_0x73a25a),_0x553cea=_0x50caee['attributes']['name'],_0x2af7a8=_0x17ea0c||_0x553cea+'.llm';if(a123_0x2527de['existsSync'](_0x2af7a8)&&!_0x5a49e8)throw new SDKError(ErrorCode[_0x5df953(0x1c6)],_0x5df953(0x177)+_0x2af7a8,undefined,{'helpText':_0x5df953(0x17f)});const _0x4835b4=await this[_0x5df953(0x1ac)][_0x5df953(0x147)](_0x2ea186),_0xfd9b1b=await this[_0x5df953(0x1ac)]['listKnowledgeBases'](_0x2ea186),_0x5b6cc0=await this[_0x5df953(0x1ac)][_0x5df953(0x10c)](_0x2ea186),_0x29fb0b=await this[_0x5df953(0x1ac)][_0x5df953(0x111)](_0x2ea186);if(!_0x5a49e8){a123_0x2527de[_0x5df953(0x145)](_0x2af7a8,{'recursive':!![]});const _0x537f20={'version':_0x5df953(0x167),'exportedAt':new Date()[_0x5df953(0xe9)](),'exportedFrom':{'site':this['context'][_0x5df953(0x1eb)],'projectId':_0x2ea186,'projectName':_0x553cea},'project':_0x50caee};a123_0x2527de[_0x5df953(0x12d)](a123_0x48aad4[_0x5df953(0x14f)](_0x2af7a8,'project.json'),JSON[_0x5df953(0xf2)](_0x537f20,null,0x2)),a123_0x2527de[_0x5df953(0x12d)](a123_0x48aad4[_0x5df953(0x14f)](_0x2af7a8,'agents.json'),JSON[_0x5df953(0xf2)](_0x4835b4,null,0x2)),a123_0x2527de[_0x5df953(0x12d)](a123_0x48aad4[_0x5df953(0x14f)](_0x2af7a8,_0x5df953(0x11e)),JSON[_0x5df953(0xf2)](_0xfd9b1b,null,0x2)),a123_0x2527de[_0x5df953(0x12d)](a123_0x48aad4[_0x5df953(0x14f)](_0x2af7a8,_0x5df953(0x1b2)),JSON[_0x5df953(0xf2)](_0x5b6cc0,null,0x2)),a123_0x2527de['writeFileSync'](a123_0x48aad4[_0x5df953(0x14f)](_0x2af7a8,_0x5df953(0x18e)),JSON[_0x5df953(0xf2)](_0x29fb0b,null,0x2));}return{'projectName':_0x553cea,'outputDir':_0x2af7a8,'counts':{'agents':_0x4835b4[_0x5df953(0x1b0)],'knowledgeBases':_0xfd9b1b[_0x5df953(0x1b0)],'prompts':_0x5b6cc0['length'],'integrations':_0x29fb0b[_0x5df953(0x1b0)]}};}async[a123_0x3243df(0x166)](_0x1cdfbb,_0x13c8e5){const _0x3fbfbf=a123_0x3243df,_0x16d0cb=_0x13c8e5?.[_0x3fbfbf(0x16c)]??![],_0x67606c=this['getBackupMetadata'](_0x1cdfbb),_0x21ea5d=_0x67606c[_0x3fbfbf(0x10f)][_0x3fbfbf(0x1eb)],_0x383747=this[_0x3fbfbf(0x1bf)][_0x3fbfbf(0x1eb)],_0x4bf166=_0x21ea5d!==_0x383747?_0x21ea5d:undefined,_0x317f28=this[_0x3fbfbf(0x1c0)](a123_0x48aad4['join'](_0x1cdfbb,_0x3fbfbf(0x175)),[]),_0x27a532=this[_0x3fbfbf(0x1c0)](a123_0x48aad4[_0x3fbfbf(0x14f)](_0x1cdfbb,'knowledgebases.json'),[]),_0x333cf0=this[_0x3fbfbf(0x1c0)](a123_0x48aad4[_0x3fbfbf(0x14f)](_0x1cdfbb,_0x3fbfbf(0x1b2)),[]),_0x49ef21=this['loadJsonFile'](a123_0x48aad4[_0x3fbfbf(0x14f)](_0x1cdfbb,_0x3fbfbf(0x18e)),[]),_0x2bf70c=_0x13c8e5?.['name']||_0x67606c[_0x3fbfbf(0x10f)][_0x3fbfbf(0x127)];if(_0x16d0cb){const _0x1d252d=new Map(),_0x2e4fb6=[..._0x317f28],_0x3451e1=_0x317f28[_0x3fbfbf(0x1b0)]+0x1;let _0x42b3de=0x0;while(_0x2e4fb6[_0x3fbfbf(0x1b0)]>0x0&&_0x42b3de<_0x3451e1){_0x42b3de++;const _0x1ec93d=[];for(const _0x529200 of _0x2e4fb6){canCreateAgent(_0x529200,_0x1d252d)?_0x1d252d['set'](_0x529200['id'],'dry-run-'+_0x529200['id']):_0x1ec93d['push'](_0x529200);}if(_0x1ec93d['length']===_0x2e4fb6[_0x3fbfbf(0x1b0)])throw new SDKError(ErrorCode[_0x3fbfbf(0x181)],_0x3fbfbf(0x1ad),undefined,{'helpText':_0x3fbfbf(0x187)});_0x2e4fb6['length']=0x0,_0x2e4fb6[_0x3fbfbf(0x12f)](..._0x1ec93d);}const _0x1f8ce4=_0x333cf0[_0x3fbfbf(0x117)](_0x1cf203=>_0x1d252d[_0x3fbfbf(0x1f3)](_0x1cf203['attributes'][_0x3fbfbf(0x18b)]))[_0x3fbfbf(0x1b0)];return{'projectName':_0x2bf70c,'projectId':'(dry-run)','counts':{'agents':_0x317f28[_0x3fbfbf(0x1b0)],'knowledgeBases':_0x27a532[_0x3fbfbf(0x1b0)],'prompts':_0x1f8ce4,'integrations':_0x49ef21['length']},'sourceSite':_0x4bf166};}const _0x354616=await this[_0x3fbfbf(0x1ac)][_0x3fbfbf(0x1d8)]({'name':_0x2bf70c,'description':_0x67606c[_0x3fbfbf(0x171)][_0x3fbfbf(0xf1)][_0x3fbfbf(0x102)]}),_0x48e395=_0x354616['id'],_0xf7d786=new Map(),_0x50b422=new Map(),_0x59849c=new Map();for(const _0x4edc56 of _0x27a532){const _0x382821=await this[_0x3fbfbf(0x1ac)]['createKnowledgeBase']({'projectId':_0x48e395,'name':_0x4edc56[_0x3fbfbf(0xf1)][_0x3fbfbf(0x16d)],'tdDatabaseName':_0x4edc56[_0x3fbfbf(0xf1)][_0x3fbfbf(0x1d7)],'tables':_0x4edc56['attributes'][_0x3fbfbf(0x1a2)]});_0xf7d786[_0x3fbfbf(0x19a)](_0x4edc56['id'],_0x382821['id']);}const _0x6d0de4=[..._0x317f28],_0x336c22=_0x317f28['length']+0x1;let _0x554391=0x0;while(_0x6d0de4['length']>0x0&&_0x554391<_0x336c22){_0x554391++;const _0x1acf2d=[];for(const _0x43e713 of _0x6d0de4){if(canCreateAgent(_0x43e713,_0x50b422)){const _0x743532=remapToolIds(_0x43e713['attributes']['tools'],_0xf7d786,_0x50b422),_0x657839=remapVariableIds(_0x43e713['attributes'][_0x3fbfbf(0x10b)],_0xf7d786),_0x1b2de6=await this['client'][_0x3fbfbf(0x1dc)]({'name':_0x43e713[_0x3fbfbf(0xf1)]['name'],'projectId':_0x48e395,'systemPrompt':_0x43e713[_0x3fbfbf(0xf1)]['systemPrompt'],'starterMessage':_0x43e713[_0x3fbfbf(0xf1)][_0x3fbfbf(0x158)],'modelType':migrateModelType(_0x43e713[_0x3fbfbf(0xf1)][_0x3fbfbf(0x193)]),'maxToolIterations':_0x43e713[_0x3fbfbf(0xf1)][_0x3fbfbf(0x1c9)],'temperature':_0x43e713[_0x3fbfbf(0xf1)][_0x3fbfbf(0xee)],'reasoningEffort':_0x43e713[_0x3fbfbf(0xf1)]['reasoningEffort'],'outputs':_0x43e713[_0x3fbfbf(0xf1)][_0x3fbfbf(0x14b)],'tools':_0x743532,'variables':_0x657839});_0x50b422[_0x3fbfbf(0x19a)](_0x43e713['id'],_0x1b2de6['id']);}else _0x1acf2d['push'](_0x43e713);}if(_0x1acf2d['length']===_0x6d0de4[_0x3fbfbf(0x1b0)])throw new SDKError(ErrorCode[_0x3fbfbf(0x181)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x3fbfbf(0x187)});_0x6d0de4['length']=0x0,_0x6d0de4[_0x3fbfbf(0x12f)](..._0x1acf2d);}for(const _0x85c82 of _0x333cf0){const _0xbb0025=_0x50b422[_0x3fbfbf(0x104)](_0x85c82['attributes'][_0x3fbfbf(0x18b)]);if(!_0xbb0025)continue;const _0x4ac43f=await this['client'][_0x3fbfbf(0xfd)]({'projectId':_0x48e395,'agentId':_0xbb0025,'name':_0x85c82[_0x3fbfbf(0xf1)][_0x3fbfbf(0x16d)],'systemPrompt':_0x85c82[_0x3fbfbf(0xf1)][_0x3fbfbf(0x198)],'template':_0x85c82['attributes'][_0x3fbfbf(0x1a5)],'jsonSchemaHint':_0x85c82[_0x3fbfbf(0xf1)][_0x3fbfbf(0x189)]});_0x59849c[_0x3fbfbf(0x19a)](_0x85c82['id'],_0x4ac43f['id']);}for(const _0x5dd63d of _0x49ef21){const _0x4969e2=_0x5dd63d[_0x3fbfbf(0xf1)][_0x3fbfbf(0x16f)][_0x3fbfbf(0x15b)](_0x22bcb8=>({..._0x22bcb8,'promptId':_0x59849c[_0x3fbfbf(0x104)](_0x22bcb8['promptId'])||_0x22bcb8[_0x3fbfbf(0x1c2)]}));await this[_0x3fbfbf(0x1ac)][_0x3fbfbf(0x151)]({'projectId':_0x48e395,'serviceType':_0x5dd63d[_0x3fbfbf(0xf1)][_0x3fbfbf(0x184)],'actions':_0x4969e2,'slackMessageMode':_0x5dd63d[_0x3fbfbf(0xf1)][_0x3fbfbf(0x17a)],'chatIgnoreManagedActions':_0x5dd63d[_0x3fbfbf(0xf1)][_0x3fbfbf(0xfa)],'chatWelcomeMessage':_0x5dd63d[_0x3fbfbf(0xf1)][_0x3fbfbf(0x1ef)],'webhookCorsOrigins':_0x5dd63d[_0x3fbfbf(0xf1)]['webhookCorsOrigins']});}return{'projectName':_0x2bf70c,'projectId':_0x48e395,'counts':{'agents':_0x50b422['size'],'knowledgeBases':_0xf7d786[_0x3fbfbf(0x12c)],'prompts':_0x59849c[_0x3fbfbf(0x12c)],'integrations':_0x49ef21[_0x3fbfbf(0x1b0)]},'sourceSite':_0x4bf166};}[a123_0x3243df(0x1c0)](_0xc41b89,_0x145366){const _0x423fab=a123_0x3243df;if(!a123_0x2527de[_0x423fab(0x140)](_0xc41b89))return _0x145366;return JSON[_0x423fab(0x10e)](a123_0x2527de[_0x423fab(0x101)](_0xc41b89,_0x423fab(0x168)));}[a123_0x3243df(0x169)](_0x1ee300){const _0x4f49be=a123_0x3243df;if(!a123_0x2527de['existsSync'](_0x1ee300))throw new SDKError(ErrorCode['NOT_FOUND'],'Backup\x20folder\x20not\x20found:\x20'+_0x1ee300,undefined,{'helpText':_0x4f49be(0x1e3)});const _0x27c50d=a123_0x48aad4[_0x4f49be(0x14f)](_0x1ee300,_0x4f49be(0x12a));if(!a123_0x2527de[_0x4f49be(0x140)](_0x27c50d))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4f49be(0x197)+_0x1ee300,undefined,{'helpText':_0x4f49be(0x14d)});const _0x2e059e=JSON[_0x4f49be(0x10e)](a123_0x2527de[_0x4f49be(0x101)](_0x27c50d,_0x4f49be(0x168)));if(!isSupportedBackupVersion(_0x2e059e[_0x4f49be(0x1a1)]))throw new SDKError(ErrorCode[_0x4f49be(0xe8)],'Unsupported\x20backup\x20version:\x20'+_0x2e059e['version'],undefined,{'helpText':'This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.'});return _0x2e059e;}async[a123_0x3243df(0x19c)](_0x4986e8,_0x33360f,_0x3e09a1){const _0x2c2de8=a123_0x3243df,{projectId:_0x1f0144,project:_0x56efed}=await this[_0x2c2de8(0x1db)](_0x4986e8),_0x1f4bc6=_0x56efed[_0x2c2de8(0xf1)]['name'];let _0x57316e;if(_0x33360f)_0x57316e=_0x33360f;else{const _0x1c1b60=a123_0x48aad4[_0x2c2de8(0x14f)](process['cwd'](),'agents'),_0x1d54e8=getSanitizedPathWithMigration(_0x1c1b60,_0x1f4bc6);_0x1d54e8[_0x2c2de8(0xf0)]&&this[_0x2c2de8(0x15c)]['info'](_0x2c2de8(0x1df)+a123_0x48aad4['basename'](_0x1d54e8[_0x2c2de8(0xfc)])+'\x20→\x20'+a123_0x48aad4[_0x2c2de8(0x13c)](_0x1d54e8['path'])),_0x57316e=_0x1d54e8['path'];}const _0x319a66=await this[_0x2c2de8(0x1ac)][_0x2c2de8(0x147)](_0x1f0144),_0x1f808d=await this[_0x2c2de8(0x1ac)][_0x2c2de8(0x1ee)](_0x1f0144),_0x44ea59=await this[_0x2c2de8(0x1ac)][_0x2c2de8(0x14c)](_0x1f0144),_0x2f673a=await safeListOrEmpty(()=>this['client']['listImageGenerators'](_0x1f0144)),_0x5715ba=await safeListOrEmpty(()=>this[_0x2c2de8(0x1ac)][_0x2c2de8(0x18c)](_0x1f0144)),_0x4e0363=await this[_0x2c2de8(0x1ac)][_0x2c2de8(0x10c)](_0x1f0144),_0x2bcb2d=await this[_0x2c2de8(0x1ac)][_0x2c2de8(0x111)](_0x1f0144),_0x123165=await safeListOrEmpty(()=>this['client'][_0x2c2de8(0x1f0)](_0x1f0144)),_0x4588df=await safeListOrEmpty(()=>this[_0x2c2de8(0x1ac)][_0x2c2de8(0x17d)](_0x1f0144)),_0x3b941d=_0x2bcb2d['filter'](_0x5a2f70=>!_0x5a2f70['attributes'][_0x2c2de8(0x134)]&&SAFE_INTEGRATION_TYPES[_0x2c2de8(0x148)](_0x5a2f70[_0x2c2de8(0xf1)][_0x2c2de8(0x184)][_0x2c2de8(0x1b3)]())),_0x198c51=new Map(),_0x57cd3a=new Map(),_0xfc02cd=new Map(),_0x520d1d=new Map(),_0x56544c=new Map(),_0x35dd7a=new Map(),_0x28e32c=new Map();for(const _0x1f77c7 of _0x319a66){_0x198c51[_0x2c2de8(0x19a)](_0x1f77c7['id'],_0x1f77c7[_0x2c2de8(0xf1)][_0x2c2de8(0x16d)]);}for(const _0x53c7a2 of _0x1f808d){_0x57cd3a[_0x2c2de8(0x19a)](_0x53c7a2['id'],_0x53c7a2[_0x2c2de8(0xf1)]['name']);}for(const _0x2b8994 of _0x44ea59){_0xfc02cd[_0x2c2de8(0x19a)](_0x2b8994['id'],_0x2b8994[_0x2c2de8(0xf1)][_0x2c2de8(0x16d)]);}for(const _0x538e41 of _0x2f673a){_0x520d1d[_0x2c2de8(0x19a)](_0x538e41['id'],_0x538e41[_0x2c2de8(0xf1)]['name']);}for(const _0x505b4f of _0x5715ba){_0x56544c[_0x2c2de8(0x19a)](_0x505b4f['id'],_0x505b4f[_0x2c2de8(0xf1)]['name']);}for(const _0x5a3b9d of _0x4e0363){_0x35dd7a['set'](_0x5a3b9d['id'],_0x5a3b9d[_0x2c2de8(0xf1)][_0x2c2de8(0x16d)]);}for(const _0x2791b1 of _0x123165){_0x28e32c['set'](_0x2791b1['id'],_0x2791b1['attributes']['name']);}const _0x592ef1={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x57cd3a,'TextKnowledgeBase':_0xfc02cd,'Agent':_0x198c51,'WebSearchTool':_0x56544c,'ImageGenerator':_0x520d1d,'ExperimentalKnowledgeBase':_0x28e32c}),'resolvePromptName':async _0x19ea88=>_0x35dd7a[_0x2c2de8(0x104)](_0x19ea88),'onWarning':_0x36d017=>this[_0x2c2de8(0x15c)][_0x2c2de8(0x10a)](_0x36d017)},_0xf75a5d={'projectName':_0x1f4bc6,'outputDir':_0x57316e,'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}}},_0x4ce8d5=[],_0x1a22f4=[];for(const _0x5a8a88 of _0x319a66){const _0x3ea5e9=getSanitizedPathWithMigration(_0x57316e,_0x5a8a88[_0x2c2de8(0xf1)][_0x2c2de8(0x16d)]);_0x3ea5e9[_0x2c2de8(0xf0)]&&this[_0x2c2de8(0x15c)][_0x2c2de8(0x196)](_0x2c2de8(0xeb)+a123_0x48aad4['basename'](_0x3ea5e9[_0x2c2de8(0xfc)])+_0x2c2de8(0x133)+a123_0x48aad4['basename'](_0x3ea5e9[_0x2c2de8(0xf3)]));const _0x46be74=_0x3ea5e9[_0x2c2de8(0xf3)],_0xf17e67=a123_0x48aad4['join'](_0x46be74,_0x2c2de8(0x190)),_0xee449a=a123_0x48aad4['join'](_0x46be74,_0x2c2de8(0x153)),_0x39c67b=a123_0x48aad4[_0x2c2de8(0x14f)](_0x46be74,'starter_message.md'),{yaml:_0x466979,systemPrompt:_0x280e9c,starterMessage:_0x3e8da7}=await agentResponseToDef(_0x5a8a88,_0x592ef1),_0x4c6794=toAgentYamlString(_0x466979),_0x32a3f8=!a123_0x2527de['existsSync'](_0xee449a);let _0x2cda41=_0x32a3f8,_0x26c4c9;if(!_0x32a3f8){const _0x99db01=a123_0x2527de[_0x2c2de8(0x140)](_0xf17e67)?a123_0x2527de[_0x2c2de8(0x101)](_0xf17e67,_0x2c2de8(0x168)):'',_0x3d3317=a123_0x2527de[_0x2c2de8(0x101)](_0xee449a,_0x2c2de8(0x168)),_0x2e6ca8=_0x2c2de8(0x1b8)+_0x99db01+_0x2c2de8(0x11c)+_0x3d3317,_0x4213f2=_0x2c2de8(0x1b8)+_0x280e9c+_0x2c2de8(0x11c)+_0x4c6794,_0x25f70d=generateDiff(_0x2e6ca8,_0x4213f2);_0x2cda41=hasChanges(_0x25f70d),_0x2cda41&&(_0x26c4c9=formatDiffWithColors(_0x25f70d));}_0x4ce8d5['push']({'path':_0x46be74,'content':'','isDir':!![]}),_0x4ce8d5[_0x2c2de8(0x12f)]({'path':_0xf17e67,'content':_0x280e9c}),_0x4ce8d5[_0x2c2de8(0x12f)]({'path':_0xee449a,'content':_0x4c6794});_0x3e8da7&&_0x3e8da7[_0x2c2de8(0x148)]('\x0a')&&_0x4ce8d5[_0x2c2de8(0x12f)]({'path':_0x39c67b,'content':_0x3e8da7});_0xf75a5d['agents'][_0x2c2de8(0x12f)]({'agentName':_0x5a8a88[_0x2c2de8(0xf1)][_0x2c2de8(0x16d)],'outputPath':_0x46be74,'isNew':_0x32a3f8,'hasChanges':_0x2cda41,'diff':_0x26c4c9}),_0xf75a5d[_0x2c2de8(0x194)]['agents'][_0x2c2de8(0x1ec)]++;if(_0x32a3f8)_0xf75a5d[_0x2c2de8(0x194)][_0x2c2de8(0x1af)][_0x2c2de8(0x1e1)]++;else{if(_0x2cda41)_0xf75a5d[_0x2c2de8(0x194)][_0x2c2de8(0x1af)][_0x2c2de8(0x195)]++;else _0xf75a5d[_0x2c2de8(0x194)][_0x2c2de8(0x1af)][_0x2c2de8(0x1c5)]++;}}for(const _0x188917 of _0x1f808d){if(_0x188917[_0x2c2de8(0xf1)][_0x2c2de8(0x134)])continue;const _0x41480f=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x57316e),_0x188917[_0x2c2de8(0xf1)]['name'],_0x2c2de8(0x1f7));_0x41480f[_0x2c2de8(0xf0)]&&this[_0x2c2de8(0x15c)][_0x2c2de8(0x196)]('Renamed\x20KB\x20file:\x20'+a123_0x48aad4[_0x2c2de8(0x13c)](_0x41480f[_0x2c2de8(0xfc)])+'\x20→\x20'+a123_0x48aad4[_0x2c2de8(0x13c)](_0x41480f[_0x2c2de8(0xf3)]));const _0x139b74=_0x41480f['path'],_0x43c870=apiKnowledgeBaseToYaml(_0x188917),_0x525413=toKnowledgeBaseYamlString(_0x43c870),_0x2bb240=!a123_0x2527de[_0x2c2de8(0x140)](_0x139b74);let _0x1b598a=_0x2bb240,_0x577860;if(!_0x2bb240){const _0x3994be=a123_0x2527de['readFileSync'](_0x139b74,_0x2c2de8(0x168)),_0x561321=generateDiff(_0x3994be,_0x525413);_0x1b598a=hasChanges(_0x561321),_0x1b598a&&(_0x577860=formatDiffWithColors(_0x561321));}_0x4ce8d5[_0x2c2de8(0x12f)]({'path':_0x139b74,'content':_0x525413}),_0xf75a5d[_0x2c2de8(0x156)][_0x2c2de8(0x12f)]({'name':_0x188917[_0x2c2de8(0xf1)][_0x2c2de8(0x16d)],'outputPath':_0x139b74,'isNew':_0x2bb240,'hasChanges':_0x1b598a,'diff':_0x577860}),_0xf75a5d[_0x2c2de8(0x194)]['knowledgeBases'][_0x2c2de8(0x1ec)]++;if(_0x2bb240)_0xf75a5d['counts'][_0x2c2de8(0x156)]['new']++;else{if(_0x1b598a)_0xf75a5d[_0x2c2de8(0x194)][_0x2c2de8(0x156)][_0x2c2de8(0x195)]++;else _0xf75a5d[_0x2c2de8(0x194)][_0x2c2de8(0x156)][_0x2c2de8(0x1c5)]++;}}for(const _0x52e186 of _0x44ea59){if(_0x52e186[_0x2c2de8(0xf1)][_0x2c2de8(0x134)])continue;const _0x32f60f=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x57316e),_0x52e186['attributes']['name'],_0x2c2de8(0x186));_0x32f60f[_0x2c2de8(0xf0)]&&this[_0x2c2de8(0x15c)][_0x2c2de8(0x196)]('Renamed\x20text\x20KB\x20file:\x20'+a123_0x48aad4[_0x2c2de8(0x13c)](_0x32f60f[_0x2c2de8(0xfc)])+_0x2c2de8(0x133)+a123_0x48aad4[_0x2c2de8(0x13c)](_0x32f60f[_0x2c2de8(0xf3)]));const _0xe8328c=_0x32f60f[_0x2c2de8(0xf3)],_0x18b872=toTextKnowledgeBaseMd(_0x52e186[_0x2c2de8(0xf1)][_0x2c2de8(0x16d)],_0x52e186[_0x2c2de8(0xf1)][_0x2c2de8(0x1b6)]),_0x31d2ea=!a123_0x2527de[_0x2c2de8(0x140)](_0xe8328c);let _0xbd0c09=_0x31d2ea,_0x10f256;if(!_0x31d2ea){const _0x5d7c14=a123_0x2527de[_0x2c2de8(0x101)](_0xe8328c,_0x2c2de8(0x168)),_0x4cb7b1=generateDiff(_0x5d7c14,_0x18b872);_0xbd0c09=hasChanges(_0x4cb7b1),_0xbd0c09&&(_0x10f256=formatDiffWithColors(_0x4cb7b1));}_0x4ce8d5[_0x2c2de8(0x12f)]({'path':_0xe8328c,'content':_0x18b872}),_0xf75a5d['textKnowledgeBases'][_0x2c2de8(0x12f)]({'name':_0x52e186[_0x2c2de8(0xf1)][_0x2c2de8(0x16d)],'outputPath':_0xe8328c,'isNew':_0x31d2ea,'hasChanges':_0xbd0c09,'diff':_0x10f256}),_0xf75a5d[_0x2c2de8(0x194)][_0x2c2de8(0x1f5)][_0x2c2de8(0x1ec)]++;if(_0x31d2ea)_0xf75a5d['counts']['textKnowledgeBases'][_0x2c2de8(0x1e1)]++;else{if(_0xbd0c09)_0xf75a5d[_0x2c2de8(0x194)][_0x2c2de8(0x1f5)][_0x2c2de8(0x195)]++;else _0xf75a5d['counts'][_0x2c2de8(0x1f5)][_0x2c2de8(0x1c5)]++;}}for(const _0x5c0430 of _0x4e0363){if(_0x5c0430[_0x2c2de8(0xf1)]['isManaged'])continue;const _0x480cfd=getSanitizedPathWithMigration(getPromptsDir(_0x57316e),_0x5c0430[_0x2c2de8(0xf1)][_0x2c2de8(0x16d)],'.yml');_0x480cfd[_0x2c2de8(0xf0)]&&this[_0x2c2de8(0x15c)][_0x2c2de8(0x196)](_0x2c2de8(0x165)+a123_0x48aad4[_0x2c2de8(0x13c)](_0x480cfd['oldPath'])+_0x2c2de8(0x133)+a123_0x48aad4[_0x2c2de8(0x13c)](_0x480cfd[_0x2c2de8(0xf3)]));const _0x179ade=_0x480cfd[_0x2c2de8(0xf3)],_0x564028=await apiPromptToYaml(_0x5c0430,_0x592ef1);if(!_0x564028)continue;const _0x18e0e7=toPromptYamlString(_0x564028),_0x191a15=!a123_0x2527de[_0x2c2de8(0x140)](_0x179ade);let _0x1087cf=_0x191a15,_0x52f0f1;if(!_0x191a15){const _0x2e713c=a123_0x2527de[_0x2c2de8(0x101)](_0x179ade,_0x2c2de8(0x168)),_0x340389=generateDiff(_0x2e713c,_0x18e0e7);_0x1087cf=hasChanges(_0x340389),_0x1087cf&&(_0x52f0f1=formatDiffWithColors(_0x340389));}_0x4ce8d5[_0x2c2de8(0x12f)]({'path':_0x179ade,'content':_0x18e0e7}),_0xf75a5d[_0x2c2de8(0x139)][_0x2c2de8(0x12f)]({'name':_0x5c0430[_0x2c2de8(0xf1)][_0x2c2de8(0x16d)],'outputPath':_0x179ade,'isNew':_0x191a15,'hasChanges':_0x1087cf,'diff':_0x52f0f1}),_0xf75a5d[_0x2c2de8(0x194)][_0x2c2de8(0x139)][_0x2c2de8(0x1ec)]++;if(_0x191a15)_0xf75a5d[_0x2c2de8(0x194)][_0x2c2de8(0x139)][_0x2c2de8(0x1e1)]++;else{if(_0x1087cf)_0xf75a5d[_0x2c2de8(0x194)]['prompts'][_0x2c2de8(0x195)]++;else _0xf75a5d[_0x2c2de8(0x194)]['prompts'][_0x2c2de8(0x1c5)]++;}}for(const _0x36cbe2 of _0x3b941d){const _0x32d9be=_0x36cbe2['attributes'][_0x2c2de8(0x184)][_0x2c2de8(0x1b3)](),_0x1700fa=getSanitizedPathWithMigration(getIntegrationsDir(_0x57316e),_0x32d9be,_0x2c2de8(0x1f7));_0x1700fa[_0x2c2de8(0xf0)]&&this[_0x2c2de8(0x15c)][_0x2c2de8(0x196)](_0x2c2de8(0xf9)+a123_0x48aad4[_0x2c2de8(0x13c)](_0x1700fa['oldPath'])+'\x20→\x20'+a123_0x48aad4[_0x2c2de8(0x13c)](_0x1700fa['path']));const _0x4304b5=_0x1700fa['path'],_0x4f87b9=await apiIntegrationToYaml(_0x36cbe2,_0x592ef1),_0x562693=toIntegrationYamlString(_0x4f87b9),_0x1bb193=!a123_0x2527de[_0x2c2de8(0x140)](_0x4304b5);let _0x386d68=_0x1bb193,_0x2a3c6e;if(!_0x1bb193){const _0x5e25aa=a123_0x2527de['readFileSync'](_0x4304b5,'utf-8'),_0x21a8d6=generateDiff(_0x5e25aa,_0x562693);_0x386d68=hasChanges(_0x21a8d6),_0x386d68&&(_0x2a3c6e=formatDiffWithColors(_0x21a8d6));}_0x4ce8d5[_0x2c2de8(0x12f)]({'path':_0x4304b5,'content':_0x562693}),_0xf75a5d['integrations'][_0x2c2de8(0x12f)]({'name':_0x32d9be,'outputPath':_0x4304b5,'isNew':_0x1bb193,'hasChanges':_0x386d68,'diff':_0x2a3c6e}),_0xf75a5d['counts'][_0x2c2de8(0x1d4)][_0x2c2de8(0x1ec)]++;if(_0x1bb193)_0xf75a5d[_0x2c2de8(0x194)][_0x2c2de8(0x1d4)][_0x2c2de8(0x1e1)]++;else{if(_0x386d68)_0xf75a5d[_0x2c2de8(0x194)][_0x2c2de8(0x1d4)]['updated']++;else _0xf75a5d[_0x2c2de8(0x194)][_0x2c2de8(0x1d4)][_0x2c2de8(0x1c5)]++;}}for(const _0x2a3a17 of _0x123165){if(_0x2a3a17[_0x2c2de8(0xf1)][_0x2c2de8(0x134)])continue;const _0xbee182=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x57316e),_0x2a3a17[_0x2c2de8(0xf1)][_0x2c2de8(0x16d)]);_0xbee182['renamed']&&this[_0x2c2de8(0x15c)][_0x2c2de8(0x196)](_0x2c2de8(0x180)+a123_0x48aad4['basename'](_0xbee182[_0x2c2de8(0xfc)])+'\x20→\x20'+a123_0x48aad4[_0x2c2de8(0x13c)](_0xbee182[_0x2c2de8(0xf3)]));const _0x3bd1d1=_0xbee182[_0x2c2de8(0xf3)],_0x39d37b=a123_0x48aad4[_0x2c2de8(0x14f)](_0x3bd1d1,sanitizeForFilesystem(_0x2a3a17['attributes']['name'])+_0x2c2de8(0x1f7)),_0x442036=a123_0x48aad4[_0x2c2de8(0x14f)](_0x3bd1d1,_0x2c2de8(0x1ed)),_0x52dabc=apiExperimentalKnowledgeBaseToYaml(_0x2a3a17),_0x54bce0=toExperimentalKnowledgeBaseYamlString(_0x52dabc),_0x4eb9c7=!a123_0x2527de[_0x2c2de8(0x140)](_0x3bd1d1);let _0x4ce553=_0x4eb9c7,_0x1f37f3,_0x320dcf=_0x54bce0;const _0x1452b8=[..._0x52dabc[_0x2c2de8(0x1ed)]][_0x2c2de8(0x108)]((_0x567893,_0x1c89d7)=>_0x567893[_0x2c2de8(0x16d)]['localeCompare'](_0x1c89d7[_0x2c2de8(0x16d)]));for(const _0x50eb13 of _0x1452b8){_0x320dcf+=_0x2c2de8(0x1d2)+_0x50eb13[_0x2c2de8(0x16d)]+_0x2c2de8(0x1a4)+_0x50eb13[_0x2c2de8(0x1d5)]+_0x2c2de8(0x1bb)+_0x50eb13[_0x2c2de8(0x16d)]+'\x20---\x0a'+_0x50eb13[_0x2c2de8(0x135)]+'\x0a';}if(!_0x4eb9c7){let _0x2c85ba='';a123_0x2527de[_0x2c2de8(0x140)](_0x39d37b)&&(_0x2c85ba=a123_0x2527de[_0x2c2de8(0x101)](_0x39d37b,_0x2c2de8(0x168)));if(a123_0x2527de['existsSync'](_0x442036)){const _0x103683=a123_0x2527de['readdirSync'](_0x442036,{'withFileTypes':!![]}),_0x21302b=_0x103683[_0x2c2de8(0x117)](_0xe69418=>_0xe69418[_0x2c2de8(0x1b4)]())[_0x2c2de8(0x108)]((_0x15bbaa,_0x4271aa)=>_0x15bbaa[_0x2c2de8(0x16d)][_0x2c2de8(0x1e8)](_0x4271aa[_0x2c2de8(0x16d)]));for(const _0x4fd597 of _0x21302b){const _0x37aa1e=a123_0x48aad4[_0x2c2de8(0x14f)](_0x442036,_0x4fd597['name'],_0x2c2de8(0x1a7)),_0x4bad9d=a123_0x48aad4[_0x2c2de8(0x14f)](_0x442036,_0x4fd597[_0x2c2de8(0x16d)],_0x2c2de8(0x1e6));a123_0x2527de[_0x2c2de8(0x140)](_0x37aa1e)&&(_0x2c85ba+=_0x2c2de8(0x1d2)+_0x4fd597[_0x2c2de8(0x16d)]+'\x20---\x0a'+a123_0x2527de['readFileSync'](_0x37aa1e,_0x2c2de8(0x168))+'\x0a'),a123_0x2527de[_0x2c2de8(0x140)](_0x4bad9d)&&(_0x2c85ba+=_0x2c2de8(0x15d)+_0x4fd597[_0x2c2de8(0x16d)]+_0x2c2de8(0x1a4)+a123_0x2527de[_0x2c2de8(0x101)](_0x4bad9d,'utf-8')+'\x0a');}}const _0x1a4d6e=generateDiff(_0x2c85ba,_0x320dcf);_0x4ce553=hasChanges(_0x1a4d6e),_0x4ce553&&(_0x1f37f3=formatDiffWithColors(_0x1a4d6e));}_0x4ce8d5[_0x2c2de8(0x12f)]({'path':_0x3bd1d1,'content':'','isDir':!![]}),_0x4ce8d5[_0x2c2de8(0x12f)]({'path':_0x39d37b,'content':_0x54bce0}),_0x4ce8d5[_0x2c2de8(0x12f)]({'path':_0x442036,'content':'','isDir':!![]});for(const _0x3dd4bb of _0x52dabc['functions']){const _0x2d7b05=a123_0x48aad4['join'](_0x442036,sanitizeForFilesystem(_0x3dd4bb['name'])),_0x26aabd=a123_0x48aad4[_0x2c2de8(0x14f)](_0x2d7b05,_0x2c2de8(0x1a7)),_0x42eba2=a123_0x48aad4[_0x2c2de8(0x14f)](_0x2d7b05,'json_schema.json');_0x4ce8d5['push']({'path':_0x2d7b05,'content':'','isDir':!![]}),_0x4ce8d5[_0x2c2de8(0x12f)]({'path':_0x26aabd,'content':_0x3dd4bb[_0x2c2de8(0x1d5)]}),_0x4ce8d5[_0x2c2de8(0x12f)]({'path':_0x42eba2,'content':_0x3dd4bb[_0x2c2de8(0x135)]});}if(a123_0x2527de[_0x2c2de8(0x140)](_0x442036)){const _0x4fd474=a123_0x2527de[_0x2c2de8(0x18d)](_0x442036,{'withFileTypes':!![]}),_0x1316fe=new Set(_0x52dabc[_0x2c2de8(0x1ed)][_0x2c2de8(0x15b)](_0x491f53=>sanitizeForFilesystem(_0x491f53['name'])));for(const _0x313c7e of _0x4fd474){if(_0x313c7e[_0x2c2de8(0x1b4)]()&&!_0x1316fe['has'](_0x313c7e[_0x2c2de8(0x16d)])){const _0x6e3a11=a123_0x48aad4[_0x2c2de8(0x14f)](_0x442036,_0x313c7e['name']);_0x1a22f4[_0x2c2de8(0x12f)]({'path':_0x6e3a11,'isDir':!![]});}}}_0xf75a5d[_0x2c2de8(0x13d)][_0x2c2de8(0x12f)]({'name':_0x2a3a17[_0x2c2de8(0xf1)][_0x2c2de8(0x16d)],'outputPath':_0x3bd1d1,'isNew':_0x4eb9c7,'hasChanges':_0x4ce553,'diff':_0x1f37f3}),_0xf75a5d[_0x2c2de8(0x194)]['experimentalKnowledgeBases'][_0x2c2de8(0x1ec)]++;if(_0x4eb9c7)_0xf75a5d['counts']['experimentalKnowledgeBases'][_0x2c2de8(0x1e1)]++;else{if(_0x4ce553)_0xf75a5d['counts'][_0x2c2de8(0x13d)][_0x2c2de8(0x195)]++;else _0xf75a5d[_0x2c2de8(0x194)][_0x2c2de8(0x13d)][_0x2c2de8(0x1c5)]++;}}for(const _0x36a96f of _0x4588df){if(_0x36a96f[_0x2c2de8(0xf1)]['isManaged'])continue;const _0x51e9a8=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x57316e),_0x36a96f['attributes'][_0x2c2de8(0x16d)]);_0x51e9a8[_0x2c2de8(0xf0)]&&this[_0x2c2de8(0x15c)]['info'](_0x2c2de8(0x10d)+a123_0x48aad4[_0x2c2de8(0x13c)](_0x51e9a8[_0x2c2de8(0xfc)])+_0x2c2de8(0x133)+a123_0x48aad4[_0x2c2de8(0x13c)](_0x51e9a8[_0x2c2de8(0xf3)]));const _0x7d8ea0=_0x51e9a8[_0x2c2de8(0xf3)],_0x238108=a123_0x48aad4[_0x2c2de8(0x14f)](_0x7d8ea0,sanitizeForFilesystem(_0x36a96f['attributes'][_0x2c2de8(0x16d)])+_0x2c2de8(0x1f7)),_0x29628c=a123_0x48aad4[_0x2c2de8(0x14f)](_0x7d8ea0,_0x2c2de8(0x1a7)),_0x56e1d8=a123_0x48aad4[_0x2c2de8(0x14f)](_0x7d8ea0,_0x2c2de8(0x1cf)),_0xd753f4=apiExperimentalArtifactToYaml(_0x36a96f),_0x2655df=toExperimentalArtifactYamlString(_0xd753f4),_0x5f31db=!a123_0x2527de[_0x2c2de8(0x140)](_0x7d8ea0);let _0x1b6583=_0x5f31db,_0x118a44,_0x34d005=_0x2655df+('\x0a---\x20code\x20---\x0a'+_0xd753f4['code']+'\x0a');const _0x49fdd8=[..._0xd753f4[_0x2c2de8(0x1cf)]][_0x2c2de8(0x108)]((_0x1573b9,_0x5afea0)=>_0x1573b9[_0x2c2de8(0x15e)]['localeCompare'](_0x5afea0[_0x2c2de8(0x15e)]));for(const _0x4f9aa8 of _0x49fdd8){_0x34d005+='---\x20file:\x20'+_0x4f9aa8[_0x2c2de8(0x15e)]+_0x2c2de8(0x1a4)+_0x4f9aa8['text_content']+'\x0a';}if(!_0x5f31db){let _0x2cba87='';a123_0x2527de[_0x2c2de8(0x140)](_0x238108)&&(_0x2cba87=a123_0x2527de[_0x2c2de8(0x101)](_0x238108,'utf-8'));a123_0x2527de[_0x2c2de8(0x140)](_0x29628c)&&(_0x2cba87+=_0x2c2de8(0x1cb)+a123_0x2527de['readFileSync'](_0x29628c,_0x2c2de8(0x168))+'\x0a');if(a123_0x2527de[_0x2c2de8(0x140)](_0x56e1d8)){const _0x26fc1a=a123_0x2527de[_0x2c2de8(0x18d)](_0x56e1d8),_0x176831=_0x26fc1a[_0x2c2de8(0x117)](_0x2fb2bc=>{const _0xcb289b=_0x2c2de8,_0x2fbc81=a123_0x48aad4[_0xcb289b(0x14f)](_0x56e1d8,_0x2fb2bc);return a123_0x2527de[_0xcb289b(0x1a0)](_0x2fbc81)['isFile']();})[_0x2c2de8(0x108)]((_0x38521d,_0x3e4245)=>_0x38521d[_0x2c2de8(0x1e8)](_0x3e4245));for(const _0x22ad10 of _0x176831){const _0x2506b4=a123_0x48aad4[_0x2c2de8(0x14f)](_0x56e1d8,_0x22ad10);_0x2cba87+=_0x2c2de8(0x1f8)+_0x22ad10+'\x20---\x0a'+a123_0x2527de[_0x2c2de8(0x101)](_0x2506b4,'utf-8')+'\x0a';}}const _0x2411b0=generateDiff(_0x2cba87,_0x34d005);_0x1b6583=hasChanges(_0x2411b0),_0x1b6583&&(_0x118a44=formatDiffWithColors(_0x2411b0));}_0x4ce8d5[_0x2c2de8(0x12f)]({'path':_0x7d8ea0,'content':'','isDir':!![]}),_0x4ce8d5[_0x2c2de8(0x12f)]({'path':_0x238108,'content':_0x2655df}),_0x4ce8d5['push']({'path':_0x29628c,'content':_0xd753f4['code']});if(_0xd753f4[_0x2c2de8(0x1cf)]['length']>0x0){_0x4ce8d5[_0x2c2de8(0x12f)]({'path':_0x56e1d8,'content':'','isDir':!![]});for(const _0x401c9a of _0xd753f4[_0x2c2de8(0x1cf)]){const _0x2c85c7=a123_0x48aad4['join'](_0x56e1d8,_0x401c9a[_0x2c2de8(0x15e)]);_0x4ce8d5[_0x2c2de8(0x12f)]({'path':_0x2c85c7,'content':_0x401c9a[_0x2c2de8(0x174)]});}}if(a123_0x2527de['existsSync'](_0x56e1d8)){const _0x472eb1=a123_0x2527de[_0x2c2de8(0x18d)](_0x56e1d8),_0x56b7a9=new Set(_0xd753f4[_0x2c2de8(0x1cf)][_0x2c2de8(0x15b)](_0x22faa8=>_0x22faa8[_0x2c2de8(0x15e)]));for(const _0x4d87c3 of _0x472eb1){const _0x46c5e7=a123_0x48aad4['join'](_0x56e1d8,_0x4d87c3);a123_0x2527de[_0x2c2de8(0x1a0)](_0x46c5e7)[_0x2c2de8(0x114)]()&&!_0x56b7a9[_0x2c2de8(0x1f3)](_0x4d87c3)&&_0x1a22f4[_0x2c2de8(0x12f)]({'path':_0x46c5e7});}}_0xf75a5d[_0x2c2de8(0x1ba)][_0x2c2de8(0x12f)]({'name':_0x36a96f[_0x2c2de8(0xf1)][_0x2c2de8(0x16d)],'outputPath':_0x7d8ea0,'isNew':_0x5f31db,'hasChanges':_0x1b6583,'diff':_0x118a44}),_0xf75a5d[_0x2c2de8(0x194)][_0x2c2de8(0x1ba)][_0x2c2de8(0x1ec)]++;if(_0x5f31db)_0xf75a5d[_0x2c2de8(0x194)][_0x2c2de8(0x1ba)]['new']++;else{if(_0x1b6583)_0xf75a5d[_0x2c2de8(0x194)]['experimentalArtifacts'][_0x2c2de8(0x195)]++;else _0xf75a5d['counts'][_0x2c2de8(0x1ba)][_0x2c2de8(0x1c5)]++;}}if(_0x3e09a1?.['dryRun'])return _0xf75a5d;a123_0x2527de[_0x2c2de8(0x145)](_0x57316e,{'recursive':!![]}),a123_0x2527de[_0x2c2de8(0x145)](getKnowledgeBasesDir(_0x57316e),{'recursive':!![]}),a123_0x2527de[_0x2c2de8(0x145)](getPromptsDir(_0x57316e),{'recursive':!![]}),a123_0x2527de['mkdirSync'](getIntegrationsDir(_0x57316e),{'recursive':!![]}),a123_0x2527de[_0x2c2de8(0x145)](getExperimentalKnowledgeBasesDir(_0x57316e),{'recursive':!![]}),a123_0x2527de[_0x2c2de8(0x145)](getExperimentalArtifactsDir(_0x57316e),{'recursive':!![]});const _0x4788a9=a123_0x48aad4[_0x2c2de8(0x14f)](_0x57316e,_0x2c2de8(0x1e0));a123_0x2527de['writeFileSync'](_0x4788a9,createAgentConfigContent(_0x1f4bc6));for(const _0x4c05f2 of _0x4ce8d5){if(_0x4c05f2[_0x2c2de8(0xed)])a123_0x2527de[_0x2c2de8(0x145)](_0x4c05f2[_0x2c2de8(0xf3)],{'recursive':!![]});else{const _0x33c2d7=a123_0x48aad4[_0x2c2de8(0xe7)](_0x4c05f2[_0x2c2de8(0xf3)]);!a123_0x2527de['existsSync'](_0x33c2d7)&&a123_0x2527de['mkdirSync'](_0x33c2d7,{'recursive':!![]}),a123_0x2527de['writeFileSync'](_0x4c05f2[_0x2c2de8(0xf3)],_0x4c05f2['content']);}}for(const _0x112aa0 of _0x1a22f4){_0x112aa0['isDir']?(a123_0x2527de[_0x2c2de8(0x1de)](_0x112aa0[_0x2c2de8(0xf3)],{'recursive':!![],'force':!![]}),this['logger']['info'](_0x2c2de8(0x17e)+a123_0x48aad4[_0x2c2de8(0x13c)](a123_0x48aad4[_0x2c2de8(0xe7)](_0x112aa0[_0x2c2de8(0xf3)]))+'/'+a123_0x48aad4[_0x2c2de8(0x13c)](_0x112aa0[_0x2c2de8(0xf3)]))):(a123_0x2527de['rmSync'](_0x112aa0[_0x2c2de8(0xf3)],{'force':!![]}),this['logger'][_0x2c2de8(0x196)](_0x2c2de8(0x137)+a123_0x48aad4[_0x2c2de8(0x13c)](a123_0x48aad4[_0x2c2de8(0xe7)](_0x112aa0[_0x2c2de8(0xf3)]))+'/'+a123_0x48aad4[_0x2c2de8(0x13c)](_0x112aa0['path'])));}return _0xf75a5d;}async['pushProject'](_0x265405,_0x322a86){const _0x22fb75=a123_0x3243df,_0x4da722=a123_0x48aad4[_0x22fb75(0x14f)](_0x265405,_0x22fb75(0x1e0));if(!a123_0x2527de[_0x22fb75(0x140)](_0x4da722))throw new SDKError(ErrorCode[_0x22fb75(0xe8)],_0x22fb75(0x121)+_0x265405,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x23d710=loadAgentConfig(_0x4da722),_0x46c61c=await this[_0x22fb75(0x100)](_0x23d710[_0x22fb75(0x1e7)]),_0x192154=await this[_0x22fb75(0x1ac)]['getProject'](_0x46c61c),_0x34c327=_0x192154['attributes']['name'],_0x2bc21f={'projectName':_0x34c327,'projectId':_0x46c61c,'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}}},_0x3b96d8=[],_0x4f4f25=[],_0x4db472=[],_0x53ca58=[],_0x27e430=[],_0x5d587e=[],_0x13bb6d=a123_0x2527de['readdirSync'](_0x265405,{'withFileTypes':!![]});for(const _0xf69bec of _0x13bb6d){if(!_0xf69bec['isDirectory']())continue;if(['knowledge_bases',_0x22fb75(0x139),_0x22fb75(0x1d4),_0x22fb75(0xf7),_0x22fb75(0xe2)][_0x22fb75(0x148)](_0xf69bec[_0x22fb75(0x16d)]))continue;const _0x381af1=a123_0x48aad4['join'](_0x265405,_0xf69bec[_0x22fb75(0x16d)]);if(isAgentDir(_0x381af1)){const _0x131abd=a123_0x48aad4['join'](_0x381af1,_0x22fb75(0x153)),_0x2e853b=a123_0x48aad4['join'](_0x381af1,_0x22fb75(0x190)),_0x4d0ce1=a123_0x48aad4[_0x22fb75(0x14f)](_0x381af1,_0x22fb75(0x152)),_0x190523=parseAgentYaml(a123_0x2527de[_0x22fb75(0x101)](_0x131abd,_0x22fb75(0x168)),_0x131abd),_0x3e0676=a123_0x2527de[_0x22fb75(0x140)](_0x2e853b)?a123_0x2527de['readFileSync'](_0x2e853b,_0x22fb75(0x168)):'',_0x47ec3a=a123_0x2527de[_0x22fb75(0x140)](_0x4d0ce1)?a123_0x2527de[_0x22fb75(0x101)](_0x4d0ce1,_0x22fb75(0x168)):_0x190523[_0x22fb75(0x1a6)];_0x3b96d8[_0x22fb75(0x12f)]({'name':_0x190523[_0x22fb75(0x16d)],'dir':_0x381af1,'yaml':_0x190523,'systemPrompt':_0x3e0676,'starterMessage':_0x47ec3a});}}const _0x122ff=getKnowledgeBasesDir(_0x265405);if(a123_0x2527de[_0x22fb75(0x140)](_0x122ff)){const _0x4aeac3=a123_0x2527de[_0x22fb75(0x18d)](_0x122ff);for(const _0x1c5e0a of _0x4aeac3){const _0xb86cef=a123_0x48aad4['join'](_0x122ff,_0x1c5e0a);if(_0x1c5e0a[_0x22fb75(0xff)]('.yml')){const _0x18452f=parseKnowledgeBaseYaml(a123_0x2527de[_0x22fb75(0x101)](_0xb86cef,_0x22fb75(0x168)),_0xb86cef);_0x4f4f25['push']({'name':_0x18452f[_0x22fb75(0x16d)],'path':_0xb86cef,'yaml':_0x18452f});}else{if(_0x1c5e0a[_0x22fb75(0xff)](_0x22fb75(0x186))){const _0xc9f4d9=a123_0x2527de['readFileSync'](_0xb86cef,_0x22fb75(0x168)),{name:_0x44cefa,text:_0x19104a}=parseTextKnowledgeBaseMd(_0xc9f4d9,_0x1c5e0a);_0x4db472[_0x22fb75(0x12f)]({'name':_0x44cefa,'path':_0xb86cef,'text':_0x19104a});}}}}const _0x22a4e0=getPromptsDir(_0x265405);if(a123_0x2527de['existsSync'](_0x22a4e0)){const _0x32efa3=a123_0x2527de[_0x22fb75(0x18d)](_0x22a4e0)[_0x22fb75(0x117)](_0x2356b5=>_0x2356b5[_0x22fb75(0xff)]('.yml'));for(const _0xe6d110 of _0x32efa3){const _0x2c7d5b=a123_0x48aad4[_0x22fb75(0x14f)](_0x22a4e0,_0xe6d110),_0x447fb8=parsePromptYaml(a123_0x2527de['readFileSync'](_0x2c7d5b,_0x22fb75(0x168)),_0x2c7d5b);_0x53ca58[_0x22fb75(0x12f)]({'name':_0x447fb8[_0x22fb75(0x16d)],'path':_0x2c7d5b,'yaml':_0x447fb8});}}const _0x25d927=[],_0x40d622=getIntegrationsDir(_0x265405);if(a123_0x2527de[_0x22fb75(0x140)](_0x40d622)){const _0x3f2678=a123_0x2527de['readdirSync'](_0x40d622)[_0x22fb75(0x117)](_0x5d1ccb=>_0x5d1ccb[_0x22fb75(0xff)](_0x22fb75(0x1f7)));for(const _0x337a57 of _0x3f2678){const _0x2a7d85=a123_0x48aad4[_0x22fb75(0x14f)](_0x40d622,_0x337a57),_0x206e31=parseIntegrationYaml(a123_0x2527de[_0x22fb75(0x101)](_0x2a7d85,'utf-8'),_0x2a7d85);if(!SAFE_INTEGRATION_TYPES[_0x22fb75(0x148)](_0x206e31[_0x22fb75(0x141)]['toLowerCase']())){this['logger'][_0x22fb75(0x10a)]('Skipping\x20integration\x20\x27'+_0x206e31[_0x22fb75(0x16d)]+_0x22fb75(0x1f1)+_0x206e31['service_type']+_0x22fb75(0x160)+(_0x22fb75(0x1aa)+SAFE_INTEGRATION_TYPES[_0x22fb75(0x14f)](',\x20')+_0x22fb75(0x1d6))+_0x22fb75(0x1bc));continue;}_0x25d927[_0x22fb75(0x12f)]({'name':_0x206e31[_0x22fb75(0x16d)],'path':_0x2a7d85,'yaml':_0x206e31});}}const _0x54e10d=getExperimentalKnowledgeBasesDir(_0x265405);if(a123_0x2527de[_0x22fb75(0x140)](_0x54e10d)){const _0x469867=a123_0x2527de[_0x22fb75(0x18d)](_0x54e10d,{'withFileTypes':!![]});for(const _0x4875e2 of _0x469867){if(!_0x4875e2[_0x22fb75(0x1b4)]())continue;const _0x573bb2=a123_0x48aad4[_0x22fb75(0x14f)](_0x54e10d,_0x4875e2[_0x22fb75(0x16d)]),_0x16799b=a123_0x48aad4['join'](_0x573bb2,_0x4875e2[_0x22fb75(0x16d)]+_0x22fb75(0x1f7)),_0x137605=a123_0x48aad4[_0x22fb75(0x14f)](_0x573bb2,'functions');if(!a123_0x2527de[_0x22fb75(0x140)](_0x16799b))continue;const _0x55a773=parseExperimentalKnowledgeBaseYaml(a123_0x2527de[_0x22fb75(0x101)](_0x16799b,_0x22fb75(0x168)),_0x16799b),_0x54d63f=[];if(a123_0x2527de['existsSync'](_0x137605)){const _0x5ad61a=a123_0x2527de['readdirSync'](_0x137605,{'withFileTypes':!![]});for(const _0x416d94 of _0x5ad61a){if(!_0x416d94[_0x22fb75(0x1b4)]())continue;const _0x59e561=a123_0x48aad4[_0x22fb75(0x14f)](_0x137605,_0x416d94[_0x22fb75(0x16d)]),_0x3c6661=a123_0x48aad4[_0x22fb75(0x14f)](_0x59e561,_0x22fb75(0x1a7)),_0x247581=a123_0x48aad4[_0x22fb75(0x14f)](_0x59e561,_0x22fb75(0x1e6));a123_0x2527de[_0x22fb75(0x140)](_0x3c6661)&&a123_0x2527de[_0x22fb75(0x140)](_0x247581)&&_0x54d63f[_0x22fb75(0x12f)]({'name':_0x416d94[_0x22fb75(0x16d)],'code':a123_0x2527de[_0x22fb75(0x101)](_0x3c6661,'utf-8'),'json_schema':a123_0x2527de['readFileSync'](_0x247581,_0x22fb75(0x168))});}}const _0x2eb3f9={..._0x55a773,'variables':_0x55a773[_0x22fb75(0x10b)]||[],'functions':_0x54d63f};_0x27e430[_0x22fb75(0x12f)]({'name':_0x55a773[_0x22fb75(0x16d)],'dir':_0x573bb2,'def':_0x2eb3f9});}}const _0x5302a6=getExperimentalArtifactsDir(_0x265405);if(a123_0x2527de[_0x22fb75(0x140)](_0x5302a6)){const _0x4a4cc8=a123_0x2527de['readdirSync'](_0x5302a6,{'withFileTypes':!![]});for(const _0xa75d55 of _0x4a4cc8){if(!_0xa75d55['isDirectory']())continue;const _0x28d682=a123_0x48aad4[_0x22fb75(0x14f)](_0x5302a6,_0xa75d55[_0x22fb75(0x16d)]),_0x2d73ae=a123_0x48aad4[_0x22fb75(0x14f)](_0x28d682,_0xa75d55[_0x22fb75(0x16d)]+_0x22fb75(0x1f7)),_0x4d7647=a123_0x48aad4['join'](_0x28d682,_0x22fb75(0x1a7)),_0x4dee0e=a123_0x48aad4[_0x22fb75(0x14f)](_0x28d682,'files');if(!a123_0x2527de['existsSync'](_0x2d73ae)||!a123_0x2527de[_0x22fb75(0x140)](_0x4d7647))continue;const _0x56a512=parseExperimentalArtifactYaml(a123_0x2527de[_0x22fb75(0x101)](_0x2d73ae,_0x22fb75(0x168)),_0x2d73ae),_0x554844=a123_0x2527de[_0x22fb75(0x101)](_0x4d7647,_0x22fb75(0x168)),_0x57923b=[];if(a123_0x2527de['existsSync'](_0x4dee0e)){const _0x2cf2c7=a123_0x2527de['readdirSync'](_0x4dee0e);for(const _0x58eee3 of _0x2cf2c7){const _0x4e795d=a123_0x48aad4['join'](_0x4dee0e,_0x58eee3);a123_0x2527de[_0x22fb75(0x1a0)](_0x4e795d)['isFile']()&&_0x57923b[_0x22fb75(0x12f)]({'file_name':_0x58eee3,'text_content':a123_0x2527de[_0x22fb75(0x101)](_0x4e795d,_0x22fb75(0x168))});}}const _0x4adc5a={..._0x56a512,'code':_0x554844,'files':_0x57923b};_0x5d587e[_0x22fb75(0x12f)]({'name':_0x56a512['name'],'dir':_0x28d682,'def':_0x4adc5a});}}const _0x364590=await this[_0x22fb75(0x1ac)][_0x22fb75(0x147)](_0x46c61c),_0xc29e14=await this['client'][_0x22fb75(0x1ee)](_0x46c61c),_0x3af03d=await this['client'][_0x22fb75(0x14c)](_0x46c61c),_0x27ec11=await this[_0x22fb75(0x1ac)][_0x22fb75(0x10c)](_0x46c61c),_0x3ffc4e=await this[_0x22fb75(0x1ac)][_0x22fb75(0x111)](_0x46c61c),_0x5f241e=await safeListOrEmpty(()=>this[_0x22fb75(0x1ac)][_0x22fb75(0x1f0)](_0x46c61c)),_0x2c65ff=await safeListOrEmpty(()=>this[_0x22fb75(0x1ac)][_0x22fb75(0x17d)](_0x46c61c)),_0x45cc81=await fetchAllToolTargetMaps((_0x42d334,_0x1a684d)=>this['client'][_0x22fb75(0x1c8)](_0x42d334,_0x1a684d),_0x46c61c),_0x27a444=new Map(),_0xf80655=new Map(),_0x3b8e1c=new Map(),_0x705c13=new Map(),_0x56b355=new Map(),_0x32fcdc=new Map(),_0x3fa810=new Map();for(const _0x3eeb25 of _0x364590){_0x27a444[_0x22fb75(0x19a)](_0x3eeb25[_0x22fb75(0xf1)][_0x22fb75(0x16d)],_0x3eeb25);}for(const _0x114e30 of _0xc29e14){_0xf80655[_0x22fb75(0x19a)](_0x114e30[_0x22fb75(0xf1)][_0x22fb75(0x16d)],_0x114e30);}for(const _0x5caf9b of _0x3af03d){_0x3b8e1c[_0x22fb75(0x19a)](_0x5caf9b['attributes'][_0x22fb75(0x16d)],_0x5caf9b);}for(const _0x207a23 of _0x27ec11){_0x705c13[_0x22fb75(0x19a)](_0x207a23[_0x22fb75(0xf1)]['name'],_0x207a23);}for(const _0x686728 of _0x3ffc4e){_0x56b355[_0x22fb75(0x19a)](_0x686728[_0x22fb75(0xf1)][_0x22fb75(0x184)][_0x22fb75(0x1b3)](),_0x686728);}for(const _0x42300c of _0x5f241e){_0x32fcdc['set'](_0x42300c[_0x22fb75(0xf1)][_0x22fb75(0x16d)],_0x42300c);}for(const _0x428e1c of _0x2c65ff){_0x3fa810[_0x22fb75(0x19a)](_0x428e1c[_0x22fb75(0xf1)][_0x22fb75(0x16d)],_0x428e1c);}const _0x39af65=new Map(),_0x25f982=new Map();for(const _0x3f173b of _0x364590){_0x39af65[_0x22fb75(0x19a)](_0x3f173b['attributes'][_0x22fb75(0x16d)],_0x3f173b['id']),_0x25f982[_0x22fb75(0x19a)](_0x3f173b['id'],_0x3f173b[_0x22fb75(0xf1)]['name']);}const _0x281569=new Map(),_0x1bcbf0=new Map();for(const _0x3a0765 of _0x27ec11){_0x281569[_0x22fb75(0x19a)](_0x3a0765[_0x22fb75(0xf1)][_0x22fb75(0x16d)],_0x3a0765['id']),_0x1bcbf0['set'](_0x3a0765['id'],_0x3a0765[_0x22fb75(0xf1)]['name']);}const _0x225af5=_0x45cc81[_0x22fb75(0x1be)]['KnowledgeBase']||new Map(),_0x4ab02a=_0x45cc81[_0x22fb75(0x1be)][_0x22fb75(0x1e5)]||new Map(),_0x216f3c=_0x45cc81[_0x22fb75(0x1be)][_0x22fb75(0x1ab)]||new Map(),_0xf042be=new Map(),_0xffdb3c={'resolveToolTargetName':buildNameResolver({..._0x45cc81[_0x22fb75(0x1cd)],'Agent':_0x25f982}),'resolvePromptName':async _0x1aa838=>_0x1bcbf0[_0x22fb75(0x104)](_0x1aa838),'onWarning':_0x2cb76c=>this[_0x22fb75(0x15c)][_0x22fb75(0x10a)](_0x2cb76c)};let _0x7f3ab2=[];const _0x2f3546={'projectId':_0x46c61c,'resolveToolTargetId':buildIdResolver({..._0x45cc81[_0x22fb75(0x1be)],'Agent':_0x39af65}),'resolvePromptId':async _0x565140=>_0x281569[_0x22fb75(0x104)](_0x565140),'onWarning':_0x4046ad=>{const _0x304a52=_0x22fb75;this[_0x304a52(0x15c)][_0x304a52(0x10a)](_0x4046ad),_0x7f3ab2[_0x304a52(0x12f)](_0x4046ad);}},{resolved:_0x15ba04,unresolved:_0x238a5e}=resolveAgentDependencies(_0x3b96d8,new Set(_0x27a444[_0x22fb75(0x112)]()));for(const {agent:_0x4ff878,missingDeps:_0xb9484b}of _0x238a5e){_0x2bc21f[_0x22fb75(0x1af)]['push']({'agentName':_0x4ff878[_0x22fb75(0x1ce)]['name'],'action':_0x22fb75(0x1bd),'error':'Unresolved\x20dependencies:\x20'+_0xb9484b[_0x22fb75(0x14f)](',\x20')+_0x22fb75(0x1f9)}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1af)][_0x22fb75(0x149)]++;}for(const _0x37c466 of _0x4f4f25){const _0x20fb52=_0xf80655['get'](_0x37c466[_0x22fb75(0x1ce)][_0x22fb75(0x16d)]),_0x1dfa74=a123_0x2527de[_0x22fb75(0x101)](_0x37c466[_0x22fb75(0xf3)],_0x22fb75(0x168));if(_0x20fb52){const _0x22125d=apiKnowledgeBaseToYaml(_0x20fb52),_0x20e7f5=toKnowledgeBaseYamlString(_0x22125d),_0x227930=generateDiff(_0x20e7f5,_0x1dfa74),_0x325b4a=hasChanges(_0x227930);_0x325b4a?(_0x2bc21f[_0x22fb75(0x156)]['push']({'name':_0x37c466[_0x22fb75(0x1ce)][_0x22fb75(0x16d)],'action':_0x22fb75(0x195),'id':_0x20fb52['id'],'diff':formatDiffWithColors(_0x227930)}),_0x2bc21f['counts'][_0x22fb75(0x156)][_0x22fb75(0x195)]++):(_0x2bc21f[_0x22fb75(0x156)][_0x22fb75(0x12f)]({'name':_0x37c466['yaml'][_0x22fb75(0x16d)],'action':_0x22fb75(0x1c5),'id':_0x20fb52['id']}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x156)]['unchanged']++);}else _0x2bc21f[_0x22fb75(0x156)][_0x22fb75(0x12f)]({'name':_0x37c466[_0x22fb75(0x1ce)][_0x22fb75(0x16d)],'action':_0x22fb75(0x120)}),_0x2bc21f[_0x22fb75(0x194)]['knowledgeBases'][_0x22fb75(0x120)]++;}for(const _0x53f135 of _0x4db472){const _0x128bf1=_0x3b8e1c[_0x22fb75(0x104)](_0x53f135[_0x22fb75(0x16d)]),_0x201356=a123_0x2527de[_0x22fb75(0x101)](_0x53f135['path'],_0x22fb75(0x168));if(_0x128bf1){const _0x5ae283=toTextKnowledgeBaseMd(_0x128bf1[_0x22fb75(0xf1)][_0x22fb75(0x16d)],_0x128bf1[_0x22fb75(0xf1)][_0x22fb75(0x1b6)]),_0x1c3133=generateDiff(_0x5ae283,_0x201356),_0x193ea6=hasChanges(_0x1c3133);_0x193ea6?(_0x2bc21f[_0x22fb75(0x1f5)][_0x22fb75(0x12f)]({'name':_0x53f135['name'],'action':_0x22fb75(0x195),'id':_0x128bf1['id'],'diff':formatDiffWithColors(_0x1c3133)}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1f5)][_0x22fb75(0x195)]++):(_0x2bc21f['textKnowledgeBases'][_0x22fb75(0x12f)]({'name':_0x53f135[_0x22fb75(0x16d)],'action':_0x22fb75(0x1c5),'id':_0x128bf1['id']}),_0x2bc21f[_0x22fb75(0x194)]['textKnowledgeBases']['unchanged']++);}else _0x2bc21f[_0x22fb75(0x1f5)]['push']({'name':_0x53f135[_0x22fb75(0x16d)],'action':'created'}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1f5)][_0x22fb75(0x120)]++;}for(const _0x5b68f7 of _0x15ba04){const _0x3f9f58=_0x27a444[_0x22fb75(0x104)](_0x5b68f7[_0x22fb75(0x1ce)]['name']),_0x5b9fe6=a123_0x48aad4['join'](_0x5b68f7[_0x22fb75(0x1d3)],_0x22fb75(0x153)),_0x537729=a123_0x2527de[_0x22fb75(0x101)](_0x5b9fe6,_0x22fb75(0x168)),_0x5b9a49=_0x5b68f7[_0x22fb75(0x198)],_0x39a8f9=_0x22fb75(0x1b8)+_0x5b9a49+'\x0a\x0a#\x20agent.yml\x0a'+_0x537729;if(_0x3f9f58){const {yaml:_0x12a0b2,systemPrompt:_0x4f7c9a}=await agentResponseToDef(_0x3f9f58,_0xffdb3c),_0x4032e4=toAgentYamlString(_0x12a0b2),_0x31f282=_0x22fb75(0x1b8)+_0x4f7c9a+_0x22fb75(0x11c)+_0x4032e4,_0x485903=generateDiff(_0x31f282,_0x39a8f9),_0x44ef2a=hasChanges(_0x485903);_0x44ef2a?(_0x2bc21f['agents'][_0x22fb75(0x12f)]({'agentName':_0x5b68f7[_0x22fb75(0x1ce)]['name'],'action':_0x22fb75(0x195),'agentId':_0x3f9f58['id'],'diff':formatDiffWithColors(_0x485903)}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1af)][_0x22fb75(0x195)]++):(_0x2bc21f[_0x22fb75(0x1af)][_0x22fb75(0x12f)]({'agentName':_0x5b68f7[_0x22fb75(0x1ce)][_0x22fb75(0x16d)],'action':_0x22fb75(0x1c5),'agentId':_0x3f9f58['id']}),_0x2bc21f['counts'][_0x22fb75(0x1af)]['unchanged']++);}else _0x2bc21f[_0x22fb75(0x1af)][_0x22fb75(0x12f)]({'agentName':_0x5b68f7[_0x22fb75(0x1ce)]['name'],'action':_0x22fb75(0x120)}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1af)][_0x22fb75(0x120)]++;}for(const _0x49f4de of _0x53ca58){const _0x2c28c0=_0x705c13[_0x22fb75(0x104)](_0x49f4de[_0x22fb75(0x1ce)][_0x22fb75(0x16d)]),_0x14caeb=a123_0x2527de['readFileSync'](_0x49f4de['path'],'utf-8');if(_0x2c28c0){const _0x383562=await apiPromptToYaml(_0x2c28c0,_0xffdb3c);if(!_0x383562){_0x2bc21f[_0x22fb75(0x139)][_0x22fb75(0x12f)]({'name':_0x49f4de[_0x22fb75(0x1ce)][_0x22fb75(0x16d)],'action':_0x22fb75(0x195),'id':_0x2c28c0['id']}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x139)][_0x22fb75(0x195)]++;continue;}const _0x3f134d=toPromptYamlString(_0x383562),_0x213ad4=generateDiff(_0x3f134d,_0x14caeb),_0x2deaf1=hasChanges(_0x213ad4);_0x2deaf1?(_0x2bc21f[_0x22fb75(0x139)][_0x22fb75(0x12f)]({'name':_0x49f4de[_0x22fb75(0x1ce)][_0x22fb75(0x16d)],'action':_0x22fb75(0x195),'id':_0x2c28c0['id'],'diff':formatDiffWithColors(_0x213ad4)}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x139)]['updated']++):(_0x2bc21f[_0x22fb75(0x139)][_0x22fb75(0x12f)]({'name':_0x49f4de[_0x22fb75(0x1ce)][_0x22fb75(0x16d)],'action':'unchanged','id':_0x2c28c0['id']}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x139)][_0x22fb75(0x1c5)]++);}else _0x2bc21f['prompts'][_0x22fb75(0x12f)]({'name':_0x49f4de[_0x22fb75(0x1ce)]['name'],'action':'created'}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x139)][_0x22fb75(0x120)]++;}for(const _0x16a99f of _0x25d927){const _0x4d26da=_0x56b355[_0x22fb75(0x104)](_0x16a99f['yaml'][_0x22fb75(0x141)]),_0x340bd5=a123_0x2527de[_0x22fb75(0x101)](_0x16a99f[_0x22fb75(0xf3)],_0x22fb75(0x168));if(_0x4d26da){const _0x2b6c64=await apiIntegrationToYaml(_0x4d26da,_0xffdb3c),_0x5287e7=toIntegrationYamlString(_0x2b6c64),_0x1fc951=generateDiff(_0x5287e7,_0x340bd5),_0x5e82e5=hasChanges(_0x1fc951);_0x5e82e5?(_0x2bc21f[_0x22fb75(0x1d4)][_0x22fb75(0x12f)]({'name':_0x16a99f[_0x22fb75(0x1ce)]['service_type'],'action':'updated','id':_0x4d26da['id'],'diff':formatDiffWithColors(_0x1fc951)}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1d4)][_0x22fb75(0x195)]++):(_0x2bc21f['integrations'][_0x22fb75(0x12f)]({'name':_0x16a99f[_0x22fb75(0x1ce)]['service_type'],'action':_0x22fb75(0x1c5),'id':_0x4d26da['id']}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1d4)]['unchanged']++);}else _0x2bc21f[_0x22fb75(0x1d4)][_0x22fb75(0x12f)]({'name':_0x16a99f[_0x22fb75(0x1ce)][_0x22fb75(0x141)],'action':_0x22fb75(0x120)}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1d4)][_0x22fb75(0x120)]++;}for(const _0x22d115 of _0x27e430){const _0x1e4442=_0x32fcdc[_0x22fb75(0x104)](_0x22d115['def'][_0x22fb75(0x16d)]),_0x5908c9=toExperimentalKnowledgeBaseYamlString(_0x22d115[_0x22fb75(0x18f)]);let _0x198e61=_0x5908c9;for(const _0x502429 of _0x22d115[_0x22fb75(0x18f)]['functions']){_0x198e61+=_0x22fb75(0x1d2)+_0x502429[_0x22fb75(0x16d)]+_0x22fb75(0x1a4)+_0x502429['code']+_0x22fb75(0x1bb)+_0x502429[_0x22fb75(0x16d)]+_0x22fb75(0x1a4)+_0x502429[_0x22fb75(0x135)]+'\x0a';}if(_0x1e4442){const _0x3ff66c=apiExperimentalKnowledgeBaseToYaml(_0x1e4442),_0x1401b7=toExperimentalKnowledgeBaseYamlString(_0x3ff66c);let _0x16ab02=_0x1401b7;for(const _0x2de561 of _0x3ff66c['functions']){_0x16ab02+=_0x22fb75(0x1d2)+_0x2de561[_0x22fb75(0x16d)]+_0x22fb75(0x1a4)+_0x2de561[_0x22fb75(0x1d5)]+'\x0a---\x20schema:\x20'+_0x2de561[_0x22fb75(0x16d)]+_0x22fb75(0x1a4)+_0x2de561[_0x22fb75(0x135)]+'\x0a';}const _0x15ec4b=generateDiff(_0x16ab02,_0x198e61),_0x39bb90=hasChanges(_0x15ec4b);_0x39bb90?(_0x2bc21f['experimentalKnowledgeBases'][_0x22fb75(0x12f)]({'name':_0x22d115[_0x22fb75(0x18f)]['name'],'action':'updated','id':_0x1e4442['id'],'diff':formatDiffWithColors(_0x15ec4b)}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x13d)][_0x22fb75(0x195)]++):(_0x2bc21f[_0x22fb75(0x13d)]['push']({'name':_0x22d115[_0x22fb75(0x18f)][_0x22fb75(0x16d)],'action':_0x22fb75(0x1c5),'id':_0x1e4442['id']}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x13d)][_0x22fb75(0x1c5)]++);}else _0x2bc21f['experimentalKnowledgeBases'][_0x22fb75(0x12f)]({'name':_0x22d115[_0x22fb75(0x18f)]['name'],'action':'created'}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x13d)][_0x22fb75(0x120)]++;}for(const _0x2d2bb9 of _0x5d587e){const _0x4bd9df=_0x3fa810[_0x22fb75(0x104)](_0x2d2bb9[_0x22fb75(0x18f)]['name']),_0x5076b2=toExperimentalArtifactYamlString(_0x2d2bb9['def']);let _0x59d732=_0x5076b2+(_0x22fb75(0x1cb)+_0x2d2bb9['def'][_0x22fb75(0x1d5)]+'\x0a');for(const _0x10fda7 of _0x2d2bb9[_0x22fb75(0x18f)]['files']){_0x59d732+='---\x20file:\x20'+_0x10fda7[_0x22fb75(0x15e)]+_0x22fb75(0x1a4)+_0x10fda7[_0x22fb75(0x174)]+'\x0a';}if(_0x4bd9df){const _0x2f298d=apiExperimentalArtifactToYaml(_0x4bd9df),_0x40868a=toExperimentalArtifactYamlString(_0x2f298d);let _0x7730cf=_0x40868a+(_0x22fb75(0x1cb)+_0x2f298d[_0x22fb75(0x1d5)]+'\x0a');for(const _0x1a4799 of _0x2f298d['files']){_0x7730cf+='---\x20file:\x20'+_0x1a4799[_0x22fb75(0x15e)]+_0x22fb75(0x1a4)+_0x1a4799[_0x22fb75(0x174)]+'\x0a';}const _0x2d232f=generateDiff(_0x7730cf,_0x59d732),_0x348577=hasChanges(_0x2d232f);_0x348577?(_0x2bc21f[_0x22fb75(0x1ba)][_0x22fb75(0x12f)]({'name':_0x2d2bb9['def'][_0x22fb75(0x16d)],'action':_0x22fb75(0x195),'id':_0x4bd9df['id'],'diff':formatDiffWithColors(_0x2d232f)}),_0x2bc21f[_0x22fb75(0x194)]['experimentalArtifacts'][_0x22fb75(0x195)]++):(_0x2bc21f[_0x22fb75(0x1ba)][_0x22fb75(0x12f)]({'name':_0x2d2bb9[_0x22fb75(0x18f)][_0x22fb75(0x16d)],'action':_0x22fb75(0x1c5),'id':_0x4bd9df['id']}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1ba)][_0x22fb75(0x1c5)]++);}else _0x2bc21f['experimentalArtifacts'][_0x22fb75(0x12f)]({'name':_0x2d2bb9[_0x22fb75(0x18f)]['name'],'action':_0x22fb75(0x120)}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1ba)]['created']++;}if(_0x322a86?.['dryRun'])return _0x2bc21f;_0x2bc21f[_0x22fb75(0x156)]=[],_0x2bc21f[_0x22fb75(0x1f5)]=[],_0x2bc21f[_0x22fb75(0x139)]=[],_0x2bc21f[_0x22fb75(0x1d4)]=[],_0x2bc21f[_0x22fb75(0x13d)]=[],_0x2bc21f[_0x22fb75(0x1ba)]=[];const _0x5d2827=_0x2bc21f[_0x22fb75(0x1af)][_0x22fb75(0x117)](_0x21bc3f=>_0x21bc3f[_0x22fb75(0x129)]==='error');_0x2bc21f[_0x22fb75(0x1af)]=_0x5d2827,_0x2bc21f[_0x22fb75(0x194)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x5d2827['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 _0x277acb of _0x4f4f25){try{const _0x370237=_0xf80655['get'](_0x277acb[_0x22fb75(0x1ce)][_0x22fb75(0x16d)]),_0x3fd109=yamlKnowledgeBaseToApi(_0x277acb[_0x22fb75(0x1ce)],_0x46c61c);if(_0x370237)await this[_0x22fb75(0x1ac)][_0x22fb75(0x179)](_0x370237['id'],_0x3fd109),_0x225af5[_0x22fb75(0x19a)](_0x277acb[_0x22fb75(0x1ce)][_0x22fb75(0x16d)],_0x370237['id']),_0x2bc21f[_0x22fb75(0x156)][_0x22fb75(0x12f)]({'name':_0x277acb[_0x22fb75(0x1ce)]['name'],'action':_0x22fb75(0x195),'id':_0x370237['id']}),_0x2bc21f[_0x22fb75(0x194)]['knowledgeBases']['updated']++;else{const _0x223fad=await this['client'][_0x22fb75(0xfb)](_0x3fd109);_0x225af5['set'](_0x277acb[_0x22fb75(0x1ce)][_0x22fb75(0x16d)],_0x223fad['id']),_0x2bc21f[_0x22fb75(0x156)][_0x22fb75(0x12f)]({'name':_0x277acb[_0x22fb75(0x1ce)]['name'],'action':_0x22fb75(0x120),'id':_0x223fad['id']}),_0x2bc21f['counts']['knowledgeBases']['created']++;}}catch(_0x106748){_0x2bc21f[_0x22fb75(0x156)]['push']({'name':_0x277acb[_0x22fb75(0x1ce)][_0x22fb75(0x16d)],'action':_0x22fb75(0x1bd),'error':_0x106748[_0x22fb75(0x1ae)]}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x156)][_0x22fb75(0x149)]++;}}for(const _0x443002 of _0x4db472){try{const _0x5beb33=_0x3b8e1c[_0x22fb75(0x104)](_0x443002[_0x22fb75(0x16d)]),_0x490f1d=yamlTextKnowledgeBaseToApi({'name':_0x443002['name'],'text':_0x443002['text']},_0x46c61c);if(_0x5beb33)await this[_0x22fb75(0x1ac)][_0x22fb75(0x1f4)](_0x5beb33['id'],_0x490f1d),_0x4ab02a[_0x22fb75(0x19a)](_0x443002[_0x22fb75(0x16d)],_0x5beb33['id']),_0x2bc21f['textKnowledgeBases']['push']({'name':_0x443002['name'],'action':_0x22fb75(0x195),'id':_0x5beb33['id']}),_0x2bc21f[_0x22fb75(0x194)]['textKnowledgeBases'][_0x22fb75(0x195)]++;else{const _0x56cefa=await this[_0x22fb75(0x1ac)]['createTextKnowledgeBase'](_0x490f1d);_0x4ab02a[_0x22fb75(0x19a)](_0x443002[_0x22fb75(0x16d)],_0x56cefa['id']),_0x2bc21f['textKnowledgeBases'][_0x22fb75(0x12f)]({'name':_0x443002[_0x22fb75(0x16d)],'action':'created','id':_0x56cefa['id']}),_0x2bc21f[_0x22fb75(0x194)]['textKnowledgeBases'][_0x22fb75(0x120)]++;}}catch(_0x42b6c5){_0x2bc21f['textKnowledgeBases'][_0x22fb75(0x12f)]({'name':_0x443002[_0x22fb75(0x16d)],'action':_0x22fb75(0x1bd),'error':_0x42b6c5['message']}),_0x2bc21f[_0x22fb75(0x194)]['textKnowledgeBases']['errors']++;}}for(const _0x1c7061 of _0x27e430){try{const _0x1cbc60=_0x32fcdc[_0x22fb75(0x104)](_0x1c7061[_0x22fb75(0x18f)]['name']),_0x2f8127=yamlExperimentalKnowledgeBaseToApi(_0x1c7061[_0x22fb75(0x18f)],_0x46c61c);if(_0x1cbc60)await this['client'][_0x22fb75(0x105)](_0x1cbc60['id'],_0x2f8127),_0x216f3c[_0x22fb75(0x19a)](_0x1c7061[_0x22fb75(0x18f)][_0x22fb75(0x16d)],_0x1cbc60['id']),_0x2bc21f[_0x22fb75(0x13d)][_0x22fb75(0x12f)]({'name':_0x1c7061[_0x22fb75(0x18f)][_0x22fb75(0x16d)],'action':_0x22fb75(0x195),'id':_0x1cbc60['id']}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x13d)]['updated']++;else{const _0x3e51f5=await this[_0x22fb75(0x1ac)][_0x22fb75(0x144)](_0x2f8127);_0x216f3c[_0x22fb75(0x19a)](_0x1c7061[_0x22fb75(0x18f)][_0x22fb75(0x16d)],_0x3e51f5['id']),_0x2bc21f[_0x22fb75(0x13d)][_0x22fb75(0x12f)]({'name':_0x1c7061[_0x22fb75(0x18f)]['name'],'action':_0x22fb75(0x120),'id':_0x3e51f5['id']}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x13d)][_0x22fb75(0x120)]++;}}catch(_0x4ea96c){_0x2bc21f[_0x22fb75(0x13d)][_0x22fb75(0x12f)]({'name':_0x1c7061[_0x22fb75(0x18f)][_0x22fb75(0x16d)],'action':_0x22fb75(0x1bd),'error':_0x4ea96c[_0x22fb75(0x1ae)]}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x13d)][_0x22fb75(0x149)]++;}}for(const _0x5ea94b of _0x5d587e){try{const _0x21efe3=_0x3fa810['get'](_0x5ea94b['def'][_0x22fb75(0x16d)]),_0x42744b=yamlExperimentalArtifactToApi(_0x5ea94b['def'],_0x46c61c);if(_0x21efe3)await this[_0x22fb75(0x1ac)][_0x22fb75(0x1c1)](_0x21efe3['id'],_0x42744b),_0xf042be['set'](_0x5ea94b[_0x22fb75(0x18f)][_0x22fb75(0x16d)],_0x21efe3['id']),_0x2bc21f[_0x22fb75(0x1ba)][_0x22fb75(0x12f)]({'name':_0x5ea94b[_0x22fb75(0x18f)]['name'],'action':_0x22fb75(0x195),'id':_0x21efe3['id']}),_0x2bc21f['counts']['experimentalArtifacts']['updated']++;else{const _0x33a3a7=await this[_0x22fb75(0x1ac)][_0x22fb75(0x1c4)](_0x42744b);_0xf042be[_0x22fb75(0x19a)](_0x5ea94b[_0x22fb75(0x18f)][_0x22fb75(0x16d)],_0x33a3a7['id']),_0x2bc21f[_0x22fb75(0x1ba)][_0x22fb75(0x12f)]({'name':_0x5ea94b['def'][_0x22fb75(0x16d)],'action':'created','id':_0x33a3a7['id']}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1ba)][_0x22fb75(0x120)]++;}}catch(_0xb013a){_0x2bc21f[_0x22fb75(0x1ba)][_0x22fb75(0x12f)]({'name':_0x5ea94b[_0x22fb75(0x18f)][_0x22fb75(0x16d)],'action':'error','error':_0xb013a[_0x22fb75(0x1ae)]}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1ba)][_0x22fb75(0x149)]++;}}for(const _0x8b691e of _0x15ba04){_0x7f3ab2=[];try{const _0x251072=_0x27a444['get'](_0x8b691e['yaml']['name']),_0x52bd87=await agentDefToRequest(_0x8b691e[_0x22fb75(0x1ce)],_0x8b691e[_0x22fb75(0x198)],_0x8b691e[_0x22fb75(0x158)],_0x2f3546);if(_0x251072)await this[_0x22fb75(0x1ac)][_0x22fb75(0x115)](_0x251072['id'],_0x52bd87),_0x39af65['set'](_0x8b691e[_0x22fb75(0x1ce)][_0x22fb75(0x16d)],_0x251072['id']),_0x2bc21f[_0x22fb75(0x1af)][_0x22fb75(0x12f)]({'agentName':_0x8b691e['yaml'][_0x22fb75(0x16d)],'action':_0x22fb75(0x195),'agentId':_0x251072['id'],'warnings':_0x7f3ab2[_0x22fb75(0x1b0)]>0x0?_0x7f3ab2:undefined}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1af)][_0x22fb75(0x195)]++;else{const _0x595fe4=await this[_0x22fb75(0x1ac)]['createAgentResponse'](_0x52bd87);_0x39af65['set'](_0x8b691e[_0x22fb75(0x1ce)][_0x22fb75(0x16d)],_0x595fe4['id']),_0x2bc21f[_0x22fb75(0x1af)][_0x22fb75(0x12f)]({'agentName':_0x8b691e['yaml'][_0x22fb75(0x16d)],'action':'created','agentId':_0x595fe4['id'],'warnings':_0x7f3ab2[_0x22fb75(0x1b0)]>0x0?_0x7f3ab2:undefined}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1af)][_0x22fb75(0x120)]++;}}catch(_0x5d2a3c){_0x2bc21f['agents'][_0x22fb75(0x12f)]({'agentName':_0x8b691e['yaml'][_0x22fb75(0x16d)],'action':_0x22fb75(0x1bd),'error':_0x5d2a3c[_0x22fb75(0x1ae)],'warnings':_0x7f3ab2[_0x22fb75(0x1b0)]>0x0?_0x7f3ab2:undefined}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1af)]['errors']++;}}for(const _0xe02afe of _0x53ca58){try{const _0x308e0a=_0x705c13[_0x22fb75(0x104)](_0xe02afe['yaml']['name']),_0x5304eb=await yamlPromptToApi(_0xe02afe[_0x22fb75(0x1ce)],_0x46c61c,_0x2f3546);if(!_0x5304eb){_0x2bc21f[_0x22fb75(0x139)][_0x22fb75(0x12f)]({'name':_0xe02afe[_0x22fb75(0x1ce)][_0x22fb75(0x16d)],'action':_0x22fb75(0x1bd),'error':_0x22fb75(0x13a)}),_0x2bc21f[_0x22fb75(0x194)]['prompts'][_0x22fb75(0x149)]++;continue;}if(_0x308e0a)await this[_0x22fb75(0x1ac)][_0x22fb75(0x14e)](_0x308e0a['id'],_0x5304eb),_0x281569[_0x22fb75(0x19a)](_0xe02afe[_0x22fb75(0x1ce)][_0x22fb75(0x16d)],_0x308e0a['id']),_0x2bc21f[_0x22fb75(0x139)][_0x22fb75(0x12f)]({'name':_0xe02afe['yaml']['name'],'action':_0x22fb75(0x195),'id':_0x308e0a['id']}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x139)]['updated']++;else{const _0x38743a=await this[_0x22fb75(0x1ac)]['createPrompt'](_0x5304eb);_0x281569[_0x22fb75(0x19a)](_0xe02afe[_0x22fb75(0x1ce)][_0x22fb75(0x16d)],_0x38743a['id']),_0x2bc21f[_0x22fb75(0x139)][_0x22fb75(0x12f)]({'name':_0xe02afe[_0x22fb75(0x1ce)][_0x22fb75(0x16d)],'action':_0x22fb75(0x120),'id':_0x38743a['id']}),_0x2bc21f['counts'][_0x22fb75(0x139)][_0x22fb75(0x120)]++;}}catch(_0x4e7cf1){_0x2bc21f[_0x22fb75(0x139)]['push']({'name':_0xe02afe[_0x22fb75(0x1ce)][_0x22fb75(0x16d)],'action':_0x22fb75(0x1bd),'error':_0x4e7cf1[_0x22fb75(0x1ae)]}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x139)]['errors']++;}}for(const _0x1474fd of _0x25d927){try{const _0x1cc9de=_0x56b355[_0x22fb75(0x104)](_0x1474fd['yaml']['service_type']),_0x159e16=await yamlIntegrationToApi(_0x1474fd[_0x22fb75(0x1ce)],_0x46c61c,_0x2f3546);if(_0x1cc9de){await this[_0x22fb75(0x1ac)][_0x22fb75(0x138)](_0x1cc9de['id']);const _0xd974d7=await this[_0x22fb75(0x1ac)][_0x22fb75(0x151)](_0x159e16);_0x2bc21f[_0x22fb75(0x1d4)][_0x22fb75(0x12f)]({'name':_0x1474fd[_0x22fb75(0x1ce)][_0x22fb75(0x141)],'action':_0x22fb75(0x195),'id':_0xd974d7['id']}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1d4)][_0x22fb75(0x195)]++;}else{const _0x4287db=await this['client']['createIntegration'](_0x159e16);_0x2bc21f[_0x22fb75(0x1d4)]['push']({'name':_0x1474fd[_0x22fb75(0x1ce)][_0x22fb75(0x141)],'action':'created','id':_0x4287db['id']}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1d4)][_0x22fb75(0x120)]++;}}catch(_0x25fbbf){_0x2bc21f['integrations'][_0x22fb75(0x12f)]({'name':_0x1474fd[_0x22fb75(0x1ce)]['service_type'],'action':'error','error':_0x25fbbf[_0x22fb75(0x1ae)]}),_0x2bc21f[_0x22fb75(0x194)][_0x22fb75(0x1d4)]['errors']++;}}return _0x2bc21f;}async[a123_0x3243df(0x150)](_0x1e5887,_0x5c5e7e,_0x1dc3f5,_0x17f47b){const _0x4379aa=a123_0x3243df,{projectId:_0x157433,project:_0x2591cd}=await this[_0x4379aa(0x1db)](_0x1e5887),_0x121e6b=_0x2591cd['attributes'][_0x4379aa(0x16d)],_0xd9556=await this[_0x4379aa(0x1ac)][_0x4379aa(0x147)](_0x157433),_0x2f5ef6=_0xd9556[_0x4379aa(0x1c7)](_0x2bb491=>_0x2bb491[_0x4379aa(0xf1)][_0x4379aa(0x16d)]===_0x5c5e7e);if(!_0x2f5ef6)throw new SDKError(ErrorCode[_0x4379aa(0x155)],'Agent\x20not\x20found:\x20'+_0x5c5e7e,undefined,{'helpText':'Available\x20agents:\x20'+_0xd9556[_0x4379aa(0x15b)](_0x3f9996=>_0x3f9996[_0x4379aa(0xf1)]['name'])[_0x4379aa(0x14f)](',\x20')});let _0x3f3a8a;if(_0x1dc3f5)_0x3f3a8a=_0x1dc3f5;else{const _0x215c13=a123_0x48aad4[_0x4379aa(0x14f)](process[_0x4379aa(0x1e4)](),_0x4379aa(0x1af)),_0xf322e6=getSanitizedPathWithMigration(_0x215c13,_0x121e6b);_0xf322e6[_0x4379aa(0xf0)]&&this[_0x4379aa(0x15c)][_0x4379aa(0x196)](_0x4379aa(0x1df)+a123_0x48aad4['basename'](_0xf322e6[_0x4379aa(0xfc)])+_0x4379aa(0x133)+a123_0x48aad4[_0x4379aa(0x13c)](_0xf322e6[_0x4379aa(0xf3)])),_0x3f3a8a=_0xf322e6['path'];}const _0x4e78f0=getSanitizedPathWithMigration(_0x3f3a8a,_0x5c5e7e);_0x4e78f0[_0x4379aa(0xf0)]&&this[_0x4379aa(0x15c)][_0x4379aa(0x196)](_0x4379aa(0xeb)+a123_0x48aad4[_0x4379aa(0x13c)](_0x4e78f0[_0x4379aa(0xfc)])+_0x4379aa(0x133)+a123_0x48aad4['basename'](_0x4e78f0[_0x4379aa(0xf3)]));const _0x59c4c8=_0x4e78f0[_0x4379aa(0xf3)],_0x309464=new Map(),_0x237b3f=new Map(),_0x3d8d4c=await this[_0x4379aa(0x1ac)][_0x4379aa(0x1ee)](_0x157433),_0x4fcd39=await this[_0x4379aa(0x1ac)][_0x4379aa(0x14c)](_0x157433),_0x346197=await safeListOrEmpty(()=>this[_0x4379aa(0x1ac)][_0x4379aa(0x1f0)](_0x157433)),_0x5f132b=new Map(),_0x81dae2=new Map();for(const _0x38091c of _0x3d8d4c){_0x309464[_0x4379aa(0x19a)](_0x38091c['id'],_0x38091c[_0x4379aa(0xf1)]['name']);}for(const _0x4cca95 of _0x4fcd39){_0x5f132b['set'](_0x4cca95['id'],_0x4cca95['attributes'][_0x4379aa(0x16d)]);}for(const _0x2a01c2 of _0x346197){_0x81dae2[_0x4379aa(0x19a)](_0x2a01c2['id'],_0x2a01c2[_0x4379aa(0xf1)][_0x4379aa(0x16d)]);}for(const _0x50c9bd of _0xd9556){_0x237b3f[_0x4379aa(0x19a)](_0x50c9bd['id'],_0x50c9bd[_0x4379aa(0xf1)][_0x4379aa(0x16d)]);}const _0x160fe3={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x309464,'TextKnowledgeBase':_0x5f132b,'Agent':_0x237b3f,'ExperimentalKnowledgeBase':_0x81dae2}),'resolvePromptName':async()=>undefined,'onWarning':_0xd397e7=>this[_0x4379aa(0x15c)][_0x4379aa(0x10a)](_0xd397e7)},_0x4e2df1=a123_0x48aad4[_0x4379aa(0x14f)](_0x59c4c8,_0x4379aa(0x190)),_0x84cfda=a123_0x48aad4[_0x4379aa(0x14f)](_0x59c4c8,_0x4379aa(0x153)),_0x4e9620=a123_0x48aad4[_0x4379aa(0x14f)](_0x59c4c8,_0x4379aa(0x152)),_0x2edca8=!a123_0x2527de[_0x4379aa(0x140)](_0x84cfda);if(_0x17f47b?.['dryRun'])return{'agentName':_0x5c5e7e,'outputPath':_0x59c4c8,'isNew':_0x2edca8,'hasChanges':!![]};a123_0x2527de[_0x4379aa(0x145)](_0x3f3a8a,{'recursive':!![]}),a123_0x2527de[_0x4379aa(0x145)](_0x59c4c8,{'recursive':!![]});const _0x459f86=a123_0x48aad4[_0x4379aa(0x14f)](_0x3f3a8a,_0x4379aa(0x1e0));!a123_0x2527de['existsSync'](_0x459f86)&&a123_0x2527de['writeFileSync'](_0x459f86,createAgentConfigContent(_0x1e5887));const {yaml:_0x4fe792,systemPrompt:_0x397e6a,starterMessage:_0x3ecbac}=await agentResponseToDef(_0x2f5ef6,_0x160fe3);let _0x912ec8=_0x2edca8;if(!_0x2edca8){const _0x5de968=a123_0x2527de[_0x4379aa(0x140)](_0x4e2df1)?a123_0x2527de[_0x4379aa(0x101)](_0x4e2df1,_0x4379aa(0x168)):'',_0xf47524=a123_0x2527de[_0x4379aa(0x101)](_0x84cfda,'utf-8');_0x912ec8=_0x5de968!==_0x397e6a||_0xf47524!==toAgentYamlString(_0x4fe792);}a123_0x2527de['writeFileSync'](_0x4e2df1,_0x397e6a),a123_0x2527de['writeFileSync'](_0x84cfda,toAgentYamlString(_0x4fe792));if(_0x3ecbac&&_0x3ecbac[_0x4379aa(0x148)]('\x0a'))a123_0x2527de[_0x4379aa(0x12d)](_0x4e9620,_0x3ecbac);else a123_0x2527de['existsSync'](_0x4e9620)&&a123_0x2527de['unlinkSync'](_0x4e9620);return{'agentName':_0x5c5e7e,'outputPath':_0x59c4c8,'isNew':_0x2edca8,'hasChanges':_0x912ec8};}async[a123_0x3243df(0x12b)](_0xb3b13d,_0x140219){const _0x39f930=a123_0x3243df;let _0x3b476b;isAgentYamlPath(_0xb3b13d)?_0x3b476b=getAgentDirFromYamlPath(_0xb3b13d):_0x3b476b=_0xb3b13d;const {config:_0x53ead9}=findAgentConfig(_0x3b476b),_0x3f7026=await this[_0x39f930(0x100)](_0x53ead9[_0x39f930(0x1e7)]),_0x39cb8a=a123_0x48aad4[_0x39f930(0x14f)](_0x3b476b,_0x39f930(0x153)),_0x5e3bed=a123_0x48aad4[_0x39f930(0x14f)](_0x3b476b,_0x39f930(0x190)),_0x2071f1=a123_0x48aad4[_0x39f930(0x14f)](_0x3b476b,_0x39f930(0x152));if(!a123_0x2527de['existsSync'](_0x39cb8a))throw new SDKError(ErrorCode[_0x39f930(0x107)],_0x39f930(0x11f)+_0x3b476b,undefined,{'helpText':_0x39f930(0x1e2)});const _0x22a3b0=parseAgentYaml(a123_0x2527de[_0x39f930(0x101)](_0x39cb8a,_0x39f930(0x168)),_0x39cb8a),_0x4f0e5f=a123_0x2527de['existsSync'](_0x5e3bed)?a123_0x2527de[_0x39f930(0x101)](_0x5e3bed,'utf-8'):'',_0x1e4ca5=a123_0x2527de[_0x39f930(0x140)](_0x2071f1)?a123_0x2527de[_0x39f930(0x101)](_0x2071f1,_0x39f930(0x168)):_0x22a3b0[_0x39f930(0x1a6)];if(_0x140219?.[_0x39f930(0x16c)])return{'agentName':_0x22a3b0[_0x39f930(0x16d)],'action':_0x39f930(0x120),'projectId':_0x3f7026};const _0xa353ed=await this[_0x39f930(0x1ac)][_0x39f930(0x147)](_0x3f7026),_0x3a9385=await fetchAllToolTargetMaps((_0x287283,_0x559af3)=>this[_0x39f930(0x1ac)][_0x39f930(0x1c8)](_0x287283,_0x559af3),_0x3f7026),_0x2dde60=new Map();for(const _0x211ea7 of _0xa353ed){_0x2dde60[_0x39f930(0x19a)](_0x211ea7[_0x39f930(0xf1)]['name'],_0x211ea7['id']);}const _0x2f3174=[],_0x2e206b={'projectId':_0x3f7026,'resolveToolTargetId':buildIdResolver({..._0x3a9385['nameToId'],'Agent':_0x2dde60}),'resolvePromptId':async()=>undefined,'onWarning':_0x3e2283=>{const _0x472116=_0x39f930;this['logger']['warn'](_0x3e2283),_0x2f3174[_0x472116(0x12f)](_0x3e2283);}};try{const _0x57b8a1=_0xa353ed[_0x39f930(0x1c7)](_0x21ee90=>_0x21ee90['attributes']['name']===_0x22a3b0[_0x39f930(0x16d)]),_0x22c58f=await agentDefToRequest(_0x22a3b0,_0x4f0e5f,_0x1e4ca5,_0x2e206b);if(_0x57b8a1)return await this['client'][_0x39f930(0x115)](_0x57b8a1['id'],_0x22c58f),{'agentName':_0x22a3b0['name'],'action':_0x39f930(0x195),'projectId':_0x3f7026,'agentId':_0x57b8a1['id'],'warnings':_0x2f3174['length']>0x0?_0x2f3174:undefined};else{const _0x2d2252=await this['client'][_0x39f930(0x1dc)](_0x22c58f);return{'agentName':_0x22a3b0[_0x39f930(0x16d)],'action':_0x39f930(0x120),'projectId':_0x3f7026,'agentId':_0x2d2252['id'],'warnings':_0x2f3174['length']>0x0?_0x2f3174:undefined};}}catch(_0x1fddcf){return{'agentName':_0x22a3b0[_0x39f930(0x16d)],'action':_0x39f930(0x1bd),'projectId':_0x3f7026,'error':_0x1fddcf[_0x39f930(0x1ae)],'warnings':_0x2f3174['length']>0x0?_0x2f3174:undefined};}}async[a123_0x3243df(0x11a)](_0x381728,_0x5e8495,_0x1e7a04){const _0x52ffcd=a123_0x3243df,_0x331175=a123_0x2527de[_0x52ffcd(0x140)](_0x381728)&&a123_0x2527de['existsSync'](a123_0x48aad4[_0x52ffcd(0x14f)](_0x381728,_0x52ffcd(0x1e0)));let _0x29226b;const _0x25a806=[],_0x3fa3eb=[],_0x144256=[],_0x52718f=[],_0x46ba00=[],_0x49628b=[],_0x1657b9=[];if(_0x331175){const _0x5256fa=loadAgentConfig(a123_0x48aad4[_0x52ffcd(0x14f)](_0x381728,_0x52ffcd(0x1e0)));_0x29226b=_0x5256fa[_0x52ffcd(0x1e7)];const _0x4a21c5=a123_0x2527de[_0x52ffcd(0x18d)](_0x381728,{'withFileTypes':!![]});for(const _0x1f2455 of _0x4a21c5){if(!_0x1f2455[_0x52ffcd(0x1b4)]())continue;if([_0x52ffcd(0x176),_0x52ffcd(0xf7),_0x52ffcd(0xe2),_0x52ffcd(0x139),_0x52ffcd(0x1d4)][_0x52ffcd(0x148)](_0x1f2455[_0x52ffcd(0x16d)]))continue;const _0x35f088=a123_0x48aad4[_0x52ffcd(0x14f)](_0x381728,_0x1f2455[_0x52ffcd(0x16d)]);if(isAgentDir(_0x35f088)){const _0x3b7137=a123_0x48aad4[_0x52ffcd(0x14f)](_0x35f088,_0x52ffcd(0x153)),_0x50709=a123_0x48aad4[_0x52ffcd(0x14f)](_0x35f088,_0x52ffcd(0x190)),_0x2f3869=a123_0x48aad4[_0x52ffcd(0x14f)](_0x35f088,_0x52ffcd(0x152)),_0x3a65bc=parseAgentYaml(a123_0x2527de[_0x52ffcd(0x101)](_0x3b7137,_0x52ffcd(0x168)),_0x3b7137),_0x2423dd=a123_0x2527de[_0x52ffcd(0x140)](_0x50709)?a123_0x2527de[_0x52ffcd(0x101)](_0x50709,'utf-8'):'',_0xac5406=a123_0x2527de[_0x52ffcd(0x140)](_0x2f3869)?a123_0x2527de[_0x52ffcd(0x101)](_0x2f3869,'utf-8'):_0x3a65bc['starter_message'];_0x25a806[_0x52ffcd(0x12f)]({'name':_0x3a65bc['name'],'dir':_0x35f088,'yaml':_0x3a65bc,'systemPrompt':_0x2423dd,'starterMessage':_0xac5406});}}const _0x1a8370=getKnowledgeBasesDir(_0x381728);if(a123_0x2527de[_0x52ffcd(0x140)](_0x1a8370)){const _0xba7958=a123_0x2527de['readdirSync'](_0x1a8370);for(const _0x4d2fc6 of _0xba7958){const _0x24729c=a123_0x48aad4[_0x52ffcd(0x14f)](_0x1a8370,_0x4d2fc6);if(_0x4d2fc6['endsWith'](_0x52ffcd(0x1f7))){const _0x52dab4=parseKnowledgeBaseYaml(a123_0x2527de[_0x52ffcd(0x101)](_0x24729c,_0x52ffcd(0x168)),_0x24729c);_0x3fa3eb[_0x52ffcd(0x12f)]({'name':_0x52dab4[_0x52ffcd(0x16d)],'path':_0x24729c,'yaml':_0x52dab4});}else{if(_0x4d2fc6[_0x52ffcd(0xff)](_0x52ffcd(0x186))){const _0x4242c6=a123_0x2527de[_0x52ffcd(0x101)](_0x24729c,_0x52ffcd(0x168)),{name:_0x6c52ba,text:_0x1122a7}=parseTextKnowledgeBaseMd(_0x4242c6,_0x4d2fc6);_0x144256[_0x52ffcd(0x12f)]({'name':_0x6c52ba,'path':_0x24729c,'text':_0x1122a7});}}}}const _0x4fa507=getPromptsDir(_0x381728);if(a123_0x2527de['existsSync'](_0x4fa507)){const _0x5443e6=a123_0x2527de[_0x52ffcd(0x18d)](_0x4fa507)[_0x52ffcd(0x117)](_0x7b7533=>_0x7b7533[_0x52ffcd(0xff)](_0x52ffcd(0x1f7)));for(const _0x233153 of _0x5443e6){const _0x359022=a123_0x48aad4[_0x52ffcd(0x14f)](_0x4fa507,_0x233153),_0xff7d36=parsePromptYaml(a123_0x2527de[_0x52ffcd(0x101)](_0x359022,_0x52ffcd(0x168)),_0x359022);_0x52718f[_0x52ffcd(0x12f)]({'name':_0xff7d36[_0x52ffcd(0x16d)],'path':_0x359022,'yaml':_0xff7d36});}}const _0x1de1a7=getIntegrationsDir(_0x381728);if(a123_0x2527de['existsSync'](_0x1de1a7)){const _0x4e46d3=a123_0x2527de[_0x52ffcd(0x18d)](_0x1de1a7)[_0x52ffcd(0x117)](_0x318f0b=>_0x318f0b['endsWith'](_0x52ffcd(0x1f7)));for(const _0x503b02 of _0x4e46d3){const _0xa15723=a123_0x48aad4['join'](_0x1de1a7,_0x503b02),_0x2bcdc7=parseIntegrationYaml(a123_0x2527de[_0x52ffcd(0x101)](_0xa15723,'utf-8'),_0xa15723);SAFE_INTEGRATION_TYPES[_0x52ffcd(0x148)](_0x2bcdc7[_0x52ffcd(0x141)][_0x52ffcd(0x1b3)]())?_0x46ba00[_0x52ffcd(0x12f)]({'name':_0x2bcdc7[_0x52ffcd(0x16d)],'path':_0xa15723,'yaml':_0x2bcdc7}):this[_0x52ffcd(0x15c)][_0x52ffcd(0x10a)]('Skipping\x20integration\x20\x27'+_0x2bcdc7['name']+_0x52ffcd(0x1f1)+_0x2bcdc7[_0x52ffcd(0x141)]+_0x52ffcd(0x160)+(_0x52ffcd(0x1aa)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x52ffcd(0x1b9)));}}const _0x54eb17=getExperimentalKnowledgeBasesDir(_0x381728);if(a123_0x2527de[_0x52ffcd(0x140)](_0x54eb17)){const _0x3026dd=a123_0x2527de[_0x52ffcd(0x18d)](_0x54eb17,{'withFileTypes':!![]});for(const _0x23a01a of _0x3026dd){if(!_0x23a01a[_0x52ffcd(0x1b4)]())continue;const _0x5000a8=a123_0x48aad4[_0x52ffcd(0x14f)](_0x54eb17,_0x23a01a[_0x52ffcd(0x16d)]),_0x4a73f0=a123_0x48aad4['join'](_0x5000a8,_0x23a01a[_0x52ffcd(0x16d)]+_0x52ffcd(0x1f7));if(a123_0x2527de[_0x52ffcd(0x140)](_0x4a73f0)){const _0x410f70=parseExperimentalKnowledgeBaseYaml(a123_0x2527de[_0x52ffcd(0x101)](_0x4a73f0,_0x52ffcd(0x168)),_0x4a73f0),_0x551307=a123_0x48aad4['join'](_0x5000a8,_0x52ffcd(0x1ed)),_0x45e0da=[];if(a123_0x2527de[_0x52ffcd(0x140)](_0x551307)){const _0x4e388a=a123_0x2527de[_0x52ffcd(0x18d)](_0x551307,{'withFileTypes':!![]});for(const _0x121812 of _0x4e388a){if(!_0x121812[_0x52ffcd(0x1b4)]())continue;const _0x5b4526=a123_0x48aad4[_0x52ffcd(0x14f)](_0x551307,_0x121812[_0x52ffcd(0x16d)]),_0x144e60=a123_0x48aad4[_0x52ffcd(0x14f)](_0x5b4526,_0x52ffcd(0x1a7)),_0x4fa435=a123_0x48aad4[_0x52ffcd(0x14f)](_0x5b4526,_0x52ffcd(0x1e6));if(a123_0x2527de[_0x52ffcd(0x140)](_0x144e60)&&a123_0x2527de[_0x52ffcd(0x140)](_0x4fa435)){const _0x11957f=a123_0x2527de[_0x52ffcd(0x101)](_0x144e60,_0x52ffcd(0x168)),_0x3255c9=a123_0x2527de[_0x52ffcd(0x101)](_0x4fa435,_0x52ffcd(0x168));_0x45e0da['push']({'name':_0x121812[_0x52ffcd(0x16d)],'code':_0x11957f,'json_schema':_0x3255c9});}}}const _0xcf84e1={..._0x410f70,'functions':_0x45e0da};_0x49628b[_0x52ffcd(0x12f)]({'name':_0x410f70[_0x52ffcd(0x16d)],'path':_0x5000a8,'def':_0xcf84e1});}}}const _0x536ba0=getExperimentalArtifactsDir(_0x381728);if(a123_0x2527de[_0x52ffcd(0x140)](_0x536ba0)){const _0x25df3d=a123_0x2527de['readdirSync'](_0x536ba0,{'withFileTypes':!![]});for(const _0x22f77e of _0x25df3d){if(!_0x22f77e['isDirectory']())continue;const _0x4f5f62=a123_0x48aad4['join'](_0x536ba0,_0x22f77e[_0x52ffcd(0x16d)]),_0x5d27ce=a123_0x48aad4['join'](_0x4f5f62,_0x22f77e[_0x52ffcd(0x16d)]+_0x52ffcd(0x1f7));if(a123_0x2527de[_0x52ffcd(0x140)](_0x5d27ce)){const _0x5e248a=parseExperimentalArtifactYaml(a123_0x2527de[_0x52ffcd(0x101)](_0x5d27ce,'utf-8'),_0x5d27ce),_0x5d79d1=a123_0x48aad4[_0x52ffcd(0x14f)](_0x4f5f62,_0x52ffcd(0x1a7)),_0x2da3a9=a123_0x2527de['existsSync'](_0x5d79d1)?a123_0x2527de['readFileSync'](_0x5d79d1,'utf-8'):'',_0x59720e=a123_0x48aad4[_0x52ffcd(0x14f)](_0x4f5f62,_0x52ffcd(0x1cf)),_0x32a5a2=[];if(a123_0x2527de['existsSync'](_0x59720e)){const _0x28cb6f=a123_0x2527de['readdirSync'](_0x59720e);for(const _0x3e9703 of _0x28cb6f){const _0x475fed=a123_0x48aad4[_0x52ffcd(0x14f)](_0x59720e,_0x3e9703);if(a123_0x2527de[_0x52ffcd(0x1a0)](_0x475fed)['isFile']()){const _0xd6ab69=a123_0x2527de['readFileSync'](_0x475fed,_0x52ffcd(0x168));_0x32a5a2['push']({'file_name':_0x3e9703,'text_content':_0xd6ab69});}}}const _0x3555ac={..._0x5e248a,'code':_0x2da3a9,'files':_0x32a5a2};_0x1657b9[_0x52ffcd(0x12f)]({'name':_0x5e248a[_0x52ffcd(0x16d)],'path':_0x4f5f62,'def':_0x3555ac});}}}}else{const _0xa9ce38=await this[_0x52ffcd(0x100)](_0x381728),_0x35d848=await this['client']['getProject'](_0xa9ce38);_0x29226b=_0x35d848[_0x52ffcd(0xf1)][_0x52ffcd(0x16d)];const _0x306329=await this[_0x52ffcd(0x1ac)][_0x52ffcd(0x147)](_0xa9ce38),_0x450373=await this[_0x52ffcd(0x1ac)][_0x52ffcd(0x1ee)](_0xa9ce38),_0xc32bb0=await this[_0x52ffcd(0x1ac)][_0x52ffcd(0x14c)](_0xa9ce38),_0x10e3bd=await this[_0x52ffcd(0x1ac)][_0x52ffcd(0x10c)](_0xa9ce38),_0x2dd35d=await this[_0x52ffcd(0x1ac)]['listIntegrations'](_0xa9ce38),_0x4aec49=await safeListOrEmpty(()=>this['client'][_0x52ffcd(0x1f0)](_0xa9ce38)),_0x1e51eb=await safeListOrEmpty(()=>this[_0x52ffcd(0x1ac)]['listExperimentalArtifacts'](_0xa9ce38)),_0x1ac330=new Map(),_0x4b4975=new Map(),_0x4cc5bf=new Map(),_0x57dea8=new Map(),_0x33a132=new Map(),_0x5b89fe=new Map();for(const _0x3c7fed of _0x450373){_0x1ac330['set'](_0x3c7fed['id'],_0x3c7fed['attributes'][_0x52ffcd(0x16d)]);}for(const _0xe6819a of _0xc32bb0){_0x4b4975['set'](_0xe6819a['id'],_0xe6819a[_0x52ffcd(0xf1)]['name']);}for(const _0x46ed19 of _0x306329){_0x4cc5bf[_0x52ffcd(0x19a)](_0x46ed19['id'],_0x46ed19['attributes'][_0x52ffcd(0x16d)]);}for(const _0x2ad63c of _0x10e3bd){_0x57dea8[_0x52ffcd(0x19a)](_0x2ad63c['id'],_0x2ad63c['attributes'][_0x52ffcd(0x16d)]);}for(const _0x233c16 of _0x4aec49){_0x33a132['set'](_0x233c16['id'],_0x233c16[_0x52ffcd(0xf1)][_0x52ffcd(0x16d)]);}for(const _0x18d016 of _0x1e51eb){_0x5b89fe['set'](_0x18d016['id'],_0x18d016[_0x52ffcd(0xf1)][_0x52ffcd(0x16d)]);}const _0x95018e={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x1ac330,'TextKnowledgeBase':_0x4b4975,'Agent':_0x4cc5bf,'ExperimentalKnowledgeBase':_0x33a132}),'resolvePromptName':async _0x53eca9=>_0x57dea8[_0x52ffcd(0x104)](_0x53eca9),'onWarning':_0x50e102=>this[_0x52ffcd(0x15c)][_0x52ffcd(0x10a)](_0x50e102)};for(const _0x57e06e of _0x306329){const _0x5da9ea=await agentResponseToDef(_0x57e06e,_0x95018e),{yaml:_0x1ed1dc,systemPrompt:_0x16e71b,starterMessage:_0x1e3ee2}=_0x5da9ea;_0x25a806[_0x52ffcd(0x12f)]({'name':_0x1ed1dc['name'],'dir':'','yaml':_0x1ed1dc,'systemPrompt':_0x16e71b,'starterMessage':_0x1e3ee2});}for(const _0xc8140c of _0x450373){const _0x5434cc=apiKnowledgeBaseToYaml(_0xc8140c);_0x3fa3eb[_0x52ffcd(0x12f)]({'name':_0x5434cc[_0x52ffcd(0x16d)],'path':'','yaml':_0x5434cc});}for(const _0x4b7342 of _0xc32bb0){_0x144256[_0x52ffcd(0x12f)]({'name':_0x4b7342[_0x52ffcd(0xf1)]['name'],'path':'','text':_0x4b7342[_0x52ffcd(0xf1)][_0x52ffcd(0x1b6)]});}for(const _0x1098c6 of _0x10e3bd){const _0x9cb5e7=await apiPromptToYaml(_0x1098c6,_0x95018e);_0x9cb5e7&&_0x52718f[_0x52ffcd(0x12f)]({'name':_0x9cb5e7[_0x52ffcd(0x16d)],'path':'','yaml':_0x9cb5e7});}for(const _0x35b3d3 of _0x2dd35d){if(!_0x35b3d3[_0x52ffcd(0xf1)][_0x52ffcd(0x134)]&&SAFE_INTEGRATION_TYPES[_0x52ffcd(0x148)](_0x35b3d3[_0x52ffcd(0xf1)][_0x52ffcd(0x184)]['toLowerCase']())){const _0xe05e03=await apiIntegrationToYaml(_0x35b3d3,_0x95018e);_0x46ba00[_0x52ffcd(0x12f)]({'name':_0x35b3d3[_0x52ffcd(0xf1)][_0x52ffcd(0x184)][_0x52ffcd(0x1b3)](),'path':'','yaml':_0xe05e03});}}for(const _0x307fb1 of _0x4aec49){const _0x341421=apiExperimentalKnowledgeBaseToYaml(_0x307fb1);_0x49628b['push']({'name':_0x341421[_0x52ffcd(0x16d)],'path':'','def':_0x341421});}for(const _0x246e5b of _0x1e51eb){const _0x59a14f=apiExperimentalArtifactToYaml(_0x246e5b);_0x1657b9['push']({'name':_0x59a14f[_0x52ffcd(0x16d)],'path':'','def':_0x59a14f});}}const _0x1c3ee8={'sourceProjectName':_0x29226b,'newProjectName':_0x5e8495,'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}}},_0x41f768=await this['client'][_0x52ffcd(0xea)](),_0x233f8b=_0x41f768[_0x52ffcd(0x1c7)](_0x79d36e=>_0x79d36e['attributes'][_0x52ffcd(0x16d)]===_0x5e8495);if(_0x233f8b)throw new SDKError(ErrorCode['ALREADY_EXISTS'],'Project\x20\x22'+_0x5e8495+_0x52ffcd(0x116),undefined,{'helpText':_0x52ffcd(0x162)});if(_0x1e7a04?.[_0x52ffcd(0x16c)])return _0x1c3ee8[_0x52ffcd(0x194)][_0x52ffcd(0x1af)][_0x52ffcd(0x120)]=_0x25a806['length'],_0x1c3ee8[_0x52ffcd(0x194)][_0x52ffcd(0x156)]['created']=_0x3fa3eb[_0x52ffcd(0x1b0)],_0x1c3ee8[_0x52ffcd(0x194)][_0x52ffcd(0x1f5)][_0x52ffcd(0x120)]=_0x144256[_0x52ffcd(0x1b0)],_0x1c3ee8[_0x52ffcd(0x194)]['experimentalKnowledgeBases'][_0x52ffcd(0x120)]=_0x49628b[_0x52ffcd(0x1b0)],_0x1c3ee8['counts'][_0x52ffcd(0x1ba)][_0x52ffcd(0x120)]=_0x1657b9[_0x52ffcd(0x1b0)],_0x1c3ee8[_0x52ffcd(0x194)][_0x52ffcd(0x139)][_0x52ffcd(0x120)]=_0x52718f[_0x52ffcd(0x1b0)],_0x1c3ee8[_0x52ffcd(0x194)]['integrations'][_0x52ffcd(0x120)]=_0x46ba00[_0x52ffcd(0x1b0)],_0x1c3ee8;const _0x1b178a=await this['client'][_0x52ffcd(0x1d8)]({'name':_0x5e8495}),_0x2b90b4=_0x1b178a['id'];_0x1c3ee8[_0x52ffcd(0xf5)]=_0x2b90b4;const _0x33bb16=new Map(),_0x2ab51c=new Map(),_0x39db50=new Map(),_0x819f78=new Map(),_0x154503=new Map(),_0x42f132=new Map(),_0x430865=new Map(),_0x568e80=new Map(),_0xd581c9=new Set(),_0x54779b=new Set();for(const _0x5cbdb2 of _0x25a806){for(const _0x3c5adc of _0x5cbdb2[_0x52ffcd(0x1ce)][_0x52ffcd(0x178)]||[]){if(_0x3c5adc[_0x52ffcd(0x17c)]===_0x52ffcd(0x130)&&_0x3c5adc['target']){const _0x5744b0=parseRef(_0x3c5adc[_0x52ffcd(0x172)]);if(_0x5744b0)_0xd581c9[_0x52ffcd(0x11d)](_0x5744b0[_0x52ffcd(0x16d)]);}else{if(_0x3c5adc[_0x52ffcd(0x17c)]===_0x52ffcd(0x183)&&_0x3c5adc[_0x52ffcd(0x172)]){const _0x12ae5a=parseRef(_0x3c5adc[_0x52ffcd(0x172)]);if(_0x12ae5a)_0x54779b[_0x52ffcd(0x11d)](_0x12ae5a[_0x52ffcd(0x16d)]);}}}}for(const _0x56de20 of _0xd581c9){try{const _0x4b486d=await this[_0x52ffcd(0x1ac)][_0x52ffcd(0x1fb)]({'projectId':_0x2b90b4,'name':_0x56de20});_0x154503['set'](_0x56de20,_0x4b486d['id']),_0x1c3ee8[_0x52ffcd(0x13f)][_0x52ffcd(0x12f)]({'name':_0x56de20,'action':_0x52ffcd(0x120),'id':_0x4b486d['id']}),_0x1c3ee8[_0x52ffcd(0x194)][_0x52ffcd(0x13f)][_0x52ffcd(0x120)]++;}catch(_0x4f452e){_0x1c3ee8[_0x52ffcd(0x13f)][_0x52ffcd(0x12f)]({'name':_0x56de20,'action':_0x52ffcd(0x1bd),'error':_0x4f452e['message']}),_0x1c3ee8[_0x52ffcd(0x194)][_0x52ffcd(0x13f)][_0x52ffcd(0x149)]++;}}for(const _0x270d19 of _0x54779b){try{const _0x127c9c=await this[_0x52ffcd(0x1ac)][_0x52ffcd(0x18a)]({'projectId':_0x2b90b4,'name':_0x270d19});_0x42f132[_0x52ffcd(0x19a)](_0x270d19,_0x127c9c['id']),_0x1c3ee8[_0x52ffcd(0x16e)][_0x52ffcd(0x12f)]({'name':_0x270d19,'action':_0x52ffcd(0x120),'id':_0x127c9c['id']}),_0x1c3ee8[_0x52ffcd(0x194)][_0x52ffcd(0x16e)][_0x52ffcd(0x120)]++;}catch(_0x42c199){_0x1c3ee8[_0x52ffcd(0x16e)]['push']({'name':_0x270d19,'action':_0x52ffcd(0x1bd),'error':_0x42c199[_0x52ffcd(0x1ae)]}),_0x1c3ee8['counts'][_0x52ffcd(0x16e)][_0x52ffcd(0x149)]++;}}const _0x22344f=await fetchAllToolTargetMaps((_0x5554ad,_0x3dec5f)=>this[_0x52ffcd(0x1ac)][_0x52ffcd(0x1c8)](_0x5554ad,_0x3dec5f),_0x2b90b4);let _0x1079b4=[];const _0x4a2116={'projectId':_0x2b90b4,'resolveToolTargetId':buildIdResolver({..._0x22344f[_0x52ffcd(0x1be)],'KnowledgeBase':_0x33bb16,'TextKnowledgeBase':_0x2ab51c,'ExperimentalKnowledgeBase':_0x430865,'Agent':_0x39db50,'WebSearchTool':_0x42f132,'ImageGenerator':_0x154503}),'resolvePromptId':async _0x5d92ef=>_0x819f78['get'](_0x5d92ef),'onWarning':_0x30e8af=>{const _0x329723=_0x52ffcd;this['logger'][_0x329723(0x10a)](_0x30e8af),_0x1079b4[_0x329723(0x12f)](_0x30e8af);}};for(const _0x36f5a3 of _0x3fa3eb){try{const _0xbcd779=yamlKnowledgeBaseToApi(_0x36f5a3['yaml'],_0x2b90b4),_0x55113d=await this[_0x52ffcd(0x1ac)][_0x52ffcd(0xfb)](_0xbcd779);_0x33bb16[_0x52ffcd(0x19a)](_0x36f5a3['yaml'][_0x52ffcd(0x16d)],_0x55113d['id']),_0x1c3ee8[_0x52ffcd(0x156)][_0x52ffcd(0x12f)]({'name':_0x36f5a3[_0x52ffcd(0x1ce)][_0x52ffcd(0x16d)],'action':_0x52ffcd(0x120),'id':_0x55113d['id']}),_0x1c3ee8['counts'][_0x52ffcd(0x156)][_0x52ffcd(0x120)]++;}catch(_0x57f770){_0x1c3ee8['knowledgeBases']['push']({'name':_0x36f5a3['yaml'][_0x52ffcd(0x16d)],'action':_0x52ffcd(0x1bd),'error':_0x57f770[_0x52ffcd(0x1ae)]}),_0x1c3ee8[_0x52ffcd(0x194)][_0x52ffcd(0x156)][_0x52ffcd(0x149)]++;}}for(const _0x4624dc of _0x144256){try{const _0x36e85d=yamlTextKnowledgeBaseToApi({'name':_0x4624dc['name'],'text':_0x4624dc[_0x52ffcd(0x1b6)]},_0x2b90b4),_0x47aebc=await this[_0x52ffcd(0x1ac)][_0x52ffcd(0xec)](_0x36e85d);_0x2ab51c[_0x52ffcd(0x19a)](_0x4624dc[_0x52ffcd(0x16d)],_0x47aebc['id']),_0x1c3ee8[_0x52ffcd(0x1f5)][_0x52ffcd(0x12f)]({'name':_0x4624dc['name'],'action':_0x52ffcd(0x120),'id':_0x47aebc['id']}),_0x1c3ee8[_0x52ffcd(0x194)][_0x52ffcd(0x1f5)][_0x52ffcd(0x120)]++;}catch(_0x20ce41){_0x1c3ee8[_0x52ffcd(0x1f5)][_0x52ffcd(0x12f)]({'name':_0x4624dc[_0x52ffcd(0x16d)],'action':'error','error':_0x20ce41[_0x52ffcd(0x1ae)]}),_0x1c3ee8[_0x52ffcd(0x194)][_0x52ffcd(0x1f5)][_0x52ffcd(0x149)]++;}}for(const _0x1b5718 of _0x1657b9){try{const _0x313908=yamlExperimentalArtifactToApi(_0x1b5718[_0x52ffcd(0x18f)],_0x2b90b4),_0x27cb34=await this[_0x52ffcd(0x1ac)][_0x52ffcd(0x1c4)](_0x313908);_0x568e80[_0x52ffcd(0x19a)](_0x1b5718[_0x52ffcd(0x18f)][_0x52ffcd(0x16d)],_0x27cb34['id']),_0x1c3ee8['experimentalArtifacts'][_0x52ffcd(0x12f)]({'name':_0x1b5718[_0x52ffcd(0x18f)][_0x52ffcd(0x16d)],'action':_0x52ffcd(0x120),'id':_0x27cb34['id']}),_0x1c3ee8[_0x52ffcd(0x194)][_0x52ffcd(0x1ba)][_0x52ffcd(0x120)]++;}catch(_0x22a3ff){_0x1c3ee8['experimentalArtifacts'][_0x52ffcd(0x12f)]({'name':_0x1b5718[_0x52ffcd(0x18f)]['name'],'action':'error','error':_0x22a3ff[_0x52ffcd(0x1ae)]}),_0x1c3ee8[_0x52ffcd(0x194)][_0x52ffcd(0x1ba)]['errors']++;}}for(const _0x238e98 of _0x49628b){try{const _0x4bd82e=yamlExperimentalKnowledgeBaseToApi(_0x238e98[_0x52ffcd(0x18f)],_0x2b90b4),_0x3fae09=await this[_0x52ffcd(0x1ac)]['createExperimentalKnowledgeBase'](_0x4bd82e);_0x430865[_0x52ffcd(0x19a)](_0x238e98[_0x52ffcd(0x18f)][_0x52ffcd(0x16d)],_0x3fae09['id']),_0x1c3ee8[_0x52ffcd(0x13d)][_0x52ffcd(0x12f)]({'name':_0x238e98[_0x52ffcd(0x18f)][_0x52ffcd(0x16d)],'action':_0x52ffcd(0x120),'id':_0x3fae09['id']}),_0x1c3ee8['counts'][_0x52ffcd(0x13d)]['created']++;}catch(_0x1912f5){_0x1c3ee8['experimentalKnowledgeBases'][_0x52ffcd(0x12f)]({'name':_0x238e98[_0x52ffcd(0x18f)][_0x52ffcd(0x16d)],'action':_0x52ffcd(0x1bd),'error':_0x1912f5[_0x52ffcd(0x1ae)]}),_0x1c3ee8['counts'][_0x52ffcd(0x13d)][_0x52ffcd(0x149)]++;}}const _0x1b0179=[..._0x25a806][_0x52ffcd(0x108)]((_0x540fcf,_0x74972c)=>{const _0x4ebd42=_0x52ffcd,_0x2b10cf=_0x540fcf['yaml'][_0x4ebd42(0x178)]?.[_0x4ebd42(0x16a)](_0x41459f=>_0x41459f[_0x4ebd42(0x17c)]===_0x4ebd42(0x124))??![],_0x5b75b1=_0x74972c['yaml'][_0x4ebd42(0x178)]?.['some'](_0xe9e309=>_0xe9e309['type']==='agent')??![];if(_0x2b10cf&&!_0x5b75b1)return 0x1;if(!_0x2b10cf&&_0x5b75b1)return-0x1;return 0x0;});for(const _0x1b1ddd of _0x1b0179){_0x1079b4=[];try{const _0x35bdb6=_0x1b1ddd['yaml'][_0x52ffcd(0x178)]?.[_0x52ffcd(0x117)](_0x2dbea2=>{const _0x2e746b=_0x52ffcd;if(_0x2dbea2[_0x2e746b(0x17c)]===_0x2e746b(0x124)&&_0x2dbea2[_0x2e746b(0x172)]){const _0x3cd4b8=parseRef(_0x2dbea2[_0x2e746b(0x172)]);return _0x3cd4b8?.['name']===_0x1b1ddd[_0x2e746b(0x1ce)][_0x2e746b(0x16d)];}return![];})??[];if(_0x35bdb6[_0x52ffcd(0x1b0)]>0x0){const _0x2ae732=_0x52ffcd(0x1ea)+_0x1b1ddd[_0x52ffcd(0x1ce)][_0x52ffcd(0x16d)]+_0x52ffcd(0x113)+_0x52ffcd(0x103);this[_0x52ffcd(0x15c)]['warn'](_0x2ae732),_0x1079b4[_0x52ffcd(0x12f)](_0x2ae732);}const _0x3a8a0e=await agentDefToRequest(_0x1b1ddd[_0x52ffcd(0x1ce)],_0x1b1ddd['systemPrompt'],_0x1b1ddd[_0x52ffcd(0x158)],_0x4a2116),_0x1117dd=await this[_0x52ffcd(0x1ac)][_0x52ffcd(0x1dc)](_0x3a8a0e);_0x39db50['set'](_0x1b1ddd[_0x52ffcd(0x1ce)]['name'],_0x1117dd['id']),_0x1c3ee8['agents']['push']({'agentName':_0x1b1ddd[_0x52ffcd(0x1ce)][_0x52ffcd(0x16d)],'action':'created','agentId':_0x1117dd['id'],'warnings':_0x1079b4[_0x52ffcd(0x1b0)]>0x0?_0x1079b4:undefined}),_0x1c3ee8[_0x52ffcd(0x194)][_0x52ffcd(0x1af)][_0x52ffcd(0x120)]++;}catch(_0x18e54c){_0x1c3ee8[_0x52ffcd(0x1af)][_0x52ffcd(0x12f)]({'agentName':_0x1b1ddd['yaml'][_0x52ffcd(0x16d)],'action':'error','error':_0x18e54c[_0x52ffcd(0x1ae)],'warnings':_0x1079b4[_0x52ffcd(0x1b0)]>0x0?_0x1079b4:undefined}),_0x1c3ee8[_0x52ffcd(0x194)][_0x52ffcd(0x1af)][_0x52ffcd(0x149)]++;}}for(const _0x399f40 of _0x52718f){try{const _0x585782=await yamlPromptToApi(_0x399f40['yaml'],_0x2b90b4,_0x4a2116);if(!_0x585782){_0x1c3ee8[_0x52ffcd(0x139)][_0x52ffcd(0x12f)]({'name':_0x399f40['yaml']['name'],'action':'error','error':'Agent\x20reference\x20not\x20found'}),_0x1c3ee8[_0x52ffcd(0x194)][_0x52ffcd(0x139)][_0x52ffcd(0x149)]++;continue;}const _0xfc24e1=await this['client']['createPrompt'](_0x585782);_0x819f78[_0x52ffcd(0x19a)](_0x399f40[_0x52ffcd(0x1ce)]['name'],_0xfc24e1['id']),_0x1c3ee8[_0x52ffcd(0x139)][_0x52ffcd(0x12f)]({'name':_0x399f40['yaml']['name'],'action':'created','id':_0xfc24e1['id']}),_0x1c3ee8['counts'][_0x52ffcd(0x139)]['created']++;}catch(_0xd89e85){_0x1c3ee8[_0x52ffcd(0x139)][_0x52ffcd(0x12f)]({'name':_0x399f40[_0x52ffcd(0x1ce)][_0x52ffcd(0x16d)],'action':'error','error':_0xd89e85[_0x52ffcd(0x1ae)]}),_0x1c3ee8[_0x52ffcd(0x194)][_0x52ffcd(0x139)]['errors']++;}}for(const _0x4f81c2 of _0x46ba00){try{const _0x262333=await yamlIntegrationToApi(_0x4f81c2[_0x52ffcd(0x1ce)],_0x2b90b4,_0x4a2116),_0x520a3d=await this[_0x52ffcd(0x1ac)][_0x52ffcd(0x151)](_0x262333);_0x1c3ee8[_0x52ffcd(0x1d4)][_0x52ffcd(0x12f)]({'name':_0x4f81c2['yaml'][_0x52ffcd(0x141)],'action':_0x52ffcd(0x120),'id':_0x520a3d['id']}),_0x1c3ee8['counts'][_0x52ffcd(0x1d4)]['created']++;}catch(_0x5468c1){_0x1c3ee8[_0x52ffcd(0x1d4)][_0x52ffcd(0x12f)]({'name':_0x4f81c2[_0x52ffcd(0x1ce)][_0x52ffcd(0x141)],'action':'error','error':_0x5468c1[_0x52ffcd(0x1ae)]}),_0x1c3ee8[_0x52ffcd(0x194)][_0x52ffcd(0x1d4)][_0x52ffcd(0x149)]++;}}return _0x1c3ee8;}}
@@ -1 +1 @@
1
- function a124_0x311d(){const _0x4501c0=['5503326JJyRdF','map','tools','5391420wdLInx','1.0','9XRaAzm','442670XyNklc','776YjbBhc','has','1138015OiCzlm','targetKnowledgeBaseId','get','10381neVfca','193593ccPJyk','targetAgentId','36AxeCBi','attributes','30743530PrCGXX'];a124_0x311d=function(){return _0x4501c0;};return a124_0x311d();}(function(_0x7316ca,_0xe21b1a){const _0x20cd29=a124_0x58de,_0x12945f=_0x7316ca();while(!![]){try{const _0x2bd282=-parseInt(_0x20cd29(0xdf))/0x1+parseInt(_0x20cd29(0xdc))/0x2+-parseInt(_0x20cd29(0xd1))/0x3*(-parseInt(_0x20cd29(0xd3))/0x4)+-parseInt(_0x20cd29(0xd9))/0x5+-parseInt(_0x20cd29(0xd6))/0x6+parseInt(_0x20cd29(0xd0))/0x7*(-parseInt(_0x20cd29(0xdd))/0x8)+-parseInt(_0x20cd29(0xdb))/0x9*(-parseInt(_0x20cd29(0xd5))/0xa);if(_0x2bd282===_0xe21b1a)break;else _0x12945f['push'](_0x12945f['shift']());}catch(_0x299a5b){_0x12945f['push'](_0x12945f['shift']());}}}(a124_0x311d,0x92438));export function canCreateAgent(_0x323eaa,_0x2f62f1){const _0x33450e=a124_0x58de;for(const _0x1d3e05 of _0x323eaa[_0x33450e(0xd4)][_0x33450e(0xd8)]){if(_0x1d3e05[_0x33450e(0xd2)]&&!_0x2f62f1[_0x33450e(0xde)](_0x1d3e05[_0x33450e(0xd2)]))return![];}return!![];}function a124_0x58de(_0x3fd0f2,_0x1de88f){_0x3fd0f2=_0x3fd0f2-0xce;const _0x311dd0=a124_0x311d();let _0x58def9=_0x311dd0[_0x3fd0f2];return _0x58def9;}export function remapToolIds(_0x118a96,_0x541ae1,_0x57a29f){const _0x1d9a53=a124_0x58de;return _0x118a96[_0x1d9a53(0xd7)](_0x40780f=>({..._0x40780f,'targetKnowledgeBaseId':_0x40780f[_0x1d9a53(0xce)]?_0x541ae1[_0x1d9a53(0xcf)](_0x40780f[_0x1d9a53(0xce)])||_0x40780f[_0x1d9a53(0xce)]:undefined,'targetAgentId':_0x40780f[_0x1d9a53(0xd2)]?_0x57a29f[_0x1d9a53(0xcf)](_0x40780f[_0x1d9a53(0xd2)])||_0x40780f[_0x1d9a53(0xd2)]:undefined}));}export function remapVariableIds(_0x2bbaea,_0x2b32e6){const _0x268bb0=a124_0x58de;return _0x2bbaea[_0x268bb0(0xd7)](_0x36b1eb=>({..._0x36b1eb,'targetKnowledgeBaseId':_0x2b32e6['get'](_0x36b1eb[_0x268bb0(0xce)])||_0x36b1eb['targetKnowledgeBaseId']}));}export function isSupportedBackupVersion(_0x55ad08){const _0x46ebcc=a124_0x58de;return _0x55ad08===_0x46ebcc(0xda);}
1
+ (function(_0x313f4d,_0x548fc9){const _0x40b9d4=a124_0x3d02,_0x3b6ea7=_0x313f4d();while(!![]){try{const _0x26febb=-parseInt(_0x40b9d4(0x9b))/0x1+parseInt(_0x40b9d4(0xa0))/0x2+parseInt(_0x40b9d4(0x9d))/0x3+parseInt(_0x40b9d4(0x96))/0x4+-parseInt(_0x40b9d4(0x92))/0x5*(-parseInt(_0x40b9d4(0x98))/0x6)+parseInt(_0x40b9d4(0x9a))/0x7*(-parseInt(_0x40b9d4(0x95))/0x8)+parseInt(_0x40b9d4(0x93))/0x9*(-parseInt(_0x40b9d4(0x91))/0xa);if(_0x26febb===_0x548fc9)break;else _0x3b6ea7['push'](_0x3b6ea7['shift']());}catch(_0xf3bcd5){_0x3b6ea7['push'](_0x3b6ea7['shift']());}}}(a124_0x2b34,0x33d89));export function canCreateAgent(_0x1eb81b,_0x241611){const _0x508ad9=a124_0x3d02;for(const _0x5ace74 of _0x1eb81b['attributes'][_0x508ad9(0x9c)]){if(_0x5ace74[_0x508ad9(0x9f)]&&!_0x241611[_0x508ad9(0x94)](_0x5ace74[_0x508ad9(0x9f)]))return![];}return!![];}export function remapToolIds(_0x136543,_0x1c1b53,_0x682d11){const _0x55cd01=a124_0x3d02;return _0x136543['map'](_0x2f4827=>({..._0x2f4827,'targetKnowledgeBaseId':_0x2f4827[_0x55cd01(0x97)]?_0x1c1b53[_0x55cd01(0x99)](_0x2f4827[_0x55cd01(0x97)])||_0x2f4827[_0x55cd01(0x97)]:undefined,'targetAgentId':_0x2f4827[_0x55cd01(0x9f)]?_0x682d11['get'](_0x2f4827[_0x55cd01(0x9f)])||_0x2f4827[_0x55cd01(0x9f)]:undefined}));}function a124_0x3d02(_0x169894,_0x3161a2){_0x169894=_0x169894-0x91;const _0x2b3404=a124_0x2b34();let _0x3d0247=_0x2b3404[_0x169894];return _0x3d0247;}export function remapVariableIds(_0x1a9151,_0x34b088){const _0x1f6b79=a124_0x3d02;return _0x1a9151[_0x1f6b79(0xa1)](_0x4c1719=>({..._0x4c1719,'targetKnowledgeBaseId':_0x34b088[_0x1f6b79(0x99)](_0x4c1719[_0x1f6b79(0x97)])||_0x4c1719[_0x1f6b79(0x97)]}));}export function isSupportedBackupVersion(_0x8e7370){const _0x8b0010=a124_0x3d02;return _0x8e7370===_0x8b0010(0x9e);}function a124_0x2b34(){const _0x13f685=['2824256QMuEnU','1289864RDANXR','targetKnowledgeBaseId','4350oxMABE','get','7cxrbDs','113017gxhqOE','tools','964311FbPXNe','1.0','targetAgentId','838192VAcHYC','map','130jgQtam','190ionUqG','285327ydCXVq','has'];a124_0x2b34=function(){return _0x13f685;};return a124_0x2b34();}