@treasuredata/tdx 2026.4.13 → 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_0x533a84=a133_0x323b;(function(_0x7c47b0,_0xdfcf94){const _0x26bdb3=a133_0x323b,_0x2d26f2=_0x7c47b0();while(!![]){try{const _0x590215=parseInt(_0x26bdb3(0x1db))/0x1+parseInt(_0x26bdb3(0x1c0))/0x2+-parseInt(_0x26bdb3(0x2c5))/0x3+-parseInt(_0x26bdb3(0x1cf))/0x4+-parseInt(_0x26bdb3(0x2a5))/0x5*(parseInt(_0x26bdb3(0x1d3))/0x6)+-parseInt(_0x26bdb3(0x2b1))/0x7+parseInt(_0x26bdb3(0x262))/0x8;if(_0x590215===_0xdfcf94)break;else _0x2d26f2['push'](_0x2d26f2['shift']());}catch(_0x53e79e){_0x2d26f2['push'](_0x2d26f2['shift']());}}}(a133_0x51c8,0xc2768));import{LLMApiClient}from'../client/llm-api-client.js';import*as a133_0x11072e from'node:fs';import*as a133_0x503bb8 from'node:path';function a133_0x323b(_0x5208e6,_0x59800c){_0x5208e6=_0x5208e6-0x1a3;const _0x51c81c=a133_0x51c8();let _0x323bd0=_0x51c81c[_0x5208e6];return _0x323bd0;}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';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a133_0x533a84(0x1bf),a133_0x533a84(0x23c),a133_0x533a84(0x20e)];function a133_0x51c8(){const _0x480f6b=['site','currentProjectId','listToolTargets','Agent\x20not\x20found:\x20','listImageGenerators','integrations.json','\x27.\x20This\x20should\x20not\x20happen.','history','startChat','updateExperimentalArtifact','outputs','serviceType','attributes','Removed\x20deleted\x20file:\x20','listTextKnowledgeBases','dryRun','setDefaultAgent','\x20attempts\x20due\x20to\x20name\x20conflicts.','newProjectId','length','chat_generic','949418zxSyFM','formInterfaces','Renamed\x20KB\x20file:\x20','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','errors','deleteAgent','nameToId','setCurrentProject','pullAgent','listIntegrations','agent.yml','get','toLowerCase','metadata','Skipping\x20integration\x20\x27','5623656fCbkgC','code.js','status','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','18Wjdicn','localeCompare','experimental_knowledge_bases','systemPrompt','createImageGenerator','chatInterfaces','sdk.llm','listAgents','1163758QSmoOm','includes','updateAgentResponse','listAgentsFull','form_interfaces','prompts.json','has','updated','endsWith','listChatInterfaces','tdx.json','def','.llm','medium','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','createPrompt','prompt.md','starter_message','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','projectId','split','getChatInfo','---\x20file:\x20','projectName','knowledge_bases','Renamed\x20folder:\x20','continueChat','basename','promptId','total','.md','isDirectory','\x20→\x20','\x0a---\x20schema:\x20','new','dry-run-','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.','createChatInterface','Invalid\x20agent\x20reference\x20format:\x20','models','oldPath','updateAgent','profile','event','add','Only\x20safe\x20types\x20(','knowledgeBases','updateTextKnowledgeBase','experimentalKnowledgeBases','chat_interfaces','getOrCreateDefaultAgent','chat_parent_segment','webSearchTools','keys','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','Unable\x20to\x20create\x20project\x20after\x20','filter','content','Renamed\x20integration\x20file:\x20','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','parse','loadJsonFile','cloneProject','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','size','info','isDir','low','Agent\x20\x27','listExperimentalKnowledgeBases','\x22\x20already\x20exists','some','availableModelNames','Unresolved\x20dependencies:\x20','createAgent','resolveProjectId','chat','getUserSettings','\x20---\x0a','):\x20','name','isManaged','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','backupProject','chats','map','INVALID_ARGUMENT','starter_message.md','readFileSync','file_name','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','jsonSchemaHint','writeFileSync','find','agents','version','Output\x20directory\x20already\x20exists:\x20','chat_agent_console','dir','type','UNAUTHENTICATED','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','getChatLog','message','webhookCorsOrigins','updateFormInterface','text','Renamed\x20experimental\x20artifact\x20directory:\x20','service_type','createWebSearchTool','mkdirSync','tables','Removed\x20deleted\x20directory:\x20','project.json','1.0','agent','temperature','image_gen','functions','NOT_FOUND','getBackupMetadata','description','clearDefaultAgent','knowledgebases.json','cwd','deleteProject','\x27\x20(','getChatHistory','AGENT_NOT_FOUND','tdx_default_','listProjects','Available\x20agents:\x20','listWebSearchTools','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','experimental_artifacts','28496128TUSTrw','dirname','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','starterMessage','existsSync','integrations','Multiple\x20projects\x20found\x20with\x20name\x20\x27','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','stringify','join','createFormInterface','#\x20prompt.md\x0a','llm_project','yaml','statSync','set','signal','prompts','Renamed\x20prompt\x20file:\x20','resolveAgentId','claude-4.5-sonnet','LLM_PROJECT_NOT_FOUND','created','---\x20schema:\x20','Project\x20\x22','utf-8','chatInfo','push','_reasoning_','restoreProject','target','unchanged','listPrompts','.yml','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','resolveProjectName','minimal','imageGenerators','isFile','\x0a---\x20code\x20---\x0a','createExperimentalKnowledgeBase','counts','code','Renamed\x20agent\x20folder:\x20','client','(dry-run)','createIntegration','TextKnowledgeBase','textKnowledgeBases','tdx_','exportedFrom','getDefaultProjectName','createExperimentalArtifact','json_schema','INTERNAL','Agent\x20reference\x20not\x20found','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','warn','error','listFormInterfaces','createAgentResponse','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','createTextKnowledgeBase','ExperimentalKnowledgeBase','\x0a\x0a#\x20agent.yml\x0a','already\x20exists','KnowledgeBase','2182605MWHzpj','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','getOrCreateDefaultProject','tdDatabaseName','reasoningEffort','sort','files','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','json_schema.json','displayName','getProject','getCurrentProject','5686954NWWfyF','tools','\x0a---\x20function:\x20','Backup\x20folder\x20not\x20found:\x20','path','variables','text_content','chatIgnoreManagedActions','chatId','maxToolIterations','none','createKnowledgeBase','deleteIntegration','experimentalArtifacts','template','pullProject','renamed','context','readdirSync','ALREADY_EXISTS','2628192pKDIXC','listKnowledgeBases','agentId','listExperimentalArtifacts','PERMISSION_DENIED','listChats','getDefaultAgent','logger','createProject','Project\x20not\x20found:\x20'];a133_0x51c8=function(){return _0x480f6b;};return a133_0x51c8();}async function safeListOrEmpty(_0x547c23){try{return await _0x547c23();}catch(_0x1c9730){if(_0x1c9730 instanceof HTTPClientError&&_0x1c9730['status']===0x194)return[];throw _0x1c9730;}}export class LLMSDK{[a133_0x533a84(0x1ac)];[a133_0x533a84(0x28e)];[a133_0x533a84(0x2c2)];[a133_0x533a84(0x1a8)]=Logger['of'](a133_0x533a84(0x1d9));constructor(_0x2a7a94){const _0x1eae3a=a133_0x533a84;this[_0x1eae3a(0x28e)]=new LLMApiClient(_0x2a7a94),this['context']=_0x2a7a94;}[a133_0x533a84(0x295)](){const _0x4d4d9b=a133_0x533a84,_0x4632cb=getSanitizedUsername();return _0x4d4d9b(0x25c)+_0x4632cb;}async[a133_0x533a84(0x1c7)](_0x17d22e){const _0x37aa45=a133_0x533a84,{projectId:_0x4c14db}=await this[_0x37aa45(0x285)](_0x17d22e);this[_0x37aa45(0x1ac)]=_0x4c14db;}[a133_0x533a84(0x2b0)](){const _0x2c0f23=a133_0x533a84;return this[_0x2c0f23(0x1ac)];}async[a133_0x533a84(0x1bb)](_0x809d35){const _0x14616b=a133_0x533a84,_0x181e29=this[_0x14616b(0x2c2)][_0x14616b(0x205)];let _0x2c1143,_0x22071e;if(_0x809d35[_0x14616b(0x1dc)]('/')){const _0x565f39=_0x809d35[_0x14616b(0x1ef)]('/');if(_0x565f39[_0x14616b(0x1be)]!==0x2)throw new SDKError(ErrorCode[_0x14616b(0x231)],_0x14616b(0x201)+_0x809d35,undefined,{'helpText':_0x14616b(0x29f)});const [_0x293bf0,_0x2c3e7a]=_0x565f39;_0x2c1143=await this[_0x14616b(0x226)](_0x293bf0),_0x22071e=_0x2c3e7a;}else _0x2c1143=this[_0x14616b(0x1ac)]||(await this[_0x14616b(0x2a7)]())['id'],_0x22071e=_0x809d35;const _0x2fb93b=await this[_0x14616b(0x275)](_0x22071e,_0x2c1143),_0x57ac9a=await this[_0x14616b(0x28e)]['getAgent'](_0x2fb93b);writeCachedLLMAgent(_0x57ac9a['attributes'][_0x14616b(0x22b)],_0x2fb93b,_0x2c1143,_0x181e29);}[a133_0x533a84(0x1a7)](){const _0x1a2097=a133_0x533a84,_0x3d327f=this[_0x1a2097(0x2c2)][_0x1a2097(0x205)];return readCachedLLMAgent(_0x3d327f)||undefined;}[a133_0x533a84(0x255)](){const _0x3e48d8=a133_0x533a84,_0x296cf7=this['context'][_0x3e48d8(0x205)];clearCachedLLMAgent(_0x296cf7);}async[a133_0x533a84(0x202)](){const _0x552517=a133_0x533a84,_0x4129f3=await this[_0x552517(0x28e)][_0x552517(0x228)](),_0x20508c=[];for(const _0x3e85a0 of _0x4129f3[_0x552517(0x223)]){const _0x8f380f=_0x4129f3['availableModels'][_0x3e85a0];_0x8f380f&&_0x20508c[_0x552517(0x27d)]({'name':_0x3e85a0,'displayName':_0x8f380f[_0x552517(0x2ae)]});}return _0x20508c;}async[a133_0x533a84(0x1a9)](_0x39ecd6){const _0x25a7d4=a133_0x533a84;return await this[_0x25a7d4(0x28e)]['createProject'](_0x39ecd6);}async[a133_0x533a84(0x258)](_0x1281b7){const _0xbd887d=a133_0x533a84,{projectId:_0x4d743b}=await this[_0xbd887d(0x285)](_0x1281b7);await this[_0xbd887d(0x28e)][_0xbd887d(0x258)](_0x4d743b);}async['projects'](_0x4b2a89=0x32){const _0x4539ce=a133_0x533a84;return await this['client'][_0x4539ce(0x25d)](_0x4b2a89);}async[a133_0x533a84(0x2a7)](_0x52817d){const _0x26c8a5=a133_0x533a84,_0x540567=_0x52817d||this[_0x26c8a5(0x295)](),_0x2bb301=this[_0x26c8a5(0x2c2)][_0x26c8a5(0x205)];if(!_0x52817d){const _0x50f397=readCachedLLMProject(_0x2bb301);if(_0x50f397&&_0x50f397['name']===_0x540567)try{const _0x3a5181=await this[_0x26c8a5(0x28e)][_0x26c8a5(0x2af)](_0x50f397['id']);if(_0x3a5181[_0x26c8a5(0x1b7)]['name']===_0x540567)return _0x3a5181;}catch{}}const _0x5f37a3=await this[_0x26c8a5(0x28e)][_0x26c8a5(0x25d)](),_0x1073cc=_0x5f37a3[_0x26c8a5(0x238)](_0x153a18=>_0x153a18[_0x26c8a5(0x1b7)][_0x26c8a5(0x22b)]===_0x540567);if(_0x1073cc)return!_0x52817d&&writeCachedLLMProject(_0x540567,_0x1073cc['id'],_0x2bb301),_0x1073cc;const _0x1e8800=await this[_0x26c8a5(0x28e)][_0x26c8a5(0x1a9)]({'name':_0x540567,'description':_0x26c8a5(0x260)+getSanitizedUsername()+')'});return!_0x52817d&&writeCachedLLMProject(_0x540567,_0x1e8800['id'],_0x2bb301),_0x1e8800;}async['resolveProjectId'](_0x3a1533){const _0x3a0694=a133_0x533a84,_0x2ee1a5=await this['client']['listProjects'](),_0x250a80=_0x2ee1a5['filter'](_0x2b567d=>_0x2b567d[_0x3a0694(0x1b7)][_0x3a0694(0x22b)]===_0x3a1533);if(_0x250a80[_0x3a0694(0x1be)]===0x0)throw new SDKError(ErrorCode[_0x3a0694(0x277)],_0x3a0694(0x1aa)+_0x3a1533,undefined,{'helpText':_0x3a0694(0x21a)});if(_0x250a80[_0x3a0694(0x1be)]>0x1)throw new SDKError(ErrorCode[_0x3a0694(0x298)],_0x3a0694(0x268)+_0x3a1533+_0x3a0694(0x1b1));return _0x250a80[0x0]['id'];}async[a133_0x533a84(0x285)](_0x3ce04b){const _0x418271=a133_0x533a84,_0xb00c0b=await this['client']['listProjects'](),_0x28a839=_0xb00c0b['find'](_0xa54276=>_0xa54276[_0x418271(0x1b7)]['name']===_0x3ce04b);if(_0x28a839)return{'projectId':_0x28a839['id'],'project':_0x28a839};throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x418271(0x1aa)+_0x3ce04b,undefined,{'helpText':_0x418271(0x21a)});}async[a133_0x533a84(0x20d)](_0x3d0b60=a133_0x533a84(0x276),_0x425cfb=0x0,_0x54aa6e){const _0x2968d4=a133_0x533a84,_0x4a4ad6=0xa;let _0x1dfff9=0x0,_0x220a19;while(_0x1dfff9<_0x4a4ad6){try{const _0x4e670c=await this[_0x2968d4(0x2a7)](_0x220a19),_0x5baef3=_0x4e670c['id'],_0x360ddb=[_0x2968d4(0x2bb),_0x2968d4(0x286),_0x2968d4(0x21e),_0x2968d4(0x1e8),'high'],_0x15b11b=_0x425cfb===0x0?_0x2968d4(0x293)+_0x3d0b60:_0x2968d4(0x293)+_0x3d0b60+_0x2968d4(0x27e)+_0x360ddb[_0x425cfb],_0x2e3f52=await this['client'][_0x2968d4(0x1da)](_0x5baef3),_0x4ce52a=_0x2e3f52[_0x2968d4(0x238)](_0x14277d=>_0x14277d[_0x2968d4(0x1b7)][_0x2968d4(0x22b)]===_0x15b11b);if(_0x4ce52a)return _0x4ce52a;const _0x5c5345=_0x425cfb>0x0?0x1:_0x54aa6e;return await this['client'][_0x2968d4(0x225)]({'name':_0x15b11b,'projectId':_0x5baef3,'modelType':_0x3d0b60,'systemPrompt':'','temperature':_0x5c5345,'reasoningEffort':_0x425cfb>0x0?_0x425cfb:undefined});}catch(_0x45c2ac){if(_0x45c2ac instanceof HTTPClientError){const _0x9133ea=_0x45c2ac[_0x2968d4(0x1d1)];if(_0x9133ea>=0x190&&_0x9133ea<0x1f4){if(_0x9133ea===0x191)throw new SDKError(ErrorCode[_0x2968d4(0x23f)],_0x2968d4(0x2ac),_0x45c2ac);else{if(_0x9133ea===0x193)throw new SDKError(ErrorCode[_0x2968d4(0x1a5)],_0x2968d4(0x1ed),_0x45c2ac);}throw _0x45c2ac;}}if(errorContains(_0x45c2ac,_0x2968d4(0x2a3),'duplicate','conflict')){_0x1dfff9++;if(_0x1dfff9>=_0x4a4ad6)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x2968d4(0x212)+_0x4a4ad6+_0x2968d4(0x1bc),_0x45c2ac);const _0x3ecffd=this[_0x2968d4(0x295)]();_0x220a19=_0x3ecffd+'_'+generateRandomHex();continue;}throw _0x45c2ac;}}throw new SDKError(ErrorCode[_0x2968d4(0x298)],_0x2968d4(0x1d2));}async[a133_0x533a84(0x275)](_0x11243f,_0x47b6fb){const _0x4600c7=a133_0x533a84,_0x3fdeed=_0x47b6fb||this[_0x4600c7(0x1ac)],_0x8580c9=await this[_0x4600c7(0x28e)][_0x4600c7(0x1da)](_0x3fdeed),_0x2e5360=_0x8580c9[_0x4600c7(0x213)](_0x13e552=>_0x13e552[_0x4600c7(0x1b7)]['name']===_0x11243f);if(_0x2e5360[_0x4600c7(0x1be)]===0x0){const _0x378f90=_0x3fdeed?'\x20in\x20project\x20'+_0x3fdeed:'';throw new SDKError(ErrorCode[_0x4600c7(0x25b)],_0x4600c7(0x1ae)+_0x11243f+_0x378f90,undefined,{'helpText':_0x3fdeed?_0x4600c7(0x216):_0x4600c7(0x1ff)});}if(_0x2e5360['length']>0x1)throw new SDKError(ErrorCode[_0x4600c7(0x298)],'Multiple\x20agents\x20found\x20with\x20name\x20\x27'+_0x11243f+_0x4600c7(0x1b1));return _0x2e5360[0x0]['id'];}async[a133_0x533a84(0x239)](_0x3d7662){const _0xca0e97=a133_0x533a84,_0x587f5b=_0x3d7662||this[_0xca0e97(0x1ac)];return await this['client']['listAgents'](_0x587f5b);}async['agentsFull'](_0x127261){const _0x1a4751=a133_0x533a84;return await this[_0x1a4751(0x28e)]['listAgentsFull'](_0x127261);}async['agent'](_0x763c5){const _0x487547=a133_0x533a84;return await this[_0x487547(0x28e)]['getAgent'](_0x763c5);}async[a133_0x533a84(0x225)](_0xd59e61){const _0x3c73da=a133_0x533a84;return await this['client'][_0x3c73da(0x225)](_0xd59e61);}async[a133_0x533a84(0x204)](_0x1cc1f0,_0x426ae5){const _0x4f7df7=a133_0x533a84;return await this[_0x4f7df7(0x28e)]['updateAgent'](_0x1cc1f0,_0x426ae5);}async[a133_0x533a84(0x1c5)](_0x323bb3){const _0x332b65=a133_0x533a84;await this['client'][_0x332b65(0x1c5)](_0x323bb3);}async['startChat'](_0x77230f){const _0xa9e98c=a133_0x533a84;return await this[_0xa9e98c(0x28e)]['startChat']({'agentId':_0x77230f});}async*[a133_0x533a84(0x227)](_0x2df475,_0x5d5405){const _0x524ff4=a133_0x533a84;let _0x149105=_0x5d5405?.[_0x524ff4(0x2b9)];const _0x3c6d71=_0x5d5405?.[_0x524ff4(0x1a3)];if(!_0x149105){if(!_0x3c6d71)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x4128b1=await this['client'][_0x524ff4(0x1b3)]({'agentId':_0x3c6d71});_0x149105=_0x4128b1['id'],yield{'type':_0x524ff4(0x1cd),'data':{'chatId':_0x149105,'agentId':_0x3c6d71,'projectId':_0x4128b1[_0x524ff4(0x1b7)][_0x524ff4(0x1ee)]}};}for await(const _0x5aef6a of this['client'][_0x524ff4(0x1f5)](_0x149105,_0x2df475,_0x5d5405?.[_0x524ff4(0x272)])){yield{'type':_0x524ff4(0x206),'data':_0x5aef6a};}}async[a133_0x533a84(0x22f)](_0x45645e=0x32){const _0xfc7edb=a133_0x533a84;return await this[_0xfc7edb(0x28e)][_0xfc7edb(0x1a6)](_0x45645e);}async[a133_0x533a84(0x1b2)](_0x294046){const _0x4e0a58=a133_0x533a84;return await this['client'][_0x4e0a58(0x25a)](_0x294046);}async[a133_0x533a84(0x241)](_0x32468f){const _0x4a0207=a133_0x533a84;return await this[_0x4a0207(0x28e)]['getChatLog'](_0x32468f);}async[a133_0x533a84(0x27c)](_0x3d81a9){const _0x16f701=a133_0x533a84;return await this[_0x16f701(0x28e)][_0x16f701(0x1f0)](_0x3d81a9);}async[a133_0x533a84(0x22e)](_0x54802c,_0x411ec4,_0x174af5){const _0x50a0af=a133_0x533a84,_0x7f5a3=_0x174af5?.[_0x50a0af(0x1ba)]??![],{projectId:_0x95ad67,project:_0x15f705}=await this[_0x50a0af(0x285)](_0x54802c),_0x144e1a=_0x15f705[_0x50a0af(0x1b7)][_0x50a0af(0x22b)],_0x2e5467=_0x411ec4||_0x144e1a+_0x50a0af(0x1e7);if(a133_0x11072e['existsSync'](_0x2e5467)&&!_0x7f5a3)throw new SDKError(ErrorCode[_0x50a0af(0x2c4)],_0x50a0af(0x23b)+_0x2e5467,undefined,{'helpText':_0x50a0af(0x269)});const _0x31732b=await this[_0x50a0af(0x28e)][_0x50a0af(0x1de)](_0x95ad67),_0x16a0b1=await this[_0x50a0af(0x28e)]['listKnowledgeBases'](_0x95ad67),_0x2c548c=await this[_0x50a0af(0x28e)][_0x50a0af(0x282)](_0x95ad67),_0x457439=await this[_0x50a0af(0x28e)][_0x50a0af(0x1c9)](_0x95ad67);if(!_0x7f5a3){a133_0x11072e['mkdirSync'](_0x2e5467,{'recursive':!![]});const _0x52df5e={'version':_0x50a0af(0x24d),'exportedAt':new Date()['toISOString'](),'exportedFrom':{'site':this[_0x50a0af(0x2c2)][_0x50a0af(0x1ab)],'projectId':_0x95ad67,'projectName':_0x144e1a},'project':_0x15f705};a133_0x11072e[_0x50a0af(0x237)](a133_0x503bb8[_0x50a0af(0x26b)](_0x2e5467,_0x50a0af(0x24c)),JSON[_0x50a0af(0x26a)](_0x52df5e,null,0x2)),a133_0x11072e[_0x50a0af(0x237)](a133_0x503bb8[_0x50a0af(0x26b)](_0x2e5467,'agents.json'),JSON[_0x50a0af(0x26a)](_0x31732b,null,0x2)),a133_0x11072e[_0x50a0af(0x237)](a133_0x503bb8[_0x50a0af(0x26b)](_0x2e5467,'knowledgebases.json'),JSON['stringify'](_0x16a0b1,null,0x2)),a133_0x11072e[_0x50a0af(0x237)](a133_0x503bb8[_0x50a0af(0x26b)](_0x2e5467,_0x50a0af(0x1e0)),JSON[_0x50a0af(0x26a)](_0x2c548c,null,0x2)),a133_0x11072e[_0x50a0af(0x237)](a133_0x503bb8['join'](_0x2e5467,_0x50a0af(0x1b0)),JSON[_0x50a0af(0x26a)](_0x457439,null,0x2));}return{'projectName':_0x144e1a,'outputDir':_0x2e5467,'counts':{'agents':_0x31732b[_0x50a0af(0x1be)],'knowledgeBases':_0x16a0b1['length'],'prompts':_0x2c548c['length'],'integrations':_0x457439[_0x50a0af(0x1be)]}};}async[a133_0x533a84(0x27f)](_0x38ff36,_0x153e48){const _0x578973=a133_0x533a84,_0x5da815=_0x153e48?.['dryRun']??![],_0x140ef5=this[_0x578973(0x253)](_0x38ff36),_0x4ea172=_0x140ef5[_0x578973(0x294)][_0x578973(0x1ab)],_0x2b8729=this[_0x578973(0x2c2)]['site'],_0xe97a91=_0x4ea172!==_0x2b8729?_0x4ea172:undefined,_0x1e778e=this[_0x578973(0x218)](a133_0x503bb8[_0x578973(0x26b)](_0x38ff36,'agents.json'),[]),_0xcbdffe=this['loadJsonFile'](a133_0x503bb8[_0x578973(0x26b)](_0x38ff36,_0x578973(0x256)),[]),_0x41e26e=this[_0x578973(0x218)](a133_0x503bb8[_0x578973(0x26b)](_0x38ff36,_0x578973(0x1e0)),[]),_0x533835=this['loadJsonFile'](a133_0x503bb8[_0x578973(0x26b)](_0x38ff36,_0x578973(0x1b0)),[]),_0x56cb57=_0x153e48?.[_0x578973(0x22b)]||_0x140ef5[_0x578973(0x294)][_0x578973(0x1f2)];if(_0x5da815){const _0x36796a=new Map(),_0x4708a8=[..._0x1e778e],_0x395c4c=_0x1e778e[_0x578973(0x1be)]+0x1;let _0x110943=0x0;while(_0x4708a8['length']>0x0&&_0x110943<_0x395c4c){_0x110943++;const _0x5630a8=[];for(const _0x473746 of _0x4708a8){canCreateAgent(_0x473746,_0x36796a)?_0x36796a[_0x578973(0x271)](_0x473746['id'],_0x578973(0x1fe)+_0x473746['id']):_0x5630a8[_0x578973(0x27d)](_0x473746);}if(_0x5630a8[_0x578973(0x1be)]===_0x4708a8[_0x578973(0x1be)])throw new SDKError(ErrorCode[_0x578973(0x298)],_0x578973(0x240),undefined,{'helpText':_0x578973(0x284)});_0x4708a8[_0x578973(0x1be)]=0x0,_0x4708a8[_0x578973(0x27d)](..._0x5630a8);}const _0x11e916=_0x41e26e[_0x578973(0x213)](_0x3ed50c=>_0x36796a[_0x578973(0x1e1)](_0x3ed50c[_0x578973(0x1b7)]['agentId']))[_0x578973(0x1be)];return{'projectName':_0x56cb57,'projectId':_0x578973(0x28f),'counts':{'agents':_0x1e778e[_0x578973(0x1be)],'knowledgeBases':_0xcbdffe['length'],'prompts':_0x11e916,'integrations':_0x533835[_0x578973(0x1be)]},'sourceSite':_0xe97a91};}const _0x2f7bf4=await this[_0x578973(0x28e)][_0x578973(0x1a9)]({'name':_0x56cb57,'description':_0x140ef5['project'][_0x578973(0x1b7)][_0x578973(0x254)]}),_0x2448c8=_0x2f7bf4['id'],_0x2a8618=new Map(),_0x5ecc73=new Map(),_0x40c684=new Map();for(const _0x3cbd34 of _0xcbdffe){const _0x1784cb=await this[_0x578973(0x28e)][_0x578973(0x2bc)]({'projectId':_0x2448c8,'name':_0x3cbd34[_0x578973(0x1b7)][_0x578973(0x22b)],'tdDatabaseName':_0x3cbd34[_0x578973(0x1b7)][_0x578973(0x2a8)],'tables':_0x3cbd34['attributes'][_0x578973(0x24a)]});_0x2a8618[_0x578973(0x271)](_0x3cbd34['id'],_0x1784cb['id']);}const _0x12ed64=[..._0x1e778e],_0xd60237=_0x1e778e[_0x578973(0x1be)]+0x1;let _0x5373f2=0x0;while(_0x12ed64[_0x578973(0x1be)]>0x0&&_0x5373f2<_0xd60237){_0x5373f2++;const _0x41d66d=[];for(const _0x9b54f2 of _0x12ed64){if(canCreateAgent(_0x9b54f2,_0x5ecc73)){const _0x276ac3=remapToolIds(_0x9b54f2[_0x578973(0x1b7)][_0x578973(0x2b2)],_0x2a8618,_0x5ecc73),_0xf0b9ac=remapVariableIds(_0x9b54f2[_0x578973(0x1b7)]['variables'],_0x2a8618),_0x2259a0=await this[_0x578973(0x28e)][_0x578973(0x29e)]({'name':_0x9b54f2[_0x578973(0x1b7)]['name'],'projectId':_0x2448c8,'systemPrompt':_0x9b54f2[_0x578973(0x1b7)][_0x578973(0x1d6)],'starterMessage':_0x9b54f2['attributes'][_0x578973(0x265)],'modelType':migrateModelType(_0x9b54f2[_0x578973(0x1b7)]['modelType']),'maxToolIterations':_0x9b54f2[_0x578973(0x1b7)][_0x578973(0x2ba)],'temperature':_0x9b54f2[_0x578973(0x1b7)][_0x578973(0x24f)],'reasoningEffort':_0x9b54f2[_0x578973(0x1b7)][_0x578973(0x2a9)],'outputs':_0x9b54f2['attributes'][_0x578973(0x1b5)],'tools':_0x276ac3,'variables':_0xf0b9ac});_0x5ecc73[_0x578973(0x271)](_0x9b54f2['id'],_0x2259a0['id']);}else _0x41d66d['push'](_0x9b54f2);}if(_0x41d66d[_0x578973(0x1be)]===_0x12ed64[_0x578973(0x1be)])throw new SDKError(ErrorCode[_0x578973(0x298)],_0x578973(0x240),undefined,{'helpText':_0x578973(0x284)});_0x12ed64[_0x578973(0x1be)]=0x0,_0x12ed64[_0x578973(0x27d)](..._0x41d66d);}for(const _0x6c69b0 of _0x41e26e){const _0x407f74=_0x5ecc73[_0x578973(0x1cb)](_0x6c69b0[_0x578973(0x1b7)]['agentId']);if(!_0x407f74)continue;const _0x361bdd=await this[_0x578973(0x28e)]['createPrompt']({'projectId':_0x2448c8,'agentId':_0x407f74,'name':_0x6c69b0['attributes'][_0x578973(0x22b)],'systemPrompt':_0x6c69b0[_0x578973(0x1b7)][_0x578973(0x1d6)],'template':_0x6c69b0[_0x578973(0x1b7)][_0x578973(0x2bf)],'jsonSchemaHint':_0x6c69b0['attributes'][_0x578973(0x236)]});_0x40c684[_0x578973(0x271)](_0x6c69b0['id'],_0x361bdd['id']);}for(const _0x332b95 of _0x533835){const _0x6f6e07=_0x332b95[_0x578973(0x1b7)]['actions'][_0x578973(0x230)](_0x4ed459=>({..._0x4ed459,'promptId':_0x40c684[_0x578973(0x1cb)](_0x4ed459['promptId'])||_0x4ed459[_0x578973(0x1f7)]}));await this[_0x578973(0x28e)]['createIntegration']({'projectId':_0x2448c8,'serviceType':_0x332b95[_0x578973(0x1b7)][_0x578973(0x1b6)],'actions':_0x6f6e07,'slackMessageMode':_0x332b95[_0x578973(0x1b7)]['slackMessageMode'],'chatIgnoreManagedActions':_0x332b95[_0x578973(0x1b7)][_0x578973(0x2b8)],'chatWelcomeMessage':_0x332b95[_0x578973(0x1b7)]['chatWelcomeMessage'],'webhookCorsOrigins':_0x332b95[_0x578973(0x1b7)][_0x578973(0x243)]});}return{'projectName':_0x56cb57,'projectId':_0x2448c8,'counts':{'agents':_0x5ecc73['size'],'knowledgeBases':_0x2a8618[_0x578973(0x21b)],'prompts':_0x40c684[_0x578973(0x21b)],'integrations':_0x533835[_0x578973(0x1be)]},'sourceSite':_0xe97a91};}[a133_0x533a84(0x218)](_0x569500,_0x268310){const _0x3cb30d=a133_0x533a84;if(!a133_0x11072e[_0x3cb30d(0x266)](_0x569500))return _0x268310;return JSON[_0x3cb30d(0x217)](a133_0x11072e['readFileSync'](_0x569500,_0x3cb30d(0x27b)));}[a133_0x533a84(0x253)](_0x39b23a){const _0xad3f69=a133_0x533a84;if(!a133_0x11072e[_0xad3f69(0x266)](_0x39b23a))throw new SDKError(ErrorCode[_0xad3f69(0x252)],_0xad3f69(0x2b4)+_0x39b23a,undefined,{'helpText':_0xad3f69(0x29a)});const _0x5ba698=a133_0x503bb8[_0xad3f69(0x26b)](_0x39b23a,_0xad3f69(0x24c));if(!a133_0x11072e[_0xad3f69(0x266)](_0x5ba698))throw new SDKError(ErrorCode[_0xad3f69(0x231)],_0xad3f69(0x22d)+_0x39b23a,undefined,{'helpText':_0xad3f69(0x235)});const _0x1a6643=JSON[_0xad3f69(0x217)](a133_0x11072e[_0xad3f69(0x233)](_0x5ba698,_0xad3f69(0x27b)));if(!isSupportedBackupVersion(_0x1a6643[_0xad3f69(0x23a)]))throw new SDKError(ErrorCode[_0xad3f69(0x231)],'Unsupported\x20backup\x20version:\x20'+_0x1a6643[_0xad3f69(0x23a)],undefined,{'helpText':'This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.'});return _0x1a6643;}async[a133_0x533a84(0x2c0)](_0x26f258,_0x10c988,_0x1c2614){const _0x434aba=a133_0x533a84,{projectId:_0x213f7c,project:_0x1dd7fb}=await this[_0x434aba(0x285)](_0x26f258),_0x37b41f=_0x1dd7fb[_0x434aba(0x1b7)]['name'];let _0x4b5dc4;if(_0x10c988)_0x4b5dc4=_0x10c988;else{const _0x313503=a133_0x503bb8[_0x434aba(0x26b)](process[_0x434aba(0x257)](),_0x434aba(0x239)),_0x12367b=getSanitizedPathWithMigration(_0x313503,_0x37b41f);_0x12367b[_0x434aba(0x2c1)]&&this['logger']['info'](_0x434aba(0x1f4)+a133_0x503bb8['basename'](_0x12367b[_0x434aba(0x203)])+'\x20→\x20'+a133_0x503bb8[_0x434aba(0x1f6)](_0x12367b[_0x434aba(0x2b5)])),_0x4b5dc4=_0x12367b[_0x434aba(0x2b5)];}const _0x266511=await this[_0x434aba(0x28e)]['listAgentsFull'](_0x213f7c),_0x42a9a6=await this['client'][_0x434aba(0x2c6)](_0x213f7c),_0x15fb38=await this[_0x434aba(0x28e)][_0x434aba(0x1b9)](_0x213f7c),_0x4017ce=await safeListOrEmpty(()=>this[_0x434aba(0x28e)][_0x434aba(0x1af)](_0x213f7c)),_0x59f7d0=await safeListOrEmpty(()=>this['client'][_0x434aba(0x25f)](_0x213f7c)),_0x5528d0=await this[_0x434aba(0x28e)][_0x434aba(0x282)](_0x213f7c),_0x4bc414=await this['client'][_0x434aba(0x1c9)](_0x213f7c),_0x56c06f=await safeListOrEmpty(()=>this['client'][_0x434aba(0x220)](_0x213f7c)),_0x1697a2=await safeListOrEmpty(()=>this[_0x434aba(0x28e)][_0x434aba(0x1a4)](_0x213f7c)),_0x2180c2=await safeListOrEmpty(()=>this[_0x434aba(0x28e)][_0x434aba(0x29d)](_0x213f7c)),_0xf30024=await safeListOrEmpty(()=>this[_0x434aba(0x28e)][_0x434aba(0x1e4)](_0x213f7c)),_0x39f86f=_0x4bc414[_0x434aba(0x213)](_0x19eda1=>!_0x19eda1[_0x434aba(0x1b7)][_0x434aba(0x22c)]&&SAFE_INTEGRATION_TYPES[_0x434aba(0x1dc)](_0x19eda1[_0x434aba(0x1b7)][_0x434aba(0x1b6)][_0x434aba(0x1cc)]())),_0x1220ad=new Map(),_0x469bf3=new Map(),_0x4f7a68=new Map(),_0x1aa07d=new Map(),_0x47e9a7=new Map(),_0x5985ad=new Map(),_0x1da77a=new Map();for(const _0x48d870 of _0x266511){_0x1220ad[_0x434aba(0x271)](_0x48d870['id'],_0x48d870[_0x434aba(0x1b7)][_0x434aba(0x22b)]);}for(const _0x2fc36b of _0x42a9a6){_0x469bf3[_0x434aba(0x271)](_0x2fc36b['id'],_0x2fc36b[_0x434aba(0x1b7)][_0x434aba(0x22b)]);}for(const _0x42aa30 of _0x15fb38){_0x4f7a68['set'](_0x42aa30['id'],_0x42aa30[_0x434aba(0x1b7)]['name']);}for(const _0x344385 of _0x4017ce){_0x1aa07d['set'](_0x344385['id'],_0x344385[_0x434aba(0x1b7)][_0x434aba(0x22b)]);}for(const _0x4a0858 of _0x59f7d0){_0x47e9a7[_0x434aba(0x271)](_0x4a0858['id'],_0x4a0858[_0x434aba(0x1b7)][_0x434aba(0x22b)]);}for(const _0x275123 of _0x5528d0){_0x5985ad[_0x434aba(0x271)](_0x275123['id'],_0x275123[_0x434aba(0x1b7)][_0x434aba(0x22b)]);}for(const _0xf73162 of _0x56c06f){_0x1da77a[_0x434aba(0x271)](_0xf73162['id'],_0xf73162[_0x434aba(0x1b7)][_0x434aba(0x22b)]);}const _0x22149b={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x469bf3,'TextKnowledgeBase':_0x4f7a68,'Agent':_0x1220ad,'WebSearchTool':_0x47e9a7,'ImageGenerator':_0x1aa07d,'ExperimentalKnowledgeBase':_0x1da77a}),'resolvePromptName':async _0x81ead6=>_0x5985ad[_0x434aba(0x1cb)](_0x81ead6),'onWarning':_0x407c43=>this[_0x434aba(0x1a8)][_0x434aba(0x29b)](_0x407c43)},_0x2d20ea={'projectName':_0x37b41f,'outputDir':_0x4b5dc4,'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}}},_0x3cccfb=[],_0xaccf71=[];for(const _0x5bc548 of _0x266511){const _0x3588a5=getSanitizedPathWithMigration(_0x4b5dc4,_0x5bc548[_0x434aba(0x1b7)][_0x434aba(0x22b)]);_0x3588a5['renamed']&&this['logger'][_0x434aba(0x21c)](_0x434aba(0x28d)+a133_0x503bb8['basename'](_0x3588a5[_0x434aba(0x203)])+_0x434aba(0x1fb)+a133_0x503bb8[_0x434aba(0x1f6)](_0x3588a5['path']));const _0x411828=_0x3588a5[_0x434aba(0x2b5)],_0x358d51=a133_0x503bb8[_0x434aba(0x26b)](_0x411828,_0x434aba(0x1eb)),_0x4f6c2a=a133_0x503bb8[_0x434aba(0x26b)](_0x411828,_0x434aba(0x1ca)),_0x3a04e5=a133_0x503bb8[_0x434aba(0x26b)](_0x411828,_0x434aba(0x232)),{yaml:_0x5e50d1,systemPrompt:_0x4bc71c,starterMessage:_0x400a1c}=await agentResponseToDef(_0x5bc548,_0x22149b),_0x2c655a=toAgentYamlString(_0x5e50d1),_0x457332=!a133_0x11072e[_0x434aba(0x266)](_0x4f6c2a);let _0x3f4eec=_0x457332,_0x5b08a6;if(!_0x457332){const _0x2500a4=a133_0x11072e[_0x434aba(0x266)](_0x358d51)?a133_0x11072e[_0x434aba(0x233)](_0x358d51,'utf-8'):'',_0x4c503b=a133_0x11072e[_0x434aba(0x233)](_0x4f6c2a,_0x434aba(0x27b)),_0x488c8b=_0x434aba(0x26d)+_0x2500a4+_0x434aba(0x2a2)+_0x4c503b,_0x2952fb=_0x434aba(0x26d)+_0x4bc71c+_0x434aba(0x2a2)+_0x2c655a,_0x4f7654=generateDiff(_0x488c8b,_0x2952fb);_0x3f4eec=hasChanges(_0x4f7654),_0x3f4eec&&(_0x5b08a6=formatDiffWithColors(_0x4f7654));}_0x3cccfb[_0x434aba(0x27d)]({'path':_0x411828,'content':'','isDir':!![]}),_0x3cccfb[_0x434aba(0x27d)]({'path':_0x358d51,'content':_0x4bc71c}),_0x3cccfb[_0x434aba(0x27d)]({'path':_0x4f6c2a,'content':_0x2c655a});_0x400a1c&&_0x400a1c[_0x434aba(0x1dc)]('\x0a')&&_0x3cccfb[_0x434aba(0x27d)]({'path':_0x3a04e5,'content':_0x400a1c});_0x2d20ea[_0x434aba(0x239)][_0x434aba(0x27d)]({'agentName':_0x5bc548['attributes'][_0x434aba(0x22b)],'outputPath':_0x411828,'isNew':_0x457332,'hasChanges':_0x3f4eec,'diff':_0x5b08a6}),_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x239)][_0x434aba(0x1f8)]++;if(_0x457332)_0x2d20ea[_0x434aba(0x28b)]['agents']['new']++;else{if(_0x3f4eec)_0x2d20ea[_0x434aba(0x28b)]['agents'][_0x434aba(0x1e2)]++;else _0x2d20ea['counts'][_0x434aba(0x239)][_0x434aba(0x281)]++;}}for(const _0x5685f1 of _0x42a9a6){if(_0x5685f1[_0x434aba(0x1b7)][_0x434aba(0x22c)])continue;const _0x313672=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x4b5dc4),_0x5685f1['attributes']['name'],_0x434aba(0x283));_0x313672[_0x434aba(0x2c1)]&&this[_0x434aba(0x1a8)][_0x434aba(0x21c)](_0x434aba(0x1c2)+a133_0x503bb8[_0x434aba(0x1f6)](_0x313672['oldPath'])+_0x434aba(0x1fb)+a133_0x503bb8['basename'](_0x313672['path']));const _0x44efa3=_0x313672['path'],_0x34b0f0=apiKnowledgeBaseToYaml(_0x5685f1),_0x4d4781=toKnowledgeBaseYamlString(_0x34b0f0),_0xa9f328=!a133_0x11072e[_0x434aba(0x266)](_0x44efa3);let _0x1e46d6=_0xa9f328,_0x4667d5;if(!_0xa9f328){const _0x393cf1=a133_0x11072e[_0x434aba(0x233)](_0x44efa3,'utf-8'),_0x3094f8=generateDiff(_0x393cf1,_0x4d4781);_0x1e46d6=hasChanges(_0x3094f8),_0x1e46d6&&(_0x4667d5=formatDiffWithColors(_0x3094f8));}_0x3cccfb['push']({'path':_0x44efa3,'content':_0x4d4781}),_0x2d20ea['knowledgeBases']['push']({'name':_0x5685f1[_0x434aba(0x1b7)][_0x434aba(0x22b)],'outputPath':_0x44efa3,'isNew':_0xa9f328,'hasChanges':_0x1e46d6,'diff':_0x4667d5}),_0x2d20ea['counts']['knowledgeBases']['total']++;if(_0xa9f328)_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x209)]['new']++;else{if(_0x1e46d6)_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x209)][_0x434aba(0x1e2)]++;else _0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x209)][_0x434aba(0x281)]++;}}for(const _0x346187 of _0x15fb38){if(_0x346187[_0x434aba(0x1b7)][_0x434aba(0x22c)])continue;const _0xf7e0ca=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x4b5dc4),_0x346187[_0x434aba(0x1b7)][_0x434aba(0x22b)],_0x434aba(0x1f9));_0xf7e0ca['renamed']&&this[_0x434aba(0x1a8)][_0x434aba(0x21c)]('Renamed\x20text\x20KB\x20file:\x20'+a133_0x503bb8[_0x434aba(0x1f6)](_0xf7e0ca[_0x434aba(0x203)])+_0x434aba(0x1fb)+a133_0x503bb8[_0x434aba(0x1f6)](_0xf7e0ca['path']));const _0x22a828=_0xf7e0ca[_0x434aba(0x2b5)],_0x5b1ff5=toTextKnowledgeBaseMd(_0x346187[_0x434aba(0x1b7)][_0x434aba(0x22b)],_0x346187[_0x434aba(0x1b7)][_0x434aba(0x245)]),_0x5ef505=!a133_0x11072e[_0x434aba(0x266)](_0x22a828);let _0x1990d5=_0x5ef505,_0x1ea62f;if(!_0x5ef505){const _0x4a5dc1=a133_0x11072e['readFileSync'](_0x22a828,_0x434aba(0x27b)),_0x5c1b61=generateDiff(_0x4a5dc1,_0x5b1ff5);_0x1990d5=hasChanges(_0x5c1b61),_0x1990d5&&(_0x1ea62f=formatDiffWithColors(_0x5c1b61));}_0x3cccfb[_0x434aba(0x27d)]({'path':_0x22a828,'content':_0x5b1ff5}),_0x2d20ea[_0x434aba(0x292)][_0x434aba(0x27d)]({'name':_0x346187[_0x434aba(0x1b7)][_0x434aba(0x22b)],'outputPath':_0x22a828,'isNew':_0x5ef505,'hasChanges':_0x1990d5,'diff':_0x1ea62f}),_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x292)][_0x434aba(0x1f8)]++;if(_0x5ef505)_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x292)][_0x434aba(0x1fd)]++;else{if(_0x1990d5)_0x2d20ea['counts']['textKnowledgeBases']['updated']++;else _0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x292)][_0x434aba(0x281)]++;}}for(const _0x57a58f of _0x5528d0){if(_0x57a58f[_0x434aba(0x1b7)][_0x434aba(0x22c)])continue;const _0x2d3c89=getSanitizedPathWithMigration(getPromptsDir(_0x4b5dc4),_0x57a58f['attributes'][_0x434aba(0x22b)],_0x434aba(0x283));_0x2d3c89[_0x434aba(0x2c1)]&&this[_0x434aba(0x1a8)][_0x434aba(0x21c)](_0x434aba(0x274)+a133_0x503bb8[_0x434aba(0x1f6)](_0x2d3c89[_0x434aba(0x203)])+'\x20→\x20'+a133_0x503bb8[_0x434aba(0x1f6)](_0x2d3c89[_0x434aba(0x2b5)]));const _0x5b93c2=_0x2d3c89[_0x434aba(0x2b5)],_0x326cbc=await apiPromptToYaml(_0x57a58f,_0x22149b);if(!_0x326cbc)continue;const _0x5e23fa=toPromptYamlString(_0x326cbc),_0x3f9783=!a133_0x11072e['existsSync'](_0x5b93c2);let _0x247bfd=_0x3f9783,_0x308ca3;if(!_0x3f9783){const _0x56dfbf=a133_0x11072e[_0x434aba(0x233)](_0x5b93c2,_0x434aba(0x27b)),_0x1ae888=generateDiff(_0x56dfbf,_0x5e23fa);_0x247bfd=hasChanges(_0x1ae888),_0x247bfd&&(_0x308ca3=formatDiffWithColors(_0x1ae888));}_0x3cccfb[_0x434aba(0x27d)]({'path':_0x5b93c2,'content':_0x5e23fa}),_0x2d20ea['prompts'][_0x434aba(0x27d)]({'name':_0x57a58f[_0x434aba(0x1b7)][_0x434aba(0x22b)],'outputPath':_0x5b93c2,'isNew':_0x3f9783,'hasChanges':_0x247bfd,'diff':_0x308ca3}),_0x2d20ea[_0x434aba(0x28b)]['prompts']['total']++;if(_0x3f9783)_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x273)][_0x434aba(0x1fd)]++;else{if(_0x247bfd)_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x273)][_0x434aba(0x1e2)]++;else _0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x273)][_0x434aba(0x281)]++;}}for(const _0x5bfee2 of _0x39f86f){const _0xfaaecf=_0x5bfee2['attributes']['serviceType'][_0x434aba(0x1cc)](),_0x48c2e9=getSanitizedPathWithMigration(getIntegrationsDir(_0x4b5dc4),_0xfaaecf,_0x434aba(0x283));_0x48c2e9['renamed']&&this[_0x434aba(0x1a8)][_0x434aba(0x21c)](_0x434aba(0x215)+a133_0x503bb8['basename'](_0x48c2e9['oldPath'])+_0x434aba(0x1fb)+a133_0x503bb8['basename'](_0x48c2e9[_0x434aba(0x2b5)]));const _0x4a2131=_0x48c2e9['path'],_0x2aa696=await apiIntegrationToYaml(_0x5bfee2,_0x22149b),_0x154d04=toIntegrationYamlString(_0x2aa696),_0x151851=!a133_0x11072e[_0x434aba(0x266)](_0x4a2131);let _0x308c09=_0x151851,_0x1c24f6;if(!_0x151851){const _0x5454d0=a133_0x11072e[_0x434aba(0x233)](_0x4a2131,_0x434aba(0x27b)),_0x440035=generateDiff(_0x5454d0,_0x154d04);_0x308c09=hasChanges(_0x440035),_0x308c09&&(_0x1c24f6=formatDiffWithColors(_0x440035));}_0x3cccfb[_0x434aba(0x27d)]({'path':_0x4a2131,'content':_0x154d04}),_0x2d20ea[_0x434aba(0x267)][_0x434aba(0x27d)]({'name':_0xfaaecf,'outputPath':_0x4a2131,'isNew':_0x151851,'hasChanges':_0x308c09,'diff':_0x1c24f6}),_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x267)][_0x434aba(0x1f8)]++;if(_0x151851)_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x267)][_0x434aba(0x1fd)]++;else{if(_0x308c09)_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x267)][_0x434aba(0x1e2)]++;else _0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x267)][_0x434aba(0x281)]++;}}for(const _0x5824a3 of _0x56c06f){if(_0x5824a3[_0x434aba(0x1b7)][_0x434aba(0x22c)])continue;const _0x4a863b=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x4b5dc4),_0x5824a3[_0x434aba(0x1b7)][_0x434aba(0x22b)]);_0x4a863b[_0x434aba(0x2c1)]&&this[_0x434aba(0x1a8)]['info']('Renamed\x20experimental\x20KB\x20directory:\x20'+a133_0x503bb8[_0x434aba(0x1f6)](_0x4a863b['oldPath'])+'\x20→\x20'+a133_0x503bb8[_0x434aba(0x1f6)](_0x4a863b['path']));const _0x54cd04=_0x4a863b[_0x434aba(0x2b5)],_0x57bd5f=a133_0x503bb8[_0x434aba(0x26b)](_0x54cd04,sanitizeForFilesystem(_0x5824a3[_0x434aba(0x1b7)]['name'])+_0x434aba(0x283)),_0x2739f2=a133_0x503bb8[_0x434aba(0x26b)](_0x54cd04,'functions'),_0x3319e3=apiExperimentalKnowledgeBaseToYaml(_0x5824a3),_0x2baf64=toExperimentalKnowledgeBaseYamlString(_0x3319e3),_0x15b16f=!a133_0x11072e[_0x434aba(0x266)](_0x54cd04);let _0x34c800=_0x15b16f,_0x490aa9,_0x2bc456=_0x2baf64;const _0x54e6fc=[..._0x3319e3[_0x434aba(0x251)]][_0x434aba(0x2aa)]((_0x48796c,_0x3f2740)=>_0x48796c[_0x434aba(0x22b)][_0x434aba(0x1d4)](_0x3f2740['name']));for(const _0x40f6f2 of _0x54e6fc){_0x2bc456+=_0x434aba(0x2b3)+_0x40f6f2[_0x434aba(0x22b)]+'\x20---\x0a'+_0x40f6f2[_0x434aba(0x28c)]+'\x0a---\x20schema:\x20'+_0x40f6f2[_0x434aba(0x22b)]+_0x434aba(0x229)+_0x40f6f2[_0x434aba(0x297)]+'\x0a';}if(!_0x15b16f){let _0x45c334='';a133_0x11072e[_0x434aba(0x266)](_0x57bd5f)&&(_0x45c334=a133_0x11072e[_0x434aba(0x233)](_0x57bd5f,_0x434aba(0x27b)));if(a133_0x11072e[_0x434aba(0x266)](_0x2739f2)){const _0x420b9b=a133_0x11072e['readdirSync'](_0x2739f2,{'withFileTypes':!![]}),_0x46b48f=_0x420b9b['filter'](_0x712b87=>_0x712b87[_0x434aba(0x1fa)]())['sort']((_0x149c33,_0x301aed)=>_0x149c33[_0x434aba(0x22b)][_0x434aba(0x1d4)](_0x301aed[_0x434aba(0x22b)]));for(const _0x2230f0 of _0x46b48f){const _0x3f871d=a133_0x503bb8[_0x434aba(0x26b)](_0x2739f2,_0x2230f0['name'],_0x434aba(0x1d0)),_0x177c92=a133_0x503bb8[_0x434aba(0x26b)](_0x2739f2,_0x2230f0[_0x434aba(0x22b)],_0x434aba(0x2ad));a133_0x11072e['existsSync'](_0x3f871d)&&(_0x45c334+=_0x434aba(0x2b3)+_0x2230f0['name']+'\x20---\x0a'+a133_0x11072e[_0x434aba(0x233)](_0x3f871d,_0x434aba(0x27b))+'\x0a'),a133_0x11072e[_0x434aba(0x266)](_0x177c92)&&(_0x45c334+=_0x434aba(0x279)+_0x2230f0[_0x434aba(0x22b)]+_0x434aba(0x229)+a133_0x11072e['readFileSync'](_0x177c92,'utf-8')+'\x0a');}}const _0x24075b=generateDiff(_0x45c334,_0x2bc456);_0x34c800=hasChanges(_0x24075b),_0x34c800&&(_0x490aa9=formatDiffWithColors(_0x24075b));}_0x3cccfb[_0x434aba(0x27d)]({'path':_0x54cd04,'content':'','isDir':!![]}),_0x3cccfb['push']({'path':_0x57bd5f,'content':_0x2baf64}),_0x3cccfb[_0x434aba(0x27d)]({'path':_0x2739f2,'content':'','isDir':!![]});for(const _0xf2b327 of _0x3319e3[_0x434aba(0x251)]){const _0x1c48c6=a133_0x503bb8[_0x434aba(0x26b)](_0x2739f2,sanitizeForFilesystem(_0xf2b327[_0x434aba(0x22b)])),_0x1641e9=a133_0x503bb8['join'](_0x1c48c6,_0x434aba(0x1d0)),_0xbc1167=a133_0x503bb8[_0x434aba(0x26b)](_0x1c48c6,_0x434aba(0x2ad));_0x3cccfb[_0x434aba(0x27d)]({'path':_0x1c48c6,'content':'','isDir':!![]}),_0x3cccfb[_0x434aba(0x27d)]({'path':_0x1641e9,'content':_0xf2b327[_0x434aba(0x28c)]}),_0x3cccfb['push']({'path':_0xbc1167,'content':_0xf2b327[_0x434aba(0x297)]});}if(a133_0x11072e[_0x434aba(0x266)](_0x2739f2)){const _0x4d4682=a133_0x11072e[_0x434aba(0x2c3)](_0x2739f2,{'withFileTypes':!![]}),_0x3335e8=new Set(_0x3319e3[_0x434aba(0x251)][_0x434aba(0x230)](_0x20b316=>sanitizeForFilesystem(_0x20b316[_0x434aba(0x22b)])));for(const _0xe5f291 of _0x4d4682){if(_0xe5f291['isDirectory']()&&!_0x3335e8[_0x434aba(0x1e1)](_0xe5f291[_0x434aba(0x22b)])){const _0x505e1b=a133_0x503bb8[_0x434aba(0x26b)](_0x2739f2,_0xe5f291[_0x434aba(0x22b)]);_0xaccf71[_0x434aba(0x27d)]({'path':_0x505e1b,'isDir':!![]});}}}_0x2d20ea['experimentalKnowledgeBases']['push']({'name':_0x5824a3['attributes'][_0x434aba(0x22b)],'outputPath':_0x54cd04,'isNew':_0x15b16f,'hasChanges':_0x34c800,'diff':_0x490aa9}),_0x2d20ea[_0x434aba(0x28b)]['experimentalKnowledgeBases'][_0x434aba(0x1f8)]++;if(_0x15b16f)_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x20b)][_0x434aba(0x1fd)]++;else{if(_0x34c800)_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x20b)][_0x434aba(0x1e2)]++;else _0x2d20ea['counts']['experimentalKnowledgeBases'][_0x434aba(0x281)]++;}}for(const _0x48a1ae of _0x1697a2){if(_0x48a1ae[_0x434aba(0x1b7)][_0x434aba(0x22c)])continue;const _0x5b0c7f=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x4b5dc4),_0x48a1ae[_0x434aba(0x1b7)]['name']);_0x5b0c7f[_0x434aba(0x2c1)]&&this[_0x434aba(0x1a8)][_0x434aba(0x21c)](_0x434aba(0x246)+a133_0x503bb8[_0x434aba(0x1f6)](_0x5b0c7f[_0x434aba(0x203)])+_0x434aba(0x1fb)+a133_0x503bb8[_0x434aba(0x1f6)](_0x5b0c7f[_0x434aba(0x2b5)]));const _0x4521e1=_0x5b0c7f[_0x434aba(0x2b5)],_0x149d58=a133_0x503bb8[_0x434aba(0x26b)](_0x4521e1,sanitizeForFilesystem(_0x48a1ae[_0x434aba(0x1b7)][_0x434aba(0x22b)])+_0x434aba(0x283)),_0xb5d083=a133_0x503bb8[_0x434aba(0x26b)](_0x4521e1,_0x434aba(0x1d0)),_0x2afbf5=a133_0x503bb8[_0x434aba(0x26b)](_0x4521e1,_0x434aba(0x2ab)),_0x58fefb=apiExperimentalArtifactToYaml(_0x48a1ae),_0x4f5d1e=toExperimentalArtifactYamlString(_0x58fefb),_0x2995a4=!a133_0x11072e[_0x434aba(0x266)](_0x4521e1);let _0x37a8f1=_0x2995a4,_0x5617b3,_0x19d171=_0x4f5d1e+(_0x434aba(0x289)+_0x58fefb[_0x434aba(0x28c)]+'\x0a');const _0x1ac881=[..._0x58fefb[_0x434aba(0x2ab)]][_0x434aba(0x2aa)]((_0x2d8dcd,_0x502bb7)=>_0x2d8dcd['file_name'][_0x434aba(0x1d4)](_0x502bb7[_0x434aba(0x234)]));for(const _0x5eba41 of _0x1ac881){_0x19d171+=_0x434aba(0x1f1)+_0x5eba41[_0x434aba(0x234)]+_0x434aba(0x229)+_0x5eba41[_0x434aba(0x2b7)]+'\x0a';}if(!_0x2995a4){let _0xcb380c='';a133_0x11072e[_0x434aba(0x266)](_0x149d58)&&(_0xcb380c=a133_0x11072e[_0x434aba(0x233)](_0x149d58,'utf-8'));a133_0x11072e[_0x434aba(0x266)](_0xb5d083)&&(_0xcb380c+=_0x434aba(0x289)+a133_0x11072e[_0x434aba(0x233)](_0xb5d083,_0x434aba(0x27b))+'\x0a');if(a133_0x11072e['existsSync'](_0x2afbf5)){const _0x30121d=a133_0x11072e[_0x434aba(0x2c3)](_0x2afbf5),_0x531daa=_0x30121d[_0x434aba(0x213)](_0xf2bf63=>{const _0x5ce32f=_0x434aba,_0x339ab2=a133_0x503bb8[_0x5ce32f(0x26b)](_0x2afbf5,_0xf2bf63);return a133_0x11072e[_0x5ce32f(0x270)](_0x339ab2)['isFile']();})[_0x434aba(0x2aa)]((_0x3bd016,_0x1c1a6a)=>_0x3bd016['localeCompare'](_0x1c1a6a));for(const _0x57c5eb of _0x531daa){const _0x492180=a133_0x503bb8[_0x434aba(0x26b)](_0x2afbf5,_0x57c5eb);_0xcb380c+=_0x434aba(0x1f1)+_0x57c5eb+_0x434aba(0x229)+a133_0x11072e[_0x434aba(0x233)](_0x492180,_0x434aba(0x27b))+'\x0a';}}const _0x2d9f50=generateDiff(_0xcb380c,_0x19d171);_0x37a8f1=hasChanges(_0x2d9f50),_0x37a8f1&&(_0x5617b3=formatDiffWithColors(_0x2d9f50));}_0x3cccfb[_0x434aba(0x27d)]({'path':_0x4521e1,'content':'','isDir':!![]}),_0x3cccfb[_0x434aba(0x27d)]({'path':_0x149d58,'content':_0x4f5d1e}),_0x3cccfb[_0x434aba(0x27d)]({'path':_0xb5d083,'content':_0x58fefb[_0x434aba(0x28c)]});if(_0x58fefb[_0x434aba(0x2ab)][_0x434aba(0x1be)]>0x0){_0x3cccfb[_0x434aba(0x27d)]({'path':_0x2afbf5,'content':'','isDir':!![]});for(const _0x3e1a1a of _0x58fefb['files']){const _0x3165f4=a133_0x503bb8[_0x434aba(0x26b)](_0x2afbf5,_0x3e1a1a['file_name']);_0x3cccfb[_0x434aba(0x27d)]({'path':_0x3165f4,'content':_0x3e1a1a[_0x434aba(0x2b7)]});}}if(a133_0x11072e[_0x434aba(0x266)](_0x2afbf5)){const _0x54d6a8=a133_0x11072e[_0x434aba(0x2c3)](_0x2afbf5),_0x43e8f8=new Set(_0x58fefb['files'][_0x434aba(0x230)](_0x204349=>_0x204349[_0x434aba(0x234)]));for(const _0x279214 of _0x54d6a8){const _0x433f8e=a133_0x503bb8[_0x434aba(0x26b)](_0x2afbf5,_0x279214);a133_0x11072e[_0x434aba(0x270)](_0x433f8e)[_0x434aba(0x288)]()&&!_0x43e8f8[_0x434aba(0x1e1)](_0x279214)&&_0xaccf71['push']({'path':_0x433f8e});}}_0x2d20ea[_0x434aba(0x2be)][_0x434aba(0x27d)]({'name':_0x48a1ae[_0x434aba(0x1b7)][_0x434aba(0x22b)],'outputPath':_0x4521e1,'isNew':_0x2995a4,'hasChanges':_0x37a8f1,'diff':_0x5617b3}),_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x2be)][_0x434aba(0x1f8)]++;if(_0x2995a4)_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x2be)]['new']++;else{if(_0x37a8f1)_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x2be)]['updated']++;else _0x2d20ea['counts'][_0x434aba(0x2be)][_0x434aba(0x281)]++;}}for(const _0x1ab56c of _0x2180c2){const _0x101863=getSanitizedPathWithMigration(getFormInterfacesDir(_0x4b5dc4),_0x1ab56c[_0x434aba(0x1b7)][_0x434aba(0x22b)],'.yml');_0x101863[_0x434aba(0x2c1)]&&this[_0x434aba(0x1a8)][_0x434aba(0x21c)]('Renamed\x20form\x20interface\x20file:\x20'+a133_0x503bb8[_0x434aba(0x1f6)](_0x101863[_0x434aba(0x203)])+_0x434aba(0x1fb)+a133_0x503bb8[_0x434aba(0x1f6)](_0x101863[_0x434aba(0x2b5)]));const _0x4e5614=_0x101863[_0x434aba(0x2b5)],_0x117140=await apiFormInterfaceToYaml(_0x1ab56c,_0x22149b),_0xd57ce=toFormInterfaceYamlString(_0x117140),_0x1515d1=!a133_0x11072e[_0x434aba(0x266)](_0x4e5614);let _0xdedad2=_0x1515d1,_0x20dbd0;if(!_0x1515d1){const _0x159d09=a133_0x11072e['readFileSync'](_0x4e5614,_0x434aba(0x27b)),_0x2ed540=generateDiff(_0x159d09,_0xd57ce);_0xdedad2=hasChanges(_0x2ed540),_0xdedad2&&(_0x20dbd0=formatDiffWithColors(_0x2ed540));}_0x3cccfb[_0x434aba(0x27d)]({'path':_0x4e5614,'content':_0xd57ce}),_0x2d20ea['formInterfaces'][_0x434aba(0x27d)]({'name':_0x1ab56c[_0x434aba(0x1b7)][_0x434aba(0x22b)],'outputPath':_0x4e5614,'isNew':_0x1515d1,'hasChanges':_0xdedad2,'diff':_0x20dbd0}),_0x2d20ea[_0x434aba(0x28b)]['formInterfaces']['total']++;if(_0x1515d1)_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x1c1)][_0x434aba(0x1fd)]++;else{if(_0xdedad2)_0x2d20ea['counts'][_0x434aba(0x1c1)][_0x434aba(0x1e2)]++;else _0x2d20ea['counts'][_0x434aba(0x1c1)][_0x434aba(0x281)]++;}}for(const _0x39f902 of _0xf30024){if(_0x39f902[_0x434aba(0x1b7)][_0x434aba(0x22c)])continue;const _0x5e25ed=getSanitizedPathWithMigration(getChatInterfacesDir(_0x4b5dc4),_0x39f902[_0x434aba(0x1b7)][_0x434aba(0x22b)],_0x434aba(0x283));_0x5e25ed[_0x434aba(0x2c1)]&&this['logger'][_0x434aba(0x21c)]('Renamed\x20chat\x20interface\x20file:\x20'+a133_0x503bb8[_0x434aba(0x1f6)](_0x5e25ed['oldPath'])+'\x20→\x20'+a133_0x503bb8[_0x434aba(0x1f6)](_0x5e25ed[_0x434aba(0x2b5)]));const _0x2739dc=_0x5e25ed[_0x434aba(0x2b5)],_0x27b9b2=await apiChatInterfaceToYaml(_0x39f902,_0x22149b),_0x1a026a=toChatInterfaceYamlString(_0x27b9b2),_0x11455e=!a133_0x11072e[_0x434aba(0x266)](_0x2739dc);let _0x1124aa=_0x11455e,_0x3ac542;if(!_0x11455e){const _0xe9d3c=a133_0x11072e['readFileSync'](_0x2739dc,_0x434aba(0x27b)),_0x5c34ed=generateDiff(_0xe9d3c,_0x1a026a);_0x1124aa=hasChanges(_0x5c34ed),_0x1124aa&&(_0x3ac542=formatDiffWithColors(_0x5c34ed));}_0x3cccfb[_0x434aba(0x27d)]({'path':_0x2739dc,'content':_0x1a026a}),_0x2d20ea['chatInterfaces'][_0x434aba(0x27d)]({'name':_0x39f902['attributes']['name'],'outputPath':_0x2739dc,'isNew':_0x11455e,'hasChanges':_0x1124aa,'diff':_0x3ac542}),_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x1d8)][_0x434aba(0x1f8)]++;if(_0x11455e)_0x2d20ea['counts']['chatInterfaces'][_0x434aba(0x1fd)]++;else{if(_0x1124aa)_0x2d20ea[_0x434aba(0x28b)][_0x434aba(0x1d8)][_0x434aba(0x1e2)]++;else _0x2d20ea['counts'][_0x434aba(0x1d8)][_0x434aba(0x281)]++;}}if(_0x1c2614?.[_0x434aba(0x1ba)])return _0x2d20ea;a133_0x11072e['mkdirSync'](_0x4b5dc4,{'recursive':!![]}),a133_0x11072e[_0x434aba(0x249)](getKnowledgeBasesDir(_0x4b5dc4),{'recursive':!![]}),a133_0x11072e[_0x434aba(0x249)](getPromptsDir(_0x4b5dc4),{'recursive':!![]}),a133_0x11072e['mkdirSync'](getIntegrationsDir(_0x4b5dc4),{'recursive':!![]}),a133_0x11072e[_0x434aba(0x249)](getExperimentalKnowledgeBasesDir(_0x4b5dc4),{'recursive':!![]}),a133_0x11072e[_0x434aba(0x249)](getExperimentalArtifactsDir(_0x4b5dc4),{'recursive':!![]}),a133_0x11072e[_0x434aba(0x249)](getFormInterfacesDir(_0x4b5dc4),{'recursive':!![]}),a133_0x11072e[_0x434aba(0x249)](getChatInterfacesDir(_0x4b5dc4),{'recursive':!![]});const _0x2ca8e8=a133_0x503bb8[_0x434aba(0x26b)](_0x4b5dc4,_0x434aba(0x1e5));a133_0x11072e[_0x434aba(0x237)](_0x2ca8e8,createAgentConfigContent(_0x37b41f));for(const _0x364ebe of _0x3cccfb){if(_0x364ebe['isDir'])a133_0x11072e[_0x434aba(0x249)](_0x364ebe[_0x434aba(0x2b5)],{'recursive':!![]});else{const _0x483a00=a133_0x503bb8[_0x434aba(0x263)](_0x364ebe[_0x434aba(0x2b5)]);!a133_0x11072e[_0x434aba(0x266)](_0x483a00)&&a133_0x11072e[_0x434aba(0x249)](_0x483a00,{'recursive':!![]}),a133_0x11072e[_0x434aba(0x237)](_0x364ebe['path'],_0x364ebe[_0x434aba(0x214)]);}}for(const _0x42ffcd of _0xaccf71){_0x42ffcd[_0x434aba(0x21d)]?(a133_0x11072e['rmSync'](_0x42ffcd[_0x434aba(0x2b5)],{'recursive':!![],'force':!![]}),this['logger'][_0x434aba(0x21c)](_0x434aba(0x24b)+a133_0x503bb8['basename'](a133_0x503bb8['dirname'](_0x42ffcd[_0x434aba(0x2b5)]))+'/'+a133_0x503bb8[_0x434aba(0x1f6)](_0x42ffcd[_0x434aba(0x2b5)]))):(a133_0x11072e['rmSync'](_0x42ffcd[_0x434aba(0x2b5)],{'force':!![]}),this['logger'][_0x434aba(0x21c)](_0x434aba(0x1b8)+a133_0x503bb8[_0x434aba(0x1f6)](a133_0x503bb8[_0x434aba(0x263)](_0x42ffcd[_0x434aba(0x2b5)]))+'/'+a133_0x503bb8['basename'](_0x42ffcd[_0x434aba(0x2b5)])));}return _0x2d20ea;}async['pushProject'](_0x14df47,_0x365647){const _0x40685e=a133_0x533a84,_0x56607e=a133_0x503bb8['join'](_0x14df47,'tdx.json');if(!a133_0x11072e[_0x40685e(0x266)](_0x56607e))throw new SDKError(ErrorCode[_0x40685e(0x231)],'No\x20tdx.json\x20found\x20in\x20'+_0x14df47,undefined,{'helpText':_0x40685e(0x1e9)});const _0x3cbed0=loadAgentConfig(_0x56607e),_0x4c37c4=await this[_0x40685e(0x226)](_0x3cbed0['llm_project']),_0x38fe4f=await this[_0x40685e(0x28e)][_0x40685e(0x2af)](_0x4c37c4),_0xd46ced=_0x38fe4f[_0x40685e(0x1b7)][_0x40685e(0x22b)],_0x5a17ac={'projectName':_0xd46ced,'projectId':_0x4c37c4,'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}}},_0x1a06fb=[],_0x1572db=[],_0x29f455=[],_0x37617a=[],_0x3e07ab=[],_0x17d7bb=[],_0x53969b=a133_0x11072e[_0x40685e(0x2c3)](_0x14df47,{'withFileTypes':!![]});for(const _0x5e6808 of _0x53969b){if(!_0x5e6808[_0x40685e(0x1fa)]())continue;if([_0x40685e(0x1f3),'prompts',_0x40685e(0x267),_0x40685e(0x1d5),'experimental_artifacts','form_interfaces',_0x40685e(0x20c)]['includes'](_0x5e6808[_0x40685e(0x22b)]))continue;const _0x4080fa=a133_0x503bb8[_0x40685e(0x26b)](_0x14df47,_0x5e6808[_0x40685e(0x22b)]);if(isAgentDir(_0x4080fa)){const _0x5db301=a133_0x503bb8['join'](_0x4080fa,'agent.yml'),_0xccae94=a133_0x503bb8['join'](_0x4080fa,_0x40685e(0x1eb)),_0x2b46a5=a133_0x503bb8[_0x40685e(0x26b)](_0x4080fa,_0x40685e(0x232)),_0x47c4da=parseAgentYaml(a133_0x11072e[_0x40685e(0x233)](_0x5db301,'utf-8'),_0x5db301),_0x1d894f=a133_0x11072e['existsSync'](_0xccae94)?a133_0x11072e[_0x40685e(0x233)](_0xccae94,'utf-8'):'',_0x2bd016=a133_0x11072e[_0x40685e(0x266)](_0x2b46a5)?a133_0x11072e[_0x40685e(0x233)](_0x2b46a5,'utf-8'):_0x47c4da[_0x40685e(0x1ec)];_0x1a06fb['push']({'name':_0x47c4da['name'],'dir':_0x4080fa,'yaml':_0x47c4da,'systemPrompt':_0x1d894f,'starterMessage':_0x2bd016});}}const _0xe8c7a0=getKnowledgeBasesDir(_0x14df47);if(a133_0x11072e[_0x40685e(0x266)](_0xe8c7a0)){const _0x1138a4=a133_0x11072e[_0x40685e(0x2c3)](_0xe8c7a0);for(const _0x596ef0 of _0x1138a4){const _0x18c4c8=a133_0x503bb8[_0x40685e(0x26b)](_0xe8c7a0,_0x596ef0);if(_0x596ef0[_0x40685e(0x1e3)](_0x40685e(0x283))){const _0x3c27e0=parseKnowledgeBaseYaml(a133_0x11072e[_0x40685e(0x233)](_0x18c4c8,'utf-8'),_0x18c4c8);_0x1572db[_0x40685e(0x27d)]({'name':_0x3c27e0[_0x40685e(0x22b)],'path':_0x18c4c8,'yaml':_0x3c27e0});}else{if(_0x596ef0[_0x40685e(0x1e3)](_0x40685e(0x1f9))){const _0x43146b=a133_0x11072e[_0x40685e(0x233)](_0x18c4c8,_0x40685e(0x27b)),{name:_0x335162,text:_0x3b54bd}=parseTextKnowledgeBaseMd(_0x43146b,_0x596ef0);_0x29f455['push']({'name':_0x335162,'path':_0x18c4c8,'text':_0x3b54bd});}}}}const _0x484d9a=getPromptsDir(_0x14df47);if(a133_0x11072e[_0x40685e(0x266)](_0x484d9a)){const _0x2b1dd1=a133_0x11072e[_0x40685e(0x2c3)](_0x484d9a)[_0x40685e(0x213)](_0x11d5bf=>_0x11d5bf[_0x40685e(0x1e3)](_0x40685e(0x283)));for(const _0x374902 of _0x2b1dd1){const _0x44fcb3=a133_0x503bb8[_0x40685e(0x26b)](_0x484d9a,_0x374902),_0x50f8c6=parsePromptYaml(a133_0x11072e[_0x40685e(0x233)](_0x44fcb3,'utf-8'),_0x44fcb3);_0x37617a[_0x40685e(0x27d)]({'name':_0x50f8c6[_0x40685e(0x22b)],'path':_0x44fcb3,'yaml':_0x50f8c6});}}const _0x37aa31=[],_0x216f78=getIntegrationsDir(_0x14df47);if(a133_0x11072e['existsSync'](_0x216f78)){const _0x551b8c=a133_0x11072e[_0x40685e(0x2c3)](_0x216f78)[_0x40685e(0x213)](_0xe6d4d1=>_0xe6d4d1[_0x40685e(0x1e3)]('.yml'));for(const _0x450b82 of _0x551b8c){const _0x4e948b=a133_0x503bb8['join'](_0x216f78,_0x450b82),_0x430bdb=parseIntegrationYaml(a133_0x11072e[_0x40685e(0x233)](_0x4e948b,_0x40685e(0x27b)),_0x4e948b);if(!SAFE_INTEGRATION_TYPES[_0x40685e(0x1dc)](_0x430bdb[_0x40685e(0x247)][_0x40685e(0x1cc)]())){this[_0x40685e(0x1a8)][_0x40685e(0x29b)](_0x40685e(0x1ce)+_0x430bdb['name']+_0x40685e(0x259)+_0x430bdb['service_type']+_0x40685e(0x22a)+(_0x40685e(0x208)+SAFE_INTEGRATION_TYPES[_0x40685e(0x26b)](',\x20')+')\x20can\x20be\x20pushed.\x20')+'Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.');continue;}_0x37aa31[_0x40685e(0x27d)]({'name':_0x430bdb[_0x40685e(0x22b)],'path':_0x4e948b,'yaml':_0x430bdb});}}const _0xc736a6=getExperimentalKnowledgeBasesDir(_0x14df47);if(a133_0x11072e[_0x40685e(0x266)](_0xc736a6)){const _0x1ed3bb=a133_0x11072e[_0x40685e(0x2c3)](_0xc736a6,{'withFileTypes':!![]});for(const _0x30cd57 of _0x1ed3bb){if(!_0x30cd57['isDirectory']())continue;const _0x277dae=a133_0x503bb8[_0x40685e(0x26b)](_0xc736a6,_0x30cd57[_0x40685e(0x22b)]),_0x319b47=a133_0x503bb8[_0x40685e(0x26b)](_0x277dae,_0x30cd57[_0x40685e(0x22b)]+_0x40685e(0x283)),_0x145227=a133_0x503bb8[_0x40685e(0x26b)](_0x277dae,'functions');if(!a133_0x11072e[_0x40685e(0x266)](_0x319b47))continue;const _0x9c56a7=parseExperimentalKnowledgeBaseYaml(a133_0x11072e[_0x40685e(0x233)](_0x319b47,_0x40685e(0x27b)),_0x319b47),_0x59116=[];if(a133_0x11072e[_0x40685e(0x266)](_0x145227)){const _0x451cb5=a133_0x11072e[_0x40685e(0x2c3)](_0x145227,{'withFileTypes':!![]});for(const _0x10c0f7 of _0x451cb5){if(!_0x10c0f7[_0x40685e(0x1fa)]())continue;const _0x4af88a=a133_0x503bb8[_0x40685e(0x26b)](_0x145227,_0x10c0f7[_0x40685e(0x22b)]),_0x39678f=a133_0x503bb8['join'](_0x4af88a,_0x40685e(0x1d0)),_0xcc695c=a133_0x503bb8[_0x40685e(0x26b)](_0x4af88a,_0x40685e(0x2ad));a133_0x11072e[_0x40685e(0x266)](_0x39678f)&&a133_0x11072e[_0x40685e(0x266)](_0xcc695c)&&_0x59116[_0x40685e(0x27d)]({'name':_0x10c0f7['name'],'code':a133_0x11072e[_0x40685e(0x233)](_0x39678f,'utf-8'),'json_schema':a133_0x11072e[_0x40685e(0x233)](_0xcc695c,_0x40685e(0x27b))});}}const _0x8b9f7b={..._0x9c56a7,'variables':_0x9c56a7[_0x40685e(0x2b6)]||[],'functions':_0x59116};_0x3e07ab['push']({'name':_0x9c56a7[_0x40685e(0x22b)],'dir':_0x277dae,'def':_0x8b9f7b});}}const _0x3aecfe=getExperimentalArtifactsDir(_0x14df47);if(a133_0x11072e[_0x40685e(0x266)](_0x3aecfe)){const _0x2506e6=a133_0x11072e[_0x40685e(0x2c3)](_0x3aecfe,{'withFileTypes':!![]});for(const _0x5eb4d4 of _0x2506e6){if(!_0x5eb4d4[_0x40685e(0x1fa)]())continue;const _0x510e97=a133_0x503bb8[_0x40685e(0x26b)](_0x3aecfe,_0x5eb4d4[_0x40685e(0x22b)]),_0x38e520=a133_0x503bb8[_0x40685e(0x26b)](_0x510e97,_0x5eb4d4[_0x40685e(0x22b)]+_0x40685e(0x283)),_0xa5fe3d=a133_0x503bb8['join'](_0x510e97,'code.js'),_0x2e8945=a133_0x503bb8[_0x40685e(0x26b)](_0x510e97,_0x40685e(0x2ab));if(!a133_0x11072e['existsSync'](_0x38e520)||!a133_0x11072e[_0x40685e(0x266)](_0xa5fe3d))continue;const _0xff628b=parseExperimentalArtifactYaml(a133_0x11072e[_0x40685e(0x233)](_0x38e520,'utf-8'),_0x38e520),_0x1ff02d=a133_0x11072e[_0x40685e(0x233)](_0xa5fe3d,_0x40685e(0x27b)),_0x387eb5=[];if(a133_0x11072e[_0x40685e(0x266)](_0x2e8945)){const _0x2384f3=a133_0x11072e[_0x40685e(0x2c3)](_0x2e8945);for(const _0x5068e0 of _0x2384f3){const _0x16baee=a133_0x503bb8[_0x40685e(0x26b)](_0x2e8945,_0x5068e0);a133_0x11072e[_0x40685e(0x270)](_0x16baee)[_0x40685e(0x288)]()&&_0x387eb5[_0x40685e(0x27d)]({'file_name':_0x5068e0,'text_content':a133_0x11072e[_0x40685e(0x233)](_0x16baee,_0x40685e(0x27b))});}}const _0x408c31={..._0xff628b,'code':_0x1ff02d,'files':_0x387eb5};_0x17d7bb[_0x40685e(0x27d)]({'name':_0xff628b['name'],'dir':_0x510e97,'def':_0x408c31});}}const _0x111737=[],_0x4077ba=getFormInterfacesDir(_0x14df47);if(a133_0x11072e[_0x40685e(0x266)](_0x4077ba)){const _0x4c3481=a133_0x11072e[_0x40685e(0x2c3)](_0x4077ba)['filter'](_0x310736=>_0x310736['endsWith'](_0x40685e(0x283)));for(const _0x2f74d8 of _0x4c3481){const _0xa7043d=a133_0x503bb8[_0x40685e(0x26b)](_0x4077ba,_0x2f74d8),_0x1c7332=parseFormInterfaceYaml(a133_0x11072e[_0x40685e(0x233)](_0xa7043d,'utf-8'),_0xa7043d);_0x111737['push']({'name':_0x1c7332[_0x40685e(0x22b)],'path':_0xa7043d,'yaml':_0x1c7332});}}const _0x5daadc=[],_0x3ea4b1=getChatInterfacesDir(_0x14df47);if(a133_0x11072e[_0x40685e(0x266)](_0x3ea4b1)){const _0x5844b4=a133_0x11072e[_0x40685e(0x2c3)](_0x3ea4b1)[_0x40685e(0x213)](_0x5d6b87=>_0x5d6b87['endsWith'](_0x40685e(0x283)));for(const _0x3790f4 of _0x5844b4){const _0x81be72=a133_0x503bb8['join'](_0x3ea4b1,_0x3790f4),_0x388bae=parseChatInterfaceYaml(a133_0x11072e[_0x40685e(0x233)](_0x81be72,_0x40685e(0x27b)),_0x81be72);_0x5daadc['push']({'name':_0x388bae['name'],'path':_0x81be72,'yaml':_0x388bae});}}const _0x5a1546=await this[_0x40685e(0x28e)]['listAgentsFull'](_0x4c37c4),_0x1ee575=await this['client']['listKnowledgeBases'](_0x4c37c4),_0x43f8c0=await this[_0x40685e(0x28e)]['listTextKnowledgeBases'](_0x4c37c4),_0x1211eb=await this[_0x40685e(0x28e)][_0x40685e(0x282)](_0x4c37c4),_0x21c85b=await this[_0x40685e(0x28e)][_0x40685e(0x1c9)](_0x4c37c4),_0x3702d0=await safeListOrEmpty(()=>this[_0x40685e(0x28e)][_0x40685e(0x220)](_0x4c37c4)),_0xef5c7b=await safeListOrEmpty(()=>this[_0x40685e(0x28e)][_0x40685e(0x1a4)](_0x4c37c4)),_0x2082f8=await safeListOrEmpty(()=>this[_0x40685e(0x28e)][_0x40685e(0x29d)](_0x4c37c4)),_0x35a7e2=await safeListOrEmpty(()=>this[_0x40685e(0x28e)][_0x40685e(0x1e4)](_0x4c37c4)),_0x35d59f=await fetchAllToolTargetMaps((_0x3531fa,_0x81edbb)=>this[_0x40685e(0x28e)][_0x40685e(0x1ad)](_0x3531fa,_0x81edbb),_0x4c37c4),_0x5a388c=new Map(),_0x51ec9e=new Map(),_0x319e3e=new Map(),_0x516dc5=new Map(),_0x4df2ec=new Map(),_0x3d6e74=new Map(),_0x5ee164=new Map();for(const _0x188144 of _0x5a1546){_0x5a388c['set'](_0x188144[_0x40685e(0x1b7)][_0x40685e(0x22b)],_0x188144);}for(const _0x2d0335 of _0x1ee575){_0x51ec9e[_0x40685e(0x271)](_0x2d0335[_0x40685e(0x1b7)]['name'],_0x2d0335);}for(const _0x57f495 of _0x43f8c0){_0x319e3e[_0x40685e(0x271)](_0x57f495['attributes'][_0x40685e(0x22b)],_0x57f495);}for(const _0x2b905d of _0x1211eb){_0x516dc5['set'](_0x2b905d['attributes'][_0x40685e(0x22b)],_0x2b905d);}for(const _0x28a0dc of _0x21c85b){_0x4df2ec[_0x40685e(0x271)](_0x28a0dc[_0x40685e(0x1b7)]['serviceType']['toLowerCase'](),_0x28a0dc);}for(const _0x2528fd of _0x3702d0){_0x3d6e74[_0x40685e(0x271)](_0x2528fd['attributes'][_0x40685e(0x22b)],_0x2528fd);}for(const _0x7f907e of _0xef5c7b){_0x5ee164[_0x40685e(0x271)](_0x7f907e['attributes'][_0x40685e(0x22b)],_0x7f907e);}const _0x36e3ab=new Map(),_0x5df94d=new Map();for(const _0x2579b9 of _0x2082f8){_0x36e3ab['set'](_0x2579b9[_0x40685e(0x1b7)][_0x40685e(0x22b)],_0x2579b9);}for(const _0x75a65e of _0x35a7e2){_0x5df94d['set'](_0x75a65e[_0x40685e(0x1b7)]['name'],_0x75a65e);}const _0x3f8bce=new Map(),_0x59504d=new Map();for(const _0x475bf1 of _0x5a1546){_0x3f8bce[_0x40685e(0x271)](_0x475bf1[_0x40685e(0x1b7)][_0x40685e(0x22b)],_0x475bf1['id']),_0x59504d[_0x40685e(0x271)](_0x475bf1['id'],_0x475bf1[_0x40685e(0x1b7)]['name']);}const _0x1fc9d0=new Map(),_0x207f06=new Map();for(const _0x57f970 of _0x1211eb){_0x1fc9d0[_0x40685e(0x271)](_0x57f970[_0x40685e(0x1b7)][_0x40685e(0x22b)],_0x57f970['id']),_0x207f06[_0x40685e(0x271)](_0x57f970['id'],_0x57f970['attributes']['name']);}const _0xf051c9=_0x35d59f['nameToId'][_0x40685e(0x2a4)]||new Map(),_0xa1ee1f=_0x35d59f[_0x40685e(0x1c6)][_0x40685e(0x291)]||new Map(),_0x33ba00=_0x35d59f[_0x40685e(0x1c6)][_0x40685e(0x2a1)]||new Map(),_0x4ea9d9=new Map(),_0x333d1d={'resolveToolTargetName':buildNameResolver({..._0x35d59f['idToName'],'Agent':_0x59504d}),'resolvePromptName':async _0x5d10e0=>_0x207f06['get'](_0x5d10e0),'onWarning':_0x38f337=>this[_0x40685e(0x1a8)][_0x40685e(0x29b)](_0x38f337)};let _0x2592d9=[];const _0xf46727={'projectId':_0x4c37c4,'resolveToolTargetId':buildIdResolver({..._0x35d59f['nameToId'],'Agent':_0x3f8bce}),'resolvePromptId':async _0x1a5222=>_0x1fc9d0[_0x40685e(0x1cb)](_0x1a5222),'onWarning':_0x3b6e21=>{const _0x56c00d=_0x40685e;this['logger'][_0x56c00d(0x29b)](_0x3b6e21),_0x2592d9[_0x56c00d(0x27d)](_0x3b6e21);}},{resolved:_0x3cd38d,unresolved:_0x10764e}=resolveAgentDependencies(_0x1a06fb,new Set(_0x5a388c[_0x40685e(0x210)]()));for(const {agent:_0x40d000,missingDeps:_0x171749}of _0x10764e){_0x5a17ac[_0x40685e(0x239)][_0x40685e(0x27d)]({'agentName':_0x40d000['yaml']['name'],'action':_0x40685e(0x29c),'error':_0x40685e(0x224)+_0x171749[_0x40685e(0x26b)](',\x20')+_0x40685e(0x211)}),_0x5a17ac[_0x40685e(0x28b)]['agents'][_0x40685e(0x1c4)]++;}for(const _0x439f8c of _0x1572db){const _0x349401=_0x51ec9e[_0x40685e(0x1cb)](_0x439f8c['yaml'][_0x40685e(0x22b)]),_0x1eb0de=a133_0x11072e[_0x40685e(0x233)](_0x439f8c['path'],_0x40685e(0x27b));if(_0x349401){const _0x247d4b=apiKnowledgeBaseToYaml(_0x349401),_0x4e1ce2=toKnowledgeBaseYamlString(_0x247d4b),_0x2fb952=generateDiff(_0x4e1ce2,_0x1eb0de),_0x27bda5=hasChanges(_0x2fb952);_0x27bda5?(_0x5a17ac[_0x40685e(0x209)][_0x40685e(0x27d)]({'name':_0x439f8c[_0x40685e(0x26f)][_0x40685e(0x22b)],'action':_0x40685e(0x1e2),'id':_0x349401['id'],'diff':formatDiffWithColors(_0x2fb952)}),_0x5a17ac[_0x40685e(0x28b)]['knowledgeBases'][_0x40685e(0x1e2)]++):(_0x5a17ac[_0x40685e(0x209)][_0x40685e(0x27d)]({'name':_0x439f8c[_0x40685e(0x26f)][_0x40685e(0x22b)],'action':_0x40685e(0x281),'id':_0x349401['id']}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x209)]['unchanged']++);}else _0x5a17ac[_0x40685e(0x209)][_0x40685e(0x27d)]({'name':_0x439f8c[_0x40685e(0x26f)][_0x40685e(0x22b)],'action':_0x40685e(0x278)}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x209)][_0x40685e(0x278)]++;}for(const _0x5b41f1 of _0x29f455){const _0x49f3a9=_0x319e3e[_0x40685e(0x1cb)](_0x5b41f1[_0x40685e(0x22b)]),_0x1cd694=a133_0x11072e[_0x40685e(0x233)](_0x5b41f1[_0x40685e(0x2b5)],_0x40685e(0x27b));if(_0x49f3a9){const _0xa46a24=toTextKnowledgeBaseMd(_0x49f3a9[_0x40685e(0x1b7)][_0x40685e(0x22b)],_0x49f3a9['attributes'][_0x40685e(0x245)]),_0x7a6d28=generateDiff(_0xa46a24,_0x1cd694),_0x44fa92=hasChanges(_0x7a6d28);_0x44fa92?(_0x5a17ac[_0x40685e(0x292)][_0x40685e(0x27d)]({'name':_0x5b41f1[_0x40685e(0x22b)],'action':_0x40685e(0x1e2),'id':_0x49f3a9['id'],'diff':formatDiffWithColors(_0x7a6d28)}),_0x5a17ac[_0x40685e(0x28b)]['textKnowledgeBases']['updated']++):(_0x5a17ac[_0x40685e(0x292)]['push']({'name':_0x5b41f1[_0x40685e(0x22b)],'action':_0x40685e(0x281),'id':_0x49f3a9['id']}),_0x5a17ac['counts'][_0x40685e(0x292)]['unchanged']++);}else _0x5a17ac[_0x40685e(0x292)][_0x40685e(0x27d)]({'name':_0x5b41f1[_0x40685e(0x22b)],'action':'created'}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x292)]['created']++;}for(const _0x251684 of _0x3cd38d){const _0x18f43c=_0x5a388c[_0x40685e(0x1cb)](_0x251684[_0x40685e(0x26f)][_0x40685e(0x22b)]),_0xbc5c08=a133_0x503bb8[_0x40685e(0x26b)](_0x251684[_0x40685e(0x23d)],_0x40685e(0x1ca)),_0x57a62c=a133_0x11072e[_0x40685e(0x233)](_0xbc5c08,'utf-8'),_0x544655=_0x251684[_0x40685e(0x1d6)],_0x92218=_0x40685e(0x26d)+_0x544655+_0x40685e(0x2a2)+_0x57a62c;if(_0x18f43c){const {yaml:_0x3fdf9f,systemPrompt:_0x1d83b6}=await agentResponseToDef(_0x18f43c,_0x333d1d),_0xf9eb6a=toAgentYamlString(_0x3fdf9f),_0x1f13e9=_0x40685e(0x26d)+_0x1d83b6+_0x40685e(0x2a2)+_0xf9eb6a,_0x13db82=generateDiff(_0x1f13e9,_0x92218),_0x20f3e9=hasChanges(_0x13db82);_0x20f3e9?(_0x5a17ac[_0x40685e(0x239)]['push']({'agentName':_0x251684[_0x40685e(0x26f)][_0x40685e(0x22b)],'action':_0x40685e(0x1e2),'agentId':_0x18f43c['id'],'diff':formatDiffWithColors(_0x13db82)}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x239)][_0x40685e(0x1e2)]++):(_0x5a17ac[_0x40685e(0x239)][_0x40685e(0x27d)]({'agentName':_0x251684['yaml'][_0x40685e(0x22b)],'action':_0x40685e(0x281),'agentId':_0x18f43c['id']}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x239)][_0x40685e(0x281)]++);}else _0x5a17ac['agents'][_0x40685e(0x27d)]({'agentName':_0x251684[_0x40685e(0x26f)][_0x40685e(0x22b)],'action':_0x40685e(0x278)}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x239)][_0x40685e(0x278)]++;}for(const _0x1360e3 of _0x37617a){const _0x2544ad=_0x516dc5[_0x40685e(0x1cb)](_0x1360e3[_0x40685e(0x26f)][_0x40685e(0x22b)]),_0x580a05=a133_0x11072e['readFileSync'](_0x1360e3[_0x40685e(0x2b5)],_0x40685e(0x27b));if(_0x2544ad){const _0x58ffa4=await apiPromptToYaml(_0x2544ad,_0x333d1d);if(!_0x58ffa4){_0x5a17ac[_0x40685e(0x273)][_0x40685e(0x27d)]({'name':_0x1360e3[_0x40685e(0x26f)][_0x40685e(0x22b)],'action':_0x40685e(0x1e2),'id':_0x2544ad['id']}),_0x5a17ac['counts'][_0x40685e(0x273)][_0x40685e(0x1e2)]++;continue;}const _0x1baa88=toPromptYamlString(_0x58ffa4),_0x588fa9=generateDiff(_0x1baa88,_0x580a05),_0xa2d492=hasChanges(_0x588fa9);_0xa2d492?(_0x5a17ac[_0x40685e(0x273)][_0x40685e(0x27d)]({'name':_0x1360e3[_0x40685e(0x26f)][_0x40685e(0x22b)],'action':_0x40685e(0x1e2),'id':_0x2544ad['id'],'diff':formatDiffWithColors(_0x588fa9)}),_0x5a17ac[_0x40685e(0x28b)]['prompts'][_0x40685e(0x1e2)]++):(_0x5a17ac['prompts'][_0x40685e(0x27d)]({'name':_0x1360e3[_0x40685e(0x26f)]['name'],'action':_0x40685e(0x281),'id':_0x2544ad['id']}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x273)][_0x40685e(0x281)]++);}else _0x5a17ac[_0x40685e(0x273)][_0x40685e(0x27d)]({'name':_0x1360e3[_0x40685e(0x26f)]['name'],'action':'created'}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x273)][_0x40685e(0x278)]++;}for(const _0x16acdf of _0x37aa31){const _0x135607=_0x4df2ec[_0x40685e(0x1cb)](_0x16acdf['yaml'][_0x40685e(0x247)]),_0x40d1c1=a133_0x11072e[_0x40685e(0x233)](_0x16acdf[_0x40685e(0x2b5)],_0x40685e(0x27b));if(_0x135607){const _0x3162f3=await apiIntegrationToYaml(_0x135607,_0x333d1d),_0x59af90=toIntegrationYamlString(_0x3162f3),_0x4156c9=generateDiff(_0x59af90,_0x40d1c1),_0x37cba7=hasChanges(_0x4156c9);_0x37cba7?(_0x5a17ac[_0x40685e(0x267)]['push']({'name':_0x16acdf[_0x40685e(0x26f)]['service_type'],'action':_0x40685e(0x1e2),'id':_0x135607['id'],'diff':formatDiffWithColors(_0x4156c9)}),_0x5a17ac[_0x40685e(0x28b)]['integrations'][_0x40685e(0x1e2)]++):(_0x5a17ac[_0x40685e(0x267)]['push']({'name':_0x16acdf[_0x40685e(0x26f)][_0x40685e(0x247)],'action':_0x40685e(0x281),'id':_0x135607['id']}),_0x5a17ac['counts'][_0x40685e(0x267)][_0x40685e(0x281)]++);}else _0x5a17ac[_0x40685e(0x267)][_0x40685e(0x27d)]({'name':_0x16acdf['yaml']['service_type'],'action':'created'}),_0x5a17ac['counts'][_0x40685e(0x267)][_0x40685e(0x278)]++;}for(const _0x4446dd of _0x3e07ab){const _0x3072ec=_0x3d6e74[_0x40685e(0x1cb)](_0x4446dd[_0x40685e(0x1e6)][_0x40685e(0x22b)]),_0x3260ef=toExperimentalKnowledgeBaseYamlString(_0x4446dd['def']);let _0x49d7a7=_0x3260ef;for(const _0x5401ee of _0x4446dd[_0x40685e(0x1e6)][_0x40685e(0x251)]){_0x49d7a7+=_0x40685e(0x2b3)+_0x5401ee[_0x40685e(0x22b)]+_0x40685e(0x229)+_0x5401ee[_0x40685e(0x28c)]+_0x40685e(0x1fc)+_0x5401ee[_0x40685e(0x22b)]+_0x40685e(0x229)+_0x5401ee[_0x40685e(0x297)]+'\x0a';}if(_0x3072ec){const _0x54ed07=apiExperimentalKnowledgeBaseToYaml(_0x3072ec),_0x30f47b=toExperimentalKnowledgeBaseYamlString(_0x54ed07);let _0x869c77=_0x30f47b;for(const _0x3b2629 of _0x54ed07[_0x40685e(0x251)]){_0x869c77+=_0x40685e(0x2b3)+_0x3b2629[_0x40685e(0x22b)]+_0x40685e(0x229)+_0x3b2629[_0x40685e(0x28c)]+'\x0a---\x20schema:\x20'+_0x3b2629[_0x40685e(0x22b)]+'\x20---\x0a'+_0x3b2629[_0x40685e(0x297)]+'\x0a';}const _0x35e385=generateDiff(_0x869c77,_0x49d7a7),_0x3d4470=hasChanges(_0x35e385);_0x3d4470?(_0x5a17ac['experimentalKnowledgeBases'][_0x40685e(0x27d)]({'name':_0x4446dd['def']['name'],'action':_0x40685e(0x1e2),'id':_0x3072ec['id'],'diff':formatDiffWithColors(_0x35e385)}),_0x5a17ac[_0x40685e(0x28b)]['experimentalKnowledgeBases'][_0x40685e(0x1e2)]++):(_0x5a17ac[_0x40685e(0x20b)][_0x40685e(0x27d)]({'name':_0x4446dd['def']['name'],'action':_0x40685e(0x281),'id':_0x3072ec['id']}),_0x5a17ac['counts'][_0x40685e(0x20b)]['unchanged']++);}else _0x5a17ac[_0x40685e(0x20b)][_0x40685e(0x27d)]({'name':_0x4446dd['def']['name'],'action':_0x40685e(0x278)}),_0x5a17ac[_0x40685e(0x28b)]['experimentalKnowledgeBases'][_0x40685e(0x278)]++;}for(const _0xb66e26 of _0x17d7bb){const _0x2a28d6=_0x5ee164[_0x40685e(0x1cb)](_0xb66e26[_0x40685e(0x1e6)][_0x40685e(0x22b)]),_0x53f5ff=toExperimentalArtifactYamlString(_0xb66e26[_0x40685e(0x1e6)]);let _0x43f49d=_0x53f5ff+(_0x40685e(0x289)+_0xb66e26['def']['code']+'\x0a');for(const _0x135102 of _0xb66e26[_0x40685e(0x1e6)][_0x40685e(0x2ab)]){_0x43f49d+=_0x40685e(0x1f1)+_0x135102['file_name']+_0x40685e(0x229)+_0x135102[_0x40685e(0x2b7)]+'\x0a';}if(_0x2a28d6){const _0x1f1d03=apiExperimentalArtifactToYaml(_0x2a28d6),_0x335dae=toExperimentalArtifactYamlString(_0x1f1d03);let _0x4459c3=_0x335dae+(_0x40685e(0x289)+_0x1f1d03['code']+'\x0a');for(const _0x5337cb of _0x1f1d03[_0x40685e(0x2ab)]){_0x4459c3+=_0x40685e(0x1f1)+_0x5337cb[_0x40685e(0x234)]+_0x40685e(0x229)+_0x5337cb[_0x40685e(0x2b7)]+'\x0a';}const _0x4ac238=generateDiff(_0x4459c3,_0x43f49d),_0x4d73a6=hasChanges(_0x4ac238);_0x4d73a6?(_0x5a17ac[_0x40685e(0x2be)][_0x40685e(0x27d)]({'name':_0xb66e26['def']['name'],'action':_0x40685e(0x1e2),'id':_0x2a28d6['id'],'diff':formatDiffWithColors(_0x4ac238)}),_0x5a17ac[_0x40685e(0x28b)]['experimentalArtifacts'][_0x40685e(0x1e2)]++):(_0x5a17ac[_0x40685e(0x2be)][_0x40685e(0x27d)]({'name':_0xb66e26[_0x40685e(0x1e6)][_0x40685e(0x22b)],'action':'unchanged','id':_0x2a28d6['id']}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x2be)]['unchanged']++);}else _0x5a17ac[_0x40685e(0x2be)][_0x40685e(0x27d)]({'name':_0xb66e26[_0x40685e(0x1e6)]['name'],'action':_0x40685e(0x278)}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x2be)]['created']++;}for(const _0x4fc2d9 of _0x111737){const _0x13bfeb=_0x36e3ab[_0x40685e(0x1cb)](_0x4fc2d9[_0x40685e(0x26f)]['name']),_0x3903b7=a133_0x11072e['readFileSync'](_0x4fc2d9[_0x40685e(0x2b5)],'utf-8');if(_0x13bfeb){const _0x4fe6f7=await apiFormInterfaceToYaml(_0x13bfeb,_0x333d1d),_0x5b2119=toFormInterfaceYamlString(_0x4fe6f7),_0x326bb7=generateDiff(_0x5b2119,_0x3903b7),_0x3cee6b=hasChanges(_0x326bb7);_0x3cee6b?(_0x5a17ac[_0x40685e(0x1c1)][_0x40685e(0x27d)]({'name':_0x4fc2d9[_0x40685e(0x26f)][_0x40685e(0x22b)],'action':_0x40685e(0x1e2),'id':_0x13bfeb['id'],'diff':formatDiffWithColors(_0x326bb7)}),_0x5a17ac['counts']['formInterfaces'][_0x40685e(0x1e2)]++):(_0x5a17ac[_0x40685e(0x1c1)][_0x40685e(0x27d)]({'name':_0x4fc2d9[_0x40685e(0x26f)]['name'],'action':_0x40685e(0x281),'id':_0x13bfeb['id']}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x1c1)][_0x40685e(0x281)]++);}else _0x5a17ac['formInterfaces'][_0x40685e(0x27d)]({'name':_0x4fc2d9[_0x40685e(0x26f)][_0x40685e(0x22b)],'action':'created'}),_0x5a17ac['counts']['formInterfaces'][_0x40685e(0x278)]++;}for(const _0x2d3156 of _0x5daadc){const _0x4fcd8b=_0x5df94d[_0x40685e(0x1cb)](_0x2d3156[_0x40685e(0x26f)][_0x40685e(0x22b)]),_0x20907d=a133_0x11072e[_0x40685e(0x233)](_0x2d3156[_0x40685e(0x2b5)],_0x40685e(0x27b));if(_0x4fcd8b){const _0x2c3e39=await apiChatInterfaceToYaml(_0x4fcd8b,_0x333d1d),_0x230f15=toChatInterfaceYamlString(_0x2c3e39),_0x251a8b=generateDiff(_0x230f15,_0x20907d),_0x8cea1c=hasChanges(_0x251a8b);_0x8cea1c?(_0x5a17ac[_0x40685e(0x1d8)][_0x40685e(0x27d)]({'name':_0x2d3156['yaml'][_0x40685e(0x22b)],'action':'updated','id':_0x4fcd8b['id'],'diff':formatDiffWithColors(_0x251a8b)}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x1d8)][_0x40685e(0x1e2)]++):(_0x5a17ac[_0x40685e(0x1d8)][_0x40685e(0x27d)]({'name':_0x2d3156['yaml'][_0x40685e(0x22b)],'action':_0x40685e(0x281),'id':_0x4fcd8b['id']}),_0x5a17ac['counts'][_0x40685e(0x1d8)][_0x40685e(0x281)]++);}else _0x5a17ac[_0x40685e(0x1d8)][_0x40685e(0x27d)]({'name':_0x2d3156[_0x40685e(0x26f)][_0x40685e(0x22b)],'action':_0x40685e(0x278)}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x1d8)]['created']++;}if(_0x365647?.[_0x40685e(0x1ba)])return _0x5a17ac;_0x5a17ac[_0x40685e(0x209)]=[],_0x5a17ac['textKnowledgeBases']=[],_0x5a17ac[_0x40685e(0x273)]=[],_0x5a17ac[_0x40685e(0x267)]=[],_0x5a17ac[_0x40685e(0x20b)]=[],_0x5a17ac[_0x40685e(0x2be)]=[],_0x5a17ac['formInterfaces']=[],_0x5a17ac['chatInterfaces']=[];const _0x54f7db=_0x5a17ac['agents']['filter'](_0x45c255=>_0x45c255['action']===_0x40685e(0x29c));_0x5a17ac[_0x40685e(0x239)]=_0x54f7db,_0x5a17ac['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x54f7db[_0x40685e(0x1be)]},'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 _0x11b1ec of _0x1572db){try{const _0x2fa1e5=_0x51ec9e['get'](_0x11b1ec[_0x40685e(0x26f)][_0x40685e(0x22b)]),_0x1acfee=yamlKnowledgeBaseToApi(_0x11b1ec[_0x40685e(0x26f)],_0x4c37c4);if(_0x2fa1e5)await this['client']['updateKnowledgeBase'](_0x2fa1e5['id'],_0x1acfee),_0xf051c9[_0x40685e(0x271)](_0x11b1ec['yaml'][_0x40685e(0x22b)],_0x2fa1e5['id']),_0x5a17ac[_0x40685e(0x209)][_0x40685e(0x27d)]({'name':_0x11b1ec['yaml'][_0x40685e(0x22b)],'action':'updated','id':_0x2fa1e5['id']}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x209)][_0x40685e(0x1e2)]++;else{const _0x31fc39=await this[_0x40685e(0x28e)][_0x40685e(0x2bc)](_0x1acfee);_0xf051c9[_0x40685e(0x271)](_0x11b1ec[_0x40685e(0x26f)][_0x40685e(0x22b)],_0x31fc39['id']),_0x5a17ac[_0x40685e(0x209)][_0x40685e(0x27d)]({'name':_0x11b1ec['yaml'][_0x40685e(0x22b)],'action':_0x40685e(0x278),'id':_0x31fc39['id']}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x209)]['created']++;}}catch(_0x3aa4fb){_0x5a17ac[_0x40685e(0x209)][_0x40685e(0x27d)]({'name':_0x11b1ec[_0x40685e(0x26f)][_0x40685e(0x22b)],'action':_0x40685e(0x29c),'error':_0x3aa4fb[_0x40685e(0x242)]}),_0x5a17ac['counts'][_0x40685e(0x209)]['errors']++;}}for(const _0x12488d of _0x29f455){try{const _0x11f670=_0x319e3e[_0x40685e(0x1cb)](_0x12488d[_0x40685e(0x22b)]),_0x2ed325=yamlTextKnowledgeBaseToApi({'name':_0x12488d[_0x40685e(0x22b)],'text':_0x12488d['text']},_0x4c37c4);if(_0x11f670)await this[_0x40685e(0x28e)][_0x40685e(0x20a)](_0x11f670['id'],_0x2ed325),_0xa1ee1f[_0x40685e(0x271)](_0x12488d[_0x40685e(0x22b)],_0x11f670['id']),_0x5a17ac[_0x40685e(0x292)][_0x40685e(0x27d)]({'name':_0x12488d[_0x40685e(0x22b)],'action':_0x40685e(0x1e2),'id':_0x11f670['id']}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x292)][_0x40685e(0x1e2)]++;else{const _0x287d45=await this[_0x40685e(0x28e)][_0x40685e(0x2a0)](_0x2ed325);_0xa1ee1f[_0x40685e(0x271)](_0x12488d[_0x40685e(0x22b)],_0x287d45['id']),_0x5a17ac[_0x40685e(0x292)][_0x40685e(0x27d)]({'name':_0x12488d['name'],'action':'created','id':_0x287d45['id']}),_0x5a17ac[_0x40685e(0x28b)]['textKnowledgeBases'][_0x40685e(0x278)]++;}}catch(_0x14a392){_0x5a17ac[_0x40685e(0x292)][_0x40685e(0x27d)]({'name':_0x12488d[_0x40685e(0x22b)],'action':'error','error':_0x14a392[_0x40685e(0x242)]}),_0x5a17ac[_0x40685e(0x28b)]['textKnowledgeBases'][_0x40685e(0x1c4)]++;}}for(const _0x58fc77 of _0x3e07ab){try{const _0x1bc2a2=_0x3d6e74['get'](_0x58fc77[_0x40685e(0x1e6)][_0x40685e(0x22b)]),_0x2e60c5=yamlExperimentalKnowledgeBaseToApi(_0x58fc77[_0x40685e(0x1e6)],_0x4c37c4);if(_0x1bc2a2)await this[_0x40685e(0x28e)]['updateExperimentalKnowledgeBase'](_0x1bc2a2['id'],_0x2e60c5),_0x33ba00[_0x40685e(0x271)](_0x58fc77[_0x40685e(0x1e6)][_0x40685e(0x22b)],_0x1bc2a2['id']),_0x5a17ac['experimentalKnowledgeBases'][_0x40685e(0x27d)]({'name':_0x58fc77[_0x40685e(0x1e6)][_0x40685e(0x22b)],'action':_0x40685e(0x1e2),'id':_0x1bc2a2['id']}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x20b)][_0x40685e(0x1e2)]++;else{const _0x30ec52=await this[_0x40685e(0x28e)][_0x40685e(0x28a)](_0x2e60c5);_0x33ba00[_0x40685e(0x271)](_0x58fc77[_0x40685e(0x1e6)]['name'],_0x30ec52['id']),_0x5a17ac[_0x40685e(0x20b)][_0x40685e(0x27d)]({'name':_0x58fc77[_0x40685e(0x1e6)][_0x40685e(0x22b)],'action':_0x40685e(0x278),'id':_0x30ec52['id']}),_0x5a17ac['counts'][_0x40685e(0x20b)][_0x40685e(0x278)]++;}}catch(_0x387265){_0x5a17ac[_0x40685e(0x20b)][_0x40685e(0x27d)]({'name':_0x58fc77[_0x40685e(0x1e6)][_0x40685e(0x22b)],'action':'error','error':_0x387265[_0x40685e(0x242)]}),_0x5a17ac['counts']['experimentalKnowledgeBases'][_0x40685e(0x1c4)]++;}}for(const _0x2a1ffe of _0x17d7bb){try{const _0x2bccad=_0x5ee164[_0x40685e(0x1cb)](_0x2a1ffe[_0x40685e(0x1e6)][_0x40685e(0x22b)]),_0x6c10ca=yamlExperimentalArtifactToApi(_0x2a1ffe[_0x40685e(0x1e6)],_0x4c37c4);if(_0x2bccad)await this['client'][_0x40685e(0x1b4)](_0x2bccad['id'],_0x6c10ca),_0x4ea9d9['set'](_0x2a1ffe[_0x40685e(0x1e6)]['name'],_0x2bccad['id']),_0x5a17ac[_0x40685e(0x2be)][_0x40685e(0x27d)]({'name':_0x2a1ffe[_0x40685e(0x1e6)][_0x40685e(0x22b)],'action':_0x40685e(0x1e2),'id':_0x2bccad['id']}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x2be)][_0x40685e(0x1e2)]++;else{const _0x1968e7=await this[_0x40685e(0x28e)][_0x40685e(0x296)](_0x6c10ca);_0x4ea9d9[_0x40685e(0x271)](_0x2a1ffe['def'][_0x40685e(0x22b)],_0x1968e7['id']),_0x5a17ac[_0x40685e(0x2be)][_0x40685e(0x27d)]({'name':_0x2a1ffe[_0x40685e(0x1e6)][_0x40685e(0x22b)],'action':_0x40685e(0x278),'id':_0x1968e7['id']}),_0x5a17ac[_0x40685e(0x28b)]['experimentalArtifacts']['created']++;}}catch(_0x4e5f72){_0x5a17ac[_0x40685e(0x2be)][_0x40685e(0x27d)]({'name':_0x2a1ffe[_0x40685e(0x1e6)][_0x40685e(0x22b)],'action':_0x40685e(0x29c),'error':_0x4e5f72['message']}),_0x5a17ac['counts']['experimentalArtifacts'][_0x40685e(0x1c4)]++;}}for(const _0x5c72e1 of _0x3cd38d){_0x2592d9=[];try{const _0x2cee14=_0x5a388c[_0x40685e(0x1cb)](_0x5c72e1['yaml'][_0x40685e(0x22b)]),_0x850437=await agentDefToRequest(_0x5c72e1[_0x40685e(0x26f)],_0x5c72e1[_0x40685e(0x1d6)],_0x5c72e1['starterMessage'],_0xf46727);if(_0x2cee14)await this[_0x40685e(0x28e)][_0x40685e(0x1dd)](_0x2cee14['id'],_0x850437),_0x3f8bce['set'](_0x5c72e1[_0x40685e(0x26f)][_0x40685e(0x22b)],_0x2cee14['id']),_0x5a17ac[_0x40685e(0x239)][_0x40685e(0x27d)]({'agentName':_0x5c72e1[_0x40685e(0x26f)][_0x40685e(0x22b)],'action':_0x40685e(0x1e2),'agentId':_0x2cee14['id'],'warnings':_0x2592d9[_0x40685e(0x1be)]>0x0?_0x2592d9:undefined}),_0x5a17ac['counts'][_0x40685e(0x239)][_0x40685e(0x1e2)]++;else{const _0x5867bf=await this['client'][_0x40685e(0x29e)](_0x850437);_0x3f8bce[_0x40685e(0x271)](_0x5c72e1[_0x40685e(0x26f)][_0x40685e(0x22b)],_0x5867bf['id']),_0x5a17ac[_0x40685e(0x239)][_0x40685e(0x27d)]({'agentName':_0x5c72e1[_0x40685e(0x26f)][_0x40685e(0x22b)],'action':_0x40685e(0x278),'agentId':_0x5867bf['id'],'warnings':_0x2592d9[_0x40685e(0x1be)]>0x0?_0x2592d9:undefined}),_0x5a17ac['counts'][_0x40685e(0x239)][_0x40685e(0x278)]++;}}catch(_0x422cac){_0x5a17ac[_0x40685e(0x239)][_0x40685e(0x27d)]({'agentName':_0x5c72e1['yaml'][_0x40685e(0x22b)],'action':'error','error':_0x422cac[_0x40685e(0x242)],'warnings':_0x2592d9['length']>0x0?_0x2592d9:undefined}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x239)][_0x40685e(0x1c4)]++;}}for(const _0x3ab066 of _0x37617a){try{const _0x18c13f=_0x516dc5[_0x40685e(0x1cb)](_0x3ab066['yaml'][_0x40685e(0x22b)]),_0x34f4a1=await yamlPromptToApi(_0x3ab066[_0x40685e(0x26f)],_0x4c37c4,_0xf46727);if(!_0x34f4a1){_0x5a17ac[_0x40685e(0x273)]['push']({'name':_0x3ab066['yaml'][_0x40685e(0x22b)],'action':_0x40685e(0x29c),'error':_0x40685e(0x299)}),_0x5a17ac[_0x40685e(0x28b)]['prompts'][_0x40685e(0x1c4)]++;continue;}if(_0x18c13f)await this[_0x40685e(0x28e)]['updatePrompt'](_0x18c13f['id'],_0x34f4a1),_0x1fc9d0[_0x40685e(0x271)](_0x3ab066[_0x40685e(0x26f)][_0x40685e(0x22b)],_0x18c13f['id']),_0x5a17ac['prompts']['push']({'name':_0x3ab066[_0x40685e(0x26f)][_0x40685e(0x22b)],'action':_0x40685e(0x1e2),'id':_0x18c13f['id']}),_0x5a17ac['counts']['prompts'][_0x40685e(0x1e2)]++;else{const _0x5ea49b=await this[_0x40685e(0x28e)][_0x40685e(0x1ea)](_0x34f4a1);_0x1fc9d0[_0x40685e(0x271)](_0x3ab066['yaml'][_0x40685e(0x22b)],_0x5ea49b['id']),_0x5a17ac[_0x40685e(0x273)][_0x40685e(0x27d)]({'name':_0x3ab066[_0x40685e(0x26f)][_0x40685e(0x22b)],'action':_0x40685e(0x278),'id':_0x5ea49b['id']}),_0x5a17ac['counts']['prompts'][_0x40685e(0x278)]++;}}catch(_0x67fbd6){_0x5a17ac[_0x40685e(0x273)][_0x40685e(0x27d)]({'name':_0x3ab066['yaml'][_0x40685e(0x22b)],'action':_0x40685e(0x29c),'error':_0x67fbd6[_0x40685e(0x242)]}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x273)][_0x40685e(0x1c4)]++;}}for(const _0x338100 of _0x37aa31){try{const _0x3dac5f=_0x4df2ec[_0x40685e(0x1cb)](_0x338100['yaml'][_0x40685e(0x247)]),_0x40d316=await yamlIntegrationToApi(_0x338100[_0x40685e(0x26f)],_0x4c37c4,_0xf46727);if(_0x3dac5f){await this[_0x40685e(0x28e)][_0x40685e(0x2bd)](_0x3dac5f['id']);const _0x560890=await this[_0x40685e(0x28e)][_0x40685e(0x290)](_0x40d316);_0x5a17ac[_0x40685e(0x267)][_0x40685e(0x27d)]({'name':_0x338100['yaml'][_0x40685e(0x247)],'action':_0x40685e(0x1e2),'id':_0x560890['id']}),_0x5a17ac['counts'][_0x40685e(0x267)][_0x40685e(0x1e2)]++;}else{const _0x2d40bf=await this[_0x40685e(0x28e)][_0x40685e(0x290)](_0x40d316);_0x5a17ac[_0x40685e(0x267)][_0x40685e(0x27d)]({'name':_0x338100['yaml'][_0x40685e(0x247)],'action':'created','id':_0x2d40bf['id']}),_0x5a17ac['counts'][_0x40685e(0x267)][_0x40685e(0x278)]++;}}catch(_0x16c279){_0x5a17ac[_0x40685e(0x267)][_0x40685e(0x27d)]({'name':_0x338100['yaml'][_0x40685e(0x247)],'action':'error','error':_0x16c279[_0x40685e(0x242)]}),_0x5a17ac['counts'][_0x40685e(0x267)][_0x40685e(0x1c4)]++;}}for(const _0x5859db of _0x111737){try{const _0x32052c=_0x36e3ab[_0x40685e(0x1cb)](_0x5859db[_0x40685e(0x26f)][_0x40685e(0x22b)]),_0x35be51=await yamlFormInterfaceToApi(_0x5859db[_0x40685e(0x26f)],_0x4c37c4,_0xf46727);if(!_0x35be51){_0x5a17ac[_0x40685e(0x1c1)][_0x40685e(0x27d)]({'name':_0x5859db['yaml'][_0x40685e(0x22b)],'action':_0x40685e(0x29c),'error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x1c1)][_0x40685e(0x1c4)]++;continue;}if(_0x32052c){const _0x34439b=await this['client'][_0x40685e(0x244)](_0x32052c['id'],_0x35be51);_0x5a17ac[_0x40685e(0x1c1)][_0x40685e(0x27d)]({'name':_0x5859db[_0x40685e(0x26f)]['name'],'action':'updated','id':_0x34439b['id']}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x1c1)][_0x40685e(0x1e2)]++;}else{const _0x35ec21=await this[_0x40685e(0x28e)][_0x40685e(0x26c)](_0x35be51);_0x5a17ac[_0x40685e(0x1c1)][_0x40685e(0x27d)]({'name':_0x5859db[_0x40685e(0x26f)][_0x40685e(0x22b)],'action':'created','id':_0x35ec21['id']}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x1c1)][_0x40685e(0x278)]++;}}catch(_0x3bacba){_0x5a17ac[_0x40685e(0x1c1)][_0x40685e(0x27d)]({'name':_0x5859db[_0x40685e(0x26f)][_0x40685e(0x22b)],'action':_0x40685e(0x29c),'error':_0x3bacba[_0x40685e(0x242)]}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x1c1)][_0x40685e(0x1c4)]++;}}for(const _0x1e96cf of _0x5daadc){try{const _0x4a6686=_0x5df94d['get'](_0x1e96cf['yaml']['name']),_0x567a94=await yamlChatInterfaceToApi(_0x1e96cf[_0x40685e(0x26f)],_0x4c37c4,_0xf46727);if(_0x4a6686){const _0x4f2d97=await this[_0x40685e(0x28e)]['updateChatInterface'](_0x4a6686['id'],_0x567a94);_0x5a17ac[_0x40685e(0x1d8)]['push']({'name':_0x1e96cf['yaml'][_0x40685e(0x22b)],'action':_0x40685e(0x1e2),'id':_0x4f2d97['id']}),_0x5a17ac['counts'][_0x40685e(0x1d8)][_0x40685e(0x1e2)]++;}else{const _0x53dd5c=await this[_0x40685e(0x28e)]['createChatInterface'](_0x567a94);_0x5a17ac[_0x40685e(0x1d8)][_0x40685e(0x27d)]({'name':_0x1e96cf[_0x40685e(0x26f)]['name'],'action':_0x40685e(0x278),'id':_0x53dd5c['id']}),_0x5a17ac[_0x40685e(0x28b)]['chatInterfaces']['created']++;}}catch(_0x4be9bf){_0x5a17ac[_0x40685e(0x1d8)]['push']({'name':_0x1e96cf[_0x40685e(0x26f)]['name'],'action':_0x40685e(0x29c),'error':_0x4be9bf['message']}),_0x5a17ac[_0x40685e(0x28b)][_0x40685e(0x1d8)][_0x40685e(0x1c4)]++;}}return _0x5a17ac;}async[a133_0x533a84(0x1c8)](_0x37c0fa,_0x160f58,_0x36f33e,_0x4b2f72){const _0x236bbe=a133_0x533a84,{projectId:_0x3ccaa0,project:_0x6f4ad8}=await this['resolveProjectName'](_0x37c0fa),_0x4d4a78=_0x6f4ad8['attributes'][_0x236bbe(0x22b)],_0x8e239e=await this['client'][_0x236bbe(0x1de)](_0x3ccaa0),_0x514cb8=_0x8e239e['find'](_0x360793=>_0x360793[_0x236bbe(0x1b7)][_0x236bbe(0x22b)]===_0x160f58);if(!_0x514cb8)throw new SDKError(ErrorCode[_0x236bbe(0x25b)],_0x236bbe(0x1ae)+_0x160f58,undefined,{'helpText':_0x236bbe(0x25e)+_0x8e239e[_0x236bbe(0x230)](_0x490488=>_0x490488[_0x236bbe(0x1b7)]['name'])[_0x236bbe(0x26b)](',\x20')});let _0x12ede9;if(_0x36f33e)_0x12ede9=_0x36f33e;else{const _0x14f540=a133_0x503bb8[_0x236bbe(0x26b)](process[_0x236bbe(0x257)](),_0x236bbe(0x239)),_0x3d385d=getSanitizedPathWithMigration(_0x14f540,_0x4d4a78);_0x3d385d[_0x236bbe(0x2c1)]&&this[_0x236bbe(0x1a8)]['info'](_0x236bbe(0x1f4)+a133_0x503bb8[_0x236bbe(0x1f6)](_0x3d385d['oldPath'])+_0x236bbe(0x1fb)+a133_0x503bb8['basename'](_0x3d385d['path'])),_0x12ede9=_0x3d385d[_0x236bbe(0x2b5)];}const _0x41eceb=getSanitizedPathWithMigration(_0x12ede9,_0x160f58);_0x41eceb[_0x236bbe(0x2c1)]&&this[_0x236bbe(0x1a8)]['info'](_0x236bbe(0x28d)+a133_0x503bb8[_0x236bbe(0x1f6)](_0x41eceb[_0x236bbe(0x203)])+'\x20→\x20'+a133_0x503bb8[_0x236bbe(0x1f6)](_0x41eceb['path']));const _0x42fc39=_0x41eceb[_0x236bbe(0x2b5)],_0x38d071=new Map(),_0x1a1937=new Map(),_0x515fcb=await this[_0x236bbe(0x28e)][_0x236bbe(0x2c6)](_0x3ccaa0),_0x2a6a70=await this[_0x236bbe(0x28e)]['listTextKnowledgeBases'](_0x3ccaa0),_0x590c23=await safeListOrEmpty(()=>this[_0x236bbe(0x28e)][_0x236bbe(0x220)](_0x3ccaa0)),_0x46ac28=new Map(),_0x326293=new Map();for(const _0x100601 of _0x515fcb){_0x38d071[_0x236bbe(0x271)](_0x100601['id'],_0x100601['attributes']['name']);}for(const _0x1c90e9 of _0x2a6a70){_0x46ac28[_0x236bbe(0x271)](_0x1c90e9['id'],_0x1c90e9['attributes'][_0x236bbe(0x22b)]);}for(const _0x3858fd of _0x590c23){_0x326293[_0x236bbe(0x271)](_0x3858fd['id'],_0x3858fd[_0x236bbe(0x1b7)]['name']);}for(const _0x46b525 of _0x8e239e){_0x1a1937[_0x236bbe(0x271)](_0x46b525['id'],_0x46b525[_0x236bbe(0x1b7)][_0x236bbe(0x22b)]);}const _0x3b6a9d={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x38d071,'TextKnowledgeBase':_0x46ac28,'Agent':_0x1a1937,'ExperimentalKnowledgeBase':_0x326293}),'resolvePromptName':async()=>undefined,'onWarning':_0x458407=>this['logger'][_0x236bbe(0x29b)](_0x458407)},_0x27932f=a133_0x503bb8[_0x236bbe(0x26b)](_0x42fc39,_0x236bbe(0x1eb)),_0x16ea62=a133_0x503bb8['join'](_0x42fc39,_0x236bbe(0x1ca)),_0x29483e=a133_0x503bb8[_0x236bbe(0x26b)](_0x42fc39,_0x236bbe(0x232)),_0x2d2039=!a133_0x11072e['existsSync'](_0x16ea62);if(_0x4b2f72?.['dryRun'])return{'agentName':_0x160f58,'outputPath':_0x42fc39,'isNew':_0x2d2039,'hasChanges':!![]};a133_0x11072e[_0x236bbe(0x249)](_0x12ede9,{'recursive':!![]}),a133_0x11072e[_0x236bbe(0x249)](_0x42fc39,{'recursive':!![]});const _0x1c7889=a133_0x503bb8[_0x236bbe(0x26b)](_0x12ede9,_0x236bbe(0x1e5));!a133_0x11072e[_0x236bbe(0x266)](_0x1c7889)&&a133_0x11072e[_0x236bbe(0x237)](_0x1c7889,createAgentConfigContent(_0x37c0fa));const {yaml:_0x4175be,systemPrompt:_0x2f0aac,starterMessage:_0x19b27a}=await agentResponseToDef(_0x514cb8,_0x3b6a9d);let _0x5fa6d6=_0x2d2039;if(!_0x2d2039){const _0x51164d=a133_0x11072e[_0x236bbe(0x266)](_0x27932f)?a133_0x11072e[_0x236bbe(0x233)](_0x27932f,_0x236bbe(0x27b)):'',_0x2dd353=a133_0x11072e[_0x236bbe(0x233)](_0x16ea62,'utf-8');_0x5fa6d6=_0x51164d!==_0x2f0aac||_0x2dd353!==toAgentYamlString(_0x4175be);}a133_0x11072e[_0x236bbe(0x237)](_0x27932f,_0x2f0aac),a133_0x11072e[_0x236bbe(0x237)](_0x16ea62,toAgentYamlString(_0x4175be));if(_0x19b27a&&_0x19b27a[_0x236bbe(0x1dc)]('\x0a'))a133_0x11072e[_0x236bbe(0x237)](_0x29483e,_0x19b27a);else a133_0x11072e[_0x236bbe(0x266)](_0x29483e)&&a133_0x11072e['unlinkSync'](_0x29483e);return{'agentName':_0x160f58,'outputPath':_0x42fc39,'isNew':_0x2d2039,'hasChanges':_0x5fa6d6};}async['pushAgent'](_0x5b03de,_0x3ea447){const _0x2e4b54=a133_0x533a84;let _0x1727e6;isAgentYamlPath(_0x5b03de)?_0x1727e6=getAgentDirFromYamlPath(_0x5b03de):_0x1727e6=_0x5b03de;const {config:_0x5c7b96}=findAgentConfig(_0x1727e6),_0x15208b=await this[_0x2e4b54(0x226)](_0x5c7b96[_0x2e4b54(0x26e)]),_0x1e1f46=a133_0x503bb8[_0x2e4b54(0x26b)](_0x1727e6,_0x2e4b54(0x1ca)),_0x788326=a133_0x503bb8[_0x2e4b54(0x26b)](_0x1727e6,_0x2e4b54(0x1eb)),_0x1d54fc=a133_0x503bb8[_0x2e4b54(0x26b)](_0x1727e6,_0x2e4b54(0x232));if(!a133_0x11072e[_0x2e4b54(0x266)](_0x1e1f46))throw new SDKError(ErrorCode[_0x2e4b54(0x252)],'agent.yml\x20not\x20found\x20in\x20'+_0x1727e6,undefined,{'helpText':_0x2e4b54(0x2a6)});const _0x40dca1=parseAgentYaml(a133_0x11072e[_0x2e4b54(0x233)](_0x1e1f46,_0x2e4b54(0x27b)),_0x1e1f46),_0x2bd558=a133_0x11072e[_0x2e4b54(0x266)](_0x788326)?a133_0x11072e[_0x2e4b54(0x233)](_0x788326,_0x2e4b54(0x27b)):'',_0x4c67d4=a133_0x11072e['existsSync'](_0x1d54fc)?a133_0x11072e['readFileSync'](_0x1d54fc,_0x2e4b54(0x27b)):_0x40dca1[_0x2e4b54(0x1ec)];if(_0x3ea447?.[_0x2e4b54(0x1ba)])return{'agentName':_0x40dca1['name'],'action':_0x2e4b54(0x278),'projectId':_0x15208b};const _0x57f908=await this[_0x2e4b54(0x28e)][_0x2e4b54(0x1de)](_0x15208b),_0x6da32b=await fetchAllToolTargetMaps((_0x12a6ac,_0xe80a47)=>this[_0x2e4b54(0x28e)][_0x2e4b54(0x1ad)](_0x12a6ac,_0xe80a47),_0x15208b),_0x55e42=new Map();for(const _0x221b89 of _0x57f908){_0x55e42[_0x2e4b54(0x271)](_0x221b89[_0x2e4b54(0x1b7)]['name'],_0x221b89['id']);}const _0x5976d3=[],_0x47e1b4={'projectId':_0x15208b,'resolveToolTargetId':buildIdResolver({..._0x6da32b[_0x2e4b54(0x1c6)],'Agent':_0x55e42}),'resolvePromptId':async()=>undefined,'onWarning':_0x5415eb=>{this['logger']['warn'](_0x5415eb),_0x5976d3['push'](_0x5415eb);}};try{const _0x1884f6=_0x57f908[_0x2e4b54(0x238)](_0x4d639e=>_0x4d639e[_0x2e4b54(0x1b7)][_0x2e4b54(0x22b)]===_0x40dca1[_0x2e4b54(0x22b)]),_0x2d8719=await agentDefToRequest(_0x40dca1,_0x2bd558,_0x4c67d4,_0x47e1b4);if(_0x1884f6)return await this[_0x2e4b54(0x28e)][_0x2e4b54(0x1dd)](_0x1884f6['id'],_0x2d8719),{'agentName':_0x40dca1[_0x2e4b54(0x22b)],'action':'updated','projectId':_0x15208b,'agentId':_0x1884f6['id'],'warnings':_0x5976d3[_0x2e4b54(0x1be)]>0x0?_0x5976d3:undefined};else{const _0x2819a5=await this[_0x2e4b54(0x28e)][_0x2e4b54(0x29e)](_0x2d8719);return{'agentName':_0x40dca1[_0x2e4b54(0x22b)],'action':_0x2e4b54(0x278),'projectId':_0x15208b,'agentId':_0x2819a5['id'],'warnings':_0x5976d3[_0x2e4b54(0x1be)]>0x0?_0x5976d3:undefined};}}catch(_0x4bd72e){return{'agentName':_0x40dca1[_0x2e4b54(0x22b)],'action':'error','projectId':_0x15208b,'error':_0x4bd72e[_0x2e4b54(0x242)],'warnings':_0x5976d3[_0x2e4b54(0x1be)]>0x0?_0x5976d3:undefined};}}async[a133_0x533a84(0x219)](_0xd7ea9b,_0x3dc57c,_0x36361f){const _0x29ae25=a133_0x533a84,_0x290702=a133_0x11072e['existsSync'](_0xd7ea9b)&&a133_0x11072e[_0x29ae25(0x266)](a133_0x503bb8[_0x29ae25(0x26b)](_0xd7ea9b,_0x29ae25(0x1e5)));let _0x1c5707;const _0x2abb8d=[],_0x2a8078=[],_0x599a43=[],_0x41c216=[],_0x1d8d14=[],_0x5438cd=[],_0x52ee14=[],_0x76b25d=[],_0x3326af=[];if(_0x290702){const _0x5ed1af=loadAgentConfig(a133_0x503bb8['join'](_0xd7ea9b,_0x29ae25(0x1e5)));_0x1c5707=_0x5ed1af['llm_project'];const _0x295d90=a133_0x11072e[_0x29ae25(0x2c3)](_0xd7ea9b,{'withFileTypes':!![]});for(const _0x445074 of _0x295d90){if(!_0x445074[_0x29ae25(0x1fa)]())continue;if([_0x29ae25(0x1f3),'experimental_knowledge_bases',_0x29ae25(0x261),_0x29ae25(0x273),_0x29ae25(0x267),_0x29ae25(0x1df),'chat_interfaces'][_0x29ae25(0x1dc)](_0x445074[_0x29ae25(0x22b)]))continue;const _0x1b9c69=a133_0x503bb8['join'](_0xd7ea9b,_0x445074[_0x29ae25(0x22b)]);if(isAgentDir(_0x1b9c69)){const _0x430a87=a133_0x503bb8['join'](_0x1b9c69,_0x29ae25(0x1ca)),_0x12aab8=a133_0x503bb8[_0x29ae25(0x26b)](_0x1b9c69,_0x29ae25(0x1eb)),_0x5e2f6b=a133_0x503bb8[_0x29ae25(0x26b)](_0x1b9c69,_0x29ae25(0x232)),_0x4c5dcd=parseAgentYaml(a133_0x11072e[_0x29ae25(0x233)](_0x430a87,_0x29ae25(0x27b)),_0x430a87),_0x7e6aa=a133_0x11072e[_0x29ae25(0x266)](_0x12aab8)?a133_0x11072e[_0x29ae25(0x233)](_0x12aab8,_0x29ae25(0x27b)):'',_0x5f0351=a133_0x11072e[_0x29ae25(0x266)](_0x5e2f6b)?a133_0x11072e[_0x29ae25(0x233)](_0x5e2f6b,_0x29ae25(0x27b)):_0x4c5dcd['starter_message'];_0x2abb8d[_0x29ae25(0x27d)]({'name':_0x4c5dcd[_0x29ae25(0x22b)],'dir':_0x1b9c69,'yaml':_0x4c5dcd,'systemPrompt':_0x7e6aa,'starterMessage':_0x5f0351});}}const _0x1f7b08=getKnowledgeBasesDir(_0xd7ea9b);if(a133_0x11072e[_0x29ae25(0x266)](_0x1f7b08)){const _0x22a21e=a133_0x11072e[_0x29ae25(0x2c3)](_0x1f7b08);for(const _0x2179e5 of _0x22a21e){const _0x59f1fa=a133_0x503bb8[_0x29ae25(0x26b)](_0x1f7b08,_0x2179e5);if(_0x2179e5['endsWith'](_0x29ae25(0x283))){const _0x2de2c2=parseKnowledgeBaseYaml(a133_0x11072e[_0x29ae25(0x233)](_0x59f1fa,_0x29ae25(0x27b)),_0x59f1fa);_0x2a8078[_0x29ae25(0x27d)]({'name':_0x2de2c2[_0x29ae25(0x22b)],'path':_0x59f1fa,'yaml':_0x2de2c2});}else{if(_0x2179e5[_0x29ae25(0x1e3)](_0x29ae25(0x1f9))){const _0x4395f7=a133_0x11072e[_0x29ae25(0x233)](_0x59f1fa,'utf-8'),{name:_0x3a3fed,text:_0x2fbbd4}=parseTextKnowledgeBaseMd(_0x4395f7,_0x2179e5);_0x599a43[_0x29ae25(0x27d)]({'name':_0x3a3fed,'path':_0x59f1fa,'text':_0x2fbbd4});}}}}const _0x37a506=getPromptsDir(_0xd7ea9b);if(a133_0x11072e[_0x29ae25(0x266)](_0x37a506)){const _0x16687c=a133_0x11072e[_0x29ae25(0x2c3)](_0x37a506)[_0x29ae25(0x213)](_0x50af41=>_0x50af41[_0x29ae25(0x1e3)](_0x29ae25(0x283)));for(const _0x5a1cf3 of _0x16687c){const _0x15c8e0=a133_0x503bb8['join'](_0x37a506,_0x5a1cf3),_0x1260da=parsePromptYaml(a133_0x11072e[_0x29ae25(0x233)](_0x15c8e0,_0x29ae25(0x27b)),_0x15c8e0);_0x41c216[_0x29ae25(0x27d)]({'name':_0x1260da[_0x29ae25(0x22b)],'path':_0x15c8e0,'yaml':_0x1260da});}}const _0x13aa3f=getIntegrationsDir(_0xd7ea9b);if(a133_0x11072e[_0x29ae25(0x266)](_0x13aa3f)){const _0x4a4a7f=a133_0x11072e[_0x29ae25(0x2c3)](_0x13aa3f)[_0x29ae25(0x213)](_0x2c98b2=>_0x2c98b2[_0x29ae25(0x1e3)](_0x29ae25(0x283)));for(const _0x24dd63 of _0x4a4a7f){const _0x33085f=a133_0x503bb8[_0x29ae25(0x26b)](_0x13aa3f,_0x24dd63),_0x1568f1=parseIntegrationYaml(a133_0x11072e['readFileSync'](_0x33085f,'utf-8'),_0x33085f);SAFE_INTEGRATION_TYPES[_0x29ae25(0x1dc)](_0x1568f1[_0x29ae25(0x247)][_0x29ae25(0x1cc)]())?_0x1d8d14[_0x29ae25(0x27d)]({'name':_0x1568f1[_0x29ae25(0x22b)],'path':_0x33085f,'yaml':_0x1568f1}):this[_0x29ae25(0x1a8)]['warn'](_0x29ae25(0x1ce)+_0x1568f1[_0x29ae25(0x22b)]+'\x27\x20('+_0x1568f1[_0x29ae25(0x247)]+_0x29ae25(0x22a)+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES['join'](',\x20')+')\x20can\x20be\x20cloned.'));}}const _0x2beab6=getExperimentalKnowledgeBasesDir(_0xd7ea9b);if(a133_0x11072e[_0x29ae25(0x266)](_0x2beab6)){const _0x4f7e70=a133_0x11072e[_0x29ae25(0x2c3)](_0x2beab6,{'withFileTypes':!![]});for(const _0x5ad13c of _0x4f7e70){if(!_0x5ad13c[_0x29ae25(0x1fa)]())continue;const _0x2a36f6=a133_0x503bb8[_0x29ae25(0x26b)](_0x2beab6,_0x5ad13c[_0x29ae25(0x22b)]),_0x33620d=a133_0x503bb8['join'](_0x2a36f6,_0x5ad13c[_0x29ae25(0x22b)]+_0x29ae25(0x283));if(a133_0x11072e[_0x29ae25(0x266)](_0x33620d)){const _0x20e4d3=parseExperimentalKnowledgeBaseYaml(a133_0x11072e[_0x29ae25(0x233)](_0x33620d,'utf-8'),_0x33620d),_0x3c1d9b=a133_0x503bb8[_0x29ae25(0x26b)](_0x2a36f6,_0x29ae25(0x251)),_0x1cb284=[];if(a133_0x11072e[_0x29ae25(0x266)](_0x3c1d9b)){const _0x4a4d4b=a133_0x11072e[_0x29ae25(0x2c3)](_0x3c1d9b,{'withFileTypes':!![]});for(const _0x488244 of _0x4a4d4b){if(!_0x488244[_0x29ae25(0x1fa)]())continue;const _0x55bb55=a133_0x503bb8[_0x29ae25(0x26b)](_0x3c1d9b,_0x488244[_0x29ae25(0x22b)]),_0x1d4f02=a133_0x503bb8[_0x29ae25(0x26b)](_0x55bb55,'code.js'),_0x5381df=a133_0x503bb8[_0x29ae25(0x26b)](_0x55bb55,'json_schema.json');if(a133_0x11072e[_0x29ae25(0x266)](_0x1d4f02)&&a133_0x11072e[_0x29ae25(0x266)](_0x5381df)){const _0x54ba61=a133_0x11072e[_0x29ae25(0x233)](_0x1d4f02,_0x29ae25(0x27b)),_0xd73128=a133_0x11072e[_0x29ae25(0x233)](_0x5381df,'utf-8');_0x1cb284[_0x29ae25(0x27d)]({'name':_0x488244[_0x29ae25(0x22b)],'code':_0x54ba61,'json_schema':_0xd73128});}}}const _0x5d4b03={..._0x20e4d3,'functions':_0x1cb284};_0x5438cd[_0x29ae25(0x27d)]({'name':_0x20e4d3[_0x29ae25(0x22b)],'path':_0x2a36f6,'def':_0x5d4b03});}}}const _0x19e9e7=getExperimentalArtifactsDir(_0xd7ea9b);if(a133_0x11072e['existsSync'](_0x19e9e7)){const _0x41e4c5=a133_0x11072e[_0x29ae25(0x2c3)](_0x19e9e7,{'withFileTypes':!![]});for(const _0x19af0f of _0x41e4c5){if(!_0x19af0f[_0x29ae25(0x1fa)]())continue;const _0x579f35=a133_0x503bb8['join'](_0x19e9e7,_0x19af0f[_0x29ae25(0x22b)]),_0x3a9338=a133_0x503bb8[_0x29ae25(0x26b)](_0x579f35,_0x19af0f[_0x29ae25(0x22b)]+_0x29ae25(0x283));if(a133_0x11072e[_0x29ae25(0x266)](_0x3a9338)){const _0x2b0157=parseExperimentalArtifactYaml(a133_0x11072e[_0x29ae25(0x233)](_0x3a9338,_0x29ae25(0x27b)),_0x3a9338),_0xcf307a=a133_0x503bb8[_0x29ae25(0x26b)](_0x579f35,_0x29ae25(0x1d0)),_0x163a65=a133_0x11072e['existsSync'](_0xcf307a)?a133_0x11072e[_0x29ae25(0x233)](_0xcf307a,_0x29ae25(0x27b)):'',_0x4e36ee=a133_0x503bb8['join'](_0x579f35,'files'),_0x1dae2e=[];if(a133_0x11072e['existsSync'](_0x4e36ee)){const _0x3930ca=a133_0x11072e[_0x29ae25(0x2c3)](_0x4e36ee);for(const _0xbe481 of _0x3930ca){const _0x4881c7=a133_0x503bb8['join'](_0x4e36ee,_0xbe481);if(a133_0x11072e['statSync'](_0x4881c7)[_0x29ae25(0x288)]()){const _0x291225=a133_0x11072e[_0x29ae25(0x233)](_0x4881c7,_0x29ae25(0x27b));_0x1dae2e['push']({'file_name':_0xbe481,'text_content':_0x291225});}}}const _0xaa6787={..._0x2b0157,'code':_0x163a65,'files':_0x1dae2e};_0x52ee14[_0x29ae25(0x27d)]({'name':_0x2b0157[_0x29ae25(0x22b)],'path':_0x579f35,'def':_0xaa6787});}}}const _0x115ea4=getFormInterfacesDir(_0xd7ea9b);if(a133_0x11072e[_0x29ae25(0x266)](_0x115ea4)){const _0x1cd1ed=a133_0x11072e[_0x29ae25(0x2c3)](_0x115ea4)[_0x29ae25(0x213)](_0x3b3aae=>_0x3b3aae[_0x29ae25(0x1e3)](_0x29ae25(0x283)));for(const _0x6fbc31 of _0x1cd1ed){const _0x47bd07=a133_0x503bb8[_0x29ae25(0x26b)](_0x115ea4,_0x6fbc31),_0xf9be76=parseFormInterfaceYaml(a133_0x11072e[_0x29ae25(0x233)](_0x47bd07,_0x29ae25(0x27b)),_0x47bd07);_0x76b25d[_0x29ae25(0x27d)]({'name':_0xf9be76[_0x29ae25(0x22b)],'path':_0x47bd07,'yaml':_0xf9be76});}}const _0x2a2097=getChatInterfacesDir(_0xd7ea9b);if(a133_0x11072e[_0x29ae25(0x266)](_0x2a2097)){const _0x3d217c=a133_0x11072e[_0x29ae25(0x2c3)](_0x2a2097)['filter'](_0x2ecd29=>_0x2ecd29[_0x29ae25(0x1e3)](_0x29ae25(0x283)));for(const _0xfb1467 of _0x3d217c){const _0x1974ef=a133_0x503bb8[_0x29ae25(0x26b)](_0x2a2097,_0xfb1467),_0x4f69a9=parseChatInterfaceYaml(a133_0x11072e[_0x29ae25(0x233)](_0x1974ef,_0x29ae25(0x27b)),_0x1974ef);_0x3326af['push']({'name':_0x4f69a9[_0x29ae25(0x22b)],'path':_0x1974ef,'yaml':_0x4f69a9});}}}else{const _0x28b24a=await this[_0x29ae25(0x226)](_0xd7ea9b),_0x29e17d=await this['client'][_0x29ae25(0x2af)](_0x28b24a);_0x1c5707=_0x29e17d[_0x29ae25(0x1b7)][_0x29ae25(0x22b)];const _0xe3dce2=await this[_0x29ae25(0x28e)]['listAgentsFull'](_0x28b24a),_0x2ff8a3=await this[_0x29ae25(0x28e)][_0x29ae25(0x2c6)](_0x28b24a),_0xe7a32c=await this[_0x29ae25(0x28e)][_0x29ae25(0x1b9)](_0x28b24a),_0x12c1b9=await this[_0x29ae25(0x28e)][_0x29ae25(0x282)](_0x28b24a),_0x5a433=await this['client']['listIntegrations'](_0x28b24a),_0x15daa2=await safeListOrEmpty(()=>this['client']['listExperimentalKnowledgeBases'](_0x28b24a)),_0x2af5a5=await safeListOrEmpty(()=>this[_0x29ae25(0x28e)][_0x29ae25(0x1a4)](_0x28b24a)),_0x239f97=new Map(),_0xfa4037=new Map(),_0x286b13=new Map(),_0x4fe43f=new Map(),_0x31ea0d=new Map(),_0x1d71e2=new Map();for(const _0x28c343 of _0x2ff8a3){_0x239f97[_0x29ae25(0x271)](_0x28c343['id'],_0x28c343[_0x29ae25(0x1b7)][_0x29ae25(0x22b)]);}for(const _0x17470c of _0xe7a32c){_0xfa4037[_0x29ae25(0x271)](_0x17470c['id'],_0x17470c[_0x29ae25(0x1b7)]['name']);}for(const _0xc56789 of _0xe3dce2){_0x286b13[_0x29ae25(0x271)](_0xc56789['id'],_0xc56789[_0x29ae25(0x1b7)][_0x29ae25(0x22b)]);}for(const _0x28dccf of _0x12c1b9){_0x4fe43f[_0x29ae25(0x271)](_0x28dccf['id'],_0x28dccf['attributes']['name']);}for(const _0xd6bd9d of _0x15daa2){_0x31ea0d['set'](_0xd6bd9d['id'],_0xd6bd9d[_0x29ae25(0x1b7)]['name']);}for(const _0x9ece58 of _0x2af5a5){_0x1d71e2[_0x29ae25(0x271)](_0x9ece58['id'],_0x9ece58[_0x29ae25(0x1b7)][_0x29ae25(0x22b)]);}const _0x18c259={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x239f97,'TextKnowledgeBase':_0xfa4037,'Agent':_0x286b13,'ExperimentalKnowledgeBase':_0x31ea0d}),'resolvePromptName':async _0x1a18a9=>_0x4fe43f[_0x29ae25(0x1cb)](_0x1a18a9),'onWarning':_0x19c99f=>this[_0x29ae25(0x1a8)][_0x29ae25(0x29b)](_0x19c99f)};for(const _0x4ba143 of _0xe3dce2){const _0x42d976=await agentResponseToDef(_0x4ba143,_0x18c259),{yaml:_0x3959f7,systemPrompt:_0x43e3c5,starterMessage:_0x29332f}=_0x42d976;_0x2abb8d[_0x29ae25(0x27d)]({'name':_0x3959f7['name'],'dir':'','yaml':_0x3959f7,'systemPrompt':_0x43e3c5,'starterMessage':_0x29332f});}for(const _0x5c4aff of _0x2ff8a3){const _0x5a7275=apiKnowledgeBaseToYaml(_0x5c4aff);_0x2a8078[_0x29ae25(0x27d)]({'name':_0x5a7275['name'],'path':'','yaml':_0x5a7275});}for(const _0x4bf3f9 of _0xe7a32c){_0x599a43['push']({'name':_0x4bf3f9[_0x29ae25(0x1b7)][_0x29ae25(0x22b)],'path':'','text':_0x4bf3f9[_0x29ae25(0x1b7)]['text']});}for(const _0x37bf1d of _0x12c1b9){const _0x1f6829=await apiPromptToYaml(_0x37bf1d,_0x18c259);_0x1f6829&&_0x41c216[_0x29ae25(0x27d)]({'name':_0x1f6829[_0x29ae25(0x22b)],'path':'','yaml':_0x1f6829});}for(const _0x284670 of _0x5a433){if(!_0x284670[_0x29ae25(0x1b7)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x29ae25(0x1dc)](_0x284670[_0x29ae25(0x1b7)][_0x29ae25(0x1b6)][_0x29ae25(0x1cc)]())){const _0x1c6695=await apiIntegrationToYaml(_0x284670,_0x18c259);_0x1d8d14[_0x29ae25(0x27d)]({'name':_0x284670['attributes'][_0x29ae25(0x1b6)][_0x29ae25(0x1cc)](),'path':'','yaml':_0x1c6695});}}for(const _0x5d67dc of _0x15daa2){const _0x6beba0=apiExperimentalKnowledgeBaseToYaml(_0x5d67dc);_0x5438cd[_0x29ae25(0x27d)]({'name':_0x6beba0['name'],'path':'','def':_0x6beba0});}for(const _0x3803a6 of _0x2af5a5){const _0x2e7f3e=apiExperimentalArtifactToYaml(_0x3803a6);_0x52ee14[_0x29ae25(0x27d)]({'name':_0x2e7f3e['name'],'path':'','def':_0x2e7f3e});}const _0x15406f=await safeListOrEmpty(()=>this[_0x29ae25(0x28e)][_0x29ae25(0x29d)](_0x28b24a));for(const _0x5a8d56 of _0x15406f){const _0x1a4f21=await apiFormInterfaceToYaml(_0x5a8d56,_0x18c259);_0x76b25d[_0x29ae25(0x27d)]({'name':_0x1a4f21[_0x29ae25(0x22b)],'path':'','yaml':_0x1a4f21});}const _0x3a8023=await safeListOrEmpty(()=>this[_0x29ae25(0x28e)][_0x29ae25(0x1e4)](_0x28b24a));for(const _0x399f26 of _0x3a8023){if(_0x399f26[_0x29ae25(0x1b7)][_0x29ae25(0x22c)])continue;const _0x65275f=await apiChatInterfaceToYaml(_0x399f26,_0x18c259);_0x3326af[_0x29ae25(0x27d)]({'name':_0x65275f['name'],'path':'','yaml':_0x65275f});}}const _0x181270={'sourceProjectName':_0x1c5707,'newProjectName':_0x3dc57c,'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}}},_0x1de57f=await this['client'][_0x29ae25(0x25d)](),_0x255e37=_0x1de57f[_0x29ae25(0x238)](_0x55de25=>_0x55de25[_0x29ae25(0x1b7)][_0x29ae25(0x22b)]===_0x3dc57c);if(_0x255e37)throw new SDKError(ErrorCode[_0x29ae25(0x2c4)],_0x29ae25(0x27a)+_0x3dc57c+_0x29ae25(0x221),undefined,{'helpText':_0x29ae25(0x1c3)});if(_0x36361f?.['dryRun'])return _0x181270[_0x29ae25(0x28b)][_0x29ae25(0x239)][_0x29ae25(0x278)]=_0x2abb8d['length'],_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x209)][_0x29ae25(0x278)]=_0x2a8078[_0x29ae25(0x1be)],_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x292)][_0x29ae25(0x278)]=_0x599a43[_0x29ae25(0x1be)],_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x20b)][_0x29ae25(0x278)]=_0x5438cd[_0x29ae25(0x1be)],_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x2be)][_0x29ae25(0x278)]=_0x52ee14['length'],_0x181270['counts'][_0x29ae25(0x273)]['created']=_0x41c216[_0x29ae25(0x1be)],_0x181270[_0x29ae25(0x28b)]['integrations'][_0x29ae25(0x278)]=_0x1d8d14[_0x29ae25(0x1be)],_0x181270;const _0xfc4006=await this[_0x29ae25(0x28e)][_0x29ae25(0x1a9)]({'name':_0x3dc57c}),_0x1a73f2=_0xfc4006['id'];_0x181270[_0x29ae25(0x1bd)]=_0x1a73f2;const _0x46704d=new Map(),_0x4302ff=new Map(),_0x137608=new Map(),_0x4eb40c=new Map(),_0x1da168=new Map(),_0x2ecd70=new Map(),_0x53bc57=new Map(),_0xc7e20d=new Map(),_0x3add23=new Set(),_0x1538ff=new Set();for(const _0x5c3606 of _0x2abb8d){for(const _0x205f12 of _0x5c3606[_0x29ae25(0x26f)][_0x29ae25(0x2b2)]||[]){if(_0x205f12[_0x29ae25(0x23e)]===_0x29ae25(0x250)&&_0x205f12[_0x29ae25(0x280)]){const _0x396ccf=parseRef(_0x205f12[_0x29ae25(0x280)]);if(_0x396ccf)_0x3add23[_0x29ae25(0x207)](_0x396ccf[_0x29ae25(0x22b)]);}else{if(_0x205f12[_0x29ae25(0x23e)]==='web_search'&&_0x205f12[_0x29ae25(0x280)]){const _0x10895f=parseRef(_0x205f12[_0x29ae25(0x280)]);if(_0x10895f)_0x1538ff[_0x29ae25(0x207)](_0x10895f[_0x29ae25(0x22b)]);}}}}for(const _0x5f10ce of _0x3add23){try{const _0x50dcc7=await this['client'][_0x29ae25(0x1d7)]({'projectId':_0x1a73f2,'name':_0x5f10ce});_0x1da168[_0x29ae25(0x271)](_0x5f10ce,_0x50dcc7['id']),_0x181270[_0x29ae25(0x287)]['push']({'name':_0x5f10ce,'action':_0x29ae25(0x278),'id':_0x50dcc7['id']}),_0x181270['counts'][_0x29ae25(0x287)][_0x29ae25(0x278)]++;}catch(_0xc9f0ab){_0x181270['imageGenerators']['push']({'name':_0x5f10ce,'action':_0x29ae25(0x29c),'error':_0xc9f0ab[_0x29ae25(0x242)]}),_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x287)][_0x29ae25(0x1c4)]++;}}for(const _0x2391f1 of _0x1538ff){try{const _0x2d4a26=await this['client'][_0x29ae25(0x248)]({'projectId':_0x1a73f2,'name':_0x2391f1});_0x2ecd70[_0x29ae25(0x271)](_0x2391f1,_0x2d4a26['id']),_0x181270[_0x29ae25(0x20f)][_0x29ae25(0x27d)]({'name':_0x2391f1,'action':'created','id':_0x2d4a26['id']}),_0x181270[_0x29ae25(0x28b)]['webSearchTools'][_0x29ae25(0x278)]++;}catch(_0x4d533a){_0x181270[_0x29ae25(0x20f)][_0x29ae25(0x27d)]({'name':_0x2391f1,'action':_0x29ae25(0x29c),'error':_0x4d533a[_0x29ae25(0x242)]}),_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x20f)][_0x29ae25(0x1c4)]++;}}const _0x5f440d=await fetchAllToolTargetMaps((_0x210d6c,_0x45f39c)=>this[_0x29ae25(0x28e)][_0x29ae25(0x1ad)](_0x210d6c,_0x45f39c),_0x1a73f2);let _0x2f7b0c=[];const _0x53f6ee={'projectId':_0x1a73f2,'resolveToolTargetId':buildIdResolver({..._0x5f440d[_0x29ae25(0x1c6)],'KnowledgeBase':_0x46704d,'TextKnowledgeBase':_0x4302ff,'ExperimentalKnowledgeBase':_0x53bc57,'Agent':_0x137608,'WebSearchTool':_0x2ecd70,'ImageGenerator':_0x1da168}),'resolvePromptId':async _0x269e4e=>_0x4eb40c[_0x29ae25(0x1cb)](_0x269e4e),'onWarning':_0x65d100=>{const _0x4a9287=_0x29ae25;this[_0x4a9287(0x1a8)]['warn'](_0x65d100),_0x2f7b0c[_0x4a9287(0x27d)](_0x65d100);}};for(const _0x3494fb of _0x2a8078){try{const _0x2bd649=yamlKnowledgeBaseToApi(_0x3494fb[_0x29ae25(0x26f)],_0x1a73f2),_0x2c43af=await this['client'][_0x29ae25(0x2bc)](_0x2bd649);_0x46704d[_0x29ae25(0x271)](_0x3494fb[_0x29ae25(0x26f)][_0x29ae25(0x22b)],_0x2c43af['id']),_0x181270[_0x29ae25(0x209)][_0x29ae25(0x27d)]({'name':_0x3494fb['yaml'][_0x29ae25(0x22b)],'action':_0x29ae25(0x278),'id':_0x2c43af['id']}),_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x209)][_0x29ae25(0x278)]++;}catch(_0x1554a3){_0x181270[_0x29ae25(0x209)][_0x29ae25(0x27d)]({'name':_0x3494fb[_0x29ae25(0x26f)][_0x29ae25(0x22b)],'action':_0x29ae25(0x29c),'error':_0x1554a3['message']}),_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x209)][_0x29ae25(0x1c4)]++;}}for(const _0x4d3544 of _0x599a43){try{const _0xb33c90=yamlTextKnowledgeBaseToApi({'name':_0x4d3544[_0x29ae25(0x22b)],'text':_0x4d3544['text']},_0x1a73f2),_0x491044=await this[_0x29ae25(0x28e)][_0x29ae25(0x2a0)](_0xb33c90);_0x4302ff[_0x29ae25(0x271)](_0x4d3544['name'],_0x491044['id']),_0x181270[_0x29ae25(0x292)][_0x29ae25(0x27d)]({'name':_0x4d3544[_0x29ae25(0x22b)],'action':_0x29ae25(0x278),'id':_0x491044['id']}),_0x181270['counts'][_0x29ae25(0x292)][_0x29ae25(0x278)]++;}catch(_0x3b6457){_0x181270[_0x29ae25(0x292)]['push']({'name':_0x4d3544[_0x29ae25(0x22b)],'action':'error','error':_0x3b6457[_0x29ae25(0x242)]}),_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x292)][_0x29ae25(0x1c4)]++;}}for(const _0x2faa20 of _0x52ee14){try{const _0x160d9b=yamlExperimentalArtifactToApi(_0x2faa20[_0x29ae25(0x1e6)],_0x1a73f2),_0x3bdd29=await this['client'][_0x29ae25(0x296)](_0x160d9b);_0xc7e20d[_0x29ae25(0x271)](_0x2faa20['def'][_0x29ae25(0x22b)],_0x3bdd29['id']),_0x181270['experimentalArtifacts'][_0x29ae25(0x27d)]({'name':_0x2faa20[_0x29ae25(0x1e6)]['name'],'action':_0x29ae25(0x278),'id':_0x3bdd29['id']}),_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x2be)]['created']++;}catch(_0x4f243f){_0x181270['experimentalArtifacts'][_0x29ae25(0x27d)]({'name':_0x2faa20[_0x29ae25(0x1e6)][_0x29ae25(0x22b)],'action':_0x29ae25(0x29c),'error':_0x4f243f[_0x29ae25(0x242)]}),_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x2be)]['errors']++;}}for(const _0x4e4e15 of _0x5438cd){try{const _0x3fd9dc=yamlExperimentalKnowledgeBaseToApi(_0x4e4e15[_0x29ae25(0x1e6)],_0x1a73f2),_0x364c59=await this[_0x29ae25(0x28e)][_0x29ae25(0x28a)](_0x3fd9dc);_0x53bc57[_0x29ae25(0x271)](_0x4e4e15[_0x29ae25(0x1e6)][_0x29ae25(0x22b)],_0x364c59['id']),_0x181270[_0x29ae25(0x20b)][_0x29ae25(0x27d)]({'name':_0x4e4e15[_0x29ae25(0x1e6)][_0x29ae25(0x22b)],'action':'created','id':_0x364c59['id']}),_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x20b)][_0x29ae25(0x278)]++;}catch(_0x5a1408){_0x181270[_0x29ae25(0x20b)]['push']({'name':_0x4e4e15[_0x29ae25(0x1e6)][_0x29ae25(0x22b)],'action':_0x29ae25(0x29c),'error':_0x5a1408[_0x29ae25(0x242)]}),_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x20b)][_0x29ae25(0x1c4)]++;}}const _0x32661c=[..._0x2abb8d][_0x29ae25(0x2aa)]((_0x1ba839,_0x18b11c)=>{const _0x324b19=_0x29ae25,_0xd55e5f=_0x1ba839[_0x324b19(0x26f)]['tools']?.[_0x324b19(0x222)](_0x307be0=>_0x307be0[_0x324b19(0x23e)]==='agent')??![],_0x32beb6=_0x18b11c[_0x324b19(0x26f)][_0x324b19(0x2b2)]?.['some'](_0x307f59=>_0x307f59[_0x324b19(0x23e)]===_0x324b19(0x24e))??![];if(_0xd55e5f&&!_0x32beb6)return 0x1;if(!_0xd55e5f&&_0x32beb6)return-0x1;return 0x0;});for(const _0x36ab27 of _0x32661c){_0x2f7b0c=[];try{const _0x4ea9c7=_0x36ab27[_0x29ae25(0x26f)][_0x29ae25(0x2b2)]?.[_0x29ae25(0x213)](_0x50f503=>{const _0x1b0e5f=_0x29ae25;if(_0x50f503['type']===_0x1b0e5f(0x24e)&&_0x50f503[_0x1b0e5f(0x280)]){const _0x537ba4=parseRef(_0x50f503[_0x1b0e5f(0x280)]);return _0x537ba4?.['name']===_0x36ab27['yaml'][_0x1b0e5f(0x22b)];}return![];})??[];if(_0x4ea9c7[_0x29ae25(0x1be)]>0x0){const _0x11fe5c=_0x29ae25(0x21f)+_0x36ab27['yaml'][_0x29ae25(0x22b)]+'\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20'+_0x29ae25(0x264);this[_0x29ae25(0x1a8)][_0x29ae25(0x29b)](_0x11fe5c),_0x2f7b0c[_0x29ae25(0x27d)](_0x11fe5c);}const _0x127c11=await agentDefToRequest(_0x36ab27[_0x29ae25(0x26f)],_0x36ab27['systemPrompt'],_0x36ab27[_0x29ae25(0x265)],_0x53f6ee),_0x485116=await this[_0x29ae25(0x28e)][_0x29ae25(0x29e)](_0x127c11);_0x137608[_0x29ae25(0x271)](_0x36ab27['yaml'][_0x29ae25(0x22b)],_0x485116['id']),_0x181270[_0x29ae25(0x239)][_0x29ae25(0x27d)]({'agentName':_0x36ab27[_0x29ae25(0x26f)]['name'],'action':_0x29ae25(0x278),'agentId':_0x485116['id'],'warnings':_0x2f7b0c[_0x29ae25(0x1be)]>0x0?_0x2f7b0c:undefined}),_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x239)][_0x29ae25(0x278)]++;}catch(_0x27e67f){_0x181270['agents'][_0x29ae25(0x27d)]({'agentName':_0x36ab27[_0x29ae25(0x26f)][_0x29ae25(0x22b)],'action':_0x29ae25(0x29c),'error':_0x27e67f[_0x29ae25(0x242)],'warnings':_0x2f7b0c[_0x29ae25(0x1be)]>0x0?_0x2f7b0c:undefined}),_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x239)][_0x29ae25(0x1c4)]++;}}for(const _0x9986be of _0x41c216){try{const _0x29b57f=await yamlPromptToApi(_0x9986be[_0x29ae25(0x26f)],_0x1a73f2,_0x53f6ee);if(!_0x29b57f){_0x181270[_0x29ae25(0x273)][_0x29ae25(0x27d)]({'name':_0x9986be['yaml'][_0x29ae25(0x22b)],'action':'error','error':_0x29ae25(0x299)}),_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x273)][_0x29ae25(0x1c4)]++;continue;}const _0x33887b=await this[_0x29ae25(0x28e)][_0x29ae25(0x1ea)](_0x29b57f);_0x4eb40c['set'](_0x9986be[_0x29ae25(0x26f)][_0x29ae25(0x22b)],_0x33887b['id']),_0x181270['prompts']['push']({'name':_0x9986be[_0x29ae25(0x26f)][_0x29ae25(0x22b)],'action':_0x29ae25(0x278),'id':_0x33887b['id']}),_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x273)]['created']++;}catch(_0x125514){_0x181270[_0x29ae25(0x273)]['push']({'name':_0x9986be['yaml'][_0x29ae25(0x22b)],'action':_0x29ae25(0x29c),'error':_0x125514[_0x29ae25(0x242)]}),_0x181270['counts']['prompts']['errors']++;}}for(const _0x4937f1 of _0x1d8d14){try{const _0x2b70ec=await yamlIntegrationToApi(_0x4937f1[_0x29ae25(0x26f)],_0x1a73f2,_0x53f6ee),_0x2c8030=await this[_0x29ae25(0x28e)][_0x29ae25(0x290)](_0x2b70ec);_0x181270[_0x29ae25(0x267)][_0x29ae25(0x27d)]({'name':_0x4937f1[_0x29ae25(0x26f)]['service_type'],'action':'created','id':_0x2c8030['id']}),_0x181270['counts']['integrations']['created']++;}catch(_0x28eb30){_0x181270[_0x29ae25(0x267)][_0x29ae25(0x27d)]({'name':_0x4937f1[_0x29ae25(0x26f)][_0x29ae25(0x247)],'action':'error','error':_0x28eb30[_0x29ae25(0x242)]}),_0x181270[_0x29ae25(0x28b)]['integrations'][_0x29ae25(0x1c4)]++;}}for(const _0x1f55f2 of _0x76b25d){try{const _0x43ae40=await yamlFormInterfaceToApi(_0x1f55f2[_0x29ae25(0x26f)],_0x1a73f2,_0x53f6ee);if(!_0x43ae40){_0x181270[_0x29ae25(0x1c1)]['push']({'name':_0x1f55f2['yaml']['name'],'action':_0x29ae25(0x29c),'error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x181270[_0x29ae25(0x28b)]['formInterfaces'][_0x29ae25(0x1c4)]++;continue;}const _0x3cb989=await this[_0x29ae25(0x28e)][_0x29ae25(0x26c)](_0x43ae40);_0x181270[_0x29ae25(0x1c1)]['push']({'name':_0x1f55f2[_0x29ae25(0x26f)][_0x29ae25(0x22b)],'action':_0x29ae25(0x278),'id':_0x3cb989['id']}),_0x181270['counts']['formInterfaces']['created']++;}catch(_0xf2bd9c){_0x181270[_0x29ae25(0x1c1)][_0x29ae25(0x27d)]({'name':_0x1f55f2[_0x29ae25(0x26f)][_0x29ae25(0x22b)],'action':_0x29ae25(0x29c),'error':_0xf2bd9c[_0x29ae25(0x242)]}),_0x181270[_0x29ae25(0x28b)]['formInterfaces'][_0x29ae25(0x1c4)]++;}}for(const _0x2ea767 of _0x3326af){try{const _0x34f274=await yamlChatInterfaceToApi(_0x2ea767[_0x29ae25(0x26f)],_0x1a73f2,_0x53f6ee),_0xcd5acb=await this[_0x29ae25(0x28e)][_0x29ae25(0x200)](_0x34f274);_0x181270[_0x29ae25(0x1d8)][_0x29ae25(0x27d)]({'name':_0x2ea767[_0x29ae25(0x26f)][_0x29ae25(0x22b)],'action':_0x29ae25(0x278),'id':_0xcd5acb['id']}),_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x1d8)][_0x29ae25(0x278)]++;}catch(_0x1afe2b){_0x181270[_0x29ae25(0x1d8)]['push']({'name':_0x2ea767[_0x29ae25(0x26f)][_0x29ae25(0x22b)],'action':_0x29ae25(0x29c),'error':_0x1afe2b[_0x29ae25(0x242)]}),_0x181270[_0x29ae25(0x28b)][_0x29ae25(0x1d8)][_0x29ae25(0x1c4)]++;}}return _0x181270;}}
|
|
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;}}
|