@treasuredata/tdx 2026.4.15 → 2026.4.16
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.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/cas/cas-api-client.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js +1 -1
- package/dist/sdk/cas/cas-segment-yaml.js +1 -1
- package/dist/sdk/cas/index.js +1 -1
- package/dist/sdk/cas/pull-workflow.js +1 -1
- package/dist/sdk/cas/push-workflow.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/types/workspace.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/sdk/workspace/access-tracker.js +1 -1
- package/dist/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
package/dist/sdk/llm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a133_0x4f6d4d=a133_0x29d6;(function(_0x4cc990,_0x427746){const _0x302a69=a133_0x29d6,_0x3c5a1f=_0x4cc990();while(!![]){try{const _0x2a9559=parseInt(_0x302a69(0x209))/0x1*(parseInt(_0x302a69(0x11d))/0x2)+-parseInt(_0x302a69(0x177))/0x3*(-parseInt(_0x302a69(0x224))/0x4)+parseInt(_0x302a69(0x130))/0x5*(parseInt(_0x302a69(0x13d))/0x6)+-parseInt(_0x302a69(0x208))/0x7*(-parseInt(_0x302a69(0x1fc))/0x8)+-parseInt(_0x302a69(0x1ab))/0x9+parseInt(_0x302a69(0x239))/0xa+parseInt(_0x302a69(0x11a))/0xb*(-parseInt(_0x302a69(0x12c))/0xc);if(_0x2a9559===_0x427746)break;else _0x3c5a1f['push'](_0x3c5a1f['shift']());}catch(_0x35e226){_0x3c5a1f['push'](_0x3c5a1f['shift']());}}}(a133_0x798d,0x953d0));import{LLMApiClient}from'../client/llm-api-client.js';import*as a133_0x1b52fe from'node:fs';function a133_0x29d6(_0x92b713,_0x2f5aaf){_0x92b713=_0x92b713-0x117;const _0x798d41=a133_0x798d();let _0x29d6f5=_0x798d41[_0x92b713];return _0x29d6f5;}import*as a133_0x3324d2 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';function a133_0x798d(){const _0x40f975=['Skipping\x20integration\x20\x27','Renamed\x20integration\x20file:\x20','4550913iChjKR','availableModels','prompts','serviceType','status','createExperimentalArtifact','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','high','new','llm_project','statSync','temperature','getProject','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','reasoningEffort','promptId','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','starterMessage','variables','size','getBackupMetadata','prompts.json','INVALID_ARGUMENT','createTextKnowledgeBase','agents','Renamed\x20experimental\x20artifact\x20directory:\x20','Only\x20safe\x20types\x20(','readFileSync','_reasoning_','parse','client','chat_agent_console','existsSync','getChatInfo','updateAgent','Unable\x20to\x20create\x20project\x20after\x20','Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.','knowledgeBases','listIntegrations','duplicate','get','target','dirname','toLowerCase','Renamed\x20text\x20KB\x20file:\x20','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','error','image_gen','code.js','formInterfaces','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','restoreProject','jsonSchemaHint','minimal','def','currentProjectId','backupProject','chatInterfaces','chat','listAgents','agents.json','createAgent','availableModelNames','event','.yml','):\x20','createKnowledgeBase','experimental_knowledge_bases','unlinkSync','updateAgentResponse','Multiple\x20agents\x20found\x20with\x20name\x20\x27','yaml','Renamed\x20folder:\x20','chat_parent_segment','stringify','projects','isManaged','set','experimentalArtifacts','service_type','json_schema','128vsjZVW','listExperimentalKnowledgeBases','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','name','systemPrompt','integrations.json','models','context','pullAgent','continueChat','warn','writeFileSync','531461inUqMJ','2128JACYeh','counts','starter_message','basename','Renamed\x20experimental\x20KB\x20directory:\x20','filter','deleteIntegration','NOT_FOUND','displayName','Could\x20not\x20resolve\x20agent\x20reference','toISOString','message','sort','json_schema.json','.llm','endsWith','chats','text','updateExperimentalArtifact','length','experimental_artifacts','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','getOrCreateDefaultProject','deleteAgent','errors',')\x20can\x20be\x20pushed.\x20','#\x20prompt.md\x0a','16LcwAKS','content','dryRun','tdx_default_','claude-4.5-sonnet','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','sdk.llm','createChatInterface','site','Agent\x20reference\x20not\x20found','listProjects','oldPath','text_content','listTextKnowledgeBases','Renamed\x20prompt\x20file:\x20','updated','idToName','Backup\x20folder\x20not\x20found:\x20','agentId','agentsFull','utf-8','1074510dnELBw','textKnowledgeBases','listExperimentalArtifacts','knowledgebases.json','Renamed\x20agent\x20folder:\x20','signal','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','2497abbYWz','setCurrentProject','updateKnowledgeBase','1132ppzrMO','files','AGENT_NOT_FOUND','agent.yml','mkdirSync','tdDatabaseName','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','listWebSearchTools','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','knowledge_bases',')\x20can\x20be\x20cloned.','nameToId','localeCompare','find','createExperimentalKnowledgeBase','111204iQRMNQ','\x20→\x20','add','createIntegration','25jHnDJb','createAgentResponse','Agent\x20\x27','info','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','metadata','startChat','Project\x20not\x20found:\x20','Renamed\x20chat\x20interface\x20file:\x20','slackMessageMode','prompt.md','listAgentsFull','TextKnowledgeBase','562314Yibctd','getDefaultProjectName','push','version','created','\x0a---\x20schema:\x20','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','(dry-run)','createImageGenerator','\x27.\x20This\x20should\x20not\x20happen.','logger','chat_interfaces','imageGenerators','updateFormInterface','Available\x20agents:\x20','pushProject','webhookCorsOrigins','actions','has','.md','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','Project\x20\x22','updateTextKnowledgeBase','maxToolIterations','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','exportedFrom','listPrompts','conflict','webSearchTools','isDir','createFormInterface','PERMISSION_DENIED','ALREADY_EXISTS','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','Renamed\x20form\x20interface\x20file:\x20','project','---\x20file:\x20','rmSync','readdirSync','INTERNAL','chat_generic','isFile','total','\x0a\x0a#\x20agent.yml\x0a','deleteProject','code','isDirectory','file_name','clearDefaultAgent','\x22\x20already\x20exists','projectId','Multiple\x20projects\x20found\x20with\x20name\x20\x27','tools','tdx_','path','renamed','description','168963xYnoUF','profile','createPrompt','functions','\x0a---\x20function:\x20','integrations','listFormInterfaces','tdx.json','includes','resolveAgentId','updatePrompt','cwd','agent','getCurrentProject','template','\x20attempts\x20due\x20to\x20name\x20conflicts.','resolveProjectName','getUserSettings','listToolTargets','listKnowledgeBases','updateExperimentalKnowledgeBase','projectName','KnowledgeBase','type','createProject','join','form_interfaces','experimentalKnowledgeBases','pushAgent','starter_message.md','project.json','already\x20exists','resolveProjectId','---\x20schema:\x20','getChatLog','unchanged','tables','chatIgnoreManagedActions','Unresolved\x20dependencies:\x20','attributes','Output\x20directory\x20already\x20exists:\x20','history','getAgent','split','map','updateChatInterface','\x0a---\x20code\x20---\x0a','Unsupported\x20backup\x20version:\x20','loadJsonFile','\x20---\x0a'];a133_0x798d=function(){return _0x40f975;};return a133_0x798d();}import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a133_0x4f6d4d(0x166),a133_0x4f6d4d(0x1ca),a133_0x4f6d4d(0x1f4)];async function safeListOrEmpty(_0x114931){const _0x11678a=a133_0x4f6d4d;try{return await _0x114931();}catch(_0xcfd87d){if(_0xcfd87d instanceof HTTPClientError&&_0xcfd87d[_0x11678a(0x1af)]===0x194)return[];throw _0xcfd87d;}}export class LLMSDK{[a133_0x4f6d4d(0x1e2)];[a133_0x4f6d4d(0x1c9)];[a133_0x4f6d4d(0x203)];['logger']=Logger['of'](a133_0x4f6d4d(0x22a));constructor(_0x3c64b9){this['client']=new LLMApiClient(_0x3c64b9),this['context']=_0x3c64b9;}[a133_0x4f6d4d(0x13e)](){const _0x2ab920=a133_0x4f6d4d,_0x4add39=getSanitizedUsername();return _0x2ab920(0x227)+_0x4add39;}async[a133_0x4f6d4d(0x11b)](_0x4f727f){const _0x1e409f=a133_0x4f6d4d,{projectId:_0x43986f}=await this[_0x1e409f(0x187)](_0x4f727f);this[_0x1e409f(0x1e2)]=_0x43986f;}[a133_0x4f6d4d(0x184)](){const _0x34b468=a133_0x4f6d4d;return this[_0x34b468(0x1e2)];}async['setDefaultAgent'](_0x1c1de1){const _0x3654c0=a133_0x4f6d4d,_0x5874a1=this[_0x3654c0(0x203)][_0x3654c0(0x178)];let _0x26291c,_0x3fffca;if(_0x1c1de1[_0x3654c0(0x17f)]('/')){const _0x17a0d3=_0x1c1de1[_0x3654c0(0x1a2)]('/');if(_0x17a0d3[_0x3654c0(0x21c)]!==0x2)throw new SDKError(ErrorCode[_0x3654c0(0x1c1)],'Invalid\x20agent\x20reference\x20format:\x20'+_0x1c1de1,undefined,{'helpText':_0x3654c0(0x1b8)});const [_0x4e36db,_0x286d70]=_0x17a0d3;_0x26291c=await this[_0x3654c0(0x197)](_0x4e36db),_0x3fffca=_0x286d70;}else _0x26291c=this[_0x3654c0(0x1e2)]||(await this[_0x3654c0(0x21f)]())['id'],_0x3fffca=_0x1c1de1;const _0x45ce0e=await this[_0x3654c0(0x180)](_0x3fffca,_0x26291c),_0x4da8c5=await this[_0x3654c0(0x1c9)]['getAgent'](_0x45ce0e);writeCachedLLMAgent(_0x4da8c5['attributes'][_0x3654c0(0x1ff)],_0x45ce0e,_0x26291c,_0x5874a1);}['getDefaultAgent'](){const _0x356245=a133_0x4f6d4d,_0x1db945=this[_0x356245(0x203)][_0x356245(0x178)];return readCachedLLMAgent(_0x1db945)||undefined;}[a133_0x4f6d4d(0x16e)](){const _0x3439ab=a133_0x4f6d4d,_0x304f66=this['context'][_0x3439ab(0x178)];clearCachedLLMAgent(_0x304f66);}async[a133_0x4f6d4d(0x202)](){const _0x310dba=a133_0x4f6d4d,_0x1af6e5=await this[_0x310dba(0x1c9)][_0x310dba(0x188)](),_0x281951=[];for(const _0x193ea3 of _0x1af6e5[_0x310dba(0x1e9)]){const _0x33c1f7=_0x1af6e5[_0x310dba(0x1ac)][_0x193ea3];_0x33c1f7&&_0x281951[_0x310dba(0x13f)]({'name':_0x193ea3,'displayName':_0x33c1f7[_0x310dba(0x211)]});}return _0x281951;}async[a133_0x4f6d4d(0x18f)](_0x28eb0f){const _0x5eeaca=a133_0x4f6d4d;return await this['client'][_0x5eeaca(0x18f)](_0x28eb0f);}async[a133_0x4f6d4d(0x16a)](_0x31abea){const _0x5df08b=a133_0x4f6d4d,{projectId:_0xadf6b0}=await this[_0x5df08b(0x187)](_0x31abea);await this[_0x5df08b(0x1c9)][_0x5df08b(0x16a)](_0xadf6b0);}async[a133_0x4f6d4d(0x1f6)](_0xcd4a65=0x32){const _0x4f4b34=a133_0x4f6d4d;return await this[_0x4f4b34(0x1c9)][_0x4f4b34(0x22e)](_0xcd4a65);}async[a133_0x4f6d4d(0x21f)](_0x486052){const _0x70dfae=a133_0x4f6d4d,_0x2af574=_0x486052||this[_0x70dfae(0x13e)](),_0x3c3902=this[_0x70dfae(0x203)][_0x70dfae(0x178)];if(!_0x486052){const _0x214d5f=readCachedLLMProject(_0x3c3902);if(_0x214d5f&&_0x214d5f['name']===_0x2af574)try{const _0x27b3ea=await this[_0x70dfae(0x1c9)]['getProject'](_0x214d5f['id']);if(_0x27b3ea[_0x70dfae(0x19e)][_0x70dfae(0x1ff)]===_0x2af574)return _0x27b3ea;}catch{}}const _0x316ca9=await this[_0x70dfae(0x1c9)]['listProjects'](),_0x1939fc=_0x316ca9[_0x70dfae(0x12a)](_0x509666=>_0x509666[_0x70dfae(0x19e)]['name']===_0x2af574);if(_0x1939fc)return!_0x486052&&writeCachedLLMProject(_0x2af574,_0x1939fc['id'],_0x3c3902),_0x1939fc;const _0x29b10d=await this['client'][_0x70dfae(0x18f)]({'name':_0x2af574,'description':_0x70dfae(0x123)+getSanitizedUsername()+')'});return!_0x486052&&writeCachedLLMProject(_0x2af574,_0x29b10d['id'],_0x3c3902),_0x29b10d;}async[a133_0x4f6d4d(0x197)](_0x1c1992){const _0x14f2a2=a133_0x4f6d4d,_0x1dc4b7=await this[_0x14f2a2(0x1c9)][_0x14f2a2(0x22e)](),_0x90aa9=_0x1dc4b7['filter'](_0x455b00=>_0x455b00[_0x14f2a2(0x19e)]['name']===_0x1c1992);if(_0x90aa9[_0x14f2a2(0x21c)]===0x0)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x14f2a2(0x137)+_0x1c1992,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x90aa9[_0x14f2a2(0x21c)]>0x1)throw new SDKError(ErrorCode[_0x14f2a2(0x165)],_0x14f2a2(0x171)+_0x1c1992+_0x14f2a2(0x146));return _0x90aa9[0x0]['id'];}async['resolveProjectName'](_0x161ae6){const _0x38b811=a133_0x4f6d4d,_0x35e1f9=await this[_0x38b811(0x1c9)]['listProjects'](),_0x39689b=_0x35e1f9['find'](_0x634810=>_0x634810[_0x38b811(0x19e)][_0x38b811(0x1ff)]===_0x161ae6);if(_0x39689b)return{'projectId':_0x39689b['id'],'project':_0x39689b};throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0x161ae6,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async['getOrCreateDefaultAgent'](_0xc02970=a133_0x4f6d4d(0x228),_0x285f1c=0x0,_0xc5a243){const _0x269251=a133_0x4f6d4d,_0x3e8742=0xa;let _0x192d0e=0x0,_0x508ad8;while(_0x192d0e<_0x3e8742){try{const _0x4ee98d=await this[_0x269251(0x21f)](_0x508ad8),_0x5956e1=_0x4ee98d['id'],_0x4e3bac=['none',_0x269251(0x1e0),'low','medium',_0x269251(0x1b2)],_0x316741=_0x285f1c===0x0?_0x269251(0x173)+_0xc02970:_0x269251(0x173)+_0xc02970+_0x269251(0x1c7)+_0x4e3bac[_0x285f1c],_0x2acb54=await this[_0x269251(0x1c9)][_0x269251(0x1e6)](_0x5956e1),_0xf3e1a=_0x2acb54[_0x269251(0x12a)](_0x5979f9=>_0x5979f9[_0x269251(0x19e)][_0x269251(0x1ff)]===_0x316741);if(_0xf3e1a)return _0xf3e1a;const _0x595878=_0x285f1c>0x0?0x1:_0xc5a243;return await this['client'][_0x269251(0x1e8)]({'name':_0x316741,'projectId':_0x5956e1,'modelType':_0xc02970,'systemPrompt':'','temperature':_0x595878,'reasoningEffort':_0x285f1c>0x0?_0x285f1c:undefined});}catch(_0x4c4ac1){if(_0x4c4ac1 instanceof HTTPClientError){const _0x282674=_0x4c4ac1['status'];if(_0x282674>=0x190&&_0x282674<0x1f4){if(_0x282674===0x191)throw new SDKError(ErrorCode['UNAUTHENTICATED'],_0x269251(0x21e),_0x4c4ac1);else{if(_0x282674===0x193)throw new SDKError(ErrorCode[_0x269251(0x15d)],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x4c4ac1);}throw _0x4c4ac1;}}if(errorContains(_0x4c4ac1,_0x269251(0x196),_0x269251(0x1d2),_0x269251(0x159))){_0x192d0e++;if(_0x192d0e>=_0x3e8742)throw new SDKError(ErrorCode[_0x269251(0x15e)],_0x269251(0x1ce)+_0x3e8742+_0x269251(0x186),_0x4c4ac1);const _0x479aee=this[_0x269251(0x13e)]();_0x508ad8=_0x479aee+'_'+generateRandomHex();continue;}throw _0x4c4ac1;}}throw new SDKError(ErrorCode[_0x269251(0x165)],_0x269251(0x125));}async[a133_0x4f6d4d(0x180)](_0x740aa2,_0x2af1e8){const _0xe43bec=a133_0x4f6d4d,_0x53a82c=_0x2af1e8||this[_0xe43bec(0x1e2)],_0x4beb61=await this[_0xe43bec(0x1c9)][_0xe43bec(0x1e6)](_0x53a82c),_0x388442=_0x4beb61[_0xe43bec(0x20e)](_0x2d945d=>_0x2d945d['attributes'][_0xe43bec(0x1ff)]===_0x740aa2);if(_0x388442['length']===0x0){const _0x45b90e=_0x53a82c?'\x20in\x20project\x20'+_0x53a82c:'';throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],'Agent\x20not\x20found:\x20'+_0x740aa2+_0x45b90e,undefined,{'helpText':_0x53a82c?_0xe43bec(0x156):_0xe43bec(0x1cf)});}if(_0x388442[_0xe43bec(0x21c)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0xe43bec(0x1f1)+_0x740aa2+'\x27.\x20This\x20should\x20not\x20happen.');return _0x388442[0x0]['id'];}async[a133_0x4f6d4d(0x1c3)](_0x4d32ba){const _0x4ff275=a133_0x4f6d4d,_0x23c8a1=_0x4d32ba||this[_0x4ff275(0x1e2)];return await this['client']['listAgents'](_0x23c8a1);}async[a133_0x4f6d4d(0x237)](_0x33c549){const _0x51d460=a133_0x4f6d4d;return await this[_0x51d460(0x1c9)]['listAgentsFull'](_0x33c549);}async[a133_0x4f6d4d(0x183)](_0x15d30c){const _0x245ffb=a133_0x4f6d4d;return await this['client'][_0x245ffb(0x1a1)](_0x15d30c);}async[a133_0x4f6d4d(0x1e8)](_0x423e57){return await this['client']['createAgent'](_0x423e57);}async['updateAgent'](_0x59f505,_0x36c021){const _0x575045=a133_0x4f6d4d;return await this['client'][_0x575045(0x1cd)](_0x59f505,_0x36c021);}async[a133_0x4f6d4d(0x220)](_0x5944db){const _0x27a954=a133_0x4f6d4d;await this[_0x27a954(0x1c9)]['deleteAgent'](_0x5944db);}async['startChat'](_0x44a932){const _0xa52b01=a133_0x4f6d4d;return await this[_0xa52b01(0x1c9)][_0xa52b01(0x136)]({'agentId':_0x44a932});}async*[a133_0x4f6d4d(0x1e5)](_0x5b033d,_0x1401f9){const _0x5027d5=a133_0x4f6d4d;let _0x46f300=_0x1401f9?.['chatId'];const _0x101278=_0x1401f9?.[_0x5027d5(0x236)];if(!_0x46f300){if(!_0x101278)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x385637=await this[_0x5027d5(0x1c9)][_0x5027d5(0x136)]({'agentId':_0x101278});_0x46f300=_0x385637['id'],yield{'type':_0x5027d5(0x135),'data':{'chatId':_0x46f300,'agentId':_0x101278,'projectId':_0x385637[_0x5027d5(0x19e)][_0x5027d5(0x170)]}};}for await(const _0x2d50dc of this[_0x5027d5(0x1c9)][_0x5027d5(0x205)](_0x46f300,_0x5b033d,_0x1401f9?.[_0x5027d5(0x118)])){yield{'type':_0x5027d5(0x1ea),'data':_0x2d50dc};}}async[a133_0x4f6d4d(0x219)](_0x3466b1=0x32){return await this['client']['listChats'](_0x3466b1);}async[a133_0x4f6d4d(0x1a0)](_0x3a23fa){const _0x1f67be=a133_0x4f6d4d;return await this[_0x1f67be(0x1c9)]['getChatHistory'](_0x3a23fa);}async['getChatLog'](_0x25880e){const _0x3fd3f9=a133_0x4f6d4d;return await this['client'][_0x3fd3f9(0x199)](_0x25880e);}async['chatInfo'](_0x22e484){const _0x294ae6=a133_0x4f6d4d;return await this['client'][_0x294ae6(0x1cc)](_0x22e484);}async[a133_0x4f6d4d(0x1e3)](_0x3cd6b8,_0x4bc441,_0x48a5f){const _0x4f277b=a133_0x4f6d4d,_0x266140=_0x48a5f?.['dryRun']??![],{projectId:_0x5dfc9c,project:_0x34de76}=await this[_0x4f277b(0x187)](_0x3cd6b8),_0x44fee0=_0x34de76[_0x4f277b(0x19e)][_0x4f277b(0x1ff)],_0x3a5745=_0x4bc441||_0x44fee0+_0x4f277b(0x217);if(a133_0x1b52fe[_0x4f277b(0x1cb)](_0x3a5745)&&!_0x266140)throw new SDKError(ErrorCode[_0x4f277b(0x15e)],_0x4f277b(0x19f)+_0x3a5745,undefined,{'helpText':_0x4f277b(0x1fe)});const _0x56655e=await this['client'][_0x4f277b(0x13b)](_0x5dfc9c),_0x3bb70f=await this[_0x4f277b(0x1c9)][_0x4f277b(0x18a)](_0x5dfc9c),_0x170a2d=await this['client'][_0x4f277b(0x158)](_0x5dfc9c),_0x258abf=await this['client'][_0x4f277b(0x1d1)](_0x5dfc9c);if(!_0x266140){a133_0x1b52fe[_0x4f277b(0x121)](_0x3a5745,{'recursive':!![]});const _0x374d66={'version':'1.0','exportedAt':new Date()[_0x4f277b(0x213)](),'exportedFrom':{'site':this[_0x4f277b(0x203)][_0x4f277b(0x22c)],'projectId':_0x5dfc9c,'projectName':_0x44fee0},'project':_0x34de76};a133_0x1b52fe[_0x4f277b(0x207)](a133_0x3324d2['join'](_0x3a5745,_0x4f277b(0x195)),JSON[_0x4f277b(0x1f5)](_0x374d66,null,0x2)),a133_0x1b52fe[_0x4f277b(0x207)](a133_0x3324d2[_0x4f277b(0x190)](_0x3a5745,_0x4f277b(0x1e7)),JSON['stringify'](_0x56655e,null,0x2)),a133_0x1b52fe['writeFileSync'](a133_0x3324d2[_0x4f277b(0x190)](_0x3a5745,_0x4f277b(0x23c)),JSON[_0x4f277b(0x1f5)](_0x3bb70f,null,0x2)),a133_0x1b52fe['writeFileSync'](a133_0x3324d2['join'](_0x3a5745,'prompts.json'),JSON['stringify'](_0x170a2d,null,0x2)),a133_0x1b52fe['writeFileSync'](a133_0x3324d2[_0x4f277b(0x190)](_0x3a5745,_0x4f277b(0x201)),JSON[_0x4f277b(0x1f5)](_0x258abf,null,0x2));}return{'projectName':_0x44fee0,'outputDir':_0x3a5745,'counts':{'agents':_0x56655e[_0x4f277b(0x21c)],'knowledgeBases':_0x3bb70f[_0x4f277b(0x21c)],'prompts':_0x170a2d['length'],'integrations':_0x258abf[_0x4f277b(0x21c)]}};}async[a133_0x4f6d4d(0x1de)](_0x4ff6f7,_0x5cdf53){const _0x2137c7=a133_0x4f6d4d,_0x52295d=_0x5cdf53?.[_0x2137c7(0x226)]??![],_0x8c576e=this[_0x2137c7(0x1bf)](_0x4ff6f7),_0x5a94ec=_0x8c576e[_0x2137c7(0x157)]['site'],_0x5d8741=this[_0x2137c7(0x203)][_0x2137c7(0x22c)],_0x32edf6=_0x5a94ec!==_0x5d8741?_0x5a94ec:undefined,_0x39f263=this[_0x2137c7(0x1a7)](a133_0x3324d2[_0x2137c7(0x190)](_0x4ff6f7,_0x2137c7(0x1e7)),[]),_0x3da720=this[_0x2137c7(0x1a7)](a133_0x3324d2['join'](_0x4ff6f7,_0x2137c7(0x23c)),[]),_0x10f32c=this[_0x2137c7(0x1a7)](a133_0x3324d2[_0x2137c7(0x190)](_0x4ff6f7,_0x2137c7(0x1c0)),[]),_0xf08f69=this[_0x2137c7(0x1a7)](a133_0x3324d2['join'](_0x4ff6f7,_0x2137c7(0x201)),[]),_0x33aba3=_0x5cdf53?.[_0x2137c7(0x1ff)]||_0x8c576e[_0x2137c7(0x157)][_0x2137c7(0x18c)];if(_0x52295d){const _0x19580e=new Map(),_0x217d6d=[..._0x39f263],_0x1da737=_0x39f263[_0x2137c7(0x21c)]+0x1;let _0x196c7e=0x0;while(_0x217d6d[_0x2137c7(0x21c)]>0x0&&_0x196c7e<_0x1da737){_0x196c7e++;const _0x3f4cdd=[];for(const _0x4c4e7a of _0x217d6d){canCreateAgent(_0x4c4e7a,_0x19580e)?_0x19580e[_0x2137c7(0x1f8)](_0x4c4e7a['id'],'dry-run-'+_0x4c4e7a['id']):_0x3f4cdd[_0x2137c7(0x13f)](_0x4c4e7a);}if(_0x3f4cdd[_0x2137c7(0x21c)]===_0x217d6d[_0x2137c7(0x21c)])throw new SDKError(ErrorCode['INTERNAL'],_0x2137c7(0x1d8),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x217d6d[_0x2137c7(0x21c)]=0x0,_0x217d6d[_0x2137c7(0x13f)](..._0x3f4cdd);}const _0x4cfab0=_0x10f32c[_0x2137c7(0x20e)](_0x31ca8c=>_0x19580e[_0x2137c7(0x14f)](_0x31ca8c[_0x2137c7(0x19e)][_0x2137c7(0x236)]))['length'];return{'projectName':_0x33aba3,'projectId':_0x2137c7(0x144),'counts':{'agents':_0x39f263[_0x2137c7(0x21c)],'knowledgeBases':_0x3da720[_0x2137c7(0x21c)],'prompts':_0x4cfab0,'integrations':_0xf08f69['length']},'sourceSite':_0x32edf6};}const _0x24c543=await this['client'][_0x2137c7(0x18f)]({'name':_0x33aba3,'description':_0x8c576e[_0x2137c7(0x161)]['attributes'][_0x2137c7(0x176)]}),_0x328823=_0x24c543['id'],_0xbd2f46=new Map(),_0x5989ac=new Map(),_0x1087a9=new Map();for(const _0x79c693 of _0x3da720){const _0xed523e=await this[_0x2137c7(0x1c9)][_0x2137c7(0x1ed)]({'projectId':_0x328823,'name':_0x79c693[_0x2137c7(0x19e)][_0x2137c7(0x1ff)],'tdDatabaseName':_0x79c693[_0x2137c7(0x19e)][_0x2137c7(0x122)],'tables':_0x79c693[_0x2137c7(0x19e)][_0x2137c7(0x19b)]});_0xbd2f46[_0x2137c7(0x1f8)](_0x79c693['id'],_0xed523e['id']);}const _0x400a41=[..._0x39f263],_0x3e6f5a=_0x39f263['length']+0x1;let _0x594450=0x0;while(_0x400a41[_0x2137c7(0x21c)]>0x0&&_0x594450<_0x3e6f5a){_0x594450++;const _0x4de615=[];for(const _0x132db6 of _0x400a41){if(canCreateAgent(_0x132db6,_0x5989ac)){const _0x5b202d=remapToolIds(_0x132db6['attributes'][_0x2137c7(0x172)],_0xbd2f46,_0x5989ac),_0x1c0672=remapVariableIds(_0x132db6['attributes'][_0x2137c7(0x1bd)],_0xbd2f46),_0x5d4076=await this[_0x2137c7(0x1c9)][_0x2137c7(0x131)]({'name':_0x132db6[_0x2137c7(0x19e)][_0x2137c7(0x1ff)],'projectId':_0x328823,'systemPrompt':_0x132db6['attributes'][_0x2137c7(0x200)],'starterMessage':_0x132db6[_0x2137c7(0x19e)][_0x2137c7(0x1bc)],'modelType':migrateModelType(_0x132db6['attributes']['modelType']),'maxToolIterations':_0x132db6[_0x2137c7(0x19e)][_0x2137c7(0x154)],'temperature':_0x132db6[_0x2137c7(0x19e)][_0x2137c7(0x1b6)],'reasoningEffort':_0x132db6['attributes'][_0x2137c7(0x1b9)],'outputs':_0x132db6[_0x2137c7(0x19e)]['outputs'],'tools':_0x5b202d,'variables':_0x1c0672});_0x5989ac[_0x2137c7(0x1f8)](_0x132db6['id'],_0x5d4076['id']);}else _0x4de615[_0x2137c7(0x13f)](_0x132db6);}if(_0x4de615[_0x2137c7(0x21c)]===_0x400a41[_0x2137c7(0x21c)])throw new SDKError(ErrorCode[_0x2137c7(0x165)],_0x2137c7(0x1d8),undefined,{'helpText':_0x2137c7(0x143)});_0x400a41['length']=0x0,_0x400a41['push'](..._0x4de615);}for(const _0x4b0c4e of _0x10f32c){const _0x46de01=_0x5989ac[_0x2137c7(0x1d3)](_0x4b0c4e[_0x2137c7(0x19e)][_0x2137c7(0x236)]);if(!_0x46de01)continue;const _0xbc012a=await this['client']['createPrompt']({'projectId':_0x328823,'agentId':_0x46de01,'name':_0x4b0c4e[_0x2137c7(0x19e)]['name'],'systemPrompt':_0x4b0c4e['attributes'][_0x2137c7(0x200)],'template':_0x4b0c4e['attributes'][_0x2137c7(0x185)],'jsonSchemaHint':_0x4b0c4e[_0x2137c7(0x19e)][_0x2137c7(0x1df)]});_0x1087a9[_0x2137c7(0x1f8)](_0x4b0c4e['id'],_0xbc012a['id']);}for(const _0x153199 of _0xf08f69){const _0x5d52b4=_0x153199[_0x2137c7(0x19e)][_0x2137c7(0x14e)]['map'](_0x6e766d=>({..._0x6e766d,'promptId':_0x1087a9[_0x2137c7(0x1d3)](_0x6e766d[_0x2137c7(0x1ba)])||_0x6e766d[_0x2137c7(0x1ba)]}));await this[_0x2137c7(0x1c9)][_0x2137c7(0x12f)]({'projectId':_0x328823,'serviceType':_0x153199['attributes']['serviceType'],'actions':_0x5d52b4,'slackMessageMode':_0x153199[_0x2137c7(0x19e)][_0x2137c7(0x139)],'chatIgnoreManagedActions':_0x153199['attributes'][_0x2137c7(0x19c)],'chatWelcomeMessage':_0x153199[_0x2137c7(0x19e)]['chatWelcomeMessage'],'webhookCorsOrigins':_0x153199['attributes'][_0x2137c7(0x14d)]});}return{'projectName':_0x33aba3,'projectId':_0x328823,'counts':{'agents':_0x5989ac['size'],'knowledgeBases':_0xbd2f46[_0x2137c7(0x1be)],'prompts':_0x1087a9[_0x2137c7(0x1be)],'integrations':_0xf08f69[_0x2137c7(0x21c)]},'sourceSite':_0x32edf6};}[a133_0x4f6d4d(0x1a7)](_0x5aa06a,_0x55fac7){const _0x2d0b51=a133_0x4f6d4d;if(!a133_0x1b52fe[_0x2d0b51(0x1cb)](_0x5aa06a))return _0x55fac7;return JSON[_0x2d0b51(0x1c8)](a133_0x1b52fe[_0x2d0b51(0x1c6)](_0x5aa06a,'utf-8'));}[a133_0x4f6d4d(0x1bf)](_0x327551){const _0x1d2da9=a133_0x4f6d4d;if(!a133_0x1b52fe[_0x1d2da9(0x1cb)](_0x327551))throw new SDKError(ErrorCode[_0x1d2da9(0x210)],_0x1d2da9(0x235)+_0x327551,undefined,{'helpText':_0x1d2da9(0x1dd)});const _0x2ab74d=a133_0x3324d2['join'](_0x327551,_0x1d2da9(0x195));if(!a133_0x1b52fe[_0x1d2da9(0x1cb)](_0x2ab74d))throw new SDKError(ErrorCode[_0x1d2da9(0x1c1)],'Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20'+_0x327551,undefined,{'helpText':_0x1d2da9(0x134)});const _0x5894ea=JSON[_0x1d2da9(0x1c8)](a133_0x1b52fe[_0x1d2da9(0x1c6)](_0x2ab74d,'utf-8'));if(!isSupportedBackupVersion(_0x5894ea[_0x1d2da9(0x140)]))throw new SDKError(ErrorCode[_0x1d2da9(0x1c1)],_0x1d2da9(0x1a6)+_0x5894ea[_0x1d2da9(0x140)],undefined,{'helpText':_0x1d2da9(0x229)});return _0x5894ea;}async['pullProject'](_0x2b5da6,_0x6c3c26,_0x35e5b5){const _0x3e19fd=a133_0x4f6d4d,{projectId:_0x3bdc67,project:_0x1afa9a}=await this[_0x3e19fd(0x187)](_0x2b5da6),_0x15a6db=_0x1afa9a['attributes']['name'];let _0x134c08;if(_0x6c3c26)_0x134c08=_0x6c3c26;else{const _0xa8cc45=a133_0x3324d2[_0x3e19fd(0x190)](process[_0x3e19fd(0x182)](),'agents'),_0x3e1b58=getSanitizedPathWithMigration(_0xa8cc45,_0x15a6db);_0x3e1b58['renamed']&&this[_0x3e19fd(0x147)][_0x3e19fd(0x133)](_0x3e19fd(0x1f3)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x3e1b58['oldPath'])+_0x3e19fd(0x12d)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x3e1b58[_0x3e19fd(0x174)])),_0x134c08=_0x3e1b58['path'];}const _0x3ae368=await this[_0x3e19fd(0x1c9)][_0x3e19fd(0x13b)](_0x3bdc67),_0xa95b82=await this['client']['listKnowledgeBases'](_0x3bdc67),_0x5b23de=await this[_0x3e19fd(0x1c9)][_0x3e19fd(0x231)](_0x3bdc67),_0x69e56e=await safeListOrEmpty(()=>this[_0x3e19fd(0x1c9)]['listImageGenerators'](_0x3bdc67)),_0x380e59=await safeListOrEmpty(()=>this['client'][_0x3e19fd(0x124)](_0x3bdc67)),_0x135e4e=await this[_0x3e19fd(0x1c9)][_0x3e19fd(0x158)](_0x3bdc67),_0x4bd04d=await this[_0x3e19fd(0x1c9)][_0x3e19fd(0x1d1)](_0x3bdc67),_0x3d4d22=await safeListOrEmpty(()=>this[_0x3e19fd(0x1c9)][_0x3e19fd(0x1fd)](_0x3bdc67)),_0x3b7bde=await safeListOrEmpty(()=>this[_0x3e19fd(0x1c9)][_0x3e19fd(0x23b)](_0x3bdc67)),_0x5d756e=await safeListOrEmpty(()=>this[_0x3e19fd(0x1c9)][_0x3e19fd(0x17d)](_0x3bdc67)),_0x14fee6=await safeListOrEmpty(()=>this['client']['listChatInterfaces'](_0x3bdc67)),_0x24d0ca=_0x4bd04d['filter'](_0x366d86=>!_0x366d86[_0x3e19fd(0x19e)][_0x3e19fd(0x1f7)]&&SAFE_INTEGRATION_TYPES[_0x3e19fd(0x17f)](_0x366d86[_0x3e19fd(0x19e)][_0x3e19fd(0x1ae)][_0x3e19fd(0x1d6)]())),_0x1db08c=new Map(),_0x340f90=new Map(),_0x2eb0a6=new Map(),_0x46dc91=new Map(),_0x20e2f7=new Map(),_0x52ce9f=new Map(),_0x209021=new Map();for(const _0x293294 of _0x3ae368){_0x1db08c['set'](_0x293294['id'],_0x293294[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)]);}for(const _0x18dfea of _0xa95b82){_0x340f90[_0x3e19fd(0x1f8)](_0x18dfea['id'],_0x18dfea[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)]);}for(const _0x2363ff of _0x5b23de){_0x2eb0a6[_0x3e19fd(0x1f8)](_0x2363ff['id'],_0x2363ff[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)]);}for(const _0x2e9682 of _0x69e56e){_0x46dc91['set'](_0x2e9682['id'],_0x2e9682['attributes'][_0x3e19fd(0x1ff)]);}for(const _0x2b3c55 of _0x380e59){_0x20e2f7[_0x3e19fd(0x1f8)](_0x2b3c55['id'],_0x2b3c55[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)]);}for(const _0x27a7e3 of _0x135e4e){_0x52ce9f[_0x3e19fd(0x1f8)](_0x27a7e3['id'],_0x27a7e3[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)]);}for(const _0x3e2550 of _0x3d4d22){_0x209021[_0x3e19fd(0x1f8)](_0x3e2550['id'],_0x3e2550['attributes']['name']);}const _0x3f648d={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x340f90,'TextKnowledgeBase':_0x2eb0a6,'Agent':_0x1db08c,'WebSearchTool':_0x20e2f7,'ImageGenerator':_0x46dc91,'ExperimentalKnowledgeBase':_0x209021}),'resolvePromptName':async _0x5bc8d0=>_0x52ce9f[_0x3e19fd(0x1d3)](_0x5bc8d0),'onWarning':_0x430275=>this[_0x3e19fd(0x147)][_0x3e19fd(0x206)](_0x430275)},_0x108d28={'projectName':_0x15a6db,'outputDir':_0x134c08,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'knowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'textKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'prompts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'integrations':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalArtifacts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'formInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'chatInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0x5d7259=[],_0x36104c=[];for(const _0x1a09d7 of _0x3ae368){const _0x362666=getSanitizedPathWithMigration(_0x134c08,_0x1a09d7[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)]);_0x362666[_0x3e19fd(0x175)]&&this[_0x3e19fd(0x147)][_0x3e19fd(0x133)](_0x3e19fd(0x117)+a133_0x3324d2['basename'](_0x362666[_0x3e19fd(0x22f)])+_0x3e19fd(0x12d)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x362666[_0x3e19fd(0x174)]));const _0x3e09d8=_0x362666[_0x3e19fd(0x174)],_0x1cf1cd=a133_0x3324d2[_0x3e19fd(0x190)](_0x3e09d8,'prompt.md'),_0x565c0c=a133_0x3324d2[_0x3e19fd(0x190)](_0x3e09d8,_0x3e19fd(0x120)),_0x1b2c0a=a133_0x3324d2['join'](_0x3e09d8,'starter_message.md'),{yaml:_0x37a55d,systemPrompt:_0x15bca8,starterMessage:_0x381815}=await agentResponseToDef(_0x1a09d7,_0x3f648d),_0x31be85=toAgentYamlString(_0x37a55d),_0x544bc8=!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x565c0c);let _0x469820=_0x544bc8,_0x3d786f;if(!_0x544bc8){const _0x32227a=a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x1cf1cd)?a133_0x1b52fe['readFileSync'](_0x1cf1cd,_0x3e19fd(0x238)):'',_0x293947=a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x565c0c,_0x3e19fd(0x238)),_0x213141=_0x3e19fd(0x223)+_0x32227a+'\x0a\x0a#\x20agent.yml\x0a'+_0x293947,_0x3efe5b=_0x3e19fd(0x223)+_0x15bca8+_0x3e19fd(0x169)+_0x31be85,_0x38a425=generateDiff(_0x213141,_0x3efe5b);_0x469820=hasChanges(_0x38a425),_0x469820&&(_0x3d786f=formatDiffWithColors(_0x38a425));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x3e09d8,'content':'','isDir':!![]}),_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x1cf1cd,'content':_0x15bca8}),_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x565c0c,'content':_0x31be85});_0x381815&&_0x381815['includes']('\x0a')&&_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x1b2c0a,'content':_0x381815});_0x108d28[_0x3e19fd(0x1c3)][_0x3e19fd(0x13f)]({'agentName':_0x1a09d7[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'outputPath':_0x3e09d8,'isNew':_0x544bc8,'hasChanges':_0x469820,'diff':_0x3d786f}),_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1c3)][_0x3e19fd(0x168)]++;if(_0x544bc8)_0x108d28[_0x3e19fd(0x20a)]['agents']['new']++;else{if(_0x469820)_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1c3)][_0x3e19fd(0x233)]++;else _0x108d28['counts']['agents'][_0x3e19fd(0x19a)]++;}}for(const _0x22c03e of _0xa95b82){if(_0x22c03e[_0x3e19fd(0x19e)][_0x3e19fd(0x1f7)])continue;const _0x558241=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x134c08),_0x22c03e[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],_0x3e19fd(0x1eb));_0x558241[_0x3e19fd(0x175)]&&this['logger'][_0x3e19fd(0x133)]('Renamed\x20KB\x20file:\x20'+a133_0x3324d2[_0x3e19fd(0x20c)](_0x558241['oldPath'])+'\x20→\x20'+a133_0x3324d2[_0x3e19fd(0x20c)](_0x558241[_0x3e19fd(0x174)]));const _0x25e8f1=_0x558241[_0x3e19fd(0x174)],_0x276b67=apiKnowledgeBaseToYaml(_0x22c03e),_0x3c849a=toKnowledgeBaseYamlString(_0x276b67),_0x347746=!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x25e8f1);let _0x27ff7c=_0x347746,_0x145281;if(!_0x347746){const _0x4a4707=a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x25e8f1,'utf-8'),_0x1cdfee=generateDiff(_0x4a4707,_0x3c849a);_0x27ff7c=hasChanges(_0x1cdfee),_0x27ff7c&&(_0x145281=formatDiffWithColors(_0x1cdfee));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x25e8f1,'content':_0x3c849a}),_0x108d28[_0x3e19fd(0x1d0)][_0x3e19fd(0x13f)]({'name':_0x22c03e[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'outputPath':_0x25e8f1,'isNew':_0x347746,'hasChanges':_0x27ff7c,'diff':_0x145281}),_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1d0)][_0x3e19fd(0x168)]++;if(_0x347746)_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1d0)][_0x3e19fd(0x1b3)]++;else{if(_0x27ff7c)_0x108d28['counts'][_0x3e19fd(0x1d0)][_0x3e19fd(0x233)]++;else _0x108d28[_0x3e19fd(0x20a)]['knowledgeBases'][_0x3e19fd(0x19a)]++;}}for(const _0x48d140 of _0x5b23de){if(_0x48d140['attributes']['isManaged'])continue;const _0x5cd432=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x134c08),_0x48d140[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],_0x3e19fd(0x150));_0x5cd432[_0x3e19fd(0x175)]&&this[_0x3e19fd(0x147)][_0x3e19fd(0x133)](_0x3e19fd(0x1d7)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x5cd432[_0x3e19fd(0x22f)])+_0x3e19fd(0x12d)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x5cd432[_0x3e19fd(0x174)]));const _0x59ca3a=_0x5cd432[_0x3e19fd(0x174)],_0x11979d=toTextKnowledgeBaseMd(_0x48d140[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],_0x48d140['attributes'][_0x3e19fd(0x21a)]),_0x4da1a7=!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x59ca3a);let _0x1fba90=_0x4da1a7,_0x3ce130;if(!_0x4da1a7){const _0x4cea46=a133_0x1b52fe['readFileSync'](_0x59ca3a,_0x3e19fd(0x238)),_0x291bc9=generateDiff(_0x4cea46,_0x11979d);_0x1fba90=hasChanges(_0x291bc9),_0x1fba90&&(_0x3ce130=formatDiffWithColors(_0x291bc9));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x59ca3a,'content':_0x11979d}),_0x108d28[_0x3e19fd(0x23a)]['push']({'name':_0x48d140[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'outputPath':_0x59ca3a,'isNew':_0x4da1a7,'hasChanges':_0x1fba90,'diff':_0x3ce130}),_0x108d28['counts']['textKnowledgeBases'][_0x3e19fd(0x168)]++;if(_0x4da1a7)_0x108d28['counts'][_0x3e19fd(0x23a)]['new']++;else{if(_0x1fba90)_0x108d28['counts']['textKnowledgeBases'][_0x3e19fd(0x233)]++;else _0x108d28['counts'][_0x3e19fd(0x23a)]['unchanged']++;}}for(const _0x36d1df of _0x135e4e){if(_0x36d1df[_0x3e19fd(0x19e)]['isManaged'])continue;const _0x391acc=getSanitizedPathWithMigration(getPromptsDir(_0x134c08),_0x36d1df[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'.yml');_0x391acc[_0x3e19fd(0x175)]&&this[_0x3e19fd(0x147)][_0x3e19fd(0x133)](_0x3e19fd(0x232)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x391acc[_0x3e19fd(0x22f)])+_0x3e19fd(0x12d)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x391acc[_0x3e19fd(0x174)]));const _0x389d3a=_0x391acc[_0x3e19fd(0x174)],_0x68988c=await apiPromptToYaml(_0x36d1df,_0x3f648d);if(!_0x68988c)continue;const _0xafc415=toPromptYamlString(_0x68988c),_0x25dc05=!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x389d3a);let _0x1cf562=_0x25dc05,_0x5469ff;if(!_0x25dc05){const _0x1f6002=a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x389d3a,_0x3e19fd(0x238)),_0x51fdc1=generateDiff(_0x1f6002,_0xafc415);_0x1cf562=hasChanges(_0x51fdc1),_0x1cf562&&(_0x5469ff=formatDiffWithColors(_0x51fdc1));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x389d3a,'content':_0xafc415}),_0x108d28[_0x3e19fd(0x1ad)][_0x3e19fd(0x13f)]({'name':_0x36d1df[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'outputPath':_0x389d3a,'isNew':_0x25dc05,'hasChanges':_0x1cf562,'diff':_0x5469ff}),_0x108d28['counts'][_0x3e19fd(0x1ad)]['total']++;if(_0x25dc05)_0x108d28['counts'][_0x3e19fd(0x1ad)][_0x3e19fd(0x1b3)]++;else{if(_0x1cf562)_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1ad)][_0x3e19fd(0x233)]++;else _0x108d28['counts'][_0x3e19fd(0x1ad)]['unchanged']++;}}for(const _0x2da128 of _0x24d0ca){const _0x45e964=_0x2da128[_0x3e19fd(0x19e)][_0x3e19fd(0x1ae)]['toLowerCase'](),_0x48c884=getSanitizedPathWithMigration(getIntegrationsDir(_0x134c08),_0x45e964,'.yml');_0x48c884[_0x3e19fd(0x175)]&&this[_0x3e19fd(0x147)][_0x3e19fd(0x133)](_0x3e19fd(0x1aa)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x48c884[_0x3e19fd(0x22f)])+_0x3e19fd(0x12d)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x48c884[_0x3e19fd(0x174)]));const _0x2a67c8=_0x48c884[_0x3e19fd(0x174)],_0x294c18=await apiIntegrationToYaml(_0x2da128,_0x3f648d),_0x61d21a=toIntegrationYamlString(_0x294c18),_0x35ecfa=!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x2a67c8);let _0x157b7e=_0x35ecfa,_0x58620d;if(!_0x35ecfa){const _0x499f9b=a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x2a67c8,_0x3e19fd(0x238)),_0x298d69=generateDiff(_0x499f9b,_0x61d21a);_0x157b7e=hasChanges(_0x298d69),_0x157b7e&&(_0x58620d=formatDiffWithColors(_0x298d69));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x2a67c8,'content':_0x61d21a}),_0x108d28[_0x3e19fd(0x17c)]['push']({'name':_0x45e964,'outputPath':_0x2a67c8,'isNew':_0x35ecfa,'hasChanges':_0x157b7e,'diff':_0x58620d}),_0x108d28['counts'][_0x3e19fd(0x17c)]['total']++;if(_0x35ecfa)_0x108d28[_0x3e19fd(0x20a)]['integrations'][_0x3e19fd(0x1b3)]++;else{if(_0x157b7e)_0x108d28['counts'][_0x3e19fd(0x17c)][_0x3e19fd(0x233)]++;else _0x108d28[_0x3e19fd(0x20a)]['integrations'][_0x3e19fd(0x19a)]++;}}for(const _0x5dc5c5 of _0x3d4d22){if(_0x5dc5c5[_0x3e19fd(0x19e)]['isManaged'])continue;const _0x1f41c2=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x134c08),_0x5dc5c5[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)]);_0x1f41c2[_0x3e19fd(0x175)]&&this[_0x3e19fd(0x147)][_0x3e19fd(0x133)](_0x3e19fd(0x20d)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x1f41c2[_0x3e19fd(0x22f)])+_0x3e19fd(0x12d)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x1f41c2[_0x3e19fd(0x174)]));const _0x304784=_0x1f41c2['path'],_0x5d3fcb=a133_0x3324d2['join'](_0x304784,sanitizeForFilesystem(_0x5dc5c5[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)])+_0x3e19fd(0x1eb)),_0x189fc1=a133_0x3324d2['join'](_0x304784,_0x3e19fd(0x17a)),_0x1f3906=apiExperimentalKnowledgeBaseToYaml(_0x5dc5c5),_0x4f633b=toExperimentalKnowledgeBaseYamlString(_0x1f3906),_0x5acdc9=!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x304784);let _0x3539aa=_0x5acdc9,_0x284f3d,_0x40569b=_0x4f633b;const _0x544090=[..._0x1f3906['functions']][_0x3e19fd(0x215)]((_0x33817,_0x3caf8b)=>_0x33817[_0x3e19fd(0x1ff)][_0x3e19fd(0x129)](_0x3caf8b[_0x3e19fd(0x1ff)]));for(const _0x5a68ce of _0x544090){_0x40569b+=_0x3e19fd(0x17b)+_0x5a68ce[_0x3e19fd(0x1ff)]+_0x3e19fd(0x1a8)+_0x5a68ce[_0x3e19fd(0x16b)]+_0x3e19fd(0x142)+_0x5a68ce[_0x3e19fd(0x1ff)]+_0x3e19fd(0x1a8)+_0x5a68ce[_0x3e19fd(0x1fb)]+'\x0a';}if(!_0x5acdc9){let _0x428867='';a133_0x1b52fe['existsSync'](_0x5d3fcb)&&(_0x428867=a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x5d3fcb,_0x3e19fd(0x238)));if(a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x189fc1)){const _0x1e5be9=a133_0x1b52fe[_0x3e19fd(0x164)](_0x189fc1,{'withFileTypes':!![]}),_0x31a00f=_0x1e5be9[_0x3e19fd(0x20e)](_0x517220=>_0x517220[_0x3e19fd(0x16c)]())[_0x3e19fd(0x215)]((_0x4b4596,_0x6ce7b)=>_0x4b4596[_0x3e19fd(0x1ff)]['localeCompare'](_0x6ce7b[_0x3e19fd(0x1ff)]));for(const _0x5d9b5c of _0x31a00f){const _0x3c04b7=a133_0x3324d2[_0x3e19fd(0x190)](_0x189fc1,_0x5d9b5c['name'],_0x3e19fd(0x1db)),_0x315c11=a133_0x3324d2[_0x3e19fd(0x190)](_0x189fc1,_0x5d9b5c[_0x3e19fd(0x1ff)],_0x3e19fd(0x216));a133_0x1b52fe['existsSync'](_0x3c04b7)&&(_0x428867+=_0x3e19fd(0x17b)+_0x5d9b5c[_0x3e19fd(0x1ff)]+_0x3e19fd(0x1a8)+a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x3c04b7,_0x3e19fd(0x238))+'\x0a'),a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x315c11)&&(_0x428867+=_0x3e19fd(0x198)+_0x5d9b5c[_0x3e19fd(0x1ff)]+_0x3e19fd(0x1a8)+a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x315c11,_0x3e19fd(0x238))+'\x0a');}}const _0x34a0c5=generateDiff(_0x428867,_0x40569b);_0x3539aa=hasChanges(_0x34a0c5),_0x3539aa&&(_0x284f3d=formatDiffWithColors(_0x34a0c5));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x304784,'content':'','isDir':!![]}),_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x5d3fcb,'content':_0x4f633b}),_0x5d7259['push']({'path':_0x189fc1,'content':'','isDir':!![]});for(const _0x40df31 of _0x1f3906['functions']){const _0x51f047=a133_0x3324d2['join'](_0x189fc1,sanitizeForFilesystem(_0x40df31[_0x3e19fd(0x1ff)])),_0x445b25=a133_0x3324d2[_0x3e19fd(0x190)](_0x51f047,_0x3e19fd(0x1db)),_0x3f70be=a133_0x3324d2[_0x3e19fd(0x190)](_0x51f047,_0x3e19fd(0x216));_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x51f047,'content':'','isDir':!![]}),_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x445b25,'content':_0x40df31[_0x3e19fd(0x16b)]}),_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x3f70be,'content':_0x40df31[_0x3e19fd(0x1fb)]});}if(a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x189fc1)){const _0x2b577a=a133_0x1b52fe[_0x3e19fd(0x164)](_0x189fc1,{'withFileTypes':!![]}),_0x1c466d=new Set(_0x1f3906[_0x3e19fd(0x17a)][_0x3e19fd(0x1a3)](_0x1aac02=>sanitizeForFilesystem(_0x1aac02['name'])));for(const _0x2109d4 of _0x2b577a){if(_0x2109d4[_0x3e19fd(0x16c)]()&&!_0x1c466d['has'](_0x2109d4[_0x3e19fd(0x1ff)])){const _0x5a9606=a133_0x3324d2[_0x3e19fd(0x190)](_0x189fc1,_0x2109d4[_0x3e19fd(0x1ff)]);_0x36104c[_0x3e19fd(0x13f)]({'path':_0x5a9606,'isDir':!![]});}}}_0x108d28[_0x3e19fd(0x192)][_0x3e19fd(0x13f)]({'name':_0x5dc5c5[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'outputPath':_0x304784,'isNew':_0x5acdc9,'hasChanges':_0x3539aa,'diff':_0x284f3d}),_0x108d28['counts'][_0x3e19fd(0x192)][_0x3e19fd(0x168)]++;if(_0x5acdc9)_0x108d28['counts'][_0x3e19fd(0x192)][_0x3e19fd(0x1b3)]++;else{if(_0x3539aa)_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x192)][_0x3e19fd(0x233)]++;else _0x108d28[_0x3e19fd(0x20a)]['experimentalKnowledgeBases'][_0x3e19fd(0x19a)]++;}}for(const _0x48895c of _0x3b7bde){if(_0x48895c[_0x3e19fd(0x19e)][_0x3e19fd(0x1f7)])continue;const _0x5e17ab=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x134c08),_0x48895c['attributes'][_0x3e19fd(0x1ff)]);_0x5e17ab[_0x3e19fd(0x175)]&&this[_0x3e19fd(0x147)][_0x3e19fd(0x133)](_0x3e19fd(0x1c4)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x5e17ab['oldPath'])+'\x20→\x20'+a133_0x3324d2['basename'](_0x5e17ab[_0x3e19fd(0x174)]));const _0x183d71=_0x5e17ab[_0x3e19fd(0x174)],_0x58f330=a133_0x3324d2[_0x3e19fd(0x190)](_0x183d71,sanitizeForFilesystem(_0x48895c['attributes'][_0x3e19fd(0x1ff)])+_0x3e19fd(0x1eb)),_0x33fa81=a133_0x3324d2['join'](_0x183d71,'code.js'),_0x185ef3=a133_0x3324d2[_0x3e19fd(0x190)](_0x183d71,_0x3e19fd(0x11e)),_0x410211=apiExperimentalArtifactToYaml(_0x48895c),_0x393a94=toExperimentalArtifactYamlString(_0x410211),_0x5f00fe=!a133_0x1b52fe['existsSync'](_0x183d71);let _0x95479b=_0x5f00fe,_0x3f7647,_0x155397=_0x393a94+(_0x3e19fd(0x1a5)+_0x410211[_0x3e19fd(0x16b)]+'\x0a');const _0x51e7f3=[..._0x410211[_0x3e19fd(0x11e)]][_0x3e19fd(0x215)]((_0x531e86,_0x1086d0)=>_0x531e86[_0x3e19fd(0x16d)]['localeCompare'](_0x1086d0[_0x3e19fd(0x16d)]));for(const _0x49aac0 of _0x51e7f3){_0x155397+='---\x20file:\x20'+_0x49aac0[_0x3e19fd(0x16d)]+_0x3e19fd(0x1a8)+_0x49aac0[_0x3e19fd(0x230)]+'\x0a';}if(!_0x5f00fe){let _0x5d3873='';a133_0x1b52fe['existsSync'](_0x58f330)&&(_0x5d3873=a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x58f330,'utf-8'));a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x33fa81)&&(_0x5d3873+=_0x3e19fd(0x1a5)+a133_0x1b52fe['readFileSync'](_0x33fa81,_0x3e19fd(0x238))+'\x0a');if(a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x185ef3)){const _0x249eda=a133_0x1b52fe[_0x3e19fd(0x164)](_0x185ef3),_0x3dd6e2=_0x249eda[_0x3e19fd(0x20e)](_0xb0c780=>{const _0xfdf91a=_0x3e19fd,_0x5567b8=a133_0x3324d2['join'](_0x185ef3,_0xb0c780);return a133_0x1b52fe[_0xfdf91a(0x1b5)](_0x5567b8)[_0xfdf91a(0x167)]();})[_0x3e19fd(0x215)]((_0x54acc4,_0x234d74)=>_0x54acc4[_0x3e19fd(0x129)](_0x234d74));for(const _0x10b98d of _0x3dd6e2){const _0x452108=a133_0x3324d2[_0x3e19fd(0x190)](_0x185ef3,_0x10b98d);_0x5d3873+=_0x3e19fd(0x162)+_0x10b98d+_0x3e19fd(0x1a8)+a133_0x1b52fe['readFileSync'](_0x452108,'utf-8')+'\x0a';}}const _0x588b0f=generateDiff(_0x5d3873,_0x155397);_0x95479b=hasChanges(_0x588b0f),_0x95479b&&(_0x3f7647=formatDiffWithColors(_0x588b0f));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x183d71,'content':'','isDir':!![]}),_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x58f330,'content':_0x393a94}),_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x33fa81,'content':_0x410211[_0x3e19fd(0x16b)]});if(_0x410211['files']['length']>0x0){_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x185ef3,'content':'','isDir':!![]});for(const _0x204066 of _0x410211[_0x3e19fd(0x11e)]){const _0x587e60=a133_0x3324d2[_0x3e19fd(0x190)](_0x185ef3,_0x204066[_0x3e19fd(0x16d)]);_0x5d7259['push']({'path':_0x587e60,'content':_0x204066[_0x3e19fd(0x230)]});}}if(a133_0x1b52fe['existsSync'](_0x185ef3)){const _0x2312cc=a133_0x1b52fe['readdirSync'](_0x185ef3),_0x27d2ef=new Set(_0x410211[_0x3e19fd(0x11e)][_0x3e19fd(0x1a3)](_0x423d88=>_0x423d88[_0x3e19fd(0x16d)]));for(const _0x123e33 of _0x2312cc){const _0x2fe51e=a133_0x3324d2['join'](_0x185ef3,_0x123e33);a133_0x1b52fe[_0x3e19fd(0x1b5)](_0x2fe51e)['isFile']()&&!_0x27d2ef[_0x3e19fd(0x14f)](_0x123e33)&&_0x36104c[_0x3e19fd(0x13f)]({'path':_0x2fe51e});}}_0x108d28[_0x3e19fd(0x1f9)][_0x3e19fd(0x13f)]({'name':_0x48895c[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'outputPath':_0x183d71,'isNew':_0x5f00fe,'hasChanges':_0x95479b,'diff':_0x3f7647}),_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1f9)][_0x3e19fd(0x168)]++;if(_0x5f00fe)_0x108d28['counts'][_0x3e19fd(0x1f9)][_0x3e19fd(0x1b3)]++;else{if(_0x95479b)_0x108d28['counts'][_0x3e19fd(0x1f9)][_0x3e19fd(0x233)]++;else _0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1f9)][_0x3e19fd(0x19a)]++;}}for(const _0x162122 of _0x5d756e){const _0x469064=getSanitizedPathWithMigration(getFormInterfacesDir(_0x134c08),_0x162122[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],_0x3e19fd(0x1eb));_0x469064[_0x3e19fd(0x175)]&&this[_0x3e19fd(0x147)][_0x3e19fd(0x133)](_0x3e19fd(0x160)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x469064[_0x3e19fd(0x22f)])+_0x3e19fd(0x12d)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x469064[_0x3e19fd(0x174)]));const _0x5a5410=_0x469064[_0x3e19fd(0x174)],_0xf9f9bc=await apiFormInterfaceToYaml(_0x162122,_0x3f648d),_0x446b14=toFormInterfaceYamlString(_0xf9f9bc),_0x46b4e8=!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x5a5410);let _0x396661=_0x46b4e8,_0x1ff93e;if(!_0x46b4e8){const _0x1aa144=a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x5a5410,_0x3e19fd(0x238)),_0x4e3d35=generateDiff(_0x1aa144,_0x446b14);_0x396661=hasChanges(_0x4e3d35),_0x396661&&(_0x1ff93e=formatDiffWithColors(_0x4e3d35));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x5a5410,'content':_0x446b14}),_0x108d28[_0x3e19fd(0x1dc)][_0x3e19fd(0x13f)]({'name':_0x162122[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'outputPath':_0x5a5410,'isNew':_0x46b4e8,'hasChanges':_0x396661,'diff':_0x1ff93e}),_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1dc)]['total']++;if(_0x46b4e8)_0x108d28['counts'][_0x3e19fd(0x1dc)][_0x3e19fd(0x1b3)]++;else{if(_0x396661)_0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1dc)]['updated']++;else _0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1dc)][_0x3e19fd(0x19a)]++;}}for(const _0x54be0b of _0x14fee6){if(_0x54be0b['attributes'][_0x3e19fd(0x1f7)])continue;const _0x3dfb78=getSanitizedPathWithMigration(getChatInterfacesDir(_0x134c08),_0x54be0b[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],_0x3e19fd(0x1eb));_0x3dfb78[_0x3e19fd(0x175)]&&this[_0x3e19fd(0x147)]['info'](_0x3e19fd(0x138)+a133_0x3324d2[_0x3e19fd(0x20c)](_0x3dfb78[_0x3e19fd(0x22f)])+_0x3e19fd(0x12d)+a133_0x3324d2['basename'](_0x3dfb78['path']));const _0x39a758=_0x3dfb78[_0x3e19fd(0x174)],_0xa44f90=await apiChatInterfaceToYaml(_0x54be0b,_0x3f648d),_0x4a6ec4=toChatInterfaceYamlString(_0xa44f90),_0x2eb16a=!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x39a758);let _0x2bc44e=_0x2eb16a,_0x306f3d;if(!_0x2eb16a){const _0x5d4ffe=a133_0x1b52fe[_0x3e19fd(0x1c6)](_0x39a758,'utf-8'),_0x27e9e7=generateDiff(_0x5d4ffe,_0x4a6ec4);_0x2bc44e=hasChanges(_0x27e9e7),_0x2bc44e&&(_0x306f3d=formatDiffWithColors(_0x27e9e7));}_0x5d7259[_0x3e19fd(0x13f)]({'path':_0x39a758,'content':_0x4a6ec4}),_0x108d28['chatInterfaces'][_0x3e19fd(0x13f)]({'name':_0x54be0b[_0x3e19fd(0x19e)][_0x3e19fd(0x1ff)],'outputPath':_0x39a758,'isNew':_0x2eb16a,'hasChanges':_0x2bc44e,'diff':_0x306f3d}),_0x108d28[_0x3e19fd(0x20a)]['chatInterfaces']['total']++;if(_0x2eb16a)_0x108d28['counts']['chatInterfaces'][_0x3e19fd(0x1b3)]++;else{if(_0x2bc44e)_0x108d28[_0x3e19fd(0x20a)]['chatInterfaces'][_0x3e19fd(0x233)]++;else _0x108d28[_0x3e19fd(0x20a)][_0x3e19fd(0x1e4)][_0x3e19fd(0x19a)]++;}}if(_0x35e5b5?.['dryRun'])return _0x108d28;a133_0x1b52fe[_0x3e19fd(0x121)](_0x134c08,{'recursive':!![]}),a133_0x1b52fe[_0x3e19fd(0x121)](getKnowledgeBasesDir(_0x134c08),{'recursive':!![]}),a133_0x1b52fe[_0x3e19fd(0x121)](getPromptsDir(_0x134c08),{'recursive':!![]}),a133_0x1b52fe[_0x3e19fd(0x121)](getIntegrationsDir(_0x134c08),{'recursive':!![]}),a133_0x1b52fe[_0x3e19fd(0x121)](getExperimentalKnowledgeBasesDir(_0x134c08),{'recursive':!![]}),a133_0x1b52fe['mkdirSync'](getExperimentalArtifactsDir(_0x134c08),{'recursive':!![]}),a133_0x1b52fe[_0x3e19fd(0x121)](getFormInterfacesDir(_0x134c08),{'recursive':!![]}),a133_0x1b52fe[_0x3e19fd(0x121)](getChatInterfacesDir(_0x134c08),{'recursive':!![]});const _0x43dc16=a133_0x3324d2[_0x3e19fd(0x190)](_0x134c08,'tdx.json');a133_0x1b52fe[_0x3e19fd(0x207)](_0x43dc16,createAgentConfigContent(_0x15a6db));for(const _0x3fb72d of _0x5d7259){if(_0x3fb72d[_0x3e19fd(0x15b)])a133_0x1b52fe[_0x3e19fd(0x121)](_0x3fb72d[_0x3e19fd(0x174)],{'recursive':!![]});else{const _0x16e3fb=a133_0x3324d2[_0x3e19fd(0x1d5)](_0x3fb72d[_0x3e19fd(0x174)]);!a133_0x1b52fe[_0x3e19fd(0x1cb)](_0x16e3fb)&&a133_0x1b52fe[_0x3e19fd(0x121)](_0x16e3fb,{'recursive':!![]}),a133_0x1b52fe[_0x3e19fd(0x207)](_0x3fb72d[_0x3e19fd(0x174)],_0x3fb72d[_0x3e19fd(0x225)]);}}for(const _0x56444b of _0x36104c){_0x56444b[_0x3e19fd(0x15b)]?(a133_0x1b52fe[_0x3e19fd(0x163)](_0x56444b[_0x3e19fd(0x174)],{'recursive':!![],'force':!![]}),this[_0x3e19fd(0x147)][_0x3e19fd(0x133)]('Removed\x20deleted\x20directory:\x20'+a133_0x3324d2[_0x3e19fd(0x20c)](a133_0x3324d2[_0x3e19fd(0x1d5)](_0x56444b[_0x3e19fd(0x174)]))+'/'+a133_0x3324d2['basename'](_0x56444b[_0x3e19fd(0x174)]))):(a133_0x1b52fe[_0x3e19fd(0x163)](_0x56444b['path'],{'force':!![]}),this['logger'][_0x3e19fd(0x133)]('Removed\x20deleted\x20file:\x20'+a133_0x3324d2[_0x3e19fd(0x20c)](a133_0x3324d2[_0x3e19fd(0x1d5)](_0x56444b[_0x3e19fd(0x174)]))+'/'+a133_0x3324d2[_0x3e19fd(0x20c)](_0x56444b['path'])));}return _0x108d28;}async[a133_0x4f6d4d(0x14c)](_0xcdbcc3,_0x4b166b){const _0x31f468=a133_0x4f6d4d,_0x5a362e=a133_0x3324d2['join'](_0xcdbcc3,_0x31f468(0x17e));if(!a133_0x1b52fe['existsSync'](_0x5a362e))throw new SDKError(ErrorCode[_0x31f468(0x1c1)],'No\x20tdx.json\x20found\x20in\x20'+_0xcdbcc3,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x3e4021=loadAgentConfig(_0x5a362e),_0x519efd=await this[_0x31f468(0x197)](_0x3e4021[_0x31f468(0x1b4)]),_0x2552eb=await this[_0x31f468(0x1c9)]['getProject'](_0x519efd),_0x5d1366=_0x2552eb[_0x31f468(0x19e)][_0x31f468(0x1ff)],_0xdd789a={'projectName':_0x5d1366,'projectId':_0x519efd,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x2d3438=[],_0x3dbd24=[],_0x1ac634=[],_0x5a1eca=[],_0x383c8b=[],_0xa4637c=[],_0x458b71=a133_0x1b52fe[_0x31f468(0x164)](_0xcdbcc3,{'withFileTypes':!![]});for(const _0x2520bd of _0x458b71){if(!_0x2520bd[_0x31f468(0x16c)]())continue;if([_0x31f468(0x126),_0x31f468(0x1ad),_0x31f468(0x17c),_0x31f468(0x1ee),_0x31f468(0x21d),'form_interfaces',_0x31f468(0x148)][_0x31f468(0x17f)](_0x2520bd['name']))continue;const _0x2a3a97=a133_0x3324d2['join'](_0xcdbcc3,_0x2520bd[_0x31f468(0x1ff)]);if(isAgentDir(_0x2a3a97)){const _0x433157=a133_0x3324d2[_0x31f468(0x190)](_0x2a3a97,_0x31f468(0x120)),_0x50f442=a133_0x3324d2[_0x31f468(0x190)](_0x2a3a97,_0x31f468(0x13a)),_0x982e29=a133_0x3324d2[_0x31f468(0x190)](_0x2a3a97,_0x31f468(0x194)),_0x43548f=parseAgentYaml(a133_0x1b52fe['readFileSync'](_0x433157,_0x31f468(0x238)),_0x433157),_0x7be0bc=a133_0x1b52fe[_0x31f468(0x1cb)](_0x50f442)?a133_0x1b52fe[_0x31f468(0x1c6)](_0x50f442,_0x31f468(0x238)):'',_0x25f119=a133_0x1b52fe[_0x31f468(0x1cb)](_0x982e29)?a133_0x1b52fe[_0x31f468(0x1c6)](_0x982e29,'utf-8'):_0x43548f[_0x31f468(0x20b)];_0x2d3438[_0x31f468(0x13f)]({'name':_0x43548f[_0x31f468(0x1ff)],'dir':_0x2a3a97,'yaml':_0x43548f,'systemPrompt':_0x7be0bc,'starterMessage':_0x25f119});}}const _0x2df3d1=getKnowledgeBasesDir(_0xcdbcc3);if(a133_0x1b52fe[_0x31f468(0x1cb)](_0x2df3d1)){const _0x2eb8f3=a133_0x1b52fe[_0x31f468(0x164)](_0x2df3d1);for(const _0x4f0251 of _0x2eb8f3){const _0x191a4a=a133_0x3324d2['join'](_0x2df3d1,_0x4f0251);if(_0x4f0251[_0x31f468(0x218)](_0x31f468(0x1eb))){const _0x2bb0e3=parseKnowledgeBaseYaml(a133_0x1b52fe['readFileSync'](_0x191a4a,_0x31f468(0x238)),_0x191a4a);_0x3dbd24[_0x31f468(0x13f)]({'name':_0x2bb0e3[_0x31f468(0x1ff)],'path':_0x191a4a,'yaml':_0x2bb0e3});}else{if(_0x4f0251[_0x31f468(0x218)]('.md')){const _0x2d6aca=a133_0x1b52fe[_0x31f468(0x1c6)](_0x191a4a,_0x31f468(0x238)),{name:_0x4505a5,text:_0x3b9783}=parseTextKnowledgeBaseMd(_0x2d6aca,_0x4f0251);_0x1ac634['push']({'name':_0x4505a5,'path':_0x191a4a,'text':_0x3b9783});}}}}const _0x5af0ab=getPromptsDir(_0xcdbcc3);if(a133_0x1b52fe['existsSync'](_0x5af0ab)){const _0x4c376c=a133_0x1b52fe['readdirSync'](_0x5af0ab)[_0x31f468(0x20e)](_0x2b129a=>_0x2b129a['endsWith']('.yml'));for(const _0x4da217 of _0x4c376c){const _0x5a48eb=a133_0x3324d2[_0x31f468(0x190)](_0x5af0ab,_0x4da217),_0x1aa63d=parsePromptYaml(a133_0x1b52fe[_0x31f468(0x1c6)](_0x5a48eb,_0x31f468(0x238)),_0x5a48eb);_0x5a1eca[_0x31f468(0x13f)]({'name':_0x1aa63d['name'],'path':_0x5a48eb,'yaml':_0x1aa63d});}}const _0x636a0f=[],_0xc28ba8=getIntegrationsDir(_0xcdbcc3);if(a133_0x1b52fe[_0x31f468(0x1cb)](_0xc28ba8)){const _0x4ecb77=a133_0x1b52fe[_0x31f468(0x164)](_0xc28ba8)['filter'](_0x590d01=>_0x590d01[_0x31f468(0x218)](_0x31f468(0x1eb)));for(const _0x22ccbb of _0x4ecb77){const _0x34e3ae=a133_0x3324d2[_0x31f468(0x190)](_0xc28ba8,_0x22ccbb),_0x174f71=parseIntegrationYaml(a133_0x1b52fe[_0x31f468(0x1c6)](_0x34e3ae,_0x31f468(0x238)),_0x34e3ae);if(!SAFE_INTEGRATION_TYPES['includes'](_0x174f71[_0x31f468(0x1fa)]['toLowerCase']())){this[_0x31f468(0x147)][_0x31f468(0x206)](_0x31f468(0x1a9)+_0x174f71[_0x31f468(0x1ff)]+'\x27\x20('+_0x174f71[_0x31f468(0x1fa)]+_0x31f468(0x1ec)+(_0x31f468(0x1c5)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x31f468(0x222))+_0x31f468(0x15f));continue;}_0x636a0f[_0x31f468(0x13f)]({'name':_0x174f71[_0x31f468(0x1ff)],'path':_0x34e3ae,'yaml':_0x174f71});}}const _0x553fdf=getExperimentalKnowledgeBasesDir(_0xcdbcc3);if(a133_0x1b52fe[_0x31f468(0x1cb)](_0x553fdf)){const _0x37874a=a133_0x1b52fe[_0x31f468(0x164)](_0x553fdf,{'withFileTypes':!![]});for(const _0x2a0019 of _0x37874a){if(!_0x2a0019[_0x31f468(0x16c)]())continue;const _0xf213df=a133_0x3324d2[_0x31f468(0x190)](_0x553fdf,_0x2a0019[_0x31f468(0x1ff)]),_0x171e33=a133_0x3324d2['join'](_0xf213df,_0x2a0019['name']+_0x31f468(0x1eb)),_0x3de09a=a133_0x3324d2[_0x31f468(0x190)](_0xf213df,_0x31f468(0x17a));if(!a133_0x1b52fe[_0x31f468(0x1cb)](_0x171e33))continue;const _0xc556ee=parseExperimentalKnowledgeBaseYaml(a133_0x1b52fe[_0x31f468(0x1c6)](_0x171e33,_0x31f468(0x238)),_0x171e33),_0x51ecab=[];if(a133_0x1b52fe[_0x31f468(0x1cb)](_0x3de09a)){const _0x370c3a=a133_0x1b52fe[_0x31f468(0x164)](_0x3de09a,{'withFileTypes':!![]});for(const _0x334821 of _0x370c3a){if(!_0x334821[_0x31f468(0x16c)]())continue;const _0x5ae550=a133_0x3324d2['join'](_0x3de09a,_0x334821['name']),_0xfbbd63=a133_0x3324d2[_0x31f468(0x190)](_0x5ae550,_0x31f468(0x1db)),_0x395975=a133_0x3324d2[_0x31f468(0x190)](_0x5ae550,_0x31f468(0x216));a133_0x1b52fe['existsSync'](_0xfbbd63)&&a133_0x1b52fe[_0x31f468(0x1cb)](_0x395975)&&_0x51ecab[_0x31f468(0x13f)]({'name':_0x334821[_0x31f468(0x1ff)],'code':a133_0x1b52fe[_0x31f468(0x1c6)](_0xfbbd63,_0x31f468(0x238)),'json_schema':a133_0x1b52fe[_0x31f468(0x1c6)](_0x395975,_0x31f468(0x238))});}}const _0x5b7ce6={..._0xc556ee,'variables':_0xc556ee[_0x31f468(0x1bd)]||[],'functions':_0x51ecab};_0x383c8b[_0x31f468(0x13f)]({'name':_0xc556ee[_0x31f468(0x1ff)],'dir':_0xf213df,'def':_0x5b7ce6});}}const _0x3dd733=getExperimentalArtifactsDir(_0xcdbcc3);if(a133_0x1b52fe[_0x31f468(0x1cb)](_0x3dd733)){const _0x2f16d0=a133_0x1b52fe[_0x31f468(0x164)](_0x3dd733,{'withFileTypes':!![]});for(const _0x30574c of _0x2f16d0){if(!_0x30574c[_0x31f468(0x16c)]())continue;const _0x530e07=a133_0x3324d2['join'](_0x3dd733,_0x30574c[_0x31f468(0x1ff)]),_0x2e11e9=a133_0x3324d2[_0x31f468(0x190)](_0x530e07,_0x30574c[_0x31f468(0x1ff)]+_0x31f468(0x1eb)),_0xe0f59f=a133_0x3324d2['join'](_0x530e07,'code.js'),_0x3650cf=a133_0x3324d2[_0x31f468(0x190)](_0x530e07,_0x31f468(0x11e));if(!a133_0x1b52fe[_0x31f468(0x1cb)](_0x2e11e9)||!a133_0x1b52fe[_0x31f468(0x1cb)](_0xe0f59f))continue;const _0x1dc168=parseExperimentalArtifactYaml(a133_0x1b52fe[_0x31f468(0x1c6)](_0x2e11e9,_0x31f468(0x238)),_0x2e11e9),_0x24806a=a133_0x1b52fe[_0x31f468(0x1c6)](_0xe0f59f,_0x31f468(0x238)),_0x50f7de=[];if(a133_0x1b52fe[_0x31f468(0x1cb)](_0x3650cf)){const _0x45e7b3=a133_0x1b52fe[_0x31f468(0x164)](_0x3650cf);for(const _0x2aaecb of _0x45e7b3){const _0x5405a6=a133_0x3324d2[_0x31f468(0x190)](_0x3650cf,_0x2aaecb);a133_0x1b52fe[_0x31f468(0x1b5)](_0x5405a6)[_0x31f468(0x167)]()&&_0x50f7de['push']({'file_name':_0x2aaecb,'text_content':a133_0x1b52fe['readFileSync'](_0x5405a6,_0x31f468(0x238))});}}const _0x3da9a9={..._0x1dc168,'code':_0x24806a,'files':_0x50f7de};_0xa4637c[_0x31f468(0x13f)]({'name':_0x1dc168[_0x31f468(0x1ff)],'dir':_0x530e07,'def':_0x3da9a9});}}const _0x3528ae=[],_0x254a3c=getFormInterfacesDir(_0xcdbcc3);if(a133_0x1b52fe[_0x31f468(0x1cb)](_0x254a3c)){const _0x19fdec=a133_0x1b52fe[_0x31f468(0x164)](_0x254a3c)[_0x31f468(0x20e)](_0x49bc02=>_0x49bc02[_0x31f468(0x218)](_0x31f468(0x1eb)));for(const _0x5d7556 of _0x19fdec){const _0x31cd29=a133_0x3324d2[_0x31f468(0x190)](_0x254a3c,_0x5d7556),_0x1835c4=parseFormInterfaceYaml(a133_0x1b52fe[_0x31f468(0x1c6)](_0x31cd29,'utf-8'),_0x31cd29);_0x3528ae[_0x31f468(0x13f)]({'name':_0x1835c4[_0x31f468(0x1ff)],'path':_0x31cd29,'yaml':_0x1835c4});}}const _0xc69ca2=[],_0x37d6a0=getChatInterfacesDir(_0xcdbcc3);if(a133_0x1b52fe['existsSync'](_0x37d6a0)){const _0x24c4f=a133_0x1b52fe[_0x31f468(0x164)](_0x37d6a0)[_0x31f468(0x20e)](_0x2cf59e=>_0x2cf59e[_0x31f468(0x218)](_0x31f468(0x1eb)));for(const _0x2e7f26 of _0x24c4f){const _0x58fb40=a133_0x3324d2['join'](_0x37d6a0,_0x2e7f26),_0x3c9c34=parseChatInterfaceYaml(a133_0x1b52fe['readFileSync'](_0x58fb40,_0x31f468(0x238)),_0x58fb40);_0xc69ca2[_0x31f468(0x13f)]({'name':_0x3c9c34[_0x31f468(0x1ff)],'path':_0x58fb40,'yaml':_0x3c9c34});}}const _0x5b2995=await this['client'][_0x31f468(0x13b)](_0x519efd),_0x217f10=await this['client'][_0x31f468(0x18a)](_0x519efd),_0x32f62b=await this[_0x31f468(0x1c9)][_0x31f468(0x231)](_0x519efd),_0x41d425=await this[_0x31f468(0x1c9)][_0x31f468(0x158)](_0x519efd),_0x40d4d5=await this[_0x31f468(0x1c9)][_0x31f468(0x1d1)](_0x519efd),_0x58c6f0=await safeListOrEmpty(()=>this[_0x31f468(0x1c9)][_0x31f468(0x1fd)](_0x519efd)),_0x225be4=await safeListOrEmpty(()=>this['client'][_0x31f468(0x23b)](_0x519efd)),_0x4dc50b=await safeListOrEmpty(()=>this['client'][_0x31f468(0x17d)](_0x519efd)),_0xc7c629=await safeListOrEmpty(()=>this[_0x31f468(0x1c9)]['listChatInterfaces'](_0x519efd)),_0x5bfba9=await fetchAllToolTargetMaps((_0x191bf4,_0x51502c)=>this['client'][_0x31f468(0x189)](_0x191bf4,_0x51502c),_0x519efd),_0x13bb93=new Map(),_0x2fad04=new Map(),_0x5ad7fc=new Map(),_0x2c8956=new Map(),_0x37db10=new Map(),_0xc28c8=new Map(),_0x1ac70d=new Map();for(const _0xff7007 of _0x5b2995){_0x13bb93[_0x31f468(0x1f8)](_0xff7007[_0x31f468(0x19e)]['name'],_0xff7007);}for(const _0x3ab707 of _0x217f10){_0x2fad04[_0x31f468(0x1f8)](_0x3ab707[_0x31f468(0x19e)][_0x31f468(0x1ff)],_0x3ab707);}for(const _0x31e575 of _0x32f62b){_0x5ad7fc['set'](_0x31e575[_0x31f468(0x19e)][_0x31f468(0x1ff)],_0x31e575);}for(const _0x31c586 of _0x41d425){_0x2c8956[_0x31f468(0x1f8)](_0x31c586['attributes'][_0x31f468(0x1ff)],_0x31c586);}for(const _0x3f6e16 of _0x40d4d5){_0x37db10[_0x31f468(0x1f8)](_0x3f6e16[_0x31f468(0x19e)][_0x31f468(0x1ae)][_0x31f468(0x1d6)](),_0x3f6e16);}for(const _0x171acc of _0x58c6f0){_0xc28c8[_0x31f468(0x1f8)](_0x171acc[_0x31f468(0x19e)][_0x31f468(0x1ff)],_0x171acc);}for(const _0x8db365 of _0x225be4){_0x1ac70d[_0x31f468(0x1f8)](_0x8db365['attributes'][_0x31f468(0x1ff)],_0x8db365);}const _0x318cee=new Map(),_0x692ee3=new Map();for(const _0x7d2030 of _0x4dc50b){_0x318cee[_0x31f468(0x1f8)](_0x7d2030[_0x31f468(0x19e)][_0x31f468(0x1ff)],_0x7d2030);}for(const _0x463ded of _0xc7c629){_0x692ee3[_0x31f468(0x1f8)](_0x463ded[_0x31f468(0x19e)][_0x31f468(0x1ff)],_0x463ded);}const _0x479811=new Map(),_0x36f266=new Map();for(const _0x3e4e85 of _0x5b2995){_0x479811[_0x31f468(0x1f8)](_0x3e4e85['attributes'][_0x31f468(0x1ff)],_0x3e4e85['id']),_0x36f266['set'](_0x3e4e85['id'],_0x3e4e85[_0x31f468(0x19e)][_0x31f468(0x1ff)]);}const _0x6bc505=new Map(),_0x1a3e21=new Map();for(const _0x1541d3 of _0x41d425){_0x6bc505[_0x31f468(0x1f8)](_0x1541d3[_0x31f468(0x19e)]['name'],_0x1541d3['id']),_0x1a3e21[_0x31f468(0x1f8)](_0x1541d3['id'],_0x1541d3['attributes'][_0x31f468(0x1ff)]);}const _0x4fc3fb=_0x5bfba9['nameToId'][_0x31f468(0x18d)]||new Map(),_0xb3a65=_0x5bfba9[_0x31f468(0x128)][_0x31f468(0x13c)]||new Map(),_0x24b1ef=_0x5bfba9['nameToId']['ExperimentalKnowledgeBase']||new Map(),_0x48e903=new Map(),_0x2a0a67={'resolveToolTargetName':buildNameResolver({..._0x5bfba9[_0x31f468(0x234)],'Agent':_0x36f266}),'resolvePromptName':async _0x5d79b3=>_0x1a3e21[_0x31f468(0x1d3)](_0x5d79b3),'onWarning':_0x587215=>this[_0x31f468(0x147)][_0x31f468(0x206)](_0x587215)};let _0xdd36d6=[];const _0x3a1fbe={'projectId':_0x519efd,'resolveToolTargetId':buildIdResolver({..._0x5bfba9[_0x31f468(0x128)],'Agent':_0x479811}),'resolvePromptId':async _0x52795b=>_0x6bc505['get'](_0x52795b),'onWarning':_0x425fd8=>{const _0x1576ca=_0x31f468;this[_0x1576ca(0x147)]['warn'](_0x425fd8),_0xdd36d6[_0x1576ca(0x13f)](_0x425fd8);}},{resolved:_0xff27f4,unresolved:_0x3009ce}=resolveAgentDependencies(_0x2d3438,new Set(_0x13bb93['keys']()));for(const {agent:_0xea29dc,missingDeps:_0x56e6d2}of _0x3009ce){_0xdd789a[_0x31f468(0x1c3)]['push']({'agentName':_0xea29dc['yaml'][_0x31f468(0x1ff)],'action':_0x31f468(0x1d9),'error':_0x31f468(0x19d)+_0x56e6d2[_0x31f468(0x190)](',\x20')+_0x31f468(0x1b1)}),_0xdd789a['counts'][_0x31f468(0x1c3)][_0x31f468(0x221)]++;}for(const _0x1c3fa8 of _0x3dbd24){const _0x43e1b6=_0x2fad04[_0x31f468(0x1d3)](_0x1c3fa8['yaml'][_0x31f468(0x1ff)]),_0x37e9c3=a133_0x1b52fe[_0x31f468(0x1c6)](_0x1c3fa8['path'],_0x31f468(0x238));if(_0x43e1b6){const _0x512dcc=apiKnowledgeBaseToYaml(_0x43e1b6),_0x5c4cf7=toKnowledgeBaseYamlString(_0x512dcc),_0x12b049=generateDiff(_0x5c4cf7,_0x37e9c3),_0x2ab5e8=hasChanges(_0x12b049);_0x2ab5e8?(_0xdd789a[_0x31f468(0x1d0)][_0x31f468(0x13f)]({'name':_0x1c3fa8[_0x31f468(0x1f2)]['name'],'action':_0x31f468(0x233),'id':_0x43e1b6['id'],'diff':formatDiffWithColors(_0x12b049)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1d0)][_0x31f468(0x233)]++):(_0xdd789a[_0x31f468(0x1d0)]['push']({'name':_0x1c3fa8['yaml'][_0x31f468(0x1ff)],'action':'unchanged','id':_0x43e1b6['id']}),_0xdd789a['counts'][_0x31f468(0x1d0)][_0x31f468(0x19a)]++);}else _0xdd789a[_0x31f468(0x1d0)]['push']({'name':_0x1c3fa8[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x141)}),_0xdd789a['counts']['knowledgeBases'][_0x31f468(0x141)]++;}for(const _0x203580 of _0x1ac634){const _0x4db48f=_0x5ad7fc['get'](_0x203580['name']),_0x15290c=a133_0x1b52fe[_0x31f468(0x1c6)](_0x203580['path'],_0x31f468(0x238));if(_0x4db48f){const _0x42ec56=toTextKnowledgeBaseMd(_0x4db48f['attributes']['name'],_0x4db48f[_0x31f468(0x19e)]['text']),_0x3f7b9f=generateDiff(_0x42ec56,_0x15290c),_0x589ed3=hasChanges(_0x3f7b9f);_0x589ed3?(_0xdd789a[_0x31f468(0x23a)]['push']({'name':_0x203580[_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x4db48f['id'],'diff':formatDiffWithColors(_0x3f7b9f)}),_0xdd789a['counts'][_0x31f468(0x23a)][_0x31f468(0x233)]++):(_0xdd789a['textKnowledgeBases'][_0x31f468(0x13f)]({'name':_0x203580['name'],'action':'unchanged','id':_0x4db48f['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x23a)]['unchanged']++);}else _0xdd789a['textKnowledgeBases'][_0x31f468(0x13f)]({'name':_0x203580[_0x31f468(0x1ff)],'action':_0x31f468(0x141)}),_0xdd789a['counts'][_0x31f468(0x23a)][_0x31f468(0x141)]++;}for(const _0x550c01 of _0xff27f4){const _0x1f3659=_0x13bb93[_0x31f468(0x1d3)](_0x550c01[_0x31f468(0x1f2)][_0x31f468(0x1ff)]),_0x5d612e=a133_0x3324d2[_0x31f468(0x190)](_0x550c01['dir'],_0x31f468(0x120)),_0x152236=a133_0x1b52fe[_0x31f468(0x1c6)](_0x5d612e,_0x31f468(0x238)),_0x572900=_0x550c01['systemPrompt'],_0x255974=_0x31f468(0x223)+_0x572900+_0x31f468(0x169)+_0x152236;if(_0x1f3659){const {yaml:_0xff3490,systemPrompt:_0x459c5b}=await agentResponseToDef(_0x1f3659,_0x2a0a67),_0xa5d5ee=toAgentYamlString(_0xff3490),_0x29b7c6=_0x31f468(0x223)+_0x459c5b+'\x0a\x0a#\x20agent.yml\x0a'+_0xa5d5ee,_0x3fa1c6=generateDiff(_0x29b7c6,_0x255974),_0xb8e42f=hasChanges(_0x3fa1c6);_0xb8e42f?(_0xdd789a[_0x31f468(0x1c3)][_0x31f468(0x13f)]({'agentName':_0x550c01[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'agentId':_0x1f3659['id'],'diff':formatDiffWithColors(_0x3fa1c6)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1c3)][_0x31f468(0x233)]++):(_0xdd789a[_0x31f468(0x1c3)][_0x31f468(0x13f)]({'agentName':_0x550c01[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x19a),'agentId':_0x1f3659['id']}),_0xdd789a['counts'][_0x31f468(0x1c3)][_0x31f468(0x19a)]++);}else _0xdd789a[_0x31f468(0x1c3)]['push']({'agentName':_0x550c01[_0x31f468(0x1f2)]['name'],'action':_0x31f468(0x141)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1c3)][_0x31f468(0x141)]++;}for(const _0x4e67ed of _0x5a1eca){const _0x5436e2=_0x2c8956[_0x31f468(0x1d3)](_0x4e67ed['yaml'][_0x31f468(0x1ff)]),_0x313f79=a133_0x1b52fe[_0x31f468(0x1c6)](_0x4e67ed[_0x31f468(0x174)],_0x31f468(0x238));if(_0x5436e2){const _0x51bc73=await apiPromptToYaml(_0x5436e2,_0x2a0a67);if(!_0x51bc73){_0xdd789a[_0x31f468(0x1ad)][_0x31f468(0x13f)]({'name':_0x4e67ed[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':'updated','id':_0x5436e2['id']}),_0xdd789a['counts'][_0x31f468(0x1ad)]['updated']++;continue;}const _0x1216e6=toPromptYamlString(_0x51bc73),_0x947819=generateDiff(_0x1216e6,_0x313f79),_0x563a2e=hasChanges(_0x947819);_0x563a2e?(_0xdd789a['prompts'][_0x31f468(0x13f)]({'name':_0x4e67ed[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x5436e2['id'],'diff':formatDiffWithColors(_0x947819)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1ad)]['updated']++):(_0xdd789a[_0x31f468(0x1ad)]['push']({'name':_0x4e67ed[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x19a),'id':_0x5436e2['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1ad)]['unchanged']++);}else _0xdd789a[_0x31f468(0x1ad)][_0x31f468(0x13f)]({'name':_0x4e67ed[_0x31f468(0x1f2)]['name'],'action':_0x31f468(0x141)}),_0xdd789a[_0x31f468(0x20a)]['prompts'][_0x31f468(0x141)]++;}for(const _0x242d91 of _0x636a0f){const _0x4c3a25=_0x37db10[_0x31f468(0x1d3)](_0x242d91[_0x31f468(0x1f2)][_0x31f468(0x1fa)]),_0x4f0dc7=a133_0x1b52fe[_0x31f468(0x1c6)](_0x242d91['path'],_0x31f468(0x238));if(_0x4c3a25){const _0x45497c=await apiIntegrationToYaml(_0x4c3a25,_0x2a0a67),_0xe51920=toIntegrationYamlString(_0x45497c),_0x9e0c45=generateDiff(_0xe51920,_0x4f0dc7),_0x53131c=hasChanges(_0x9e0c45);_0x53131c?(_0xdd789a['integrations'][_0x31f468(0x13f)]({'name':_0x242d91['yaml'][_0x31f468(0x1fa)],'action':'updated','id':_0x4c3a25['id'],'diff':formatDiffWithColors(_0x9e0c45)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x17c)][_0x31f468(0x233)]++):(_0xdd789a[_0x31f468(0x17c)][_0x31f468(0x13f)]({'name':_0x242d91[_0x31f468(0x1f2)][_0x31f468(0x1fa)],'action':'unchanged','id':_0x4c3a25['id']}),_0xdd789a['counts'][_0x31f468(0x17c)][_0x31f468(0x19a)]++);}else _0xdd789a[_0x31f468(0x17c)][_0x31f468(0x13f)]({'name':_0x242d91[_0x31f468(0x1f2)][_0x31f468(0x1fa)],'action':_0x31f468(0x141)}),_0xdd789a['counts'][_0x31f468(0x17c)][_0x31f468(0x141)]++;}for(const _0x454af2 of _0x383c8b){const _0x474921=_0xc28c8[_0x31f468(0x1d3)](_0x454af2['def'][_0x31f468(0x1ff)]),_0x430b2c=toExperimentalKnowledgeBaseYamlString(_0x454af2[_0x31f468(0x1e1)]);let _0x2f1aaa=_0x430b2c;for(const _0x3832fc of _0x454af2[_0x31f468(0x1e1)][_0x31f468(0x17a)]){_0x2f1aaa+=_0x31f468(0x17b)+_0x3832fc[_0x31f468(0x1ff)]+_0x31f468(0x1a8)+_0x3832fc[_0x31f468(0x16b)]+'\x0a---\x20schema:\x20'+_0x3832fc[_0x31f468(0x1ff)]+'\x20---\x0a'+_0x3832fc[_0x31f468(0x1fb)]+'\x0a';}if(_0x474921){const _0x38cfad=apiExperimentalKnowledgeBaseToYaml(_0x474921),_0x3cecb8=toExperimentalKnowledgeBaseYamlString(_0x38cfad);let _0x4e3a4e=_0x3cecb8;for(const _0x2c14a2 of _0x38cfad[_0x31f468(0x17a)]){_0x4e3a4e+='\x0a---\x20function:\x20'+_0x2c14a2[_0x31f468(0x1ff)]+_0x31f468(0x1a8)+_0x2c14a2[_0x31f468(0x16b)]+_0x31f468(0x142)+_0x2c14a2[_0x31f468(0x1ff)]+'\x20---\x0a'+_0x2c14a2[_0x31f468(0x1fb)]+'\x0a';}const _0x41613d=generateDiff(_0x4e3a4e,_0x2f1aaa),_0x1820b2=hasChanges(_0x41613d);_0x1820b2?(_0xdd789a[_0x31f468(0x192)][_0x31f468(0x13f)]({'name':_0x454af2[_0x31f468(0x1e1)][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x474921['id'],'diff':formatDiffWithColors(_0x41613d)}),_0xdd789a['counts'][_0x31f468(0x192)][_0x31f468(0x233)]++):(_0xdd789a[_0x31f468(0x192)][_0x31f468(0x13f)]({'name':_0x454af2[_0x31f468(0x1e1)][_0x31f468(0x1ff)],'action':_0x31f468(0x19a),'id':_0x474921['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x192)][_0x31f468(0x19a)]++);}else _0xdd789a[_0x31f468(0x192)][_0x31f468(0x13f)]({'name':_0x454af2['def'][_0x31f468(0x1ff)],'action':_0x31f468(0x141)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x192)][_0x31f468(0x141)]++;}for(const _0x19d1f6 of _0xa4637c){const _0x19a71=_0x1ac70d[_0x31f468(0x1d3)](_0x19d1f6[_0x31f468(0x1e1)][_0x31f468(0x1ff)]),_0x24e75c=toExperimentalArtifactYamlString(_0x19d1f6[_0x31f468(0x1e1)]);let _0x25635d=_0x24e75c+(_0x31f468(0x1a5)+_0x19d1f6[_0x31f468(0x1e1)][_0x31f468(0x16b)]+'\x0a');for(const _0xdcb7b0 of _0x19d1f6[_0x31f468(0x1e1)][_0x31f468(0x11e)]){_0x25635d+='---\x20file:\x20'+_0xdcb7b0[_0x31f468(0x16d)]+_0x31f468(0x1a8)+_0xdcb7b0[_0x31f468(0x230)]+'\x0a';}if(_0x19a71){const _0x57017c=apiExperimentalArtifactToYaml(_0x19a71),_0x33c378=toExperimentalArtifactYamlString(_0x57017c);let _0x2fd4da=_0x33c378+('\x0a---\x20code\x20---\x0a'+_0x57017c[_0x31f468(0x16b)]+'\x0a');for(const _0xe3f5b1 of _0x57017c[_0x31f468(0x11e)]){_0x2fd4da+='---\x20file:\x20'+_0xe3f5b1[_0x31f468(0x16d)]+_0x31f468(0x1a8)+_0xe3f5b1['text_content']+'\x0a';}const _0x5e80a7=generateDiff(_0x2fd4da,_0x25635d),_0x72c8f4=hasChanges(_0x5e80a7);_0x72c8f4?(_0xdd789a[_0x31f468(0x1f9)][_0x31f468(0x13f)]({'name':_0x19d1f6[_0x31f468(0x1e1)][_0x31f468(0x1ff)],'action':'updated','id':_0x19a71['id'],'diff':formatDiffWithColors(_0x5e80a7)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1f9)]['updated']++):(_0xdd789a['experimentalArtifacts'][_0x31f468(0x13f)]({'name':_0x19d1f6[_0x31f468(0x1e1)][_0x31f468(0x1ff)],'action':_0x31f468(0x19a),'id':_0x19a71['id']}),_0xdd789a[_0x31f468(0x20a)]['experimentalArtifacts']['unchanged']++);}else _0xdd789a[_0x31f468(0x1f9)][_0x31f468(0x13f)]({'name':_0x19d1f6[_0x31f468(0x1e1)][_0x31f468(0x1ff)],'action':_0x31f468(0x141)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1f9)]['created']++;}for(const _0x45e945 of _0x3528ae){const _0x5d8c70=_0x318cee[_0x31f468(0x1d3)](_0x45e945[_0x31f468(0x1f2)]['name']),_0x37944b=a133_0x1b52fe[_0x31f468(0x1c6)](_0x45e945['path'],'utf-8');if(_0x5d8c70){const _0x480374=await apiFormInterfaceToYaml(_0x5d8c70,_0x2a0a67),_0x3f17d9=toFormInterfaceYamlString(_0x480374),_0x1efa70=generateDiff(_0x3f17d9,_0x37944b),_0x18f73d=hasChanges(_0x1efa70);_0x18f73d?(_0xdd789a[_0x31f468(0x1dc)][_0x31f468(0x13f)]({'name':_0x45e945['yaml'][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x5d8c70['id'],'diff':formatDiffWithColors(_0x1efa70)}),_0xdd789a['counts']['formInterfaces']['updated']++):(_0xdd789a[_0x31f468(0x1dc)][_0x31f468(0x13f)]({'name':_0x45e945[_0x31f468(0x1f2)]['name'],'action':_0x31f468(0x19a),'id':_0x5d8c70['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1dc)][_0x31f468(0x19a)]++);}else _0xdd789a[_0x31f468(0x1dc)][_0x31f468(0x13f)]({'name':_0x45e945[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':'created'}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1dc)][_0x31f468(0x141)]++;}for(const _0x2eaa97 of _0xc69ca2){const _0x41b7df=_0x692ee3['get'](_0x2eaa97['yaml']['name']),_0x1902fb=a133_0x1b52fe[_0x31f468(0x1c6)](_0x2eaa97[_0x31f468(0x174)],_0x31f468(0x238));if(_0x41b7df){const _0x3c7085=await apiChatInterfaceToYaml(_0x41b7df,_0x2a0a67),_0x452236=toChatInterfaceYamlString(_0x3c7085),_0x24a35a=generateDiff(_0x452236,_0x1902fb),_0x498fc0=hasChanges(_0x24a35a);_0x498fc0?(_0xdd789a[_0x31f468(0x1e4)]['push']({'name':_0x2eaa97[_0x31f468(0x1f2)]['name'],'action':_0x31f468(0x233),'id':_0x41b7df['id'],'diff':formatDiffWithColors(_0x24a35a)}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1e4)][_0x31f468(0x233)]++):(_0xdd789a[_0x31f468(0x1e4)]['push']({'name':_0x2eaa97[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x19a),'id':_0x41b7df['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1e4)]['unchanged']++);}else _0xdd789a[_0x31f468(0x1e4)][_0x31f468(0x13f)]({'name':_0x2eaa97[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x141)}),_0xdd789a['counts'][_0x31f468(0x1e4)][_0x31f468(0x141)]++;}if(_0x4b166b?.[_0x31f468(0x226)])return _0xdd789a;_0xdd789a[_0x31f468(0x1d0)]=[],_0xdd789a[_0x31f468(0x23a)]=[],_0xdd789a[_0x31f468(0x1ad)]=[],_0xdd789a[_0x31f468(0x17c)]=[],_0xdd789a[_0x31f468(0x192)]=[],_0xdd789a[_0x31f468(0x1f9)]=[],_0xdd789a[_0x31f468(0x1dc)]=[],_0xdd789a[_0x31f468(0x1e4)]=[];const _0x928f0f=_0xdd789a[_0x31f468(0x1c3)][_0x31f468(0x20e)](_0x2ed5c8=>_0x2ed5c8['action']===_0x31f468(0x1d9));_0xdd789a['agents']=_0x928f0f,_0xdd789a[_0x31f468(0x20a)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x928f0f['length']},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x1a7e88 of _0x3dbd24){try{const _0x47157d=_0x2fad04[_0x31f468(0x1d3)](_0x1a7e88[_0x31f468(0x1f2)]['name']),_0x21416d=yamlKnowledgeBaseToApi(_0x1a7e88['yaml'],_0x519efd);if(_0x47157d)await this['client'][_0x31f468(0x11c)](_0x47157d['id'],_0x21416d),_0x4fc3fb[_0x31f468(0x1f8)](_0x1a7e88[_0x31f468(0x1f2)]['name'],_0x47157d['id']),_0xdd789a[_0x31f468(0x1d0)][_0x31f468(0x13f)]({'name':_0x1a7e88[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x47157d['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1d0)][_0x31f468(0x233)]++;else{const _0x1e74ea=await this['client'][_0x31f468(0x1ed)](_0x21416d);_0x4fc3fb['set'](_0x1a7e88[_0x31f468(0x1f2)][_0x31f468(0x1ff)],_0x1e74ea['id']),_0xdd789a[_0x31f468(0x1d0)][_0x31f468(0x13f)]({'name':_0x1a7e88[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x141),'id':_0x1e74ea['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1d0)]['created']++;}}catch(_0x322ef3){_0xdd789a[_0x31f468(0x1d0)][_0x31f468(0x13f)]({'name':_0x1a7e88[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':'error','error':_0x322ef3[_0x31f468(0x214)]}),_0xdd789a[_0x31f468(0x20a)]['knowledgeBases']['errors']++;}}for(const _0x1b663f of _0x1ac634){try{const _0x1b92a9=_0x5ad7fc[_0x31f468(0x1d3)](_0x1b663f['name']),_0x8ae843=yamlTextKnowledgeBaseToApi({'name':_0x1b663f[_0x31f468(0x1ff)],'text':_0x1b663f[_0x31f468(0x21a)]},_0x519efd);if(_0x1b92a9)await this[_0x31f468(0x1c9)][_0x31f468(0x153)](_0x1b92a9['id'],_0x8ae843),_0xb3a65[_0x31f468(0x1f8)](_0x1b663f['name'],_0x1b92a9['id']),_0xdd789a[_0x31f468(0x23a)][_0x31f468(0x13f)]({'name':_0x1b663f[_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x1b92a9['id']}),_0xdd789a[_0x31f468(0x20a)]['textKnowledgeBases'][_0x31f468(0x233)]++;else{const _0x31f699=await this[_0x31f468(0x1c9)][_0x31f468(0x1c2)](_0x8ae843);_0xb3a65[_0x31f468(0x1f8)](_0x1b663f[_0x31f468(0x1ff)],_0x31f699['id']),_0xdd789a[_0x31f468(0x23a)][_0x31f468(0x13f)]({'name':_0x1b663f[_0x31f468(0x1ff)],'action':_0x31f468(0x141),'id':_0x31f699['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x23a)][_0x31f468(0x141)]++;}}catch(_0x5b215e){_0xdd789a[_0x31f468(0x23a)][_0x31f468(0x13f)]({'name':_0x1b663f['name'],'action':_0x31f468(0x1d9),'error':_0x5b215e[_0x31f468(0x214)]}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x23a)][_0x31f468(0x221)]++;}}for(const _0x1084e0 of _0x383c8b){try{const _0x506a3b=_0xc28c8[_0x31f468(0x1d3)](_0x1084e0['def'][_0x31f468(0x1ff)]),_0x16ff84=yamlExperimentalKnowledgeBaseToApi(_0x1084e0[_0x31f468(0x1e1)],_0x519efd);if(_0x506a3b)await this['client'][_0x31f468(0x18b)](_0x506a3b['id'],_0x16ff84),_0x24b1ef[_0x31f468(0x1f8)](_0x1084e0[_0x31f468(0x1e1)][_0x31f468(0x1ff)],_0x506a3b['id']),_0xdd789a[_0x31f468(0x192)][_0x31f468(0x13f)]({'name':_0x1084e0[_0x31f468(0x1e1)][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x506a3b['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x192)][_0x31f468(0x233)]++;else{const _0x59a672=await this['client'][_0x31f468(0x12b)](_0x16ff84);_0x24b1ef[_0x31f468(0x1f8)](_0x1084e0[_0x31f468(0x1e1)][_0x31f468(0x1ff)],_0x59a672['id']),_0xdd789a['experimentalKnowledgeBases'][_0x31f468(0x13f)]({'name':_0x1084e0['def'][_0x31f468(0x1ff)],'action':_0x31f468(0x141),'id':_0x59a672['id']}),_0xdd789a[_0x31f468(0x20a)]['experimentalKnowledgeBases'][_0x31f468(0x141)]++;}}catch(_0x3f9970){_0xdd789a['experimentalKnowledgeBases'][_0x31f468(0x13f)]({'name':_0x1084e0[_0x31f468(0x1e1)][_0x31f468(0x1ff)],'action':'error','error':_0x3f9970[_0x31f468(0x214)]}),_0xdd789a[_0x31f468(0x20a)]['experimentalKnowledgeBases'][_0x31f468(0x221)]++;}}for(const _0x50cd00 of _0xa4637c){try{const _0x129287=_0x1ac70d[_0x31f468(0x1d3)](_0x50cd00['def']['name']),_0x4bd19e=yamlExperimentalArtifactToApi(_0x50cd00[_0x31f468(0x1e1)],_0x519efd);if(_0x129287)await this['client'][_0x31f468(0x21b)](_0x129287['id'],_0x4bd19e),_0x48e903[_0x31f468(0x1f8)](_0x50cd00[_0x31f468(0x1e1)][_0x31f468(0x1ff)],_0x129287['id']),_0xdd789a[_0x31f468(0x1f9)][_0x31f468(0x13f)]({'name':_0x50cd00[_0x31f468(0x1e1)]['name'],'action':'updated','id':_0x129287['id']}),_0xdd789a['counts'][_0x31f468(0x1f9)][_0x31f468(0x233)]++;else{const _0x57e483=await this['client']['createExperimentalArtifact'](_0x4bd19e);_0x48e903[_0x31f468(0x1f8)](_0x50cd00[_0x31f468(0x1e1)][_0x31f468(0x1ff)],_0x57e483['id']),_0xdd789a[_0x31f468(0x1f9)]['push']({'name':_0x50cd00['def'][_0x31f468(0x1ff)],'action':_0x31f468(0x141),'id':_0x57e483['id']}),_0xdd789a['counts'][_0x31f468(0x1f9)][_0x31f468(0x141)]++;}}catch(_0x4cc5db){_0xdd789a['experimentalArtifacts'][_0x31f468(0x13f)]({'name':_0x50cd00[_0x31f468(0x1e1)][_0x31f468(0x1ff)],'action':_0x31f468(0x1d9),'error':_0x4cc5db[_0x31f468(0x214)]}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1f9)][_0x31f468(0x221)]++;}}for(const _0x1c2ae8 of _0xff27f4){_0xdd36d6=[];try{const _0x1b2877=_0x13bb93[_0x31f468(0x1d3)](_0x1c2ae8[_0x31f468(0x1f2)][_0x31f468(0x1ff)]),_0x5a9827=await agentDefToRequest(_0x1c2ae8[_0x31f468(0x1f2)],_0x1c2ae8['systemPrompt'],_0x1c2ae8[_0x31f468(0x1bc)],_0x3a1fbe);if(_0x1b2877)await this[_0x31f468(0x1c9)]['updateAgentResponse'](_0x1b2877['id'],_0x5a9827),_0x479811[_0x31f468(0x1f8)](_0x1c2ae8[_0x31f468(0x1f2)][_0x31f468(0x1ff)],_0x1b2877['id']),_0xdd789a['agents']['push']({'agentName':_0x1c2ae8[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'agentId':_0x1b2877['id'],'warnings':_0xdd36d6['length']>0x0?_0xdd36d6:undefined}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1c3)][_0x31f468(0x233)]++;else{const _0x4c393b=await this[_0x31f468(0x1c9)][_0x31f468(0x131)](_0x5a9827);_0x479811[_0x31f468(0x1f8)](_0x1c2ae8[_0x31f468(0x1f2)][_0x31f468(0x1ff)],_0x4c393b['id']),_0xdd789a[_0x31f468(0x1c3)][_0x31f468(0x13f)]({'agentName':_0x1c2ae8[_0x31f468(0x1f2)]['name'],'action':_0x31f468(0x141),'agentId':_0x4c393b['id'],'warnings':_0xdd36d6['length']>0x0?_0xdd36d6:undefined}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1c3)][_0x31f468(0x141)]++;}}catch(_0x26b799){_0xdd789a['agents'][_0x31f468(0x13f)]({'agentName':_0x1c2ae8[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x1d9),'error':_0x26b799[_0x31f468(0x214)],'warnings':_0xdd36d6[_0x31f468(0x21c)]>0x0?_0xdd36d6:undefined}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1c3)]['errors']++;}}for(const _0x381b2c of _0x5a1eca){try{const _0x3ed396=_0x2c8956[_0x31f468(0x1d3)](_0x381b2c[_0x31f468(0x1f2)]['name']),_0xd06b9f=await yamlPromptToApi(_0x381b2c['yaml'],_0x519efd,_0x3a1fbe);if(!_0xd06b9f){_0xdd789a['prompts'][_0x31f468(0x13f)]({'name':_0x381b2c[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x1d9),'error':'Agent\x20reference\x20not\x20found'}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1ad)][_0x31f468(0x221)]++;continue;}if(_0x3ed396)await this[_0x31f468(0x1c9)][_0x31f468(0x181)](_0x3ed396['id'],_0xd06b9f),_0x6bc505[_0x31f468(0x1f8)](_0x381b2c[_0x31f468(0x1f2)]['name'],_0x3ed396['id']),_0xdd789a['prompts'][_0x31f468(0x13f)]({'name':_0x381b2c[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':'updated','id':_0x3ed396['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1ad)][_0x31f468(0x233)]++;else{const _0x49f618=await this['client'][_0x31f468(0x179)](_0xd06b9f);_0x6bc505[_0x31f468(0x1f8)](_0x381b2c[_0x31f468(0x1f2)][_0x31f468(0x1ff)],_0x49f618['id']),_0xdd789a['prompts'][_0x31f468(0x13f)]({'name':_0x381b2c[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x141),'id':_0x49f618['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1ad)][_0x31f468(0x141)]++;}}catch(_0x10ecc4){_0xdd789a[_0x31f468(0x1ad)][_0x31f468(0x13f)]({'name':_0x381b2c['yaml'][_0x31f468(0x1ff)],'action':_0x31f468(0x1d9),'error':_0x10ecc4[_0x31f468(0x214)]}),_0xdd789a['counts']['prompts'][_0x31f468(0x221)]++;}}for(const _0x14c712 of _0x636a0f){try{const _0x2ee1a4=_0x37db10['get'](_0x14c712['yaml']['service_type']),_0x185f73=await yamlIntegrationToApi(_0x14c712[_0x31f468(0x1f2)],_0x519efd,_0x3a1fbe);if(_0x2ee1a4){await this[_0x31f468(0x1c9)][_0x31f468(0x20f)](_0x2ee1a4['id']);const _0x37879a=await this[_0x31f468(0x1c9)][_0x31f468(0x12f)](_0x185f73);_0xdd789a[_0x31f468(0x17c)][_0x31f468(0x13f)]({'name':_0x14c712[_0x31f468(0x1f2)][_0x31f468(0x1fa)],'action':_0x31f468(0x233),'id':_0x37879a['id']}),_0xdd789a['counts'][_0x31f468(0x17c)][_0x31f468(0x233)]++;}else{const _0x4599dc=await this['client']['createIntegration'](_0x185f73);_0xdd789a[_0x31f468(0x17c)][_0x31f468(0x13f)]({'name':_0x14c712[_0x31f468(0x1f2)][_0x31f468(0x1fa)],'action':_0x31f468(0x141),'id':_0x4599dc['id']}),_0xdd789a[_0x31f468(0x20a)]['integrations'][_0x31f468(0x141)]++;}}catch(_0x3c8fce){_0xdd789a[_0x31f468(0x17c)][_0x31f468(0x13f)]({'name':_0x14c712[_0x31f468(0x1f2)][_0x31f468(0x1fa)],'action':_0x31f468(0x1d9),'error':_0x3c8fce['message']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x17c)][_0x31f468(0x221)]++;}}for(const _0x406bba of _0x3528ae){try{const _0x41bf97=_0x318cee[_0x31f468(0x1d3)](_0x406bba[_0x31f468(0x1f2)][_0x31f468(0x1ff)]),_0xa09d89=await yamlFormInterfaceToApi(_0x406bba['yaml'],_0x519efd,_0x3a1fbe);if(!_0xa09d89){_0xdd789a[_0x31f468(0x1dc)][_0x31f468(0x13f)]({'name':_0x406bba[_0x31f468(0x1f2)]['name'],'action':_0x31f468(0x1d9),'error':_0x31f468(0x212)}),_0xdd789a[_0x31f468(0x20a)]['formInterfaces'][_0x31f468(0x221)]++;continue;}if(_0x41bf97){const _0x176f97=await this[_0x31f468(0x1c9)][_0x31f468(0x14a)](_0x41bf97['id'],_0xa09d89);_0xdd789a[_0x31f468(0x1dc)][_0x31f468(0x13f)]({'name':_0x406bba['yaml'][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x176f97['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1dc)][_0x31f468(0x233)]++;}else{const _0x40dec8=await this[_0x31f468(0x1c9)][_0x31f468(0x15c)](_0xa09d89);_0xdd789a[_0x31f468(0x1dc)][_0x31f468(0x13f)]({'name':_0x406bba[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x141),'id':_0x40dec8['id']}),_0xdd789a['counts']['formInterfaces'][_0x31f468(0x141)]++;}}catch(_0x47ff5c){_0xdd789a[_0x31f468(0x1dc)][_0x31f468(0x13f)]({'name':_0x406bba[_0x31f468(0x1f2)]['name'],'action':_0x31f468(0x1d9),'error':_0x47ff5c[_0x31f468(0x214)]}),_0xdd789a[_0x31f468(0x20a)]['formInterfaces']['errors']++;}}for(const _0x5c5eef of _0xc69ca2){try{const _0x2c7b10=_0x692ee3[_0x31f468(0x1d3)](_0x5c5eef[_0x31f468(0x1f2)][_0x31f468(0x1ff)]),_0x371cb2=await yamlChatInterfaceToApi(_0x5c5eef[_0x31f468(0x1f2)],_0x519efd,_0x3a1fbe);if(_0x2c7b10){const _0x4035d5=await this[_0x31f468(0x1c9)][_0x31f468(0x1a4)](_0x2c7b10['id'],_0x371cb2);_0xdd789a[_0x31f468(0x1e4)][_0x31f468(0x13f)]({'name':_0x5c5eef['yaml'][_0x31f468(0x1ff)],'action':_0x31f468(0x233),'id':_0x4035d5['id']}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1e4)][_0x31f468(0x233)]++;}else{const _0x481725=await this['client']['createChatInterface'](_0x371cb2);_0xdd789a[_0x31f468(0x1e4)][_0x31f468(0x13f)]({'name':_0x5c5eef[_0x31f468(0x1f2)][_0x31f468(0x1ff)],'action':_0x31f468(0x141),'id':_0x481725['id']}),_0xdd789a['counts'][_0x31f468(0x1e4)][_0x31f468(0x141)]++;}}catch(_0x48b909){_0xdd789a[_0x31f468(0x1e4)]['push']({'name':_0x5c5eef['yaml'][_0x31f468(0x1ff)],'action':'error','error':_0x48b909[_0x31f468(0x214)]}),_0xdd789a[_0x31f468(0x20a)][_0x31f468(0x1e4)][_0x31f468(0x221)]++;}}return _0xdd789a;}async[a133_0x4f6d4d(0x204)](_0x322c8f,_0xeb2b60,_0x5a5eda,_0x5d9ebc){const _0x2eb71a=a133_0x4f6d4d,{projectId:_0x1e4da5,project:_0x11b17c}=await this[_0x2eb71a(0x187)](_0x322c8f),_0x475118=_0x11b17c[_0x2eb71a(0x19e)]['name'],_0x2c2b66=await this[_0x2eb71a(0x1c9)][_0x2eb71a(0x13b)](_0x1e4da5),_0x264d07=_0x2c2b66[_0x2eb71a(0x12a)](_0x272244=>_0x272244[_0x2eb71a(0x19e)][_0x2eb71a(0x1ff)]===_0xeb2b60);if(!_0x264d07)throw new SDKError(ErrorCode[_0x2eb71a(0x11f)],'Agent\x20not\x20found:\x20'+_0xeb2b60,undefined,{'helpText':_0x2eb71a(0x14b)+_0x2c2b66[_0x2eb71a(0x1a3)](_0x4c5fc7=>_0x4c5fc7[_0x2eb71a(0x19e)][_0x2eb71a(0x1ff)])[_0x2eb71a(0x190)](',\x20')});let _0x4dad23;if(_0x5a5eda)_0x4dad23=_0x5a5eda;else{const _0x15fc94=a133_0x3324d2[_0x2eb71a(0x190)](process[_0x2eb71a(0x182)](),_0x2eb71a(0x1c3)),_0xee07ae=getSanitizedPathWithMigration(_0x15fc94,_0x475118);_0xee07ae['renamed']&&this[_0x2eb71a(0x147)][_0x2eb71a(0x133)]('Renamed\x20folder:\x20'+a133_0x3324d2[_0x2eb71a(0x20c)](_0xee07ae[_0x2eb71a(0x22f)])+_0x2eb71a(0x12d)+a133_0x3324d2['basename'](_0xee07ae[_0x2eb71a(0x174)])),_0x4dad23=_0xee07ae['path'];}const _0x361e0e=getSanitizedPathWithMigration(_0x4dad23,_0xeb2b60);_0x361e0e['renamed']&&this[_0x2eb71a(0x147)][_0x2eb71a(0x133)](_0x2eb71a(0x117)+a133_0x3324d2[_0x2eb71a(0x20c)](_0x361e0e[_0x2eb71a(0x22f)])+_0x2eb71a(0x12d)+a133_0x3324d2[_0x2eb71a(0x20c)](_0x361e0e[_0x2eb71a(0x174)]));const _0x5babbb=_0x361e0e[_0x2eb71a(0x174)],_0x332c5c=new Map(),_0x2a6c23=new Map(),_0x448e56=await this['client'][_0x2eb71a(0x18a)](_0x1e4da5),_0x424582=await this[_0x2eb71a(0x1c9)][_0x2eb71a(0x231)](_0x1e4da5),_0x1bac26=await safeListOrEmpty(()=>this[_0x2eb71a(0x1c9)][_0x2eb71a(0x1fd)](_0x1e4da5)),_0x310b38=new Map(),_0x31a59f=new Map();for(const _0x14dd26 of _0x448e56){_0x332c5c['set'](_0x14dd26['id'],_0x14dd26[_0x2eb71a(0x19e)][_0x2eb71a(0x1ff)]);}for(const _0x442745 of _0x424582){_0x310b38[_0x2eb71a(0x1f8)](_0x442745['id'],_0x442745['attributes'][_0x2eb71a(0x1ff)]);}for(const _0x4c5c84 of _0x1bac26){_0x31a59f[_0x2eb71a(0x1f8)](_0x4c5c84['id'],_0x4c5c84[_0x2eb71a(0x19e)][_0x2eb71a(0x1ff)]);}for(const _0x494910 of _0x2c2b66){_0x2a6c23['set'](_0x494910['id'],_0x494910[_0x2eb71a(0x19e)]['name']);}const _0x56bffb={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x332c5c,'TextKnowledgeBase':_0x310b38,'Agent':_0x2a6c23,'ExperimentalKnowledgeBase':_0x31a59f}),'resolvePromptName':async()=>undefined,'onWarning':_0x46922d=>this['logger'][_0x2eb71a(0x206)](_0x46922d)},_0x5d80fe=a133_0x3324d2[_0x2eb71a(0x190)](_0x5babbb,_0x2eb71a(0x13a)),_0x44f4d8=a133_0x3324d2[_0x2eb71a(0x190)](_0x5babbb,_0x2eb71a(0x120)),_0x3c2942=a133_0x3324d2[_0x2eb71a(0x190)](_0x5babbb,_0x2eb71a(0x194)),_0x2f1bc7=!a133_0x1b52fe['existsSync'](_0x44f4d8);if(_0x5d9ebc?.[_0x2eb71a(0x226)])return{'agentName':_0xeb2b60,'outputPath':_0x5babbb,'isNew':_0x2f1bc7,'hasChanges':!![]};a133_0x1b52fe[_0x2eb71a(0x121)](_0x4dad23,{'recursive':!![]}),a133_0x1b52fe[_0x2eb71a(0x121)](_0x5babbb,{'recursive':!![]});const _0x523238=a133_0x3324d2[_0x2eb71a(0x190)](_0x4dad23,_0x2eb71a(0x17e));!a133_0x1b52fe[_0x2eb71a(0x1cb)](_0x523238)&&a133_0x1b52fe[_0x2eb71a(0x207)](_0x523238,createAgentConfigContent(_0x322c8f));const {yaml:_0x7c5506,systemPrompt:_0x67960f,starterMessage:_0x190c5c}=await agentResponseToDef(_0x264d07,_0x56bffb);let _0x8c9b85=_0x2f1bc7;if(!_0x2f1bc7){const _0x187cd6=a133_0x1b52fe['existsSync'](_0x5d80fe)?a133_0x1b52fe['readFileSync'](_0x5d80fe,_0x2eb71a(0x238)):'',_0x3d8643=a133_0x1b52fe[_0x2eb71a(0x1c6)](_0x44f4d8,'utf-8');_0x8c9b85=_0x187cd6!==_0x67960f||_0x3d8643!==toAgentYamlString(_0x7c5506);}a133_0x1b52fe[_0x2eb71a(0x207)](_0x5d80fe,_0x67960f),a133_0x1b52fe['writeFileSync'](_0x44f4d8,toAgentYamlString(_0x7c5506));if(_0x190c5c&&_0x190c5c['includes']('\x0a'))a133_0x1b52fe['writeFileSync'](_0x3c2942,_0x190c5c);else a133_0x1b52fe['existsSync'](_0x3c2942)&&a133_0x1b52fe[_0x2eb71a(0x1ef)](_0x3c2942);return{'agentName':_0xeb2b60,'outputPath':_0x5babbb,'isNew':_0x2f1bc7,'hasChanges':_0x8c9b85};}async[a133_0x4f6d4d(0x193)](_0x2abdfc,_0x2107f2){const _0xc7897f=a133_0x4f6d4d;let _0x2291e9;isAgentYamlPath(_0x2abdfc)?_0x2291e9=getAgentDirFromYamlPath(_0x2abdfc):_0x2291e9=_0x2abdfc;const {config:_0x3d7bdd}=findAgentConfig(_0x2291e9),_0x17fe50=await this[_0xc7897f(0x197)](_0x3d7bdd[_0xc7897f(0x1b4)]),_0x4ee892=a133_0x3324d2[_0xc7897f(0x190)](_0x2291e9,_0xc7897f(0x120)),_0x5b81fb=a133_0x3324d2[_0xc7897f(0x190)](_0x2291e9,'prompt.md'),_0x2c38ac=a133_0x3324d2[_0xc7897f(0x190)](_0x2291e9,'starter_message.md');if(!a133_0x1b52fe[_0xc7897f(0x1cb)](_0x4ee892))throw new SDKError(ErrorCode[_0xc7897f(0x210)],'agent.yml\x20not\x20found\x20in\x20'+_0x2291e9,undefined,{'helpText':_0xc7897f(0x1bb)});const _0x5a0442=parseAgentYaml(a133_0x1b52fe[_0xc7897f(0x1c6)](_0x4ee892,'utf-8'),_0x4ee892),_0x443948=a133_0x1b52fe[_0xc7897f(0x1cb)](_0x5b81fb)?a133_0x1b52fe[_0xc7897f(0x1c6)](_0x5b81fb,_0xc7897f(0x238)):'',_0xea3edf=a133_0x1b52fe[_0xc7897f(0x1cb)](_0x2c38ac)?a133_0x1b52fe[_0xc7897f(0x1c6)](_0x2c38ac,'utf-8'):_0x5a0442['starter_message'];if(_0x2107f2?.['dryRun'])return{'agentName':_0x5a0442[_0xc7897f(0x1ff)],'action':_0xc7897f(0x141),'projectId':_0x17fe50};const _0x46372a=await this['client']['listAgentsFull'](_0x17fe50),_0x6f6ed0=await fetchAllToolTargetMaps((_0x31e6b8,_0x5b3e2f)=>this[_0xc7897f(0x1c9)][_0xc7897f(0x189)](_0x31e6b8,_0x5b3e2f),_0x17fe50),_0x1c180c=new Map();for(const _0x3dbd02 of _0x46372a){_0x1c180c['set'](_0x3dbd02['attributes'][_0xc7897f(0x1ff)],_0x3dbd02['id']);}const _0x1a8c09=[],_0x5271b1={'projectId':_0x17fe50,'resolveToolTargetId':buildIdResolver({..._0x6f6ed0['nameToId'],'Agent':_0x1c180c}),'resolvePromptId':async()=>undefined,'onWarning':_0x391bcb=>{const _0x38acff=_0xc7897f;this[_0x38acff(0x147)][_0x38acff(0x206)](_0x391bcb),_0x1a8c09[_0x38acff(0x13f)](_0x391bcb);}};try{const _0x110e5e=_0x46372a['find'](_0x4d3c57=>_0x4d3c57[_0xc7897f(0x19e)][_0xc7897f(0x1ff)]===_0x5a0442[_0xc7897f(0x1ff)]),_0x1c2625=await agentDefToRequest(_0x5a0442,_0x443948,_0xea3edf,_0x5271b1);if(_0x110e5e)return await this[_0xc7897f(0x1c9)][_0xc7897f(0x1f0)](_0x110e5e['id'],_0x1c2625),{'agentName':_0x5a0442[_0xc7897f(0x1ff)],'action':_0xc7897f(0x233),'projectId':_0x17fe50,'agentId':_0x110e5e['id'],'warnings':_0x1a8c09[_0xc7897f(0x21c)]>0x0?_0x1a8c09:undefined};else{const _0x4390c6=await this[_0xc7897f(0x1c9)][_0xc7897f(0x131)](_0x1c2625);return{'agentName':_0x5a0442['name'],'action':_0xc7897f(0x141),'projectId':_0x17fe50,'agentId':_0x4390c6['id'],'warnings':_0x1a8c09['length']>0x0?_0x1a8c09:undefined};}}catch(_0x1ffee1){return{'agentName':_0x5a0442[_0xc7897f(0x1ff)],'action':'error','projectId':_0x17fe50,'error':_0x1ffee1['message'],'warnings':_0x1a8c09[_0xc7897f(0x21c)]>0x0?_0x1a8c09:undefined};}}async['cloneProject'](_0x1ddf2b,_0x1ca9e7,_0x5dfcaa){const _0x45574f=a133_0x4f6d4d,_0x163933=a133_0x1b52fe[_0x45574f(0x1cb)](_0x1ddf2b)&&a133_0x1b52fe[_0x45574f(0x1cb)](a133_0x3324d2[_0x45574f(0x190)](_0x1ddf2b,_0x45574f(0x17e)));let _0x27218f;const _0x56be0c=[],_0xee802f=[],_0x37cc99=[],_0x420851=[],_0xa1c9d9=[],_0x5b7842=[],_0x45907b=[],_0xbf1430=[],_0x55a4b6=[];if(_0x163933){const _0x6691bb=loadAgentConfig(a133_0x3324d2[_0x45574f(0x190)](_0x1ddf2b,'tdx.json'));_0x27218f=_0x6691bb[_0x45574f(0x1b4)];const _0x2979bd=a133_0x1b52fe[_0x45574f(0x164)](_0x1ddf2b,{'withFileTypes':!![]});for(const _0x3f1c5e of _0x2979bd){if(!_0x3f1c5e[_0x45574f(0x16c)]())continue;if([_0x45574f(0x126),'experimental_knowledge_bases',_0x45574f(0x21d),'prompts',_0x45574f(0x17c),_0x45574f(0x191),_0x45574f(0x148)][_0x45574f(0x17f)](_0x3f1c5e['name']))continue;const _0x283b26=a133_0x3324d2[_0x45574f(0x190)](_0x1ddf2b,_0x3f1c5e['name']);if(isAgentDir(_0x283b26)){const _0x1f4090=a133_0x3324d2[_0x45574f(0x190)](_0x283b26,_0x45574f(0x120)),_0x4b43ff=a133_0x3324d2[_0x45574f(0x190)](_0x283b26,_0x45574f(0x13a)),_0x4ea2aa=a133_0x3324d2[_0x45574f(0x190)](_0x283b26,_0x45574f(0x194)),_0x319998=parseAgentYaml(a133_0x1b52fe[_0x45574f(0x1c6)](_0x1f4090,_0x45574f(0x238)),_0x1f4090),_0x3091dd=a133_0x1b52fe[_0x45574f(0x1cb)](_0x4b43ff)?a133_0x1b52fe[_0x45574f(0x1c6)](_0x4b43ff,_0x45574f(0x238)):'',_0xa138a4=a133_0x1b52fe[_0x45574f(0x1cb)](_0x4ea2aa)?a133_0x1b52fe[_0x45574f(0x1c6)](_0x4ea2aa,_0x45574f(0x238)):_0x319998[_0x45574f(0x20b)];_0x56be0c['push']({'name':_0x319998[_0x45574f(0x1ff)],'dir':_0x283b26,'yaml':_0x319998,'systemPrompt':_0x3091dd,'starterMessage':_0xa138a4});}}const _0x411a03=getKnowledgeBasesDir(_0x1ddf2b);if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x411a03)){const _0x4bf9e6=a133_0x1b52fe[_0x45574f(0x164)](_0x411a03);for(const _0x4f6b21 of _0x4bf9e6){const _0x1bb6a4=a133_0x3324d2[_0x45574f(0x190)](_0x411a03,_0x4f6b21);if(_0x4f6b21[_0x45574f(0x218)]('.yml')){const _0x1c3b58=parseKnowledgeBaseYaml(a133_0x1b52fe[_0x45574f(0x1c6)](_0x1bb6a4,_0x45574f(0x238)),_0x1bb6a4);_0xee802f[_0x45574f(0x13f)]({'name':_0x1c3b58[_0x45574f(0x1ff)],'path':_0x1bb6a4,'yaml':_0x1c3b58});}else{if(_0x4f6b21[_0x45574f(0x218)]('.md')){const _0x5796c7=a133_0x1b52fe[_0x45574f(0x1c6)](_0x1bb6a4,'utf-8'),{name:_0x5c38a9,text:_0xd8845b}=parseTextKnowledgeBaseMd(_0x5796c7,_0x4f6b21);_0x37cc99[_0x45574f(0x13f)]({'name':_0x5c38a9,'path':_0x1bb6a4,'text':_0xd8845b});}}}}const _0x2e45cc=getPromptsDir(_0x1ddf2b);if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x2e45cc)){const _0xee74b9=a133_0x1b52fe['readdirSync'](_0x2e45cc)[_0x45574f(0x20e)](_0xeba942=>_0xeba942['endsWith'](_0x45574f(0x1eb)));for(const _0x112638 of _0xee74b9){const _0x595fbc=a133_0x3324d2[_0x45574f(0x190)](_0x2e45cc,_0x112638),_0x213237=parsePromptYaml(a133_0x1b52fe[_0x45574f(0x1c6)](_0x595fbc,_0x45574f(0x238)),_0x595fbc);_0x420851[_0x45574f(0x13f)]({'name':_0x213237[_0x45574f(0x1ff)],'path':_0x595fbc,'yaml':_0x213237});}}const _0x5ae942=getIntegrationsDir(_0x1ddf2b);if(a133_0x1b52fe['existsSync'](_0x5ae942)){const _0xdb3518=a133_0x1b52fe['readdirSync'](_0x5ae942)[_0x45574f(0x20e)](_0x26176f=>_0x26176f[_0x45574f(0x218)](_0x45574f(0x1eb)));for(const _0x267cb4 of _0xdb3518){const _0x16b200=a133_0x3324d2[_0x45574f(0x190)](_0x5ae942,_0x267cb4),_0x38b470=parseIntegrationYaml(a133_0x1b52fe['readFileSync'](_0x16b200,_0x45574f(0x238)),_0x16b200);SAFE_INTEGRATION_TYPES['includes'](_0x38b470[_0x45574f(0x1fa)]['toLowerCase']())?_0xa1c9d9[_0x45574f(0x13f)]({'name':_0x38b470[_0x45574f(0x1ff)],'path':_0x16b200,'yaml':_0x38b470}):this[_0x45574f(0x147)][_0x45574f(0x206)](_0x45574f(0x1a9)+_0x38b470[_0x45574f(0x1ff)]+'\x27\x20('+_0x38b470[_0x45574f(0x1fa)]+_0x45574f(0x1ec)+(_0x45574f(0x1c5)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x45574f(0x127)));}}const _0x12190c=getExperimentalKnowledgeBasesDir(_0x1ddf2b);if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x12190c)){const _0xb46151=a133_0x1b52fe[_0x45574f(0x164)](_0x12190c,{'withFileTypes':!![]});for(const _0x4cd02d of _0xb46151){if(!_0x4cd02d[_0x45574f(0x16c)]())continue;const _0x5f32a5=a133_0x3324d2['join'](_0x12190c,_0x4cd02d[_0x45574f(0x1ff)]),_0x4e80d7=a133_0x3324d2[_0x45574f(0x190)](_0x5f32a5,_0x4cd02d[_0x45574f(0x1ff)]+'.yml');if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x4e80d7)){const _0x542206=parseExperimentalKnowledgeBaseYaml(a133_0x1b52fe[_0x45574f(0x1c6)](_0x4e80d7,_0x45574f(0x238)),_0x4e80d7),_0x3f9a8e=a133_0x3324d2[_0x45574f(0x190)](_0x5f32a5,_0x45574f(0x17a)),_0x59b992=[];if(a133_0x1b52fe['existsSync'](_0x3f9a8e)){const _0x37a615=a133_0x1b52fe[_0x45574f(0x164)](_0x3f9a8e,{'withFileTypes':!![]});for(const _0x44ae3e of _0x37a615){if(!_0x44ae3e[_0x45574f(0x16c)]())continue;const _0x5efa6d=a133_0x3324d2[_0x45574f(0x190)](_0x3f9a8e,_0x44ae3e[_0x45574f(0x1ff)]),_0x192799=a133_0x3324d2[_0x45574f(0x190)](_0x5efa6d,_0x45574f(0x1db)),_0x19ccb8=a133_0x3324d2[_0x45574f(0x190)](_0x5efa6d,_0x45574f(0x216));if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x192799)&&a133_0x1b52fe[_0x45574f(0x1cb)](_0x19ccb8)){const _0x1bba7d=a133_0x1b52fe['readFileSync'](_0x192799,_0x45574f(0x238)),_0x226b1e=a133_0x1b52fe['readFileSync'](_0x19ccb8,'utf-8');_0x59b992[_0x45574f(0x13f)]({'name':_0x44ae3e[_0x45574f(0x1ff)],'code':_0x1bba7d,'json_schema':_0x226b1e});}}}const _0x2087dc={..._0x542206,'functions':_0x59b992};_0x5b7842['push']({'name':_0x542206[_0x45574f(0x1ff)],'path':_0x5f32a5,'def':_0x2087dc});}}}const _0x13a538=getExperimentalArtifactsDir(_0x1ddf2b);if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x13a538)){const _0x47cc34=a133_0x1b52fe[_0x45574f(0x164)](_0x13a538,{'withFileTypes':!![]});for(const _0x4d88be of _0x47cc34){if(!_0x4d88be[_0x45574f(0x16c)]())continue;const _0x3be26b=a133_0x3324d2[_0x45574f(0x190)](_0x13a538,_0x4d88be[_0x45574f(0x1ff)]),_0x296e77=a133_0x3324d2[_0x45574f(0x190)](_0x3be26b,_0x4d88be['name']+_0x45574f(0x1eb));if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x296e77)){const _0x22c55a=parseExperimentalArtifactYaml(a133_0x1b52fe['readFileSync'](_0x296e77,_0x45574f(0x238)),_0x296e77),_0x155f1f=a133_0x3324d2[_0x45574f(0x190)](_0x3be26b,_0x45574f(0x1db)),_0x1eb908=a133_0x1b52fe[_0x45574f(0x1cb)](_0x155f1f)?a133_0x1b52fe[_0x45574f(0x1c6)](_0x155f1f,'utf-8'):'',_0x1ffed1=a133_0x3324d2[_0x45574f(0x190)](_0x3be26b,_0x45574f(0x11e)),_0x3f1d72=[];if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x1ffed1)){const _0x13d749=a133_0x1b52fe[_0x45574f(0x164)](_0x1ffed1);for(const _0x281214 of _0x13d749){const _0x41e5e=a133_0x3324d2['join'](_0x1ffed1,_0x281214);if(a133_0x1b52fe[_0x45574f(0x1b5)](_0x41e5e)[_0x45574f(0x167)]()){const _0x1c4df5=a133_0x1b52fe[_0x45574f(0x1c6)](_0x41e5e,_0x45574f(0x238));_0x3f1d72[_0x45574f(0x13f)]({'file_name':_0x281214,'text_content':_0x1c4df5});}}}const _0x52f64a={..._0x22c55a,'code':_0x1eb908,'files':_0x3f1d72};_0x45907b[_0x45574f(0x13f)]({'name':_0x22c55a[_0x45574f(0x1ff)],'path':_0x3be26b,'def':_0x52f64a});}}}const _0x36b4bb=getFormInterfacesDir(_0x1ddf2b);if(a133_0x1b52fe[_0x45574f(0x1cb)](_0x36b4bb)){const _0x1c6a18=a133_0x1b52fe['readdirSync'](_0x36b4bb)[_0x45574f(0x20e)](_0x35b894=>_0x35b894['endsWith'](_0x45574f(0x1eb)));for(const _0x5e7d22 of _0x1c6a18){const _0x541065=a133_0x3324d2[_0x45574f(0x190)](_0x36b4bb,_0x5e7d22),_0x53817d=parseFormInterfaceYaml(a133_0x1b52fe[_0x45574f(0x1c6)](_0x541065,'utf-8'),_0x541065);_0xbf1430[_0x45574f(0x13f)]({'name':_0x53817d[_0x45574f(0x1ff)],'path':_0x541065,'yaml':_0x53817d});}}const _0xf43ead=getChatInterfacesDir(_0x1ddf2b);if(a133_0x1b52fe[_0x45574f(0x1cb)](_0xf43ead)){const _0x4f98fd=a133_0x1b52fe['readdirSync'](_0xf43ead)['filter'](_0x6ab9f6=>_0x6ab9f6['endsWith'](_0x45574f(0x1eb)));for(const _0x11e96d of _0x4f98fd){const _0x99d25f=a133_0x3324d2[_0x45574f(0x190)](_0xf43ead,_0x11e96d),_0x3c46bc=parseChatInterfaceYaml(a133_0x1b52fe['readFileSync'](_0x99d25f,_0x45574f(0x238)),_0x99d25f);_0x55a4b6[_0x45574f(0x13f)]({'name':_0x3c46bc[_0x45574f(0x1ff)],'path':_0x99d25f,'yaml':_0x3c46bc});}}}else{const _0x5e03c4=await this[_0x45574f(0x197)](_0x1ddf2b),_0x52af63=await this[_0x45574f(0x1c9)][_0x45574f(0x1b7)](_0x5e03c4);_0x27218f=_0x52af63[_0x45574f(0x19e)][_0x45574f(0x1ff)];const _0x30b0b2=await this['client'][_0x45574f(0x13b)](_0x5e03c4),_0x3b07ef=await this['client']['listKnowledgeBases'](_0x5e03c4),_0x19c521=await this[_0x45574f(0x1c9)][_0x45574f(0x231)](_0x5e03c4),_0x2fa3ff=await this[_0x45574f(0x1c9)][_0x45574f(0x158)](_0x5e03c4),_0x238288=await this[_0x45574f(0x1c9)][_0x45574f(0x1d1)](_0x5e03c4),_0x4f007c=await safeListOrEmpty(()=>this[_0x45574f(0x1c9)][_0x45574f(0x1fd)](_0x5e03c4)),_0xaaea1b=await safeListOrEmpty(()=>this['client']['listExperimentalArtifacts'](_0x5e03c4)),_0x518227=new Map(),_0x415d01=new Map(),_0x1b7159=new Map(),_0x1adebf=new Map(),_0x52eb6d=new Map(),_0x4cac54=new Map();for(const _0xdad27a of _0x3b07ef){_0x518227[_0x45574f(0x1f8)](_0xdad27a['id'],_0xdad27a[_0x45574f(0x19e)][_0x45574f(0x1ff)]);}for(const _0xeb1144 of _0x19c521){_0x415d01[_0x45574f(0x1f8)](_0xeb1144['id'],_0xeb1144[_0x45574f(0x19e)]['name']);}for(const _0x591bd5 of _0x30b0b2){_0x1b7159[_0x45574f(0x1f8)](_0x591bd5['id'],_0x591bd5['attributes'][_0x45574f(0x1ff)]);}for(const _0x2bdd08 of _0x2fa3ff){_0x1adebf[_0x45574f(0x1f8)](_0x2bdd08['id'],_0x2bdd08[_0x45574f(0x19e)][_0x45574f(0x1ff)]);}for(const _0x3e6904 of _0x4f007c){_0x52eb6d[_0x45574f(0x1f8)](_0x3e6904['id'],_0x3e6904[_0x45574f(0x19e)][_0x45574f(0x1ff)]);}for(const _0x35f073 of _0xaaea1b){_0x4cac54[_0x45574f(0x1f8)](_0x35f073['id'],_0x35f073[_0x45574f(0x19e)][_0x45574f(0x1ff)]);}const _0x4d0184={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x518227,'TextKnowledgeBase':_0x415d01,'Agent':_0x1b7159,'ExperimentalKnowledgeBase':_0x52eb6d}),'resolvePromptName':async _0x19e655=>_0x1adebf[_0x45574f(0x1d3)](_0x19e655),'onWarning':_0x23ad9b=>this[_0x45574f(0x147)]['warn'](_0x23ad9b)};for(const _0x22da6f of _0x30b0b2){const _0x121e98=await agentResponseToDef(_0x22da6f,_0x4d0184),{yaml:_0x166227,systemPrompt:_0x1f78a1,starterMessage:_0x28f1c3}=_0x121e98;_0x56be0c['push']({'name':_0x166227[_0x45574f(0x1ff)],'dir':'','yaml':_0x166227,'systemPrompt':_0x1f78a1,'starterMessage':_0x28f1c3});}for(const _0x1b8fcd of _0x3b07ef){const _0x5e0921=apiKnowledgeBaseToYaml(_0x1b8fcd);_0xee802f['push']({'name':_0x5e0921[_0x45574f(0x1ff)],'path':'','yaml':_0x5e0921});}for(const _0x4e07d0 of _0x19c521){_0x37cc99['push']({'name':_0x4e07d0['attributes']['name'],'path':'','text':_0x4e07d0['attributes']['text']});}for(const _0x584f43 of _0x2fa3ff){const _0x47a808=await apiPromptToYaml(_0x584f43,_0x4d0184);_0x47a808&&_0x420851[_0x45574f(0x13f)]({'name':_0x47a808['name'],'path':'','yaml':_0x47a808});}for(const _0x37ff5d of _0x238288){if(!_0x37ff5d['attributes'][_0x45574f(0x1f7)]&&SAFE_INTEGRATION_TYPES[_0x45574f(0x17f)](_0x37ff5d['attributes'][_0x45574f(0x1ae)]['toLowerCase']())){const _0x30451e=await apiIntegrationToYaml(_0x37ff5d,_0x4d0184);_0xa1c9d9[_0x45574f(0x13f)]({'name':_0x37ff5d[_0x45574f(0x19e)][_0x45574f(0x1ae)]['toLowerCase'](),'path':'','yaml':_0x30451e});}}for(const _0x228ace of _0x4f007c){const _0x30d19e=apiExperimentalKnowledgeBaseToYaml(_0x228ace);_0x5b7842[_0x45574f(0x13f)]({'name':_0x30d19e['name'],'path':'','def':_0x30d19e});}for(const _0x57b7d6 of _0xaaea1b){const _0xf37f7=apiExperimentalArtifactToYaml(_0x57b7d6);_0x45907b[_0x45574f(0x13f)]({'name':_0xf37f7[_0x45574f(0x1ff)],'path':'','def':_0xf37f7});}const _0x1856aa=await safeListOrEmpty(()=>this[_0x45574f(0x1c9)][_0x45574f(0x17d)](_0x5e03c4));for(const _0x2c63a7 of _0x1856aa){const _0x211634=await apiFormInterfaceToYaml(_0x2c63a7,_0x4d0184);_0xbf1430[_0x45574f(0x13f)]({'name':_0x211634[_0x45574f(0x1ff)],'path':'','yaml':_0x211634});}const _0x885f64=await safeListOrEmpty(()=>this['client']['listChatInterfaces'](_0x5e03c4));for(const _0x10866b of _0x885f64){if(_0x10866b[_0x45574f(0x19e)]['isManaged'])continue;const _0x46bf4f=await apiChatInterfaceToYaml(_0x10866b,_0x4d0184);_0x55a4b6[_0x45574f(0x13f)]({'name':_0x46bf4f[_0x45574f(0x1ff)],'path':'','yaml':_0x46bf4f});}}const _0x1585b8={'sourceProjectName':_0x27218f,'newProjectName':_0x1ca9e7,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'imageGenerators':{'created':0x0,'errors':0x0},'webSearchTools':{'created':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'errors':0x0}}},_0xc4b141=await this[_0x45574f(0x1c9)][_0x45574f(0x22e)](),_0x4895bc=_0xc4b141[_0x45574f(0x12a)](_0x56c071=>_0x56c071['attributes'][_0x45574f(0x1ff)]===_0x1ca9e7);if(_0x4895bc)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x45574f(0x152)+_0x1ca9e7+_0x45574f(0x16f),undefined,{'helpText':_0x45574f(0x119)});if(_0x5dfcaa?.['dryRun'])return _0x1585b8['counts'][_0x45574f(0x1c3)][_0x45574f(0x141)]=_0x56be0c[_0x45574f(0x21c)],_0x1585b8['counts'][_0x45574f(0x1d0)][_0x45574f(0x141)]=_0xee802f[_0x45574f(0x21c)],_0x1585b8['counts'][_0x45574f(0x23a)][_0x45574f(0x141)]=_0x37cc99[_0x45574f(0x21c)],_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x192)]['created']=_0x5b7842[_0x45574f(0x21c)],_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x1f9)]['created']=_0x45907b[_0x45574f(0x21c)],_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x1ad)][_0x45574f(0x141)]=_0x420851[_0x45574f(0x21c)],_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x17c)]['created']=_0xa1c9d9[_0x45574f(0x21c)],_0x1585b8;const _0x3938aa=await this[_0x45574f(0x1c9)][_0x45574f(0x18f)]({'name':_0x1ca9e7}),_0x54597a=_0x3938aa['id'];_0x1585b8['newProjectId']=_0x54597a;const _0x1bbd4c=new Map(),_0x2e0c56=new Map(),_0x510a9f=new Map(),_0x533c1a=new Map(),_0x2c9fef=new Map(),_0x399a6b=new Map(),_0x245323=new Map(),_0x51b324=new Map(),_0x171566=new Set(),_0x1815fa=new Set();for(const _0x58040e of _0x56be0c){for(const _0x45345e of _0x58040e[_0x45574f(0x1f2)][_0x45574f(0x172)]||[]){if(_0x45345e[_0x45574f(0x18e)]===_0x45574f(0x1da)&&_0x45345e[_0x45574f(0x1d4)]){const _0x3d2323=parseRef(_0x45345e['target']);if(_0x3d2323)_0x171566[_0x45574f(0x12e)](_0x3d2323[_0x45574f(0x1ff)]);}else{if(_0x45345e[_0x45574f(0x18e)]==='web_search'&&_0x45345e[_0x45574f(0x1d4)]){const _0x24152c=parseRef(_0x45345e[_0x45574f(0x1d4)]);if(_0x24152c)_0x1815fa[_0x45574f(0x12e)](_0x24152c['name']);}}}}for(const _0xed867b of _0x171566){try{const _0x3472dd=await this['client'][_0x45574f(0x145)]({'projectId':_0x54597a,'name':_0xed867b});_0x2c9fef[_0x45574f(0x1f8)](_0xed867b,_0x3472dd['id']),_0x1585b8[_0x45574f(0x149)][_0x45574f(0x13f)]({'name':_0xed867b,'action':'created','id':_0x3472dd['id']}),_0x1585b8['counts'][_0x45574f(0x149)]['created']++;}catch(_0x7302){_0x1585b8[_0x45574f(0x149)]['push']({'name':_0xed867b,'action':_0x45574f(0x1d9),'error':_0x7302[_0x45574f(0x214)]}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x149)][_0x45574f(0x221)]++;}}for(const _0x53b815 of _0x1815fa){try{const _0x591acf=await this[_0x45574f(0x1c9)]['createWebSearchTool']({'projectId':_0x54597a,'name':_0x53b815});_0x399a6b[_0x45574f(0x1f8)](_0x53b815,_0x591acf['id']),_0x1585b8[_0x45574f(0x15a)]['push']({'name':_0x53b815,'action':_0x45574f(0x141),'id':_0x591acf['id']}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x15a)][_0x45574f(0x141)]++;}catch(_0x18db1d){_0x1585b8[_0x45574f(0x15a)]['push']({'name':_0x53b815,'action':_0x45574f(0x1d9),'error':_0x18db1d[_0x45574f(0x214)]}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x15a)][_0x45574f(0x221)]++;}}const _0x128484=await fetchAllToolTargetMaps((_0x5ebace,_0x1e1b5b)=>this[_0x45574f(0x1c9)][_0x45574f(0x189)](_0x5ebace,_0x1e1b5b),_0x54597a);let _0x5d819c=[];const _0x8358f7={'projectId':_0x54597a,'resolveToolTargetId':buildIdResolver({..._0x128484[_0x45574f(0x128)],'KnowledgeBase':_0x1bbd4c,'TextKnowledgeBase':_0x2e0c56,'ExperimentalKnowledgeBase':_0x245323,'Agent':_0x510a9f,'WebSearchTool':_0x399a6b,'ImageGenerator':_0x2c9fef}),'resolvePromptId':async _0x255858=>_0x533c1a[_0x45574f(0x1d3)](_0x255858),'onWarning':_0x4a0de6=>{const _0x49819a=_0x45574f;this[_0x49819a(0x147)][_0x49819a(0x206)](_0x4a0de6),_0x5d819c[_0x49819a(0x13f)](_0x4a0de6);}};for(const _0x4b01ae of _0xee802f){try{const _0x334948=yamlKnowledgeBaseToApi(_0x4b01ae[_0x45574f(0x1f2)],_0x54597a),_0x2da1b7=await this[_0x45574f(0x1c9)][_0x45574f(0x1ed)](_0x334948);_0x1bbd4c[_0x45574f(0x1f8)](_0x4b01ae['yaml'][_0x45574f(0x1ff)],_0x2da1b7['id']),_0x1585b8[_0x45574f(0x1d0)][_0x45574f(0x13f)]({'name':_0x4b01ae[_0x45574f(0x1f2)][_0x45574f(0x1ff)],'action':_0x45574f(0x141),'id':_0x2da1b7['id']}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x1d0)][_0x45574f(0x141)]++;}catch(_0x1d688e){_0x1585b8[_0x45574f(0x1d0)][_0x45574f(0x13f)]({'name':_0x4b01ae[_0x45574f(0x1f2)][_0x45574f(0x1ff)],'action':_0x45574f(0x1d9),'error':_0x1d688e[_0x45574f(0x214)]}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x1d0)][_0x45574f(0x221)]++;}}for(const _0x41bd8e of _0x37cc99){try{const _0x1e734f=yamlTextKnowledgeBaseToApi({'name':_0x41bd8e[_0x45574f(0x1ff)],'text':_0x41bd8e[_0x45574f(0x21a)]},_0x54597a),_0x87d2b0=await this['client'][_0x45574f(0x1c2)](_0x1e734f);_0x2e0c56['set'](_0x41bd8e[_0x45574f(0x1ff)],_0x87d2b0['id']),_0x1585b8[_0x45574f(0x23a)]['push']({'name':_0x41bd8e[_0x45574f(0x1ff)],'action':_0x45574f(0x141),'id':_0x87d2b0['id']}),_0x1585b8['counts'][_0x45574f(0x23a)][_0x45574f(0x141)]++;}catch(_0x35a2bf){_0x1585b8[_0x45574f(0x23a)][_0x45574f(0x13f)]({'name':_0x41bd8e[_0x45574f(0x1ff)],'action':_0x45574f(0x1d9),'error':_0x35a2bf[_0x45574f(0x214)]}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x23a)][_0x45574f(0x221)]++;}}for(const _0x5b9f9f of _0x45907b){try{const _0x5a9148=yamlExperimentalArtifactToApi(_0x5b9f9f['def'],_0x54597a),_0x374c2=await this[_0x45574f(0x1c9)][_0x45574f(0x1b0)](_0x5a9148);_0x51b324[_0x45574f(0x1f8)](_0x5b9f9f[_0x45574f(0x1e1)][_0x45574f(0x1ff)],_0x374c2['id']),_0x1585b8['experimentalArtifacts'][_0x45574f(0x13f)]({'name':_0x5b9f9f[_0x45574f(0x1e1)][_0x45574f(0x1ff)],'action':_0x45574f(0x141),'id':_0x374c2['id']}),_0x1585b8['counts'][_0x45574f(0x1f9)][_0x45574f(0x141)]++;}catch(_0x3d4332){_0x1585b8[_0x45574f(0x1f9)]['push']({'name':_0x5b9f9f[_0x45574f(0x1e1)][_0x45574f(0x1ff)],'action':_0x45574f(0x1d9),'error':_0x3d4332['message']}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x1f9)][_0x45574f(0x221)]++;}}for(const _0x57658d of _0x5b7842){try{const _0x3b6163=yamlExperimentalKnowledgeBaseToApi(_0x57658d['def'],_0x54597a),_0x54865a=await this[_0x45574f(0x1c9)][_0x45574f(0x12b)](_0x3b6163);_0x245323[_0x45574f(0x1f8)](_0x57658d[_0x45574f(0x1e1)][_0x45574f(0x1ff)],_0x54865a['id']),_0x1585b8[_0x45574f(0x192)][_0x45574f(0x13f)]({'name':_0x57658d[_0x45574f(0x1e1)][_0x45574f(0x1ff)],'action':'created','id':_0x54865a['id']}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x192)][_0x45574f(0x141)]++;}catch(_0xcf4259){_0x1585b8[_0x45574f(0x192)][_0x45574f(0x13f)]({'name':_0x57658d['def'][_0x45574f(0x1ff)],'action':_0x45574f(0x1d9),'error':_0xcf4259[_0x45574f(0x214)]}),_0x1585b8['counts']['experimentalKnowledgeBases']['errors']++;}}const _0x5c8c96=[..._0x56be0c]['sort']((_0x9160e1,_0x272778)=>{const _0x3dc15e=_0x45574f,_0x58d732=_0x9160e1[_0x3dc15e(0x1f2)][_0x3dc15e(0x172)]?.['some'](_0x3536fa=>_0x3536fa[_0x3dc15e(0x18e)]==='agent')??![],_0xa4970=_0x272778[_0x3dc15e(0x1f2)][_0x3dc15e(0x172)]?.['some'](_0x52408a=>_0x52408a['type']===_0x3dc15e(0x183))??![];if(_0x58d732&&!_0xa4970)return 0x1;if(!_0x58d732&&_0xa4970)return-0x1;return 0x0;});for(const _0x4e8cce of _0x5c8c96){_0x5d819c=[];try{const _0x1a91f9=_0x4e8cce[_0x45574f(0x1f2)]['tools']?.[_0x45574f(0x20e)](_0x207df6=>{const _0x45c774=_0x45574f;if(_0x207df6['type']===_0x45c774(0x183)&&_0x207df6[_0x45c774(0x1d4)]){const _0x575240=parseRef(_0x207df6[_0x45c774(0x1d4)]);return _0x575240?.[_0x45c774(0x1ff)]===_0x4e8cce[_0x45c774(0x1f2)]['name'];}return![];})??[];if(_0x1a91f9[_0x45574f(0x21c)]>0x0){const _0x37e30f=_0x45574f(0x132)+_0x4e8cce['yaml'][_0x45574f(0x1ff)]+_0x45574f(0x151)+_0x45574f(0x155);this[_0x45574f(0x147)][_0x45574f(0x206)](_0x37e30f),_0x5d819c[_0x45574f(0x13f)](_0x37e30f);}const _0x52762d=await agentDefToRequest(_0x4e8cce[_0x45574f(0x1f2)],_0x4e8cce[_0x45574f(0x200)],_0x4e8cce[_0x45574f(0x1bc)],_0x8358f7),_0xb14208=await this[_0x45574f(0x1c9)][_0x45574f(0x131)](_0x52762d);_0x510a9f[_0x45574f(0x1f8)](_0x4e8cce[_0x45574f(0x1f2)][_0x45574f(0x1ff)],_0xb14208['id']),_0x1585b8[_0x45574f(0x1c3)][_0x45574f(0x13f)]({'agentName':_0x4e8cce[_0x45574f(0x1f2)]['name'],'action':'created','agentId':_0xb14208['id'],'warnings':_0x5d819c[_0x45574f(0x21c)]>0x0?_0x5d819c:undefined}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x1c3)][_0x45574f(0x141)]++;}catch(_0x36bae6){_0x1585b8[_0x45574f(0x1c3)][_0x45574f(0x13f)]({'agentName':_0x4e8cce[_0x45574f(0x1f2)][_0x45574f(0x1ff)],'action':'error','error':_0x36bae6[_0x45574f(0x214)],'warnings':_0x5d819c['length']>0x0?_0x5d819c:undefined}),_0x1585b8[_0x45574f(0x20a)]['agents'][_0x45574f(0x221)]++;}}for(const _0x3fe225 of _0x420851){try{const _0x59dca6=await yamlPromptToApi(_0x3fe225[_0x45574f(0x1f2)],_0x54597a,_0x8358f7);if(!_0x59dca6){_0x1585b8[_0x45574f(0x1ad)][_0x45574f(0x13f)]({'name':_0x3fe225[_0x45574f(0x1f2)][_0x45574f(0x1ff)],'action':_0x45574f(0x1d9),'error':_0x45574f(0x22d)}),_0x1585b8[_0x45574f(0x20a)]['prompts'][_0x45574f(0x221)]++;continue;}const _0x31b95f=await this[_0x45574f(0x1c9)][_0x45574f(0x179)](_0x59dca6);_0x533c1a['set'](_0x3fe225[_0x45574f(0x1f2)]['name'],_0x31b95f['id']),_0x1585b8['prompts'][_0x45574f(0x13f)]({'name':_0x3fe225[_0x45574f(0x1f2)]['name'],'action':_0x45574f(0x141),'id':_0x31b95f['id']}),_0x1585b8[_0x45574f(0x20a)]['prompts'][_0x45574f(0x141)]++;}catch(_0x11a9f9){_0x1585b8[_0x45574f(0x1ad)][_0x45574f(0x13f)]({'name':_0x3fe225[_0x45574f(0x1f2)][_0x45574f(0x1ff)],'action':_0x45574f(0x1d9),'error':_0x11a9f9[_0x45574f(0x214)]}),_0x1585b8[_0x45574f(0x20a)]['prompts']['errors']++;}}for(const _0x4acbb4 of _0xa1c9d9){try{const _0x2aef7e=await yamlIntegrationToApi(_0x4acbb4[_0x45574f(0x1f2)],_0x54597a,_0x8358f7),_0x10c837=await this['client'][_0x45574f(0x12f)](_0x2aef7e);_0x1585b8[_0x45574f(0x17c)][_0x45574f(0x13f)]({'name':_0x4acbb4['yaml'][_0x45574f(0x1fa)],'action':_0x45574f(0x141),'id':_0x10c837['id']}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x17c)][_0x45574f(0x141)]++;}catch(_0x3c80d8){_0x1585b8[_0x45574f(0x17c)][_0x45574f(0x13f)]({'name':_0x4acbb4[_0x45574f(0x1f2)][_0x45574f(0x1fa)],'action':_0x45574f(0x1d9),'error':_0x3c80d8[_0x45574f(0x214)]}),_0x1585b8[_0x45574f(0x20a)]['integrations'][_0x45574f(0x221)]++;}}for(const _0x1bdbd8 of _0xbf1430){try{const _0x13eb3b=await yamlFormInterfaceToApi(_0x1bdbd8['yaml'],_0x54597a,_0x8358f7);if(!_0x13eb3b){_0x1585b8[_0x45574f(0x1dc)][_0x45574f(0x13f)]({'name':_0x1bdbd8['yaml'][_0x45574f(0x1ff)],'action':_0x45574f(0x1d9),'error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x1585b8[_0x45574f(0x20a)]['formInterfaces']['errors']++;continue;}const _0x46f7da=await this['client'][_0x45574f(0x15c)](_0x13eb3b);_0x1585b8[_0x45574f(0x1dc)]['push']({'name':_0x1bdbd8['yaml'][_0x45574f(0x1ff)],'action':_0x45574f(0x141),'id':_0x46f7da['id']}),_0x1585b8['counts'][_0x45574f(0x1dc)][_0x45574f(0x141)]++;}catch(_0x3b730d){_0x1585b8['formInterfaces']['push']({'name':_0x1bdbd8['yaml'][_0x45574f(0x1ff)],'action':'error','error':_0x3b730d['message']}),_0x1585b8[_0x45574f(0x20a)]['formInterfaces']['errors']++;}}for(const _0x2f1c1f of _0x55a4b6){try{const _0x2b801e=await yamlChatInterfaceToApi(_0x2f1c1f[_0x45574f(0x1f2)],_0x54597a,_0x8358f7),_0x7725f3=await this[_0x45574f(0x1c9)][_0x45574f(0x22b)](_0x2b801e);_0x1585b8['chatInterfaces'][_0x45574f(0x13f)]({'name':_0x2f1c1f[_0x45574f(0x1f2)][_0x45574f(0x1ff)],'action':'created','id':_0x7725f3['id']}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x1e4)]['created']++;}catch(_0x2a2f90){_0x1585b8[_0x45574f(0x1e4)][_0x45574f(0x13f)]({'name':_0x2f1c1f['yaml'][_0x45574f(0x1ff)],'action':_0x45574f(0x1d9),'error':_0x2a2f90[_0x45574f(0x214)]}),_0x1585b8[_0x45574f(0x20a)][_0x45574f(0x1e4)][_0x45574f(0x221)]++;}}return _0x1585b8;}}
|
|
1
|
+
function a133_0x1f30(_0x1198ac,_0x22f8e5){_0x1198ac=_0x1198ac-0x188;const _0x4d44ab=a133_0x4d44();let _0x1f30fb=_0x4d44ab[_0x1198ac];return _0x1f30fb;}const a133_0x4dcb58=a133_0x1f30;(function(_0xe7f96a,_0x339850){const _0x31b499=a133_0x1f30,_0x168b23=_0xe7f96a();while(!![]){try{const _0x318e75=-parseInt(_0x31b499(0x1da))/0x1*(-parseInt(_0x31b499(0x266))/0x2)+parseInt(_0x31b499(0x237))/0x3+parseInt(_0x31b499(0x19d))/0x4*(-parseInt(_0x31b499(0x1c9))/0x5)+-parseInt(_0x31b499(0x19e))/0x6*(parseInt(_0x31b499(0x20a))/0x7)+parseInt(_0x31b499(0x2a1))/0x8+parseInt(_0x31b499(0x1c3))/0x9+-parseInt(_0x31b499(0x1df))/0xa;if(_0x318e75===_0x339850)break;else _0x168b23['push'](_0x168b23['shift']());}catch(_0x445eb9){_0x168b23['push'](_0x168b23['shift']());}}}(a133_0x4d44,0xcf838));import{LLMApiClient}from'../client/llm-api-client.js';import*as a133_0x39b0da from'node:fs';import*as a133_0x371f12 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a133_0x4dcb58(0x264),'chat_agent_console','chat_parent_segment'];async function safeListOrEmpty(_0x4a7f6b){const _0x251f79=a133_0x4dcb58;try{return await _0x4a7f6b();}catch(_0x1e34f3){if(_0x1e34f3 instanceof HTTPClientError&&_0x1e34f3[_0x251f79(0x279)]===0x194)return[];throw _0x1e34f3;}}export class LLMSDK{['currentProjectId'];[a133_0x4dcb58(0x1f1)];[a133_0x4dcb58(0x1d9)];[a133_0x4dcb58(0x251)]=Logger['of'](a133_0x4dcb58(0x267));constructor(_0x5b51ca){const _0x4913f0=a133_0x4dcb58;this['client']=new LLMApiClient(_0x5b51ca),this[_0x4913f0(0x1d9)]=_0x5b51ca;}[a133_0x4dcb58(0x1a5)](){const _0x201a3a=a133_0x4dcb58,_0x4a037c=getSanitizedUsername();return _0x201a3a(0x1b8)+_0x4a037c;}async[a133_0x4dcb58(0x19c)](_0x22b6df){const _0x17c5e9=a133_0x4dcb58,{projectId:_0x2a4c05}=await this[_0x17c5e9(0x1a6)](_0x22b6df);this['currentProjectId']=_0x2a4c05;}[a133_0x4dcb58(0x1de)](){const _0x16589f=a133_0x4dcb58;return this[_0x16589f(0x1aa)];}async['setDefaultAgent'](_0x17a815){const _0x606bba=a133_0x4dcb58,_0x365edc=this[_0x606bba(0x1d9)][_0x606bba(0x23d)];let _0x5015b5,_0x3da457;if(_0x17a815[_0x606bba(0x28a)]('/')){const _0x4a749f=_0x17a815['split']('/');if(_0x4a749f[_0x606bba(0x1a7)]!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x606bba(0x253)+_0x17a815,undefined,{'helpText':'Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22'});const [_0x3cf43a,_0x7a8fc2]=_0x4a749f;_0x5015b5=await this[_0x606bba(0x219)](_0x3cf43a),_0x3da457=_0x7a8fc2;}else _0x5015b5=this[_0x606bba(0x1aa)]||(await this[_0x606bba(0x27b)]())['id'],_0x3da457=_0x17a815;const _0x44d6d5=await this['resolveAgentId'](_0x3da457,_0x5015b5),_0x53a163=await this[_0x606bba(0x1f1)]['getAgent'](_0x44d6d5);writeCachedLLMAgent(_0x53a163['attributes'][_0x606bba(0x1c6)],_0x44d6d5,_0x5015b5,_0x365edc);}[a133_0x4dcb58(0x1fe)](){const _0x1cc3d1=a133_0x4dcb58,_0x4a7fa7=this[_0x1cc3d1(0x1d9)][_0x1cc3d1(0x23d)];return readCachedLLMAgent(_0x4a7fa7)||undefined;}[a133_0x4dcb58(0x21a)](){const _0x41d375=a133_0x4dcb58,_0x5f2a5b=this[_0x41d375(0x1d9)][_0x41d375(0x23d)];clearCachedLLMAgent(_0x5f2a5b);}async[a133_0x4dcb58(0x1c5)](){const _0x4de1e0=a133_0x4dcb58,_0x41a66e=await this[_0x4de1e0(0x1f1)][_0x4de1e0(0x18e)](),_0x4f1f81=[];for(const _0x161f31 of _0x41a66e['availableModelNames']){const _0x472c72=_0x41a66e[_0x4de1e0(0x1bb)][_0x161f31];_0x472c72&&_0x4f1f81['push']({'name':_0x161f31,'displayName':_0x472c72['displayName']});}return _0x4f1f81;}async[a133_0x4dcb58(0x248)](_0x4a3f99){const _0x44dbc6=a133_0x4dcb58;return await this[_0x44dbc6(0x1f1)][_0x44dbc6(0x248)](_0x4a3f99);}async[a133_0x4dcb58(0x285)](_0x32cd5e){const _0x2fa65a=a133_0x4dcb58,{projectId:_0x51419b}=await this[_0x2fa65a(0x1a6)](_0x32cd5e);await this[_0x2fa65a(0x1f1)]['deleteProject'](_0x51419b);}async['projects'](_0x2337d5=0x32){const _0xe1d638=a133_0x4dcb58;return await this[_0xe1d638(0x1f1)][_0xe1d638(0x257)](_0x2337d5);}async[a133_0x4dcb58(0x27b)](_0x571871){const _0x19b433=a133_0x4dcb58,_0x35e115=_0x571871||this[_0x19b433(0x1a5)](),_0x22b420=this[_0x19b433(0x1d9)]['profile'];if(!_0x571871){const _0x219029=readCachedLLMProject(_0x22b420);if(_0x219029&&_0x219029[_0x19b433(0x1c6)]===_0x35e115)try{const _0x457a70=await this[_0x19b433(0x1f1)][_0x19b433(0x1bf)](_0x219029['id']);if(_0x457a70[_0x19b433(0x1a9)][_0x19b433(0x1c6)]===_0x35e115)return _0x457a70;}catch{}}const _0x7d70ab=await this[_0x19b433(0x1f1)][_0x19b433(0x257)](),_0x2f3558=_0x7d70ab[_0x19b433(0x1db)](_0x3a32f4=>_0x3a32f4[_0x19b433(0x1a9)][_0x19b433(0x1c6)]===_0x35e115);if(_0x2f3558)return!_0x571871&&writeCachedLLMProject(_0x35e115,_0x2f3558['id'],_0x22b420),_0x2f3558;const _0x55b826=await this[_0x19b433(0x1f1)][_0x19b433(0x248)]({'name':_0x35e115,'description':_0x19b433(0x260)+getSanitizedUsername()+')'});return!_0x571871&&writeCachedLLMProject(_0x35e115,_0x55b826['id'],_0x22b420),_0x55b826;}async[a133_0x4dcb58(0x219)](_0x1820af){const _0x56397e=a133_0x4dcb58,_0x30e868=await this[_0x56397e(0x1f1)][_0x56397e(0x257)](),_0x1eb9dc=_0x30e868[_0x56397e(0x1d2)](_0x1f4069=>_0x1f4069[_0x56397e(0x1a9)][_0x56397e(0x1c6)]===_0x1820af);if(_0x1eb9dc[_0x56397e(0x1a7)]===0x0)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x56397e(0x28f)+_0x1820af,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x1eb9dc[_0x56397e(0x1a7)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x56397e(0x207)+_0x1820af+'\x27.\x20This\x20should\x20not\x20happen.');return _0x1eb9dc[0x0]['id'];}async[a133_0x4dcb58(0x1a6)](_0x45811d){const _0x171a1a=a133_0x4dcb58,_0x3d59be=await this[_0x171a1a(0x1f1)]['listProjects'](),_0x4547ae=_0x3d59be[_0x171a1a(0x1db)](_0x449a38=>_0x449a38[_0x171a1a(0x1a9)][_0x171a1a(0x1c6)]===_0x45811d);if(_0x4547ae)return{'projectId':_0x4547ae['id'],'project':_0x4547ae};throw new SDKError(ErrorCode[_0x171a1a(0x29b)],_0x171a1a(0x28f)+_0x45811d,undefined,{'helpText':_0x171a1a(0x19b)});}async[a133_0x4dcb58(0x282)](_0x241fce='claude-4.5-sonnet',_0x4356b1=0x0,_0x53d10e){const _0x3af6c8=a133_0x4dcb58,_0x7f3a7a=0xa;let _0x1cf001=0x0,_0x59a616;while(_0x1cf001<_0x7f3a7a){try{const _0x12f083=await this[_0x3af6c8(0x27b)](_0x59a616),_0x5cd249=_0x12f083['id'],_0x1c6a5=[_0x3af6c8(0x1f9),'minimal','low','medium',_0x3af6c8(0x1ca)],_0x3d8dd7=_0x4356b1===0x0?_0x3af6c8(0x23f)+_0x241fce:_0x3af6c8(0x23f)+_0x241fce+_0x3af6c8(0x263)+_0x1c6a5[_0x4356b1],_0x4d4144=await this['client']['listAgents'](_0x5cd249),_0x49e7ea=_0x4d4144[_0x3af6c8(0x1db)](_0x3d1dfe=>_0x3d1dfe[_0x3af6c8(0x1a9)][_0x3af6c8(0x1c6)]===_0x3d8dd7);if(_0x49e7ea)return _0x49e7ea;const _0x54c009=_0x4356b1>0x0?0x1:_0x53d10e;return await this[_0x3af6c8(0x1f1)]['createAgent']({'name':_0x3d8dd7,'projectId':_0x5cd249,'modelType':_0x241fce,'systemPrompt':'','temperature':_0x54c009,'reasoningEffort':_0x4356b1>0x0?_0x4356b1:undefined});}catch(_0x60f262){if(_0x60f262 instanceof HTTPClientError){const _0x428e4b=_0x60f262[_0x3af6c8(0x279)];if(_0x428e4b>=0x190&&_0x428e4b<0x1f4){if(_0x428e4b===0x191)throw new SDKError(ErrorCode[_0x3af6c8(0x1be)],_0x3af6c8(0x1dd),_0x60f262);else{if(_0x428e4b===0x193)throw new SDKError(ErrorCode[_0x3af6c8(0x21c)],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x60f262);}throw _0x60f262;}}if(errorContains(_0x60f262,_0x3af6c8(0x189),_0x3af6c8(0x1a0),'conflict')){_0x1cf001++;if(_0x1cf001>=_0x7f3a7a)throw new SDKError(ErrorCode[_0x3af6c8(0x213)],_0x3af6c8(0x218)+_0x7f3a7a+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x60f262);const _0x1d12d2=this[_0x3af6c8(0x1a5)]();_0x59a616=_0x1d12d2+'_'+generateRandomHex();continue;}throw _0x60f262;}}throw new SDKError(ErrorCode[_0x3af6c8(0x209)],_0x3af6c8(0x200));}async[a133_0x4dcb58(0x1b9)](_0x21f156,_0x39cfe3){const _0x54e5bf=a133_0x4dcb58,_0x33196e=_0x39cfe3||this['currentProjectId'],_0x19a221=await this[_0x54e5bf(0x1f1)]['listAgents'](_0x33196e),_0x3a0450=_0x19a221[_0x54e5bf(0x1d2)](_0x444675=>_0x444675['attributes'][_0x54e5bf(0x1c6)]===_0x21f156);if(_0x3a0450[_0x54e5bf(0x1a7)]===0x0){const _0x539c63=_0x33196e?_0x54e5bf(0x1b4)+_0x33196e:'';throw new SDKError(ErrorCode[_0x54e5bf(0x1d8)],_0x54e5bf(0x1ea)+_0x21f156+_0x539c63,undefined,{'helpText':_0x33196e?_0x54e5bf(0x1ff):_0x54e5bf(0x25f)});}if(_0x3a0450['length']>0x1)throw new SDKError(ErrorCode[_0x54e5bf(0x209)],_0x54e5bf(0x24f)+_0x21f156+_0x54e5bf(0x217));return _0x3a0450[0x0]['id'];}async[a133_0x4dcb58(0x1d4)](_0x11032f){const _0x3bbf76=a133_0x4dcb58,_0x3d6aa7=_0x11032f||this['currentProjectId'];return await this[_0x3bbf76(0x1f1)]['listAgents'](_0x3d6aa7);}async[a133_0x4dcb58(0x232)](_0x3f23b7){const _0x333900=a133_0x4dcb58;return await this[_0x333900(0x1f1)][_0x333900(0x211)](_0x3f23b7);}async[a133_0x4dcb58(0x18f)](_0x18e2fd){return await this['client']['getAgent'](_0x18e2fd);}async[a133_0x4dcb58(0x26d)](_0x26fa70){const _0x3d0890=a133_0x4dcb58;return await this[_0x3d0890(0x1f1)]['createAgent'](_0x26fa70);}async['updateAgent'](_0x1ebd48,_0x3fa6db){const _0xe6f224=a133_0x4dcb58;return await this[_0xe6f224(0x1f1)][_0xe6f224(0x25e)](_0x1ebd48,_0x3fa6db);}async[a133_0x4dcb58(0x27a)](_0x2810bd){const _0x4b4a4c=a133_0x4dcb58;await this[_0x4b4a4c(0x1f1)]['deleteAgent'](_0x2810bd);}async[a133_0x4dcb58(0x22e)](_0x495f45){const _0x11ad28=a133_0x4dcb58;return await this[_0x11ad28(0x1f1)]['startChat']({'agentId':_0x495f45});}async*['chat'](_0x5e21fa,_0x54b91b){const _0x111148=a133_0x4dcb58;let _0x2633b3=_0x54b91b?.[_0x111148(0x18b)];const _0x485d2d=_0x54b91b?.[_0x111148(0x283)];if(!_0x2633b3){if(!_0x485d2d)throw new Error(_0x111148(0x23a));const _0x373841=await this['client'][_0x111148(0x22e)]({'agentId':_0x485d2d});_0x2633b3=_0x373841['id'],yield{'type':_0x111148(0x203),'data':{'chatId':_0x2633b3,'agentId':_0x485d2d,'projectId':_0x373841[_0x111148(0x1a9)]['projectId']}};}for await(const _0x2c2015 of this[_0x111148(0x1f1)][_0x111148(0x230)](_0x2633b3,_0x5e21fa,_0x54b91b?.['signal'])){yield{'type':_0x111148(0x289),'data':_0x2c2015};}}async[a133_0x4dcb58(0x1b0)](_0x3693d5=0x32){const _0x4f2abd=a133_0x4dcb58;return await this['client'][_0x4f2abd(0x192)](_0x3693d5);}async['history'](_0x9348a5){const _0x2f7e23=a133_0x4dcb58;return await this[_0x2f7e23(0x1f1)][_0x2f7e23(0x208)](_0x9348a5);}async[a133_0x4dcb58(0x28b)](_0xad18d2){const _0x43a73e=a133_0x4dcb58;return await this[_0x43a73e(0x1f1)][_0x43a73e(0x28b)](_0xad18d2);}async[a133_0x4dcb58(0x259)](_0x59e329){const _0x4a63be=a133_0x4dcb58;return await this[_0x4a63be(0x1f1)]['getChatInfo'](_0x59e329);}async[a133_0x4dcb58(0x1a3)](_0xe54aee,_0x42cd53,_0x156a84){const _0x186ff2=a133_0x4dcb58,_0xf32cc4=_0x156a84?.[_0x186ff2(0x245)]??![],{projectId:_0x46b5c7,project:_0x470d60}=await this['resolveProjectName'](_0xe54aee),_0x3b1e08=_0x470d60[_0x186ff2(0x1a9)][_0x186ff2(0x1c6)],_0x27b9e8=_0x42cd53||_0x3b1e08+'.llm';if(a133_0x39b0da[_0x186ff2(0x247)](_0x27b9e8)&&!_0xf32cc4)throw new SDKError(ErrorCode[_0x186ff2(0x213)],_0x186ff2(0x1fb)+_0x27b9e8,undefined,{'helpText':_0x186ff2(0x25c)});const _0x3b2d75=await this['client']['listAgentsFull'](_0x46b5c7),_0x5763e1=await this['client']['listKnowledgeBases'](_0x46b5c7),_0x126271=await this['client']['listPrompts'](_0x46b5c7),_0x1dd669=await this[_0x186ff2(0x1f1)][_0x186ff2(0x190)](_0x46b5c7);if(!_0xf32cc4){a133_0x39b0da[_0x186ff2(0x262)](_0x27b9e8,{'recursive':!![]});const _0xb4c52c={'version':_0x186ff2(0x1f8),'exportedAt':new Date()[_0x186ff2(0x265)](),'exportedFrom':{'site':this[_0x186ff2(0x1d9)][_0x186ff2(0x1f7)],'projectId':_0x46b5c7,'projectName':_0x3b1e08},'project':_0x470d60};a133_0x39b0da[_0x186ff2(0x29a)](a133_0x371f12['join'](_0x27b9e8,'project.json'),JSON[_0x186ff2(0x281)](_0xb4c52c,null,0x2)),a133_0x39b0da['writeFileSync'](a133_0x371f12[_0x186ff2(0x22b)](_0x27b9e8,'agents.json'),JSON[_0x186ff2(0x281)](_0x3b2d75,null,0x2)),a133_0x39b0da[_0x186ff2(0x29a)](a133_0x371f12['join'](_0x27b9e8,'knowledgebases.json'),JSON[_0x186ff2(0x281)](_0x5763e1,null,0x2)),a133_0x39b0da[_0x186ff2(0x29a)](a133_0x371f12['join'](_0x27b9e8,_0x186ff2(0x29d)),JSON['stringify'](_0x126271,null,0x2)),a133_0x39b0da[_0x186ff2(0x29a)](a133_0x371f12['join'](_0x27b9e8,_0x186ff2(0x214)),JSON['stringify'](_0x1dd669,null,0x2));}return{'projectName':_0x3b1e08,'outputDir':_0x27b9e8,'counts':{'agents':_0x3b2d75[_0x186ff2(0x1a7)],'knowledgeBases':_0x5763e1[_0x186ff2(0x1a7)],'prompts':_0x126271['length'],'integrations':_0x1dd669[_0x186ff2(0x1a7)]}};}async['restoreProject'](_0x4fa6e7,_0x4ff403){const _0x27509f=a133_0x4dcb58,_0x389001=_0x4ff403?.['dryRun']??![],_0x543e08=this[_0x27509f(0x27f)](_0x4fa6e7),_0x1d4c23=_0x543e08[_0x27509f(0x292)]['site'],_0x42bedc=this['context'][_0x27509f(0x1f7)],_0x1201ea=_0x1d4c23!==_0x42bedc?_0x1d4c23:undefined,_0x4eee29=this['loadJsonFile'](a133_0x371f12[_0x27509f(0x22b)](_0x4fa6e7,_0x27509f(0x1d0)),[]),_0x59a0ef=this[_0x27509f(0x1e3)](a133_0x371f12['join'](_0x4fa6e7,_0x27509f(0x26a)),[]),_0x30f1ba=this['loadJsonFile'](a133_0x371f12[_0x27509f(0x22b)](_0x4fa6e7,_0x27509f(0x29d)),[]),_0x45f599=this[_0x27509f(0x1e3)](a133_0x371f12[_0x27509f(0x22b)](_0x4fa6e7,_0x27509f(0x214)),[]),_0x506da5=_0x4ff403?.['name']||_0x543e08[_0x27509f(0x292)][_0x27509f(0x1ee)];if(_0x389001){const _0x1328f4=new Map(),_0x33ec54=[..._0x4eee29],_0x15af41=_0x4eee29['length']+0x1;let _0x575de6=0x0;while(_0x33ec54[_0x27509f(0x1a7)]>0x0&&_0x575de6<_0x15af41){_0x575de6++;const _0x23c4b2=[];for(const _0x2c25eb of _0x33ec54){canCreateAgent(_0x2c25eb,_0x1328f4)?_0x1328f4['set'](_0x2c25eb['id'],_0x27509f(0x1ae)+_0x2c25eb['id']):_0x23c4b2[_0x27509f(0x1f3)](_0x2c25eb);}if(_0x23c4b2['length']===_0x33ec54[_0x27509f(0x1a7)])throw new SDKError(ErrorCode['INTERNAL'],_0x27509f(0x21e),undefined,{'helpText':_0x27509f(0x295)});_0x33ec54[_0x27509f(0x1a7)]=0x0,_0x33ec54[_0x27509f(0x1f3)](..._0x23c4b2);}const _0x5781bc=_0x30f1ba[_0x27509f(0x1d2)](_0x154bb2=>_0x1328f4[_0x27509f(0x1eb)](_0x154bb2['attributes'][_0x27509f(0x283)]))[_0x27509f(0x1a7)];return{'projectName':_0x506da5,'projectId':_0x27509f(0x271),'counts':{'agents':_0x4eee29[_0x27509f(0x1a7)],'knowledgeBases':_0x59a0ef[_0x27509f(0x1a7)],'prompts':_0x5781bc,'integrations':_0x45f599[_0x27509f(0x1a7)]},'sourceSite':_0x1201ea};}const _0x2521eb=await this[_0x27509f(0x1f1)][_0x27509f(0x248)]({'name':_0x506da5,'description':_0x543e08['project'][_0x27509f(0x1a9)]['description']}),_0x1379a6=_0x2521eb['id'],_0x270a64=new Map(),_0x211b44=new Map(),_0x2a2c7b=new Map();for(const _0x4e1400 of _0x59a0ef){const _0x35b094=await this[_0x27509f(0x1f1)][_0x27509f(0x258)]({'projectId':_0x1379a6,'name':_0x4e1400[_0x27509f(0x1a9)][_0x27509f(0x1c6)],'tdDatabaseName':_0x4e1400['attributes'][_0x27509f(0x287)],'tables':_0x4e1400[_0x27509f(0x1a9)]['tables']});_0x270a64['set'](_0x4e1400['id'],_0x35b094['id']);}const _0x4a9e81=[..._0x4eee29],_0xc94bea=_0x4eee29[_0x27509f(0x1a7)]+0x1;let _0x30e49e=0x0;while(_0x4a9e81['length']>0x0&&_0x30e49e<_0xc94bea){_0x30e49e++;const _0x1fc59c=[];for(const _0x6fea7b of _0x4a9e81){if(canCreateAgent(_0x6fea7b,_0x211b44)){const _0x416b78=remapToolIds(_0x6fea7b['attributes'][_0x27509f(0x296)],_0x270a64,_0x211b44),_0x39678e=remapVariableIds(_0x6fea7b['attributes']['variables'],_0x270a64),_0x94c37e=await this[_0x27509f(0x1f1)][_0x27509f(0x188)]({'name':_0x6fea7b['attributes'][_0x27509f(0x1c6)],'projectId':_0x1379a6,'systemPrompt':_0x6fea7b[_0x27509f(0x1a9)][_0x27509f(0x26f)],'starterMessage':_0x6fea7b[_0x27509f(0x1a9)][_0x27509f(0x1cc)],'modelType':migrateModelType(_0x6fea7b['attributes']['modelType']),'maxToolIterations':_0x6fea7b[_0x27509f(0x1a9)][_0x27509f(0x222)],'temperature':_0x6fea7b[_0x27509f(0x1a9)][_0x27509f(0x276)],'reasoningEffort':_0x6fea7b[_0x27509f(0x1a9)][_0x27509f(0x1b3)],'outputs':_0x6fea7b['attributes']['outputs'],'tools':_0x416b78,'variables':_0x39678e});_0x211b44[_0x27509f(0x1c0)](_0x6fea7b['id'],_0x94c37e['id']);}else _0x1fc59c['push'](_0x6fea7b);}if(_0x1fc59c[_0x27509f(0x1a7)]===_0x4a9e81['length'])throw new SDKError(ErrorCode['INTERNAL'],_0x27509f(0x21e),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x4a9e81[_0x27509f(0x1a7)]=0x0,_0x4a9e81['push'](..._0x1fc59c);}for(const _0x24d3d4 of _0x30f1ba){const _0x32ec24=_0x211b44[_0x27509f(0x291)](_0x24d3d4['attributes']['agentId']);if(!_0x32ec24)continue;const _0x1e3b7f=await this[_0x27509f(0x1f1)][_0x27509f(0x20e)]({'projectId':_0x1379a6,'agentId':_0x32ec24,'name':_0x24d3d4[_0x27509f(0x1a9)][_0x27509f(0x1c6)],'systemPrompt':_0x24d3d4[_0x27509f(0x1a9)]['systemPrompt'],'template':_0x24d3d4['attributes'][_0x27509f(0x223)],'jsonSchemaHint':_0x24d3d4[_0x27509f(0x1a9)][_0x27509f(0x215)]});_0x2a2c7b[_0x27509f(0x1c0)](_0x24d3d4['id'],_0x1e3b7f['id']);}for(const _0x2dd2dd of _0x45f599){const _0x4ae83e=_0x2dd2dd[_0x27509f(0x1a9)][_0x27509f(0x195)][_0x27509f(0x22c)](_0x14fe51=>({..._0x14fe51,'promptId':_0x2a2c7b[_0x27509f(0x291)](_0x14fe51[_0x27509f(0x1c8)])||_0x14fe51['promptId']}));await this[_0x27509f(0x1f1)][_0x27509f(0x286)]({'projectId':_0x1379a6,'serviceType':_0x2dd2dd['attributes'][_0x27509f(0x20d)],'actions':_0x4ae83e,'slackMessageMode':_0x2dd2dd[_0x27509f(0x1a9)][_0x27509f(0x243)],'chatIgnoreManagedActions':_0x2dd2dd['attributes'][_0x27509f(0x270)],'chatWelcomeMessage':_0x2dd2dd['attributes']['chatWelcomeMessage'],'webhookCorsOrigins':_0x2dd2dd[_0x27509f(0x1a9)][_0x27509f(0x1b5)]});}return{'projectName':_0x506da5,'projectId':_0x1379a6,'counts':{'agents':_0x211b44[_0x27509f(0x1ac)],'knowledgeBases':_0x270a64[_0x27509f(0x1ac)],'prompts':_0x2a2c7b[_0x27509f(0x1ac)],'integrations':_0x45f599[_0x27509f(0x1a7)]},'sourceSite':_0x1201ea};}['loadJsonFile'](_0x481e75,_0x14cc71){const _0xc77903=a133_0x4dcb58;if(!a133_0x39b0da[_0xc77903(0x247)](_0x481e75))return _0x14cc71;return JSON['parse'](a133_0x39b0da[_0xc77903(0x1d6)](_0x481e75,_0xc77903(0x1a1)));}[a133_0x4dcb58(0x27f)](_0x3b2694){const _0x276175=a133_0x4dcb58;if(!a133_0x39b0da[_0x276175(0x247)](_0x3b2694))throw new SDKError(ErrorCode[_0x276175(0x24c)],_0x276175(0x1ba)+_0x3b2694,undefined,{'helpText':'Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.'});const _0x810880=a133_0x371f12[_0x276175(0x22b)](_0x3b2694,_0x276175(0x1a2));if(!a133_0x39b0da[_0x276175(0x247)](_0x810880))throw new SDKError(ErrorCode[_0x276175(0x1d1)],_0x276175(0x280)+_0x3b2694,undefined,{'helpText':_0x276175(0x24b)});const _0xbbf64e=JSON['parse'](a133_0x39b0da['readFileSync'](_0x810880,'utf-8'));if(!isSupportedBackupVersion(_0xbbf64e['version']))throw new SDKError(ErrorCode[_0x276175(0x1d1)],'Unsupported\x20backup\x20version:\x20'+_0xbbf64e['version'],undefined,{'helpText':'This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.'});return _0xbbf64e;}async['pullProject'](_0x14b055,_0x42978d,_0x662939){const _0x40d0b0=a133_0x4dcb58,{projectId:_0x2bc028,project:_0xcead5e}=await this[_0x40d0b0(0x1a6)](_0x14b055),_0x503fb5=_0xcead5e['attributes'][_0x40d0b0(0x1c6)];let _0x57bb4e;if(_0x42978d)_0x57bb4e=_0x42978d;else{const _0xa5923c=a133_0x371f12['join'](process['cwd'](),_0x40d0b0(0x1d4)),_0x37316b=getSanitizedPathWithMigration(_0xa5923c,_0x503fb5);_0x37316b[_0x40d0b0(0x191)]&&this[_0x40d0b0(0x251)][_0x40d0b0(0x27e)]('Renamed\x20folder:\x20'+a133_0x371f12[_0x40d0b0(0x238)](_0x37316b[_0x40d0b0(0x1d3)])+'\x20→\x20'+a133_0x371f12[_0x40d0b0(0x238)](_0x37316b['path'])),_0x57bb4e=_0x37316b[_0x40d0b0(0x275)];}const _0xad46cc=await this[_0x40d0b0(0x1f1)][_0x40d0b0(0x211)](_0x2bc028),_0x3cf143=await this['client']['listKnowledgeBases'](_0x2bc028),_0xd9f42d=await this['client']['listTextKnowledgeBases'](_0x2bc028),_0x46e1e7=await safeListOrEmpty(()=>this[_0x40d0b0(0x1f1)][_0x40d0b0(0x202)](_0x2bc028)),_0x455b75=await safeListOrEmpty(()=>this[_0x40d0b0(0x1f1)][_0x40d0b0(0x22a)](_0x2bc028)),_0xf804c0=await this[_0x40d0b0(0x1f1)][_0x40d0b0(0x288)](_0x2bc028),_0x2b8409=await this['client'][_0x40d0b0(0x190)](_0x2bc028),_0xcabfae=await safeListOrEmpty(()=>this[_0x40d0b0(0x1f1)][_0x40d0b0(0x1f5)](_0x2bc028)),_0x2d4ffc=await safeListOrEmpty(()=>this['client']['listExperimentalArtifacts'](_0x2bc028)),_0xef16ed=await safeListOrEmpty(()=>this[_0x40d0b0(0x1f1)]['listFormInterfaces'](_0x2bc028)),_0xf70de8=await safeListOrEmpty(()=>this['client'][_0x40d0b0(0x212)](_0x2bc028)),_0x10942b=_0x2b8409[_0x40d0b0(0x1d2)](_0x2cdb40=>!_0x2cdb40['attributes'][_0x40d0b0(0x290)]&&SAFE_INTEGRATION_TYPES['includes'](_0x2cdb40[_0x40d0b0(0x1a9)]['serviceType'][_0x40d0b0(0x233)]())),_0x1aebb8=new Map(),_0x3c4dc4=new Map(),_0x37e0a0=new Map(),_0x894bc6=new Map(),_0x38130c=new Map(),_0x3bd941=new Map(),_0x593620=new Map();for(const _0x32eee8 of _0xad46cc){_0x1aebb8[_0x40d0b0(0x1c0)](_0x32eee8['id'],_0x32eee8[_0x40d0b0(0x1a9)]['name']);}for(const _0x988188 of _0x3cf143){_0x3c4dc4[_0x40d0b0(0x1c0)](_0x988188['id'],_0x988188[_0x40d0b0(0x1a9)][_0x40d0b0(0x1c6)]);}for(const _0x40218e of _0xd9f42d){_0x37e0a0[_0x40d0b0(0x1c0)](_0x40218e['id'],_0x40218e['attributes']['name']);}for(const _0x239b12 of _0x46e1e7){_0x894bc6['set'](_0x239b12['id'],_0x239b12[_0x40d0b0(0x1a9)][_0x40d0b0(0x1c6)]);}for(const _0x1c0652 of _0x455b75){_0x38130c['set'](_0x1c0652['id'],_0x1c0652['attributes'][_0x40d0b0(0x1c6)]);}for(const _0x33904a of _0xf804c0){_0x3bd941[_0x40d0b0(0x1c0)](_0x33904a['id'],_0x33904a[_0x40d0b0(0x1a9)][_0x40d0b0(0x1c6)]);}for(const _0x36c525 of _0xcabfae){_0x593620[_0x40d0b0(0x1c0)](_0x36c525['id'],_0x36c525['attributes']['name']);}const _0x4c7845={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x3c4dc4,'TextKnowledgeBase':_0x37e0a0,'Agent':_0x1aebb8,'WebSearchTool':_0x38130c,'ImageGenerator':_0x894bc6,'ExperimentalKnowledgeBase':_0x593620}),'resolvePromptName':async _0x284c29=>_0x3bd941['get'](_0x284c29),'onWarning':_0xd87f47=>this[_0x40d0b0(0x251)][_0x40d0b0(0x252)](_0xd87f47)},_0x5d4327={'projectName':_0x503fb5,'outputDir':_0x57bb4e,'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}}},_0x59accc=[],_0x25d222=[];for(const _0x1d4c94 of _0xad46cc){const _0x4c86f8=getSanitizedPathWithMigration(_0x57bb4e,_0x1d4c94[_0x40d0b0(0x1a9)][_0x40d0b0(0x1c6)]);_0x4c86f8['renamed']&&this['logger'][_0x40d0b0(0x27e)]('Renamed\x20agent\x20folder:\x20'+a133_0x371f12[_0x40d0b0(0x238)](_0x4c86f8[_0x40d0b0(0x1d3)])+_0x40d0b0(0x268)+a133_0x371f12[_0x40d0b0(0x238)](_0x4c86f8[_0x40d0b0(0x275)]));const _0x36c9e7=_0x4c86f8[_0x40d0b0(0x275)],_0x5d35b8=a133_0x371f12[_0x40d0b0(0x22b)](_0x36c9e7,'prompt.md'),_0x129e57=a133_0x371f12[_0x40d0b0(0x22b)](_0x36c9e7,_0x40d0b0(0x1d7)),_0x82486c=a133_0x371f12[_0x40d0b0(0x22b)](_0x36c9e7,'starter_message.md'),{yaml:_0x2490b6,systemPrompt:_0x4f7447,starterMessage:_0x24d986}=await agentResponseToDef(_0x1d4c94,_0x4c7845),_0x5cbbf2=toAgentYamlString(_0x2490b6),_0x442b76=!a133_0x39b0da['existsSync'](_0x129e57);let _0x2b1e43=_0x442b76,_0x255724;if(!_0x442b76){const _0x5736df=a133_0x39b0da['existsSync'](_0x5d35b8)?a133_0x39b0da[_0x40d0b0(0x1d6)](_0x5d35b8,_0x40d0b0(0x1a1)):'',_0x391484=a133_0x39b0da[_0x40d0b0(0x1d6)](_0x129e57,_0x40d0b0(0x1a1)),_0x3b5322=_0x40d0b0(0x205)+_0x5736df+_0x40d0b0(0x293)+_0x391484,_0x4a1274=_0x40d0b0(0x205)+_0x4f7447+_0x40d0b0(0x293)+_0x5cbbf2,_0x4c6f57=generateDiff(_0x3b5322,_0x4a1274);_0x2b1e43=hasChanges(_0x4c6f57),_0x2b1e43&&(_0x255724=formatDiffWithColors(_0x4c6f57));}_0x59accc[_0x40d0b0(0x1f3)]({'path':_0x36c9e7,'content':'','isDir':!![]}),_0x59accc[_0x40d0b0(0x1f3)]({'path':_0x5d35b8,'content':_0x4f7447}),_0x59accc[_0x40d0b0(0x1f3)]({'path':_0x129e57,'content':_0x5cbbf2});_0x24d986&&_0x24d986[_0x40d0b0(0x28a)]('\x0a')&&_0x59accc[_0x40d0b0(0x1f3)]({'path':_0x82486c,'content':_0x24d986});_0x5d4327[_0x40d0b0(0x1d4)][_0x40d0b0(0x1f3)]({'agentName':_0x1d4c94[_0x40d0b0(0x1a9)][_0x40d0b0(0x1c6)],'outputPath':_0x36c9e7,'isNew':_0x442b76,'hasChanges':_0x2b1e43,'diff':_0x255724}),_0x5d4327['counts']['agents'][_0x40d0b0(0x193)]++;if(_0x442b76)_0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x1d4)][_0x40d0b0(0x1e6)]++;else{if(_0x2b1e43)_0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x1d4)][_0x40d0b0(0x220)]++;else _0x5d4327[_0x40d0b0(0x298)]['agents'][_0x40d0b0(0x206)]++;}}for(const _0x448dc4 of _0x3cf143){if(_0x448dc4['attributes'][_0x40d0b0(0x290)])continue;const _0x32f93c=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x57bb4e),_0x448dc4[_0x40d0b0(0x1a9)][_0x40d0b0(0x1c6)],_0x40d0b0(0x1e0));_0x32f93c[_0x40d0b0(0x191)]&&this[_0x40d0b0(0x251)][_0x40d0b0(0x27e)](_0x40d0b0(0x21d)+a133_0x371f12[_0x40d0b0(0x238)](_0x32f93c['oldPath'])+'\x20→\x20'+a133_0x371f12[_0x40d0b0(0x238)](_0x32f93c['path']));const _0x12903a=_0x32f93c['path'],_0x4599c3=apiKnowledgeBaseToYaml(_0x448dc4),_0x2d215a=toKnowledgeBaseYamlString(_0x4599c3),_0x20e665=!a133_0x39b0da['existsSync'](_0x12903a);let _0x32cde9=_0x20e665,_0x57228c;if(!_0x20e665){const _0x514f7e=a133_0x39b0da[_0x40d0b0(0x1d6)](_0x12903a,_0x40d0b0(0x1a1)),_0x504554=generateDiff(_0x514f7e,_0x2d215a);_0x32cde9=hasChanges(_0x504554),_0x32cde9&&(_0x57228c=formatDiffWithColors(_0x504554));}_0x59accc['push']({'path':_0x12903a,'content':_0x2d215a}),_0x5d4327['knowledgeBases'][_0x40d0b0(0x1f3)]({'name':_0x448dc4['attributes'][_0x40d0b0(0x1c6)],'outputPath':_0x12903a,'isNew':_0x20e665,'hasChanges':_0x32cde9,'diff':_0x57228c}),_0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x272)][_0x40d0b0(0x193)]++;if(_0x20e665)_0x5d4327['counts'][_0x40d0b0(0x272)][_0x40d0b0(0x1e6)]++;else{if(_0x32cde9)_0x5d4327['counts']['knowledgeBases'][_0x40d0b0(0x220)]++;else _0x5d4327['counts'][_0x40d0b0(0x272)]['unchanged']++;}}for(const _0x5c3b4a of _0xd9f42d){if(_0x5c3b4a['attributes'][_0x40d0b0(0x290)])continue;const _0xd045a2=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x57bb4e),_0x5c3b4a[_0x40d0b0(0x1a9)]['name'],_0x40d0b0(0x1e2));_0xd045a2[_0x40d0b0(0x191)]&&this[_0x40d0b0(0x251)][_0x40d0b0(0x27e)](_0x40d0b0(0x241)+a133_0x371f12['basename'](_0xd045a2[_0x40d0b0(0x1d3)])+'\x20→\x20'+a133_0x371f12[_0x40d0b0(0x238)](_0xd045a2[_0x40d0b0(0x275)]));const _0x467398=_0xd045a2[_0x40d0b0(0x275)],_0x512e62=toTextKnowledgeBaseMd(_0x5c3b4a[_0x40d0b0(0x1a9)][_0x40d0b0(0x1c6)],_0x5c3b4a[_0x40d0b0(0x1a9)]['text']),_0x7cc524=!a133_0x39b0da['existsSync'](_0x467398);let _0x4add9a=_0x7cc524,_0x5da3af;if(!_0x7cc524){const _0x5e9ce2=a133_0x39b0da['readFileSync'](_0x467398,'utf-8'),_0x4b25f9=generateDiff(_0x5e9ce2,_0x512e62);_0x4add9a=hasChanges(_0x4b25f9),_0x4add9a&&(_0x5da3af=formatDiffWithColors(_0x4b25f9));}_0x59accc[_0x40d0b0(0x1f3)]({'path':_0x467398,'content':_0x512e62}),_0x5d4327[_0x40d0b0(0x21b)][_0x40d0b0(0x1f3)]({'name':_0x5c3b4a[_0x40d0b0(0x1a9)][_0x40d0b0(0x1c6)],'outputPath':_0x467398,'isNew':_0x7cc524,'hasChanges':_0x4add9a,'diff':_0x5da3af}),_0x5d4327[_0x40d0b0(0x298)]['textKnowledgeBases'][_0x40d0b0(0x193)]++;if(_0x7cc524)_0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x21b)]['new']++;else{if(_0x4add9a)_0x5d4327[_0x40d0b0(0x298)]['textKnowledgeBases']['updated']++;else _0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x21b)][_0x40d0b0(0x206)]++;}}for(const _0x326b5d of _0xf804c0){if(_0x326b5d[_0x40d0b0(0x1a9)]['isManaged'])continue;const _0x577482=getSanitizedPathWithMigration(getPromptsDir(_0x57bb4e),_0x326b5d['attributes']['name'],_0x40d0b0(0x1e0));_0x577482['renamed']&&this[_0x40d0b0(0x251)][_0x40d0b0(0x27e)](_0x40d0b0(0x28e)+a133_0x371f12['basename'](_0x577482[_0x40d0b0(0x1d3)])+_0x40d0b0(0x268)+a133_0x371f12['basename'](_0x577482[_0x40d0b0(0x275)]));const _0x4af14d=_0x577482['path'],_0x370189=await apiPromptToYaml(_0x326b5d,_0x4c7845);if(!_0x370189)continue;const _0x18685d=toPromptYamlString(_0x370189),_0x331b23=!a133_0x39b0da[_0x40d0b0(0x247)](_0x4af14d);let _0x153761=_0x331b23,_0x2f7bb8;if(!_0x331b23){const _0x3b7b3a=a133_0x39b0da[_0x40d0b0(0x1d6)](_0x4af14d,_0x40d0b0(0x1a1)),_0x51d0e6=generateDiff(_0x3b7b3a,_0x18685d);_0x153761=hasChanges(_0x51d0e6),_0x153761&&(_0x2f7bb8=formatDiffWithColors(_0x51d0e6));}_0x59accc[_0x40d0b0(0x1f3)]({'path':_0x4af14d,'content':_0x18685d}),_0x5d4327[_0x40d0b0(0x1ce)]['push']({'name':_0x326b5d[_0x40d0b0(0x1a9)][_0x40d0b0(0x1c6)],'outputPath':_0x4af14d,'isNew':_0x331b23,'hasChanges':_0x153761,'diff':_0x2f7bb8}),_0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x1ce)][_0x40d0b0(0x193)]++;if(_0x331b23)_0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x1ce)][_0x40d0b0(0x1e6)]++;else{if(_0x153761)_0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x1ce)][_0x40d0b0(0x220)]++;else _0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x1ce)][_0x40d0b0(0x206)]++;}}for(const _0x184bcd of _0x10942b){const _0x444852=_0x184bcd[_0x40d0b0(0x1a9)][_0x40d0b0(0x20d)][_0x40d0b0(0x233)](),_0x3cde36=getSanitizedPathWithMigration(getIntegrationsDir(_0x57bb4e),_0x444852,_0x40d0b0(0x1e0));_0x3cde36[_0x40d0b0(0x191)]&&this['logger'][_0x40d0b0(0x27e)](_0x40d0b0(0x20f)+a133_0x371f12[_0x40d0b0(0x238)](_0x3cde36[_0x40d0b0(0x1d3)])+_0x40d0b0(0x268)+a133_0x371f12[_0x40d0b0(0x238)](_0x3cde36[_0x40d0b0(0x275)]));const _0x577272=_0x3cde36[_0x40d0b0(0x275)],_0x2e554c=await apiIntegrationToYaml(_0x184bcd,_0x4c7845),_0x5b4357=toIntegrationYamlString(_0x2e554c),_0x47de9f=!a133_0x39b0da['existsSync'](_0x577272);let _0x1907d6=_0x47de9f,_0x38653b;if(!_0x47de9f){const _0x16d4ea=a133_0x39b0da[_0x40d0b0(0x1d6)](_0x577272,_0x40d0b0(0x1a1)),_0x444a22=generateDiff(_0x16d4ea,_0x5b4357);_0x1907d6=hasChanges(_0x444a22),_0x1907d6&&(_0x38653b=formatDiffWithColors(_0x444a22));}_0x59accc[_0x40d0b0(0x1f3)]({'path':_0x577272,'content':_0x5b4357}),_0x5d4327[_0x40d0b0(0x196)]['push']({'name':_0x444852,'outputPath':_0x577272,'isNew':_0x47de9f,'hasChanges':_0x1907d6,'diff':_0x38653b}),_0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x196)][_0x40d0b0(0x193)]++;if(_0x47de9f)_0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x196)][_0x40d0b0(0x1e6)]++;else{if(_0x1907d6)_0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x196)][_0x40d0b0(0x220)]++;else _0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x196)][_0x40d0b0(0x206)]++;}}for(const _0x508103 of _0xcabfae){if(_0x508103[_0x40d0b0(0x1a9)][_0x40d0b0(0x290)])continue;const _0x38d976=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x57bb4e),_0x508103[_0x40d0b0(0x1a9)][_0x40d0b0(0x1c6)]);_0x38d976['renamed']&&this[_0x40d0b0(0x251)][_0x40d0b0(0x27e)]('Renamed\x20experimental\x20KB\x20directory:\x20'+a133_0x371f12['basename'](_0x38d976['oldPath'])+_0x40d0b0(0x268)+a133_0x371f12[_0x40d0b0(0x238)](_0x38d976['path']));const _0x141e75=_0x38d976['path'],_0xb2cee1=a133_0x371f12['join'](_0x141e75,sanitizeForFilesystem(_0x508103[_0x40d0b0(0x1a9)][_0x40d0b0(0x1c6)])+_0x40d0b0(0x1e0)),_0x22c601=a133_0x371f12[_0x40d0b0(0x22b)](_0x141e75,_0x40d0b0(0x254)),_0x180e8d=apiExperimentalKnowledgeBaseToYaml(_0x508103),_0x4cc30c=toExperimentalKnowledgeBaseYamlString(_0x180e8d),_0x43b3cc=!a133_0x39b0da['existsSync'](_0x141e75);let _0x33ac5b=_0x43b3cc,_0x846f4f,_0x1f0f15=_0x4cc30c;const _0x116cc0=[..._0x180e8d[_0x40d0b0(0x254)]][_0x40d0b0(0x249)]((_0x203649,_0x253c66)=>_0x203649[_0x40d0b0(0x1c6)][_0x40d0b0(0x227)](_0x253c66['name']));for(const _0x2902c4 of _0x116cc0){_0x1f0f15+='\x0a---\x20function:\x20'+_0x2902c4['name']+_0x40d0b0(0x1e5)+_0x2902c4[_0x40d0b0(0x297)]+'\x0a---\x20schema:\x20'+_0x2902c4[_0x40d0b0(0x1c6)]+_0x40d0b0(0x1e5)+_0x2902c4[_0x40d0b0(0x1e1)]+'\x0a';}if(!_0x43b3cc){let _0x5c30dd='';a133_0x39b0da[_0x40d0b0(0x247)](_0xb2cee1)&&(_0x5c30dd=a133_0x39b0da[_0x40d0b0(0x1d6)](_0xb2cee1,_0x40d0b0(0x1a1)));if(a133_0x39b0da[_0x40d0b0(0x247)](_0x22c601)){const _0x6b55ee=a133_0x39b0da[_0x40d0b0(0x23e)](_0x22c601,{'withFileTypes':!![]}),_0x1afbf9=_0x6b55ee[_0x40d0b0(0x1d2)](_0xfe5697=>_0xfe5697[_0x40d0b0(0x197)]())[_0x40d0b0(0x249)]((_0x51307c,_0x2290fe)=>_0x51307c[_0x40d0b0(0x1c6)][_0x40d0b0(0x227)](_0x2290fe['name']));for(const _0x2d4bf0 of _0x1afbf9){const _0x3678e2=a133_0x371f12[_0x40d0b0(0x22b)](_0x22c601,_0x2d4bf0[_0x40d0b0(0x1c6)],'code.js'),_0x471545=a133_0x371f12['join'](_0x22c601,_0x2d4bf0[_0x40d0b0(0x1c6)],'json_schema.json');a133_0x39b0da[_0x40d0b0(0x247)](_0x3678e2)&&(_0x5c30dd+=_0x40d0b0(0x29c)+_0x2d4bf0[_0x40d0b0(0x1c6)]+_0x40d0b0(0x1e5)+a133_0x39b0da[_0x40d0b0(0x1d6)](_0x3678e2,_0x40d0b0(0x1a1))+'\x0a'),a133_0x39b0da[_0x40d0b0(0x247)](_0x471545)&&(_0x5c30dd+=_0x40d0b0(0x27d)+_0x2d4bf0['name']+_0x40d0b0(0x1e5)+a133_0x39b0da[_0x40d0b0(0x1d6)](_0x471545,_0x40d0b0(0x1a1))+'\x0a');}}const _0x1305ac=generateDiff(_0x5c30dd,_0x1f0f15);_0x33ac5b=hasChanges(_0x1305ac),_0x33ac5b&&(_0x846f4f=formatDiffWithColors(_0x1305ac));}_0x59accc[_0x40d0b0(0x1f3)]({'path':_0x141e75,'content':'','isDir':!![]}),_0x59accc[_0x40d0b0(0x1f3)]({'path':_0xb2cee1,'content':_0x4cc30c}),_0x59accc[_0x40d0b0(0x1f3)]({'path':_0x22c601,'content':'','isDir':!![]});for(const _0xa3f4f of _0x180e8d['functions']){const _0x28ccfb=a133_0x371f12['join'](_0x22c601,sanitizeForFilesystem(_0xa3f4f['name'])),_0x38b597=a133_0x371f12[_0x40d0b0(0x22b)](_0x28ccfb,_0x40d0b0(0x255)),_0x3f3f0d=a133_0x371f12[_0x40d0b0(0x22b)](_0x28ccfb,_0x40d0b0(0x239));_0x59accc['push']({'path':_0x28ccfb,'content':'','isDir':!![]}),_0x59accc[_0x40d0b0(0x1f3)]({'path':_0x38b597,'content':_0xa3f4f[_0x40d0b0(0x297)]}),_0x59accc[_0x40d0b0(0x1f3)]({'path':_0x3f3f0d,'content':_0xa3f4f[_0x40d0b0(0x1e1)]});}if(a133_0x39b0da[_0x40d0b0(0x247)](_0x22c601)){const _0x75717c=a133_0x39b0da['readdirSync'](_0x22c601,{'withFileTypes':!![]}),_0x32477d=new Set(_0x180e8d[_0x40d0b0(0x254)][_0x40d0b0(0x22c)](_0x25f0dd=>sanitizeForFilesystem(_0x25f0dd[_0x40d0b0(0x1c6)])));for(const _0x9c9b1c of _0x75717c){if(_0x9c9b1c['isDirectory']()&&!_0x32477d[_0x40d0b0(0x1eb)](_0x9c9b1c[_0x40d0b0(0x1c6)])){const _0x5f2e42=a133_0x371f12[_0x40d0b0(0x22b)](_0x22c601,_0x9c9b1c[_0x40d0b0(0x1c6)]);_0x25d222[_0x40d0b0(0x1f3)]({'path':_0x5f2e42,'isDir':!![]});}}}_0x5d4327[_0x40d0b0(0x1bc)][_0x40d0b0(0x1f3)]({'name':_0x508103['attributes']['name'],'outputPath':_0x141e75,'isNew':_0x43b3cc,'hasChanges':_0x33ac5b,'diff':_0x846f4f}),_0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x1bc)]['total']++;if(_0x43b3cc)_0x5d4327['counts'][_0x40d0b0(0x1bc)][_0x40d0b0(0x1e6)]++;else{if(_0x33ac5b)_0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x1bc)][_0x40d0b0(0x220)]++;else _0x5d4327['counts'][_0x40d0b0(0x1bc)]['unchanged']++;}}for(const _0x5f423b of _0x2d4ffc){if(_0x5f423b[_0x40d0b0(0x1a9)][_0x40d0b0(0x290)])continue;const _0x1c70b1=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x57bb4e),_0x5f423b[_0x40d0b0(0x1a9)][_0x40d0b0(0x1c6)]);_0x1c70b1[_0x40d0b0(0x191)]&&this[_0x40d0b0(0x251)][_0x40d0b0(0x27e)](_0x40d0b0(0x29e)+a133_0x371f12[_0x40d0b0(0x238)](_0x1c70b1[_0x40d0b0(0x1d3)])+'\x20→\x20'+a133_0x371f12[_0x40d0b0(0x238)](_0x1c70b1['path']));const _0x345eca=_0x1c70b1['path'],_0x58206f=a133_0x371f12['join'](_0x345eca,sanitizeForFilesystem(_0x5f423b['attributes'][_0x40d0b0(0x1c6)])+_0x40d0b0(0x1e0)),_0x32faef=a133_0x371f12[_0x40d0b0(0x22b)](_0x345eca,_0x40d0b0(0x255)),_0x4e06d6=a133_0x371f12[_0x40d0b0(0x22b)](_0x345eca,_0x40d0b0(0x246)),_0x1f3994=apiExperimentalArtifactToYaml(_0x5f423b),_0x51a301=toExperimentalArtifactYamlString(_0x1f3994),_0x484654=!a133_0x39b0da[_0x40d0b0(0x247)](_0x345eca);let _0x394bf3=_0x484654,_0xef3128,_0x588d3f=_0x51a301+(_0x40d0b0(0x1c4)+_0x1f3994[_0x40d0b0(0x297)]+'\x0a');const _0x5bbb95=[..._0x1f3994[_0x40d0b0(0x246)]]['sort']((_0x33eb24,_0xdc99a6)=>_0x33eb24['file_name']['localeCompare'](_0xdc99a6[_0x40d0b0(0x25a)]));for(const _0x131248 of _0x5bbb95){_0x588d3f+=_0x40d0b0(0x1ed)+_0x131248['file_name']+_0x40d0b0(0x1e5)+_0x131248[_0x40d0b0(0x1ef)]+'\x0a';}if(!_0x484654){let _0xb2a678='';a133_0x39b0da[_0x40d0b0(0x247)](_0x58206f)&&(_0xb2a678=a133_0x39b0da[_0x40d0b0(0x1d6)](_0x58206f,'utf-8'));a133_0x39b0da[_0x40d0b0(0x247)](_0x32faef)&&(_0xb2a678+=_0x40d0b0(0x1c4)+a133_0x39b0da[_0x40d0b0(0x1d6)](_0x32faef,'utf-8')+'\x0a');if(a133_0x39b0da[_0x40d0b0(0x247)](_0x4e06d6)){const _0xc47455=a133_0x39b0da[_0x40d0b0(0x23e)](_0x4e06d6),_0x5ef202=_0xc47455['filter'](_0x10c2fc=>{const _0x520282=_0x40d0b0,_0x5ad765=a133_0x371f12[_0x520282(0x22b)](_0x4e06d6,_0x10c2fc);return a133_0x39b0da[_0x520282(0x244)](_0x5ad765)['isFile']();})['sort']((_0x154a8c,_0xf56805)=>_0x154a8c[_0x40d0b0(0x227)](_0xf56805));for(const _0x325834 of _0x5ef202){const _0x1098ea=a133_0x371f12['join'](_0x4e06d6,_0x325834);_0xb2a678+='---\x20file:\x20'+_0x325834+_0x40d0b0(0x1e5)+a133_0x39b0da[_0x40d0b0(0x1d6)](_0x1098ea,'utf-8')+'\x0a';}}const _0x4ec47e=generateDiff(_0xb2a678,_0x588d3f);_0x394bf3=hasChanges(_0x4ec47e),_0x394bf3&&(_0xef3128=formatDiffWithColors(_0x4ec47e));}_0x59accc[_0x40d0b0(0x1f3)]({'path':_0x345eca,'content':'','isDir':!![]}),_0x59accc[_0x40d0b0(0x1f3)]({'path':_0x58206f,'content':_0x51a301}),_0x59accc[_0x40d0b0(0x1f3)]({'path':_0x32faef,'content':_0x1f3994[_0x40d0b0(0x297)]});if(_0x1f3994[_0x40d0b0(0x246)][_0x40d0b0(0x1a7)]>0x0){_0x59accc[_0x40d0b0(0x1f3)]({'path':_0x4e06d6,'content':'','isDir':!![]});for(const _0x1ae1af of _0x1f3994[_0x40d0b0(0x246)]){const _0x226fd1=a133_0x371f12[_0x40d0b0(0x22b)](_0x4e06d6,_0x1ae1af[_0x40d0b0(0x25a)]);_0x59accc['push']({'path':_0x226fd1,'content':_0x1ae1af[_0x40d0b0(0x1ef)]});}}if(a133_0x39b0da[_0x40d0b0(0x247)](_0x4e06d6)){const _0x488963=a133_0x39b0da[_0x40d0b0(0x23e)](_0x4e06d6),_0x2dc87a=new Set(_0x1f3994[_0x40d0b0(0x246)][_0x40d0b0(0x22c)](_0x14c69b=>_0x14c69b[_0x40d0b0(0x25a)]));for(const _0x57cb4a of _0x488963){const _0x1c4f94=a133_0x371f12[_0x40d0b0(0x22b)](_0x4e06d6,_0x57cb4a);a133_0x39b0da['statSync'](_0x1c4f94)[_0x40d0b0(0x225)]()&&!_0x2dc87a[_0x40d0b0(0x1eb)](_0x57cb4a)&&_0x25d222[_0x40d0b0(0x1f3)]({'path':_0x1c4f94});}}_0x5d4327[_0x40d0b0(0x1cb)][_0x40d0b0(0x1f3)]({'name':_0x5f423b[_0x40d0b0(0x1a9)]['name'],'outputPath':_0x345eca,'isNew':_0x484654,'hasChanges':_0x394bf3,'diff':_0xef3128}),_0x5d4327['counts'][_0x40d0b0(0x1cb)]['total']++;if(_0x484654)_0x5d4327[_0x40d0b0(0x298)]['experimentalArtifacts']['new']++;else{if(_0x394bf3)_0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x1cb)][_0x40d0b0(0x220)]++;else _0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x1cb)][_0x40d0b0(0x206)]++;}}for(const _0x4be222 of _0xef16ed){const _0x124461=getSanitizedPathWithMigration(getFormInterfacesDir(_0x57bb4e),_0x4be222['attributes'][_0x40d0b0(0x1c6)],_0x40d0b0(0x1e0));_0x124461[_0x40d0b0(0x191)]&&this[_0x40d0b0(0x251)][_0x40d0b0(0x27e)](_0x40d0b0(0x1ec)+a133_0x371f12['basename'](_0x124461['oldPath'])+_0x40d0b0(0x268)+a133_0x371f12[_0x40d0b0(0x238)](_0x124461[_0x40d0b0(0x275)]));const _0x586f62=_0x124461[_0x40d0b0(0x275)],_0x310205=await apiFormInterfaceToYaml(_0x4be222,_0x4c7845),_0xb24a50=toFormInterfaceYamlString(_0x310205),_0x29d7ae=!a133_0x39b0da[_0x40d0b0(0x247)](_0x586f62);let _0x4c9cd4=_0x29d7ae,_0xb32f1b;if(!_0x29d7ae){const _0x106d81=a133_0x39b0da['readFileSync'](_0x586f62,_0x40d0b0(0x1a1)),_0x152e47=generateDiff(_0x106d81,_0xb24a50);_0x4c9cd4=hasChanges(_0x152e47),_0x4c9cd4&&(_0xb32f1b=formatDiffWithColors(_0x152e47));}_0x59accc['push']({'path':_0x586f62,'content':_0xb24a50}),_0x5d4327[_0x40d0b0(0x1e8)][_0x40d0b0(0x1f3)]({'name':_0x4be222[_0x40d0b0(0x1a9)]['name'],'outputPath':_0x586f62,'isNew':_0x29d7ae,'hasChanges':_0x4c9cd4,'diff':_0xb32f1b}),_0x5d4327['counts'][_0x40d0b0(0x1e8)][_0x40d0b0(0x193)]++;if(_0x29d7ae)_0x5d4327[_0x40d0b0(0x298)]['formInterfaces'][_0x40d0b0(0x1e6)]++;else{if(_0x4c9cd4)_0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x1e8)][_0x40d0b0(0x220)]++;else _0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x1e8)][_0x40d0b0(0x206)]++;}}for(const _0x2ccf81 of _0xf70de8){if(_0x2ccf81['attributes'][_0x40d0b0(0x290)])continue;const _0x42a50d=getSanitizedPathWithMigration(getChatInterfacesDir(_0x57bb4e),_0x2ccf81[_0x40d0b0(0x1a9)][_0x40d0b0(0x1c6)],_0x40d0b0(0x1e0));_0x42a50d[_0x40d0b0(0x191)]&&this[_0x40d0b0(0x251)][_0x40d0b0(0x27e)]('Renamed\x20chat\x20interface\x20file:\x20'+a133_0x371f12['basename'](_0x42a50d[_0x40d0b0(0x1d3)])+_0x40d0b0(0x268)+a133_0x371f12['basename'](_0x42a50d[_0x40d0b0(0x275)]));const _0x31cd0d=_0x42a50d[_0x40d0b0(0x275)],_0x4ac6d2=await apiChatInterfaceToYaml(_0x2ccf81,_0x4c7845),_0x8b1816=toChatInterfaceYamlString(_0x4ac6d2),_0x4aa9d3=!a133_0x39b0da[_0x40d0b0(0x247)](_0x31cd0d);let _0x201bd5=_0x4aa9d3,_0x5e1981;if(!_0x4aa9d3){const _0x51f8ea=a133_0x39b0da[_0x40d0b0(0x1d6)](_0x31cd0d,'utf-8'),_0x1bfd1e=generateDiff(_0x51f8ea,_0x8b1816);_0x201bd5=hasChanges(_0x1bfd1e),_0x201bd5&&(_0x5e1981=formatDiffWithColors(_0x1bfd1e));}_0x59accc[_0x40d0b0(0x1f3)]({'path':_0x31cd0d,'content':_0x8b1816}),_0x5d4327[_0x40d0b0(0x1b1)][_0x40d0b0(0x1f3)]({'name':_0x2ccf81['attributes'][_0x40d0b0(0x1c6)],'outputPath':_0x31cd0d,'isNew':_0x4aa9d3,'hasChanges':_0x201bd5,'diff':_0x5e1981}),_0x5d4327[_0x40d0b0(0x298)]['chatInterfaces'][_0x40d0b0(0x193)]++;if(_0x4aa9d3)_0x5d4327['counts'][_0x40d0b0(0x1b1)]['new']++;else{if(_0x201bd5)_0x5d4327['counts'][_0x40d0b0(0x1b1)][_0x40d0b0(0x220)]++;else _0x5d4327[_0x40d0b0(0x298)][_0x40d0b0(0x1b1)][_0x40d0b0(0x206)]++;}}if(_0x662939?.['dryRun'])return _0x5d4327;a133_0x39b0da[_0x40d0b0(0x262)](_0x57bb4e,{'recursive':!![]}),a133_0x39b0da[_0x40d0b0(0x262)](getKnowledgeBasesDir(_0x57bb4e),{'recursive':!![]}),a133_0x39b0da['mkdirSync'](getPromptsDir(_0x57bb4e),{'recursive':!![]}),a133_0x39b0da[_0x40d0b0(0x262)](getIntegrationsDir(_0x57bb4e),{'recursive':!![]}),a133_0x39b0da[_0x40d0b0(0x262)](getExperimentalKnowledgeBasesDir(_0x57bb4e),{'recursive':!![]}),a133_0x39b0da[_0x40d0b0(0x262)](getExperimentalArtifactsDir(_0x57bb4e),{'recursive':!![]}),a133_0x39b0da[_0x40d0b0(0x262)](getFormInterfacesDir(_0x57bb4e),{'recursive':!![]}),a133_0x39b0da['mkdirSync'](getChatInterfacesDir(_0x57bb4e),{'recursive':!![]});const _0x3092af=a133_0x371f12[_0x40d0b0(0x22b)](_0x57bb4e,_0x40d0b0(0x28d));a133_0x39b0da[_0x40d0b0(0x29a)](_0x3092af,createAgentConfigContent(_0x503fb5));for(const _0x588b17 of _0x59accc){if(_0x588b17[_0x40d0b0(0x273)])a133_0x39b0da[_0x40d0b0(0x262)](_0x588b17['path'],{'recursive':!![]});else{const _0x3c4d05=a133_0x371f12[_0x40d0b0(0x19a)](_0x588b17[_0x40d0b0(0x275)]);!a133_0x39b0da[_0x40d0b0(0x247)](_0x3c4d05)&&a133_0x39b0da[_0x40d0b0(0x262)](_0x3c4d05,{'recursive':!![]}),a133_0x39b0da[_0x40d0b0(0x29a)](_0x588b17[_0x40d0b0(0x275)],_0x588b17['content']);}}for(const _0x4e92e4 of _0x25d222){_0x4e92e4[_0x40d0b0(0x273)]?(a133_0x39b0da[_0x40d0b0(0x1a8)](_0x4e92e4[_0x40d0b0(0x275)],{'recursive':!![],'force':!![]}),this[_0x40d0b0(0x251)][_0x40d0b0(0x27e)]('Removed\x20deleted\x20directory:\x20'+a133_0x371f12[_0x40d0b0(0x238)](a133_0x371f12[_0x40d0b0(0x19a)](_0x4e92e4[_0x40d0b0(0x275)]))+'/'+a133_0x371f12[_0x40d0b0(0x238)](_0x4e92e4[_0x40d0b0(0x275)]))):(a133_0x39b0da[_0x40d0b0(0x1a8)](_0x4e92e4['path'],{'force':!![]}),this[_0x40d0b0(0x251)][_0x40d0b0(0x27e)](_0x40d0b0(0x299)+a133_0x371f12[_0x40d0b0(0x238)](a133_0x371f12[_0x40d0b0(0x19a)](_0x4e92e4[_0x40d0b0(0x275)]))+'/'+a133_0x371f12[_0x40d0b0(0x238)](_0x4e92e4[_0x40d0b0(0x275)])));}return _0x5d4327;}async[a133_0x4dcb58(0x1f2)](_0x58fabf,_0x8d2099){const _0x2550f9=a133_0x4dcb58,_0x447e67=a133_0x371f12[_0x2550f9(0x22b)](_0x58fabf,_0x2550f9(0x28d));if(!a133_0x39b0da[_0x2550f9(0x247)](_0x447e67))throw new SDKError(ErrorCode[_0x2550f9(0x1d1)],_0x2550f9(0x194)+_0x58fabf,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x40b3b6=loadAgentConfig(_0x447e67),_0x27fa00=await this[_0x2550f9(0x219)](_0x40b3b6[_0x2550f9(0x274)]),_0x38450f=await this[_0x2550f9(0x1f1)]['getProject'](_0x27fa00),_0x262f08=_0x38450f[_0x2550f9(0x1a9)][_0x2550f9(0x1c6)],_0x365dd7={'projectName':_0x262f08,'projectId':_0x27fa00,'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}}},_0x3f8cfb=[],_0x35f9ad=[],_0x529cf7=[],_0x5bce4f=[],_0x25a19c=[],_0x4e4e37=[],_0x5e2fe0=a133_0x39b0da[_0x2550f9(0x23e)](_0x58fabf,{'withFileTypes':!![]});for(const _0x35e024 of _0x5e2fe0){if(!_0x35e024[_0x2550f9(0x197)]())continue;if([_0x2550f9(0x25d),'prompts',_0x2550f9(0x196),'experimental_knowledge_bases',_0x2550f9(0x1cf),'form_interfaces',_0x2550f9(0x1fc)]['includes'](_0x35e024[_0x2550f9(0x1c6)]))continue;const _0x42b3d0=a133_0x371f12[_0x2550f9(0x22b)](_0x58fabf,_0x35e024['name']);if(isAgentDir(_0x42b3d0)){const _0x513ec2=a133_0x371f12['join'](_0x42b3d0,_0x2550f9(0x1d7)),_0x4094f8=a133_0x371f12[_0x2550f9(0x22b)](_0x42b3d0,'prompt.md'),_0x49d5c2=a133_0x371f12[_0x2550f9(0x22b)](_0x42b3d0,'starter_message.md'),_0x351770=parseAgentYaml(a133_0x39b0da[_0x2550f9(0x1d6)](_0x513ec2,_0x2550f9(0x1a1)),_0x513ec2),_0x4723fe=a133_0x39b0da[_0x2550f9(0x247)](_0x4094f8)?a133_0x39b0da[_0x2550f9(0x1d6)](_0x4094f8,_0x2550f9(0x1a1)):'',_0x3961b2=a133_0x39b0da[_0x2550f9(0x247)](_0x49d5c2)?a133_0x39b0da[_0x2550f9(0x1d6)](_0x49d5c2,_0x2550f9(0x1a1)):_0x351770['starter_message'];_0x3f8cfb[_0x2550f9(0x1f3)]({'name':_0x351770[_0x2550f9(0x1c6)],'dir':_0x42b3d0,'yaml':_0x351770,'systemPrompt':_0x4723fe,'starterMessage':_0x3961b2});}}const _0x438159=getKnowledgeBasesDir(_0x58fabf);if(a133_0x39b0da[_0x2550f9(0x247)](_0x438159)){const _0x130e71=a133_0x39b0da['readdirSync'](_0x438159);for(const _0x23fb31 of _0x130e71){const _0x21bee3=a133_0x371f12[_0x2550f9(0x22b)](_0x438159,_0x23fb31);if(_0x23fb31[_0x2550f9(0x198)](_0x2550f9(0x1e0))){const _0x122abb=parseKnowledgeBaseYaml(a133_0x39b0da[_0x2550f9(0x1d6)](_0x21bee3,_0x2550f9(0x1a1)),_0x21bee3);_0x35f9ad['push']({'name':_0x122abb['name'],'path':_0x21bee3,'yaml':_0x122abb});}else{if(_0x23fb31[_0x2550f9(0x198)](_0x2550f9(0x1e2))){const _0x5d7874=a133_0x39b0da[_0x2550f9(0x1d6)](_0x21bee3,_0x2550f9(0x1a1)),{name:_0x25ba40,text:_0x209748}=parseTextKnowledgeBaseMd(_0x5d7874,_0x23fb31);_0x529cf7['push']({'name':_0x25ba40,'path':_0x21bee3,'text':_0x209748});}}}}const _0x25d810=getPromptsDir(_0x58fabf);if(a133_0x39b0da[_0x2550f9(0x247)](_0x25d810)){const _0x503bea=a133_0x39b0da[_0x2550f9(0x23e)](_0x25d810)[_0x2550f9(0x1d2)](_0x76e4fc=>_0x76e4fc[_0x2550f9(0x198)](_0x2550f9(0x1e0)));for(const _0x454f1a of _0x503bea){const _0x381f8e=a133_0x371f12['join'](_0x25d810,_0x454f1a),_0x1a2550=parsePromptYaml(a133_0x39b0da[_0x2550f9(0x1d6)](_0x381f8e,_0x2550f9(0x1a1)),_0x381f8e);_0x5bce4f[_0x2550f9(0x1f3)]({'name':_0x1a2550[_0x2550f9(0x1c6)],'path':_0x381f8e,'yaml':_0x1a2550});}}const _0xeae300=[],_0x2f65da=getIntegrationsDir(_0x58fabf);if(a133_0x39b0da[_0x2550f9(0x247)](_0x2f65da)){const _0x4d2a2d=a133_0x39b0da[_0x2550f9(0x23e)](_0x2f65da)['filter'](_0x3c98ff=>_0x3c98ff[_0x2550f9(0x198)](_0x2550f9(0x1e0)));for(const _0x561799 of _0x4d2a2d){const _0x39c0fd=a133_0x371f12[_0x2550f9(0x22b)](_0x2f65da,_0x561799),_0x336611=parseIntegrationYaml(a133_0x39b0da[_0x2550f9(0x1d6)](_0x39c0fd,'utf-8'),_0x39c0fd);if(!SAFE_INTEGRATION_TYPES[_0x2550f9(0x28a)](_0x336611[_0x2550f9(0x24d)][_0x2550f9(0x233)]())){this['logger'][_0x2550f9(0x252)]('Skipping\x20integration\x20\x27'+_0x336611[_0x2550f9(0x1c6)]+_0x2550f9(0x256)+_0x336611[_0x2550f9(0x24d)]+'):\x20'+(_0x2550f9(0x277)+SAFE_INTEGRATION_TYPES[_0x2550f9(0x22b)](',\x20')+_0x2550f9(0x18a))+_0x2550f9(0x2a2));continue;}_0xeae300[_0x2550f9(0x1f3)]({'name':_0x336611[_0x2550f9(0x1c6)],'path':_0x39c0fd,'yaml':_0x336611});}}const _0x5cfdd3=getExperimentalKnowledgeBasesDir(_0x58fabf);if(a133_0x39b0da[_0x2550f9(0x247)](_0x5cfdd3)){const _0x39ffeb=a133_0x39b0da[_0x2550f9(0x23e)](_0x5cfdd3,{'withFileTypes':!![]});for(const _0x5f2540 of _0x39ffeb){if(!_0x5f2540[_0x2550f9(0x197)]())continue;const _0x38b900=a133_0x371f12['join'](_0x5cfdd3,_0x5f2540['name']),_0x22a3ec=a133_0x371f12[_0x2550f9(0x22b)](_0x38b900,_0x5f2540[_0x2550f9(0x1c6)]+_0x2550f9(0x1e0)),_0x51a385=a133_0x371f12[_0x2550f9(0x22b)](_0x38b900,'functions');if(!a133_0x39b0da[_0x2550f9(0x247)](_0x22a3ec))continue;const _0x12b5d4=parseExperimentalKnowledgeBaseYaml(a133_0x39b0da[_0x2550f9(0x1d6)](_0x22a3ec,_0x2550f9(0x1a1)),_0x22a3ec),_0x8455c=[];if(a133_0x39b0da[_0x2550f9(0x247)](_0x51a385)){const _0x4c913e=a133_0x39b0da[_0x2550f9(0x23e)](_0x51a385,{'withFileTypes':!![]});for(const _0x36dfe3 of _0x4c913e){if(!_0x36dfe3[_0x2550f9(0x197)]())continue;const _0x22f6e5=a133_0x371f12[_0x2550f9(0x22b)](_0x51a385,_0x36dfe3[_0x2550f9(0x1c6)]),_0x52b46b=a133_0x371f12[_0x2550f9(0x22b)](_0x22f6e5,_0x2550f9(0x255)),_0x3d0c7a=a133_0x371f12[_0x2550f9(0x22b)](_0x22f6e5,_0x2550f9(0x239));a133_0x39b0da[_0x2550f9(0x247)](_0x52b46b)&&a133_0x39b0da[_0x2550f9(0x247)](_0x3d0c7a)&&_0x8455c[_0x2550f9(0x1f3)]({'name':_0x36dfe3[_0x2550f9(0x1c6)],'code':a133_0x39b0da[_0x2550f9(0x1d6)](_0x52b46b,_0x2550f9(0x1a1)),'json_schema':a133_0x39b0da['readFileSync'](_0x3d0c7a,'utf-8')});}}const _0xccbd2c={..._0x12b5d4,'variables':_0x12b5d4[_0x2550f9(0x22d)]||[],'functions':_0x8455c};_0x25a19c[_0x2550f9(0x1f3)]({'name':_0x12b5d4[_0x2550f9(0x1c6)],'dir':_0x38b900,'def':_0xccbd2c});}}const _0x1af256=getExperimentalArtifactsDir(_0x58fabf);if(a133_0x39b0da[_0x2550f9(0x247)](_0x1af256)){const _0x5441c=a133_0x39b0da['readdirSync'](_0x1af256,{'withFileTypes':!![]});for(const _0x2f331a of _0x5441c){if(!_0x2f331a[_0x2550f9(0x197)]())continue;const _0x544d8d=a133_0x371f12[_0x2550f9(0x22b)](_0x1af256,_0x2f331a['name']),_0x41a3c7=a133_0x371f12[_0x2550f9(0x22b)](_0x544d8d,_0x2f331a[_0x2550f9(0x1c6)]+_0x2550f9(0x1e0)),_0x55ca48=a133_0x371f12[_0x2550f9(0x22b)](_0x544d8d,_0x2550f9(0x255)),_0x1afefc=a133_0x371f12[_0x2550f9(0x22b)](_0x544d8d,_0x2550f9(0x246));if(!a133_0x39b0da[_0x2550f9(0x247)](_0x41a3c7)||!a133_0x39b0da[_0x2550f9(0x247)](_0x55ca48))continue;const _0x32cb69=parseExperimentalArtifactYaml(a133_0x39b0da[_0x2550f9(0x1d6)](_0x41a3c7,_0x2550f9(0x1a1)),_0x41a3c7),_0x1f68d7=a133_0x39b0da['readFileSync'](_0x55ca48,_0x2550f9(0x1a1)),_0x543d61=[];if(a133_0x39b0da['existsSync'](_0x1afefc)){const _0x58097b=a133_0x39b0da[_0x2550f9(0x23e)](_0x1afefc);for(const _0x4010d5 of _0x58097b){const _0x1e0357=a133_0x371f12[_0x2550f9(0x22b)](_0x1afefc,_0x4010d5);a133_0x39b0da[_0x2550f9(0x244)](_0x1e0357)[_0x2550f9(0x225)]()&&_0x543d61[_0x2550f9(0x1f3)]({'file_name':_0x4010d5,'text_content':a133_0x39b0da['readFileSync'](_0x1e0357,_0x2550f9(0x1a1))});}}const _0x166baa={..._0x32cb69,'code':_0x1f68d7,'files':_0x543d61};_0x4e4e37[_0x2550f9(0x1f3)]({'name':_0x32cb69[_0x2550f9(0x1c6)],'dir':_0x544d8d,'def':_0x166baa});}}const _0x10a164=[],_0x353451=getFormInterfacesDir(_0x58fabf);if(a133_0x39b0da[_0x2550f9(0x247)](_0x353451)){const _0x297f05=a133_0x39b0da['readdirSync'](_0x353451)[_0x2550f9(0x1d2)](_0x12d372=>_0x12d372[_0x2550f9(0x198)](_0x2550f9(0x1e0)));for(const _0x3cc387 of _0x297f05){const _0x517a34=a133_0x371f12['join'](_0x353451,_0x3cc387),_0x401fdc=parseFormInterfaceYaml(a133_0x39b0da[_0x2550f9(0x1d6)](_0x517a34,'utf-8'),_0x517a34);_0x10a164[_0x2550f9(0x1f3)]({'name':_0x401fdc[_0x2550f9(0x1c6)],'path':_0x517a34,'yaml':_0x401fdc});}}const _0x5d0a49=[],_0x2fc782=getChatInterfacesDir(_0x58fabf);if(a133_0x39b0da['existsSync'](_0x2fc782)){const _0x4e909d=a133_0x39b0da[_0x2550f9(0x23e)](_0x2fc782)['filter'](_0x510024=>_0x510024[_0x2550f9(0x198)]('.yml'));for(const _0x52977a of _0x4e909d){const _0x5191f4=a133_0x371f12[_0x2550f9(0x22b)](_0x2fc782,_0x52977a),_0x4e9de1=parseChatInterfaceYaml(a133_0x39b0da[_0x2550f9(0x1d6)](_0x5191f4,_0x2550f9(0x1a1)),_0x5191f4);_0x5d0a49[_0x2550f9(0x1f3)]({'name':_0x4e9de1['name'],'path':_0x5191f4,'yaml':_0x4e9de1});}}const _0x24b2f2=await this[_0x2550f9(0x1f1)]['listAgentsFull'](_0x27fa00),_0x29c025=await this['client']['listKnowledgeBases'](_0x27fa00),_0x181372=await this[_0x2550f9(0x1f1)]['listTextKnowledgeBases'](_0x27fa00),_0x47199f=await this[_0x2550f9(0x1f1)]['listPrompts'](_0x27fa00),_0x278b92=await this[_0x2550f9(0x1f1)][_0x2550f9(0x190)](_0x27fa00),_0x375220=await safeListOrEmpty(()=>this[_0x2550f9(0x1f1)][_0x2550f9(0x1f5)](_0x27fa00)),_0xda2a94=await safeListOrEmpty(()=>this[_0x2550f9(0x1f1)]['listExperimentalArtifacts'](_0x27fa00)),_0xb9343e=await safeListOrEmpty(()=>this[_0x2550f9(0x1f1)]['listFormInterfaces'](_0x27fa00)),_0x144f51=await safeListOrEmpty(()=>this['client']['listChatInterfaces'](_0x27fa00)),_0x4941e6=await fetchAllToolTargetMaps((_0x4f3813,_0x21f676)=>this['client']['listToolTargets'](_0x4f3813,_0x21f676),_0x27fa00),_0x49211a=new Map(),_0x4ada0f=new Map(),_0x3c0036=new Map(),_0xe87fbd=new Map(),_0x96da1f=new Map(),_0x1c8f11=new Map(),_0xdc0d8c=new Map();for(const _0x1c97aa of _0x24b2f2){_0x49211a[_0x2550f9(0x1c0)](_0x1c97aa[_0x2550f9(0x1a9)]['name'],_0x1c97aa);}for(const _0x4f77c1 of _0x29c025){_0x4ada0f['set'](_0x4f77c1['attributes'][_0x2550f9(0x1c6)],_0x4f77c1);}for(const _0xbf0cd5 of _0x181372){_0x3c0036[_0x2550f9(0x1c0)](_0xbf0cd5[_0x2550f9(0x1a9)][_0x2550f9(0x1c6)],_0xbf0cd5);}for(const _0xbe59a9 of _0x47199f){_0xe87fbd['set'](_0xbe59a9[_0x2550f9(0x1a9)][_0x2550f9(0x1c6)],_0xbe59a9);}for(const _0x37e127 of _0x278b92){_0x96da1f[_0x2550f9(0x1c0)](_0x37e127[_0x2550f9(0x1a9)][_0x2550f9(0x20d)][_0x2550f9(0x233)](),_0x37e127);}for(const _0x9f4a4d of _0x375220){_0x1c8f11[_0x2550f9(0x1c0)](_0x9f4a4d[_0x2550f9(0x1a9)]['name'],_0x9f4a4d);}for(const _0x294dfd of _0xda2a94){_0xdc0d8c['set'](_0x294dfd[_0x2550f9(0x1a9)][_0x2550f9(0x1c6)],_0x294dfd);}const _0x5ab735=new Map(),_0x3803e3=new Map();for(const _0x2dea90 of _0xb9343e){_0x5ab735[_0x2550f9(0x1c0)](_0x2dea90[_0x2550f9(0x1a9)]['name'],_0x2dea90);}for(const _0x43454f of _0x144f51){_0x3803e3[_0x2550f9(0x1c0)](_0x43454f['attributes']['name'],_0x43454f);}const _0x5f11e6=new Map(),_0x3acd84=new Map();for(const _0x52f1f9 of _0x24b2f2){_0x5f11e6['set'](_0x52f1f9[_0x2550f9(0x1a9)]['name'],_0x52f1f9['id']),_0x3acd84[_0x2550f9(0x1c0)](_0x52f1f9['id'],_0x52f1f9[_0x2550f9(0x1a9)][_0x2550f9(0x1c6)]);}const _0x3c4b62=new Map(),_0x24fc48=new Map();for(const _0x2a1291 of _0x47199f){_0x3c4b62[_0x2550f9(0x1c0)](_0x2a1291[_0x2550f9(0x1a9)][_0x2550f9(0x1c6)],_0x2a1291['id']),_0x24fc48[_0x2550f9(0x1c0)](_0x2a1291['id'],_0x2a1291[_0x2550f9(0x1a9)][_0x2550f9(0x1c6)]);}const _0x3f2b97=_0x4941e6[_0x2550f9(0x26c)][_0x2550f9(0x278)]||new Map(),_0x2a1d50=_0x4941e6[_0x2550f9(0x26c)][_0x2550f9(0x18d)]||new Map(),_0x4f338e=_0x4941e6['nameToId']['ExperimentalKnowledgeBase']||new Map(),_0x5071c2=new Map(),_0x23047d={'resolveToolTargetName':buildNameResolver({..._0x4941e6[_0x2550f9(0x21f)],'Agent':_0x3acd84}),'resolvePromptName':async _0x4ecbc8=>_0x24fc48[_0x2550f9(0x291)](_0x4ecbc8),'onWarning':_0xb65584=>this[_0x2550f9(0x251)]['warn'](_0xb65584)};let _0x4ada1a=[];const _0x2ed6b0={'projectId':_0x27fa00,'resolveToolTargetId':buildIdResolver({..._0x4941e6[_0x2550f9(0x26c)],'Agent':_0x5f11e6}),'resolvePromptId':async _0x3ced67=>_0x3c4b62[_0x2550f9(0x291)](_0x3ced67),'onWarning':_0x15a709=>{const _0x7438f2=_0x2550f9;this['logger']['warn'](_0x15a709),_0x4ada1a[_0x7438f2(0x1f3)](_0x15a709);}},{resolved:_0x2a534c,unresolved:_0x31dac6}=resolveAgentDependencies(_0x3f8cfb,new Set(_0x49211a['keys']()));for(const {agent:_0x4e3ff7,missingDeps:_0x3d1603}of _0x31dac6){_0x365dd7[_0x2550f9(0x1d4)][_0x2550f9(0x1f3)]({'agentName':_0x4e3ff7[_0x2550f9(0x224)]['name'],'action':_0x2550f9(0x210),'error':_0x2550f9(0x18c)+_0x3d1603[_0x2550f9(0x22b)](',\x20')+'.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.'}),_0x365dd7['counts'][_0x2550f9(0x1d4)][_0x2550f9(0x294)]++;}for(const _0xe71eaf of _0x35f9ad){const _0x1b209f=_0x4ada0f[_0x2550f9(0x291)](_0xe71eaf[_0x2550f9(0x224)][_0x2550f9(0x1c6)]),_0x264530=a133_0x39b0da['readFileSync'](_0xe71eaf[_0x2550f9(0x275)],_0x2550f9(0x1a1));if(_0x1b209f){const _0x53c577=apiKnowledgeBaseToYaml(_0x1b209f),_0x34e8c3=toKnowledgeBaseYamlString(_0x53c577),_0x1b7b3c=generateDiff(_0x34e8c3,_0x264530),_0x6ea946=hasChanges(_0x1b7b3c);_0x6ea946?(_0x365dd7[_0x2550f9(0x272)]['push']({'name':_0xe71eaf['yaml']['name'],'action':'updated','id':_0x1b209f['id'],'diff':formatDiffWithColors(_0x1b7b3c)}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x272)][_0x2550f9(0x220)]++):(_0x365dd7[_0x2550f9(0x272)][_0x2550f9(0x1f3)]({'name':_0xe71eaf['yaml'][_0x2550f9(0x1c6)],'action':_0x2550f9(0x206),'id':_0x1b209f['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x272)][_0x2550f9(0x206)]++);}else _0x365dd7[_0x2550f9(0x272)][_0x2550f9(0x1f3)]({'name':_0xe71eaf['yaml'][_0x2550f9(0x1c6)],'action':_0x2550f9(0x1dc)}),_0x365dd7['counts'][_0x2550f9(0x272)][_0x2550f9(0x1dc)]++;}for(const _0x3e95a8 of _0x529cf7){const _0x2c74a9=_0x3c0036[_0x2550f9(0x291)](_0x3e95a8[_0x2550f9(0x1c6)]),_0x2cd62c=a133_0x39b0da[_0x2550f9(0x1d6)](_0x3e95a8['path'],_0x2550f9(0x1a1));if(_0x2c74a9){const _0x47b904=toTextKnowledgeBaseMd(_0x2c74a9[_0x2550f9(0x1a9)][_0x2550f9(0x1c6)],_0x2c74a9[_0x2550f9(0x1a9)][_0x2550f9(0x1e9)]),_0x3c93cc=generateDiff(_0x47b904,_0x2cd62c),_0x25198b=hasChanges(_0x3c93cc);_0x25198b?(_0x365dd7['textKnowledgeBases'][_0x2550f9(0x1f3)]({'name':_0x3e95a8[_0x2550f9(0x1c6)],'action':'updated','id':_0x2c74a9['id'],'diff':formatDiffWithColors(_0x3c93cc)}),_0x365dd7[_0x2550f9(0x298)]['textKnowledgeBases'][_0x2550f9(0x220)]++):(_0x365dd7['textKnowledgeBases']['push']({'name':_0x3e95a8[_0x2550f9(0x1c6)],'action':_0x2550f9(0x206),'id':_0x2c74a9['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x21b)]['unchanged']++);}else _0x365dd7['textKnowledgeBases'][_0x2550f9(0x1f3)]({'name':_0x3e95a8[_0x2550f9(0x1c6)],'action':'created'}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x21b)]['created']++;}for(const _0x244092 of _0x2a534c){const _0x2bfc43=_0x49211a[_0x2550f9(0x291)](_0x244092[_0x2550f9(0x224)][_0x2550f9(0x1c6)]),_0x586bdb=a133_0x371f12['join'](_0x244092[_0x2550f9(0x226)],_0x2550f9(0x1d7)),_0x13ac56=a133_0x39b0da[_0x2550f9(0x1d6)](_0x586bdb,'utf-8'),_0x282363=_0x244092[_0x2550f9(0x26f)],_0x2212f1=_0x2550f9(0x205)+_0x282363+'\x0a\x0a#\x20agent.yml\x0a'+_0x13ac56;if(_0x2bfc43){const {yaml:_0xdd25cd,systemPrompt:_0x597e87}=await agentResponseToDef(_0x2bfc43,_0x23047d),_0x21ebac=toAgentYamlString(_0xdd25cd),_0x209781=_0x2550f9(0x205)+_0x597e87+'\x0a\x0a#\x20agent.yml\x0a'+_0x21ebac,_0x3993ce=generateDiff(_0x209781,_0x2212f1),_0x3a6aab=hasChanges(_0x3993ce);_0x3a6aab?(_0x365dd7[_0x2550f9(0x1d4)]['push']({'agentName':_0x244092[_0x2550f9(0x224)]['name'],'action':'updated','agentId':_0x2bfc43['id'],'diff':formatDiffWithColors(_0x3993ce)}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1d4)][_0x2550f9(0x220)]++):(_0x365dd7['agents']['push']({'agentName':_0x244092[_0x2550f9(0x224)]['name'],'action':'unchanged','agentId':_0x2bfc43['id']}),_0x365dd7[_0x2550f9(0x298)]['agents'][_0x2550f9(0x206)]++);}else _0x365dd7[_0x2550f9(0x1d4)][_0x2550f9(0x1f3)]({'agentName':_0x244092['yaml'][_0x2550f9(0x1c6)],'action':'created'}),_0x365dd7['counts']['agents']['created']++;}for(const _0x31c6a0 of _0x5bce4f){const _0x4cbd48=_0xe87fbd[_0x2550f9(0x291)](_0x31c6a0[_0x2550f9(0x224)]['name']),_0x17649c=a133_0x39b0da[_0x2550f9(0x1d6)](_0x31c6a0[_0x2550f9(0x275)],_0x2550f9(0x1a1));if(_0x4cbd48){const _0x5db369=await apiPromptToYaml(_0x4cbd48,_0x23047d);if(!_0x5db369){_0x365dd7[_0x2550f9(0x1ce)][_0x2550f9(0x1f3)]({'name':_0x31c6a0[_0x2550f9(0x224)][_0x2550f9(0x1c6)],'action':_0x2550f9(0x220),'id':_0x4cbd48['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1ce)]['updated']++;continue;}const _0xe3ffc5=toPromptYamlString(_0x5db369),_0x41cbef=generateDiff(_0xe3ffc5,_0x17649c),_0x12b365=hasChanges(_0x41cbef);_0x12b365?(_0x365dd7['prompts']['push']({'name':_0x31c6a0[_0x2550f9(0x224)]['name'],'action':'updated','id':_0x4cbd48['id'],'diff':formatDiffWithColors(_0x41cbef)}),_0x365dd7[_0x2550f9(0x298)]['prompts']['updated']++):(_0x365dd7[_0x2550f9(0x1ce)]['push']({'name':_0x31c6a0[_0x2550f9(0x224)][_0x2550f9(0x1c6)],'action':'unchanged','id':_0x4cbd48['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1ce)][_0x2550f9(0x206)]++);}else _0x365dd7[_0x2550f9(0x1ce)][_0x2550f9(0x1f3)]({'name':_0x31c6a0[_0x2550f9(0x224)]['name'],'action':_0x2550f9(0x1dc)}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1ce)][_0x2550f9(0x1dc)]++;}for(const _0x13e4a8 of _0xeae300){const _0x25b0da=_0x96da1f[_0x2550f9(0x291)](_0x13e4a8['yaml']['service_type']),_0x51e7d8=a133_0x39b0da[_0x2550f9(0x1d6)](_0x13e4a8[_0x2550f9(0x275)],_0x2550f9(0x1a1));if(_0x25b0da){const _0x5b7257=await apiIntegrationToYaml(_0x25b0da,_0x23047d),_0x513c85=toIntegrationYamlString(_0x5b7257),_0x1448ea=generateDiff(_0x513c85,_0x51e7d8),_0x1e94ee=hasChanges(_0x1448ea);_0x1e94ee?(_0x365dd7[_0x2550f9(0x196)][_0x2550f9(0x1f3)]({'name':_0x13e4a8['yaml'][_0x2550f9(0x24d)],'action':_0x2550f9(0x220),'id':_0x25b0da['id'],'diff':formatDiffWithColors(_0x1448ea)}),_0x365dd7[_0x2550f9(0x298)]['integrations'][_0x2550f9(0x220)]++):(_0x365dd7[_0x2550f9(0x196)]['push']({'name':_0x13e4a8[_0x2550f9(0x224)][_0x2550f9(0x24d)],'action':_0x2550f9(0x206),'id':_0x25b0da['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x196)][_0x2550f9(0x206)]++);}else _0x365dd7[_0x2550f9(0x196)][_0x2550f9(0x1f3)]({'name':_0x13e4a8[_0x2550f9(0x224)][_0x2550f9(0x24d)],'action':'created'}),_0x365dd7[_0x2550f9(0x298)]['integrations']['created']++;}for(const _0x35caf2 of _0x25a19c){const _0x3d51a5=_0x1c8f11['get'](_0x35caf2['def']['name']),_0xe33f14=toExperimentalKnowledgeBaseYamlString(_0x35caf2[_0x2550f9(0x1fd)]);let _0x4623d0=_0xe33f14;for(const _0x1e7938 of _0x35caf2[_0x2550f9(0x1fd)][_0x2550f9(0x254)]){_0x4623d0+=_0x2550f9(0x29c)+_0x1e7938['name']+_0x2550f9(0x1e5)+_0x1e7938[_0x2550f9(0x297)]+_0x2550f9(0x235)+_0x1e7938[_0x2550f9(0x1c6)]+_0x2550f9(0x1e5)+_0x1e7938[_0x2550f9(0x1e1)]+'\x0a';}if(_0x3d51a5){const _0x3af2c3=apiExperimentalKnowledgeBaseToYaml(_0x3d51a5),_0x2c3ba7=toExperimentalKnowledgeBaseYamlString(_0x3af2c3);let _0x64126e=_0x2c3ba7;for(const _0x16bbe9 of _0x3af2c3[_0x2550f9(0x254)]){_0x64126e+='\x0a---\x20function:\x20'+_0x16bbe9[_0x2550f9(0x1c6)]+_0x2550f9(0x1e5)+_0x16bbe9[_0x2550f9(0x297)]+_0x2550f9(0x235)+_0x16bbe9['name']+_0x2550f9(0x1e5)+_0x16bbe9[_0x2550f9(0x1e1)]+'\x0a';}const _0x4349fb=generateDiff(_0x64126e,_0x4623d0),_0xa0bbb=hasChanges(_0x4349fb);_0xa0bbb?(_0x365dd7[_0x2550f9(0x1bc)][_0x2550f9(0x1f3)]({'name':_0x35caf2[_0x2550f9(0x1fd)][_0x2550f9(0x1c6)],'action':_0x2550f9(0x220),'id':_0x3d51a5['id'],'diff':formatDiffWithColors(_0x4349fb)}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1bc)][_0x2550f9(0x220)]++):(_0x365dd7[_0x2550f9(0x1bc)][_0x2550f9(0x1f3)]({'name':_0x35caf2[_0x2550f9(0x1fd)]['name'],'action':_0x2550f9(0x206),'id':_0x3d51a5['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1bc)][_0x2550f9(0x206)]++);}else _0x365dd7[_0x2550f9(0x1bc)]['push']({'name':_0x35caf2['def'][_0x2550f9(0x1c6)],'action':_0x2550f9(0x1dc)}),_0x365dd7[_0x2550f9(0x298)]['experimentalKnowledgeBases'][_0x2550f9(0x1dc)]++;}for(const _0x3f28fd of _0x4e4e37){const _0x561f77=_0xdc0d8c[_0x2550f9(0x291)](_0x3f28fd[_0x2550f9(0x1fd)][_0x2550f9(0x1c6)]),_0x1179e6=toExperimentalArtifactYamlString(_0x3f28fd[_0x2550f9(0x1fd)]);let _0x247906=_0x1179e6+(_0x2550f9(0x1c4)+_0x3f28fd[_0x2550f9(0x1fd)][_0x2550f9(0x297)]+'\x0a');for(const _0x298dd9 of _0x3f28fd['def'][_0x2550f9(0x246)]){_0x247906+=_0x2550f9(0x1ed)+_0x298dd9[_0x2550f9(0x25a)]+_0x2550f9(0x1e5)+_0x298dd9[_0x2550f9(0x1ef)]+'\x0a';}if(_0x561f77){const _0x22aecd=apiExperimentalArtifactToYaml(_0x561f77),_0x3b1c43=toExperimentalArtifactYamlString(_0x22aecd);let _0x447c78=_0x3b1c43+(_0x2550f9(0x1c4)+_0x22aecd['code']+'\x0a');for(const _0xad1839 of _0x22aecd['files']){_0x447c78+=_0x2550f9(0x1ed)+_0xad1839['file_name']+'\x20---\x0a'+_0xad1839[_0x2550f9(0x1ef)]+'\x0a';}const _0x54f9c6=generateDiff(_0x447c78,_0x247906),_0x47521c=hasChanges(_0x54f9c6);_0x47521c?(_0x365dd7['experimentalArtifacts']['push']({'name':_0x3f28fd[_0x2550f9(0x1fd)][_0x2550f9(0x1c6)],'action':_0x2550f9(0x220),'id':_0x561f77['id'],'diff':formatDiffWithColors(_0x54f9c6)}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1cb)]['updated']++):(_0x365dd7['experimentalArtifacts']['push']({'name':_0x3f28fd['def']['name'],'action':'unchanged','id':_0x561f77['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1cb)][_0x2550f9(0x206)]++);}else _0x365dd7[_0x2550f9(0x1cb)][_0x2550f9(0x1f3)]({'name':_0x3f28fd[_0x2550f9(0x1fd)][_0x2550f9(0x1c6)],'action':'created'}),_0x365dd7['counts'][_0x2550f9(0x1cb)][_0x2550f9(0x1dc)]++;}for(const _0x25f87e of _0x10a164){const _0x17d88d=_0x5ab735[_0x2550f9(0x291)](_0x25f87e[_0x2550f9(0x224)]['name']),_0x4a3b74=a133_0x39b0da[_0x2550f9(0x1d6)](_0x25f87e[_0x2550f9(0x275)],_0x2550f9(0x1a1));if(_0x17d88d){const _0x5283d9=await apiFormInterfaceToYaml(_0x17d88d,_0x23047d),_0x39dc33=toFormInterfaceYamlString(_0x5283d9),_0x476d99=generateDiff(_0x39dc33,_0x4a3b74),_0xcc239a=hasChanges(_0x476d99);_0xcc239a?(_0x365dd7['formInterfaces'][_0x2550f9(0x1f3)]({'name':_0x25f87e[_0x2550f9(0x224)][_0x2550f9(0x1c6)],'action':'updated','id':_0x17d88d['id'],'diff':formatDiffWithColors(_0x476d99)}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1e8)][_0x2550f9(0x220)]++):(_0x365dd7[_0x2550f9(0x1e8)][_0x2550f9(0x1f3)]({'name':_0x25f87e['yaml'][_0x2550f9(0x1c6)],'action':_0x2550f9(0x206),'id':_0x17d88d['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1e8)][_0x2550f9(0x206)]++);}else _0x365dd7[_0x2550f9(0x1e8)][_0x2550f9(0x1f3)]({'name':_0x25f87e['yaml']['name'],'action':_0x2550f9(0x1dc)}),_0x365dd7['counts']['formInterfaces'][_0x2550f9(0x1dc)]++;}for(const _0x2b8d9d of _0x5d0a49){const _0x4b0388=_0x3803e3[_0x2550f9(0x291)](_0x2b8d9d['yaml'][_0x2550f9(0x1c6)]),_0x129bd7=a133_0x39b0da[_0x2550f9(0x1d6)](_0x2b8d9d[_0x2550f9(0x275)],_0x2550f9(0x1a1));if(_0x4b0388){const _0x34acd6=await apiChatInterfaceToYaml(_0x4b0388,_0x23047d),_0x3ef221=toChatInterfaceYamlString(_0x34acd6),_0x1c5960=generateDiff(_0x3ef221,_0x129bd7),_0x461417=hasChanges(_0x1c5960);_0x461417?(_0x365dd7[_0x2550f9(0x1b1)]['push']({'name':_0x2b8d9d[_0x2550f9(0x224)][_0x2550f9(0x1c6)],'action':_0x2550f9(0x220),'id':_0x4b0388['id'],'diff':formatDiffWithColors(_0x1c5960)}),_0x365dd7[_0x2550f9(0x298)]['chatInterfaces']['updated']++):(_0x365dd7[_0x2550f9(0x1b1)][_0x2550f9(0x1f3)]({'name':_0x2b8d9d['yaml'][_0x2550f9(0x1c6)],'action':_0x2550f9(0x206),'id':_0x4b0388['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1b1)][_0x2550f9(0x206)]++);}else _0x365dd7[_0x2550f9(0x1b1)][_0x2550f9(0x1f3)]({'name':_0x2b8d9d[_0x2550f9(0x224)][_0x2550f9(0x1c6)],'action':_0x2550f9(0x1dc)}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1b1)]['created']++;}if(_0x8d2099?.[_0x2550f9(0x245)])return _0x365dd7;_0x365dd7[_0x2550f9(0x272)]=[],_0x365dd7['textKnowledgeBases']=[],_0x365dd7[_0x2550f9(0x1ce)]=[],_0x365dd7[_0x2550f9(0x196)]=[],_0x365dd7['experimentalKnowledgeBases']=[],_0x365dd7[_0x2550f9(0x1cb)]=[],_0x365dd7[_0x2550f9(0x1e8)]=[],_0x365dd7[_0x2550f9(0x1b1)]=[];const _0x37d6fd=_0x365dd7[_0x2550f9(0x1d4)]['filter'](_0x11da57=>_0x11da57[_0x2550f9(0x240)]==='error');_0x365dd7[_0x2550f9(0x1d4)]=_0x37d6fd,_0x365dd7[_0x2550f9(0x298)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x37d6fd['length']},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x1691bb of _0x35f9ad){try{const _0x28dafd=_0x4ada0f['get'](_0x1691bb[_0x2550f9(0x224)][_0x2550f9(0x1c6)]),_0x333943=yamlKnowledgeBaseToApi(_0x1691bb['yaml'],_0x27fa00);if(_0x28dafd)await this[_0x2550f9(0x1f1)][_0x2550f9(0x1af)](_0x28dafd['id'],_0x333943),_0x3f2b97[_0x2550f9(0x1c0)](_0x1691bb[_0x2550f9(0x224)][_0x2550f9(0x1c6)],_0x28dafd['id']),_0x365dd7[_0x2550f9(0x272)][_0x2550f9(0x1f3)]({'name':_0x1691bb[_0x2550f9(0x224)][_0x2550f9(0x1c6)],'action':'updated','id':_0x28dafd['id']}),_0x365dd7['counts'][_0x2550f9(0x272)][_0x2550f9(0x220)]++;else{const _0x26d0c8=await this[_0x2550f9(0x1f1)][_0x2550f9(0x258)](_0x333943);_0x3f2b97[_0x2550f9(0x1c0)](_0x1691bb['yaml'][_0x2550f9(0x1c6)],_0x26d0c8['id']),_0x365dd7[_0x2550f9(0x272)][_0x2550f9(0x1f3)]({'name':_0x1691bb['yaml'][_0x2550f9(0x1c6)],'action':_0x2550f9(0x1dc),'id':_0x26d0c8['id']}),_0x365dd7[_0x2550f9(0x298)]['knowledgeBases'][_0x2550f9(0x1dc)]++;}}catch(_0x4bd515){_0x365dd7[_0x2550f9(0x272)][_0x2550f9(0x1f3)]({'name':_0x1691bb[_0x2550f9(0x224)][_0x2550f9(0x1c6)],'action':_0x2550f9(0x210),'error':_0x4bd515[_0x2550f9(0x1b7)]}),_0x365dd7['counts'][_0x2550f9(0x272)][_0x2550f9(0x294)]++;}}for(const _0x53c847 of _0x529cf7){try{const _0xa2d4a9=_0x3c0036[_0x2550f9(0x291)](_0x53c847[_0x2550f9(0x1c6)]),_0x5410f1=yamlTextKnowledgeBaseToApi({'name':_0x53c847[_0x2550f9(0x1c6)],'text':_0x53c847[_0x2550f9(0x1e9)]},_0x27fa00);if(_0xa2d4a9)await this[_0x2550f9(0x1f1)]['updateTextKnowledgeBase'](_0xa2d4a9['id'],_0x5410f1),_0x2a1d50[_0x2550f9(0x1c0)](_0x53c847[_0x2550f9(0x1c6)],_0xa2d4a9['id']),_0x365dd7[_0x2550f9(0x21b)]['push']({'name':_0x53c847[_0x2550f9(0x1c6)],'action':_0x2550f9(0x220),'id':_0xa2d4a9['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x21b)][_0x2550f9(0x220)]++;else{const _0x46545c=await this['client']['createTextKnowledgeBase'](_0x5410f1);_0x2a1d50['set'](_0x53c847[_0x2550f9(0x1c6)],_0x46545c['id']),_0x365dd7['textKnowledgeBases'][_0x2550f9(0x1f3)]({'name':_0x53c847[_0x2550f9(0x1c6)],'action':_0x2550f9(0x1dc),'id':_0x46545c['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x21b)]['created']++;}}catch(_0x18bbdc){_0x365dd7[_0x2550f9(0x21b)][_0x2550f9(0x1f3)]({'name':_0x53c847[_0x2550f9(0x1c6)],'action':_0x2550f9(0x210),'error':_0x18bbdc[_0x2550f9(0x1b7)]}),_0x365dd7[_0x2550f9(0x298)]['textKnowledgeBases'][_0x2550f9(0x294)]++;}}for(const _0x50857f of _0x25a19c){try{const _0x71b025=_0x1c8f11[_0x2550f9(0x291)](_0x50857f['def'][_0x2550f9(0x1c6)]),_0x2754a8=yamlExperimentalKnowledgeBaseToApi(_0x50857f[_0x2550f9(0x1fd)],_0x27fa00);if(_0x71b025)await this[_0x2550f9(0x1f1)][_0x2550f9(0x1d5)](_0x71b025['id'],_0x2754a8),_0x4f338e[_0x2550f9(0x1c0)](_0x50857f[_0x2550f9(0x1fd)][_0x2550f9(0x1c6)],_0x71b025['id']),_0x365dd7[_0x2550f9(0x1bc)][_0x2550f9(0x1f3)]({'name':_0x50857f[_0x2550f9(0x1fd)][_0x2550f9(0x1c6)],'action':_0x2550f9(0x220),'id':_0x71b025['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1bc)][_0x2550f9(0x220)]++;else{const _0x200261=await this['client'][_0x2550f9(0x19f)](_0x2754a8);_0x4f338e[_0x2550f9(0x1c0)](_0x50857f['def']['name'],_0x200261['id']),_0x365dd7[_0x2550f9(0x1bc)][_0x2550f9(0x1f3)]({'name':_0x50857f[_0x2550f9(0x1fd)]['name'],'action':_0x2550f9(0x1dc),'id':_0x200261['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1bc)][_0x2550f9(0x1dc)]++;}}catch(_0x5217f5){_0x365dd7[_0x2550f9(0x1bc)][_0x2550f9(0x1f3)]({'name':_0x50857f['def'][_0x2550f9(0x1c6)],'action':_0x2550f9(0x210),'error':_0x5217f5[_0x2550f9(0x1b7)]}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1bc)][_0x2550f9(0x294)]++;}}for(const _0x435056 of _0x4e4e37){try{const _0x2ee5ed=_0xdc0d8c[_0x2550f9(0x291)](_0x435056[_0x2550f9(0x1fd)][_0x2550f9(0x1c6)]),_0x4b1db9=yamlExperimentalArtifactToApi(_0x435056[_0x2550f9(0x1fd)],_0x27fa00);if(_0x2ee5ed)await this[_0x2550f9(0x1f1)][_0x2550f9(0x20b)](_0x2ee5ed['id'],_0x4b1db9),_0x5071c2[_0x2550f9(0x1c0)](_0x435056[_0x2550f9(0x1fd)]['name'],_0x2ee5ed['id']),_0x365dd7[_0x2550f9(0x1cb)][_0x2550f9(0x1f3)]({'name':_0x435056[_0x2550f9(0x1fd)][_0x2550f9(0x1c6)],'action':'updated','id':_0x2ee5ed['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1cb)][_0x2550f9(0x220)]++;else{const _0x330d96=await this['client'][_0x2550f9(0x269)](_0x4b1db9);_0x5071c2[_0x2550f9(0x1c0)](_0x435056['def'][_0x2550f9(0x1c6)],_0x330d96['id']),_0x365dd7[_0x2550f9(0x1cb)][_0x2550f9(0x1f3)]({'name':_0x435056['def'][_0x2550f9(0x1c6)],'action':_0x2550f9(0x1dc),'id':_0x330d96['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1cb)][_0x2550f9(0x1dc)]++;}}catch(_0x18f2c8){_0x365dd7[_0x2550f9(0x1cb)][_0x2550f9(0x1f3)]({'name':_0x435056['def'][_0x2550f9(0x1c6)],'action':_0x2550f9(0x210),'error':_0x18f2c8[_0x2550f9(0x1b7)]}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1cb)][_0x2550f9(0x294)]++;}}for(const _0x1e0bde of _0x2a534c){_0x4ada1a=[];try{const _0x215489=_0x49211a['get'](_0x1e0bde[_0x2550f9(0x224)][_0x2550f9(0x1c6)]),_0x2e173f=await agentDefToRequest(_0x1e0bde[_0x2550f9(0x224)],_0x1e0bde[_0x2550f9(0x26f)],_0x1e0bde[_0x2550f9(0x1cc)],_0x2ed6b0);if(_0x215489)await this[_0x2550f9(0x1f1)][_0x2550f9(0x1bd)](_0x215489['id'],_0x2e173f),_0x5f11e6[_0x2550f9(0x1c0)](_0x1e0bde[_0x2550f9(0x224)][_0x2550f9(0x1c6)],_0x215489['id']),_0x365dd7[_0x2550f9(0x1d4)][_0x2550f9(0x1f3)]({'agentName':_0x1e0bde[_0x2550f9(0x224)][_0x2550f9(0x1c6)],'action':_0x2550f9(0x220),'agentId':_0x215489['id'],'warnings':_0x4ada1a[_0x2550f9(0x1a7)]>0x0?_0x4ada1a:undefined}),_0x365dd7[_0x2550f9(0x298)]['agents'][_0x2550f9(0x220)]++;else{const _0x242f76=await this[_0x2550f9(0x1f1)][_0x2550f9(0x188)](_0x2e173f);_0x5f11e6[_0x2550f9(0x1c0)](_0x1e0bde[_0x2550f9(0x224)]['name'],_0x242f76['id']),_0x365dd7[_0x2550f9(0x1d4)][_0x2550f9(0x1f3)]({'agentName':_0x1e0bde[_0x2550f9(0x224)][_0x2550f9(0x1c6)],'action':_0x2550f9(0x1dc),'agentId':_0x242f76['id'],'warnings':_0x4ada1a[_0x2550f9(0x1a7)]>0x0?_0x4ada1a:undefined}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1d4)][_0x2550f9(0x1dc)]++;}}catch(_0x523404){_0x365dd7[_0x2550f9(0x1d4)][_0x2550f9(0x1f3)]({'agentName':_0x1e0bde[_0x2550f9(0x224)][_0x2550f9(0x1c6)],'action':_0x2550f9(0x210),'error':_0x523404[_0x2550f9(0x1b7)],'warnings':_0x4ada1a[_0x2550f9(0x1a7)]>0x0?_0x4ada1a:undefined}),_0x365dd7['counts'][_0x2550f9(0x1d4)]['errors']++;}}for(const _0x2f9650 of _0x5bce4f){try{const _0x3563c4=_0xe87fbd[_0x2550f9(0x291)](_0x2f9650['yaml']['name']),_0x33ad46=await yamlPromptToApi(_0x2f9650[_0x2550f9(0x224)],_0x27fa00,_0x2ed6b0);if(!_0x33ad46){_0x365dd7['prompts']['push']({'name':_0x2f9650[_0x2550f9(0x224)][_0x2550f9(0x1c6)],'action':_0x2550f9(0x210),'error':_0x2550f9(0x1f0)}),_0x365dd7['counts']['prompts']['errors']++;continue;}if(_0x3563c4)await this[_0x2550f9(0x1f1)][_0x2550f9(0x199)](_0x3563c4['id'],_0x33ad46),_0x3c4b62[_0x2550f9(0x1c0)](_0x2f9650[_0x2550f9(0x224)]['name'],_0x3563c4['id']),_0x365dd7['prompts']['push']({'name':_0x2f9650[_0x2550f9(0x224)][_0x2550f9(0x1c6)],'action':_0x2550f9(0x220),'id':_0x3563c4['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1ce)]['updated']++;else{const _0x3fce63=await this[_0x2550f9(0x1f1)]['createPrompt'](_0x33ad46);_0x3c4b62[_0x2550f9(0x1c0)](_0x2f9650[_0x2550f9(0x224)][_0x2550f9(0x1c6)],_0x3fce63['id']),_0x365dd7[_0x2550f9(0x1ce)][_0x2550f9(0x1f3)]({'name':_0x2f9650['yaml'][_0x2550f9(0x1c6)],'action':'created','id':_0x3fce63['id']}),_0x365dd7[_0x2550f9(0x298)]['prompts'][_0x2550f9(0x1dc)]++;}}catch(_0x537db9){_0x365dd7['prompts'][_0x2550f9(0x1f3)]({'name':_0x2f9650[_0x2550f9(0x224)][_0x2550f9(0x1c6)],'action':_0x2550f9(0x210),'error':_0x537db9['message']}),_0x365dd7['counts'][_0x2550f9(0x1ce)]['errors']++;}}for(const _0x1f22f2 of _0xeae300){try{const _0x33b7d1=_0x96da1f['get'](_0x1f22f2[_0x2550f9(0x224)]['service_type']),_0x38775c=await yamlIntegrationToApi(_0x1f22f2[_0x2550f9(0x224)],_0x27fa00,_0x2ed6b0);if(_0x33b7d1){await this[_0x2550f9(0x1f1)][_0x2550f9(0x1cd)](_0x33b7d1['id']);const _0x4cd46d=await this[_0x2550f9(0x1f1)]['createIntegration'](_0x38775c);_0x365dd7[_0x2550f9(0x196)][_0x2550f9(0x1f3)]({'name':_0x1f22f2['yaml'][_0x2550f9(0x24d)],'action':_0x2550f9(0x220),'id':_0x4cd46d['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x196)][_0x2550f9(0x220)]++;}else{const _0xf395eb=await this[_0x2550f9(0x1f1)][_0x2550f9(0x286)](_0x38775c);_0x365dd7[_0x2550f9(0x196)][_0x2550f9(0x1f3)]({'name':_0x1f22f2[_0x2550f9(0x224)]['service_type'],'action':_0x2550f9(0x1dc),'id':_0xf395eb['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x196)][_0x2550f9(0x1dc)]++;}}catch(_0x5897c5){_0x365dd7['integrations']['push']({'name':_0x1f22f2['yaml']['service_type'],'action':'error','error':_0x5897c5['message']}),_0x365dd7['counts']['integrations'][_0x2550f9(0x294)]++;}}for(const _0x109cde of _0x10a164){try{const _0x22114e=_0x5ab735[_0x2550f9(0x291)](_0x109cde[_0x2550f9(0x224)][_0x2550f9(0x1c6)]),_0x3666d4=await yamlFormInterfaceToApi(_0x109cde[_0x2550f9(0x224)],_0x27fa00,_0x2ed6b0);if(!_0x3666d4){_0x365dd7['formInterfaces'][_0x2550f9(0x1f3)]({'name':_0x109cde[_0x2550f9(0x224)]['name'],'action':_0x2550f9(0x210),'error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x365dd7[_0x2550f9(0x298)]['formInterfaces'][_0x2550f9(0x294)]++;continue;}if(_0x22114e){const _0x71f78=await this[_0x2550f9(0x1f1)][_0x2550f9(0x242)](_0x22114e['id'],_0x3666d4);_0x365dd7[_0x2550f9(0x1e8)][_0x2550f9(0x1f3)]({'name':_0x109cde['yaml'][_0x2550f9(0x1c6)],'action':_0x2550f9(0x220),'id':_0x71f78['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1e8)]['updated']++;}else{const _0x36d48d=await this['client'][_0x2550f9(0x236)](_0x3666d4);_0x365dd7[_0x2550f9(0x1e8)]['push']({'name':_0x109cde[_0x2550f9(0x224)][_0x2550f9(0x1c6)],'action':'created','id':_0x36d48d['id']}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1e8)]['created']++;}}catch(_0x29029b){_0x365dd7[_0x2550f9(0x1e8)][_0x2550f9(0x1f3)]({'name':_0x109cde[_0x2550f9(0x224)][_0x2550f9(0x1c6)],'action':'error','error':_0x29029b[_0x2550f9(0x1b7)]}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1e8)][_0x2550f9(0x294)]++;}}for(const _0x3d7d7a of _0x5d0a49){try{const _0x57a9ab=_0x3803e3['get'](_0x3d7d7a[_0x2550f9(0x224)][_0x2550f9(0x1c6)]),_0x295f0d=await yamlChatInterfaceToApi(_0x3d7d7a[_0x2550f9(0x224)],_0x27fa00,_0x2ed6b0);if(_0x57a9ab){const _0x265499=await this[_0x2550f9(0x1f1)][_0x2550f9(0x22f)](_0x57a9ab['id'],_0x295f0d);_0x365dd7[_0x2550f9(0x1b1)][_0x2550f9(0x1f3)]({'name':_0x3d7d7a[_0x2550f9(0x224)][_0x2550f9(0x1c6)],'action':_0x2550f9(0x220),'id':_0x265499['id']}),_0x365dd7['counts'][_0x2550f9(0x1b1)][_0x2550f9(0x220)]++;}else{const _0x3c27b6=await this['client'][_0x2550f9(0x26e)](_0x295f0d);_0x365dd7[_0x2550f9(0x1b1)][_0x2550f9(0x1f3)]({'name':_0x3d7d7a[_0x2550f9(0x224)]['name'],'action':_0x2550f9(0x1dc),'id':_0x3c27b6['id']}),_0x365dd7[_0x2550f9(0x298)]['chatInterfaces'][_0x2550f9(0x1dc)]++;}}catch(_0x12de37){_0x365dd7['chatInterfaces'][_0x2550f9(0x1f3)]({'name':_0x3d7d7a[_0x2550f9(0x224)][_0x2550f9(0x1c6)],'action':'error','error':_0x12de37[_0x2550f9(0x1b7)]}),_0x365dd7[_0x2550f9(0x298)][_0x2550f9(0x1b1)][_0x2550f9(0x294)]++;}}return _0x365dd7;}async[a133_0x4dcb58(0x23c)](_0x2ee515,_0x55e9e6,_0x3c6ad7,_0x25d355){const _0x37a792=a133_0x4dcb58,{projectId:_0x33997e,project:_0x491840}=await this[_0x37a792(0x1a6)](_0x2ee515),_0x10be9d=_0x491840['attributes'][_0x37a792(0x1c6)],_0x42b741=await this['client']['listAgentsFull'](_0x33997e),_0x1882ee=_0x42b741[_0x37a792(0x1db)](_0x4a9ca4=>_0x4a9ca4[_0x37a792(0x1a9)][_0x37a792(0x1c6)]===_0x55e9e6);if(!_0x1882ee)throw new SDKError(ErrorCode[_0x37a792(0x1d8)],_0x37a792(0x1ea)+_0x55e9e6,undefined,{'helpText':'Available\x20agents:\x20'+_0x42b741[_0x37a792(0x22c)](_0x54ea47=>_0x54ea47[_0x37a792(0x1a9)][_0x37a792(0x1c6)])[_0x37a792(0x22b)](',\x20')});let _0x809cef;if(_0x3c6ad7)_0x809cef=_0x3c6ad7;else{const _0x7a82c7=a133_0x371f12['join'](process[_0x37a792(0x204)](),'agents'),_0x505de7=getSanitizedPathWithMigration(_0x7a82c7,_0x10be9d);_0x505de7['renamed']&&this[_0x37a792(0x251)]['info'](_0x37a792(0x1e7)+a133_0x371f12[_0x37a792(0x238)](_0x505de7[_0x37a792(0x1d3)])+_0x37a792(0x268)+a133_0x371f12[_0x37a792(0x238)](_0x505de7['path'])),_0x809cef=_0x505de7['path'];}const _0x3cff32=getSanitizedPathWithMigration(_0x809cef,_0x55e9e6);_0x3cff32[_0x37a792(0x191)]&&this[_0x37a792(0x251)][_0x37a792(0x27e)](_0x37a792(0x250)+a133_0x371f12[_0x37a792(0x238)](_0x3cff32[_0x37a792(0x1d3)])+_0x37a792(0x268)+a133_0x371f12[_0x37a792(0x238)](_0x3cff32[_0x37a792(0x275)]));const _0x365fb5=_0x3cff32[_0x37a792(0x275)],_0x483181=new Map(),_0x47657c=new Map(),_0x3c142b=await this[_0x37a792(0x1f1)]['listKnowledgeBases'](_0x33997e),_0x1565b0=await this[_0x37a792(0x1f1)][_0x37a792(0x2a0)](_0x33997e),_0x504d25=await safeListOrEmpty(()=>this[_0x37a792(0x1f1)][_0x37a792(0x1f5)](_0x33997e)),_0xb34c9=new Map(),_0x33c922=new Map();for(const _0xc2c3d8 of _0x3c142b){_0x483181[_0x37a792(0x1c0)](_0xc2c3d8['id'],_0xc2c3d8['attributes'][_0x37a792(0x1c6)]);}for(const _0x49a010 of _0x1565b0){_0xb34c9['set'](_0x49a010['id'],_0x49a010['attributes'][_0x37a792(0x1c6)]);}for(const _0x166e08 of _0x504d25){_0x33c922['set'](_0x166e08['id'],_0x166e08[_0x37a792(0x1a9)]['name']);}for(const _0x3886b4 of _0x42b741){_0x47657c[_0x37a792(0x1c0)](_0x3886b4['id'],_0x3886b4[_0x37a792(0x1a9)]['name']);}const _0x56b9d8={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x483181,'TextKnowledgeBase':_0xb34c9,'Agent':_0x47657c,'ExperimentalKnowledgeBase':_0x33c922}),'resolvePromptName':async()=>undefined,'onWarning':_0x20ff45=>this['logger'][_0x37a792(0x252)](_0x20ff45)},_0x5c9f49=a133_0x371f12[_0x37a792(0x22b)](_0x365fb5,_0x37a792(0x1a4)),_0x4a6b8a=a133_0x371f12[_0x37a792(0x22b)](_0x365fb5,_0x37a792(0x1d7)),_0x469452=a133_0x371f12['join'](_0x365fb5,_0x37a792(0x1f4)),_0x11cd9e=!a133_0x39b0da[_0x37a792(0x247)](_0x4a6b8a);if(_0x25d355?.['dryRun'])return{'agentName':_0x55e9e6,'outputPath':_0x365fb5,'isNew':_0x11cd9e,'hasChanges':!![]};a133_0x39b0da[_0x37a792(0x262)](_0x809cef,{'recursive':!![]}),a133_0x39b0da[_0x37a792(0x262)](_0x365fb5,{'recursive':!![]});const _0x1b7f23=a133_0x371f12[_0x37a792(0x22b)](_0x809cef,_0x37a792(0x28d));!a133_0x39b0da['existsSync'](_0x1b7f23)&&a133_0x39b0da[_0x37a792(0x29a)](_0x1b7f23,createAgentConfigContent(_0x2ee515));const {yaml:_0x3f758e,systemPrompt:_0x4edef9,starterMessage:_0x4b795f}=await agentResponseToDef(_0x1882ee,_0x56b9d8);let _0x1e27e2=_0x11cd9e;if(!_0x11cd9e){const _0x5a160d=a133_0x39b0da[_0x37a792(0x247)](_0x5c9f49)?a133_0x39b0da['readFileSync'](_0x5c9f49,_0x37a792(0x1a1)):'',_0x5f0a05=a133_0x39b0da[_0x37a792(0x1d6)](_0x4a6b8a,_0x37a792(0x1a1));_0x1e27e2=_0x5a160d!==_0x4edef9||_0x5f0a05!==toAgentYamlString(_0x3f758e);}a133_0x39b0da[_0x37a792(0x29a)](_0x5c9f49,_0x4edef9),a133_0x39b0da[_0x37a792(0x29a)](_0x4a6b8a,toAgentYamlString(_0x3f758e));if(_0x4b795f&&_0x4b795f['includes']('\x0a'))a133_0x39b0da[_0x37a792(0x29a)](_0x469452,_0x4b795f);else a133_0x39b0da[_0x37a792(0x247)](_0x469452)&&a133_0x39b0da[_0x37a792(0x229)](_0x469452);return{'agentName':_0x55e9e6,'outputPath':_0x365fb5,'isNew':_0x11cd9e,'hasChanges':_0x1e27e2};}async[a133_0x4dcb58(0x2a3)](_0x3a79e1,_0xd59457){const _0x4f219a=a133_0x4dcb58;let _0x37086d;isAgentYamlPath(_0x3a79e1)?_0x37086d=getAgentDirFromYamlPath(_0x3a79e1):_0x37086d=_0x3a79e1;const {config:_0x48b837}=findAgentConfig(_0x37086d),_0x6d6ef1=await this[_0x4f219a(0x219)](_0x48b837[_0x4f219a(0x274)]),_0x34917f=a133_0x371f12[_0x4f219a(0x22b)](_0x37086d,_0x4f219a(0x1d7)),_0x329031=a133_0x371f12[_0x4f219a(0x22b)](_0x37086d,'prompt.md'),_0x2ca877=a133_0x371f12['join'](_0x37086d,_0x4f219a(0x1f4));if(!a133_0x39b0da[_0x4f219a(0x247)](_0x34917f))throw new SDKError(ErrorCode[_0x4f219a(0x24c)],_0x4f219a(0x221)+_0x37086d,undefined,{'helpText':_0x4f219a(0x24e)});const _0x4de961=parseAgentYaml(a133_0x39b0da[_0x4f219a(0x1d6)](_0x34917f,'utf-8'),_0x34917f),_0x8a0ea0=a133_0x39b0da[_0x4f219a(0x247)](_0x329031)?a133_0x39b0da[_0x4f219a(0x1d6)](_0x329031,_0x4f219a(0x1a1)):'',_0x380f60=a133_0x39b0da[_0x4f219a(0x247)](_0x2ca877)?a133_0x39b0da[_0x4f219a(0x1d6)](_0x2ca877,_0x4f219a(0x1a1)):_0x4de961[_0x4f219a(0x24a)];if(_0xd59457?.[_0x4f219a(0x245)])return{'agentName':_0x4de961['name'],'action':_0x4f219a(0x1dc),'projectId':_0x6d6ef1};const _0x125631=await this[_0x4f219a(0x1f1)][_0x4f219a(0x211)](_0x6d6ef1),_0x4d8fe2=await fetchAllToolTargetMaps((_0x288079,_0x52b28f)=>this[_0x4f219a(0x1f1)][_0x4f219a(0x26b)](_0x288079,_0x52b28f),_0x6d6ef1),_0x5c8b07=new Map();for(const _0x3da647 of _0x125631){_0x5c8b07[_0x4f219a(0x1c0)](_0x3da647['attributes'][_0x4f219a(0x1c6)],_0x3da647['id']);}const _0x31999a=[],_0x1b95b4={'projectId':_0x6d6ef1,'resolveToolTargetId':buildIdResolver({..._0x4d8fe2[_0x4f219a(0x26c)],'Agent':_0x5c8b07}),'resolvePromptId':async()=>undefined,'onWarning':_0x101d53=>{const _0x567b1c=_0x4f219a;this[_0x567b1c(0x251)]['warn'](_0x101d53),_0x31999a[_0x567b1c(0x1f3)](_0x101d53);}};try{const _0x42a7be=_0x125631['find'](_0xb5e57d=>_0xb5e57d['attributes'][_0x4f219a(0x1c6)]===_0x4de961[_0x4f219a(0x1c6)]),_0x1e2795=await agentDefToRequest(_0x4de961,_0x8a0ea0,_0x380f60,_0x1b95b4);if(_0x42a7be)return await this[_0x4f219a(0x1f1)][_0x4f219a(0x1bd)](_0x42a7be['id'],_0x1e2795),{'agentName':_0x4de961['name'],'action':'updated','projectId':_0x6d6ef1,'agentId':_0x42a7be['id'],'warnings':_0x31999a['length']>0x0?_0x31999a:undefined};else{const _0x2c9370=await this[_0x4f219a(0x1f1)][_0x4f219a(0x188)](_0x1e2795);return{'agentName':_0x4de961[_0x4f219a(0x1c6)],'action':_0x4f219a(0x1dc),'projectId':_0x6d6ef1,'agentId':_0x2c9370['id'],'warnings':_0x31999a[_0x4f219a(0x1a7)]>0x0?_0x31999a:undefined};}}catch(_0x2096c8){return{'agentName':_0x4de961['name'],'action':_0x4f219a(0x210),'projectId':_0x6d6ef1,'error':_0x2096c8[_0x4f219a(0x1b7)],'warnings':_0x31999a[_0x4f219a(0x1a7)]>0x0?_0x31999a:undefined};}}async[a133_0x4dcb58(0x231)](_0x331257,_0x57eeb0,_0x2601cd){const _0x535675=a133_0x4dcb58,_0x3a0078=a133_0x39b0da[_0x535675(0x247)](_0x331257)&&a133_0x39b0da[_0x535675(0x247)](a133_0x371f12['join'](_0x331257,_0x535675(0x28d)));let _0x3d989b;const _0x41be27=[],_0x35fdce=[],_0x131dd5=[],_0x33ed17=[],_0x242b1d=[],_0x491436=[],_0x55d995=[],_0x3fe88c=[],_0x1d55d5=[];if(_0x3a0078){const _0x430111=loadAgentConfig(a133_0x371f12[_0x535675(0x22b)](_0x331257,_0x535675(0x28d)));_0x3d989b=_0x430111['llm_project'];const _0x4de642=a133_0x39b0da[_0x535675(0x23e)](_0x331257,{'withFileTypes':!![]});for(const _0x22f8d4 of _0x4de642){if(!_0x22f8d4[_0x535675(0x197)]())continue;if([_0x535675(0x25d),'experimental_knowledge_bases',_0x535675(0x1cf),_0x535675(0x1ce),_0x535675(0x196),_0x535675(0x284),_0x535675(0x1fc)]['includes'](_0x22f8d4[_0x535675(0x1c6)]))continue;const _0x259c7c=a133_0x371f12[_0x535675(0x22b)](_0x331257,_0x22f8d4['name']);if(isAgentDir(_0x259c7c)){const _0x5c4c95=a133_0x371f12[_0x535675(0x22b)](_0x259c7c,'agent.yml'),_0x1cee7c=a133_0x371f12[_0x535675(0x22b)](_0x259c7c,_0x535675(0x1a4)),_0xb649d2=a133_0x371f12[_0x535675(0x22b)](_0x259c7c,_0x535675(0x1f4)),_0x482fa0=parseAgentYaml(a133_0x39b0da[_0x535675(0x1d6)](_0x5c4c95,_0x535675(0x1a1)),_0x5c4c95),_0x2e6add=a133_0x39b0da['existsSync'](_0x1cee7c)?a133_0x39b0da[_0x535675(0x1d6)](_0x1cee7c,'utf-8'):'',_0x18a93b=a133_0x39b0da['existsSync'](_0xb649d2)?a133_0x39b0da[_0x535675(0x1d6)](_0xb649d2,_0x535675(0x1a1)):_0x482fa0[_0x535675(0x24a)];_0x41be27['push']({'name':_0x482fa0['name'],'dir':_0x259c7c,'yaml':_0x482fa0,'systemPrompt':_0x2e6add,'starterMessage':_0x18a93b});}}const _0x281167=getKnowledgeBasesDir(_0x331257);if(a133_0x39b0da['existsSync'](_0x281167)){const _0x4704ae=a133_0x39b0da[_0x535675(0x23e)](_0x281167);for(const _0x3b1d83 of _0x4704ae){const _0x5d2718=a133_0x371f12[_0x535675(0x22b)](_0x281167,_0x3b1d83);if(_0x3b1d83['endsWith']('.yml')){const _0x48abb2=parseKnowledgeBaseYaml(a133_0x39b0da['readFileSync'](_0x5d2718,_0x535675(0x1a1)),_0x5d2718);_0x35fdce[_0x535675(0x1f3)]({'name':_0x48abb2[_0x535675(0x1c6)],'path':_0x5d2718,'yaml':_0x48abb2});}else{if(_0x3b1d83[_0x535675(0x198)](_0x535675(0x1e2))){const _0x1d724b=a133_0x39b0da[_0x535675(0x1d6)](_0x5d2718,_0x535675(0x1a1)),{name:_0x9be487,text:_0x798f91}=parseTextKnowledgeBaseMd(_0x1d724b,_0x3b1d83);_0x131dd5[_0x535675(0x1f3)]({'name':_0x9be487,'path':_0x5d2718,'text':_0x798f91});}}}}const _0x12fbd2=getPromptsDir(_0x331257);if(a133_0x39b0da['existsSync'](_0x12fbd2)){const _0x53f23b=a133_0x39b0da[_0x535675(0x23e)](_0x12fbd2)['filter'](_0xbd48a1=>_0xbd48a1['endsWith'](_0x535675(0x1e0)));for(const _0x7ac41 of _0x53f23b){const _0x2b6f49=a133_0x371f12[_0x535675(0x22b)](_0x12fbd2,_0x7ac41),_0x1cf4cc=parsePromptYaml(a133_0x39b0da[_0x535675(0x1d6)](_0x2b6f49,_0x535675(0x1a1)),_0x2b6f49);_0x33ed17[_0x535675(0x1f3)]({'name':_0x1cf4cc['name'],'path':_0x2b6f49,'yaml':_0x1cf4cc});}}const _0x42b3d1=getIntegrationsDir(_0x331257);if(a133_0x39b0da['existsSync'](_0x42b3d1)){const _0x5cb389=a133_0x39b0da[_0x535675(0x23e)](_0x42b3d1)[_0x535675(0x1d2)](_0x40424=>_0x40424['endsWith'](_0x535675(0x1e0)));for(const _0x541087 of _0x5cb389){const _0xa4bbaf=a133_0x371f12['join'](_0x42b3d1,_0x541087),_0xa2f2e5=parseIntegrationYaml(a133_0x39b0da['readFileSync'](_0xa4bbaf,_0x535675(0x1a1)),_0xa4bbaf);SAFE_INTEGRATION_TYPES[_0x535675(0x28a)](_0xa2f2e5[_0x535675(0x24d)][_0x535675(0x233)]())?_0x242b1d[_0x535675(0x1f3)]({'name':_0xa2f2e5[_0x535675(0x1c6)],'path':_0xa4bbaf,'yaml':_0xa2f2e5}):this[_0x535675(0x251)][_0x535675(0x252)](_0x535675(0x1ad)+_0xa2f2e5[_0x535675(0x1c6)]+_0x535675(0x256)+_0xa2f2e5[_0x535675(0x24d)]+_0x535675(0x1c2)+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES[_0x535675(0x22b)](',\x20')+_0x535675(0x29f)));}}const _0x392416=getExperimentalKnowledgeBasesDir(_0x331257);if(a133_0x39b0da[_0x535675(0x247)](_0x392416)){const _0x5a6246=a133_0x39b0da[_0x535675(0x23e)](_0x392416,{'withFileTypes':!![]});for(const _0x580988 of _0x5a6246){if(!_0x580988['isDirectory']())continue;const _0x3b4dc3=a133_0x371f12[_0x535675(0x22b)](_0x392416,_0x580988[_0x535675(0x1c6)]),_0x513e1c=a133_0x371f12[_0x535675(0x22b)](_0x3b4dc3,_0x580988[_0x535675(0x1c6)]+_0x535675(0x1e0));if(a133_0x39b0da['existsSync'](_0x513e1c)){const _0x2ebf74=parseExperimentalKnowledgeBaseYaml(a133_0x39b0da[_0x535675(0x1d6)](_0x513e1c,'utf-8'),_0x513e1c),_0x174cdb=a133_0x371f12['join'](_0x3b4dc3,_0x535675(0x254)),_0x799d1d=[];if(a133_0x39b0da[_0x535675(0x247)](_0x174cdb)){const _0x4c40e4=a133_0x39b0da[_0x535675(0x23e)](_0x174cdb,{'withFileTypes':!![]});for(const _0x809d75 of _0x4c40e4){if(!_0x809d75['isDirectory']())continue;const _0x24b8c8=a133_0x371f12[_0x535675(0x22b)](_0x174cdb,_0x809d75[_0x535675(0x1c6)]),_0xcd358d=a133_0x371f12['join'](_0x24b8c8,_0x535675(0x255)),_0x54c955=a133_0x371f12[_0x535675(0x22b)](_0x24b8c8,_0x535675(0x239));if(a133_0x39b0da['existsSync'](_0xcd358d)&&a133_0x39b0da[_0x535675(0x247)](_0x54c955)){const _0x1d9348=a133_0x39b0da[_0x535675(0x1d6)](_0xcd358d,_0x535675(0x1a1)),_0x472200=a133_0x39b0da[_0x535675(0x1d6)](_0x54c955,'utf-8');_0x799d1d[_0x535675(0x1f3)]({'name':_0x809d75[_0x535675(0x1c6)],'code':_0x1d9348,'json_schema':_0x472200});}}}const _0x167c3e={..._0x2ebf74,'functions':_0x799d1d};_0x491436[_0x535675(0x1f3)]({'name':_0x2ebf74[_0x535675(0x1c6)],'path':_0x3b4dc3,'def':_0x167c3e});}}}const _0x5b9b1d=getExperimentalArtifactsDir(_0x331257);if(a133_0x39b0da['existsSync'](_0x5b9b1d)){const _0x21c333=a133_0x39b0da[_0x535675(0x23e)](_0x5b9b1d,{'withFileTypes':!![]});for(const _0x101a49 of _0x21c333){if(!_0x101a49[_0x535675(0x197)]())continue;const _0x2e2f8d=a133_0x371f12['join'](_0x5b9b1d,_0x101a49['name']),_0x3092a4=a133_0x371f12[_0x535675(0x22b)](_0x2e2f8d,_0x101a49[_0x535675(0x1c6)]+'.yml');if(a133_0x39b0da['existsSync'](_0x3092a4)){const _0xfc2b07=parseExperimentalArtifactYaml(a133_0x39b0da['readFileSync'](_0x3092a4,_0x535675(0x1a1)),_0x3092a4),_0x36bdac=a133_0x371f12[_0x535675(0x22b)](_0x2e2f8d,_0x535675(0x255)),_0x53d87c=a133_0x39b0da['existsSync'](_0x36bdac)?a133_0x39b0da[_0x535675(0x1d6)](_0x36bdac,_0x535675(0x1a1)):'',_0x584d9d=a133_0x371f12[_0x535675(0x22b)](_0x2e2f8d,_0x535675(0x246)),_0x1f0594=[];if(a133_0x39b0da[_0x535675(0x247)](_0x584d9d)){const _0x2a3ff0=a133_0x39b0da[_0x535675(0x23e)](_0x584d9d);for(const _0x1225ae of _0x2a3ff0){const _0x413938=a133_0x371f12[_0x535675(0x22b)](_0x584d9d,_0x1225ae);if(a133_0x39b0da[_0x535675(0x244)](_0x413938)[_0x535675(0x225)]()){const _0x387317=a133_0x39b0da[_0x535675(0x1d6)](_0x413938,'utf-8');_0x1f0594['push']({'file_name':_0x1225ae,'text_content':_0x387317});}}}const _0x3469a0={..._0xfc2b07,'code':_0x53d87c,'files':_0x1f0594};_0x55d995[_0x535675(0x1f3)]({'name':_0xfc2b07[_0x535675(0x1c6)],'path':_0x2e2f8d,'def':_0x3469a0});}}}const _0x552688=getFormInterfacesDir(_0x331257);if(a133_0x39b0da[_0x535675(0x247)](_0x552688)){const _0x439669=a133_0x39b0da[_0x535675(0x23e)](_0x552688)['filter'](_0x4cd3cf=>_0x4cd3cf[_0x535675(0x198)]('.yml'));for(const _0x5d8e34 of _0x439669){const _0xe82c99=a133_0x371f12['join'](_0x552688,_0x5d8e34),_0x3871c7=parseFormInterfaceYaml(a133_0x39b0da['readFileSync'](_0xe82c99,_0x535675(0x1a1)),_0xe82c99);_0x3fe88c[_0x535675(0x1f3)]({'name':_0x3871c7['name'],'path':_0xe82c99,'yaml':_0x3871c7});}}const _0x3e2687=getChatInterfacesDir(_0x331257);if(a133_0x39b0da[_0x535675(0x247)](_0x3e2687)){const _0x212201=a133_0x39b0da['readdirSync'](_0x3e2687)[_0x535675(0x1d2)](_0x5c6553=>_0x5c6553[_0x535675(0x198)](_0x535675(0x1e0)));for(const _0x307ebf of _0x212201){const _0x5c1e74=a133_0x371f12['join'](_0x3e2687,_0x307ebf),_0x4bd942=parseChatInterfaceYaml(a133_0x39b0da[_0x535675(0x1d6)](_0x5c1e74,'utf-8'),_0x5c1e74);_0x1d55d5[_0x535675(0x1f3)]({'name':_0x4bd942['name'],'path':_0x5c1e74,'yaml':_0x4bd942});}}}else{const _0x3e76c0=await this[_0x535675(0x219)](_0x331257),_0x3c179c=await this['client']['getProject'](_0x3e76c0);_0x3d989b=_0x3c179c[_0x535675(0x1a9)]['name'];const _0x4f49f6=await this[_0x535675(0x1f1)]['listAgentsFull'](_0x3e76c0),_0x3e86e9=await this[_0x535675(0x1f1)][_0x535675(0x20c)](_0x3e76c0),_0x54cca2=await this[_0x535675(0x1f1)]['listTextKnowledgeBases'](_0x3e76c0),_0x302e2c=await this[_0x535675(0x1f1)][_0x535675(0x288)](_0x3e76c0),_0x261767=await this[_0x535675(0x1f1)]['listIntegrations'](_0x3e76c0),_0x384fb4=await safeListOrEmpty(()=>this[_0x535675(0x1f1)]['listExperimentalKnowledgeBases'](_0x3e76c0)),_0x1a01d6=await safeListOrEmpty(()=>this['client']['listExperimentalArtifacts'](_0x3e76c0)),_0x12ed92=new Map(),_0x2917bb=new Map(),_0x5602ff=new Map(),_0x2971de=new Map(),_0xaa8ede=new Map(),_0x1f5f9e=new Map();for(const _0x102d25 of _0x3e86e9){_0x12ed92[_0x535675(0x1c0)](_0x102d25['id'],_0x102d25['attributes'][_0x535675(0x1c6)]);}for(const _0x1dc935 of _0x54cca2){_0x2917bb[_0x535675(0x1c0)](_0x1dc935['id'],_0x1dc935[_0x535675(0x1a9)][_0x535675(0x1c6)]);}for(const _0x36230e of _0x4f49f6){_0x5602ff[_0x535675(0x1c0)](_0x36230e['id'],_0x36230e['attributes']['name']);}for(const _0x39dbd2 of _0x302e2c){_0x2971de[_0x535675(0x1c0)](_0x39dbd2['id'],_0x39dbd2[_0x535675(0x1a9)]['name']);}for(const _0x4d32e5 of _0x384fb4){_0xaa8ede[_0x535675(0x1c0)](_0x4d32e5['id'],_0x4d32e5[_0x535675(0x1a9)][_0x535675(0x1c6)]);}for(const _0x35f7f2 of _0x1a01d6){_0x1f5f9e['set'](_0x35f7f2['id'],_0x35f7f2[_0x535675(0x1a9)][_0x535675(0x1c6)]);}const _0xf5c763={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x12ed92,'TextKnowledgeBase':_0x2917bb,'Agent':_0x5602ff,'ExperimentalKnowledgeBase':_0xaa8ede}),'resolvePromptName':async _0x2ddbb2=>_0x2971de['get'](_0x2ddbb2),'onWarning':_0x573769=>this[_0x535675(0x251)]['warn'](_0x573769)};for(const _0x2ec3ed of _0x4f49f6){const _0x50bbc1=await agentResponseToDef(_0x2ec3ed,_0xf5c763),{yaml:_0x1f5e22,systemPrompt:_0xbedcea,starterMessage:_0x78968}=_0x50bbc1;_0x41be27[_0x535675(0x1f3)]({'name':_0x1f5e22[_0x535675(0x1c6)],'dir':'','yaml':_0x1f5e22,'systemPrompt':_0xbedcea,'starterMessage':_0x78968});}for(const _0x462ced of _0x3e86e9){const _0x3b4348=apiKnowledgeBaseToYaml(_0x462ced);_0x35fdce[_0x535675(0x1f3)]({'name':_0x3b4348[_0x535675(0x1c6)],'path':'','yaml':_0x3b4348});}for(const _0x26f072 of _0x54cca2){_0x131dd5['push']({'name':_0x26f072[_0x535675(0x1a9)][_0x535675(0x1c6)],'path':'','text':_0x26f072[_0x535675(0x1a9)][_0x535675(0x1e9)]});}for(const _0x3d4549 of _0x302e2c){const _0x3f93f6=await apiPromptToYaml(_0x3d4549,_0xf5c763);_0x3f93f6&&_0x33ed17[_0x535675(0x1f3)]({'name':_0x3f93f6[_0x535675(0x1c6)],'path':'','yaml':_0x3f93f6});}for(const _0xc08f95 of _0x261767){if(!_0xc08f95[_0x535675(0x1a9)][_0x535675(0x290)]&&SAFE_INTEGRATION_TYPES[_0x535675(0x28a)](_0xc08f95[_0x535675(0x1a9)][_0x535675(0x20d)]['toLowerCase']())){const _0x3f7e61=await apiIntegrationToYaml(_0xc08f95,_0xf5c763);_0x242b1d[_0x535675(0x1f3)]({'name':_0xc08f95[_0x535675(0x1a9)]['serviceType'][_0x535675(0x233)](),'path':'','yaml':_0x3f7e61});}}for(const _0x2f80fa of _0x384fb4){const _0x56ba00=apiExperimentalKnowledgeBaseToYaml(_0x2f80fa);_0x491436[_0x535675(0x1f3)]({'name':_0x56ba00[_0x535675(0x1c6)],'path':'','def':_0x56ba00});}for(const _0x2781c8 of _0x1a01d6){const _0x5dac80=apiExperimentalArtifactToYaml(_0x2781c8);_0x55d995[_0x535675(0x1f3)]({'name':_0x5dac80[_0x535675(0x1c6)],'path':'','def':_0x5dac80});}const _0x2c5d75=await safeListOrEmpty(()=>this['client'][_0x535675(0x216)](_0x3e76c0));for(const _0x51c2ea of _0x2c5d75){const _0x273571=await apiFormInterfaceToYaml(_0x51c2ea,_0xf5c763);_0x3fe88c[_0x535675(0x1f3)]({'name':_0x273571[_0x535675(0x1c6)],'path':'','yaml':_0x273571});}const _0x19731e=await safeListOrEmpty(()=>this[_0x535675(0x1f1)][_0x535675(0x212)](_0x3e76c0));for(const _0x38ce97 of _0x19731e){if(_0x38ce97[_0x535675(0x1a9)][_0x535675(0x290)])continue;const _0x262f41=await apiChatInterfaceToYaml(_0x38ce97,_0xf5c763);_0x1d55d5[_0x535675(0x1f3)]({'name':_0x262f41[_0x535675(0x1c6)],'path':'','yaml':_0x262f41});}}const _0x4795d0={'sourceProjectName':_0x3d989b,'newProjectName':_0x57eeb0,'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}}},_0x53dcff=await this[_0x535675(0x1f1)]['listProjects'](),_0x2a2cd5=_0x53dcff[_0x535675(0x1db)](_0x48e79d=>_0x48e79d[_0x535675(0x1a9)][_0x535675(0x1c6)]===_0x57eeb0);if(_0x2a2cd5)throw new SDKError(ErrorCode[_0x535675(0x213)],_0x535675(0x1f6)+_0x57eeb0+_0x535675(0x261),undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x2601cd?.[_0x535675(0x245)])return _0x4795d0[_0x535675(0x298)][_0x535675(0x1d4)]['created']=_0x41be27[_0x535675(0x1a7)],_0x4795d0[_0x535675(0x298)][_0x535675(0x272)]['created']=_0x35fdce[_0x535675(0x1a7)],_0x4795d0[_0x535675(0x298)][_0x535675(0x21b)][_0x535675(0x1dc)]=_0x131dd5[_0x535675(0x1a7)],_0x4795d0[_0x535675(0x298)][_0x535675(0x1bc)][_0x535675(0x1dc)]=_0x491436[_0x535675(0x1a7)],_0x4795d0[_0x535675(0x298)][_0x535675(0x1cb)]['created']=_0x55d995[_0x535675(0x1a7)],_0x4795d0[_0x535675(0x298)][_0x535675(0x1ce)][_0x535675(0x1dc)]=_0x33ed17['length'],_0x4795d0['counts'][_0x535675(0x196)]['created']=_0x242b1d['length'],_0x4795d0;const _0x215d3a=await this['client']['createProject']({'name':_0x57eeb0}),_0x3260b2=_0x215d3a['id'];_0x4795d0['newProjectId']=_0x3260b2;const _0x51518f=new Map(),_0x107c14=new Map(),_0x52daa5=new Map(),_0x37309e=new Map(),_0x244794=new Map(),_0x420633=new Map(),_0x27404e=new Map(),_0x5b5056=new Map(),_0x3ef38e=new Set(),_0x42c389=new Set();for(const _0x57fb7a of _0x41be27){for(const _0x4c9331 of _0x57fb7a[_0x535675(0x224)][_0x535675(0x296)]||[]){if(_0x4c9331[_0x535675(0x201)]===_0x535675(0x1b2)&&_0x4c9331[_0x535675(0x1ab)]){const _0x255230=parseRef(_0x4c9331[_0x535675(0x1ab)]);if(_0x255230)_0x3ef38e[_0x535675(0x28c)](_0x255230[_0x535675(0x1c6)]);}else{if(_0x4c9331[_0x535675(0x201)]===_0x535675(0x25b)&&_0x4c9331['target']){const _0x4da206=parseRef(_0x4c9331[_0x535675(0x1ab)]);if(_0x4da206)_0x42c389['add'](_0x4da206[_0x535675(0x1c6)]);}}}}for(const _0x2480b4 of _0x3ef38e){try{const _0x6dbeb=await this[_0x535675(0x1f1)]['createImageGenerator']({'projectId':_0x3260b2,'name':_0x2480b4});_0x244794['set'](_0x2480b4,_0x6dbeb['id']),_0x4795d0[_0x535675(0x27c)][_0x535675(0x1f3)]({'name':_0x2480b4,'action':_0x535675(0x1dc),'id':_0x6dbeb['id']}),_0x4795d0[_0x535675(0x298)]['imageGenerators']['created']++;}catch(_0x501a1e){_0x4795d0[_0x535675(0x27c)][_0x535675(0x1f3)]({'name':_0x2480b4,'action':'error','error':_0x501a1e[_0x535675(0x1b7)]}),_0x4795d0[_0x535675(0x298)][_0x535675(0x27c)][_0x535675(0x294)]++;}}for(const _0x57c488 of _0x42c389){try{const _0x143940=await this[_0x535675(0x1f1)][_0x535675(0x1e4)]({'projectId':_0x3260b2,'name':_0x57c488});_0x420633[_0x535675(0x1c0)](_0x57c488,_0x143940['id']),_0x4795d0[_0x535675(0x1c1)]['push']({'name':_0x57c488,'action':_0x535675(0x1dc),'id':_0x143940['id']}),_0x4795d0[_0x535675(0x298)][_0x535675(0x1c1)][_0x535675(0x1dc)]++;}catch(_0x589c23){_0x4795d0[_0x535675(0x1c1)][_0x535675(0x1f3)]({'name':_0x57c488,'action':_0x535675(0x210),'error':_0x589c23[_0x535675(0x1b7)]}),_0x4795d0[_0x535675(0x298)][_0x535675(0x1c1)]['errors']++;}}const _0x2efa72=await fetchAllToolTargetMaps((_0x861c27,_0x5615b8)=>this['client']['listToolTargets'](_0x861c27,_0x5615b8),_0x3260b2);let _0x169eaa=[];const _0x253d60={'projectId':_0x3260b2,'resolveToolTargetId':buildIdResolver({..._0x2efa72[_0x535675(0x26c)],'KnowledgeBase':_0x51518f,'TextKnowledgeBase':_0x107c14,'ExperimentalKnowledgeBase':_0x27404e,'Agent':_0x52daa5,'WebSearchTool':_0x420633,'ImageGenerator':_0x244794}),'resolvePromptId':async _0x3d857b=>_0x37309e[_0x535675(0x291)](_0x3d857b),'onWarning':_0x3a1d35=>{const _0x4a7462=_0x535675;this[_0x4a7462(0x251)]['warn'](_0x3a1d35),_0x169eaa[_0x4a7462(0x1f3)](_0x3a1d35);}};for(const _0x1de51a of _0x35fdce){try{const _0x5a3ea8=yamlKnowledgeBaseToApi(_0x1de51a['yaml'],_0x3260b2),_0x12d198=await this[_0x535675(0x1f1)][_0x535675(0x258)](_0x5a3ea8);_0x51518f[_0x535675(0x1c0)](_0x1de51a[_0x535675(0x224)][_0x535675(0x1c6)],_0x12d198['id']),_0x4795d0[_0x535675(0x272)][_0x535675(0x1f3)]({'name':_0x1de51a[_0x535675(0x224)][_0x535675(0x1c6)],'action':_0x535675(0x1dc),'id':_0x12d198['id']}),_0x4795d0['counts'][_0x535675(0x272)]['created']++;}catch(_0x4c83b6){_0x4795d0['knowledgeBases'][_0x535675(0x1f3)]({'name':_0x1de51a[_0x535675(0x224)][_0x535675(0x1c6)],'action':_0x535675(0x210),'error':_0x4c83b6[_0x535675(0x1b7)]}),_0x4795d0[_0x535675(0x298)][_0x535675(0x272)]['errors']++;}}for(const _0x552240 of _0x131dd5){try{const _0x586e25=yamlTextKnowledgeBaseToApi({'name':_0x552240[_0x535675(0x1c6)],'text':_0x552240[_0x535675(0x1e9)]},_0x3260b2),_0x43e399=await this[_0x535675(0x1f1)][_0x535675(0x234)](_0x586e25);_0x107c14[_0x535675(0x1c0)](_0x552240[_0x535675(0x1c6)],_0x43e399['id']),_0x4795d0[_0x535675(0x21b)][_0x535675(0x1f3)]({'name':_0x552240[_0x535675(0x1c6)],'action':'created','id':_0x43e399['id']}),_0x4795d0['counts'][_0x535675(0x21b)][_0x535675(0x1dc)]++;}catch(_0x3231b8){_0x4795d0[_0x535675(0x21b)][_0x535675(0x1f3)]({'name':_0x552240[_0x535675(0x1c6)],'action':_0x535675(0x210),'error':_0x3231b8[_0x535675(0x1b7)]}),_0x4795d0[_0x535675(0x298)][_0x535675(0x21b)][_0x535675(0x294)]++;}}for(const _0x248e6a of _0x55d995){try{const _0x210304=yamlExperimentalArtifactToApi(_0x248e6a[_0x535675(0x1fd)],_0x3260b2),_0x28d15a=await this[_0x535675(0x1f1)]['createExperimentalArtifact'](_0x210304);_0x5b5056[_0x535675(0x1c0)](_0x248e6a[_0x535675(0x1fd)][_0x535675(0x1c6)],_0x28d15a['id']),_0x4795d0[_0x535675(0x1cb)]['push']({'name':_0x248e6a[_0x535675(0x1fd)][_0x535675(0x1c6)],'action':_0x535675(0x1dc),'id':_0x28d15a['id']}),_0x4795d0[_0x535675(0x298)]['experimentalArtifacts'][_0x535675(0x1dc)]++;}catch(_0x13af60){_0x4795d0[_0x535675(0x1cb)][_0x535675(0x1f3)]({'name':_0x248e6a[_0x535675(0x1fd)]['name'],'action':_0x535675(0x210),'error':_0x13af60[_0x535675(0x1b7)]}),_0x4795d0[_0x535675(0x298)][_0x535675(0x1cb)]['errors']++;}}for(const _0x406cfe of _0x491436){try{const _0x18340c=yamlExperimentalKnowledgeBaseToApi(_0x406cfe[_0x535675(0x1fd)],_0x3260b2),_0xaea731=await this[_0x535675(0x1f1)]['createExperimentalKnowledgeBase'](_0x18340c);_0x27404e[_0x535675(0x1c0)](_0x406cfe[_0x535675(0x1fd)][_0x535675(0x1c6)],_0xaea731['id']),_0x4795d0[_0x535675(0x1bc)][_0x535675(0x1f3)]({'name':_0x406cfe['def'][_0x535675(0x1c6)],'action':'created','id':_0xaea731['id']}),_0x4795d0[_0x535675(0x298)][_0x535675(0x1bc)][_0x535675(0x1dc)]++;}catch(_0x5993f7){_0x4795d0[_0x535675(0x1bc)]['push']({'name':_0x406cfe[_0x535675(0x1fd)][_0x535675(0x1c6)],'action':_0x535675(0x210),'error':_0x5993f7['message']}),_0x4795d0['counts'][_0x535675(0x1bc)][_0x535675(0x294)]++;}}const _0x29c9b5=[..._0x41be27][_0x535675(0x249)]((_0x44d82d,_0x2e866b)=>{const _0x517d13=_0x535675,_0xea9457=_0x44d82d[_0x517d13(0x224)]['tools']?.['some'](_0x1bb4b7=>_0x1bb4b7[_0x517d13(0x201)]===_0x517d13(0x18f))??![],_0x5ec134=_0x2e866b[_0x517d13(0x224)][_0x517d13(0x296)]?.[_0x517d13(0x1b6)](_0x13bc7c=>_0x13bc7c[_0x517d13(0x201)]==='agent')??![];if(_0xea9457&&!_0x5ec134)return 0x1;if(!_0xea9457&&_0x5ec134)return-0x1;return 0x0;});for(const _0x159b99 of _0x29c9b5){_0x169eaa=[];try{const _0x5e9835=_0x159b99['yaml'][_0x535675(0x296)]?.[_0x535675(0x1d2)](_0x1e4c1b=>{const _0x5f2757=_0x535675;if(_0x1e4c1b[_0x5f2757(0x201)]===_0x5f2757(0x18f)&&_0x1e4c1b['target']){const _0x3a6846=parseRef(_0x1e4c1b['target']);return _0x3a6846?.['name']===_0x159b99[_0x5f2757(0x224)][_0x5f2757(0x1c6)];}return![];})??[];if(_0x5e9835['length']>0x0){const _0x102da5=_0x535675(0x228)+_0x159b99[_0x535675(0x224)]['name']+_0x535675(0x1fa)+_0x535675(0x23b);this[_0x535675(0x251)][_0x535675(0x252)](_0x102da5),_0x169eaa[_0x535675(0x1f3)](_0x102da5);}const _0x54a0ad=await agentDefToRequest(_0x159b99[_0x535675(0x224)],_0x159b99[_0x535675(0x26f)],_0x159b99[_0x535675(0x1cc)],_0x253d60),_0x4f73ea=await this[_0x535675(0x1f1)][_0x535675(0x188)](_0x54a0ad);_0x52daa5[_0x535675(0x1c0)](_0x159b99['yaml']['name'],_0x4f73ea['id']),_0x4795d0['agents']['push']({'agentName':_0x159b99[_0x535675(0x224)][_0x535675(0x1c6)],'action':_0x535675(0x1dc),'agentId':_0x4f73ea['id'],'warnings':_0x169eaa[_0x535675(0x1a7)]>0x0?_0x169eaa:undefined}),_0x4795d0[_0x535675(0x298)]['agents'][_0x535675(0x1dc)]++;}catch(_0x5010fa){_0x4795d0[_0x535675(0x1d4)]['push']({'agentName':_0x159b99[_0x535675(0x224)]['name'],'action':'error','error':_0x5010fa['message'],'warnings':_0x169eaa[_0x535675(0x1a7)]>0x0?_0x169eaa:undefined}),_0x4795d0[_0x535675(0x298)][_0x535675(0x1d4)]['errors']++;}}for(const _0x55f2b2 of _0x33ed17){try{const _0x264976=await yamlPromptToApi(_0x55f2b2[_0x535675(0x224)],_0x3260b2,_0x253d60);if(!_0x264976){_0x4795d0[_0x535675(0x1ce)]['push']({'name':_0x55f2b2[_0x535675(0x224)]['name'],'action':_0x535675(0x210),'error':_0x535675(0x1f0)}),_0x4795d0[_0x535675(0x298)][_0x535675(0x1ce)][_0x535675(0x294)]++;continue;}const _0x13d836=await this[_0x535675(0x1f1)]['createPrompt'](_0x264976);_0x37309e['set'](_0x55f2b2['yaml'][_0x535675(0x1c6)],_0x13d836['id']),_0x4795d0['prompts'][_0x535675(0x1f3)]({'name':_0x55f2b2['yaml']['name'],'action':_0x535675(0x1dc),'id':_0x13d836['id']}),_0x4795d0['counts'][_0x535675(0x1ce)][_0x535675(0x1dc)]++;}catch(_0x3aae34){_0x4795d0['prompts'][_0x535675(0x1f3)]({'name':_0x55f2b2[_0x535675(0x224)][_0x535675(0x1c6)],'action':_0x535675(0x210),'error':_0x3aae34[_0x535675(0x1b7)]}),_0x4795d0[_0x535675(0x298)][_0x535675(0x1ce)][_0x535675(0x294)]++;}}for(const _0xf6528d of _0x242b1d){try{const _0x418896=await yamlIntegrationToApi(_0xf6528d['yaml'],_0x3260b2,_0x253d60),_0x9723eb=await this[_0x535675(0x1f1)]['createIntegration'](_0x418896);_0x4795d0[_0x535675(0x196)][_0x535675(0x1f3)]({'name':_0xf6528d[_0x535675(0x224)][_0x535675(0x24d)],'action':_0x535675(0x1dc),'id':_0x9723eb['id']}),_0x4795d0[_0x535675(0x298)][_0x535675(0x196)][_0x535675(0x1dc)]++;}catch(_0x32d357){_0x4795d0['integrations'][_0x535675(0x1f3)]({'name':_0xf6528d[_0x535675(0x224)][_0x535675(0x24d)],'action':_0x535675(0x210),'error':_0x32d357[_0x535675(0x1b7)]}),_0x4795d0[_0x535675(0x298)][_0x535675(0x196)]['errors']++;}}for(const _0x264bd5 of _0x3fe88c){try{const _0x512ad0=await yamlFormInterfaceToApi(_0x264bd5[_0x535675(0x224)],_0x3260b2,_0x253d60);if(!_0x512ad0){_0x4795d0[_0x535675(0x1e8)][_0x535675(0x1f3)]({'name':_0x264bd5[_0x535675(0x224)][_0x535675(0x1c6)],'action':_0x535675(0x210),'error':_0x535675(0x1c7)}),_0x4795d0[_0x535675(0x298)][_0x535675(0x1e8)][_0x535675(0x294)]++;continue;}const _0x3f5028=await this[_0x535675(0x1f1)]['createFormInterface'](_0x512ad0);_0x4795d0['formInterfaces'][_0x535675(0x1f3)]({'name':_0x264bd5['yaml']['name'],'action':_0x535675(0x1dc),'id':_0x3f5028['id']}),_0x4795d0['counts'][_0x535675(0x1e8)][_0x535675(0x1dc)]++;}catch(_0x5d16da){_0x4795d0[_0x535675(0x1e8)][_0x535675(0x1f3)]({'name':_0x264bd5[_0x535675(0x224)][_0x535675(0x1c6)],'action':_0x535675(0x210),'error':_0x5d16da[_0x535675(0x1b7)]}),_0x4795d0['counts']['formInterfaces'][_0x535675(0x294)]++;}}for(const _0x31b124 of _0x1d55d5){try{const _0x153021=await yamlChatInterfaceToApi(_0x31b124[_0x535675(0x224)],_0x3260b2,_0x253d60),_0x4efcac=await this[_0x535675(0x1f1)][_0x535675(0x26e)](_0x153021);_0x4795d0['chatInterfaces'][_0x535675(0x1f3)]({'name':_0x31b124[_0x535675(0x224)][_0x535675(0x1c6)],'action':_0x535675(0x1dc),'id':_0x4efcac['id']}),_0x4795d0['counts'][_0x535675(0x1b1)][_0x535675(0x1dc)]++;}catch(_0xe69e05){_0x4795d0[_0x535675(0x1b1)]['push']({'name':_0x31b124[_0x535675(0x224)][_0x535675(0x1c6)],'action':'error','error':_0xe69e05[_0x535675(0x1b7)]}),_0x4795d0[_0x535675(0x298)][_0x535675(0x1b1)][_0x535675(0x294)]++;}}return _0x4795d0;}}function a133_0x4d44(){const _0x52f4a1=['listWebSearchTools','join','map','variables','startChat','updateChatInterface','continueChat','cloneProject','agentsFull','toLowerCase','createTextKnowledgeBase','\x0a---\x20schema:\x20','createFormInterface','5007234LolEuj','basename','json_schema.json','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','pullAgent','profile','readdirSync','tdx_','action','Renamed\x20text\x20KB\x20file:\x20','updateFormInterface','slackMessageMode','statSync','dryRun','files','existsSync','createProject','sort','starter_message','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','NOT_FOUND','service_type','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','Multiple\x20agents\x20found\x20with\x20name\x20\x27','Renamed\x20agent\x20folder:\x20','logger','warn','Invalid\x20agent\x20reference\x20format:\x20','functions','code.js','\x27\x20(','listProjects','createKnowledgeBase','chatInfo','file_name','web_search','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','knowledge_bases','updateAgent','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.','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','\x22\x20already\x20exists','mkdirSync','_reasoning_','chat_generic','toISOString','311312kQpUHM','sdk.llm','\x20→\x20','createExperimentalArtifact','knowledgebases.json','listToolTargets','nameToId','createAgent','createChatInterface','systemPrompt','chatIgnoreManagedActions','(dry-run)','knowledgeBases','isDir','llm_project','path','temperature','Only\x20safe\x20types\x20(','KnowledgeBase','status','deleteAgent','getOrCreateDefaultProject','imageGenerators','---\x20schema:\x20','info','getBackupMetadata','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','stringify','getOrCreateDefaultAgent','agentId','form_interfaces','deleteProject','createIntegration','tdDatabaseName','listPrompts','event','includes','getChatLog','add','tdx.json','Renamed\x20prompt\x20file:\x20','Project\x20not\x20found:\x20','isManaged','get','exportedFrom','\x0a\x0a#\x20agent.yml\x0a','errors','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','tools','code','counts','Removed\x20deleted\x20file:\x20','writeFileSync','LLM_PROJECT_NOT_FOUND','\x0a---\x20function:\x20','prompts.json','Renamed\x20experimental\x20artifact\x20directory:\x20',')\x20can\x20be\x20cloned.','listTextKnowledgeBases','1519840SBoWHQ','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','pushAgent','createAgentResponse','already\x20exists',')\x20can\x20be\x20pushed.\x20','chatId','Unresolved\x20dependencies:\x20','TextKnowledgeBase','getUserSettings','agent','listIntegrations','renamed','listChats','total','No\x20tdx.json\x20found\x20in\x20','actions','integrations','isDirectory','endsWith','updatePrompt','dirname','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','setCurrentProject','31676xtiaEX','12786YOfdPP','createExperimentalKnowledgeBase','duplicate','utf-8','project.json','backupProject','prompt.md','getDefaultProjectName','resolveProjectName','length','rmSync','attributes','currentProjectId','target','size','Skipping\x20integration\x20\x27','dry-run-','updateKnowledgeBase','chats','chatInterfaces','image_gen','reasoningEffort','\x20in\x20project\x20','webhookCorsOrigins','some','message','tdx_default_','resolveAgentId','Backup\x20folder\x20not\x20found:\x20','availableModels','experimentalKnowledgeBases','updateAgentResponse','UNAUTHENTICATED','getProject','set','webSearchTools','):\x20','11865708RXOAal','\x0a---\x20code\x20---\x0a','models','name','Could\x20not\x20resolve\x20agent\x20reference','promptId','445zPfSqF','high','experimentalArtifacts','starterMessage','deleteIntegration','prompts','experimental_artifacts','agents.json','INVALID_ARGUMENT','filter','oldPath','agents','updateExperimentalKnowledgeBase','readFileSync','agent.yml','AGENT_NOT_FOUND','context','1lssPDf','find','created','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','getCurrentProject','3271480BNjKkO','.yml','json_schema','.md','loadJsonFile','createWebSearchTool','\x20---\x0a','new','Renamed\x20folder:\x20','formInterfaces','text','Agent\x20not\x20found:\x20','has','Renamed\x20form\x20interface\x20file:\x20','---\x20file:\x20','projectName','text_content','Agent\x20reference\x20not\x20found','client','pushProject','push','starter_message.md','listExperimentalKnowledgeBases','Project\x20\x22','site','1.0','none','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','Output\x20directory\x20already\x20exists:\x20','chat_interfaces','def','getDefaultAgent','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','type','listImageGenerators','metadata','cwd','#\x20prompt.md\x0a','unchanged','Multiple\x20projects\x20found\x20with\x20name\x20\x27','getChatHistory','INTERNAL','4767vbgCpe','updateExperimentalArtifact','listKnowledgeBases','serviceType','createPrompt','Renamed\x20integration\x20file:\x20','error','listAgentsFull','listChatInterfaces','ALREADY_EXISTS','integrations.json','jsonSchemaHint','listFormInterfaces','\x27.\x20This\x20should\x20not\x20happen.','Unable\x20to\x20create\x20project\x20after\x20','resolveProjectId','clearDefaultAgent','textKnowledgeBases','PERMISSION_DENIED','Renamed\x20KB\x20file:\x20','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','idToName','updated','agent.yml\x20not\x20found\x20in\x20','maxToolIterations','template','yaml','isFile','dir','localeCompare','Agent\x20\x27','unlinkSync'];a133_0x4d44=function(){return _0x52f4a1;};return a133_0x4d44();}
|