@treasuredata/tdx 2026.8.0 → 2026.8.1
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.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +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.d.ts +9 -0
- package/dist/commands/auth-command.d.ts.map +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/auth-command.js.map +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.d.ts +10 -1
- package/dist/commands/claude-command.d.ts.map +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-command.js.map +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-always-on-campaign-pull-command.js +1 -1
- package/dist/commands/engage-always-on-campaign-push-command.js +1 -1
- package/dist/commands/engage-always-on-campaign-validate-command.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-move-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/table-deleted.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/site-mismatch.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/auth-token.d.ts +23 -0
- package/dist/sdk/auth-token.d.ts.map +1 -0
- package/dist/sdk/auth-token.js +1 -0
- package/dist/sdk/auth-token.js.map +1 -0
- package/dist/sdk/cas/cas-api-client.js +1 -1
- package/dist/sdk/cas/cas-audience-schema.js +1 -1
- package/dist/sdk/cas/cas-audience-validator.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/cas/validate-files.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/always-on-campaign-pull.js +1 -1
- package/dist/sdk/engage/always-on-campaign-push.js +1 -1
- package/dist/sdk/engage/always-on-campaign-validator.js +1 -1
- package/dist/sdk/engage/always-on-campaign-yaml.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/always-on-campaign-schema.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/llm/user-settings.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/deleted-table-validation.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/util/tree-search.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/task-graph.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/sdk/workspace/access-tracker.js +1 -1
- package/dist/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/claude-code-state.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/proxy-fetch.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 a147_0xd3e41f=a147_0x57a6;function a147_0x57a6(_0x1d39de,_0x4cf721){_0x1d39de=_0x1d39de-0xdd;const _0x52dca6=a147_0x52dc();let _0x57a696=_0x52dca6[_0x1d39de];return _0x57a696;}(function(_0x3720bd,_0x9edf36){const _0x3543a6=a147_0x57a6,_0x43826d=_0x3720bd();while(!![]){try{const _0x5908be=-parseInt(_0x3543a6(0x15e))/0x1*(-parseInt(_0x3543a6(0x10e))/0x2)+-parseInt(_0x3543a6(0x17a))/0x3*(parseInt(_0x3543a6(0x158))/0x4)+-parseInt(_0x3543a6(0x1fd))/0x5+parseInt(_0x3543a6(0xe5))/0x6+-parseInt(_0x3543a6(0x1a7))/0x7+-parseInt(_0x3543a6(0x1ce))/0x8*(-parseInt(_0x3543a6(0x1d7))/0x9)+parseInt(_0x3543a6(0x141))/0xa;if(_0x5908be===_0x9edf36)break;else _0x43826d['push'](_0x43826d['shift']());}catch(_0x5d3896){_0x43826d['push'](_0x43826d['shift']());}}}(a147_0x52dc,0x8a757));import{LLMApiClient}from'../client/llm-api-client.js';import*as a147_0xb9fbad from'node:fs';import*as a147_0x5b4142 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{toModelInfos}from'./user-settings.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';function a147_0x52dc(){const _0x167b39=['yaml','loadJsonFile','Renamed\x20text\x20KB\x20file:\x20','mkdirSync','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','getProject','oldPath','updateChatInterface','dry-run-','client','2268831GhfdjR','createWebSearchTool','agentId','\x27.\x20This\x20should\x20not\x20happen.','message','Project\x20not\x20found:\x20','info','actions','experimentalKnowledgeBases','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','Renamed\x20agent\x20folder:\x20','currentProjectId','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','project.json','listAgentsFull','createFormInterface','projects','context','\x20---\x0a','integrations','Only\x20safe\x20types\x20(','split','pullAgent','\x20attempts\x20due\x20to\x20name\x20conflicts.','temperature','attributes','experimental_artifacts','---\x20file:\x20','minimal','agentsFull','get','unlinkSync','text_content','service_type','updateExperimentalKnowledgeBase','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','json_schema','toLowerCase','nameToId','tdx.json','\x0a---\x20code\x20---\x0a','profile','pullProject','setCurrentProject','code.js','6014764VSpvsc','createExperimentalKnowledgeBase','chat_agent_console','deleteAgent','functions','total','agent.yml','integrations.json','webhookCorsOrigins','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','readdirSync','updateAgent','new','starter_message.md','form_interfaces','resolveProjectId','tdx_default_','Could\x20not\x20resolve\x20agent\x20reference','listChats','\x27\x20(','getOrCreateDefaultAgent','utf-8','path','high','promptId','size','statSync','prompts.json','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','agent.yml\x20not\x20found\x20in\x20','1.0','image_gen','target','text','isManaged','files','listToolTargets','project','chat_interfaces','585512jXWFqQ','Removed\x20deleted\x20directory:\x20','parse','logger','INTERNAL','sort','Backup\x20folder\x20not\x20found:\x20','listFormInterfaces','knowledgeBases','81IPdzok','Agent\x20reference\x20not\x20found','Unresolved\x20dependencies:\x20','cwd','dirname','createKnowledgeBase','prompts','createIntegration','set','agents.json','agents','isFile','counts','listExperimentalArtifacts','createProject','Unable\x20to\x20create\x20project\x20after\x20','agent','createTextKnowledgeBase','projectId','createPrompt','getBackupMetadata','LLM_PROJECT_NOT_FOUND','join','createExperimentalArtifact',')\x20can\x20be\x20pushed.\x20','rmSync','ALREADY_EXISTS','name','createChatInterface','type','filter','site','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.',')\x20can\x20be\x20cloned.','none','sdk.llm','endsWith','idToName','2688520WQtabW','Renamed\x20folder:\x20','dryRun','chat','INVALID_ARGUMENT','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','getChatLog','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','resolveProjectName','getDefaultAgent','created','backupProject','3021738pVLXgp','.md','prompt.md','unchanged','chatWelcomeMessage','knowledgebases.json','NOT_FOUND','exportedFrom','Renamed\x20chat\x20interface\x20file:\x20','\x0a---\x20function:\x20','listProjects','Renamed\x20integration\x20file:\x20','systemPrompt','#\x20prompt.md\x0a','getChatHistory','textKnowledgeBases','imageGenerators','updateExperimentalArtifact','listAgents','def','deleteProject','isDirectory','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','stringify','readFileSync','setDefaultAgent','code','writeFileSync','AGENT_NOT_FOUND','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','getAgent','includes','updateAgentResponse','updateTextKnowledgeBase','llm_project','file_name','description','chatIgnoreManagedActions','\x22\x20already\x20exists','tables','_reasoning_','141142RVmQxe','resolveAgentId','Invalid\x20agent\x20reference\x20format:\x20','Renamed\x20KB\x20file:\x20','models','localeCompare','cloneProject','Available\x20agents:\x20','listExperimentalKnowledgeBases','history','Renamed\x20prompt\x20file:\x20','Renamed\x20experimental\x20artifact\x20directory:\x20','modelType','updated','chatInterfaces','map','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','starter_message','):\x20','createAgent','chat_generic','getCurrentProject','listChatInterfaces','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','already\x20exists','pushAgent','ExperimentalKnowledgeBase','KnowledgeBase','has','experimental_knowledge_bases','find','getDefaultProjectName','(dry-run)','\x0a---\x20schema:\x20','error','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.','errors','newProjectId','basename','chats','updateFormInterface','starterMessage','signal','add','listWebSearchTools','Removed\x20deleted\x20file:\x20','Skipping\x20integration\x20\x27','Output\x20directory\x20already\x20exists:\x20','Unsupported\x20backup\x20version:\x20','variables','claude-4.5-sonnet','13463230PTnDiv','getOrCreateDefaultProject','isDir','Multiple\x20agents\x20found\x20with\x20name\x20\x27','existsSync','listIntegrations','status','web_search','action','\x0a\x0a#\x20agent.yml\x0a','serviceType','json_schema.json','webSearchTools','.yml','toISOString','pushProject','push','tdDatabaseName','listKnowledgeBases','createAgentResponse','medium','content','listTextKnowledgeBases','4ApwMOQ','experimentalArtifacts','startChat','renamed','formInterfaces','listPrompts','3fHTfPR','clearDefaultAgent','length','tdx_','some','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','\x20in\x20project\x20','outputs','Agent\x20not\x20found:\x20','version','Renamed\x20form\x20interface\x20file:\x20','knowledge_bases','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','tools','\x20→\x20','warn','chatId','No\x20tdx.json\x20found\x20in\x20'];a147_0x52dc=function(){return _0x167b39;};return a147_0x52dc();}import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a147_0xd3e41f(0x122),a147_0xd3e41f(0x1a9),'chat_parent_segment'];async function safeListOrEmpty(_0xb0079d){try{return await _0xb0079d();}catch(_0x43af19){if(_0x43af19 instanceof HTTPClientError&&_0x43af19['status']===0x194)return[];throw _0x43af19;}}export class LLMSDK{[a147_0xd3e41f(0x185)];[a147_0xd3e41f(0x179)];[a147_0xd3e41f(0x18b)];['logger']=Logger['of'](a147_0xd3e41f(0x1fa));constructor(_0x2f6d30){const _0x1e802f=a147_0xd3e41f;this['client']=new LLMApiClient(_0x2f6d30),this[_0x1e802f(0x18b)]=_0x2f6d30;}[a147_0xd3e41f(0x12d)](){const _0xfd0e4b=a147_0xd3e41f,_0x2de868=getSanitizedUsername();return _0xfd0e4b(0x1b7)+_0x2de868;}async[a147_0xd3e41f(0x1a5)](_0x575f62){const _0x4e9913=a147_0xd3e41f,{projectId:_0x37578e}=await this[_0x4e9913(0xe1)](_0x575f62);this[_0x4e9913(0x185)]=_0x37578e;}[a147_0xd3e41f(0x123)](){const _0x186c05=a147_0xd3e41f;return this[_0x186c05(0x185)];}async[a147_0xd3e41f(0xfe)](_0x54df4d){const _0x4d0cf0=a147_0xd3e41f,_0x56eecb=this[_0x4d0cf0(0x18b)][_0x4d0cf0(0x1a3)];let _0x1a5e30,_0x56a62d;if(_0x54df4d[_0x4d0cf0(0x104)]('/')){const _0x40839a=_0x54df4d[_0x4d0cf0(0x18f)]('/');if(_0x40839a[_0x4d0cf0(0x160)]!==0x2)throw new SDKError(ErrorCode[_0x4d0cf0(0x201)],_0x4d0cf0(0x110)+_0x54df4d,undefined,{'helpText':_0x4d0cf0(0xdd)});const [_0x45bfc2,_0x38a438]=_0x40839a;_0x1a5e30=await this['resolveProjectId'](_0x45bfc2),_0x56a62d=_0x38a438;}else _0x1a5e30=this[_0x4d0cf0(0x185)]||(await this[_0x4d0cf0(0x142)]())['id'],_0x56a62d=_0x54df4d;const _0x4779e9=await this[_0x4d0cf0(0x10f)](_0x56a62d,_0x1a5e30),_0x453ae=await this[_0x4d0cf0(0x179)][_0x4d0cf0(0x103)](_0x4779e9);writeCachedLLMAgent(_0x453ae[_0x4d0cf0(0x193)]['name'],_0x4779e9,_0x1a5e30,_0x56eecb);}[a147_0xd3e41f(0xe2)](){const _0x3268c2=a147_0xd3e41f,_0x38081a=this[_0x3268c2(0x18b)][_0x3268c2(0x1a3)];return readCachedLLMAgent(_0x38081a)||undefined;}[a147_0xd3e41f(0x15f)](){const _0x3d18ed=a147_0xd3e41f,_0x270912=this[_0x3d18ed(0x18b)][_0x3d18ed(0x1a3)];clearCachedLLMAgent(_0x270912);}async[a147_0xd3e41f(0x112)](){const _0x4ba6b6=a147_0xd3e41f,_0x43d06a=await this[_0x4ba6b6(0x179)]['getUserSettings']();return toModelInfos(_0x43d06a);}async['createProject'](_0x6730f5){const _0x1ff0c3=a147_0xd3e41f;return await this[_0x1ff0c3(0x179)][_0x1ff0c3(0x1e5)](_0x6730f5);}async[a147_0xd3e41f(0xf9)](_0x105833){const _0x8a2207=a147_0xd3e41f,{projectId:_0x46b924}=await this[_0x8a2207(0xe1)](_0x105833);await this[_0x8a2207(0x179)][_0x8a2207(0xf9)](_0x46b924);}async[a147_0xd3e41f(0x18a)](_0x4fbcb3=0x32){const _0x1d70c4=a147_0xd3e41f;return await this[_0x1d70c4(0x179)][_0x1d70c4(0xef)](_0x4fbcb3);}async[a147_0xd3e41f(0x142)](_0x10d470){const _0x4ea7cf=a147_0xd3e41f,_0x35f437=_0x10d470||this[_0x4ea7cf(0x12d)](),_0x28e995=this['context'][_0x4ea7cf(0x1a3)];if(!_0x10d470){const _0x395126=readCachedLLMProject(_0x28e995);if(_0x395126&&_0x395126[_0x4ea7cf(0x1f2)]===_0x35f437)try{const _0x2e327a=await this[_0x4ea7cf(0x179)][_0x4ea7cf(0x175)](_0x395126['id']);if(_0x2e327a[_0x4ea7cf(0x193)]['name']===_0x35f437)return _0x2e327a;}catch{}}const _0x4051a6=await this[_0x4ea7cf(0x179)]['listProjects'](),_0xd5af39=_0x4051a6[_0x4ea7cf(0x12c)](_0x2e1718=>_0x2e1718[_0x4ea7cf(0x193)][_0x4ea7cf(0x1f2)]===_0x35f437);if(_0xd5af39)return!_0x10d470&&writeCachedLLMProject(_0x35f437,_0xd5af39['id'],_0x28e995),_0xd5af39;const _0xfd083b=await this[_0x4ea7cf(0x179)]['createProject']({'name':_0x35f437,'description':'Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20'+getSanitizedUsername()+')'});return!_0x10d470&&writeCachedLLMProject(_0x35f437,_0xfd083b['id'],_0x28e995),_0xfd083b;}async['resolveProjectId'](_0x336382){const _0x45bb27=a147_0xd3e41f,_0x13d928=await this[_0x45bb27(0x179)][_0x45bb27(0xef)](),_0x394b8e=_0x13d928[_0x45bb27(0x1f5)](_0x23479d=>_0x23479d[_0x45bb27(0x193)][_0x45bb27(0x1f2)]===_0x336382);if(_0x394b8e['length']===0x0)throw new SDKError(ErrorCode[_0x45bb27(0x1ec)],_0x45bb27(0x17f)+_0x336382,undefined,{'helpText':_0x45bb27(0x174)});if(_0x394b8e[_0x45bb27(0x160)]>0x1)throw new SDKError(ErrorCode[_0x45bb27(0x1d2)],'Multiple\x20projects\x20found\x20with\x20name\x20\x27'+_0x336382+_0x45bb27(0x17d));return _0x394b8e[0x0]['id'];}async[a147_0xd3e41f(0xe1)](_0x1f370d){const _0x51a60f=a147_0xd3e41f,_0x4a4ecc=await this[_0x51a60f(0x179)][_0x51a60f(0xef)](),_0x4f64eb=_0x4a4ecc[_0x51a60f(0x12c)](_0x4ecbad=>_0x4ecbad['attributes']['name']===_0x1f370d);if(_0x4f64eb)return{'projectId':_0x4f64eb['id'],'project':_0x4f64eb};throw new SDKError(ErrorCode[_0x51a60f(0x1ec)],_0x51a60f(0x17f)+_0x1f370d,undefined,{'helpText':_0x51a60f(0x174)});}async[a147_0xd3e41f(0x1bb)](_0x369f7b=a147_0xd3e41f(0x140),_0x4cca9f=0x0,_0x16716f){const _0x534ab7=a147_0xd3e41f,_0x8bd691=0xa;let _0x4829b3=0x0,_0x279fe2;while(_0x4829b3<_0x8bd691){try{const _0x31b6b4=await this['getOrCreateDefaultProject'](_0x279fe2),_0x451910=_0x31b6b4['id'],_0x445d7f=[_0x534ab7(0x1f9),_0x534ab7(0x196),'low',_0x534ab7(0x155),_0x534ab7(0x1be)],_0x399c5e=_0x4cca9f===0x0?_0x534ab7(0x161)+_0x369f7b:_0x534ab7(0x161)+_0x369f7b+_0x534ab7(0x10d)+_0x445d7f[_0x4cca9f],_0x351e79=await this[_0x534ab7(0x179)]['listAgents'](_0x451910),_0xaa8d19=_0x351e79['find'](_0x3920df=>_0x3920df[_0x534ab7(0x193)][_0x534ab7(0x1f2)]===_0x399c5e);if(_0xaa8d19)return _0xaa8d19;const _0x477ab9=_0x4cca9f>0x0?0x1:_0x16716f;return await this['client'][_0x534ab7(0x121)]({'name':_0x399c5e,'projectId':_0x451910,'modelType':_0x369f7b,'systemPrompt':'','temperature':_0x477ab9,'reasoningEffort':_0x4cca9f>0x0?_0x4cca9f:undefined});}catch(_0x98af14){if(_0x98af14 instanceof HTTPClientError){const _0x588ee4=_0x98af14[_0x534ab7(0x147)];if(_0x588ee4>=0x190&&_0x588ee4<0x1f4){if(_0x588ee4===0x191)throw new SDKError(ErrorCode['UNAUTHENTICATED'],'Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.',_0x98af14);else{if(_0x588ee4===0x193)throw new SDKError(ErrorCode['PERMISSION_DENIED'],_0x534ab7(0x11e),_0x98af14);}throw _0x98af14;}}if(errorContains(_0x98af14,_0x534ab7(0x126),'duplicate','conflict')){_0x4829b3++;if(_0x4829b3>=_0x8bd691)throw new SDKError(ErrorCode[_0x534ab7(0x1f1)],_0x534ab7(0x1e6)+_0x8bd691+_0x534ab7(0x191),_0x98af14);const _0x578d08=this['getDefaultProjectName']();_0x279fe2=_0x578d08+'_'+generateRandomHex();continue;}throw _0x98af14;}}throw new SDKError(ErrorCode[_0x534ab7(0x1d2)],_0x534ab7(0x1c3));}async[a147_0xd3e41f(0x10f)](_0x558007,_0x29925e){const _0x4bc2e0=a147_0xd3e41f,_0x721db8=_0x29925e||this[_0x4bc2e0(0x185)],_0x234768=await this[_0x4bc2e0(0x179)][_0x4bc2e0(0xf7)](_0x721db8),_0x1325ff=_0x234768[_0x4bc2e0(0x1f5)](_0x424411=>_0x424411['attributes'][_0x4bc2e0(0x1f2)]===_0x558007);if(_0x1325ff[_0x4bc2e0(0x160)]===0x0){const _0x22bd9d=_0x721db8?_0x4bc2e0(0x164)+_0x721db8:'';throw new SDKError(ErrorCode[_0x4bc2e0(0x101)],'Agent\x20not\x20found:\x20'+_0x558007+_0x22bd9d,undefined,{'helpText':_0x721db8?_0x4bc2e0(0xde):_0x4bc2e0(0x131)});}if(_0x1325ff[_0x4bc2e0(0x160)]>0x1)throw new SDKError(ErrorCode[_0x4bc2e0(0x1d2)],_0x4bc2e0(0x144)+_0x558007+_0x4bc2e0(0x17d));return _0x1325ff[0x0]['id'];}async['agents'](_0x80a0d0){const _0x149797=a147_0xd3e41f,_0x1fbf7d=_0x80a0d0||this[_0x149797(0x185)];return await this['client'][_0x149797(0xf7)](_0x1fbf7d);}async[a147_0xd3e41f(0x197)](_0x157f08){const _0x4f67ba=a147_0xd3e41f;return await this[_0x4f67ba(0x179)]['listAgentsFull'](_0x157f08);}async[a147_0xd3e41f(0x1e7)](_0xc86c56){const _0x30e1da=a147_0xd3e41f;return await this[_0x30e1da(0x179)]['getAgent'](_0xc86c56);}async[a147_0xd3e41f(0x121)](_0x125dfb){const _0x26a653=a147_0xd3e41f;return await this[_0x26a653(0x179)][_0x26a653(0x121)](_0x125dfb);}async[a147_0xd3e41f(0x1b2)](_0x43a1a9,_0x316549){const _0x1d1ad7=a147_0xd3e41f;return await this[_0x1d1ad7(0x179)][_0x1d1ad7(0x1b2)](_0x43a1a9,_0x316549);}async[a147_0xd3e41f(0x1aa)](_0x2141b5){await this['client']['deleteAgent'](_0x2141b5);}async[a147_0xd3e41f(0x15a)](_0x17bf27){const _0x475cb1=a147_0xd3e41f;return await this[_0x475cb1(0x179)][_0x475cb1(0x15a)]({'agentId':_0x17bf27});}async*[a147_0xd3e41f(0x200)](_0x2cb598,_0x2fc214){const _0x4418ee=a147_0xd3e41f;let _0x4c7723=_0x2fc214?.[_0x4418ee(0x16e)];const _0xc118f8=_0x2fc214?.['agentId'];if(!_0x4c7723){if(!_0xc118f8)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x5575f7=await this['client'][_0x4418ee(0x15a)]({'agentId':_0xc118f8});_0x4c7723=_0x5575f7['id'],yield{'type':'metadata','data':{'chatId':_0x4c7723,'agentId':_0xc118f8,'projectId':_0x5575f7['attributes'][_0x4418ee(0x1e9)]}};}for await(const _0x1f3cf9 of this[_0x4418ee(0x179)]['continueChat'](_0x4c7723,_0x2cb598,_0x2fc214?.[_0x4418ee(0x138)])){yield{'type':'event','data':_0x1f3cf9};}}async[a147_0xd3e41f(0x135)](_0x53077f=0x32){const _0x40f91c=a147_0xd3e41f;return await this[_0x40f91c(0x179)][_0x40f91c(0x1b9)](_0x53077f);}async[a147_0xd3e41f(0x117)](_0x4d071b){const _0x4869e7=a147_0xd3e41f;return await this['client'][_0x4869e7(0xf3)](_0x4d071b);}async[a147_0xd3e41f(0xdf)](_0x5f43d6){const _0x3dce7e=a147_0xd3e41f;return await this[_0x3dce7e(0x179)][_0x3dce7e(0xdf)](_0x5f43d6);}async['chatInfo'](_0x374dd0){const _0x2a65fa=a147_0xd3e41f;return await this[_0x2a65fa(0x179)]['getChatInfo'](_0x374dd0);}async[a147_0xd3e41f(0xe4)](_0x387615,_0xb50739,_0x35bb47){const _0x32b0b1=a147_0xd3e41f,_0x4742b3=_0x35bb47?.[_0x32b0b1(0x1ff)]??![],{projectId:_0x1598cd,project:_0x4f06dc}=await this[_0x32b0b1(0xe1)](_0x387615),_0x49bd9a=_0x4f06dc['attributes']['name'],_0x36a632=_0xb50739||_0x49bd9a+'.llm';if(a147_0xb9fbad[_0x32b0b1(0x145)](_0x36a632)&&!_0x4742b3)throw new SDKError(ErrorCode[_0x32b0b1(0x1f1)],_0x32b0b1(0x13d)+_0x36a632,undefined,{'helpText':_0x32b0b1(0x1b0)});const _0x1042d5=await this['client'][_0x32b0b1(0x188)](_0x1598cd),_0x88e632=await this[_0x32b0b1(0x179)]['listKnowledgeBases'](_0x1598cd),_0x573f2b=await this[_0x32b0b1(0x179)][_0x32b0b1(0x15d)](_0x1598cd),_0x17e5f6=await this[_0x32b0b1(0x179)][_0x32b0b1(0x146)](_0x1598cd);if(!_0x4742b3){a147_0xb9fbad['mkdirSync'](_0x36a632,{'recursive':!![]});const _0x5577bc={'version':_0x32b0b1(0x1c5),'exportedAt':new Date()[_0x32b0b1(0x14f)](),'exportedFrom':{'site':this[_0x32b0b1(0x18b)][_0x32b0b1(0x1f6)],'projectId':_0x1598cd,'projectName':_0x49bd9a},'project':_0x4f06dc};a147_0xb9fbad[_0x32b0b1(0x100)](a147_0x5b4142['join'](_0x36a632,'project.json'),JSON[_0x32b0b1(0xfc)](_0x5577bc,null,0x2)),a147_0xb9fbad[_0x32b0b1(0x100)](a147_0x5b4142[_0x32b0b1(0x1ed)](_0x36a632,'agents.json'),JSON['stringify'](_0x1042d5,null,0x2)),a147_0xb9fbad[_0x32b0b1(0x100)](a147_0x5b4142['join'](_0x36a632,'knowledgebases.json'),JSON[_0x32b0b1(0xfc)](_0x88e632,null,0x2)),a147_0xb9fbad[_0x32b0b1(0x100)](a147_0x5b4142[_0x32b0b1(0x1ed)](_0x36a632,_0x32b0b1(0x1c2)),JSON['stringify'](_0x573f2b,null,0x2)),a147_0xb9fbad[_0x32b0b1(0x100)](a147_0x5b4142[_0x32b0b1(0x1ed)](_0x36a632,_0x32b0b1(0x1ae)),JSON[_0x32b0b1(0xfc)](_0x17e5f6,null,0x2));}return{'projectName':_0x49bd9a,'outputDir':_0x36a632,'counts':{'agents':_0x1042d5['length'],'knowledgeBases':_0x88e632[_0x32b0b1(0x160)],'prompts':_0x573f2b[_0x32b0b1(0x160)],'integrations':_0x17e5f6[_0x32b0b1(0x160)]}};}async['restoreProject'](_0x9ad604,_0x54807b){const _0x4ee3b3=a147_0xd3e41f,_0x175f93=_0x54807b?.['dryRun']??![],_0x3b8a6f=this['getBackupMetadata'](_0x9ad604),_0x3974fd=_0x3b8a6f[_0x4ee3b3(0xec)][_0x4ee3b3(0x1f6)],_0x115d0b=this[_0x4ee3b3(0x18b)]['site'],_0x1067b4=_0x3974fd!==_0x115d0b?_0x3974fd:undefined,_0x470049=this[_0x4ee3b3(0x171)](a147_0x5b4142[_0x4ee3b3(0x1ed)](_0x9ad604,_0x4ee3b3(0x1e0)),[]),_0x17f2d6=this[_0x4ee3b3(0x171)](a147_0x5b4142['join'](_0x9ad604,_0x4ee3b3(0xea)),[]),_0x123512=this[_0x4ee3b3(0x171)](a147_0x5b4142[_0x4ee3b3(0x1ed)](_0x9ad604,_0x4ee3b3(0x1c2)),[]),_0x1fff24=this['loadJsonFile'](a147_0x5b4142[_0x4ee3b3(0x1ed)](_0x9ad604,_0x4ee3b3(0x1ae)),[]),_0x5da475=_0x54807b?.[_0x4ee3b3(0x1f2)]||_0x3b8a6f[_0x4ee3b3(0xec)]['projectName'];if(_0x175f93){const _0x279e6f=new Map(),_0x560b5c=[..._0x470049],_0x29ee45=_0x470049[_0x4ee3b3(0x160)]+0x1;let _0x5239e0=0x0;while(_0x560b5c['length']>0x0&&_0x5239e0<_0x29ee45){_0x5239e0++;const _0x2d48ab=[];for(const _0x2db288 of _0x560b5c){canCreateAgent(_0x2db288,_0x279e6f)?_0x279e6f['set'](_0x2db288['id'],_0x4ee3b3(0x178)+_0x2db288['id']):_0x2d48ab['push'](_0x2db288);}if(_0x2d48ab['length']===_0x560b5c[_0x4ee3b3(0x160)])throw new SDKError(ErrorCode[_0x4ee3b3(0x1d2)],_0x4ee3b3(0x183),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x560b5c[_0x4ee3b3(0x160)]=0x0,_0x560b5c[_0x4ee3b3(0x151)](..._0x2d48ab);}const _0x17b8ab=_0x123512[_0x4ee3b3(0x1f5)](_0x6f5998=>_0x279e6f[_0x4ee3b3(0x12a)](_0x6f5998[_0x4ee3b3(0x193)][_0x4ee3b3(0x17c)]))[_0x4ee3b3(0x160)];return{'projectName':_0x5da475,'projectId':_0x4ee3b3(0x12e),'counts':{'agents':_0x470049[_0x4ee3b3(0x160)],'knowledgeBases':_0x17f2d6[_0x4ee3b3(0x160)],'prompts':_0x17b8ab,'integrations':_0x1fff24[_0x4ee3b3(0x160)]},'sourceSite':_0x1067b4};}const _0x5cbd42=await this[_0x4ee3b3(0x179)][_0x4ee3b3(0x1e5)]({'name':_0x5da475,'description':_0x3b8a6f[_0x4ee3b3(0x1cc)]['attributes'][_0x4ee3b3(0x109)]}),_0x456166=_0x5cbd42['id'],_0x3eaf66=new Map(),_0x30713f=new Map(),_0x50b0c8=new Map();for(const _0x5ce38d of _0x17f2d6){const _0x362731=await this['client'][_0x4ee3b3(0x1dc)]({'projectId':_0x456166,'name':_0x5ce38d[_0x4ee3b3(0x193)]['name'],'tdDatabaseName':_0x5ce38d[_0x4ee3b3(0x193)][_0x4ee3b3(0x152)],'tables':_0x5ce38d[_0x4ee3b3(0x193)][_0x4ee3b3(0x10c)]});_0x3eaf66['set'](_0x5ce38d['id'],_0x362731['id']);}const _0x532f2f=[..._0x470049],_0x12b3e7=_0x470049[_0x4ee3b3(0x160)]+0x1;let _0xf984e9=0x0;while(_0x532f2f[_0x4ee3b3(0x160)]>0x0&&_0xf984e9<_0x12b3e7){_0xf984e9++;const _0x2040ed=[];for(const _0x520e72 of _0x532f2f){if(canCreateAgent(_0x520e72,_0x30713f)){const _0x24f702=remapToolIds(_0x520e72[_0x4ee3b3(0x193)][_0x4ee3b3(0x16b)],_0x3eaf66,_0x30713f),_0xcfa64b=remapVariableIds(_0x520e72[_0x4ee3b3(0x193)][_0x4ee3b3(0x13f)],_0x3eaf66),_0xc7598c=await this[_0x4ee3b3(0x179)][_0x4ee3b3(0x154)]({'name':_0x520e72[_0x4ee3b3(0x193)][_0x4ee3b3(0x1f2)],'projectId':_0x456166,'systemPrompt':_0x520e72['attributes'][_0x4ee3b3(0xf1)],'starterMessage':_0x520e72[_0x4ee3b3(0x193)]['starterMessage'],'modelType':migrateModelType(_0x520e72[_0x4ee3b3(0x193)][_0x4ee3b3(0x11a)]),'maxToolIterations':_0x520e72[_0x4ee3b3(0x193)]['maxToolIterations'],'temperature':_0x520e72['attributes'][_0x4ee3b3(0x192)],'reasoningEffort':_0x520e72['attributes']['reasoningEffort'],'outputs':_0x520e72[_0x4ee3b3(0x193)][_0x4ee3b3(0x165)],'tools':_0x24f702,'variables':_0xcfa64b});_0x30713f['set'](_0x520e72['id'],_0xc7598c['id']);}else _0x2040ed[_0x4ee3b3(0x151)](_0x520e72);}if(_0x2040ed[_0x4ee3b3(0x160)]===_0x532f2f[_0x4ee3b3(0x160)])throw new SDKError(ErrorCode['INTERNAL'],_0x4ee3b3(0x183),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x532f2f[_0x4ee3b3(0x160)]=0x0,_0x532f2f[_0x4ee3b3(0x151)](..._0x2040ed);}for(const _0x49f03e of _0x123512){const _0x4176ea=_0x30713f['get'](_0x49f03e[_0x4ee3b3(0x193)][_0x4ee3b3(0x17c)]);if(!_0x4176ea)continue;const _0x45adbe=await this[_0x4ee3b3(0x179)][_0x4ee3b3(0x1ea)]({'projectId':_0x456166,'agentId':_0x4176ea,'name':_0x49f03e[_0x4ee3b3(0x193)][_0x4ee3b3(0x1f2)],'systemPrompt':_0x49f03e[_0x4ee3b3(0x193)][_0x4ee3b3(0xf1)],'template':_0x49f03e[_0x4ee3b3(0x193)]['template'],'jsonSchemaHint':_0x49f03e[_0x4ee3b3(0x193)]['jsonSchemaHint']});_0x50b0c8['set'](_0x49f03e['id'],_0x45adbe['id']);}for(const _0x17aa8f of _0x1fff24){const _0x50bf69=_0x17aa8f['attributes'][_0x4ee3b3(0x181)][_0x4ee3b3(0x11d)](_0x108c18=>({..._0x108c18,'promptId':_0x50b0c8['get'](_0x108c18[_0x4ee3b3(0x1bf)])||_0x108c18[_0x4ee3b3(0x1bf)]}));await this['client'][_0x4ee3b3(0x1de)]({'projectId':_0x456166,'serviceType':_0x17aa8f[_0x4ee3b3(0x193)][_0x4ee3b3(0x14b)],'actions':_0x50bf69,'slackMessageMode':_0x17aa8f[_0x4ee3b3(0x193)]['slackMessageMode'],'chatIgnoreManagedActions':_0x17aa8f[_0x4ee3b3(0x193)][_0x4ee3b3(0x10a)],'chatWelcomeMessage':_0x17aa8f['attributes'][_0x4ee3b3(0xe9)],'webhookCorsOrigins':_0x17aa8f[_0x4ee3b3(0x193)][_0x4ee3b3(0x1af)]});}return{'projectName':_0x5da475,'projectId':_0x456166,'counts':{'agents':_0x30713f[_0x4ee3b3(0x1c0)],'knowledgeBases':_0x3eaf66[_0x4ee3b3(0x1c0)],'prompts':_0x50b0c8[_0x4ee3b3(0x1c0)],'integrations':_0x1fff24[_0x4ee3b3(0x160)]},'sourceSite':_0x1067b4};}[a147_0xd3e41f(0x171)](_0x9cf291,_0x32ba4b){const _0x4b75a4=a147_0xd3e41f;if(!a147_0xb9fbad['existsSync'](_0x9cf291))return _0x32ba4b;return JSON[_0x4b75a4(0x1d0)](a147_0xb9fbad[_0x4b75a4(0xfd)](_0x9cf291,_0x4b75a4(0x1bc)));}[a147_0xd3e41f(0x1eb)](_0x4ce6fa){const _0x46ca1a=a147_0xd3e41f;if(!a147_0xb9fbad[_0x46ca1a(0x145)](_0x4ce6fa))throw new SDKError(ErrorCode[_0x46ca1a(0xeb)],_0x46ca1a(0x1d4)+_0x4ce6fa,undefined,{'helpText':_0x46ca1a(0x186)});const _0x1441d1=a147_0x5b4142['join'](_0x4ce6fa,_0x46ca1a(0x187));if(!a147_0xb9fbad[_0x46ca1a(0x145)](_0x1441d1))throw new SDKError(ErrorCode[_0x46ca1a(0x201)],_0x46ca1a(0x16a)+_0x4ce6fa,undefined,{'helpText':_0x46ca1a(0x1f7)});const _0x41d5f3=JSON[_0x46ca1a(0x1d0)](a147_0xb9fbad[_0x46ca1a(0xfd)](_0x1441d1,_0x46ca1a(0x1bc)));if(!isSupportedBackupVersion(_0x41d5f3['version']))throw new SDKError(ErrorCode[_0x46ca1a(0x201)],_0x46ca1a(0x13e)+_0x41d5f3[_0x46ca1a(0x167)],undefined,{'helpText':_0x46ca1a(0xe0)});return _0x41d5f3;}async[a147_0xd3e41f(0x1a4)](_0x44cc26,_0x1ac1b6,_0x201ede){const _0x1f42dd=a147_0xd3e41f,{projectId:_0x205199,project:_0x3d8179}=await this[_0x1f42dd(0xe1)](_0x44cc26),_0x3ae0cd=_0x3d8179[_0x1f42dd(0x193)][_0x1f42dd(0x1f2)];let _0x2a43ec;if(_0x1ac1b6)_0x2a43ec=_0x1ac1b6;else{const _0x507eb4=a147_0x5b4142[_0x1f42dd(0x1ed)](process[_0x1f42dd(0x1da)](),_0x1f42dd(0x1e1)),_0xc14b5e=getSanitizedPathWithMigration(_0x507eb4,_0x3ae0cd);_0xc14b5e[_0x1f42dd(0x15b)]&&this[_0x1f42dd(0x1d1)][_0x1f42dd(0x180)](_0x1f42dd(0x1fe)+a147_0x5b4142[_0x1f42dd(0x134)](_0xc14b5e['oldPath'])+_0x1f42dd(0x16c)+a147_0x5b4142['basename'](_0xc14b5e[_0x1f42dd(0x1bd)])),_0x2a43ec=_0xc14b5e['path'];}const _0x50c597=await this['client'][_0x1f42dd(0x188)](_0x205199),_0x452bbf=await this[_0x1f42dd(0x179)]['listKnowledgeBases'](_0x205199),_0x1c9450=await this[_0x1f42dd(0x179)]['listTextKnowledgeBases'](_0x205199),_0x5bd970=await safeListOrEmpty(()=>this[_0x1f42dd(0x179)]['listImageGenerators'](_0x205199)),_0x3a4a36=await safeListOrEmpty(()=>this[_0x1f42dd(0x179)][_0x1f42dd(0x13a)](_0x205199)),_0x1234d3=await this[_0x1f42dd(0x179)][_0x1f42dd(0x15d)](_0x205199),_0x136e44=await this[_0x1f42dd(0x179)][_0x1f42dd(0x146)](_0x205199),_0xe0088=await safeListOrEmpty(()=>this[_0x1f42dd(0x179)][_0x1f42dd(0x116)](_0x205199)),_0x4582fc=await safeListOrEmpty(()=>this[_0x1f42dd(0x179)][_0x1f42dd(0x1e4)](_0x205199)),_0x395df2=await safeListOrEmpty(()=>this['client'][_0x1f42dd(0x1d5)](_0x205199)),_0x26323c=await safeListOrEmpty(()=>this[_0x1f42dd(0x179)][_0x1f42dd(0x124)](_0x205199)),_0x2abc8a=_0x136e44[_0x1f42dd(0x1f5)](_0x40aa01=>!_0x40aa01[_0x1f42dd(0x193)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x1f42dd(0x104)](_0x40aa01[_0x1f42dd(0x193)][_0x1f42dd(0x14b)][_0x1f42dd(0x19f)]())),_0x1345c2=new Map(),_0xd09427=new Map(),_0x3bb1b1=new Map(),_0x22399d=new Map(),_0x4a03cb=new Map(),_0xc169cf=new Map(),_0x587055=new Map();for(const _0x1e250b of _0x50c597){_0x1345c2[_0x1f42dd(0x1df)](_0x1e250b['id'],_0x1e250b[_0x1f42dd(0x193)][_0x1f42dd(0x1f2)]);}for(const _0x2b934f of _0x452bbf){_0xd09427[_0x1f42dd(0x1df)](_0x2b934f['id'],_0x2b934f['attributes'][_0x1f42dd(0x1f2)]);}for(const _0x258cbf of _0x1c9450){_0x3bb1b1[_0x1f42dd(0x1df)](_0x258cbf['id'],_0x258cbf[_0x1f42dd(0x193)][_0x1f42dd(0x1f2)]);}for(const _0x30b2f0 of _0x5bd970){_0x22399d[_0x1f42dd(0x1df)](_0x30b2f0['id'],_0x30b2f0['attributes'][_0x1f42dd(0x1f2)]);}for(const _0x37ef83 of _0x3a4a36){_0x4a03cb[_0x1f42dd(0x1df)](_0x37ef83['id'],_0x37ef83[_0x1f42dd(0x193)]['name']);}for(const _0x14e75f of _0x1234d3){_0xc169cf[_0x1f42dd(0x1df)](_0x14e75f['id'],_0x14e75f[_0x1f42dd(0x193)]['name']);}for(const _0x16b5d8 of _0xe0088){_0x587055['set'](_0x16b5d8['id'],_0x16b5d8[_0x1f42dd(0x193)][_0x1f42dd(0x1f2)]);}const _0x38b1b6={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0xd09427,'TextKnowledgeBase':_0x3bb1b1,'Agent':_0x1345c2,'WebSearchTool':_0x4a03cb,'ImageGenerator':_0x22399d,'ExperimentalKnowledgeBase':_0x587055}),'resolvePromptName':async _0x16f4dc=>_0xc169cf[_0x1f42dd(0x198)](_0x16f4dc),'onWarning':_0x47f499=>this[_0x1f42dd(0x1d1)][_0x1f42dd(0x16d)](_0x47f499)},_0x1c303f={'projectName':_0x3ae0cd,'outputDir':_0x2a43ec,'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}}},_0x349078=[],_0xaaf52d=[];for(const _0x553244 of _0x50c597){const _0x355c4a=getSanitizedPathWithMigration(_0x2a43ec,_0x553244[_0x1f42dd(0x193)]['name']);_0x355c4a[_0x1f42dd(0x15b)]&&this[_0x1f42dd(0x1d1)]['info'](_0x1f42dd(0x184)+a147_0x5b4142['basename'](_0x355c4a['oldPath'])+'\x20→\x20'+a147_0x5b4142[_0x1f42dd(0x134)](_0x355c4a[_0x1f42dd(0x1bd)]));const _0x5cc58f=_0x355c4a[_0x1f42dd(0x1bd)],_0x2a6051=a147_0x5b4142[_0x1f42dd(0x1ed)](_0x5cc58f,_0x1f42dd(0xe7)),_0xffb6f2=a147_0x5b4142[_0x1f42dd(0x1ed)](_0x5cc58f,_0x1f42dd(0x1ad)),_0x3f17c2=a147_0x5b4142[_0x1f42dd(0x1ed)](_0x5cc58f,_0x1f42dd(0x1b4)),{yaml:_0x4dc95e,systemPrompt:_0x30f3c7,starterMessage:_0x313742}=await agentResponseToDef(_0x553244,_0x38b1b6),_0x45c4e8=toAgentYamlString(_0x4dc95e),_0x37d706=!a147_0xb9fbad['existsSync'](_0xffb6f2);let _0x351524=_0x37d706,_0x40858e;if(!_0x37d706){const _0x5acce9=a147_0xb9fbad['existsSync'](_0x2a6051)?a147_0xb9fbad[_0x1f42dd(0xfd)](_0x2a6051,'utf-8'):'',_0x452b88=a147_0xb9fbad['readFileSync'](_0xffb6f2,'utf-8'),_0x4e2c62=_0x1f42dd(0xf2)+_0x5acce9+_0x1f42dd(0x14a)+_0x452b88,_0x4964ca=_0x1f42dd(0xf2)+_0x30f3c7+_0x1f42dd(0x14a)+_0x45c4e8,_0x5b3cdb=generateDiff(_0x4e2c62,_0x4964ca);_0x351524=hasChanges(_0x5b3cdb),_0x351524&&(_0x40858e=formatDiffWithColors(_0x5b3cdb));}_0x349078['push']({'path':_0x5cc58f,'content':'','isDir':!![]}),_0x349078['push']({'path':_0x2a6051,'content':_0x30f3c7}),_0x349078['push']({'path':_0xffb6f2,'content':_0x45c4e8});_0x313742&&_0x313742[_0x1f42dd(0x104)]('\x0a')&&_0x349078[_0x1f42dd(0x151)]({'path':_0x3f17c2,'content':_0x313742});_0x1c303f[_0x1f42dd(0x1e1)]['push']({'agentName':_0x553244[_0x1f42dd(0x193)]['name'],'outputPath':_0x5cc58f,'isNew':_0x37d706,'hasChanges':_0x351524,'diff':_0x40858e}),_0x1c303f[_0x1f42dd(0x1e3)]['agents'][_0x1f42dd(0x1ac)]++;if(_0x37d706)_0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x1e1)][_0x1f42dd(0x1b3)]++;else{if(_0x351524)_0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x1e1)][_0x1f42dd(0x11b)]++;else _0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x1e1)]['unchanged']++;}}for(const _0x110563 of _0x452bbf){if(_0x110563[_0x1f42dd(0x193)][_0x1f42dd(0x1c9)])continue;const _0x161398=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x2a43ec),_0x110563[_0x1f42dd(0x193)][_0x1f42dd(0x1f2)],_0x1f42dd(0x14e));_0x161398[_0x1f42dd(0x15b)]&&this[_0x1f42dd(0x1d1)][_0x1f42dd(0x180)](_0x1f42dd(0x111)+a147_0x5b4142['basename'](_0x161398['oldPath'])+_0x1f42dd(0x16c)+a147_0x5b4142[_0x1f42dd(0x134)](_0x161398[_0x1f42dd(0x1bd)]));const _0x2c6a85=_0x161398['path'],_0x1da0e8=apiKnowledgeBaseToYaml(_0x110563),_0x37c0f7=toKnowledgeBaseYamlString(_0x1da0e8),_0x47da5b=!a147_0xb9fbad[_0x1f42dd(0x145)](_0x2c6a85);let _0x3f2e92=_0x47da5b,_0x4506d5;if(!_0x47da5b){const _0x2de519=a147_0xb9fbad['readFileSync'](_0x2c6a85,_0x1f42dd(0x1bc)),_0x256e33=generateDiff(_0x2de519,_0x37c0f7);_0x3f2e92=hasChanges(_0x256e33),_0x3f2e92&&(_0x4506d5=formatDiffWithColors(_0x256e33));}_0x349078[_0x1f42dd(0x151)]({'path':_0x2c6a85,'content':_0x37c0f7}),_0x1c303f[_0x1f42dd(0x1d6)][_0x1f42dd(0x151)]({'name':_0x110563['attributes'][_0x1f42dd(0x1f2)],'outputPath':_0x2c6a85,'isNew':_0x47da5b,'hasChanges':_0x3f2e92,'diff':_0x4506d5}),_0x1c303f['counts'][_0x1f42dd(0x1d6)][_0x1f42dd(0x1ac)]++;if(_0x47da5b)_0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x1d6)]['new']++;else{if(_0x3f2e92)_0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x1d6)][_0x1f42dd(0x11b)]++;else _0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x1d6)][_0x1f42dd(0xe8)]++;}}for(const _0x4638b3 of _0x1c9450){if(_0x4638b3[_0x1f42dd(0x193)][_0x1f42dd(0x1c9)])continue;const _0x2053a9=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x2a43ec),_0x4638b3[_0x1f42dd(0x193)][_0x1f42dd(0x1f2)],_0x1f42dd(0xe6));_0x2053a9[_0x1f42dd(0x15b)]&&this[_0x1f42dd(0x1d1)][_0x1f42dd(0x180)](_0x1f42dd(0x172)+a147_0x5b4142[_0x1f42dd(0x134)](_0x2053a9[_0x1f42dd(0x176)])+'\x20→\x20'+a147_0x5b4142[_0x1f42dd(0x134)](_0x2053a9[_0x1f42dd(0x1bd)]));const _0x5f04ce=_0x2053a9[_0x1f42dd(0x1bd)],_0x5a8253=toTextKnowledgeBaseMd(_0x4638b3[_0x1f42dd(0x193)]['name'],_0x4638b3[_0x1f42dd(0x193)][_0x1f42dd(0x1c8)]),_0x2a88a2=!a147_0xb9fbad[_0x1f42dd(0x145)](_0x5f04ce);let _0x2980c7=_0x2a88a2,_0x8e45ee;if(!_0x2a88a2){const _0x464d6e=a147_0xb9fbad[_0x1f42dd(0xfd)](_0x5f04ce,_0x1f42dd(0x1bc)),_0xeb99a4=generateDiff(_0x464d6e,_0x5a8253);_0x2980c7=hasChanges(_0xeb99a4),_0x2980c7&&(_0x8e45ee=formatDiffWithColors(_0xeb99a4));}_0x349078[_0x1f42dd(0x151)]({'path':_0x5f04ce,'content':_0x5a8253}),_0x1c303f[_0x1f42dd(0xf4)][_0x1f42dd(0x151)]({'name':_0x4638b3['attributes'][_0x1f42dd(0x1f2)],'outputPath':_0x5f04ce,'isNew':_0x2a88a2,'hasChanges':_0x2980c7,'diff':_0x8e45ee}),_0x1c303f['counts'][_0x1f42dd(0xf4)]['total']++;if(_0x2a88a2)_0x1c303f[_0x1f42dd(0x1e3)]['textKnowledgeBases']['new']++;else{if(_0x2980c7)_0x1c303f[_0x1f42dd(0x1e3)]['textKnowledgeBases']['updated']++;else _0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0xf4)][_0x1f42dd(0xe8)]++;}}for(const _0x3c3c4 of _0x1234d3){if(_0x3c3c4[_0x1f42dd(0x193)][_0x1f42dd(0x1c9)])continue;const _0x47828b=getSanitizedPathWithMigration(getPromptsDir(_0x2a43ec),_0x3c3c4[_0x1f42dd(0x193)][_0x1f42dd(0x1f2)],'.yml');_0x47828b['renamed']&&this[_0x1f42dd(0x1d1)][_0x1f42dd(0x180)](_0x1f42dd(0x118)+a147_0x5b4142[_0x1f42dd(0x134)](_0x47828b[_0x1f42dd(0x176)])+_0x1f42dd(0x16c)+a147_0x5b4142['basename'](_0x47828b[_0x1f42dd(0x1bd)]));const _0x4d68f3=_0x47828b[_0x1f42dd(0x1bd)],_0x42e28a=await apiPromptToYaml(_0x3c3c4,_0x38b1b6);if(!_0x42e28a)continue;const _0xf071d2=toPromptYamlString(_0x42e28a),_0x5b0234=!a147_0xb9fbad['existsSync'](_0x4d68f3);let _0x260e70=_0x5b0234,_0x37cbb6;if(!_0x5b0234){const _0x211107=a147_0xb9fbad[_0x1f42dd(0xfd)](_0x4d68f3,_0x1f42dd(0x1bc)),_0x34c3b9=generateDiff(_0x211107,_0xf071d2);_0x260e70=hasChanges(_0x34c3b9),_0x260e70&&(_0x37cbb6=formatDiffWithColors(_0x34c3b9));}_0x349078[_0x1f42dd(0x151)]({'path':_0x4d68f3,'content':_0xf071d2}),_0x1c303f['prompts'][_0x1f42dd(0x151)]({'name':_0x3c3c4[_0x1f42dd(0x193)][_0x1f42dd(0x1f2)],'outputPath':_0x4d68f3,'isNew':_0x5b0234,'hasChanges':_0x260e70,'diff':_0x37cbb6}),_0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x1dd)][_0x1f42dd(0x1ac)]++;if(_0x5b0234)_0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x1dd)][_0x1f42dd(0x1b3)]++;else{if(_0x260e70)_0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x1dd)][_0x1f42dd(0x11b)]++;else _0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x1dd)][_0x1f42dd(0xe8)]++;}}for(const _0x360796 of _0x2abc8a){const _0x1224f0=_0x360796[_0x1f42dd(0x193)][_0x1f42dd(0x14b)]['toLowerCase'](),_0x13fe79=getSanitizedPathWithMigration(getIntegrationsDir(_0x2a43ec),_0x1224f0,_0x1f42dd(0x14e));_0x13fe79['renamed']&&this[_0x1f42dd(0x1d1)]['info'](_0x1f42dd(0xf0)+a147_0x5b4142[_0x1f42dd(0x134)](_0x13fe79[_0x1f42dd(0x176)])+_0x1f42dd(0x16c)+a147_0x5b4142[_0x1f42dd(0x134)](_0x13fe79[_0x1f42dd(0x1bd)]));const _0x1ac34e=_0x13fe79[_0x1f42dd(0x1bd)],_0x3949dd=await apiIntegrationToYaml(_0x360796,_0x38b1b6),_0x3c1ae7=toIntegrationYamlString(_0x3949dd),_0xac6eb0=!a147_0xb9fbad[_0x1f42dd(0x145)](_0x1ac34e);let _0x31a894=_0xac6eb0,_0x32020d;if(!_0xac6eb0){const _0x11776d=a147_0xb9fbad[_0x1f42dd(0xfd)](_0x1ac34e,'utf-8'),_0x1fa150=generateDiff(_0x11776d,_0x3c1ae7);_0x31a894=hasChanges(_0x1fa150),_0x31a894&&(_0x32020d=formatDiffWithColors(_0x1fa150));}_0x349078['push']({'path':_0x1ac34e,'content':_0x3c1ae7}),_0x1c303f[_0x1f42dd(0x18d)][_0x1f42dd(0x151)]({'name':_0x1224f0,'outputPath':_0x1ac34e,'isNew':_0xac6eb0,'hasChanges':_0x31a894,'diff':_0x32020d}),_0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x18d)][_0x1f42dd(0x1ac)]++;if(_0xac6eb0)_0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x18d)][_0x1f42dd(0x1b3)]++;else{if(_0x31a894)_0x1c303f[_0x1f42dd(0x1e3)]['integrations'][_0x1f42dd(0x11b)]++;else _0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x18d)][_0x1f42dd(0xe8)]++;}}for(const _0x52c22c of _0xe0088){if(_0x52c22c[_0x1f42dd(0x193)][_0x1f42dd(0x1c9)])continue;const _0x582890=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x2a43ec),_0x52c22c[_0x1f42dd(0x193)][_0x1f42dd(0x1f2)]);_0x582890[_0x1f42dd(0x15b)]&&this[_0x1f42dd(0x1d1)][_0x1f42dd(0x180)]('Renamed\x20experimental\x20KB\x20directory:\x20'+a147_0x5b4142[_0x1f42dd(0x134)](_0x582890[_0x1f42dd(0x176)])+_0x1f42dd(0x16c)+a147_0x5b4142[_0x1f42dd(0x134)](_0x582890['path']));const _0x62c3d4=_0x582890['path'],_0x2aacc7=a147_0x5b4142['join'](_0x62c3d4,sanitizeForFilesystem(_0x52c22c[_0x1f42dd(0x193)][_0x1f42dd(0x1f2)])+_0x1f42dd(0x14e)),_0x1e8608=a147_0x5b4142['join'](_0x62c3d4,_0x1f42dd(0x1ab)),_0x510d8d=apiExperimentalKnowledgeBaseToYaml(_0x52c22c),_0x4a6428=toExperimentalKnowledgeBaseYamlString(_0x510d8d),_0x24882d=!a147_0xb9fbad[_0x1f42dd(0x145)](_0x62c3d4);let _0x249a85=_0x24882d,_0x19e9e5,_0x32c2ea=_0x4a6428;const _0xacabf2=[..._0x510d8d[_0x1f42dd(0x1ab)]][_0x1f42dd(0x1d3)]((_0x56a154,_0x48c758)=>_0x56a154[_0x1f42dd(0x1f2)][_0x1f42dd(0x113)](_0x48c758[_0x1f42dd(0x1f2)]));for(const _0x46e9d3 of _0xacabf2){_0x32c2ea+=_0x1f42dd(0xee)+_0x46e9d3[_0x1f42dd(0x1f2)]+_0x1f42dd(0x18c)+_0x46e9d3[_0x1f42dd(0xff)]+'\x0a---\x20schema:\x20'+_0x46e9d3['name']+_0x1f42dd(0x18c)+_0x46e9d3[_0x1f42dd(0x19e)]+'\x0a';}if(!_0x24882d){let _0x3c0c21='';a147_0xb9fbad['existsSync'](_0x2aacc7)&&(_0x3c0c21=a147_0xb9fbad[_0x1f42dd(0xfd)](_0x2aacc7,_0x1f42dd(0x1bc)));if(a147_0xb9fbad[_0x1f42dd(0x145)](_0x1e8608)){const _0x25945c=a147_0xb9fbad[_0x1f42dd(0x1b1)](_0x1e8608,{'withFileTypes':!![]}),_0x3446dd=_0x25945c['filter'](_0x2f9c46=>_0x2f9c46[_0x1f42dd(0xfa)]())[_0x1f42dd(0x1d3)]((_0x310faf,_0x4254ae)=>_0x310faf[_0x1f42dd(0x1f2)][_0x1f42dd(0x113)](_0x4254ae[_0x1f42dd(0x1f2)]));for(const _0xc9c79c of _0x3446dd){const _0x4fa256=a147_0x5b4142[_0x1f42dd(0x1ed)](_0x1e8608,_0xc9c79c['name'],'code.js'),_0x54a858=a147_0x5b4142[_0x1f42dd(0x1ed)](_0x1e8608,_0xc9c79c['name'],'json_schema.json');a147_0xb9fbad[_0x1f42dd(0x145)](_0x4fa256)&&(_0x3c0c21+=_0x1f42dd(0xee)+_0xc9c79c[_0x1f42dd(0x1f2)]+'\x20---\x0a'+a147_0xb9fbad[_0x1f42dd(0xfd)](_0x4fa256,_0x1f42dd(0x1bc))+'\x0a'),a147_0xb9fbad['existsSync'](_0x54a858)&&(_0x3c0c21+='---\x20schema:\x20'+_0xc9c79c[_0x1f42dd(0x1f2)]+'\x20---\x0a'+a147_0xb9fbad[_0x1f42dd(0xfd)](_0x54a858,_0x1f42dd(0x1bc))+'\x0a');}}const _0x2a3457=generateDiff(_0x3c0c21,_0x32c2ea);_0x249a85=hasChanges(_0x2a3457),_0x249a85&&(_0x19e9e5=formatDiffWithColors(_0x2a3457));}_0x349078[_0x1f42dd(0x151)]({'path':_0x62c3d4,'content':'','isDir':!![]}),_0x349078['push']({'path':_0x2aacc7,'content':_0x4a6428}),_0x349078['push']({'path':_0x1e8608,'content':'','isDir':!![]});for(const _0x17b03d of _0x510d8d[_0x1f42dd(0x1ab)]){const _0x3725e3=a147_0x5b4142[_0x1f42dd(0x1ed)](_0x1e8608,sanitizeForFilesystem(_0x17b03d[_0x1f42dd(0x1f2)])),_0x598ebf=a147_0x5b4142['join'](_0x3725e3,_0x1f42dd(0x1a6)),_0x679c85=a147_0x5b4142[_0x1f42dd(0x1ed)](_0x3725e3,_0x1f42dd(0x14c));_0x349078[_0x1f42dd(0x151)]({'path':_0x3725e3,'content':'','isDir':!![]}),_0x349078[_0x1f42dd(0x151)]({'path':_0x598ebf,'content':_0x17b03d[_0x1f42dd(0xff)]}),_0x349078[_0x1f42dd(0x151)]({'path':_0x679c85,'content':_0x17b03d[_0x1f42dd(0x19e)]});}if(a147_0xb9fbad[_0x1f42dd(0x145)](_0x1e8608)){const _0x1cd4bf=a147_0xb9fbad['readdirSync'](_0x1e8608,{'withFileTypes':!![]}),_0x49b58b=new Set(_0x510d8d[_0x1f42dd(0x1ab)]['map'](_0x456aa4=>sanitizeForFilesystem(_0x456aa4[_0x1f42dd(0x1f2)])));for(const _0x2482eb of _0x1cd4bf){if(_0x2482eb[_0x1f42dd(0xfa)]()&&!_0x49b58b['has'](_0x2482eb[_0x1f42dd(0x1f2)])){const _0xfcdec7=a147_0x5b4142[_0x1f42dd(0x1ed)](_0x1e8608,_0x2482eb[_0x1f42dd(0x1f2)]);_0xaaf52d[_0x1f42dd(0x151)]({'path':_0xfcdec7,'isDir':!![]});}}}_0x1c303f[_0x1f42dd(0x182)][_0x1f42dd(0x151)]({'name':_0x52c22c[_0x1f42dd(0x193)]['name'],'outputPath':_0x62c3d4,'isNew':_0x24882d,'hasChanges':_0x249a85,'diff':_0x19e9e5}),_0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x182)]['total']++;if(_0x24882d)_0x1c303f[_0x1f42dd(0x1e3)]['experimentalKnowledgeBases']['new']++;else{if(_0x249a85)_0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x182)]['updated']++;else _0x1c303f['counts'][_0x1f42dd(0x182)][_0x1f42dd(0xe8)]++;}}for(const _0x4cc712 of _0x4582fc){if(_0x4cc712[_0x1f42dd(0x193)][_0x1f42dd(0x1c9)])continue;const _0x159454=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x2a43ec),_0x4cc712[_0x1f42dd(0x193)][_0x1f42dd(0x1f2)]);_0x159454[_0x1f42dd(0x15b)]&&this[_0x1f42dd(0x1d1)]['info'](_0x1f42dd(0x119)+a147_0x5b4142[_0x1f42dd(0x134)](_0x159454[_0x1f42dd(0x176)])+'\x20→\x20'+a147_0x5b4142[_0x1f42dd(0x134)](_0x159454['path']));const _0xbabc82=_0x159454['path'],_0xc31736=a147_0x5b4142[_0x1f42dd(0x1ed)](_0xbabc82,sanitizeForFilesystem(_0x4cc712[_0x1f42dd(0x193)][_0x1f42dd(0x1f2)])+_0x1f42dd(0x14e)),_0x16b970=a147_0x5b4142['join'](_0xbabc82,_0x1f42dd(0x1a6)),_0x424acf=a147_0x5b4142[_0x1f42dd(0x1ed)](_0xbabc82,_0x1f42dd(0x1ca)),_0x3639f4=apiExperimentalArtifactToYaml(_0x4cc712),_0x379787=toExperimentalArtifactYamlString(_0x3639f4),_0x2e8713=!a147_0xb9fbad[_0x1f42dd(0x145)](_0xbabc82);let _0x465e25=_0x2e8713,_0x492911,_0x437ead=_0x379787+(_0x1f42dd(0x1a2)+_0x3639f4[_0x1f42dd(0xff)]+'\x0a');const _0x3f167=[..._0x3639f4['files']]['sort']((_0x1550e9,_0x12d414)=>_0x1550e9['file_name'][_0x1f42dd(0x113)](_0x12d414[_0x1f42dd(0x108)]));for(const _0x17cfa0 of _0x3f167){_0x437ead+=_0x1f42dd(0x195)+_0x17cfa0[_0x1f42dd(0x108)]+_0x1f42dd(0x18c)+_0x17cfa0['text_content']+'\x0a';}if(!_0x2e8713){let _0x1f1726='';a147_0xb9fbad[_0x1f42dd(0x145)](_0xc31736)&&(_0x1f1726=a147_0xb9fbad[_0x1f42dd(0xfd)](_0xc31736,_0x1f42dd(0x1bc)));a147_0xb9fbad[_0x1f42dd(0x145)](_0x16b970)&&(_0x1f1726+=_0x1f42dd(0x1a2)+a147_0xb9fbad[_0x1f42dd(0xfd)](_0x16b970,'utf-8')+'\x0a');if(a147_0xb9fbad[_0x1f42dd(0x145)](_0x424acf)){const _0x545ea2=a147_0xb9fbad[_0x1f42dd(0x1b1)](_0x424acf),_0x37d3af=_0x545ea2[_0x1f42dd(0x1f5)](_0x2d381a=>{const _0x7d8c22=_0x1f42dd,_0x40241a=a147_0x5b4142[_0x7d8c22(0x1ed)](_0x424acf,_0x2d381a);return a147_0xb9fbad['statSync'](_0x40241a)[_0x7d8c22(0x1e2)]();})[_0x1f42dd(0x1d3)]((_0x3da5d9,_0x1830a5)=>_0x3da5d9['localeCompare'](_0x1830a5));for(const _0x3e00b4 of _0x37d3af){const _0x231f23=a147_0x5b4142[_0x1f42dd(0x1ed)](_0x424acf,_0x3e00b4);_0x1f1726+=_0x1f42dd(0x195)+_0x3e00b4+_0x1f42dd(0x18c)+a147_0xb9fbad[_0x1f42dd(0xfd)](_0x231f23,'utf-8')+'\x0a';}}const _0xabcff0=generateDiff(_0x1f1726,_0x437ead);_0x465e25=hasChanges(_0xabcff0),_0x465e25&&(_0x492911=formatDiffWithColors(_0xabcff0));}_0x349078[_0x1f42dd(0x151)]({'path':_0xbabc82,'content':'','isDir':!![]}),_0x349078[_0x1f42dd(0x151)]({'path':_0xc31736,'content':_0x379787}),_0x349078[_0x1f42dd(0x151)]({'path':_0x16b970,'content':_0x3639f4[_0x1f42dd(0xff)]});if(_0x3639f4['files'][_0x1f42dd(0x160)]>0x0){_0x349078[_0x1f42dd(0x151)]({'path':_0x424acf,'content':'','isDir':!![]});for(const _0x544d77 of _0x3639f4[_0x1f42dd(0x1ca)]){const _0x501162=a147_0x5b4142['join'](_0x424acf,_0x544d77[_0x1f42dd(0x108)]);_0x349078[_0x1f42dd(0x151)]({'path':_0x501162,'content':_0x544d77[_0x1f42dd(0x19a)]});}}if(a147_0xb9fbad[_0x1f42dd(0x145)](_0x424acf)){const _0x3565d0=a147_0xb9fbad[_0x1f42dd(0x1b1)](_0x424acf),_0x5371d9=new Set(_0x3639f4[_0x1f42dd(0x1ca)]['map'](_0x4b5ea5=>_0x4b5ea5[_0x1f42dd(0x108)]));for(const _0x1bf6a2 of _0x3565d0){const _0x46eb16=a147_0x5b4142[_0x1f42dd(0x1ed)](_0x424acf,_0x1bf6a2);a147_0xb9fbad['statSync'](_0x46eb16)['isFile']()&&!_0x5371d9[_0x1f42dd(0x12a)](_0x1bf6a2)&&_0xaaf52d[_0x1f42dd(0x151)]({'path':_0x46eb16});}}_0x1c303f[_0x1f42dd(0x159)][_0x1f42dd(0x151)]({'name':_0x4cc712[_0x1f42dd(0x193)]['name'],'outputPath':_0xbabc82,'isNew':_0x2e8713,'hasChanges':_0x465e25,'diff':_0x492911}),_0x1c303f[_0x1f42dd(0x1e3)]['experimentalArtifacts']['total']++;if(_0x2e8713)_0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x159)]['new']++;else{if(_0x465e25)_0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x159)][_0x1f42dd(0x11b)]++;else _0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x159)]['unchanged']++;}}for(const _0x45a5e6 of _0x395df2){const _0x300c10=getSanitizedPathWithMigration(getFormInterfacesDir(_0x2a43ec),_0x45a5e6['attributes'][_0x1f42dd(0x1f2)],'.yml');_0x300c10[_0x1f42dd(0x15b)]&&this[_0x1f42dd(0x1d1)][_0x1f42dd(0x180)](_0x1f42dd(0x168)+a147_0x5b4142[_0x1f42dd(0x134)](_0x300c10[_0x1f42dd(0x176)])+_0x1f42dd(0x16c)+a147_0x5b4142['basename'](_0x300c10[_0x1f42dd(0x1bd)]));const _0x28cc7a=_0x300c10[_0x1f42dd(0x1bd)],_0x579ff8=await apiFormInterfaceToYaml(_0x45a5e6,_0x38b1b6),_0x4d2021=toFormInterfaceYamlString(_0x579ff8),_0x3c278f=!a147_0xb9fbad[_0x1f42dd(0x145)](_0x28cc7a);let _0x194760=_0x3c278f,_0x3e4691;if(!_0x3c278f){const _0x2dfb5b=a147_0xb9fbad[_0x1f42dd(0xfd)](_0x28cc7a,_0x1f42dd(0x1bc)),_0x5ae510=generateDiff(_0x2dfb5b,_0x4d2021);_0x194760=hasChanges(_0x5ae510),_0x194760&&(_0x3e4691=formatDiffWithColors(_0x5ae510));}_0x349078['push']({'path':_0x28cc7a,'content':_0x4d2021}),_0x1c303f['formInterfaces']['push']({'name':_0x45a5e6['attributes'][_0x1f42dd(0x1f2)],'outputPath':_0x28cc7a,'isNew':_0x3c278f,'hasChanges':_0x194760,'diff':_0x3e4691}),_0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x15c)][_0x1f42dd(0x1ac)]++;if(_0x3c278f)_0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x15c)]['new']++;else{if(_0x194760)_0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x15c)]['updated']++;else _0x1c303f[_0x1f42dd(0x1e3)][_0x1f42dd(0x15c)]['unchanged']++;}}for(const _0x1a23ae of _0x26323c){if(_0x1a23ae['attributes'][_0x1f42dd(0x1c9)])continue;const _0x324afb=getSanitizedPathWithMigration(getChatInterfacesDir(_0x2a43ec),_0x1a23ae[_0x1f42dd(0x193)][_0x1f42dd(0x1f2)],_0x1f42dd(0x14e));_0x324afb[_0x1f42dd(0x15b)]&&this[_0x1f42dd(0x1d1)][_0x1f42dd(0x180)](_0x1f42dd(0xed)+a147_0x5b4142['basename'](_0x324afb[_0x1f42dd(0x176)])+'\x20→\x20'+a147_0x5b4142[_0x1f42dd(0x134)](_0x324afb[_0x1f42dd(0x1bd)]));const _0x2b420d=_0x324afb[_0x1f42dd(0x1bd)],_0x414862=await apiChatInterfaceToYaml(_0x1a23ae,_0x38b1b6),_0x22df05=toChatInterfaceYamlString(_0x414862),_0x436a8a=!a147_0xb9fbad[_0x1f42dd(0x145)](_0x2b420d);let _0x135267=_0x436a8a,_0xf7adc8;if(!_0x436a8a){const _0x994cb4=a147_0xb9fbad['readFileSync'](_0x2b420d,_0x1f42dd(0x1bc)),_0x3f4399=generateDiff(_0x994cb4,_0x22df05);_0x135267=hasChanges(_0x3f4399),_0x135267&&(_0xf7adc8=formatDiffWithColors(_0x3f4399));}_0x349078[_0x1f42dd(0x151)]({'path':_0x2b420d,'content':_0x22df05}),_0x1c303f[_0x1f42dd(0x11c)][_0x1f42dd(0x151)]({'name':_0x1a23ae[_0x1f42dd(0x193)][_0x1f42dd(0x1f2)],'outputPath':_0x2b420d,'isNew':_0x436a8a,'hasChanges':_0x135267,'diff':_0xf7adc8}),_0x1c303f['counts'][_0x1f42dd(0x11c)][_0x1f42dd(0x1ac)]++;if(_0x436a8a)_0x1c303f['counts']['chatInterfaces'][_0x1f42dd(0x1b3)]++;else{if(_0x135267)_0x1c303f[_0x1f42dd(0x1e3)]['chatInterfaces'][_0x1f42dd(0x11b)]++;else _0x1c303f['counts']['chatInterfaces'][_0x1f42dd(0xe8)]++;}}if(_0x201ede?.[_0x1f42dd(0x1ff)])return _0x1c303f;a147_0xb9fbad[_0x1f42dd(0x173)](_0x2a43ec,{'recursive':!![]}),a147_0xb9fbad['mkdirSync'](getKnowledgeBasesDir(_0x2a43ec),{'recursive':!![]}),a147_0xb9fbad[_0x1f42dd(0x173)](getPromptsDir(_0x2a43ec),{'recursive':!![]}),a147_0xb9fbad[_0x1f42dd(0x173)](getIntegrationsDir(_0x2a43ec),{'recursive':!![]}),a147_0xb9fbad['mkdirSync'](getExperimentalKnowledgeBasesDir(_0x2a43ec),{'recursive':!![]}),a147_0xb9fbad[_0x1f42dd(0x173)](getExperimentalArtifactsDir(_0x2a43ec),{'recursive':!![]}),a147_0xb9fbad['mkdirSync'](getFormInterfacesDir(_0x2a43ec),{'recursive':!![]}),a147_0xb9fbad[_0x1f42dd(0x173)](getChatInterfacesDir(_0x2a43ec),{'recursive':!![]});const _0x2d480d=a147_0x5b4142[_0x1f42dd(0x1ed)](_0x2a43ec,_0x1f42dd(0x1a1));a147_0xb9fbad[_0x1f42dd(0x100)](_0x2d480d,createAgentConfigContent(_0x3ae0cd));for(const _0x438e24 of _0x349078){if(_0x438e24[_0x1f42dd(0x143)])a147_0xb9fbad[_0x1f42dd(0x173)](_0x438e24[_0x1f42dd(0x1bd)],{'recursive':!![]});else{const _0x2101cf=a147_0x5b4142[_0x1f42dd(0x1db)](_0x438e24[_0x1f42dd(0x1bd)]);!a147_0xb9fbad[_0x1f42dd(0x145)](_0x2101cf)&&a147_0xb9fbad[_0x1f42dd(0x173)](_0x2101cf,{'recursive':!![]}),a147_0xb9fbad[_0x1f42dd(0x100)](_0x438e24['path'],_0x438e24[_0x1f42dd(0x156)]);}}for(const _0xd64ac9 of _0xaaf52d){_0xd64ac9[_0x1f42dd(0x143)]?(a147_0xb9fbad[_0x1f42dd(0x1f0)](_0xd64ac9[_0x1f42dd(0x1bd)],{'recursive':!![],'force':!![]}),this[_0x1f42dd(0x1d1)][_0x1f42dd(0x180)](_0x1f42dd(0x1cf)+a147_0x5b4142[_0x1f42dd(0x134)](a147_0x5b4142[_0x1f42dd(0x1db)](_0xd64ac9[_0x1f42dd(0x1bd)]))+'/'+a147_0x5b4142[_0x1f42dd(0x134)](_0xd64ac9[_0x1f42dd(0x1bd)]))):(a147_0xb9fbad['rmSync'](_0xd64ac9[_0x1f42dd(0x1bd)],{'force':!![]}),this[_0x1f42dd(0x1d1)][_0x1f42dd(0x180)](_0x1f42dd(0x13b)+a147_0x5b4142[_0x1f42dd(0x134)](a147_0x5b4142[_0x1f42dd(0x1db)](_0xd64ac9[_0x1f42dd(0x1bd)]))+'/'+a147_0x5b4142[_0x1f42dd(0x134)](_0xd64ac9[_0x1f42dd(0x1bd)])));}return _0x1c303f;}async[a147_0xd3e41f(0x150)](_0x228146,_0x1865e0){const _0x1990a8=a147_0xd3e41f,_0x1db7f8=a147_0x5b4142[_0x1990a8(0x1ed)](_0x228146,_0x1990a8(0x1a1));if(!a147_0xb9fbad[_0x1990a8(0x145)](_0x1db7f8))throw new SDKError(ErrorCode[_0x1990a8(0x201)],_0x1990a8(0x16f)+_0x228146,undefined,{'helpText':_0x1990a8(0x163)});const _0x43fc41=loadAgentConfig(_0x1db7f8),_0x42a912=await this[_0x1990a8(0x1b6)](_0x43fc41[_0x1990a8(0x107)]),_0x40b198=await this[_0x1990a8(0x179)][_0x1990a8(0x175)](_0x42a912),_0xa38617=_0x40b198['attributes'][_0x1990a8(0x1f2)],_0x1f18a0={'projectName':_0xa38617,'projectId':_0x42a912,'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}}},_0x2c4d52=[],_0x503465=[],_0x4aadad=[],_0x3eb24c=[],_0x3542d6=[],_0x5b8045=[],_0x5d2c44=a147_0xb9fbad['readdirSync'](_0x228146,{'withFileTypes':!![]});for(const _0x1cafce of _0x5d2c44){if(!_0x1cafce[_0x1990a8(0xfa)]())continue;if(['knowledge_bases','prompts','integrations','experimental_knowledge_bases',_0x1990a8(0x194),'form_interfaces',_0x1990a8(0x1cd)][_0x1990a8(0x104)](_0x1cafce['name']))continue;const _0x31ef67=a147_0x5b4142[_0x1990a8(0x1ed)](_0x228146,_0x1cafce[_0x1990a8(0x1f2)]);if(isAgentDir(_0x31ef67)){const _0x4621a1=a147_0x5b4142[_0x1990a8(0x1ed)](_0x31ef67,_0x1990a8(0x1ad)),_0x272445=a147_0x5b4142['join'](_0x31ef67,'prompt.md'),_0x548ecf=a147_0x5b4142[_0x1990a8(0x1ed)](_0x31ef67,_0x1990a8(0x1b4)),_0x389a2b=parseAgentYaml(a147_0xb9fbad[_0x1990a8(0xfd)](_0x4621a1,_0x1990a8(0x1bc)),_0x4621a1),_0x2a4d53=a147_0xb9fbad['existsSync'](_0x272445)?a147_0xb9fbad[_0x1990a8(0xfd)](_0x272445,'utf-8'):'',_0x16ff78=a147_0xb9fbad[_0x1990a8(0x145)](_0x548ecf)?a147_0xb9fbad[_0x1990a8(0xfd)](_0x548ecf,'utf-8'):_0x389a2b[_0x1990a8(0x11f)];_0x2c4d52['push']({'name':_0x389a2b[_0x1990a8(0x1f2)],'dir':_0x31ef67,'yaml':_0x389a2b,'systemPrompt':_0x2a4d53,'starterMessage':_0x16ff78});}}const _0x1d81fd=getKnowledgeBasesDir(_0x228146);if(a147_0xb9fbad['existsSync'](_0x1d81fd)){const _0x23e6b5=a147_0xb9fbad[_0x1990a8(0x1b1)](_0x1d81fd);for(const _0x4b0049 of _0x23e6b5){const _0x34460a=a147_0x5b4142[_0x1990a8(0x1ed)](_0x1d81fd,_0x4b0049);if(_0x4b0049[_0x1990a8(0x1fb)](_0x1990a8(0x14e))){const _0x4d7090=parseKnowledgeBaseYaml(a147_0xb9fbad[_0x1990a8(0xfd)](_0x34460a,_0x1990a8(0x1bc)),_0x34460a);_0x503465[_0x1990a8(0x151)]({'name':_0x4d7090[_0x1990a8(0x1f2)],'path':_0x34460a,'yaml':_0x4d7090});}else{if(_0x4b0049['endsWith'](_0x1990a8(0xe6))){const _0x3cc85c=a147_0xb9fbad[_0x1990a8(0xfd)](_0x34460a,'utf-8'),{name:_0x32d061,text:_0x1592f7}=parseTextKnowledgeBaseMd(_0x3cc85c,_0x4b0049);_0x4aadad[_0x1990a8(0x151)]({'name':_0x32d061,'path':_0x34460a,'text':_0x1592f7});}}}}const _0x36600d=getPromptsDir(_0x228146);if(a147_0xb9fbad[_0x1990a8(0x145)](_0x36600d)){const _0x405291=a147_0xb9fbad[_0x1990a8(0x1b1)](_0x36600d)['filter'](_0x123f91=>_0x123f91['endsWith'](_0x1990a8(0x14e)));for(const _0x1a8f51 of _0x405291){const _0x4b620d=a147_0x5b4142[_0x1990a8(0x1ed)](_0x36600d,_0x1a8f51),_0x5826e8=parsePromptYaml(a147_0xb9fbad['readFileSync'](_0x4b620d,_0x1990a8(0x1bc)),_0x4b620d);_0x3eb24c[_0x1990a8(0x151)]({'name':_0x5826e8[_0x1990a8(0x1f2)],'path':_0x4b620d,'yaml':_0x5826e8});}}const _0x28e0db=[],_0x294256=getIntegrationsDir(_0x228146);if(a147_0xb9fbad[_0x1990a8(0x145)](_0x294256)){const _0x4044df=a147_0xb9fbad[_0x1990a8(0x1b1)](_0x294256)[_0x1990a8(0x1f5)](_0x560b61=>_0x560b61['endsWith'](_0x1990a8(0x14e)));for(const _0x160536 of _0x4044df){const _0x6a9919=a147_0x5b4142[_0x1990a8(0x1ed)](_0x294256,_0x160536),_0x4904e9=parseIntegrationYaml(a147_0xb9fbad['readFileSync'](_0x6a9919,'utf-8'),_0x6a9919);if(!SAFE_INTEGRATION_TYPES[_0x1990a8(0x104)](_0x4904e9[_0x1990a8(0x19b)][_0x1990a8(0x19f)]())){this[_0x1990a8(0x1d1)]['warn']('Skipping\x20integration\x20\x27'+_0x4904e9['name']+_0x1990a8(0x1ba)+_0x4904e9[_0x1990a8(0x19b)]+'):\x20'+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x1990a8(0x1ef))+_0x1990a8(0x19d));continue;}_0x28e0db[_0x1990a8(0x151)]({'name':_0x4904e9[_0x1990a8(0x1f2)],'path':_0x6a9919,'yaml':_0x4904e9});}}const _0x4a8bf0=getExperimentalKnowledgeBasesDir(_0x228146);if(a147_0xb9fbad['existsSync'](_0x4a8bf0)){const _0x45dfab=a147_0xb9fbad[_0x1990a8(0x1b1)](_0x4a8bf0,{'withFileTypes':!![]});for(const _0x1912fc of _0x45dfab){if(!_0x1912fc['isDirectory']())continue;const _0x2d2343=a147_0x5b4142[_0x1990a8(0x1ed)](_0x4a8bf0,_0x1912fc[_0x1990a8(0x1f2)]),_0x52c284=a147_0x5b4142['join'](_0x2d2343,_0x1912fc[_0x1990a8(0x1f2)]+_0x1990a8(0x14e)),_0x5c0269=a147_0x5b4142[_0x1990a8(0x1ed)](_0x2d2343,_0x1990a8(0x1ab));if(!a147_0xb9fbad[_0x1990a8(0x145)](_0x52c284))continue;const _0x1bc151=parseExperimentalKnowledgeBaseYaml(a147_0xb9fbad[_0x1990a8(0xfd)](_0x52c284,'utf-8'),_0x52c284),_0x389f6d=[];if(a147_0xb9fbad[_0x1990a8(0x145)](_0x5c0269)){const _0x1d9e71=a147_0xb9fbad[_0x1990a8(0x1b1)](_0x5c0269,{'withFileTypes':!![]});for(const _0x5ea1b6 of _0x1d9e71){if(!_0x5ea1b6['isDirectory']())continue;const _0x574919=a147_0x5b4142[_0x1990a8(0x1ed)](_0x5c0269,_0x5ea1b6[_0x1990a8(0x1f2)]),_0x1be893=a147_0x5b4142['join'](_0x574919,_0x1990a8(0x1a6)),_0x36bb99=a147_0x5b4142['join'](_0x574919,'json_schema.json');a147_0xb9fbad[_0x1990a8(0x145)](_0x1be893)&&a147_0xb9fbad[_0x1990a8(0x145)](_0x36bb99)&&_0x389f6d[_0x1990a8(0x151)]({'name':_0x5ea1b6[_0x1990a8(0x1f2)],'code':a147_0xb9fbad['readFileSync'](_0x1be893,_0x1990a8(0x1bc)),'json_schema':a147_0xb9fbad['readFileSync'](_0x36bb99,_0x1990a8(0x1bc))});}}const _0x169572={..._0x1bc151,'variables':_0x1bc151['variables']||[],'functions':_0x389f6d};_0x3542d6[_0x1990a8(0x151)]({'name':_0x1bc151[_0x1990a8(0x1f2)],'dir':_0x2d2343,'def':_0x169572});}}const _0x342c45=getExperimentalArtifactsDir(_0x228146);if(a147_0xb9fbad[_0x1990a8(0x145)](_0x342c45)){const _0x2f34ac=a147_0xb9fbad['readdirSync'](_0x342c45,{'withFileTypes':!![]});for(const _0x486f80 of _0x2f34ac){if(!_0x486f80[_0x1990a8(0xfa)]())continue;const _0x1f3cab=a147_0x5b4142['join'](_0x342c45,_0x486f80[_0x1990a8(0x1f2)]),_0x590dda=a147_0x5b4142['join'](_0x1f3cab,_0x486f80[_0x1990a8(0x1f2)]+'.yml'),_0x488316=a147_0x5b4142[_0x1990a8(0x1ed)](_0x1f3cab,_0x1990a8(0x1a6)),_0x4f112f=a147_0x5b4142[_0x1990a8(0x1ed)](_0x1f3cab,_0x1990a8(0x1ca));if(!a147_0xb9fbad[_0x1990a8(0x145)](_0x590dda)||!a147_0xb9fbad['existsSync'](_0x488316))continue;const _0x4430d8=parseExperimentalArtifactYaml(a147_0xb9fbad['readFileSync'](_0x590dda,_0x1990a8(0x1bc)),_0x590dda),_0x8dd9de=a147_0xb9fbad[_0x1990a8(0xfd)](_0x488316,_0x1990a8(0x1bc)),_0x2f06db=[];if(a147_0xb9fbad[_0x1990a8(0x145)](_0x4f112f)){const _0x4b6e68=a147_0xb9fbad['readdirSync'](_0x4f112f);for(const _0x213eb5 of _0x4b6e68){const _0x1e41f9=a147_0x5b4142['join'](_0x4f112f,_0x213eb5);a147_0xb9fbad[_0x1990a8(0x1c1)](_0x1e41f9)['isFile']()&&_0x2f06db[_0x1990a8(0x151)]({'file_name':_0x213eb5,'text_content':a147_0xb9fbad[_0x1990a8(0xfd)](_0x1e41f9,_0x1990a8(0x1bc))});}}const _0x1a7b56={..._0x4430d8,'code':_0x8dd9de,'files':_0x2f06db};_0x5b8045[_0x1990a8(0x151)]({'name':_0x4430d8[_0x1990a8(0x1f2)],'dir':_0x1f3cab,'def':_0x1a7b56});}}const _0x151f86=[],_0x4bd846=getFormInterfacesDir(_0x228146);if(a147_0xb9fbad[_0x1990a8(0x145)](_0x4bd846)){const _0x2cbffc=a147_0xb9fbad[_0x1990a8(0x1b1)](_0x4bd846)[_0x1990a8(0x1f5)](_0x218dea=>_0x218dea['endsWith'](_0x1990a8(0x14e)));for(const _0x597163 of _0x2cbffc){const _0x144c64=a147_0x5b4142[_0x1990a8(0x1ed)](_0x4bd846,_0x597163),_0x5e1709=parseFormInterfaceYaml(a147_0xb9fbad['readFileSync'](_0x144c64,_0x1990a8(0x1bc)),_0x144c64);_0x151f86['push']({'name':_0x5e1709['name'],'path':_0x144c64,'yaml':_0x5e1709});}}const _0x1faf23=[],_0x1d116d=getChatInterfacesDir(_0x228146);if(a147_0xb9fbad[_0x1990a8(0x145)](_0x1d116d)){const _0x327b42=a147_0xb9fbad[_0x1990a8(0x1b1)](_0x1d116d)['filter'](_0x47e162=>_0x47e162[_0x1990a8(0x1fb)](_0x1990a8(0x14e)));for(const _0x4b4aed of _0x327b42){const _0x496668=a147_0x5b4142[_0x1990a8(0x1ed)](_0x1d116d,_0x4b4aed),_0x244db0=parseChatInterfaceYaml(a147_0xb9fbad[_0x1990a8(0xfd)](_0x496668,'utf-8'),_0x496668);_0x1faf23[_0x1990a8(0x151)]({'name':_0x244db0[_0x1990a8(0x1f2)],'path':_0x496668,'yaml':_0x244db0});}}const _0x358c27=await this['client'][_0x1990a8(0x188)](_0x42a912),_0x2a2fc1=await this[_0x1990a8(0x179)][_0x1990a8(0x153)](_0x42a912),_0xa010d4=await this[_0x1990a8(0x179)][_0x1990a8(0x157)](_0x42a912),_0x57d684=await this[_0x1990a8(0x179)]['listPrompts'](_0x42a912),_0x3657a1=await this[_0x1990a8(0x179)][_0x1990a8(0x146)](_0x42a912),_0x3c9019=await safeListOrEmpty(()=>this['client']['listExperimentalKnowledgeBases'](_0x42a912)),_0x5cb70e=await safeListOrEmpty(()=>this[_0x1990a8(0x179)]['listExperimentalArtifacts'](_0x42a912)),_0x44956a=await safeListOrEmpty(()=>this[_0x1990a8(0x179)][_0x1990a8(0x1d5)](_0x42a912)),_0x1cb8ca=await safeListOrEmpty(()=>this[_0x1990a8(0x179)][_0x1990a8(0x124)](_0x42a912)),_0x4833c7=await fetchAllToolTargetMaps((_0x318da1,_0x150e43)=>this[_0x1990a8(0x179)][_0x1990a8(0x1cb)](_0x318da1,_0x150e43),_0x42a912),_0x5a1101=new Map(),_0x37b443=new Map(),_0x2326e9=new Map(),_0x3dffdf=new Map(),_0x2d7970=new Map(),_0x4801e6=new Map(),_0x294596=new Map();for(const _0x152496 of _0x358c27){_0x5a1101[_0x1990a8(0x1df)](_0x152496['attributes']['name'],_0x152496);}for(const _0x49b41d of _0x2a2fc1){_0x37b443['set'](_0x49b41d[_0x1990a8(0x193)][_0x1990a8(0x1f2)],_0x49b41d);}for(const _0x323b74 of _0xa010d4){_0x2326e9[_0x1990a8(0x1df)](_0x323b74[_0x1990a8(0x193)]['name'],_0x323b74);}for(const _0x1e5b1a of _0x57d684){_0x3dffdf[_0x1990a8(0x1df)](_0x1e5b1a[_0x1990a8(0x193)][_0x1990a8(0x1f2)],_0x1e5b1a);}for(const _0x583806 of _0x3657a1){_0x2d7970[_0x1990a8(0x1df)](_0x583806[_0x1990a8(0x193)][_0x1990a8(0x14b)][_0x1990a8(0x19f)](),_0x583806);}for(const _0x4f3590 of _0x3c9019){_0x4801e6[_0x1990a8(0x1df)](_0x4f3590[_0x1990a8(0x193)][_0x1990a8(0x1f2)],_0x4f3590);}for(const _0xde7bd5 of _0x5cb70e){_0x294596[_0x1990a8(0x1df)](_0xde7bd5['attributes'][_0x1990a8(0x1f2)],_0xde7bd5);}const _0xbc6ceb=new Map(),_0x49db05=new Map();for(const _0x3d77bf of _0x44956a){_0xbc6ceb[_0x1990a8(0x1df)](_0x3d77bf[_0x1990a8(0x193)][_0x1990a8(0x1f2)],_0x3d77bf);}for(const _0x284e8c of _0x1cb8ca){_0x49db05['set'](_0x284e8c[_0x1990a8(0x193)][_0x1990a8(0x1f2)],_0x284e8c);}const _0x3e5847=new Map(),_0x4c8669=new Map();for(const _0xb1b699 of _0x358c27){_0x3e5847[_0x1990a8(0x1df)](_0xb1b699[_0x1990a8(0x193)][_0x1990a8(0x1f2)],_0xb1b699['id']),_0x4c8669[_0x1990a8(0x1df)](_0xb1b699['id'],_0xb1b699[_0x1990a8(0x193)][_0x1990a8(0x1f2)]);}const _0x33c664=new Map(),_0x30075d=new Map();for(const _0x2f570d of _0x57d684){_0x33c664['set'](_0x2f570d[_0x1990a8(0x193)]['name'],_0x2f570d['id']),_0x30075d[_0x1990a8(0x1df)](_0x2f570d['id'],_0x2f570d['attributes'][_0x1990a8(0x1f2)]);}const _0x3568bf=_0x4833c7['nameToId'][_0x1990a8(0x129)]||new Map(),_0x236089=_0x4833c7[_0x1990a8(0x1a0)]['TextKnowledgeBase']||new Map(),_0x48cd6e=_0x4833c7['nameToId'][_0x1990a8(0x128)]||new Map(),_0x47cf8c=new Map(),_0x417e95={'resolveToolTargetName':buildNameResolver({..._0x4833c7[_0x1990a8(0x1fc)],'Agent':_0x4c8669}),'resolvePromptName':async _0x39bb0e=>_0x30075d['get'](_0x39bb0e),'onWarning':_0x3559bc=>this['logger'][_0x1990a8(0x16d)](_0x3559bc)};let _0x16f2fe=[];const _0x307f65={'projectId':_0x42a912,'resolveToolTargetId':buildIdResolver({..._0x4833c7[_0x1990a8(0x1a0)],'Agent':_0x3e5847}),'resolvePromptId':async _0xd4bbb0=>_0x33c664['get'](_0xd4bbb0),'onWarning':_0x4979d3=>{const _0x547807=_0x1990a8;this[_0x547807(0x1d1)]['warn'](_0x4979d3),_0x16f2fe[_0x547807(0x151)](_0x4979d3);}},{resolved:_0x104436,unresolved:_0x4147bc}=resolveAgentDependencies(_0x2c4d52,new Set(_0x5a1101['keys']()));for(const {agent:_0x519e37,missingDeps:_0xf5ecc1}of _0x4147bc){_0x1f18a0[_0x1990a8(0x1e1)]['push']({'agentName':_0x519e37['yaml'][_0x1990a8(0x1f2)],'action':'error','error':_0x1990a8(0x1d9)+_0xf5ecc1[_0x1990a8(0x1ed)](',\x20')+_0x1990a8(0x125)}),_0x1f18a0['counts'][_0x1990a8(0x1e1)][_0x1990a8(0x132)]++;}for(const _0x1655a4 of _0x503465){const _0x7df023=_0x37b443[_0x1990a8(0x198)](_0x1655a4[_0x1990a8(0x170)]['name']),_0x3b197c=a147_0xb9fbad[_0x1990a8(0xfd)](_0x1655a4[_0x1990a8(0x1bd)],_0x1990a8(0x1bc));if(_0x7df023){const _0x74e924=apiKnowledgeBaseToYaml(_0x7df023),_0x1070c0=toKnowledgeBaseYamlString(_0x74e924),_0x3a478a=generateDiff(_0x1070c0,_0x3b197c),_0x159802=hasChanges(_0x3a478a);_0x159802?(_0x1f18a0[_0x1990a8(0x1d6)]['push']({'name':_0x1655a4[_0x1990a8(0x170)][_0x1990a8(0x1f2)],'action':'updated','id':_0x7df023['id'],'diff':formatDiffWithColors(_0x3a478a)}),_0x1f18a0['counts'][_0x1990a8(0x1d6)][_0x1990a8(0x11b)]++):(_0x1f18a0['knowledgeBases'][_0x1990a8(0x151)]({'name':_0x1655a4[_0x1990a8(0x170)][_0x1990a8(0x1f2)],'action':_0x1990a8(0xe8),'id':_0x7df023['id']}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x1d6)]['unchanged']++);}else _0x1f18a0['knowledgeBases'][_0x1990a8(0x151)]({'name':_0x1655a4[_0x1990a8(0x170)]['name'],'action':_0x1990a8(0xe3)}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x1d6)][_0x1990a8(0xe3)]++;}for(const _0x4b20fe of _0x4aadad){const _0x55dd78=_0x2326e9[_0x1990a8(0x198)](_0x4b20fe[_0x1990a8(0x1f2)]),_0xa2ee38=a147_0xb9fbad['readFileSync'](_0x4b20fe[_0x1990a8(0x1bd)],_0x1990a8(0x1bc));if(_0x55dd78){const _0x6f0443=toTextKnowledgeBaseMd(_0x55dd78[_0x1990a8(0x193)][_0x1990a8(0x1f2)],_0x55dd78[_0x1990a8(0x193)][_0x1990a8(0x1c8)]),_0xad7a66=generateDiff(_0x6f0443,_0xa2ee38),_0x3645f9=hasChanges(_0xad7a66);_0x3645f9?(_0x1f18a0[_0x1990a8(0xf4)][_0x1990a8(0x151)]({'name':_0x4b20fe[_0x1990a8(0x1f2)],'action':_0x1990a8(0x11b),'id':_0x55dd78['id'],'diff':formatDiffWithColors(_0xad7a66)}),_0x1f18a0['counts']['textKnowledgeBases'][_0x1990a8(0x11b)]++):(_0x1f18a0[_0x1990a8(0xf4)][_0x1990a8(0x151)]({'name':_0x4b20fe[_0x1990a8(0x1f2)],'action':_0x1990a8(0xe8),'id':_0x55dd78['id']}),_0x1f18a0['counts'][_0x1990a8(0xf4)][_0x1990a8(0xe8)]++);}else _0x1f18a0[_0x1990a8(0xf4)][_0x1990a8(0x151)]({'name':_0x4b20fe['name'],'action':'created'}),_0x1f18a0['counts']['textKnowledgeBases'][_0x1990a8(0xe3)]++;}for(const _0x526908 of _0x104436){const _0x1560e8=_0x5a1101[_0x1990a8(0x198)](_0x526908[_0x1990a8(0x170)][_0x1990a8(0x1f2)]),_0x2f5836=a147_0x5b4142['join'](_0x526908['dir'],'agent.yml'),_0x3ce6e4=a147_0xb9fbad['readFileSync'](_0x2f5836,_0x1990a8(0x1bc)),_0x32dd36=_0x526908[_0x1990a8(0xf1)],_0x1c9dcf=_0x1990a8(0xf2)+_0x32dd36+'\x0a\x0a#\x20agent.yml\x0a'+_0x3ce6e4;if(_0x1560e8){const {yaml:_0xd0b16d,systemPrompt:_0xe14470}=await agentResponseToDef(_0x1560e8,_0x417e95),_0x35b735=toAgentYamlString(_0xd0b16d),_0x3ee479=_0x1990a8(0xf2)+_0xe14470+_0x1990a8(0x14a)+_0x35b735,_0x2ff3b8=generateDiff(_0x3ee479,_0x1c9dcf),_0x58c16f=hasChanges(_0x2ff3b8);_0x58c16f?(_0x1f18a0[_0x1990a8(0x1e1)][_0x1990a8(0x151)]({'agentName':_0x526908[_0x1990a8(0x170)][_0x1990a8(0x1f2)],'action':_0x1990a8(0x11b),'agentId':_0x1560e8['id'],'diff':formatDiffWithColors(_0x2ff3b8)}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x1e1)][_0x1990a8(0x11b)]++):(_0x1f18a0[_0x1990a8(0x1e1)]['push']({'agentName':_0x526908[_0x1990a8(0x170)][_0x1990a8(0x1f2)],'action':_0x1990a8(0xe8),'agentId':_0x1560e8['id']}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x1e1)][_0x1990a8(0xe8)]++);}else _0x1f18a0[_0x1990a8(0x1e1)]['push']({'agentName':_0x526908[_0x1990a8(0x170)]['name'],'action':_0x1990a8(0xe3)}),_0x1f18a0[_0x1990a8(0x1e3)]['agents'][_0x1990a8(0xe3)]++;}for(const _0x49acc3 of _0x3eb24c){const _0x364947=_0x3dffdf[_0x1990a8(0x198)](_0x49acc3['yaml'][_0x1990a8(0x1f2)]),_0x151661=a147_0xb9fbad[_0x1990a8(0xfd)](_0x49acc3[_0x1990a8(0x1bd)],'utf-8');if(_0x364947){const _0x16caa7=await apiPromptToYaml(_0x364947,_0x417e95);if(!_0x16caa7){_0x1f18a0[_0x1990a8(0x1dd)][_0x1990a8(0x151)]({'name':_0x49acc3[_0x1990a8(0x170)]['name'],'action':_0x1990a8(0x11b),'id':_0x364947['id']}),_0x1f18a0[_0x1990a8(0x1e3)]['prompts'][_0x1990a8(0x11b)]++;continue;}const _0x152336=toPromptYamlString(_0x16caa7),_0x11e459=generateDiff(_0x152336,_0x151661),_0x4289e4=hasChanges(_0x11e459);_0x4289e4?(_0x1f18a0[_0x1990a8(0x1dd)][_0x1990a8(0x151)]({'name':_0x49acc3[_0x1990a8(0x170)][_0x1990a8(0x1f2)],'action':_0x1990a8(0x11b),'id':_0x364947['id'],'diff':formatDiffWithColors(_0x11e459)}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x1dd)]['updated']++):(_0x1f18a0[_0x1990a8(0x1dd)]['push']({'name':_0x49acc3[_0x1990a8(0x170)][_0x1990a8(0x1f2)],'action':_0x1990a8(0xe8),'id':_0x364947['id']}),_0x1f18a0['counts'][_0x1990a8(0x1dd)]['unchanged']++);}else _0x1f18a0['prompts'][_0x1990a8(0x151)]({'name':_0x49acc3[_0x1990a8(0x170)][_0x1990a8(0x1f2)],'action':_0x1990a8(0xe3)}),_0x1f18a0[_0x1990a8(0x1e3)]['prompts'][_0x1990a8(0xe3)]++;}for(const _0x5b90a0 of _0x28e0db){const _0x126af8=_0x2d7970[_0x1990a8(0x198)](_0x5b90a0[_0x1990a8(0x170)][_0x1990a8(0x19b)]),_0xa6cac1=a147_0xb9fbad[_0x1990a8(0xfd)](_0x5b90a0[_0x1990a8(0x1bd)],_0x1990a8(0x1bc));if(_0x126af8){const _0x2775d9=await apiIntegrationToYaml(_0x126af8,_0x417e95),_0x12b31a=toIntegrationYamlString(_0x2775d9),_0x1f91bf=generateDiff(_0x12b31a,_0xa6cac1),_0x4466a8=hasChanges(_0x1f91bf);_0x4466a8?(_0x1f18a0['integrations'][_0x1990a8(0x151)]({'name':_0x5b90a0[_0x1990a8(0x170)]['service_type'],'action':_0x1990a8(0x11b),'id':_0x126af8['id'],'diff':formatDiffWithColors(_0x1f91bf)}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x18d)][_0x1990a8(0x11b)]++):(_0x1f18a0[_0x1990a8(0x18d)][_0x1990a8(0x151)]({'name':_0x5b90a0[_0x1990a8(0x170)]['service_type'],'action':_0x1990a8(0xe8),'id':_0x126af8['id']}),_0x1f18a0['counts'][_0x1990a8(0x18d)][_0x1990a8(0xe8)]++);}else _0x1f18a0['integrations']['push']({'name':_0x5b90a0['yaml'][_0x1990a8(0x19b)],'action':_0x1990a8(0xe3)}),_0x1f18a0[_0x1990a8(0x1e3)]['integrations'][_0x1990a8(0xe3)]++;}for(const _0x57db57 of _0x3542d6){const _0x23d1d8=_0x4801e6[_0x1990a8(0x198)](_0x57db57['def'][_0x1990a8(0x1f2)]),_0x56a515=toExperimentalKnowledgeBaseYamlString(_0x57db57[_0x1990a8(0xf8)]);let _0x4f43a4=_0x56a515;for(const _0x57ab44 of _0x57db57[_0x1990a8(0xf8)]['functions']){_0x4f43a4+=_0x1990a8(0xee)+_0x57ab44[_0x1990a8(0x1f2)]+_0x1990a8(0x18c)+_0x57ab44[_0x1990a8(0xff)]+_0x1990a8(0x12f)+_0x57ab44[_0x1990a8(0x1f2)]+_0x1990a8(0x18c)+_0x57ab44[_0x1990a8(0x19e)]+'\x0a';}if(_0x23d1d8){const _0x4b0ee6=apiExperimentalKnowledgeBaseToYaml(_0x23d1d8),_0x37a062=toExperimentalKnowledgeBaseYamlString(_0x4b0ee6);let _0x3ce7e9=_0x37a062;for(const _0x549e79 of _0x4b0ee6[_0x1990a8(0x1ab)]){_0x3ce7e9+=_0x1990a8(0xee)+_0x549e79[_0x1990a8(0x1f2)]+_0x1990a8(0x18c)+_0x549e79[_0x1990a8(0xff)]+_0x1990a8(0x12f)+_0x549e79[_0x1990a8(0x1f2)]+_0x1990a8(0x18c)+_0x549e79[_0x1990a8(0x19e)]+'\x0a';}const _0x14415c=generateDiff(_0x3ce7e9,_0x4f43a4),_0x16552b=hasChanges(_0x14415c);_0x16552b?(_0x1f18a0['experimentalKnowledgeBases'][_0x1990a8(0x151)]({'name':_0x57db57[_0x1990a8(0xf8)][_0x1990a8(0x1f2)],'action':_0x1990a8(0x11b),'id':_0x23d1d8['id'],'diff':formatDiffWithColors(_0x14415c)}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x182)][_0x1990a8(0x11b)]++):(_0x1f18a0[_0x1990a8(0x182)][_0x1990a8(0x151)]({'name':_0x57db57['def']['name'],'action':_0x1990a8(0xe8),'id':_0x23d1d8['id']}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x182)]['unchanged']++);}else _0x1f18a0[_0x1990a8(0x182)][_0x1990a8(0x151)]({'name':_0x57db57[_0x1990a8(0xf8)][_0x1990a8(0x1f2)],'action':_0x1990a8(0xe3)}),_0x1f18a0['counts'][_0x1990a8(0x182)][_0x1990a8(0xe3)]++;}for(const _0x56367f of _0x5b8045){const _0x45345f=_0x294596[_0x1990a8(0x198)](_0x56367f[_0x1990a8(0xf8)]['name']),_0x19694d=toExperimentalArtifactYamlString(_0x56367f[_0x1990a8(0xf8)]);let _0x46457c=_0x19694d+('\x0a---\x20code\x20---\x0a'+_0x56367f[_0x1990a8(0xf8)][_0x1990a8(0xff)]+'\x0a');for(const _0x2081fc of _0x56367f[_0x1990a8(0xf8)]['files']){_0x46457c+=_0x1990a8(0x195)+_0x2081fc[_0x1990a8(0x108)]+_0x1990a8(0x18c)+_0x2081fc[_0x1990a8(0x19a)]+'\x0a';}if(_0x45345f){const _0x22ccb6=apiExperimentalArtifactToYaml(_0x45345f),_0x134ecf=toExperimentalArtifactYamlString(_0x22ccb6);let _0x3e2e07=_0x134ecf+(_0x1990a8(0x1a2)+_0x22ccb6[_0x1990a8(0xff)]+'\x0a');for(const _0x1d7230 of _0x22ccb6[_0x1990a8(0x1ca)]){_0x3e2e07+=_0x1990a8(0x195)+_0x1d7230[_0x1990a8(0x108)]+_0x1990a8(0x18c)+_0x1d7230['text_content']+'\x0a';}const _0x4d9fea=generateDiff(_0x3e2e07,_0x46457c),_0x3f04d0=hasChanges(_0x4d9fea);_0x3f04d0?(_0x1f18a0['experimentalArtifacts']['push']({'name':_0x56367f[_0x1990a8(0xf8)]['name'],'action':_0x1990a8(0x11b),'id':_0x45345f['id'],'diff':formatDiffWithColors(_0x4d9fea)}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x159)]['updated']++):(_0x1f18a0['experimentalArtifacts']['push']({'name':_0x56367f[_0x1990a8(0xf8)]['name'],'action':_0x1990a8(0xe8),'id':_0x45345f['id']}),_0x1f18a0['counts']['experimentalArtifacts'][_0x1990a8(0xe8)]++);}else _0x1f18a0[_0x1990a8(0x159)][_0x1990a8(0x151)]({'name':_0x56367f[_0x1990a8(0xf8)]['name'],'action':'created'}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x159)][_0x1990a8(0xe3)]++;}for(const _0x1c1f14 of _0x151f86){const _0x38e1fe=_0xbc6ceb[_0x1990a8(0x198)](_0x1c1f14['yaml'][_0x1990a8(0x1f2)]),_0x4345ba=a147_0xb9fbad[_0x1990a8(0xfd)](_0x1c1f14[_0x1990a8(0x1bd)],'utf-8');if(_0x38e1fe){const _0x4860cd=await apiFormInterfaceToYaml(_0x38e1fe,_0x417e95),_0x15b165=toFormInterfaceYamlString(_0x4860cd),_0x52851f=generateDiff(_0x15b165,_0x4345ba),_0xa4b696=hasChanges(_0x52851f);_0xa4b696?(_0x1f18a0[_0x1990a8(0x15c)][_0x1990a8(0x151)]({'name':_0x1c1f14['yaml'][_0x1990a8(0x1f2)],'action':'updated','id':_0x38e1fe['id'],'diff':formatDiffWithColors(_0x52851f)}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x15c)][_0x1990a8(0x11b)]++):(_0x1f18a0[_0x1990a8(0x15c)]['push']({'name':_0x1c1f14[_0x1990a8(0x170)][_0x1990a8(0x1f2)],'action':_0x1990a8(0xe8),'id':_0x38e1fe['id']}),_0x1f18a0[_0x1990a8(0x1e3)]['formInterfaces'][_0x1990a8(0xe8)]++);}else _0x1f18a0[_0x1990a8(0x15c)]['push']({'name':_0x1c1f14[_0x1990a8(0x170)]['name'],'action':_0x1990a8(0xe3)}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x15c)]['created']++;}for(const _0x2f2b1d of _0x1faf23){const _0xfc7ffb=_0x49db05[_0x1990a8(0x198)](_0x2f2b1d[_0x1990a8(0x170)][_0x1990a8(0x1f2)]),_0x3f0eb0=a147_0xb9fbad['readFileSync'](_0x2f2b1d[_0x1990a8(0x1bd)],'utf-8');if(_0xfc7ffb){const _0x4f1670=await apiChatInterfaceToYaml(_0xfc7ffb,_0x417e95),_0xbf7da8=toChatInterfaceYamlString(_0x4f1670),_0x2e9880=generateDiff(_0xbf7da8,_0x3f0eb0),_0xd1a14d=hasChanges(_0x2e9880);_0xd1a14d?(_0x1f18a0['chatInterfaces']['push']({'name':_0x2f2b1d['yaml'][_0x1990a8(0x1f2)],'action':_0x1990a8(0x11b),'id':_0xfc7ffb['id'],'diff':formatDiffWithColors(_0x2e9880)}),_0x1f18a0['counts'][_0x1990a8(0x11c)][_0x1990a8(0x11b)]++):(_0x1f18a0[_0x1990a8(0x11c)][_0x1990a8(0x151)]({'name':_0x2f2b1d[_0x1990a8(0x170)][_0x1990a8(0x1f2)],'action':'unchanged','id':_0xfc7ffb['id']}),_0x1f18a0[_0x1990a8(0x1e3)]['chatInterfaces']['unchanged']++);}else _0x1f18a0[_0x1990a8(0x11c)][_0x1990a8(0x151)]({'name':_0x2f2b1d[_0x1990a8(0x170)][_0x1990a8(0x1f2)],'action':_0x1990a8(0xe3)}),_0x1f18a0['counts'][_0x1990a8(0x11c)][_0x1990a8(0xe3)]++;}if(_0x1865e0?.[_0x1990a8(0x1ff)])return _0x1f18a0;_0x1f18a0[_0x1990a8(0x1d6)]=[],_0x1f18a0['textKnowledgeBases']=[],_0x1f18a0['prompts']=[],_0x1f18a0['integrations']=[],_0x1f18a0['experimentalKnowledgeBases']=[],_0x1f18a0['experimentalArtifacts']=[],_0x1f18a0['formInterfaces']=[],_0x1f18a0[_0x1990a8(0x11c)]=[];const _0x59abf5=_0x1f18a0[_0x1990a8(0x1e1)][_0x1990a8(0x1f5)](_0x5c34bb=>_0x5c34bb[_0x1990a8(0x149)]==='error');_0x1f18a0['agents']=_0x59abf5,_0x1f18a0[_0x1990a8(0x1e3)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x59abf5[_0x1990a8(0x160)]},'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 _0x51a7ba of _0x503465){try{const _0x23f6cb=_0x37b443[_0x1990a8(0x198)](_0x51a7ba[_0x1990a8(0x170)][_0x1990a8(0x1f2)]),_0x32b9e5=yamlKnowledgeBaseToApi(_0x51a7ba[_0x1990a8(0x170)],_0x42a912);if(_0x23f6cb)await this['client']['updateKnowledgeBase'](_0x23f6cb['id'],_0x32b9e5),_0x3568bf['set'](_0x51a7ba[_0x1990a8(0x170)][_0x1990a8(0x1f2)],_0x23f6cb['id']),_0x1f18a0[_0x1990a8(0x1d6)][_0x1990a8(0x151)]({'name':_0x51a7ba['yaml']['name'],'action':_0x1990a8(0x11b),'id':_0x23f6cb['id']}),_0x1f18a0[_0x1990a8(0x1e3)]['knowledgeBases'][_0x1990a8(0x11b)]++;else{const _0x2d752f=await this[_0x1990a8(0x179)][_0x1990a8(0x1dc)](_0x32b9e5);_0x3568bf[_0x1990a8(0x1df)](_0x51a7ba[_0x1990a8(0x170)]['name'],_0x2d752f['id']),_0x1f18a0[_0x1990a8(0x1d6)]['push']({'name':_0x51a7ba['yaml'][_0x1990a8(0x1f2)],'action':'created','id':_0x2d752f['id']}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x1d6)]['created']++;}}catch(_0x44c229){_0x1f18a0[_0x1990a8(0x1d6)][_0x1990a8(0x151)]({'name':_0x51a7ba[_0x1990a8(0x170)]['name'],'action':_0x1990a8(0x130),'error':_0x44c229[_0x1990a8(0x17e)]}),_0x1f18a0[_0x1990a8(0x1e3)]['knowledgeBases'][_0x1990a8(0x132)]++;}}for(const _0x116386 of _0x4aadad){try{const _0x1fb7a6=_0x2326e9[_0x1990a8(0x198)](_0x116386[_0x1990a8(0x1f2)]),_0x3c2b1f=yamlTextKnowledgeBaseToApi({'name':_0x116386[_0x1990a8(0x1f2)],'text':_0x116386[_0x1990a8(0x1c8)]},_0x42a912);if(_0x1fb7a6)await this[_0x1990a8(0x179)][_0x1990a8(0x106)](_0x1fb7a6['id'],_0x3c2b1f),_0x236089[_0x1990a8(0x1df)](_0x116386[_0x1990a8(0x1f2)],_0x1fb7a6['id']),_0x1f18a0[_0x1990a8(0xf4)][_0x1990a8(0x151)]({'name':_0x116386[_0x1990a8(0x1f2)],'action':_0x1990a8(0x11b),'id':_0x1fb7a6['id']}),_0x1f18a0[_0x1990a8(0x1e3)]['textKnowledgeBases'][_0x1990a8(0x11b)]++;else{const _0x1ceb91=await this[_0x1990a8(0x179)]['createTextKnowledgeBase'](_0x3c2b1f);_0x236089[_0x1990a8(0x1df)](_0x116386[_0x1990a8(0x1f2)],_0x1ceb91['id']),_0x1f18a0[_0x1990a8(0xf4)][_0x1990a8(0x151)]({'name':_0x116386[_0x1990a8(0x1f2)],'action':_0x1990a8(0xe3),'id':_0x1ceb91['id']}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0xf4)]['created']++;}}catch(_0x22897c){_0x1f18a0[_0x1990a8(0xf4)][_0x1990a8(0x151)]({'name':_0x116386[_0x1990a8(0x1f2)],'action':'error','error':_0x22897c[_0x1990a8(0x17e)]}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0xf4)][_0x1990a8(0x132)]++;}}for(const _0x487b98 of _0x3542d6){try{const _0x20aec4=_0x4801e6[_0x1990a8(0x198)](_0x487b98[_0x1990a8(0xf8)][_0x1990a8(0x1f2)]),_0x37e740=yamlExperimentalKnowledgeBaseToApi(_0x487b98[_0x1990a8(0xf8)],_0x42a912);if(_0x20aec4)await this[_0x1990a8(0x179)][_0x1990a8(0x19c)](_0x20aec4['id'],_0x37e740),_0x48cd6e['set'](_0x487b98['def']['name'],_0x20aec4['id']),_0x1f18a0[_0x1990a8(0x182)]['push']({'name':_0x487b98[_0x1990a8(0xf8)]['name'],'action':_0x1990a8(0x11b),'id':_0x20aec4['id']}),_0x1f18a0[_0x1990a8(0x1e3)]['experimentalKnowledgeBases'][_0x1990a8(0x11b)]++;else{const _0x4d1954=await this[_0x1990a8(0x179)][_0x1990a8(0x1a8)](_0x37e740);_0x48cd6e[_0x1990a8(0x1df)](_0x487b98['def'][_0x1990a8(0x1f2)],_0x4d1954['id']),_0x1f18a0[_0x1990a8(0x182)]['push']({'name':_0x487b98[_0x1990a8(0xf8)]['name'],'action':'created','id':_0x4d1954['id']}),_0x1f18a0[_0x1990a8(0x1e3)]['experimentalKnowledgeBases'][_0x1990a8(0xe3)]++;}}catch(_0x23379f){_0x1f18a0[_0x1990a8(0x182)]['push']({'name':_0x487b98['def'][_0x1990a8(0x1f2)],'action':'error','error':_0x23379f[_0x1990a8(0x17e)]}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x182)][_0x1990a8(0x132)]++;}}for(const _0x18cd67 of _0x5b8045){try{const _0x6b14c=_0x294596[_0x1990a8(0x198)](_0x18cd67[_0x1990a8(0xf8)][_0x1990a8(0x1f2)]),_0xf25768=yamlExperimentalArtifactToApi(_0x18cd67[_0x1990a8(0xf8)],_0x42a912);if(_0x6b14c)await this['client'][_0x1990a8(0xf6)](_0x6b14c['id'],_0xf25768),_0x47cf8c[_0x1990a8(0x1df)](_0x18cd67[_0x1990a8(0xf8)][_0x1990a8(0x1f2)],_0x6b14c['id']),_0x1f18a0[_0x1990a8(0x159)]['push']({'name':_0x18cd67['def'][_0x1990a8(0x1f2)],'action':_0x1990a8(0x11b),'id':_0x6b14c['id']}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x159)][_0x1990a8(0x11b)]++;else{const _0x54f6eb=await this[_0x1990a8(0x179)][_0x1990a8(0x1ee)](_0xf25768);_0x47cf8c['set'](_0x18cd67[_0x1990a8(0xf8)][_0x1990a8(0x1f2)],_0x54f6eb['id']),_0x1f18a0[_0x1990a8(0x159)]['push']({'name':_0x18cd67['def'][_0x1990a8(0x1f2)],'action':'created','id':_0x54f6eb['id']}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x159)][_0x1990a8(0xe3)]++;}}catch(_0x41b884){_0x1f18a0[_0x1990a8(0x159)][_0x1990a8(0x151)]({'name':_0x18cd67[_0x1990a8(0xf8)][_0x1990a8(0x1f2)],'action':_0x1990a8(0x130),'error':_0x41b884[_0x1990a8(0x17e)]}),_0x1f18a0['counts']['experimentalArtifacts'][_0x1990a8(0x132)]++;}}for(const _0x397f32 of _0x104436){_0x16f2fe=[];try{const _0xf5af5d=_0x5a1101[_0x1990a8(0x198)](_0x397f32[_0x1990a8(0x170)]['name']),_0x3646e1=await agentDefToRequest(_0x397f32[_0x1990a8(0x170)],_0x397f32[_0x1990a8(0xf1)],_0x397f32[_0x1990a8(0x137)],_0x307f65);if(_0xf5af5d)await this['client'][_0x1990a8(0x105)](_0xf5af5d['id'],_0x3646e1),_0x3e5847[_0x1990a8(0x1df)](_0x397f32[_0x1990a8(0x170)][_0x1990a8(0x1f2)],_0xf5af5d['id']),_0x1f18a0[_0x1990a8(0x1e1)][_0x1990a8(0x151)]({'agentName':_0x397f32[_0x1990a8(0x170)]['name'],'action':_0x1990a8(0x11b),'agentId':_0xf5af5d['id'],'warnings':_0x16f2fe[_0x1990a8(0x160)]>0x0?_0x16f2fe:undefined}),_0x1f18a0['counts'][_0x1990a8(0x1e1)][_0x1990a8(0x11b)]++;else{const _0x29d1e2=await this[_0x1990a8(0x179)][_0x1990a8(0x154)](_0x3646e1);_0x3e5847[_0x1990a8(0x1df)](_0x397f32[_0x1990a8(0x170)][_0x1990a8(0x1f2)],_0x29d1e2['id']),_0x1f18a0[_0x1990a8(0x1e1)][_0x1990a8(0x151)]({'agentName':_0x397f32['yaml'][_0x1990a8(0x1f2)],'action':_0x1990a8(0xe3),'agentId':_0x29d1e2['id'],'warnings':_0x16f2fe['length']>0x0?_0x16f2fe:undefined}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x1e1)][_0x1990a8(0xe3)]++;}}catch(_0x34b2e5){_0x1f18a0[_0x1990a8(0x1e1)]['push']({'agentName':_0x397f32['yaml']['name'],'action':_0x1990a8(0x130),'error':_0x34b2e5[_0x1990a8(0x17e)],'warnings':_0x16f2fe['length']>0x0?_0x16f2fe:undefined}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x1e1)][_0x1990a8(0x132)]++;}}for(const _0x409440 of _0x3eb24c){try{const _0x28ed43=_0x3dffdf[_0x1990a8(0x198)](_0x409440[_0x1990a8(0x170)][_0x1990a8(0x1f2)]),_0x2e7d6b=await yamlPromptToApi(_0x409440[_0x1990a8(0x170)],_0x42a912,_0x307f65);if(!_0x2e7d6b){_0x1f18a0[_0x1990a8(0x1dd)]['push']({'name':_0x409440[_0x1990a8(0x170)][_0x1990a8(0x1f2)],'action':_0x1990a8(0x130),'error':_0x1990a8(0x1d8)}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x1dd)][_0x1990a8(0x132)]++;continue;}if(_0x28ed43)await this[_0x1990a8(0x179)]['updatePrompt'](_0x28ed43['id'],_0x2e7d6b),_0x33c664[_0x1990a8(0x1df)](_0x409440[_0x1990a8(0x170)][_0x1990a8(0x1f2)],_0x28ed43['id']),_0x1f18a0[_0x1990a8(0x1dd)][_0x1990a8(0x151)]({'name':_0x409440[_0x1990a8(0x170)][_0x1990a8(0x1f2)],'action':_0x1990a8(0x11b),'id':_0x28ed43['id']}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x1dd)][_0x1990a8(0x11b)]++;else{const _0x551840=await this[_0x1990a8(0x179)][_0x1990a8(0x1ea)](_0x2e7d6b);_0x33c664['set'](_0x409440[_0x1990a8(0x170)][_0x1990a8(0x1f2)],_0x551840['id']),_0x1f18a0[_0x1990a8(0x1dd)][_0x1990a8(0x151)]({'name':_0x409440[_0x1990a8(0x170)]['name'],'action':'created','id':_0x551840['id']}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x1dd)]['created']++;}}catch(_0x381fc0){_0x1f18a0[_0x1990a8(0x1dd)][_0x1990a8(0x151)]({'name':_0x409440[_0x1990a8(0x170)][_0x1990a8(0x1f2)],'action':'error','error':_0x381fc0[_0x1990a8(0x17e)]}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x1dd)][_0x1990a8(0x132)]++;}}for(const _0x3c5cce of _0x28e0db){try{const _0x17080a=_0x2d7970[_0x1990a8(0x198)](_0x3c5cce[_0x1990a8(0x170)][_0x1990a8(0x19b)]),_0x39144f=await yamlIntegrationToApi(_0x3c5cce['yaml'],_0x42a912,_0x307f65);if(_0x17080a){await this[_0x1990a8(0x179)]['deleteIntegration'](_0x17080a['id']);const _0x38c711=await this['client']['createIntegration'](_0x39144f);_0x1f18a0[_0x1990a8(0x18d)][_0x1990a8(0x151)]({'name':_0x3c5cce[_0x1990a8(0x170)]['service_type'],'action':_0x1990a8(0x11b),'id':_0x38c711['id']}),_0x1f18a0['counts']['integrations']['updated']++;}else{const _0x296abf=await this[_0x1990a8(0x179)][_0x1990a8(0x1de)](_0x39144f);_0x1f18a0[_0x1990a8(0x18d)][_0x1990a8(0x151)]({'name':_0x3c5cce['yaml'][_0x1990a8(0x19b)],'action':_0x1990a8(0xe3),'id':_0x296abf['id']}),_0x1f18a0[_0x1990a8(0x1e3)]['integrations'][_0x1990a8(0xe3)]++;}}catch(_0x2bab96){_0x1f18a0[_0x1990a8(0x18d)][_0x1990a8(0x151)]({'name':_0x3c5cce[_0x1990a8(0x170)][_0x1990a8(0x19b)],'action':'error','error':_0x2bab96[_0x1990a8(0x17e)]}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x18d)][_0x1990a8(0x132)]++;}}for(const _0x9cc816 of _0x151f86){try{const _0x5d45a5=_0xbc6ceb[_0x1990a8(0x198)](_0x9cc816[_0x1990a8(0x170)][_0x1990a8(0x1f2)]),_0x48f11b=await yamlFormInterfaceToApi(_0x9cc816[_0x1990a8(0x170)],_0x42a912,_0x307f65);if(!_0x48f11b){_0x1f18a0['formInterfaces'][_0x1990a8(0x151)]({'name':_0x9cc816[_0x1990a8(0x170)][_0x1990a8(0x1f2)],'action':_0x1990a8(0x130),'error':_0x1990a8(0x1b8)}),_0x1f18a0['counts']['formInterfaces'][_0x1990a8(0x132)]++;continue;}if(_0x5d45a5){const _0x3da5b1=await this[_0x1990a8(0x179)][_0x1990a8(0x136)](_0x5d45a5['id'],_0x48f11b);_0x1f18a0[_0x1990a8(0x15c)][_0x1990a8(0x151)]({'name':_0x9cc816['yaml']['name'],'action':_0x1990a8(0x11b),'id':_0x3da5b1['id']}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x15c)][_0x1990a8(0x11b)]++;}else{const _0x40032f=await this[_0x1990a8(0x179)][_0x1990a8(0x189)](_0x48f11b);_0x1f18a0[_0x1990a8(0x15c)][_0x1990a8(0x151)]({'name':_0x9cc816[_0x1990a8(0x170)]['name'],'action':_0x1990a8(0xe3),'id':_0x40032f['id']}),_0x1f18a0[_0x1990a8(0x1e3)]['formInterfaces'][_0x1990a8(0xe3)]++;}}catch(_0x7ecfac){_0x1f18a0[_0x1990a8(0x15c)][_0x1990a8(0x151)]({'name':_0x9cc816[_0x1990a8(0x170)]['name'],'action':_0x1990a8(0x130),'error':_0x7ecfac[_0x1990a8(0x17e)]}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x15c)][_0x1990a8(0x132)]++;}}for(const _0x2d89e9 of _0x1faf23){try{const _0x30328d=_0x49db05[_0x1990a8(0x198)](_0x2d89e9[_0x1990a8(0x170)][_0x1990a8(0x1f2)]),_0x531e1a=await yamlChatInterfaceToApi(_0x2d89e9[_0x1990a8(0x170)],_0x42a912,_0x307f65);if(_0x30328d){const _0x24314e=await this['client'][_0x1990a8(0x177)](_0x30328d['id'],_0x531e1a);_0x1f18a0[_0x1990a8(0x11c)][_0x1990a8(0x151)]({'name':_0x2d89e9[_0x1990a8(0x170)][_0x1990a8(0x1f2)],'action':'updated','id':_0x24314e['id']}),_0x1f18a0[_0x1990a8(0x1e3)]['chatInterfaces'][_0x1990a8(0x11b)]++;}else{const _0xf54803=await this[_0x1990a8(0x179)][_0x1990a8(0x1f3)](_0x531e1a);_0x1f18a0['chatInterfaces'][_0x1990a8(0x151)]({'name':_0x2d89e9[_0x1990a8(0x170)]['name'],'action':_0x1990a8(0xe3),'id':_0xf54803['id']}),_0x1f18a0[_0x1990a8(0x1e3)][_0x1990a8(0x11c)][_0x1990a8(0xe3)]++;}}catch(_0x25cfb){_0x1f18a0[_0x1990a8(0x11c)][_0x1990a8(0x151)]({'name':_0x2d89e9[_0x1990a8(0x170)][_0x1990a8(0x1f2)],'action':'error','error':_0x25cfb[_0x1990a8(0x17e)]}),_0x1f18a0[_0x1990a8(0x1e3)]['chatInterfaces'][_0x1990a8(0x132)]++;}}return _0x1f18a0;}async[a147_0xd3e41f(0x190)](_0x55772a,_0x5a2ddb,_0x2fbf1f,_0x393397){const _0x1c8c45=a147_0xd3e41f,{projectId:_0x418688,project:_0x51202b}=await this[_0x1c8c45(0xe1)](_0x55772a),_0x812a72=_0x51202b['attributes'][_0x1c8c45(0x1f2)],_0x5f49e6=await this['client'][_0x1c8c45(0x188)](_0x418688),_0x37eee0=_0x5f49e6[_0x1c8c45(0x12c)](_0x1864da=>_0x1864da['attributes'][_0x1c8c45(0x1f2)]===_0x5a2ddb);if(!_0x37eee0)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x1c8c45(0x166)+_0x5a2ddb,undefined,{'helpText':_0x1c8c45(0x115)+_0x5f49e6[_0x1c8c45(0x11d)](_0x29e41f=>_0x29e41f['attributes'][_0x1c8c45(0x1f2)])['join'](',\x20')});let _0x439db8;if(_0x2fbf1f)_0x439db8=_0x2fbf1f;else{const _0x44e3e8=a147_0x5b4142[_0x1c8c45(0x1ed)](process[_0x1c8c45(0x1da)](),_0x1c8c45(0x1e1)),_0x5a5c4e=getSanitizedPathWithMigration(_0x44e3e8,_0x812a72);_0x5a5c4e[_0x1c8c45(0x15b)]&&this['logger'][_0x1c8c45(0x180)]('Renamed\x20folder:\x20'+a147_0x5b4142['basename'](_0x5a5c4e['oldPath'])+_0x1c8c45(0x16c)+a147_0x5b4142[_0x1c8c45(0x134)](_0x5a5c4e['path'])),_0x439db8=_0x5a5c4e[_0x1c8c45(0x1bd)];}const _0x46bdfe=getSanitizedPathWithMigration(_0x439db8,_0x5a2ddb);_0x46bdfe[_0x1c8c45(0x15b)]&&this[_0x1c8c45(0x1d1)]['info']('Renamed\x20agent\x20folder:\x20'+a147_0x5b4142[_0x1c8c45(0x134)](_0x46bdfe[_0x1c8c45(0x176)])+_0x1c8c45(0x16c)+a147_0x5b4142['basename'](_0x46bdfe['path']));const _0x4ec6ed=_0x46bdfe[_0x1c8c45(0x1bd)],_0x455c4a=new Map(),_0x2c9d7b=new Map(),_0x3a9911=await this['client'][_0x1c8c45(0x153)](_0x418688),_0x2f5bc4=await this['client']['listTextKnowledgeBases'](_0x418688),_0x181ecd=await safeListOrEmpty(()=>this[_0x1c8c45(0x179)][_0x1c8c45(0x116)](_0x418688)),_0x7d10ac=new Map(),_0x3e919b=new Map();for(const _0x559038 of _0x3a9911){_0x455c4a[_0x1c8c45(0x1df)](_0x559038['id'],_0x559038[_0x1c8c45(0x193)][_0x1c8c45(0x1f2)]);}for(const _0x810748 of _0x2f5bc4){_0x7d10ac[_0x1c8c45(0x1df)](_0x810748['id'],_0x810748[_0x1c8c45(0x193)][_0x1c8c45(0x1f2)]);}for(const _0x5485a5 of _0x181ecd){_0x3e919b['set'](_0x5485a5['id'],_0x5485a5[_0x1c8c45(0x193)][_0x1c8c45(0x1f2)]);}for(const _0x2f1c62 of _0x5f49e6){_0x2c9d7b[_0x1c8c45(0x1df)](_0x2f1c62['id'],_0x2f1c62[_0x1c8c45(0x193)][_0x1c8c45(0x1f2)]);}const _0x5bd7e9={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x455c4a,'TextKnowledgeBase':_0x7d10ac,'Agent':_0x2c9d7b,'ExperimentalKnowledgeBase':_0x3e919b}),'resolvePromptName':async()=>undefined,'onWarning':_0x191841=>this[_0x1c8c45(0x1d1)][_0x1c8c45(0x16d)](_0x191841)},_0x400301=a147_0x5b4142[_0x1c8c45(0x1ed)](_0x4ec6ed,_0x1c8c45(0xe7)),_0x3eec40=a147_0x5b4142[_0x1c8c45(0x1ed)](_0x4ec6ed,_0x1c8c45(0x1ad)),_0x450913=a147_0x5b4142[_0x1c8c45(0x1ed)](_0x4ec6ed,'starter_message.md'),_0x5ba8d6=!a147_0xb9fbad['existsSync'](_0x3eec40);if(_0x393397?.['dryRun'])return{'agentName':_0x5a2ddb,'outputPath':_0x4ec6ed,'isNew':_0x5ba8d6,'hasChanges':!![]};a147_0xb9fbad['mkdirSync'](_0x439db8,{'recursive':!![]}),a147_0xb9fbad[_0x1c8c45(0x173)](_0x4ec6ed,{'recursive':!![]});const _0x39b268=a147_0x5b4142['join'](_0x439db8,_0x1c8c45(0x1a1));!a147_0xb9fbad['existsSync'](_0x39b268)&&a147_0xb9fbad[_0x1c8c45(0x100)](_0x39b268,createAgentConfigContent(_0x55772a));const {yaml:_0x4234f4,systemPrompt:_0xb71f90,starterMessage:_0x4ac60a}=await agentResponseToDef(_0x37eee0,_0x5bd7e9);let _0x563fa3=_0x5ba8d6;if(!_0x5ba8d6){const _0x22ca7d=a147_0xb9fbad['existsSync'](_0x400301)?a147_0xb9fbad[_0x1c8c45(0xfd)](_0x400301,_0x1c8c45(0x1bc)):'',_0x5ab821=a147_0xb9fbad['readFileSync'](_0x3eec40,'utf-8');_0x563fa3=_0x22ca7d!==_0xb71f90||_0x5ab821!==toAgentYamlString(_0x4234f4);}a147_0xb9fbad[_0x1c8c45(0x100)](_0x400301,_0xb71f90),a147_0xb9fbad['writeFileSync'](_0x3eec40,toAgentYamlString(_0x4234f4));if(_0x4ac60a&&_0x4ac60a['includes']('\x0a'))a147_0xb9fbad[_0x1c8c45(0x100)](_0x450913,_0x4ac60a);else a147_0xb9fbad[_0x1c8c45(0x145)](_0x450913)&&a147_0xb9fbad[_0x1c8c45(0x199)](_0x450913);return{'agentName':_0x5a2ddb,'outputPath':_0x4ec6ed,'isNew':_0x5ba8d6,'hasChanges':_0x563fa3};}async[a147_0xd3e41f(0x127)](_0x2fb8d8,_0x112590){const _0x14c41c=a147_0xd3e41f;let _0x49c499;isAgentYamlPath(_0x2fb8d8)?_0x49c499=getAgentDirFromYamlPath(_0x2fb8d8):_0x49c499=_0x2fb8d8;const {config:_0x606fb3}=findAgentConfig(_0x49c499),_0x1b1210=await this[_0x14c41c(0x1b6)](_0x606fb3[_0x14c41c(0x107)]),_0xbb91e=a147_0x5b4142[_0x14c41c(0x1ed)](_0x49c499,_0x14c41c(0x1ad)),_0x2733d1=a147_0x5b4142[_0x14c41c(0x1ed)](_0x49c499,_0x14c41c(0xe7)),_0x3db267=a147_0x5b4142[_0x14c41c(0x1ed)](_0x49c499,_0x14c41c(0x1b4));if(!a147_0xb9fbad[_0x14c41c(0x145)](_0xbb91e))throw new SDKError(ErrorCode[_0x14c41c(0xeb)],_0x14c41c(0x1c4)+_0x49c499,undefined,{'helpText':'Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.'});const _0xca8860=parseAgentYaml(a147_0xb9fbad[_0x14c41c(0xfd)](_0xbb91e,_0x14c41c(0x1bc)),_0xbb91e),_0x5c589c=a147_0xb9fbad[_0x14c41c(0x145)](_0x2733d1)?a147_0xb9fbad[_0x14c41c(0xfd)](_0x2733d1,_0x14c41c(0x1bc)):'',_0x207990=a147_0xb9fbad[_0x14c41c(0x145)](_0x3db267)?a147_0xb9fbad['readFileSync'](_0x3db267,_0x14c41c(0x1bc)):_0xca8860[_0x14c41c(0x11f)];if(_0x112590?.[_0x14c41c(0x1ff)])return{'agentName':_0xca8860['name'],'action':'created','projectId':_0x1b1210};const _0x249436=await this['client'][_0x14c41c(0x188)](_0x1b1210),_0x445c4f=await fetchAllToolTargetMaps((_0x26744c,_0x198777)=>this[_0x14c41c(0x179)][_0x14c41c(0x1cb)](_0x26744c,_0x198777),_0x1b1210),_0x242ba3=new Map();for(const _0x8db024 of _0x249436){_0x242ba3[_0x14c41c(0x1df)](_0x8db024[_0x14c41c(0x193)][_0x14c41c(0x1f2)],_0x8db024['id']);}const _0x16dbb2=[],_0x166cce={'projectId':_0x1b1210,'resolveToolTargetId':buildIdResolver({..._0x445c4f[_0x14c41c(0x1a0)],'Agent':_0x242ba3}),'resolvePromptId':async()=>undefined,'onWarning':_0x2d54b2=>{const _0x3b1e14=_0x14c41c;this[_0x3b1e14(0x1d1)]['warn'](_0x2d54b2),_0x16dbb2['push'](_0x2d54b2);}};try{const _0x487daf=_0x249436[_0x14c41c(0x12c)](_0x150b67=>_0x150b67[_0x14c41c(0x193)][_0x14c41c(0x1f2)]===_0xca8860[_0x14c41c(0x1f2)]),_0x5054e7=await agentDefToRequest(_0xca8860,_0x5c589c,_0x207990,_0x166cce);if(_0x487daf)return await this[_0x14c41c(0x179)][_0x14c41c(0x105)](_0x487daf['id'],_0x5054e7),{'agentName':_0xca8860[_0x14c41c(0x1f2)],'action':_0x14c41c(0x11b),'projectId':_0x1b1210,'agentId':_0x487daf['id'],'warnings':_0x16dbb2[_0x14c41c(0x160)]>0x0?_0x16dbb2:undefined};else{const _0x24100f=await this[_0x14c41c(0x179)][_0x14c41c(0x154)](_0x5054e7);return{'agentName':_0xca8860[_0x14c41c(0x1f2)],'action':_0x14c41c(0xe3),'projectId':_0x1b1210,'agentId':_0x24100f['id'],'warnings':_0x16dbb2[_0x14c41c(0x160)]>0x0?_0x16dbb2:undefined};}}catch(_0x6f7861){return{'agentName':_0xca8860[_0x14c41c(0x1f2)],'action':_0x14c41c(0x130),'projectId':_0x1b1210,'error':_0x6f7861[_0x14c41c(0x17e)],'warnings':_0x16dbb2[_0x14c41c(0x160)]>0x0?_0x16dbb2:undefined};}}async[a147_0xd3e41f(0x114)](_0x31d61a,_0x49cb93,_0x2003aa){const _0x3d8a8d=a147_0xd3e41f,_0x446775=a147_0xb9fbad[_0x3d8a8d(0x145)](_0x31d61a)&&a147_0xb9fbad[_0x3d8a8d(0x145)](a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x31d61a,_0x3d8a8d(0x1a1)));let _0x126415;const _0x4d3eae=[],_0x47e931=[],_0x34c3e5=[],_0x279e3=[],_0x294e95=[],_0x13460d=[],_0x282acd=[],_0x4694a1=[],_0x2197eb=[];if(_0x446775){const _0x5666cf=loadAgentConfig(a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x31d61a,'tdx.json'));_0x126415=_0x5666cf['llm_project'];const _0xe0b8af=a147_0xb9fbad[_0x3d8a8d(0x1b1)](_0x31d61a,{'withFileTypes':!![]});for(const _0x53a810 of _0xe0b8af){if(!_0x53a810[_0x3d8a8d(0xfa)]())continue;if([_0x3d8a8d(0x169),_0x3d8a8d(0x12b),'experimental_artifacts',_0x3d8a8d(0x1dd),'integrations',_0x3d8a8d(0x1b5),_0x3d8a8d(0x1cd)][_0x3d8a8d(0x104)](_0x53a810[_0x3d8a8d(0x1f2)]))continue;const _0x5a6852=a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x31d61a,_0x53a810[_0x3d8a8d(0x1f2)]);if(isAgentDir(_0x5a6852)){const _0x4baf77=a147_0x5b4142['join'](_0x5a6852,_0x3d8a8d(0x1ad)),_0x1f87cb=a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x5a6852,_0x3d8a8d(0xe7)),_0x1b7672=a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x5a6852,_0x3d8a8d(0x1b4)),_0x4fdf21=parseAgentYaml(a147_0xb9fbad[_0x3d8a8d(0xfd)](_0x4baf77,_0x3d8a8d(0x1bc)),_0x4baf77),_0x20a00a=a147_0xb9fbad[_0x3d8a8d(0x145)](_0x1f87cb)?a147_0xb9fbad['readFileSync'](_0x1f87cb,_0x3d8a8d(0x1bc)):'',_0x155b93=a147_0xb9fbad[_0x3d8a8d(0x145)](_0x1b7672)?a147_0xb9fbad[_0x3d8a8d(0xfd)](_0x1b7672,_0x3d8a8d(0x1bc)):_0x4fdf21[_0x3d8a8d(0x11f)];_0x4d3eae['push']({'name':_0x4fdf21[_0x3d8a8d(0x1f2)],'dir':_0x5a6852,'yaml':_0x4fdf21,'systemPrompt':_0x20a00a,'starterMessage':_0x155b93});}}const _0x57a875=getKnowledgeBasesDir(_0x31d61a);if(a147_0xb9fbad[_0x3d8a8d(0x145)](_0x57a875)){const _0x35b09e=a147_0xb9fbad[_0x3d8a8d(0x1b1)](_0x57a875);for(const _0x2c9b76 of _0x35b09e){const _0x5ddd5a=a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x57a875,_0x2c9b76);if(_0x2c9b76['endsWith'](_0x3d8a8d(0x14e))){const _0x578200=parseKnowledgeBaseYaml(a147_0xb9fbad[_0x3d8a8d(0xfd)](_0x5ddd5a,_0x3d8a8d(0x1bc)),_0x5ddd5a);_0x47e931['push']({'name':_0x578200[_0x3d8a8d(0x1f2)],'path':_0x5ddd5a,'yaml':_0x578200});}else{if(_0x2c9b76[_0x3d8a8d(0x1fb)](_0x3d8a8d(0xe6))){const _0x4897c6=a147_0xb9fbad['readFileSync'](_0x5ddd5a,_0x3d8a8d(0x1bc)),{name:_0x5172a5,text:_0x2f334e}=parseTextKnowledgeBaseMd(_0x4897c6,_0x2c9b76);_0x34c3e5['push']({'name':_0x5172a5,'path':_0x5ddd5a,'text':_0x2f334e});}}}}const _0x7b792e=getPromptsDir(_0x31d61a);if(a147_0xb9fbad[_0x3d8a8d(0x145)](_0x7b792e)){const _0x2bbccb=a147_0xb9fbad[_0x3d8a8d(0x1b1)](_0x7b792e)[_0x3d8a8d(0x1f5)](_0x37b1f6=>_0x37b1f6['endsWith'](_0x3d8a8d(0x14e)));for(const _0x543cbe of _0x2bbccb){const _0x1cfefb=a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x7b792e,_0x543cbe),_0x323c53=parsePromptYaml(a147_0xb9fbad[_0x3d8a8d(0xfd)](_0x1cfefb,_0x3d8a8d(0x1bc)),_0x1cfefb);_0x279e3[_0x3d8a8d(0x151)]({'name':_0x323c53['name'],'path':_0x1cfefb,'yaml':_0x323c53});}}const _0x154c2e=getIntegrationsDir(_0x31d61a);if(a147_0xb9fbad[_0x3d8a8d(0x145)](_0x154c2e)){const _0x1096a8=a147_0xb9fbad[_0x3d8a8d(0x1b1)](_0x154c2e)[_0x3d8a8d(0x1f5)](_0x464f6d=>_0x464f6d['endsWith'](_0x3d8a8d(0x14e)));for(const _0x4a9f13 of _0x1096a8){const _0x5c1dcf=a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x154c2e,_0x4a9f13),_0x47861e=parseIntegrationYaml(a147_0xb9fbad[_0x3d8a8d(0xfd)](_0x5c1dcf,_0x3d8a8d(0x1bc)),_0x5c1dcf);SAFE_INTEGRATION_TYPES[_0x3d8a8d(0x104)](_0x47861e[_0x3d8a8d(0x19b)][_0x3d8a8d(0x19f)]())?_0x294e95[_0x3d8a8d(0x151)]({'name':_0x47861e[_0x3d8a8d(0x1f2)],'path':_0x5c1dcf,'yaml':_0x47861e}):this['logger'][_0x3d8a8d(0x16d)](_0x3d8a8d(0x13c)+_0x47861e[_0x3d8a8d(0x1f2)]+_0x3d8a8d(0x1ba)+_0x47861e[_0x3d8a8d(0x19b)]+_0x3d8a8d(0x120)+(_0x3d8a8d(0x18e)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x3d8a8d(0x1f8)));}}const _0x5b4923=getExperimentalKnowledgeBasesDir(_0x31d61a);if(a147_0xb9fbad[_0x3d8a8d(0x145)](_0x5b4923)){const _0x4514c7=a147_0xb9fbad['readdirSync'](_0x5b4923,{'withFileTypes':!![]});for(const _0x2a2e17 of _0x4514c7){if(!_0x2a2e17['isDirectory']())continue;const _0x53a2e7=a147_0x5b4142['join'](_0x5b4923,_0x2a2e17[_0x3d8a8d(0x1f2)]),_0x174770=a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x53a2e7,_0x2a2e17[_0x3d8a8d(0x1f2)]+_0x3d8a8d(0x14e));if(a147_0xb9fbad[_0x3d8a8d(0x145)](_0x174770)){const _0x16bc02=parseExperimentalKnowledgeBaseYaml(a147_0xb9fbad[_0x3d8a8d(0xfd)](_0x174770,_0x3d8a8d(0x1bc)),_0x174770),_0x59779e=a147_0x5b4142['join'](_0x53a2e7,_0x3d8a8d(0x1ab)),_0x47d897=[];if(a147_0xb9fbad[_0x3d8a8d(0x145)](_0x59779e)){const _0x444989=a147_0xb9fbad[_0x3d8a8d(0x1b1)](_0x59779e,{'withFileTypes':!![]});for(const _0x1622ab of _0x444989){if(!_0x1622ab[_0x3d8a8d(0xfa)]())continue;const _0x4d4e0c=a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x59779e,_0x1622ab[_0x3d8a8d(0x1f2)]),_0xb6d8b2=a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x4d4e0c,_0x3d8a8d(0x1a6)),_0x485610=a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x4d4e0c,_0x3d8a8d(0x14c));if(a147_0xb9fbad[_0x3d8a8d(0x145)](_0xb6d8b2)&&a147_0xb9fbad[_0x3d8a8d(0x145)](_0x485610)){const _0x1e1862=a147_0xb9fbad['readFileSync'](_0xb6d8b2,_0x3d8a8d(0x1bc)),_0x4333ff=a147_0xb9fbad[_0x3d8a8d(0xfd)](_0x485610,_0x3d8a8d(0x1bc));_0x47d897[_0x3d8a8d(0x151)]({'name':_0x1622ab['name'],'code':_0x1e1862,'json_schema':_0x4333ff});}}}const _0xb9360b={..._0x16bc02,'functions':_0x47d897};_0x13460d[_0x3d8a8d(0x151)]({'name':_0x16bc02[_0x3d8a8d(0x1f2)],'path':_0x53a2e7,'def':_0xb9360b});}}}const _0x5c1c59=getExperimentalArtifactsDir(_0x31d61a);if(a147_0xb9fbad[_0x3d8a8d(0x145)](_0x5c1c59)){const _0x166cb7=a147_0xb9fbad[_0x3d8a8d(0x1b1)](_0x5c1c59,{'withFileTypes':!![]});for(const _0xb686be of _0x166cb7){if(!_0xb686be['isDirectory']())continue;const _0x3106ea=a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x5c1c59,_0xb686be[_0x3d8a8d(0x1f2)]),_0x1a55e8=a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x3106ea,_0xb686be[_0x3d8a8d(0x1f2)]+_0x3d8a8d(0x14e));if(a147_0xb9fbad[_0x3d8a8d(0x145)](_0x1a55e8)){const _0x22d075=parseExperimentalArtifactYaml(a147_0xb9fbad[_0x3d8a8d(0xfd)](_0x1a55e8,_0x3d8a8d(0x1bc)),_0x1a55e8),_0x3c38ea=a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x3106ea,'code.js'),_0x12dc19=a147_0xb9fbad[_0x3d8a8d(0x145)](_0x3c38ea)?a147_0xb9fbad[_0x3d8a8d(0xfd)](_0x3c38ea,_0x3d8a8d(0x1bc)):'',_0x2b2814=a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x3106ea,_0x3d8a8d(0x1ca)),_0xa9b7e5=[];if(a147_0xb9fbad[_0x3d8a8d(0x145)](_0x2b2814)){const _0xf0d3f8=a147_0xb9fbad[_0x3d8a8d(0x1b1)](_0x2b2814);for(const _0x4bb287 of _0xf0d3f8){const _0x42c73a=a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x2b2814,_0x4bb287);if(a147_0xb9fbad[_0x3d8a8d(0x1c1)](_0x42c73a)[_0x3d8a8d(0x1e2)]()){const _0x258994=a147_0xb9fbad['readFileSync'](_0x42c73a,'utf-8');_0xa9b7e5[_0x3d8a8d(0x151)]({'file_name':_0x4bb287,'text_content':_0x258994});}}}const _0x5390a0={..._0x22d075,'code':_0x12dc19,'files':_0xa9b7e5};_0x282acd[_0x3d8a8d(0x151)]({'name':_0x22d075[_0x3d8a8d(0x1f2)],'path':_0x3106ea,'def':_0x5390a0});}}}const _0x4ce2d7=getFormInterfacesDir(_0x31d61a);if(a147_0xb9fbad[_0x3d8a8d(0x145)](_0x4ce2d7)){const _0x2b743f=a147_0xb9fbad['readdirSync'](_0x4ce2d7)[_0x3d8a8d(0x1f5)](_0x40a859=>_0x40a859['endsWith'](_0x3d8a8d(0x14e)));for(const _0x460b0c of _0x2b743f){const _0x203a0c=a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x4ce2d7,_0x460b0c),_0x27e27f=parseFormInterfaceYaml(a147_0xb9fbad['readFileSync'](_0x203a0c,_0x3d8a8d(0x1bc)),_0x203a0c);_0x4694a1[_0x3d8a8d(0x151)]({'name':_0x27e27f[_0x3d8a8d(0x1f2)],'path':_0x203a0c,'yaml':_0x27e27f});}}const _0x58d0f0=getChatInterfacesDir(_0x31d61a);if(a147_0xb9fbad['existsSync'](_0x58d0f0)){const _0x1cd21b=a147_0xb9fbad[_0x3d8a8d(0x1b1)](_0x58d0f0)[_0x3d8a8d(0x1f5)](_0x50d50d=>_0x50d50d[_0x3d8a8d(0x1fb)](_0x3d8a8d(0x14e)));for(const _0x32106a of _0x1cd21b){const _0x4e1248=a147_0x5b4142[_0x3d8a8d(0x1ed)](_0x58d0f0,_0x32106a),_0x5d0711=parseChatInterfaceYaml(a147_0xb9fbad[_0x3d8a8d(0xfd)](_0x4e1248,_0x3d8a8d(0x1bc)),_0x4e1248);_0x2197eb[_0x3d8a8d(0x151)]({'name':_0x5d0711[_0x3d8a8d(0x1f2)],'path':_0x4e1248,'yaml':_0x5d0711});}}}else{const _0x23abb1=await this[_0x3d8a8d(0x1b6)](_0x31d61a),_0x4e8d0c=await this['client'][_0x3d8a8d(0x175)](_0x23abb1);_0x126415=_0x4e8d0c['attributes']['name'];const _0x13d487=await this[_0x3d8a8d(0x179)][_0x3d8a8d(0x188)](_0x23abb1),_0x24f35c=await this[_0x3d8a8d(0x179)]['listKnowledgeBases'](_0x23abb1),_0x4f5118=await this['client']['listTextKnowledgeBases'](_0x23abb1),_0x51ff8b=await this[_0x3d8a8d(0x179)]['listPrompts'](_0x23abb1),_0x40a007=await this[_0x3d8a8d(0x179)][_0x3d8a8d(0x146)](_0x23abb1),_0xc5fce7=await safeListOrEmpty(()=>this[_0x3d8a8d(0x179)][_0x3d8a8d(0x116)](_0x23abb1)),_0x1483e9=await safeListOrEmpty(()=>this[_0x3d8a8d(0x179)][_0x3d8a8d(0x1e4)](_0x23abb1)),_0x5f3bc8=new Map(),_0x38aa56=new Map(),_0x55d666=new Map(),_0x1b6ec7=new Map(),_0x1cbd4f=new Map(),_0x36dad5=new Map();for(const _0x2d7d5c of _0x24f35c){_0x5f3bc8[_0x3d8a8d(0x1df)](_0x2d7d5c['id'],_0x2d7d5c[_0x3d8a8d(0x193)]['name']);}for(const _0x409db9 of _0x4f5118){_0x38aa56[_0x3d8a8d(0x1df)](_0x409db9['id'],_0x409db9[_0x3d8a8d(0x193)][_0x3d8a8d(0x1f2)]);}for(const _0xe57aee of _0x13d487){_0x55d666[_0x3d8a8d(0x1df)](_0xe57aee['id'],_0xe57aee[_0x3d8a8d(0x193)][_0x3d8a8d(0x1f2)]);}for(const _0x19ba2f of _0x51ff8b){_0x1b6ec7[_0x3d8a8d(0x1df)](_0x19ba2f['id'],_0x19ba2f[_0x3d8a8d(0x193)]['name']);}for(const _0x4866e5 of _0xc5fce7){_0x1cbd4f[_0x3d8a8d(0x1df)](_0x4866e5['id'],_0x4866e5[_0x3d8a8d(0x193)][_0x3d8a8d(0x1f2)]);}for(const _0x1a01f9 of _0x1483e9){_0x36dad5[_0x3d8a8d(0x1df)](_0x1a01f9['id'],_0x1a01f9[_0x3d8a8d(0x193)]['name']);}const _0x401a7a={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x5f3bc8,'TextKnowledgeBase':_0x38aa56,'Agent':_0x55d666,'ExperimentalKnowledgeBase':_0x1cbd4f}),'resolvePromptName':async _0x5c7e50=>_0x1b6ec7[_0x3d8a8d(0x198)](_0x5c7e50),'onWarning':_0x1219a6=>this[_0x3d8a8d(0x1d1)][_0x3d8a8d(0x16d)](_0x1219a6)};for(const _0x3391d9 of _0x13d487){const _0x2706f4=await agentResponseToDef(_0x3391d9,_0x401a7a),{yaml:_0xcc054b,systemPrompt:_0xb5c958,starterMessage:_0x28171c}=_0x2706f4;_0x4d3eae[_0x3d8a8d(0x151)]({'name':_0xcc054b[_0x3d8a8d(0x1f2)],'dir':'','yaml':_0xcc054b,'systemPrompt':_0xb5c958,'starterMessage':_0x28171c});}for(const _0xb8f45a of _0x24f35c){const _0x53e0fb=apiKnowledgeBaseToYaml(_0xb8f45a);_0x47e931[_0x3d8a8d(0x151)]({'name':_0x53e0fb[_0x3d8a8d(0x1f2)],'path':'','yaml':_0x53e0fb});}for(const _0x43d90b of _0x4f5118){_0x34c3e5[_0x3d8a8d(0x151)]({'name':_0x43d90b[_0x3d8a8d(0x193)][_0x3d8a8d(0x1f2)],'path':'','text':_0x43d90b[_0x3d8a8d(0x193)]['text']});}for(const _0x3c5537 of _0x51ff8b){const _0x1e4f29=await apiPromptToYaml(_0x3c5537,_0x401a7a);_0x1e4f29&&_0x279e3[_0x3d8a8d(0x151)]({'name':_0x1e4f29[_0x3d8a8d(0x1f2)],'path':'','yaml':_0x1e4f29});}for(const _0xcbf038 of _0x40a007){if(!_0xcbf038[_0x3d8a8d(0x193)][_0x3d8a8d(0x1c9)]&&SAFE_INTEGRATION_TYPES[_0x3d8a8d(0x104)](_0xcbf038['attributes'][_0x3d8a8d(0x14b)][_0x3d8a8d(0x19f)]())){const _0x49052f=await apiIntegrationToYaml(_0xcbf038,_0x401a7a);_0x294e95[_0x3d8a8d(0x151)]({'name':_0xcbf038[_0x3d8a8d(0x193)][_0x3d8a8d(0x14b)][_0x3d8a8d(0x19f)](),'path':'','yaml':_0x49052f});}}for(const _0x2409f2 of _0xc5fce7){const _0x37aff7=apiExperimentalKnowledgeBaseToYaml(_0x2409f2);_0x13460d[_0x3d8a8d(0x151)]({'name':_0x37aff7[_0x3d8a8d(0x1f2)],'path':'','def':_0x37aff7});}for(const _0x3a8fc2 of _0x1483e9){const _0x4c72cd=apiExperimentalArtifactToYaml(_0x3a8fc2);_0x282acd['push']({'name':_0x4c72cd[_0x3d8a8d(0x1f2)],'path':'','def':_0x4c72cd});}const _0x563a4d=await safeListOrEmpty(()=>this[_0x3d8a8d(0x179)][_0x3d8a8d(0x1d5)](_0x23abb1));for(const _0x28dafb of _0x563a4d){const _0x59bbaf=await apiFormInterfaceToYaml(_0x28dafb,_0x401a7a);_0x4694a1[_0x3d8a8d(0x151)]({'name':_0x59bbaf['name'],'path':'','yaml':_0x59bbaf});}const _0x3f65c8=await safeListOrEmpty(()=>this[_0x3d8a8d(0x179)]['listChatInterfaces'](_0x23abb1));for(const _0x4c9804 of _0x3f65c8){if(_0x4c9804['attributes'][_0x3d8a8d(0x1c9)])continue;const _0x1d62e6=await apiChatInterfaceToYaml(_0x4c9804,_0x401a7a);_0x2197eb[_0x3d8a8d(0x151)]({'name':_0x1d62e6[_0x3d8a8d(0x1f2)],'path':'','yaml':_0x1d62e6});}}const _0x2c199a={'sourceProjectName':_0x126415,'newProjectName':_0x49cb93,'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}}},_0x1ebd9e=await this[_0x3d8a8d(0x179)][_0x3d8a8d(0xef)](),_0x5cb7de=_0x1ebd9e[_0x3d8a8d(0x12c)](_0x3c2fb0=>_0x3c2fb0[_0x3d8a8d(0x193)][_0x3d8a8d(0x1f2)]===_0x49cb93);if(_0x5cb7de)throw new SDKError(ErrorCode[_0x3d8a8d(0x1f1)],'Project\x20\x22'+_0x49cb93+_0x3d8a8d(0x10b),undefined,{'helpText':_0x3d8a8d(0x102)});if(_0x2003aa?.[_0x3d8a8d(0x1ff)])return _0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0x1e1)][_0x3d8a8d(0xe3)]=_0x4d3eae[_0x3d8a8d(0x160)],_0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0x1d6)][_0x3d8a8d(0xe3)]=_0x47e931['length'],_0x2c199a[_0x3d8a8d(0x1e3)]['textKnowledgeBases'][_0x3d8a8d(0xe3)]=_0x34c3e5[_0x3d8a8d(0x160)],_0x2c199a[_0x3d8a8d(0x1e3)]['experimentalKnowledgeBases']['created']=_0x13460d[_0x3d8a8d(0x160)],_0x2c199a['counts'][_0x3d8a8d(0x159)][_0x3d8a8d(0xe3)]=_0x282acd[_0x3d8a8d(0x160)],_0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0x1dd)][_0x3d8a8d(0xe3)]=_0x279e3[_0x3d8a8d(0x160)],_0x2c199a[_0x3d8a8d(0x1e3)]['integrations'][_0x3d8a8d(0xe3)]=_0x294e95[_0x3d8a8d(0x160)],_0x2c199a;const _0x17a6b2=await this[_0x3d8a8d(0x179)][_0x3d8a8d(0x1e5)]({'name':_0x49cb93}),_0x52974f=_0x17a6b2['id'];_0x2c199a[_0x3d8a8d(0x133)]=_0x52974f;const _0x452034=new Map(),_0x3b278e=new Map(),_0x4dd445=new Map(),_0x1c1675=new Map(),_0x32e082=new Map(),_0xeb8965=new Map(),_0x223e54=new Map(),_0x60db28=new Map(),_0x40fd4a=new Set(),_0x4f6818=new Set();for(const _0x422408 of _0x4d3eae){for(const _0x51c51d of _0x422408['yaml'][_0x3d8a8d(0x16b)]||[]){if(_0x51c51d['type']===_0x3d8a8d(0x1c6)&&_0x51c51d['target']){const _0x378a1d=parseRef(_0x51c51d[_0x3d8a8d(0x1c7)]);if(_0x378a1d)_0x40fd4a[_0x3d8a8d(0x139)](_0x378a1d[_0x3d8a8d(0x1f2)]);}else{if(_0x51c51d[_0x3d8a8d(0x1f4)]===_0x3d8a8d(0x148)&&_0x51c51d[_0x3d8a8d(0x1c7)]){const _0x25d973=parseRef(_0x51c51d[_0x3d8a8d(0x1c7)]);if(_0x25d973)_0x4f6818[_0x3d8a8d(0x139)](_0x25d973[_0x3d8a8d(0x1f2)]);}}}}for(const _0x4ea8e2 of _0x40fd4a){try{const _0x3ee819=await this[_0x3d8a8d(0x179)]['createImageGenerator']({'projectId':_0x52974f,'name':_0x4ea8e2});_0x32e082[_0x3d8a8d(0x1df)](_0x4ea8e2,_0x3ee819['id']),_0x2c199a[_0x3d8a8d(0xf5)][_0x3d8a8d(0x151)]({'name':_0x4ea8e2,'action':_0x3d8a8d(0xe3),'id':_0x3ee819['id']}),_0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0xf5)]['created']++;}catch(_0x24a531){_0x2c199a[_0x3d8a8d(0xf5)][_0x3d8a8d(0x151)]({'name':_0x4ea8e2,'action':'error','error':_0x24a531['message']}),_0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0xf5)][_0x3d8a8d(0x132)]++;}}for(const _0x31c1b2 of _0x4f6818){try{const _0x14bd78=await this[_0x3d8a8d(0x179)][_0x3d8a8d(0x17b)]({'projectId':_0x52974f,'name':_0x31c1b2});_0xeb8965[_0x3d8a8d(0x1df)](_0x31c1b2,_0x14bd78['id']),_0x2c199a[_0x3d8a8d(0x14d)][_0x3d8a8d(0x151)]({'name':_0x31c1b2,'action':_0x3d8a8d(0xe3),'id':_0x14bd78['id']}),_0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0x14d)][_0x3d8a8d(0xe3)]++;}catch(_0x1c81f2){_0x2c199a[_0x3d8a8d(0x14d)][_0x3d8a8d(0x151)]({'name':_0x31c1b2,'action':'error','error':_0x1c81f2[_0x3d8a8d(0x17e)]}),_0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0x14d)][_0x3d8a8d(0x132)]++;}}const _0x2fc33f=await fetchAllToolTargetMaps((_0x18c759,_0x2b6448)=>this[_0x3d8a8d(0x179)][_0x3d8a8d(0x1cb)](_0x18c759,_0x2b6448),_0x52974f);let _0x48a3b3=[];const _0x14b4fe={'projectId':_0x52974f,'resolveToolTargetId':buildIdResolver({..._0x2fc33f['nameToId'],'KnowledgeBase':_0x452034,'TextKnowledgeBase':_0x3b278e,'ExperimentalKnowledgeBase':_0x223e54,'Agent':_0x4dd445,'WebSearchTool':_0xeb8965,'ImageGenerator':_0x32e082}),'resolvePromptId':async _0x5956eb=>_0x1c1675[_0x3d8a8d(0x198)](_0x5956eb),'onWarning':_0x187be2=>{const _0x199043=_0x3d8a8d;this['logger']['warn'](_0x187be2),_0x48a3b3[_0x199043(0x151)](_0x187be2);}};for(const _0x4967f5 of _0x47e931){try{const _0x414652=yamlKnowledgeBaseToApi(_0x4967f5[_0x3d8a8d(0x170)],_0x52974f),_0x56f653=await this[_0x3d8a8d(0x179)][_0x3d8a8d(0x1dc)](_0x414652);_0x452034[_0x3d8a8d(0x1df)](_0x4967f5[_0x3d8a8d(0x170)][_0x3d8a8d(0x1f2)],_0x56f653['id']),_0x2c199a[_0x3d8a8d(0x1d6)][_0x3d8a8d(0x151)]({'name':_0x4967f5['yaml'][_0x3d8a8d(0x1f2)],'action':'created','id':_0x56f653['id']}),_0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0x1d6)][_0x3d8a8d(0xe3)]++;}catch(_0x1db31c){_0x2c199a[_0x3d8a8d(0x1d6)][_0x3d8a8d(0x151)]({'name':_0x4967f5[_0x3d8a8d(0x170)][_0x3d8a8d(0x1f2)],'action':_0x3d8a8d(0x130),'error':_0x1db31c[_0x3d8a8d(0x17e)]}),_0x2c199a['counts'][_0x3d8a8d(0x1d6)][_0x3d8a8d(0x132)]++;}}for(const _0x332702 of _0x34c3e5){try{const _0x54ca98=yamlTextKnowledgeBaseToApi({'name':_0x332702[_0x3d8a8d(0x1f2)],'text':_0x332702['text']},_0x52974f),_0x1d1996=await this[_0x3d8a8d(0x179)][_0x3d8a8d(0x1e8)](_0x54ca98);_0x3b278e['set'](_0x332702['name'],_0x1d1996['id']),_0x2c199a[_0x3d8a8d(0xf4)][_0x3d8a8d(0x151)]({'name':_0x332702[_0x3d8a8d(0x1f2)],'action':_0x3d8a8d(0xe3),'id':_0x1d1996['id']}),_0x2c199a['counts'][_0x3d8a8d(0xf4)][_0x3d8a8d(0xe3)]++;}catch(_0x4a8250){_0x2c199a['textKnowledgeBases'][_0x3d8a8d(0x151)]({'name':_0x332702[_0x3d8a8d(0x1f2)],'action':_0x3d8a8d(0x130),'error':_0x4a8250[_0x3d8a8d(0x17e)]}),_0x2c199a[_0x3d8a8d(0x1e3)]['textKnowledgeBases'][_0x3d8a8d(0x132)]++;}}for(const _0x1be43d of _0x282acd){try{const _0x120031=yamlExperimentalArtifactToApi(_0x1be43d[_0x3d8a8d(0xf8)],_0x52974f),_0x485205=await this[_0x3d8a8d(0x179)][_0x3d8a8d(0x1ee)](_0x120031);_0x60db28['set'](_0x1be43d[_0x3d8a8d(0xf8)][_0x3d8a8d(0x1f2)],_0x485205['id']),_0x2c199a[_0x3d8a8d(0x159)][_0x3d8a8d(0x151)]({'name':_0x1be43d['def'][_0x3d8a8d(0x1f2)],'action':_0x3d8a8d(0xe3),'id':_0x485205['id']}),_0x2c199a[_0x3d8a8d(0x1e3)]['experimentalArtifacts'][_0x3d8a8d(0xe3)]++;}catch(_0x5587fd){_0x2c199a[_0x3d8a8d(0x159)][_0x3d8a8d(0x151)]({'name':_0x1be43d[_0x3d8a8d(0xf8)][_0x3d8a8d(0x1f2)],'action':_0x3d8a8d(0x130),'error':_0x5587fd[_0x3d8a8d(0x17e)]}),_0x2c199a['counts'][_0x3d8a8d(0x159)][_0x3d8a8d(0x132)]++;}}for(const _0x5510f5 of _0x13460d){try{const _0x139bc9=yamlExperimentalKnowledgeBaseToApi(_0x5510f5[_0x3d8a8d(0xf8)],_0x52974f),_0x4f6f09=await this['client'][_0x3d8a8d(0x1a8)](_0x139bc9);_0x223e54[_0x3d8a8d(0x1df)](_0x5510f5[_0x3d8a8d(0xf8)][_0x3d8a8d(0x1f2)],_0x4f6f09['id']),_0x2c199a[_0x3d8a8d(0x182)][_0x3d8a8d(0x151)]({'name':_0x5510f5[_0x3d8a8d(0xf8)]['name'],'action':_0x3d8a8d(0xe3),'id':_0x4f6f09['id']}),_0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0x182)][_0x3d8a8d(0xe3)]++;}catch(_0x4d9a70){_0x2c199a[_0x3d8a8d(0x182)][_0x3d8a8d(0x151)]({'name':_0x5510f5[_0x3d8a8d(0xf8)][_0x3d8a8d(0x1f2)],'action':_0x3d8a8d(0x130),'error':_0x4d9a70[_0x3d8a8d(0x17e)]}),_0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0x182)]['errors']++;}}const _0x54ad85=[..._0x4d3eae][_0x3d8a8d(0x1d3)]((_0x4872e7,_0x4a0a7a)=>{const _0x28e2d5=_0x3d8a8d,_0x4cb79f=_0x4872e7[_0x28e2d5(0x170)]['tools']?.[_0x28e2d5(0x162)](_0x4d5b0d=>_0x4d5b0d[_0x28e2d5(0x1f4)]===_0x28e2d5(0x1e7))??![],_0x5807b7=_0x4a0a7a[_0x28e2d5(0x170)][_0x28e2d5(0x16b)]?.[_0x28e2d5(0x162)](_0x1c858e=>_0x1c858e[_0x28e2d5(0x1f4)]===_0x28e2d5(0x1e7))??![];if(_0x4cb79f&&!_0x5807b7)return 0x1;if(!_0x4cb79f&&_0x5807b7)return-0x1;return 0x0;});for(const _0x5ad995 of _0x54ad85){_0x48a3b3=[];try{const _0x587fcb=_0x5ad995[_0x3d8a8d(0x170)][_0x3d8a8d(0x16b)]?.['filter'](_0x2d4298=>{const _0x78dd06=_0x3d8a8d;if(_0x2d4298[_0x78dd06(0x1f4)]==='agent'&&_0x2d4298['target']){const _0x4cd947=parseRef(_0x2d4298['target']);return _0x4cd947?.[_0x78dd06(0x1f2)]===_0x5ad995[_0x78dd06(0x170)][_0x78dd06(0x1f2)];}return![];})??[];if(_0x587fcb['length']>0x0){const _0x459ca8='Agent\x20\x27'+_0x5ad995[_0x3d8a8d(0x170)][_0x3d8a8d(0x1f2)]+'\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20'+_0x3d8a8d(0xfb);this['logger']['warn'](_0x459ca8),_0x48a3b3[_0x3d8a8d(0x151)](_0x459ca8);}const _0x13f447=await agentDefToRequest(_0x5ad995['yaml'],_0x5ad995[_0x3d8a8d(0xf1)],_0x5ad995[_0x3d8a8d(0x137)],_0x14b4fe),_0x79f027=await this['client'][_0x3d8a8d(0x154)](_0x13f447);_0x4dd445[_0x3d8a8d(0x1df)](_0x5ad995[_0x3d8a8d(0x170)][_0x3d8a8d(0x1f2)],_0x79f027['id']),_0x2c199a[_0x3d8a8d(0x1e1)]['push']({'agentName':_0x5ad995[_0x3d8a8d(0x170)][_0x3d8a8d(0x1f2)],'action':'created','agentId':_0x79f027['id'],'warnings':_0x48a3b3[_0x3d8a8d(0x160)]>0x0?_0x48a3b3:undefined}),_0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0x1e1)][_0x3d8a8d(0xe3)]++;}catch(_0x1f6bd6){_0x2c199a[_0x3d8a8d(0x1e1)]['push']({'agentName':_0x5ad995[_0x3d8a8d(0x170)][_0x3d8a8d(0x1f2)],'action':'error','error':_0x1f6bd6['message'],'warnings':_0x48a3b3[_0x3d8a8d(0x160)]>0x0?_0x48a3b3:undefined}),_0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0x1e1)][_0x3d8a8d(0x132)]++;}}for(const _0x248dc4 of _0x279e3){try{const _0x27ab74=await yamlPromptToApi(_0x248dc4[_0x3d8a8d(0x170)],_0x52974f,_0x14b4fe);if(!_0x27ab74){_0x2c199a['prompts'][_0x3d8a8d(0x151)]({'name':_0x248dc4[_0x3d8a8d(0x170)][_0x3d8a8d(0x1f2)],'action':_0x3d8a8d(0x130),'error':_0x3d8a8d(0x1d8)}),_0x2c199a[_0x3d8a8d(0x1e3)]['prompts'][_0x3d8a8d(0x132)]++;continue;}const _0x2450e4=await this[_0x3d8a8d(0x179)][_0x3d8a8d(0x1ea)](_0x27ab74);_0x1c1675[_0x3d8a8d(0x1df)](_0x248dc4['yaml']['name'],_0x2450e4['id']),_0x2c199a[_0x3d8a8d(0x1dd)][_0x3d8a8d(0x151)]({'name':_0x248dc4[_0x3d8a8d(0x170)][_0x3d8a8d(0x1f2)],'action':'created','id':_0x2450e4['id']}),_0x2c199a['counts'][_0x3d8a8d(0x1dd)][_0x3d8a8d(0xe3)]++;}catch(_0x5e9957){_0x2c199a['prompts'][_0x3d8a8d(0x151)]({'name':_0x248dc4[_0x3d8a8d(0x170)][_0x3d8a8d(0x1f2)],'action':'error','error':_0x5e9957[_0x3d8a8d(0x17e)]}),_0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0x1dd)][_0x3d8a8d(0x132)]++;}}for(const _0x12d93a of _0x294e95){try{const _0x3c8bdb=await yamlIntegrationToApi(_0x12d93a[_0x3d8a8d(0x170)],_0x52974f,_0x14b4fe),_0x798b03=await this[_0x3d8a8d(0x179)][_0x3d8a8d(0x1de)](_0x3c8bdb);_0x2c199a[_0x3d8a8d(0x18d)][_0x3d8a8d(0x151)]({'name':_0x12d93a[_0x3d8a8d(0x170)][_0x3d8a8d(0x19b)],'action':_0x3d8a8d(0xe3),'id':_0x798b03['id']}),_0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0x18d)][_0x3d8a8d(0xe3)]++;}catch(_0x1c3aab){_0x2c199a[_0x3d8a8d(0x18d)][_0x3d8a8d(0x151)]({'name':_0x12d93a[_0x3d8a8d(0x170)][_0x3d8a8d(0x19b)],'action':_0x3d8a8d(0x130),'error':_0x1c3aab[_0x3d8a8d(0x17e)]}),_0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0x18d)]['errors']++;}}for(const _0x292a04 of _0x4694a1){try{const _0x21d199=await yamlFormInterfaceToApi(_0x292a04[_0x3d8a8d(0x170)],_0x52974f,_0x14b4fe);if(!_0x21d199){_0x2c199a[_0x3d8a8d(0x15c)]['push']({'name':_0x292a04['yaml'][_0x3d8a8d(0x1f2)],'action':_0x3d8a8d(0x130),'error':_0x3d8a8d(0x1b8)}),_0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0x15c)]['errors']++;continue;}const _0x31853b=await this[_0x3d8a8d(0x179)][_0x3d8a8d(0x189)](_0x21d199);_0x2c199a[_0x3d8a8d(0x15c)][_0x3d8a8d(0x151)]({'name':_0x292a04[_0x3d8a8d(0x170)][_0x3d8a8d(0x1f2)],'action':'created','id':_0x31853b['id']}),_0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0x15c)][_0x3d8a8d(0xe3)]++;}catch(_0x201e36){_0x2c199a[_0x3d8a8d(0x15c)][_0x3d8a8d(0x151)]({'name':_0x292a04['yaml']['name'],'action':_0x3d8a8d(0x130),'error':_0x201e36[_0x3d8a8d(0x17e)]}),_0x2c199a[_0x3d8a8d(0x1e3)][_0x3d8a8d(0x15c)][_0x3d8a8d(0x132)]++;}}for(const _0x495d3a of _0x2197eb){try{const _0x179e44=await yamlChatInterfaceToApi(_0x495d3a['yaml'],_0x52974f,_0x14b4fe),_0x29c5d8=await this[_0x3d8a8d(0x179)][_0x3d8a8d(0x1f3)](_0x179e44);_0x2c199a['chatInterfaces'][_0x3d8a8d(0x151)]({'name':_0x495d3a['yaml'][_0x3d8a8d(0x1f2)],'action':_0x3d8a8d(0xe3),'id':_0x29c5d8['id']}),_0x2c199a[_0x3d8a8d(0x1e3)]['chatInterfaces'][_0x3d8a8d(0xe3)]++;}catch(_0x4a865e){_0x2c199a['chatInterfaces'][_0x3d8a8d(0x151)]({'name':_0x495d3a[_0x3d8a8d(0x170)][_0x3d8a8d(0x1f2)],'action':_0x3d8a8d(0x130),'error':_0x4a865e['message']}),_0x2c199a['counts'][_0x3d8a8d(0x11c)][_0x3d8a8d(0x132)]++;}}return _0x2c199a;}}
|
|
1
|
+
const a148_0x41755e=a148_0x5d72;function a148_0x5d72(_0x9ca6c7,_0x4f8edc){_0x9ca6c7=_0x9ca6c7-0xcc;const _0x5b91b4=a148_0x5b91();let _0x5d72f5=_0x5b91b4[_0x9ca6c7];return _0x5d72f5;}(function(_0x4ac297,_0x5144be){const _0x1e2551=a148_0x5d72,_0x3e9670=_0x4ac297();while(!![]){try{const _0x483028=parseInt(_0x1e2551(0x1bf))/0x1*(-parseInt(_0x1e2551(0x16d))/0x2)+-parseInt(_0x1e2551(0x1e1))/0x3+parseInt(_0x1e2551(0xfc))/0x4+parseInt(_0x1e2551(0x168))/0x5*(-parseInt(_0x1e2551(0x14b))/0x6)+-parseInt(_0x1e2551(0x19b))/0x7+parseInt(_0x1e2551(0x1e3))/0x8+parseInt(_0x1e2551(0x1ab))/0x9*(parseInt(_0x1e2551(0x155))/0xa);if(_0x483028===_0x5144be)break;else _0x3e9670['push'](_0x3e9670['shift']());}catch(_0x59f0e4){_0x3e9670['push'](_0x3e9670['shift']());}}}(a148_0x5b91,0x4ad05));import{LLMApiClient}from'../client/llm-api-client.js';import*as a148_0x1a108a from'node:fs';import*as a148_0x55bc74 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{toModelInfos}from'./user-settings.js';function a148_0x5b91(){const _0x159a1b=['3261544giIpXv','find','knowledgebases.json','size','listIntegrations','Only\x20safe\x20types\x20(','getBackupMetadata','functions','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','chat','listTextKnowledgeBases','Renamed\x20integration\x20file:\x20','tables','LLM_PROJECT_NOT_FOUND','agents.json','webhookCorsOrigins','.llm','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','\x0a---\x20function:\x20','llm_project','agentId','agent.yml','Available\x20agents:\x20','readFileSync','INTERNAL','Skipping\x20integration\x20\x27','isDirectory','dryRun','profile','outputs','getAgent','updateChatInterface','isFile','jsonSchemaHint','Renamed\x20chat\x20interface\x20file:\x20','loadJsonFile','pullAgent','total','yaml','unlinkSync','warn','length','integrations.json','name','currentProjectId','PERMISSION_DENIED','serviceType','projectId','event','prompt.md','createChatInterface','chat_interfaces','createIntegration','Renamed\x20agent\x20folder:\x20','toISOString','838004sOdwjL','utf-8','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','resolveProjectId','get','dirname','experimental_knowledge_bases','updatePrompt','createProject','description','listExperimentalArtifacts','pullProject','Project\x20\x22','json_schema','updated','project','status','Unsupported\x20backup\x20version:\x20','createFormInterface','experimentalArtifacts','add',')\x20can\x20be\x20cloned.','Renamed\x20text\x20KB\x20file:\x20','service_type','KnowledgeBase','starter_message.md','updateAgentResponse','resolveProjectName','client','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','NOT_FOUND','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','text','template','imageGenerators','path','isManaged','\x20attempts\x20due\x20to\x20name\x20conflicts.','target','webSearchTools','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','isDir','Renamed\x20experimental\x20artifact\x20directory:\x20','promptId','files','message','listProjects','Renamed\x20experimental\x20KB\x20directory:\x20','updateFormInterface','backupProject','listExperimentalKnowledgeBases','Removed\x20deleted\x20file:\x20','oldPath','listToolTargets','statSync','agentsFull','chats','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','knowledge_bases','push','\x27\x20(','updateTextKnowledgeBase','Multiple\x20agents\x20found\x20with\x20name\x20\x27','listKnowledgeBases','sdk.llm','updateAgent','---\x20schema:\x20','\x20---\x0a','createAgent','getCurrentProject','startChat','Renamed\x20KB\x20file:\x20','Project\x20not\x20found:\x20','slackMessageMode','\x20in\x20project\x20','\x0a---\x20code\x20---\x0a','image_gen','chatInfo','chat_parent_segment','7194JPcOxt','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','mkdirSync','projects','starter_message','\x20→\x20','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','renamed','endsWith','5671240zWMwlw','getChatHistory','set','dir','Agent\x20not\x20found:\x20','text_content','\x0a\x0a#\x20agent.yml\x0a','.yml','minimal','---\x20file:\x20','conflict','pushProject','newProjectId','Could\x20not\x20resolve\x20agent\x20reference','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.',')\x20can\x20be\x20pushed.\x20','content','listWebSearchTools','getOrCreateDefaultProject','770gZfWvt','duplicate','maxToolIterations','Unable\x20to\x20create\x20project\x20after\x20','join','18190WqNqEe','existsSync','createTextKnowledgeBase','textKnowledgeBases','info','temperature','getChatLog','agent.yml\x20not\x20found\x20in\x20','#\x20prompt.md\x0a','toLowerCase','systemPrompt','INVALID_ARGUMENT','knowledgeBases','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','claude-4.5-sonnet','resolveAgentId','1.0','modelType','new','has','parse','filter','agents','code.js','cwd','split','tdx.json','Output\x20directory\x20already\x20exists:\x20','Renamed\x20folder:\x20','formInterfaces','def','listAgents','Invalid\x20agent\x20reference\x20format:\x20','deleteAgent','models','Renamed\x20form\x20interface\x20file:\x20','chatId','createExperimentalArtifact','createAgentResponse','low','integrations','AGENT_NOT_FOUND','attributes','project.json','UNAUTHENTICATED','errors','4110169EFFEmW','chatInterfaces','starterMessage','context','listAgentsFull','createWebSearchTool','action','version','idToName','variables','experimental_artifacts','created','exportedFrom','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','none','chat_generic','9CsKbpB','createExperimentalKnowledgeBase','tdDatabaseName','\x22\x20already\x20exists','agent','createKnowledgeBase','code','basename','prompts.json','\x27.\x20This\x20should\x20not\x20happen.','sort','rmSync','experimentalKnowledgeBases','tdx_','ALREADY_EXISTS','error','chatWelcomeMessage','deleteProject','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','logger','11wjmqnK','Removed\x20deleted\x20directory:\x20','localeCompare','listPrompts','includes','stringify','site','writeFileSync','readdirSync','counts','listImageGenerators','file_name','unchanged','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','getProject','createPrompt','listFormInterfaces','already\x20exists','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','):\x20','TextKnowledgeBase','Renamed\x20prompt\x20file:\x20','getChatInfo','listChatInterfaces','tools','Multiple\x20projects\x20found\x20with\x20name\x20\x27','No\x20tdx.json\x20found\x20in\x20','\x0a---\x20schema:\x20','map','.md','nameToId','Unresolved\x20dependencies:\x20','type','listChats','18069zmfsHk','prompts'];a148_0x5b91=function(){return _0x159a1b;};return a148_0x5b91();}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=[a148_0x41755e(0x1aa),'chat_agent_console',a148_0x41755e(0x14a)];async function safeListOrEmpty(_0x57210e){const _0x411646=a148_0x41755e;try{return await _0x57210e();}catch(_0x45dba1){if(_0x45dba1 instanceof HTTPClientError&&_0x45dba1[_0x411646(0x10c)]===0x194)return[];throw _0x45dba1;}}export class LLMSDK{[a148_0x41755e(0xf1)];[a148_0x41755e(0x118)];[a148_0x41755e(0x19e)];['logger']=Logger['of'](a148_0x41755e(0x13c));constructor(_0x2ac8f0){const _0x29e071=a148_0x41755e;this[_0x29e071(0x118)]=new LLMApiClient(_0x2ac8f0),this[_0x29e071(0x19e)]=_0x2ac8f0;}['getDefaultProjectName'](){const _0x3e21e5=getSanitizedUsername();return'tdx_default_'+_0x3e21e5;}async['setCurrentProject'](_0x321839){const _0x2704d7=a148_0x41755e,{projectId:_0x593607}=await this['resolveProjectName'](_0x321839);this[_0x2704d7(0xf1)]=_0x593607;}[a148_0x41755e(0x141)](){return this['currentProjectId'];}async['setDefaultAgent'](_0x484bf2){const _0x1768d6=a148_0x41755e,_0x410a9b=this[_0x1768d6(0x19e)]['profile'];let _0x21b09f,_0x346c7f;if(_0x484bf2[_0x1768d6(0x1c3)]('/')){const _0x2a1d26=_0x484bf2[_0x1768d6(0x186)]('/');if(_0x2a1d26[_0x1768d6(0xee)]!==0x2)throw new SDKError(ErrorCode[_0x1768d6(0x178)],_0x1768d6(0x18d)+_0x484bf2,undefined,{'helpText':_0x1768d6(0x119)});const [_0x1139b8,_0xf08d36]=_0x2a1d26;_0x21b09f=await this[_0x1768d6(0xff)](_0x1139b8),_0x346c7f=_0xf08d36;}else _0x21b09f=this['currentProjectId']||(await this[_0x1768d6(0x167)]())['id'],_0x346c7f=_0x484bf2;const _0x2f80a2=await this[_0x1768d6(0x17c)](_0x346c7f,_0x21b09f),_0x52871e=await this[_0x1768d6(0x118)][_0x1768d6(0xe3)](_0x2f80a2);writeCachedLLMAgent(_0x52871e[_0x1768d6(0x197)]['name'],_0x2f80a2,_0x21b09f,_0x410a9b);}['getDefaultAgent'](){const _0x1ee234=a148_0x41755e,_0x4bd856=this[_0x1ee234(0x19e)]['profile'];return readCachedLLMAgent(_0x4bd856)||undefined;}['clearDefaultAgent'](){const _0x22ab5b=a148_0x41755e,_0x4cda77=this[_0x22ab5b(0x19e)][_0x22ab5b(0xe1)];clearCachedLLMAgent(_0x4cda77);}async[a148_0x41755e(0x18f)](){const _0x568d95=a148_0x41755e,_0x1a12c6=await this[_0x568d95(0x118)]['getUserSettings']();return toModelInfos(_0x1a12c6);}async[a148_0x41755e(0x104)](_0x2941dd){const _0x2c1bc1=a148_0x41755e;return await this[_0x2c1bc1(0x118)][_0x2c1bc1(0x104)](_0x2941dd);}async['deleteProject'](_0x41b8b1){const _0x2b1301=a148_0x41755e,{projectId:_0x59637c}=await this[_0x2b1301(0x117)](_0x41b8b1);await this[_0x2b1301(0x118)][_0x2b1301(0x1bc)](_0x59637c);}async[a148_0x41755e(0x14f)](_0x5732f9=0x32){return await this['client']['listProjects'](_0x5732f9);}async[a148_0x41755e(0x167)](_0x360693){const _0x48c792=a148_0x41755e,_0x5c72ce=_0x360693||this['getDefaultProjectName'](),_0x3db6fe=this['context'][_0x48c792(0xe1)];if(!_0x360693){const _0x1b4e8d=readCachedLLMProject(_0x3db6fe);if(_0x1b4e8d&&_0x1b4e8d[_0x48c792(0xf0)]===_0x5c72ce)try{const _0x138bd1=await this[_0x48c792(0x118)][_0x48c792(0x1cd)](_0x1b4e8d['id']);if(_0x138bd1['attributes']['name']===_0x5c72ce)return _0x138bd1;}catch{}}const _0x5d7ec4=await this['client']['listProjects'](),_0x20c984=_0x5d7ec4[_0x48c792(0x1e4)](_0x158282=>_0x158282[_0x48c792(0x197)][_0x48c792(0xf0)]===_0x5c72ce);if(_0x20c984)return!_0x360693&&writeCachedLLMProject(_0x5c72ce,_0x20c984['id'],_0x3db6fe),_0x20c984;const _0x399273=await this['client']['createProject']({'name':_0x5c72ce,'description':_0x48c792(0x1a8)+getSanitizedUsername()+')'});return!_0x360693&&writeCachedLLMProject(_0x5c72ce,_0x399273['id'],_0x3db6fe),_0x399273;}async[a148_0x41755e(0xff)](_0x12c38d){const _0x3314e8=a148_0x41755e,_0x570eba=await this[_0x3314e8(0x118)]['listProjects'](),_0x56e969=_0x570eba[_0x3314e8(0x182)](_0xe0212a=>_0xe0212a[_0x3314e8(0x197)][_0x3314e8(0xf0)]===_0x12c38d);if(_0x56e969[_0x3314e8(0xee)]===0x0)throw new SDKError(ErrorCode[_0x3314e8(0xd2)],'Project\x20not\x20found:\x20'+_0x12c38d,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x56e969[_0x3314e8(0xee)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x3314e8(0x1d8)+_0x12c38d+'\x27.\x20This\x20should\x20not\x20happen.');return _0x56e969[0x0]['id'];}async[a148_0x41755e(0x117)](_0x2d0b05){const _0x3dbfe5=a148_0x41755e,_0x575700=await this[_0x3dbfe5(0x118)]['listProjects'](),_0x544450=_0x575700[_0x3dbfe5(0x1e4)](_0x456a38=>_0x456a38[_0x3dbfe5(0x197)][_0x3dbfe5(0xf0)]===_0x2d0b05);if(_0x544450)return{'projectId':_0x544450['id'],'project':_0x544450};throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x3dbfe5(0x144)+_0x2d0b05,undefined,{'helpText':_0x3dbfe5(0x14d)});}async['getOrCreateDefaultAgent'](_0x2d3d1f=a148_0x41755e(0x17b),_0x3cb4d0=0x0,_0xaa1661){const _0x2ce578=a148_0x41755e,_0x57908b=0xa;let _0x29e09b=0x0,_0x10cdab;while(_0x29e09b<_0x57908b){try{const _0xda5053=await this['getOrCreateDefaultProject'](_0x10cdab),_0x18f122=_0xda5053['id'],_0x1efc28=[_0x2ce578(0x1a9),_0x2ce578(0x15d),_0x2ce578(0x194),'medium','high'],_0xe67c26=_0x3cb4d0===0x0?_0x2ce578(0x1b8)+_0x2d3d1f:_0x2ce578(0x1b8)+_0x2d3d1f+'_reasoning_'+_0x1efc28[_0x3cb4d0],_0xbfda50=await this[_0x2ce578(0x118)]['listAgents'](_0x18f122),_0x14c553=_0xbfda50[_0x2ce578(0x1e4)](_0x21799e=>_0x21799e['attributes'][_0x2ce578(0xf0)]===_0xe67c26);if(_0x14c553)return _0x14c553;const _0x4b9706=_0x3cb4d0>0x0?0x1:_0xaa1661;return await this[_0x2ce578(0x118)][_0x2ce578(0x140)]({'name':_0xe67c26,'projectId':_0x18f122,'modelType':_0x2d3d1f,'systemPrompt':'','temperature':_0x4b9706,'reasoningEffort':_0x3cb4d0>0x0?_0x3cb4d0:undefined});}catch(_0x49b1b9){if(_0x49b1b9 instanceof HTTPClientError){const _0x194cb3=_0x49b1b9[_0x2ce578(0x10c)];if(_0x194cb3>=0x190&&_0x194cb3<0x1f4){if(_0x194cb3===0x191)throw new SDKError(ErrorCode[_0x2ce578(0x199)],_0x2ce578(0x1bd),_0x49b1b9);else{if(_0x194cb3===0x193)throw new SDKError(ErrorCode[_0x2ce578(0xf2)],_0x2ce578(0x152),_0x49b1b9);}throw _0x49b1b9;}}if(errorContains(_0x49b1b9,_0x2ce578(0x1d0),_0x2ce578(0x169),_0x2ce578(0x15f))){_0x29e09b++;if(_0x29e09b>=_0x57908b)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x2ce578(0x16b)+_0x57908b+_0x2ce578(0x121),_0x49b1b9);const _0x101598=this['getDefaultProjectName']();_0x10cdab=_0x101598+'_'+generateRandomHex();continue;}throw _0x49b1b9;}}throw new SDKError(ErrorCode['INTERNAL'],'Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts');}async['resolveAgentId'](_0x49a74e,_0x6a9a83){const _0x18c4b4=a148_0x41755e,_0x4c00ad=_0x6a9a83||this[_0x18c4b4(0xf1)],_0x5f1946=await this[_0x18c4b4(0x118)][_0x18c4b4(0x18c)](_0x4c00ad),_0x4c781c=_0x5f1946[_0x18c4b4(0x182)](_0x2689c0=>_0x2689c0['attributes'][_0x18c4b4(0xf0)]===_0x49a74e);if(_0x4c781c['length']===0x0){const _0x55f20b=_0x4c00ad?_0x18c4b4(0x146)+_0x4c00ad:'';throw new SDKError(ErrorCode[_0x18c4b4(0x196)],_0x18c4b4(0x159)+_0x49a74e+_0x55f20b,undefined,{'helpText':_0x4c00ad?_0x18c4b4(0xd6):'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.'});}if(_0x4c781c['length']>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x18c4b4(0x13a)+_0x49a74e+_0x18c4b4(0x1b4));return _0x4c781c[0x0]['id'];}async[a148_0x41755e(0x183)](_0x58d9d6){const _0x58192a=a148_0x41755e,_0x259745=_0x58d9d6||this[_0x58192a(0xf1)];return await this[_0x58192a(0x118)][_0x58192a(0x18c)](_0x259745);}async[a148_0x41755e(0x133)](_0x53dedb){const _0x2efdec=a148_0x41755e;return await this[_0x2efdec(0x118)][_0x2efdec(0x19f)](_0x53dedb);}async[a148_0x41755e(0x1af)](_0x19aed3){const _0x4c4224=a148_0x41755e;return await this[_0x4c4224(0x118)][_0x4c4224(0xe3)](_0x19aed3);}async[a148_0x41755e(0x140)](_0x2e8d2c){const _0x5aa8fb=a148_0x41755e;return await this['client'][_0x5aa8fb(0x140)](_0x2e8d2c);}async['updateAgent'](_0x47a583,_0x2d437b){const _0x5f284b=a148_0x41755e;return await this[_0x5f284b(0x118)][_0x5f284b(0x13d)](_0x47a583,_0x2d437b);}async[a148_0x41755e(0x18e)](_0x3e8eb7){const _0x5bb55e=a148_0x41755e;await this['client'][_0x5bb55e(0x18e)](_0x3e8eb7);}async[a148_0x41755e(0x142)](_0x29b261){const _0x4d907f=a148_0x41755e;return await this[_0x4d907f(0x118)][_0x4d907f(0x142)]({'agentId':_0x29b261});}async*[a148_0x41755e(0xce)](_0x22d40a,_0x24d3ad){const _0x58a5e5=a148_0x41755e;let _0x39f331=_0x24d3ad?.[_0x58a5e5(0x191)];const _0x45b8ca=_0x24d3ad?.['agentId'];if(!_0x39f331){if(!_0x45b8ca)throw new Error(_0x58a5e5(0x124));const _0x3c1777=await this['client'][_0x58a5e5(0x142)]({'agentId':_0x45b8ca});_0x39f331=_0x3c1777['id'],yield{'type':'metadata','data':{'chatId':_0x39f331,'agentId':_0x45b8ca,'projectId':_0x3c1777[_0x58a5e5(0x197)][_0x58a5e5(0xf4)]}};}for await(const _0x3fe238 of this[_0x58a5e5(0x118)]['continueChat'](_0x39f331,_0x22d40a,_0x24d3ad?.['signal'])){yield{'type':_0x58a5e5(0xf5),'data':_0x3fe238};}}async[a148_0x41755e(0x134)](_0x34edfe=0x32){const _0x40d9bb=a148_0x41755e;return await this[_0x40d9bb(0x118)][_0x40d9bb(0x1e0)](_0x34edfe);}async['history'](_0x32382d){const _0x99b7c7=a148_0x41755e;return await this['client'][_0x99b7c7(0x156)](_0x32382d);}async[a148_0x41755e(0x173)](_0x4bc713){const _0x47c59a=a148_0x41755e;return await this['client'][_0x47c59a(0x173)](_0x4bc713);}async[a148_0x41755e(0x149)](_0x5eba55){const _0x49b2d1=a148_0x41755e;return await this[_0x49b2d1(0x118)][_0x49b2d1(0x1d5)](_0x5eba55);}async[a148_0x41755e(0x12d)](_0x38164f,_0x3eca18,_0x543e9b){const _0x2fd162=a148_0x41755e,_0x187d54=_0x543e9b?.['dryRun']??![],{projectId:_0x35fc02,project:_0x47fa06}=await this[_0x2fd162(0x117)](_0x38164f),_0x1734c7=_0x47fa06[_0x2fd162(0x197)][_0x2fd162(0xf0)],_0x3e0532=_0x3eca18||_0x1734c7+_0x2fd162(0xd5);if(a148_0x1a108a['existsSync'](_0x3e0532)&&!_0x187d54)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x2fd162(0x188)+_0x3e0532,undefined,{'helpText':_0x2fd162(0x1d1)});const _0x22a246=await this[_0x2fd162(0x118)][_0x2fd162(0x19f)](_0x35fc02),_0x4a4613=await this[_0x2fd162(0x118)][_0x2fd162(0x13b)](_0x35fc02),_0x275a5b=await this['client'][_0x2fd162(0x1c2)](_0x35fc02),_0xf73736=await this[_0x2fd162(0x118)][_0x2fd162(0x1e7)](_0x35fc02);if(!_0x187d54){a148_0x1a108a['mkdirSync'](_0x3e0532,{'recursive':!![]});const _0x1e18db={'version':_0x2fd162(0x17d),'exportedAt':new Date()[_0x2fd162(0xfb)](),'exportedFrom':{'site':this[_0x2fd162(0x19e)][_0x2fd162(0x1c5)],'projectId':_0x35fc02,'projectName':_0x1734c7},'project':_0x47fa06};a148_0x1a108a[_0x2fd162(0x1c6)](a148_0x55bc74[_0x2fd162(0x16c)](_0x3e0532,_0x2fd162(0x198)),JSON[_0x2fd162(0x1c4)](_0x1e18db,null,0x2)),a148_0x1a108a[_0x2fd162(0x1c6)](a148_0x55bc74[_0x2fd162(0x16c)](_0x3e0532,_0x2fd162(0xd3)),JSON[_0x2fd162(0x1c4)](_0x22a246,null,0x2)),a148_0x1a108a[_0x2fd162(0x1c6)](a148_0x55bc74[_0x2fd162(0x16c)](_0x3e0532,_0x2fd162(0x1e5)),JSON[_0x2fd162(0x1c4)](_0x4a4613,null,0x2)),a148_0x1a108a[_0x2fd162(0x1c6)](a148_0x55bc74[_0x2fd162(0x16c)](_0x3e0532,'prompts.json'),JSON[_0x2fd162(0x1c4)](_0x275a5b,null,0x2)),a148_0x1a108a[_0x2fd162(0x1c6)](a148_0x55bc74[_0x2fd162(0x16c)](_0x3e0532,_0x2fd162(0xef)),JSON[_0x2fd162(0x1c4)](_0xf73736,null,0x2));}return{'projectName':_0x1734c7,'outputDir':_0x3e0532,'counts':{'agents':_0x22a246[_0x2fd162(0xee)],'knowledgeBases':_0x4a4613[_0x2fd162(0xee)],'prompts':_0x275a5b[_0x2fd162(0xee)],'integrations':_0xf73736['length']}};}async['restoreProject'](_0x3eb7f7,_0x49162b){const _0x1841e2=a148_0x41755e,_0x278db1=_0x49162b?.[_0x1841e2(0xe0)]??![],_0x17c995=this[_0x1841e2(0x1e9)](_0x3eb7f7),_0x3582bd=_0x17c995[_0x1841e2(0x1a7)][_0x1841e2(0x1c5)],_0x1c00ce=this[_0x1841e2(0x19e)][_0x1841e2(0x1c5)],_0x5b9aa6=_0x3582bd!==_0x1c00ce?_0x3582bd:undefined,_0x45c156=this['loadJsonFile'](a148_0x55bc74[_0x1841e2(0x16c)](_0x3eb7f7,'agents.json'),[]),_0x242eb4=this[_0x1841e2(0xe8)](a148_0x55bc74[_0x1841e2(0x16c)](_0x3eb7f7,_0x1841e2(0x1e5)),[]),_0x1b06b0=this[_0x1841e2(0xe8)](a148_0x55bc74[_0x1841e2(0x16c)](_0x3eb7f7,_0x1841e2(0x1b3)),[]),_0x4c9f5c=this['loadJsonFile'](a148_0x55bc74['join'](_0x3eb7f7,_0x1841e2(0xef)),[]),_0x12fc5e=_0x49162b?.[_0x1841e2(0xf0)]||_0x17c995[_0x1841e2(0x1a7)]['projectName'];if(_0x278db1){const _0x5e4483=new Map(),_0x539af4=[..._0x45c156],_0x24e941=_0x45c156[_0x1841e2(0xee)]+0x1;let _0x1db0c4=0x0;while(_0x539af4[_0x1841e2(0xee)]>0x0&&_0x1db0c4<_0x24e941){_0x1db0c4++;const _0xa72484=[];for(const _0x1f1508 of _0x539af4){canCreateAgent(_0x1f1508,_0x5e4483)?_0x5e4483[_0x1841e2(0x157)](_0x1f1508['id'],'dry-run-'+_0x1f1508['id']):_0xa72484[_0x1841e2(0x137)](_0x1f1508);}if(_0xa72484[_0x1841e2(0xee)]===_0x539af4[_0x1841e2(0xee)])throw new SDKError(ErrorCode[_0x1841e2(0xdd)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x1841e2(0x1cc)});_0x539af4[_0x1841e2(0xee)]=0x0,_0x539af4[_0x1841e2(0x137)](..._0xa72484);}const _0x2618a5=_0x1b06b0[_0x1841e2(0x182)](_0x196344=>_0x5e4483[_0x1841e2(0x180)](_0x196344['attributes'][_0x1841e2(0xd9)]))[_0x1841e2(0xee)];return{'projectName':_0x12fc5e,'projectId':'(dry-run)','counts':{'agents':_0x45c156[_0x1841e2(0xee)],'knowledgeBases':_0x242eb4['length'],'prompts':_0x2618a5,'integrations':_0x4c9f5c[_0x1841e2(0xee)]},'sourceSite':_0x5b9aa6};}const _0x295d95=await this[_0x1841e2(0x118)][_0x1841e2(0x104)]({'name':_0x12fc5e,'description':_0x17c995[_0x1841e2(0x10b)][_0x1841e2(0x197)][_0x1841e2(0x105)]}),_0x9add02=_0x295d95['id'],_0x4afbdf=new Map(),_0x5cdab1=new Map(),_0x1b6721=new Map();for(const _0x4a00f7 of _0x242eb4){const _0x2d5181=await this[_0x1841e2(0x118)][_0x1841e2(0x1b0)]({'projectId':_0x9add02,'name':_0x4a00f7[_0x1841e2(0x197)]['name'],'tdDatabaseName':_0x4a00f7[_0x1841e2(0x197)][_0x1841e2(0x1ad)],'tables':_0x4a00f7['attributes'][_0x1841e2(0xd1)]});_0x4afbdf[_0x1841e2(0x157)](_0x4a00f7['id'],_0x2d5181['id']);}const _0x38b249=[..._0x45c156],_0x1afbdd=_0x45c156[_0x1841e2(0xee)]+0x1;let _0x49f07f=0x0;while(_0x38b249[_0x1841e2(0xee)]>0x0&&_0x49f07f<_0x1afbdd){_0x49f07f++;const _0xdc64a=[];for(const _0x2a7ec2 of _0x38b249){if(canCreateAgent(_0x2a7ec2,_0x5cdab1)){const _0x98a917=remapToolIds(_0x2a7ec2['attributes'][_0x1841e2(0x1d7)],_0x4afbdf,_0x5cdab1),_0x50cdcd=remapVariableIds(_0x2a7ec2[_0x1841e2(0x197)][_0x1841e2(0x1a4)],_0x4afbdf),_0x5282e8=await this[_0x1841e2(0x118)][_0x1841e2(0x193)]({'name':_0x2a7ec2[_0x1841e2(0x197)]['name'],'projectId':_0x9add02,'systemPrompt':_0x2a7ec2['attributes'][_0x1841e2(0x177)],'starterMessage':_0x2a7ec2[_0x1841e2(0x197)][_0x1841e2(0x19d)],'modelType':migrateModelType(_0x2a7ec2[_0x1841e2(0x197)][_0x1841e2(0x17e)]),'maxToolIterations':_0x2a7ec2['attributes'][_0x1841e2(0x16a)],'temperature':_0x2a7ec2['attributes'][_0x1841e2(0x172)],'reasoningEffort':_0x2a7ec2[_0x1841e2(0x197)]['reasoningEffort'],'outputs':_0x2a7ec2[_0x1841e2(0x197)][_0x1841e2(0xe2)],'tools':_0x98a917,'variables':_0x50cdcd});_0x5cdab1[_0x1841e2(0x157)](_0x2a7ec2['id'],_0x5282e8['id']);}else _0xdc64a[_0x1841e2(0x137)](_0x2a7ec2);}if(_0xdc64a[_0x1841e2(0xee)]===_0x38b249[_0x1841e2(0xee)])throw new SDKError(ErrorCode['INTERNAL'],_0x1841e2(0x17a),undefined,{'helpText':_0x1841e2(0x1cc)});_0x38b249[_0x1841e2(0xee)]=0x0,_0x38b249[_0x1841e2(0x137)](..._0xdc64a);}for(const _0x11cf01 of _0x1b06b0){const _0x14a259=_0x5cdab1['get'](_0x11cf01[_0x1841e2(0x197)]['agentId']);if(!_0x14a259)continue;const _0x6b67d1=await this[_0x1841e2(0x118)]['createPrompt']({'projectId':_0x9add02,'agentId':_0x14a259,'name':_0x11cf01[_0x1841e2(0x197)][_0x1841e2(0xf0)],'systemPrompt':_0x11cf01['attributes'][_0x1841e2(0x177)],'template':_0x11cf01[_0x1841e2(0x197)][_0x1841e2(0x11d)],'jsonSchemaHint':_0x11cf01[_0x1841e2(0x197)][_0x1841e2(0xe6)]});_0x1b6721[_0x1841e2(0x157)](_0x11cf01['id'],_0x6b67d1['id']);}for(const _0x25e84e of _0x4c9f5c){const _0x4112b1=_0x25e84e[_0x1841e2(0x197)]['actions'][_0x1841e2(0x1db)](_0x904e3e=>({..._0x904e3e,'promptId':_0x1b6721[_0x1841e2(0x100)](_0x904e3e[_0x1841e2(0x127)])||_0x904e3e['promptId']}));await this[_0x1841e2(0x118)][_0x1841e2(0xf9)]({'projectId':_0x9add02,'serviceType':_0x25e84e['attributes']['serviceType'],'actions':_0x4112b1,'slackMessageMode':_0x25e84e[_0x1841e2(0x197)][_0x1841e2(0x145)],'chatIgnoreManagedActions':_0x25e84e[_0x1841e2(0x197)]['chatIgnoreManagedActions'],'chatWelcomeMessage':_0x25e84e[_0x1841e2(0x197)][_0x1841e2(0x1bb)],'webhookCorsOrigins':_0x25e84e[_0x1841e2(0x197)][_0x1841e2(0xd4)]});}return{'projectName':_0x12fc5e,'projectId':_0x9add02,'counts':{'agents':_0x5cdab1[_0x1841e2(0x1e6)],'knowledgeBases':_0x4afbdf[_0x1841e2(0x1e6)],'prompts':_0x1b6721[_0x1841e2(0x1e6)],'integrations':_0x4c9f5c[_0x1841e2(0xee)]},'sourceSite':_0x5b9aa6};}[a148_0x41755e(0xe8)](_0x4ae894,_0xf6b58d){const _0x2ebcca=a148_0x41755e;if(!a148_0x1a108a[_0x2ebcca(0x16e)](_0x4ae894))return _0xf6b58d;return JSON[_0x2ebcca(0x181)](a148_0x1a108a[_0x2ebcca(0xdc)](_0x4ae894,_0x2ebcca(0xfd)));}[a148_0x41755e(0x1e9)](_0x37b0ff){const _0x6b6bee=a148_0x41755e;if(!a148_0x1a108a[_0x6b6bee(0x16e)](_0x37b0ff))throw new SDKError(ErrorCode[_0x6b6bee(0x11a)],'Backup\x20folder\x20not\x20found:\x20'+_0x37b0ff,undefined,{'helpText':_0x6b6bee(0x11b)});const _0x354dc5=a148_0x55bc74[_0x6b6bee(0x16c)](_0x37b0ff,_0x6b6bee(0x198));if(!a148_0x1a108a['existsSync'](_0x354dc5))throw new SDKError(ErrorCode[_0x6b6bee(0x178)],_0x6b6bee(0xfe)+_0x37b0ff,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x42445a=JSON['parse'](a148_0x1a108a['readFileSync'](_0x354dc5,'utf-8'));if(!isSupportedBackupVersion(_0x42445a[_0x6b6bee(0x1a2)]))throw new SDKError(ErrorCode[_0x6b6bee(0x178)],_0x6b6bee(0x10d)+_0x42445a[_0x6b6bee(0x1a2)],undefined,{'helpText':_0x6b6bee(0x163)});return _0x42445a;}async[a148_0x41755e(0x107)](_0x58fb32,_0xc3d713,_0x422b32){const _0x2e7b73=a148_0x41755e,{projectId:_0x2403f4,project:_0x1a3728}=await this[_0x2e7b73(0x117)](_0x58fb32),_0x222127=_0x1a3728['attributes'][_0x2e7b73(0xf0)];let _0x40e87c;if(_0xc3d713)_0x40e87c=_0xc3d713;else{const _0x54f569=a148_0x55bc74[_0x2e7b73(0x16c)](process[_0x2e7b73(0x185)](),_0x2e7b73(0x183)),_0x502e4a=getSanitizedPathWithMigration(_0x54f569,_0x222127);_0x502e4a[_0x2e7b73(0x153)]&&this[_0x2e7b73(0x1be)]['info'](_0x2e7b73(0x189)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x502e4a[_0x2e7b73(0x130)])+_0x2e7b73(0x151)+a148_0x55bc74['basename'](_0x502e4a['path'])),_0x40e87c=_0x502e4a[_0x2e7b73(0x11f)];}const _0xd14bea=await this[_0x2e7b73(0x118)][_0x2e7b73(0x19f)](_0x2403f4),_0x4cd179=await this[_0x2e7b73(0x118)]['listKnowledgeBases'](_0x2403f4),_0x196dcb=await this['client']['listTextKnowledgeBases'](_0x2403f4),_0x27ecde=await safeListOrEmpty(()=>this[_0x2e7b73(0x118)][_0x2e7b73(0x1c9)](_0x2403f4)),_0x461b8a=await safeListOrEmpty(()=>this['client'][_0x2e7b73(0x166)](_0x2403f4)),_0x19e55c=await this[_0x2e7b73(0x118)]['listPrompts'](_0x2403f4),_0x50f967=await this[_0x2e7b73(0x118)][_0x2e7b73(0x1e7)](_0x2403f4),_0x21105c=await safeListOrEmpty(()=>this[_0x2e7b73(0x118)][_0x2e7b73(0x12e)](_0x2403f4)),_0x2bdcd1=await safeListOrEmpty(()=>this[_0x2e7b73(0x118)]['listExperimentalArtifacts'](_0x2403f4)),_0x576e97=await safeListOrEmpty(()=>this[_0x2e7b73(0x118)][_0x2e7b73(0x1cf)](_0x2403f4)),_0x4b2525=await safeListOrEmpty(()=>this[_0x2e7b73(0x118)][_0x2e7b73(0x1d6)](_0x2403f4)),_0x50851d=_0x50f967[_0x2e7b73(0x182)](_0x38406d=>!_0x38406d[_0x2e7b73(0x197)][_0x2e7b73(0x120)]&&SAFE_INTEGRATION_TYPES['includes'](_0x38406d['attributes']['serviceType'][_0x2e7b73(0x176)]())),_0x36c4ec=new Map(),_0x504617=new Map(),_0x57a185=new Map(),_0x14cf1e=new Map(),_0x32add0=new Map(),_0x2172b2=new Map(),_0x47d04f=new Map();for(const _0xe7f5d1 of _0xd14bea){_0x36c4ec[_0x2e7b73(0x157)](_0xe7f5d1['id'],_0xe7f5d1[_0x2e7b73(0x197)][_0x2e7b73(0xf0)]);}for(const _0x33cd93 of _0x4cd179){_0x504617[_0x2e7b73(0x157)](_0x33cd93['id'],_0x33cd93[_0x2e7b73(0x197)][_0x2e7b73(0xf0)]);}for(const _0xe6e14a of _0x196dcb){_0x57a185[_0x2e7b73(0x157)](_0xe6e14a['id'],_0xe6e14a['attributes'][_0x2e7b73(0xf0)]);}for(const _0x447512 of _0x27ecde){_0x14cf1e[_0x2e7b73(0x157)](_0x447512['id'],_0x447512[_0x2e7b73(0x197)]['name']);}for(const _0x30ee15 of _0x461b8a){_0x32add0[_0x2e7b73(0x157)](_0x30ee15['id'],_0x30ee15['attributes'][_0x2e7b73(0xf0)]);}for(const _0x133cb6 of _0x19e55c){_0x2172b2[_0x2e7b73(0x157)](_0x133cb6['id'],_0x133cb6[_0x2e7b73(0x197)]['name']);}for(const _0x1aadcc of _0x21105c){_0x47d04f[_0x2e7b73(0x157)](_0x1aadcc['id'],_0x1aadcc[_0x2e7b73(0x197)]['name']);}const _0x559674={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x504617,'TextKnowledgeBase':_0x57a185,'Agent':_0x36c4ec,'WebSearchTool':_0x32add0,'ImageGenerator':_0x14cf1e,'ExperimentalKnowledgeBase':_0x47d04f}),'resolvePromptName':async _0x371fe3=>_0x2172b2['get'](_0x371fe3),'onWarning':_0x173a0d=>this[_0x2e7b73(0x1be)][_0x2e7b73(0xed)](_0x173a0d)},_0x26420e={'projectName':_0x222127,'outputDir':_0x40e87c,'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}}},_0x38796b=[],_0x35ff3a=[];for(const _0x19955c of _0xd14bea){const _0x122e30=getSanitizedPathWithMigration(_0x40e87c,_0x19955c[_0x2e7b73(0x197)][_0x2e7b73(0xf0)]);_0x122e30[_0x2e7b73(0x153)]&&this['logger'][_0x2e7b73(0x171)]('Renamed\x20agent\x20folder:\x20'+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x122e30[_0x2e7b73(0x130)])+_0x2e7b73(0x151)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x122e30[_0x2e7b73(0x11f)]));const _0x120935=_0x122e30['path'],_0x2871f8=a148_0x55bc74[_0x2e7b73(0x16c)](_0x120935,'prompt.md'),_0x50368b=a148_0x55bc74[_0x2e7b73(0x16c)](_0x120935,_0x2e7b73(0xda)),_0x3d81d4=a148_0x55bc74[_0x2e7b73(0x16c)](_0x120935,_0x2e7b73(0x115)),{yaml:_0x50a2f2,systemPrompt:_0x31b373,starterMessage:_0x20899a}=await agentResponseToDef(_0x19955c,_0x559674),_0xac9e35=toAgentYamlString(_0x50a2f2),_0x49502a=!a148_0x1a108a[_0x2e7b73(0x16e)](_0x50368b);let _0x528b31=_0x49502a,_0x4a16e3;if(!_0x49502a){const _0x320c97=a148_0x1a108a['existsSync'](_0x2871f8)?a148_0x1a108a['readFileSync'](_0x2871f8,_0x2e7b73(0xfd)):'',_0x254cac=a148_0x1a108a[_0x2e7b73(0xdc)](_0x50368b,_0x2e7b73(0xfd)),_0x38634d=_0x2e7b73(0x175)+_0x320c97+_0x2e7b73(0x15b)+_0x254cac,_0x1df3aa=_0x2e7b73(0x175)+_0x31b373+_0x2e7b73(0x15b)+_0xac9e35,_0x5a8dcb=generateDiff(_0x38634d,_0x1df3aa);_0x528b31=hasChanges(_0x5a8dcb),_0x528b31&&(_0x4a16e3=formatDiffWithColors(_0x5a8dcb));}_0x38796b[_0x2e7b73(0x137)]({'path':_0x120935,'content':'','isDir':!![]}),_0x38796b[_0x2e7b73(0x137)]({'path':_0x2871f8,'content':_0x31b373}),_0x38796b[_0x2e7b73(0x137)]({'path':_0x50368b,'content':_0xac9e35});_0x20899a&&_0x20899a['includes']('\x0a')&&_0x38796b[_0x2e7b73(0x137)]({'path':_0x3d81d4,'content':_0x20899a});_0x26420e[_0x2e7b73(0x183)][_0x2e7b73(0x137)]({'agentName':_0x19955c[_0x2e7b73(0x197)]['name'],'outputPath':_0x120935,'isNew':_0x49502a,'hasChanges':_0x528b31,'diff':_0x4a16e3}),_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x183)]['total']++;if(_0x49502a)_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x183)][_0x2e7b73(0x17f)]++;else{if(_0x528b31)_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x183)][_0x2e7b73(0x10a)]++;else _0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x183)][_0x2e7b73(0x1cb)]++;}}for(const _0x1365b3 of _0x4cd179){if(_0x1365b3['attributes'][_0x2e7b73(0x120)])continue;const _0x4ba45e=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x40e87c),_0x1365b3[_0x2e7b73(0x197)][_0x2e7b73(0xf0)],_0x2e7b73(0x15c));_0x4ba45e[_0x2e7b73(0x153)]&&this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0x143)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x4ba45e[_0x2e7b73(0x130)])+'\x20→\x20'+a148_0x55bc74['basename'](_0x4ba45e[_0x2e7b73(0x11f)]));const _0x5722f5=_0x4ba45e[_0x2e7b73(0x11f)],_0xeea1ce=apiKnowledgeBaseToYaml(_0x1365b3),_0x4ce22f=toKnowledgeBaseYamlString(_0xeea1ce),_0x184896=!a148_0x1a108a[_0x2e7b73(0x16e)](_0x5722f5);let _0x55457d=_0x184896,_0x305618;if(!_0x184896){const _0x519dc5=a148_0x1a108a[_0x2e7b73(0xdc)](_0x5722f5,'utf-8'),_0xb9eefc=generateDiff(_0x519dc5,_0x4ce22f);_0x55457d=hasChanges(_0xb9eefc),_0x55457d&&(_0x305618=formatDiffWithColors(_0xb9eefc));}_0x38796b[_0x2e7b73(0x137)]({'path':_0x5722f5,'content':_0x4ce22f}),_0x26420e[_0x2e7b73(0x179)]['push']({'name':_0x1365b3[_0x2e7b73(0x197)]['name'],'outputPath':_0x5722f5,'isNew':_0x184896,'hasChanges':_0x55457d,'diff':_0x305618}),_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x179)]['total']++;if(_0x184896)_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x179)][_0x2e7b73(0x17f)]++;else{if(_0x55457d)_0x26420e[_0x2e7b73(0x1c8)]['knowledgeBases'][_0x2e7b73(0x10a)]++;else _0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x179)][_0x2e7b73(0x1cb)]++;}}for(const _0x325f6e of _0x196dcb){if(_0x325f6e[_0x2e7b73(0x197)][_0x2e7b73(0x120)])continue;const _0x835290=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x40e87c),_0x325f6e[_0x2e7b73(0x197)][_0x2e7b73(0xf0)],_0x2e7b73(0x1dc));_0x835290['renamed']&&this['logger'][_0x2e7b73(0x171)](_0x2e7b73(0x112)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x835290['oldPath'])+_0x2e7b73(0x151)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x835290[_0x2e7b73(0x11f)]));const _0x5c8a30=_0x835290[_0x2e7b73(0x11f)],_0x326b9e=toTextKnowledgeBaseMd(_0x325f6e[_0x2e7b73(0x197)][_0x2e7b73(0xf0)],_0x325f6e[_0x2e7b73(0x197)][_0x2e7b73(0x11c)]),_0x11896d=!a148_0x1a108a[_0x2e7b73(0x16e)](_0x5c8a30);let _0x32fd0a=_0x11896d,_0x54e73f;if(!_0x11896d){const _0x18e38e=a148_0x1a108a['readFileSync'](_0x5c8a30,_0x2e7b73(0xfd)),_0x4459df=generateDiff(_0x18e38e,_0x326b9e);_0x32fd0a=hasChanges(_0x4459df),_0x32fd0a&&(_0x54e73f=formatDiffWithColors(_0x4459df));}_0x38796b['push']({'path':_0x5c8a30,'content':_0x326b9e}),_0x26420e['textKnowledgeBases'][_0x2e7b73(0x137)]({'name':_0x325f6e['attributes'][_0x2e7b73(0xf0)],'outputPath':_0x5c8a30,'isNew':_0x11896d,'hasChanges':_0x32fd0a,'diff':_0x54e73f}),_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x170)]['total']++;if(_0x11896d)_0x26420e['counts'][_0x2e7b73(0x170)][_0x2e7b73(0x17f)]++;else{if(_0x32fd0a)_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x170)][_0x2e7b73(0x10a)]++;else _0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x170)][_0x2e7b73(0x1cb)]++;}}for(const _0x5baaff of _0x19e55c){if(_0x5baaff[_0x2e7b73(0x197)][_0x2e7b73(0x120)])continue;const _0x489701=getSanitizedPathWithMigration(getPromptsDir(_0x40e87c),_0x5baaff[_0x2e7b73(0x197)][_0x2e7b73(0xf0)],_0x2e7b73(0x15c));_0x489701[_0x2e7b73(0x153)]&&this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0x1d4)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x489701[_0x2e7b73(0x130)])+'\x20→\x20'+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x489701['path']));const _0x331d44=_0x489701[_0x2e7b73(0x11f)],_0x1008ee=await apiPromptToYaml(_0x5baaff,_0x559674);if(!_0x1008ee)continue;const _0x5e0244=toPromptYamlString(_0x1008ee),_0x120962=!a148_0x1a108a[_0x2e7b73(0x16e)](_0x331d44);let _0x250f67=_0x120962,_0x21165b;if(!_0x120962){const _0x1e192d=a148_0x1a108a[_0x2e7b73(0xdc)](_0x331d44,'utf-8'),_0x44fb61=generateDiff(_0x1e192d,_0x5e0244);_0x250f67=hasChanges(_0x44fb61),_0x250f67&&(_0x21165b=formatDiffWithColors(_0x44fb61));}_0x38796b[_0x2e7b73(0x137)]({'path':_0x331d44,'content':_0x5e0244}),_0x26420e['prompts'][_0x2e7b73(0x137)]({'name':_0x5baaff[_0x2e7b73(0x197)][_0x2e7b73(0xf0)],'outputPath':_0x331d44,'isNew':_0x120962,'hasChanges':_0x250f67,'diff':_0x21165b}),_0x26420e[_0x2e7b73(0x1c8)]['prompts'][_0x2e7b73(0xea)]++;if(_0x120962)_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x1e2)][_0x2e7b73(0x17f)]++;else{if(_0x250f67)_0x26420e['counts'][_0x2e7b73(0x1e2)][_0x2e7b73(0x10a)]++;else _0x26420e['counts'][_0x2e7b73(0x1e2)][_0x2e7b73(0x1cb)]++;}}for(const _0x1ca4c8 of _0x50851d){const _0x1446bc=_0x1ca4c8[_0x2e7b73(0x197)][_0x2e7b73(0xf3)][_0x2e7b73(0x176)](),_0x4beb91=getSanitizedPathWithMigration(getIntegrationsDir(_0x40e87c),_0x1446bc,_0x2e7b73(0x15c));_0x4beb91[_0x2e7b73(0x153)]&&this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0xd0)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x4beb91['oldPath'])+_0x2e7b73(0x151)+a148_0x55bc74['basename'](_0x4beb91[_0x2e7b73(0x11f)]));const _0x322e79=_0x4beb91[_0x2e7b73(0x11f)],_0x9d839a=await apiIntegrationToYaml(_0x1ca4c8,_0x559674),_0x5e5045=toIntegrationYamlString(_0x9d839a),_0x1dc2f4=!a148_0x1a108a[_0x2e7b73(0x16e)](_0x322e79);let _0x49c13f=_0x1dc2f4,_0x4cc9d0;if(!_0x1dc2f4){const _0x1fef67=a148_0x1a108a['readFileSync'](_0x322e79,_0x2e7b73(0xfd)),_0x580252=generateDiff(_0x1fef67,_0x5e5045);_0x49c13f=hasChanges(_0x580252),_0x49c13f&&(_0x4cc9d0=formatDiffWithColors(_0x580252));}_0x38796b[_0x2e7b73(0x137)]({'path':_0x322e79,'content':_0x5e5045}),_0x26420e[_0x2e7b73(0x195)][_0x2e7b73(0x137)]({'name':_0x1446bc,'outputPath':_0x322e79,'isNew':_0x1dc2f4,'hasChanges':_0x49c13f,'diff':_0x4cc9d0}),_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x195)][_0x2e7b73(0xea)]++;if(_0x1dc2f4)_0x26420e['counts'][_0x2e7b73(0x195)][_0x2e7b73(0x17f)]++;else{if(_0x49c13f)_0x26420e[_0x2e7b73(0x1c8)]['integrations'][_0x2e7b73(0x10a)]++;else _0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x195)]['unchanged']++;}}for(const _0x295f7a of _0x21105c){if(_0x295f7a[_0x2e7b73(0x197)][_0x2e7b73(0x120)])continue;const _0x181d19=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x40e87c),_0x295f7a['attributes'][_0x2e7b73(0xf0)]);_0x181d19['renamed']&&this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0x12b)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x181d19[_0x2e7b73(0x130)])+_0x2e7b73(0x151)+a148_0x55bc74['basename'](_0x181d19[_0x2e7b73(0x11f)]));const _0x3c52d9=_0x181d19[_0x2e7b73(0x11f)],_0x264c38=a148_0x55bc74[_0x2e7b73(0x16c)](_0x3c52d9,sanitizeForFilesystem(_0x295f7a[_0x2e7b73(0x197)]['name'])+_0x2e7b73(0x15c)),_0x2830b5=a148_0x55bc74[_0x2e7b73(0x16c)](_0x3c52d9,_0x2e7b73(0xcc)),_0x357f7e=apiExperimentalKnowledgeBaseToYaml(_0x295f7a),_0x31df26=toExperimentalKnowledgeBaseYamlString(_0x357f7e),_0x344098=!a148_0x1a108a['existsSync'](_0x3c52d9);let _0x259fe7=_0x344098,_0x2d0198,_0x344a83=_0x31df26;const _0x2b9846=[..._0x357f7e[_0x2e7b73(0xcc)]][_0x2e7b73(0x1b5)]((_0x152dd0,_0x153309)=>_0x152dd0['name'][_0x2e7b73(0x1c1)](_0x153309[_0x2e7b73(0xf0)]));for(const _0x1a57bd of _0x2b9846){_0x344a83+=_0x2e7b73(0xd7)+_0x1a57bd['name']+_0x2e7b73(0x13f)+_0x1a57bd[_0x2e7b73(0x1b1)]+_0x2e7b73(0x1da)+_0x1a57bd[_0x2e7b73(0xf0)]+_0x2e7b73(0x13f)+_0x1a57bd[_0x2e7b73(0x109)]+'\x0a';}if(!_0x344098){let _0x3561bb='';a148_0x1a108a[_0x2e7b73(0x16e)](_0x264c38)&&(_0x3561bb=a148_0x1a108a[_0x2e7b73(0xdc)](_0x264c38,_0x2e7b73(0xfd)));if(a148_0x1a108a[_0x2e7b73(0x16e)](_0x2830b5)){const _0x1b509c=a148_0x1a108a[_0x2e7b73(0x1c7)](_0x2830b5,{'withFileTypes':!![]}),_0x572402=_0x1b509c[_0x2e7b73(0x182)](_0x36609a=>_0x36609a[_0x2e7b73(0xdf)]())['sort']((_0x3e3529,_0x531e06)=>_0x3e3529[_0x2e7b73(0xf0)][_0x2e7b73(0x1c1)](_0x531e06[_0x2e7b73(0xf0)]));for(const _0x56b4d8 of _0x572402){const _0x519a12=a148_0x55bc74[_0x2e7b73(0x16c)](_0x2830b5,_0x56b4d8[_0x2e7b73(0xf0)],'code.js'),_0x42ec2f=a148_0x55bc74['join'](_0x2830b5,_0x56b4d8[_0x2e7b73(0xf0)],'json_schema.json');a148_0x1a108a[_0x2e7b73(0x16e)](_0x519a12)&&(_0x3561bb+='\x0a---\x20function:\x20'+_0x56b4d8[_0x2e7b73(0xf0)]+_0x2e7b73(0x13f)+a148_0x1a108a['readFileSync'](_0x519a12,'utf-8')+'\x0a'),a148_0x1a108a['existsSync'](_0x42ec2f)&&(_0x3561bb+=_0x2e7b73(0x13e)+_0x56b4d8[_0x2e7b73(0xf0)]+_0x2e7b73(0x13f)+a148_0x1a108a[_0x2e7b73(0xdc)](_0x42ec2f,'utf-8')+'\x0a');}}const _0x390838=generateDiff(_0x3561bb,_0x344a83);_0x259fe7=hasChanges(_0x390838),_0x259fe7&&(_0x2d0198=formatDiffWithColors(_0x390838));}_0x38796b[_0x2e7b73(0x137)]({'path':_0x3c52d9,'content':'','isDir':!![]}),_0x38796b[_0x2e7b73(0x137)]({'path':_0x264c38,'content':_0x31df26}),_0x38796b[_0x2e7b73(0x137)]({'path':_0x2830b5,'content':'','isDir':!![]});for(const _0xc92fb2 of _0x357f7e[_0x2e7b73(0xcc)]){const _0x533330=a148_0x55bc74[_0x2e7b73(0x16c)](_0x2830b5,sanitizeForFilesystem(_0xc92fb2[_0x2e7b73(0xf0)])),_0x19d58b=a148_0x55bc74[_0x2e7b73(0x16c)](_0x533330,_0x2e7b73(0x184)),_0x524d30=a148_0x55bc74[_0x2e7b73(0x16c)](_0x533330,'json_schema.json');_0x38796b[_0x2e7b73(0x137)]({'path':_0x533330,'content':'','isDir':!![]}),_0x38796b[_0x2e7b73(0x137)]({'path':_0x19d58b,'content':_0xc92fb2['code']}),_0x38796b['push']({'path':_0x524d30,'content':_0xc92fb2[_0x2e7b73(0x109)]});}if(a148_0x1a108a[_0x2e7b73(0x16e)](_0x2830b5)){const _0x1bb205=a148_0x1a108a[_0x2e7b73(0x1c7)](_0x2830b5,{'withFileTypes':!![]}),_0x964e08=new Set(_0x357f7e['functions'][_0x2e7b73(0x1db)](_0x59056e=>sanitizeForFilesystem(_0x59056e[_0x2e7b73(0xf0)])));for(const _0x5b1bc3 of _0x1bb205){if(_0x5b1bc3['isDirectory']()&&!_0x964e08['has'](_0x5b1bc3[_0x2e7b73(0xf0)])){const _0xde47a2=a148_0x55bc74[_0x2e7b73(0x16c)](_0x2830b5,_0x5b1bc3[_0x2e7b73(0xf0)]);_0x35ff3a[_0x2e7b73(0x137)]({'path':_0xde47a2,'isDir':!![]});}}}_0x26420e[_0x2e7b73(0x1b7)]['push']({'name':_0x295f7a[_0x2e7b73(0x197)]['name'],'outputPath':_0x3c52d9,'isNew':_0x344098,'hasChanges':_0x259fe7,'diff':_0x2d0198}),_0x26420e['counts']['experimentalKnowledgeBases'][_0x2e7b73(0xea)]++;if(_0x344098)_0x26420e['counts'][_0x2e7b73(0x1b7)][_0x2e7b73(0x17f)]++;else{if(_0x259fe7)_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x1b7)][_0x2e7b73(0x10a)]++;else _0x26420e[_0x2e7b73(0x1c8)]['experimentalKnowledgeBases'][_0x2e7b73(0x1cb)]++;}}for(const _0x48d48c of _0x2bdcd1){if(_0x48d48c[_0x2e7b73(0x197)]['isManaged'])continue;const _0x148d13=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x40e87c),_0x48d48c['attributes'][_0x2e7b73(0xf0)]);_0x148d13[_0x2e7b73(0x153)]&&this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0x126)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x148d13[_0x2e7b73(0x130)])+'\x20→\x20'+a148_0x55bc74['basename'](_0x148d13[_0x2e7b73(0x11f)]));const _0x20b369=_0x148d13[_0x2e7b73(0x11f)],_0x58aeaa=a148_0x55bc74[_0x2e7b73(0x16c)](_0x20b369,sanitizeForFilesystem(_0x48d48c[_0x2e7b73(0x197)][_0x2e7b73(0xf0)])+_0x2e7b73(0x15c)),_0x5f88b=a148_0x55bc74['join'](_0x20b369,_0x2e7b73(0x184)),_0x4470e5=a148_0x55bc74[_0x2e7b73(0x16c)](_0x20b369,_0x2e7b73(0x128)),_0x3fad96=apiExperimentalArtifactToYaml(_0x48d48c),_0x43b81d=toExperimentalArtifactYamlString(_0x3fad96),_0x3b5e63=!a148_0x1a108a[_0x2e7b73(0x16e)](_0x20b369);let _0x27ce0a=_0x3b5e63,_0x449ef5,_0x163406=_0x43b81d+(_0x2e7b73(0x147)+_0x3fad96['code']+'\x0a');const _0x2a499a=[..._0x3fad96[_0x2e7b73(0x128)]]['sort']((_0x12f076,_0x1b76e2)=>_0x12f076[_0x2e7b73(0x1ca)][_0x2e7b73(0x1c1)](_0x1b76e2[_0x2e7b73(0x1ca)]));for(const _0x52994a of _0x2a499a){_0x163406+=_0x2e7b73(0x15e)+_0x52994a[_0x2e7b73(0x1ca)]+_0x2e7b73(0x13f)+_0x52994a['text_content']+'\x0a';}if(!_0x3b5e63){let _0x446f01='';a148_0x1a108a[_0x2e7b73(0x16e)](_0x58aeaa)&&(_0x446f01=a148_0x1a108a[_0x2e7b73(0xdc)](_0x58aeaa,_0x2e7b73(0xfd)));a148_0x1a108a[_0x2e7b73(0x16e)](_0x5f88b)&&(_0x446f01+=_0x2e7b73(0x147)+a148_0x1a108a[_0x2e7b73(0xdc)](_0x5f88b,_0x2e7b73(0xfd))+'\x0a');if(a148_0x1a108a[_0x2e7b73(0x16e)](_0x4470e5)){const _0x2bda9e=a148_0x1a108a[_0x2e7b73(0x1c7)](_0x4470e5),_0x419173=_0x2bda9e[_0x2e7b73(0x182)](_0x20ac07=>{const _0x3de8c1=_0x2e7b73,_0x491c1c=a148_0x55bc74[_0x3de8c1(0x16c)](_0x4470e5,_0x20ac07);return a148_0x1a108a[_0x3de8c1(0x132)](_0x491c1c)[_0x3de8c1(0xe5)]();})['sort']((_0x3c117d,_0x244d4f)=>_0x3c117d[_0x2e7b73(0x1c1)](_0x244d4f));for(const _0x5560fe of _0x419173){const _0x5b8022=a148_0x55bc74['join'](_0x4470e5,_0x5560fe);_0x446f01+=_0x2e7b73(0x15e)+_0x5560fe+_0x2e7b73(0x13f)+a148_0x1a108a['readFileSync'](_0x5b8022,_0x2e7b73(0xfd))+'\x0a';}}const _0x599e1c=generateDiff(_0x446f01,_0x163406);_0x27ce0a=hasChanges(_0x599e1c),_0x27ce0a&&(_0x449ef5=formatDiffWithColors(_0x599e1c));}_0x38796b[_0x2e7b73(0x137)]({'path':_0x20b369,'content':'','isDir':!![]}),_0x38796b[_0x2e7b73(0x137)]({'path':_0x58aeaa,'content':_0x43b81d}),_0x38796b['push']({'path':_0x5f88b,'content':_0x3fad96[_0x2e7b73(0x1b1)]});if(_0x3fad96[_0x2e7b73(0x128)]['length']>0x0){_0x38796b[_0x2e7b73(0x137)]({'path':_0x4470e5,'content':'','isDir':!![]});for(const _0x4a7e69 of _0x3fad96[_0x2e7b73(0x128)]){const _0x42d5ae=a148_0x55bc74[_0x2e7b73(0x16c)](_0x4470e5,_0x4a7e69[_0x2e7b73(0x1ca)]);_0x38796b[_0x2e7b73(0x137)]({'path':_0x42d5ae,'content':_0x4a7e69[_0x2e7b73(0x15a)]});}}if(a148_0x1a108a[_0x2e7b73(0x16e)](_0x4470e5)){const _0x17c00b=a148_0x1a108a[_0x2e7b73(0x1c7)](_0x4470e5),_0x148417=new Set(_0x3fad96[_0x2e7b73(0x128)][_0x2e7b73(0x1db)](_0x5c9661=>_0x5c9661[_0x2e7b73(0x1ca)]));for(const _0x542b64 of _0x17c00b){const _0x19cbbf=a148_0x55bc74[_0x2e7b73(0x16c)](_0x4470e5,_0x542b64);a148_0x1a108a[_0x2e7b73(0x132)](_0x19cbbf)[_0x2e7b73(0xe5)]()&&!_0x148417[_0x2e7b73(0x180)](_0x542b64)&&_0x35ff3a['push']({'path':_0x19cbbf});}}_0x26420e[_0x2e7b73(0x10f)][_0x2e7b73(0x137)]({'name':_0x48d48c[_0x2e7b73(0x197)][_0x2e7b73(0xf0)],'outputPath':_0x20b369,'isNew':_0x3b5e63,'hasChanges':_0x27ce0a,'diff':_0x449ef5}),_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x10f)]['total']++;if(_0x3b5e63)_0x26420e['counts'][_0x2e7b73(0x10f)][_0x2e7b73(0x17f)]++;else{if(_0x27ce0a)_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x10f)]['updated']++;else _0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x10f)][_0x2e7b73(0x1cb)]++;}}for(const _0x448f0d of _0x576e97){const _0x24f630=getSanitizedPathWithMigration(getFormInterfacesDir(_0x40e87c),_0x448f0d[_0x2e7b73(0x197)]['name'],'.yml');_0x24f630[_0x2e7b73(0x153)]&&this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0x190)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x24f630['oldPath'])+_0x2e7b73(0x151)+a148_0x55bc74['basename'](_0x24f630[_0x2e7b73(0x11f)]));const _0x5384fd=_0x24f630[_0x2e7b73(0x11f)],_0x32c924=await apiFormInterfaceToYaml(_0x448f0d,_0x559674),_0x1558f9=toFormInterfaceYamlString(_0x32c924),_0xb8f8e5=!a148_0x1a108a[_0x2e7b73(0x16e)](_0x5384fd);let _0x3efc2d=_0xb8f8e5,_0x2f8d61;if(!_0xb8f8e5){const _0x2f66cf=a148_0x1a108a[_0x2e7b73(0xdc)](_0x5384fd,_0x2e7b73(0xfd)),_0x3dcfc4=generateDiff(_0x2f66cf,_0x1558f9);_0x3efc2d=hasChanges(_0x3dcfc4),_0x3efc2d&&(_0x2f8d61=formatDiffWithColors(_0x3dcfc4));}_0x38796b[_0x2e7b73(0x137)]({'path':_0x5384fd,'content':_0x1558f9}),_0x26420e[_0x2e7b73(0x18a)][_0x2e7b73(0x137)]({'name':_0x448f0d['attributes'][_0x2e7b73(0xf0)],'outputPath':_0x5384fd,'isNew':_0xb8f8e5,'hasChanges':_0x3efc2d,'diff':_0x2f8d61}),_0x26420e['counts']['formInterfaces']['total']++;if(_0xb8f8e5)_0x26420e[_0x2e7b73(0x1c8)]['formInterfaces'][_0x2e7b73(0x17f)]++;else{if(_0x3efc2d)_0x26420e[_0x2e7b73(0x1c8)]['formInterfaces']['updated']++;else _0x26420e['counts'][_0x2e7b73(0x18a)][_0x2e7b73(0x1cb)]++;}}for(const _0x6c4c67 of _0x4b2525){if(_0x6c4c67[_0x2e7b73(0x197)][_0x2e7b73(0x120)])continue;const _0x402cd2=getSanitizedPathWithMigration(getChatInterfacesDir(_0x40e87c),_0x6c4c67[_0x2e7b73(0x197)]['name'],_0x2e7b73(0x15c));_0x402cd2[_0x2e7b73(0x153)]&&this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0xe7)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x402cd2[_0x2e7b73(0x130)])+_0x2e7b73(0x151)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x402cd2[_0x2e7b73(0x11f)]));const _0x1c9891=_0x402cd2['path'],_0x448e3d=await apiChatInterfaceToYaml(_0x6c4c67,_0x559674),_0x4decc5=toChatInterfaceYamlString(_0x448e3d),_0x43d379=!a148_0x1a108a['existsSync'](_0x1c9891);let _0x1bf78f=_0x43d379,_0x3113a4;if(!_0x43d379){const _0x48f3f1=a148_0x1a108a[_0x2e7b73(0xdc)](_0x1c9891,_0x2e7b73(0xfd)),_0x7dfe6a=generateDiff(_0x48f3f1,_0x4decc5);_0x1bf78f=hasChanges(_0x7dfe6a),_0x1bf78f&&(_0x3113a4=formatDiffWithColors(_0x7dfe6a));}_0x38796b['push']({'path':_0x1c9891,'content':_0x4decc5}),_0x26420e[_0x2e7b73(0x19c)][_0x2e7b73(0x137)]({'name':_0x6c4c67[_0x2e7b73(0x197)][_0x2e7b73(0xf0)],'outputPath':_0x1c9891,'isNew':_0x43d379,'hasChanges':_0x1bf78f,'diff':_0x3113a4}),_0x26420e[_0x2e7b73(0x1c8)]['chatInterfaces'][_0x2e7b73(0xea)]++;if(_0x43d379)_0x26420e['counts'][_0x2e7b73(0x19c)]['new']++;else{if(_0x1bf78f)_0x26420e['counts'][_0x2e7b73(0x19c)]['updated']++;else _0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x19c)][_0x2e7b73(0x1cb)]++;}}if(_0x422b32?.[_0x2e7b73(0xe0)])return _0x26420e;a148_0x1a108a['mkdirSync'](_0x40e87c,{'recursive':!![]}),a148_0x1a108a[_0x2e7b73(0x14e)](getKnowledgeBasesDir(_0x40e87c),{'recursive':!![]}),a148_0x1a108a[_0x2e7b73(0x14e)](getPromptsDir(_0x40e87c),{'recursive':!![]}),a148_0x1a108a[_0x2e7b73(0x14e)](getIntegrationsDir(_0x40e87c),{'recursive':!![]}),a148_0x1a108a[_0x2e7b73(0x14e)](getExperimentalKnowledgeBasesDir(_0x40e87c),{'recursive':!![]}),a148_0x1a108a['mkdirSync'](getExperimentalArtifactsDir(_0x40e87c),{'recursive':!![]}),a148_0x1a108a[_0x2e7b73(0x14e)](getFormInterfacesDir(_0x40e87c),{'recursive':!![]}),a148_0x1a108a[_0x2e7b73(0x14e)](getChatInterfacesDir(_0x40e87c),{'recursive':!![]});const _0x1a284b=a148_0x55bc74[_0x2e7b73(0x16c)](_0x40e87c,_0x2e7b73(0x187));a148_0x1a108a[_0x2e7b73(0x1c6)](_0x1a284b,createAgentConfigContent(_0x222127));for(const _0x2ad07a of _0x38796b){if(_0x2ad07a[_0x2e7b73(0x125)])a148_0x1a108a[_0x2e7b73(0x14e)](_0x2ad07a[_0x2e7b73(0x11f)],{'recursive':!![]});else{const _0x4fa226=a148_0x55bc74[_0x2e7b73(0x101)](_0x2ad07a[_0x2e7b73(0x11f)]);!a148_0x1a108a[_0x2e7b73(0x16e)](_0x4fa226)&&a148_0x1a108a[_0x2e7b73(0x14e)](_0x4fa226,{'recursive':!![]}),a148_0x1a108a[_0x2e7b73(0x1c6)](_0x2ad07a[_0x2e7b73(0x11f)],_0x2ad07a[_0x2e7b73(0x165)]);}}for(const _0x3f75dc of _0x35ff3a){_0x3f75dc['isDir']?(a148_0x1a108a[_0x2e7b73(0x1b6)](_0x3f75dc[_0x2e7b73(0x11f)],{'recursive':!![],'force':!![]}),this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0x1c0)+a148_0x55bc74['basename'](a148_0x55bc74[_0x2e7b73(0x101)](_0x3f75dc['path']))+'/'+a148_0x55bc74['basename'](_0x3f75dc[_0x2e7b73(0x11f)]))):(a148_0x1a108a[_0x2e7b73(0x1b6)](_0x3f75dc[_0x2e7b73(0x11f)],{'force':!![]}),this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0x12f)+a148_0x55bc74[_0x2e7b73(0x1b2)](a148_0x55bc74[_0x2e7b73(0x101)](_0x3f75dc[_0x2e7b73(0x11f)]))+'/'+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x3f75dc[_0x2e7b73(0x11f)])));}return _0x26420e;}async[a148_0x41755e(0x160)](_0x8924d7,_0x1d91fe){const _0x2678da=a148_0x41755e,_0x4bc0f8=a148_0x55bc74[_0x2678da(0x16c)](_0x8924d7,_0x2678da(0x187));if(!a148_0x1a108a[_0x2678da(0x16e)](_0x4bc0f8))throw new SDKError(ErrorCode[_0x2678da(0x178)],_0x2678da(0x1d9)+_0x8924d7,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x816c01=loadAgentConfig(_0x4bc0f8),_0x37bec5=await this[_0x2678da(0xff)](_0x816c01[_0x2678da(0xd8)]),_0x5d92c3=await this['client'][_0x2678da(0x1cd)](_0x37bec5),_0x22d3bb=_0x5d92c3['attributes'][_0x2678da(0xf0)],_0x4d6ec2={'projectName':_0x22d3bb,'projectId':_0x37bec5,'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}}},_0x320cbc=[],_0x1b3c73=[],_0x1a350e=[],_0x388191=[],_0x36d6e0=[],_0x335b74=[],_0x6ea28a=a148_0x1a108a[_0x2678da(0x1c7)](_0x8924d7,{'withFileTypes':!![]});for(const _0x2418bb of _0x6ea28a){if(!_0x2418bb[_0x2678da(0xdf)]())continue;if(['knowledge_bases',_0x2678da(0x1e2),_0x2678da(0x195),_0x2678da(0x102),_0x2678da(0x1a5),'form_interfaces','chat_interfaces'][_0x2678da(0x1c3)](_0x2418bb['name']))continue;const _0x256234=a148_0x55bc74[_0x2678da(0x16c)](_0x8924d7,_0x2418bb[_0x2678da(0xf0)]);if(isAgentDir(_0x256234)){const _0x202c3b=a148_0x55bc74[_0x2678da(0x16c)](_0x256234,_0x2678da(0xda)),_0x259f6b=a148_0x55bc74[_0x2678da(0x16c)](_0x256234,_0x2678da(0xf6)),_0x1b33c9=a148_0x55bc74[_0x2678da(0x16c)](_0x256234,_0x2678da(0x115)),_0x1fdee3=parseAgentYaml(a148_0x1a108a[_0x2678da(0xdc)](_0x202c3b,_0x2678da(0xfd)),_0x202c3b),_0x2a4d6e=a148_0x1a108a[_0x2678da(0x16e)](_0x259f6b)?a148_0x1a108a[_0x2678da(0xdc)](_0x259f6b,_0x2678da(0xfd)):'',_0x5f0615=a148_0x1a108a['existsSync'](_0x1b33c9)?a148_0x1a108a[_0x2678da(0xdc)](_0x1b33c9,_0x2678da(0xfd)):_0x1fdee3[_0x2678da(0x150)];_0x320cbc[_0x2678da(0x137)]({'name':_0x1fdee3[_0x2678da(0xf0)],'dir':_0x256234,'yaml':_0x1fdee3,'systemPrompt':_0x2a4d6e,'starterMessage':_0x5f0615});}}const _0x5ef89a=getKnowledgeBasesDir(_0x8924d7);if(a148_0x1a108a['existsSync'](_0x5ef89a)){const _0x5615a9=a148_0x1a108a[_0x2678da(0x1c7)](_0x5ef89a);for(const _0x3c8ef5 of _0x5615a9){const _0x4595e6=a148_0x55bc74[_0x2678da(0x16c)](_0x5ef89a,_0x3c8ef5);if(_0x3c8ef5[_0x2678da(0x154)](_0x2678da(0x15c))){const _0x23067f=parseKnowledgeBaseYaml(a148_0x1a108a[_0x2678da(0xdc)](_0x4595e6,_0x2678da(0xfd)),_0x4595e6);_0x1b3c73[_0x2678da(0x137)]({'name':_0x23067f['name'],'path':_0x4595e6,'yaml':_0x23067f});}else{if(_0x3c8ef5[_0x2678da(0x154)](_0x2678da(0x1dc))){const _0x1bce04=a148_0x1a108a[_0x2678da(0xdc)](_0x4595e6,'utf-8'),{name:_0x295c2f,text:_0x1b885b}=parseTextKnowledgeBaseMd(_0x1bce04,_0x3c8ef5);_0x1a350e[_0x2678da(0x137)]({'name':_0x295c2f,'path':_0x4595e6,'text':_0x1b885b});}}}}const _0x4c8983=getPromptsDir(_0x8924d7);if(a148_0x1a108a[_0x2678da(0x16e)](_0x4c8983)){const _0x4fc456=a148_0x1a108a[_0x2678da(0x1c7)](_0x4c8983)[_0x2678da(0x182)](_0x115923=>_0x115923['endsWith'](_0x2678da(0x15c)));for(const _0x120fd0 of _0x4fc456){const _0x3a029f=a148_0x55bc74[_0x2678da(0x16c)](_0x4c8983,_0x120fd0),_0x23239c=parsePromptYaml(a148_0x1a108a[_0x2678da(0xdc)](_0x3a029f,_0x2678da(0xfd)),_0x3a029f);_0x388191[_0x2678da(0x137)]({'name':_0x23239c[_0x2678da(0xf0)],'path':_0x3a029f,'yaml':_0x23239c});}}const _0x1f7746=[],_0x20bc60=getIntegrationsDir(_0x8924d7);if(a148_0x1a108a['existsSync'](_0x20bc60)){const _0x454d31=a148_0x1a108a['readdirSync'](_0x20bc60)['filter'](_0x4720e9=>_0x4720e9[_0x2678da(0x154)]('.yml'));for(const _0x10baa3 of _0x454d31){const _0x461296=a148_0x55bc74[_0x2678da(0x16c)](_0x20bc60,_0x10baa3),_0xc01f81=parseIntegrationYaml(a148_0x1a108a[_0x2678da(0xdc)](_0x461296,'utf-8'),_0x461296);if(!SAFE_INTEGRATION_TYPES[_0x2678da(0x1c3)](_0xc01f81['service_type']['toLowerCase']())){this[_0x2678da(0x1be)][_0x2678da(0xed)]('Skipping\x20integration\x20\x27'+_0xc01f81['name']+_0x2678da(0x138)+_0xc01f81['service_type']+_0x2678da(0x1d2)+(_0x2678da(0x1e8)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x2678da(0x164))+_0x2678da(0x135));continue;}_0x1f7746[_0x2678da(0x137)]({'name':_0xc01f81[_0x2678da(0xf0)],'path':_0x461296,'yaml':_0xc01f81});}}const _0x5aff56=getExperimentalKnowledgeBasesDir(_0x8924d7);if(a148_0x1a108a[_0x2678da(0x16e)](_0x5aff56)){const _0x473012=a148_0x1a108a[_0x2678da(0x1c7)](_0x5aff56,{'withFileTypes':!![]});for(const _0x34e9b0 of _0x473012){if(!_0x34e9b0[_0x2678da(0xdf)]())continue;const _0x480534=a148_0x55bc74[_0x2678da(0x16c)](_0x5aff56,_0x34e9b0['name']),_0x5d7aca=a148_0x55bc74[_0x2678da(0x16c)](_0x480534,_0x34e9b0[_0x2678da(0xf0)]+_0x2678da(0x15c)),_0x27dc80=a148_0x55bc74['join'](_0x480534,_0x2678da(0xcc));if(!a148_0x1a108a[_0x2678da(0x16e)](_0x5d7aca))continue;const _0x1233b6=parseExperimentalKnowledgeBaseYaml(a148_0x1a108a[_0x2678da(0xdc)](_0x5d7aca,_0x2678da(0xfd)),_0x5d7aca),_0x4b8233=[];if(a148_0x1a108a[_0x2678da(0x16e)](_0x27dc80)){const _0x30edbe=a148_0x1a108a[_0x2678da(0x1c7)](_0x27dc80,{'withFileTypes':!![]});for(const _0x1fe3ce of _0x30edbe){if(!_0x1fe3ce['isDirectory']())continue;const _0x2a17fe=a148_0x55bc74[_0x2678da(0x16c)](_0x27dc80,_0x1fe3ce[_0x2678da(0xf0)]),_0x3d9edd=a148_0x55bc74[_0x2678da(0x16c)](_0x2a17fe,_0x2678da(0x184)),_0x17f7c3=a148_0x55bc74[_0x2678da(0x16c)](_0x2a17fe,'json_schema.json');a148_0x1a108a[_0x2678da(0x16e)](_0x3d9edd)&&a148_0x1a108a[_0x2678da(0x16e)](_0x17f7c3)&&_0x4b8233[_0x2678da(0x137)]({'name':_0x1fe3ce[_0x2678da(0xf0)],'code':a148_0x1a108a['readFileSync'](_0x3d9edd,_0x2678da(0xfd)),'json_schema':a148_0x1a108a[_0x2678da(0xdc)](_0x17f7c3,_0x2678da(0xfd))});}}const _0x42ffbe={..._0x1233b6,'variables':_0x1233b6['variables']||[],'functions':_0x4b8233};_0x36d6e0[_0x2678da(0x137)]({'name':_0x1233b6[_0x2678da(0xf0)],'dir':_0x480534,'def':_0x42ffbe});}}const _0x4cbbb9=getExperimentalArtifactsDir(_0x8924d7);if(a148_0x1a108a[_0x2678da(0x16e)](_0x4cbbb9)){const _0x988eea=a148_0x1a108a['readdirSync'](_0x4cbbb9,{'withFileTypes':!![]});for(const _0x30978f of _0x988eea){if(!_0x30978f[_0x2678da(0xdf)]())continue;const _0x328629=a148_0x55bc74['join'](_0x4cbbb9,_0x30978f[_0x2678da(0xf0)]),_0x4cfe74=a148_0x55bc74[_0x2678da(0x16c)](_0x328629,_0x30978f[_0x2678da(0xf0)]+_0x2678da(0x15c)),_0x369844=a148_0x55bc74[_0x2678da(0x16c)](_0x328629,_0x2678da(0x184)),_0x211127=a148_0x55bc74[_0x2678da(0x16c)](_0x328629,'files');if(!a148_0x1a108a[_0x2678da(0x16e)](_0x4cfe74)||!a148_0x1a108a[_0x2678da(0x16e)](_0x369844))continue;const _0x374e4e=parseExperimentalArtifactYaml(a148_0x1a108a[_0x2678da(0xdc)](_0x4cfe74,_0x2678da(0xfd)),_0x4cfe74),_0x1d1e45=a148_0x1a108a[_0x2678da(0xdc)](_0x369844,_0x2678da(0xfd)),_0x18e1c0=[];if(a148_0x1a108a[_0x2678da(0x16e)](_0x211127)){const _0x3a0190=a148_0x1a108a['readdirSync'](_0x211127);for(const _0x225063 of _0x3a0190){const _0x4f0fd8=a148_0x55bc74[_0x2678da(0x16c)](_0x211127,_0x225063);a148_0x1a108a[_0x2678da(0x132)](_0x4f0fd8)[_0x2678da(0xe5)]()&&_0x18e1c0[_0x2678da(0x137)]({'file_name':_0x225063,'text_content':a148_0x1a108a[_0x2678da(0xdc)](_0x4f0fd8,_0x2678da(0xfd))});}}const _0x3c0404={..._0x374e4e,'code':_0x1d1e45,'files':_0x18e1c0};_0x335b74['push']({'name':_0x374e4e[_0x2678da(0xf0)],'dir':_0x328629,'def':_0x3c0404});}}const _0x559758=[],_0x6a96cd=getFormInterfacesDir(_0x8924d7);if(a148_0x1a108a[_0x2678da(0x16e)](_0x6a96cd)){const _0x1c30ce=a148_0x1a108a[_0x2678da(0x1c7)](_0x6a96cd)['filter'](_0x1b8694=>_0x1b8694[_0x2678da(0x154)](_0x2678da(0x15c)));for(const _0x152cac of _0x1c30ce){const _0x43e1b5=a148_0x55bc74[_0x2678da(0x16c)](_0x6a96cd,_0x152cac),_0x3ac4b9=parseFormInterfaceYaml(a148_0x1a108a[_0x2678da(0xdc)](_0x43e1b5,'utf-8'),_0x43e1b5);_0x559758['push']({'name':_0x3ac4b9[_0x2678da(0xf0)],'path':_0x43e1b5,'yaml':_0x3ac4b9});}}const _0x31c15f=[],_0x306951=getChatInterfacesDir(_0x8924d7);if(a148_0x1a108a[_0x2678da(0x16e)](_0x306951)){const _0x539c82=a148_0x1a108a[_0x2678da(0x1c7)](_0x306951)[_0x2678da(0x182)](_0x4aebe4=>_0x4aebe4['endsWith'](_0x2678da(0x15c)));for(const _0x4a1380 of _0x539c82){const _0x10f311=a148_0x55bc74[_0x2678da(0x16c)](_0x306951,_0x4a1380),_0x469423=parseChatInterfaceYaml(a148_0x1a108a['readFileSync'](_0x10f311,'utf-8'),_0x10f311);_0x31c15f[_0x2678da(0x137)]({'name':_0x469423[_0x2678da(0xf0)],'path':_0x10f311,'yaml':_0x469423});}}const _0x4ab272=await this['client'][_0x2678da(0x19f)](_0x37bec5),_0x3dec7b=await this['client']['listKnowledgeBases'](_0x37bec5),_0x5941a9=await this[_0x2678da(0x118)][_0x2678da(0xcf)](_0x37bec5),_0x155746=await this[_0x2678da(0x118)][_0x2678da(0x1c2)](_0x37bec5),_0xf67792=await this[_0x2678da(0x118)][_0x2678da(0x1e7)](_0x37bec5),_0x1830ed=await safeListOrEmpty(()=>this[_0x2678da(0x118)][_0x2678da(0x12e)](_0x37bec5)),_0x50844c=await safeListOrEmpty(()=>this['client'][_0x2678da(0x106)](_0x37bec5)),_0x55372f=await safeListOrEmpty(()=>this[_0x2678da(0x118)][_0x2678da(0x1cf)](_0x37bec5)),_0x286838=await safeListOrEmpty(()=>this['client']['listChatInterfaces'](_0x37bec5)),_0x98065a=await fetchAllToolTargetMaps((_0x5edf40,_0xe5090a)=>this[_0x2678da(0x118)]['listToolTargets'](_0x5edf40,_0xe5090a),_0x37bec5),_0x53426e=new Map(),_0x21801c=new Map(),_0x5f2e3c=new Map(),_0x275a2a=new Map(),_0x3273bc=new Map(),_0x274f1f=new Map(),_0x49b4b2=new Map();for(const _0x35e08e of _0x4ab272){_0x53426e[_0x2678da(0x157)](_0x35e08e[_0x2678da(0x197)][_0x2678da(0xf0)],_0x35e08e);}for(const _0x100e0f of _0x3dec7b){_0x21801c[_0x2678da(0x157)](_0x100e0f[_0x2678da(0x197)][_0x2678da(0xf0)],_0x100e0f);}for(const _0x4e73e7 of _0x5941a9){_0x5f2e3c['set'](_0x4e73e7['attributes'][_0x2678da(0xf0)],_0x4e73e7);}for(const _0x47edf1 of _0x155746){_0x275a2a[_0x2678da(0x157)](_0x47edf1['attributes']['name'],_0x47edf1);}for(const _0x59bc6e of _0xf67792){_0x3273bc[_0x2678da(0x157)](_0x59bc6e[_0x2678da(0x197)][_0x2678da(0xf3)]['toLowerCase'](),_0x59bc6e);}for(const _0x99c354 of _0x1830ed){_0x274f1f[_0x2678da(0x157)](_0x99c354['attributes'][_0x2678da(0xf0)],_0x99c354);}for(const _0x5e2fc9 of _0x50844c){_0x49b4b2[_0x2678da(0x157)](_0x5e2fc9[_0x2678da(0x197)]['name'],_0x5e2fc9);}const _0xa2aae5=new Map(),_0x11ba7e=new Map();for(const _0x4dc78a of _0x55372f){_0xa2aae5[_0x2678da(0x157)](_0x4dc78a['attributes'][_0x2678da(0xf0)],_0x4dc78a);}for(const _0x14bd41 of _0x286838){_0x11ba7e['set'](_0x14bd41[_0x2678da(0x197)][_0x2678da(0xf0)],_0x14bd41);}const _0x1aa0c1=new Map(),_0x39c5a2=new Map();for(const _0x35e3e7 of _0x4ab272){_0x1aa0c1['set'](_0x35e3e7[_0x2678da(0x197)][_0x2678da(0xf0)],_0x35e3e7['id']),_0x39c5a2['set'](_0x35e3e7['id'],_0x35e3e7[_0x2678da(0x197)]['name']);}const _0x31276d=new Map(),_0x1f92eb=new Map();for(const _0x1f17f3 of _0x155746){_0x31276d[_0x2678da(0x157)](_0x1f17f3['attributes']['name'],_0x1f17f3['id']),_0x1f92eb[_0x2678da(0x157)](_0x1f17f3['id'],_0x1f17f3[_0x2678da(0x197)][_0x2678da(0xf0)]);}const _0x2b2373=_0x98065a[_0x2678da(0x1dd)][_0x2678da(0x114)]||new Map(),_0x4f020d=_0x98065a[_0x2678da(0x1dd)][_0x2678da(0x1d3)]||new Map(),_0x472050=_0x98065a['nameToId']['ExperimentalKnowledgeBase']||new Map(),_0x286ec4=new Map(),_0xe46ad2={'resolveToolTargetName':buildNameResolver({..._0x98065a[_0x2678da(0x1a3)],'Agent':_0x39c5a2}),'resolvePromptName':async _0x3aea55=>_0x1f92eb[_0x2678da(0x100)](_0x3aea55),'onWarning':_0x116204=>this[_0x2678da(0x1be)]['warn'](_0x116204)};let _0x2d9576=[];const _0x51321d={'projectId':_0x37bec5,'resolveToolTargetId':buildIdResolver({..._0x98065a[_0x2678da(0x1dd)],'Agent':_0x1aa0c1}),'resolvePromptId':async _0x4f1bdd=>_0x31276d[_0x2678da(0x100)](_0x4f1bdd),'onWarning':_0x4a572d=>{const _0x316191=_0x2678da;this['logger']['warn'](_0x4a572d),_0x2d9576[_0x316191(0x137)](_0x4a572d);}},{resolved:_0x36d11d,unresolved:_0x336fd9}=resolveAgentDependencies(_0x320cbc,new Set(_0x53426e['keys']()));for(const {agent:_0x39413c,missingDeps:_0x3a4f7c}of _0x336fd9){_0x4d6ec2[_0x2678da(0x183)][_0x2678da(0x137)]({'agentName':_0x39413c[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x1ba),'error':_0x2678da(0x1de)+_0x3a4f7c[_0x2678da(0x16c)](',\x20')+'.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.'}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x183)]['errors']++;}for(const _0x5870b5 of _0x1b3c73){const _0x3b5d9b=_0x21801c[_0x2678da(0x100)](_0x5870b5[_0x2678da(0xeb)][_0x2678da(0xf0)]),_0x427d5d=a148_0x1a108a['readFileSync'](_0x5870b5[_0x2678da(0x11f)],_0x2678da(0xfd));if(_0x3b5d9b){const _0x42ab86=apiKnowledgeBaseToYaml(_0x3b5d9b),_0x4bebdf=toKnowledgeBaseYamlString(_0x42ab86),_0x4ee93b=generateDiff(_0x4bebdf,_0x427d5d),_0x3e05d7=hasChanges(_0x4ee93b);_0x3e05d7?(_0x4d6ec2['knowledgeBases']['push']({'name':_0x5870b5[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':'updated','id':_0x3b5d9b['id'],'diff':formatDiffWithColors(_0x4ee93b)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x179)][_0x2678da(0x10a)]++):(_0x4d6ec2[_0x2678da(0x179)][_0x2678da(0x137)]({'name':_0x5870b5[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':'unchanged','id':_0x3b5d9b['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x179)]['unchanged']++);}else _0x4d6ec2['knowledgeBases'][_0x2678da(0x137)]({'name':_0x5870b5[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x1a6)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x179)]['created']++;}for(const _0x62849d of _0x1a350e){const _0x490be0=_0x5f2e3c['get'](_0x62849d[_0x2678da(0xf0)]),_0x465afe=a148_0x1a108a[_0x2678da(0xdc)](_0x62849d[_0x2678da(0x11f)],_0x2678da(0xfd));if(_0x490be0){const _0x55e852=toTextKnowledgeBaseMd(_0x490be0['attributes'][_0x2678da(0xf0)],_0x490be0[_0x2678da(0x197)][_0x2678da(0x11c)]),_0x3858bf=generateDiff(_0x55e852,_0x465afe),_0xe868c0=hasChanges(_0x3858bf);_0xe868c0?(_0x4d6ec2[_0x2678da(0x170)][_0x2678da(0x137)]({'name':_0x62849d[_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x490be0['id'],'diff':formatDiffWithColors(_0x3858bf)}),_0x4d6ec2[_0x2678da(0x1c8)]['textKnowledgeBases'][_0x2678da(0x10a)]++):(_0x4d6ec2[_0x2678da(0x170)]['push']({'name':_0x62849d[_0x2678da(0xf0)],'action':'unchanged','id':_0x490be0['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x170)][_0x2678da(0x1cb)]++);}else _0x4d6ec2[_0x2678da(0x170)][_0x2678da(0x137)]({'name':_0x62849d[_0x2678da(0xf0)],'action':_0x2678da(0x1a6)}),_0x4d6ec2['counts'][_0x2678da(0x170)][_0x2678da(0x1a6)]++;}for(const _0x5f526b of _0x36d11d){const _0x243da8=_0x53426e[_0x2678da(0x100)](_0x5f526b[_0x2678da(0xeb)][_0x2678da(0xf0)]),_0x43f8d1=a148_0x55bc74[_0x2678da(0x16c)](_0x5f526b[_0x2678da(0x158)],'agent.yml'),_0x49bbc3=a148_0x1a108a[_0x2678da(0xdc)](_0x43f8d1,'utf-8'),_0x1f77ae=_0x5f526b[_0x2678da(0x177)],_0x3da6e9=_0x2678da(0x175)+_0x1f77ae+_0x2678da(0x15b)+_0x49bbc3;if(_0x243da8){const {yaml:_0x5bab3b,systemPrompt:_0x5c1faf}=await agentResponseToDef(_0x243da8,_0xe46ad2),_0x309911=toAgentYamlString(_0x5bab3b),_0x5df3d3=_0x2678da(0x175)+_0x5c1faf+'\x0a\x0a#\x20agent.yml\x0a'+_0x309911,_0x195400=generateDiff(_0x5df3d3,_0x3da6e9),_0x42f54b=hasChanges(_0x195400);_0x42f54b?(_0x4d6ec2[_0x2678da(0x183)]['push']({'agentName':_0x5f526b[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'agentId':_0x243da8['id'],'diff':formatDiffWithColors(_0x195400)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x183)][_0x2678da(0x10a)]++):(_0x4d6ec2[_0x2678da(0x183)][_0x2678da(0x137)]({'agentName':_0x5f526b[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':'unchanged','agentId':_0x243da8['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x183)][_0x2678da(0x1cb)]++);}else _0x4d6ec2['agents'][_0x2678da(0x137)]({'agentName':_0x5f526b['yaml'][_0x2678da(0xf0)],'action':'created'}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x183)][_0x2678da(0x1a6)]++;}for(const _0x4e09a9 of _0x388191){const _0x31e5ba=_0x275a2a[_0x2678da(0x100)](_0x4e09a9[_0x2678da(0xeb)][_0x2678da(0xf0)]),_0x20e664=a148_0x1a108a[_0x2678da(0xdc)](_0x4e09a9[_0x2678da(0x11f)],_0x2678da(0xfd));if(_0x31e5ba){const _0x3b0396=await apiPromptToYaml(_0x31e5ba,_0xe46ad2);if(!_0x3b0396){_0x4d6ec2[_0x2678da(0x1e2)][_0x2678da(0x137)]({'name':_0x4e09a9['yaml'][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x31e5ba['id']}),_0x4d6ec2['counts'][_0x2678da(0x1e2)]['updated']++;continue;}const _0x41ca08=toPromptYamlString(_0x3b0396),_0x18a82e=generateDiff(_0x41ca08,_0x20e664),_0xf20134=hasChanges(_0x18a82e);_0xf20134?(_0x4d6ec2[_0x2678da(0x1e2)][_0x2678da(0x137)]({'name':_0x4e09a9[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x31e5ba['id'],'diff':formatDiffWithColors(_0x18a82e)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x1e2)][_0x2678da(0x10a)]++):(_0x4d6ec2['prompts']['push']({'name':_0x4e09a9[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':'unchanged','id':_0x31e5ba['id']}),_0x4d6ec2['counts'][_0x2678da(0x1e2)][_0x2678da(0x1cb)]++);}else _0x4d6ec2['prompts']['push']({'name':_0x4e09a9[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':'created'}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x1e2)][_0x2678da(0x1a6)]++;}for(const _0x1bea74 of _0x1f7746){const _0x3f6859=_0x3273bc[_0x2678da(0x100)](_0x1bea74[_0x2678da(0xeb)][_0x2678da(0x113)]),_0x579990=a148_0x1a108a[_0x2678da(0xdc)](_0x1bea74['path'],_0x2678da(0xfd));if(_0x3f6859){const _0x56ec39=await apiIntegrationToYaml(_0x3f6859,_0xe46ad2),_0x3da480=toIntegrationYamlString(_0x56ec39),_0x5ad309=generateDiff(_0x3da480,_0x579990),_0x151186=hasChanges(_0x5ad309);_0x151186?(_0x4d6ec2['integrations']['push']({'name':_0x1bea74[_0x2678da(0xeb)][_0x2678da(0x113)],'action':'updated','id':_0x3f6859['id'],'diff':formatDiffWithColors(_0x5ad309)}),_0x4d6ec2[_0x2678da(0x1c8)]['integrations'][_0x2678da(0x10a)]++):(_0x4d6ec2[_0x2678da(0x195)]['push']({'name':_0x1bea74[_0x2678da(0xeb)][_0x2678da(0x113)],'action':_0x2678da(0x1cb),'id':_0x3f6859['id']}),_0x4d6ec2[_0x2678da(0x1c8)]['integrations'][_0x2678da(0x1cb)]++);}else _0x4d6ec2[_0x2678da(0x195)][_0x2678da(0x137)]({'name':_0x1bea74[_0x2678da(0xeb)][_0x2678da(0x113)],'action':_0x2678da(0x1a6)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x195)][_0x2678da(0x1a6)]++;}for(const _0x5546c3 of _0x36d6e0){const _0x47411c=_0x274f1f[_0x2678da(0x100)](_0x5546c3[_0x2678da(0x18b)]['name']),_0x3eeb2b=toExperimentalKnowledgeBaseYamlString(_0x5546c3[_0x2678da(0x18b)]);let _0x36ef04=_0x3eeb2b;for(const _0x1ca1c8 of _0x5546c3[_0x2678da(0x18b)]['functions']){_0x36ef04+=_0x2678da(0xd7)+_0x1ca1c8[_0x2678da(0xf0)]+_0x2678da(0x13f)+_0x1ca1c8[_0x2678da(0x1b1)]+'\x0a---\x20schema:\x20'+_0x1ca1c8[_0x2678da(0xf0)]+_0x2678da(0x13f)+_0x1ca1c8[_0x2678da(0x109)]+'\x0a';}if(_0x47411c){const _0x1eda51=apiExperimentalKnowledgeBaseToYaml(_0x47411c),_0x5e9558=toExperimentalKnowledgeBaseYamlString(_0x1eda51);let _0x51787b=_0x5e9558;for(const _0x10c552 of _0x1eda51[_0x2678da(0xcc)]){_0x51787b+=_0x2678da(0xd7)+_0x10c552[_0x2678da(0xf0)]+'\x20---\x0a'+_0x10c552[_0x2678da(0x1b1)]+_0x2678da(0x1da)+_0x10c552['name']+'\x20---\x0a'+_0x10c552[_0x2678da(0x109)]+'\x0a';}const _0xab5145=generateDiff(_0x51787b,_0x36ef04),_0x1b289a=hasChanges(_0xab5145);_0x1b289a?(_0x4d6ec2[_0x2678da(0x1b7)][_0x2678da(0x137)]({'name':_0x5546c3[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x47411c['id'],'diff':formatDiffWithColors(_0xab5145)}),_0x4d6ec2[_0x2678da(0x1c8)]['experimentalKnowledgeBases'][_0x2678da(0x10a)]++):(_0x4d6ec2[_0x2678da(0x1b7)][_0x2678da(0x137)]({'name':_0x5546c3[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':_0x2678da(0x1cb),'id':_0x47411c['id']}),_0x4d6ec2[_0x2678da(0x1c8)]['experimentalKnowledgeBases'][_0x2678da(0x1cb)]++);}else _0x4d6ec2[_0x2678da(0x1b7)][_0x2678da(0x137)]({'name':_0x5546c3[_0x2678da(0x18b)]['name'],'action':_0x2678da(0x1a6)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x1b7)][_0x2678da(0x1a6)]++;}for(const _0x24a282 of _0x335b74){const _0x2b0b04=_0x49b4b2['get'](_0x24a282['def'][_0x2678da(0xf0)]),_0x4beef2=toExperimentalArtifactYamlString(_0x24a282[_0x2678da(0x18b)]);let _0x4a5234=_0x4beef2+(_0x2678da(0x147)+_0x24a282['def']['code']+'\x0a');for(const _0x5d7a7d of _0x24a282[_0x2678da(0x18b)][_0x2678da(0x128)]){_0x4a5234+=_0x2678da(0x15e)+_0x5d7a7d[_0x2678da(0x1ca)]+_0x2678da(0x13f)+_0x5d7a7d[_0x2678da(0x15a)]+'\x0a';}if(_0x2b0b04){const _0x4b80d9=apiExperimentalArtifactToYaml(_0x2b0b04),_0x1b2506=toExperimentalArtifactYamlString(_0x4b80d9);let _0x98969f=_0x1b2506+('\x0a---\x20code\x20---\x0a'+_0x4b80d9['code']+'\x0a');for(const _0x9dc45d of _0x4b80d9['files']){_0x98969f+=_0x2678da(0x15e)+_0x9dc45d['file_name']+_0x2678da(0x13f)+_0x9dc45d[_0x2678da(0x15a)]+'\x0a';}const _0x645f48=generateDiff(_0x98969f,_0x4a5234),_0x251397=hasChanges(_0x645f48);_0x251397?(_0x4d6ec2[_0x2678da(0x10f)][_0x2678da(0x137)]({'name':_0x24a282[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x2b0b04['id'],'diff':formatDiffWithColors(_0x645f48)}),_0x4d6ec2['counts'][_0x2678da(0x10f)][_0x2678da(0x10a)]++):(_0x4d6ec2[_0x2678da(0x10f)][_0x2678da(0x137)]({'name':_0x24a282[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':_0x2678da(0x1cb),'id':_0x2b0b04['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x10f)][_0x2678da(0x1cb)]++);}else _0x4d6ec2['experimentalArtifacts']['push']({'name':_0x24a282[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':_0x2678da(0x1a6)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x10f)][_0x2678da(0x1a6)]++;}for(const _0x37fb60 of _0x559758){const _0x1337c2=_0xa2aae5[_0x2678da(0x100)](_0x37fb60[_0x2678da(0xeb)][_0x2678da(0xf0)]),_0xc4ad4a=a148_0x1a108a[_0x2678da(0xdc)](_0x37fb60['path'],_0x2678da(0xfd));if(_0x1337c2){const _0x4505b6=await apiFormInterfaceToYaml(_0x1337c2,_0xe46ad2),_0x3c5070=toFormInterfaceYamlString(_0x4505b6),_0x3080a5=generateDiff(_0x3c5070,_0xc4ad4a),_0x4d5c41=hasChanges(_0x3080a5);_0x4d5c41?(_0x4d6ec2[_0x2678da(0x18a)]['push']({'name':_0x37fb60[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x1337c2['id'],'diff':formatDiffWithColors(_0x3080a5)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x18a)][_0x2678da(0x10a)]++):(_0x4d6ec2[_0x2678da(0x18a)][_0x2678da(0x137)]({'name':_0x37fb60[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x1cb),'id':_0x1337c2['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x18a)]['unchanged']++);}else _0x4d6ec2['formInterfaces'][_0x2678da(0x137)]({'name':_0x37fb60[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x1a6)}),_0x4d6ec2[_0x2678da(0x1c8)]['formInterfaces'][_0x2678da(0x1a6)]++;}for(const _0x527dc5 of _0x31c15f){const _0x2bba4f=_0x11ba7e[_0x2678da(0x100)](_0x527dc5[_0x2678da(0xeb)][_0x2678da(0xf0)]),_0x585a78=a148_0x1a108a[_0x2678da(0xdc)](_0x527dc5[_0x2678da(0x11f)],_0x2678da(0xfd));if(_0x2bba4f){const _0x5c0bc0=await apiChatInterfaceToYaml(_0x2bba4f,_0xe46ad2),_0x3e4e6f=toChatInterfaceYamlString(_0x5c0bc0),_0x1cfa13=generateDiff(_0x3e4e6f,_0x585a78),_0xf118ff=hasChanges(_0x1cfa13);_0xf118ff?(_0x4d6ec2[_0x2678da(0x19c)][_0x2678da(0x137)]({'name':_0x527dc5[_0x2678da(0xeb)]['name'],'action':_0x2678da(0x10a),'id':_0x2bba4f['id'],'diff':formatDiffWithColors(_0x1cfa13)}),_0x4d6ec2['counts']['chatInterfaces'][_0x2678da(0x10a)]++):(_0x4d6ec2[_0x2678da(0x19c)]['push']({'name':_0x527dc5[_0x2678da(0xeb)]['name'],'action':_0x2678da(0x1cb),'id':_0x2bba4f['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x19c)][_0x2678da(0x1cb)]++);}else _0x4d6ec2[_0x2678da(0x19c)][_0x2678da(0x137)]({'name':_0x527dc5['yaml'][_0x2678da(0xf0)],'action':_0x2678da(0x1a6)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x19c)][_0x2678da(0x1a6)]++;}if(_0x1d91fe?.['dryRun'])return _0x4d6ec2;_0x4d6ec2['knowledgeBases']=[],_0x4d6ec2[_0x2678da(0x170)]=[],_0x4d6ec2[_0x2678da(0x1e2)]=[],_0x4d6ec2['integrations']=[],_0x4d6ec2[_0x2678da(0x1b7)]=[],_0x4d6ec2['experimentalArtifacts']=[],_0x4d6ec2[_0x2678da(0x18a)]=[],_0x4d6ec2[_0x2678da(0x19c)]=[];const _0x14dde5=_0x4d6ec2[_0x2678da(0x183)][_0x2678da(0x182)](_0x453336=>_0x453336[_0x2678da(0x1a1)]===_0x2678da(0x1ba));_0x4d6ec2['agents']=_0x14dde5,_0x4d6ec2['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x14dde5[_0x2678da(0xee)]},'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 _0x32ed22 of _0x1b3c73){try{const _0x39f243=_0x21801c['get'](_0x32ed22[_0x2678da(0xeb)][_0x2678da(0xf0)]),_0x412ca0=yamlKnowledgeBaseToApi(_0x32ed22['yaml'],_0x37bec5);if(_0x39f243)await this[_0x2678da(0x118)]['updateKnowledgeBase'](_0x39f243['id'],_0x412ca0),_0x2b2373[_0x2678da(0x157)](_0x32ed22['yaml'][_0x2678da(0xf0)],_0x39f243['id']),_0x4d6ec2[_0x2678da(0x179)][_0x2678da(0x137)]({'name':_0x32ed22['yaml'][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x39f243['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x179)][_0x2678da(0x10a)]++;else{const _0x3e79c4=await this[_0x2678da(0x118)]['createKnowledgeBase'](_0x412ca0);_0x2b2373[_0x2678da(0x157)](_0x32ed22[_0x2678da(0xeb)][_0x2678da(0xf0)],_0x3e79c4['id']),_0x4d6ec2[_0x2678da(0x179)][_0x2678da(0x137)]({'name':_0x32ed22[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x1a6),'id':_0x3e79c4['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x179)]['created']++;}}catch(_0x238790){_0x4d6ec2[_0x2678da(0x179)][_0x2678da(0x137)]({'name':_0x32ed22['yaml'][_0x2678da(0xf0)],'action':'error','error':_0x238790[_0x2678da(0x129)]}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x179)]['errors']++;}}for(const _0x19a057 of _0x1a350e){try{const _0x446729=_0x5f2e3c[_0x2678da(0x100)](_0x19a057[_0x2678da(0xf0)]),_0x168310=yamlTextKnowledgeBaseToApi({'name':_0x19a057[_0x2678da(0xf0)],'text':_0x19a057[_0x2678da(0x11c)]},_0x37bec5);if(_0x446729)await this[_0x2678da(0x118)][_0x2678da(0x139)](_0x446729['id'],_0x168310),_0x4f020d['set'](_0x19a057[_0x2678da(0xf0)],_0x446729['id']),_0x4d6ec2[_0x2678da(0x170)][_0x2678da(0x137)]({'name':_0x19a057['name'],'action':_0x2678da(0x10a),'id':_0x446729['id']}),_0x4d6ec2['counts'][_0x2678da(0x170)][_0x2678da(0x10a)]++;else{const _0x325786=await this[_0x2678da(0x118)][_0x2678da(0x16f)](_0x168310);_0x4f020d['set'](_0x19a057['name'],_0x325786['id']),_0x4d6ec2[_0x2678da(0x170)]['push']({'name':_0x19a057[_0x2678da(0xf0)],'action':_0x2678da(0x1a6),'id':_0x325786['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x170)][_0x2678da(0x1a6)]++;}}catch(_0x158a14){_0x4d6ec2[_0x2678da(0x170)][_0x2678da(0x137)]({'name':_0x19a057[_0x2678da(0xf0)],'action':_0x2678da(0x1ba),'error':_0x158a14['message']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x170)][_0x2678da(0x19a)]++;}}for(const _0x1b9751 of _0x36d6e0){try{const _0x422142=_0x274f1f['get'](_0x1b9751[_0x2678da(0x18b)][_0x2678da(0xf0)]),_0x37b4f5=yamlExperimentalKnowledgeBaseToApi(_0x1b9751[_0x2678da(0x18b)],_0x37bec5);if(_0x422142)await this[_0x2678da(0x118)]['updateExperimentalKnowledgeBase'](_0x422142['id'],_0x37b4f5),_0x472050[_0x2678da(0x157)](_0x1b9751[_0x2678da(0x18b)]['name'],_0x422142['id']),_0x4d6ec2[_0x2678da(0x1b7)][_0x2678da(0x137)]({'name':_0x1b9751[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':'updated','id':_0x422142['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x1b7)][_0x2678da(0x10a)]++;else{const _0x3fb47a=await this[_0x2678da(0x118)][_0x2678da(0x1ac)](_0x37b4f5);_0x472050[_0x2678da(0x157)](_0x1b9751[_0x2678da(0x18b)]['name'],_0x3fb47a['id']),_0x4d6ec2[_0x2678da(0x1b7)]['push']({'name':_0x1b9751[_0x2678da(0x18b)]['name'],'action':'created','id':_0x3fb47a['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x1b7)]['created']++;}}catch(_0x21756a){_0x4d6ec2[_0x2678da(0x1b7)][_0x2678da(0x137)]({'name':_0x1b9751[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':_0x2678da(0x1ba),'error':_0x21756a[_0x2678da(0x129)]}),_0x4d6ec2['counts'][_0x2678da(0x1b7)][_0x2678da(0x19a)]++;}}for(const _0x27163c of _0x335b74){try{const _0x26eb7e=_0x49b4b2['get'](_0x27163c[_0x2678da(0x18b)][_0x2678da(0xf0)]),_0x467490=yamlExperimentalArtifactToApi(_0x27163c[_0x2678da(0x18b)],_0x37bec5);if(_0x26eb7e)await this[_0x2678da(0x118)]['updateExperimentalArtifact'](_0x26eb7e['id'],_0x467490),_0x286ec4['set'](_0x27163c[_0x2678da(0x18b)][_0x2678da(0xf0)],_0x26eb7e['id']),_0x4d6ec2[_0x2678da(0x10f)]['push']({'name':_0x27163c[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x26eb7e['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x10f)][_0x2678da(0x10a)]++;else{const _0x141d8c=await this['client'][_0x2678da(0x192)](_0x467490);_0x286ec4[_0x2678da(0x157)](_0x27163c[_0x2678da(0x18b)][_0x2678da(0xf0)],_0x141d8c['id']),_0x4d6ec2[_0x2678da(0x10f)][_0x2678da(0x137)]({'name':_0x27163c[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':_0x2678da(0x1a6),'id':_0x141d8c['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x10f)][_0x2678da(0x1a6)]++;}}catch(_0x1585e7){_0x4d6ec2[_0x2678da(0x10f)]['push']({'name':_0x27163c['def'][_0x2678da(0xf0)],'action':_0x2678da(0x1ba),'error':_0x1585e7[_0x2678da(0x129)]}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x10f)]['errors']++;}}for(const _0x569c30 of _0x36d11d){_0x2d9576=[];try{const _0x13c9d8=_0x53426e[_0x2678da(0x100)](_0x569c30['yaml']['name']),_0x34cec8=await agentDefToRequest(_0x569c30[_0x2678da(0xeb)],_0x569c30[_0x2678da(0x177)],_0x569c30[_0x2678da(0x19d)],_0x51321d);if(_0x13c9d8)await this[_0x2678da(0x118)][_0x2678da(0x116)](_0x13c9d8['id'],_0x34cec8),_0x1aa0c1[_0x2678da(0x157)](_0x569c30[_0x2678da(0xeb)]['name'],_0x13c9d8['id']),_0x4d6ec2[_0x2678da(0x183)][_0x2678da(0x137)]({'agentName':_0x569c30['yaml'][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'agentId':_0x13c9d8['id'],'warnings':_0x2d9576[_0x2678da(0xee)]>0x0?_0x2d9576:undefined}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x183)][_0x2678da(0x10a)]++;else{const _0x55d945=await this[_0x2678da(0x118)]['createAgentResponse'](_0x34cec8);_0x1aa0c1[_0x2678da(0x157)](_0x569c30[_0x2678da(0xeb)]['name'],_0x55d945['id']),_0x4d6ec2[_0x2678da(0x183)][_0x2678da(0x137)]({'agentName':_0x569c30[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x1a6),'agentId':_0x55d945['id'],'warnings':_0x2d9576[_0x2678da(0xee)]>0x0?_0x2d9576:undefined}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x183)][_0x2678da(0x1a6)]++;}}catch(_0x3eced9){_0x4d6ec2[_0x2678da(0x183)]['push']({'agentName':_0x569c30[_0x2678da(0xeb)]['name'],'action':_0x2678da(0x1ba),'error':_0x3eced9['message'],'warnings':_0x2d9576['length']>0x0?_0x2d9576:undefined}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x183)][_0x2678da(0x19a)]++;}}for(const _0x33cc30 of _0x388191){try{const _0x46d637=_0x275a2a['get'](_0x33cc30[_0x2678da(0xeb)][_0x2678da(0xf0)]),_0x3dc3a4=await yamlPromptToApi(_0x33cc30[_0x2678da(0xeb)],_0x37bec5,_0x51321d);if(!_0x3dc3a4){_0x4d6ec2['prompts'][_0x2678da(0x137)]({'name':_0x33cc30[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x1ba),'error':'Agent\x20reference\x20not\x20found'}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x1e2)][_0x2678da(0x19a)]++;continue;}if(_0x46d637)await this['client'][_0x2678da(0x103)](_0x46d637['id'],_0x3dc3a4),_0x31276d[_0x2678da(0x157)](_0x33cc30[_0x2678da(0xeb)]['name'],_0x46d637['id']),_0x4d6ec2[_0x2678da(0x1e2)][_0x2678da(0x137)]({'name':_0x33cc30['yaml'][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x46d637['id']}),_0x4d6ec2[_0x2678da(0x1c8)]['prompts']['updated']++;else{const _0xe85f98=await this[_0x2678da(0x118)][_0x2678da(0x1ce)](_0x3dc3a4);_0x31276d['set'](_0x33cc30[_0x2678da(0xeb)]['name'],_0xe85f98['id']),_0x4d6ec2[_0x2678da(0x1e2)][_0x2678da(0x137)]({'name':_0x33cc30[_0x2678da(0xeb)]['name'],'action':_0x2678da(0x1a6),'id':_0xe85f98['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x1e2)][_0x2678da(0x1a6)]++;}}catch(_0x357b2b){_0x4d6ec2[_0x2678da(0x1e2)][_0x2678da(0x137)]({'name':_0x33cc30['yaml']['name'],'action':'error','error':_0x357b2b[_0x2678da(0x129)]}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x1e2)][_0x2678da(0x19a)]++;}}for(const _0x55d665 of _0x1f7746){try{const _0x3427b1=_0x3273bc[_0x2678da(0x100)](_0x55d665['yaml'][_0x2678da(0x113)]),_0x21cbc1=await yamlIntegrationToApi(_0x55d665[_0x2678da(0xeb)],_0x37bec5,_0x51321d);if(_0x3427b1){await this['client']['deleteIntegration'](_0x3427b1['id']);const _0x8bb047=await this[_0x2678da(0x118)]['createIntegration'](_0x21cbc1);_0x4d6ec2[_0x2678da(0x195)][_0x2678da(0x137)]({'name':_0x55d665['yaml'][_0x2678da(0x113)],'action':_0x2678da(0x10a),'id':_0x8bb047['id']}),_0x4d6ec2['counts'][_0x2678da(0x195)]['updated']++;}else{const _0x244899=await this[_0x2678da(0x118)]['createIntegration'](_0x21cbc1);_0x4d6ec2['integrations'][_0x2678da(0x137)]({'name':_0x55d665['yaml'][_0x2678da(0x113)],'action':_0x2678da(0x1a6),'id':_0x244899['id']}),_0x4d6ec2[_0x2678da(0x1c8)]['integrations']['created']++;}}catch(_0x3eb8b4){_0x4d6ec2[_0x2678da(0x195)][_0x2678da(0x137)]({'name':_0x55d665[_0x2678da(0xeb)]['service_type'],'action':_0x2678da(0x1ba),'error':_0x3eb8b4[_0x2678da(0x129)]}),_0x4d6ec2[_0x2678da(0x1c8)]['integrations'][_0x2678da(0x19a)]++;}}for(const _0x50b8cf of _0x559758){try{const _0x378b0a=_0xa2aae5[_0x2678da(0x100)](_0x50b8cf['yaml']['name']),_0x57e31b=await yamlFormInterfaceToApi(_0x50b8cf[_0x2678da(0xeb)],_0x37bec5,_0x51321d);if(!_0x57e31b){_0x4d6ec2[_0x2678da(0x18a)][_0x2678da(0x137)]({'name':_0x50b8cf[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x1ba),'error':_0x2678da(0x162)}),_0x4d6ec2['counts'][_0x2678da(0x18a)]['errors']++;continue;}if(_0x378b0a){const _0x3794fa=await this['client'][_0x2678da(0x12c)](_0x378b0a['id'],_0x57e31b);_0x4d6ec2[_0x2678da(0x18a)]['push']({'name':_0x50b8cf[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x3794fa['id']}),_0x4d6ec2['counts'][_0x2678da(0x18a)][_0x2678da(0x10a)]++;}else{const _0x58f35f=await this[_0x2678da(0x118)]['createFormInterface'](_0x57e31b);_0x4d6ec2[_0x2678da(0x18a)][_0x2678da(0x137)]({'name':_0x50b8cf['yaml']['name'],'action':_0x2678da(0x1a6),'id':_0x58f35f['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x18a)][_0x2678da(0x1a6)]++;}}catch(_0x24e3f6){_0x4d6ec2[_0x2678da(0x18a)][_0x2678da(0x137)]({'name':_0x50b8cf[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':'error','error':_0x24e3f6[_0x2678da(0x129)]}),_0x4d6ec2[_0x2678da(0x1c8)]['formInterfaces'][_0x2678da(0x19a)]++;}}for(const _0x57ddaf of _0x31c15f){try{const _0x161920=_0x11ba7e[_0x2678da(0x100)](_0x57ddaf[_0x2678da(0xeb)]['name']),_0x36acd6=await yamlChatInterfaceToApi(_0x57ddaf[_0x2678da(0xeb)],_0x37bec5,_0x51321d);if(_0x161920){const _0x4de3bf=await this['client'][_0x2678da(0xe4)](_0x161920['id'],_0x36acd6);_0x4d6ec2[_0x2678da(0x19c)][_0x2678da(0x137)]({'name':_0x57ddaf['yaml'][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x4de3bf['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x19c)]['updated']++;}else{const _0x53d89c=await this[_0x2678da(0x118)][_0x2678da(0xf7)](_0x36acd6);_0x4d6ec2['chatInterfaces'][_0x2678da(0x137)]({'name':_0x57ddaf['yaml'][_0x2678da(0xf0)],'action':_0x2678da(0x1a6),'id':_0x53d89c['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x19c)][_0x2678da(0x1a6)]++;}}catch(_0x6bc64d){_0x4d6ec2[_0x2678da(0x19c)][_0x2678da(0x137)]({'name':_0x57ddaf['yaml']['name'],'action':'error','error':_0x6bc64d[_0x2678da(0x129)]}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x19c)][_0x2678da(0x19a)]++;}}return _0x4d6ec2;}async[a148_0x41755e(0xe9)](_0x414d51,_0x124d21,_0x3efea4,_0x3c1783){const _0x3c1bcc=a148_0x41755e,{projectId:_0x20942d,project:_0x41ac31}=await this[_0x3c1bcc(0x117)](_0x414d51),_0xb5121b=_0x41ac31[_0x3c1bcc(0x197)][_0x3c1bcc(0xf0)],_0x36a9f3=await this[_0x3c1bcc(0x118)][_0x3c1bcc(0x19f)](_0x20942d),_0x16b8fc=_0x36a9f3['find'](_0x33efd8=>_0x33efd8['attributes'][_0x3c1bcc(0xf0)]===_0x124d21);if(!_0x16b8fc)throw new SDKError(ErrorCode[_0x3c1bcc(0x196)],_0x3c1bcc(0x159)+_0x124d21,undefined,{'helpText':_0x3c1bcc(0xdb)+_0x36a9f3[_0x3c1bcc(0x1db)](_0x453f04=>_0x453f04[_0x3c1bcc(0x197)][_0x3c1bcc(0xf0)])['join'](',\x20')});let _0x129435;if(_0x3efea4)_0x129435=_0x3efea4;else{const _0x698642=a148_0x55bc74[_0x3c1bcc(0x16c)](process[_0x3c1bcc(0x185)](),_0x3c1bcc(0x183)),_0x5ac55a=getSanitizedPathWithMigration(_0x698642,_0xb5121b);_0x5ac55a['renamed']&&this[_0x3c1bcc(0x1be)]['info'](_0x3c1bcc(0x189)+a148_0x55bc74['basename'](_0x5ac55a[_0x3c1bcc(0x130)])+_0x3c1bcc(0x151)+a148_0x55bc74[_0x3c1bcc(0x1b2)](_0x5ac55a[_0x3c1bcc(0x11f)])),_0x129435=_0x5ac55a['path'];}const _0x575718=getSanitizedPathWithMigration(_0x129435,_0x124d21);_0x575718[_0x3c1bcc(0x153)]&&this[_0x3c1bcc(0x1be)][_0x3c1bcc(0x171)](_0x3c1bcc(0xfa)+a148_0x55bc74['basename'](_0x575718[_0x3c1bcc(0x130)])+_0x3c1bcc(0x151)+a148_0x55bc74[_0x3c1bcc(0x1b2)](_0x575718[_0x3c1bcc(0x11f)]));const _0x520300=_0x575718[_0x3c1bcc(0x11f)],_0x495cec=new Map(),_0x3f09b4=new Map(),_0x147f8c=await this[_0x3c1bcc(0x118)]['listKnowledgeBases'](_0x20942d),_0x269611=await this[_0x3c1bcc(0x118)][_0x3c1bcc(0xcf)](_0x20942d),_0x50d4ef=await safeListOrEmpty(()=>this['client'][_0x3c1bcc(0x12e)](_0x20942d)),_0x3fda05=new Map(),_0x37a14b=new Map();for(const _0x388adb of _0x147f8c){_0x495cec[_0x3c1bcc(0x157)](_0x388adb['id'],_0x388adb['attributes']['name']);}for(const _0x7b67bf of _0x269611){_0x3fda05['set'](_0x7b67bf['id'],_0x7b67bf['attributes'][_0x3c1bcc(0xf0)]);}for(const _0x2d2a5d of _0x50d4ef){_0x37a14b[_0x3c1bcc(0x157)](_0x2d2a5d['id'],_0x2d2a5d[_0x3c1bcc(0x197)][_0x3c1bcc(0xf0)]);}for(const _0x4c0538 of _0x36a9f3){_0x3f09b4[_0x3c1bcc(0x157)](_0x4c0538['id'],_0x4c0538['attributes']['name']);}const _0x4e07c3={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x495cec,'TextKnowledgeBase':_0x3fda05,'Agent':_0x3f09b4,'ExperimentalKnowledgeBase':_0x37a14b}),'resolvePromptName':async()=>undefined,'onWarning':_0x342a87=>this[_0x3c1bcc(0x1be)][_0x3c1bcc(0xed)](_0x342a87)},_0x10003e=a148_0x55bc74[_0x3c1bcc(0x16c)](_0x520300,_0x3c1bcc(0xf6)),_0x5542e4=a148_0x55bc74[_0x3c1bcc(0x16c)](_0x520300,_0x3c1bcc(0xda)),_0x98adc9=a148_0x55bc74[_0x3c1bcc(0x16c)](_0x520300,_0x3c1bcc(0x115)),_0x44db93=!a148_0x1a108a[_0x3c1bcc(0x16e)](_0x5542e4);if(_0x3c1783?.['dryRun'])return{'agentName':_0x124d21,'outputPath':_0x520300,'isNew':_0x44db93,'hasChanges':!![]};a148_0x1a108a[_0x3c1bcc(0x14e)](_0x129435,{'recursive':!![]}),a148_0x1a108a['mkdirSync'](_0x520300,{'recursive':!![]});const _0x238fbe=a148_0x55bc74[_0x3c1bcc(0x16c)](_0x129435,_0x3c1bcc(0x187));!a148_0x1a108a['existsSync'](_0x238fbe)&&a148_0x1a108a[_0x3c1bcc(0x1c6)](_0x238fbe,createAgentConfigContent(_0x414d51));const {yaml:_0x30c728,systemPrompt:_0xea56a0,starterMessage:_0x38961c}=await agentResponseToDef(_0x16b8fc,_0x4e07c3);let _0x59c3ce=_0x44db93;if(!_0x44db93){const _0x2c676f=a148_0x1a108a[_0x3c1bcc(0x16e)](_0x10003e)?a148_0x1a108a['readFileSync'](_0x10003e,_0x3c1bcc(0xfd)):'',_0x35e473=a148_0x1a108a['readFileSync'](_0x5542e4,_0x3c1bcc(0xfd));_0x59c3ce=_0x2c676f!==_0xea56a0||_0x35e473!==toAgentYamlString(_0x30c728);}a148_0x1a108a[_0x3c1bcc(0x1c6)](_0x10003e,_0xea56a0),a148_0x1a108a['writeFileSync'](_0x5542e4,toAgentYamlString(_0x30c728));if(_0x38961c&&_0x38961c[_0x3c1bcc(0x1c3)]('\x0a'))a148_0x1a108a['writeFileSync'](_0x98adc9,_0x38961c);else a148_0x1a108a['existsSync'](_0x98adc9)&&a148_0x1a108a[_0x3c1bcc(0xec)](_0x98adc9);return{'agentName':_0x124d21,'outputPath':_0x520300,'isNew':_0x44db93,'hasChanges':_0x59c3ce};}async['pushAgent'](_0x33d4d7,_0x563aaa){const _0x6fd260=a148_0x41755e;let _0x1b0f41;isAgentYamlPath(_0x33d4d7)?_0x1b0f41=getAgentDirFromYamlPath(_0x33d4d7):_0x1b0f41=_0x33d4d7;const {config:_0x4d5063}=findAgentConfig(_0x1b0f41),_0x24b66d=await this[_0x6fd260(0xff)](_0x4d5063[_0x6fd260(0xd8)]),_0x52bcfd=a148_0x55bc74[_0x6fd260(0x16c)](_0x1b0f41,_0x6fd260(0xda)),_0x50d580=a148_0x55bc74['join'](_0x1b0f41,_0x6fd260(0xf6)),_0x3c3cba=a148_0x55bc74[_0x6fd260(0x16c)](_0x1b0f41,_0x6fd260(0x115));if(!a148_0x1a108a['existsSync'](_0x52bcfd))throw new SDKError(ErrorCode[_0x6fd260(0x11a)],_0x6fd260(0x174)+_0x1b0f41,undefined,{'helpText':_0x6fd260(0xcd)});const _0x3682cd=parseAgentYaml(a148_0x1a108a['readFileSync'](_0x52bcfd,_0x6fd260(0xfd)),_0x52bcfd),_0x2c1a04=a148_0x1a108a['existsSync'](_0x50d580)?a148_0x1a108a[_0x6fd260(0xdc)](_0x50d580,_0x6fd260(0xfd)):'',_0x4cd881=a148_0x1a108a[_0x6fd260(0x16e)](_0x3c3cba)?a148_0x1a108a[_0x6fd260(0xdc)](_0x3c3cba,_0x6fd260(0xfd)):_0x3682cd[_0x6fd260(0x150)];if(_0x563aaa?.[_0x6fd260(0xe0)])return{'agentName':_0x3682cd['name'],'action':_0x6fd260(0x1a6),'projectId':_0x24b66d};const _0x140f01=await this[_0x6fd260(0x118)]['listAgentsFull'](_0x24b66d),_0x1fada5=await fetchAllToolTargetMaps((_0x164289,_0x53dd86)=>this[_0x6fd260(0x118)][_0x6fd260(0x131)](_0x164289,_0x53dd86),_0x24b66d),_0x224ff1=new Map();for(const _0x186791 of _0x140f01){_0x224ff1['set'](_0x186791[_0x6fd260(0x197)][_0x6fd260(0xf0)],_0x186791['id']);}const _0x57e35=[],_0x18ae46={'projectId':_0x24b66d,'resolveToolTargetId':buildIdResolver({..._0x1fada5[_0x6fd260(0x1dd)],'Agent':_0x224ff1}),'resolvePromptId':async()=>undefined,'onWarning':_0x73db8a=>{const _0xabe213=_0x6fd260;this[_0xabe213(0x1be)][_0xabe213(0xed)](_0x73db8a),_0x57e35[_0xabe213(0x137)](_0x73db8a);}};try{const _0x3ad680=_0x140f01[_0x6fd260(0x1e4)](_0x2ecc2d=>_0x2ecc2d[_0x6fd260(0x197)][_0x6fd260(0xf0)]===_0x3682cd['name']),_0x50ae14=await agentDefToRequest(_0x3682cd,_0x2c1a04,_0x4cd881,_0x18ae46);if(_0x3ad680)return await this[_0x6fd260(0x118)][_0x6fd260(0x116)](_0x3ad680['id'],_0x50ae14),{'agentName':_0x3682cd[_0x6fd260(0xf0)],'action':'updated','projectId':_0x24b66d,'agentId':_0x3ad680['id'],'warnings':_0x57e35[_0x6fd260(0xee)]>0x0?_0x57e35:undefined};else{const _0xffc313=await this[_0x6fd260(0x118)][_0x6fd260(0x193)](_0x50ae14);return{'agentName':_0x3682cd[_0x6fd260(0xf0)],'action':_0x6fd260(0x1a6),'projectId':_0x24b66d,'agentId':_0xffc313['id'],'warnings':_0x57e35['length']>0x0?_0x57e35:undefined};}}catch(_0x4a4bd9){return{'agentName':_0x3682cd[_0x6fd260(0xf0)],'action':_0x6fd260(0x1ba),'projectId':_0x24b66d,'error':_0x4a4bd9[_0x6fd260(0x129)],'warnings':_0x57e35[_0x6fd260(0xee)]>0x0?_0x57e35:undefined};}}async['cloneProject'](_0x3a5196,_0x542496,_0x2fd18a){const _0x8df602=a148_0x41755e,_0x429ac0=a148_0x1a108a[_0x8df602(0x16e)](_0x3a5196)&&a148_0x1a108a['existsSync'](a148_0x55bc74[_0x8df602(0x16c)](_0x3a5196,_0x8df602(0x187)));let _0xd28ff0;const _0x8809ee=[],_0x5627ec=[],_0x5de052=[],_0x5d598e=[],_0x7f94ce=[],_0x185b68=[],_0x2f9ce6=[],_0x106f5a=[],_0x2f2c13=[];if(_0x429ac0){const _0x35531b=loadAgentConfig(a148_0x55bc74[_0x8df602(0x16c)](_0x3a5196,_0x8df602(0x187)));_0xd28ff0=_0x35531b['llm_project'];const _0x5841ee=a148_0x1a108a[_0x8df602(0x1c7)](_0x3a5196,{'withFileTypes':!![]});for(const _0x3bb5d6 of _0x5841ee){if(!_0x3bb5d6[_0x8df602(0xdf)]())continue;if([_0x8df602(0x136),_0x8df602(0x102),_0x8df602(0x1a5),_0x8df602(0x1e2),_0x8df602(0x195),'form_interfaces',_0x8df602(0xf8)][_0x8df602(0x1c3)](_0x3bb5d6[_0x8df602(0xf0)]))continue;const _0x187868=a148_0x55bc74['join'](_0x3a5196,_0x3bb5d6[_0x8df602(0xf0)]);if(isAgentDir(_0x187868)){const _0x2cf959=a148_0x55bc74[_0x8df602(0x16c)](_0x187868,_0x8df602(0xda)),_0x9eb392=a148_0x55bc74['join'](_0x187868,_0x8df602(0xf6)),_0x3aeebe=a148_0x55bc74['join'](_0x187868,'starter_message.md'),_0x3afb3d=parseAgentYaml(a148_0x1a108a[_0x8df602(0xdc)](_0x2cf959,'utf-8'),_0x2cf959),_0x407add=a148_0x1a108a['existsSync'](_0x9eb392)?a148_0x1a108a[_0x8df602(0xdc)](_0x9eb392,_0x8df602(0xfd)):'',_0x1c2b5d=a148_0x1a108a['existsSync'](_0x3aeebe)?a148_0x1a108a[_0x8df602(0xdc)](_0x3aeebe,_0x8df602(0xfd)):_0x3afb3d['starter_message'];_0x8809ee['push']({'name':_0x3afb3d[_0x8df602(0xf0)],'dir':_0x187868,'yaml':_0x3afb3d,'systemPrompt':_0x407add,'starterMessage':_0x1c2b5d});}}const _0x20dd5f=getKnowledgeBasesDir(_0x3a5196);if(a148_0x1a108a['existsSync'](_0x20dd5f)){const _0x2249b7=a148_0x1a108a['readdirSync'](_0x20dd5f);for(const _0x56f621 of _0x2249b7){const _0x4739a3=a148_0x55bc74[_0x8df602(0x16c)](_0x20dd5f,_0x56f621);if(_0x56f621['endsWith'](_0x8df602(0x15c))){const _0x29bcc4=parseKnowledgeBaseYaml(a148_0x1a108a[_0x8df602(0xdc)](_0x4739a3,_0x8df602(0xfd)),_0x4739a3);_0x5627ec['push']({'name':_0x29bcc4[_0x8df602(0xf0)],'path':_0x4739a3,'yaml':_0x29bcc4});}else{if(_0x56f621['endsWith'](_0x8df602(0x1dc))){const _0x5d73c8=a148_0x1a108a['readFileSync'](_0x4739a3,'utf-8'),{name:_0x1efa8f,text:_0x23454b}=parseTextKnowledgeBaseMd(_0x5d73c8,_0x56f621);_0x5de052[_0x8df602(0x137)]({'name':_0x1efa8f,'path':_0x4739a3,'text':_0x23454b});}}}}const _0x11ee1b=getPromptsDir(_0x3a5196);if(a148_0x1a108a[_0x8df602(0x16e)](_0x11ee1b)){const _0x4adfad=a148_0x1a108a['readdirSync'](_0x11ee1b)[_0x8df602(0x182)](_0x1955f7=>_0x1955f7['endsWith']('.yml'));for(const _0x29821b of _0x4adfad){const _0x14d2b9=a148_0x55bc74['join'](_0x11ee1b,_0x29821b),_0x200c4d=parsePromptYaml(a148_0x1a108a[_0x8df602(0xdc)](_0x14d2b9,'utf-8'),_0x14d2b9);_0x5d598e[_0x8df602(0x137)]({'name':_0x200c4d[_0x8df602(0xf0)],'path':_0x14d2b9,'yaml':_0x200c4d});}}const _0x2f15e8=getIntegrationsDir(_0x3a5196);if(a148_0x1a108a['existsSync'](_0x2f15e8)){const _0xd25df9=a148_0x1a108a[_0x8df602(0x1c7)](_0x2f15e8)[_0x8df602(0x182)](_0xcf2ba5=>_0xcf2ba5[_0x8df602(0x154)](_0x8df602(0x15c)));for(const _0x1040ba of _0xd25df9){const _0x598d97=a148_0x55bc74[_0x8df602(0x16c)](_0x2f15e8,_0x1040ba),_0x1321f1=parseIntegrationYaml(a148_0x1a108a[_0x8df602(0xdc)](_0x598d97,_0x8df602(0xfd)),_0x598d97);SAFE_INTEGRATION_TYPES[_0x8df602(0x1c3)](_0x1321f1[_0x8df602(0x113)][_0x8df602(0x176)]())?_0x7f94ce[_0x8df602(0x137)]({'name':_0x1321f1[_0x8df602(0xf0)],'path':_0x598d97,'yaml':_0x1321f1}):this[_0x8df602(0x1be)]['warn'](_0x8df602(0xde)+_0x1321f1[_0x8df602(0xf0)]+_0x8df602(0x138)+_0x1321f1[_0x8df602(0x113)]+'):\x20'+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES[_0x8df602(0x16c)](',\x20')+_0x8df602(0x111)));}}const _0x1197ab=getExperimentalKnowledgeBasesDir(_0x3a5196);if(a148_0x1a108a[_0x8df602(0x16e)](_0x1197ab)){const _0x3e8811=a148_0x1a108a[_0x8df602(0x1c7)](_0x1197ab,{'withFileTypes':!![]});for(const _0x394299 of _0x3e8811){if(!_0x394299['isDirectory']())continue;const _0x14c04b=a148_0x55bc74[_0x8df602(0x16c)](_0x1197ab,_0x394299[_0x8df602(0xf0)]),_0x469edb=a148_0x55bc74['join'](_0x14c04b,_0x394299['name']+_0x8df602(0x15c));if(a148_0x1a108a['existsSync'](_0x469edb)){const _0x5e95b0=parseExperimentalKnowledgeBaseYaml(a148_0x1a108a[_0x8df602(0xdc)](_0x469edb,_0x8df602(0xfd)),_0x469edb),_0x29fd33=a148_0x55bc74['join'](_0x14c04b,_0x8df602(0xcc)),_0x110316=[];if(a148_0x1a108a['existsSync'](_0x29fd33)){const _0x3ca480=a148_0x1a108a[_0x8df602(0x1c7)](_0x29fd33,{'withFileTypes':!![]});for(const _0x5a88c4 of _0x3ca480){if(!_0x5a88c4[_0x8df602(0xdf)]())continue;const _0x354d43=a148_0x55bc74[_0x8df602(0x16c)](_0x29fd33,_0x5a88c4[_0x8df602(0xf0)]),_0x160f99=a148_0x55bc74[_0x8df602(0x16c)](_0x354d43,_0x8df602(0x184)),_0x27e495=a148_0x55bc74[_0x8df602(0x16c)](_0x354d43,'json_schema.json');if(a148_0x1a108a[_0x8df602(0x16e)](_0x160f99)&&a148_0x1a108a[_0x8df602(0x16e)](_0x27e495)){const _0x25625c=a148_0x1a108a['readFileSync'](_0x160f99,_0x8df602(0xfd)),_0x10d1af=a148_0x1a108a[_0x8df602(0xdc)](_0x27e495,_0x8df602(0xfd));_0x110316[_0x8df602(0x137)]({'name':_0x5a88c4['name'],'code':_0x25625c,'json_schema':_0x10d1af});}}}const _0x30198f={..._0x5e95b0,'functions':_0x110316};_0x185b68[_0x8df602(0x137)]({'name':_0x5e95b0['name'],'path':_0x14c04b,'def':_0x30198f});}}}const _0x5930ef=getExperimentalArtifactsDir(_0x3a5196);if(a148_0x1a108a[_0x8df602(0x16e)](_0x5930ef)){const _0x61ab7c=a148_0x1a108a[_0x8df602(0x1c7)](_0x5930ef,{'withFileTypes':!![]});for(const _0x53ee80 of _0x61ab7c){if(!_0x53ee80[_0x8df602(0xdf)]())continue;const _0x55f653=a148_0x55bc74['join'](_0x5930ef,_0x53ee80['name']),_0x2cd580=a148_0x55bc74[_0x8df602(0x16c)](_0x55f653,_0x53ee80[_0x8df602(0xf0)]+_0x8df602(0x15c));if(a148_0x1a108a[_0x8df602(0x16e)](_0x2cd580)){const _0x353589=parseExperimentalArtifactYaml(a148_0x1a108a[_0x8df602(0xdc)](_0x2cd580,'utf-8'),_0x2cd580),_0xe0cbc4=a148_0x55bc74['join'](_0x55f653,_0x8df602(0x184)),_0x2eab59=a148_0x1a108a[_0x8df602(0x16e)](_0xe0cbc4)?a148_0x1a108a[_0x8df602(0xdc)](_0xe0cbc4,_0x8df602(0xfd)):'',_0x2eded2=a148_0x55bc74[_0x8df602(0x16c)](_0x55f653,_0x8df602(0x128)),_0x4c24e3=[];if(a148_0x1a108a['existsSync'](_0x2eded2)){const _0xc502f=a148_0x1a108a[_0x8df602(0x1c7)](_0x2eded2);for(const _0x5acee4 of _0xc502f){const _0x78398b=a148_0x55bc74['join'](_0x2eded2,_0x5acee4);if(a148_0x1a108a['statSync'](_0x78398b)[_0x8df602(0xe5)]()){const _0x53b697=a148_0x1a108a[_0x8df602(0xdc)](_0x78398b,_0x8df602(0xfd));_0x4c24e3[_0x8df602(0x137)]({'file_name':_0x5acee4,'text_content':_0x53b697});}}}const _0xff1a32={..._0x353589,'code':_0x2eab59,'files':_0x4c24e3};_0x2f9ce6[_0x8df602(0x137)]({'name':_0x353589[_0x8df602(0xf0)],'path':_0x55f653,'def':_0xff1a32});}}}const _0x32630e=getFormInterfacesDir(_0x3a5196);if(a148_0x1a108a[_0x8df602(0x16e)](_0x32630e)){const _0x577dea=a148_0x1a108a[_0x8df602(0x1c7)](_0x32630e)[_0x8df602(0x182)](_0x33ed57=>_0x33ed57[_0x8df602(0x154)](_0x8df602(0x15c)));for(const _0x398fb4 of _0x577dea){const _0x48e55a=a148_0x55bc74[_0x8df602(0x16c)](_0x32630e,_0x398fb4),_0xfb44d1=parseFormInterfaceYaml(a148_0x1a108a[_0x8df602(0xdc)](_0x48e55a,'utf-8'),_0x48e55a);_0x106f5a[_0x8df602(0x137)]({'name':_0xfb44d1[_0x8df602(0xf0)],'path':_0x48e55a,'yaml':_0xfb44d1});}}const _0x571ce3=getChatInterfacesDir(_0x3a5196);if(a148_0x1a108a[_0x8df602(0x16e)](_0x571ce3)){const _0x38d720=a148_0x1a108a[_0x8df602(0x1c7)](_0x571ce3)[_0x8df602(0x182)](_0x110bde=>_0x110bde['endsWith'](_0x8df602(0x15c)));for(const _0x4bd5dd of _0x38d720){const _0xbeed81=a148_0x55bc74[_0x8df602(0x16c)](_0x571ce3,_0x4bd5dd),_0x4848c1=parseChatInterfaceYaml(a148_0x1a108a[_0x8df602(0xdc)](_0xbeed81,_0x8df602(0xfd)),_0xbeed81);_0x2f2c13['push']({'name':_0x4848c1[_0x8df602(0xf0)],'path':_0xbeed81,'yaml':_0x4848c1});}}}else{const _0x349153=await this[_0x8df602(0xff)](_0x3a5196),_0xb6dac0=await this[_0x8df602(0x118)][_0x8df602(0x1cd)](_0x349153);_0xd28ff0=_0xb6dac0[_0x8df602(0x197)][_0x8df602(0xf0)];const _0x20b14b=await this[_0x8df602(0x118)]['listAgentsFull'](_0x349153),_0x41ae73=await this['client'][_0x8df602(0x13b)](_0x349153),_0x45cd78=await this[_0x8df602(0x118)][_0x8df602(0xcf)](_0x349153),_0x48aef0=await this[_0x8df602(0x118)]['listPrompts'](_0x349153),_0x551bbc=await this[_0x8df602(0x118)][_0x8df602(0x1e7)](_0x349153),_0x465e50=await safeListOrEmpty(()=>this[_0x8df602(0x118)][_0x8df602(0x12e)](_0x349153)),_0x572275=await safeListOrEmpty(()=>this['client'][_0x8df602(0x106)](_0x349153)),_0x1133e2=new Map(),_0x3526b4=new Map(),_0x2ba58a=new Map(),_0x550d2c=new Map(),_0x5e8adc=new Map(),_0x270276=new Map();for(const _0x2e6f9f of _0x41ae73){_0x1133e2[_0x8df602(0x157)](_0x2e6f9f['id'],_0x2e6f9f[_0x8df602(0x197)][_0x8df602(0xf0)]);}for(const _0x22fcdf of _0x45cd78){_0x3526b4['set'](_0x22fcdf['id'],_0x22fcdf[_0x8df602(0x197)][_0x8df602(0xf0)]);}for(const _0x5f19b2 of _0x20b14b){_0x2ba58a[_0x8df602(0x157)](_0x5f19b2['id'],_0x5f19b2[_0x8df602(0x197)][_0x8df602(0xf0)]);}for(const _0x48bc60 of _0x48aef0){_0x550d2c[_0x8df602(0x157)](_0x48bc60['id'],_0x48bc60[_0x8df602(0x197)][_0x8df602(0xf0)]);}for(const _0x4c3b40 of _0x465e50){_0x5e8adc[_0x8df602(0x157)](_0x4c3b40['id'],_0x4c3b40[_0x8df602(0x197)][_0x8df602(0xf0)]);}for(const _0x2b3834 of _0x572275){_0x270276[_0x8df602(0x157)](_0x2b3834['id'],_0x2b3834[_0x8df602(0x197)][_0x8df602(0xf0)]);}const _0x2b7bde={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x1133e2,'TextKnowledgeBase':_0x3526b4,'Agent':_0x2ba58a,'ExperimentalKnowledgeBase':_0x5e8adc}),'resolvePromptName':async _0x4dac68=>_0x550d2c[_0x8df602(0x100)](_0x4dac68),'onWarning':_0x189dec=>this[_0x8df602(0x1be)]['warn'](_0x189dec)};for(const _0x56fb6a of _0x20b14b){const _0x3df9b0=await agentResponseToDef(_0x56fb6a,_0x2b7bde),{yaml:_0x4ddab9,systemPrompt:_0x45cc21,starterMessage:_0x5de0cc}=_0x3df9b0;_0x8809ee['push']({'name':_0x4ddab9[_0x8df602(0xf0)],'dir':'','yaml':_0x4ddab9,'systemPrompt':_0x45cc21,'starterMessage':_0x5de0cc});}for(const _0x155c20 of _0x41ae73){const _0x56f108=apiKnowledgeBaseToYaml(_0x155c20);_0x5627ec[_0x8df602(0x137)]({'name':_0x56f108['name'],'path':'','yaml':_0x56f108});}for(const _0xb0ed4a of _0x45cd78){_0x5de052[_0x8df602(0x137)]({'name':_0xb0ed4a['attributes'][_0x8df602(0xf0)],'path':'','text':_0xb0ed4a['attributes']['text']});}for(const _0x39f8a4 of _0x48aef0){const _0x2955c3=await apiPromptToYaml(_0x39f8a4,_0x2b7bde);_0x2955c3&&_0x5d598e[_0x8df602(0x137)]({'name':_0x2955c3[_0x8df602(0xf0)],'path':'','yaml':_0x2955c3});}for(const _0x11e471 of _0x551bbc){if(!_0x11e471['attributes'][_0x8df602(0x120)]&&SAFE_INTEGRATION_TYPES[_0x8df602(0x1c3)](_0x11e471[_0x8df602(0x197)]['serviceType']['toLowerCase']())){const _0x593a4e=await apiIntegrationToYaml(_0x11e471,_0x2b7bde);_0x7f94ce[_0x8df602(0x137)]({'name':_0x11e471[_0x8df602(0x197)][_0x8df602(0xf3)]['toLowerCase'](),'path':'','yaml':_0x593a4e});}}for(const _0x365a73 of _0x465e50){const _0x4e53a6=apiExperimentalKnowledgeBaseToYaml(_0x365a73);_0x185b68['push']({'name':_0x4e53a6[_0x8df602(0xf0)],'path':'','def':_0x4e53a6});}for(const _0x166929 of _0x572275){const _0x187929=apiExperimentalArtifactToYaml(_0x166929);_0x2f9ce6[_0x8df602(0x137)]({'name':_0x187929[_0x8df602(0xf0)],'path':'','def':_0x187929});}const _0x11fc25=await safeListOrEmpty(()=>this[_0x8df602(0x118)]['listFormInterfaces'](_0x349153));for(const _0x327b40 of _0x11fc25){const _0xa55743=await apiFormInterfaceToYaml(_0x327b40,_0x2b7bde);_0x106f5a[_0x8df602(0x137)]({'name':_0xa55743['name'],'path':'','yaml':_0xa55743});}const _0x3e69af=await safeListOrEmpty(()=>this[_0x8df602(0x118)]['listChatInterfaces'](_0x349153));for(const _0x43ffb7 of _0x3e69af){if(_0x43ffb7[_0x8df602(0x197)][_0x8df602(0x120)])continue;const _0x37ce61=await apiChatInterfaceToYaml(_0x43ffb7,_0x2b7bde);_0x2f2c13[_0x8df602(0x137)]({'name':_0x37ce61[_0x8df602(0xf0)],'path':'','yaml':_0x37ce61});}}const _0xda017={'sourceProjectName':_0xd28ff0,'newProjectName':_0x542496,'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}}},_0x28a75e=await this[_0x8df602(0x118)][_0x8df602(0x12a)](),_0x41776e=_0x28a75e[_0x8df602(0x1e4)](_0xed4789=>_0xed4789['attributes']['name']===_0x542496);if(_0x41776e)throw new SDKError(ErrorCode[_0x8df602(0x1b9)],_0x8df602(0x108)+_0x542496+_0x8df602(0x1ae),undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x2fd18a?.['dryRun'])return _0xda017[_0x8df602(0x1c8)][_0x8df602(0x183)][_0x8df602(0x1a6)]=_0x8809ee[_0x8df602(0xee)],_0xda017[_0x8df602(0x1c8)][_0x8df602(0x179)][_0x8df602(0x1a6)]=_0x5627ec[_0x8df602(0xee)],_0xda017['counts'][_0x8df602(0x170)][_0x8df602(0x1a6)]=_0x5de052[_0x8df602(0xee)],_0xda017[_0x8df602(0x1c8)][_0x8df602(0x1b7)][_0x8df602(0x1a6)]=_0x185b68[_0x8df602(0xee)],_0xda017[_0x8df602(0x1c8)][_0x8df602(0x10f)]['created']=_0x2f9ce6[_0x8df602(0xee)],_0xda017[_0x8df602(0x1c8)][_0x8df602(0x1e2)]['created']=_0x5d598e[_0x8df602(0xee)],_0xda017[_0x8df602(0x1c8)][_0x8df602(0x195)][_0x8df602(0x1a6)]=_0x7f94ce[_0x8df602(0xee)],_0xda017;const _0x4737aa=await this[_0x8df602(0x118)][_0x8df602(0x104)]({'name':_0x542496}),_0x16d8bd=_0x4737aa['id'];_0xda017[_0x8df602(0x161)]=_0x16d8bd;const _0xefe2=new Map(),_0xd843ea=new Map(),_0x3d118a=new Map(),_0x48ad91=new Map(),_0x51bcb4=new Map(),_0x2b0c9a=new Map(),_0x2ecf4b=new Map(),_0x54f142=new Map(),_0x52c7e3=new Set(),_0x59b891=new Set();for(const _0x5334b0 of _0x8809ee){for(const _0x175781 of _0x5334b0['yaml'][_0x8df602(0x1d7)]||[]){if(_0x175781[_0x8df602(0x1df)]===_0x8df602(0x148)&&_0x175781[_0x8df602(0x122)]){const _0x2d3fc3=parseRef(_0x175781[_0x8df602(0x122)]);if(_0x2d3fc3)_0x52c7e3[_0x8df602(0x110)](_0x2d3fc3[_0x8df602(0xf0)]);}else{if(_0x175781['type']==='web_search'&&_0x175781[_0x8df602(0x122)]){const _0x5df154=parseRef(_0x175781[_0x8df602(0x122)]);if(_0x5df154)_0x59b891[_0x8df602(0x110)](_0x5df154['name']);}}}}for(const _0x230842 of _0x52c7e3){try{const _0x4c6f6f=await this['client']['createImageGenerator']({'projectId':_0x16d8bd,'name':_0x230842});_0x51bcb4[_0x8df602(0x157)](_0x230842,_0x4c6f6f['id']),_0xda017['imageGenerators'][_0x8df602(0x137)]({'name':_0x230842,'action':_0x8df602(0x1a6),'id':_0x4c6f6f['id']}),_0xda017[_0x8df602(0x1c8)]['imageGenerators'][_0x8df602(0x1a6)]++;}catch(_0x353e53){_0xda017[_0x8df602(0x11e)][_0x8df602(0x137)]({'name':_0x230842,'action':_0x8df602(0x1ba),'error':_0x353e53[_0x8df602(0x129)]}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x11e)][_0x8df602(0x19a)]++;}}for(const _0x20e21b of _0x59b891){try{const _0x57c01d=await this['client'][_0x8df602(0x1a0)]({'projectId':_0x16d8bd,'name':_0x20e21b});_0x2b0c9a['set'](_0x20e21b,_0x57c01d['id']),_0xda017[_0x8df602(0x123)]['push']({'name':_0x20e21b,'action':'created','id':_0x57c01d['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x123)][_0x8df602(0x1a6)]++;}catch(_0x4f0ac2){_0xda017[_0x8df602(0x123)][_0x8df602(0x137)]({'name':_0x20e21b,'action':_0x8df602(0x1ba),'error':_0x4f0ac2[_0x8df602(0x129)]}),_0xda017['counts'][_0x8df602(0x123)]['errors']++;}}const _0x4b7939=await fetchAllToolTargetMaps((_0x4ffdea,_0x5a7c70)=>this[_0x8df602(0x118)]['listToolTargets'](_0x4ffdea,_0x5a7c70),_0x16d8bd);let _0xfa0d4b=[];const _0x328035={'projectId':_0x16d8bd,'resolveToolTargetId':buildIdResolver({..._0x4b7939[_0x8df602(0x1dd)],'KnowledgeBase':_0xefe2,'TextKnowledgeBase':_0xd843ea,'ExperimentalKnowledgeBase':_0x2ecf4b,'Agent':_0x3d118a,'WebSearchTool':_0x2b0c9a,'ImageGenerator':_0x51bcb4}),'resolvePromptId':async _0x1f4ef0=>_0x48ad91[_0x8df602(0x100)](_0x1f4ef0),'onWarning':_0x37ad19=>{const _0x34d4b2=_0x8df602;this[_0x34d4b2(0x1be)][_0x34d4b2(0xed)](_0x37ad19),_0xfa0d4b['push'](_0x37ad19);}};for(const _0x336ce7 of _0x5627ec){try{const _0x2c6cf0=yamlKnowledgeBaseToApi(_0x336ce7[_0x8df602(0xeb)],_0x16d8bd),_0xb869e=await this[_0x8df602(0x118)][_0x8df602(0x1b0)](_0x2c6cf0);_0xefe2[_0x8df602(0x157)](_0x336ce7[_0x8df602(0xeb)]['name'],_0xb869e['id']),_0xda017[_0x8df602(0x179)]['push']({'name':_0x336ce7[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':_0x8df602(0x1a6),'id':_0xb869e['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x179)]['created']++;}catch(_0x97fe00){_0xda017[_0x8df602(0x179)][_0x8df602(0x137)]({'name':_0x336ce7[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':_0x8df602(0x1ba),'error':_0x97fe00[_0x8df602(0x129)]}),_0xda017[_0x8df602(0x1c8)]['knowledgeBases']['errors']++;}}for(const _0x4be8e7 of _0x5de052){try{const _0x2b9ec3=yamlTextKnowledgeBaseToApi({'name':_0x4be8e7[_0x8df602(0xf0)],'text':_0x4be8e7[_0x8df602(0x11c)]},_0x16d8bd),_0xaecf08=await this['client'][_0x8df602(0x16f)](_0x2b9ec3);_0xd843ea[_0x8df602(0x157)](_0x4be8e7[_0x8df602(0xf0)],_0xaecf08['id']),_0xda017[_0x8df602(0x170)]['push']({'name':_0x4be8e7[_0x8df602(0xf0)],'action':_0x8df602(0x1a6),'id':_0xaecf08['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x170)]['created']++;}catch(_0x1ccc1e){_0xda017[_0x8df602(0x170)][_0x8df602(0x137)]({'name':_0x4be8e7['name'],'action':_0x8df602(0x1ba),'error':_0x1ccc1e['message']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x170)]['errors']++;}}for(const _0x2a04b3 of _0x2f9ce6){try{const _0xd0c4fc=yamlExperimentalArtifactToApi(_0x2a04b3[_0x8df602(0x18b)],_0x16d8bd),_0x569e40=await this[_0x8df602(0x118)][_0x8df602(0x192)](_0xd0c4fc);_0x54f142[_0x8df602(0x157)](_0x2a04b3['def'][_0x8df602(0xf0)],_0x569e40['id']),_0xda017[_0x8df602(0x10f)]['push']({'name':_0x2a04b3[_0x8df602(0x18b)][_0x8df602(0xf0)],'action':_0x8df602(0x1a6),'id':_0x569e40['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x10f)][_0x8df602(0x1a6)]++;}catch(_0x575941){_0xda017[_0x8df602(0x10f)][_0x8df602(0x137)]({'name':_0x2a04b3[_0x8df602(0x18b)][_0x8df602(0xf0)],'action':_0x8df602(0x1ba),'error':_0x575941[_0x8df602(0x129)]}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x10f)][_0x8df602(0x19a)]++;}}for(const _0x393df7 of _0x185b68){try{const _0x446e3f=yamlExperimentalKnowledgeBaseToApi(_0x393df7[_0x8df602(0x18b)],_0x16d8bd),_0x17790e=await this[_0x8df602(0x118)]['createExperimentalKnowledgeBase'](_0x446e3f);_0x2ecf4b[_0x8df602(0x157)](_0x393df7[_0x8df602(0x18b)][_0x8df602(0xf0)],_0x17790e['id']),_0xda017[_0x8df602(0x1b7)][_0x8df602(0x137)]({'name':_0x393df7['def'][_0x8df602(0xf0)],'action':_0x8df602(0x1a6),'id':_0x17790e['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x1b7)][_0x8df602(0x1a6)]++;}catch(_0x4bd554){_0xda017[_0x8df602(0x1b7)][_0x8df602(0x137)]({'name':_0x393df7['def']['name'],'action':_0x8df602(0x1ba),'error':_0x4bd554[_0x8df602(0x129)]}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x1b7)][_0x8df602(0x19a)]++;}}const _0xfbe50c=[..._0x8809ee][_0x8df602(0x1b5)]((_0x27f436,_0x347445)=>{const _0x416a64=_0x8df602,_0x1f83fb=_0x27f436[_0x416a64(0xeb)]['tools']?.['some'](_0x57bed2=>_0x57bed2[_0x416a64(0x1df)]===_0x416a64(0x1af))??![],_0x41c174=_0x347445[_0x416a64(0xeb)][_0x416a64(0x1d7)]?.['some'](_0x263af7=>_0x263af7[_0x416a64(0x1df)]===_0x416a64(0x1af))??![];if(_0x1f83fb&&!_0x41c174)return 0x1;if(!_0x1f83fb&&_0x41c174)return-0x1;return 0x0;});for(const _0x2f178b of _0xfbe50c){_0xfa0d4b=[];try{const _0xdf5cc2=_0x2f178b[_0x8df602(0xeb)][_0x8df602(0x1d7)]?.[_0x8df602(0x182)](_0x4ece99=>{const _0x39174f=_0x8df602;if(_0x4ece99[_0x39174f(0x1df)]==='agent'&&_0x4ece99[_0x39174f(0x122)]){const _0xd672a9=parseRef(_0x4ece99['target']);return _0xd672a9?.[_0x39174f(0xf0)]===_0x2f178b[_0x39174f(0xeb)][_0x39174f(0xf0)];}return![];})??[];if(_0xdf5cc2[_0x8df602(0xee)]>0x0){const _0x4ebe5a='Agent\x20\x27'+_0x2f178b['yaml']['name']+_0x8df602(0x14c)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this[_0x8df602(0x1be)]['warn'](_0x4ebe5a),_0xfa0d4b[_0x8df602(0x137)](_0x4ebe5a);}const _0x459f63=await agentDefToRequest(_0x2f178b[_0x8df602(0xeb)],_0x2f178b[_0x8df602(0x177)],_0x2f178b['starterMessage'],_0x328035),_0xcf3cd7=await this['client'][_0x8df602(0x193)](_0x459f63);_0x3d118a[_0x8df602(0x157)](_0x2f178b['yaml'][_0x8df602(0xf0)],_0xcf3cd7['id']),_0xda017[_0x8df602(0x183)][_0x8df602(0x137)]({'agentName':_0x2f178b[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':_0x8df602(0x1a6),'agentId':_0xcf3cd7['id'],'warnings':_0xfa0d4b[_0x8df602(0xee)]>0x0?_0xfa0d4b:undefined}),_0xda017['counts'][_0x8df602(0x183)][_0x8df602(0x1a6)]++;}catch(_0x315339){_0xda017['agents']['push']({'agentName':_0x2f178b[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':'error','error':_0x315339['message'],'warnings':_0xfa0d4b[_0x8df602(0xee)]>0x0?_0xfa0d4b:undefined}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x183)][_0x8df602(0x19a)]++;}}for(const _0x5ccbed of _0x5d598e){try{const _0x7b4b0a=await yamlPromptToApi(_0x5ccbed[_0x8df602(0xeb)],_0x16d8bd,_0x328035);if(!_0x7b4b0a){_0xda017[_0x8df602(0x1e2)][_0x8df602(0x137)]({'name':_0x5ccbed[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':_0x8df602(0x1ba),'error':'Agent\x20reference\x20not\x20found'}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x1e2)][_0x8df602(0x19a)]++;continue;}const _0x1d0520=await this[_0x8df602(0x118)][_0x8df602(0x1ce)](_0x7b4b0a);_0x48ad91['set'](_0x5ccbed[_0x8df602(0xeb)][_0x8df602(0xf0)],_0x1d0520['id']),_0xda017[_0x8df602(0x1e2)][_0x8df602(0x137)]({'name':_0x5ccbed[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':_0x8df602(0x1a6),'id':_0x1d0520['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x1e2)][_0x8df602(0x1a6)]++;}catch(_0xb6e0b2){_0xda017[_0x8df602(0x1e2)]['push']({'name':_0x5ccbed[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':_0x8df602(0x1ba),'error':_0xb6e0b2[_0x8df602(0x129)]}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x1e2)][_0x8df602(0x19a)]++;}}for(const _0x37593d of _0x7f94ce){try{const _0x501836=await yamlIntegrationToApi(_0x37593d[_0x8df602(0xeb)],_0x16d8bd,_0x328035),_0x1302c8=await this['client'][_0x8df602(0xf9)](_0x501836);_0xda017[_0x8df602(0x195)][_0x8df602(0x137)]({'name':_0x37593d['yaml'][_0x8df602(0x113)],'action':'created','id':_0x1302c8['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x195)]['created']++;}catch(_0x16b6a3){_0xda017[_0x8df602(0x195)][_0x8df602(0x137)]({'name':_0x37593d[_0x8df602(0xeb)]['service_type'],'action':_0x8df602(0x1ba),'error':_0x16b6a3['message']}),_0xda017['counts']['integrations'][_0x8df602(0x19a)]++;}}for(const _0xef73a2 of _0x106f5a){try{const _0x2ecad2=await yamlFormInterfaceToApi(_0xef73a2['yaml'],_0x16d8bd,_0x328035);if(!_0x2ecad2){_0xda017[_0x8df602(0x18a)]['push']({'name':_0xef73a2['yaml'][_0x8df602(0xf0)],'action':_0x8df602(0x1ba),'error':_0x8df602(0x162)}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x18a)][_0x8df602(0x19a)]++;continue;}const _0x6f88d4=await this[_0x8df602(0x118)][_0x8df602(0x10e)](_0x2ecad2);_0xda017['formInterfaces'][_0x8df602(0x137)]({'name':_0xef73a2['yaml'][_0x8df602(0xf0)],'action':'created','id':_0x6f88d4['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x18a)][_0x8df602(0x1a6)]++;}catch(_0x56fb49){_0xda017[_0x8df602(0x18a)][_0x8df602(0x137)]({'name':_0xef73a2[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':_0x8df602(0x1ba),'error':_0x56fb49['message']}),_0xda017[_0x8df602(0x1c8)]['formInterfaces'][_0x8df602(0x19a)]++;}}for(const _0x5f4a90 of _0x2f2c13){try{const _0x4508f4=await yamlChatInterfaceToApi(_0x5f4a90[_0x8df602(0xeb)],_0x16d8bd,_0x328035),_0x591a87=await this[_0x8df602(0x118)][_0x8df602(0xf7)](_0x4508f4);_0xda017['chatInterfaces']['push']({'name':_0x5f4a90[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':'created','id':_0x591a87['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x19c)][_0x8df602(0x1a6)]++;}catch(_0x5b987b){_0xda017[_0x8df602(0x19c)]['push']({'name':_0x5f4a90[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':_0x8df602(0x1ba),'error':_0x5b987b['message']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x19c)]['errors']++;}}return _0xda017;}}
|