@treasuredata/tdx 0.26.4 → 0.26.6

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 (169) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/activations.js +1 -1
  8. package/dist/commands/agent-command.js +1 -1
  9. package/dist/commands/agent-test-command.js +1 -1
  10. package/dist/commands/api-command.js +1 -1
  11. package/dist/commands/auth-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/describe.js +1 -1
  20. package/dist/commands/engage-command.js +1 -1
  21. package/dist/commands/job-command.js +1 -1
  22. package/dist/commands/journey-command.js +1 -1
  23. package/dist/commands/journey-validate-command.js +1 -1
  24. package/dist/commands/llm-command.js +1 -1
  25. package/dist/commands/mcp-command.js +1 -1
  26. package/dist/commands/parent-segment-command.js +1 -1
  27. package/dist/commands/profile-command.js +1 -1
  28. package/dist/commands/profiles-command.js +1 -1
  29. package/dist/commands/query-command.js +1 -1
  30. package/dist/commands/schedule-command.js +1 -1
  31. package/dist/commands/segment-command.js +1 -1
  32. package/dist/commands/segment-create-command.js +1 -1
  33. package/dist/commands/segment-fields-command.js +1 -1
  34. package/dist/commands/segment-pull-command.js +1 -1
  35. package/dist/commands/segment-push-command.js +1 -1
  36. package/dist/commands/segment-update-command.js +1 -1
  37. package/dist/commands/segment-use-command.js +1 -1
  38. package/dist/commands/segment-validate-command.js +1 -1
  39. package/dist/commands/segments.js +1 -1
  40. package/dist/commands/show.js +1 -1
  41. package/dist/commands/status-command.js +1 -1
  42. package/dist/commands/tables.js +1 -1
  43. package/dist/commands/unset-command.js +1 -1
  44. package/dist/commands/use-command.js +1 -1
  45. package/dist/commands/user-command.js +1 -1
  46. package/dist/commands/workflow-command.js +1 -1
  47. package/dist/core/auth.js +1 -1
  48. package/dist/core/command-output.js +1 -1
  49. package/dist/core/config.js +1 -1
  50. package/dist/core/connection-cache.js +1 -1
  51. package/dist/core/constants.js +1 -1
  52. package/dist/core/credential-cache.js +1 -1
  53. package/dist/core/global-context.js +1 -1
  54. package/dist/core/keychain.js +1 -1
  55. package/dist/core/profile.js +1 -1
  56. package/dist/core/project-config.js +1 -1
  57. package/dist/core/session.js +1 -1
  58. package/dist/core/user-cache.js +1 -1
  59. package/dist/core/version.js +1 -1
  60. package/dist/index.js +1 -1
  61. package/dist/mcp/server.js +1 -1
  62. package/dist/mcp/tools/index.js +1 -1
  63. package/dist/mcp/tools/tdx-run.js +1 -1
  64. package/dist/mcp/tools/tdx-search.js +1 -1
  65. package/dist/mcp/utils.js +1 -1
  66. package/dist/proxy/claude-usage-tracker.js +1 -1
  67. package/dist/proxy/passthrough-server.js +1 -1
  68. package/dist/proxy/sse-usage-parser.js +1 -1
  69. package/dist/sdk/agent/agent-config.js +1 -1
  70. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  71. package/dist/sdk/agent/agent-yaml.js +1 -1
  72. package/dist/sdk/agent/test/evaluator.js +1 -1
  73. package/dist/sdk/agent/test/executor.js +1 -1
  74. package/dist/sdk/agent/test/index.js +1 -1
  75. package/dist/sdk/agent/test/output.js +1 -1
  76. package/dist/sdk/agent/test/parser.js +1 -1
  77. package/dist/sdk/api.js +1 -1
  78. package/dist/sdk/client/cdp-api-client.js +1 -1
  79. package/dist/sdk/client/endpoints.js +1 -1
  80. package/dist/sdk/client/engage-api-client.js +1 -1
  81. package/dist/sdk/client/http-client.js +1 -1
  82. package/dist/sdk/client/llm-api-client.js +1 -1
  83. package/dist/sdk/client/rate-limiter.js +1 -1
  84. package/dist/sdk/client/td-api-client.js +1 -1
  85. package/dist/sdk/client/trino-api-client.js +1 -1
  86. package/dist/sdk/client/workflow-client.js +1 -1
  87. package/dist/sdk/connection-validator.js +1 -1
  88. package/dist/sdk/connection.js +1 -1
  89. package/dist/sdk/engage.js +1 -1
  90. package/dist/sdk/errors.js +1 -1
  91. package/dist/sdk/index.js +1 -1
  92. package/dist/sdk/io/index.js +1 -1
  93. package/dist/sdk/io/node-filesystem.js +1 -1
  94. package/dist/sdk/job.js +1 -1
  95. package/dist/sdk/journey.js +1 -1
  96. package/dist/sdk/llm/chat-cache.js +1 -1
  97. package/dist/sdk/llm/index.js +1 -1
  98. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  99. package/dist/sdk/llm/model-factors.js +1 -1
  100. package/dist/sdk/personalization.js +1 -1
  101. package/dist/sdk/query/index.js +1 -1
  102. package/dist/sdk/query/sql-parser.js +1 -1
  103. package/dist/sdk/realtime.js +1 -1
  104. package/dist/sdk/schedule.js +1 -1
  105. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  106. package/dist/sdk/segment/fields-display.js +1 -1
  107. package/dist/sdk/segment/file-discovery.js +1 -1
  108. package/dist/sdk/segment/journey-utils.js +1 -1
  109. package/dist/sdk/segment/journey-validator.js +1 -1
  110. package/dist/sdk/segment/journey-yaml.js +1 -1
  111. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  112. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  113. package/dist/sdk/segment/pull-workflow.js +1 -1
  114. package/dist/sdk/segment/push-recovery.js +1 -1
  115. package/dist/sdk/segment/push-workflow.js +1 -1
  116. package/dist/sdk/segment/resolution-context.js +1 -1
  117. package/dist/sdk/segment/segment-path-parser.js +1 -1
  118. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  119. package/dist/sdk/segment/target-resolution.js +1 -1
  120. package/dist/sdk/segment/tdx-config.js +1 -1
  121. package/dist/sdk/segment/validate-files.js +1 -1
  122. package/dist/sdk/segment/yaml-validator.js +1 -1
  123. package/dist/sdk/segment.js +1 -1
  124. package/dist/sdk/types/index.js +1 -1
  125. package/dist/sdk/types/progress.js +1 -1
  126. package/dist/sdk/user.js +1 -1
  127. package/dist/sdk/util/format-detector.js +1 -1
  128. package/dist/sdk/util/formatters.js +1 -1
  129. package/dist/sdk/util/index.js +1 -1
  130. package/dist/sdk/util/tree-formatter.js +1 -1
  131. package/dist/sdk/workflow/archive-validation.js +1 -1
  132. package/dist/sdk/workflow/clone-workflow.js +1 -1
  133. package/dist/sdk/workflow/index.js +1 -1
  134. package/dist/sdk/workflow/pull-workflow.js +1 -1
  135. package/dist/sdk/workflow/push-workflow.js +1 -1
  136. package/dist/sdk/workflow/tdx-config.js +1 -1
  137. package/dist/sdk/workflow/workflow-utils.js +1 -1
  138. package/dist/test-utils/command-runner.js +1 -1
  139. package/dist/test-utils/factories.js +1 -1
  140. package/dist/test-utils/fixtures.js +1 -1
  141. package/dist/test-utils/http-mock.js +1 -1
  142. package/dist/test-utils/index.js +1 -1
  143. package/dist/utils/async.js +1 -1
  144. package/dist/utils/colors.js +1 -1
  145. package/dist/utils/diff.js +1 -1
  146. package/dist/utils/file-permissions.js +1 -1
  147. package/dist/utils/global-cache.js +1 -1
  148. package/dist/utils/json-loader.js +1 -1
  149. package/dist/utils/local-cache.js +1 -1
  150. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  151. package/dist/utils/logger/formatters/index.js +1 -1
  152. package/dist/utils/logger/handlers/console-handler.js +1 -1
  153. package/dist/utils/logger/handlers/file-handler.js +1 -1
  154. package/dist/utils/logger/handlers/index.js +1 -1
  155. package/dist/utils/logger/handlers/null-handler.js +1 -1
  156. package/dist/utils/logger/index.js +1 -1
  157. package/dist/utils/logger/logger.js +1 -1
  158. package/dist/utils/logger/types.js +1 -1
  159. package/dist/utils/option-validation.js +1 -1
  160. package/dist/utils/port.js +1 -1
  161. package/dist/utils/process.js +1 -1
  162. package/dist/utils/prompt.js +1 -1
  163. package/dist/utils/spinner.js +1 -1
  164. package/dist/utils/sse-parser.js +1 -1
  165. package/dist/utils/string-utils.js +1 -1
  166. package/dist/utils/table-ref-parser.js +1 -1
  167. package/dist/utils/tdx-logger.js +1 -1
  168. package/dist/utils/version-check.js +1 -1
  169. package/package.json +1 -1
@@ -1 +1 @@
1
- const a96_0x8551a0=a96_0x4380;(function(_0x24549e,_0x3597ee){const _0x469ae5=a96_0x4380,_0xc9e1ca=_0x24549e();while(!![]){try{const _0x58de45=-parseInt(_0x469ae5(0x14d))/0x1*(parseInt(_0x469ae5(0x13f))/0x2)+-parseInt(_0x469ae5(0x194))/0x3+-parseInt(_0x469ae5(0x148))/0x4*(parseInt(_0x469ae5(0x113))/0x5)+-parseInt(_0x469ae5(0x12a))/0x6*(-parseInt(_0x469ae5(0x1b0))/0x7)+parseInt(_0x469ae5(0x112))/0x8+parseInt(_0x469ae5(0x1bc))/0x9+parseInt(_0x469ae5(0x131))/0xa;if(_0x58de45===_0x3597ee)break;else _0xc9e1ca['push'](_0xc9e1ca['shift']());}catch(_0x35a9f6){_0xc9e1ca['push'](_0xc9e1ca['shift']());}}}(a96_0x56e9,0x8a309));import{LLMApiClient}from'../client/llm-api-client.js';import*as a96_0x3256d2 from'node:fs';import*as a96_0x43c449 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,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,resolveAgentDependencies}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 a96_0x4380(_0x4d044e,_0x24d419){_0x4d044e=_0x4d044e-0xe3;const _0x56e90a=a96_0x56e9();let _0x438026=_0x56e90a[_0x4d044e];return _0x438026;}function a96_0x56e9(){const _0x4378c8=['Skipping\x20integration\x20\x27','\x0a\x0a#\x20agent.yml\x0a','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','tdx_','272VIAlDF','toLowerCase','reasoningEffort','createImageGenerator','serviceType','llm_project','Output\x20directory\x20already\x20exists:\x20','push','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','381028zjpHtG','INTERNAL','find','currentProjectId','ALREADY_EXISTS','3973omWQYQ','experimentalArtifacts','warn','availableModelNames','listTextKnowledgeBases','imageGenerators','utf-8','chatId','.md','conflict','prompts.json','Removed\x20deleted\x20file:\x20','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','modelType','Multiple\x20projects\x20found\x20with\x20name\x20\x27','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','unchanged','readFileSync','getChatHistory','prompt.md','resolveProjectId','text_content','Backup\x20folder\x20not\x20found:\x20','chats','knowledgeBases','agents','updateAgent','site','\x0a---\x20function:\x20','variables','agent.yml','keys','Unsupported\x20backup\x20version:\x20','Available\x20agents:\x20','isDirectory','attributes','set','integrations.json','experimental_knowledge_bases','exportedFrom','createKnowledgeBase','\x20→\x20','webSearchTools','mkdirSync','deleteIntegration','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','projectId','dryRun','availableModels','getCurrentProject','):\x20','LLM_PROJECT_NOT_FOUND','agentsFull','chat','getParentSegmentKnowledgeBase','deleteAgent','web_search','Renamed\x20prompt\x20file:\x20','Renamed\x20folder:\x20','integrations','agent','chat_generic','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','slackMessageMode','AGENT_NOT_FOUND','description','project.json','message','chatInfo','Renamed\x20experimental\x20KB\x20directory:\x20','3324540oqvJcy','PERMISSION_DENIED','info','has','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','projects','map','getBackupMetadata','isManaged','models','createPrompt','listExperimentalArtifacts','existsSync','listPrompts','chat_parent_segment','resolveAgentId','status','\x0a---\x20schema:\x20','json_schema.json','action','createIntegration','setCurrentProject','starter_message.md','INVALID_ARGUMENT','Agent\x20not\x20found:\x20','filter','Project\x20\x22','logger','2884IFpzWd','.llm','add','starter_message','endsWith','getOrCreateDefaultAgent','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','dir','isDir','systemPrompt','created','signal','1510506bbPCev','loadJsonFile','updateExperimentalArtifact','Unresolved\x20dependencies:\x20','pullAgent',')\x20can\x20be\x20pushed.\x20','.yml','updateExperimentalKnowledgeBase','createExperimentalKnowledgeBase','files','getDefaultProjectName','Renamed\x20text\x20KB\x20file:\x20','deleteProject','Unable\x20to\x20create\x20project\x20after\x20','startChat','none','counts','Invalid\x20agent\x20reference\x20format:\x20','context','code.js','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','updated','projectName','pullProject','medium','service_type','sdk.llm','size','Agent\x20reference\x20not\x20found','readdirSync','promptId','rmSync','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.','\x20attempts\x20due\x20to\x20name\x20conflicts.','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','code','createWebSearchTool','getAgent','\x27\x20(','json_schema','continueChat','listKnowledgeBases','listAgents','split','profile','statSync','length','localeCompare','cloneProject','isFile','---\x20file:\x20','webhookCorsOrigins','1.0','outputs','listIntegrations','listProjects','target','NOT_FOUND','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','Multiple\x20agents\x20found\x20with\x20name\x20\x27','functions','starterMessage','name','setDefaultAgent','tdx_default_','Renamed\x20agent\x20folder:\x20','knowledgebases.json','includes','path','file_name','tdx.json','experimental_artifacts','error','createProject','text','writeFileSync','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','minimal','listImageGenerators','createExperimentalArtifact','listWebSearchTools','(dry-run)','createAgentResponse','Only\x20safe\x20types\x20(','join','renamed','errors','getDefaultAgent','stringify','content','resolveProjectName','new','listChats','pushAgent','---\x20schema:\x20','event','\x22\x20already\x20exists','\x27.\x20This\x20should\x20not\x20happen.','sort','low','parse','some','prompts','tools','dirname','Renamed\x20KB\x20file:\x20','1313368IULoea','25hDYHXG','Project\x20not\x20found:\x20','getOrCreateDefaultProject','#\x20prompt.md\x0a','chatIgnoreManagedActions','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','maxToolIterations','getChatLog','getProject','\x20---\x0a','createAgent','experimentalKnowledgeBases','project','dry-run-','_reasoning_','version','get','agentId','total','listExperimentalKnowledgeBases','listAgentsFull','textKnowledgeBases','type','1860lEoney','cwd','basename','oldPath','\x0a---\x20code\x20---\x0a','knowledge_bases','def','22310930akzyts','updateAgentResponse','claude-4.5-sonnet','yaml','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','createTextKnowledgeBase','agents.json','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','chatWelcomeMessage','client'];a96_0x56e9=function(){return _0x4378c8;};return a96_0x56e9();}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=[a96_0x8551a0(0x18a),'chat_agent_console',a96_0x8551a0(0x1a2)];export class LLMSDK{[a96_0x8551a0(0x14b)];[a96_0x8551a0(0x13a)];['context'];[a96_0x8551a0(0x1af)]=Logger['of'](a96_0x8551a0(0x1d6));constructor(_0x197aab){const _0x162b36=a96_0x8551a0;this[_0x162b36(0x13a)]=new LLMApiClient(_0x197aab),this[_0x162b36(0x1ce)]=_0x197aab;}[a96_0x8551a0(0x1c6)](){const _0xc8d76a=a96_0x8551a0,_0x55ee5d=getSanitizedUsername();return _0xc8d76a(0xe8)+_0x55ee5d;}async[a96_0x8551a0(0x1a9)](_0x4c70d7){const _0x88fdf=a96_0x8551a0,{projectId:_0x405a55}=await this[_0x88fdf(0x102)](_0x4c70d7);this[_0x88fdf(0x14b)]=_0x405a55;}[a96_0x8551a0(0x17e)](){const _0x4e0a55=a96_0x8551a0;return this[_0x4e0a55(0x14b)];}async[a96_0x8551a0(0xe7)](_0x56b1df){const _0x3393a6=a96_0x8551a0,_0x478e0e=this[_0x3393a6(0x1ce)][_0x3393a6(0x1e8)];let _0x1ef4dc,_0x24a6b1;if(_0x56b1df[_0x3393a6(0xeb)]('/')){const _0x1f68de=_0x56b1df[_0x3393a6(0x1e7)]('/');if(_0x1f68de[_0x3393a6(0x1ea)]!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x3393a6(0x1cd)+_0x56b1df,undefined,{'helpText':_0x3393a6(0x198)});const [_0x347239,_0x310f35]=_0x1f68de;_0x1ef4dc=await this[_0x3393a6(0x161)](_0x347239),_0x24a6b1=_0x310f35;}else _0x1ef4dc=this['currentProjectId']||(await this[_0x3393a6(0x115)]())['id'],_0x24a6b1=_0x56b1df;const _0x8e3659=await this[_0x3393a6(0x1a3)](_0x24a6b1,_0x1ef4dc),_0x33d122=await this[_0x3393a6(0x13a)]['getAgent'](_0x8e3659);writeCachedLLMAgent(_0x33d122['attributes'][_0x3393a6(0xe6)],_0x8e3659,_0x1ef4dc,_0x478e0e);}[a96_0x8551a0(0xff)](){const _0x33cc79=this['context']['profile'];return readCachedLLMAgent(_0x33cc79)||undefined;}['clearDefaultAgent'](){const _0x28bd33=a96_0x8551a0,_0x1f53ed=this[_0x28bd33(0x1ce)][_0x28bd33(0x1e8)];clearCachedLLMAgent(_0x1f53ed);}async[a96_0x8551a0(0x19d)](){const _0x113cb1=a96_0x8551a0,_0x37edb0=await this[_0x113cb1(0x13a)]['getUserSettings'](),_0x10434c=[];for(const _0xa2db39 of _0x37edb0[_0x113cb1(0x150)]){const _0x1517b5=_0x37edb0[_0x113cb1(0x17d)][_0xa2db39];_0x1517b5&&_0x10434c[_0x113cb1(0x146)]({'name':_0xa2db39,'displayName':_0x1517b5['displayName']});}return _0x10434c;}async['createProject'](_0x57e425){const _0x490826=a96_0x8551a0;return await this['client'][_0x490826(0xf1)](_0x57e425);}async[a96_0x8551a0(0x1c8)](_0x1111f9){const _0x2bff72=a96_0x8551a0,{projectId:_0x49a4c9}=await this[_0x2bff72(0x102)](_0x1111f9);await this[_0x2bff72(0x13a)][_0x2bff72(0x1c8)](_0x49a4c9);}async[a96_0x8551a0(0x199)](_0x225536=0x32){const _0x564299=a96_0x8551a0;return await this[_0x564299(0x13a)]['listProjects'](_0x225536);}async[a96_0x8551a0(0x115)](_0x49eb40){const _0x24a9f3=a96_0x8551a0,_0x36dae2=_0x49eb40||this[_0x24a9f3(0x1c6)](),_0x436360=this[_0x24a9f3(0x1ce)][_0x24a9f3(0x1e8)];if(!_0x49eb40){const _0x50856b=readCachedLLMProject(_0x436360);if(_0x50856b&&_0x50856b[_0x24a9f3(0xe6)]===_0x36dae2)try{const _0x36ca2b=await this[_0x24a9f3(0x13a)][_0x24a9f3(0x11b)](_0x50856b['id']);if(_0x36ca2b[_0x24a9f3(0x170)][_0x24a9f3(0xe6)]===_0x36dae2)return _0x36ca2b;}catch{}}const _0x564041=await this['client'][_0x24a9f3(0x1f3)](),_0x25a321=_0x564041[_0x24a9f3(0x14a)](_0x503048=>_0x503048['attributes'][_0x24a9f3(0xe6)]===_0x36dae2);if(_0x25a321)return!_0x49eb40&&writeCachedLLMProject(_0x36dae2,_0x25a321['id'],_0x436360),_0x25a321;const _0x2a0c7a=await this[_0x24a9f3(0x13a)][_0x24a9f3(0xf1)]({'name':_0x36dae2,'description':_0x24a9f3(0x159)+getSanitizedUsername()+')'});return!_0x49eb40&&writeCachedLLMProject(_0x36dae2,_0x2a0c7a['id'],_0x436360),_0x2a0c7a;}async[a96_0x8551a0(0x161)](_0x5b7060){const _0x4ec536=a96_0x8551a0,_0x573585=await this[_0x4ec536(0x13a)][_0x4ec536(0x1f3)](),_0x31c783=_0x573585['filter'](_0x5f0b61=>_0x5f0b61[_0x4ec536(0x170)][_0x4ec536(0xe6)]===_0x5b7060);if(_0x31c783['length']===0x0)throw new SDKError(ErrorCode[_0x4ec536(0x180)],_0x4ec536(0x114)+_0x5b7060,undefined,{'helpText':_0x4ec536(0x18b)});if(_0x31c783[_0x4ec536(0x1ea)]>0x1)throw new SDKError(ErrorCode[_0x4ec536(0x149)],_0x4ec536(0x15b)+_0x5b7060+_0x4ec536(0x109));return _0x31c783[0x0]['id'];}async[a96_0x8551a0(0x102)](_0x3acf8d){const _0x3a16a7=a96_0x8551a0,_0x2dd7d9=await this[_0x3a16a7(0x13a)][_0x3a16a7(0x1f3)](),_0x244d5c=_0x2dd7d9[_0x3a16a7(0x14a)](_0x1865af=>_0x1865af[_0x3a16a7(0x170)][_0x3a16a7(0xe6)]===_0x3acf8d);if(_0x244d5c)return{'projectId':_0x244d5c['id'],'project':_0x244d5c};throw new SDKError(ErrorCode[_0x3a16a7(0x180)],'Project\x20not\x20found:\x20'+_0x3acf8d,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async[a96_0x8551a0(0x1b5)](_0x2608d6=a96_0x8551a0(0x133),_0x3fc98a=0x0,_0x3b4fd9){const _0x3f6b6a=a96_0x8551a0,_0x3268ec=0xa;let _0x2e37e0=0x0,_0x2f601a;while(_0x2e37e0<_0x3268ec){try{const _0x5d9580=await this[_0x3f6b6a(0x115)](_0x2f601a),_0x524e08=_0x5d9580['id'],_0x43f627=[_0x3f6b6a(0x1cb),_0x3f6b6a(0xf5),_0x3f6b6a(0x10b),_0x3f6b6a(0x1d4),'high'],_0x51f7a5=_0x3fc98a===0x0?_0x3f6b6a(0x13e)+_0x2608d6:_0x3f6b6a(0x13e)+_0x2608d6+_0x3f6b6a(0x121)+_0x43f627[_0x3fc98a],_0x427391=await this[_0x3f6b6a(0x13a)]['listAgents'](_0x524e08),_0x6bd949=_0x427391[_0x3f6b6a(0x14a)](_0x946c25=>_0x946c25[_0x3f6b6a(0x170)][_0x3f6b6a(0xe6)]===_0x51f7a5);if(_0x6bd949)return _0x6bd949;const _0x158af9=_0x3fc98a>0x0?0x1:_0x3b4fd9;return await this[_0x3f6b6a(0x13a)][_0x3f6b6a(0x11d)]({'name':_0x51f7a5,'projectId':_0x524e08,'modelType':_0x2608d6,'systemPrompt':'','temperature':_0x158af9,'reasoningEffort':_0x3fc98a>0x0?_0x3fc98a:undefined});}catch(_0x5c6d2f){if(_0x5c6d2f instanceof HTTPClientError){const _0x72db04=_0x5c6d2f[_0x3f6b6a(0x1a4)];if(_0x72db04>=0x190&&_0x72db04<0x1f4){if(_0x72db04===0x191)throw new SDKError(ErrorCode['UNAUTHENTICATED'],_0x3f6b6a(0x138),_0x5c6d2f);else{if(_0x72db04===0x193)throw new SDKError(ErrorCode[_0x3f6b6a(0x195)],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x5c6d2f);}throw _0x5c6d2f;}}if(errorContains(_0x5c6d2f,'already\x20exists','duplicate',_0x3f6b6a(0x156))){_0x2e37e0++;if(_0x2e37e0>=_0x3268ec)throw new SDKError(ErrorCode[_0x3f6b6a(0x14c)],_0x3f6b6a(0x1c9)+_0x3268ec+_0x3f6b6a(0x1dd),_0x5c6d2f);const _0x299a03=this[_0x3f6b6a(0x1c6)]();_0x2f601a=_0x299a03+'_'+generateRandomHex();continue;}throw _0x5c6d2f;}}throw new SDKError(ErrorCode['INTERNAL'],_0x3f6b6a(0x118));}async[a96_0x8551a0(0x1a3)](_0x52e00c,_0x281a30){const _0x354e85=a96_0x8551a0,_0x38e92a=_0x281a30||this[_0x354e85(0x14b)],_0x4648a3=await this[_0x354e85(0x13a)][_0x354e85(0x1e6)](_0x38e92a),_0x1698dc=_0x4648a3[_0x354e85(0x1ad)](_0x3d2d59=>_0x3d2d59[_0x354e85(0x170)][_0x354e85(0xe6)]===_0x52e00c);if(_0x1698dc[_0x354e85(0x1ea)]===0x0){const _0x5bd21a=_0x38e92a?'\x20in\x20project\x20'+_0x38e92a:'';throw new SDKError(ErrorCode[_0x354e85(0x18e)],_0x354e85(0x1ac)+_0x52e00c+_0x5bd21a,undefined,{'helpText':_0x38e92a?_0x354e85(0x15c):_0x354e85(0x1dc)});}if(_0x1698dc[_0x354e85(0x1ea)]>0x1)throw new SDKError(ErrorCode[_0x354e85(0x149)],_0x354e85(0xe3)+_0x52e00c+_0x354e85(0x109));return _0x1698dc[0x0]['id'];}async[a96_0x8551a0(0x166)](_0x2c4ab7){const _0x506da4=a96_0x8551a0,_0x198bba=_0x2c4ab7||this['currentProjectId'];return await this['client'][_0x506da4(0x1e6)](_0x198bba);}async[a96_0x8551a0(0x181)](_0x5a230a){const _0x592734=a96_0x8551a0;return await this[_0x592734(0x13a)]['listAgentsFull'](_0x5a230a);}async[a96_0x8551a0(0x189)](_0x2914be){const _0x85469a=a96_0x8551a0;return await this['client'][_0x85469a(0x1e1)](_0x2914be);}async[a96_0x8551a0(0x11d)](_0x34edab){const _0x42a47f=a96_0x8551a0;return await this['client'][_0x42a47f(0x11d)](_0x34edab);}async[a96_0x8551a0(0x167)](_0x318199,_0x570ce3){const _0x5d1101=a96_0x8551a0;return await this[_0x5d1101(0x13a)][_0x5d1101(0x167)](_0x318199,_0x570ce3);}async[a96_0x8551a0(0x184)](_0x59a33e){const _0x1a7e0d=a96_0x8551a0;await this[_0x1a7e0d(0x13a)][_0x1a7e0d(0x184)](_0x59a33e);}async[a96_0x8551a0(0x1ca)](_0x42d0a8){const _0x1f8b90=a96_0x8551a0;return await this[_0x1f8b90(0x13a)][_0x1f8b90(0x1ca)]({'agentId':_0x42d0a8});}async*[a96_0x8551a0(0x182)](_0x2ad199,_0x4ae9a6){const _0x1e9e47=a96_0x8551a0;let _0x113d22=_0x4ae9a6?.[_0x1e9e47(0x154)];const _0x294497=_0x4ae9a6?.[_0x1e9e47(0x124)];if(!_0x113d22){if(!_0x294497)throw new Error(_0x1e9e47(0x1f6));const _0x217d9d=await this[_0x1e9e47(0x13a)][_0x1e9e47(0x1ca)]({'agentId':_0x294497});_0x113d22=_0x217d9d['id'],yield{'type':'metadata','data':{'chatId':_0x113d22,'agentId':_0x294497,'projectId':_0x217d9d[_0x1e9e47(0x170)][_0x1e9e47(0x17b)]}};}for await(const _0x5327a3 of this['client'][_0x1e9e47(0x1e4)](_0x113d22,_0x2ad199,_0x4ae9a6?.[_0x1e9e47(0x1bb)])){yield{'type':_0x1e9e47(0x107),'data':_0x5327a3};}}async[a96_0x8551a0(0x164)](_0x41c2fb=0x32){const _0x179f3b=a96_0x8551a0;return await this[_0x179f3b(0x13a)][_0x179f3b(0x104)](_0x41c2fb);}async['history'](_0x27a812){const _0x4cdc51=a96_0x8551a0;return await this[_0x4cdc51(0x13a)][_0x4cdc51(0x15f)](_0x27a812);}async[a96_0x8551a0(0x11a)](_0xb4508){const _0x622d7a=a96_0x8551a0;return await this[_0x622d7a(0x13a)][_0x622d7a(0x11a)](_0xb4508);}async[a96_0x8551a0(0x192)](_0x16e06f){return await this['client']['getChatInfo'](_0x16e06f);}async['backupProject'](_0x524c3c,_0x24cc6d,_0x4c1f0b){const _0x34bfff=a96_0x8551a0,_0x4b12ec=_0x4c1f0b?.[_0x34bfff(0x17c)]??![],{projectId:_0x58a241,project:_0x578b28}=await this[_0x34bfff(0x102)](_0x524c3c),_0x462494=_0x578b28[_0x34bfff(0x170)][_0x34bfff(0xe6)],_0x38a022=_0x24cc6d||_0x462494+_0x34bfff(0x1b1);if(a96_0x3256d2[_0x34bfff(0x1a0)](_0x38a022)&&!_0x4b12ec)throw new SDKError(ErrorCode[_0x34bfff(0x14c)],_0x34bfff(0x145)+_0x38a022,undefined,{'helpText':_0x34bfff(0x135)});const _0x466ff5=await this['client'][_0x34bfff(0x127)](_0x58a241),_0x54a280=await this[_0x34bfff(0x13a)]['listKnowledgeBases'](_0x58a241),_0x35dd73=await this[_0x34bfff(0x13a)][_0x34bfff(0x1a1)](_0x58a241),_0x377ee2=await this['client']['listIntegrations'](_0x58a241);if(!_0x4b12ec){a96_0x3256d2[_0x34bfff(0x178)](_0x38a022,{'recursive':!![]});const _0xc786a5={'version':_0x34bfff(0x1f0),'exportedAt':new Date()['toISOString'](),'exportedFrom':{'site':this[_0x34bfff(0x1ce)][_0x34bfff(0x168)],'projectId':_0x58a241,'projectName':_0x462494},'project':_0x578b28};a96_0x3256d2[_0x34bfff(0xf3)](a96_0x43c449[_0x34bfff(0xfc)](_0x38a022,'project.json'),JSON[_0x34bfff(0x100)](_0xc786a5,null,0x2)),a96_0x3256d2['writeFileSync'](a96_0x43c449['join'](_0x38a022,_0x34bfff(0x137)),JSON[_0x34bfff(0x100)](_0x466ff5,null,0x2)),a96_0x3256d2[_0x34bfff(0xf3)](a96_0x43c449[_0x34bfff(0xfc)](_0x38a022,_0x34bfff(0xea)),JSON[_0x34bfff(0x100)](_0x54a280,null,0x2)),a96_0x3256d2[_0x34bfff(0xf3)](a96_0x43c449[_0x34bfff(0xfc)](_0x38a022,_0x34bfff(0x157)),JSON[_0x34bfff(0x100)](_0x35dd73,null,0x2)),a96_0x3256d2[_0x34bfff(0xf3)](a96_0x43c449[_0x34bfff(0xfc)](_0x38a022,_0x34bfff(0x172)),JSON[_0x34bfff(0x100)](_0x377ee2,null,0x2));}return{'projectName':_0x462494,'outputDir':_0x38a022,'counts':{'agents':_0x466ff5[_0x34bfff(0x1ea)],'knowledgeBases':_0x54a280[_0x34bfff(0x1ea)],'prompts':_0x35dd73[_0x34bfff(0x1ea)],'integrations':_0x377ee2[_0x34bfff(0x1ea)]}};}async['restoreProject'](_0x4857a5,_0x5c170a){const _0x37f543=a96_0x8551a0,_0x5de5aa=_0x5c170a?.[_0x37f543(0x17c)]??![],_0x2a186c=this[_0x37f543(0x19b)](_0x4857a5),_0x1bbff9=_0x2a186c[_0x37f543(0x174)][_0x37f543(0x168)],_0x85ceb6=this[_0x37f543(0x1ce)][_0x37f543(0x168)],_0x46bb2f=_0x1bbff9!==_0x85ceb6?_0x1bbff9:undefined,_0x271daa=this[_0x37f543(0x1bd)](a96_0x43c449[_0x37f543(0xfc)](_0x4857a5,_0x37f543(0x137)),[]),_0x3f22c5=this[_0x37f543(0x1bd)](a96_0x43c449[_0x37f543(0xfc)](_0x4857a5,_0x37f543(0xea)),[]),_0x360cbe=this[_0x37f543(0x1bd)](a96_0x43c449[_0x37f543(0xfc)](_0x4857a5,_0x37f543(0x157)),[]),_0x375048=this[_0x37f543(0x1bd)](a96_0x43c449[_0x37f543(0xfc)](_0x4857a5,_0x37f543(0x172)),[]),_0x432845=_0x5c170a?.['name']||_0x2a186c[_0x37f543(0x174)][_0x37f543(0x1d2)];if(_0x5de5aa){const _0x5adb41=new Map(),_0x1ba1a1=[..._0x271daa],_0x45a3ea=_0x271daa[_0x37f543(0x1ea)]+0x1;let _0x24df94=0x0;while(_0x1ba1a1[_0x37f543(0x1ea)]>0x0&&_0x24df94<_0x45a3ea){_0x24df94++;const _0x423253=[];for(const _0x4e8599 of _0x1ba1a1){canCreateAgent(_0x4e8599,_0x5adb41)?_0x5adb41[_0x37f543(0x171)](_0x4e8599['id'],_0x37f543(0x120)+_0x4e8599['id']):_0x423253[_0x37f543(0x146)](_0x4e8599);}if(_0x423253[_0x37f543(0x1ea)]===_0x1ba1a1[_0x37f543(0x1ea)])throw new SDKError(ErrorCode[_0x37f543(0x149)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x1ba1a1[_0x37f543(0x1ea)]=0x0,_0x1ba1a1['push'](..._0x423253);}const _0x412840=_0x360cbe[_0x37f543(0x1ad)](_0xf95991=>_0x5adb41[_0x37f543(0x197)](_0xf95991[_0x37f543(0x170)][_0x37f543(0x124)]))[_0x37f543(0x1ea)];return{'projectName':_0x432845,'projectId':_0x37f543(0xf9),'counts':{'agents':_0x271daa[_0x37f543(0x1ea)],'knowledgeBases':_0x3f22c5[_0x37f543(0x1ea)],'prompts':_0x412840,'integrations':_0x375048[_0x37f543(0x1ea)]},'sourceSite':_0x46bb2f};}const _0x26481c=await this[_0x37f543(0x13a)][_0x37f543(0xf1)]({'name':_0x432845,'description':_0x2a186c[_0x37f543(0x11f)][_0x37f543(0x170)][_0x37f543(0x18f)]}),_0x3d1781=_0x26481c['id'],_0x1a0832=new Map(),_0x2f4d3b=new Map(),_0x5c7952=new Map();for(const _0x21f269 of _0x3f22c5){const _0x1667a9=await this[_0x37f543(0x13a)][_0x37f543(0x175)]({'projectId':_0x3d1781,'name':_0x21f269[_0x37f543(0x170)][_0x37f543(0xe6)],'tdDatabaseName':_0x21f269[_0x37f543(0x170)]['tdDatabaseName'],'tables':_0x21f269['attributes']['tables']});_0x1a0832[_0x37f543(0x171)](_0x21f269['id'],_0x1667a9['id']);}const _0x1d7f90=[..._0x271daa],_0x45308e=_0x271daa[_0x37f543(0x1ea)]+0x1;let _0x8b7e4c=0x0;while(_0x1d7f90[_0x37f543(0x1ea)]>0x0&&_0x8b7e4c<_0x45308e){_0x8b7e4c++;const _0x52bb44=[];for(const _0x466f58 of _0x1d7f90){if(canCreateAgent(_0x466f58,_0x2f4d3b)){const _0x590aee=remapToolIds(_0x466f58['attributes'][_0x37f543(0x10f)],_0x1a0832,_0x2f4d3b),_0x139e1c=remapVariableIds(_0x466f58[_0x37f543(0x170)][_0x37f543(0x16a)],_0x1a0832),_0x38539e=await this[_0x37f543(0x13a)][_0x37f543(0xfa)]({'name':_0x466f58[_0x37f543(0x170)][_0x37f543(0xe6)],'projectId':_0x3d1781,'systemPrompt':_0x466f58['attributes'][_0x37f543(0x1b9)],'starterMessage':_0x466f58['attributes'][_0x37f543(0xe5)],'modelType':migrateModelType(_0x466f58[_0x37f543(0x170)][_0x37f543(0x15a)]),'maxToolIterations':_0x466f58[_0x37f543(0x170)][_0x37f543(0x119)],'temperature':_0x466f58['attributes']['temperature'],'reasoningEffort':_0x466f58[_0x37f543(0x170)][_0x37f543(0x141)],'outputs':_0x466f58['attributes'][_0x37f543(0x1f1)],'tools':_0x590aee,'variables':_0x139e1c});_0x2f4d3b['set'](_0x466f58['id'],_0x38539e['id']);}else _0x52bb44['push'](_0x466f58);}if(_0x52bb44[_0x37f543(0x1ea)]===_0x1d7f90[_0x37f543(0x1ea)])throw new SDKError(ErrorCode[_0x37f543(0x149)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x1d7f90[_0x37f543(0x1ea)]=0x0,_0x1d7f90[_0x37f543(0x146)](..._0x52bb44);}for(const _0xb4538d of _0x360cbe){const _0x25f76a=_0x2f4d3b['get'](_0xb4538d[_0x37f543(0x170)][_0x37f543(0x124)]);if(!_0x25f76a)continue;const _0x3c700a=await this['client'][_0x37f543(0x19e)]({'projectId':_0x3d1781,'agentId':_0x25f76a,'name':_0xb4538d[_0x37f543(0x170)]['name'],'systemPrompt':_0xb4538d[_0x37f543(0x170)]['systemPrompt'],'template':_0xb4538d[_0x37f543(0x170)]['template'],'jsonSchemaHint':_0xb4538d['attributes']['jsonSchemaHint']});_0x5c7952[_0x37f543(0x171)](_0xb4538d['id'],_0x3c700a['id']);}for(const _0x4fb1ef of _0x375048){const _0x33c2ae=_0x4fb1ef[_0x37f543(0x170)]['actions'][_0x37f543(0x19a)](_0x3565d5=>({..._0x3565d5,'promptId':_0x5c7952['get'](_0x3565d5['promptId'])||_0x3565d5[_0x37f543(0x1da)]}));await this['client']['createIntegration']({'projectId':_0x3d1781,'serviceType':_0x4fb1ef[_0x37f543(0x170)][_0x37f543(0x143)],'actions':_0x33c2ae,'slackMessageMode':_0x4fb1ef['attributes'][_0x37f543(0x18d)],'chatIgnoreManagedActions':_0x4fb1ef[_0x37f543(0x170)][_0x37f543(0x117)],'chatWelcomeMessage':_0x4fb1ef[_0x37f543(0x170)][_0x37f543(0x139)],'webhookCorsOrigins':_0x4fb1ef[_0x37f543(0x170)][_0x37f543(0x1ef)]});}return{'projectName':_0x432845,'projectId':_0x3d1781,'counts':{'agents':_0x2f4d3b[_0x37f543(0x1d7)],'knowledgeBases':_0x1a0832['size'],'prompts':_0x5c7952[_0x37f543(0x1d7)],'integrations':_0x375048['length']},'sourceSite':_0x46bb2f};}[a96_0x8551a0(0x1bd)](_0xb00a03,_0x3513fc){const _0x4bcb0f=a96_0x8551a0;if(!a96_0x3256d2[_0x4bcb0f(0x1a0)](_0xb00a03))return _0x3513fc;return JSON['parse'](a96_0x3256d2['readFileSync'](_0xb00a03,_0x4bcb0f(0x153)));}[a96_0x8551a0(0x19b)](_0x1520c9){const _0x5e7a86=a96_0x8551a0;if(!a96_0x3256d2[_0x5e7a86(0x1a0)](_0x1520c9))throw new SDKError(ErrorCode[_0x5e7a86(0x1f5)],_0x5e7a86(0x163)+_0x1520c9,undefined,{'helpText':_0x5e7a86(0x18c)});const _0x2f1c6a=a96_0x43c449['join'](_0x1520c9,_0x5e7a86(0x190));if(!a96_0x3256d2[_0x5e7a86(0x1a0)](_0x2f1c6a))throw new SDKError(ErrorCode[_0x5e7a86(0x1ab)],_0x5e7a86(0x1de)+_0x1520c9,undefined,{'helpText':_0x5e7a86(0x147)});const _0x319cf6=JSON[_0x5e7a86(0x10c)](a96_0x3256d2[_0x5e7a86(0x15e)](_0x2f1c6a,'utf-8'));if(!isSupportedBackupVersion(_0x319cf6[_0x5e7a86(0x122)]))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x5e7a86(0x16d)+_0x319cf6[_0x5e7a86(0x122)],undefined,{'helpText':_0x5e7a86(0x17a)});return _0x319cf6;}async[a96_0x8551a0(0x1d3)](_0x452a60,_0x4a6c40,_0xa758ff){const _0x326735=a96_0x8551a0,{projectId:_0x4efd0e,project:_0x245656}=await this['resolveProjectName'](_0x452a60),_0x1f06d9=_0x245656['attributes'][_0x326735(0xe6)];let _0x13f55a;if(_0x4a6c40)_0x13f55a=_0x4a6c40;else{const _0x434a61=a96_0x43c449[_0x326735(0xfc)](process[_0x326735(0x12b)](),_0x326735(0x166)),_0x5dd720=getSanitizedPathWithMigration(_0x434a61,_0x1f06d9);_0x5dd720[_0x326735(0xfd)]&&this[_0x326735(0x1af)][_0x326735(0x196)](_0x326735(0x187)+a96_0x43c449[_0x326735(0x12c)](_0x5dd720['oldPath'])+_0x326735(0x176)+a96_0x43c449[_0x326735(0x12c)](_0x5dd720[_0x326735(0xec)])),_0x13f55a=_0x5dd720['path'];}const _0x1bd0bd=await this[_0x326735(0x13a)][_0x326735(0x127)](_0x4efd0e),_0x4092ba=await this['client'][_0x326735(0x1e5)](_0x4efd0e),_0x3c243c=await this['client'][_0x326735(0x151)](_0x4efd0e),_0x404e80=await this['client'][_0x326735(0xf6)](_0x4efd0e),_0x490478=await this[_0x326735(0x13a)][_0x326735(0xf8)](_0x4efd0e),_0x272716=await this[_0x326735(0x13a)][_0x326735(0x1a1)](_0x4efd0e),_0x356d48=await this[_0x326735(0x13a)]['listIntegrations'](_0x4efd0e),_0x6469c0=await this[_0x326735(0x13a)][_0x326735(0x126)](_0x4efd0e),_0xcd5b7=await this[_0x326735(0x13a)][_0x326735(0x19f)](_0x4efd0e),_0x388401=_0x356d48[_0x326735(0x1ad)](_0x302a38=>!_0x302a38[_0x326735(0x170)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x326735(0xeb)](_0x302a38[_0x326735(0x170)][_0x326735(0x143)][_0x326735(0x140)]())),_0x31d88f=new Map(),_0x4d24cc=new Map(),_0x737cf2=new Map(),_0xc235e5=new Map(),_0x224910=new Map(),_0x271abd=new Map(),_0x58ec1e=new Map();for(const _0x4e8fa0 of _0x1bd0bd){_0x31d88f[_0x326735(0x171)](_0x4e8fa0['id'],_0x4e8fa0['attributes']['name']);}for(const _0x450c70 of _0x4092ba){_0x4d24cc[_0x326735(0x171)](_0x450c70['id'],_0x450c70[_0x326735(0x170)][_0x326735(0xe6)]);}for(const _0x9c16e4 of _0x3c243c){_0x737cf2[_0x326735(0x171)](_0x9c16e4['id'],_0x9c16e4[_0x326735(0x170)][_0x326735(0xe6)]);}for(const _0x49cec7 of _0x404e80){_0xc235e5[_0x326735(0x171)](_0x49cec7['id'],_0x49cec7[_0x326735(0x170)][_0x326735(0xe6)]);}for(const _0xc71ecc of _0x490478){_0x224910[_0x326735(0x171)](_0xc71ecc['id'],_0xc71ecc[_0x326735(0x170)][_0x326735(0xe6)]);}for(const _0x5545a4 of _0x272716){_0x271abd[_0x326735(0x171)](_0x5545a4['id'],_0x5545a4[_0x326735(0x170)]['name']);}for(const _0x1f6d6a of _0x6469c0){_0x58ec1e[_0x326735(0x171)](_0x1f6d6a['id'],_0x1f6d6a[_0x326735(0x170)][_0x326735(0xe6)]);}const _0x4d62d1={'resolveKnowledgeBaseName':async _0x5c5f8d=>_0x4d24cc[_0x326735(0x123)](_0x5c5f8d),'resolveTextKnowledgeBaseName':async _0x5a96be=>_0x737cf2['get'](_0x5a96be),'resolveAgentName':async _0x577fd6=>_0x31d88f[_0x326735(0x123)](_0x577fd6),'resolveWebSearchToolName':async _0x5e4e27=>_0x224910['get'](_0x5e4e27),'resolveImageGeneratorName':async _0x3c0c3b=>_0xc235e5[_0x326735(0x123)](_0x3c0c3b),'resolvePromptName':async _0x367d7f=>_0x271abd[_0x326735(0x123)](_0x367d7f),'resolveExperimentalKnowledgeBaseName':async _0x1986de=>_0x58ec1e['get'](_0x1986de),'onWarning':_0x37ecb1=>this[_0x326735(0x1af)][_0x326735(0x14f)](_0x37ecb1)},_0x23e910={'projectName':_0x1f06d9,'outputDir':_0x13f55a,'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}}},_0x1aa5b6=[],_0x12870f=[];for(const _0x14a9c2 of _0x1bd0bd){const _0x713405=getSanitizedPathWithMigration(_0x13f55a,_0x14a9c2[_0x326735(0x170)]['name']);_0x713405[_0x326735(0xfd)]&&this['logger'][_0x326735(0x196)]('Renamed\x20agent\x20folder:\x20'+a96_0x43c449[_0x326735(0x12c)](_0x713405[_0x326735(0x12d)])+_0x326735(0x176)+a96_0x43c449[_0x326735(0x12c)](_0x713405['path']));const _0x1d2db3=_0x713405['path'],_0x465f55=a96_0x43c449[_0x326735(0xfc)](_0x1d2db3,_0x326735(0x160)),_0x24e9e0=a96_0x43c449[_0x326735(0xfc)](_0x1d2db3,_0x326735(0x16b)),_0xd888=a96_0x43c449['join'](_0x1d2db3,_0x326735(0x1aa)),{yaml:_0x5e1c4a,systemPrompt:_0x2de98e,starterMessage:_0x13ec3d}=await agentResponseToDef(_0x14a9c2,_0x4d62d1),_0x1acf02=toAgentYamlString(_0x5e1c4a),_0x269603=!a96_0x3256d2[_0x326735(0x1a0)](_0x24e9e0);let _0x5d9a0a=_0x269603,_0x2c7bd7;if(!_0x269603){const _0x164509=a96_0x3256d2[_0x326735(0x1a0)](_0x465f55)?a96_0x3256d2[_0x326735(0x15e)](_0x465f55,'utf-8'):'',_0x2b31e0=a96_0x3256d2['readFileSync'](_0x24e9e0,_0x326735(0x153)),_0x1ef400=_0x326735(0x116)+_0x164509+_0x326735(0x13c)+_0x2b31e0,_0x4cb977='#\x20prompt.md\x0a'+_0x2de98e+'\x0a\x0a#\x20agent.yml\x0a'+_0x1acf02,_0xb6e454=generateDiff(_0x1ef400,_0x4cb977);_0x5d9a0a=hasChanges(_0xb6e454),_0x5d9a0a&&(_0x2c7bd7=formatDiffWithColors(_0xb6e454));}_0x1aa5b6[_0x326735(0x146)]({'path':_0x1d2db3,'content':'','isDir':!![]}),_0x1aa5b6[_0x326735(0x146)]({'path':_0x465f55,'content':_0x2de98e}),_0x1aa5b6['push']({'path':_0x24e9e0,'content':_0x1acf02});_0x13ec3d&&_0x13ec3d[_0x326735(0xeb)]('\x0a')&&_0x1aa5b6[_0x326735(0x146)]({'path':_0xd888,'content':_0x13ec3d});_0x23e910[_0x326735(0x166)][_0x326735(0x146)]({'agentName':_0x14a9c2[_0x326735(0x170)]['name'],'outputPath':_0x1d2db3,'isNew':_0x269603,'hasChanges':_0x5d9a0a,'diff':_0x2c7bd7}),_0x23e910[_0x326735(0x1cc)][_0x326735(0x166)]['total']++;if(_0x269603)_0x23e910['counts'][_0x326735(0x166)][_0x326735(0x103)]++;else{if(_0x5d9a0a)_0x23e910[_0x326735(0x1cc)][_0x326735(0x166)][_0x326735(0x1d1)]++;else _0x23e910['counts']['agents'][_0x326735(0x15d)]++;}}for(const _0x10877c of _0x4092ba){if(_0x10877c[_0x326735(0x170)][_0x326735(0x19c)])continue;const _0x2de31c=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x13f55a),_0x10877c[_0x326735(0x170)][_0x326735(0xe6)],'.yml');_0x2de31c[_0x326735(0xfd)]&&this[_0x326735(0x1af)][_0x326735(0x196)](_0x326735(0x111)+a96_0x43c449['basename'](_0x2de31c[_0x326735(0x12d)])+_0x326735(0x176)+a96_0x43c449['basename'](_0x2de31c[_0x326735(0xec)]));const _0x219ce0=_0x2de31c['path'],_0x56eacd=apiKnowledgeBaseToYaml(_0x10877c),_0x1849fb=toKnowledgeBaseYamlString(_0x56eacd),_0x38579f=!a96_0x3256d2['existsSync'](_0x219ce0);let _0x2c2224=_0x38579f,_0x5dc408;if(!_0x38579f){const _0x282b84=a96_0x3256d2[_0x326735(0x15e)](_0x219ce0,_0x326735(0x153)),_0x9007e3=generateDiff(_0x282b84,_0x1849fb);_0x2c2224=hasChanges(_0x9007e3),_0x2c2224&&(_0x5dc408=formatDiffWithColors(_0x9007e3));}_0x1aa5b6[_0x326735(0x146)]({'path':_0x219ce0,'content':_0x1849fb}),_0x23e910[_0x326735(0x165)][_0x326735(0x146)]({'name':_0x10877c[_0x326735(0x170)]['name'],'outputPath':_0x219ce0,'isNew':_0x38579f,'hasChanges':_0x2c2224,'diff':_0x5dc408}),_0x23e910[_0x326735(0x1cc)][_0x326735(0x165)]['total']++;if(_0x38579f)_0x23e910['counts'][_0x326735(0x165)][_0x326735(0x103)]++;else{if(_0x2c2224)_0x23e910[_0x326735(0x1cc)]['knowledgeBases']['updated']++;else _0x23e910['counts']['knowledgeBases'][_0x326735(0x15d)]++;}}for(const _0x4a559c of _0x3c243c){if(_0x4a559c[_0x326735(0x170)][_0x326735(0x19c)])continue;const _0x2810f6=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x13f55a),_0x4a559c[_0x326735(0x170)][_0x326735(0xe6)],'.md');_0x2810f6[_0x326735(0xfd)]&&this['logger'][_0x326735(0x196)](_0x326735(0x1c7)+a96_0x43c449[_0x326735(0x12c)](_0x2810f6[_0x326735(0x12d)])+_0x326735(0x176)+a96_0x43c449[_0x326735(0x12c)](_0x2810f6[_0x326735(0xec)]));const _0x90cb64=_0x2810f6[_0x326735(0xec)],_0x1ead52=toTextKnowledgeBaseMd(_0x4a559c[_0x326735(0x170)][_0x326735(0xe6)],_0x4a559c[_0x326735(0x170)][_0x326735(0xf2)]),_0x472204=!a96_0x3256d2[_0x326735(0x1a0)](_0x90cb64);let _0x192881=_0x472204,_0x12cde7;if(!_0x472204){const _0x79abfd=a96_0x3256d2['readFileSync'](_0x90cb64,_0x326735(0x153)),_0x446800=generateDiff(_0x79abfd,_0x1ead52);_0x192881=hasChanges(_0x446800),_0x192881&&(_0x12cde7=formatDiffWithColors(_0x446800));}_0x1aa5b6[_0x326735(0x146)]({'path':_0x90cb64,'content':_0x1ead52}),_0x23e910['textKnowledgeBases'][_0x326735(0x146)]({'name':_0x4a559c['attributes'][_0x326735(0xe6)],'outputPath':_0x90cb64,'isNew':_0x472204,'hasChanges':_0x192881,'diff':_0x12cde7}),_0x23e910['counts'][_0x326735(0x128)][_0x326735(0x125)]++;if(_0x472204)_0x23e910[_0x326735(0x1cc)]['textKnowledgeBases'][_0x326735(0x103)]++;else{if(_0x192881)_0x23e910['counts'][_0x326735(0x128)][_0x326735(0x1d1)]++;else _0x23e910[_0x326735(0x1cc)][_0x326735(0x128)]['unchanged']++;}}for(const _0x222a55 of _0x272716){if(_0x222a55[_0x326735(0x170)][_0x326735(0x19c)])continue;const _0x12bcd6=getSanitizedPathWithMigration(getPromptsDir(_0x13f55a),_0x222a55[_0x326735(0x170)]['name'],_0x326735(0x1c2));_0x12bcd6['renamed']&&this[_0x326735(0x1af)][_0x326735(0x196)](_0x326735(0x186)+a96_0x43c449[_0x326735(0x12c)](_0x12bcd6['oldPath'])+_0x326735(0x176)+a96_0x43c449[_0x326735(0x12c)](_0x12bcd6[_0x326735(0xec)]));const _0x392deb=_0x12bcd6[_0x326735(0xec)],_0x155a39=await apiPromptToYaml(_0x222a55,_0x4d62d1);if(!_0x155a39)continue;const _0xfd0a99=toPromptYamlString(_0x155a39),_0x5a38b6=!a96_0x3256d2[_0x326735(0x1a0)](_0x392deb);let _0xc01f17=_0x5a38b6,_0x347eb6;if(!_0x5a38b6){const _0x114489=a96_0x3256d2[_0x326735(0x15e)](_0x392deb,'utf-8'),_0x142b61=generateDiff(_0x114489,_0xfd0a99);_0xc01f17=hasChanges(_0x142b61),_0xc01f17&&(_0x347eb6=formatDiffWithColors(_0x142b61));}_0x1aa5b6[_0x326735(0x146)]({'path':_0x392deb,'content':_0xfd0a99}),_0x23e910[_0x326735(0x10e)][_0x326735(0x146)]({'name':_0x222a55[_0x326735(0x170)]['name'],'outputPath':_0x392deb,'isNew':_0x5a38b6,'hasChanges':_0xc01f17,'diff':_0x347eb6}),_0x23e910[_0x326735(0x1cc)]['prompts'][_0x326735(0x125)]++;if(_0x5a38b6)_0x23e910[_0x326735(0x1cc)][_0x326735(0x10e)]['new']++;else{if(_0xc01f17)_0x23e910[_0x326735(0x1cc)][_0x326735(0x10e)]['updated']++;else _0x23e910[_0x326735(0x1cc)]['prompts']['unchanged']++;}}for(const _0x4d1a8b of _0x388401){const _0x51d293=_0x4d1a8b[_0x326735(0x170)][_0x326735(0x143)]['toLowerCase'](),_0x49ad70=getSanitizedPathWithMigration(getIntegrationsDir(_0x13f55a),_0x51d293,_0x326735(0x1c2));_0x49ad70[_0x326735(0xfd)]&&this[_0x326735(0x1af)][_0x326735(0x196)]('Renamed\x20integration\x20file:\x20'+a96_0x43c449[_0x326735(0x12c)](_0x49ad70[_0x326735(0x12d)])+_0x326735(0x176)+a96_0x43c449[_0x326735(0x12c)](_0x49ad70[_0x326735(0xec)]));const _0xadf3ec=_0x49ad70[_0x326735(0xec)],_0x29cd1b=await apiIntegrationToYaml(_0x4d1a8b,_0x4d62d1),_0xb6bb4d=toIntegrationYamlString(_0x29cd1b),_0x5bf79a=!a96_0x3256d2['existsSync'](_0xadf3ec);let _0x1db784=_0x5bf79a,_0x13461c;if(!_0x5bf79a){const _0x3919d7=a96_0x3256d2[_0x326735(0x15e)](_0xadf3ec,'utf-8'),_0x1b80aa=generateDiff(_0x3919d7,_0xb6bb4d);_0x1db784=hasChanges(_0x1b80aa),_0x1db784&&(_0x13461c=formatDiffWithColors(_0x1b80aa));}_0x1aa5b6[_0x326735(0x146)]({'path':_0xadf3ec,'content':_0xb6bb4d}),_0x23e910[_0x326735(0x188)]['push']({'name':_0x51d293,'outputPath':_0xadf3ec,'isNew':_0x5bf79a,'hasChanges':_0x1db784,'diff':_0x13461c}),_0x23e910[_0x326735(0x1cc)][_0x326735(0x188)][_0x326735(0x125)]++;if(_0x5bf79a)_0x23e910['counts']['integrations'][_0x326735(0x103)]++;else{if(_0x1db784)_0x23e910[_0x326735(0x1cc)]['integrations'][_0x326735(0x1d1)]++;else _0x23e910[_0x326735(0x1cc)][_0x326735(0x188)]['unchanged']++;}}for(const _0x55b813 of _0x6469c0){if(_0x55b813[_0x326735(0x170)][_0x326735(0x19c)])continue;const _0x238c49=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x13f55a),_0x55b813[_0x326735(0x170)][_0x326735(0xe6)]);_0x238c49[_0x326735(0xfd)]&&this[_0x326735(0x1af)][_0x326735(0x196)](_0x326735(0x193)+a96_0x43c449[_0x326735(0x12c)](_0x238c49['oldPath'])+_0x326735(0x176)+a96_0x43c449[_0x326735(0x12c)](_0x238c49[_0x326735(0xec)]));const _0x41430f=_0x238c49['path'],_0x472927=a96_0x43c449[_0x326735(0xfc)](_0x41430f,sanitizeForFilesystem(_0x55b813[_0x326735(0x170)][_0x326735(0xe6)])+_0x326735(0x1c2)),_0x10f8a6=a96_0x43c449['join'](_0x41430f,_0x326735(0xe4)),_0x4cc1fb=apiExperimentalKnowledgeBaseToYaml(_0x55b813),_0x20bcb5=toExperimentalKnowledgeBaseYamlString(_0x4cc1fb),_0xcf5e87=!a96_0x3256d2['existsSync'](_0x41430f);let _0x3459b7=_0xcf5e87,_0x4a1823,_0x51a4ac=_0x20bcb5;const _0x40f84e=[..._0x4cc1fb[_0x326735(0xe4)]][_0x326735(0x10a)]((_0x2a7105,_0x1c5a0b)=>_0x2a7105[_0x326735(0xe6)][_0x326735(0x1eb)](_0x1c5a0b[_0x326735(0xe6)]));for(const _0x4d486e of _0x40f84e){_0x51a4ac+=_0x326735(0x169)+_0x4d486e['name']+_0x326735(0x11c)+_0x4d486e[_0x326735(0x1df)]+_0x326735(0x1a5)+_0x4d486e[_0x326735(0xe6)]+'\x20---\x0a'+_0x4d486e[_0x326735(0x1e3)]+'\x0a';}if(!_0xcf5e87){let _0x271859='';a96_0x3256d2[_0x326735(0x1a0)](_0x472927)&&(_0x271859=a96_0x3256d2[_0x326735(0x15e)](_0x472927,'utf-8'));if(a96_0x3256d2[_0x326735(0x1a0)](_0x10f8a6)){const _0x301422=a96_0x3256d2[_0x326735(0x1d9)](_0x10f8a6,{'withFileTypes':!![]}),_0x31c5e2=_0x301422['filter'](_0x187807=>_0x187807[_0x326735(0x16f)]())[_0x326735(0x10a)]((_0xa2bda1,_0x1c5da7)=>_0xa2bda1[_0x326735(0xe6)][_0x326735(0x1eb)](_0x1c5da7[_0x326735(0xe6)]));for(const _0x34cafa of _0x31c5e2){const _0x3e9ed3=a96_0x43c449['join'](_0x10f8a6,_0x34cafa[_0x326735(0xe6)],_0x326735(0x1cf)),_0x498528=a96_0x43c449[_0x326735(0xfc)](_0x10f8a6,_0x34cafa['name'],_0x326735(0x1a6));a96_0x3256d2[_0x326735(0x1a0)](_0x3e9ed3)&&(_0x271859+=_0x326735(0x169)+_0x34cafa[_0x326735(0xe6)]+_0x326735(0x11c)+a96_0x3256d2['readFileSync'](_0x3e9ed3,_0x326735(0x153))+'\x0a'),a96_0x3256d2[_0x326735(0x1a0)](_0x498528)&&(_0x271859+=_0x326735(0x106)+_0x34cafa[_0x326735(0xe6)]+_0x326735(0x11c)+a96_0x3256d2['readFileSync'](_0x498528,_0x326735(0x153))+'\x0a');}}const _0x583194=generateDiff(_0x271859,_0x51a4ac);_0x3459b7=hasChanges(_0x583194),_0x3459b7&&(_0x4a1823=formatDiffWithColors(_0x583194));}_0x1aa5b6[_0x326735(0x146)]({'path':_0x41430f,'content':'','isDir':!![]}),_0x1aa5b6[_0x326735(0x146)]({'path':_0x472927,'content':_0x20bcb5}),_0x1aa5b6[_0x326735(0x146)]({'path':_0x10f8a6,'content':'','isDir':!![]});for(const _0x11b713 of _0x4cc1fb['functions']){const _0x32cb6d=a96_0x43c449[_0x326735(0xfc)](_0x10f8a6,sanitizeForFilesystem(_0x11b713[_0x326735(0xe6)])),_0x386720=a96_0x43c449[_0x326735(0xfc)](_0x32cb6d,_0x326735(0x1cf)),_0x3d46bc=a96_0x43c449['join'](_0x32cb6d,'json_schema.json');_0x1aa5b6[_0x326735(0x146)]({'path':_0x32cb6d,'content':'','isDir':!![]}),_0x1aa5b6[_0x326735(0x146)]({'path':_0x386720,'content':_0x11b713[_0x326735(0x1df)]}),_0x1aa5b6['push']({'path':_0x3d46bc,'content':_0x11b713['json_schema']});}if(a96_0x3256d2[_0x326735(0x1a0)](_0x10f8a6)){const _0x49dbe7=a96_0x3256d2[_0x326735(0x1d9)](_0x10f8a6,{'withFileTypes':!![]}),_0x34bd17=new Set(_0x4cc1fb[_0x326735(0xe4)][_0x326735(0x19a)](_0x20f261=>sanitizeForFilesystem(_0x20f261[_0x326735(0xe6)])));for(const _0x59fc86 of _0x49dbe7){if(_0x59fc86[_0x326735(0x16f)]()&&!_0x34bd17[_0x326735(0x197)](_0x59fc86[_0x326735(0xe6)])){const _0x1f4d09=a96_0x43c449[_0x326735(0xfc)](_0x10f8a6,_0x59fc86[_0x326735(0xe6)]);_0x12870f['push']({'path':_0x1f4d09,'isDir':!![]});}}}_0x23e910[_0x326735(0x11e)][_0x326735(0x146)]({'name':_0x55b813[_0x326735(0x170)][_0x326735(0xe6)],'outputPath':_0x41430f,'isNew':_0xcf5e87,'hasChanges':_0x3459b7,'diff':_0x4a1823}),_0x23e910[_0x326735(0x1cc)]['experimentalKnowledgeBases'][_0x326735(0x125)]++;if(_0xcf5e87)_0x23e910[_0x326735(0x1cc)][_0x326735(0x11e)][_0x326735(0x103)]++;else{if(_0x3459b7)_0x23e910[_0x326735(0x1cc)]['experimentalKnowledgeBases'][_0x326735(0x1d1)]++;else _0x23e910[_0x326735(0x1cc)]['experimentalKnowledgeBases'][_0x326735(0x15d)]++;}}for(const _0x25e2c2 of _0xcd5b7){if(_0x25e2c2[_0x326735(0x170)][_0x326735(0x19c)])continue;const _0x5c389e=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x13f55a),_0x25e2c2[_0x326735(0x170)][_0x326735(0xe6)]);_0x5c389e[_0x326735(0xfd)]&&this[_0x326735(0x1af)][_0x326735(0x196)]('Renamed\x20experimental\x20artifact\x20directory:\x20'+a96_0x43c449[_0x326735(0x12c)](_0x5c389e[_0x326735(0x12d)])+'\x20→\x20'+a96_0x43c449[_0x326735(0x12c)](_0x5c389e['path']));const _0x59cad7=_0x5c389e['path'],_0x525ace=a96_0x43c449[_0x326735(0xfc)](_0x59cad7,sanitizeForFilesystem(_0x25e2c2['attributes'][_0x326735(0xe6)])+_0x326735(0x1c2)),_0x3bd33a=a96_0x43c449[_0x326735(0xfc)](_0x59cad7,_0x326735(0x1cf)),_0x292512=a96_0x43c449['join'](_0x59cad7,_0x326735(0x1c5)),_0x3a9c4f=apiExperimentalArtifactToYaml(_0x25e2c2),_0x33d461=toExperimentalArtifactYamlString(_0x3a9c4f),_0x2300e0=!a96_0x3256d2[_0x326735(0x1a0)](_0x59cad7);let _0x5f3758=_0x2300e0,_0x3b6bd2,_0x1b8696=_0x33d461+(_0x326735(0x12e)+_0x3a9c4f[_0x326735(0x1df)]+'\x0a');const _0x59c48a=[..._0x3a9c4f[_0x326735(0x1c5)]][_0x326735(0x10a)]((_0x3bd75c,_0x312b3e)=>_0x3bd75c[_0x326735(0xed)][_0x326735(0x1eb)](_0x312b3e[_0x326735(0xed)]));for(const _0x2f0357 of _0x59c48a){_0x1b8696+=_0x326735(0x1ee)+_0x2f0357[_0x326735(0xed)]+_0x326735(0x11c)+_0x2f0357['text_content']+'\x0a';}if(!_0x2300e0){let _0x3b551c='';a96_0x3256d2[_0x326735(0x1a0)](_0x525ace)&&(_0x3b551c=a96_0x3256d2[_0x326735(0x15e)](_0x525ace,_0x326735(0x153)));a96_0x3256d2[_0x326735(0x1a0)](_0x3bd33a)&&(_0x3b551c+='\x0a---\x20code\x20---\x0a'+a96_0x3256d2[_0x326735(0x15e)](_0x3bd33a,'utf-8')+'\x0a');if(a96_0x3256d2[_0x326735(0x1a0)](_0x292512)){const _0x4c31ef=a96_0x3256d2[_0x326735(0x1d9)](_0x292512),_0x1f1136=_0x4c31ef['filter'](_0x55fdff=>{const _0x3f109e=_0x326735,_0x49caad=a96_0x43c449[_0x3f109e(0xfc)](_0x292512,_0x55fdff);return a96_0x3256d2[_0x3f109e(0x1e9)](_0x49caad)[_0x3f109e(0x1ed)]();})[_0x326735(0x10a)]((_0x54dc52,_0x501f1b)=>_0x54dc52['localeCompare'](_0x501f1b));for(const _0x288ce8 of _0x1f1136){const _0x2d53a1=a96_0x43c449[_0x326735(0xfc)](_0x292512,_0x288ce8);_0x3b551c+=_0x326735(0x1ee)+_0x288ce8+_0x326735(0x11c)+a96_0x3256d2['readFileSync'](_0x2d53a1,_0x326735(0x153))+'\x0a';}}const _0x563ee3=generateDiff(_0x3b551c,_0x1b8696);_0x5f3758=hasChanges(_0x563ee3),_0x5f3758&&(_0x3b6bd2=formatDiffWithColors(_0x563ee3));}_0x1aa5b6[_0x326735(0x146)]({'path':_0x59cad7,'content':'','isDir':!![]}),_0x1aa5b6['push']({'path':_0x525ace,'content':_0x33d461}),_0x1aa5b6['push']({'path':_0x3bd33a,'content':_0x3a9c4f[_0x326735(0x1df)]});if(_0x3a9c4f[_0x326735(0x1c5)][_0x326735(0x1ea)]>0x0){_0x1aa5b6[_0x326735(0x146)]({'path':_0x292512,'content':'','isDir':!![]});for(const _0x4bb337 of _0x3a9c4f['files']){const _0x310306=a96_0x43c449['join'](_0x292512,_0x4bb337[_0x326735(0xed)]);_0x1aa5b6[_0x326735(0x146)]({'path':_0x310306,'content':_0x4bb337['text_content']});}}if(a96_0x3256d2[_0x326735(0x1a0)](_0x292512)){const _0x26fc85=a96_0x3256d2[_0x326735(0x1d9)](_0x292512),_0x336dca=new Set(_0x3a9c4f['files']['map'](_0x44fa3d=>_0x44fa3d[_0x326735(0xed)]));for(const _0x275b34 of _0x26fc85){const _0x43da58=a96_0x43c449[_0x326735(0xfc)](_0x292512,_0x275b34);a96_0x3256d2[_0x326735(0x1e9)](_0x43da58)[_0x326735(0x1ed)]()&&!_0x336dca['has'](_0x275b34)&&_0x12870f[_0x326735(0x146)]({'path':_0x43da58});}}_0x23e910['experimentalArtifacts']['push']({'name':_0x25e2c2[_0x326735(0x170)]['name'],'outputPath':_0x59cad7,'isNew':_0x2300e0,'hasChanges':_0x5f3758,'diff':_0x3b6bd2}),_0x23e910['counts']['experimentalArtifacts'][_0x326735(0x125)]++;if(_0x2300e0)_0x23e910[_0x326735(0x1cc)]['experimentalArtifacts']['new']++;else{if(_0x5f3758)_0x23e910[_0x326735(0x1cc)][_0x326735(0x14e)][_0x326735(0x1d1)]++;else _0x23e910[_0x326735(0x1cc)][_0x326735(0x14e)][_0x326735(0x15d)]++;}}if(_0xa758ff?.['dryRun'])return _0x23e910;a96_0x3256d2[_0x326735(0x178)](_0x13f55a,{'recursive':!![]}),a96_0x3256d2[_0x326735(0x178)](getKnowledgeBasesDir(_0x13f55a),{'recursive':!![]}),a96_0x3256d2[_0x326735(0x178)](getPromptsDir(_0x13f55a),{'recursive':!![]}),a96_0x3256d2['mkdirSync'](getIntegrationsDir(_0x13f55a),{'recursive':!![]}),a96_0x3256d2['mkdirSync'](getExperimentalKnowledgeBasesDir(_0x13f55a),{'recursive':!![]}),a96_0x3256d2['mkdirSync'](getExperimentalArtifactsDir(_0x13f55a),{'recursive':!![]});const _0x280b9a=a96_0x43c449[_0x326735(0xfc)](_0x13f55a,_0x326735(0xee));a96_0x3256d2['writeFileSync'](_0x280b9a,createAgentConfigContent(_0x1f06d9));for(const _0x41861f of _0x1aa5b6){if(_0x41861f[_0x326735(0x1b8)])a96_0x3256d2[_0x326735(0x178)](_0x41861f[_0x326735(0xec)],{'recursive':!![]});else{const _0x2e62de=a96_0x43c449['dirname'](_0x41861f['path']);!a96_0x3256d2[_0x326735(0x1a0)](_0x2e62de)&&a96_0x3256d2[_0x326735(0x178)](_0x2e62de,{'recursive':!![]}),a96_0x3256d2[_0x326735(0xf3)](_0x41861f['path'],_0x41861f[_0x326735(0x101)]);}}for(const _0x3034fb of _0x12870f){_0x3034fb['isDir']?(a96_0x3256d2[_0x326735(0x1db)](_0x3034fb[_0x326735(0xec)],{'recursive':!![],'force':!![]}),this['logger'][_0x326735(0x196)]('Removed\x20deleted\x20directory:\x20'+a96_0x43c449['basename'](a96_0x43c449['dirname'](_0x3034fb[_0x326735(0xec)]))+'/'+a96_0x43c449['basename'](_0x3034fb[_0x326735(0xec)]))):(a96_0x3256d2[_0x326735(0x1db)](_0x3034fb[_0x326735(0xec)],{'force':!![]}),this[_0x326735(0x1af)][_0x326735(0x196)](_0x326735(0x158)+a96_0x43c449[_0x326735(0x12c)](a96_0x43c449[_0x326735(0x110)](_0x3034fb[_0x326735(0xec)]))+'/'+a96_0x43c449['basename'](_0x3034fb[_0x326735(0xec)])));}return _0x23e910;}async['pushProject'](_0x461b49,_0x526eeb){const _0x33aba5=a96_0x8551a0,_0x199cb6=a96_0x43c449[_0x33aba5(0xfc)](_0x461b49,_0x33aba5(0xee));if(!a96_0x3256d2['existsSync'](_0x199cb6))throw new SDKError(ErrorCode[_0x33aba5(0x1ab)],'No\x20tdx.json\x20found\x20in\x20'+_0x461b49,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x3b3553=loadAgentConfig(_0x199cb6),_0x135612=await this['resolveProjectId'](_0x3b3553[_0x33aba5(0x144)]),_0x110b5a=await this['client']['getProject'](_0x135612),_0x5a1b52=_0x110b5a[_0x33aba5(0x170)]['name'],_0x20b4e4={'projectName':_0x5a1b52,'projectId':_0x135612,'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}}},_0x130063=[],_0x87a8bf=[],_0x74c513=[],_0x19a9ce=[],_0x8c68d4=[],_0x1cc0c8=[],_0x16c7d4=a96_0x3256d2['readdirSync'](_0x461b49,{'withFileTypes':!![]});for(const _0x5aac28 of _0x16c7d4){if(!_0x5aac28[_0x33aba5(0x16f)]())continue;if([_0x33aba5(0x12f),_0x33aba5(0x10e),'integrations',_0x33aba5(0x173),_0x33aba5(0xef)][_0x33aba5(0xeb)](_0x5aac28[_0x33aba5(0xe6)]))continue;const _0xaaca66=a96_0x43c449[_0x33aba5(0xfc)](_0x461b49,_0x5aac28['name']);if(isAgentDir(_0xaaca66)){const _0x230ea6=a96_0x43c449[_0x33aba5(0xfc)](_0xaaca66,_0x33aba5(0x16b)),_0x4b80fd=a96_0x43c449[_0x33aba5(0xfc)](_0xaaca66,_0x33aba5(0x160)),_0x3f91a5=a96_0x43c449['join'](_0xaaca66,_0x33aba5(0x1aa)),_0x540c30=parseAgentYaml(a96_0x3256d2[_0x33aba5(0x15e)](_0x230ea6,_0x33aba5(0x153)),_0x230ea6),_0x3cfefa=a96_0x3256d2[_0x33aba5(0x1a0)](_0x4b80fd)?a96_0x3256d2[_0x33aba5(0x15e)](_0x4b80fd,_0x33aba5(0x153)):'',_0x423b90=a96_0x3256d2[_0x33aba5(0x1a0)](_0x3f91a5)?a96_0x3256d2['readFileSync'](_0x3f91a5,_0x33aba5(0x153)):_0x540c30[_0x33aba5(0x1b3)];_0x130063[_0x33aba5(0x146)]({'name':_0x540c30[_0x33aba5(0xe6)],'dir':_0xaaca66,'yaml':_0x540c30,'systemPrompt':_0x3cfefa,'starterMessage':_0x423b90});}}const _0x377361=getKnowledgeBasesDir(_0x461b49);if(a96_0x3256d2[_0x33aba5(0x1a0)](_0x377361)){const _0xcf9a31=a96_0x3256d2[_0x33aba5(0x1d9)](_0x377361);for(const _0x527e52 of _0xcf9a31){const _0x1b3118=a96_0x43c449[_0x33aba5(0xfc)](_0x377361,_0x527e52);if(_0x527e52[_0x33aba5(0x1b4)]('.yml')){const _0x4e8ed0=parseKnowledgeBaseYaml(a96_0x3256d2[_0x33aba5(0x15e)](_0x1b3118,_0x33aba5(0x153)),_0x1b3118);_0x87a8bf['push']({'name':_0x4e8ed0[_0x33aba5(0xe6)],'path':_0x1b3118,'yaml':_0x4e8ed0});}else{if(_0x527e52[_0x33aba5(0x1b4)](_0x33aba5(0x155))){const _0x1fcb48=a96_0x3256d2['readFileSync'](_0x1b3118,'utf-8'),{name:_0x3c811f,text:_0xe29de1}=parseTextKnowledgeBaseMd(_0x1fcb48,_0x527e52);_0x74c513[_0x33aba5(0x146)]({'name':_0x3c811f,'path':_0x1b3118,'text':_0xe29de1});}}}}const _0xb2591c=getPromptsDir(_0x461b49);if(a96_0x3256d2['existsSync'](_0xb2591c)){const _0x4cddb5=a96_0x3256d2[_0x33aba5(0x1d9)](_0xb2591c)[_0x33aba5(0x1ad)](_0x9cfa4f=>_0x9cfa4f[_0x33aba5(0x1b4)](_0x33aba5(0x1c2)));for(const _0x45ce52 of _0x4cddb5){const _0x43ecf9=a96_0x43c449[_0x33aba5(0xfc)](_0xb2591c,_0x45ce52),_0x419a39=parsePromptYaml(a96_0x3256d2['readFileSync'](_0x43ecf9,_0x33aba5(0x153)),_0x43ecf9);_0x19a9ce[_0x33aba5(0x146)]({'name':_0x419a39[_0x33aba5(0xe6)],'path':_0x43ecf9,'yaml':_0x419a39});}}const _0x1d9f33=[],_0x2ad126=getIntegrationsDir(_0x461b49);if(a96_0x3256d2[_0x33aba5(0x1a0)](_0x2ad126)){const _0x3662b4=a96_0x3256d2['readdirSync'](_0x2ad126)['filter'](_0x37dea4=>_0x37dea4[_0x33aba5(0x1b4)](_0x33aba5(0x1c2)));for(const _0x4baab5 of _0x3662b4){const _0x1148c9=a96_0x43c449[_0x33aba5(0xfc)](_0x2ad126,_0x4baab5),_0x212f7f=parseIntegrationYaml(a96_0x3256d2['readFileSync'](_0x1148c9,_0x33aba5(0x153)),_0x1148c9);if(!SAFE_INTEGRATION_TYPES['includes'](_0x212f7f[_0x33aba5(0x1d5)][_0x33aba5(0x140)]())){this[_0x33aba5(0x1af)][_0x33aba5(0x14f)]('Skipping\x20integration\x20\x27'+_0x212f7f[_0x33aba5(0xe6)]+_0x33aba5(0x1e2)+_0x212f7f['service_type']+_0x33aba5(0x17f)+(_0x33aba5(0xfb)+SAFE_INTEGRATION_TYPES[_0x33aba5(0xfc)](',\x20')+_0x33aba5(0x1c1))+'Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.');continue;}_0x1d9f33[_0x33aba5(0x146)]({'name':_0x212f7f[_0x33aba5(0xe6)],'path':_0x1148c9,'yaml':_0x212f7f});}}const _0x2d1147=getExperimentalKnowledgeBasesDir(_0x461b49);if(a96_0x3256d2['existsSync'](_0x2d1147)){const _0x58710c=a96_0x3256d2[_0x33aba5(0x1d9)](_0x2d1147,{'withFileTypes':!![]});for(const _0x4c98b8 of _0x58710c){if(!_0x4c98b8[_0x33aba5(0x16f)]())continue;const _0x242d56=a96_0x43c449[_0x33aba5(0xfc)](_0x2d1147,_0x4c98b8[_0x33aba5(0xe6)]),_0x2c20ed=a96_0x43c449['join'](_0x242d56,_0x4c98b8[_0x33aba5(0xe6)]+'.yml'),_0x16f62a=a96_0x43c449['join'](_0x242d56,_0x33aba5(0xe4));if(!a96_0x3256d2[_0x33aba5(0x1a0)](_0x2c20ed))continue;const _0x4b2025=parseExperimentalKnowledgeBaseYaml(a96_0x3256d2[_0x33aba5(0x15e)](_0x2c20ed,_0x33aba5(0x153)),_0x2c20ed),_0x42b5d6=[];if(a96_0x3256d2['existsSync'](_0x16f62a)){const _0x3209a2=a96_0x3256d2[_0x33aba5(0x1d9)](_0x16f62a,{'withFileTypes':!![]});for(const _0x3f6929 of _0x3209a2){if(!_0x3f6929[_0x33aba5(0x16f)]())continue;const _0xf5358b=a96_0x43c449[_0x33aba5(0xfc)](_0x16f62a,_0x3f6929[_0x33aba5(0xe6)]),_0xa92487=a96_0x43c449[_0x33aba5(0xfc)](_0xf5358b,_0x33aba5(0x1cf)),_0x52c4d6=a96_0x43c449[_0x33aba5(0xfc)](_0xf5358b,_0x33aba5(0x1a6));a96_0x3256d2['existsSync'](_0xa92487)&&a96_0x3256d2[_0x33aba5(0x1a0)](_0x52c4d6)&&_0x42b5d6[_0x33aba5(0x146)]({'name':_0x3f6929['name'],'code':a96_0x3256d2[_0x33aba5(0x15e)](_0xa92487,'utf-8'),'json_schema':a96_0x3256d2[_0x33aba5(0x15e)](_0x52c4d6,_0x33aba5(0x153))});}}const _0x39d722={..._0x4b2025,'variables':_0x4b2025[_0x33aba5(0x16a)]||[],'functions':_0x42b5d6};_0x8c68d4['push']({'name':_0x4b2025[_0x33aba5(0xe6)],'dir':_0x242d56,'def':_0x39d722});}}const _0x473f3c=getExperimentalArtifactsDir(_0x461b49);if(a96_0x3256d2[_0x33aba5(0x1a0)](_0x473f3c)){const _0x5ec417=a96_0x3256d2[_0x33aba5(0x1d9)](_0x473f3c,{'withFileTypes':!![]});for(const _0x491fb2 of _0x5ec417){if(!_0x491fb2[_0x33aba5(0x16f)]())continue;const _0x2c9441=a96_0x43c449[_0x33aba5(0xfc)](_0x473f3c,_0x491fb2[_0x33aba5(0xe6)]),_0x177c4d=a96_0x43c449['join'](_0x2c9441,_0x491fb2[_0x33aba5(0xe6)]+_0x33aba5(0x1c2)),_0x36d2fa=a96_0x43c449[_0x33aba5(0xfc)](_0x2c9441,'code.js'),_0x3b4f74=a96_0x43c449[_0x33aba5(0xfc)](_0x2c9441,_0x33aba5(0x1c5));if(!a96_0x3256d2[_0x33aba5(0x1a0)](_0x177c4d)||!a96_0x3256d2[_0x33aba5(0x1a0)](_0x36d2fa))continue;const _0x5b00d6=parseExperimentalArtifactYaml(a96_0x3256d2[_0x33aba5(0x15e)](_0x177c4d,_0x33aba5(0x153)),_0x177c4d),_0x47a1ad=a96_0x3256d2[_0x33aba5(0x15e)](_0x36d2fa,_0x33aba5(0x153)),_0x496764=[];if(a96_0x3256d2[_0x33aba5(0x1a0)](_0x3b4f74)){const _0x2cfb2a=a96_0x3256d2[_0x33aba5(0x1d9)](_0x3b4f74);for(const _0x2ef3fc of _0x2cfb2a){const _0x8e3eec=a96_0x43c449['join'](_0x3b4f74,_0x2ef3fc);a96_0x3256d2[_0x33aba5(0x1e9)](_0x8e3eec)[_0x33aba5(0x1ed)]()&&_0x496764[_0x33aba5(0x146)]({'file_name':_0x2ef3fc,'text_content':a96_0x3256d2[_0x33aba5(0x15e)](_0x8e3eec,_0x33aba5(0x153))});}}const _0x3b61b6={..._0x5b00d6,'code':_0x47a1ad,'files':_0x496764};_0x1cc0c8[_0x33aba5(0x146)]({'name':_0x5b00d6['name'],'dir':_0x2c9441,'def':_0x3b61b6});}}const _0x1596fc=await this[_0x33aba5(0x13a)][_0x33aba5(0x127)](_0x135612),_0x584fea=await this[_0x33aba5(0x13a)][_0x33aba5(0x1e5)](_0x135612),_0x2f25da=await this[_0x33aba5(0x13a)][_0x33aba5(0x151)](_0x135612),_0x131824=await this[_0x33aba5(0x13a)][_0x33aba5(0xf6)](_0x135612),_0x1df420=await this[_0x33aba5(0x13a)][_0x33aba5(0xf8)](_0x135612),_0x3bc4d7=await this[_0x33aba5(0x13a)][_0x33aba5(0x1a1)](_0x135612),_0x43751f=await this[_0x33aba5(0x13a)]['listIntegrations'](_0x135612),_0x55c79e=await this[_0x33aba5(0x13a)][_0x33aba5(0x183)](_0x135612),_0x54b1ae=await this[_0x33aba5(0x13a)][_0x33aba5(0x126)](_0x135612),_0x2bd56f=await this[_0x33aba5(0x13a)]['listExperimentalArtifacts'](_0x135612),_0x24f349=new Map(),_0x3e2977=new Map(),_0x14d513=new Map(),_0x51a241=new Map(),_0x20f4e2=new Map(),_0xb0be06=new Map(),_0x244568=new Map();for(const _0x160506 of _0x1596fc){_0x24f349[_0x33aba5(0x171)](_0x160506[_0x33aba5(0x170)][_0x33aba5(0xe6)],_0x160506);}for(const _0x204349 of _0x584fea){_0x3e2977[_0x33aba5(0x171)](_0x204349[_0x33aba5(0x170)][_0x33aba5(0xe6)],_0x204349);}for(const _0x1eaea0 of _0x2f25da){_0x14d513['set'](_0x1eaea0[_0x33aba5(0x170)][_0x33aba5(0xe6)],_0x1eaea0);}for(const _0x13aa60 of _0x3bc4d7){_0x51a241[_0x33aba5(0x171)](_0x13aa60['attributes']['name'],_0x13aa60);}for(const _0x206ef8 of _0x43751f){_0x20f4e2[_0x33aba5(0x171)](_0x206ef8[_0x33aba5(0x170)][_0x33aba5(0x143)][_0x33aba5(0x140)](),_0x206ef8);}for(const _0x29b4bc of _0x54b1ae){_0xb0be06['set'](_0x29b4bc[_0x33aba5(0x170)]['name'],_0x29b4bc);}for(const _0x3717c1 of _0x2bd56f){_0x244568[_0x33aba5(0x171)](_0x3717c1['attributes']['name'],_0x3717c1);}const _0x30d058=new Map(),_0x278e3d=new Map(),_0x1b1d2e=new Map(),_0x37c94e=new Map(),_0xd8f4c8=new Map(),_0x2d24be=new Map(),_0x513110=new Map(),_0x1d9dfc=new Map(),_0x4b384c=new Map(),_0x3f1d9a=new Map(),_0xb32ea4=new Map(),_0x4a8640=new Map(),_0xaf0720=new Map(),_0x171297=new Map(),_0x399457=new Map(),_0x1e766c=new Map();for(const _0x4fb4c6 of _0x584fea){_0x30d058[_0x33aba5(0x171)](_0x4fb4c6[_0x33aba5(0x170)]['name'],_0x4fb4c6['id']),_0x4b384c[_0x33aba5(0x171)](_0x4fb4c6['id'],_0x4fb4c6['attributes'][_0x33aba5(0xe6)]);}for(const _0x46d6aa of _0x2f25da){_0x278e3d['set'](_0x46d6aa[_0x33aba5(0x170)][_0x33aba5(0xe6)],_0x46d6aa['id']),_0x3f1d9a[_0x33aba5(0x171)](_0x46d6aa['id'],_0x46d6aa['attributes'][_0x33aba5(0xe6)]);}for(const _0x166c44 of _0x1596fc){_0x1b1d2e[_0x33aba5(0x171)](_0x166c44[_0x33aba5(0x170)][_0x33aba5(0xe6)],_0x166c44['id']),_0xb32ea4['set'](_0x166c44['id'],_0x166c44[_0x33aba5(0x170)][_0x33aba5(0xe6)]);}for(const _0x377dec of _0x131824){_0x37c94e[_0x33aba5(0x171)](_0x377dec[_0x33aba5(0x170)][_0x33aba5(0xe6)],_0x377dec['id']),_0x4a8640[_0x33aba5(0x171)](_0x377dec['id'],_0x377dec['attributes'][_0x33aba5(0xe6)]);}for(const _0x396baf of _0x1df420){_0xd8f4c8[_0x33aba5(0x171)](_0x396baf[_0x33aba5(0x170)][_0x33aba5(0xe6)],_0x396baf['id']),_0xaf0720[_0x33aba5(0x171)](_0x396baf['id'],_0x396baf['attributes']['name']);}for(const _0x535c51 of _0x3bc4d7){_0x2d24be[_0x33aba5(0x171)](_0x535c51[_0x33aba5(0x170)][_0x33aba5(0xe6)],_0x535c51['id']),_0x171297[_0x33aba5(0x171)](_0x535c51['id'],_0x535c51['attributes'][_0x33aba5(0xe6)]);}for(const _0x2517ca of _0x54b1ae){_0x513110[_0x33aba5(0x171)](_0x2517ca[_0x33aba5(0x170)][_0x33aba5(0xe6)],_0x2517ca['id']),_0x399457[_0x33aba5(0x171)](_0x2517ca['id'],_0x2517ca['attributes'][_0x33aba5(0xe6)]);}for(const _0x2f3ad1 of _0x2bd56f){_0x1d9dfc[_0x33aba5(0x171)](_0x2f3ad1[_0x33aba5(0x170)][_0x33aba5(0xe6)],_0x2f3ad1['id']),_0x1e766c[_0x33aba5(0x171)](_0x2f3ad1['id'],_0x2f3ad1[_0x33aba5(0x170)][_0x33aba5(0xe6)]);}const _0x364895={'resolveKnowledgeBaseName':async _0x2d5acf=>_0x4b384c[_0x33aba5(0x123)](_0x2d5acf),'resolveTextKnowledgeBaseName':async _0x3697f9=>_0x3f1d9a[_0x33aba5(0x123)](_0x3697f9),'resolveAgentName':async _0x1ba686=>_0xb32ea4[_0x33aba5(0x123)](_0x1ba686),'resolveWebSearchToolName':async _0x270ca4=>_0xaf0720[_0x33aba5(0x123)](_0x270ca4),'resolveImageGeneratorName':async _0x35e764=>_0x4a8640[_0x33aba5(0x123)](_0x35e764),'resolvePromptName':async _0x55165f=>_0x171297['get'](_0x55165f),'resolveExperimentalKnowledgeBaseName':async _0x1df418=>_0x399457[_0x33aba5(0x123)](_0x1df418),'onWarning':_0x11e0b3=>this[_0x33aba5(0x1af)][_0x33aba5(0x14f)](_0x11e0b3)};let _0x481c11=[];const _0x4d26ca={'projectId':_0x135612,'resolveKnowledgeBaseId':async _0x928401=>_0x30d058[_0x33aba5(0x123)](_0x928401),'resolveTextKnowledgeBaseId':async _0x15e9f6=>_0x278e3d[_0x33aba5(0x123)](_0x15e9f6),'resolveAgentId':async _0x4cc63c=>_0x1b1d2e[_0x33aba5(0x123)](_0x4cc63c),'resolveWebSearchToolId':async _0x3bff29=>_0xd8f4c8['get'](_0x3bff29),'resolveImageGeneratorId':async _0x3e2b55=>_0x37c94e[_0x33aba5(0x123)](_0x3e2b55),'resolvePromptId':async _0x18e9a7=>_0x2d24be[_0x33aba5(0x123)](_0x18e9a7),'resolveParentSegmentKBId':async()=>_0x55c79e?.['id'],'resolveExperimentalKnowledgeBaseId':async _0x136f07=>_0x513110[_0x33aba5(0x123)](_0x136f07),'onWarning':_0x25ff5b=>{const _0x27c007=_0x33aba5;this[_0x27c007(0x1af)][_0x27c007(0x14f)](_0x25ff5b),_0x481c11[_0x27c007(0x146)](_0x25ff5b);}},{resolved:_0x138d6b,unresolved:_0x9fe08}=resolveAgentDependencies(_0x130063,new Set(_0x24f349[_0x33aba5(0x16c)]()));for(const {agent:_0x1de81c,missingDeps:_0x450ae9}of _0x9fe08){_0x20b4e4['agents'][_0x33aba5(0x146)]({'agentName':_0x1de81c[_0x33aba5(0x134)]['name'],'action':_0x33aba5(0xf0),'error':_0x33aba5(0x1bf)+_0x450ae9[_0x33aba5(0xfc)](',\x20')+_0x33aba5(0x1d0)}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x166)]['errors']++;}for(const _0x5c0412 of _0x87a8bf){const _0x203d65=_0x3e2977[_0x33aba5(0x123)](_0x5c0412[_0x33aba5(0x134)][_0x33aba5(0xe6)]),_0x534a13=a96_0x3256d2[_0x33aba5(0x15e)](_0x5c0412['path'],_0x33aba5(0x153));if(_0x203d65){const _0x5b0d55=apiKnowledgeBaseToYaml(_0x203d65),_0x326cd9=toKnowledgeBaseYamlString(_0x5b0d55),_0x2fc90e=generateDiff(_0x326cd9,_0x534a13),_0x1c916e=hasChanges(_0x2fc90e);_0x1c916e?(_0x20b4e4[_0x33aba5(0x165)][_0x33aba5(0x146)]({'name':_0x5c0412[_0x33aba5(0x134)][_0x33aba5(0xe6)],'action':_0x33aba5(0x1d1),'id':_0x203d65['id'],'diff':formatDiffWithColors(_0x2fc90e)}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x165)][_0x33aba5(0x1d1)]++):(_0x20b4e4['knowledgeBases'][_0x33aba5(0x146)]({'name':_0x5c0412[_0x33aba5(0x134)][_0x33aba5(0xe6)],'action':_0x33aba5(0x15d),'id':_0x203d65['id']}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x165)]['unchanged']++);}else _0x20b4e4[_0x33aba5(0x165)][_0x33aba5(0x146)]({'name':_0x5c0412[_0x33aba5(0x134)][_0x33aba5(0xe6)],'action':_0x33aba5(0x1ba)}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x165)][_0x33aba5(0x1ba)]++;}for(const _0x235dc8 of _0x74c513){const _0x578990=_0x14d513['get'](_0x235dc8[_0x33aba5(0xe6)]),_0x4d1ed7=a96_0x3256d2[_0x33aba5(0x15e)](_0x235dc8['path'],'utf-8');if(_0x578990){const _0x8b08eb=toTextKnowledgeBaseMd(_0x578990['attributes'][_0x33aba5(0xe6)],_0x578990[_0x33aba5(0x170)][_0x33aba5(0xf2)]),_0x4fce2b=generateDiff(_0x8b08eb,_0x4d1ed7),_0x46b6fd=hasChanges(_0x4fce2b);_0x46b6fd?(_0x20b4e4[_0x33aba5(0x128)][_0x33aba5(0x146)]({'name':_0x235dc8[_0x33aba5(0xe6)],'action':_0x33aba5(0x1d1),'id':_0x578990['id'],'diff':formatDiffWithColors(_0x4fce2b)}),_0x20b4e4['counts'][_0x33aba5(0x128)][_0x33aba5(0x1d1)]++):(_0x20b4e4[_0x33aba5(0x128)][_0x33aba5(0x146)]({'name':_0x235dc8[_0x33aba5(0xe6)],'action':_0x33aba5(0x15d),'id':_0x578990['id']}),_0x20b4e4[_0x33aba5(0x1cc)]['textKnowledgeBases'][_0x33aba5(0x15d)]++);}else _0x20b4e4['textKnowledgeBases'][_0x33aba5(0x146)]({'name':_0x235dc8[_0x33aba5(0xe6)],'action':_0x33aba5(0x1ba)}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x128)][_0x33aba5(0x1ba)]++;}for(const _0x2426b4 of _0x138d6b){const _0x154a00=_0x24f349[_0x33aba5(0x123)](_0x2426b4[_0x33aba5(0x134)][_0x33aba5(0xe6)]),_0x281d39=a96_0x43c449[_0x33aba5(0xfc)](_0x2426b4[_0x33aba5(0x1b7)],_0x33aba5(0x16b)),_0xec041a=a96_0x3256d2['readFileSync'](_0x281d39,_0x33aba5(0x153)),_0x5e25e3=_0x2426b4[_0x33aba5(0x1b9)],_0xbc80d3=_0x33aba5(0x116)+_0x5e25e3+'\x0a\x0a#\x20agent.yml\x0a'+_0xec041a;if(_0x154a00){const {yaml:_0x33a62c,systemPrompt:_0x4aa0ba}=await agentResponseToDef(_0x154a00,_0x364895),_0x21b146=toAgentYamlString(_0x33a62c),_0x207624=_0x33aba5(0x116)+_0x4aa0ba+_0x33aba5(0x13c)+_0x21b146,_0xb2a5c8=generateDiff(_0x207624,_0xbc80d3),_0x50f14d=hasChanges(_0xb2a5c8);_0x50f14d?(_0x20b4e4[_0x33aba5(0x166)]['push']({'agentName':_0x2426b4[_0x33aba5(0x134)]['name'],'action':'updated','agentId':_0x154a00['id'],'diff':formatDiffWithColors(_0xb2a5c8)}),_0x20b4e4['counts'][_0x33aba5(0x166)][_0x33aba5(0x1d1)]++):(_0x20b4e4[_0x33aba5(0x166)]['push']({'agentName':_0x2426b4['yaml'][_0x33aba5(0xe6)],'action':_0x33aba5(0x15d),'agentId':_0x154a00['id']}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x166)][_0x33aba5(0x15d)]++);}else _0x20b4e4[_0x33aba5(0x166)]['push']({'agentName':_0x2426b4[_0x33aba5(0x134)][_0x33aba5(0xe6)],'action':_0x33aba5(0x1ba)}),_0x20b4e4[_0x33aba5(0x1cc)]['agents']['created']++;}for(const _0x419803 of _0x19a9ce){const _0x48819a=_0x51a241[_0x33aba5(0x123)](_0x419803['yaml'][_0x33aba5(0xe6)]),_0x109d4f=a96_0x3256d2[_0x33aba5(0x15e)](_0x419803[_0x33aba5(0xec)],_0x33aba5(0x153));if(_0x48819a){const _0x2becee=await apiPromptToYaml(_0x48819a,_0x364895);if(!_0x2becee){_0x20b4e4['prompts']['push']({'name':_0x419803['yaml']['name'],'action':_0x33aba5(0x1d1),'id':_0x48819a['id']}),_0x20b4e4[_0x33aba5(0x1cc)]['prompts']['updated']++;continue;}const _0x295bc3=toPromptYamlString(_0x2becee),_0x2db5c4=generateDiff(_0x295bc3,_0x109d4f),_0x994ee4=hasChanges(_0x2db5c4);_0x994ee4?(_0x20b4e4['prompts'][_0x33aba5(0x146)]({'name':_0x419803['yaml'][_0x33aba5(0xe6)],'action':_0x33aba5(0x1d1),'id':_0x48819a['id'],'diff':formatDiffWithColors(_0x2db5c4)}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x10e)]['updated']++):(_0x20b4e4['prompts'][_0x33aba5(0x146)]({'name':_0x419803[_0x33aba5(0x134)][_0x33aba5(0xe6)],'action':'unchanged','id':_0x48819a['id']}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x10e)][_0x33aba5(0x15d)]++);}else _0x20b4e4[_0x33aba5(0x10e)][_0x33aba5(0x146)]({'name':_0x419803[_0x33aba5(0x134)][_0x33aba5(0xe6)],'action':_0x33aba5(0x1ba)}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x10e)]['created']++;}for(const _0x25be6d of _0x1d9f33){const _0x2a8a0a=_0x20f4e2[_0x33aba5(0x123)](_0x25be6d['yaml'][_0x33aba5(0x1d5)]),_0x283890=a96_0x3256d2[_0x33aba5(0x15e)](_0x25be6d['path'],_0x33aba5(0x153));if(_0x2a8a0a){const _0x19e6b2=await apiIntegrationToYaml(_0x2a8a0a,_0x364895),_0x2ef4cd=toIntegrationYamlString(_0x19e6b2),_0x4a51b2=generateDiff(_0x2ef4cd,_0x283890),_0x45c099=hasChanges(_0x4a51b2);_0x45c099?(_0x20b4e4[_0x33aba5(0x188)][_0x33aba5(0x146)]({'name':_0x25be6d[_0x33aba5(0x134)][_0x33aba5(0x1d5)],'action':_0x33aba5(0x1d1),'id':_0x2a8a0a['id'],'diff':formatDiffWithColors(_0x4a51b2)}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x188)][_0x33aba5(0x1d1)]++):(_0x20b4e4['integrations'][_0x33aba5(0x146)]({'name':_0x25be6d[_0x33aba5(0x134)][_0x33aba5(0x1d5)],'action':'unchanged','id':_0x2a8a0a['id']}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x188)][_0x33aba5(0x15d)]++);}else _0x20b4e4[_0x33aba5(0x188)][_0x33aba5(0x146)]({'name':_0x25be6d[_0x33aba5(0x134)][_0x33aba5(0x1d5)],'action':_0x33aba5(0x1ba)}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x188)][_0x33aba5(0x1ba)]++;}for(const _0x17a035 of _0x8c68d4){const _0x189f3b=_0xb0be06[_0x33aba5(0x123)](_0x17a035[_0x33aba5(0x130)]['name']),_0x2fd273=toExperimentalKnowledgeBaseYamlString(_0x17a035[_0x33aba5(0x130)]);let _0x579573=_0x2fd273;for(const _0x25b21d of _0x17a035[_0x33aba5(0x130)][_0x33aba5(0xe4)]){_0x579573+=_0x33aba5(0x169)+_0x25b21d[_0x33aba5(0xe6)]+_0x33aba5(0x11c)+_0x25b21d[_0x33aba5(0x1df)]+_0x33aba5(0x1a5)+_0x25b21d[_0x33aba5(0xe6)]+_0x33aba5(0x11c)+_0x25b21d['json_schema']+'\x0a';}if(_0x189f3b){const _0x11d6b9=apiExperimentalKnowledgeBaseToYaml(_0x189f3b),_0x1d5c2c=toExperimentalKnowledgeBaseYamlString(_0x11d6b9);let _0x1f75dd=_0x1d5c2c;for(const _0x56b703 of _0x11d6b9['functions']){_0x1f75dd+=_0x33aba5(0x169)+_0x56b703[_0x33aba5(0xe6)]+_0x33aba5(0x11c)+_0x56b703[_0x33aba5(0x1df)]+_0x33aba5(0x1a5)+_0x56b703['name']+'\x20---\x0a'+_0x56b703[_0x33aba5(0x1e3)]+'\x0a';}const _0x49becc=generateDiff(_0x1f75dd,_0x579573),_0x578bf6=hasChanges(_0x49becc);_0x578bf6?(_0x20b4e4[_0x33aba5(0x11e)][_0x33aba5(0x146)]({'name':_0x17a035[_0x33aba5(0x130)][_0x33aba5(0xe6)],'action':'updated','id':_0x189f3b['id'],'diff':formatDiffWithColors(_0x49becc)}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x11e)][_0x33aba5(0x1d1)]++):(_0x20b4e4[_0x33aba5(0x11e)][_0x33aba5(0x146)]({'name':_0x17a035[_0x33aba5(0x130)]['name'],'action':_0x33aba5(0x15d),'id':_0x189f3b['id']}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x11e)][_0x33aba5(0x15d)]++);}else _0x20b4e4[_0x33aba5(0x11e)][_0x33aba5(0x146)]({'name':_0x17a035['def'][_0x33aba5(0xe6)],'action':_0x33aba5(0x1ba)}),_0x20b4e4[_0x33aba5(0x1cc)]['experimentalKnowledgeBases'][_0x33aba5(0x1ba)]++;}for(const _0x2dbc82 of _0x1cc0c8){const _0x21bb54=_0x244568[_0x33aba5(0x123)](_0x2dbc82[_0x33aba5(0x130)][_0x33aba5(0xe6)]),_0x3fa38a=toExperimentalArtifactYamlString(_0x2dbc82['def']);let _0x5be33=_0x3fa38a+(_0x33aba5(0x12e)+_0x2dbc82[_0x33aba5(0x130)][_0x33aba5(0x1df)]+'\x0a');for(const _0x220bba of _0x2dbc82['def']['files']){_0x5be33+=_0x33aba5(0x1ee)+_0x220bba[_0x33aba5(0xed)]+'\x20---\x0a'+_0x220bba[_0x33aba5(0x162)]+'\x0a';}if(_0x21bb54){const _0x4261db=apiExperimentalArtifactToYaml(_0x21bb54),_0x54b203=toExperimentalArtifactYamlString(_0x4261db);let _0x311a01=_0x54b203+('\x0a---\x20code\x20---\x0a'+_0x4261db[_0x33aba5(0x1df)]+'\x0a');for(const _0x38904a of _0x4261db[_0x33aba5(0x1c5)]){_0x311a01+='---\x20file:\x20'+_0x38904a['file_name']+_0x33aba5(0x11c)+_0x38904a['text_content']+'\x0a';}const _0x33aa12=generateDiff(_0x311a01,_0x5be33),_0x47cd26=hasChanges(_0x33aa12);_0x47cd26?(_0x20b4e4[_0x33aba5(0x14e)][_0x33aba5(0x146)]({'name':_0x2dbc82[_0x33aba5(0x130)][_0x33aba5(0xe6)],'action':'updated','id':_0x21bb54['id'],'diff':formatDiffWithColors(_0x33aa12)}),_0x20b4e4[_0x33aba5(0x1cc)]['experimentalArtifacts'][_0x33aba5(0x1d1)]++):(_0x20b4e4[_0x33aba5(0x14e)][_0x33aba5(0x146)]({'name':_0x2dbc82[_0x33aba5(0x130)][_0x33aba5(0xe6)],'action':_0x33aba5(0x15d),'id':_0x21bb54['id']}),_0x20b4e4['counts'][_0x33aba5(0x14e)][_0x33aba5(0x15d)]++);}else _0x20b4e4[_0x33aba5(0x14e)][_0x33aba5(0x146)]({'name':_0x2dbc82['def']['name'],'action':_0x33aba5(0x1ba)}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x14e)][_0x33aba5(0x1ba)]++;}if(_0x526eeb?.[_0x33aba5(0x17c)])return _0x20b4e4;_0x20b4e4[_0x33aba5(0x165)]=[],_0x20b4e4[_0x33aba5(0x128)]=[],_0x20b4e4[_0x33aba5(0x10e)]=[],_0x20b4e4[_0x33aba5(0x188)]=[],_0x20b4e4['experimentalKnowledgeBases']=[],_0x20b4e4[_0x33aba5(0x14e)]=[];const _0x9cc660=_0x20b4e4[_0x33aba5(0x166)]['filter'](_0x5b9a6f=>_0x5b9a6f[_0x33aba5(0x1a7)]===_0x33aba5(0xf0));_0x20b4e4[_0x33aba5(0x166)]=_0x9cc660,_0x20b4e4[_0x33aba5(0x1cc)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x9cc660[_0x33aba5(0x1ea)]},'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 _0x322a8f of _0x87a8bf){try{const _0x35f1f6=_0x3e2977[_0x33aba5(0x123)](_0x322a8f[_0x33aba5(0x134)][_0x33aba5(0xe6)]),_0x3df148=yamlKnowledgeBaseToApi(_0x322a8f[_0x33aba5(0x134)],_0x135612);if(_0x35f1f6)await this['client']['updateKnowledgeBase'](_0x35f1f6['id'],_0x3df148),_0x30d058[_0x33aba5(0x171)](_0x322a8f[_0x33aba5(0x134)]['name'],_0x35f1f6['id']),_0x20b4e4[_0x33aba5(0x165)][_0x33aba5(0x146)]({'name':_0x322a8f['yaml']['name'],'action':_0x33aba5(0x1d1),'id':_0x35f1f6['id']}),_0x20b4e4[_0x33aba5(0x1cc)]['knowledgeBases'][_0x33aba5(0x1d1)]++;else{const _0x334cc1=await this['client']['createKnowledgeBase'](_0x3df148);_0x30d058[_0x33aba5(0x171)](_0x322a8f[_0x33aba5(0x134)][_0x33aba5(0xe6)],_0x334cc1['id']),_0x20b4e4[_0x33aba5(0x165)]['push']({'name':_0x322a8f[_0x33aba5(0x134)][_0x33aba5(0xe6)],'action':_0x33aba5(0x1ba),'id':_0x334cc1['id']}),_0x20b4e4[_0x33aba5(0x1cc)]['knowledgeBases']['created']++;}}catch(_0x5d362e){_0x20b4e4[_0x33aba5(0x165)][_0x33aba5(0x146)]({'name':_0x322a8f[_0x33aba5(0x134)][_0x33aba5(0xe6)],'action':_0x33aba5(0xf0),'error':_0x5d362e[_0x33aba5(0x191)]}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x165)][_0x33aba5(0xfe)]++;}}for(const _0x37350f of _0x74c513){try{const _0x483cc1=_0x14d513[_0x33aba5(0x123)](_0x37350f[_0x33aba5(0xe6)]),_0x189c96=yamlTextKnowledgeBaseToApi({'name':_0x37350f[_0x33aba5(0xe6)],'text':_0x37350f[_0x33aba5(0xf2)]},_0x135612);if(_0x483cc1)await this[_0x33aba5(0x13a)]['updateTextKnowledgeBase'](_0x483cc1['id'],_0x189c96),_0x278e3d[_0x33aba5(0x171)](_0x37350f[_0x33aba5(0xe6)],_0x483cc1['id']),_0x20b4e4[_0x33aba5(0x128)][_0x33aba5(0x146)]({'name':_0x37350f[_0x33aba5(0xe6)],'action':_0x33aba5(0x1d1),'id':_0x483cc1['id']}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x128)][_0x33aba5(0x1d1)]++;else{const _0x3260e0=await this[_0x33aba5(0x13a)][_0x33aba5(0x136)](_0x189c96);_0x278e3d[_0x33aba5(0x171)](_0x37350f['name'],_0x3260e0['id']),_0x20b4e4[_0x33aba5(0x128)]['push']({'name':_0x37350f[_0x33aba5(0xe6)],'action':_0x33aba5(0x1ba),'id':_0x3260e0['id']}),_0x20b4e4[_0x33aba5(0x1cc)]['textKnowledgeBases'][_0x33aba5(0x1ba)]++;}}catch(_0x247be7){_0x20b4e4['textKnowledgeBases'][_0x33aba5(0x146)]({'name':_0x37350f[_0x33aba5(0xe6)],'action':_0x33aba5(0xf0),'error':_0x247be7['message']}),_0x20b4e4[_0x33aba5(0x1cc)]['textKnowledgeBases']['errors']++;}}for(const _0x3c5290 of _0x8c68d4){try{const _0x19c686=_0xb0be06['get'](_0x3c5290[_0x33aba5(0x130)]['name']),_0x1c3b50=yamlExperimentalKnowledgeBaseToApi(_0x3c5290['def'],_0x135612);if(_0x19c686)await this[_0x33aba5(0x13a)][_0x33aba5(0x1c3)](_0x19c686['id'],_0x1c3b50),_0x513110[_0x33aba5(0x171)](_0x3c5290[_0x33aba5(0x130)][_0x33aba5(0xe6)],_0x19c686['id']),_0x20b4e4[_0x33aba5(0x11e)]['push']({'name':_0x3c5290[_0x33aba5(0x130)][_0x33aba5(0xe6)],'action':_0x33aba5(0x1d1),'id':_0x19c686['id']}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x11e)]['updated']++;else{const _0x4a044f=await this['client'][_0x33aba5(0x1c4)](_0x1c3b50);_0x513110[_0x33aba5(0x171)](_0x3c5290[_0x33aba5(0x130)][_0x33aba5(0xe6)],_0x4a044f['id']),_0x20b4e4[_0x33aba5(0x11e)][_0x33aba5(0x146)]({'name':_0x3c5290[_0x33aba5(0x130)][_0x33aba5(0xe6)],'action':_0x33aba5(0x1ba),'id':_0x4a044f['id']}),_0x20b4e4['counts'][_0x33aba5(0x11e)][_0x33aba5(0x1ba)]++;}}catch(_0x2832b5){_0x20b4e4[_0x33aba5(0x11e)]['push']({'name':_0x3c5290['def']['name'],'action':_0x33aba5(0xf0),'error':_0x2832b5[_0x33aba5(0x191)]}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x11e)][_0x33aba5(0xfe)]++;}}for(const _0x485daa of _0x1cc0c8){try{const _0xd80b6e=_0x244568[_0x33aba5(0x123)](_0x485daa['def'][_0x33aba5(0xe6)]),_0x1adb46=yamlExperimentalArtifactToApi(_0x485daa['def'],_0x135612);if(_0xd80b6e)await this['client'][_0x33aba5(0x1be)](_0xd80b6e['id'],_0x1adb46),_0x1d9dfc[_0x33aba5(0x171)](_0x485daa[_0x33aba5(0x130)][_0x33aba5(0xe6)],_0xd80b6e['id']),_0x20b4e4[_0x33aba5(0x14e)][_0x33aba5(0x146)]({'name':_0x485daa[_0x33aba5(0x130)][_0x33aba5(0xe6)],'action':_0x33aba5(0x1d1),'id':_0xd80b6e['id']}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x14e)][_0x33aba5(0x1d1)]++;else{const _0x57b8b7=await this[_0x33aba5(0x13a)][_0x33aba5(0xf7)](_0x1adb46);_0x1d9dfc[_0x33aba5(0x171)](_0x485daa['def'][_0x33aba5(0xe6)],_0x57b8b7['id']),_0x20b4e4['experimentalArtifacts']['push']({'name':_0x485daa[_0x33aba5(0x130)][_0x33aba5(0xe6)],'action':_0x33aba5(0x1ba),'id':_0x57b8b7['id']}),_0x20b4e4['counts'][_0x33aba5(0x14e)]['created']++;}}catch(_0x595377){_0x20b4e4[_0x33aba5(0x14e)][_0x33aba5(0x146)]({'name':_0x485daa[_0x33aba5(0x130)][_0x33aba5(0xe6)],'action':_0x33aba5(0xf0),'error':_0x595377['message']}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x14e)][_0x33aba5(0xfe)]++;}}for(const _0x4747c0 of _0x138d6b){_0x481c11=[];try{const _0x543fa1=_0x24f349['get'](_0x4747c0[_0x33aba5(0x134)][_0x33aba5(0xe6)]),_0x32a73f=await agentDefToRequest(_0x4747c0[_0x33aba5(0x134)],_0x4747c0[_0x33aba5(0x1b9)],_0x4747c0['starterMessage'],_0x4d26ca);if(_0x543fa1)await this[_0x33aba5(0x13a)][_0x33aba5(0x132)](_0x543fa1['id'],_0x32a73f),_0x1b1d2e[_0x33aba5(0x171)](_0x4747c0[_0x33aba5(0x134)]['name'],_0x543fa1['id']),_0x20b4e4[_0x33aba5(0x166)]['push']({'agentName':_0x4747c0[_0x33aba5(0x134)][_0x33aba5(0xe6)],'action':_0x33aba5(0x1d1),'agentId':_0x543fa1['id'],'warnings':_0x481c11[_0x33aba5(0x1ea)]>0x0?_0x481c11:undefined}),_0x20b4e4['counts'][_0x33aba5(0x166)][_0x33aba5(0x1d1)]++;else{const _0x31ac94=await this[_0x33aba5(0x13a)][_0x33aba5(0xfa)](_0x32a73f);_0x1b1d2e[_0x33aba5(0x171)](_0x4747c0[_0x33aba5(0x134)][_0x33aba5(0xe6)],_0x31ac94['id']),_0x20b4e4[_0x33aba5(0x166)][_0x33aba5(0x146)]({'agentName':_0x4747c0[_0x33aba5(0x134)][_0x33aba5(0xe6)],'action':_0x33aba5(0x1ba),'agentId':_0x31ac94['id'],'warnings':_0x481c11[_0x33aba5(0x1ea)]>0x0?_0x481c11:undefined}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x166)][_0x33aba5(0x1ba)]++;}}catch(_0x2e93e2){_0x20b4e4[_0x33aba5(0x166)][_0x33aba5(0x146)]({'agentName':_0x4747c0[_0x33aba5(0x134)][_0x33aba5(0xe6)],'action':'error','error':_0x2e93e2[_0x33aba5(0x191)],'warnings':_0x481c11[_0x33aba5(0x1ea)]>0x0?_0x481c11:undefined}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x166)]['errors']++;}}for(const _0x375a28 of _0x19a9ce){try{const _0x21eba8=_0x51a241['get'](_0x375a28[_0x33aba5(0x134)][_0x33aba5(0xe6)]),_0x35f48a=await yamlPromptToApi(_0x375a28[_0x33aba5(0x134)],_0x135612,_0x4d26ca);if(!_0x35f48a){_0x20b4e4[_0x33aba5(0x10e)]['push']({'name':_0x375a28[_0x33aba5(0x134)][_0x33aba5(0xe6)],'action':'error','error':_0x33aba5(0x1d8)}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x10e)][_0x33aba5(0xfe)]++;continue;}if(_0x21eba8)await this['client']['updatePrompt'](_0x21eba8['id'],_0x35f48a),_0x2d24be[_0x33aba5(0x171)](_0x375a28['yaml'][_0x33aba5(0xe6)],_0x21eba8['id']),_0x20b4e4[_0x33aba5(0x10e)]['push']({'name':_0x375a28['yaml'][_0x33aba5(0xe6)],'action':_0x33aba5(0x1d1),'id':_0x21eba8['id']}),_0x20b4e4['counts']['prompts'][_0x33aba5(0x1d1)]++;else{const _0x892a91=await this[_0x33aba5(0x13a)][_0x33aba5(0x19e)](_0x35f48a);_0x2d24be[_0x33aba5(0x171)](_0x375a28[_0x33aba5(0x134)][_0x33aba5(0xe6)],_0x892a91['id']),_0x20b4e4['prompts'][_0x33aba5(0x146)]({'name':_0x375a28[_0x33aba5(0x134)][_0x33aba5(0xe6)],'action':_0x33aba5(0x1ba),'id':_0x892a91['id']}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x10e)][_0x33aba5(0x1ba)]++;}}catch(_0x1fc81c){_0x20b4e4[_0x33aba5(0x10e)]['push']({'name':_0x375a28[_0x33aba5(0x134)][_0x33aba5(0xe6)],'action':_0x33aba5(0xf0),'error':_0x1fc81c[_0x33aba5(0x191)]}),_0x20b4e4['counts'][_0x33aba5(0x10e)][_0x33aba5(0xfe)]++;}}for(const _0x183d9a of _0x1d9f33){try{const _0x552fbf=_0x20f4e2[_0x33aba5(0x123)](_0x183d9a[_0x33aba5(0x134)][_0x33aba5(0x1d5)]),_0x359342=await yamlIntegrationToApi(_0x183d9a[_0x33aba5(0x134)],_0x135612,_0x4d26ca);if(_0x552fbf){await this[_0x33aba5(0x13a)][_0x33aba5(0x179)](_0x552fbf['id']);const _0x4ac257=await this['client'][_0x33aba5(0x1a8)](_0x359342);_0x20b4e4['integrations']['push']({'name':_0x183d9a[_0x33aba5(0x134)][_0x33aba5(0x1d5)],'action':_0x33aba5(0x1d1),'id':_0x4ac257['id']}),_0x20b4e4['counts'][_0x33aba5(0x188)][_0x33aba5(0x1d1)]++;}else{const _0x4a8eb1=await this[_0x33aba5(0x13a)]['createIntegration'](_0x359342);_0x20b4e4[_0x33aba5(0x188)][_0x33aba5(0x146)]({'name':_0x183d9a[_0x33aba5(0x134)][_0x33aba5(0x1d5)],'action':_0x33aba5(0x1ba),'id':_0x4a8eb1['id']}),_0x20b4e4[_0x33aba5(0x1cc)]['integrations'][_0x33aba5(0x1ba)]++;}}catch(_0x3d1346){_0x20b4e4[_0x33aba5(0x188)]['push']({'name':_0x183d9a[_0x33aba5(0x134)][_0x33aba5(0x1d5)],'action':_0x33aba5(0xf0),'error':_0x3d1346['message']}),_0x20b4e4[_0x33aba5(0x1cc)][_0x33aba5(0x188)][_0x33aba5(0xfe)]++;}}return _0x20b4e4;}async[a96_0x8551a0(0x1c0)](_0x4c1700,_0x3b5b2f,_0x5482de,_0x31f2ec){const _0x3fdd50=a96_0x8551a0,{projectId:_0x50d52b,project:_0x2671d4}=await this[_0x3fdd50(0x102)](_0x4c1700),_0x3fa9cb=_0x2671d4[_0x3fdd50(0x170)][_0x3fdd50(0xe6)],_0x4f687f=await this['client']['listAgentsFull'](_0x50d52b),_0x3567aa=_0x4f687f['find'](_0x25d260=>_0x25d260['attributes'][_0x3fdd50(0xe6)]===_0x3b5b2f);if(!_0x3567aa)throw new SDKError(ErrorCode[_0x3fdd50(0x18e)],_0x3fdd50(0x1ac)+_0x3b5b2f,undefined,{'helpText':_0x3fdd50(0x16e)+_0x4f687f[_0x3fdd50(0x19a)](_0x584e7b=>_0x584e7b[_0x3fdd50(0x170)]['name'])[_0x3fdd50(0xfc)](',\x20')});let _0x6bb6c7;if(_0x5482de)_0x6bb6c7=_0x5482de;else{const _0x2dc472=a96_0x43c449[_0x3fdd50(0xfc)](process['cwd'](),'agents'),_0x16be28=getSanitizedPathWithMigration(_0x2dc472,_0x3fa9cb);_0x16be28[_0x3fdd50(0xfd)]&&this[_0x3fdd50(0x1af)][_0x3fdd50(0x196)](_0x3fdd50(0x187)+a96_0x43c449[_0x3fdd50(0x12c)](_0x16be28[_0x3fdd50(0x12d)])+_0x3fdd50(0x176)+a96_0x43c449[_0x3fdd50(0x12c)](_0x16be28[_0x3fdd50(0xec)])),_0x6bb6c7=_0x16be28[_0x3fdd50(0xec)];}const _0x328d32=getSanitizedPathWithMigration(_0x6bb6c7,_0x3b5b2f);_0x328d32[_0x3fdd50(0xfd)]&&this[_0x3fdd50(0x1af)][_0x3fdd50(0x196)](_0x3fdd50(0xe9)+a96_0x43c449['basename'](_0x328d32[_0x3fdd50(0x12d)])+'\x20→\x20'+a96_0x43c449[_0x3fdd50(0x12c)](_0x328d32['path']));const _0x43ac39=_0x328d32['path'],_0x327614=new Map(),_0x2a35b9=new Map(),_0x461615=await this[_0x3fdd50(0x13a)]['listKnowledgeBases'](_0x50d52b),_0x3b8bc7=await this['client'][_0x3fdd50(0x151)](_0x50d52b),_0x4aff7b=await this['client']['listExperimentalKnowledgeBases'](_0x50d52b),_0x2a2e7d=new Map(),_0x1cb6e5=new Map();for(const _0x41dcc0 of _0x461615){_0x327614['set'](_0x41dcc0['id'],_0x41dcc0[_0x3fdd50(0x170)]['name']);}for(const _0x394a2d of _0x3b8bc7){_0x2a2e7d[_0x3fdd50(0x171)](_0x394a2d['id'],_0x394a2d[_0x3fdd50(0x170)]['name']);}for(const _0x12e6bd of _0x4aff7b){_0x1cb6e5['set'](_0x12e6bd['id'],_0x12e6bd['attributes'][_0x3fdd50(0xe6)]);}for(const _0x32baae of _0x4f687f){_0x2a35b9[_0x3fdd50(0x171)](_0x32baae['id'],_0x32baae[_0x3fdd50(0x170)]['name']);}const _0x2d9738={'resolveKnowledgeBaseName':async _0x417684=>_0x327614[_0x3fdd50(0x123)](_0x417684),'resolveTextKnowledgeBaseName':async _0x41bff0=>_0x2a2e7d[_0x3fdd50(0x123)](_0x41bff0),'resolveAgentName':async _0xb1bcbb=>_0x2a35b9[_0x3fdd50(0x123)](_0xb1bcbb),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async()=>undefined,'resolveExperimentalKnowledgeBaseName':async _0x160dca=>_0x1cb6e5[_0x3fdd50(0x123)](_0x160dca),'onWarning':_0x3358af=>this[_0x3fdd50(0x1af)][_0x3fdd50(0x14f)](_0x3358af)},_0x28ffe4=a96_0x43c449[_0x3fdd50(0xfc)](_0x43ac39,_0x3fdd50(0x160)),_0xfc07a8=a96_0x43c449[_0x3fdd50(0xfc)](_0x43ac39,_0x3fdd50(0x16b)),_0x4628ce=a96_0x43c449[_0x3fdd50(0xfc)](_0x43ac39,_0x3fdd50(0x1aa)),_0x29b379=!a96_0x3256d2[_0x3fdd50(0x1a0)](_0xfc07a8);if(_0x31f2ec?.[_0x3fdd50(0x17c)])return{'agentName':_0x3b5b2f,'outputPath':_0x43ac39,'isNew':_0x29b379,'hasChanges':!![]};a96_0x3256d2[_0x3fdd50(0x178)](_0x6bb6c7,{'recursive':!![]}),a96_0x3256d2[_0x3fdd50(0x178)](_0x43ac39,{'recursive':!![]});const _0x2f7bfc=a96_0x43c449[_0x3fdd50(0xfc)](_0x6bb6c7,_0x3fdd50(0xee));!a96_0x3256d2[_0x3fdd50(0x1a0)](_0x2f7bfc)&&a96_0x3256d2['writeFileSync'](_0x2f7bfc,createAgentConfigContent(_0x4c1700));const {yaml:_0x70a636,systemPrompt:_0x2c67b9,starterMessage:_0x3659ad}=await agentResponseToDef(_0x3567aa,_0x2d9738);let _0x14f549=_0x29b379;if(!_0x29b379){const _0x2e05bb=a96_0x3256d2[_0x3fdd50(0x1a0)](_0x28ffe4)?a96_0x3256d2[_0x3fdd50(0x15e)](_0x28ffe4,'utf-8'):'',_0x2930c8=a96_0x3256d2[_0x3fdd50(0x15e)](_0xfc07a8,_0x3fdd50(0x153));_0x14f549=_0x2e05bb!==_0x2c67b9||_0x2930c8!==toAgentYamlString(_0x70a636);}a96_0x3256d2[_0x3fdd50(0xf3)](_0x28ffe4,_0x2c67b9),a96_0x3256d2[_0x3fdd50(0xf3)](_0xfc07a8,toAgentYamlString(_0x70a636));if(_0x3659ad&&_0x3659ad[_0x3fdd50(0xeb)]('\x0a'))a96_0x3256d2[_0x3fdd50(0xf3)](_0x4628ce,_0x3659ad);else a96_0x3256d2[_0x3fdd50(0x1a0)](_0x4628ce)&&a96_0x3256d2['unlinkSync'](_0x4628ce);return{'agentName':_0x3b5b2f,'outputPath':_0x43ac39,'isNew':_0x29b379,'hasChanges':_0x14f549};}async[a96_0x8551a0(0x105)](_0x2e41a4,_0x4c7e43){const _0x3fd951=a96_0x8551a0;let _0x2f3522;isAgentYamlPath(_0x2e41a4)?_0x2f3522=getAgentDirFromYamlPath(_0x2e41a4):_0x2f3522=_0x2e41a4;const {config:_0x46c83c}=findAgentConfig(_0x2f3522),_0xe051bd=await this[_0x3fd951(0x161)](_0x46c83c[_0x3fd951(0x144)]),_0xc4f42f=a96_0x43c449[_0x3fd951(0xfc)](_0x2f3522,'agent.yml'),_0x186018=a96_0x43c449['join'](_0x2f3522,'prompt.md'),_0x48314c=a96_0x43c449[_0x3fd951(0xfc)](_0x2f3522,_0x3fd951(0x1aa));if(!a96_0x3256d2[_0x3fd951(0x1a0)](_0xc4f42f))throw new SDKError(ErrorCode[_0x3fd951(0x1f5)],'agent.yml\x20not\x20found\x20in\x20'+_0x2f3522,undefined,{'helpText':_0x3fd951(0x1b6)});const _0x2bf45a=parseAgentYaml(a96_0x3256d2[_0x3fd951(0x15e)](_0xc4f42f,_0x3fd951(0x153)),_0xc4f42f),_0x31454e=a96_0x3256d2[_0x3fd951(0x1a0)](_0x186018)?a96_0x3256d2['readFileSync'](_0x186018,_0x3fd951(0x153)):'',_0x37923e=a96_0x3256d2['existsSync'](_0x48314c)?a96_0x3256d2[_0x3fd951(0x15e)](_0x48314c,_0x3fd951(0x153)):_0x2bf45a[_0x3fd951(0x1b3)];if(_0x4c7e43?.[_0x3fd951(0x17c)])return{'agentName':_0x2bf45a['name'],'action':_0x3fd951(0x1ba),'projectId':_0xe051bd};const _0x439913=await this[_0x3fd951(0x13a)][_0x3fd951(0x127)](_0xe051bd),_0x5c907e=await this[_0x3fd951(0x13a)][_0x3fd951(0x1e5)](_0xe051bd),_0x4a7709=await this[_0x3fd951(0x13a)]['listTextKnowledgeBases'](_0xe051bd),_0x17e37b=await this[_0x3fd951(0x13a)][_0x3fd951(0x126)](_0xe051bd),_0x3671a3=await this[_0x3fd951(0x13a)][_0x3fd951(0x183)](_0xe051bd),_0x290da2=new Map(),_0x4c569c=new Map(),_0x324f01=new Map(),_0xb653df=new Map();for(const _0x5aa7f7 of _0x5c907e){_0x290da2[_0x3fd951(0x171)](_0x5aa7f7[_0x3fd951(0x170)][_0x3fd951(0xe6)],_0x5aa7f7['id']);}for(const _0x3a78b7 of _0x4a7709){_0x4c569c['set'](_0x3a78b7[_0x3fd951(0x170)][_0x3fd951(0xe6)],_0x3a78b7['id']);}for(const _0x494673 of _0x17e37b){_0x324f01[_0x3fd951(0x171)](_0x494673[_0x3fd951(0x170)]['name'],_0x494673['id']);}for(const _0x2ddce2 of _0x439913){_0xb653df[_0x3fd951(0x171)](_0x2ddce2[_0x3fd951(0x170)]['name'],_0x2ddce2['id']);}const _0x3ab8e0=[],_0x5249c0={'projectId':_0xe051bd,'resolveKnowledgeBaseId':async _0x2e654e=>_0x290da2[_0x3fd951(0x123)](_0x2e654e),'resolveTextKnowledgeBaseId':async _0x20b635=>_0x4c569c[_0x3fd951(0x123)](_0x20b635),'resolveAgentId':async _0x1f3831=>_0xb653df[_0x3fd951(0x123)](_0x1f3831),'resolveWebSearchToolId':async()=>undefined,'resolveImageGeneratorId':async()=>undefined,'resolvePromptId':async()=>undefined,'resolveParentSegmentKBId':async()=>_0x3671a3?.['id'],'resolveExperimentalKnowledgeBaseId':async _0x4ebec1=>_0x324f01[_0x3fd951(0x123)](_0x4ebec1),'onWarning':_0x40518e=>{const _0x31a0d8=_0x3fd951;this[_0x31a0d8(0x1af)][_0x31a0d8(0x14f)](_0x40518e),_0x3ab8e0[_0x31a0d8(0x146)](_0x40518e);}};try{const _0x4a2ca8=_0x439913['find'](_0x1f04f3=>_0x1f04f3[_0x3fd951(0x170)][_0x3fd951(0xe6)]===_0x2bf45a[_0x3fd951(0xe6)]),_0x43b414=await agentDefToRequest(_0x2bf45a,_0x31454e,_0x37923e,_0x5249c0);if(_0x4a2ca8)return await this['client'][_0x3fd951(0x132)](_0x4a2ca8['id'],_0x43b414),{'agentName':_0x2bf45a[_0x3fd951(0xe6)],'action':_0x3fd951(0x1d1),'projectId':_0xe051bd,'agentId':_0x4a2ca8['id'],'warnings':_0x3ab8e0[_0x3fd951(0x1ea)]>0x0?_0x3ab8e0:undefined};else{const _0x18e340=await this[_0x3fd951(0x13a)][_0x3fd951(0xfa)](_0x43b414);return{'agentName':_0x2bf45a[_0x3fd951(0xe6)],'action':_0x3fd951(0x1ba),'projectId':_0xe051bd,'agentId':_0x18e340['id'],'warnings':_0x3ab8e0[_0x3fd951(0x1ea)]>0x0?_0x3ab8e0:undefined};}}catch(_0x38ade6){return{'agentName':_0x2bf45a[_0x3fd951(0xe6)],'action':_0x3fd951(0xf0),'projectId':_0xe051bd,'error':_0x38ade6[_0x3fd951(0x191)],'warnings':_0x3ab8e0[_0x3fd951(0x1ea)]>0x0?_0x3ab8e0:undefined};}}async[a96_0x8551a0(0x1ec)](_0x44b070,_0x216ab,_0x58efca){const _0x81561=a96_0x8551a0,_0x4c06d0=a96_0x3256d2[_0x81561(0x1a0)](_0x44b070)&&a96_0x3256d2['existsSync'](a96_0x43c449['join'](_0x44b070,_0x81561(0xee)));let _0x1d6c20;const _0x57b950=[],_0x72f6e6=[],_0x4a7e95=[],_0x540ee8=[],_0x1ac0ba=[],_0x28be9e=[],_0x3c3ffd=[];if(_0x4c06d0){const _0x206b15=loadAgentConfig(a96_0x43c449[_0x81561(0xfc)](_0x44b070,'tdx.json'));_0x1d6c20=_0x206b15[_0x81561(0x144)];const _0x5bc6c2=a96_0x3256d2['readdirSync'](_0x44b070,{'withFileTypes':!![]});for(const _0x466552 of _0x5bc6c2){if(!_0x466552[_0x81561(0x16f)]())continue;if([_0x81561(0x12f),_0x81561(0x173),_0x81561(0xef),'prompts',_0x81561(0x188)][_0x81561(0xeb)](_0x466552[_0x81561(0xe6)]))continue;const _0x516b31=a96_0x43c449[_0x81561(0xfc)](_0x44b070,_0x466552[_0x81561(0xe6)]);if(isAgentDir(_0x516b31)){const _0x5877c4=a96_0x43c449['join'](_0x516b31,_0x81561(0x16b)),_0x4c9e04=a96_0x43c449['join'](_0x516b31,_0x81561(0x160)),_0x5eada5=a96_0x43c449['join'](_0x516b31,_0x81561(0x1aa)),_0x323791=parseAgentYaml(a96_0x3256d2['readFileSync'](_0x5877c4,'utf-8'),_0x5877c4),_0x2d5ca4=a96_0x3256d2['existsSync'](_0x4c9e04)?a96_0x3256d2[_0x81561(0x15e)](_0x4c9e04,_0x81561(0x153)):'',_0x4ea35b=a96_0x3256d2[_0x81561(0x1a0)](_0x5eada5)?a96_0x3256d2[_0x81561(0x15e)](_0x5eada5,_0x81561(0x153)):_0x323791['starter_message'];_0x57b950[_0x81561(0x146)]({'name':_0x323791[_0x81561(0xe6)],'dir':_0x516b31,'yaml':_0x323791,'systemPrompt':_0x2d5ca4,'starterMessage':_0x4ea35b});}}const _0x4ef560=getKnowledgeBasesDir(_0x44b070);if(a96_0x3256d2[_0x81561(0x1a0)](_0x4ef560)){const _0x3a8387=a96_0x3256d2[_0x81561(0x1d9)](_0x4ef560);for(const _0x77a36a of _0x3a8387){const _0x3f8cc4=a96_0x43c449[_0x81561(0xfc)](_0x4ef560,_0x77a36a);if(_0x77a36a['endsWith'](_0x81561(0x1c2))){const _0x52a1d8=parseKnowledgeBaseYaml(a96_0x3256d2[_0x81561(0x15e)](_0x3f8cc4,'utf-8'),_0x3f8cc4);_0x72f6e6[_0x81561(0x146)]({'name':_0x52a1d8['name'],'path':_0x3f8cc4,'yaml':_0x52a1d8});}else{if(_0x77a36a[_0x81561(0x1b4)](_0x81561(0x155))){const _0x4d6c50=a96_0x3256d2['readFileSync'](_0x3f8cc4,'utf-8'),{name:_0x451c6d,text:_0x24416f}=parseTextKnowledgeBaseMd(_0x4d6c50,_0x77a36a);_0x4a7e95[_0x81561(0x146)]({'name':_0x451c6d,'path':_0x3f8cc4,'text':_0x24416f});}}}}const _0x2d50ee=getPromptsDir(_0x44b070);if(a96_0x3256d2[_0x81561(0x1a0)](_0x2d50ee)){const _0x1c1aae=a96_0x3256d2[_0x81561(0x1d9)](_0x2d50ee)[_0x81561(0x1ad)](_0x13624e=>_0x13624e[_0x81561(0x1b4)](_0x81561(0x1c2)));for(const _0x59a011 of _0x1c1aae){const _0x33b53e=a96_0x43c449[_0x81561(0xfc)](_0x2d50ee,_0x59a011),_0x1e841c=parsePromptYaml(a96_0x3256d2[_0x81561(0x15e)](_0x33b53e,'utf-8'),_0x33b53e);_0x540ee8[_0x81561(0x146)]({'name':_0x1e841c['name'],'path':_0x33b53e,'yaml':_0x1e841c});}}const _0x5de4fa=getIntegrationsDir(_0x44b070);if(a96_0x3256d2['existsSync'](_0x5de4fa)){const _0xb57c1f=a96_0x3256d2[_0x81561(0x1d9)](_0x5de4fa)[_0x81561(0x1ad)](_0x3de264=>_0x3de264[_0x81561(0x1b4)]('.yml'));for(const _0x5384e1 of _0xb57c1f){const _0x24f987=a96_0x43c449['join'](_0x5de4fa,_0x5384e1),_0x12a4ef=parseIntegrationYaml(a96_0x3256d2[_0x81561(0x15e)](_0x24f987,_0x81561(0x153)),_0x24f987);SAFE_INTEGRATION_TYPES[_0x81561(0xeb)](_0x12a4ef[_0x81561(0x1d5)][_0x81561(0x140)]())?_0x1ac0ba[_0x81561(0x146)]({'name':_0x12a4ef['name'],'path':_0x24f987,'yaml':_0x12a4ef}):this[_0x81561(0x1af)][_0x81561(0x14f)](_0x81561(0x13b)+_0x12a4ef['name']+_0x81561(0x1e2)+_0x12a4ef[_0x81561(0x1d5)]+_0x81561(0x17f)+(_0x81561(0xfb)+SAFE_INTEGRATION_TYPES[_0x81561(0xfc)](',\x20')+')\x20can\x20be\x20cloned.'));}}const _0x1042cb=getExperimentalKnowledgeBasesDir(_0x44b070);if(a96_0x3256d2[_0x81561(0x1a0)](_0x1042cb)){const _0x531b3b=a96_0x3256d2['readdirSync'](_0x1042cb,{'withFileTypes':!![]});for(const _0x28ba9f of _0x531b3b){if(!_0x28ba9f[_0x81561(0x16f)]())continue;const _0x313a42=a96_0x43c449[_0x81561(0xfc)](_0x1042cb,_0x28ba9f['name']),_0x31e929=a96_0x43c449[_0x81561(0xfc)](_0x313a42,_0x28ba9f[_0x81561(0xe6)]+_0x81561(0x1c2));if(a96_0x3256d2[_0x81561(0x1a0)](_0x31e929)){const _0x573fef=parseExperimentalKnowledgeBaseYaml(a96_0x3256d2['readFileSync'](_0x31e929,_0x81561(0x153)),_0x31e929),_0x3c338c=a96_0x43c449[_0x81561(0xfc)](_0x313a42,_0x81561(0xe4)),_0xd66d73=[];if(a96_0x3256d2[_0x81561(0x1a0)](_0x3c338c)){const _0x20d2d3=a96_0x3256d2[_0x81561(0x1d9)](_0x3c338c,{'withFileTypes':!![]});for(const _0x403e99 of _0x20d2d3){if(!_0x403e99[_0x81561(0x16f)]())continue;const _0x1ec6c6=a96_0x43c449[_0x81561(0xfc)](_0x3c338c,_0x403e99[_0x81561(0xe6)]),_0x206f57=a96_0x43c449[_0x81561(0xfc)](_0x1ec6c6,_0x81561(0x1cf)),_0x283262=a96_0x43c449[_0x81561(0xfc)](_0x1ec6c6,_0x81561(0x1a6));if(a96_0x3256d2[_0x81561(0x1a0)](_0x206f57)&&a96_0x3256d2[_0x81561(0x1a0)](_0x283262)){const _0x27fd4a=a96_0x3256d2[_0x81561(0x15e)](_0x206f57,'utf-8'),_0x1b4547=a96_0x3256d2[_0x81561(0x15e)](_0x283262,_0x81561(0x153));_0xd66d73['push']({'name':_0x403e99['name'],'code':_0x27fd4a,'json_schema':_0x1b4547});}}}const _0x5c1eb2={..._0x573fef,'functions':_0xd66d73};_0x28be9e['push']({'name':_0x573fef[_0x81561(0xe6)],'path':_0x313a42,'def':_0x5c1eb2});}}}const _0x445901=getExperimentalArtifactsDir(_0x44b070);if(a96_0x3256d2[_0x81561(0x1a0)](_0x445901)){const _0x2c5b6c=a96_0x3256d2[_0x81561(0x1d9)](_0x445901,{'withFileTypes':!![]});for(const _0x47a581 of _0x2c5b6c){if(!_0x47a581[_0x81561(0x16f)]())continue;const _0x1d9805=a96_0x43c449[_0x81561(0xfc)](_0x445901,_0x47a581['name']),_0x5d607c=a96_0x43c449[_0x81561(0xfc)](_0x1d9805,_0x47a581[_0x81561(0xe6)]+_0x81561(0x1c2));if(a96_0x3256d2[_0x81561(0x1a0)](_0x5d607c)){const _0xa27cb4=parseExperimentalArtifactYaml(a96_0x3256d2[_0x81561(0x15e)](_0x5d607c,_0x81561(0x153)),_0x5d607c),_0x22abba=a96_0x43c449[_0x81561(0xfc)](_0x1d9805,_0x81561(0x1cf)),_0x2a1ad6=a96_0x3256d2[_0x81561(0x1a0)](_0x22abba)?a96_0x3256d2['readFileSync'](_0x22abba,_0x81561(0x153)):'',_0x27a60b=a96_0x43c449[_0x81561(0xfc)](_0x1d9805,_0x81561(0x1c5)),_0x106051=[];if(a96_0x3256d2[_0x81561(0x1a0)](_0x27a60b)){const _0x222453=a96_0x3256d2[_0x81561(0x1d9)](_0x27a60b);for(const _0x336e46 of _0x222453){const _0x13c9eb=a96_0x43c449[_0x81561(0xfc)](_0x27a60b,_0x336e46);if(a96_0x3256d2[_0x81561(0x1e9)](_0x13c9eb)[_0x81561(0x1ed)]()){const _0x4a5b72=a96_0x3256d2[_0x81561(0x15e)](_0x13c9eb,'utf-8');_0x106051['push']({'file_name':_0x336e46,'text_content':_0x4a5b72});}}}const _0x3464e8={..._0xa27cb4,'code':_0x2a1ad6,'files':_0x106051};_0x3c3ffd[_0x81561(0x146)]({'name':_0xa27cb4[_0x81561(0xe6)],'path':_0x1d9805,'def':_0x3464e8});}}}}else{const _0x3fde64=await this[_0x81561(0x161)](_0x44b070),_0x45ff1f=await this['client'][_0x81561(0x11b)](_0x3fde64);_0x1d6c20=_0x45ff1f[_0x81561(0x170)]['name'];const _0x420fe6=await this['client'][_0x81561(0x127)](_0x3fde64),_0x32a426=await this[_0x81561(0x13a)]['listKnowledgeBases'](_0x3fde64),_0x476653=await this[_0x81561(0x13a)]['listTextKnowledgeBases'](_0x3fde64),_0x446bba=await this['client'][_0x81561(0x1a1)](_0x3fde64),_0x12a446=await this[_0x81561(0x13a)][_0x81561(0x1f2)](_0x3fde64),_0x444f82=await this[_0x81561(0x13a)][_0x81561(0x126)](_0x3fde64),_0x56ef42=await this['client']['listExperimentalArtifacts'](_0x3fde64),_0x56c8b3=new Map(),_0xc63454=new Map(),_0x26ff4f=new Map(),_0x516dd7=new Map(),_0x313e6e=new Map(),_0x4ed89c=new Map();for(const _0x57ac25 of _0x32a426){_0x56c8b3['set'](_0x57ac25['id'],_0x57ac25[_0x81561(0x170)]['name']);}for(const _0x65f810 of _0x476653){_0xc63454[_0x81561(0x171)](_0x65f810['id'],_0x65f810[_0x81561(0x170)][_0x81561(0xe6)]);}for(const _0x54cfb7 of _0x420fe6){_0x26ff4f[_0x81561(0x171)](_0x54cfb7['id'],_0x54cfb7[_0x81561(0x170)]['name']);}for(const _0x330495 of _0x446bba){_0x516dd7[_0x81561(0x171)](_0x330495['id'],_0x330495[_0x81561(0x170)]['name']);}for(const _0x125204 of _0x444f82){_0x313e6e['set'](_0x125204['id'],_0x125204[_0x81561(0x170)][_0x81561(0xe6)]);}for(const _0xd0042e of _0x56ef42){_0x4ed89c['set'](_0xd0042e['id'],_0xd0042e[_0x81561(0x170)][_0x81561(0xe6)]);}const _0x244023={'resolveKnowledgeBaseName':async _0x57c9e0=>_0x56c8b3['get'](_0x57c9e0),'resolveTextKnowledgeBaseName':async _0x2a7817=>_0xc63454['get'](_0x2a7817),'resolveAgentName':async _0x21db94=>_0x26ff4f[_0x81561(0x123)](_0x21db94),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async _0x5edecf=>_0x516dd7[_0x81561(0x123)](_0x5edecf),'resolveExperimentalKnowledgeBaseName':async _0x49fa17=>_0x313e6e[_0x81561(0x123)](_0x49fa17),'onWarning':_0x2d7280=>this[_0x81561(0x1af)][_0x81561(0x14f)](_0x2d7280)};for(const _0x5d61dc of _0x420fe6){const _0x15076d=await agentResponseToDef(_0x5d61dc,_0x244023),{yaml:_0x57b0a8,systemPrompt:_0x5a62fe,starterMessage:_0x31f0a3}=_0x15076d;_0x57b950[_0x81561(0x146)]({'name':_0x57b0a8['name'],'dir':'','yaml':_0x57b0a8,'systemPrompt':_0x5a62fe,'starterMessage':_0x31f0a3});}for(const _0x3d6307 of _0x32a426){const _0x4a2504=apiKnowledgeBaseToYaml(_0x3d6307);_0x72f6e6['push']({'name':_0x4a2504[_0x81561(0xe6)],'path':'','yaml':_0x4a2504});}for(const _0x3a7e0b of _0x476653){_0x4a7e95[_0x81561(0x146)]({'name':_0x3a7e0b[_0x81561(0x170)][_0x81561(0xe6)],'path':'','text':_0x3a7e0b['attributes'][_0x81561(0xf2)]});}for(const _0x35157a of _0x446bba){const _0x4ab003=await apiPromptToYaml(_0x35157a,_0x244023);_0x4ab003&&_0x540ee8[_0x81561(0x146)]({'name':_0x4ab003[_0x81561(0xe6)],'path':'','yaml':_0x4ab003});}for(const _0x53e57b of _0x12a446){if(!_0x53e57b[_0x81561(0x170)][_0x81561(0x19c)]&&SAFE_INTEGRATION_TYPES[_0x81561(0xeb)](_0x53e57b['attributes'][_0x81561(0x143)][_0x81561(0x140)]())){const _0x1cb22b=await apiIntegrationToYaml(_0x53e57b,_0x244023);_0x1ac0ba[_0x81561(0x146)]({'name':_0x53e57b['attributes'][_0x81561(0x143)]['toLowerCase'](),'path':'','yaml':_0x1cb22b});}}for(const _0x6cb0bf of _0x444f82){const _0x1894b7=apiExperimentalKnowledgeBaseToYaml(_0x6cb0bf);_0x28be9e[_0x81561(0x146)]({'name':_0x1894b7[_0x81561(0xe6)],'path':'','def':_0x1894b7});}for(const _0x9c28cd of _0x56ef42){const _0x4ca9c0=apiExperimentalArtifactToYaml(_0x9c28cd);_0x3c3ffd[_0x81561(0x146)]({'name':_0x4ca9c0[_0x81561(0xe6)],'path':'','def':_0x4ca9c0});}}const _0x4254bf={'sourceProjectName':_0x1d6c20,'newProjectName':_0x216ab,'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}}},_0xf050b2=await this[_0x81561(0x13a)][_0x81561(0x1f3)](),_0x4a572e=_0xf050b2['find'](_0x5276be=>_0x5276be['attributes']['name']===_0x216ab);if(_0x4a572e)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x81561(0x1ae)+_0x216ab+_0x81561(0x108),undefined,{'helpText':_0x81561(0x13d)});if(_0x58efca?.['dryRun'])return _0x4254bf['counts'][_0x81561(0x166)][_0x81561(0x1ba)]=_0x57b950['length'],_0x4254bf[_0x81561(0x1cc)]['knowledgeBases']['created']=_0x72f6e6[_0x81561(0x1ea)],_0x4254bf[_0x81561(0x1cc)][_0x81561(0x128)]['created']=_0x4a7e95[_0x81561(0x1ea)],_0x4254bf[_0x81561(0x1cc)][_0x81561(0x11e)][_0x81561(0x1ba)]=_0x28be9e[_0x81561(0x1ea)],_0x4254bf[_0x81561(0x1cc)][_0x81561(0x14e)][_0x81561(0x1ba)]=_0x3c3ffd['length'],_0x4254bf[_0x81561(0x1cc)][_0x81561(0x10e)]['created']=_0x540ee8[_0x81561(0x1ea)],_0x4254bf[_0x81561(0x1cc)][_0x81561(0x188)][_0x81561(0x1ba)]=_0x1ac0ba[_0x81561(0x1ea)],_0x4254bf;const _0x24ce62=await this[_0x81561(0x13a)][_0x81561(0xf1)]({'name':_0x216ab}),_0x30fc2a=_0x24ce62['id'];_0x4254bf['newProjectId']=_0x30fc2a;const _0x2b9f00=new Map(),_0x5f4e13=new Map(),_0x7e6099=new Map(),_0x4e7e29=new Map(),_0x2bb59f=new Map(),_0x22c016=new Map(),_0x6e7afb=new Map(),_0x1426d7=new Map(),_0x427ee0=new Set(),_0x16b446=new Set();for(const _0x12cdf0 of _0x57b950){for(const _0xf99f53 of _0x12cdf0[_0x81561(0x134)]['tools']||[]){if(_0xf99f53[_0x81561(0x129)]==='image_gen'&&_0xf99f53[_0x81561(0x1f4)]){const _0x20e87c=parseRef(_0xf99f53[_0x81561(0x1f4)]);if(_0x20e87c)_0x427ee0[_0x81561(0x1b2)](_0x20e87c[_0x81561(0xe6)]);}else{if(_0xf99f53[_0x81561(0x129)]===_0x81561(0x185)&&_0xf99f53['target']){const _0x341a97=parseRef(_0xf99f53[_0x81561(0x1f4)]);if(_0x341a97)_0x16b446[_0x81561(0x1b2)](_0x341a97[_0x81561(0xe6)]);}}}}for(const _0x50e809 of _0x427ee0){try{const _0x1a4c57=await this[_0x81561(0x13a)][_0x81561(0x142)]({'projectId':_0x30fc2a,'name':_0x50e809});_0x2bb59f[_0x81561(0x171)](_0x50e809,_0x1a4c57['id']),_0x4254bf[_0x81561(0x152)]['push']({'name':_0x50e809,'action':_0x81561(0x1ba),'id':_0x1a4c57['id']}),_0x4254bf[_0x81561(0x1cc)][_0x81561(0x152)][_0x81561(0x1ba)]++;}catch(_0x42d346){_0x4254bf['imageGenerators'][_0x81561(0x146)]({'name':_0x50e809,'action':_0x81561(0xf0),'error':_0x42d346[_0x81561(0x191)]}),_0x4254bf[_0x81561(0x1cc)][_0x81561(0x152)]['errors']++;}}for(const _0x28104e of _0x16b446){try{const _0x425224=await this[_0x81561(0x13a)][_0x81561(0x1e0)]({'projectId':_0x30fc2a,'name':_0x28104e});_0x22c016[_0x81561(0x171)](_0x28104e,_0x425224['id']),_0x4254bf[_0x81561(0x177)][_0x81561(0x146)]({'name':_0x28104e,'action':_0x81561(0x1ba),'id':_0x425224['id']}),_0x4254bf['counts']['webSearchTools']['created']++;}catch(_0x4e4774){_0x4254bf['webSearchTools']['push']({'name':_0x28104e,'action':_0x81561(0xf0),'error':_0x4e4774['message']}),_0x4254bf['counts'][_0x81561(0x177)][_0x81561(0xfe)]++;}}const _0x3f217c=await this[_0x81561(0x13a)][_0x81561(0x183)](_0x30fc2a);let _0x4e4599=[];const _0x15853a={'projectId':_0x30fc2a,'resolveKnowledgeBaseId':async _0x1ec229=>_0x2b9f00[_0x81561(0x123)](_0x1ec229),'resolveTextKnowledgeBaseId':async _0xd5740=>_0x5f4e13[_0x81561(0x123)](_0xd5740),'resolveExperimentalKnowledgeBaseId':async _0x41152a=>_0x6e7afb[_0x81561(0x123)](_0x41152a),'resolveAgentId':async _0x578c1b=>_0x7e6099[_0x81561(0x123)](_0x578c1b),'resolveWebSearchToolId':async _0x2cf4dc=>_0x22c016['get'](_0x2cf4dc),'resolveImageGeneratorId':async _0x4bf0cc=>_0x2bb59f[_0x81561(0x123)](_0x4bf0cc),'resolvePromptId':async _0x436c3b=>_0x4e7e29[_0x81561(0x123)](_0x436c3b),'resolveParentSegmentKBId':async()=>_0x3f217c?.['id'],'onWarning':_0x3742be=>{const _0x3a3aab=_0x81561;this[_0x3a3aab(0x1af)]['warn'](_0x3742be),_0x4e4599[_0x3a3aab(0x146)](_0x3742be);}};for(const _0x522798 of _0x72f6e6){try{const _0x1b4655=yamlKnowledgeBaseToApi(_0x522798[_0x81561(0x134)],_0x30fc2a),_0xc5a3f0=await this[_0x81561(0x13a)][_0x81561(0x175)](_0x1b4655);_0x2b9f00[_0x81561(0x171)](_0x522798[_0x81561(0x134)][_0x81561(0xe6)],_0xc5a3f0['id']),_0x4254bf[_0x81561(0x165)][_0x81561(0x146)]({'name':_0x522798[_0x81561(0x134)][_0x81561(0xe6)],'action':_0x81561(0x1ba),'id':_0xc5a3f0['id']}),_0x4254bf[_0x81561(0x1cc)][_0x81561(0x165)][_0x81561(0x1ba)]++;}catch(_0x5c104d){_0x4254bf[_0x81561(0x165)][_0x81561(0x146)]({'name':_0x522798[_0x81561(0x134)][_0x81561(0xe6)],'action':_0x81561(0xf0),'error':_0x5c104d[_0x81561(0x191)]}),_0x4254bf[_0x81561(0x1cc)][_0x81561(0x165)][_0x81561(0xfe)]++;}}for(const _0x4e5b57 of _0x4a7e95){try{const _0x4d5b58=yamlTextKnowledgeBaseToApi({'name':_0x4e5b57['name'],'text':_0x4e5b57[_0x81561(0xf2)]},_0x30fc2a),_0x569828=await this[_0x81561(0x13a)][_0x81561(0x136)](_0x4d5b58);_0x5f4e13[_0x81561(0x171)](_0x4e5b57[_0x81561(0xe6)],_0x569828['id']),_0x4254bf[_0x81561(0x128)][_0x81561(0x146)]({'name':_0x4e5b57[_0x81561(0xe6)],'action':_0x81561(0x1ba),'id':_0x569828['id']}),_0x4254bf[_0x81561(0x1cc)][_0x81561(0x128)]['created']++;}catch(_0x55d270){_0x4254bf['textKnowledgeBases']['push']({'name':_0x4e5b57['name'],'action':_0x81561(0xf0),'error':_0x55d270[_0x81561(0x191)]}),_0x4254bf[_0x81561(0x1cc)][_0x81561(0x128)][_0x81561(0xfe)]++;}}for(const _0x18cb68 of _0x3c3ffd){try{const _0x5ce191=yamlExperimentalArtifactToApi(_0x18cb68[_0x81561(0x130)],_0x30fc2a),_0x5e2426=await this[_0x81561(0x13a)][_0x81561(0xf7)](_0x5ce191);_0x1426d7['set'](_0x18cb68[_0x81561(0x130)][_0x81561(0xe6)],_0x5e2426['id']),_0x4254bf[_0x81561(0x14e)][_0x81561(0x146)]({'name':_0x18cb68['def']['name'],'action':_0x81561(0x1ba),'id':_0x5e2426['id']}),_0x4254bf[_0x81561(0x1cc)][_0x81561(0x14e)][_0x81561(0x1ba)]++;}catch(_0x545205){_0x4254bf[_0x81561(0x14e)][_0x81561(0x146)]({'name':_0x18cb68[_0x81561(0x130)]['name'],'action':_0x81561(0xf0),'error':_0x545205['message']}),_0x4254bf[_0x81561(0x1cc)]['experimentalArtifacts']['errors']++;}}for(const _0x22e07e of _0x28be9e){try{const _0x46cad8=yamlExperimentalKnowledgeBaseToApi(_0x22e07e[_0x81561(0x130)],_0x30fc2a),_0x1e447d=await this[_0x81561(0x13a)][_0x81561(0x1c4)](_0x46cad8);_0x6e7afb['set'](_0x22e07e['def'][_0x81561(0xe6)],_0x1e447d['id']),_0x4254bf[_0x81561(0x11e)][_0x81561(0x146)]({'name':_0x22e07e[_0x81561(0x130)][_0x81561(0xe6)],'action':_0x81561(0x1ba),'id':_0x1e447d['id']}),_0x4254bf['counts'][_0x81561(0x11e)]['created']++;}catch(_0x25c71b){_0x4254bf[_0x81561(0x11e)][_0x81561(0x146)]({'name':_0x22e07e[_0x81561(0x130)][_0x81561(0xe6)],'action':_0x81561(0xf0),'error':_0x25c71b[_0x81561(0x191)]}),_0x4254bf[_0x81561(0x1cc)][_0x81561(0x11e)]['errors']++;}}const _0x976972=[..._0x57b950][_0x81561(0x10a)]((_0x8dc8e5,_0x1d095c)=>{const _0x248783=_0x81561,_0x220f17=_0x8dc8e5['yaml'][_0x248783(0x10f)]?.[_0x248783(0x10d)](_0x458d5b=>_0x458d5b[_0x248783(0x129)]===_0x248783(0x189))??![],_0x3d6e3e=_0x1d095c[_0x248783(0x134)]['tools']?.[_0x248783(0x10d)](_0x1e7a28=>_0x1e7a28[_0x248783(0x129)]==='agent')??![];if(_0x220f17&&!_0x3d6e3e)return 0x1;if(!_0x220f17&&_0x3d6e3e)return-0x1;return 0x0;});for(const _0x259484 of _0x976972){_0x4e4599=[];try{const _0x5a35dd=_0x259484[_0x81561(0x134)][_0x81561(0x10f)]?.[_0x81561(0x1ad)](_0x4d41d2=>{const _0x5665c8=_0x81561;if(_0x4d41d2[_0x5665c8(0x129)]==='agent'&&_0x4d41d2[_0x5665c8(0x1f4)]){const _0x2569d8=parseRef(_0x4d41d2[_0x5665c8(0x1f4)]);return _0x2569d8?.[_0x5665c8(0xe6)]===_0x259484['yaml']['name'];}return![];})??[];if(_0x5a35dd[_0x81561(0x1ea)]>0x0){const _0x5e5deb='Agent\x20\x27'+_0x259484['yaml'][_0x81561(0xe6)]+'\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20'+_0x81561(0xf4);this[_0x81561(0x1af)][_0x81561(0x14f)](_0x5e5deb),_0x4e4599['push'](_0x5e5deb);}const _0x1633cc=await agentDefToRequest(_0x259484['yaml'],_0x259484[_0x81561(0x1b9)],_0x259484['starterMessage'],_0x15853a),_0x4e513c=await this['client']['createAgentResponse'](_0x1633cc);_0x7e6099[_0x81561(0x171)](_0x259484[_0x81561(0x134)][_0x81561(0xe6)],_0x4e513c['id']),_0x4254bf[_0x81561(0x166)]['push']({'agentName':_0x259484[_0x81561(0x134)][_0x81561(0xe6)],'action':_0x81561(0x1ba),'agentId':_0x4e513c['id'],'warnings':_0x4e4599['length']>0x0?_0x4e4599:undefined}),_0x4254bf[_0x81561(0x1cc)][_0x81561(0x166)][_0x81561(0x1ba)]++;}catch(_0x242412){_0x4254bf[_0x81561(0x166)]['push']({'agentName':_0x259484[_0x81561(0x134)]['name'],'action':_0x81561(0xf0),'error':_0x242412[_0x81561(0x191)],'warnings':_0x4e4599[_0x81561(0x1ea)]>0x0?_0x4e4599:undefined}),_0x4254bf[_0x81561(0x1cc)][_0x81561(0x166)][_0x81561(0xfe)]++;}}for(const _0xc5d90c of _0x540ee8){try{const _0x164648=await yamlPromptToApi(_0xc5d90c['yaml'],_0x30fc2a,_0x15853a);if(!_0x164648){_0x4254bf['prompts'][_0x81561(0x146)]({'name':_0xc5d90c[_0x81561(0x134)][_0x81561(0xe6)],'action':_0x81561(0xf0),'error':_0x81561(0x1d8)}),_0x4254bf['counts'][_0x81561(0x10e)][_0x81561(0xfe)]++;continue;}const _0x58ea94=await this['client']['createPrompt'](_0x164648);_0x4e7e29[_0x81561(0x171)](_0xc5d90c[_0x81561(0x134)][_0x81561(0xe6)],_0x58ea94['id']),_0x4254bf[_0x81561(0x10e)][_0x81561(0x146)]({'name':_0xc5d90c[_0x81561(0x134)][_0x81561(0xe6)],'action':_0x81561(0x1ba),'id':_0x58ea94['id']}),_0x4254bf[_0x81561(0x1cc)][_0x81561(0x10e)][_0x81561(0x1ba)]++;}catch(_0xc32004){_0x4254bf[_0x81561(0x10e)]['push']({'name':_0xc5d90c[_0x81561(0x134)][_0x81561(0xe6)],'action':_0x81561(0xf0),'error':_0xc32004[_0x81561(0x191)]}),_0x4254bf[_0x81561(0x1cc)][_0x81561(0x10e)][_0x81561(0xfe)]++;}}for(const _0x49337e of _0x1ac0ba){try{const _0x3fae94=await yamlIntegrationToApi(_0x49337e[_0x81561(0x134)],_0x30fc2a,_0x15853a),_0x3f984f=await this[_0x81561(0x13a)][_0x81561(0x1a8)](_0x3fae94);_0x4254bf[_0x81561(0x188)]['push']({'name':_0x49337e[_0x81561(0x134)][_0x81561(0x1d5)],'action':_0x81561(0x1ba),'id':_0x3f984f['id']}),_0x4254bf[_0x81561(0x1cc)][_0x81561(0x188)][_0x81561(0x1ba)]++;}catch(_0x5b2c29){_0x4254bf[_0x81561(0x188)][_0x81561(0x146)]({'name':_0x49337e[_0x81561(0x134)][_0x81561(0x1d5)],'action':_0x81561(0xf0),'error':_0x5b2c29[_0x81561(0x191)]}),_0x4254bf['counts'][_0x81561(0x188)][_0x81561(0xfe)]++;}}return _0x4254bf;}}
1
+ const a96_0x5d9617=a96_0x186e;(function(_0x22ffa8,_0x935652){const _0x3fd756=a96_0x186e,_0x1c942e=_0x22ffa8();while(!![]){try{const _0x42e939=-parseInt(_0x3fd756(0x26b))/0x1*(-parseInt(_0x3fd756(0x1d7))/0x2)+-parseInt(_0x3fd756(0x185))/0x3*(-parseInt(_0x3fd756(0x24a))/0x4)+parseInt(_0x3fd756(0x25d))/0x5*(parseInt(_0x3fd756(0x1e0))/0x6)+parseInt(_0x3fd756(0x270))/0x7+-parseInt(_0x3fd756(0x1ff))/0x8+parseInt(_0x3fd756(0x251))/0x9+-parseInt(_0x3fd756(0x273))/0xa*(parseInt(_0x3fd756(0x1cc))/0xb);if(_0x42e939===_0x935652)break;else _0x1c942e['push'](_0x1c942e['shift']());}catch(_0x5f26eb){_0x1c942e['push'](_0x1c942e['shift']());}}}(a96_0x2d05,0x58750));import{LLMApiClient}from'../client/llm-api-client.js';import*as a96_0x1974b2 from'node:fs';import*as a96_0xa96e78 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,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,resolveAgentDependencies}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir}from'../agent/agent-config.js';function a96_0x186e(_0x264c6e,_0x276505){_0x264c6e=_0x264c6e-0x17e;const _0x2d052c=a96_0x2d05();let _0x186ece=_0x2d052c[_0x264c6e];return _0x186ece;}function a96_0x2d05(){const _0x1ed895=['Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','createAgentResponse','createIntegration','tdx.json','type','add','(dry-run)','UNAUTHENTICATED','dry-run-','getChatInfo','AGENT_NOT_FOUND','path','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','getProject','Renamed\x20KB\x20file:\x20','3676KWzzZa','slackMessageMode','image_gen','listChats','outputs','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.','listAgentsFull','3146868xIANJk','updatePrompt','PERMISSION_DENIED','#\x20prompt.md\x0a','find','agent','models','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','service_type','startChat','profile','Available\x20agents:\x20','5ZeSyIi','renamed','Skipping\x20integration\x20\x27','resolveProjectId','starter_message.md','prompt.md','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','agent.yml','listExperimentalArtifacts','name','has','getDefaultAgent','version','integrations','114RmjFcj','getDefaultProjectName','already\x20exists','client','utf-8','2206792iXhYAN','yaml','starter_message','10UEpRXx','createTextKnowledgeBase','listExperimentalKnowledgeBases','listIntegrations','description','.llm','Agent\x20\x27','getOrCreateDefaultProject','json_schema.json','action','):\x20','setCurrentProject','knowledgebases.json','rmSync','listWebSearchTools','logger','knowledgeBases','dir','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','context','site','tables','restoreProject','createAgent','map','new','Agent\x20reference\x20not\x20found','jsonSchemaHint','createProject','warn','imageGenerators','Unable\x20to\x20create\x20project\x20after\x20','errors','created','metadata','updateAgentResponse','getChatLog','knowledge_bases','dryRun','324tGStUX','---\x20file:\x20','Multiple\x20agents\x20found\x20with\x20name\x20\x27','promptId','chat_generic','tdx_default_','project.json','oldPath','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','\x0a---\x20schema:\x20','updateAgent','\x0a\x0a#\x20agent.yml\x0a','Renamed\x20experimental\x20artifact\x20directory:\x20','agentId','size','files','low','listTextKnowledgeBases','isDir','llm_project','cwd','serviceType','\x20attempts\x20due\x20to\x20name\x20conflicts.','Project\x20not\x20found:\x20','experimentalKnowledgeBases','mkdirSync','createExperimentalKnowledgeBase','getAgent','LLM_PROJECT_NOT_FOUND','listAgents','pushProject','updated','exportedFrom','\x0a---\x20code\x20---\x0a','getParentSegmentKnowledgeBase','webhookCorsOrigins','updateTextKnowledgeBase','cloneProject','Renamed\x20folder:\x20','Unsupported\x20backup\x20version:\x20','message','\x20---\x0a','readFileSync','agents.json','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','Agent\x20not\x20found:\x20','Multiple\x20projects\x20found\x20with\x20name\x20\x27','conflict','existsSync','readdirSync','deleteProject','actions','setDefaultAgent','target','statSync','agent.yml\x20not\x20found\x20in\x20','Renamed\x20agent\x20folder:\x20','file_name','backupProject','ALREADY_EXISTS','info','createWebSearchTool','integrations.json','listPrompts','Renamed\x20prompt\x20file:\x20','get','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','\x0a---\x20function:\x20','deleteAgent','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','listKnowledgeBases','7712331DZLcKI','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','agentsFull','stringify','total','tdx_','minimal','temperature','getOrCreateDefaultAgent','projects','experimentalArtifacts','12130ukejXU','Invalid\x20agent\x20reference\x20format:\x20','Output\x20directory\x20already\x20exists:\x20','clearDefaultAgent','variables','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','listImageGenerators','chat','availableModelNames','1810986KtpQKg','projectName',')\x20can\x20be\x20pushed.\x20','agents','text_content','endsWith','localeCompare','functions','dirname','prompts','def','attributes','includes','chatId','.yml','Only\x20safe\x20types\x20(','NOT_FOUND','parse','json_schema','modelType','writeFileSync','duplicate','chat_parent_segment','prompts.json','createImageGenerator','toLowerCase','status','loadJsonFile','signal','createKnowledgeBase','reasoningEffort','5551680oSunPE','resolveAgentId','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','INTERNAL','set','\x27\x20(','some','text','createPrompt','chatWelcomeMessage','Renamed\x20integration\x20file:\x20','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','listProjects','content','No\x20tdx.json\x20found\x20in\x20','filter','newProjectId','currentProjectId','push','textKnowledgeBases','Project\x20\x22','createExperimentalArtifact','.md','getBackupMetadata','starterMessage','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','length','\x27.\x20This\x20should\x20not\x20happen.','error','systemPrompt','Backup\x20folder\x20not\x20found:\x20','basename','INVALID_ARGUMENT','getChatHistory','isFile','updateExperimentalArtifact','tdDatabaseName','\x20→\x20','tools','continueChat','isManaged','Removed\x20deleted\x20directory:\x20','none','resolveProjectName','toISOString','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','\x22\x20already\x20exists','sort','isDirectory','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','webSearchTools','experimental_knowledge_bases','code.js','counts','code','maxToolIterations','join','unchanged','pullAgent'];a96_0x2d05=function(){return _0x1ed895;};return a96_0x2d05();}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=[a96_0x5d9617(0x189),'chat_agent_console',a96_0x5d9617(0x1f6)];export class LLMSDK{['currentProjectId'];[a96_0x5d9617(0x26e)];[a96_0x5d9617(0x286)];[a96_0x5d9617(0x282)]=Logger['of']('sdk.llm');constructor(_0x181f37){const _0x3009b4=a96_0x5d9617;this['client']=new LLMApiClient(_0x181f37),this[_0x3009b4(0x286)]=_0x181f37;}[a96_0x5d9617(0x26c)](){const _0x5d7efe=a96_0x5d9617,_0x6c9d84=getSanitizedUsername();return _0x5d7efe(0x18a)+_0x6c9d84;}async[a96_0x5d9617(0x27e)](_0x3ed979){const _0x5b7369=a96_0x5d9617,{projectId:_0x32d633}=await this[_0x5b7369(0x22a)](_0x3ed979);this[_0x5b7369(0x210)]=_0x32d633;}['getCurrentProject'](){const _0x17df28=a96_0x5d9617;return this[_0x17df28(0x210)];}async[a96_0x5d9617(0x1b9)](_0xd1980e){const _0x53aac9=a96_0x5d9617,_0x26b1c0=this['context'][_0x53aac9(0x25b)];let _0x1a2df5,_0x4a0a84;if(_0xd1980e[_0x53aac9(0x1ec)]('/')){const _0x1de881=_0xd1980e['split']('/');if(_0x1de881[_0x53aac9(0x219)]!==0x2)throw new SDKError(ErrorCode[_0x53aac9(0x21f)],_0x53aac9(0x1d8)+_0xd1980e,undefined,{'helpText':_0x53aac9(0x1ca)});const [_0x5a80fa,_0x4ead5a]=_0x1de881;_0x1a2df5=await this['resolveProjectId'](_0x5a80fa),_0x4a0a84=_0x4ead5a;}else _0x1a2df5=this['currentProjectId']||(await this[_0x53aac9(0x27a)]())['id'],_0x4a0a84=_0xd1980e;const _0x4de8ab=await this[_0x53aac9(0x200)](_0x4a0a84,_0x1a2df5),_0x1bddbb=await this[_0x53aac9(0x26e)][_0x53aac9(0x1a0)](_0x4de8ab);writeCachedLLMAgent(_0x1bddbb[_0x53aac9(0x1eb)]['name'],_0x4de8ab,_0x1a2df5,_0x26b1c0);}[a96_0x5d9617(0x268)](){const _0x3d1bde=a96_0x5d9617,_0x7ff860=this[_0x3d1bde(0x286)][_0x3d1bde(0x25b)];return readCachedLLMAgent(_0x7ff860)||undefined;}[a96_0x5d9617(0x1da)](){const _0xff6e2c=a96_0x5d9617,_0x3c651c=this[_0xff6e2c(0x286)]['profile'];clearCachedLLMAgent(_0x3c651c);}async[a96_0x5d9617(0x257)](){const _0x154ead=a96_0x5d9617,_0x23beba=await this[_0x154ead(0x26e)]['getUserSettings'](),_0x50b4ac=[];for(const _0x55e2ff of _0x23beba[_0x154ead(0x1df)]){const _0x33eb3a=_0x23beba['availableModels'][_0x55e2ff];_0x33eb3a&&_0x50b4ac['push']({'name':_0x55e2ff,'displayName':_0x33eb3a['displayName']});}return _0x50b4ac;}async[a96_0x5d9617(0x28f)](_0x5ab81a){const _0x46865a=a96_0x5d9617;return await this['client'][_0x46865a(0x28f)](_0x5ab81a);}async[a96_0x5d9617(0x1b7)](_0x48002d){const _0x5aec44=a96_0x5d9617,{projectId:_0x49f29e}=await this[_0x5aec44(0x22a)](_0x48002d);await this[_0x5aec44(0x26e)][_0x5aec44(0x1b7)](_0x49f29e);}async[a96_0x5d9617(0x1d5)](_0x333001=0x32){const _0x44f6a2=a96_0x5d9617;return await this['client'][_0x44f6a2(0x20b)](_0x333001);}async['getOrCreateDefaultProject'](_0x52e60b){const _0x15eb23=a96_0x5d9617,_0x4cf2cd=_0x52e60b||this[_0x15eb23(0x26c)](),_0x4140ad=this[_0x15eb23(0x286)][_0x15eb23(0x25b)];if(!_0x52e60b){const _0xfc1036=readCachedLLMProject(_0x4140ad);if(_0xfc1036&&_0xfc1036[_0x15eb23(0x266)]===_0x4cf2cd)try{const _0x29ecdc=await this[_0x15eb23(0x26e)][_0x15eb23(0x248)](_0xfc1036['id']);if(_0x29ecdc[_0x15eb23(0x1eb)][_0x15eb23(0x266)]===_0x4cf2cd)return _0x29ecdc;}catch{}}const _0x4c8322=await this['client'][_0x15eb23(0x20b)](),_0x46bc28=_0x4c8322['find'](_0x153690=>_0x153690[_0x15eb23(0x1eb)]['name']===_0x4cf2cd);if(_0x46bc28)return!_0x52e60b&&writeCachedLLMProject(_0x4cf2cd,_0x46bc28['id'],_0x4140ad),_0x46bc28;const _0x1e744b=await this[_0x15eb23(0x26e)][_0x15eb23(0x28f)]({'name':_0x4cf2cd,'description':_0x15eb23(0x201)+getSanitizedUsername()+')'});return!_0x52e60b&&writeCachedLLMProject(_0x4cf2cd,_0x1e744b['id'],_0x4140ad),_0x1e744b;}async[a96_0x5d9617(0x260)](_0x4e024b){const _0x10eafb=a96_0x5d9617,_0x176d07=await this[_0x10eafb(0x26e)][_0x10eafb(0x20b)](),_0x2268d3=_0x176d07[_0x10eafb(0x20e)](_0x5bfd7a=>_0x5bfd7a[_0x10eafb(0x1eb)][_0x10eafb(0x266)]===_0x4e024b);if(_0x2268d3[_0x10eafb(0x219)]===0x0)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x10eafb(0x19c)+_0x4e024b,undefined,{'helpText':_0x10eafb(0x1cd)});if(_0x2268d3['length']>0x1)throw new SDKError(ErrorCode[_0x10eafb(0x202)],_0x10eafb(0x1b3)+_0x4e024b+_0x10eafb(0x21a));return _0x2268d3[0x0]['id'];}async['resolveProjectName'](_0x1e7264){const _0x2103d4=a96_0x5d9617,_0x4df0fe=await this[_0x2103d4(0x26e)][_0x2103d4(0x20b)](),_0x2f9193=_0x4df0fe[_0x2103d4(0x255)](_0x131721=>_0x131721[_0x2103d4(0x1eb)][_0x2103d4(0x266)]===_0x1e7264);if(_0x2f9193)return{'projectId':_0x2f9193['id'],'project':_0x2f9193};throw new SDKError(ErrorCode[_0x2103d4(0x1a1)],_0x2103d4(0x19c)+_0x1e7264,undefined,{'helpText':_0x2103d4(0x1cd)});}async[a96_0x5d9617(0x1d4)](_0x49e945='claude-4.5-sonnet',_0x29727c=0x0,_0x7b0a36){const _0x57c1de=a96_0x5d9617,_0x52a6b8=0xa;let _0x202e5c=0x0,_0x2cdd51;while(_0x202e5c<_0x52a6b8){try{const _0xd3ebe=await this[_0x57c1de(0x27a)](_0x2cdd51),_0x225cf3=_0xd3ebe['id'],_0xfacfc9=[_0x57c1de(0x229),_0x57c1de(0x1d2),_0x57c1de(0x195),'medium','high'],_0x1ba78b=_0x29727c===0x0?_0x57c1de(0x1d1)+_0x49e945:_0x57c1de(0x1d1)+_0x49e945+'_reasoning_'+_0xfacfc9[_0x29727c],_0x56be10=await this['client'][_0x57c1de(0x1a2)](_0x225cf3),_0xb2b48e=_0x56be10[_0x57c1de(0x255)](_0x169c60=>_0x169c60[_0x57c1de(0x1eb)][_0x57c1de(0x266)]===_0x1ba78b);if(_0xb2b48e)return _0xb2b48e;const _0x2ecdf1=_0x29727c>0x0?0x1:_0x7b0a36;return await this[_0x57c1de(0x26e)][_0x57c1de(0x28a)]({'name':_0x1ba78b,'projectId':_0x225cf3,'modelType':_0x49e945,'systemPrompt':'','temperature':_0x2ecdf1,'reasoningEffort':_0x29727c>0x0?_0x29727c:undefined});}catch(_0x2e1d6f){if(_0x2e1d6f instanceof HTTPClientError){const _0x121d7e=_0x2e1d6f[_0x57c1de(0x1fa)];if(_0x121d7e>=0x190&&_0x121d7e<0x1f4){if(_0x121d7e===0x191)throw new SDKError(ErrorCode[_0x57c1de(0x242)],_0x57c1de(0x247),_0x2e1d6f);else{if(_0x121d7e===0x193)throw new SDKError(ErrorCode[_0x57c1de(0x253)],_0x57c1de(0x22c),_0x2e1d6f);}throw _0x2e1d6f;}}if(errorContains(_0x2e1d6f,_0x57c1de(0x26d),_0x57c1de(0x1f5),_0x57c1de(0x1b4))){_0x202e5c++;if(_0x202e5c>=_0x52a6b8)throw new SDKError(ErrorCode[_0x57c1de(0x1c0)],_0x57c1de(0x292)+_0x52a6b8+_0x57c1de(0x19b),_0x2e1d6f);const _0x407df4=this[_0x57c1de(0x26c)]();_0x2cdd51=_0x407df4+'_'+generateRandomHex();continue;}throw _0x2e1d6f;}}throw new SDKError(ErrorCode['INTERNAL'],_0x57c1de(0x23a));}async['resolveAgentId'](_0x840679,_0x38acfb){const _0x20ed9c=a96_0x5d9617,_0x21a5a1=_0x38acfb||this[_0x20ed9c(0x210)],_0xec5db3=await this[_0x20ed9c(0x26e)][_0x20ed9c(0x1a2)](_0x21a5a1),_0x3efc04=_0xec5db3[_0x20ed9c(0x20e)](_0x477a2f=>_0x477a2f[_0x20ed9c(0x1eb)]['name']===_0x840679);if(_0x3efc04[_0x20ed9c(0x219)]===0x0){const _0x47f871=_0x21a5a1?'\x20in\x20project\x20'+_0x21a5a1:'';throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x20ed9c(0x1b2)+_0x840679+_0x47f871,undefined,{'helpText':_0x21a5a1?_0x20ed9c(0x1b1):_0x20ed9c(0x24f)});}if(_0x3efc04['length']>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x20ed9c(0x187)+_0x840679+_0x20ed9c(0x21a));return _0x3efc04[0x0]['id'];}async['agents'](_0x4be4a5){const _0x2c64f0=a96_0x5d9617,_0x34ced6=_0x4be4a5||this[_0x2c64f0(0x210)];return await this[_0x2c64f0(0x26e)]['listAgents'](_0x34ced6);}async[a96_0x5d9617(0x1ce)](_0xff64a){const _0x2b6879=a96_0x5d9617;return await this[_0x2b6879(0x26e)][_0x2b6879(0x250)](_0xff64a);}async['agent'](_0x3f3c45){const _0x3d624c=a96_0x5d9617;return await this[_0x3d624c(0x26e)][_0x3d624c(0x1a0)](_0x3f3c45);}async['createAgent'](_0x388b0c){const _0x395c71=a96_0x5d9617;return await this['client'][_0x395c71(0x28a)](_0x388b0c);}async[a96_0x5d9617(0x18f)](_0x27b0ae,_0x221ff3){return await this['client']['updateAgent'](_0x27b0ae,_0x221ff3);}async[a96_0x5d9617(0x1c9)](_0x3aeb8b){const _0x33ebf1=a96_0x5d9617;await this[_0x33ebf1(0x26e)][_0x33ebf1(0x1c9)](_0x3aeb8b);}async[a96_0x5d9617(0x25a)](_0x79bd2a){const _0x74aa07=a96_0x5d9617;return await this[_0x74aa07(0x26e)]['startChat']({'agentId':_0x79bd2a});}async*[a96_0x5d9617(0x1de)](_0x2a6b98,_0x4bcb38){const _0x2150e1=a96_0x5d9617;let _0x3c5aa6=_0x4bcb38?.[_0x2150e1(0x1ed)];const _0xda4651=_0x4bcb38?.[_0x2150e1(0x192)];if(!_0x3c5aa6){if(!_0xda4651)throw new Error(_0x2150e1(0x218));const _0x4c6abf=await this[_0x2150e1(0x26e)][_0x2150e1(0x25a)]({'agentId':_0xda4651});_0x3c5aa6=_0x4c6abf['id'],yield{'type':_0x2150e1(0x180),'data':{'chatId':_0x3c5aa6,'agentId':_0xda4651,'projectId':_0x4c6abf[_0x2150e1(0x1eb)]['projectId']}};}for await(const _0x38ec50 of this[_0x2150e1(0x26e)][_0x2150e1(0x226)](_0x3c5aa6,_0x2a6b98,_0x4bcb38?.[_0x2150e1(0x1fc)])){yield{'type':'event','data':_0x38ec50};}}async['chats'](_0xa0466e=0x32){const _0x2bcd82=a96_0x5d9617;return await this[_0x2bcd82(0x26e)][_0x2bcd82(0x24d)](_0xa0466e);}async['history'](_0x19a3d9){const _0x3e896a=a96_0x5d9617;return await this[_0x3e896a(0x26e)][_0x3e896a(0x220)](_0x19a3d9);}async[a96_0x5d9617(0x182)](_0x1198d1){const _0x4b4fb4=a96_0x5d9617;return await this[_0x4b4fb4(0x26e)][_0x4b4fb4(0x182)](_0x1198d1);}async['chatInfo'](_0x4af85d){const _0x370908=a96_0x5d9617;return await this[_0x370908(0x26e)][_0x370908(0x244)](_0x4af85d);}async[a96_0x5d9617(0x1bf)](_0x2df71a,_0x38889d,_0x59e300){const _0x2689b9=a96_0x5d9617,_0x134dee=_0x59e300?.['dryRun']??![],{projectId:_0x2ac36f,project:_0x382b18}=await this['resolveProjectName'](_0x2df71a),_0x282176=_0x382b18[_0x2689b9(0x1eb)][_0x2689b9(0x266)],_0xcee911=_0x38889d||_0x282176+_0x2689b9(0x278);if(a96_0x1974b2['existsSync'](_0xcee911)&&!_0x134dee)throw new SDKError(ErrorCode[_0x2689b9(0x1c0)],_0x2689b9(0x1d9)+_0xcee911,undefined,{'helpText':_0x2689b9(0x1c7)});const _0x5d719d=await this[_0x2689b9(0x26e)]['listAgentsFull'](_0x2ac36f),_0x3b336e=await this[_0x2689b9(0x26e)][_0x2689b9(0x1cb)](_0x2ac36f),_0x2d291d=await this[_0x2689b9(0x26e)][_0x2689b9(0x1c4)](_0x2ac36f),_0x57c742=await this[_0x2689b9(0x26e)][_0x2689b9(0x276)](_0x2ac36f);if(!_0x134dee){a96_0x1974b2[_0x2689b9(0x19e)](_0xcee911,{'recursive':!![]});const _0x59dad7={'version':'1.0','exportedAt':new Date()[_0x2689b9(0x22b)](),'exportedFrom':{'site':this[_0x2689b9(0x286)][_0x2689b9(0x287)],'projectId':_0x2ac36f,'projectName':_0x282176},'project':_0x382b18};a96_0x1974b2[_0x2689b9(0x1f4)](a96_0xa96e78['join'](_0xcee911,'project.json'),JSON[_0x2689b9(0x1cf)](_0x59dad7,null,0x2)),a96_0x1974b2[_0x2689b9(0x1f4)](a96_0xa96e78['join'](_0xcee911,_0x2689b9(0x1b0)),JSON[_0x2689b9(0x1cf)](_0x5d719d,null,0x2)),a96_0x1974b2[_0x2689b9(0x1f4)](a96_0xa96e78['join'](_0xcee911,_0x2689b9(0x27f)),JSON[_0x2689b9(0x1cf)](_0x3b336e,null,0x2)),a96_0x1974b2['writeFileSync'](a96_0xa96e78['join'](_0xcee911,'prompts.json'),JSON['stringify'](_0x2d291d,null,0x2)),a96_0x1974b2[_0x2689b9(0x1f4)](a96_0xa96e78[_0x2689b9(0x237)](_0xcee911,'integrations.json'),JSON['stringify'](_0x57c742,null,0x2));}return{'projectName':_0x282176,'outputDir':_0xcee911,'counts':{'agents':_0x5d719d['length'],'knowledgeBases':_0x3b336e[_0x2689b9(0x219)],'prompts':_0x2d291d[_0x2689b9(0x219)],'integrations':_0x57c742[_0x2689b9(0x219)]}};}async[a96_0x5d9617(0x289)](_0x51cab0,_0x37eafa){const _0x458e4d=a96_0x5d9617,_0x3efc29=_0x37eafa?.[_0x458e4d(0x184)]??![],_0x34018d=this[_0x458e4d(0x216)](_0x51cab0),_0x225f0d=_0x34018d['exportedFrom'][_0x458e4d(0x287)],_0x5bca7a=this[_0x458e4d(0x286)][_0x458e4d(0x287)],_0x58b452=_0x225f0d!==_0x5bca7a?_0x225f0d:undefined,_0x202129=this[_0x458e4d(0x1fb)](a96_0xa96e78['join'](_0x51cab0,_0x458e4d(0x1b0)),[]),_0x2f9d1f=this[_0x458e4d(0x1fb)](a96_0xa96e78['join'](_0x51cab0,_0x458e4d(0x27f)),[]),_0x447d57=this[_0x458e4d(0x1fb)](a96_0xa96e78[_0x458e4d(0x237)](_0x51cab0,_0x458e4d(0x1f7)),[]),_0x339316=this[_0x458e4d(0x1fb)](a96_0xa96e78[_0x458e4d(0x237)](_0x51cab0,_0x458e4d(0x1c3)),[]),_0x17888c=_0x37eafa?.['name']||_0x34018d[_0x458e4d(0x1a5)][_0x458e4d(0x1e1)];if(_0x3efc29){const _0x4c432d=new Map(),_0x270e7e=[..._0x202129],_0x46e815=_0x202129[_0x458e4d(0x219)]+0x1;let _0x67d146=0x0;while(_0x270e7e['length']>0x0&&_0x67d146<_0x46e815){_0x67d146++;const _0x11261a=[];for(const _0x35ed9a of _0x270e7e){canCreateAgent(_0x35ed9a,_0x4c432d)?_0x4c432d[_0x458e4d(0x203)](_0x35ed9a['id'],_0x458e4d(0x243)+_0x35ed9a['id']):_0x11261a[_0x458e4d(0x211)](_0x35ed9a);}if(_0x11261a[_0x458e4d(0x219)]===_0x270e7e[_0x458e4d(0x219)])throw new SDKError(ErrorCode[_0x458e4d(0x202)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x270e7e[_0x458e4d(0x219)]=0x0,_0x270e7e[_0x458e4d(0x211)](..._0x11261a);}const _0x116c08=_0x447d57[_0x458e4d(0x20e)](_0x5d24a4=>_0x4c432d['has'](_0x5d24a4[_0x458e4d(0x1eb)][_0x458e4d(0x192)]))['length'];return{'projectName':_0x17888c,'projectId':_0x458e4d(0x241),'counts':{'agents':_0x202129[_0x458e4d(0x219)],'knowledgeBases':_0x2f9d1f[_0x458e4d(0x219)],'prompts':_0x116c08,'integrations':_0x339316[_0x458e4d(0x219)]},'sourceSite':_0x58b452};}const _0x27584e=await this[_0x458e4d(0x26e)][_0x458e4d(0x28f)]({'name':_0x17888c,'description':_0x34018d['project'][_0x458e4d(0x1eb)][_0x458e4d(0x277)]}),_0xc02048=_0x27584e['id'],_0x17e87e=new Map(),_0x41e96d=new Map(),_0x4d0634=new Map();for(const _0x56528b of _0x2f9d1f){const _0x5a20d6=await this[_0x458e4d(0x26e)][_0x458e4d(0x1fd)]({'projectId':_0xc02048,'name':_0x56528b['attributes'][_0x458e4d(0x266)],'tdDatabaseName':_0x56528b['attributes'][_0x458e4d(0x223)],'tables':_0x56528b[_0x458e4d(0x1eb)][_0x458e4d(0x288)]});_0x17e87e['set'](_0x56528b['id'],_0x5a20d6['id']);}const _0x42ea6d=[..._0x202129],_0x29f18e=_0x202129['length']+0x1;let _0xa55e0=0x0;while(_0x42ea6d['length']>0x0&&_0xa55e0<_0x29f18e){_0xa55e0++;const _0x1f5d50=[];for(const _0x4d008 of _0x42ea6d){if(canCreateAgent(_0x4d008,_0x41e96d)){const _0x4433f4=remapToolIds(_0x4d008[_0x458e4d(0x1eb)]['tools'],_0x17e87e,_0x41e96d),_0x487562=remapVariableIds(_0x4d008['attributes'][_0x458e4d(0x1db)],_0x17e87e),_0x39734f=await this[_0x458e4d(0x26e)][_0x458e4d(0x23c)]({'name':_0x4d008[_0x458e4d(0x1eb)][_0x458e4d(0x266)],'projectId':_0xc02048,'systemPrompt':_0x4d008[_0x458e4d(0x1eb)]['systemPrompt'],'starterMessage':_0x4d008[_0x458e4d(0x1eb)]['starterMessage'],'modelType':migrateModelType(_0x4d008['attributes'][_0x458e4d(0x1f3)]),'maxToolIterations':_0x4d008[_0x458e4d(0x1eb)][_0x458e4d(0x236)],'temperature':_0x4d008[_0x458e4d(0x1eb)][_0x458e4d(0x1d3)],'reasoningEffort':_0x4d008[_0x458e4d(0x1eb)][_0x458e4d(0x1fe)],'outputs':_0x4d008[_0x458e4d(0x1eb)][_0x458e4d(0x24e)],'tools':_0x4433f4,'variables':_0x487562});_0x41e96d[_0x458e4d(0x203)](_0x4d008['id'],_0x39734f['id']);}else _0x1f5d50[_0x458e4d(0x211)](_0x4d008);}if(_0x1f5d50['length']===_0x42ea6d['length'])throw new SDKError(ErrorCode[_0x458e4d(0x202)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x458e4d(0x263)});_0x42ea6d[_0x458e4d(0x219)]=0x0,_0x42ea6d['push'](..._0x1f5d50);}for(const _0x31f2f9 of _0x447d57){const _0x110075=_0x41e96d[_0x458e4d(0x1c6)](_0x31f2f9[_0x458e4d(0x1eb)][_0x458e4d(0x192)]);if(!_0x110075)continue;const _0x5bc236=await this[_0x458e4d(0x26e)]['createPrompt']({'projectId':_0xc02048,'agentId':_0x110075,'name':_0x31f2f9[_0x458e4d(0x1eb)][_0x458e4d(0x266)],'systemPrompt':_0x31f2f9[_0x458e4d(0x1eb)]['systemPrompt'],'template':_0x31f2f9[_0x458e4d(0x1eb)]['template'],'jsonSchemaHint':_0x31f2f9[_0x458e4d(0x1eb)][_0x458e4d(0x28e)]});_0x4d0634[_0x458e4d(0x203)](_0x31f2f9['id'],_0x5bc236['id']);}for(const _0x5d02fd of _0x339316){const _0xd82e7c=_0x5d02fd[_0x458e4d(0x1eb)][_0x458e4d(0x1b8)][_0x458e4d(0x28b)](_0x42c844=>({..._0x42c844,'promptId':_0x4d0634['get'](_0x42c844['promptId'])||_0x42c844[_0x458e4d(0x188)]}));await this[_0x458e4d(0x26e)][_0x458e4d(0x23d)]({'projectId':_0xc02048,'serviceType':_0x5d02fd[_0x458e4d(0x1eb)][_0x458e4d(0x19a)],'actions':_0xd82e7c,'slackMessageMode':_0x5d02fd['attributes'][_0x458e4d(0x24b)],'chatIgnoreManagedActions':_0x5d02fd['attributes']['chatIgnoreManagedActions'],'chatWelcomeMessage':_0x5d02fd[_0x458e4d(0x1eb)][_0x458e4d(0x208)],'webhookCorsOrigins':_0x5d02fd[_0x458e4d(0x1eb)][_0x458e4d(0x1a8)]});}return{'projectName':_0x17888c,'projectId':_0xc02048,'counts':{'agents':_0x41e96d[_0x458e4d(0x193)],'knowledgeBases':_0x17e87e[_0x458e4d(0x193)],'prompts':_0x4d0634['size'],'integrations':_0x339316[_0x458e4d(0x219)]},'sourceSite':_0x58b452};}[a96_0x5d9617(0x1fb)](_0x277d13,_0x16fbdd){const _0x11c758=a96_0x5d9617;if(!a96_0x1974b2[_0x11c758(0x1b5)](_0x277d13))return _0x16fbdd;return JSON[_0x11c758(0x1f1)](a96_0x1974b2[_0x11c758(0x1af)](_0x277d13,_0x11c758(0x26f)));}['getBackupMetadata'](_0x59934a){const _0x2c1bfa=a96_0x5d9617;if(!a96_0x1974b2[_0x2c1bfa(0x1b5)](_0x59934a))throw new SDKError(ErrorCode['NOT_FOUND'],_0x2c1bfa(0x21d)+_0x59934a,undefined,{'helpText':_0x2c1bfa(0x285)});const _0x14e559=a96_0xa96e78['join'](_0x59934a,_0x2c1bfa(0x18b));if(!a96_0x1974b2['existsSync'](_0x14e559))throw new SDKError(ErrorCode[_0x2c1bfa(0x21f)],_0x2c1bfa(0x1dc)+_0x59934a,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x48ccd7=JSON[_0x2c1bfa(0x1f1)](a96_0x1974b2['readFileSync'](_0x14e559,'utf-8'));if(!isSupportedBackupVersion(_0x48ccd7[_0x2c1bfa(0x269)]))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x2c1bfa(0x1ac)+_0x48ccd7[_0x2c1bfa(0x269)],undefined,{'helpText':_0x2c1bfa(0x20a)});return _0x48ccd7;}async['pullProject'](_0x2c99fb,_0x3bc890,_0x4be00f){const _0x5a935c=a96_0x5d9617,{projectId:_0x5a3f8f,project:_0x1ca199}=await this[_0x5a935c(0x22a)](_0x2c99fb),_0x538242=_0x1ca199[_0x5a935c(0x1eb)][_0x5a935c(0x266)];let _0x208c69;if(_0x3bc890)_0x208c69=_0x3bc890;else{const _0x45b21e=a96_0xa96e78[_0x5a935c(0x237)](process[_0x5a935c(0x199)](),'agents'),_0x260058=getSanitizedPathWithMigration(_0x45b21e,_0x538242);_0x260058[_0x5a935c(0x25e)]&&this[_0x5a935c(0x282)][_0x5a935c(0x1c1)](_0x5a935c(0x1ab)+a96_0xa96e78[_0x5a935c(0x21e)](_0x260058[_0x5a935c(0x18c)])+_0x5a935c(0x224)+a96_0xa96e78[_0x5a935c(0x21e)](_0x260058[_0x5a935c(0x246)])),_0x208c69=_0x260058[_0x5a935c(0x246)];}const _0x144b6e=await this[_0x5a935c(0x26e)][_0x5a935c(0x250)](_0x5a3f8f),_0x15b792=await this['client'][_0x5a935c(0x1cb)](_0x5a3f8f),_0x273378=await this[_0x5a935c(0x26e)]['listTextKnowledgeBases'](_0x5a3f8f),_0x58fa0d=await this[_0x5a935c(0x26e)][_0x5a935c(0x1dd)](_0x5a3f8f),_0x172f70=await this[_0x5a935c(0x26e)][_0x5a935c(0x281)](_0x5a3f8f),_0x2d1302=await this[_0x5a935c(0x26e)][_0x5a935c(0x1c4)](_0x5a3f8f),_0x466fb5=await this[_0x5a935c(0x26e)]['listIntegrations'](_0x5a3f8f),_0x587ca0=await this[_0x5a935c(0x26e)][_0x5a935c(0x275)](_0x5a3f8f),_0x1a18b2=await this[_0x5a935c(0x26e)][_0x5a935c(0x265)](_0x5a3f8f),_0x56fa75=_0x466fb5['filter'](_0x4f9274=>!_0x4f9274['attributes']['isManaged']&&SAFE_INTEGRATION_TYPES[_0x5a935c(0x1ec)](_0x4f9274[_0x5a935c(0x1eb)][_0x5a935c(0x19a)][_0x5a935c(0x1f9)]())),_0x5af258=new Map(),_0x4048bc=new Map(),_0x3efd1a=new Map(),_0x4a4c2d=new Map(),_0x3102bd=new Map(),_0x3ed2c7=new Map(),_0x4cf0ea=new Map();for(const _0x2028d6 of _0x144b6e){_0x5af258['set'](_0x2028d6['id'],_0x2028d6['attributes'][_0x5a935c(0x266)]);}for(const _0x266c83 of _0x15b792){_0x4048bc[_0x5a935c(0x203)](_0x266c83['id'],_0x266c83[_0x5a935c(0x1eb)]['name']);}for(const _0x1c2edc of _0x273378){_0x3efd1a['set'](_0x1c2edc['id'],_0x1c2edc[_0x5a935c(0x1eb)]['name']);}for(const _0x563565 of _0x58fa0d){_0x4a4c2d[_0x5a935c(0x203)](_0x563565['id'],_0x563565[_0x5a935c(0x1eb)]['name']);}for(const _0x57a755 of _0x172f70){_0x3102bd[_0x5a935c(0x203)](_0x57a755['id'],_0x57a755[_0x5a935c(0x1eb)]['name']);}for(const _0x603d8b of _0x2d1302){_0x3ed2c7[_0x5a935c(0x203)](_0x603d8b['id'],_0x603d8b['attributes'][_0x5a935c(0x266)]);}for(const _0x34ef34 of _0x587ca0){_0x4cf0ea['set'](_0x34ef34['id'],_0x34ef34[_0x5a935c(0x1eb)][_0x5a935c(0x266)]);}const _0x45af7c={'resolveKnowledgeBaseName':async _0x54816a=>_0x4048bc[_0x5a935c(0x1c6)](_0x54816a),'resolveTextKnowledgeBaseName':async _0x58d48f=>_0x3efd1a[_0x5a935c(0x1c6)](_0x58d48f),'resolveAgentName':async _0x3072da=>_0x5af258[_0x5a935c(0x1c6)](_0x3072da),'resolveWebSearchToolName':async _0x518af0=>_0x3102bd[_0x5a935c(0x1c6)](_0x518af0),'resolveImageGeneratorName':async _0x2ff197=>_0x4a4c2d[_0x5a935c(0x1c6)](_0x2ff197),'resolvePromptName':async _0x31d90b=>_0x3ed2c7[_0x5a935c(0x1c6)](_0x31d90b),'resolveExperimentalKnowledgeBaseName':async _0xe11cde=>_0x4cf0ea[_0x5a935c(0x1c6)](_0xe11cde),'onWarning':_0x59bbfd=>this[_0x5a935c(0x282)][_0x5a935c(0x290)](_0x59bbfd)},_0x55e600={'projectName':_0x538242,'outputDir':_0x208c69,'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}}},_0xb7f8d7=[],_0x5294b6=[];for(const _0x26d732 of _0x144b6e){const _0x6460d=getSanitizedPathWithMigration(_0x208c69,_0x26d732[_0x5a935c(0x1eb)][_0x5a935c(0x266)]);_0x6460d[_0x5a935c(0x25e)]&&this['logger'][_0x5a935c(0x1c1)]('Renamed\x20agent\x20folder:\x20'+a96_0xa96e78[_0x5a935c(0x21e)](_0x6460d[_0x5a935c(0x18c)])+'\x20→\x20'+a96_0xa96e78[_0x5a935c(0x21e)](_0x6460d[_0x5a935c(0x246)]));const _0x48e556=_0x6460d[_0x5a935c(0x246)],_0x1a3bb2=a96_0xa96e78['join'](_0x48e556,'prompt.md'),_0x15ccb0=a96_0xa96e78[_0x5a935c(0x237)](_0x48e556,_0x5a935c(0x264)),_0x36e747=a96_0xa96e78[_0x5a935c(0x237)](_0x48e556,_0x5a935c(0x261)),{yaml:_0x5bb8ee,systemPrompt:_0x5356b0,starterMessage:_0x40a507}=await agentResponseToDef(_0x26d732,_0x45af7c),_0x27ab0e=toAgentYamlString(_0x5bb8ee),_0x1e9ac6=!a96_0x1974b2[_0x5a935c(0x1b5)](_0x15ccb0);let _0x33c3d0=_0x1e9ac6,_0x8334c5;if(!_0x1e9ac6){const _0x3679ea=a96_0x1974b2[_0x5a935c(0x1b5)](_0x1a3bb2)?a96_0x1974b2[_0x5a935c(0x1af)](_0x1a3bb2,_0x5a935c(0x26f)):'',_0x541a2a=a96_0x1974b2[_0x5a935c(0x1af)](_0x15ccb0,_0x5a935c(0x26f)),_0x4994e1='#\x20prompt.md\x0a'+_0x3679ea+'\x0a\x0a#\x20agent.yml\x0a'+_0x541a2a,_0x45e35b=_0x5a935c(0x254)+_0x5356b0+_0x5a935c(0x190)+_0x27ab0e,_0x44a12f=generateDiff(_0x4994e1,_0x45e35b);_0x33c3d0=hasChanges(_0x44a12f),_0x33c3d0&&(_0x8334c5=formatDiffWithColors(_0x44a12f));}_0xb7f8d7['push']({'path':_0x48e556,'content':'','isDir':!![]}),_0xb7f8d7['push']({'path':_0x1a3bb2,'content':_0x5356b0}),_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x15ccb0,'content':_0x27ab0e});_0x40a507&&_0x40a507['includes']('\x0a')&&_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x36e747,'content':_0x40a507});_0x55e600[_0x5a935c(0x1e3)][_0x5a935c(0x211)]({'agentName':_0x26d732[_0x5a935c(0x1eb)][_0x5a935c(0x266)],'outputPath':_0x48e556,'isNew':_0x1e9ac6,'hasChanges':_0x33c3d0,'diff':_0x8334c5}),_0x55e600['counts'][_0x5a935c(0x1e3)][_0x5a935c(0x1d0)]++;if(_0x1e9ac6)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x1e3)]['new']++;else{if(_0x33c3d0)_0x55e600['counts'][_0x5a935c(0x1e3)]['updated']++;else _0x55e600[_0x5a935c(0x234)][_0x5a935c(0x1e3)]['unchanged']++;}}for(const _0x1003a1 of _0x15b792){if(_0x1003a1[_0x5a935c(0x1eb)][_0x5a935c(0x227)])continue;const _0x1a4882=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x208c69),_0x1003a1[_0x5a935c(0x1eb)][_0x5a935c(0x266)],'.yml');_0x1a4882['renamed']&&this['logger']['info'](_0x5a935c(0x249)+a96_0xa96e78[_0x5a935c(0x21e)](_0x1a4882[_0x5a935c(0x18c)])+_0x5a935c(0x224)+a96_0xa96e78[_0x5a935c(0x21e)](_0x1a4882[_0x5a935c(0x246)]));const _0x4297d7=_0x1a4882[_0x5a935c(0x246)],_0x2057ba=apiKnowledgeBaseToYaml(_0x1003a1),_0x34854a=toKnowledgeBaseYamlString(_0x2057ba),_0xd53456=!a96_0x1974b2[_0x5a935c(0x1b5)](_0x4297d7);let _0x207c8b=_0xd53456,_0x2ba79a;if(!_0xd53456){const _0x184c97=a96_0x1974b2[_0x5a935c(0x1af)](_0x4297d7,'utf-8'),_0x2d2271=generateDiff(_0x184c97,_0x34854a);_0x207c8b=hasChanges(_0x2d2271),_0x207c8b&&(_0x2ba79a=formatDiffWithColors(_0x2d2271));}_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x4297d7,'content':_0x34854a}),_0x55e600[_0x5a935c(0x283)]['push']({'name':_0x1003a1[_0x5a935c(0x1eb)]['name'],'outputPath':_0x4297d7,'isNew':_0xd53456,'hasChanges':_0x207c8b,'diff':_0x2ba79a}),_0x55e600[_0x5a935c(0x234)]['knowledgeBases'][_0x5a935c(0x1d0)]++;if(_0xd53456)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x283)][_0x5a935c(0x28c)]++;else{if(_0x207c8b)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x283)][_0x5a935c(0x1a4)]++;else _0x55e600[_0x5a935c(0x234)][_0x5a935c(0x283)][_0x5a935c(0x238)]++;}}for(const _0x45c750 of _0x273378){if(_0x45c750['attributes'][_0x5a935c(0x227)])continue;const _0x40a51e=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x208c69),_0x45c750['attributes'][_0x5a935c(0x266)],'.md');_0x40a51e[_0x5a935c(0x25e)]&&this[_0x5a935c(0x282)]['info']('Renamed\x20text\x20KB\x20file:\x20'+a96_0xa96e78[_0x5a935c(0x21e)](_0x40a51e[_0x5a935c(0x18c)])+_0x5a935c(0x224)+a96_0xa96e78[_0x5a935c(0x21e)](_0x40a51e['path']));const _0x3ec65d=_0x40a51e['path'],_0x384932=toTextKnowledgeBaseMd(_0x45c750['attributes']['name'],_0x45c750[_0x5a935c(0x1eb)][_0x5a935c(0x206)]),_0x617ad3=!a96_0x1974b2['existsSync'](_0x3ec65d);let _0x51f6bc=_0x617ad3,_0x2ba933;if(!_0x617ad3){const _0x427129=a96_0x1974b2['readFileSync'](_0x3ec65d,_0x5a935c(0x26f)),_0x2eeb89=generateDiff(_0x427129,_0x384932);_0x51f6bc=hasChanges(_0x2eeb89),_0x51f6bc&&(_0x2ba933=formatDiffWithColors(_0x2eeb89));}_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x3ec65d,'content':_0x384932}),_0x55e600['textKnowledgeBases'][_0x5a935c(0x211)]({'name':_0x45c750['attributes'][_0x5a935c(0x266)],'outputPath':_0x3ec65d,'isNew':_0x617ad3,'hasChanges':_0x51f6bc,'diff':_0x2ba933}),_0x55e600['counts'][_0x5a935c(0x212)][_0x5a935c(0x1d0)]++;if(_0x617ad3)_0x55e600['counts'][_0x5a935c(0x212)]['new']++;else{if(_0x51f6bc)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x212)][_0x5a935c(0x1a4)]++;else _0x55e600[_0x5a935c(0x234)][_0x5a935c(0x212)][_0x5a935c(0x238)]++;}}for(const _0x3c5cad of _0x2d1302){if(_0x3c5cad[_0x5a935c(0x1eb)][_0x5a935c(0x227)])continue;const _0x4b3c63=getSanitizedPathWithMigration(getPromptsDir(_0x208c69),_0x3c5cad[_0x5a935c(0x1eb)][_0x5a935c(0x266)],_0x5a935c(0x1ee));_0x4b3c63[_0x5a935c(0x25e)]&&this['logger']['info'](_0x5a935c(0x1c5)+a96_0xa96e78[_0x5a935c(0x21e)](_0x4b3c63['oldPath'])+_0x5a935c(0x224)+a96_0xa96e78[_0x5a935c(0x21e)](_0x4b3c63['path']));const _0x11b06d=_0x4b3c63[_0x5a935c(0x246)],_0x3e1b6a=await apiPromptToYaml(_0x3c5cad,_0x45af7c);if(!_0x3e1b6a)continue;const _0x3f5180=toPromptYamlString(_0x3e1b6a),_0x32afb6=!a96_0x1974b2[_0x5a935c(0x1b5)](_0x11b06d);let _0x2de6d1=_0x32afb6,_0x5f5445;if(!_0x32afb6){const _0x1e8d3d=a96_0x1974b2[_0x5a935c(0x1af)](_0x11b06d,_0x5a935c(0x26f)),_0x253156=generateDiff(_0x1e8d3d,_0x3f5180);_0x2de6d1=hasChanges(_0x253156),_0x2de6d1&&(_0x5f5445=formatDiffWithColors(_0x253156));}_0xb7f8d7['push']({'path':_0x11b06d,'content':_0x3f5180}),_0x55e600[_0x5a935c(0x1e9)][_0x5a935c(0x211)]({'name':_0x3c5cad[_0x5a935c(0x1eb)][_0x5a935c(0x266)],'outputPath':_0x11b06d,'isNew':_0x32afb6,'hasChanges':_0x2de6d1,'diff':_0x5f5445}),_0x55e600[_0x5a935c(0x234)]['prompts']['total']++;if(_0x32afb6)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x1e9)][_0x5a935c(0x28c)]++;else{if(_0x2de6d1)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x1e9)]['updated']++;else _0x55e600[_0x5a935c(0x234)]['prompts'][_0x5a935c(0x238)]++;}}for(const _0x38db5f of _0x56fa75){const _0x405fdc=_0x38db5f['attributes'][_0x5a935c(0x19a)][_0x5a935c(0x1f9)](),_0x44420b=getSanitizedPathWithMigration(getIntegrationsDir(_0x208c69),_0x405fdc,'.yml');_0x44420b[_0x5a935c(0x25e)]&&this[_0x5a935c(0x282)][_0x5a935c(0x1c1)](_0x5a935c(0x209)+a96_0xa96e78['basename'](_0x44420b[_0x5a935c(0x18c)])+_0x5a935c(0x224)+a96_0xa96e78[_0x5a935c(0x21e)](_0x44420b[_0x5a935c(0x246)]));const _0x37f40b=_0x44420b[_0x5a935c(0x246)],_0x4e5643=await apiIntegrationToYaml(_0x38db5f,_0x45af7c),_0x369a58=toIntegrationYamlString(_0x4e5643),_0x28f974=!a96_0x1974b2[_0x5a935c(0x1b5)](_0x37f40b);let _0x39de85=_0x28f974,_0x1e7e00;if(!_0x28f974){const _0x33e52b=a96_0x1974b2[_0x5a935c(0x1af)](_0x37f40b,'utf-8'),_0x16fdd5=generateDiff(_0x33e52b,_0x369a58);_0x39de85=hasChanges(_0x16fdd5),_0x39de85&&(_0x1e7e00=formatDiffWithColors(_0x16fdd5));}_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x37f40b,'content':_0x369a58}),_0x55e600['integrations'][_0x5a935c(0x211)]({'name':_0x405fdc,'outputPath':_0x37f40b,'isNew':_0x28f974,'hasChanges':_0x39de85,'diff':_0x1e7e00}),_0x55e600[_0x5a935c(0x234)]['integrations'][_0x5a935c(0x1d0)]++;if(_0x28f974)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x26a)][_0x5a935c(0x28c)]++;else{if(_0x39de85)_0x55e600['counts'][_0x5a935c(0x26a)][_0x5a935c(0x1a4)]++;else _0x55e600[_0x5a935c(0x234)][_0x5a935c(0x26a)][_0x5a935c(0x238)]++;}}for(const _0x17450e of _0x587ca0){if(_0x17450e[_0x5a935c(0x1eb)][_0x5a935c(0x227)])continue;const _0x4717d7=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x208c69),_0x17450e[_0x5a935c(0x1eb)][_0x5a935c(0x266)]);_0x4717d7[_0x5a935c(0x25e)]&&this['logger'][_0x5a935c(0x1c1)]('Renamed\x20experimental\x20KB\x20directory:\x20'+a96_0xa96e78['basename'](_0x4717d7[_0x5a935c(0x18c)])+_0x5a935c(0x224)+a96_0xa96e78[_0x5a935c(0x21e)](_0x4717d7[_0x5a935c(0x246)]));const _0x2d4225=_0x4717d7[_0x5a935c(0x246)],_0x10c830=a96_0xa96e78[_0x5a935c(0x237)](_0x2d4225,sanitizeForFilesystem(_0x17450e[_0x5a935c(0x1eb)][_0x5a935c(0x266)])+'.yml'),_0x486c7d=a96_0xa96e78[_0x5a935c(0x237)](_0x2d4225,_0x5a935c(0x1e7)),_0x1dba3a=apiExperimentalKnowledgeBaseToYaml(_0x17450e),_0x526452=toExperimentalKnowledgeBaseYamlString(_0x1dba3a),_0x3d6c2d=!a96_0x1974b2['existsSync'](_0x2d4225);let _0x49d8fb=_0x3d6c2d,_0x3b0118,_0x510980=_0x526452;const _0x2d7488=[..._0x1dba3a[_0x5a935c(0x1e7)]][_0x5a935c(0x22e)]((_0x452dcd,_0x27d652)=>_0x452dcd['name'][_0x5a935c(0x1e6)](_0x27d652[_0x5a935c(0x266)]));for(const _0x535233 of _0x2d7488){_0x510980+='\x0a---\x20function:\x20'+_0x535233[_0x5a935c(0x266)]+_0x5a935c(0x1ae)+_0x535233[_0x5a935c(0x235)]+'\x0a---\x20schema:\x20'+_0x535233[_0x5a935c(0x266)]+_0x5a935c(0x1ae)+_0x535233[_0x5a935c(0x1f2)]+'\x0a';}if(!_0x3d6c2d){let _0x4377cb='';a96_0x1974b2['existsSync'](_0x10c830)&&(_0x4377cb=a96_0x1974b2[_0x5a935c(0x1af)](_0x10c830,_0x5a935c(0x26f)));if(a96_0x1974b2[_0x5a935c(0x1b5)](_0x486c7d)){const _0x41ac70=a96_0x1974b2['readdirSync'](_0x486c7d,{'withFileTypes':!![]}),_0x59ac56=_0x41ac70[_0x5a935c(0x20e)](_0x7c5fa1=>_0x7c5fa1[_0x5a935c(0x22f)]())[_0x5a935c(0x22e)]((_0x5c7aa7,_0x49dc01)=>_0x5c7aa7[_0x5a935c(0x266)][_0x5a935c(0x1e6)](_0x49dc01[_0x5a935c(0x266)]));for(const _0x1fab17 of _0x59ac56){const _0x3dd648=a96_0xa96e78[_0x5a935c(0x237)](_0x486c7d,_0x1fab17[_0x5a935c(0x266)],'code.js'),_0x46dd02=a96_0xa96e78['join'](_0x486c7d,_0x1fab17[_0x5a935c(0x266)],_0x5a935c(0x27b));a96_0x1974b2['existsSync'](_0x3dd648)&&(_0x4377cb+='\x0a---\x20function:\x20'+_0x1fab17[_0x5a935c(0x266)]+_0x5a935c(0x1ae)+a96_0x1974b2['readFileSync'](_0x3dd648,_0x5a935c(0x26f))+'\x0a'),a96_0x1974b2[_0x5a935c(0x1b5)](_0x46dd02)&&(_0x4377cb+='---\x20schema:\x20'+_0x1fab17[_0x5a935c(0x266)]+_0x5a935c(0x1ae)+a96_0x1974b2[_0x5a935c(0x1af)](_0x46dd02,'utf-8')+'\x0a');}}const _0x14ee0e=generateDiff(_0x4377cb,_0x510980);_0x49d8fb=hasChanges(_0x14ee0e),_0x49d8fb&&(_0x3b0118=formatDiffWithColors(_0x14ee0e));}_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x2d4225,'content':'','isDir':!![]}),_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x10c830,'content':_0x526452}),_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x486c7d,'content':'','isDir':!![]});for(const _0x460a56 of _0x1dba3a[_0x5a935c(0x1e7)]){const _0x336d94=a96_0xa96e78['join'](_0x486c7d,sanitizeForFilesystem(_0x460a56[_0x5a935c(0x266)])),_0x55074b=a96_0xa96e78[_0x5a935c(0x237)](_0x336d94,_0x5a935c(0x233)),_0x36b521=a96_0xa96e78[_0x5a935c(0x237)](_0x336d94,'json_schema.json');_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x336d94,'content':'','isDir':!![]}),_0xb7f8d7['push']({'path':_0x55074b,'content':_0x460a56[_0x5a935c(0x235)]}),_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x36b521,'content':_0x460a56[_0x5a935c(0x1f2)]});}if(a96_0x1974b2['existsSync'](_0x486c7d)){const _0x8058e0=a96_0x1974b2['readdirSync'](_0x486c7d,{'withFileTypes':!![]}),_0xca1202=new Set(_0x1dba3a[_0x5a935c(0x1e7)][_0x5a935c(0x28b)](_0x1def83=>sanitizeForFilesystem(_0x1def83[_0x5a935c(0x266)])));for(const _0x43433e of _0x8058e0){if(_0x43433e[_0x5a935c(0x22f)]()&&!_0xca1202[_0x5a935c(0x267)](_0x43433e[_0x5a935c(0x266)])){const _0x550e05=a96_0xa96e78[_0x5a935c(0x237)](_0x486c7d,_0x43433e[_0x5a935c(0x266)]);_0x5294b6[_0x5a935c(0x211)]({'path':_0x550e05,'isDir':!![]});}}}_0x55e600['experimentalKnowledgeBases'][_0x5a935c(0x211)]({'name':_0x17450e['attributes']['name'],'outputPath':_0x2d4225,'isNew':_0x3d6c2d,'hasChanges':_0x49d8fb,'diff':_0x3b0118}),_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x19d)][_0x5a935c(0x1d0)]++;if(_0x3d6c2d)_0x55e600['counts']['experimentalKnowledgeBases'][_0x5a935c(0x28c)]++;else{if(_0x49d8fb)_0x55e600['counts']['experimentalKnowledgeBases'][_0x5a935c(0x1a4)]++;else _0x55e600[_0x5a935c(0x234)][_0x5a935c(0x19d)]['unchanged']++;}}for(const _0x821210 of _0x1a18b2){if(_0x821210[_0x5a935c(0x1eb)]['isManaged'])continue;const _0x3ab127=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x208c69),_0x821210[_0x5a935c(0x1eb)][_0x5a935c(0x266)]);_0x3ab127['renamed']&&this[_0x5a935c(0x282)]['info'](_0x5a935c(0x191)+a96_0xa96e78[_0x5a935c(0x21e)](_0x3ab127['oldPath'])+'\x20→\x20'+a96_0xa96e78[_0x5a935c(0x21e)](_0x3ab127[_0x5a935c(0x246)]));const _0x387f31=_0x3ab127['path'],_0x2c702e=a96_0xa96e78[_0x5a935c(0x237)](_0x387f31,sanitizeForFilesystem(_0x821210[_0x5a935c(0x1eb)][_0x5a935c(0x266)])+_0x5a935c(0x1ee)),_0x5f2256=a96_0xa96e78[_0x5a935c(0x237)](_0x387f31,_0x5a935c(0x233)),_0x595d0a=a96_0xa96e78[_0x5a935c(0x237)](_0x387f31,'files'),_0x2990ae=apiExperimentalArtifactToYaml(_0x821210),_0x23b961=toExperimentalArtifactYamlString(_0x2990ae),_0x2b3e14=!a96_0x1974b2[_0x5a935c(0x1b5)](_0x387f31);let _0x37324f=_0x2b3e14,_0x5bb5ad,_0x4c9587=_0x23b961+(_0x5a935c(0x1a6)+_0x2990ae[_0x5a935c(0x235)]+'\x0a');const _0x4ad6a5=[..._0x2990ae['files']][_0x5a935c(0x22e)]((_0x1b7152,_0x2d4dd3)=>_0x1b7152[_0x5a935c(0x1be)]['localeCompare'](_0x2d4dd3[_0x5a935c(0x1be)]));for(const _0x31d0d9 of _0x4ad6a5){_0x4c9587+=_0x5a935c(0x186)+_0x31d0d9[_0x5a935c(0x1be)]+_0x5a935c(0x1ae)+_0x31d0d9[_0x5a935c(0x1e4)]+'\x0a';}if(!_0x2b3e14){let _0xedc6bd='';a96_0x1974b2[_0x5a935c(0x1b5)](_0x2c702e)&&(_0xedc6bd=a96_0x1974b2['readFileSync'](_0x2c702e,'utf-8'));a96_0x1974b2[_0x5a935c(0x1b5)](_0x5f2256)&&(_0xedc6bd+='\x0a---\x20code\x20---\x0a'+a96_0x1974b2[_0x5a935c(0x1af)](_0x5f2256,_0x5a935c(0x26f))+'\x0a');if(a96_0x1974b2[_0x5a935c(0x1b5)](_0x595d0a)){const _0x18dc5a=a96_0x1974b2['readdirSync'](_0x595d0a),_0x3ea0f1=_0x18dc5a[_0x5a935c(0x20e)](_0x48ce3a=>{const _0xe9012f=_0x5a935c,_0x11d22b=a96_0xa96e78[_0xe9012f(0x237)](_0x595d0a,_0x48ce3a);return a96_0x1974b2[_0xe9012f(0x1bb)](_0x11d22b)[_0xe9012f(0x221)]();})[_0x5a935c(0x22e)]((_0x20fd5a,_0x51bef3)=>_0x20fd5a[_0x5a935c(0x1e6)](_0x51bef3));for(const _0x9f4c8 of _0x3ea0f1){const _0x597f2f=a96_0xa96e78['join'](_0x595d0a,_0x9f4c8);_0xedc6bd+=_0x5a935c(0x186)+_0x9f4c8+_0x5a935c(0x1ae)+a96_0x1974b2[_0x5a935c(0x1af)](_0x597f2f,_0x5a935c(0x26f))+'\x0a';}}const _0x6ac46d=generateDiff(_0xedc6bd,_0x4c9587);_0x37324f=hasChanges(_0x6ac46d),_0x37324f&&(_0x5bb5ad=formatDiffWithColors(_0x6ac46d));}_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x387f31,'content':'','isDir':!![]}),_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x2c702e,'content':_0x23b961}),_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x5f2256,'content':_0x2990ae[_0x5a935c(0x235)]});if(_0x2990ae[_0x5a935c(0x194)][_0x5a935c(0x219)]>0x0){_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x595d0a,'content':'','isDir':!![]});for(const _0x1917cc of _0x2990ae['files']){const _0x19b55b=a96_0xa96e78[_0x5a935c(0x237)](_0x595d0a,_0x1917cc[_0x5a935c(0x1be)]);_0xb7f8d7[_0x5a935c(0x211)]({'path':_0x19b55b,'content':_0x1917cc[_0x5a935c(0x1e4)]});}}if(a96_0x1974b2[_0x5a935c(0x1b5)](_0x595d0a)){const _0xf59a5=a96_0x1974b2[_0x5a935c(0x1b6)](_0x595d0a),_0x1d52d2=new Set(_0x2990ae[_0x5a935c(0x194)][_0x5a935c(0x28b)](_0x10e97c=>_0x10e97c[_0x5a935c(0x1be)]));for(const _0x2c5da5 of _0xf59a5){const _0x190627=a96_0xa96e78[_0x5a935c(0x237)](_0x595d0a,_0x2c5da5);a96_0x1974b2[_0x5a935c(0x1bb)](_0x190627)['isFile']()&&!_0x1d52d2[_0x5a935c(0x267)](_0x2c5da5)&&_0x5294b6[_0x5a935c(0x211)]({'path':_0x190627});}}_0x55e600[_0x5a935c(0x1d6)]['push']({'name':_0x821210[_0x5a935c(0x1eb)][_0x5a935c(0x266)],'outputPath':_0x387f31,'isNew':_0x2b3e14,'hasChanges':_0x37324f,'diff':_0x5bb5ad}),_0x55e600['counts']['experimentalArtifacts']['total']++;if(_0x2b3e14)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x1d6)][_0x5a935c(0x28c)]++;else{if(_0x37324f)_0x55e600[_0x5a935c(0x234)][_0x5a935c(0x1d6)][_0x5a935c(0x1a4)]++;else _0x55e600['counts'][_0x5a935c(0x1d6)][_0x5a935c(0x238)]++;}}if(_0x4be00f?.['dryRun'])return _0x55e600;a96_0x1974b2[_0x5a935c(0x19e)](_0x208c69,{'recursive':!![]}),a96_0x1974b2[_0x5a935c(0x19e)](getKnowledgeBasesDir(_0x208c69),{'recursive':!![]}),a96_0x1974b2[_0x5a935c(0x19e)](getPromptsDir(_0x208c69),{'recursive':!![]}),a96_0x1974b2[_0x5a935c(0x19e)](getIntegrationsDir(_0x208c69),{'recursive':!![]}),a96_0x1974b2[_0x5a935c(0x19e)](getExperimentalKnowledgeBasesDir(_0x208c69),{'recursive':!![]}),a96_0x1974b2[_0x5a935c(0x19e)](getExperimentalArtifactsDir(_0x208c69),{'recursive':!![]});const _0x1f1100=a96_0xa96e78[_0x5a935c(0x237)](_0x208c69,'tdx.json');a96_0x1974b2['writeFileSync'](_0x1f1100,createAgentConfigContent(_0x538242));for(const _0x18784f of _0xb7f8d7){if(_0x18784f[_0x5a935c(0x197)])a96_0x1974b2[_0x5a935c(0x19e)](_0x18784f[_0x5a935c(0x246)],{'recursive':!![]});else{const _0xa6ca92=a96_0xa96e78[_0x5a935c(0x1e8)](_0x18784f[_0x5a935c(0x246)]);!a96_0x1974b2[_0x5a935c(0x1b5)](_0xa6ca92)&&a96_0x1974b2[_0x5a935c(0x19e)](_0xa6ca92,{'recursive':!![]}),a96_0x1974b2[_0x5a935c(0x1f4)](_0x18784f[_0x5a935c(0x246)],_0x18784f[_0x5a935c(0x20c)]);}}for(const _0x57f5df of _0x5294b6){_0x57f5df['isDir']?(a96_0x1974b2[_0x5a935c(0x280)](_0x57f5df[_0x5a935c(0x246)],{'recursive':!![],'force':!![]}),this[_0x5a935c(0x282)][_0x5a935c(0x1c1)](_0x5a935c(0x228)+a96_0xa96e78[_0x5a935c(0x21e)](a96_0xa96e78['dirname'](_0x57f5df[_0x5a935c(0x246)]))+'/'+a96_0xa96e78[_0x5a935c(0x21e)](_0x57f5df['path']))):(a96_0x1974b2['rmSync'](_0x57f5df['path'],{'force':!![]}),this[_0x5a935c(0x282)]['info']('Removed\x20deleted\x20file:\x20'+a96_0xa96e78[_0x5a935c(0x21e)](a96_0xa96e78[_0x5a935c(0x1e8)](_0x57f5df[_0x5a935c(0x246)]))+'/'+a96_0xa96e78['basename'](_0x57f5df['path'])));}return _0x55e600;}async[a96_0x5d9617(0x1a3)](_0x566498,_0x2f9739){const _0xc0009=a96_0x5d9617,_0x2e8ffd=a96_0xa96e78[_0xc0009(0x237)](_0x566498,_0xc0009(0x23e));if(!a96_0x1974b2['existsSync'](_0x2e8ffd))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0xc0009(0x20d)+_0x566498,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x32b850=loadAgentConfig(_0x2e8ffd),_0xffbd1=await this[_0xc0009(0x260)](_0x32b850[_0xc0009(0x198)]),_0x4c522c=await this[_0xc0009(0x26e)]['getProject'](_0xffbd1),_0x24959c=_0x4c522c[_0xc0009(0x1eb)]['name'],_0x5ef5c2={'projectName':_0x24959c,'projectId':_0xffbd1,'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}}},_0x259a00=[],_0x28ec15=[],_0x29aa56=[],_0x28a987=[],_0x3cc637=[],_0x59ca95=[],_0xfe2cd2=a96_0x1974b2[_0xc0009(0x1b6)](_0x566498,{'withFileTypes':!![]});for(const _0xfc539e of _0xfe2cd2){if(!_0xfc539e[_0xc0009(0x22f)]())continue;if([_0xc0009(0x183),_0xc0009(0x1e9),_0xc0009(0x26a),_0xc0009(0x232),'experimental_artifacts'][_0xc0009(0x1ec)](_0xfc539e[_0xc0009(0x266)]))continue;const _0xe31c4b=a96_0xa96e78['join'](_0x566498,_0xfc539e['name']);if(isAgentDir(_0xe31c4b)){const _0x28e8a5=a96_0xa96e78['join'](_0xe31c4b,_0xc0009(0x264)),_0x523351=a96_0xa96e78[_0xc0009(0x237)](_0xe31c4b,'prompt.md'),_0x5f106a=a96_0xa96e78['join'](_0xe31c4b,_0xc0009(0x261)),_0x377833=parseAgentYaml(a96_0x1974b2[_0xc0009(0x1af)](_0x28e8a5,_0xc0009(0x26f)),_0x28e8a5),_0x7ebef6=a96_0x1974b2[_0xc0009(0x1b5)](_0x523351)?a96_0x1974b2[_0xc0009(0x1af)](_0x523351,_0xc0009(0x26f)):'',_0x53be87=a96_0x1974b2[_0xc0009(0x1b5)](_0x5f106a)?a96_0x1974b2['readFileSync'](_0x5f106a,_0xc0009(0x26f)):_0x377833[_0xc0009(0x272)];_0x259a00['push']({'name':_0x377833['name'],'dir':_0xe31c4b,'yaml':_0x377833,'systemPrompt':_0x7ebef6,'starterMessage':_0x53be87});}}const _0x261cd7=getKnowledgeBasesDir(_0x566498);if(a96_0x1974b2[_0xc0009(0x1b5)](_0x261cd7)){const _0x346c56=a96_0x1974b2['readdirSync'](_0x261cd7);for(const _0x1c4a8c of _0x346c56){const _0xacc317=a96_0xa96e78[_0xc0009(0x237)](_0x261cd7,_0x1c4a8c);if(_0x1c4a8c[_0xc0009(0x1e5)](_0xc0009(0x1ee))){const _0x45b2d6=parseKnowledgeBaseYaml(a96_0x1974b2[_0xc0009(0x1af)](_0xacc317,_0xc0009(0x26f)),_0xacc317);_0x28ec15['push']({'name':_0x45b2d6[_0xc0009(0x266)],'path':_0xacc317,'yaml':_0x45b2d6});}else{if(_0x1c4a8c['endsWith'](_0xc0009(0x215))){const _0x4746f2=a96_0x1974b2['readFileSync'](_0xacc317,_0xc0009(0x26f)),{name:_0x544599,text:_0x4a8e1e}=parseTextKnowledgeBaseMd(_0x4746f2,_0x1c4a8c);_0x29aa56[_0xc0009(0x211)]({'name':_0x544599,'path':_0xacc317,'text':_0x4a8e1e});}}}}const _0x356109=getPromptsDir(_0x566498);if(a96_0x1974b2[_0xc0009(0x1b5)](_0x356109)){const _0x2b4419=a96_0x1974b2['readdirSync'](_0x356109)['filter'](_0x1a9b35=>_0x1a9b35['endsWith'](_0xc0009(0x1ee)));for(const _0x42b8b7 of _0x2b4419){const _0x57a625=a96_0xa96e78[_0xc0009(0x237)](_0x356109,_0x42b8b7),_0x5ad495=parsePromptYaml(a96_0x1974b2['readFileSync'](_0x57a625,'utf-8'),_0x57a625);_0x28a987[_0xc0009(0x211)]({'name':_0x5ad495['name'],'path':_0x57a625,'yaml':_0x5ad495});}}const _0x4d03f8=[],_0x126936=getIntegrationsDir(_0x566498);if(a96_0x1974b2['existsSync'](_0x126936)){const _0x37fcd8=a96_0x1974b2[_0xc0009(0x1b6)](_0x126936)[_0xc0009(0x20e)](_0x55723e=>_0x55723e[_0xc0009(0x1e5)]('.yml'));for(const _0x254e60 of _0x37fcd8){const _0x1cb261=a96_0xa96e78[_0xc0009(0x237)](_0x126936,_0x254e60),_0x4f1dc5=parseIntegrationYaml(a96_0x1974b2[_0xc0009(0x1af)](_0x1cb261,'utf-8'),_0x1cb261);if(!SAFE_INTEGRATION_TYPES[_0xc0009(0x1ec)](_0x4f1dc5['service_type'][_0xc0009(0x1f9)]())){this[_0xc0009(0x282)][_0xc0009(0x290)](_0xc0009(0x25f)+_0x4f1dc5[_0xc0009(0x266)]+_0xc0009(0x204)+_0x4f1dc5[_0xc0009(0x259)]+_0xc0009(0x27d)+(_0xc0009(0x1ef)+SAFE_INTEGRATION_TYPES[_0xc0009(0x237)](',\x20')+_0xc0009(0x1e2))+_0xc0009(0x18d));continue;}_0x4d03f8['push']({'name':_0x4f1dc5['name'],'path':_0x1cb261,'yaml':_0x4f1dc5});}}const _0x2c7dc1=getExperimentalKnowledgeBasesDir(_0x566498);if(a96_0x1974b2[_0xc0009(0x1b5)](_0x2c7dc1)){const _0x198cfb=a96_0x1974b2[_0xc0009(0x1b6)](_0x2c7dc1,{'withFileTypes':!![]});for(const _0x5a2498 of _0x198cfb){if(!_0x5a2498[_0xc0009(0x22f)]())continue;const _0x534b73=a96_0xa96e78[_0xc0009(0x237)](_0x2c7dc1,_0x5a2498[_0xc0009(0x266)]),_0x172465=a96_0xa96e78[_0xc0009(0x237)](_0x534b73,_0x5a2498[_0xc0009(0x266)]+'.yml'),_0x2bd54a=a96_0xa96e78[_0xc0009(0x237)](_0x534b73,_0xc0009(0x1e7));if(!a96_0x1974b2[_0xc0009(0x1b5)](_0x172465))continue;const _0x13b783=parseExperimentalKnowledgeBaseYaml(a96_0x1974b2[_0xc0009(0x1af)](_0x172465,_0xc0009(0x26f)),_0x172465),_0x3e329a=[];if(a96_0x1974b2[_0xc0009(0x1b5)](_0x2bd54a)){const _0x2d8aed=a96_0x1974b2['readdirSync'](_0x2bd54a,{'withFileTypes':!![]});for(const _0x4f03ec of _0x2d8aed){if(!_0x4f03ec[_0xc0009(0x22f)]())continue;const _0x20e336=a96_0xa96e78[_0xc0009(0x237)](_0x2bd54a,_0x4f03ec[_0xc0009(0x266)]),_0x28f054=a96_0xa96e78[_0xc0009(0x237)](_0x20e336,_0xc0009(0x233)),_0x20fa92=a96_0xa96e78['join'](_0x20e336,_0xc0009(0x27b));a96_0x1974b2[_0xc0009(0x1b5)](_0x28f054)&&a96_0x1974b2[_0xc0009(0x1b5)](_0x20fa92)&&_0x3e329a[_0xc0009(0x211)]({'name':_0x4f03ec[_0xc0009(0x266)],'code':a96_0x1974b2['readFileSync'](_0x28f054,_0xc0009(0x26f)),'json_schema':a96_0x1974b2['readFileSync'](_0x20fa92,_0xc0009(0x26f))});}}const _0x1c3852={..._0x13b783,'variables':_0x13b783[_0xc0009(0x1db)]||[],'functions':_0x3e329a};_0x3cc637[_0xc0009(0x211)]({'name':_0x13b783[_0xc0009(0x266)],'dir':_0x534b73,'def':_0x1c3852});}}const _0x28a6bb=getExperimentalArtifactsDir(_0x566498);if(a96_0x1974b2[_0xc0009(0x1b5)](_0x28a6bb)){const _0x4cf827=a96_0x1974b2['readdirSync'](_0x28a6bb,{'withFileTypes':!![]});for(const _0x7130ea of _0x4cf827){if(!_0x7130ea[_0xc0009(0x22f)]())continue;const _0x3dc9f5=a96_0xa96e78[_0xc0009(0x237)](_0x28a6bb,_0x7130ea[_0xc0009(0x266)]),_0x582fcf=a96_0xa96e78[_0xc0009(0x237)](_0x3dc9f5,_0x7130ea[_0xc0009(0x266)]+_0xc0009(0x1ee)),_0x43087b=a96_0xa96e78['join'](_0x3dc9f5,_0xc0009(0x233)),_0x4e1210=a96_0xa96e78['join'](_0x3dc9f5,_0xc0009(0x194));if(!a96_0x1974b2[_0xc0009(0x1b5)](_0x582fcf)||!a96_0x1974b2[_0xc0009(0x1b5)](_0x43087b))continue;const _0xc982fc=parseExperimentalArtifactYaml(a96_0x1974b2[_0xc0009(0x1af)](_0x582fcf,'utf-8'),_0x582fcf),_0x2cb529=a96_0x1974b2[_0xc0009(0x1af)](_0x43087b,_0xc0009(0x26f)),_0x96635c=[];if(a96_0x1974b2[_0xc0009(0x1b5)](_0x4e1210)){const _0xb60b35=a96_0x1974b2['readdirSync'](_0x4e1210);for(const _0x430f35 of _0xb60b35){const _0x5061e6=a96_0xa96e78[_0xc0009(0x237)](_0x4e1210,_0x430f35);a96_0x1974b2[_0xc0009(0x1bb)](_0x5061e6)['isFile']()&&_0x96635c[_0xc0009(0x211)]({'file_name':_0x430f35,'text_content':a96_0x1974b2[_0xc0009(0x1af)](_0x5061e6,_0xc0009(0x26f))});}}const _0x34bc79={..._0xc982fc,'code':_0x2cb529,'files':_0x96635c};_0x59ca95[_0xc0009(0x211)]({'name':_0xc982fc[_0xc0009(0x266)],'dir':_0x3dc9f5,'def':_0x34bc79});}}const _0x56a4a5=await this[_0xc0009(0x26e)][_0xc0009(0x250)](_0xffbd1),_0x142256=await this[_0xc0009(0x26e)][_0xc0009(0x1cb)](_0xffbd1),_0x17f9c6=await this[_0xc0009(0x26e)][_0xc0009(0x196)](_0xffbd1),_0x119c36=await this[_0xc0009(0x26e)][_0xc0009(0x1dd)](_0xffbd1),_0x543383=await this[_0xc0009(0x26e)]['listWebSearchTools'](_0xffbd1),_0x214be7=await this['client'][_0xc0009(0x1c4)](_0xffbd1),_0x434008=await this[_0xc0009(0x26e)][_0xc0009(0x276)](_0xffbd1),_0x580340=await this[_0xc0009(0x26e)][_0xc0009(0x1a7)](_0xffbd1),_0x46c06b=await this[_0xc0009(0x26e)][_0xc0009(0x275)](_0xffbd1),_0x14403a=await this[_0xc0009(0x26e)][_0xc0009(0x265)](_0xffbd1),_0x33329e=new Map(),_0xc95e25=new Map(),_0x8ce0b9=new Map(),_0x4ead06=new Map(),_0x23c33f=new Map(),_0x5a17cc=new Map(),_0x5a3acc=new Map();for(const _0x1005ee of _0x56a4a5){_0x33329e[_0xc0009(0x203)](_0x1005ee['attributes']['name'],_0x1005ee);}for(const _0x5a939c of _0x142256){_0xc95e25[_0xc0009(0x203)](_0x5a939c[_0xc0009(0x1eb)]['name'],_0x5a939c);}for(const _0x5f27dc of _0x17f9c6){_0x8ce0b9[_0xc0009(0x203)](_0x5f27dc[_0xc0009(0x1eb)]['name'],_0x5f27dc);}for(const _0x452039 of _0x214be7){_0x4ead06['set'](_0x452039[_0xc0009(0x1eb)][_0xc0009(0x266)],_0x452039);}for(const _0x51f4d1 of _0x434008){_0x23c33f[_0xc0009(0x203)](_0x51f4d1['attributes'][_0xc0009(0x19a)][_0xc0009(0x1f9)](),_0x51f4d1);}for(const _0x64f625 of _0x46c06b){_0x5a17cc[_0xc0009(0x203)](_0x64f625['attributes'][_0xc0009(0x266)],_0x64f625);}for(const _0x779552 of _0x14403a){_0x5a3acc['set'](_0x779552[_0xc0009(0x1eb)][_0xc0009(0x266)],_0x779552);}const _0x1d9915=new Map(),_0x4b6692=new Map(),_0x379c7a=new Map(),_0x53574c=new Map(),_0x50ee83=new Map(),_0x41e09d=new Map(),_0x53647e=new Map(),_0x3ea53e=new Map(),_0xc24aae=new Map(),_0x1bd36a=new Map(),_0x2f9db5=new Map(),_0x5f5089=new Map(),_0x4bae66=new Map(),_0x37a103=new Map(),_0xbbfb8c=new Map(),_0x5dbd4c=new Map();for(const _0x4ab7f0 of _0x142256){_0x1d9915['set'](_0x4ab7f0[_0xc0009(0x1eb)][_0xc0009(0x266)],_0x4ab7f0['id']),_0xc24aae[_0xc0009(0x203)](_0x4ab7f0['id'],_0x4ab7f0['attributes'][_0xc0009(0x266)]);}for(const _0x1ca3a8 of _0x17f9c6){_0x4b6692[_0xc0009(0x203)](_0x1ca3a8['attributes'][_0xc0009(0x266)],_0x1ca3a8['id']),_0x1bd36a['set'](_0x1ca3a8['id'],_0x1ca3a8['attributes'][_0xc0009(0x266)]);}for(const _0x82d1fc of _0x56a4a5){_0x379c7a[_0xc0009(0x203)](_0x82d1fc[_0xc0009(0x1eb)][_0xc0009(0x266)],_0x82d1fc['id']),_0x2f9db5[_0xc0009(0x203)](_0x82d1fc['id'],_0x82d1fc[_0xc0009(0x1eb)][_0xc0009(0x266)]);}for(const _0x39cc57 of _0x119c36){_0x53574c[_0xc0009(0x203)](_0x39cc57[_0xc0009(0x1eb)][_0xc0009(0x266)],_0x39cc57['id']),_0x5f5089[_0xc0009(0x203)](_0x39cc57['id'],_0x39cc57['attributes']['name']);}for(const _0x1782c7 of _0x543383){_0x50ee83[_0xc0009(0x203)](_0x1782c7[_0xc0009(0x1eb)][_0xc0009(0x266)],_0x1782c7['id']),_0x4bae66[_0xc0009(0x203)](_0x1782c7['id'],_0x1782c7[_0xc0009(0x1eb)][_0xc0009(0x266)]);}for(const _0x42069f of _0x214be7){_0x41e09d[_0xc0009(0x203)](_0x42069f['attributes'][_0xc0009(0x266)],_0x42069f['id']),_0x37a103['set'](_0x42069f['id'],_0x42069f[_0xc0009(0x1eb)][_0xc0009(0x266)]);}for(const _0x5ca180 of _0x46c06b){_0x53647e['set'](_0x5ca180[_0xc0009(0x1eb)][_0xc0009(0x266)],_0x5ca180['id']),_0xbbfb8c[_0xc0009(0x203)](_0x5ca180['id'],_0x5ca180[_0xc0009(0x1eb)]['name']);}for(const _0x3d72c7 of _0x14403a){_0x3ea53e['set'](_0x3d72c7[_0xc0009(0x1eb)][_0xc0009(0x266)],_0x3d72c7['id']),_0x5dbd4c['set'](_0x3d72c7['id'],_0x3d72c7[_0xc0009(0x1eb)][_0xc0009(0x266)]);}const _0x1c3083={'resolveKnowledgeBaseName':async _0x4f4699=>_0xc24aae[_0xc0009(0x1c6)](_0x4f4699),'resolveTextKnowledgeBaseName':async _0x476a90=>_0x1bd36a[_0xc0009(0x1c6)](_0x476a90),'resolveAgentName':async _0x91dd2c=>_0x2f9db5[_0xc0009(0x1c6)](_0x91dd2c),'resolveWebSearchToolName':async _0x275c0f=>_0x4bae66[_0xc0009(0x1c6)](_0x275c0f),'resolveImageGeneratorName':async _0x4d557e=>_0x5f5089[_0xc0009(0x1c6)](_0x4d557e),'resolvePromptName':async _0x15d052=>_0x37a103[_0xc0009(0x1c6)](_0x15d052),'resolveExperimentalKnowledgeBaseName':async _0x5b21e8=>_0xbbfb8c[_0xc0009(0x1c6)](_0x5b21e8),'onWarning':_0x48181f=>this[_0xc0009(0x282)][_0xc0009(0x290)](_0x48181f)};let _0x592b51=[];const _0x16adff={'projectId':_0xffbd1,'resolveKnowledgeBaseId':async _0x3f19ee=>_0x1d9915[_0xc0009(0x1c6)](_0x3f19ee),'resolveTextKnowledgeBaseId':async _0x4d01b0=>_0x4b6692['get'](_0x4d01b0),'resolveAgentId':async _0x507a4b=>_0x379c7a[_0xc0009(0x1c6)](_0x507a4b),'resolveWebSearchToolId':async _0x2cc462=>_0x50ee83[_0xc0009(0x1c6)](_0x2cc462),'resolveImageGeneratorId':async _0x34fbf=>_0x53574c[_0xc0009(0x1c6)](_0x34fbf),'resolvePromptId':async _0x4850ce=>_0x41e09d[_0xc0009(0x1c6)](_0x4850ce),'resolveParentSegmentKBId':async()=>_0x580340?.['id'],'resolveExperimentalKnowledgeBaseId':async _0x5cde93=>_0x53647e[_0xc0009(0x1c6)](_0x5cde93),'onWarning':_0x435b1e=>{const _0x32dd4e=_0xc0009;this[_0x32dd4e(0x282)][_0x32dd4e(0x290)](_0x435b1e),_0x592b51[_0x32dd4e(0x211)](_0x435b1e);}},{resolved:_0x45d816,unresolved:_0x54a964}=resolveAgentDependencies(_0x259a00,new Set(_0x33329e['keys']()));for(const {agent:_0x2eb59a,missingDeps:_0x3f18f7}of _0x54a964){_0x5ef5c2[_0xc0009(0x1e3)][_0xc0009(0x211)]({'agentName':_0x2eb59a[_0xc0009(0x271)][_0xc0009(0x266)],'action':_0xc0009(0x21b),'error':'Unresolved\x20dependencies:\x20'+_0x3f18f7[_0xc0009(0x237)](',\x20')+_0xc0009(0x258)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1e3)][_0xc0009(0x17e)]++;}for(const _0x53a316 of _0x28ec15){const _0x2cb8e2=_0xc95e25[_0xc0009(0x1c6)](_0x53a316[_0xc0009(0x271)][_0xc0009(0x266)]),_0x644783=a96_0x1974b2[_0xc0009(0x1af)](_0x53a316[_0xc0009(0x246)],'utf-8');if(_0x2cb8e2){const _0x6079a3=apiKnowledgeBaseToYaml(_0x2cb8e2),_0x293e58=toKnowledgeBaseYamlString(_0x6079a3),_0x1ae114=generateDiff(_0x293e58,_0x644783),_0x1c920c=hasChanges(_0x1ae114);_0x1c920c?(_0x5ef5c2[_0xc0009(0x283)][_0xc0009(0x211)]({'name':_0x53a316[_0xc0009(0x271)][_0xc0009(0x266)],'action':_0xc0009(0x1a4),'id':_0x2cb8e2['id'],'diff':formatDiffWithColors(_0x1ae114)}),_0x5ef5c2['counts']['knowledgeBases'][_0xc0009(0x1a4)]++):(_0x5ef5c2[_0xc0009(0x283)][_0xc0009(0x211)]({'name':_0x53a316[_0xc0009(0x271)]['name'],'action':_0xc0009(0x238),'id':_0x2cb8e2['id']}),_0x5ef5c2['counts'][_0xc0009(0x283)][_0xc0009(0x238)]++);}else _0x5ef5c2[_0xc0009(0x283)][_0xc0009(0x211)]({'name':_0x53a316['yaml'][_0xc0009(0x266)],'action':'created'}),_0x5ef5c2['counts']['knowledgeBases']['created']++;}for(const _0x4dc0c7 of _0x29aa56){const _0x5b0698=_0x8ce0b9[_0xc0009(0x1c6)](_0x4dc0c7[_0xc0009(0x266)]),_0x3fd7f7=a96_0x1974b2[_0xc0009(0x1af)](_0x4dc0c7[_0xc0009(0x246)],'utf-8');if(_0x5b0698){const _0x8eb055=toTextKnowledgeBaseMd(_0x5b0698['attributes']['name'],_0x5b0698[_0xc0009(0x1eb)]['text']),_0x50e3f8=generateDiff(_0x8eb055,_0x3fd7f7),_0xcd3fc6=hasChanges(_0x50e3f8);_0xcd3fc6?(_0x5ef5c2['textKnowledgeBases'][_0xc0009(0x211)]({'name':_0x4dc0c7['name'],'action':'updated','id':_0x5b0698['id'],'diff':formatDiffWithColors(_0x50e3f8)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x212)][_0xc0009(0x1a4)]++):(_0x5ef5c2[_0xc0009(0x212)][_0xc0009(0x211)]({'name':_0x4dc0c7[_0xc0009(0x266)],'action':_0xc0009(0x238),'id':_0x5b0698['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x212)][_0xc0009(0x238)]++);}else _0x5ef5c2[_0xc0009(0x212)][_0xc0009(0x211)]({'name':_0x4dc0c7[_0xc0009(0x266)],'action':_0xc0009(0x17f)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x212)][_0xc0009(0x17f)]++;}for(const _0x326919 of _0x45d816){const _0x55e315=_0x33329e['get'](_0x326919[_0xc0009(0x271)]['name']),_0x7ede19=a96_0xa96e78[_0xc0009(0x237)](_0x326919[_0xc0009(0x284)],_0xc0009(0x264)),_0x9269d3=a96_0x1974b2[_0xc0009(0x1af)](_0x7ede19,_0xc0009(0x26f)),_0x2929ce=_0x326919[_0xc0009(0x21c)],_0x398c6d=_0xc0009(0x254)+_0x2929ce+_0xc0009(0x190)+_0x9269d3;if(_0x55e315){const {yaml:_0x5c0cf0,systemPrompt:_0x4715e2}=await agentResponseToDef(_0x55e315,_0x1c3083),_0x4f082f=toAgentYamlString(_0x5c0cf0),_0x383c13=_0xc0009(0x254)+_0x4715e2+_0xc0009(0x190)+_0x4f082f,_0x65ea1b=generateDiff(_0x383c13,_0x398c6d),_0x2d7d2c=hasChanges(_0x65ea1b);_0x2d7d2c?(_0x5ef5c2[_0xc0009(0x1e3)]['push']({'agentName':_0x326919[_0xc0009(0x271)][_0xc0009(0x266)],'action':_0xc0009(0x1a4),'agentId':_0x55e315['id'],'diff':formatDiffWithColors(_0x65ea1b)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1e3)]['updated']++):(_0x5ef5c2[_0xc0009(0x1e3)][_0xc0009(0x211)]({'agentName':_0x326919[_0xc0009(0x271)][_0xc0009(0x266)],'action':_0xc0009(0x238),'agentId':_0x55e315['id']}),_0x5ef5c2['counts'][_0xc0009(0x1e3)]['unchanged']++);}else _0x5ef5c2['agents'][_0xc0009(0x211)]({'agentName':_0x326919[_0xc0009(0x271)][_0xc0009(0x266)],'action':_0xc0009(0x17f)}),_0x5ef5c2[_0xc0009(0x234)]['agents'][_0xc0009(0x17f)]++;}for(const _0xd387e4 of _0x28a987){const _0x1eaaa6=_0x4ead06['get'](_0xd387e4['yaml'][_0xc0009(0x266)]),_0x346854=a96_0x1974b2[_0xc0009(0x1af)](_0xd387e4[_0xc0009(0x246)],_0xc0009(0x26f));if(_0x1eaaa6){const _0x556ba0=await apiPromptToYaml(_0x1eaaa6,_0x1c3083);if(!_0x556ba0){_0x5ef5c2[_0xc0009(0x1e9)]['push']({'name':_0xd387e4['yaml']['name'],'action':_0xc0009(0x1a4),'id':_0x1eaaa6['id']}),_0x5ef5c2[_0xc0009(0x234)]['prompts']['updated']++;continue;}const _0x4dd80d=toPromptYamlString(_0x556ba0),_0x2ec1a7=generateDiff(_0x4dd80d,_0x346854),_0x9033ad=hasChanges(_0x2ec1a7);_0x9033ad?(_0x5ef5c2['prompts'][_0xc0009(0x211)]({'name':_0xd387e4['yaml'][_0xc0009(0x266)],'action':'updated','id':_0x1eaaa6['id'],'diff':formatDiffWithColors(_0x2ec1a7)}),_0x5ef5c2['counts'][_0xc0009(0x1e9)][_0xc0009(0x1a4)]++):(_0x5ef5c2[_0xc0009(0x1e9)]['push']({'name':_0xd387e4['yaml'][_0xc0009(0x266)],'action':_0xc0009(0x238),'id':_0x1eaaa6['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1e9)]['unchanged']++);}else _0x5ef5c2[_0xc0009(0x1e9)][_0xc0009(0x211)]({'name':_0xd387e4['yaml'][_0xc0009(0x266)],'action':_0xc0009(0x17f)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1e9)]['created']++;}for(const _0x51eb73 of _0x4d03f8){const _0x4984a8=_0x23c33f[_0xc0009(0x1c6)](_0x51eb73[_0xc0009(0x271)][_0xc0009(0x259)]),_0x9d6e1f=a96_0x1974b2['readFileSync'](_0x51eb73[_0xc0009(0x246)],_0xc0009(0x26f));if(_0x4984a8){const _0x1a119a=await apiIntegrationToYaml(_0x4984a8,_0x1c3083),_0x50d4d9=toIntegrationYamlString(_0x1a119a),_0x24cf1d=generateDiff(_0x50d4d9,_0x9d6e1f),_0x5ee2e7=hasChanges(_0x24cf1d);_0x5ee2e7?(_0x5ef5c2[_0xc0009(0x26a)][_0xc0009(0x211)]({'name':_0x51eb73[_0xc0009(0x271)][_0xc0009(0x259)],'action':_0xc0009(0x1a4),'id':_0x4984a8['id'],'diff':formatDiffWithColors(_0x24cf1d)}),_0x5ef5c2['counts'][_0xc0009(0x26a)][_0xc0009(0x1a4)]++):(_0x5ef5c2[_0xc0009(0x26a)]['push']({'name':_0x51eb73['yaml'][_0xc0009(0x259)],'action':_0xc0009(0x238),'id':_0x4984a8['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x26a)][_0xc0009(0x238)]++);}else _0x5ef5c2[_0xc0009(0x26a)][_0xc0009(0x211)]({'name':_0x51eb73['yaml'][_0xc0009(0x259)],'action':_0xc0009(0x17f)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x26a)][_0xc0009(0x17f)]++;}for(const _0x3a9ce0 of _0x3cc637){const _0x52e068=_0x5a17cc[_0xc0009(0x1c6)](_0x3a9ce0['def']['name']),_0x122166=toExperimentalKnowledgeBaseYamlString(_0x3a9ce0[_0xc0009(0x1ea)]);let _0x3b9195=_0x122166;for(const _0x5ae237 of _0x3a9ce0['def']['functions']){_0x3b9195+=_0xc0009(0x1c8)+_0x5ae237['name']+_0xc0009(0x1ae)+_0x5ae237[_0xc0009(0x235)]+'\x0a---\x20schema:\x20'+_0x5ae237['name']+_0xc0009(0x1ae)+_0x5ae237[_0xc0009(0x1f2)]+'\x0a';}if(_0x52e068){const _0x26a974=apiExperimentalKnowledgeBaseToYaml(_0x52e068),_0x44e45a=toExperimentalKnowledgeBaseYamlString(_0x26a974);let _0x202ae0=_0x44e45a;for(const _0x12b810 of _0x26a974[_0xc0009(0x1e7)]){_0x202ae0+='\x0a---\x20function:\x20'+_0x12b810['name']+_0xc0009(0x1ae)+_0x12b810[_0xc0009(0x235)]+_0xc0009(0x18e)+_0x12b810['name']+_0xc0009(0x1ae)+_0x12b810[_0xc0009(0x1f2)]+'\x0a';}const _0x5f093c=generateDiff(_0x202ae0,_0x3b9195),_0x2049b7=hasChanges(_0x5f093c);_0x2049b7?(_0x5ef5c2[_0xc0009(0x19d)][_0xc0009(0x211)]({'name':_0x3a9ce0[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':_0xc0009(0x1a4),'id':_0x52e068['id'],'diff':formatDiffWithColors(_0x5f093c)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x19d)][_0xc0009(0x1a4)]++):(_0x5ef5c2['experimentalKnowledgeBases'][_0xc0009(0x211)]({'name':_0x3a9ce0['def']['name'],'action':_0xc0009(0x238),'id':_0x52e068['id']}),_0x5ef5c2[_0xc0009(0x234)]['experimentalKnowledgeBases'][_0xc0009(0x238)]++);}else _0x5ef5c2[_0xc0009(0x19d)]['push']({'name':_0x3a9ce0[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':_0xc0009(0x17f)}),_0x5ef5c2[_0xc0009(0x234)]['experimentalKnowledgeBases'][_0xc0009(0x17f)]++;}for(const _0x2fdb05 of _0x59ca95){const _0x52f4ec=_0x5a3acc[_0xc0009(0x1c6)](_0x2fdb05[_0xc0009(0x1ea)][_0xc0009(0x266)]),_0x287c17=toExperimentalArtifactYamlString(_0x2fdb05[_0xc0009(0x1ea)]);let _0x523bb6=_0x287c17+(_0xc0009(0x1a6)+_0x2fdb05['def'][_0xc0009(0x235)]+'\x0a');for(const _0x5dfad6 of _0x2fdb05[_0xc0009(0x1ea)][_0xc0009(0x194)]){_0x523bb6+=_0xc0009(0x186)+_0x5dfad6['file_name']+'\x20---\x0a'+_0x5dfad6['text_content']+'\x0a';}if(_0x52f4ec){const _0x326c90=apiExperimentalArtifactToYaml(_0x52f4ec),_0x583434=toExperimentalArtifactYamlString(_0x326c90);let _0x5b2634=_0x583434+(_0xc0009(0x1a6)+_0x326c90['code']+'\x0a');for(const _0x59ba0a of _0x326c90[_0xc0009(0x194)]){_0x5b2634+=_0xc0009(0x186)+_0x59ba0a[_0xc0009(0x1be)]+'\x20---\x0a'+_0x59ba0a[_0xc0009(0x1e4)]+'\x0a';}const _0x2c7b05=generateDiff(_0x5b2634,_0x523bb6),_0x47ff60=hasChanges(_0x2c7b05);_0x47ff60?(_0x5ef5c2[_0xc0009(0x1d6)][_0xc0009(0x211)]({'name':_0x2fdb05[_0xc0009(0x1ea)]['name'],'action':_0xc0009(0x1a4),'id':_0x52f4ec['id'],'diff':formatDiffWithColors(_0x2c7b05)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1d6)][_0xc0009(0x1a4)]++):(_0x5ef5c2[_0xc0009(0x1d6)][_0xc0009(0x211)]({'name':_0x2fdb05[_0xc0009(0x1ea)]['name'],'action':_0xc0009(0x238),'id':_0x52f4ec['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1d6)][_0xc0009(0x238)]++);}else _0x5ef5c2[_0xc0009(0x1d6)][_0xc0009(0x211)]({'name':_0x2fdb05[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':_0xc0009(0x17f)}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1d6)][_0xc0009(0x17f)]++;}if(_0x2f9739?.['dryRun'])return _0x5ef5c2;_0x5ef5c2[_0xc0009(0x283)]=[],_0x5ef5c2[_0xc0009(0x212)]=[],_0x5ef5c2[_0xc0009(0x1e9)]=[],_0x5ef5c2[_0xc0009(0x26a)]=[],_0x5ef5c2[_0xc0009(0x19d)]=[],_0x5ef5c2[_0xc0009(0x1d6)]=[];const _0x105987=_0x5ef5c2[_0xc0009(0x1e3)][_0xc0009(0x20e)](_0x461f26=>_0x461f26[_0xc0009(0x27c)]===_0xc0009(0x21b));_0x5ef5c2[_0xc0009(0x1e3)]=_0x105987,_0x5ef5c2[_0xc0009(0x234)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x105987[_0xc0009(0x219)]},'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 _0x218514 of _0x28ec15){try{const _0x36dcc1=_0xc95e25['get'](_0x218514['yaml']['name']),_0x238ca6=yamlKnowledgeBaseToApi(_0x218514[_0xc0009(0x271)],_0xffbd1);if(_0x36dcc1)await this[_0xc0009(0x26e)]['updateKnowledgeBase'](_0x36dcc1['id'],_0x238ca6),_0x1d9915[_0xc0009(0x203)](_0x218514['yaml'][_0xc0009(0x266)],_0x36dcc1['id']),_0x5ef5c2[_0xc0009(0x283)][_0xc0009(0x211)]({'name':_0x218514[_0xc0009(0x271)][_0xc0009(0x266)],'action':'updated','id':_0x36dcc1['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x283)]['updated']++;else{const _0x1e1054=await this[_0xc0009(0x26e)][_0xc0009(0x1fd)](_0x238ca6);_0x1d9915[_0xc0009(0x203)](_0x218514[_0xc0009(0x271)][_0xc0009(0x266)],_0x1e1054['id']),_0x5ef5c2[_0xc0009(0x283)][_0xc0009(0x211)]({'name':_0x218514[_0xc0009(0x271)][_0xc0009(0x266)],'action':'created','id':_0x1e1054['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x283)][_0xc0009(0x17f)]++;}}catch(_0x47fe7c){_0x5ef5c2['knowledgeBases'][_0xc0009(0x211)]({'name':_0x218514['yaml'][_0xc0009(0x266)],'action':_0xc0009(0x21b),'error':_0x47fe7c[_0xc0009(0x1ad)]}),_0x5ef5c2['counts'][_0xc0009(0x283)][_0xc0009(0x17e)]++;}}for(const _0x4f34d8 of _0x29aa56){try{const _0x25005b=_0x8ce0b9['get'](_0x4f34d8['name']),_0x14fea6=yamlTextKnowledgeBaseToApi({'name':_0x4f34d8[_0xc0009(0x266)],'text':_0x4f34d8[_0xc0009(0x206)]},_0xffbd1);if(_0x25005b)await this[_0xc0009(0x26e)][_0xc0009(0x1a9)](_0x25005b['id'],_0x14fea6),_0x4b6692[_0xc0009(0x203)](_0x4f34d8[_0xc0009(0x266)],_0x25005b['id']),_0x5ef5c2[_0xc0009(0x212)][_0xc0009(0x211)]({'name':_0x4f34d8['name'],'action':_0xc0009(0x1a4),'id':_0x25005b['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x212)][_0xc0009(0x1a4)]++;else{const _0x4cddae=await this[_0xc0009(0x26e)][_0xc0009(0x274)](_0x14fea6);_0x4b6692[_0xc0009(0x203)](_0x4f34d8[_0xc0009(0x266)],_0x4cddae['id']),_0x5ef5c2[_0xc0009(0x212)][_0xc0009(0x211)]({'name':_0x4f34d8[_0xc0009(0x266)],'action':_0xc0009(0x17f),'id':_0x4cddae['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x212)]['created']++;}}catch(_0x231657){_0x5ef5c2['textKnowledgeBases']['push']({'name':_0x4f34d8[_0xc0009(0x266)],'action':_0xc0009(0x21b),'error':_0x231657[_0xc0009(0x1ad)]}),_0x5ef5c2['counts'][_0xc0009(0x212)][_0xc0009(0x17e)]++;}}for(const _0x2e362e of _0x3cc637){try{const _0x46d1b7=_0x5a17cc[_0xc0009(0x1c6)](_0x2e362e['def'][_0xc0009(0x266)]),_0x242ebd=yamlExperimentalKnowledgeBaseToApi(_0x2e362e[_0xc0009(0x1ea)],_0xffbd1);if(_0x46d1b7)await this[_0xc0009(0x26e)]['updateExperimentalKnowledgeBase'](_0x46d1b7['id'],_0x242ebd),_0x53647e[_0xc0009(0x203)](_0x2e362e[_0xc0009(0x1ea)][_0xc0009(0x266)],_0x46d1b7['id']),_0x5ef5c2['experimentalKnowledgeBases']['push']({'name':_0x2e362e[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':_0xc0009(0x1a4),'id':_0x46d1b7['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x19d)][_0xc0009(0x1a4)]++;else{const _0x4901a3=await this[_0xc0009(0x26e)][_0xc0009(0x19f)](_0x242ebd);_0x53647e[_0xc0009(0x203)](_0x2e362e[_0xc0009(0x1ea)][_0xc0009(0x266)],_0x4901a3['id']),_0x5ef5c2['experimentalKnowledgeBases'][_0xc0009(0x211)]({'name':_0x2e362e[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':'created','id':_0x4901a3['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x19d)][_0xc0009(0x17f)]++;}}catch(_0x5d99b3){_0x5ef5c2[_0xc0009(0x19d)][_0xc0009(0x211)]({'name':_0x2e362e[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':'error','error':_0x5d99b3[_0xc0009(0x1ad)]}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x19d)][_0xc0009(0x17e)]++;}}for(const _0xf1cebc of _0x59ca95){try{const _0x1af5f7=_0x5a3acc[_0xc0009(0x1c6)](_0xf1cebc['def'][_0xc0009(0x266)]),_0x586ff7=yamlExperimentalArtifactToApi(_0xf1cebc['def'],_0xffbd1);if(_0x1af5f7)await this[_0xc0009(0x26e)][_0xc0009(0x222)](_0x1af5f7['id'],_0x586ff7),_0x3ea53e['set'](_0xf1cebc['def']['name'],_0x1af5f7['id']),_0x5ef5c2['experimentalArtifacts'][_0xc0009(0x211)]({'name':_0xf1cebc[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':'updated','id':_0x1af5f7['id']}),_0x5ef5c2['counts'][_0xc0009(0x1d6)][_0xc0009(0x1a4)]++;else{const _0x1e3c3b=await this[_0xc0009(0x26e)][_0xc0009(0x214)](_0x586ff7);_0x3ea53e[_0xc0009(0x203)](_0xf1cebc['def']['name'],_0x1e3c3b['id']),_0x5ef5c2[_0xc0009(0x1d6)][_0xc0009(0x211)]({'name':_0xf1cebc[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':_0xc0009(0x17f),'id':_0x1e3c3b['id']}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1d6)][_0xc0009(0x17f)]++;}}catch(_0x3a559b){_0x5ef5c2['experimentalArtifacts'][_0xc0009(0x211)]({'name':_0xf1cebc[_0xc0009(0x1ea)][_0xc0009(0x266)],'action':_0xc0009(0x21b),'error':_0x3a559b[_0xc0009(0x1ad)]}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1d6)]['errors']++;}}for(const _0x5dc002 of _0x45d816){_0x592b51=[];try{const _0x72deee=_0x33329e[_0xc0009(0x1c6)](_0x5dc002[_0xc0009(0x271)][_0xc0009(0x266)]),_0x35d516=await agentDefToRequest(_0x5dc002[_0xc0009(0x271)],_0x5dc002[_0xc0009(0x21c)],_0x5dc002[_0xc0009(0x217)],_0x16adff);if(_0x72deee)await this['client']['updateAgentResponse'](_0x72deee['id'],_0x35d516),_0x379c7a['set'](_0x5dc002['yaml'][_0xc0009(0x266)],_0x72deee['id']),_0x5ef5c2[_0xc0009(0x1e3)][_0xc0009(0x211)]({'agentName':_0x5dc002[_0xc0009(0x271)][_0xc0009(0x266)],'action':_0xc0009(0x1a4),'agentId':_0x72deee['id'],'warnings':_0x592b51[_0xc0009(0x219)]>0x0?_0x592b51:undefined}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1e3)][_0xc0009(0x1a4)]++;else{const _0x36b48c=await this['client'][_0xc0009(0x23c)](_0x35d516);_0x379c7a[_0xc0009(0x203)](_0x5dc002['yaml'][_0xc0009(0x266)],_0x36b48c['id']),_0x5ef5c2[_0xc0009(0x1e3)][_0xc0009(0x211)]({'agentName':_0x5dc002['yaml']['name'],'action':_0xc0009(0x17f),'agentId':_0x36b48c['id'],'warnings':_0x592b51['length']>0x0?_0x592b51:undefined}),_0x5ef5c2['counts'][_0xc0009(0x1e3)]['created']++;}}catch(_0x40467b){_0x5ef5c2[_0xc0009(0x1e3)][_0xc0009(0x211)]({'agentName':_0x5dc002[_0xc0009(0x271)]['name'],'action':'error','error':_0x40467b['message'],'warnings':_0x592b51['length']>0x0?_0x592b51:undefined}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1e3)][_0xc0009(0x17e)]++;}}for(const _0x1dc016 of _0x28a987){try{const _0x4b5403=_0x4ead06[_0xc0009(0x1c6)](_0x1dc016[_0xc0009(0x271)][_0xc0009(0x266)]),_0x563434=await yamlPromptToApi(_0x1dc016[_0xc0009(0x271)],_0xffbd1,_0x16adff);if(!_0x563434){_0x5ef5c2[_0xc0009(0x1e9)][_0xc0009(0x211)]({'name':_0x1dc016[_0xc0009(0x271)][_0xc0009(0x266)],'action':_0xc0009(0x21b),'error':'Agent\x20reference\x20not\x20found'}),_0x5ef5c2[_0xc0009(0x234)][_0xc0009(0x1e9)][_0xc0009(0x17e)]++;continue;}if(_0x4b5403)await this[_0xc0009(0x26e)][_0xc0009(0x252)](_0x4b5403['id'],_0x563434),_0x41e09d['set'](_0x1dc016[_0xc0009(0x271)][_0xc0009(0x266)],_0x4b5403['id']),_0x5ef5c2[_0xc0009(0x1e9)][_0xc0009(0x211)]({'name':_0x1dc016['yaml'][_0xc0009(0x266)],'action':_0xc0009(0x1a4),'id':_0x4b5403['id']}),_0x5ef5c2[_0xc0009(0x234)]['prompts']['updated']++;else{const _0x5cec1b=await this['client'][_0xc0009(0x207)](_0x563434);_0x41e09d[_0xc0009(0x203)](_0x1dc016[_0xc0009(0x271)][_0xc0009(0x266)],_0x5cec1b['id']),_0x5ef5c2[_0xc0009(0x1e9)][_0xc0009(0x211)]({'name':_0x1dc016[_0xc0009(0x271)][_0xc0009(0x266)],'action':_0xc0009(0x17f),'id':_0x5cec1b['id']}),_0x5ef5c2['counts']['prompts'][_0xc0009(0x17f)]++;}}catch(_0x17f8ac){_0x5ef5c2['prompts'][_0xc0009(0x211)]({'name':_0x1dc016['yaml'][_0xc0009(0x266)],'action':_0xc0009(0x21b),'error':_0x17f8ac[_0xc0009(0x1ad)]}),_0x5ef5c2[_0xc0009(0x234)]['prompts'][_0xc0009(0x17e)]++;}}for(const _0x39fc4c of _0x4d03f8){try{const _0x24b861=_0x23c33f[_0xc0009(0x1c6)](_0x39fc4c[_0xc0009(0x271)][_0xc0009(0x259)]),_0x58a089=await yamlIntegrationToApi(_0x39fc4c['yaml'],_0xffbd1,_0x16adff);if(_0x24b861){await this[_0xc0009(0x26e)]['deleteIntegration'](_0x24b861['id']);const _0x27cc52=await this[_0xc0009(0x26e)]['createIntegration'](_0x58a089);_0x5ef5c2[_0xc0009(0x26a)][_0xc0009(0x211)]({'name':_0x39fc4c['yaml'][_0xc0009(0x259)],'action':_0xc0009(0x1a4),'id':_0x27cc52['id']}),_0x5ef5c2[_0xc0009(0x234)]['integrations'][_0xc0009(0x1a4)]++;}else{const _0x14c3e5=await this['client'][_0xc0009(0x23d)](_0x58a089);_0x5ef5c2['integrations'][_0xc0009(0x211)]({'name':_0x39fc4c[_0xc0009(0x271)][_0xc0009(0x259)],'action':'created','id':_0x14c3e5['id']}),_0x5ef5c2[_0xc0009(0x234)]['integrations']['created']++;}}catch(_0x2f0730){_0x5ef5c2[_0xc0009(0x26a)][_0xc0009(0x211)]({'name':_0x39fc4c[_0xc0009(0x271)]['service_type'],'action':_0xc0009(0x21b),'error':_0x2f0730[_0xc0009(0x1ad)]}),_0x5ef5c2['counts'][_0xc0009(0x26a)][_0xc0009(0x17e)]++;}}return _0x5ef5c2;}async[a96_0x5d9617(0x239)](_0x235526,_0x4a2cb6,_0x5dbb50,_0x3e5269){const _0x3c5bef=a96_0x5d9617,{projectId:_0xbf7384,project:_0x3efaa1}=await this[_0x3c5bef(0x22a)](_0x235526),_0x4c305a=_0x3efaa1['attributes'][_0x3c5bef(0x266)],_0x5d811b=await this[_0x3c5bef(0x26e)][_0x3c5bef(0x250)](_0xbf7384),_0x43591e=_0x5d811b['find'](_0xf4602f=>_0xf4602f['attributes'][_0x3c5bef(0x266)]===_0x4a2cb6);if(!_0x43591e)throw new SDKError(ErrorCode[_0x3c5bef(0x245)],_0x3c5bef(0x1b2)+_0x4a2cb6,undefined,{'helpText':_0x3c5bef(0x25c)+_0x5d811b[_0x3c5bef(0x28b)](_0x23efb0=>_0x23efb0[_0x3c5bef(0x1eb)][_0x3c5bef(0x266)])[_0x3c5bef(0x237)](',\x20')});let _0x5f2400;if(_0x5dbb50)_0x5f2400=_0x5dbb50;else{const _0x265938=a96_0xa96e78[_0x3c5bef(0x237)](process['cwd'](),_0x3c5bef(0x1e3)),_0x2d9a9c=getSanitizedPathWithMigration(_0x265938,_0x4c305a);_0x2d9a9c[_0x3c5bef(0x25e)]&&this['logger'][_0x3c5bef(0x1c1)](_0x3c5bef(0x1ab)+a96_0xa96e78[_0x3c5bef(0x21e)](_0x2d9a9c[_0x3c5bef(0x18c)])+_0x3c5bef(0x224)+a96_0xa96e78['basename'](_0x2d9a9c[_0x3c5bef(0x246)])),_0x5f2400=_0x2d9a9c[_0x3c5bef(0x246)];}const _0x5c4bf2=getSanitizedPathWithMigration(_0x5f2400,_0x4a2cb6);_0x5c4bf2[_0x3c5bef(0x25e)]&&this[_0x3c5bef(0x282)]['info'](_0x3c5bef(0x1bd)+a96_0xa96e78[_0x3c5bef(0x21e)](_0x5c4bf2[_0x3c5bef(0x18c)])+_0x3c5bef(0x224)+a96_0xa96e78[_0x3c5bef(0x21e)](_0x5c4bf2['path']));const _0x3a426e=_0x5c4bf2[_0x3c5bef(0x246)],_0x2a7e99=new Map(),_0x58ce2a=new Map(),_0x3cb453=await this[_0x3c5bef(0x26e)]['listKnowledgeBases'](_0xbf7384),_0x3be644=await this[_0x3c5bef(0x26e)][_0x3c5bef(0x196)](_0xbf7384),_0x373814=await this[_0x3c5bef(0x26e)]['listExperimentalKnowledgeBases'](_0xbf7384),_0x4f1e09=new Map(),_0x52ab13=new Map();for(const _0x3ab23a of _0x3cb453){_0x2a7e99['set'](_0x3ab23a['id'],_0x3ab23a[_0x3c5bef(0x1eb)]['name']);}for(const _0x4b4740 of _0x3be644){_0x4f1e09[_0x3c5bef(0x203)](_0x4b4740['id'],_0x4b4740[_0x3c5bef(0x1eb)][_0x3c5bef(0x266)]);}for(const _0x1a4396 of _0x373814){_0x52ab13[_0x3c5bef(0x203)](_0x1a4396['id'],_0x1a4396[_0x3c5bef(0x1eb)][_0x3c5bef(0x266)]);}for(const _0x1f666b of _0x5d811b){_0x58ce2a[_0x3c5bef(0x203)](_0x1f666b['id'],_0x1f666b['attributes']['name']);}const _0x2de5e2={'resolveKnowledgeBaseName':async _0x2860b4=>_0x2a7e99[_0x3c5bef(0x1c6)](_0x2860b4),'resolveTextKnowledgeBaseName':async _0x17f42c=>_0x4f1e09[_0x3c5bef(0x1c6)](_0x17f42c),'resolveAgentName':async _0x24b134=>_0x58ce2a[_0x3c5bef(0x1c6)](_0x24b134),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async()=>undefined,'resolveExperimentalKnowledgeBaseName':async _0x1143a9=>_0x52ab13[_0x3c5bef(0x1c6)](_0x1143a9),'onWarning':_0x3c388a=>this[_0x3c5bef(0x282)][_0x3c5bef(0x290)](_0x3c388a)},_0x1622d4=a96_0xa96e78[_0x3c5bef(0x237)](_0x3a426e,_0x3c5bef(0x262)),_0x110917=a96_0xa96e78[_0x3c5bef(0x237)](_0x3a426e,_0x3c5bef(0x264)),_0xb84192=a96_0xa96e78[_0x3c5bef(0x237)](_0x3a426e,_0x3c5bef(0x261)),_0x41474b=!a96_0x1974b2['existsSync'](_0x110917);if(_0x3e5269?.[_0x3c5bef(0x184)])return{'agentName':_0x4a2cb6,'outputPath':_0x3a426e,'isNew':_0x41474b,'hasChanges':!![]};a96_0x1974b2['mkdirSync'](_0x5f2400,{'recursive':!![]}),a96_0x1974b2[_0x3c5bef(0x19e)](_0x3a426e,{'recursive':!![]});const _0x7b2ab6=a96_0xa96e78[_0x3c5bef(0x237)](_0x5f2400,_0x3c5bef(0x23e));!a96_0x1974b2['existsSync'](_0x7b2ab6)&&a96_0x1974b2[_0x3c5bef(0x1f4)](_0x7b2ab6,createAgentConfigContent(_0x235526));const {yaml:_0x39a61d,systemPrompt:_0x2a8cf5,starterMessage:_0x43fdec}=await agentResponseToDef(_0x43591e,_0x2de5e2);let _0x2788eb=_0x41474b;if(!_0x41474b){const _0x356ee2=a96_0x1974b2[_0x3c5bef(0x1b5)](_0x1622d4)?a96_0x1974b2[_0x3c5bef(0x1af)](_0x1622d4,'utf-8'):'',_0x5220f8=a96_0x1974b2[_0x3c5bef(0x1af)](_0x110917,_0x3c5bef(0x26f));_0x2788eb=_0x356ee2!==_0x2a8cf5||_0x5220f8!==toAgentYamlString(_0x39a61d);}a96_0x1974b2['writeFileSync'](_0x1622d4,_0x2a8cf5),a96_0x1974b2[_0x3c5bef(0x1f4)](_0x110917,toAgentYamlString(_0x39a61d));if(_0x43fdec&&_0x43fdec[_0x3c5bef(0x1ec)]('\x0a'))a96_0x1974b2['writeFileSync'](_0xb84192,_0x43fdec);else a96_0x1974b2['existsSync'](_0xb84192)&&a96_0x1974b2['unlinkSync'](_0xb84192);return{'agentName':_0x4a2cb6,'outputPath':_0x3a426e,'isNew':_0x41474b,'hasChanges':_0x2788eb};}async['pushAgent'](_0x4b5390,_0x355fcf){const _0xc7b8af=a96_0x5d9617;let _0x3da30f;isAgentYamlPath(_0x4b5390)?_0x3da30f=getAgentDirFromYamlPath(_0x4b5390):_0x3da30f=_0x4b5390;const {config:_0x6aced3}=findAgentConfig(_0x3da30f),_0x46fc3d=await this[_0xc7b8af(0x260)](_0x6aced3[_0xc7b8af(0x198)]),_0x22ebf5=a96_0xa96e78[_0xc7b8af(0x237)](_0x3da30f,_0xc7b8af(0x264)),_0x211738=a96_0xa96e78[_0xc7b8af(0x237)](_0x3da30f,_0xc7b8af(0x262)),_0x45ed88=a96_0xa96e78[_0xc7b8af(0x237)](_0x3da30f,_0xc7b8af(0x261));if(!a96_0x1974b2['existsSync'](_0x22ebf5))throw new SDKError(ErrorCode[_0xc7b8af(0x1f0)],_0xc7b8af(0x1bc)+_0x3da30f,undefined,{'helpText':'Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.'});const _0x259683=parseAgentYaml(a96_0x1974b2['readFileSync'](_0x22ebf5,_0xc7b8af(0x26f)),_0x22ebf5),_0x2ccea1=a96_0x1974b2[_0xc7b8af(0x1b5)](_0x211738)?a96_0x1974b2['readFileSync'](_0x211738,_0xc7b8af(0x26f)):'',_0x271fbc=a96_0x1974b2['existsSync'](_0x45ed88)?a96_0x1974b2[_0xc7b8af(0x1af)](_0x45ed88,_0xc7b8af(0x26f)):_0x259683['starter_message'];if(_0x355fcf?.[_0xc7b8af(0x184)])return{'agentName':_0x259683['name'],'action':'created','projectId':_0x46fc3d};const _0x275ed7=await this[_0xc7b8af(0x26e)]['listAgentsFull'](_0x46fc3d),_0x5450b7=await this[_0xc7b8af(0x26e)]['listKnowledgeBases'](_0x46fc3d),_0x56e485=await this['client'][_0xc7b8af(0x196)](_0x46fc3d),_0x2e467e=await this['client'][_0xc7b8af(0x275)](_0x46fc3d),_0xe7362a=await this[_0xc7b8af(0x26e)]['getParentSegmentKnowledgeBase'](_0x46fc3d),_0x39f888=new Map(),_0x21a43d=new Map(),_0xd66a7b=new Map(),_0xba9014=new Map();for(const _0x46e15e of _0x5450b7){_0x39f888[_0xc7b8af(0x203)](_0x46e15e['attributes']['name'],_0x46e15e['id']);}for(const _0x310526 of _0x56e485){_0x21a43d[_0xc7b8af(0x203)](_0x310526[_0xc7b8af(0x1eb)][_0xc7b8af(0x266)],_0x310526['id']);}for(const _0x2ffeb0 of _0x2e467e){_0xd66a7b[_0xc7b8af(0x203)](_0x2ffeb0[_0xc7b8af(0x1eb)][_0xc7b8af(0x266)],_0x2ffeb0['id']);}for(const _0x3801e0 of _0x275ed7){_0xba9014[_0xc7b8af(0x203)](_0x3801e0[_0xc7b8af(0x1eb)][_0xc7b8af(0x266)],_0x3801e0['id']);}const _0x4fafd7=[],_0x2e1c59={'projectId':_0x46fc3d,'resolveKnowledgeBaseId':async _0x28601a=>_0x39f888[_0xc7b8af(0x1c6)](_0x28601a),'resolveTextKnowledgeBaseId':async _0x31952b=>_0x21a43d[_0xc7b8af(0x1c6)](_0x31952b),'resolveAgentId':async _0xadf2f1=>_0xba9014[_0xc7b8af(0x1c6)](_0xadf2f1),'resolveWebSearchToolId':async()=>undefined,'resolveImageGeneratorId':async()=>undefined,'resolvePromptId':async()=>undefined,'resolveParentSegmentKBId':async()=>_0xe7362a?.['id'],'resolveExperimentalKnowledgeBaseId':async _0x36ce37=>_0xd66a7b['get'](_0x36ce37),'onWarning':_0x38c613=>{const _0x19ef0b=_0xc7b8af;this[_0x19ef0b(0x282)][_0x19ef0b(0x290)](_0x38c613),_0x4fafd7['push'](_0x38c613);}};try{const _0x402b97=_0x275ed7['find'](_0x3b5580=>_0x3b5580[_0xc7b8af(0x1eb)]['name']===_0x259683['name']),_0x27c03e=await agentDefToRequest(_0x259683,_0x2ccea1,_0x271fbc,_0x2e1c59);if(_0x402b97)return await this[_0xc7b8af(0x26e)][_0xc7b8af(0x181)](_0x402b97['id'],_0x27c03e),{'agentName':_0x259683[_0xc7b8af(0x266)],'action':_0xc7b8af(0x1a4),'projectId':_0x46fc3d,'agentId':_0x402b97['id'],'warnings':_0x4fafd7[_0xc7b8af(0x219)]>0x0?_0x4fafd7:undefined};else{const _0x3522e4=await this[_0xc7b8af(0x26e)]['createAgentResponse'](_0x27c03e);return{'agentName':_0x259683[_0xc7b8af(0x266)],'action':_0xc7b8af(0x17f),'projectId':_0x46fc3d,'agentId':_0x3522e4['id'],'warnings':_0x4fafd7[_0xc7b8af(0x219)]>0x0?_0x4fafd7:undefined};}}catch(_0x11a5d0){return{'agentName':_0x259683[_0xc7b8af(0x266)],'action':'error','projectId':_0x46fc3d,'error':_0x11a5d0[_0xc7b8af(0x1ad)],'warnings':_0x4fafd7[_0xc7b8af(0x219)]>0x0?_0x4fafd7:undefined};}}async[a96_0x5d9617(0x1aa)](_0x4085d3,_0x3dbd55,_0x3b3e06){const _0x343f7f=a96_0x5d9617,_0x10e06f=a96_0x1974b2[_0x343f7f(0x1b5)](_0x4085d3)&&a96_0x1974b2[_0x343f7f(0x1b5)](a96_0xa96e78[_0x343f7f(0x237)](_0x4085d3,_0x343f7f(0x23e)));let _0x2f9f56;const _0x7650f7=[],_0x1e84fd=[],_0x28cd5a=[],_0x29fcc6=[],_0x1dabf9=[],_0x35e971=[],_0x390954=[];if(_0x10e06f){const _0x2bbf4e=loadAgentConfig(a96_0xa96e78['join'](_0x4085d3,_0x343f7f(0x23e)));_0x2f9f56=_0x2bbf4e[_0x343f7f(0x198)];const _0x46619c=a96_0x1974b2['readdirSync'](_0x4085d3,{'withFileTypes':!![]});for(const _0x2b396f of _0x46619c){if(!_0x2b396f[_0x343f7f(0x22f)]())continue;if([_0x343f7f(0x183),_0x343f7f(0x232),'experimental_artifacts',_0x343f7f(0x1e9),_0x343f7f(0x26a)][_0x343f7f(0x1ec)](_0x2b396f['name']))continue;const _0x352d68=a96_0xa96e78['join'](_0x4085d3,_0x2b396f[_0x343f7f(0x266)]);if(isAgentDir(_0x352d68)){const _0x16c5c9=a96_0xa96e78[_0x343f7f(0x237)](_0x352d68,_0x343f7f(0x264)),_0xd85968=a96_0xa96e78[_0x343f7f(0x237)](_0x352d68,_0x343f7f(0x262)),_0x16e3a1=a96_0xa96e78[_0x343f7f(0x237)](_0x352d68,'starter_message.md'),_0x23dbe2=parseAgentYaml(a96_0x1974b2[_0x343f7f(0x1af)](_0x16c5c9,_0x343f7f(0x26f)),_0x16c5c9),_0x15169f=a96_0x1974b2[_0x343f7f(0x1b5)](_0xd85968)?a96_0x1974b2[_0x343f7f(0x1af)](_0xd85968,_0x343f7f(0x26f)):'',_0x1a934e=a96_0x1974b2['existsSync'](_0x16e3a1)?a96_0x1974b2[_0x343f7f(0x1af)](_0x16e3a1,'utf-8'):_0x23dbe2['starter_message'];_0x7650f7[_0x343f7f(0x211)]({'name':_0x23dbe2[_0x343f7f(0x266)],'dir':_0x352d68,'yaml':_0x23dbe2,'systemPrompt':_0x15169f,'starterMessage':_0x1a934e});}}const _0x19ae5d=getKnowledgeBasesDir(_0x4085d3);if(a96_0x1974b2['existsSync'](_0x19ae5d)){const _0x3a183c=a96_0x1974b2['readdirSync'](_0x19ae5d);for(const _0x54f1d5 of _0x3a183c){const _0x3da3a1=a96_0xa96e78[_0x343f7f(0x237)](_0x19ae5d,_0x54f1d5);if(_0x54f1d5[_0x343f7f(0x1e5)](_0x343f7f(0x1ee))){const _0x23b6c8=parseKnowledgeBaseYaml(a96_0x1974b2[_0x343f7f(0x1af)](_0x3da3a1,'utf-8'),_0x3da3a1);_0x1e84fd[_0x343f7f(0x211)]({'name':_0x23b6c8[_0x343f7f(0x266)],'path':_0x3da3a1,'yaml':_0x23b6c8});}else{if(_0x54f1d5[_0x343f7f(0x1e5)]('.md')){const _0x464365=a96_0x1974b2[_0x343f7f(0x1af)](_0x3da3a1,_0x343f7f(0x26f)),{name:_0x419ec7,text:_0x532ad7}=parseTextKnowledgeBaseMd(_0x464365,_0x54f1d5);_0x28cd5a[_0x343f7f(0x211)]({'name':_0x419ec7,'path':_0x3da3a1,'text':_0x532ad7});}}}}const _0x37998d=getPromptsDir(_0x4085d3);if(a96_0x1974b2[_0x343f7f(0x1b5)](_0x37998d)){const _0x1fd8f2=a96_0x1974b2['readdirSync'](_0x37998d)[_0x343f7f(0x20e)](_0x23d808=>_0x23d808[_0x343f7f(0x1e5)](_0x343f7f(0x1ee)));for(const _0x421257 of _0x1fd8f2){const _0xba90e0=a96_0xa96e78[_0x343f7f(0x237)](_0x37998d,_0x421257),_0xa0dd6d=parsePromptYaml(a96_0x1974b2[_0x343f7f(0x1af)](_0xba90e0,_0x343f7f(0x26f)),_0xba90e0);_0x29fcc6['push']({'name':_0xa0dd6d[_0x343f7f(0x266)],'path':_0xba90e0,'yaml':_0xa0dd6d});}}const _0x180ae5=getIntegrationsDir(_0x4085d3);if(a96_0x1974b2[_0x343f7f(0x1b5)](_0x180ae5)){const _0x39ed91=a96_0x1974b2[_0x343f7f(0x1b6)](_0x180ae5)[_0x343f7f(0x20e)](_0x460d6d=>_0x460d6d[_0x343f7f(0x1e5)](_0x343f7f(0x1ee)));for(const _0x56a782 of _0x39ed91){const _0x3d3594=a96_0xa96e78[_0x343f7f(0x237)](_0x180ae5,_0x56a782),_0x2de39a=parseIntegrationYaml(a96_0x1974b2[_0x343f7f(0x1af)](_0x3d3594,_0x343f7f(0x26f)),_0x3d3594);SAFE_INTEGRATION_TYPES[_0x343f7f(0x1ec)](_0x2de39a[_0x343f7f(0x259)][_0x343f7f(0x1f9)]())?_0x1dabf9['push']({'name':_0x2de39a[_0x343f7f(0x266)],'path':_0x3d3594,'yaml':_0x2de39a}):this[_0x343f7f(0x282)][_0x343f7f(0x290)](_0x343f7f(0x25f)+_0x2de39a['name']+_0x343f7f(0x204)+_0x2de39a[_0x343f7f(0x259)]+_0x343f7f(0x27d)+(_0x343f7f(0x1ef)+SAFE_INTEGRATION_TYPES[_0x343f7f(0x237)](',\x20')+')\x20can\x20be\x20cloned.'));}}const _0x115f4e=getExperimentalKnowledgeBasesDir(_0x4085d3);if(a96_0x1974b2[_0x343f7f(0x1b5)](_0x115f4e)){const _0x4269e2=a96_0x1974b2[_0x343f7f(0x1b6)](_0x115f4e,{'withFileTypes':!![]});for(const _0x34465b of _0x4269e2){if(!_0x34465b['isDirectory']())continue;const _0x5edbee=a96_0xa96e78[_0x343f7f(0x237)](_0x115f4e,_0x34465b[_0x343f7f(0x266)]),_0x23f650=a96_0xa96e78[_0x343f7f(0x237)](_0x5edbee,_0x34465b[_0x343f7f(0x266)]+_0x343f7f(0x1ee));if(a96_0x1974b2[_0x343f7f(0x1b5)](_0x23f650)){const _0x3163bb=parseExperimentalKnowledgeBaseYaml(a96_0x1974b2[_0x343f7f(0x1af)](_0x23f650,_0x343f7f(0x26f)),_0x23f650),_0x81b47c=a96_0xa96e78[_0x343f7f(0x237)](_0x5edbee,'functions'),_0x5acba0=[];if(a96_0x1974b2[_0x343f7f(0x1b5)](_0x81b47c)){const _0x50558c=a96_0x1974b2['readdirSync'](_0x81b47c,{'withFileTypes':!![]});for(const _0x386bac of _0x50558c){if(!_0x386bac[_0x343f7f(0x22f)]())continue;const _0x2a347c=a96_0xa96e78[_0x343f7f(0x237)](_0x81b47c,_0x386bac[_0x343f7f(0x266)]),_0x50429d=a96_0xa96e78[_0x343f7f(0x237)](_0x2a347c,_0x343f7f(0x233)),_0x3d752f=a96_0xa96e78[_0x343f7f(0x237)](_0x2a347c,_0x343f7f(0x27b));if(a96_0x1974b2[_0x343f7f(0x1b5)](_0x50429d)&&a96_0x1974b2[_0x343f7f(0x1b5)](_0x3d752f)){const _0x3265b8=a96_0x1974b2['readFileSync'](_0x50429d,_0x343f7f(0x26f)),_0x3f76bd=a96_0x1974b2['readFileSync'](_0x3d752f,_0x343f7f(0x26f));_0x5acba0[_0x343f7f(0x211)]({'name':_0x386bac[_0x343f7f(0x266)],'code':_0x3265b8,'json_schema':_0x3f76bd});}}}const _0x4d349a={..._0x3163bb,'functions':_0x5acba0};_0x35e971['push']({'name':_0x3163bb['name'],'path':_0x5edbee,'def':_0x4d349a});}}}const _0x147148=getExperimentalArtifactsDir(_0x4085d3);if(a96_0x1974b2[_0x343f7f(0x1b5)](_0x147148)){const _0x22dd92=a96_0x1974b2[_0x343f7f(0x1b6)](_0x147148,{'withFileTypes':!![]});for(const _0x2fb384 of _0x22dd92){if(!_0x2fb384['isDirectory']())continue;const _0x196e62=a96_0xa96e78[_0x343f7f(0x237)](_0x147148,_0x2fb384[_0x343f7f(0x266)]),_0x3b8e8b=a96_0xa96e78[_0x343f7f(0x237)](_0x196e62,_0x2fb384[_0x343f7f(0x266)]+_0x343f7f(0x1ee));if(a96_0x1974b2['existsSync'](_0x3b8e8b)){const _0x5647cd=parseExperimentalArtifactYaml(a96_0x1974b2[_0x343f7f(0x1af)](_0x3b8e8b,_0x343f7f(0x26f)),_0x3b8e8b),_0x278e8c=a96_0xa96e78['join'](_0x196e62,'code.js'),_0x76158b=a96_0x1974b2[_0x343f7f(0x1b5)](_0x278e8c)?a96_0x1974b2[_0x343f7f(0x1af)](_0x278e8c,'utf-8'):'',_0x35cd02=a96_0xa96e78[_0x343f7f(0x237)](_0x196e62,_0x343f7f(0x194)),_0x4fbeb4=[];if(a96_0x1974b2[_0x343f7f(0x1b5)](_0x35cd02)){const _0x1b7804=a96_0x1974b2['readdirSync'](_0x35cd02);for(const _0x40269e of _0x1b7804){const _0x486314=a96_0xa96e78[_0x343f7f(0x237)](_0x35cd02,_0x40269e);if(a96_0x1974b2[_0x343f7f(0x1bb)](_0x486314)[_0x343f7f(0x221)]()){const _0x4b97b0=a96_0x1974b2['readFileSync'](_0x486314,_0x343f7f(0x26f));_0x4fbeb4[_0x343f7f(0x211)]({'file_name':_0x40269e,'text_content':_0x4b97b0});}}}const _0x12628b={..._0x5647cd,'code':_0x76158b,'files':_0x4fbeb4};_0x390954[_0x343f7f(0x211)]({'name':_0x5647cd[_0x343f7f(0x266)],'path':_0x196e62,'def':_0x12628b});}}}}else{const _0x2fe475=await this[_0x343f7f(0x260)](_0x4085d3),_0x4a0d44=await this[_0x343f7f(0x26e)]['getProject'](_0x2fe475);_0x2f9f56=_0x4a0d44[_0x343f7f(0x1eb)]['name'];const _0x1ad7c8=await this[_0x343f7f(0x26e)]['listAgentsFull'](_0x2fe475),_0x1d5510=await this[_0x343f7f(0x26e)][_0x343f7f(0x1cb)](_0x2fe475),_0x1c95ea=await this[_0x343f7f(0x26e)][_0x343f7f(0x196)](_0x2fe475),_0xdc0743=await this[_0x343f7f(0x26e)][_0x343f7f(0x1c4)](_0x2fe475),_0x167e59=await this['client'][_0x343f7f(0x276)](_0x2fe475),_0x4aa04e=await this[_0x343f7f(0x26e)][_0x343f7f(0x275)](_0x2fe475),_0x42d238=await this[_0x343f7f(0x26e)]['listExperimentalArtifacts'](_0x2fe475),_0x3ad5a6=new Map(),_0x1839ba=new Map(),_0x29e9b0=new Map(),_0x2de2e2=new Map(),_0x4bda66=new Map(),_0x10cb9a=new Map();for(const _0x475ad1 of _0x1d5510){_0x3ad5a6[_0x343f7f(0x203)](_0x475ad1['id'],_0x475ad1[_0x343f7f(0x1eb)][_0x343f7f(0x266)]);}for(const _0x18f45a of _0x1c95ea){_0x1839ba[_0x343f7f(0x203)](_0x18f45a['id'],_0x18f45a['attributes']['name']);}for(const _0x425d6a of _0x1ad7c8){_0x29e9b0['set'](_0x425d6a['id'],_0x425d6a[_0x343f7f(0x1eb)][_0x343f7f(0x266)]);}for(const _0x39a319 of _0xdc0743){_0x2de2e2[_0x343f7f(0x203)](_0x39a319['id'],_0x39a319[_0x343f7f(0x1eb)][_0x343f7f(0x266)]);}for(const _0x5bda1c of _0x4aa04e){_0x4bda66[_0x343f7f(0x203)](_0x5bda1c['id'],_0x5bda1c['attributes'][_0x343f7f(0x266)]);}for(const _0x566c3e of _0x42d238){_0x10cb9a[_0x343f7f(0x203)](_0x566c3e['id'],_0x566c3e[_0x343f7f(0x1eb)][_0x343f7f(0x266)]);}const _0x22005d={'resolveKnowledgeBaseName':async _0x523756=>_0x3ad5a6['get'](_0x523756),'resolveTextKnowledgeBaseName':async _0x839643=>_0x1839ba[_0x343f7f(0x1c6)](_0x839643),'resolveAgentName':async _0x2650c4=>_0x29e9b0[_0x343f7f(0x1c6)](_0x2650c4),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async _0x20b6ed=>_0x2de2e2[_0x343f7f(0x1c6)](_0x20b6ed),'resolveExperimentalKnowledgeBaseName':async _0x24f62c=>_0x4bda66[_0x343f7f(0x1c6)](_0x24f62c),'onWarning':_0x243ad8=>this[_0x343f7f(0x282)][_0x343f7f(0x290)](_0x243ad8)};for(const _0x117bcd of _0x1ad7c8){const _0x2a6b35=await agentResponseToDef(_0x117bcd,_0x22005d),{yaml:_0x5f2e8b,systemPrompt:_0x1cc7de,starterMessage:_0x4b004f}=_0x2a6b35;_0x7650f7[_0x343f7f(0x211)]({'name':_0x5f2e8b['name'],'dir':'','yaml':_0x5f2e8b,'systemPrompt':_0x1cc7de,'starterMessage':_0x4b004f});}for(const _0x13a920 of _0x1d5510){const _0x3de599=apiKnowledgeBaseToYaml(_0x13a920);_0x1e84fd['push']({'name':_0x3de599[_0x343f7f(0x266)],'path':'','yaml':_0x3de599});}for(const _0xcbc8e4 of _0x1c95ea){_0x28cd5a[_0x343f7f(0x211)]({'name':_0xcbc8e4[_0x343f7f(0x1eb)]['name'],'path':'','text':_0xcbc8e4[_0x343f7f(0x1eb)][_0x343f7f(0x206)]});}for(const _0x117d2f of _0xdc0743){const _0x1e2830=await apiPromptToYaml(_0x117d2f,_0x22005d);_0x1e2830&&_0x29fcc6[_0x343f7f(0x211)]({'name':_0x1e2830['name'],'path':'','yaml':_0x1e2830});}for(const _0x31d34a of _0x167e59){if(!_0x31d34a[_0x343f7f(0x1eb)][_0x343f7f(0x227)]&&SAFE_INTEGRATION_TYPES[_0x343f7f(0x1ec)](_0x31d34a[_0x343f7f(0x1eb)]['serviceType'][_0x343f7f(0x1f9)]())){const _0x4df4f6=await apiIntegrationToYaml(_0x31d34a,_0x22005d);_0x1dabf9[_0x343f7f(0x211)]({'name':_0x31d34a[_0x343f7f(0x1eb)][_0x343f7f(0x19a)][_0x343f7f(0x1f9)](),'path':'','yaml':_0x4df4f6});}}for(const _0x5632ab of _0x4aa04e){const _0x24bec6=apiExperimentalKnowledgeBaseToYaml(_0x5632ab);_0x35e971[_0x343f7f(0x211)]({'name':_0x24bec6[_0x343f7f(0x266)],'path':'','def':_0x24bec6});}for(const _0x213cb3 of _0x42d238){const _0x18654a=apiExperimentalArtifactToYaml(_0x213cb3);_0x390954[_0x343f7f(0x211)]({'name':_0x18654a[_0x343f7f(0x266)],'path':'','def':_0x18654a});}}const _0x482670={'sourceProjectName':_0x2f9f56,'newProjectName':_0x3dbd55,'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}}},_0x102169=await this['client'][_0x343f7f(0x20b)](),_0x487409=_0x102169['find'](_0x27f000=>_0x27f000[_0x343f7f(0x1eb)][_0x343f7f(0x266)]===_0x3dbd55);if(_0x487409)throw new SDKError(ErrorCode[_0x343f7f(0x1c0)],_0x343f7f(0x213)+_0x3dbd55+_0x343f7f(0x22d),undefined,{'helpText':_0x343f7f(0x230)});if(_0x3b3e06?.[_0x343f7f(0x184)])return _0x482670[_0x343f7f(0x234)]['agents']['created']=_0x7650f7[_0x343f7f(0x219)],_0x482670[_0x343f7f(0x234)][_0x343f7f(0x283)][_0x343f7f(0x17f)]=_0x1e84fd[_0x343f7f(0x219)],_0x482670[_0x343f7f(0x234)][_0x343f7f(0x212)][_0x343f7f(0x17f)]=_0x28cd5a[_0x343f7f(0x219)],_0x482670[_0x343f7f(0x234)][_0x343f7f(0x19d)][_0x343f7f(0x17f)]=_0x35e971['length'],_0x482670[_0x343f7f(0x234)][_0x343f7f(0x1d6)][_0x343f7f(0x17f)]=_0x390954[_0x343f7f(0x219)],_0x482670[_0x343f7f(0x234)][_0x343f7f(0x1e9)][_0x343f7f(0x17f)]=_0x29fcc6[_0x343f7f(0x219)],_0x482670['counts'][_0x343f7f(0x26a)][_0x343f7f(0x17f)]=_0x1dabf9['length'],_0x482670;const _0x43fdb7=await this[_0x343f7f(0x26e)][_0x343f7f(0x28f)]({'name':_0x3dbd55}),_0xcf1220=_0x43fdb7['id'];_0x482670[_0x343f7f(0x20f)]=_0xcf1220;const _0x28653e=new Map(),_0x263cb9=new Map(),_0x2b8a2e=new Map(),_0x1e6788=new Map(),_0x2d6298=new Map(),_0x5d6d7b=new Map(),_0x2d8030=new Map(),_0x3e868c=new Map(),_0x11eb90=new Set(),_0x17a0ac=new Set();for(const _0x1582dd of _0x7650f7){for(const _0x4534ef of _0x1582dd[_0x343f7f(0x271)][_0x343f7f(0x225)]||[]){if(_0x4534ef[_0x343f7f(0x23f)]===_0x343f7f(0x24c)&&_0x4534ef[_0x343f7f(0x1ba)]){const _0x4f33ba=parseRef(_0x4534ef[_0x343f7f(0x1ba)]);if(_0x4f33ba)_0x11eb90[_0x343f7f(0x240)](_0x4f33ba[_0x343f7f(0x266)]);}else{if(_0x4534ef[_0x343f7f(0x23f)]==='web_search'&&_0x4534ef['target']){const _0xcf6bf4=parseRef(_0x4534ef[_0x343f7f(0x1ba)]);if(_0xcf6bf4)_0x17a0ac[_0x343f7f(0x240)](_0xcf6bf4['name']);}}}}for(const _0x21bf5b of _0x11eb90){try{const _0x27611e=await this['client'][_0x343f7f(0x1f8)]({'projectId':_0xcf1220,'name':_0x21bf5b});_0x2d6298[_0x343f7f(0x203)](_0x21bf5b,_0x27611e['id']),_0x482670[_0x343f7f(0x291)]['push']({'name':_0x21bf5b,'action':'created','id':_0x27611e['id']}),_0x482670['counts'][_0x343f7f(0x291)][_0x343f7f(0x17f)]++;}catch(_0x1d4982){_0x482670[_0x343f7f(0x291)][_0x343f7f(0x211)]({'name':_0x21bf5b,'action':_0x343f7f(0x21b),'error':_0x1d4982['message']}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x291)][_0x343f7f(0x17e)]++;}}for(const _0x5dc214 of _0x17a0ac){try{const _0x36c082=await this['client'][_0x343f7f(0x1c2)]({'projectId':_0xcf1220,'name':_0x5dc214});_0x5d6d7b[_0x343f7f(0x203)](_0x5dc214,_0x36c082['id']),_0x482670[_0x343f7f(0x231)][_0x343f7f(0x211)]({'name':_0x5dc214,'action':_0x343f7f(0x17f),'id':_0x36c082['id']}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x231)][_0x343f7f(0x17f)]++;}catch(_0x225417){_0x482670['webSearchTools']['push']({'name':_0x5dc214,'action':_0x343f7f(0x21b),'error':_0x225417[_0x343f7f(0x1ad)]}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x231)][_0x343f7f(0x17e)]++;}}const _0x1a5fcf=await this[_0x343f7f(0x26e)]['getParentSegmentKnowledgeBase'](_0xcf1220);let _0x3c5115=[];const _0x107d26={'projectId':_0xcf1220,'resolveKnowledgeBaseId':async _0x4a8926=>_0x28653e['get'](_0x4a8926),'resolveTextKnowledgeBaseId':async _0x52a35e=>_0x263cb9[_0x343f7f(0x1c6)](_0x52a35e),'resolveExperimentalKnowledgeBaseId':async _0x25ba39=>_0x2d8030['get'](_0x25ba39),'resolveAgentId':async _0x3ead6a=>_0x2b8a2e[_0x343f7f(0x1c6)](_0x3ead6a),'resolveWebSearchToolId':async _0x16a718=>_0x5d6d7b['get'](_0x16a718),'resolveImageGeneratorId':async _0x2611af=>_0x2d6298[_0x343f7f(0x1c6)](_0x2611af),'resolvePromptId':async _0x335ca8=>_0x1e6788[_0x343f7f(0x1c6)](_0x335ca8),'resolveParentSegmentKBId':async()=>_0x1a5fcf?.['id'],'onWarning':_0x377bc7=>{const _0x335ef7=_0x343f7f;this[_0x335ef7(0x282)]['warn'](_0x377bc7),_0x3c5115[_0x335ef7(0x211)](_0x377bc7);}};for(const _0x52e5c7 of _0x1e84fd){try{const _0x48bd1c=yamlKnowledgeBaseToApi(_0x52e5c7[_0x343f7f(0x271)],_0xcf1220),_0x213937=await this[_0x343f7f(0x26e)][_0x343f7f(0x1fd)](_0x48bd1c);_0x28653e[_0x343f7f(0x203)](_0x52e5c7[_0x343f7f(0x271)][_0x343f7f(0x266)],_0x213937['id']),_0x482670[_0x343f7f(0x283)][_0x343f7f(0x211)]({'name':_0x52e5c7[_0x343f7f(0x271)]['name'],'action':_0x343f7f(0x17f),'id':_0x213937['id']}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x283)][_0x343f7f(0x17f)]++;}catch(_0x20bc59){_0x482670[_0x343f7f(0x283)][_0x343f7f(0x211)]({'name':_0x52e5c7['yaml'][_0x343f7f(0x266)],'action':_0x343f7f(0x21b),'error':_0x20bc59[_0x343f7f(0x1ad)]}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x283)]['errors']++;}}for(const _0x3c9508 of _0x28cd5a){try{const _0x3cdd32=yamlTextKnowledgeBaseToApi({'name':_0x3c9508[_0x343f7f(0x266)],'text':_0x3c9508[_0x343f7f(0x206)]},_0xcf1220),_0x1665cc=await this[_0x343f7f(0x26e)][_0x343f7f(0x274)](_0x3cdd32);_0x263cb9[_0x343f7f(0x203)](_0x3c9508[_0x343f7f(0x266)],_0x1665cc['id']),_0x482670['textKnowledgeBases']['push']({'name':_0x3c9508[_0x343f7f(0x266)],'action':'created','id':_0x1665cc['id']}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x212)][_0x343f7f(0x17f)]++;}catch(_0x2d04ef){_0x482670['textKnowledgeBases'][_0x343f7f(0x211)]({'name':_0x3c9508['name'],'action':'error','error':_0x2d04ef[_0x343f7f(0x1ad)]}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x212)]['errors']++;}}for(const _0x312bca of _0x390954){try{const _0x36ad52=yamlExperimentalArtifactToApi(_0x312bca[_0x343f7f(0x1ea)],_0xcf1220),_0x2514e5=await this['client'][_0x343f7f(0x214)](_0x36ad52);_0x3e868c['set'](_0x312bca[_0x343f7f(0x1ea)]['name'],_0x2514e5['id']),_0x482670[_0x343f7f(0x1d6)][_0x343f7f(0x211)]({'name':_0x312bca[_0x343f7f(0x1ea)]['name'],'action':_0x343f7f(0x17f),'id':_0x2514e5['id']}),_0x482670['counts'][_0x343f7f(0x1d6)][_0x343f7f(0x17f)]++;}catch(_0x5a03dc){_0x482670[_0x343f7f(0x1d6)][_0x343f7f(0x211)]({'name':_0x312bca[_0x343f7f(0x1ea)][_0x343f7f(0x266)],'action':_0x343f7f(0x21b),'error':_0x5a03dc[_0x343f7f(0x1ad)]}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x1d6)][_0x343f7f(0x17e)]++;}}for(const _0x46327e of _0x35e971){try{const _0x381c6c=yamlExperimentalKnowledgeBaseToApi(_0x46327e[_0x343f7f(0x1ea)],_0xcf1220),_0x4e38f8=await this['client'][_0x343f7f(0x19f)](_0x381c6c);_0x2d8030[_0x343f7f(0x203)](_0x46327e[_0x343f7f(0x1ea)]['name'],_0x4e38f8['id']),_0x482670[_0x343f7f(0x19d)][_0x343f7f(0x211)]({'name':_0x46327e[_0x343f7f(0x1ea)][_0x343f7f(0x266)],'action':_0x343f7f(0x17f),'id':_0x4e38f8['id']}),_0x482670['counts'][_0x343f7f(0x19d)][_0x343f7f(0x17f)]++;}catch(_0x9a1f36){_0x482670['experimentalKnowledgeBases'][_0x343f7f(0x211)]({'name':_0x46327e['def'][_0x343f7f(0x266)],'action':_0x343f7f(0x21b),'error':_0x9a1f36['message']}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x19d)]['errors']++;}}const _0x4e7402=[..._0x7650f7][_0x343f7f(0x22e)]((_0xd62b3a,_0x5113fa)=>{const _0x122db5=_0x343f7f,_0xde31df=_0xd62b3a[_0x122db5(0x271)]['tools']?.[_0x122db5(0x205)](_0x3a892a=>_0x3a892a[_0x122db5(0x23f)]===_0x122db5(0x256))??![],_0x595e19=_0x5113fa['yaml'][_0x122db5(0x225)]?.[_0x122db5(0x205)](_0x428379=>_0x428379[_0x122db5(0x23f)]===_0x122db5(0x256))??![];if(_0xde31df&&!_0x595e19)return 0x1;if(!_0xde31df&&_0x595e19)return-0x1;return 0x0;});for(const _0x148d48 of _0x4e7402){_0x3c5115=[];try{const _0x5e8cff=_0x148d48[_0x343f7f(0x271)][_0x343f7f(0x225)]?.['filter'](_0x4dbb60=>{const _0x37d233=_0x343f7f;if(_0x4dbb60[_0x37d233(0x23f)]===_0x37d233(0x256)&&_0x4dbb60[_0x37d233(0x1ba)]){const _0xa0d677=parseRef(_0x4dbb60[_0x37d233(0x1ba)]);return _0xa0d677?.['name']===_0x148d48[_0x37d233(0x271)][_0x37d233(0x266)];}return![];})??[];if(_0x5e8cff[_0x343f7f(0x219)]>0x0){const _0x3f553f=_0x343f7f(0x279)+_0x148d48[_0x343f7f(0x271)][_0x343f7f(0x266)]+_0x343f7f(0x23b)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this['logger']['warn'](_0x3f553f),_0x3c5115[_0x343f7f(0x211)](_0x3f553f);}const _0x3db7f7=await agentDefToRequest(_0x148d48['yaml'],_0x148d48[_0x343f7f(0x21c)],_0x148d48['starterMessage'],_0x107d26),_0x22e7ac=await this['client'][_0x343f7f(0x23c)](_0x3db7f7);_0x2b8a2e[_0x343f7f(0x203)](_0x148d48['yaml'][_0x343f7f(0x266)],_0x22e7ac['id']),_0x482670[_0x343f7f(0x1e3)][_0x343f7f(0x211)]({'agentName':_0x148d48['yaml'][_0x343f7f(0x266)],'action':_0x343f7f(0x17f),'agentId':_0x22e7ac['id'],'warnings':_0x3c5115[_0x343f7f(0x219)]>0x0?_0x3c5115:undefined}),_0x482670[_0x343f7f(0x234)]['agents'][_0x343f7f(0x17f)]++;}catch(_0xb9845a){_0x482670[_0x343f7f(0x1e3)][_0x343f7f(0x211)]({'agentName':_0x148d48['yaml'][_0x343f7f(0x266)],'action':_0x343f7f(0x21b),'error':_0xb9845a[_0x343f7f(0x1ad)],'warnings':_0x3c5115[_0x343f7f(0x219)]>0x0?_0x3c5115:undefined}),_0x482670[_0x343f7f(0x234)]['agents'][_0x343f7f(0x17e)]++;}}for(const _0x318ce8 of _0x29fcc6){try{const _0x90b250=await yamlPromptToApi(_0x318ce8[_0x343f7f(0x271)],_0xcf1220,_0x107d26);if(!_0x90b250){_0x482670[_0x343f7f(0x1e9)]['push']({'name':_0x318ce8['yaml']['name'],'action':'error','error':_0x343f7f(0x28d)}),_0x482670['counts'][_0x343f7f(0x1e9)]['errors']++;continue;}const _0x2093dc=await this[_0x343f7f(0x26e)][_0x343f7f(0x207)](_0x90b250);_0x1e6788[_0x343f7f(0x203)](_0x318ce8[_0x343f7f(0x271)]['name'],_0x2093dc['id']),_0x482670[_0x343f7f(0x1e9)][_0x343f7f(0x211)]({'name':_0x318ce8[_0x343f7f(0x271)]['name'],'action':_0x343f7f(0x17f),'id':_0x2093dc['id']}),_0x482670['counts'][_0x343f7f(0x1e9)]['created']++;}catch(_0x22c95b){_0x482670['prompts'][_0x343f7f(0x211)]({'name':_0x318ce8['yaml']['name'],'action':_0x343f7f(0x21b),'error':_0x22c95b[_0x343f7f(0x1ad)]}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x1e9)][_0x343f7f(0x17e)]++;}}for(const _0xb4e0e4 of _0x1dabf9){try{const _0x33f5ca=await yamlIntegrationToApi(_0xb4e0e4[_0x343f7f(0x271)],_0xcf1220,_0x107d26),_0x434307=await this[_0x343f7f(0x26e)][_0x343f7f(0x23d)](_0x33f5ca);_0x482670[_0x343f7f(0x26a)][_0x343f7f(0x211)]({'name':_0xb4e0e4[_0x343f7f(0x271)][_0x343f7f(0x259)],'action':'created','id':_0x434307['id']}),_0x482670['counts'][_0x343f7f(0x26a)]['created']++;}catch(_0x2998b7){_0x482670[_0x343f7f(0x26a)][_0x343f7f(0x211)]({'name':_0xb4e0e4[_0x343f7f(0x271)][_0x343f7f(0x259)],'action':'error','error':_0x2998b7['message']}),_0x482670[_0x343f7f(0x234)][_0x343f7f(0x26a)]['errors']++;}}return _0x482670;}}