@treasuredata/tdx 2026.4.22 → 2026.4.23
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/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.d.ts +7 -0
- package/dist/proxy/passthrough-server.d.ts.map +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/passthrough-server.js.map +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/task-graph.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 +1 -1
package/dist/sdk/llm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a133_0xe8af3=a133_0x209e;(function(_0x1a4351,_0x12afba){const _0x565c81=a133_0x209e,_0x54de5e=_0x1a4351();while(!![]){try{const _0x58add2=parseInt(_0x565c81(0x182))/0x1+-parseInt(_0x565c81(0x1c6))/0x2+parseInt(_0x565c81(0x13c))/0x3*(-parseInt(_0x565c81(0x215))/0x4)+parseInt(_0x565c81(0x20d))/0x5*(parseInt(_0x565c81(0x232))/0x6)+parseInt(_0x565c81(0x15c))/0x7*(-parseInt(_0x565c81(0x179))/0x8)+parseInt(_0x565c81(0x256))/0x9+-parseInt(_0x565c81(0x17c))/0xa*(-parseInt(_0x565c81(0x1bc))/0xb);if(_0x58add2===_0x12afba)break;else _0x54de5e['push'](_0x54de5e['shift']());}catch(_0x3dec16){_0x54de5e['push'](_0x54de5e['shift']());}}}(a133_0x5894,0xdfa55));import{LLMApiClient}from'../client/llm-api-client.js';import*as a133_0x8c5550 from'node:fs';import*as a133_0xcf5d58 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';function a133_0x5894(){const _0x3fe49f=['file_name','basename','TextKnowledgeBase','No\x20tdx.json\x20found\x20in\x20','getOrCreateDefaultAgent','createImageGenerator','variables','listChats','maxToolIterations','getBackupMetadata','files','getDefaultProjectName','yaml','getProject','prompt.md','Project\x20\x22','renamed','listAgentsFull','promptId','push','none','Project\x20not\x20found:\x20','statSync','site','web_search','\x0a\x0a#\x20agent.yml\x0a','deleteIntegration','Output\x20directory\x20already\x20exists:\x20','\x20→\x20','mkdirSync','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','join','agents','resolveAgentId','(dry-run)','total','createAgentResponse','projects','info','readdirSync','clearDefaultAgent','some','INTERNAL','createKnowledgeBase','createWebSearchTool','availableModels','localeCompare','new','Multiple\x20agents\x20found\x20with\x20name\x20\x27','.llm','integrations.json','already\x20exists','.md','restoreProject','starter_message.md','createAgent','unchanged','updateAgent','metadata','duplicate','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','has','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','\x22\x20already\x20exists','counts','text_content','knowledgebases.json','code.js','Renamed\x20agent\x20folder:\x20','continueChat','75025SeyQhf','json_schema','createExperimentalKnowledgeBase','tdx_default_','Multiple\x20projects\x20found\x20with\x20name\x20\x27','length','chat_agent_console','\x20in\x20project\x20','101624GRTHNG','medium','experimentalKnowledgeBases','.yml','createTextKnowledgeBase','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','Backup\x20folder\x20not\x20found:\x20','sdk.llm','service_type','listPrompts','knowledge_bases','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','webSearchTools','attributes','listChatInterfaces','tdx_','code','action','\x27\x20(','add','existsSync','loadJsonFile','def','createFormInterface','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','INVALID_ARGUMENT','writeFileSync','updateKnowledgeBase','toISOString','654RboODf','agentsFull','dryRun','createProject','prompts','updateAgentResponse','history','listTextKnowledgeBases','sort','type','deleteProject','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.','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','nameToId','parse','minimal','imageGenerators','tdx.json','Removed\x20deleted\x20directory:\x20','\x0a---\x20code\x20---\x0a','getOrCreateDefaultProject','chatInterfaces','text','get','Invalid\x20agent\x20reference\x20format:\x20','listToolTargets','isDirectory','dirname','keys','actions','message','oldPath','knowledgeBases','getAgent','serviceType','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','3733731EEmNKa','chatId','pullProject','profile','integrations','createIntegration','created','path','agent','_reasoning_','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','low','207URnrwL','createChatInterface','LLM_PROJECT_NOT_FOUND','pullAgent','cloneProject','chat_generic','listFormInterfaces','availableModelNames','getChatLog','json_schema.json','filter','\x0a---\x20schema:\x20','prompts.json','NOT_FOUND','setCurrentProject','warn','Skipping\x20integration\x20\x27','size','resolveProjectName',')\x20can\x20be\x20cloned.','map','---\x20file:\x20','rmSync','toLowerCase','currentProjectId','project.json','errors','logger','agents.json','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','ALREADY_EXISTS','starter_message','3175809IhLOKY','cwd','stringify','chat','dry-run-','chats','setDefaultAgent','project','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','Renamed\x20chat\x20interface\x20file:\x20','isFile','getUserSettings','Removed\x20deleted\x20file:\x20','Renamed\x20experimental\x20artifact\x20directory:\x20','includes','---\x20schema:\x20','\x0a---\x20function:\x20','AGENT_NOT_FOUND','deleteAgent','systemPrompt','template','error','exportedFrom','isDir','form_interfaces','experimental_artifacts','Only\x20safe\x20types\x20(','agent.yml\x20not\x20found\x20in\x20','formInterfaces','24EoutwO','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','split','310ZAozbe','agentId','createPrompt','slackMessageMode','event','llm_project','721999ldnRAU','listKnowledgeBases','Renamed\x20prompt\x20file:\x20','Agent\x20not\x20found:\x20','Unsupported\x20backup\x20version:\x20','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','tools','utf-8','client','isManaged',')\x20can\x20be\x20pushed.\x20','#\x20prompt.md\x0a','ExperimentalKnowledgeBase','idToName','version','listAgents','chatIgnoreManagedActions','updateExperimentalArtifact','pushProject','outputs','experimental_knowledge_bases','context','agent.yml','set','dir','listImageGenerators','signal','Renamed\x20form\x20interface\x20file:\x20','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','models','listExperimentalKnowledgeBases','chat_interfaces','find','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','UNAUTHENTICATED','Agent\x20reference\x20not\x20found','createExperimentalArtifact','listProjects','Could\x20not\x20resolve\x20agent\x20reference','textKnowledgeBases','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','content','status','):\x20','starterMessage','displayName','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','readFileSync','\x27.\x20This\x20should\x20not\x20happen.','experimentalArtifacts','description','\x20---\x0a','startChat','target','functions','endsWith','listIntegrations','chat_parent_segment','650353QpoIdu','chatInfo','updated','backupProject','tdDatabaseName','unlinkSync','Agent\x20\x27','name','image_gen','resolveProjectId','1150176kdcTuj'];a133_0x5894=function(){return _0x3fe49f;};return a133_0x5894();}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_0xe8af3(0x141),a133_0xe8af3(0x213),a133_0xe8af3(0x1bb)];async function safeListOrEmpty(_0x5cef04){const _0x5f2691=a133_0xe8af3;try{return await _0x5cef04();}catch(_0xcd11b5){if(_0xcd11b5 instanceof HTTPClientError&&_0xcd11b5[_0x5f2691(0x1ac)]===0x194)return[];throw _0xcd11b5;}}function a133_0x209e(_0x433423,_0x45c153){_0x433423=_0x433423-0x139;const _0x5894cb=a133_0x5894();let _0x209e6e=_0x5894cb[_0x433423];return _0x209e6e;}export class LLMSDK{[a133_0xe8af3(0x154)];[a133_0xe8af3(0x18a)];[a133_0xe8af3(0x197)];[a133_0xe8af3(0x157)]=Logger['of'](a133_0xe8af3(0x21c));constructor(_0x261808){const _0x168863=a133_0xe8af3;this['client']=new LLMApiClient(_0x261808),this[_0x168863(0x197)]=_0x261808;}[a133_0xe8af3(0x1d2)](){const _0x5a46ef=a133_0xe8af3,_0x18dcf7=getSanitizedUsername();return _0x5a46ef(0x210)+_0x18dcf7;}async[a133_0xe8af3(0x14a)](_0x5bf612){const _0x374360=a133_0xe8af3,{projectId:_0x5e7076}=await this[_0x374360(0x14e)](_0x5bf612);this[_0x374360(0x154)]=_0x5e7076;}['getCurrentProject'](){const _0x3d89df=a133_0xe8af3;return this[_0x3d89df(0x154)];}async[a133_0xe8af3(0x162)](_0x4caf73){const _0x3c4ae7=a133_0xe8af3,_0x55fda2=this[_0x3c4ae7(0x197)]['profile'];let _0x405122,_0x451fe6;if(_0x4caf73['includes']('/')){const _0x39aa43=_0x4caf73[_0x3c4ae7(0x17b)]('/');if(_0x39aa43[_0x3c4ae7(0x212)]!==0x2)throw new SDKError(ErrorCode[_0x3c4ae7(0x22e)],_0x3c4ae7(0x24a)+_0x4caf73,undefined,{'helpText':_0x3c4ae7(0x205)});const [_0x1e0f9e,_0xb92849]=_0x39aa43;_0x405122=await this[_0x3c4ae7(0x1c5)](_0x1e0f9e),_0x451fe6=_0xb92849;}else _0x405122=this[_0x3c4ae7(0x154)]||(await this[_0x3c4ae7(0x246)]())['id'],_0x451fe6=_0x4caf73;const _0x59714b=await this[_0x3c4ae7(0x1e8)](_0x451fe6,_0x405122),_0x1fc718=await this[_0x3c4ae7(0x18a)][_0x3c4ae7(0x253)](_0x59714b);writeCachedLLMAgent(_0x1fc718[_0x3c4ae7(0x222)][_0x3c4ae7(0x1c3)],_0x59714b,_0x405122,_0x55fda2);}['getDefaultAgent'](){const _0x15baac=a133_0xe8af3,_0x332341=this[_0x15baac(0x197)]['profile'];return readCachedLLMAgent(_0x332341)||undefined;}[a133_0xe8af3(0x1ef)](){const _0x7c9e85=a133_0xe8af3,_0x1a01fb=this[_0x7c9e85(0x197)]['profile'];clearCachedLLMAgent(_0x1a01fb);}async[a133_0xe8af3(0x19f)](){const _0x4c9851=a133_0xe8af3,_0x359638=await this[_0x4c9851(0x18a)][_0x4c9851(0x167)](),_0x377b73=[];for(const _0x33f485 of _0x359638[_0x4c9851(0x143)]){const _0x18fb77=_0x359638[_0x4c9851(0x1f4)][_0x33f485];_0x18fb77&&_0x377b73['push']({'name':_0x33f485,'displayName':_0x18fb77[_0x4c9851(0x1af)]});}return _0x377b73;}async[a133_0xe8af3(0x235)](_0x4269ad){const _0x207671=a133_0xe8af3;return await this['client'][_0x207671(0x235)](_0x4269ad);}async[a133_0xe8af3(0x23c)](_0x459b32){const _0x59151f=a133_0xe8af3,{projectId:_0x15a8ac}=await this[_0x59151f(0x14e)](_0x459b32);await this[_0x59151f(0x18a)][_0x59151f(0x23c)](_0x15a8ac);}async[a133_0xe8af3(0x1ec)](_0x7ae99d=0x32){const _0x3b41ce=a133_0xe8af3;return await this[_0x3b41ce(0x18a)][_0x3b41ce(0x1a7)](_0x7ae99d);}async[a133_0xe8af3(0x246)](_0x2c0364){const _0x412a63=a133_0xe8af3,_0x42f742=_0x2c0364||this[_0x412a63(0x1d2)](),_0x3177fa=this[_0x412a63(0x197)][_0x412a63(0x259)];if(!_0x2c0364){const _0x52c0b4=readCachedLLMProject(_0x3177fa);if(_0x52c0b4&&_0x52c0b4[_0x412a63(0x1c3)]===_0x42f742)try{const _0x3f3b57=await this[_0x412a63(0x18a)]['getProject'](_0x52c0b4['id']);if(_0x3f3b57[_0x412a63(0x222)]['name']===_0x42f742)return _0x3f3b57;}catch{}}const _0x2bfa49=await this['client'][_0x412a63(0x1a7)](),_0xa30987=_0x2bfa49[_0x412a63(0x1a2)](_0xd267b3=>_0xd267b3[_0x412a63(0x222)][_0x412a63(0x1c3)]===_0x42f742);if(_0xa30987)return!_0x2c0364&&writeCachedLLMProject(_0x42f742,_0xa30987['id'],_0x3177fa),_0xa30987;const _0x5bedfb=await this[_0x412a63(0x18a)][_0x412a63(0x235)]({'name':_0x42f742,'description':_0x412a63(0x1aa)+getSanitizedUsername()+')'});return!_0x2c0364&&writeCachedLLMProject(_0x42f742,_0x5bedfb['id'],_0x3177fa),_0x5bedfb;}async[a133_0xe8af3(0x1c5)](_0x7c39e4){const _0x17b015=a133_0xe8af3,_0x213b74=await this['client'][_0x17b015(0x1a7)](),_0x48f911=_0x213b74['filter'](_0x305acb=>_0x305acb['attributes'][_0x17b015(0x1c3)]===_0x7c39e4);if(_0x48f911[_0x17b015(0x212)]===0x0)throw new SDKError(ErrorCode[_0x17b015(0x13e)],_0x17b015(0x1dc)+_0x7c39e4,undefined,{'helpText':_0x17b015(0x203)});if(_0x48f911['length']>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x17b015(0x211)+_0x7c39e4+_0x17b015(0x1b2));return _0x48f911[0x0]['id'];}async['resolveProjectName'](_0x4142c9){const _0x547f81=a133_0xe8af3,_0x1ef30d=await this[_0x547f81(0x18a)][_0x547f81(0x1a7)](),_0x5169c6=_0x1ef30d[_0x547f81(0x1a2)](_0x264091=>_0x264091[_0x547f81(0x222)][_0x547f81(0x1c3)]===_0x4142c9);if(_0x5169c6)return{'projectId':_0x5169c6['id'],'project':_0x5169c6};throw new SDKError(ErrorCode[_0x547f81(0x13e)],_0x547f81(0x1dc)+_0x4142c9,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async[a133_0xe8af3(0x1cb)](_0x5eb7c7='claude-4.5-sonnet',_0x230f2b=0x0,_0x46832d){const _0x5528aa=a133_0xe8af3,_0x3fa0d3=0xa;let _0x60d5d5=0x0,_0x240c4d;while(_0x60d5d5<_0x3fa0d3){try{const _0x1629cc=await this['getOrCreateDefaultProject'](_0x240c4d),_0x467451=_0x1629cc['id'],_0x3315dc=[_0x5528aa(0x1db),_0x5528aa(0x241),_0x5528aa(0x13b),_0x5528aa(0x216),'high'],_0x38a6d0=_0x230f2b===0x0?_0x5528aa(0x224)+_0x5eb7c7:_0x5528aa(0x224)+_0x5eb7c7+_0x5528aa(0x139)+_0x3315dc[_0x230f2b],_0x3fc813=await this['client'][_0x5528aa(0x191)](_0x467451),_0x1f6584=_0x3fc813[_0x5528aa(0x1a2)](_0x268594=>_0x268594['attributes'][_0x5528aa(0x1c3)]===_0x38a6d0);if(_0x1f6584)return _0x1f6584;const _0x9ed5a9=_0x230f2b>0x0?0x1:_0x46832d;return await this[_0x5528aa(0x18a)][_0x5528aa(0x1fe)]({'name':_0x38a6d0,'projectId':_0x467451,'modelType':_0x5eb7c7,'systemPrompt':'','temperature':_0x9ed5a9,'reasoningEffort':_0x230f2b>0x0?_0x230f2b:undefined});}catch(_0x2d7ed3){if(_0x2d7ed3 instanceof HTTPClientError){const _0x22b175=_0x2d7ed3[_0x5528aa(0x1ac)];if(_0x22b175>=0x190&&_0x22b175<0x1f4){if(_0x22b175===0x191)throw new SDKError(ErrorCode[_0x5528aa(0x1a4)],'Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.',_0x2d7ed3);else{if(_0x22b175===0x193)throw new SDKError(ErrorCode['PERMISSION_DENIED'],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x2d7ed3);}throw _0x2d7ed3;}}if(errorContains(_0x2d7ed3,_0x5528aa(0x1fa),_0x5528aa(0x202),'conflict')){_0x60d5d5++;if(_0x60d5d5>=_0x3fa0d3)throw new SDKError(ErrorCode[_0x5528aa(0x15a)],'Unable\x20to\x20create\x20project\x20after\x20'+_0x3fa0d3+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x2d7ed3);const _0xe2a22d=this[_0x5528aa(0x1d2)]();_0x240c4d=_0xe2a22d+'_'+generateRandomHex();continue;}throw _0x2d7ed3;}}throw new SDKError(ErrorCode[_0x5528aa(0x1f1)],_0x5528aa(0x220));}async['resolveAgentId'](_0x3df2d8,_0x43d0f8){const _0x2bc73b=a133_0xe8af3,_0x17ea65=_0x43d0f8||this[_0x2bc73b(0x154)],_0xc270c3=await this[_0x2bc73b(0x18a)][_0x2bc73b(0x191)](_0x17ea65),_0xfc4f9=_0xc270c3[_0x2bc73b(0x146)](_0x2fd6bf=>_0x2fd6bf[_0x2bc73b(0x222)][_0x2bc73b(0x1c3)]===_0x3df2d8);if(_0xfc4f9[_0x2bc73b(0x212)]===0x0){const _0x35ebe8=_0x17ea65?_0x2bc73b(0x214)+_0x17ea65:'';throw new SDKError(ErrorCode[_0x2bc73b(0x16d)],'Agent\x20not\x20found:\x20'+_0x3df2d8+_0x35ebe8,undefined,{'helpText':_0x17ea65?_0x2bc73b(0x23e):_0x2bc73b(0x23d)});}if(_0xfc4f9[_0x2bc73b(0x212)]>0x1)throw new SDKError(ErrorCode[_0x2bc73b(0x1f1)],_0x2bc73b(0x1f7)+_0x3df2d8+_0x2bc73b(0x1b2));return _0xfc4f9[0x0]['id'];}async[a133_0xe8af3(0x1e7)](_0x430f9e){const _0x464acd=a133_0xe8af3,_0x1080d7=_0x430f9e||this[_0x464acd(0x154)];return await this[_0x464acd(0x18a)][_0x464acd(0x191)](_0x1080d7);}async[a133_0xe8af3(0x233)](_0x409b0c){const _0x2ba5d2=a133_0xe8af3;return await this[_0x2ba5d2(0x18a)][_0x2ba5d2(0x1d8)](_0x409b0c);}async['agent'](_0xad62b0){const _0x81dcfe=a133_0xe8af3;return await this[_0x81dcfe(0x18a)][_0x81dcfe(0x253)](_0xad62b0);}async[a133_0xe8af3(0x1fe)](_0x287702){const _0x13c812=a133_0xe8af3;return await this[_0x13c812(0x18a)][_0x13c812(0x1fe)](_0x287702);}async[a133_0xe8af3(0x200)](_0x53d616,_0x3cd11d){const _0x13e4ca=a133_0xe8af3;return await this[_0x13e4ca(0x18a)][_0x13e4ca(0x200)](_0x53d616,_0x3cd11d);}async['deleteAgent'](_0x6a739){const _0x47576a=a133_0xe8af3;await this['client'][_0x47576a(0x16e)](_0x6a739);}async[a133_0xe8af3(0x1b6)](_0x1a6e36){const _0x228924=a133_0xe8af3;return await this['client'][_0x228924(0x1b6)]({'agentId':_0x1a6e36});}async*[a133_0xe8af3(0x15f)](_0x2f1b35,_0xfcbc41){const _0x126f54=a133_0xe8af3;let _0x4c179b=_0xfcbc41?.[_0x126f54(0x257)];const _0x16e765=_0xfcbc41?.['agentId'];if(!_0x4c179b){if(!_0x16e765)throw new Error(_0x126f54(0x187));const _0x5830b5=await this[_0x126f54(0x18a)][_0x126f54(0x1b6)]({'agentId':_0x16e765});_0x4c179b=_0x5830b5['id'],yield{'type':_0x126f54(0x201),'data':{'chatId':_0x4c179b,'agentId':_0x16e765,'projectId':_0x5830b5[_0x126f54(0x222)]['projectId']}};}for await(const _0x347eb3 of this['client'][_0x126f54(0x20c)](_0x4c179b,_0x2f1b35,_0xfcbc41?.[_0x126f54(0x19c)])){yield{'type':_0x126f54(0x180),'data':_0x347eb3};}}async[a133_0xe8af3(0x161)](_0x9b7490=0x32){const _0x15100e=a133_0xe8af3;return await this[_0x15100e(0x18a)][_0x15100e(0x1ce)](_0x9b7490);}async[a133_0xe8af3(0x238)](_0x11aea4){const _0x5d6d85=a133_0xe8af3;return await this[_0x5d6d85(0x18a)]['getChatHistory'](_0x11aea4);}async[a133_0xe8af3(0x144)](_0x14a384){const _0x4cab3a=a133_0xe8af3;return await this[_0x4cab3a(0x18a)]['getChatLog'](_0x14a384);}async[a133_0xe8af3(0x1bd)](_0x1ff2b2){const _0x24977c=a133_0xe8af3;return await this[_0x24977c(0x18a)]['getChatInfo'](_0x1ff2b2);}async[a133_0xe8af3(0x1bf)](_0x1ff354,_0x535f15,_0x5c34d5){const _0x2f9ec3=a133_0xe8af3,_0x53ebab=_0x5c34d5?.[_0x2f9ec3(0x234)]??![],{projectId:_0x57ea87,project:_0x5096aa}=await this[_0x2f9ec3(0x14e)](_0x1ff354),_0x77e078=_0x5096aa['attributes'][_0x2f9ec3(0x1c3)],_0x439a43=_0x535f15||_0x77e078+_0x2f9ec3(0x1f8);if(a133_0x8c5550[_0x2f9ec3(0x229)](_0x439a43)&&!_0x53ebab)throw new SDKError(ErrorCode[_0x2f9ec3(0x15a)],_0x2f9ec3(0x1e2)+_0x439a43,undefined,{'helpText':_0x2f9ec3(0x17a)});const _0x1b0de8=await this['client'][_0x2f9ec3(0x1d8)](_0x57ea87),_0x30f314=await this['client'][_0x2f9ec3(0x183)](_0x57ea87),_0x2cc619=await this[_0x2f9ec3(0x18a)][_0x2f9ec3(0x21e)](_0x57ea87),_0x487b68=await this[_0x2f9ec3(0x18a)][_0x2f9ec3(0x1ba)](_0x57ea87);if(!_0x53ebab){a133_0x8c5550[_0x2f9ec3(0x1e4)](_0x439a43,{'recursive':!![]});const _0x5dcbc3={'version':'1.0','exportedAt':new Date()[_0x2f9ec3(0x231)](),'exportedFrom':{'site':this[_0x2f9ec3(0x197)]['site'],'projectId':_0x57ea87,'projectName':_0x77e078},'project':_0x5096aa};a133_0x8c5550[_0x2f9ec3(0x22f)](a133_0xcf5d58[_0x2f9ec3(0x1e6)](_0x439a43,_0x2f9ec3(0x155)),JSON[_0x2f9ec3(0x15e)](_0x5dcbc3,null,0x2)),a133_0x8c5550[_0x2f9ec3(0x22f)](a133_0xcf5d58['join'](_0x439a43,_0x2f9ec3(0x158)),JSON[_0x2f9ec3(0x15e)](_0x1b0de8,null,0x2)),a133_0x8c5550['writeFileSync'](a133_0xcf5d58[_0x2f9ec3(0x1e6)](_0x439a43,_0x2f9ec3(0x209)),JSON['stringify'](_0x30f314,null,0x2)),a133_0x8c5550['writeFileSync'](a133_0xcf5d58[_0x2f9ec3(0x1e6)](_0x439a43,_0x2f9ec3(0x148)),JSON[_0x2f9ec3(0x15e)](_0x2cc619,null,0x2)),a133_0x8c5550[_0x2f9ec3(0x22f)](a133_0xcf5d58[_0x2f9ec3(0x1e6)](_0x439a43,_0x2f9ec3(0x1f9)),JSON[_0x2f9ec3(0x15e)](_0x487b68,null,0x2));}return{'projectName':_0x77e078,'outputDir':_0x439a43,'counts':{'agents':_0x1b0de8[_0x2f9ec3(0x212)],'knowledgeBases':_0x30f314[_0x2f9ec3(0x212)],'prompts':_0x2cc619[_0x2f9ec3(0x212)],'integrations':_0x487b68[_0x2f9ec3(0x212)]}};}async[a133_0xe8af3(0x1fc)](_0x466508,_0x293051){const _0x417a58=a133_0xe8af3,_0x47c50d=_0x293051?.['dryRun']??![],_0x92acfb=this[_0x417a58(0x1d0)](_0x466508),_0x5aeda8=_0x92acfb[_0x417a58(0x172)][_0x417a58(0x1de)],_0x6af44a=this[_0x417a58(0x197)][_0x417a58(0x1de)],_0x4aaf23=_0x5aeda8!==_0x6af44a?_0x5aeda8:undefined,_0x5ec7b0=this[_0x417a58(0x22a)](a133_0xcf5d58[_0x417a58(0x1e6)](_0x466508,_0x417a58(0x158)),[]),_0x3db85f=this[_0x417a58(0x22a)](a133_0xcf5d58[_0x417a58(0x1e6)](_0x466508,_0x417a58(0x209)),[]),_0x35daa6=this[_0x417a58(0x22a)](a133_0xcf5d58['join'](_0x466508,_0x417a58(0x148)),[]),_0x3740b3=this[_0x417a58(0x22a)](a133_0xcf5d58[_0x417a58(0x1e6)](_0x466508,_0x417a58(0x1f9)),[]),_0x23910a=_0x293051?.[_0x417a58(0x1c3)]||_0x92acfb[_0x417a58(0x172)]['projectName'];if(_0x47c50d){const _0x5aefd7=new Map(),_0x340a5f=[..._0x5ec7b0],_0x3824e0=_0x5ec7b0['length']+0x1;let _0x196162=0x0;while(_0x340a5f[_0x417a58(0x212)]>0x0&&_0x196162<_0x3824e0){_0x196162++;const _0x4410af=[];for(const _0x13ae48 of _0x340a5f){canCreateAgent(_0x13ae48,_0x5aefd7)?_0x5aefd7['set'](_0x13ae48['id'],_0x417a58(0x160)+_0x13ae48['id']):_0x4410af[_0x417a58(0x1da)](_0x13ae48);}if(_0x4410af[_0x417a58(0x212)]===_0x340a5f[_0x417a58(0x212)])throw new SDKError(ErrorCode[_0x417a58(0x1f1)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x417a58(0x164)});_0x340a5f['length']=0x0,_0x340a5f[_0x417a58(0x1da)](..._0x4410af);}const _0x3be5da=_0x35daa6[_0x417a58(0x146)](_0x2c1964=>_0x5aefd7[_0x417a58(0x204)](_0x2c1964[_0x417a58(0x222)]['agentId']))['length'];return{'projectName':_0x23910a,'projectId':_0x417a58(0x1e9),'counts':{'agents':_0x5ec7b0['length'],'knowledgeBases':_0x3db85f['length'],'prompts':_0x3be5da,'integrations':_0x3740b3['length']},'sourceSite':_0x4aaf23};}const _0x22c18c=await this['client'][_0x417a58(0x235)]({'name':_0x23910a,'description':_0x92acfb[_0x417a58(0x163)]['attributes'][_0x417a58(0x1b4)]}),_0x29216b=_0x22c18c['id'],_0x8a2302=new Map(),_0x3dbf45=new Map(),_0x51a192=new Map();for(const _0x370a58 of _0x3db85f){const _0x5c6f86=await this[_0x417a58(0x18a)][_0x417a58(0x1f2)]({'projectId':_0x29216b,'name':_0x370a58[_0x417a58(0x222)][_0x417a58(0x1c3)],'tdDatabaseName':_0x370a58['attributes'][_0x417a58(0x1c0)],'tables':_0x370a58[_0x417a58(0x222)]['tables']});_0x8a2302['set'](_0x370a58['id'],_0x5c6f86['id']);}const _0x2dec0e=[..._0x5ec7b0],_0x5aaf50=_0x5ec7b0['length']+0x1;let _0x1136eb=0x0;while(_0x2dec0e['length']>0x0&&_0x1136eb<_0x5aaf50){_0x1136eb++;const _0x119ba3=[];for(const _0x46800d of _0x2dec0e){if(canCreateAgent(_0x46800d,_0x3dbf45)){const _0x3cbe0c=remapToolIds(_0x46800d[_0x417a58(0x222)][_0x417a58(0x188)],_0x8a2302,_0x3dbf45),_0x55f0f3=remapVariableIds(_0x46800d[_0x417a58(0x222)]['variables'],_0x8a2302),_0x5b2675=await this[_0x417a58(0x18a)][_0x417a58(0x1eb)]({'name':_0x46800d[_0x417a58(0x222)][_0x417a58(0x1c3)],'projectId':_0x29216b,'systemPrompt':_0x46800d[_0x417a58(0x222)][_0x417a58(0x16f)],'starterMessage':_0x46800d[_0x417a58(0x222)][_0x417a58(0x1ae)],'modelType':migrateModelType(_0x46800d[_0x417a58(0x222)]['modelType']),'maxToolIterations':_0x46800d[_0x417a58(0x222)][_0x417a58(0x1cf)],'temperature':_0x46800d[_0x417a58(0x222)]['temperature'],'reasoningEffort':_0x46800d[_0x417a58(0x222)]['reasoningEffort'],'outputs':_0x46800d[_0x417a58(0x222)][_0x417a58(0x195)],'tools':_0x3cbe0c,'variables':_0x55f0f3});_0x3dbf45[_0x417a58(0x199)](_0x46800d['id'],_0x5b2675['id']);}else _0x119ba3[_0x417a58(0x1da)](_0x46800d);}if(_0x119ba3[_0x417a58(0x212)]===_0x2dec0e['length'])throw new SDKError(ErrorCode[_0x417a58(0x1f1)],_0x417a58(0x1b0),undefined,{'helpText':_0x417a58(0x164)});_0x2dec0e['length']=0x0,_0x2dec0e[_0x417a58(0x1da)](..._0x119ba3);}for(const _0x2db6db of _0x35daa6){const _0x2eefb4=_0x3dbf45[_0x417a58(0x249)](_0x2db6db[_0x417a58(0x222)][_0x417a58(0x17d)]);if(!_0x2eefb4)continue;const _0x2a490f=await this[_0x417a58(0x18a)][_0x417a58(0x17e)]({'projectId':_0x29216b,'agentId':_0x2eefb4,'name':_0x2db6db[_0x417a58(0x222)][_0x417a58(0x1c3)],'systemPrompt':_0x2db6db[_0x417a58(0x222)][_0x417a58(0x16f)],'template':_0x2db6db[_0x417a58(0x222)][_0x417a58(0x170)],'jsonSchemaHint':_0x2db6db['attributes']['jsonSchemaHint']});_0x51a192[_0x417a58(0x199)](_0x2db6db['id'],_0x2a490f['id']);}for(const _0x3b09a8 of _0x3740b3){const _0x403399=_0x3b09a8[_0x417a58(0x222)][_0x417a58(0x24f)][_0x417a58(0x150)](_0x20f488=>({..._0x20f488,'promptId':_0x51a192['get'](_0x20f488['promptId'])||_0x20f488[_0x417a58(0x1d9)]}));await this['client'][_0x417a58(0x25b)]({'projectId':_0x29216b,'serviceType':_0x3b09a8[_0x417a58(0x222)][_0x417a58(0x254)],'actions':_0x403399,'slackMessageMode':_0x3b09a8['attributes'][_0x417a58(0x17f)],'chatIgnoreManagedActions':_0x3b09a8[_0x417a58(0x222)][_0x417a58(0x192)],'chatWelcomeMessage':_0x3b09a8[_0x417a58(0x222)]['chatWelcomeMessage'],'webhookCorsOrigins':_0x3b09a8['attributes']['webhookCorsOrigins']});}return{'projectName':_0x23910a,'projectId':_0x29216b,'counts':{'agents':_0x3dbf45[_0x417a58(0x14d)],'knowledgeBases':_0x8a2302[_0x417a58(0x14d)],'prompts':_0x51a192['size'],'integrations':_0x3740b3[_0x417a58(0x212)]},'sourceSite':_0x4aaf23};}['loadJsonFile'](_0x1225e0,_0x4d8348){const _0x8fcaf=a133_0xe8af3;if(!a133_0x8c5550[_0x8fcaf(0x229)](_0x1225e0))return _0x4d8348;return JSON['parse'](a133_0x8c5550['readFileSync'](_0x1225e0,_0x8fcaf(0x189)));}[a133_0xe8af3(0x1d0)](_0x2efd2f){const _0x3945d8=a133_0xe8af3;if(!a133_0x8c5550[_0x3945d8(0x229)](_0x2efd2f))throw new SDKError(ErrorCode[_0x3945d8(0x149)],_0x3945d8(0x21b)+_0x2efd2f,undefined,{'helpText':_0x3945d8(0x159)});const _0x38a5fa=a133_0xcf5d58[_0x3945d8(0x1e6)](_0x2efd2f,_0x3945d8(0x155));if(!a133_0x8c5550[_0x3945d8(0x229)](_0x38a5fa))throw new SDKError(ErrorCode[_0x3945d8(0x22e)],'Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20'+_0x2efd2f,undefined,{'helpText':_0x3945d8(0x1e5)});const _0x5745b6=JSON[_0x3945d8(0x240)](a133_0x8c5550['readFileSync'](_0x38a5fa,_0x3945d8(0x189)));if(!isSupportedBackupVersion(_0x5745b6[_0x3945d8(0x190)]))throw new SDKError(ErrorCode[_0x3945d8(0x22e)],_0x3945d8(0x186)+_0x5745b6[_0x3945d8(0x190)],undefined,{'helpText':_0x3945d8(0x255)});return _0x5745b6;}async[a133_0xe8af3(0x258)](_0x53fbda,_0x438e00,_0x3fc515){const _0x196854=a133_0xe8af3,{projectId:_0x522fee,project:_0x9621db}=await this[_0x196854(0x14e)](_0x53fbda),_0x5338c2=_0x9621db[_0x196854(0x222)][_0x196854(0x1c3)];let _0x1f5970;if(_0x438e00)_0x1f5970=_0x438e00;else{const _0x20192b=a133_0xcf5d58[_0x196854(0x1e6)](process[_0x196854(0x15d)](),'agents'),_0x4cf9a6=getSanitizedPathWithMigration(_0x20192b,_0x5338c2);_0x4cf9a6['renamed']&&this[_0x196854(0x157)][_0x196854(0x1ed)]('Renamed\x20folder:\x20'+a133_0xcf5d58['basename'](_0x4cf9a6['oldPath'])+'\x20→\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x4cf9a6['path'])),_0x1f5970=_0x4cf9a6['path'];}const _0x7c53d4=await this['client']['listAgentsFull'](_0x522fee),_0x596646=await this[_0x196854(0x18a)]['listKnowledgeBases'](_0x522fee),_0x5dfb06=await this['client'][_0x196854(0x239)](_0x522fee),_0x5bcfc6=await safeListOrEmpty(()=>this[_0x196854(0x18a)][_0x196854(0x19b)](_0x522fee)),_0x52a214=await safeListOrEmpty(()=>this[_0x196854(0x18a)]['listWebSearchTools'](_0x522fee)),_0x5ebac2=await this[_0x196854(0x18a)][_0x196854(0x21e)](_0x522fee),_0x282a1a=await this[_0x196854(0x18a)][_0x196854(0x1ba)](_0x522fee),_0x242497=await safeListOrEmpty(()=>this[_0x196854(0x18a)][_0x196854(0x1a0)](_0x522fee)),_0x19b5f8=await safeListOrEmpty(()=>this[_0x196854(0x18a)]['listExperimentalArtifacts'](_0x522fee)),_0x2f8851=await safeListOrEmpty(()=>this['client'][_0x196854(0x142)](_0x522fee)),_0x2ad0db=await safeListOrEmpty(()=>this['client']['listChatInterfaces'](_0x522fee)),_0x5cc8a7=_0x282a1a[_0x196854(0x146)](_0x2e7112=>!_0x2e7112['attributes'][_0x196854(0x18b)]&&SAFE_INTEGRATION_TYPES[_0x196854(0x16a)](_0x2e7112[_0x196854(0x222)]['serviceType'][_0x196854(0x153)]())),_0x49ab34=new Map(),_0x2bcb53=new Map(),_0x424139=new Map(),_0x55cd8b=new Map(),_0x194dea=new Map(),_0x52a268=new Map(),_0x11d134=new Map();for(const _0x35e963 of _0x7c53d4){_0x49ab34[_0x196854(0x199)](_0x35e963['id'],_0x35e963[_0x196854(0x222)][_0x196854(0x1c3)]);}for(const _0x5b1d8b of _0x596646){_0x2bcb53[_0x196854(0x199)](_0x5b1d8b['id'],_0x5b1d8b['attributes'][_0x196854(0x1c3)]);}for(const _0x43ec74 of _0x5dfb06){_0x424139[_0x196854(0x199)](_0x43ec74['id'],_0x43ec74[_0x196854(0x222)][_0x196854(0x1c3)]);}for(const _0x37d8bd of _0x5bcfc6){_0x55cd8b['set'](_0x37d8bd['id'],_0x37d8bd[_0x196854(0x222)][_0x196854(0x1c3)]);}for(const _0x41d72 of _0x52a214){_0x194dea[_0x196854(0x199)](_0x41d72['id'],_0x41d72[_0x196854(0x222)][_0x196854(0x1c3)]);}for(const _0x2867b4 of _0x5ebac2){_0x52a268['set'](_0x2867b4['id'],_0x2867b4[_0x196854(0x222)]['name']);}for(const _0x552c23 of _0x242497){_0x11d134[_0x196854(0x199)](_0x552c23['id'],_0x552c23[_0x196854(0x222)][_0x196854(0x1c3)]);}const _0x14d5d5={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x2bcb53,'TextKnowledgeBase':_0x424139,'Agent':_0x49ab34,'WebSearchTool':_0x194dea,'ImageGenerator':_0x55cd8b,'ExperimentalKnowledgeBase':_0x11d134}),'resolvePromptName':async _0xecc55f=>_0x52a268[_0x196854(0x249)](_0xecc55f),'onWarning':_0x3c96ae=>this[_0x196854(0x157)][_0x196854(0x14b)](_0x3c96ae)},_0x25e5dd={'projectName':_0x5338c2,'outputDir':_0x1f5970,'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}}},_0x38a668=[],_0x18832a=[];for(const _0xd9d19 of _0x7c53d4){const _0x487e92=getSanitizedPathWithMigration(_0x1f5970,_0xd9d19[_0x196854(0x222)][_0x196854(0x1c3)]);_0x487e92[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)]('Renamed\x20agent\x20folder:\x20'+a133_0xcf5d58['basename'](_0x487e92[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58['basename'](_0x487e92[_0x196854(0x25d)]));const _0x47e94b=_0x487e92['path'],_0x54dec1=a133_0xcf5d58[_0x196854(0x1e6)](_0x47e94b,'prompt.md'),_0x195b7f=a133_0xcf5d58[_0x196854(0x1e6)](_0x47e94b,'agent.yml'),_0x3c0099=a133_0xcf5d58[_0x196854(0x1e6)](_0x47e94b,_0x196854(0x1fd)),{yaml:_0x454df0,systemPrompt:_0x3c4122,starterMessage:_0x5a32f4}=await agentResponseToDef(_0xd9d19,_0x14d5d5),_0x399c1d=toAgentYamlString(_0x454df0),_0x5be526=!a133_0x8c5550[_0x196854(0x229)](_0x195b7f);let _0x533ac8=_0x5be526,_0x55054b;if(!_0x5be526){const _0x29b56b=a133_0x8c5550[_0x196854(0x229)](_0x54dec1)?a133_0x8c5550[_0x196854(0x1b1)](_0x54dec1,'utf-8'):'',_0x11c0f8=a133_0x8c5550['readFileSync'](_0x195b7f,_0x196854(0x189)),_0x36e5e0='#\x20prompt.md\x0a'+_0x29b56b+_0x196854(0x1e0)+_0x11c0f8,_0x2513af=_0x196854(0x18d)+_0x3c4122+_0x196854(0x1e0)+_0x399c1d,_0x3052ae=generateDiff(_0x36e5e0,_0x2513af);_0x533ac8=hasChanges(_0x3052ae),_0x533ac8&&(_0x55054b=formatDiffWithColors(_0x3052ae));}_0x38a668[_0x196854(0x1da)]({'path':_0x47e94b,'content':'','isDir':!![]}),_0x38a668[_0x196854(0x1da)]({'path':_0x54dec1,'content':_0x3c4122}),_0x38a668[_0x196854(0x1da)]({'path':_0x195b7f,'content':_0x399c1d});_0x5a32f4&&_0x5a32f4[_0x196854(0x16a)]('\x0a')&&_0x38a668[_0x196854(0x1da)]({'path':_0x3c0099,'content':_0x5a32f4});_0x25e5dd[_0x196854(0x1e7)]['push']({'agentName':_0xd9d19[_0x196854(0x222)]['name'],'outputPath':_0x47e94b,'isNew':_0x5be526,'hasChanges':_0x533ac8,'diff':_0x55054b}),_0x25e5dd['counts']['agents'][_0x196854(0x1ea)]++;if(_0x5be526)_0x25e5dd['counts'][_0x196854(0x1e7)]['new']++;else{if(_0x533ac8)_0x25e5dd['counts']['agents'][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)]['agents'][_0x196854(0x1ff)]++;}}for(const _0x439210 of _0x596646){if(_0x439210[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x47cc09=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x1f5970),_0x439210[_0x196854(0x222)][_0x196854(0x1c3)],_0x196854(0x218));_0x47cc09[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)]('Renamed\x20KB\x20file:\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x47cc09[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58['basename'](_0x47cc09[_0x196854(0x25d)]));const _0x44cc57=_0x47cc09['path'],_0x48e1a2=apiKnowledgeBaseToYaml(_0x439210),_0x9ba083=toKnowledgeBaseYamlString(_0x48e1a2),_0x16d41d=!a133_0x8c5550[_0x196854(0x229)](_0x44cc57);let _0xa6b42f=_0x16d41d,_0x23be03;if(!_0x16d41d){const _0xd66e0=a133_0x8c5550['readFileSync'](_0x44cc57,_0x196854(0x189)),_0x219aed=generateDiff(_0xd66e0,_0x9ba083);_0xa6b42f=hasChanges(_0x219aed),_0xa6b42f&&(_0x23be03=formatDiffWithColors(_0x219aed));}_0x38a668['push']({'path':_0x44cc57,'content':_0x9ba083}),_0x25e5dd[_0x196854(0x252)][_0x196854(0x1da)]({'name':_0x439210[_0x196854(0x222)][_0x196854(0x1c3)],'outputPath':_0x44cc57,'isNew':_0x16d41d,'hasChanges':_0xa6b42f,'diff':_0x23be03}),_0x25e5dd['counts'][_0x196854(0x252)]['total']++;if(_0x16d41d)_0x25e5dd[_0x196854(0x207)][_0x196854(0x252)][_0x196854(0x1f6)]++;else{if(_0xa6b42f)_0x25e5dd[_0x196854(0x207)][_0x196854(0x252)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)]['knowledgeBases'][_0x196854(0x1ff)]++;}}for(const _0x4357c7 of _0x5dfb06){if(_0x4357c7[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x13a371=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x1f5970),_0x4357c7[_0x196854(0x222)][_0x196854(0x1c3)],_0x196854(0x1fb));_0x13a371[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)]('Renamed\x20text\x20KB\x20file:\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x13a371[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58[_0x196854(0x1c8)](_0x13a371[_0x196854(0x25d)]));const _0xafa196=_0x13a371['path'],_0x18ecd9=toTextKnowledgeBaseMd(_0x4357c7['attributes'][_0x196854(0x1c3)],_0x4357c7[_0x196854(0x222)][_0x196854(0x248)]),_0x52ef99=!a133_0x8c5550[_0x196854(0x229)](_0xafa196);let _0x356da8=_0x52ef99,_0x21beb6;if(!_0x52ef99){const _0x11edc3=a133_0x8c5550[_0x196854(0x1b1)](_0xafa196,_0x196854(0x189)),_0x22b584=generateDiff(_0x11edc3,_0x18ecd9);_0x356da8=hasChanges(_0x22b584),_0x356da8&&(_0x21beb6=formatDiffWithColors(_0x22b584));}_0x38a668[_0x196854(0x1da)]({'path':_0xafa196,'content':_0x18ecd9}),_0x25e5dd[_0x196854(0x1a9)][_0x196854(0x1da)]({'name':_0x4357c7['attributes'][_0x196854(0x1c3)],'outputPath':_0xafa196,'isNew':_0x52ef99,'hasChanges':_0x356da8,'diff':_0x21beb6}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x1a9)][_0x196854(0x1ea)]++;if(_0x52ef99)_0x25e5dd[_0x196854(0x207)][_0x196854(0x1a9)]['new']++;else{if(_0x356da8)_0x25e5dd['counts']['textKnowledgeBases'][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)][_0x196854(0x1a9)][_0x196854(0x1ff)]++;}}for(const _0x410a75 of _0x5ebac2){if(_0x410a75[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x447688=getSanitizedPathWithMigration(getPromptsDir(_0x1f5970),_0x410a75[_0x196854(0x222)]['name'],_0x196854(0x218));_0x447688['renamed']&&this[_0x196854(0x157)][_0x196854(0x1ed)](_0x196854(0x184)+a133_0xcf5d58[_0x196854(0x1c8)](_0x447688['oldPath'])+_0x196854(0x1e3)+a133_0xcf5d58['basename'](_0x447688[_0x196854(0x25d)]));const _0x14151a=_0x447688['path'],_0xbc0aa0=await apiPromptToYaml(_0x410a75,_0x14d5d5);if(!_0xbc0aa0)continue;const _0x35c1ea=toPromptYamlString(_0xbc0aa0),_0x6c8e8f=!a133_0x8c5550[_0x196854(0x229)](_0x14151a);let _0x3c8d69=_0x6c8e8f,_0x15deab;if(!_0x6c8e8f){const _0x1d9f40=a133_0x8c5550[_0x196854(0x1b1)](_0x14151a,'utf-8'),_0x5b34c5=generateDiff(_0x1d9f40,_0x35c1ea);_0x3c8d69=hasChanges(_0x5b34c5),_0x3c8d69&&(_0x15deab=formatDiffWithColors(_0x5b34c5));}_0x38a668['push']({'path':_0x14151a,'content':_0x35c1ea}),_0x25e5dd['prompts'][_0x196854(0x1da)]({'name':_0x410a75[_0x196854(0x222)][_0x196854(0x1c3)],'outputPath':_0x14151a,'isNew':_0x6c8e8f,'hasChanges':_0x3c8d69,'diff':_0x15deab}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x236)][_0x196854(0x1ea)]++;if(_0x6c8e8f)_0x25e5dd['counts']['prompts']['new']++;else{if(_0x3c8d69)_0x25e5dd[_0x196854(0x207)][_0x196854(0x236)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)]['prompts'][_0x196854(0x1ff)]++;}}for(const _0x30a5c4 of _0x5cc8a7){const _0x5b7bd9=_0x30a5c4[_0x196854(0x222)][_0x196854(0x254)][_0x196854(0x153)](),_0x40928e=getSanitizedPathWithMigration(getIntegrationsDir(_0x1f5970),_0x5b7bd9,_0x196854(0x218));_0x40928e['renamed']&&this[_0x196854(0x157)]['info']('Renamed\x20integration\x20file:\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x40928e[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58[_0x196854(0x1c8)](_0x40928e[_0x196854(0x25d)]));const _0x11d526=_0x40928e['path'],_0x3cfd46=await apiIntegrationToYaml(_0x30a5c4,_0x14d5d5),_0xedef54=toIntegrationYamlString(_0x3cfd46),_0x276093=!a133_0x8c5550[_0x196854(0x229)](_0x11d526);let _0x1fe2ec=_0x276093,_0x5df350;if(!_0x276093){const _0x3193f2=a133_0x8c5550[_0x196854(0x1b1)](_0x11d526,_0x196854(0x189)),_0x4aea39=generateDiff(_0x3193f2,_0xedef54);_0x1fe2ec=hasChanges(_0x4aea39),_0x1fe2ec&&(_0x5df350=formatDiffWithColors(_0x4aea39));}_0x38a668['push']({'path':_0x11d526,'content':_0xedef54}),_0x25e5dd[_0x196854(0x25a)]['push']({'name':_0x5b7bd9,'outputPath':_0x11d526,'isNew':_0x276093,'hasChanges':_0x1fe2ec,'diff':_0x5df350}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x25a)]['total']++;if(_0x276093)_0x25e5dd[_0x196854(0x207)][_0x196854(0x25a)][_0x196854(0x1f6)]++;else{if(_0x1fe2ec)_0x25e5dd[_0x196854(0x207)][_0x196854(0x25a)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)][_0x196854(0x25a)][_0x196854(0x1ff)]++;}}for(const _0x48efc9 of _0x242497){if(_0x48efc9[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x4f3eed=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x1f5970),_0x48efc9[_0x196854(0x222)][_0x196854(0x1c3)]);_0x4f3eed[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)]('Renamed\x20experimental\x20KB\x20directory:\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x4f3eed[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58[_0x196854(0x1c8)](_0x4f3eed['path']));const _0x50cf1c=_0x4f3eed[_0x196854(0x25d)],_0x16ca9d=a133_0xcf5d58[_0x196854(0x1e6)](_0x50cf1c,sanitizeForFilesystem(_0x48efc9[_0x196854(0x222)]['name'])+_0x196854(0x218)),_0x11bcec=a133_0xcf5d58['join'](_0x50cf1c,_0x196854(0x1b8)),_0xfc0eeb=apiExperimentalKnowledgeBaseToYaml(_0x48efc9),_0x5128d1=toExperimentalKnowledgeBaseYamlString(_0xfc0eeb),_0xb778bd=!a133_0x8c5550['existsSync'](_0x50cf1c);let _0x354a2c=_0xb778bd,_0x3a5787,_0x5c153a=_0x5128d1;const _0x5a0a58=[..._0xfc0eeb[_0x196854(0x1b8)]][_0x196854(0x23a)]((_0x45a9df,_0x1e918b)=>_0x45a9df['name'][_0x196854(0x1f5)](_0x1e918b['name']));for(const _0x56c77c of _0x5a0a58){_0x5c153a+=_0x196854(0x16c)+_0x56c77c['name']+'\x20---\x0a'+_0x56c77c['code']+_0x196854(0x147)+_0x56c77c['name']+'\x20---\x0a'+_0x56c77c[_0x196854(0x20e)]+'\x0a';}if(!_0xb778bd){let _0x2f2b50='';a133_0x8c5550[_0x196854(0x229)](_0x16ca9d)&&(_0x2f2b50=a133_0x8c5550['readFileSync'](_0x16ca9d,'utf-8'));if(a133_0x8c5550[_0x196854(0x229)](_0x11bcec)){const _0x4ae141=a133_0x8c5550[_0x196854(0x1ee)](_0x11bcec,{'withFileTypes':!![]}),_0x163307=_0x4ae141[_0x196854(0x146)](_0x574ce2=>_0x574ce2[_0x196854(0x24c)]())[_0x196854(0x23a)]((_0x3f679b,_0x4162d2)=>_0x3f679b[_0x196854(0x1c3)][_0x196854(0x1f5)](_0x4162d2[_0x196854(0x1c3)]));for(const _0x4d87e3 of _0x163307){const _0x22620e=a133_0xcf5d58[_0x196854(0x1e6)](_0x11bcec,_0x4d87e3[_0x196854(0x1c3)],'code.js'),_0x526d89=a133_0xcf5d58[_0x196854(0x1e6)](_0x11bcec,_0x4d87e3['name'],_0x196854(0x145));a133_0x8c5550[_0x196854(0x229)](_0x22620e)&&(_0x2f2b50+=_0x196854(0x16c)+_0x4d87e3[_0x196854(0x1c3)]+_0x196854(0x1b5)+a133_0x8c5550['readFileSync'](_0x22620e,'utf-8')+'\x0a'),a133_0x8c5550[_0x196854(0x229)](_0x526d89)&&(_0x2f2b50+=_0x196854(0x16b)+_0x4d87e3[_0x196854(0x1c3)]+'\x20---\x0a'+a133_0x8c5550['readFileSync'](_0x526d89,_0x196854(0x189))+'\x0a');}}const _0xe9dc14=generateDiff(_0x2f2b50,_0x5c153a);_0x354a2c=hasChanges(_0xe9dc14),_0x354a2c&&(_0x3a5787=formatDiffWithColors(_0xe9dc14));}_0x38a668[_0x196854(0x1da)]({'path':_0x50cf1c,'content':'','isDir':!![]}),_0x38a668['push']({'path':_0x16ca9d,'content':_0x5128d1}),_0x38a668[_0x196854(0x1da)]({'path':_0x11bcec,'content':'','isDir':!![]});for(const _0x4bf828 of _0xfc0eeb['functions']){const _0x2e3a59=a133_0xcf5d58[_0x196854(0x1e6)](_0x11bcec,sanitizeForFilesystem(_0x4bf828[_0x196854(0x1c3)])),_0x19d9d2=a133_0xcf5d58[_0x196854(0x1e6)](_0x2e3a59,_0x196854(0x20a)),_0x376f92=a133_0xcf5d58[_0x196854(0x1e6)](_0x2e3a59,_0x196854(0x145));_0x38a668[_0x196854(0x1da)]({'path':_0x2e3a59,'content':'','isDir':!![]}),_0x38a668[_0x196854(0x1da)]({'path':_0x19d9d2,'content':_0x4bf828[_0x196854(0x225)]}),_0x38a668[_0x196854(0x1da)]({'path':_0x376f92,'content':_0x4bf828['json_schema']});}if(a133_0x8c5550['existsSync'](_0x11bcec)){const _0x20c807=a133_0x8c5550[_0x196854(0x1ee)](_0x11bcec,{'withFileTypes':!![]}),_0x3aeba1=new Set(_0xfc0eeb['functions'][_0x196854(0x150)](_0x1e58a8=>sanitizeForFilesystem(_0x1e58a8[_0x196854(0x1c3)])));for(const _0x17ec98 of _0x20c807){if(_0x17ec98[_0x196854(0x24c)]()&&!_0x3aeba1[_0x196854(0x204)](_0x17ec98[_0x196854(0x1c3)])){const _0x17f839=a133_0xcf5d58['join'](_0x11bcec,_0x17ec98[_0x196854(0x1c3)]);_0x18832a[_0x196854(0x1da)]({'path':_0x17f839,'isDir':!![]});}}}_0x25e5dd[_0x196854(0x217)][_0x196854(0x1da)]({'name':_0x48efc9[_0x196854(0x222)][_0x196854(0x1c3)],'outputPath':_0x50cf1c,'isNew':_0xb778bd,'hasChanges':_0x354a2c,'diff':_0x3a5787}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x217)][_0x196854(0x1ea)]++;if(_0xb778bd)_0x25e5dd[_0x196854(0x207)][_0x196854(0x217)][_0x196854(0x1f6)]++;else{if(_0x354a2c)_0x25e5dd[_0x196854(0x207)][_0x196854(0x217)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)][_0x196854(0x217)][_0x196854(0x1ff)]++;}}for(const _0x4212fc of _0x19b5f8){if(_0x4212fc[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x9fdadc=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x1f5970),_0x4212fc[_0x196854(0x222)]['name']);_0x9fdadc['renamed']&&this['logger'][_0x196854(0x1ed)](_0x196854(0x169)+a133_0xcf5d58['basename'](_0x9fdadc[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58[_0x196854(0x1c8)](_0x9fdadc[_0x196854(0x25d)]));const _0x1f67ae=_0x9fdadc['path'],_0x34175c=a133_0xcf5d58[_0x196854(0x1e6)](_0x1f67ae,sanitizeForFilesystem(_0x4212fc[_0x196854(0x222)][_0x196854(0x1c3)])+_0x196854(0x218)),_0x1c3c3e=a133_0xcf5d58[_0x196854(0x1e6)](_0x1f67ae,'code.js'),_0x5c97e5=a133_0xcf5d58[_0x196854(0x1e6)](_0x1f67ae,_0x196854(0x1d1)),_0x48a468=apiExperimentalArtifactToYaml(_0x4212fc),_0x380e48=toExperimentalArtifactYamlString(_0x48a468),_0x130f16=!a133_0x8c5550[_0x196854(0x229)](_0x1f67ae);let _0x57530f=_0x130f16,_0x23fd40,_0x5b8bda=_0x380e48+('\x0a---\x20code\x20---\x0a'+_0x48a468['code']+'\x0a');const _0x56ce45=[..._0x48a468[_0x196854(0x1d1)]][_0x196854(0x23a)]((_0x216617,_0x3b88e1)=>_0x216617[_0x196854(0x1c7)][_0x196854(0x1f5)](_0x3b88e1[_0x196854(0x1c7)]));for(const _0x1c5ca7 of _0x56ce45){_0x5b8bda+=_0x196854(0x151)+_0x1c5ca7[_0x196854(0x1c7)]+'\x20---\x0a'+_0x1c5ca7['text_content']+'\x0a';}if(!_0x130f16){let _0x299a43='';a133_0x8c5550['existsSync'](_0x34175c)&&(_0x299a43=a133_0x8c5550[_0x196854(0x1b1)](_0x34175c,'utf-8'));a133_0x8c5550[_0x196854(0x229)](_0x1c3c3e)&&(_0x299a43+=_0x196854(0x245)+a133_0x8c5550['readFileSync'](_0x1c3c3e,_0x196854(0x189))+'\x0a');if(a133_0x8c5550[_0x196854(0x229)](_0x5c97e5)){const _0x204a66=a133_0x8c5550[_0x196854(0x1ee)](_0x5c97e5),_0x12288e=_0x204a66[_0x196854(0x146)](_0x4dd730=>{const _0x373cbc=_0x196854,_0x3205ff=a133_0xcf5d58[_0x373cbc(0x1e6)](_0x5c97e5,_0x4dd730);return a133_0x8c5550[_0x373cbc(0x1dd)](_0x3205ff)[_0x373cbc(0x166)]();})[_0x196854(0x23a)]((_0x4ca103,_0x358518)=>_0x4ca103[_0x196854(0x1f5)](_0x358518));for(const _0x5bec9e of _0x12288e){const _0x158016=a133_0xcf5d58[_0x196854(0x1e6)](_0x5c97e5,_0x5bec9e);_0x299a43+=_0x196854(0x151)+_0x5bec9e+_0x196854(0x1b5)+a133_0x8c5550[_0x196854(0x1b1)](_0x158016,_0x196854(0x189))+'\x0a';}}const _0x512723=generateDiff(_0x299a43,_0x5b8bda);_0x57530f=hasChanges(_0x512723),_0x57530f&&(_0x23fd40=formatDiffWithColors(_0x512723));}_0x38a668[_0x196854(0x1da)]({'path':_0x1f67ae,'content':'','isDir':!![]}),_0x38a668[_0x196854(0x1da)]({'path':_0x34175c,'content':_0x380e48}),_0x38a668[_0x196854(0x1da)]({'path':_0x1c3c3e,'content':_0x48a468[_0x196854(0x225)]});if(_0x48a468[_0x196854(0x1d1)][_0x196854(0x212)]>0x0){_0x38a668[_0x196854(0x1da)]({'path':_0x5c97e5,'content':'','isDir':!![]});for(const _0x4a1e48 of _0x48a468[_0x196854(0x1d1)]){const _0x4ea1a4=a133_0xcf5d58[_0x196854(0x1e6)](_0x5c97e5,_0x4a1e48[_0x196854(0x1c7)]);_0x38a668[_0x196854(0x1da)]({'path':_0x4ea1a4,'content':_0x4a1e48[_0x196854(0x208)]});}}if(a133_0x8c5550[_0x196854(0x229)](_0x5c97e5)){const _0x2d46ce=a133_0x8c5550[_0x196854(0x1ee)](_0x5c97e5),_0x1cda98=new Set(_0x48a468[_0x196854(0x1d1)][_0x196854(0x150)](_0x2e0674=>_0x2e0674['file_name']));for(const _0x539f84 of _0x2d46ce){const _0x3ff999=a133_0xcf5d58['join'](_0x5c97e5,_0x539f84);a133_0x8c5550[_0x196854(0x1dd)](_0x3ff999)['isFile']()&&!_0x1cda98['has'](_0x539f84)&&_0x18832a['push']({'path':_0x3ff999});}}_0x25e5dd[_0x196854(0x1b3)][_0x196854(0x1da)]({'name':_0x4212fc['attributes'][_0x196854(0x1c3)],'outputPath':_0x1f67ae,'isNew':_0x130f16,'hasChanges':_0x57530f,'diff':_0x23fd40}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x1b3)]['total']++;if(_0x130f16)_0x25e5dd['counts'][_0x196854(0x1b3)]['new']++;else{if(_0x57530f)_0x25e5dd[_0x196854(0x207)][_0x196854(0x1b3)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)][_0x196854(0x1b3)][_0x196854(0x1ff)]++;}}for(const _0x4194c9 of _0x2f8851){const _0x40ca1d=getSanitizedPathWithMigration(getFormInterfacesDir(_0x1f5970),_0x4194c9[_0x196854(0x222)][_0x196854(0x1c3)],_0x196854(0x218));_0x40ca1d[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)](_0x196854(0x19d)+a133_0xcf5d58[_0x196854(0x1c8)](_0x40ca1d[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58['basename'](_0x40ca1d[_0x196854(0x25d)]));const _0x568ed7=_0x40ca1d[_0x196854(0x25d)],_0x55be96=await apiFormInterfaceToYaml(_0x4194c9,_0x14d5d5),_0x382fcf=toFormInterfaceYamlString(_0x55be96),_0x482a16=!a133_0x8c5550[_0x196854(0x229)](_0x568ed7);let _0x39c4fd=_0x482a16,_0x4ee646;if(!_0x482a16){const _0x4a42e4=a133_0x8c5550[_0x196854(0x1b1)](_0x568ed7,_0x196854(0x189)),_0x17f3cd=generateDiff(_0x4a42e4,_0x382fcf);_0x39c4fd=hasChanges(_0x17f3cd),_0x39c4fd&&(_0x4ee646=formatDiffWithColors(_0x17f3cd));}_0x38a668[_0x196854(0x1da)]({'path':_0x568ed7,'content':_0x382fcf}),_0x25e5dd[_0x196854(0x178)][_0x196854(0x1da)]({'name':_0x4194c9['attributes'][_0x196854(0x1c3)],'outputPath':_0x568ed7,'isNew':_0x482a16,'hasChanges':_0x39c4fd,'diff':_0x4ee646}),_0x25e5dd[_0x196854(0x207)]['formInterfaces'][_0x196854(0x1ea)]++;if(_0x482a16)_0x25e5dd[_0x196854(0x207)][_0x196854(0x178)][_0x196854(0x1f6)]++;else{if(_0x39c4fd)_0x25e5dd[_0x196854(0x207)][_0x196854(0x178)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)][_0x196854(0x178)][_0x196854(0x1ff)]++;}}for(const _0x2338ae of _0x2ad0db){if(_0x2338ae[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x1eca7f=getSanitizedPathWithMigration(getChatInterfacesDir(_0x1f5970),_0x2338ae['attributes'][_0x196854(0x1c3)],_0x196854(0x218));_0x1eca7f[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)](_0x196854(0x165)+a133_0xcf5d58[_0x196854(0x1c8)](_0x1eca7f[_0x196854(0x251)])+'\x20→\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x1eca7f[_0x196854(0x25d)]));const _0x40af0c=_0x1eca7f[_0x196854(0x25d)],_0x619084=await apiChatInterfaceToYaml(_0x2338ae,_0x14d5d5),_0x4ce3d0=toChatInterfaceYamlString(_0x619084),_0x2148c6=!a133_0x8c5550[_0x196854(0x229)](_0x40af0c);let _0x538b62=_0x2148c6,_0x2d932a;if(!_0x2148c6){const _0x146d28=a133_0x8c5550[_0x196854(0x1b1)](_0x40af0c,'utf-8'),_0x58b91c=generateDiff(_0x146d28,_0x4ce3d0);_0x538b62=hasChanges(_0x58b91c),_0x538b62&&(_0x2d932a=formatDiffWithColors(_0x58b91c));}_0x38a668['push']({'path':_0x40af0c,'content':_0x4ce3d0}),_0x25e5dd[_0x196854(0x247)][_0x196854(0x1da)]({'name':_0x2338ae[_0x196854(0x222)][_0x196854(0x1c3)],'outputPath':_0x40af0c,'isNew':_0x2148c6,'hasChanges':_0x538b62,'diff':_0x2d932a}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x247)][_0x196854(0x1ea)]++;if(_0x2148c6)_0x25e5dd[_0x196854(0x207)]['chatInterfaces'][_0x196854(0x1f6)]++;else{if(_0x538b62)_0x25e5dd[_0x196854(0x207)][_0x196854(0x247)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)]['chatInterfaces'][_0x196854(0x1ff)]++;}}if(_0x3fc515?.[_0x196854(0x234)])return _0x25e5dd;a133_0x8c5550[_0x196854(0x1e4)](_0x1f5970,{'recursive':!![]}),a133_0x8c5550['mkdirSync'](getKnowledgeBasesDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550[_0x196854(0x1e4)](getPromptsDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550[_0x196854(0x1e4)](getIntegrationsDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550[_0x196854(0x1e4)](getExperimentalKnowledgeBasesDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550['mkdirSync'](getExperimentalArtifactsDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550[_0x196854(0x1e4)](getFormInterfacesDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550[_0x196854(0x1e4)](getChatInterfacesDir(_0x1f5970),{'recursive':!![]});const _0x186bb9=a133_0xcf5d58['join'](_0x1f5970,_0x196854(0x243));a133_0x8c5550[_0x196854(0x22f)](_0x186bb9,createAgentConfigContent(_0x5338c2));for(const _0x46bd0d of _0x38a668){if(_0x46bd0d['isDir'])a133_0x8c5550[_0x196854(0x1e4)](_0x46bd0d[_0x196854(0x25d)],{'recursive':!![]});else{const _0x3d0d29=a133_0xcf5d58[_0x196854(0x24d)](_0x46bd0d[_0x196854(0x25d)]);!a133_0x8c5550[_0x196854(0x229)](_0x3d0d29)&&a133_0x8c5550[_0x196854(0x1e4)](_0x3d0d29,{'recursive':!![]}),a133_0x8c5550[_0x196854(0x22f)](_0x46bd0d[_0x196854(0x25d)],_0x46bd0d[_0x196854(0x1ab)]);}}for(const _0x55d736 of _0x18832a){_0x55d736[_0x196854(0x173)]?(a133_0x8c5550[_0x196854(0x152)](_0x55d736[_0x196854(0x25d)],{'recursive':!![],'force':!![]}),this[_0x196854(0x157)]['info'](_0x196854(0x244)+a133_0xcf5d58[_0x196854(0x1c8)](a133_0xcf5d58[_0x196854(0x24d)](_0x55d736['path']))+'/'+a133_0xcf5d58[_0x196854(0x1c8)](_0x55d736[_0x196854(0x25d)]))):(a133_0x8c5550[_0x196854(0x152)](_0x55d736[_0x196854(0x25d)],{'force':!![]}),this['logger'][_0x196854(0x1ed)](_0x196854(0x168)+a133_0xcf5d58['basename'](a133_0xcf5d58['dirname'](_0x55d736[_0x196854(0x25d)]))+'/'+a133_0xcf5d58[_0x196854(0x1c8)](_0x55d736[_0x196854(0x25d)])));}return _0x25e5dd;}async[a133_0xe8af3(0x194)](_0x11347e,_0x4407a8){const _0x48fc7b=a133_0xe8af3,_0x39c7fc=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x11347e,'tdx.json');if(!a133_0x8c5550[_0x48fc7b(0x229)](_0x39c7fc))throw new SDKError(ErrorCode[_0x48fc7b(0x22e)],_0x48fc7b(0x1ca)+_0x11347e,undefined,{'helpText':_0x48fc7b(0x1a3)});const _0x563cd8=loadAgentConfig(_0x39c7fc),_0x23e555=await this[_0x48fc7b(0x1c5)](_0x563cd8[_0x48fc7b(0x181)]),_0x3517e0=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x1d4)](_0x23e555),_0x9db351=_0x3517e0['attributes']['name'],_0x3b18f5={'projectName':_0x9db351,'projectId':_0x23e555,'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}}},_0xf8fab8=[],_0x269704=[],_0x5bf5de=[],_0x262d1a=[],_0x3cf0ae=[],_0x66f9a5=[],_0x1ec36e=a133_0x8c5550['readdirSync'](_0x11347e,{'withFileTypes':!![]});for(const _0x5256b3 of _0x1ec36e){if(!_0x5256b3[_0x48fc7b(0x24c)]())continue;if([_0x48fc7b(0x21f),_0x48fc7b(0x236),_0x48fc7b(0x25a),_0x48fc7b(0x196),_0x48fc7b(0x175),_0x48fc7b(0x174),'chat_interfaces'][_0x48fc7b(0x16a)](_0x5256b3[_0x48fc7b(0x1c3)]))continue;const _0x161ad5=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x11347e,_0x5256b3[_0x48fc7b(0x1c3)]);if(isAgentDir(_0x161ad5)){const _0x2625b1=a133_0xcf5d58['join'](_0x161ad5,_0x48fc7b(0x198)),_0x3fc129=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x161ad5,_0x48fc7b(0x1d5)),_0x30506c=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x161ad5,'starter_message.md'),_0x236316=parseAgentYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x2625b1,_0x48fc7b(0x189)),_0x2625b1),_0xd4086a=a133_0x8c5550[_0x48fc7b(0x229)](_0x3fc129)?a133_0x8c5550[_0x48fc7b(0x1b1)](_0x3fc129,_0x48fc7b(0x189)):'',_0x2a8507=a133_0x8c5550[_0x48fc7b(0x229)](_0x30506c)?a133_0x8c5550[_0x48fc7b(0x1b1)](_0x30506c,_0x48fc7b(0x189)):_0x236316[_0x48fc7b(0x15b)];_0xf8fab8[_0x48fc7b(0x1da)]({'name':_0x236316[_0x48fc7b(0x1c3)],'dir':_0x161ad5,'yaml':_0x236316,'systemPrompt':_0xd4086a,'starterMessage':_0x2a8507});}}const _0x106325=getKnowledgeBasesDir(_0x11347e);if(a133_0x8c5550[_0x48fc7b(0x229)](_0x106325)){const _0x58e12e=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x106325);for(const _0x305738 of _0x58e12e){const _0x325345=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x106325,_0x305738);if(_0x305738[_0x48fc7b(0x1b9)](_0x48fc7b(0x218))){const _0x1b1116=parseKnowledgeBaseYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x325345,'utf-8'),_0x325345);_0x269704[_0x48fc7b(0x1da)]({'name':_0x1b1116[_0x48fc7b(0x1c3)],'path':_0x325345,'yaml':_0x1b1116});}else{if(_0x305738[_0x48fc7b(0x1b9)](_0x48fc7b(0x1fb))){const _0x4ab55e=a133_0x8c5550['readFileSync'](_0x325345,_0x48fc7b(0x189)),{name:_0x191634,text:_0x5b2c7d}=parseTextKnowledgeBaseMd(_0x4ab55e,_0x305738);_0x5bf5de[_0x48fc7b(0x1da)]({'name':_0x191634,'path':_0x325345,'text':_0x5b2c7d});}}}}const _0x1f5e99=getPromptsDir(_0x11347e);if(a133_0x8c5550['existsSync'](_0x1f5e99)){const _0x442758=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x1f5e99)[_0x48fc7b(0x146)](_0x2a22e7=>_0x2a22e7[_0x48fc7b(0x1b9)](_0x48fc7b(0x218)));for(const _0x13b902 of _0x442758){const _0x235849=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x1f5e99,_0x13b902),_0x27ada3=parsePromptYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x235849,_0x48fc7b(0x189)),_0x235849);_0x262d1a[_0x48fc7b(0x1da)]({'name':_0x27ada3[_0x48fc7b(0x1c3)],'path':_0x235849,'yaml':_0x27ada3});}}const _0x2d98be=[],_0xaa282a=getIntegrationsDir(_0x11347e);if(a133_0x8c5550[_0x48fc7b(0x229)](_0xaa282a)){const _0x4de8c5=a133_0x8c5550[_0x48fc7b(0x1ee)](_0xaa282a)[_0x48fc7b(0x146)](_0x1c6b83=>_0x1c6b83[_0x48fc7b(0x1b9)](_0x48fc7b(0x218)));for(const _0x409768 of _0x4de8c5){const _0x207233=a133_0xcf5d58['join'](_0xaa282a,_0x409768),_0x4aa949=parseIntegrationYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x207233,_0x48fc7b(0x189)),_0x207233);if(!SAFE_INTEGRATION_TYPES[_0x48fc7b(0x16a)](_0x4aa949[_0x48fc7b(0x21d)][_0x48fc7b(0x153)]())){this[_0x48fc7b(0x157)][_0x48fc7b(0x14b)](_0x48fc7b(0x14c)+_0x4aa949[_0x48fc7b(0x1c3)]+_0x48fc7b(0x227)+_0x4aa949['service_type']+_0x48fc7b(0x1ad)+(_0x48fc7b(0x176)+SAFE_INTEGRATION_TYPES[_0x48fc7b(0x1e6)](',\x20')+_0x48fc7b(0x18c))+_0x48fc7b(0x19e));continue;}_0x2d98be[_0x48fc7b(0x1da)]({'name':_0x4aa949['name'],'path':_0x207233,'yaml':_0x4aa949});}}const _0x21af66=getExperimentalKnowledgeBasesDir(_0x11347e);if(a133_0x8c5550[_0x48fc7b(0x229)](_0x21af66)){const _0x50e781=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x21af66,{'withFileTypes':!![]});for(const _0x1724d7 of _0x50e781){if(!_0x1724d7[_0x48fc7b(0x24c)]())continue;const _0x211166=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x21af66,_0x1724d7[_0x48fc7b(0x1c3)]),_0x521f46=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x211166,_0x1724d7[_0x48fc7b(0x1c3)]+'.yml'),_0x2a94bb=a133_0xcf5d58['join'](_0x211166,_0x48fc7b(0x1b8));if(!a133_0x8c5550['existsSync'](_0x521f46))continue;const _0x4ab0a4=parseExperimentalKnowledgeBaseYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x521f46,'utf-8'),_0x521f46),_0x1abd2d=[];if(a133_0x8c5550['existsSync'](_0x2a94bb)){const _0x25d102=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x2a94bb,{'withFileTypes':!![]});for(const _0x2f07ee of _0x25d102){if(!_0x2f07ee['isDirectory']())continue;const _0x167746=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x2a94bb,_0x2f07ee[_0x48fc7b(0x1c3)]),_0x3ef05a=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x167746,'code.js'),_0x3bd766=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x167746,_0x48fc7b(0x145));a133_0x8c5550['existsSync'](_0x3ef05a)&&a133_0x8c5550[_0x48fc7b(0x229)](_0x3bd766)&&_0x1abd2d['push']({'name':_0x2f07ee[_0x48fc7b(0x1c3)],'code':a133_0x8c5550[_0x48fc7b(0x1b1)](_0x3ef05a,'utf-8'),'json_schema':a133_0x8c5550[_0x48fc7b(0x1b1)](_0x3bd766,_0x48fc7b(0x189))});}}const _0x3d6f99={..._0x4ab0a4,'variables':_0x4ab0a4[_0x48fc7b(0x1cd)]||[],'functions':_0x1abd2d};_0x3cf0ae[_0x48fc7b(0x1da)]({'name':_0x4ab0a4[_0x48fc7b(0x1c3)],'dir':_0x211166,'def':_0x3d6f99});}}const _0x43d9a9=getExperimentalArtifactsDir(_0x11347e);if(a133_0x8c5550[_0x48fc7b(0x229)](_0x43d9a9)){const _0x533853=a133_0x8c5550['readdirSync'](_0x43d9a9,{'withFileTypes':!![]});for(const _0x604938 of _0x533853){if(!_0x604938['isDirectory']())continue;const _0x19ed67=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x43d9a9,_0x604938[_0x48fc7b(0x1c3)]),_0xd3345a=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x19ed67,_0x604938[_0x48fc7b(0x1c3)]+_0x48fc7b(0x218)),_0x1b1387=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x19ed67,_0x48fc7b(0x20a)),_0x3be67b=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x19ed67,_0x48fc7b(0x1d1));if(!a133_0x8c5550[_0x48fc7b(0x229)](_0xd3345a)||!a133_0x8c5550[_0x48fc7b(0x229)](_0x1b1387))continue;const _0x1899d1=parseExperimentalArtifactYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0xd3345a,_0x48fc7b(0x189)),_0xd3345a),_0x1faf55=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x1b1387,'utf-8'),_0x427d72=[];if(a133_0x8c5550[_0x48fc7b(0x229)](_0x3be67b)){const _0xf10d50=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x3be67b);for(const _0x129674 of _0xf10d50){const _0x2c408b=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x3be67b,_0x129674);a133_0x8c5550[_0x48fc7b(0x1dd)](_0x2c408b)['isFile']()&&_0x427d72[_0x48fc7b(0x1da)]({'file_name':_0x129674,'text_content':a133_0x8c5550['readFileSync'](_0x2c408b,_0x48fc7b(0x189))});}}const _0x3ee7d3={..._0x1899d1,'code':_0x1faf55,'files':_0x427d72};_0x66f9a5['push']({'name':_0x1899d1[_0x48fc7b(0x1c3)],'dir':_0x19ed67,'def':_0x3ee7d3});}}const _0x40e69d=[],_0x48382d=getFormInterfacesDir(_0x11347e);if(a133_0x8c5550[_0x48fc7b(0x229)](_0x48382d)){const _0xca0c08=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x48382d)[_0x48fc7b(0x146)](_0x5cb0aa=>_0x5cb0aa[_0x48fc7b(0x1b9)]('.yml'));for(const _0x2ad8e3 of _0xca0c08){const _0x23a6e0=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x48382d,_0x2ad8e3),_0x47ae21=parseFormInterfaceYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x23a6e0,_0x48fc7b(0x189)),_0x23a6e0);_0x40e69d[_0x48fc7b(0x1da)]({'name':_0x47ae21['name'],'path':_0x23a6e0,'yaml':_0x47ae21});}}const _0x35e986=[],_0x2b0b40=getChatInterfacesDir(_0x11347e);if(a133_0x8c5550['existsSync'](_0x2b0b40)){const _0x5932d7=a133_0x8c5550['readdirSync'](_0x2b0b40)[_0x48fc7b(0x146)](_0x3f940c=>_0x3f940c[_0x48fc7b(0x1b9)](_0x48fc7b(0x218)));for(const _0x47e1ce of _0x5932d7){const _0x259956=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x2b0b40,_0x47e1ce),_0x23434b=parseChatInterfaceYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x259956,_0x48fc7b(0x189)),_0x259956);_0x35e986['push']({'name':_0x23434b['name'],'path':_0x259956,'yaml':_0x23434b});}}const _0x44132b=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x1d8)](_0x23e555),_0x20373f=await this['client'][_0x48fc7b(0x183)](_0x23e555),_0x2053f8=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x239)](_0x23e555),_0x36d8bd=await this[_0x48fc7b(0x18a)]['listPrompts'](_0x23e555),_0x1b6a25=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x1ba)](_0x23e555),_0x280003=await safeListOrEmpty(()=>this[_0x48fc7b(0x18a)]['listExperimentalKnowledgeBases'](_0x23e555)),_0x2043c8=await safeListOrEmpty(()=>this[_0x48fc7b(0x18a)]['listExperimentalArtifacts'](_0x23e555)),_0x6bc0c0=await safeListOrEmpty(()=>this[_0x48fc7b(0x18a)][_0x48fc7b(0x142)](_0x23e555)),_0x1d2763=await safeListOrEmpty(()=>this['client'][_0x48fc7b(0x223)](_0x23e555)),_0x3b6030=await fetchAllToolTargetMaps((_0xafb6ba,_0x209ce8)=>this['client'][_0x48fc7b(0x24b)](_0xafb6ba,_0x209ce8),_0x23e555),_0x4ce081=new Map(),_0x4b6e1a=new Map(),_0x2d4773=new Map(),_0x4f9c4c=new Map(),_0x3439ff=new Map(),_0x428f0f=new Map(),_0x4b7fed=new Map();for(const _0x406294 of _0x44132b){_0x4ce081[_0x48fc7b(0x199)](_0x406294[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0x406294);}for(const _0x55cf00 of _0x20373f){_0x4b6e1a[_0x48fc7b(0x199)](_0x55cf00[_0x48fc7b(0x222)]['name'],_0x55cf00);}for(const _0xcf8ff1 of _0x2053f8){_0x2d4773[_0x48fc7b(0x199)](_0xcf8ff1['attributes'][_0x48fc7b(0x1c3)],_0xcf8ff1);}for(const _0xf30c6f of _0x36d8bd){_0x4f9c4c['set'](_0xf30c6f[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0xf30c6f);}for(const _0x1220b1 of _0x1b6a25){_0x3439ff[_0x48fc7b(0x199)](_0x1220b1['attributes']['serviceType'][_0x48fc7b(0x153)](),_0x1220b1);}for(const _0x586bd5 of _0x280003){_0x428f0f[_0x48fc7b(0x199)](_0x586bd5[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0x586bd5);}for(const _0x5dead4 of _0x2043c8){_0x4b7fed['set'](_0x5dead4[_0x48fc7b(0x222)]['name'],_0x5dead4);}const _0x115cca=new Map(),_0x1480a0=new Map();for(const _0xe6dc76 of _0x6bc0c0){_0x115cca['set'](_0xe6dc76['attributes'][_0x48fc7b(0x1c3)],_0xe6dc76);}for(const _0x1ffe5b of _0x1d2763){_0x1480a0[_0x48fc7b(0x199)](_0x1ffe5b[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0x1ffe5b);}const _0x4315f6=new Map(),_0x83c28=new Map();for(const _0x174197 of _0x44132b){_0x4315f6['set'](_0x174197[_0x48fc7b(0x222)]['name'],_0x174197['id']),_0x83c28[_0x48fc7b(0x199)](_0x174197['id'],_0x174197[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)]);}const _0x167009=new Map(),_0x1da7b4=new Map();for(const _0x556707 of _0x36d8bd){_0x167009[_0x48fc7b(0x199)](_0x556707[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0x556707['id']),_0x1da7b4[_0x48fc7b(0x199)](_0x556707['id'],_0x556707[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)]);}const _0x3035cf=_0x3b6030[_0x48fc7b(0x23f)]['KnowledgeBase']||new Map(),_0x14c757=_0x3b6030[_0x48fc7b(0x23f)][_0x48fc7b(0x1c9)]||new Map(),_0x139ed9=_0x3b6030[_0x48fc7b(0x23f)][_0x48fc7b(0x18e)]||new Map(),_0x17ecfc=new Map(),_0x6e038c={'resolveToolTargetName':buildNameResolver({..._0x3b6030[_0x48fc7b(0x18f)],'Agent':_0x83c28}),'resolvePromptName':async _0x5b595d=>_0x1da7b4['get'](_0x5b595d),'onWarning':_0x27d1cd=>this[_0x48fc7b(0x157)][_0x48fc7b(0x14b)](_0x27d1cd)};let _0x288a85=[];const _0x50df6e={'projectId':_0x23e555,'resolveToolTargetId':buildIdResolver({..._0x3b6030[_0x48fc7b(0x23f)],'Agent':_0x4315f6}),'resolvePromptId':async _0x2cf882=>_0x167009[_0x48fc7b(0x249)](_0x2cf882),'onWarning':_0x41b297=>{const _0x1d6284=_0x48fc7b;this[_0x1d6284(0x157)][_0x1d6284(0x14b)](_0x41b297),_0x288a85[_0x1d6284(0x1da)](_0x41b297);}},{resolved:_0x5d561a,unresolved:_0x473353}=resolveAgentDependencies(_0xf8fab8,new Set(_0x4ce081[_0x48fc7b(0x24e)]()));for(const {agent:_0x75b24,missingDeps:_0x3ffab8}of _0x473353){_0x3b18f5[_0x48fc7b(0x1e7)][_0x48fc7b(0x1da)]({'agentName':_0x75b24[_0x48fc7b(0x1d3)]['name'],'action':'error','error':'Unresolved\x20dependencies:\x20'+_0x3ffab8['join'](',\x20')+'.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.'}),_0x3b18f5['counts']['agents']['errors']++;}for(const _0xadefdd of _0x269704){const _0x5418ff=_0x4b6e1a['get'](_0xadefdd['yaml'][_0x48fc7b(0x1c3)]),_0x15467d=a133_0x8c5550[_0x48fc7b(0x1b1)](_0xadefdd[_0x48fc7b(0x25d)],_0x48fc7b(0x189));if(_0x5418ff){const _0x15001c=apiKnowledgeBaseToYaml(_0x5418ff),_0x21af92=toKnowledgeBaseYamlString(_0x15001c),_0x11e359=generateDiff(_0x21af92,_0x15467d),_0x27357e=hasChanges(_0x11e359);_0x27357e?(_0x3b18f5['knowledgeBases'][_0x48fc7b(0x1da)]({'name':_0xadefdd[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x5418ff['id'],'diff':formatDiffWithColors(_0x11e359)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x252)]['updated']++):(_0x3b18f5['knowledgeBases'][_0x48fc7b(0x1da)]({'name':_0xadefdd[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x5418ff['id']}),_0x3b18f5[_0x48fc7b(0x207)]['knowledgeBases'][_0x48fc7b(0x1ff)]++);}else _0x3b18f5[_0x48fc7b(0x252)]['push']({'name':_0xadefdd[_0x48fc7b(0x1d3)]['name'],'action':_0x48fc7b(0x25c)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x252)][_0x48fc7b(0x25c)]++;}for(const _0x4ade0b of _0x5bf5de){const _0x2020a1=_0x2d4773[_0x48fc7b(0x249)](_0x4ade0b[_0x48fc7b(0x1c3)]),_0x3e24f4=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x4ade0b[_0x48fc7b(0x25d)],_0x48fc7b(0x189));if(_0x2020a1){const _0x4273e9=toTextKnowledgeBaseMd(_0x2020a1[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0x2020a1[_0x48fc7b(0x222)][_0x48fc7b(0x248)]),_0x226f6f=generateDiff(_0x4273e9,_0x3e24f4),_0x3521cc=hasChanges(_0x226f6f);_0x3521cc?(_0x3b18f5[_0x48fc7b(0x1a9)][_0x48fc7b(0x1da)]({'name':_0x4ade0b[_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x2020a1['id'],'diff':formatDiffWithColors(_0x226f6f)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1a9)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x1a9)]['push']({'name':_0x4ade0b[_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x2020a1['id']}),_0x3b18f5['counts'][_0x48fc7b(0x1a9)][_0x48fc7b(0x1ff)]++);}else _0x3b18f5[_0x48fc7b(0x1a9)][_0x48fc7b(0x1da)]({'name':_0x4ade0b[_0x48fc7b(0x1c3)],'action':'created'}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1a9)][_0x48fc7b(0x25c)]++;}for(const _0x463c76 of _0x5d561a){const _0x45f3f4=_0x4ce081[_0x48fc7b(0x249)](_0x463c76['yaml'][_0x48fc7b(0x1c3)]),_0x547168=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x463c76[_0x48fc7b(0x19a)],_0x48fc7b(0x198)),_0x37dc73=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x547168,'utf-8'),_0x1bed72=_0x463c76[_0x48fc7b(0x16f)],_0x25a957=_0x48fc7b(0x18d)+_0x1bed72+'\x0a\x0a#\x20agent.yml\x0a'+_0x37dc73;if(_0x45f3f4){const {yaml:_0xa231a5,systemPrompt:_0x4cf85a}=await agentResponseToDef(_0x45f3f4,_0x6e038c),_0x19969d=toAgentYamlString(_0xa231a5),_0x5eef8d='#\x20prompt.md\x0a'+_0x4cf85a+_0x48fc7b(0x1e0)+_0x19969d,_0x3b14d4=generateDiff(_0x5eef8d,_0x25a957),_0x1bc203=hasChanges(_0x3b14d4);_0x1bc203?(_0x3b18f5[_0x48fc7b(0x1e7)][_0x48fc7b(0x1da)]({'agentName':_0x463c76[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'agentId':_0x45f3f4['id'],'diff':formatDiffWithColors(_0x3b14d4)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1e7)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x1e7)][_0x48fc7b(0x1da)]({'agentName':_0x463c76[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'agentId':_0x45f3f4['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1e7)][_0x48fc7b(0x1ff)]++);}else _0x3b18f5[_0x48fc7b(0x1e7)]['push']({'agentName':_0x463c76[_0x48fc7b(0x1d3)]['name'],'action':_0x48fc7b(0x25c)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1e7)][_0x48fc7b(0x25c)]++;}for(const _0x405159 of _0x262d1a){const _0x249210=_0x4f9c4c[_0x48fc7b(0x249)](_0x405159[_0x48fc7b(0x1d3)]['name']),_0x5745d0=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x405159[_0x48fc7b(0x25d)],_0x48fc7b(0x189));if(_0x249210){const _0x1b5876=await apiPromptToYaml(_0x249210,_0x6e038c);if(!_0x1b5876){_0x3b18f5[_0x48fc7b(0x236)][_0x48fc7b(0x1da)]({'name':_0x405159['yaml'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x249210['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)][_0x48fc7b(0x1be)]++;continue;}const _0x3db53b=toPromptYamlString(_0x1b5876),_0x122d15=generateDiff(_0x3db53b,_0x5745d0),_0x2e1cec=hasChanges(_0x122d15);_0x2e1cec?(_0x3b18f5[_0x48fc7b(0x236)][_0x48fc7b(0x1da)]({'name':_0x405159[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x249210['id'],'diff':formatDiffWithColors(_0x122d15)}),_0x3b18f5['counts'][_0x48fc7b(0x236)]['updated']++):(_0x3b18f5['prompts']['push']({'name':_0x405159[_0x48fc7b(0x1d3)]['name'],'action':_0x48fc7b(0x1ff),'id':_0x249210['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)][_0x48fc7b(0x1ff)]++);}else _0x3b18f5['prompts'][_0x48fc7b(0x1da)]({'name':_0x405159[_0x48fc7b(0x1d3)]['name'],'action':_0x48fc7b(0x25c)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)][_0x48fc7b(0x25c)]++;}for(const _0x57d0d3 of _0x2d98be){const _0x1922ec=_0x3439ff['get'](_0x57d0d3[_0x48fc7b(0x1d3)][_0x48fc7b(0x21d)]),_0xd9bbc6=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x57d0d3['path'],'utf-8');if(_0x1922ec){const _0x28d6ea=await apiIntegrationToYaml(_0x1922ec,_0x6e038c),_0x494be1=toIntegrationYamlString(_0x28d6ea),_0x54a647=generateDiff(_0x494be1,_0xd9bbc6),_0x34f8fe=hasChanges(_0x54a647);_0x34f8fe?(_0x3b18f5[_0x48fc7b(0x25a)][_0x48fc7b(0x1da)]({'name':_0x57d0d3[_0x48fc7b(0x1d3)]['service_type'],'action':_0x48fc7b(0x1be),'id':_0x1922ec['id'],'diff':formatDiffWithColors(_0x54a647)}),_0x3b18f5['counts'][_0x48fc7b(0x25a)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x25a)]['push']({'name':_0x57d0d3['yaml'][_0x48fc7b(0x21d)],'action':_0x48fc7b(0x1ff),'id':_0x1922ec['id']}),_0x3b18f5[_0x48fc7b(0x207)]['integrations'][_0x48fc7b(0x1ff)]++);}else _0x3b18f5['integrations'][_0x48fc7b(0x1da)]({'name':_0x57d0d3['yaml'][_0x48fc7b(0x21d)],'action':_0x48fc7b(0x25c)}),_0x3b18f5['counts'][_0x48fc7b(0x25a)][_0x48fc7b(0x25c)]++;}for(const _0x493992 of _0x3cf0ae){const _0x2498a4=_0x428f0f[_0x48fc7b(0x249)](_0x493992[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)]),_0x386b15=toExperimentalKnowledgeBaseYamlString(_0x493992[_0x48fc7b(0x22b)]);let _0x53e361=_0x386b15;for(const _0x113d28 of _0x493992['def'][_0x48fc7b(0x1b8)]){_0x53e361+=_0x48fc7b(0x16c)+_0x113d28[_0x48fc7b(0x1c3)]+_0x48fc7b(0x1b5)+_0x113d28[_0x48fc7b(0x225)]+'\x0a---\x20schema:\x20'+_0x113d28['name']+_0x48fc7b(0x1b5)+_0x113d28[_0x48fc7b(0x20e)]+'\x0a';}if(_0x2498a4){const _0x4ac92f=apiExperimentalKnowledgeBaseToYaml(_0x2498a4),_0x52bbde=toExperimentalKnowledgeBaseYamlString(_0x4ac92f);let _0x1b35c9=_0x52bbde;for(const _0x24f710 of _0x4ac92f[_0x48fc7b(0x1b8)]){_0x1b35c9+='\x0a---\x20function:\x20'+_0x24f710['name']+'\x20---\x0a'+_0x24f710[_0x48fc7b(0x225)]+_0x48fc7b(0x147)+_0x24f710[_0x48fc7b(0x1c3)]+_0x48fc7b(0x1b5)+_0x24f710[_0x48fc7b(0x20e)]+'\x0a';}const _0x6c38c7=generateDiff(_0x1b35c9,_0x53e361),_0x5e1e69=hasChanges(_0x6c38c7);_0x5e1e69?(_0x3b18f5['experimentalKnowledgeBases'][_0x48fc7b(0x1da)]({'name':_0x493992[_0x48fc7b(0x22b)]['name'],'action':'updated','id':_0x2498a4['id'],'diff':formatDiffWithColors(_0x6c38c7)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x217)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x217)]['push']({'name':_0x493992[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x2498a4['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x217)]['unchanged']++);}else _0x3b18f5[_0x48fc7b(0x217)][_0x48fc7b(0x1da)]({'name':_0x493992[_0x48fc7b(0x22b)]['name'],'action':'created'}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x217)][_0x48fc7b(0x25c)]++;}for(const _0x51389d of _0x66f9a5){const _0x5e44a6=_0x4b7fed[_0x48fc7b(0x249)](_0x51389d[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)]),_0x6b5191=toExperimentalArtifactYamlString(_0x51389d[_0x48fc7b(0x22b)]);let _0x37843c=_0x6b5191+(_0x48fc7b(0x245)+_0x51389d[_0x48fc7b(0x22b)]['code']+'\x0a');for(const _0x4e1b5d of _0x51389d[_0x48fc7b(0x22b)][_0x48fc7b(0x1d1)]){_0x37843c+=_0x48fc7b(0x151)+_0x4e1b5d[_0x48fc7b(0x1c7)]+_0x48fc7b(0x1b5)+_0x4e1b5d['text_content']+'\x0a';}if(_0x5e44a6){const _0x4399d1=apiExperimentalArtifactToYaml(_0x5e44a6),_0x4a6c16=toExperimentalArtifactYamlString(_0x4399d1);let _0x4a7d5b=_0x4a6c16+('\x0a---\x20code\x20---\x0a'+_0x4399d1[_0x48fc7b(0x225)]+'\x0a');for(const _0x10d662 of _0x4399d1[_0x48fc7b(0x1d1)]){_0x4a7d5b+=_0x48fc7b(0x151)+_0x10d662[_0x48fc7b(0x1c7)]+'\x20---\x0a'+_0x10d662[_0x48fc7b(0x208)]+'\x0a';}const _0x44f0db=generateDiff(_0x4a7d5b,_0x37843c),_0x26e93a=hasChanges(_0x44f0db);_0x26e93a?(_0x3b18f5[_0x48fc7b(0x1b3)][_0x48fc7b(0x1da)]({'name':_0x51389d[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':'updated','id':_0x5e44a6['id'],'diff':formatDiffWithColors(_0x44f0db)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1b3)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x1b3)][_0x48fc7b(0x1da)]({'name':_0x51389d['def'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x5e44a6['id']}),_0x3b18f5['counts'][_0x48fc7b(0x1b3)]['unchanged']++);}else _0x3b18f5[_0x48fc7b(0x1b3)][_0x48fc7b(0x1da)]({'name':_0x51389d[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c)}),_0x3b18f5['counts']['experimentalArtifacts'][_0x48fc7b(0x25c)]++;}for(const _0x746f55 of _0x40e69d){const _0x471bcb=_0x115cca['get'](_0x746f55[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)]),_0x54b9b8=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x746f55[_0x48fc7b(0x25d)],_0x48fc7b(0x189));if(_0x471bcb){const _0xecf7be=await apiFormInterfaceToYaml(_0x471bcb,_0x6e038c),_0x34a467=toFormInterfaceYamlString(_0xecf7be),_0x451821=generateDiff(_0x34a467,_0x54b9b8),_0x26f404=hasChanges(_0x451821);_0x26f404?(_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x746f55['yaml'][_0x48fc7b(0x1c3)],'action':'updated','id':_0x471bcb['id'],'diff':formatDiffWithColors(_0x451821)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x178)]['updated']++):(_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x746f55['yaml'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x471bcb['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x178)][_0x48fc7b(0x1ff)]++);}else _0x3b18f5['formInterfaces'][_0x48fc7b(0x1da)]({'name':_0x746f55['yaml'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c)}),_0x3b18f5['counts'][_0x48fc7b(0x178)][_0x48fc7b(0x25c)]++;}for(const _0x25ec3a of _0x35e986){const _0x1b89c3=_0x1480a0[_0x48fc7b(0x249)](_0x25ec3a[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)]),_0x12f4fd=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x25ec3a[_0x48fc7b(0x25d)],_0x48fc7b(0x189));if(_0x1b89c3){const _0x1f127e=await apiChatInterfaceToYaml(_0x1b89c3,_0x6e038c),_0x3b02f9=toChatInterfaceYamlString(_0x1f127e),_0x3da0d9=generateDiff(_0x3b02f9,_0x12f4fd),_0x351e5a=hasChanges(_0x3da0d9);_0x351e5a?(_0x3b18f5['chatInterfaces'][_0x48fc7b(0x1da)]({'name':_0x25ec3a['yaml']['name'],'action':'updated','id':_0x1b89c3['id'],'diff':formatDiffWithColors(_0x3da0d9)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x247)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x247)][_0x48fc7b(0x1da)]({'name':_0x25ec3a[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x1b89c3['id']}),_0x3b18f5[_0x48fc7b(0x207)]['chatInterfaces'][_0x48fc7b(0x1ff)]++);}else _0x3b18f5[_0x48fc7b(0x247)]['push']({'name':_0x25ec3a[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x247)][_0x48fc7b(0x25c)]++;}if(_0x4407a8?.[_0x48fc7b(0x234)])return _0x3b18f5;_0x3b18f5['knowledgeBases']=[],_0x3b18f5['textKnowledgeBases']=[],_0x3b18f5[_0x48fc7b(0x236)]=[],_0x3b18f5[_0x48fc7b(0x25a)]=[],_0x3b18f5[_0x48fc7b(0x217)]=[],_0x3b18f5[_0x48fc7b(0x1b3)]=[],_0x3b18f5[_0x48fc7b(0x178)]=[],_0x3b18f5[_0x48fc7b(0x247)]=[];const _0x8da56b=_0x3b18f5[_0x48fc7b(0x1e7)][_0x48fc7b(0x146)](_0x30d38b=>_0x30d38b[_0x48fc7b(0x226)]===_0x48fc7b(0x171));_0x3b18f5['agents']=_0x8da56b,_0x3b18f5['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x8da56b[_0x48fc7b(0x212)]},'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 _0x4bd44e of _0x269704){try{const _0x11be39=_0x4b6e1a[_0x48fc7b(0x249)](_0x4bd44e[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)]),_0x407c4c=yamlKnowledgeBaseToApi(_0x4bd44e[_0x48fc7b(0x1d3)],_0x23e555);if(_0x11be39)await this[_0x48fc7b(0x18a)][_0x48fc7b(0x230)](_0x11be39['id'],_0x407c4c),_0x3035cf[_0x48fc7b(0x199)](_0x4bd44e[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],_0x11be39['id']),_0x3b18f5['knowledgeBases']['push']({'name':_0x4bd44e['yaml']['name'],'action':_0x48fc7b(0x1be),'id':_0x11be39['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x252)][_0x48fc7b(0x1be)]++;else{const _0x422197=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x1f2)](_0x407c4c);_0x3035cf[_0x48fc7b(0x199)](_0x4bd44e[_0x48fc7b(0x1d3)]['name'],_0x422197['id']),_0x3b18f5[_0x48fc7b(0x252)][_0x48fc7b(0x1da)]({'name':_0x4bd44e[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c),'id':_0x422197['id']}),_0x3b18f5[_0x48fc7b(0x207)]['knowledgeBases'][_0x48fc7b(0x25c)]++;}}catch(_0x238a8d){_0x3b18f5[_0x48fc7b(0x252)][_0x48fc7b(0x1da)]({'name':_0x4bd44e[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0x238a8d['message']}),_0x3b18f5[_0x48fc7b(0x207)]['knowledgeBases'][_0x48fc7b(0x156)]++;}}for(const _0xf1a01e of _0x5bf5de){try{const _0x5c0da7=_0x2d4773[_0x48fc7b(0x249)](_0xf1a01e[_0x48fc7b(0x1c3)]),_0x1e56e6=yamlTextKnowledgeBaseToApi({'name':_0xf1a01e[_0x48fc7b(0x1c3)],'text':_0xf1a01e[_0x48fc7b(0x248)]},_0x23e555);if(_0x5c0da7)await this[_0x48fc7b(0x18a)]['updateTextKnowledgeBase'](_0x5c0da7['id'],_0x1e56e6),_0x14c757[_0x48fc7b(0x199)](_0xf1a01e[_0x48fc7b(0x1c3)],_0x5c0da7['id']),_0x3b18f5['textKnowledgeBases'][_0x48fc7b(0x1da)]({'name':_0xf1a01e[_0x48fc7b(0x1c3)],'action':'updated','id':_0x5c0da7['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1a9)][_0x48fc7b(0x1be)]++;else{const _0x223376=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x219)](_0x1e56e6);_0x14c757[_0x48fc7b(0x199)](_0xf1a01e[_0x48fc7b(0x1c3)],_0x223376['id']),_0x3b18f5['textKnowledgeBases'][_0x48fc7b(0x1da)]({'name':_0xf1a01e[_0x48fc7b(0x1c3)],'action':'created','id':_0x223376['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1a9)][_0x48fc7b(0x25c)]++;}}catch(_0x2e5710){_0x3b18f5[_0x48fc7b(0x1a9)][_0x48fc7b(0x1da)]({'name':_0xf1a01e[_0x48fc7b(0x1c3)],'action':'error','error':_0x2e5710[_0x48fc7b(0x250)]}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1a9)]['errors']++;}}for(const _0x27f4b8 of _0x3cf0ae){try{const _0x19da63=_0x428f0f[_0x48fc7b(0x249)](_0x27f4b8[_0x48fc7b(0x22b)]['name']),_0x123b27=yamlExperimentalKnowledgeBaseToApi(_0x27f4b8['def'],_0x23e555);if(_0x19da63)await this[_0x48fc7b(0x18a)]['updateExperimentalKnowledgeBase'](_0x19da63['id'],_0x123b27),_0x139ed9[_0x48fc7b(0x199)](_0x27f4b8[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],_0x19da63['id']),_0x3b18f5[_0x48fc7b(0x217)]['push']({'name':_0x27f4b8[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x19da63['id']}),_0x3b18f5[_0x48fc7b(0x207)]['experimentalKnowledgeBases'][_0x48fc7b(0x1be)]++;else{const _0x6951b8=await this[_0x48fc7b(0x18a)]['createExperimentalKnowledgeBase'](_0x123b27);_0x139ed9[_0x48fc7b(0x199)](_0x27f4b8[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],_0x6951b8['id']),_0x3b18f5['experimentalKnowledgeBases'][_0x48fc7b(0x1da)]({'name':_0x27f4b8[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c),'id':_0x6951b8['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x217)][_0x48fc7b(0x25c)]++;}}catch(_0x52ca62){_0x3b18f5[_0x48fc7b(0x217)][_0x48fc7b(0x1da)]({'name':_0x27f4b8[_0x48fc7b(0x22b)]['name'],'action':_0x48fc7b(0x171),'error':_0x52ca62[_0x48fc7b(0x250)]}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x217)]['errors']++;}}for(const _0xb0b1d4 of _0x66f9a5){try{const _0x57df91=_0x4b7fed[_0x48fc7b(0x249)](_0xb0b1d4[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)]),_0x497a89=yamlExperimentalArtifactToApi(_0xb0b1d4[_0x48fc7b(0x22b)],_0x23e555);if(_0x57df91)await this[_0x48fc7b(0x18a)][_0x48fc7b(0x193)](_0x57df91['id'],_0x497a89),_0x17ecfc[_0x48fc7b(0x199)](_0xb0b1d4[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],_0x57df91['id']),_0x3b18f5['experimentalArtifacts']['push']({'name':_0xb0b1d4['def'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x57df91['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1b3)][_0x48fc7b(0x1be)]++;else{const _0x54d124=await this['client'][_0x48fc7b(0x1a6)](_0x497a89);_0x17ecfc[_0x48fc7b(0x199)](_0xb0b1d4[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],_0x54d124['id']),_0x3b18f5[_0x48fc7b(0x1b3)][_0x48fc7b(0x1da)]({'name':_0xb0b1d4[_0x48fc7b(0x22b)]['name'],'action':_0x48fc7b(0x25c),'id':_0x54d124['id']}),_0x3b18f5['counts'][_0x48fc7b(0x1b3)][_0x48fc7b(0x25c)]++;}}catch(_0x4afc51){_0x3b18f5[_0x48fc7b(0x1b3)][_0x48fc7b(0x1da)]({'name':_0xb0b1d4[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0x4afc51[_0x48fc7b(0x250)]}),_0x3b18f5[_0x48fc7b(0x207)]['experimentalArtifacts'][_0x48fc7b(0x156)]++;}}for(const _0x319ec1 of _0x5d561a){_0x288a85=[];try{const _0xa8626a=_0x4ce081[_0x48fc7b(0x249)](_0x319ec1[_0x48fc7b(0x1d3)]['name']),_0x4b4ce4=await agentDefToRequest(_0x319ec1[_0x48fc7b(0x1d3)],_0x319ec1[_0x48fc7b(0x16f)],_0x319ec1['starterMessage'],_0x50df6e);if(_0xa8626a)await this['client'][_0x48fc7b(0x237)](_0xa8626a['id'],_0x4b4ce4),_0x4315f6['set'](_0x319ec1['yaml'][_0x48fc7b(0x1c3)],_0xa8626a['id']),_0x3b18f5[_0x48fc7b(0x1e7)][_0x48fc7b(0x1da)]({'agentName':_0x319ec1['yaml'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'agentId':_0xa8626a['id'],'warnings':_0x288a85[_0x48fc7b(0x212)]>0x0?_0x288a85:undefined}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1e7)][_0x48fc7b(0x1be)]++;else{const _0x27e519=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x1eb)](_0x4b4ce4);_0x4315f6['set'](_0x319ec1[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],_0x27e519['id']),_0x3b18f5[_0x48fc7b(0x1e7)]['push']({'agentName':_0x319ec1[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c),'agentId':_0x27e519['id'],'warnings':_0x288a85[_0x48fc7b(0x212)]>0x0?_0x288a85:undefined}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1e7)][_0x48fc7b(0x25c)]++;}}catch(_0x2a40f0){_0x3b18f5[_0x48fc7b(0x1e7)]['push']({'agentName':_0x319ec1[_0x48fc7b(0x1d3)]['name'],'action':'error','error':_0x2a40f0[_0x48fc7b(0x250)],'warnings':_0x288a85[_0x48fc7b(0x212)]>0x0?_0x288a85:undefined}),_0x3b18f5[_0x48fc7b(0x207)]['agents']['errors']++;}}for(const _0x3317c7 of _0x262d1a){try{const _0x5d66fa=_0x4f9c4c[_0x48fc7b(0x249)](_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)]),_0x53cd1e=await yamlPromptToApi(_0x3317c7[_0x48fc7b(0x1d3)],_0x23e555,_0x50df6e);if(!_0x53cd1e){_0x3b18f5[_0x48fc7b(0x236)]['push']({'name':_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0x48fc7b(0x1a5)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)]['errors']++;continue;}if(_0x5d66fa)await this['client']['updatePrompt'](_0x5d66fa['id'],_0x53cd1e),_0x167009[_0x48fc7b(0x199)](_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],_0x5d66fa['id']),_0x3b18f5['prompts'][_0x48fc7b(0x1da)]({'name':_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x5d66fa['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)][_0x48fc7b(0x1be)]++;else{const _0x1d2bde=await this['client'][_0x48fc7b(0x17e)](_0x53cd1e);_0x167009[_0x48fc7b(0x199)](_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],_0x1d2bde['id']),_0x3b18f5[_0x48fc7b(0x236)][_0x48fc7b(0x1da)]({'name':_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c),'id':_0x1d2bde['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)]['created']++;}}catch(_0x1361fc){_0x3b18f5[_0x48fc7b(0x236)][_0x48fc7b(0x1da)]({'name':_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0x1361fc[_0x48fc7b(0x250)]}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)][_0x48fc7b(0x156)]++;}}for(const _0x27c536 of _0x2d98be){try{const _0x4fb67c=_0x3439ff[_0x48fc7b(0x249)](_0x27c536[_0x48fc7b(0x1d3)][_0x48fc7b(0x21d)]),_0x3302bc=await yamlIntegrationToApi(_0x27c536[_0x48fc7b(0x1d3)],_0x23e555,_0x50df6e);if(_0x4fb67c){await this['client'][_0x48fc7b(0x1e1)](_0x4fb67c['id']);const _0x1069bd=await this['client'][_0x48fc7b(0x25b)](_0x3302bc);_0x3b18f5[_0x48fc7b(0x25a)][_0x48fc7b(0x1da)]({'name':_0x27c536[_0x48fc7b(0x1d3)]['service_type'],'action':_0x48fc7b(0x1be),'id':_0x1069bd['id']}),_0x3b18f5['counts'][_0x48fc7b(0x25a)][_0x48fc7b(0x1be)]++;}else{const _0x496302=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x25b)](_0x3302bc);_0x3b18f5['integrations'][_0x48fc7b(0x1da)]({'name':_0x27c536[_0x48fc7b(0x1d3)][_0x48fc7b(0x21d)],'action':_0x48fc7b(0x25c),'id':_0x496302['id']}),_0x3b18f5[_0x48fc7b(0x207)]['integrations'][_0x48fc7b(0x25c)]++;}}catch(_0x2fbbf1){_0x3b18f5[_0x48fc7b(0x25a)]['push']({'name':_0x27c536[_0x48fc7b(0x1d3)]['service_type'],'action':_0x48fc7b(0x171),'error':_0x2fbbf1[_0x48fc7b(0x250)]}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x25a)][_0x48fc7b(0x156)]++;}}for(const _0x269fb6 of _0x40e69d){try{const _0x310fb9=_0x115cca[_0x48fc7b(0x249)](_0x269fb6[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)]),_0x4fee2b=await yamlFormInterfaceToApi(_0x269fb6[_0x48fc7b(0x1d3)],_0x23e555,_0x50df6e);if(!_0x4fee2b){_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x269fb6[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':'error','error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x3b18f5['counts'][_0x48fc7b(0x178)]['errors']++;continue;}if(_0x310fb9){const _0x52fa09=await this['client']['updateFormInterface'](_0x310fb9['id'],_0x4fee2b);_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x269fb6[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x52fa09['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x178)][_0x48fc7b(0x1be)]++;}else{const _0x550dce=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x22c)](_0x4fee2b);_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x269fb6['yaml']['name'],'action':'created','id':_0x550dce['id']}),_0x3b18f5['counts'][_0x48fc7b(0x178)]['created']++;}}catch(_0xb12a2d){_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x269fb6[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0xb12a2d['message']}),_0x3b18f5[_0x48fc7b(0x207)]['formInterfaces']['errors']++;}}for(const _0x560795 of _0x35e986){try{const _0x19e4f5=_0x1480a0[_0x48fc7b(0x249)](_0x560795['yaml']['name']),_0x13f636=await yamlChatInterfaceToApi(_0x560795[_0x48fc7b(0x1d3)],_0x23e555,_0x50df6e);if(_0x19e4f5){const _0x2355a7=await this[_0x48fc7b(0x18a)]['updateChatInterface'](_0x19e4f5['id'],_0x13f636);_0x3b18f5['chatInterfaces'][_0x48fc7b(0x1da)]({'name':_0x560795[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x2355a7['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x247)][_0x48fc7b(0x1be)]++;}else{const _0x16de73=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x13d)](_0x13f636);_0x3b18f5[_0x48fc7b(0x247)][_0x48fc7b(0x1da)]({'name':_0x560795['yaml'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c),'id':_0x16de73['id']}),_0x3b18f5['counts'][_0x48fc7b(0x247)][_0x48fc7b(0x25c)]++;}}catch(_0x450958){_0x3b18f5['chatInterfaces'][_0x48fc7b(0x1da)]({'name':_0x560795[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0x450958[_0x48fc7b(0x250)]}),_0x3b18f5['counts'][_0x48fc7b(0x247)][_0x48fc7b(0x156)]++;}}return _0x3b18f5;}async[a133_0xe8af3(0x13f)](_0x4e8bb6,_0x53d3cb,_0x4bc397,_0x5ca258){const _0x22ac66=a133_0xe8af3,{projectId:_0x2d7ab8,project:_0x50d93a}=await this[_0x22ac66(0x14e)](_0x4e8bb6),_0x34b0f5=_0x50d93a['attributes'][_0x22ac66(0x1c3)],_0x36c30c=await this[_0x22ac66(0x18a)][_0x22ac66(0x1d8)](_0x2d7ab8),_0x5b085c=_0x36c30c[_0x22ac66(0x1a2)](_0x45a593=>_0x45a593['attributes']['name']===_0x53d3cb);if(!_0x5b085c)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x22ac66(0x185)+_0x53d3cb,undefined,{'helpText':'Available\x20agents:\x20'+_0x36c30c[_0x22ac66(0x150)](_0x8aa71=>_0x8aa71['attributes'][_0x22ac66(0x1c3)])[_0x22ac66(0x1e6)](',\x20')});let _0x18151f;if(_0x4bc397)_0x18151f=_0x4bc397;else{const _0x574463=a133_0xcf5d58[_0x22ac66(0x1e6)](process[_0x22ac66(0x15d)](),'agents'),_0x21f35b=getSanitizedPathWithMigration(_0x574463,_0x34b0f5);_0x21f35b[_0x22ac66(0x1d7)]&&this[_0x22ac66(0x157)][_0x22ac66(0x1ed)]('Renamed\x20folder:\x20'+a133_0xcf5d58['basename'](_0x21f35b[_0x22ac66(0x251)])+'\x20→\x20'+a133_0xcf5d58[_0x22ac66(0x1c8)](_0x21f35b[_0x22ac66(0x25d)])),_0x18151f=_0x21f35b['path'];}const _0x4d8e2e=getSanitizedPathWithMigration(_0x18151f,_0x53d3cb);_0x4d8e2e[_0x22ac66(0x1d7)]&&this[_0x22ac66(0x157)][_0x22ac66(0x1ed)](_0x22ac66(0x20b)+a133_0xcf5d58[_0x22ac66(0x1c8)](_0x4d8e2e[_0x22ac66(0x251)])+'\x20→\x20'+a133_0xcf5d58[_0x22ac66(0x1c8)](_0x4d8e2e['path']));const _0x402a28=_0x4d8e2e[_0x22ac66(0x25d)],_0x164f5a=new Map(),_0x51013d=new Map(),_0x49691d=await this[_0x22ac66(0x18a)]['listKnowledgeBases'](_0x2d7ab8),_0x40ea9d=await this[_0x22ac66(0x18a)][_0x22ac66(0x239)](_0x2d7ab8),_0xb93d55=await safeListOrEmpty(()=>this[_0x22ac66(0x18a)]['listExperimentalKnowledgeBases'](_0x2d7ab8)),_0x5d8e68=new Map(),_0x2df07f=new Map();for(const _0x51a528 of _0x49691d){_0x164f5a['set'](_0x51a528['id'],_0x51a528[_0x22ac66(0x222)][_0x22ac66(0x1c3)]);}for(const _0x2b2eae of _0x40ea9d){_0x5d8e68[_0x22ac66(0x199)](_0x2b2eae['id'],_0x2b2eae[_0x22ac66(0x222)]['name']);}for(const _0x520639 of _0xb93d55){_0x2df07f[_0x22ac66(0x199)](_0x520639['id'],_0x520639['attributes']['name']);}for(const _0x5a808a of _0x36c30c){_0x51013d['set'](_0x5a808a['id'],_0x5a808a[_0x22ac66(0x222)][_0x22ac66(0x1c3)]);}const _0x3a4b8f={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x164f5a,'TextKnowledgeBase':_0x5d8e68,'Agent':_0x51013d,'ExperimentalKnowledgeBase':_0x2df07f}),'resolvePromptName':async()=>undefined,'onWarning':_0x2081d1=>this[_0x22ac66(0x157)]['warn'](_0x2081d1)},_0x119e38=a133_0xcf5d58[_0x22ac66(0x1e6)](_0x402a28,_0x22ac66(0x1d5)),_0x24c7a9=a133_0xcf5d58['join'](_0x402a28,'agent.yml'),_0x3a6119=a133_0xcf5d58[_0x22ac66(0x1e6)](_0x402a28,_0x22ac66(0x1fd)),_0x7dfd80=!a133_0x8c5550['existsSync'](_0x24c7a9);if(_0x5ca258?.[_0x22ac66(0x234)])return{'agentName':_0x53d3cb,'outputPath':_0x402a28,'isNew':_0x7dfd80,'hasChanges':!![]};a133_0x8c5550['mkdirSync'](_0x18151f,{'recursive':!![]}),a133_0x8c5550[_0x22ac66(0x1e4)](_0x402a28,{'recursive':!![]});const _0x2cb5dc=a133_0xcf5d58[_0x22ac66(0x1e6)](_0x18151f,'tdx.json');!a133_0x8c5550[_0x22ac66(0x229)](_0x2cb5dc)&&a133_0x8c5550[_0x22ac66(0x22f)](_0x2cb5dc,createAgentConfigContent(_0x4e8bb6));const {yaml:_0x16021d,systemPrompt:_0x1ba8fa,starterMessage:_0x10fea5}=await agentResponseToDef(_0x5b085c,_0x3a4b8f);let _0x31ea9a=_0x7dfd80;if(!_0x7dfd80){const _0x2d9c4c=a133_0x8c5550[_0x22ac66(0x229)](_0x119e38)?a133_0x8c5550[_0x22ac66(0x1b1)](_0x119e38,_0x22ac66(0x189)):'',_0x3bfb5e=a133_0x8c5550['readFileSync'](_0x24c7a9,'utf-8');_0x31ea9a=_0x2d9c4c!==_0x1ba8fa||_0x3bfb5e!==toAgentYamlString(_0x16021d);}a133_0x8c5550[_0x22ac66(0x22f)](_0x119e38,_0x1ba8fa),a133_0x8c5550[_0x22ac66(0x22f)](_0x24c7a9,toAgentYamlString(_0x16021d));if(_0x10fea5&&_0x10fea5[_0x22ac66(0x16a)]('\x0a'))a133_0x8c5550['writeFileSync'](_0x3a6119,_0x10fea5);else a133_0x8c5550[_0x22ac66(0x229)](_0x3a6119)&&a133_0x8c5550[_0x22ac66(0x1c1)](_0x3a6119);return{'agentName':_0x53d3cb,'outputPath':_0x402a28,'isNew':_0x7dfd80,'hasChanges':_0x31ea9a};}async['pushAgent'](_0x469145,_0x505b5c){const _0x2cb9e1=a133_0xe8af3;let _0x2f2b8e;isAgentYamlPath(_0x469145)?_0x2f2b8e=getAgentDirFromYamlPath(_0x469145):_0x2f2b8e=_0x469145;const {config:_0x291bae}=findAgentConfig(_0x2f2b8e),_0x5b1084=await this[_0x2cb9e1(0x1c5)](_0x291bae[_0x2cb9e1(0x181)]),_0x103dea=a133_0xcf5d58[_0x2cb9e1(0x1e6)](_0x2f2b8e,_0x2cb9e1(0x198)),_0x1b8c72=a133_0xcf5d58[_0x2cb9e1(0x1e6)](_0x2f2b8e,_0x2cb9e1(0x1d5)),_0x4c3a32=a133_0xcf5d58[_0x2cb9e1(0x1e6)](_0x2f2b8e,_0x2cb9e1(0x1fd));if(!a133_0x8c5550[_0x2cb9e1(0x229)](_0x103dea))throw new SDKError(ErrorCode['NOT_FOUND'],_0x2cb9e1(0x177)+_0x2f2b8e,undefined,{'helpText':_0x2cb9e1(0x13a)});const _0x3343b4=parseAgentYaml(a133_0x8c5550[_0x2cb9e1(0x1b1)](_0x103dea,_0x2cb9e1(0x189)),_0x103dea),_0x3e0972=a133_0x8c5550[_0x2cb9e1(0x229)](_0x1b8c72)?a133_0x8c5550['readFileSync'](_0x1b8c72,_0x2cb9e1(0x189)):'',_0x58bd2e=a133_0x8c5550[_0x2cb9e1(0x229)](_0x4c3a32)?a133_0x8c5550[_0x2cb9e1(0x1b1)](_0x4c3a32,_0x2cb9e1(0x189)):_0x3343b4['starter_message'];if(_0x505b5c?.[_0x2cb9e1(0x234)])return{'agentName':_0x3343b4[_0x2cb9e1(0x1c3)],'action':'created','projectId':_0x5b1084};const _0x7ff6a3=await this[_0x2cb9e1(0x18a)]['listAgentsFull'](_0x5b1084),_0x521d82=await fetchAllToolTargetMaps((_0xd7d10f,_0xc4acad)=>this[_0x2cb9e1(0x18a)][_0x2cb9e1(0x24b)](_0xd7d10f,_0xc4acad),_0x5b1084),_0x21cca7=new Map();for(const _0x2567fc of _0x7ff6a3){_0x21cca7[_0x2cb9e1(0x199)](_0x2567fc['attributes'][_0x2cb9e1(0x1c3)],_0x2567fc['id']);}const _0x34fd76=[],_0x4d7370={'projectId':_0x5b1084,'resolveToolTargetId':buildIdResolver({..._0x521d82[_0x2cb9e1(0x23f)],'Agent':_0x21cca7}),'resolvePromptId':async()=>undefined,'onWarning':_0x46c8d1=>{const _0x1b0a45=_0x2cb9e1;this['logger']['warn'](_0x46c8d1),_0x34fd76[_0x1b0a45(0x1da)](_0x46c8d1);}};try{const _0x258cf8=_0x7ff6a3[_0x2cb9e1(0x1a2)](_0xa4cf73=>_0xa4cf73[_0x2cb9e1(0x222)]['name']===_0x3343b4[_0x2cb9e1(0x1c3)]),_0x49b267=await agentDefToRequest(_0x3343b4,_0x3e0972,_0x58bd2e,_0x4d7370);if(_0x258cf8)return await this[_0x2cb9e1(0x18a)][_0x2cb9e1(0x237)](_0x258cf8['id'],_0x49b267),{'agentName':_0x3343b4['name'],'action':_0x2cb9e1(0x1be),'projectId':_0x5b1084,'agentId':_0x258cf8['id'],'warnings':_0x34fd76[_0x2cb9e1(0x212)]>0x0?_0x34fd76:undefined};else{const _0xa96a75=await this['client'][_0x2cb9e1(0x1eb)](_0x49b267);return{'agentName':_0x3343b4[_0x2cb9e1(0x1c3)],'action':'created','projectId':_0x5b1084,'agentId':_0xa96a75['id'],'warnings':_0x34fd76['length']>0x0?_0x34fd76:undefined};}}catch(_0x1b218e){return{'agentName':_0x3343b4[_0x2cb9e1(0x1c3)],'action':_0x2cb9e1(0x171),'projectId':_0x5b1084,'error':_0x1b218e[_0x2cb9e1(0x250)],'warnings':_0x34fd76['length']>0x0?_0x34fd76:undefined};}}async[a133_0xe8af3(0x140)](_0x87f541,_0x266a35,_0x85bd8f){const _0x48f258=a133_0xe8af3,_0x33b353=a133_0x8c5550['existsSync'](_0x87f541)&&a133_0x8c5550[_0x48f258(0x229)](a133_0xcf5d58[_0x48f258(0x1e6)](_0x87f541,_0x48f258(0x243)));let _0x3f88d0;const _0x7c8a5=[],_0x2513fd=[],_0x3cc725=[],_0x526bdd=[],_0x9fd8b5=[],_0x1355c9=[],_0x451242=[],_0x40622e=[],_0x2b92c6=[];if(_0x33b353){const _0x40c67c=loadAgentConfig(a133_0xcf5d58[_0x48f258(0x1e6)](_0x87f541,_0x48f258(0x243)));_0x3f88d0=_0x40c67c[_0x48f258(0x181)];const _0x34ace1=a133_0x8c5550[_0x48f258(0x1ee)](_0x87f541,{'withFileTypes':!![]});for(const _0x311755 of _0x34ace1){if(!_0x311755[_0x48f258(0x24c)]())continue;if([_0x48f258(0x21f),_0x48f258(0x196),_0x48f258(0x175),_0x48f258(0x236),_0x48f258(0x25a),_0x48f258(0x174),_0x48f258(0x1a1)][_0x48f258(0x16a)](_0x311755[_0x48f258(0x1c3)]))continue;const _0x318afa=a133_0xcf5d58[_0x48f258(0x1e6)](_0x87f541,_0x311755[_0x48f258(0x1c3)]);if(isAgentDir(_0x318afa)){const _0x246237=a133_0xcf5d58[_0x48f258(0x1e6)](_0x318afa,'agent.yml'),_0x453ce9=a133_0xcf5d58[_0x48f258(0x1e6)](_0x318afa,_0x48f258(0x1d5)),_0x7e19c4=a133_0xcf5d58['join'](_0x318afa,_0x48f258(0x1fd)),_0x33e91f=parseAgentYaml(a133_0x8c5550['readFileSync'](_0x246237,_0x48f258(0x189)),_0x246237),_0x5da86a=a133_0x8c5550[_0x48f258(0x229)](_0x453ce9)?a133_0x8c5550[_0x48f258(0x1b1)](_0x453ce9,_0x48f258(0x189)):'',_0x2b6a3e=a133_0x8c5550[_0x48f258(0x229)](_0x7e19c4)?a133_0x8c5550[_0x48f258(0x1b1)](_0x7e19c4,_0x48f258(0x189)):_0x33e91f['starter_message'];_0x7c8a5[_0x48f258(0x1da)]({'name':_0x33e91f[_0x48f258(0x1c3)],'dir':_0x318afa,'yaml':_0x33e91f,'systemPrompt':_0x5da86a,'starterMessage':_0x2b6a3e});}}const _0x58fd86=getKnowledgeBasesDir(_0x87f541);if(a133_0x8c5550['existsSync'](_0x58fd86)){const _0x55485b=a133_0x8c5550[_0x48f258(0x1ee)](_0x58fd86);for(const _0x328417 of _0x55485b){const _0x584b4b=a133_0xcf5d58['join'](_0x58fd86,_0x328417);if(_0x328417['endsWith']('.yml')){const _0x2cb780=parseKnowledgeBaseYaml(a133_0x8c5550['readFileSync'](_0x584b4b,_0x48f258(0x189)),_0x584b4b);_0x2513fd['push']({'name':_0x2cb780[_0x48f258(0x1c3)],'path':_0x584b4b,'yaml':_0x2cb780});}else{if(_0x328417[_0x48f258(0x1b9)](_0x48f258(0x1fb))){const _0x5edcb4=a133_0x8c5550[_0x48f258(0x1b1)](_0x584b4b,'utf-8'),{name:_0x450474,text:_0x59e86c}=parseTextKnowledgeBaseMd(_0x5edcb4,_0x328417);_0x3cc725['push']({'name':_0x450474,'path':_0x584b4b,'text':_0x59e86c});}}}}const _0x329c92=getPromptsDir(_0x87f541);if(a133_0x8c5550['existsSync'](_0x329c92)){const _0x223aff=a133_0x8c5550[_0x48f258(0x1ee)](_0x329c92)[_0x48f258(0x146)](_0x11433e=>_0x11433e[_0x48f258(0x1b9)](_0x48f258(0x218)));for(const _0x16fdd5 of _0x223aff){const _0x240ccd=a133_0xcf5d58[_0x48f258(0x1e6)](_0x329c92,_0x16fdd5),_0x5b668e=parsePromptYaml(a133_0x8c5550['readFileSync'](_0x240ccd,_0x48f258(0x189)),_0x240ccd);_0x526bdd[_0x48f258(0x1da)]({'name':_0x5b668e['name'],'path':_0x240ccd,'yaml':_0x5b668e});}}const _0x457af0=getIntegrationsDir(_0x87f541);if(a133_0x8c5550[_0x48f258(0x229)](_0x457af0)){const _0x4320bc=a133_0x8c5550['readdirSync'](_0x457af0)[_0x48f258(0x146)](_0x5309a9=>_0x5309a9[_0x48f258(0x1b9)]('.yml'));for(const _0x34e212 of _0x4320bc){const _0x5b0e11=a133_0xcf5d58['join'](_0x457af0,_0x34e212),_0x2453b9=parseIntegrationYaml(a133_0x8c5550[_0x48f258(0x1b1)](_0x5b0e11,'utf-8'),_0x5b0e11);SAFE_INTEGRATION_TYPES[_0x48f258(0x16a)](_0x2453b9['service_type'][_0x48f258(0x153)]())?_0x9fd8b5[_0x48f258(0x1da)]({'name':_0x2453b9[_0x48f258(0x1c3)],'path':_0x5b0e11,'yaml':_0x2453b9}):this[_0x48f258(0x157)][_0x48f258(0x14b)](_0x48f258(0x14c)+_0x2453b9[_0x48f258(0x1c3)]+_0x48f258(0x227)+_0x2453b9['service_type']+_0x48f258(0x1ad)+(_0x48f258(0x176)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x48f258(0x14f)));}}const _0x399898=getExperimentalKnowledgeBasesDir(_0x87f541);if(a133_0x8c5550['existsSync'](_0x399898)){const _0x1dae39=a133_0x8c5550[_0x48f258(0x1ee)](_0x399898,{'withFileTypes':!![]});for(const _0x385f10 of _0x1dae39){if(!_0x385f10[_0x48f258(0x24c)]())continue;const _0xba7d3=a133_0xcf5d58[_0x48f258(0x1e6)](_0x399898,_0x385f10['name']),_0x4f5d31=a133_0xcf5d58[_0x48f258(0x1e6)](_0xba7d3,_0x385f10[_0x48f258(0x1c3)]+_0x48f258(0x218));if(a133_0x8c5550['existsSync'](_0x4f5d31)){const _0x1329a7=parseExperimentalKnowledgeBaseYaml(a133_0x8c5550[_0x48f258(0x1b1)](_0x4f5d31,_0x48f258(0x189)),_0x4f5d31),_0x548f1c=a133_0xcf5d58[_0x48f258(0x1e6)](_0xba7d3,_0x48f258(0x1b8)),_0x171782=[];if(a133_0x8c5550[_0x48f258(0x229)](_0x548f1c)){const _0x152a62=a133_0x8c5550[_0x48f258(0x1ee)](_0x548f1c,{'withFileTypes':!![]});for(const _0x43bb0a of _0x152a62){if(!_0x43bb0a['isDirectory']())continue;const _0x1b011f=a133_0xcf5d58['join'](_0x548f1c,_0x43bb0a[_0x48f258(0x1c3)]),_0x1dd559=a133_0xcf5d58[_0x48f258(0x1e6)](_0x1b011f,_0x48f258(0x20a)),_0x415eaf=a133_0xcf5d58[_0x48f258(0x1e6)](_0x1b011f,_0x48f258(0x145));if(a133_0x8c5550[_0x48f258(0x229)](_0x1dd559)&&a133_0x8c5550[_0x48f258(0x229)](_0x415eaf)){const _0x44d0f5=a133_0x8c5550[_0x48f258(0x1b1)](_0x1dd559,_0x48f258(0x189)),_0xde0610=a133_0x8c5550[_0x48f258(0x1b1)](_0x415eaf,_0x48f258(0x189));_0x171782['push']({'name':_0x43bb0a[_0x48f258(0x1c3)],'code':_0x44d0f5,'json_schema':_0xde0610});}}}const _0x20eb07={..._0x1329a7,'functions':_0x171782};_0x1355c9['push']({'name':_0x1329a7[_0x48f258(0x1c3)],'path':_0xba7d3,'def':_0x20eb07});}}}const _0x2a0adb=getExperimentalArtifactsDir(_0x87f541);if(a133_0x8c5550['existsSync'](_0x2a0adb)){const _0xeb351e=a133_0x8c5550[_0x48f258(0x1ee)](_0x2a0adb,{'withFileTypes':!![]});for(const _0x3c2a62 of _0xeb351e){if(!_0x3c2a62['isDirectory']())continue;const _0x3ebafd=a133_0xcf5d58['join'](_0x2a0adb,_0x3c2a62['name']),_0x5ea449=a133_0xcf5d58['join'](_0x3ebafd,_0x3c2a62['name']+_0x48f258(0x218));if(a133_0x8c5550['existsSync'](_0x5ea449)){const _0x509c95=parseExperimentalArtifactYaml(a133_0x8c5550[_0x48f258(0x1b1)](_0x5ea449,_0x48f258(0x189)),_0x5ea449),_0x54d9cb=a133_0xcf5d58['join'](_0x3ebafd,_0x48f258(0x20a)),_0xb845d9=a133_0x8c5550['existsSync'](_0x54d9cb)?a133_0x8c5550[_0x48f258(0x1b1)](_0x54d9cb,_0x48f258(0x189)):'',_0x42c387=a133_0xcf5d58[_0x48f258(0x1e6)](_0x3ebafd,_0x48f258(0x1d1)),_0x2a4d50=[];if(a133_0x8c5550[_0x48f258(0x229)](_0x42c387)){const _0x704865=a133_0x8c5550[_0x48f258(0x1ee)](_0x42c387);for(const _0x38ca1c of _0x704865){const _0x307ef8=a133_0xcf5d58[_0x48f258(0x1e6)](_0x42c387,_0x38ca1c);if(a133_0x8c5550['statSync'](_0x307ef8)[_0x48f258(0x166)]()){const _0x55e221=a133_0x8c5550[_0x48f258(0x1b1)](_0x307ef8,_0x48f258(0x189));_0x2a4d50[_0x48f258(0x1da)]({'file_name':_0x38ca1c,'text_content':_0x55e221});}}}const _0x13bb0d={..._0x509c95,'code':_0xb845d9,'files':_0x2a4d50};_0x451242[_0x48f258(0x1da)]({'name':_0x509c95[_0x48f258(0x1c3)],'path':_0x3ebafd,'def':_0x13bb0d});}}}const _0x225705=getFormInterfacesDir(_0x87f541);if(a133_0x8c5550[_0x48f258(0x229)](_0x225705)){const _0x225202=a133_0x8c5550['readdirSync'](_0x225705)[_0x48f258(0x146)](_0x16817d=>_0x16817d['endsWith'](_0x48f258(0x218)));for(const _0x1c5a9a of _0x225202){const _0x760055=a133_0xcf5d58[_0x48f258(0x1e6)](_0x225705,_0x1c5a9a),_0x3b56c8=parseFormInterfaceYaml(a133_0x8c5550[_0x48f258(0x1b1)](_0x760055,_0x48f258(0x189)),_0x760055);_0x40622e[_0x48f258(0x1da)]({'name':_0x3b56c8[_0x48f258(0x1c3)],'path':_0x760055,'yaml':_0x3b56c8});}}const _0x44192c=getChatInterfacesDir(_0x87f541);if(a133_0x8c5550[_0x48f258(0x229)](_0x44192c)){const _0x25594f=a133_0x8c5550[_0x48f258(0x1ee)](_0x44192c)[_0x48f258(0x146)](_0x1e397b=>_0x1e397b[_0x48f258(0x1b9)](_0x48f258(0x218)));for(const _0x85b321 of _0x25594f){const _0xa3e8d6=a133_0xcf5d58['join'](_0x44192c,_0x85b321),_0x15ce7e=parseChatInterfaceYaml(a133_0x8c5550[_0x48f258(0x1b1)](_0xa3e8d6,'utf-8'),_0xa3e8d6);_0x2b92c6[_0x48f258(0x1da)]({'name':_0x15ce7e['name'],'path':_0xa3e8d6,'yaml':_0x15ce7e});}}}else{const _0x52b9e1=await this[_0x48f258(0x1c5)](_0x87f541),_0x105ae9=await this[_0x48f258(0x18a)][_0x48f258(0x1d4)](_0x52b9e1);_0x3f88d0=_0x105ae9[_0x48f258(0x222)][_0x48f258(0x1c3)];const _0x5bf0a0=await this[_0x48f258(0x18a)][_0x48f258(0x1d8)](_0x52b9e1),_0x18f8b9=await this[_0x48f258(0x18a)][_0x48f258(0x183)](_0x52b9e1),_0x31908e=await this['client'][_0x48f258(0x239)](_0x52b9e1),_0x5e4226=await this['client'][_0x48f258(0x21e)](_0x52b9e1),_0x3fdd9d=await this['client']['listIntegrations'](_0x52b9e1),_0x3a32e0=await safeListOrEmpty(()=>this['client'][_0x48f258(0x1a0)](_0x52b9e1)),_0x44cb2b=await safeListOrEmpty(()=>this[_0x48f258(0x18a)]['listExperimentalArtifacts'](_0x52b9e1)),_0x148fb2=new Map(),_0x15e18c=new Map(),_0x5e7706=new Map(),_0x38c672=new Map(),_0x383a93=new Map(),_0x3c66dc=new Map();for(const _0x38d1e1 of _0x18f8b9){_0x148fb2[_0x48f258(0x199)](_0x38d1e1['id'],_0x38d1e1['attributes'][_0x48f258(0x1c3)]);}for(const _0x54c6c1 of _0x31908e){_0x15e18c[_0x48f258(0x199)](_0x54c6c1['id'],_0x54c6c1[_0x48f258(0x222)][_0x48f258(0x1c3)]);}for(const _0x2bbc0c of _0x5bf0a0){_0x5e7706[_0x48f258(0x199)](_0x2bbc0c['id'],_0x2bbc0c[_0x48f258(0x222)]['name']);}for(const _0x179256 of _0x5e4226){_0x38c672['set'](_0x179256['id'],_0x179256[_0x48f258(0x222)]['name']);}for(const _0x1d238f of _0x3a32e0){_0x383a93[_0x48f258(0x199)](_0x1d238f['id'],_0x1d238f[_0x48f258(0x222)][_0x48f258(0x1c3)]);}for(const _0x24ba4e of _0x44cb2b){_0x3c66dc[_0x48f258(0x199)](_0x24ba4e['id'],_0x24ba4e['attributes'][_0x48f258(0x1c3)]);}const _0x4c7cfd={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x148fb2,'TextKnowledgeBase':_0x15e18c,'Agent':_0x5e7706,'ExperimentalKnowledgeBase':_0x383a93}),'resolvePromptName':async _0x32521f=>_0x38c672[_0x48f258(0x249)](_0x32521f),'onWarning':_0x2d143c=>this[_0x48f258(0x157)][_0x48f258(0x14b)](_0x2d143c)};for(const _0x340920 of _0x5bf0a0){const _0x2eda91=await agentResponseToDef(_0x340920,_0x4c7cfd),{yaml:_0x22641c,systemPrompt:_0x3083b4,starterMessage:_0x398ea0}=_0x2eda91;_0x7c8a5['push']({'name':_0x22641c[_0x48f258(0x1c3)],'dir':'','yaml':_0x22641c,'systemPrompt':_0x3083b4,'starterMessage':_0x398ea0});}for(const _0x422332 of _0x18f8b9){const _0x16aa24=apiKnowledgeBaseToYaml(_0x422332);_0x2513fd[_0x48f258(0x1da)]({'name':_0x16aa24[_0x48f258(0x1c3)],'path':'','yaml':_0x16aa24});}for(const _0x5679fe of _0x31908e){_0x3cc725[_0x48f258(0x1da)]({'name':_0x5679fe['attributes'][_0x48f258(0x1c3)],'path':'','text':_0x5679fe['attributes'][_0x48f258(0x248)]});}for(const _0x30a779 of _0x5e4226){const _0x1d7011=await apiPromptToYaml(_0x30a779,_0x4c7cfd);_0x1d7011&&_0x526bdd[_0x48f258(0x1da)]({'name':_0x1d7011[_0x48f258(0x1c3)],'path':'','yaml':_0x1d7011});}for(const _0x3c162a of _0x3fdd9d){if(!_0x3c162a[_0x48f258(0x222)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x48f258(0x16a)](_0x3c162a['attributes']['serviceType'][_0x48f258(0x153)]())){const _0x5c8d4d=await apiIntegrationToYaml(_0x3c162a,_0x4c7cfd);_0x9fd8b5['push']({'name':_0x3c162a['attributes']['serviceType'][_0x48f258(0x153)](),'path':'','yaml':_0x5c8d4d});}}for(const _0x35b075 of _0x3a32e0){const _0x55cccb=apiExperimentalKnowledgeBaseToYaml(_0x35b075);_0x1355c9[_0x48f258(0x1da)]({'name':_0x55cccb[_0x48f258(0x1c3)],'path':'','def':_0x55cccb});}for(const _0x133677 of _0x44cb2b){const _0x1319b4=apiExperimentalArtifactToYaml(_0x133677);_0x451242['push']({'name':_0x1319b4[_0x48f258(0x1c3)],'path':'','def':_0x1319b4});}const _0x273eb2=await safeListOrEmpty(()=>this['client'][_0x48f258(0x142)](_0x52b9e1));for(const _0x581d6e of _0x273eb2){const _0x18b6a1=await apiFormInterfaceToYaml(_0x581d6e,_0x4c7cfd);_0x40622e[_0x48f258(0x1da)]({'name':_0x18b6a1[_0x48f258(0x1c3)],'path':'','yaml':_0x18b6a1});}const _0x50804e=await safeListOrEmpty(()=>this['client'][_0x48f258(0x223)](_0x52b9e1));for(const _0x265218 of _0x50804e){if(_0x265218[_0x48f258(0x222)][_0x48f258(0x18b)])continue;const _0x57a75b=await apiChatInterfaceToYaml(_0x265218,_0x4c7cfd);_0x2b92c6[_0x48f258(0x1da)]({'name':_0x57a75b[_0x48f258(0x1c3)],'path':'','yaml':_0x57a75b});}}const _0x383e61={'sourceProjectName':_0x3f88d0,'newProjectName':_0x266a35,'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}}},_0x4bfa28=await this[_0x48f258(0x18a)]['listProjects'](),_0x4474c8=_0x4bfa28['find'](_0x56a727=>_0x56a727[_0x48f258(0x222)][_0x48f258(0x1c3)]===_0x266a35);if(_0x4474c8)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x48f258(0x1d6)+_0x266a35+_0x48f258(0x206),undefined,{'helpText':_0x48f258(0x22d)});if(_0x85bd8f?.[_0x48f258(0x234)])return _0x383e61[_0x48f258(0x207)]['agents'][_0x48f258(0x25c)]=_0x7c8a5[_0x48f258(0x212)],_0x383e61[_0x48f258(0x207)][_0x48f258(0x252)][_0x48f258(0x25c)]=_0x2513fd[_0x48f258(0x212)],_0x383e61['counts'][_0x48f258(0x1a9)][_0x48f258(0x25c)]=_0x3cc725[_0x48f258(0x212)],_0x383e61[_0x48f258(0x207)][_0x48f258(0x217)]['created']=_0x1355c9[_0x48f258(0x212)],_0x383e61[_0x48f258(0x207)][_0x48f258(0x1b3)]['created']=_0x451242[_0x48f258(0x212)],_0x383e61[_0x48f258(0x207)]['prompts'][_0x48f258(0x25c)]=_0x526bdd[_0x48f258(0x212)],_0x383e61['counts']['integrations'][_0x48f258(0x25c)]=_0x9fd8b5[_0x48f258(0x212)],_0x383e61;const _0x570503=await this[_0x48f258(0x18a)][_0x48f258(0x235)]({'name':_0x266a35}),_0x159ed9=_0x570503['id'];_0x383e61['newProjectId']=_0x159ed9;const _0x4aeb84=new Map(),_0x1e7ddc=new Map(),_0x2ab314=new Map(),_0x5d145b=new Map(),_0x2672f1=new Map(),_0x1fdfff=new Map(),_0x31756e=new Map(),_0x534df5=new Map(),_0x499be1=new Set(),_0x335729=new Set();for(const _0x36f665 of _0x7c8a5){for(const _0x19b239 of _0x36f665[_0x48f258(0x1d3)][_0x48f258(0x188)]||[]){if(_0x19b239[_0x48f258(0x23b)]===_0x48f258(0x1c4)&&_0x19b239[_0x48f258(0x1b7)]){const _0x532b9a=parseRef(_0x19b239[_0x48f258(0x1b7)]);if(_0x532b9a)_0x499be1[_0x48f258(0x228)](_0x532b9a[_0x48f258(0x1c3)]);}else{if(_0x19b239[_0x48f258(0x23b)]===_0x48f258(0x1df)&&_0x19b239[_0x48f258(0x1b7)]){const _0x21c661=parseRef(_0x19b239[_0x48f258(0x1b7)]);if(_0x21c661)_0x335729[_0x48f258(0x228)](_0x21c661[_0x48f258(0x1c3)]);}}}}for(const _0x46519a of _0x499be1){try{const _0x599118=await this['client'][_0x48f258(0x1cc)]({'projectId':_0x159ed9,'name':_0x46519a});_0x2672f1[_0x48f258(0x199)](_0x46519a,_0x599118['id']),_0x383e61[_0x48f258(0x242)][_0x48f258(0x1da)]({'name':_0x46519a,'action':_0x48f258(0x25c),'id':_0x599118['id']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x242)][_0x48f258(0x25c)]++;}catch(_0x41da4f){_0x383e61[_0x48f258(0x242)][_0x48f258(0x1da)]({'name':_0x46519a,'action':'error','error':_0x41da4f[_0x48f258(0x250)]}),_0x383e61[_0x48f258(0x207)]['imageGenerators'][_0x48f258(0x156)]++;}}for(const _0xee1ae4 of _0x335729){try{const _0x916a2f=await this[_0x48f258(0x18a)][_0x48f258(0x1f3)]({'projectId':_0x159ed9,'name':_0xee1ae4});_0x1fdfff[_0x48f258(0x199)](_0xee1ae4,_0x916a2f['id']),_0x383e61[_0x48f258(0x221)][_0x48f258(0x1da)]({'name':_0xee1ae4,'action':_0x48f258(0x25c),'id':_0x916a2f['id']}),_0x383e61[_0x48f258(0x207)]['webSearchTools'][_0x48f258(0x25c)]++;}catch(_0x466570){_0x383e61[_0x48f258(0x221)][_0x48f258(0x1da)]({'name':_0xee1ae4,'action':_0x48f258(0x171),'error':_0x466570[_0x48f258(0x250)]}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x221)][_0x48f258(0x156)]++;}}const _0x60542=await fetchAllToolTargetMaps((_0x32aa25,_0x4724ff)=>this[_0x48f258(0x18a)][_0x48f258(0x24b)](_0x32aa25,_0x4724ff),_0x159ed9);let _0x4b17e2=[];const _0x238954={'projectId':_0x159ed9,'resolveToolTargetId':buildIdResolver({..._0x60542[_0x48f258(0x23f)],'KnowledgeBase':_0x4aeb84,'TextKnowledgeBase':_0x1e7ddc,'ExperimentalKnowledgeBase':_0x31756e,'Agent':_0x2ab314,'WebSearchTool':_0x1fdfff,'ImageGenerator':_0x2672f1}),'resolvePromptId':async _0x143719=>_0x5d145b['get'](_0x143719),'onWarning':_0xb73f5e=>{const _0x5b4e5e=_0x48f258;this[_0x5b4e5e(0x157)][_0x5b4e5e(0x14b)](_0xb73f5e),_0x4b17e2[_0x5b4e5e(0x1da)](_0xb73f5e);}};for(const _0x3dc971 of _0x2513fd){try{const _0x372c18=yamlKnowledgeBaseToApi(_0x3dc971[_0x48f258(0x1d3)],_0x159ed9),_0x4483c5=await this[_0x48f258(0x18a)][_0x48f258(0x1f2)](_0x372c18);_0x4aeb84[_0x48f258(0x199)](_0x3dc971[_0x48f258(0x1d3)]['name'],_0x4483c5['id']),_0x383e61[_0x48f258(0x252)]['push']({'name':_0x3dc971[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':_0x48f258(0x25c),'id':_0x4483c5['id']}),_0x383e61['counts'][_0x48f258(0x252)][_0x48f258(0x25c)]++;}catch(_0xd47e21){_0x383e61[_0x48f258(0x252)][_0x48f258(0x1da)]({'name':_0x3dc971[_0x48f258(0x1d3)]['name'],'action':_0x48f258(0x171),'error':_0xd47e21[_0x48f258(0x250)]}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x252)][_0x48f258(0x156)]++;}}for(const _0x4e6f05 of _0x3cc725){try{const _0x54b005=yamlTextKnowledgeBaseToApi({'name':_0x4e6f05[_0x48f258(0x1c3)],'text':_0x4e6f05['text']},_0x159ed9),_0x19f324=await this[_0x48f258(0x18a)]['createTextKnowledgeBase'](_0x54b005);_0x1e7ddc[_0x48f258(0x199)](_0x4e6f05['name'],_0x19f324['id']),_0x383e61[_0x48f258(0x1a9)][_0x48f258(0x1da)]({'name':_0x4e6f05[_0x48f258(0x1c3)],'action':_0x48f258(0x25c),'id':_0x19f324['id']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x1a9)][_0x48f258(0x25c)]++;}catch(_0x5793e7){_0x383e61[_0x48f258(0x1a9)]['push']({'name':_0x4e6f05[_0x48f258(0x1c3)],'action':_0x48f258(0x171),'error':_0x5793e7[_0x48f258(0x250)]}),_0x383e61['counts'][_0x48f258(0x1a9)][_0x48f258(0x156)]++;}}for(const _0x1c0d6f of _0x451242){try{const _0xf5f8df=yamlExperimentalArtifactToApi(_0x1c0d6f[_0x48f258(0x22b)],_0x159ed9),_0x265a5e=await this[_0x48f258(0x18a)][_0x48f258(0x1a6)](_0xf5f8df);_0x534df5[_0x48f258(0x199)](_0x1c0d6f[_0x48f258(0x22b)]['name'],_0x265a5e['id']),_0x383e61[_0x48f258(0x1b3)][_0x48f258(0x1da)]({'name':_0x1c0d6f[_0x48f258(0x22b)]['name'],'action':_0x48f258(0x25c),'id':_0x265a5e['id']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x1b3)]['created']++;}catch(_0x4765e1){_0x383e61['experimentalArtifacts'][_0x48f258(0x1da)]({'name':_0x1c0d6f[_0x48f258(0x22b)]['name'],'action':'error','error':_0x4765e1['message']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x1b3)][_0x48f258(0x156)]++;}}for(const _0x3075ad of _0x1355c9){try{const _0x1ffb57=yamlExperimentalKnowledgeBaseToApi(_0x3075ad[_0x48f258(0x22b)],_0x159ed9),_0x287828=await this[_0x48f258(0x18a)][_0x48f258(0x20f)](_0x1ffb57);_0x31756e[_0x48f258(0x199)](_0x3075ad[_0x48f258(0x22b)]['name'],_0x287828['id']),_0x383e61['experimentalKnowledgeBases'][_0x48f258(0x1da)]({'name':_0x3075ad[_0x48f258(0x22b)][_0x48f258(0x1c3)],'action':_0x48f258(0x25c),'id':_0x287828['id']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x217)][_0x48f258(0x25c)]++;}catch(_0x2ff152){_0x383e61[_0x48f258(0x217)][_0x48f258(0x1da)]({'name':_0x3075ad[_0x48f258(0x22b)][_0x48f258(0x1c3)],'action':_0x48f258(0x171),'error':_0x2ff152['message']}),_0x383e61[_0x48f258(0x207)]['experimentalKnowledgeBases'][_0x48f258(0x156)]++;}}const _0x94f891=[..._0x7c8a5][_0x48f258(0x23a)]((_0x47a8b2,_0x25f837)=>{const _0x2a79af=_0x48f258,_0x260d71=_0x47a8b2[_0x2a79af(0x1d3)][_0x2a79af(0x188)]?.[_0x2a79af(0x1f0)](_0x14e857=>_0x14e857[_0x2a79af(0x23b)]==='agent')??![],_0x19b886=_0x25f837[_0x2a79af(0x1d3)]['tools']?.[_0x2a79af(0x1f0)](_0xba3f2d=>_0xba3f2d[_0x2a79af(0x23b)]===_0x2a79af(0x25e))??![];if(_0x260d71&&!_0x19b886)return 0x1;if(!_0x260d71&&_0x19b886)return-0x1;return 0x0;});for(const _0x4d215b of _0x94f891){_0x4b17e2=[];try{const _0x3ce3de=_0x4d215b[_0x48f258(0x1d3)][_0x48f258(0x188)]?.[_0x48f258(0x146)](_0x3338bb=>{const _0x47b06b=_0x48f258;if(_0x3338bb[_0x47b06b(0x23b)]==='agent'&&_0x3338bb['target']){const _0x5c0ff0=parseRef(_0x3338bb[_0x47b06b(0x1b7)]);return _0x5c0ff0?.[_0x47b06b(0x1c3)]===_0x4d215b[_0x47b06b(0x1d3)][_0x47b06b(0x1c3)];}return![];})??[];if(_0x3ce3de['length']>0x0){const _0x52f9c0=_0x48f258(0x1c2)+_0x4d215b[_0x48f258(0x1d3)][_0x48f258(0x1c3)]+_0x48f258(0x21a)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this['logger'][_0x48f258(0x14b)](_0x52f9c0),_0x4b17e2[_0x48f258(0x1da)](_0x52f9c0);}const _0x2bad42=await agentDefToRequest(_0x4d215b[_0x48f258(0x1d3)],_0x4d215b[_0x48f258(0x16f)],_0x4d215b[_0x48f258(0x1ae)],_0x238954),_0x38254b=await this[_0x48f258(0x18a)][_0x48f258(0x1eb)](_0x2bad42);_0x2ab314[_0x48f258(0x199)](_0x4d215b[_0x48f258(0x1d3)][_0x48f258(0x1c3)],_0x38254b['id']),_0x383e61[_0x48f258(0x1e7)][_0x48f258(0x1da)]({'agentName':_0x4d215b[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':'created','agentId':_0x38254b['id'],'warnings':_0x4b17e2['length']>0x0?_0x4b17e2:undefined}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x1e7)][_0x48f258(0x25c)]++;}catch(_0x100623){_0x383e61[_0x48f258(0x1e7)][_0x48f258(0x1da)]({'agentName':_0x4d215b[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':_0x48f258(0x171),'error':_0x100623[_0x48f258(0x250)],'warnings':_0x4b17e2[_0x48f258(0x212)]>0x0?_0x4b17e2:undefined}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x1e7)][_0x48f258(0x156)]++;}}for(const _0x268c63 of _0x526bdd){try{const _0x3625b5=await yamlPromptToApi(_0x268c63['yaml'],_0x159ed9,_0x238954);if(!_0x3625b5){_0x383e61[_0x48f258(0x236)]['push']({'name':_0x268c63[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':'error','error':'Agent\x20reference\x20not\x20found'}),_0x383e61[_0x48f258(0x207)]['prompts'][_0x48f258(0x156)]++;continue;}const _0x1dd4d5=await this['client']['createPrompt'](_0x3625b5);_0x5d145b[_0x48f258(0x199)](_0x268c63[_0x48f258(0x1d3)][_0x48f258(0x1c3)],_0x1dd4d5['id']),_0x383e61[_0x48f258(0x236)][_0x48f258(0x1da)]({'name':_0x268c63[_0x48f258(0x1d3)]['name'],'action':'created','id':_0x1dd4d5['id']}),_0x383e61[_0x48f258(0x207)]['prompts'][_0x48f258(0x25c)]++;}catch(_0x24d1d3){_0x383e61[_0x48f258(0x236)]['push']({'name':_0x268c63[_0x48f258(0x1d3)]['name'],'action':_0x48f258(0x171),'error':_0x24d1d3['message']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x236)][_0x48f258(0x156)]++;}}for(const _0x10d3cf of _0x9fd8b5){try{const _0x3a0ca9=await yamlIntegrationToApi(_0x10d3cf[_0x48f258(0x1d3)],_0x159ed9,_0x238954),_0x3f8999=await this[_0x48f258(0x18a)][_0x48f258(0x25b)](_0x3a0ca9);_0x383e61[_0x48f258(0x25a)][_0x48f258(0x1da)]({'name':_0x10d3cf[_0x48f258(0x1d3)][_0x48f258(0x21d)],'action':_0x48f258(0x25c),'id':_0x3f8999['id']}),_0x383e61[_0x48f258(0x207)]['integrations'][_0x48f258(0x25c)]++;}catch(_0x2fd664){_0x383e61[_0x48f258(0x25a)][_0x48f258(0x1da)]({'name':_0x10d3cf['yaml'][_0x48f258(0x21d)],'action':_0x48f258(0x171),'error':_0x2fd664[_0x48f258(0x250)]}),_0x383e61[_0x48f258(0x207)]['integrations'][_0x48f258(0x156)]++;}}for(const _0x4078c5 of _0x40622e){try{const _0x5dec43=await yamlFormInterfaceToApi(_0x4078c5[_0x48f258(0x1d3)],_0x159ed9,_0x238954);if(!_0x5dec43){_0x383e61[_0x48f258(0x178)][_0x48f258(0x1da)]({'name':_0x4078c5[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':'error','error':_0x48f258(0x1a8)}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x178)][_0x48f258(0x156)]++;continue;}const _0x3b335a=await this['client'][_0x48f258(0x22c)](_0x5dec43);_0x383e61[_0x48f258(0x178)][_0x48f258(0x1da)]({'name':_0x4078c5['yaml']['name'],'action':_0x48f258(0x25c),'id':_0x3b335a['id']}),_0x383e61['counts'][_0x48f258(0x178)][_0x48f258(0x25c)]++;}catch(_0x410266){_0x383e61['formInterfaces']['push']({'name':_0x4078c5[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':_0x48f258(0x171),'error':_0x410266['message']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x178)]['errors']++;}}for(const _0x569b06 of _0x2b92c6){try{const _0x458ec5=await yamlChatInterfaceToApi(_0x569b06[_0x48f258(0x1d3)],_0x159ed9,_0x238954),_0x2bb149=await this[_0x48f258(0x18a)][_0x48f258(0x13d)](_0x458ec5);_0x383e61[_0x48f258(0x247)][_0x48f258(0x1da)]({'name':_0x569b06['yaml'][_0x48f258(0x1c3)],'action':_0x48f258(0x25c),'id':_0x2bb149['id']}),_0x383e61['counts'][_0x48f258(0x247)][_0x48f258(0x25c)]++;}catch(_0x4439c7){_0x383e61[_0x48f258(0x247)][_0x48f258(0x1da)]({'name':_0x569b06[_0x48f258(0x1d3)]['name'],'action':_0x48f258(0x171),'error':_0x4439c7[_0x48f258(0x250)]}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x247)]['errors']++;}}return _0x383e61;}}
|
|
1
|
+
function a133_0x2825(){const _0x25e4f2=['Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','Renamed\x20experimental\x20artifact\x20directory:\x20','action','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','createWebSearchTool','status','chat_agent_console','statSync','TextKnowledgeBase','projectId','experimentalKnowledgeBases','---\x20file:\x20','resolveAgentId','backupProject','updatePrompt','chatIgnoreManagedActions','toLowerCase','starter_message.md','listChatInterfaces','integrations.json','starterMessage','16219819niQKgo','Invalid\x20agent\x20reference\x20format:\x20','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','getChatHistory','chat_parent_segment','join','createExperimentalKnowledgeBase','listProjects','isFile','NOT_FOUND','dir','AGENT_NOT_FOUND','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','newProjectId','new','readFileSync','getProject','context','unlinkSync','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','readdirSync','created','name','updated','models','getCurrentProject','Renamed\x20folder:\x20','25638ZbRvPh','total','code.js','pullAgent','endsWith','stringify','Backup\x20folder\x20not\x20found:\x20','updateChatInterface','length','attributes','serviceType','toISOString','text_content','experimental_artifacts','integrations','loadJsonFile','chat_generic','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','currentProjectId','chatInfo','availableModelNames','agent.yml\x20not\x20found\x20in\x20','UNAUTHENTICATED','listTextKnowledgeBases','parse','Project\x20\x22','Available\x20agents:\x20','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','files','createAgentResponse','2338065OjhGpF','tdDatabaseName','Agent\x20not\x20found:\x20','file_name','rmSync','add','prompts.json','createChatInterface','code','image_gen','has','cwd','updateExperimentalKnowledgeBase','.yml','Unsupported\x20backup\x20version:\x20','basename','map','prompt.md','getAgent','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','Only\x20safe\x20types\x20(','listExperimentalKnowledgeBases','knowledgeBases','resolveProjectName','Renamed\x20KB\x20file:\x20','getOrCreateDefaultAgent','agentsFull','get','llm_project','dryRun','1652250LjNmCj','json_schema','Unresolved\x20dependencies:\x20','already\x20exists','nameToId','mkdirSync','Project\x20not\x20found:\x20','minimal','getDefaultProjectName','writeFileSync','starter_message','chat','Renamed\x20form\x20interface\x20file:\x20','agents.json','split','setCurrentProject','getUserSettings','listToolTargets','(dry-run)','slackMessageMode','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','exportedFrom','listPrompts','1.0','isDir','createIntegration','updateExperimentalArtifact','Removed\x20deleted\x20directory:\x20','listWebSearchTools','temperature','keys','dry-run-','knowledgebases.json','Renamed\x20text\x20KB\x20file:\x20','10157LATOnJ','pushProject','tools','createKnowledgeBase','startChat','listKnowledgeBases','errors','conflict','agent.yml','.md','updateAgentResponse','listAgentsFull','listIntegrations','Renamed\x20experimental\x20KB\x20directory:\x20','Multiple\x20agents\x20found\x20with\x20name\x20\x27','oldPath','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','tdx.json','client','INTERNAL','filter','service_type','):\x20','createPrompt','projects','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.','Agent\x20\x27','\x0a---\x20schema:\x20','getOrCreateDefaultProject','INVALID_ARGUMENT','webSearchTools','4203rDmdXD','profile','reasoningEffort','counts','history','PERMISSION_DENIED','textKnowledgeBases','message','signal','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','template','includes','form_interfaces','clearDefaultAgent','prompts','systemPrompt','def','listExperimentalArtifacts','\x22\x20already\x20exists','listAgents','event','idToName','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','metadata','Could\x20not\x20resolve\x20agent\x20reference','Renamed\x20integration\x20file:\x20','getDefaultAgent','low','type','ALREADY_EXISTS','unchanged','Unable\x20to\x20create\x20project\x20after\x20','566044XGGXVV','updateFormInterface','Renamed\x20chat\x20interface\x20file:\x20','knowledge_bases','chat_interfaces','size','isDirectory','listImageGenerators','push','info','displayName','formInterfaces','sort','utf-8','none','listChats','dirname','chatWelcomeMessage','modelType','high','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','continueChat','#\x20prompt.md\x0a','path','listFormInterfaces','1192UjMFmK','agent','deleteIntegration','No\x20tdx.json\x20found\x20in\x20','json_schema.json','chatInterfaces','logger','\x0a---\x20code\x20---\x0a','chats','59cVmbiE','experimental_knowledge_bases','sdk.llm','yaml','restoreProject','16690LlzUeG','createExperimentalArtifact','agents','error','createImageGenerator','5rITzBN','isManaged','version','createAgent','description','createTextKnowledgeBase','localeCompare','Renamed\x20agent\x20folder:\x20','promptId','actions','warn','setDefaultAgent','variables','getChatLog','deleteAgent','deleteProject','renamed','project.json','updateAgent','find','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','agentId','\x20attempts\x20due\x20to\x20name\x20conflicts.','target','_reasoning_','\x20---\x0a','site','some','imageGenerators','\x20→\x20','\x0a---\x20function:\x20','experimentalArtifacts','\x27.\x20This\x20should\x20not\x20happen.','functions','webhookCorsOrigins','createProject','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','LLM_PROJECT_NOT_FOUND','text','Multiple\x20projects\x20found\x20with\x20name\x20\x27','Renamed\x20prompt\x20file:\x20','existsSync','Agent\x20reference\x20not\x20found','resolveProjectId','set','\x0a\x0a#\x20agent.yml\x0a','createFormInterface','project',')\x20can\x20be\x20pushed.\x20','tdx_'];a133_0x2825=function(){return _0x25e4f2;};return a133_0x2825();}const a133_0x32634e=a133_0x4e7f;(function(_0x5638d3,_0x33d60d){const _0xe9c6ad=a133_0x4e7f,_0x583c49=_0x5638d3();while(!![]){try{const _0x4ffe52=parseInt(_0xe9c6ad(0x151))/0x1*(parseInt(_0xe9c6ad(0x1bd))/0x2)+-parseInt(_0xe9c6ad(0xae))/0x3+-parseInt(_0xe9c6ad(0x12f))/0x4+parseInt(_0xe9c6ad(0x15b))/0x5*(parseInt(_0xe9c6ad(0xcd))/0x6)+parseInt(_0xe9c6ad(0xef))/0x7*(-parseInt(_0xe9c6ad(0x148))/0x8)+parseInt(_0xe9c6ad(0x10f))/0x9*(-parseInt(_0xe9c6ad(0x156))/0xa)+parseInt(_0xe9c6ad(0x1a2))/0xb;if(_0x4ffe52===_0x33d60d)break;else _0x583c49['push'](_0x583c49['shift']());}catch(_0x7e534a){_0x583c49['push'](_0x583c49['shift']());}}}(a133_0x2825,0x8ffa9));import{LLMApiClient}from'../client/llm-api-client.js';import*as a133_0x1dfaa6 from'node:fs';import*as a133_0x10b9e5 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';function a133_0x4e7f(_0x28faae,_0x2c0b73){_0x28faae=_0x28faae-0x9e;const _0x2825f9=a133_0x2825();let _0x4e7fb8=_0x2825f9[_0x28faae];return _0x4e7fb8;}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_0x32634e(0xa0),a133_0x32634e(0x193),a133_0x32634e(0x1a6)];async function safeListOrEmpty(_0x21bd17){const _0x60a49d=a133_0x32634e;try{return await _0x21bd17();}catch(_0x217298){if(_0x217298 instanceof HTTPClientError&&_0x217298[_0x60a49d(0x192)]===0x194)return[];throw _0x217298;}}export class LLMSDK{[a133_0x32634e(0xa2)];['client'];['context'];[a133_0x32634e(0x14e)]=Logger['of'](a133_0x32634e(0x153));constructor(_0x18b536){const _0x35a661=a133_0x32634e;this[_0x35a661(0x102)]=new LLMApiClient(_0x18b536),this[_0x35a661(0x1b3)]=_0x18b536;}['getDefaultProjectName'](){const _0x3a1c73=getSanitizedUsername();return'tdx_default_'+_0x3a1c73;}async[a133_0x32634e(0xdc)](_0x5ccbf2){const _0x1c47e9=a133_0x32634e,{projectId:_0x15bd26}=await this[_0x1c47e9(0xc6)](_0x5ccbf2);this[_0x1c47e9(0xa2)]=_0x15bd26;}[a133_0x32634e(0x1bb)](){const _0x464f09=a133_0x32634e;return this[_0x464f09(0xa2)];}async[a133_0x32634e(0x166)](_0x5d14d8){const _0x122fe1=a133_0x32634e,_0x43ad6c=this[_0x122fe1(0x1b3)][_0x122fe1(0x110)];let _0xd6c0de,_0x1d0315;if(_0x5d14d8[_0x122fe1(0x11a)]('/')){const _0xd976c9=_0x5d14d8[_0x122fe1(0xdb)]('/');if(_0xd976c9['length']!==0x2)throw new SDKError(ErrorCode[_0x122fe1(0x10d)],_0x122fe1(0x1a3)+_0x5d14d8,undefined,{'helpText':_0x122fe1(0x1b5)});const [_0x1d6041,_0x4e8d5c]=_0xd976c9;_0xd6c0de=await this[_0x122fe1(0x186)](_0x1d6041),_0x1d0315=_0x4e8d5c;}else _0xd6c0de=this[_0x122fe1(0xa2)]||(await this['getOrCreateDefaultProject']())['id'],_0x1d0315=_0x5d14d8;const _0x579f16=await this[_0x122fe1(0x199)](_0x1d0315,_0xd6c0de),_0x5e5719=await this[_0x122fe1(0x102)][_0x122fe1(0xc0)](_0x579f16);writeCachedLLMAgent(_0x5e5719['attributes'][_0x122fe1(0x1b8)],_0x579f16,_0xd6c0de,_0x43ad6c);}[a133_0x32634e(0x129)](){const _0xab40cc=a133_0x32634e,_0xdb1d82=this[_0xab40cc(0x1b3)][_0xab40cc(0x110)];return readCachedLLMAgent(_0xdb1d82)||undefined;}[a133_0x32634e(0x11c)](){const _0x380b98=a133_0x32634e,_0x2be0ca=this['context'][_0x380b98(0x110)];clearCachedLLMAgent(_0x2be0ca);}async[a133_0x32634e(0x1ba)](){const _0x3a4a9d=a133_0x32634e,_0x241cb3=await this[_0x3a4a9d(0x102)][_0x3a4a9d(0xdd)](),_0x389c83=[];for(const _0x414fd4 of _0x241cb3[_0x3a4a9d(0xa4)]){const _0x4973b7=_0x241cb3['availableModels'][_0x414fd4];_0x4973b7&&_0x389c83[_0x3a4a9d(0x137)]({'name':_0x414fd4,'displayName':_0x4973b7[_0x3a4a9d(0x139)]});}return _0x389c83;}async[a133_0x32634e(0x17e)](_0x37b740){const _0x90fbf0=a133_0x32634e;return await this[_0x90fbf0(0x102)][_0x90fbf0(0x17e)](_0x37b740);}async[a133_0x32634e(0x16a)](_0x3ba170){const _0x5dca9e=a133_0x32634e,{projectId:_0x515fe3}=await this[_0x5dca9e(0xc6)](_0x3ba170);await this['client'][_0x5dca9e(0x16a)](_0x515fe3);}async[a133_0x32634e(0x108)](_0x10c9fc=0x32){const _0x392741=a133_0x32634e;return await this[_0x392741(0x102)][_0x392741(0x1a9)](_0x10c9fc);}async[a133_0x32634e(0x10c)](_0x158070){const _0x12bc8f=a133_0x32634e,_0x3ae3df=_0x158070||this[_0x12bc8f(0xd5)](),_0x56c6b8=this[_0x12bc8f(0x1b3)][_0x12bc8f(0x110)];if(!_0x158070){const _0x4f8fc0=readCachedLLMProject(_0x56c6b8);if(_0x4f8fc0&&_0x4f8fc0[_0x12bc8f(0x1b8)]===_0x3ae3df)try{const _0x5d94e2=await this['client'][_0x12bc8f(0x1b2)](_0x4f8fc0['id']);if(_0x5d94e2['attributes'][_0x12bc8f(0x1b8)]===_0x3ae3df)return _0x5d94e2;}catch{}}const _0xc814b0=await this[_0x12bc8f(0x102)]['listProjects'](),_0x49730e=_0xc814b0[_0x12bc8f(0x16e)](_0x433eff=>_0x433eff[_0x12bc8f(0x1c6)]['name']===_0x3ae3df);if(_0x49730e)return!_0x158070&&writeCachedLLMProject(_0x3ae3df,_0x49730e['id'],_0x56c6b8),_0x49730e;const _0x265295=await this[_0x12bc8f(0x102)][_0x12bc8f(0x17e)]({'name':_0x3ae3df,'description':_0x12bc8f(0x1a4)+getSanitizedUsername()+')'});return!_0x158070&&writeCachedLLMProject(_0x3ae3df,_0x265295['id'],_0x56c6b8),_0x265295;}async[a133_0x32634e(0x186)](_0x55b99a){const _0x4c73a1=a133_0x32634e,_0x3c1f51=await this['client'][_0x4c73a1(0x1a9)](),_0x8ce938=_0x3c1f51[_0x4c73a1(0x104)](_0x4f18d9=>_0x4f18d9[_0x4c73a1(0x1c6)]['name']===_0x55b99a);if(_0x8ce938[_0x4c73a1(0x1c5)]===0x0)throw new SDKError(ErrorCode[_0x4c73a1(0x180)],'Project\x20not\x20found:\x20'+_0x55b99a,undefined,{'helpText':_0x4c73a1(0x16f)});if(_0x8ce938['length']>0x1)throw new SDKError(ErrorCode[_0x4c73a1(0x103)],_0x4c73a1(0x182)+_0x55b99a+_0x4c73a1(0x17b));return _0x8ce938[0x0]['id'];}async[a133_0x32634e(0xc6)](_0x20b5be){const _0x1737c8=a133_0x32634e,_0x318983=await this['client'][_0x1737c8(0x1a9)](),_0x2ac973=_0x318983[_0x1737c8(0x16e)](_0xf1cf86=>_0xf1cf86[_0x1737c8(0x1c6)][_0x1737c8(0x1b8)]===_0x20b5be);if(_0x2ac973)return{'projectId':_0x2ac973['id'],'project':_0x2ac973};throw new SDKError(ErrorCode[_0x1737c8(0x180)],_0x1737c8(0xd3)+_0x20b5be,undefined,{'helpText':_0x1737c8(0x16f)});}async[a133_0x32634e(0xc8)](_0x10a020='claude-4.5-sonnet',_0x408e50=0x0,_0x13c6ed){const _0x452648=a133_0x32634e,_0x55e8b8=0xa;let _0x46960d=0x0,_0x3f9eb0;while(_0x46960d<_0x55e8b8){try{const _0x343ce8=await this[_0x452648(0x10c)](_0x3f9eb0),_0xf89a2b=_0x343ce8['id'],_0x561694=[_0x452648(0x13d),_0x452648(0xd4),_0x452648(0x12a),'medium',_0x452648(0x142)],_0x181dd6=_0x408e50===0x0?_0x452648(0x18c)+_0x10a020:_0x452648(0x18c)+_0x10a020+_0x452648(0x173)+_0x561694[_0x408e50],_0x5286eb=await this[_0x452648(0x102)][_0x452648(0x122)](_0xf89a2b),_0x5c6880=_0x5286eb[_0x452648(0x16e)](_0x394d99=>_0x394d99[_0x452648(0x1c6)][_0x452648(0x1b8)]===_0x181dd6);if(_0x5c6880)return _0x5c6880;const _0x50c237=_0x408e50>0x0?0x1:_0x13c6ed;return await this[_0x452648(0x102)]['createAgent']({'name':_0x181dd6,'projectId':_0xf89a2b,'modelType':_0x10a020,'systemPrompt':'','temperature':_0x50c237,'reasoningEffort':_0x408e50>0x0?_0x408e50:undefined});}catch(_0x232621){if(_0x232621 instanceof HTTPClientError){const _0x4a51d8=_0x232621[_0x452648(0x192)];if(_0x4a51d8>=0x190&&_0x4a51d8<0x1f4){if(_0x4a51d8===0x191)throw new SDKError(ErrorCode[_0x452648(0xa6)],_0x452648(0x18d),_0x232621);else{if(_0x4a51d8===0x193)throw new SDKError(ErrorCode[_0x452648(0x114)],_0x452648(0xc1),_0x232621);}throw _0x232621;}}if(errorContains(_0x232621,_0x452648(0xd0),'duplicate',_0x452648(0xf6))){_0x46960d++;if(_0x46960d>=_0x55e8b8)throw new SDKError(ErrorCode[_0x452648(0x12c)],_0x452648(0x12e)+_0x55e8b8+_0x452648(0x171),_0x232621);const _0x36595b=this[_0x452648(0xd5)]();_0x3f9eb0=_0x36595b+'_'+generateRandomHex();continue;}throw _0x232621;}}throw new SDKError(ErrorCode['INTERNAL'],_0x452648(0x17f));}async[a133_0x32634e(0x199)](_0x4624ae,_0x170492){const _0x31b8be=a133_0x32634e,_0x3a7032=_0x170492||this[_0x31b8be(0xa2)],_0x37719a=await this['client'][_0x31b8be(0x122)](_0x3a7032),_0x4b26b8=_0x37719a[_0x31b8be(0x104)](_0x13d920=>_0x13d920[_0x31b8be(0x1c6)][_0x31b8be(0x1b8)]===_0x4624ae);if(_0x4b26b8[_0x31b8be(0x1c5)]===0x0){const _0x1da840=_0x3a7032?'\x20in\x20project\x20'+_0x3a7032:'';throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x31b8be(0xb0)+_0x4624ae+_0x1da840,undefined,{'helpText':_0x3a7032?_0x31b8be(0x1ae):_0x31b8be(0x109)});}if(_0x4b26b8[_0x31b8be(0x1c5)]>0x1)throw new SDKError(ErrorCode[_0x31b8be(0x103)],_0x31b8be(0xfd)+_0x4624ae+_0x31b8be(0x17b));return _0x4b26b8[0x0]['id'];}async[a133_0x32634e(0x158)](_0x3f1717){const _0x425367=a133_0x32634e,_0x40e2b5=_0x3f1717||this['currentProjectId'];return await this[_0x425367(0x102)][_0x425367(0x122)](_0x40e2b5);}async[a133_0x32634e(0xc9)](_0x2955e4){const _0xf9faaa=a133_0x32634e;return await this[_0xf9faaa(0x102)][_0xf9faaa(0xfa)](_0x2955e4);}async[a133_0x32634e(0x149)](_0x5c5a5b){const _0x22be44=a133_0x32634e;return await this[_0x22be44(0x102)][_0x22be44(0xc0)](_0x5c5a5b);}async[a133_0x32634e(0x15e)](_0x59592b){const _0x234132=a133_0x32634e;return await this[_0x234132(0x102)][_0x234132(0x15e)](_0x59592b);}async[a133_0x32634e(0x16d)](_0xa617f5,_0x44f0df){const _0x1554c9=a133_0x32634e;return await this['client'][_0x1554c9(0x16d)](_0xa617f5,_0x44f0df);}async['deleteAgent'](_0x29296c){const _0x1d6634=a133_0x32634e;await this[_0x1d6634(0x102)][_0x1d6634(0x169)](_0x29296c);}async[a133_0x32634e(0xf3)](_0x3b75b1){const _0x235a3a=a133_0x32634e;return await this[_0x235a3a(0x102)][_0x235a3a(0xf3)]({'agentId':_0x3b75b1});}async*[a133_0x32634e(0xd8)](_0x8ce156,_0x8807e8){const _0x4afc5e=a133_0x32634e;let _0x7e0d19=_0x8807e8?.['chatId'];const _0x1ded33=_0x8807e8?.['agentId'];if(!_0x7e0d19){if(!_0x1ded33)throw new Error(_0x4afc5e(0xc2));const _0x2a605d=await this[_0x4afc5e(0x102)][_0x4afc5e(0xf3)]({'agentId':_0x1ded33});_0x7e0d19=_0x2a605d['id'],yield{'type':_0x4afc5e(0x126),'data':{'chatId':_0x7e0d19,'agentId':_0x1ded33,'projectId':_0x2a605d[_0x4afc5e(0x1c6)][_0x4afc5e(0x196)]}};}for await(const _0x23901f of this[_0x4afc5e(0x102)][_0x4afc5e(0x144)](_0x7e0d19,_0x8ce156,_0x8807e8?.[_0x4afc5e(0x117)])){yield{'type':_0x4afc5e(0x123),'data':_0x23901f};}}async[a133_0x32634e(0x150)](_0x28b2b1=0x32){const _0x1d8ae1=a133_0x32634e;return await this[_0x1d8ae1(0x102)][_0x1d8ae1(0x13e)](_0x28b2b1);}async[a133_0x32634e(0x113)](_0x1c50b9){const _0x937188=a133_0x32634e;return await this[_0x937188(0x102)][_0x937188(0x1a5)](_0x1c50b9);}async[a133_0x32634e(0x168)](_0x3e8700){const _0x1e464d=a133_0x32634e;return await this[_0x1e464d(0x102)][_0x1e464d(0x168)](_0x3e8700);}async[a133_0x32634e(0xa3)](_0x5704d7){return await this['client']['getChatInfo'](_0x5704d7);}async[a133_0x32634e(0x19a)](_0x3f6905,_0x7d99e3,_0x536e07){const _0x3df30f=a133_0x32634e,_0x3dc32b=_0x536e07?.['dryRun']??![],{projectId:_0x3ea177,project:_0x59541c}=await this['resolveProjectName'](_0x3f6905),_0x42e5cc=_0x59541c[_0x3df30f(0x1c6)]['name'],_0x31d7db=_0x7d99e3||_0x42e5cc+'.llm';if(a133_0x1dfaa6['existsSync'](_0x31d7db)&&!_0x3dc32b)throw new SDKError(ErrorCode['ALREADY_EXISTS'],'Output\x20directory\x20already\x20exists:\x20'+_0x31d7db,undefined,{'helpText':_0x3df30f(0x125)});const _0x2b376a=await this[_0x3df30f(0x102)][_0x3df30f(0xfa)](_0x3ea177),_0x1a5687=await this['client']['listKnowledgeBases'](_0x3ea177),_0x3c0225=await this[_0x3df30f(0x102)][_0x3df30f(0xe3)](_0x3ea177),_0x2b97e6=await this[_0x3df30f(0x102)][_0x3df30f(0xfb)](_0x3ea177);if(!_0x3dc32b){a133_0x1dfaa6[_0x3df30f(0xd2)](_0x31d7db,{'recursive':!![]});const _0x514525={'version':_0x3df30f(0xe4),'exportedAt':new Date()[_0x3df30f(0x1c8)](),'exportedFrom':{'site':this['context']['site'],'projectId':_0x3ea177,'projectName':_0x42e5cc},'project':_0x59541c};a133_0x1dfaa6[_0x3df30f(0xd6)](a133_0x10b9e5[_0x3df30f(0x1a7)](_0x31d7db,_0x3df30f(0x16c)),JSON[_0x3df30f(0x1c2)](_0x514525,null,0x2)),a133_0x1dfaa6[_0x3df30f(0xd6)](a133_0x10b9e5[_0x3df30f(0x1a7)](_0x31d7db,_0x3df30f(0xda)),JSON['stringify'](_0x2b376a,null,0x2)),a133_0x1dfaa6['writeFileSync'](a133_0x10b9e5[_0x3df30f(0x1a7)](_0x31d7db,_0x3df30f(0xed)),JSON['stringify'](_0x1a5687,null,0x2)),a133_0x1dfaa6['writeFileSync'](a133_0x10b9e5[_0x3df30f(0x1a7)](_0x31d7db,_0x3df30f(0xb4)),JSON[_0x3df30f(0x1c2)](_0x3c0225,null,0x2)),a133_0x1dfaa6[_0x3df30f(0xd6)](a133_0x10b9e5[_0x3df30f(0x1a7)](_0x31d7db,'integrations.json'),JSON['stringify'](_0x2b97e6,null,0x2));}return{'projectName':_0x42e5cc,'outputDir':_0x31d7db,'counts':{'agents':_0x2b376a[_0x3df30f(0x1c5)],'knowledgeBases':_0x1a5687[_0x3df30f(0x1c5)],'prompts':_0x3c0225[_0x3df30f(0x1c5)],'integrations':_0x2b97e6[_0x3df30f(0x1c5)]}};}async[a133_0x32634e(0x155)](_0x1c2a44,_0x3637c5){const _0xebf68c=a133_0x32634e,_0x287276=_0x3637c5?.[_0xebf68c(0xcc)]??![],_0xc0d47e=this['getBackupMetadata'](_0x1c2a44),_0x59f895=_0xc0d47e[_0xebf68c(0xe2)][_0xebf68c(0x175)],_0x5dfa7a=this[_0xebf68c(0x1b3)][_0xebf68c(0x175)],_0x296d4d=_0x59f895!==_0x5dfa7a?_0x59f895:undefined,_0xfcea9d=this[_0xebf68c(0x9f)](a133_0x10b9e5[_0xebf68c(0x1a7)](_0x1c2a44,_0xebf68c(0xda)),[]),_0x37cdc4=this['loadJsonFile'](a133_0x10b9e5[_0xebf68c(0x1a7)](_0x1c2a44,_0xebf68c(0xed)),[]),_0x1ec265=this[_0xebf68c(0x9f)](a133_0x10b9e5[_0xebf68c(0x1a7)](_0x1c2a44,'prompts.json'),[]),_0x1f0c28=this['loadJsonFile'](a133_0x10b9e5[_0xebf68c(0x1a7)](_0x1c2a44,_0xebf68c(0x1a0)),[]),_0x57247b=_0x3637c5?.[_0xebf68c(0x1b8)]||_0xc0d47e[_0xebf68c(0xe2)]['projectName'];if(_0x287276){const _0x29e4bc=new Map(),_0x37fbe0=[..._0xfcea9d],_0x14e51c=_0xfcea9d['length']+0x1;let _0x363666=0x0;while(_0x37fbe0[_0xebf68c(0x1c5)]>0x0&&_0x363666<_0x14e51c){_0x363666++;const _0x12846f=[];for(const _0x4dcc67 of _0x37fbe0){canCreateAgent(_0x4dcc67,_0x29e4bc)?_0x29e4bc['set'](_0x4dcc67['id'],_0xebf68c(0xec)+_0x4dcc67['id']):_0x12846f['push'](_0x4dcc67);}if(_0x12846f['length']===_0x37fbe0[_0xebf68c(0x1c5)])throw new SDKError(ErrorCode['INTERNAL'],_0xebf68c(0x100),undefined,{'helpText':_0xebf68c(0x143)});_0x37fbe0[_0xebf68c(0x1c5)]=0x0,_0x37fbe0[_0xebf68c(0x137)](..._0x12846f);}const _0x15f087=_0x1ec265[_0xebf68c(0x104)](_0x21ba32=>_0x29e4bc[_0xebf68c(0xb8)](_0x21ba32['attributes'][_0xebf68c(0x170)]))[_0xebf68c(0x1c5)];return{'projectName':_0x57247b,'projectId':_0xebf68c(0xdf),'counts':{'agents':_0xfcea9d[_0xebf68c(0x1c5)],'knowledgeBases':_0x37cdc4[_0xebf68c(0x1c5)],'prompts':_0x15f087,'integrations':_0x1f0c28[_0xebf68c(0x1c5)]},'sourceSite':_0x296d4d};}const _0x92e0d0=await this['client'][_0xebf68c(0x17e)]({'name':_0x57247b,'description':_0xc0d47e[_0xebf68c(0x18a)]['attributes'][_0xebf68c(0x15f)]}),_0x45ea7c=_0x92e0d0['id'],_0xf5273c=new Map(),_0x31f15c=new Map(),_0x5dcb8a=new Map();for(const _0x143f58 of _0x37cdc4){const _0x195e97=await this[_0xebf68c(0x102)][_0xebf68c(0xf2)]({'projectId':_0x45ea7c,'name':_0x143f58[_0xebf68c(0x1c6)][_0xebf68c(0x1b8)],'tdDatabaseName':_0x143f58[_0xebf68c(0x1c6)][_0xebf68c(0xaf)],'tables':_0x143f58[_0xebf68c(0x1c6)]['tables']});_0xf5273c[_0xebf68c(0x187)](_0x143f58['id'],_0x195e97['id']);}const _0x1720fe=[..._0xfcea9d],_0x11bc55=_0xfcea9d[_0xebf68c(0x1c5)]+0x1;let _0x149af4=0x0;while(_0x1720fe['length']>0x0&&_0x149af4<_0x11bc55){_0x149af4++;const _0x4039d3=[];for(const _0x5bef21 of _0x1720fe){if(canCreateAgent(_0x5bef21,_0x31f15c)){const _0x5a6a35=remapToolIds(_0x5bef21['attributes']['tools'],_0xf5273c,_0x31f15c),_0x4596bf=remapVariableIds(_0x5bef21[_0xebf68c(0x1c6)][_0xebf68c(0x167)],_0xf5273c),_0x5415b5=await this[_0xebf68c(0x102)]['createAgentResponse']({'name':_0x5bef21[_0xebf68c(0x1c6)][_0xebf68c(0x1b8)],'projectId':_0x45ea7c,'systemPrompt':_0x5bef21[_0xebf68c(0x1c6)]['systemPrompt'],'starterMessage':_0x5bef21[_0xebf68c(0x1c6)]['starterMessage'],'modelType':migrateModelType(_0x5bef21[_0xebf68c(0x1c6)][_0xebf68c(0x141)]),'maxToolIterations':_0x5bef21['attributes']['maxToolIterations'],'temperature':_0x5bef21[_0xebf68c(0x1c6)][_0xebf68c(0xea)],'reasoningEffort':_0x5bef21['attributes'][_0xebf68c(0x111)],'outputs':_0x5bef21[_0xebf68c(0x1c6)]['outputs'],'tools':_0x5a6a35,'variables':_0x4596bf});_0x31f15c[_0xebf68c(0x187)](_0x5bef21['id'],_0x5415b5['id']);}else _0x4039d3[_0xebf68c(0x137)](_0x5bef21);}if(_0x4039d3[_0xebf68c(0x1c5)]===_0x1720fe[_0xebf68c(0x1c5)])throw new SDKError(ErrorCode[_0xebf68c(0x103)],_0xebf68c(0x100),undefined,{'helpText':_0xebf68c(0x143)});_0x1720fe[_0xebf68c(0x1c5)]=0x0,_0x1720fe[_0xebf68c(0x137)](..._0x4039d3);}for(const _0x53a9eb of _0x1ec265){const _0x51a881=_0x31f15c['get'](_0x53a9eb['attributes'][_0xebf68c(0x170)]);if(!_0x51a881)continue;const _0x5bb698=await this['client'][_0xebf68c(0x107)]({'projectId':_0x45ea7c,'agentId':_0x51a881,'name':_0x53a9eb['attributes'][_0xebf68c(0x1b8)],'systemPrompt':_0x53a9eb['attributes'][_0xebf68c(0x11e)],'template':_0x53a9eb['attributes'][_0xebf68c(0x119)],'jsonSchemaHint':_0x53a9eb['attributes']['jsonSchemaHint']});_0x5dcb8a['set'](_0x53a9eb['id'],_0x5bb698['id']);}for(const _0x1911a8 of _0x1f0c28){const _0x116138=_0x1911a8['attributes'][_0xebf68c(0x164)]['map'](_0x3f99d4=>({..._0x3f99d4,'promptId':_0x5dcb8a[_0xebf68c(0xca)](_0x3f99d4[_0xebf68c(0x163)])||_0x3f99d4['promptId']}));await this[_0xebf68c(0x102)][_0xebf68c(0xe6)]({'projectId':_0x45ea7c,'serviceType':_0x1911a8[_0xebf68c(0x1c6)][_0xebf68c(0x1c7)],'actions':_0x116138,'slackMessageMode':_0x1911a8['attributes'][_0xebf68c(0xe0)],'chatIgnoreManagedActions':_0x1911a8[_0xebf68c(0x1c6)][_0xebf68c(0x19c)],'chatWelcomeMessage':_0x1911a8[_0xebf68c(0x1c6)][_0xebf68c(0x140)],'webhookCorsOrigins':_0x1911a8[_0xebf68c(0x1c6)][_0xebf68c(0x17d)]});}return{'projectName':_0x57247b,'projectId':_0x45ea7c,'counts':{'agents':_0x31f15c[_0xebf68c(0x134)],'knowledgeBases':_0xf5273c[_0xebf68c(0x134)],'prompts':_0x5dcb8a[_0xebf68c(0x134)],'integrations':_0x1f0c28['length']},'sourceSite':_0x296d4d};}[a133_0x32634e(0x9f)](_0x3a7447,_0x2d977b){const _0xf258d5=a133_0x32634e;if(!a133_0x1dfaa6[_0xf258d5(0x184)](_0x3a7447))return _0x2d977b;return JSON['parse'](a133_0x1dfaa6[_0xf258d5(0x1b1)](_0x3a7447,_0xf258d5(0x13c)));}['getBackupMetadata'](_0x376f69){const _0x71507c=a133_0x32634e;if(!a133_0x1dfaa6['existsSync'](_0x376f69))throw new SDKError(ErrorCode[_0x71507c(0x1ab)],_0x71507c(0x1c3)+_0x376f69,undefined,{'helpText':'Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.'});const _0x3d5977=a133_0x10b9e5[_0x71507c(0x1a7)](_0x376f69,_0x71507c(0x16c));if(!a133_0x1dfaa6['existsSync'](_0x3d5977))throw new SDKError(ErrorCode[_0x71507c(0x10d)],_0x71507c(0xa1)+_0x376f69,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x3fbad5=JSON[_0x71507c(0xa8)](a133_0x1dfaa6[_0x71507c(0x1b1)](_0x3d5977,'utf-8'));if(!isSupportedBackupVersion(_0x3fbad5[_0x71507c(0x15d)]))throw new SDKError(ErrorCode[_0x71507c(0x10d)],_0x71507c(0xbc)+_0x3fbad5[_0x71507c(0x15d)],undefined,{'helpText':_0x71507c(0xe1)});return _0x3fbad5;}async['pullProject'](_0x15869a,_0x446b94,_0x45c8f0){const _0xa22260=a133_0x32634e,{projectId:_0x3db4f2,project:_0x5833d6}=await this[_0xa22260(0xc6)](_0x15869a),_0xf8db67=_0x5833d6['attributes'][_0xa22260(0x1b8)];let _0x13b001;if(_0x446b94)_0x13b001=_0x446b94;else{const _0x4c5b68=a133_0x10b9e5[_0xa22260(0x1a7)](process['cwd'](),_0xa22260(0x158)),_0x156596=getSanitizedPathWithMigration(_0x4c5b68,_0xf8db67);_0x156596[_0xa22260(0x16b)]&&this[_0xa22260(0x14e)]['info'](_0xa22260(0x1bc)+a133_0x10b9e5['basename'](_0x156596['oldPath'])+'\x20→\x20'+a133_0x10b9e5[_0xa22260(0xbd)](_0x156596['path'])),_0x13b001=_0x156596[_0xa22260(0x146)];}const _0x2e3fda=await this['client'][_0xa22260(0xfa)](_0x3db4f2),_0x5886b1=await this[_0xa22260(0x102)]['listKnowledgeBases'](_0x3db4f2),_0x39502f=await this[_0xa22260(0x102)][_0xa22260(0xa7)](_0x3db4f2),_0x2a5bb7=await safeListOrEmpty(()=>this[_0xa22260(0x102)][_0xa22260(0x136)](_0x3db4f2)),_0x41b84c=await safeListOrEmpty(()=>this[_0xa22260(0x102)][_0xa22260(0xe9)](_0x3db4f2)),_0x5b0e16=await this[_0xa22260(0x102)][_0xa22260(0xe3)](_0x3db4f2),_0x1d1dd9=await this['client'][_0xa22260(0xfb)](_0x3db4f2),_0x38a1d1=await safeListOrEmpty(()=>this[_0xa22260(0x102)][_0xa22260(0xc4)](_0x3db4f2)),_0x50d37e=await safeListOrEmpty(()=>this['client'][_0xa22260(0x120)](_0x3db4f2)),_0x38e8e2=await safeListOrEmpty(()=>this[_0xa22260(0x102)][_0xa22260(0x147)](_0x3db4f2)),_0x4d8e3c=await safeListOrEmpty(()=>this['client'][_0xa22260(0x19f)](_0x3db4f2)),_0x29a5e8=_0x1d1dd9[_0xa22260(0x104)](_0x152b20=>!_0x152b20['attributes'][_0xa22260(0x15c)]&&SAFE_INTEGRATION_TYPES[_0xa22260(0x11a)](_0x152b20[_0xa22260(0x1c6)][_0xa22260(0x1c7)]['toLowerCase']())),_0x5508a6=new Map(),_0x4c34e5=new Map(),_0x518613=new Map(),_0x18a625=new Map(),_0x22c65a=new Map(),_0x53302c=new Map(),_0x5bc00b=new Map();for(const _0x11c1d4 of _0x2e3fda){_0x5508a6[_0xa22260(0x187)](_0x11c1d4['id'],_0x11c1d4['attributes'][_0xa22260(0x1b8)]);}for(const _0x5de20c of _0x5886b1){_0x4c34e5['set'](_0x5de20c['id'],_0x5de20c['attributes'][_0xa22260(0x1b8)]);}for(const _0x3e934c of _0x39502f){_0x518613[_0xa22260(0x187)](_0x3e934c['id'],_0x3e934c[_0xa22260(0x1c6)][_0xa22260(0x1b8)]);}for(const _0x8f2c2b of _0x2a5bb7){_0x18a625[_0xa22260(0x187)](_0x8f2c2b['id'],_0x8f2c2b[_0xa22260(0x1c6)][_0xa22260(0x1b8)]);}for(const _0x42eb6a of _0x41b84c){_0x22c65a[_0xa22260(0x187)](_0x42eb6a['id'],_0x42eb6a['attributes'][_0xa22260(0x1b8)]);}for(const _0x36075d of _0x5b0e16){_0x53302c[_0xa22260(0x187)](_0x36075d['id'],_0x36075d[_0xa22260(0x1c6)][_0xa22260(0x1b8)]);}for(const _0x21bd3d of _0x38a1d1){_0x5bc00b['set'](_0x21bd3d['id'],_0x21bd3d[_0xa22260(0x1c6)][_0xa22260(0x1b8)]);}const _0x298a8f={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x4c34e5,'TextKnowledgeBase':_0x518613,'Agent':_0x5508a6,'WebSearchTool':_0x22c65a,'ImageGenerator':_0x18a625,'ExperimentalKnowledgeBase':_0x5bc00b}),'resolvePromptName':async _0x183f02=>_0x53302c['get'](_0x183f02),'onWarning':_0x2b5b2a=>this['logger'][_0xa22260(0x165)](_0x2b5b2a)},_0x47e1ba={'projectName':_0xf8db67,'outputDir':_0x13b001,'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}}},_0xe6d28a=[],_0x1130e8=[];for(const _0x25f1a6 of _0x2e3fda){const _0x7e9376=getSanitizedPathWithMigration(_0x13b001,_0x25f1a6['attributes'][_0xa22260(0x1b8)]);_0x7e9376['renamed']&&this[_0xa22260(0x14e)][_0xa22260(0x138)](_0xa22260(0x162)+a133_0x10b9e5[_0xa22260(0xbd)](_0x7e9376[_0xa22260(0xfe)])+_0xa22260(0x178)+a133_0x10b9e5['basename'](_0x7e9376[_0xa22260(0x146)]));const _0x3e202a=_0x7e9376['path'],_0x21e858=a133_0x10b9e5[_0xa22260(0x1a7)](_0x3e202a,'prompt.md'),_0x54250e=a133_0x10b9e5[_0xa22260(0x1a7)](_0x3e202a,'agent.yml'),_0x38e6b9=a133_0x10b9e5[_0xa22260(0x1a7)](_0x3e202a,_0xa22260(0x19e)),{yaml:_0x372a13,systemPrompt:_0xeea49d,starterMessage:_0x4c1a4d}=await agentResponseToDef(_0x25f1a6,_0x298a8f),_0x23c756=toAgentYamlString(_0x372a13),_0x56b9be=!a133_0x1dfaa6['existsSync'](_0x54250e);let _0x2e32af=_0x56b9be,_0xed224c;if(!_0x56b9be){const _0x27ff6b=a133_0x1dfaa6[_0xa22260(0x184)](_0x21e858)?a133_0x1dfaa6[_0xa22260(0x1b1)](_0x21e858,_0xa22260(0x13c)):'',_0x22f23b=a133_0x1dfaa6['readFileSync'](_0x54250e,_0xa22260(0x13c)),_0x1710c6=_0xa22260(0x145)+_0x27ff6b+_0xa22260(0x188)+_0x22f23b,_0x352d17=_0xa22260(0x145)+_0xeea49d+_0xa22260(0x188)+_0x23c756,_0x15769e=generateDiff(_0x1710c6,_0x352d17);_0x2e32af=hasChanges(_0x15769e),_0x2e32af&&(_0xed224c=formatDiffWithColors(_0x15769e));}_0xe6d28a[_0xa22260(0x137)]({'path':_0x3e202a,'content':'','isDir':!![]}),_0xe6d28a[_0xa22260(0x137)]({'path':_0x21e858,'content':_0xeea49d}),_0xe6d28a[_0xa22260(0x137)]({'path':_0x54250e,'content':_0x23c756});_0x4c1a4d&&_0x4c1a4d[_0xa22260(0x11a)]('\x0a')&&_0xe6d28a[_0xa22260(0x137)]({'path':_0x38e6b9,'content':_0x4c1a4d});_0x47e1ba[_0xa22260(0x158)][_0xa22260(0x137)]({'agentName':_0x25f1a6['attributes'][_0xa22260(0x1b8)],'outputPath':_0x3e202a,'isNew':_0x56b9be,'hasChanges':_0x2e32af,'diff':_0xed224c}),_0x47e1ba[_0xa22260(0x112)][_0xa22260(0x158)]['total']++;if(_0x56b9be)_0x47e1ba[_0xa22260(0x112)][_0xa22260(0x158)][_0xa22260(0x1b0)]++;else{if(_0x2e32af)_0x47e1ba['counts'][_0xa22260(0x158)][_0xa22260(0x1b9)]++;else _0x47e1ba['counts'][_0xa22260(0x158)][_0xa22260(0x12d)]++;}}for(const _0x4346db of _0x5886b1){if(_0x4346db[_0xa22260(0x1c6)][_0xa22260(0x15c)])continue;const _0x220deb=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x13b001),_0x4346db[_0xa22260(0x1c6)][_0xa22260(0x1b8)],_0xa22260(0xbb));_0x220deb['renamed']&&this[_0xa22260(0x14e)][_0xa22260(0x138)](_0xa22260(0xc7)+a133_0x10b9e5[_0xa22260(0xbd)](_0x220deb[_0xa22260(0xfe)])+'\x20→\x20'+a133_0x10b9e5[_0xa22260(0xbd)](_0x220deb[_0xa22260(0x146)]));const _0x3701f5=_0x220deb[_0xa22260(0x146)],_0x41c2af=apiKnowledgeBaseToYaml(_0x4346db),_0x1bf346=toKnowledgeBaseYamlString(_0x41c2af),_0x14e90e=!a133_0x1dfaa6[_0xa22260(0x184)](_0x3701f5);let _0x2dc733=_0x14e90e,_0x184347;if(!_0x14e90e){const _0x3186f3=a133_0x1dfaa6['readFileSync'](_0x3701f5,_0xa22260(0x13c)),_0x12697f=generateDiff(_0x3186f3,_0x1bf346);_0x2dc733=hasChanges(_0x12697f),_0x2dc733&&(_0x184347=formatDiffWithColors(_0x12697f));}_0xe6d28a[_0xa22260(0x137)]({'path':_0x3701f5,'content':_0x1bf346}),_0x47e1ba[_0xa22260(0xc5)]['push']({'name':_0x4346db[_0xa22260(0x1c6)]['name'],'outputPath':_0x3701f5,'isNew':_0x14e90e,'hasChanges':_0x2dc733,'diff':_0x184347}),_0x47e1ba[_0xa22260(0x112)][_0xa22260(0xc5)][_0xa22260(0x1be)]++;if(_0x14e90e)_0x47e1ba['counts'][_0xa22260(0xc5)][_0xa22260(0x1b0)]++;else{if(_0x2dc733)_0x47e1ba['counts'][_0xa22260(0xc5)][_0xa22260(0x1b9)]++;else _0x47e1ba[_0xa22260(0x112)][_0xa22260(0xc5)]['unchanged']++;}}for(const _0x9fbef4 of _0x39502f){if(_0x9fbef4[_0xa22260(0x1c6)]['isManaged'])continue;const _0x3235a3=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x13b001),_0x9fbef4[_0xa22260(0x1c6)]['name'],_0xa22260(0xf8));_0x3235a3[_0xa22260(0x16b)]&&this[_0xa22260(0x14e)]['info'](_0xa22260(0xee)+a133_0x10b9e5[_0xa22260(0xbd)](_0x3235a3[_0xa22260(0xfe)])+'\x20→\x20'+a133_0x10b9e5['basename'](_0x3235a3[_0xa22260(0x146)]));const _0x504220=_0x3235a3[_0xa22260(0x146)],_0x17ebf2=toTextKnowledgeBaseMd(_0x9fbef4[_0xa22260(0x1c6)][_0xa22260(0x1b8)],_0x9fbef4['attributes'][_0xa22260(0x181)]),_0x1dbd41=!a133_0x1dfaa6[_0xa22260(0x184)](_0x504220);let _0x545f57=_0x1dbd41,_0x544b15;if(!_0x1dbd41){const _0x43e5ee=a133_0x1dfaa6[_0xa22260(0x1b1)](_0x504220,_0xa22260(0x13c)),_0x1e56bb=generateDiff(_0x43e5ee,_0x17ebf2);_0x545f57=hasChanges(_0x1e56bb),_0x545f57&&(_0x544b15=formatDiffWithColors(_0x1e56bb));}_0xe6d28a[_0xa22260(0x137)]({'path':_0x504220,'content':_0x17ebf2}),_0x47e1ba['textKnowledgeBases']['push']({'name':_0x9fbef4['attributes'][_0xa22260(0x1b8)],'outputPath':_0x504220,'isNew':_0x1dbd41,'hasChanges':_0x545f57,'diff':_0x544b15}),_0x47e1ba[_0xa22260(0x112)][_0xa22260(0x115)][_0xa22260(0x1be)]++;if(_0x1dbd41)_0x47e1ba['counts'][_0xa22260(0x115)]['new']++;else{if(_0x545f57)_0x47e1ba['counts'][_0xa22260(0x115)][_0xa22260(0x1b9)]++;else _0x47e1ba[_0xa22260(0x112)][_0xa22260(0x115)][_0xa22260(0x12d)]++;}}for(const _0x5aa98b of _0x5b0e16){if(_0x5aa98b[_0xa22260(0x1c6)][_0xa22260(0x15c)])continue;const _0x2f9919=getSanitizedPathWithMigration(getPromptsDir(_0x13b001),_0x5aa98b[_0xa22260(0x1c6)]['name'],_0xa22260(0xbb));_0x2f9919['renamed']&&this[_0xa22260(0x14e)][_0xa22260(0x138)](_0xa22260(0x183)+a133_0x10b9e5[_0xa22260(0xbd)](_0x2f9919[_0xa22260(0xfe)])+_0xa22260(0x178)+a133_0x10b9e5[_0xa22260(0xbd)](_0x2f9919[_0xa22260(0x146)]));const _0x4d6593=_0x2f9919['path'],_0x4895f7=await apiPromptToYaml(_0x5aa98b,_0x298a8f);if(!_0x4895f7)continue;const _0x254288=toPromptYamlString(_0x4895f7),_0x390c8f=!a133_0x1dfaa6[_0xa22260(0x184)](_0x4d6593);let _0xdc3bab=_0x390c8f,_0x158e15;if(!_0x390c8f){const _0x27d7ee=a133_0x1dfaa6[_0xa22260(0x1b1)](_0x4d6593,_0xa22260(0x13c)),_0x21eeb9=generateDiff(_0x27d7ee,_0x254288);_0xdc3bab=hasChanges(_0x21eeb9),_0xdc3bab&&(_0x158e15=formatDiffWithColors(_0x21eeb9));}_0xe6d28a[_0xa22260(0x137)]({'path':_0x4d6593,'content':_0x254288}),_0x47e1ba[_0xa22260(0x11d)][_0xa22260(0x137)]({'name':_0x5aa98b[_0xa22260(0x1c6)][_0xa22260(0x1b8)],'outputPath':_0x4d6593,'isNew':_0x390c8f,'hasChanges':_0xdc3bab,'diff':_0x158e15}),_0x47e1ba['counts'][_0xa22260(0x11d)][_0xa22260(0x1be)]++;if(_0x390c8f)_0x47e1ba[_0xa22260(0x112)][_0xa22260(0x11d)][_0xa22260(0x1b0)]++;else{if(_0xdc3bab)_0x47e1ba[_0xa22260(0x112)][_0xa22260(0x11d)][_0xa22260(0x1b9)]++;else _0x47e1ba['counts']['prompts']['unchanged']++;}}for(const _0x3c5fbf of _0x29a5e8){const _0x14ef51=_0x3c5fbf[_0xa22260(0x1c6)]['serviceType']['toLowerCase'](),_0x4a78d1=getSanitizedPathWithMigration(getIntegrationsDir(_0x13b001),_0x14ef51,_0xa22260(0xbb));_0x4a78d1['renamed']&&this[_0xa22260(0x14e)]['info'](_0xa22260(0x128)+a133_0x10b9e5[_0xa22260(0xbd)](_0x4a78d1[_0xa22260(0xfe)])+'\x20→\x20'+a133_0x10b9e5[_0xa22260(0xbd)](_0x4a78d1[_0xa22260(0x146)]));const _0x50b5d9=_0x4a78d1['path'],_0xcfeb1b=await apiIntegrationToYaml(_0x3c5fbf,_0x298a8f),_0x5ae1d7=toIntegrationYamlString(_0xcfeb1b),_0x55ffca=!a133_0x1dfaa6[_0xa22260(0x184)](_0x50b5d9);let _0x567287=_0x55ffca,_0x5a8514;if(!_0x55ffca){const _0x27189a=a133_0x1dfaa6['readFileSync'](_0x50b5d9,_0xa22260(0x13c)),_0x2f06f0=generateDiff(_0x27189a,_0x5ae1d7);_0x567287=hasChanges(_0x2f06f0),_0x567287&&(_0x5a8514=formatDiffWithColors(_0x2f06f0));}_0xe6d28a[_0xa22260(0x137)]({'path':_0x50b5d9,'content':_0x5ae1d7}),_0x47e1ba[_0xa22260(0x9e)][_0xa22260(0x137)]({'name':_0x14ef51,'outputPath':_0x50b5d9,'isNew':_0x55ffca,'hasChanges':_0x567287,'diff':_0x5a8514}),_0x47e1ba[_0xa22260(0x112)][_0xa22260(0x9e)][_0xa22260(0x1be)]++;if(_0x55ffca)_0x47e1ba[_0xa22260(0x112)][_0xa22260(0x9e)]['new']++;else{if(_0x567287)_0x47e1ba[_0xa22260(0x112)][_0xa22260(0x9e)]['updated']++;else _0x47e1ba[_0xa22260(0x112)]['integrations'][_0xa22260(0x12d)]++;}}for(const _0x5ec6f2 of _0x38a1d1){if(_0x5ec6f2[_0xa22260(0x1c6)][_0xa22260(0x15c)])continue;const _0xed7f9d=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x13b001),_0x5ec6f2[_0xa22260(0x1c6)][_0xa22260(0x1b8)]);_0xed7f9d['renamed']&&this['logger'][_0xa22260(0x138)](_0xa22260(0xfc)+a133_0x10b9e5['basename'](_0xed7f9d['oldPath'])+_0xa22260(0x178)+a133_0x10b9e5[_0xa22260(0xbd)](_0xed7f9d[_0xa22260(0x146)]));const _0x22e5cc=_0xed7f9d[_0xa22260(0x146)],_0x45f510=a133_0x10b9e5['join'](_0x22e5cc,sanitizeForFilesystem(_0x5ec6f2[_0xa22260(0x1c6)]['name'])+_0xa22260(0xbb)),_0x2c3040=a133_0x10b9e5[_0xa22260(0x1a7)](_0x22e5cc,_0xa22260(0x17c)),_0x14549b=apiExperimentalKnowledgeBaseToYaml(_0x5ec6f2),_0x3e716f=toExperimentalKnowledgeBaseYamlString(_0x14549b),_0xbd6b40=!a133_0x1dfaa6[_0xa22260(0x184)](_0x22e5cc);let _0x3de459=_0xbd6b40,_0xf4ef66,_0x5b23e2=_0x3e716f;const _0x121350=[..._0x14549b['functions']][_0xa22260(0x13b)]((_0x3bd246,_0x570dc2)=>_0x3bd246[_0xa22260(0x1b8)]['localeCompare'](_0x570dc2[_0xa22260(0x1b8)]));for(const _0x43d96b of _0x121350){_0x5b23e2+=_0xa22260(0x179)+_0x43d96b['name']+_0xa22260(0x174)+_0x43d96b[_0xa22260(0xb6)]+_0xa22260(0x10b)+_0x43d96b[_0xa22260(0x1b8)]+_0xa22260(0x174)+_0x43d96b['json_schema']+'\x0a';}if(!_0xbd6b40){let _0x2889c0='';a133_0x1dfaa6[_0xa22260(0x184)](_0x45f510)&&(_0x2889c0=a133_0x1dfaa6[_0xa22260(0x1b1)](_0x45f510,_0xa22260(0x13c)));if(a133_0x1dfaa6['existsSync'](_0x2c3040)){const _0x26c58e=a133_0x1dfaa6[_0xa22260(0x1b6)](_0x2c3040,{'withFileTypes':!![]}),_0x588bc3=_0x26c58e[_0xa22260(0x104)](_0x3ad565=>_0x3ad565['isDirectory']())[_0xa22260(0x13b)]((_0x589318,_0x5ec89f)=>_0x589318[_0xa22260(0x1b8)][_0xa22260(0x161)](_0x5ec89f['name']));for(const _0x5642b9 of _0x588bc3){const _0x2f13af=a133_0x10b9e5[_0xa22260(0x1a7)](_0x2c3040,_0x5642b9[_0xa22260(0x1b8)],_0xa22260(0x1bf)),_0x40cef5=a133_0x10b9e5[_0xa22260(0x1a7)](_0x2c3040,_0x5642b9[_0xa22260(0x1b8)],_0xa22260(0x14c));a133_0x1dfaa6[_0xa22260(0x184)](_0x2f13af)&&(_0x2889c0+=_0xa22260(0x179)+_0x5642b9[_0xa22260(0x1b8)]+_0xa22260(0x174)+a133_0x1dfaa6['readFileSync'](_0x2f13af,_0xa22260(0x13c))+'\x0a'),a133_0x1dfaa6[_0xa22260(0x184)](_0x40cef5)&&(_0x2889c0+='---\x20schema:\x20'+_0x5642b9[_0xa22260(0x1b8)]+'\x20---\x0a'+a133_0x1dfaa6[_0xa22260(0x1b1)](_0x40cef5,_0xa22260(0x13c))+'\x0a');}}const _0x6a9cd8=generateDiff(_0x2889c0,_0x5b23e2);_0x3de459=hasChanges(_0x6a9cd8),_0x3de459&&(_0xf4ef66=formatDiffWithColors(_0x6a9cd8));}_0xe6d28a[_0xa22260(0x137)]({'path':_0x22e5cc,'content':'','isDir':!![]}),_0xe6d28a['push']({'path':_0x45f510,'content':_0x3e716f}),_0xe6d28a['push']({'path':_0x2c3040,'content':'','isDir':!![]});for(const _0x5f3a76 of _0x14549b[_0xa22260(0x17c)]){const _0x2c982b=a133_0x10b9e5[_0xa22260(0x1a7)](_0x2c3040,sanitizeForFilesystem(_0x5f3a76[_0xa22260(0x1b8)])),_0x478858=a133_0x10b9e5[_0xa22260(0x1a7)](_0x2c982b,_0xa22260(0x1bf)),_0x38bf71=a133_0x10b9e5['join'](_0x2c982b,'json_schema.json');_0xe6d28a[_0xa22260(0x137)]({'path':_0x2c982b,'content':'','isDir':!![]}),_0xe6d28a[_0xa22260(0x137)]({'path':_0x478858,'content':_0x5f3a76[_0xa22260(0xb6)]}),_0xe6d28a[_0xa22260(0x137)]({'path':_0x38bf71,'content':_0x5f3a76[_0xa22260(0xce)]});}if(a133_0x1dfaa6['existsSync'](_0x2c3040)){const _0x54e07b=a133_0x1dfaa6[_0xa22260(0x1b6)](_0x2c3040,{'withFileTypes':!![]}),_0x57b70e=new Set(_0x14549b['functions'][_0xa22260(0xbe)](_0xa98fa9=>sanitizeForFilesystem(_0xa98fa9[_0xa22260(0x1b8)])));for(const _0x1af0c8 of _0x54e07b){if(_0x1af0c8[_0xa22260(0x135)]()&&!_0x57b70e['has'](_0x1af0c8[_0xa22260(0x1b8)])){const _0x434fd8=a133_0x10b9e5['join'](_0x2c3040,_0x1af0c8[_0xa22260(0x1b8)]);_0x1130e8[_0xa22260(0x137)]({'path':_0x434fd8,'isDir':!![]});}}}_0x47e1ba[_0xa22260(0x197)]['push']({'name':_0x5ec6f2['attributes'][_0xa22260(0x1b8)],'outputPath':_0x22e5cc,'isNew':_0xbd6b40,'hasChanges':_0x3de459,'diff':_0xf4ef66}),_0x47e1ba[_0xa22260(0x112)][_0xa22260(0x197)][_0xa22260(0x1be)]++;if(_0xbd6b40)_0x47e1ba[_0xa22260(0x112)][_0xa22260(0x197)][_0xa22260(0x1b0)]++;else{if(_0x3de459)_0x47e1ba[_0xa22260(0x112)]['experimentalKnowledgeBases'][_0xa22260(0x1b9)]++;else _0x47e1ba['counts'][_0xa22260(0x197)]['unchanged']++;}}for(const _0x5afcb0 of _0x50d37e){if(_0x5afcb0[_0xa22260(0x1c6)][_0xa22260(0x15c)])continue;const _0x5e808a=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x13b001),_0x5afcb0['attributes']['name']);_0x5e808a[_0xa22260(0x16b)]&&this[_0xa22260(0x14e)]['info'](_0xa22260(0x18e)+a133_0x10b9e5['basename'](_0x5e808a[_0xa22260(0xfe)])+_0xa22260(0x178)+a133_0x10b9e5[_0xa22260(0xbd)](_0x5e808a['path']));const _0x3ffa4b=_0x5e808a[_0xa22260(0x146)],_0x343370=a133_0x10b9e5['join'](_0x3ffa4b,sanitizeForFilesystem(_0x5afcb0['attributes'][_0xa22260(0x1b8)])+_0xa22260(0xbb)),_0x498184=a133_0x10b9e5[_0xa22260(0x1a7)](_0x3ffa4b,'code.js'),_0x5351c9=a133_0x10b9e5[_0xa22260(0x1a7)](_0x3ffa4b,_0xa22260(0xac)),_0x1ff416=apiExperimentalArtifactToYaml(_0x5afcb0),_0x3faf38=toExperimentalArtifactYamlString(_0x1ff416),_0x27b38a=!a133_0x1dfaa6['existsSync'](_0x3ffa4b);let _0x504b03=_0x27b38a,_0x40cfe6,_0x2211bb=_0x3faf38+(_0xa22260(0x14f)+_0x1ff416['code']+'\x0a');const _0x27fd0d=[..._0x1ff416[_0xa22260(0xac)]][_0xa22260(0x13b)]((_0x2f9d32,_0x55135d)=>_0x2f9d32[_0xa22260(0xb1)]['localeCompare'](_0x55135d[_0xa22260(0xb1)]));for(const _0x254437 of _0x27fd0d){_0x2211bb+=_0xa22260(0x198)+_0x254437['file_name']+'\x20---\x0a'+_0x254437[_0xa22260(0x1c9)]+'\x0a';}if(!_0x27b38a){let _0x14e73f='';a133_0x1dfaa6[_0xa22260(0x184)](_0x343370)&&(_0x14e73f=a133_0x1dfaa6[_0xa22260(0x1b1)](_0x343370,'utf-8'));a133_0x1dfaa6[_0xa22260(0x184)](_0x498184)&&(_0x14e73f+=_0xa22260(0x14f)+a133_0x1dfaa6[_0xa22260(0x1b1)](_0x498184,_0xa22260(0x13c))+'\x0a');if(a133_0x1dfaa6[_0xa22260(0x184)](_0x5351c9)){const _0x199985=a133_0x1dfaa6['readdirSync'](_0x5351c9),_0x3a5ba4=_0x199985[_0xa22260(0x104)](_0x205c74=>{const _0x46e733=_0xa22260,_0x1b12a5=a133_0x10b9e5[_0x46e733(0x1a7)](_0x5351c9,_0x205c74);return a133_0x1dfaa6['statSync'](_0x1b12a5)[_0x46e733(0x1aa)]();})['sort']((_0x31f8c6,_0x427af7)=>_0x31f8c6['localeCompare'](_0x427af7));for(const _0x441421 of _0x3a5ba4){const _0x3fc23e=a133_0x10b9e5[_0xa22260(0x1a7)](_0x5351c9,_0x441421);_0x14e73f+=_0xa22260(0x198)+_0x441421+'\x20---\x0a'+a133_0x1dfaa6[_0xa22260(0x1b1)](_0x3fc23e,_0xa22260(0x13c))+'\x0a';}}const _0x5c5c36=generateDiff(_0x14e73f,_0x2211bb);_0x504b03=hasChanges(_0x5c5c36),_0x504b03&&(_0x40cfe6=formatDiffWithColors(_0x5c5c36));}_0xe6d28a[_0xa22260(0x137)]({'path':_0x3ffa4b,'content':'','isDir':!![]}),_0xe6d28a[_0xa22260(0x137)]({'path':_0x343370,'content':_0x3faf38}),_0xe6d28a['push']({'path':_0x498184,'content':_0x1ff416['code']});if(_0x1ff416['files'][_0xa22260(0x1c5)]>0x0){_0xe6d28a['push']({'path':_0x5351c9,'content':'','isDir':!![]});for(const _0x392f15 of _0x1ff416[_0xa22260(0xac)]){const _0xecd1a3=a133_0x10b9e5['join'](_0x5351c9,_0x392f15[_0xa22260(0xb1)]);_0xe6d28a[_0xa22260(0x137)]({'path':_0xecd1a3,'content':_0x392f15[_0xa22260(0x1c9)]});}}if(a133_0x1dfaa6['existsSync'](_0x5351c9)){const _0x2da270=a133_0x1dfaa6[_0xa22260(0x1b6)](_0x5351c9),_0x8e326f=new Set(_0x1ff416[_0xa22260(0xac)][_0xa22260(0xbe)](_0x1ed7f3=>_0x1ed7f3[_0xa22260(0xb1)]));for(const _0x30b043 of _0x2da270){const _0x2675c0=a133_0x10b9e5[_0xa22260(0x1a7)](_0x5351c9,_0x30b043);a133_0x1dfaa6[_0xa22260(0x194)](_0x2675c0)[_0xa22260(0x1aa)]()&&!_0x8e326f[_0xa22260(0xb8)](_0x30b043)&&_0x1130e8[_0xa22260(0x137)]({'path':_0x2675c0});}}_0x47e1ba['experimentalArtifacts'][_0xa22260(0x137)]({'name':_0x5afcb0[_0xa22260(0x1c6)][_0xa22260(0x1b8)],'outputPath':_0x3ffa4b,'isNew':_0x27b38a,'hasChanges':_0x504b03,'diff':_0x40cfe6}),_0x47e1ba['counts']['experimentalArtifacts'][_0xa22260(0x1be)]++;if(_0x27b38a)_0x47e1ba[_0xa22260(0x112)][_0xa22260(0x17a)][_0xa22260(0x1b0)]++;else{if(_0x504b03)_0x47e1ba[_0xa22260(0x112)]['experimentalArtifacts'][_0xa22260(0x1b9)]++;else _0x47e1ba['counts'][_0xa22260(0x17a)]['unchanged']++;}}for(const _0x2faca5 of _0x38e8e2){const _0xe0b973=getSanitizedPathWithMigration(getFormInterfacesDir(_0x13b001),_0x2faca5[_0xa22260(0x1c6)][_0xa22260(0x1b8)],_0xa22260(0xbb));_0xe0b973[_0xa22260(0x16b)]&&this[_0xa22260(0x14e)][_0xa22260(0x138)](_0xa22260(0xd9)+a133_0x10b9e5['basename'](_0xe0b973[_0xa22260(0xfe)])+_0xa22260(0x178)+a133_0x10b9e5[_0xa22260(0xbd)](_0xe0b973[_0xa22260(0x146)]));const _0x1d97fd=_0xe0b973[_0xa22260(0x146)],_0x2406ce=await apiFormInterfaceToYaml(_0x2faca5,_0x298a8f),_0x1d3b14=toFormInterfaceYamlString(_0x2406ce),_0xdbf887=!a133_0x1dfaa6[_0xa22260(0x184)](_0x1d97fd);let _0x36ff13=_0xdbf887,_0x34dec4;if(!_0xdbf887){const _0x40845c=a133_0x1dfaa6[_0xa22260(0x1b1)](_0x1d97fd,_0xa22260(0x13c)),_0x438d7a=generateDiff(_0x40845c,_0x1d3b14);_0x36ff13=hasChanges(_0x438d7a),_0x36ff13&&(_0x34dec4=formatDiffWithColors(_0x438d7a));}_0xe6d28a[_0xa22260(0x137)]({'path':_0x1d97fd,'content':_0x1d3b14}),_0x47e1ba['formInterfaces']['push']({'name':_0x2faca5[_0xa22260(0x1c6)][_0xa22260(0x1b8)],'outputPath':_0x1d97fd,'isNew':_0xdbf887,'hasChanges':_0x36ff13,'diff':_0x34dec4}),_0x47e1ba[_0xa22260(0x112)]['formInterfaces'][_0xa22260(0x1be)]++;if(_0xdbf887)_0x47e1ba[_0xa22260(0x112)][_0xa22260(0x13a)][_0xa22260(0x1b0)]++;else{if(_0x36ff13)_0x47e1ba[_0xa22260(0x112)][_0xa22260(0x13a)]['updated']++;else _0x47e1ba[_0xa22260(0x112)][_0xa22260(0x13a)][_0xa22260(0x12d)]++;}}for(const _0x543178 of _0x4d8e3c){if(_0x543178[_0xa22260(0x1c6)]['isManaged'])continue;const _0x46e284=getSanitizedPathWithMigration(getChatInterfacesDir(_0x13b001),_0x543178[_0xa22260(0x1c6)]['name'],_0xa22260(0xbb));_0x46e284[_0xa22260(0x16b)]&&this[_0xa22260(0x14e)][_0xa22260(0x138)](_0xa22260(0x131)+a133_0x10b9e5['basename'](_0x46e284[_0xa22260(0xfe)])+_0xa22260(0x178)+a133_0x10b9e5[_0xa22260(0xbd)](_0x46e284['path']));const _0x2a224e=_0x46e284['path'],_0x433948=await apiChatInterfaceToYaml(_0x543178,_0x298a8f),_0x2b1755=toChatInterfaceYamlString(_0x433948),_0x1264c6=!a133_0x1dfaa6['existsSync'](_0x2a224e);let _0x582edb=_0x1264c6,_0x544714;if(!_0x1264c6){const _0x58b440=a133_0x1dfaa6[_0xa22260(0x1b1)](_0x2a224e,'utf-8'),_0x29db5a=generateDiff(_0x58b440,_0x2b1755);_0x582edb=hasChanges(_0x29db5a),_0x582edb&&(_0x544714=formatDiffWithColors(_0x29db5a));}_0xe6d28a['push']({'path':_0x2a224e,'content':_0x2b1755}),_0x47e1ba[_0xa22260(0x14d)]['push']({'name':_0x543178['attributes'][_0xa22260(0x1b8)],'outputPath':_0x2a224e,'isNew':_0x1264c6,'hasChanges':_0x582edb,'diff':_0x544714}),_0x47e1ba['counts'][_0xa22260(0x14d)][_0xa22260(0x1be)]++;if(_0x1264c6)_0x47e1ba[_0xa22260(0x112)][_0xa22260(0x14d)][_0xa22260(0x1b0)]++;else{if(_0x582edb)_0x47e1ba[_0xa22260(0x112)]['chatInterfaces'][_0xa22260(0x1b9)]++;else _0x47e1ba[_0xa22260(0x112)][_0xa22260(0x14d)][_0xa22260(0x12d)]++;}}if(_0x45c8f0?.[_0xa22260(0xcc)])return _0x47e1ba;a133_0x1dfaa6[_0xa22260(0xd2)](_0x13b001,{'recursive':!![]}),a133_0x1dfaa6[_0xa22260(0xd2)](getKnowledgeBasesDir(_0x13b001),{'recursive':!![]}),a133_0x1dfaa6[_0xa22260(0xd2)](getPromptsDir(_0x13b001),{'recursive':!![]}),a133_0x1dfaa6[_0xa22260(0xd2)](getIntegrationsDir(_0x13b001),{'recursive':!![]}),a133_0x1dfaa6[_0xa22260(0xd2)](getExperimentalKnowledgeBasesDir(_0x13b001),{'recursive':!![]}),a133_0x1dfaa6[_0xa22260(0xd2)](getExperimentalArtifactsDir(_0x13b001),{'recursive':!![]}),a133_0x1dfaa6[_0xa22260(0xd2)](getFormInterfacesDir(_0x13b001),{'recursive':!![]}),a133_0x1dfaa6[_0xa22260(0xd2)](getChatInterfacesDir(_0x13b001),{'recursive':!![]});const _0x9f3340=a133_0x10b9e5[_0xa22260(0x1a7)](_0x13b001,'tdx.json');a133_0x1dfaa6[_0xa22260(0xd6)](_0x9f3340,createAgentConfigContent(_0xf8db67));for(const _0x187f23 of _0xe6d28a){if(_0x187f23[_0xa22260(0xe5)])a133_0x1dfaa6[_0xa22260(0xd2)](_0x187f23[_0xa22260(0x146)],{'recursive':!![]});else{const _0x553b1b=a133_0x10b9e5['dirname'](_0x187f23[_0xa22260(0x146)]);!a133_0x1dfaa6[_0xa22260(0x184)](_0x553b1b)&&a133_0x1dfaa6['mkdirSync'](_0x553b1b,{'recursive':!![]}),a133_0x1dfaa6['writeFileSync'](_0x187f23[_0xa22260(0x146)],_0x187f23['content']);}}for(const _0x2dd51c of _0x1130e8){_0x2dd51c[_0xa22260(0xe5)]?(a133_0x1dfaa6[_0xa22260(0xb2)](_0x2dd51c['path'],{'recursive':!![],'force':!![]}),this[_0xa22260(0x14e)]['info'](_0xa22260(0xe8)+a133_0x10b9e5['basename'](a133_0x10b9e5[_0xa22260(0x13f)](_0x2dd51c['path']))+'/'+a133_0x10b9e5[_0xa22260(0xbd)](_0x2dd51c[_0xa22260(0x146)]))):(a133_0x1dfaa6[_0xa22260(0xb2)](_0x2dd51c['path'],{'force':!![]}),this[_0xa22260(0x14e)][_0xa22260(0x138)]('Removed\x20deleted\x20file:\x20'+a133_0x10b9e5[_0xa22260(0xbd)](a133_0x10b9e5['dirname'](_0x2dd51c[_0xa22260(0x146)]))+'/'+a133_0x10b9e5[_0xa22260(0xbd)](_0x2dd51c[_0xa22260(0x146)])));}return _0x47e1ba;}async[a133_0x32634e(0xf0)](_0x309e28,_0x18675d){const _0x34fc98=a133_0x32634e,_0xdb26ff=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x309e28,_0x34fc98(0x101));if(!a133_0x1dfaa6['existsSync'](_0xdb26ff))throw new SDKError(ErrorCode[_0x34fc98(0x10d)],_0x34fc98(0x14b)+_0x309e28,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x18e296=loadAgentConfig(_0xdb26ff),_0x3f8b61=await this[_0x34fc98(0x186)](_0x18e296[_0x34fc98(0xcb)]),_0x11a29f=await this['client'][_0x34fc98(0x1b2)](_0x3f8b61),_0x19bf21=_0x11a29f[_0x34fc98(0x1c6)]['name'],_0x3074d7={'projectName':_0x19bf21,'projectId':_0x3f8b61,'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}}},_0x416d82=[],_0x44fab0=[],_0x54528c=[],_0x3ca981=[],_0x56818b=[],_0x1c1461=[],_0x2e5268=a133_0x1dfaa6[_0x34fc98(0x1b6)](_0x309e28,{'withFileTypes':!![]});for(const _0x2d2209 of _0x2e5268){if(!_0x2d2209[_0x34fc98(0x135)]())continue;if(['knowledge_bases',_0x34fc98(0x11d),'integrations',_0x34fc98(0x152),_0x34fc98(0x1ca),_0x34fc98(0x11b),_0x34fc98(0x133)][_0x34fc98(0x11a)](_0x2d2209[_0x34fc98(0x1b8)]))continue;const _0x5ac60a=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x309e28,_0x2d2209[_0x34fc98(0x1b8)]);if(isAgentDir(_0x5ac60a)){const _0x4810e6=a133_0x10b9e5['join'](_0x5ac60a,_0x34fc98(0xf7)),_0x3efd01=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x5ac60a,_0x34fc98(0xbf)),_0x36fefa=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x5ac60a,'starter_message.md'),_0x8ba0fe=parseAgentYaml(a133_0x1dfaa6[_0x34fc98(0x1b1)](_0x4810e6,_0x34fc98(0x13c)),_0x4810e6),_0x1d8f5d=a133_0x1dfaa6[_0x34fc98(0x184)](_0x3efd01)?a133_0x1dfaa6[_0x34fc98(0x1b1)](_0x3efd01,_0x34fc98(0x13c)):'',_0x1f983b=a133_0x1dfaa6['existsSync'](_0x36fefa)?a133_0x1dfaa6[_0x34fc98(0x1b1)](_0x36fefa,_0x34fc98(0x13c)):_0x8ba0fe[_0x34fc98(0xd7)];_0x416d82[_0x34fc98(0x137)]({'name':_0x8ba0fe[_0x34fc98(0x1b8)],'dir':_0x5ac60a,'yaml':_0x8ba0fe,'systemPrompt':_0x1d8f5d,'starterMessage':_0x1f983b});}}const _0x2695ed=getKnowledgeBasesDir(_0x309e28);if(a133_0x1dfaa6[_0x34fc98(0x184)](_0x2695ed)){const _0x2bf6ca=a133_0x1dfaa6[_0x34fc98(0x1b6)](_0x2695ed);for(const _0x84976a of _0x2bf6ca){const _0x1973bc=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x2695ed,_0x84976a);if(_0x84976a[_0x34fc98(0x1c1)](_0x34fc98(0xbb))){const _0x17e30c=parseKnowledgeBaseYaml(a133_0x1dfaa6[_0x34fc98(0x1b1)](_0x1973bc,_0x34fc98(0x13c)),_0x1973bc);_0x44fab0[_0x34fc98(0x137)]({'name':_0x17e30c[_0x34fc98(0x1b8)],'path':_0x1973bc,'yaml':_0x17e30c});}else{if(_0x84976a['endsWith'](_0x34fc98(0xf8))){const _0x517438=a133_0x1dfaa6[_0x34fc98(0x1b1)](_0x1973bc,'utf-8'),{name:_0x39b1dd,text:_0x19b23f}=parseTextKnowledgeBaseMd(_0x517438,_0x84976a);_0x54528c[_0x34fc98(0x137)]({'name':_0x39b1dd,'path':_0x1973bc,'text':_0x19b23f});}}}}const _0x5598f4=getPromptsDir(_0x309e28);if(a133_0x1dfaa6[_0x34fc98(0x184)](_0x5598f4)){const _0x3a0ae7=a133_0x1dfaa6[_0x34fc98(0x1b6)](_0x5598f4)[_0x34fc98(0x104)](_0x4a7ea3=>_0x4a7ea3[_0x34fc98(0x1c1)](_0x34fc98(0xbb)));for(const _0x274f16 of _0x3a0ae7){const _0x1acc11=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x5598f4,_0x274f16),_0x35790f=parsePromptYaml(a133_0x1dfaa6['readFileSync'](_0x1acc11,_0x34fc98(0x13c)),_0x1acc11);_0x3ca981[_0x34fc98(0x137)]({'name':_0x35790f[_0x34fc98(0x1b8)],'path':_0x1acc11,'yaml':_0x35790f});}}const _0x2bac64=[],_0x29925b=getIntegrationsDir(_0x309e28);if(a133_0x1dfaa6[_0x34fc98(0x184)](_0x29925b)){const _0x2158c9=a133_0x1dfaa6[_0x34fc98(0x1b6)](_0x29925b)[_0x34fc98(0x104)](_0x594680=>_0x594680['endsWith']('.yml'));for(const _0x4341a8 of _0x2158c9){const _0x40681e=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x29925b,_0x4341a8),_0x2423a2=parseIntegrationYaml(a133_0x1dfaa6[_0x34fc98(0x1b1)](_0x40681e,_0x34fc98(0x13c)),_0x40681e);if(!SAFE_INTEGRATION_TYPES[_0x34fc98(0x11a)](_0x2423a2[_0x34fc98(0x105)][_0x34fc98(0x19d)]())){this[_0x34fc98(0x14e)][_0x34fc98(0x165)]('Skipping\x20integration\x20\x27'+_0x2423a2[_0x34fc98(0x1b8)]+'\x27\x20('+_0x2423a2['service_type']+_0x34fc98(0x106)+(_0x34fc98(0xc3)+SAFE_INTEGRATION_TYPES[_0x34fc98(0x1a7)](',\x20')+_0x34fc98(0x18b))+_0x34fc98(0x190));continue;}_0x2bac64[_0x34fc98(0x137)]({'name':_0x2423a2[_0x34fc98(0x1b8)],'path':_0x40681e,'yaml':_0x2423a2});}}const _0x3cdbf3=getExperimentalKnowledgeBasesDir(_0x309e28);if(a133_0x1dfaa6[_0x34fc98(0x184)](_0x3cdbf3)){const _0x268d46=a133_0x1dfaa6[_0x34fc98(0x1b6)](_0x3cdbf3,{'withFileTypes':!![]});for(const _0x443e7e of _0x268d46){if(!_0x443e7e[_0x34fc98(0x135)]())continue;const _0x2ba20a=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x3cdbf3,_0x443e7e[_0x34fc98(0x1b8)]),_0x29bb2c=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x2ba20a,_0x443e7e['name']+_0x34fc98(0xbb)),_0x5ea0e5=a133_0x10b9e5['join'](_0x2ba20a,'functions');if(!a133_0x1dfaa6['existsSync'](_0x29bb2c))continue;const _0x299b78=parseExperimentalKnowledgeBaseYaml(a133_0x1dfaa6[_0x34fc98(0x1b1)](_0x29bb2c,'utf-8'),_0x29bb2c),_0x46625c=[];if(a133_0x1dfaa6[_0x34fc98(0x184)](_0x5ea0e5)){const _0x2d9c51=a133_0x1dfaa6['readdirSync'](_0x5ea0e5,{'withFileTypes':!![]});for(const _0x4a439f of _0x2d9c51){if(!_0x4a439f[_0x34fc98(0x135)]())continue;const _0x89d516=a133_0x10b9e5['join'](_0x5ea0e5,_0x4a439f[_0x34fc98(0x1b8)]),_0x105381=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x89d516,_0x34fc98(0x1bf)),_0x557de8=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x89d516,_0x34fc98(0x14c));a133_0x1dfaa6['existsSync'](_0x105381)&&a133_0x1dfaa6[_0x34fc98(0x184)](_0x557de8)&&_0x46625c['push']({'name':_0x4a439f[_0x34fc98(0x1b8)],'code':a133_0x1dfaa6[_0x34fc98(0x1b1)](_0x105381,'utf-8'),'json_schema':a133_0x1dfaa6[_0x34fc98(0x1b1)](_0x557de8,'utf-8')});}}const _0x271dce={..._0x299b78,'variables':_0x299b78['variables']||[],'functions':_0x46625c};_0x56818b[_0x34fc98(0x137)]({'name':_0x299b78[_0x34fc98(0x1b8)],'dir':_0x2ba20a,'def':_0x271dce});}}const _0x170dee=getExperimentalArtifactsDir(_0x309e28);if(a133_0x1dfaa6['existsSync'](_0x170dee)){const _0x4f2c99=a133_0x1dfaa6[_0x34fc98(0x1b6)](_0x170dee,{'withFileTypes':!![]});for(const _0x2f0854 of _0x4f2c99){if(!_0x2f0854[_0x34fc98(0x135)]())continue;const _0x59a8d1=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x170dee,_0x2f0854['name']),_0x42a860=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x59a8d1,_0x2f0854[_0x34fc98(0x1b8)]+_0x34fc98(0xbb)),_0x7a73e9=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x59a8d1,_0x34fc98(0x1bf)),_0x55bba2=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x59a8d1,'files');if(!a133_0x1dfaa6[_0x34fc98(0x184)](_0x42a860)||!a133_0x1dfaa6[_0x34fc98(0x184)](_0x7a73e9))continue;const _0x3c776d=parseExperimentalArtifactYaml(a133_0x1dfaa6['readFileSync'](_0x42a860,_0x34fc98(0x13c)),_0x42a860),_0x339eeb=a133_0x1dfaa6['readFileSync'](_0x7a73e9,_0x34fc98(0x13c)),_0x216618=[];if(a133_0x1dfaa6[_0x34fc98(0x184)](_0x55bba2)){const _0x78114d=a133_0x1dfaa6[_0x34fc98(0x1b6)](_0x55bba2);for(const _0x18be3a of _0x78114d){const _0x4bb80d=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x55bba2,_0x18be3a);a133_0x1dfaa6[_0x34fc98(0x194)](_0x4bb80d)[_0x34fc98(0x1aa)]()&&_0x216618['push']({'file_name':_0x18be3a,'text_content':a133_0x1dfaa6[_0x34fc98(0x1b1)](_0x4bb80d,_0x34fc98(0x13c))});}}const _0x1ce34e={..._0x3c776d,'code':_0x339eeb,'files':_0x216618};_0x1c1461['push']({'name':_0x3c776d[_0x34fc98(0x1b8)],'dir':_0x59a8d1,'def':_0x1ce34e});}}const _0x548810=[],_0x5bc59c=getFormInterfacesDir(_0x309e28);if(a133_0x1dfaa6[_0x34fc98(0x184)](_0x5bc59c)){const _0x8e4501=a133_0x1dfaa6[_0x34fc98(0x1b6)](_0x5bc59c)[_0x34fc98(0x104)](_0x469dd1=>_0x469dd1[_0x34fc98(0x1c1)]('.yml'));for(const _0x3ba550 of _0x8e4501){const _0x11ad36=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x5bc59c,_0x3ba550),_0x26701a=parseFormInterfaceYaml(a133_0x1dfaa6['readFileSync'](_0x11ad36,'utf-8'),_0x11ad36);_0x548810[_0x34fc98(0x137)]({'name':_0x26701a[_0x34fc98(0x1b8)],'path':_0x11ad36,'yaml':_0x26701a});}}const _0x5d20cf=[],_0x5f4b79=getChatInterfacesDir(_0x309e28);if(a133_0x1dfaa6[_0x34fc98(0x184)](_0x5f4b79)){const _0x2c292a=a133_0x1dfaa6['readdirSync'](_0x5f4b79)[_0x34fc98(0x104)](_0x356bff=>_0x356bff[_0x34fc98(0x1c1)]('.yml'));for(const _0x43194f of _0x2c292a){const _0x45da93=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x5f4b79,_0x43194f),_0x461304=parseChatInterfaceYaml(a133_0x1dfaa6['readFileSync'](_0x45da93,_0x34fc98(0x13c)),_0x45da93);_0x5d20cf[_0x34fc98(0x137)]({'name':_0x461304['name'],'path':_0x45da93,'yaml':_0x461304});}}const _0x47a4c2=await this['client'][_0x34fc98(0xfa)](_0x3f8b61),_0x4418a5=await this['client']['listKnowledgeBases'](_0x3f8b61),_0x1cba19=await this['client'][_0x34fc98(0xa7)](_0x3f8b61),_0xf191e8=await this[_0x34fc98(0x102)][_0x34fc98(0xe3)](_0x3f8b61),_0x1b9511=await this['client']['listIntegrations'](_0x3f8b61),_0x53817a=await safeListOrEmpty(()=>this[_0x34fc98(0x102)][_0x34fc98(0xc4)](_0x3f8b61)),_0x557d3a=await safeListOrEmpty(()=>this['client'][_0x34fc98(0x120)](_0x3f8b61)),_0xa47adb=await safeListOrEmpty(()=>this[_0x34fc98(0x102)]['listFormInterfaces'](_0x3f8b61)),_0x4be5c7=await safeListOrEmpty(()=>this[_0x34fc98(0x102)][_0x34fc98(0x19f)](_0x3f8b61)),_0x5c5e70=await fetchAllToolTargetMaps((_0x2ef1b6,_0x561b51)=>this['client']['listToolTargets'](_0x2ef1b6,_0x561b51),_0x3f8b61),_0x53864f=new Map(),_0xcfef9b=new Map(),_0x4380c9=new Map(),_0x3c7820=new Map(),_0xc16e20=new Map(),_0x4f0f85=new Map(),_0x398e3f=new Map();for(const _0x37583d of _0x47a4c2){_0x53864f[_0x34fc98(0x187)](_0x37583d[_0x34fc98(0x1c6)]['name'],_0x37583d);}for(const _0x428cc6 of _0x4418a5){_0xcfef9b[_0x34fc98(0x187)](_0x428cc6[_0x34fc98(0x1c6)]['name'],_0x428cc6);}for(const _0x497535 of _0x1cba19){_0x4380c9[_0x34fc98(0x187)](_0x497535[_0x34fc98(0x1c6)]['name'],_0x497535);}for(const _0x183629 of _0xf191e8){_0x3c7820[_0x34fc98(0x187)](_0x183629['attributes'][_0x34fc98(0x1b8)],_0x183629);}for(const _0x415d10 of _0x1b9511){_0xc16e20[_0x34fc98(0x187)](_0x415d10[_0x34fc98(0x1c6)][_0x34fc98(0x1c7)]['toLowerCase'](),_0x415d10);}for(const _0x23da11 of _0x53817a){_0x4f0f85['set'](_0x23da11[_0x34fc98(0x1c6)][_0x34fc98(0x1b8)],_0x23da11);}for(const _0x138de2 of _0x557d3a){_0x398e3f[_0x34fc98(0x187)](_0x138de2[_0x34fc98(0x1c6)][_0x34fc98(0x1b8)],_0x138de2);}const _0x26e872=new Map(),_0x50536d=new Map();for(const _0x25f2e1 of _0xa47adb){_0x26e872[_0x34fc98(0x187)](_0x25f2e1['attributes'][_0x34fc98(0x1b8)],_0x25f2e1);}for(const _0x5da125 of _0x4be5c7){_0x50536d[_0x34fc98(0x187)](_0x5da125[_0x34fc98(0x1c6)][_0x34fc98(0x1b8)],_0x5da125);}const _0x49aee1=new Map(),_0x50e94c=new Map();for(const _0x4b1a79 of _0x47a4c2){_0x49aee1['set'](_0x4b1a79[_0x34fc98(0x1c6)][_0x34fc98(0x1b8)],_0x4b1a79['id']),_0x50e94c['set'](_0x4b1a79['id'],_0x4b1a79[_0x34fc98(0x1c6)][_0x34fc98(0x1b8)]);}const _0x39f8ef=new Map(),_0x46ebc6=new Map();for(const _0x330ca2 of _0xf191e8){_0x39f8ef[_0x34fc98(0x187)](_0x330ca2[_0x34fc98(0x1c6)][_0x34fc98(0x1b8)],_0x330ca2['id']),_0x46ebc6[_0x34fc98(0x187)](_0x330ca2['id'],_0x330ca2[_0x34fc98(0x1c6)][_0x34fc98(0x1b8)]);}const _0x4b0c68=_0x5c5e70[_0x34fc98(0xd1)]['KnowledgeBase']||new Map(),_0x336831=_0x5c5e70[_0x34fc98(0xd1)][_0x34fc98(0x195)]||new Map(),_0x521f47=_0x5c5e70[_0x34fc98(0xd1)]['ExperimentalKnowledgeBase']||new Map(),_0x4f06c5=new Map(),_0x23ea9a={'resolveToolTargetName':buildNameResolver({..._0x5c5e70[_0x34fc98(0x124)],'Agent':_0x50e94c}),'resolvePromptName':async _0x4d3f60=>_0x46ebc6[_0x34fc98(0xca)](_0x4d3f60),'onWarning':_0x32dff9=>this[_0x34fc98(0x14e)][_0x34fc98(0x165)](_0x32dff9)};let _0x5e61b6=[];const _0x155552={'projectId':_0x3f8b61,'resolveToolTargetId':buildIdResolver({..._0x5c5e70['nameToId'],'Agent':_0x49aee1}),'resolvePromptId':async _0x1b4a48=>_0x39f8ef[_0x34fc98(0xca)](_0x1b4a48),'onWarning':_0x5565a2=>{const _0x4cc6cb=_0x34fc98;this[_0x4cc6cb(0x14e)]['warn'](_0x5565a2),_0x5e61b6[_0x4cc6cb(0x137)](_0x5565a2);}},{resolved:_0x55304e,unresolved:_0x241695}=resolveAgentDependencies(_0x416d82,new Set(_0x53864f[_0x34fc98(0xeb)]()));for(const {agent:_0x22c032,missingDeps:_0x3217d8}of _0x241695){_0x3074d7[_0x34fc98(0x158)][_0x34fc98(0x137)]({'agentName':_0x22c032[_0x34fc98(0x154)]['name'],'action':_0x34fc98(0x159),'error':_0x34fc98(0xcf)+_0x3217d8[_0x34fc98(0x1a7)](',\x20')+_0x34fc98(0xab)}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x158)][_0x34fc98(0xf5)]++;}for(const _0x4576e7 of _0x44fab0){const _0xd3c89a=_0xcfef9b[_0x34fc98(0xca)](_0x4576e7[_0x34fc98(0x154)]['name']),_0x659a99=a133_0x1dfaa6[_0x34fc98(0x1b1)](_0x4576e7[_0x34fc98(0x146)],_0x34fc98(0x13c));if(_0xd3c89a){const _0x3dfbb8=apiKnowledgeBaseToYaml(_0xd3c89a),_0x3cce00=toKnowledgeBaseYamlString(_0x3dfbb8),_0x36665a=generateDiff(_0x3cce00,_0x659a99),_0x2265a8=hasChanges(_0x36665a);_0x2265a8?(_0x3074d7[_0x34fc98(0xc5)][_0x34fc98(0x137)]({'name':_0x4576e7[_0x34fc98(0x154)][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b9),'id':_0xd3c89a['id'],'diff':formatDiffWithColors(_0x36665a)}),_0x3074d7[_0x34fc98(0x112)]['knowledgeBases'][_0x34fc98(0x1b9)]++):(_0x3074d7[_0x34fc98(0xc5)][_0x34fc98(0x137)]({'name':_0x4576e7[_0x34fc98(0x154)][_0x34fc98(0x1b8)],'action':'unchanged','id':_0xd3c89a['id']}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0xc5)]['unchanged']++);}else _0x3074d7['knowledgeBases'][_0x34fc98(0x137)]({'name':_0x4576e7[_0x34fc98(0x154)][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b7)}),_0x3074d7['counts'][_0x34fc98(0xc5)][_0x34fc98(0x1b7)]++;}for(const _0x377e59 of _0x54528c){const _0x1153e2=_0x4380c9[_0x34fc98(0xca)](_0x377e59[_0x34fc98(0x1b8)]),_0x28dd27=a133_0x1dfaa6[_0x34fc98(0x1b1)](_0x377e59[_0x34fc98(0x146)],_0x34fc98(0x13c));if(_0x1153e2){const _0x1ef3b3=toTextKnowledgeBaseMd(_0x1153e2[_0x34fc98(0x1c6)][_0x34fc98(0x1b8)],_0x1153e2[_0x34fc98(0x1c6)][_0x34fc98(0x181)]),_0x2e4d9d=generateDiff(_0x1ef3b3,_0x28dd27),_0x543683=hasChanges(_0x2e4d9d);_0x543683?(_0x3074d7[_0x34fc98(0x115)][_0x34fc98(0x137)]({'name':_0x377e59[_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b9),'id':_0x1153e2['id'],'diff':formatDiffWithColors(_0x2e4d9d)}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x115)]['updated']++):(_0x3074d7[_0x34fc98(0x115)][_0x34fc98(0x137)]({'name':_0x377e59['name'],'action':'unchanged','id':_0x1153e2['id']}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x115)]['unchanged']++);}else _0x3074d7[_0x34fc98(0x115)][_0x34fc98(0x137)]({'name':_0x377e59[_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b7)}),_0x3074d7['counts'][_0x34fc98(0x115)][_0x34fc98(0x1b7)]++;}for(const _0x5dec9c of _0x55304e){const _0x518e11=_0x53864f[_0x34fc98(0xca)](_0x5dec9c[_0x34fc98(0x154)][_0x34fc98(0x1b8)]),_0x3772d4=a133_0x10b9e5[_0x34fc98(0x1a7)](_0x5dec9c[_0x34fc98(0x1ac)],_0x34fc98(0xf7)),_0x5e70ce=a133_0x1dfaa6[_0x34fc98(0x1b1)](_0x3772d4,_0x34fc98(0x13c)),_0x553fea=_0x5dec9c['systemPrompt'],_0x2c2d6f=_0x34fc98(0x145)+_0x553fea+'\x0a\x0a#\x20agent.yml\x0a'+_0x5e70ce;if(_0x518e11){const {yaml:_0x56411c,systemPrompt:_0xb7a7e}=await agentResponseToDef(_0x518e11,_0x23ea9a),_0x27b2e8=toAgentYamlString(_0x56411c),_0x15c0be=_0x34fc98(0x145)+_0xb7a7e+_0x34fc98(0x188)+_0x27b2e8,_0x3dc278=generateDiff(_0x15c0be,_0x2c2d6f),_0x579642=hasChanges(_0x3dc278);_0x579642?(_0x3074d7[_0x34fc98(0x158)][_0x34fc98(0x137)]({'agentName':_0x5dec9c[_0x34fc98(0x154)][_0x34fc98(0x1b8)],'action':'updated','agentId':_0x518e11['id'],'diff':formatDiffWithColors(_0x3dc278)}),_0x3074d7['counts'][_0x34fc98(0x158)][_0x34fc98(0x1b9)]++):(_0x3074d7[_0x34fc98(0x158)]['push']({'agentName':_0x5dec9c[_0x34fc98(0x154)]['name'],'action':_0x34fc98(0x12d),'agentId':_0x518e11['id']}),_0x3074d7['counts']['agents'][_0x34fc98(0x12d)]++);}else _0x3074d7[_0x34fc98(0x158)][_0x34fc98(0x137)]({'agentName':_0x5dec9c['yaml'][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b7)}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x158)][_0x34fc98(0x1b7)]++;}for(const _0x589c9b of _0x3ca981){const _0x3e4d9c=_0x3c7820['get'](_0x589c9b['yaml'][_0x34fc98(0x1b8)]),_0x390744=a133_0x1dfaa6[_0x34fc98(0x1b1)](_0x589c9b['path'],_0x34fc98(0x13c));if(_0x3e4d9c){const _0x326661=await apiPromptToYaml(_0x3e4d9c,_0x23ea9a);if(!_0x326661){_0x3074d7['prompts'][_0x34fc98(0x137)]({'name':_0x589c9b[_0x34fc98(0x154)][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b9),'id':_0x3e4d9c['id']}),_0x3074d7[_0x34fc98(0x112)]['prompts'][_0x34fc98(0x1b9)]++;continue;}const _0x1dfab2=toPromptYamlString(_0x326661),_0x2d9aaa=generateDiff(_0x1dfab2,_0x390744),_0x151711=hasChanges(_0x2d9aaa);_0x151711?(_0x3074d7[_0x34fc98(0x11d)]['push']({'name':_0x589c9b['yaml'][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b9),'id':_0x3e4d9c['id'],'diff':formatDiffWithColors(_0x2d9aaa)}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x11d)][_0x34fc98(0x1b9)]++):(_0x3074d7[_0x34fc98(0x11d)][_0x34fc98(0x137)]({'name':_0x589c9b['yaml'][_0x34fc98(0x1b8)],'action':_0x34fc98(0x12d),'id':_0x3e4d9c['id']}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x11d)][_0x34fc98(0x12d)]++);}else _0x3074d7['prompts'][_0x34fc98(0x137)]({'name':_0x589c9b[_0x34fc98(0x154)][_0x34fc98(0x1b8)],'action':'created'}),_0x3074d7['counts'][_0x34fc98(0x11d)][_0x34fc98(0x1b7)]++;}for(const _0x1abd73 of _0x2bac64){const _0x40ea67=_0xc16e20[_0x34fc98(0xca)](_0x1abd73[_0x34fc98(0x154)][_0x34fc98(0x105)]),_0x5298e4=a133_0x1dfaa6[_0x34fc98(0x1b1)](_0x1abd73[_0x34fc98(0x146)],_0x34fc98(0x13c));if(_0x40ea67){const _0x4cb597=await apiIntegrationToYaml(_0x40ea67,_0x23ea9a),_0x28fa34=toIntegrationYamlString(_0x4cb597),_0x21da4f=generateDiff(_0x28fa34,_0x5298e4),_0x3150fc=hasChanges(_0x21da4f);_0x3150fc?(_0x3074d7[_0x34fc98(0x9e)]['push']({'name':_0x1abd73[_0x34fc98(0x154)]['service_type'],'action':_0x34fc98(0x1b9),'id':_0x40ea67['id'],'diff':formatDiffWithColors(_0x21da4f)}),_0x3074d7[_0x34fc98(0x112)]['integrations'][_0x34fc98(0x1b9)]++):(_0x3074d7[_0x34fc98(0x9e)][_0x34fc98(0x137)]({'name':_0x1abd73[_0x34fc98(0x154)]['service_type'],'action':_0x34fc98(0x12d),'id':_0x40ea67['id']}),_0x3074d7['counts'][_0x34fc98(0x9e)]['unchanged']++);}else _0x3074d7[_0x34fc98(0x9e)][_0x34fc98(0x137)]({'name':_0x1abd73[_0x34fc98(0x154)][_0x34fc98(0x105)],'action':'created'}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x9e)][_0x34fc98(0x1b7)]++;}for(const _0x391dd9 of _0x56818b){const _0x1ef262=_0x4f0f85['get'](_0x391dd9[_0x34fc98(0x11f)][_0x34fc98(0x1b8)]),_0x35195d=toExperimentalKnowledgeBaseYamlString(_0x391dd9[_0x34fc98(0x11f)]);let _0x19c02d=_0x35195d;for(const _0xde562b of _0x391dd9[_0x34fc98(0x11f)][_0x34fc98(0x17c)]){_0x19c02d+=_0x34fc98(0x179)+_0xde562b['name']+'\x20---\x0a'+_0xde562b[_0x34fc98(0xb6)]+_0x34fc98(0x10b)+_0xde562b['name']+_0x34fc98(0x174)+_0xde562b[_0x34fc98(0xce)]+'\x0a';}if(_0x1ef262){const _0x421c81=apiExperimentalKnowledgeBaseToYaml(_0x1ef262),_0x3a888d=toExperimentalKnowledgeBaseYamlString(_0x421c81);let _0xf40e8b=_0x3a888d;for(const _0x255d02 of _0x421c81[_0x34fc98(0x17c)]){_0xf40e8b+=_0x34fc98(0x179)+_0x255d02[_0x34fc98(0x1b8)]+'\x20---\x0a'+_0x255d02[_0x34fc98(0xb6)]+_0x34fc98(0x10b)+_0x255d02[_0x34fc98(0x1b8)]+_0x34fc98(0x174)+_0x255d02['json_schema']+'\x0a';}const _0x3b2e53=generateDiff(_0xf40e8b,_0x19c02d),_0xab1ac=hasChanges(_0x3b2e53);_0xab1ac?(_0x3074d7[_0x34fc98(0x197)]['push']({'name':_0x391dd9['def'][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b9),'id':_0x1ef262['id'],'diff':formatDiffWithColors(_0x3b2e53)}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x197)]['updated']++):(_0x3074d7[_0x34fc98(0x197)][_0x34fc98(0x137)]({'name':_0x391dd9[_0x34fc98(0x11f)][_0x34fc98(0x1b8)],'action':'unchanged','id':_0x1ef262['id']}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x197)][_0x34fc98(0x12d)]++);}else _0x3074d7[_0x34fc98(0x197)][_0x34fc98(0x137)]({'name':_0x391dd9[_0x34fc98(0x11f)]['name'],'action':_0x34fc98(0x1b7)}),_0x3074d7['counts'][_0x34fc98(0x197)][_0x34fc98(0x1b7)]++;}for(const _0x2d42ed of _0x1c1461){const _0x8af82c=_0x398e3f[_0x34fc98(0xca)](_0x2d42ed['def'][_0x34fc98(0x1b8)]),_0x24c556=toExperimentalArtifactYamlString(_0x2d42ed[_0x34fc98(0x11f)]);let _0x11bad4=_0x24c556+(_0x34fc98(0x14f)+_0x2d42ed['def']['code']+'\x0a');for(const _0x325e34 of _0x2d42ed[_0x34fc98(0x11f)]['files']){_0x11bad4+=_0x34fc98(0x198)+_0x325e34['file_name']+_0x34fc98(0x174)+_0x325e34['text_content']+'\x0a';}if(_0x8af82c){const _0x5617c4=apiExperimentalArtifactToYaml(_0x8af82c),_0x4a8d51=toExperimentalArtifactYamlString(_0x5617c4);let _0x54ed6e=_0x4a8d51+(_0x34fc98(0x14f)+_0x5617c4[_0x34fc98(0xb6)]+'\x0a');for(const _0x41b1ce of _0x5617c4[_0x34fc98(0xac)]){_0x54ed6e+=_0x34fc98(0x198)+_0x41b1ce[_0x34fc98(0xb1)]+_0x34fc98(0x174)+_0x41b1ce[_0x34fc98(0x1c9)]+'\x0a';}const _0x454658=generateDiff(_0x54ed6e,_0x11bad4),_0x3f72fc=hasChanges(_0x454658);_0x3f72fc?(_0x3074d7[_0x34fc98(0x17a)]['push']({'name':_0x2d42ed[_0x34fc98(0x11f)]['name'],'action':'updated','id':_0x8af82c['id'],'diff':formatDiffWithColors(_0x454658)}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x17a)][_0x34fc98(0x1b9)]++):(_0x3074d7[_0x34fc98(0x17a)][_0x34fc98(0x137)]({'name':_0x2d42ed[_0x34fc98(0x11f)][_0x34fc98(0x1b8)],'action':_0x34fc98(0x12d),'id':_0x8af82c['id']}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x17a)][_0x34fc98(0x12d)]++);}else _0x3074d7[_0x34fc98(0x17a)][_0x34fc98(0x137)]({'name':_0x2d42ed[_0x34fc98(0x11f)]['name'],'action':_0x34fc98(0x1b7)}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x17a)][_0x34fc98(0x1b7)]++;}for(const _0x2d9964 of _0x548810){const _0x42603e=_0x26e872['get'](_0x2d9964[_0x34fc98(0x154)]['name']),_0x46737d=a133_0x1dfaa6[_0x34fc98(0x1b1)](_0x2d9964['path'],_0x34fc98(0x13c));if(_0x42603e){const _0x290d59=await apiFormInterfaceToYaml(_0x42603e,_0x23ea9a),_0x43497c=toFormInterfaceYamlString(_0x290d59),_0x4da8a1=generateDiff(_0x43497c,_0x46737d),_0xde11eb=hasChanges(_0x4da8a1);_0xde11eb?(_0x3074d7[_0x34fc98(0x13a)]['push']({'name':_0x2d9964[_0x34fc98(0x154)]['name'],'action':_0x34fc98(0x1b9),'id':_0x42603e['id'],'diff':formatDiffWithColors(_0x4da8a1)}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x13a)]['updated']++):(_0x3074d7[_0x34fc98(0x13a)][_0x34fc98(0x137)]({'name':_0x2d9964[_0x34fc98(0x154)][_0x34fc98(0x1b8)],'action':'unchanged','id':_0x42603e['id']}),_0x3074d7['counts'][_0x34fc98(0x13a)]['unchanged']++);}else _0x3074d7[_0x34fc98(0x13a)][_0x34fc98(0x137)]({'name':_0x2d9964['yaml'][_0x34fc98(0x1b8)],'action':'created'}),_0x3074d7['counts'][_0x34fc98(0x13a)][_0x34fc98(0x1b7)]++;}for(const _0x3e4b02 of _0x5d20cf){const _0x5113a4=_0x50536d[_0x34fc98(0xca)](_0x3e4b02[_0x34fc98(0x154)][_0x34fc98(0x1b8)]),_0x7dbf5a=a133_0x1dfaa6[_0x34fc98(0x1b1)](_0x3e4b02[_0x34fc98(0x146)],_0x34fc98(0x13c));if(_0x5113a4){const _0x53ab63=await apiChatInterfaceToYaml(_0x5113a4,_0x23ea9a),_0xf24b9b=toChatInterfaceYamlString(_0x53ab63),_0x2a03ca=generateDiff(_0xf24b9b,_0x7dbf5a),_0x3ed0bb=hasChanges(_0x2a03ca);_0x3ed0bb?(_0x3074d7[_0x34fc98(0x14d)]['push']({'name':_0x3e4b02['yaml'][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b9),'id':_0x5113a4['id'],'diff':formatDiffWithColors(_0x2a03ca)}),_0x3074d7[_0x34fc98(0x112)]['chatInterfaces'][_0x34fc98(0x1b9)]++):(_0x3074d7['chatInterfaces'][_0x34fc98(0x137)]({'name':_0x3e4b02[_0x34fc98(0x154)][_0x34fc98(0x1b8)],'action':_0x34fc98(0x12d),'id':_0x5113a4['id']}),_0x3074d7['counts'][_0x34fc98(0x14d)]['unchanged']++);}else _0x3074d7[_0x34fc98(0x14d)][_0x34fc98(0x137)]({'name':_0x3e4b02[_0x34fc98(0x154)][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b7)}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x14d)][_0x34fc98(0x1b7)]++;}if(_0x18675d?.[_0x34fc98(0xcc)])return _0x3074d7;_0x3074d7[_0x34fc98(0xc5)]=[],_0x3074d7[_0x34fc98(0x115)]=[],_0x3074d7[_0x34fc98(0x11d)]=[],_0x3074d7[_0x34fc98(0x9e)]=[],_0x3074d7[_0x34fc98(0x197)]=[],_0x3074d7[_0x34fc98(0x17a)]=[],_0x3074d7[_0x34fc98(0x13a)]=[],_0x3074d7[_0x34fc98(0x14d)]=[];const _0x3750a6=_0x3074d7['agents'][_0x34fc98(0x104)](_0x1ea2fc=>_0x1ea2fc[_0x34fc98(0x18f)]===_0x34fc98(0x159));_0x3074d7[_0x34fc98(0x158)]=_0x3750a6,_0x3074d7['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x3750a6[_0x34fc98(0x1c5)]},'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 _0x52b2da of _0x44fab0){try{const _0x538c06=_0xcfef9b[_0x34fc98(0xca)](_0x52b2da[_0x34fc98(0x154)][_0x34fc98(0x1b8)]),_0x1a68b0=yamlKnowledgeBaseToApi(_0x52b2da[_0x34fc98(0x154)],_0x3f8b61);if(_0x538c06)await this[_0x34fc98(0x102)]['updateKnowledgeBase'](_0x538c06['id'],_0x1a68b0),_0x4b0c68[_0x34fc98(0x187)](_0x52b2da['yaml'][_0x34fc98(0x1b8)],_0x538c06['id']),_0x3074d7['knowledgeBases'][_0x34fc98(0x137)]({'name':_0x52b2da[_0x34fc98(0x154)]['name'],'action':_0x34fc98(0x1b9),'id':_0x538c06['id']}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0xc5)]['updated']++;else{const _0x29d388=await this['client'][_0x34fc98(0xf2)](_0x1a68b0);_0x4b0c68[_0x34fc98(0x187)](_0x52b2da[_0x34fc98(0x154)][_0x34fc98(0x1b8)],_0x29d388['id']),_0x3074d7[_0x34fc98(0xc5)][_0x34fc98(0x137)]({'name':_0x52b2da[_0x34fc98(0x154)]['name'],'action':'created','id':_0x29d388['id']}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0xc5)]['created']++;}}catch(_0x5d3c14){_0x3074d7[_0x34fc98(0xc5)]['push']({'name':_0x52b2da[_0x34fc98(0x154)][_0x34fc98(0x1b8)],'action':_0x34fc98(0x159),'error':_0x5d3c14[_0x34fc98(0x116)]}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0xc5)][_0x34fc98(0xf5)]++;}}for(const _0x1d2c38 of _0x54528c){try{const _0x1e764b=_0x4380c9[_0x34fc98(0xca)](_0x1d2c38[_0x34fc98(0x1b8)]),_0x316d02=yamlTextKnowledgeBaseToApi({'name':_0x1d2c38['name'],'text':_0x1d2c38[_0x34fc98(0x181)]},_0x3f8b61);if(_0x1e764b)await this['client']['updateTextKnowledgeBase'](_0x1e764b['id'],_0x316d02),_0x336831[_0x34fc98(0x187)](_0x1d2c38['name'],_0x1e764b['id']),_0x3074d7[_0x34fc98(0x115)][_0x34fc98(0x137)]({'name':_0x1d2c38['name'],'action':_0x34fc98(0x1b9),'id':_0x1e764b['id']}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x115)]['updated']++;else{const _0xf98ecf=await this[_0x34fc98(0x102)][_0x34fc98(0x160)](_0x316d02);_0x336831['set'](_0x1d2c38[_0x34fc98(0x1b8)],_0xf98ecf['id']),_0x3074d7[_0x34fc98(0x115)]['push']({'name':_0x1d2c38[_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b7),'id':_0xf98ecf['id']}),_0x3074d7[_0x34fc98(0x112)]['textKnowledgeBases'][_0x34fc98(0x1b7)]++;}}catch(_0x5eef27){_0x3074d7['textKnowledgeBases'][_0x34fc98(0x137)]({'name':_0x1d2c38[_0x34fc98(0x1b8)],'action':_0x34fc98(0x159),'error':_0x5eef27['message']}),_0x3074d7['counts'][_0x34fc98(0x115)][_0x34fc98(0xf5)]++;}}for(const _0x2648b5 of _0x56818b){try{const _0x7124d0=_0x4f0f85[_0x34fc98(0xca)](_0x2648b5[_0x34fc98(0x11f)][_0x34fc98(0x1b8)]),_0x4f9909=yamlExperimentalKnowledgeBaseToApi(_0x2648b5['def'],_0x3f8b61);if(_0x7124d0)await this[_0x34fc98(0x102)][_0x34fc98(0xba)](_0x7124d0['id'],_0x4f9909),_0x521f47[_0x34fc98(0x187)](_0x2648b5[_0x34fc98(0x11f)][_0x34fc98(0x1b8)],_0x7124d0['id']),_0x3074d7[_0x34fc98(0x197)][_0x34fc98(0x137)]({'name':_0x2648b5[_0x34fc98(0x11f)][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b9),'id':_0x7124d0['id']}),_0x3074d7[_0x34fc98(0x112)]['experimentalKnowledgeBases']['updated']++;else{const _0x3bce4d=await this[_0x34fc98(0x102)][_0x34fc98(0x1a8)](_0x4f9909);_0x521f47[_0x34fc98(0x187)](_0x2648b5[_0x34fc98(0x11f)][_0x34fc98(0x1b8)],_0x3bce4d['id']),_0x3074d7[_0x34fc98(0x197)][_0x34fc98(0x137)]({'name':_0x2648b5[_0x34fc98(0x11f)][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b7),'id':_0x3bce4d['id']}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x197)][_0x34fc98(0x1b7)]++;}}catch(_0x38fad5){_0x3074d7['experimentalKnowledgeBases']['push']({'name':_0x2648b5[_0x34fc98(0x11f)]['name'],'action':_0x34fc98(0x159),'error':_0x38fad5[_0x34fc98(0x116)]}),_0x3074d7['counts']['experimentalKnowledgeBases'][_0x34fc98(0xf5)]++;}}for(const _0x42d1ce of _0x1c1461){try{const _0x39affb=_0x398e3f[_0x34fc98(0xca)](_0x42d1ce[_0x34fc98(0x11f)][_0x34fc98(0x1b8)]),_0x19ec2a=yamlExperimentalArtifactToApi(_0x42d1ce['def'],_0x3f8b61);if(_0x39affb)await this[_0x34fc98(0x102)][_0x34fc98(0xe7)](_0x39affb['id'],_0x19ec2a),_0x4f06c5[_0x34fc98(0x187)](_0x42d1ce[_0x34fc98(0x11f)][_0x34fc98(0x1b8)],_0x39affb['id']),_0x3074d7['experimentalArtifacts'][_0x34fc98(0x137)]({'name':_0x42d1ce['def'][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b9),'id':_0x39affb['id']}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x17a)][_0x34fc98(0x1b9)]++;else{const _0x389256=await this[_0x34fc98(0x102)][_0x34fc98(0x157)](_0x19ec2a);_0x4f06c5[_0x34fc98(0x187)](_0x42d1ce[_0x34fc98(0x11f)]['name'],_0x389256['id']),_0x3074d7['experimentalArtifacts'][_0x34fc98(0x137)]({'name':_0x42d1ce[_0x34fc98(0x11f)][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b7),'id':_0x389256['id']}),_0x3074d7[_0x34fc98(0x112)]['experimentalArtifacts'][_0x34fc98(0x1b7)]++;}}catch(_0x5defc5){_0x3074d7[_0x34fc98(0x17a)]['push']({'name':_0x42d1ce['def'][_0x34fc98(0x1b8)],'action':'error','error':_0x5defc5[_0x34fc98(0x116)]}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x17a)][_0x34fc98(0xf5)]++;}}for(const _0x598647 of _0x55304e){_0x5e61b6=[];try{const _0x92b9c2=_0x53864f['get'](_0x598647['yaml'][_0x34fc98(0x1b8)]),_0x426d3f=await agentDefToRequest(_0x598647['yaml'],_0x598647[_0x34fc98(0x11e)],_0x598647[_0x34fc98(0x1a1)],_0x155552);if(_0x92b9c2)await this['client'][_0x34fc98(0xf9)](_0x92b9c2['id'],_0x426d3f),_0x49aee1[_0x34fc98(0x187)](_0x598647[_0x34fc98(0x154)][_0x34fc98(0x1b8)],_0x92b9c2['id']),_0x3074d7[_0x34fc98(0x158)][_0x34fc98(0x137)]({'agentName':_0x598647['yaml'][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b9),'agentId':_0x92b9c2['id'],'warnings':_0x5e61b6[_0x34fc98(0x1c5)]>0x0?_0x5e61b6:undefined}),_0x3074d7[_0x34fc98(0x112)]['agents']['updated']++;else{const _0x5e6995=await this[_0x34fc98(0x102)]['createAgentResponse'](_0x426d3f);_0x49aee1[_0x34fc98(0x187)](_0x598647[_0x34fc98(0x154)][_0x34fc98(0x1b8)],_0x5e6995['id']),_0x3074d7[_0x34fc98(0x158)]['push']({'agentName':_0x598647[_0x34fc98(0x154)][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b7),'agentId':_0x5e6995['id'],'warnings':_0x5e61b6[_0x34fc98(0x1c5)]>0x0?_0x5e61b6:undefined}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x158)][_0x34fc98(0x1b7)]++;}}catch(_0x2e1cf2){_0x3074d7[_0x34fc98(0x158)][_0x34fc98(0x137)]({'agentName':_0x598647[_0x34fc98(0x154)][_0x34fc98(0x1b8)],'action':_0x34fc98(0x159),'error':_0x2e1cf2[_0x34fc98(0x116)],'warnings':_0x5e61b6[_0x34fc98(0x1c5)]>0x0?_0x5e61b6:undefined}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x158)][_0x34fc98(0xf5)]++;}}for(const _0x23b295 of _0x3ca981){try{const _0xf044aa=_0x3c7820['get'](_0x23b295[_0x34fc98(0x154)]['name']),_0x2a2782=await yamlPromptToApi(_0x23b295[_0x34fc98(0x154)],_0x3f8b61,_0x155552);if(!_0x2a2782){_0x3074d7[_0x34fc98(0x11d)]['push']({'name':_0x23b295[_0x34fc98(0x154)][_0x34fc98(0x1b8)],'action':_0x34fc98(0x159),'error':'Agent\x20reference\x20not\x20found'}),_0x3074d7[_0x34fc98(0x112)]['prompts'][_0x34fc98(0xf5)]++;continue;}if(_0xf044aa)await this['client'][_0x34fc98(0x19b)](_0xf044aa['id'],_0x2a2782),_0x39f8ef[_0x34fc98(0x187)](_0x23b295['yaml']['name'],_0xf044aa['id']),_0x3074d7[_0x34fc98(0x11d)]['push']({'name':_0x23b295['yaml'][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b9),'id':_0xf044aa['id']}),_0x3074d7['counts'][_0x34fc98(0x11d)][_0x34fc98(0x1b9)]++;else{const _0x376b69=await this[_0x34fc98(0x102)][_0x34fc98(0x107)](_0x2a2782);_0x39f8ef[_0x34fc98(0x187)](_0x23b295[_0x34fc98(0x154)][_0x34fc98(0x1b8)],_0x376b69['id']),_0x3074d7[_0x34fc98(0x11d)][_0x34fc98(0x137)]({'name':_0x23b295[_0x34fc98(0x154)][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b7),'id':_0x376b69['id']}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x11d)][_0x34fc98(0x1b7)]++;}}catch(_0x531f0f){_0x3074d7[_0x34fc98(0x11d)][_0x34fc98(0x137)]({'name':_0x23b295['yaml'][_0x34fc98(0x1b8)],'action':'error','error':_0x531f0f[_0x34fc98(0x116)]}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x11d)][_0x34fc98(0xf5)]++;}}for(const _0x1efd16 of _0x2bac64){try{const _0x3f6fa1=_0xc16e20['get'](_0x1efd16['yaml'][_0x34fc98(0x105)]),_0x11ab31=await yamlIntegrationToApi(_0x1efd16[_0x34fc98(0x154)],_0x3f8b61,_0x155552);if(_0x3f6fa1){await this['client'][_0x34fc98(0x14a)](_0x3f6fa1['id']);const _0x5cf1a0=await this[_0x34fc98(0x102)][_0x34fc98(0xe6)](_0x11ab31);_0x3074d7[_0x34fc98(0x9e)][_0x34fc98(0x137)]({'name':_0x1efd16[_0x34fc98(0x154)]['service_type'],'action':_0x34fc98(0x1b9),'id':_0x5cf1a0['id']}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x9e)][_0x34fc98(0x1b9)]++;}else{const _0x24d23e=await this[_0x34fc98(0x102)][_0x34fc98(0xe6)](_0x11ab31);_0x3074d7[_0x34fc98(0x9e)][_0x34fc98(0x137)]({'name':_0x1efd16['yaml'][_0x34fc98(0x105)],'action':_0x34fc98(0x1b7),'id':_0x24d23e['id']}),_0x3074d7[_0x34fc98(0x112)]['integrations']['created']++;}}catch(_0x35f785){_0x3074d7[_0x34fc98(0x9e)][_0x34fc98(0x137)]({'name':_0x1efd16[_0x34fc98(0x154)]['service_type'],'action':_0x34fc98(0x159),'error':_0x35f785[_0x34fc98(0x116)]}),_0x3074d7['counts']['integrations'][_0x34fc98(0xf5)]++;}}for(const _0x2d4b4b of _0x548810){try{const _0x38343c=_0x26e872[_0x34fc98(0xca)](_0x2d4b4b[_0x34fc98(0x154)][_0x34fc98(0x1b8)]),_0x1f5167=await yamlFormInterfaceToApi(_0x2d4b4b[_0x34fc98(0x154)],_0x3f8b61,_0x155552);if(!_0x1f5167){_0x3074d7[_0x34fc98(0x13a)]['push']({'name':_0x2d4b4b['yaml']['name'],'action':_0x34fc98(0x159),'error':_0x34fc98(0x127)}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x13a)][_0x34fc98(0xf5)]++;continue;}if(_0x38343c){const _0x533a8d=await this[_0x34fc98(0x102)][_0x34fc98(0x130)](_0x38343c['id'],_0x1f5167);_0x3074d7[_0x34fc98(0x13a)][_0x34fc98(0x137)]({'name':_0x2d4b4b[_0x34fc98(0x154)][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b9),'id':_0x533a8d['id']}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x13a)][_0x34fc98(0x1b9)]++;}else{const _0x3b2791=await this[_0x34fc98(0x102)][_0x34fc98(0x189)](_0x1f5167);_0x3074d7['formInterfaces']['push']({'name':_0x2d4b4b['yaml'][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b7),'id':_0x3b2791['id']}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x13a)]['created']++;}}catch(_0x313730){_0x3074d7[_0x34fc98(0x13a)][_0x34fc98(0x137)]({'name':_0x2d4b4b[_0x34fc98(0x154)][_0x34fc98(0x1b8)],'action':_0x34fc98(0x159),'error':_0x313730[_0x34fc98(0x116)]}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x13a)][_0x34fc98(0xf5)]++;}}for(const _0x348e69 of _0x5d20cf){try{const _0x24422b=_0x50536d[_0x34fc98(0xca)](_0x348e69['yaml'][_0x34fc98(0x1b8)]),_0x1dfcb6=await yamlChatInterfaceToApi(_0x348e69[_0x34fc98(0x154)],_0x3f8b61,_0x155552);if(_0x24422b){const _0x3880fa=await this[_0x34fc98(0x102)][_0x34fc98(0x1c4)](_0x24422b['id'],_0x1dfcb6);_0x3074d7[_0x34fc98(0x14d)][_0x34fc98(0x137)]({'name':_0x348e69['yaml']['name'],'action':_0x34fc98(0x1b9),'id':_0x3880fa['id']}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x14d)][_0x34fc98(0x1b9)]++;}else{const _0x52f222=await this[_0x34fc98(0x102)]['createChatInterface'](_0x1dfcb6);_0x3074d7[_0x34fc98(0x14d)]['push']({'name':_0x348e69[_0x34fc98(0x154)][_0x34fc98(0x1b8)],'action':_0x34fc98(0x1b7),'id':_0x52f222['id']}),_0x3074d7[_0x34fc98(0x112)]['chatInterfaces']['created']++;}}catch(_0x222c57){_0x3074d7[_0x34fc98(0x14d)]['push']({'name':_0x348e69['yaml'][_0x34fc98(0x1b8)],'action':_0x34fc98(0x159),'error':_0x222c57['message']}),_0x3074d7[_0x34fc98(0x112)][_0x34fc98(0x14d)][_0x34fc98(0xf5)]++;}}return _0x3074d7;}async[a133_0x32634e(0x1c0)](_0x24e0c3,_0x4ebe49,_0x1362bc,_0x5a8f1b){const _0x13f8a5=a133_0x32634e,{projectId:_0x10b654,project:_0x114cd6}=await this[_0x13f8a5(0xc6)](_0x24e0c3),_0x35b6cb=_0x114cd6['attributes']['name'],_0x57da3e=await this[_0x13f8a5(0x102)][_0x13f8a5(0xfa)](_0x10b654),_0x726f0a=_0x57da3e[_0x13f8a5(0x16e)](_0x4e2d80=>_0x4e2d80[_0x13f8a5(0x1c6)]['name']===_0x4ebe49);if(!_0x726f0a)throw new SDKError(ErrorCode[_0x13f8a5(0x1ad)],_0x13f8a5(0xb0)+_0x4ebe49,undefined,{'helpText':_0x13f8a5(0xaa)+_0x57da3e[_0x13f8a5(0xbe)](_0x48ace9=>_0x48ace9['attributes'][_0x13f8a5(0x1b8)])[_0x13f8a5(0x1a7)](',\x20')});let _0x4dd6d2;if(_0x1362bc)_0x4dd6d2=_0x1362bc;else{const _0x39d72b=a133_0x10b9e5['join'](process[_0x13f8a5(0xb9)](),_0x13f8a5(0x158)),_0x293eb7=getSanitizedPathWithMigration(_0x39d72b,_0x35b6cb);_0x293eb7[_0x13f8a5(0x16b)]&&this[_0x13f8a5(0x14e)]['info'](_0x13f8a5(0x1bc)+a133_0x10b9e5[_0x13f8a5(0xbd)](_0x293eb7[_0x13f8a5(0xfe)])+_0x13f8a5(0x178)+a133_0x10b9e5['basename'](_0x293eb7[_0x13f8a5(0x146)])),_0x4dd6d2=_0x293eb7['path'];}const _0x1ad8b1=getSanitizedPathWithMigration(_0x4dd6d2,_0x4ebe49);_0x1ad8b1[_0x13f8a5(0x16b)]&&this[_0x13f8a5(0x14e)][_0x13f8a5(0x138)](_0x13f8a5(0x162)+a133_0x10b9e5['basename'](_0x1ad8b1[_0x13f8a5(0xfe)])+_0x13f8a5(0x178)+a133_0x10b9e5['basename'](_0x1ad8b1[_0x13f8a5(0x146)]));const _0x135e37=_0x1ad8b1[_0x13f8a5(0x146)],_0x17b8cf=new Map(),_0x2a55e9=new Map(),_0x2bf427=await this[_0x13f8a5(0x102)][_0x13f8a5(0xf4)](_0x10b654),_0x23e43f=await this[_0x13f8a5(0x102)]['listTextKnowledgeBases'](_0x10b654),_0x5060a4=await safeListOrEmpty(()=>this[_0x13f8a5(0x102)][_0x13f8a5(0xc4)](_0x10b654)),_0x445578=new Map(),_0x73123e=new Map();for(const _0x26b2ac of _0x2bf427){_0x17b8cf[_0x13f8a5(0x187)](_0x26b2ac['id'],_0x26b2ac[_0x13f8a5(0x1c6)][_0x13f8a5(0x1b8)]);}for(const _0x589af9 of _0x23e43f){_0x445578[_0x13f8a5(0x187)](_0x589af9['id'],_0x589af9[_0x13f8a5(0x1c6)]['name']);}for(const _0x5f29f8 of _0x5060a4){_0x73123e['set'](_0x5f29f8['id'],_0x5f29f8['attributes'][_0x13f8a5(0x1b8)]);}for(const _0x307b23 of _0x57da3e){_0x2a55e9[_0x13f8a5(0x187)](_0x307b23['id'],_0x307b23['attributes']['name']);}const _0x59f213={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x17b8cf,'TextKnowledgeBase':_0x445578,'Agent':_0x2a55e9,'ExperimentalKnowledgeBase':_0x73123e}),'resolvePromptName':async()=>undefined,'onWarning':_0x294742=>this[_0x13f8a5(0x14e)][_0x13f8a5(0x165)](_0x294742)},_0x508b14=a133_0x10b9e5[_0x13f8a5(0x1a7)](_0x135e37,'prompt.md'),_0x54587c=a133_0x10b9e5['join'](_0x135e37,_0x13f8a5(0xf7)),_0x8cc13e=a133_0x10b9e5[_0x13f8a5(0x1a7)](_0x135e37,_0x13f8a5(0x19e)),_0x43c7c4=!a133_0x1dfaa6[_0x13f8a5(0x184)](_0x54587c);if(_0x5a8f1b?.[_0x13f8a5(0xcc)])return{'agentName':_0x4ebe49,'outputPath':_0x135e37,'isNew':_0x43c7c4,'hasChanges':!![]};a133_0x1dfaa6[_0x13f8a5(0xd2)](_0x4dd6d2,{'recursive':!![]}),a133_0x1dfaa6[_0x13f8a5(0xd2)](_0x135e37,{'recursive':!![]});const _0x246d16=a133_0x10b9e5[_0x13f8a5(0x1a7)](_0x4dd6d2,_0x13f8a5(0x101));!a133_0x1dfaa6['existsSync'](_0x246d16)&&a133_0x1dfaa6[_0x13f8a5(0xd6)](_0x246d16,createAgentConfigContent(_0x24e0c3));const {yaml:_0x1e1469,systemPrompt:_0x24a51f,starterMessage:_0x1795b8}=await agentResponseToDef(_0x726f0a,_0x59f213);let _0x4341f3=_0x43c7c4;if(!_0x43c7c4){const _0x41e76d=a133_0x1dfaa6[_0x13f8a5(0x184)](_0x508b14)?a133_0x1dfaa6[_0x13f8a5(0x1b1)](_0x508b14,_0x13f8a5(0x13c)):'',_0x1bb09b=a133_0x1dfaa6[_0x13f8a5(0x1b1)](_0x54587c,_0x13f8a5(0x13c));_0x4341f3=_0x41e76d!==_0x24a51f||_0x1bb09b!==toAgentYamlString(_0x1e1469);}a133_0x1dfaa6[_0x13f8a5(0xd6)](_0x508b14,_0x24a51f),a133_0x1dfaa6[_0x13f8a5(0xd6)](_0x54587c,toAgentYamlString(_0x1e1469));if(_0x1795b8&&_0x1795b8[_0x13f8a5(0x11a)]('\x0a'))a133_0x1dfaa6['writeFileSync'](_0x8cc13e,_0x1795b8);else a133_0x1dfaa6['existsSync'](_0x8cc13e)&&a133_0x1dfaa6[_0x13f8a5(0x1b4)](_0x8cc13e);return{'agentName':_0x4ebe49,'outputPath':_0x135e37,'isNew':_0x43c7c4,'hasChanges':_0x4341f3};}async['pushAgent'](_0x557efe,_0x2bec43){const _0x560703=a133_0x32634e;let _0x51ad1a;isAgentYamlPath(_0x557efe)?_0x51ad1a=getAgentDirFromYamlPath(_0x557efe):_0x51ad1a=_0x557efe;const {config:_0x5dca10}=findAgentConfig(_0x51ad1a),_0x507868=await this[_0x560703(0x186)](_0x5dca10[_0x560703(0xcb)]),_0x3a024d=a133_0x10b9e5['join'](_0x51ad1a,_0x560703(0xf7)),_0x5810e8=a133_0x10b9e5['join'](_0x51ad1a,'prompt.md'),_0x23c03c=a133_0x10b9e5[_0x560703(0x1a7)](_0x51ad1a,'starter_message.md');if(!a133_0x1dfaa6['existsSync'](_0x3a024d))throw new SDKError(ErrorCode[_0x560703(0x1ab)],_0x560703(0xa5)+_0x51ad1a,undefined,{'helpText':_0x560703(0xff)});const _0x7643d7=parseAgentYaml(a133_0x1dfaa6[_0x560703(0x1b1)](_0x3a024d,_0x560703(0x13c)),_0x3a024d),_0x3c8a6c=a133_0x1dfaa6['existsSync'](_0x5810e8)?a133_0x1dfaa6[_0x560703(0x1b1)](_0x5810e8,'utf-8'):'',_0xd84bb7=a133_0x1dfaa6[_0x560703(0x184)](_0x23c03c)?a133_0x1dfaa6[_0x560703(0x1b1)](_0x23c03c,_0x560703(0x13c)):_0x7643d7['starter_message'];if(_0x2bec43?.[_0x560703(0xcc)])return{'agentName':_0x7643d7[_0x560703(0x1b8)],'action':_0x560703(0x1b7),'projectId':_0x507868};const _0x24e670=await this[_0x560703(0x102)][_0x560703(0xfa)](_0x507868),_0x360a1e=await fetchAllToolTargetMaps((_0x16aba5,_0xef8202)=>this[_0x560703(0x102)][_0x560703(0xde)](_0x16aba5,_0xef8202),_0x507868),_0x6bab65=new Map();for(const _0x1b99cd of _0x24e670){_0x6bab65[_0x560703(0x187)](_0x1b99cd[_0x560703(0x1c6)]['name'],_0x1b99cd['id']);}const _0x587735=[],_0x261906={'projectId':_0x507868,'resolveToolTargetId':buildIdResolver({..._0x360a1e[_0x560703(0xd1)],'Agent':_0x6bab65}),'resolvePromptId':async()=>undefined,'onWarning':_0x365327=>{const _0x8327c5=_0x560703;this[_0x8327c5(0x14e)]['warn'](_0x365327),_0x587735[_0x8327c5(0x137)](_0x365327);}};try{const _0x56516f=_0x24e670['find'](_0x307a3d=>_0x307a3d['attributes']['name']===_0x7643d7[_0x560703(0x1b8)]),_0x1f4fa7=await agentDefToRequest(_0x7643d7,_0x3c8a6c,_0xd84bb7,_0x261906);if(_0x56516f)return await this['client'][_0x560703(0xf9)](_0x56516f['id'],_0x1f4fa7),{'agentName':_0x7643d7[_0x560703(0x1b8)],'action':_0x560703(0x1b9),'projectId':_0x507868,'agentId':_0x56516f['id'],'warnings':_0x587735[_0x560703(0x1c5)]>0x0?_0x587735:undefined};else{const _0x2a6138=await this[_0x560703(0x102)][_0x560703(0xad)](_0x1f4fa7);return{'agentName':_0x7643d7[_0x560703(0x1b8)],'action':'created','projectId':_0x507868,'agentId':_0x2a6138['id'],'warnings':_0x587735['length']>0x0?_0x587735:undefined};}}catch(_0x1e42f2){return{'agentName':_0x7643d7['name'],'action':'error','projectId':_0x507868,'error':_0x1e42f2[_0x560703(0x116)],'warnings':_0x587735['length']>0x0?_0x587735:undefined};}}async['cloneProject'](_0x5376d7,_0x191874,_0x44a6ba){const _0x22558a=a133_0x32634e,_0x48600e=a133_0x1dfaa6[_0x22558a(0x184)](_0x5376d7)&&a133_0x1dfaa6[_0x22558a(0x184)](a133_0x10b9e5['join'](_0x5376d7,_0x22558a(0x101)));let _0x32897c;const _0x242b90=[],_0x52139d=[],_0x2ac4f7=[],_0x20c176=[],_0x2d664d=[],_0x5ce173=[],_0x37f573=[],_0x4805ac=[],_0x49273a=[];if(_0x48600e){const _0x2ab27d=loadAgentConfig(a133_0x10b9e5['join'](_0x5376d7,_0x22558a(0x101)));_0x32897c=_0x2ab27d['llm_project'];const _0x3387a3=a133_0x1dfaa6[_0x22558a(0x1b6)](_0x5376d7,{'withFileTypes':!![]});for(const _0x357574 of _0x3387a3){if(!_0x357574[_0x22558a(0x135)]())continue;if([_0x22558a(0x132),'experimental_knowledge_bases','experimental_artifacts',_0x22558a(0x11d),_0x22558a(0x9e),'form_interfaces',_0x22558a(0x133)][_0x22558a(0x11a)](_0x357574[_0x22558a(0x1b8)]))continue;const _0xeb86a4=a133_0x10b9e5['join'](_0x5376d7,_0x357574[_0x22558a(0x1b8)]);if(isAgentDir(_0xeb86a4)){const _0x52208e=a133_0x10b9e5[_0x22558a(0x1a7)](_0xeb86a4,'agent.yml'),_0xe9584c=a133_0x10b9e5[_0x22558a(0x1a7)](_0xeb86a4,'prompt.md'),_0x46435e=a133_0x10b9e5[_0x22558a(0x1a7)](_0xeb86a4,_0x22558a(0x19e)),_0x5b43b9=parseAgentYaml(a133_0x1dfaa6[_0x22558a(0x1b1)](_0x52208e,_0x22558a(0x13c)),_0x52208e),_0x35df9c=a133_0x1dfaa6[_0x22558a(0x184)](_0xe9584c)?a133_0x1dfaa6[_0x22558a(0x1b1)](_0xe9584c,'utf-8'):'',_0x1b4650=a133_0x1dfaa6[_0x22558a(0x184)](_0x46435e)?a133_0x1dfaa6[_0x22558a(0x1b1)](_0x46435e,_0x22558a(0x13c)):_0x5b43b9[_0x22558a(0xd7)];_0x242b90[_0x22558a(0x137)]({'name':_0x5b43b9[_0x22558a(0x1b8)],'dir':_0xeb86a4,'yaml':_0x5b43b9,'systemPrompt':_0x35df9c,'starterMessage':_0x1b4650});}}const _0x10077d=getKnowledgeBasesDir(_0x5376d7);if(a133_0x1dfaa6[_0x22558a(0x184)](_0x10077d)){const _0x5472d0=a133_0x1dfaa6[_0x22558a(0x1b6)](_0x10077d);for(const _0x49d3d3 of _0x5472d0){const _0x19c55a=a133_0x10b9e5['join'](_0x10077d,_0x49d3d3);if(_0x49d3d3[_0x22558a(0x1c1)]('.yml')){const _0x50346f=parseKnowledgeBaseYaml(a133_0x1dfaa6[_0x22558a(0x1b1)](_0x19c55a,'utf-8'),_0x19c55a);_0x52139d[_0x22558a(0x137)]({'name':_0x50346f[_0x22558a(0x1b8)],'path':_0x19c55a,'yaml':_0x50346f});}else{if(_0x49d3d3[_0x22558a(0x1c1)](_0x22558a(0xf8))){const _0x3949bc=a133_0x1dfaa6[_0x22558a(0x1b1)](_0x19c55a,_0x22558a(0x13c)),{name:_0x109a50,text:_0x11aa45}=parseTextKnowledgeBaseMd(_0x3949bc,_0x49d3d3);_0x2ac4f7[_0x22558a(0x137)]({'name':_0x109a50,'path':_0x19c55a,'text':_0x11aa45});}}}}const _0x56d0eb=getPromptsDir(_0x5376d7);if(a133_0x1dfaa6[_0x22558a(0x184)](_0x56d0eb)){const _0x20dca1=a133_0x1dfaa6[_0x22558a(0x1b6)](_0x56d0eb)[_0x22558a(0x104)](_0x26693c=>_0x26693c[_0x22558a(0x1c1)](_0x22558a(0xbb)));for(const _0x1ab0db of _0x20dca1){const _0x4c1787=a133_0x10b9e5[_0x22558a(0x1a7)](_0x56d0eb,_0x1ab0db),_0x51076a=parsePromptYaml(a133_0x1dfaa6[_0x22558a(0x1b1)](_0x4c1787,'utf-8'),_0x4c1787);_0x20c176[_0x22558a(0x137)]({'name':_0x51076a[_0x22558a(0x1b8)],'path':_0x4c1787,'yaml':_0x51076a});}}const _0x4cd70f=getIntegrationsDir(_0x5376d7);if(a133_0x1dfaa6[_0x22558a(0x184)](_0x4cd70f)){const _0x39e46f=a133_0x1dfaa6[_0x22558a(0x1b6)](_0x4cd70f)[_0x22558a(0x104)](_0x482015=>_0x482015[_0x22558a(0x1c1)](_0x22558a(0xbb)));for(const _0x448625 of _0x39e46f){const _0x2799a0=a133_0x10b9e5[_0x22558a(0x1a7)](_0x4cd70f,_0x448625),_0xbac9dc=parseIntegrationYaml(a133_0x1dfaa6[_0x22558a(0x1b1)](_0x2799a0,_0x22558a(0x13c)),_0x2799a0);SAFE_INTEGRATION_TYPES[_0x22558a(0x11a)](_0xbac9dc[_0x22558a(0x105)][_0x22558a(0x19d)]())?_0x2d664d[_0x22558a(0x137)]({'name':_0xbac9dc['name'],'path':_0x2799a0,'yaml':_0xbac9dc}):this[_0x22558a(0x14e)][_0x22558a(0x165)]('Skipping\x20integration\x20\x27'+_0xbac9dc['name']+'\x27\x20('+_0xbac9dc[_0x22558a(0x105)]+_0x22558a(0x106)+(_0x22558a(0xc3)+SAFE_INTEGRATION_TYPES[_0x22558a(0x1a7)](',\x20')+')\x20can\x20be\x20cloned.'));}}const _0x4397a3=getExperimentalKnowledgeBasesDir(_0x5376d7);if(a133_0x1dfaa6['existsSync'](_0x4397a3)){const _0x1ad5ba=a133_0x1dfaa6[_0x22558a(0x1b6)](_0x4397a3,{'withFileTypes':!![]});for(const _0x4d3f75 of _0x1ad5ba){if(!_0x4d3f75['isDirectory']())continue;const _0x312121=a133_0x10b9e5[_0x22558a(0x1a7)](_0x4397a3,_0x4d3f75['name']),_0x56a22b=a133_0x10b9e5['join'](_0x312121,_0x4d3f75[_0x22558a(0x1b8)]+'.yml');if(a133_0x1dfaa6[_0x22558a(0x184)](_0x56a22b)){const _0x333094=parseExperimentalKnowledgeBaseYaml(a133_0x1dfaa6[_0x22558a(0x1b1)](_0x56a22b,_0x22558a(0x13c)),_0x56a22b),_0x159357=a133_0x10b9e5['join'](_0x312121,'functions'),_0x3b70e1=[];if(a133_0x1dfaa6[_0x22558a(0x184)](_0x159357)){const _0x987f95=a133_0x1dfaa6['readdirSync'](_0x159357,{'withFileTypes':!![]});for(const _0x52120b of _0x987f95){if(!_0x52120b[_0x22558a(0x135)]())continue;const _0x236bfb=a133_0x10b9e5[_0x22558a(0x1a7)](_0x159357,_0x52120b[_0x22558a(0x1b8)]),_0x25d29e=a133_0x10b9e5[_0x22558a(0x1a7)](_0x236bfb,'code.js'),_0x49e9fb=a133_0x10b9e5[_0x22558a(0x1a7)](_0x236bfb,'json_schema.json');if(a133_0x1dfaa6[_0x22558a(0x184)](_0x25d29e)&&a133_0x1dfaa6[_0x22558a(0x184)](_0x49e9fb)){const _0x1251e1=a133_0x1dfaa6[_0x22558a(0x1b1)](_0x25d29e,_0x22558a(0x13c)),_0x2852d1=a133_0x1dfaa6[_0x22558a(0x1b1)](_0x49e9fb,_0x22558a(0x13c));_0x3b70e1[_0x22558a(0x137)]({'name':_0x52120b[_0x22558a(0x1b8)],'code':_0x1251e1,'json_schema':_0x2852d1});}}}const _0x5d6272={..._0x333094,'functions':_0x3b70e1};_0x5ce173[_0x22558a(0x137)]({'name':_0x333094[_0x22558a(0x1b8)],'path':_0x312121,'def':_0x5d6272});}}}const _0x125cfd=getExperimentalArtifactsDir(_0x5376d7);if(a133_0x1dfaa6[_0x22558a(0x184)](_0x125cfd)){const _0x653e6b=a133_0x1dfaa6['readdirSync'](_0x125cfd,{'withFileTypes':!![]});for(const _0x3db317 of _0x653e6b){if(!_0x3db317[_0x22558a(0x135)]())continue;const _0x49a7c7=a133_0x10b9e5['join'](_0x125cfd,_0x3db317[_0x22558a(0x1b8)]),_0x3438f5=a133_0x10b9e5['join'](_0x49a7c7,_0x3db317[_0x22558a(0x1b8)]+'.yml');if(a133_0x1dfaa6[_0x22558a(0x184)](_0x3438f5)){const _0x5ebc58=parseExperimentalArtifactYaml(a133_0x1dfaa6[_0x22558a(0x1b1)](_0x3438f5,_0x22558a(0x13c)),_0x3438f5),_0x334219=a133_0x10b9e5[_0x22558a(0x1a7)](_0x49a7c7,_0x22558a(0x1bf)),_0x6d9be=a133_0x1dfaa6[_0x22558a(0x184)](_0x334219)?a133_0x1dfaa6[_0x22558a(0x1b1)](_0x334219,_0x22558a(0x13c)):'',_0x159f0f=a133_0x10b9e5[_0x22558a(0x1a7)](_0x49a7c7,'files'),_0x59d832=[];if(a133_0x1dfaa6['existsSync'](_0x159f0f)){const _0x29b733=a133_0x1dfaa6[_0x22558a(0x1b6)](_0x159f0f);for(const _0x31747d of _0x29b733){const _0x2916c2=a133_0x10b9e5[_0x22558a(0x1a7)](_0x159f0f,_0x31747d);if(a133_0x1dfaa6[_0x22558a(0x194)](_0x2916c2)[_0x22558a(0x1aa)]()){const _0x2c8025=a133_0x1dfaa6['readFileSync'](_0x2916c2,_0x22558a(0x13c));_0x59d832[_0x22558a(0x137)]({'file_name':_0x31747d,'text_content':_0x2c8025});}}}const _0x94e053={..._0x5ebc58,'code':_0x6d9be,'files':_0x59d832};_0x37f573[_0x22558a(0x137)]({'name':_0x5ebc58[_0x22558a(0x1b8)],'path':_0x49a7c7,'def':_0x94e053});}}}const _0x15d932=getFormInterfacesDir(_0x5376d7);if(a133_0x1dfaa6[_0x22558a(0x184)](_0x15d932)){const _0x10db6f=a133_0x1dfaa6[_0x22558a(0x1b6)](_0x15d932)[_0x22558a(0x104)](_0x47afa9=>_0x47afa9[_0x22558a(0x1c1)](_0x22558a(0xbb)));for(const _0x64948a of _0x10db6f){const _0x1fc6df=a133_0x10b9e5[_0x22558a(0x1a7)](_0x15d932,_0x64948a),_0x50be37=parseFormInterfaceYaml(a133_0x1dfaa6[_0x22558a(0x1b1)](_0x1fc6df,'utf-8'),_0x1fc6df);_0x4805ac['push']({'name':_0x50be37[_0x22558a(0x1b8)],'path':_0x1fc6df,'yaml':_0x50be37});}}const _0x45af2f=getChatInterfacesDir(_0x5376d7);if(a133_0x1dfaa6[_0x22558a(0x184)](_0x45af2f)){const _0x3bb34e=a133_0x1dfaa6[_0x22558a(0x1b6)](_0x45af2f)[_0x22558a(0x104)](_0x530afb=>_0x530afb[_0x22558a(0x1c1)]('.yml'));for(const _0x3edb21 of _0x3bb34e){const _0x31b287=a133_0x10b9e5[_0x22558a(0x1a7)](_0x45af2f,_0x3edb21),_0x2574f6=parseChatInterfaceYaml(a133_0x1dfaa6['readFileSync'](_0x31b287,_0x22558a(0x13c)),_0x31b287);_0x49273a['push']({'name':_0x2574f6[_0x22558a(0x1b8)],'path':_0x31b287,'yaml':_0x2574f6});}}}else{const _0x4a58cc=await this[_0x22558a(0x186)](_0x5376d7),_0x3386ef=await this[_0x22558a(0x102)][_0x22558a(0x1b2)](_0x4a58cc);_0x32897c=_0x3386ef['attributes'][_0x22558a(0x1b8)];const _0x4917e4=await this[_0x22558a(0x102)][_0x22558a(0xfa)](_0x4a58cc),_0x384936=await this[_0x22558a(0x102)][_0x22558a(0xf4)](_0x4a58cc),_0x563c63=await this['client'][_0x22558a(0xa7)](_0x4a58cc),_0x4f49d9=await this[_0x22558a(0x102)][_0x22558a(0xe3)](_0x4a58cc),_0x16076e=await this[_0x22558a(0x102)][_0x22558a(0xfb)](_0x4a58cc),_0x5bfa4e=await safeListOrEmpty(()=>this[_0x22558a(0x102)][_0x22558a(0xc4)](_0x4a58cc)),_0x3df874=await safeListOrEmpty(()=>this[_0x22558a(0x102)][_0x22558a(0x120)](_0x4a58cc)),_0x583cef=new Map(),_0x159681=new Map(),_0x4f22a1=new Map(),_0x149d87=new Map(),_0x1bb5f9=new Map(),_0x1e3f09=new Map();for(const _0x5cc875 of _0x384936){_0x583cef[_0x22558a(0x187)](_0x5cc875['id'],_0x5cc875[_0x22558a(0x1c6)][_0x22558a(0x1b8)]);}for(const _0x46a02c of _0x563c63){_0x159681[_0x22558a(0x187)](_0x46a02c['id'],_0x46a02c['attributes']['name']);}for(const _0x31c871 of _0x4917e4){_0x4f22a1[_0x22558a(0x187)](_0x31c871['id'],_0x31c871[_0x22558a(0x1c6)][_0x22558a(0x1b8)]);}for(const _0x554038 of _0x4f49d9){_0x149d87['set'](_0x554038['id'],_0x554038[_0x22558a(0x1c6)][_0x22558a(0x1b8)]);}for(const _0x100dde of _0x5bfa4e){_0x1bb5f9['set'](_0x100dde['id'],_0x100dde[_0x22558a(0x1c6)]['name']);}for(const _0x362b41 of _0x3df874){_0x1e3f09[_0x22558a(0x187)](_0x362b41['id'],_0x362b41['attributes'][_0x22558a(0x1b8)]);}const _0x2bb77f={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x583cef,'TextKnowledgeBase':_0x159681,'Agent':_0x4f22a1,'ExperimentalKnowledgeBase':_0x1bb5f9}),'resolvePromptName':async _0x3319da=>_0x149d87[_0x22558a(0xca)](_0x3319da),'onWarning':_0x39eaa3=>this[_0x22558a(0x14e)][_0x22558a(0x165)](_0x39eaa3)};for(const _0x2c513f of _0x4917e4){const _0x1a0722=await agentResponseToDef(_0x2c513f,_0x2bb77f),{yaml:_0x5ee9ca,systemPrompt:_0x2c0e43,starterMessage:_0x59c0d}=_0x1a0722;_0x242b90[_0x22558a(0x137)]({'name':_0x5ee9ca[_0x22558a(0x1b8)],'dir':'','yaml':_0x5ee9ca,'systemPrompt':_0x2c0e43,'starterMessage':_0x59c0d});}for(const _0x163378 of _0x384936){const _0xf9753c=apiKnowledgeBaseToYaml(_0x163378);_0x52139d[_0x22558a(0x137)]({'name':_0xf9753c[_0x22558a(0x1b8)],'path':'','yaml':_0xf9753c});}for(const _0x223c3c of _0x563c63){_0x2ac4f7['push']({'name':_0x223c3c[_0x22558a(0x1c6)][_0x22558a(0x1b8)],'path':'','text':_0x223c3c[_0x22558a(0x1c6)][_0x22558a(0x181)]});}for(const _0x28477b of _0x4f49d9){const _0x425263=await apiPromptToYaml(_0x28477b,_0x2bb77f);_0x425263&&_0x20c176[_0x22558a(0x137)]({'name':_0x425263[_0x22558a(0x1b8)],'path':'','yaml':_0x425263});}for(const _0xdbea65 of _0x16076e){if(!_0xdbea65[_0x22558a(0x1c6)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x22558a(0x11a)](_0xdbea65[_0x22558a(0x1c6)][_0x22558a(0x1c7)]['toLowerCase']())){const _0x5380cc=await apiIntegrationToYaml(_0xdbea65,_0x2bb77f);_0x2d664d[_0x22558a(0x137)]({'name':_0xdbea65['attributes']['serviceType'][_0x22558a(0x19d)](),'path':'','yaml':_0x5380cc});}}for(const _0x3fd66c of _0x5bfa4e){const _0x12ccf9=apiExperimentalKnowledgeBaseToYaml(_0x3fd66c);_0x5ce173[_0x22558a(0x137)]({'name':_0x12ccf9[_0x22558a(0x1b8)],'path':'','def':_0x12ccf9});}for(const _0xabae29 of _0x3df874){const _0x19c143=apiExperimentalArtifactToYaml(_0xabae29);_0x37f573[_0x22558a(0x137)]({'name':_0x19c143['name'],'path':'','def':_0x19c143});}const _0x53bc24=await safeListOrEmpty(()=>this['client']['listFormInterfaces'](_0x4a58cc));for(const _0x4c76e3 of _0x53bc24){const _0x483921=await apiFormInterfaceToYaml(_0x4c76e3,_0x2bb77f);_0x4805ac[_0x22558a(0x137)]({'name':_0x483921[_0x22558a(0x1b8)],'path':'','yaml':_0x483921});}const _0x75f14e=await safeListOrEmpty(()=>this['client']['listChatInterfaces'](_0x4a58cc));for(const _0x3254bc of _0x75f14e){if(_0x3254bc[_0x22558a(0x1c6)]['isManaged'])continue;const _0x4bae86=await apiChatInterfaceToYaml(_0x3254bc,_0x2bb77f);_0x49273a[_0x22558a(0x137)]({'name':_0x4bae86[_0x22558a(0x1b8)],'path':'','yaml':_0x4bae86});}}const _0x155e68={'sourceProjectName':_0x32897c,'newProjectName':_0x191874,'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}}},_0x28aba6=await this[_0x22558a(0x102)][_0x22558a(0x1a9)](),_0x16740b=_0x28aba6[_0x22558a(0x16e)](_0x338c0e=>_0x338c0e['attributes']['name']===_0x191874);if(_0x16740b)throw new SDKError(ErrorCode[_0x22558a(0x12c)],_0x22558a(0xa9)+_0x191874+_0x22558a(0x121),undefined,{'helpText':_0x22558a(0x118)});if(_0x44a6ba?.['dryRun'])return _0x155e68[_0x22558a(0x112)]['agents'][_0x22558a(0x1b7)]=_0x242b90[_0x22558a(0x1c5)],_0x155e68[_0x22558a(0x112)][_0x22558a(0xc5)][_0x22558a(0x1b7)]=_0x52139d[_0x22558a(0x1c5)],_0x155e68[_0x22558a(0x112)][_0x22558a(0x115)][_0x22558a(0x1b7)]=_0x2ac4f7[_0x22558a(0x1c5)],_0x155e68[_0x22558a(0x112)][_0x22558a(0x197)][_0x22558a(0x1b7)]=_0x5ce173[_0x22558a(0x1c5)],_0x155e68[_0x22558a(0x112)][_0x22558a(0x17a)]['created']=_0x37f573[_0x22558a(0x1c5)],_0x155e68[_0x22558a(0x112)][_0x22558a(0x11d)]['created']=_0x20c176[_0x22558a(0x1c5)],_0x155e68[_0x22558a(0x112)][_0x22558a(0x9e)][_0x22558a(0x1b7)]=_0x2d664d['length'],_0x155e68;const _0x2d8bf3=await this[_0x22558a(0x102)][_0x22558a(0x17e)]({'name':_0x191874}),_0xa21b6c=_0x2d8bf3['id'];_0x155e68[_0x22558a(0x1af)]=_0xa21b6c;const _0x45ab26=new Map(),_0x218c67=new Map(),_0x13138c=new Map(),_0x568fd3=new Map(),_0x120517=new Map(),_0x104b00=new Map(),_0x476ca6=new Map(),_0x1dc290=new Map(),_0x4da1ce=new Set(),_0x218913=new Set();for(const _0x19b853 of _0x242b90){for(const _0x175261 of _0x19b853[_0x22558a(0x154)][_0x22558a(0xf1)]||[]){if(_0x175261[_0x22558a(0x12b)]===_0x22558a(0xb7)&&_0x175261['target']){const _0xed8d9a=parseRef(_0x175261[_0x22558a(0x172)]);if(_0xed8d9a)_0x4da1ce[_0x22558a(0xb3)](_0xed8d9a['name']);}else{if(_0x175261[_0x22558a(0x12b)]==='web_search'&&_0x175261[_0x22558a(0x172)]){const _0x187721=parseRef(_0x175261[_0x22558a(0x172)]);if(_0x187721)_0x218913['add'](_0x187721[_0x22558a(0x1b8)]);}}}}for(const _0x42ff16 of _0x4da1ce){try{const _0x1616f8=await this[_0x22558a(0x102)][_0x22558a(0x15a)]({'projectId':_0xa21b6c,'name':_0x42ff16});_0x120517[_0x22558a(0x187)](_0x42ff16,_0x1616f8['id']),_0x155e68[_0x22558a(0x177)][_0x22558a(0x137)]({'name':_0x42ff16,'action':_0x22558a(0x1b7),'id':_0x1616f8['id']}),_0x155e68[_0x22558a(0x112)][_0x22558a(0x177)][_0x22558a(0x1b7)]++;}catch(_0x250e88){_0x155e68['imageGenerators']['push']({'name':_0x42ff16,'action':_0x22558a(0x159),'error':_0x250e88['message']}),_0x155e68[_0x22558a(0x112)][_0x22558a(0x177)][_0x22558a(0xf5)]++;}}for(const _0x507ad0 of _0x218913){try{const _0x5ccbdb=await this[_0x22558a(0x102)][_0x22558a(0x191)]({'projectId':_0xa21b6c,'name':_0x507ad0});_0x104b00[_0x22558a(0x187)](_0x507ad0,_0x5ccbdb['id']),_0x155e68['webSearchTools'][_0x22558a(0x137)]({'name':_0x507ad0,'action':_0x22558a(0x1b7),'id':_0x5ccbdb['id']}),_0x155e68['counts'][_0x22558a(0x10e)][_0x22558a(0x1b7)]++;}catch(_0x5c5b7d){_0x155e68[_0x22558a(0x10e)][_0x22558a(0x137)]({'name':_0x507ad0,'action':'error','error':_0x5c5b7d[_0x22558a(0x116)]}),_0x155e68['counts'][_0x22558a(0x10e)][_0x22558a(0xf5)]++;}}const _0x5a2135=await fetchAllToolTargetMaps((_0x4b3e34,_0x6f4208)=>this[_0x22558a(0x102)][_0x22558a(0xde)](_0x4b3e34,_0x6f4208),_0xa21b6c);let _0x183f6e=[];const _0x27204d={'projectId':_0xa21b6c,'resolveToolTargetId':buildIdResolver({..._0x5a2135[_0x22558a(0xd1)],'KnowledgeBase':_0x45ab26,'TextKnowledgeBase':_0x218c67,'ExperimentalKnowledgeBase':_0x476ca6,'Agent':_0x13138c,'WebSearchTool':_0x104b00,'ImageGenerator':_0x120517}),'resolvePromptId':async _0x5b16b7=>_0x568fd3[_0x22558a(0xca)](_0x5b16b7),'onWarning':_0x5e9230=>{const _0x19ae6b=_0x22558a;this[_0x19ae6b(0x14e)]['warn'](_0x5e9230),_0x183f6e[_0x19ae6b(0x137)](_0x5e9230);}};for(const _0x4f6fca of _0x52139d){try{const _0x1d306d=yamlKnowledgeBaseToApi(_0x4f6fca[_0x22558a(0x154)],_0xa21b6c),_0x42decf=await this[_0x22558a(0x102)][_0x22558a(0xf2)](_0x1d306d);_0x45ab26[_0x22558a(0x187)](_0x4f6fca[_0x22558a(0x154)]['name'],_0x42decf['id']),_0x155e68[_0x22558a(0xc5)][_0x22558a(0x137)]({'name':_0x4f6fca[_0x22558a(0x154)][_0x22558a(0x1b8)],'action':_0x22558a(0x1b7),'id':_0x42decf['id']}),_0x155e68[_0x22558a(0x112)][_0x22558a(0xc5)][_0x22558a(0x1b7)]++;}catch(_0x335999){_0x155e68[_0x22558a(0xc5)][_0x22558a(0x137)]({'name':_0x4f6fca['yaml'][_0x22558a(0x1b8)],'action':_0x22558a(0x159),'error':_0x335999[_0x22558a(0x116)]}),_0x155e68['counts'][_0x22558a(0xc5)][_0x22558a(0xf5)]++;}}for(const _0x3c4a1c of _0x2ac4f7){try{const _0x2bc90d=yamlTextKnowledgeBaseToApi({'name':_0x3c4a1c[_0x22558a(0x1b8)],'text':_0x3c4a1c[_0x22558a(0x181)]},_0xa21b6c),_0x42ed2b=await this[_0x22558a(0x102)][_0x22558a(0x160)](_0x2bc90d);_0x218c67[_0x22558a(0x187)](_0x3c4a1c[_0x22558a(0x1b8)],_0x42ed2b['id']),_0x155e68[_0x22558a(0x115)][_0x22558a(0x137)]({'name':_0x3c4a1c['name'],'action':_0x22558a(0x1b7),'id':_0x42ed2b['id']}),_0x155e68[_0x22558a(0x112)][_0x22558a(0x115)][_0x22558a(0x1b7)]++;}catch(_0x3f89b6){_0x155e68[_0x22558a(0x115)]['push']({'name':_0x3c4a1c[_0x22558a(0x1b8)],'action':_0x22558a(0x159),'error':_0x3f89b6[_0x22558a(0x116)]}),_0x155e68[_0x22558a(0x112)][_0x22558a(0x115)]['errors']++;}}for(const _0x4d2fef of _0x37f573){try{const _0x285d03=yamlExperimentalArtifactToApi(_0x4d2fef[_0x22558a(0x11f)],_0xa21b6c),_0x523cb1=await this['client']['createExperimentalArtifact'](_0x285d03);_0x1dc290['set'](_0x4d2fef[_0x22558a(0x11f)][_0x22558a(0x1b8)],_0x523cb1['id']),_0x155e68[_0x22558a(0x17a)][_0x22558a(0x137)]({'name':_0x4d2fef[_0x22558a(0x11f)][_0x22558a(0x1b8)],'action':'created','id':_0x523cb1['id']}),_0x155e68[_0x22558a(0x112)][_0x22558a(0x17a)][_0x22558a(0x1b7)]++;}catch(_0x546b89){_0x155e68[_0x22558a(0x17a)][_0x22558a(0x137)]({'name':_0x4d2fef[_0x22558a(0x11f)][_0x22558a(0x1b8)],'action':_0x22558a(0x159),'error':_0x546b89[_0x22558a(0x116)]}),_0x155e68[_0x22558a(0x112)][_0x22558a(0x17a)][_0x22558a(0xf5)]++;}}for(const _0xec7f6d of _0x5ce173){try{const _0x5900d0=yamlExperimentalKnowledgeBaseToApi(_0xec7f6d[_0x22558a(0x11f)],_0xa21b6c),_0x507353=await this['client'][_0x22558a(0x1a8)](_0x5900d0);_0x476ca6['set'](_0xec7f6d[_0x22558a(0x11f)][_0x22558a(0x1b8)],_0x507353['id']),_0x155e68[_0x22558a(0x197)][_0x22558a(0x137)]({'name':_0xec7f6d[_0x22558a(0x11f)][_0x22558a(0x1b8)],'action':_0x22558a(0x1b7),'id':_0x507353['id']}),_0x155e68['counts'][_0x22558a(0x197)][_0x22558a(0x1b7)]++;}catch(_0x226a66){_0x155e68[_0x22558a(0x197)]['push']({'name':_0xec7f6d[_0x22558a(0x11f)][_0x22558a(0x1b8)],'action':_0x22558a(0x159),'error':_0x226a66['message']}),_0x155e68[_0x22558a(0x112)][_0x22558a(0x197)][_0x22558a(0xf5)]++;}}const _0x1790cf=[..._0x242b90][_0x22558a(0x13b)]((_0x59c6aa,_0x5357a4)=>{const _0x572b8f=_0x22558a,_0x1bc7a1=_0x59c6aa[_0x572b8f(0x154)]['tools']?.[_0x572b8f(0x176)](_0x108d1f=>_0x108d1f[_0x572b8f(0x12b)]===_0x572b8f(0x149))??![],_0x25316b=_0x5357a4['yaml'][_0x572b8f(0xf1)]?.[_0x572b8f(0x176)](_0x53df1f=>_0x53df1f[_0x572b8f(0x12b)]===_0x572b8f(0x149))??![];if(_0x1bc7a1&&!_0x25316b)return 0x1;if(!_0x1bc7a1&&_0x25316b)return-0x1;return 0x0;});for(const _0x59d896 of _0x1790cf){_0x183f6e=[];try{const _0x403d8b=_0x59d896[_0x22558a(0x154)]['tools']?.[_0x22558a(0x104)](_0x1a8a43=>{const _0x553f6d=_0x22558a;if(_0x1a8a43[_0x553f6d(0x12b)]===_0x553f6d(0x149)&&_0x1a8a43[_0x553f6d(0x172)]){const _0x330fb4=parseRef(_0x1a8a43[_0x553f6d(0x172)]);return _0x330fb4?.[_0x553f6d(0x1b8)]===_0x59d896[_0x553f6d(0x154)]['name'];}return![];})??[];if(_0x403d8b[_0x22558a(0x1c5)]>0x0){const _0x592321=_0x22558a(0x10a)+_0x59d896[_0x22558a(0x154)]['name']+'\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20'+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this[_0x22558a(0x14e)][_0x22558a(0x165)](_0x592321),_0x183f6e[_0x22558a(0x137)](_0x592321);}const _0x2bd281=await agentDefToRequest(_0x59d896[_0x22558a(0x154)],_0x59d896[_0x22558a(0x11e)],_0x59d896['starterMessage'],_0x27204d),_0x5d262c=await this[_0x22558a(0x102)][_0x22558a(0xad)](_0x2bd281);_0x13138c[_0x22558a(0x187)](_0x59d896[_0x22558a(0x154)][_0x22558a(0x1b8)],_0x5d262c['id']),_0x155e68[_0x22558a(0x158)][_0x22558a(0x137)]({'agentName':_0x59d896['yaml'][_0x22558a(0x1b8)],'action':_0x22558a(0x1b7),'agentId':_0x5d262c['id'],'warnings':_0x183f6e[_0x22558a(0x1c5)]>0x0?_0x183f6e:undefined}),_0x155e68[_0x22558a(0x112)][_0x22558a(0x158)]['created']++;}catch(_0x271a01){_0x155e68[_0x22558a(0x158)][_0x22558a(0x137)]({'agentName':_0x59d896[_0x22558a(0x154)][_0x22558a(0x1b8)],'action':_0x22558a(0x159),'error':_0x271a01[_0x22558a(0x116)],'warnings':_0x183f6e['length']>0x0?_0x183f6e:undefined}),_0x155e68[_0x22558a(0x112)][_0x22558a(0x158)][_0x22558a(0xf5)]++;}}for(const _0x4429bc of _0x20c176){try{const _0x1154eb=await yamlPromptToApi(_0x4429bc[_0x22558a(0x154)],_0xa21b6c,_0x27204d);if(!_0x1154eb){_0x155e68[_0x22558a(0x11d)]['push']({'name':_0x4429bc[_0x22558a(0x154)]['name'],'action':_0x22558a(0x159),'error':_0x22558a(0x185)}),_0x155e68['counts'][_0x22558a(0x11d)]['errors']++;continue;}const _0x22fa76=await this['client'][_0x22558a(0x107)](_0x1154eb);_0x568fd3[_0x22558a(0x187)](_0x4429bc['yaml'][_0x22558a(0x1b8)],_0x22fa76['id']),_0x155e68[_0x22558a(0x11d)][_0x22558a(0x137)]({'name':_0x4429bc['yaml'][_0x22558a(0x1b8)],'action':'created','id':_0x22fa76['id']}),_0x155e68[_0x22558a(0x112)][_0x22558a(0x11d)][_0x22558a(0x1b7)]++;}catch(_0x20db2a){_0x155e68[_0x22558a(0x11d)][_0x22558a(0x137)]({'name':_0x4429bc[_0x22558a(0x154)][_0x22558a(0x1b8)],'action':_0x22558a(0x159),'error':_0x20db2a['message']}),_0x155e68[_0x22558a(0x112)][_0x22558a(0x11d)][_0x22558a(0xf5)]++;}}for(const _0xa4ebc of _0x2d664d){try{const _0x53674a=await yamlIntegrationToApi(_0xa4ebc[_0x22558a(0x154)],_0xa21b6c,_0x27204d),_0x18edb7=await this[_0x22558a(0x102)][_0x22558a(0xe6)](_0x53674a);_0x155e68[_0x22558a(0x9e)][_0x22558a(0x137)]({'name':_0xa4ebc[_0x22558a(0x154)][_0x22558a(0x105)],'action':_0x22558a(0x1b7),'id':_0x18edb7['id']}),_0x155e68[_0x22558a(0x112)][_0x22558a(0x9e)][_0x22558a(0x1b7)]++;}catch(_0x2b6eaa){_0x155e68[_0x22558a(0x9e)][_0x22558a(0x137)]({'name':_0xa4ebc[_0x22558a(0x154)][_0x22558a(0x105)],'action':_0x22558a(0x159),'error':_0x2b6eaa['message']}),_0x155e68['counts'][_0x22558a(0x9e)][_0x22558a(0xf5)]++;}}for(const _0x6e4e01 of _0x4805ac){try{const _0x4a80ba=await yamlFormInterfaceToApi(_0x6e4e01[_0x22558a(0x154)],_0xa21b6c,_0x27204d);if(!_0x4a80ba){_0x155e68[_0x22558a(0x13a)][_0x22558a(0x137)]({'name':_0x6e4e01['yaml'][_0x22558a(0x1b8)],'action':'error','error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x155e68[_0x22558a(0x112)][_0x22558a(0x13a)][_0x22558a(0xf5)]++;continue;}const _0xe20b60=await this[_0x22558a(0x102)][_0x22558a(0x189)](_0x4a80ba);_0x155e68['formInterfaces'][_0x22558a(0x137)]({'name':_0x6e4e01['yaml'][_0x22558a(0x1b8)],'action':_0x22558a(0x1b7),'id':_0xe20b60['id']}),_0x155e68[_0x22558a(0x112)][_0x22558a(0x13a)][_0x22558a(0x1b7)]++;}catch(_0x365ea0){_0x155e68[_0x22558a(0x13a)][_0x22558a(0x137)]({'name':_0x6e4e01[_0x22558a(0x154)][_0x22558a(0x1b8)],'action':'error','error':_0x365ea0[_0x22558a(0x116)]}),_0x155e68[_0x22558a(0x112)][_0x22558a(0x13a)][_0x22558a(0xf5)]++;}}for(const _0x4bf818 of _0x49273a){try{const _0xfd8e59=await yamlChatInterfaceToApi(_0x4bf818[_0x22558a(0x154)],_0xa21b6c,_0x27204d),_0x38b782=await this['client'][_0x22558a(0xb5)](_0xfd8e59);_0x155e68[_0x22558a(0x14d)]['push']({'name':_0x4bf818[_0x22558a(0x154)][_0x22558a(0x1b8)],'action':_0x22558a(0x1b7),'id':_0x38b782['id']}),_0x155e68[_0x22558a(0x112)][_0x22558a(0x14d)]['created']++;}catch(_0x105aed){_0x155e68[_0x22558a(0x14d)][_0x22558a(0x137)]({'name':_0x4bf818['yaml'][_0x22558a(0x1b8)],'action':'error','error':_0x105aed[_0x22558a(0x116)]}),_0x155e68[_0x22558a(0x112)][_0x22558a(0x14d)][_0x22558a(0xf5)]++;}}return _0x155e68;}}
|