@treasuredata/tdx 2026.4.14 → 2026.4.15
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.
- package/README.md +1 -1
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/cas-command.js +1 -1
- package/dist/commands/cas-segment-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/policy-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/work-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/oauth-keychain.js +1 -1
- package/dist/core/oauth.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/tools/work-create-item.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/cas/cas-api-client.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js +1 -1
- package/dist/sdk/cas/cas-segment-yaml.js +1 -1
- package/dist/sdk/cas/index.js +1 -1
- package/dist/sdk/cas/pull-workflow.js +1 -1
- package/dist/sdk/cas/push-workflow.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/types/workspace.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/sdk/workspace/access-tracker.js +1 -1
- package/dist/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +30 -12
package/dist/sdk/llm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a133_0x352433=a133_0x1505;(function(_0x3acd64,_0x5d63b6){const _0x16fc77=a133_0x1505,_0x5fff53=_0x3acd64();while(!![]){try{const _0x19fd59=-parseInt(_0x16fc77(0x18f))/0x1+-parseInt(_0x16fc77(0x227))/0x2+-parseInt(_0x16fc77(0x237))/0x3*(-parseInt(_0x16fc77(0x1b6))/0x4)+parseInt(_0x16fc77(0x144))/0x5*(parseInt(_0x16fc77(0x149))/0x6)+parseInt(_0x16fc77(0x15f))/0x7*(-parseInt(_0x16fc77(0x205))/0x8)+parseInt(_0x16fc77(0x146))/0x9*(-parseInt(_0x16fc77(0x1d5))/0xa)+-parseInt(_0x16fc77(0x15d))/0xb*(-parseInt(_0x16fc77(0x1eb))/0xc);if(_0x19fd59===_0x5d63b6)break;else _0x5fff53['push'](_0x5fff53['shift']());}catch(_0x27c474){_0x5fff53['push'](_0x5fff53['shift']());}}}(a133_0x1546,0x2af03));import{LLMApiClient}from'../client/llm-api-client.js';import*as a133_0x209372 from'node:fs';function a133_0x1546(){const _0x4b3e61=['createProject','\x0a\x0a#\x20agent.yml\x0a','context','20042ILvHFk','renamed','7OZUnPn','nameToId','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','Agent\x20\x27','\x27\x20(','getProject','text_content','models','updated','promptId','\x0a---\x20code\x20---\x0a','action','web_search','listIntegrations','chatInterfaces','updateChatInterface','Multiple\x20projects\x20found\x20with\x20name\x20\x27','json_schema.json','mkdirSync','file_name','project.json','webhookCorsOrigins','createExperimentalKnowledgeBase','imageGenerators','Skipping\x20integration\x20\x27','createKnowledgeBase','chatWelcomeMessage','---\x20schema:\x20','Could\x20not\x20resolve\x20agent\x20reference','createFormInterface','textKnowledgeBases','Project\x20\x22','maxToolIterations','NOT_FOUND','errors','message','_reasoning_','starter_message.md','metadata','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','listProjects','listAgentsFull','version','Removed\x20deleted\x20file:\x20','resolveAgentId','join','client','resolveProjectName','186190hAbIVE','knowledgebases.json','push','low','chat','\x20→\x20','tools','Renamed\x20text\x20KB\x20file:\x20','listExperimentalKnowledgeBases','readdirSync','projectName','duplicate','add','experimental_knowledge_bases','unchanged','oldPath','formInterfaces','listPrompts','Agent\x20not\x20found:\x20','none','find','createImageGenerator','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','starter_message','prompt.md','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','json_schema','updateTextKnowledgeBase','image_gen','\x0a---\x20schema:\x20','listKnowledgeBases','deleteAgent','Renamed\x20prompt\x20file:\x20','reasoningEffort','error','systemPrompt','def','endsWith','status','4pWBNOB','Renamed\x20folder:\x20','profile','listChatInterfaces','writeFileSync','high','pushProject',')\x20can\x20be\x20pushed.\x20','listAgents','listChats','experimentalArtifacts','updateAgent','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','currentProjectId','dryRun','\x20in\x20project\x20','Renamed\x20agent\x20folder:\x20','availableModels','agents','site','statSync','\x0a---\x20function:\x20','.llm','Output\x20directory\x20already\x20exists:\x20','createIntegration','getDefaultAgent','ALREADY_EXISTS','idToName','dirname','llm_project','AGENT_NOT_FOUND','10uVbaQM','Project\x20not\x20found:\x20','chat_parent_segment','knowledgeBases','INVALID_ARGUMENT','(dry-run)','set','.yml','target','unlinkSync','Multiple\x20agents\x20found\x20with\x20name\x20\x27','.md','Renamed\x20integration\x20file:\x20','KnowledgeBase','stringify','Renamed\x20form\x20interface\x20file:\x20','size','content','chat_agent_console','listImageGenerators','listTextKnowledgeBases','updateAgentResponse','5316gvaTLJ','files','isDirectory','LLM_PROJECT_NOT_FOUND','get','includes','claude-4.5-sonnet','updateKnowledgeBase','Renamed\x20KB\x20file:\x20','Backup\x20folder\x20not\x20found:\x20','temperature','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','agent','info','basename','total','createAgentResponse','existsSync','template','getUserSettings','updateExperimentalArtifact','INTERNAL','tdx_','minimal','agentId','exportedFrom','1292064ErjQob','prompts','code.js','Renamed\x20experimental\x20KB\x20directory:\x20','tdx.json','cloneProject','resolveProjectId','listFormInterfaces','split','project','text','variables','logger','getAgent','chat_generic','listExperimentalArtifacts','code','createPrompt','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','filter','createAgent','getChatLog','experimentalKnowledgeBases','Unable\x20to\x20create\x20project\x20after\x20','integrations','isFile','already\x20exists','getDefaultProjectName','#\x20prompt.md\x0a','---\x20file:\x20','startChat','functions','updateFormInterface','projectId','397106SMXypW','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','length','serviceType','localeCompare','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','integrations.json','experimental_artifacts','UNAUTHENTICATED','readFileSync','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','createTextKnowledgeBase','projects','attributes','displayName','166737NGhPkV','\x22\x20already\x20exists','rmSync','agent.yml','parse','toLowerCase','agents.json',')\x20can\x20be\x20cloned.','Agent\x20reference\x20not\x20found','Unresolved\x20dependencies:\x20','knowledge_bases','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.','\x20---\x0a','has','Renamed\x20experimental\x20artifact\x20directory:\x20','warn','some','agent.yml\x20not\x20found\x20in\x20','service_type','pushAgent','isManaged','deleteProject','createExperimentalArtifact','type','setDefaultAgent','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','path','counts','dir','Only\x20safe\x20types\x20(','createChatInterface','chat_interfaces','created','actions','loadJsonFile','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','clearDefaultAgent','new','sort','restoreProject','pullProject','backupProject','outputs','starterMessage','agentsFull','form_interfaces','getOrCreateDefaultAgent','1020IUqODw','TextKnowledgeBase','1986939nUlHzy','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','utf-8','2358DKulwG','listToolTargets','webSearchTools','Available\x20agents:\x20','):\x20','slackMessageMode','\x20attempts\x20due\x20to\x20name\x20conflicts.','map','toISOString','name','isDir','getOrCreateDefaultProject','prompts.json','yaml','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','cwd','newProjectId'];a133_0x1546=function(){return _0x4b3e61;};return a133_0x1546();}import*as a133_0x110b88 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,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}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 a133_0x1505(_0x20fcb4,_0x22a0b8){_0x20fcb4=_0x20fcb4-0x130;const _0x154621=a133_0x1546();let _0x150573=_0x154621[_0x20fcb4];return _0x150573;}import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a133_0x352433(0x213),a133_0x352433(0x1e7),a133_0x352433(0x1d7)];async function safeListOrEmpty(_0x2cf75d){const _0x22a6e7=a133_0x352433;try{return await _0x2cf75d();}catch(_0x39bdc8){if(_0x39bdc8 instanceof HTTPClientError&&_0x39bdc8[_0x22a6e7(0x1b5)]===0x194)return[];throw _0x39bdc8;}}export class LLMSDK{[a133_0x352433(0x1c3)];[a133_0x352433(0x18d)];['context'];[a133_0x352433(0x211)]=Logger['of']('sdk.llm');constructor(_0x45cc54){const _0xca781=a133_0x352433;this['client']=new LLMApiClient(_0x45cc54),this[_0xca781(0x15c)]=_0x45cc54;}['getDefaultProjectName'](){const _0x66e528=getSanitizedUsername();return'tdx_default_'+_0x66e528;}async['setCurrentProject'](_0x8c759d){const _0x46d8a8=a133_0x352433,{projectId:_0x74abb5}=await this['resolveProjectName'](_0x8c759d);this[_0x46d8a8(0x1c3)]=_0x74abb5;}['getCurrentProject'](){const _0xe06122=a133_0x352433;return this[_0xe06122(0x1c3)];}async[a133_0x352433(0x24f)](_0x109d77){const _0x4971af=a133_0x352433,_0x16da38=this[_0x4971af(0x15c)]['profile'];let _0x59ffd6,_0x43257e;if(_0x109d77['includes']('/')){const _0x526ea1=_0x109d77[_0x4971af(0x20d)]('/');if(_0x526ea1[_0x4971af(0x22a)]!==0x2)throw new SDKError(ErrorCode[_0x4971af(0x1d9)],'Invalid\x20agent\x20reference\x20format:\x20'+_0x109d77,undefined,{'helpText':'Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22'});const [_0x10de7f,_0x273d07]=_0x526ea1;_0x59ffd6=await this[_0x4971af(0x20b)](_0x10de7f),_0x43257e=_0x273d07;}else _0x59ffd6=this[_0x4971af(0x1c3)]||(await this['getOrCreateDefaultProject']())['id'],_0x43257e=_0x109d77;const _0x1d037c=await this[_0x4971af(0x18b)](_0x43257e,_0x59ffd6),_0x1efaef=await this[_0x4971af(0x18d)][_0x4971af(0x212)](_0x1d037c);writeCachedLLMAgent(_0x1efaef[_0x4971af(0x235)][_0x4971af(0x152)],_0x1d037c,_0x59ffd6,_0x16da38);}[a133_0x352433(0x1cf)](){const _0x285c89=a133_0x352433,_0x22b149=this[_0x285c89(0x15c)][_0x285c89(0x1b8)];return readCachedLLMAgent(_0x22b149)||undefined;}[a133_0x352433(0x139)](){const _0x2c0f98=a133_0x352433,_0xd1a828=this['context'][_0x2c0f98(0x1b8)];clearCachedLLMAgent(_0xd1a828);}async[a133_0x352433(0x166)](){const _0x139046=a133_0x352433,_0x58698d=await this['client'][_0x139046(0x1fe)](),_0x58d1f3=[];for(const _0x279084 of _0x58698d['availableModelNames']){const _0x4149ee=_0x58698d[_0x139046(0x1c7)][_0x279084];_0x4149ee&&_0x58d1f3['push']({'name':_0x279084,'displayName':_0x4149ee[_0x139046(0x236)]});}return _0x58d1f3;}async['createProject'](_0x54633c){const _0x1604f1=a133_0x352433;return await this[_0x1604f1(0x18d)]['createProject'](_0x54633c);}async[a133_0x352433(0x24c)](_0x345f85){const _0x4e55db=a133_0x352433,{projectId:_0x42b8a0}=await this[_0x4e55db(0x18e)](_0x345f85);await this[_0x4e55db(0x18d)][_0x4e55db(0x24c)](_0x42b8a0);}async[a133_0x352433(0x234)](_0x53aab0=0x32){const _0x70a54f=a133_0x352433;return await this[_0x70a54f(0x18d)][_0x70a54f(0x187)](_0x53aab0);}async[a133_0x352433(0x154)](_0x29fc5b){const _0x4f90bb=a133_0x352433,_0x1be5b8=_0x29fc5b||this[_0x4f90bb(0x220)](),_0x3f7053=this['context'][_0x4f90bb(0x1b8)];if(!_0x29fc5b){const _0xf956ea=readCachedLLMProject(_0x3f7053);if(_0xf956ea&&_0xf956ea[_0x4f90bb(0x152)]===_0x1be5b8)try{const _0x28d014=await this['client'][_0x4f90bb(0x164)](_0xf956ea['id']);if(_0x28d014[_0x4f90bb(0x235)]['name']===_0x1be5b8)return _0x28d014;}catch{}}const _0x25da11=await this[_0x4f90bb(0x18d)][_0x4f90bb(0x187)](),_0x2d751d=_0x25da11[_0x4f90bb(0x1a3)](_0x927cb4=>_0x927cb4['attributes'][_0x4f90bb(0x152)]===_0x1be5b8);if(_0x2d751d)return!_0x29fc5b&&writeCachedLLMProject(_0x1be5b8,_0x2d751d['id'],_0x3f7053),_0x2d751d;const _0x3f2422=await this[_0x4f90bb(0x18d)][_0x4f90bb(0x15a)]({'name':_0x1be5b8,'description':_0x4f90bb(0x229)+getSanitizedUsername()+')'});return!_0x29fc5b&&writeCachedLLMProject(_0x1be5b8,_0x3f2422['id'],_0x3f7053),_0x3f2422;}async['resolveProjectId'](_0x32627c){const _0x349302=a133_0x352433,_0x364333=await this['client'][_0x349302(0x187)](),_0x4f3f88=_0x364333[_0x349302(0x218)](_0x10f1e5=>_0x10f1e5[_0x349302(0x235)][_0x349302(0x152)]===_0x32627c);if(_0x4f3f88[_0x349302(0x22a)]===0x0)throw new SDKError(ErrorCode[_0x349302(0x1ee)],'Project\x20not\x20found:\x20'+_0x32627c,undefined,{'helpText':_0x349302(0x1f6)});if(_0x4f3f88[_0x349302(0x22a)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x349302(0x16f)+_0x32627c+'\x27.\x20This\x20should\x20not\x20happen.');return _0x4f3f88[0x0]['id'];}async['resolveProjectName'](_0x3a5cb4){const _0x19125b=a133_0x352433,_0x2ff6e0=await this[_0x19125b(0x18d)][_0x19125b(0x187)](),_0x57c86a=_0x2ff6e0['find'](_0x114e42=>_0x114e42[_0x19125b(0x235)][_0x19125b(0x152)]===_0x3a5cb4);if(_0x57c86a)return{'projectId':_0x57c86a['id'],'project':_0x57c86a};throw new SDKError(ErrorCode[_0x19125b(0x1ee)],_0x19125b(0x1d6)+_0x3a5cb4,undefined,{'helpText':_0x19125b(0x1f6)});}async[a133_0x352433(0x143)](_0xe107c1=a133_0x352433(0x1f1),_0x21e75d=0x0,_0x385c8e){const _0x54d18e=a133_0x352433,_0x23ab82=0xa;let _0x14bf09=0x0,_0x5ddc18;while(_0x14bf09<_0x23ab82){try{const _0x286775=await this[_0x54d18e(0x154)](_0x5ddc18),_0x3164ff=_0x286775['id'],_0x473c7e=[_0x54d18e(0x1a2),_0x54d18e(0x202),_0x54d18e(0x192),'medium',_0x54d18e(0x1bb)],_0x4861bf=_0x21e75d===0x0?_0x54d18e(0x201)+_0xe107c1:'tdx_'+_0xe107c1+_0x54d18e(0x183)+_0x473c7e[_0x21e75d],_0x47cd06=await this['client'][_0x54d18e(0x1be)](_0x3164ff),_0x3808c5=_0x47cd06[_0x54d18e(0x1a3)](_0x4dc51f=>_0x4dc51f[_0x54d18e(0x235)]['name']===_0x4861bf);if(_0x3808c5)return _0x3808c5;const _0x58f719=_0x21e75d>0x0?0x1:_0x385c8e;return await this['client'][_0x54d18e(0x219)]({'name':_0x4861bf,'projectId':_0x3164ff,'modelType':_0xe107c1,'systemPrompt':'','temperature':_0x58f719,'reasoningEffort':_0x21e75d>0x0?_0x21e75d:undefined});}catch(_0x3d0e9c){if(_0x3d0e9c instanceof HTTPClientError){const _0x5917fd=_0x3d0e9c['status'];if(_0x5917fd>=0x190&&_0x5917fd<0x1f4){if(_0x5917fd===0x191)throw new SDKError(ErrorCode[_0x54d18e(0x230)],'Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.',_0x3d0e9c);else{if(_0x5917fd===0x193)throw new SDKError(ErrorCode['PERMISSION_DENIED'],_0x54d18e(0x1a5),_0x3d0e9c);}throw _0x3d0e9c;}}if(errorContains(_0x3d0e9c,_0x54d18e(0x21f),_0x54d18e(0x19a),'conflict')){_0x14bf09++;if(_0x14bf09>=_0x23ab82)throw new SDKError(ErrorCode[_0x54d18e(0x1d0)],_0x54d18e(0x21c)+_0x23ab82+_0x54d18e(0x14f),_0x3d0e9c);const _0x35ef70=this['getDefaultProjectName']();_0x5ddc18=_0x35ef70+'_'+generateRandomHex();continue;}throw _0x3d0e9c;}}throw new SDKError(ErrorCode[_0x54d18e(0x200)],_0x54d18e(0x186));}async[a133_0x352433(0x18b)](_0x594af9,_0x493f1e){const _0x4fd417=a133_0x352433,_0x1b0c43=_0x493f1e||this[_0x4fd417(0x1c3)],_0x12c122=await this[_0x4fd417(0x18d)][_0x4fd417(0x1be)](_0x1b0c43),_0x7debf1=_0x12c122[_0x4fd417(0x218)](_0x35719c=>_0x35719c['attributes'][_0x4fd417(0x152)]===_0x594af9);if(_0x7debf1[_0x4fd417(0x22a)]===0x0){const _0x21cfee=_0x1b0c43?_0x4fd417(0x1c5)+_0x1b0c43:'';throw new SDKError(ErrorCode[_0x4fd417(0x1d4)],_0x4fd417(0x1a1)+_0x594af9+_0x21cfee,undefined,{'helpText':_0x1b0c43?_0x4fd417(0x232):_0x4fd417(0x242)});}if(_0x7debf1[_0x4fd417(0x22a)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x4fd417(0x1df)+_0x594af9+'\x27.\x20This\x20should\x20not\x20happen.');return _0x7debf1[0x0]['id'];}async[a133_0x352433(0x1c8)](_0x48d728){const _0x234425=a133_0x352433,_0x3feb2f=_0x48d728||this['currentProjectId'];return await this[_0x234425(0x18d)][_0x234425(0x1be)](_0x3feb2f);}async[a133_0x352433(0x141)](_0x3b5956){const _0x44937a=a133_0x352433;return await this[_0x44937a(0x18d)][_0x44937a(0x188)](_0x3b5956);}async['agent'](_0x37f257){const _0x466194=a133_0x352433;return await this[_0x466194(0x18d)][_0x466194(0x212)](_0x37f257);}async[a133_0x352433(0x219)](_0x12c0d2){const _0x17e427=a133_0x352433;return await this[_0x17e427(0x18d)]['createAgent'](_0x12c0d2);}async[a133_0x352433(0x1c1)](_0x264851,_0x51c319){const _0x470553=a133_0x352433;return await this[_0x470553(0x18d)][_0x470553(0x1c1)](_0x264851,_0x51c319);}async[a133_0x352433(0x1ae)](_0x538d56){const _0x41c725=a133_0x352433;await this[_0x41c725(0x18d)][_0x41c725(0x1ae)](_0x538d56);}async[a133_0x352433(0x223)](_0x48b9a5){const _0x3377f7=a133_0x352433;return await this[_0x3377f7(0x18d)]['startChat']({'agentId':_0x48b9a5});}async*[a133_0x352433(0x193)](_0x31af4b,_0x1973de){const _0x38eecc=a133_0x352433;let _0x3cfc7d=_0x1973de?.['chatId'];const _0x1d38a4=_0x1973de?.[_0x38eecc(0x203)];if(!_0x3cfc7d){if(!_0x1d38a4)throw new Error(_0x38eecc(0x217));const _0x1f968c=await this['client']['startChat']({'agentId':_0x1d38a4});_0x3cfc7d=_0x1f968c['id'],yield{'type':_0x38eecc(0x185),'data':{'chatId':_0x3cfc7d,'agentId':_0x1d38a4,'projectId':_0x1f968c[_0x38eecc(0x235)][_0x38eecc(0x226)]}};}for await(const _0x17eb92 of this['client']['continueChat'](_0x3cfc7d,_0x31af4b,_0x1973de?.['signal'])){yield{'type':'event','data':_0x17eb92};}}async['chats'](_0x2a204f=0x32){const _0x3f20bf=a133_0x352433;return await this['client'][_0x3f20bf(0x1bf)](_0x2a204f);}async['history'](_0x18f801){return await this['client']['getChatHistory'](_0x18f801);}async[a133_0x352433(0x21a)](_0x314d67){const _0x377aa9=a133_0x352433;return await this[_0x377aa9(0x18d)][_0x377aa9(0x21a)](_0x314d67);}async['chatInfo'](_0x4da77a){const _0x5f2f03=a133_0x352433;return await this[_0x5f2f03(0x18d)]['getChatInfo'](_0x4da77a);}async[a133_0x352433(0x13e)](_0x4441be,_0x38ce2d,_0x39957e){const _0x1d05b5=a133_0x352433,_0x517623=_0x39957e?.[_0x1d05b5(0x1c4)]??![],{projectId:_0x383c3b,project:_0x16c221}=await this[_0x1d05b5(0x18e)](_0x4441be),_0x526463=_0x16c221[_0x1d05b5(0x235)][_0x1d05b5(0x152)],_0x4c7373=_0x38ce2d||_0x526463+_0x1d05b5(0x1cc);if(a133_0x209372[_0x1d05b5(0x1fc)](_0x4c7373)&&!_0x517623)throw new SDKError(ErrorCode[_0x1d05b5(0x1d0)],_0x1d05b5(0x1cd)+_0x4c7373,undefined,{'helpText':_0x1d05b5(0x1a8)});const _0x1a3be2=await this[_0x1d05b5(0x18d)][_0x1d05b5(0x188)](_0x383c3b),_0x835edd=await this[_0x1d05b5(0x18d)][_0x1d05b5(0x1ad)](_0x383c3b),_0x49fc8b=await this[_0x1d05b5(0x18d)][_0x1d05b5(0x1a0)](_0x383c3b),_0xc55899=await this['client'][_0x1d05b5(0x16c)](_0x383c3b);if(!_0x517623){a133_0x209372[_0x1d05b5(0x171)](_0x4c7373,{'recursive':!![]});const _0x674b25={'version':'1.0','exportedAt':new Date()[_0x1d05b5(0x151)](),'exportedFrom':{'site':this[_0x1d05b5(0x15c)]['site'],'projectId':_0x383c3b,'projectName':_0x526463},'project':_0x16c221};a133_0x209372[_0x1d05b5(0x1ba)](a133_0x110b88[_0x1d05b5(0x18c)](_0x4c7373,_0x1d05b5(0x173)),JSON['stringify'](_0x674b25,null,0x2)),a133_0x209372[_0x1d05b5(0x1ba)](a133_0x110b88[_0x1d05b5(0x18c)](_0x4c7373,_0x1d05b5(0x23d)),JSON[_0x1d05b5(0x1e3)](_0x1a3be2,null,0x2)),a133_0x209372[_0x1d05b5(0x1ba)](a133_0x110b88[_0x1d05b5(0x18c)](_0x4c7373,_0x1d05b5(0x190)),JSON['stringify'](_0x835edd,null,0x2)),a133_0x209372[_0x1d05b5(0x1ba)](a133_0x110b88[_0x1d05b5(0x18c)](_0x4c7373,_0x1d05b5(0x155)),JSON[_0x1d05b5(0x1e3)](_0x49fc8b,null,0x2)),a133_0x209372['writeFileSync'](a133_0x110b88[_0x1d05b5(0x18c)](_0x4c7373,_0x1d05b5(0x22e)),JSON[_0x1d05b5(0x1e3)](_0xc55899,null,0x2));}return{'projectName':_0x526463,'outputDir':_0x4c7373,'counts':{'agents':_0x1a3be2[_0x1d05b5(0x22a)],'knowledgeBases':_0x835edd[_0x1d05b5(0x22a)],'prompts':_0x49fc8b['length'],'integrations':_0xc55899[_0x1d05b5(0x22a)]}};}async[a133_0x352433(0x13c)](_0x4035c,_0x3f17be){const _0xca14c8=a133_0x352433,_0x5831f9=_0x3f17be?.[_0xca14c8(0x1c4)]??![],_0x531b66=this['getBackupMetadata'](_0x4035c),_0x13e128=_0x531b66[_0xca14c8(0x204)][_0xca14c8(0x1c9)],_0x3037df=this[_0xca14c8(0x15c)]['site'],_0x19695c=_0x13e128!==_0x3037df?_0x13e128:undefined,_0x1c40eb=this[_0xca14c8(0x137)](a133_0x110b88[_0xca14c8(0x18c)](_0x4035c,_0xca14c8(0x23d)),[]),_0x1e8309=this[_0xca14c8(0x137)](a133_0x110b88[_0xca14c8(0x18c)](_0x4035c,_0xca14c8(0x190)),[]),_0x5df745=this['loadJsonFile'](a133_0x110b88[_0xca14c8(0x18c)](_0x4035c,_0xca14c8(0x155)),[]),_0x59c631=this['loadJsonFile'](a133_0x110b88[_0xca14c8(0x18c)](_0x4035c,_0xca14c8(0x22e)),[]),_0x3ab27a=_0x3f17be?.['name']||_0x531b66[_0xca14c8(0x204)][_0xca14c8(0x199)];if(_0x5831f9){const _0x567e82=new Map(),_0x1d43a0=[..._0x1c40eb],_0x118a6e=_0x1c40eb['length']+0x1;let _0x3f1789=0x0;while(_0x1d43a0[_0xca14c8(0x22a)]>0x0&&_0x3f1789<_0x118a6e){_0x3f1789++;const _0x2e79cf=[];for(const _0x50fa41 of _0x1d43a0){canCreateAgent(_0x50fa41,_0x567e82)?_0x567e82['set'](_0x50fa41['id'],'dry-run-'+_0x50fa41['id']):_0x2e79cf[_0xca14c8(0x191)](_0x50fa41);}if(_0x2e79cf['length']===_0x1d43a0[_0xca14c8(0x22a)])throw new SDKError(ErrorCode[_0xca14c8(0x200)],_0xca14c8(0x161),undefined,{'helpText':_0xca14c8(0x157)});_0x1d43a0[_0xca14c8(0x22a)]=0x0,_0x1d43a0[_0xca14c8(0x191)](..._0x2e79cf);}const _0x42ffe3=_0x5df745[_0xca14c8(0x218)](_0x49cd0a=>_0x567e82[_0xca14c8(0x244)](_0x49cd0a[_0xca14c8(0x235)][_0xca14c8(0x203)]))[_0xca14c8(0x22a)];return{'projectName':_0x3ab27a,'projectId':_0xca14c8(0x1da),'counts':{'agents':_0x1c40eb['length'],'knowledgeBases':_0x1e8309[_0xca14c8(0x22a)],'prompts':_0x42ffe3,'integrations':_0x59c631['length']},'sourceSite':_0x19695c};}const _0x253fdb=await this[_0xca14c8(0x18d)][_0xca14c8(0x15a)]({'name':_0x3ab27a,'description':_0x531b66[_0xca14c8(0x20e)][_0xca14c8(0x235)]['description']}),_0x5d96c2=_0x253fdb['id'],_0x1e7ee3=new Map(),_0x389dae=new Map(),_0x179693=new Map();for(const _0x1a3bd3 of _0x1e8309){const _0x25e9b1=await this[_0xca14c8(0x18d)][_0xca14c8(0x178)]({'projectId':_0x5d96c2,'name':_0x1a3bd3[_0xca14c8(0x235)][_0xca14c8(0x152)],'tdDatabaseName':_0x1a3bd3[_0xca14c8(0x235)]['tdDatabaseName'],'tables':_0x1a3bd3[_0xca14c8(0x235)]['tables']});_0x1e7ee3[_0xca14c8(0x1db)](_0x1a3bd3['id'],_0x25e9b1['id']);}const _0x2ea4de=[..._0x1c40eb],_0x205b4d=_0x1c40eb[_0xca14c8(0x22a)]+0x1;let _0x256c46=0x0;while(_0x2ea4de[_0xca14c8(0x22a)]>0x0&&_0x256c46<_0x205b4d){_0x256c46++;const _0x370663=[];for(const _0x15fb0a of _0x2ea4de){if(canCreateAgent(_0x15fb0a,_0x389dae)){const _0x155518=remapToolIds(_0x15fb0a[_0xca14c8(0x235)][_0xca14c8(0x195)],_0x1e7ee3,_0x389dae),_0x34c138=remapVariableIds(_0x15fb0a['attributes'][_0xca14c8(0x210)],_0x1e7ee3),_0xa92dd1=await this[_0xca14c8(0x18d)][_0xca14c8(0x1fb)]({'name':_0x15fb0a['attributes'][_0xca14c8(0x152)],'projectId':_0x5d96c2,'systemPrompt':_0x15fb0a[_0xca14c8(0x235)][_0xca14c8(0x1b2)],'starterMessage':_0x15fb0a[_0xca14c8(0x235)][_0xca14c8(0x140)],'modelType':migrateModelType(_0x15fb0a[_0xca14c8(0x235)]['modelType']),'maxToolIterations':_0x15fb0a[_0xca14c8(0x235)][_0xca14c8(0x17f)],'temperature':_0x15fb0a[_0xca14c8(0x235)][_0xca14c8(0x1f5)],'reasoningEffort':_0x15fb0a[_0xca14c8(0x235)][_0xca14c8(0x1b0)],'outputs':_0x15fb0a[_0xca14c8(0x235)][_0xca14c8(0x13f)],'tools':_0x155518,'variables':_0x34c138});_0x389dae[_0xca14c8(0x1db)](_0x15fb0a['id'],_0xa92dd1['id']);}else _0x370663[_0xca14c8(0x191)](_0x15fb0a);}if(_0x370663[_0xca14c8(0x22a)]===_0x2ea4de[_0xca14c8(0x22a)])throw new SDKError(ErrorCode[_0xca14c8(0x200)],_0xca14c8(0x161),undefined,{'helpText':_0xca14c8(0x157)});_0x2ea4de[_0xca14c8(0x22a)]=0x0,_0x2ea4de['push'](..._0x370663);}for(const _0x528d9c of _0x5df745){const _0x3b2d82=_0x389dae[_0xca14c8(0x1ef)](_0x528d9c[_0xca14c8(0x235)][_0xca14c8(0x203)]);if(!_0x3b2d82)continue;const _0x4ce070=await this[_0xca14c8(0x18d)][_0xca14c8(0x216)]({'projectId':_0x5d96c2,'agentId':_0x3b2d82,'name':_0x528d9c[_0xca14c8(0x235)][_0xca14c8(0x152)],'systemPrompt':_0x528d9c[_0xca14c8(0x235)][_0xca14c8(0x1b2)],'template':_0x528d9c[_0xca14c8(0x235)][_0xca14c8(0x1fd)],'jsonSchemaHint':_0x528d9c['attributes']['jsonSchemaHint']});_0x179693[_0xca14c8(0x1db)](_0x528d9c['id'],_0x4ce070['id']);}for(const _0x48e160 of _0x59c631){const _0x35338a=_0x48e160[_0xca14c8(0x235)][_0xca14c8(0x136)][_0xca14c8(0x150)](_0x50d4c7=>({..._0x50d4c7,'promptId':_0x179693[_0xca14c8(0x1ef)](_0x50d4c7[_0xca14c8(0x168)])||_0x50d4c7[_0xca14c8(0x168)]}));await this[_0xca14c8(0x18d)]['createIntegration']({'projectId':_0x5d96c2,'serviceType':_0x48e160['attributes'][_0xca14c8(0x22b)],'actions':_0x35338a,'slackMessageMode':_0x48e160[_0xca14c8(0x235)][_0xca14c8(0x14e)],'chatIgnoreManagedActions':_0x48e160[_0xca14c8(0x235)]['chatIgnoreManagedActions'],'chatWelcomeMessage':_0x48e160[_0xca14c8(0x235)][_0xca14c8(0x179)],'webhookCorsOrigins':_0x48e160[_0xca14c8(0x235)][_0xca14c8(0x174)]});}return{'projectName':_0x3ab27a,'projectId':_0x5d96c2,'counts':{'agents':_0x389dae[_0xca14c8(0x1e5)],'knowledgeBases':_0x1e7ee3[_0xca14c8(0x1e5)],'prompts':_0x179693['size'],'integrations':_0x59c631[_0xca14c8(0x22a)]},'sourceSite':_0x19695c};}[a133_0x352433(0x137)](_0x5b1c3a,_0x229098){const _0x6aa337=a133_0x352433;if(!a133_0x209372[_0x6aa337(0x1fc)](_0x5b1c3a))return _0x229098;return JSON[_0x6aa337(0x23b)](a133_0x209372[_0x6aa337(0x231)](_0x5b1c3a,_0x6aa337(0x148)));}['getBackupMetadata'](_0x126473){const _0x4b1d6f=a133_0x352433;if(!a133_0x209372[_0x4b1d6f(0x1fc)](_0x126473))throw new SDKError(ErrorCode['NOT_FOUND'],_0x4b1d6f(0x1f4)+_0x126473,undefined,{'helpText':_0x4b1d6f(0x138)});const _0x53f18c=a133_0x110b88[_0x4b1d6f(0x18c)](_0x126473,_0x4b1d6f(0x173));if(!a133_0x209372[_0x4b1d6f(0x1fc)](_0x53f18c))throw new SDKError(ErrorCode[_0x4b1d6f(0x1d9)],_0x4b1d6f(0x1c2)+_0x126473,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x2c02e5=JSON['parse'](a133_0x209372[_0x4b1d6f(0x231)](_0x53f18c,_0x4b1d6f(0x148)));if(!isSupportedBackupVersion(_0x2c02e5[_0x4b1d6f(0x189)]))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Unsupported\x20backup\x20version:\x20'+_0x2c02e5[_0x4b1d6f(0x189)],undefined,{'helpText':_0x4b1d6f(0x228)});return _0x2c02e5;}async[a133_0x352433(0x13d)](_0x50ba8c,_0x2b19ea,_0x5791aa){const _0x2c41e1=a133_0x352433,{projectId:_0x4d62b1,project:_0x5a0524}=await this['resolveProjectName'](_0x50ba8c),_0xad2c3c=_0x5a0524[_0x2c41e1(0x235)][_0x2c41e1(0x152)];let _0x4fc4b4;if(_0x2b19ea)_0x4fc4b4=_0x2b19ea;else{const _0x3ee62e=a133_0x110b88[_0x2c41e1(0x18c)](process[_0x2c41e1(0x158)](),_0x2c41e1(0x1c8)),_0x3d80db=getSanitizedPathWithMigration(_0x3ee62e,_0xad2c3c);_0x3d80db[_0x2c41e1(0x15e)]&&this[_0x2c41e1(0x211)][_0x2c41e1(0x1f8)]('Renamed\x20folder:\x20'+a133_0x110b88[_0x2c41e1(0x1f9)](_0x3d80db[_0x2c41e1(0x19e)])+_0x2c41e1(0x194)+a133_0x110b88[_0x2c41e1(0x1f9)](_0x3d80db['path'])),_0x4fc4b4=_0x3d80db[_0x2c41e1(0x251)];}const _0x4bf74c=await this[_0x2c41e1(0x18d)][_0x2c41e1(0x188)](_0x4d62b1),_0x46d019=await this[_0x2c41e1(0x18d)][_0x2c41e1(0x1ad)](_0x4d62b1),_0x100fa6=await this[_0x2c41e1(0x18d)][_0x2c41e1(0x1e9)](_0x4d62b1),_0x4698f6=await safeListOrEmpty(()=>this[_0x2c41e1(0x18d)][_0x2c41e1(0x1e8)](_0x4d62b1)),_0x48df3b=await safeListOrEmpty(()=>this[_0x2c41e1(0x18d)]['listWebSearchTools'](_0x4d62b1)),_0x3f0b5a=await this[_0x2c41e1(0x18d)][_0x2c41e1(0x1a0)](_0x4d62b1),_0x43cf1e=await this[_0x2c41e1(0x18d)][_0x2c41e1(0x16c)](_0x4d62b1),_0x493d6f=await safeListOrEmpty(()=>this['client'][_0x2c41e1(0x197)](_0x4d62b1)),_0x445089=await safeListOrEmpty(()=>this[_0x2c41e1(0x18d)][_0x2c41e1(0x214)](_0x4d62b1)),_0x3ca9f8=await safeListOrEmpty(()=>this['client'][_0x2c41e1(0x20c)](_0x4d62b1)),_0x3fc381=await safeListOrEmpty(()=>this[_0x2c41e1(0x18d)][_0x2c41e1(0x1b9)](_0x4d62b1)),_0x4b9334=_0x43cf1e['filter'](_0x5d04ad=>!_0x5d04ad[_0x2c41e1(0x235)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x2c41e1(0x1f0)](_0x5d04ad[_0x2c41e1(0x235)][_0x2c41e1(0x22b)]['toLowerCase']())),_0x20989b=new Map(),_0x2ce081=new Map(),_0x22c85f=new Map(),_0x87d025=new Map(),_0x173879=new Map(),_0xadb902=new Map(),_0x1781d0=new Map();for(const _0x346eed of _0x4bf74c){_0x20989b[_0x2c41e1(0x1db)](_0x346eed['id'],_0x346eed[_0x2c41e1(0x235)][_0x2c41e1(0x152)]);}for(const _0x2e671c of _0x46d019){_0x2ce081[_0x2c41e1(0x1db)](_0x2e671c['id'],_0x2e671c[_0x2c41e1(0x235)][_0x2c41e1(0x152)]);}for(const _0x128819 of _0x100fa6){_0x22c85f[_0x2c41e1(0x1db)](_0x128819['id'],_0x128819[_0x2c41e1(0x235)][_0x2c41e1(0x152)]);}for(const _0x4a343d of _0x4698f6){_0x87d025[_0x2c41e1(0x1db)](_0x4a343d['id'],_0x4a343d[_0x2c41e1(0x235)]['name']);}for(const _0xa0ad0e of _0x48df3b){_0x173879['set'](_0xa0ad0e['id'],_0xa0ad0e[_0x2c41e1(0x235)][_0x2c41e1(0x152)]);}for(const _0x263fbe of _0x3f0b5a){_0xadb902['set'](_0x263fbe['id'],_0x263fbe[_0x2c41e1(0x235)][_0x2c41e1(0x152)]);}for(const _0x185f4e of _0x493d6f){_0x1781d0[_0x2c41e1(0x1db)](_0x185f4e['id'],_0x185f4e['attributes'][_0x2c41e1(0x152)]);}const _0x554e9e={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x2ce081,'TextKnowledgeBase':_0x22c85f,'Agent':_0x20989b,'WebSearchTool':_0x173879,'ImageGenerator':_0x87d025,'ExperimentalKnowledgeBase':_0x1781d0}),'resolvePromptName':async _0x158d1f=>_0xadb902['get'](_0x158d1f),'onWarning':_0x3c28a3=>this['logger'][_0x2c41e1(0x246)](_0x3c28a3)},_0x2b66e8={'projectName':_0xad2c3c,'outputDir':_0x4fc4b4,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'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},'formInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'chatInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0x43e73e=[],_0x300eab=[];for(const _0xcde707 of _0x4bf74c){const _0x18e7a6=getSanitizedPathWithMigration(_0x4fc4b4,_0xcde707['attributes'][_0x2c41e1(0x152)]);_0x18e7a6[_0x2c41e1(0x15e)]&&this['logger']['info'](_0x2c41e1(0x1c6)+a133_0x110b88['basename'](_0x18e7a6[_0x2c41e1(0x19e)])+_0x2c41e1(0x194)+a133_0x110b88[_0x2c41e1(0x1f9)](_0x18e7a6[_0x2c41e1(0x251)]));const _0x12ef77=_0x18e7a6['path'],_0x38c4fd=a133_0x110b88[_0x2c41e1(0x18c)](_0x12ef77,_0x2c41e1(0x1a7)),_0xe24d17=a133_0x110b88[_0x2c41e1(0x18c)](_0x12ef77,_0x2c41e1(0x23a)),_0x2cdd25=a133_0x110b88['join'](_0x12ef77,_0x2c41e1(0x184)),{yaml:_0x5e5339,systemPrompt:_0x37df03,starterMessage:_0x2a3715}=await agentResponseToDef(_0xcde707,_0x554e9e),_0xda1881=toAgentYamlString(_0x5e5339),_0x3d50f0=!a133_0x209372[_0x2c41e1(0x1fc)](_0xe24d17);let _0x32bfaf=_0x3d50f0,_0x4290a3;if(!_0x3d50f0){const _0x77e0c2=a133_0x209372['existsSync'](_0x38c4fd)?a133_0x209372[_0x2c41e1(0x231)](_0x38c4fd,_0x2c41e1(0x148)):'',_0x4d4383=a133_0x209372['readFileSync'](_0xe24d17,_0x2c41e1(0x148)),_0x14ffaa=_0x2c41e1(0x221)+_0x77e0c2+_0x2c41e1(0x15b)+_0x4d4383,_0x31be41=_0x2c41e1(0x221)+_0x37df03+_0x2c41e1(0x15b)+_0xda1881,_0x2caae5=generateDiff(_0x14ffaa,_0x31be41);_0x32bfaf=hasChanges(_0x2caae5),_0x32bfaf&&(_0x4290a3=formatDiffWithColors(_0x2caae5));}_0x43e73e['push']({'path':_0x12ef77,'content':'','isDir':!![]}),_0x43e73e[_0x2c41e1(0x191)]({'path':_0x38c4fd,'content':_0x37df03}),_0x43e73e[_0x2c41e1(0x191)]({'path':_0xe24d17,'content':_0xda1881});_0x2a3715&&_0x2a3715[_0x2c41e1(0x1f0)]('\x0a')&&_0x43e73e[_0x2c41e1(0x191)]({'path':_0x2cdd25,'content':_0x2a3715});_0x2b66e8[_0x2c41e1(0x1c8)]['push']({'agentName':_0xcde707['attributes'][_0x2c41e1(0x152)],'outputPath':_0x12ef77,'isNew':_0x3d50f0,'hasChanges':_0x32bfaf,'diff':_0x4290a3}),_0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x1c8)][_0x2c41e1(0x1fa)]++;if(_0x3d50f0)_0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x1c8)][_0x2c41e1(0x13a)]++;else{if(_0x32bfaf)_0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x1c8)]['updated']++;else _0x2b66e8['counts'][_0x2c41e1(0x1c8)][_0x2c41e1(0x19d)]++;}}for(const _0x587eaf of _0x46d019){if(_0x587eaf['attributes'][_0x2c41e1(0x24b)])continue;const _0x164a50=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x4fc4b4),_0x587eaf[_0x2c41e1(0x235)][_0x2c41e1(0x152)],_0x2c41e1(0x1dc));_0x164a50[_0x2c41e1(0x15e)]&&this['logger']['info'](_0x2c41e1(0x1f3)+a133_0x110b88['basename'](_0x164a50[_0x2c41e1(0x19e)])+_0x2c41e1(0x194)+a133_0x110b88[_0x2c41e1(0x1f9)](_0x164a50[_0x2c41e1(0x251)]));const _0x52e31a=_0x164a50[_0x2c41e1(0x251)],_0x539acc=apiKnowledgeBaseToYaml(_0x587eaf),_0x535fa0=toKnowledgeBaseYamlString(_0x539acc),_0x25a0fb=!a133_0x209372[_0x2c41e1(0x1fc)](_0x52e31a);let _0x1ec20e=_0x25a0fb,_0x552562;if(!_0x25a0fb){const _0x5bbcdd=a133_0x209372[_0x2c41e1(0x231)](_0x52e31a,_0x2c41e1(0x148)),_0x44314d=generateDiff(_0x5bbcdd,_0x535fa0);_0x1ec20e=hasChanges(_0x44314d),_0x1ec20e&&(_0x552562=formatDiffWithColors(_0x44314d));}_0x43e73e[_0x2c41e1(0x191)]({'path':_0x52e31a,'content':_0x535fa0}),_0x2b66e8[_0x2c41e1(0x1d8)]['push']({'name':_0x587eaf['attributes'][_0x2c41e1(0x152)],'outputPath':_0x52e31a,'isNew':_0x25a0fb,'hasChanges':_0x1ec20e,'diff':_0x552562}),_0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x1d8)]['total']++;if(_0x25a0fb)_0x2b66e8[_0x2c41e1(0x130)]['knowledgeBases']['new']++;else{if(_0x1ec20e)_0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x1d8)][_0x2c41e1(0x167)]++;else _0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x1d8)]['unchanged']++;}}for(const _0x21d603 of _0x100fa6){if(_0x21d603['attributes'][_0x2c41e1(0x24b)])continue;const _0x109ea5=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x4fc4b4),_0x21d603[_0x2c41e1(0x235)][_0x2c41e1(0x152)],'.md');_0x109ea5[_0x2c41e1(0x15e)]&&this['logger'][_0x2c41e1(0x1f8)](_0x2c41e1(0x196)+a133_0x110b88[_0x2c41e1(0x1f9)](_0x109ea5[_0x2c41e1(0x19e)])+_0x2c41e1(0x194)+a133_0x110b88['basename'](_0x109ea5['path']));const _0x166d85=_0x109ea5[_0x2c41e1(0x251)],_0x476cc1=toTextKnowledgeBaseMd(_0x21d603['attributes'][_0x2c41e1(0x152)],_0x21d603[_0x2c41e1(0x235)][_0x2c41e1(0x20f)]),_0x48563c=!a133_0x209372[_0x2c41e1(0x1fc)](_0x166d85);let _0x4a231b=_0x48563c,_0x233cd6;if(!_0x48563c){const _0x12d602=a133_0x209372[_0x2c41e1(0x231)](_0x166d85,'utf-8'),_0x3c8fb2=generateDiff(_0x12d602,_0x476cc1);_0x4a231b=hasChanges(_0x3c8fb2),_0x4a231b&&(_0x233cd6=formatDiffWithColors(_0x3c8fb2));}_0x43e73e[_0x2c41e1(0x191)]({'path':_0x166d85,'content':_0x476cc1}),_0x2b66e8[_0x2c41e1(0x17d)][_0x2c41e1(0x191)]({'name':_0x21d603['attributes'][_0x2c41e1(0x152)],'outputPath':_0x166d85,'isNew':_0x48563c,'hasChanges':_0x4a231b,'diff':_0x233cd6}),_0x2b66e8['counts'][_0x2c41e1(0x17d)]['total']++;if(_0x48563c)_0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x17d)][_0x2c41e1(0x13a)]++;else{if(_0x4a231b)_0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x17d)]['updated']++;else _0x2b66e8[_0x2c41e1(0x130)]['textKnowledgeBases']['unchanged']++;}}for(const _0x53cdea of _0x3f0b5a){if(_0x53cdea['attributes'][_0x2c41e1(0x24b)])continue;const _0x40383a=getSanitizedPathWithMigration(getPromptsDir(_0x4fc4b4),_0x53cdea[_0x2c41e1(0x235)][_0x2c41e1(0x152)],_0x2c41e1(0x1dc));_0x40383a[_0x2c41e1(0x15e)]&&this[_0x2c41e1(0x211)][_0x2c41e1(0x1f8)](_0x2c41e1(0x1af)+a133_0x110b88[_0x2c41e1(0x1f9)](_0x40383a[_0x2c41e1(0x19e)])+'\x20→\x20'+a133_0x110b88[_0x2c41e1(0x1f9)](_0x40383a[_0x2c41e1(0x251)]));const _0x2f4289=_0x40383a['path'],_0xdef5b1=await apiPromptToYaml(_0x53cdea,_0x554e9e);if(!_0xdef5b1)continue;const _0x1fe1e4=toPromptYamlString(_0xdef5b1),_0x36bcf9=!a133_0x209372[_0x2c41e1(0x1fc)](_0x2f4289);let _0x2cc90f=_0x36bcf9,_0x29da32;if(!_0x36bcf9){const _0x18924b=a133_0x209372['readFileSync'](_0x2f4289,_0x2c41e1(0x148)),_0x1bb38b=generateDiff(_0x18924b,_0x1fe1e4);_0x2cc90f=hasChanges(_0x1bb38b),_0x2cc90f&&(_0x29da32=formatDiffWithColors(_0x1bb38b));}_0x43e73e['push']({'path':_0x2f4289,'content':_0x1fe1e4}),_0x2b66e8['prompts'][_0x2c41e1(0x191)]({'name':_0x53cdea[_0x2c41e1(0x235)]['name'],'outputPath':_0x2f4289,'isNew':_0x36bcf9,'hasChanges':_0x2cc90f,'diff':_0x29da32}),_0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x206)][_0x2c41e1(0x1fa)]++;if(_0x36bcf9)_0x2b66e8[_0x2c41e1(0x130)]['prompts']['new']++;else{if(_0x2cc90f)_0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x206)]['updated']++;else _0x2b66e8['counts'][_0x2c41e1(0x206)]['unchanged']++;}}for(const _0x56fec3 of _0x4b9334){const _0x4656cd=_0x56fec3['attributes']['serviceType'][_0x2c41e1(0x23c)](),_0x472784=getSanitizedPathWithMigration(getIntegrationsDir(_0x4fc4b4),_0x4656cd,_0x2c41e1(0x1dc));_0x472784['renamed']&&this[_0x2c41e1(0x211)]['info'](_0x2c41e1(0x1e1)+a133_0x110b88[_0x2c41e1(0x1f9)](_0x472784[_0x2c41e1(0x19e)])+'\x20→\x20'+a133_0x110b88[_0x2c41e1(0x1f9)](_0x472784[_0x2c41e1(0x251)]));const _0x1bcd06=_0x472784[_0x2c41e1(0x251)],_0x45188c=await apiIntegrationToYaml(_0x56fec3,_0x554e9e),_0x4e7233=toIntegrationYamlString(_0x45188c),_0xa3168c=!a133_0x209372[_0x2c41e1(0x1fc)](_0x1bcd06);let _0x591469=_0xa3168c,_0x2cc522;if(!_0xa3168c){const _0xc8123=a133_0x209372[_0x2c41e1(0x231)](_0x1bcd06,_0x2c41e1(0x148)),_0x5f2f8c=generateDiff(_0xc8123,_0x4e7233);_0x591469=hasChanges(_0x5f2f8c),_0x591469&&(_0x2cc522=formatDiffWithColors(_0x5f2f8c));}_0x43e73e[_0x2c41e1(0x191)]({'path':_0x1bcd06,'content':_0x4e7233}),_0x2b66e8[_0x2c41e1(0x21d)][_0x2c41e1(0x191)]({'name':_0x4656cd,'outputPath':_0x1bcd06,'isNew':_0xa3168c,'hasChanges':_0x591469,'diff':_0x2cc522}),_0x2b66e8['counts'][_0x2c41e1(0x21d)][_0x2c41e1(0x1fa)]++;if(_0xa3168c)_0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x21d)]['new']++;else{if(_0x591469)_0x2b66e8[_0x2c41e1(0x130)]['integrations'][_0x2c41e1(0x167)]++;else _0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x21d)][_0x2c41e1(0x19d)]++;}}for(const _0x1621bf of _0x493d6f){if(_0x1621bf[_0x2c41e1(0x235)][_0x2c41e1(0x24b)])continue;const _0x5ced50=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x4fc4b4),_0x1621bf[_0x2c41e1(0x235)][_0x2c41e1(0x152)]);_0x5ced50['renamed']&&this[_0x2c41e1(0x211)][_0x2c41e1(0x1f8)](_0x2c41e1(0x208)+a133_0x110b88[_0x2c41e1(0x1f9)](_0x5ced50[_0x2c41e1(0x19e)])+_0x2c41e1(0x194)+a133_0x110b88[_0x2c41e1(0x1f9)](_0x5ced50[_0x2c41e1(0x251)]));const _0x39adb9=_0x5ced50[_0x2c41e1(0x251)],_0x2f4f26=a133_0x110b88[_0x2c41e1(0x18c)](_0x39adb9,sanitizeForFilesystem(_0x1621bf[_0x2c41e1(0x235)][_0x2c41e1(0x152)])+'.yml'),_0x3d62e6=a133_0x110b88[_0x2c41e1(0x18c)](_0x39adb9,_0x2c41e1(0x224)),_0x479087=apiExperimentalKnowledgeBaseToYaml(_0x1621bf),_0x33c13a=toExperimentalKnowledgeBaseYamlString(_0x479087),_0x5cc393=!a133_0x209372['existsSync'](_0x39adb9);let _0xe8b783=_0x5cc393,_0x16e3ae,_0x11debc=_0x33c13a;const _0x240a7a=[..._0x479087['functions']][_0x2c41e1(0x13b)]((_0x4d610c,_0xb0a761)=>_0x4d610c['name']['localeCompare'](_0xb0a761[_0x2c41e1(0x152)]));for(const _0x246324 of _0x240a7a){_0x11debc+=_0x2c41e1(0x1cb)+_0x246324[_0x2c41e1(0x152)]+_0x2c41e1(0x243)+_0x246324[_0x2c41e1(0x215)]+_0x2c41e1(0x1ac)+_0x246324['name']+'\x20---\x0a'+_0x246324['json_schema']+'\x0a';}if(!_0x5cc393){let _0x459954='';a133_0x209372[_0x2c41e1(0x1fc)](_0x2f4f26)&&(_0x459954=a133_0x209372[_0x2c41e1(0x231)](_0x2f4f26,_0x2c41e1(0x148)));if(a133_0x209372[_0x2c41e1(0x1fc)](_0x3d62e6)){const _0x5bbe27=a133_0x209372[_0x2c41e1(0x198)](_0x3d62e6,{'withFileTypes':!![]}),_0x106aea=_0x5bbe27[_0x2c41e1(0x218)](_0xf540b4=>_0xf540b4[_0x2c41e1(0x1ed)]())[_0x2c41e1(0x13b)]((_0xccb7dc,_0x174b97)=>_0xccb7dc['name'][_0x2c41e1(0x22c)](_0x174b97[_0x2c41e1(0x152)]));for(const _0x1d26c5 of _0x106aea){const _0x565c1b=a133_0x110b88['join'](_0x3d62e6,_0x1d26c5['name'],'code.js'),_0x3d9a8a=a133_0x110b88[_0x2c41e1(0x18c)](_0x3d62e6,_0x1d26c5[_0x2c41e1(0x152)],_0x2c41e1(0x170));a133_0x209372[_0x2c41e1(0x1fc)](_0x565c1b)&&(_0x459954+=_0x2c41e1(0x1cb)+_0x1d26c5[_0x2c41e1(0x152)]+_0x2c41e1(0x243)+a133_0x209372[_0x2c41e1(0x231)](_0x565c1b,_0x2c41e1(0x148))+'\x0a'),a133_0x209372['existsSync'](_0x3d9a8a)&&(_0x459954+=_0x2c41e1(0x17a)+_0x1d26c5[_0x2c41e1(0x152)]+_0x2c41e1(0x243)+a133_0x209372[_0x2c41e1(0x231)](_0x3d9a8a,_0x2c41e1(0x148))+'\x0a');}}const _0x5390a2=generateDiff(_0x459954,_0x11debc);_0xe8b783=hasChanges(_0x5390a2),_0xe8b783&&(_0x16e3ae=formatDiffWithColors(_0x5390a2));}_0x43e73e[_0x2c41e1(0x191)]({'path':_0x39adb9,'content':'','isDir':!![]}),_0x43e73e[_0x2c41e1(0x191)]({'path':_0x2f4f26,'content':_0x33c13a}),_0x43e73e[_0x2c41e1(0x191)]({'path':_0x3d62e6,'content':'','isDir':!![]});for(const _0x5d2b73 of _0x479087[_0x2c41e1(0x224)]){const _0x47f7bf=a133_0x110b88['join'](_0x3d62e6,sanitizeForFilesystem(_0x5d2b73[_0x2c41e1(0x152)])),_0x1b291d=a133_0x110b88[_0x2c41e1(0x18c)](_0x47f7bf,'code.js'),_0x773fc=a133_0x110b88[_0x2c41e1(0x18c)](_0x47f7bf,'json_schema.json');_0x43e73e[_0x2c41e1(0x191)]({'path':_0x47f7bf,'content':'','isDir':!![]}),_0x43e73e['push']({'path':_0x1b291d,'content':_0x5d2b73[_0x2c41e1(0x215)]}),_0x43e73e[_0x2c41e1(0x191)]({'path':_0x773fc,'content':_0x5d2b73[_0x2c41e1(0x1a9)]});}if(a133_0x209372[_0x2c41e1(0x1fc)](_0x3d62e6)){const _0x343ba2=a133_0x209372[_0x2c41e1(0x198)](_0x3d62e6,{'withFileTypes':!![]}),_0x4da814=new Set(_0x479087[_0x2c41e1(0x224)][_0x2c41e1(0x150)](_0x515eeb=>sanitizeForFilesystem(_0x515eeb['name'])));for(const _0x1d3421 of _0x343ba2){if(_0x1d3421['isDirectory']()&&!_0x4da814['has'](_0x1d3421['name'])){const _0x63166c=a133_0x110b88['join'](_0x3d62e6,_0x1d3421[_0x2c41e1(0x152)]);_0x300eab[_0x2c41e1(0x191)]({'path':_0x63166c,'isDir':!![]});}}}_0x2b66e8[_0x2c41e1(0x21b)][_0x2c41e1(0x191)]({'name':_0x1621bf['attributes'][_0x2c41e1(0x152)],'outputPath':_0x39adb9,'isNew':_0x5cc393,'hasChanges':_0xe8b783,'diff':_0x16e3ae}),_0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x21b)][_0x2c41e1(0x1fa)]++;if(_0x5cc393)_0x2b66e8[_0x2c41e1(0x130)]['experimentalKnowledgeBases'][_0x2c41e1(0x13a)]++;else{if(_0xe8b783)_0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x21b)][_0x2c41e1(0x167)]++;else _0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x21b)][_0x2c41e1(0x19d)]++;}}for(const _0x1b3c8e of _0x445089){if(_0x1b3c8e[_0x2c41e1(0x235)][_0x2c41e1(0x24b)])continue;const _0x2e69ae=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x4fc4b4),_0x1b3c8e[_0x2c41e1(0x235)][_0x2c41e1(0x152)]);_0x2e69ae[_0x2c41e1(0x15e)]&&this[_0x2c41e1(0x211)][_0x2c41e1(0x1f8)](_0x2c41e1(0x245)+a133_0x110b88[_0x2c41e1(0x1f9)](_0x2e69ae['oldPath'])+_0x2c41e1(0x194)+a133_0x110b88[_0x2c41e1(0x1f9)](_0x2e69ae[_0x2c41e1(0x251)]));const _0x54e56a=_0x2e69ae['path'],_0x2ac145=a133_0x110b88[_0x2c41e1(0x18c)](_0x54e56a,sanitizeForFilesystem(_0x1b3c8e[_0x2c41e1(0x235)]['name'])+'.yml'),_0x34bc05=a133_0x110b88[_0x2c41e1(0x18c)](_0x54e56a,_0x2c41e1(0x207)),_0x27fa71=a133_0x110b88['join'](_0x54e56a,_0x2c41e1(0x1ec)),_0x5d3d21=apiExperimentalArtifactToYaml(_0x1b3c8e),_0x31e3cc=toExperimentalArtifactYamlString(_0x5d3d21),_0x5e8463=!a133_0x209372[_0x2c41e1(0x1fc)](_0x54e56a);let _0x55911e=_0x5e8463,_0x29a7f1,_0xb79459=_0x31e3cc+(_0x2c41e1(0x169)+_0x5d3d21[_0x2c41e1(0x215)]+'\x0a');const _0x35e378=[..._0x5d3d21[_0x2c41e1(0x1ec)]]['sort']((_0x257c81,_0x5616ca)=>_0x257c81[_0x2c41e1(0x172)][_0x2c41e1(0x22c)](_0x5616ca['file_name']));for(const _0x2b53d5 of _0x35e378){_0xb79459+=_0x2c41e1(0x222)+_0x2b53d5[_0x2c41e1(0x172)]+'\x20---\x0a'+_0x2b53d5[_0x2c41e1(0x165)]+'\x0a';}if(!_0x5e8463){let _0x497d15='';a133_0x209372[_0x2c41e1(0x1fc)](_0x2ac145)&&(_0x497d15=a133_0x209372[_0x2c41e1(0x231)](_0x2ac145,_0x2c41e1(0x148)));a133_0x209372['existsSync'](_0x34bc05)&&(_0x497d15+='\x0a---\x20code\x20---\x0a'+a133_0x209372[_0x2c41e1(0x231)](_0x34bc05,'utf-8')+'\x0a');if(a133_0x209372[_0x2c41e1(0x1fc)](_0x27fa71)){const _0x511ab8=a133_0x209372[_0x2c41e1(0x198)](_0x27fa71),_0x22f8d3=_0x511ab8[_0x2c41e1(0x218)](_0x5ce871=>{const _0x4ec5b0=_0x2c41e1,_0x598ba2=a133_0x110b88['join'](_0x27fa71,_0x5ce871);return a133_0x209372[_0x4ec5b0(0x1ca)](_0x598ba2)[_0x4ec5b0(0x21e)]();})[_0x2c41e1(0x13b)]((_0x37476c,_0x536bf5)=>_0x37476c[_0x2c41e1(0x22c)](_0x536bf5));for(const _0x340307 of _0x22f8d3){const _0x195a3c=a133_0x110b88[_0x2c41e1(0x18c)](_0x27fa71,_0x340307);_0x497d15+=_0x2c41e1(0x222)+_0x340307+'\x20---\x0a'+a133_0x209372['readFileSync'](_0x195a3c,_0x2c41e1(0x148))+'\x0a';}}const _0x152b80=generateDiff(_0x497d15,_0xb79459);_0x55911e=hasChanges(_0x152b80),_0x55911e&&(_0x29a7f1=formatDiffWithColors(_0x152b80));}_0x43e73e['push']({'path':_0x54e56a,'content':'','isDir':!![]}),_0x43e73e[_0x2c41e1(0x191)]({'path':_0x2ac145,'content':_0x31e3cc}),_0x43e73e['push']({'path':_0x34bc05,'content':_0x5d3d21[_0x2c41e1(0x215)]});if(_0x5d3d21[_0x2c41e1(0x1ec)][_0x2c41e1(0x22a)]>0x0){_0x43e73e['push']({'path':_0x27fa71,'content':'','isDir':!![]});for(const _0x42ad51 of _0x5d3d21[_0x2c41e1(0x1ec)]){const _0x3b5e98=a133_0x110b88[_0x2c41e1(0x18c)](_0x27fa71,_0x42ad51[_0x2c41e1(0x172)]);_0x43e73e[_0x2c41e1(0x191)]({'path':_0x3b5e98,'content':_0x42ad51[_0x2c41e1(0x165)]});}}if(a133_0x209372[_0x2c41e1(0x1fc)](_0x27fa71)){const _0x4c2ecf=a133_0x209372[_0x2c41e1(0x198)](_0x27fa71),_0x1e2814=new Set(_0x5d3d21['files']['map'](_0x43cc05=>_0x43cc05[_0x2c41e1(0x172)]));for(const _0x28ea51 of _0x4c2ecf){const _0x4d42e8=a133_0x110b88[_0x2c41e1(0x18c)](_0x27fa71,_0x28ea51);a133_0x209372[_0x2c41e1(0x1ca)](_0x4d42e8)[_0x2c41e1(0x21e)]()&&!_0x1e2814['has'](_0x28ea51)&&_0x300eab['push']({'path':_0x4d42e8});}}_0x2b66e8[_0x2c41e1(0x1c0)][_0x2c41e1(0x191)]({'name':_0x1b3c8e[_0x2c41e1(0x235)][_0x2c41e1(0x152)],'outputPath':_0x54e56a,'isNew':_0x5e8463,'hasChanges':_0x55911e,'diff':_0x29a7f1}),_0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x1c0)][_0x2c41e1(0x1fa)]++;if(_0x5e8463)_0x2b66e8['counts']['experimentalArtifacts']['new']++;else{if(_0x55911e)_0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x1c0)][_0x2c41e1(0x167)]++;else _0x2b66e8['counts'][_0x2c41e1(0x1c0)][_0x2c41e1(0x19d)]++;}}for(const _0x56126e of _0x3ca9f8){const _0x5042b5=getSanitizedPathWithMigration(getFormInterfacesDir(_0x4fc4b4),_0x56126e['attributes'][_0x2c41e1(0x152)],_0x2c41e1(0x1dc));_0x5042b5['renamed']&&this['logger']['info'](_0x2c41e1(0x1e4)+a133_0x110b88[_0x2c41e1(0x1f9)](_0x5042b5[_0x2c41e1(0x19e)])+_0x2c41e1(0x194)+a133_0x110b88[_0x2c41e1(0x1f9)](_0x5042b5[_0x2c41e1(0x251)]));const _0x128850=_0x5042b5['path'],_0x5d4c5f=await apiFormInterfaceToYaml(_0x56126e,_0x554e9e),_0x10f47c=toFormInterfaceYamlString(_0x5d4c5f),_0x5071c6=!a133_0x209372[_0x2c41e1(0x1fc)](_0x128850);let _0x3b7224=_0x5071c6,_0x12af1b;if(!_0x5071c6){const _0x570411=a133_0x209372[_0x2c41e1(0x231)](_0x128850,_0x2c41e1(0x148)),_0x5d17e3=generateDiff(_0x570411,_0x10f47c);_0x3b7224=hasChanges(_0x5d17e3),_0x3b7224&&(_0x12af1b=formatDiffWithColors(_0x5d17e3));}_0x43e73e[_0x2c41e1(0x191)]({'path':_0x128850,'content':_0x10f47c}),_0x2b66e8[_0x2c41e1(0x19f)][_0x2c41e1(0x191)]({'name':_0x56126e[_0x2c41e1(0x235)][_0x2c41e1(0x152)],'outputPath':_0x128850,'isNew':_0x5071c6,'hasChanges':_0x3b7224,'diff':_0x12af1b}),_0x2b66e8['counts'][_0x2c41e1(0x19f)][_0x2c41e1(0x1fa)]++;if(_0x5071c6)_0x2b66e8[_0x2c41e1(0x130)]['formInterfaces'][_0x2c41e1(0x13a)]++;else{if(_0x3b7224)_0x2b66e8[_0x2c41e1(0x130)]['formInterfaces']['updated']++;else _0x2b66e8['counts'][_0x2c41e1(0x19f)][_0x2c41e1(0x19d)]++;}}for(const _0x404ecb of _0x3fc381){if(_0x404ecb[_0x2c41e1(0x235)][_0x2c41e1(0x24b)])continue;const _0x3c63d4=getSanitizedPathWithMigration(getChatInterfacesDir(_0x4fc4b4),_0x404ecb[_0x2c41e1(0x235)][_0x2c41e1(0x152)],_0x2c41e1(0x1dc));_0x3c63d4[_0x2c41e1(0x15e)]&&this[_0x2c41e1(0x211)][_0x2c41e1(0x1f8)]('Renamed\x20chat\x20interface\x20file:\x20'+a133_0x110b88[_0x2c41e1(0x1f9)](_0x3c63d4['oldPath'])+_0x2c41e1(0x194)+a133_0x110b88[_0x2c41e1(0x1f9)](_0x3c63d4['path']));const _0x4eaefe=_0x3c63d4[_0x2c41e1(0x251)],_0x3866c8=await apiChatInterfaceToYaml(_0x404ecb,_0x554e9e),_0x577ffa=toChatInterfaceYamlString(_0x3866c8),_0x3795f=!a133_0x209372[_0x2c41e1(0x1fc)](_0x4eaefe);let _0x23126a=_0x3795f,_0x371232;if(!_0x3795f){const _0x4b9302=a133_0x209372[_0x2c41e1(0x231)](_0x4eaefe,'utf-8'),_0x499884=generateDiff(_0x4b9302,_0x577ffa);_0x23126a=hasChanges(_0x499884),_0x23126a&&(_0x371232=formatDiffWithColors(_0x499884));}_0x43e73e[_0x2c41e1(0x191)]({'path':_0x4eaefe,'content':_0x577ffa}),_0x2b66e8[_0x2c41e1(0x16d)][_0x2c41e1(0x191)]({'name':_0x404ecb[_0x2c41e1(0x235)]['name'],'outputPath':_0x4eaefe,'isNew':_0x3795f,'hasChanges':_0x23126a,'diff':_0x371232}),_0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x16d)][_0x2c41e1(0x1fa)]++;if(_0x3795f)_0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x16d)][_0x2c41e1(0x13a)]++;else{if(_0x23126a)_0x2b66e8['counts']['chatInterfaces'][_0x2c41e1(0x167)]++;else _0x2b66e8[_0x2c41e1(0x130)][_0x2c41e1(0x16d)][_0x2c41e1(0x19d)]++;}}if(_0x5791aa?.[_0x2c41e1(0x1c4)])return _0x2b66e8;a133_0x209372[_0x2c41e1(0x171)](_0x4fc4b4,{'recursive':!![]}),a133_0x209372['mkdirSync'](getKnowledgeBasesDir(_0x4fc4b4),{'recursive':!![]}),a133_0x209372[_0x2c41e1(0x171)](getPromptsDir(_0x4fc4b4),{'recursive':!![]}),a133_0x209372[_0x2c41e1(0x171)](getIntegrationsDir(_0x4fc4b4),{'recursive':!![]}),a133_0x209372[_0x2c41e1(0x171)](getExperimentalKnowledgeBasesDir(_0x4fc4b4),{'recursive':!![]}),a133_0x209372['mkdirSync'](getExperimentalArtifactsDir(_0x4fc4b4),{'recursive':!![]}),a133_0x209372['mkdirSync'](getFormInterfacesDir(_0x4fc4b4),{'recursive':!![]}),a133_0x209372['mkdirSync'](getChatInterfacesDir(_0x4fc4b4),{'recursive':!![]});const _0xcc4306=a133_0x110b88[_0x2c41e1(0x18c)](_0x4fc4b4,_0x2c41e1(0x209));a133_0x209372[_0x2c41e1(0x1ba)](_0xcc4306,createAgentConfigContent(_0xad2c3c));for(const _0xcf6f37 of _0x43e73e){if(_0xcf6f37[_0x2c41e1(0x153)])a133_0x209372[_0x2c41e1(0x171)](_0xcf6f37[_0x2c41e1(0x251)],{'recursive':!![]});else{const _0x39bece=a133_0x110b88[_0x2c41e1(0x1d2)](_0xcf6f37['path']);!a133_0x209372[_0x2c41e1(0x1fc)](_0x39bece)&&a133_0x209372['mkdirSync'](_0x39bece,{'recursive':!![]}),a133_0x209372[_0x2c41e1(0x1ba)](_0xcf6f37['path'],_0xcf6f37[_0x2c41e1(0x1e6)]);}}for(const _0x531092 of _0x300eab){_0x531092[_0x2c41e1(0x153)]?(a133_0x209372['rmSync'](_0x531092[_0x2c41e1(0x251)],{'recursive':!![],'force':!![]}),this[_0x2c41e1(0x211)][_0x2c41e1(0x1f8)]('Removed\x20deleted\x20directory:\x20'+a133_0x110b88[_0x2c41e1(0x1f9)](a133_0x110b88[_0x2c41e1(0x1d2)](_0x531092[_0x2c41e1(0x251)]))+'/'+a133_0x110b88[_0x2c41e1(0x1f9)](_0x531092['path']))):(a133_0x209372[_0x2c41e1(0x239)](_0x531092[_0x2c41e1(0x251)],{'force':!![]}),this[_0x2c41e1(0x211)][_0x2c41e1(0x1f8)](_0x2c41e1(0x18a)+a133_0x110b88[_0x2c41e1(0x1f9)](a133_0x110b88[_0x2c41e1(0x1d2)](_0x531092[_0x2c41e1(0x251)]))+'/'+a133_0x110b88['basename'](_0x531092[_0x2c41e1(0x251)])));}return _0x2b66e8;}async[a133_0x352433(0x1bc)](_0x1ea540,_0x4fc1c1){const _0x2f824e=a133_0x352433,_0x1b8dae=a133_0x110b88[_0x2f824e(0x18c)](_0x1ea540,_0x2f824e(0x209));if(!a133_0x209372[_0x2f824e(0x1fc)](_0x1b8dae))throw new SDKError(ErrorCode[_0x2f824e(0x1d9)],'No\x20tdx.json\x20found\x20in\x20'+_0x1ea540,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x550962=loadAgentConfig(_0x1b8dae),_0x41ca50=await this[_0x2f824e(0x20b)](_0x550962[_0x2f824e(0x1d3)]),_0xb6a617=await this['client']['getProject'](_0x41ca50),_0x57d546=_0xb6a617[_0x2f824e(0x235)][_0x2f824e(0x152)],_0x511c9a={'projectName':_0x57d546,'projectId':_0x41ca50,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'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},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x1139d7=[],_0x47ae0a=[],_0x520a5a=[],_0x204f14=[],_0x378c5=[],_0x1801ff=[],_0x2349c0=a133_0x209372['readdirSync'](_0x1ea540,{'withFileTypes':!![]});for(const _0x25831d of _0x2349c0){if(!_0x25831d[_0x2f824e(0x1ed)]())continue;if([_0x2f824e(0x241),_0x2f824e(0x206),_0x2f824e(0x21d),_0x2f824e(0x19c),_0x2f824e(0x22f),_0x2f824e(0x142),_0x2f824e(0x134)][_0x2f824e(0x1f0)](_0x25831d[_0x2f824e(0x152)]))continue;const _0x13fec9=a133_0x110b88['join'](_0x1ea540,_0x25831d[_0x2f824e(0x152)]);if(isAgentDir(_0x13fec9)){const _0x5e1370=a133_0x110b88[_0x2f824e(0x18c)](_0x13fec9,'agent.yml'),_0x31130f=a133_0x110b88[_0x2f824e(0x18c)](_0x13fec9,_0x2f824e(0x1a7)),_0x134b95=a133_0x110b88['join'](_0x13fec9,_0x2f824e(0x184)),_0x4290bb=parseAgentYaml(a133_0x209372[_0x2f824e(0x231)](_0x5e1370,_0x2f824e(0x148)),_0x5e1370),_0x373e63=a133_0x209372[_0x2f824e(0x1fc)](_0x31130f)?a133_0x209372['readFileSync'](_0x31130f,'utf-8'):'',_0x132df3=a133_0x209372[_0x2f824e(0x1fc)](_0x134b95)?a133_0x209372['readFileSync'](_0x134b95,_0x2f824e(0x148)):_0x4290bb[_0x2f824e(0x1a6)];_0x1139d7[_0x2f824e(0x191)]({'name':_0x4290bb['name'],'dir':_0x13fec9,'yaml':_0x4290bb,'systemPrompt':_0x373e63,'starterMessage':_0x132df3});}}const _0x1ec91d=getKnowledgeBasesDir(_0x1ea540);if(a133_0x209372['existsSync'](_0x1ec91d)){const _0x6907b=a133_0x209372[_0x2f824e(0x198)](_0x1ec91d);for(const _0x86c379 of _0x6907b){const _0x342279=a133_0x110b88['join'](_0x1ec91d,_0x86c379);if(_0x86c379[_0x2f824e(0x1b4)](_0x2f824e(0x1dc))){const _0x3beb76=parseKnowledgeBaseYaml(a133_0x209372[_0x2f824e(0x231)](_0x342279,_0x2f824e(0x148)),_0x342279);_0x47ae0a['push']({'name':_0x3beb76[_0x2f824e(0x152)],'path':_0x342279,'yaml':_0x3beb76});}else{if(_0x86c379[_0x2f824e(0x1b4)]('.md')){const _0x45e962=a133_0x209372[_0x2f824e(0x231)](_0x342279,_0x2f824e(0x148)),{name:_0x44eeed,text:_0x36f46e}=parseTextKnowledgeBaseMd(_0x45e962,_0x86c379);_0x520a5a[_0x2f824e(0x191)]({'name':_0x44eeed,'path':_0x342279,'text':_0x36f46e});}}}}const _0x2f346b=getPromptsDir(_0x1ea540);if(a133_0x209372[_0x2f824e(0x1fc)](_0x2f346b)){const _0xb08ee1=a133_0x209372[_0x2f824e(0x198)](_0x2f346b)[_0x2f824e(0x218)](_0x3a570c=>_0x3a570c[_0x2f824e(0x1b4)]('.yml'));for(const _0x26ca7c of _0xb08ee1){const _0x42b91=a133_0x110b88[_0x2f824e(0x18c)](_0x2f346b,_0x26ca7c),_0x2541a4=parsePromptYaml(a133_0x209372['readFileSync'](_0x42b91,'utf-8'),_0x42b91);_0x204f14[_0x2f824e(0x191)]({'name':_0x2541a4['name'],'path':_0x42b91,'yaml':_0x2541a4});}}const _0x7f5ff0=[],_0x242b11=getIntegrationsDir(_0x1ea540);if(a133_0x209372[_0x2f824e(0x1fc)](_0x242b11)){const _0x4f641b=a133_0x209372[_0x2f824e(0x198)](_0x242b11)['filter'](_0x5999cf=>_0x5999cf['endsWith'](_0x2f824e(0x1dc)));for(const _0x4d71f8 of _0x4f641b){const _0x310477=a133_0x110b88[_0x2f824e(0x18c)](_0x242b11,_0x4d71f8),_0x2cbe4e=parseIntegrationYaml(a133_0x209372['readFileSync'](_0x310477,_0x2f824e(0x148)),_0x310477);if(!SAFE_INTEGRATION_TYPES[_0x2f824e(0x1f0)](_0x2cbe4e[_0x2f824e(0x249)][_0x2f824e(0x23c)]())){this[_0x2f824e(0x211)]['warn'](_0x2f824e(0x177)+_0x2cbe4e[_0x2f824e(0x152)]+_0x2f824e(0x163)+_0x2cbe4e['service_type']+_0x2f824e(0x14d)+(_0x2f824e(0x132)+SAFE_INTEGRATION_TYPES[_0x2f824e(0x18c)](',\x20')+_0x2f824e(0x1bd))+'Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.');continue;}_0x7f5ff0[_0x2f824e(0x191)]({'name':_0x2cbe4e[_0x2f824e(0x152)],'path':_0x310477,'yaml':_0x2cbe4e});}}const _0x185e3f=getExperimentalKnowledgeBasesDir(_0x1ea540);if(a133_0x209372[_0x2f824e(0x1fc)](_0x185e3f)){const _0x407220=a133_0x209372[_0x2f824e(0x198)](_0x185e3f,{'withFileTypes':!![]});for(const _0x29c444 of _0x407220){if(!_0x29c444[_0x2f824e(0x1ed)]())continue;const _0x12c6cd=a133_0x110b88[_0x2f824e(0x18c)](_0x185e3f,_0x29c444[_0x2f824e(0x152)]),_0x3cf58d=a133_0x110b88['join'](_0x12c6cd,_0x29c444[_0x2f824e(0x152)]+_0x2f824e(0x1dc)),_0x1e4f2c=a133_0x110b88[_0x2f824e(0x18c)](_0x12c6cd,_0x2f824e(0x224));if(!a133_0x209372['existsSync'](_0x3cf58d))continue;const _0x41a4d9=parseExperimentalKnowledgeBaseYaml(a133_0x209372[_0x2f824e(0x231)](_0x3cf58d,_0x2f824e(0x148)),_0x3cf58d),_0x2f470d=[];if(a133_0x209372[_0x2f824e(0x1fc)](_0x1e4f2c)){const _0x216e3a=a133_0x209372[_0x2f824e(0x198)](_0x1e4f2c,{'withFileTypes':!![]});for(const _0x2c86f4 of _0x216e3a){if(!_0x2c86f4[_0x2f824e(0x1ed)]())continue;const _0x772a8c=a133_0x110b88[_0x2f824e(0x18c)](_0x1e4f2c,_0x2c86f4[_0x2f824e(0x152)]),_0x329542=a133_0x110b88[_0x2f824e(0x18c)](_0x772a8c,'code.js'),_0x24f193=a133_0x110b88['join'](_0x772a8c,'json_schema.json');a133_0x209372['existsSync'](_0x329542)&&a133_0x209372['existsSync'](_0x24f193)&&_0x2f470d['push']({'name':_0x2c86f4[_0x2f824e(0x152)],'code':a133_0x209372['readFileSync'](_0x329542,_0x2f824e(0x148)),'json_schema':a133_0x209372[_0x2f824e(0x231)](_0x24f193,'utf-8')});}}const _0x52cf9d={..._0x41a4d9,'variables':_0x41a4d9[_0x2f824e(0x210)]||[],'functions':_0x2f470d};_0x378c5[_0x2f824e(0x191)]({'name':_0x41a4d9[_0x2f824e(0x152)],'dir':_0x12c6cd,'def':_0x52cf9d});}}const _0x30f5f2=getExperimentalArtifactsDir(_0x1ea540);if(a133_0x209372[_0x2f824e(0x1fc)](_0x30f5f2)){const _0x39c07c=a133_0x209372[_0x2f824e(0x198)](_0x30f5f2,{'withFileTypes':!![]});for(const _0x2d40a4 of _0x39c07c){if(!_0x2d40a4[_0x2f824e(0x1ed)]())continue;const _0x5d94b3=a133_0x110b88[_0x2f824e(0x18c)](_0x30f5f2,_0x2d40a4[_0x2f824e(0x152)]),_0x8fb306=a133_0x110b88[_0x2f824e(0x18c)](_0x5d94b3,_0x2d40a4[_0x2f824e(0x152)]+_0x2f824e(0x1dc)),_0x736ecb=a133_0x110b88[_0x2f824e(0x18c)](_0x5d94b3,_0x2f824e(0x207)),_0x4e29c3=a133_0x110b88[_0x2f824e(0x18c)](_0x5d94b3,_0x2f824e(0x1ec));if(!a133_0x209372['existsSync'](_0x8fb306)||!a133_0x209372[_0x2f824e(0x1fc)](_0x736ecb))continue;const _0xe118ec=parseExperimentalArtifactYaml(a133_0x209372[_0x2f824e(0x231)](_0x8fb306,_0x2f824e(0x148)),_0x8fb306),_0x450e5e=a133_0x209372['readFileSync'](_0x736ecb,_0x2f824e(0x148)),_0x37a1ad=[];if(a133_0x209372['existsSync'](_0x4e29c3)){const _0x304a16=a133_0x209372[_0x2f824e(0x198)](_0x4e29c3);for(const _0x3996d7 of _0x304a16){const _0x3579f5=a133_0x110b88[_0x2f824e(0x18c)](_0x4e29c3,_0x3996d7);a133_0x209372[_0x2f824e(0x1ca)](_0x3579f5)[_0x2f824e(0x21e)]()&&_0x37a1ad[_0x2f824e(0x191)]({'file_name':_0x3996d7,'text_content':a133_0x209372[_0x2f824e(0x231)](_0x3579f5,_0x2f824e(0x148))});}}const _0x1b8604={..._0xe118ec,'code':_0x450e5e,'files':_0x37a1ad};_0x1801ff[_0x2f824e(0x191)]({'name':_0xe118ec['name'],'dir':_0x5d94b3,'def':_0x1b8604});}}const _0x1f5446=[],_0x1a89f0=getFormInterfacesDir(_0x1ea540);if(a133_0x209372[_0x2f824e(0x1fc)](_0x1a89f0)){const _0xd10ee9=a133_0x209372['readdirSync'](_0x1a89f0)[_0x2f824e(0x218)](_0x6c1e4e=>_0x6c1e4e[_0x2f824e(0x1b4)](_0x2f824e(0x1dc)));for(const _0x53cf99 of _0xd10ee9){const _0x57e402=a133_0x110b88[_0x2f824e(0x18c)](_0x1a89f0,_0x53cf99),_0x1f7a44=parseFormInterfaceYaml(a133_0x209372['readFileSync'](_0x57e402,_0x2f824e(0x148)),_0x57e402);_0x1f5446['push']({'name':_0x1f7a44[_0x2f824e(0x152)],'path':_0x57e402,'yaml':_0x1f7a44});}}const _0x5100fc=[],_0x21f6a9=getChatInterfacesDir(_0x1ea540);if(a133_0x209372['existsSync'](_0x21f6a9)){const _0x1c20c7=a133_0x209372['readdirSync'](_0x21f6a9)[_0x2f824e(0x218)](_0x359fa5=>_0x359fa5[_0x2f824e(0x1b4)](_0x2f824e(0x1dc)));for(const _0x187ec8 of _0x1c20c7){const _0x3a6230=a133_0x110b88[_0x2f824e(0x18c)](_0x21f6a9,_0x187ec8),_0x25a9f5=parseChatInterfaceYaml(a133_0x209372['readFileSync'](_0x3a6230,'utf-8'),_0x3a6230);_0x5100fc['push']({'name':_0x25a9f5[_0x2f824e(0x152)],'path':_0x3a6230,'yaml':_0x25a9f5});}}const _0x14129a=await this['client'][_0x2f824e(0x188)](_0x41ca50),_0x568831=await this[_0x2f824e(0x18d)][_0x2f824e(0x1ad)](_0x41ca50),_0x39783b=await this[_0x2f824e(0x18d)][_0x2f824e(0x1e9)](_0x41ca50),_0xbaf391=await this['client']['listPrompts'](_0x41ca50),_0x39f48c=await this[_0x2f824e(0x18d)][_0x2f824e(0x16c)](_0x41ca50),_0x33b56e=await safeListOrEmpty(()=>this['client'][_0x2f824e(0x197)](_0x41ca50)),_0x109b17=await safeListOrEmpty(()=>this[_0x2f824e(0x18d)][_0x2f824e(0x214)](_0x41ca50)),_0x1d56b3=await safeListOrEmpty(()=>this['client'][_0x2f824e(0x20c)](_0x41ca50)),_0x3319be=await safeListOrEmpty(()=>this[_0x2f824e(0x18d)][_0x2f824e(0x1b9)](_0x41ca50)),_0x58b3e6=await fetchAllToolTargetMaps((_0x347e86,_0x190708)=>this['client'][_0x2f824e(0x14a)](_0x347e86,_0x190708),_0x41ca50),_0x118639=new Map(),_0x1d1824=new Map(),_0x46005a=new Map(),_0x5994dd=new Map(),_0x5387c=new Map(),_0x1e3702=new Map(),_0x58dea5=new Map();for(const _0x18bd00 of _0x14129a){_0x118639['set'](_0x18bd00[_0x2f824e(0x235)][_0x2f824e(0x152)],_0x18bd00);}for(const _0x1672bf of _0x568831){_0x1d1824[_0x2f824e(0x1db)](_0x1672bf[_0x2f824e(0x235)][_0x2f824e(0x152)],_0x1672bf);}for(const _0x590c45 of _0x39783b){_0x46005a[_0x2f824e(0x1db)](_0x590c45[_0x2f824e(0x235)][_0x2f824e(0x152)],_0x590c45);}for(const _0x4f05f3 of _0xbaf391){_0x5994dd['set'](_0x4f05f3[_0x2f824e(0x235)][_0x2f824e(0x152)],_0x4f05f3);}for(const _0x3397a4 of _0x39f48c){_0x5387c[_0x2f824e(0x1db)](_0x3397a4[_0x2f824e(0x235)][_0x2f824e(0x22b)][_0x2f824e(0x23c)](),_0x3397a4);}for(const _0x384f6b of _0x33b56e){_0x1e3702['set'](_0x384f6b['attributes'][_0x2f824e(0x152)],_0x384f6b);}for(const _0x1b9778 of _0x109b17){_0x58dea5[_0x2f824e(0x1db)](_0x1b9778[_0x2f824e(0x235)][_0x2f824e(0x152)],_0x1b9778);}const _0x1a4a64=new Map(),_0x332563=new Map();for(const _0x45b936 of _0x1d56b3){_0x1a4a64[_0x2f824e(0x1db)](_0x45b936[_0x2f824e(0x235)][_0x2f824e(0x152)],_0x45b936);}for(const _0xcdcf11 of _0x3319be){_0x332563[_0x2f824e(0x1db)](_0xcdcf11[_0x2f824e(0x235)][_0x2f824e(0x152)],_0xcdcf11);}const _0x49a021=new Map(),_0x14b6c5=new Map();for(const _0x2bec42 of _0x14129a){_0x49a021[_0x2f824e(0x1db)](_0x2bec42[_0x2f824e(0x235)][_0x2f824e(0x152)],_0x2bec42['id']),_0x14b6c5[_0x2f824e(0x1db)](_0x2bec42['id'],_0x2bec42[_0x2f824e(0x235)][_0x2f824e(0x152)]);}const _0x103abd=new Map(),_0x2ba11a=new Map();for(const _0x4f57ef of _0xbaf391){_0x103abd['set'](_0x4f57ef[_0x2f824e(0x235)]['name'],_0x4f57ef['id']),_0x2ba11a['set'](_0x4f57ef['id'],_0x4f57ef[_0x2f824e(0x235)][_0x2f824e(0x152)]);}const _0x389bdb=_0x58b3e6[_0x2f824e(0x160)][_0x2f824e(0x1e2)]||new Map(),_0x486bee=_0x58b3e6['nameToId'][_0x2f824e(0x145)]||new Map(),_0x3b1361=_0x58b3e6[_0x2f824e(0x160)]['ExperimentalKnowledgeBase']||new Map(),_0x3a1e4e=new Map(),_0x386139={'resolveToolTargetName':buildNameResolver({..._0x58b3e6[_0x2f824e(0x1d1)],'Agent':_0x14b6c5}),'resolvePromptName':async _0x4f0468=>_0x2ba11a['get'](_0x4f0468),'onWarning':_0x2d9ffe=>this[_0x2f824e(0x211)][_0x2f824e(0x246)](_0x2d9ffe)};let _0x1a96f4=[];const _0x564421={'projectId':_0x41ca50,'resolveToolTargetId':buildIdResolver({..._0x58b3e6[_0x2f824e(0x160)],'Agent':_0x49a021}),'resolvePromptId':async _0x2b4458=>_0x103abd[_0x2f824e(0x1ef)](_0x2b4458),'onWarning':_0x11dc93=>{const _0x54e6d2=_0x2f824e;this['logger']['warn'](_0x11dc93),_0x1a96f4[_0x54e6d2(0x191)](_0x11dc93);}},{resolved:_0x1fa21f,unresolved:_0x594f79}=resolveAgentDependencies(_0x1139d7,new Set(_0x118639['keys']()));for(const {agent:_0x73eedf,missingDeps:_0x44bf55}of _0x594f79){_0x511c9a[_0x2f824e(0x1c8)]['push']({'agentName':_0x73eedf[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':_0x2f824e(0x1b1),'error':_0x2f824e(0x240)+_0x44bf55['join'](',\x20')+'.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.'}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x1c8)]['errors']++;}for(const _0x1db5c9 of _0x47ae0a){const _0x37e5b1=_0x1d1824['get'](_0x1db5c9[_0x2f824e(0x156)][_0x2f824e(0x152)]),_0x5e0c19=a133_0x209372[_0x2f824e(0x231)](_0x1db5c9[_0x2f824e(0x251)],'utf-8');if(_0x37e5b1){const _0x44b841=apiKnowledgeBaseToYaml(_0x37e5b1),_0x587346=toKnowledgeBaseYamlString(_0x44b841),_0x69c4f9=generateDiff(_0x587346,_0x5e0c19),_0xe46f2=hasChanges(_0x69c4f9);_0xe46f2?(_0x511c9a['knowledgeBases'][_0x2f824e(0x191)]({'name':_0x1db5c9[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':'updated','id':_0x37e5b1['id'],'diff':formatDiffWithColors(_0x69c4f9)}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x1d8)][_0x2f824e(0x167)]++):(_0x511c9a['knowledgeBases'][_0x2f824e(0x191)]({'name':_0x1db5c9['yaml']['name'],'action':'unchanged','id':_0x37e5b1['id']}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x1d8)]['unchanged']++);}else _0x511c9a[_0x2f824e(0x1d8)][_0x2f824e(0x191)]({'name':_0x1db5c9[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':_0x2f824e(0x135)}),_0x511c9a['counts'][_0x2f824e(0x1d8)][_0x2f824e(0x135)]++;}for(const _0x4b9e5d of _0x520a5a){const _0xb4158f=_0x46005a['get'](_0x4b9e5d['name']),_0x366d01=a133_0x209372[_0x2f824e(0x231)](_0x4b9e5d[_0x2f824e(0x251)],_0x2f824e(0x148));if(_0xb4158f){const _0x5f01b9=toTextKnowledgeBaseMd(_0xb4158f[_0x2f824e(0x235)][_0x2f824e(0x152)],_0xb4158f[_0x2f824e(0x235)][_0x2f824e(0x20f)]),_0x2b5eb2=generateDiff(_0x5f01b9,_0x366d01),_0x4bd705=hasChanges(_0x2b5eb2);_0x4bd705?(_0x511c9a[_0x2f824e(0x17d)][_0x2f824e(0x191)]({'name':_0x4b9e5d['name'],'action':'updated','id':_0xb4158f['id'],'diff':formatDiffWithColors(_0x2b5eb2)}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x17d)]['updated']++):(_0x511c9a[_0x2f824e(0x17d)]['push']({'name':_0x4b9e5d[_0x2f824e(0x152)],'action':'unchanged','id':_0xb4158f['id']}),_0x511c9a['counts'][_0x2f824e(0x17d)][_0x2f824e(0x19d)]++);}else _0x511c9a[_0x2f824e(0x17d)][_0x2f824e(0x191)]({'name':_0x4b9e5d[_0x2f824e(0x152)],'action':'created'}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x17d)][_0x2f824e(0x135)]++;}for(const _0x535b4a of _0x1fa21f){const _0x145cad=_0x118639[_0x2f824e(0x1ef)](_0x535b4a[_0x2f824e(0x156)]['name']),_0x28ba90=a133_0x110b88[_0x2f824e(0x18c)](_0x535b4a[_0x2f824e(0x131)],_0x2f824e(0x23a)),_0x182e54=a133_0x209372[_0x2f824e(0x231)](_0x28ba90,_0x2f824e(0x148)),_0x25a327=_0x535b4a['systemPrompt'],_0x2a0917='#\x20prompt.md\x0a'+_0x25a327+_0x2f824e(0x15b)+_0x182e54;if(_0x145cad){const {yaml:_0x5c4617,systemPrompt:_0x4e847a}=await agentResponseToDef(_0x145cad,_0x386139),_0x442486=toAgentYamlString(_0x5c4617),_0x29233b='#\x20prompt.md\x0a'+_0x4e847a+_0x2f824e(0x15b)+_0x442486,_0xd58ae6=generateDiff(_0x29233b,_0x2a0917),_0x4d36f2=hasChanges(_0xd58ae6);_0x4d36f2?(_0x511c9a['agents'][_0x2f824e(0x191)]({'agentName':_0x535b4a['yaml'][_0x2f824e(0x152)],'action':'updated','agentId':_0x145cad['id'],'diff':formatDiffWithColors(_0xd58ae6)}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x1c8)][_0x2f824e(0x167)]++):(_0x511c9a['agents'][_0x2f824e(0x191)]({'agentName':_0x535b4a['yaml'][_0x2f824e(0x152)],'action':_0x2f824e(0x19d),'agentId':_0x145cad['id']}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x1c8)][_0x2f824e(0x19d)]++);}else _0x511c9a[_0x2f824e(0x1c8)][_0x2f824e(0x191)]({'agentName':_0x535b4a[_0x2f824e(0x156)]['name'],'action':_0x2f824e(0x135)}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x1c8)][_0x2f824e(0x135)]++;}for(const _0x324c27 of _0x204f14){const _0x487eec=_0x5994dd[_0x2f824e(0x1ef)](_0x324c27[_0x2f824e(0x156)][_0x2f824e(0x152)]),_0x37aa66=a133_0x209372['readFileSync'](_0x324c27[_0x2f824e(0x251)],_0x2f824e(0x148));if(_0x487eec){const _0x306217=await apiPromptToYaml(_0x487eec,_0x386139);if(!_0x306217){_0x511c9a['prompts'][_0x2f824e(0x191)]({'name':_0x324c27[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':_0x2f824e(0x167),'id':_0x487eec['id']}),_0x511c9a['counts'][_0x2f824e(0x206)][_0x2f824e(0x167)]++;continue;}const _0x12915d=toPromptYamlString(_0x306217),_0x17f992=generateDiff(_0x12915d,_0x37aa66),_0x390832=hasChanges(_0x17f992);_0x390832?(_0x511c9a['prompts']['push']({'name':_0x324c27[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':_0x2f824e(0x167),'id':_0x487eec['id'],'diff':formatDiffWithColors(_0x17f992)}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x206)][_0x2f824e(0x167)]++):(_0x511c9a['prompts'][_0x2f824e(0x191)]({'name':_0x324c27['yaml'][_0x2f824e(0x152)],'action':_0x2f824e(0x19d),'id':_0x487eec['id']}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x206)][_0x2f824e(0x19d)]++);}else _0x511c9a[_0x2f824e(0x206)]['push']({'name':_0x324c27[_0x2f824e(0x156)]['name'],'action':_0x2f824e(0x135)}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x206)][_0x2f824e(0x135)]++;}for(const _0x797aeb of _0x7f5ff0){const _0x4412cc=_0x5387c[_0x2f824e(0x1ef)](_0x797aeb['yaml'][_0x2f824e(0x249)]),_0xe7a301=a133_0x209372['readFileSync'](_0x797aeb[_0x2f824e(0x251)],_0x2f824e(0x148));if(_0x4412cc){const _0x665876=await apiIntegrationToYaml(_0x4412cc,_0x386139),_0x51acc9=toIntegrationYamlString(_0x665876),_0x16301b=generateDiff(_0x51acc9,_0xe7a301),_0x3ff952=hasChanges(_0x16301b);_0x3ff952?(_0x511c9a[_0x2f824e(0x21d)][_0x2f824e(0x191)]({'name':_0x797aeb['yaml'][_0x2f824e(0x249)],'action':_0x2f824e(0x167),'id':_0x4412cc['id'],'diff':formatDiffWithColors(_0x16301b)}),_0x511c9a[_0x2f824e(0x130)]['integrations'][_0x2f824e(0x167)]++):(_0x511c9a[_0x2f824e(0x21d)][_0x2f824e(0x191)]({'name':_0x797aeb[_0x2f824e(0x156)][_0x2f824e(0x249)],'action':_0x2f824e(0x19d),'id':_0x4412cc['id']}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x21d)]['unchanged']++);}else _0x511c9a[_0x2f824e(0x21d)]['push']({'name':_0x797aeb['yaml'][_0x2f824e(0x249)],'action':_0x2f824e(0x135)}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x21d)][_0x2f824e(0x135)]++;}for(const _0x1387e3 of _0x378c5){const _0x3a5dd3=_0x1e3702[_0x2f824e(0x1ef)](_0x1387e3[_0x2f824e(0x1b3)][_0x2f824e(0x152)]),_0x124154=toExperimentalKnowledgeBaseYamlString(_0x1387e3[_0x2f824e(0x1b3)]);let _0x2f1f2d=_0x124154;for(const _0x3607df of _0x1387e3[_0x2f824e(0x1b3)][_0x2f824e(0x224)]){_0x2f1f2d+='\x0a---\x20function:\x20'+_0x3607df[_0x2f824e(0x152)]+'\x20---\x0a'+_0x3607df[_0x2f824e(0x215)]+'\x0a---\x20schema:\x20'+_0x3607df[_0x2f824e(0x152)]+_0x2f824e(0x243)+_0x3607df[_0x2f824e(0x1a9)]+'\x0a';}if(_0x3a5dd3){const _0x2a3693=apiExperimentalKnowledgeBaseToYaml(_0x3a5dd3),_0x581743=toExperimentalKnowledgeBaseYamlString(_0x2a3693);let _0x1cc959=_0x581743;for(const _0x1a7f3c of _0x2a3693[_0x2f824e(0x224)]){_0x1cc959+=_0x2f824e(0x1cb)+_0x1a7f3c[_0x2f824e(0x152)]+'\x20---\x0a'+_0x1a7f3c['code']+_0x2f824e(0x1ac)+_0x1a7f3c['name']+_0x2f824e(0x243)+_0x1a7f3c[_0x2f824e(0x1a9)]+'\x0a';}const _0x1a5643=generateDiff(_0x1cc959,_0x2f1f2d),_0x528ad5=hasChanges(_0x1a5643);_0x528ad5?(_0x511c9a[_0x2f824e(0x21b)][_0x2f824e(0x191)]({'name':_0x1387e3['def'][_0x2f824e(0x152)],'action':'updated','id':_0x3a5dd3['id'],'diff':formatDiffWithColors(_0x1a5643)}),_0x511c9a[_0x2f824e(0x130)]['experimentalKnowledgeBases'][_0x2f824e(0x167)]++):(_0x511c9a[_0x2f824e(0x21b)][_0x2f824e(0x191)]({'name':_0x1387e3[_0x2f824e(0x1b3)]['name'],'action':_0x2f824e(0x19d),'id':_0x3a5dd3['id']}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x21b)][_0x2f824e(0x19d)]++);}else _0x511c9a['experimentalKnowledgeBases'][_0x2f824e(0x191)]({'name':_0x1387e3[_0x2f824e(0x1b3)][_0x2f824e(0x152)],'action':_0x2f824e(0x135)}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x21b)][_0x2f824e(0x135)]++;}for(const _0xcb1ab8 of _0x1801ff){const _0x2fb9c1=_0x58dea5[_0x2f824e(0x1ef)](_0xcb1ab8[_0x2f824e(0x1b3)][_0x2f824e(0x152)]),_0x345a0a=toExperimentalArtifactYamlString(_0xcb1ab8[_0x2f824e(0x1b3)]);let _0x5df829=_0x345a0a+(_0x2f824e(0x169)+_0xcb1ab8[_0x2f824e(0x1b3)]['code']+'\x0a');for(const _0x10c15f of _0xcb1ab8[_0x2f824e(0x1b3)]['files']){_0x5df829+=_0x2f824e(0x222)+_0x10c15f[_0x2f824e(0x172)]+_0x2f824e(0x243)+_0x10c15f[_0x2f824e(0x165)]+'\x0a';}if(_0x2fb9c1){const _0x46502b=apiExperimentalArtifactToYaml(_0x2fb9c1),_0x40df43=toExperimentalArtifactYamlString(_0x46502b);let _0x1509e3=_0x40df43+('\x0a---\x20code\x20---\x0a'+_0x46502b[_0x2f824e(0x215)]+'\x0a');for(const _0x8ab4b4 of _0x46502b[_0x2f824e(0x1ec)]){_0x1509e3+='---\x20file:\x20'+_0x8ab4b4['file_name']+'\x20---\x0a'+_0x8ab4b4[_0x2f824e(0x165)]+'\x0a';}const _0x51edf3=generateDiff(_0x1509e3,_0x5df829),_0x594a11=hasChanges(_0x51edf3);_0x594a11?(_0x511c9a[_0x2f824e(0x1c0)][_0x2f824e(0x191)]({'name':_0xcb1ab8[_0x2f824e(0x1b3)][_0x2f824e(0x152)],'action':_0x2f824e(0x167),'id':_0x2fb9c1['id'],'diff':formatDiffWithColors(_0x51edf3)}),_0x511c9a['counts'][_0x2f824e(0x1c0)][_0x2f824e(0x167)]++):(_0x511c9a[_0x2f824e(0x1c0)][_0x2f824e(0x191)]({'name':_0xcb1ab8['def'][_0x2f824e(0x152)],'action':_0x2f824e(0x19d),'id':_0x2fb9c1['id']}),_0x511c9a['counts'][_0x2f824e(0x1c0)][_0x2f824e(0x19d)]++);}else _0x511c9a['experimentalArtifacts']['push']({'name':_0xcb1ab8[_0x2f824e(0x1b3)]['name'],'action':'created'}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x1c0)][_0x2f824e(0x135)]++;}for(const _0x19267f of _0x1f5446){const _0x10aefe=_0x1a4a64['get'](_0x19267f[_0x2f824e(0x156)]['name']),_0x3fa1c3=a133_0x209372[_0x2f824e(0x231)](_0x19267f[_0x2f824e(0x251)],'utf-8');if(_0x10aefe){const _0x2762b7=await apiFormInterfaceToYaml(_0x10aefe,_0x386139),_0x35911a=toFormInterfaceYamlString(_0x2762b7),_0x161f62=generateDiff(_0x35911a,_0x3fa1c3),_0x51e928=hasChanges(_0x161f62);_0x51e928?(_0x511c9a['formInterfaces']['push']({'name':_0x19267f['yaml'][_0x2f824e(0x152)],'action':_0x2f824e(0x167),'id':_0x10aefe['id'],'diff':formatDiffWithColors(_0x161f62)}),_0x511c9a['counts']['formInterfaces'][_0x2f824e(0x167)]++):(_0x511c9a[_0x2f824e(0x19f)][_0x2f824e(0x191)]({'name':_0x19267f[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':_0x2f824e(0x19d),'id':_0x10aefe['id']}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x19f)][_0x2f824e(0x19d)]++);}else _0x511c9a[_0x2f824e(0x19f)][_0x2f824e(0x191)]({'name':_0x19267f[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':_0x2f824e(0x135)}),_0x511c9a[_0x2f824e(0x130)]['formInterfaces'][_0x2f824e(0x135)]++;}for(const _0x1fdc08 of _0x5100fc){const _0x138961=_0x332563[_0x2f824e(0x1ef)](_0x1fdc08[_0x2f824e(0x156)]['name']),_0x3527ff=a133_0x209372[_0x2f824e(0x231)](_0x1fdc08[_0x2f824e(0x251)],_0x2f824e(0x148));if(_0x138961){const _0xa42fac=await apiChatInterfaceToYaml(_0x138961,_0x386139),_0x125d3e=toChatInterfaceYamlString(_0xa42fac),_0x1a14e0=generateDiff(_0x125d3e,_0x3527ff),_0x188dc1=hasChanges(_0x1a14e0);_0x188dc1?(_0x511c9a['chatInterfaces'][_0x2f824e(0x191)]({'name':_0x1fdc08[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':_0x2f824e(0x167),'id':_0x138961['id'],'diff':formatDiffWithColors(_0x1a14e0)}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x16d)][_0x2f824e(0x167)]++):(_0x511c9a[_0x2f824e(0x16d)]['push']({'name':_0x1fdc08[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':_0x2f824e(0x19d),'id':_0x138961['id']}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x16d)][_0x2f824e(0x19d)]++);}else _0x511c9a[_0x2f824e(0x16d)]['push']({'name':_0x1fdc08[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':'created'}),_0x511c9a[_0x2f824e(0x130)]['chatInterfaces'][_0x2f824e(0x135)]++;}if(_0x4fc1c1?.[_0x2f824e(0x1c4)])return _0x511c9a;_0x511c9a['knowledgeBases']=[],_0x511c9a[_0x2f824e(0x17d)]=[],_0x511c9a[_0x2f824e(0x206)]=[],_0x511c9a[_0x2f824e(0x21d)]=[],_0x511c9a[_0x2f824e(0x21b)]=[],_0x511c9a['experimentalArtifacts']=[],_0x511c9a[_0x2f824e(0x19f)]=[],_0x511c9a[_0x2f824e(0x16d)]=[];const _0x2fd514=_0x511c9a[_0x2f824e(0x1c8)][_0x2f824e(0x218)](_0x432458=>_0x432458[_0x2f824e(0x16a)]===_0x2f824e(0x1b1));_0x511c9a['agents']=_0x2fd514,_0x511c9a['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x2fd514['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},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x317950 of _0x47ae0a){try{const _0x20d369=_0x1d1824[_0x2f824e(0x1ef)](_0x317950[_0x2f824e(0x156)]['name']),_0x1859c5=yamlKnowledgeBaseToApi(_0x317950['yaml'],_0x41ca50);if(_0x20d369)await this[_0x2f824e(0x18d)][_0x2f824e(0x1f2)](_0x20d369['id'],_0x1859c5),_0x389bdb[_0x2f824e(0x1db)](_0x317950[_0x2f824e(0x156)][_0x2f824e(0x152)],_0x20d369['id']),_0x511c9a[_0x2f824e(0x1d8)]['push']({'name':_0x317950[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':_0x2f824e(0x167),'id':_0x20d369['id']}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x1d8)][_0x2f824e(0x167)]++;else{const _0x5c56a7=await this[_0x2f824e(0x18d)]['createKnowledgeBase'](_0x1859c5);_0x389bdb[_0x2f824e(0x1db)](_0x317950[_0x2f824e(0x156)][_0x2f824e(0x152)],_0x5c56a7['id']),_0x511c9a[_0x2f824e(0x1d8)][_0x2f824e(0x191)]({'name':_0x317950['yaml'][_0x2f824e(0x152)],'action':_0x2f824e(0x135),'id':_0x5c56a7['id']}),_0x511c9a[_0x2f824e(0x130)]['knowledgeBases'][_0x2f824e(0x135)]++;}}catch(_0x2f81f5){_0x511c9a[_0x2f824e(0x1d8)]['push']({'name':_0x317950[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':_0x2f824e(0x1b1),'error':_0x2f81f5[_0x2f824e(0x182)]}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x1d8)][_0x2f824e(0x181)]++;}}for(const _0x3bddb1 of _0x520a5a){try{const _0x582d15=_0x46005a[_0x2f824e(0x1ef)](_0x3bddb1[_0x2f824e(0x152)]),_0x57f458=yamlTextKnowledgeBaseToApi({'name':_0x3bddb1['name'],'text':_0x3bddb1[_0x2f824e(0x20f)]},_0x41ca50);if(_0x582d15)await this['client'][_0x2f824e(0x1aa)](_0x582d15['id'],_0x57f458),_0x486bee[_0x2f824e(0x1db)](_0x3bddb1[_0x2f824e(0x152)],_0x582d15['id']),_0x511c9a[_0x2f824e(0x17d)]['push']({'name':_0x3bddb1[_0x2f824e(0x152)],'action':'updated','id':_0x582d15['id']}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x17d)][_0x2f824e(0x167)]++;else{const _0x2ec116=await this[_0x2f824e(0x18d)][_0x2f824e(0x233)](_0x57f458);_0x486bee[_0x2f824e(0x1db)](_0x3bddb1['name'],_0x2ec116['id']),_0x511c9a[_0x2f824e(0x17d)][_0x2f824e(0x191)]({'name':_0x3bddb1['name'],'action':_0x2f824e(0x135),'id':_0x2ec116['id']}),_0x511c9a['counts'][_0x2f824e(0x17d)][_0x2f824e(0x135)]++;}}catch(_0x4e1dda){_0x511c9a[_0x2f824e(0x17d)][_0x2f824e(0x191)]({'name':_0x3bddb1[_0x2f824e(0x152)],'action':_0x2f824e(0x1b1),'error':_0x4e1dda[_0x2f824e(0x182)]}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x17d)]['errors']++;}}for(const _0x1b67b7 of _0x378c5){try{const _0x29358a=_0x1e3702[_0x2f824e(0x1ef)](_0x1b67b7[_0x2f824e(0x1b3)][_0x2f824e(0x152)]),_0x19d57b=yamlExperimentalKnowledgeBaseToApi(_0x1b67b7[_0x2f824e(0x1b3)],_0x41ca50);if(_0x29358a)await this[_0x2f824e(0x18d)]['updateExperimentalKnowledgeBase'](_0x29358a['id'],_0x19d57b),_0x3b1361['set'](_0x1b67b7['def'][_0x2f824e(0x152)],_0x29358a['id']),_0x511c9a[_0x2f824e(0x21b)][_0x2f824e(0x191)]({'name':_0x1b67b7[_0x2f824e(0x1b3)]['name'],'action':'updated','id':_0x29358a['id']}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x21b)][_0x2f824e(0x167)]++;else{const _0xcf34c5=await this[_0x2f824e(0x18d)][_0x2f824e(0x175)](_0x19d57b);_0x3b1361['set'](_0x1b67b7[_0x2f824e(0x1b3)][_0x2f824e(0x152)],_0xcf34c5['id']),_0x511c9a['experimentalKnowledgeBases'][_0x2f824e(0x191)]({'name':_0x1b67b7[_0x2f824e(0x1b3)][_0x2f824e(0x152)],'action':_0x2f824e(0x135),'id':_0xcf34c5['id']}),_0x511c9a['counts'][_0x2f824e(0x21b)][_0x2f824e(0x135)]++;}}catch(_0x3a2477){_0x511c9a[_0x2f824e(0x21b)]['push']({'name':_0x1b67b7[_0x2f824e(0x1b3)]['name'],'action':'error','error':_0x3a2477['message']}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x21b)][_0x2f824e(0x181)]++;}}for(const _0x4861ce of _0x1801ff){try{const _0x4aca03=_0x58dea5[_0x2f824e(0x1ef)](_0x4861ce[_0x2f824e(0x1b3)][_0x2f824e(0x152)]),_0x5cbb66=yamlExperimentalArtifactToApi(_0x4861ce[_0x2f824e(0x1b3)],_0x41ca50);if(_0x4aca03)await this[_0x2f824e(0x18d)][_0x2f824e(0x1ff)](_0x4aca03['id'],_0x5cbb66),_0x3a1e4e['set'](_0x4861ce[_0x2f824e(0x1b3)][_0x2f824e(0x152)],_0x4aca03['id']),_0x511c9a['experimentalArtifacts']['push']({'name':_0x4861ce[_0x2f824e(0x1b3)]['name'],'action':_0x2f824e(0x167),'id':_0x4aca03['id']}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x1c0)][_0x2f824e(0x167)]++;else{const _0x4d7d14=await this['client'][_0x2f824e(0x24d)](_0x5cbb66);_0x3a1e4e[_0x2f824e(0x1db)](_0x4861ce[_0x2f824e(0x1b3)]['name'],_0x4d7d14['id']),_0x511c9a['experimentalArtifacts']['push']({'name':_0x4861ce['def'][_0x2f824e(0x152)],'action':_0x2f824e(0x135),'id':_0x4d7d14['id']}),_0x511c9a['counts'][_0x2f824e(0x1c0)][_0x2f824e(0x135)]++;}}catch(_0x2e68a7){_0x511c9a['experimentalArtifacts'][_0x2f824e(0x191)]({'name':_0x4861ce[_0x2f824e(0x1b3)][_0x2f824e(0x152)],'action':_0x2f824e(0x1b1),'error':_0x2e68a7[_0x2f824e(0x182)]}),_0x511c9a['counts']['experimentalArtifacts'][_0x2f824e(0x181)]++;}}for(const _0x2138e6 of _0x1fa21f){_0x1a96f4=[];try{const _0x11bc54=_0x118639[_0x2f824e(0x1ef)](_0x2138e6[_0x2f824e(0x156)]['name']),_0x51e434=await agentDefToRequest(_0x2138e6['yaml'],_0x2138e6['systemPrompt'],_0x2138e6[_0x2f824e(0x140)],_0x564421);if(_0x11bc54)await this[_0x2f824e(0x18d)]['updateAgentResponse'](_0x11bc54['id'],_0x51e434),_0x49a021['set'](_0x2138e6[_0x2f824e(0x156)]['name'],_0x11bc54['id']),_0x511c9a['agents'][_0x2f824e(0x191)]({'agentName':_0x2138e6['yaml']['name'],'action':_0x2f824e(0x167),'agentId':_0x11bc54['id'],'warnings':_0x1a96f4[_0x2f824e(0x22a)]>0x0?_0x1a96f4:undefined}),_0x511c9a[_0x2f824e(0x130)]['agents'][_0x2f824e(0x167)]++;else{const _0x482f64=await this['client'][_0x2f824e(0x1fb)](_0x51e434);_0x49a021[_0x2f824e(0x1db)](_0x2138e6['yaml'][_0x2f824e(0x152)],_0x482f64['id']),_0x511c9a['agents'][_0x2f824e(0x191)]({'agentName':_0x2138e6[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':'created','agentId':_0x482f64['id'],'warnings':_0x1a96f4['length']>0x0?_0x1a96f4:undefined}),_0x511c9a['counts'][_0x2f824e(0x1c8)][_0x2f824e(0x135)]++;}}catch(_0x371b3e){_0x511c9a[_0x2f824e(0x1c8)][_0x2f824e(0x191)]({'agentName':_0x2138e6[_0x2f824e(0x156)]['name'],'action':_0x2f824e(0x1b1),'error':_0x371b3e[_0x2f824e(0x182)],'warnings':_0x1a96f4[_0x2f824e(0x22a)]>0x0?_0x1a96f4:undefined}),_0x511c9a['counts'][_0x2f824e(0x1c8)][_0x2f824e(0x181)]++;}}for(const _0x167512 of _0x204f14){try{const _0x201c40=_0x5994dd[_0x2f824e(0x1ef)](_0x167512[_0x2f824e(0x156)]['name']),_0x18f9da=await yamlPromptToApi(_0x167512[_0x2f824e(0x156)],_0x41ca50,_0x564421);if(!_0x18f9da){_0x511c9a[_0x2f824e(0x206)][_0x2f824e(0x191)]({'name':_0x167512[_0x2f824e(0x156)]['name'],'action':_0x2f824e(0x1b1),'error':_0x2f824e(0x23f)}),_0x511c9a['counts']['prompts'][_0x2f824e(0x181)]++;continue;}if(_0x201c40)await this[_0x2f824e(0x18d)]['updatePrompt'](_0x201c40['id'],_0x18f9da),_0x103abd[_0x2f824e(0x1db)](_0x167512[_0x2f824e(0x156)][_0x2f824e(0x152)],_0x201c40['id']),_0x511c9a[_0x2f824e(0x206)]['push']({'name':_0x167512[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':'updated','id':_0x201c40['id']}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x206)][_0x2f824e(0x167)]++;else{const _0x50829f=await this[_0x2f824e(0x18d)][_0x2f824e(0x216)](_0x18f9da);_0x103abd[_0x2f824e(0x1db)](_0x167512[_0x2f824e(0x156)]['name'],_0x50829f['id']),_0x511c9a[_0x2f824e(0x206)][_0x2f824e(0x191)]({'name':_0x167512[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':_0x2f824e(0x135),'id':_0x50829f['id']}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x206)][_0x2f824e(0x135)]++;}}catch(_0x220c5b){_0x511c9a[_0x2f824e(0x206)][_0x2f824e(0x191)]({'name':_0x167512['yaml'][_0x2f824e(0x152)],'action':_0x2f824e(0x1b1),'error':_0x220c5b[_0x2f824e(0x182)]}),_0x511c9a['counts']['prompts']['errors']++;}}for(const _0x381801 of _0x7f5ff0){try{const _0x14f41e=_0x5387c[_0x2f824e(0x1ef)](_0x381801[_0x2f824e(0x156)]['service_type']),_0x31201f=await yamlIntegrationToApi(_0x381801[_0x2f824e(0x156)],_0x41ca50,_0x564421);if(_0x14f41e){await this[_0x2f824e(0x18d)]['deleteIntegration'](_0x14f41e['id']);const _0x184b5f=await this[_0x2f824e(0x18d)]['createIntegration'](_0x31201f);_0x511c9a[_0x2f824e(0x21d)]['push']({'name':_0x381801[_0x2f824e(0x156)][_0x2f824e(0x249)],'action':'updated','id':_0x184b5f['id']}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x21d)][_0x2f824e(0x167)]++;}else{const _0x33d6c3=await this[_0x2f824e(0x18d)][_0x2f824e(0x1ce)](_0x31201f);_0x511c9a[_0x2f824e(0x21d)][_0x2f824e(0x191)]({'name':_0x381801[_0x2f824e(0x156)]['service_type'],'action':_0x2f824e(0x135),'id':_0x33d6c3['id']}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x21d)][_0x2f824e(0x135)]++;}}catch(_0x438ccd){_0x511c9a[_0x2f824e(0x21d)][_0x2f824e(0x191)]({'name':_0x381801[_0x2f824e(0x156)][_0x2f824e(0x249)],'action':'error','error':_0x438ccd[_0x2f824e(0x182)]}),_0x511c9a[_0x2f824e(0x130)]['integrations'][_0x2f824e(0x181)]++;}}for(const _0x28916c of _0x1f5446){try{const _0x305387=_0x1a4a64[_0x2f824e(0x1ef)](_0x28916c[_0x2f824e(0x156)][_0x2f824e(0x152)]),_0x4ad7be=await yamlFormInterfaceToApi(_0x28916c[_0x2f824e(0x156)],_0x41ca50,_0x564421);if(!_0x4ad7be){_0x511c9a[_0x2f824e(0x19f)][_0x2f824e(0x191)]({'name':_0x28916c[_0x2f824e(0x156)]['name'],'action':_0x2f824e(0x1b1),'error':_0x2f824e(0x17b)}),_0x511c9a['counts']['formInterfaces'][_0x2f824e(0x181)]++;continue;}if(_0x305387){const _0x57d3a9=await this['client'][_0x2f824e(0x225)](_0x305387['id'],_0x4ad7be);_0x511c9a[_0x2f824e(0x19f)]['push']({'name':_0x28916c[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':_0x2f824e(0x167),'id':_0x57d3a9['id']}),_0x511c9a['counts'][_0x2f824e(0x19f)]['updated']++;}else{const _0xa98f64=await this['client'][_0x2f824e(0x17c)](_0x4ad7be);_0x511c9a[_0x2f824e(0x19f)]['push']({'name':_0x28916c[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':_0x2f824e(0x135),'id':_0xa98f64['id']}),_0x511c9a[_0x2f824e(0x130)]['formInterfaces'][_0x2f824e(0x135)]++;}}catch(_0x4961a4){_0x511c9a[_0x2f824e(0x19f)][_0x2f824e(0x191)]({'name':_0x28916c[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':'error','error':_0x4961a4['message']}),_0x511c9a['counts'][_0x2f824e(0x19f)][_0x2f824e(0x181)]++;}}for(const _0x59d2a0 of _0x5100fc){try{const _0x3efbda=_0x332563['get'](_0x59d2a0[_0x2f824e(0x156)][_0x2f824e(0x152)]),_0x3c390e=await yamlChatInterfaceToApi(_0x59d2a0[_0x2f824e(0x156)],_0x41ca50,_0x564421);if(_0x3efbda){const _0x44a981=await this[_0x2f824e(0x18d)][_0x2f824e(0x16e)](_0x3efbda['id'],_0x3c390e);_0x511c9a['chatInterfaces']['push']({'name':_0x59d2a0[_0x2f824e(0x156)]['name'],'action':_0x2f824e(0x167),'id':_0x44a981['id']}),_0x511c9a['counts']['chatInterfaces'][_0x2f824e(0x167)]++;}else{const _0x17425b=await this['client'][_0x2f824e(0x133)](_0x3c390e);_0x511c9a['chatInterfaces'][_0x2f824e(0x191)]({'name':_0x59d2a0[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':_0x2f824e(0x135),'id':_0x17425b['id']}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x16d)][_0x2f824e(0x135)]++;}}catch(_0x2b46b5){_0x511c9a[_0x2f824e(0x16d)][_0x2f824e(0x191)]({'name':_0x59d2a0[_0x2f824e(0x156)][_0x2f824e(0x152)],'action':'error','error':_0x2b46b5[_0x2f824e(0x182)]}),_0x511c9a[_0x2f824e(0x130)][_0x2f824e(0x16d)][_0x2f824e(0x181)]++;}}return _0x511c9a;}async['pullAgent'](_0x4c913f,_0x24e31c,_0x3fffbd,_0x561760){const _0x226023=a133_0x352433,{projectId:_0x53aef8,project:_0x3736a4}=await this['resolveProjectName'](_0x4c913f),_0x1ff1ac=_0x3736a4[_0x226023(0x235)]['name'],_0x20af12=await this[_0x226023(0x18d)][_0x226023(0x188)](_0x53aef8),_0x2f099d=_0x20af12[_0x226023(0x1a3)](_0x1b9a8c=>_0x1b9a8c[_0x226023(0x235)][_0x226023(0x152)]===_0x24e31c);if(!_0x2f099d)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x226023(0x1a1)+_0x24e31c,undefined,{'helpText':_0x226023(0x14c)+_0x20af12[_0x226023(0x150)](_0x2d6954=>_0x2d6954[_0x226023(0x235)]['name'])[_0x226023(0x18c)](',\x20')});let _0x5ef942;if(_0x3fffbd)_0x5ef942=_0x3fffbd;else{const _0x4f58ee=a133_0x110b88[_0x226023(0x18c)](process[_0x226023(0x158)](),_0x226023(0x1c8)),_0x444398=getSanitizedPathWithMigration(_0x4f58ee,_0x1ff1ac);_0x444398[_0x226023(0x15e)]&&this[_0x226023(0x211)][_0x226023(0x1f8)](_0x226023(0x1b7)+a133_0x110b88[_0x226023(0x1f9)](_0x444398['oldPath'])+_0x226023(0x194)+a133_0x110b88['basename'](_0x444398[_0x226023(0x251)])),_0x5ef942=_0x444398[_0x226023(0x251)];}const _0x4dc76b=getSanitizedPathWithMigration(_0x5ef942,_0x24e31c);_0x4dc76b['renamed']&&this[_0x226023(0x211)][_0x226023(0x1f8)]('Renamed\x20agent\x20folder:\x20'+a133_0x110b88[_0x226023(0x1f9)](_0x4dc76b[_0x226023(0x19e)])+_0x226023(0x194)+a133_0x110b88[_0x226023(0x1f9)](_0x4dc76b[_0x226023(0x251)]));const _0x3e921f=_0x4dc76b[_0x226023(0x251)],_0x554828=new Map(),_0x3d36d5=new Map(),_0x41c3eb=await this[_0x226023(0x18d)][_0x226023(0x1ad)](_0x53aef8),_0x43af8d=await this[_0x226023(0x18d)][_0x226023(0x1e9)](_0x53aef8),_0x420a9e=await safeListOrEmpty(()=>this[_0x226023(0x18d)][_0x226023(0x197)](_0x53aef8)),_0x23d9bd=new Map(),_0x4762ce=new Map();for(const _0x444636 of _0x41c3eb){_0x554828[_0x226023(0x1db)](_0x444636['id'],_0x444636[_0x226023(0x235)][_0x226023(0x152)]);}for(const _0xdbbd4b of _0x43af8d){_0x23d9bd[_0x226023(0x1db)](_0xdbbd4b['id'],_0xdbbd4b[_0x226023(0x235)][_0x226023(0x152)]);}for(const _0x7b0186 of _0x420a9e){_0x4762ce[_0x226023(0x1db)](_0x7b0186['id'],_0x7b0186['attributes'][_0x226023(0x152)]);}for(const _0x3e47db of _0x20af12){_0x3d36d5[_0x226023(0x1db)](_0x3e47db['id'],_0x3e47db[_0x226023(0x235)][_0x226023(0x152)]);}const _0x591314={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x554828,'TextKnowledgeBase':_0x23d9bd,'Agent':_0x3d36d5,'ExperimentalKnowledgeBase':_0x4762ce}),'resolvePromptName':async()=>undefined,'onWarning':_0x3ad73b=>this[_0x226023(0x211)][_0x226023(0x246)](_0x3ad73b)},_0x233676=a133_0x110b88[_0x226023(0x18c)](_0x3e921f,_0x226023(0x1a7)),_0x1c6da4=a133_0x110b88['join'](_0x3e921f,_0x226023(0x23a)),_0x5b6562=a133_0x110b88[_0x226023(0x18c)](_0x3e921f,_0x226023(0x184)),_0x288aa4=!a133_0x209372[_0x226023(0x1fc)](_0x1c6da4);if(_0x561760?.[_0x226023(0x1c4)])return{'agentName':_0x24e31c,'outputPath':_0x3e921f,'isNew':_0x288aa4,'hasChanges':!![]};a133_0x209372[_0x226023(0x171)](_0x5ef942,{'recursive':!![]}),a133_0x209372['mkdirSync'](_0x3e921f,{'recursive':!![]});const _0x5e6053=a133_0x110b88[_0x226023(0x18c)](_0x5ef942,_0x226023(0x209));!a133_0x209372['existsSync'](_0x5e6053)&&a133_0x209372[_0x226023(0x1ba)](_0x5e6053,createAgentConfigContent(_0x4c913f));const {yaml:_0x3c70c9,systemPrompt:_0x5d3f3d,starterMessage:_0x580b22}=await agentResponseToDef(_0x2f099d,_0x591314);let _0x31e6a9=_0x288aa4;if(!_0x288aa4){const _0x30cb6b=a133_0x209372[_0x226023(0x1fc)](_0x233676)?a133_0x209372[_0x226023(0x231)](_0x233676,_0x226023(0x148)):'',_0x32c149=a133_0x209372['readFileSync'](_0x1c6da4,'utf-8');_0x31e6a9=_0x30cb6b!==_0x5d3f3d||_0x32c149!==toAgentYamlString(_0x3c70c9);}a133_0x209372['writeFileSync'](_0x233676,_0x5d3f3d),a133_0x209372['writeFileSync'](_0x1c6da4,toAgentYamlString(_0x3c70c9));if(_0x580b22&&_0x580b22[_0x226023(0x1f0)]('\x0a'))a133_0x209372['writeFileSync'](_0x5b6562,_0x580b22);else a133_0x209372[_0x226023(0x1fc)](_0x5b6562)&&a133_0x209372[_0x226023(0x1de)](_0x5b6562);return{'agentName':_0x24e31c,'outputPath':_0x3e921f,'isNew':_0x288aa4,'hasChanges':_0x31e6a9};}async[a133_0x352433(0x24a)](_0x5ac6e1,_0x22adbd){const _0x333620=a133_0x352433;let _0x38b979;isAgentYamlPath(_0x5ac6e1)?_0x38b979=getAgentDirFromYamlPath(_0x5ac6e1):_0x38b979=_0x5ac6e1;const {config:_0x4f554f}=findAgentConfig(_0x38b979),_0x7038a4=await this[_0x333620(0x20b)](_0x4f554f[_0x333620(0x1d3)]),_0x3c623c=a133_0x110b88['join'](_0x38b979,_0x333620(0x23a)),_0xe524d2=a133_0x110b88[_0x333620(0x18c)](_0x38b979,_0x333620(0x1a7)),_0x3a899b=a133_0x110b88[_0x333620(0x18c)](_0x38b979,_0x333620(0x184));if(!a133_0x209372[_0x333620(0x1fc)](_0x3c623c))throw new SDKError(ErrorCode[_0x333620(0x180)],_0x333620(0x248)+_0x38b979,undefined,{'helpText':_0x333620(0x250)});const _0x4804c6=parseAgentYaml(a133_0x209372[_0x333620(0x231)](_0x3c623c,_0x333620(0x148)),_0x3c623c),_0x57379f=a133_0x209372['existsSync'](_0xe524d2)?a133_0x209372[_0x333620(0x231)](_0xe524d2,'utf-8'):'',_0x70ccb4=a133_0x209372[_0x333620(0x1fc)](_0x3a899b)?a133_0x209372[_0x333620(0x231)](_0x3a899b,_0x333620(0x148)):_0x4804c6['starter_message'];if(_0x22adbd?.['dryRun'])return{'agentName':_0x4804c6['name'],'action':'created','projectId':_0x7038a4};const _0x29cd82=await this[_0x333620(0x18d)][_0x333620(0x188)](_0x7038a4),_0x1b81b0=await fetchAllToolTargetMaps((_0x4c734c,_0x5300f4)=>this['client'][_0x333620(0x14a)](_0x4c734c,_0x5300f4),_0x7038a4),_0x3186f5=new Map();for(const _0x430aee of _0x29cd82){_0x3186f5[_0x333620(0x1db)](_0x430aee[_0x333620(0x235)][_0x333620(0x152)],_0x430aee['id']);}const _0xeb4730=[],_0x57e25a={'projectId':_0x7038a4,'resolveToolTargetId':buildIdResolver({..._0x1b81b0[_0x333620(0x160)],'Agent':_0x3186f5}),'resolvePromptId':async()=>undefined,'onWarning':_0x3f8a44=>{const _0x7a8eee=_0x333620;this[_0x7a8eee(0x211)][_0x7a8eee(0x246)](_0x3f8a44),_0xeb4730['push'](_0x3f8a44);}};try{const _0x2966d0=_0x29cd82[_0x333620(0x1a3)](_0x3b16fd=>_0x3b16fd[_0x333620(0x235)]['name']===_0x4804c6[_0x333620(0x152)]),_0x34c234=await agentDefToRequest(_0x4804c6,_0x57379f,_0x70ccb4,_0x57e25a);if(_0x2966d0)return await this[_0x333620(0x18d)][_0x333620(0x1ea)](_0x2966d0['id'],_0x34c234),{'agentName':_0x4804c6[_0x333620(0x152)],'action':'updated','projectId':_0x7038a4,'agentId':_0x2966d0['id'],'warnings':_0xeb4730[_0x333620(0x22a)]>0x0?_0xeb4730:undefined};else{const _0x4fff9b=await this[_0x333620(0x18d)][_0x333620(0x1fb)](_0x34c234);return{'agentName':_0x4804c6['name'],'action':_0x333620(0x135),'projectId':_0x7038a4,'agentId':_0x4fff9b['id'],'warnings':_0xeb4730[_0x333620(0x22a)]>0x0?_0xeb4730:undefined};}}catch(_0xc7c859){return{'agentName':_0x4804c6['name'],'action':_0x333620(0x1b1),'projectId':_0x7038a4,'error':_0xc7c859[_0x333620(0x182)],'warnings':_0xeb4730[_0x333620(0x22a)]>0x0?_0xeb4730:undefined};}}async[a133_0x352433(0x20a)](_0x23c591,_0x2ab217,_0x242b76){const _0x3fe250=a133_0x352433,_0x218158=a133_0x209372[_0x3fe250(0x1fc)](_0x23c591)&&a133_0x209372[_0x3fe250(0x1fc)](a133_0x110b88['join'](_0x23c591,_0x3fe250(0x209)));let _0x35a897;const _0x5d40fc=[],_0x3c59d5=[],_0x4b285b=[],_0x1c4969=[],_0x21e95a=[],_0x14f1b4=[],_0x4e6c1d=[],_0x1e4ac2=[],_0x308bf0=[];if(_0x218158){const _0x24e7b2=loadAgentConfig(a133_0x110b88[_0x3fe250(0x18c)](_0x23c591,_0x3fe250(0x209)));_0x35a897=_0x24e7b2['llm_project'];const _0x5c9c21=a133_0x209372['readdirSync'](_0x23c591,{'withFileTypes':!![]});for(const _0x130ff1 of _0x5c9c21){if(!_0x130ff1[_0x3fe250(0x1ed)]())continue;if([_0x3fe250(0x241),_0x3fe250(0x19c),_0x3fe250(0x22f),_0x3fe250(0x206),_0x3fe250(0x21d),'form_interfaces','chat_interfaces'][_0x3fe250(0x1f0)](_0x130ff1[_0x3fe250(0x152)]))continue;const _0x13deb8=a133_0x110b88[_0x3fe250(0x18c)](_0x23c591,_0x130ff1[_0x3fe250(0x152)]);if(isAgentDir(_0x13deb8)){const _0x56d703=a133_0x110b88[_0x3fe250(0x18c)](_0x13deb8,'agent.yml'),_0x313532=a133_0x110b88[_0x3fe250(0x18c)](_0x13deb8,_0x3fe250(0x1a7)),_0x1b5e14=a133_0x110b88['join'](_0x13deb8,_0x3fe250(0x184)),_0x5c4c5=parseAgentYaml(a133_0x209372['readFileSync'](_0x56d703,_0x3fe250(0x148)),_0x56d703),_0x5ac2bf=a133_0x209372[_0x3fe250(0x1fc)](_0x313532)?a133_0x209372[_0x3fe250(0x231)](_0x313532,'utf-8'):'',_0x5a0531=a133_0x209372['existsSync'](_0x1b5e14)?a133_0x209372[_0x3fe250(0x231)](_0x1b5e14,_0x3fe250(0x148)):_0x5c4c5[_0x3fe250(0x1a6)];_0x5d40fc[_0x3fe250(0x191)]({'name':_0x5c4c5[_0x3fe250(0x152)],'dir':_0x13deb8,'yaml':_0x5c4c5,'systemPrompt':_0x5ac2bf,'starterMessage':_0x5a0531});}}const _0x21c33e=getKnowledgeBasesDir(_0x23c591);if(a133_0x209372[_0x3fe250(0x1fc)](_0x21c33e)){const _0xc59b4f=a133_0x209372['readdirSync'](_0x21c33e);for(const _0x582f7b of _0xc59b4f){const _0x2c3ed0=a133_0x110b88[_0x3fe250(0x18c)](_0x21c33e,_0x582f7b);if(_0x582f7b['endsWith'](_0x3fe250(0x1dc))){const _0x2690f7=parseKnowledgeBaseYaml(a133_0x209372[_0x3fe250(0x231)](_0x2c3ed0,'utf-8'),_0x2c3ed0);_0x3c59d5['push']({'name':_0x2690f7[_0x3fe250(0x152)],'path':_0x2c3ed0,'yaml':_0x2690f7});}else{if(_0x582f7b[_0x3fe250(0x1b4)](_0x3fe250(0x1e0))){const _0x2cfa99=a133_0x209372['readFileSync'](_0x2c3ed0,'utf-8'),{name:_0x507394,text:_0x460c42}=parseTextKnowledgeBaseMd(_0x2cfa99,_0x582f7b);_0x4b285b[_0x3fe250(0x191)]({'name':_0x507394,'path':_0x2c3ed0,'text':_0x460c42});}}}}const _0x12b17e=getPromptsDir(_0x23c591);if(a133_0x209372[_0x3fe250(0x1fc)](_0x12b17e)){const _0x57d29a=a133_0x209372[_0x3fe250(0x198)](_0x12b17e)[_0x3fe250(0x218)](_0x8129cb=>_0x8129cb['endsWith']('.yml'));for(const _0x5b61e6 of _0x57d29a){const _0x4335e0=a133_0x110b88['join'](_0x12b17e,_0x5b61e6),_0x1cc13a=parsePromptYaml(a133_0x209372[_0x3fe250(0x231)](_0x4335e0,_0x3fe250(0x148)),_0x4335e0);_0x1c4969[_0x3fe250(0x191)]({'name':_0x1cc13a['name'],'path':_0x4335e0,'yaml':_0x1cc13a});}}const _0x23a37c=getIntegrationsDir(_0x23c591);if(a133_0x209372[_0x3fe250(0x1fc)](_0x23a37c)){const _0xa14ea0=a133_0x209372[_0x3fe250(0x198)](_0x23a37c)[_0x3fe250(0x218)](_0x14bb1b=>_0x14bb1b[_0x3fe250(0x1b4)](_0x3fe250(0x1dc)));for(const _0x17c99d of _0xa14ea0){const _0x10a6ab=a133_0x110b88['join'](_0x23a37c,_0x17c99d),_0x4f3fdb=parseIntegrationYaml(a133_0x209372[_0x3fe250(0x231)](_0x10a6ab,'utf-8'),_0x10a6ab);SAFE_INTEGRATION_TYPES[_0x3fe250(0x1f0)](_0x4f3fdb[_0x3fe250(0x249)][_0x3fe250(0x23c)]())?_0x21e95a[_0x3fe250(0x191)]({'name':_0x4f3fdb['name'],'path':_0x10a6ab,'yaml':_0x4f3fdb}):this['logger']['warn'](_0x3fe250(0x177)+_0x4f3fdb[_0x3fe250(0x152)]+_0x3fe250(0x163)+_0x4f3fdb['service_type']+_0x3fe250(0x14d)+(_0x3fe250(0x132)+SAFE_INTEGRATION_TYPES[_0x3fe250(0x18c)](',\x20')+_0x3fe250(0x23e)));}}const _0x42defc=getExperimentalKnowledgeBasesDir(_0x23c591);if(a133_0x209372['existsSync'](_0x42defc)){const _0x4c09fa=a133_0x209372['readdirSync'](_0x42defc,{'withFileTypes':!![]});for(const _0x44b5d5 of _0x4c09fa){if(!_0x44b5d5['isDirectory']())continue;const _0x13d973=a133_0x110b88['join'](_0x42defc,_0x44b5d5[_0x3fe250(0x152)]),_0x37bc4e=a133_0x110b88['join'](_0x13d973,_0x44b5d5['name']+_0x3fe250(0x1dc));if(a133_0x209372[_0x3fe250(0x1fc)](_0x37bc4e)){const _0x440097=parseExperimentalKnowledgeBaseYaml(a133_0x209372[_0x3fe250(0x231)](_0x37bc4e,'utf-8'),_0x37bc4e),_0x2c7f3f=a133_0x110b88['join'](_0x13d973,_0x3fe250(0x224)),_0x1c0683=[];if(a133_0x209372[_0x3fe250(0x1fc)](_0x2c7f3f)){const _0x4e3830=a133_0x209372[_0x3fe250(0x198)](_0x2c7f3f,{'withFileTypes':!![]});for(const _0x1e90c1 of _0x4e3830){if(!_0x1e90c1[_0x3fe250(0x1ed)]())continue;const _0x1a238=a133_0x110b88[_0x3fe250(0x18c)](_0x2c7f3f,_0x1e90c1[_0x3fe250(0x152)]),_0x49a14f=a133_0x110b88[_0x3fe250(0x18c)](_0x1a238,_0x3fe250(0x207)),_0x32d2e4=a133_0x110b88[_0x3fe250(0x18c)](_0x1a238,_0x3fe250(0x170));if(a133_0x209372['existsSync'](_0x49a14f)&&a133_0x209372[_0x3fe250(0x1fc)](_0x32d2e4)){const _0x30fdc9=a133_0x209372[_0x3fe250(0x231)](_0x49a14f,_0x3fe250(0x148)),_0x221dd7=a133_0x209372['readFileSync'](_0x32d2e4,_0x3fe250(0x148));_0x1c0683[_0x3fe250(0x191)]({'name':_0x1e90c1[_0x3fe250(0x152)],'code':_0x30fdc9,'json_schema':_0x221dd7});}}}const _0x48724c={..._0x440097,'functions':_0x1c0683};_0x14f1b4[_0x3fe250(0x191)]({'name':_0x440097[_0x3fe250(0x152)],'path':_0x13d973,'def':_0x48724c});}}}const _0xc5d209=getExperimentalArtifactsDir(_0x23c591);if(a133_0x209372[_0x3fe250(0x1fc)](_0xc5d209)){const _0xc34e4a=a133_0x209372[_0x3fe250(0x198)](_0xc5d209,{'withFileTypes':!![]});for(const _0x522271 of _0xc34e4a){if(!_0x522271['isDirectory']())continue;const _0x1ecb6c=a133_0x110b88[_0x3fe250(0x18c)](_0xc5d209,_0x522271['name']),_0x2c7999=a133_0x110b88[_0x3fe250(0x18c)](_0x1ecb6c,_0x522271[_0x3fe250(0x152)]+_0x3fe250(0x1dc));if(a133_0x209372[_0x3fe250(0x1fc)](_0x2c7999)){const _0x26b1a4=parseExperimentalArtifactYaml(a133_0x209372[_0x3fe250(0x231)](_0x2c7999,_0x3fe250(0x148)),_0x2c7999),_0x440ddf=a133_0x110b88[_0x3fe250(0x18c)](_0x1ecb6c,'code.js'),_0x274fdc=a133_0x209372[_0x3fe250(0x1fc)](_0x440ddf)?a133_0x209372[_0x3fe250(0x231)](_0x440ddf,'utf-8'):'',_0x43a347=a133_0x110b88[_0x3fe250(0x18c)](_0x1ecb6c,'files'),_0x495667=[];if(a133_0x209372[_0x3fe250(0x1fc)](_0x43a347)){const _0x115fa4=a133_0x209372[_0x3fe250(0x198)](_0x43a347);for(const _0x1acbc1 of _0x115fa4){const _0x3c9c3d=a133_0x110b88[_0x3fe250(0x18c)](_0x43a347,_0x1acbc1);if(a133_0x209372['statSync'](_0x3c9c3d)[_0x3fe250(0x21e)]()){const _0x3b0c45=a133_0x209372[_0x3fe250(0x231)](_0x3c9c3d,'utf-8');_0x495667['push']({'file_name':_0x1acbc1,'text_content':_0x3b0c45});}}}const _0x32f11e={..._0x26b1a4,'code':_0x274fdc,'files':_0x495667};_0x4e6c1d[_0x3fe250(0x191)]({'name':_0x26b1a4[_0x3fe250(0x152)],'path':_0x1ecb6c,'def':_0x32f11e});}}}const _0x2adf06=getFormInterfacesDir(_0x23c591);if(a133_0x209372[_0x3fe250(0x1fc)](_0x2adf06)){const _0x1a6878=a133_0x209372[_0x3fe250(0x198)](_0x2adf06)[_0x3fe250(0x218)](_0x37f8ec=>_0x37f8ec['endsWith'](_0x3fe250(0x1dc)));for(const _0x1953a3 of _0x1a6878){const _0x3f66a5=a133_0x110b88[_0x3fe250(0x18c)](_0x2adf06,_0x1953a3),_0xf128c4=parseFormInterfaceYaml(a133_0x209372['readFileSync'](_0x3f66a5,_0x3fe250(0x148)),_0x3f66a5);_0x1e4ac2[_0x3fe250(0x191)]({'name':_0xf128c4['name'],'path':_0x3f66a5,'yaml':_0xf128c4});}}const _0x45db67=getChatInterfacesDir(_0x23c591);if(a133_0x209372[_0x3fe250(0x1fc)](_0x45db67)){const _0x3b0bbe=a133_0x209372[_0x3fe250(0x198)](_0x45db67)[_0x3fe250(0x218)](_0x464258=>_0x464258[_0x3fe250(0x1b4)]('.yml'));for(const _0x49f736 of _0x3b0bbe){const _0x2798fe=a133_0x110b88[_0x3fe250(0x18c)](_0x45db67,_0x49f736),_0x4d19c7=parseChatInterfaceYaml(a133_0x209372[_0x3fe250(0x231)](_0x2798fe,_0x3fe250(0x148)),_0x2798fe);_0x308bf0['push']({'name':_0x4d19c7[_0x3fe250(0x152)],'path':_0x2798fe,'yaml':_0x4d19c7});}}}else{const _0x23997f=await this[_0x3fe250(0x20b)](_0x23c591),_0x347980=await this[_0x3fe250(0x18d)][_0x3fe250(0x164)](_0x23997f);_0x35a897=_0x347980[_0x3fe250(0x235)][_0x3fe250(0x152)];const _0x3661e5=await this[_0x3fe250(0x18d)]['listAgentsFull'](_0x23997f),_0x13768a=await this['client'][_0x3fe250(0x1ad)](_0x23997f),_0x468a55=await this['client'][_0x3fe250(0x1e9)](_0x23997f),_0x35d7fb=await this[_0x3fe250(0x18d)][_0x3fe250(0x1a0)](_0x23997f),_0x40d8fe=await this[_0x3fe250(0x18d)][_0x3fe250(0x16c)](_0x23997f),_0x2d34f4=await safeListOrEmpty(()=>this[_0x3fe250(0x18d)][_0x3fe250(0x197)](_0x23997f)),_0x1986d1=await safeListOrEmpty(()=>this[_0x3fe250(0x18d)][_0x3fe250(0x214)](_0x23997f)),_0x47a7d2=new Map(),_0x40036c=new Map(),_0x539e78=new Map(),_0x4e8366=new Map(),_0x32639b=new Map(),_0x3ec57b=new Map();for(const _0x3a2fd7 of _0x13768a){_0x47a7d2['set'](_0x3a2fd7['id'],_0x3a2fd7[_0x3fe250(0x235)][_0x3fe250(0x152)]);}for(const _0x349377 of _0x468a55){_0x40036c['set'](_0x349377['id'],_0x349377[_0x3fe250(0x235)]['name']);}for(const _0x165cdc of _0x3661e5){_0x539e78[_0x3fe250(0x1db)](_0x165cdc['id'],_0x165cdc['attributes'][_0x3fe250(0x152)]);}for(const _0x5c7d05 of _0x35d7fb){_0x4e8366['set'](_0x5c7d05['id'],_0x5c7d05['attributes'][_0x3fe250(0x152)]);}for(const _0x14bf06 of _0x2d34f4){_0x32639b['set'](_0x14bf06['id'],_0x14bf06[_0x3fe250(0x235)][_0x3fe250(0x152)]);}for(const _0x8d5210 of _0x1986d1){_0x3ec57b[_0x3fe250(0x1db)](_0x8d5210['id'],_0x8d5210['attributes'][_0x3fe250(0x152)]);}const _0x1275ba={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x47a7d2,'TextKnowledgeBase':_0x40036c,'Agent':_0x539e78,'ExperimentalKnowledgeBase':_0x32639b}),'resolvePromptName':async _0xeb4d3e=>_0x4e8366['get'](_0xeb4d3e),'onWarning':_0x39ea62=>this[_0x3fe250(0x211)][_0x3fe250(0x246)](_0x39ea62)};for(const _0x7ce8a2 of _0x3661e5){const _0x3645a2=await agentResponseToDef(_0x7ce8a2,_0x1275ba),{yaml:_0x10e9b6,systemPrompt:_0x225ae8,starterMessage:_0x3c32f1}=_0x3645a2;_0x5d40fc[_0x3fe250(0x191)]({'name':_0x10e9b6[_0x3fe250(0x152)],'dir':'','yaml':_0x10e9b6,'systemPrompt':_0x225ae8,'starterMessage':_0x3c32f1});}for(const _0x5be2a5 of _0x13768a){const _0x41d176=apiKnowledgeBaseToYaml(_0x5be2a5);_0x3c59d5[_0x3fe250(0x191)]({'name':_0x41d176[_0x3fe250(0x152)],'path':'','yaml':_0x41d176});}for(const _0x385c85 of _0x468a55){_0x4b285b[_0x3fe250(0x191)]({'name':_0x385c85[_0x3fe250(0x235)][_0x3fe250(0x152)],'path':'','text':_0x385c85[_0x3fe250(0x235)][_0x3fe250(0x20f)]});}for(const _0x527a79 of _0x35d7fb){const _0x45899f=await apiPromptToYaml(_0x527a79,_0x1275ba);_0x45899f&&_0x1c4969[_0x3fe250(0x191)]({'name':_0x45899f[_0x3fe250(0x152)],'path':'','yaml':_0x45899f});}for(const _0x3b5840 of _0x40d8fe){if(!_0x3b5840[_0x3fe250(0x235)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x3fe250(0x1f0)](_0x3b5840[_0x3fe250(0x235)][_0x3fe250(0x22b)][_0x3fe250(0x23c)]())){const _0x58bce9=await apiIntegrationToYaml(_0x3b5840,_0x1275ba);_0x21e95a[_0x3fe250(0x191)]({'name':_0x3b5840[_0x3fe250(0x235)][_0x3fe250(0x22b)][_0x3fe250(0x23c)](),'path':'','yaml':_0x58bce9});}}for(const _0x580a56 of _0x2d34f4){const _0x479b36=apiExperimentalKnowledgeBaseToYaml(_0x580a56);_0x14f1b4[_0x3fe250(0x191)]({'name':_0x479b36[_0x3fe250(0x152)],'path':'','def':_0x479b36});}for(const _0x3e0d98 of _0x1986d1){const _0x573dd7=apiExperimentalArtifactToYaml(_0x3e0d98);_0x4e6c1d[_0x3fe250(0x191)]({'name':_0x573dd7[_0x3fe250(0x152)],'path':'','def':_0x573dd7});}const _0x2bb8dc=await safeListOrEmpty(()=>this[_0x3fe250(0x18d)][_0x3fe250(0x20c)](_0x23997f));for(const _0xaddd44 of _0x2bb8dc){const _0x150da7=await apiFormInterfaceToYaml(_0xaddd44,_0x1275ba);_0x1e4ac2[_0x3fe250(0x191)]({'name':_0x150da7['name'],'path':'','yaml':_0x150da7});}const _0x4fb643=await safeListOrEmpty(()=>this[_0x3fe250(0x18d)][_0x3fe250(0x1b9)](_0x23997f));for(const _0x4b94a0 of _0x4fb643){if(_0x4b94a0[_0x3fe250(0x235)][_0x3fe250(0x24b)])continue;const _0x37562d=await apiChatInterfaceToYaml(_0x4b94a0,_0x1275ba);_0x308bf0[_0x3fe250(0x191)]({'name':_0x37562d['name'],'path':'','yaml':_0x37562d});}}const _0x9170f2={'sourceProjectName':_0x35a897,'newProjectName':_0x2ab217,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'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},'formInterfaces':{'created':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'errors':0x0}}},_0x51837b=await this[_0x3fe250(0x18d)][_0x3fe250(0x187)](),_0x553368=_0x51837b[_0x3fe250(0x1a3)](_0x2aa8c6=>_0x2aa8c6['attributes']['name']===_0x2ab217);if(_0x553368)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x3fe250(0x17e)+_0x2ab217+_0x3fe250(0x238),undefined,{'helpText':_0x3fe250(0x147)});if(_0x242b76?.[_0x3fe250(0x1c4)])return _0x9170f2[_0x3fe250(0x130)][_0x3fe250(0x1c8)][_0x3fe250(0x135)]=_0x5d40fc['length'],_0x9170f2[_0x3fe250(0x130)]['knowledgeBases']['created']=_0x3c59d5['length'],_0x9170f2[_0x3fe250(0x130)][_0x3fe250(0x17d)][_0x3fe250(0x135)]=_0x4b285b['length'],_0x9170f2['counts'][_0x3fe250(0x21b)][_0x3fe250(0x135)]=_0x14f1b4[_0x3fe250(0x22a)],_0x9170f2[_0x3fe250(0x130)][_0x3fe250(0x1c0)]['created']=_0x4e6c1d['length'],_0x9170f2['counts']['prompts']['created']=_0x1c4969[_0x3fe250(0x22a)],_0x9170f2[_0x3fe250(0x130)]['integrations'][_0x3fe250(0x135)]=_0x21e95a[_0x3fe250(0x22a)],_0x9170f2;const _0x4a72a5=await this[_0x3fe250(0x18d)]['createProject']({'name':_0x2ab217}),_0x4d1161=_0x4a72a5['id'];_0x9170f2[_0x3fe250(0x159)]=_0x4d1161;const _0x17c734=new Map(),_0x1ff0d6=new Map(),_0x593c78=new Map(),_0x545486=new Map(),_0x8b6d58=new Map(),_0xd01d99=new Map(),_0x2a46a9=new Map(),_0x4012d8=new Map(),_0x5a0bc1=new Set(),_0x28be44=new Set();for(const _0x688793 of _0x5d40fc){for(const _0x4cb575 of _0x688793['yaml']['tools']||[]){if(_0x4cb575['type']===_0x3fe250(0x1ab)&&_0x4cb575['target']){const _0x42add2=parseRef(_0x4cb575['target']);if(_0x42add2)_0x5a0bc1[_0x3fe250(0x19b)](_0x42add2[_0x3fe250(0x152)]);}else{if(_0x4cb575[_0x3fe250(0x24e)]===_0x3fe250(0x16b)&&_0x4cb575[_0x3fe250(0x1dd)]){const _0x22fba6=parseRef(_0x4cb575[_0x3fe250(0x1dd)]);if(_0x22fba6)_0x28be44[_0x3fe250(0x19b)](_0x22fba6['name']);}}}}for(const _0x516d37 of _0x5a0bc1){try{const _0x5038f6=await this[_0x3fe250(0x18d)][_0x3fe250(0x1a4)]({'projectId':_0x4d1161,'name':_0x516d37});_0x8b6d58[_0x3fe250(0x1db)](_0x516d37,_0x5038f6['id']),_0x9170f2[_0x3fe250(0x176)][_0x3fe250(0x191)]({'name':_0x516d37,'action':_0x3fe250(0x135),'id':_0x5038f6['id']}),_0x9170f2[_0x3fe250(0x130)][_0x3fe250(0x176)][_0x3fe250(0x135)]++;}catch(_0x538f15){_0x9170f2[_0x3fe250(0x176)][_0x3fe250(0x191)]({'name':_0x516d37,'action':_0x3fe250(0x1b1),'error':_0x538f15[_0x3fe250(0x182)]}),_0x9170f2['counts'][_0x3fe250(0x176)][_0x3fe250(0x181)]++;}}for(const _0xd3edc6 of _0x28be44){try{const _0x1f87fb=await this[_0x3fe250(0x18d)]['createWebSearchTool']({'projectId':_0x4d1161,'name':_0xd3edc6});_0xd01d99[_0x3fe250(0x1db)](_0xd3edc6,_0x1f87fb['id']),_0x9170f2[_0x3fe250(0x14b)][_0x3fe250(0x191)]({'name':_0xd3edc6,'action':_0x3fe250(0x135),'id':_0x1f87fb['id']}),_0x9170f2[_0x3fe250(0x130)][_0x3fe250(0x14b)]['created']++;}catch(_0x4dee12){_0x9170f2[_0x3fe250(0x14b)][_0x3fe250(0x191)]({'name':_0xd3edc6,'action':'error','error':_0x4dee12[_0x3fe250(0x182)]}),_0x9170f2[_0x3fe250(0x130)]['webSearchTools']['errors']++;}}const _0x437af5=await fetchAllToolTargetMaps((_0x223bbf,_0x207a96)=>this[_0x3fe250(0x18d)][_0x3fe250(0x14a)](_0x223bbf,_0x207a96),_0x4d1161);let _0xe7c4c4=[];const _0x4703f5={'projectId':_0x4d1161,'resolveToolTargetId':buildIdResolver({..._0x437af5[_0x3fe250(0x160)],'KnowledgeBase':_0x17c734,'TextKnowledgeBase':_0x1ff0d6,'ExperimentalKnowledgeBase':_0x2a46a9,'Agent':_0x593c78,'WebSearchTool':_0xd01d99,'ImageGenerator':_0x8b6d58}),'resolvePromptId':async _0x395d25=>_0x545486[_0x3fe250(0x1ef)](_0x395d25),'onWarning':_0x41f5ac=>{const _0x21d7e7=_0x3fe250;this[_0x21d7e7(0x211)][_0x21d7e7(0x246)](_0x41f5ac),_0xe7c4c4['push'](_0x41f5ac);}};for(const _0x3ca2e7 of _0x3c59d5){try{const _0x543e64=yamlKnowledgeBaseToApi(_0x3ca2e7[_0x3fe250(0x156)],_0x4d1161),_0x2535d0=await this['client'][_0x3fe250(0x178)](_0x543e64);_0x17c734[_0x3fe250(0x1db)](_0x3ca2e7[_0x3fe250(0x156)][_0x3fe250(0x152)],_0x2535d0['id']),_0x9170f2[_0x3fe250(0x1d8)][_0x3fe250(0x191)]({'name':_0x3ca2e7['yaml'][_0x3fe250(0x152)],'action':_0x3fe250(0x135),'id':_0x2535d0['id']}),_0x9170f2[_0x3fe250(0x130)][_0x3fe250(0x1d8)][_0x3fe250(0x135)]++;}catch(_0x437b9d){_0x9170f2[_0x3fe250(0x1d8)]['push']({'name':_0x3ca2e7[_0x3fe250(0x156)]['name'],'action':_0x3fe250(0x1b1),'error':_0x437b9d[_0x3fe250(0x182)]}),_0x9170f2[_0x3fe250(0x130)][_0x3fe250(0x1d8)]['errors']++;}}for(const _0x35e00d of _0x4b285b){try{const _0x42aed5=yamlTextKnowledgeBaseToApi({'name':_0x35e00d['name'],'text':_0x35e00d['text']},_0x4d1161),_0x20cc95=await this['client'][_0x3fe250(0x233)](_0x42aed5);_0x1ff0d6[_0x3fe250(0x1db)](_0x35e00d[_0x3fe250(0x152)],_0x20cc95['id']),_0x9170f2[_0x3fe250(0x17d)][_0x3fe250(0x191)]({'name':_0x35e00d[_0x3fe250(0x152)],'action':_0x3fe250(0x135),'id':_0x20cc95['id']}),_0x9170f2['counts']['textKnowledgeBases']['created']++;}catch(_0x19f80d){_0x9170f2[_0x3fe250(0x17d)]['push']({'name':_0x35e00d['name'],'action':_0x3fe250(0x1b1),'error':_0x19f80d[_0x3fe250(0x182)]}),_0x9170f2[_0x3fe250(0x130)][_0x3fe250(0x17d)][_0x3fe250(0x181)]++;}}for(const _0x18f833 of _0x4e6c1d){try{const _0x19f267=yamlExperimentalArtifactToApi(_0x18f833[_0x3fe250(0x1b3)],_0x4d1161),_0x5af8fb=await this[_0x3fe250(0x18d)][_0x3fe250(0x24d)](_0x19f267);_0x4012d8['set'](_0x18f833[_0x3fe250(0x1b3)][_0x3fe250(0x152)],_0x5af8fb['id']),_0x9170f2[_0x3fe250(0x1c0)][_0x3fe250(0x191)]({'name':_0x18f833[_0x3fe250(0x1b3)]['name'],'action':_0x3fe250(0x135),'id':_0x5af8fb['id']}),_0x9170f2[_0x3fe250(0x130)][_0x3fe250(0x1c0)][_0x3fe250(0x135)]++;}catch(_0x3d3b2e){_0x9170f2[_0x3fe250(0x1c0)][_0x3fe250(0x191)]({'name':_0x18f833[_0x3fe250(0x1b3)][_0x3fe250(0x152)],'action':_0x3fe250(0x1b1),'error':_0x3d3b2e['message']}),_0x9170f2[_0x3fe250(0x130)][_0x3fe250(0x1c0)][_0x3fe250(0x181)]++;}}for(const _0x9b7731 of _0x14f1b4){try{const _0x3a9a30=yamlExperimentalKnowledgeBaseToApi(_0x9b7731['def'],_0x4d1161),_0x595bfd=await this[_0x3fe250(0x18d)][_0x3fe250(0x175)](_0x3a9a30);_0x2a46a9[_0x3fe250(0x1db)](_0x9b7731[_0x3fe250(0x1b3)][_0x3fe250(0x152)],_0x595bfd['id']),_0x9170f2[_0x3fe250(0x21b)][_0x3fe250(0x191)]({'name':_0x9b7731[_0x3fe250(0x1b3)][_0x3fe250(0x152)],'action':_0x3fe250(0x135),'id':_0x595bfd['id']}),_0x9170f2['counts'][_0x3fe250(0x21b)]['created']++;}catch(_0x384760){_0x9170f2['experimentalKnowledgeBases']['push']({'name':_0x9b7731[_0x3fe250(0x1b3)][_0x3fe250(0x152)],'action':_0x3fe250(0x1b1),'error':_0x384760[_0x3fe250(0x182)]}),_0x9170f2['counts'][_0x3fe250(0x21b)]['errors']++;}}const _0x449c1f=[..._0x5d40fc][_0x3fe250(0x13b)]((_0x186e1d,_0x29f8c4)=>{const _0x3fab1c=_0x3fe250,_0x2b5e10=_0x186e1d[_0x3fab1c(0x156)][_0x3fab1c(0x195)]?.[_0x3fab1c(0x247)](_0x271615=>_0x271615[_0x3fab1c(0x24e)]==='agent')??![],_0x286bc1=_0x29f8c4[_0x3fab1c(0x156)][_0x3fab1c(0x195)]?.['some'](_0x5d9ad2=>_0x5d9ad2[_0x3fab1c(0x24e)]==='agent')??![];if(_0x2b5e10&&!_0x286bc1)return 0x1;if(!_0x2b5e10&&_0x286bc1)return-0x1;return 0x0;});for(const _0xa4d147 of _0x449c1f){_0xe7c4c4=[];try{const _0x32cd25=_0xa4d147['yaml'][_0x3fe250(0x195)]?.[_0x3fe250(0x218)](_0x59aa8d=>{const _0x4523d2=_0x3fe250;if(_0x59aa8d[_0x4523d2(0x24e)]===_0x4523d2(0x1f7)&&_0x59aa8d[_0x4523d2(0x1dd)]){const _0x238af7=parseRef(_0x59aa8d['target']);return _0x238af7?.[_0x4523d2(0x152)]===_0xa4d147['yaml'][_0x4523d2(0x152)];}return![];})??[];if(_0x32cd25[_0x3fe250(0x22a)]>0x0){const _0x5ded24=_0x3fe250(0x162)+_0xa4d147['yaml'][_0x3fe250(0x152)]+_0x3fe250(0x22d)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this[_0x3fe250(0x211)]['warn'](_0x5ded24),_0xe7c4c4['push'](_0x5ded24);}const _0x2804e8=await agentDefToRequest(_0xa4d147[_0x3fe250(0x156)],_0xa4d147[_0x3fe250(0x1b2)],_0xa4d147[_0x3fe250(0x140)],_0x4703f5),_0x28b4ce=await this[_0x3fe250(0x18d)][_0x3fe250(0x1fb)](_0x2804e8);_0x593c78['set'](_0xa4d147['yaml'][_0x3fe250(0x152)],_0x28b4ce['id']),_0x9170f2[_0x3fe250(0x1c8)][_0x3fe250(0x191)]({'agentName':_0xa4d147[_0x3fe250(0x156)]['name'],'action':_0x3fe250(0x135),'agentId':_0x28b4ce['id'],'warnings':_0xe7c4c4[_0x3fe250(0x22a)]>0x0?_0xe7c4c4:undefined}),_0x9170f2[_0x3fe250(0x130)][_0x3fe250(0x1c8)][_0x3fe250(0x135)]++;}catch(_0x5efc13){_0x9170f2[_0x3fe250(0x1c8)]['push']({'agentName':_0xa4d147['yaml'][_0x3fe250(0x152)],'action':'error','error':_0x5efc13[_0x3fe250(0x182)],'warnings':_0xe7c4c4[_0x3fe250(0x22a)]>0x0?_0xe7c4c4:undefined}),_0x9170f2[_0x3fe250(0x130)][_0x3fe250(0x1c8)][_0x3fe250(0x181)]++;}}for(const _0x54afe6 of _0x1c4969){try{const _0x374957=await yamlPromptToApi(_0x54afe6[_0x3fe250(0x156)],_0x4d1161,_0x4703f5);if(!_0x374957){_0x9170f2[_0x3fe250(0x206)]['push']({'name':_0x54afe6[_0x3fe250(0x156)]['name'],'action':_0x3fe250(0x1b1),'error':_0x3fe250(0x23f)}),_0x9170f2[_0x3fe250(0x130)][_0x3fe250(0x206)][_0x3fe250(0x181)]++;continue;}const _0x13fb53=await this[_0x3fe250(0x18d)][_0x3fe250(0x216)](_0x374957);_0x545486[_0x3fe250(0x1db)](_0x54afe6[_0x3fe250(0x156)][_0x3fe250(0x152)],_0x13fb53['id']),_0x9170f2['prompts'][_0x3fe250(0x191)]({'name':_0x54afe6['yaml'][_0x3fe250(0x152)],'action':'created','id':_0x13fb53['id']}),_0x9170f2[_0x3fe250(0x130)]['prompts'][_0x3fe250(0x135)]++;}catch(_0x594eec){_0x9170f2[_0x3fe250(0x206)]['push']({'name':_0x54afe6['yaml'][_0x3fe250(0x152)],'action':_0x3fe250(0x1b1),'error':_0x594eec[_0x3fe250(0x182)]}),_0x9170f2['counts'][_0x3fe250(0x206)][_0x3fe250(0x181)]++;}}for(const _0x1a12a2 of _0x21e95a){try{const _0x1b6e29=await yamlIntegrationToApi(_0x1a12a2['yaml'],_0x4d1161,_0x4703f5),_0x40cbfe=await this[_0x3fe250(0x18d)][_0x3fe250(0x1ce)](_0x1b6e29);_0x9170f2[_0x3fe250(0x21d)][_0x3fe250(0x191)]({'name':_0x1a12a2[_0x3fe250(0x156)][_0x3fe250(0x249)],'action':_0x3fe250(0x135),'id':_0x40cbfe['id']}),_0x9170f2[_0x3fe250(0x130)]['integrations'][_0x3fe250(0x135)]++;}catch(_0x43684d){_0x9170f2[_0x3fe250(0x21d)][_0x3fe250(0x191)]({'name':_0x1a12a2[_0x3fe250(0x156)][_0x3fe250(0x249)],'action':_0x3fe250(0x1b1),'error':_0x43684d[_0x3fe250(0x182)]}),_0x9170f2['counts']['integrations'][_0x3fe250(0x181)]++;}}for(const _0x2684a4 of _0x1e4ac2){try{const _0x2cabda=await yamlFormInterfaceToApi(_0x2684a4['yaml'],_0x4d1161,_0x4703f5);if(!_0x2cabda){_0x9170f2[_0x3fe250(0x19f)]['push']({'name':_0x2684a4['yaml'][_0x3fe250(0x152)],'action':_0x3fe250(0x1b1),'error':_0x3fe250(0x17b)}),_0x9170f2['counts']['formInterfaces']['errors']++;continue;}const _0xf990a7=await this[_0x3fe250(0x18d)][_0x3fe250(0x17c)](_0x2cabda);_0x9170f2[_0x3fe250(0x19f)]['push']({'name':_0x2684a4[_0x3fe250(0x156)][_0x3fe250(0x152)],'action':_0x3fe250(0x135),'id':_0xf990a7['id']}),_0x9170f2['counts'][_0x3fe250(0x19f)][_0x3fe250(0x135)]++;}catch(_0x1798e5){_0x9170f2[_0x3fe250(0x19f)][_0x3fe250(0x191)]({'name':_0x2684a4['yaml'][_0x3fe250(0x152)],'action':_0x3fe250(0x1b1),'error':_0x1798e5[_0x3fe250(0x182)]}),_0x9170f2[_0x3fe250(0x130)][_0x3fe250(0x19f)][_0x3fe250(0x181)]++;}}for(const _0x3c6666 of _0x308bf0){try{const _0x158648=await yamlChatInterfaceToApi(_0x3c6666[_0x3fe250(0x156)],_0x4d1161,_0x4703f5),_0x47e00c=await this[_0x3fe250(0x18d)][_0x3fe250(0x133)](_0x158648);_0x9170f2[_0x3fe250(0x16d)][_0x3fe250(0x191)]({'name':_0x3c6666[_0x3fe250(0x156)][_0x3fe250(0x152)],'action':_0x3fe250(0x135),'id':_0x47e00c['id']}),_0x9170f2['counts']['chatInterfaces']['created']++;}catch(_0x5093a3){_0x9170f2[_0x3fe250(0x16d)][_0x3fe250(0x191)]({'name':_0x3c6666[_0x3fe250(0x156)]['name'],'action':_0x3fe250(0x1b1),'error':_0x5093a3[_0x3fe250(0x182)]}),_0x9170f2[_0x3fe250(0x130)][_0x3fe250(0x16d)][_0x3fe250(0x181)]++;}}return _0x9170f2;}}
|
|
1
|
+
const a133_0x4f6d4d=a133_0x29d6;(function(_0x4cc990,_0x427746){const _0x302a69=a133_0x29d6,_0x3c5a1f=_0x4cc990();while(!![]){try{const _0x2a9559=parseInt(_0x302a69(0x209))/0x1*(parseInt(_0x302a69(0x11d))/0x2)+-parseInt(_0x302a69(0x177))/0x3*(-parseInt(_0x302a69(0x224))/0x4)+parseInt(_0x302a69(0x130))/0x5*(parseInt(_0x302a69(0x13d))/0x6)+-parseInt(_0x302a69(0x208))/0x7*(-parseInt(_0x302a69(0x1fc))/0x8)+-parseInt(_0x302a69(0x1ab))/0x9+parseInt(_0x302a69(0x239))/0xa+parseInt(_0x302a69(0x11a))/0xb*(-parseInt(_0x302a69(0x12c))/0xc);if(_0x2a9559===_0x427746)break;else _0x3c5a1f['push'](_0x3c5a1f['shift']());}catch(_0x35e226){_0x3c5a1f['push'](_0x3c5a1f['shift']());}}}(a133_0x798d,0x953d0));import{LLMApiClient}from'../client/llm-api-client.js';import*as a133_0x1b52fe from'node:fs';function a133_0x29d6(_0x92b713,_0x2f5aaf){_0x92b713=_0x92b713-0x117;const _0x798d41=a133_0x798d();let _0x29d6f5=_0x798d41[_0x92b713];return _0x29d6f5;}import*as a133_0x3324d2 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,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';function a133_0x798d(){const _0x40f975=['Skipping\x20integration\x20\x27','Renamed\x20integration\x20file:\x20','4550913iChjKR','availableModels','prompts','serviceType','status','createExperimentalArtifact','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','high','new','llm_project','statSync','temperature','getProject','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','reasoningEffort','promptId','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','starterMessage','variables','size','getBackupMetadata','prompts.json','INVALID_ARGUMENT','createTextKnowledgeBase','agents','Renamed\x20experimental\x20artifact\x20directory:\x20','Only\x20safe\x20types\x20(','readFileSync','_reasoning_','parse','client','chat_agent_console','existsSync','getChatInfo','updateAgent','Unable\x20to\x20create\x20project\x20after\x20','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.','knowledgeBases','listIntegrations','duplicate','get','target','dirname','toLowerCase','Renamed\x20text\x20KB\x20file:\x20','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','error','image_gen','code.js','formInterfaces','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','restoreProject','jsonSchemaHint','minimal','def','currentProjectId','backupProject','chatInterfaces','chat','listAgents','agents.json','createAgent','availableModelNames','event','.yml','):\x20','createKnowledgeBase','experimental_knowledge_bases','unlinkSync','updateAgentResponse','Multiple\x20agents\x20found\x20with\x20name\x20\x27','yaml','Renamed\x20folder:\x20','chat_parent_segment','stringify','projects','isManaged','set','experimentalArtifacts','service_type','json_schema','128vsjZVW','listExperimentalKnowledgeBases','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','name','systemPrompt','integrations.json','models','context','pullAgent','continueChat','warn','writeFileSync','531461inUqMJ','2128JACYeh','counts','starter_message','basename','Renamed\x20experimental\x20KB\x20directory:\x20','filter','deleteIntegration','NOT_FOUND','displayName','Could\x20not\x20resolve\x20agent\x20reference','toISOString','message','sort','json_schema.json','.llm','endsWith','chats','text','updateExperimentalArtifact','length','experimental_artifacts','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','getOrCreateDefaultProject','deleteAgent','errors',')\x20can\x20be\x20pushed.\x20','#\x20prompt.md\x0a','16LcwAKS','content','dryRun','tdx_default_','claude-4.5-sonnet','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','sdk.llm','createChatInterface','site','Agent\x20reference\x20not\x20found','listProjects','oldPath','text_content','listTextKnowledgeBases','Renamed\x20prompt\x20file:\x20','updated','idToName','Backup\x20folder\x20not\x20found:\x20','agentId','agentsFull','utf-8','1074510dnELBw','textKnowledgeBases','listExperimentalArtifacts','knowledgebases.json','Renamed\x20agent\x20folder:\x20','signal','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','2497abbYWz','setCurrentProject','updateKnowledgeBase','1132ppzrMO','files','AGENT_NOT_FOUND','agent.yml','mkdirSync','tdDatabaseName','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','listWebSearchTools','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','knowledge_bases',')\x20can\x20be\x20cloned.','nameToId','localeCompare','find','createExperimentalKnowledgeBase','111204iQRMNQ','\x20→\x20','add','createIntegration','25jHnDJb','createAgentResponse','Agent\x20\x27','info','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','metadata','startChat','Project\x20not\x20found:\x20','Renamed\x20chat\x20interface\x20file:\x20','slackMessageMode','prompt.md','listAgentsFull','TextKnowledgeBase','562314Yibctd','getDefaultProjectName','push','version','created','\x0a---\x20schema:\x20','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','(dry-run)','createImageGenerator','\x27.\x20This\x20should\x20not\x20happen.','logger','chat_interfaces','imageGenerators','updateFormInterface','Available\x20agents:\x20','pushProject','webhookCorsOrigins','actions','has','.md','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','Project\x20\x22','updateTextKnowledgeBase','maxToolIterations','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','exportedFrom','listPrompts','conflict','webSearchTools','isDir','createFormInterface','PERMISSION_DENIED','ALREADY_EXISTS','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','Renamed\x20form\x20interface\x20file:\x20','project','---\x20file:\x20','rmSync','readdirSync','INTERNAL','chat_generic','isFile','total','\x0a\x0a#\x20agent.yml\x0a','deleteProject','code','isDirectory','file_name','clearDefaultAgent','\x22\x20already\x20exists','projectId','Multiple\x20projects\x20found\x20with\x20name\x20\x27','tools','tdx_','path','renamed','description','168963xYnoUF','profile','createPrompt','functions','\x0a---\x20function:\x20','integrations','listFormInterfaces','tdx.json','includes','resolveAgentId','updatePrompt','cwd','agent','getCurrentProject','template','\x20attempts\x20due\x20to\x20name\x20conflicts.','resolveProjectName','getUserSettings','listToolTargets','listKnowledgeBases','updateExperimentalKnowledgeBase','projectName','KnowledgeBase','type','createProject','join','form_interfaces','experimentalKnowledgeBases','pushAgent','starter_message.md','project.json','already\x20exists','resolveProjectId','---\x20schema:\x20','getChatLog','unchanged','tables','chatIgnoreManagedActions','Unresolved\x20dependencies:\x20','attributes','Output\x20directory\x20already\x20exists:\x20','history','getAgent','split','map','updateChatInterface','\x0a---\x20code\x20---\x0a','Unsupported\x20backup\x20version:\x20','loadJsonFile','\x20---\x0a'];a133_0x798d=function(){return _0x40f975;};return a133_0x798d();}import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a133_0x4f6d4d(0x166),a133_0x4f6d4d(0x1ca),a133_0x4f6d4d(0x1f4)];async function safeListOrEmpty(_0x114931){const _0x11678a=a133_0x4f6d4d;try{return await _0x114931();}catch(_0xcfd87d){if(_0xcfd87d instanceof HTTPClientError&&_0xcfd87d[_0x11678a(0x1af)]===0x194)return[];throw _0xcfd87d;}}export class LLMSDK{[a133_0x4f6d4d(0x1e2)];[a133_0x4f6d4d(0x1c9)];[a133_0x4f6d4d(0x203)];['logger']=Logger['of'](a133_0x4f6d4d(0x22a));constructor(_0x3c64b9){this['client']=new LLMApiClient(_0x3c64b9),this['context']=_0x3c64b9;}[a133_0x4f6d4d(0x13e)](){const _0x2ab920=a133_0x4f6d4d,_0x4add39=getSanitizedUsername();return _0x2ab920(0x227)+_0x4add39;}async[a133_0x4f6d4d(0x11b)](_0x4f727f){const _0x1e409f=a133_0x4f6d4d,{projectId:_0x43986f}=await this[_0x1e409f(0x187)](_0x4f727f);this[_0x1e409f(0x1e2)]=_0x43986f;}[a133_0x4f6d4d(0x184)](){const _0x34b468=a133_0x4f6d4d;return this[_0x34b468(0x1e2)];}async['setDefaultAgent'](_0x1c1de1){const _0x3654c0=a133_0x4f6d4d,_0x5874a1=this[_0x3654c0(0x203)][_0x3654c0(0x178)];let _0x26291c,_0x3fffca;if(_0x1c1de1[_0x3654c0(0x17f)]('/')){const _0x17a0d3=_0x1c1de1[_0x3654c0(0x1a2)]('/');if(_0x17a0d3[_0x3654c0(0x21c)]!==0x2)throw new SDKError(ErrorCode[_0x3654c0(0x1c1)],'Invalid\x20agent\x20reference\x20format:\x20'+_0x1c1de1,undefined,{'helpText':_0x3654c0(0x1b8)});const [_0x4e36db,_0x286d70]=_0x17a0d3;_0x26291c=await this[_0x3654c0(0x197)](_0x4e36db),_0x3fffca=_0x286d70;}else _0x26291c=this[_0x3654c0(0x1e2)]||(await this[_0x3654c0(0x21f)]())['id'],_0x3fffca=_0x1c1de1;const _0x45ce0e=await this[_0x3654c0(0x180)](_0x3fffca,_0x26291c),_0x4da8c5=await this[_0x3654c0(0x1c9)]['getAgent'](_0x45ce0e);writeCachedLLMAgent(_0x4da8c5['attributes'][_0x3654c0(0x1ff)],_0x45ce0e,_0x26291c,_0x5874a1);}['getDefaultAgent'](){const _0x356245=a133_0x4f6d4d,_0x1db945=this[_0x356245(0x203)][_0x356245(0x178)];return readCachedLLMAgent(_0x1db945)||undefined;}[a133_0x4f6d4d(0x16e)](){const _0x3439ab=a133_0x4f6d4d,_0x304f66=this['context'][_0x3439ab(0x178)];clearCachedLLMAgent(_0x304f66);}async[a133_0x4f6d4d(0x202)](){const _0x310dba=a133_0x4f6d4d,_0x1af6e5=await this[_0x310dba(0x1c9)][_0x310dba(0x188)](),_0x281951=[];for(const _0x193ea3 of _0x1af6e5[_0x310dba(0x1e9)]){const _0x33c1f7=_0x1af6e5[_0x310dba(0x1ac)][_0x193ea3];_0x33c1f7&&_0x281951[_0x310dba(0x13f)]({'name':_0x193ea3,'displayName':_0x33c1f7[_0x310dba(0x211)]});}return _0x281951;}async[a133_0x4f6d4d(0x18f)](_0x28eb0f){const _0x5eeaca=a133_0x4f6d4d;return await this['client'][_0x5eeaca(0x18f)](_0x28eb0f);}async[a133_0x4f6d4d(0x16a)](_0x31abea){const _0x5df08b=a133_0x4f6d4d,{projectId:_0xadf6b0}=await this[_0x5df08b(0x187)](_0x31abea);await this[_0x5df08b(0x1c9)][_0x5df08b(0x16a)](_0xadf6b0);}async[a133_0x4f6d4d(0x1f6)](_0xcd4a65=0x32){const _0x4f4b34=a133_0x4f6d4d;return await this[_0x4f4b34(0x1c9)][_0x4f4b34(0x22e)](_0xcd4a65);}async[a133_0x4f6d4d(0x21f)](_0x486052){const _0x70dfae=a133_0x4f6d4d,_0x2af574=_0x486052||this[_0x70dfae(0x13e)](),_0x3c3902=this[_0x70dfae(0x203)][_0x70dfae(0x178)];if(!_0x486052){const _0x214d5f=readCachedLLMProject(_0x3c3902);if(_0x214d5f&&_0x214d5f['name']===_0x2af574)try{const _0x27b3ea=await this[_0x70dfae(0x1c9)]['getProject'](_0x214d5f['id']);if(_0x27b3ea[_0x70dfae(0x19e)][_0x70dfae(0x1ff)]===_0x2af574)return _0x27b3ea;}catch{}}const _0x316ca9=await this[_0x70dfae(0x1c9)]['listProjects'](),_0x1939fc=_0x316ca9[_0x70dfae(0x12a)](_0x509666=>_0x509666[_0x70dfae(0x19e)]['name']===_0x2af574);if(_0x1939fc)return!_0x486052&&writeCachedLLMProject(_0x2af574,_0x1939fc['id'],_0x3c3902),_0x1939fc;const _0x29b10d=await this['client'][_0x70dfae(0x18f)]({'name':_0x2af574,'description':_0x70dfae(0x123)+getSanitizedUsername()+')'});return!_0x486052&&writeCachedLLMProject(_0x2af574,_0x29b10d['id'],_0x3c3902),_0x29b10d;}async[a133_0x4f6d4d(0x197)](_0x1c1992){const _0x14f2a2=a133_0x4f6d4d,_0x1dc4b7=await this[_0x14f2a2(0x1c9)][_0x14f2a2(0x22e)](),_0x90aa9=_0x1dc4b7['filter'](_0x455b00=>_0x455b00[_0x14f2a2(0x19e)]['name']===_0x1c1992);if(_0x90aa9[_0x14f2a2(0x21c)]===0x0)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x14f2a2(0x137)+_0x1c1992,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x90aa9[_0x14f2a2(0x21c)]>0x1)throw new SDKError(ErrorCode[_0x14f2a2(0x165)],_0x14f2a2(0x171)+_0x1c1992+_0x14f2a2(0x146));return _0x90aa9[0x0]['id'];}async['resolveProjectName'](_0x161ae6){const _0x38b811=a133_0x4f6d4d,_0x35e1f9=await this[_0x38b811(0x1c9)]['listProjects'](),_0x39689b=_0x35e1f9['find'](_0x634810=>_0x634810[_0x38b811(0x19e)][_0x38b811(0x1ff)]===_0x161ae6);if(_0x39689b)return{'projectId':_0x39689b['id'],'project':_0x39689b};throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0x161ae6,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async['getOrCreateDefaultAgent'](_0xc02970=a133_0x4f6d4d(0x228),_0x285f1c=0x0,_0xc5a243){const _0x269251=a133_0x4f6d4d,_0x3e8742=0xa;let _0x192d0e=0x0,_0x508ad8;while(_0x192d0e<_0x3e8742){try{const _0x4ee98d=await this[_0x269251(0x21f)](_0x508ad8),_0x5956e1=_0x4ee98d['id'],_0x4e3bac=['none',_0x269251(0x1e0),'low','medium',_0x269251(0x1b2)],_0x316741=_0x285f1c===0x0?_0x269251(0x173)+_0xc02970:_0x269251(0x173)+_0xc02970+_0x269251(0x1c7)+_0x4e3bac[_0x285f1c],_0x2acb54=await this[_0x269251(0x1c9)][_0x269251(0x1e6)](_0x5956e1),_0xf3e1a=_0x2acb54[_0x269251(0x12a)](_0x5979f9=>_0x5979f9[_0x269251(0x19e)][_0x269251(0x1ff)]===_0x316741);if(_0xf3e1a)return _0xf3e1a;const _0x595878=_0x285f1c>0x0?0x1:_0xc5a243;return await this['client'][_0x269251(0x1e8)]({'name':_0x316741,'projectId':_0x5956e1,'modelType':_0xc02970,'systemPrompt':'','temperature':_0x595878,'reasoningEffort':_0x285f1c>0x0?_0x285f1c:undefined});}catch(_0x4c4ac1){if(_0x4c4ac1 instanceof HTTPClientError){const _0x282674=_0x4c4ac1['status'];if(_0x282674>=0x190&&_0x282674<0x1f4){if(_0x282674===0x191)throw new SDKError(ErrorCode['UNAUTHENTICATED'],_0x269251(0x21e),_0x4c4ac1);else{if(_0x282674===0x193)throw new SDKError(ErrorCode[_0x269251(0x15d)],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x4c4ac1);}throw _0x4c4ac1;}}if(errorContains(_0x4c4ac1,_0x269251(0x196),_0x269251(0x1d2),_0x269251(0x159))){_0x192d0e++;if(_0x192d0e>=_0x3e8742)throw new SDKError(ErrorCode[_0x269251(0x15e)],_0x269251(0x1ce)+_0x3e8742+_0x269251(0x186),_0x4c4ac1);const _0x479aee=this[_0x269251(0x13e)]();_0x508ad8=_0x479aee+'_'+generateRandomHex();continue;}throw _0x4c4ac1;}}throw new SDKError(ErrorCode[_0x269251(0x165)],_0x269251(0x125));}async[a133_0x4f6d4d(0x180)](_0x740aa2,_0x2af1e8){const _0xe43bec=a133_0x4f6d4d,_0x53a82c=_0x2af1e8||this[_0xe43bec(0x1e2)],_0x4beb61=await this[_0xe43bec(0x1c9)][_0xe43bec(0x1e6)](_0x53a82c),_0x388442=_0x4beb61[_0xe43bec(0x20e)](_0x2d945d=>_0x2d945d['attributes'][_0xe43bec(0x1ff)]===_0x740aa2);if(_0x388442['length']===0x0){const _0x45b90e=_0x53a82c?'\x20in\x20project\x20'+_0x53a82c:'';throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],'Agent\x20not\x20found:\x20'+_0x740aa2+_0x45b90e,undefined,{'helpText':_0x53a82c?_0xe43bec(0x156):_0xe43bec(0x1cf)});}if(_0x388442[_0xe43bec(0x21c)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0xe43bec(0x1f1)+_0x740aa2+'\x27.\x20This\x20should\x20not\x20happen.');return _0x388442[0x0]['id'];}async[a133_0x4f6d4d(0x1c3)](_0x4d32ba){const _0x4ff275=a133_0x4f6d4d,_0x23c8a1=_0x4d32ba||this[_0x4ff275(0x1e2)];return await this['client']['listAgents'](_0x23c8a1);}async[a133_0x4f6d4d(0x237)](_0x33c549){const _0x51d460=a133_0x4f6d4d;return await this[_0x51d460(0x1c9)]['listAgentsFull'](_0x33c549);}async[a133_0x4f6d4d(0x183)](_0x15d30c){const _0x245ffb=a133_0x4f6d4d;return await this['client'][_0x245ffb(0x1a1)](_0x15d30c);}async[a133_0x4f6d4d(0x1e8)](_0x423e57){return await this['client']['createAgent'](_0x423e57);}async['updateAgent'](_0x59f505,_0x36c021){const _0x575045=a133_0x4f6d4d;return await this['client'][_0x575045(0x1cd)](_0x59f505,_0x36c021);}async[a133_0x4f6d4d(0x220)](_0x5944db){const _0x27a954=a133_0x4f6d4d;await this[_0x27a954(0x1c9)]['deleteAgent'](_0x5944db);}async['startChat'](_0x44a932){const _0xa52b01=a133_0x4f6d4d;return await this[_0xa52b01(0x1c9)][_0xa52b01(0x136)]({'agentId':_0x44a932});}async*[a133_0x4f6d4d(0x1e5)](_0x5b033d,_0x1401f9){const _0x5027d5=a133_0x4f6d4d;let _0x46f300=_0x1401f9?.['chatId'];const _0x101278=_0x1401f9?.[_0x5027d5(0x236)];if(!_0x46f300){if(!_0x101278)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x385637=await this[_0x5027d5(0x1c9)][_0x5027d5(0x136)]({'agentId':_0x101278});_0x46f300=_0x385637['id'],yield{'type':_0x5027d5(0x135),'data':{'chatId':_0x46f300,'agentId':_0x101278,'projectId':_0x385637[_0x5027d5(0x19e)][_0x5027d5(0x170)]}};}for await(const _0x2d50dc of this[_0x5027d5(0x1c9)][_0x5027d5(0x205)](_0x46f300,_0x5b033d,_0x1401f9?.[_0x5027d5(0x118)])){yield{'type':_0x5027d5(0x1ea),'data':_0x2d50dc};}}async[a133_0x4f6d4d(0x219)](_0x3466b1=0x32){return await this['client']['listChats'](_0x3466b1);}async[a133_0x4f6d4d(0x1a0)](_0x3a23fa){const _0x1f67be=a133_0x4f6d4d;return await this[_0x1f67be(0x1c9)]['getChatHistory'](_0x3a23fa);}async['getChatLog'](_0x25880e){const _0x3fd3f9=a133_0x4f6d4d;return await this['client'][_0x3fd3f9(0x199)](_0x25880e);}async['chatInfo'](_0x22e484){const _0x294ae6=a133_0x4f6d4d;return await this['client'][_0x294ae6(0x1cc)](_0x22e484);}async[a133_0x4f6d4d(0x1e3)](_0x3cd6b8,_0x4bc441,_0x48a5f){const _0x4f277b=a133_0x4f6d4d,_0x266140=_0x48a5f?.['dryRun']??![],{projectId:_0x5dfc9c,project:_0x34de76}=await this[_0x4f277b(0x187)](_0x3cd6b8),_0x44fee0=_0x34de76[_0x4f277b(0x19e)][_0x4f277b(0x1ff)],_0x3a5745=_0x4bc441||_0x44fee0+_0x4f277b(0x217);if(a133_0x1b52fe[_0x4f277b(0x1cb)](_0x3a5745)&&!_0x266140)throw new SDKError(ErrorCode[_0x4f277b(0x15e)],_0x4f277b(0x19f)+_0x3a5745,undefined,{'helpText':_0x4f277b(0x1fe)});const _0x56655e=await this['client'][_0x4f277b(0x13b)](_0x5dfc9c),_0x3bb70f=await this[_0x4f277b(0x1c9)][_0x4f277b(0x18a)](_0x5dfc9c),_0x170a2d=await this['client'][_0x4f277b(0x158)](_0x5dfc9c),_0x258abf=await this['client'][_0x4f277b(0x1d1)](_0x5dfc9c);if(!_0x266140){a133_0x1b52fe[_0x4f277b(0x121)](_0x3a5745,{'recursive':!![]});const _0x374d66={'version':'1.0','exportedAt':new Date()[_0x4f277b(0x213)](),'exportedFrom':{'site':this[_0x4f277b(0x203)][_0x4f277b(0x22c)],'projectId':_0x5dfc9c,'projectName':_0x44fee0},'project':_0x34de76};a133_0x1b52fe[_0x4f277b(0x207)](a133_0x3324d2['join'](_0x3a5745,_0x4f277b(0x195)),JSON[_0x4f277b(0x1f5)](_0x374d66,null,0x2)),a133_0x1b52fe[_0x4f277b(0x207)](a133_0x3324d2[_0x4f277b(0x190)](_0x3a5745,_0x4f277b(0x1e7)),JSON['stringify'](_0x56655e,null,0x2)),a133_0x1b52fe['writeFileSync'](a133_0x3324d2[_0x4f277b(0x190)](_0x3a5745,_0x4f277b(0x23c)),JSON[_0x4f277b(0x1f5)](_0x3bb70f,null,0x2)),a133_0x1b52fe['writeFileSync'](a133_0x3324d2['join'](_0x3a5745,'prompts.json'),JSON['stringify'](_0x170a2d,null,0x2)),a133_0x1b52fe['writeFileSync'](a133_0x3324d2[_0x4f277b(0x190)](_0x3a5745,_0x4f277b(0x201)),JSON[_0x4f277b(0x1f5)](_0x258abf,null,0x2));}return{'projectName':_0x44fee0,'outputDir':_0x3a5745,'counts':{'agents':_0x56655e[_0x4f277b(0x21c)],'knowledgeBases':_0x3bb70f[_0x4f277b(0x21c)],'prompts':_0x170a2d['length'],'integrations':_0x258abf[_0x4f277b(0x21c)]}};}async[a133_0x4f6d4d(0x1de)](_0x4ff6f7,_0x5cdf53){const _0x2137c7=a133_0x4f6d4d,_0x52295d=_0x5cdf53?.[_0x2137c7(0x226)]??![],_0x8c576e=this[_0x2137c7(0x1bf)](_0x4ff6f7),_0x5a94ec=_0x8c576e[_0x2137c7(0x157)]['site'],_0x5d8741=this[_0x2137c7(0x203)][_0x2137c7(0x22c)],_0x32edf6=_0x5a94ec!==_0x5d8741?_0x5a94ec:undefined,_0x39f263=this[_0x2137c7(0x1a7)](a133_0x3324d2[_0x2137c7(0x190)](_0x4ff6f7,_0x2137c7(0x1e7)),[]),_0x3da720=this[_0x2137c7(0x1a7)](a133_0x3324d2['join'](_0x4ff6f7,_0x2137c7(0x23c)),[]),_0x10f32c=this[_0x2137c7(0x1a7)](a133_0x3324d2[_0x2137c7(0x190)](_0x4ff6f7,_0x2137c7(0x1c0)),[]),_0xf08f69=this[_0x2137c7(0x1a7)](a133_0x3324d2['join'](_0x4ff6f7,_0x2137c7(0x201)),[]),_0x33aba3=_0x5cdf53?.[_0x2137c7(0x1ff)]||_0x8c576e[_0x2137c7(0x157)][_0x2137c7(0x18c)];if(_0x52295d){const _0x19580e=new Map(),_0x217d6d=[..._0x39f263],_0x1da737=_0x39f263[_0x2137c7(0x21c)]+0x1;let _0x196c7e=0x0;while(_0x217d6d[_0x2137c7(0x21c)]>0x0&&_0x196c7e<_0x1da737){_0x196c7e++;const _0x3f4cdd=[];for(const _0x4c4e7a of _0x217d6d){canCreateAgent(_0x4c4e7a,_0x19580e)?_0x19580e[_0x2137c7(0x1f8)](_0x4c4e7a['id'],'dry-run-'+_0x4c4e7a['id']):_0x3f4cdd[_0x2137c7(0x13f)](_0x4c4e7a);}if(_0x3f4cdd[_0x2137c7(0x21c)]===_0x217d6d[_0x2137c7(0x21c)])throw new SDKError(ErrorCode['INTERNAL'],_0x2137c7(0x1d8),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x217d6d[_0x2137c7(0x21c)]=0x0,_0x217d6d[_0x2137c7(0x13f)](..._0x3f4cdd);}const _0x4cfab0=_0x10f32c[_0x2137c7(0x20e)](_0x31ca8c=>_0x19580e[_0x2137c7(0x14f)](_0x31ca8c[_0x2137c7(0x19e)][_0x2137c7(0x236)]))['length'];return{'projectName':_0x33aba3,'projectId':_0x2137c7(0x144),'counts':{'agents':_0x39f263[_0x2137c7(0x21c)],'knowledgeBases':_0x3da720[_0x2137c7(0x21c)],'prompts':_0x4cfab0,'integrations':_0xf08f69['length']},'sourceSite':_0x32edf6};}const _0x24c543=await this['client'][_0x2137c7(0x18f)]({'name':_0x33aba3,'description':_0x8c576e[_0x2137c7(0x161)]['attributes'][_0x2137c7(0x176)]}),_0x328823=_0x24c543['id'],_0xbd2f46=new Map(),_0x5989ac=new Map(),_0x1087a9=new Map();for(const _0x79c693 of _0x3da720){const _0xed523e=await this[_0x2137c7(0x1c9)][_0x2137c7(0x1ed)]({'projectId':_0x328823,'name':_0x79c693[_0x2137c7(0x19e)][_0x2137c7(0x1ff)],'tdDatabaseName':_0x79c693[_0x2137c7(0x19e)][_0x2137c7(0x122)],'tables':_0x79c693[_0x2137c7(0x19e)][_0x2137c7(0x19b)]});_0xbd2f46[_0x2137c7(0x1f8)](_0x79c693['id'],_0xed523e['id']);}const _0x400a41=[..._0x39f263],_0x3e6f5a=_0x39f263['length']+0x1;let _0x594450=0x0;while(_0x400a41[_0x2137c7(0x21c)]>0x0&&_0x594450<_0x3e6f5a){_0x594450++;const _0x4de615=[];for(const _0x132db6 of _0x400a41){if(canCreateAgent(_0x132db6,_0x5989ac)){const _0x5b202d=remapToolIds(_0x132db6['attributes'][_0x2137c7(0x172)],_0xbd2f46,_0x5989ac),_0x1c0672=remapVariableIds(_0x132db6['attributes'][_0x2137c7(0x1bd)],_0xbd2f46),_0x5d4076=await this[_0x2137c7(0x1c9)][_0x2137c7(0x131)]({'name':_0x132db6[_0x2137c7(0x19e)][_0x2137c7(0x1ff)],'projectId':_0x328823,'systemPrompt':_0x132db6['attributes'][_0x2137c7(0x200)],'starterMessage':_0x132db6[_0x2137c7(0x19e)][_0x2137c7(0x1bc)],'modelType':migrateModelType(_0x132db6['attributes']['modelType']),'maxToolIterations':_0x132db6[_0x2137c7(0x19e)][_0x2137c7(0x154)],'temperature':_0x132db6[_0x2137c7(0x19e)][_0x2137c7(0x1b6)],'reasoningEffort':_0x132db6['attributes'][_0x2137c7(0x1b9)],'outputs':_0x132db6[_0x2137c7(0x19e)]['outputs'],'tools':_0x5b202d,'variables':_0x1c0672});_0x5989ac[_0x2137c7(0x1f8)](_0x132db6['id'],_0x5d4076['id']);}else _0x4de615[_0x2137c7(0x13f)](_0x132db6);}if(_0x4de615[_0x2137c7(0x21c)]===_0x400a41[_0x2137c7(0x21c)])throw new SDKError(ErrorCode[_0x2137c7(0x165)],_0x2137c7(0x1d8),undefined,{'helpText':_0x2137c7(0x143)});_0x400a41['length']=0x0,_0x400a41['push'](..._0x4de615);}for(const _0x4b0c4e of _0x10f32c){const _0x46de01=_0x5989ac[_0x2137c7(0x1d3)](_0x4b0c4e[_0x2137c7(0x19e)][_0x2137c7(0x236)]);if(!_0x46de01)continue;const _0xbc012a=await this['client']['createPrompt']({'projectId':_0x328823,'agentId':_0x46de01,'name':_0x4b0c4e[_0x2137c7(0x19e)]['name'],'systemPrompt':_0x4b0c4e['attributes'][_0x2137c7(0x200)],'template':_0x4b0c4e['attributes'][_0x2137c7(0x185)],'jsonSchemaHint':_0x4b0c4e[_0x2137c7(0x19e)][_0x2137c7(0x1df)]});_0x1087a9[_0x2137c7(0x1f8)](_0x4b0c4e['id'],_0xbc012a['id']);}for(const _0x153199 of _0xf08f69){const _0x5d52b4=_0x153199[_0x2137c7(0x19e)][_0x2137c7(0x14e)]['map'](_0x6e766d=>({..._0x6e766d,'promptId':_0x1087a9[_0x2137c7(0x1d3)](_0x6e766d[_0x2137c7(0x1ba)])||_0x6e766d[_0x2137c7(0x1ba)]}));await this[_0x2137c7(0x1c9)][_0x2137c7(0x12f)]({'projectId':_0x328823,'serviceType':_0x153199['attributes']['serviceType'],'actions':_0x5d52b4,'slackMessageMode':_0x153199[_0x2137c7(0x19e)][_0x2137c7(0x139)],'chatIgnoreManagedActions':_0x153199['attributes'][_0x2137c7(0x19c)],'chatWelcomeMessage':_0x153199[_0x2137c7(0x19e)]['chatWelcomeMessage'],'webhookCorsOrigins':_0x153199['attributes'][_0x2137c7(0x14d)]});}return{'projectName':_0x33aba3,'projectId':_0x328823,'counts':{'agents':_0x5989ac['size'],'knowledgeBases':_0xbd2f46[_0x2137c7(0x1be)],'prompts':_0x1087a9[_0x2137c7(0x1be)],'integrations':_0xf08f69[_0x2137c7(0x21c)]},'sourceSite':_0x32edf6};}[a133_0x4f6d4d(0x1a7)](_0x5aa06a,_0x55fac7){const _0x2d0b51=a133_0x4f6d4d;if(!a133_0x1b52fe[_0x2d0b51(0x1cb)](_0x5aa06a))return _0x55fac7;return JSON[_0x2d0b51(0x1c8)](a133_0x1b52fe[_0x2d0b51(0x1c6)](_0x5aa06a,'utf-8'));}[a133_0x4f6d4d(0x1bf)](_0x327551){const _0x1d2da9=a133_0x4f6d4d;if(!a133_0x1b52fe[_0x1d2da9(0x1cb)](_0x327551))throw new SDKError(ErrorCode[_0x1d2da9(0x210)],_0x1d2da9(0x235)+_0x327551,undefined,{'helpText':_0x1d2da9(0x1dd)});const _0x2ab74d=a133_0x3324d2['join'](_0x327551,_0x1d2da9(0x195));if(!a133_0x1b52fe[_0x1d2da9(0x1cb)](_0x2ab74d))throw new SDKError(ErrorCode[_0x1d2da9(0x1c1)],'Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20'+_0x327551,undefined,{'helpText':_0x1d2da9(0x134)});const _0x5894ea=JSON[_0x1d2da9(0x1c8)](a133_0x1b52fe[_0x1d2da9(0x1c6)](_0x2ab74d,'utf-8'));if(!isSupportedBackupVersion(_0x5894ea[_0x1d2da9(0x140)]))throw new SDKError(ErrorCode[_0x1d2da9(0x1c1)],_0x1d2da9(0x1a6)+_0x5894ea[_0x1d2da9(0x140)],undefined,{'helpText':_0x1d2da9(0x229)});return _0x5894ea;}async['pullProject'](_0x2b5da6,_0x6c3c26,_0x35e5b5){const _0x3e19fd=a133_0x4f6d4d,{projectId:_0x3bdc67,project:_0x1afa9a}=await this[_0x3e19fd(0x187)](_0x2b5da6),_0x15a6db=_0x1afa9a['attributes']['name'];let _0x134c08;if(_0x6c3c26)_0x134c08=_0x6c3c26;else{const _0xa8cc45=a133_0x3324d2[_0x3e19fd(0x190)](process[_0x3e19fd(0x182)](),'agents'),_0x3e1b58=getSanitizedPathWithMigration(_0xa8cc45,_0x15a6db);_0x3e1b58['renamed']&&this[_0x3e19fd(0x147)][_0x3e19fd(0x133)](_0x3e19fd(0x1f3)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x3e1b58['oldPath'])+_0x3e19fd(0x12d)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x3e1b58[_0x3e19fd(0x174)])),_0x134c08=_0x3e1b58['path'];}const _0x3ae368=await this[_0x3e19fd(0x1c9)][_0x3e19fd(0x13b)](_0x3bdc67),_0xa95b82=await this['client']['listKnowledgeBases'](_0x3bdc67),_0x5b23de=await this[_0x3e19fd(0x1c9)][_0x3e19fd(0x231)](_0x3bdc67),_0x69e56e=await safeListOrEmpty(()=>this[_0x3e19fd(0x1c9)]['listImageGenerators'](_0x3bdc67)),_0x380e59=await safeListOrEmpty(()=>this['client'][_0x3e19fd(0x124)](_0x3bdc67)),_0x135e4e=await this[_0x3e19fd(0x1c9)][_0x3e19fd(0x158)](_0x3bdc67),_0x4bd04d=await this[_0x3e19fd(0x1c9)][_0x3e19fd(0x1d1)](_0x3bdc67),_0x3d4d22=await safeListOrEmpty(()=>this[_0x3e19fd(0x1c9)][_0x3e19fd(0x1fd)](_0x3bdc67)),_0x3b7bde=await safeListOrEmpty(()=>this[_0x3e19fd(0x1c9)][_0x3e19fd(0x23b)](_0x3bdc67)),_0x5d756e=await safeListOrEmpty(()=>this[_0x3e19fd(0x1c9)][_0x3e19fd(0x17d)](_0x3bdc67)),_0x14fee6=await safeListOrEmpty(()=>this['client']['listChatInterfaces'](_0x3bdc67)),_0x24d0ca=_0x4bd04d['filter'](_0x366d86=>!_0x366d86[_0x3e19fd(0x19e)][_0x3e19fd(0x1f7)]&&SAFE_INTEGRATION_TYPES[_0x3e19fd(0x17f)](_0x366d86[_0x3e19fd(0x19e)][_0x3e19fd(0x1ae)][_0x3e19fd(0x1d6)]())),_0x1db08c=new Map(),_0x340f90=new Map(),_0x2eb0a6=new Map(),_0x46dc91=new Map(),_0x20e2f7=new Map(),_0x52ce9f=new Map(),_0x209021=new Map();for(const _0x293294 of _0x3ae368){_0x1db08c['set'](_0x293294['id'],_0x293294[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)]);}for(const _0x18dfea of _0xa95b82){_0x340f90[_0x3e19fd(0x1f8)](_0x18dfea['id'],_0x18dfea[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)]);}for(const _0x2363ff of _0x5b23de){_0x2eb0a6[_0x3e19fd(0x1f8)](_0x2363ff['id'],_0x2363ff[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)]);}for(const _0x2e9682 of _0x69e56e){_0x46dc91['set'](_0x2e9682['id'],_0x2e9682['attributes'][_0x3e19fd(0x1ff)]);}for(const _0x2b3c55 of _0x380e59){_0x20e2f7[_0x3e19fd(0x1f8)](_0x2b3c55['id'],_0x2b3c55[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)]);}for(const _0x27a7e3 of _0x135e4e){_0x52ce9f[_0x3e19fd(0x1f8)](_0x27a7e3['id'],_0x27a7e3[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)]);}for(const _0x3e2550 of _0x3d4d22){_0x209021[_0x3e19fd(0x1f8)](_0x3e2550['id'],_0x3e2550['attributes']['name']);}const _0x3f648d={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x340f90,'TextKnowledgeBase':_0x2eb0a6,'Agent':_0x1db08c,'WebSearchTool':_0x20e2f7,'ImageGenerator':_0x46dc91,'ExperimentalKnowledgeBase':_0x209021}),'resolvePromptName':async _0x5bc8d0=>_0x52ce9f[_0x3e19fd(0x1d3)](_0x5bc8d0),'onWarning':_0x430275=>this[_0x3e19fd(0x147)][_0x3e19fd(0x206)](_0x430275)},_0x108d28={'projectName':_0x15a6db,'outputDir':_0x134c08,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'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},'formInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'chatInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0x5d7259=[],_0x36104c=[];for(const _0x1a09d7 of _0x3ae368){const _0x362666=getSanitizedPathWithMigration(_0x134c08,_0x1a09d7[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)]);_0x362666[_0x3e19fd(0x175)]&&this[_0x3e19fd(0x147)][_0x3e19fd(0x133)](_0x3e19fd(0x117)+a133_0x3324d2['basename'](_0x362666[_0x3e19fd(0x22f)])+_0x3e19fd(0x12d)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x362666[_0x3e19fd(0x174)]));const _0x3e09d8=_0x362666[_0x3e19fd(0x174)],_0x1cf1cd=a133_0x3324d2[_0x3e19fd(0x190)](_0x3e09d8,'prompt.md'),_0x565c0c=a133_0x3324d2[_0x3e19fd(0x190)](_0x3e09d8,_0x3e19fd(0x120)),_0x1b2c0a=a133_0x3324d2['join'](_0x3e09d8,'starter_message.md'),{yaml:_0x37a55d,systemPrompt:_0x15bca8,starterMessage:_0x381815}=await agentResponseToDef(_0x1a09d7,_0x3f648d),_0x31be85=toAgentYamlString(_0x37a55d),_0x544bc8=!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x565c0c);let _0x469820=_0x544bc8,_0x3d786f;if(!_0x544bc8){const _0x32227a=a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x1cf1cd)?a133_0x1b52fe['readFileSync'](_0x1cf1cd,_0x3e19fd(0x238)):'',_0x293947=a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x565c0c,_0x3e19fd(0x238)),_0x213141=_0x3e19fd(0x223)+_0x32227a+'\x0a\x0a#\x20agent.yml\x0a'+_0x293947,_0x3efe5b=_0x3e19fd(0x223)+_0x15bca8+_0x3e19fd(0x169)+_0x31be85,_0x38a425=generateDiff(_0x213141,_0x3efe5b);_0x469820=hasChanges(_0x38a425),_0x469820&&(_0x3d786f=formatDiffWithColors(_0x38a425));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x3e09d8,'content':'','isDir':!![]}),_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x1cf1cd,'content':_0x15bca8}),_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x565c0c,'content':_0x31be85});_0x381815&&_0x381815['includes']('\x0a')&&_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x1b2c0a,'content':_0x381815});_0x108d28[_0x3e19fd(0x1c3)][_0x3e19fd(0x13f)]({'agentName':_0x1a09d7[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'outputPath':_0x3e09d8,'isNew':_0x544bc8,'hasChanges':_0x469820,'diff':_0x3d786f}),_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1c3)][_0x3e19fd(0x168)]++;if(_0x544bc8)_0x108d28[_0x3e19fd(0x20a)]['agents']['new']++;else{if(_0x469820)_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1c3)][_0x3e19fd(0x233)]++;else _0x108d28['counts']['agents'][_0x3e19fd(0x19a)]++;}}for(const _0x22c03e of _0xa95b82){if(_0x22c03e[_0x3e19fd(0x19e)][_0x3e19fd(0x1f7)])continue;const _0x558241=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x134c08),_0x22c03e[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],_0x3e19fd(0x1eb));_0x558241[_0x3e19fd(0x175)]&&this['logger'][_0x3e19fd(0x133)]('Renamed\x20KB\x20file:\x20'+a133_0x3324d2[_0x3e19fd(0x20c)](_0x558241['oldPath'])+'\x20→\x20'+a133_0x3324d2[_0x3e19fd(0x20c)](_0x558241[_0x3e19fd(0x174)]));const _0x25e8f1=_0x558241[_0x3e19fd(0x174)],_0x276b67=apiKnowledgeBaseToYaml(_0x22c03e),_0x3c849a=toKnowledgeBaseYamlString(_0x276b67),_0x347746=!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x25e8f1);let _0x27ff7c=_0x347746,_0x145281;if(!_0x347746){const _0x4a4707=a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x25e8f1,'utf-8'),_0x1cdfee=generateDiff(_0x4a4707,_0x3c849a);_0x27ff7c=hasChanges(_0x1cdfee),_0x27ff7c&&(_0x145281=formatDiffWithColors(_0x1cdfee));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x25e8f1,'content':_0x3c849a}),_0x108d28[_0x3e19fd(0x1d0)][_0x3e19fd(0x13f)]({'name':_0x22c03e[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'outputPath':_0x25e8f1,'isNew':_0x347746,'hasChanges':_0x27ff7c,'diff':_0x145281}),_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1d0)][_0x3e19fd(0x168)]++;if(_0x347746)_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1d0)][_0x3e19fd(0x1b3)]++;else{if(_0x27ff7c)_0x108d28['counts'][_0x3e19fd(0x1d0)][_0x3e19fd(0x233)]++;else _0x108d28[_0x3e19fd(0x20a)]['knowledgeBases'][_0x3e19fd(0x19a)]++;}}for(const _0x48d140 of _0x5b23de){if(_0x48d140['attributes']['isManaged'])continue;const _0x5cd432=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x134c08),_0x48d140[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],_0x3e19fd(0x150));_0x5cd432[_0x3e19fd(0x175)]&&this[_0x3e19fd(0x147)][_0x3e19fd(0x133)](_0x3e19fd(0x1d7)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x5cd432[_0x3e19fd(0x22f)])+_0x3e19fd(0x12d)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x5cd432[_0x3e19fd(0x174)]));const _0x59ca3a=_0x5cd432[_0x3e19fd(0x174)],_0x11979d=toTextKnowledgeBaseMd(_0x48d140[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],_0x48d140['attributes'][_0x3e19fd(0x21a)]),_0x4da1a7=!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x59ca3a);let _0x1fba90=_0x4da1a7,_0x3ce130;if(!_0x4da1a7){const _0x4cea46=a133_0x1b52fe['readFileSync'](_0x59ca3a,_0x3e19fd(0x238)),_0x291bc9=generateDiff(_0x4cea46,_0x11979d);_0x1fba90=hasChanges(_0x291bc9),_0x1fba90&&(_0x3ce130=formatDiffWithColors(_0x291bc9));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x59ca3a,'content':_0x11979d}),_0x108d28[_0x3e19fd(0x23a)]['push']({'name':_0x48d140[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'outputPath':_0x59ca3a,'isNew':_0x4da1a7,'hasChanges':_0x1fba90,'diff':_0x3ce130}),_0x108d28['counts']['textKnowledgeBases'][_0x3e19fd(0x168)]++;if(_0x4da1a7)_0x108d28['counts'][_0x3e19fd(0x23a)]['new']++;else{if(_0x1fba90)_0x108d28['counts']['textKnowledgeBases'][_0x3e19fd(0x233)]++;else _0x108d28['counts'][_0x3e19fd(0x23a)]['unchanged']++;}}for(const _0x36d1df of _0x135e4e){if(_0x36d1df[_0x3e19fd(0x19e)]['isManaged'])continue;const _0x391acc=getSanitizedPathWithMigration(getPromptsDir(_0x134c08),_0x36d1df[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'.yml');_0x391acc[_0x3e19fd(0x175)]&&this[_0x3e19fd(0x147)][_0x3e19fd(0x133)](_0x3e19fd(0x232)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x391acc[_0x3e19fd(0x22f)])+_0x3e19fd(0x12d)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x391acc[_0x3e19fd(0x174)]));const _0x389d3a=_0x391acc[_0x3e19fd(0x174)],_0x68988c=await apiPromptToYaml(_0x36d1df,_0x3f648d);if(!_0x68988c)continue;const _0xafc415=toPromptYamlString(_0x68988c),_0x25dc05=!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x389d3a);let _0x1cf562=_0x25dc05,_0x5469ff;if(!_0x25dc05){const _0x1f6002=a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x389d3a,_0x3e19fd(0x238)),_0x51fdc1=generateDiff(_0x1f6002,_0xafc415);_0x1cf562=hasChanges(_0x51fdc1),_0x1cf562&&(_0x5469ff=formatDiffWithColors(_0x51fdc1));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x389d3a,'content':_0xafc415}),_0x108d28[_0x3e19fd(0x1ad)][_0x3e19fd(0x13f)]({'name':_0x36d1df[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'outputPath':_0x389d3a,'isNew':_0x25dc05,'hasChanges':_0x1cf562,'diff':_0x5469ff}),_0x108d28['counts'][_0x3e19fd(0x1ad)]['total']++;if(_0x25dc05)_0x108d28['counts'][_0x3e19fd(0x1ad)][_0x3e19fd(0x1b3)]++;else{if(_0x1cf562)_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1ad)][_0x3e19fd(0x233)]++;else _0x108d28['counts'][_0x3e19fd(0x1ad)]['unchanged']++;}}for(const _0x2da128 of _0x24d0ca){const _0x45e964=_0x2da128[_0x3e19fd(0x19e)][_0x3e19fd(0x1ae)]['toLowerCase'](),_0x48c884=getSanitizedPathWithMigration(getIntegrationsDir(_0x134c08),_0x45e964,'.yml');_0x48c884[_0x3e19fd(0x175)]&&this[_0x3e19fd(0x147)][_0x3e19fd(0x133)](_0x3e19fd(0x1aa)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x48c884[_0x3e19fd(0x22f)])+_0x3e19fd(0x12d)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x48c884[_0x3e19fd(0x174)]));const _0x2a67c8=_0x48c884[_0x3e19fd(0x174)],_0x294c18=await apiIntegrationToYaml(_0x2da128,_0x3f648d),_0x61d21a=toIntegrationYamlString(_0x294c18),_0x35ecfa=!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x2a67c8);let _0x157b7e=_0x35ecfa,_0x58620d;if(!_0x35ecfa){const _0x499f9b=a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x2a67c8,_0x3e19fd(0x238)),_0x298d69=generateDiff(_0x499f9b,_0x61d21a);_0x157b7e=hasChanges(_0x298d69),_0x157b7e&&(_0x58620d=formatDiffWithColors(_0x298d69));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x2a67c8,'content':_0x61d21a}),_0x108d28[_0x3e19fd(0x17c)]['push']({'name':_0x45e964,'outputPath':_0x2a67c8,'isNew':_0x35ecfa,'hasChanges':_0x157b7e,'diff':_0x58620d}),_0x108d28['counts'][_0x3e19fd(0x17c)]['total']++;if(_0x35ecfa)_0x108d28[_0x3e19fd(0x20a)]['integrations'][_0x3e19fd(0x1b3)]++;else{if(_0x157b7e)_0x108d28['counts'][_0x3e19fd(0x17c)][_0x3e19fd(0x233)]++;else _0x108d28[_0x3e19fd(0x20a)]['integrations'][_0x3e19fd(0x19a)]++;}}for(const _0x5dc5c5 of _0x3d4d22){if(_0x5dc5c5[_0x3e19fd(0x19e)]['isManaged'])continue;const _0x1f41c2=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x134c08),_0x5dc5c5[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)]);_0x1f41c2[_0x3e19fd(0x175)]&&this[_0x3e19fd(0x147)][_0x3e19fd(0x133)](_0x3e19fd(0x20d)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x1f41c2[_0x3e19fd(0x22f)])+_0x3e19fd(0x12d)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x1f41c2[_0x3e19fd(0x174)]));const _0x304784=_0x1f41c2['path'],_0x5d3fcb=a133_0x3324d2['join'](_0x304784,sanitizeForFilesystem(_0x5dc5c5[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)])+_0x3e19fd(0x1eb)),_0x189fc1=a133_0x3324d2['join'](_0x304784,_0x3e19fd(0x17a)),_0x1f3906=apiExperimentalKnowledgeBaseToYaml(_0x5dc5c5),_0x4f633b=toExperimentalKnowledgeBaseYamlString(_0x1f3906),_0x5acdc9=!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x304784);let _0x3539aa=_0x5acdc9,_0x284f3d,_0x40569b=_0x4f633b;const _0x544090=[..._0x1f3906['functions']][_0x3e19fd(0x215)]((_0x33817,_0x3caf8b)=>_0x33817[_0x3e19fd(0x1ff)][_0x3e19fd(0x129)](_0x3caf8b[_0x3e19fd(0x1ff)]));for(const _0x5a68ce of _0x544090){_0x40569b+=_0x3e19fd(0x17b)+_0x5a68ce[_0x3e19fd(0x1ff)]+_0x3e19fd(0x1a8)+_0x5a68ce[_0x3e19fd(0x16b)]+_0x3e19fd(0x142)+_0x5a68ce[_0x3e19fd(0x1ff)]+_0x3e19fd(0x1a8)+_0x5a68ce[_0x3e19fd(0x1fb)]+'\x0a';}if(!_0x5acdc9){let _0x428867='';a133_0x1b52fe['existsSync'](_0x5d3fcb)&&(_0x428867=a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x5d3fcb,_0x3e19fd(0x238)));if(a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x189fc1)){const _0x1e5be9=a133_0x1b52fe[_0x3e19fd(0x164)](_0x189fc1,{'withFileTypes':!![]}),_0x31a00f=_0x1e5be9[_0x3e19fd(0x20e)](_0x517220=>_0x517220[_0x3e19fd(0x16c)]())[_0x3e19fd(0x215)]((_0x4b4596,_0x6ce7b)=>_0x4b4596[_0x3e19fd(0x1ff)]['localeCompare'](_0x6ce7b[_0x3e19fd(0x1ff)]));for(const _0x5d9b5c of _0x31a00f){const _0x3c04b7=a133_0x3324d2[_0x3e19fd(0x190)](_0x189fc1,_0x5d9b5c['name'],_0x3e19fd(0x1db)),_0x315c11=a133_0x3324d2[_0x3e19fd(0x190)](_0x189fc1,_0x5d9b5c[_0x3e19fd(0x1ff)],_0x3e19fd(0x216));a133_0x1b52fe['existsSync'](_0x3c04b7)&&(_0x428867+=_0x3e19fd(0x17b)+_0x5d9b5c[_0x3e19fd(0x1ff)]+_0x3e19fd(0x1a8)+a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x3c04b7,_0x3e19fd(0x238))+'\x0a'),a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x315c11)&&(_0x428867+=_0x3e19fd(0x198)+_0x5d9b5c[_0x3e19fd(0x1ff)]+_0x3e19fd(0x1a8)+a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x315c11,_0x3e19fd(0x238))+'\x0a');}}const _0x34a0c5=generateDiff(_0x428867,_0x40569b);_0x3539aa=hasChanges(_0x34a0c5),_0x3539aa&&(_0x284f3d=formatDiffWithColors(_0x34a0c5));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x304784,'content':'','isDir':!![]}),_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x5d3fcb,'content':_0x4f633b}),_0x5d7259['push']({'path':_0x189fc1,'content':'','isDir':!![]});for(const _0x40df31 of _0x1f3906['functions']){const _0x51f047=a133_0x3324d2['join'](_0x189fc1,sanitizeForFilesystem(_0x40df31[_0x3e19fd(0x1ff)])),_0x445b25=a133_0x3324d2[_0x3e19fd(0x190)](_0x51f047,_0x3e19fd(0x1db)),_0x3f70be=a133_0x3324d2[_0x3e19fd(0x190)](_0x51f047,_0x3e19fd(0x216));_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x51f047,'content':'','isDir':!![]}),_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x445b25,'content':_0x40df31[_0x3e19fd(0x16b)]}),_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x3f70be,'content':_0x40df31[_0x3e19fd(0x1fb)]});}if(a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x189fc1)){const _0x2b577a=a133_0x1b52fe[_0x3e19fd(0x164)](_0x189fc1,{'withFileTypes':!![]}),_0x1c466d=new Set(_0x1f3906[_0x3e19fd(0x17a)][_0x3e19fd(0x1a3)](_0x1aac02=>sanitizeForFilesystem(_0x1aac02['name'])));for(const _0x2109d4 of _0x2b577a){if(_0x2109d4[_0x3e19fd(0x16c)]()&&!_0x1c466d['has'](_0x2109d4[_0x3e19fd(0x1ff)])){const _0x5a9606=a133_0x3324d2[_0x3e19fd(0x190)](_0x189fc1,_0x2109d4[_0x3e19fd(0x1ff)]);_0x36104c[_0x3e19fd(0x13f)]({'path':_0x5a9606,'isDir':!![]});}}}_0x108d28[_0x3e19fd(0x192)][_0x3e19fd(0x13f)]({'name':_0x5dc5c5[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'outputPath':_0x304784,'isNew':_0x5acdc9,'hasChanges':_0x3539aa,'diff':_0x284f3d}),_0x108d28['counts'][_0x3e19fd(0x192)][_0x3e19fd(0x168)]++;if(_0x5acdc9)_0x108d28['counts'][_0x3e19fd(0x192)][_0x3e19fd(0x1b3)]++;else{if(_0x3539aa)_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x192)][_0x3e19fd(0x233)]++;else _0x108d28[_0x3e19fd(0x20a)]['experimentalKnowledgeBases'][_0x3e19fd(0x19a)]++;}}for(const _0x48895c of _0x3b7bde){if(_0x48895c[_0x3e19fd(0x19e)][_0x3e19fd(0x1f7)])continue;const _0x5e17ab=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x134c08),_0x48895c['attributes'][_0x3e19fd(0x1ff)]);_0x5e17ab[_0x3e19fd(0x175)]&&this[_0x3e19fd(0x147)][_0x3e19fd(0x133)](_0x3e19fd(0x1c4)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x5e17ab['oldPath'])+'\x20→\x20'+a133_0x3324d2['basename'](_0x5e17ab[_0x3e19fd(0x174)]));const _0x183d71=_0x5e17ab[_0x3e19fd(0x174)],_0x58f330=a133_0x3324d2[_0x3e19fd(0x190)](_0x183d71,sanitizeForFilesystem(_0x48895c['attributes'][_0x3e19fd(0x1ff)])+_0x3e19fd(0x1eb)),_0x33fa81=a133_0x3324d2['join'](_0x183d71,'code.js'),_0x185ef3=a133_0x3324d2[_0x3e19fd(0x190)](_0x183d71,_0x3e19fd(0x11e)),_0x410211=apiExperimentalArtifactToYaml(_0x48895c),_0x393a94=toExperimentalArtifactYamlString(_0x410211),_0x5f00fe=!a133_0x1b52fe['existsSync'](_0x183d71);let _0x95479b=_0x5f00fe,_0x3f7647,_0x155397=_0x393a94+(_0x3e19fd(0x1a5)+_0x410211[_0x3e19fd(0x16b)]+'\x0a');const _0x51e7f3=[..._0x410211[_0x3e19fd(0x11e)]][_0x3e19fd(0x215)]((_0x531e86,_0x1086d0)=>_0x531e86[_0x3e19fd(0x16d)]['localeCompare'](_0x1086d0[_0x3e19fd(0x16d)]));for(const _0x49aac0 of _0x51e7f3){_0x155397+='---\x20file:\x20'+_0x49aac0[_0x3e19fd(0x16d)]+_0x3e19fd(0x1a8)+_0x49aac0[_0x3e19fd(0x230)]+'\x0a';}if(!_0x5f00fe){let _0x5d3873='';a133_0x1b52fe['existsSync'](_0x58f330)&&(_0x5d3873=a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x58f330,'utf-8'));a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x33fa81)&&(_0x5d3873+=_0x3e19fd(0x1a5)+a133_0x1b52fe['readFileSync'](_0x33fa81,_0x3e19fd(0x238))+'\x0a');if(a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x185ef3)){const _0x249eda=a133_0x1b52fe[_0x3e19fd(0x164)](_0x185ef3),_0x3dd6e2=_0x249eda[_0x3e19fd(0x20e)](_0xb0c780=>{const _0xfdf91a=_0x3e19fd,_0x5567b8=a133_0x3324d2['join'](_0x185ef3,_0xb0c780);return a133_0x1b52fe[_0xfdf91a(0x1b5)](_0x5567b8)[_0xfdf91a(0x167)]();})[_0x3e19fd(0x215)]((_0x54acc4,_0x234d74)=>_0x54acc4[_0x3e19fd(0x129)](_0x234d74));for(const _0x10b98d of _0x3dd6e2){const _0x452108=a133_0x3324d2[_0x3e19fd(0x190)](_0x185ef3,_0x10b98d);_0x5d3873+=_0x3e19fd(0x162)+_0x10b98d+_0x3e19fd(0x1a8)+a133_0x1b52fe['readFileSync'](_0x452108,'utf-8')+'\x0a';}}const _0x588b0f=generateDiff(_0x5d3873,_0x155397);_0x95479b=hasChanges(_0x588b0f),_0x95479b&&(_0x3f7647=formatDiffWithColors(_0x588b0f));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x183d71,'content':'','isDir':!![]}),_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x58f330,'content':_0x393a94}),_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x33fa81,'content':_0x410211[_0x3e19fd(0x16b)]});if(_0x410211['files']['length']>0x0){_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x185ef3,'content':'','isDir':!![]});for(const _0x204066 of _0x410211[_0x3e19fd(0x11e)]){const _0x587e60=a133_0x3324d2[_0x3e19fd(0x190)](_0x185ef3,_0x204066[_0x3e19fd(0x16d)]);_0x5d7259['push']({'path':_0x587e60,'content':_0x204066[_0x3e19fd(0x230)]});}}if(a133_0x1b52fe['existsSync'](_0x185ef3)){const _0x2312cc=a133_0x1b52fe['readdirSync'](_0x185ef3),_0x27d2ef=new Set(_0x410211[_0x3e19fd(0x11e)][_0x3e19fd(0x1a3)](_0x423d88=>_0x423d88[_0x3e19fd(0x16d)]));for(const _0x123e33 of _0x2312cc){const _0x2fe51e=a133_0x3324d2['join'](_0x185ef3,_0x123e33);a133_0x1b52fe[_0x3e19fd(0x1b5)](_0x2fe51e)['isFile']()&&!_0x27d2ef[_0x3e19fd(0x14f)](_0x123e33)&&_0x36104c[_0x3e19fd(0x13f)]({'path':_0x2fe51e});}}_0x108d28[_0x3e19fd(0x1f9)][_0x3e19fd(0x13f)]({'name':_0x48895c[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'outputPath':_0x183d71,'isNew':_0x5f00fe,'hasChanges':_0x95479b,'diff':_0x3f7647}),_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1f9)][_0x3e19fd(0x168)]++;if(_0x5f00fe)_0x108d28['counts'][_0x3e19fd(0x1f9)][_0x3e19fd(0x1b3)]++;else{if(_0x95479b)_0x108d28['counts'][_0x3e19fd(0x1f9)][_0x3e19fd(0x233)]++;else _0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1f9)][_0x3e19fd(0x19a)]++;}}for(const _0x162122 of _0x5d756e){const _0x469064=getSanitizedPathWithMigration(getFormInterfacesDir(_0x134c08),_0x162122[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],_0x3e19fd(0x1eb));_0x469064[_0x3e19fd(0x175)]&&this[_0x3e19fd(0x147)][_0x3e19fd(0x133)](_0x3e19fd(0x160)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x469064[_0x3e19fd(0x22f)])+_0x3e19fd(0x12d)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x469064[_0x3e19fd(0x174)]));const _0x5a5410=_0x469064[_0x3e19fd(0x174)],_0xf9f9bc=await apiFormInterfaceToYaml(_0x162122,_0x3f648d),_0x446b14=toFormInterfaceYamlString(_0xf9f9bc),_0x46b4e8=!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x5a5410);let _0x396661=_0x46b4e8,_0x1ff93e;if(!_0x46b4e8){const _0x1aa144=a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x5a5410,_0x3e19fd(0x238)),_0x4e3d35=generateDiff(_0x1aa144,_0x446b14);_0x396661=hasChanges(_0x4e3d35),_0x396661&&(_0x1ff93e=formatDiffWithColors(_0x4e3d35));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x5a5410,'content':_0x446b14}),_0x108d28[_0x3e19fd(0x1dc)][_0x3e19fd(0x13f)]({'name':_0x162122[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'outputPath':_0x5a5410,'isNew':_0x46b4e8,'hasChanges':_0x396661,'diff':_0x1ff93e}),_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1dc)]['total']++;if(_0x46b4e8)_0x108d28['counts'][_0x3e19fd(0x1dc)][_0x3e19fd(0x1b3)]++;else{if(_0x396661)_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1dc)]['updated']++;else _0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1dc)][_0x3e19fd(0x19a)]++;}}for(const _0x54be0b of _0x14fee6){if(_0x54be0b['attributes'][_0x3e19fd(0x1f7)])continue;const _0x3dfb78=getSanitizedPathWithMigration(getChatInterfacesDir(_0x134c08),_0x54be0b[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],_0x3e19fd(0x1eb));_0x3dfb78[_0x3e19fd(0x175)]&&this[_0x3e19fd(0x147)]['info'](_0x3e19fd(0x138)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x3dfb78[_0x3e19fd(0x22f)])+_0x3e19fd(0x12d)+a133_0x3324d2['basename'](_0x3dfb78['path']));const _0x39a758=_0x3dfb78[_0x3e19fd(0x174)],_0xa44f90=await apiChatInterfaceToYaml(_0x54be0b,_0x3f648d),_0x4a6ec4=toChatInterfaceYamlString(_0xa44f90),_0x2eb16a=!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x39a758);let _0x2bc44e=_0x2eb16a,_0x306f3d;if(!_0x2eb16a){const _0x5d4ffe=a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x39a758,'utf-8'),_0x27e9e7=generateDiff(_0x5d4ffe,_0x4a6ec4);_0x2bc44e=hasChanges(_0x27e9e7),_0x2bc44e&&(_0x306f3d=formatDiffWithColors(_0x27e9e7));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x39a758,'content':_0x4a6ec4}),_0x108d28['chatInterfaces'][_0x3e19fd(0x13f)]({'name':_0x54be0b[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'outputPath':_0x39a758,'isNew':_0x2eb16a,'hasChanges':_0x2bc44e,'diff':_0x306f3d}),_0x108d28[_0x3e19fd(0x20a)]['chatInterfaces']['total']++;if(_0x2eb16a)_0x108d28['counts']['chatInterfaces'][_0x3e19fd(0x1b3)]++;else{if(_0x2bc44e)_0x108d28[_0x3e19fd(0x20a)]['chatInterfaces'][_0x3e19fd(0x233)]++;else _0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1e4)][_0x3e19fd(0x19a)]++;}}if(_0x35e5b5?.['dryRun'])return _0x108d28;a133_0x1b52fe[_0x3e19fd(0x121)](_0x134c08,{'recursive':!![]}),a133_0x1b52fe[_0x3e19fd(0x121)](getKnowledgeBasesDir(_0x134c08),{'recursive':!![]}),a133_0x1b52fe[_0x3e19fd(0x121)](getPromptsDir(_0x134c08),{'recursive':!![]}),a133_0x1b52fe[_0x3e19fd(0x121)](getIntegrationsDir(_0x134c08),{'recursive':!![]}),a133_0x1b52fe[_0x3e19fd(0x121)](getExperimentalKnowledgeBasesDir(_0x134c08),{'recursive':!![]}),a133_0x1b52fe['mkdirSync'](getExperimentalArtifactsDir(_0x134c08),{'recursive':!![]}),a133_0x1b52fe[_0x3e19fd(0x121)](getFormInterfacesDir(_0x134c08),{'recursive':!![]}),a133_0x1b52fe[_0x3e19fd(0x121)](getChatInterfacesDir(_0x134c08),{'recursive':!![]});const _0x43dc16=a133_0x3324d2[_0x3e19fd(0x190)](_0x134c08,'tdx.json');a133_0x1b52fe[_0x3e19fd(0x207)](_0x43dc16,createAgentConfigContent(_0x15a6db));for(const _0x3fb72d of _0x5d7259){if(_0x3fb72d[_0x3e19fd(0x15b)])a133_0x1b52fe[_0x3e19fd(0x121)](_0x3fb72d[_0x3e19fd(0x174)],{'recursive':!![]});else{const _0x16e3fb=a133_0x3324d2[_0x3e19fd(0x1d5)](_0x3fb72d[_0x3e19fd(0x174)]);!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x16e3fb)&&a133_0x1b52fe[_0x3e19fd(0x121)](_0x16e3fb,{'recursive':!![]}),a133_0x1b52fe[_0x3e19fd(0x207)](_0x3fb72d[_0x3e19fd(0x174)],_0x3fb72d[_0x3e19fd(0x225)]);}}for(const _0x56444b of _0x36104c){_0x56444b[_0x3e19fd(0x15b)]?(a133_0x1b52fe[_0x3e19fd(0x163)](_0x56444b[_0x3e19fd(0x174)],{'recursive':!![],'force':!![]}),this[_0x3e19fd(0x147)][_0x3e19fd(0x133)]('Removed\x20deleted\x20directory:\x20'+a133_0x3324d2[_0x3e19fd(0x20c)](a133_0x3324d2[_0x3e19fd(0x1d5)](_0x56444b[_0x3e19fd(0x174)]))+'/'+a133_0x3324d2['basename'](_0x56444b[_0x3e19fd(0x174)]))):(a133_0x1b52fe[_0x3e19fd(0x163)](_0x56444b['path'],{'force':!![]}),this['logger'][_0x3e19fd(0x133)]('Removed\x20deleted\x20file:\x20'+a133_0x3324d2[_0x3e19fd(0x20c)](a133_0x3324d2[_0x3e19fd(0x1d5)](_0x56444b[_0x3e19fd(0x174)]))+'/'+a133_0x3324d2[_0x3e19fd(0x20c)](_0x56444b['path'])));}return _0x108d28;}async[a133_0x4f6d4d(0x14c)](_0xcdbcc3,_0x4b166b){const _0x31f468=a133_0x4f6d4d,_0x5a362e=a133_0x3324d2['join'](_0xcdbcc3,_0x31f468(0x17e));if(!a133_0x1b52fe['existsSync'](_0x5a362e))throw new SDKError(ErrorCode[_0x31f468(0x1c1)],'No\x20tdx.json\x20found\x20in\x20'+_0xcdbcc3,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x3e4021=loadAgentConfig(_0x5a362e),_0x519efd=await this[_0x31f468(0x197)](_0x3e4021[_0x31f468(0x1b4)]),_0x2552eb=await this[_0x31f468(0x1c9)]['getProject'](_0x519efd),_0x5d1366=_0x2552eb[_0x31f468(0x19e)][_0x31f468(0x1ff)],_0xdd789a={'projectName':_0x5d1366,'projectId':_0x519efd,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'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},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x2d3438=[],_0x3dbd24=[],_0x1ac634=[],_0x5a1eca=[],_0x383c8b=[],_0xa4637c=[],_0x458b71=a133_0x1b52fe[_0x31f468(0x164)](_0xcdbcc3,{'withFileTypes':!![]});for(const _0x2520bd of _0x458b71){if(!_0x2520bd[_0x31f468(0x16c)]())continue;if([_0x31f468(0x126),_0x31f468(0x1ad),_0x31f468(0x17c),_0x31f468(0x1ee),_0x31f468(0x21d),'form_interfaces',_0x31f468(0x148)][_0x31f468(0x17f)](_0x2520bd['name']))continue;const _0x2a3a97=a133_0x3324d2['join'](_0xcdbcc3,_0x2520bd[_0x31f468(0x1ff)]);if(isAgentDir(_0x2a3a97)){const _0x433157=a133_0x3324d2[_0x31f468(0x190)](_0x2a3a97,_0x31f468(0x120)),_0x50f442=a133_0x3324d2[_0x31f468(0x190)](_0x2a3a97,_0x31f468(0x13a)),_0x982e29=a133_0x3324d2[_0x31f468(0x190)](_0x2a3a97,_0x31f468(0x194)),_0x43548f=parseAgentYaml(a133_0x1b52fe['readFileSync'](_0x433157,_0x31f468(0x238)),_0x433157),_0x7be0bc=a133_0x1b52fe[_0x31f468(0x1cb)](_0x50f442)?a133_0x1b52fe[_0x31f468(0x1c6)](_0x50f442,_0x31f468(0x238)):'',_0x25f119=a133_0x1b52fe[_0x31f468(0x1cb)](_0x982e29)?a133_0x1b52fe[_0x31f468(0x1c6)](_0x982e29,'utf-8'):_0x43548f[_0x31f468(0x20b)];_0x2d3438[_0x31f468(0x13f)]({'name':_0x43548f[_0x31f468(0x1ff)],'dir':_0x2a3a97,'yaml':_0x43548f,'systemPrompt':_0x7be0bc,'starterMessage':_0x25f119});}}const _0x2df3d1=getKnowledgeBasesDir(_0xcdbcc3);if(a133_0x1b52fe[_0x31f468(0x1cb)](_0x2df3d1)){const _0x2eb8f3=a133_0x1b52fe[_0x31f468(0x164)](_0x2df3d1);for(const _0x4f0251 of _0x2eb8f3){const _0x191a4a=a133_0x3324d2['join'](_0x2df3d1,_0x4f0251);if(_0x4f0251[_0x31f468(0x218)](_0x31f468(0x1eb))){const _0x2bb0e3=parseKnowledgeBaseYaml(a133_0x1b52fe['readFileSync'](_0x191a4a,_0x31f468(0x238)),_0x191a4a);_0x3dbd24[_0x31f468(0x13f)]({'name':_0x2bb0e3[_0x31f468(0x1ff)],'path':_0x191a4a,'yaml':_0x2bb0e3});}else{if(_0x4f0251[_0x31f468(0x218)]('.md')){const _0x2d6aca=a133_0x1b52fe[_0x31f468(0x1c6)](_0x191a4a,_0x31f468(0x238)),{name:_0x4505a5,text:_0x3b9783}=parseTextKnowledgeBaseMd(_0x2d6aca,_0x4f0251);_0x1ac634['push']({'name':_0x4505a5,'path':_0x191a4a,'text':_0x3b9783});}}}}const _0x5af0ab=getPromptsDir(_0xcdbcc3);if(a133_0x1b52fe['existsSync'](_0x5af0ab)){const _0x4c376c=a133_0x1b52fe['readdirSync'](_0x5af0ab)[_0x31f468(0x20e)](_0x2b129a=>_0x2b129a['endsWith']('.yml'));for(const _0x4da217 of _0x4c376c){const _0x5a48eb=a133_0x3324d2[_0x31f468(0x190)](_0x5af0ab,_0x4da217),_0x1aa63d=parsePromptYaml(a133_0x1b52fe[_0x31f468(0x1c6)](_0x5a48eb,_0x31f468(0x238)),_0x5a48eb);_0x5a1eca[_0x31f468(0x13f)]({'name':_0x1aa63d['name'],'path':_0x5a48eb,'yaml':_0x1aa63d});}}const _0x636a0f=[],_0xc28ba8=getIntegrationsDir(_0xcdbcc3);if(a133_0x1b52fe[_0x31f468(0x1cb)](_0xc28ba8)){const _0x4ecb77=a133_0x1b52fe[_0x31f468(0x164)](_0xc28ba8)['filter'](_0x590d01=>_0x590d01[_0x31f468(0x218)](_0x31f468(0x1eb)));for(const _0x22ccbb of _0x4ecb77){const _0x34e3ae=a133_0x3324d2[_0x31f468(0x190)](_0xc28ba8,_0x22ccbb),_0x174f71=parseIntegrationYaml(a133_0x1b52fe[_0x31f468(0x1c6)](_0x34e3ae,_0x31f468(0x238)),_0x34e3ae);if(!SAFE_INTEGRATION_TYPES['includes'](_0x174f71[_0x31f468(0x1fa)]['toLowerCase']())){this[_0x31f468(0x147)][_0x31f468(0x206)](_0x31f468(0x1a9)+_0x174f71[_0x31f468(0x1ff)]+'\x27\x20('+_0x174f71[_0x31f468(0x1fa)]+_0x31f468(0x1ec)+(_0x31f468(0x1c5)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x31f468(0x222))+_0x31f468(0x15f));continue;}_0x636a0f[_0x31f468(0x13f)]({'name':_0x174f71[_0x31f468(0x1ff)],'path':_0x34e3ae,'yaml':_0x174f71});}}const _0x553fdf=getExperimentalKnowledgeBasesDir(_0xcdbcc3);if(a133_0x1b52fe[_0x31f468(0x1cb)](_0x553fdf)){const _0x37874a=a133_0x1b52fe[_0x31f468(0x164)](_0x553fdf,{'withFileTypes':!![]});for(const _0x2a0019 of _0x37874a){if(!_0x2a0019[_0x31f468(0x16c)]())continue;const _0xf213df=a133_0x3324d2[_0x31f468(0x190)](_0x553fdf,_0x2a0019[_0x31f468(0x1ff)]),_0x171e33=a133_0x3324d2['join'](_0xf213df,_0x2a0019['name']+_0x31f468(0x1eb)),_0x3de09a=a133_0x3324d2[_0x31f468(0x190)](_0xf213df,_0x31f468(0x17a));if(!a133_0x1b52fe[_0x31f468(0x1cb)](_0x171e33))continue;const _0xc556ee=parseExperimentalKnowledgeBaseYaml(a133_0x1b52fe[_0x31f468(0x1c6)](_0x171e33,_0x31f468(0x238)),_0x171e33),_0x51ecab=[];if(a133_0x1b52fe[_0x31f468(0x1cb)](_0x3de09a)){const _0x370c3a=a133_0x1b52fe[_0x31f468(0x164)](_0x3de09a,{'withFileTypes':!![]});for(const _0x334821 of _0x370c3a){if(!_0x334821[_0x31f468(0x16c)]())continue;const _0x5ae550=a133_0x3324d2['join'](_0x3de09a,_0x334821['name']),_0xfbbd63=a133_0x3324d2[_0x31f468(0x190)](_0x5ae550,_0x31f468(0x1db)),_0x395975=a133_0x3324d2[_0x31f468(0x190)](_0x5ae550,_0x31f468(0x216));a133_0x1b52fe['existsSync'](_0xfbbd63)&&a133_0x1b52fe[_0x31f468(0x1cb)](_0x395975)&&_0x51ecab[_0x31f468(0x13f)]({'name':_0x334821[_0x31f468(0x1ff)],'code':a133_0x1b52fe[_0x31f468(0x1c6)](_0xfbbd63,_0x31f468(0x238)),'json_schema':a133_0x1b52fe[_0x31f468(0x1c6)](_0x395975,_0x31f468(0x238))});}}const _0x5b7ce6={..._0xc556ee,'variables':_0xc556ee[_0x31f468(0x1bd)]||[],'functions':_0x51ecab};_0x383c8b[_0x31f468(0x13f)]({'name':_0xc556ee[_0x31f468(0x1ff)],'dir':_0xf213df,'def':_0x5b7ce6});}}const _0x3dd733=getExperimentalArtifactsDir(_0xcdbcc3);if(a133_0x1b52fe[_0x31f468(0x1cb)](_0x3dd733)){const _0x2f16d0=a133_0x1b52fe[_0x31f468(0x164)](_0x3dd733,{'withFileTypes':!![]});for(const _0x30574c of _0x2f16d0){if(!_0x30574c[_0x31f468(0x16c)]())continue;const _0x530e07=a133_0x3324d2['join'](_0x3dd733,_0x30574c[_0x31f468(0x1ff)]),_0x2e11e9=a133_0x3324d2[_0x31f468(0x190)](_0x530e07,_0x30574c[_0x31f468(0x1ff)]+_0x31f468(0x1eb)),_0xe0f59f=a133_0x3324d2['join'](_0x530e07,'code.js'),_0x3650cf=a133_0x3324d2[_0x31f468(0x190)](_0x530e07,_0x31f468(0x11e));if(!a133_0x1b52fe[_0x31f468(0x1cb)](_0x2e11e9)||!a133_0x1b52fe[_0x31f468(0x1cb)](_0xe0f59f))continue;const _0x1dc168=parseExperimentalArtifactYaml(a133_0x1b52fe[_0x31f468(0x1c6)](_0x2e11e9,_0x31f468(0x238)),_0x2e11e9),_0x24806a=a133_0x1b52fe[_0x31f468(0x1c6)](_0xe0f59f,_0x31f468(0x238)),_0x50f7de=[];if(a133_0x1b52fe[_0x31f468(0x1cb)](_0x3650cf)){const _0x45e7b3=a133_0x1b52fe[_0x31f468(0x164)](_0x3650cf);for(const _0x2aaecb of _0x45e7b3){const _0x5405a6=a133_0x3324d2[_0x31f468(0x190)](_0x3650cf,_0x2aaecb);a133_0x1b52fe[_0x31f468(0x1b5)](_0x5405a6)[_0x31f468(0x167)]()&&_0x50f7de['push']({'file_name':_0x2aaecb,'text_content':a133_0x1b52fe['readFileSync'](_0x5405a6,_0x31f468(0x238))});}}const _0x3da9a9={..._0x1dc168,'code':_0x24806a,'files':_0x50f7de};_0xa4637c[_0x31f468(0x13f)]({'name':_0x1dc168[_0x31f468(0x1ff)],'dir':_0x530e07,'def':_0x3da9a9});}}const _0x3528ae=[],_0x254a3c=getFormInterfacesDir(_0xcdbcc3);if(a133_0x1b52fe[_0x31f468(0x1cb)](_0x254a3c)){const _0x19fdec=a133_0x1b52fe[_0x31f468(0x164)](_0x254a3c)[_0x31f468(0x20e)](_0x49bc02=>_0x49bc02[_0x31f468(0x218)](_0x31f468(0x1eb)));for(const _0x5d7556 of _0x19fdec){const _0x31cd29=a133_0x3324d2[_0x31f468(0x190)](_0x254a3c,_0x5d7556),_0x1835c4=parseFormInterfaceYaml(a133_0x1b52fe[_0x31f468(0x1c6)](_0x31cd29,'utf-8'),_0x31cd29);_0x3528ae[_0x31f468(0x13f)]({'name':_0x1835c4[_0x31f468(0x1ff)],'path':_0x31cd29,'yaml':_0x1835c4});}}const _0xc69ca2=[],_0x37d6a0=getChatInterfacesDir(_0xcdbcc3);if(a133_0x1b52fe['existsSync'](_0x37d6a0)){const _0x24c4f=a133_0x1b52fe[_0x31f468(0x164)](_0x37d6a0)[_0x31f468(0x20e)](_0x2cf59e=>_0x2cf59e[_0x31f468(0x218)](_0x31f468(0x1eb)));for(const _0x2e7f26 of _0x24c4f){const _0x58fb40=a133_0x3324d2['join'](_0x37d6a0,_0x2e7f26),_0x3c9c34=parseChatInterfaceYaml(a133_0x1b52fe['readFileSync'](_0x58fb40,_0x31f468(0x238)),_0x58fb40);_0xc69ca2[_0x31f468(0x13f)]({'name':_0x3c9c34[_0x31f468(0x1ff)],'path':_0x58fb40,'yaml':_0x3c9c34});}}const _0x5b2995=await this['client'][_0x31f468(0x13b)](_0x519efd),_0x217f10=await this['client'][_0x31f468(0x18a)](_0x519efd),_0x32f62b=await this[_0x31f468(0x1c9)][_0x31f468(0x231)](_0x519efd),_0x41d425=await this[_0x31f468(0x1c9)][_0x31f468(0x158)](_0x519efd),_0x40d4d5=await this[_0x31f468(0x1c9)][_0x31f468(0x1d1)](_0x519efd),_0x58c6f0=await safeListOrEmpty(()=>this[_0x31f468(0x1c9)][_0x31f468(0x1fd)](_0x519efd)),_0x225be4=await safeListOrEmpty(()=>this['client'][_0x31f468(0x23b)](_0x519efd)),_0x4dc50b=await safeListOrEmpty(()=>this['client'][_0x31f468(0x17d)](_0x519efd)),_0xc7c629=await safeListOrEmpty(()=>this[_0x31f468(0x1c9)]['listChatInterfaces'](_0x519efd)),_0x5bfba9=await fetchAllToolTargetMaps((_0x191bf4,_0x51502c)=>this['client'][_0x31f468(0x189)](_0x191bf4,_0x51502c),_0x519efd),_0x13bb93=new Map(),_0x2fad04=new Map(),_0x5ad7fc=new Map(),_0x2c8956=new Map(),_0x37db10=new Map(),_0xc28c8=new Map(),_0x1ac70d=new Map();for(const _0xff7007 of _0x5b2995){_0x13bb93[_0x31f468(0x1f8)](_0xff7007[_0x31f468(0x19e)]['name'],_0xff7007);}for(const _0x3ab707 of _0x217f10){_0x2fad04[_0x31f468(0x1f8)](_0x3ab707[_0x31f468(0x19e)][_0x31f468(0x1ff)],_0x3ab707);}for(const _0x31e575 of _0x32f62b){_0x5ad7fc['set'](_0x31e575[_0x31f468(0x19e)][_0x31f468(0x1ff)],_0x31e575);}for(const _0x31c586 of _0x41d425){_0x2c8956[_0x31f468(0x1f8)](_0x31c586['attributes'][_0x31f468(0x1ff)],_0x31c586);}for(const _0x3f6e16 of _0x40d4d5){_0x37db10[_0x31f468(0x1f8)](_0x3f6e16[_0x31f468(0x19e)][_0x31f468(0x1ae)][_0x31f468(0x1d6)](),_0x3f6e16);}for(const _0x171acc of _0x58c6f0){_0xc28c8[_0x31f468(0x1f8)](_0x171acc[_0x31f468(0x19e)][_0x31f468(0x1ff)],_0x171acc);}for(const _0x8db365 of _0x225be4){_0x1ac70d[_0x31f468(0x1f8)](_0x8db365['attributes'][_0x31f468(0x1ff)],_0x8db365);}const _0x318cee=new Map(),_0x692ee3=new Map();for(const _0x7d2030 of _0x4dc50b){_0x318cee[_0x31f468(0x1f8)](_0x7d2030[_0x31f468(0x19e)][_0x31f468(0x1ff)],_0x7d2030);}for(const _0x463ded of _0xc7c629){_0x692ee3[_0x31f468(0x1f8)](_0x463ded[_0x31f468(0x19e)][_0x31f468(0x1ff)],_0x463ded);}const _0x479811=new Map(),_0x36f266=new Map();for(const _0x3e4e85 of _0x5b2995){_0x479811[_0x31f468(0x1f8)](_0x3e4e85['attributes'][_0x31f468(0x1ff)],_0x3e4e85['id']),_0x36f266['set'](_0x3e4e85['id'],_0x3e4e85[_0x31f468(0x19e)][_0x31f468(0x1ff)]);}const _0x6bc505=new Map(),_0x1a3e21=new Map();for(const _0x1541d3 of _0x41d425){_0x6bc505[_0x31f468(0x1f8)](_0x1541d3[_0x31f468(0x19e)]['name'],_0x1541d3['id']),_0x1a3e21[_0x31f468(0x1f8)](_0x1541d3['id'],_0x1541d3['attributes'][_0x31f468(0x1ff)]);}const _0x4fc3fb=_0x5bfba9['nameToId'][_0x31f468(0x18d)]||new Map(),_0xb3a65=_0x5bfba9[_0x31f468(0x128)][_0x31f468(0x13c)]||new Map(),_0x24b1ef=_0x5bfba9['nameToId']['ExperimentalKnowledgeBase']||new Map(),_0x48e903=new Map(),_0x2a0a67={'resolveToolTargetName':buildNameResolver({..._0x5bfba9[_0x31f468(0x234)],'Agent':_0x36f266}),'resolvePromptName':async _0x5d79b3=>_0x1a3e21[_0x31f468(0x1d3)](_0x5d79b3),'onWarning':_0x587215=>this[_0x31f468(0x147)][_0x31f468(0x206)](_0x587215)};let _0xdd36d6=[];const _0x3a1fbe={'projectId':_0x519efd,'resolveToolTargetId':buildIdResolver({..._0x5bfba9[_0x31f468(0x128)],'Agent':_0x479811}),'resolvePromptId':async _0x52795b=>_0x6bc505['get'](_0x52795b),'onWarning':_0x425fd8=>{const _0x1576ca=_0x31f468;this[_0x1576ca(0x147)]['warn'](_0x425fd8),_0xdd36d6[_0x1576ca(0x13f)](_0x425fd8);}},{resolved:_0xff27f4,unresolved:_0x3009ce}=resolveAgentDependencies(_0x2d3438,new Set(_0x13bb93['keys']()));for(const {agent:_0xea29dc,missingDeps:_0x56e6d2}of _0x3009ce){_0xdd789a[_0x31f468(0x1c3)]['push']({'agentName':_0xea29dc['yaml'][_0x31f468(0x1ff)],'action':_0x31f468(0x1d9),'error':_0x31f468(0x19d)+_0x56e6d2[_0x31f468(0x190)](',\x20')+_0x31f468(0x1b1)}),_0xdd789a['counts'][_0x31f468(0x1c3)][_0x31f468(0x221)]++;}for(const _0x1c3fa8 of _0x3dbd24){const _0x43e1b6=_0x2fad04[_0x31f468(0x1d3)](_0x1c3fa8['yaml'][_0x31f468(0x1ff)]),_0x37e9c3=a133_0x1b52fe[_0x31f468(0x1c6)](_0x1c3fa8['path'],_0x31f468(0x238));if(_0x43e1b6){const _0x512dcc=apiKnowledgeBaseToYaml(_0x43e1b6),_0x5c4cf7=toKnowledgeBaseYamlString(_0x512dcc),_0x12b049=generateDiff(_0x5c4cf7,_0x37e9c3),_0x2ab5e8=hasChanges(_0x12b049);_0x2ab5e8?(_0xdd789a[_0x31f468(0x1d0)][_0x31f468(0x13f)]({'name':_0x1c3fa8[_0x31f468(0x1f2)]['name'],'action':_0x31f468(0x233),'id':_0x43e1b6['id'],'diff':formatDiffWithColors(_0x12b049)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1d0)][_0x31f468(0x233)]++):(_0xdd789a[_0x31f468(0x1d0)]['push']({'name':_0x1c3fa8['yaml'][_0x31f468(0x1ff)],'action':'unchanged','id':_0x43e1b6['id']}),_0xdd789a['counts'][_0x31f468(0x1d0)][_0x31f468(0x19a)]++);}else _0xdd789a[_0x31f468(0x1d0)]['push']({'name':_0x1c3fa8[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x141)}),_0xdd789a['counts']['knowledgeBases'][_0x31f468(0x141)]++;}for(const _0x203580 of _0x1ac634){const _0x4db48f=_0x5ad7fc['get'](_0x203580['name']),_0x15290c=a133_0x1b52fe[_0x31f468(0x1c6)](_0x203580['path'],_0x31f468(0x238));if(_0x4db48f){const _0x42ec56=toTextKnowledgeBaseMd(_0x4db48f['attributes']['name'],_0x4db48f[_0x31f468(0x19e)]['text']),_0x3f7b9f=generateDiff(_0x42ec56,_0x15290c),_0x589ed3=hasChanges(_0x3f7b9f);_0x589ed3?(_0xdd789a[_0x31f468(0x23a)]['push']({'name':_0x203580[_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x4db48f['id'],'diff':formatDiffWithColors(_0x3f7b9f)}),_0xdd789a['counts'][_0x31f468(0x23a)][_0x31f468(0x233)]++):(_0xdd789a['textKnowledgeBases'][_0x31f468(0x13f)]({'name':_0x203580['name'],'action':'unchanged','id':_0x4db48f['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x23a)]['unchanged']++);}else _0xdd789a['textKnowledgeBases'][_0x31f468(0x13f)]({'name':_0x203580[_0x31f468(0x1ff)],'action':_0x31f468(0x141)}),_0xdd789a['counts'][_0x31f468(0x23a)][_0x31f468(0x141)]++;}for(const _0x550c01 of _0xff27f4){const _0x1f3659=_0x13bb93[_0x31f468(0x1d3)](_0x550c01[_0x31f468(0x1f2)][_0x31f468(0x1ff)]),_0x5d612e=a133_0x3324d2[_0x31f468(0x190)](_0x550c01['dir'],_0x31f468(0x120)),_0x152236=a133_0x1b52fe[_0x31f468(0x1c6)](_0x5d612e,_0x31f468(0x238)),_0x572900=_0x550c01['systemPrompt'],_0x255974=_0x31f468(0x223)+_0x572900+_0x31f468(0x169)+_0x152236;if(_0x1f3659){const {yaml:_0xff3490,systemPrompt:_0x459c5b}=await agentResponseToDef(_0x1f3659,_0x2a0a67),_0xa5d5ee=toAgentYamlString(_0xff3490),_0x29b7c6=_0x31f468(0x223)+_0x459c5b+'\x0a\x0a#\x20agent.yml\x0a'+_0xa5d5ee,_0x3fa1c6=generateDiff(_0x29b7c6,_0x255974),_0xb8e42f=hasChanges(_0x3fa1c6);_0xb8e42f?(_0xdd789a[_0x31f468(0x1c3)][_0x31f468(0x13f)]({'agentName':_0x550c01[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'agentId':_0x1f3659['id'],'diff':formatDiffWithColors(_0x3fa1c6)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1c3)][_0x31f468(0x233)]++):(_0xdd789a[_0x31f468(0x1c3)][_0x31f468(0x13f)]({'agentName':_0x550c01[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x19a),'agentId':_0x1f3659['id']}),_0xdd789a['counts'][_0x31f468(0x1c3)][_0x31f468(0x19a)]++);}else _0xdd789a[_0x31f468(0x1c3)]['push']({'agentName':_0x550c01[_0x31f468(0x1f2)]['name'],'action':_0x31f468(0x141)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1c3)][_0x31f468(0x141)]++;}for(const _0x4e67ed of _0x5a1eca){const _0x5436e2=_0x2c8956[_0x31f468(0x1d3)](_0x4e67ed['yaml'][_0x31f468(0x1ff)]),_0x313f79=a133_0x1b52fe[_0x31f468(0x1c6)](_0x4e67ed[_0x31f468(0x174)],_0x31f468(0x238));if(_0x5436e2){const _0x51bc73=await apiPromptToYaml(_0x5436e2,_0x2a0a67);if(!_0x51bc73){_0xdd789a[_0x31f468(0x1ad)][_0x31f468(0x13f)]({'name':_0x4e67ed[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':'updated','id':_0x5436e2['id']}),_0xdd789a['counts'][_0x31f468(0x1ad)]['updated']++;continue;}const _0x1216e6=toPromptYamlString(_0x51bc73),_0x947819=generateDiff(_0x1216e6,_0x313f79),_0x563a2e=hasChanges(_0x947819);_0x563a2e?(_0xdd789a['prompts'][_0x31f468(0x13f)]({'name':_0x4e67ed[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x5436e2['id'],'diff':formatDiffWithColors(_0x947819)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1ad)]['updated']++):(_0xdd789a[_0x31f468(0x1ad)]['push']({'name':_0x4e67ed[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x19a),'id':_0x5436e2['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1ad)]['unchanged']++);}else _0xdd789a[_0x31f468(0x1ad)][_0x31f468(0x13f)]({'name':_0x4e67ed[_0x31f468(0x1f2)]['name'],'action':_0x31f468(0x141)}),_0xdd789a[_0x31f468(0x20a)]['prompts'][_0x31f468(0x141)]++;}for(const _0x242d91 of _0x636a0f){const _0x4c3a25=_0x37db10[_0x31f468(0x1d3)](_0x242d91[_0x31f468(0x1f2)][_0x31f468(0x1fa)]),_0x4f0dc7=a133_0x1b52fe[_0x31f468(0x1c6)](_0x242d91['path'],_0x31f468(0x238));if(_0x4c3a25){const _0x45497c=await apiIntegrationToYaml(_0x4c3a25,_0x2a0a67),_0xe51920=toIntegrationYamlString(_0x45497c),_0x9e0c45=generateDiff(_0xe51920,_0x4f0dc7),_0x53131c=hasChanges(_0x9e0c45);_0x53131c?(_0xdd789a['integrations'][_0x31f468(0x13f)]({'name':_0x242d91['yaml'][_0x31f468(0x1fa)],'action':'updated','id':_0x4c3a25['id'],'diff':formatDiffWithColors(_0x9e0c45)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x17c)][_0x31f468(0x233)]++):(_0xdd789a[_0x31f468(0x17c)][_0x31f468(0x13f)]({'name':_0x242d91[_0x31f468(0x1f2)][_0x31f468(0x1fa)],'action':'unchanged','id':_0x4c3a25['id']}),_0xdd789a['counts'][_0x31f468(0x17c)][_0x31f468(0x19a)]++);}else _0xdd789a[_0x31f468(0x17c)][_0x31f468(0x13f)]({'name':_0x242d91[_0x31f468(0x1f2)][_0x31f468(0x1fa)],'action':_0x31f468(0x141)}),_0xdd789a['counts'][_0x31f468(0x17c)][_0x31f468(0x141)]++;}for(const _0x454af2 of _0x383c8b){const _0x474921=_0xc28c8[_0x31f468(0x1d3)](_0x454af2['def'][_0x31f468(0x1ff)]),_0x430b2c=toExperimentalKnowledgeBaseYamlString(_0x454af2[_0x31f468(0x1e1)]);let _0x2f1aaa=_0x430b2c;for(const _0x3832fc of _0x454af2[_0x31f468(0x1e1)][_0x31f468(0x17a)]){_0x2f1aaa+=_0x31f468(0x17b)+_0x3832fc[_0x31f468(0x1ff)]+_0x31f468(0x1a8)+_0x3832fc[_0x31f468(0x16b)]+'\x0a---\x20schema:\x20'+_0x3832fc[_0x31f468(0x1ff)]+'\x20---\x0a'+_0x3832fc[_0x31f468(0x1fb)]+'\x0a';}if(_0x474921){const _0x38cfad=apiExperimentalKnowledgeBaseToYaml(_0x474921),_0x3cecb8=toExperimentalKnowledgeBaseYamlString(_0x38cfad);let _0x4e3a4e=_0x3cecb8;for(const _0x2c14a2 of _0x38cfad[_0x31f468(0x17a)]){_0x4e3a4e+='\x0a---\x20function:\x20'+_0x2c14a2[_0x31f468(0x1ff)]+_0x31f468(0x1a8)+_0x2c14a2[_0x31f468(0x16b)]+_0x31f468(0x142)+_0x2c14a2[_0x31f468(0x1ff)]+'\x20---\x0a'+_0x2c14a2[_0x31f468(0x1fb)]+'\x0a';}const _0x41613d=generateDiff(_0x4e3a4e,_0x2f1aaa),_0x1820b2=hasChanges(_0x41613d);_0x1820b2?(_0xdd789a[_0x31f468(0x192)][_0x31f468(0x13f)]({'name':_0x454af2[_0x31f468(0x1e1)][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x474921['id'],'diff':formatDiffWithColors(_0x41613d)}),_0xdd789a['counts'][_0x31f468(0x192)][_0x31f468(0x233)]++):(_0xdd789a[_0x31f468(0x192)][_0x31f468(0x13f)]({'name':_0x454af2[_0x31f468(0x1e1)][_0x31f468(0x1ff)],'action':_0x31f468(0x19a),'id':_0x474921['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x192)][_0x31f468(0x19a)]++);}else _0xdd789a[_0x31f468(0x192)][_0x31f468(0x13f)]({'name':_0x454af2['def'][_0x31f468(0x1ff)],'action':_0x31f468(0x141)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x192)][_0x31f468(0x141)]++;}for(const _0x19d1f6 of _0xa4637c){const _0x19a71=_0x1ac70d[_0x31f468(0x1d3)](_0x19d1f6[_0x31f468(0x1e1)][_0x31f468(0x1ff)]),_0x24e75c=toExperimentalArtifactYamlString(_0x19d1f6[_0x31f468(0x1e1)]);let _0x25635d=_0x24e75c+(_0x31f468(0x1a5)+_0x19d1f6[_0x31f468(0x1e1)][_0x31f468(0x16b)]+'\x0a');for(const _0xdcb7b0 of _0x19d1f6[_0x31f468(0x1e1)][_0x31f468(0x11e)]){_0x25635d+='---\x20file:\x20'+_0xdcb7b0[_0x31f468(0x16d)]+_0x31f468(0x1a8)+_0xdcb7b0[_0x31f468(0x230)]+'\x0a';}if(_0x19a71){const _0x57017c=apiExperimentalArtifactToYaml(_0x19a71),_0x33c378=toExperimentalArtifactYamlString(_0x57017c);let _0x2fd4da=_0x33c378+('\x0a---\x20code\x20---\x0a'+_0x57017c[_0x31f468(0x16b)]+'\x0a');for(const _0xe3f5b1 of _0x57017c[_0x31f468(0x11e)]){_0x2fd4da+='---\x20file:\x20'+_0xe3f5b1[_0x31f468(0x16d)]+_0x31f468(0x1a8)+_0xe3f5b1['text_content']+'\x0a';}const _0x5e80a7=generateDiff(_0x2fd4da,_0x25635d),_0x72c8f4=hasChanges(_0x5e80a7);_0x72c8f4?(_0xdd789a[_0x31f468(0x1f9)][_0x31f468(0x13f)]({'name':_0x19d1f6[_0x31f468(0x1e1)][_0x31f468(0x1ff)],'action':'updated','id':_0x19a71['id'],'diff':formatDiffWithColors(_0x5e80a7)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1f9)]['updated']++):(_0xdd789a['experimentalArtifacts'][_0x31f468(0x13f)]({'name':_0x19d1f6[_0x31f468(0x1e1)][_0x31f468(0x1ff)],'action':_0x31f468(0x19a),'id':_0x19a71['id']}),_0xdd789a[_0x31f468(0x20a)]['experimentalArtifacts']['unchanged']++);}else _0xdd789a[_0x31f468(0x1f9)][_0x31f468(0x13f)]({'name':_0x19d1f6[_0x31f468(0x1e1)][_0x31f468(0x1ff)],'action':_0x31f468(0x141)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1f9)]['created']++;}for(const _0x45e945 of _0x3528ae){const _0x5d8c70=_0x318cee[_0x31f468(0x1d3)](_0x45e945[_0x31f468(0x1f2)]['name']),_0x37944b=a133_0x1b52fe[_0x31f468(0x1c6)](_0x45e945['path'],'utf-8');if(_0x5d8c70){const _0x480374=await apiFormInterfaceToYaml(_0x5d8c70,_0x2a0a67),_0x3f17d9=toFormInterfaceYamlString(_0x480374),_0x1efa70=generateDiff(_0x3f17d9,_0x37944b),_0x18f73d=hasChanges(_0x1efa70);_0x18f73d?(_0xdd789a[_0x31f468(0x1dc)][_0x31f468(0x13f)]({'name':_0x45e945['yaml'][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x5d8c70['id'],'diff':formatDiffWithColors(_0x1efa70)}),_0xdd789a['counts']['formInterfaces']['updated']++):(_0xdd789a[_0x31f468(0x1dc)][_0x31f468(0x13f)]({'name':_0x45e945[_0x31f468(0x1f2)]['name'],'action':_0x31f468(0x19a),'id':_0x5d8c70['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1dc)][_0x31f468(0x19a)]++);}else _0xdd789a[_0x31f468(0x1dc)][_0x31f468(0x13f)]({'name':_0x45e945[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':'created'}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1dc)][_0x31f468(0x141)]++;}for(const _0x2eaa97 of _0xc69ca2){const _0x41b7df=_0x692ee3['get'](_0x2eaa97['yaml']['name']),_0x1902fb=a133_0x1b52fe[_0x31f468(0x1c6)](_0x2eaa97[_0x31f468(0x174)],_0x31f468(0x238));if(_0x41b7df){const _0x3c7085=await apiChatInterfaceToYaml(_0x41b7df,_0x2a0a67),_0x452236=toChatInterfaceYamlString(_0x3c7085),_0x24a35a=generateDiff(_0x452236,_0x1902fb),_0x498fc0=hasChanges(_0x24a35a);_0x498fc0?(_0xdd789a[_0x31f468(0x1e4)]['push']({'name':_0x2eaa97[_0x31f468(0x1f2)]['name'],'action':_0x31f468(0x233),'id':_0x41b7df['id'],'diff':formatDiffWithColors(_0x24a35a)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1e4)][_0x31f468(0x233)]++):(_0xdd789a[_0x31f468(0x1e4)]['push']({'name':_0x2eaa97[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x19a),'id':_0x41b7df['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1e4)]['unchanged']++);}else _0xdd789a[_0x31f468(0x1e4)][_0x31f468(0x13f)]({'name':_0x2eaa97[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x141)}),_0xdd789a['counts'][_0x31f468(0x1e4)][_0x31f468(0x141)]++;}if(_0x4b166b?.[_0x31f468(0x226)])return _0xdd789a;_0xdd789a[_0x31f468(0x1d0)]=[],_0xdd789a[_0x31f468(0x23a)]=[],_0xdd789a[_0x31f468(0x1ad)]=[],_0xdd789a[_0x31f468(0x17c)]=[],_0xdd789a[_0x31f468(0x192)]=[],_0xdd789a[_0x31f468(0x1f9)]=[],_0xdd789a[_0x31f468(0x1dc)]=[],_0xdd789a[_0x31f468(0x1e4)]=[];const _0x928f0f=_0xdd789a[_0x31f468(0x1c3)][_0x31f468(0x20e)](_0x2ed5c8=>_0x2ed5c8['action']===_0x31f468(0x1d9));_0xdd789a['agents']=_0x928f0f,_0xdd789a[_0x31f468(0x20a)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x928f0f['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},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x1a7e88 of _0x3dbd24){try{const _0x47157d=_0x2fad04[_0x31f468(0x1d3)](_0x1a7e88[_0x31f468(0x1f2)]['name']),_0x21416d=yamlKnowledgeBaseToApi(_0x1a7e88['yaml'],_0x519efd);if(_0x47157d)await this['client'][_0x31f468(0x11c)](_0x47157d['id'],_0x21416d),_0x4fc3fb[_0x31f468(0x1f8)](_0x1a7e88[_0x31f468(0x1f2)]['name'],_0x47157d['id']),_0xdd789a[_0x31f468(0x1d0)][_0x31f468(0x13f)]({'name':_0x1a7e88[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x47157d['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1d0)][_0x31f468(0x233)]++;else{const _0x1e74ea=await this['client'][_0x31f468(0x1ed)](_0x21416d);_0x4fc3fb['set'](_0x1a7e88[_0x31f468(0x1f2)][_0x31f468(0x1ff)],_0x1e74ea['id']),_0xdd789a[_0x31f468(0x1d0)][_0x31f468(0x13f)]({'name':_0x1a7e88[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x141),'id':_0x1e74ea['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1d0)]['created']++;}}catch(_0x322ef3){_0xdd789a[_0x31f468(0x1d0)][_0x31f468(0x13f)]({'name':_0x1a7e88[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':'error','error':_0x322ef3[_0x31f468(0x214)]}),_0xdd789a[_0x31f468(0x20a)]['knowledgeBases']['errors']++;}}for(const _0x1b663f of _0x1ac634){try{const _0x1b92a9=_0x5ad7fc[_0x31f468(0x1d3)](_0x1b663f['name']),_0x8ae843=yamlTextKnowledgeBaseToApi({'name':_0x1b663f[_0x31f468(0x1ff)],'text':_0x1b663f[_0x31f468(0x21a)]},_0x519efd);if(_0x1b92a9)await this[_0x31f468(0x1c9)][_0x31f468(0x153)](_0x1b92a9['id'],_0x8ae843),_0xb3a65[_0x31f468(0x1f8)](_0x1b663f['name'],_0x1b92a9['id']),_0xdd789a[_0x31f468(0x23a)][_0x31f468(0x13f)]({'name':_0x1b663f[_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x1b92a9['id']}),_0xdd789a[_0x31f468(0x20a)]['textKnowledgeBases'][_0x31f468(0x233)]++;else{const _0x31f699=await this[_0x31f468(0x1c9)][_0x31f468(0x1c2)](_0x8ae843);_0xb3a65[_0x31f468(0x1f8)](_0x1b663f[_0x31f468(0x1ff)],_0x31f699['id']),_0xdd789a[_0x31f468(0x23a)][_0x31f468(0x13f)]({'name':_0x1b663f[_0x31f468(0x1ff)],'action':_0x31f468(0x141),'id':_0x31f699['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x23a)][_0x31f468(0x141)]++;}}catch(_0x5b215e){_0xdd789a[_0x31f468(0x23a)][_0x31f468(0x13f)]({'name':_0x1b663f['name'],'action':_0x31f468(0x1d9),'error':_0x5b215e[_0x31f468(0x214)]}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x23a)][_0x31f468(0x221)]++;}}for(const _0x1084e0 of _0x383c8b){try{const _0x506a3b=_0xc28c8[_0x31f468(0x1d3)](_0x1084e0['def'][_0x31f468(0x1ff)]),_0x16ff84=yamlExperimentalKnowledgeBaseToApi(_0x1084e0[_0x31f468(0x1e1)],_0x519efd);if(_0x506a3b)await this['client'][_0x31f468(0x18b)](_0x506a3b['id'],_0x16ff84),_0x24b1ef[_0x31f468(0x1f8)](_0x1084e0[_0x31f468(0x1e1)][_0x31f468(0x1ff)],_0x506a3b['id']),_0xdd789a[_0x31f468(0x192)][_0x31f468(0x13f)]({'name':_0x1084e0[_0x31f468(0x1e1)][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x506a3b['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x192)][_0x31f468(0x233)]++;else{const _0x59a672=await this['client'][_0x31f468(0x12b)](_0x16ff84);_0x24b1ef[_0x31f468(0x1f8)](_0x1084e0[_0x31f468(0x1e1)][_0x31f468(0x1ff)],_0x59a672['id']),_0xdd789a['experimentalKnowledgeBases'][_0x31f468(0x13f)]({'name':_0x1084e0['def'][_0x31f468(0x1ff)],'action':_0x31f468(0x141),'id':_0x59a672['id']}),_0xdd789a[_0x31f468(0x20a)]['experimentalKnowledgeBases'][_0x31f468(0x141)]++;}}catch(_0x3f9970){_0xdd789a['experimentalKnowledgeBases'][_0x31f468(0x13f)]({'name':_0x1084e0[_0x31f468(0x1e1)][_0x31f468(0x1ff)],'action':'error','error':_0x3f9970[_0x31f468(0x214)]}),_0xdd789a[_0x31f468(0x20a)]['experimentalKnowledgeBases'][_0x31f468(0x221)]++;}}for(const _0x50cd00 of _0xa4637c){try{const _0x129287=_0x1ac70d[_0x31f468(0x1d3)](_0x50cd00['def']['name']),_0x4bd19e=yamlExperimentalArtifactToApi(_0x50cd00[_0x31f468(0x1e1)],_0x519efd);if(_0x129287)await this['client'][_0x31f468(0x21b)](_0x129287['id'],_0x4bd19e),_0x48e903[_0x31f468(0x1f8)](_0x50cd00[_0x31f468(0x1e1)][_0x31f468(0x1ff)],_0x129287['id']),_0xdd789a[_0x31f468(0x1f9)][_0x31f468(0x13f)]({'name':_0x50cd00[_0x31f468(0x1e1)]['name'],'action':'updated','id':_0x129287['id']}),_0xdd789a['counts'][_0x31f468(0x1f9)][_0x31f468(0x233)]++;else{const _0x57e483=await this['client']['createExperimentalArtifact'](_0x4bd19e);_0x48e903[_0x31f468(0x1f8)](_0x50cd00[_0x31f468(0x1e1)][_0x31f468(0x1ff)],_0x57e483['id']),_0xdd789a[_0x31f468(0x1f9)]['push']({'name':_0x50cd00['def'][_0x31f468(0x1ff)],'action':_0x31f468(0x141),'id':_0x57e483['id']}),_0xdd789a['counts'][_0x31f468(0x1f9)][_0x31f468(0x141)]++;}}catch(_0x4cc5db){_0xdd789a['experimentalArtifacts'][_0x31f468(0x13f)]({'name':_0x50cd00[_0x31f468(0x1e1)][_0x31f468(0x1ff)],'action':_0x31f468(0x1d9),'error':_0x4cc5db[_0x31f468(0x214)]}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1f9)][_0x31f468(0x221)]++;}}for(const _0x1c2ae8 of _0xff27f4){_0xdd36d6=[];try{const _0x1b2877=_0x13bb93[_0x31f468(0x1d3)](_0x1c2ae8[_0x31f468(0x1f2)][_0x31f468(0x1ff)]),_0x5a9827=await agentDefToRequest(_0x1c2ae8[_0x31f468(0x1f2)],_0x1c2ae8['systemPrompt'],_0x1c2ae8[_0x31f468(0x1bc)],_0x3a1fbe);if(_0x1b2877)await this[_0x31f468(0x1c9)]['updateAgentResponse'](_0x1b2877['id'],_0x5a9827),_0x479811[_0x31f468(0x1f8)](_0x1c2ae8[_0x31f468(0x1f2)][_0x31f468(0x1ff)],_0x1b2877['id']),_0xdd789a['agents']['push']({'agentName':_0x1c2ae8[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'agentId':_0x1b2877['id'],'warnings':_0xdd36d6['length']>0x0?_0xdd36d6:undefined}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1c3)][_0x31f468(0x233)]++;else{const _0x4c393b=await this[_0x31f468(0x1c9)][_0x31f468(0x131)](_0x5a9827);_0x479811[_0x31f468(0x1f8)](_0x1c2ae8[_0x31f468(0x1f2)][_0x31f468(0x1ff)],_0x4c393b['id']),_0xdd789a[_0x31f468(0x1c3)][_0x31f468(0x13f)]({'agentName':_0x1c2ae8[_0x31f468(0x1f2)]['name'],'action':_0x31f468(0x141),'agentId':_0x4c393b['id'],'warnings':_0xdd36d6['length']>0x0?_0xdd36d6:undefined}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1c3)][_0x31f468(0x141)]++;}}catch(_0x26b799){_0xdd789a['agents'][_0x31f468(0x13f)]({'agentName':_0x1c2ae8[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x1d9),'error':_0x26b799[_0x31f468(0x214)],'warnings':_0xdd36d6[_0x31f468(0x21c)]>0x0?_0xdd36d6:undefined}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1c3)]['errors']++;}}for(const _0x381b2c of _0x5a1eca){try{const _0x3ed396=_0x2c8956[_0x31f468(0x1d3)](_0x381b2c[_0x31f468(0x1f2)]['name']),_0xd06b9f=await yamlPromptToApi(_0x381b2c['yaml'],_0x519efd,_0x3a1fbe);if(!_0xd06b9f){_0xdd789a['prompts'][_0x31f468(0x13f)]({'name':_0x381b2c[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x1d9),'error':'Agent\x20reference\x20not\x20found'}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1ad)][_0x31f468(0x221)]++;continue;}if(_0x3ed396)await this[_0x31f468(0x1c9)][_0x31f468(0x181)](_0x3ed396['id'],_0xd06b9f),_0x6bc505[_0x31f468(0x1f8)](_0x381b2c[_0x31f468(0x1f2)]['name'],_0x3ed396['id']),_0xdd789a['prompts'][_0x31f468(0x13f)]({'name':_0x381b2c[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':'updated','id':_0x3ed396['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1ad)][_0x31f468(0x233)]++;else{const _0x49f618=await this['client'][_0x31f468(0x179)](_0xd06b9f);_0x6bc505[_0x31f468(0x1f8)](_0x381b2c[_0x31f468(0x1f2)][_0x31f468(0x1ff)],_0x49f618['id']),_0xdd789a['prompts'][_0x31f468(0x13f)]({'name':_0x381b2c[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x141),'id':_0x49f618['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1ad)][_0x31f468(0x141)]++;}}catch(_0x10ecc4){_0xdd789a[_0x31f468(0x1ad)][_0x31f468(0x13f)]({'name':_0x381b2c['yaml'][_0x31f468(0x1ff)],'action':_0x31f468(0x1d9),'error':_0x10ecc4[_0x31f468(0x214)]}),_0xdd789a['counts']['prompts'][_0x31f468(0x221)]++;}}for(const _0x14c712 of _0x636a0f){try{const _0x2ee1a4=_0x37db10['get'](_0x14c712['yaml']['service_type']),_0x185f73=await yamlIntegrationToApi(_0x14c712[_0x31f468(0x1f2)],_0x519efd,_0x3a1fbe);if(_0x2ee1a4){await this[_0x31f468(0x1c9)][_0x31f468(0x20f)](_0x2ee1a4['id']);const _0x37879a=await this[_0x31f468(0x1c9)][_0x31f468(0x12f)](_0x185f73);_0xdd789a[_0x31f468(0x17c)][_0x31f468(0x13f)]({'name':_0x14c712[_0x31f468(0x1f2)][_0x31f468(0x1fa)],'action':_0x31f468(0x233),'id':_0x37879a['id']}),_0xdd789a['counts'][_0x31f468(0x17c)][_0x31f468(0x233)]++;}else{const _0x4599dc=await this['client']['createIntegration'](_0x185f73);_0xdd789a[_0x31f468(0x17c)][_0x31f468(0x13f)]({'name':_0x14c712[_0x31f468(0x1f2)][_0x31f468(0x1fa)],'action':_0x31f468(0x141),'id':_0x4599dc['id']}),_0xdd789a[_0x31f468(0x20a)]['integrations'][_0x31f468(0x141)]++;}}catch(_0x3c8fce){_0xdd789a[_0x31f468(0x17c)][_0x31f468(0x13f)]({'name':_0x14c712[_0x31f468(0x1f2)][_0x31f468(0x1fa)],'action':_0x31f468(0x1d9),'error':_0x3c8fce['message']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x17c)][_0x31f468(0x221)]++;}}for(const _0x406bba of _0x3528ae){try{const _0x41bf97=_0x318cee[_0x31f468(0x1d3)](_0x406bba[_0x31f468(0x1f2)][_0x31f468(0x1ff)]),_0xa09d89=await yamlFormInterfaceToApi(_0x406bba['yaml'],_0x519efd,_0x3a1fbe);if(!_0xa09d89){_0xdd789a[_0x31f468(0x1dc)][_0x31f468(0x13f)]({'name':_0x406bba[_0x31f468(0x1f2)]['name'],'action':_0x31f468(0x1d9),'error':_0x31f468(0x212)}),_0xdd789a[_0x31f468(0x20a)]['formInterfaces'][_0x31f468(0x221)]++;continue;}if(_0x41bf97){const _0x176f97=await this[_0x31f468(0x1c9)][_0x31f468(0x14a)](_0x41bf97['id'],_0xa09d89);_0xdd789a[_0x31f468(0x1dc)][_0x31f468(0x13f)]({'name':_0x406bba['yaml'][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x176f97['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1dc)][_0x31f468(0x233)]++;}else{const _0x40dec8=await this[_0x31f468(0x1c9)][_0x31f468(0x15c)](_0xa09d89);_0xdd789a[_0x31f468(0x1dc)][_0x31f468(0x13f)]({'name':_0x406bba[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x141),'id':_0x40dec8['id']}),_0xdd789a['counts']['formInterfaces'][_0x31f468(0x141)]++;}}catch(_0x47ff5c){_0xdd789a[_0x31f468(0x1dc)][_0x31f468(0x13f)]({'name':_0x406bba[_0x31f468(0x1f2)]['name'],'action':_0x31f468(0x1d9),'error':_0x47ff5c[_0x31f468(0x214)]}),_0xdd789a[_0x31f468(0x20a)]['formInterfaces']['errors']++;}}for(const _0x5c5eef of _0xc69ca2){try{const _0x2c7b10=_0x692ee3[_0x31f468(0x1d3)](_0x5c5eef[_0x31f468(0x1f2)][_0x31f468(0x1ff)]),_0x371cb2=await yamlChatInterfaceToApi(_0x5c5eef[_0x31f468(0x1f2)],_0x519efd,_0x3a1fbe);if(_0x2c7b10){const _0x4035d5=await this[_0x31f468(0x1c9)][_0x31f468(0x1a4)](_0x2c7b10['id'],_0x371cb2);_0xdd789a[_0x31f468(0x1e4)][_0x31f468(0x13f)]({'name':_0x5c5eef['yaml'][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x4035d5['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1e4)][_0x31f468(0x233)]++;}else{const _0x481725=await this['client']['createChatInterface'](_0x371cb2);_0xdd789a[_0x31f468(0x1e4)][_0x31f468(0x13f)]({'name':_0x5c5eef[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x141),'id':_0x481725['id']}),_0xdd789a['counts'][_0x31f468(0x1e4)][_0x31f468(0x141)]++;}}catch(_0x48b909){_0xdd789a[_0x31f468(0x1e4)]['push']({'name':_0x5c5eef['yaml'][_0x31f468(0x1ff)],'action':'error','error':_0x48b909[_0x31f468(0x214)]}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1e4)][_0x31f468(0x221)]++;}}return _0xdd789a;}async[a133_0x4f6d4d(0x204)](_0x322c8f,_0xeb2b60,_0x5a5eda,_0x5d9ebc){const _0x2eb71a=a133_0x4f6d4d,{projectId:_0x1e4da5,project:_0x11b17c}=await this[_0x2eb71a(0x187)](_0x322c8f),_0x475118=_0x11b17c[_0x2eb71a(0x19e)]['name'],_0x2c2b66=await this[_0x2eb71a(0x1c9)][_0x2eb71a(0x13b)](_0x1e4da5),_0x264d07=_0x2c2b66[_0x2eb71a(0x12a)](_0x272244=>_0x272244[_0x2eb71a(0x19e)][_0x2eb71a(0x1ff)]===_0xeb2b60);if(!_0x264d07)throw new SDKError(ErrorCode[_0x2eb71a(0x11f)],'Agent\x20not\x20found:\x20'+_0xeb2b60,undefined,{'helpText':_0x2eb71a(0x14b)+_0x2c2b66[_0x2eb71a(0x1a3)](_0x4c5fc7=>_0x4c5fc7[_0x2eb71a(0x19e)][_0x2eb71a(0x1ff)])[_0x2eb71a(0x190)](',\x20')});let _0x4dad23;if(_0x5a5eda)_0x4dad23=_0x5a5eda;else{const _0x15fc94=a133_0x3324d2[_0x2eb71a(0x190)](process[_0x2eb71a(0x182)](),_0x2eb71a(0x1c3)),_0xee07ae=getSanitizedPathWithMigration(_0x15fc94,_0x475118);_0xee07ae['renamed']&&this[_0x2eb71a(0x147)][_0x2eb71a(0x133)]('Renamed\x20folder:\x20'+a133_0x3324d2[_0x2eb71a(0x20c)](_0xee07ae[_0x2eb71a(0x22f)])+_0x2eb71a(0x12d)+a133_0x3324d2['basename'](_0xee07ae[_0x2eb71a(0x174)])),_0x4dad23=_0xee07ae['path'];}const _0x361e0e=getSanitizedPathWithMigration(_0x4dad23,_0xeb2b60);_0x361e0e['renamed']&&this[_0x2eb71a(0x147)][_0x2eb71a(0x133)](_0x2eb71a(0x117)+a133_0x3324d2[_0x2eb71a(0x20c)](_0x361e0e[_0x2eb71a(0x22f)])+_0x2eb71a(0x12d)+a133_0x3324d2[_0x2eb71a(0x20c)](_0x361e0e[_0x2eb71a(0x174)]));const _0x5babbb=_0x361e0e[_0x2eb71a(0x174)],_0x332c5c=new Map(),_0x2a6c23=new Map(),_0x448e56=await this['client'][_0x2eb71a(0x18a)](_0x1e4da5),_0x424582=await this[_0x2eb71a(0x1c9)][_0x2eb71a(0x231)](_0x1e4da5),_0x1bac26=await safeListOrEmpty(()=>this[_0x2eb71a(0x1c9)][_0x2eb71a(0x1fd)](_0x1e4da5)),_0x310b38=new Map(),_0x31a59f=new Map();for(const _0x14dd26 of _0x448e56){_0x332c5c['set'](_0x14dd26['id'],_0x14dd26[_0x2eb71a(0x19e)][_0x2eb71a(0x1ff)]);}for(const _0x442745 of _0x424582){_0x310b38[_0x2eb71a(0x1f8)](_0x442745['id'],_0x442745['attributes'][_0x2eb71a(0x1ff)]);}for(const _0x4c5c84 of _0x1bac26){_0x31a59f[_0x2eb71a(0x1f8)](_0x4c5c84['id'],_0x4c5c84[_0x2eb71a(0x19e)][_0x2eb71a(0x1ff)]);}for(const _0x494910 of _0x2c2b66){_0x2a6c23['set'](_0x494910['id'],_0x494910[_0x2eb71a(0x19e)]['name']);}const _0x56bffb={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x332c5c,'TextKnowledgeBase':_0x310b38,'Agent':_0x2a6c23,'ExperimentalKnowledgeBase':_0x31a59f}),'resolvePromptName':async()=>undefined,'onWarning':_0x46922d=>this['logger'][_0x2eb71a(0x206)](_0x46922d)},_0x5d80fe=a133_0x3324d2[_0x2eb71a(0x190)](_0x5babbb,_0x2eb71a(0x13a)),_0x44f4d8=a133_0x3324d2[_0x2eb71a(0x190)](_0x5babbb,_0x2eb71a(0x120)),_0x3c2942=a133_0x3324d2[_0x2eb71a(0x190)](_0x5babbb,_0x2eb71a(0x194)),_0x2f1bc7=!a133_0x1b52fe['existsSync'](_0x44f4d8);if(_0x5d9ebc?.[_0x2eb71a(0x226)])return{'agentName':_0xeb2b60,'outputPath':_0x5babbb,'isNew':_0x2f1bc7,'hasChanges':!![]};a133_0x1b52fe[_0x2eb71a(0x121)](_0x4dad23,{'recursive':!![]}),a133_0x1b52fe[_0x2eb71a(0x121)](_0x5babbb,{'recursive':!![]});const _0x523238=a133_0x3324d2[_0x2eb71a(0x190)](_0x4dad23,_0x2eb71a(0x17e));!a133_0x1b52fe[_0x2eb71a(0x1cb)](_0x523238)&&a133_0x1b52fe[_0x2eb71a(0x207)](_0x523238,createAgentConfigContent(_0x322c8f));const {yaml:_0x7c5506,systemPrompt:_0x67960f,starterMessage:_0x190c5c}=await agentResponseToDef(_0x264d07,_0x56bffb);let _0x8c9b85=_0x2f1bc7;if(!_0x2f1bc7){const _0x187cd6=a133_0x1b52fe['existsSync'](_0x5d80fe)?a133_0x1b52fe['readFileSync'](_0x5d80fe,_0x2eb71a(0x238)):'',_0x3d8643=a133_0x1b52fe[_0x2eb71a(0x1c6)](_0x44f4d8,'utf-8');_0x8c9b85=_0x187cd6!==_0x67960f||_0x3d8643!==toAgentYamlString(_0x7c5506);}a133_0x1b52fe[_0x2eb71a(0x207)](_0x5d80fe,_0x67960f),a133_0x1b52fe['writeFileSync'](_0x44f4d8,toAgentYamlString(_0x7c5506));if(_0x190c5c&&_0x190c5c['includes']('\x0a'))a133_0x1b52fe['writeFileSync'](_0x3c2942,_0x190c5c);else a133_0x1b52fe['existsSync'](_0x3c2942)&&a133_0x1b52fe[_0x2eb71a(0x1ef)](_0x3c2942);return{'agentName':_0xeb2b60,'outputPath':_0x5babbb,'isNew':_0x2f1bc7,'hasChanges':_0x8c9b85};}async[a133_0x4f6d4d(0x193)](_0x2abdfc,_0x2107f2){const _0xc7897f=a133_0x4f6d4d;let _0x2291e9;isAgentYamlPath(_0x2abdfc)?_0x2291e9=getAgentDirFromYamlPath(_0x2abdfc):_0x2291e9=_0x2abdfc;const {config:_0x3d7bdd}=findAgentConfig(_0x2291e9),_0x17fe50=await this[_0xc7897f(0x197)](_0x3d7bdd[_0xc7897f(0x1b4)]),_0x4ee892=a133_0x3324d2[_0xc7897f(0x190)](_0x2291e9,_0xc7897f(0x120)),_0x5b81fb=a133_0x3324d2[_0xc7897f(0x190)](_0x2291e9,'prompt.md'),_0x2c38ac=a133_0x3324d2[_0xc7897f(0x190)](_0x2291e9,'starter_message.md');if(!a133_0x1b52fe[_0xc7897f(0x1cb)](_0x4ee892))throw new SDKError(ErrorCode[_0xc7897f(0x210)],'agent.yml\x20not\x20found\x20in\x20'+_0x2291e9,undefined,{'helpText':_0xc7897f(0x1bb)});const _0x5a0442=parseAgentYaml(a133_0x1b52fe[_0xc7897f(0x1c6)](_0x4ee892,'utf-8'),_0x4ee892),_0x443948=a133_0x1b52fe[_0xc7897f(0x1cb)](_0x5b81fb)?a133_0x1b52fe[_0xc7897f(0x1c6)](_0x5b81fb,_0xc7897f(0x238)):'',_0xea3edf=a133_0x1b52fe[_0xc7897f(0x1cb)](_0x2c38ac)?a133_0x1b52fe[_0xc7897f(0x1c6)](_0x2c38ac,'utf-8'):_0x5a0442['starter_message'];if(_0x2107f2?.['dryRun'])return{'agentName':_0x5a0442[_0xc7897f(0x1ff)],'action':_0xc7897f(0x141),'projectId':_0x17fe50};const _0x46372a=await this['client']['listAgentsFull'](_0x17fe50),_0x6f6ed0=await fetchAllToolTargetMaps((_0x31e6b8,_0x5b3e2f)=>this[_0xc7897f(0x1c9)][_0xc7897f(0x189)](_0x31e6b8,_0x5b3e2f),_0x17fe50),_0x1c180c=new Map();for(const _0x3dbd02 of _0x46372a){_0x1c180c['set'](_0x3dbd02['attributes'][_0xc7897f(0x1ff)],_0x3dbd02['id']);}const _0x1a8c09=[],_0x5271b1={'projectId':_0x17fe50,'resolveToolTargetId':buildIdResolver({..._0x6f6ed0['nameToId'],'Agent':_0x1c180c}),'resolvePromptId':async()=>undefined,'onWarning':_0x391bcb=>{const _0x38acff=_0xc7897f;this[_0x38acff(0x147)][_0x38acff(0x206)](_0x391bcb),_0x1a8c09[_0x38acff(0x13f)](_0x391bcb);}};try{const _0x110e5e=_0x46372a['find'](_0x4d3c57=>_0x4d3c57[_0xc7897f(0x19e)][_0xc7897f(0x1ff)]===_0x5a0442[_0xc7897f(0x1ff)]),_0x1c2625=await agentDefToRequest(_0x5a0442,_0x443948,_0xea3edf,_0x5271b1);if(_0x110e5e)return await this[_0xc7897f(0x1c9)][_0xc7897f(0x1f0)](_0x110e5e['id'],_0x1c2625),{'agentName':_0x5a0442[_0xc7897f(0x1ff)],'action':_0xc7897f(0x233),'projectId':_0x17fe50,'agentId':_0x110e5e['id'],'warnings':_0x1a8c09[_0xc7897f(0x21c)]>0x0?_0x1a8c09:undefined};else{const _0x4390c6=await this[_0xc7897f(0x1c9)][_0xc7897f(0x131)](_0x1c2625);return{'agentName':_0x5a0442['name'],'action':_0xc7897f(0x141),'projectId':_0x17fe50,'agentId':_0x4390c6['id'],'warnings':_0x1a8c09['length']>0x0?_0x1a8c09:undefined};}}catch(_0x1ffee1){return{'agentName':_0x5a0442[_0xc7897f(0x1ff)],'action':'error','projectId':_0x17fe50,'error':_0x1ffee1['message'],'warnings':_0x1a8c09[_0xc7897f(0x21c)]>0x0?_0x1a8c09:undefined};}}async['cloneProject'](_0x1ddf2b,_0x1ca9e7,_0x5dfcaa){const _0x45574f=a133_0x4f6d4d,_0x163933=a133_0x1b52fe[_0x45574f(0x1cb)](_0x1ddf2b)&&a133_0x1b52fe[_0x45574f(0x1cb)](a133_0x3324d2[_0x45574f(0x190)](_0x1ddf2b,_0x45574f(0x17e)));let _0x27218f;const _0x56be0c=[],_0xee802f=[],_0x37cc99=[],_0x420851=[],_0xa1c9d9=[],_0x5b7842=[],_0x45907b=[],_0xbf1430=[],_0x55a4b6=[];if(_0x163933){const _0x6691bb=loadAgentConfig(a133_0x3324d2[_0x45574f(0x190)](_0x1ddf2b,'tdx.json'));_0x27218f=_0x6691bb[_0x45574f(0x1b4)];const _0x2979bd=a133_0x1b52fe[_0x45574f(0x164)](_0x1ddf2b,{'withFileTypes':!![]});for(const _0x3f1c5e of _0x2979bd){if(!_0x3f1c5e[_0x45574f(0x16c)]())continue;if([_0x45574f(0x126),'experimental_knowledge_bases',_0x45574f(0x21d),'prompts',_0x45574f(0x17c),_0x45574f(0x191),_0x45574f(0x148)][_0x45574f(0x17f)](_0x3f1c5e['name']))continue;const _0x283b26=a133_0x3324d2[_0x45574f(0x190)](_0x1ddf2b,_0x3f1c5e['name']);if(isAgentDir(_0x283b26)){const _0x1f4090=a133_0x3324d2[_0x45574f(0x190)](_0x283b26,_0x45574f(0x120)),_0x4b43ff=a133_0x3324d2[_0x45574f(0x190)](_0x283b26,_0x45574f(0x13a)),_0x4ea2aa=a133_0x3324d2[_0x45574f(0x190)](_0x283b26,_0x45574f(0x194)),_0x319998=parseAgentYaml(a133_0x1b52fe[_0x45574f(0x1c6)](_0x1f4090,_0x45574f(0x238)),_0x1f4090),_0x3091dd=a133_0x1b52fe[_0x45574f(0x1cb)](_0x4b43ff)?a133_0x1b52fe[_0x45574f(0x1c6)](_0x4b43ff,_0x45574f(0x238)):'',_0xa138a4=a133_0x1b52fe[_0x45574f(0x1cb)](_0x4ea2aa)?a133_0x1b52fe[_0x45574f(0x1c6)](_0x4ea2aa,_0x45574f(0x238)):_0x319998[_0x45574f(0x20b)];_0x56be0c['push']({'name':_0x319998[_0x45574f(0x1ff)],'dir':_0x283b26,'yaml':_0x319998,'systemPrompt':_0x3091dd,'starterMessage':_0xa138a4});}}const _0x411a03=getKnowledgeBasesDir(_0x1ddf2b);if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x411a03)){const _0x4bf9e6=a133_0x1b52fe[_0x45574f(0x164)](_0x411a03);for(const _0x4f6b21 of _0x4bf9e6){const _0x1bb6a4=a133_0x3324d2[_0x45574f(0x190)](_0x411a03,_0x4f6b21);if(_0x4f6b21[_0x45574f(0x218)]('.yml')){const _0x1c3b58=parseKnowledgeBaseYaml(a133_0x1b52fe[_0x45574f(0x1c6)](_0x1bb6a4,_0x45574f(0x238)),_0x1bb6a4);_0xee802f[_0x45574f(0x13f)]({'name':_0x1c3b58[_0x45574f(0x1ff)],'path':_0x1bb6a4,'yaml':_0x1c3b58});}else{if(_0x4f6b21[_0x45574f(0x218)]('.md')){const _0x5796c7=a133_0x1b52fe[_0x45574f(0x1c6)](_0x1bb6a4,'utf-8'),{name:_0x5c38a9,text:_0xd8845b}=parseTextKnowledgeBaseMd(_0x5796c7,_0x4f6b21);_0x37cc99[_0x45574f(0x13f)]({'name':_0x5c38a9,'path':_0x1bb6a4,'text':_0xd8845b});}}}}const _0x2e45cc=getPromptsDir(_0x1ddf2b);if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x2e45cc)){const _0xee74b9=a133_0x1b52fe['readdirSync'](_0x2e45cc)[_0x45574f(0x20e)](_0xeba942=>_0xeba942['endsWith'](_0x45574f(0x1eb)));for(const _0x112638 of _0xee74b9){const _0x595fbc=a133_0x3324d2[_0x45574f(0x190)](_0x2e45cc,_0x112638),_0x213237=parsePromptYaml(a133_0x1b52fe[_0x45574f(0x1c6)](_0x595fbc,_0x45574f(0x238)),_0x595fbc);_0x420851[_0x45574f(0x13f)]({'name':_0x213237[_0x45574f(0x1ff)],'path':_0x595fbc,'yaml':_0x213237});}}const _0x5ae942=getIntegrationsDir(_0x1ddf2b);if(a133_0x1b52fe['existsSync'](_0x5ae942)){const _0xdb3518=a133_0x1b52fe['readdirSync'](_0x5ae942)[_0x45574f(0x20e)](_0x26176f=>_0x26176f[_0x45574f(0x218)](_0x45574f(0x1eb)));for(const _0x267cb4 of _0xdb3518){const _0x16b200=a133_0x3324d2[_0x45574f(0x190)](_0x5ae942,_0x267cb4),_0x38b470=parseIntegrationYaml(a133_0x1b52fe['readFileSync'](_0x16b200,_0x45574f(0x238)),_0x16b200);SAFE_INTEGRATION_TYPES['includes'](_0x38b470[_0x45574f(0x1fa)]['toLowerCase']())?_0xa1c9d9[_0x45574f(0x13f)]({'name':_0x38b470[_0x45574f(0x1ff)],'path':_0x16b200,'yaml':_0x38b470}):this[_0x45574f(0x147)][_0x45574f(0x206)](_0x45574f(0x1a9)+_0x38b470[_0x45574f(0x1ff)]+'\x27\x20('+_0x38b470[_0x45574f(0x1fa)]+_0x45574f(0x1ec)+(_0x45574f(0x1c5)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x45574f(0x127)));}}const _0x12190c=getExperimentalKnowledgeBasesDir(_0x1ddf2b);if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x12190c)){const _0xb46151=a133_0x1b52fe[_0x45574f(0x164)](_0x12190c,{'withFileTypes':!![]});for(const _0x4cd02d of _0xb46151){if(!_0x4cd02d[_0x45574f(0x16c)]())continue;const _0x5f32a5=a133_0x3324d2['join'](_0x12190c,_0x4cd02d[_0x45574f(0x1ff)]),_0x4e80d7=a133_0x3324d2[_0x45574f(0x190)](_0x5f32a5,_0x4cd02d[_0x45574f(0x1ff)]+'.yml');if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x4e80d7)){const _0x542206=parseExperimentalKnowledgeBaseYaml(a133_0x1b52fe[_0x45574f(0x1c6)](_0x4e80d7,_0x45574f(0x238)),_0x4e80d7),_0x3f9a8e=a133_0x3324d2[_0x45574f(0x190)](_0x5f32a5,_0x45574f(0x17a)),_0x59b992=[];if(a133_0x1b52fe['existsSync'](_0x3f9a8e)){const _0x37a615=a133_0x1b52fe[_0x45574f(0x164)](_0x3f9a8e,{'withFileTypes':!![]});for(const _0x44ae3e of _0x37a615){if(!_0x44ae3e[_0x45574f(0x16c)]())continue;const _0x5efa6d=a133_0x3324d2[_0x45574f(0x190)](_0x3f9a8e,_0x44ae3e[_0x45574f(0x1ff)]),_0x192799=a133_0x3324d2[_0x45574f(0x190)](_0x5efa6d,_0x45574f(0x1db)),_0x19ccb8=a133_0x3324d2[_0x45574f(0x190)](_0x5efa6d,_0x45574f(0x216));if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x192799)&&a133_0x1b52fe[_0x45574f(0x1cb)](_0x19ccb8)){const _0x1bba7d=a133_0x1b52fe['readFileSync'](_0x192799,_0x45574f(0x238)),_0x226b1e=a133_0x1b52fe['readFileSync'](_0x19ccb8,'utf-8');_0x59b992[_0x45574f(0x13f)]({'name':_0x44ae3e[_0x45574f(0x1ff)],'code':_0x1bba7d,'json_schema':_0x226b1e});}}}const _0x2087dc={..._0x542206,'functions':_0x59b992};_0x5b7842['push']({'name':_0x542206[_0x45574f(0x1ff)],'path':_0x5f32a5,'def':_0x2087dc});}}}const _0x13a538=getExperimentalArtifactsDir(_0x1ddf2b);if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x13a538)){const _0x47cc34=a133_0x1b52fe[_0x45574f(0x164)](_0x13a538,{'withFileTypes':!![]});for(const _0x4d88be of _0x47cc34){if(!_0x4d88be[_0x45574f(0x16c)]())continue;const _0x3be26b=a133_0x3324d2[_0x45574f(0x190)](_0x13a538,_0x4d88be[_0x45574f(0x1ff)]),_0x296e77=a133_0x3324d2[_0x45574f(0x190)](_0x3be26b,_0x4d88be['name']+_0x45574f(0x1eb));if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x296e77)){const _0x22c55a=parseExperimentalArtifactYaml(a133_0x1b52fe['readFileSync'](_0x296e77,_0x45574f(0x238)),_0x296e77),_0x155f1f=a133_0x3324d2[_0x45574f(0x190)](_0x3be26b,_0x45574f(0x1db)),_0x1eb908=a133_0x1b52fe[_0x45574f(0x1cb)](_0x155f1f)?a133_0x1b52fe[_0x45574f(0x1c6)](_0x155f1f,'utf-8'):'',_0x1ffed1=a133_0x3324d2[_0x45574f(0x190)](_0x3be26b,_0x45574f(0x11e)),_0x3f1d72=[];if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x1ffed1)){const _0x13d749=a133_0x1b52fe[_0x45574f(0x164)](_0x1ffed1);for(const _0x281214 of _0x13d749){const _0x41e5e=a133_0x3324d2['join'](_0x1ffed1,_0x281214);if(a133_0x1b52fe[_0x45574f(0x1b5)](_0x41e5e)[_0x45574f(0x167)]()){const _0x1c4df5=a133_0x1b52fe[_0x45574f(0x1c6)](_0x41e5e,_0x45574f(0x238));_0x3f1d72[_0x45574f(0x13f)]({'file_name':_0x281214,'text_content':_0x1c4df5});}}}const _0x52f64a={..._0x22c55a,'code':_0x1eb908,'files':_0x3f1d72};_0x45907b[_0x45574f(0x13f)]({'name':_0x22c55a[_0x45574f(0x1ff)],'path':_0x3be26b,'def':_0x52f64a});}}}const _0x36b4bb=getFormInterfacesDir(_0x1ddf2b);if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x36b4bb)){const _0x1c6a18=a133_0x1b52fe['readdirSync'](_0x36b4bb)[_0x45574f(0x20e)](_0x35b894=>_0x35b894['endsWith'](_0x45574f(0x1eb)));for(const _0x5e7d22 of _0x1c6a18){const _0x541065=a133_0x3324d2[_0x45574f(0x190)](_0x36b4bb,_0x5e7d22),_0x53817d=parseFormInterfaceYaml(a133_0x1b52fe[_0x45574f(0x1c6)](_0x541065,'utf-8'),_0x541065);_0xbf1430[_0x45574f(0x13f)]({'name':_0x53817d[_0x45574f(0x1ff)],'path':_0x541065,'yaml':_0x53817d});}}const _0xf43ead=getChatInterfacesDir(_0x1ddf2b);if(a133_0x1b52fe[_0x45574f(0x1cb)](_0xf43ead)){const _0x4f98fd=a133_0x1b52fe['readdirSync'](_0xf43ead)['filter'](_0x6ab9f6=>_0x6ab9f6['endsWith'](_0x45574f(0x1eb)));for(const _0x11e96d of _0x4f98fd){const _0x99d25f=a133_0x3324d2[_0x45574f(0x190)](_0xf43ead,_0x11e96d),_0x3c46bc=parseChatInterfaceYaml(a133_0x1b52fe['readFileSync'](_0x99d25f,_0x45574f(0x238)),_0x99d25f);_0x55a4b6[_0x45574f(0x13f)]({'name':_0x3c46bc[_0x45574f(0x1ff)],'path':_0x99d25f,'yaml':_0x3c46bc});}}}else{const _0x5e03c4=await this[_0x45574f(0x197)](_0x1ddf2b),_0x52af63=await this[_0x45574f(0x1c9)][_0x45574f(0x1b7)](_0x5e03c4);_0x27218f=_0x52af63[_0x45574f(0x19e)][_0x45574f(0x1ff)];const _0x30b0b2=await this['client'][_0x45574f(0x13b)](_0x5e03c4),_0x3b07ef=await this['client']['listKnowledgeBases'](_0x5e03c4),_0x19c521=await this[_0x45574f(0x1c9)][_0x45574f(0x231)](_0x5e03c4),_0x2fa3ff=await this[_0x45574f(0x1c9)][_0x45574f(0x158)](_0x5e03c4),_0x238288=await this[_0x45574f(0x1c9)][_0x45574f(0x1d1)](_0x5e03c4),_0x4f007c=await safeListOrEmpty(()=>this[_0x45574f(0x1c9)][_0x45574f(0x1fd)](_0x5e03c4)),_0xaaea1b=await safeListOrEmpty(()=>this['client']['listExperimentalArtifacts'](_0x5e03c4)),_0x518227=new Map(),_0x415d01=new Map(),_0x1b7159=new Map(),_0x1adebf=new Map(),_0x52eb6d=new Map(),_0x4cac54=new Map();for(const _0xdad27a of _0x3b07ef){_0x518227[_0x45574f(0x1f8)](_0xdad27a['id'],_0xdad27a[_0x45574f(0x19e)][_0x45574f(0x1ff)]);}for(const _0xeb1144 of _0x19c521){_0x415d01[_0x45574f(0x1f8)](_0xeb1144['id'],_0xeb1144[_0x45574f(0x19e)]['name']);}for(const _0x591bd5 of _0x30b0b2){_0x1b7159[_0x45574f(0x1f8)](_0x591bd5['id'],_0x591bd5['attributes'][_0x45574f(0x1ff)]);}for(const _0x2bdd08 of _0x2fa3ff){_0x1adebf[_0x45574f(0x1f8)](_0x2bdd08['id'],_0x2bdd08[_0x45574f(0x19e)][_0x45574f(0x1ff)]);}for(const _0x3e6904 of _0x4f007c){_0x52eb6d[_0x45574f(0x1f8)](_0x3e6904['id'],_0x3e6904[_0x45574f(0x19e)][_0x45574f(0x1ff)]);}for(const _0x35f073 of _0xaaea1b){_0x4cac54[_0x45574f(0x1f8)](_0x35f073['id'],_0x35f073[_0x45574f(0x19e)][_0x45574f(0x1ff)]);}const _0x4d0184={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x518227,'TextKnowledgeBase':_0x415d01,'Agent':_0x1b7159,'ExperimentalKnowledgeBase':_0x52eb6d}),'resolvePromptName':async _0x19e655=>_0x1adebf[_0x45574f(0x1d3)](_0x19e655),'onWarning':_0x23ad9b=>this[_0x45574f(0x147)]['warn'](_0x23ad9b)};for(const _0x22da6f of _0x30b0b2){const _0x121e98=await agentResponseToDef(_0x22da6f,_0x4d0184),{yaml:_0x166227,systemPrompt:_0x1f78a1,starterMessage:_0x28f1c3}=_0x121e98;_0x56be0c['push']({'name':_0x166227[_0x45574f(0x1ff)],'dir':'','yaml':_0x166227,'systemPrompt':_0x1f78a1,'starterMessage':_0x28f1c3});}for(const _0x1b8fcd of _0x3b07ef){const _0x5e0921=apiKnowledgeBaseToYaml(_0x1b8fcd);_0xee802f['push']({'name':_0x5e0921[_0x45574f(0x1ff)],'path':'','yaml':_0x5e0921});}for(const _0x4e07d0 of _0x19c521){_0x37cc99['push']({'name':_0x4e07d0['attributes']['name'],'path':'','text':_0x4e07d0['attributes']['text']});}for(const _0x584f43 of _0x2fa3ff){const _0x47a808=await apiPromptToYaml(_0x584f43,_0x4d0184);_0x47a808&&_0x420851[_0x45574f(0x13f)]({'name':_0x47a808['name'],'path':'','yaml':_0x47a808});}for(const _0x37ff5d of _0x238288){if(!_0x37ff5d['attributes'][_0x45574f(0x1f7)]&&SAFE_INTEGRATION_TYPES[_0x45574f(0x17f)](_0x37ff5d['attributes'][_0x45574f(0x1ae)]['toLowerCase']())){const _0x30451e=await apiIntegrationToYaml(_0x37ff5d,_0x4d0184);_0xa1c9d9[_0x45574f(0x13f)]({'name':_0x37ff5d[_0x45574f(0x19e)][_0x45574f(0x1ae)]['toLowerCase'](),'path':'','yaml':_0x30451e});}}for(const _0x228ace of _0x4f007c){const _0x30d19e=apiExperimentalKnowledgeBaseToYaml(_0x228ace);_0x5b7842[_0x45574f(0x13f)]({'name':_0x30d19e['name'],'path':'','def':_0x30d19e});}for(const _0x57b7d6 of _0xaaea1b){const _0xf37f7=apiExperimentalArtifactToYaml(_0x57b7d6);_0x45907b[_0x45574f(0x13f)]({'name':_0xf37f7[_0x45574f(0x1ff)],'path':'','def':_0xf37f7});}const _0x1856aa=await safeListOrEmpty(()=>this[_0x45574f(0x1c9)][_0x45574f(0x17d)](_0x5e03c4));for(const _0x2c63a7 of _0x1856aa){const _0x211634=await apiFormInterfaceToYaml(_0x2c63a7,_0x4d0184);_0xbf1430[_0x45574f(0x13f)]({'name':_0x211634[_0x45574f(0x1ff)],'path':'','yaml':_0x211634});}const _0x885f64=await safeListOrEmpty(()=>this['client']['listChatInterfaces'](_0x5e03c4));for(const _0x10866b of _0x885f64){if(_0x10866b[_0x45574f(0x19e)]['isManaged'])continue;const _0x46bf4f=await apiChatInterfaceToYaml(_0x10866b,_0x4d0184);_0x55a4b6[_0x45574f(0x13f)]({'name':_0x46bf4f[_0x45574f(0x1ff)],'path':'','yaml':_0x46bf4f});}}const _0x1585b8={'sourceProjectName':_0x27218f,'newProjectName':_0x1ca9e7,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'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},'formInterfaces':{'created':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'errors':0x0}}},_0xc4b141=await this[_0x45574f(0x1c9)][_0x45574f(0x22e)](),_0x4895bc=_0xc4b141[_0x45574f(0x12a)](_0x56c071=>_0x56c071['attributes'][_0x45574f(0x1ff)]===_0x1ca9e7);if(_0x4895bc)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x45574f(0x152)+_0x1ca9e7+_0x45574f(0x16f),undefined,{'helpText':_0x45574f(0x119)});if(_0x5dfcaa?.['dryRun'])return _0x1585b8['counts'][_0x45574f(0x1c3)][_0x45574f(0x141)]=_0x56be0c[_0x45574f(0x21c)],_0x1585b8['counts'][_0x45574f(0x1d0)][_0x45574f(0x141)]=_0xee802f[_0x45574f(0x21c)],_0x1585b8['counts'][_0x45574f(0x23a)][_0x45574f(0x141)]=_0x37cc99[_0x45574f(0x21c)],_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x192)]['created']=_0x5b7842[_0x45574f(0x21c)],_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x1f9)]['created']=_0x45907b[_0x45574f(0x21c)],_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x1ad)][_0x45574f(0x141)]=_0x420851[_0x45574f(0x21c)],_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x17c)]['created']=_0xa1c9d9[_0x45574f(0x21c)],_0x1585b8;const _0x3938aa=await this[_0x45574f(0x1c9)][_0x45574f(0x18f)]({'name':_0x1ca9e7}),_0x54597a=_0x3938aa['id'];_0x1585b8['newProjectId']=_0x54597a;const _0x1bbd4c=new Map(),_0x2e0c56=new Map(),_0x510a9f=new Map(),_0x533c1a=new Map(),_0x2c9fef=new Map(),_0x399a6b=new Map(),_0x245323=new Map(),_0x51b324=new Map(),_0x171566=new Set(),_0x1815fa=new Set();for(const _0x58040e of _0x56be0c){for(const _0x45345e of _0x58040e[_0x45574f(0x1f2)][_0x45574f(0x172)]||[]){if(_0x45345e[_0x45574f(0x18e)]===_0x45574f(0x1da)&&_0x45345e[_0x45574f(0x1d4)]){const _0x3d2323=parseRef(_0x45345e['target']);if(_0x3d2323)_0x171566[_0x45574f(0x12e)](_0x3d2323[_0x45574f(0x1ff)]);}else{if(_0x45345e[_0x45574f(0x18e)]==='web_search'&&_0x45345e[_0x45574f(0x1d4)]){const _0x24152c=parseRef(_0x45345e[_0x45574f(0x1d4)]);if(_0x24152c)_0x1815fa[_0x45574f(0x12e)](_0x24152c['name']);}}}}for(const _0xed867b of _0x171566){try{const _0x3472dd=await this['client'][_0x45574f(0x145)]({'projectId':_0x54597a,'name':_0xed867b});_0x2c9fef[_0x45574f(0x1f8)](_0xed867b,_0x3472dd['id']),_0x1585b8[_0x45574f(0x149)][_0x45574f(0x13f)]({'name':_0xed867b,'action':'created','id':_0x3472dd['id']}),_0x1585b8['counts'][_0x45574f(0x149)]['created']++;}catch(_0x7302){_0x1585b8[_0x45574f(0x149)]['push']({'name':_0xed867b,'action':_0x45574f(0x1d9),'error':_0x7302[_0x45574f(0x214)]}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x149)][_0x45574f(0x221)]++;}}for(const _0x53b815 of _0x1815fa){try{const _0x591acf=await this[_0x45574f(0x1c9)]['createWebSearchTool']({'projectId':_0x54597a,'name':_0x53b815});_0x399a6b[_0x45574f(0x1f8)](_0x53b815,_0x591acf['id']),_0x1585b8[_0x45574f(0x15a)]['push']({'name':_0x53b815,'action':_0x45574f(0x141),'id':_0x591acf['id']}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x15a)][_0x45574f(0x141)]++;}catch(_0x18db1d){_0x1585b8[_0x45574f(0x15a)]['push']({'name':_0x53b815,'action':_0x45574f(0x1d9),'error':_0x18db1d[_0x45574f(0x214)]}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x15a)][_0x45574f(0x221)]++;}}const _0x128484=await fetchAllToolTargetMaps((_0x5ebace,_0x1e1b5b)=>this[_0x45574f(0x1c9)][_0x45574f(0x189)](_0x5ebace,_0x1e1b5b),_0x54597a);let _0x5d819c=[];const _0x8358f7={'projectId':_0x54597a,'resolveToolTargetId':buildIdResolver({..._0x128484[_0x45574f(0x128)],'KnowledgeBase':_0x1bbd4c,'TextKnowledgeBase':_0x2e0c56,'ExperimentalKnowledgeBase':_0x245323,'Agent':_0x510a9f,'WebSearchTool':_0x399a6b,'ImageGenerator':_0x2c9fef}),'resolvePromptId':async _0x255858=>_0x533c1a[_0x45574f(0x1d3)](_0x255858),'onWarning':_0x4a0de6=>{const _0x49819a=_0x45574f;this[_0x49819a(0x147)][_0x49819a(0x206)](_0x4a0de6),_0x5d819c[_0x49819a(0x13f)](_0x4a0de6);}};for(const _0x4b01ae of _0xee802f){try{const _0x334948=yamlKnowledgeBaseToApi(_0x4b01ae[_0x45574f(0x1f2)],_0x54597a),_0x2da1b7=await this[_0x45574f(0x1c9)][_0x45574f(0x1ed)](_0x334948);_0x1bbd4c[_0x45574f(0x1f8)](_0x4b01ae['yaml'][_0x45574f(0x1ff)],_0x2da1b7['id']),_0x1585b8[_0x45574f(0x1d0)][_0x45574f(0x13f)]({'name':_0x4b01ae[_0x45574f(0x1f2)][_0x45574f(0x1ff)],'action':_0x45574f(0x141),'id':_0x2da1b7['id']}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x1d0)][_0x45574f(0x141)]++;}catch(_0x1d688e){_0x1585b8[_0x45574f(0x1d0)][_0x45574f(0x13f)]({'name':_0x4b01ae[_0x45574f(0x1f2)][_0x45574f(0x1ff)],'action':_0x45574f(0x1d9),'error':_0x1d688e[_0x45574f(0x214)]}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x1d0)][_0x45574f(0x221)]++;}}for(const _0x41bd8e of _0x37cc99){try{const _0x1e734f=yamlTextKnowledgeBaseToApi({'name':_0x41bd8e[_0x45574f(0x1ff)],'text':_0x41bd8e[_0x45574f(0x21a)]},_0x54597a),_0x87d2b0=await this['client'][_0x45574f(0x1c2)](_0x1e734f);_0x2e0c56['set'](_0x41bd8e[_0x45574f(0x1ff)],_0x87d2b0['id']),_0x1585b8[_0x45574f(0x23a)]['push']({'name':_0x41bd8e[_0x45574f(0x1ff)],'action':_0x45574f(0x141),'id':_0x87d2b0['id']}),_0x1585b8['counts'][_0x45574f(0x23a)][_0x45574f(0x141)]++;}catch(_0x35a2bf){_0x1585b8[_0x45574f(0x23a)][_0x45574f(0x13f)]({'name':_0x41bd8e[_0x45574f(0x1ff)],'action':_0x45574f(0x1d9),'error':_0x35a2bf[_0x45574f(0x214)]}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x23a)][_0x45574f(0x221)]++;}}for(const _0x5b9f9f of _0x45907b){try{const _0x5a9148=yamlExperimentalArtifactToApi(_0x5b9f9f['def'],_0x54597a),_0x374c2=await this[_0x45574f(0x1c9)][_0x45574f(0x1b0)](_0x5a9148);_0x51b324[_0x45574f(0x1f8)](_0x5b9f9f[_0x45574f(0x1e1)][_0x45574f(0x1ff)],_0x374c2['id']),_0x1585b8['experimentalArtifacts'][_0x45574f(0x13f)]({'name':_0x5b9f9f[_0x45574f(0x1e1)][_0x45574f(0x1ff)],'action':_0x45574f(0x141),'id':_0x374c2['id']}),_0x1585b8['counts'][_0x45574f(0x1f9)][_0x45574f(0x141)]++;}catch(_0x3d4332){_0x1585b8[_0x45574f(0x1f9)]['push']({'name':_0x5b9f9f[_0x45574f(0x1e1)][_0x45574f(0x1ff)],'action':_0x45574f(0x1d9),'error':_0x3d4332['message']}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x1f9)][_0x45574f(0x221)]++;}}for(const _0x57658d of _0x5b7842){try{const _0x3b6163=yamlExperimentalKnowledgeBaseToApi(_0x57658d['def'],_0x54597a),_0x54865a=await this[_0x45574f(0x1c9)][_0x45574f(0x12b)](_0x3b6163);_0x245323[_0x45574f(0x1f8)](_0x57658d[_0x45574f(0x1e1)][_0x45574f(0x1ff)],_0x54865a['id']),_0x1585b8[_0x45574f(0x192)][_0x45574f(0x13f)]({'name':_0x57658d[_0x45574f(0x1e1)][_0x45574f(0x1ff)],'action':'created','id':_0x54865a['id']}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x192)][_0x45574f(0x141)]++;}catch(_0xcf4259){_0x1585b8[_0x45574f(0x192)][_0x45574f(0x13f)]({'name':_0x57658d['def'][_0x45574f(0x1ff)],'action':_0x45574f(0x1d9),'error':_0xcf4259[_0x45574f(0x214)]}),_0x1585b8['counts']['experimentalKnowledgeBases']['errors']++;}}const _0x5c8c96=[..._0x56be0c]['sort']((_0x9160e1,_0x272778)=>{const _0x3dc15e=_0x45574f,_0x58d732=_0x9160e1[_0x3dc15e(0x1f2)][_0x3dc15e(0x172)]?.['some'](_0x3536fa=>_0x3536fa[_0x3dc15e(0x18e)]==='agent')??![],_0xa4970=_0x272778[_0x3dc15e(0x1f2)][_0x3dc15e(0x172)]?.['some'](_0x52408a=>_0x52408a['type']===_0x3dc15e(0x183))??![];if(_0x58d732&&!_0xa4970)return 0x1;if(!_0x58d732&&_0xa4970)return-0x1;return 0x0;});for(const _0x4e8cce of _0x5c8c96){_0x5d819c=[];try{const _0x1a91f9=_0x4e8cce[_0x45574f(0x1f2)]['tools']?.[_0x45574f(0x20e)](_0x207df6=>{const _0x45c774=_0x45574f;if(_0x207df6['type']===_0x45c774(0x183)&&_0x207df6[_0x45c774(0x1d4)]){const _0x575240=parseRef(_0x207df6[_0x45c774(0x1d4)]);return _0x575240?.[_0x45c774(0x1ff)]===_0x4e8cce[_0x45c774(0x1f2)]['name'];}return![];})??[];if(_0x1a91f9[_0x45574f(0x21c)]>0x0){const _0x37e30f=_0x45574f(0x132)+_0x4e8cce['yaml'][_0x45574f(0x1ff)]+_0x45574f(0x151)+_0x45574f(0x155);this[_0x45574f(0x147)][_0x45574f(0x206)](_0x37e30f),_0x5d819c[_0x45574f(0x13f)](_0x37e30f);}const _0x52762d=await agentDefToRequest(_0x4e8cce[_0x45574f(0x1f2)],_0x4e8cce[_0x45574f(0x200)],_0x4e8cce[_0x45574f(0x1bc)],_0x8358f7),_0xb14208=await this[_0x45574f(0x1c9)][_0x45574f(0x131)](_0x52762d);_0x510a9f[_0x45574f(0x1f8)](_0x4e8cce[_0x45574f(0x1f2)][_0x45574f(0x1ff)],_0xb14208['id']),_0x1585b8[_0x45574f(0x1c3)][_0x45574f(0x13f)]({'agentName':_0x4e8cce[_0x45574f(0x1f2)]['name'],'action':'created','agentId':_0xb14208['id'],'warnings':_0x5d819c[_0x45574f(0x21c)]>0x0?_0x5d819c:undefined}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x1c3)][_0x45574f(0x141)]++;}catch(_0x36bae6){_0x1585b8[_0x45574f(0x1c3)][_0x45574f(0x13f)]({'agentName':_0x4e8cce[_0x45574f(0x1f2)][_0x45574f(0x1ff)],'action':'error','error':_0x36bae6[_0x45574f(0x214)],'warnings':_0x5d819c['length']>0x0?_0x5d819c:undefined}),_0x1585b8[_0x45574f(0x20a)]['agents'][_0x45574f(0x221)]++;}}for(const _0x3fe225 of _0x420851){try{const _0x59dca6=await yamlPromptToApi(_0x3fe225[_0x45574f(0x1f2)],_0x54597a,_0x8358f7);if(!_0x59dca6){_0x1585b8[_0x45574f(0x1ad)][_0x45574f(0x13f)]({'name':_0x3fe225[_0x45574f(0x1f2)][_0x45574f(0x1ff)],'action':_0x45574f(0x1d9),'error':_0x45574f(0x22d)}),_0x1585b8[_0x45574f(0x20a)]['prompts'][_0x45574f(0x221)]++;continue;}const _0x31b95f=await this[_0x45574f(0x1c9)][_0x45574f(0x179)](_0x59dca6);_0x533c1a['set'](_0x3fe225[_0x45574f(0x1f2)]['name'],_0x31b95f['id']),_0x1585b8['prompts'][_0x45574f(0x13f)]({'name':_0x3fe225[_0x45574f(0x1f2)]['name'],'action':_0x45574f(0x141),'id':_0x31b95f['id']}),_0x1585b8[_0x45574f(0x20a)]['prompts'][_0x45574f(0x141)]++;}catch(_0x11a9f9){_0x1585b8[_0x45574f(0x1ad)][_0x45574f(0x13f)]({'name':_0x3fe225[_0x45574f(0x1f2)][_0x45574f(0x1ff)],'action':_0x45574f(0x1d9),'error':_0x11a9f9[_0x45574f(0x214)]}),_0x1585b8[_0x45574f(0x20a)]['prompts']['errors']++;}}for(const _0x4acbb4 of _0xa1c9d9){try{const _0x2aef7e=await yamlIntegrationToApi(_0x4acbb4[_0x45574f(0x1f2)],_0x54597a,_0x8358f7),_0x10c837=await this['client'][_0x45574f(0x12f)](_0x2aef7e);_0x1585b8[_0x45574f(0x17c)][_0x45574f(0x13f)]({'name':_0x4acbb4['yaml'][_0x45574f(0x1fa)],'action':_0x45574f(0x141),'id':_0x10c837['id']}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x17c)][_0x45574f(0x141)]++;}catch(_0x3c80d8){_0x1585b8[_0x45574f(0x17c)][_0x45574f(0x13f)]({'name':_0x4acbb4[_0x45574f(0x1f2)][_0x45574f(0x1fa)],'action':_0x45574f(0x1d9),'error':_0x3c80d8[_0x45574f(0x214)]}),_0x1585b8[_0x45574f(0x20a)]['integrations'][_0x45574f(0x221)]++;}}for(const _0x1bdbd8 of _0xbf1430){try{const _0x13eb3b=await yamlFormInterfaceToApi(_0x1bdbd8['yaml'],_0x54597a,_0x8358f7);if(!_0x13eb3b){_0x1585b8[_0x45574f(0x1dc)][_0x45574f(0x13f)]({'name':_0x1bdbd8['yaml'][_0x45574f(0x1ff)],'action':_0x45574f(0x1d9),'error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x1585b8[_0x45574f(0x20a)]['formInterfaces']['errors']++;continue;}const _0x46f7da=await this['client'][_0x45574f(0x15c)](_0x13eb3b);_0x1585b8[_0x45574f(0x1dc)]['push']({'name':_0x1bdbd8['yaml'][_0x45574f(0x1ff)],'action':_0x45574f(0x141),'id':_0x46f7da['id']}),_0x1585b8['counts'][_0x45574f(0x1dc)][_0x45574f(0x141)]++;}catch(_0x3b730d){_0x1585b8['formInterfaces']['push']({'name':_0x1bdbd8['yaml'][_0x45574f(0x1ff)],'action':'error','error':_0x3b730d['message']}),_0x1585b8[_0x45574f(0x20a)]['formInterfaces']['errors']++;}}for(const _0x2f1c1f of _0x55a4b6){try{const _0x2b801e=await yamlChatInterfaceToApi(_0x2f1c1f[_0x45574f(0x1f2)],_0x54597a,_0x8358f7),_0x7725f3=await this[_0x45574f(0x1c9)][_0x45574f(0x22b)](_0x2b801e);_0x1585b8['chatInterfaces'][_0x45574f(0x13f)]({'name':_0x2f1c1f[_0x45574f(0x1f2)][_0x45574f(0x1ff)],'action':'created','id':_0x7725f3['id']}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x1e4)]['created']++;}catch(_0x2a2f90){_0x1585b8[_0x45574f(0x1e4)][_0x45574f(0x13f)]({'name':_0x2f1c1f['yaml'][_0x45574f(0x1ff)],'action':_0x45574f(0x1d9),'error':_0x2a2f90[_0x45574f(0x214)]}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x1e4)][_0x45574f(0x221)]++;}}return _0x1585b8;}}
|