@treasuredata/tdx 0.26.0 → 0.26.1

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_0x221c40=a96_0x463a;(function(_0x58df4d,_0xc82e9d){const _0x2893a3=a96_0x463a,_0x52cee3=_0x58df4d();while(!![]){try{const _0x5ed69b=-parseInt(_0x2893a3(0x1ea))/0x1+-parseInt(_0x2893a3(0x155))/0x2+parseInt(_0x2893a3(0x1ed))/0x3*(-parseInt(_0x2893a3(0x215))/0x4)+-parseInt(_0x2893a3(0x1cf))/0x5+-parseInt(_0x2893a3(0x1a0))/0x6+-parseInt(_0x2893a3(0x221))/0x7*(parseInt(_0x2893a3(0x199))/0x8)+parseInt(_0x2893a3(0x156))/0x9;if(_0x5ed69b===_0xc82e9d)break;else _0x52cee3['push'](_0x52cee3['shift']());}catch(_0x1b7222){_0x52cee3['push'](_0x52cee3['shift']());}}}(a96_0x3bf9,0xb919c));import{LLMApiClient}from'../client/llm-api-client.js';import*as a96_0x484e47 from'node:fs';import*as a96_0x1684a2 from'node:path';import{HTTPClientError}from'../client/http-client.js';function a96_0x3bf9(){const _0x36e005=['metadata','getOrCreateDefaultProject','template','getAgent','files','deleteProject','version','experimentalArtifacts','.llm','INTERNAL','Invalid\x20agent\x20reference\x20format:\x20','existsSync','includes','minimal','15272DFwSOU','high','toISOString','createKnowledgeBase','chats','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','---\x20schema:\x20','2477898vvMJOA','newProjectId','listExperimentalKnowledgeBases','\x20---\x0a','chatWelcomeMessage','Agent\x20\x27','basename','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','text_content','listIntegrations','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','statSync','add','counts','listWebSearchTools','path','Agent\x20reference\x20not\x20found','file_name','tdx_','isFile','\x27\x20(','tools','low','restoreProject','chatId','attributes','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','):\x20','textKnowledgeBases','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','agent.yml\x20not\x20found\x20in\x20','No\x20tdx.json\x20found\x20in\x20','logger','code','.yml','Only\x20safe\x20types\x20(','warn','parse','project','loadJsonFile','some','chatIgnoreManagedActions','modelType','Renamed\x20integration\x20file:\x20','\x20→\x20','functions','(dry-run)','3584110yShEPV','pushAgent','deleteIntegration','updateAgentResponse','map','resolveProjectName','knowledge_bases','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','Renamed\x20prompt\x20file:\x20','unchanged','variables','1.0','oldPath','agents','unlinkSync','error','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','action','knowledgebases.json','getCurrentProject','getOrCreateDefaultAgent','yaml','tdx.json','INVALID_ARGUMENT','agent.yml','starter_message.md','readFileSync','1148798rrnoxw','Renamed\x20experimental\x20KB\x20directory:\x20','resolveProjectId','1098sIQAHn','#\x20prompt.md\x0a','deleteAgent','pullAgent','startChat','createTextKnowledgeBase','getParentSegmentKnowledgeBase','text','tdDatabaseName','agentId','stringify','jsonSchemaHint','duplicate','experimental_artifacts','readdirSync','AGENT_NOT_FOUND','exportedFrom','listExperimentalArtifacts','createPrompt','updateKnowledgeBase','webSearchTools','writeFileSync','mkdirSync','getChatInfo','projectId','client','Renamed\x20text\x20KB\x20file:\x20','ALREADY_EXISTS','getDefaultAgent','medium','starter_message','set','_reasoning_','tdx_default_','event','PERMISSION_DENIED','history','LLM_PROJECT_NOT_FOUND','chat_parent_segment','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','15548dyWMVm','temperature','availableModelNames','\x22\x20already\x20exists','UNAUTHENTICATED','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','Unsupported\x20backup\x20version:\x20','pullProject','prompts','has','imageGenerators','type','1358zowsHw','dirname','total','updateAgent','claude-4.5-sonnet','dryRun','systemPrompt','code.js','join','createExperimentalArtifact','isDir','listPrompts','integrations','knowledgeBases','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','toLowerCase','chat_agent_console','---\x20file:\x20','push','listKnowledgeBases','length','def','getProject','Unresolved\x20dependencies:\x20','listChats','\x0a---\x20code\x20---\x0a','prompt.md','getDefaultProjectName','new','keys','listAgents','Renamed\x20experimental\x20artifact\x20directory:\x20','listImageGenerators','getUserSettings','experimental_knowledge_bases','status','updateTextKnowledgeBase','updated','promptId','message','agent','service_type','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','clearDefaultAgent','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','getChatLog','Skipping\x20integration\x20\x27','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','localeCompare','llm_project','Available\x20agents:\x20','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','createAgent','chatInfo','pushProject','web_search','cwd','currentProjectId','agents.json','cloneProject','json_schema.json','signal','createIntegration','Removed\x20deleted\x20file:\x20','name','json_schema','resolveAgentId','.md','context','webhookCorsOrigins','serviceType','updateExperimentalArtifact','Removed\x20deleted\x20directory:\x20','rmSync','target','2651372BLNbww','55399041ZOrHxq','outputs','NOT_FOUND','createProject','Project\x20not\x20found:\x20','\x27.\x20This\x20should\x20not\x20happen.','maxToolIterations','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','starterMessage','filter','Multiple\x20projects\x20found\x20with\x20name\x20\x27','updatePrompt','createImageGenerator','errors','get','created','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','continueChat','size','listAgentsFull','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','dir','find','profile','\x0a\x0a#\x20agent.yml\x0a','listTextKnowledgeBases','availableModels','isDirectory','info','backupProject','listProjects','createAgentResponse','Renamed\x20agent\x20folder:\x20','renamed','Renamed\x20folder:\x20','project.json','\x0a---\x20function:\x20','sort','slackMessageMode','site','utf-8','createExperimentalKnowledgeBase','experimentalKnowledgeBases','image_gen','Renamed\x20KB\x20file:\x20','tables','isManaged','getChatHistory','prompts.json','endsWith','reasoningEffort','chat','models'];a96_0x3bf9=function(){return _0x36e005;};return a96_0x3bf9();}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';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=['chat_generic',a96_0x221c40(0x231),a96_0x221c40(0x213)];function a96_0x463a(_0xd72870,_0x4cac8a){_0xd72870=_0xd72870-0x139;const _0x3bf906=a96_0x3bf9();let _0x463a99=_0x3bf906[_0xd72870];return _0x463a99;}export class LLMSDK{[a96_0x221c40(0x143)];[a96_0x221c40(0x206)];[a96_0x221c40(0x14e)];[a96_0x221c40(0x1c0)]=Logger['of']('sdk.llm');constructor(_0x11ca98){const _0x219512=a96_0x221c40;this['client']=new LLMApiClient(_0x11ca98),this[_0x219512(0x14e)]=_0x11ca98;}['getDefaultProjectName'](){const _0x31c25f=a96_0x221c40,_0x27e6c4=getSanitizedUsername();return _0x31c25f(0x20e)+_0x27e6c4;}async['setCurrentProject'](_0x2bbc92){const _0x5d2763=a96_0x221c40,{projectId:_0x23df31}=await this[_0x5d2763(0x1d4)](_0x2bbc92);this[_0x5d2763(0x143)]=_0x23df31;}[a96_0x221c40(0x1e2)](){return this['currentProjectId'];}async['setDefaultAgent'](_0x2c9f8e){const _0x13877f=a96_0x221c40,_0x514b64=this[_0x13877f(0x14e)]['profile'];let _0x1de8b6,_0x46901f;if(_0x2c9f8e['includes']('/')){const _0x3af289=_0x2c9f8e['split']('/');if(_0x3af289[_0x13877f(0x235)]!==0x2)throw new SDKError(ErrorCode[_0x13877f(0x1e6)],_0x13877f(0x195)+_0x2c9f8e,undefined,{'helpText':_0x13877f(0x13d)});const [_0xf9af6f,_0x18b066]=_0x3af289;_0x1de8b6=await this[_0x13877f(0x1ec)](_0xf9af6f),_0x46901f=_0x18b066;}else _0x1de8b6=this[_0x13877f(0x143)]||(await this['getOrCreateDefaultProject']())['id'],_0x46901f=_0x2c9f8e;const _0x645871=await this[_0x13877f(0x14c)](_0x46901f,_0x1de8b6),_0x246e86=await this[_0x13877f(0x206)][_0x13877f(0x18e)](_0x645871);writeCachedLLMAgent(_0x246e86[_0x13877f(0x1b9)][_0x13877f(0x14a)],_0x645871,_0x1de8b6,_0x514b64);}[a96_0x221c40(0x209)](){const _0x3149d3=a96_0x221c40,_0x54c11a=this[_0x3149d3(0x14e)][_0x3149d3(0x16d)];return readCachedLLMAgent(_0x54c11a)||undefined;}[a96_0x221c40(0x24c)](){const _0x4d6818=a96_0x221c40,_0x993f56=this[_0x4d6818(0x14e)][_0x4d6818(0x16d)];clearCachedLLMAgent(_0x993f56);}async[a96_0x221c40(0x18a)](){const _0x2924fd=a96_0x221c40,_0xf8b351=await this['client'][_0x2924fd(0x242)](),_0x4befb7=[];for(const _0x4bd696 of _0xf8b351[_0x2924fd(0x217)]){const _0x2047e6=_0xf8b351[_0x2924fd(0x170)][_0x4bd696];_0x2047e6&&_0x4befb7['push']({'name':_0x4bd696,'displayName':_0x2047e6['displayName']});}return _0x4befb7;}async[a96_0x221c40(0x159)](_0x304c81){const _0x2de7bf=a96_0x221c40;return await this[_0x2de7bf(0x206)][_0x2de7bf(0x159)](_0x304c81);}async[a96_0x221c40(0x190)](_0xfe9a28){const _0x483cdd=a96_0x221c40,{projectId:_0x5c2a1f}=await this[_0x483cdd(0x1d4)](_0xfe9a28);await this[_0x483cdd(0x206)][_0x483cdd(0x190)](_0x5c2a1f);}async['projects'](_0x2e4b27=0x32){const _0x323377=a96_0x221c40;return await this[_0x323377(0x206)]['listProjects'](_0x2e4b27);}async[a96_0x221c40(0x18c)](_0x43cebe){const _0x34191f=a96_0x221c40,_0x58aa76=_0x43cebe||this['getDefaultProjectName'](),_0x4b2aa7=this[_0x34191f(0x14e)][_0x34191f(0x16d)];if(!_0x43cebe){const _0x28c3fd=readCachedLLMProject(_0x4b2aa7);if(_0x28c3fd&&_0x28c3fd[_0x34191f(0x14a)]===_0x58aa76)try{const _0x57cfb6=await this['client'][_0x34191f(0x237)](_0x28c3fd['id']);if(_0x57cfb6[_0x34191f(0x1b9)]['name']===_0x58aa76)return _0x57cfb6;}catch{}}const _0xfa5553=await this['client'][_0x34191f(0x174)](),_0x41942a=_0xfa5553[_0x34191f(0x16c)](_0x42ea4a=>_0x42ea4a[_0x34191f(0x1b9)][_0x34191f(0x14a)]===_0x58aa76);if(_0x41942a)return!_0x43cebe&&writeCachedLLMProject(_0x58aa76,_0x41942a['id'],_0x4b2aa7),_0x41942a;const _0x18cec2=await this[_0x34191f(0x206)][_0x34191f(0x159)]({'name':_0x58aa76,'description':_0x34191f(0x24b)+getSanitizedUsername()+')'});return!_0x43cebe&&writeCachedLLMProject(_0x58aa76,_0x18cec2['id'],_0x4b2aa7),_0x18cec2;}async['resolveProjectId'](_0x324d96){const _0x3aa6d1=a96_0x221c40,_0x1c2514=await this[_0x3aa6d1(0x206)][_0x3aa6d1(0x174)](),_0x1b7224=_0x1c2514[_0x3aa6d1(0x15f)](_0x533604=>_0x533604[_0x3aa6d1(0x1b9)]['name']===_0x324d96);if(_0x1b7224['length']===0x0)throw new SDKError(ErrorCode[_0x3aa6d1(0x212)],'Project\x20not\x20found:\x20'+_0x324d96,undefined,{'helpText':_0x3aa6d1(0x1d6)});if(_0x1b7224['length']>0x1)throw new SDKError(ErrorCode[_0x3aa6d1(0x194)],_0x3aa6d1(0x160)+_0x324d96+_0x3aa6d1(0x15b));return _0x1b7224[0x0]['id'];}async[a96_0x221c40(0x1d4)](_0x29af4c){const _0x5a5a2a=a96_0x221c40,_0x3b9575=await this[_0x5a5a2a(0x206)]['listProjects'](),_0x2cf09c=_0x3b9575['find'](_0x40deec=>_0x40deec[_0x5a5a2a(0x1b9)][_0x5a5a2a(0x14a)]===_0x29af4c);if(_0x2cf09c)return{'projectId':_0x2cf09c['id'],'project':_0x2cf09c};throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x5a5a2a(0x15a)+_0x29af4c,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async[a96_0x221c40(0x1e3)](_0x3549ab=a96_0x221c40(0x225),_0x1f60fa=0x0,_0x12f28c){const _0x53607f=a96_0x221c40,_0x3ed839=0xa;let _0x1f403c=0x0,_0x29a0bc;while(_0x1f403c<_0x3ed839){try{const _0x2a56ec=await this[_0x53607f(0x18c)](_0x29a0bc),_0x38541f=_0x2a56ec['id'],_0x3a2947=['none',_0x53607f(0x198),_0x53607f(0x1b6),_0x53607f(0x20a),_0x53607f(0x19a)],_0xaf9e69=_0x1f60fa===0x0?_0x53607f(0x1b2)+_0x3549ab:_0x53607f(0x1b2)+_0x3549ab+_0x53607f(0x20d)+_0x3a2947[_0x1f60fa],_0x9b1cf1=await this[_0x53607f(0x206)][_0x53607f(0x23f)](_0x38541f),_0x17d6fb=_0x9b1cf1[_0x53607f(0x16c)](_0x2cae64=>_0x2cae64[_0x53607f(0x1b9)][_0x53607f(0x14a)]===_0xaf9e69);if(_0x17d6fb)return _0x17d6fb;const _0x14b322=_0x1f60fa>0x0?0x1:_0x12f28c;return await this[_0x53607f(0x206)][_0x53607f(0x13e)]({'name':_0xaf9e69,'projectId':_0x38541f,'modelType':_0x3549ab,'systemPrompt':'','temperature':_0x14b322,'reasoningEffort':_0x1f60fa>0x0?_0x1f60fa:undefined});}catch(_0x48b84c){if(_0x48b84c instanceof HTTPClientError){const _0x3ad756=_0x48b84c[_0x53607f(0x244)];if(_0x3ad756>=0x190&&_0x3ad756<0x1f4){if(_0x3ad756===0x191)throw new SDKError(ErrorCode[_0x53607f(0x219)],_0x53607f(0x15d),_0x48b84c);else{if(_0x3ad756===0x193)throw new SDKError(ErrorCode[_0x53607f(0x210)],_0x53607f(0x24d),_0x48b84c);}throw _0x48b84c;}}if(errorContains(_0x48b84c,'already\x20exists',_0x53607f(0x1f9),'conflict')){_0x1f403c++;if(_0x1f403c>=_0x3ed839)throw new SDKError(ErrorCode[_0x53607f(0x208)],'Unable\x20to\x20create\x20project\x20after\x20'+_0x3ed839+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x48b84c);const _0x563745=this[_0x53607f(0x23c)]();_0x29a0bc=_0x563745+'_'+generateRandomHex();continue;}throw _0x48b84c;}}throw new SDKError(ErrorCode[_0x53607f(0x194)],'Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts');}async[a96_0x221c40(0x14c)](_0x103bb1,_0x1942eb){const _0x56daa5=a96_0x221c40,_0x259553=_0x1942eb||this[_0x56daa5(0x143)],_0xa1eb2=await this['client']['listAgents'](_0x259553),_0x2a3852=_0xa1eb2['filter'](_0x128d8d=>_0x128d8d[_0x56daa5(0x1b9)]['name']===_0x103bb1);if(_0x2a3852[_0x56daa5(0x235)]===0x0){const _0x4d1739=_0x259553?'\x20in\x20project\x20'+_0x259553:'';throw new SDKError(ErrorCode[_0x56daa5(0x1fc)],'Agent\x20not\x20found:\x20'+_0x103bb1+_0x4d1739,undefined,{'helpText':_0x259553?_0x56daa5(0x1aa):'Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.'});}if(_0x2a3852[_0x56daa5(0x235)]>0x1)throw new SDKError(ErrorCode[_0x56daa5(0x194)],'Multiple\x20agents\x20found\x20with\x20name\x20\x27'+_0x103bb1+_0x56daa5(0x15b));return _0x2a3852[0x0]['id'];}async['agents'](_0x29a68e){const _0x4778d7=a96_0x221c40,_0x42ebaf=_0x29a68e||this[_0x4778d7(0x143)];return await this[_0x4778d7(0x206)][_0x4778d7(0x23f)](_0x42ebaf);}async['agentsFull'](_0x57441b){const _0x1bf07f=a96_0x221c40;return await this['client'][_0x1bf07f(0x169)](_0x57441b);}async[a96_0x221c40(0x249)](_0x768965){const _0x142426=a96_0x221c40;return await this['client'][_0x142426(0x18e)](_0x768965);}async[a96_0x221c40(0x13e)](_0x115c60){const _0x5cd7c9=a96_0x221c40;return await this[_0x5cd7c9(0x206)][_0x5cd7c9(0x13e)](_0x115c60);}async[a96_0x221c40(0x224)](_0x3b25eb,_0x25079c){const _0x142eb3=a96_0x221c40;return await this[_0x142eb3(0x206)][_0x142eb3(0x224)](_0x3b25eb,_0x25079c);}async[a96_0x221c40(0x1ef)](_0x5b3b57){await this['client']['deleteAgent'](_0x5b3b57);}async[a96_0x221c40(0x1f1)](_0x320b3a){const _0x13bc49=a96_0x221c40;return await this[_0x13bc49(0x206)][_0x13bc49(0x1f1)]({'agentId':_0x320b3a});}async*[a96_0x221c40(0x189)](_0x4f2066,_0x5dd3ec){const _0x1ca865=a96_0x221c40;let _0x5c3324=_0x5dd3ec?.[_0x1ca865(0x1b8)];const _0x3f5c27=_0x5dd3ec?.[_0x1ca865(0x1f6)];if(!_0x5c3324){if(!_0x3f5c27)throw new Error(_0x1ca865(0x214));const _0x2fc92e=await this['client'][_0x1ca865(0x1f1)]({'agentId':_0x3f5c27});_0x5c3324=_0x2fc92e['id'],yield{'type':_0x1ca865(0x18b),'data':{'chatId':_0x5c3324,'agentId':_0x3f5c27,'projectId':_0x2fc92e[_0x1ca865(0x1b9)][_0x1ca865(0x205)]}};}for await(const _0x1a74a9 of this['client'][_0x1ca865(0x167)](_0x5c3324,_0x4f2066,_0x5dd3ec?.[_0x1ca865(0x147)])){yield{'type':_0x1ca865(0x20f),'data':_0x1a74a9};}}async[a96_0x221c40(0x19d)](_0x1754aa=0x32){const _0x409c59=a96_0x221c40;return await this[_0x409c59(0x206)][_0x409c59(0x239)](_0x1754aa);}async[a96_0x221c40(0x211)](_0x5b7fe4){const _0x40b553=a96_0x221c40;return await this[_0x40b553(0x206)][_0x40b553(0x185)](_0x5b7fe4);}async[a96_0x221c40(0x24e)](_0x324490){const _0x5b1702=a96_0x221c40;return await this[_0x5b1702(0x206)][_0x5b1702(0x24e)](_0x324490);}async[a96_0x221c40(0x13f)](_0x1589ac){const _0x242f04=a96_0x221c40;return await this[_0x242f04(0x206)][_0x242f04(0x204)](_0x1589ac);}async[a96_0x221c40(0x173)](_0x5f406c,_0x1274d0,_0x558463){const _0x38c162=a96_0x221c40,_0x445edf=_0x558463?.[_0x38c162(0x226)]??![],{projectId:_0x290e65,project:_0xd03c3f}=await this[_0x38c162(0x1d4)](_0x5f406c),_0x1f842e=_0xd03c3f[_0x38c162(0x1b9)][_0x38c162(0x14a)],_0x151394=_0x1274d0||_0x1f842e+_0x38c162(0x193);if(a96_0x484e47[_0x38c162(0x196)](_0x151394)&&!_0x445edf)throw new SDKError(ErrorCode['ALREADY_EXISTS'],'Output\x20directory\x20already\x20exists:\x20'+_0x151394,undefined,{'helpText':_0x38c162(0x16a)});const _0x37775c=await this[_0x38c162(0x206)]['listAgentsFull'](_0x290e65),_0x2f66f8=await this[_0x38c162(0x206)][_0x38c162(0x234)](_0x290e65),_0x4548e2=await this[_0x38c162(0x206)][_0x38c162(0x22c)](_0x290e65),_0x198ead=await this['client'][_0x38c162(0x1a9)](_0x290e65);if(!_0x445edf){a96_0x484e47['mkdirSync'](_0x151394,{'recursive':!![]});const _0x41d9f5={'version':_0x38c162(0x1da),'exportedAt':new Date()[_0x38c162(0x19b)](),'exportedFrom':{'site':this[_0x38c162(0x14e)]['site'],'projectId':_0x290e65,'projectName':_0x1f842e},'project':_0xd03c3f};a96_0x484e47['writeFileSync'](a96_0x1684a2[_0x38c162(0x229)](_0x151394,_0x38c162(0x179)),JSON[_0x38c162(0x1f7)](_0x41d9f5,null,0x2)),a96_0x484e47[_0x38c162(0x202)](a96_0x1684a2['join'](_0x151394,_0x38c162(0x144)),JSON[_0x38c162(0x1f7)](_0x37775c,null,0x2)),a96_0x484e47['writeFileSync'](a96_0x1684a2[_0x38c162(0x229)](_0x151394,_0x38c162(0x1e1)),JSON[_0x38c162(0x1f7)](_0x2f66f8,null,0x2)),a96_0x484e47[_0x38c162(0x202)](a96_0x1684a2['join'](_0x151394,'prompts.json'),JSON['stringify'](_0x4548e2,null,0x2)),a96_0x484e47[_0x38c162(0x202)](a96_0x1684a2[_0x38c162(0x229)](_0x151394,'integrations.json'),JSON[_0x38c162(0x1f7)](_0x198ead,null,0x2));}return{'projectName':_0x1f842e,'outputDir':_0x151394,'counts':{'agents':_0x37775c['length'],'knowledgeBases':_0x2f66f8[_0x38c162(0x235)],'prompts':_0x4548e2[_0x38c162(0x235)],'integrations':_0x198ead[_0x38c162(0x235)]}};}async[a96_0x221c40(0x1b7)](_0x358584,_0x4abb3e){const _0x1cb9a0=a96_0x221c40,_0x37e022=_0x4abb3e?.[_0x1cb9a0(0x226)]??![],_0x478f05=this['getBackupMetadata'](_0x358584),_0x6c8211=_0x478f05[_0x1cb9a0(0x1fd)][_0x1cb9a0(0x17d)],_0x2a13e1=this['context']['site'],_0x333dfe=_0x6c8211!==_0x2a13e1?_0x6c8211:undefined,_0x1e7353=this[_0x1cb9a0(0x1c7)](a96_0x1684a2[_0x1cb9a0(0x229)](_0x358584,'agents.json'),[]),_0x577f32=this[_0x1cb9a0(0x1c7)](a96_0x1684a2['join'](_0x358584,'knowledgebases.json'),[]),_0x55f377=this[_0x1cb9a0(0x1c7)](a96_0x1684a2[_0x1cb9a0(0x229)](_0x358584,_0x1cb9a0(0x186)),[]),_0x4d00e2=this[_0x1cb9a0(0x1c7)](a96_0x1684a2[_0x1cb9a0(0x229)](_0x358584,'integrations.json'),[]),_0x1a76e1=_0x4abb3e?.[_0x1cb9a0(0x14a)]||_0x478f05[_0x1cb9a0(0x1fd)]['projectName'];if(_0x37e022){const _0x2043b5=new Map(),_0x137f7a=[..._0x1e7353],_0x240451=_0x1e7353['length']+0x1;let _0x575c5a=0x0;while(_0x137f7a[_0x1cb9a0(0x235)]>0x0&&_0x575c5a<_0x240451){_0x575c5a++;const _0x93c66c=[];for(const _0x329b54 of _0x137f7a){canCreateAgent(_0x329b54,_0x2043b5)?_0x2043b5[_0x1cb9a0(0x20c)](_0x329b54['id'],'dry-run-'+_0x329b54['id']):_0x93c66c[_0x1cb9a0(0x233)](_0x329b54);}if(_0x93c66c[_0x1cb9a0(0x235)]===_0x137f7a[_0x1cb9a0(0x235)])throw new SDKError(ErrorCode[_0x1cb9a0(0x194)],_0x1cb9a0(0x1ba),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x137f7a[_0x1cb9a0(0x235)]=0x0,_0x137f7a['push'](..._0x93c66c);}const _0x195e9a=_0x55f377['filter'](_0x4f42e1=>_0x2043b5[_0x1cb9a0(0x21e)](_0x4f42e1[_0x1cb9a0(0x1b9)][_0x1cb9a0(0x1f6)]))[_0x1cb9a0(0x235)];return{'projectName':_0x1a76e1,'projectId':_0x1cb9a0(0x1ce),'counts':{'agents':_0x1e7353['length'],'knowledgeBases':_0x577f32[_0x1cb9a0(0x235)],'prompts':_0x195e9a,'integrations':_0x4d00e2[_0x1cb9a0(0x235)]},'sourceSite':_0x333dfe};}const _0x25fbd8=await this[_0x1cb9a0(0x206)][_0x1cb9a0(0x159)]({'name':_0x1a76e1,'description':_0x478f05[_0x1cb9a0(0x1c6)][_0x1cb9a0(0x1b9)]['description']}),_0x145f86=_0x25fbd8['id'],_0x68cddc=new Map(),_0x4c9dd5=new Map(),_0x58e9db=new Map();for(const _0x3ddacd of _0x577f32){const _0x273669=await this[_0x1cb9a0(0x206)]['createKnowledgeBase']({'projectId':_0x145f86,'name':_0x3ddacd[_0x1cb9a0(0x1b9)][_0x1cb9a0(0x14a)],'tdDatabaseName':_0x3ddacd['attributes'][_0x1cb9a0(0x1f5)],'tables':_0x3ddacd[_0x1cb9a0(0x1b9)][_0x1cb9a0(0x183)]});_0x68cddc[_0x1cb9a0(0x20c)](_0x3ddacd['id'],_0x273669['id']);}const _0x598a84=[..._0x1e7353],_0x5b86af=_0x1e7353[_0x1cb9a0(0x235)]+0x1;let _0xd2c1a=0x0;while(_0x598a84[_0x1cb9a0(0x235)]>0x0&&_0xd2c1a<_0x5b86af){_0xd2c1a++;const _0xe15450=[];for(const _0x5dfddf of _0x598a84){if(canCreateAgent(_0x5dfddf,_0x4c9dd5)){const _0x2d3950=remapToolIds(_0x5dfddf[_0x1cb9a0(0x1b9)]['tools'],_0x68cddc,_0x4c9dd5),_0x1f77f2=remapVariableIds(_0x5dfddf[_0x1cb9a0(0x1b9)][_0x1cb9a0(0x1d9)],_0x68cddc),_0x1b49ab=await this[_0x1cb9a0(0x206)]['createAgentResponse']({'name':_0x5dfddf['attributes'][_0x1cb9a0(0x14a)],'projectId':_0x145f86,'systemPrompt':_0x5dfddf[_0x1cb9a0(0x1b9)][_0x1cb9a0(0x227)],'starterMessage':_0x5dfddf[_0x1cb9a0(0x1b9)]['starterMessage'],'modelType':migrateModelType(_0x5dfddf[_0x1cb9a0(0x1b9)][_0x1cb9a0(0x1ca)]),'maxToolIterations':_0x5dfddf['attributes'][_0x1cb9a0(0x15c)],'temperature':_0x5dfddf['attributes'][_0x1cb9a0(0x216)],'reasoningEffort':_0x5dfddf['attributes'][_0x1cb9a0(0x188)],'outputs':_0x5dfddf[_0x1cb9a0(0x1b9)][_0x1cb9a0(0x157)],'tools':_0x2d3950,'variables':_0x1f77f2});_0x4c9dd5['set'](_0x5dfddf['id'],_0x1b49ab['id']);}else _0xe15450[_0x1cb9a0(0x233)](_0x5dfddf);}if(_0xe15450['length']===_0x598a84[_0x1cb9a0(0x235)])throw new SDKError(ErrorCode['INTERNAL'],_0x1cb9a0(0x1ba),undefined,{'helpText':_0x1cb9a0(0x139)});_0x598a84[_0x1cb9a0(0x235)]=0x0,_0x598a84[_0x1cb9a0(0x233)](..._0xe15450);}for(const _0x20a6de of _0x55f377){const _0x482699=_0x4c9dd5[_0x1cb9a0(0x164)](_0x20a6de[_0x1cb9a0(0x1b9)][_0x1cb9a0(0x1f6)]);if(!_0x482699)continue;const _0x42d244=await this[_0x1cb9a0(0x206)][_0x1cb9a0(0x1ff)]({'projectId':_0x145f86,'agentId':_0x482699,'name':_0x20a6de[_0x1cb9a0(0x1b9)][_0x1cb9a0(0x14a)],'systemPrompt':_0x20a6de['attributes'][_0x1cb9a0(0x227)],'template':_0x20a6de[_0x1cb9a0(0x1b9)][_0x1cb9a0(0x18d)],'jsonSchemaHint':_0x20a6de[_0x1cb9a0(0x1b9)][_0x1cb9a0(0x1f8)]});_0x58e9db[_0x1cb9a0(0x20c)](_0x20a6de['id'],_0x42d244['id']);}for(const _0x5195bd of _0x4d00e2){const _0x9be5f9=_0x5195bd['attributes']['actions'][_0x1cb9a0(0x1d3)](_0x510bc7=>({..._0x510bc7,'promptId':_0x58e9db[_0x1cb9a0(0x164)](_0x510bc7[_0x1cb9a0(0x247)])||_0x510bc7[_0x1cb9a0(0x247)]}));await this[_0x1cb9a0(0x206)][_0x1cb9a0(0x148)]({'projectId':_0x145f86,'serviceType':_0x5195bd[_0x1cb9a0(0x1b9)][_0x1cb9a0(0x150)],'actions':_0x9be5f9,'slackMessageMode':_0x5195bd['attributes'][_0x1cb9a0(0x17c)],'chatIgnoreManagedActions':_0x5195bd[_0x1cb9a0(0x1b9)][_0x1cb9a0(0x1c9)],'chatWelcomeMessage':_0x5195bd['attributes'][_0x1cb9a0(0x1a4)],'webhookCorsOrigins':_0x5195bd[_0x1cb9a0(0x1b9)][_0x1cb9a0(0x14f)]});}return{'projectName':_0x1a76e1,'projectId':_0x145f86,'counts':{'agents':_0x4c9dd5[_0x1cb9a0(0x168)],'knowledgeBases':_0x68cddc['size'],'prompts':_0x58e9db[_0x1cb9a0(0x168)],'integrations':_0x4d00e2[_0x1cb9a0(0x235)]},'sourceSite':_0x333dfe};}[a96_0x221c40(0x1c7)](_0x825c41,_0x4dee31){const _0x55e9c6=a96_0x221c40;if(!a96_0x484e47[_0x55e9c6(0x196)](_0x825c41))return _0x4dee31;return JSON[_0x55e9c6(0x1c5)](a96_0x484e47[_0x55e9c6(0x1e9)](_0x825c41,_0x55e9c6(0x17e)));}['getBackupMetadata'](_0x14f225){const _0xe316d7=a96_0x221c40;if(!a96_0x484e47[_0xe316d7(0x196)](_0x14f225))throw new SDKError(ErrorCode[_0xe316d7(0x158)],'Backup\x20folder\x20not\x20found:\x20'+_0x14f225,undefined,{'helpText':_0xe316d7(0x19e)});const _0x264804=a96_0x1684a2[_0xe316d7(0x229)](_0x14f225,_0xe316d7(0x179));if(!a96_0x484e47[_0xe316d7(0x196)](_0x264804))throw new SDKError(ErrorCode[_0xe316d7(0x1e6)],'Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20'+_0x14f225,undefined,{'helpText':_0xe316d7(0x166)});const _0x40a189=JSON[_0xe316d7(0x1c5)](a96_0x484e47['readFileSync'](_0x264804,_0xe316d7(0x17e)));if(!isSupportedBackupVersion(_0x40a189['version']))throw new SDKError(ErrorCode[_0xe316d7(0x1e6)],_0xe316d7(0x21b)+_0x40a189[_0xe316d7(0x191)],undefined,{'helpText':_0xe316d7(0x1df)});return _0x40a189;}async[a96_0x221c40(0x21c)](_0x183ca9,_0x22ecb4,_0x3978a7){const _0x3ebfbd=a96_0x221c40,{projectId:_0x22e956,project:_0x206cfe}=await this['resolveProjectName'](_0x183ca9),_0x12dbdc=_0x206cfe[_0x3ebfbd(0x1b9)]['name'];let _0x300008;if(_0x22ecb4)_0x300008=_0x22ecb4;else{const _0x45317e=a96_0x1684a2[_0x3ebfbd(0x229)](process[_0x3ebfbd(0x142)](),'agents'),_0x1fd3c3=getSanitizedPathWithMigration(_0x45317e,_0x12dbdc);_0x1fd3c3['renamed']&&this[_0x3ebfbd(0x1c0)][_0x3ebfbd(0x172)](_0x3ebfbd(0x178)+a96_0x1684a2['basename'](_0x1fd3c3[_0x3ebfbd(0x1db)])+'\x20→\x20'+a96_0x1684a2[_0x3ebfbd(0x1a6)](_0x1fd3c3[_0x3ebfbd(0x1af)])),_0x300008=_0x1fd3c3[_0x3ebfbd(0x1af)];}const _0x33a41d=await this['client'][_0x3ebfbd(0x169)](_0x22e956),_0x415326=await this[_0x3ebfbd(0x206)]['listKnowledgeBases'](_0x22e956),_0x32e4e8=await this['client']['listTextKnowledgeBases'](_0x22e956),_0x43110d=await this['client'][_0x3ebfbd(0x241)](_0x22e956),_0x1f9c52=await this[_0x3ebfbd(0x206)][_0x3ebfbd(0x1ae)](_0x22e956),_0x27dbb3=await this['client'][_0x3ebfbd(0x22c)](_0x22e956),_0x22a584=await this[_0x3ebfbd(0x206)]['listIntegrations'](_0x22e956),_0x5bfd8d=await this['client'][_0x3ebfbd(0x1a2)](_0x22e956),_0x19ebf2=await this['client'][_0x3ebfbd(0x1fe)](_0x22e956),_0xabcb56=_0x22a584['filter'](_0x3cf22e=>!_0x3cf22e[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x184)]&&SAFE_INTEGRATION_TYPES[_0x3ebfbd(0x197)](_0x3cf22e['attributes']['serviceType'][_0x3ebfbd(0x230)]())),_0x58cf36=new Map(),_0x7e3fab=new Map(),_0x121338=new Map(),_0xed4a17=new Map(),_0x1eaa28=new Map(),_0x424bab=new Map(),_0x2a8cbb=new Map();for(const _0x4b5bc3 of _0x33a41d){_0x58cf36['set'](_0x4b5bc3['id'],_0x4b5bc3[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x14a)]);}for(const _0x3d8773 of _0x415326){_0x7e3fab['set'](_0x3d8773['id'],_0x3d8773[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x14a)]);}for(const _0x192611 of _0x32e4e8){_0x121338[_0x3ebfbd(0x20c)](_0x192611['id'],_0x192611[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x14a)]);}for(const _0x58c390 of _0x43110d){_0xed4a17[_0x3ebfbd(0x20c)](_0x58c390['id'],_0x58c390[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x14a)]);}for(const _0x479d40 of _0x1f9c52){_0x1eaa28[_0x3ebfbd(0x20c)](_0x479d40['id'],_0x479d40[_0x3ebfbd(0x1b9)]['name']);}for(const _0x46e43a of _0x27dbb3){_0x424bab[_0x3ebfbd(0x20c)](_0x46e43a['id'],_0x46e43a[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x14a)]);}for(const _0x477aa8 of _0x5bfd8d){_0x2a8cbb[_0x3ebfbd(0x20c)](_0x477aa8['id'],_0x477aa8['attributes'][_0x3ebfbd(0x14a)]);}const _0xf82df3={'resolveKnowledgeBaseName':async _0x204526=>_0x7e3fab['get'](_0x204526),'resolveTextKnowledgeBaseName':async _0x1602a2=>_0x121338[_0x3ebfbd(0x164)](_0x1602a2),'resolveAgentName':async _0x3fc52f=>_0x58cf36['get'](_0x3fc52f),'resolveWebSearchToolName':async _0x2705d9=>_0x1eaa28[_0x3ebfbd(0x164)](_0x2705d9),'resolveImageGeneratorName':async _0x3b0f84=>_0xed4a17[_0x3ebfbd(0x164)](_0x3b0f84),'resolvePromptName':async _0x3cb68a=>_0x424bab['get'](_0x3cb68a),'resolveExperimentalKnowledgeBaseName':async _0x3ef5a5=>_0x2a8cbb[_0x3ebfbd(0x164)](_0x3ef5a5),'onWarning':_0x564cce=>this[_0x3ebfbd(0x1c0)][_0x3ebfbd(0x1c4)](_0x564cce)},_0x4c416b={'projectName':_0x12dbdc,'outputDir':_0x300008,'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}}},_0x307cf6=[],_0x4acb7c=[];for(const _0x17ff07 of _0x33a41d){const _0x4c8e7f=getSanitizedPathWithMigration(_0x300008,_0x17ff07[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x14a)]);_0x4c8e7f[_0x3ebfbd(0x177)]&&this['logger']['info'](_0x3ebfbd(0x176)+a96_0x1684a2[_0x3ebfbd(0x1a6)](_0x4c8e7f[_0x3ebfbd(0x1db)])+_0x3ebfbd(0x1cc)+a96_0x1684a2[_0x3ebfbd(0x1a6)](_0x4c8e7f['path']));const _0x39302c=_0x4c8e7f[_0x3ebfbd(0x1af)],_0x3ae04b=a96_0x1684a2['join'](_0x39302c,_0x3ebfbd(0x23b)),_0x29d266=a96_0x1684a2['join'](_0x39302c,'agent.yml'),_0x583033=a96_0x1684a2[_0x3ebfbd(0x229)](_0x39302c,_0x3ebfbd(0x1e8)),{yaml:_0xf2446c,systemPrompt:_0x8a7130,starterMessage:_0x27540a}=await agentResponseToDef(_0x17ff07,_0xf82df3),_0x4b9626=toAgentYamlString(_0xf2446c),_0x120de3=!a96_0x484e47[_0x3ebfbd(0x196)](_0x29d266);let _0x267422=_0x120de3,_0x48ceb2;if(!_0x120de3){const _0x164b5a=a96_0x484e47['existsSync'](_0x3ae04b)?a96_0x484e47[_0x3ebfbd(0x1e9)](_0x3ae04b,_0x3ebfbd(0x17e)):'',_0x24ec64=a96_0x484e47[_0x3ebfbd(0x1e9)](_0x29d266,'utf-8'),_0x512749='#\x20prompt.md\x0a'+_0x164b5a+_0x3ebfbd(0x16e)+_0x24ec64,_0x122b79=_0x3ebfbd(0x1ee)+_0x8a7130+_0x3ebfbd(0x16e)+_0x4b9626,_0x131c1d=generateDiff(_0x512749,_0x122b79);_0x267422=hasChanges(_0x131c1d),_0x267422&&(_0x48ceb2=formatDiffWithColors(_0x131c1d));}_0x307cf6[_0x3ebfbd(0x233)]({'path':_0x39302c,'content':'','isDir':!![]}),_0x307cf6[_0x3ebfbd(0x233)]({'path':_0x3ae04b,'content':_0x8a7130}),_0x307cf6[_0x3ebfbd(0x233)]({'path':_0x29d266,'content':_0x4b9626});_0x27540a&&_0x27540a['includes']('\x0a')&&_0x307cf6[_0x3ebfbd(0x233)]({'path':_0x583033,'content':_0x27540a});_0x4c416b['agents'][_0x3ebfbd(0x233)]({'agentName':_0x17ff07[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x14a)],'outputPath':_0x39302c,'isNew':_0x120de3,'hasChanges':_0x267422,'diff':_0x48ceb2}),_0x4c416b[_0x3ebfbd(0x1ad)][_0x3ebfbd(0x1dc)]['total']++;if(_0x120de3)_0x4c416b[_0x3ebfbd(0x1ad)][_0x3ebfbd(0x1dc)]['new']++;else{if(_0x267422)_0x4c416b[_0x3ebfbd(0x1ad)][_0x3ebfbd(0x1dc)][_0x3ebfbd(0x246)]++;else _0x4c416b['counts'][_0x3ebfbd(0x1dc)][_0x3ebfbd(0x1d8)]++;}}for(const _0x2a3917 of _0x415326){if(_0x2a3917[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x184)])continue;const _0x105766=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x300008),_0x2a3917[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x14a)],_0x3ebfbd(0x1c2));_0x105766[_0x3ebfbd(0x177)]&&this[_0x3ebfbd(0x1c0)]['info'](_0x3ebfbd(0x182)+a96_0x1684a2[_0x3ebfbd(0x1a6)](_0x105766['oldPath'])+_0x3ebfbd(0x1cc)+a96_0x1684a2['basename'](_0x105766[_0x3ebfbd(0x1af)]));const _0x39048d=_0x105766[_0x3ebfbd(0x1af)],_0x553a92=apiKnowledgeBaseToYaml(_0x2a3917),_0x3f7b12=toKnowledgeBaseYamlString(_0x553a92),_0x2e5648=!a96_0x484e47[_0x3ebfbd(0x196)](_0x39048d);let _0xf98e62=_0x2e5648,_0x381519;if(!_0x2e5648){const _0x2e99f3=a96_0x484e47[_0x3ebfbd(0x1e9)](_0x39048d,_0x3ebfbd(0x17e)),_0x156800=generateDiff(_0x2e99f3,_0x3f7b12);_0xf98e62=hasChanges(_0x156800),_0xf98e62&&(_0x381519=formatDiffWithColors(_0x156800));}_0x307cf6[_0x3ebfbd(0x233)]({'path':_0x39048d,'content':_0x3f7b12}),_0x4c416b[_0x3ebfbd(0x22e)][_0x3ebfbd(0x233)]({'name':_0x2a3917[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x14a)],'outputPath':_0x39048d,'isNew':_0x2e5648,'hasChanges':_0xf98e62,'diff':_0x381519}),_0x4c416b[_0x3ebfbd(0x1ad)][_0x3ebfbd(0x22e)][_0x3ebfbd(0x223)]++;if(_0x2e5648)_0x4c416b[_0x3ebfbd(0x1ad)][_0x3ebfbd(0x22e)][_0x3ebfbd(0x23d)]++;else{if(_0xf98e62)_0x4c416b[_0x3ebfbd(0x1ad)]['knowledgeBases'][_0x3ebfbd(0x246)]++;else _0x4c416b[_0x3ebfbd(0x1ad)][_0x3ebfbd(0x22e)][_0x3ebfbd(0x1d8)]++;}}for(const _0x153372 of _0x32e4e8){if(_0x153372[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x184)])continue;const _0x3d4fc9=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x300008),_0x153372['attributes'][_0x3ebfbd(0x14a)],_0x3ebfbd(0x14d));_0x3d4fc9['renamed']&&this[_0x3ebfbd(0x1c0)]['info'](_0x3ebfbd(0x207)+a96_0x1684a2[_0x3ebfbd(0x1a6)](_0x3d4fc9[_0x3ebfbd(0x1db)])+_0x3ebfbd(0x1cc)+a96_0x1684a2['basename'](_0x3d4fc9[_0x3ebfbd(0x1af)]));const _0x290ca9=_0x3d4fc9[_0x3ebfbd(0x1af)],_0x4ce8ec=toTextKnowledgeBaseMd(_0x153372[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x14a)],_0x153372['attributes'][_0x3ebfbd(0x1f4)]),_0x13d675=!a96_0x484e47[_0x3ebfbd(0x196)](_0x290ca9);let _0x400426=_0x13d675,_0x542599;if(!_0x13d675){const _0x3f9e4e=a96_0x484e47['readFileSync'](_0x290ca9,'utf-8'),_0x29458a=generateDiff(_0x3f9e4e,_0x4ce8ec);_0x400426=hasChanges(_0x29458a),_0x400426&&(_0x542599=formatDiffWithColors(_0x29458a));}_0x307cf6[_0x3ebfbd(0x233)]({'path':_0x290ca9,'content':_0x4ce8ec}),_0x4c416b[_0x3ebfbd(0x1bc)][_0x3ebfbd(0x233)]({'name':_0x153372[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x14a)],'outputPath':_0x290ca9,'isNew':_0x13d675,'hasChanges':_0x400426,'diff':_0x542599}),_0x4c416b[_0x3ebfbd(0x1ad)][_0x3ebfbd(0x1bc)][_0x3ebfbd(0x223)]++;if(_0x13d675)_0x4c416b[_0x3ebfbd(0x1ad)][_0x3ebfbd(0x1bc)][_0x3ebfbd(0x23d)]++;else{if(_0x400426)_0x4c416b[_0x3ebfbd(0x1ad)]['textKnowledgeBases'][_0x3ebfbd(0x246)]++;else _0x4c416b[_0x3ebfbd(0x1ad)]['textKnowledgeBases'][_0x3ebfbd(0x1d8)]++;}}for(const _0x15bd7a of _0x27dbb3){if(_0x15bd7a[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x184)])continue;const _0x1a062a=getSanitizedPathWithMigration(getPromptsDir(_0x300008),_0x15bd7a[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x14a)],_0x3ebfbd(0x1c2));_0x1a062a[_0x3ebfbd(0x177)]&&this[_0x3ebfbd(0x1c0)][_0x3ebfbd(0x172)](_0x3ebfbd(0x1d7)+a96_0x1684a2[_0x3ebfbd(0x1a6)](_0x1a062a['oldPath'])+'\x20→\x20'+a96_0x1684a2[_0x3ebfbd(0x1a6)](_0x1a062a[_0x3ebfbd(0x1af)]));const _0x125256=_0x1a062a[_0x3ebfbd(0x1af)],_0x20fa2c=await apiPromptToYaml(_0x15bd7a,_0xf82df3);if(!_0x20fa2c)continue;const _0x26295f=toPromptYamlString(_0x20fa2c),_0x2699e2=!a96_0x484e47['existsSync'](_0x125256);let _0x7f5492=_0x2699e2,_0x580a20;if(!_0x2699e2){const _0x24f99d=a96_0x484e47[_0x3ebfbd(0x1e9)](_0x125256,'utf-8'),_0x473227=generateDiff(_0x24f99d,_0x26295f);_0x7f5492=hasChanges(_0x473227),_0x7f5492&&(_0x580a20=formatDiffWithColors(_0x473227));}_0x307cf6[_0x3ebfbd(0x233)]({'path':_0x125256,'content':_0x26295f}),_0x4c416b[_0x3ebfbd(0x21d)][_0x3ebfbd(0x233)]({'name':_0x15bd7a[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x14a)],'outputPath':_0x125256,'isNew':_0x2699e2,'hasChanges':_0x7f5492,'diff':_0x580a20}),_0x4c416b['counts'][_0x3ebfbd(0x21d)]['total']++;if(_0x2699e2)_0x4c416b[_0x3ebfbd(0x1ad)][_0x3ebfbd(0x21d)][_0x3ebfbd(0x23d)]++;else{if(_0x7f5492)_0x4c416b[_0x3ebfbd(0x1ad)][_0x3ebfbd(0x21d)][_0x3ebfbd(0x246)]++;else _0x4c416b['counts'][_0x3ebfbd(0x21d)][_0x3ebfbd(0x1d8)]++;}}for(const _0x53a4e6 of _0xabcb56){const _0x55f92f=_0x53a4e6[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x150)][_0x3ebfbd(0x230)](),_0x31b8ec=getSanitizedPathWithMigration(getIntegrationsDir(_0x300008),_0x55f92f,_0x3ebfbd(0x1c2));_0x31b8ec[_0x3ebfbd(0x177)]&&this[_0x3ebfbd(0x1c0)]['info'](_0x3ebfbd(0x1cb)+a96_0x1684a2[_0x3ebfbd(0x1a6)](_0x31b8ec[_0x3ebfbd(0x1db)])+'\x20→\x20'+a96_0x1684a2['basename'](_0x31b8ec[_0x3ebfbd(0x1af)]));const _0x1d5078=_0x31b8ec[_0x3ebfbd(0x1af)],_0x4d5104=await apiIntegrationToYaml(_0x53a4e6,_0xf82df3),_0x2d1c00=toIntegrationYamlString(_0x4d5104),_0x1a3105=!a96_0x484e47[_0x3ebfbd(0x196)](_0x1d5078);let _0x573ea8=_0x1a3105,_0x496f9f;if(!_0x1a3105){const _0x2a64e0=a96_0x484e47[_0x3ebfbd(0x1e9)](_0x1d5078,'utf-8'),_0x224560=generateDiff(_0x2a64e0,_0x2d1c00);_0x573ea8=hasChanges(_0x224560),_0x573ea8&&(_0x496f9f=formatDiffWithColors(_0x224560));}_0x307cf6[_0x3ebfbd(0x233)]({'path':_0x1d5078,'content':_0x2d1c00}),_0x4c416b['integrations'][_0x3ebfbd(0x233)]({'name':_0x55f92f,'outputPath':_0x1d5078,'isNew':_0x1a3105,'hasChanges':_0x573ea8,'diff':_0x496f9f}),_0x4c416b[_0x3ebfbd(0x1ad)][_0x3ebfbd(0x22d)]['total']++;if(_0x1a3105)_0x4c416b[_0x3ebfbd(0x1ad)][_0x3ebfbd(0x22d)][_0x3ebfbd(0x23d)]++;else{if(_0x573ea8)_0x4c416b[_0x3ebfbd(0x1ad)]['integrations'][_0x3ebfbd(0x246)]++;else _0x4c416b['counts'][_0x3ebfbd(0x22d)][_0x3ebfbd(0x1d8)]++;}}for(const _0x45f961 of _0x5bfd8d){if(_0x45f961[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x184)])continue;const _0x175b23=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x300008),_0x45f961[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x14a)]);_0x175b23[_0x3ebfbd(0x177)]&&this[_0x3ebfbd(0x1c0)][_0x3ebfbd(0x172)](_0x3ebfbd(0x1eb)+a96_0x1684a2[_0x3ebfbd(0x1a6)](_0x175b23[_0x3ebfbd(0x1db)])+'\x20→\x20'+a96_0x1684a2['basename'](_0x175b23[_0x3ebfbd(0x1af)]));const _0x2d6022=_0x175b23[_0x3ebfbd(0x1af)],_0x414125=a96_0x1684a2[_0x3ebfbd(0x229)](_0x2d6022,sanitizeForFilesystem(_0x45f961[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x14a)])+'.yml'),_0x34981f=a96_0x1684a2['join'](_0x2d6022,_0x3ebfbd(0x1cd)),_0x6c0853=apiExperimentalKnowledgeBaseToYaml(_0x45f961),_0x9d867=toExperimentalKnowledgeBaseYamlString(_0x6c0853),_0x2f45b9=!a96_0x484e47[_0x3ebfbd(0x196)](_0x2d6022);let _0x43a378=_0x2f45b9,_0xe0be94,_0xbc2b15=_0x9d867;const _0x5d26c7=[..._0x6c0853['functions']][_0x3ebfbd(0x17b)]((_0x20b52d,_0x4f5e2c)=>_0x20b52d[_0x3ebfbd(0x14a)][_0x3ebfbd(0x13a)](_0x4f5e2c['name']));for(const _0x5b4a89 of _0x5d26c7){_0xbc2b15+='\x0a---\x20function:\x20'+_0x5b4a89['name']+_0x3ebfbd(0x1a3)+_0x5b4a89['code']+'\x0a---\x20schema:\x20'+_0x5b4a89[_0x3ebfbd(0x14a)]+_0x3ebfbd(0x1a3)+_0x5b4a89[_0x3ebfbd(0x14b)]+'\x0a';}if(!_0x2f45b9){let _0x4805e3='';a96_0x484e47['existsSync'](_0x414125)&&(_0x4805e3=a96_0x484e47[_0x3ebfbd(0x1e9)](_0x414125,'utf-8'));if(a96_0x484e47['existsSync'](_0x34981f)){const _0x2a37a3=a96_0x484e47[_0x3ebfbd(0x1fb)](_0x34981f,{'withFileTypes':!![]}),_0xc0d240=_0x2a37a3[_0x3ebfbd(0x15f)](_0x2ebb79=>_0x2ebb79[_0x3ebfbd(0x171)]())[_0x3ebfbd(0x17b)]((_0x2f44bb,_0x32d12f)=>_0x2f44bb[_0x3ebfbd(0x14a)]['localeCompare'](_0x32d12f[_0x3ebfbd(0x14a)]));for(const _0x2050e4 of _0xc0d240){const _0x2d464e=a96_0x1684a2['join'](_0x34981f,_0x2050e4[_0x3ebfbd(0x14a)],'code.js'),_0x418310=a96_0x1684a2[_0x3ebfbd(0x229)](_0x34981f,_0x2050e4[_0x3ebfbd(0x14a)],_0x3ebfbd(0x146));a96_0x484e47[_0x3ebfbd(0x196)](_0x2d464e)&&(_0x4805e3+=_0x3ebfbd(0x17a)+_0x2050e4[_0x3ebfbd(0x14a)]+'\x20---\x0a'+a96_0x484e47[_0x3ebfbd(0x1e9)](_0x2d464e,'utf-8')+'\x0a'),a96_0x484e47['existsSync'](_0x418310)&&(_0x4805e3+=_0x3ebfbd(0x19f)+_0x2050e4[_0x3ebfbd(0x14a)]+_0x3ebfbd(0x1a3)+a96_0x484e47[_0x3ebfbd(0x1e9)](_0x418310,_0x3ebfbd(0x17e))+'\x0a');}}const _0x3b6b41=generateDiff(_0x4805e3,_0xbc2b15);_0x43a378=hasChanges(_0x3b6b41),_0x43a378&&(_0xe0be94=formatDiffWithColors(_0x3b6b41));}_0x307cf6[_0x3ebfbd(0x233)]({'path':_0x2d6022,'content':'','isDir':!![]}),_0x307cf6[_0x3ebfbd(0x233)]({'path':_0x414125,'content':_0x9d867}),_0x307cf6['push']({'path':_0x34981f,'content':'','isDir':!![]});for(const _0x152ccb of _0x6c0853['functions']){const _0x5c868e=a96_0x1684a2[_0x3ebfbd(0x229)](_0x34981f,sanitizeForFilesystem(_0x152ccb['name'])),_0x445dfd=a96_0x1684a2[_0x3ebfbd(0x229)](_0x5c868e,_0x3ebfbd(0x228)),_0x1bd3ad=a96_0x1684a2['join'](_0x5c868e,_0x3ebfbd(0x146));_0x307cf6['push']({'path':_0x5c868e,'content':'','isDir':!![]}),_0x307cf6[_0x3ebfbd(0x233)]({'path':_0x445dfd,'content':_0x152ccb['code']}),_0x307cf6[_0x3ebfbd(0x233)]({'path':_0x1bd3ad,'content':_0x152ccb['json_schema']});}if(a96_0x484e47[_0x3ebfbd(0x196)](_0x34981f)){const _0x5f234f=a96_0x484e47['readdirSync'](_0x34981f,{'withFileTypes':!![]}),_0x2aee23=new Set(_0x6c0853[_0x3ebfbd(0x1cd)][_0x3ebfbd(0x1d3)](_0xc70411=>sanitizeForFilesystem(_0xc70411['name'])));for(const _0x41226c of _0x5f234f){if(_0x41226c['isDirectory']()&&!_0x2aee23[_0x3ebfbd(0x21e)](_0x41226c[_0x3ebfbd(0x14a)])){const _0x52b8cc=a96_0x1684a2[_0x3ebfbd(0x229)](_0x34981f,_0x41226c[_0x3ebfbd(0x14a)]);_0x4acb7c[_0x3ebfbd(0x233)]({'path':_0x52b8cc,'isDir':!![]});}}}_0x4c416b[_0x3ebfbd(0x180)]['push']({'name':_0x45f961[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x14a)],'outputPath':_0x2d6022,'isNew':_0x2f45b9,'hasChanges':_0x43a378,'diff':_0xe0be94}),_0x4c416b['counts'][_0x3ebfbd(0x180)][_0x3ebfbd(0x223)]++;if(_0x2f45b9)_0x4c416b[_0x3ebfbd(0x1ad)]['experimentalKnowledgeBases'][_0x3ebfbd(0x23d)]++;else{if(_0x43a378)_0x4c416b[_0x3ebfbd(0x1ad)]['experimentalKnowledgeBases'][_0x3ebfbd(0x246)]++;else _0x4c416b[_0x3ebfbd(0x1ad)][_0x3ebfbd(0x180)]['unchanged']++;}}for(const _0x3ccbf7 of _0x19ebf2){if(_0x3ccbf7[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x184)])continue;const _0x3df6b8=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x300008),_0x3ccbf7['attributes']['name']);_0x3df6b8[_0x3ebfbd(0x177)]&&this[_0x3ebfbd(0x1c0)][_0x3ebfbd(0x172)](_0x3ebfbd(0x240)+a96_0x1684a2['basename'](_0x3df6b8['oldPath'])+_0x3ebfbd(0x1cc)+a96_0x1684a2[_0x3ebfbd(0x1a6)](_0x3df6b8['path']));const _0x74e63=_0x3df6b8[_0x3ebfbd(0x1af)],_0x275c39=a96_0x1684a2['join'](_0x74e63,sanitizeForFilesystem(_0x3ccbf7[_0x3ebfbd(0x1b9)][_0x3ebfbd(0x14a)])+_0x3ebfbd(0x1c2)),_0x1a02f3=a96_0x1684a2['join'](_0x74e63,_0x3ebfbd(0x228)),_0x50189a=a96_0x1684a2['join'](_0x74e63,_0x3ebfbd(0x18f)),_0x14b656=apiExperimentalArtifactToYaml(_0x3ccbf7),_0x326932=toExperimentalArtifactYamlString(_0x14b656),_0x25ba2b=!a96_0x484e47[_0x3ebfbd(0x196)](_0x74e63);let _0xe68a8c=_0x25ba2b,_0x1070eb,_0xca9629=_0x326932+('\x0a---\x20code\x20---\x0a'+_0x14b656[_0x3ebfbd(0x1c1)]+'\x0a');const _0x5ac608=[..._0x14b656[_0x3ebfbd(0x18f)]][_0x3ebfbd(0x17b)]((_0x3ab81d,_0x81e580)=>_0x3ab81d['file_name'][_0x3ebfbd(0x13a)](_0x81e580[_0x3ebfbd(0x1b1)]));for(const _0x4c6b86 of _0x5ac608){_0xca9629+=_0x3ebfbd(0x232)+_0x4c6b86['file_name']+_0x3ebfbd(0x1a3)+_0x4c6b86[_0x3ebfbd(0x1a8)]+'\x0a';}if(!_0x25ba2b){let _0x4f6835='';a96_0x484e47['existsSync'](_0x275c39)&&(_0x4f6835=a96_0x484e47['readFileSync'](_0x275c39,_0x3ebfbd(0x17e)));a96_0x484e47[_0x3ebfbd(0x196)](_0x1a02f3)&&(_0x4f6835+=_0x3ebfbd(0x23a)+a96_0x484e47[_0x3ebfbd(0x1e9)](_0x1a02f3,'utf-8')+'\x0a');if(a96_0x484e47['existsSync'](_0x50189a)){const _0xa8fabf=a96_0x484e47['readdirSync'](_0x50189a),_0xe7642=_0xa8fabf[_0x3ebfbd(0x15f)](_0x20b30e=>{const _0x24d4b1=_0x3ebfbd,_0x256f91=a96_0x1684a2[_0x24d4b1(0x229)](_0x50189a,_0x20b30e);return a96_0x484e47['statSync'](_0x256f91)[_0x24d4b1(0x1b3)]();})['sort']((_0x558dd4,_0x167b4c)=>_0x558dd4[_0x3ebfbd(0x13a)](_0x167b4c));for(const _0x44cc7a of _0xe7642){const _0x221029=a96_0x1684a2[_0x3ebfbd(0x229)](_0x50189a,_0x44cc7a);_0x4f6835+='---\x20file:\x20'+_0x44cc7a+_0x3ebfbd(0x1a3)+a96_0x484e47[_0x3ebfbd(0x1e9)](_0x221029,_0x3ebfbd(0x17e))+'\x0a';}}const _0x57a66c=generateDiff(_0x4f6835,_0xca9629);_0xe68a8c=hasChanges(_0x57a66c),_0xe68a8c&&(_0x1070eb=formatDiffWithColors(_0x57a66c));}_0x307cf6['push']({'path':_0x74e63,'content':'','isDir':!![]}),_0x307cf6[_0x3ebfbd(0x233)]({'path':_0x275c39,'content':_0x326932}),_0x307cf6[_0x3ebfbd(0x233)]({'path':_0x1a02f3,'content':_0x14b656[_0x3ebfbd(0x1c1)]});if(_0x14b656[_0x3ebfbd(0x18f)]['length']>0x0){_0x307cf6['push']({'path':_0x50189a,'content':'','isDir':!![]});for(const _0x2f593b of _0x14b656['files']){const _0x1e4af1=a96_0x1684a2[_0x3ebfbd(0x229)](_0x50189a,_0x2f593b[_0x3ebfbd(0x1b1)]);_0x307cf6[_0x3ebfbd(0x233)]({'path':_0x1e4af1,'content':_0x2f593b[_0x3ebfbd(0x1a8)]});}}if(a96_0x484e47['existsSync'](_0x50189a)){const _0xe5adb7=a96_0x484e47[_0x3ebfbd(0x1fb)](_0x50189a),_0x280cc1=new Set(_0x14b656[_0x3ebfbd(0x18f)][_0x3ebfbd(0x1d3)](_0x318d7b=>_0x318d7b[_0x3ebfbd(0x1b1)]));for(const _0x2295fd of _0xe5adb7){const _0x24559f=a96_0x1684a2[_0x3ebfbd(0x229)](_0x50189a,_0x2295fd);a96_0x484e47[_0x3ebfbd(0x1ab)](_0x24559f)[_0x3ebfbd(0x1b3)]()&&!_0x280cc1['has'](_0x2295fd)&&_0x4acb7c['push']({'path':_0x24559f});}}_0x4c416b[_0x3ebfbd(0x192)][_0x3ebfbd(0x233)]({'name':_0x3ccbf7['attributes'][_0x3ebfbd(0x14a)],'outputPath':_0x74e63,'isNew':_0x25ba2b,'hasChanges':_0xe68a8c,'diff':_0x1070eb}),_0x4c416b[_0x3ebfbd(0x1ad)][_0x3ebfbd(0x192)][_0x3ebfbd(0x223)]++;if(_0x25ba2b)_0x4c416b[_0x3ebfbd(0x1ad)]['experimentalArtifacts'][_0x3ebfbd(0x23d)]++;else{if(_0xe68a8c)_0x4c416b[_0x3ebfbd(0x1ad)][_0x3ebfbd(0x192)][_0x3ebfbd(0x246)]++;else _0x4c416b['counts'][_0x3ebfbd(0x192)][_0x3ebfbd(0x1d8)]++;}}if(_0x3978a7?.[_0x3ebfbd(0x226)])return _0x4c416b;a96_0x484e47['mkdirSync'](_0x300008,{'recursive':!![]}),a96_0x484e47[_0x3ebfbd(0x203)](getKnowledgeBasesDir(_0x300008),{'recursive':!![]}),a96_0x484e47[_0x3ebfbd(0x203)](getPromptsDir(_0x300008),{'recursive':!![]}),a96_0x484e47[_0x3ebfbd(0x203)](getIntegrationsDir(_0x300008),{'recursive':!![]}),a96_0x484e47[_0x3ebfbd(0x203)](getExperimentalKnowledgeBasesDir(_0x300008),{'recursive':!![]}),a96_0x484e47[_0x3ebfbd(0x203)](getExperimentalArtifactsDir(_0x300008),{'recursive':!![]});const _0x543bce=a96_0x1684a2[_0x3ebfbd(0x229)](_0x300008,_0x3ebfbd(0x1e5));a96_0x484e47[_0x3ebfbd(0x202)](_0x543bce,createAgentConfigContent(_0x12dbdc));for(const _0x79610f of _0x307cf6){if(_0x79610f[_0x3ebfbd(0x22b)])a96_0x484e47[_0x3ebfbd(0x203)](_0x79610f['path'],{'recursive':!![]});else{const _0x5ef2ff=a96_0x1684a2[_0x3ebfbd(0x222)](_0x79610f[_0x3ebfbd(0x1af)]);!a96_0x484e47[_0x3ebfbd(0x196)](_0x5ef2ff)&&a96_0x484e47[_0x3ebfbd(0x203)](_0x5ef2ff,{'recursive':!![]}),a96_0x484e47['writeFileSync'](_0x79610f['path'],_0x79610f['content']);}}for(const _0x373a2e of _0x4acb7c){_0x373a2e[_0x3ebfbd(0x22b)]?(a96_0x484e47[_0x3ebfbd(0x153)](_0x373a2e[_0x3ebfbd(0x1af)],{'recursive':!![],'force':!![]}),this[_0x3ebfbd(0x1c0)]['info'](_0x3ebfbd(0x152)+a96_0x1684a2['basename'](a96_0x1684a2[_0x3ebfbd(0x222)](_0x373a2e[_0x3ebfbd(0x1af)]))+'/'+a96_0x1684a2[_0x3ebfbd(0x1a6)](_0x373a2e[_0x3ebfbd(0x1af)]))):(a96_0x484e47[_0x3ebfbd(0x153)](_0x373a2e['path'],{'force':!![]}),this['logger'][_0x3ebfbd(0x172)](_0x3ebfbd(0x149)+a96_0x1684a2[_0x3ebfbd(0x1a6)](a96_0x1684a2['dirname'](_0x373a2e[_0x3ebfbd(0x1af)]))+'/'+a96_0x1684a2[_0x3ebfbd(0x1a6)](_0x373a2e[_0x3ebfbd(0x1af)])));}return _0x4c416b;}async[a96_0x221c40(0x140)](_0x214336,_0x3266dd){const _0x371d3f=a96_0x221c40,_0x5b5241=a96_0x1684a2['join'](_0x214336,_0x371d3f(0x1e5));if(!a96_0x484e47[_0x371d3f(0x196)](_0x5b5241))throw new SDKError(ErrorCode[_0x371d3f(0x1e6)],_0x371d3f(0x1bf)+_0x214336,undefined,{'helpText':_0x371d3f(0x1bd)});const _0x127cb2=loadAgentConfig(_0x5b5241),_0x4b1623=await this[_0x371d3f(0x1ec)](_0x127cb2[_0x371d3f(0x13b)]),_0x362fbf=await this['client'][_0x371d3f(0x237)](_0x4b1623),_0x4de6de=_0x362fbf[_0x371d3f(0x1b9)]['name'],_0x15549f={'projectName':_0x4de6de,'projectId':_0x4b1623,'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}}},_0x1a43ca=[],_0x579d37=[],_0x777bb7=[],_0x5d7fac=[],_0x366d5e=[],_0x37aff5=[],_0x3f60e5=a96_0x484e47[_0x371d3f(0x1fb)](_0x214336,{'withFileTypes':!![]});for(const _0x83425b of _0x3f60e5){if(!_0x83425b['isDirectory']())continue;if([_0x371d3f(0x1d5),_0x371d3f(0x21d),_0x371d3f(0x22d),'experimental_knowledge_bases',_0x371d3f(0x1fa)]['includes'](_0x83425b[_0x371d3f(0x14a)]))continue;const _0x4edfe8=a96_0x1684a2[_0x371d3f(0x229)](_0x214336,_0x83425b[_0x371d3f(0x14a)]);if(isAgentDir(_0x4edfe8)){const _0x489caa=a96_0x1684a2['join'](_0x4edfe8,_0x371d3f(0x1e7)),_0x2a13de=a96_0x1684a2['join'](_0x4edfe8,_0x371d3f(0x23b)),_0x8c83ea=a96_0x1684a2['join'](_0x4edfe8,_0x371d3f(0x1e8)),_0x48a856=parseAgentYaml(a96_0x484e47[_0x371d3f(0x1e9)](_0x489caa,_0x371d3f(0x17e)),_0x489caa),_0x43e27d=a96_0x484e47[_0x371d3f(0x196)](_0x2a13de)?a96_0x484e47[_0x371d3f(0x1e9)](_0x2a13de,_0x371d3f(0x17e)):'',_0x7caf9d=a96_0x484e47['existsSync'](_0x8c83ea)?a96_0x484e47[_0x371d3f(0x1e9)](_0x8c83ea,_0x371d3f(0x17e)):_0x48a856['starter_message'];_0x1a43ca[_0x371d3f(0x233)]({'name':_0x48a856[_0x371d3f(0x14a)],'dir':_0x4edfe8,'yaml':_0x48a856,'systemPrompt':_0x43e27d,'starterMessage':_0x7caf9d});}}const _0x5d1b2b=getKnowledgeBasesDir(_0x214336);if(a96_0x484e47[_0x371d3f(0x196)](_0x5d1b2b)){const _0x44882c=a96_0x484e47[_0x371d3f(0x1fb)](_0x5d1b2b);for(const _0x5323b3 of _0x44882c){const _0x1bba76=a96_0x1684a2[_0x371d3f(0x229)](_0x5d1b2b,_0x5323b3);if(_0x5323b3[_0x371d3f(0x187)](_0x371d3f(0x1c2))){const _0x105dcc=parseKnowledgeBaseYaml(a96_0x484e47[_0x371d3f(0x1e9)](_0x1bba76,'utf-8'),_0x1bba76);_0x579d37[_0x371d3f(0x233)]({'name':_0x105dcc[_0x371d3f(0x14a)],'path':_0x1bba76,'yaml':_0x105dcc});}else{if(_0x5323b3[_0x371d3f(0x187)](_0x371d3f(0x14d))){const _0x1d8e80=a96_0x484e47[_0x371d3f(0x1e9)](_0x1bba76,_0x371d3f(0x17e)),{name:_0x5a79cc,text:_0xf50efc}=parseTextKnowledgeBaseMd(_0x1d8e80,_0x5323b3);_0x777bb7['push']({'name':_0x5a79cc,'path':_0x1bba76,'text':_0xf50efc});}}}}const _0x52424d=getPromptsDir(_0x214336);if(a96_0x484e47[_0x371d3f(0x196)](_0x52424d)){const _0x1f1171=a96_0x484e47[_0x371d3f(0x1fb)](_0x52424d)[_0x371d3f(0x15f)](_0x18dccf=>_0x18dccf['endsWith'](_0x371d3f(0x1c2)));for(const _0x4a6f02 of _0x1f1171){const _0x1689c3=a96_0x1684a2[_0x371d3f(0x229)](_0x52424d,_0x4a6f02),_0xebcf9a=parsePromptYaml(a96_0x484e47[_0x371d3f(0x1e9)](_0x1689c3,_0x371d3f(0x17e)),_0x1689c3);_0x5d7fac['push']({'name':_0xebcf9a['name'],'path':_0x1689c3,'yaml':_0xebcf9a});}}const _0x40ed0a=[],_0x32c259=getIntegrationsDir(_0x214336);if(a96_0x484e47[_0x371d3f(0x196)](_0x32c259)){const _0x1fc4d1=a96_0x484e47[_0x371d3f(0x1fb)](_0x32c259)[_0x371d3f(0x15f)](_0x4ee1fa=>_0x4ee1fa[_0x371d3f(0x187)]('.yml'));for(const _0x508615 of _0x1fc4d1){const _0x1e16cd=a96_0x1684a2['join'](_0x32c259,_0x508615),_0x53dfbb=parseIntegrationYaml(a96_0x484e47[_0x371d3f(0x1e9)](_0x1e16cd,'utf-8'),_0x1e16cd);if(!SAFE_INTEGRATION_TYPES['includes'](_0x53dfbb['service_type'][_0x371d3f(0x230)]())){this['logger']['warn'](_0x371d3f(0x24f)+_0x53dfbb[_0x371d3f(0x14a)]+_0x371d3f(0x1b4)+_0x53dfbb[_0x371d3f(0x24a)]+_0x371d3f(0x1bb)+(_0x371d3f(0x1c3)+SAFE_INTEGRATION_TYPES[_0x371d3f(0x229)](',\x20')+')\x20can\x20be\x20pushed.\x20')+_0x371d3f(0x1a7));continue;}_0x40ed0a['push']({'name':_0x53dfbb['name'],'path':_0x1e16cd,'yaml':_0x53dfbb});}}const _0x1dd8b6=getExperimentalKnowledgeBasesDir(_0x214336);if(a96_0x484e47[_0x371d3f(0x196)](_0x1dd8b6)){const _0x3ab371=a96_0x484e47[_0x371d3f(0x1fb)](_0x1dd8b6,{'withFileTypes':!![]});for(const _0xdda696 of _0x3ab371){if(!_0xdda696[_0x371d3f(0x171)]())continue;const _0x35c87b=a96_0x1684a2[_0x371d3f(0x229)](_0x1dd8b6,_0xdda696[_0x371d3f(0x14a)]),_0x15ac9c=a96_0x1684a2['join'](_0x35c87b,_0xdda696[_0x371d3f(0x14a)]+_0x371d3f(0x1c2)),_0x2266ec=a96_0x1684a2[_0x371d3f(0x229)](_0x35c87b,'functions');if(!a96_0x484e47[_0x371d3f(0x196)](_0x15ac9c))continue;const _0x14d6d9=parseExperimentalKnowledgeBaseYaml(a96_0x484e47[_0x371d3f(0x1e9)](_0x15ac9c,_0x371d3f(0x17e)),_0x15ac9c),_0x2356b5=[];if(a96_0x484e47[_0x371d3f(0x196)](_0x2266ec)){const _0x1a5baa=a96_0x484e47[_0x371d3f(0x1fb)](_0x2266ec,{'withFileTypes':!![]});for(const _0x47b3d7 of _0x1a5baa){if(!_0x47b3d7[_0x371d3f(0x171)]())continue;const _0x4c5323=a96_0x1684a2[_0x371d3f(0x229)](_0x2266ec,_0x47b3d7[_0x371d3f(0x14a)]),_0x39f1cb=a96_0x1684a2[_0x371d3f(0x229)](_0x4c5323,_0x371d3f(0x228)),_0x3e326d=a96_0x1684a2[_0x371d3f(0x229)](_0x4c5323,_0x371d3f(0x146));a96_0x484e47['existsSync'](_0x39f1cb)&&a96_0x484e47[_0x371d3f(0x196)](_0x3e326d)&&_0x2356b5[_0x371d3f(0x233)]({'name':_0x47b3d7[_0x371d3f(0x14a)],'code':a96_0x484e47['readFileSync'](_0x39f1cb,_0x371d3f(0x17e)),'json_schema':a96_0x484e47['readFileSync'](_0x3e326d,_0x371d3f(0x17e))});}}const _0x176858={..._0x14d6d9,'variables':_0x14d6d9[_0x371d3f(0x1d9)]||[],'functions':_0x2356b5};_0x366d5e[_0x371d3f(0x233)]({'name':_0x14d6d9[_0x371d3f(0x14a)],'dir':_0x35c87b,'def':_0x176858});}}const _0x12823e=getExperimentalArtifactsDir(_0x214336);if(a96_0x484e47[_0x371d3f(0x196)](_0x12823e)){const _0x1a321c=a96_0x484e47[_0x371d3f(0x1fb)](_0x12823e,{'withFileTypes':!![]});for(const _0x215759 of _0x1a321c){if(!_0x215759[_0x371d3f(0x171)]())continue;const _0xac0440=a96_0x1684a2[_0x371d3f(0x229)](_0x12823e,_0x215759[_0x371d3f(0x14a)]),_0x5dac70=a96_0x1684a2[_0x371d3f(0x229)](_0xac0440,_0x215759[_0x371d3f(0x14a)]+_0x371d3f(0x1c2)),_0x78f4c2=a96_0x1684a2[_0x371d3f(0x229)](_0xac0440,_0x371d3f(0x228)),_0x5b10f3=a96_0x1684a2[_0x371d3f(0x229)](_0xac0440,_0x371d3f(0x18f));if(!a96_0x484e47['existsSync'](_0x5dac70)||!a96_0x484e47['existsSync'](_0x78f4c2))continue;const _0x320330=parseExperimentalArtifactYaml(a96_0x484e47[_0x371d3f(0x1e9)](_0x5dac70,_0x371d3f(0x17e)),_0x5dac70),_0x2561de=a96_0x484e47[_0x371d3f(0x1e9)](_0x78f4c2,'utf-8'),_0x293651=[];if(a96_0x484e47['existsSync'](_0x5b10f3)){const _0x130c96=a96_0x484e47[_0x371d3f(0x1fb)](_0x5b10f3);for(const _0x135d04 of _0x130c96){const _0x13a082=a96_0x1684a2[_0x371d3f(0x229)](_0x5b10f3,_0x135d04);a96_0x484e47[_0x371d3f(0x1ab)](_0x13a082)[_0x371d3f(0x1b3)]()&&_0x293651[_0x371d3f(0x233)]({'file_name':_0x135d04,'text_content':a96_0x484e47[_0x371d3f(0x1e9)](_0x13a082,'utf-8')});}}const _0x38c504={..._0x320330,'code':_0x2561de,'files':_0x293651};_0x37aff5[_0x371d3f(0x233)]({'name':_0x320330['name'],'dir':_0xac0440,'def':_0x38c504});}}const _0x24cdcf=await this[_0x371d3f(0x206)][_0x371d3f(0x169)](_0x4b1623),_0x2d88e9=await this[_0x371d3f(0x206)][_0x371d3f(0x234)](_0x4b1623),_0x18aaea=await this[_0x371d3f(0x206)]['listTextKnowledgeBases'](_0x4b1623),_0x5a0686=await this[_0x371d3f(0x206)][_0x371d3f(0x241)](_0x4b1623),_0x462864=await this['client'][_0x371d3f(0x1ae)](_0x4b1623),_0x2eed98=await this[_0x371d3f(0x206)][_0x371d3f(0x22c)](_0x4b1623),_0x297cd7=await this[_0x371d3f(0x206)]['listIntegrations'](_0x4b1623),_0x18c1ed=await this[_0x371d3f(0x206)][_0x371d3f(0x1f3)](_0x4b1623),_0x694833=await this[_0x371d3f(0x206)][_0x371d3f(0x1a2)](_0x4b1623),_0x20fef5=await this[_0x371d3f(0x206)][_0x371d3f(0x1fe)](_0x4b1623),_0x20da33=new Map(),_0x8f2f54=new Map(),_0x3ff5b1=new Map(),_0x185610=new Map(),_0x5b81c8=new Map(),_0x5aa11d=new Map(),_0x52c271=new Map();for(const _0x3b5d1b of _0x24cdcf){_0x20da33['set'](_0x3b5d1b['attributes']['name'],_0x3b5d1b);}for(const _0x459016 of _0x2d88e9){_0x8f2f54[_0x371d3f(0x20c)](_0x459016['attributes'][_0x371d3f(0x14a)],_0x459016);}for(const _0x11b470 of _0x18aaea){_0x3ff5b1['set'](_0x11b470[_0x371d3f(0x1b9)]['name'],_0x11b470);}for(const _0x5b4ef5 of _0x2eed98){_0x185610[_0x371d3f(0x20c)](_0x5b4ef5['attributes'][_0x371d3f(0x14a)],_0x5b4ef5);}for(const _0x3281a1 of _0x297cd7){_0x5b81c8[_0x371d3f(0x20c)](_0x3281a1[_0x371d3f(0x1b9)][_0x371d3f(0x150)][_0x371d3f(0x230)](),_0x3281a1);}for(const _0xef0f2c of _0x694833){_0x5aa11d['set'](_0xef0f2c[_0x371d3f(0x1b9)][_0x371d3f(0x14a)],_0xef0f2c);}for(const _0x1cacec of _0x20fef5){_0x52c271['set'](_0x1cacec['attributes'][_0x371d3f(0x14a)],_0x1cacec);}const _0x56634e=new Map(),_0x4b1f05=new Map(),_0x5cea30=new Map(),_0x20a252=new Map(),_0x4fb6b7=new Map(),_0x59e8c0=new Map(),_0x26387d=new Map(),_0x5c0efc=new Map(),_0x59f66b=new Map(),_0x389bc8=new Map(),_0x4f6c73=new Map(),_0x3ec249=new Map(),_0x37947b=new Map(),_0x16e383=new Map(),_0x6ea9f5=new Map(),_0x3b5d48=new Map();for(const _0x20d4f9 of _0x2d88e9){_0x56634e['set'](_0x20d4f9[_0x371d3f(0x1b9)]['name'],_0x20d4f9['id']),_0x59f66b[_0x371d3f(0x20c)](_0x20d4f9['id'],_0x20d4f9['attributes'][_0x371d3f(0x14a)]);}for(const _0x2def80 of _0x18aaea){_0x4b1f05[_0x371d3f(0x20c)](_0x2def80[_0x371d3f(0x1b9)]['name'],_0x2def80['id']),_0x389bc8['set'](_0x2def80['id'],_0x2def80['attributes'][_0x371d3f(0x14a)]);}for(const _0x3bc703 of _0x24cdcf){_0x5cea30[_0x371d3f(0x20c)](_0x3bc703[_0x371d3f(0x1b9)]['name'],_0x3bc703['id']),_0x4f6c73['set'](_0x3bc703['id'],_0x3bc703[_0x371d3f(0x1b9)][_0x371d3f(0x14a)]);}for(const _0x326acb of _0x5a0686){_0x20a252['set'](_0x326acb[_0x371d3f(0x1b9)][_0x371d3f(0x14a)],_0x326acb['id']),_0x3ec249[_0x371d3f(0x20c)](_0x326acb['id'],_0x326acb[_0x371d3f(0x1b9)][_0x371d3f(0x14a)]);}for(const _0x2b59cf of _0x462864){_0x4fb6b7[_0x371d3f(0x20c)](_0x2b59cf['attributes']['name'],_0x2b59cf['id']),_0x37947b['set'](_0x2b59cf['id'],_0x2b59cf[_0x371d3f(0x1b9)][_0x371d3f(0x14a)]);}for(const _0x146508 of _0x2eed98){_0x59e8c0['set'](_0x146508[_0x371d3f(0x1b9)][_0x371d3f(0x14a)],_0x146508['id']),_0x16e383[_0x371d3f(0x20c)](_0x146508['id'],_0x146508['attributes']['name']);}for(const _0xb660a4 of _0x694833){_0x26387d[_0x371d3f(0x20c)](_0xb660a4[_0x371d3f(0x1b9)][_0x371d3f(0x14a)],_0xb660a4['id']),_0x6ea9f5['set'](_0xb660a4['id'],_0xb660a4[_0x371d3f(0x1b9)]['name']);}for(const _0x225f63 of _0x20fef5){_0x5c0efc[_0x371d3f(0x20c)](_0x225f63['attributes']['name'],_0x225f63['id']),_0x3b5d48[_0x371d3f(0x20c)](_0x225f63['id'],_0x225f63['attributes']['name']);}const _0x39e020={'resolveKnowledgeBaseName':async _0x215b8d=>_0x59f66b[_0x371d3f(0x164)](_0x215b8d),'resolveTextKnowledgeBaseName':async _0xd401ef=>_0x389bc8[_0x371d3f(0x164)](_0xd401ef),'resolveAgentName':async _0x397ad5=>_0x4f6c73[_0x371d3f(0x164)](_0x397ad5),'resolveWebSearchToolName':async _0x1778e5=>_0x37947b[_0x371d3f(0x164)](_0x1778e5),'resolveImageGeneratorName':async _0x14f733=>_0x3ec249[_0x371d3f(0x164)](_0x14f733),'resolvePromptName':async _0x5e1356=>_0x16e383[_0x371d3f(0x164)](_0x5e1356),'resolveExperimentalKnowledgeBaseName':async _0x3b9b51=>_0x6ea9f5[_0x371d3f(0x164)](_0x3b9b51),'onWarning':_0x56a182=>this['logger'][_0x371d3f(0x1c4)](_0x56a182)};let _0x83c4a2=[];const _0x5d8ec1={'projectId':_0x4b1623,'resolveKnowledgeBaseId':async _0x39643a=>_0x56634e[_0x371d3f(0x164)](_0x39643a),'resolveTextKnowledgeBaseId':async _0x14b04b=>_0x4b1f05[_0x371d3f(0x164)](_0x14b04b),'resolveAgentId':async _0x58409a=>_0x5cea30[_0x371d3f(0x164)](_0x58409a),'resolveWebSearchToolId':async _0x1248df=>_0x4fb6b7['get'](_0x1248df),'resolveImageGeneratorId':async _0x24d785=>_0x20a252[_0x371d3f(0x164)](_0x24d785),'resolvePromptId':async _0x2f092b=>_0x59e8c0['get'](_0x2f092b),'resolveParentSegmentKBId':async()=>_0x18c1ed?.['id'],'resolveExperimentalKnowledgeBaseId':async _0xf91550=>_0x26387d['get'](_0xf91550),'onWarning':_0x3d6496=>{const _0x552451=_0x371d3f;this[_0x552451(0x1c0)][_0x552451(0x1c4)](_0x3d6496),_0x83c4a2[_0x552451(0x233)](_0x3d6496);}},{resolved:_0x5e7df2,unresolved:_0x1b654a}=resolveAgentDependencies(_0x1a43ca,new Set(_0x20da33[_0x371d3f(0x23e)]()));for(const {agent:_0x58753e,missingDeps:_0x5ae2c2}of _0x1b654a){_0x15549f['agents']['push']({'agentName':_0x58753e[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],'action':'error','error':_0x371d3f(0x238)+_0x5ae2c2[_0x371d3f(0x229)](',\x20')+_0x371d3f(0x22f)}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x1dc)][_0x371d3f(0x163)]++;}for(const _0x16464e of _0x579d37){const _0x42266b=_0x8f2f54[_0x371d3f(0x164)](_0x16464e[_0x371d3f(0x1e4)]['name']),_0x5aa8b4=a96_0x484e47[_0x371d3f(0x1e9)](_0x16464e[_0x371d3f(0x1af)],_0x371d3f(0x17e));if(_0x42266b){const _0x5a6e0e=apiKnowledgeBaseToYaml(_0x42266b),_0x13dcb2=toKnowledgeBaseYamlString(_0x5a6e0e),_0x330e67=generateDiff(_0x13dcb2,_0x5aa8b4),_0x4884a2=hasChanges(_0x330e67);_0x4884a2?(_0x15549f[_0x371d3f(0x22e)]['push']({'name':_0x16464e[_0x371d3f(0x1e4)]['name'],'action':'updated','id':_0x42266b['id'],'diff':formatDiffWithColors(_0x330e67)}),_0x15549f['counts']['knowledgeBases'][_0x371d3f(0x246)]++):(_0x15549f[_0x371d3f(0x22e)][_0x371d3f(0x233)]({'name':_0x16464e[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],'action':_0x371d3f(0x1d8),'id':_0x42266b['id']}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x22e)][_0x371d3f(0x1d8)]++);}else _0x15549f[_0x371d3f(0x22e)][_0x371d3f(0x233)]({'name':_0x16464e[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],'action':_0x371d3f(0x165)}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x22e)][_0x371d3f(0x165)]++;}for(const _0x32e534 of _0x777bb7){const _0x267b7c=_0x3ff5b1[_0x371d3f(0x164)](_0x32e534['name']),_0x463253=a96_0x484e47['readFileSync'](_0x32e534[_0x371d3f(0x1af)],'utf-8');if(_0x267b7c){const _0x2c4e29=toTextKnowledgeBaseMd(_0x267b7c[_0x371d3f(0x1b9)]['name'],_0x267b7c[_0x371d3f(0x1b9)][_0x371d3f(0x1f4)]),_0xea7234=generateDiff(_0x2c4e29,_0x463253),_0x1b10c1=hasChanges(_0xea7234);_0x1b10c1?(_0x15549f[_0x371d3f(0x1bc)][_0x371d3f(0x233)]({'name':_0x32e534[_0x371d3f(0x14a)],'action':_0x371d3f(0x246),'id':_0x267b7c['id'],'diff':formatDiffWithColors(_0xea7234)}),_0x15549f['counts']['textKnowledgeBases'][_0x371d3f(0x246)]++):(_0x15549f['textKnowledgeBases'][_0x371d3f(0x233)]({'name':_0x32e534[_0x371d3f(0x14a)],'action':'unchanged','id':_0x267b7c['id']}),_0x15549f[_0x371d3f(0x1ad)]['textKnowledgeBases'][_0x371d3f(0x1d8)]++);}else _0x15549f['textKnowledgeBases'][_0x371d3f(0x233)]({'name':_0x32e534[_0x371d3f(0x14a)],'action':_0x371d3f(0x165)}),_0x15549f['counts'][_0x371d3f(0x1bc)]['created']++;}for(const _0x28ff3b of _0x5e7df2){const _0x57ec97=_0x20da33[_0x371d3f(0x164)](_0x28ff3b[_0x371d3f(0x1e4)][_0x371d3f(0x14a)]),_0x90cf9=a96_0x1684a2[_0x371d3f(0x229)](_0x28ff3b[_0x371d3f(0x16b)],'agent.yml'),_0x226b6b=a96_0x484e47[_0x371d3f(0x1e9)](_0x90cf9,_0x371d3f(0x17e)),_0x1f7d12=_0x28ff3b[_0x371d3f(0x227)],_0x2fca59=_0x371d3f(0x1ee)+_0x1f7d12+_0x371d3f(0x16e)+_0x226b6b;if(_0x57ec97){const {yaml:_0x5a6608,systemPrompt:_0x87ea8c}=await agentResponseToDef(_0x57ec97,_0x39e020),_0x3c96b3=toAgentYamlString(_0x5a6608),_0x359b28=_0x371d3f(0x1ee)+_0x87ea8c+_0x371d3f(0x16e)+_0x3c96b3,_0x2ccdbb=generateDiff(_0x359b28,_0x2fca59),_0x18132a=hasChanges(_0x2ccdbb);_0x18132a?(_0x15549f[_0x371d3f(0x1dc)]['push']({'agentName':_0x28ff3b[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],'action':_0x371d3f(0x246),'agentId':_0x57ec97['id'],'diff':formatDiffWithColors(_0x2ccdbb)}),_0x15549f[_0x371d3f(0x1ad)]['agents']['updated']++):(_0x15549f[_0x371d3f(0x1dc)][_0x371d3f(0x233)]({'agentName':_0x28ff3b[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],'action':'unchanged','agentId':_0x57ec97['id']}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x1dc)][_0x371d3f(0x1d8)]++);}else _0x15549f[_0x371d3f(0x1dc)][_0x371d3f(0x233)]({'agentName':_0x28ff3b[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],'action':_0x371d3f(0x165)}),_0x15549f[_0x371d3f(0x1ad)]['agents'][_0x371d3f(0x165)]++;}for(const _0x574e48 of _0x5d7fac){const _0xd432b1=_0x185610['get'](_0x574e48[_0x371d3f(0x1e4)][_0x371d3f(0x14a)]),_0x5c89d0=a96_0x484e47[_0x371d3f(0x1e9)](_0x574e48[_0x371d3f(0x1af)],_0x371d3f(0x17e));if(_0xd432b1){const _0xc462f2=await apiPromptToYaml(_0xd432b1,_0x39e020);if(!_0xc462f2){_0x15549f[_0x371d3f(0x21d)][_0x371d3f(0x233)]({'name':_0x574e48[_0x371d3f(0x1e4)]['name'],'action':_0x371d3f(0x246),'id':_0xd432b1['id']}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x21d)]['updated']++;continue;}const _0x35123a=toPromptYamlString(_0xc462f2),_0x5121c2=generateDiff(_0x35123a,_0x5c89d0),_0xee9b11=hasChanges(_0x5121c2);_0xee9b11?(_0x15549f[_0x371d3f(0x21d)][_0x371d3f(0x233)]({'name':_0x574e48[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],'action':_0x371d3f(0x246),'id':_0xd432b1['id'],'diff':formatDiffWithColors(_0x5121c2)}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x21d)]['updated']++):(_0x15549f[_0x371d3f(0x21d)][_0x371d3f(0x233)]({'name':_0x574e48[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],'action':'unchanged','id':_0xd432b1['id']}),_0x15549f['counts'][_0x371d3f(0x21d)][_0x371d3f(0x1d8)]++);}else _0x15549f[_0x371d3f(0x21d)][_0x371d3f(0x233)]({'name':_0x574e48[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],'action':_0x371d3f(0x165)}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x21d)]['created']++;}for(const _0x2783ac of _0x40ed0a){const _0x277c96=_0x5b81c8[_0x371d3f(0x164)](_0x2783ac[_0x371d3f(0x1e4)][_0x371d3f(0x24a)]),_0x236172=a96_0x484e47[_0x371d3f(0x1e9)](_0x2783ac[_0x371d3f(0x1af)],_0x371d3f(0x17e));if(_0x277c96){const _0x486c12=await apiIntegrationToYaml(_0x277c96,_0x39e020),_0x356fd3=toIntegrationYamlString(_0x486c12),_0x14c4ca=generateDiff(_0x356fd3,_0x236172),_0x438abc=hasChanges(_0x14c4ca);_0x438abc?(_0x15549f[_0x371d3f(0x22d)][_0x371d3f(0x233)]({'name':_0x2783ac[_0x371d3f(0x1e4)]['service_type'],'action':_0x371d3f(0x246),'id':_0x277c96['id'],'diff':formatDiffWithColors(_0x14c4ca)}),_0x15549f['counts']['integrations']['updated']++):(_0x15549f[_0x371d3f(0x22d)][_0x371d3f(0x233)]({'name':_0x2783ac[_0x371d3f(0x1e4)][_0x371d3f(0x24a)],'action':_0x371d3f(0x1d8),'id':_0x277c96['id']}),_0x15549f['counts'][_0x371d3f(0x22d)][_0x371d3f(0x1d8)]++);}else _0x15549f[_0x371d3f(0x22d)][_0x371d3f(0x233)]({'name':_0x2783ac[_0x371d3f(0x1e4)][_0x371d3f(0x24a)],'action':_0x371d3f(0x165)}),_0x15549f['counts'][_0x371d3f(0x22d)][_0x371d3f(0x165)]++;}for(const _0x19bbc1 of _0x366d5e){const _0x5d255d=_0x5aa11d[_0x371d3f(0x164)](_0x19bbc1[_0x371d3f(0x236)]['name']),_0x254060=toExperimentalKnowledgeBaseYamlString(_0x19bbc1[_0x371d3f(0x236)]);let _0x581f9b=_0x254060;for(const _0x4b8313 of _0x19bbc1[_0x371d3f(0x236)][_0x371d3f(0x1cd)]){_0x581f9b+=_0x371d3f(0x17a)+_0x4b8313['name']+_0x371d3f(0x1a3)+_0x4b8313[_0x371d3f(0x1c1)]+'\x0a---\x20schema:\x20'+_0x4b8313['name']+_0x371d3f(0x1a3)+_0x4b8313['json_schema']+'\x0a';}if(_0x5d255d){const _0x5aa582=apiExperimentalKnowledgeBaseToYaml(_0x5d255d),_0x31cb5f=toExperimentalKnowledgeBaseYamlString(_0x5aa582);let _0x52d896=_0x31cb5f;for(const _0x48ecab of _0x5aa582['functions']){_0x52d896+=_0x371d3f(0x17a)+_0x48ecab[_0x371d3f(0x14a)]+_0x371d3f(0x1a3)+_0x48ecab[_0x371d3f(0x1c1)]+'\x0a---\x20schema:\x20'+_0x48ecab[_0x371d3f(0x14a)]+'\x20---\x0a'+_0x48ecab[_0x371d3f(0x14b)]+'\x0a';}const _0x5037bd=generateDiff(_0x52d896,_0x581f9b),_0x5c8b6e=hasChanges(_0x5037bd);_0x5c8b6e?(_0x15549f[_0x371d3f(0x180)][_0x371d3f(0x233)]({'name':_0x19bbc1[_0x371d3f(0x236)][_0x371d3f(0x14a)],'action':_0x371d3f(0x246),'id':_0x5d255d['id'],'diff':formatDiffWithColors(_0x5037bd)}),_0x15549f['counts']['experimentalKnowledgeBases'][_0x371d3f(0x246)]++):(_0x15549f['experimentalKnowledgeBases'][_0x371d3f(0x233)]({'name':_0x19bbc1['def']['name'],'action':_0x371d3f(0x1d8),'id':_0x5d255d['id']}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x180)][_0x371d3f(0x1d8)]++);}else _0x15549f[_0x371d3f(0x180)][_0x371d3f(0x233)]({'name':_0x19bbc1['def'][_0x371d3f(0x14a)],'action':_0x371d3f(0x165)}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x180)][_0x371d3f(0x165)]++;}for(const _0x341526 of _0x37aff5){const _0x20ad35=_0x52c271[_0x371d3f(0x164)](_0x341526[_0x371d3f(0x236)][_0x371d3f(0x14a)]),_0x3063ff=toExperimentalArtifactYamlString(_0x341526['def']);let _0x5d14cc=_0x3063ff+('\x0a---\x20code\x20---\x0a'+_0x341526['def'][_0x371d3f(0x1c1)]+'\x0a');for(const _0x4efe8f of _0x341526['def']['files']){_0x5d14cc+=_0x371d3f(0x232)+_0x4efe8f[_0x371d3f(0x1b1)]+'\x20---\x0a'+_0x4efe8f['text_content']+'\x0a';}if(_0x20ad35){const _0x53c06f=apiExperimentalArtifactToYaml(_0x20ad35),_0x40a037=toExperimentalArtifactYamlString(_0x53c06f);let _0x21316e=_0x40a037+('\x0a---\x20code\x20---\x0a'+_0x53c06f[_0x371d3f(0x1c1)]+'\x0a');for(const _0x567715 of _0x53c06f[_0x371d3f(0x18f)]){_0x21316e+=_0x371d3f(0x232)+_0x567715[_0x371d3f(0x1b1)]+'\x20---\x0a'+_0x567715[_0x371d3f(0x1a8)]+'\x0a';}const _0x3c26bb=generateDiff(_0x21316e,_0x5d14cc),_0xadc6f2=hasChanges(_0x3c26bb);_0xadc6f2?(_0x15549f[_0x371d3f(0x192)][_0x371d3f(0x233)]({'name':_0x341526['def']['name'],'action':_0x371d3f(0x246),'id':_0x20ad35['id'],'diff':formatDiffWithColors(_0x3c26bb)}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x192)][_0x371d3f(0x246)]++):(_0x15549f['experimentalArtifacts']['push']({'name':_0x341526[_0x371d3f(0x236)][_0x371d3f(0x14a)],'action':_0x371d3f(0x1d8),'id':_0x20ad35['id']}),_0x15549f['counts'][_0x371d3f(0x192)][_0x371d3f(0x1d8)]++);}else _0x15549f[_0x371d3f(0x192)]['push']({'name':_0x341526[_0x371d3f(0x236)][_0x371d3f(0x14a)],'action':_0x371d3f(0x165)}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x192)][_0x371d3f(0x165)]++;}if(_0x3266dd?.[_0x371d3f(0x226)])return _0x15549f;_0x15549f[_0x371d3f(0x22e)]=[],_0x15549f[_0x371d3f(0x1bc)]=[],_0x15549f['prompts']=[],_0x15549f['integrations']=[],_0x15549f[_0x371d3f(0x180)]=[],_0x15549f['experimentalArtifacts']=[];const _0x43f0ea=_0x15549f[_0x371d3f(0x1dc)]['filter'](_0xf86f8c=>_0xf86f8c[_0x371d3f(0x1e0)]===_0x371d3f(0x1de));_0x15549f[_0x371d3f(0x1dc)]=_0x43f0ea,_0x15549f[_0x371d3f(0x1ad)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x43f0ea[_0x371d3f(0x235)]},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x84212d of _0x579d37){try{const _0xdf7aa4=_0x8f2f54[_0x371d3f(0x164)](_0x84212d['yaml'][_0x371d3f(0x14a)]),_0x353d56=yamlKnowledgeBaseToApi(_0x84212d[_0x371d3f(0x1e4)],_0x4b1623);if(_0xdf7aa4)await this['client'][_0x371d3f(0x200)](_0xdf7aa4['id'],_0x353d56),_0x56634e[_0x371d3f(0x20c)](_0x84212d[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],_0xdf7aa4['id']),_0x15549f[_0x371d3f(0x22e)]['push']({'name':_0x84212d[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],'action':_0x371d3f(0x246),'id':_0xdf7aa4['id']}),_0x15549f['counts'][_0x371d3f(0x22e)][_0x371d3f(0x246)]++;else{const _0x452a63=await this[_0x371d3f(0x206)]['createKnowledgeBase'](_0x353d56);_0x56634e[_0x371d3f(0x20c)](_0x84212d[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],_0x452a63['id']),_0x15549f[_0x371d3f(0x22e)]['push']({'name':_0x84212d[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],'action':_0x371d3f(0x165),'id':_0x452a63['id']}),_0x15549f[_0x371d3f(0x1ad)]['knowledgeBases']['created']++;}}catch(_0x54ee0e){_0x15549f[_0x371d3f(0x22e)][_0x371d3f(0x233)]({'name':_0x84212d[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],'action':'error','error':_0x54ee0e[_0x371d3f(0x248)]}),_0x15549f['counts'][_0x371d3f(0x22e)][_0x371d3f(0x163)]++;}}for(const _0x34c0c7 of _0x777bb7){try{const _0x147c08=_0x3ff5b1['get'](_0x34c0c7[_0x371d3f(0x14a)]),_0x40b2d6=yamlTextKnowledgeBaseToApi({'name':_0x34c0c7[_0x371d3f(0x14a)],'text':_0x34c0c7['text']},_0x4b1623);if(_0x147c08)await this[_0x371d3f(0x206)][_0x371d3f(0x245)](_0x147c08['id'],_0x40b2d6),_0x4b1f05[_0x371d3f(0x20c)](_0x34c0c7[_0x371d3f(0x14a)],_0x147c08['id']),_0x15549f[_0x371d3f(0x1bc)]['push']({'name':_0x34c0c7[_0x371d3f(0x14a)],'action':_0x371d3f(0x246),'id':_0x147c08['id']}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x1bc)][_0x371d3f(0x246)]++;else{const _0x5875ed=await this[_0x371d3f(0x206)][_0x371d3f(0x1f2)](_0x40b2d6);_0x4b1f05[_0x371d3f(0x20c)](_0x34c0c7[_0x371d3f(0x14a)],_0x5875ed['id']),_0x15549f[_0x371d3f(0x1bc)][_0x371d3f(0x233)]({'name':_0x34c0c7[_0x371d3f(0x14a)],'action':_0x371d3f(0x165),'id':_0x5875ed['id']}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x1bc)][_0x371d3f(0x165)]++;}}catch(_0xfecb){_0x15549f[_0x371d3f(0x1bc)][_0x371d3f(0x233)]({'name':_0x34c0c7[_0x371d3f(0x14a)],'action':'error','error':_0xfecb['message']}),_0x15549f[_0x371d3f(0x1ad)]['textKnowledgeBases']['errors']++;}}for(const _0x4b7f1c of _0x366d5e){try{const _0x22958d=_0x5aa11d[_0x371d3f(0x164)](_0x4b7f1c[_0x371d3f(0x236)][_0x371d3f(0x14a)]),_0x104dd6=yamlExperimentalKnowledgeBaseToApi(_0x4b7f1c[_0x371d3f(0x236)],_0x4b1623);if(_0x22958d)await this[_0x371d3f(0x206)]['updateExperimentalKnowledgeBase'](_0x22958d['id'],_0x104dd6),_0x26387d['set'](_0x4b7f1c['def'][_0x371d3f(0x14a)],_0x22958d['id']),_0x15549f[_0x371d3f(0x180)][_0x371d3f(0x233)]({'name':_0x4b7f1c['def'][_0x371d3f(0x14a)],'action':_0x371d3f(0x246),'id':_0x22958d['id']}),_0x15549f['counts']['experimentalKnowledgeBases'][_0x371d3f(0x246)]++;else{const _0x5c7887=await this[_0x371d3f(0x206)][_0x371d3f(0x17f)](_0x104dd6);_0x26387d[_0x371d3f(0x20c)](_0x4b7f1c[_0x371d3f(0x236)][_0x371d3f(0x14a)],_0x5c7887['id']),_0x15549f['experimentalKnowledgeBases'][_0x371d3f(0x233)]({'name':_0x4b7f1c[_0x371d3f(0x236)][_0x371d3f(0x14a)],'action':_0x371d3f(0x165),'id':_0x5c7887['id']}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x180)][_0x371d3f(0x165)]++;}}catch(_0x48a1f2){_0x15549f['experimentalKnowledgeBases'][_0x371d3f(0x233)]({'name':_0x4b7f1c[_0x371d3f(0x236)][_0x371d3f(0x14a)],'action':'error','error':_0x48a1f2[_0x371d3f(0x248)]}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x180)][_0x371d3f(0x163)]++;}}for(const _0x1d0636 of _0x37aff5){try{const _0x598518=_0x52c271['get'](_0x1d0636[_0x371d3f(0x236)]['name']),_0x580f0f=yamlExperimentalArtifactToApi(_0x1d0636[_0x371d3f(0x236)],_0x4b1623);if(_0x598518)await this[_0x371d3f(0x206)][_0x371d3f(0x151)](_0x598518['id'],_0x580f0f),_0x5c0efc[_0x371d3f(0x20c)](_0x1d0636['def'][_0x371d3f(0x14a)],_0x598518['id']),_0x15549f[_0x371d3f(0x192)][_0x371d3f(0x233)]({'name':_0x1d0636[_0x371d3f(0x236)][_0x371d3f(0x14a)],'action':_0x371d3f(0x246),'id':_0x598518['id']}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x192)]['updated']++;else{const _0x542f29=await this[_0x371d3f(0x206)][_0x371d3f(0x22a)](_0x580f0f);_0x5c0efc[_0x371d3f(0x20c)](_0x1d0636[_0x371d3f(0x236)][_0x371d3f(0x14a)],_0x542f29['id']),_0x15549f[_0x371d3f(0x192)][_0x371d3f(0x233)]({'name':_0x1d0636[_0x371d3f(0x236)]['name'],'action':_0x371d3f(0x165),'id':_0x542f29['id']}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x192)][_0x371d3f(0x165)]++;}}catch(_0x2042e5){_0x15549f[_0x371d3f(0x192)][_0x371d3f(0x233)]({'name':_0x1d0636[_0x371d3f(0x236)][_0x371d3f(0x14a)],'action':'error','error':_0x2042e5[_0x371d3f(0x248)]}),_0x15549f[_0x371d3f(0x1ad)]['experimentalArtifacts']['errors']++;}}for(const _0x5098c7 of _0x5e7df2){_0x83c4a2=[];try{const _0xcfca51=_0x20da33[_0x371d3f(0x164)](_0x5098c7[_0x371d3f(0x1e4)][_0x371d3f(0x14a)]),_0x360433=await agentDefToRequest(_0x5098c7[_0x371d3f(0x1e4)],_0x5098c7[_0x371d3f(0x227)],_0x5098c7['starterMessage'],_0x5d8ec1);if(_0xcfca51)await this[_0x371d3f(0x206)][_0x371d3f(0x1d2)](_0xcfca51['id'],_0x360433),_0x5cea30[_0x371d3f(0x20c)](_0x5098c7[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],_0xcfca51['id']),_0x15549f[_0x371d3f(0x1dc)][_0x371d3f(0x233)]({'agentName':_0x5098c7[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],'action':_0x371d3f(0x246),'agentId':_0xcfca51['id'],'warnings':_0x83c4a2[_0x371d3f(0x235)]>0x0?_0x83c4a2:undefined}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x1dc)][_0x371d3f(0x246)]++;else{const _0x56a516=await this[_0x371d3f(0x206)][_0x371d3f(0x175)](_0x360433);_0x5cea30[_0x371d3f(0x20c)](_0x5098c7[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],_0x56a516['id']),_0x15549f[_0x371d3f(0x1dc)][_0x371d3f(0x233)]({'agentName':_0x5098c7[_0x371d3f(0x1e4)]['name'],'action':'created','agentId':_0x56a516['id'],'warnings':_0x83c4a2['length']>0x0?_0x83c4a2:undefined}),_0x15549f[_0x371d3f(0x1ad)]['agents'][_0x371d3f(0x165)]++;}}catch(_0x170496){_0x15549f[_0x371d3f(0x1dc)][_0x371d3f(0x233)]({'agentName':_0x5098c7[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],'action':'error','error':_0x170496['message'],'warnings':_0x83c4a2[_0x371d3f(0x235)]>0x0?_0x83c4a2:undefined}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x1dc)][_0x371d3f(0x163)]++;}}for(const _0x5e042f of _0x5d7fac){try{const _0x459ad1=_0x185610['get'](_0x5e042f['yaml'][_0x371d3f(0x14a)]),_0x1c97b5=await yamlPromptToApi(_0x5e042f[_0x371d3f(0x1e4)],_0x4b1623,_0x5d8ec1);if(!_0x1c97b5){_0x15549f[_0x371d3f(0x21d)][_0x371d3f(0x233)]({'name':_0x5e042f['yaml']['name'],'action':_0x371d3f(0x1de),'error':_0x371d3f(0x1b0)}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x21d)]['errors']++;continue;}if(_0x459ad1)await this[_0x371d3f(0x206)][_0x371d3f(0x161)](_0x459ad1['id'],_0x1c97b5),_0x59e8c0[_0x371d3f(0x20c)](_0x5e042f[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],_0x459ad1['id']),_0x15549f['prompts'][_0x371d3f(0x233)]({'name':_0x5e042f[_0x371d3f(0x1e4)]['name'],'action':'updated','id':_0x459ad1['id']}),_0x15549f['counts'][_0x371d3f(0x21d)]['updated']++;else{const _0x699157=await this[_0x371d3f(0x206)][_0x371d3f(0x1ff)](_0x1c97b5);_0x59e8c0[_0x371d3f(0x20c)](_0x5e042f[_0x371d3f(0x1e4)][_0x371d3f(0x14a)],_0x699157['id']),_0x15549f[_0x371d3f(0x21d)][_0x371d3f(0x233)]({'name':_0x5e042f[_0x371d3f(0x1e4)]['name'],'action':_0x371d3f(0x165),'id':_0x699157['id']}),_0x15549f['counts'][_0x371d3f(0x21d)][_0x371d3f(0x165)]++;}}catch(_0x5f2485){_0x15549f[_0x371d3f(0x21d)][_0x371d3f(0x233)]({'name':_0x5e042f['yaml'][_0x371d3f(0x14a)],'action':_0x371d3f(0x1de),'error':_0x5f2485[_0x371d3f(0x248)]}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x21d)][_0x371d3f(0x163)]++;}}for(const _0xd98cc4 of _0x40ed0a){try{const _0x406965=_0x5b81c8[_0x371d3f(0x164)](_0xd98cc4['yaml'][_0x371d3f(0x24a)]),_0x1d4928=await yamlIntegrationToApi(_0xd98cc4[_0x371d3f(0x1e4)],_0x4b1623,_0x5d8ec1);if(_0x406965){await this[_0x371d3f(0x206)][_0x371d3f(0x1d1)](_0x406965['id']);const _0x2d96da=await this[_0x371d3f(0x206)]['createIntegration'](_0x1d4928);_0x15549f[_0x371d3f(0x22d)][_0x371d3f(0x233)]({'name':_0xd98cc4['yaml']['service_type'],'action':_0x371d3f(0x246),'id':_0x2d96da['id']}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x22d)][_0x371d3f(0x246)]++;}else{const _0x2e270c=await this[_0x371d3f(0x206)][_0x371d3f(0x148)](_0x1d4928);_0x15549f[_0x371d3f(0x22d)][_0x371d3f(0x233)]({'name':_0xd98cc4[_0x371d3f(0x1e4)][_0x371d3f(0x24a)],'action':_0x371d3f(0x165),'id':_0x2e270c['id']}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x22d)][_0x371d3f(0x165)]++;}}catch(_0x42fdc2){_0x15549f[_0x371d3f(0x22d)]['push']({'name':_0xd98cc4[_0x371d3f(0x1e4)][_0x371d3f(0x24a)],'action':_0x371d3f(0x1de),'error':_0x42fdc2['message']}),_0x15549f[_0x371d3f(0x1ad)][_0x371d3f(0x22d)][_0x371d3f(0x163)]++;}}return _0x15549f;}async[a96_0x221c40(0x1f0)](_0x391c83,_0xb01fea,_0x1009b2,_0x16ec86){const _0x3609e7=a96_0x221c40,{projectId:_0x5edaa3,project:_0x216834}=await this[_0x3609e7(0x1d4)](_0x391c83),_0x12fee8=_0x216834[_0x3609e7(0x1b9)][_0x3609e7(0x14a)],_0x4b9e13=await this[_0x3609e7(0x206)][_0x3609e7(0x169)](_0x5edaa3),_0x45e0eb=_0x4b9e13['find'](_0x1f5c33=>_0x1f5c33[_0x3609e7(0x1b9)][_0x3609e7(0x14a)]===_0xb01fea);if(!_0x45e0eb)throw new SDKError(ErrorCode[_0x3609e7(0x1fc)],'Agent\x20not\x20found:\x20'+_0xb01fea,undefined,{'helpText':_0x3609e7(0x13c)+_0x4b9e13[_0x3609e7(0x1d3)](_0x1e7e53=>_0x1e7e53['attributes'][_0x3609e7(0x14a)])['join'](',\x20')});let _0x6289f3;if(_0x1009b2)_0x6289f3=_0x1009b2;else{const _0x125226=a96_0x1684a2['join'](process[_0x3609e7(0x142)](),_0x3609e7(0x1dc)),_0x5aa278=getSanitizedPathWithMigration(_0x125226,_0x12fee8);_0x5aa278[_0x3609e7(0x177)]&&this[_0x3609e7(0x1c0)][_0x3609e7(0x172)](_0x3609e7(0x178)+a96_0x1684a2[_0x3609e7(0x1a6)](_0x5aa278[_0x3609e7(0x1db)])+_0x3609e7(0x1cc)+a96_0x1684a2[_0x3609e7(0x1a6)](_0x5aa278[_0x3609e7(0x1af)])),_0x6289f3=_0x5aa278['path'];}const _0x1569e7=getSanitizedPathWithMigration(_0x6289f3,_0xb01fea);_0x1569e7[_0x3609e7(0x177)]&&this['logger']['info'](_0x3609e7(0x176)+a96_0x1684a2[_0x3609e7(0x1a6)](_0x1569e7[_0x3609e7(0x1db)])+'\x20→\x20'+a96_0x1684a2[_0x3609e7(0x1a6)](_0x1569e7[_0x3609e7(0x1af)]));const _0x1c543b=_0x1569e7[_0x3609e7(0x1af)],_0x205419=new Map(),_0x39209c=new Map(),_0x5c0e43=await this[_0x3609e7(0x206)][_0x3609e7(0x234)](_0x5edaa3),_0x14dbb1=await this[_0x3609e7(0x206)][_0x3609e7(0x16f)](_0x5edaa3),_0x57f321=await this[_0x3609e7(0x206)][_0x3609e7(0x1a2)](_0x5edaa3),_0x3fd6b7=new Map(),_0xb8b8cf=new Map();for(const _0x12b7e9 of _0x5c0e43){_0x205419[_0x3609e7(0x20c)](_0x12b7e9['id'],_0x12b7e9['attributes'][_0x3609e7(0x14a)]);}for(const _0x2fc0ab of _0x14dbb1){_0x3fd6b7[_0x3609e7(0x20c)](_0x2fc0ab['id'],_0x2fc0ab[_0x3609e7(0x1b9)][_0x3609e7(0x14a)]);}for(const _0x2375ef of _0x57f321){_0xb8b8cf[_0x3609e7(0x20c)](_0x2375ef['id'],_0x2375ef[_0x3609e7(0x1b9)][_0x3609e7(0x14a)]);}for(const _0x5a9894 of _0x4b9e13){_0x39209c[_0x3609e7(0x20c)](_0x5a9894['id'],_0x5a9894[_0x3609e7(0x1b9)][_0x3609e7(0x14a)]);}const _0xc3de50={'resolveKnowledgeBaseName':async _0x5e911d=>_0x205419['get'](_0x5e911d),'resolveTextKnowledgeBaseName':async _0x1d9aee=>_0x3fd6b7[_0x3609e7(0x164)](_0x1d9aee),'resolveAgentName':async _0x446c84=>_0x39209c[_0x3609e7(0x164)](_0x446c84),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async()=>undefined,'resolveExperimentalKnowledgeBaseName':async _0xb0aa27=>_0xb8b8cf['get'](_0xb0aa27),'onWarning':_0x2f114f=>this[_0x3609e7(0x1c0)][_0x3609e7(0x1c4)](_0x2f114f)},_0x5d3201=a96_0x1684a2['join'](_0x1c543b,_0x3609e7(0x23b)),_0x2a878a=a96_0x1684a2[_0x3609e7(0x229)](_0x1c543b,'agent.yml'),_0x55c55f=a96_0x1684a2[_0x3609e7(0x229)](_0x1c543b,_0x3609e7(0x1e8)),_0x1ca95a=!a96_0x484e47[_0x3609e7(0x196)](_0x2a878a);if(_0x16ec86?.[_0x3609e7(0x226)])return{'agentName':_0xb01fea,'outputPath':_0x1c543b,'isNew':_0x1ca95a,'hasChanges':!![]};a96_0x484e47[_0x3609e7(0x203)](_0x6289f3,{'recursive':!![]}),a96_0x484e47[_0x3609e7(0x203)](_0x1c543b,{'recursive':!![]});const _0x2ed0a9=a96_0x1684a2[_0x3609e7(0x229)](_0x6289f3,_0x3609e7(0x1e5));!a96_0x484e47['existsSync'](_0x2ed0a9)&&a96_0x484e47['writeFileSync'](_0x2ed0a9,createAgentConfigContent(_0x391c83));const {yaml:_0x57169c,systemPrompt:_0x4f2c35,starterMessage:_0x120baa}=await agentResponseToDef(_0x45e0eb,_0xc3de50);let _0x1f4780=_0x1ca95a;if(!_0x1ca95a){const _0x31103e=a96_0x484e47['existsSync'](_0x5d3201)?a96_0x484e47[_0x3609e7(0x1e9)](_0x5d3201,_0x3609e7(0x17e)):'',_0x15d46f=a96_0x484e47[_0x3609e7(0x1e9)](_0x2a878a,'utf-8');_0x1f4780=_0x31103e!==_0x4f2c35||_0x15d46f!==toAgentYamlString(_0x57169c);}a96_0x484e47[_0x3609e7(0x202)](_0x5d3201,_0x4f2c35),a96_0x484e47['writeFileSync'](_0x2a878a,toAgentYamlString(_0x57169c));if(_0x120baa&&_0x120baa[_0x3609e7(0x197)]('\x0a'))a96_0x484e47[_0x3609e7(0x202)](_0x55c55f,_0x120baa);else a96_0x484e47[_0x3609e7(0x196)](_0x55c55f)&&a96_0x484e47[_0x3609e7(0x1dd)](_0x55c55f);return{'agentName':_0xb01fea,'outputPath':_0x1c543b,'isNew':_0x1ca95a,'hasChanges':_0x1f4780};}async[a96_0x221c40(0x1d0)](_0x20a5a4,_0x41227d){const _0x4946a9=a96_0x221c40;let _0x37c0d1;isAgentYamlPath(_0x20a5a4)?_0x37c0d1=getAgentDirFromYamlPath(_0x20a5a4):_0x37c0d1=_0x20a5a4;const {config:_0x5a147d}=findAgentConfig(_0x37c0d1),_0x347850=await this[_0x4946a9(0x1ec)](_0x5a147d[_0x4946a9(0x13b)]),_0x374c0d=a96_0x1684a2[_0x4946a9(0x229)](_0x37c0d1,_0x4946a9(0x1e7)),_0x3dc812=a96_0x1684a2[_0x4946a9(0x229)](_0x37c0d1,_0x4946a9(0x23b)),_0x25781=a96_0x1684a2[_0x4946a9(0x229)](_0x37c0d1,'starter_message.md');if(!a96_0x484e47[_0x4946a9(0x196)](_0x374c0d))throw new SDKError(ErrorCode['NOT_FOUND'],_0x4946a9(0x1be)+_0x37c0d1,undefined,{'helpText':_0x4946a9(0x21a)});const _0x3267eb=parseAgentYaml(a96_0x484e47[_0x4946a9(0x1e9)](_0x374c0d,'utf-8'),_0x374c0d),_0x12fd68=a96_0x484e47[_0x4946a9(0x196)](_0x3dc812)?a96_0x484e47['readFileSync'](_0x3dc812,_0x4946a9(0x17e)):'',_0x2c4f08=a96_0x484e47[_0x4946a9(0x196)](_0x25781)?a96_0x484e47['readFileSync'](_0x25781,'utf-8'):_0x3267eb[_0x4946a9(0x20b)];if(_0x41227d?.['dryRun'])return{'agentName':_0x3267eb[_0x4946a9(0x14a)],'action':_0x4946a9(0x165),'projectId':_0x347850};const _0x42f1cb=await this[_0x4946a9(0x206)][_0x4946a9(0x169)](_0x347850),_0x324083=await this[_0x4946a9(0x206)][_0x4946a9(0x234)](_0x347850),_0x3ae959=await this[_0x4946a9(0x206)][_0x4946a9(0x16f)](_0x347850),_0x21a728=await this[_0x4946a9(0x206)][_0x4946a9(0x1a2)](_0x347850),_0x45fbce=await this[_0x4946a9(0x206)]['getParentSegmentKnowledgeBase'](_0x347850),_0x4511d8=new Map(),_0x53028a=new Map(),_0x13de42=new Map(),_0x2212d7=new Map();for(const _0x54fcfc of _0x324083){_0x4511d8[_0x4946a9(0x20c)](_0x54fcfc[_0x4946a9(0x1b9)][_0x4946a9(0x14a)],_0x54fcfc['id']);}for(const _0x3e8c39 of _0x3ae959){_0x53028a['set'](_0x3e8c39[_0x4946a9(0x1b9)][_0x4946a9(0x14a)],_0x3e8c39['id']);}for(const _0x1bc1ab of _0x21a728){_0x13de42[_0x4946a9(0x20c)](_0x1bc1ab['attributes'][_0x4946a9(0x14a)],_0x1bc1ab['id']);}for(const _0x11b187 of _0x42f1cb){_0x2212d7[_0x4946a9(0x20c)](_0x11b187['attributes'][_0x4946a9(0x14a)],_0x11b187['id']);}const _0x3ee8c3=[],_0x4bea6b={'projectId':_0x347850,'resolveKnowledgeBaseId':async _0x2b8692=>_0x4511d8[_0x4946a9(0x164)](_0x2b8692),'resolveTextKnowledgeBaseId':async _0x3e7744=>_0x53028a['get'](_0x3e7744),'resolveAgentId':async _0x383eac=>_0x2212d7['get'](_0x383eac),'resolveWebSearchToolId':async()=>undefined,'resolveImageGeneratorId':async()=>undefined,'resolvePromptId':async()=>undefined,'resolveParentSegmentKBId':async()=>_0x45fbce?.['id'],'resolveExperimentalKnowledgeBaseId':async _0x26d7c9=>_0x13de42['get'](_0x26d7c9),'onWarning':_0x1619af=>{const _0x23e972=_0x4946a9;this['logger'][_0x23e972(0x1c4)](_0x1619af),_0x3ee8c3[_0x23e972(0x233)](_0x1619af);}};try{const _0x4430ab=_0x42f1cb['find'](_0x36d380=>_0x36d380[_0x4946a9(0x1b9)][_0x4946a9(0x14a)]===_0x3267eb[_0x4946a9(0x14a)]),_0x2362b8=await agentDefToRequest(_0x3267eb,_0x12fd68,_0x2c4f08,_0x4bea6b);if(_0x4430ab)return await this[_0x4946a9(0x206)][_0x4946a9(0x1d2)](_0x4430ab['id'],_0x2362b8),{'agentName':_0x3267eb[_0x4946a9(0x14a)],'action':'updated','projectId':_0x347850,'agentId':_0x4430ab['id'],'warnings':_0x3ee8c3[_0x4946a9(0x235)]>0x0?_0x3ee8c3:undefined};else{const _0x5968bf=await this[_0x4946a9(0x206)][_0x4946a9(0x175)](_0x2362b8);return{'agentName':_0x3267eb['name'],'action':_0x4946a9(0x165),'projectId':_0x347850,'agentId':_0x5968bf['id'],'warnings':_0x3ee8c3['length']>0x0?_0x3ee8c3:undefined};}}catch(_0xbfdf5b){return{'agentName':_0x3267eb[_0x4946a9(0x14a)],'action':'error','projectId':_0x347850,'error':_0xbfdf5b['message'],'warnings':_0x3ee8c3['length']>0x0?_0x3ee8c3:undefined};}}async[a96_0x221c40(0x145)](_0x5cfed0,_0x353036,_0x5a8d1f){const _0x1d6fbb=a96_0x221c40,_0x3e7330=a96_0x484e47['existsSync'](_0x5cfed0)&&a96_0x484e47[_0x1d6fbb(0x196)](a96_0x1684a2[_0x1d6fbb(0x229)](_0x5cfed0,_0x1d6fbb(0x1e5)));let _0x3c04cf;const _0x179cf5=[],_0x50140c=[],_0x2d8e73=[],_0x4f03b1=[],_0x30b73c=[],_0x3001a9=[],_0x249233=[];if(_0x3e7330){const _0x5e0a04=loadAgentConfig(a96_0x1684a2[_0x1d6fbb(0x229)](_0x5cfed0,_0x1d6fbb(0x1e5)));_0x3c04cf=_0x5e0a04[_0x1d6fbb(0x13b)];const _0x5c3cbd=a96_0x484e47[_0x1d6fbb(0x1fb)](_0x5cfed0,{'withFileTypes':!![]});for(const _0xe1c627 of _0x5c3cbd){if(!_0xe1c627[_0x1d6fbb(0x171)]())continue;if(['knowledge_bases',_0x1d6fbb(0x243),_0x1d6fbb(0x1fa),'prompts',_0x1d6fbb(0x22d)][_0x1d6fbb(0x197)](_0xe1c627['name']))continue;const _0xfc5b48=a96_0x1684a2[_0x1d6fbb(0x229)](_0x5cfed0,_0xe1c627[_0x1d6fbb(0x14a)]);if(isAgentDir(_0xfc5b48)){const _0x51c5c8=a96_0x1684a2[_0x1d6fbb(0x229)](_0xfc5b48,_0x1d6fbb(0x1e7)),_0x87668a=a96_0x1684a2[_0x1d6fbb(0x229)](_0xfc5b48,_0x1d6fbb(0x23b)),_0x4e6c0a=a96_0x1684a2[_0x1d6fbb(0x229)](_0xfc5b48,_0x1d6fbb(0x1e8)),_0x961acb=parseAgentYaml(a96_0x484e47['readFileSync'](_0x51c5c8,_0x1d6fbb(0x17e)),_0x51c5c8),_0xa1563e=a96_0x484e47[_0x1d6fbb(0x196)](_0x87668a)?a96_0x484e47[_0x1d6fbb(0x1e9)](_0x87668a,_0x1d6fbb(0x17e)):'',_0x511f4a=a96_0x484e47[_0x1d6fbb(0x196)](_0x4e6c0a)?a96_0x484e47[_0x1d6fbb(0x1e9)](_0x4e6c0a,'utf-8'):_0x961acb[_0x1d6fbb(0x20b)];_0x179cf5[_0x1d6fbb(0x233)]({'name':_0x961acb[_0x1d6fbb(0x14a)],'dir':_0xfc5b48,'yaml':_0x961acb,'systemPrompt':_0xa1563e,'starterMessage':_0x511f4a});}}const _0x16a914=getKnowledgeBasesDir(_0x5cfed0);if(a96_0x484e47[_0x1d6fbb(0x196)](_0x16a914)){const _0x47ab3b=a96_0x484e47[_0x1d6fbb(0x1fb)](_0x16a914);for(const _0x2527d0 of _0x47ab3b){const _0x585bda=a96_0x1684a2[_0x1d6fbb(0x229)](_0x16a914,_0x2527d0);if(_0x2527d0['endsWith']('.yml')){const _0x18c874=parseKnowledgeBaseYaml(a96_0x484e47[_0x1d6fbb(0x1e9)](_0x585bda,_0x1d6fbb(0x17e)),_0x585bda);_0x50140c[_0x1d6fbb(0x233)]({'name':_0x18c874['name'],'path':_0x585bda,'yaml':_0x18c874});}else{if(_0x2527d0[_0x1d6fbb(0x187)](_0x1d6fbb(0x14d))){const _0xed4202=a96_0x484e47[_0x1d6fbb(0x1e9)](_0x585bda,_0x1d6fbb(0x17e)),{name:_0x369578,text:_0x2895ab}=parseTextKnowledgeBaseMd(_0xed4202,_0x2527d0);_0x2d8e73['push']({'name':_0x369578,'path':_0x585bda,'text':_0x2895ab});}}}}const _0x5df2a4=getPromptsDir(_0x5cfed0);if(a96_0x484e47[_0x1d6fbb(0x196)](_0x5df2a4)){const _0x19397b=a96_0x484e47[_0x1d6fbb(0x1fb)](_0x5df2a4)['filter'](_0x195313=>_0x195313[_0x1d6fbb(0x187)]('.yml'));for(const _0x2f0254 of _0x19397b){const _0x2111f9=a96_0x1684a2[_0x1d6fbb(0x229)](_0x5df2a4,_0x2f0254),_0x303d98=parsePromptYaml(a96_0x484e47[_0x1d6fbb(0x1e9)](_0x2111f9,_0x1d6fbb(0x17e)),_0x2111f9);_0x4f03b1['push']({'name':_0x303d98['name'],'path':_0x2111f9,'yaml':_0x303d98});}}const _0x2fb890=getIntegrationsDir(_0x5cfed0);if(a96_0x484e47[_0x1d6fbb(0x196)](_0x2fb890)){const _0x19b216=a96_0x484e47[_0x1d6fbb(0x1fb)](_0x2fb890)[_0x1d6fbb(0x15f)](_0x3c7c19=>_0x3c7c19['endsWith'](_0x1d6fbb(0x1c2)));for(const _0x5778e6 of _0x19b216){const _0x59ea31=a96_0x1684a2[_0x1d6fbb(0x229)](_0x2fb890,_0x5778e6),_0xcc5b77=parseIntegrationYaml(a96_0x484e47[_0x1d6fbb(0x1e9)](_0x59ea31,'utf-8'),_0x59ea31);SAFE_INTEGRATION_TYPES['includes'](_0xcc5b77['service_type'][_0x1d6fbb(0x230)]())?_0x30b73c[_0x1d6fbb(0x233)]({'name':_0xcc5b77['name'],'path':_0x59ea31,'yaml':_0xcc5b77}):this[_0x1d6fbb(0x1c0)][_0x1d6fbb(0x1c4)](_0x1d6fbb(0x24f)+_0xcc5b77[_0x1d6fbb(0x14a)]+_0x1d6fbb(0x1b4)+_0xcc5b77[_0x1d6fbb(0x24a)]+_0x1d6fbb(0x1bb)+(_0x1d6fbb(0x1c3)+SAFE_INTEGRATION_TYPES['join'](',\x20')+')\x20can\x20be\x20cloned.'));}}const _0x3a6e32=getExperimentalKnowledgeBasesDir(_0x5cfed0);if(a96_0x484e47[_0x1d6fbb(0x196)](_0x3a6e32)){const _0x31d383=a96_0x484e47[_0x1d6fbb(0x1fb)](_0x3a6e32,{'withFileTypes':!![]});for(const _0x5d67dc of _0x31d383){if(!_0x5d67dc['isDirectory']())continue;const _0x11d0c2=a96_0x1684a2[_0x1d6fbb(0x229)](_0x3a6e32,_0x5d67dc[_0x1d6fbb(0x14a)]),_0x5aa2ac=a96_0x1684a2[_0x1d6fbb(0x229)](_0x11d0c2,_0x5d67dc['name']+_0x1d6fbb(0x1c2));if(a96_0x484e47[_0x1d6fbb(0x196)](_0x5aa2ac)){const _0x90faab=parseExperimentalKnowledgeBaseYaml(a96_0x484e47['readFileSync'](_0x5aa2ac,_0x1d6fbb(0x17e)),_0x5aa2ac),_0x2e3d33=a96_0x1684a2[_0x1d6fbb(0x229)](_0x11d0c2,'functions'),_0x3c5240=[];if(a96_0x484e47[_0x1d6fbb(0x196)](_0x2e3d33)){const _0x269c38=a96_0x484e47[_0x1d6fbb(0x1fb)](_0x2e3d33,{'withFileTypes':!![]});for(const _0x10e508 of _0x269c38){if(!_0x10e508['isDirectory']())continue;const _0xb81f=a96_0x1684a2[_0x1d6fbb(0x229)](_0x2e3d33,_0x10e508[_0x1d6fbb(0x14a)]),_0x13bb31=a96_0x1684a2[_0x1d6fbb(0x229)](_0xb81f,'code.js'),_0x5e2859=a96_0x1684a2[_0x1d6fbb(0x229)](_0xb81f,_0x1d6fbb(0x146));if(a96_0x484e47[_0x1d6fbb(0x196)](_0x13bb31)&&a96_0x484e47['existsSync'](_0x5e2859)){const _0x42ba12=a96_0x484e47[_0x1d6fbb(0x1e9)](_0x13bb31,_0x1d6fbb(0x17e)),_0xbcd0f=a96_0x484e47[_0x1d6fbb(0x1e9)](_0x5e2859,_0x1d6fbb(0x17e));_0x3c5240[_0x1d6fbb(0x233)]({'name':_0x10e508[_0x1d6fbb(0x14a)],'code':_0x42ba12,'json_schema':_0xbcd0f});}}}const _0x334538={..._0x90faab,'functions':_0x3c5240};_0x3001a9[_0x1d6fbb(0x233)]({'name':_0x90faab['name'],'path':_0x11d0c2,'def':_0x334538});}}}const _0x2cf62a=getExperimentalArtifactsDir(_0x5cfed0);if(a96_0x484e47[_0x1d6fbb(0x196)](_0x2cf62a)){const _0x1c7225=a96_0x484e47[_0x1d6fbb(0x1fb)](_0x2cf62a,{'withFileTypes':!![]});for(const _0x43ae9b of _0x1c7225){if(!_0x43ae9b[_0x1d6fbb(0x171)]())continue;const _0x1cc88e=a96_0x1684a2[_0x1d6fbb(0x229)](_0x2cf62a,_0x43ae9b[_0x1d6fbb(0x14a)]),_0x2fd56f=a96_0x1684a2[_0x1d6fbb(0x229)](_0x1cc88e,_0x43ae9b[_0x1d6fbb(0x14a)]+_0x1d6fbb(0x1c2));if(a96_0x484e47[_0x1d6fbb(0x196)](_0x2fd56f)){const _0x2bf66d=parseExperimentalArtifactYaml(a96_0x484e47[_0x1d6fbb(0x1e9)](_0x2fd56f,_0x1d6fbb(0x17e)),_0x2fd56f),_0x5d7a7d=a96_0x1684a2[_0x1d6fbb(0x229)](_0x1cc88e,_0x1d6fbb(0x228)),_0x155ebf=a96_0x484e47[_0x1d6fbb(0x196)](_0x5d7a7d)?a96_0x484e47[_0x1d6fbb(0x1e9)](_0x5d7a7d,_0x1d6fbb(0x17e)):'',_0xc22ec0=a96_0x1684a2['join'](_0x1cc88e,_0x1d6fbb(0x18f)),_0x26c69d=[];if(a96_0x484e47[_0x1d6fbb(0x196)](_0xc22ec0)){const _0xcc9fe6=a96_0x484e47['readdirSync'](_0xc22ec0);for(const _0x5aa6d7 of _0xcc9fe6){const _0x427140=a96_0x1684a2[_0x1d6fbb(0x229)](_0xc22ec0,_0x5aa6d7);if(a96_0x484e47[_0x1d6fbb(0x1ab)](_0x427140)['isFile']()){const _0x222b8e=a96_0x484e47[_0x1d6fbb(0x1e9)](_0x427140,_0x1d6fbb(0x17e));_0x26c69d['push']({'file_name':_0x5aa6d7,'text_content':_0x222b8e});}}}const _0x2c2011={..._0x2bf66d,'code':_0x155ebf,'files':_0x26c69d};_0x249233['push']({'name':_0x2bf66d[_0x1d6fbb(0x14a)],'path':_0x1cc88e,'def':_0x2c2011});}}}}else{const _0x3aa21c=await this[_0x1d6fbb(0x1ec)](_0x5cfed0),_0x384f37=await this['client'][_0x1d6fbb(0x237)](_0x3aa21c);_0x3c04cf=_0x384f37['attributes']['name'];const _0x1e9af1=await this['client']['listAgentsFull'](_0x3aa21c),_0x458ed7=await this[_0x1d6fbb(0x206)][_0x1d6fbb(0x234)](_0x3aa21c),_0x24f348=await this[_0x1d6fbb(0x206)][_0x1d6fbb(0x16f)](_0x3aa21c),_0x475660=await this[_0x1d6fbb(0x206)][_0x1d6fbb(0x22c)](_0x3aa21c),_0x2ca3bf=await this['client'][_0x1d6fbb(0x1a9)](_0x3aa21c),_0x2d3dcd=await this[_0x1d6fbb(0x206)][_0x1d6fbb(0x1a2)](_0x3aa21c),_0x513f83=await this[_0x1d6fbb(0x206)][_0x1d6fbb(0x1fe)](_0x3aa21c),_0x27055d=new Map(),_0x51dabd=new Map(),_0x55f9e2=new Map(),_0x3922c1=new Map(),_0x2a9129=new Map(),_0x1d4962=new Map();for(const _0x48c823 of _0x458ed7){_0x27055d[_0x1d6fbb(0x20c)](_0x48c823['id'],_0x48c823[_0x1d6fbb(0x1b9)][_0x1d6fbb(0x14a)]);}for(const _0x5a3177 of _0x24f348){_0x51dabd[_0x1d6fbb(0x20c)](_0x5a3177['id'],_0x5a3177['attributes']['name']);}for(const _0x1843d1 of _0x1e9af1){_0x55f9e2[_0x1d6fbb(0x20c)](_0x1843d1['id'],_0x1843d1[_0x1d6fbb(0x1b9)][_0x1d6fbb(0x14a)]);}for(const _0x278e6d of _0x475660){_0x3922c1[_0x1d6fbb(0x20c)](_0x278e6d['id'],_0x278e6d[_0x1d6fbb(0x1b9)][_0x1d6fbb(0x14a)]);}for(const _0x2a6c97 of _0x2d3dcd){_0x2a9129[_0x1d6fbb(0x20c)](_0x2a6c97['id'],_0x2a6c97['attributes'][_0x1d6fbb(0x14a)]);}for(const _0x3ae267 of _0x513f83){_0x1d4962['set'](_0x3ae267['id'],_0x3ae267['attributes'][_0x1d6fbb(0x14a)]);}const _0x99ad22={'resolveKnowledgeBaseName':async _0x380f9c=>_0x27055d['get'](_0x380f9c),'resolveTextKnowledgeBaseName':async _0x1c24e7=>_0x51dabd[_0x1d6fbb(0x164)](_0x1c24e7),'resolveAgentName':async _0x26832e=>_0x55f9e2[_0x1d6fbb(0x164)](_0x26832e),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async _0x30ab39=>_0x3922c1['get'](_0x30ab39),'resolveExperimentalKnowledgeBaseName':async _0x3179bd=>_0x2a9129[_0x1d6fbb(0x164)](_0x3179bd),'onWarning':_0x366c5a=>this[_0x1d6fbb(0x1c0)][_0x1d6fbb(0x1c4)](_0x366c5a)};for(const _0x10a2bc of _0x1e9af1){const _0x14f78f=await agentResponseToDef(_0x10a2bc,_0x99ad22),{yaml:_0xd330f3,systemPrompt:_0x391ec8,starterMessage:_0x477688}=_0x14f78f;_0x179cf5[_0x1d6fbb(0x233)]({'name':_0xd330f3['name'],'dir':'','yaml':_0xd330f3,'systemPrompt':_0x391ec8,'starterMessage':_0x477688});}for(const _0x3b57a5 of _0x458ed7){const _0x9f6477=apiKnowledgeBaseToYaml(_0x3b57a5);_0x50140c[_0x1d6fbb(0x233)]({'name':_0x9f6477[_0x1d6fbb(0x14a)],'path':'','yaml':_0x9f6477});}for(const _0x2b56b0 of _0x24f348){_0x2d8e73[_0x1d6fbb(0x233)]({'name':_0x2b56b0[_0x1d6fbb(0x1b9)][_0x1d6fbb(0x14a)],'path':'','text':_0x2b56b0[_0x1d6fbb(0x1b9)][_0x1d6fbb(0x1f4)]});}for(const _0x5d729e of _0x475660){const _0x5df329=await apiPromptToYaml(_0x5d729e,_0x99ad22);_0x5df329&&_0x4f03b1['push']({'name':_0x5df329[_0x1d6fbb(0x14a)],'path':'','yaml':_0x5df329});}for(const _0x366222 of _0x2ca3bf){if(!_0x366222[_0x1d6fbb(0x1b9)][_0x1d6fbb(0x184)]&&SAFE_INTEGRATION_TYPES[_0x1d6fbb(0x197)](_0x366222[_0x1d6fbb(0x1b9)][_0x1d6fbb(0x150)][_0x1d6fbb(0x230)]())){const _0x47ff8a=await apiIntegrationToYaml(_0x366222,_0x99ad22);_0x30b73c[_0x1d6fbb(0x233)]({'name':_0x366222[_0x1d6fbb(0x1b9)][_0x1d6fbb(0x150)][_0x1d6fbb(0x230)](),'path':'','yaml':_0x47ff8a});}}for(const _0x1b72eb of _0x2d3dcd){const _0x5b121c=apiExperimentalKnowledgeBaseToYaml(_0x1b72eb);_0x3001a9[_0x1d6fbb(0x233)]({'name':_0x5b121c[_0x1d6fbb(0x14a)],'path':'','def':_0x5b121c});}for(const _0x284f0a of _0x513f83){const _0x4e4e5a=apiExperimentalArtifactToYaml(_0x284f0a);_0x249233[_0x1d6fbb(0x233)]({'name':_0x4e4e5a[_0x1d6fbb(0x14a)],'path':'','def':_0x4e4e5a});}}const _0x12ffbb={'sourceProjectName':_0x3c04cf,'newProjectName':_0x353036,'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}}},_0x3287fd=await this[_0x1d6fbb(0x206)]['listProjects'](),_0x1e654f=_0x3287fd[_0x1d6fbb(0x16c)](_0x2d1126=>_0x2d1126[_0x1d6fbb(0x1b9)][_0x1d6fbb(0x14a)]===_0x353036);if(_0x1e654f)throw new SDKError(ErrorCode['ALREADY_EXISTS'],'Project\x20\x22'+_0x353036+_0x1d6fbb(0x218),undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x5a8d1f?.[_0x1d6fbb(0x226)])return _0x12ffbb['counts'][_0x1d6fbb(0x1dc)][_0x1d6fbb(0x165)]=_0x179cf5[_0x1d6fbb(0x235)],_0x12ffbb[_0x1d6fbb(0x1ad)][_0x1d6fbb(0x22e)][_0x1d6fbb(0x165)]=_0x50140c[_0x1d6fbb(0x235)],_0x12ffbb['counts'][_0x1d6fbb(0x1bc)]['created']=_0x2d8e73[_0x1d6fbb(0x235)],_0x12ffbb[_0x1d6fbb(0x1ad)][_0x1d6fbb(0x180)][_0x1d6fbb(0x165)]=_0x3001a9[_0x1d6fbb(0x235)],_0x12ffbb['counts'][_0x1d6fbb(0x192)][_0x1d6fbb(0x165)]=_0x249233['length'],_0x12ffbb['counts'][_0x1d6fbb(0x21d)][_0x1d6fbb(0x165)]=_0x4f03b1[_0x1d6fbb(0x235)],_0x12ffbb[_0x1d6fbb(0x1ad)][_0x1d6fbb(0x22d)][_0x1d6fbb(0x165)]=_0x30b73c[_0x1d6fbb(0x235)],_0x12ffbb;const _0x5cd209=await this['client'][_0x1d6fbb(0x159)]({'name':_0x353036}),_0x4b6306=_0x5cd209['id'];_0x12ffbb[_0x1d6fbb(0x1a1)]=_0x4b6306;const _0x8c4cb9=new Map(),_0x11d20c=new Map(),_0x4b3aab=new Map(),_0x1eeea9=new Map(),_0x2781e5=new Map(),_0x362cd8=new Map(),_0x2a4202=new Map(),_0x4242d7=new Map(),_0x13d77e=new Set(),_0x3e4621=new Set();for(const _0x4716ed of _0x179cf5){for(const _0x1c7d50 of _0x4716ed[_0x1d6fbb(0x1e4)][_0x1d6fbb(0x1b5)]||[]){if(_0x1c7d50[_0x1d6fbb(0x220)]===_0x1d6fbb(0x181)&&_0x1c7d50[_0x1d6fbb(0x154)]){const _0x2790b0=parseRef(_0x1c7d50[_0x1d6fbb(0x154)]);if(_0x2790b0)_0x13d77e['add'](_0x2790b0[_0x1d6fbb(0x14a)]);}else{if(_0x1c7d50[_0x1d6fbb(0x220)]===_0x1d6fbb(0x141)&&_0x1c7d50[_0x1d6fbb(0x154)]){const _0x256927=parseRef(_0x1c7d50[_0x1d6fbb(0x154)]);if(_0x256927)_0x3e4621[_0x1d6fbb(0x1ac)](_0x256927[_0x1d6fbb(0x14a)]);}}}}for(const _0x50f6d6 of _0x13d77e){try{const _0x16b7f5=await this['client'][_0x1d6fbb(0x162)]({'projectId':_0x4b6306,'name':_0x50f6d6});_0x2781e5[_0x1d6fbb(0x20c)](_0x50f6d6,_0x16b7f5['id']),_0x12ffbb[_0x1d6fbb(0x21f)][_0x1d6fbb(0x233)]({'name':_0x50f6d6,'action':'created','id':_0x16b7f5['id']}),_0x12ffbb[_0x1d6fbb(0x1ad)][_0x1d6fbb(0x21f)][_0x1d6fbb(0x165)]++;}catch(_0x243f8b){_0x12ffbb['imageGenerators']['push']({'name':_0x50f6d6,'action':_0x1d6fbb(0x1de),'error':_0x243f8b[_0x1d6fbb(0x248)]}),_0x12ffbb['counts']['imageGenerators'][_0x1d6fbb(0x163)]++;}}for(const _0x35363e of _0x3e4621){try{const _0x47bfec=await this[_0x1d6fbb(0x206)]['createWebSearchTool']({'projectId':_0x4b6306,'name':_0x35363e});_0x362cd8[_0x1d6fbb(0x20c)](_0x35363e,_0x47bfec['id']),_0x12ffbb['webSearchTools'][_0x1d6fbb(0x233)]({'name':_0x35363e,'action':'created','id':_0x47bfec['id']}),_0x12ffbb[_0x1d6fbb(0x1ad)][_0x1d6fbb(0x201)][_0x1d6fbb(0x165)]++;}catch(_0x5745e0){_0x12ffbb[_0x1d6fbb(0x201)][_0x1d6fbb(0x233)]({'name':_0x35363e,'action':'error','error':_0x5745e0[_0x1d6fbb(0x248)]}),_0x12ffbb[_0x1d6fbb(0x1ad)]['webSearchTools']['errors']++;}}const _0x37c10c=await this[_0x1d6fbb(0x206)]['getParentSegmentKnowledgeBase'](_0x4b6306);let _0x251c0a=[];const _0x24cce6={'projectId':_0x4b6306,'resolveKnowledgeBaseId':async _0x5c67ae=>_0x8c4cb9[_0x1d6fbb(0x164)](_0x5c67ae),'resolveTextKnowledgeBaseId':async _0x5047a0=>_0x11d20c[_0x1d6fbb(0x164)](_0x5047a0),'resolveExperimentalKnowledgeBaseId':async _0xb65337=>_0x2a4202[_0x1d6fbb(0x164)](_0xb65337),'resolveAgentId':async _0x47650f=>_0x4b3aab[_0x1d6fbb(0x164)](_0x47650f),'resolveWebSearchToolId':async _0x477a6c=>_0x362cd8[_0x1d6fbb(0x164)](_0x477a6c),'resolveImageGeneratorId':async _0x3b8d97=>_0x2781e5[_0x1d6fbb(0x164)](_0x3b8d97),'resolvePromptId':async _0x3f8b77=>_0x1eeea9['get'](_0x3f8b77),'resolveParentSegmentKBId':async()=>_0x37c10c?.['id'],'onWarning':_0x5dc13d=>{const _0x59a628=_0x1d6fbb;this[_0x59a628(0x1c0)][_0x59a628(0x1c4)](_0x5dc13d),_0x251c0a[_0x59a628(0x233)](_0x5dc13d);}};for(const _0x59f30d of _0x50140c){try{const _0x6d1f3=yamlKnowledgeBaseToApi(_0x59f30d['yaml'],_0x4b6306),_0x414a93=await this[_0x1d6fbb(0x206)][_0x1d6fbb(0x19c)](_0x6d1f3);_0x8c4cb9['set'](_0x59f30d[_0x1d6fbb(0x1e4)][_0x1d6fbb(0x14a)],_0x414a93['id']),_0x12ffbb['knowledgeBases'][_0x1d6fbb(0x233)]({'name':_0x59f30d[_0x1d6fbb(0x1e4)][_0x1d6fbb(0x14a)],'action':_0x1d6fbb(0x165),'id':_0x414a93['id']}),_0x12ffbb[_0x1d6fbb(0x1ad)][_0x1d6fbb(0x22e)][_0x1d6fbb(0x165)]++;}catch(_0x5ba80a){_0x12ffbb['knowledgeBases'][_0x1d6fbb(0x233)]({'name':_0x59f30d[_0x1d6fbb(0x1e4)]['name'],'action':_0x1d6fbb(0x1de),'error':_0x5ba80a['message']}),_0x12ffbb[_0x1d6fbb(0x1ad)][_0x1d6fbb(0x22e)][_0x1d6fbb(0x163)]++;}}for(const _0xcec18f of _0x2d8e73){try{const _0xf86914=yamlTextKnowledgeBaseToApi({'name':_0xcec18f[_0x1d6fbb(0x14a)],'text':_0xcec18f[_0x1d6fbb(0x1f4)]},_0x4b6306),_0x7b7659=await this[_0x1d6fbb(0x206)][_0x1d6fbb(0x1f2)](_0xf86914);_0x11d20c[_0x1d6fbb(0x20c)](_0xcec18f[_0x1d6fbb(0x14a)],_0x7b7659['id']),_0x12ffbb[_0x1d6fbb(0x1bc)]['push']({'name':_0xcec18f[_0x1d6fbb(0x14a)],'action':_0x1d6fbb(0x165),'id':_0x7b7659['id']}),_0x12ffbb[_0x1d6fbb(0x1ad)][_0x1d6fbb(0x1bc)][_0x1d6fbb(0x165)]++;}catch(_0x158960){_0x12ffbb[_0x1d6fbb(0x1bc)][_0x1d6fbb(0x233)]({'name':_0xcec18f[_0x1d6fbb(0x14a)],'action':_0x1d6fbb(0x1de),'error':_0x158960[_0x1d6fbb(0x248)]}),_0x12ffbb[_0x1d6fbb(0x1ad)][_0x1d6fbb(0x1bc)][_0x1d6fbb(0x163)]++;}}for(const _0x1e8e6b of _0x249233){try{const _0x12b0ab=yamlExperimentalArtifactToApi(_0x1e8e6b[_0x1d6fbb(0x236)],_0x4b6306),_0x13bf22=await this[_0x1d6fbb(0x206)][_0x1d6fbb(0x22a)](_0x12b0ab);_0x4242d7[_0x1d6fbb(0x20c)](_0x1e8e6b['def'][_0x1d6fbb(0x14a)],_0x13bf22['id']),_0x12ffbb[_0x1d6fbb(0x192)][_0x1d6fbb(0x233)]({'name':_0x1e8e6b[_0x1d6fbb(0x236)][_0x1d6fbb(0x14a)],'action':'created','id':_0x13bf22['id']}),_0x12ffbb['counts'][_0x1d6fbb(0x192)]['created']++;}catch(_0x1449cb){_0x12ffbb[_0x1d6fbb(0x192)][_0x1d6fbb(0x233)]({'name':_0x1e8e6b[_0x1d6fbb(0x236)][_0x1d6fbb(0x14a)],'action':'error','error':_0x1449cb[_0x1d6fbb(0x248)]}),_0x12ffbb[_0x1d6fbb(0x1ad)]['experimentalArtifacts'][_0x1d6fbb(0x163)]++;}}for(const _0x4a2faa of _0x3001a9){try{const _0x29c6d1=yamlExperimentalKnowledgeBaseToApi(_0x4a2faa['def'],_0x4b6306),_0x2012e8=await this[_0x1d6fbb(0x206)][_0x1d6fbb(0x17f)](_0x29c6d1);_0x2a4202[_0x1d6fbb(0x20c)](_0x4a2faa['def'][_0x1d6fbb(0x14a)],_0x2012e8['id']),_0x12ffbb[_0x1d6fbb(0x180)][_0x1d6fbb(0x233)]({'name':_0x4a2faa[_0x1d6fbb(0x236)][_0x1d6fbb(0x14a)],'action':_0x1d6fbb(0x165),'id':_0x2012e8['id']}),_0x12ffbb[_0x1d6fbb(0x1ad)][_0x1d6fbb(0x180)][_0x1d6fbb(0x165)]++;}catch(_0x53fbdf){_0x12ffbb['experimentalKnowledgeBases'][_0x1d6fbb(0x233)]({'name':_0x4a2faa['def']['name'],'action':_0x1d6fbb(0x1de),'error':_0x53fbdf['message']}),_0x12ffbb[_0x1d6fbb(0x1ad)][_0x1d6fbb(0x180)][_0x1d6fbb(0x163)]++;}}const _0x576be5=[..._0x179cf5]['sort']((_0x3206a6,_0xf87651)=>{const _0x4fd8ae=_0x1d6fbb,_0x213f25=_0x3206a6[_0x4fd8ae(0x1e4)][_0x4fd8ae(0x1b5)]?.[_0x4fd8ae(0x1c8)](_0x7451e6=>_0x7451e6[_0x4fd8ae(0x220)]===_0x4fd8ae(0x249))??![],_0x274764=_0xf87651[_0x4fd8ae(0x1e4)]['tools']?.[_0x4fd8ae(0x1c8)](_0xfc787e=>_0xfc787e[_0x4fd8ae(0x220)]===_0x4fd8ae(0x249))??![];if(_0x213f25&&!_0x274764)return 0x1;if(!_0x213f25&&_0x274764)return-0x1;return 0x0;});for(const _0x10eb7f of _0x576be5){_0x251c0a=[];try{const _0x5923ed=_0x10eb7f[_0x1d6fbb(0x1e4)][_0x1d6fbb(0x1b5)]?.[_0x1d6fbb(0x15f)](_0x1ebd0d=>{const _0x3f49b6=_0x1d6fbb;if(_0x1ebd0d[_0x3f49b6(0x220)]===_0x3f49b6(0x249)&&_0x1ebd0d['target']){const _0xf314a=parseRef(_0x1ebd0d['target']);return _0xf314a?.[_0x3f49b6(0x14a)]===_0x10eb7f[_0x3f49b6(0x1e4)]['name'];}return![];})??[];if(_0x5923ed[_0x1d6fbb(0x235)]>0x0){const _0x3ab32b=_0x1d6fbb(0x1a5)+_0x10eb7f[_0x1d6fbb(0x1e4)]['name']+'\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20'+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this['logger'][_0x1d6fbb(0x1c4)](_0x3ab32b),_0x251c0a[_0x1d6fbb(0x233)](_0x3ab32b);}const _0x24502e=await agentDefToRequest(_0x10eb7f[_0x1d6fbb(0x1e4)],_0x10eb7f[_0x1d6fbb(0x227)],_0x10eb7f[_0x1d6fbb(0x15e)],_0x24cce6),_0x49126f=await this[_0x1d6fbb(0x206)][_0x1d6fbb(0x175)](_0x24502e);_0x4b3aab[_0x1d6fbb(0x20c)](_0x10eb7f['yaml'][_0x1d6fbb(0x14a)],_0x49126f['id']),_0x12ffbb[_0x1d6fbb(0x1dc)][_0x1d6fbb(0x233)]({'agentName':_0x10eb7f['yaml'][_0x1d6fbb(0x14a)],'action':_0x1d6fbb(0x165),'agentId':_0x49126f['id'],'warnings':_0x251c0a[_0x1d6fbb(0x235)]>0x0?_0x251c0a:undefined}),_0x12ffbb['counts'][_0x1d6fbb(0x1dc)][_0x1d6fbb(0x165)]++;}catch(_0x4a5efe){_0x12ffbb[_0x1d6fbb(0x1dc)][_0x1d6fbb(0x233)]({'agentName':_0x10eb7f[_0x1d6fbb(0x1e4)][_0x1d6fbb(0x14a)],'action':_0x1d6fbb(0x1de),'error':_0x4a5efe['message'],'warnings':_0x251c0a['length']>0x0?_0x251c0a:undefined}),_0x12ffbb[_0x1d6fbb(0x1ad)]['agents'][_0x1d6fbb(0x163)]++;}}for(const _0x49e0b6 of _0x4f03b1){try{const _0x447251=await yamlPromptToApi(_0x49e0b6[_0x1d6fbb(0x1e4)],_0x4b6306,_0x24cce6);if(!_0x447251){_0x12ffbb[_0x1d6fbb(0x21d)][_0x1d6fbb(0x233)]({'name':_0x49e0b6['yaml']['name'],'action':'error','error':_0x1d6fbb(0x1b0)}),_0x12ffbb[_0x1d6fbb(0x1ad)][_0x1d6fbb(0x21d)]['errors']++;continue;}const _0x1ae99e=await this[_0x1d6fbb(0x206)]['createPrompt'](_0x447251);_0x1eeea9[_0x1d6fbb(0x20c)](_0x49e0b6[_0x1d6fbb(0x1e4)]['name'],_0x1ae99e['id']),_0x12ffbb[_0x1d6fbb(0x21d)]['push']({'name':_0x49e0b6[_0x1d6fbb(0x1e4)][_0x1d6fbb(0x14a)],'action':_0x1d6fbb(0x165),'id':_0x1ae99e['id']}),_0x12ffbb['counts']['prompts'][_0x1d6fbb(0x165)]++;}catch(_0x2f66b6){_0x12ffbb[_0x1d6fbb(0x21d)][_0x1d6fbb(0x233)]({'name':_0x49e0b6[_0x1d6fbb(0x1e4)][_0x1d6fbb(0x14a)],'action':_0x1d6fbb(0x1de),'error':_0x2f66b6[_0x1d6fbb(0x248)]}),_0x12ffbb[_0x1d6fbb(0x1ad)][_0x1d6fbb(0x21d)][_0x1d6fbb(0x163)]++;}}for(const _0x56f3bb of _0x30b73c){try{const _0x27f334=await yamlIntegrationToApi(_0x56f3bb[_0x1d6fbb(0x1e4)],_0x4b6306,_0x24cce6),_0x4f04f2=await this[_0x1d6fbb(0x206)][_0x1d6fbb(0x148)](_0x27f334);_0x12ffbb[_0x1d6fbb(0x22d)][_0x1d6fbb(0x233)]({'name':_0x56f3bb[_0x1d6fbb(0x1e4)]['service_type'],'action':_0x1d6fbb(0x165),'id':_0x4f04f2['id']}),_0x12ffbb[_0x1d6fbb(0x1ad)][_0x1d6fbb(0x22d)][_0x1d6fbb(0x165)]++;}catch(_0x4c0652){_0x12ffbb['integrations'][_0x1d6fbb(0x233)]({'name':_0x56f3bb[_0x1d6fbb(0x1e4)][_0x1d6fbb(0x24a)],'action':_0x1d6fbb(0x1de),'error':_0x4c0652[_0x1d6fbb(0x248)]}),_0x12ffbb[_0x1d6fbb(0x1ad)]['integrations'][_0x1d6fbb(0x163)]++;}}return _0x12ffbb;}}