@treasuredata/tdx 0.26.0 → 0.26.2

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 (170) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/chat-command.js +1 -1
  11. package/dist/commands/claude-command.js +1 -1
  12. package/dist/commands/claude-statusline-command.js +1 -1
  13. package/dist/commands/claude-usage-command.js +1 -1
  14. package/dist/commands/command.js +1 -1
  15. package/dist/commands/connection-command.js +1 -1
  16. package/dist/commands/databases.js +1 -1
  17. package/dist/commands/describe.js +1 -1
  18. package/dist/commands/engage-command.js +1 -1
  19. package/dist/commands/job-command.js +1 -1
  20. package/dist/commands/journey-command.js +1 -1
  21. package/dist/commands/journey-validate-command.js +1 -1
  22. package/dist/commands/llm-command.js +1 -1
  23. package/dist/commands/mcp-command.js +1 -1
  24. package/dist/commands/parent-segment-command.js +1 -1
  25. package/dist/commands/profile-command.js +1 -1
  26. package/dist/commands/profiles-command.js +1 -1
  27. package/dist/commands/query-command.js +1 -1
  28. package/dist/commands/schedule-command.js +1 -1
  29. package/dist/commands/segment-command.js +1 -1
  30. package/dist/commands/segment-create-command.js +1 -1
  31. package/dist/commands/segment-fields-command.js +1 -1
  32. package/dist/commands/segment-pull-command.js +1 -1
  33. package/dist/commands/segment-push-command.js +1 -1
  34. package/dist/commands/segment-update-command.js +1 -1
  35. package/dist/commands/segment-use-command.js +1 -1
  36. package/dist/commands/segment-validate-command.js +1 -1
  37. package/dist/commands/segments.js +1 -1
  38. package/dist/commands/show.js +1 -1
  39. package/dist/commands/status-command.js +1 -1
  40. package/dist/commands/tables.js +1 -1
  41. package/dist/commands/unset-command.js +1 -1
  42. package/dist/commands/use-command.js +1 -1
  43. package/dist/commands/user-command.js +1 -1
  44. package/dist/commands/workflow-command.js +1 -1
  45. package/dist/core/auth.js +1 -1
  46. package/dist/core/command-output.js +1 -1
  47. package/dist/core/config.js +1 -1
  48. package/dist/core/connection-cache.js +1 -1
  49. package/dist/core/constants.js +1 -1
  50. package/dist/core/credential-cache.js +1 -1
  51. package/dist/core/global-context.js +1 -1
  52. package/dist/core/keychain.js +1 -1
  53. package/dist/core/profile.js +1 -1
  54. package/dist/core/project-config.js +1 -1
  55. package/dist/core/session.js +1 -1
  56. package/dist/core/user-cache.js +1 -1
  57. package/dist/core/version.js +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/mcp/server.js +1 -1
  60. package/dist/mcp/tools/index.js +1 -1
  61. package/dist/mcp/tools/tdx-run.js +1 -1
  62. package/dist/mcp/tools/tdx-search.js +1 -1
  63. package/dist/mcp/utils.js +1 -1
  64. package/dist/proxy/claude-usage-tracker.js +1 -1
  65. package/dist/proxy/passthrough-server.js +1 -1
  66. package/dist/proxy/sse-usage-parser.js +1 -1
  67. package/dist/sdk/agent/agent-config.js +1 -1
  68. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  69. package/dist/sdk/agent/agent-yaml.js +1 -1
  70. package/dist/sdk/agent/test/evaluator.js +1 -1
  71. package/dist/sdk/agent/test/executor.js +1 -1
  72. package/dist/sdk/agent/test/index.js +1 -1
  73. package/dist/sdk/agent/test/output.js +1 -1
  74. package/dist/sdk/agent/test/parser.js +1 -1
  75. package/dist/sdk/api.js +1 -1
  76. package/dist/sdk/client/cdp-api-client.js +1 -1
  77. package/dist/sdk/client/endpoints.js +1 -1
  78. package/dist/sdk/client/engage-api-client.js +1 -1
  79. package/dist/sdk/client/http-client.js +1 -1
  80. package/dist/sdk/client/llm-api-client.js +1 -1
  81. package/dist/sdk/client/rate-limiter.js +1 -1
  82. package/dist/sdk/client/td-api-client.js +1 -1
  83. package/dist/sdk/client/trino-api-client.js +1 -1
  84. package/dist/sdk/client/workflow-client.js +1 -1
  85. package/dist/sdk/connection-validator.js +1 -1
  86. package/dist/sdk/connection.js +1 -1
  87. package/dist/sdk/engage.js +1 -1
  88. package/dist/sdk/errors.js +1 -1
  89. package/dist/sdk/index.js +1 -1
  90. package/dist/sdk/io/index.js +1 -1
  91. package/dist/sdk/io/node-filesystem.js +1 -1
  92. package/dist/sdk/job.js +1 -1
  93. package/dist/sdk/journey.js +1 -1
  94. package/dist/sdk/llm/chat-cache.js +1 -1
  95. package/dist/sdk/llm/index.js +1 -1
  96. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  97. package/dist/sdk/llm/model-factors.js +1 -1
  98. package/dist/sdk/personalization.js +1 -1
  99. package/dist/sdk/query/index.js +1 -1
  100. package/dist/sdk/query/sql-parser.js +1 -1
  101. package/dist/sdk/realtime.js +1 -1
  102. package/dist/sdk/schedule.js +1 -1
  103. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  104. package/dist/sdk/segment/fields-display.js +1 -1
  105. package/dist/sdk/segment/file-discovery.js +1 -1
  106. package/dist/sdk/segment/journey-utils.js +1 -1
  107. package/dist/sdk/segment/journey-validator.js +1 -1
  108. package/dist/sdk/segment/journey-yaml.js +1 -1
  109. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  110. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  111. package/dist/sdk/segment/pull-workflow.js +1 -1
  112. package/dist/sdk/segment/push-recovery.js +1 -1
  113. package/dist/sdk/segment/push-workflow.js +1 -1
  114. package/dist/sdk/segment/resolution-context.js +1 -1
  115. package/dist/sdk/segment/segment-path-parser.js +1 -1
  116. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  117. package/dist/sdk/segment/target-resolution.js +1 -1
  118. package/dist/sdk/segment/tdx-config.js +1 -1
  119. package/dist/sdk/segment/validate-files.js +1 -1
  120. package/dist/sdk/segment/yaml-validator.js +1 -1
  121. package/dist/sdk/segment.js +1 -1
  122. package/dist/sdk/types/index.js +1 -1
  123. package/dist/sdk/types/progress.js +1 -1
  124. package/dist/sdk/user.js +1 -1
  125. package/dist/sdk/util/format-detector.js +1 -1
  126. package/dist/sdk/util/formatters.js +1 -1
  127. package/dist/sdk/util/index.js +1 -1
  128. package/dist/sdk/util/tree-formatter.js +1 -1
  129. package/dist/sdk/workflow/archive-validation.js +1 -1
  130. package/dist/sdk/workflow/clone-workflow.js +1 -1
  131. package/dist/sdk/workflow/index.js +1 -1
  132. package/dist/sdk/workflow/pull-workflow.js +1 -1
  133. package/dist/sdk/workflow/push-workflow.js +1 -1
  134. package/dist/sdk/workflow/tdx-config.js +1 -1
  135. package/dist/sdk/workflow/workflow-utils.js +1 -1
  136. package/dist/test-utils/command-runner.js +1 -1
  137. package/dist/test-utils/factories.js +1 -1
  138. package/dist/test-utils/fixtures.js +1 -1
  139. package/dist/test-utils/http-mock.js +1 -1
  140. package/dist/test-utils/index.js +1 -1
  141. package/dist/utils/async.js +1 -1
  142. package/dist/utils/colors.js +1 -1
  143. package/dist/utils/diff.js +1 -1
  144. package/dist/utils/file-permissions.js +1 -1
  145. package/dist/utils/global-cache.js +1 -1
  146. package/dist/utils/json-loader.js +1 -1
  147. package/dist/utils/local-cache.d.ts +2 -1
  148. package/dist/utils/local-cache.d.ts.map +1 -1
  149. package/dist/utils/local-cache.js +1 -1
  150. package/dist/utils/local-cache.js.map +1 -1
  151. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  152. package/dist/utils/logger/formatters/index.js +1 -1
  153. package/dist/utils/logger/handlers/console-handler.js +1 -1
  154. package/dist/utils/logger/handlers/file-handler.js +1 -1
  155. package/dist/utils/logger/handlers/index.js +1 -1
  156. package/dist/utils/logger/handlers/null-handler.js +1 -1
  157. package/dist/utils/logger/index.js +1 -1
  158. package/dist/utils/logger/logger.js +1 -1
  159. package/dist/utils/logger/types.js +1 -1
  160. package/dist/utils/option-validation.js +1 -1
  161. package/dist/utils/port.js +1 -1
  162. package/dist/utils/process.js +1 -1
  163. package/dist/utils/prompt.js +1 -1
  164. package/dist/utils/spinner.js +1 -1
  165. package/dist/utils/sse-parser.js +1 -1
  166. package/dist/utils/string-utils.js +1 -1
  167. package/dist/utils/table-ref-parser.js +1 -1
  168. package/dist/utils/tdx-logger.js +1 -1
  169. package/dist/utils/version-check.js +1 -1
  170. package/package.json +1 -1
@@ -1 +1 @@
1
- const a96_0x50fe1e=a96_0x12dc;(function(_0x4ff1bd,_0x4cf713){const _0x3ce666=a96_0x12dc,_0x3dee12=_0x4ff1bd();while(!![]){try{const _0x4dae08=parseInt(_0x3ce666(0x2c6))/0x1+-parseInt(_0x3ce666(0x22f))/0x2*(parseInt(_0x3ce666(0x210))/0x3)+parseInt(_0x3ce666(0x1ff))/0x4*(-parseInt(_0x3ce666(0x22e))/0x5)+parseInt(_0x3ce666(0x2ab))/0x6*(parseInt(_0x3ce666(0x29c))/0x7)+-parseInt(_0x3ce666(0x2b9))/0x8+parseInt(_0x3ce666(0x234))/0x9+parseInt(_0x3ce666(0x2b1))/0xa;if(_0x4dae08===_0x4cf713)break;else _0x3dee12['push'](_0x3dee12['shift']());}catch(_0x1db5c1){_0x3dee12['push'](_0x3dee12['shift']());}}}(a96_0xbafe,0xcc0da));import{LLMApiClient}from'../client/llm-api-client.js';import*as a96_0x44d248 from'node:fs';import*as a96_0x268840 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';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';function a96_0xbafe(){const _0x5ad581=['serviceType','outputs','maxToolIterations',')\x20can\x20be\x20cloned.','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','\x0a\x0a#\x20agent.yml\x0a','agentId','updateAgentResponse','availableModels','Backup\x20folder\x20not\x20found:\x20','map','json_schema.json','has','warn','isDirectory','currentProjectId','LLM_PROJECT_NOT_FOUND','\x27.\x20This\x20should\x20not\x20happen.','prompts.json','listAgentsFull','description','content','starterMessage','listAgents','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','cloneProject','Renamed\x20text\x20KB\x20file:\x20','createIntegration','name','chat','Project\x20\x22','\x22\x20already\x20exists','metadata','agent','counts','NOT_FOUND','def','clearDefaultAgent','Renamed\x20integration\x20file:\x20','join','project.json','createImageGenerator','tdx_default_','INVALID_ARGUMENT','Renamed\x20KB\x20file:\x20','listWebSearchTools','info','3817919piERkC','dirname','listImageGenerators','some','getChatLog','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','knowledgeBases','Agent\x20not\x20found:\x20','agent.yml\x20not\x20found\x20in\x20','agents.json','new','):\x20','service_type','Multiple\x20agents\x20found\x20with\x20name\x20\x27','6fgyhBV','toISOString','\x20---\x0a','createExperimentalKnowledgeBase','experimental_artifacts','updateAgent','10499770tfWHtS','yaml','push','version','writeFileSync','site','getBackupMetadata','Unable\x20to\x20create\x20project\x20after\x20','935112GzFpoI','isDir','agent.yml','textKnowledgeBases','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','experimental_knowledge_bases','template','path','Project\x20not\x20found:\x20','pullAgent','Renamed\x20folder:\x20','signal','641274fSIcnU','minimal','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','projectName','agents','UNAUTHENTICATED','tdDatabaseName','statSync','updated','Only\x20safe\x20types\x20(','createAgentResponse','createExperimentalArtifact','createTextKnowledgeBase','integrations.json','getChatInfo','\x27\x20(','imageGenerators','integrations','logger','toLowerCase','continueChat','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.','filter','No\x20tdx.json\x20found\x20in\x20','dryRun','tools','deleteProject','claude-4.5-sonnet','sdk.llm','listKnowledgeBases','basename','createPrompt','backupProject','updateExperimentalKnowledgeBase','exportedFrom','getAgent','_reasoning_','chatIgnoreManagedActions','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','chat_generic','getDefaultAgent','web_search','functions','\x20in\x20project\x20','total','deleteAgent','chatWelcomeMessage','status','Renamed\x20prompt\x20file:\x20','knowledgebases.json','isFile','set','utf-8','Renamed\x20agent\x20folder:\x20','cwd','readdirSync','\x0a---\x20code\x20---\x0a','getProject','#\x20prompt.md\x0a','existsSync','Multiple\x20projects\x20found\x20with\x20name\x20\x27','agentsFull','.yml','resolveProjectName','size','medium','errors','prompts','split','sort','files','mkdirSync','renamed','56dbTwlo','duplicate','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','text','\x20→\x20','isManaged','projects','AGENT_NOT_FOUND','experimentalKnowledgeBases','target','resolveProjectId','profile','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','get','add','conflict','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','855mwLRxx','starter_message','getUserSettings','getCurrentProject','listExperimentalKnowledgeBases','length','endsWith','find','context','---\x20file:\x20','loadJsonFile','getDefaultProjectName','oldPath','updatePrompt','stringify','.llm','getOrCreateDefaultProject','prompt.md','tdx_','updateExperimentalArtifact','pushProject','readFileSync','json_schema','code.js','listExperimentalArtifacts','listPrompts','event','Agent\x20\x27','createKnowledgeBase','unchanged','415765SiNDDp','5674lPLMnE','\x0a---\x20function:\x20','chat_parent_segment','tdx.json','includes','6198390bPQWlN','.md','listProjects','file_name','createAgent','systemPrompt','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','getChatHistory','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','parse','jsonSchemaHint','availableModelNames','pullProject','createProject','attributes','Agent\x20reference\x20not\x20found','resolveAgentId','code','getParentSegmentKnowledgeBase','projectId','text_content','setCurrentProject','deleteIntegration','\x20attempts\x20due\x20to\x20name\x20conflicts.','client','starter_message.md','llm_project','webSearchTools','ALREADY_EXISTS','(dry-run)','listIntegrations','experimentalArtifacts','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','PERMISSION_DENIED','error','promptId','newProjectId','Skipping\x20integration\x20\x27','type','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','updateTextKnowledgeBase','modelType','image_gen','INTERNAL','chatId','message','listTextKnowledgeBases','restoreProject','project','startChat','localeCompare','knowledge_bases','actions','Renamed\x20experimental\x20artifact\x20directory:\x20','variables','\x0a---\x20schema:\x20','created'];a96_0xbafe=function(){return _0x5ad581;};return a96_0xbafe();}import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a96_0x50fe1e(0x2ed),'chat_agent_console',a96_0x50fe1e(0x231)];function a96_0x12dc(_0x5955db,_0x5c75fc){_0x5955db=_0x5955db-0x1e6;const _0xbafec1=a96_0xbafe();let _0x12dcbe=_0xbafec1[_0x5955db];return _0x12dcbe;}export class LLMSDK{[a96_0x50fe1e(0x27c)];[a96_0x50fe1e(0x24c)];[a96_0x50fe1e(0x218)];[a96_0x50fe1e(0x2d8)]=Logger['of'](a96_0x50fe1e(0x2e2));constructor(_0x3a7f31){this['client']=new LLMApiClient(_0x3a7f31),this['context']=_0x3a7f31;}[a96_0x50fe1e(0x21b)](){const _0x2c7a6f=a96_0x50fe1e,_0xcc4615=getSanitizedUsername();return _0x2c7a6f(0x297)+_0xcc4615;}async[a96_0x50fe1e(0x249)](_0x3cf65d){const _0x3f4d29=a96_0x50fe1e,{projectId:_0x2c1eba}=await this[_0x3f4d29(0x1f5)](_0x3cf65d);this[_0x3f4d29(0x27c)]=_0x2c1eba;}[a96_0x50fe1e(0x213)](){const _0x54a557=a96_0x50fe1e;return this[_0x54a557(0x27c)];}async['setDefaultAgent'](_0xb518c1){const _0x53f9d7=a96_0x50fe1e,_0x413e22=this['context'][_0x53f9d7(0x20a)];let _0x14b362,_0x5dfc0e;if(_0xb518c1['includes']('/')){const _0x3a4bf8=_0xb518c1[_0x53f9d7(0x1fa)]('/');if(_0x3a4bf8['length']!==0x2)throw new SDKError(ErrorCode[_0x53f9d7(0x298)],'Invalid\x20agent\x20reference\x20format:\x20'+_0xb518c1,undefined,{'helpText':'Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22'});const [_0x435de0,_0x1cac49]=_0x3a4bf8;_0x14b362=await this[_0x53f9d7(0x209)](_0x435de0),_0x5dfc0e=_0x1cac49;}else _0x14b362=this[_0x53f9d7(0x27c)]||(await this['getOrCreateDefaultProject']())['id'],_0x5dfc0e=_0xb518c1;const _0x4bd79d=await this[_0x53f9d7(0x244)](_0x5dfc0e,_0x14b362),_0x1409bd=await this['client']['getAgent'](_0x4bd79d);writeCachedLLMAgent(_0x1409bd['attributes'][_0x53f9d7(0x289)],_0x4bd79d,_0x14b362,_0x413e22);}[a96_0x50fe1e(0x2ee)](){const _0x58e334=a96_0x50fe1e,_0x41178c=this['context'][_0x58e334(0x20a)];return readCachedLLMAgent(_0x41178c)||undefined;}[a96_0x50fe1e(0x292)](){const _0x4d61fb=a96_0x50fe1e,_0x5ab1bf=this['context'][_0x4d61fb(0x20a)];clearCachedLLMAgent(_0x5ab1bf);}async['models'](){const _0x4b6121=a96_0x50fe1e,_0x223e1b=await this[_0x4b6121(0x24c)][_0x4b6121(0x212)](),_0x4be7c1=[];for(const _0x27b32c of _0x223e1b[_0x4b6121(0x23f)]){const _0x423996=_0x223e1b[_0x4b6121(0x275)][_0x27b32c];_0x423996&&_0x4be7c1['push']({'name':_0x27b32c,'displayName':_0x423996['displayName']});}return _0x4be7c1;}async[a96_0x50fe1e(0x241)](_0x490a0c){const _0x24b1af=a96_0x50fe1e;return await this['client'][_0x24b1af(0x241)](_0x490a0c);}async[a96_0x50fe1e(0x2e0)](_0x20bacc){const _0x19ff74=a96_0x50fe1e,{projectId:_0x358d1c}=await this[_0x19ff74(0x1f5)](_0x20bacc);await this[_0x19ff74(0x24c)]['deleteProject'](_0x358d1c);}async[a96_0x50fe1e(0x205)](_0x1d928a=0x32){const _0x2e0c82=a96_0x50fe1e;return await this[_0x2e0c82(0x24c)][_0x2e0c82(0x236)](_0x1d928a);}async['getOrCreateDefaultProject'](_0x284d17){const _0x237229=a96_0x50fe1e,_0x29614e=_0x284d17||this[_0x237229(0x21b)](),_0x5b6c14=this['context'][_0x237229(0x20a)];if(!_0x284d17){const _0x53878c=readCachedLLMProject(_0x5b6c14);if(_0x53878c&&_0x53878c[_0x237229(0x289)]===_0x29614e)try{const _0x423cf1=await this['client'][_0x237229(0x1ef)](_0x53878c['id']);if(_0x423cf1[_0x237229(0x242)][_0x237229(0x289)]===_0x29614e)return _0x423cf1;}catch{}}const _0x55f9a9=await this[_0x237229(0x24c)][_0x237229(0x236)](),_0x1da64a=_0x55f9a9[_0x237229(0x217)](_0x598fc9=>_0x598fc9[_0x237229(0x242)][_0x237229(0x289)]===_0x29614e);if(_0x1da64a)return!_0x284d17&&writeCachedLLMProject(_0x29614e,_0x1da64a['id'],_0x5b6c14),_0x1da64a;const _0x57f1d0=await this[_0x237229(0x24c)][_0x237229(0x241)]({'name':_0x29614e,'description':_0x237229(0x2a1)+getSanitizedUsername()+')'});return!_0x284d17&&writeCachedLLMProject(_0x29614e,_0x57f1d0['id'],_0x5b6c14),_0x57f1d0;}async['resolveProjectId'](_0x25ddde){const _0x4ed612=a96_0x50fe1e,_0x1a678f=await this[_0x4ed612(0x24c)]['listProjects'](),_0x4f482e=_0x1a678f['filter'](_0xa86ab1=>_0xa86ab1[_0x4ed612(0x242)][_0x4ed612(0x289)]===_0x25ddde);if(_0x4f482e[_0x4ed612(0x215)]===0x0)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x4ed612(0x2c2)+_0x25ddde,undefined,{'helpText':_0x4ed612(0x2be)});if(_0x4f482e[_0x4ed612(0x215)]>0x1)throw new SDKError(ErrorCode[_0x4ed612(0x25f)],_0x4ed612(0x1f2)+_0x25ddde+_0x4ed612(0x27e));return _0x4f482e[0x0]['id'];}async['resolveProjectName'](_0x48be11){const _0xdccfe8=a96_0x50fe1e,_0x119233=await this['client'][_0xdccfe8(0x236)](),_0x2ca6ed=_0x119233['find'](_0x34d83c=>_0x34d83c[_0xdccfe8(0x242)][_0xdccfe8(0x289)]===_0x48be11);if(_0x2ca6ed)return{'projectId':_0x2ca6ed['id'],'project':_0x2ca6ed};throw new SDKError(ErrorCode[_0xdccfe8(0x27d)],_0xdccfe8(0x2c2)+_0x48be11,undefined,{'helpText':_0xdccfe8(0x2be)});}async['getOrCreateDefaultAgent'](_0x317686=a96_0x50fe1e(0x2e1),_0x4603f8=0x0,_0x53e516){const _0x1933bd=a96_0x50fe1e,_0x19b29f=0xa;let _0x4d9e93=0x0,_0x53728e;while(_0x4d9e93<_0x19b29f){try{const _0x561b84=await this[_0x1933bd(0x220)](_0x53728e),_0x238383=_0x561b84['id'],_0x21c6be=['none',_0x1933bd(0x2c7),'low',_0x1933bd(0x1f7),'high'],_0x319201=_0x4603f8===0x0?_0x1933bd(0x222)+_0x317686:_0x1933bd(0x222)+_0x317686+_0x1933bd(0x2ea)+_0x21c6be[_0x4603f8],_0x28179b=await this[_0x1933bd(0x24c)][_0x1933bd(0x284)](_0x238383),_0x14264f=_0x28179b[_0x1933bd(0x217)](_0x565454=>_0x565454[_0x1933bd(0x242)][_0x1933bd(0x289)]===_0x319201);if(_0x14264f)return _0x14264f;const _0x1b3866=_0x4603f8>0x0?0x1:_0x53e516;return await this['client'][_0x1933bd(0x238)]({'name':_0x319201,'projectId':_0x238383,'modelType':_0x317686,'systemPrompt':'','temperature':_0x1b3866,'reasoningEffort':_0x4603f8>0x0?_0x4603f8:undefined});}catch(_0x428ab0){if(_0x428ab0 instanceof HTTPClientError){const _0x2c95e2=_0x428ab0[_0x1933bd(0x2f5)];if(_0x2c95e2>=0x190&&_0x2c95e2<0x1f4){if(_0x2c95e2===0x191)throw new SDKError(ErrorCode[_0x1933bd(0x2cb)],_0x1933bd(0x25b),_0x428ab0);else{if(_0x2c95e2===0x193)throw new SDKError(ErrorCode[_0x1933bd(0x255)],_0x1933bd(0x285),_0x428ab0);}throw _0x428ab0;}}if(errorContains(_0x428ab0,'already\x20exists',_0x1933bd(0x200),_0x1933bd(0x20e))){_0x4d9e93++;if(_0x4d9e93>=_0x19b29f)throw new SDKError(ErrorCode[_0x1933bd(0x250)],_0x1933bd(0x2b8)+_0x19b29f+_0x1933bd(0x24b),_0x428ab0);const _0x1891da=this['getDefaultProjectName']();_0x53728e=_0x1891da+'_'+generateRandomHex();continue;}throw _0x428ab0;}}throw new SDKError(ErrorCode[_0x1933bd(0x25f)],'Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts');}async['resolveAgentId'](_0x8039c4,_0x1816cc){const _0x134120=a96_0x50fe1e,_0x4fd0d1=_0x1816cc||this[_0x134120(0x27c)],_0x2c6bbc=await this[_0x134120(0x24c)][_0x134120(0x284)](_0x4fd0d1),_0x5ce7ab=_0x2c6bbc[_0x134120(0x2dc)](_0x29ed0d=>_0x29ed0d[_0x134120(0x242)][_0x134120(0x289)]===_0x8039c4);if(_0x5ce7ab[_0x134120(0x215)]===0x0){const _0x22bf82=_0x4fd0d1?_0x134120(0x2f1)+_0x4fd0d1:'';throw new SDKError(ErrorCode[_0x134120(0x206)],'Agent\x20not\x20found:\x20'+_0x8039c4+_0x22bf82,undefined,{'helpText':_0x4fd0d1?_0x134120(0x201):_0x134120(0x2db)});}if(_0x5ce7ab[_0x134120(0x215)]>0x1)throw new SDKError(ErrorCode[_0x134120(0x25f)],_0x134120(0x2aa)+_0x8039c4+_0x134120(0x27e));return _0x5ce7ab[0x0]['id'];}async['agents'](_0x44d101){const _0x316c90=a96_0x50fe1e,_0x3244a8=_0x44d101||this[_0x316c90(0x27c)];return await this[_0x316c90(0x24c)][_0x316c90(0x284)](_0x3244a8);}async[a96_0x50fe1e(0x1f3)](_0x477958){const _0x860ac7=a96_0x50fe1e;return await this[_0x860ac7(0x24c)][_0x860ac7(0x280)](_0x477958);}async['agent'](_0x3e6674){const _0x2d10a3=a96_0x50fe1e;return await this[_0x2d10a3(0x24c)][_0x2d10a3(0x2e9)](_0x3e6674);}async['createAgent'](_0xf985bb){const _0x2271fa=a96_0x50fe1e;return await this['client'][_0x2271fa(0x238)](_0xf985bb);}async[a96_0x50fe1e(0x2b0)](_0xea50de,_0x506b2c){const _0x13d9d1=a96_0x50fe1e;return await this[_0x13d9d1(0x24c)][_0x13d9d1(0x2b0)](_0xea50de,_0x506b2c);}async[a96_0x50fe1e(0x2f3)](_0x119052){const _0x1775f2=a96_0x50fe1e;await this['client'][_0x1775f2(0x2f3)](_0x119052);}async[a96_0x50fe1e(0x265)](_0x147717){const _0x555453=a96_0x50fe1e;return await this[_0x555453(0x24c)][_0x555453(0x265)]({'agentId':_0x147717});}async*[a96_0x50fe1e(0x28a)](_0x3f7c3d,_0x525e43){const _0x3048b2=a96_0x50fe1e;let _0x5eea5c=_0x525e43?.[_0x3048b2(0x260)];const _0x2919f6=_0x525e43?.[_0x3048b2(0x273)];if(!_0x5eea5c){if(!_0x2919f6)throw new Error(_0x3048b2(0x23c));const _0x72cbce=await this[_0x3048b2(0x24c)][_0x3048b2(0x265)]({'agentId':_0x2919f6});_0x5eea5c=_0x72cbce['id'],yield{'type':_0x3048b2(0x28d),'data':{'chatId':_0x5eea5c,'agentId':_0x2919f6,'projectId':_0x72cbce[_0x3048b2(0x242)][_0x3048b2(0x247)]}};}for await(const _0x3f5346 of this['client'][_0x3048b2(0x2da)](_0x5eea5c,_0x3f7c3d,_0x525e43?.[_0x3048b2(0x2c5)])){yield{'type':_0x3048b2(0x22a),'data':_0x3f5346};}}async['chats'](_0x2b4aa3=0x32){return await this['client']['listChats'](_0x2b4aa3);}async['history'](_0x7d6190){const _0x35c65f=a96_0x50fe1e;return await this[_0x35c65f(0x24c)][_0x35c65f(0x23b)](_0x7d6190);}async[a96_0x50fe1e(0x2a0)](_0x233754){const _0x36fc55=a96_0x50fe1e;return await this[_0x36fc55(0x24c)]['getChatLog'](_0x233754);}async['chatInfo'](_0x534e50){const _0xad84c7=a96_0x50fe1e;return await this['client'][_0xad84c7(0x2d4)](_0x534e50);}async[a96_0x50fe1e(0x2e6)](_0x183acc,_0x417723,_0x27a8fc){const _0x27cc8f=a96_0x50fe1e,_0x214118=_0x27a8fc?.['dryRun']??![],{projectId:_0x4a7daa,project:_0x549c6d}=await this[_0x27cc8f(0x1f5)](_0x183acc),_0x4e9df0=_0x549c6d['attributes']['name'],_0x4731df=_0x417723||_0x4e9df0+_0x27cc8f(0x21f);if(a96_0x44d248[_0x27cc8f(0x1f1)](_0x4731df)&&!_0x214118)throw new SDKError(ErrorCode[_0x27cc8f(0x250)],'Output\x20directory\x20already\x20exists:\x20'+_0x4731df,undefined,{'helpText':'Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.'});const _0x59c10c=await this['client'][_0x27cc8f(0x280)](_0x4a7daa),_0x40fed6=await this[_0x27cc8f(0x24c)][_0x27cc8f(0x2e3)](_0x4a7daa),_0x5dc6fa=await this[_0x27cc8f(0x24c)]['listPrompts'](_0x4a7daa),_0x4bd934=await this[_0x27cc8f(0x24c)]['listIntegrations'](_0x4a7daa);if(!_0x214118){a96_0x44d248['mkdirSync'](_0x4731df,{'recursive':!![]});const _0x4992={'version':'1.0','exportedAt':new Date()[_0x27cc8f(0x2ac)](),'exportedFrom':{'site':this[_0x27cc8f(0x218)][_0x27cc8f(0x2b6)],'projectId':_0x4a7daa,'projectName':_0x4e9df0},'project':_0x549c6d};a96_0x44d248['writeFileSync'](a96_0x268840['join'](_0x4731df,'project.json'),JSON[_0x27cc8f(0x21e)](_0x4992,null,0x2)),a96_0x44d248['writeFileSync'](a96_0x268840[_0x27cc8f(0x294)](_0x4731df,_0x27cc8f(0x2a6)),JSON['stringify'](_0x59c10c,null,0x2)),a96_0x44d248[_0x27cc8f(0x2b5)](a96_0x268840[_0x27cc8f(0x294)](_0x4731df,_0x27cc8f(0x1e7)),JSON[_0x27cc8f(0x21e)](_0x40fed6,null,0x2)),a96_0x44d248[_0x27cc8f(0x2b5)](a96_0x268840[_0x27cc8f(0x294)](_0x4731df,_0x27cc8f(0x27f)),JSON[_0x27cc8f(0x21e)](_0x5dc6fa,null,0x2)),a96_0x44d248['writeFileSync'](a96_0x268840[_0x27cc8f(0x294)](_0x4731df,_0x27cc8f(0x2d3)),JSON[_0x27cc8f(0x21e)](_0x4bd934,null,0x2));}return{'projectName':_0x4e9df0,'outputDir':_0x4731df,'counts':{'agents':_0x59c10c[_0x27cc8f(0x215)],'knowledgeBases':_0x40fed6['length'],'prompts':_0x5dc6fa[_0x27cc8f(0x215)],'integrations':_0x4bd934[_0x27cc8f(0x215)]}};}async[a96_0x50fe1e(0x263)](_0x2434ab,_0x1af679){const _0x4a2ef1=a96_0x50fe1e,_0x2981d4=_0x1af679?.[_0x4a2ef1(0x2de)]??![],_0x3d8b99=this['getBackupMetadata'](_0x2434ab),_0x5493e2=_0x3d8b99[_0x4a2ef1(0x2e8)][_0x4a2ef1(0x2b6)],_0x23dd0b=this[_0x4a2ef1(0x218)]['site'],_0x33b7a2=_0x5493e2!==_0x23dd0b?_0x5493e2:undefined,_0x43d6c6=this[_0x4a2ef1(0x21a)](a96_0x268840[_0x4a2ef1(0x294)](_0x2434ab,_0x4a2ef1(0x2a6)),[]),_0x43d3ed=this[_0x4a2ef1(0x21a)](a96_0x268840[_0x4a2ef1(0x294)](_0x2434ab,'knowledgebases.json'),[]),_0x5416e5=this[_0x4a2ef1(0x21a)](a96_0x268840[_0x4a2ef1(0x294)](_0x2434ab,_0x4a2ef1(0x27f)),[]),_0x5c88b7=this[_0x4a2ef1(0x21a)](a96_0x268840['join'](_0x2434ab,_0x4a2ef1(0x2d3)),[]),_0x4168c7=_0x1af679?.['name']||_0x3d8b99[_0x4a2ef1(0x2e8)][_0x4a2ef1(0x2c9)];if(_0x2981d4){const _0x154ea9=new Map(),_0x276ec3=[..._0x43d6c6],_0x1d9803=_0x43d6c6[_0x4a2ef1(0x215)]+0x1;let _0x46551a=0x0;while(_0x276ec3[_0x4a2ef1(0x215)]>0x0&&_0x46551a<_0x1d9803){_0x46551a++;const _0x42b1dd=[];for(const _0x3b6291 of _0x276ec3){canCreateAgent(_0x3b6291,_0x154ea9)?_0x154ea9[_0x4a2ef1(0x1e9)](_0x3b6291['id'],'dry-run-'+_0x3b6291['id']):_0x42b1dd[_0x4a2ef1(0x2b3)](_0x3b6291);}if(_0x42b1dd['length']===_0x276ec3[_0x4a2ef1(0x215)])throw new SDKError(ErrorCode[_0x4a2ef1(0x25f)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x4a2ef1(0x20b)});_0x276ec3['length']=0x0,_0x276ec3[_0x4a2ef1(0x2b3)](..._0x42b1dd);}const _0x33a71f=_0x5416e5['filter'](_0x36c50d=>_0x154ea9[_0x4a2ef1(0x279)](_0x36c50d[_0x4a2ef1(0x242)][_0x4a2ef1(0x273)]))[_0x4a2ef1(0x215)];return{'projectName':_0x4168c7,'projectId':_0x4a2ef1(0x251),'counts':{'agents':_0x43d6c6['length'],'knowledgeBases':_0x43d3ed[_0x4a2ef1(0x215)],'prompts':_0x33a71f,'integrations':_0x5c88b7[_0x4a2ef1(0x215)]},'sourceSite':_0x33b7a2};}const _0x598c6b=await this[_0x4a2ef1(0x24c)][_0x4a2ef1(0x241)]({'name':_0x4168c7,'description':_0x3d8b99[_0x4a2ef1(0x264)][_0x4a2ef1(0x242)][_0x4a2ef1(0x281)]}),_0x538de2=_0x598c6b['id'],_0x533201=new Map(),_0x191462=new Map(),_0x20bd68=new Map();for(const _0x149412 of _0x43d3ed){const _0x2f4561=await this['client'][_0x4a2ef1(0x22c)]({'projectId':_0x538de2,'name':_0x149412['attributes'][_0x4a2ef1(0x289)],'tdDatabaseName':_0x149412[_0x4a2ef1(0x242)][_0x4a2ef1(0x2cc)],'tables':_0x149412[_0x4a2ef1(0x242)]['tables']});_0x533201[_0x4a2ef1(0x1e9)](_0x149412['id'],_0x2f4561['id']);}const _0x25cb03=[..._0x43d6c6],_0x157510=_0x43d6c6[_0x4a2ef1(0x215)]+0x1;let _0x3f162e=0x0;while(_0x25cb03['length']>0x0&&_0x3f162e<_0x157510){_0x3f162e++;const _0x236ee3=[];for(const _0x50d924 of _0x25cb03){if(canCreateAgent(_0x50d924,_0x191462)){const _0x34ae29=remapToolIds(_0x50d924['attributes'][_0x4a2ef1(0x2df)],_0x533201,_0x191462),_0x3754ae=remapVariableIds(_0x50d924[_0x4a2ef1(0x242)][_0x4a2ef1(0x26a)],_0x533201),_0x224958=await this[_0x4a2ef1(0x24c)]['createAgentResponse']({'name':_0x50d924['attributes'][_0x4a2ef1(0x289)],'projectId':_0x538de2,'systemPrompt':_0x50d924[_0x4a2ef1(0x242)]['systemPrompt'],'starterMessage':_0x50d924[_0x4a2ef1(0x242)][_0x4a2ef1(0x283)],'modelType':migrateModelType(_0x50d924[_0x4a2ef1(0x242)][_0x4a2ef1(0x25d)]),'maxToolIterations':_0x50d924[_0x4a2ef1(0x242)][_0x4a2ef1(0x26f)],'temperature':_0x50d924[_0x4a2ef1(0x242)]['temperature'],'reasoningEffort':_0x50d924['attributes']['reasoningEffort'],'outputs':_0x50d924['attributes'][_0x4a2ef1(0x26e)],'tools':_0x34ae29,'variables':_0x3754ae});_0x191462[_0x4a2ef1(0x1e9)](_0x50d924['id'],_0x224958['id']);}else _0x236ee3[_0x4a2ef1(0x2b3)](_0x50d924);}if(_0x236ee3[_0x4a2ef1(0x215)]===_0x25cb03[_0x4a2ef1(0x215)])throw new SDKError(ErrorCode[_0x4a2ef1(0x25f)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x4a2ef1(0x20b)});_0x25cb03[_0x4a2ef1(0x215)]=0x0,_0x25cb03[_0x4a2ef1(0x2b3)](..._0x236ee3);}for(const _0x3abfa7 of _0x5416e5){const _0x33f65f=_0x191462[_0x4a2ef1(0x20c)](_0x3abfa7[_0x4a2ef1(0x242)]['agentId']);if(!_0x33f65f)continue;const _0x5b0141=await this[_0x4a2ef1(0x24c)][_0x4a2ef1(0x2e5)]({'projectId':_0x538de2,'agentId':_0x33f65f,'name':_0x3abfa7[_0x4a2ef1(0x242)][_0x4a2ef1(0x289)],'systemPrompt':_0x3abfa7[_0x4a2ef1(0x242)][_0x4a2ef1(0x239)],'template':_0x3abfa7[_0x4a2ef1(0x242)][_0x4a2ef1(0x2c0)],'jsonSchemaHint':_0x3abfa7[_0x4a2ef1(0x242)][_0x4a2ef1(0x23e)]});_0x20bd68['set'](_0x3abfa7['id'],_0x5b0141['id']);}for(const _0x5c2c79 of _0x5c88b7){const _0x1f8b6a=_0x5c2c79[_0x4a2ef1(0x242)][_0x4a2ef1(0x268)][_0x4a2ef1(0x277)](_0x35aaeb=>({..._0x35aaeb,'promptId':_0x20bd68[_0x4a2ef1(0x20c)](_0x35aaeb[_0x4a2ef1(0x257)])||_0x35aaeb['promptId']}));await this[_0x4a2ef1(0x24c)]['createIntegration']({'projectId':_0x538de2,'serviceType':_0x5c2c79['attributes'][_0x4a2ef1(0x26d)],'actions':_0x1f8b6a,'slackMessageMode':_0x5c2c79[_0x4a2ef1(0x242)]['slackMessageMode'],'chatIgnoreManagedActions':_0x5c2c79[_0x4a2ef1(0x242)][_0x4a2ef1(0x2eb)],'chatWelcomeMessage':_0x5c2c79[_0x4a2ef1(0x242)][_0x4a2ef1(0x2f4)],'webhookCorsOrigins':_0x5c2c79[_0x4a2ef1(0x242)]['webhookCorsOrigins']});}return{'projectName':_0x4168c7,'projectId':_0x538de2,'counts':{'agents':_0x191462[_0x4a2ef1(0x1f6)],'knowledgeBases':_0x533201[_0x4a2ef1(0x1f6)],'prompts':_0x20bd68[_0x4a2ef1(0x1f6)],'integrations':_0x5c88b7['length']},'sourceSite':_0x33b7a2};}[a96_0x50fe1e(0x21a)](_0x1c4a58,_0x334aa7){const _0x125d64=a96_0x50fe1e;if(!a96_0x44d248[_0x125d64(0x1f1)](_0x1c4a58))return _0x334aa7;return JSON[_0x125d64(0x23d)](a96_0x44d248[_0x125d64(0x225)](_0x1c4a58,_0x125d64(0x1ea)));}[a96_0x50fe1e(0x2b7)](_0x445f10){const _0x6e3f94=a96_0x50fe1e;if(!a96_0x44d248[_0x6e3f94(0x1f1)](_0x445f10))throw new SDKError(ErrorCode[_0x6e3f94(0x290)],_0x6e3f94(0x276)+_0x445f10,undefined,{'helpText':_0x6e3f94(0x23a)});const _0x2e9ad8=a96_0x268840[_0x6e3f94(0x294)](_0x445f10,_0x6e3f94(0x295));if(!a96_0x44d248[_0x6e3f94(0x1f1)](_0x2e9ad8))throw new SDKError(ErrorCode[_0x6e3f94(0x298)],_0x6e3f94(0x254)+_0x445f10,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x6c7dc1=JSON[_0x6e3f94(0x23d)](a96_0x44d248['readFileSync'](_0x2e9ad8,_0x6e3f94(0x1ea)));if(!isSupportedBackupVersion(_0x6c7dc1[_0x6e3f94(0x2b4)]))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Unsupported\x20backup\x20version:\x20'+_0x6c7dc1[_0x6e3f94(0x2b4)],undefined,{'helpText':_0x6e3f94(0x20f)});return _0x6c7dc1;}async[a96_0x50fe1e(0x240)](_0x3cb336,_0x1233ee,_0x311f93){const _0x118819=a96_0x50fe1e,{projectId:_0x7bb524,project:_0x34111a}=await this['resolveProjectName'](_0x3cb336),_0x4e0734=_0x34111a[_0x118819(0x242)][_0x118819(0x289)];let _0x176ac5;if(_0x1233ee)_0x176ac5=_0x1233ee;else{const _0x46a1c9=a96_0x268840[_0x118819(0x294)](process[_0x118819(0x1ec)](),_0x118819(0x2ca)),_0x4ca003=getSanitizedPathWithMigration(_0x46a1c9,_0x4e0734);_0x4ca003['renamed']&&this[_0x118819(0x2d8)]['info'](_0x118819(0x2c4)+a96_0x268840[_0x118819(0x2e4)](_0x4ca003[_0x118819(0x21c)])+'\x20→\x20'+a96_0x268840['basename'](_0x4ca003[_0x118819(0x2c1)])),_0x176ac5=_0x4ca003[_0x118819(0x2c1)];}const _0x5ef4e0=await this[_0x118819(0x24c)][_0x118819(0x280)](_0x7bb524),_0x11c132=await this['client'][_0x118819(0x2e3)](_0x7bb524),_0x27d4bb=await this['client'][_0x118819(0x262)](_0x7bb524),_0x32c411=await this[_0x118819(0x24c)]['listImageGenerators'](_0x7bb524),_0xb2fc1a=await this['client'][_0x118819(0x29a)](_0x7bb524),_0x1c0f03=await this[_0x118819(0x24c)][_0x118819(0x229)](_0x7bb524),_0x1e4a7e=await this[_0x118819(0x24c)][_0x118819(0x252)](_0x7bb524),_0x5dddc5=await this[_0x118819(0x24c)][_0x118819(0x214)](_0x7bb524),_0x4713eb=await this[_0x118819(0x24c)][_0x118819(0x228)](_0x7bb524),_0x2ab6c2=_0x1e4a7e['filter'](_0x2f9ba8=>!_0x2f9ba8['attributes'][_0x118819(0x204)]&&SAFE_INTEGRATION_TYPES[_0x118819(0x233)](_0x2f9ba8[_0x118819(0x242)][_0x118819(0x26d)][_0x118819(0x2d9)]())),_0x2b0894=new Map(),_0x2e38bf=new Map(),_0x4f7636=new Map(),_0x945a89=new Map(),_0x2aecd4=new Map(),_0x515278=new Map(),_0x1b1cef=new Map();for(const _0x5e5d5b of _0x5ef4e0){_0x2b0894['set'](_0x5e5d5b['id'],_0x5e5d5b[_0x118819(0x242)][_0x118819(0x289)]);}for(const _0x1fba6f of _0x11c132){_0x2e38bf['set'](_0x1fba6f['id'],_0x1fba6f[_0x118819(0x242)]['name']);}for(const _0x29e870 of _0x27d4bb){_0x4f7636[_0x118819(0x1e9)](_0x29e870['id'],_0x29e870[_0x118819(0x242)]['name']);}for(const _0xa6e0b of _0x32c411){_0x945a89[_0x118819(0x1e9)](_0xa6e0b['id'],_0xa6e0b[_0x118819(0x242)][_0x118819(0x289)]);}for(const _0x41106c of _0xb2fc1a){_0x2aecd4['set'](_0x41106c['id'],_0x41106c[_0x118819(0x242)][_0x118819(0x289)]);}for(const _0x40787d of _0x1c0f03){_0x515278[_0x118819(0x1e9)](_0x40787d['id'],_0x40787d[_0x118819(0x242)][_0x118819(0x289)]);}for(const _0x760c50 of _0x5dddc5){_0x1b1cef[_0x118819(0x1e9)](_0x760c50['id'],_0x760c50[_0x118819(0x242)][_0x118819(0x289)]);}const _0x1101a6={'resolveKnowledgeBaseName':async _0x47c8bf=>_0x2e38bf[_0x118819(0x20c)](_0x47c8bf),'resolveTextKnowledgeBaseName':async _0x436fdf=>_0x4f7636[_0x118819(0x20c)](_0x436fdf),'resolveAgentName':async _0x14c9c3=>_0x2b0894[_0x118819(0x20c)](_0x14c9c3),'resolveWebSearchToolName':async _0x5db69b=>_0x2aecd4[_0x118819(0x20c)](_0x5db69b),'resolveImageGeneratorName':async _0xcb19d3=>_0x945a89[_0x118819(0x20c)](_0xcb19d3),'resolvePromptName':async _0x49dfa3=>_0x515278[_0x118819(0x20c)](_0x49dfa3),'resolveExperimentalKnowledgeBaseName':async _0x49c16c=>_0x1b1cef['get'](_0x49c16c),'onWarning':_0x35ce5e=>this[_0x118819(0x2d8)]['warn'](_0x35ce5e)},_0x46dd98={'projectName':_0x4e0734,'outputDir':_0x176ac5,'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}}},_0x46e25a=[],_0x35a9b3=[];for(const _0x25b880 of _0x5ef4e0){const _0x5ed0cc=getSanitizedPathWithMigration(_0x176ac5,_0x25b880[_0x118819(0x242)][_0x118819(0x289)]);_0x5ed0cc[_0x118819(0x1fe)]&&this[_0x118819(0x2d8)][_0x118819(0x29b)](_0x118819(0x1eb)+a96_0x268840['basename'](_0x5ed0cc[_0x118819(0x21c)])+_0x118819(0x203)+a96_0x268840[_0x118819(0x2e4)](_0x5ed0cc[_0x118819(0x2c1)]));const _0x586ba8=_0x5ed0cc[_0x118819(0x2c1)],_0x25813f=a96_0x268840['join'](_0x586ba8,'prompt.md'),_0x4c224d=a96_0x268840['join'](_0x586ba8,_0x118819(0x2bb)),_0x5169e7=a96_0x268840[_0x118819(0x294)](_0x586ba8,'starter_message.md'),{yaml:_0x1e5abe,systemPrompt:_0x3b8fa5,starterMessage:_0x15dcd0}=await agentResponseToDef(_0x25b880,_0x1101a6),_0x1fe200=toAgentYamlString(_0x1e5abe),_0x2d99e9=!a96_0x44d248[_0x118819(0x1f1)](_0x4c224d);let _0x1c19af=_0x2d99e9,_0x430002;if(!_0x2d99e9){const _0x4a9f27=a96_0x44d248['existsSync'](_0x25813f)?a96_0x44d248[_0x118819(0x225)](_0x25813f,_0x118819(0x1ea)):'',_0xb7b494=a96_0x44d248[_0x118819(0x225)](_0x4c224d,'utf-8'),_0x39edc7=_0x118819(0x1f0)+_0x4a9f27+_0x118819(0x272)+_0xb7b494,_0x2279d7=_0x118819(0x1f0)+_0x3b8fa5+_0x118819(0x272)+_0x1fe200,_0x2da3d3=generateDiff(_0x39edc7,_0x2279d7);_0x1c19af=hasChanges(_0x2da3d3),_0x1c19af&&(_0x430002=formatDiffWithColors(_0x2da3d3));}_0x46e25a[_0x118819(0x2b3)]({'path':_0x586ba8,'content':'','isDir':!![]}),_0x46e25a[_0x118819(0x2b3)]({'path':_0x25813f,'content':_0x3b8fa5}),_0x46e25a['push']({'path':_0x4c224d,'content':_0x1fe200});_0x15dcd0&&_0x15dcd0['includes']('\x0a')&&_0x46e25a[_0x118819(0x2b3)]({'path':_0x5169e7,'content':_0x15dcd0});_0x46dd98['agents'][_0x118819(0x2b3)]({'agentName':_0x25b880[_0x118819(0x242)]['name'],'outputPath':_0x586ba8,'isNew':_0x2d99e9,'hasChanges':_0x1c19af,'diff':_0x430002}),_0x46dd98[_0x118819(0x28f)][_0x118819(0x2ca)][_0x118819(0x2f2)]++;if(_0x2d99e9)_0x46dd98[_0x118819(0x28f)]['agents'][_0x118819(0x2a7)]++;else{if(_0x1c19af)_0x46dd98[_0x118819(0x28f)][_0x118819(0x2ca)]['updated']++;else _0x46dd98[_0x118819(0x28f)][_0x118819(0x2ca)][_0x118819(0x22d)]++;}}for(const _0x3354aa of _0x11c132){if(_0x3354aa[_0x118819(0x242)]['isManaged'])continue;const _0x3bc3d0=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x176ac5),_0x3354aa[_0x118819(0x242)][_0x118819(0x289)],_0x118819(0x1f4));_0x3bc3d0['renamed']&&this[_0x118819(0x2d8)]['info'](_0x118819(0x299)+a96_0x268840[_0x118819(0x2e4)](_0x3bc3d0[_0x118819(0x21c)])+_0x118819(0x203)+a96_0x268840[_0x118819(0x2e4)](_0x3bc3d0[_0x118819(0x2c1)]));const _0x4412af=_0x3bc3d0['path'],_0x406717=apiKnowledgeBaseToYaml(_0x3354aa),_0x9b0071=toKnowledgeBaseYamlString(_0x406717),_0x55f49a=!a96_0x44d248[_0x118819(0x1f1)](_0x4412af);let _0x40bdfb=_0x55f49a,_0x2f3555;if(!_0x55f49a){const _0x5a576d=a96_0x44d248[_0x118819(0x225)](_0x4412af,'utf-8'),_0x1645a7=generateDiff(_0x5a576d,_0x9b0071);_0x40bdfb=hasChanges(_0x1645a7),_0x40bdfb&&(_0x2f3555=formatDiffWithColors(_0x1645a7));}_0x46e25a[_0x118819(0x2b3)]({'path':_0x4412af,'content':_0x9b0071}),_0x46dd98[_0x118819(0x2a3)]['push']({'name':_0x3354aa[_0x118819(0x242)][_0x118819(0x289)],'outputPath':_0x4412af,'isNew':_0x55f49a,'hasChanges':_0x40bdfb,'diff':_0x2f3555}),_0x46dd98['counts'][_0x118819(0x2a3)]['total']++;if(_0x55f49a)_0x46dd98['counts'][_0x118819(0x2a3)]['new']++;else{if(_0x40bdfb)_0x46dd98['counts'][_0x118819(0x2a3)][_0x118819(0x2ce)]++;else _0x46dd98[_0x118819(0x28f)]['knowledgeBases'][_0x118819(0x22d)]++;}}for(const _0xe24897 of _0x27d4bb){if(_0xe24897['attributes'][_0x118819(0x204)])continue;const _0x343de4=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x176ac5),_0xe24897[_0x118819(0x242)][_0x118819(0x289)],'.md');_0x343de4[_0x118819(0x1fe)]&&this['logger'][_0x118819(0x29b)](_0x118819(0x287)+a96_0x268840['basename'](_0x343de4[_0x118819(0x21c)])+_0x118819(0x203)+a96_0x268840[_0x118819(0x2e4)](_0x343de4[_0x118819(0x2c1)]));const _0x582e29=_0x343de4[_0x118819(0x2c1)],_0x5afda8=toTextKnowledgeBaseMd(_0xe24897[_0x118819(0x242)][_0x118819(0x289)],_0xe24897['attributes'][_0x118819(0x202)]),_0x46af44=!a96_0x44d248[_0x118819(0x1f1)](_0x582e29);let _0xd5e3f2=_0x46af44,_0x26fa30;if(!_0x46af44){const _0x5efe06=a96_0x44d248['readFileSync'](_0x582e29,'utf-8'),_0x110c66=generateDiff(_0x5efe06,_0x5afda8);_0xd5e3f2=hasChanges(_0x110c66),_0xd5e3f2&&(_0x26fa30=formatDiffWithColors(_0x110c66));}_0x46e25a[_0x118819(0x2b3)]({'path':_0x582e29,'content':_0x5afda8}),_0x46dd98[_0x118819(0x2bc)][_0x118819(0x2b3)]({'name':_0xe24897['attributes']['name'],'outputPath':_0x582e29,'isNew':_0x46af44,'hasChanges':_0xd5e3f2,'diff':_0x26fa30}),_0x46dd98['counts'][_0x118819(0x2bc)][_0x118819(0x2f2)]++;if(_0x46af44)_0x46dd98[_0x118819(0x28f)][_0x118819(0x2bc)]['new']++;else{if(_0xd5e3f2)_0x46dd98[_0x118819(0x28f)][_0x118819(0x2bc)][_0x118819(0x2ce)]++;else _0x46dd98[_0x118819(0x28f)]['textKnowledgeBases']['unchanged']++;}}for(const _0x2d64dd of _0x1c0f03){if(_0x2d64dd[_0x118819(0x242)]['isManaged'])continue;const _0x5c8d1e=getSanitizedPathWithMigration(getPromptsDir(_0x176ac5),_0x2d64dd[_0x118819(0x242)][_0x118819(0x289)],_0x118819(0x1f4));_0x5c8d1e['renamed']&&this['logger'][_0x118819(0x29b)](_0x118819(0x1e6)+a96_0x268840[_0x118819(0x2e4)](_0x5c8d1e[_0x118819(0x21c)])+_0x118819(0x203)+a96_0x268840[_0x118819(0x2e4)](_0x5c8d1e[_0x118819(0x2c1)]));const _0x468b88=_0x5c8d1e[_0x118819(0x2c1)],_0x95c03a=await apiPromptToYaml(_0x2d64dd,_0x1101a6);if(!_0x95c03a)continue;const _0x281a53=toPromptYamlString(_0x95c03a),_0x245c2f=!a96_0x44d248[_0x118819(0x1f1)](_0x468b88);let _0x56270f=_0x245c2f,_0x41f9a3;if(!_0x245c2f){const _0x495b1d=a96_0x44d248[_0x118819(0x225)](_0x468b88,'utf-8'),_0x586da3=generateDiff(_0x495b1d,_0x281a53);_0x56270f=hasChanges(_0x586da3),_0x56270f&&(_0x41f9a3=formatDiffWithColors(_0x586da3));}_0x46e25a['push']({'path':_0x468b88,'content':_0x281a53}),_0x46dd98[_0x118819(0x1f9)][_0x118819(0x2b3)]({'name':_0x2d64dd[_0x118819(0x242)][_0x118819(0x289)],'outputPath':_0x468b88,'isNew':_0x245c2f,'hasChanges':_0x56270f,'diff':_0x41f9a3}),_0x46dd98['counts'][_0x118819(0x1f9)][_0x118819(0x2f2)]++;if(_0x245c2f)_0x46dd98[_0x118819(0x28f)][_0x118819(0x1f9)]['new']++;else{if(_0x56270f)_0x46dd98[_0x118819(0x28f)][_0x118819(0x1f9)][_0x118819(0x2ce)]++;else _0x46dd98[_0x118819(0x28f)][_0x118819(0x1f9)][_0x118819(0x22d)]++;}}for(const _0x1bcb50 of _0x2ab6c2){const _0x5a2411=_0x1bcb50['attributes'][_0x118819(0x26d)]['toLowerCase'](),_0x584711=getSanitizedPathWithMigration(getIntegrationsDir(_0x176ac5),_0x5a2411,'.yml');_0x584711[_0x118819(0x1fe)]&&this[_0x118819(0x2d8)]['info'](_0x118819(0x293)+a96_0x268840['basename'](_0x584711['oldPath'])+_0x118819(0x203)+a96_0x268840[_0x118819(0x2e4)](_0x584711[_0x118819(0x2c1)]));const _0x3483db=_0x584711['path'],_0x589d50=await apiIntegrationToYaml(_0x1bcb50,_0x1101a6),_0x4b09a8=toIntegrationYamlString(_0x589d50),_0x2c59d0=!a96_0x44d248[_0x118819(0x1f1)](_0x3483db);let _0x3e5499=_0x2c59d0,_0x3cc5b3;if(!_0x2c59d0){const _0x449ce4=a96_0x44d248['readFileSync'](_0x3483db,'utf-8'),_0x407b6e=generateDiff(_0x449ce4,_0x4b09a8);_0x3e5499=hasChanges(_0x407b6e),_0x3e5499&&(_0x3cc5b3=formatDiffWithColors(_0x407b6e));}_0x46e25a[_0x118819(0x2b3)]({'path':_0x3483db,'content':_0x4b09a8}),_0x46dd98[_0x118819(0x2d7)]['push']({'name':_0x5a2411,'outputPath':_0x3483db,'isNew':_0x2c59d0,'hasChanges':_0x3e5499,'diff':_0x3cc5b3}),_0x46dd98[_0x118819(0x28f)][_0x118819(0x2d7)]['total']++;if(_0x2c59d0)_0x46dd98[_0x118819(0x28f)][_0x118819(0x2d7)][_0x118819(0x2a7)]++;else{if(_0x3e5499)_0x46dd98[_0x118819(0x28f)][_0x118819(0x2d7)][_0x118819(0x2ce)]++;else _0x46dd98[_0x118819(0x28f)][_0x118819(0x2d7)]['unchanged']++;}}for(const _0x42481b of _0x5dddc5){if(_0x42481b[_0x118819(0x242)][_0x118819(0x204)])continue;const _0x8eaadc=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x176ac5),_0x42481b[_0x118819(0x242)][_0x118819(0x289)]);_0x8eaadc[_0x118819(0x1fe)]&&this[_0x118819(0x2d8)][_0x118819(0x29b)]('Renamed\x20experimental\x20KB\x20directory:\x20'+a96_0x268840[_0x118819(0x2e4)](_0x8eaadc[_0x118819(0x21c)])+_0x118819(0x203)+a96_0x268840[_0x118819(0x2e4)](_0x8eaadc[_0x118819(0x2c1)]));const _0x2e8504=_0x8eaadc[_0x118819(0x2c1)],_0x23ce2b=a96_0x268840[_0x118819(0x294)](_0x2e8504,sanitizeForFilesystem(_0x42481b[_0x118819(0x242)][_0x118819(0x289)])+_0x118819(0x1f4)),_0x1b6d16=a96_0x268840[_0x118819(0x294)](_0x2e8504,_0x118819(0x2f0)),_0xf4652a=apiExperimentalKnowledgeBaseToYaml(_0x42481b),_0xc164e1=toExperimentalKnowledgeBaseYamlString(_0xf4652a),_0xdf30c0=!a96_0x44d248[_0x118819(0x1f1)](_0x2e8504);let _0x110daa=_0xdf30c0,_0x494c03,_0x7d1fa6=_0xc164e1;const _0x1b6675=[..._0xf4652a['functions']]['sort']((_0x57ae22,_0x59350b)=>_0x57ae22[_0x118819(0x289)]['localeCompare'](_0x59350b[_0x118819(0x289)]));for(const _0x1c49d3 of _0x1b6675){_0x7d1fa6+=_0x118819(0x230)+_0x1c49d3['name']+'\x20---\x0a'+_0x1c49d3[_0x118819(0x245)]+_0x118819(0x26b)+_0x1c49d3[_0x118819(0x289)]+_0x118819(0x2ad)+_0x1c49d3[_0x118819(0x226)]+'\x0a';}if(!_0xdf30c0){let _0x4f186b='';a96_0x44d248[_0x118819(0x1f1)](_0x23ce2b)&&(_0x4f186b=a96_0x44d248[_0x118819(0x225)](_0x23ce2b,_0x118819(0x1ea)));if(a96_0x44d248[_0x118819(0x1f1)](_0x1b6d16)){const _0x362b85=a96_0x44d248[_0x118819(0x1ed)](_0x1b6d16,{'withFileTypes':!![]}),_0x3f4529=_0x362b85['filter'](_0x2735f3=>_0x2735f3[_0x118819(0x27b)]())[_0x118819(0x1fb)]((_0xb49e9e,_0x4ce8a1)=>_0xb49e9e[_0x118819(0x289)][_0x118819(0x266)](_0x4ce8a1[_0x118819(0x289)]));for(const _0x59cf02 of _0x3f4529){const _0x3de0cc=a96_0x268840['join'](_0x1b6d16,_0x59cf02[_0x118819(0x289)],_0x118819(0x227)),_0x3b9451=a96_0x268840[_0x118819(0x294)](_0x1b6d16,_0x59cf02['name'],_0x118819(0x278));a96_0x44d248[_0x118819(0x1f1)](_0x3de0cc)&&(_0x4f186b+='\x0a---\x20function:\x20'+_0x59cf02[_0x118819(0x289)]+_0x118819(0x2ad)+a96_0x44d248[_0x118819(0x225)](_0x3de0cc,'utf-8')+'\x0a'),a96_0x44d248[_0x118819(0x1f1)](_0x3b9451)&&(_0x4f186b+='---\x20schema:\x20'+_0x59cf02[_0x118819(0x289)]+_0x118819(0x2ad)+a96_0x44d248[_0x118819(0x225)](_0x3b9451,'utf-8')+'\x0a');}}const _0x1b3c51=generateDiff(_0x4f186b,_0x7d1fa6);_0x110daa=hasChanges(_0x1b3c51),_0x110daa&&(_0x494c03=formatDiffWithColors(_0x1b3c51));}_0x46e25a[_0x118819(0x2b3)]({'path':_0x2e8504,'content':'','isDir':!![]}),_0x46e25a['push']({'path':_0x23ce2b,'content':_0xc164e1}),_0x46e25a['push']({'path':_0x1b6d16,'content':'','isDir':!![]});for(const _0x2a145a of _0xf4652a['functions']){const _0x372534=a96_0x268840[_0x118819(0x294)](_0x1b6d16,sanitizeForFilesystem(_0x2a145a[_0x118819(0x289)])),_0x25e244=a96_0x268840[_0x118819(0x294)](_0x372534,_0x118819(0x227)),_0x1720e4=a96_0x268840[_0x118819(0x294)](_0x372534,_0x118819(0x278));_0x46e25a[_0x118819(0x2b3)]({'path':_0x372534,'content':'','isDir':!![]}),_0x46e25a[_0x118819(0x2b3)]({'path':_0x25e244,'content':_0x2a145a[_0x118819(0x245)]}),_0x46e25a[_0x118819(0x2b3)]({'path':_0x1720e4,'content':_0x2a145a[_0x118819(0x226)]});}if(a96_0x44d248[_0x118819(0x1f1)](_0x1b6d16)){const _0x98f4b1=a96_0x44d248['readdirSync'](_0x1b6d16,{'withFileTypes':!![]}),_0x3024a5=new Set(_0xf4652a[_0x118819(0x2f0)][_0x118819(0x277)](_0x29927a=>sanitizeForFilesystem(_0x29927a[_0x118819(0x289)])));for(const _0x3a92cb of _0x98f4b1){if(_0x3a92cb[_0x118819(0x27b)]()&&!_0x3024a5[_0x118819(0x279)](_0x3a92cb[_0x118819(0x289)])){const _0x190bcd=a96_0x268840[_0x118819(0x294)](_0x1b6d16,_0x3a92cb[_0x118819(0x289)]);_0x35a9b3[_0x118819(0x2b3)]({'path':_0x190bcd,'isDir':!![]});}}}_0x46dd98[_0x118819(0x207)][_0x118819(0x2b3)]({'name':_0x42481b[_0x118819(0x242)][_0x118819(0x289)],'outputPath':_0x2e8504,'isNew':_0xdf30c0,'hasChanges':_0x110daa,'diff':_0x494c03}),_0x46dd98['counts'][_0x118819(0x207)][_0x118819(0x2f2)]++;if(_0xdf30c0)_0x46dd98[_0x118819(0x28f)][_0x118819(0x207)][_0x118819(0x2a7)]++;else{if(_0x110daa)_0x46dd98[_0x118819(0x28f)][_0x118819(0x207)]['updated']++;else _0x46dd98[_0x118819(0x28f)][_0x118819(0x207)][_0x118819(0x22d)]++;}}for(const _0x40df59 of _0x4713eb){if(_0x40df59[_0x118819(0x242)]['isManaged'])continue;const _0x517bd7=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x176ac5),_0x40df59[_0x118819(0x242)]['name']);_0x517bd7[_0x118819(0x1fe)]&&this[_0x118819(0x2d8)][_0x118819(0x29b)](_0x118819(0x269)+a96_0x268840[_0x118819(0x2e4)](_0x517bd7[_0x118819(0x21c)])+'\x20→\x20'+a96_0x268840[_0x118819(0x2e4)](_0x517bd7[_0x118819(0x2c1)]));const _0x1a115a=_0x517bd7[_0x118819(0x2c1)],_0x123c3e=a96_0x268840[_0x118819(0x294)](_0x1a115a,sanitizeForFilesystem(_0x40df59[_0x118819(0x242)][_0x118819(0x289)])+_0x118819(0x1f4)),_0xc20dea=a96_0x268840[_0x118819(0x294)](_0x1a115a,_0x118819(0x227)),_0x81c2bd=a96_0x268840[_0x118819(0x294)](_0x1a115a,_0x118819(0x1fc)),_0xd854ef=apiExperimentalArtifactToYaml(_0x40df59),_0x566766=toExperimentalArtifactYamlString(_0xd854ef),_0x28179a=!a96_0x44d248[_0x118819(0x1f1)](_0x1a115a);let _0x121cab=_0x28179a,_0x18ac8e,_0x5a4063=_0x566766+(_0x118819(0x1ee)+_0xd854ef['code']+'\x0a');const _0x37dfb1=[..._0xd854ef[_0x118819(0x1fc)]][_0x118819(0x1fb)]((_0x438c65,_0x3ebc32)=>_0x438c65[_0x118819(0x237)][_0x118819(0x266)](_0x3ebc32[_0x118819(0x237)]));for(const _0x3398a5 of _0x37dfb1){_0x5a4063+='---\x20file:\x20'+_0x3398a5['file_name']+_0x118819(0x2ad)+_0x3398a5[_0x118819(0x248)]+'\x0a';}if(!_0x28179a){let _0x1b6be3='';a96_0x44d248[_0x118819(0x1f1)](_0x123c3e)&&(_0x1b6be3=a96_0x44d248[_0x118819(0x225)](_0x123c3e,'utf-8'));a96_0x44d248[_0x118819(0x1f1)](_0xc20dea)&&(_0x1b6be3+='\x0a---\x20code\x20---\x0a'+a96_0x44d248[_0x118819(0x225)](_0xc20dea,_0x118819(0x1ea))+'\x0a');if(a96_0x44d248['existsSync'](_0x81c2bd)){const _0x23c433=a96_0x44d248[_0x118819(0x1ed)](_0x81c2bd),_0x1877ac=_0x23c433[_0x118819(0x2dc)](_0x3a9193=>{const _0xc8b9b4=_0x118819,_0x4e6030=a96_0x268840[_0xc8b9b4(0x294)](_0x81c2bd,_0x3a9193);return a96_0x44d248[_0xc8b9b4(0x2cd)](_0x4e6030)[_0xc8b9b4(0x1e8)]();})['sort']((_0x226bdf,_0x25649e)=>_0x226bdf[_0x118819(0x266)](_0x25649e));for(const _0x15c59b of _0x1877ac){const _0x552fe9=a96_0x268840[_0x118819(0x294)](_0x81c2bd,_0x15c59b);_0x1b6be3+=_0x118819(0x219)+_0x15c59b+'\x20---\x0a'+a96_0x44d248[_0x118819(0x225)](_0x552fe9,_0x118819(0x1ea))+'\x0a';}}const _0x1ac503=generateDiff(_0x1b6be3,_0x5a4063);_0x121cab=hasChanges(_0x1ac503),_0x121cab&&(_0x18ac8e=formatDiffWithColors(_0x1ac503));}_0x46e25a['push']({'path':_0x1a115a,'content':'','isDir':!![]}),_0x46e25a[_0x118819(0x2b3)]({'path':_0x123c3e,'content':_0x566766}),_0x46e25a['push']({'path':_0xc20dea,'content':_0xd854ef[_0x118819(0x245)]});if(_0xd854ef[_0x118819(0x1fc)][_0x118819(0x215)]>0x0){_0x46e25a[_0x118819(0x2b3)]({'path':_0x81c2bd,'content':'','isDir':!![]});for(const _0x331160 of _0xd854ef[_0x118819(0x1fc)]){const _0x5b1395=a96_0x268840[_0x118819(0x294)](_0x81c2bd,_0x331160['file_name']);_0x46e25a[_0x118819(0x2b3)]({'path':_0x5b1395,'content':_0x331160['text_content']});}}if(a96_0x44d248[_0x118819(0x1f1)](_0x81c2bd)){const _0x1f4f4e=a96_0x44d248['readdirSync'](_0x81c2bd),_0x5e83aa=new Set(_0xd854ef[_0x118819(0x1fc)][_0x118819(0x277)](_0x31e170=>_0x31e170[_0x118819(0x237)]));for(const _0x1b1032 of _0x1f4f4e){const _0xcc5310=a96_0x268840[_0x118819(0x294)](_0x81c2bd,_0x1b1032);a96_0x44d248[_0x118819(0x2cd)](_0xcc5310)[_0x118819(0x1e8)]()&&!_0x5e83aa[_0x118819(0x279)](_0x1b1032)&&_0x35a9b3[_0x118819(0x2b3)]({'path':_0xcc5310});}}_0x46dd98[_0x118819(0x253)][_0x118819(0x2b3)]({'name':_0x40df59[_0x118819(0x242)][_0x118819(0x289)],'outputPath':_0x1a115a,'isNew':_0x28179a,'hasChanges':_0x121cab,'diff':_0x18ac8e}),_0x46dd98['counts'][_0x118819(0x253)][_0x118819(0x2f2)]++;if(_0x28179a)_0x46dd98[_0x118819(0x28f)]['experimentalArtifacts']['new']++;else{if(_0x121cab)_0x46dd98[_0x118819(0x28f)][_0x118819(0x253)]['updated']++;else _0x46dd98['counts'][_0x118819(0x253)][_0x118819(0x22d)]++;}}if(_0x311f93?.[_0x118819(0x2de)])return _0x46dd98;a96_0x44d248[_0x118819(0x1fd)](_0x176ac5,{'recursive':!![]}),a96_0x44d248['mkdirSync'](getKnowledgeBasesDir(_0x176ac5),{'recursive':!![]}),a96_0x44d248[_0x118819(0x1fd)](getPromptsDir(_0x176ac5),{'recursive':!![]}),a96_0x44d248[_0x118819(0x1fd)](getIntegrationsDir(_0x176ac5),{'recursive':!![]}),a96_0x44d248[_0x118819(0x1fd)](getExperimentalKnowledgeBasesDir(_0x176ac5),{'recursive':!![]}),a96_0x44d248[_0x118819(0x1fd)](getExperimentalArtifactsDir(_0x176ac5),{'recursive':!![]});const _0x42667b=a96_0x268840[_0x118819(0x294)](_0x176ac5,_0x118819(0x232));a96_0x44d248[_0x118819(0x2b5)](_0x42667b,createAgentConfigContent(_0x4e0734));for(const _0x1c7d11 of _0x46e25a){if(_0x1c7d11[_0x118819(0x2ba)])a96_0x44d248[_0x118819(0x1fd)](_0x1c7d11[_0x118819(0x2c1)],{'recursive':!![]});else{const _0x3f0d9c=a96_0x268840[_0x118819(0x29d)](_0x1c7d11[_0x118819(0x2c1)]);!a96_0x44d248[_0x118819(0x1f1)](_0x3f0d9c)&&a96_0x44d248[_0x118819(0x1fd)](_0x3f0d9c,{'recursive':!![]}),a96_0x44d248['writeFileSync'](_0x1c7d11[_0x118819(0x2c1)],_0x1c7d11[_0x118819(0x282)]);}}for(const _0x2d5dd1 of _0x35a9b3){_0x2d5dd1[_0x118819(0x2ba)]?(a96_0x44d248['rmSync'](_0x2d5dd1[_0x118819(0x2c1)],{'recursive':!![],'force':!![]}),this[_0x118819(0x2d8)][_0x118819(0x29b)]('Removed\x20deleted\x20directory:\x20'+a96_0x268840['basename'](a96_0x268840[_0x118819(0x29d)](_0x2d5dd1[_0x118819(0x2c1)]))+'/'+a96_0x268840[_0x118819(0x2e4)](_0x2d5dd1['path']))):(a96_0x44d248['rmSync'](_0x2d5dd1[_0x118819(0x2c1)],{'force':!![]}),this[_0x118819(0x2d8)]['info']('Removed\x20deleted\x20file:\x20'+a96_0x268840[_0x118819(0x2e4)](a96_0x268840[_0x118819(0x29d)](_0x2d5dd1['path']))+'/'+a96_0x268840[_0x118819(0x2e4)](_0x2d5dd1['path'])));}return _0x46dd98;}async[a96_0x50fe1e(0x224)](_0x4d992e,_0x5a6f0f){const _0x67434b=a96_0x50fe1e,_0x20b682=a96_0x268840[_0x67434b(0x294)](_0x4d992e,_0x67434b(0x232));if(!a96_0x44d248['existsSync'](_0x20b682))throw new SDKError(ErrorCode[_0x67434b(0x298)],_0x67434b(0x2dd)+_0x4d992e,undefined,{'helpText':_0x67434b(0x2ec)});const _0x35f7b0=loadAgentConfig(_0x20b682),_0x240068=await this['resolveProjectId'](_0x35f7b0[_0x67434b(0x24e)]),_0x1259bf=await this[_0x67434b(0x24c)][_0x67434b(0x1ef)](_0x240068),_0x460c3d=_0x1259bf[_0x67434b(0x242)][_0x67434b(0x289)],_0x4caf62={'projectName':_0x460c3d,'projectId':_0x240068,'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}}},_0x128004=[],_0x4e64ef=[],_0x20146f=[],_0x58b582=[],_0x57c79a=[],_0x50045e=[],_0x18de35=a96_0x44d248[_0x67434b(0x1ed)](_0x4d992e,{'withFileTypes':!![]});for(const _0x55c875 of _0x18de35){if(!_0x55c875[_0x67434b(0x27b)]())continue;if([_0x67434b(0x267),_0x67434b(0x1f9),_0x67434b(0x2d7),'experimental_knowledge_bases',_0x67434b(0x2af)][_0x67434b(0x233)](_0x55c875[_0x67434b(0x289)]))continue;const _0x21dbf1=a96_0x268840[_0x67434b(0x294)](_0x4d992e,_0x55c875[_0x67434b(0x289)]);if(isAgentDir(_0x21dbf1)){const _0x186366=a96_0x268840[_0x67434b(0x294)](_0x21dbf1,_0x67434b(0x2bb)),_0x3a10ac=a96_0x268840[_0x67434b(0x294)](_0x21dbf1,'prompt.md'),_0x2955f9=a96_0x268840[_0x67434b(0x294)](_0x21dbf1,_0x67434b(0x24d)),_0x55c5d0=parseAgentYaml(a96_0x44d248[_0x67434b(0x225)](_0x186366,_0x67434b(0x1ea)),_0x186366),_0x3dd01e=a96_0x44d248[_0x67434b(0x1f1)](_0x3a10ac)?a96_0x44d248[_0x67434b(0x225)](_0x3a10ac,_0x67434b(0x1ea)):'',_0x11a794=a96_0x44d248['existsSync'](_0x2955f9)?a96_0x44d248[_0x67434b(0x225)](_0x2955f9,_0x67434b(0x1ea)):_0x55c5d0[_0x67434b(0x211)];_0x128004[_0x67434b(0x2b3)]({'name':_0x55c5d0[_0x67434b(0x289)],'dir':_0x21dbf1,'yaml':_0x55c5d0,'systemPrompt':_0x3dd01e,'starterMessage':_0x11a794});}}const _0x4bb5a6=getKnowledgeBasesDir(_0x4d992e);if(a96_0x44d248[_0x67434b(0x1f1)](_0x4bb5a6)){const _0x4cfa66=a96_0x44d248[_0x67434b(0x1ed)](_0x4bb5a6);for(const _0x8dc02e of _0x4cfa66){const _0x40720e=a96_0x268840[_0x67434b(0x294)](_0x4bb5a6,_0x8dc02e);if(_0x8dc02e[_0x67434b(0x216)](_0x67434b(0x1f4))){const _0x53f14b=parseKnowledgeBaseYaml(a96_0x44d248['readFileSync'](_0x40720e,_0x67434b(0x1ea)),_0x40720e);_0x4e64ef[_0x67434b(0x2b3)]({'name':_0x53f14b[_0x67434b(0x289)],'path':_0x40720e,'yaml':_0x53f14b});}else{if(_0x8dc02e[_0x67434b(0x216)]('.md')){const _0x4c396d=a96_0x44d248[_0x67434b(0x225)](_0x40720e,_0x67434b(0x1ea)),{name:_0x455437,text:_0x4e5f15}=parseTextKnowledgeBaseMd(_0x4c396d,_0x8dc02e);_0x20146f['push']({'name':_0x455437,'path':_0x40720e,'text':_0x4e5f15});}}}}const _0x373633=getPromptsDir(_0x4d992e);if(a96_0x44d248['existsSync'](_0x373633)){const _0x18b625=a96_0x44d248[_0x67434b(0x1ed)](_0x373633)[_0x67434b(0x2dc)](_0x259c0e=>_0x259c0e[_0x67434b(0x216)](_0x67434b(0x1f4)));for(const _0x1b1c86 of _0x18b625){const _0x2aab59=a96_0x268840[_0x67434b(0x294)](_0x373633,_0x1b1c86),_0x2da975=parsePromptYaml(a96_0x44d248[_0x67434b(0x225)](_0x2aab59,_0x67434b(0x1ea)),_0x2aab59);_0x58b582['push']({'name':_0x2da975[_0x67434b(0x289)],'path':_0x2aab59,'yaml':_0x2da975});}}const _0xfe9c58=[],_0x41801c=getIntegrationsDir(_0x4d992e);if(a96_0x44d248[_0x67434b(0x1f1)](_0x41801c)){const _0x33e3bc=a96_0x44d248['readdirSync'](_0x41801c)['filter'](_0x17961c=>_0x17961c[_0x67434b(0x216)](_0x67434b(0x1f4)));for(const _0x29a1dc of _0x33e3bc){const _0x5a3d55=a96_0x268840[_0x67434b(0x294)](_0x41801c,_0x29a1dc),_0x113a4a=parseIntegrationYaml(a96_0x44d248[_0x67434b(0x225)](_0x5a3d55,_0x67434b(0x1ea)),_0x5a3d55);if(!SAFE_INTEGRATION_TYPES[_0x67434b(0x233)](_0x113a4a[_0x67434b(0x2a9)][_0x67434b(0x2d9)]())){this[_0x67434b(0x2d8)][_0x67434b(0x27a)](_0x67434b(0x259)+_0x113a4a['name']+_0x67434b(0x2d5)+_0x113a4a[_0x67434b(0x2a9)]+'):\x20'+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES[_0x67434b(0x294)](',\x20')+')\x20can\x20be\x20pushed.\x20')+_0x67434b(0x2c8));continue;}_0xfe9c58[_0x67434b(0x2b3)]({'name':_0x113a4a[_0x67434b(0x289)],'path':_0x5a3d55,'yaml':_0x113a4a});}}const _0x3e2e00=getExperimentalKnowledgeBasesDir(_0x4d992e);if(a96_0x44d248[_0x67434b(0x1f1)](_0x3e2e00)){const _0x574641=a96_0x44d248[_0x67434b(0x1ed)](_0x3e2e00,{'withFileTypes':!![]});for(const _0x4b9ad0 of _0x574641){if(!_0x4b9ad0[_0x67434b(0x27b)]())continue;const _0x3ccfc2=a96_0x268840[_0x67434b(0x294)](_0x3e2e00,_0x4b9ad0[_0x67434b(0x289)]),_0x1f02a3=a96_0x268840[_0x67434b(0x294)](_0x3ccfc2,_0x4b9ad0[_0x67434b(0x289)]+_0x67434b(0x1f4)),_0x4555e7=a96_0x268840[_0x67434b(0x294)](_0x3ccfc2,_0x67434b(0x2f0));if(!a96_0x44d248[_0x67434b(0x1f1)](_0x1f02a3))continue;const _0x3a3843=parseExperimentalKnowledgeBaseYaml(a96_0x44d248['readFileSync'](_0x1f02a3,_0x67434b(0x1ea)),_0x1f02a3),_0x52b274=[];if(a96_0x44d248['existsSync'](_0x4555e7)){const _0xa3dc26=a96_0x44d248[_0x67434b(0x1ed)](_0x4555e7,{'withFileTypes':!![]});for(const _0x4e574b of _0xa3dc26){if(!_0x4e574b[_0x67434b(0x27b)]())continue;const _0x471dde=a96_0x268840[_0x67434b(0x294)](_0x4555e7,_0x4e574b[_0x67434b(0x289)]),_0x588073=a96_0x268840['join'](_0x471dde,'code.js'),_0x4ed931=a96_0x268840[_0x67434b(0x294)](_0x471dde,_0x67434b(0x278));a96_0x44d248['existsSync'](_0x588073)&&a96_0x44d248[_0x67434b(0x1f1)](_0x4ed931)&&_0x52b274[_0x67434b(0x2b3)]({'name':_0x4e574b[_0x67434b(0x289)],'code':a96_0x44d248[_0x67434b(0x225)](_0x588073,'utf-8'),'json_schema':a96_0x44d248['readFileSync'](_0x4ed931,'utf-8')});}}const _0x196522={..._0x3a3843,'variables':_0x3a3843['variables']||[],'functions':_0x52b274};_0x57c79a[_0x67434b(0x2b3)]({'name':_0x3a3843['name'],'dir':_0x3ccfc2,'def':_0x196522});}}const _0x4c5671=getExperimentalArtifactsDir(_0x4d992e);if(a96_0x44d248[_0x67434b(0x1f1)](_0x4c5671)){const _0x51cc06=a96_0x44d248[_0x67434b(0x1ed)](_0x4c5671,{'withFileTypes':!![]});for(const _0x11e4c2 of _0x51cc06){if(!_0x11e4c2[_0x67434b(0x27b)]())continue;const _0x4d8ac0=a96_0x268840['join'](_0x4c5671,_0x11e4c2[_0x67434b(0x289)]),_0x3562cb=a96_0x268840['join'](_0x4d8ac0,_0x11e4c2['name']+_0x67434b(0x1f4)),_0x240069=a96_0x268840[_0x67434b(0x294)](_0x4d8ac0,_0x67434b(0x227)),_0x923d8b=a96_0x268840[_0x67434b(0x294)](_0x4d8ac0,_0x67434b(0x1fc));if(!a96_0x44d248['existsSync'](_0x3562cb)||!a96_0x44d248[_0x67434b(0x1f1)](_0x240069))continue;const _0x3a1410=parseExperimentalArtifactYaml(a96_0x44d248[_0x67434b(0x225)](_0x3562cb,_0x67434b(0x1ea)),_0x3562cb),_0x6317d=a96_0x44d248['readFileSync'](_0x240069,_0x67434b(0x1ea)),_0x21f492=[];if(a96_0x44d248[_0x67434b(0x1f1)](_0x923d8b)){const _0x350aeb=a96_0x44d248['readdirSync'](_0x923d8b);for(const _0x4a7cb4 of _0x350aeb){const _0x42ee2f=a96_0x268840['join'](_0x923d8b,_0x4a7cb4);a96_0x44d248[_0x67434b(0x2cd)](_0x42ee2f)[_0x67434b(0x1e8)]()&&_0x21f492[_0x67434b(0x2b3)]({'file_name':_0x4a7cb4,'text_content':a96_0x44d248[_0x67434b(0x225)](_0x42ee2f,_0x67434b(0x1ea))});}}const _0x1f7989={..._0x3a1410,'code':_0x6317d,'files':_0x21f492};_0x50045e[_0x67434b(0x2b3)]({'name':_0x3a1410[_0x67434b(0x289)],'dir':_0x4d8ac0,'def':_0x1f7989});}}const _0x218027=await this[_0x67434b(0x24c)][_0x67434b(0x280)](_0x240068),_0x4102e1=await this['client']['listKnowledgeBases'](_0x240068),_0xa252f=await this[_0x67434b(0x24c)]['listTextKnowledgeBases'](_0x240068),_0x2858c1=await this['client'][_0x67434b(0x29e)](_0x240068),_0x4eb749=await this['client'][_0x67434b(0x29a)](_0x240068),_0x6d2fad=await this[_0x67434b(0x24c)][_0x67434b(0x229)](_0x240068),_0x1b62e9=await this[_0x67434b(0x24c)][_0x67434b(0x252)](_0x240068),_0x4b3394=await this[_0x67434b(0x24c)][_0x67434b(0x246)](_0x240068),_0xfd42a0=await this[_0x67434b(0x24c)][_0x67434b(0x214)](_0x240068),_0x22e216=await this[_0x67434b(0x24c)][_0x67434b(0x228)](_0x240068),_0x260c7d=new Map(),_0x3c79ea=new Map(),_0x524104=new Map(),_0x49f73e=new Map(),_0x3f394d=new Map(),_0x53142e=new Map(),_0x2c4cfa=new Map();for(const _0x2b0f6f of _0x218027){_0x260c7d[_0x67434b(0x1e9)](_0x2b0f6f[_0x67434b(0x242)][_0x67434b(0x289)],_0x2b0f6f);}for(const _0xdd205e of _0x4102e1){_0x3c79ea[_0x67434b(0x1e9)](_0xdd205e[_0x67434b(0x242)][_0x67434b(0x289)],_0xdd205e);}for(const _0x5249c1 of _0xa252f){_0x524104[_0x67434b(0x1e9)](_0x5249c1[_0x67434b(0x242)][_0x67434b(0x289)],_0x5249c1);}for(const _0x4df7df of _0x6d2fad){_0x49f73e[_0x67434b(0x1e9)](_0x4df7df['attributes'][_0x67434b(0x289)],_0x4df7df);}for(const _0x343d05 of _0x1b62e9){_0x3f394d[_0x67434b(0x1e9)](_0x343d05[_0x67434b(0x242)][_0x67434b(0x26d)][_0x67434b(0x2d9)](),_0x343d05);}for(const _0x3dcd72 of _0xfd42a0){_0x53142e[_0x67434b(0x1e9)](_0x3dcd72['attributes'][_0x67434b(0x289)],_0x3dcd72);}for(const _0x1856e6 of _0x22e216){_0x2c4cfa[_0x67434b(0x1e9)](_0x1856e6['attributes'][_0x67434b(0x289)],_0x1856e6);}const _0x33aa08=new Map(),_0x4c7793=new Map(),_0x20fcce=new Map(),_0xa9b15a=new Map(),_0x45e6e0=new Map(),_0x249f20=new Map(),_0x1ca88c=new Map(),_0x35abd3=new Map(),_0x22d492=new Map(),_0x3063c3=new Map(),_0x348fe6=new Map(),_0x7e0a45=new Map(),_0x25b5db=new Map(),_0x4b7f67=new Map(),_0x24a63d=new Map(),_0x7f527b=new Map();for(const _0x56a03b of _0x4102e1){_0x33aa08[_0x67434b(0x1e9)](_0x56a03b[_0x67434b(0x242)]['name'],_0x56a03b['id']),_0x22d492[_0x67434b(0x1e9)](_0x56a03b['id'],_0x56a03b[_0x67434b(0x242)][_0x67434b(0x289)]);}for(const _0xd8e3a0 of _0xa252f){_0x4c7793[_0x67434b(0x1e9)](_0xd8e3a0[_0x67434b(0x242)][_0x67434b(0x289)],_0xd8e3a0['id']),_0x3063c3['set'](_0xd8e3a0['id'],_0xd8e3a0[_0x67434b(0x242)][_0x67434b(0x289)]);}for(const _0x494147 of _0x218027){_0x20fcce[_0x67434b(0x1e9)](_0x494147[_0x67434b(0x242)][_0x67434b(0x289)],_0x494147['id']),_0x348fe6[_0x67434b(0x1e9)](_0x494147['id'],_0x494147[_0x67434b(0x242)][_0x67434b(0x289)]);}for(const _0x137f2e of _0x2858c1){_0xa9b15a[_0x67434b(0x1e9)](_0x137f2e['attributes'][_0x67434b(0x289)],_0x137f2e['id']),_0x7e0a45[_0x67434b(0x1e9)](_0x137f2e['id'],_0x137f2e['attributes'][_0x67434b(0x289)]);}for(const _0xa4a2c3 of _0x4eb749){_0x45e6e0[_0x67434b(0x1e9)](_0xa4a2c3[_0x67434b(0x242)][_0x67434b(0x289)],_0xa4a2c3['id']),_0x25b5db[_0x67434b(0x1e9)](_0xa4a2c3['id'],_0xa4a2c3[_0x67434b(0x242)][_0x67434b(0x289)]);}for(const _0x3e38cf of _0x6d2fad){_0x249f20[_0x67434b(0x1e9)](_0x3e38cf[_0x67434b(0x242)]['name'],_0x3e38cf['id']),_0x4b7f67[_0x67434b(0x1e9)](_0x3e38cf['id'],_0x3e38cf['attributes'][_0x67434b(0x289)]);}for(const _0x517af5 of _0xfd42a0){_0x1ca88c[_0x67434b(0x1e9)](_0x517af5[_0x67434b(0x242)][_0x67434b(0x289)],_0x517af5['id']),_0x24a63d[_0x67434b(0x1e9)](_0x517af5['id'],_0x517af5[_0x67434b(0x242)][_0x67434b(0x289)]);}for(const _0x25f7ba of _0x22e216){_0x35abd3['set'](_0x25f7ba['attributes'][_0x67434b(0x289)],_0x25f7ba['id']),_0x7f527b[_0x67434b(0x1e9)](_0x25f7ba['id'],_0x25f7ba[_0x67434b(0x242)]['name']);}const _0x33fd2e={'resolveKnowledgeBaseName':async _0x43dc3f=>_0x22d492[_0x67434b(0x20c)](_0x43dc3f),'resolveTextKnowledgeBaseName':async _0x251114=>_0x3063c3[_0x67434b(0x20c)](_0x251114),'resolveAgentName':async _0x2991c9=>_0x348fe6[_0x67434b(0x20c)](_0x2991c9),'resolveWebSearchToolName':async _0x5c6dda=>_0x25b5db[_0x67434b(0x20c)](_0x5c6dda),'resolveImageGeneratorName':async _0x10046d=>_0x7e0a45[_0x67434b(0x20c)](_0x10046d),'resolvePromptName':async _0x155b2d=>_0x4b7f67['get'](_0x155b2d),'resolveExperimentalKnowledgeBaseName':async _0xdb6579=>_0x24a63d['get'](_0xdb6579),'onWarning':_0x3f02e5=>this[_0x67434b(0x2d8)][_0x67434b(0x27a)](_0x3f02e5)};let _0x529603=[];const _0xf0c15c={'projectId':_0x240068,'resolveKnowledgeBaseId':async _0x459c58=>_0x33aa08['get'](_0x459c58),'resolveTextKnowledgeBaseId':async _0xe02332=>_0x4c7793[_0x67434b(0x20c)](_0xe02332),'resolveAgentId':async _0x115f70=>_0x20fcce[_0x67434b(0x20c)](_0x115f70),'resolveWebSearchToolId':async _0x5f2d4d=>_0x45e6e0[_0x67434b(0x20c)](_0x5f2d4d),'resolveImageGeneratorId':async _0x1794fa=>_0xa9b15a['get'](_0x1794fa),'resolvePromptId':async _0x24e224=>_0x249f20[_0x67434b(0x20c)](_0x24e224),'resolveParentSegmentKBId':async()=>_0x4b3394?.['id'],'resolveExperimentalKnowledgeBaseId':async _0x12a9ff=>_0x1ca88c[_0x67434b(0x20c)](_0x12a9ff),'onWarning':_0x2e0f99=>{const _0x457f66=_0x67434b;this[_0x457f66(0x2d8)][_0x457f66(0x27a)](_0x2e0f99),_0x529603[_0x457f66(0x2b3)](_0x2e0f99);}},{resolved:_0x371051,unresolved:_0x84baee}=resolveAgentDependencies(_0x128004,new Set(_0x260c7d['keys']()));for(const {agent:_0x79733e,missingDeps:_0x3323c2}of _0x84baee){_0x4caf62[_0x67434b(0x2ca)][_0x67434b(0x2b3)]({'agentName':_0x79733e[_0x67434b(0x2b2)][_0x67434b(0x289)],'action':_0x67434b(0x256),'error':'Unresolved\x20dependencies:\x20'+_0x3323c2[_0x67434b(0x294)](',\x20')+'.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.'}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x2ca)]['errors']++;}for(const _0x3eb68e of _0x4e64ef){const _0x53c015=_0x3c79ea['get'](_0x3eb68e['yaml'][_0x67434b(0x289)]),_0x993ce6=a96_0x44d248[_0x67434b(0x225)](_0x3eb68e[_0x67434b(0x2c1)],'utf-8');if(_0x53c015){const _0x1e5c68=apiKnowledgeBaseToYaml(_0x53c015),_0x48e38e=toKnowledgeBaseYamlString(_0x1e5c68),_0x29a680=generateDiff(_0x48e38e,_0x993ce6),_0x16b651=hasChanges(_0x29a680);_0x16b651?(_0x4caf62[_0x67434b(0x2a3)]['push']({'name':_0x3eb68e['yaml'][_0x67434b(0x289)],'action':_0x67434b(0x2ce),'id':_0x53c015['id'],'diff':formatDiffWithColors(_0x29a680)}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x2a3)][_0x67434b(0x2ce)]++):(_0x4caf62[_0x67434b(0x2a3)][_0x67434b(0x2b3)]({'name':_0x3eb68e[_0x67434b(0x2b2)]['name'],'action':_0x67434b(0x22d),'id':_0x53c015['id']}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x2a3)][_0x67434b(0x22d)]++);}else _0x4caf62[_0x67434b(0x2a3)][_0x67434b(0x2b3)]({'name':_0x3eb68e[_0x67434b(0x2b2)][_0x67434b(0x289)],'action':'created'}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x2a3)]['created']++;}for(const _0x3e85b9 of _0x20146f){const _0x582c21=_0x524104[_0x67434b(0x20c)](_0x3e85b9[_0x67434b(0x289)]),_0x1386ec=a96_0x44d248['readFileSync'](_0x3e85b9[_0x67434b(0x2c1)],_0x67434b(0x1ea));if(_0x582c21){const _0x4bc5c5=toTextKnowledgeBaseMd(_0x582c21[_0x67434b(0x242)][_0x67434b(0x289)],_0x582c21[_0x67434b(0x242)][_0x67434b(0x202)]),_0x29283a=generateDiff(_0x4bc5c5,_0x1386ec),_0x3bd421=hasChanges(_0x29283a);_0x3bd421?(_0x4caf62[_0x67434b(0x2bc)]['push']({'name':_0x3e85b9[_0x67434b(0x289)],'action':_0x67434b(0x2ce),'id':_0x582c21['id'],'diff':formatDiffWithColors(_0x29283a)}),_0x4caf62['counts'][_0x67434b(0x2bc)][_0x67434b(0x2ce)]++):(_0x4caf62['textKnowledgeBases'][_0x67434b(0x2b3)]({'name':_0x3e85b9[_0x67434b(0x289)],'action':_0x67434b(0x22d),'id':_0x582c21['id']}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x2bc)][_0x67434b(0x22d)]++);}else _0x4caf62[_0x67434b(0x2bc)][_0x67434b(0x2b3)]({'name':_0x3e85b9[_0x67434b(0x289)],'action':'created'}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x2bc)][_0x67434b(0x26c)]++;}for(const _0x588a21 of _0x371051){const _0x2b2781=_0x260c7d[_0x67434b(0x20c)](_0x588a21['yaml']['name']),_0x3a4e7c=a96_0x268840[_0x67434b(0x294)](_0x588a21['dir'],_0x67434b(0x2bb)),_0x21fe3f=a96_0x44d248['readFileSync'](_0x3a4e7c,_0x67434b(0x1ea)),_0x148796=_0x588a21[_0x67434b(0x239)],_0x1cbe9f=_0x67434b(0x1f0)+_0x148796+_0x67434b(0x272)+_0x21fe3f;if(_0x2b2781){const {yaml:_0x5caf74,systemPrompt:_0x33e41e}=await agentResponseToDef(_0x2b2781,_0x33fd2e),_0x32b160=toAgentYamlString(_0x5caf74),_0x185d28=_0x67434b(0x1f0)+_0x33e41e+_0x67434b(0x272)+_0x32b160,_0x3e9478=generateDiff(_0x185d28,_0x1cbe9f),_0x7b89e0=hasChanges(_0x3e9478);_0x7b89e0?(_0x4caf62[_0x67434b(0x2ca)][_0x67434b(0x2b3)]({'agentName':_0x588a21[_0x67434b(0x2b2)][_0x67434b(0x289)],'action':_0x67434b(0x2ce),'agentId':_0x2b2781['id'],'diff':formatDiffWithColors(_0x3e9478)}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x2ca)][_0x67434b(0x2ce)]++):(_0x4caf62[_0x67434b(0x2ca)][_0x67434b(0x2b3)]({'agentName':_0x588a21[_0x67434b(0x2b2)][_0x67434b(0x289)],'action':'unchanged','agentId':_0x2b2781['id']}),_0x4caf62[_0x67434b(0x28f)]['agents']['unchanged']++);}else _0x4caf62[_0x67434b(0x2ca)][_0x67434b(0x2b3)]({'agentName':_0x588a21['yaml'][_0x67434b(0x289)],'action':_0x67434b(0x26c)}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x2ca)][_0x67434b(0x26c)]++;}for(const _0x36313f of _0x58b582){const _0x584717=_0x49f73e[_0x67434b(0x20c)](_0x36313f[_0x67434b(0x2b2)][_0x67434b(0x289)]),_0x305595=a96_0x44d248['readFileSync'](_0x36313f[_0x67434b(0x2c1)],_0x67434b(0x1ea));if(_0x584717){const _0x493220=await apiPromptToYaml(_0x584717,_0x33fd2e);if(!_0x493220){_0x4caf62[_0x67434b(0x1f9)][_0x67434b(0x2b3)]({'name':_0x36313f[_0x67434b(0x2b2)][_0x67434b(0x289)],'action':_0x67434b(0x2ce),'id':_0x584717['id']}),_0x4caf62['counts'][_0x67434b(0x1f9)]['updated']++;continue;}const _0x4d559c=toPromptYamlString(_0x493220),_0x65a9=generateDiff(_0x4d559c,_0x305595),_0x1a2f2a=hasChanges(_0x65a9);_0x1a2f2a?(_0x4caf62['prompts']['push']({'name':_0x36313f['yaml']['name'],'action':'updated','id':_0x584717['id'],'diff':formatDiffWithColors(_0x65a9)}),_0x4caf62[_0x67434b(0x28f)]['prompts'][_0x67434b(0x2ce)]++):(_0x4caf62[_0x67434b(0x1f9)][_0x67434b(0x2b3)]({'name':_0x36313f[_0x67434b(0x2b2)][_0x67434b(0x289)],'action':'unchanged','id':_0x584717['id']}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x1f9)][_0x67434b(0x22d)]++);}else _0x4caf62['prompts'][_0x67434b(0x2b3)]({'name':_0x36313f[_0x67434b(0x2b2)]['name'],'action':_0x67434b(0x26c)}),_0x4caf62['counts']['prompts'][_0x67434b(0x26c)]++;}for(const _0x56eb58 of _0xfe9c58){const _0x4104ae=_0x3f394d[_0x67434b(0x20c)](_0x56eb58[_0x67434b(0x2b2)][_0x67434b(0x2a9)]),_0x204265=a96_0x44d248[_0x67434b(0x225)](_0x56eb58['path'],_0x67434b(0x1ea));if(_0x4104ae){const _0x21ac87=await apiIntegrationToYaml(_0x4104ae,_0x33fd2e),_0x55e2ff=toIntegrationYamlString(_0x21ac87),_0x5b7571=generateDiff(_0x55e2ff,_0x204265),_0x584024=hasChanges(_0x5b7571);_0x584024?(_0x4caf62[_0x67434b(0x2d7)][_0x67434b(0x2b3)]({'name':_0x56eb58[_0x67434b(0x2b2)][_0x67434b(0x2a9)],'action':_0x67434b(0x2ce),'id':_0x4104ae['id'],'diff':formatDiffWithColors(_0x5b7571)}),_0x4caf62[_0x67434b(0x28f)]['integrations'][_0x67434b(0x2ce)]++):(_0x4caf62[_0x67434b(0x2d7)][_0x67434b(0x2b3)]({'name':_0x56eb58[_0x67434b(0x2b2)][_0x67434b(0x2a9)],'action':_0x67434b(0x22d),'id':_0x4104ae['id']}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x2d7)][_0x67434b(0x22d)]++);}else _0x4caf62[_0x67434b(0x2d7)][_0x67434b(0x2b3)]({'name':_0x56eb58[_0x67434b(0x2b2)][_0x67434b(0x2a9)],'action':_0x67434b(0x26c)}),_0x4caf62['counts']['integrations'][_0x67434b(0x26c)]++;}for(const _0x15af21 of _0x57c79a){const _0xe49b12=_0x53142e[_0x67434b(0x20c)](_0x15af21[_0x67434b(0x291)][_0x67434b(0x289)]),_0x184613=toExperimentalKnowledgeBaseYamlString(_0x15af21[_0x67434b(0x291)]);let _0x1ef0d9=_0x184613;for(const _0xc13077 of _0x15af21[_0x67434b(0x291)][_0x67434b(0x2f0)]){_0x1ef0d9+=_0x67434b(0x230)+_0xc13077[_0x67434b(0x289)]+'\x20---\x0a'+_0xc13077[_0x67434b(0x245)]+_0x67434b(0x26b)+_0xc13077[_0x67434b(0x289)]+'\x20---\x0a'+_0xc13077[_0x67434b(0x226)]+'\x0a';}if(_0xe49b12){const _0x3f284e=apiExperimentalKnowledgeBaseToYaml(_0xe49b12),_0x353381=toExperimentalKnowledgeBaseYamlString(_0x3f284e);let _0x5ebc97=_0x353381;for(const _0x5f0b92 of _0x3f284e[_0x67434b(0x2f0)]){_0x5ebc97+='\x0a---\x20function:\x20'+_0x5f0b92[_0x67434b(0x289)]+_0x67434b(0x2ad)+_0x5f0b92[_0x67434b(0x245)]+_0x67434b(0x26b)+_0x5f0b92['name']+_0x67434b(0x2ad)+_0x5f0b92[_0x67434b(0x226)]+'\x0a';}const _0x13bea6=generateDiff(_0x5ebc97,_0x1ef0d9),_0x27622d=hasChanges(_0x13bea6);_0x27622d?(_0x4caf62[_0x67434b(0x207)][_0x67434b(0x2b3)]({'name':_0x15af21[_0x67434b(0x291)][_0x67434b(0x289)],'action':'updated','id':_0xe49b12['id'],'diff':formatDiffWithColors(_0x13bea6)}),_0x4caf62[_0x67434b(0x28f)]['experimentalKnowledgeBases'][_0x67434b(0x2ce)]++):(_0x4caf62['experimentalKnowledgeBases']['push']({'name':_0x15af21[_0x67434b(0x291)]['name'],'action':_0x67434b(0x22d),'id':_0xe49b12['id']}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x207)][_0x67434b(0x22d)]++);}else _0x4caf62['experimentalKnowledgeBases'][_0x67434b(0x2b3)]({'name':_0x15af21[_0x67434b(0x291)][_0x67434b(0x289)],'action':'created'}),_0x4caf62['counts']['experimentalKnowledgeBases'][_0x67434b(0x26c)]++;}for(const _0x556d52 of _0x50045e){const _0x1e1b7b=_0x2c4cfa[_0x67434b(0x20c)](_0x556d52[_0x67434b(0x291)][_0x67434b(0x289)]),_0x3859da=toExperimentalArtifactYamlString(_0x556d52[_0x67434b(0x291)]);let _0x1a1213=_0x3859da+('\x0a---\x20code\x20---\x0a'+_0x556d52[_0x67434b(0x291)][_0x67434b(0x245)]+'\x0a');for(const _0x1a7e3a of _0x556d52[_0x67434b(0x291)]['files']){_0x1a1213+='---\x20file:\x20'+_0x1a7e3a[_0x67434b(0x237)]+_0x67434b(0x2ad)+_0x1a7e3a[_0x67434b(0x248)]+'\x0a';}if(_0x1e1b7b){const _0x585c14=apiExperimentalArtifactToYaml(_0x1e1b7b),_0x39484d=toExperimentalArtifactYamlString(_0x585c14);let _0x1772a9=_0x39484d+(_0x67434b(0x1ee)+_0x585c14['code']+'\x0a');for(const _0x2a94cb of _0x585c14[_0x67434b(0x1fc)]){_0x1772a9+=_0x67434b(0x219)+_0x2a94cb[_0x67434b(0x237)]+'\x20---\x0a'+_0x2a94cb[_0x67434b(0x248)]+'\x0a';}const _0x33a2c8=generateDiff(_0x1772a9,_0x1a1213),_0x2d32b0=hasChanges(_0x33a2c8);_0x2d32b0?(_0x4caf62[_0x67434b(0x253)][_0x67434b(0x2b3)]({'name':_0x556d52[_0x67434b(0x291)][_0x67434b(0x289)],'action':'updated','id':_0x1e1b7b['id'],'diff':formatDiffWithColors(_0x33a2c8)}),_0x4caf62['counts']['experimentalArtifacts'][_0x67434b(0x2ce)]++):(_0x4caf62[_0x67434b(0x253)]['push']({'name':_0x556d52[_0x67434b(0x291)]['name'],'action':_0x67434b(0x22d),'id':_0x1e1b7b['id']}),_0x4caf62['counts']['experimentalArtifacts']['unchanged']++);}else _0x4caf62['experimentalArtifacts'][_0x67434b(0x2b3)]({'name':_0x556d52['def'][_0x67434b(0x289)],'action':'created'}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x253)][_0x67434b(0x26c)]++;}if(_0x5a6f0f?.[_0x67434b(0x2de)])return _0x4caf62;_0x4caf62[_0x67434b(0x2a3)]=[],_0x4caf62[_0x67434b(0x2bc)]=[],_0x4caf62[_0x67434b(0x1f9)]=[],_0x4caf62[_0x67434b(0x2d7)]=[],_0x4caf62[_0x67434b(0x207)]=[],_0x4caf62[_0x67434b(0x253)]=[];const _0x2690c4=_0x4caf62[_0x67434b(0x2ca)][_0x67434b(0x2dc)](_0x40fb7b=>_0x40fb7b['action']==='error');_0x4caf62[_0x67434b(0x2ca)]=_0x2690c4,_0x4caf62['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x2690c4[_0x67434b(0x215)]},'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 _0x18290d of _0x4e64ef){try{const _0x4f9e15=_0x3c79ea['get'](_0x18290d[_0x67434b(0x2b2)][_0x67434b(0x289)]),_0x3ddbcb=yamlKnowledgeBaseToApi(_0x18290d[_0x67434b(0x2b2)],_0x240068);if(_0x4f9e15)await this[_0x67434b(0x24c)]['updateKnowledgeBase'](_0x4f9e15['id'],_0x3ddbcb),_0x33aa08[_0x67434b(0x1e9)](_0x18290d[_0x67434b(0x2b2)][_0x67434b(0x289)],_0x4f9e15['id']),_0x4caf62[_0x67434b(0x2a3)][_0x67434b(0x2b3)]({'name':_0x18290d[_0x67434b(0x2b2)][_0x67434b(0x289)],'action':'updated','id':_0x4f9e15['id']}),_0x4caf62[_0x67434b(0x28f)]['knowledgeBases'][_0x67434b(0x2ce)]++;else{const _0x5407f8=await this[_0x67434b(0x24c)]['createKnowledgeBase'](_0x3ddbcb);_0x33aa08['set'](_0x18290d[_0x67434b(0x2b2)][_0x67434b(0x289)],_0x5407f8['id']),_0x4caf62[_0x67434b(0x2a3)][_0x67434b(0x2b3)]({'name':_0x18290d['yaml'][_0x67434b(0x289)],'action':_0x67434b(0x26c),'id':_0x5407f8['id']}),_0x4caf62['counts']['knowledgeBases'][_0x67434b(0x26c)]++;}}catch(_0x2f952d){_0x4caf62[_0x67434b(0x2a3)]['push']({'name':_0x18290d[_0x67434b(0x2b2)][_0x67434b(0x289)],'action':'error','error':_0x2f952d[_0x67434b(0x261)]}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x2a3)][_0x67434b(0x1f8)]++;}}for(const _0x4913b7 of _0x20146f){try{const _0x208df8=_0x524104[_0x67434b(0x20c)](_0x4913b7['name']),_0x93731c=yamlTextKnowledgeBaseToApi({'name':_0x4913b7[_0x67434b(0x289)],'text':_0x4913b7[_0x67434b(0x202)]},_0x240068);if(_0x208df8)await this[_0x67434b(0x24c)][_0x67434b(0x25c)](_0x208df8['id'],_0x93731c),_0x4c7793[_0x67434b(0x1e9)](_0x4913b7[_0x67434b(0x289)],_0x208df8['id']),_0x4caf62[_0x67434b(0x2bc)]['push']({'name':_0x4913b7[_0x67434b(0x289)],'action':_0x67434b(0x2ce),'id':_0x208df8['id']}),_0x4caf62[_0x67434b(0x28f)]['textKnowledgeBases'][_0x67434b(0x2ce)]++;else{const _0x28c02c=await this['client'][_0x67434b(0x2d2)](_0x93731c);_0x4c7793['set'](_0x4913b7[_0x67434b(0x289)],_0x28c02c['id']),_0x4caf62[_0x67434b(0x2bc)]['push']({'name':_0x4913b7['name'],'action':_0x67434b(0x26c),'id':_0x28c02c['id']}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x2bc)][_0x67434b(0x26c)]++;}}catch(_0x267127){_0x4caf62['textKnowledgeBases'][_0x67434b(0x2b3)]({'name':_0x4913b7[_0x67434b(0x289)],'action':'error','error':_0x267127[_0x67434b(0x261)]}),_0x4caf62['counts'][_0x67434b(0x2bc)]['errors']++;}}for(const _0xd6f024 of _0x57c79a){try{const _0xe3ecd1=_0x53142e[_0x67434b(0x20c)](_0xd6f024[_0x67434b(0x291)][_0x67434b(0x289)]),_0x203424=yamlExperimentalKnowledgeBaseToApi(_0xd6f024['def'],_0x240068);if(_0xe3ecd1)await this[_0x67434b(0x24c)][_0x67434b(0x2e7)](_0xe3ecd1['id'],_0x203424),_0x1ca88c[_0x67434b(0x1e9)](_0xd6f024[_0x67434b(0x291)][_0x67434b(0x289)],_0xe3ecd1['id']),_0x4caf62[_0x67434b(0x207)][_0x67434b(0x2b3)]({'name':_0xd6f024[_0x67434b(0x291)][_0x67434b(0x289)],'action':_0x67434b(0x2ce),'id':_0xe3ecd1['id']}),_0x4caf62['counts'][_0x67434b(0x207)][_0x67434b(0x2ce)]++;else{const _0x24d3e3=await this['client'][_0x67434b(0x2ae)](_0x203424);_0x1ca88c[_0x67434b(0x1e9)](_0xd6f024[_0x67434b(0x291)][_0x67434b(0x289)],_0x24d3e3['id']),_0x4caf62[_0x67434b(0x207)][_0x67434b(0x2b3)]({'name':_0xd6f024['def'][_0x67434b(0x289)],'action':_0x67434b(0x26c),'id':_0x24d3e3['id']}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x207)][_0x67434b(0x26c)]++;}}catch(_0x5bf49f){_0x4caf62[_0x67434b(0x207)]['push']({'name':_0xd6f024[_0x67434b(0x291)][_0x67434b(0x289)],'action':_0x67434b(0x256),'error':_0x5bf49f[_0x67434b(0x261)]}),_0x4caf62['counts']['experimentalKnowledgeBases'][_0x67434b(0x1f8)]++;}}for(const _0x2ee6f9 of _0x50045e){try{const _0x47624b=_0x2c4cfa[_0x67434b(0x20c)](_0x2ee6f9['def'][_0x67434b(0x289)]),_0x467c69=yamlExperimentalArtifactToApi(_0x2ee6f9['def'],_0x240068);if(_0x47624b)await this['client'][_0x67434b(0x223)](_0x47624b['id'],_0x467c69),_0x35abd3[_0x67434b(0x1e9)](_0x2ee6f9[_0x67434b(0x291)][_0x67434b(0x289)],_0x47624b['id']),_0x4caf62[_0x67434b(0x253)][_0x67434b(0x2b3)]({'name':_0x2ee6f9[_0x67434b(0x291)][_0x67434b(0x289)],'action':_0x67434b(0x2ce),'id':_0x47624b['id']}),_0x4caf62[_0x67434b(0x28f)]['experimentalArtifacts']['updated']++;else{const _0x33d19f=await this[_0x67434b(0x24c)][_0x67434b(0x2d1)](_0x467c69);_0x35abd3[_0x67434b(0x1e9)](_0x2ee6f9[_0x67434b(0x291)]['name'],_0x33d19f['id']),_0x4caf62[_0x67434b(0x253)]['push']({'name':_0x2ee6f9[_0x67434b(0x291)][_0x67434b(0x289)],'action':'created','id':_0x33d19f['id']}),_0x4caf62[_0x67434b(0x28f)]['experimentalArtifacts'][_0x67434b(0x26c)]++;}}catch(_0x3175be){_0x4caf62[_0x67434b(0x253)][_0x67434b(0x2b3)]({'name':_0x2ee6f9[_0x67434b(0x291)]['name'],'action':_0x67434b(0x256),'error':_0x3175be[_0x67434b(0x261)]}),_0x4caf62[_0x67434b(0x28f)]['experimentalArtifacts']['errors']++;}}for(const _0x1091a0 of _0x371051){_0x529603=[];try{const _0xce1acf=_0x260c7d['get'](_0x1091a0['yaml'][_0x67434b(0x289)]),_0x178a08=await agentDefToRequest(_0x1091a0[_0x67434b(0x2b2)],_0x1091a0[_0x67434b(0x239)],_0x1091a0[_0x67434b(0x283)],_0xf0c15c);if(_0xce1acf)await this[_0x67434b(0x24c)][_0x67434b(0x274)](_0xce1acf['id'],_0x178a08),_0x20fcce[_0x67434b(0x1e9)](_0x1091a0['yaml']['name'],_0xce1acf['id']),_0x4caf62[_0x67434b(0x2ca)]['push']({'agentName':_0x1091a0[_0x67434b(0x2b2)][_0x67434b(0x289)],'action':_0x67434b(0x2ce),'agentId':_0xce1acf['id'],'warnings':_0x529603['length']>0x0?_0x529603:undefined}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x2ca)][_0x67434b(0x2ce)]++;else{const _0x1a9f5a=await this[_0x67434b(0x24c)][_0x67434b(0x2d0)](_0x178a08);_0x20fcce[_0x67434b(0x1e9)](_0x1091a0[_0x67434b(0x2b2)]['name'],_0x1a9f5a['id']),_0x4caf62['agents'][_0x67434b(0x2b3)]({'agentName':_0x1091a0[_0x67434b(0x2b2)][_0x67434b(0x289)],'action':_0x67434b(0x26c),'agentId':_0x1a9f5a['id'],'warnings':_0x529603[_0x67434b(0x215)]>0x0?_0x529603:undefined}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x2ca)][_0x67434b(0x26c)]++;}}catch(_0x331fe3){_0x4caf62['agents']['push']({'agentName':_0x1091a0[_0x67434b(0x2b2)][_0x67434b(0x289)],'action':'error','error':_0x331fe3[_0x67434b(0x261)],'warnings':_0x529603[_0x67434b(0x215)]>0x0?_0x529603:undefined}),_0x4caf62['counts']['agents'][_0x67434b(0x1f8)]++;}}for(const _0x350ed2 of _0x58b582){try{const _0x1651f0=_0x49f73e[_0x67434b(0x20c)](_0x350ed2['yaml'][_0x67434b(0x289)]),_0x14d619=await yamlPromptToApi(_0x350ed2[_0x67434b(0x2b2)],_0x240068,_0xf0c15c);if(!_0x14d619){_0x4caf62[_0x67434b(0x1f9)][_0x67434b(0x2b3)]({'name':_0x350ed2[_0x67434b(0x2b2)][_0x67434b(0x289)],'action':_0x67434b(0x256),'error':'Agent\x20reference\x20not\x20found'}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x1f9)][_0x67434b(0x1f8)]++;continue;}if(_0x1651f0)await this['client'][_0x67434b(0x21d)](_0x1651f0['id'],_0x14d619),_0x249f20['set'](_0x350ed2['yaml'][_0x67434b(0x289)],_0x1651f0['id']),_0x4caf62[_0x67434b(0x1f9)]['push']({'name':_0x350ed2[_0x67434b(0x2b2)][_0x67434b(0x289)],'action':_0x67434b(0x2ce),'id':_0x1651f0['id']}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x1f9)][_0x67434b(0x2ce)]++;else{const _0x11a5e9=await this['client'][_0x67434b(0x2e5)](_0x14d619);_0x249f20[_0x67434b(0x1e9)](_0x350ed2[_0x67434b(0x2b2)][_0x67434b(0x289)],_0x11a5e9['id']),_0x4caf62[_0x67434b(0x1f9)][_0x67434b(0x2b3)]({'name':_0x350ed2[_0x67434b(0x2b2)]['name'],'action':_0x67434b(0x26c),'id':_0x11a5e9['id']}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x1f9)]['created']++;}}catch(_0x373462){_0x4caf62['prompts']['push']({'name':_0x350ed2[_0x67434b(0x2b2)]['name'],'action':_0x67434b(0x256),'error':_0x373462[_0x67434b(0x261)]}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x1f9)]['errors']++;}}for(const _0x3b2eb8 of _0xfe9c58){try{const _0x45dbd3=_0x3f394d[_0x67434b(0x20c)](_0x3b2eb8[_0x67434b(0x2b2)][_0x67434b(0x2a9)]),_0x380334=await yamlIntegrationToApi(_0x3b2eb8[_0x67434b(0x2b2)],_0x240068,_0xf0c15c);if(_0x45dbd3){await this['client'][_0x67434b(0x24a)](_0x45dbd3['id']);const _0x391d0e=await this[_0x67434b(0x24c)]['createIntegration'](_0x380334);_0x4caf62[_0x67434b(0x2d7)][_0x67434b(0x2b3)]({'name':_0x3b2eb8['yaml'][_0x67434b(0x2a9)],'action':'updated','id':_0x391d0e['id']}),_0x4caf62['counts'][_0x67434b(0x2d7)][_0x67434b(0x2ce)]++;}else{const _0x3e79eb=await this[_0x67434b(0x24c)]['createIntegration'](_0x380334);_0x4caf62[_0x67434b(0x2d7)]['push']({'name':_0x3b2eb8[_0x67434b(0x2b2)][_0x67434b(0x2a9)],'action':_0x67434b(0x26c),'id':_0x3e79eb['id']}),_0x4caf62['counts']['integrations'][_0x67434b(0x26c)]++;}}catch(_0x444b15){_0x4caf62['integrations']['push']({'name':_0x3b2eb8[_0x67434b(0x2b2)][_0x67434b(0x2a9)],'action':_0x67434b(0x256),'error':_0x444b15[_0x67434b(0x261)]}),_0x4caf62[_0x67434b(0x28f)][_0x67434b(0x2d7)][_0x67434b(0x1f8)]++;}}return _0x4caf62;}async[a96_0x50fe1e(0x2c3)](_0x437074,_0x39f965,_0x3d9dbe,_0x38f69d){const _0x43dd3a=a96_0x50fe1e,{projectId:_0x2a943c,project:_0x1308d5}=await this[_0x43dd3a(0x1f5)](_0x437074),_0x3e7472=_0x1308d5[_0x43dd3a(0x242)][_0x43dd3a(0x289)],_0x16d5d8=await this['client']['listAgentsFull'](_0x2a943c),_0x563ddd=_0x16d5d8[_0x43dd3a(0x217)](_0x3734e1=>_0x3734e1[_0x43dd3a(0x242)][_0x43dd3a(0x289)]===_0x39f965);if(!_0x563ddd)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x43dd3a(0x2a4)+_0x39f965,undefined,{'helpText':'Available\x20agents:\x20'+_0x16d5d8['map'](_0x2ddb02=>_0x2ddb02[_0x43dd3a(0x242)]['name'])[_0x43dd3a(0x294)](',\x20')});let _0x1d484f;if(_0x3d9dbe)_0x1d484f=_0x3d9dbe;else{const _0x3ed96d=a96_0x268840['join'](process[_0x43dd3a(0x1ec)](),_0x43dd3a(0x2ca)),_0x54117f=getSanitizedPathWithMigration(_0x3ed96d,_0x3e7472);_0x54117f[_0x43dd3a(0x1fe)]&&this['logger'][_0x43dd3a(0x29b)]('Renamed\x20folder:\x20'+a96_0x268840[_0x43dd3a(0x2e4)](_0x54117f[_0x43dd3a(0x21c)])+'\x20→\x20'+a96_0x268840[_0x43dd3a(0x2e4)](_0x54117f['path'])),_0x1d484f=_0x54117f[_0x43dd3a(0x2c1)];}const _0x346076=getSanitizedPathWithMigration(_0x1d484f,_0x39f965);_0x346076['renamed']&&this[_0x43dd3a(0x2d8)][_0x43dd3a(0x29b)]('Renamed\x20agent\x20folder:\x20'+a96_0x268840['basename'](_0x346076[_0x43dd3a(0x21c)])+_0x43dd3a(0x203)+a96_0x268840[_0x43dd3a(0x2e4)](_0x346076[_0x43dd3a(0x2c1)]));const _0x1fdd5f=_0x346076[_0x43dd3a(0x2c1)],_0x71fd96=new Map(),_0xdb8768=new Map(),_0x327dfe=await this['client'][_0x43dd3a(0x2e3)](_0x2a943c),_0x301f85=await this[_0x43dd3a(0x24c)][_0x43dd3a(0x262)](_0x2a943c),_0x186e4b=await this['client'][_0x43dd3a(0x214)](_0x2a943c),_0x979336=new Map(),_0x11e926=new Map();for(const _0x38ac36 of _0x327dfe){_0x71fd96['set'](_0x38ac36['id'],_0x38ac36[_0x43dd3a(0x242)][_0x43dd3a(0x289)]);}for(const _0x2ec4da of _0x301f85){_0x979336[_0x43dd3a(0x1e9)](_0x2ec4da['id'],_0x2ec4da[_0x43dd3a(0x242)][_0x43dd3a(0x289)]);}for(const _0x3a1949 of _0x186e4b){_0x11e926[_0x43dd3a(0x1e9)](_0x3a1949['id'],_0x3a1949['attributes'][_0x43dd3a(0x289)]);}for(const _0x6d9af9 of _0x16d5d8){_0xdb8768[_0x43dd3a(0x1e9)](_0x6d9af9['id'],_0x6d9af9[_0x43dd3a(0x242)]['name']);}const _0x4d3a96={'resolveKnowledgeBaseName':async _0x2e1674=>_0x71fd96[_0x43dd3a(0x20c)](_0x2e1674),'resolveTextKnowledgeBaseName':async _0xbd6bfb=>_0x979336[_0x43dd3a(0x20c)](_0xbd6bfb),'resolveAgentName':async _0x341380=>_0xdb8768[_0x43dd3a(0x20c)](_0x341380),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async()=>undefined,'resolveExperimentalKnowledgeBaseName':async _0x19671d=>_0x11e926[_0x43dd3a(0x20c)](_0x19671d),'onWarning':_0x877394=>this[_0x43dd3a(0x2d8)][_0x43dd3a(0x27a)](_0x877394)},_0x36be64=a96_0x268840[_0x43dd3a(0x294)](_0x1fdd5f,'prompt.md'),_0x332811=a96_0x268840[_0x43dd3a(0x294)](_0x1fdd5f,'agent.yml'),_0x6f04ad=a96_0x268840[_0x43dd3a(0x294)](_0x1fdd5f,_0x43dd3a(0x24d)),_0x1a973f=!a96_0x44d248[_0x43dd3a(0x1f1)](_0x332811);if(_0x38f69d?.[_0x43dd3a(0x2de)])return{'agentName':_0x39f965,'outputPath':_0x1fdd5f,'isNew':_0x1a973f,'hasChanges':!![]};a96_0x44d248[_0x43dd3a(0x1fd)](_0x1d484f,{'recursive':!![]}),a96_0x44d248[_0x43dd3a(0x1fd)](_0x1fdd5f,{'recursive':!![]});const _0x4ad3d4=a96_0x268840[_0x43dd3a(0x294)](_0x1d484f,'tdx.json');!a96_0x44d248[_0x43dd3a(0x1f1)](_0x4ad3d4)&&a96_0x44d248['writeFileSync'](_0x4ad3d4,createAgentConfigContent(_0x437074));const {yaml:_0x120dc0,systemPrompt:_0x272cb2,starterMessage:_0x5e87c3}=await agentResponseToDef(_0x563ddd,_0x4d3a96);let _0x5ccce8=_0x1a973f;if(!_0x1a973f){const _0x4b81e5=a96_0x44d248[_0x43dd3a(0x1f1)](_0x36be64)?a96_0x44d248['readFileSync'](_0x36be64,_0x43dd3a(0x1ea)):'',_0x51e903=a96_0x44d248[_0x43dd3a(0x225)](_0x332811,_0x43dd3a(0x1ea));_0x5ccce8=_0x4b81e5!==_0x272cb2||_0x51e903!==toAgentYamlString(_0x120dc0);}a96_0x44d248[_0x43dd3a(0x2b5)](_0x36be64,_0x272cb2),a96_0x44d248[_0x43dd3a(0x2b5)](_0x332811,toAgentYamlString(_0x120dc0));if(_0x5e87c3&&_0x5e87c3[_0x43dd3a(0x233)]('\x0a'))a96_0x44d248['writeFileSync'](_0x6f04ad,_0x5e87c3);else a96_0x44d248[_0x43dd3a(0x1f1)](_0x6f04ad)&&a96_0x44d248['unlinkSync'](_0x6f04ad);return{'agentName':_0x39f965,'outputPath':_0x1fdd5f,'isNew':_0x1a973f,'hasChanges':_0x5ccce8};}async['pushAgent'](_0x4ba424,_0x4a398c){const _0x5b04ee=a96_0x50fe1e;let _0x2aa843;isAgentYamlPath(_0x4ba424)?_0x2aa843=getAgentDirFromYamlPath(_0x4ba424):_0x2aa843=_0x4ba424;const {config:_0x2386f6}=findAgentConfig(_0x2aa843),_0xc99b0d=await this[_0x5b04ee(0x209)](_0x2386f6['llm_project']),_0x22d08e=a96_0x268840[_0x5b04ee(0x294)](_0x2aa843,'agent.yml'),_0x352b37=a96_0x268840['join'](_0x2aa843,'prompt.md'),_0x4ba8a7=a96_0x268840['join'](_0x2aa843,_0x5b04ee(0x24d));if(!a96_0x44d248['existsSync'](_0x22d08e))throw new SDKError(ErrorCode[_0x5b04ee(0x290)],_0x5b04ee(0x2a5)+_0x2aa843,undefined,{'helpText':_0x5b04ee(0x271)});const _0x23522c=parseAgentYaml(a96_0x44d248[_0x5b04ee(0x225)](_0x22d08e,_0x5b04ee(0x1ea)),_0x22d08e),_0x2ed712=a96_0x44d248[_0x5b04ee(0x1f1)](_0x352b37)?a96_0x44d248[_0x5b04ee(0x225)](_0x352b37,_0x5b04ee(0x1ea)):'',_0xdd3122=a96_0x44d248['existsSync'](_0x4ba8a7)?a96_0x44d248[_0x5b04ee(0x225)](_0x4ba8a7,_0x5b04ee(0x1ea)):_0x23522c[_0x5b04ee(0x211)];if(_0x4a398c?.[_0x5b04ee(0x2de)])return{'agentName':_0x23522c[_0x5b04ee(0x289)],'action':_0x5b04ee(0x26c),'projectId':_0xc99b0d};const _0x587ce2=await this[_0x5b04ee(0x24c)]['listAgentsFull'](_0xc99b0d),_0xa8ec74=await this['client'][_0x5b04ee(0x2e3)](_0xc99b0d),_0x40556e=await this[_0x5b04ee(0x24c)][_0x5b04ee(0x262)](_0xc99b0d),_0x12e3cc=await this[_0x5b04ee(0x24c)][_0x5b04ee(0x214)](_0xc99b0d),_0x11e4dd=await this['client'][_0x5b04ee(0x246)](_0xc99b0d),_0xc8b773=new Map(),_0xb65b56=new Map(),_0x30c1d5=new Map(),_0x3379e3=new Map();for(const _0x427389 of _0xa8ec74){_0xc8b773['set'](_0x427389[_0x5b04ee(0x242)][_0x5b04ee(0x289)],_0x427389['id']);}for(const _0x4f3cdf of _0x40556e){_0xb65b56[_0x5b04ee(0x1e9)](_0x4f3cdf[_0x5b04ee(0x242)]['name'],_0x4f3cdf['id']);}for(const _0xb969b1 of _0x12e3cc){_0x30c1d5[_0x5b04ee(0x1e9)](_0xb969b1[_0x5b04ee(0x242)]['name'],_0xb969b1['id']);}for(const _0x4c9b8e of _0x587ce2){_0x3379e3['set'](_0x4c9b8e[_0x5b04ee(0x242)][_0x5b04ee(0x289)],_0x4c9b8e['id']);}const _0x409a80=[],_0x2a4590={'projectId':_0xc99b0d,'resolveKnowledgeBaseId':async _0x26f95a=>_0xc8b773[_0x5b04ee(0x20c)](_0x26f95a),'resolveTextKnowledgeBaseId':async _0x3b4cae=>_0xb65b56['get'](_0x3b4cae),'resolveAgentId':async _0x17c709=>_0x3379e3[_0x5b04ee(0x20c)](_0x17c709),'resolveWebSearchToolId':async()=>undefined,'resolveImageGeneratorId':async()=>undefined,'resolvePromptId':async()=>undefined,'resolveParentSegmentKBId':async()=>_0x11e4dd?.['id'],'resolveExperimentalKnowledgeBaseId':async _0x46160b=>_0x30c1d5[_0x5b04ee(0x20c)](_0x46160b),'onWarning':_0x553a51=>{const _0x202534=_0x5b04ee;this[_0x202534(0x2d8)][_0x202534(0x27a)](_0x553a51),_0x409a80['push'](_0x553a51);}};try{const _0x13c377=_0x587ce2[_0x5b04ee(0x217)](_0x4ecf42=>_0x4ecf42[_0x5b04ee(0x242)][_0x5b04ee(0x289)]===_0x23522c['name']),_0x58fa21=await agentDefToRequest(_0x23522c,_0x2ed712,_0xdd3122,_0x2a4590);if(_0x13c377)return await this[_0x5b04ee(0x24c)][_0x5b04ee(0x274)](_0x13c377['id'],_0x58fa21),{'agentName':_0x23522c[_0x5b04ee(0x289)],'action':'updated','projectId':_0xc99b0d,'agentId':_0x13c377['id'],'warnings':_0x409a80['length']>0x0?_0x409a80:undefined};else{const _0x4f7255=await this[_0x5b04ee(0x24c)][_0x5b04ee(0x2d0)](_0x58fa21);return{'agentName':_0x23522c[_0x5b04ee(0x289)],'action':'created','projectId':_0xc99b0d,'agentId':_0x4f7255['id'],'warnings':_0x409a80[_0x5b04ee(0x215)]>0x0?_0x409a80:undefined};}}catch(_0x5e6cb0){return{'agentName':_0x23522c['name'],'action':_0x5b04ee(0x256),'projectId':_0xc99b0d,'error':_0x5e6cb0[_0x5b04ee(0x261)],'warnings':_0x409a80[_0x5b04ee(0x215)]>0x0?_0x409a80:undefined};}}async[a96_0x50fe1e(0x286)](_0x543d49,_0x2a5f75,_0x3f8123){const _0xd35af0=a96_0x50fe1e,_0x3fd37f=a96_0x44d248['existsSync'](_0x543d49)&&a96_0x44d248[_0xd35af0(0x1f1)](a96_0x268840['join'](_0x543d49,_0xd35af0(0x232)));let _0x2f8821;const _0x109ab5=[],_0x2612be=[],_0xa010e3=[],_0x39e4d=[],_0x5c8e57=[],_0x1c7789=[],_0x3c0aa5=[];if(_0x3fd37f){const _0xfaa0ce=loadAgentConfig(a96_0x268840[_0xd35af0(0x294)](_0x543d49,'tdx.json'));_0x2f8821=_0xfaa0ce[_0xd35af0(0x24e)];const _0x1355e3=a96_0x44d248[_0xd35af0(0x1ed)](_0x543d49,{'withFileTypes':!![]});for(const _0xdc32cb of _0x1355e3){if(!_0xdc32cb[_0xd35af0(0x27b)]())continue;if([_0xd35af0(0x267),_0xd35af0(0x2bf),_0xd35af0(0x2af),_0xd35af0(0x1f9),_0xd35af0(0x2d7)][_0xd35af0(0x233)](_0xdc32cb['name']))continue;const _0xd0dd=a96_0x268840[_0xd35af0(0x294)](_0x543d49,_0xdc32cb['name']);if(isAgentDir(_0xd0dd)){const _0x35f351=a96_0x268840['join'](_0xd0dd,_0xd35af0(0x2bb)),_0x2a3e4b=a96_0x268840['join'](_0xd0dd,_0xd35af0(0x221)),_0x560575=a96_0x268840[_0xd35af0(0x294)](_0xd0dd,_0xd35af0(0x24d)),_0xc9405f=parseAgentYaml(a96_0x44d248[_0xd35af0(0x225)](_0x35f351,_0xd35af0(0x1ea)),_0x35f351),_0x55b2ce=a96_0x44d248[_0xd35af0(0x1f1)](_0x2a3e4b)?a96_0x44d248['readFileSync'](_0x2a3e4b,_0xd35af0(0x1ea)):'',_0x8e9522=a96_0x44d248[_0xd35af0(0x1f1)](_0x560575)?a96_0x44d248['readFileSync'](_0x560575,'utf-8'):_0xc9405f[_0xd35af0(0x211)];_0x109ab5['push']({'name':_0xc9405f[_0xd35af0(0x289)],'dir':_0xd0dd,'yaml':_0xc9405f,'systemPrompt':_0x55b2ce,'starterMessage':_0x8e9522});}}const _0x9938eb=getKnowledgeBasesDir(_0x543d49);if(a96_0x44d248[_0xd35af0(0x1f1)](_0x9938eb)){const _0x4a05a5=a96_0x44d248['readdirSync'](_0x9938eb);for(const _0x3c8d03 of _0x4a05a5){const _0x49a9b8=a96_0x268840[_0xd35af0(0x294)](_0x9938eb,_0x3c8d03);if(_0x3c8d03['endsWith']('.yml')){const _0xb57525=parseKnowledgeBaseYaml(a96_0x44d248[_0xd35af0(0x225)](_0x49a9b8,'utf-8'),_0x49a9b8);_0x2612be['push']({'name':_0xb57525[_0xd35af0(0x289)],'path':_0x49a9b8,'yaml':_0xb57525});}else{if(_0x3c8d03[_0xd35af0(0x216)](_0xd35af0(0x235))){const _0x4e6153=a96_0x44d248['readFileSync'](_0x49a9b8,_0xd35af0(0x1ea)),{name:_0x32075e,text:_0x4a8d22}=parseTextKnowledgeBaseMd(_0x4e6153,_0x3c8d03);_0xa010e3[_0xd35af0(0x2b3)]({'name':_0x32075e,'path':_0x49a9b8,'text':_0x4a8d22});}}}}const _0x695feb=getPromptsDir(_0x543d49);if(a96_0x44d248[_0xd35af0(0x1f1)](_0x695feb)){const _0x472484=a96_0x44d248['readdirSync'](_0x695feb)[_0xd35af0(0x2dc)](_0xa8bde1=>_0xa8bde1[_0xd35af0(0x216)](_0xd35af0(0x1f4)));for(const _0x36f916 of _0x472484){const _0x5c708e=a96_0x268840[_0xd35af0(0x294)](_0x695feb,_0x36f916),_0x553393=parsePromptYaml(a96_0x44d248[_0xd35af0(0x225)](_0x5c708e,_0xd35af0(0x1ea)),_0x5c708e);_0x39e4d[_0xd35af0(0x2b3)]({'name':_0x553393[_0xd35af0(0x289)],'path':_0x5c708e,'yaml':_0x553393});}}const _0x471af1=getIntegrationsDir(_0x543d49);if(a96_0x44d248[_0xd35af0(0x1f1)](_0x471af1)){const _0x5cfb4f=a96_0x44d248[_0xd35af0(0x1ed)](_0x471af1)[_0xd35af0(0x2dc)](_0x9879b1=>_0x9879b1['endsWith']('.yml'));for(const _0x2e5b18 of _0x5cfb4f){const _0x514100=a96_0x268840['join'](_0x471af1,_0x2e5b18),_0x1fb60c=parseIntegrationYaml(a96_0x44d248[_0xd35af0(0x225)](_0x514100,_0xd35af0(0x1ea)),_0x514100);SAFE_INTEGRATION_TYPES[_0xd35af0(0x233)](_0x1fb60c[_0xd35af0(0x2a9)][_0xd35af0(0x2d9)]())?_0x5c8e57[_0xd35af0(0x2b3)]({'name':_0x1fb60c[_0xd35af0(0x289)],'path':_0x514100,'yaml':_0x1fb60c}):this[_0xd35af0(0x2d8)][_0xd35af0(0x27a)](_0xd35af0(0x259)+_0x1fb60c[_0xd35af0(0x289)]+_0xd35af0(0x2d5)+_0x1fb60c[_0xd35af0(0x2a9)]+_0xd35af0(0x2a8)+(_0xd35af0(0x2cf)+SAFE_INTEGRATION_TYPES[_0xd35af0(0x294)](',\x20')+_0xd35af0(0x270)));}}const _0x5e041a=getExperimentalKnowledgeBasesDir(_0x543d49);if(a96_0x44d248['existsSync'](_0x5e041a)){const _0x5430a4=a96_0x44d248[_0xd35af0(0x1ed)](_0x5e041a,{'withFileTypes':!![]});for(const _0x193b90 of _0x5430a4){if(!_0x193b90[_0xd35af0(0x27b)]())continue;const _0x557240=a96_0x268840[_0xd35af0(0x294)](_0x5e041a,_0x193b90[_0xd35af0(0x289)]),_0x35247d=a96_0x268840[_0xd35af0(0x294)](_0x557240,_0x193b90['name']+_0xd35af0(0x1f4));if(a96_0x44d248['existsSync'](_0x35247d)){const _0x581eda=parseExperimentalKnowledgeBaseYaml(a96_0x44d248[_0xd35af0(0x225)](_0x35247d,'utf-8'),_0x35247d),_0x1653ed=a96_0x268840[_0xd35af0(0x294)](_0x557240,_0xd35af0(0x2f0)),_0x561dab=[];if(a96_0x44d248[_0xd35af0(0x1f1)](_0x1653ed)){const _0x5f30f8=a96_0x44d248[_0xd35af0(0x1ed)](_0x1653ed,{'withFileTypes':!![]});for(const _0x5e2c3a of _0x5f30f8){if(!_0x5e2c3a['isDirectory']())continue;const _0x29f0a3=a96_0x268840[_0xd35af0(0x294)](_0x1653ed,_0x5e2c3a[_0xd35af0(0x289)]),_0xf15781=a96_0x268840[_0xd35af0(0x294)](_0x29f0a3,'code.js'),_0x324b5c=a96_0x268840[_0xd35af0(0x294)](_0x29f0a3,_0xd35af0(0x278));if(a96_0x44d248[_0xd35af0(0x1f1)](_0xf15781)&&a96_0x44d248[_0xd35af0(0x1f1)](_0x324b5c)){const _0xf9f56=a96_0x44d248['readFileSync'](_0xf15781,_0xd35af0(0x1ea)),_0x861989=a96_0x44d248[_0xd35af0(0x225)](_0x324b5c,_0xd35af0(0x1ea));_0x561dab[_0xd35af0(0x2b3)]({'name':_0x5e2c3a[_0xd35af0(0x289)],'code':_0xf9f56,'json_schema':_0x861989});}}}const _0x49264a={..._0x581eda,'functions':_0x561dab};_0x1c7789[_0xd35af0(0x2b3)]({'name':_0x581eda[_0xd35af0(0x289)],'path':_0x557240,'def':_0x49264a});}}}const _0x133676=getExperimentalArtifactsDir(_0x543d49);if(a96_0x44d248[_0xd35af0(0x1f1)](_0x133676)){const _0x191d84=a96_0x44d248[_0xd35af0(0x1ed)](_0x133676,{'withFileTypes':!![]});for(const _0x54ce5d of _0x191d84){if(!_0x54ce5d[_0xd35af0(0x27b)]())continue;const _0xd98e58=a96_0x268840[_0xd35af0(0x294)](_0x133676,_0x54ce5d[_0xd35af0(0x289)]),_0x5e7c70=a96_0x268840['join'](_0xd98e58,_0x54ce5d[_0xd35af0(0x289)]+'.yml');if(a96_0x44d248[_0xd35af0(0x1f1)](_0x5e7c70)){const _0x290418=parseExperimentalArtifactYaml(a96_0x44d248[_0xd35af0(0x225)](_0x5e7c70,_0xd35af0(0x1ea)),_0x5e7c70),_0x9c8d79=a96_0x268840[_0xd35af0(0x294)](_0xd98e58,_0xd35af0(0x227)),_0x113046=a96_0x44d248[_0xd35af0(0x1f1)](_0x9c8d79)?a96_0x44d248[_0xd35af0(0x225)](_0x9c8d79,'utf-8'):'',_0x43b87f=a96_0x268840[_0xd35af0(0x294)](_0xd98e58,'files'),_0x4f4655=[];if(a96_0x44d248[_0xd35af0(0x1f1)](_0x43b87f)){const _0xbd2770=a96_0x44d248[_0xd35af0(0x1ed)](_0x43b87f);for(const _0x3206d5 of _0xbd2770){const _0x16b1ab=a96_0x268840['join'](_0x43b87f,_0x3206d5);if(a96_0x44d248[_0xd35af0(0x2cd)](_0x16b1ab)[_0xd35af0(0x1e8)]()){const _0x54aed7=a96_0x44d248[_0xd35af0(0x225)](_0x16b1ab,_0xd35af0(0x1ea));_0x4f4655['push']({'file_name':_0x3206d5,'text_content':_0x54aed7});}}}const _0x152ecb={..._0x290418,'code':_0x113046,'files':_0x4f4655};_0x3c0aa5[_0xd35af0(0x2b3)]({'name':_0x290418['name'],'path':_0xd98e58,'def':_0x152ecb});}}}}else{const _0x10a41b=await this[_0xd35af0(0x209)](_0x543d49),_0x57ab3f=await this['client'][_0xd35af0(0x1ef)](_0x10a41b);_0x2f8821=_0x57ab3f[_0xd35af0(0x242)][_0xd35af0(0x289)];const _0x1c9550=await this[_0xd35af0(0x24c)][_0xd35af0(0x280)](_0x10a41b),_0x4eab53=await this[_0xd35af0(0x24c)]['listKnowledgeBases'](_0x10a41b),_0x47a135=await this[_0xd35af0(0x24c)]['listTextKnowledgeBases'](_0x10a41b),_0x1dae9c=await this[_0xd35af0(0x24c)][_0xd35af0(0x229)](_0x10a41b),_0x39dbbf=await this[_0xd35af0(0x24c)][_0xd35af0(0x252)](_0x10a41b),_0x4eb1cf=await this[_0xd35af0(0x24c)][_0xd35af0(0x214)](_0x10a41b),_0x3aca64=await this[_0xd35af0(0x24c)]['listExperimentalArtifacts'](_0x10a41b),_0x3263aa=new Map(),_0x77982d=new Map(),_0x9adbc=new Map(),_0x515b54=new Map(),_0x416df3=new Map(),_0x18970f=new Map();for(const _0x1b9fd0 of _0x4eab53){_0x3263aa[_0xd35af0(0x1e9)](_0x1b9fd0['id'],_0x1b9fd0['attributes'][_0xd35af0(0x289)]);}for(const _0x2f639a of _0x47a135){_0x77982d['set'](_0x2f639a['id'],_0x2f639a[_0xd35af0(0x242)][_0xd35af0(0x289)]);}for(const _0x35571a of _0x1c9550){_0x9adbc[_0xd35af0(0x1e9)](_0x35571a['id'],_0x35571a[_0xd35af0(0x242)][_0xd35af0(0x289)]);}for(const _0x290ddb of _0x1dae9c){_0x515b54['set'](_0x290ddb['id'],_0x290ddb[_0xd35af0(0x242)]['name']);}for(const _0xbde373 of _0x4eb1cf){_0x416df3[_0xd35af0(0x1e9)](_0xbde373['id'],_0xbde373[_0xd35af0(0x242)]['name']);}for(const _0x122ad4 of _0x3aca64){_0x18970f['set'](_0x122ad4['id'],_0x122ad4[_0xd35af0(0x242)][_0xd35af0(0x289)]);}const _0x49dd19={'resolveKnowledgeBaseName':async _0xd4df16=>_0x3263aa[_0xd35af0(0x20c)](_0xd4df16),'resolveTextKnowledgeBaseName':async _0xdf95e=>_0x77982d[_0xd35af0(0x20c)](_0xdf95e),'resolveAgentName':async _0x2224ba=>_0x9adbc[_0xd35af0(0x20c)](_0x2224ba),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async _0x542b7e=>_0x515b54[_0xd35af0(0x20c)](_0x542b7e),'resolveExperimentalKnowledgeBaseName':async _0x3fa021=>_0x416df3[_0xd35af0(0x20c)](_0x3fa021),'onWarning':_0x567902=>this[_0xd35af0(0x2d8)]['warn'](_0x567902)};for(const _0x2a3011 of _0x1c9550){const _0x17f21c=await agentResponseToDef(_0x2a3011,_0x49dd19),{yaml:_0x3718ec,systemPrompt:_0x1897b5,starterMessage:_0x28540d}=_0x17f21c;_0x109ab5[_0xd35af0(0x2b3)]({'name':_0x3718ec[_0xd35af0(0x289)],'dir':'','yaml':_0x3718ec,'systemPrompt':_0x1897b5,'starterMessage':_0x28540d});}for(const _0x3412d8 of _0x4eab53){const _0x3b4bd4=apiKnowledgeBaseToYaml(_0x3412d8);_0x2612be[_0xd35af0(0x2b3)]({'name':_0x3b4bd4[_0xd35af0(0x289)],'path':'','yaml':_0x3b4bd4});}for(const _0x309534 of _0x47a135){_0xa010e3[_0xd35af0(0x2b3)]({'name':_0x309534['attributes']['name'],'path':'','text':_0x309534[_0xd35af0(0x242)][_0xd35af0(0x202)]});}for(const _0x15eb95 of _0x1dae9c){const _0x2319ba=await apiPromptToYaml(_0x15eb95,_0x49dd19);_0x2319ba&&_0x39e4d['push']({'name':_0x2319ba[_0xd35af0(0x289)],'path':'','yaml':_0x2319ba});}for(const _0x9149a9 of _0x39dbbf){if(!_0x9149a9[_0xd35af0(0x242)][_0xd35af0(0x204)]&&SAFE_INTEGRATION_TYPES[_0xd35af0(0x233)](_0x9149a9[_0xd35af0(0x242)][_0xd35af0(0x26d)][_0xd35af0(0x2d9)]())){const _0x29b6bc=await apiIntegrationToYaml(_0x9149a9,_0x49dd19);_0x5c8e57[_0xd35af0(0x2b3)]({'name':_0x9149a9[_0xd35af0(0x242)][_0xd35af0(0x26d)][_0xd35af0(0x2d9)](),'path':'','yaml':_0x29b6bc});}}for(const _0x4dd4e1 of _0x4eb1cf){const _0x22cb13=apiExperimentalKnowledgeBaseToYaml(_0x4dd4e1);_0x1c7789[_0xd35af0(0x2b3)]({'name':_0x22cb13[_0xd35af0(0x289)],'path':'','def':_0x22cb13});}for(const _0x520044 of _0x3aca64){const _0x24d2be=apiExperimentalArtifactToYaml(_0x520044);_0x3c0aa5['push']({'name':_0x24d2be[_0xd35af0(0x289)],'path':'','def':_0x24d2be});}}const _0xb746c4={'sourceProjectName':_0x2f8821,'newProjectName':_0x2a5f75,'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}}},_0x141c6e=await this['client'][_0xd35af0(0x236)](),_0x1379a1=_0x141c6e[_0xd35af0(0x217)](_0x1950fb=>_0x1950fb[_0xd35af0(0x242)][_0xd35af0(0x289)]===_0x2a5f75);if(_0x1379a1)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0xd35af0(0x28b)+_0x2a5f75+_0xd35af0(0x28c),undefined,{'helpText':_0xd35af0(0x2bd)});if(_0x3f8123?.[_0xd35af0(0x2de)])return _0xb746c4[_0xd35af0(0x28f)][_0xd35af0(0x2ca)][_0xd35af0(0x26c)]=_0x109ab5[_0xd35af0(0x215)],_0xb746c4[_0xd35af0(0x28f)][_0xd35af0(0x2a3)][_0xd35af0(0x26c)]=_0x2612be['length'],_0xb746c4[_0xd35af0(0x28f)][_0xd35af0(0x2bc)][_0xd35af0(0x26c)]=_0xa010e3[_0xd35af0(0x215)],_0xb746c4[_0xd35af0(0x28f)][_0xd35af0(0x207)]['created']=_0x1c7789[_0xd35af0(0x215)],_0xb746c4[_0xd35af0(0x28f)][_0xd35af0(0x253)][_0xd35af0(0x26c)]=_0x3c0aa5[_0xd35af0(0x215)],_0xb746c4['counts'][_0xd35af0(0x1f9)]['created']=_0x39e4d[_0xd35af0(0x215)],_0xb746c4[_0xd35af0(0x28f)]['integrations']['created']=_0x5c8e57[_0xd35af0(0x215)],_0xb746c4;const _0x2a4474=await this[_0xd35af0(0x24c)]['createProject']({'name':_0x2a5f75}),_0x51cb3e=_0x2a4474['id'];_0xb746c4[_0xd35af0(0x258)]=_0x51cb3e;const _0x31c6d8=new Map(),_0x2af92f=new Map(),_0x28041f=new Map(),_0x2c455a=new Map(),_0x14734a=new Map(),_0x301261=new Map(),_0xdeaf6=new Map(),_0x12b784=new Map(),_0x2287d1=new Set(),_0x7b47a9=new Set();for(const _0x8a71d0 of _0x109ab5){for(const _0x4e076b of _0x8a71d0['yaml'][_0xd35af0(0x2df)]||[]){if(_0x4e076b[_0xd35af0(0x25a)]===_0xd35af0(0x25e)&&_0x4e076b[_0xd35af0(0x208)]){const _0x39baea=parseRef(_0x4e076b['target']);if(_0x39baea)_0x2287d1[_0xd35af0(0x20d)](_0x39baea[_0xd35af0(0x289)]);}else{if(_0x4e076b[_0xd35af0(0x25a)]===_0xd35af0(0x2ef)&&_0x4e076b['target']){const _0x554ee8=parseRef(_0x4e076b['target']);if(_0x554ee8)_0x7b47a9[_0xd35af0(0x20d)](_0x554ee8[_0xd35af0(0x289)]);}}}}for(const _0x1defe4 of _0x2287d1){try{const _0xdb459f=await this[_0xd35af0(0x24c)][_0xd35af0(0x296)]({'projectId':_0x51cb3e,'name':_0x1defe4});_0x14734a['set'](_0x1defe4,_0xdb459f['id']),_0xb746c4[_0xd35af0(0x2d6)][_0xd35af0(0x2b3)]({'name':_0x1defe4,'action':'created','id':_0xdb459f['id']}),_0xb746c4['counts'][_0xd35af0(0x2d6)][_0xd35af0(0x26c)]++;}catch(_0x1d3686){_0xb746c4[_0xd35af0(0x2d6)][_0xd35af0(0x2b3)]({'name':_0x1defe4,'action':'error','error':_0x1d3686[_0xd35af0(0x261)]}),_0xb746c4[_0xd35af0(0x28f)][_0xd35af0(0x2d6)][_0xd35af0(0x1f8)]++;}}for(const _0x45efda of _0x7b47a9){try{const _0x276244=await this[_0xd35af0(0x24c)]['createWebSearchTool']({'projectId':_0x51cb3e,'name':_0x45efda});_0x301261[_0xd35af0(0x1e9)](_0x45efda,_0x276244['id']),_0xb746c4[_0xd35af0(0x24f)][_0xd35af0(0x2b3)]({'name':_0x45efda,'action':_0xd35af0(0x26c),'id':_0x276244['id']}),_0xb746c4[_0xd35af0(0x28f)][_0xd35af0(0x24f)][_0xd35af0(0x26c)]++;}catch(_0xd3aed1){_0xb746c4['webSearchTools'][_0xd35af0(0x2b3)]({'name':_0x45efda,'action':_0xd35af0(0x256),'error':_0xd3aed1[_0xd35af0(0x261)]}),_0xb746c4[_0xd35af0(0x28f)][_0xd35af0(0x24f)][_0xd35af0(0x1f8)]++;}}const _0x342745=await this['client'][_0xd35af0(0x246)](_0x51cb3e);let _0x5df205=[];const _0x3888c2={'projectId':_0x51cb3e,'resolveKnowledgeBaseId':async _0x52b968=>_0x31c6d8['get'](_0x52b968),'resolveTextKnowledgeBaseId':async _0x5b40bb=>_0x2af92f[_0xd35af0(0x20c)](_0x5b40bb),'resolveExperimentalKnowledgeBaseId':async _0x34eab2=>_0xdeaf6[_0xd35af0(0x20c)](_0x34eab2),'resolveAgentId':async _0x35d8c1=>_0x28041f[_0xd35af0(0x20c)](_0x35d8c1),'resolveWebSearchToolId':async _0x535f30=>_0x301261['get'](_0x535f30),'resolveImageGeneratorId':async _0x43ce4e=>_0x14734a[_0xd35af0(0x20c)](_0x43ce4e),'resolvePromptId':async _0x2558e9=>_0x2c455a['get'](_0x2558e9),'resolveParentSegmentKBId':async()=>_0x342745?.['id'],'onWarning':_0x1403ac=>{const _0x1cc13b=_0xd35af0;this[_0x1cc13b(0x2d8)][_0x1cc13b(0x27a)](_0x1403ac),_0x5df205['push'](_0x1403ac);}};for(const _0x3c8fe6 of _0x2612be){try{const _0x1b61ed=yamlKnowledgeBaseToApi(_0x3c8fe6[_0xd35af0(0x2b2)],_0x51cb3e),_0x3bbcfa=await this[_0xd35af0(0x24c)][_0xd35af0(0x22c)](_0x1b61ed);_0x31c6d8['set'](_0x3c8fe6[_0xd35af0(0x2b2)][_0xd35af0(0x289)],_0x3bbcfa['id']),_0xb746c4[_0xd35af0(0x2a3)]['push']({'name':_0x3c8fe6[_0xd35af0(0x2b2)]['name'],'action':_0xd35af0(0x26c),'id':_0x3bbcfa['id']}),_0xb746c4[_0xd35af0(0x28f)][_0xd35af0(0x2a3)][_0xd35af0(0x26c)]++;}catch(_0x38059e){_0xb746c4[_0xd35af0(0x2a3)]['push']({'name':_0x3c8fe6[_0xd35af0(0x2b2)][_0xd35af0(0x289)],'action':_0xd35af0(0x256),'error':_0x38059e['message']}),_0xb746c4[_0xd35af0(0x28f)][_0xd35af0(0x2a3)][_0xd35af0(0x1f8)]++;}}for(const _0x256c77 of _0xa010e3){try{const _0x2d0237=yamlTextKnowledgeBaseToApi({'name':_0x256c77[_0xd35af0(0x289)],'text':_0x256c77['text']},_0x51cb3e),_0x3900a9=await this[_0xd35af0(0x24c)][_0xd35af0(0x2d2)](_0x2d0237);_0x2af92f[_0xd35af0(0x1e9)](_0x256c77[_0xd35af0(0x289)],_0x3900a9['id']),_0xb746c4[_0xd35af0(0x2bc)][_0xd35af0(0x2b3)]({'name':_0x256c77[_0xd35af0(0x289)],'action':_0xd35af0(0x26c),'id':_0x3900a9['id']}),_0xb746c4[_0xd35af0(0x28f)][_0xd35af0(0x2bc)]['created']++;}catch(_0x107815){_0xb746c4['textKnowledgeBases'][_0xd35af0(0x2b3)]({'name':_0x256c77[_0xd35af0(0x289)],'action':'error','error':_0x107815[_0xd35af0(0x261)]}),_0xb746c4[_0xd35af0(0x28f)][_0xd35af0(0x2bc)][_0xd35af0(0x1f8)]++;}}for(const _0x462755 of _0x3c0aa5){try{const _0x1bca76=yamlExperimentalArtifactToApi(_0x462755[_0xd35af0(0x291)],_0x51cb3e),_0x3f817c=await this[_0xd35af0(0x24c)][_0xd35af0(0x2d1)](_0x1bca76);_0x12b784[_0xd35af0(0x1e9)](_0x462755[_0xd35af0(0x291)][_0xd35af0(0x289)],_0x3f817c['id']),_0xb746c4[_0xd35af0(0x253)]['push']({'name':_0x462755[_0xd35af0(0x291)][_0xd35af0(0x289)],'action':_0xd35af0(0x26c),'id':_0x3f817c['id']}),_0xb746c4[_0xd35af0(0x28f)][_0xd35af0(0x253)][_0xd35af0(0x26c)]++;}catch(_0x1b5ec7){_0xb746c4[_0xd35af0(0x253)]['push']({'name':_0x462755[_0xd35af0(0x291)][_0xd35af0(0x289)],'action':'error','error':_0x1b5ec7[_0xd35af0(0x261)]}),_0xb746c4[_0xd35af0(0x28f)]['experimentalArtifacts'][_0xd35af0(0x1f8)]++;}}for(const _0x246af1 of _0x1c7789){try{const _0xed0859=yamlExperimentalKnowledgeBaseToApi(_0x246af1[_0xd35af0(0x291)],_0x51cb3e),_0x3a8c39=await this[_0xd35af0(0x24c)][_0xd35af0(0x2ae)](_0xed0859);_0xdeaf6[_0xd35af0(0x1e9)](_0x246af1[_0xd35af0(0x291)][_0xd35af0(0x289)],_0x3a8c39['id']),_0xb746c4[_0xd35af0(0x207)]['push']({'name':_0x246af1['def'][_0xd35af0(0x289)],'action':_0xd35af0(0x26c),'id':_0x3a8c39['id']}),_0xb746c4['counts'][_0xd35af0(0x207)][_0xd35af0(0x26c)]++;}catch(_0x5d9106){_0xb746c4[_0xd35af0(0x207)][_0xd35af0(0x2b3)]({'name':_0x246af1[_0xd35af0(0x291)][_0xd35af0(0x289)],'action':_0xd35af0(0x256),'error':_0x5d9106[_0xd35af0(0x261)]}),_0xb746c4[_0xd35af0(0x28f)][_0xd35af0(0x207)]['errors']++;}}const _0x3c2974=[..._0x109ab5][_0xd35af0(0x1fb)]((_0xce1df0,_0x56b627)=>{const _0xc25107=_0xd35af0,_0xe08305=_0xce1df0[_0xc25107(0x2b2)]['tools']?.[_0xc25107(0x29f)](_0x2d4c68=>_0x2d4c68[_0xc25107(0x25a)]===_0xc25107(0x28e))??![],_0x1fb021=_0x56b627[_0xc25107(0x2b2)][_0xc25107(0x2df)]?.['some'](_0xe3cc2b=>_0xe3cc2b['type']===_0xc25107(0x28e))??![];if(_0xe08305&&!_0x1fb021)return 0x1;if(!_0xe08305&&_0x1fb021)return-0x1;return 0x0;});for(const _0x3aadc1 of _0x3c2974){_0x5df205=[];try{const _0x1ce28c=_0x3aadc1[_0xd35af0(0x2b2)][_0xd35af0(0x2df)]?.['filter'](_0x5a1521=>{const _0x59cb4b=_0xd35af0;if(_0x5a1521[_0x59cb4b(0x25a)]===_0x59cb4b(0x28e)&&_0x5a1521[_0x59cb4b(0x208)]){const _0x420c6e=parseRef(_0x5a1521['target']);return _0x420c6e?.[_0x59cb4b(0x289)]===_0x3aadc1['yaml'][_0x59cb4b(0x289)];}return![];})??[];if(_0x1ce28c[_0xd35af0(0x215)]>0x0){const _0x428004=_0xd35af0(0x22b)+_0x3aadc1[_0xd35af0(0x2b2)][_0xd35af0(0x289)]+_0xd35af0(0x2a2)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this[_0xd35af0(0x2d8)]['warn'](_0x428004),_0x5df205[_0xd35af0(0x2b3)](_0x428004);}const _0x590631=await agentDefToRequest(_0x3aadc1['yaml'],_0x3aadc1['systemPrompt'],_0x3aadc1[_0xd35af0(0x283)],_0x3888c2),_0x465532=await this[_0xd35af0(0x24c)][_0xd35af0(0x2d0)](_0x590631);_0x28041f[_0xd35af0(0x1e9)](_0x3aadc1[_0xd35af0(0x2b2)][_0xd35af0(0x289)],_0x465532['id']),_0xb746c4[_0xd35af0(0x2ca)][_0xd35af0(0x2b3)]({'agentName':_0x3aadc1[_0xd35af0(0x2b2)]['name'],'action':_0xd35af0(0x26c),'agentId':_0x465532['id'],'warnings':_0x5df205[_0xd35af0(0x215)]>0x0?_0x5df205:undefined}),_0xb746c4['counts'][_0xd35af0(0x2ca)][_0xd35af0(0x26c)]++;}catch(_0x66613a){_0xb746c4['agents'][_0xd35af0(0x2b3)]({'agentName':_0x3aadc1[_0xd35af0(0x2b2)][_0xd35af0(0x289)],'action':_0xd35af0(0x256),'error':_0x66613a[_0xd35af0(0x261)],'warnings':_0x5df205[_0xd35af0(0x215)]>0x0?_0x5df205:undefined}),_0xb746c4['counts'][_0xd35af0(0x2ca)]['errors']++;}}for(const _0x7e6c7e of _0x39e4d){try{const _0x543096=await yamlPromptToApi(_0x7e6c7e[_0xd35af0(0x2b2)],_0x51cb3e,_0x3888c2);if(!_0x543096){_0xb746c4[_0xd35af0(0x1f9)][_0xd35af0(0x2b3)]({'name':_0x7e6c7e[_0xd35af0(0x2b2)][_0xd35af0(0x289)],'action':_0xd35af0(0x256),'error':_0xd35af0(0x243)}),_0xb746c4[_0xd35af0(0x28f)][_0xd35af0(0x1f9)][_0xd35af0(0x1f8)]++;continue;}const _0x11f19e=await this[_0xd35af0(0x24c)][_0xd35af0(0x2e5)](_0x543096);_0x2c455a[_0xd35af0(0x1e9)](_0x7e6c7e[_0xd35af0(0x2b2)][_0xd35af0(0x289)],_0x11f19e['id']),_0xb746c4[_0xd35af0(0x1f9)][_0xd35af0(0x2b3)]({'name':_0x7e6c7e[_0xd35af0(0x2b2)][_0xd35af0(0x289)],'action':_0xd35af0(0x26c),'id':_0x11f19e['id']}),_0xb746c4[_0xd35af0(0x28f)][_0xd35af0(0x1f9)][_0xd35af0(0x26c)]++;}catch(_0x1e42b9){_0xb746c4[_0xd35af0(0x1f9)][_0xd35af0(0x2b3)]({'name':_0x7e6c7e[_0xd35af0(0x2b2)][_0xd35af0(0x289)],'action':_0xd35af0(0x256),'error':_0x1e42b9[_0xd35af0(0x261)]}),_0xb746c4[_0xd35af0(0x28f)]['prompts'][_0xd35af0(0x1f8)]++;}}for(const _0x47dcff of _0x5c8e57){try{const _0x3a28f5=await yamlIntegrationToApi(_0x47dcff[_0xd35af0(0x2b2)],_0x51cb3e,_0x3888c2),_0x258d58=await this[_0xd35af0(0x24c)][_0xd35af0(0x288)](_0x3a28f5);_0xb746c4[_0xd35af0(0x2d7)][_0xd35af0(0x2b3)]({'name':_0x47dcff[_0xd35af0(0x2b2)][_0xd35af0(0x2a9)],'action':_0xd35af0(0x26c),'id':_0x258d58['id']}),_0xb746c4[_0xd35af0(0x28f)]['integrations'][_0xd35af0(0x26c)]++;}catch(_0x26a296){_0xb746c4['integrations'][_0xd35af0(0x2b3)]({'name':_0x47dcff['yaml'][_0xd35af0(0x2a9)],'action':'error','error':_0x26a296[_0xd35af0(0x261)]}),_0xb746c4['counts'][_0xd35af0(0x2d7)][_0xd35af0(0x1f8)]++;}}return _0xb746c4;}}
1
+ const a96_0x4932d2=a96_0x2ea9;(function(_0x4da36a,_0x3348a5){const _0x94d0ce=a96_0x2ea9,_0x5e55cc=_0x4da36a();while(!![]){try{const _0x27e070=parseInt(_0x94d0ce(0x184))/0x1*(parseInt(_0x94d0ce(0x190))/0x2)+-parseInt(_0x94d0ce(0xec))/0x3+-parseInt(_0x94d0ce(0x1c3))/0x4+parseInt(_0x94d0ce(0x1b5))/0x5*(parseInt(_0x94d0ce(0xc7))/0x6)+-parseInt(_0x94d0ce(0x13e))/0x7+parseInt(_0x94d0ce(0x161))/0x8*(-parseInt(_0x94d0ce(0x118))/0x9)+parseInt(_0x94d0ce(0x1a7))/0xa*(parseInt(_0x94d0ce(0x129))/0xb);if(_0x27e070===_0x3348a5)break;else _0x5e55cc['push'](_0x5e55cc['shift']());}catch(_0x132464){_0x5e55cc['push'](_0x5e55cc['shift']());}}}(a96_0x566d,0x44c14));import{LLMApiClient}from'../client/llm-api-client.js';import*as a96_0x12834e from'node:fs';import*as a96_0x35c8eb 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';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';function a96_0x2ea9(_0x177884,_0x27516b){_0x177884=_0x177884-0xc0;const _0x566d7a=a96_0x566d();let _0x2ea9c2=_0x566d7a[_0x177884];return _0x2ea9c2;}import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=['chat_generic','chat_agent_console',a96_0x4932d2(0x18f)];function a96_0x566d(){const _0x519960=['.yml','code.js','actions','tdx_default_','backupProject','Renamed\x20integration\x20file:\x20','listTextKnowledgeBases','exportedFrom','_reasoning_','code','Renamed\x20prompt\x20file:\x20','updateAgent','#\x20prompt.md\x0a','webhookCorsOrigins','Agent\x20not\x20found:\x20','\x27\x20(','agentId','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.','startChat','project','clearDefaultAgent','---\x20file:\x20','getDefaultAgent','isDirectory','782889MeSUjk','already\x20exists','setDefaultAgent','webSearchTools','utf-8','\x0a---\x20function:\x20','client','reasoningEffort','serviceType','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','yaml','tdx.json','listWebSearchTools','files','createExperimentalArtifact','target','version','duplicate','new','basename','counts','functions','listImageGenerators','createAgent','updatePrompt','createWebSearchTool','getBackupMetadata','slackMessageMode','deleteProject','unlinkSync','site','conflict','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','listKnowledgeBases','history','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','pushProject','length','newProjectId','agentsFull','chatIgnoreManagedActions','getDefaultProjectName','.llm','size','28170Ktjflb','pushAgent','agent','renamed','setCurrentProject','push','localeCompare','metadata','listAgentsFull','---\x20schema:\x20','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','createIntegration','status','.md','Skipping\x20integration\x20\x27','agents','integrations.json','3476OlLzEd','map','get','info','listExperimentalKnowledgeBases','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','Project\x20not\x20found:\x20','chats','updateExperimentalArtifact','pullProject','getCurrentProject','listProjects','Multiple\x20projects\x20found\x20with\x20name\x20\x27','isDir','readdirSync','web_search','errors','chatId','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','endsWith','\x20---\x0a','2964731cqdRty','context','event','dryRun','getChatInfo','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','logger','starter_message','updated','(dry-run)','Available\x20agents:\x20','cwd','\x0a---\x20schema:\x20','displayName','path','Agent\x20\x27','def','experimentalArtifacts','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','createKnowledgeBase','Renamed\x20experimental\x20KB\x20directory:\x20','updateTextKnowledgeBase','llm_project','Renamed\x20folder:\x20','json_schema','Unresolved\x20dependencies:\x20','listIntegrations','filter','tables','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','minimal','low','createProject','writeFileSync','projectId','1040nwIqDc','getParentSegmentKnowledgeBase','total','oldPath','Backup\x20folder\x20not\x20found:\x20','):\x20','resolveProjectName','currentProjectId','Renamed\x20agent\x20folder:\x20','listPrompts','includes','\x0a---\x20code\x20---\x0a','createExperimentalKnowledgeBase','template','systemPrompt','content','Agent\x20reference\x20not\x20found','listExperimentalArtifacts','set','Only\x20safe\x20types\x20(','deleteIntegration','getOrCreateDefaultProject','claude-4.5-sonnet','sdk.llm','createAgentResponse','resolveProjectId','chatWelcomeMessage','agent.yml','Unable\x20to\x20create\x20project\x20after\x20','dirname','existsSync',')\x20can\x20be\x20pushed.\x20','text_content','name','\x0a\x0a#\x20agent.yml\x0a','10513jHrnmX','join','high','\x22\x20already\x20exists','loadJsonFile','PERMISSION_DENIED','mkdirSync','modelType','sort','getAgent','prompts','chat_parent_segment','76ZLkUsp','description','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','temperature','experimental_knowledge_bases','has','parse','knowledge_bases','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','prompts.json','getChatHistory','tools','isFile','projectName','profile','AGENT_NOT_FOUND','deleteAgent','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','toLowerCase','createPrompt','Renamed\x20KB\x20file:\x20','resolveAgentId','INVALID_ARGUMENT','24180GtQXtw','isManaged','agents.json','imageGenerators','Project\x20\x22','statSync','prompt.md','type','stringify','\x27.\x20This\x20should\x20not\x20happen.','find','message','warn','restoreProject','5RQcjPI','tdx_','text','none','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','ALREADY_EXISTS','json_schema.json','signal','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','variables','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','readFileSync','attributes','experimentalKnowledgeBases','644828vgQuWw','integrations','getProject','getOrCreateDefaultAgent','starterMessage','updateAgentResponse','knowledgeBases','error','\x20→\x20','listAgents','Removed\x20deleted\x20directory:\x20','Multiple\x20agents\x20found\x20with\x20name\x20\x27','file_name','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','chatInfo','dry-run-','jsonSchemaHint','image_gen','NOT_FOUND','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','INTERNAL','pullAgent','rmSync','2223846rVgMpU','project.json','some','add','unchanged','toISOString','textKnowledgeBases','starter_message.md','service_type','created','agent.yml\x20not\x20found\x20in\x20','Removed\x20deleted\x20file:\x20','promptId'];a96_0x566d=function(){return _0x519960;};return a96_0x566d();}export class LLMSDK{[a96_0x4932d2(0x168)];[a96_0x4932d2(0xf2)];['context'];[a96_0x4932d2(0x144)]=Logger['of'](a96_0x4932d2(0x178));constructor(_0x291458){const _0x51e81a=a96_0x4932d2;this[_0x51e81a(0xf2)]=new LLMApiClient(_0x291458),this[_0x51e81a(0x13f)]=_0x291458;}['getDefaultProjectName'](){const _0x4fad37=a96_0x4932d2,_0x5748d7=getSanitizedUsername();return _0x4fad37(0xd7)+_0x5748d7;}async[a96_0x4932d2(0x11c)](_0xa1605d){const _0x4d9bc3=a96_0x4932d2,{projectId:_0xab68ac}=await this[_0x4d9bc3(0x167)](_0xa1605d);this[_0x4d9bc3(0x168)]=_0xab68ac;}[a96_0x4932d2(0x133)](){const _0x399e5e=a96_0x4932d2;return this[_0x399e5e(0x168)];}async[a96_0x4932d2(0xee)](_0x8f3a0c){const _0x25591e=a96_0x4932d2,_0x419c1c=this[_0x25591e(0x13f)][_0x25591e(0x19e)];let _0xd644d2,_0x5f2453;if(_0x8f3a0c[_0x25591e(0x16b)]('/')){const _0xc3b3b0=_0x8f3a0c['split']('/');if(_0xc3b3b0['length']!==0x2)throw new SDKError(ErrorCode[_0x25591e(0x1a6)],'Invalid\x20agent\x20reference\x20format:\x20'+_0x8f3a0c,undefined,{'helpText':_0x25591e(0x1bf)});const [_0x3fdb9c,_0x404537]=_0xc3b3b0;_0xd644d2=await this['resolveProjectId'](_0x3fdb9c),_0x5f2453=_0x404537;}else _0xd644d2=this[_0x25591e(0x168)]||(await this[_0x25591e(0x176)]())['id'],_0x5f2453=_0x8f3a0c;const _0x59f91f=await this['resolveAgentId'](_0x5f2453,_0xd644d2),_0x4c837b=await this[_0x25591e(0xf2)][_0x25591e(0x18d)](_0x59f91f);writeCachedLLMAgent(_0x4c837b['attributes']['name'],_0x59f91f,_0xd644d2,_0x419c1c);}[a96_0x4932d2(0xea)](){const _0x3aafe5=a96_0x4932d2,_0x1a3451=this[_0x3aafe5(0x13f)][_0x3aafe5(0x19e)];return readCachedLLMAgent(_0x1a3451)||undefined;}[a96_0x4932d2(0xe8)](){const _0x3e5521=a96_0x4932d2,_0x1ffc46=this[_0x3e5521(0x13f)][_0x3e5521(0x19e)];clearCachedLLMAgent(_0x1ffc46);}async['models'](){const _0x4cabbb=a96_0x4932d2,_0x33bfe0=await this['client']['getUserSettings'](),_0x45e34c=[];for(const _0x1f7d9d of _0x33bfe0['availableModelNames']){const _0x353660=_0x33bfe0['availableModels'][_0x1f7d9d];_0x353660&&_0x45e34c[_0x4cabbb(0x11d)]({'name':_0x1f7d9d,'displayName':_0x353660[_0x4cabbb(0x14b)]});}return _0x45e34c;}async['createProject'](_0x206821){const _0x52ce02=a96_0x4932d2;return await this[_0x52ce02(0xf2)][_0x52ce02(0x15e)](_0x206821);}async['deleteProject'](_0x1f7cde){const _0x1c42b4=a96_0x4932d2,{projectId:_0x3133a7}=await this[_0x1c42b4(0x167)](_0x1f7cde);await this[_0x1c42b4(0xf2)][_0x1c42b4(0x108)](_0x3133a7);}async['projects'](_0x586c6e=0x32){const _0x3c23ca=a96_0x4932d2;return await this[_0x3c23ca(0xf2)][_0x3c23ca(0x134)](_0x586c6e);}async[a96_0x4932d2(0x176)](_0x5035ce){const _0x1cfe90=a96_0x4932d2,_0x309347=_0x5035ce||this[_0x1cfe90(0x115)](),_0x282e36=this[_0x1cfe90(0x13f)]['profile'];if(!_0x5035ce){const _0x160b51=readCachedLLMProject(_0x282e36);if(_0x160b51&&_0x160b51[_0x1cfe90(0x182)]===_0x309347)try{const _0x34d40e=await this[_0x1cfe90(0xf2)][_0x1cfe90(0x1c5)](_0x160b51['id']);if(_0x34d40e[_0x1cfe90(0x1c1)][_0x1cfe90(0x182)]===_0x309347)return _0x34d40e;}catch{}}const _0x1dcc19=await this['client'][_0x1cfe90(0x134)](),_0x2d4bde=_0x1dcc19[_0x1cfe90(0x1b1)](_0x506dc8=>_0x506dc8[_0x1cfe90(0x1c1)][_0x1cfe90(0x182)]===_0x309347);if(_0x2d4bde)return!_0x5035ce&&writeCachedLLMProject(_0x309347,_0x2d4bde['id'],_0x282e36),_0x2d4bde;const _0x49d31e=await this[_0x1cfe90(0xf2)][_0x1cfe90(0x15e)]({'name':_0x309347,'description':_0x1cfe90(0x1d0)+getSanitizedUsername()+')'});return!_0x5035ce&&writeCachedLLMProject(_0x309347,_0x49d31e['id'],_0x282e36),_0x49d31e;}async[a96_0x4932d2(0x17a)](_0x3e88a2){const _0x1c5f4e=a96_0x4932d2,_0x176745=await this[_0x1c5f4e(0xf2)]['listProjects'](),_0x1499b4=_0x176745['filter'](_0x2d332c=>_0x2d332c['attributes']['name']===_0x3e88a2);if(_0x1499b4[_0x1c5f4e(0x111)]===0x0)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x1c5f4e(0x12f)+_0x3e88a2,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x1499b4[_0x1c5f4e(0x111)]>0x1)throw new SDKError(ErrorCode[_0x1c5f4e(0xc4)],_0x1c5f4e(0x135)+_0x3e88a2+_0x1c5f4e(0x1b0));return _0x1499b4[0x0]['id'];}async[a96_0x4932d2(0x167)](_0x199e0f){const _0x1fd3cd=a96_0x4932d2,_0x1623af=await this[_0x1fd3cd(0xf2)][_0x1fd3cd(0x134)](),_0x47daf4=_0x1623af[_0x1fd3cd(0x1b1)](_0x2a6fa1=>_0x2a6fa1['attributes']['name']===_0x199e0f);if(_0x47daf4)return{'projectId':_0x47daf4['id'],'project':_0x47daf4};throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0x199e0f,undefined,{'helpText':_0x1fd3cd(0x1b9)});}async[a96_0x4932d2(0x1c6)](_0x30967e=a96_0x4932d2(0x177),_0x2203d5=0x0,_0x45d98a){const _0x2d7ee0=a96_0x4932d2,_0x42861e=0xa;let _0xa1e67c=0x0,_0x317752;while(_0xa1e67c<_0x42861e){try{const _0x57909b=await this[_0x2d7ee0(0x176)](_0x317752),_0x5c4aba=_0x57909b['id'],_0x20d0d1=[_0x2d7ee0(0x1b8),_0x2d7ee0(0x15c),_0x2d7ee0(0x15d),'medium',_0x2d7ee0(0x186)],_0x53e977=_0x2203d5===0x0?_0x2d7ee0(0x1b6)+_0x30967e:_0x2d7ee0(0x1b6)+_0x30967e+_0x2d7ee0(0xdc)+_0x20d0d1[_0x2203d5],_0xeb49c=await this['client']['listAgents'](_0x5c4aba),_0x584e24=_0xeb49c['find'](_0x118e61=>_0x118e61['attributes'][_0x2d7ee0(0x182)]===_0x53e977);if(_0x584e24)return _0x584e24;const _0x4efb1c=_0x2203d5>0x0?0x1:_0x45d98a;return await this[_0x2d7ee0(0xf2)][_0x2d7ee0(0x103)]({'name':_0x53e977,'projectId':_0x5c4aba,'modelType':_0x30967e,'systemPrompt':'','temperature':_0x4efb1c,'reasoningEffort':_0x2203d5>0x0?_0x2203d5:undefined});}catch(_0x3272fa){if(_0x3272fa instanceof HTTPClientError){const _0x1dd7db=_0x3272fa[_0x2d7ee0(0x124)];if(_0x1dd7db>=0x190&&_0x1dd7db<0x1f4){if(_0x1dd7db===0x191)throw new SDKError(ErrorCode['UNAUTHENTICATED'],_0x2d7ee0(0x1bd),_0x3272fa);else{if(_0x1dd7db===0x193)throw new SDKError(ErrorCode[_0x2d7ee0(0x189)],_0x2d7ee0(0x10f),_0x3272fa);}throw _0x3272fa;}}if(errorContains(_0x3272fa,_0x2d7ee0(0xed),_0x2d7ee0(0xfd),_0x2d7ee0(0x10b))){_0xa1e67c++;if(_0xa1e67c>=_0x42861e)throw new SDKError(ErrorCode[_0x2d7ee0(0x1ba)],_0x2d7ee0(0x17d)+_0x42861e+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x3272fa);const _0x9b090f=this['getDefaultProjectName']();_0x317752=_0x9b090f+'_'+generateRandomHex();continue;}throw _0x3272fa;}}throw new SDKError(ErrorCode[_0x2d7ee0(0xc4)],_0x2d7ee0(0x13b));}async[a96_0x4932d2(0x1a5)](_0x238be0,_0x1c860d){const _0x23ab9c=a96_0x4932d2,_0x5b304e=_0x1c860d||this[_0x23ab9c(0x168)],_0x3b0d7f=await this[_0x23ab9c(0xf2)][_0x23ab9c(0x1cc)](_0x5b304e),_0x21229f=_0x3b0d7f[_0x23ab9c(0x159)](_0x362a17=>_0x362a17[_0x23ab9c(0x1c1)][_0x23ab9c(0x182)]===_0x238be0);if(_0x21229f[_0x23ab9c(0x111)]===0x0){const _0x2847bc=_0x5b304e?'\x20in\x20project\x20'+_0x5b304e:'';throw new SDKError(ErrorCode[_0x23ab9c(0x19f)],_0x23ab9c(0xe2)+_0x238be0+_0x2847bc,undefined,{'helpText':_0x5b304e?_0x23ab9c(0x192):_0x23ab9c(0xe5)});}if(_0x21229f[_0x23ab9c(0x111)]>0x1)throw new SDKError(ErrorCode[_0x23ab9c(0xc4)],_0x23ab9c(0x1ce)+_0x238be0+'\x27.\x20This\x20should\x20not\x20happen.');return _0x21229f[0x0]['id'];}async[a96_0x4932d2(0x127)](_0x15c783){const _0x29387d=a96_0x4932d2,_0x5a5f1c=_0x15c783||this[_0x29387d(0x168)];return await this[_0x29387d(0xf2)][_0x29387d(0x1cc)](_0x5a5f1c);}async[a96_0x4932d2(0x113)](_0x3be4a3){const _0x2a14c9=a96_0x4932d2;return await this['client'][_0x2a14c9(0x120)](_0x3be4a3);}async[a96_0x4932d2(0x11a)](_0x550cac){return await this['client']['getAgent'](_0x550cac);}async[a96_0x4932d2(0x103)](_0x41d756){const _0x5c6e52=a96_0x4932d2;return await this[_0x5c6e52(0xf2)][_0x5c6e52(0x103)](_0x41d756);}async[a96_0x4932d2(0xdf)](_0x2dcd83,_0x10bc72){return await this['client']['updateAgent'](_0x2dcd83,_0x10bc72);}async[a96_0x4932d2(0x1a0)](_0x48f386){const _0x587a10=a96_0x4932d2;await this[_0x587a10(0xf2)][_0x587a10(0x1a0)](_0x48f386);}async['startChat'](_0x2d5c7b){const _0x40460f=a96_0x4932d2;return await this[_0x40460f(0xf2)][_0x40460f(0xe6)]({'agentId':_0x2d5c7b});}async*['chat'](_0x390c45,_0x270048){const _0x3a2684=a96_0x4932d2;let _0x12877c=_0x270048?.[_0x3a2684(0x13a)];const _0x1c7d68=_0x270048?.['agentId'];if(!_0x12877c){if(!_0x1c7d68)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x2f67bf=await this[_0x3a2684(0xf2)]['startChat']({'agentId':_0x1c7d68});_0x12877c=_0x2f67bf['id'],yield{'type':_0x3a2684(0x11f),'data':{'chatId':_0x12877c,'agentId':_0x1c7d68,'projectId':_0x2f67bf[_0x3a2684(0x1c1)][_0x3a2684(0x160)]}};}for await(const _0x45c365 of this[_0x3a2684(0xf2)]['continueChat'](_0x12877c,_0x390c45,_0x270048?.[_0x3a2684(0x1bc)])){yield{'type':_0x3a2684(0x140),'data':_0x45c365};}}async[a96_0x4932d2(0x130)](_0x173e74=0x32){const _0xe5e7c5=a96_0x4932d2;return await this[_0xe5e7c5(0xf2)]['listChats'](_0x173e74);}async[a96_0x4932d2(0x10e)](_0x480b87){const _0x5e0588=a96_0x4932d2;return await this[_0x5e0588(0xf2)][_0x5e0588(0x19a)](_0x480b87);}async['getChatLog'](_0x3ad0ce){const _0x1946c9=a96_0x4932d2;return await this[_0x1946c9(0xf2)]['getChatLog'](_0x3ad0ce);}async[a96_0x4932d2(0x1d2)](_0x4e4cf0){const _0x2ad4c6=a96_0x4932d2;return await this[_0x2ad4c6(0xf2)][_0x2ad4c6(0x142)](_0x4e4cf0);}async[a96_0x4932d2(0xd8)](_0x4bcccf,_0x173fcf,_0x3666b8){const _0x5c29ff=a96_0x4932d2,_0x16c9fd=_0x3666b8?.['dryRun']??![],{projectId:_0x228e0e,project:_0x47102f}=await this[_0x5c29ff(0x167)](_0x4bcccf),_0x18a464=_0x47102f['attributes'][_0x5c29ff(0x182)],_0x3f97ca=_0x173fcf||_0x18a464+_0x5c29ff(0x116);if(a96_0x12834e[_0x5c29ff(0x17f)](_0x3f97ca)&&!_0x16c9fd)throw new SDKError(ErrorCode[_0x5c29ff(0x1ba)],'Output\x20directory\x20already\x20exists:\x20'+_0x3f97ca,undefined,{'helpText':_0x5c29ff(0x15b)});const _0x52dd1b=await this[_0x5c29ff(0xf2)]['listAgentsFull'](_0x228e0e),_0x3a9498=await this[_0x5c29ff(0xf2)]['listKnowledgeBases'](_0x228e0e),_0x4195b2=await this[_0x5c29ff(0xf2)]['listPrompts'](_0x228e0e),_0x57a7d3=await this['client'][_0x5c29ff(0x158)](_0x228e0e);if(!_0x16c9fd){a96_0x12834e['mkdirSync'](_0x3f97ca,{'recursive':!![]});const _0x2fc675={'version':'1.0','exportedAt':new Date()[_0x5c29ff(0xcc)](),'exportedFrom':{'site':this['context'][_0x5c29ff(0x10a)],'projectId':_0x228e0e,'projectName':_0x18a464},'project':_0x47102f};a96_0x12834e[_0x5c29ff(0x15f)](a96_0x35c8eb[_0x5c29ff(0x185)](_0x3f97ca,_0x5c29ff(0xc8)),JSON[_0x5c29ff(0x1af)](_0x2fc675,null,0x2)),a96_0x12834e[_0x5c29ff(0x15f)](a96_0x35c8eb['join'](_0x3f97ca,_0x5c29ff(0x1a9)),JSON['stringify'](_0x52dd1b,null,0x2)),a96_0x12834e[_0x5c29ff(0x15f)](a96_0x35c8eb[_0x5c29ff(0x185)](_0x3f97ca,'knowledgebases.json'),JSON[_0x5c29ff(0x1af)](_0x3a9498,null,0x2)),a96_0x12834e['writeFileSync'](a96_0x35c8eb[_0x5c29ff(0x185)](_0x3f97ca,'prompts.json'),JSON['stringify'](_0x4195b2,null,0x2)),a96_0x12834e[_0x5c29ff(0x15f)](a96_0x35c8eb[_0x5c29ff(0x185)](_0x3f97ca,_0x5c29ff(0x128)),JSON[_0x5c29ff(0x1af)](_0x57a7d3,null,0x2));}return{'projectName':_0x18a464,'outputDir':_0x3f97ca,'counts':{'agents':_0x52dd1b['length'],'knowledgeBases':_0x3a9498[_0x5c29ff(0x111)],'prompts':_0x4195b2[_0x5c29ff(0x111)],'integrations':_0x57a7d3[_0x5c29ff(0x111)]}};}async[a96_0x4932d2(0x1b4)](_0x240364,_0x5cde49){const _0x37feec=a96_0x4932d2,_0x31ad2d=_0x5cde49?.['dryRun']??![],_0xb65fd=this[_0x37feec(0x106)](_0x240364),_0x488006=_0xb65fd['exportedFrom'][_0x37feec(0x10a)],_0x4a02f3=this['context'][_0x37feec(0x10a)],_0x31209c=_0x488006!==_0x4a02f3?_0x488006:undefined,_0x31d2c1=this[_0x37feec(0x188)](a96_0x35c8eb[_0x37feec(0x185)](_0x240364,_0x37feec(0x1a9)),[]),_0x19be74=this[_0x37feec(0x188)](a96_0x35c8eb[_0x37feec(0x185)](_0x240364,'knowledgebases.json'),[]),_0x5646ab=this['loadJsonFile'](a96_0x35c8eb[_0x37feec(0x185)](_0x240364,_0x37feec(0x199)),[]),_0x5c8631=this[_0x37feec(0x188)](a96_0x35c8eb[_0x37feec(0x185)](_0x240364,_0x37feec(0x128)),[]),_0x258d99=_0x5cde49?.['name']||_0xb65fd[_0x37feec(0xdb)][_0x37feec(0x19d)];if(_0x31ad2d){const _0x187293=new Map(),_0x26b6c4=[..._0x31d2c1],_0x28ef5f=_0x31d2c1[_0x37feec(0x111)]+0x1;let _0x2a060b=0x0;while(_0x26b6c4['length']>0x0&&_0x2a060b<_0x28ef5f){_0x2a060b++;const _0x2f3a1c=[];for(const _0x1fdc48 of _0x26b6c4){canCreateAgent(_0x1fdc48,_0x187293)?_0x187293[_0x37feec(0x173)](_0x1fdc48['id'],_0x37feec(0x1d3)+_0x1fdc48['id']):_0x2f3a1c[_0x37feec(0x11d)](_0x1fdc48);}if(_0x2f3a1c[_0x37feec(0x111)]===_0x26b6c4['length'])throw new SDKError(ErrorCode[_0x37feec(0xc4)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x37feec(0x122)});_0x26b6c4[_0x37feec(0x111)]=0x0,_0x26b6c4[_0x37feec(0x11d)](..._0x2f3a1c);}const _0x4a01ed=_0x5646ab[_0x37feec(0x159)](_0x391e72=>_0x187293[_0x37feec(0x195)](_0x391e72[_0x37feec(0x1c1)][_0x37feec(0xe4)]))[_0x37feec(0x111)];return{'projectName':_0x258d99,'projectId':_0x37feec(0x147),'counts':{'agents':_0x31d2c1[_0x37feec(0x111)],'knowledgeBases':_0x19be74[_0x37feec(0x111)],'prompts':_0x4a01ed,'integrations':_0x5c8631[_0x37feec(0x111)]},'sourceSite':_0x31209c};}const _0x52f1c2=await this[_0x37feec(0xf2)][_0x37feec(0x15e)]({'name':_0x258d99,'description':_0xb65fd[_0x37feec(0xe7)][_0x37feec(0x1c1)][_0x37feec(0x191)]}),_0x3384f9=_0x52f1c2['id'],_0xc0f2fd=new Map(),_0x4ea918=new Map(),_0x4d91fa=new Map();for(const _0x2f5f67 of _0x19be74){const _0x1a8f4f=await this[_0x37feec(0xf2)]['createKnowledgeBase']({'projectId':_0x3384f9,'name':_0x2f5f67['attributes']['name'],'tdDatabaseName':_0x2f5f67[_0x37feec(0x1c1)]['tdDatabaseName'],'tables':_0x2f5f67[_0x37feec(0x1c1)][_0x37feec(0x15a)]});_0xc0f2fd['set'](_0x2f5f67['id'],_0x1a8f4f['id']);}const _0x5bcfa7=[..._0x31d2c1],_0x169b19=_0x31d2c1[_0x37feec(0x111)]+0x1;let _0x2e6932=0x0;while(_0x5bcfa7[_0x37feec(0x111)]>0x0&&_0x2e6932<_0x169b19){_0x2e6932++;const _0x5e23db=[];for(const _0x2c2315 of _0x5bcfa7){if(canCreateAgent(_0x2c2315,_0x4ea918)){const _0x55e2e3=remapToolIds(_0x2c2315[_0x37feec(0x1c1)][_0x37feec(0x19b)],_0xc0f2fd,_0x4ea918),_0x45d6d1=remapVariableIds(_0x2c2315[_0x37feec(0x1c1)][_0x37feec(0x1be)],_0xc0f2fd),_0x25fafd=await this[_0x37feec(0xf2)][_0x37feec(0x179)]({'name':_0x2c2315[_0x37feec(0x1c1)][_0x37feec(0x182)],'projectId':_0x3384f9,'systemPrompt':_0x2c2315[_0x37feec(0x1c1)][_0x37feec(0x16f)],'starterMessage':_0x2c2315[_0x37feec(0x1c1)][_0x37feec(0x1c7)],'modelType':migrateModelType(_0x2c2315[_0x37feec(0x1c1)][_0x37feec(0x18b)]),'maxToolIterations':_0x2c2315['attributes']['maxToolIterations'],'temperature':_0x2c2315['attributes'][_0x37feec(0x193)],'reasoningEffort':_0x2c2315[_0x37feec(0x1c1)][_0x37feec(0xf3)],'outputs':_0x2c2315[_0x37feec(0x1c1)]['outputs'],'tools':_0x55e2e3,'variables':_0x45d6d1});_0x4ea918[_0x37feec(0x173)](_0x2c2315['id'],_0x25fafd['id']);}else _0x5e23db[_0x37feec(0x11d)](_0x2c2315);}if(_0x5e23db['length']===_0x5bcfa7['length'])throw new SDKError(ErrorCode[_0x37feec(0xc4)],_0x37feec(0x1d1),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x5bcfa7[_0x37feec(0x111)]=0x0,_0x5bcfa7['push'](..._0x5e23db);}for(const _0x2ba1a9 of _0x5646ab){const _0x5ab4b4=_0x4ea918[_0x37feec(0x12b)](_0x2ba1a9['attributes'][_0x37feec(0xe4)]);if(!_0x5ab4b4)continue;const _0x3aa114=await this[_0x37feec(0xf2)][_0x37feec(0x1a3)]({'projectId':_0x3384f9,'agentId':_0x5ab4b4,'name':_0x2ba1a9[_0x37feec(0x1c1)][_0x37feec(0x182)],'systemPrompt':_0x2ba1a9[_0x37feec(0x1c1)]['systemPrompt'],'template':_0x2ba1a9[_0x37feec(0x1c1)][_0x37feec(0x16e)],'jsonSchemaHint':_0x2ba1a9[_0x37feec(0x1c1)][_0x37feec(0xc0)]});_0x4d91fa['set'](_0x2ba1a9['id'],_0x3aa114['id']);}for(const _0x334649 of _0x5c8631){const _0x2f4c32=_0x334649['attributes'][_0x37feec(0xd6)][_0x37feec(0x12a)](_0x28f7b1=>({..._0x28f7b1,'promptId':_0x4d91fa[_0x37feec(0x12b)](_0x28f7b1[_0x37feec(0xd3)])||_0x28f7b1[_0x37feec(0xd3)]}));await this[_0x37feec(0xf2)][_0x37feec(0x123)]({'projectId':_0x3384f9,'serviceType':_0x334649[_0x37feec(0x1c1)]['serviceType'],'actions':_0x2f4c32,'slackMessageMode':_0x334649['attributes'][_0x37feec(0x107)],'chatIgnoreManagedActions':_0x334649[_0x37feec(0x1c1)][_0x37feec(0x114)],'chatWelcomeMessage':_0x334649['attributes'][_0x37feec(0x17b)],'webhookCorsOrigins':_0x334649[_0x37feec(0x1c1)][_0x37feec(0xe1)]});}return{'projectName':_0x258d99,'projectId':_0x3384f9,'counts':{'agents':_0x4ea918[_0x37feec(0x117)],'knowledgeBases':_0xc0f2fd[_0x37feec(0x117)],'prompts':_0x4d91fa[_0x37feec(0x117)],'integrations':_0x5c8631[_0x37feec(0x111)]},'sourceSite':_0x31209c};}[a96_0x4932d2(0x188)](_0x248c61,_0x4a1991){const _0x26e8bb=a96_0x4932d2;if(!a96_0x12834e[_0x26e8bb(0x17f)](_0x248c61))return _0x4a1991;return JSON[_0x26e8bb(0x196)](a96_0x12834e[_0x26e8bb(0x1c0)](_0x248c61,_0x26e8bb(0xf0)));}[a96_0x4932d2(0x106)](_0x598f56){const _0x137afb=a96_0x4932d2;if(!a96_0x12834e[_0x137afb(0x17f)](_0x598f56))throw new SDKError(ErrorCode[_0x137afb(0xc2)],_0x137afb(0x165)+_0x598f56,undefined,{'helpText':_0x137afb(0xf5)});const _0xbe629d=a96_0x35c8eb['join'](_0x598f56,_0x137afb(0xc8));if(!a96_0x12834e[_0x137afb(0x17f)](_0xbe629d))throw new SDKError(ErrorCode[_0x137afb(0x1a6)],'Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20'+_0x598f56,undefined,{'helpText':_0x137afb(0x198)});const _0x35be59=JSON[_0x137afb(0x196)](a96_0x12834e[_0x137afb(0x1c0)](_0xbe629d,'utf-8'));if(!isSupportedBackupVersion(_0x35be59[_0x137afb(0xfc)]))throw new SDKError(ErrorCode[_0x137afb(0x1a6)],'Unsupported\x20backup\x20version:\x20'+_0x35be59[_0x137afb(0xfc)],undefined,{'helpText':_0x137afb(0x150)});return _0x35be59;}async[a96_0x4932d2(0x132)](_0x16f9e6,_0x5e3d81,_0x3d4581){const _0x52d42f=a96_0x4932d2,{projectId:_0x5372e0,project:_0x3f08ce}=await this[_0x52d42f(0x167)](_0x16f9e6),_0x5549b8=_0x3f08ce[_0x52d42f(0x1c1)][_0x52d42f(0x182)];let _0x21a96b;if(_0x5e3d81)_0x21a96b=_0x5e3d81;else{const _0x428eb9=a96_0x35c8eb[_0x52d42f(0x185)](process[_0x52d42f(0x149)](),_0x52d42f(0x127)),_0x5d3505=getSanitizedPathWithMigration(_0x428eb9,_0x5549b8);_0x5d3505[_0x52d42f(0x11b)]&&this[_0x52d42f(0x144)][_0x52d42f(0x12c)](_0x52d42f(0x155)+a96_0x35c8eb[_0x52d42f(0xff)](_0x5d3505['oldPath'])+'\x20→\x20'+a96_0x35c8eb[_0x52d42f(0xff)](_0x5d3505[_0x52d42f(0x14c)])),_0x21a96b=_0x5d3505[_0x52d42f(0x14c)];}const _0x32e1bf=await this['client'][_0x52d42f(0x120)](_0x5372e0),_0x53aaff=await this[_0x52d42f(0xf2)][_0x52d42f(0x10d)](_0x5372e0),_0x340142=await this[_0x52d42f(0xf2)][_0x52d42f(0xda)](_0x5372e0),_0x5c6c8d=await this['client'][_0x52d42f(0x102)](_0x5372e0),_0x7bc846=await this[_0x52d42f(0xf2)][_0x52d42f(0xf8)](_0x5372e0),_0x4087a4=await this[_0x52d42f(0xf2)]['listPrompts'](_0x5372e0),_0x4f9f78=await this['client']['listIntegrations'](_0x5372e0),_0x5bad1b=await this[_0x52d42f(0xf2)]['listExperimentalKnowledgeBases'](_0x5372e0),_0x2c3213=await this[_0x52d42f(0xf2)]['listExperimentalArtifacts'](_0x5372e0),_0x508127=_0x4f9f78[_0x52d42f(0x159)](_0x5d8255=>!_0x5d8255[_0x52d42f(0x1c1)][_0x52d42f(0x1a8)]&&SAFE_INTEGRATION_TYPES['includes'](_0x5d8255['attributes']['serviceType']['toLowerCase']())),_0x59dede=new Map(),_0x25301a=new Map(),_0x511005=new Map(),_0x3b40e2=new Map(),_0x510c95=new Map(),_0x46312d=new Map(),_0x10bc35=new Map();for(const _0x9bba5c of _0x32e1bf){_0x59dede[_0x52d42f(0x173)](_0x9bba5c['id'],_0x9bba5c[_0x52d42f(0x1c1)][_0x52d42f(0x182)]);}for(const _0x52fb01 of _0x53aaff){_0x25301a[_0x52d42f(0x173)](_0x52fb01['id'],_0x52fb01[_0x52d42f(0x1c1)][_0x52d42f(0x182)]);}for(const _0x169bac of _0x340142){_0x511005[_0x52d42f(0x173)](_0x169bac['id'],_0x169bac[_0x52d42f(0x1c1)][_0x52d42f(0x182)]);}for(const _0xea55fb of _0x5c6c8d){_0x3b40e2[_0x52d42f(0x173)](_0xea55fb['id'],_0xea55fb['attributes'][_0x52d42f(0x182)]);}for(const _0x395899 of _0x7bc846){_0x510c95['set'](_0x395899['id'],_0x395899[_0x52d42f(0x1c1)][_0x52d42f(0x182)]);}for(const _0x5737ac of _0x4087a4){_0x46312d['set'](_0x5737ac['id'],_0x5737ac['attributes'][_0x52d42f(0x182)]);}for(const _0x1155a9 of _0x5bad1b){_0x10bc35['set'](_0x1155a9['id'],_0x1155a9[_0x52d42f(0x1c1)][_0x52d42f(0x182)]);}const _0x209799={'resolveKnowledgeBaseName':async _0x396a26=>_0x25301a[_0x52d42f(0x12b)](_0x396a26),'resolveTextKnowledgeBaseName':async _0x24950f=>_0x511005['get'](_0x24950f),'resolveAgentName':async _0x39ab45=>_0x59dede[_0x52d42f(0x12b)](_0x39ab45),'resolveWebSearchToolName':async _0x19614a=>_0x510c95[_0x52d42f(0x12b)](_0x19614a),'resolveImageGeneratorName':async _0x3c308c=>_0x3b40e2[_0x52d42f(0x12b)](_0x3c308c),'resolvePromptName':async _0x443530=>_0x46312d[_0x52d42f(0x12b)](_0x443530),'resolveExperimentalKnowledgeBaseName':async _0xb39ce2=>_0x10bc35['get'](_0xb39ce2),'onWarning':_0xb09907=>this[_0x52d42f(0x144)][_0x52d42f(0x1b3)](_0xb09907)},_0x53a43f={'projectName':_0x5549b8,'outputDir':_0x21a96b,'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}}},_0x307733=[],_0x1fbc92=[];for(const _0x275ffc of _0x32e1bf){const _0xdd7fb7=getSanitizedPathWithMigration(_0x21a96b,_0x275ffc[_0x52d42f(0x1c1)][_0x52d42f(0x182)]);_0xdd7fb7['renamed']&&this[_0x52d42f(0x144)][_0x52d42f(0x12c)](_0x52d42f(0x169)+a96_0x35c8eb[_0x52d42f(0xff)](_0xdd7fb7[_0x52d42f(0x164)])+'\x20→\x20'+a96_0x35c8eb[_0x52d42f(0xff)](_0xdd7fb7[_0x52d42f(0x14c)]));const _0x3d9e35=_0xdd7fb7[_0x52d42f(0x14c)],_0x165031=a96_0x35c8eb[_0x52d42f(0x185)](_0x3d9e35,_0x52d42f(0x1ad)),_0x36955d=a96_0x35c8eb['join'](_0x3d9e35,_0x52d42f(0x17c)),_0x5b80c5=a96_0x35c8eb[_0x52d42f(0x185)](_0x3d9e35,_0x52d42f(0xce)),{yaml:_0x1254e4,systemPrompt:_0x4b09a7,starterMessage:_0x3dd02e}=await agentResponseToDef(_0x275ffc,_0x209799),_0xe2f0be=toAgentYamlString(_0x1254e4),_0x203a3b=!a96_0x12834e['existsSync'](_0x36955d);let _0x3ce859=_0x203a3b,_0x69a0a3;if(!_0x203a3b){const _0x5b222d=a96_0x12834e['existsSync'](_0x165031)?a96_0x12834e['readFileSync'](_0x165031,_0x52d42f(0xf0)):'',_0x5cd4f7=a96_0x12834e[_0x52d42f(0x1c0)](_0x36955d,'utf-8'),_0x54ddc4=_0x52d42f(0xe0)+_0x5b222d+_0x52d42f(0x183)+_0x5cd4f7,_0x4aeff2=_0x52d42f(0xe0)+_0x4b09a7+_0x52d42f(0x183)+_0xe2f0be,_0x3fc9da=generateDiff(_0x54ddc4,_0x4aeff2);_0x3ce859=hasChanges(_0x3fc9da),_0x3ce859&&(_0x69a0a3=formatDiffWithColors(_0x3fc9da));}_0x307733[_0x52d42f(0x11d)]({'path':_0x3d9e35,'content':'','isDir':!![]}),_0x307733[_0x52d42f(0x11d)]({'path':_0x165031,'content':_0x4b09a7}),_0x307733[_0x52d42f(0x11d)]({'path':_0x36955d,'content':_0xe2f0be});_0x3dd02e&&_0x3dd02e[_0x52d42f(0x16b)]('\x0a')&&_0x307733[_0x52d42f(0x11d)]({'path':_0x5b80c5,'content':_0x3dd02e});_0x53a43f[_0x52d42f(0x127)][_0x52d42f(0x11d)]({'agentName':_0x275ffc['attributes'][_0x52d42f(0x182)],'outputPath':_0x3d9e35,'isNew':_0x203a3b,'hasChanges':_0x3ce859,'diff':_0x69a0a3}),_0x53a43f[_0x52d42f(0x100)][_0x52d42f(0x127)][_0x52d42f(0x163)]++;if(_0x203a3b)_0x53a43f[_0x52d42f(0x100)][_0x52d42f(0x127)][_0x52d42f(0xfe)]++;else{if(_0x3ce859)_0x53a43f['counts'][_0x52d42f(0x127)][_0x52d42f(0x146)]++;else _0x53a43f[_0x52d42f(0x100)]['agents']['unchanged']++;}}for(const _0x35d2af of _0x53aaff){if(_0x35d2af[_0x52d42f(0x1c1)][_0x52d42f(0x1a8)])continue;const _0x23ca57=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x21a96b),_0x35d2af[_0x52d42f(0x1c1)][_0x52d42f(0x182)],_0x52d42f(0xd4));_0x23ca57[_0x52d42f(0x11b)]&&this[_0x52d42f(0x144)][_0x52d42f(0x12c)](_0x52d42f(0x1a4)+a96_0x35c8eb[_0x52d42f(0xff)](_0x23ca57[_0x52d42f(0x164)])+_0x52d42f(0x1cb)+a96_0x35c8eb[_0x52d42f(0xff)](_0x23ca57['path']));const _0x488561=_0x23ca57[_0x52d42f(0x14c)],_0x35d223=apiKnowledgeBaseToYaml(_0x35d2af),_0x530e8f=toKnowledgeBaseYamlString(_0x35d223),_0x23b13f=!a96_0x12834e[_0x52d42f(0x17f)](_0x488561);let _0x547dce=_0x23b13f,_0x5a9620;if(!_0x23b13f){const _0x18d6be=a96_0x12834e[_0x52d42f(0x1c0)](_0x488561,'utf-8'),_0x46dff5=generateDiff(_0x18d6be,_0x530e8f);_0x547dce=hasChanges(_0x46dff5),_0x547dce&&(_0x5a9620=formatDiffWithColors(_0x46dff5));}_0x307733[_0x52d42f(0x11d)]({'path':_0x488561,'content':_0x530e8f}),_0x53a43f['knowledgeBases'][_0x52d42f(0x11d)]({'name':_0x35d2af[_0x52d42f(0x1c1)]['name'],'outputPath':_0x488561,'isNew':_0x23b13f,'hasChanges':_0x547dce,'diff':_0x5a9620}),_0x53a43f[_0x52d42f(0x100)][_0x52d42f(0x1c9)][_0x52d42f(0x163)]++;if(_0x23b13f)_0x53a43f[_0x52d42f(0x100)][_0x52d42f(0x1c9)][_0x52d42f(0xfe)]++;else{if(_0x547dce)_0x53a43f[_0x52d42f(0x100)][_0x52d42f(0x1c9)][_0x52d42f(0x146)]++;else _0x53a43f[_0x52d42f(0x100)][_0x52d42f(0x1c9)][_0x52d42f(0xcb)]++;}}for(const _0x2a70ea of _0x340142){if(_0x2a70ea[_0x52d42f(0x1c1)][_0x52d42f(0x1a8)])continue;const _0x161675=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x21a96b),_0x2a70ea['attributes']['name'],'.md');_0x161675[_0x52d42f(0x11b)]&&this[_0x52d42f(0x144)][_0x52d42f(0x12c)]('Renamed\x20text\x20KB\x20file:\x20'+a96_0x35c8eb[_0x52d42f(0xff)](_0x161675[_0x52d42f(0x164)])+_0x52d42f(0x1cb)+a96_0x35c8eb[_0x52d42f(0xff)](_0x161675['path']));const _0x3b19d4=_0x161675['path'],_0x56061a=toTextKnowledgeBaseMd(_0x2a70ea[_0x52d42f(0x1c1)][_0x52d42f(0x182)],_0x2a70ea[_0x52d42f(0x1c1)]['text']),_0xdf73b8=!a96_0x12834e[_0x52d42f(0x17f)](_0x3b19d4);let _0x3b81d1=_0xdf73b8,_0x1257bc;if(!_0xdf73b8){const _0x448515=a96_0x12834e[_0x52d42f(0x1c0)](_0x3b19d4,_0x52d42f(0xf0)),_0x24a790=generateDiff(_0x448515,_0x56061a);_0x3b81d1=hasChanges(_0x24a790),_0x3b81d1&&(_0x1257bc=formatDiffWithColors(_0x24a790));}_0x307733[_0x52d42f(0x11d)]({'path':_0x3b19d4,'content':_0x56061a}),_0x53a43f[_0x52d42f(0xcd)][_0x52d42f(0x11d)]({'name':_0x2a70ea[_0x52d42f(0x1c1)][_0x52d42f(0x182)],'outputPath':_0x3b19d4,'isNew':_0xdf73b8,'hasChanges':_0x3b81d1,'diff':_0x1257bc}),_0x53a43f[_0x52d42f(0x100)][_0x52d42f(0xcd)][_0x52d42f(0x163)]++;if(_0xdf73b8)_0x53a43f['counts'][_0x52d42f(0xcd)][_0x52d42f(0xfe)]++;else{if(_0x3b81d1)_0x53a43f['counts'][_0x52d42f(0xcd)][_0x52d42f(0x146)]++;else _0x53a43f['counts'][_0x52d42f(0xcd)][_0x52d42f(0xcb)]++;}}for(const _0x1e4239 of _0x4087a4){if(_0x1e4239[_0x52d42f(0x1c1)][_0x52d42f(0x1a8)])continue;const _0x5cc60b=getSanitizedPathWithMigration(getPromptsDir(_0x21a96b),_0x1e4239[_0x52d42f(0x1c1)][_0x52d42f(0x182)],'.yml');_0x5cc60b['renamed']&&this[_0x52d42f(0x144)][_0x52d42f(0x12c)](_0x52d42f(0xde)+a96_0x35c8eb[_0x52d42f(0xff)](_0x5cc60b[_0x52d42f(0x164)])+'\x20→\x20'+a96_0x35c8eb[_0x52d42f(0xff)](_0x5cc60b[_0x52d42f(0x14c)]));const _0x7ca14e=_0x5cc60b[_0x52d42f(0x14c)],_0x557ebf=await apiPromptToYaml(_0x1e4239,_0x209799);if(!_0x557ebf)continue;const _0x2e2f1c=toPromptYamlString(_0x557ebf),_0x124891=!a96_0x12834e[_0x52d42f(0x17f)](_0x7ca14e);let _0x54180f=_0x124891,_0x3ef320;if(!_0x124891){const _0x3df1aa=a96_0x12834e[_0x52d42f(0x1c0)](_0x7ca14e,'utf-8'),_0x2ed10f=generateDiff(_0x3df1aa,_0x2e2f1c);_0x54180f=hasChanges(_0x2ed10f),_0x54180f&&(_0x3ef320=formatDiffWithColors(_0x2ed10f));}_0x307733[_0x52d42f(0x11d)]({'path':_0x7ca14e,'content':_0x2e2f1c}),_0x53a43f[_0x52d42f(0x18e)]['push']({'name':_0x1e4239[_0x52d42f(0x1c1)][_0x52d42f(0x182)],'outputPath':_0x7ca14e,'isNew':_0x124891,'hasChanges':_0x54180f,'diff':_0x3ef320}),_0x53a43f[_0x52d42f(0x100)]['prompts'][_0x52d42f(0x163)]++;if(_0x124891)_0x53a43f[_0x52d42f(0x100)][_0x52d42f(0x18e)][_0x52d42f(0xfe)]++;else{if(_0x54180f)_0x53a43f[_0x52d42f(0x100)][_0x52d42f(0x18e)][_0x52d42f(0x146)]++;else _0x53a43f['counts'][_0x52d42f(0x18e)][_0x52d42f(0xcb)]++;}}for(const _0x1721bb of _0x508127){const _0x31d586=_0x1721bb[_0x52d42f(0x1c1)][_0x52d42f(0xf4)][_0x52d42f(0x1a2)](),_0xc2b8e5=getSanitizedPathWithMigration(getIntegrationsDir(_0x21a96b),_0x31d586,_0x52d42f(0xd4));_0xc2b8e5[_0x52d42f(0x11b)]&&this[_0x52d42f(0x144)][_0x52d42f(0x12c)](_0x52d42f(0xd9)+a96_0x35c8eb[_0x52d42f(0xff)](_0xc2b8e5[_0x52d42f(0x164)])+_0x52d42f(0x1cb)+a96_0x35c8eb[_0x52d42f(0xff)](_0xc2b8e5[_0x52d42f(0x14c)]));const _0x288fb2=_0xc2b8e5[_0x52d42f(0x14c)],_0x37d7b5=await apiIntegrationToYaml(_0x1721bb,_0x209799),_0x1d58fe=toIntegrationYamlString(_0x37d7b5),_0x12129c=!a96_0x12834e[_0x52d42f(0x17f)](_0x288fb2);let _0x4e7d11=_0x12129c,_0x594ebe;if(!_0x12129c){const _0x1464d5=a96_0x12834e['readFileSync'](_0x288fb2,_0x52d42f(0xf0)),_0x222e30=generateDiff(_0x1464d5,_0x1d58fe);_0x4e7d11=hasChanges(_0x222e30),_0x4e7d11&&(_0x594ebe=formatDiffWithColors(_0x222e30));}_0x307733[_0x52d42f(0x11d)]({'path':_0x288fb2,'content':_0x1d58fe}),_0x53a43f[_0x52d42f(0x1c4)][_0x52d42f(0x11d)]({'name':_0x31d586,'outputPath':_0x288fb2,'isNew':_0x12129c,'hasChanges':_0x4e7d11,'diff':_0x594ebe}),_0x53a43f[_0x52d42f(0x100)]['integrations'][_0x52d42f(0x163)]++;if(_0x12129c)_0x53a43f[_0x52d42f(0x100)][_0x52d42f(0x1c4)][_0x52d42f(0xfe)]++;else{if(_0x4e7d11)_0x53a43f[_0x52d42f(0x100)][_0x52d42f(0x1c4)][_0x52d42f(0x146)]++;else _0x53a43f[_0x52d42f(0x100)][_0x52d42f(0x1c4)][_0x52d42f(0xcb)]++;}}for(const _0x2c357f of _0x5bad1b){if(_0x2c357f[_0x52d42f(0x1c1)][_0x52d42f(0x1a8)])continue;const _0x163acd=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x21a96b),_0x2c357f[_0x52d42f(0x1c1)][_0x52d42f(0x182)]);_0x163acd[_0x52d42f(0x11b)]&&this['logger'][_0x52d42f(0x12c)](_0x52d42f(0x152)+a96_0x35c8eb['basename'](_0x163acd[_0x52d42f(0x164)])+_0x52d42f(0x1cb)+a96_0x35c8eb['basename'](_0x163acd[_0x52d42f(0x14c)]));const _0x4de8c5=_0x163acd[_0x52d42f(0x14c)],_0x20900f=a96_0x35c8eb[_0x52d42f(0x185)](_0x4de8c5,sanitizeForFilesystem(_0x2c357f[_0x52d42f(0x1c1)][_0x52d42f(0x182)])+'.yml'),_0x568af6=a96_0x35c8eb[_0x52d42f(0x185)](_0x4de8c5,'functions'),_0x3b421e=apiExperimentalKnowledgeBaseToYaml(_0x2c357f),_0x26a34d=toExperimentalKnowledgeBaseYamlString(_0x3b421e),_0x8faad8=!a96_0x12834e[_0x52d42f(0x17f)](_0x4de8c5);let _0x4f9e5a=_0x8faad8,_0x4a559c,_0x4e2e41=_0x26a34d;const _0x5099ca=[..._0x3b421e[_0x52d42f(0x101)]]['sort']((_0xc9e031,_0xa0077e)=>_0xc9e031[_0x52d42f(0x182)][_0x52d42f(0x11e)](_0xa0077e[_0x52d42f(0x182)]));for(const _0x59d4e8 of _0x5099ca){_0x4e2e41+=_0x52d42f(0xf1)+_0x59d4e8[_0x52d42f(0x182)]+_0x52d42f(0x13d)+_0x59d4e8['code']+_0x52d42f(0x14a)+_0x59d4e8[_0x52d42f(0x182)]+_0x52d42f(0x13d)+_0x59d4e8['json_schema']+'\x0a';}if(!_0x8faad8){let _0x4b526c='';a96_0x12834e[_0x52d42f(0x17f)](_0x20900f)&&(_0x4b526c=a96_0x12834e[_0x52d42f(0x1c0)](_0x20900f,_0x52d42f(0xf0)));if(a96_0x12834e[_0x52d42f(0x17f)](_0x568af6)){const _0xa04253=a96_0x12834e[_0x52d42f(0x137)](_0x568af6,{'withFileTypes':!![]}),_0x1e055=_0xa04253[_0x52d42f(0x159)](_0x24bce6=>_0x24bce6['isDirectory']())[_0x52d42f(0x18c)]((_0x517fc8,_0x56bf4d)=>_0x517fc8[_0x52d42f(0x182)][_0x52d42f(0x11e)](_0x56bf4d[_0x52d42f(0x182)]));for(const _0x26d86e of _0x1e055){const _0x387ea0=a96_0x35c8eb[_0x52d42f(0x185)](_0x568af6,_0x26d86e[_0x52d42f(0x182)],_0x52d42f(0xd5)),_0x19dc52=a96_0x35c8eb[_0x52d42f(0x185)](_0x568af6,_0x26d86e['name'],_0x52d42f(0x1bb));a96_0x12834e[_0x52d42f(0x17f)](_0x387ea0)&&(_0x4b526c+=_0x52d42f(0xf1)+_0x26d86e[_0x52d42f(0x182)]+_0x52d42f(0x13d)+a96_0x12834e['readFileSync'](_0x387ea0,_0x52d42f(0xf0))+'\x0a'),a96_0x12834e['existsSync'](_0x19dc52)&&(_0x4b526c+=_0x52d42f(0x121)+_0x26d86e[_0x52d42f(0x182)]+_0x52d42f(0x13d)+a96_0x12834e[_0x52d42f(0x1c0)](_0x19dc52,_0x52d42f(0xf0))+'\x0a');}}const _0x2b35f9=generateDiff(_0x4b526c,_0x4e2e41);_0x4f9e5a=hasChanges(_0x2b35f9),_0x4f9e5a&&(_0x4a559c=formatDiffWithColors(_0x2b35f9));}_0x307733[_0x52d42f(0x11d)]({'path':_0x4de8c5,'content':'','isDir':!![]}),_0x307733[_0x52d42f(0x11d)]({'path':_0x20900f,'content':_0x26a34d}),_0x307733[_0x52d42f(0x11d)]({'path':_0x568af6,'content':'','isDir':!![]});for(const _0x44a9f4 of _0x3b421e[_0x52d42f(0x101)]){const _0x1892a0=a96_0x35c8eb[_0x52d42f(0x185)](_0x568af6,sanitizeForFilesystem(_0x44a9f4[_0x52d42f(0x182)])),_0x145efc=a96_0x35c8eb[_0x52d42f(0x185)](_0x1892a0,'code.js'),_0x231e22=a96_0x35c8eb[_0x52d42f(0x185)](_0x1892a0,'json_schema.json');_0x307733['push']({'path':_0x1892a0,'content':'','isDir':!![]}),_0x307733[_0x52d42f(0x11d)]({'path':_0x145efc,'content':_0x44a9f4['code']}),_0x307733[_0x52d42f(0x11d)]({'path':_0x231e22,'content':_0x44a9f4['json_schema']});}if(a96_0x12834e['existsSync'](_0x568af6)){const _0x105e4b=a96_0x12834e[_0x52d42f(0x137)](_0x568af6,{'withFileTypes':!![]}),_0x3afbe5=new Set(_0x3b421e[_0x52d42f(0x101)][_0x52d42f(0x12a)](_0x57401=>sanitizeForFilesystem(_0x57401[_0x52d42f(0x182)])));for(const _0x488db6 of _0x105e4b){if(_0x488db6['isDirectory']()&&!_0x3afbe5['has'](_0x488db6[_0x52d42f(0x182)])){const _0x1606cc=a96_0x35c8eb[_0x52d42f(0x185)](_0x568af6,_0x488db6[_0x52d42f(0x182)]);_0x1fbc92[_0x52d42f(0x11d)]({'path':_0x1606cc,'isDir':!![]});}}}_0x53a43f['experimentalKnowledgeBases'][_0x52d42f(0x11d)]({'name':_0x2c357f[_0x52d42f(0x1c1)][_0x52d42f(0x182)],'outputPath':_0x4de8c5,'isNew':_0x8faad8,'hasChanges':_0x4f9e5a,'diff':_0x4a559c}),_0x53a43f[_0x52d42f(0x100)][_0x52d42f(0x1c2)][_0x52d42f(0x163)]++;if(_0x8faad8)_0x53a43f[_0x52d42f(0x100)][_0x52d42f(0x1c2)][_0x52d42f(0xfe)]++;else{if(_0x4f9e5a)_0x53a43f[_0x52d42f(0x100)][_0x52d42f(0x1c2)][_0x52d42f(0x146)]++;else _0x53a43f['counts'][_0x52d42f(0x1c2)][_0x52d42f(0xcb)]++;}}for(const _0x40bdf5 of _0x2c3213){if(_0x40bdf5['attributes'][_0x52d42f(0x1a8)])continue;const _0x153420=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x21a96b),_0x40bdf5[_0x52d42f(0x1c1)][_0x52d42f(0x182)]);_0x153420[_0x52d42f(0x11b)]&&this['logger'][_0x52d42f(0x12c)]('Renamed\x20experimental\x20artifact\x20directory:\x20'+a96_0x35c8eb['basename'](_0x153420['oldPath'])+'\x20→\x20'+a96_0x35c8eb['basename'](_0x153420[_0x52d42f(0x14c)]));const _0x46da3a=_0x153420['path'],_0xd95383=a96_0x35c8eb[_0x52d42f(0x185)](_0x46da3a,sanitizeForFilesystem(_0x40bdf5['attributes'][_0x52d42f(0x182)])+_0x52d42f(0xd4)),_0x1b9a30=a96_0x35c8eb[_0x52d42f(0x185)](_0x46da3a,_0x52d42f(0xd5)),_0x44722e=a96_0x35c8eb[_0x52d42f(0x185)](_0x46da3a,_0x52d42f(0xf9)),_0x3d3544=apiExperimentalArtifactToYaml(_0x40bdf5),_0x21ee73=toExperimentalArtifactYamlString(_0x3d3544),_0x16df3a=!a96_0x12834e['existsSync'](_0x46da3a);let _0x11d08a=_0x16df3a,_0x46c7a5,_0x3c9a18=_0x21ee73+(_0x52d42f(0x16c)+_0x3d3544[_0x52d42f(0xdd)]+'\x0a');const _0x331c37=[..._0x3d3544['files']][_0x52d42f(0x18c)]((_0x37b89c,_0x3879c4)=>_0x37b89c[_0x52d42f(0x1cf)][_0x52d42f(0x11e)](_0x3879c4[_0x52d42f(0x1cf)]));for(const _0x1b8109 of _0x331c37){_0x3c9a18+=_0x52d42f(0xe9)+_0x1b8109['file_name']+_0x52d42f(0x13d)+_0x1b8109[_0x52d42f(0x181)]+'\x0a';}if(!_0x16df3a){let _0x182c54='';a96_0x12834e['existsSync'](_0xd95383)&&(_0x182c54=a96_0x12834e[_0x52d42f(0x1c0)](_0xd95383,_0x52d42f(0xf0)));a96_0x12834e[_0x52d42f(0x17f)](_0x1b9a30)&&(_0x182c54+='\x0a---\x20code\x20---\x0a'+a96_0x12834e[_0x52d42f(0x1c0)](_0x1b9a30,_0x52d42f(0xf0))+'\x0a');if(a96_0x12834e[_0x52d42f(0x17f)](_0x44722e)){const _0x23c937=a96_0x12834e[_0x52d42f(0x137)](_0x44722e),_0x5217c9=_0x23c937[_0x52d42f(0x159)](_0x312ef5=>{const _0x2ac925=_0x52d42f,_0xf14f5d=a96_0x35c8eb[_0x2ac925(0x185)](_0x44722e,_0x312ef5);return a96_0x12834e['statSync'](_0xf14f5d)['isFile']();})['sort']((_0x40ee9,_0x54db23)=>_0x40ee9['localeCompare'](_0x54db23));for(const _0x2c6538 of _0x5217c9){const _0x2235f0=a96_0x35c8eb[_0x52d42f(0x185)](_0x44722e,_0x2c6538);_0x182c54+=_0x52d42f(0xe9)+_0x2c6538+'\x20---\x0a'+a96_0x12834e[_0x52d42f(0x1c0)](_0x2235f0,'utf-8')+'\x0a';}}const _0x122def=generateDiff(_0x182c54,_0x3c9a18);_0x11d08a=hasChanges(_0x122def),_0x11d08a&&(_0x46c7a5=formatDiffWithColors(_0x122def));}_0x307733[_0x52d42f(0x11d)]({'path':_0x46da3a,'content':'','isDir':!![]}),_0x307733[_0x52d42f(0x11d)]({'path':_0xd95383,'content':_0x21ee73}),_0x307733['push']({'path':_0x1b9a30,'content':_0x3d3544[_0x52d42f(0xdd)]});if(_0x3d3544['files'][_0x52d42f(0x111)]>0x0){_0x307733['push']({'path':_0x44722e,'content':'','isDir':!![]});for(const _0x7c6416 of _0x3d3544[_0x52d42f(0xf9)]){const _0xf8e635=a96_0x35c8eb[_0x52d42f(0x185)](_0x44722e,_0x7c6416[_0x52d42f(0x1cf)]);_0x307733[_0x52d42f(0x11d)]({'path':_0xf8e635,'content':_0x7c6416[_0x52d42f(0x181)]});}}if(a96_0x12834e[_0x52d42f(0x17f)](_0x44722e)){const _0x5cc29a=a96_0x12834e[_0x52d42f(0x137)](_0x44722e),_0x530094=new Set(_0x3d3544[_0x52d42f(0xf9)][_0x52d42f(0x12a)](_0x2f212f=>_0x2f212f[_0x52d42f(0x1cf)]));for(const _0x14c181 of _0x5cc29a){const _0x28dc52=a96_0x35c8eb[_0x52d42f(0x185)](_0x44722e,_0x14c181);a96_0x12834e[_0x52d42f(0x1ac)](_0x28dc52)['isFile']()&&!_0x530094[_0x52d42f(0x195)](_0x14c181)&&_0x1fbc92[_0x52d42f(0x11d)]({'path':_0x28dc52});}}_0x53a43f['experimentalArtifacts'][_0x52d42f(0x11d)]({'name':_0x40bdf5[_0x52d42f(0x1c1)][_0x52d42f(0x182)],'outputPath':_0x46da3a,'isNew':_0x16df3a,'hasChanges':_0x11d08a,'diff':_0x46c7a5}),_0x53a43f[_0x52d42f(0x100)][_0x52d42f(0x14f)][_0x52d42f(0x163)]++;if(_0x16df3a)_0x53a43f[_0x52d42f(0x100)][_0x52d42f(0x14f)][_0x52d42f(0xfe)]++;else{if(_0x11d08a)_0x53a43f['counts'][_0x52d42f(0x14f)][_0x52d42f(0x146)]++;else _0x53a43f['counts'][_0x52d42f(0x14f)]['unchanged']++;}}if(_0x3d4581?.['dryRun'])return _0x53a43f;a96_0x12834e['mkdirSync'](_0x21a96b,{'recursive':!![]}),a96_0x12834e[_0x52d42f(0x18a)](getKnowledgeBasesDir(_0x21a96b),{'recursive':!![]}),a96_0x12834e[_0x52d42f(0x18a)](getPromptsDir(_0x21a96b),{'recursive':!![]}),a96_0x12834e[_0x52d42f(0x18a)](getIntegrationsDir(_0x21a96b),{'recursive':!![]}),a96_0x12834e['mkdirSync'](getExperimentalKnowledgeBasesDir(_0x21a96b),{'recursive':!![]}),a96_0x12834e['mkdirSync'](getExperimentalArtifactsDir(_0x21a96b),{'recursive':!![]});const _0x1bc7ca=a96_0x35c8eb['join'](_0x21a96b,_0x52d42f(0xf7));a96_0x12834e[_0x52d42f(0x15f)](_0x1bc7ca,createAgentConfigContent(_0x5549b8));for(const _0x2fedba of _0x307733){if(_0x2fedba['isDir'])a96_0x12834e['mkdirSync'](_0x2fedba[_0x52d42f(0x14c)],{'recursive':!![]});else{const _0x36f34d=a96_0x35c8eb[_0x52d42f(0x17e)](_0x2fedba['path']);!a96_0x12834e['existsSync'](_0x36f34d)&&a96_0x12834e[_0x52d42f(0x18a)](_0x36f34d,{'recursive':!![]}),a96_0x12834e[_0x52d42f(0x15f)](_0x2fedba[_0x52d42f(0x14c)],_0x2fedba[_0x52d42f(0x170)]);}}for(const _0x263527 of _0x1fbc92){_0x263527[_0x52d42f(0x136)]?(a96_0x12834e['rmSync'](_0x263527['path'],{'recursive':!![],'force':!![]}),this[_0x52d42f(0x144)][_0x52d42f(0x12c)](_0x52d42f(0x1cd)+a96_0x35c8eb[_0x52d42f(0xff)](a96_0x35c8eb[_0x52d42f(0x17e)](_0x263527['path']))+'/'+a96_0x35c8eb['basename'](_0x263527[_0x52d42f(0x14c)]))):(a96_0x12834e[_0x52d42f(0xc6)](_0x263527[_0x52d42f(0x14c)],{'force':!![]}),this[_0x52d42f(0x144)][_0x52d42f(0x12c)](_0x52d42f(0xd2)+a96_0x35c8eb[_0x52d42f(0xff)](a96_0x35c8eb[_0x52d42f(0x17e)](_0x263527[_0x52d42f(0x14c)]))+'/'+a96_0x35c8eb['basename'](_0x263527['path'])));}return _0x53a43f;}async[a96_0x4932d2(0x110)](_0x31791d,_0x11ff5f){const _0x3eef9b=a96_0x4932d2,_0x168787=a96_0x35c8eb[_0x3eef9b(0x185)](_0x31791d,_0x3eef9b(0xf7));if(!a96_0x12834e[_0x3eef9b(0x17f)](_0x168787))throw new SDKError(ErrorCode[_0x3eef9b(0x1a6)],'No\x20tdx.json\x20found\x20in\x20'+_0x31791d,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x18f569=loadAgentConfig(_0x168787),_0x1206d3=await this[_0x3eef9b(0x17a)](_0x18f569['llm_project']),_0x574424=await this[_0x3eef9b(0xf2)]['getProject'](_0x1206d3),_0x137c64=_0x574424[_0x3eef9b(0x1c1)]['name'],_0x130eeb={'projectName':_0x137c64,'projectId':_0x1206d3,'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}}},_0x572643=[],_0x537ed2=[],_0x88585e=[],_0x27160c=[],_0x27c89e=[],_0x2eb056=[],_0x1215a5=a96_0x12834e[_0x3eef9b(0x137)](_0x31791d,{'withFileTypes':!![]});for(const _0xf6e99c of _0x1215a5){if(!_0xf6e99c['isDirectory']())continue;if(['knowledge_bases',_0x3eef9b(0x18e),_0x3eef9b(0x1c4),'experimental_knowledge_bases','experimental_artifacts']['includes'](_0xf6e99c[_0x3eef9b(0x182)]))continue;const _0x580a8f=a96_0x35c8eb[_0x3eef9b(0x185)](_0x31791d,_0xf6e99c[_0x3eef9b(0x182)]);if(isAgentDir(_0x580a8f)){const _0x698f0e=a96_0x35c8eb[_0x3eef9b(0x185)](_0x580a8f,_0x3eef9b(0x17c)),_0x4e6257=a96_0x35c8eb[_0x3eef9b(0x185)](_0x580a8f,_0x3eef9b(0x1ad)),_0xa97569=a96_0x35c8eb[_0x3eef9b(0x185)](_0x580a8f,_0x3eef9b(0xce)),_0x574317=parseAgentYaml(a96_0x12834e[_0x3eef9b(0x1c0)](_0x698f0e,_0x3eef9b(0xf0)),_0x698f0e),_0x3d79b2=a96_0x12834e[_0x3eef9b(0x17f)](_0x4e6257)?a96_0x12834e[_0x3eef9b(0x1c0)](_0x4e6257,_0x3eef9b(0xf0)):'',_0x2b1778=a96_0x12834e[_0x3eef9b(0x17f)](_0xa97569)?a96_0x12834e['readFileSync'](_0xa97569,_0x3eef9b(0xf0)):_0x574317['starter_message'];_0x572643['push']({'name':_0x574317['name'],'dir':_0x580a8f,'yaml':_0x574317,'systemPrompt':_0x3d79b2,'starterMessage':_0x2b1778});}}const _0x3d1ad3=getKnowledgeBasesDir(_0x31791d);if(a96_0x12834e[_0x3eef9b(0x17f)](_0x3d1ad3)){const _0x3d2003=a96_0x12834e[_0x3eef9b(0x137)](_0x3d1ad3);for(const _0x2f3921 of _0x3d2003){const _0x5e0915=a96_0x35c8eb[_0x3eef9b(0x185)](_0x3d1ad3,_0x2f3921);if(_0x2f3921[_0x3eef9b(0x13c)](_0x3eef9b(0xd4))){const _0x28befd=parseKnowledgeBaseYaml(a96_0x12834e[_0x3eef9b(0x1c0)](_0x5e0915,_0x3eef9b(0xf0)),_0x5e0915);_0x537ed2[_0x3eef9b(0x11d)]({'name':_0x28befd[_0x3eef9b(0x182)],'path':_0x5e0915,'yaml':_0x28befd});}else{if(_0x2f3921[_0x3eef9b(0x13c)](_0x3eef9b(0x125))){const _0x367c49=a96_0x12834e['readFileSync'](_0x5e0915,_0x3eef9b(0xf0)),{name:_0x27b1d5,text:_0x1300dc}=parseTextKnowledgeBaseMd(_0x367c49,_0x2f3921);_0x88585e['push']({'name':_0x27b1d5,'path':_0x5e0915,'text':_0x1300dc});}}}}const _0x1d98ce=getPromptsDir(_0x31791d);if(a96_0x12834e['existsSync'](_0x1d98ce)){const _0xc6af92=a96_0x12834e['readdirSync'](_0x1d98ce)[_0x3eef9b(0x159)](_0x53049d=>_0x53049d[_0x3eef9b(0x13c)](_0x3eef9b(0xd4)));for(const _0x17fb29 of _0xc6af92){const _0x1a3c8c=a96_0x35c8eb[_0x3eef9b(0x185)](_0x1d98ce,_0x17fb29),_0x5903f8=parsePromptYaml(a96_0x12834e[_0x3eef9b(0x1c0)](_0x1a3c8c,_0x3eef9b(0xf0)),_0x1a3c8c);_0x27160c[_0x3eef9b(0x11d)]({'name':_0x5903f8[_0x3eef9b(0x182)],'path':_0x1a3c8c,'yaml':_0x5903f8});}}const _0xb8ba23=[],_0x4e590a=getIntegrationsDir(_0x31791d);if(a96_0x12834e[_0x3eef9b(0x17f)](_0x4e590a)){const _0x4b4682=a96_0x12834e['readdirSync'](_0x4e590a)[_0x3eef9b(0x159)](_0x4d925c=>_0x4d925c[_0x3eef9b(0x13c)](_0x3eef9b(0xd4)));for(const _0x3f2b7e of _0x4b4682){const _0x3ec869=a96_0x35c8eb[_0x3eef9b(0x185)](_0x4e590a,_0x3f2b7e),_0x5693c4=parseIntegrationYaml(a96_0x12834e['readFileSync'](_0x3ec869,_0x3eef9b(0xf0)),_0x3ec869);if(!SAFE_INTEGRATION_TYPES[_0x3eef9b(0x16b)](_0x5693c4['service_type'][_0x3eef9b(0x1a2)]())){this[_0x3eef9b(0x144)][_0x3eef9b(0x1b3)](_0x3eef9b(0x126)+_0x5693c4[_0x3eef9b(0x182)]+_0x3eef9b(0xe3)+_0x5693c4[_0x3eef9b(0xcf)]+'):\x20'+(_0x3eef9b(0x174)+SAFE_INTEGRATION_TYPES[_0x3eef9b(0x185)](',\x20')+_0x3eef9b(0x180))+_0x3eef9b(0xc3));continue;}_0xb8ba23[_0x3eef9b(0x11d)]({'name':_0x5693c4[_0x3eef9b(0x182)],'path':_0x3ec869,'yaml':_0x5693c4});}}const _0x108315=getExperimentalKnowledgeBasesDir(_0x31791d);if(a96_0x12834e[_0x3eef9b(0x17f)](_0x108315)){const _0x9412a6=a96_0x12834e[_0x3eef9b(0x137)](_0x108315,{'withFileTypes':!![]});for(const _0x24c385 of _0x9412a6){if(!_0x24c385[_0x3eef9b(0xeb)]())continue;const _0x2db92a=a96_0x35c8eb[_0x3eef9b(0x185)](_0x108315,_0x24c385[_0x3eef9b(0x182)]),_0x22058c=a96_0x35c8eb['join'](_0x2db92a,_0x24c385[_0x3eef9b(0x182)]+'.yml'),_0x43feb7=a96_0x35c8eb[_0x3eef9b(0x185)](_0x2db92a,'functions');if(!a96_0x12834e['existsSync'](_0x22058c))continue;const _0x39a401=parseExperimentalKnowledgeBaseYaml(a96_0x12834e['readFileSync'](_0x22058c,'utf-8'),_0x22058c),_0x873f2d=[];if(a96_0x12834e[_0x3eef9b(0x17f)](_0x43feb7)){const _0x2c4988=a96_0x12834e[_0x3eef9b(0x137)](_0x43feb7,{'withFileTypes':!![]});for(const _0xecbd46 of _0x2c4988){if(!_0xecbd46['isDirectory']())continue;const _0x352c6b=a96_0x35c8eb[_0x3eef9b(0x185)](_0x43feb7,_0xecbd46['name']),_0x2a4f65=a96_0x35c8eb['join'](_0x352c6b,_0x3eef9b(0xd5)),_0x445fa7=a96_0x35c8eb[_0x3eef9b(0x185)](_0x352c6b,_0x3eef9b(0x1bb));a96_0x12834e[_0x3eef9b(0x17f)](_0x2a4f65)&&a96_0x12834e[_0x3eef9b(0x17f)](_0x445fa7)&&_0x873f2d[_0x3eef9b(0x11d)]({'name':_0xecbd46['name'],'code':a96_0x12834e['readFileSync'](_0x2a4f65,'utf-8'),'json_schema':a96_0x12834e[_0x3eef9b(0x1c0)](_0x445fa7,_0x3eef9b(0xf0))});}}const _0x2d4a7f={..._0x39a401,'variables':_0x39a401[_0x3eef9b(0x1be)]||[],'functions':_0x873f2d};_0x27c89e[_0x3eef9b(0x11d)]({'name':_0x39a401[_0x3eef9b(0x182)],'dir':_0x2db92a,'def':_0x2d4a7f});}}const _0x2a22c3=getExperimentalArtifactsDir(_0x31791d);if(a96_0x12834e['existsSync'](_0x2a22c3)){const _0x145682=a96_0x12834e[_0x3eef9b(0x137)](_0x2a22c3,{'withFileTypes':!![]});for(const _0x2d66e5 of _0x145682){if(!_0x2d66e5[_0x3eef9b(0xeb)]())continue;const _0x3d3895=a96_0x35c8eb[_0x3eef9b(0x185)](_0x2a22c3,_0x2d66e5[_0x3eef9b(0x182)]),_0x8a31e6=a96_0x35c8eb[_0x3eef9b(0x185)](_0x3d3895,_0x2d66e5[_0x3eef9b(0x182)]+_0x3eef9b(0xd4)),_0x2db315=a96_0x35c8eb[_0x3eef9b(0x185)](_0x3d3895,_0x3eef9b(0xd5)),_0x33b9c4=a96_0x35c8eb[_0x3eef9b(0x185)](_0x3d3895,_0x3eef9b(0xf9));if(!a96_0x12834e[_0x3eef9b(0x17f)](_0x8a31e6)||!a96_0x12834e['existsSync'](_0x2db315))continue;const _0x58ee80=parseExperimentalArtifactYaml(a96_0x12834e[_0x3eef9b(0x1c0)](_0x8a31e6,'utf-8'),_0x8a31e6),_0x26e810=a96_0x12834e[_0x3eef9b(0x1c0)](_0x2db315,_0x3eef9b(0xf0)),_0x1ed367=[];if(a96_0x12834e[_0x3eef9b(0x17f)](_0x33b9c4)){const _0x225f94=a96_0x12834e[_0x3eef9b(0x137)](_0x33b9c4);for(const _0x4ba2a1 of _0x225f94){const _0xf560e6=a96_0x35c8eb[_0x3eef9b(0x185)](_0x33b9c4,_0x4ba2a1);a96_0x12834e[_0x3eef9b(0x1ac)](_0xf560e6)[_0x3eef9b(0x19c)]()&&_0x1ed367['push']({'file_name':_0x4ba2a1,'text_content':a96_0x12834e['readFileSync'](_0xf560e6,'utf-8')});}}const _0x5aefed={..._0x58ee80,'code':_0x26e810,'files':_0x1ed367};_0x2eb056[_0x3eef9b(0x11d)]({'name':_0x58ee80[_0x3eef9b(0x182)],'dir':_0x3d3895,'def':_0x5aefed});}}const _0x2fcdf7=await this[_0x3eef9b(0xf2)]['listAgentsFull'](_0x1206d3),_0x304e53=await this['client'][_0x3eef9b(0x10d)](_0x1206d3),_0x5c8098=await this['client'][_0x3eef9b(0xda)](_0x1206d3),_0x43246b=await this[_0x3eef9b(0xf2)][_0x3eef9b(0x102)](_0x1206d3),_0x4bb1dc=await this[_0x3eef9b(0xf2)]['listWebSearchTools'](_0x1206d3),_0x531534=await this['client'][_0x3eef9b(0x16a)](_0x1206d3),_0x4e4631=await this[_0x3eef9b(0xf2)][_0x3eef9b(0x158)](_0x1206d3),_0x3cbc71=await this[_0x3eef9b(0xf2)][_0x3eef9b(0x162)](_0x1206d3),_0x1fdc29=await this['client']['listExperimentalKnowledgeBases'](_0x1206d3),_0x34ebff=await this[_0x3eef9b(0xf2)]['listExperimentalArtifacts'](_0x1206d3),_0x278610=new Map(),_0xea3ec0=new Map(),_0x50435c=new Map(),_0x17583c=new Map(),_0x5829ee=new Map(),_0x5e385c=new Map(),_0x143b2e=new Map();for(const _0x1daeb7 of _0x2fcdf7){_0x278610['set'](_0x1daeb7['attributes']['name'],_0x1daeb7);}for(const _0x2fb74a of _0x304e53){_0xea3ec0[_0x3eef9b(0x173)](_0x2fb74a['attributes'][_0x3eef9b(0x182)],_0x2fb74a);}for(const _0x18783a of _0x5c8098){_0x50435c[_0x3eef9b(0x173)](_0x18783a[_0x3eef9b(0x1c1)]['name'],_0x18783a);}for(const _0x1084bf of _0x531534){_0x17583c[_0x3eef9b(0x173)](_0x1084bf['attributes']['name'],_0x1084bf);}for(const _0x488add of _0x4e4631){_0x5829ee[_0x3eef9b(0x173)](_0x488add['attributes'][_0x3eef9b(0xf4)][_0x3eef9b(0x1a2)](),_0x488add);}for(const _0x3af1f6 of _0x1fdc29){_0x5e385c[_0x3eef9b(0x173)](_0x3af1f6[_0x3eef9b(0x1c1)][_0x3eef9b(0x182)],_0x3af1f6);}for(const _0x21a88d of _0x34ebff){_0x143b2e[_0x3eef9b(0x173)](_0x21a88d['attributes']['name'],_0x21a88d);}const _0x56adda=new Map(),_0xbdb04f=new Map(),_0x1ae9c0=new Map(),_0x1dadaf=new Map(),_0x26227e=new Map(),_0x2768da=new Map(),_0xa9db74=new Map(),_0x486c12=new Map(),_0x4dec33=new Map(),_0xc43135=new Map(),_0x4a0582=new Map(),_0x34bd70=new Map(),_0x185b2e=new Map(),_0x230a08=new Map(),_0x4edc11=new Map(),_0x4eb4b3=new Map();for(const _0x282a89 of _0x304e53){_0x56adda[_0x3eef9b(0x173)](_0x282a89[_0x3eef9b(0x1c1)][_0x3eef9b(0x182)],_0x282a89['id']),_0x4dec33[_0x3eef9b(0x173)](_0x282a89['id'],_0x282a89[_0x3eef9b(0x1c1)][_0x3eef9b(0x182)]);}for(const _0x365466 of _0x5c8098){_0xbdb04f[_0x3eef9b(0x173)](_0x365466[_0x3eef9b(0x1c1)][_0x3eef9b(0x182)],_0x365466['id']),_0xc43135[_0x3eef9b(0x173)](_0x365466['id'],_0x365466['attributes']['name']);}for(const _0x40fe7d of _0x2fcdf7){_0x1ae9c0[_0x3eef9b(0x173)](_0x40fe7d[_0x3eef9b(0x1c1)][_0x3eef9b(0x182)],_0x40fe7d['id']),_0x4a0582[_0x3eef9b(0x173)](_0x40fe7d['id'],_0x40fe7d[_0x3eef9b(0x1c1)][_0x3eef9b(0x182)]);}for(const _0x44bc57 of _0x43246b){_0x1dadaf[_0x3eef9b(0x173)](_0x44bc57['attributes']['name'],_0x44bc57['id']),_0x34bd70['set'](_0x44bc57['id'],_0x44bc57[_0x3eef9b(0x1c1)][_0x3eef9b(0x182)]);}for(const _0x545f65 of _0x4bb1dc){_0x26227e['set'](_0x545f65['attributes'][_0x3eef9b(0x182)],_0x545f65['id']),_0x185b2e[_0x3eef9b(0x173)](_0x545f65['id'],_0x545f65[_0x3eef9b(0x1c1)][_0x3eef9b(0x182)]);}for(const _0x497111 of _0x531534){_0x2768da['set'](_0x497111[_0x3eef9b(0x1c1)]['name'],_0x497111['id']),_0x230a08[_0x3eef9b(0x173)](_0x497111['id'],_0x497111[_0x3eef9b(0x1c1)][_0x3eef9b(0x182)]);}for(const _0x572470 of _0x1fdc29){_0xa9db74[_0x3eef9b(0x173)](_0x572470[_0x3eef9b(0x1c1)][_0x3eef9b(0x182)],_0x572470['id']),_0x4edc11[_0x3eef9b(0x173)](_0x572470['id'],_0x572470['attributes']['name']);}for(const _0x559f63 of _0x34ebff){_0x486c12['set'](_0x559f63[_0x3eef9b(0x1c1)][_0x3eef9b(0x182)],_0x559f63['id']),_0x4eb4b3[_0x3eef9b(0x173)](_0x559f63['id'],_0x559f63[_0x3eef9b(0x1c1)][_0x3eef9b(0x182)]);}const _0x8da09={'resolveKnowledgeBaseName':async _0x37f9e5=>_0x4dec33[_0x3eef9b(0x12b)](_0x37f9e5),'resolveTextKnowledgeBaseName':async _0x5a63b2=>_0xc43135[_0x3eef9b(0x12b)](_0x5a63b2),'resolveAgentName':async _0x5f80b3=>_0x4a0582[_0x3eef9b(0x12b)](_0x5f80b3),'resolveWebSearchToolName':async _0x21a070=>_0x185b2e[_0x3eef9b(0x12b)](_0x21a070),'resolveImageGeneratorName':async _0x45f1ee=>_0x34bd70[_0x3eef9b(0x12b)](_0x45f1ee),'resolvePromptName':async _0x5dd311=>_0x230a08[_0x3eef9b(0x12b)](_0x5dd311),'resolveExperimentalKnowledgeBaseName':async _0x34f6d5=>_0x4edc11[_0x3eef9b(0x12b)](_0x34f6d5),'onWarning':_0x3c4088=>this[_0x3eef9b(0x144)][_0x3eef9b(0x1b3)](_0x3c4088)};let _0x3a40b9=[];const _0x19d83a={'projectId':_0x1206d3,'resolveKnowledgeBaseId':async _0x5a74d0=>_0x56adda['get'](_0x5a74d0),'resolveTextKnowledgeBaseId':async _0x562ec3=>_0xbdb04f[_0x3eef9b(0x12b)](_0x562ec3),'resolveAgentId':async _0x30468d=>_0x1ae9c0[_0x3eef9b(0x12b)](_0x30468d),'resolveWebSearchToolId':async _0x380372=>_0x26227e['get'](_0x380372),'resolveImageGeneratorId':async _0x373985=>_0x1dadaf[_0x3eef9b(0x12b)](_0x373985),'resolvePromptId':async _0x54bee3=>_0x2768da[_0x3eef9b(0x12b)](_0x54bee3),'resolveParentSegmentKBId':async()=>_0x3cbc71?.['id'],'resolveExperimentalKnowledgeBaseId':async _0x1f674d=>_0xa9db74[_0x3eef9b(0x12b)](_0x1f674d),'onWarning':_0x2620b0=>{const _0x43fe51=_0x3eef9b;this[_0x43fe51(0x144)][_0x43fe51(0x1b3)](_0x2620b0),_0x3a40b9[_0x43fe51(0x11d)](_0x2620b0);}},{resolved:_0x399c1e,unresolved:_0x3f059a}=resolveAgentDependencies(_0x572643,new Set(_0x278610['keys']()));for(const {agent:_0x401891,missingDeps:_0x513156}of _0x3f059a){_0x130eeb[_0x3eef9b(0x127)][_0x3eef9b(0x11d)]({'agentName':_0x401891[_0x3eef9b(0xf6)]['name'],'action':'error','error':_0x3eef9b(0x157)+_0x513156[_0x3eef9b(0x185)](',\x20')+_0x3eef9b(0x10c)}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x127)][_0x3eef9b(0x139)]++;}for(const _0x442524 of _0x537ed2){const _0xacf955=_0xea3ec0[_0x3eef9b(0x12b)](_0x442524[_0x3eef9b(0xf6)]['name']),_0x39c7b3=a96_0x12834e[_0x3eef9b(0x1c0)](_0x442524[_0x3eef9b(0x14c)],'utf-8');if(_0xacf955){const _0x3acf7b=apiKnowledgeBaseToYaml(_0xacf955),_0x207372=toKnowledgeBaseYamlString(_0x3acf7b),_0x4ab3a0=generateDiff(_0x207372,_0x39c7b3),_0x534cb4=hasChanges(_0x4ab3a0);_0x534cb4?(_0x130eeb[_0x3eef9b(0x1c9)]['push']({'name':_0x442524[_0x3eef9b(0xf6)]['name'],'action':'updated','id':_0xacf955['id'],'diff':formatDiffWithColors(_0x4ab3a0)}),_0x130eeb['counts'][_0x3eef9b(0x1c9)][_0x3eef9b(0x146)]++):(_0x130eeb['knowledgeBases'][_0x3eef9b(0x11d)]({'name':_0x442524['yaml'][_0x3eef9b(0x182)],'action':_0x3eef9b(0xcb),'id':_0xacf955['id']}),_0x130eeb['counts'][_0x3eef9b(0x1c9)][_0x3eef9b(0xcb)]++);}else _0x130eeb['knowledgeBases'][_0x3eef9b(0x11d)]({'name':_0x442524[_0x3eef9b(0xf6)][_0x3eef9b(0x182)],'action':_0x3eef9b(0xd0)}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x1c9)][_0x3eef9b(0xd0)]++;}for(const _0x4b6434 of _0x88585e){const _0x718f4e=_0x50435c[_0x3eef9b(0x12b)](_0x4b6434[_0x3eef9b(0x182)]),_0x1dc394=a96_0x12834e[_0x3eef9b(0x1c0)](_0x4b6434[_0x3eef9b(0x14c)],'utf-8');if(_0x718f4e){const _0x22c490=toTextKnowledgeBaseMd(_0x718f4e['attributes'][_0x3eef9b(0x182)],_0x718f4e['attributes'][_0x3eef9b(0x1b7)]),_0x1bab80=generateDiff(_0x22c490,_0x1dc394),_0x6efbb4=hasChanges(_0x1bab80);_0x6efbb4?(_0x130eeb[_0x3eef9b(0xcd)][_0x3eef9b(0x11d)]({'name':_0x4b6434['name'],'action':_0x3eef9b(0x146),'id':_0x718f4e['id'],'diff':formatDiffWithColors(_0x1bab80)}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0xcd)][_0x3eef9b(0x146)]++):(_0x130eeb[_0x3eef9b(0xcd)][_0x3eef9b(0x11d)]({'name':_0x4b6434[_0x3eef9b(0x182)],'action':_0x3eef9b(0xcb),'id':_0x718f4e['id']}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0xcd)][_0x3eef9b(0xcb)]++);}else _0x130eeb[_0x3eef9b(0xcd)][_0x3eef9b(0x11d)]({'name':_0x4b6434['name'],'action':'created'}),_0x130eeb[_0x3eef9b(0x100)]['textKnowledgeBases'][_0x3eef9b(0xd0)]++;}for(const _0x18e009 of _0x399c1e){const _0x36e815=_0x278610[_0x3eef9b(0x12b)](_0x18e009[_0x3eef9b(0xf6)][_0x3eef9b(0x182)]),_0xfb486=a96_0x35c8eb[_0x3eef9b(0x185)](_0x18e009['dir'],_0x3eef9b(0x17c)),_0x11fd99=a96_0x12834e[_0x3eef9b(0x1c0)](_0xfb486,'utf-8'),_0x86cd30=_0x18e009[_0x3eef9b(0x16f)],_0x223a45='#\x20prompt.md\x0a'+_0x86cd30+_0x3eef9b(0x183)+_0x11fd99;if(_0x36e815){const {yaml:_0x3616bd,systemPrompt:_0x9ef5}=await agentResponseToDef(_0x36e815,_0x8da09),_0x1e6736=toAgentYamlString(_0x3616bd),_0x71ece3='#\x20prompt.md\x0a'+_0x9ef5+'\x0a\x0a#\x20agent.yml\x0a'+_0x1e6736,_0x50f28=generateDiff(_0x71ece3,_0x223a45),_0x19331b=hasChanges(_0x50f28);_0x19331b?(_0x130eeb[_0x3eef9b(0x127)][_0x3eef9b(0x11d)]({'agentName':_0x18e009[_0x3eef9b(0xf6)][_0x3eef9b(0x182)],'action':_0x3eef9b(0x146),'agentId':_0x36e815['id'],'diff':formatDiffWithColors(_0x50f28)}),_0x130eeb['counts'][_0x3eef9b(0x127)][_0x3eef9b(0x146)]++):(_0x130eeb[_0x3eef9b(0x127)][_0x3eef9b(0x11d)]({'agentName':_0x18e009[_0x3eef9b(0xf6)]['name'],'action':'unchanged','agentId':_0x36e815['id']}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x127)][_0x3eef9b(0xcb)]++);}else _0x130eeb[_0x3eef9b(0x127)][_0x3eef9b(0x11d)]({'agentName':_0x18e009[_0x3eef9b(0xf6)][_0x3eef9b(0x182)],'action':'created'}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x127)][_0x3eef9b(0xd0)]++;}for(const _0xb25cd7 of _0x27160c){const _0xa8cedd=_0x17583c[_0x3eef9b(0x12b)](_0xb25cd7[_0x3eef9b(0xf6)][_0x3eef9b(0x182)]),_0x331cd5=a96_0x12834e[_0x3eef9b(0x1c0)](_0xb25cd7[_0x3eef9b(0x14c)],'utf-8');if(_0xa8cedd){const _0x184623=await apiPromptToYaml(_0xa8cedd,_0x8da09);if(!_0x184623){_0x130eeb['prompts'][_0x3eef9b(0x11d)]({'name':_0xb25cd7['yaml'][_0x3eef9b(0x182)],'action':'updated','id':_0xa8cedd['id']}),_0x130eeb[_0x3eef9b(0x100)]['prompts']['updated']++;continue;}const _0x64e44=toPromptYamlString(_0x184623),_0xd326e7=generateDiff(_0x64e44,_0x331cd5),_0x188f20=hasChanges(_0xd326e7);_0x188f20?(_0x130eeb['prompts'][_0x3eef9b(0x11d)]({'name':_0xb25cd7[_0x3eef9b(0xf6)][_0x3eef9b(0x182)],'action':_0x3eef9b(0x146),'id':_0xa8cedd['id'],'diff':formatDiffWithColors(_0xd326e7)}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x18e)]['updated']++):(_0x130eeb[_0x3eef9b(0x18e)][_0x3eef9b(0x11d)]({'name':_0xb25cd7['yaml'][_0x3eef9b(0x182)],'action':_0x3eef9b(0xcb),'id':_0xa8cedd['id']}),_0x130eeb['counts']['prompts'][_0x3eef9b(0xcb)]++);}else _0x130eeb[_0x3eef9b(0x18e)][_0x3eef9b(0x11d)]({'name':_0xb25cd7[_0x3eef9b(0xf6)][_0x3eef9b(0x182)],'action':_0x3eef9b(0xd0)}),_0x130eeb[_0x3eef9b(0x100)]['prompts'][_0x3eef9b(0xd0)]++;}for(const _0x5ee7e4 of _0xb8ba23){const _0x2f00e2=_0x5829ee[_0x3eef9b(0x12b)](_0x5ee7e4[_0x3eef9b(0xf6)][_0x3eef9b(0xcf)]),_0x562611=a96_0x12834e[_0x3eef9b(0x1c0)](_0x5ee7e4[_0x3eef9b(0x14c)],_0x3eef9b(0xf0));if(_0x2f00e2){const _0x50ce1e=await apiIntegrationToYaml(_0x2f00e2,_0x8da09),_0x548df8=toIntegrationYamlString(_0x50ce1e),_0x16128c=generateDiff(_0x548df8,_0x562611),_0x3a11a1=hasChanges(_0x16128c);_0x3a11a1?(_0x130eeb[_0x3eef9b(0x1c4)][_0x3eef9b(0x11d)]({'name':_0x5ee7e4[_0x3eef9b(0xf6)][_0x3eef9b(0xcf)],'action':_0x3eef9b(0x146),'id':_0x2f00e2['id'],'diff':formatDiffWithColors(_0x16128c)}),_0x130eeb['counts'][_0x3eef9b(0x1c4)][_0x3eef9b(0x146)]++):(_0x130eeb[_0x3eef9b(0x1c4)][_0x3eef9b(0x11d)]({'name':_0x5ee7e4[_0x3eef9b(0xf6)][_0x3eef9b(0xcf)],'action':'unchanged','id':_0x2f00e2['id']}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x1c4)][_0x3eef9b(0xcb)]++);}else _0x130eeb[_0x3eef9b(0x1c4)][_0x3eef9b(0x11d)]({'name':_0x5ee7e4[_0x3eef9b(0xf6)]['service_type'],'action':_0x3eef9b(0xd0)}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x1c4)]['created']++;}for(const _0x360236 of _0x27c89e){const _0x221cb0=_0x5e385c[_0x3eef9b(0x12b)](_0x360236[_0x3eef9b(0x14e)][_0x3eef9b(0x182)]),_0x7d50ae=toExperimentalKnowledgeBaseYamlString(_0x360236['def']);let _0x1eaba5=_0x7d50ae;for(const _0x4997df of _0x360236[_0x3eef9b(0x14e)][_0x3eef9b(0x101)]){_0x1eaba5+=_0x3eef9b(0xf1)+_0x4997df[_0x3eef9b(0x182)]+'\x20---\x0a'+_0x4997df[_0x3eef9b(0xdd)]+_0x3eef9b(0x14a)+_0x4997df[_0x3eef9b(0x182)]+'\x20---\x0a'+_0x4997df[_0x3eef9b(0x156)]+'\x0a';}if(_0x221cb0){const _0x209437=apiExperimentalKnowledgeBaseToYaml(_0x221cb0),_0x585c0a=toExperimentalKnowledgeBaseYamlString(_0x209437);let _0x4d7d1b=_0x585c0a;for(const _0x1a38ea of _0x209437[_0x3eef9b(0x101)]){_0x4d7d1b+=_0x3eef9b(0xf1)+_0x1a38ea['name']+_0x3eef9b(0x13d)+_0x1a38ea[_0x3eef9b(0xdd)]+'\x0a---\x20schema:\x20'+_0x1a38ea['name']+_0x3eef9b(0x13d)+_0x1a38ea[_0x3eef9b(0x156)]+'\x0a';}const _0x3d595d=generateDiff(_0x4d7d1b,_0x1eaba5),_0x964d52=hasChanges(_0x3d595d);_0x964d52?(_0x130eeb[_0x3eef9b(0x1c2)][_0x3eef9b(0x11d)]({'name':_0x360236[_0x3eef9b(0x14e)][_0x3eef9b(0x182)],'action':'updated','id':_0x221cb0['id'],'diff':formatDiffWithColors(_0x3d595d)}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x1c2)][_0x3eef9b(0x146)]++):(_0x130eeb[_0x3eef9b(0x1c2)][_0x3eef9b(0x11d)]({'name':_0x360236[_0x3eef9b(0x14e)][_0x3eef9b(0x182)],'action':_0x3eef9b(0xcb),'id':_0x221cb0['id']}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x1c2)][_0x3eef9b(0xcb)]++);}else _0x130eeb[_0x3eef9b(0x1c2)]['push']({'name':_0x360236['def']['name'],'action':'created'}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x1c2)][_0x3eef9b(0xd0)]++;}for(const _0x5c8d22 of _0x2eb056){const _0x2e7eb3=_0x143b2e[_0x3eef9b(0x12b)](_0x5c8d22['def'][_0x3eef9b(0x182)]),_0x5f2b61=toExperimentalArtifactYamlString(_0x5c8d22['def']);let _0x23e13b=_0x5f2b61+(_0x3eef9b(0x16c)+_0x5c8d22[_0x3eef9b(0x14e)][_0x3eef9b(0xdd)]+'\x0a');for(const _0x4de485 of _0x5c8d22['def'][_0x3eef9b(0xf9)]){_0x23e13b+=_0x3eef9b(0xe9)+_0x4de485[_0x3eef9b(0x1cf)]+'\x20---\x0a'+_0x4de485[_0x3eef9b(0x181)]+'\x0a';}if(_0x2e7eb3){const _0x447ac8=apiExperimentalArtifactToYaml(_0x2e7eb3),_0x166d29=toExperimentalArtifactYamlString(_0x447ac8);let _0xcfda20=_0x166d29+(_0x3eef9b(0x16c)+_0x447ac8[_0x3eef9b(0xdd)]+'\x0a');for(const _0x3bfaa1 of _0x447ac8[_0x3eef9b(0xf9)]){_0xcfda20+='---\x20file:\x20'+_0x3bfaa1['file_name']+_0x3eef9b(0x13d)+_0x3bfaa1[_0x3eef9b(0x181)]+'\x0a';}const _0x7f4fce=generateDiff(_0xcfda20,_0x23e13b),_0x9c3b5=hasChanges(_0x7f4fce);_0x9c3b5?(_0x130eeb[_0x3eef9b(0x14f)][_0x3eef9b(0x11d)]({'name':_0x5c8d22[_0x3eef9b(0x14e)]['name'],'action':_0x3eef9b(0x146),'id':_0x2e7eb3['id'],'diff':formatDiffWithColors(_0x7f4fce)}),_0x130eeb[_0x3eef9b(0x100)]['experimentalArtifacts'][_0x3eef9b(0x146)]++):(_0x130eeb[_0x3eef9b(0x14f)][_0x3eef9b(0x11d)]({'name':_0x5c8d22['def'][_0x3eef9b(0x182)],'action':_0x3eef9b(0xcb),'id':_0x2e7eb3['id']}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x14f)][_0x3eef9b(0xcb)]++);}else _0x130eeb[_0x3eef9b(0x14f)][_0x3eef9b(0x11d)]({'name':_0x5c8d22[_0x3eef9b(0x14e)]['name'],'action':_0x3eef9b(0xd0)}),_0x130eeb['counts'][_0x3eef9b(0x14f)][_0x3eef9b(0xd0)]++;}if(_0x11ff5f?.['dryRun'])return _0x130eeb;_0x130eeb[_0x3eef9b(0x1c9)]=[],_0x130eeb['textKnowledgeBases']=[],_0x130eeb['prompts']=[],_0x130eeb[_0x3eef9b(0x1c4)]=[],_0x130eeb[_0x3eef9b(0x1c2)]=[],_0x130eeb[_0x3eef9b(0x14f)]=[];const _0xe75a25=_0x130eeb[_0x3eef9b(0x127)][_0x3eef9b(0x159)](_0x21ef02=>_0x21ef02['action']===_0x3eef9b(0x1ca));_0x130eeb[_0x3eef9b(0x127)]=_0xe75a25,_0x130eeb[_0x3eef9b(0x100)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0xe75a25[_0x3eef9b(0x111)]},'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 _0xd10f3b of _0x537ed2){try{const _0x3dee25=_0xea3ec0[_0x3eef9b(0x12b)](_0xd10f3b[_0x3eef9b(0xf6)][_0x3eef9b(0x182)]),_0x26c4c0=yamlKnowledgeBaseToApi(_0xd10f3b[_0x3eef9b(0xf6)],_0x1206d3);if(_0x3dee25)await this['client']['updateKnowledgeBase'](_0x3dee25['id'],_0x26c4c0),_0x56adda[_0x3eef9b(0x173)](_0xd10f3b[_0x3eef9b(0xf6)][_0x3eef9b(0x182)],_0x3dee25['id']),_0x130eeb[_0x3eef9b(0x1c9)][_0x3eef9b(0x11d)]({'name':_0xd10f3b[_0x3eef9b(0xf6)][_0x3eef9b(0x182)],'action':_0x3eef9b(0x146),'id':_0x3dee25['id']}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x1c9)][_0x3eef9b(0x146)]++;else{const _0x301b8f=await this[_0x3eef9b(0xf2)][_0x3eef9b(0x151)](_0x26c4c0);_0x56adda['set'](_0xd10f3b[_0x3eef9b(0xf6)]['name'],_0x301b8f['id']),_0x130eeb[_0x3eef9b(0x1c9)][_0x3eef9b(0x11d)]({'name':_0xd10f3b['yaml']['name'],'action':_0x3eef9b(0xd0),'id':_0x301b8f['id']}),_0x130eeb['counts'][_0x3eef9b(0x1c9)][_0x3eef9b(0xd0)]++;}}catch(_0x1bb1c4){_0x130eeb[_0x3eef9b(0x1c9)][_0x3eef9b(0x11d)]({'name':_0xd10f3b[_0x3eef9b(0xf6)][_0x3eef9b(0x182)],'action':_0x3eef9b(0x1ca),'error':_0x1bb1c4[_0x3eef9b(0x1b2)]}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x1c9)]['errors']++;}}for(const _0x423c5c of _0x88585e){try{const _0x73ee09=_0x50435c[_0x3eef9b(0x12b)](_0x423c5c[_0x3eef9b(0x182)]),_0x34ec4b=yamlTextKnowledgeBaseToApi({'name':_0x423c5c[_0x3eef9b(0x182)],'text':_0x423c5c[_0x3eef9b(0x1b7)]},_0x1206d3);if(_0x73ee09)await this[_0x3eef9b(0xf2)][_0x3eef9b(0x153)](_0x73ee09['id'],_0x34ec4b),_0xbdb04f[_0x3eef9b(0x173)](_0x423c5c[_0x3eef9b(0x182)],_0x73ee09['id']),_0x130eeb[_0x3eef9b(0xcd)][_0x3eef9b(0x11d)]({'name':_0x423c5c[_0x3eef9b(0x182)],'action':'updated','id':_0x73ee09['id']}),_0x130eeb['counts'][_0x3eef9b(0xcd)][_0x3eef9b(0x146)]++;else{const _0x344871=await this[_0x3eef9b(0xf2)]['createTextKnowledgeBase'](_0x34ec4b);_0xbdb04f[_0x3eef9b(0x173)](_0x423c5c['name'],_0x344871['id']),_0x130eeb[_0x3eef9b(0xcd)][_0x3eef9b(0x11d)]({'name':_0x423c5c[_0x3eef9b(0x182)],'action':_0x3eef9b(0xd0),'id':_0x344871['id']}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0xcd)][_0x3eef9b(0xd0)]++;}}catch(_0x2a693a){_0x130eeb['textKnowledgeBases'][_0x3eef9b(0x11d)]({'name':_0x423c5c['name'],'action':'error','error':_0x2a693a[_0x3eef9b(0x1b2)]}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0xcd)][_0x3eef9b(0x139)]++;}}for(const _0x3e6ee6 of _0x27c89e){try{const _0x3ba59f=_0x5e385c[_0x3eef9b(0x12b)](_0x3e6ee6[_0x3eef9b(0x14e)][_0x3eef9b(0x182)]),_0x27232d=yamlExperimentalKnowledgeBaseToApi(_0x3e6ee6[_0x3eef9b(0x14e)],_0x1206d3);if(_0x3ba59f)await this[_0x3eef9b(0xf2)]['updateExperimentalKnowledgeBase'](_0x3ba59f['id'],_0x27232d),_0xa9db74[_0x3eef9b(0x173)](_0x3e6ee6[_0x3eef9b(0x14e)][_0x3eef9b(0x182)],_0x3ba59f['id']),_0x130eeb[_0x3eef9b(0x1c2)]['push']({'name':_0x3e6ee6[_0x3eef9b(0x14e)][_0x3eef9b(0x182)],'action':_0x3eef9b(0x146),'id':_0x3ba59f['id']}),_0x130eeb['counts'][_0x3eef9b(0x1c2)]['updated']++;else{const _0xf4c389=await this[_0x3eef9b(0xf2)][_0x3eef9b(0x16d)](_0x27232d);_0xa9db74[_0x3eef9b(0x173)](_0x3e6ee6[_0x3eef9b(0x14e)]['name'],_0xf4c389['id']),_0x130eeb['experimentalKnowledgeBases'][_0x3eef9b(0x11d)]({'name':_0x3e6ee6[_0x3eef9b(0x14e)][_0x3eef9b(0x182)],'action':'created','id':_0xf4c389['id']}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x1c2)][_0x3eef9b(0xd0)]++;}}catch(_0x41c910){_0x130eeb[_0x3eef9b(0x1c2)][_0x3eef9b(0x11d)]({'name':_0x3e6ee6['def'][_0x3eef9b(0x182)],'action':_0x3eef9b(0x1ca),'error':_0x41c910['message']}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x1c2)][_0x3eef9b(0x139)]++;}}for(const _0x343b53 of _0x2eb056){try{const _0xe1d902=_0x143b2e[_0x3eef9b(0x12b)](_0x343b53[_0x3eef9b(0x14e)][_0x3eef9b(0x182)]),_0x449022=yamlExperimentalArtifactToApi(_0x343b53['def'],_0x1206d3);if(_0xe1d902)await this[_0x3eef9b(0xf2)][_0x3eef9b(0x131)](_0xe1d902['id'],_0x449022),_0x486c12[_0x3eef9b(0x173)](_0x343b53[_0x3eef9b(0x14e)][_0x3eef9b(0x182)],_0xe1d902['id']),_0x130eeb[_0x3eef9b(0x14f)]['push']({'name':_0x343b53[_0x3eef9b(0x14e)][_0x3eef9b(0x182)],'action':_0x3eef9b(0x146),'id':_0xe1d902['id']}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x14f)][_0x3eef9b(0x146)]++;else{const _0xdca14d=await this[_0x3eef9b(0xf2)][_0x3eef9b(0xfa)](_0x449022);_0x486c12[_0x3eef9b(0x173)](_0x343b53['def'][_0x3eef9b(0x182)],_0xdca14d['id']),_0x130eeb[_0x3eef9b(0x14f)]['push']({'name':_0x343b53[_0x3eef9b(0x14e)][_0x3eef9b(0x182)],'action':_0x3eef9b(0xd0),'id':_0xdca14d['id']}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x14f)][_0x3eef9b(0xd0)]++;}}catch(_0x27c22a){_0x130eeb['experimentalArtifacts'][_0x3eef9b(0x11d)]({'name':_0x343b53[_0x3eef9b(0x14e)][_0x3eef9b(0x182)],'action':'error','error':_0x27c22a['message']}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x14f)]['errors']++;}}for(const _0x580b79 of _0x399c1e){_0x3a40b9=[];try{const _0x5f281e=_0x278610[_0x3eef9b(0x12b)](_0x580b79[_0x3eef9b(0xf6)][_0x3eef9b(0x182)]),_0x45c48b=await agentDefToRequest(_0x580b79[_0x3eef9b(0xf6)],_0x580b79[_0x3eef9b(0x16f)],_0x580b79[_0x3eef9b(0x1c7)],_0x19d83a);if(_0x5f281e)await this[_0x3eef9b(0xf2)][_0x3eef9b(0x1c8)](_0x5f281e['id'],_0x45c48b),_0x1ae9c0[_0x3eef9b(0x173)](_0x580b79[_0x3eef9b(0xf6)][_0x3eef9b(0x182)],_0x5f281e['id']),_0x130eeb['agents'][_0x3eef9b(0x11d)]({'agentName':_0x580b79[_0x3eef9b(0xf6)][_0x3eef9b(0x182)],'action':'updated','agentId':_0x5f281e['id'],'warnings':_0x3a40b9[_0x3eef9b(0x111)]>0x0?_0x3a40b9:undefined}),_0x130eeb['counts'][_0x3eef9b(0x127)]['updated']++;else{const _0x1b514e=await this[_0x3eef9b(0xf2)][_0x3eef9b(0x179)](_0x45c48b);_0x1ae9c0['set'](_0x580b79[_0x3eef9b(0xf6)][_0x3eef9b(0x182)],_0x1b514e['id']),_0x130eeb[_0x3eef9b(0x127)][_0x3eef9b(0x11d)]({'agentName':_0x580b79[_0x3eef9b(0xf6)]['name'],'action':_0x3eef9b(0xd0),'agentId':_0x1b514e['id'],'warnings':_0x3a40b9[_0x3eef9b(0x111)]>0x0?_0x3a40b9:undefined}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x127)][_0x3eef9b(0xd0)]++;}}catch(_0x3a998f){_0x130eeb[_0x3eef9b(0x127)][_0x3eef9b(0x11d)]({'agentName':_0x580b79[_0x3eef9b(0xf6)][_0x3eef9b(0x182)],'action':_0x3eef9b(0x1ca),'error':_0x3a998f['message'],'warnings':_0x3a40b9[_0x3eef9b(0x111)]>0x0?_0x3a40b9:undefined}),_0x130eeb['counts']['agents']['errors']++;}}for(const _0x448150 of _0x27160c){try{const _0x57d3db=_0x17583c['get'](_0x448150[_0x3eef9b(0xf6)][_0x3eef9b(0x182)]),_0x109075=await yamlPromptToApi(_0x448150[_0x3eef9b(0xf6)],_0x1206d3,_0x19d83a);if(!_0x109075){_0x130eeb['prompts']['push']({'name':_0x448150['yaml']['name'],'action':_0x3eef9b(0x1ca),'error':_0x3eef9b(0x171)}),_0x130eeb['counts'][_0x3eef9b(0x18e)]['errors']++;continue;}if(_0x57d3db)await this[_0x3eef9b(0xf2)][_0x3eef9b(0x104)](_0x57d3db['id'],_0x109075),_0x2768da[_0x3eef9b(0x173)](_0x448150['yaml'][_0x3eef9b(0x182)],_0x57d3db['id']),_0x130eeb[_0x3eef9b(0x18e)][_0x3eef9b(0x11d)]({'name':_0x448150[_0x3eef9b(0xf6)][_0x3eef9b(0x182)],'action':_0x3eef9b(0x146),'id':_0x57d3db['id']}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x18e)][_0x3eef9b(0x146)]++;else{const _0x2f7a84=await this[_0x3eef9b(0xf2)]['createPrompt'](_0x109075);_0x2768da['set'](_0x448150['yaml']['name'],_0x2f7a84['id']),_0x130eeb['prompts'][_0x3eef9b(0x11d)]({'name':_0x448150[_0x3eef9b(0xf6)][_0x3eef9b(0x182)],'action':_0x3eef9b(0xd0),'id':_0x2f7a84['id']}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x18e)][_0x3eef9b(0xd0)]++;}}catch(_0x52ed35){_0x130eeb[_0x3eef9b(0x18e)][_0x3eef9b(0x11d)]({'name':_0x448150['yaml'][_0x3eef9b(0x182)],'action':_0x3eef9b(0x1ca),'error':_0x52ed35[_0x3eef9b(0x1b2)]}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x18e)][_0x3eef9b(0x139)]++;}}for(const _0x2bb656 of _0xb8ba23){try{const _0xb7496a=_0x5829ee[_0x3eef9b(0x12b)](_0x2bb656[_0x3eef9b(0xf6)]['service_type']),_0x3baa23=await yamlIntegrationToApi(_0x2bb656[_0x3eef9b(0xf6)],_0x1206d3,_0x19d83a);if(_0xb7496a){await this['client'][_0x3eef9b(0x175)](_0xb7496a['id']);const _0x593f21=await this['client']['createIntegration'](_0x3baa23);_0x130eeb[_0x3eef9b(0x1c4)]['push']({'name':_0x2bb656[_0x3eef9b(0xf6)]['service_type'],'action':_0x3eef9b(0x146),'id':_0x593f21['id']}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x1c4)][_0x3eef9b(0x146)]++;}else{const _0x5d4563=await this[_0x3eef9b(0xf2)][_0x3eef9b(0x123)](_0x3baa23);_0x130eeb[_0x3eef9b(0x1c4)][_0x3eef9b(0x11d)]({'name':_0x2bb656[_0x3eef9b(0xf6)][_0x3eef9b(0xcf)],'action':_0x3eef9b(0xd0),'id':_0x5d4563['id']}),_0x130eeb[_0x3eef9b(0x100)][_0x3eef9b(0x1c4)][_0x3eef9b(0xd0)]++;}}catch(_0xb8fa4b){_0x130eeb['integrations']['push']({'name':_0x2bb656[_0x3eef9b(0xf6)][_0x3eef9b(0xcf)],'action':_0x3eef9b(0x1ca),'error':_0xb8fa4b[_0x3eef9b(0x1b2)]}),_0x130eeb['counts'][_0x3eef9b(0x1c4)][_0x3eef9b(0x139)]++;}}return _0x130eeb;}async[a96_0x4932d2(0xc5)](_0x12eacb,_0x3c92ec,_0x4b7f7b,_0x3fe170){const _0x15afc1=a96_0x4932d2,{projectId:_0x5b2180,project:_0x5bb0d2}=await this[_0x15afc1(0x167)](_0x12eacb),_0x4e36cc=_0x5bb0d2['attributes']['name'],_0xf99842=await this[_0x15afc1(0xf2)]['listAgentsFull'](_0x5b2180),_0x4cca12=_0xf99842['find'](_0x3a271d=>_0x3a271d[_0x15afc1(0x1c1)][_0x15afc1(0x182)]===_0x3c92ec);if(!_0x4cca12)throw new SDKError(ErrorCode[_0x15afc1(0x19f)],_0x15afc1(0xe2)+_0x3c92ec,undefined,{'helpText':_0x15afc1(0x148)+_0xf99842[_0x15afc1(0x12a)](_0x589913=>_0x589913['attributes']['name'])['join'](',\x20')});let _0x5642bf;if(_0x4b7f7b)_0x5642bf=_0x4b7f7b;else{const _0x4b7018=a96_0x35c8eb[_0x15afc1(0x185)](process[_0x15afc1(0x149)](),_0x15afc1(0x127)),_0x47aaf0=getSanitizedPathWithMigration(_0x4b7018,_0x4e36cc);_0x47aaf0['renamed']&&this[_0x15afc1(0x144)][_0x15afc1(0x12c)](_0x15afc1(0x155)+a96_0x35c8eb['basename'](_0x47aaf0[_0x15afc1(0x164)])+_0x15afc1(0x1cb)+a96_0x35c8eb[_0x15afc1(0xff)](_0x47aaf0[_0x15afc1(0x14c)])),_0x5642bf=_0x47aaf0[_0x15afc1(0x14c)];}const _0x560558=getSanitizedPathWithMigration(_0x5642bf,_0x3c92ec);_0x560558[_0x15afc1(0x11b)]&&this[_0x15afc1(0x144)][_0x15afc1(0x12c)]('Renamed\x20agent\x20folder:\x20'+a96_0x35c8eb[_0x15afc1(0xff)](_0x560558[_0x15afc1(0x164)])+_0x15afc1(0x1cb)+a96_0x35c8eb[_0x15afc1(0xff)](_0x560558[_0x15afc1(0x14c)]));const _0x101a28=_0x560558[_0x15afc1(0x14c)],_0x47afe5=new Map(),_0x39d51f=new Map(),_0xc27e1f=await this[_0x15afc1(0xf2)]['listKnowledgeBases'](_0x5b2180),_0x531b81=await this[_0x15afc1(0xf2)]['listTextKnowledgeBases'](_0x5b2180),_0x1e311f=await this[_0x15afc1(0xf2)]['listExperimentalKnowledgeBases'](_0x5b2180),_0x39a199=new Map(),_0x1f67d7=new Map();for(const _0x321eb1 of _0xc27e1f){_0x47afe5[_0x15afc1(0x173)](_0x321eb1['id'],_0x321eb1['attributes'][_0x15afc1(0x182)]);}for(const _0x2ef776 of _0x531b81){_0x39a199[_0x15afc1(0x173)](_0x2ef776['id'],_0x2ef776[_0x15afc1(0x1c1)][_0x15afc1(0x182)]);}for(const _0x4aca18 of _0x1e311f){_0x1f67d7[_0x15afc1(0x173)](_0x4aca18['id'],_0x4aca18['attributes'][_0x15afc1(0x182)]);}for(const _0x121902 of _0xf99842){_0x39d51f['set'](_0x121902['id'],_0x121902['attributes'][_0x15afc1(0x182)]);}const _0x3f42cc={'resolveKnowledgeBaseName':async _0x53bd2=>_0x47afe5['get'](_0x53bd2),'resolveTextKnowledgeBaseName':async _0x4357f1=>_0x39a199['get'](_0x4357f1),'resolveAgentName':async _0x209d14=>_0x39d51f[_0x15afc1(0x12b)](_0x209d14),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async()=>undefined,'resolveExperimentalKnowledgeBaseName':async _0x23824a=>_0x1f67d7[_0x15afc1(0x12b)](_0x23824a),'onWarning':_0x1c9286=>this[_0x15afc1(0x144)]['warn'](_0x1c9286)},_0x39bcde=a96_0x35c8eb['join'](_0x101a28,'prompt.md'),_0x144e15=a96_0x35c8eb[_0x15afc1(0x185)](_0x101a28,_0x15afc1(0x17c)),_0x31f362=a96_0x35c8eb[_0x15afc1(0x185)](_0x101a28,'starter_message.md'),_0x1929a2=!a96_0x12834e['existsSync'](_0x144e15);if(_0x3fe170?.[_0x15afc1(0x141)])return{'agentName':_0x3c92ec,'outputPath':_0x101a28,'isNew':_0x1929a2,'hasChanges':!![]};a96_0x12834e[_0x15afc1(0x18a)](_0x5642bf,{'recursive':!![]}),a96_0x12834e['mkdirSync'](_0x101a28,{'recursive':!![]});const _0x44d4d9=a96_0x35c8eb['join'](_0x5642bf,_0x15afc1(0xf7));!a96_0x12834e[_0x15afc1(0x17f)](_0x44d4d9)&&a96_0x12834e[_0x15afc1(0x15f)](_0x44d4d9,createAgentConfigContent(_0x12eacb));const {yaml:_0xdd219,systemPrompt:_0x18e376,starterMessage:_0x5d4cc2}=await agentResponseToDef(_0x4cca12,_0x3f42cc);let _0x31214f=_0x1929a2;if(!_0x1929a2){const _0x1d5094=a96_0x12834e[_0x15afc1(0x17f)](_0x39bcde)?a96_0x12834e[_0x15afc1(0x1c0)](_0x39bcde,_0x15afc1(0xf0)):'',_0x5803b7=a96_0x12834e[_0x15afc1(0x1c0)](_0x144e15,_0x15afc1(0xf0));_0x31214f=_0x1d5094!==_0x18e376||_0x5803b7!==toAgentYamlString(_0xdd219);}a96_0x12834e[_0x15afc1(0x15f)](_0x39bcde,_0x18e376),a96_0x12834e[_0x15afc1(0x15f)](_0x144e15,toAgentYamlString(_0xdd219));if(_0x5d4cc2&&_0x5d4cc2[_0x15afc1(0x16b)]('\x0a'))a96_0x12834e['writeFileSync'](_0x31f362,_0x5d4cc2);else a96_0x12834e[_0x15afc1(0x17f)](_0x31f362)&&a96_0x12834e[_0x15afc1(0x109)](_0x31f362);return{'agentName':_0x3c92ec,'outputPath':_0x101a28,'isNew':_0x1929a2,'hasChanges':_0x31214f};}async[a96_0x4932d2(0x119)](_0x498bce,_0x1bd4aa){const _0x2d144e=a96_0x4932d2;let _0x1b6b41;isAgentYamlPath(_0x498bce)?_0x1b6b41=getAgentDirFromYamlPath(_0x498bce):_0x1b6b41=_0x498bce;const {config:_0x4b9b66}=findAgentConfig(_0x1b6b41),_0x27db6b=await this[_0x2d144e(0x17a)](_0x4b9b66[_0x2d144e(0x154)]),_0x5db637=a96_0x35c8eb[_0x2d144e(0x185)](_0x1b6b41,'agent.yml'),_0xea5919=a96_0x35c8eb[_0x2d144e(0x185)](_0x1b6b41,'prompt.md'),_0x13d801=a96_0x35c8eb[_0x2d144e(0x185)](_0x1b6b41,_0x2d144e(0xce));if(!a96_0x12834e[_0x2d144e(0x17f)](_0x5db637))throw new SDKError(ErrorCode[_0x2d144e(0xc2)],_0x2d144e(0xd1)+_0x1b6b41,undefined,{'helpText':_0x2d144e(0x143)});const _0x548a4c=parseAgentYaml(a96_0x12834e[_0x2d144e(0x1c0)](_0x5db637,_0x2d144e(0xf0)),_0x5db637),_0x2f9932=a96_0x12834e[_0x2d144e(0x17f)](_0xea5919)?a96_0x12834e[_0x2d144e(0x1c0)](_0xea5919,_0x2d144e(0xf0)):'',_0x4748bb=a96_0x12834e[_0x2d144e(0x17f)](_0x13d801)?a96_0x12834e['readFileSync'](_0x13d801,_0x2d144e(0xf0)):_0x548a4c[_0x2d144e(0x145)];if(_0x1bd4aa?.[_0x2d144e(0x141)])return{'agentName':_0x548a4c['name'],'action':_0x2d144e(0xd0),'projectId':_0x27db6b};const _0x43fd8a=await this[_0x2d144e(0xf2)]['listAgentsFull'](_0x27db6b),_0x3cfc65=await this[_0x2d144e(0xf2)]['listKnowledgeBases'](_0x27db6b),_0x348958=await this[_0x2d144e(0xf2)][_0x2d144e(0xda)](_0x27db6b),_0x1c37dc=await this[_0x2d144e(0xf2)][_0x2d144e(0x12d)](_0x27db6b),_0x32f780=await this[_0x2d144e(0xf2)][_0x2d144e(0x162)](_0x27db6b),_0x193275=new Map(),_0x1403a3=new Map(),_0x595a79=new Map(),_0x28cad1=new Map();for(const _0x2b9e01 of _0x3cfc65){_0x193275[_0x2d144e(0x173)](_0x2b9e01[_0x2d144e(0x1c1)]['name'],_0x2b9e01['id']);}for(const _0x4fc2cd of _0x348958){_0x1403a3[_0x2d144e(0x173)](_0x4fc2cd[_0x2d144e(0x1c1)][_0x2d144e(0x182)],_0x4fc2cd['id']);}for(const _0x36f112 of _0x1c37dc){_0x595a79[_0x2d144e(0x173)](_0x36f112[_0x2d144e(0x1c1)][_0x2d144e(0x182)],_0x36f112['id']);}for(const _0x49352b of _0x43fd8a){_0x28cad1['set'](_0x49352b[_0x2d144e(0x1c1)]['name'],_0x49352b['id']);}const _0x2360c0=[],_0x315200={'projectId':_0x27db6b,'resolveKnowledgeBaseId':async _0x189d00=>_0x193275['get'](_0x189d00),'resolveTextKnowledgeBaseId':async _0x1cb8a9=>_0x1403a3['get'](_0x1cb8a9),'resolveAgentId':async _0x3443cb=>_0x28cad1[_0x2d144e(0x12b)](_0x3443cb),'resolveWebSearchToolId':async()=>undefined,'resolveImageGeneratorId':async()=>undefined,'resolvePromptId':async()=>undefined,'resolveParentSegmentKBId':async()=>_0x32f780?.['id'],'resolveExperimentalKnowledgeBaseId':async _0x33d471=>_0x595a79['get'](_0x33d471),'onWarning':_0x228bd1=>{const _0x4b012a=_0x2d144e;this[_0x4b012a(0x144)]['warn'](_0x228bd1),_0x2360c0['push'](_0x228bd1);}};try{const _0x25a898=_0x43fd8a[_0x2d144e(0x1b1)](_0x1ad33f=>_0x1ad33f[_0x2d144e(0x1c1)][_0x2d144e(0x182)]===_0x548a4c[_0x2d144e(0x182)]),_0x5a9bb0=await agentDefToRequest(_0x548a4c,_0x2f9932,_0x4748bb,_0x315200);if(_0x25a898)return await this[_0x2d144e(0xf2)]['updateAgentResponse'](_0x25a898['id'],_0x5a9bb0),{'agentName':_0x548a4c[_0x2d144e(0x182)],'action':_0x2d144e(0x146),'projectId':_0x27db6b,'agentId':_0x25a898['id'],'warnings':_0x2360c0[_0x2d144e(0x111)]>0x0?_0x2360c0:undefined};else{const _0x5f2d43=await this[_0x2d144e(0xf2)][_0x2d144e(0x179)](_0x5a9bb0);return{'agentName':_0x548a4c['name'],'action':_0x2d144e(0xd0),'projectId':_0x27db6b,'agentId':_0x5f2d43['id'],'warnings':_0x2360c0['length']>0x0?_0x2360c0:undefined};}}catch(_0x1eadf7){return{'agentName':_0x548a4c[_0x2d144e(0x182)],'action':_0x2d144e(0x1ca),'projectId':_0x27db6b,'error':_0x1eadf7[_0x2d144e(0x1b2)],'warnings':_0x2360c0[_0x2d144e(0x111)]>0x0?_0x2360c0:undefined};}}async['cloneProject'](_0x38773c,_0x2b7462,_0x1d97e8){const _0x28ff98=a96_0x4932d2,_0x3ee89b=a96_0x12834e[_0x28ff98(0x17f)](_0x38773c)&&a96_0x12834e[_0x28ff98(0x17f)](a96_0x35c8eb['join'](_0x38773c,_0x28ff98(0xf7)));let _0x4fcfab;const _0x551585=[],_0x528b09=[],_0x2e54e7=[],_0x484eac=[],_0x14b93a=[],_0x42999b=[],_0x13278d=[];if(_0x3ee89b){const _0x29f46d=loadAgentConfig(a96_0x35c8eb[_0x28ff98(0x185)](_0x38773c,'tdx.json'));_0x4fcfab=_0x29f46d[_0x28ff98(0x154)];const _0x5515db=a96_0x12834e[_0x28ff98(0x137)](_0x38773c,{'withFileTypes':!![]});for(const _0x1eff2a of _0x5515db){if(!_0x1eff2a[_0x28ff98(0xeb)]())continue;if([_0x28ff98(0x197),_0x28ff98(0x194),'experimental_artifacts',_0x28ff98(0x18e),'integrations']['includes'](_0x1eff2a[_0x28ff98(0x182)]))continue;const _0x5e1b12=a96_0x35c8eb[_0x28ff98(0x185)](_0x38773c,_0x1eff2a[_0x28ff98(0x182)]);if(isAgentDir(_0x5e1b12)){const _0x131b59=a96_0x35c8eb[_0x28ff98(0x185)](_0x5e1b12,_0x28ff98(0x17c)),_0x42b9b4=a96_0x35c8eb[_0x28ff98(0x185)](_0x5e1b12,_0x28ff98(0x1ad)),_0x517140=a96_0x35c8eb[_0x28ff98(0x185)](_0x5e1b12,'starter_message.md'),_0x351a25=parseAgentYaml(a96_0x12834e[_0x28ff98(0x1c0)](_0x131b59,_0x28ff98(0xf0)),_0x131b59),_0x4fe99f=a96_0x12834e['existsSync'](_0x42b9b4)?a96_0x12834e[_0x28ff98(0x1c0)](_0x42b9b4,_0x28ff98(0xf0)):'',_0x15df11=a96_0x12834e[_0x28ff98(0x17f)](_0x517140)?a96_0x12834e[_0x28ff98(0x1c0)](_0x517140,_0x28ff98(0xf0)):_0x351a25[_0x28ff98(0x145)];_0x551585[_0x28ff98(0x11d)]({'name':_0x351a25[_0x28ff98(0x182)],'dir':_0x5e1b12,'yaml':_0x351a25,'systemPrompt':_0x4fe99f,'starterMessage':_0x15df11});}}const _0x32d6fa=getKnowledgeBasesDir(_0x38773c);if(a96_0x12834e[_0x28ff98(0x17f)](_0x32d6fa)){const _0x37016a=a96_0x12834e['readdirSync'](_0x32d6fa);for(const _0x59b857 of _0x37016a){const _0x2d1f8f=a96_0x35c8eb['join'](_0x32d6fa,_0x59b857);if(_0x59b857['endsWith'](_0x28ff98(0xd4))){const _0x506852=parseKnowledgeBaseYaml(a96_0x12834e['readFileSync'](_0x2d1f8f,_0x28ff98(0xf0)),_0x2d1f8f);_0x528b09['push']({'name':_0x506852[_0x28ff98(0x182)],'path':_0x2d1f8f,'yaml':_0x506852});}else{if(_0x59b857['endsWith'](_0x28ff98(0x125))){const _0x28d9b3=a96_0x12834e[_0x28ff98(0x1c0)](_0x2d1f8f,_0x28ff98(0xf0)),{name:_0x2295fb,text:_0x31496e}=parseTextKnowledgeBaseMd(_0x28d9b3,_0x59b857);_0x2e54e7[_0x28ff98(0x11d)]({'name':_0x2295fb,'path':_0x2d1f8f,'text':_0x31496e});}}}}const _0x5cd1e8=getPromptsDir(_0x38773c);if(a96_0x12834e['existsSync'](_0x5cd1e8)){const _0x4db595=a96_0x12834e[_0x28ff98(0x137)](_0x5cd1e8)[_0x28ff98(0x159)](_0x3544e1=>_0x3544e1[_0x28ff98(0x13c)](_0x28ff98(0xd4)));for(const _0x5bd549 of _0x4db595){const _0x188636=a96_0x35c8eb[_0x28ff98(0x185)](_0x5cd1e8,_0x5bd549),_0x18d246=parsePromptYaml(a96_0x12834e[_0x28ff98(0x1c0)](_0x188636,_0x28ff98(0xf0)),_0x188636);_0x484eac[_0x28ff98(0x11d)]({'name':_0x18d246[_0x28ff98(0x182)],'path':_0x188636,'yaml':_0x18d246});}}const _0x2f7ca4=getIntegrationsDir(_0x38773c);if(a96_0x12834e[_0x28ff98(0x17f)](_0x2f7ca4)){const _0x3eefde=a96_0x12834e[_0x28ff98(0x137)](_0x2f7ca4)[_0x28ff98(0x159)](_0x189710=>_0x189710[_0x28ff98(0x13c)](_0x28ff98(0xd4)));for(const _0x1e4944 of _0x3eefde){const _0x4f05fd=a96_0x35c8eb[_0x28ff98(0x185)](_0x2f7ca4,_0x1e4944),_0x2a4e00=parseIntegrationYaml(a96_0x12834e[_0x28ff98(0x1c0)](_0x4f05fd,_0x28ff98(0xf0)),_0x4f05fd);SAFE_INTEGRATION_TYPES[_0x28ff98(0x16b)](_0x2a4e00[_0x28ff98(0xcf)][_0x28ff98(0x1a2)]())?_0x14b93a[_0x28ff98(0x11d)]({'name':_0x2a4e00[_0x28ff98(0x182)],'path':_0x4f05fd,'yaml':_0x2a4e00}):this[_0x28ff98(0x144)][_0x28ff98(0x1b3)](_0x28ff98(0x126)+_0x2a4e00[_0x28ff98(0x182)]+_0x28ff98(0xe3)+_0x2a4e00[_0x28ff98(0xcf)]+_0x28ff98(0x166)+(_0x28ff98(0x174)+SAFE_INTEGRATION_TYPES[_0x28ff98(0x185)](',\x20')+')\x20can\x20be\x20cloned.'));}}const _0xc9cb50=getExperimentalKnowledgeBasesDir(_0x38773c);if(a96_0x12834e[_0x28ff98(0x17f)](_0xc9cb50)){const _0x2b911e=a96_0x12834e[_0x28ff98(0x137)](_0xc9cb50,{'withFileTypes':!![]});for(const _0x582ee7 of _0x2b911e){if(!_0x582ee7[_0x28ff98(0xeb)]())continue;const _0xe716f4=a96_0x35c8eb[_0x28ff98(0x185)](_0xc9cb50,_0x582ee7[_0x28ff98(0x182)]),_0x100406=a96_0x35c8eb['join'](_0xe716f4,_0x582ee7[_0x28ff98(0x182)]+_0x28ff98(0xd4));if(a96_0x12834e[_0x28ff98(0x17f)](_0x100406)){const _0xddc839=parseExperimentalKnowledgeBaseYaml(a96_0x12834e['readFileSync'](_0x100406,_0x28ff98(0xf0)),_0x100406),_0x585545=a96_0x35c8eb['join'](_0xe716f4,'functions'),_0xd10c1=[];if(a96_0x12834e['existsSync'](_0x585545)){const _0x2dce7d=a96_0x12834e[_0x28ff98(0x137)](_0x585545,{'withFileTypes':!![]});for(const _0x458aa1 of _0x2dce7d){if(!_0x458aa1[_0x28ff98(0xeb)]())continue;const _0x11dc03=a96_0x35c8eb[_0x28ff98(0x185)](_0x585545,_0x458aa1['name']),_0xbba3a=a96_0x35c8eb[_0x28ff98(0x185)](_0x11dc03,_0x28ff98(0xd5)),_0x5f5353=a96_0x35c8eb['join'](_0x11dc03,_0x28ff98(0x1bb));if(a96_0x12834e[_0x28ff98(0x17f)](_0xbba3a)&&a96_0x12834e['existsSync'](_0x5f5353)){const _0x246fc4=a96_0x12834e[_0x28ff98(0x1c0)](_0xbba3a,'utf-8'),_0x4788a7=a96_0x12834e[_0x28ff98(0x1c0)](_0x5f5353,_0x28ff98(0xf0));_0xd10c1['push']({'name':_0x458aa1[_0x28ff98(0x182)],'code':_0x246fc4,'json_schema':_0x4788a7});}}}const _0x3893d9={..._0xddc839,'functions':_0xd10c1};_0x42999b[_0x28ff98(0x11d)]({'name':_0xddc839[_0x28ff98(0x182)],'path':_0xe716f4,'def':_0x3893d9});}}}const _0x44b18e=getExperimentalArtifactsDir(_0x38773c);if(a96_0x12834e[_0x28ff98(0x17f)](_0x44b18e)){const _0x190881=a96_0x12834e[_0x28ff98(0x137)](_0x44b18e,{'withFileTypes':!![]});for(const _0x1e0e03 of _0x190881){if(!_0x1e0e03[_0x28ff98(0xeb)]())continue;const _0x50e177=a96_0x35c8eb[_0x28ff98(0x185)](_0x44b18e,_0x1e0e03[_0x28ff98(0x182)]),_0x39adbf=a96_0x35c8eb['join'](_0x50e177,_0x1e0e03[_0x28ff98(0x182)]+_0x28ff98(0xd4));if(a96_0x12834e[_0x28ff98(0x17f)](_0x39adbf)){const _0x47b907=parseExperimentalArtifactYaml(a96_0x12834e['readFileSync'](_0x39adbf,_0x28ff98(0xf0)),_0x39adbf),_0x2823e4=a96_0x35c8eb[_0x28ff98(0x185)](_0x50e177,_0x28ff98(0xd5)),_0x322652=a96_0x12834e[_0x28ff98(0x17f)](_0x2823e4)?a96_0x12834e[_0x28ff98(0x1c0)](_0x2823e4,_0x28ff98(0xf0)):'',_0x14769d=a96_0x35c8eb[_0x28ff98(0x185)](_0x50e177,_0x28ff98(0xf9)),_0x30834f=[];if(a96_0x12834e[_0x28ff98(0x17f)](_0x14769d)){const _0x3347e3=a96_0x12834e['readdirSync'](_0x14769d);for(const _0x36e141 of _0x3347e3){const _0x295af0=a96_0x35c8eb['join'](_0x14769d,_0x36e141);if(a96_0x12834e[_0x28ff98(0x1ac)](_0x295af0)[_0x28ff98(0x19c)]()){const _0x1a8474=a96_0x12834e[_0x28ff98(0x1c0)](_0x295af0,'utf-8');_0x30834f['push']({'file_name':_0x36e141,'text_content':_0x1a8474});}}}const _0x5ceb52={..._0x47b907,'code':_0x322652,'files':_0x30834f};_0x13278d[_0x28ff98(0x11d)]({'name':_0x47b907['name'],'path':_0x50e177,'def':_0x5ceb52});}}}}else{const _0x20f704=await this[_0x28ff98(0x17a)](_0x38773c),_0x42d986=await this['client'][_0x28ff98(0x1c5)](_0x20f704);_0x4fcfab=_0x42d986[_0x28ff98(0x1c1)][_0x28ff98(0x182)];const _0x83265e=await this[_0x28ff98(0xf2)]['listAgentsFull'](_0x20f704),_0x3c72f5=await this['client'][_0x28ff98(0x10d)](_0x20f704),_0x83fc3e=await this[_0x28ff98(0xf2)]['listTextKnowledgeBases'](_0x20f704),_0x2f4164=await this[_0x28ff98(0xf2)]['listPrompts'](_0x20f704),_0x133351=await this[_0x28ff98(0xf2)][_0x28ff98(0x158)](_0x20f704),_0x15b80b=await this[_0x28ff98(0xf2)][_0x28ff98(0x12d)](_0x20f704),_0x11e927=await this[_0x28ff98(0xf2)][_0x28ff98(0x172)](_0x20f704),_0x3fbf81=new Map(),_0x222130=new Map(),_0x15ae43=new Map(),_0x5d933b=new Map(),_0x568961=new Map(),_0x2b0edc=new Map();for(const _0x164922 of _0x3c72f5){_0x3fbf81['set'](_0x164922['id'],_0x164922[_0x28ff98(0x1c1)][_0x28ff98(0x182)]);}for(const _0x69218d of _0x83fc3e){_0x222130[_0x28ff98(0x173)](_0x69218d['id'],_0x69218d['attributes'][_0x28ff98(0x182)]);}for(const _0x6169bb of _0x83265e){_0x15ae43[_0x28ff98(0x173)](_0x6169bb['id'],_0x6169bb['attributes']['name']);}for(const _0x5725bd of _0x2f4164){_0x5d933b['set'](_0x5725bd['id'],_0x5725bd[_0x28ff98(0x1c1)][_0x28ff98(0x182)]);}for(const _0x4e8087 of _0x15b80b){_0x568961[_0x28ff98(0x173)](_0x4e8087['id'],_0x4e8087[_0x28ff98(0x1c1)][_0x28ff98(0x182)]);}for(const _0x269fe0 of _0x11e927){_0x2b0edc[_0x28ff98(0x173)](_0x269fe0['id'],_0x269fe0['attributes'][_0x28ff98(0x182)]);}const _0x47a06c={'resolveKnowledgeBaseName':async _0x3bd518=>_0x3fbf81[_0x28ff98(0x12b)](_0x3bd518),'resolveTextKnowledgeBaseName':async _0x1ca03b=>_0x222130[_0x28ff98(0x12b)](_0x1ca03b),'resolveAgentName':async _0x4b6c50=>_0x15ae43[_0x28ff98(0x12b)](_0x4b6c50),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async _0x579398=>_0x5d933b[_0x28ff98(0x12b)](_0x579398),'resolveExperimentalKnowledgeBaseName':async _0x2fb780=>_0x568961['get'](_0x2fb780),'onWarning':_0x491a2b=>this[_0x28ff98(0x144)]['warn'](_0x491a2b)};for(const _0x3ef56d of _0x83265e){const _0x4373df=await agentResponseToDef(_0x3ef56d,_0x47a06c),{yaml:_0x169677,systemPrompt:_0x28a2dd,starterMessage:_0x3d242d}=_0x4373df;_0x551585[_0x28ff98(0x11d)]({'name':_0x169677[_0x28ff98(0x182)],'dir':'','yaml':_0x169677,'systemPrompt':_0x28a2dd,'starterMessage':_0x3d242d});}for(const _0x58f594 of _0x3c72f5){const _0x4cf1b2=apiKnowledgeBaseToYaml(_0x58f594);_0x528b09[_0x28ff98(0x11d)]({'name':_0x4cf1b2[_0x28ff98(0x182)],'path':'','yaml':_0x4cf1b2});}for(const _0x268b11 of _0x83fc3e){_0x2e54e7[_0x28ff98(0x11d)]({'name':_0x268b11['attributes'][_0x28ff98(0x182)],'path':'','text':_0x268b11[_0x28ff98(0x1c1)][_0x28ff98(0x1b7)]});}for(const _0x581b4e of _0x2f4164){const _0x529c1c=await apiPromptToYaml(_0x581b4e,_0x47a06c);_0x529c1c&&_0x484eac[_0x28ff98(0x11d)]({'name':_0x529c1c['name'],'path':'','yaml':_0x529c1c});}for(const _0x3d97d0 of _0x133351){if(!_0x3d97d0['attributes'][_0x28ff98(0x1a8)]&&SAFE_INTEGRATION_TYPES['includes'](_0x3d97d0[_0x28ff98(0x1c1)][_0x28ff98(0xf4)][_0x28ff98(0x1a2)]())){const _0x2cfbd9=await apiIntegrationToYaml(_0x3d97d0,_0x47a06c);_0x14b93a[_0x28ff98(0x11d)]({'name':_0x3d97d0[_0x28ff98(0x1c1)][_0x28ff98(0xf4)][_0x28ff98(0x1a2)](),'path':'','yaml':_0x2cfbd9});}}for(const _0x9d1218 of _0x15b80b){const _0x3823db=apiExperimentalKnowledgeBaseToYaml(_0x9d1218);_0x42999b['push']({'name':_0x3823db['name'],'path':'','def':_0x3823db});}for(const _0x482ed7 of _0x11e927){const _0x3cfed7=apiExperimentalArtifactToYaml(_0x482ed7);_0x13278d['push']({'name':_0x3cfed7[_0x28ff98(0x182)],'path':'','def':_0x3cfed7});}}const _0x1309cb={'sourceProjectName':_0x4fcfab,'newProjectName':_0x2b7462,'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}}},_0x519625=await this[_0x28ff98(0xf2)]['listProjects'](),_0x42bdb9=_0x519625[_0x28ff98(0x1b1)](_0x4ac943=>_0x4ac943['attributes'][_0x28ff98(0x182)]===_0x2b7462);if(_0x42bdb9)throw new SDKError(ErrorCode[_0x28ff98(0x1ba)],_0x28ff98(0x1ab)+_0x2b7462+_0x28ff98(0x187),undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x1d97e8?.[_0x28ff98(0x141)])return _0x1309cb['counts'][_0x28ff98(0x127)][_0x28ff98(0xd0)]=_0x551585['length'],_0x1309cb[_0x28ff98(0x100)][_0x28ff98(0x1c9)][_0x28ff98(0xd0)]=_0x528b09[_0x28ff98(0x111)],_0x1309cb[_0x28ff98(0x100)][_0x28ff98(0xcd)][_0x28ff98(0xd0)]=_0x2e54e7['length'],_0x1309cb[_0x28ff98(0x100)][_0x28ff98(0x1c2)][_0x28ff98(0xd0)]=_0x42999b[_0x28ff98(0x111)],_0x1309cb['counts'][_0x28ff98(0x14f)][_0x28ff98(0xd0)]=_0x13278d[_0x28ff98(0x111)],_0x1309cb[_0x28ff98(0x100)][_0x28ff98(0x18e)][_0x28ff98(0xd0)]=_0x484eac[_0x28ff98(0x111)],_0x1309cb[_0x28ff98(0x100)][_0x28ff98(0x1c4)]['created']=_0x14b93a['length'],_0x1309cb;const _0x4b9c46=await this[_0x28ff98(0xf2)][_0x28ff98(0x15e)]({'name':_0x2b7462}),_0x4bfe79=_0x4b9c46['id'];_0x1309cb[_0x28ff98(0x112)]=_0x4bfe79;const _0x4aa691=new Map(),_0x12d21d=new Map(),_0x296fb6=new Map(),_0x4af98d=new Map(),_0x16f475=new Map(),_0x1ca406=new Map(),_0x2ee26f=new Map(),_0x26efe6=new Map(),_0xb6243=new Set(),_0x508c5d=new Set();for(const _0x1cfe0a of _0x551585){for(const _0x144548 of _0x1cfe0a[_0x28ff98(0xf6)][_0x28ff98(0x19b)]||[]){if(_0x144548[_0x28ff98(0x1ae)]===_0x28ff98(0xc1)&&_0x144548[_0x28ff98(0xfb)]){const _0xf40d3=parseRef(_0x144548[_0x28ff98(0xfb)]);if(_0xf40d3)_0xb6243['add'](_0xf40d3[_0x28ff98(0x182)]);}else{if(_0x144548['type']===_0x28ff98(0x138)&&_0x144548[_0x28ff98(0xfb)]){const _0x1cedf8=parseRef(_0x144548[_0x28ff98(0xfb)]);if(_0x1cedf8)_0x508c5d[_0x28ff98(0xca)](_0x1cedf8[_0x28ff98(0x182)]);}}}}for(const _0x90d64f of _0xb6243){try{const _0x3ba05a=await this['client']['createImageGenerator']({'projectId':_0x4bfe79,'name':_0x90d64f});_0x16f475[_0x28ff98(0x173)](_0x90d64f,_0x3ba05a['id']),_0x1309cb[_0x28ff98(0x1aa)][_0x28ff98(0x11d)]({'name':_0x90d64f,'action':_0x28ff98(0xd0),'id':_0x3ba05a['id']}),_0x1309cb[_0x28ff98(0x100)]['imageGenerators'][_0x28ff98(0xd0)]++;}catch(_0x38add6){_0x1309cb['imageGenerators'][_0x28ff98(0x11d)]({'name':_0x90d64f,'action':_0x28ff98(0x1ca),'error':_0x38add6['message']}),_0x1309cb[_0x28ff98(0x100)]['imageGenerators'][_0x28ff98(0x139)]++;}}for(const _0x3ea6ab of _0x508c5d){try{const _0x5abc7f=await this[_0x28ff98(0xf2)][_0x28ff98(0x105)]({'projectId':_0x4bfe79,'name':_0x3ea6ab});_0x1ca406[_0x28ff98(0x173)](_0x3ea6ab,_0x5abc7f['id']),_0x1309cb[_0x28ff98(0xef)][_0x28ff98(0x11d)]({'name':_0x3ea6ab,'action':'created','id':_0x5abc7f['id']}),_0x1309cb['counts'][_0x28ff98(0xef)][_0x28ff98(0xd0)]++;}catch(_0x1ede2c){_0x1309cb['webSearchTools']['push']({'name':_0x3ea6ab,'action':'error','error':_0x1ede2c[_0x28ff98(0x1b2)]}),_0x1309cb[_0x28ff98(0x100)][_0x28ff98(0xef)][_0x28ff98(0x139)]++;}}const _0x496040=await this[_0x28ff98(0xf2)][_0x28ff98(0x162)](_0x4bfe79);let _0x3248e5=[];const _0x3da4fe={'projectId':_0x4bfe79,'resolveKnowledgeBaseId':async _0x4df998=>_0x4aa691[_0x28ff98(0x12b)](_0x4df998),'resolveTextKnowledgeBaseId':async _0x376d3a=>_0x12d21d[_0x28ff98(0x12b)](_0x376d3a),'resolveExperimentalKnowledgeBaseId':async _0x566ca8=>_0x2ee26f[_0x28ff98(0x12b)](_0x566ca8),'resolveAgentId':async _0x2c54bb=>_0x296fb6[_0x28ff98(0x12b)](_0x2c54bb),'resolveWebSearchToolId':async _0x38de41=>_0x1ca406['get'](_0x38de41),'resolveImageGeneratorId':async _0x34da04=>_0x16f475[_0x28ff98(0x12b)](_0x34da04),'resolvePromptId':async _0x26da47=>_0x4af98d[_0x28ff98(0x12b)](_0x26da47),'resolveParentSegmentKBId':async()=>_0x496040?.['id'],'onWarning':_0x1e70d5=>{const _0x5b747f=_0x28ff98;this[_0x5b747f(0x144)]['warn'](_0x1e70d5),_0x3248e5[_0x5b747f(0x11d)](_0x1e70d5);}};for(const _0x479f6c of _0x528b09){try{const _0x509c36=yamlKnowledgeBaseToApi(_0x479f6c[_0x28ff98(0xf6)],_0x4bfe79),_0x115006=await this[_0x28ff98(0xf2)][_0x28ff98(0x151)](_0x509c36);_0x4aa691['set'](_0x479f6c['yaml'][_0x28ff98(0x182)],_0x115006['id']),_0x1309cb[_0x28ff98(0x1c9)][_0x28ff98(0x11d)]({'name':_0x479f6c[_0x28ff98(0xf6)][_0x28ff98(0x182)],'action':_0x28ff98(0xd0),'id':_0x115006['id']}),_0x1309cb[_0x28ff98(0x100)]['knowledgeBases'][_0x28ff98(0xd0)]++;}catch(_0x184c34){_0x1309cb[_0x28ff98(0x1c9)][_0x28ff98(0x11d)]({'name':_0x479f6c['yaml'][_0x28ff98(0x182)],'action':_0x28ff98(0x1ca),'error':_0x184c34[_0x28ff98(0x1b2)]}),_0x1309cb['counts'][_0x28ff98(0x1c9)]['errors']++;}}for(const _0x30b3ff of _0x2e54e7){try{const _0x33e440=yamlTextKnowledgeBaseToApi({'name':_0x30b3ff[_0x28ff98(0x182)],'text':_0x30b3ff[_0x28ff98(0x1b7)]},_0x4bfe79),_0xe235af=await this[_0x28ff98(0xf2)]['createTextKnowledgeBase'](_0x33e440);_0x12d21d[_0x28ff98(0x173)](_0x30b3ff[_0x28ff98(0x182)],_0xe235af['id']),_0x1309cb[_0x28ff98(0xcd)][_0x28ff98(0x11d)]({'name':_0x30b3ff['name'],'action':_0x28ff98(0xd0),'id':_0xe235af['id']}),_0x1309cb['counts']['textKnowledgeBases'][_0x28ff98(0xd0)]++;}catch(_0x3da1f7){_0x1309cb[_0x28ff98(0xcd)][_0x28ff98(0x11d)]({'name':_0x30b3ff[_0x28ff98(0x182)],'action':_0x28ff98(0x1ca),'error':_0x3da1f7[_0x28ff98(0x1b2)]}),_0x1309cb[_0x28ff98(0x100)][_0x28ff98(0xcd)]['errors']++;}}for(const _0x5eba7f of _0x13278d){try{const _0x3f6b5d=yamlExperimentalArtifactToApi(_0x5eba7f[_0x28ff98(0x14e)],_0x4bfe79),_0x2b0377=await this[_0x28ff98(0xf2)][_0x28ff98(0xfa)](_0x3f6b5d);_0x26efe6[_0x28ff98(0x173)](_0x5eba7f[_0x28ff98(0x14e)][_0x28ff98(0x182)],_0x2b0377['id']),_0x1309cb[_0x28ff98(0x14f)][_0x28ff98(0x11d)]({'name':_0x5eba7f[_0x28ff98(0x14e)][_0x28ff98(0x182)],'action':_0x28ff98(0xd0),'id':_0x2b0377['id']}),_0x1309cb[_0x28ff98(0x100)][_0x28ff98(0x14f)]['created']++;}catch(_0x14dad8){_0x1309cb[_0x28ff98(0x14f)][_0x28ff98(0x11d)]({'name':_0x5eba7f[_0x28ff98(0x14e)][_0x28ff98(0x182)],'action':'error','error':_0x14dad8[_0x28ff98(0x1b2)]}),_0x1309cb[_0x28ff98(0x100)]['experimentalArtifacts']['errors']++;}}for(const _0x15bdc6 of _0x42999b){try{const _0x52060f=yamlExperimentalKnowledgeBaseToApi(_0x15bdc6[_0x28ff98(0x14e)],_0x4bfe79),_0x46da1d=await this['client'][_0x28ff98(0x16d)](_0x52060f);_0x2ee26f[_0x28ff98(0x173)](_0x15bdc6[_0x28ff98(0x14e)][_0x28ff98(0x182)],_0x46da1d['id']),_0x1309cb[_0x28ff98(0x1c2)][_0x28ff98(0x11d)]({'name':_0x15bdc6['def']['name'],'action':_0x28ff98(0xd0),'id':_0x46da1d['id']}),_0x1309cb[_0x28ff98(0x100)][_0x28ff98(0x1c2)][_0x28ff98(0xd0)]++;}catch(_0x3dcf88){_0x1309cb[_0x28ff98(0x1c2)]['push']({'name':_0x15bdc6[_0x28ff98(0x14e)][_0x28ff98(0x182)],'action':'error','error':_0x3dcf88[_0x28ff98(0x1b2)]}),_0x1309cb[_0x28ff98(0x100)][_0x28ff98(0x1c2)][_0x28ff98(0x139)]++;}}const _0x4455e9=[..._0x551585][_0x28ff98(0x18c)]((_0x5b9da1,_0x3d532c)=>{const _0x1e51d4=_0x28ff98,_0x154b15=_0x5b9da1[_0x1e51d4(0xf6)]['tools']?.[_0x1e51d4(0xc9)](_0x1f24ff=>_0x1f24ff[_0x1e51d4(0x1ae)]===_0x1e51d4(0x11a))??![],_0x1bed1f=_0x3d532c[_0x1e51d4(0xf6)][_0x1e51d4(0x19b)]?.['some'](_0x386bc1=>_0x386bc1[_0x1e51d4(0x1ae)]==='agent')??![];if(_0x154b15&&!_0x1bed1f)return 0x1;if(!_0x154b15&&_0x1bed1f)return-0x1;return 0x0;});for(const _0xd3004e of _0x4455e9){_0x3248e5=[];try{const _0x3ee0c1=_0xd3004e['yaml'][_0x28ff98(0x19b)]?.[_0x28ff98(0x159)](_0x269b17=>{const _0x425fc6=_0x28ff98;if(_0x269b17[_0x425fc6(0x1ae)]===_0x425fc6(0x11a)&&_0x269b17['target']){const _0x4b2f4e=parseRef(_0x269b17[_0x425fc6(0xfb)]);return _0x4b2f4e?.['name']===_0xd3004e[_0x425fc6(0xf6)][_0x425fc6(0x182)];}return![];})??[];if(_0x3ee0c1[_0x28ff98(0x111)]>0x0){const _0x5381e7=_0x28ff98(0x14d)+_0xd3004e['yaml'][_0x28ff98(0x182)]+_0x28ff98(0x12e)+_0x28ff98(0x1a1);this[_0x28ff98(0x144)]['warn'](_0x5381e7),_0x3248e5[_0x28ff98(0x11d)](_0x5381e7);}const _0xa0ee8=await agentDefToRequest(_0xd3004e['yaml'],_0xd3004e[_0x28ff98(0x16f)],_0xd3004e[_0x28ff98(0x1c7)],_0x3da4fe),_0x3761fb=await this['client'][_0x28ff98(0x179)](_0xa0ee8);_0x296fb6[_0x28ff98(0x173)](_0xd3004e[_0x28ff98(0xf6)][_0x28ff98(0x182)],_0x3761fb['id']),_0x1309cb['agents'][_0x28ff98(0x11d)]({'agentName':_0xd3004e[_0x28ff98(0xf6)][_0x28ff98(0x182)],'action':'created','agentId':_0x3761fb['id'],'warnings':_0x3248e5[_0x28ff98(0x111)]>0x0?_0x3248e5:undefined}),_0x1309cb[_0x28ff98(0x100)][_0x28ff98(0x127)]['created']++;}catch(_0x3bc3cf){_0x1309cb[_0x28ff98(0x127)][_0x28ff98(0x11d)]({'agentName':_0xd3004e[_0x28ff98(0xf6)][_0x28ff98(0x182)],'action':'error','error':_0x3bc3cf['message'],'warnings':_0x3248e5[_0x28ff98(0x111)]>0x0?_0x3248e5:undefined}),_0x1309cb[_0x28ff98(0x100)]['agents'][_0x28ff98(0x139)]++;}}for(const _0x282e4a of _0x484eac){try{const _0x56b38a=await yamlPromptToApi(_0x282e4a[_0x28ff98(0xf6)],_0x4bfe79,_0x3da4fe);if(!_0x56b38a){_0x1309cb['prompts'][_0x28ff98(0x11d)]({'name':_0x282e4a[_0x28ff98(0xf6)][_0x28ff98(0x182)],'action':'error','error':_0x28ff98(0x171)}),_0x1309cb[_0x28ff98(0x100)][_0x28ff98(0x18e)][_0x28ff98(0x139)]++;continue;}const _0x3ac9e3=await this['client']['createPrompt'](_0x56b38a);_0x4af98d[_0x28ff98(0x173)](_0x282e4a[_0x28ff98(0xf6)]['name'],_0x3ac9e3['id']),_0x1309cb[_0x28ff98(0x18e)][_0x28ff98(0x11d)]({'name':_0x282e4a['yaml'][_0x28ff98(0x182)],'action':_0x28ff98(0xd0),'id':_0x3ac9e3['id']}),_0x1309cb[_0x28ff98(0x100)][_0x28ff98(0x18e)][_0x28ff98(0xd0)]++;}catch(_0x551d07){_0x1309cb['prompts'][_0x28ff98(0x11d)]({'name':_0x282e4a[_0x28ff98(0xf6)][_0x28ff98(0x182)],'action':'error','error':_0x551d07[_0x28ff98(0x1b2)]}),_0x1309cb[_0x28ff98(0x100)][_0x28ff98(0x18e)]['errors']++;}}for(const _0x5901dc of _0x14b93a){try{const _0x5f3505=await yamlIntegrationToApi(_0x5901dc[_0x28ff98(0xf6)],_0x4bfe79,_0x3da4fe),_0x466d5b=await this[_0x28ff98(0xf2)][_0x28ff98(0x123)](_0x5f3505);_0x1309cb['integrations'][_0x28ff98(0x11d)]({'name':_0x5901dc[_0x28ff98(0xf6)]['service_type'],'action':_0x28ff98(0xd0),'id':_0x466d5b['id']}),_0x1309cb[_0x28ff98(0x100)][_0x28ff98(0x1c4)][_0x28ff98(0xd0)]++;}catch(_0x5bdb79){_0x1309cb['integrations']['push']({'name':_0x5901dc[_0x28ff98(0xf6)][_0x28ff98(0xcf)],'action':'error','error':_0x5bdb79[_0x28ff98(0x1b2)]}),_0x1309cb[_0x28ff98(0x100)][_0x28ff98(0x1c4)][_0x28ff98(0x139)]++;}}return _0x1309cb;}}