@treasuredata/tdx 2026.3.6 → 2026.3.8

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 (208) hide show
  1. package/dist/bin.js +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-categories.js +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/commands/activations.js +1 -1
  6. package/dist/commands/agent-command.js +1 -1
  7. package/dist/commands/agent-test-command.js +1 -1
  8. package/dist/commands/api-command.js +1 -1
  9. package/dist/commands/auth-command.js +1 -1
  10. package/dist/commands/auth-command.js.map +1 -1
  11. package/dist/commands/auth-login-command.js +1 -1
  12. package/dist/commands/chat-command.js +1 -1
  13. package/dist/commands/claude-command.js +1 -1
  14. package/dist/commands/claude-statusline-command.js +1 -1
  15. package/dist/commands/claude-usage-command.js +1 -1
  16. package/dist/commands/command.js +1 -1
  17. package/dist/commands/connection-command.js +1 -1
  18. package/dist/commands/databases.js +1 -1
  19. package/dist/commands/delivery-command.js +1 -1
  20. package/dist/commands/describe.js +1 -1
  21. package/dist/commands/engage-campaign-pull-command.js +1 -1
  22. package/dist/commands/engage-campaign-push-command.js +1 -1
  23. package/dist/commands/engage-campaign-validate-command.js +1 -1
  24. package/dist/commands/engage-command.js +1 -1
  25. package/dist/commands/engage-template-pull-command.js +1 -1
  26. package/dist/commands/engage-template-push-command.js +1 -1
  27. package/dist/commands/engage-template-validate-command.js +1 -1
  28. package/dist/commands/job-command.js +1 -1
  29. package/dist/commands/journey-command.js +1 -1
  30. package/dist/commands/journey-validate-command.js +1 -1
  31. package/dist/commands/llm-command.js +1 -1
  32. package/dist/commands/mcp-command.js +1 -1
  33. package/dist/commands/parent-segment-command.js +1 -1
  34. package/dist/commands/profile-command.js +1 -1
  35. package/dist/commands/profiles-command.d.ts.map +1 -1
  36. package/dist/commands/profiles-command.js +1 -1
  37. package/dist/commands/profiles-command.js.map +1 -1
  38. package/dist/commands/query-command.js +1 -1
  39. package/dist/commands/schedule-command.js +1 -1
  40. package/dist/commands/segment-command.js +1 -1
  41. package/dist/commands/segment-create-command.js +1 -1
  42. package/dist/commands/segment-fields-command.js +1 -1
  43. package/dist/commands/segment-pull-command.js +1 -1
  44. package/dist/commands/segment-push-command.js +1 -1
  45. package/dist/commands/segment-update-command.js +1 -1
  46. package/dist/commands/segment-use-command.js +1 -1
  47. package/dist/commands/segment-validate-command.js +1 -1
  48. package/dist/commands/segments.js +1 -1
  49. package/dist/commands/show.js +1 -1
  50. package/dist/commands/status-command.js +1 -1
  51. package/dist/commands/tables.js +1 -1
  52. package/dist/commands/unset-command.js +1 -1
  53. package/dist/commands/upgrade-command.js +1 -1
  54. package/dist/commands/use-command.js +1 -1
  55. package/dist/commands/user-command.d.ts.map +1 -1
  56. package/dist/commands/user-command.js +1 -1
  57. package/dist/commands/user-command.js.map +1 -1
  58. package/dist/commands/workflow-command.js +1 -1
  59. package/dist/core/auth.js +1 -1
  60. package/dist/core/command-output.js +1 -1
  61. package/dist/core/config.js +1 -1
  62. package/dist/core/connection-cache.js +1 -1
  63. package/dist/core/constants.js +1 -1
  64. package/dist/core/credential-cache.js +1 -1
  65. package/dist/core/global-context.js +1 -1
  66. package/dist/core/keychain.js +1 -1
  67. package/dist/core/oauth-keychain.js +1 -1
  68. package/dist/core/oauth.d.ts.map +1 -1
  69. package/dist/core/oauth.js +1 -1
  70. package/dist/core/oauth.js.map +1 -1
  71. package/dist/core/profile.js +1 -1
  72. package/dist/core/project-config.js +1 -1
  73. package/dist/core/session.js +1 -1
  74. package/dist/core/user-cache.js +1 -1
  75. package/dist/core/version.js +1 -1
  76. package/dist/index.js +1 -1
  77. package/dist/mcp/server.js +1 -1
  78. package/dist/mcp/tools/index.js +1 -1
  79. package/dist/mcp/tools/tdx-run.js +1 -1
  80. package/dist/mcp/tools/tdx-search.js +1 -1
  81. package/dist/mcp/utils.js +1 -1
  82. package/dist/proxy/claude-usage-tracker.js +1 -1
  83. package/dist/proxy/passthrough-server.js +1 -1
  84. package/dist/proxy/sse-usage-parser.js +1 -1
  85. package/dist/sdk/agent/agent-config.js +1 -1
  86. package/dist/sdk/agent/agent-ref-parser.js +1 -1
  87. package/dist/sdk/agent/agent-yaml.js +1 -1
  88. package/dist/sdk/agent/test/evaluator.js +1 -1
  89. package/dist/sdk/agent/test/executor.js +1 -1
  90. package/dist/sdk/agent/test/index.js +1 -1
  91. package/dist/sdk/agent/test/output.js +1 -1
  92. package/dist/sdk/agent/test/parser.js +1 -1
  93. package/dist/sdk/agent/tool-target-registry.js +1 -1
  94. package/dist/sdk/api.js +1 -1
  95. package/dist/sdk/client/cdp-api-client.js +1 -1
  96. package/dist/sdk/client/delivery-api-client.js +1 -1
  97. package/dist/sdk/client/endpoints.js +1 -1
  98. package/dist/sdk/client/engage-api-client.js +1 -1
  99. package/dist/sdk/client/http-client.js +1 -1
  100. package/dist/sdk/client/llm-api-client.js +1 -1
  101. package/dist/sdk/client/oauth-refresh.js +1 -1
  102. package/dist/sdk/client/rate-limiter.js +1 -1
  103. package/dist/sdk/client/td-api-client.js +1 -1
  104. package/dist/sdk/client/trino-api-client.js +1 -1
  105. package/dist/sdk/client/workflow-client.js +1 -1
  106. package/dist/sdk/connection-validator.js +1 -1
  107. package/dist/sdk/connection.js +1 -1
  108. package/dist/sdk/delivery.js +1 -1
  109. package/dist/sdk/engage/campaign-pull.js +1 -1
  110. package/dist/sdk/engage/campaign-push.js +1 -1
  111. package/dist/sdk/engage/campaign-validator.js +1 -1
  112. package/dist/sdk/engage/campaign-yaml.js +1 -1
  113. package/dist/sdk/engage/template-pull.js +1 -1
  114. package/dist/sdk/engage/template-push.js +1 -1
  115. package/dist/sdk/engage/template-validator.js +1 -1
  116. package/dist/sdk/engage/template-yaml.js +1 -1
  117. package/dist/sdk/engage/types/campaign-def.js +1 -1
  118. package/dist/sdk/engage/types/campaign-schema.js +1 -1
  119. package/dist/sdk/engage/types/template-schema.js +1 -1
  120. package/dist/sdk/engage.js +1 -1
  121. package/dist/sdk/errors.js +1 -1
  122. package/dist/sdk/index.js +1 -1
  123. package/dist/sdk/io/index.js +1 -1
  124. package/dist/sdk/io/node-filesystem.js +1 -1
  125. package/dist/sdk/job.js +1 -1
  126. package/dist/sdk/journey.js +1 -1
  127. package/dist/sdk/llm/chat-cache.js +1 -1
  128. package/dist/sdk/llm/index.js +1 -1
  129. package/dist/sdk/llm/llm-backup-utils.js +1 -1
  130. package/dist/sdk/llm/model-factors.js +1 -1
  131. package/dist/sdk/personalization.js +1 -1
  132. package/dist/sdk/query/index.js +1 -1
  133. package/dist/sdk/query/sql-parser.js +1 -1
  134. package/dist/sdk/realtime.js +1 -1
  135. package/dist/sdk/schedule.js +1 -1
  136. package/dist/sdk/segment/child-segment-yaml.js +1 -1
  137. package/dist/sdk/segment/fields-display.js +1 -1
  138. package/dist/sdk/segment/file-discovery.js +1 -1
  139. package/dist/sdk/segment/journey-utils.js +1 -1
  140. package/dist/sdk/segment/journey-validator.js +1 -1
  141. package/dist/sdk/segment/journey-yaml.js +1 -1
  142. package/dist/sdk/segment/parent-segment-preview.js +1 -1
  143. package/dist/sdk/segment/parent-segment-yaml.js +1 -1
  144. package/dist/sdk/segment/pull-workflow.js +1 -1
  145. package/dist/sdk/segment/push-recovery.js +1 -1
  146. package/dist/sdk/segment/push-workflow.js +1 -1
  147. package/dist/sdk/segment/resolution-context.js +1 -1
  148. package/dist/sdk/segment/segment-path-parser.js +1 -1
  149. package/dist/sdk/segment/segment-ref-parser.js +1 -1
  150. package/dist/sdk/segment/segment-validator.js +1 -1
  151. package/dist/sdk/segment/target-resolution.js +1 -1
  152. package/dist/sdk/segment/tdx-config.js +1 -1
  153. package/dist/sdk/segment/types/activation-schema.js +1 -1
  154. package/dist/sdk/segment/types/journey-def.js +1 -1
  155. package/dist/sdk/segment/types/journey-schema.js +1 -1
  156. package/dist/sdk/segment/types/segment-def.js +1 -1
  157. package/dist/sdk/segment/types/segment-schema.js +1 -1
  158. package/dist/sdk/segment/validate-files.js +1 -1
  159. package/dist/sdk/segment/yaml-validator.js +1 -1
  160. package/dist/sdk/segment.js +1 -1
  161. package/dist/sdk/types/index.js +1 -1
  162. package/dist/sdk/types/progress.js +1 -1
  163. package/dist/sdk/user.js +1 -1
  164. package/dist/sdk/util/format-detector.js +1 -1
  165. package/dist/sdk/util/formatters.js +1 -1
  166. package/dist/sdk/util/index.js +1 -1
  167. package/dist/sdk/util/paginate.js +1 -1
  168. package/dist/sdk/util/tree-formatter.js +1 -1
  169. package/dist/sdk/workflow/archive-validation.js +1 -1
  170. package/dist/sdk/workflow/clone-workflow.js +1 -1
  171. package/dist/sdk/workflow/index.js +1 -1
  172. package/dist/sdk/workflow/pull-workflow.js +1 -1
  173. package/dist/sdk/workflow/push-workflow.js +1 -1
  174. package/dist/sdk/workflow/tdx-config.js +1 -1
  175. package/dist/sdk/workflow/workflow-utils.js +1 -1
  176. package/dist/test-utils/command-runner.js +1 -1
  177. package/dist/test-utils/factories.js +1 -1
  178. package/dist/test-utils/fixtures.js +1 -1
  179. package/dist/test-utils/http-mock.js +1 -1
  180. package/dist/test-utils/index.js +1 -1
  181. package/dist/utils/async.js +1 -1
  182. package/dist/utils/colors.js +1 -1
  183. package/dist/utils/diff.js +1 -1
  184. package/dist/utils/file-permissions.js +1 -1
  185. package/dist/utils/file-reader.js +1 -1
  186. package/dist/utils/github-releases.js +1 -1
  187. package/dist/utils/global-cache.js +1 -1
  188. package/dist/utils/json-loader.js +1 -1
  189. package/dist/utils/local-cache.js +1 -1
  190. package/dist/utils/logger/formatters/default-formatter.js +1 -1
  191. package/dist/utils/logger/formatters/index.js +1 -1
  192. package/dist/utils/logger/handlers/console-handler.js +1 -1
  193. package/dist/utils/logger/handlers/file-handler.js +1 -1
  194. package/dist/utils/logger/handlers/index.js +1 -1
  195. package/dist/utils/logger/handlers/null-handler.js +1 -1
  196. package/dist/utils/logger/index.js +1 -1
  197. package/dist/utils/logger/logger.js +1 -1
  198. package/dist/utils/logger/types.js +1 -1
  199. package/dist/utils/option-validation.js +1 -1
  200. package/dist/utils/process.js +1 -1
  201. package/dist/utils/prompt.js +1 -1
  202. package/dist/utils/spinner.js +1 -1
  203. package/dist/utils/sse-parser.js +1 -1
  204. package/dist/utils/string-utils.js +1 -1
  205. package/dist/utils/table-ref-parser.js +1 -1
  206. package/dist/utils/tdx-logger.js +1 -1
  207. package/dist/utils/version-check.js +1 -1
  208. package/package.json +1 -1
@@ -1 +1 @@
1
- const a122_0x49f035=a122_0x124d;(function(_0x508549,_0x15aee9){const _0x53ce47=a122_0x124d,_0x32b74f=_0x508549();while(!![]){try{const _0x1db01f=parseInt(_0x53ce47(0x178))/0x1*(parseInt(_0x53ce47(0x1c7))/0x2)+-parseInt(_0x53ce47(0x1c5))/0x3*(-parseInt(_0x53ce47(0x137))/0x4)+-parseInt(_0x53ce47(0x1a6))/0x5*(-parseInt(_0x53ce47(0xf3))/0x6)+parseInt(_0x53ce47(0x122))/0x7*(-parseInt(_0x53ce47(0x140))/0x8)+-parseInt(_0x53ce47(0x18c))/0x9*(parseInt(_0x53ce47(0x18f))/0xa)+parseInt(_0x53ce47(0x1b3))/0xb+-parseInt(_0x53ce47(0x118))/0xc*(parseInt(_0x53ce47(0xda))/0xd);if(_0x1db01f===_0x15aee9)break;else _0x32b74f['push'](_0x32b74f['shift']());}catch(_0x421345){_0x32b74f['push'](_0x32b74f['shift']());}}}(a122_0xb32a,0x22c11));import{LLMApiClient}from'../client/llm-api-client.js';import*as a122_0x48f2d8 from'node:fs';import*as a122_0x280b9 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';function a122_0x124d(_0x4d5774,_0x25371d){_0x4d5774=_0x4d5774-0xb8;const _0xb32ae3=a122_0xb32a();let _0x124df2=_0xb32ae3[_0x4d5774];return _0x124df2;}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 a122_0xb32a(){const _0x1eb893=['writeFileSync','isFile','tables','deleteIntegration','startChat','llm_project','service_type','pullAgent','Multiple\x20agents\x20found\x20with\x20name\x20\x27','currentProjectId','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','createAgent','9816Oyflnu','status','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','\x20---\x0a','Renamed\x20folder:\x20','getOrCreateDefaultProject','add','join','agents.json','oldPath','139391ZxbwZp','experimental_artifacts','client','medium','Unable\x20to\x20create\x20project\x20after\x20','NOT_FOUND','claude-4.5-sonnet','.md','integrations','deleteProject','chatWelcomeMessage','conflict','message','isManaged','readdirSync','agentId','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','.yml','Agent\x20reference\x20not\x20found','promptId','LLM_PROJECT_NOT_FOUND','8KWmMlc','integrations.json','Only\x20safe\x20types\x20(','tdDatabaseName','restoreProject','listTextKnowledgeBases','createAgentResponse','file_name','\x0a---\x20function:\x20','16XyPaFj','Renamed\x20agent\x20folder:\x20','isDirectory','agent','parse','chatId','dryRun','reasoningEffort','agents','getDefaultProjectName','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','json_schema','renamed','basename','size','functions','Backup\x20folder\x20not\x20found:\x20','content','PERMISSION_DENIED','listToolTargets','chat_parent_segment','toISOString','createKnowledgeBase','getUserSettings','\x0a\x0a#\x20agent.yml\x0a','updateTextKnowledgeBase','prompt.md','tdx_','Renamed\x20integration\x20file:\x20','listKnowledgeBases','Renamed\x20prompt\x20file:\x20','\x22\x20already\x20exists','getChatInfo','has','knowledgeBases','experimentalKnowledgeBases','starterMessage','pullProject','duplicate','projectName','keys','createPrompt','text','exportedFrom','text_content','\x0a---\x20code\x20---\x0a','availableModelNames','push','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','createTextKnowledgeBase','resolveProjectName','#\x20prompt.md\x0a','sdk.llm','tdx_default_','Renamed\x20experimental\x20KB\x20directory:\x20','none','5069DayVDv','action','projectId','listExperimentalArtifacts','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','agent.yml','Renamed\x20experimental\x20artifact\x20directory:\x20','image_gen','createExperimentalArtifact','tools','updated','slackMessageMode','includes','chatIgnoreManagedActions','starter_message.md','attributes','---\x20file:\x20','type','logger','created','36uTUNHG','listAgentsFull','getAgent','408620tYKtjF','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','prompts','resolveAgentId','map','unlinkSync','json_schema.json','chat_generic','updateExperimentalArtifact','getDefaultAgent','systemPrompt','\x27\x20(','TextKnowledgeBase','getChatHistory','updateExperimentalKnowledgeBase','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','getOrCreateDefaultAgent','loadJsonFile','maxToolIterations','):\x20','dirname','starter_message','15095nKVbtK','\x20→\x20','pushAgent','createWebSearchTool','clearDefaultAgent','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','Agent\x20\x27','experimentalArtifacts','INVALID_ARGUMENT','outputs','description','resolveProjectId','chats','701866hPoyen','event','metadata','dry-run-','availableModels','updateAgent','readFileSync',')\x20can\x20be\x20cloned.','isDir','existsSync','modelType','version','pushProject','toLowerCase','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','listPrompts','nameToId','listExperimentalKnowledgeBases','172689DnblJw','knowledge_bases','68qqlEXI','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','cwd','displayName','ALREADY_EXISTS','\x27.\x20This\x20should\x20not\x20happen.','high',')\x20can\x20be\x20pushed.\x20','Unresolved\x20dependencies:\x20','chatInfo','endsWith','UNAUTHENTICATED','total','statSync','prompts.json','name','getProject','get','errors','getChatLog','warn','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','webSearchTools','listAgents','tdx.json','Renamed\x20text\x20KB\x20file:\x20','rmSync','agentsFull','length','updatePrompt','code.js','chat_agent_console','def','createExperimentalKnowledgeBase','knowledgebases.json','createIntegration','projects','\x0a---\x20schema:\x20','sort','listWebSearchTools','jsonSchemaHint','textKnowledgeBases','updateKnowledgeBase','imageGenerators','Project\x20not\x20found:\x20','counts','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','Invalid\x20agent\x20reference\x20format:\x20','already\x20exists','4264AVPfaP','code','Removed\x20deleted\x20directory:\x20','AGENT_NOT_FOUND','find','filter','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','info','backupProject','split','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.','files','unchanged','listChats','error','some','context','stringify','utf-8','listProjects','Removed\x20deleted\x20file:\x20','chat','deleteAgent','listImageGenerators','target','522BxWThZ','serviceType','path','Skipping\x20integration\x20\x27','yaml','dir','history','updateAgentResponse','new','createImageGenerator','profile','project.json','INTERNAL','set','listIntegrations','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','localeCompare','getBackupMetadata','site','createProject','continueChat','getCurrentProject','Agent\x20not\x20found:\x20','mkdirSync','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'];a122_0xb32a=function(){return _0x1eb893;};return a122_0xb32a();}import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a122_0x49f035(0x196),a122_0x49f035(0xc8),a122_0x49f035(0x154)];async function safeListOrEmpty(_0x29c281){const _0x5eebad=a122_0x49f035;try{return await _0x29c281();}catch(_0xbf4cc0){if(_0xbf4cc0 instanceof HTTPClientError&&_0xbf4cc0[_0x5eebad(0x119)]===0x194)return[];throw _0xbf4cc0;}}export class LLMSDK{['currentProjectId'];[a122_0x49f035(0x124)];[a122_0x49f035(0xea)];[a122_0x49f035(0x18a)]=Logger['of'](a122_0x49f035(0x174));constructor(_0x45c2cf){const _0x452c28=a122_0x49f035;this[_0x452c28(0x124)]=new LLMApiClient(_0x45c2cf),this[_0x452c28(0xea)]=_0x45c2cf;}[a122_0x49f035(0x149)](){const _0x353383=a122_0x49f035,_0x2d688a=getSanitizedUsername();return _0x353383(0x175)+_0x2d688a;}async['setCurrentProject'](_0x4bc7ce){const _0x1c63d0=a122_0x49f035,{projectId:_0x5e249e}=await this[_0x1c63d0(0x172)](_0x4bc7ce);this[_0x1c63d0(0x115)]=_0x5e249e;}[a122_0x49f035(0x108)](){const _0x5940f3=a122_0x49f035;return this[_0x5940f3(0x115)];}async['setDefaultAgent'](_0x10e49c){const _0x150bad=a122_0x49f035,_0x3084b7=this[_0x150bad(0xea)]['profile'];let _0x33045b,_0x5680cd;if(_0x10e49c[_0x150bad(0x184)]('/')){const _0x375877=_0x10e49c[_0x150bad(0xe3)]('/');if(_0x375877['length']!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x150bad(0xd8)+_0x10e49c,undefined,{'helpText':_0x150bad(0x14a)});const [_0x488bbd,_0x49e19b]=_0x375877;_0x33045b=await this[_0x150bad(0x1b1)](_0x488bbd),_0x5680cd=_0x49e19b;}else _0x33045b=this[_0x150bad(0x115)]||(await this[_0x150bad(0x11d)]())['id'],_0x5680cd=_0x10e49c;const _0x20e297=await this['resolveAgentId'](_0x5680cd,_0x33045b),_0x379925=await this[_0x150bad(0x124)][_0x150bad(0x18e)](_0x20e297);writeCachedLLMAgent(_0x379925[_0x150bad(0x187)][_0x150bad(0xb8)],_0x20e297,_0x33045b,_0x3084b7);}[a122_0x49f035(0x198)](){const _0x10c8f0=a122_0x49f035,_0x5a621d=this[_0x10c8f0(0xea)][_0x10c8f0(0xfd)];return readCachedLLMAgent(_0x5a621d)||undefined;}[a122_0x49f035(0x1aa)](){const _0x301c7d=a122_0x49f035,_0x11ba2f=this[_0x301c7d(0xea)][_0x301c7d(0xfd)];clearCachedLLMAgent(_0x11ba2f);}async['models'](){const _0xc410c1=a122_0x49f035,_0x3aa0e1=await this['client'][_0xc410c1(0x157)](),_0xc08263=[];for(const _0x23e735 of _0x3aa0e1[_0xc410c1(0x16e)]){const _0x489916=_0x3aa0e1[_0xc410c1(0x1b7)][_0x23e735];_0x489916&&_0xc08263[_0xc410c1(0x16f)]({'name':_0x23e735,'displayName':_0x489916[_0xc410c1(0x1ca)]});}return _0xc08263;}async[a122_0x49f035(0x106)](_0xcadaa9){const _0x1a92de=a122_0x49f035;return await this[_0x1a92de(0x124)]['createProject'](_0xcadaa9);}async[a122_0x49f035(0x12b)](_0x379bb0){const _0x1aa417=a122_0x49f035,{projectId:_0x30f6a4}=await this[_0x1aa417(0x172)](_0x379bb0);await this[_0x1aa417(0x124)]['deleteProject'](_0x30f6a4);}async[a122_0x49f035(0xcd)](_0x3e9795=0x32){const _0x44130b=a122_0x49f035;return await this[_0x44130b(0x124)][_0x44130b(0xed)](_0x3e9795);}async['getOrCreateDefaultProject'](_0x5c25e1){const _0x314bd8=a122_0x49f035,_0x51efda=_0x5c25e1||this[_0x314bd8(0x149)](),_0x24634d=this['context'][_0x314bd8(0xfd)];if(!_0x5c25e1){const _0x48eb6c=readCachedLLMProject(_0x24634d);if(_0x48eb6c&&_0x48eb6c[_0x314bd8(0xb8)]===_0x51efda)try{const _0x3997d9=await this['client'][_0x314bd8(0xb9)](_0x48eb6c['id']);if(_0x3997d9[_0x314bd8(0x187)][_0x314bd8(0xb8)]===_0x51efda)return _0x3997d9;}catch{}}const _0x1c3a7a=await this[_0x314bd8(0x124)]['listProjects'](),_0x23f367=_0x1c3a7a[_0x314bd8(0xde)](_0x145dd8=>_0x145dd8[_0x314bd8(0x187)][_0x314bd8(0xb8)]===_0x51efda);if(_0x23f367)return!_0x5c25e1&&writeCachedLLMProject(_0x51efda,_0x23f367['id'],_0x24634d),_0x23f367;const _0x46432b=await this['client'][_0x314bd8(0x106)]({'name':_0x51efda,'description':_0x314bd8(0xe0)+getSanitizedUsername()+')'});return!_0x5c25e1&&writeCachedLLMProject(_0x51efda,_0x46432b['id'],_0x24634d),_0x46432b;}async[a122_0x49f035(0x1b1)](_0x2f9652){const _0x372dd9=a122_0x49f035,_0x585fc5=await this[_0x372dd9(0x124)][_0x372dd9(0xed)](),_0x51d415=_0x585fc5['filter'](_0x5c2110=>_0x5c2110[_0x372dd9(0x187)]['name']===_0x2f9652);if(_0x51d415[_0x372dd9(0xc5)]===0x0)throw new SDKError(ErrorCode[_0x372dd9(0x136)],'Project\x20not\x20found:\x20'+_0x2f9652,undefined,{'helpText':_0x372dd9(0xbe)});if(_0x51d415[_0x372dd9(0xc5)]>0x1)throw new SDKError(ErrorCode[_0x372dd9(0xff)],'Multiple\x20projects\x20found\x20with\x20name\x20\x27'+_0x2f9652+'\x27.\x20This\x20should\x20not\x20happen.');return _0x51d415[0x0]['id'];}async[a122_0x49f035(0x172)](_0xcfa8a){const _0xb6083f=a122_0x49f035,_0x15fd26=await this[_0xb6083f(0x124)][_0xb6083f(0xed)](),_0x427ef4=_0x15fd26[_0xb6083f(0xde)](_0x5a67e9=>_0x5a67e9[_0xb6083f(0x187)]['name']===_0xcfa8a);if(_0x427ef4)return{'projectId':_0x427ef4['id'],'project':_0x427ef4};throw new SDKError(ErrorCode[_0xb6083f(0x136)],_0xb6083f(0xd5)+_0xcfa8a,undefined,{'helpText':_0xb6083f(0xbe)});}async[a122_0x49f035(0x1a0)](_0x5aec68=a122_0x49f035(0x128),_0x2b4b07=0x0,_0x57e778){const _0x2533bd=a122_0x49f035,_0x348a1d=0xa;let _0x2685de=0x0,_0x582df8;while(_0x2685de<_0x348a1d){try{const _0x39af6b=await this[_0x2533bd(0x11d)](_0x582df8),_0x107401=_0x39af6b['id'],_0x17220e=[_0x2533bd(0x177),'minimal','low',_0x2533bd(0x125),_0x2533bd(0x1cd)],_0x42beb8=_0x2b4b07===0x0?_0x2533bd(0x15b)+_0x5aec68:_0x2533bd(0x15b)+_0x5aec68+'_reasoning_'+_0x17220e[_0x2b4b07],_0x4ba4a9=await this[_0x2533bd(0x124)][_0x2533bd(0xc0)](_0x107401),_0x3b8e23=_0x4ba4a9['find'](_0x2fc47e=>_0x2fc47e['attributes'][_0x2533bd(0xb8)]===_0x42beb8);if(_0x3b8e23)return _0x3b8e23;const _0x337980=_0x2b4b07>0x0?0x1:_0x57e778;return await this[_0x2533bd(0x124)][_0x2533bd(0x117)]({'name':_0x42beb8,'projectId':_0x107401,'modelType':_0x5aec68,'systemPrompt':'','temperature':_0x337980,'reasoningEffort':_0x2b4b07>0x0?_0x2b4b07:undefined});}catch(_0x227bb7){if(_0x227bb7 instanceof HTTPClientError){const _0x4cc85f=_0x227bb7[_0x2533bd(0x119)];if(_0x4cc85f>=0x190&&_0x4cc85f<0x1f4){if(_0x4cc85f===0x191)throw new SDKError(ErrorCode[_0x2533bd(0x1d2)],_0x2533bd(0x1c1),_0x227bb7);else{if(_0x4cc85f===0x193)throw new SDKError(ErrorCode[_0x2533bd(0x152)],_0x2533bd(0x116),_0x227bb7);}throw _0x227bb7;}}if(errorContains(_0x227bb7,_0x2533bd(0xd9),_0x2533bd(0x166),_0x2533bd(0x12d))){_0x2685de++;if(_0x2685de>=_0x348a1d)throw new SDKError(ErrorCode[_0x2533bd(0x1cb)],_0x2533bd(0x126)+_0x348a1d+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x227bb7);const _0xdf78e0=this[_0x2533bd(0x149)]();_0x582df8=_0xdf78e0+'_'+generateRandomHex();continue;}throw _0x227bb7;}}throw new SDKError(ErrorCode[_0x2533bd(0xff)],_0x2533bd(0x1ab));}async[a122_0x49f035(0x192)](_0x5613c7,_0x493fca){const _0x44ad26=a122_0x49f035,_0x16c987=_0x493fca||this[_0x44ad26(0x115)],_0x34ff21=await this[_0x44ad26(0x124)][_0x44ad26(0xc0)](_0x16c987),_0x3ff5c=_0x34ff21[_0x44ad26(0xdf)](_0x29c3cc=>_0x29c3cc[_0x44ad26(0x187)][_0x44ad26(0xb8)]===_0x5613c7);if(_0x3ff5c['length']===0x0){const _0x46dbcc=_0x16c987?'\x20in\x20project\x20'+_0x16c987:'';throw new SDKError(ErrorCode[_0x44ad26(0xdd)],'Agent\x20not\x20found:\x20'+_0x5613c7+_0x46dbcc,undefined,{'helpText':_0x16c987?_0x44ad26(0x132):_0x44ad26(0xe4)});}if(_0x3ff5c[_0x44ad26(0xc5)]>0x1)throw new SDKError(ErrorCode[_0x44ad26(0xff)],_0x44ad26(0x114)+_0x5613c7+_0x44ad26(0x1cc));return _0x3ff5c[0x0]['id'];}async['agents'](_0x5146a8){const _0x532e08=_0x5146a8||this['currentProjectId'];return await this['client']['listAgents'](_0x532e08);}async[a122_0x49f035(0xc4)](_0x495f3b){const _0x15c753=a122_0x49f035;return await this['client'][_0x15c753(0x18d)](_0x495f3b);}async['agent'](_0x4fc4be){const _0x1ccece=a122_0x49f035;return await this['client'][_0x1ccece(0x18e)](_0x4fc4be);}async[a122_0x49f035(0x117)](_0x442a13){const _0x32c3e3=a122_0x49f035;return await this[_0x32c3e3(0x124)][_0x32c3e3(0x117)](_0x442a13);}async['updateAgent'](_0x2fceb9,_0x276f5d){const _0x221e8c=a122_0x49f035;return await this[_0x221e8c(0x124)][_0x221e8c(0x1b8)](_0x2fceb9,_0x276f5d);}async[a122_0x49f035(0xf0)](_0x2aa53e){const _0x21dd2e=a122_0x49f035;await this[_0x21dd2e(0x124)]['deleteAgent'](_0x2aa53e);}async[a122_0x49f035(0x110)](_0x11de2a){const _0x3eef80=a122_0x49f035;return await this['client'][_0x3eef80(0x110)]({'agentId':_0x11de2a});}async*[a122_0x49f035(0xef)](_0x37dadf,_0x117df4){const _0x39c8ec=a122_0x49f035;let _0x164778=_0x117df4?.[_0x39c8ec(0x145)];const _0x3439a1=_0x117df4?.[_0x39c8ec(0x131)];if(!_0x164778){if(!_0x3439a1)throw new Error(_0x39c8ec(0x17c));const _0x4c16a4=await this[_0x39c8ec(0x124)][_0x39c8ec(0x110)]({'agentId':_0x3439a1});_0x164778=_0x4c16a4['id'],yield{'type':_0x39c8ec(0x1b5),'data':{'chatId':_0x164778,'agentId':_0x3439a1,'projectId':_0x4c16a4[_0x39c8ec(0x187)][_0x39c8ec(0x17a)]}};}for await(const _0x5f1813 of this[_0x39c8ec(0x124)][_0x39c8ec(0x107)](_0x164778,_0x37dadf,_0x117df4?.['signal'])){yield{'type':_0x39c8ec(0x1b4),'data':_0x5f1813};}}async[a122_0x49f035(0x1b2)](_0x249c7f=0x32){const _0x377a6b=a122_0x49f035;return await this[_0x377a6b(0x124)][_0x377a6b(0xe7)](_0x249c7f);}async[a122_0x49f035(0xf9)](_0x3a592f){const _0x38a786=a122_0x49f035;return await this['client'][_0x38a786(0x19c)](_0x3a592f);}async[a122_0x49f035(0xbc)](_0x198017){const _0x57ddb3=a122_0x49f035;return await this[_0x57ddb3(0x124)][_0x57ddb3(0xbc)](_0x198017);}async[a122_0x49f035(0x1d0)](_0x37dd7d){const _0x5ddeaf=a122_0x49f035;return await this[_0x5ddeaf(0x124)][_0x5ddeaf(0x160)](_0x37dd7d);}async[a122_0x49f035(0xe2)](_0x3fbdec,_0x14b633,_0x12d6dc){const _0x39846d=a122_0x49f035,_0x54e9d2=_0x12d6dc?.['dryRun']??![],{projectId:_0x141860,project:_0xfb3eaf}=await this[_0x39846d(0x172)](_0x3fbdec),_0x4687a0=_0xfb3eaf[_0x39846d(0x187)][_0x39846d(0xb8)],_0x4126a6=_0x14b633||_0x4687a0+'.llm';if(a122_0x48f2d8[_0x39846d(0x1bc)](_0x4126a6)&&!_0x54e9d2)throw new SDKError(ErrorCode['ALREADY_EXISTS'],'Output\x20directory\x20already\x20exists:\x20'+_0x4126a6,undefined,{'helpText':_0x39846d(0xd7)});const _0x40259b=await this[_0x39846d(0x124)]['listAgentsFull'](_0x141860),_0x1922f3=await this[_0x39846d(0x124)][_0x39846d(0x15d)](_0x141860),_0x5c53b0=await this[_0x39846d(0x124)][_0x39846d(0x1c2)](_0x141860),_0x41c6a4=await this['client']['listIntegrations'](_0x141860);if(!_0x54e9d2){a122_0x48f2d8[_0x39846d(0x10a)](_0x4126a6,{'recursive':!![]});const _0x22fca0={'version':'1.0','exportedAt':new Date()[_0x39846d(0x155)](),'exportedFrom':{'site':this[_0x39846d(0xea)]['site'],'projectId':_0x141860,'projectName':_0x4687a0},'project':_0xfb3eaf};a122_0x48f2d8['writeFileSync'](a122_0x280b9[_0x39846d(0x11f)](_0x4126a6,_0x39846d(0xfe)),JSON[_0x39846d(0xeb)](_0x22fca0,null,0x2)),a122_0x48f2d8[_0x39846d(0x10c)](a122_0x280b9[_0x39846d(0x11f)](_0x4126a6,_0x39846d(0x120)),JSON['stringify'](_0x40259b,null,0x2)),a122_0x48f2d8[_0x39846d(0x10c)](a122_0x280b9[_0x39846d(0x11f)](_0x4126a6,_0x39846d(0xcb)),JSON['stringify'](_0x1922f3,null,0x2)),a122_0x48f2d8[_0x39846d(0x10c)](a122_0x280b9[_0x39846d(0x11f)](_0x4126a6,_0x39846d(0x1d5)),JSON[_0x39846d(0xeb)](_0x5c53b0,null,0x2)),a122_0x48f2d8['writeFileSync'](a122_0x280b9[_0x39846d(0x11f)](_0x4126a6,_0x39846d(0x138)),JSON[_0x39846d(0xeb)](_0x41c6a4,null,0x2));}return{'projectName':_0x4687a0,'outputDir':_0x4126a6,'counts':{'agents':_0x40259b[_0x39846d(0xc5)],'knowledgeBases':_0x1922f3[_0x39846d(0xc5)],'prompts':_0x5c53b0[_0x39846d(0xc5)],'integrations':_0x41c6a4[_0x39846d(0xc5)]}};}async[a122_0x49f035(0x13b)](_0x2edaba,_0x14af47){const _0x160396=a122_0x49f035,_0x44bb5d=_0x14af47?.[_0x160396(0x146)]??![],_0x1f4452=this[_0x160396(0x104)](_0x2edaba),_0x5b65a2=_0x1f4452[_0x160396(0x16b)][_0x160396(0x105)],_0x2e9897=this['context'][_0x160396(0x105)],_0x4770ac=_0x5b65a2!==_0x2e9897?_0x5b65a2:undefined,_0x4a140d=this[_0x160396(0x1a1)](a122_0x280b9[_0x160396(0x11f)](_0x2edaba,_0x160396(0x120)),[]),_0x15a054=this['loadJsonFile'](a122_0x280b9[_0x160396(0x11f)](_0x2edaba,_0x160396(0xcb)),[]),_0x472a3f=this[_0x160396(0x1a1)](a122_0x280b9['join'](_0x2edaba,_0x160396(0x1d5)),[]),_0x36a6f5=this[_0x160396(0x1a1)](a122_0x280b9[_0x160396(0x11f)](_0x2edaba,_0x160396(0x138)),[]),_0x1c2717=_0x14af47?.[_0x160396(0xb8)]||_0x1f4452['exportedFrom'][_0x160396(0x167)];if(_0x44bb5d){const _0x484c0f=new Map(),_0x3a33db=[..._0x4a140d],_0x3289fa=_0x4a140d[_0x160396(0xc5)]+0x1;let _0x50acf4=0x0;while(_0x3a33db[_0x160396(0xc5)]>0x0&&_0x50acf4<_0x3289fa){_0x50acf4++;const _0x428e0b=[];for(const _0x5e5858 of _0x3a33db){canCreateAgent(_0x5e5858,_0x484c0f)?_0x484c0f[_0x160396(0x100)](_0x5e5858['id'],_0x160396(0x1b6)+_0x5e5858['id']):_0x428e0b[_0x160396(0x16f)](_0x5e5858);}if(_0x428e0b[_0x160396(0xc5)]===_0x3a33db[_0x160396(0xc5)])throw new SDKError(ErrorCode[_0x160396(0xff)],_0x160396(0x170),undefined,{'helpText':_0x160396(0x11a)});_0x3a33db[_0x160396(0xc5)]=0x0,_0x3a33db[_0x160396(0x16f)](..._0x428e0b);}const _0x58b4c5=_0x472a3f[_0x160396(0xdf)](_0x9ea3e6=>_0x484c0f[_0x160396(0x161)](_0x9ea3e6[_0x160396(0x187)][_0x160396(0x131)]))[_0x160396(0xc5)];return{'projectName':_0x1c2717,'projectId':'(dry-run)','counts':{'agents':_0x4a140d[_0x160396(0xc5)],'knowledgeBases':_0x15a054[_0x160396(0xc5)],'prompts':_0x58b4c5,'integrations':_0x36a6f5[_0x160396(0xc5)]},'sourceSite':_0x4770ac};}const _0x29cf3d=await this[_0x160396(0x124)][_0x160396(0x106)]({'name':_0x1c2717,'description':_0x1f4452['project'][_0x160396(0x187)][_0x160396(0x1b0)]}),_0x378e06=_0x29cf3d['id'],_0x44368e=new Map(),_0xf771de=new Map(),_0x59b9de=new Map();for(const _0x55d849 of _0x15a054){const _0x334611=await this[_0x160396(0x124)]['createKnowledgeBase']({'projectId':_0x378e06,'name':_0x55d849[_0x160396(0x187)][_0x160396(0xb8)],'tdDatabaseName':_0x55d849[_0x160396(0x187)][_0x160396(0x13a)],'tables':_0x55d849['attributes'][_0x160396(0x10e)]});_0x44368e[_0x160396(0x100)](_0x55d849['id'],_0x334611['id']);}const _0x26fa9e=[..._0x4a140d],_0x54acde=_0x4a140d[_0x160396(0xc5)]+0x1;let _0x470097=0x0;while(_0x26fa9e[_0x160396(0xc5)]>0x0&&_0x470097<_0x54acde){_0x470097++;const _0x1f6fa3=[];for(const _0x52f035 of _0x26fa9e){if(canCreateAgent(_0x52f035,_0xf771de)){const _0x4bb6a9=remapToolIds(_0x52f035[_0x160396(0x187)]['tools'],_0x44368e,_0xf771de),_0x311c26=remapVariableIds(_0x52f035['attributes']['variables'],_0x44368e),_0x5ddeb3=await this['client'][_0x160396(0x13d)]({'name':_0x52f035[_0x160396(0x187)][_0x160396(0xb8)],'projectId':_0x378e06,'systemPrompt':_0x52f035[_0x160396(0x187)]['systemPrompt'],'starterMessage':_0x52f035[_0x160396(0x187)][_0x160396(0x164)],'modelType':migrateModelType(_0x52f035[_0x160396(0x187)][_0x160396(0x1bd)]),'maxToolIterations':_0x52f035['attributes'][_0x160396(0x1a2)],'temperature':_0x52f035[_0x160396(0x187)]['temperature'],'reasoningEffort':_0x52f035[_0x160396(0x187)][_0x160396(0x147)],'outputs':_0x52f035[_0x160396(0x187)][_0x160396(0x1af)],'tools':_0x4bb6a9,'variables':_0x311c26});_0xf771de[_0x160396(0x100)](_0x52f035['id'],_0x5ddeb3['id']);}else _0x1f6fa3['push'](_0x52f035);}if(_0x1f6fa3[_0x160396(0xc5)]===_0x26fa9e['length'])throw new SDKError(ErrorCode[_0x160396(0xff)],_0x160396(0x170),undefined,{'helpText':_0x160396(0x11a)});_0x26fa9e['length']=0x0,_0x26fa9e[_0x160396(0x16f)](..._0x1f6fa3);}for(const _0x1f02d7 of _0x472a3f){const _0x340478=_0xf771de[_0x160396(0xba)](_0x1f02d7[_0x160396(0x187)]['agentId']);if(!_0x340478)continue;const _0x2f88e6=await this[_0x160396(0x124)][_0x160396(0x169)]({'projectId':_0x378e06,'agentId':_0x340478,'name':_0x1f02d7[_0x160396(0x187)][_0x160396(0xb8)],'systemPrompt':_0x1f02d7[_0x160396(0x187)][_0x160396(0x199)],'template':_0x1f02d7['attributes']['template'],'jsonSchemaHint':_0x1f02d7[_0x160396(0x187)][_0x160396(0xd1)]});_0x59b9de[_0x160396(0x100)](_0x1f02d7['id'],_0x2f88e6['id']);}for(const _0x148164 of _0x36a6f5){const _0x177729=_0x148164[_0x160396(0x187)]['actions'][_0x160396(0x193)](_0x35ad66=>({..._0x35ad66,'promptId':_0x59b9de[_0x160396(0xba)](_0x35ad66[_0x160396(0x135)])||_0x35ad66[_0x160396(0x135)]}));await this[_0x160396(0x124)]['createIntegration']({'projectId':_0x378e06,'serviceType':_0x148164[_0x160396(0x187)][_0x160396(0xf4)],'actions':_0x177729,'slackMessageMode':_0x148164[_0x160396(0x187)][_0x160396(0x183)],'chatIgnoreManagedActions':_0x148164[_0x160396(0x187)][_0x160396(0x185)],'chatWelcomeMessage':_0x148164['attributes'][_0x160396(0x12c)],'webhookCorsOrigins':_0x148164[_0x160396(0x187)]['webhookCorsOrigins']});}return{'projectName':_0x1c2717,'projectId':_0x378e06,'counts':{'agents':_0xf771de['size'],'knowledgeBases':_0x44368e[_0x160396(0x14e)],'prompts':_0x59b9de[_0x160396(0x14e)],'integrations':_0x36a6f5['length']},'sourceSite':_0x4770ac};}[a122_0x49f035(0x1a1)](_0x59ce04,_0x48116e){const _0x2f39d1=a122_0x49f035;if(!a122_0x48f2d8['existsSync'](_0x59ce04))return _0x48116e;return JSON[_0x2f39d1(0x144)](a122_0x48f2d8[_0x2f39d1(0x1b9)](_0x59ce04,_0x2f39d1(0xec)));}[a122_0x49f035(0x104)](_0x1fdbe3){const _0x21ef7a=a122_0x49f035;if(!a122_0x48f2d8[_0x21ef7a(0x1bc)](_0x1fdbe3))throw new SDKError(ErrorCode[_0x21ef7a(0x127)],_0x21ef7a(0x150)+_0x1fdbe3,undefined,{'helpText':'Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.'});const _0x4ac7e7=a122_0x280b9[_0x21ef7a(0x11f)](_0x1fdbe3,'project.json');if(!a122_0x48f2d8['existsSync'](_0x4ac7e7))throw new SDKError(ErrorCode[_0x21ef7a(0x1ae)],_0x21ef7a(0x190)+_0x1fdbe3,undefined,{'helpText':_0x21ef7a(0x10b)});const _0x288524=JSON[_0x21ef7a(0x144)](a122_0x48f2d8[_0x21ef7a(0x1b9)](_0x4ac7e7,_0x21ef7a(0xec)));if(!isSupportedBackupVersion(_0x288524['version']))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Unsupported\x20backup\x20version:\x20'+_0x288524[_0x21ef7a(0x1be)],undefined,{'helpText':_0x21ef7a(0x1c8)});return _0x288524;}async[a122_0x49f035(0x165)](_0x2725f1,_0x2961b3,_0x3bd781){const _0x2c3516=a122_0x49f035,{projectId:_0x29703a,project:_0x3126b6}=await this[_0x2c3516(0x172)](_0x2725f1),_0x1c06f0=_0x3126b6['attributes'][_0x2c3516(0xb8)];let _0x22f312;if(_0x2961b3)_0x22f312=_0x2961b3;else{const _0x1525a7=a122_0x280b9[_0x2c3516(0x11f)](process[_0x2c3516(0x1c9)](),_0x2c3516(0x148)),_0x5a68c6=getSanitizedPathWithMigration(_0x1525a7,_0x1c06f0);_0x5a68c6['renamed']&&this[_0x2c3516(0x18a)][_0x2c3516(0xe1)]('Renamed\x20folder:\x20'+a122_0x280b9[_0x2c3516(0x14d)](_0x5a68c6[_0x2c3516(0x121)])+_0x2c3516(0x1a7)+a122_0x280b9[_0x2c3516(0x14d)](_0x5a68c6[_0x2c3516(0xf5)])),_0x22f312=_0x5a68c6[_0x2c3516(0xf5)];}const _0x487831=await this['client'][_0x2c3516(0x18d)](_0x29703a),_0x2a24ef=await this[_0x2c3516(0x124)][_0x2c3516(0x15d)](_0x29703a),_0x1e5093=await this[_0x2c3516(0x124)]['listTextKnowledgeBases'](_0x29703a),_0x240da2=await safeListOrEmpty(()=>this['client'][_0x2c3516(0xf1)](_0x29703a)),_0x494a7e=await safeListOrEmpty(()=>this[_0x2c3516(0x124)][_0x2c3516(0xd0)](_0x29703a)),_0x5b4e43=await this['client']['listPrompts'](_0x29703a),_0x2f3050=await this[_0x2c3516(0x124)]['listIntegrations'](_0x29703a),_0x48d7fa=await safeListOrEmpty(()=>this[_0x2c3516(0x124)][_0x2c3516(0x1c4)](_0x29703a)),_0x10d29a=await safeListOrEmpty(()=>this[_0x2c3516(0x124)][_0x2c3516(0x17b)](_0x29703a)),_0x5b37dc=_0x2f3050[_0x2c3516(0xdf)](_0x24f1db=>!_0x24f1db[_0x2c3516(0x187)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x2c3516(0x184)](_0x24f1db[_0x2c3516(0x187)]['serviceType'][_0x2c3516(0x1c0)]())),_0x541158=new Map(),_0xeab56b=new Map(),_0x329c9c=new Map(),_0x1e90c8=new Map(),_0x4ee8c5=new Map(),_0x388f0a=new Map(),_0x230912=new Map();for(const _0x5a3c74 of _0x487831){_0x541158['set'](_0x5a3c74['id'],_0x5a3c74[_0x2c3516(0x187)][_0x2c3516(0xb8)]);}for(const _0x3d1548 of _0x2a24ef){_0xeab56b['set'](_0x3d1548['id'],_0x3d1548[_0x2c3516(0x187)]['name']);}for(const _0x544907 of _0x1e5093){_0x329c9c[_0x2c3516(0x100)](_0x544907['id'],_0x544907[_0x2c3516(0x187)][_0x2c3516(0xb8)]);}for(const _0x37ba50 of _0x240da2){_0x1e90c8[_0x2c3516(0x100)](_0x37ba50['id'],_0x37ba50[_0x2c3516(0x187)][_0x2c3516(0xb8)]);}for(const _0x331b29 of _0x494a7e){_0x4ee8c5[_0x2c3516(0x100)](_0x331b29['id'],_0x331b29['attributes']['name']);}for(const _0x5ab1c7 of _0x5b4e43){_0x388f0a[_0x2c3516(0x100)](_0x5ab1c7['id'],_0x5ab1c7[_0x2c3516(0x187)][_0x2c3516(0xb8)]);}for(const _0x2c4a85 of _0x48d7fa){_0x230912[_0x2c3516(0x100)](_0x2c4a85['id'],_0x2c4a85[_0x2c3516(0x187)][_0x2c3516(0xb8)]);}const _0x207006={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0xeab56b,'TextKnowledgeBase':_0x329c9c,'Agent':_0x541158,'WebSearchTool':_0x4ee8c5,'ImageGenerator':_0x1e90c8,'ExperimentalKnowledgeBase':_0x230912}),'resolvePromptName':async _0x4076bd=>_0x388f0a[_0x2c3516(0xba)](_0x4076bd),'onWarning':_0x499270=>this[_0x2c3516(0x18a)][_0x2c3516(0xbd)](_0x499270)},_0x6d9be9={'projectName':_0x1c06f0,'outputDir':_0x22f312,'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}}},_0x113109=[],_0x12fd22=[];for(const _0x3ffd7d of _0x487831){const _0x3ac356=getSanitizedPathWithMigration(_0x22f312,_0x3ffd7d[_0x2c3516(0x187)][_0x2c3516(0xb8)]);_0x3ac356[_0x2c3516(0x14c)]&&this[_0x2c3516(0x18a)][_0x2c3516(0xe1)](_0x2c3516(0x141)+a122_0x280b9['basename'](_0x3ac356[_0x2c3516(0x121)])+'\x20→\x20'+a122_0x280b9[_0x2c3516(0x14d)](_0x3ac356[_0x2c3516(0xf5)]));const _0x1975d7=_0x3ac356[_0x2c3516(0xf5)],_0x561725=a122_0x280b9['join'](_0x1975d7,_0x2c3516(0x15a)),_0x30d4f2=a122_0x280b9[_0x2c3516(0x11f)](_0x1975d7,_0x2c3516(0x17d)),_0x42f0e3=a122_0x280b9[_0x2c3516(0x11f)](_0x1975d7,'starter_message.md'),{yaml:_0x4a9cec,systemPrompt:_0x103509,starterMessage:_0x1e86de}=await agentResponseToDef(_0x3ffd7d,_0x207006),_0x202dcb=toAgentYamlString(_0x4a9cec),_0x51568f=!a122_0x48f2d8[_0x2c3516(0x1bc)](_0x30d4f2);let _0x375d1f=_0x51568f,_0x3abffa;if(!_0x51568f){const _0x39c959=a122_0x48f2d8[_0x2c3516(0x1bc)](_0x561725)?a122_0x48f2d8['readFileSync'](_0x561725,'utf-8'):'',_0x31b374=a122_0x48f2d8[_0x2c3516(0x1b9)](_0x30d4f2,_0x2c3516(0xec)),_0x41d236=_0x2c3516(0x173)+_0x39c959+_0x2c3516(0x158)+_0x31b374,_0x388ddf=_0x2c3516(0x173)+_0x103509+'\x0a\x0a#\x20agent.yml\x0a'+_0x202dcb,_0x1c0c40=generateDiff(_0x41d236,_0x388ddf);_0x375d1f=hasChanges(_0x1c0c40),_0x375d1f&&(_0x3abffa=formatDiffWithColors(_0x1c0c40));}_0x113109[_0x2c3516(0x16f)]({'path':_0x1975d7,'content':'','isDir':!![]}),_0x113109[_0x2c3516(0x16f)]({'path':_0x561725,'content':_0x103509}),_0x113109[_0x2c3516(0x16f)]({'path':_0x30d4f2,'content':_0x202dcb});_0x1e86de&&_0x1e86de[_0x2c3516(0x184)]('\x0a')&&_0x113109['push']({'path':_0x42f0e3,'content':_0x1e86de});_0x6d9be9['agents'][_0x2c3516(0x16f)]({'agentName':_0x3ffd7d[_0x2c3516(0x187)]['name'],'outputPath':_0x1975d7,'isNew':_0x51568f,'hasChanges':_0x375d1f,'diff':_0x3abffa}),_0x6d9be9[_0x2c3516(0xd6)][_0x2c3516(0x148)][_0x2c3516(0x1d3)]++;if(_0x51568f)_0x6d9be9['counts'][_0x2c3516(0x148)][_0x2c3516(0xfb)]++;else{if(_0x375d1f)_0x6d9be9[_0x2c3516(0xd6)][_0x2c3516(0x148)]['updated']++;else _0x6d9be9[_0x2c3516(0xd6)][_0x2c3516(0x148)][_0x2c3516(0xe6)]++;}}for(const _0x55226b of _0x2a24ef){if(_0x55226b[_0x2c3516(0x187)][_0x2c3516(0x12f)])continue;const _0x2589e6=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x22f312),_0x55226b['attributes'][_0x2c3516(0xb8)],_0x2c3516(0x133));_0x2589e6['renamed']&&this['logger'][_0x2c3516(0xe1)]('Renamed\x20KB\x20file:\x20'+a122_0x280b9[_0x2c3516(0x14d)](_0x2589e6[_0x2c3516(0x121)])+'\x20→\x20'+a122_0x280b9[_0x2c3516(0x14d)](_0x2589e6[_0x2c3516(0xf5)]));const _0x12a27b=_0x2589e6[_0x2c3516(0xf5)],_0x42fd47=apiKnowledgeBaseToYaml(_0x55226b),_0x16b60c=toKnowledgeBaseYamlString(_0x42fd47),_0x28453e=!a122_0x48f2d8[_0x2c3516(0x1bc)](_0x12a27b);let _0x5131c2=_0x28453e,_0x2f1d3b;if(!_0x28453e){const _0x368c67=a122_0x48f2d8[_0x2c3516(0x1b9)](_0x12a27b,_0x2c3516(0xec)),_0x1a013d=generateDiff(_0x368c67,_0x16b60c);_0x5131c2=hasChanges(_0x1a013d),_0x5131c2&&(_0x2f1d3b=formatDiffWithColors(_0x1a013d));}_0x113109['push']({'path':_0x12a27b,'content':_0x16b60c}),_0x6d9be9[_0x2c3516(0x162)][_0x2c3516(0x16f)]({'name':_0x55226b['attributes']['name'],'outputPath':_0x12a27b,'isNew':_0x28453e,'hasChanges':_0x5131c2,'diff':_0x2f1d3b}),_0x6d9be9['counts'][_0x2c3516(0x162)][_0x2c3516(0x1d3)]++;if(_0x28453e)_0x6d9be9[_0x2c3516(0xd6)][_0x2c3516(0x162)][_0x2c3516(0xfb)]++;else{if(_0x5131c2)_0x6d9be9[_0x2c3516(0xd6)][_0x2c3516(0x162)][_0x2c3516(0x182)]++;else _0x6d9be9[_0x2c3516(0xd6)]['knowledgeBases'][_0x2c3516(0xe6)]++;}}for(const _0x125771 of _0x1e5093){if(_0x125771[_0x2c3516(0x187)][_0x2c3516(0x12f)])continue;const _0x157020=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x22f312),_0x125771[_0x2c3516(0x187)][_0x2c3516(0xb8)],_0x2c3516(0x129));_0x157020[_0x2c3516(0x14c)]&&this[_0x2c3516(0x18a)][_0x2c3516(0xe1)](_0x2c3516(0xc2)+a122_0x280b9[_0x2c3516(0x14d)](_0x157020[_0x2c3516(0x121)])+_0x2c3516(0x1a7)+a122_0x280b9[_0x2c3516(0x14d)](_0x157020[_0x2c3516(0xf5)]));const _0x1af04c=_0x157020[_0x2c3516(0xf5)],_0xc0d9a3=toTextKnowledgeBaseMd(_0x125771[_0x2c3516(0x187)][_0x2c3516(0xb8)],_0x125771['attributes'][_0x2c3516(0x16a)]),_0x39bb0c=!a122_0x48f2d8[_0x2c3516(0x1bc)](_0x1af04c);let _0x1d0d9f=_0x39bb0c,_0x545be6;if(!_0x39bb0c){const _0x59d9bd=a122_0x48f2d8[_0x2c3516(0x1b9)](_0x1af04c,_0x2c3516(0xec)),_0x27935e=generateDiff(_0x59d9bd,_0xc0d9a3);_0x1d0d9f=hasChanges(_0x27935e),_0x1d0d9f&&(_0x545be6=formatDiffWithColors(_0x27935e));}_0x113109[_0x2c3516(0x16f)]({'path':_0x1af04c,'content':_0xc0d9a3}),_0x6d9be9[_0x2c3516(0xd2)]['push']({'name':_0x125771[_0x2c3516(0x187)][_0x2c3516(0xb8)],'outputPath':_0x1af04c,'isNew':_0x39bb0c,'hasChanges':_0x1d0d9f,'diff':_0x545be6}),_0x6d9be9[_0x2c3516(0xd6)][_0x2c3516(0xd2)]['total']++;if(_0x39bb0c)_0x6d9be9[_0x2c3516(0xd6)][_0x2c3516(0xd2)][_0x2c3516(0xfb)]++;else{if(_0x1d0d9f)_0x6d9be9[_0x2c3516(0xd6)][_0x2c3516(0xd2)][_0x2c3516(0x182)]++;else _0x6d9be9[_0x2c3516(0xd6)][_0x2c3516(0xd2)]['unchanged']++;}}for(const _0x36eecc of _0x5b4e43){if(_0x36eecc[_0x2c3516(0x187)][_0x2c3516(0x12f)])continue;const _0x420165=getSanitizedPathWithMigration(getPromptsDir(_0x22f312),_0x36eecc[_0x2c3516(0x187)][_0x2c3516(0xb8)],_0x2c3516(0x133));_0x420165[_0x2c3516(0x14c)]&&this[_0x2c3516(0x18a)][_0x2c3516(0xe1)](_0x2c3516(0x15e)+a122_0x280b9[_0x2c3516(0x14d)](_0x420165['oldPath'])+_0x2c3516(0x1a7)+a122_0x280b9[_0x2c3516(0x14d)](_0x420165[_0x2c3516(0xf5)]));const _0x5735f8=_0x420165[_0x2c3516(0xf5)],_0x5b8a8c=await apiPromptToYaml(_0x36eecc,_0x207006);if(!_0x5b8a8c)continue;const _0xd86048=toPromptYamlString(_0x5b8a8c),_0x232817=!a122_0x48f2d8[_0x2c3516(0x1bc)](_0x5735f8);let _0x4e7d77=_0x232817,_0x14e2a2;if(!_0x232817){const _0x296a8a=a122_0x48f2d8[_0x2c3516(0x1b9)](_0x5735f8,'utf-8'),_0x1e4910=generateDiff(_0x296a8a,_0xd86048);_0x4e7d77=hasChanges(_0x1e4910),_0x4e7d77&&(_0x14e2a2=formatDiffWithColors(_0x1e4910));}_0x113109['push']({'path':_0x5735f8,'content':_0xd86048}),_0x6d9be9[_0x2c3516(0x191)]['push']({'name':_0x36eecc[_0x2c3516(0x187)][_0x2c3516(0xb8)],'outputPath':_0x5735f8,'isNew':_0x232817,'hasChanges':_0x4e7d77,'diff':_0x14e2a2}),_0x6d9be9['counts'][_0x2c3516(0x191)][_0x2c3516(0x1d3)]++;if(_0x232817)_0x6d9be9[_0x2c3516(0xd6)][_0x2c3516(0x191)][_0x2c3516(0xfb)]++;else{if(_0x4e7d77)_0x6d9be9[_0x2c3516(0xd6)][_0x2c3516(0x191)][_0x2c3516(0x182)]++;else _0x6d9be9[_0x2c3516(0xd6)][_0x2c3516(0x191)][_0x2c3516(0xe6)]++;}}for(const _0x2dfe2e of _0x5b37dc){const _0x2357d8=_0x2dfe2e[_0x2c3516(0x187)][_0x2c3516(0xf4)][_0x2c3516(0x1c0)](),_0x23229a=getSanitizedPathWithMigration(getIntegrationsDir(_0x22f312),_0x2357d8,'.yml');_0x23229a[_0x2c3516(0x14c)]&&this[_0x2c3516(0x18a)][_0x2c3516(0xe1)](_0x2c3516(0x15c)+a122_0x280b9[_0x2c3516(0x14d)](_0x23229a[_0x2c3516(0x121)])+_0x2c3516(0x1a7)+a122_0x280b9[_0x2c3516(0x14d)](_0x23229a[_0x2c3516(0xf5)]));const _0x9bf9a=_0x23229a['path'],_0xd4c4f2=await apiIntegrationToYaml(_0x2dfe2e,_0x207006),_0x23ac9e=toIntegrationYamlString(_0xd4c4f2),_0x2fb548=!a122_0x48f2d8['existsSync'](_0x9bf9a);let _0x5f4304=_0x2fb548,_0x1620aa;if(!_0x2fb548){const _0xb82943=a122_0x48f2d8[_0x2c3516(0x1b9)](_0x9bf9a,_0x2c3516(0xec)),_0xe245e4=generateDiff(_0xb82943,_0x23ac9e);_0x5f4304=hasChanges(_0xe245e4),_0x5f4304&&(_0x1620aa=formatDiffWithColors(_0xe245e4));}_0x113109[_0x2c3516(0x16f)]({'path':_0x9bf9a,'content':_0x23ac9e}),_0x6d9be9[_0x2c3516(0x12a)]['push']({'name':_0x2357d8,'outputPath':_0x9bf9a,'isNew':_0x2fb548,'hasChanges':_0x5f4304,'diff':_0x1620aa}),_0x6d9be9[_0x2c3516(0xd6)]['integrations'][_0x2c3516(0x1d3)]++;if(_0x2fb548)_0x6d9be9['counts'][_0x2c3516(0x12a)][_0x2c3516(0xfb)]++;else{if(_0x5f4304)_0x6d9be9[_0x2c3516(0xd6)][_0x2c3516(0x12a)][_0x2c3516(0x182)]++;else _0x6d9be9[_0x2c3516(0xd6)][_0x2c3516(0x12a)]['unchanged']++;}}for(const _0x21b65c of _0x48d7fa){if(_0x21b65c[_0x2c3516(0x187)][_0x2c3516(0x12f)])continue;const _0x28f5fd=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x22f312),_0x21b65c[_0x2c3516(0x187)][_0x2c3516(0xb8)]);_0x28f5fd['renamed']&&this[_0x2c3516(0x18a)][_0x2c3516(0xe1)](_0x2c3516(0x176)+a122_0x280b9['basename'](_0x28f5fd[_0x2c3516(0x121)])+_0x2c3516(0x1a7)+a122_0x280b9[_0x2c3516(0x14d)](_0x28f5fd[_0x2c3516(0xf5)]));const _0xfdb137=_0x28f5fd[_0x2c3516(0xf5)],_0x3f2035=a122_0x280b9[_0x2c3516(0x11f)](_0xfdb137,sanitizeForFilesystem(_0x21b65c['attributes'][_0x2c3516(0xb8)])+_0x2c3516(0x133)),_0x63747c=a122_0x280b9[_0x2c3516(0x11f)](_0xfdb137,'functions'),_0x25bddb=apiExperimentalKnowledgeBaseToYaml(_0x21b65c),_0x319b41=toExperimentalKnowledgeBaseYamlString(_0x25bddb),_0x2c6496=!a122_0x48f2d8[_0x2c3516(0x1bc)](_0xfdb137);let _0x6bee28=_0x2c6496,_0x521a72,_0x3caf9f=_0x319b41;const _0x39c3c4=[..._0x25bddb[_0x2c3516(0x14f)]][_0x2c3516(0xcf)]((_0x2b5afe,_0x6884fa)=>_0x2b5afe[_0x2c3516(0xb8)][_0x2c3516(0x103)](_0x6884fa['name']));for(const _0x3600de of _0x39c3c4){_0x3caf9f+=_0x2c3516(0x13f)+_0x3600de['name']+_0x2c3516(0x11b)+_0x3600de[_0x2c3516(0xdb)]+_0x2c3516(0xce)+_0x3600de[_0x2c3516(0xb8)]+_0x2c3516(0x11b)+_0x3600de[_0x2c3516(0x14b)]+'\x0a';}if(!_0x2c6496){let _0x1ff1b6='';a122_0x48f2d8['existsSync'](_0x3f2035)&&(_0x1ff1b6=a122_0x48f2d8[_0x2c3516(0x1b9)](_0x3f2035,_0x2c3516(0xec)));if(a122_0x48f2d8[_0x2c3516(0x1bc)](_0x63747c)){const _0x113ae9=a122_0x48f2d8[_0x2c3516(0x130)](_0x63747c,{'withFileTypes':!![]}),_0x3684d3=_0x113ae9[_0x2c3516(0xdf)](_0xe26705=>_0xe26705[_0x2c3516(0x142)]())[_0x2c3516(0xcf)]((_0x2e16e5,_0x2dc366)=>_0x2e16e5[_0x2c3516(0xb8)]['localeCompare'](_0x2dc366[_0x2c3516(0xb8)]));for(const _0x454e63 of _0x3684d3){const _0x346cd3=a122_0x280b9[_0x2c3516(0x11f)](_0x63747c,_0x454e63[_0x2c3516(0xb8)],'code.js'),_0x561c88=a122_0x280b9['join'](_0x63747c,_0x454e63[_0x2c3516(0xb8)],'json_schema.json');a122_0x48f2d8[_0x2c3516(0x1bc)](_0x346cd3)&&(_0x1ff1b6+=_0x2c3516(0x13f)+_0x454e63[_0x2c3516(0xb8)]+'\x20---\x0a'+a122_0x48f2d8[_0x2c3516(0x1b9)](_0x346cd3,_0x2c3516(0xec))+'\x0a'),a122_0x48f2d8[_0x2c3516(0x1bc)](_0x561c88)&&(_0x1ff1b6+='---\x20schema:\x20'+_0x454e63[_0x2c3516(0xb8)]+_0x2c3516(0x11b)+a122_0x48f2d8['readFileSync'](_0x561c88,'utf-8')+'\x0a');}}const _0x5a18d4=generateDiff(_0x1ff1b6,_0x3caf9f);_0x6bee28=hasChanges(_0x5a18d4),_0x6bee28&&(_0x521a72=formatDiffWithColors(_0x5a18d4));}_0x113109[_0x2c3516(0x16f)]({'path':_0xfdb137,'content':'','isDir':!![]}),_0x113109[_0x2c3516(0x16f)]({'path':_0x3f2035,'content':_0x319b41}),_0x113109[_0x2c3516(0x16f)]({'path':_0x63747c,'content':'','isDir':!![]});for(const _0x18e6fe of _0x25bddb['functions']){const _0xe8da52=a122_0x280b9[_0x2c3516(0x11f)](_0x63747c,sanitizeForFilesystem(_0x18e6fe[_0x2c3516(0xb8)])),_0x1ff681=a122_0x280b9[_0x2c3516(0x11f)](_0xe8da52,_0x2c3516(0xc7)),_0x599336=a122_0x280b9[_0x2c3516(0x11f)](_0xe8da52,'json_schema.json');_0x113109[_0x2c3516(0x16f)]({'path':_0xe8da52,'content':'','isDir':!![]}),_0x113109[_0x2c3516(0x16f)]({'path':_0x1ff681,'content':_0x18e6fe[_0x2c3516(0xdb)]}),_0x113109[_0x2c3516(0x16f)]({'path':_0x599336,'content':_0x18e6fe[_0x2c3516(0x14b)]});}if(a122_0x48f2d8[_0x2c3516(0x1bc)](_0x63747c)){const _0x22099a=a122_0x48f2d8[_0x2c3516(0x130)](_0x63747c,{'withFileTypes':!![]}),_0x26ea9a=new Set(_0x25bddb['functions'][_0x2c3516(0x193)](_0x3a16bc=>sanitizeForFilesystem(_0x3a16bc['name'])));for(const _0x10fce7 of _0x22099a){if(_0x10fce7[_0x2c3516(0x142)]()&&!_0x26ea9a[_0x2c3516(0x161)](_0x10fce7['name'])){const _0x14f387=a122_0x280b9['join'](_0x63747c,_0x10fce7['name']);_0x12fd22['push']({'path':_0x14f387,'isDir':!![]});}}}_0x6d9be9[_0x2c3516(0x163)][_0x2c3516(0x16f)]({'name':_0x21b65c[_0x2c3516(0x187)][_0x2c3516(0xb8)],'outputPath':_0xfdb137,'isNew':_0x2c6496,'hasChanges':_0x6bee28,'diff':_0x521a72}),_0x6d9be9[_0x2c3516(0xd6)]['experimentalKnowledgeBases'][_0x2c3516(0x1d3)]++;if(_0x2c6496)_0x6d9be9[_0x2c3516(0xd6)][_0x2c3516(0x163)][_0x2c3516(0xfb)]++;else{if(_0x6bee28)_0x6d9be9[_0x2c3516(0xd6)]['experimentalKnowledgeBases'][_0x2c3516(0x182)]++;else _0x6d9be9[_0x2c3516(0xd6)][_0x2c3516(0x163)][_0x2c3516(0xe6)]++;}}for(const _0x4e2e8a of _0x10d29a){if(_0x4e2e8a[_0x2c3516(0x187)][_0x2c3516(0x12f)])continue;const _0x97a43e=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x22f312),_0x4e2e8a['attributes']['name']);_0x97a43e[_0x2c3516(0x14c)]&&this[_0x2c3516(0x18a)][_0x2c3516(0xe1)](_0x2c3516(0x17e)+a122_0x280b9[_0x2c3516(0x14d)](_0x97a43e[_0x2c3516(0x121)])+_0x2c3516(0x1a7)+a122_0x280b9[_0x2c3516(0x14d)](_0x97a43e['path']));const _0x265d53=_0x97a43e['path'],_0x2887f2=a122_0x280b9[_0x2c3516(0x11f)](_0x265d53,sanitizeForFilesystem(_0x4e2e8a[_0x2c3516(0x187)][_0x2c3516(0xb8)])+_0x2c3516(0x133)),_0x423fc3=a122_0x280b9[_0x2c3516(0x11f)](_0x265d53,'code.js'),_0x58f7f0=a122_0x280b9['join'](_0x265d53,_0x2c3516(0xe5)),_0x51a39d=apiExperimentalArtifactToYaml(_0x4e2e8a),_0x137c91=toExperimentalArtifactYamlString(_0x51a39d),_0x43830c=!a122_0x48f2d8[_0x2c3516(0x1bc)](_0x265d53);let _0x456b67=_0x43830c,_0x132f67,_0x31bfbd=_0x137c91+(_0x2c3516(0x16d)+_0x51a39d[_0x2c3516(0xdb)]+'\x0a');const _0x959483=[..._0x51a39d['files']]['sort']((_0x3195ff,_0x175772)=>_0x3195ff[_0x2c3516(0x13e)][_0x2c3516(0x103)](_0x175772['file_name']));for(const _0x37f382 of _0x959483){_0x31bfbd+=_0x2c3516(0x188)+_0x37f382[_0x2c3516(0x13e)]+_0x2c3516(0x11b)+_0x37f382[_0x2c3516(0x16c)]+'\x0a';}if(!_0x43830c){let _0x5524cd='';a122_0x48f2d8[_0x2c3516(0x1bc)](_0x2887f2)&&(_0x5524cd=a122_0x48f2d8[_0x2c3516(0x1b9)](_0x2887f2,_0x2c3516(0xec)));a122_0x48f2d8[_0x2c3516(0x1bc)](_0x423fc3)&&(_0x5524cd+=_0x2c3516(0x16d)+a122_0x48f2d8[_0x2c3516(0x1b9)](_0x423fc3,_0x2c3516(0xec))+'\x0a');if(a122_0x48f2d8[_0x2c3516(0x1bc)](_0x58f7f0)){const _0x4e3537=a122_0x48f2d8[_0x2c3516(0x130)](_0x58f7f0),_0x46e14a=_0x4e3537['filter'](_0x1c18c3=>{const _0x1cefd2=_0x2c3516,_0x39f6ae=a122_0x280b9['join'](_0x58f7f0,_0x1c18c3);return a122_0x48f2d8[_0x1cefd2(0x1d4)](_0x39f6ae)[_0x1cefd2(0x10d)]();})[_0x2c3516(0xcf)]((_0x38c65f,_0x1bb466)=>_0x38c65f[_0x2c3516(0x103)](_0x1bb466));for(const _0x3ad44f of _0x46e14a){const _0x20e73d=a122_0x280b9[_0x2c3516(0x11f)](_0x58f7f0,_0x3ad44f);_0x5524cd+='---\x20file:\x20'+_0x3ad44f+_0x2c3516(0x11b)+a122_0x48f2d8[_0x2c3516(0x1b9)](_0x20e73d,_0x2c3516(0xec))+'\x0a';}}const _0x566780=generateDiff(_0x5524cd,_0x31bfbd);_0x456b67=hasChanges(_0x566780),_0x456b67&&(_0x132f67=formatDiffWithColors(_0x566780));}_0x113109[_0x2c3516(0x16f)]({'path':_0x265d53,'content':'','isDir':!![]}),_0x113109[_0x2c3516(0x16f)]({'path':_0x2887f2,'content':_0x137c91}),_0x113109[_0x2c3516(0x16f)]({'path':_0x423fc3,'content':_0x51a39d[_0x2c3516(0xdb)]});if(_0x51a39d['files'][_0x2c3516(0xc5)]>0x0){_0x113109[_0x2c3516(0x16f)]({'path':_0x58f7f0,'content':'','isDir':!![]});for(const _0x4bd5fe of _0x51a39d[_0x2c3516(0xe5)]){const _0x86373f=a122_0x280b9[_0x2c3516(0x11f)](_0x58f7f0,_0x4bd5fe[_0x2c3516(0x13e)]);_0x113109['push']({'path':_0x86373f,'content':_0x4bd5fe[_0x2c3516(0x16c)]});}}if(a122_0x48f2d8[_0x2c3516(0x1bc)](_0x58f7f0)){const _0x26f883=a122_0x48f2d8[_0x2c3516(0x130)](_0x58f7f0),_0x318504=new Set(_0x51a39d[_0x2c3516(0xe5)][_0x2c3516(0x193)](_0x33caf3=>_0x33caf3[_0x2c3516(0x13e)]));for(const _0x25aabd of _0x26f883){const _0x23039d=a122_0x280b9['join'](_0x58f7f0,_0x25aabd);a122_0x48f2d8['statSync'](_0x23039d)[_0x2c3516(0x10d)]()&&!_0x318504[_0x2c3516(0x161)](_0x25aabd)&&_0x12fd22[_0x2c3516(0x16f)]({'path':_0x23039d});}}_0x6d9be9[_0x2c3516(0x1ad)][_0x2c3516(0x16f)]({'name':_0x4e2e8a[_0x2c3516(0x187)][_0x2c3516(0xb8)],'outputPath':_0x265d53,'isNew':_0x43830c,'hasChanges':_0x456b67,'diff':_0x132f67}),_0x6d9be9['counts']['experimentalArtifacts'][_0x2c3516(0x1d3)]++;if(_0x43830c)_0x6d9be9[_0x2c3516(0xd6)]['experimentalArtifacts'][_0x2c3516(0xfb)]++;else{if(_0x456b67)_0x6d9be9['counts'][_0x2c3516(0x1ad)]['updated']++;else _0x6d9be9[_0x2c3516(0xd6)][_0x2c3516(0x1ad)]['unchanged']++;}}if(_0x3bd781?.[_0x2c3516(0x146)])return _0x6d9be9;a122_0x48f2d8[_0x2c3516(0x10a)](_0x22f312,{'recursive':!![]}),a122_0x48f2d8['mkdirSync'](getKnowledgeBasesDir(_0x22f312),{'recursive':!![]}),a122_0x48f2d8[_0x2c3516(0x10a)](getPromptsDir(_0x22f312),{'recursive':!![]}),a122_0x48f2d8['mkdirSync'](getIntegrationsDir(_0x22f312),{'recursive':!![]}),a122_0x48f2d8['mkdirSync'](getExperimentalKnowledgeBasesDir(_0x22f312),{'recursive':!![]}),a122_0x48f2d8[_0x2c3516(0x10a)](getExperimentalArtifactsDir(_0x22f312),{'recursive':!![]});const _0x1da117=a122_0x280b9['join'](_0x22f312,_0x2c3516(0xc1));a122_0x48f2d8[_0x2c3516(0x10c)](_0x1da117,createAgentConfigContent(_0x1c06f0));for(const _0x5a48a2 of _0x113109){if(_0x5a48a2[_0x2c3516(0x1bb)])a122_0x48f2d8[_0x2c3516(0x10a)](_0x5a48a2[_0x2c3516(0xf5)],{'recursive':!![]});else{const _0x3c3b1c=a122_0x280b9[_0x2c3516(0x1a4)](_0x5a48a2['path']);!a122_0x48f2d8[_0x2c3516(0x1bc)](_0x3c3b1c)&&a122_0x48f2d8[_0x2c3516(0x10a)](_0x3c3b1c,{'recursive':!![]}),a122_0x48f2d8[_0x2c3516(0x10c)](_0x5a48a2[_0x2c3516(0xf5)],_0x5a48a2[_0x2c3516(0x151)]);}}for(const _0x1660d3 of _0x12fd22){_0x1660d3[_0x2c3516(0x1bb)]?(a122_0x48f2d8[_0x2c3516(0xc3)](_0x1660d3[_0x2c3516(0xf5)],{'recursive':!![],'force':!![]}),this['logger'][_0x2c3516(0xe1)](_0x2c3516(0xdc)+a122_0x280b9[_0x2c3516(0x14d)](a122_0x280b9[_0x2c3516(0x1a4)](_0x1660d3[_0x2c3516(0xf5)]))+'/'+a122_0x280b9[_0x2c3516(0x14d)](_0x1660d3[_0x2c3516(0xf5)]))):(a122_0x48f2d8['rmSync'](_0x1660d3[_0x2c3516(0xf5)],{'force':!![]}),this[_0x2c3516(0x18a)]['info'](_0x2c3516(0xee)+a122_0x280b9['basename'](a122_0x280b9[_0x2c3516(0x1a4)](_0x1660d3[_0x2c3516(0xf5)]))+'/'+a122_0x280b9['basename'](_0x1660d3['path'])));}return _0x6d9be9;}async[a122_0x49f035(0x1bf)](_0x427194,_0x175728){const _0x512747=a122_0x49f035,_0x566c1b=a122_0x280b9[_0x512747(0x11f)](_0x427194,_0x512747(0xc1));if(!a122_0x48f2d8[_0x512747(0x1bc)](_0x566c1b))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'No\x20tdx.json\x20found\x20in\x20'+_0x427194,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x430e22=loadAgentConfig(_0x566c1b),_0x33c93b=await this[_0x512747(0x1b1)](_0x430e22[_0x512747(0x111)]),_0x4b1bec=await this[_0x512747(0x124)][_0x512747(0xb9)](_0x33c93b),_0xfbca33=_0x4b1bec['attributes']['name'],_0x51e320={'projectName':_0xfbca33,'projectId':_0x33c93b,'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}}},_0x51b88a=[],_0x3cf47d=[],_0x2e4f20=[],_0x56e6bc=[],_0x49b04e=[],_0x1fa97f=[],_0x3a3952=a122_0x48f2d8['readdirSync'](_0x427194,{'withFileTypes':!![]});for(const _0x236cec of _0x3a3952){if(!_0x236cec[_0x512747(0x142)]())continue;if([_0x512747(0x1c6),_0x512747(0x191),_0x512747(0x12a),'experimental_knowledge_bases',_0x512747(0x123)][_0x512747(0x184)](_0x236cec[_0x512747(0xb8)]))continue;const _0x30906c=a122_0x280b9[_0x512747(0x11f)](_0x427194,_0x236cec[_0x512747(0xb8)]);if(isAgentDir(_0x30906c)){const _0x490b2a=a122_0x280b9['join'](_0x30906c,_0x512747(0x17d)),_0x19f7fc=a122_0x280b9[_0x512747(0x11f)](_0x30906c,'prompt.md'),_0x4339eb=a122_0x280b9[_0x512747(0x11f)](_0x30906c,_0x512747(0x186)),_0x7afdb2=parseAgentYaml(a122_0x48f2d8[_0x512747(0x1b9)](_0x490b2a,_0x512747(0xec)),_0x490b2a),_0xa3c625=a122_0x48f2d8['existsSync'](_0x19f7fc)?a122_0x48f2d8['readFileSync'](_0x19f7fc,'utf-8'):'',_0x39240e=a122_0x48f2d8['existsSync'](_0x4339eb)?a122_0x48f2d8[_0x512747(0x1b9)](_0x4339eb,_0x512747(0xec)):_0x7afdb2[_0x512747(0x1a5)];_0x51b88a['push']({'name':_0x7afdb2[_0x512747(0xb8)],'dir':_0x30906c,'yaml':_0x7afdb2,'systemPrompt':_0xa3c625,'starterMessage':_0x39240e});}}const _0xf9a1=getKnowledgeBasesDir(_0x427194);if(a122_0x48f2d8[_0x512747(0x1bc)](_0xf9a1)){const _0x3400d7=a122_0x48f2d8[_0x512747(0x130)](_0xf9a1);for(const _0x549b19 of _0x3400d7){const _0x3ce3de=a122_0x280b9['join'](_0xf9a1,_0x549b19);if(_0x549b19[_0x512747(0x1d1)](_0x512747(0x133))){const _0x30b9da=parseKnowledgeBaseYaml(a122_0x48f2d8[_0x512747(0x1b9)](_0x3ce3de,_0x512747(0xec)),_0x3ce3de);_0x3cf47d[_0x512747(0x16f)]({'name':_0x30b9da[_0x512747(0xb8)],'path':_0x3ce3de,'yaml':_0x30b9da});}else{if(_0x549b19[_0x512747(0x1d1)]('.md')){const _0x2ef650=a122_0x48f2d8[_0x512747(0x1b9)](_0x3ce3de,_0x512747(0xec)),{name:_0x104cf2,text:_0x371573}=parseTextKnowledgeBaseMd(_0x2ef650,_0x549b19);_0x2e4f20[_0x512747(0x16f)]({'name':_0x104cf2,'path':_0x3ce3de,'text':_0x371573});}}}}const _0xa39bff=getPromptsDir(_0x427194);if(a122_0x48f2d8['existsSync'](_0xa39bff)){const _0x305b04=a122_0x48f2d8[_0x512747(0x130)](_0xa39bff)[_0x512747(0xdf)](_0x47df06=>_0x47df06[_0x512747(0x1d1)](_0x512747(0x133)));for(const _0x379382 of _0x305b04){const _0x1b8933=a122_0x280b9[_0x512747(0x11f)](_0xa39bff,_0x379382),_0x5b1925=parsePromptYaml(a122_0x48f2d8['readFileSync'](_0x1b8933,_0x512747(0xec)),_0x1b8933);_0x56e6bc[_0x512747(0x16f)]({'name':_0x5b1925[_0x512747(0xb8)],'path':_0x1b8933,'yaml':_0x5b1925});}}const _0x5e0f43=[],_0x49a2f5=getIntegrationsDir(_0x427194);if(a122_0x48f2d8[_0x512747(0x1bc)](_0x49a2f5)){const _0x3618fd=a122_0x48f2d8[_0x512747(0x130)](_0x49a2f5)['filter'](_0x583706=>_0x583706[_0x512747(0x1d1)]('.yml'));for(const _0x1405a8 of _0x3618fd){const _0x42ea0d=a122_0x280b9['join'](_0x49a2f5,_0x1405a8),_0x46b82f=parseIntegrationYaml(a122_0x48f2d8['readFileSync'](_0x42ea0d,_0x512747(0xec)),_0x42ea0d);if(!SAFE_INTEGRATION_TYPES[_0x512747(0x184)](_0x46b82f[_0x512747(0x112)][_0x512747(0x1c0)]())){this[_0x512747(0x18a)][_0x512747(0xbd)](_0x512747(0xf6)+_0x46b82f['name']+'\x27\x20('+_0x46b82f['service_type']+_0x512747(0x1a3)+(_0x512747(0x139)+SAFE_INTEGRATION_TYPES[_0x512747(0x11f)](',\x20')+_0x512747(0x1ce))+'Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.');continue;}_0x5e0f43[_0x512747(0x16f)]({'name':_0x46b82f[_0x512747(0xb8)],'path':_0x42ea0d,'yaml':_0x46b82f});}}const _0x15b59d=getExperimentalKnowledgeBasesDir(_0x427194);if(a122_0x48f2d8[_0x512747(0x1bc)](_0x15b59d)){const _0x9b4b82=a122_0x48f2d8['readdirSync'](_0x15b59d,{'withFileTypes':!![]});for(const _0x362cfb of _0x9b4b82){if(!_0x362cfb[_0x512747(0x142)]())continue;const _0x3fd4a2=a122_0x280b9[_0x512747(0x11f)](_0x15b59d,_0x362cfb[_0x512747(0xb8)]),_0x271a0e=a122_0x280b9[_0x512747(0x11f)](_0x3fd4a2,_0x362cfb[_0x512747(0xb8)]+_0x512747(0x133)),_0x26ed03=a122_0x280b9['join'](_0x3fd4a2,'functions');if(!a122_0x48f2d8[_0x512747(0x1bc)](_0x271a0e))continue;const _0x3ed1f1=parseExperimentalKnowledgeBaseYaml(a122_0x48f2d8[_0x512747(0x1b9)](_0x271a0e,_0x512747(0xec)),_0x271a0e),_0x2e1c54=[];if(a122_0x48f2d8[_0x512747(0x1bc)](_0x26ed03)){const _0x11b279=a122_0x48f2d8[_0x512747(0x130)](_0x26ed03,{'withFileTypes':!![]});for(const _0x1e0834 of _0x11b279){if(!_0x1e0834[_0x512747(0x142)]())continue;const _0x439f08=a122_0x280b9[_0x512747(0x11f)](_0x26ed03,_0x1e0834[_0x512747(0xb8)]),_0x517bd6=a122_0x280b9[_0x512747(0x11f)](_0x439f08,_0x512747(0xc7)),_0x128ad4=a122_0x280b9[_0x512747(0x11f)](_0x439f08,_0x512747(0x195));a122_0x48f2d8['existsSync'](_0x517bd6)&&a122_0x48f2d8[_0x512747(0x1bc)](_0x128ad4)&&_0x2e1c54['push']({'name':_0x1e0834[_0x512747(0xb8)],'code':a122_0x48f2d8[_0x512747(0x1b9)](_0x517bd6,_0x512747(0xec)),'json_schema':a122_0x48f2d8[_0x512747(0x1b9)](_0x128ad4,_0x512747(0xec))});}}const _0x36e54a={..._0x3ed1f1,'variables':_0x3ed1f1['variables']||[],'functions':_0x2e1c54};_0x49b04e[_0x512747(0x16f)]({'name':_0x3ed1f1[_0x512747(0xb8)],'dir':_0x3fd4a2,'def':_0x36e54a});}}const _0x1c8cad=getExperimentalArtifactsDir(_0x427194);if(a122_0x48f2d8['existsSync'](_0x1c8cad)){const _0x541b61=a122_0x48f2d8[_0x512747(0x130)](_0x1c8cad,{'withFileTypes':!![]});for(const _0x2334b9 of _0x541b61){if(!_0x2334b9['isDirectory']())continue;const _0xbbc998=a122_0x280b9['join'](_0x1c8cad,_0x2334b9[_0x512747(0xb8)]),_0x18e638=a122_0x280b9[_0x512747(0x11f)](_0xbbc998,_0x2334b9['name']+_0x512747(0x133)),_0x109ac1=a122_0x280b9[_0x512747(0x11f)](_0xbbc998,_0x512747(0xc7)),_0x318f16=a122_0x280b9[_0x512747(0x11f)](_0xbbc998,_0x512747(0xe5));if(!a122_0x48f2d8['existsSync'](_0x18e638)||!a122_0x48f2d8[_0x512747(0x1bc)](_0x109ac1))continue;const _0xf77538=parseExperimentalArtifactYaml(a122_0x48f2d8[_0x512747(0x1b9)](_0x18e638,_0x512747(0xec)),_0x18e638),_0x1b5233=a122_0x48f2d8[_0x512747(0x1b9)](_0x109ac1,_0x512747(0xec)),_0x18e9f1=[];if(a122_0x48f2d8['existsSync'](_0x318f16)){const _0x490e69=a122_0x48f2d8[_0x512747(0x130)](_0x318f16);for(const _0x28d1d8 of _0x490e69){const _0x3fab15=a122_0x280b9[_0x512747(0x11f)](_0x318f16,_0x28d1d8);a122_0x48f2d8[_0x512747(0x1d4)](_0x3fab15)['isFile']()&&_0x18e9f1[_0x512747(0x16f)]({'file_name':_0x28d1d8,'text_content':a122_0x48f2d8[_0x512747(0x1b9)](_0x3fab15,_0x512747(0xec))});}}const _0x2bba1f={..._0xf77538,'code':_0x1b5233,'files':_0x18e9f1};_0x1fa97f[_0x512747(0x16f)]({'name':_0xf77538[_0x512747(0xb8)],'dir':_0xbbc998,'def':_0x2bba1f});}}const _0x1c33be=await this[_0x512747(0x124)]['listAgentsFull'](_0x33c93b),_0x1acd88=await this['client'][_0x512747(0x15d)](_0x33c93b),_0x2b0401=await this['client'][_0x512747(0x13c)](_0x33c93b),_0x3fa870=await this[_0x512747(0x124)][_0x512747(0x1c2)](_0x33c93b),_0x423715=await this['client'][_0x512747(0x101)](_0x33c93b),_0x1bf1bf=await safeListOrEmpty(()=>this['client'][_0x512747(0x1c4)](_0x33c93b)),_0x593eb5=await safeListOrEmpty(()=>this[_0x512747(0x124)][_0x512747(0x17b)](_0x33c93b)),_0x20db15=await fetchAllToolTargetMaps((_0x21e44e,_0x37c5be)=>this['client'][_0x512747(0x153)](_0x21e44e,_0x37c5be),_0x33c93b),_0x22b0be=new Map(),_0x53bce2=new Map(),_0x35a080=new Map(),_0x57aa40=new Map(),_0x5bf855=new Map(),_0x41ddbc=new Map(),_0x44ee78=new Map();for(const _0x3da237 of _0x1c33be){_0x22b0be[_0x512747(0x100)](_0x3da237[_0x512747(0x187)][_0x512747(0xb8)],_0x3da237);}for(const _0x1f0c14 of _0x1acd88){_0x53bce2[_0x512747(0x100)](_0x1f0c14[_0x512747(0x187)][_0x512747(0xb8)],_0x1f0c14);}for(const _0x2382c8 of _0x2b0401){_0x35a080['set'](_0x2382c8[_0x512747(0x187)]['name'],_0x2382c8);}for(const _0xeeeb12 of _0x3fa870){_0x57aa40[_0x512747(0x100)](_0xeeeb12['attributes'][_0x512747(0xb8)],_0xeeeb12);}for(const _0xc51ff2 of _0x423715){_0x5bf855[_0x512747(0x100)](_0xc51ff2[_0x512747(0x187)][_0x512747(0xf4)][_0x512747(0x1c0)](),_0xc51ff2);}for(const _0x1005aa of _0x1bf1bf){_0x41ddbc[_0x512747(0x100)](_0x1005aa['attributes']['name'],_0x1005aa);}for(const _0x182dcd of _0x593eb5){_0x44ee78['set'](_0x182dcd['attributes']['name'],_0x182dcd);}const _0x43518d=new Map(),_0x4e1dcf=new Map();for(const _0x2781bd of _0x1c33be){_0x43518d[_0x512747(0x100)](_0x2781bd[_0x512747(0x187)][_0x512747(0xb8)],_0x2781bd['id']),_0x4e1dcf['set'](_0x2781bd['id'],_0x2781bd[_0x512747(0x187)][_0x512747(0xb8)]);}const _0x1f8905=new Map(),_0x40bfdc=new Map();for(const _0x3bcea6 of _0x3fa870){_0x1f8905[_0x512747(0x100)](_0x3bcea6[_0x512747(0x187)][_0x512747(0xb8)],_0x3bcea6['id']),_0x40bfdc['set'](_0x3bcea6['id'],_0x3bcea6[_0x512747(0x187)][_0x512747(0xb8)]);}const _0x44d58=_0x20db15[_0x512747(0x1c3)]['KnowledgeBase']||new Map(),_0x5b1c90=_0x20db15['nameToId'][_0x512747(0x19b)]||new Map(),_0xb393db=_0x20db15[_0x512747(0x1c3)]['ExperimentalKnowledgeBase']||new Map(),_0x2b23a3=new Map(),_0x32a81c={'resolveToolTargetName':buildNameResolver({..._0x20db15['idToName'],'Agent':_0x4e1dcf}),'resolvePromptName':async _0x3b4b3f=>_0x40bfdc['get'](_0x3b4b3f),'onWarning':_0x20f45b=>this[_0x512747(0x18a)][_0x512747(0xbd)](_0x20f45b)};let _0x4a2405=[];const _0xeb1576={'projectId':_0x33c93b,'resolveToolTargetId':buildIdResolver({..._0x20db15[_0x512747(0x1c3)],'Agent':_0x43518d}),'resolvePromptId':async _0x192b5e=>_0x1f8905[_0x512747(0xba)](_0x192b5e),'onWarning':_0x9b3f92=>{const _0x1a81f4=_0x512747;this['logger'][_0x1a81f4(0xbd)](_0x9b3f92),_0x4a2405[_0x1a81f4(0x16f)](_0x9b3f92);}},{resolved:_0x3e4567,unresolved:_0x57c1ab}=resolveAgentDependencies(_0x51b88a,new Set(_0x22b0be[_0x512747(0x168)]()));for(const {agent:_0x3d92e5,missingDeps:_0x4ec477}of _0x57c1ab){_0x51e320[_0x512747(0x148)][_0x512747(0x16f)]({'agentName':_0x3d92e5[_0x512747(0xf7)]['name'],'action':_0x512747(0xe8),'error':_0x512747(0x1cf)+_0x4ec477[_0x512747(0x11f)](',\x20')+_0x512747(0x102)}),_0x51e320[_0x512747(0xd6)]['agents']['errors']++;}for(const _0x352dc0 of _0x3cf47d){const _0x41ee51=_0x53bce2['get'](_0x352dc0['yaml'][_0x512747(0xb8)]),_0x55deda=a122_0x48f2d8[_0x512747(0x1b9)](_0x352dc0[_0x512747(0xf5)],_0x512747(0xec));if(_0x41ee51){const _0x236f02=apiKnowledgeBaseToYaml(_0x41ee51),_0x3916df=toKnowledgeBaseYamlString(_0x236f02),_0x298154=generateDiff(_0x3916df,_0x55deda),_0x47ec43=hasChanges(_0x298154);_0x47ec43?(_0x51e320[_0x512747(0x162)][_0x512747(0x16f)]({'name':_0x352dc0[_0x512747(0xf7)][_0x512747(0xb8)],'action':'updated','id':_0x41ee51['id'],'diff':formatDiffWithColors(_0x298154)}),_0x51e320['counts'][_0x512747(0x162)][_0x512747(0x182)]++):(_0x51e320[_0x512747(0x162)]['push']({'name':_0x352dc0[_0x512747(0xf7)]['name'],'action':'unchanged','id':_0x41ee51['id']}),_0x51e320[_0x512747(0xd6)]['knowledgeBases'][_0x512747(0xe6)]++);}else _0x51e320[_0x512747(0x162)][_0x512747(0x16f)]({'name':_0x352dc0['yaml']['name'],'action':'created'}),_0x51e320[_0x512747(0xd6)][_0x512747(0x162)][_0x512747(0x18b)]++;}for(const _0x4de430 of _0x2e4f20){const _0x411466=_0x35a080[_0x512747(0xba)](_0x4de430[_0x512747(0xb8)]),_0x5b255e=a122_0x48f2d8[_0x512747(0x1b9)](_0x4de430['path'],_0x512747(0xec));if(_0x411466){const _0x588a3a=toTextKnowledgeBaseMd(_0x411466[_0x512747(0x187)][_0x512747(0xb8)],_0x411466[_0x512747(0x187)]['text']),_0x1571e4=generateDiff(_0x588a3a,_0x5b255e),_0x417bf4=hasChanges(_0x1571e4);_0x417bf4?(_0x51e320[_0x512747(0xd2)]['push']({'name':_0x4de430['name'],'action':'updated','id':_0x411466['id'],'diff':formatDiffWithColors(_0x1571e4)}),_0x51e320['counts'][_0x512747(0xd2)]['updated']++):(_0x51e320[_0x512747(0xd2)][_0x512747(0x16f)]({'name':_0x4de430[_0x512747(0xb8)],'action':_0x512747(0xe6),'id':_0x411466['id']}),_0x51e320[_0x512747(0xd6)][_0x512747(0xd2)][_0x512747(0xe6)]++);}else _0x51e320[_0x512747(0xd2)][_0x512747(0x16f)]({'name':_0x4de430[_0x512747(0xb8)],'action':_0x512747(0x18b)}),_0x51e320[_0x512747(0xd6)]['textKnowledgeBases'][_0x512747(0x18b)]++;}for(const _0x256267 of _0x3e4567){const _0x28483a=_0x22b0be[_0x512747(0xba)](_0x256267[_0x512747(0xf7)]['name']),_0x347b6b=a122_0x280b9[_0x512747(0x11f)](_0x256267[_0x512747(0xf8)],_0x512747(0x17d)),_0x23d3ee=a122_0x48f2d8['readFileSync'](_0x347b6b,_0x512747(0xec)),_0xb9ea24=_0x256267[_0x512747(0x199)],_0x11a849=_0x512747(0x173)+_0xb9ea24+_0x512747(0x158)+_0x23d3ee;if(_0x28483a){const {yaml:_0x2ac12c,systemPrompt:_0x2d882d}=await agentResponseToDef(_0x28483a,_0x32a81c),_0x461be2=toAgentYamlString(_0x2ac12c),_0x34b05e=_0x512747(0x173)+_0x2d882d+_0x512747(0x158)+_0x461be2,_0x5bbfad=generateDiff(_0x34b05e,_0x11a849),_0x532fb0=hasChanges(_0x5bbfad);_0x532fb0?(_0x51e320[_0x512747(0x148)][_0x512747(0x16f)]({'agentName':_0x256267[_0x512747(0xf7)][_0x512747(0xb8)],'action':_0x512747(0x182),'agentId':_0x28483a['id'],'diff':formatDiffWithColors(_0x5bbfad)}),_0x51e320['counts']['agents'][_0x512747(0x182)]++):(_0x51e320['agents'][_0x512747(0x16f)]({'agentName':_0x256267[_0x512747(0xf7)][_0x512747(0xb8)],'action':'unchanged','agentId':_0x28483a['id']}),_0x51e320[_0x512747(0xd6)][_0x512747(0x148)][_0x512747(0xe6)]++);}else _0x51e320[_0x512747(0x148)][_0x512747(0x16f)]({'agentName':_0x256267[_0x512747(0xf7)][_0x512747(0xb8)],'action':'created'}),_0x51e320[_0x512747(0xd6)][_0x512747(0x148)][_0x512747(0x18b)]++;}for(const _0x2bcfd8 of _0x56e6bc){const _0x1aec32=_0x57aa40[_0x512747(0xba)](_0x2bcfd8['yaml'][_0x512747(0xb8)]),_0x96ce29=a122_0x48f2d8[_0x512747(0x1b9)](_0x2bcfd8[_0x512747(0xf5)],_0x512747(0xec));if(_0x1aec32){const _0x303ba4=await apiPromptToYaml(_0x1aec32,_0x32a81c);if(!_0x303ba4){_0x51e320[_0x512747(0x191)][_0x512747(0x16f)]({'name':_0x2bcfd8[_0x512747(0xf7)][_0x512747(0xb8)],'action':_0x512747(0x182),'id':_0x1aec32['id']}),_0x51e320[_0x512747(0xd6)][_0x512747(0x191)]['updated']++;continue;}const _0x96632b=toPromptYamlString(_0x303ba4),_0x2046dc=generateDiff(_0x96632b,_0x96ce29),_0x1b1895=hasChanges(_0x2046dc);_0x1b1895?(_0x51e320[_0x512747(0x191)][_0x512747(0x16f)]({'name':_0x2bcfd8[_0x512747(0xf7)][_0x512747(0xb8)],'action':'updated','id':_0x1aec32['id'],'diff':formatDiffWithColors(_0x2046dc)}),_0x51e320[_0x512747(0xd6)][_0x512747(0x191)][_0x512747(0x182)]++):(_0x51e320[_0x512747(0x191)][_0x512747(0x16f)]({'name':_0x2bcfd8[_0x512747(0xf7)][_0x512747(0xb8)],'action':_0x512747(0xe6),'id':_0x1aec32['id']}),_0x51e320[_0x512747(0xd6)]['prompts'][_0x512747(0xe6)]++);}else _0x51e320[_0x512747(0x191)][_0x512747(0x16f)]({'name':_0x2bcfd8[_0x512747(0xf7)][_0x512747(0xb8)],'action':_0x512747(0x18b)}),_0x51e320[_0x512747(0xd6)][_0x512747(0x191)]['created']++;}for(const _0x1aaab5 of _0x5e0f43){const _0xe2133c=_0x5bf855[_0x512747(0xba)](_0x1aaab5[_0x512747(0xf7)]['service_type']),_0x2f23ec=a122_0x48f2d8[_0x512747(0x1b9)](_0x1aaab5['path'],'utf-8');if(_0xe2133c){const _0xad88ba=await apiIntegrationToYaml(_0xe2133c,_0x32a81c),_0x50a4bf=toIntegrationYamlString(_0xad88ba),_0x5a3744=generateDiff(_0x50a4bf,_0x2f23ec),_0x35132d=hasChanges(_0x5a3744);_0x35132d?(_0x51e320[_0x512747(0x12a)]['push']({'name':_0x1aaab5[_0x512747(0xf7)][_0x512747(0x112)],'action':_0x512747(0x182),'id':_0xe2133c['id'],'diff':formatDiffWithColors(_0x5a3744)}),_0x51e320['counts'][_0x512747(0x12a)][_0x512747(0x182)]++):(_0x51e320[_0x512747(0x12a)]['push']({'name':_0x1aaab5['yaml'][_0x512747(0x112)],'action':_0x512747(0xe6),'id':_0xe2133c['id']}),_0x51e320[_0x512747(0xd6)][_0x512747(0x12a)][_0x512747(0xe6)]++);}else _0x51e320[_0x512747(0x12a)][_0x512747(0x16f)]({'name':_0x1aaab5[_0x512747(0xf7)]['service_type'],'action':_0x512747(0x18b)}),_0x51e320[_0x512747(0xd6)][_0x512747(0x12a)][_0x512747(0x18b)]++;}for(const _0x431d7d of _0x49b04e){const _0x33ec1d=_0x41ddbc[_0x512747(0xba)](_0x431d7d[_0x512747(0xc9)][_0x512747(0xb8)]),_0x49b528=toExperimentalKnowledgeBaseYamlString(_0x431d7d[_0x512747(0xc9)]);let _0x31f92e=_0x49b528;for(const _0x4fa568 of _0x431d7d[_0x512747(0xc9)][_0x512747(0x14f)]){_0x31f92e+=_0x512747(0x13f)+_0x4fa568[_0x512747(0xb8)]+'\x20---\x0a'+_0x4fa568[_0x512747(0xdb)]+_0x512747(0xce)+_0x4fa568[_0x512747(0xb8)]+_0x512747(0x11b)+_0x4fa568[_0x512747(0x14b)]+'\x0a';}if(_0x33ec1d){const _0xbe2854=apiExperimentalKnowledgeBaseToYaml(_0x33ec1d),_0x40efce=toExperimentalKnowledgeBaseYamlString(_0xbe2854);let _0xb94c8a=_0x40efce;for(const _0x57179c of _0xbe2854[_0x512747(0x14f)]){_0xb94c8a+=_0x512747(0x13f)+_0x57179c[_0x512747(0xb8)]+_0x512747(0x11b)+_0x57179c[_0x512747(0xdb)]+_0x512747(0xce)+_0x57179c[_0x512747(0xb8)]+_0x512747(0x11b)+_0x57179c[_0x512747(0x14b)]+'\x0a';}const _0x39ecaa=generateDiff(_0xb94c8a,_0x31f92e),_0x53f9f3=hasChanges(_0x39ecaa);_0x53f9f3?(_0x51e320[_0x512747(0x163)][_0x512747(0x16f)]({'name':_0x431d7d[_0x512747(0xc9)]['name'],'action':_0x512747(0x182),'id':_0x33ec1d['id'],'diff':formatDiffWithColors(_0x39ecaa)}),_0x51e320[_0x512747(0xd6)][_0x512747(0x163)]['updated']++):(_0x51e320['experimentalKnowledgeBases'][_0x512747(0x16f)]({'name':_0x431d7d[_0x512747(0xc9)][_0x512747(0xb8)],'action':_0x512747(0xe6),'id':_0x33ec1d['id']}),_0x51e320[_0x512747(0xd6)][_0x512747(0x163)]['unchanged']++);}else _0x51e320['experimentalKnowledgeBases']['push']({'name':_0x431d7d[_0x512747(0xc9)]['name'],'action':_0x512747(0x18b)}),_0x51e320[_0x512747(0xd6)][_0x512747(0x163)][_0x512747(0x18b)]++;}for(const _0x16225a of _0x1fa97f){const _0xc1d1d9=_0x44ee78['get'](_0x16225a[_0x512747(0xc9)][_0x512747(0xb8)]),_0x5d68c7=toExperimentalArtifactYamlString(_0x16225a[_0x512747(0xc9)]);let _0x4cd19d=_0x5d68c7+('\x0a---\x20code\x20---\x0a'+_0x16225a['def'][_0x512747(0xdb)]+'\x0a');for(const _0x50eb35 of _0x16225a['def']['files']){_0x4cd19d+=_0x512747(0x188)+_0x50eb35[_0x512747(0x13e)]+_0x512747(0x11b)+_0x50eb35[_0x512747(0x16c)]+'\x0a';}if(_0xc1d1d9){const _0x3add49=apiExperimentalArtifactToYaml(_0xc1d1d9),_0x5dcae4=toExperimentalArtifactYamlString(_0x3add49);let _0x37967c=_0x5dcae4+(_0x512747(0x16d)+_0x3add49['code']+'\x0a');for(const _0x3d66cd of _0x3add49[_0x512747(0xe5)]){_0x37967c+=_0x512747(0x188)+_0x3d66cd[_0x512747(0x13e)]+'\x20---\x0a'+_0x3d66cd[_0x512747(0x16c)]+'\x0a';}const _0x5326e8=generateDiff(_0x37967c,_0x4cd19d),_0xe13e6f=hasChanges(_0x5326e8);_0xe13e6f?(_0x51e320[_0x512747(0x1ad)]['push']({'name':_0x16225a[_0x512747(0xc9)][_0x512747(0xb8)],'action':_0x512747(0x182),'id':_0xc1d1d9['id'],'diff':formatDiffWithColors(_0x5326e8)}),_0x51e320[_0x512747(0xd6)][_0x512747(0x1ad)][_0x512747(0x182)]++):(_0x51e320[_0x512747(0x1ad)][_0x512747(0x16f)]({'name':_0x16225a['def']['name'],'action':_0x512747(0xe6),'id':_0xc1d1d9['id']}),_0x51e320['counts'][_0x512747(0x1ad)][_0x512747(0xe6)]++);}else _0x51e320[_0x512747(0x1ad)][_0x512747(0x16f)]({'name':_0x16225a[_0x512747(0xc9)]['name'],'action':_0x512747(0x18b)}),_0x51e320[_0x512747(0xd6)][_0x512747(0x1ad)][_0x512747(0x18b)]++;}if(_0x175728?.[_0x512747(0x146)])return _0x51e320;_0x51e320[_0x512747(0x162)]=[],_0x51e320[_0x512747(0xd2)]=[],_0x51e320[_0x512747(0x191)]=[],_0x51e320[_0x512747(0x12a)]=[],_0x51e320[_0x512747(0x163)]=[],_0x51e320['experimentalArtifacts']=[];const _0x1dd4b9=_0x51e320['agents'][_0x512747(0xdf)](_0x3cb68b=>_0x3cb68b[_0x512747(0x179)]===_0x512747(0xe8));_0x51e320[_0x512747(0x148)]=_0x1dd4b9,_0x51e320['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x1dd4b9['length']},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0xdbe500 of _0x3cf47d){try{const _0x333865=_0x53bce2[_0x512747(0xba)](_0xdbe500[_0x512747(0xf7)]['name']),_0x541596=yamlKnowledgeBaseToApi(_0xdbe500[_0x512747(0xf7)],_0x33c93b);if(_0x333865)await this[_0x512747(0x124)][_0x512747(0xd3)](_0x333865['id'],_0x541596),_0x44d58['set'](_0xdbe500[_0x512747(0xf7)][_0x512747(0xb8)],_0x333865['id']),_0x51e320['knowledgeBases']['push']({'name':_0xdbe500[_0x512747(0xf7)]['name'],'action':_0x512747(0x182),'id':_0x333865['id']}),_0x51e320[_0x512747(0xd6)][_0x512747(0x162)][_0x512747(0x182)]++;else{const _0x2d0dc2=await this['client']['createKnowledgeBase'](_0x541596);_0x44d58[_0x512747(0x100)](_0xdbe500[_0x512747(0xf7)][_0x512747(0xb8)],_0x2d0dc2['id']),_0x51e320[_0x512747(0x162)][_0x512747(0x16f)]({'name':_0xdbe500[_0x512747(0xf7)]['name'],'action':_0x512747(0x18b),'id':_0x2d0dc2['id']}),_0x51e320[_0x512747(0xd6)][_0x512747(0x162)]['created']++;}}catch(_0x18e5f2){_0x51e320[_0x512747(0x162)][_0x512747(0x16f)]({'name':_0xdbe500[_0x512747(0xf7)][_0x512747(0xb8)],'action':'error','error':_0x18e5f2['message']}),_0x51e320[_0x512747(0xd6)][_0x512747(0x162)]['errors']++;}}for(const _0x4c8fc6 of _0x2e4f20){try{const _0x8eb557=_0x35a080[_0x512747(0xba)](_0x4c8fc6['name']),_0x2133b8=yamlTextKnowledgeBaseToApi({'name':_0x4c8fc6[_0x512747(0xb8)],'text':_0x4c8fc6['text']},_0x33c93b);if(_0x8eb557)await this['client'][_0x512747(0x159)](_0x8eb557['id'],_0x2133b8),_0x5b1c90[_0x512747(0x100)](_0x4c8fc6[_0x512747(0xb8)],_0x8eb557['id']),_0x51e320[_0x512747(0xd2)]['push']({'name':_0x4c8fc6[_0x512747(0xb8)],'action':_0x512747(0x182),'id':_0x8eb557['id']}),_0x51e320[_0x512747(0xd6)][_0x512747(0xd2)][_0x512747(0x182)]++;else{const _0x2e25e0=await this['client']['createTextKnowledgeBase'](_0x2133b8);_0x5b1c90[_0x512747(0x100)](_0x4c8fc6[_0x512747(0xb8)],_0x2e25e0['id']),_0x51e320[_0x512747(0xd2)]['push']({'name':_0x4c8fc6['name'],'action':_0x512747(0x18b),'id':_0x2e25e0['id']}),_0x51e320['counts'][_0x512747(0xd2)]['created']++;}}catch(_0x247dd6){_0x51e320['textKnowledgeBases'][_0x512747(0x16f)]({'name':_0x4c8fc6[_0x512747(0xb8)],'action':'error','error':_0x247dd6[_0x512747(0x12e)]}),_0x51e320[_0x512747(0xd6)]['textKnowledgeBases'][_0x512747(0xbb)]++;}}for(const _0x477da8 of _0x49b04e){try{const _0x1ac93f=_0x41ddbc['get'](_0x477da8['def'][_0x512747(0xb8)]),_0x1bd30a=yamlExperimentalKnowledgeBaseToApi(_0x477da8[_0x512747(0xc9)],_0x33c93b);if(_0x1ac93f)await this[_0x512747(0x124)][_0x512747(0x19d)](_0x1ac93f['id'],_0x1bd30a),_0xb393db['set'](_0x477da8[_0x512747(0xc9)][_0x512747(0xb8)],_0x1ac93f['id']),_0x51e320['experimentalKnowledgeBases'][_0x512747(0x16f)]({'name':_0x477da8[_0x512747(0xc9)]['name'],'action':_0x512747(0x182),'id':_0x1ac93f['id']}),_0x51e320[_0x512747(0xd6)]['experimentalKnowledgeBases']['updated']++;else{const _0x2e851c=await this['client'][_0x512747(0xca)](_0x1bd30a);_0xb393db['set'](_0x477da8[_0x512747(0xc9)]['name'],_0x2e851c['id']),_0x51e320[_0x512747(0x163)][_0x512747(0x16f)]({'name':_0x477da8[_0x512747(0xc9)][_0x512747(0xb8)],'action':'created','id':_0x2e851c['id']}),_0x51e320[_0x512747(0xd6)][_0x512747(0x163)][_0x512747(0x18b)]++;}}catch(_0x419b2f){_0x51e320[_0x512747(0x163)]['push']({'name':_0x477da8[_0x512747(0xc9)][_0x512747(0xb8)],'action':_0x512747(0xe8),'error':_0x419b2f[_0x512747(0x12e)]}),_0x51e320[_0x512747(0xd6)][_0x512747(0x163)][_0x512747(0xbb)]++;}}for(const _0x24930a of _0x1fa97f){try{const _0x6724fa=_0x44ee78[_0x512747(0xba)](_0x24930a[_0x512747(0xc9)]['name']),_0x454be8=yamlExperimentalArtifactToApi(_0x24930a[_0x512747(0xc9)],_0x33c93b);if(_0x6724fa)await this[_0x512747(0x124)][_0x512747(0x197)](_0x6724fa['id'],_0x454be8),_0x2b23a3['set'](_0x24930a[_0x512747(0xc9)][_0x512747(0xb8)],_0x6724fa['id']),_0x51e320[_0x512747(0x1ad)][_0x512747(0x16f)]({'name':_0x24930a[_0x512747(0xc9)][_0x512747(0xb8)],'action':'updated','id':_0x6724fa['id']}),_0x51e320[_0x512747(0xd6)]['experimentalArtifacts']['updated']++;else{const _0x1167ac=await this[_0x512747(0x124)][_0x512747(0x180)](_0x454be8);_0x2b23a3[_0x512747(0x100)](_0x24930a[_0x512747(0xc9)][_0x512747(0xb8)],_0x1167ac['id']),_0x51e320[_0x512747(0x1ad)]['push']({'name':_0x24930a[_0x512747(0xc9)][_0x512747(0xb8)],'action':_0x512747(0x18b),'id':_0x1167ac['id']}),_0x51e320[_0x512747(0xd6)][_0x512747(0x1ad)][_0x512747(0x18b)]++;}}catch(_0x30f0d3){_0x51e320[_0x512747(0x1ad)]['push']({'name':_0x24930a['def']['name'],'action':_0x512747(0xe8),'error':_0x30f0d3[_0x512747(0x12e)]}),_0x51e320[_0x512747(0xd6)][_0x512747(0x1ad)][_0x512747(0xbb)]++;}}for(const _0x3fc65c of _0x3e4567){_0x4a2405=[];try{const _0x1c29cf=_0x22b0be['get'](_0x3fc65c[_0x512747(0xf7)]['name']),_0x406a60=await agentDefToRequest(_0x3fc65c[_0x512747(0xf7)],_0x3fc65c[_0x512747(0x199)],_0x3fc65c[_0x512747(0x164)],_0xeb1576);if(_0x1c29cf)await this[_0x512747(0x124)][_0x512747(0xfa)](_0x1c29cf['id'],_0x406a60),_0x43518d[_0x512747(0x100)](_0x3fc65c[_0x512747(0xf7)][_0x512747(0xb8)],_0x1c29cf['id']),_0x51e320[_0x512747(0x148)]['push']({'agentName':_0x3fc65c[_0x512747(0xf7)][_0x512747(0xb8)],'action':_0x512747(0x182),'agentId':_0x1c29cf['id'],'warnings':_0x4a2405[_0x512747(0xc5)]>0x0?_0x4a2405:undefined}),_0x51e320[_0x512747(0xd6)][_0x512747(0x148)][_0x512747(0x182)]++;else{const _0x2085d1=await this[_0x512747(0x124)][_0x512747(0x13d)](_0x406a60);_0x43518d[_0x512747(0x100)](_0x3fc65c[_0x512747(0xf7)][_0x512747(0xb8)],_0x2085d1['id']),_0x51e320[_0x512747(0x148)][_0x512747(0x16f)]({'agentName':_0x3fc65c['yaml'][_0x512747(0xb8)],'action':'created','agentId':_0x2085d1['id'],'warnings':_0x4a2405[_0x512747(0xc5)]>0x0?_0x4a2405:undefined}),_0x51e320['counts'][_0x512747(0x148)]['created']++;}}catch(_0x5dcf76){_0x51e320[_0x512747(0x148)]['push']({'agentName':_0x3fc65c[_0x512747(0xf7)][_0x512747(0xb8)],'action':_0x512747(0xe8),'error':_0x5dcf76[_0x512747(0x12e)],'warnings':_0x4a2405['length']>0x0?_0x4a2405:undefined}),_0x51e320[_0x512747(0xd6)][_0x512747(0x148)][_0x512747(0xbb)]++;}}for(const _0x138374 of _0x56e6bc){try{const _0x271931=_0x57aa40['get'](_0x138374['yaml']['name']),_0x56ec01=await yamlPromptToApi(_0x138374[_0x512747(0xf7)],_0x33c93b,_0xeb1576);if(!_0x56ec01){_0x51e320[_0x512747(0x191)][_0x512747(0x16f)]({'name':_0x138374[_0x512747(0xf7)][_0x512747(0xb8)],'action':_0x512747(0xe8),'error':_0x512747(0x134)}),_0x51e320[_0x512747(0xd6)][_0x512747(0x191)][_0x512747(0xbb)]++;continue;}if(_0x271931)await this['client'][_0x512747(0xc6)](_0x271931['id'],_0x56ec01),_0x1f8905[_0x512747(0x100)](_0x138374[_0x512747(0xf7)]['name'],_0x271931['id']),_0x51e320[_0x512747(0x191)][_0x512747(0x16f)]({'name':_0x138374[_0x512747(0xf7)]['name'],'action':_0x512747(0x182),'id':_0x271931['id']}),_0x51e320['counts'][_0x512747(0x191)][_0x512747(0x182)]++;else{const _0x5ac77f=await this[_0x512747(0x124)][_0x512747(0x169)](_0x56ec01);_0x1f8905['set'](_0x138374[_0x512747(0xf7)][_0x512747(0xb8)],_0x5ac77f['id']),_0x51e320[_0x512747(0x191)]['push']({'name':_0x138374[_0x512747(0xf7)][_0x512747(0xb8)],'action':_0x512747(0x18b),'id':_0x5ac77f['id']}),_0x51e320['counts'][_0x512747(0x191)][_0x512747(0x18b)]++;}}catch(_0x229a2e){_0x51e320[_0x512747(0x191)]['push']({'name':_0x138374['yaml'][_0x512747(0xb8)],'action':_0x512747(0xe8),'error':_0x229a2e[_0x512747(0x12e)]}),_0x51e320['counts'][_0x512747(0x191)]['errors']++;}}for(const _0x3a0f52 of _0x5e0f43){try{const _0x357374=_0x5bf855[_0x512747(0xba)](_0x3a0f52[_0x512747(0xf7)][_0x512747(0x112)]),_0x3f7858=await yamlIntegrationToApi(_0x3a0f52[_0x512747(0xf7)],_0x33c93b,_0xeb1576);if(_0x357374){await this['client'][_0x512747(0x10f)](_0x357374['id']);const _0x3fc4e4=await this[_0x512747(0x124)][_0x512747(0xcc)](_0x3f7858);_0x51e320['integrations'][_0x512747(0x16f)]({'name':_0x3a0f52[_0x512747(0xf7)][_0x512747(0x112)],'action':_0x512747(0x182),'id':_0x3fc4e4['id']}),_0x51e320[_0x512747(0xd6)][_0x512747(0x12a)][_0x512747(0x182)]++;}else{const _0x476e01=await this[_0x512747(0x124)][_0x512747(0xcc)](_0x3f7858);_0x51e320[_0x512747(0x12a)][_0x512747(0x16f)]({'name':_0x3a0f52['yaml'][_0x512747(0x112)],'action':_0x512747(0x18b),'id':_0x476e01['id']}),_0x51e320[_0x512747(0xd6)][_0x512747(0x12a)]['created']++;}}catch(_0x4115ac){_0x51e320['integrations'][_0x512747(0x16f)]({'name':_0x3a0f52[_0x512747(0xf7)][_0x512747(0x112)],'action':_0x512747(0xe8),'error':_0x4115ac[_0x512747(0x12e)]}),_0x51e320['counts'][_0x512747(0x12a)]['errors']++;}}return _0x51e320;}async[a122_0x49f035(0x113)](_0xfa1ab,_0x22338b,_0xf7f551,_0x39b0c8){const _0x537c4f=a122_0x49f035,{projectId:_0x423d8b,project:_0x581281}=await this[_0x537c4f(0x172)](_0xfa1ab),_0x14cdf2=_0x581281['attributes'][_0x537c4f(0xb8)],_0x37ac11=await this[_0x537c4f(0x124)]['listAgentsFull'](_0x423d8b),_0x41345c=_0x37ac11[_0x537c4f(0xde)](_0x33c754=>_0x33c754[_0x537c4f(0x187)]['name']===_0x22338b);if(!_0x41345c)throw new SDKError(ErrorCode[_0x537c4f(0xdd)],_0x537c4f(0x109)+_0x22338b,undefined,{'helpText':'Available\x20agents:\x20'+_0x37ac11[_0x537c4f(0x193)](_0x5a7d11=>_0x5a7d11[_0x537c4f(0x187)]['name'])[_0x537c4f(0x11f)](',\x20')});let _0x5b185c;if(_0xf7f551)_0x5b185c=_0xf7f551;else{const _0x1bf60c=a122_0x280b9[_0x537c4f(0x11f)](process[_0x537c4f(0x1c9)](),'agents'),_0x23a855=getSanitizedPathWithMigration(_0x1bf60c,_0x14cdf2);_0x23a855[_0x537c4f(0x14c)]&&this[_0x537c4f(0x18a)][_0x537c4f(0xe1)](_0x537c4f(0x11c)+a122_0x280b9['basename'](_0x23a855['oldPath'])+'\x20→\x20'+a122_0x280b9[_0x537c4f(0x14d)](_0x23a855[_0x537c4f(0xf5)])),_0x5b185c=_0x23a855['path'];}const _0x16b165=getSanitizedPathWithMigration(_0x5b185c,_0x22338b);_0x16b165['renamed']&&this[_0x537c4f(0x18a)][_0x537c4f(0xe1)](_0x537c4f(0x141)+a122_0x280b9[_0x537c4f(0x14d)](_0x16b165[_0x537c4f(0x121)])+_0x537c4f(0x1a7)+a122_0x280b9[_0x537c4f(0x14d)](_0x16b165['path']));const _0x18876c=_0x16b165['path'],_0xbcd1bb=new Map(),_0xb802bc=new Map(),_0x2833db=await this[_0x537c4f(0x124)]['listKnowledgeBases'](_0x423d8b),_0x22c315=await this[_0x537c4f(0x124)][_0x537c4f(0x13c)](_0x423d8b),_0x57f775=await safeListOrEmpty(()=>this[_0x537c4f(0x124)][_0x537c4f(0x1c4)](_0x423d8b)),_0x281e94=new Map(),_0x532367=new Map();for(const _0x50df33 of _0x2833db){_0xbcd1bb[_0x537c4f(0x100)](_0x50df33['id'],_0x50df33['attributes'][_0x537c4f(0xb8)]);}for(const _0x4bdd08 of _0x22c315){_0x281e94[_0x537c4f(0x100)](_0x4bdd08['id'],_0x4bdd08[_0x537c4f(0x187)]['name']);}for(const _0x497dde of _0x57f775){_0x532367[_0x537c4f(0x100)](_0x497dde['id'],_0x497dde[_0x537c4f(0x187)][_0x537c4f(0xb8)]);}for(const _0x11657b of _0x37ac11){_0xb802bc[_0x537c4f(0x100)](_0x11657b['id'],_0x11657b['attributes'][_0x537c4f(0xb8)]);}const _0x5f3297={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0xbcd1bb,'TextKnowledgeBase':_0x281e94,'Agent':_0xb802bc,'ExperimentalKnowledgeBase':_0x532367}),'resolvePromptName':async()=>undefined,'onWarning':_0x1df442=>this[_0x537c4f(0x18a)][_0x537c4f(0xbd)](_0x1df442)},_0x2a75b0=a122_0x280b9[_0x537c4f(0x11f)](_0x18876c,_0x537c4f(0x15a)),_0xd0cdeb=a122_0x280b9['join'](_0x18876c,_0x537c4f(0x17d)),_0x34203e=a122_0x280b9['join'](_0x18876c,_0x537c4f(0x186)),_0x4b4f17=!a122_0x48f2d8['existsSync'](_0xd0cdeb);if(_0x39b0c8?.[_0x537c4f(0x146)])return{'agentName':_0x22338b,'outputPath':_0x18876c,'isNew':_0x4b4f17,'hasChanges':!![]};a122_0x48f2d8[_0x537c4f(0x10a)](_0x5b185c,{'recursive':!![]}),a122_0x48f2d8[_0x537c4f(0x10a)](_0x18876c,{'recursive':!![]});const _0x4555a7=a122_0x280b9[_0x537c4f(0x11f)](_0x5b185c,_0x537c4f(0xc1));!a122_0x48f2d8[_0x537c4f(0x1bc)](_0x4555a7)&&a122_0x48f2d8[_0x537c4f(0x10c)](_0x4555a7,createAgentConfigContent(_0xfa1ab));const {yaml:_0x51ffc9,systemPrompt:_0x4f45ca,starterMessage:_0x36d35f}=await agentResponseToDef(_0x41345c,_0x5f3297);let _0x15f3b4=_0x4b4f17;if(!_0x4b4f17){const _0x285585=a122_0x48f2d8[_0x537c4f(0x1bc)](_0x2a75b0)?a122_0x48f2d8[_0x537c4f(0x1b9)](_0x2a75b0,_0x537c4f(0xec)):'',_0x36e559=a122_0x48f2d8[_0x537c4f(0x1b9)](_0xd0cdeb,_0x537c4f(0xec));_0x15f3b4=_0x285585!==_0x4f45ca||_0x36e559!==toAgentYamlString(_0x51ffc9);}a122_0x48f2d8['writeFileSync'](_0x2a75b0,_0x4f45ca),a122_0x48f2d8[_0x537c4f(0x10c)](_0xd0cdeb,toAgentYamlString(_0x51ffc9));if(_0x36d35f&&_0x36d35f[_0x537c4f(0x184)]('\x0a'))a122_0x48f2d8[_0x537c4f(0x10c)](_0x34203e,_0x36d35f);else a122_0x48f2d8['existsSync'](_0x34203e)&&a122_0x48f2d8[_0x537c4f(0x194)](_0x34203e);return{'agentName':_0x22338b,'outputPath':_0x18876c,'isNew':_0x4b4f17,'hasChanges':_0x15f3b4};}async[a122_0x49f035(0x1a8)](_0x898fb2,_0x2f423e){const _0x211282=a122_0x49f035;let _0x39c571;isAgentYamlPath(_0x898fb2)?_0x39c571=getAgentDirFromYamlPath(_0x898fb2):_0x39c571=_0x898fb2;const {config:_0x50cd4e}=findAgentConfig(_0x39c571),_0x5c2761=await this[_0x211282(0x1b1)](_0x50cd4e['llm_project']),_0x3ac3bf=a122_0x280b9[_0x211282(0x11f)](_0x39c571,_0x211282(0x17d)),_0x14d53a=a122_0x280b9[_0x211282(0x11f)](_0x39c571,_0x211282(0x15a)),_0x2d9cd4=a122_0x280b9[_0x211282(0x11f)](_0x39c571,'starter_message.md');if(!a122_0x48f2d8['existsSync'](_0x3ac3bf))throw new SDKError(ErrorCode[_0x211282(0x127)],'agent.yml\x20not\x20found\x20in\x20'+_0x39c571,undefined,{'helpText':'Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.'});const _0x35d13b=parseAgentYaml(a122_0x48f2d8[_0x211282(0x1b9)](_0x3ac3bf,'utf-8'),_0x3ac3bf),_0x4ef0a4=a122_0x48f2d8[_0x211282(0x1bc)](_0x14d53a)?a122_0x48f2d8['readFileSync'](_0x14d53a,_0x211282(0xec)):'',_0x5e930c=a122_0x48f2d8[_0x211282(0x1bc)](_0x2d9cd4)?a122_0x48f2d8[_0x211282(0x1b9)](_0x2d9cd4,'utf-8'):_0x35d13b[_0x211282(0x1a5)];if(_0x2f423e?.[_0x211282(0x146)])return{'agentName':_0x35d13b[_0x211282(0xb8)],'action':_0x211282(0x18b),'projectId':_0x5c2761};const _0x5d15c1=await this[_0x211282(0x124)]['listAgentsFull'](_0x5c2761),_0x45aa6f=await fetchAllToolTargetMaps((_0x5c989a,_0x4ed5cf)=>this[_0x211282(0x124)][_0x211282(0x153)](_0x5c989a,_0x4ed5cf),_0x5c2761),_0x51e85e=new Map();for(const _0x2ab0cf of _0x5d15c1){_0x51e85e[_0x211282(0x100)](_0x2ab0cf[_0x211282(0x187)][_0x211282(0xb8)],_0x2ab0cf['id']);}const _0x559c7e=[],_0x28f24c={'projectId':_0x5c2761,'resolveToolTargetId':buildIdResolver({..._0x45aa6f['nameToId'],'Agent':_0x51e85e}),'resolvePromptId':async()=>undefined,'onWarning':_0xd055ae=>{const _0x5688fb=_0x211282;this['logger']['warn'](_0xd055ae),_0x559c7e[_0x5688fb(0x16f)](_0xd055ae);}};try{const _0x55caf8=_0x5d15c1['find'](_0x3624cb=>_0x3624cb[_0x211282(0x187)][_0x211282(0xb8)]===_0x35d13b['name']),_0x2e0296=await agentDefToRequest(_0x35d13b,_0x4ef0a4,_0x5e930c,_0x28f24c);if(_0x55caf8)return await this[_0x211282(0x124)][_0x211282(0xfa)](_0x55caf8['id'],_0x2e0296),{'agentName':_0x35d13b[_0x211282(0xb8)],'action':_0x211282(0x182),'projectId':_0x5c2761,'agentId':_0x55caf8['id'],'warnings':_0x559c7e['length']>0x0?_0x559c7e:undefined};else{const _0x538d95=await this[_0x211282(0x124)][_0x211282(0x13d)](_0x2e0296);return{'agentName':_0x35d13b['name'],'action':_0x211282(0x18b),'projectId':_0x5c2761,'agentId':_0x538d95['id'],'warnings':_0x559c7e[_0x211282(0xc5)]>0x0?_0x559c7e:undefined};}}catch(_0x187965){return{'agentName':_0x35d13b[_0x211282(0xb8)],'action':_0x211282(0xe8),'projectId':_0x5c2761,'error':_0x187965['message'],'warnings':_0x559c7e[_0x211282(0xc5)]>0x0?_0x559c7e:undefined};}}async['cloneProject'](_0x4c5566,_0xfb450e,_0x328880){const _0x2893b7=a122_0x49f035,_0x5ec30d=a122_0x48f2d8[_0x2893b7(0x1bc)](_0x4c5566)&&a122_0x48f2d8[_0x2893b7(0x1bc)](a122_0x280b9['join'](_0x4c5566,_0x2893b7(0xc1)));let _0x15b9ee;const _0x4bda95=[],_0x254899=[],_0x5b7390=[],_0x409b45=[],_0x2d8efe=[],_0x334377=[],_0x523bc8=[];if(_0x5ec30d){const _0x3416ae=loadAgentConfig(a122_0x280b9[_0x2893b7(0x11f)](_0x4c5566,_0x2893b7(0xc1)));_0x15b9ee=_0x3416ae[_0x2893b7(0x111)];const _0x4d6d79=a122_0x48f2d8[_0x2893b7(0x130)](_0x4c5566,{'withFileTypes':!![]});for(const _0x1e71a6 of _0x4d6d79){if(!_0x1e71a6['isDirectory']())continue;if(['knowledge_bases','experimental_knowledge_bases','experimental_artifacts',_0x2893b7(0x191),_0x2893b7(0x12a)][_0x2893b7(0x184)](_0x1e71a6[_0x2893b7(0xb8)]))continue;const _0x22ebb0=a122_0x280b9[_0x2893b7(0x11f)](_0x4c5566,_0x1e71a6[_0x2893b7(0xb8)]);if(isAgentDir(_0x22ebb0)){const _0x294f83=a122_0x280b9[_0x2893b7(0x11f)](_0x22ebb0,'agent.yml'),_0x2e051b=a122_0x280b9[_0x2893b7(0x11f)](_0x22ebb0,'prompt.md'),_0x1c3a23=a122_0x280b9[_0x2893b7(0x11f)](_0x22ebb0,_0x2893b7(0x186)),_0xa0890=parseAgentYaml(a122_0x48f2d8[_0x2893b7(0x1b9)](_0x294f83,_0x2893b7(0xec)),_0x294f83),_0x2852e8=a122_0x48f2d8[_0x2893b7(0x1bc)](_0x2e051b)?a122_0x48f2d8['readFileSync'](_0x2e051b,_0x2893b7(0xec)):'',_0x3cb060=a122_0x48f2d8[_0x2893b7(0x1bc)](_0x1c3a23)?a122_0x48f2d8[_0x2893b7(0x1b9)](_0x1c3a23,_0x2893b7(0xec)):_0xa0890[_0x2893b7(0x1a5)];_0x4bda95[_0x2893b7(0x16f)]({'name':_0xa0890[_0x2893b7(0xb8)],'dir':_0x22ebb0,'yaml':_0xa0890,'systemPrompt':_0x2852e8,'starterMessage':_0x3cb060});}}const _0x13ca7d=getKnowledgeBasesDir(_0x4c5566);if(a122_0x48f2d8['existsSync'](_0x13ca7d)){const _0xa96240=a122_0x48f2d8[_0x2893b7(0x130)](_0x13ca7d);for(const _0x3ee04b of _0xa96240){const _0x502668=a122_0x280b9['join'](_0x13ca7d,_0x3ee04b);if(_0x3ee04b['endsWith']('.yml')){const _0x20b07e=parseKnowledgeBaseYaml(a122_0x48f2d8['readFileSync'](_0x502668,_0x2893b7(0xec)),_0x502668);_0x254899['push']({'name':_0x20b07e['name'],'path':_0x502668,'yaml':_0x20b07e});}else{if(_0x3ee04b[_0x2893b7(0x1d1)](_0x2893b7(0x129))){const _0x16da71=a122_0x48f2d8[_0x2893b7(0x1b9)](_0x502668,_0x2893b7(0xec)),{name:_0x3dc201,text:_0x3e49a3}=parseTextKnowledgeBaseMd(_0x16da71,_0x3ee04b);_0x5b7390[_0x2893b7(0x16f)]({'name':_0x3dc201,'path':_0x502668,'text':_0x3e49a3});}}}}const _0x1c2baa=getPromptsDir(_0x4c5566);if(a122_0x48f2d8[_0x2893b7(0x1bc)](_0x1c2baa)){const _0x5f02fc=a122_0x48f2d8[_0x2893b7(0x130)](_0x1c2baa)['filter'](_0x398232=>_0x398232[_0x2893b7(0x1d1)](_0x2893b7(0x133)));for(const _0x47cf95 of _0x5f02fc){const _0x1824f3=a122_0x280b9['join'](_0x1c2baa,_0x47cf95),_0x6ddaba=parsePromptYaml(a122_0x48f2d8['readFileSync'](_0x1824f3,_0x2893b7(0xec)),_0x1824f3);_0x409b45[_0x2893b7(0x16f)]({'name':_0x6ddaba[_0x2893b7(0xb8)],'path':_0x1824f3,'yaml':_0x6ddaba});}}const _0x12b24e=getIntegrationsDir(_0x4c5566);if(a122_0x48f2d8['existsSync'](_0x12b24e)){const _0x2db43f=a122_0x48f2d8['readdirSync'](_0x12b24e)[_0x2893b7(0xdf)](_0xfc434e=>_0xfc434e[_0x2893b7(0x1d1)](_0x2893b7(0x133)));for(const _0x3f46bd of _0x2db43f){const _0x5d4cfa=a122_0x280b9['join'](_0x12b24e,_0x3f46bd),_0x45cd63=parseIntegrationYaml(a122_0x48f2d8[_0x2893b7(0x1b9)](_0x5d4cfa,_0x2893b7(0xec)),_0x5d4cfa);SAFE_INTEGRATION_TYPES[_0x2893b7(0x184)](_0x45cd63['service_type'][_0x2893b7(0x1c0)]())?_0x2d8efe['push']({'name':_0x45cd63[_0x2893b7(0xb8)],'path':_0x5d4cfa,'yaml':_0x45cd63}):this[_0x2893b7(0x18a)][_0x2893b7(0xbd)](_0x2893b7(0xf6)+_0x45cd63[_0x2893b7(0xb8)]+_0x2893b7(0x19a)+_0x45cd63['service_type']+_0x2893b7(0x1a3)+(_0x2893b7(0x139)+SAFE_INTEGRATION_TYPES[_0x2893b7(0x11f)](',\x20')+_0x2893b7(0x1ba)));}}const _0xe1048e=getExperimentalKnowledgeBasesDir(_0x4c5566);if(a122_0x48f2d8['existsSync'](_0xe1048e)){const _0xc6b29c=a122_0x48f2d8[_0x2893b7(0x130)](_0xe1048e,{'withFileTypes':!![]});for(const _0x58d0b1 of _0xc6b29c){if(!_0x58d0b1[_0x2893b7(0x142)]())continue;const _0x41e74a=a122_0x280b9[_0x2893b7(0x11f)](_0xe1048e,_0x58d0b1['name']),_0x2f9414=a122_0x280b9[_0x2893b7(0x11f)](_0x41e74a,_0x58d0b1[_0x2893b7(0xb8)]+'.yml');if(a122_0x48f2d8[_0x2893b7(0x1bc)](_0x2f9414)){const _0x517fc1=parseExperimentalKnowledgeBaseYaml(a122_0x48f2d8[_0x2893b7(0x1b9)](_0x2f9414,'utf-8'),_0x2f9414),_0x404341=a122_0x280b9['join'](_0x41e74a,_0x2893b7(0x14f)),_0x506e91=[];if(a122_0x48f2d8['existsSync'](_0x404341)){const _0x1a5903=a122_0x48f2d8[_0x2893b7(0x130)](_0x404341,{'withFileTypes':!![]});for(const _0xa0259d of _0x1a5903){if(!_0xa0259d['isDirectory']())continue;const _0x364b66=a122_0x280b9[_0x2893b7(0x11f)](_0x404341,_0xa0259d[_0x2893b7(0xb8)]),_0x38aa2b=a122_0x280b9[_0x2893b7(0x11f)](_0x364b66,_0x2893b7(0xc7)),_0xb58d86=a122_0x280b9[_0x2893b7(0x11f)](_0x364b66,'json_schema.json');if(a122_0x48f2d8[_0x2893b7(0x1bc)](_0x38aa2b)&&a122_0x48f2d8['existsSync'](_0xb58d86)){const _0x5eb3b5=a122_0x48f2d8[_0x2893b7(0x1b9)](_0x38aa2b,_0x2893b7(0xec)),_0xfc6ba6=a122_0x48f2d8[_0x2893b7(0x1b9)](_0xb58d86,_0x2893b7(0xec));_0x506e91[_0x2893b7(0x16f)]({'name':_0xa0259d[_0x2893b7(0xb8)],'code':_0x5eb3b5,'json_schema':_0xfc6ba6});}}}const _0x12d2e7={..._0x517fc1,'functions':_0x506e91};_0x334377[_0x2893b7(0x16f)]({'name':_0x517fc1['name'],'path':_0x41e74a,'def':_0x12d2e7});}}}const _0x39b395=getExperimentalArtifactsDir(_0x4c5566);if(a122_0x48f2d8['existsSync'](_0x39b395)){const _0xda0260=a122_0x48f2d8[_0x2893b7(0x130)](_0x39b395,{'withFileTypes':!![]});for(const _0x432e84 of _0xda0260){if(!_0x432e84[_0x2893b7(0x142)]())continue;const _0x5c4328=a122_0x280b9[_0x2893b7(0x11f)](_0x39b395,_0x432e84[_0x2893b7(0xb8)]),_0x293dc2=a122_0x280b9[_0x2893b7(0x11f)](_0x5c4328,_0x432e84[_0x2893b7(0xb8)]+_0x2893b7(0x133));if(a122_0x48f2d8['existsSync'](_0x293dc2)){const _0x4feffb=parseExperimentalArtifactYaml(a122_0x48f2d8['readFileSync'](_0x293dc2,_0x2893b7(0xec)),_0x293dc2),_0x2305ac=a122_0x280b9[_0x2893b7(0x11f)](_0x5c4328,_0x2893b7(0xc7)),_0x5c83c9=a122_0x48f2d8[_0x2893b7(0x1bc)](_0x2305ac)?a122_0x48f2d8[_0x2893b7(0x1b9)](_0x2305ac,_0x2893b7(0xec)):'',_0x26110c=a122_0x280b9['join'](_0x5c4328,'files'),_0x200a41=[];if(a122_0x48f2d8[_0x2893b7(0x1bc)](_0x26110c)){const _0x4db7bf=a122_0x48f2d8[_0x2893b7(0x130)](_0x26110c);for(const _0x1b8931 of _0x4db7bf){const _0x2d9f62=a122_0x280b9[_0x2893b7(0x11f)](_0x26110c,_0x1b8931);if(a122_0x48f2d8[_0x2893b7(0x1d4)](_0x2d9f62)['isFile']()){const _0x5b42d1=a122_0x48f2d8[_0x2893b7(0x1b9)](_0x2d9f62,_0x2893b7(0xec));_0x200a41[_0x2893b7(0x16f)]({'file_name':_0x1b8931,'text_content':_0x5b42d1});}}}const _0x58f9a7={..._0x4feffb,'code':_0x5c83c9,'files':_0x200a41};_0x523bc8[_0x2893b7(0x16f)]({'name':_0x4feffb[_0x2893b7(0xb8)],'path':_0x5c4328,'def':_0x58f9a7});}}}}else{const _0x2e7caf=await this[_0x2893b7(0x1b1)](_0x4c5566),_0x34e5b1=await this[_0x2893b7(0x124)][_0x2893b7(0xb9)](_0x2e7caf);_0x15b9ee=_0x34e5b1['attributes'][_0x2893b7(0xb8)];const _0x5a2299=await this[_0x2893b7(0x124)][_0x2893b7(0x18d)](_0x2e7caf),_0x2c66ce=await this[_0x2893b7(0x124)]['listKnowledgeBases'](_0x2e7caf),_0x4ea419=await this['client'][_0x2893b7(0x13c)](_0x2e7caf),_0x2c49d4=await this[_0x2893b7(0x124)][_0x2893b7(0x1c2)](_0x2e7caf),_0x41dfbf=await this[_0x2893b7(0x124)][_0x2893b7(0x101)](_0x2e7caf),_0x1e8c49=await safeListOrEmpty(()=>this[_0x2893b7(0x124)][_0x2893b7(0x1c4)](_0x2e7caf)),_0x4ebfe8=await safeListOrEmpty(()=>this[_0x2893b7(0x124)][_0x2893b7(0x17b)](_0x2e7caf)),_0x2b8129=new Map(),_0x5a1bde=new Map(),_0x203456=new Map(),_0x585232=new Map(),_0x5a2022=new Map(),_0x52f6e6=new Map();for(const _0xcb9bf2 of _0x2c66ce){_0x2b8129['set'](_0xcb9bf2['id'],_0xcb9bf2[_0x2893b7(0x187)]['name']);}for(const _0x441d17 of _0x4ea419){_0x5a1bde[_0x2893b7(0x100)](_0x441d17['id'],_0x441d17['attributes'][_0x2893b7(0xb8)]);}for(const _0x525262 of _0x5a2299){_0x203456[_0x2893b7(0x100)](_0x525262['id'],_0x525262['attributes'][_0x2893b7(0xb8)]);}for(const _0x337937 of _0x2c49d4){_0x585232[_0x2893b7(0x100)](_0x337937['id'],_0x337937[_0x2893b7(0x187)][_0x2893b7(0xb8)]);}for(const _0x59e6cb of _0x1e8c49){_0x5a2022[_0x2893b7(0x100)](_0x59e6cb['id'],_0x59e6cb[_0x2893b7(0x187)][_0x2893b7(0xb8)]);}for(const _0x118c49 of _0x4ebfe8){_0x52f6e6['set'](_0x118c49['id'],_0x118c49[_0x2893b7(0x187)][_0x2893b7(0xb8)]);}const _0x3b72f1={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x2b8129,'TextKnowledgeBase':_0x5a1bde,'Agent':_0x203456,'ExperimentalKnowledgeBase':_0x5a2022}),'resolvePromptName':async _0x3172be=>_0x585232['get'](_0x3172be),'onWarning':_0x3ab102=>this[_0x2893b7(0x18a)][_0x2893b7(0xbd)](_0x3ab102)};for(const _0x215d65 of _0x5a2299){const _0x4e4126=await agentResponseToDef(_0x215d65,_0x3b72f1),{yaml:_0x25028f,systemPrompt:_0x3e8309,starterMessage:_0x11f422}=_0x4e4126;_0x4bda95[_0x2893b7(0x16f)]({'name':_0x25028f['name'],'dir':'','yaml':_0x25028f,'systemPrompt':_0x3e8309,'starterMessage':_0x11f422});}for(const _0x22d4b4 of _0x2c66ce){const _0x486b1b=apiKnowledgeBaseToYaml(_0x22d4b4);_0x254899['push']({'name':_0x486b1b[_0x2893b7(0xb8)],'path':'','yaml':_0x486b1b});}for(const _0x55c8aa of _0x4ea419){_0x5b7390[_0x2893b7(0x16f)]({'name':_0x55c8aa[_0x2893b7(0x187)][_0x2893b7(0xb8)],'path':'','text':_0x55c8aa['attributes'][_0x2893b7(0x16a)]});}for(const _0x36c26b of _0x2c49d4){const _0x41719e=await apiPromptToYaml(_0x36c26b,_0x3b72f1);_0x41719e&&_0x409b45[_0x2893b7(0x16f)]({'name':_0x41719e[_0x2893b7(0xb8)],'path':'','yaml':_0x41719e});}for(const _0x2a0611 of _0x41dfbf){if(!_0x2a0611['attributes']['isManaged']&&SAFE_INTEGRATION_TYPES[_0x2893b7(0x184)](_0x2a0611['attributes'][_0x2893b7(0xf4)]['toLowerCase']())){const _0xbd8a55=await apiIntegrationToYaml(_0x2a0611,_0x3b72f1);_0x2d8efe[_0x2893b7(0x16f)]({'name':_0x2a0611[_0x2893b7(0x187)][_0x2893b7(0xf4)][_0x2893b7(0x1c0)](),'path':'','yaml':_0xbd8a55});}}for(const _0x796d0 of _0x1e8c49){const _0x524774=apiExperimentalKnowledgeBaseToYaml(_0x796d0);_0x334377[_0x2893b7(0x16f)]({'name':_0x524774[_0x2893b7(0xb8)],'path':'','def':_0x524774});}for(const _0x27ad89 of _0x4ebfe8){const _0x1c1efb=apiExperimentalArtifactToYaml(_0x27ad89);_0x523bc8[_0x2893b7(0x16f)]({'name':_0x1c1efb[_0x2893b7(0xb8)],'path':'','def':_0x1c1efb});}}const _0x154fde={'sourceProjectName':_0x15b9ee,'newProjectName':_0xfb450e,'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}}},_0x2e1374=await this[_0x2893b7(0x124)][_0x2893b7(0xed)](),_0x2eb46f=_0x2e1374[_0x2893b7(0xde)](_0x149f22=>_0x149f22[_0x2893b7(0x187)][_0x2893b7(0xb8)]===_0xfb450e);if(_0x2eb46f)throw new SDKError(ErrorCode[_0x2893b7(0x1cb)],'Project\x20\x22'+_0xfb450e+_0x2893b7(0x15f),undefined,{'helpText':_0x2893b7(0x19f)});if(_0x328880?.[_0x2893b7(0x146)])return _0x154fde[_0x2893b7(0xd6)][_0x2893b7(0x148)][_0x2893b7(0x18b)]=_0x4bda95[_0x2893b7(0xc5)],_0x154fde['counts'][_0x2893b7(0x162)][_0x2893b7(0x18b)]=_0x254899[_0x2893b7(0xc5)],_0x154fde[_0x2893b7(0xd6)][_0x2893b7(0xd2)][_0x2893b7(0x18b)]=_0x5b7390[_0x2893b7(0xc5)],_0x154fde[_0x2893b7(0xd6)]['experimentalKnowledgeBases'][_0x2893b7(0x18b)]=_0x334377[_0x2893b7(0xc5)],_0x154fde[_0x2893b7(0xd6)][_0x2893b7(0x1ad)][_0x2893b7(0x18b)]=_0x523bc8[_0x2893b7(0xc5)],_0x154fde['counts'][_0x2893b7(0x191)][_0x2893b7(0x18b)]=_0x409b45[_0x2893b7(0xc5)],_0x154fde[_0x2893b7(0xd6)][_0x2893b7(0x12a)][_0x2893b7(0x18b)]=_0x2d8efe[_0x2893b7(0xc5)],_0x154fde;const _0x33d5bb=await this[_0x2893b7(0x124)][_0x2893b7(0x106)]({'name':_0xfb450e}),_0x58cbee=_0x33d5bb['id'];_0x154fde['newProjectId']=_0x58cbee;const _0x17a076=new Map(),_0x319b3a=new Map(),_0x3592e8=new Map(),_0x4bca65=new Map(),_0x39aff7=new Map(),_0x2ddb63=new Map(),_0x40b1c2=new Map(),_0x5106b8=new Map(),_0x3e1166=new Set(),_0x21d40d=new Set();for(const _0x4e97de of _0x4bda95){for(const _0x305433 of _0x4e97de[_0x2893b7(0xf7)][_0x2893b7(0x181)]||[]){if(_0x305433['type']===_0x2893b7(0x17f)&&_0x305433[_0x2893b7(0xf2)]){const _0x6aac81=parseRef(_0x305433['target']);if(_0x6aac81)_0x3e1166[_0x2893b7(0x11e)](_0x6aac81[_0x2893b7(0xb8)]);}else{if(_0x305433['type']==='web_search'&&_0x305433['target']){const _0x193ed6=parseRef(_0x305433[_0x2893b7(0xf2)]);if(_0x193ed6)_0x21d40d['add'](_0x193ed6[_0x2893b7(0xb8)]);}}}}for(const _0xec7af4 of _0x3e1166){try{const _0x296f95=await this['client'][_0x2893b7(0xfc)]({'projectId':_0x58cbee,'name':_0xec7af4});_0x39aff7[_0x2893b7(0x100)](_0xec7af4,_0x296f95['id']),_0x154fde['imageGenerators']['push']({'name':_0xec7af4,'action':_0x2893b7(0x18b),'id':_0x296f95['id']}),_0x154fde[_0x2893b7(0xd6)][_0x2893b7(0xd4)]['created']++;}catch(_0x5518ff){_0x154fde[_0x2893b7(0xd4)][_0x2893b7(0x16f)]({'name':_0xec7af4,'action':'error','error':_0x5518ff['message']}),_0x154fde[_0x2893b7(0xd6)][_0x2893b7(0xd4)][_0x2893b7(0xbb)]++;}}for(const _0x37e1ac of _0x21d40d){try{const _0x1b354f=await this['client'][_0x2893b7(0x1a9)]({'projectId':_0x58cbee,'name':_0x37e1ac});_0x2ddb63[_0x2893b7(0x100)](_0x37e1ac,_0x1b354f['id']),_0x154fde[_0x2893b7(0xbf)]['push']({'name':_0x37e1ac,'action':_0x2893b7(0x18b),'id':_0x1b354f['id']}),_0x154fde[_0x2893b7(0xd6)]['webSearchTools'][_0x2893b7(0x18b)]++;}catch(_0x1f8db5){_0x154fde[_0x2893b7(0xbf)][_0x2893b7(0x16f)]({'name':_0x37e1ac,'action':_0x2893b7(0xe8),'error':_0x1f8db5['message']}),_0x154fde[_0x2893b7(0xd6)]['webSearchTools'][_0x2893b7(0xbb)]++;}}const _0x4c5caa=await fetchAllToolTargetMaps((_0x48b9fc,_0x37211f)=>this[_0x2893b7(0x124)][_0x2893b7(0x153)](_0x48b9fc,_0x37211f),_0x58cbee);let _0x5368dc=[];const _0x34d100={'projectId':_0x58cbee,'resolveToolTargetId':buildIdResolver({..._0x4c5caa[_0x2893b7(0x1c3)],'KnowledgeBase':_0x17a076,'TextKnowledgeBase':_0x319b3a,'ExperimentalKnowledgeBase':_0x40b1c2,'Agent':_0x3592e8,'WebSearchTool':_0x2ddb63,'ImageGenerator':_0x39aff7}),'resolvePromptId':async _0xf48371=>_0x4bca65[_0x2893b7(0xba)](_0xf48371),'onWarning':_0xf268c5=>{const _0x26fb25=_0x2893b7;this['logger'][_0x26fb25(0xbd)](_0xf268c5),_0x5368dc[_0x26fb25(0x16f)](_0xf268c5);}};for(const _0x461a71 of _0x254899){try{const _0x5c295a=yamlKnowledgeBaseToApi(_0x461a71['yaml'],_0x58cbee),_0x3a9a8f=await this[_0x2893b7(0x124)][_0x2893b7(0x156)](_0x5c295a);_0x17a076[_0x2893b7(0x100)](_0x461a71['yaml']['name'],_0x3a9a8f['id']),_0x154fde[_0x2893b7(0x162)][_0x2893b7(0x16f)]({'name':_0x461a71[_0x2893b7(0xf7)][_0x2893b7(0xb8)],'action':'created','id':_0x3a9a8f['id']}),_0x154fde[_0x2893b7(0xd6)][_0x2893b7(0x162)][_0x2893b7(0x18b)]++;}catch(_0x1302cf){_0x154fde['knowledgeBases'][_0x2893b7(0x16f)]({'name':_0x461a71['yaml'][_0x2893b7(0xb8)],'action':_0x2893b7(0xe8),'error':_0x1302cf[_0x2893b7(0x12e)]}),_0x154fde[_0x2893b7(0xd6)][_0x2893b7(0x162)][_0x2893b7(0xbb)]++;}}for(const _0x1c0a7f of _0x5b7390){try{const _0x1eb3cf=yamlTextKnowledgeBaseToApi({'name':_0x1c0a7f['name'],'text':_0x1c0a7f[_0x2893b7(0x16a)]},_0x58cbee),_0x128214=await this[_0x2893b7(0x124)][_0x2893b7(0x171)](_0x1eb3cf);_0x319b3a[_0x2893b7(0x100)](_0x1c0a7f[_0x2893b7(0xb8)],_0x128214['id']),_0x154fde['textKnowledgeBases']['push']({'name':_0x1c0a7f[_0x2893b7(0xb8)],'action':_0x2893b7(0x18b),'id':_0x128214['id']}),_0x154fde[_0x2893b7(0xd6)][_0x2893b7(0xd2)][_0x2893b7(0x18b)]++;}catch(_0x27aa82){_0x154fde[_0x2893b7(0xd2)][_0x2893b7(0x16f)]({'name':_0x1c0a7f[_0x2893b7(0xb8)],'action':'error','error':_0x27aa82[_0x2893b7(0x12e)]}),_0x154fde['counts'][_0x2893b7(0xd2)]['errors']++;}}for(const _0x52ad9a of _0x523bc8){try{const _0x38cf4b=yamlExperimentalArtifactToApi(_0x52ad9a[_0x2893b7(0xc9)],_0x58cbee),_0x5eaa80=await this[_0x2893b7(0x124)][_0x2893b7(0x180)](_0x38cf4b);_0x5106b8[_0x2893b7(0x100)](_0x52ad9a[_0x2893b7(0xc9)][_0x2893b7(0xb8)],_0x5eaa80['id']),_0x154fde['experimentalArtifacts'][_0x2893b7(0x16f)]({'name':_0x52ad9a[_0x2893b7(0xc9)][_0x2893b7(0xb8)],'action':_0x2893b7(0x18b),'id':_0x5eaa80['id']}),_0x154fde['counts']['experimentalArtifacts'][_0x2893b7(0x18b)]++;}catch(_0x5d0e31){_0x154fde[_0x2893b7(0x1ad)][_0x2893b7(0x16f)]({'name':_0x52ad9a[_0x2893b7(0xc9)][_0x2893b7(0xb8)],'action':_0x2893b7(0xe8),'error':_0x5d0e31[_0x2893b7(0x12e)]}),_0x154fde[_0x2893b7(0xd6)][_0x2893b7(0x1ad)][_0x2893b7(0xbb)]++;}}for(const _0x427211 of _0x334377){try{const _0x47ea5c=yamlExperimentalKnowledgeBaseToApi(_0x427211[_0x2893b7(0xc9)],_0x58cbee),_0x5800fc=await this['client']['createExperimentalKnowledgeBase'](_0x47ea5c);_0x40b1c2['set'](_0x427211[_0x2893b7(0xc9)][_0x2893b7(0xb8)],_0x5800fc['id']),_0x154fde[_0x2893b7(0x163)][_0x2893b7(0x16f)]({'name':_0x427211[_0x2893b7(0xc9)]['name'],'action':_0x2893b7(0x18b),'id':_0x5800fc['id']}),_0x154fde[_0x2893b7(0xd6)][_0x2893b7(0x163)]['created']++;}catch(_0x22a518){_0x154fde[_0x2893b7(0x163)][_0x2893b7(0x16f)]({'name':_0x427211[_0x2893b7(0xc9)]['name'],'action':_0x2893b7(0xe8),'error':_0x22a518['message']}),_0x154fde['counts'][_0x2893b7(0x163)][_0x2893b7(0xbb)]++;}}const _0x5ca8d8=[..._0x4bda95][_0x2893b7(0xcf)]((_0x2170ea,_0x5e3677)=>{const _0x3126cc=_0x2893b7,_0x56cf6b=_0x2170ea['yaml']['tools']?.[_0x3126cc(0xe9)](_0x217301=>_0x217301[_0x3126cc(0x189)]===_0x3126cc(0x143))??![],_0x26802e=_0x5e3677[_0x3126cc(0xf7)][_0x3126cc(0x181)]?.[_0x3126cc(0xe9)](_0x1a58bc=>_0x1a58bc[_0x3126cc(0x189)]===_0x3126cc(0x143))??![];if(_0x56cf6b&&!_0x26802e)return 0x1;if(!_0x56cf6b&&_0x26802e)return-0x1;return 0x0;});for(const _0x1588a6 of _0x5ca8d8){_0x5368dc=[];try{const _0x41ef9c=_0x1588a6[_0x2893b7(0xf7)]['tools']?.[_0x2893b7(0xdf)](_0x25ae7a=>{const _0x3606d1=_0x2893b7;if(_0x25ae7a[_0x3606d1(0x189)]===_0x3606d1(0x143)&&_0x25ae7a[_0x3606d1(0xf2)]){const _0x1c0b06=parseRef(_0x25ae7a['target']);return _0x1c0b06?.[_0x3606d1(0xb8)]===_0x1588a6[_0x3606d1(0xf7)][_0x3606d1(0xb8)];}return![];})??[];if(_0x41ef9c[_0x2893b7(0xc5)]>0x0){const _0x2175bd=_0x2893b7(0x1ac)+_0x1588a6['yaml']['name']+'\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20'+_0x2893b7(0x19e);this[_0x2893b7(0x18a)][_0x2893b7(0xbd)](_0x2175bd),_0x5368dc[_0x2893b7(0x16f)](_0x2175bd);}const _0x2c9f05=await agentDefToRequest(_0x1588a6[_0x2893b7(0xf7)],_0x1588a6['systemPrompt'],_0x1588a6[_0x2893b7(0x164)],_0x34d100),_0x45640b=await this[_0x2893b7(0x124)][_0x2893b7(0x13d)](_0x2c9f05);_0x3592e8[_0x2893b7(0x100)](_0x1588a6[_0x2893b7(0xf7)][_0x2893b7(0xb8)],_0x45640b['id']),_0x154fde[_0x2893b7(0x148)][_0x2893b7(0x16f)]({'agentName':_0x1588a6['yaml'][_0x2893b7(0xb8)],'action':_0x2893b7(0x18b),'agentId':_0x45640b['id'],'warnings':_0x5368dc[_0x2893b7(0xc5)]>0x0?_0x5368dc:undefined}),_0x154fde[_0x2893b7(0xd6)][_0x2893b7(0x148)]['created']++;}catch(_0x220836){_0x154fde[_0x2893b7(0x148)][_0x2893b7(0x16f)]({'agentName':_0x1588a6[_0x2893b7(0xf7)][_0x2893b7(0xb8)],'action':_0x2893b7(0xe8),'error':_0x220836[_0x2893b7(0x12e)],'warnings':_0x5368dc['length']>0x0?_0x5368dc:undefined}),_0x154fde[_0x2893b7(0xd6)]['agents'][_0x2893b7(0xbb)]++;}}for(const _0x2a131e of _0x409b45){try{const _0x3e54c0=await yamlPromptToApi(_0x2a131e[_0x2893b7(0xf7)],_0x58cbee,_0x34d100);if(!_0x3e54c0){_0x154fde[_0x2893b7(0x191)][_0x2893b7(0x16f)]({'name':_0x2a131e[_0x2893b7(0xf7)]['name'],'action':'error','error':_0x2893b7(0x134)}),_0x154fde['counts'][_0x2893b7(0x191)][_0x2893b7(0xbb)]++;continue;}const _0x2cfbaf=await this[_0x2893b7(0x124)][_0x2893b7(0x169)](_0x3e54c0);_0x4bca65[_0x2893b7(0x100)](_0x2a131e[_0x2893b7(0xf7)][_0x2893b7(0xb8)],_0x2cfbaf['id']),_0x154fde['prompts']['push']({'name':_0x2a131e[_0x2893b7(0xf7)][_0x2893b7(0xb8)],'action':_0x2893b7(0x18b),'id':_0x2cfbaf['id']}),_0x154fde[_0x2893b7(0xd6)][_0x2893b7(0x191)][_0x2893b7(0x18b)]++;}catch(_0x3c47bb){_0x154fde['prompts']['push']({'name':_0x2a131e[_0x2893b7(0xf7)][_0x2893b7(0xb8)],'action':_0x2893b7(0xe8),'error':_0x3c47bb[_0x2893b7(0x12e)]}),_0x154fde[_0x2893b7(0xd6)][_0x2893b7(0x191)]['errors']++;}}for(const _0xd3ce65 of _0x2d8efe){try{const _0x202136=await yamlIntegrationToApi(_0xd3ce65['yaml'],_0x58cbee,_0x34d100),_0x7b995c=await this[_0x2893b7(0x124)][_0x2893b7(0xcc)](_0x202136);_0x154fde[_0x2893b7(0x12a)]['push']({'name':_0xd3ce65['yaml']['service_type'],'action':_0x2893b7(0x18b),'id':_0x7b995c['id']}),_0x154fde[_0x2893b7(0xd6)][_0x2893b7(0x12a)][_0x2893b7(0x18b)]++;}catch(_0x5d6d1d){_0x154fde[_0x2893b7(0x12a)][_0x2893b7(0x16f)]({'name':_0xd3ce65['yaml']['service_type'],'action':_0x2893b7(0xe8),'error':_0x5d6d1d[_0x2893b7(0x12e)]}),_0x154fde['counts'][_0x2893b7(0x12a)][_0x2893b7(0xbb)]++;}}return _0x154fde;}}
1
+ const a122_0x1a5445=a122_0x2819;(function(_0x581bac,_0x2bfda9){const _0x55cd0b=a122_0x2819,_0xa40d42=_0x581bac();while(!![]){try{const _0x247c7b=parseInt(_0x55cd0b(0x12f))/0x1*(parseInt(_0x55cd0b(0x117))/0x2)+parseInt(_0x55cd0b(0x138))/0x3+parseInt(_0x55cd0b(0x118))/0x4*(parseInt(_0x55cd0b(0x1d4))/0x5)+-parseInt(_0x55cd0b(0x126))/0x6+-parseInt(_0x55cd0b(0x1ae))/0x7+-parseInt(_0x55cd0b(0x19c))/0x8+parseInt(_0x55cd0b(0x1ad))/0x9;if(_0x247c7b===_0x2bfda9)break;else _0xa40d42['push'](_0xa40d42['shift']());}catch(_0x460092){_0xa40d42['push'](_0xa40d42['shift']());}}}(a122_0x2fb0,0x48d06));import{LLMApiClient}from'../client/llm-api-client.js';import*as a122_0x5102fc from'node:fs';import*as a122_0x1dfc50 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';function a122_0x2fb0(){const _0x63497c=['Renamed\x20agent\x20folder:\x20','Available\x20agents:\x20','yaml','file_name','context','web_search','5qvJmCs','chat','getOrCreateDefaultProject','unlinkSync','some','path','listPrompts','text_content','writeFileSync','257415ayIREm','json_schema.json','has','textKnowledgeBases','project.json','Only\x20safe\x20types\x20(','\x0a---\x20schema:\x20',')\x20can\x20be\x20cloned.','createExperimentalKnowledgeBase','agents.json','variables','updateTextKnowledgeBase','name','availableModelNames','displayName','dirname','filter','---\x20schema:\x20','NOT_FOUND','set','.md','keys','deleteAgent','warn','dir','readdirSync','project','isManaged','Renamed\x20integration\x20file:\x20','TextKnowledgeBase','integrations.json','KnowledgeBase','chat_generic','Renamed\x20experimental\x20artifact\x20directory:\x20','chats','\x22\x20already\x20exists','projectName','INTERNAL','\x0a\x0a#\x20agent.yml\x0a','event','Agent\x20reference\x20not\x20found','content','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','agentId','oldPath','.yml','isDir','updated','unchanged','listWebSearchTools','statSync','pushProject','imageGenerators','dryRun','attributes','Renamed\x20KB\x20file:\x20','tdx_','stringify','rmSync','Renamed\x20folder:\x20','utf-8','createIntegration','cloneProject','createKnowledgeBase','Agent\x20\x27','prompts.json','promptId','listIntegrations','webSearchTools','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','sort','\x0a---\x20code\x20---\x0a','push','resolveProjectId','getProject','prompts','already\x20exists','systemPrompt','Multiple\x20projects\x20found\x20with\x20name\x20\x27','listProjects','listExperimentalArtifacts','errors','mkdirSync','listTextKnowledgeBases','isDirectory','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','\x0a---\x20function:\x20','action','experimentalKnowledgeBases','map','AGENT_NOT_FOUND','template','duplicate','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','existsSync','toLowerCase','resolveAgentId','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','listToolTargets','createAgentResponse','657944TwBuHT','counts','\x27.\x20This\x20should\x20not\x20happen.','files','deleteProject','experimentalArtifacts','text','profile','conflict','isFile','projects','PERMISSION_DENIED','code.js','webhookCorsOrigins','high','getDefaultProjectName','createProject','9323442OBQuva','3037762OiKBmz','.llm','tools','length','\x27\x20(','error','outputs','listAgents','pullProject','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','createAgent','serviceType',')\x20can\x20be\x20pushed.\x20','prompt.md','jsonSchemaHint','getUserSettings','chat_parent_segment','listExperimentalKnowledgeBases','starterMessage','def','Output\x20directory\x20already\x20exists:\x20','basename','starter_message','slackMessageMode','chatIgnoreManagedActions','restoreProject','agents','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','message','total','ALREADY_EXISTS','Renamed\x20text\x20KB\x20file:\x20','updateExperimentalArtifact','info','No\x20tdx.json\x20found\x20in\x20','none','listChats','integrations','5pSvbgJ','Renamed\x20experimental\x20KB\x20directory:\x20','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','service_type','medium','currentProjectId','type','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','Project\x20not\x20found:\x20','localeCompare','agent','image_gen','find','tdx_default_','updateExperimentalKnowledgeBase','renamed','experimental_artifacts','getCurrentProject','starter_message.md','llm_project','get','history','readFileSync','Renamed\x20prompt\x20file:\x20','\x20→\x20','pushAgent','client','tables','description','metadata','):\x20','projectId','\x20---\x0a','parse','code','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','includes','knowledge_bases','endsWith','claude-4.5-sonnet','getChatLog','Multiple\x20agents\x20found\x20with\x20name\x20\x27','new','size','_reasoning_','createPrompt','actions','json_schema','cwd','createExperimentalArtifact','site','knowledgeBases','Removed\x20deleted\x20file:\x20','Unable\x20to\x20create\x20project\x20after\x20','add','availableModels','dry-run-','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','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.','INVALID_ARGUMENT','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','getBackupMetadata','deleteIntegration','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','listKnowledgeBases','listAgentsFull','getAgent','signal','resolveProjectName','tdx.json','Unresolved\x20dependencies:\x20','join','getOrCreateDefaultAgent','pullAgent','agent.yml','created','createImageGenerator','startChat','newProjectId','exportedFrom','setCurrentProject','5582FhnMFb','927724FcCVnv','functions','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','reasoningEffort','updateAgentResponse','loadJsonFile','#\x20prompt.md\x0a','setDefaultAgent','logger','target','nameToId','experimental_knowledge_bases','createTextKnowledgeBase','status','3319044YSlPDR','---\x20file:\x20','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat'];a122_0x2fb0=function(){return _0x63497c;};return a122_0x2fb0();}import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';function a122_0x2819(_0xd76386,_0x306d86){_0xd76386=_0xd76386-0x103;const _0x2fb0b4=a122_0x2fb0();let _0x281918=_0x2fb0b4[_0xd76386];return _0x281918;}import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a122_0x1a5445(0x158),'chat_agent_console',a122_0x1a5445(0x1be)];async function safeListOrEmpty(_0x8f349a){const _0x1f9409=a122_0x1a5445;try{return await _0x8f349a();}catch(_0xde5b0b){if(_0xde5b0b instanceof HTTPClientError&&_0xde5b0b[_0x1f9409(0x125)]===0x194)return[];throw _0xde5b0b;}}export class LLMSDK{['currentProjectId'];[a122_0x1a5445(0x1ee)];[a122_0x1a5445(0x12d)];[a122_0x1a5445(0x120)]=Logger['of']('sdk.llm');constructor(_0x13eea6){const _0x39ddc7=a122_0x1a5445;this[_0x39ddc7(0x1ee)]=new LLMApiClient(_0x13eea6),this['context']=_0x13eea6;}['getDefaultProjectName'](){const _0x22a95e=a122_0x1a5445,_0x542d39=getSanitizedUsername();return _0x22a95e(0x1e1)+_0x542d39;}async[a122_0x1a5445(0x116)](_0x5c9606){const _0x33a5a1=a122_0x1a5445,{projectId:_0x57910a}=await this['resolveProjectName'](_0x5c9606);this[_0x33a5a1(0x1d9)]=_0x57910a;}[a122_0x1a5445(0x1e5)](){return this['currentProjectId'];}async[a122_0x1a5445(0x11f)](_0x3a114a){const _0x48304a=a122_0x1a5445,_0x18c2db=this['context']['profile'];let _0x2c1282,_0x314c7c;if(_0x3a114a[_0x48304a(0x1f8)]('/')){const _0x4c118c=_0x3a114a['split']('/');if(_0x4c118c[_0x48304a(0x1b1)]!==0x2)throw new SDKError(ErrorCode[_0x48304a(0x20f)],'Invalid\x20agent\x20reference\x20format:\x20'+_0x3a114a,undefined,{'helpText':_0x48304a(0x1d6)});const [_0x11cf0b,_0x318edf]=_0x4c118c;_0x2c1282=await this[_0x48304a(0x181)](_0x11cf0b),_0x314c7c=_0x318edf;}else _0x2c1282=this[_0x48304a(0x1d9)]||(await this[_0x48304a(0x131)]())['id'],_0x314c7c=_0x3a114a;const _0x3740c9=await this['resolveAgentId'](_0x314c7c,_0x2c1282),_0x54b48f=await this[_0x48304a(0x1ee)][_0x48304a(0x108)](_0x3740c9);writeCachedLLMAgent(_0x54b48f['attributes'][_0x48304a(0x144)],_0x3740c9,_0x2c1282,_0x18c2db);}['getDefaultAgent'](){const _0x870986=this['context']['profile'];return readCachedLLMAgent(_0x870986)||undefined;}['clearDefaultAgent'](){const _0x1d88f4=a122_0x1a5445,_0x5eacef=this[_0x1d88f4(0x12d)][_0x1d88f4(0x1a3)];clearCachedLLMAgent(_0x5eacef);}async['models'](){const _0x2c0351=a122_0x1a5445,_0xa96d72=await this['client'][_0x2c0351(0x1bd)](),_0x2aac64=[];for(const _0x40db75 of _0xa96d72[_0x2c0351(0x145)]){const _0x190815=_0xa96d72[_0x2c0351(0x20b)][_0x40db75];_0x190815&&_0x2aac64[_0x2c0351(0x180)]({'name':_0x40db75,'displayName':_0x190815[_0x2c0351(0x146)]});}return _0x2aac64;}async[a122_0x1a5445(0x1ac)](_0x55dfde){const _0xbbee62=a122_0x1a5445;return await this['client'][_0xbbee62(0x1ac)](_0x55dfde);}async[a122_0x1a5445(0x1a0)](_0x171f7e){const _0x59c135=a122_0x1a5445,{projectId:_0x37d4ce}=await this['resolveProjectName'](_0x171f7e);await this[_0x59c135(0x1ee)]['deleteProject'](_0x37d4ce);}async[a122_0x1a5445(0x1a6)](_0x52e0a3=0x32){const _0x28fc0f=a122_0x1a5445;return await this[_0x28fc0f(0x1ee)][_0x28fc0f(0x187)](_0x52e0a3);}async['getOrCreateDefaultProject'](_0x5e2f7a){const _0x12b380=a122_0x1a5445,_0x25c63a=_0x5e2f7a||this[_0x12b380(0x1ab)](),_0x2fc112=this[_0x12b380(0x12d)]['profile'];if(!_0x5e2f7a){const _0x3bb6d8=readCachedLLMProject(_0x2fc112);if(_0x3bb6d8&&_0x3bb6d8[_0x12b380(0x144)]===_0x25c63a)try{const _0x54bbf4=await this[_0x12b380(0x1ee)][_0x12b380(0x182)](_0x3bb6d8['id']);if(_0x54bbf4[_0x12b380(0x16e)][_0x12b380(0x144)]===_0x25c63a)return _0x54bbf4;}catch{}}const _0x18ca2d=await this[_0x12b380(0x1ee)]['listProjects'](),_0x4657e2=_0x18ca2d[_0x12b380(0x1e0)](_0x8366c9=>_0x8366c9[_0x12b380(0x16e)][_0x12b380(0x144)]===_0x25c63a);if(_0x4657e2)return!_0x5e2f7a&&writeCachedLLMProject(_0x25c63a,_0x4657e2['id'],_0x2fc112),_0x4657e2;const _0x3b88bf=await this[_0x12b380(0x1ee)][_0x12b380(0x1ac)]({'name':_0x25c63a,'description':_0x12b380(0x195)+getSanitizedUsername()+')'});return!_0x5e2f7a&&writeCachedLLMProject(_0x25c63a,_0x3b88bf['id'],_0x2fc112),_0x3b88bf;}async['resolveProjectId'](_0x55dda3){const _0xca7cdf=a122_0x1a5445,_0x27a9fb=await this[_0xca7cdf(0x1ee)]['listProjects'](),_0x3a1cd2=_0x27a9fb[_0xca7cdf(0x148)](_0xc753b6=>_0xc753b6[_0xca7cdf(0x16e)]['name']===_0x55dda3);if(_0x3a1cd2[_0xca7cdf(0x1b1)]===0x0)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0xca7cdf(0x1dc)+_0x55dda3,undefined,{'helpText':_0xca7cdf(0x162)});if(_0x3a1cd2['length']>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0xca7cdf(0x186)+_0x55dda3+'\x27.\x20This\x20should\x20not\x20happen.');return _0x3a1cd2[0x0]['id'];}async['resolveProjectName'](_0x214123){const _0x2f81f0=a122_0x1a5445,_0x424b32=await this['client'][_0x2f81f0(0x187)](),_0x366b26=_0x424b32['find'](_0x4fc10a=>_0x4fc10a[_0x2f81f0(0x16e)][_0x2f81f0(0x144)]===_0x214123);if(_0x366b26)return{'projectId':_0x366b26['id'],'project':_0x366b26};throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0x214123,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async[a122_0x1a5445(0x10e)](_0x2d6b83=a122_0x1a5445(0x1fb),_0x2978d5=0x0,_0x5c787f){const _0x24b648=a122_0x1a5445,_0x2b7fd1=0xa;let _0x462495=0x0,_0x43edc4;while(_0x462495<_0x2b7fd1){try{const _0x380160=await this[_0x24b648(0x131)](_0x43edc4),_0x5484e2=_0x380160['id'],_0x5b13a7=[_0x24b648(0x1d1),'minimal','low',_0x24b648(0x1d8),_0x24b648(0x1aa)],_0x278078=_0x2978d5===0x0?_0x24b648(0x170)+_0x2d6b83:_0x24b648(0x170)+_0x2d6b83+_0x24b648(0x200)+_0x5b13a7[_0x2978d5],_0x28725f=await this[_0x24b648(0x1ee)][_0x24b648(0x1b5)](_0x5484e2),_0x1d445e=_0x28725f['find'](_0x574919=>_0x574919['attributes'][_0x24b648(0x144)]===_0x278078);if(_0x1d445e)return _0x1d445e;const _0xb5a69e=_0x2978d5>0x0?0x1:_0x5c787f;return await this[_0x24b648(0x1ee)][_0x24b648(0x1b8)]({'name':_0x278078,'projectId':_0x5484e2,'modelType':_0x2d6b83,'systemPrompt':'','temperature':_0xb5a69e,'reasoningEffort':_0x2978d5>0x0?_0x2978d5:undefined});}catch(_0x288a33){if(_0x288a33 instanceof HTTPClientError){const _0x28f83=_0x288a33[_0x24b648(0x125)];if(_0x28f83>=0x190&&_0x28f83<0x1f4){if(_0x28f83===0x191)throw new SDKError(ErrorCode['UNAUTHENTICATED'],_0x24b648(0x1f7),_0x288a33);else{if(_0x28f83===0x193)throw new SDKError(ErrorCode[_0x24b648(0x1a7)],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x288a33);}throw _0x288a33;}}if(errorContains(_0x288a33,_0x24b648(0x184),_0x24b648(0x194),_0x24b648(0x1a4))){_0x462495++;if(_0x462495>=_0x2b7fd1)throw new SDKError(ErrorCode[_0x24b648(0x1cc)],_0x24b648(0x209)+_0x2b7fd1+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x288a33);const _0xd3187d=this[_0x24b648(0x1ab)]();_0x43edc4=_0xd3187d+'_'+generateRandomHex();continue;}throw _0x288a33;}}throw new SDKError(ErrorCode[_0x24b648(0x15d)],_0x24b648(0x210));}async[a122_0x1a5445(0x198)](_0x268aa4,_0x51cd90){const _0x39ef4f=a122_0x1a5445,_0x4cf5ef=_0x51cd90||this[_0x39ef4f(0x1d9)],_0x29ce3f=await this['client']['listAgents'](_0x4cf5ef),_0xb129b7=_0x29ce3f[_0x39ef4f(0x148)](_0x449146=>_0x449146[_0x39ef4f(0x16e)]['name']===_0x268aa4);if(_0xb129b7[_0x39ef4f(0x1b1)]===0x0){const _0x28b165=_0x4cf5ef?'\x20in\x20project\x20'+_0x4cf5ef:'';throw new SDKError(ErrorCode[_0x39ef4f(0x192)],'Agent\x20not\x20found:\x20'+_0x268aa4+_0x28b165,undefined,{'helpText':_0x4cf5ef?'Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.':_0x39ef4f(0x20e)});}if(_0xb129b7[_0x39ef4f(0x1b1)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x39ef4f(0x1fd)+_0x268aa4+_0x39ef4f(0x19e));return _0xb129b7[0x0]['id'];}async[a122_0x1a5445(0x1c8)](_0x505eca){const _0x343043=a122_0x1a5445,_0x4324e9=_0x505eca||this[_0x343043(0x1d9)];return await this[_0x343043(0x1ee)][_0x343043(0x1b5)](_0x4324e9);}async['agentsFull'](_0x46f349){const _0x232881=a122_0x1a5445;return await this[_0x232881(0x1ee)]['listAgentsFull'](_0x46f349);}async[a122_0x1a5445(0x1de)](_0x67e6b0){const _0x5dd4d9=a122_0x1a5445;return await this[_0x5dd4d9(0x1ee)][_0x5dd4d9(0x108)](_0x67e6b0);}async[a122_0x1a5445(0x1b8)](_0x5b1e7b){return await this['client']['createAgent'](_0x5b1e7b);}async['updateAgent'](_0x4cd5f0,_0x192099){const _0x47b1f1=a122_0x1a5445;return await this[_0x47b1f1(0x1ee)]['updateAgent'](_0x4cd5f0,_0x192099);}async[a122_0x1a5445(0x14e)](_0x51d73f){const _0x562aa9=a122_0x1a5445;await this[_0x562aa9(0x1ee)][_0x562aa9(0x14e)](_0x51d73f);}async[a122_0x1a5445(0x113)](_0x3d4a94){const _0x58bcb1=a122_0x1a5445;return await this[_0x58bcb1(0x1ee)][_0x58bcb1(0x113)]({'agentId':_0x3d4a94});}async*[a122_0x1a5445(0x130)](_0x2eaad8,_0x266a94){const _0x52b753=a122_0x1a5445;let _0xc3f1eb=_0x266a94?.['chatId'];const _0x328084=_0x266a94?.[_0x52b753(0x163)];if(!_0xc3f1eb){if(!_0x328084)throw new Error(_0x52b753(0x128));const _0x1b0590=await this[_0x52b753(0x1ee)][_0x52b753(0x113)]({'agentId':_0x328084});_0xc3f1eb=_0x1b0590['id'],yield{'type':_0x52b753(0x1f1),'data':{'chatId':_0xc3f1eb,'agentId':_0x328084,'projectId':_0x1b0590[_0x52b753(0x16e)][_0x52b753(0x1f3)]}};}for await(const _0x4faf77 of this[_0x52b753(0x1ee)]['continueChat'](_0xc3f1eb,_0x2eaad8,_0x266a94?.[_0x52b753(0x109)])){yield{'type':_0x52b753(0x15f),'data':_0x4faf77};}}async[a122_0x1a5445(0x15a)](_0x7e85c2=0x32){const _0x156099=a122_0x1a5445;return await this[_0x156099(0x1ee)][_0x156099(0x1d2)](_0x7e85c2);}async[a122_0x1a5445(0x1e9)](_0x33b403){return await this['client']['getChatHistory'](_0x33b403);}async[a122_0x1a5445(0x1fc)](_0x1a6faf){const _0xc1b21f=a122_0x1a5445;return await this['client'][_0xc1b21f(0x1fc)](_0x1a6faf);}async['chatInfo'](_0x5e6e1a){return await this['client']['getChatInfo'](_0x5e6e1a);}async['backupProject'](_0x3a7c43,_0x2bef06,_0x46eb59){const _0x519981=a122_0x1a5445,_0x38d15c=_0x46eb59?.[_0x519981(0x16d)]??![],{projectId:_0x156812,project:_0xc924d4}=await this['resolveProjectName'](_0x3a7c43),_0x397f5e=_0xc924d4[_0x519981(0x16e)][_0x519981(0x144)],_0x53cc17=_0x2bef06||_0x397f5e+_0x519981(0x1af);if(a122_0x5102fc[_0x519981(0x196)](_0x53cc17)&&!_0x38d15c)throw new SDKError(ErrorCode[_0x519981(0x1cc)],_0x519981(0x1c2)+_0x53cc17,undefined,{'helpText':_0x519981(0x1c9)});const _0x2eed36=await this[_0x519981(0x1ee)]['listAgentsFull'](_0x156812),_0xac88a9=await this[_0x519981(0x1ee)]['listKnowledgeBases'](_0x156812),_0x20c810=await this[_0x519981(0x1ee)]['listPrompts'](_0x156812),_0x47be62=await this[_0x519981(0x1ee)]['listIntegrations'](_0x156812);if(!_0x38d15c){a122_0x5102fc[_0x519981(0x18a)](_0x53cc17,{'recursive':!![]});const _0x4db145={'version':'1.0','exportedAt':new Date()['toISOString'](),'exportedFrom':{'site':this['context'][_0x519981(0x206)],'projectId':_0x156812,'projectName':_0x397f5e},'project':_0xc924d4};a122_0x5102fc[_0x519981(0x137)](a122_0x1dfc50[_0x519981(0x10d)](_0x53cc17,_0x519981(0x13c)),JSON[_0x519981(0x171)](_0x4db145,null,0x2)),a122_0x5102fc[_0x519981(0x137)](a122_0x1dfc50[_0x519981(0x10d)](_0x53cc17,_0x519981(0x141)),JSON[_0x519981(0x171)](_0x2eed36,null,0x2)),a122_0x5102fc['writeFileSync'](a122_0x1dfc50[_0x519981(0x10d)](_0x53cc17,'knowledgebases.json'),JSON[_0x519981(0x171)](_0xac88a9,null,0x2)),a122_0x5102fc[_0x519981(0x137)](a122_0x1dfc50['join'](_0x53cc17,_0x519981(0x179)),JSON['stringify'](_0x20c810,null,0x2)),a122_0x5102fc[_0x519981(0x137)](a122_0x1dfc50[_0x519981(0x10d)](_0x53cc17,'integrations.json'),JSON['stringify'](_0x47be62,null,0x2));}return{'projectName':_0x397f5e,'outputDir':_0x53cc17,'counts':{'agents':_0x2eed36['length'],'knowledgeBases':_0xac88a9['length'],'prompts':_0x20c810[_0x519981(0x1b1)],'integrations':_0x47be62[_0x519981(0x1b1)]}};}async[a122_0x1a5445(0x1c7)](_0x4b6a9b,_0x1f3b83){const _0x4076bc=a122_0x1a5445,_0x3b0a6b=_0x1f3b83?.[_0x4076bc(0x16d)]??![],_0x49115b=this[_0x4076bc(0x103)](_0x4b6a9b),_0x18b35f=_0x49115b[_0x4076bc(0x115)][_0x4076bc(0x206)],_0xcf45a=this[_0x4076bc(0x12d)][_0x4076bc(0x206)],_0x3014d1=_0x18b35f!==_0xcf45a?_0x18b35f:undefined,_0x438fd4=this[_0x4076bc(0x11d)](a122_0x1dfc50[_0x4076bc(0x10d)](_0x4b6a9b,_0x4076bc(0x141)),[]),_0x3f3966=this[_0x4076bc(0x11d)](a122_0x1dfc50[_0x4076bc(0x10d)](_0x4b6a9b,'knowledgebases.json'),[]),_0x3d51ff=this[_0x4076bc(0x11d)](a122_0x1dfc50['join'](_0x4b6a9b,_0x4076bc(0x179)),[]),_0x288531=this[_0x4076bc(0x11d)](a122_0x1dfc50[_0x4076bc(0x10d)](_0x4b6a9b,_0x4076bc(0x156)),[]),_0x3e5a5c=_0x1f3b83?.[_0x4076bc(0x144)]||_0x49115b[_0x4076bc(0x115)][_0x4076bc(0x15c)];if(_0x3b0a6b){const _0x570d7a=new Map(),_0x47b261=[..._0x438fd4],_0x29ad8a=_0x438fd4[_0x4076bc(0x1b1)]+0x1;let _0x28a81c=0x0;while(_0x47b261[_0x4076bc(0x1b1)]>0x0&&_0x28a81c<_0x29ad8a){_0x28a81c++;const _0x4e9a4a=[];for(const _0x2fd80f of _0x47b261){canCreateAgent(_0x2fd80f,_0x570d7a)?_0x570d7a[_0x4076bc(0x14b)](_0x2fd80f['id'],_0x4076bc(0x20c)+_0x2fd80f['id']):_0x4e9a4a[_0x4076bc(0x180)](_0x2fd80f);}if(_0x4e9a4a[_0x4076bc(0x1b1)]===_0x47b261['length'])throw new SDKError(ErrorCode[_0x4076bc(0x15d)],_0x4076bc(0x20d),undefined,{'helpText':_0x4076bc(0x105)});_0x47b261[_0x4076bc(0x1b1)]=0x0,_0x47b261[_0x4076bc(0x180)](..._0x4e9a4a);}const _0x339ee3=_0x3d51ff[_0x4076bc(0x148)](_0x5b86ab=>_0x570d7a[_0x4076bc(0x13a)](_0x5b86ab[_0x4076bc(0x16e)][_0x4076bc(0x163)]))[_0x4076bc(0x1b1)];return{'projectName':_0x3e5a5c,'projectId':'(dry-run)','counts':{'agents':_0x438fd4[_0x4076bc(0x1b1)],'knowledgeBases':_0x3f3966[_0x4076bc(0x1b1)],'prompts':_0x339ee3,'integrations':_0x288531[_0x4076bc(0x1b1)]},'sourceSite':_0x3014d1};}const _0x4ba84e=await this[_0x4076bc(0x1ee)]['createProject']({'name':_0x3e5a5c,'description':_0x49115b[_0x4076bc(0x152)][_0x4076bc(0x16e)][_0x4076bc(0x1f0)]}),_0x1eeed8=_0x4ba84e['id'],_0x4d16cf=new Map(),_0x1dbcf3=new Map(),_0x1f676f=new Map();for(const _0x1f776b of _0x3f3966){const _0x3a70e0=await this[_0x4076bc(0x1ee)][_0x4076bc(0x177)]({'projectId':_0x1eeed8,'name':_0x1f776b[_0x4076bc(0x16e)]['name'],'tdDatabaseName':_0x1f776b[_0x4076bc(0x16e)]['tdDatabaseName'],'tables':_0x1f776b['attributes'][_0x4076bc(0x1ef)]});_0x4d16cf['set'](_0x1f776b['id'],_0x3a70e0['id']);}const _0x3205e1=[..._0x438fd4],_0x5282be=_0x438fd4[_0x4076bc(0x1b1)]+0x1;let _0x29c0b8=0x0;while(_0x3205e1[_0x4076bc(0x1b1)]>0x0&&_0x29c0b8<_0x5282be){_0x29c0b8++;const _0x14bfc2=[];for(const _0x3be02a of _0x3205e1){if(canCreateAgent(_0x3be02a,_0x1dbcf3)){const _0x2b1ace=remapToolIds(_0x3be02a[_0x4076bc(0x16e)]['tools'],_0x4d16cf,_0x1dbcf3),_0x2d8be9=remapVariableIds(_0x3be02a[_0x4076bc(0x16e)][_0x4076bc(0x142)],_0x4d16cf),_0xdd2335=await this[_0x4076bc(0x1ee)]['createAgentResponse']({'name':_0x3be02a[_0x4076bc(0x16e)]['name'],'projectId':_0x1eeed8,'systemPrompt':_0x3be02a[_0x4076bc(0x16e)][_0x4076bc(0x185)],'starterMessage':_0x3be02a[_0x4076bc(0x16e)]['starterMessage'],'modelType':migrateModelType(_0x3be02a[_0x4076bc(0x16e)]['modelType']),'maxToolIterations':_0x3be02a[_0x4076bc(0x16e)]['maxToolIterations'],'temperature':_0x3be02a[_0x4076bc(0x16e)]['temperature'],'reasoningEffort':_0x3be02a[_0x4076bc(0x16e)][_0x4076bc(0x11b)],'outputs':_0x3be02a['attributes'][_0x4076bc(0x1b4)],'tools':_0x2b1ace,'variables':_0x2d8be9});_0x1dbcf3[_0x4076bc(0x14b)](_0x3be02a['id'],_0xdd2335['id']);}else _0x14bfc2[_0x4076bc(0x180)](_0x3be02a);}if(_0x14bfc2[_0x4076bc(0x1b1)]===_0x3205e1[_0x4076bc(0x1b1)])throw new SDKError(ErrorCode[_0x4076bc(0x15d)],_0x4076bc(0x20d),undefined,{'helpText':_0x4076bc(0x105)});_0x3205e1[_0x4076bc(0x1b1)]=0x0,_0x3205e1[_0x4076bc(0x180)](..._0x14bfc2);}for(const _0x185365 of _0x3d51ff){const _0x343310=_0x1dbcf3[_0x4076bc(0x1e8)](_0x185365[_0x4076bc(0x16e)][_0x4076bc(0x163)]);if(!_0x343310)continue;const _0x2518c9=await this[_0x4076bc(0x1ee)][_0x4076bc(0x201)]({'projectId':_0x1eeed8,'agentId':_0x343310,'name':_0x185365[_0x4076bc(0x16e)]['name'],'systemPrompt':_0x185365[_0x4076bc(0x16e)][_0x4076bc(0x185)],'template':_0x185365[_0x4076bc(0x16e)][_0x4076bc(0x193)],'jsonSchemaHint':_0x185365[_0x4076bc(0x16e)][_0x4076bc(0x1bc)]});_0x1f676f[_0x4076bc(0x14b)](_0x185365['id'],_0x2518c9['id']);}for(const _0x2f65bd of _0x288531){const _0xb3f2ae=_0x2f65bd[_0x4076bc(0x16e)][_0x4076bc(0x202)][_0x4076bc(0x191)](_0x344641=>({..._0x344641,'promptId':_0x1f676f[_0x4076bc(0x1e8)](_0x344641[_0x4076bc(0x17a)])||_0x344641[_0x4076bc(0x17a)]}));await this[_0x4076bc(0x1ee)][_0x4076bc(0x175)]({'projectId':_0x1eeed8,'serviceType':_0x2f65bd[_0x4076bc(0x16e)][_0x4076bc(0x1b9)],'actions':_0xb3f2ae,'slackMessageMode':_0x2f65bd[_0x4076bc(0x16e)][_0x4076bc(0x1c5)],'chatIgnoreManagedActions':_0x2f65bd[_0x4076bc(0x16e)][_0x4076bc(0x1c6)],'chatWelcomeMessage':_0x2f65bd[_0x4076bc(0x16e)]['chatWelcomeMessage'],'webhookCorsOrigins':_0x2f65bd[_0x4076bc(0x16e)][_0x4076bc(0x1a9)]});}return{'projectName':_0x3e5a5c,'projectId':_0x1eeed8,'counts':{'agents':_0x1dbcf3[_0x4076bc(0x1ff)],'knowledgeBases':_0x4d16cf['size'],'prompts':_0x1f676f[_0x4076bc(0x1ff)],'integrations':_0x288531['length']},'sourceSite':_0x3014d1};}[a122_0x1a5445(0x11d)](_0x4aa13e,_0x234d05){const _0x40c143=a122_0x1a5445;if(!a122_0x5102fc[_0x40c143(0x196)](_0x4aa13e))return _0x234d05;return JSON[_0x40c143(0x1f5)](a122_0x5102fc['readFileSync'](_0x4aa13e,_0x40c143(0x174)));}[a122_0x1a5445(0x103)](_0x32dba1){const _0x3f338f=a122_0x1a5445;if(!a122_0x5102fc[_0x3f338f(0x196)](_0x32dba1))throw new SDKError(ErrorCode[_0x3f338f(0x14a)],'Backup\x20folder\x20not\x20found:\x20'+_0x32dba1,undefined,{'helpText':'Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.'});const _0x515111=a122_0x1dfc50[_0x3f338f(0x10d)](_0x32dba1,'project.json');if(!a122_0x5102fc[_0x3f338f(0x196)](_0x515111))throw new SDKError(ErrorCode[_0x3f338f(0x20f)],_0x3f338f(0x1b7)+_0x32dba1,undefined,{'helpText':_0x3f338f(0x18d)});const _0x33b98b=JSON[_0x3f338f(0x1f5)](a122_0x5102fc[_0x3f338f(0x1ea)](_0x515111,_0x3f338f(0x174)));if(!isSupportedBackupVersion(_0x33b98b['version']))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Unsupported\x20backup\x20version:\x20'+_0x33b98b['version'],undefined,{'helpText':'This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.'});return _0x33b98b;}async[a122_0x1a5445(0x1b6)](_0x42045c,_0x507432,_0x3c2268){const _0x155de8=a122_0x1a5445,{projectId:_0xfe5637,project:_0x124589}=await this['resolveProjectName'](_0x42045c),_0x17d2f9=_0x124589[_0x155de8(0x16e)][_0x155de8(0x144)];let _0x6c9877;if(_0x507432)_0x6c9877=_0x507432;else{const _0x58722d=a122_0x1dfc50[_0x155de8(0x10d)](process[_0x155de8(0x204)](),_0x155de8(0x1c8)),_0x5bc8a9=getSanitizedPathWithMigration(_0x58722d,_0x17d2f9);_0x5bc8a9[_0x155de8(0x1e3)]&&this[_0x155de8(0x120)]['info'](_0x155de8(0x173)+a122_0x1dfc50[_0x155de8(0x1c3)](_0x5bc8a9[_0x155de8(0x164)])+_0x155de8(0x1ec)+a122_0x1dfc50[_0x155de8(0x1c3)](_0x5bc8a9['path'])),_0x6c9877=_0x5bc8a9[_0x155de8(0x134)];}const _0x37c4b6=await this[_0x155de8(0x1ee)][_0x155de8(0x107)](_0xfe5637),_0x427cf5=await this[_0x155de8(0x1ee)]['listKnowledgeBases'](_0xfe5637),_0x404093=await this[_0x155de8(0x1ee)][_0x155de8(0x18b)](_0xfe5637),_0x51c117=await safeListOrEmpty(()=>this['client']['listImageGenerators'](_0xfe5637)),_0x35f488=await safeListOrEmpty(()=>this[_0x155de8(0x1ee)][_0x155de8(0x169)](_0xfe5637)),_0x428e84=await this[_0x155de8(0x1ee)][_0x155de8(0x135)](_0xfe5637),_0x372f53=await this[_0x155de8(0x1ee)][_0x155de8(0x17b)](_0xfe5637),_0x4a36ca=await safeListOrEmpty(()=>this['client']['listExperimentalKnowledgeBases'](_0xfe5637)),_0xc24e46=await safeListOrEmpty(()=>this[_0x155de8(0x1ee)]['listExperimentalArtifacts'](_0xfe5637)),_0xd4d690=_0x372f53[_0x155de8(0x148)](_0x5df7fe=>!_0x5df7fe['attributes']['isManaged']&&SAFE_INTEGRATION_TYPES[_0x155de8(0x1f8)](_0x5df7fe[_0x155de8(0x16e)][_0x155de8(0x1b9)]['toLowerCase']())),_0x55eb1a=new Map(),_0x8b0c9a=new Map(),_0x65a60e=new Map(),_0x49d470=new Map(),_0x264986=new Map(),_0x4ef89e=new Map(),_0x1f3da8=new Map();for(const _0x4df4e2 of _0x37c4b6){_0x55eb1a[_0x155de8(0x14b)](_0x4df4e2['id'],_0x4df4e2[_0x155de8(0x16e)][_0x155de8(0x144)]);}for(const _0x3e227f of _0x427cf5){_0x8b0c9a[_0x155de8(0x14b)](_0x3e227f['id'],_0x3e227f['attributes'][_0x155de8(0x144)]);}for(const _0x429abb of _0x404093){_0x65a60e[_0x155de8(0x14b)](_0x429abb['id'],_0x429abb[_0x155de8(0x16e)][_0x155de8(0x144)]);}for(const _0x596bef of _0x51c117){_0x49d470[_0x155de8(0x14b)](_0x596bef['id'],_0x596bef[_0x155de8(0x16e)][_0x155de8(0x144)]);}for(const _0x5dcae6 of _0x35f488){_0x264986['set'](_0x5dcae6['id'],_0x5dcae6[_0x155de8(0x16e)][_0x155de8(0x144)]);}for(const _0x113b62 of _0x428e84){_0x4ef89e[_0x155de8(0x14b)](_0x113b62['id'],_0x113b62[_0x155de8(0x16e)][_0x155de8(0x144)]);}for(const _0x30c8a3 of _0x4a36ca){_0x1f3da8[_0x155de8(0x14b)](_0x30c8a3['id'],_0x30c8a3[_0x155de8(0x16e)][_0x155de8(0x144)]);}const _0x1a2bb4={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x8b0c9a,'TextKnowledgeBase':_0x65a60e,'Agent':_0x55eb1a,'WebSearchTool':_0x264986,'ImageGenerator':_0x49d470,'ExperimentalKnowledgeBase':_0x1f3da8}),'resolvePromptName':async _0x26952b=>_0x4ef89e['get'](_0x26952b),'onWarning':_0x560ccd=>this[_0x155de8(0x120)][_0x155de8(0x14f)](_0x560ccd)},_0x58dfc7={'projectName':_0x17d2f9,'outputDir':_0x6c9877,'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}}},_0x5aef77=[],_0x5ea6ec=[];for(const _0x2882a3 of _0x37c4b6){const _0xc02fbe=getSanitizedPathWithMigration(_0x6c9877,_0x2882a3[_0x155de8(0x16e)]['name']);_0xc02fbe[_0x155de8(0x1e3)]&&this[_0x155de8(0x120)][_0x155de8(0x1cf)](_0x155de8(0x129)+a122_0x1dfc50['basename'](_0xc02fbe[_0x155de8(0x164)])+'\x20→\x20'+a122_0x1dfc50['basename'](_0xc02fbe['path']));const _0xec9bf=_0xc02fbe[_0x155de8(0x134)],_0x3e1912=a122_0x1dfc50['join'](_0xec9bf,_0x155de8(0x1bb)),_0x23b2a8=a122_0x1dfc50['join'](_0xec9bf,_0x155de8(0x110)),_0x28cdeb=a122_0x1dfc50[_0x155de8(0x10d)](_0xec9bf,_0x155de8(0x1e6)),{yaml:_0x5b2ebe,systemPrompt:_0x376bf5,starterMessage:_0x40ef52}=await agentResponseToDef(_0x2882a3,_0x1a2bb4),_0x177c3f=toAgentYamlString(_0x5b2ebe),_0x16a327=!a122_0x5102fc['existsSync'](_0x23b2a8);let _0x1e5a38=_0x16a327,_0x706eb8;if(!_0x16a327){const _0x4d1f3d=a122_0x5102fc['existsSync'](_0x3e1912)?a122_0x5102fc[_0x155de8(0x1ea)](_0x3e1912,_0x155de8(0x174)):'',_0x408059=a122_0x5102fc[_0x155de8(0x1ea)](_0x23b2a8,_0x155de8(0x174)),_0x235e7d='#\x20prompt.md\x0a'+_0x4d1f3d+_0x155de8(0x15e)+_0x408059,_0x19802f=_0x155de8(0x11e)+_0x376bf5+_0x155de8(0x15e)+_0x177c3f,_0x3c4d30=generateDiff(_0x235e7d,_0x19802f);_0x1e5a38=hasChanges(_0x3c4d30),_0x1e5a38&&(_0x706eb8=formatDiffWithColors(_0x3c4d30));}_0x5aef77['push']({'path':_0xec9bf,'content':'','isDir':!![]}),_0x5aef77[_0x155de8(0x180)]({'path':_0x3e1912,'content':_0x376bf5}),_0x5aef77[_0x155de8(0x180)]({'path':_0x23b2a8,'content':_0x177c3f});_0x40ef52&&_0x40ef52[_0x155de8(0x1f8)]('\x0a')&&_0x5aef77['push']({'path':_0x28cdeb,'content':_0x40ef52});_0x58dfc7['agents'][_0x155de8(0x180)]({'agentName':_0x2882a3[_0x155de8(0x16e)]['name'],'outputPath':_0xec9bf,'isNew':_0x16a327,'hasChanges':_0x1e5a38,'diff':_0x706eb8}),_0x58dfc7['counts'][_0x155de8(0x1c8)]['total']++;if(_0x16a327)_0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x1c8)]['new']++;else{if(_0x1e5a38)_0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x1c8)]['updated']++;else _0x58dfc7['counts'][_0x155de8(0x1c8)][_0x155de8(0x168)]++;}}for(const _0x565202 of _0x427cf5){if(_0x565202[_0x155de8(0x16e)]['isManaged'])continue;const _0x153662=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x6c9877),_0x565202[_0x155de8(0x16e)][_0x155de8(0x144)],'.yml');_0x153662[_0x155de8(0x1e3)]&&this[_0x155de8(0x120)][_0x155de8(0x1cf)](_0x155de8(0x16f)+a122_0x1dfc50[_0x155de8(0x1c3)](_0x153662['oldPath'])+_0x155de8(0x1ec)+a122_0x1dfc50['basename'](_0x153662[_0x155de8(0x134)]));const _0x42043a=_0x153662['path'],_0x4562f9=apiKnowledgeBaseToYaml(_0x565202),_0x58ddca=toKnowledgeBaseYamlString(_0x4562f9),_0xe74696=!a122_0x5102fc[_0x155de8(0x196)](_0x42043a);let _0xc71584=_0xe74696,_0x2da747;if(!_0xe74696){const _0x361534=a122_0x5102fc[_0x155de8(0x1ea)](_0x42043a,_0x155de8(0x174)),_0x417054=generateDiff(_0x361534,_0x58ddca);_0xc71584=hasChanges(_0x417054),_0xc71584&&(_0x2da747=formatDiffWithColors(_0x417054));}_0x5aef77['push']({'path':_0x42043a,'content':_0x58ddca}),_0x58dfc7['knowledgeBases']['push']({'name':_0x565202[_0x155de8(0x16e)][_0x155de8(0x144)],'outputPath':_0x42043a,'isNew':_0xe74696,'hasChanges':_0xc71584,'diff':_0x2da747}),_0x58dfc7[_0x155de8(0x19d)]['knowledgeBases'][_0x155de8(0x1cb)]++;if(_0xe74696)_0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x207)]['new']++;else{if(_0xc71584)_0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x207)][_0x155de8(0x167)]++;else _0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x207)]['unchanged']++;}}for(const _0x4991c8 of _0x404093){if(_0x4991c8[_0x155de8(0x16e)][_0x155de8(0x153)])continue;const _0x4bbd3a=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x6c9877),_0x4991c8['attributes'][_0x155de8(0x144)],_0x155de8(0x14c));_0x4bbd3a[_0x155de8(0x1e3)]&&this[_0x155de8(0x120)][_0x155de8(0x1cf)](_0x155de8(0x1cd)+a122_0x1dfc50[_0x155de8(0x1c3)](_0x4bbd3a[_0x155de8(0x164)])+_0x155de8(0x1ec)+a122_0x1dfc50[_0x155de8(0x1c3)](_0x4bbd3a[_0x155de8(0x134)]));const _0x3a5d67=_0x4bbd3a[_0x155de8(0x134)],_0x2c5b12=toTextKnowledgeBaseMd(_0x4991c8['attributes'][_0x155de8(0x144)],_0x4991c8[_0x155de8(0x16e)][_0x155de8(0x1a2)]),_0x1df44d=!a122_0x5102fc[_0x155de8(0x196)](_0x3a5d67);let _0x47cdfb=_0x1df44d,_0x58e6d4;if(!_0x1df44d){const _0x3146d3=a122_0x5102fc[_0x155de8(0x1ea)](_0x3a5d67,'utf-8'),_0x30d136=generateDiff(_0x3146d3,_0x2c5b12);_0x47cdfb=hasChanges(_0x30d136),_0x47cdfb&&(_0x58e6d4=formatDiffWithColors(_0x30d136));}_0x5aef77[_0x155de8(0x180)]({'path':_0x3a5d67,'content':_0x2c5b12}),_0x58dfc7[_0x155de8(0x13b)][_0x155de8(0x180)]({'name':_0x4991c8[_0x155de8(0x16e)][_0x155de8(0x144)],'outputPath':_0x3a5d67,'isNew':_0x1df44d,'hasChanges':_0x47cdfb,'diff':_0x58e6d4}),_0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x13b)]['total']++;if(_0x1df44d)_0x58dfc7[_0x155de8(0x19d)]['textKnowledgeBases'][_0x155de8(0x1fe)]++;else{if(_0x47cdfb)_0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x13b)][_0x155de8(0x167)]++;else _0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x13b)][_0x155de8(0x168)]++;}}for(const _0x3d4298 of _0x428e84){if(_0x3d4298[_0x155de8(0x16e)][_0x155de8(0x153)])continue;const _0xfce3d2=getSanitizedPathWithMigration(getPromptsDir(_0x6c9877),_0x3d4298[_0x155de8(0x16e)]['name'],'.yml');_0xfce3d2[_0x155de8(0x1e3)]&&this['logger'][_0x155de8(0x1cf)](_0x155de8(0x1eb)+a122_0x1dfc50['basename'](_0xfce3d2['oldPath'])+_0x155de8(0x1ec)+a122_0x1dfc50[_0x155de8(0x1c3)](_0xfce3d2['path']));const _0x437c52=_0xfce3d2[_0x155de8(0x134)],_0x217bf7=await apiPromptToYaml(_0x3d4298,_0x1a2bb4);if(!_0x217bf7)continue;const _0x707706=toPromptYamlString(_0x217bf7),_0x3c2021=!a122_0x5102fc[_0x155de8(0x196)](_0x437c52);let _0x2ab711=_0x3c2021,_0x18d9d8;if(!_0x3c2021){const _0x2bd760=a122_0x5102fc[_0x155de8(0x1ea)](_0x437c52,_0x155de8(0x174)),_0x2f90f9=generateDiff(_0x2bd760,_0x707706);_0x2ab711=hasChanges(_0x2f90f9),_0x2ab711&&(_0x18d9d8=formatDiffWithColors(_0x2f90f9));}_0x5aef77[_0x155de8(0x180)]({'path':_0x437c52,'content':_0x707706}),_0x58dfc7[_0x155de8(0x183)][_0x155de8(0x180)]({'name':_0x3d4298[_0x155de8(0x16e)][_0x155de8(0x144)],'outputPath':_0x437c52,'isNew':_0x3c2021,'hasChanges':_0x2ab711,'diff':_0x18d9d8}),_0x58dfc7['counts'][_0x155de8(0x183)]['total']++;if(_0x3c2021)_0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x183)][_0x155de8(0x1fe)]++;else{if(_0x2ab711)_0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x183)][_0x155de8(0x167)]++;else _0x58dfc7['counts'][_0x155de8(0x183)][_0x155de8(0x168)]++;}}for(const _0x5c9666 of _0xd4d690){const _0x1e9e9f=_0x5c9666['attributes'][_0x155de8(0x1b9)][_0x155de8(0x197)](),_0x3dd1b7=getSanitizedPathWithMigration(getIntegrationsDir(_0x6c9877),_0x1e9e9f,_0x155de8(0x165));_0x3dd1b7[_0x155de8(0x1e3)]&&this[_0x155de8(0x120)][_0x155de8(0x1cf)](_0x155de8(0x154)+a122_0x1dfc50[_0x155de8(0x1c3)](_0x3dd1b7['oldPath'])+'\x20→\x20'+a122_0x1dfc50[_0x155de8(0x1c3)](_0x3dd1b7[_0x155de8(0x134)]));const _0x30359f=_0x3dd1b7[_0x155de8(0x134)],_0x447816=await apiIntegrationToYaml(_0x5c9666,_0x1a2bb4),_0x5f22e9=toIntegrationYamlString(_0x447816),_0x2c1b6d=!a122_0x5102fc['existsSync'](_0x30359f);let _0x148800=_0x2c1b6d,_0xf2ce24;if(!_0x2c1b6d){const _0x429447=a122_0x5102fc[_0x155de8(0x1ea)](_0x30359f,'utf-8'),_0x18c714=generateDiff(_0x429447,_0x5f22e9);_0x148800=hasChanges(_0x18c714),_0x148800&&(_0xf2ce24=formatDiffWithColors(_0x18c714));}_0x5aef77[_0x155de8(0x180)]({'path':_0x30359f,'content':_0x5f22e9}),_0x58dfc7[_0x155de8(0x1d3)]['push']({'name':_0x1e9e9f,'outputPath':_0x30359f,'isNew':_0x2c1b6d,'hasChanges':_0x148800,'diff':_0xf2ce24}),_0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x1d3)]['total']++;if(_0x2c1b6d)_0x58dfc7['counts'][_0x155de8(0x1d3)][_0x155de8(0x1fe)]++;else{if(_0x148800)_0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x1d3)][_0x155de8(0x167)]++;else _0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x1d3)]['unchanged']++;}}for(const _0x5d5ca3 of _0x4a36ca){if(_0x5d5ca3[_0x155de8(0x16e)][_0x155de8(0x153)])continue;const _0x5e3fbc=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x6c9877),_0x5d5ca3[_0x155de8(0x16e)][_0x155de8(0x144)]);_0x5e3fbc[_0x155de8(0x1e3)]&&this[_0x155de8(0x120)][_0x155de8(0x1cf)](_0x155de8(0x1d5)+a122_0x1dfc50[_0x155de8(0x1c3)](_0x5e3fbc[_0x155de8(0x164)])+_0x155de8(0x1ec)+a122_0x1dfc50[_0x155de8(0x1c3)](_0x5e3fbc[_0x155de8(0x134)]));const _0x2a794b=_0x5e3fbc[_0x155de8(0x134)],_0x158bca=a122_0x1dfc50[_0x155de8(0x10d)](_0x2a794b,sanitizeForFilesystem(_0x5d5ca3[_0x155de8(0x16e)][_0x155de8(0x144)])+_0x155de8(0x165)),_0x25db50=a122_0x1dfc50['join'](_0x2a794b,_0x155de8(0x119)),_0x426a0f=apiExperimentalKnowledgeBaseToYaml(_0x5d5ca3),_0x10a21d=toExperimentalKnowledgeBaseYamlString(_0x426a0f),_0x5af389=!a122_0x5102fc[_0x155de8(0x196)](_0x2a794b);let _0x28ca3=_0x5af389,_0x1be35e,_0x125001=_0x10a21d;const _0x504c4f=[..._0x426a0f['functions']][_0x155de8(0x17e)]((_0x434226,_0x49bb9e)=>_0x434226['name'][_0x155de8(0x1dd)](_0x49bb9e[_0x155de8(0x144)]));for(const _0xde2471 of _0x504c4f){_0x125001+=_0x155de8(0x18e)+_0xde2471[_0x155de8(0x144)]+_0x155de8(0x1f4)+_0xde2471[_0x155de8(0x1f6)]+_0x155de8(0x13e)+_0xde2471['name']+_0x155de8(0x1f4)+_0xde2471[_0x155de8(0x203)]+'\x0a';}if(!_0x5af389){let _0x213db3='';a122_0x5102fc[_0x155de8(0x196)](_0x158bca)&&(_0x213db3=a122_0x5102fc[_0x155de8(0x1ea)](_0x158bca,'utf-8'));if(a122_0x5102fc[_0x155de8(0x196)](_0x25db50)){const _0x49ce5d=a122_0x5102fc[_0x155de8(0x151)](_0x25db50,{'withFileTypes':!![]}),_0x2156d1=_0x49ce5d[_0x155de8(0x148)](_0x436cc6=>_0x436cc6[_0x155de8(0x18c)]())[_0x155de8(0x17e)]((_0x210a7a,_0xb68c07)=>_0x210a7a[_0x155de8(0x144)]['localeCompare'](_0xb68c07[_0x155de8(0x144)]));for(const _0x6ba4ed of _0x2156d1){const _0x1d23f6=a122_0x1dfc50['join'](_0x25db50,_0x6ba4ed['name'],'code.js'),_0x537f04=a122_0x1dfc50[_0x155de8(0x10d)](_0x25db50,_0x6ba4ed[_0x155de8(0x144)],_0x155de8(0x139));a122_0x5102fc[_0x155de8(0x196)](_0x1d23f6)&&(_0x213db3+='\x0a---\x20function:\x20'+_0x6ba4ed[_0x155de8(0x144)]+_0x155de8(0x1f4)+a122_0x5102fc[_0x155de8(0x1ea)](_0x1d23f6,'utf-8')+'\x0a'),a122_0x5102fc[_0x155de8(0x196)](_0x537f04)&&(_0x213db3+=_0x155de8(0x149)+_0x6ba4ed[_0x155de8(0x144)]+'\x20---\x0a'+a122_0x5102fc[_0x155de8(0x1ea)](_0x537f04,'utf-8')+'\x0a');}}const _0x4e97f5=generateDiff(_0x213db3,_0x125001);_0x28ca3=hasChanges(_0x4e97f5),_0x28ca3&&(_0x1be35e=formatDiffWithColors(_0x4e97f5));}_0x5aef77[_0x155de8(0x180)]({'path':_0x2a794b,'content':'','isDir':!![]}),_0x5aef77[_0x155de8(0x180)]({'path':_0x158bca,'content':_0x10a21d}),_0x5aef77[_0x155de8(0x180)]({'path':_0x25db50,'content':'','isDir':!![]});for(const _0x54eecb of _0x426a0f[_0x155de8(0x119)]){const _0x52a837=a122_0x1dfc50['join'](_0x25db50,sanitizeForFilesystem(_0x54eecb[_0x155de8(0x144)])),_0x2b3567=a122_0x1dfc50[_0x155de8(0x10d)](_0x52a837,_0x155de8(0x1a8)),_0x29d696=a122_0x1dfc50[_0x155de8(0x10d)](_0x52a837,_0x155de8(0x139));_0x5aef77[_0x155de8(0x180)]({'path':_0x52a837,'content':'','isDir':!![]}),_0x5aef77['push']({'path':_0x2b3567,'content':_0x54eecb[_0x155de8(0x1f6)]}),_0x5aef77['push']({'path':_0x29d696,'content':_0x54eecb[_0x155de8(0x203)]});}if(a122_0x5102fc[_0x155de8(0x196)](_0x25db50)){const _0x50f2f8=a122_0x5102fc[_0x155de8(0x151)](_0x25db50,{'withFileTypes':!![]}),_0x52a4ee=new Set(_0x426a0f['functions'][_0x155de8(0x191)](_0x414665=>sanitizeForFilesystem(_0x414665[_0x155de8(0x144)])));for(const _0x419146 of _0x50f2f8){if(_0x419146[_0x155de8(0x18c)]()&&!_0x52a4ee[_0x155de8(0x13a)](_0x419146[_0x155de8(0x144)])){const _0x147990=a122_0x1dfc50[_0x155de8(0x10d)](_0x25db50,_0x419146[_0x155de8(0x144)]);_0x5ea6ec[_0x155de8(0x180)]({'path':_0x147990,'isDir':!![]});}}}_0x58dfc7[_0x155de8(0x190)]['push']({'name':_0x5d5ca3[_0x155de8(0x16e)][_0x155de8(0x144)],'outputPath':_0x2a794b,'isNew':_0x5af389,'hasChanges':_0x28ca3,'diff':_0x1be35e}),_0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x190)][_0x155de8(0x1cb)]++;if(_0x5af389)_0x58dfc7[_0x155de8(0x19d)]['experimentalKnowledgeBases'][_0x155de8(0x1fe)]++;else{if(_0x28ca3)_0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x190)]['updated']++;else _0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x190)]['unchanged']++;}}for(const _0x2b9588 of _0xc24e46){if(_0x2b9588[_0x155de8(0x16e)][_0x155de8(0x153)])continue;const _0x296708=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x6c9877),_0x2b9588[_0x155de8(0x16e)][_0x155de8(0x144)]);_0x296708[_0x155de8(0x1e3)]&&this[_0x155de8(0x120)][_0x155de8(0x1cf)](_0x155de8(0x159)+a122_0x1dfc50['basename'](_0x296708[_0x155de8(0x164)])+_0x155de8(0x1ec)+a122_0x1dfc50[_0x155de8(0x1c3)](_0x296708[_0x155de8(0x134)]));const _0x1770ee=_0x296708[_0x155de8(0x134)],_0x5d43e8=a122_0x1dfc50[_0x155de8(0x10d)](_0x1770ee,sanitizeForFilesystem(_0x2b9588[_0x155de8(0x16e)][_0x155de8(0x144)])+_0x155de8(0x165)),_0x28631a=a122_0x1dfc50[_0x155de8(0x10d)](_0x1770ee,_0x155de8(0x1a8)),_0x5cac00=a122_0x1dfc50[_0x155de8(0x10d)](_0x1770ee,_0x155de8(0x19f)),_0x1258bb=apiExperimentalArtifactToYaml(_0x2b9588),_0x3d30c4=toExperimentalArtifactYamlString(_0x1258bb),_0x7cb40f=!a122_0x5102fc[_0x155de8(0x196)](_0x1770ee);let _0x24bcad=_0x7cb40f,_0x4e1c68,_0x1afcfe=_0x3d30c4+(_0x155de8(0x17f)+_0x1258bb['code']+'\x0a');const _0x3f7dac=[..._0x1258bb[_0x155de8(0x19f)]][_0x155de8(0x17e)]((_0x172a75,_0x447960)=>_0x172a75[_0x155de8(0x12c)]['localeCompare'](_0x447960[_0x155de8(0x12c)]));for(const _0x3289f2 of _0x3f7dac){_0x1afcfe+=_0x155de8(0x127)+_0x3289f2[_0x155de8(0x12c)]+_0x155de8(0x1f4)+_0x3289f2['text_content']+'\x0a';}if(!_0x7cb40f){let _0x4bfc48='';a122_0x5102fc[_0x155de8(0x196)](_0x5d43e8)&&(_0x4bfc48=a122_0x5102fc['readFileSync'](_0x5d43e8,_0x155de8(0x174)));a122_0x5102fc[_0x155de8(0x196)](_0x28631a)&&(_0x4bfc48+=_0x155de8(0x17f)+a122_0x5102fc[_0x155de8(0x1ea)](_0x28631a,_0x155de8(0x174))+'\x0a');if(a122_0x5102fc[_0x155de8(0x196)](_0x5cac00)){const _0x34b52e=a122_0x5102fc[_0x155de8(0x151)](_0x5cac00),_0x1920b0=_0x34b52e[_0x155de8(0x148)](_0x254bbb=>{const _0x349df3=_0x155de8,_0x39b8b2=a122_0x1dfc50['join'](_0x5cac00,_0x254bbb);return a122_0x5102fc['statSync'](_0x39b8b2)[_0x349df3(0x1a5)]();})['sort']((_0x348630,_0x52e1d6)=>_0x348630[_0x155de8(0x1dd)](_0x52e1d6));for(const _0x284abf of _0x1920b0){const _0xbfe423=a122_0x1dfc50[_0x155de8(0x10d)](_0x5cac00,_0x284abf);_0x4bfc48+='---\x20file:\x20'+_0x284abf+_0x155de8(0x1f4)+a122_0x5102fc[_0x155de8(0x1ea)](_0xbfe423,'utf-8')+'\x0a';}}const _0x1f0033=generateDiff(_0x4bfc48,_0x1afcfe);_0x24bcad=hasChanges(_0x1f0033),_0x24bcad&&(_0x4e1c68=formatDiffWithColors(_0x1f0033));}_0x5aef77[_0x155de8(0x180)]({'path':_0x1770ee,'content':'','isDir':!![]}),_0x5aef77[_0x155de8(0x180)]({'path':_0x5d43e8,'content':_0x3d30c4}),_0x5aef77[_0x155de8(0x180)]({'path':_0x28631a,'content':_0x1258bb['code']});if(_0x1258bb['files']['length']>0x0){_0x5aef77['push']({'path':_0x5cac00,'content':'','isDir':!![]});for(const _0x44fd94 of _0x1258bb[_0x155de8(0x19f)]){const _0x111d4e=a122_0x1dfc50[_0x155de8(0x10d)](_0x5cac00,_0x44fd94[_0x155de8(0x12c)]);_0x5aef77[_0x155de8(0x180)]({'path':_0x111d4e,'content':_0x44fd94[_0x155de8(0x136)]});}}if(a122_0x5102fc[_0x155de8(0x196)](_0x5cac00)){const _0x197a3e=a122_0x5102fc['readdirSync'](_0x5cac00),_0x40d099=new Set(_0x1258bb[_0x155de8(0x19f)]['map'](_0x1e25d7=>_0x1e25d7[_0x155de8(0x12c)]));for(const _0x19ab11 of _0x197a3e){const _0x53f8c5=a122_0x1dfc50['join'](_0x5cac00,_0x19ab11);a122_0x5102fc['statSync'](_0x53f8c5)['isFile']()&&!_0x40d099[_0x155de8(0x13a)](_0x19ab11)&&_0x5ea6ec[_0x155de8(0x180)]({'path':_0x53f8c5});}}_0x58dfc7[_0x155de8(0x1a1)][_0x155de8(0x180)]({'name':_0x2b9588['attributes'][_0x155de8(0x144)],'outputPath':_0x1770ee,'isNew':_0x7cb40f,'hasChanges':_0x24bcad,'diff':_0x4e1c68}),_0x58dfc7['counts'][_0x155de8(0x1a1)][_0x155de8(0x1cb)]++;if(_0x7cb40f)_0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x1a1)][_0x155de8(0x1fe)]++;else{if(_0x24bcad)_0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x1a1)][_0x155de8(0x167)]++;else _0x58dfc7[_0x155de8(0x19d)][_0x155de8(0x1a1)][_0x155de8(0x168)]++;}}if(_0x3c2268?.[_0x155de8(0x16d)])return _0x58dfc7;a122_0x5102fc['mkdirSync'](_0x6c9877,{'recursive':!![]}),a122_0x5102fc[_0x155de8(0x18a)](getKnowledgeBasesDir(_0x6c9877),{'recursive':!![]}),a122_0x5102fc[_0x155de8(0x18a)](getPromptsDir(_0x6c9877),{'recursive':!![]}),a122_0x5102fc['mkdirSync'](getIntegrationsDir(_0x6c9877),{'recursive':!![]}),a122_0x5102fc[_0x155de8(0x18a)](getExperimentalKnowledgeBasesDir(_0x6c9877),{'recursive':!![]}),a122_0x5102fc[_0x155de8(0x18a)](getExperimentalArtifactsDir(_0x6c9877),{'recursive':!![]});const _0x26c3bc=a122_0x1dfc50[_0x155de8(0x10d)](_0x6c9877,_0x155de8(0x10b));a122_0x5102fc['writeFileSync'](_0x26c3bc,createAgentConfigContent(_0x17d2f9));for(const _0x188ea5 of _0x5aef77){if(_0x188ea5[_0x155de8(0x166)])a122_0x5102fc[_0x155de8(0x18a)](_0x188ea5['path'],{'recursive':!![]});else{const _0x304792=a122_0x1dfc50[_0x155de8(0x147)](_0x188ea5[_0x155de8(0x134)]);!a122_0x5102fc['existsSync'](_0x304792)&&a122_0x5102fc[_0x155de8(0x18a)](_0x304792,{'recursive':!![]}),a122_0x5102fc[_0x155de8(0x137)](_0x188ea5['path'],_0x188ea5[_0x155de8(0x161)]);}}for(const _0x237774 of _0x5ea6ec){_0x237774[_0x155de8(0x166)]?(a122_0x5102fc[_0x155de8(0x172)](_0x237774['path'],{'recursive':!![],'force':!![]}),this[_0x155de8(0x120)][_0x155de8(0x1cf)]('Removed\x20deleted\x20directory:\x20'+a122_0x1dfc50[_0x155de8(0x1c3)](a122_0x1dfc50[_0x155de8(0x147)](_0x237774[_0x155de8(0x134)]))+'/'+a122_0x1dfc50[_0x155de8(0x1c3)](_0x237774[_0x155de8(0x134)]))):(a122_0x5102fc[_0x155de8(0x172)](_0x237774[_0x155de8(0x134)],{'force':!![]}),this[_0x155de8(0x120)]['info'](_0x155de8(0x208)+a122_0x1dfc50[_0x155de8(0x1c3)](a122_0x1dfc50[_0x155de8(0x147)](_0x237774[_0x155de8(0x134)]))+'/'+a122_0x1dfc50['basename'](_0x237774[_0x155de8(0x134)])));}return _0x58dfc7;}async[a122_0x1a5445(0x16b)](_0x45d110,_0x50a001){const _0x416f34=a122_0x1a5445,_0x1f93e0=a122_0x1dfc50[_0x416f34(0x10d)](_0x45d110,'tdx.json');if(!a122_0x5102fc[_0x416f34(0x196)](_0x1f93e0))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x416f34(0x1d0)+_0x45d110,undefined,{'helpText':_0x416f34(0x1db)});const _0x47fdfd=loadAgentConfig(_0x1f93e0),_0x2f0a27=await this[_0x416f34(0x181)](_0x47fdfd[_0x416f34(0x1e7)]),_0x11b78e=await this[_0x416f34(0x1ee)][_0x416f34(0x182)](_0x2f0a27),_0x38e9b0=_0x11b78e[_0x416f34(0x16e)][_0x416f34(0x144)],_0x3e445b={'projectName':_0x38e9b0,'projectId':_0x2f0a27,'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}}},_0x4c7250=[],_0x34ddba=[],_0x2f2f85=[],_0xa1e956=[],_0x562844=[],_0x494a1f=[],_0x18e3c1=a122_0x5102fc[_0x416f34(0x151)](_0x45d110,{'withFileTypes':!![]});for(const _0x29f260 of _0x18e3c1){if(!_0x29f260[_0x416f34(0x18c)]())continue;if(['knowledge_bases',_0x416f34(0x183),_0x416f34(0x1d3),_0x416f34(0x123),'experimental_artifacts']['includes'](_0x29f260[_0x416f34(0x144)]))continue;const _0x12709e=a122_0x1dfc50[_0x416f34(0x10d)](_0x45d110,_0x29f260['name']);if(isAgentDir(_0x12709e)){const _0x213cee=a122_0x1dfc50[_0x416f34(0x10d)](_0x12709e,_0x416f34(0x110)),_0xd92ba0=a122_0x1dfc50['join'](_0x12709e,_0x416f34(0x1bb)),_0x57cdc5=a122_0x1dfc50['join'](_0x12709e,'starter_message.md'),_0x15f829=parseAgentYaml(a122_0x5102fc[_0x416f34(0x1ea)](_0x213cee,_0x416f34(0x174)),_0x213cee),_0x5debb3=a122_0x5102fc['existsSync'](_0xd92ba0)?a122_0x5102fc['readFileSync'](_0xd92ba0,_0x416f34(0x174)):'',_0x48d395=a122_0x5102fc[_0x416f34(0x196)](_0x57cdc5)?a122_0x5102fc[_0x416f34(0x1ea)](_0x57cdc5,'utf-8'):_0x15f829[_0x416f34(0x1c4)];_0x4c7250[_0x416f34(0x180)]({'name':_0x15f829['name'],'dir':_0x12709e,'yaml':_0x15f829,'systemPrompt':_0x5debb3,'starterMessage':_0x48d395});}}const _0x3cb6b9=getKnowledgeBasesDir(_0x45d110);if(a122_0x5102fc[_0x416f34(0x196)](_0x3cb6b9)){const _0x177885=a122_0x5102fc[_0x416f34(0x151)](_0x3cb6b9);for(const _0x1c590c of _0x177885){const _0x30358d=a122_0x1dfc50['join'](_0x3cb6b9,_0x1c590c);if(_0x1c590c[_0x416f34(0x1fa)](_0x416f34(0x165))){const _0x5193d8=parseKnowledgeBaseYaml(a122_0x5102fc[_0x416f34(0x1ea)](_0x30358d,_0x416f34(0x174)),_0x30358d);_0x34ddba['push']({'name':_0x5193d8[_0x416f34(0x144)],'path':_0x30358d,'yaml':_0x5193d8});}else{if(_0x1c590c[_0x416f34(0x1fa)](_0x416f34(0x14c))){const _0x318f6b=a122_0x5102fc['readFileSync'](_0x30358d,_0x416f34(0x174)),{name:_0x4cdd6d,text:_0x44fbee}=parseTextKnowledgeBaseMd(_0x318f6b,_0x1c590c);_0x2f2f85[_0x416f34(0x180)]({'name':_0x4cdd6d,'path':_0x30358d,'text':_0x44fbee});}}}}const _0x54bc76=getPromptsDir(_0x45d110);if(a122_0x5102fc[_0x416f34(0x196)](_0x54bc76)){const _0x4fdae0=a122_0x5102fc['readdirSync'](_0x54bc76)[_0x416f34(0x148)](_0x154769=>_0x154769[_0x416f34(0x1fa)]('.yml'));for(const _0x59bd98 of _0x4fdae0){const _0x309ca4=a122_0x1dfc50['join'](_0x54bc76,_0x59bd98),_0x3ed071=parsePromptYaml(a122_0x5102fc['readFileSync'](_0x309ca4,_0x416f34(0x174)),_0x309ca4);_0xa1e956[_0x416f34(0x180)]({'name':_0x3ed071['name'],'path':_0x309ca4,'yaml':_0x3ed071});}}const _0x291e56=[],_0x8e3c8f=getIntegrationsDir(_0x45d110);if(a122_0x5102fc[_0x416f34(0x196)](_0x8e3c8f)){const _0x3cf217=a122_0x5102fc[_0x416f34(0x151)](_0x8e3c8f)[_0x416f34(0x148)](_0x437970=>_0x437970[_0x416f34(0x1fa)](_0x416f34(0x165)));for(const _0x3d100f of _0x3cf217){const _0x5ad622=a122_0x1dfc50[_0x416f34(0x10d)](_0x8e3c8f,_0x3d100f),_0x1d86f1=parseIntegrationYaml(a122_0x5102fc[_0x416f34(0x1ea)](_0x5ad622,_0x416f34(0x174)),_0x5ad622);if(!SAFE_INTEGRATION_TYPES['includes'](_0x1d86f1[_0x416f34(0x1d7)]['toLowerCase']())){this[_0x416f34(0x120)][_0x416f34(0x14f)]('Skipping\x20integration\x20\x27'+_0x1d86f1[_0x416f34(0x144)]+'\x27\x20('+_0x1d86f1[_0x416f34(0x1d7)]+_0x416f34(0x1f2)+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x416f34(0x1ba))+_0x416f34(0x199));continue;}_0x291e56['push']({'name':_0x1d86f1[_0x416f34(0x144)],'path':_0x5ad622,'yaml':_0x1d86f1});}}const _0x201d0c=getExperimentalKnowledgeBasesDir(_0x45d110);if(a122_0x5102fc[_0x416f34(0x196)](_0x201d0c)){const _0x3b9284=a122_0x5102fc['readdirSync'](_0x201d0c,{'withFileTypes':!![]});for(const _0x25563d of _0x3b9284){if(!_0x25563d[_0x416f34(0x18c)]())continue;const _0x495b8b=a122_0x1dfc50[_0x416f34(0x10d)](_0x201d0c,_0x25563d['name']),_0x13bbfb=a122_0x1dfc50[_0x416f34(0x10d)](_0x495b8b,_0x25563d['name']+_0x416f34(0x165)),_0x3d3de4=a122_0x1dfc50[_0x416f34(0x10d)](_0x495b8b,_0x416f34(0x119));if(!a122_0x5102fc[_0x416f34(0x196)](_0x13bbfb))continue;const _0x1013d4=parseExperimentalKnowledgeBaseYaml(a122_0x5102fc[_0x416f34(0x1ea)](_0x13bbfb,_0x416f34(0x174)),_0x13bbfb),_0x2feeb8=[];if(a122_0x5102fc[_0x416f34(0x196)](_0x3d3de4)){const _0xe41fa5=a122_0x5102fc[_0x416f34(0x151)](_0x3d3de4,{'withFileTypes':!![]});for(const _0x158a96 of _0xe41fa5){if(!_0x158a96[_0x416f34(0x18c)]())continue;const _0x503be0=a122_0x1dfc50[_0x416f34(0x10d)](_0x3d3de4,_0x158a96[_0x416f34(0x144)]),_0x13ea77=a122_0x1dfc50[_0x416f34(0x10d)](_0x503be0,_0x416f34(0x1a8)),_0x254a08=a122_0x1dfc50[_0x416f34(0x10d)](_0x503be0,'json_schema.json');a122_0x5102fc[_0x416f34(0x196)](_0x13ea77)&&a122_0x5102fc[_0x416f34(0x196)](_0x254a08)&&_0x2feeb8[_0x416f34(0x180)]({'name':_0x158a96[_0x416f34(0x144)],'code':a122_0x5102fc['readFileSync'](_0x13ea77,'utf-8'),'json_schema':a122_0x5102fc[_0x416f34(0x1ea)](_0x254a08,_0x416f34(0x174))});}}const _0xe9d633={..._0x1013d4,'variables':_0x1013d4[_0x416f34(0x142)]||[],'functions':_0x2feeb8};_0x562844[_0x416f34(0x180)]({'name':_0x1013d4[_0x416f34(0x144)],'dir':_0x495b8b,'def':_0xe9d633});}}const _0x3a32f8=getExperimentalArtifactsDir(_0x45d110);if(a122_0x5102fc[_0x416f34(0x196)](_0x3a32f8)){const _0x1c7583=a122_0x5102fc[_0x416f34(0x151)](_0x3a32f8,{'withFileTypes':!![]});for(const _0x502a53 of _0x1c7583){if(!_0x502a53[_0x416f34(0x18c)]())continue;const _0x5d07d7=a122_0x1dfc50[_0x416f34(0x10d)](_0x3a32f8,_0x502a53['name']),_0x2a476f=a122_0x1dfc50[_0x416f34(0x10d)](_0x5d07d7,_0x502a53[_0x416f34(0x144)]+'.yml'),_0x3d848f=a122_0x1dfc50['join'](_0x5d07d7,'code.js'),_0x5be9a2=a122_0x1dfc50[_0x416f34(0x10d)](_0x5d07d7,_0x416f34(0x19f));if(!a122_0x5102fc[_0x416f34(0x196)](_0x2a476f)||!a122_0x5102fc[_0x416f34(0x196)](_0x3d848f))continue;const _0x2cfdc0=parseExperimentalArtifactYaml(a122_0x5102fc[_0x416f34(0x1ea)](_0x2a476f,'utf-8'),_0x2a476f),_0x9d311e=a122_0x5102fc[_0x416f34(0x1ea)](_0x3d848f,'utf-8'),_0x423a59=[];if(a122_0x5102fc['existsSync'](_0x5be9a2)){const _0x20e27c=a122_0x5102fc[_0x416f34(0x151)](_0x5be9a2);for(const _0x5b3e05 of _0x20e27c){const _0x4d222f=a122_0x1dfc50[_0x416f34(0x10d)](_0x5be9a2,_0x5b3e05);a122_0x5102fc[_0x416f34(0x16a)](_0x4d222f)['isFile']()&&_0x423a59[_0x416f34(0x180)]({'file_name':_0x5b3e05,'text_content':a122_0x5102fc['readFileSync'](_0x4d222f,'utf-8')});}}const _0xe996e6={..._0x2cfdc0,'code':_0x9d311e,'files':_0x423a59};_0x494a1f[_0x416f34(0x180)]({'name':_0x2cfdc0[_0x416f34(0x144)],'dir':_0x5d07d7,'def':_0xe996e6});}}const _0x46a0c9=await this[_0x416f34(0x1ee)][_0x416f34(0x107)](_0x2f0a27),_0x4a8f59=await this[_0x416f34(0x1ee)]['listKnowledgeBases'](_0x2f0a27),_0x53000a=await this[_0x416f34(0x1ee)][_0x416f34(0x18b)](_0x2f0a27),_0x2235d0=await this[_0x416f34(0x1ee)][_0x416f34(0x135)](_0x2f0a27),_0x2727d3=await this[_0x416f34(0x1ee)][_0x416f34(0x17b)](_0x2f0a27),_0x3032a5=await safeListOrEmpty(()=>this[_0x416f34(0x1ee)]['listExperimentalKnowledgeBases'](_0x2f0a27)),_0x4a1518=await safeListOrEmpty(()=>this['client']['listExperimentalArtifacts'](_0x2f0a27)),_0x133784=await fetchAllToolTargetMaps((_0x30b3ac,_0x10e72c)=>this[_0x416f34(0x1ee)][_0x416f34(0x19a)](_0x30b3ac,_0x10e72c),_0x2f0a27),_0x3b127a=new Map(),_0x52b34d=new Map(),_0x4e8ad7=new Map(),_0x5ea886=new Map(),_0x5e41e2=new Map(),_0x4bc5fa=new Map(),_0x5c32dc=new Map();for(const _0x41e5ad of _0x46a0c9){_0x3b127a[_0x416f34(0x14b)](_0x41e5ad[_0x416f34(0x16e)][_0x416f34(0x144)],_0x41e5ad);}for(const _0x402627 of _0x4a8f59){_0x52b34d[_0x416f34(0x14b)](_0x402627[_0x416f34(0x16e)][_0x416f34(0x144)],_0x402627);}for(const _0x4fc540 of _0x53000a){_0x4e8ad7['set'](_0x4fc540[_0x416f34(0x16e)][_0x416f34(0x144)],_0x4fc540);}for(const _0x1ce367 of _0x2235d0){_0x5ea886[_0x416f34(0x14b)](_0x1ce367[_0x416f34(0x16e)]['name'],_0x1ce367);}for(const _0x2d85f6 of _0x2727d3){_0x5e41e2[_0x416f34(0x14b)](_0x2d85f6[_0x416f34(0x16e)][_0x416f34(0x1b9)][_0x416f34(0x197)](),_0x2d85f6);}for(const _0x3623d5 of _0x3032a5){_0x4bc5fa[_0x416f34(0x14b)](_0x3623d5[_0x416f34(0x16e)]['name'],_0x3623d5);}for(const _0x138ac6 of _0x4a1518){_0x5c32dc[_0x416f34(0x14b)](_0x138ac6[_0x416f34(0x16e)][_0x416f34(0x144)],_0x138ac6);}const _0x5522aa=new Map(),_0x1ca379=new Map();for(const _0x44938b of _0x46a0c9){_0x5522aa[_0x416f34(0x14b)](_0x44938b[_0x416f34(0x16e)]['name'],_0x44938b['id']),_0x1ca379['set'](_0x44938b['id'],_0x44938b['attributes'][_0x416f34(0x144)]);}const _0x30a7b5=new Map(),_0x543ee6=new Map();for(const _0x4002d9 of _0x2235d0){_0x30a7b5[_0x416f34(0x14b)](_0x4002d9[_0x416f34(0x16e)]['name'],_0x4002d9['id']),_0x543ee6[_0x416f34(0x14b)](_0x4002d9['id'],_0x4002d9[_0x416f34(0x16e)][_0x416f34(0x144)]);}const _0x9b1dc8=_0x133784[_0x416f34(0x122)][_0x416f34(0x157)]||new Map(),_0x3d6661=_0x133784[_0x416f34(0x122)][_0x416f34(0x155)]||new Map(),_0x532152=_0x133784[_0x416f34(0x122)]['ExperimentalKnowledgeBase']||new Map(),_0x564cf6=new Map(),_0x4458b8={'resolveToolTargetName':buildNameResolver({..._0x133784['idToName'],'Agent':_0x1ca379}),'resolvePromptName':async _0x47839f=>_0x543ee6[_0x416f34(0x1e8)](_0x47839f),'onWarning':_0x517cd4=>this['logger'][_0x416f34(0x14f)](_0x517cd4)};let _0x13612d=[];const _0x2281ae={'projectId':_0x2f0a27,'resolveToolTargetId':buildIdResolver({..._0x133784['nameToId'],'Agent':_0x5522aa}),'resolvePromptId':async _0x2cdf57=>_0x30a7b5['get'](_0x2cdf57),'onWarning':_0x16e769=>{const _0x196069=_0x416f34;this[_0x196069(0x120)][_0x196069(0x14f)](_0x16e769),_0x13612d[_0x196069(0x180)](_0x16e769);}},{resolved:_0x1ee89,unresolved:_0x4c110e}=resolveAgentDependencies(_0x4c7250,new Set(_0x3b127a[_0x416f34(0x14d)]()));for(const {agent:_0x24dc4c,missingDeps:_0x41c242}of _0x4c110e){_0x3e445b[_0x416f34(0x1c8)]['push']({'agentName':_0x24dc4c[_0x416f34(0x12b)]['name'],'action':'error','error':_0x416f34(0x10c)+_0x41c242[_0x416f34(0x10d)](',\x20')+_0x416f34(0x11a)}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x1c8)][_0x416f34(0x189)]++;}for(const _0x17554a of _0x34ddba){const _0x45b5b7=_0x52b34d[_0x416f34(0x1e8)](_0x17554a['yaml'][_0x416f34(0x144)]),_0x47b35a=a122_0x5102fc[_0x416f34(0x1ea)](_0x17554a[_0x416f34(0x134)],_0x416f34(0x174));if(_0x45b5b7){const _0x470e44=apiKnowledgeBaseToYaml(_0x45b5b7),_0x5e7190=toKnowledgeBaseYamlString(_0x470e44),_0x1694eb=generateDiff(_0x5e7190,_0x47b35a),_0x3febed=hasChanges(_0x1694eb);_0x3febed?(_0x3e445b[_0x416f34(0x207)][_0x416f34(0x180)]({'name':_0x17554a[_0x416f34(0x12b)][_0x416f34(0x144)],'action':'updated','id':_0x45b5b7['id'],'diff':formatDiffWithColors(_0x1694eb)}),_0x3e445b[_0x416f34(0x19d)]['knowledgeBases'][_0x416f34(0x167)]++):(_0x3e445b[_0x416f34(0x207)][_0x416f34(0x180)]({'name':_0x17554a[_0x416f34(0x12b)][_0x416f34(0x144)],'action':'unchanged','id':_0x45b5b7['id']}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x207)][_0x416f34(0x168)]++);}else _0x3e445b['knowledgeBases'][_0x416f34(0x180)]({'name':_0x17554a[_0x416f34(0x12b)][_0x416f34(0x144)],'action':_0x416f34(0x111)}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x207)][_0x416f34(0x111)]++;}for(const _0x270220 of _0x2f2f85){const _0x1df0de=_0x4e8ad7['get'](_0x270220[_0x416f34(0x144)]),_0x557b9e=a122_0x5102fc['readFileSync'](_0x270220[_0x416f34(0x134)],_0x416f34(0x174));if(_0x1df0de){const _0xb4b7cc=toTextKnowledgeBaseMd(_0x1df0de[_0x416f34(0x16e)][_0x416f34(0x144)],_0x1df0de[_0x416f34(0x16e)][_0x416f34(0x1a2)]),_0x141086=generateDiff(_0xb4b7cc,_0x557b9e),_0x226a9c=hasChanges(_0x141086);_0x226a9c?(_0x3e445b[_0x416f34(0x13b)][_0x416f34(0x180)]({'name':_0x270220[_0x416f34(0x144)],'action':_0x416f34(0x167),'id':_0x1df0de['id'],'diff':formatDiffWithColors(_0x141086)}),_0x3e445b['counts']['textKnowledgeBases'][_0x416f34(0x167)]++):(_0x3e445b['textKnowledgeBases'][_0x416f34(0x180)]({'name':_0x270220['name'],'action':_0x416f34(0x168),'id':_0x1df0de['id']}),_0x3e445b['counts'][_0x416f34(0x13b)][_0x416f34(0x168)]++);}else _0x3e445b[_0x416f34(0x13b)]['push']({'name':_0x270220[_0x416f34(0x144)],'action':_0x416f34(0x111)}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x13b)][_0x416f34(0x111)]++;}for(const _0x9f4ff of _0x1ee89){const _0x532ad7=_0x3b127a['get'](_0x9f4ff[_0x416f34(0x12b)][_0x416f34(0x144)]),_0x3dab4f=a122_0x1dfc50[_0x416f34(0x10d)](_0x9f4ff[_0x416f34(0x150)],_0x416f34(0x110)),_0x59b212=a122_0x5102fc[_0x416f34(0x1ea)](_0x3dab4f,_0x416f34(0x174)),_0x538efc=_0x9f4ff[_0x416f34(0x185)],_0x4baeca=_0x416f34(0x11e)+_0x538efc+'\x0a\x0a#\x20agent.yml\x0a'+_0x59b212;if(_0x532ad7){const {yaml:_0x3cb4a8,systemPrompt:_0x3c85b7}=await agentResponseToDef(_0x532ad7,_0x4458b8),_0x371803=toAgentYamlString(_0x3cb4a8),_0x510294=_0x416f34(0x11e)+_0x3c85b7+_0x416f34(0x15e)+_0x371803,_0x5c6fde=generateDiff(_0x510294,_0x4baeca),_0x1c2b25=hasChanges(_0x5c6fde);_0x1c2b25?(_0x3e445b[_0x416f34(0x1c8)][_0x416f34(0x180)]({'agentName':_0x9f4ff[_0x416f34(0x12b)][_0x416f34(0x144)],'action':_0x416f34(0x167),'agentId':_0x532ad7['id'],'diff':formatDiffWithColors(_0x5c6fde)}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x1c8)][_0x416f34(0x167)]++):(_0x3e445b[_0x416f34(0x1c8)][_0x416f34(0x180)]({'agentName':_0x9f4ff[_0x416f34(0x12b)][_0x416f34(0x144)],'action':_0x416f34(0x168),'agentId':_0x532ad7['id']}),_0x3e445b['counts'][_0x416f34(0x1c8)][_0x416f34(0x168)]++);}else _0x3e445b[_0x416f34(0x1c8)][_0x416f34(0x180)]({'agentName':_0x9f4ff[_0x416f34(0x12b)][_0x416f34(0x144)],'action':_0x416f34(0x111)}),_0x3e445b[_0x416f34(0x19d)]['agents'][_0x416f34(0x111)]++;}for(const _0x4d5e2e of _0xa1e956){const _0x211206=_0x5ea886[_0x416f34(0x1e8)](_0x4d5e2e[_0x416f34(0x12b)][_0x416f34(0x144)]),_0x369af5=a122_0x5102fc[_0x416f34(0x1ea)](_0x4d5e2e[_0x416f34(0x134)],_0x416f34(0x174));if(_0x211206){const _0x1e3ebc=await apiPromptToYaml(_0x211206,_0x4458b8);if(!_0x1e3ebc){_0x3e445b['prompts'][_0x416f34(0x180)]({'name':_0x4d5e2e[_0x416f34(0x12b)][_0x416f34(0x144)],'action':'updated','id':_0x211206['id']}),_0x3e445b[_0x416f34(0x19d)]['prompts'][_0x416f34(0x167)]++;continue;}const _0x31123b=toPromptYamlString(_0x1e3ebc),_0x37f6f8=generateDiff(_0x31123b,_0x369af5),_0x400319=hasChanges(_0x37f6f8);_0x400319?(_0x3e445b['prompts'][_0x416f34(0x180)]({'name':_0x4d5e2e['yaml'][_0x416f34(0x144)],'action':_0x416f34(0x167),'id':_0x211206['id'],'diff':formatDiffWithColors(_0x37f6f8)}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x183)][_0x416f34(0x167)]++):(_0x3e445b['prompts'][_0x416f34(0x180)]({'name':_0x4d5e2e[_0x416f34(0x12b)][_0x416f34(0x144)],'action':'unchanged','id':_0x211206['id']}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x183)][_0x416f34(0x168)]++);}else _0x3e445b['prompts']['push']({'name':_0x4d5e2e[_0x416f34(0x12b)][_0x416f34(0x144)],'action':_0x416f34(0x111)}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x183)]['created']++;}for(const _0x21752f of _0x291e56){const _0x214cb2=_0x5e41e2[_0x416f34(0x1e8)](_0x21752f[_0x416f34(0x12b)][_0x416f34(0x1d7)]),_0xe12308=a122_0x5102fc[_0x416f34(0x1ea)](_0x21752f[_0x416f34(0x134)],'utf-8');if(_0x214cb2){const _0xf76139=await apiIntegrationToYaml(_0x214cb2,_0x4458b8),_0x41532a=toIntegrationYamlString(_0xf76139),_0x44b225=generateDiff(_0x41532a,_0xe12308),_0x2ae62f=hasChanges(_0x44b225);_0x2ae62f?(_0x3e445b[_0x416f34(0x1d3)][_0x416f34(0x180)]({'name':_0x21752f['yaml']['service_type'],'action':_0x416f34(0x167),'id':_0x214cb2['id'],'diff':formatDiffWithColors(_0x44b225)}),_0x3e445b[_0x416f34(0x19d)]['integrations'][_0x416f34(0x167)]++):(_0x3e445b['integrations'][_0x416f34(0x180)]({'name':_0x21752f[_0x416f34(0x12b)]['service_type'],'action':_0x416f34(0x168),'id':_0x214cb2['id']}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x1d3)][_0x416f34(0x168)]++);}else _0x3e445b[_0x416f34(0x1d3)][_0x416f34(0x180)]({'name':_0x21752f[_0x416f34(0x12b)]['service_type'],'action':_0x416f34(0x111)}),_0x3e445b['counts'][_0x416f34(0x1d3)][_0x416f34(0x111)]++;}for(const _0x88eeed of _0x562844){const _0x42ccb6=_0x4bc5fa[_0x416f34(0x1e8)](_0x88eeed[_0x416f34(0x1c1)][_0x416f34(0x144)]),_0x1d5a88=toExperimentalKnowledgeBaseYamlString(_0x88eeed[_0x416f34(0x1c1)]);let _0x2dfb67=_0x1d5a88;for(const _0x4857f4 of _0x88eeed[_0x416f34(0x1c1)][_0x416f34(0x119)]){_0x2dfb67+=_0x416f34(0x18e)+_0x4857f4[_0x416f34(0x144)]+_0x416f34(0x1f4)+_0x4857f4[_0x416f34(0x1f6)]+_0x416f34(0x13e)+_0x4857f4[_0x416f34(0x144)]+_0x416f34(0x1f4)+_0x4857f4[_0x416f34(0x203)]+'\x0a';}if(_0x42ccb6){const _0xda4375=apiExperimentalKnowledgeBaseToYaml(_0x42ccb6),_0x48ad0b=toExperimentalKnowledgeBaseYamlString(_0xda4375);let _0x465ab0=_0x48ad0b;for(const _0x50264f of _0xda4375[_0x416f34(0x119)]){_0x465ab0+='\x0a---\x20function:\x20'+_0x50264f[_0x416f34(0x144)]+_0x416f34(0x1f4)+_0x50264f['code']+_0x416f34(0x13e)+_0x50264f[_0x416f34(0x144)]+'\x20---\x0a'+_0x50264f[_0x416f34(0x203)]+'\x0a';}const _0x291135=generateDiff(_0x465ab0,_0x2dfb67),_0x405ec8=hasChanges(_0x291135);_0x405ec8?(_0x3e445b['experimentalKnowledgeBases'][_0x416f34(0x180)]({'name':_0x88eeed[_0x416f34(0x1c1)]['name'],'action':_0x416f34(0x167),'id':_0x42ccb6['id'],'diff':formatDiffWithColors(_0x291135)}),_0x3e445b[_0x416f34(0x19d)]['experimentalKnowledgeBases']['updated']++):(_0x3e445b['experimentalKnowledgeBases'][_0x416f34(0x180)]({'name':_0x88eeed['def'][_0x416f34(0x144)],'action':_0x416f34(0x168),'id':_0x42ccb6['id']}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x190)][_0x416f34(0x168)]++);}else _0x3e445b[_0x416f34(0x190)][_0x416f34(0x180)]({'name':_0x88eeed['def'][_0x416f34(0x144)],'action':'created'}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x190)][_0x416f34(0x111)]++;}for(const _0x5a8d28 of _0x494a1f){const _0x41daf1=_0x5c32dc[_0x416f34(0x1e8)](_0x5a8d28[_0x416f34(0x1c1)][_0x416f34(0x144)]),_0x248269=toExperimentalArtifactYamlString(_0x5a8d28['def']);let _0x15f079=_0x248269+(_0x416f34(0x17f)+_0x5a8d28[_0x416f34(0x1c1)]['code']+'\x0a');for(const _0x40c89e of _0x5a8d28[_0x416f34(0x1c1)][_0x416f34(0x19f)]){_0x15f079+='---\x20file:\x20'+_0x40c89e[_0x416f34(0x12c)]+_0x416f34(0x1f4)+_0x40c89e[_0x416f34(0x136)]+'\x0a';}if(_0x41daf1){const _0x269218=apiExperimentalArtifactToYaml(_0x41daf1),_0x5cb254=toExperimentalArtifactYamlString(_0x269218);let _0x147d3a=_0x5cb254+(_0x416f34(0x17f)+_0x269218[_0x416f34(0x1f6)]+'\x0a');for(const _0x4ba1e0 of _0x269218[_0x416f34(0x19f)]){_0x147d3a+=_0x416f34(0x127)+_0x4ba1e0[_0x416f34(0x12c)]+_0x416f34(0x1f4)+_0x4ba1e0[_0x416f34(0x136)]+'\x0a';}const _0x304a08=generateDiff(_0x147d3a,_0x15f079),_0x3b52a3=hasChanges(_0x304a08);_0x3b52a3?(_0x3e445b[_0x416f34(0x1a1)][_0x416f34(0x180)]({'name':_0x5a8d28['def'][_0x416f34(0x144)],'action':'updated','id':_0x41daf1['id'],'diff':formatDiffWithColors(_0x304a08)}),_0x3e445b['counts']['experimentalArtifacts'][_0x416f34(0x167)]++):(_0x3e445b[_0x416f34(0x1a1)][_0x416f34(0x180)]({'name':_0x5a8d28[_0x416f34(0x1c1)][_0x416f34(0x144)],'action':_0x416f34(0x168),'id':_0x41daf1['id']}),_0x3e445b['counts'][_0x416f34(0x1a1)][_0x416f34(0x168)]++);}else _0x3e445b[_0x416f34(0x1a1)][_0x416f34(0x180)]({'name':_0x5a8d28[_0x416f34(0x1c1)][_0x416f34(0x144)],'action':_0x416f34(0x111)}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x1a1)][_0x416f34(0x111)]++;}if(_0x50a001?.['dryRun'])return _0x3e445b;_0x3e445b[_0x416f34(0x207)]=[],_0x3e445b[_0x416f34(0x13b)]=[],_0x3e445b[_0x416f34(0x183)]=[],_0x3e445b[_0x416f34(0x1d3)]=[],_0x3e445b['experimentalKnowledgeBases']=[],_0x3e445b[_0x416f34(0x1a1)]=[];const _0x22e387=_0x3e445b[_0x416f34(0x1c8)]['filter'](_0x5c8c1e=>_0x5c8c1e[_0x416f34(0x18f)]===_0x416f34(0x1b3));_0x3e445b[_0x416f34(0x1c8)]=_0x22e387,_0x3e445b[_0x416f34(0x19d)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x22e387[_0x416f34(0x1b1)]},'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 _0x1dc7f5 of _0x34ddba){try{const _0x5ace15=_0x52b34d[_0x416f34(0x1e8)](_0x1dc7f5[_0x416f34(0x12b)]['name']),_0x267b18=yamlKnowledgeBaseToApi(_0x1dc7f5[_0x416f34(0x12b)],_0x2f0a27);if(_0x5ace15)await this['client']['updateKnowledgeBase'](_0x5ace15['id'],_0x267b18),_0x9b1dc8['set'](_0x1dc7f5['yaml'][_0x416f34(0x144)],_0x5ace15['id']),_0x3e445b[_0x416f34(0x207)]['push']({'name':_0x1dc7f5['yaml'][_0x416f34(0x144)],'action':_0x416f34(0x167),'id':_0x5ace15['id']}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x207)]['updated']++;else{const _0xa211fd=await this[_0x416f34(0x1ee)][_0x416f34(0x177)](_0x267b18);_0x9b1dc8[_0x416f34(0x14b)](_0x1dc7f5[_0x416f34(0x12b)][_0x416f34(0x144)],_0xa211fd['id']),_0x3e445b['knowledgeBases']['push']({'name':_0x1dc7f5['yaml'][_0x416f34(0x144)],'action':'created','id':_0xa211fd['id']}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x207)][_0x416f34(0x111)]++;}}catch(_0x9cf7b9){_0x3e445b['knowledgeBases'][_0x416f34(0x180)]({'name':_0x1dc7f5[_0x416f34(0x12b)][_0x416f34(0x144)],'action':_0x416f34(0x1b3),'error':_0x9cf7b9[_0x416f34(0x1ca)]}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x207)][_0x416f34(0x189)]++;}}for(const _0x521f23 of _0x2f2f85){try{const _0xd38248=_0x4e8ad7[_0x416f34(0x1e8)](_0x521f23[_0x416f34(0x144)]),_0x31a691=yamlTextKnowledgeBaseToApi({'name':_0x521f23[_0x416f34(0x144)],'text':_0x521f23['text']},_0x2f0a27);if(_0xd38248)await this[_0x416f34(0x1ee)][_0x416f34(0x143)](_0xd38248['id'],_0x31a691),_0x3d6661[_0x416f34(0x14b)](_0x521f23[_0x416f34(0x144)],_0xd38248['id']),_0x3e445b[_0x416f34(0x13b)][_0x416f34(0x180)]({'name':_0x521f23[_0x416f34(0x144)],'action':_0x416f34(0x167),'id':_0xd38248['id']}),_0x3e445b['counts'][_0x416f34(0x13b)]['updated']++;else{const _0x483167=await this[_0x416f34(0x1ee)][_0x416f34(0x124)](_0x31a691);_0x3d6661[_0x416f34(0x14b)](_0x521f23[_0x416f34(0x144)],_0x483167['id']),_0x3e445b['textKnowledgeBases'][_0x416f34(0x180)]({'name':_0x521f23['name'],'action':_0x416f34(0x111),'id':_0x483167['id']}),_0x3e445b['counts']['textKnowledgeBases'][_0x416f34(0x111)]++;}}catch(_0x2b6a5e){_0x3e445b[_0x416f34(0x13b)][_0x416f34(0x180)]({'name':_0x521f23[_0x416f34(0x144)],'action':_0x416f34(0x1b3),'error':_0x2b6a5e[_0x416f34(0x1ca)]}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x13b)][_0x416f34(0x189)]++;}}for(const _0x19aa4e of _0x562844){try{const _0x4d884e=_0x4bc5fa['get'](_0x19aa4e['def'][_0x416f34(0x144)]),_0x19230c=yamlExperimentalKnowledgeBaseToApi(_0x19aa4e[_0x416f34(0x1c1)],_0x2f0a27);if(_0x4d884e)await this[_0x416f34(0x1ee)][_0x416f34(0x1e2)](_0x4d884e['id'],_0x19230c),_0x532152['set'](_0x19aa4e[_0x416f34(0x1c1)][_0x416f34(0x144)],_0x4d884e['id']),_0x3e445b[_0x416f34(0x190)][_0x416f34(0x180)]({'name':_0x19aa4e[_0x416f34(0x1c1)][_0x416f34(0x144)],'action':'updated','id':_0x4d884e['id']}),_0x3e445b[_0x416f34(0x19d)]['experimentalKnowledgeBases'][_0x416f34(0x167)]++;else{const _0x203980=await this['client'][_0x416f34(0x140)](_0x19230c);_0x532152['set'](_0x19aa4e[_0x416f34(0x1c1)][_0x416f34(0x144)],_0x203980['id']),_0x3e445b['experimentalKnowledgeBases'][_0x416f34(0x180)]({'name':_0x19aa4e[_0x416f34(0x1c1)]['name'],'action':_0x416f34(0x111),'id':_0x203980['id']}),_0x3e445b[_0x416f34(0x19d)]['experimentalKnowledgeBases'][_0x416f34(0x111)]++;}}catch(_0x2faf7a){_0x3e445b['experimentalKnowledgeBases'][_0x416f34(0x180)]({'name':_0x19aa4e['def']['name'],'action':'error','error':_0x2faf7a['message']}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x190)]['errors']++;}}for(const _0x55dfdc of _0x494a1f){try{const _0x405752=_0x5c32dc[_0x416f34(0x1e8)](_0x55dfdc[_0x416f34(0x1c1)][_0x416f34(0x144)]),_0x467706=yamlExperimentalArtifactToApi(_0x55dfdc['def'],_0x2f0a27);if(_0x405752)await this[_0x416f34(0x1ee)][_0x416f34(0x1ce)](_0x405752['id'],_0x467706),_0x564cf6['set'](_0x55dfdc['def'][_0x416f34(0x144)],_0x405752['id']),_0x3e445b[_0x416f34(0x1a1)]['push']({'name':_0x55dfdc[_0x416f34(0x1c1)][_0x416f34(0x144)],'action':_0x416f34(0x167),'id':_0x405752['id']}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x1a1)]['updated']++;else{const _0x5507d3=await this['client'][_0x416f34(0x205)](_0x467706);_0x564cf6[_0x416f34(0x14b)](_0x55dfdc[_0x416f34(0x1c1)][_0x416f34(0x144)],_0x5507d3['id']),_0x3e445b[_0x416f34(0x1a1)][_0x416f34(0x180)]({'name':_0x55dfdc[_0x416f34(0x1c1)][_0x416f34(0x144)],'action':_0x416f34(0x111),'id':_0x5507d3['id']}),_0x3e445b[_0x416f34(0x19d)]['experimentalArtifacts']['created']++;}}catch(_0x33b0b8){_0x3e445b[_0x416f34(0x1a1)][_0x416f34(0x180)]({'name':_0x55dfdc[_0x416f34(0x1c1)][_0x416f34(0x144)],'action':'error','error':_0x33b0b8['message']}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x1a1)][_0x416f34(0x189)]++;}}for(const _0x1a2fe5 of _0x1ee89){_0x13612d=[];try{const _0x22b531=_0x3b127a[_0x416f34(0x1e8)](_0x1a2fe5[_0x416f34(0x12b)][_0x416f34(0x144)]),_0x4d17fb=await agentDefToRequest(_0x1a2fe5[_0x416f34(0x12b)],_0x1a2fe5[_0x416f34(0x185)],_0x1a2fe5[_0x416f34(0x1c0)],_0x2281ae);if(_0x22b531)await this[_0x416f34(0x1ee)][_0x416f34(0x11c)](_0x22b531['id'],_0x4d17fb),_0x5522aa['set'](_0x1a2fe5['yaml'][_0x416f34(0x144)],_0x22b531['id']),_0x3e445b[_0x416f34(0x1c8)]['push']({'agentName':_0x1a2fe5[_0x416f34(0x12b)][_0x416f34(0x144)],'action':_0x416f34(0x167),'agentId':_0x22b531['id'],'warnings':_0x13612d[_0x416f34(0x1b1)]>0x0?_0x13612d:undefined}),_0x3e445b[_0x416f34(0x19d)]['agents'][_0x416f34(0x167)]++;else{const _0x1b8c36=await this[_0x416f34(0x1ee)][_0x416f34(0x19b)](_0x4d17fb);_0x5522aa['set'](_0x1a2fe5[_0x416f34(0x12b)][_0x416f34(0x144)],_0x1b8c36['id']),_0x3e445b[_0x416f34(0x1c8)]['push']({'agentName':_0x1a2fe5[_0x416f34(0x12b)][_0x416f34(0x144)],'action':_0x416f34(0x111),'agentId':_0x1b8c36['id'],'warnings':_0x13612d['length']>0x0?_0x13612d:undefined}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x1c8)][_0x416f34(0x111)]++;}}catch(_0xa85777){_0x3e445b[_0x416f34(0x1c8)][_0x416f34(0x180)]({'agentName':_0x1a2fe5[_0x416f34(0x12b)][_0x416f34(0x144)],'action':_0x416f34(0x1b3),'error':_0xa85777[_0x416f34(0x1ca)],'warnings':_0x13612d[_0x416f34(0x1b1)]>0x0?_0x13612d:undefined}),_0x3e445b['counts'][_0x416f34(0x1c8)]['errors']++;}}for(const _0x1cc077 of _0xa1e956){try{const _0x47d4c8=_0x5ea886[_0x416f34(0x1e8)](_0x1cc077[_0x416f34(0x12b)][_0x416f34(0x144)]),_0x43f9a0=await yamlPromptToApi(_0x1cc077[_0x416f34(0x12b)],_0x2f0a27,_0x2281ae);if(!_0x43f9a0){_0x3e445b[_0x416f34(0x183)][_0x416f34(0x180)]({'name':_0x1cc077['yaml']['name'],'action':'error','error':_0x416f34(0x160)}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x183)][_0x416f34(0x189)]++;continue;}if(_0x47d4c8)await this[_0x416f34(0x1ee)]['updatePrompt'](_0x47d4c8['id'],_0x43f9a0),_0x30a7b5[_0x416f34(0x14b)](_0x1cc077['yaml'][_0x416f34(0x144)],_0x47d4c8['id']),_0x3e445b[_0x416f34(0x183)][_0x416f34(0x180)]({'name':_0x1cc077[_0x416f34(0x12b)][_0x416f34(0x144)],'action':_0x416f34(0x167),'id':_0x47d4c8['id']}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x183)][_0x416f34(0x167)]++;else{const _0x15cb20=await this['client'][_0x416f34(0x201)](_0x43f9a0);_0x30a7b5[_0x416f34(0x14b)](_0x1cc077['yaml']['name'],_0x15cb20['id']),_0x3e445b[_0x416f34(0x183)][_0x416f34(0x180)]({'name':_0x1cc077['yaml'][_0x416f34(0x144)],'action':_0x416f34(0x111),'id':_0x15cb20['id']}),_0x3e445b[_0x416f34(0x19d)]['prompts']['created']++;}}catch(_0xb0e962){_0x3e445b[_0x416f34(0x183)]['push']({'name':_0x1cc077[_0x416f34(0x12b)][_0x416f34(0x144)],'action':_0x416f34(0x1b3),'error':_0xb0e962['message']}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x183)][_0x416f34(0x189)]++;}}for(const _0x20f930 of _0x291e56){try{const _0x214473=_0x5e41e2[_0x416f34(0x1e8)](_0x20f930[_0x416f34(0x12b)][_0x416f34(0x1d7)]),_0x38a27c=await yamlIntegrationToApi(_0x20f930[_0x416f34(0x12b)],_0x2f0a27,_0x2281ae);if(_0x214473){await this['client'][_0x416f34(0x104)](_0x214473['id']);const _0x4774ee=await this[_0x416f34(0x1ee)]['createIntegration'](_0x38a27c);_0x3e445b[_0x416f34(0x1d3)][_0x416f34(0x180)]({'name':_0x20f930[_0x416f34(0x12b)][_0x416f34(0x1d7)],'action':_0x416f34(0x167),'id':_0x4774ee['id']}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x1d3)][_0x416f34(0x167)]++;}else{const _0x3b9a0f=await this[_0x416f34(0x1ee)][_0x416f34(0x175)](_0x38a27c);_0x3e445b['integrations'][_0x416f34(0x180)]({'name':_0x20f930['yaml'][_0x416f34(0x1d7)],'action':_0x416f34(0x111),'id':_0x3b9a0f['id']}),_0x3e445b[_0x416f34(0x19d)]['integrations'][_0x416f34(0x111)]++;}}catch(_0x17407c){_0x3e445b[_0x416f34(0x1d3)]['push']({'name':_0x20f930['yaml']['service_type'],'action':'error','error':_0x17407c['message']}),_0x3e445b[_0x416f34(0x19d)][_0x416f34(0x1d3)][_0x416f34(0x189)]++;}}return _0x3e445b;}async[a122_0x1a5445(0x10f)](_0x1a979e,_0x357189,_0x58da6e,_0x12947b){const _0x159635=a122_0x1a5445,{projectId:_0x1cd03a,project:_0x102105}=await this[_0x159635(0x10a)](_0x1a979e),_0x2cab7e=_0x102105[_0x159635(0x16e)][_0x159635(0x144)],_0x5ebed9=await this[_0x159635(0x1ee)]['listAgentsFull'](_0x1cd03a),_0x12ab9b=_0x5ebed9[_0x159635(0x1e0)](_0x1f3def=>_0x1f3def[_0x159635(0x16e)][_0x159635(0x144)]===_0x357189);if(!_0x12ab9b)throw new SDKError(ErrorCode[_0x159635(0x192)],'Agent\x20not\x20found:\x20'+_0x357189,undefined,{'helpText':_0x159635(0x12a)+_0x5ebed9[_0x159635(0x191)](_0x448923=>_0x448923[_0x159635(0x16e)][_0x159635(0x144)])['join'](',\x20')});let _0x129a60;if(_0x58da6e)_0x129a60=_0x58da6e;else{const _0x4412ed=a122_0x1dfc50[_0x159635(0x10d)](process['cwd'](),_0x159635(0x1c8)),_0x3941d4=getSanitizedPathWithMigration(_0x4412ed,_0x2cab7e);_0x3941d4[_0x159635(0x1e3)]&&this[_0x159635(0x120)][_0x159635(0x1cf)](_0x159635(0x173)+a122_0x1dfc50[_0x159635(0x1c3)](_0x3941d4[_0x159635(0x164)])+'\x20→\x20'+a122_0x1dfc50[_0x159635(0x1c3)](_0x3941d4[_0x159635(0x134)])),_0x129a60=_0x3941d4[_0x159635(0x134)];}const _0x536900=getSanitizedPathWithMigration(_0x129a60,_0x357189);_0x536900[_0x159635(0x1e3)]&&this['logger'][_0x159635(0x1cf)](_0x159635(0x129)+a122_0x1dfc50[_0x159635(0x1c3)](_0x536900[_0x159635(0x164)])+'\x20→\x20'+a122_0x1dfc50['basename'](_0x536900[_0x159635(0x134)]));const _0x4f4db4=_0x536900[_0x159635(0x134)],_0x261c37=new Map(),_0x2a0135=new Map(),_0x236e57=await this[_0x159635(0x1ee)][_0x159635(0x106)](_0x1cd03a),_0x514d1d=await this['client']['listTextKnowledgeBases'](_0x1cd03a),_0x248b84=await safeListOrEmpty(()=>this['client'][_0x159635(0x1bf)](_0x1cd03a)),_0x3c808d=new Map(),_0x2d7d6b=new Map();for(const _0x1deecb of _0x236e57){_0x261c37[_0x159635(0x14b)](_0x1deecb['id'],_0x1deecb[_0x159635(0x16e)][_0x159635(0x144)]);}for(const _0x1ba1ea of _0x514d1d){_0x3c808d[_0x159635(0x14b)](_0x1ba1ea['id'],_0x1ba1ea[_0x159635(0x16e)][_0x159635(0x144)]);}for(const _0x332171 of _0x248b84){_0x2d7d6b[_0x159635(0x14b)](_0x332171['id'],_0x332171[_0x159635(0x16e)][_0x159635(0x144)]);}for(const _0x29f680 of _0x5ebed9){_0x2a0135['set'](_0x29f680['id'],_0x29f680[_0x159635(0x16e)][_0x159635(0x144)]);}const _0x2c8993={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x261c37,'TextKnowledgeBase':_0x3c808d,'Agent':_0x2a0135,'ExperimentalKnowledgeBase':_0x2d7d6b}),'resolvePromptName':async()=>undefined,'onWarning':_0x4e91b1=>this[_0x159635(0x120)][_0x159635(0x14f)](_0x4e91b1)},_0x8ff55e=a122_0x1dfc50[_0x159635(0x10d)](_0x4f4db4,_0x159635(0x1bb)),_0x66f4d4=a122_0x1dfc50[_0x159635(0x10d)](_0x4f4db4,_0x159635(0x110)),_0x8a8bba=a122_0x1dfc50[_0x159635(0x10d)](_0x4f4db4,_0x159635(0x1e6)),_0xad7e4d=!a122_0x5102fc[_0x159635(0x196)](_0x66f4d4);if(_0x12947b?.[_0x159635(0x16d)])return{'agentName':_0x357189,'outputPath':_0x4f4db4,'isNew':_0xad7e4d,'hasChanges':!![]};a122_0x5102fc[_0x159635(0x18a)](_0x129a60,{'recursive':!![]}),a122_0x5102fc[_0x159635(0x18a)](_0x4f4db4,{'recursive':!![]});const _0x2a835f=a122_0x1dfc50[_0x159635(0x10d)](_0x129a60,_0x159635(0x10b));!a122_0x5102fc[_0x159635(0x196)](_0x2a835f)&&a122_0x5102fc['writeFileSync'](_0x2a835f,createAgentConfigContent(_0x1a979e));const {yaml:_0x10a2f2,systemPrompt:_0x75b361,starterMessage:_0x5b1785}=await agentResponseToDef(_0x12ab9b,_0x2c8993);let _0x37cf1a=_0xad7e4d;if(!_0xad7e4d){const _0x1e2626=a122_0x5102fc[_0x159635(0x196)](_0x8ff55e)?a122_0x5102fc[_0x159635(0x1ea)](_0x8ff55e,'utf-8'):'',_0x2714d7=a122_0x5102fc[_0x159635(0x1ea)](_0x66f4d4,'utf-8');_0x37cf1a=_0x1e2626!==_0x75b361||_0x2714d7!==toAgentYamlString(_0x10a2f2);}a122_0x5102fc['writeFileSync'](_0x8ff55e,_0x75b361),a122_0x5102fc[_0x159635(0x137)](_0x66f4d4,toAgentYamlString(_0x10a2f2));if(_0x5b1785&&_0x5b1785['includes']('\x0a'))a122_0x5102fc[_0x159635(0x137)](_0x8a8bba,_0x5b1785);else a122_0x5102fc[_0x159635(0x196)](_0x8a8bba)&&a122_0x5102fc[_0x159635(0x132)](_0x8a8bba);return{'agentName':_0x357189,'outputPath':_0x4f4db4,'isNew':_0xad7e4d,'hasChanges':_0x37cf1a};}async[a122_0x1a5445(0x1ed)](_0x3d7b68,_0x16410b){const _0x13ab42=a122_0x1a5445;let _0x519a9c;isAgentYamlPath(_0x3d7b68)?_0x519a9c=getAgentDirFromYamlPath(_0x3d7b68):_0x519a9c=_0x3d7b68;const {config:_0x261767}=findAgentConfig(_0x519a9c),_0x804191=await this[_0x13ab42(0x181)](_0x261767[_0x13ab42(0x1e7)]),_0x2b039d=a122_0x1dfc50[_0x13ab42(0x10d)](_0x519a9c,_0x13ab42(0x110)),_0x31cd3b=a122_0x1dfc50[_0x13ab42(0x10d)](_0x519a9c,_0x13ab42(0x1bb)),_0x355089=a122_0x1dfc50[_0x13ab42(0x10d)](_0x519a9c,_0x13ab42(0x1e6));if(!a122_0x5102fc[_0x13ab42(0x196)](_0x2b039d))throw new SDKError(ErrorCode[_0x13ab42(0x14a)],'agent.yml\x20not\x20found\x20in\x20'+_0x519a9c,undefined,{'helpText':'Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.'});const _0x9efca2=parseAgentYaml(a122_0x5102fc[_0x13ab42(0x1ea)](_0x2b039d,_0x13ab42(0x174)),_0x2b039d),_0x3980d3=a122_0x5102fc[_0x13ab42(0x196)](_0x31cd3b)?a122_0x5102fc[_0x13ab42(0x1ea)](_0x31cd3b,'utf-8'):'',_0x38e8f7=a122_0x5102fc[_0x13ab42(0x196)](_0x355089)?a122_0x5102fc[_0x13ab42(0x1ea)](_0x355089,'utf-8'):_0x9efca2[_0x13ab42(0x1c4)];if(_0x16410b?.['dryRun'])return{'agentName':_0x9efca2['name'],'action':_0x13ab42(0x111),'projectId':_0x804191};const _0xb2873=await this['client'][_0x13ab42(0x107)](_0x804191),_0x1fcd33=await fetchAllToolTargetMaps((_0x342cea,_0x184091)=>this['client']['listToolTargets'](_0x342cea,_0x184091),_0x804191),_0x599ede=new Map();for(const _0x559e67 of _0xb2873){_0x599ede['set'](_0x559e67[_0x13ab42(0x16e)][_0x13ab42(0x144)],_0x559e67['id']);}const _0x4669e1=[],_0x5d8689={'projectId':_0x804191,'resolveToolTargetId':buildIdResolver({..._0x1fcd33[_0x13ab42(0x122)],'Agent':_0x599ede}),'resolvePromptId':async()=>undefined,'onWarning':_0x119e00=>{const _0x4452ab=_0x13ab42;this[_0x4452ab(0x120)][_0x4452ab(0x14f)](_0x119e00),_0x4669e1[_0x4452ab(0x180)](_0x119e00);}};try{const _0x11ac74=_0xb2873[_0x13ab42(0x1e0)](_0x11b41e=>_0x11b41e[_0x13ab42(0x16e)][_0x13ab42(0x144)]===_0x9efca2[_0x13ab42(0x144)]),_0x4738df=await agentDefToRequest(_0x9efca2,_0x3980d3,_0x38e8f7,_0x5d8689);if(_0x11ac74)return await this[_0x13ab42(0x1ee)]['updateAgentResponse'](_0x11ac74['id'],_0x4738df),{'agentName':_0x9efca2[_0x13ab42(0x144)],'action':_0x13ab42(0x167),'projectId':_0x804191,'agentId':_0x11ac74['id'],'warnings':_0x4669e1[_0x13ab42(0x1b1)]>0x0?_0x4669e1:undefined};else{const _0x254d50=await this['client'][_0x13ab42(0x19b)](_0x4738df);return{'agentName':_0x9efca2[_0x13ab42(0x144)],'action':'created','projectId':_0x804191,'agentId':_0x254d50['id'],'warnings':_0x4669e1[_0x13ab42(0x1b1)]>0x0?_0x4669e1:undefined};}}catch(_0x5afdad){return{'agentName':_0x9efca2[_0x13ab42(0x144)],'action':'error','projectId':_0x804191,'error':_0x5afdad['message'],'warnings':_0x4669e1[_0x13ab42(0x1b1)]>0x0?_0x4669e1:undefined};}}async[a122_0x1a5445(0x176)](_0x1ebe4c,_0x3c4528,_0x23f449){const _0xc21b30=a122_0x1a5445,_0x5e5db6=a122_0x5102fc[_0xc21b30(0x196)](_0x1ebe4c)&&a122_0x5102fc[_0xc21b30(0x196)](a122_0x1dfc50['join'](_0x1ebe4c,'tdx.json'));let _0x5f5372;const _0x44742a=[],_0x246b8a=[],_0x361046=[],_0xe6550c=[],_0x19793f=[],_0x1a656f=[],_0x25e995=[];if(_0x5e5db6){const _0x16f7b0=loadAgentConfig(a122_0x1dfc50['join'](_0x1ebe4c,_0xc21b30(0x10b)));_0x5f5372=_0x16f7b0[_0xc21b30(0x1e7)];const _0x561145=a122_0x5102fc[_0xc21b30(0x151)](_0x1ebe4c,{'withFileTypes':!![]});for(const _0x3e6369 of _0x561145){if(!_0x3e6369[_0xc21b30(0x18c)]())continue;if([_0xc21b30(0x1f9),_0xc21b30(0x123),_0xc21b30(0x1e4),_0xc21b30(0x183),'integrations']['includes'](_0x3e6369[_0xc21b30(0x144)]))continue;const _0x5c284b=a122_0x1dfc50[_0xc21b30(0x10d)](_0x1ebe4c,_0x3e6369['name']);if(isAgentDir(_0x5c284b)){const _0x248fe3=a122_0x1dfc50[_0xc21b30(0x10d)](_0x5c284b,_0xc21b30(0x110)),_0x162d33=a122_0x1dfc50[_0xc21b30(0x10d)](_0x5c284b,_0xc21b30(0x1bb)),_0x4c4459=a122_0x1dfc50[_0xc21b30(0x10d)](_0x5c284b,_0xc21b30(0x1e6)),_0x2700f1=parseAgentYaml(a122_0x5102fc[_0xc21b30(0x1ea)](_0x248fe3,'utf-8'),_0x248fe3),_0x52b0bd=a122_0x5102fc[_0xc21b30(0x196)](_0x162d33)?a122_0x5102fc[_0xc21b30(0x1ea)](_0x162d33,'utf-8'):'',_0x3c9ebb=a122_0x5102fc['existsSync'](_0x4c4459)?a122_0x5102fc[_0xc21b30(0x1ea)](_0x4c4459,'utf-8'):_0x2700f1['starter_message'];_0x44742a[_0xc21b30(0x180)]({'name':_0x2700f1[_0xc21b30(0x144)],'dir':_0x5c284b,'yaml':_0x2700f1,'systemPrompt':_0x52b0bd,'starterMessage':_0x3c9ebb});}}const _0x5d9898=getKnowledgeBasesDir(_0x1ebe4c);if(a122_0x5102fc['existsSync'](_0x5d9898)){const _0x14237b=a122_0x5102fc[_0xc21b30(0x151)](_0x5d9898);for(const _0x5483aa of _0x14237b){const _0x51eaf7=a122_0x1dfc50['join'](_0x5d9898,_0x5483aa);if(_0x5483aa[_0xc21b30(0x1fa)](_0xc21b30(0x165))){const _0x4d0a7c=parseKnowledgeBaseYaml(a122_0x5102fc[_0xc21b30(0x1ea)](_0x51eaf7,_0xc21b30(0x174)),_0x51eaf7);_0x246b8a['push']({'name':_0x4d0a7c[_0xc21b30(0x144)],'path':_0x51eaf7,'yaml':_0x4d0a7c});}else{if(_0x5483aa[_0xc21b30(0x1fa)](_0xc21b30(0x14c))){const _0x2661de=a122_0x5102fc[_0xc21b30(0x1ea)](_0x51eaf7,_0xc21b30(0x174)),{name:_0x41928d,text:_0xd62ff3}=parseTextKnowledgeBaseMd(_0x2661de,_0x5483aa);_0x361046['push']({'name':_0x41928d,'path':_0x51eaf7,'text':_0xd62ff3});}}}}const _0x3034a3=getPromptsDir(_0x1ebe4c);if(a122_0x5102fc[_0xc21b30(0x196)](_0x3034a3)){const _0x29c945=a122_0x5102fc[_0xc21b30(0x151)](_0x3034a3)['filter'](_0x3d36c2=>_0x3d36c2[_0xc21b30(0x1fa)](_0xc21b30(0x165)));for(const _0x61bee4 of _0x29c945){const _0x5456f1=a122_0x1dfc50[_0xc21b30(0x10d)](_0x3034a3,_0x61bee4),_0x52496b=parsePromptYaml(a122_0x5102fc[_0xc21b30(0x1ea)](_0x5456f1,_0xc21b30(0x174)),_0x5456f1);_0xe6550c[_0xc21b30(0x180)]({'name':_0x52496b[_0xc21b30(0x144)],'path':_0x5456f1,'yaml':_0x52496b});}}const _0x4e60a4=getIntegrationsDir(_0x1ebe4c);if(a122_0x5102fc[_0xc21b30(0x196)](_0x4e60a4)){const _0x667c76=a122_0x5102fc[_0xc21b30(0x151)](_0x4e60a4)[_0xc21b30(0x148)](_0x139993=>_0x139993[_0xc21b30(0x1fa)]('.yml'));for(const _0xeb3d4b of _0x667c76){const _0x163465=a122_0x1dfc50[_0xc21b30(0x10d)](_0x4e60a4,_0xeb3d4b),_0x3a8598=parseIntegrationYaml(a122_0x5102fc['readFileSync'](_0x163465,_0xc21b30(0x174)),_0x163465);SAFE_INTEGRATION_TYPES[_0xc21b30(0x1f8)](_0x3a8598[_0xc21b30(0x1d7)][_0xc21b30(0x197)]())?_0x19793f[_0xc21b30(0x180)]({'name':_0x3a8598[_0xc21b30(0x144)],'path':_0x163465,'yaml':_0x3a8598}):this[_0xc21b30(0x120)][_0xc21b30(0x14f)]('Skipping\x20integration\x20\x27'+_0x3a8598[_0xc21b30(0x144)]+_0xc21b30(0x1b2)+_0x3a8598['service_type']+_0xc21b30(0x1f2)+(_0xc21b30(0x13d)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0xc21b30(0x13f)));}}const _0x2d9a27=getExperimentalKnowledgeBasesDir(_0x1ebe4c);if(a122_0x5102fc[_0xc21b30(0x196)](_0x2d9a27)){const _0xc3d7e0=a122_0x5102fc[_0xc21b30(0x151)](_0x2d9a27,{'withFileTypes':!![]});for(const _0x1eaf20 of _0xc3d7e0){if(!_0x1eaf20['isDirectory']())continue;const _0x25bd1d=a122_0x1dfc50[_0xc21b30(0x10d)](_0x2d9a27,_0x1eaf20[_0xc21b30(0x144)]),_0x327a5c=a122_0x1dfc50['join'](_0x25bd1d,_0x1eaf20[_0xc21b30(0x144)]+_0xc21b30(0x165));if(a122_0x5102fc[_0xc21b30(0x196)](_0x327a5c)){const _0x4cd8bd=parseExperimentalKnowledgeBaseYaml(a122_0x5102fc[_0xc21b30(0x1ea)](_0x327a5c,_0xc21b30(0x174)),_0x327a5c),_0x4f3417=a122_0x1dfc50[_0xc21b30(0x10d)](_0x25bd1d,_0xc21b30(0x119)),_0x4ec42b=[];if(a122_0x5102fc[_0xc21b30(0x196)](_0x4f3417)){const _0x3d920f=a122_0x5102fc['readdirSync'](_0x4f3417,{'withFileTypes':!![]});for(const _0x54a847 of _0x3d920f){if(!_0x54a847[_0xc21b30(0x18c)]())continue;const _0x1e3810=a122_0x1dfc50[_0xc21b30(0x10d)](_0x4f3417,_0x54a847[_0xc21b30(0x144)]),_0x3db906=a122_0x1dfc50[_0xc21b30(0x10d)](_0x1e3810,_0xc21b30(0x1a8)),_0x391b94=a122_0x1dfc50[_0xc21b30(0x10d)](_0x1e3810,_0xc21b30(0x139));if(a122_0x5102fc[_0xc21b30(0x196)](_0x3db906)&&a122_0x5102fc[_0xc21b30(0x196)](_0x391b94)){const _0x4e2bd9=a122_0x5102fc['readFileSync'](_0x3db906,'utf-8'),_0x6b0517=a122_0x5102fc[_0xc21b30(0x1ea)](_0x391b94,'utf-8');_0x4ec42b['push']({'name':_0x54a847[_0xc21b30(0x144)],'code':_0x4e2bd9,'json_schema':_0x6b0517});}}}const _0x23a70={..._0x4cd8bd,'functions':_0x4ec42b};_0x1a656f[_0xc21b30(0x180)]({'name':_0x4cd8bd[_0xc21b30(0x144)],'path':_0x25bd1d,'def':_0x23a70});}}}const _0x4eb48f=getExperimentalArtifactsDir(_0x1ebe4c);if(a122_0x5102fc[_0xc21b30(0x196)](_0x4eb48f)){const _0x708bc7=a122_0x5102fc[_0xc21b30(0x151)](_0x4eb48f,{'withFileTypes':!![]});for(const _0x3c6f2a of _0x708bc7){if(!_0x3c6f2a['isDirectory']())continue;const _0xb3e5af=a122_0x1dfc50['join'](_0x4eb48f,_0x3c6f2a[_0xc21b30(0x144)]),_0x2de2e6=a122_0x1dfc50[_0xc21b30(0x10d)](_0xb3e5af,_0x3c6f2a[_0xc21b30(0x144)]+_0xc21b30(0x165));if(a122_0x5102fc[_0xc21b30(0x196)](_0x2de2e6)){const _0x217df1=parseExperimentalArtifactYaml(a122_0x5102fc['readFileSync'](_0x2de2e6,_0xc21b30(0x174)),_0x2de2e6),_0x52a87a=a122_0x1dfc50[_0xc21b30(0x10d)](_0xb3e5af,_0xc21b30(0x1a8)),_0x27a67e=a122_0x5102fc[_0xc21b30(0x196)](_0x52a87a)?a122_0x5102fc['readFileSync'](_0x52a87a,_0xc21b30(0x174)):'',_0x3dc5b4=a122_0x1dfc50['join'](_0xb3e5af,_0xc21b30(0x19f)),_0x5a1a1f=[];if(a122_0x5102fc[_0xc21b30(0x196)](_0x3dc5b4)){const _0x1cb0e0=a122_0x5102fc['readdirSync'](_0x3dc5b4);for(const _0x2cfd94 of _0x1cb0e0){const _0x219631=a122_0x1dfc50['join'](_0x3dc5b4,_0x2cfd94);if(a122_0x5102fc[_0xc21b30(0x16a)](_0x219631)[_0xc21b30(0x1a5)]()){const _0x515210=a122_0x5102fc['readFileSync'](_0x219631,_0xc21b30(0x174));_0x5a1a1f[_0xc21b30(0x180)]({'file_name':_0x2cfd94,'text_content':_0x515210});}}}const _0x322bc6={..._0x217df1,'code':_0x27a67e,'files':_0x5a1a1f};_0x25e995['push']({'name':_0x217df1[_0xc21b30(0x144)],'path':_0xb3e5af,'def':_0x322bc6});}}}}else{const _0x39a22a=await this[_0xc21b30(0x181)](_0x1ebe4c),_0x56573b=await this[_0xc21b30(0x1ee)][_0xc21b30(0x182)](_0x39a22a);_0x5f5372=_0x56573b[_0xc21b30(0x16e)]['name'];const _0x478c01=await this['client'][_0xc21b30(0x107)](_0x39a22a),_0x181657=await this[_0xc21b30(0x1ee)][_0xc21b30(0x106)](_0x39a22a),_0x17f136=await this[_0xc21b30(0x1ee)]['listTextKnowledgeBases'](_0x39a22a),_0x2c3707=await this[_0xc21b30(0x1ee)]['listPrompts'](_0x39a22a),_0x190095=await this['client'][_0xc21b30(0x17b)](_0x39a22a),_0x1e8d5d=await safeListOrEmpty(()=>this['client'][_0xc21b30(0x1bf)](_0x39a22a)),_0x5a81bf=await safeListOrEmpty(()=>this[_0xc21b30(0x1ee)][_0xc21b30(0x188)](_0x39a22a)),_0x34076c=new Map(),_0x19454a=new Map(),_0x551ad2=new Map(),_0x789e15=new Map(),_0x42920c=new Map(),_0x5bd33b=new Map();for(const _0x1f8634 of _0x181657){_0x34076c[_0xc21b30(0x14b)](_0x1f8634['id'],_0x1f8634[_0xc21b30(0x16e)]['name']);}for(const _0x2c4bc3 of _0x17f136){_0x19454a[_0xc21b30(0x14b)](_0x2c4bc3['id'],_0x2c4bc3['attributes'][_0xc21b30(0x144)]);}for(const _0x3212cd of _0x478c01){_0x551ad2[_0xc21b30(0x14b)](_0x3212cd['id'],_0x3212cd['attributes'][_0xc21b30(0x144)]);}for(const _0x422195 of _0x2c3707){_0x789e15[_0xc21b30(0x14b)](_0x422195['id'],_0x422195[_0xc21b30(0x16e)][_0xc21b30(0x144)]);}for(const _0x249e88 of _0x1e8d5d){_0x42920c[_0xc21b30(0x14b)](_0x249e88['id'],_0x249e88[_0xc21b30(0x16e)][_0xc21b30(0x144)]);}for(const _0x1ba697 of _0x5a81bf){_0x5bd33b[_0xc21b30(0x14b)](_0x1ba697['id'],_0x1ba697[_0xc21b30(0x16e)]['name']);}const _0x1f1015={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x34076c,'TextKnowledgeBase':_0x19454a,'Agent':_0x551ad2,'ExperimentalKnowledgeBase':_0x42920c}),'resolvePromptName':async _0x4677fe=>_0x789e15[_0xc21b30(0x1e8)](_0x4677fe),'onWarning':_0x550b79=>this['logger'][_0xc21b30(0x14f)](_0x550b79)};for(const _0x401043 of _0x478c01){const _0x2c2661=await agentResponseToDef(_0x401043,_0x1f1015),{yaml:_0x27a781,systemPrompt:_0x1572fa,starterMessage:_0x39c135}=_0x2c2661;_0x44742a[_0xc21b30(0x180)]({'name':_0x27a781[_0xc21b30(0x144)],'dir':'','yaml':_0x27a781,'systemPrompt':_0x1572fa,'starterMessage':_0x39c135});}for(const _0x5c30f3 of _0x181657){const _0x53c295=apiKnowledgeBaseToYaml(_0x5c30f3);_0x246b8a[_0xc21b30(0x180)]({'name':_0x53c295['name'],'path':'','yaml':_0x53c295});}for(const _0xf310a9 of _0x17f136){_0x361046[_0xc21b30(0x180)]({'name':_0xf310a9['attributes'][_0xc21b30(0x144)],'path':'','text':_0xf310a9['attributes'][_0xc21b30(0x1a2)]});}for(const _0x2a4e77 of _0x2c3707){const _0x387b91=await apiPromptToYaml(_0x2a4e77,_0x1f1015);_0x387b91&&_0xe6550c['push']({'name':_0x387b91['name'],'path':'','yaml':_0x387b91});}for(const _0x297f54 of _0x190095){if(!_0x297f54[_0xc21b30(0x16e)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0xc21b30(0x1f8)](_0x297f54['attributes'][_0xc21b30(0x1b9)][_0xc21b30(0x197)]())){const _0x4ab2f2=await apiIntegrationToYaml(_0x297f54,_0x1f1015);_0x19793f[_0xc21b30(0x180)]({'name':_0x297f54[_0xc21b30(0x16e)][_0xc21b30(0x1b9)][_0xc21b30(0x197)](),'path':'','yaml':_0x4ab2f2});}}for(const _0x1bc314 of _0x1e8d5d){const _0x599fdd=apiExperimentalKnowledgeBaseToYaml(_0x1bc314);_0x1a656f[_0xc21b30(0x180)]({'name':_0x599fdd[_0xc21b30(0x144)],'path':'','def':_0x599fdd});}for(const _0x18813e of _0x5a81bf){const _0x30a901=apiExperimentalArtifactToYaml(_0x18813e);_0x25e995[_0xc21b30(0x180)]({'name':_0x30a901[_0xc21b30(0x144)],'path':'','def':_0x30a901});}}const _0x25233b={'sourceProjectName':_0x5f5372,'newProjectName':_0x3c4528,'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}}},_0x591f48=await this[_0xc21b30(0x1ee)][_0xc21b30(0x187)](),_0x8a36c4=_0x591f48[_0xc21b30(0x1e0)](_0x279ab6=>_0x279ab6['attributes'][_0xc21b30(0x144)]===_0x3c4528);if(_0x8a36c4)throw new SDKError(ErrorCode[_0xc21b30(0x1cc)],'Project\x20\x22'+_0x3c4528+_0xc21b30(0x15b),undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x23f449?.[_0xc21b30(0x16d)])return _0x25233b['counts'][_0xc21b30(0x1c8)][_0xc21b30(0x111)]=_0x44742a[_0xc21b30(0x1b1)],_0x25233b[_0xc21b30(0x19d)]['knowledgeBases'][_0xc21b30(0x111)]=_0x246b8a[_0xc21b30(0x1b1)],_0x25233b[_0xc21b30(0x19d)][_0xc21b30(0x13b)][_0xc21b30(0x111)]=_0x361046[_0xc21b30(0x1b1)],_0x25233b[_0xc21b30(0x19d)][_0xc21b30(0x190)][_0xc21b30(0x111)]=_0x1a656f['length'],_0x25233b[_0xc21b30(0x19d)][_0xc21b30(0x1a1)][_0xc21b30(0x111)]=_0x25e995[_0xc21b30(0x1b1)],_0x25233b[_0xc21b30(0x19d)][_0xc21b30(0x183)][_0xc21b30(0x111)]=_0xe6550c[_0xc21b30(0x1b1)],_0x25233b[_0xc21b30(0x19d)][_0xc21b30(0x1d3)]['created']=_0x19793f[_0xc21b30(0x1b1)],_0x25233b;const _0x3db12c=await this['client'][_0xc21b30(0x1ac)]({'name':_0x3c4528}),_0x17cc0a=_0x3db12c['id'];_0x25233b[_0xc21b30(0x114)]=_0x17cc0a;const _0x5d93be=new Map(),_0x51d4d=new Map(),_0x53909c=new Map(),_0x2430c6=new Map(),_0x4b8794=new Map(),_0x25901a=new Map(),_0x2c4a60=new Map(),_0x253725=new Map(),_0x452cb6=new Set(),_0x2770d6=new Set();for(const _0x1a48b5 of _0x44742a){for(const _0x237baa of _0x1a48b5['yaml']['tools']||[]){if(_0x237baa['type']===_0xc21b30(0x1df)&&_0x237baa[_0xc21b30(0x121)]){const _0x3d65cb=parseRef(_0x237baa[_0xc21b30(0x121)]);if(_0x3d65cb)_0x452cb6[_0xc21b30(0x20a)](_0x3d65cb[_0xc21b30(0x144)]);}else{if(_0x237baa[_0xc21b30(0x1da)]===_0xc21b30(0x12e)&&_0x237baa[_0xc21b30(0x121)]){const _0x649d74=parseRef(_0x237baa[_0xc21b30(0x121)]);if(_0x649d74)_0x2770d6[_0xc21b30(0x20a)](_0x649d74[_0xc21b30(0x144)]);}}}}for(const _0x286519 of _0x452cb6){try{const _0x57584c=await this[_0xc21b30(0x1ee)][_0xc21b30(0x112)]({'projectId':_0x17cc0a,'name':_0x286519});_0x4b8794['set'](_0x286519,_0x57584c['id']),_0x25233b['imageGenerators']['push']({'name':_0x286519,'action':_0xc21b30(0x111),'id':_0x57584c['id']}),_0x25233b['counts']['imageGenerators'][_0xc21b30(0x111)]++;}catch(_0x38eb45){_0x25233b['imageGenerators'][_0xc21b30(0x180)]({'name':_0x286519,'action':_0xc21b30(0x1b3),'error':_0x38eb45[_0xc21b30(0x1ca)]}),_0x25233b['counts'][_0xc21b30(0x16c)][_0xc21b30(0x189)]++;}}for(const _0x18e1df of _0x2770d6){try{const _0x422d48=await this['client']['createWebSearchTool']({'projectId':_0x17cc0a,'name':_0x18e1df});_0x25901a[_0xc21b30(0x14b)](_0x18e1df,_0x422d48['id']),_0x25233b[_0xc21b30(0x17c)][_0xc21b30(0x180)]({'name':_0x18e1df,'action':_0xc21b30(0x111),'id':_0x422d48['id']}),_0x25233b[_0xc21b30(0x19d)]['webSearchTools'][_0xc21b30(0x111)]++;}catch(_0x426dea){_0x25233b[_0xc21b30(0x17c)][_0xc21b30(0x180)]({'name':_0x18e1df,'action':_0xc21b30(0x1b3),'error':_0x426dea[_0xc21b30(0x1ca)]}),_0x25233b[_0xc21b30(0x19d)][_0xc21b30(0x17c)][_0xc21b30(0x189)]++;}}const _0x94b288=await fetchAllToolTargetMaps((_0x5deab3,_0x2d87d2)=>this['client']['listToolTargets'](_0x5deab3,_0x2d87d2),_0x17cc0a);let _0x7f92aa=[];const _0x2744ad={'projectId':_0x17cc0a,'resolveToolTargetId':buildIdResolver({..._0x94b288[_0xc21b30(0x122)],'KnowledgeBase':_0x5d93be,'TextKnowledgeBase':_0x51d4d,'ExperimentalKnowledgeBase':_0x2c4a60,'Agent':_0x53909c,'WebSearchTool':_0x25901a,'ImageGenerator':_0x4b8794}),'resolvePromptId':async _0x28c297=>_0x2430c6[_0xc21b30(0x1e8)](_0x28c297),'onWarning':_0x4c669a=>{const _0x18184e=_0xc21b30;this[_0x18184e(0x120)]['warn'](_0x4c669a),_0x7f92aa[_0x18184e(0x180)](_0x4c669a);}};for(const _0x2afabb of _0x246b8a){try{const _0x331068=yamlKnowledgeBaseToApi(_0x2afabb[_0xc21b30(0x12b)],_0x17cc0a),_0x28b8f0=await this['client'][_0xc21b30(0x177)](_0x331068);_0x5d93be[_0xc21b30(0x14b)](_0x2afabb[_0xc21b30(0x12b)][_0xc21b30(0x144)],_0x28b8f0['id']),_0x25233b[_0xc21b30(0x207)]['push']({'name':_0x2afabb[_0xc21b30(0x12b)][_0xc21b30(0x144)],'action':_0xc21b30(0x111),'id':_0x28b8f0['id']}),_0x25233b[_0xc21b30(0x19d)][_0xc21b30(0x207)][_0xc21b30(0x111)]++;}catch(_0x4f2ed6){_0x25233b['knowledgeBases']['push']({'name':_0x2afabb[_0xc21b30(0x12b)][_0xc21b30(0x144)],'action':_0xc21b30(0x1b3),'error':_0x4f2ed6[_0xc21b30(0x1ca)]}),_0x25233b['counts'][_0xc21b30(0x207)][_0xc21b30(0x189)]++;}}for(const _0x124c07 of _0x361046){try{const _0x260acb=yamlTextKnowledgeBaseToApi({'name':_0x124c07[_0xc21b30(0x144)],'text':_0x124c07[_0xc21b30(0x1a2)]},_0x17cc0a),_0x55c670=await this['client']['createTextKnowledgeBase'](_0x260acb);_0x51d4d[_0xc21b30(0x14b)](_0x124c07[_0xc21b30(0x144)],_0x55c670['id']),_0x25233b[_0xc21b30(0x13b)][_0xc21b30(0x180)]({'name':_0x124c07[_0xc21b30(0x144)],'action':_0xc21b30(0x111),'id':_0x55c670['id']}),_0x25233b['counts'][_0xc21b30(0x13b)][_0xc21b30(0x111)]++;}catch(_0x3982c7){_0x25233b[_0xc21b30(0x13b)][_0xc21b30(0x180)]({'name':_0x124c07[_0xc21b30(0x144)],'action':'error','error':_0x3982c7[_0xc21b30(0x1ca)]}),_0x25233b['counts']['textKnowledgeBases'][_0xc21b30(0x189)]++;}}for(const _0xcc8f84 of _0x25e995){try{const _0x17fc03=yamlExperimentalArtifactToApi(_0xcc8f84['def'],_0x17cc0a),_0x2b82ef=await this[_0xc21b30(0x1ee)][_0xc21b30(0x205)](_0x17fc03);_0x253725[_0xc21b30(0x14b)](_0xcc8f84[_0xc21b30(0x1c1)][_0xc21b30(0x144)],_0x2b82ef['id']),_0x25233b['experimentalArtifacts']['push']({'name':_0xcc8f84[_0xc21b30(0x1c1)][_0xc21b30(0x144)],'action':_0xc21b30(0x111),'id':_0x2b82ef['id']}),_0x25233b[_0xc21b30(0x19d)]['experimentalArtifacts']['created']++;}catch(_0x116f61){_0x25233b[_0xc21b30(0x1a1)][_0xc21b30(0x180)]({'name':_0xcc8f84[_0xc21b30(0x1c1)][_0xc21b30(0x144)],'action':_0xc21b30(0x1b3),'error':_0x116f61['message']}),_0x25233b[_0xc21b30(0x19d)][_0xc21b30(0x1a1)]['errors']++;}}for(const _0x505b97 of _0x1a656f){try{const _0x48d3db=yamlExperimentalKnowledgeBaseToApi(_0x505b97['def'],_0x17cc0a),_0x5f0e0e=await this[_0xc21b30(0x1ee)][_0xc21b30(0x140)](_0x48d3db);_0x2c4a60['set'](_0x505b97['def'][_0xc21b30(0x144)],_0x5f0e0e['id']),_0x25233b[_0xc21b30(0x190)][_0xc21b30(0x180)]({'name':_0x505b97[_0xc21b30(0x1c1)][_0xc21b30(0x144)],'action':_0xc21b30(0x111),'id':_0x5f0e0e['id']}),_0x25233b[_0xc21b30(0x19d)]['experimentalKnowledgeBases'][_0xc21b30(0x111)]++;}catch(_0x12f5c7){_0x25233b[_0xc21b30(0x190)][_0xc21b30(0x180)]({'name':_0x505b97['def']['name'],'action':'error','error':_0x12f5c7['message']}),_0x25233b[_0xc21b30(0x19d)]['experimentalKnowledgeBases'][_0xc21b30(0x189)]++;}}const _0x55eb57=[..._0x44742a][_0xc21b30(0x17e)]((_0x5db2f3,_0x346482)=>{const _0xf6365e=_0xc21b30,_0x385986=_0x5db2f3[_0xf6365e(0x12b)][_0xf6365e(0x1b0)]?.['some'](_0x28cc59=>_0x28cc59[_0xf6365e(0x1da)]===_0xf6365e(0x1de))??![],_0x4d2c11=_0x346482[_0xf6365e(0x12b)][_0xf6365e(0x1b0)]?.[_0xf6365e(0x133)](_0x29cba0=>_0x29cba0['type']===_0xf6365e(0x1de))??![];if(_0x385986&&!_0x4d2c11)return 0x1;if(!_0x385986&&_0x4d2c11)return-0x1;return 0x0;});for(const _0x565fad of _0x55eb57){_0x7f92aa=[];try{const _0x4217a3=_0x565fad[_0xc21b30(0x12b)][_0xc21b30(0x1b0)]?.[_0xc21b30(0x148)](_0x367cc1=>{const _0x4ab6b3=_0xc21b30;if(_0x367cc1[_0x4ab6b3(0x1da)]===_0x4ab6b3(0x1de)&&_0x367cc1['target']){const _0x651746=parseRef(_0x367cc1[_0x4ab6b3(0x121)]);return _0x651746?.[_0x4ab6b3(0x144)]===_0x565fad['yaml']['name'];}return![];})??[];if(_0x4217a3['length']>0x0){const _0x27c691=_0xc21b30(0x178)+_0x565fad[_0xc21b30(0x12b)][_0xc21b30(0x144)]+_0xc21b30(0x17d)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this[_0xc21b30(0x120)][_0xc21b30(0x14f)](_0x27c691),_0x7f92aa[_0xc21b30(0x180)](_0x27c691);}const _0xe9e033=await agentDefToRequest(_0x565fad[_0xc21b30(0x12b)],_0x565fad[_0xc21b30(0x185)],_0x565fad[_0xc21b30(0x1c0)],_0x2744ad),_0x175d8c=await this[_0xc21b30(0x1ee)][_0xc21b30(0x19b)](_0xe9e033);_0x53909c[_0xc21b30(0x14b)](_0x565fad[_0xc21b30(0x12b)][_0xc21b30(0x144)],_0x175d8c['id']),_0x25233b['agents'][_0xc21b30(0x180)]({'agentName':_0x565fad['yaml'][_0xc21b30(0x144)],'action':'created','agentId':_0x175d8c['id'],'warnings':_0x7f92aa[_0xc21b30(0x1b1)]>0x0?_0x7f92aa:undefined}),_0x25233b[_0xc21b30(0x19d)]['agents'][_0xc21b30(0x111)]++;}catch(_0x23bdaf){_0x25233b[_0xc21b30(0x1c8)][_0xc21b30(0x180)]({'agentName':_0x565fad[_0xc21b30(0x12b)]['name'],'action':_0xc21b30(0x1b3),'error':_0x23bdaf[_0xc21b30(0x1ca)],'warnings':_0x7f92aa['length']>0x0?_0x7f92aa:undefined}),_0x25233b['counts']['agents'][_0xc21b30(0x189)]++;}}for(const _0x5c04f2 of _0xe6550c){try{const _0x293277=await yamlPromptToApi(_0x5c04f2[_0xc21b30(0x12b)],_0x17cc0a,_0x2744ad);if(!_0x293277){_0x25233b[_0xc21b30(0x183)]['push']({'name':_0x5c04f2[_0xc21b30(0x12b)]['name'],'action':_0xc21b30(0x1b3),'error':_0xc21b30(0x160)}),_0x25233b['counts'][_0xc21b30(0x183)][_0xc21b30(0x189)]++;continue;}const _0x3fadbd=await this[_0xc21b30(0x1ee)][_0xc21b30(0x201)](_0x293277);_0x2430c6[_0xc21b30(0x14b)](_0x5c04f2[_0xc21b30(0x12b)][_0xc21b30(0x144)],_0x3fadbd['id']),_0x25233b[_0xc21b30(0x183)][_0xc21b30(0x180)]({'name':_0x5c04f2['yaml'][_0xc21b30(0x144)],'action':_0xc21b30(0x111),'id':_0x3fadbd['id']}),_0x25233b[_0xc21b30(0x19d)][_0xc21b30(0x183)][_0xc21b30(0x111)]++;}catch(_0x215325){_0x25233b[_0xc21b30(0x183)][_0xc21b30(0x180)]({'name':_0x5c04f2[_0xc21b30(0x12b)][_0xc21b30(0x144)],'action':'error','error':_0x215325['message']}),_0x25233b[_0xc21b30(0x19d)][_0xc21b30(0x183)][_0xc21b30(0x189)]++;}}for(const _0x502a8b of _0x19793f){try{const _0x4ff73b=await yamlIntegrationToApi(_0x502a8b[_0xc21b30(0x12b)],_0x17cc0a,_0x2744ad),_0x3de858=await this[_0xc21b30(0x1ee)][_0xc21b30(0x175)](_0x4ff73b);_0x25233b[_0xc21b30(0x1d3)]['push']({'name':_0x502a8b[_0xc21b30(0x12b)][_0xc21b30(0x1d7)],'action':_0xc21b30(0x111),'id':_0x3de858['id']}),_0x25233b['counts'][_0xc21b30(0x1d3)]['created']++;}catch(_0x1d2502){_0x25233b[_0xc21b30(0x1d3)][_0xc21b30(0x180)]({'name':_0x502a8b[_0xc21b30(0x12b)][_0xc21b30(0x1d7)],'action':_0xc21b30(0x1b3),'error':_0x1d2502[_0xc21b30(0x1ca)]}),_0x25233b[_0xc21b30(0x19d)][_0xc21b30(0x1d3)]['errors']++;}}return _0x25233b;}}
@@ -1 +1 @@
1
- (function(_0x498d71,_0x380a8a){const _0x19bad8=a123_0x4ced,_0x743442=_0x498d71();while(!![]){try{const _0x2ace77=-parseInt(_0x19bad8(0x72))/0x1*(parseInt(_0x19bad8(0x66))/0x2)+-parseInt(_0x19bad8(0x6a))/0x3+parseInt(_0x19bad8(0x75))/0x4+-parseInt(_0x19bad8(0x6c))/0x5+parseInt(_0x19bad8(0x71))/0x6+-parseInt(_0x19bad8(0x74))/0x7+-parseInt(_0x19bad8(0x6f))/0x8*(-parseInt(_0x19bad8(0x6b))/0x9);if(_0x2ace77===_0x380a8a)break;else _0x743442['push'](_0x743442['shift']());}catch(_0x5b0c36){_0x743442['push'](_0x743442['shift']());}}}(a123_0x1e54,0xb396f));export function canCreateAgent(_0x576e35,_0x3784de){const _0x460813=a123_0x4ced;for(const _0x435860 of _0x576e35[_0x460813(0x68)][_0x460813(0x6d)]){if(_0x435860[_0x460813(0x65)]&&!_0x3784de[_0x460813(0x73)](_0x435860[_0x460813(0x65)]))return![];}return!![];}export function remapToolIds(_0x294c84,_0x3c8b60,_0xb4c56f){const _0x12ba05=a123_0x4ced;return _0x294c84[_0x12ba05(0x69)](_0x2fe6c9=>({..._0x2fe6c9,'targetKnowledgeBaseId':_0x2fe6c9[_0x12ba05(0x6e)]?_0x3c8b60[_0x12ba05(0x67)](_0x2fe6c9[_0x12ba05(0x6e)])||_0x2fe6c9[_0x12ba05(0x6e)]:undefined,'targetAgentId':_0x2fe6c9[_0x12ba05(0x65)]?_0xb4c56f[_0x12ba05(0x67)](_0x2fe6c9['targetAgentId'])||_0x2fe6c9[_0x12ba05(0x65)]:undefined}));}export function remapVariableIds(_0x4a7c5b,_0x6ce9b8){const _0x3b67aa=a123_0x4ced;return _0x4a7c5b[_0x3b67aa(0x69)](_0x4d4f7e=>({..._0x4d4f7e,'targetKnowledgeBaseId':_0x6ce9b8['get'](_0x4d4f7e[_0x3b67aa(0x6e)])||_0x4d4f7e[_0x3b67aa(0x6e)]}));}function a123_0x1e54(){const _0x48cfb6=['get','attributes','map','562197pTPEJG','953721NSXJcL','2047275UHtoAl','tools','targetKnowledgeBaseId','8faYeHL','1.0','5303190vFwsgD','58zVMoGH','has','710892ftlMsr','4826804tMDilC','targetAgentId','26294dCpJyt'];a123_0x1e54=function(){return _0x48cfb6;};return a123_0x1e54();}function a123_0x4ced(_0x24d708,_0x4efd5d){_0x24d708=_0x24d708-0x65;const _0x1e548d=a123_0x1e54();let _0x4ced6d=_0x1e548d[_0x24d708];return _0x4ced6d;}export function isSupportedBackupVersion(_0x43ce19){const _0x22f6d7=a123_0x4ced;return _0x43ce19===_0x22f6d7(0x70);}
1
+ (function(_0x35f850,_0x4a4251){const _0x4daf7d=a123_0xf5bf,_0x5269a0=_0x35f850();while(!![]){try{const _0x357394=parseInt(_0x4daf7d(0xd3))/0x1*(parseInt(_0x4daf7d(0xdb))/0x2)+parseInt(_0x4daf7d(0xde))/0x3+-parseInt(_0x4daf7d(0xd2))/0x4*(-parseInt(_0x4daf7d(0xd7))/0x5)+parseInt(_0x4daf7d(0xdd))/0x6+-parseInt(_0x4daf7d(0xd1))/0x7+-parseInt(_0x4daf7d(0xdf))/0x8+-parseInt(_0x4daf7d(0xe0))/0x9*(-parseInt(_0x4daf7d(0xd6))/0xa);if(_0x357394===_0x4a4251)break;else _0x5269a0['push'](_0x5269a0['shift']());}catch(_0x4a375f){_0x5269a0['push'](_0x5269a0['shift']());}}}(a123_0x270e,0xa83a1));export function canCreateAgent(_0x5676ba,_0x367338){const _0x5de1d3=a123_0xf5bf;for(const _0x336448 of _0x5676ba[_0x5de1d3(0xe2)][_0x5de1d3(0xdc)]){if(_0x336448[_0x5de1d3(0xd9)]&&!_0x367338[_0x5de1d3(0xd8)](_0x336448[_0x5de1d3(0xd9)]))return![];}return!![];}export function remapToolIds(_0x4642bf,_0x21fe0b,_0x251ca2){const _0x51838b=a123_0xf5bf;return _0x4642bf['map'](_0x3a26c2=>({..._0x3a26c2,'targetKnowledgeBaseId':_0x3a26c2[_0x51838b(0xd4)]?_0x21fe0b[_0x51838b(0xda)](_0x3a26c2[_0x51838b(0xd4)])||_0x3a26c2[_0x51838b(0xd4)]:undefined,'targetAgentId':_0x3a26c2[_0x51838b(0xd9)]?_0x251ca2[_0x51838b(0xda)](_0x3a26c2[_0x51838b(0xd9)])||_0x3a26c2[_0x51838b(0xd9)]:undefined}));}function a123_0x270e(){const _0x15b669=['get','22ZcbzUr','tools','2706432qTuwri','288720pQrlRd','5541792ssffpi','117MmKZMf','1.0','attributes','8636222OBVcrw','4732XjiLjw','110341dVPkxz','targetKnowledgeBaseId','map','531700xQfQQR','690uVVlGo','has','targetAgentId'];a123_0x270e=function(){return _0x15b669;};return a123_0x270e();}export function remapVariableIds(_0x1543d5,_0x49b39b){const _0x59b62a=a123_0xf5bf;return _0x1543d5[_0x59b62a(0xd5)](_0x41b55b=>({..._0x41b55b,'targetKnowledgeBaseId':_0x49b39b['get'](_0x41b55b[_0x59b62a(0xd4)])||_0x41b55b['targetKnowledgeBaseId']}));}function a123_0xf5bf(_0x23ec79,_0x476fc9){_0x23ec79=_0x23ec79-0xd1;const _0x270e88=a123_0x270e();let _0xf5bfe9=_0x270e88[_0x23ec79];return _0xf5bfe9;}export function isSupportedBackupVersion(_0x3d6f86){const _0x299095=a123_0xf5bf;return _0x3d6f86===_0x299095(0xe1);}