@treasuredata/tdx 2026.4.20 → 2026.4.22
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.js +1 -1
- package/dist/commands/cas-command.js +1 -1
- package/dist/commands/cas-segment-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.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-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.d.ts +47 -0
- package/dist/commands/engage-command.d.ts.map +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-command.js.map +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/policy-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/work-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/oauth-keychain.js +1 -1
- package/dist/core/oauth.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/tools/work-create-item.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.d.ts.map +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/claude-usage-tracker.js.map +1 -1
- package/dist/proxy/passthrough-server.d.ts +10 -0
- package/dist/proxy/passthrough-server.d.ts.map +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/passthrough-server.js.map +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/cas/cas-api-client.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js +1 -1
- package/dist/sdk/cas/cas-segment-yaml.js +1 -1
- package/dist/sdk/cas/index.js +1 -1
- package/dist/sdk/cas/pull-workflow.js +1 -1
- package/dist/sdk/cas/push-workflow.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.d.ts +50 -1
- package/dist/sdk/client/engage-api-client.d.ts.map +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/engage-api-client.js.map +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage.d.ts +35 -1
- package/dist/sdk/engage.d.ts.map +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/engage.js.map +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.d.ts +33 -9
- package/dist/sdk/llm/model-factors.d.ts.map +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/llm/model-factors.js.map +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/engage.d.ts +53 -0
- package/dist/sdk/types/engage.d.ts.map +1 -1
- package/dist/sdk/types/index.d.ts +1 -1
- package/dist/sdk/types/index.d.ts.map +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/index.js.map +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/types/workspace.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/task-graph.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/sdk/workspace/access-tracker.js +1 -1
- package/dist/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
package/dist/sdk/llm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a133_0x31c45e=a133_0x507f;(function(_0x560680,_0x5bf76a){const _0x361521=a133_0x507f,_0x2a3d2b=_0x560680();while(!![]){try{const _0x15d482=-parseInt(_0x361521(0x8e))/0x1*(-parseInt(_0x361521(0x174))/0x2)+parseInt(_0x361521(0xa2))/0x3+-parseInt(_0x361521(0x124))/0x4+-parseInt(_0x361521(0x139))/0x5*(parseInt(_0x361521(0x129))/0x6)+parseInt(_0x361521(0x144))/0x7+-parseInt(_0x361521(0x170))/0x8+-parseInt(_0x361521(0x162))/0x9*(-parseInt(_0x361521(0xf7))/0xa);if(_0x15d482===_0x5bf76a)break;else _0x2a3d2b['push'](_0x2a3d2b['shift']());}catch(_0x193deb){_0x2a3d2b['push'](_0x2a3d2b['shift']());}}}(a133_0x4271,0x8f951));function a133_0x507f(_0x1ff87a,_0x354b37){_0x1ff87a=_0x1ff87a-0x88;const _0x427145=a133_0x4271();let _0x507feb=_0x427145[_0x1ff87a];return _0x507feb;}import{LLMApiClient}from'../client/llm-api-client.js';import*as a133_0x39da6b from'node:fs';import*as a133_0x43bfdf from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';function a133_0x4271(){const _0x2df129=['.yml','chatInterfaces','updated','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','Available\x20agents:\x20','listExperimentalKnowledgeBases','find','existsSync','Renamed\x20KB\x20file:\x20','web_search','knowledge_bases','set','createWebSearchTool','4133000hBZDfR','promptId','Renamed\x20text\x20KB\x20file:\x20','agents.json','26wQmQiG','Agent\x20\x27','tools','listToolTargets','knowledgebases.json','#\x20prompt.md\x0a','LLM_PROJECT_NOT_FOUND','agentsFull','Could\x20not\x20resolve\x20agent\x20reference','createKnowledgeBase','agent.yml','AGENT_NOT_FOUND','tdx.json','createAgentResponse','experimental_knowledge_bases','pullAgent','filter','\x0a---\x20schema:\x20','createIntegration','nameToId','conflict','total','prompt.md','ALREADY_EXISTS','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','getChatLog','agent','Unresolved\x20dependencies:\x20','sort','error','chat_interfaces','\x27\x20(','actions','file_name','client','):\x20','createFormInterface','createChatInterface','def','functions','\x20---\x0a','target','experimentalKnowledgeBases','push','cloneProject','listTextKnowledgeBases','get','listAgents','availableModels','attributes','deleteAgent','serviceType','warn','llm_project',')\x20can\x20be\x20cloned.','---\x20schema:\x20','UNAUTHENTICATED','integrations.json','availableModelNames','KnowledgeBase','webhookCorsOrigins','knowledgeBases','Renamed\x20chat\x20interface\x20file:\x20','pushProject','Only\x20safe\x20types\x20(','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','size','36529DeiASv','has','currentProjectId','temperature','info','resolveProjectId','listKnowledgeBases','oldPath','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','add','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','Removed\x20deleted\x20file:\x20','resolveProjectName','text','chat_parent_segment','chat','createTextKnowledgeBase','dryRun','createExperimentalKnowledgeBase','endsWith','452268VHzZqF','tdx_default_','listImageGenerators','projectName','createPrompt','code.js','some','length','Project\x20not\x20found:\x20','experimental_artifacts','site','errors','action','getUserSettings','join','json_schema.json','tdDatabaseName','Multiple\x20projects\x20found\x20with\x20name\x20\x27','dirname','Agent\x20reference\x20not\x20found','\x20attempts\x20due\x20to\x20name\x20conflicts.','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','already\x20exists','context','isFile','unchanged','models','startChat','maxToolIterations','listChatInterfaces','statSync','listChats','path','Renamed\x20agent\x20folder:\x20','_reasoning_','utf-8','json_schema','listFormInterfaces','tables','starter_message.md','Skipping\x20integration\x20\x27','getDefaultProjectName','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','exportedFrom','createExperimentalArtifact','starterMessage','renamed','agent.yml\x20not\x20found\x20in\x20','projectId','getCurrentProject','files','isManaged','\x22\x20already\x20exists','listPrompts','yaml','isDirectory','listAgentsFull','getBackupMetadata','counts','webSearchTools','getChatInfo','outputs','formInterfaces','jsonSchemaHint','sdk.llm','updateAgent','pullProject','map','getOrCreateDefaultAgent','profile','updatePrompt','newProjectId','getAgent','text_content','chat_agent_console','stringify','chatWelcomeMessage','chat_generic','toLowerCase','type','image_gen','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','Renamed\x20integration\x20file:\x20','mkdirSync','parse','40DJvqJo','TextKnowledgeBase','deleteProject','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','version','listIntegrations','localeCompare','Agent\x20not\x20found:\x20','content','No\x20tdx.json\x20found\x20in\x20','getDefaultAgent','setDefaultAgent','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','Backup\x20folder\x20not\x20found:\x20','unlinkSync','pushAgent','createProject','message','service_type','form_interfaces','rmSync','high','status','.llm','minimal','listExperimentalArtifacts','modelType','INVALID_ARGUMENT','Renamed\x20prompt\x20file:\x20','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','backupProject','toISOString','starter_message','signal','template','listProjects','resolveAgentId','imageGenerators','Project\x20\x22','agents','description','getChatHistory','variables','deleteIntegration','writeFileSync','1987740unlSvt','project.json','textKnowledgeBases','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','chatIgnoreManagedActions','3522900qWARUP','updateExperimentalKnowledgeBase','\x0a\x0a#\x20agent.yml\x0a','agentId','experimentalArtifacts','readFileSync','updateExperimentalArtifact','\x0a---\x20code\x20---\x0a','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','cwd','logger','updateAgentResponse','new','code','Renamed\x20experimental\x20KB\x20directory:\x20','tdx_','10nfMgXa','idToName','createAgent','\x20→\x20','claude-4.5-sonnet','isDir','Unable\x20to\x20create\x20project\x20after\x20','none','name','getOrCreateDefaultProject','PERMISSION_DENIED','2601452LwYBWJ','prompts','.md','updateKnowledgeBase','Removed\x20deleted\x20directory:\x20','created','metadata','getProject','dry-run-','---\x20file:\x20','history','1.0','systemPrompt','\x20in\x20project\x20','loadJsonFile','integrations','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.','Invalid\x20agent\x20reference\x20format:\x20','Renamed\x20experimental\x20artifact\x20directory:\x20','readdirSync','INTERNAL','\x27.\x20This\x20should\x20not\x20happen.','includes','reasoningEffort','basename','displayName','low','ExperimentalKnowledgeBase','\x0a---\x20function:\x20','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','4002084AuSpoS'];a133_0x4271=function(){return _0x2df129;};return a133_0x4271();}import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a133_0x31c45e(0xef),a133_0x31c45e(0xec),a133_0x31c45e(0x9c)];async function safeListOrEmpty(_0x27bf88){try{return await _0x27bf88();}catch(_0x4682de){if(_0x4682de instanceof HTTPClientError&&_0x4682de['status']===0x194)return[];throw _0x4682de;}}export class LLMSDK{[a133_0x31c45e(0x90)];['client'];[a133_0x31c45e(0xb9)];[a133_0x31c45e(0x133)]=Logger['of'](a133_0x31c45e(0xe2));constructor(_0x42ebb1){const _0x5e588e=a133_0x31c45e;this[_0x5e588e(0x196)]=new LLMApiClient(_0x42ebb1),this[_0x5e588e(0xb9)]=_0x42ebb1;}[a133_0x31c45e(0xcb)](){const _0x446189=a133_0x31c45e,_0x43ad10=getSanitizedUsername();return _0x446189(0xa3)+_0x43ad10;}async['setCurrentProject'](_0x36bf6c){const _0x2f479d=a133_0x31c45e,{projectId:_0x5e4676}=await this[_0x2f479d(0x9a)](_0x36bf6c);this[_0x2f479d(0x90)]=_0x5e4676;}[a133_0x31c45e(0xd3)](){const _0x4a2f99=a133_0x31c45e;return this[_0x4a2f99(0x90)];}async[a133_0x31c45e(0x102)](_0x29ae34){const _0xe756f7=a133_0x31c45e,_0x1831c5=this['context'][_0xe756f7(0xe7)];let _0x5bc6b9,_0xb5202f;if(_0x29ae34[_0xe756f7(0x15a)]('/')){const _0x2f161d=_0x29ae34['split']('/');if(_0x2f161d[_0xe756f7(0xa9)]!==0x2)throw new SDKError(ErrorCode[_0xe756f7(0x112)],_0xe756f7(0x155)+_0x29ae34,undefined,{'helpText':_0xe756f7(0x161)});const [_0x437858,_0x1d57d7]=_0x2f161d;_0x5bc6b9=await this[_0xe756f7(0x93)](_0x437858),_0xb5202f=_0x1d57d7;}else _0x5bc6b9=this[_0xe756f7(0x90)]||(await this['getOrCreateDefaultProject']())['id'],_0xb5202f=_0x29ae34;const _0x9cb475=await this[_0xe756f7(0x11b)](_0xb5202f,_0x5bc6b9),_0x696ca0=await this[_0xe756f7(0x196)][_0xe756f7(0xea)](_0x9cb475);writeCachedLLMAgent(_0x696ca0['attributes'][_0xe756f7(0x141)],_0x9cb475,_0x5bc6b9,_0x1831c5);}[a133_0x31c45e(0x101)](){const _0x83a087=a133_0x31c45e,_0x18aa73=this[_0x83a087(0xb9)][_0x83a087(0xe7)];return readCachedLLMAgent(_0x18aa73)||undefined;}['clearDefaultAgent'](){const _0x4f5a92=a133_0x31c45e,_0x1f8db6=this[_0x4f5a92(0xb9)]['profile'];clearCachedLLMAgent(_0x1f8db6);}async[a133_0x31c45e(0xbc)](){const _0x270283=a133_0x31c45e,_0x55df74=await this[_0x270283(0x196)][_0x270283(0xaf)](),_0x237684=[];for(const _0x13c5af of _0x55df74[_0x270283(0x1ae)]){const _0x3f6037=_0x55df74[_0x270283(0x1a4)][_0x13c5af];_0x3f6037&&_0x237684[_0x270283(0x19f)]({'name':_0x13c5af,'displayName':_0x3f6037[_0x270283(0x15d)]});}return _0x237684;}async['createProject'](_0xc0c04a){const _0x4d9a13=a133_0x31c45e;return await this[_0x4d9a13(0x196)][_0x4d9a13(0x107)](_0xc0c04a);}async[a133_0x31c45e(0xf9)](_0xb46eff){const _0x2972d7=a133_0x31c45e,{projectId:_0x27e4cb}=await this['resolveProjectName'](_0xb46eff);await this['client'][_0x2972d7(0xf9)](_0x27e4cb);}async['projects'](_0x31e752=0x32){const _0x788e35=a133_0x31c45e;return await this[_0x788e35(0x196)][_0x788e35(0x11a)](_0x31e752);}async['getOrCreateDefaultProject'](_0x2ecf3d){const _0x3b0a56=a133_0x31c45e,_0x22a7f6=_0x2ecf3d||this[_0x3b0a56(0xcb)](),_0x46b9bf=this['context'][_0x3b0a56(0xe7)];if(!_0x2ecf3d){const _0x518e2e=readCachedLLMProject(_0x46b9bf);if(_0x518e2e&&_0x518e2e['name']===_0x22a7f6)try{const _0x5d8616=await this['client']['getProject'](_0x518e2e['id']);if(_0x5d8616[_0x3b0a56(0x1a5)][_0x3b0a56(0x141)]===_0x22a7f6)return _0x5d8616;}catch{}}const _0x4600b6=await this[_0x3b0a56(0x196)][_0x3b0a56(0x11a)](),_0x38b8c2=_0x4600b6[_0x3b0a56(0x169)](_0x2b0839=>_0x2b0839[_0x3b0a56(0x1a5)][_0x3b0a56(0x141)]===_0x22a7f6);if(_0x38b8c2)return!_0x2ecf3d&&writeCachedLLMProject(_0x22a7f6,_0x38b8c2['id'],_0x46b9bf),_0x38b8c2;const _0x5be9d0=await this[_0x3b0a56(0x196)][_0x3b0a56(0x107)]({'name':_0x22a7f6,'description':'Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20'+getSanitizedUsername()+')'});return!_0x2ecf3d&&writeCachedLLMProject(_0x22a7f6,_0x5be9d0['id'],_0x46b9bf),_0x5be9d0;}async[a133_0x31c45e(0x93)](_0x381a35){const _0x47a98f=a133_0x31c45e,_0x447c3d=await this[_0x47a98f(0x196)][_0x47a98f(0x11a)](),_0x551a05=_0x447c3d[_0x47a98f(0x184)](_0x564eea=>_0x564eea[_0x47a98f(0x1a5)][_0x47a98f(0x141)]===_0x381a35);if(_0x551a05['length']===0x0)throw new SDKError(ErrorCode[_0x47a98f(0x17a)],_0x47a98f(0xaa)+_0x381a35,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x551a05[_0x47a98f(0xa9)]>0x1)throw new SDKError(ErrorCode[_0x47a98f(0x158)],_0x47a98f(0xb3)+_0x381a35+'\x27.\x20This\x20should\x20not\x20happen.');return _0x551a05[0x0]['id'];}async['resolveProjectName'](_0x4cdcd2){const _0x5b3715=a133_0x31c45e,_0x1ef008=await this[_0x5b3715(0x196)][_0x5b3715(0x11a)](),_0x2ee767=_0x1ef008['find'](_0x132a1f=>_0x132a1f[_0x5b3715(0x1a5)][_0x5b3715(0x141)]===_0x4cdcd2);if(_0x2ee767)return{'projectId':_0x2ee767['id'],'project':_0x2ee767};throw new SDKError(ErrorCode[_0x5b3715(0x17a)],_0x5b3715(0xaa)+_0x4cdcd2,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async[a133_0x31c45e(0xe6)](_0x260add=a133_0x31c45e(0x13d),_0x3fae4c=0x0,_0x22d5cb){const _0x164472=a133_0x31c45e,_0x1ea97d=0xa;let _0x5717a0=0x0,_0x65ea5c;while(_0x5717a0<_0x1ea97d){try{const _0x308e41=await this[_0x164472(0x142)](_0x65ea5c),_0x529738=_0x308e41['id'],_0x506807=[_0x164472(0x140),_0x164472(0x10f),_0x164472(0x15e),'medium',_0x164472(0x10c)],_0x18ded4=_0x3fae4c===0x0?_0x164472(0x138)+_0x260add:_0x164472(0x138)+_0x260add+_0x164472(0xc4)+_0x506807[_0x3fae4c],_0x39e94f=await this[_0x164472(0x196)][_0x164472(0x1a3)](_0x529738),_0x48c6a2=_0x39e94f[_0x164472(0x169)](_0x2eb86a=>_0x2eb86a[_0x164472(0x1a5)]['name']===_0x18ded4);if(_0x48c6a2)return _0x48c6a2;const _0x4cc80a=_0x3fae4c>0x0?0x1:_0x22d5cb;return await this[_0x164472(0x196)][_0x164472(0x13b)]({'name':_0x18ded4,'projectId':_0x529738,'modelType':_0x260add,'systemPrompt':'','temperature':_0x4cc80a,'reasoningEffort':_0x3fae4c>0x0?_0x3fae4c:undefined});}catch(_0x31b9a4){if(_0x31b9a4 instanceof HTTPClientError){const _0x5d6a83=_0x31b9a4[_0x164472(0x10d)];if(_0x5d6a83>=0x190&&_0x5d6a83<0x1f4){if(_0x5d6a83===0x191)throw new SDKError(ErrorCode[_0x164472(0x1ac)],_0x164472(0x131),_0x31b9a4);else{if(_0x5d6a83===0x193)throw new SDKError(ErrorCode[_0x164472(0x143)],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x31b9a4);}throw _0x31b9a4;}}if(errorContains(_0x31b9a4,_0x164472(0xb8),'duplicate',_0x164472(0x188))){_0x5717a0++;if(_0x5717a0>=_0x1ea97d)throw new SDKError(ErrorCode[_0x164472(0x18b)],_0x164472(0x13f)+_0x1ea97d+_0x164472(0xb6),_0x31b9a4);const _0x5dd6af=this['getDefaultProjectName']();_0x65ea5c=_0x5dd6af+'_'+generateRandomHex();continue;}throw _0x31b9a4;}}throw new SDKError(ErrorCode[_0x164472(0x158)],_0x164472(0x103));}async[a133_0x31c45e(0x11b)](_0x2031cd,_0x2ab2dc){const _0x291ec3=a133_0x31c45e,_0x2fba42=_0x2ab2dc||this['currentProjectId'],_0x4b5ab0=await this[_0x291ec3(0x196)][_0x291ec3(0x1a3)](_0x2fba42),_0x453c90=_0x4b5ab0[_0x291ec3(0x184)](_0x410e16=>_0x410e16[_0x291ec3(0x1a5)][_0x291ec3(0x141)]===_0x2031cd);if(_0x453c90['length']===0x0){const _0x195a84=_0x2fba42?_0x291ec3(0x151)+_0x2fba42:'';throw new SDKError(ErrorCode[_0x291ec3(0x17f)],_0x291ec3(0xfe)+_0x2031cd+_0x195a84,undefined,{'helpText':_0x2fba42?'Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.':_0x291ec3(0x154)});}if(_0x453c90['length']>0x1)throw new SDKError(ErrorCode[_0x291ec3(0x158)],'Multiple\x20agents\x20found\x20with\x20name\x20\x27'+_0x2031cd+_0x291ec3(0x159));return _0x453c90[0x0]['id'];}async[a133_0x31c45e(0x11e)](_0x23509f){const _0x28fe2c=a133_0x31c45e,_0x3257d2=_0x23509f||this[_0x28fe2c(0x90)];return await this[_0x28fe2c(0x196)][_0x28fe2c(0x1a3)](_0x3257d2);}async[a133_0x31c45e(0x17b)](_0xd1d6f6){const _0x44cfec=a133_0x31c45e;return await this[_0x44cfec(0x196)]['listAgentsFull'](_0xd1d6f6);}async[a133_0x31c45e(0x18e)](_0x5de751){const _0x4bdbed=a133_0x31c45e;return await this[_0x4bdbed(0x196)][_0x4bdbed(0xea)](_0x5de751);}async[a133_0x31c45e(0x13b)](_0x5ea09d){const _0x2512d4=a133_0x31c45e;return await this[_0x2512d4(0x196)]['createAgent'](_0x5ea09d);}async['updateAgent'](_0x3bd814,_0x2b7f08){const _0x54ac4f=a133_0x31c45e;return await this[_0x54ac4f(0x196)][_0x54ac4f(0xe3)](_0x3bd814,_0x2b7f08);}async[a133_0x31c45e(0x1a6)](_0x464a45){const _0x293073=a133_0x31c45e;await this['client'][_0x293073(0x1a6)](_0x464a45);}async['startChat'](_0x580e15){const _0x4db68e=a133_0x31c45e;return await this[_0x4db68e(0x196)][_0x4db68e(0xbd)]({'agentId':_0x580e15});}async*[a133_0x31c45e(0x9d)](_0x70cd6e,_0x144195){const _0x27dcfe=a133_0x31c45e;let _0x33de83=_0x144195?.['chatId'];const _0x502f4a=_0x144195?.[_0x27dcfe(0x12c)];if(!_0x33de83){if(!_0x502f4a)throw new Error(_0x27dcfe(0x96));const _0xead66d=await this['client'][_0x27dcfe(0xbd)]({'agentId':_0x502f4a});_0x33de83=_0xead66d['id'],yield{'type':_0x27dcfe(0x14a),'data':{'chatId':_0x33de83,'agentId':_0x502f4a,'projectId':_0xead66d[_0x27dcfe(0x1a5)][_0x27dcfe(0xd2)]}};}for await(const _0x223638 of this[_0x27dcfe(0x196)]['continueChat'](_0x33de83,_0x70cd6e,_0x144195?.[_0x27dcfe(0x118)])){yield{'type':'event','data':_0x223638};}}async['chats'](_0x5c6313=0x32){const _0x4af67f=a133_0x31c45e;return await this['client'][_0x4af67f(0xc1)](_0x5c6313);}async[a133_0x31c45e(0x14e)](_0x39a043){const _0x5d74ef=a133_0x31c45e;return await this['client'][_0x5d74ef(0x120)](_0x39a043);}async[a133_0x31c45e(0x18d)](_0x5f489b){return await this['client']['getChatLog'](_0x5f489b);}async['chatInfo'](_0x56c986){const _0x2ed9e4=a133_0x31c45e;return await this[_0x2ed9e4(0x196)][_0x2ed9e4(0xde)](_0x56c986);}async[a133_0x31c45e(0x115)](_0x2ba648,_0x3338a7,_0x55f457){const _0x50fdc9=a133_0x31c45e,_0x33902a=_0x55f457?.[_0x50fdc9(0x9f)]??![],{projectId:_0x53f8f4,project:_0x3440e0}=await this[_0x50fdc9(0x9a)](_0x2ba648),_0x136b9c=_0x3440e0[_0x50fdc9(0x1a5)][_0x50fdc9(0x141)],_0x3fb3ca=_0x3338a7||_0x136b9c+_0x50fdc9(0x10e);if(a133_0x39da6b[_0x50fdc9(0x16a)](_0x3fb3ca)&&!_0x33902a)throw new SDKError(ErrorCode['ALREADY_EXISTS'],'Output\x20directory\x20already\x20exists:\x20'+_0x3fb3ca,undefined,{'helpText':'Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.'});const _0x42bfa3=await this['client'][_0x50fdc9(0xda)](_0x53f8f4),_0x8af51=await this[_0x50fdc9(0x196)]['listKnowledgeBases'](_0x53f8f4),_0x7be31c=await this[_0x50fdc9(0x196)][_0x50fdc9(0xd7)](_0x53f8f4),_0x5caab4=await this['client'][_0x50fdc9(0xfc)](_0x53f8f4);if(!_0x33902a){a133_0x39da6b['mkdirSync'](_0x3fb3ca,{'recursive':!![]});const _0x344bbe={'version':_0x50fdc9(0x14f),'exportedAt':new Date()[_0x50fdc9(0x116)](),'exportedFrom':{'site':this['context'][_0x50fdc9(0xac)],'projectId':_0x53f8f4,'projectName':_0x136b9c},'project':_0x3440e0};a133_0x39da6b['writeFileSync'](a133_0x43bfdf[_0x50fdc9(0xb0)](_0x3fb3ca,_0x50fdc9(0x125)),JSON['stringify'](_0x344bbe,null,0x2)),a133_0x39da6b['writeFileSync'](a133_0x43bfdf['join'](_0x3fb3ca,_0x50fdc9(0x173)),JSON[_0x50fdc9(0xed)](_0x42bfa3,null,0x2)),a133_0x39da6b['writeFileSync'](a133_0x43bfdf[_0x50fdc9(0xb0)](_0x3fb3ca,_0x50fdc9(0x178)),JSON['stringify'](_0x8af51,null,0x2)),a133_0x39da6b[_0x50fdc9(0x123)](a133_0x43bfdf[_0x50fdc9(0xb0)](_0x3fb3ca,'prompts.json'),JSON[_0x50fdc9(0xed)](_0x7be31c,null,0x2)),a133_0x39da6b[_0x50fdc9(0x123)](a133_0x43bfdf['join'](_0x3fb3ca,_0x50fdc9(0x1ad)),JSON[_0x50fdc9(0xed)](_0x5caab4,null,0x2));}return{'projectName':_0x136b9c,'outputDir':_0x3fb3ca,'counts':{'agents':_0x42bfa3[_0x50fdc9(0xa9)],'knowledgeBases':_0x8af51[_0x50fdc9(0xa9)],'prompts':_0x7be31c[_0x50fdc9(0xa9)],'integrations':_0x5caab4[_0x50fdc9(0xa9)]}};}async['restoreProject'](_0x74b3ef,_0x109450){const _0x4b0cdd=a133_0x31c45e,_0x4d9e3d=_0x109450?.[_0x4b0cdd(0x9f)]??![],_0x3c4b0b=this[_0x4b0cdd(0xdb)](_0x74b3ef),_0x3aecbc=_0x3c4b0b[_0x4b0cdd(0xcd)]['site'],_0x1ab2ed=this[_0x4b0cdd(0xb9)][_0x4b0cdd(0xac)],_0x3469ea=_0x3aecbc!==_0x1ab2ed?_0x3aecbc:undefined,_0x547626=this['loadJsonFile'](a133_0x43bfdf[_0x4b0cdd(0xb0)](_0x74b3ef,_0x4b0cdd(0x173)),[]),_0x2bdc7e=this[_0x4b0cdd(0x152)](a133_0x43bfdf['join'](_0x74b3ef,'knowledgebases.json'),[]),_0x365f8d=this[_0x4b0cdd(0x152)](a133_0x43bfdf[_0x4b0cdd(0xb0)](_0x74b3ef,'prompts.json'),[]),_0x3026e4=this['loadJsonFile'](a133_0x43bfdf['join'](_0x74b3ef,_0x4b0cdd(0x1ad)),[]),_0x4544bf=_0x109450?.[_0x4b0cdd(0x141)]||_0x3c4b0b[_0x4b0cdd(0xcd)][_0x4b0cdd(0xa5)];if(_0x4d9e3d){const _0x5aed01=new Map(),_0x4ebfac=[..._0x547626],_0x122c7e=_0x547626['length']+0x1;let _0x433cef=0x0;while(_0x4ebfac[_0x4b0cdd(0xa9)]>0x0&&_0x433cef<_0x122c7e){_0x433cef++;const _0x2c40c4=[];for(const _0x4191ae of _0x4ebfac){canCreateAgent(_0x4191ae,_0x5aed01)?_0x5aed01[_0x4b0cdd(0x16e)](_0x4191ae['id'],_0x4b0cdd(0x14c)+_0x4191ae['id']):_0x2c40c4[_0x4b0cdd(0x19f)](_0x4191ae);}if(_0x2c40c4[_0x4b0cdd(0xa9)]===_0x4ebfac['length'])throw new SDKError(ErrorCode[_0x4b0cdd(0x158)],_0x4b0cdd(0xb7),undefined,{'helpText':_0x4b0cdd(0xcc)});_0x4ebfac['length']=0x0,_0x4ebfac[_0x4b0cdd(0x19f)](..._0x2c40c4);}const _0x20306f=_0x365f8d[_0x4b0cdd(0x184)](_0x5b892f=>_0x5aed01[_0x4b0cdd(0x8f)](_0x5b892f['attributes'][_0x4b0cdd(0x12c)]))['length'];return{'projectName':_0x4544bf,'projectId':'(dry-run)','counts':{'agents':_0x547626['length'],'knowledgeBases':_0x2bdc7e['length'],'prompts':_0x20306f,'integrations':_0x3026e4['length']},'sourceSite':_0x3469ea};}const _0x16a2be=await this[_0x4b0cdd(0x196)][_0x4b0cdd(0x107)]({'name':_0x4544bf,'description':_0x3c4b0b['project'][_0x4b0cdd(0x1a5)][_0x4b0cdd(0x11f)]}),_0x4e2b2c=_0x16a2be['id'],_0xa0c7e2=new Map(),_0x1ab66e=new Map(),_0x31a3f5=new Map();for(const _0x1a25b4 of _0x2bdc7e){const _0x4a8983=await this[_0x4b0cdd(0x196)][_0x4b0cdd(0x17d)]({'projectId':_0x4e2b2c,'name':_0x1a25b4[_0x4b0cdd(0x1a5)]['name'],'tdDatabaseName':_0x1a25b4[_0x4b0cdd(0x1a5)][_0x4b0cdd(0xb2)],'tables':_0x1a25b4[_0x4b0cdd(0x1a5)][_0x4b0cdd(0xc8)]});_0xa0c7e2[_0x4b0cdd(0x16e)](_0x1a25b4['id'],_0x4a8983['id']);}const _0x48bac4=[..._0x547626],_0x53968a=_0x547626[_0x4b0cdd(0xa9)]+0x1;let _0x597059=0x0;while(_0x48bac4[_0x4b0cdd(0xa9)]>0x0&&_0x597059<_0x53968a){_0x597059++;const _0x302f25=[];for(const _0x4aa068 of _0x48bac4){if(canCreateAgent(_0x4aa068,_0x1ab66e)){const _0x30ff13=remapToolIds(_0x4aa068[_0x4b0cdd(0x1a5)][_0x4b0cdd(0x176)],_0xa0c7e2,_0x1ab66e),_0xe5b03c=remapVariableIds(_0x4aa068[_0x4b0cdd(0x1a5)][_0x4b0cdd(0x121)],_0xa0c7e2),_0x110d02=await this[_0x4b0cdd(0x196)][_0x4b0cdd(0x181)]({'name':_0x4aa068[_0x4b0cdd(0x1a5)]['name'],'projectId':_0x4e2b2c,'systemPrompt':_0x4aa068['attributes']['systemPrompt'],'starterMessage':_0x4aa068[_0x4b0cdd(0x1a5)][_0x4b0cdd(0xcf)],'modelType':migrateModelType(_0x4aa068[_0x4b0cdd(0x1a5)][_0x4b0cdd(0x111)]),'maxToolIterations':_0x4aa068[_0x4b0cdd(0x1a5)][_0x4b0cdd(0xbe)],'temperature':_0x4aa068[_0x4b0cdd(0x1a5)][_0x4b0cdd(0x91)],'reasoningEffort':_0x4aa068[_0x4b0cdd(0x1a5)][_0x4b0cdd(0x15b)],'outputs':_0x4aa068[_0x4b0cdd(0x1a5)][_0x4b0cdd(0xdf)],'tools':_0x30ff13,'variables':_0xe5b03c});_0x1ab66e[_0x4b0cdd(0x16e)](_0x4aa068['id'],_0x110d02['id']);}else _0x302f25['push'](_0x4aa068);}if(_0x302f25[_0x4b0cdd(0xa9)]===_0x48bac4[_0x4b0cdd(0xa9)])throw new SDKError(ErrorCode['INTERNAL'],_0x4b0cdd(0xb7),undefined,{'helpText':_0x4b0cdd(0xcc)});_0x48bac4['length']=0x0,_0x48bac4[_0x4b0cdd(0x19f)](..._0x302f25);}for(const _0x2b7f6c of _0x365f8d){const _0x2b36d1=_0x1ab66e[_0x4b0cdd(0x1a2)](_0x2b7f6c[_0x4b0cdd(0x1a5)][_0x4b0cdd(0x12c)]);if(!_0x2b36d1)continue;const _0x1429ef=await this['client'][_0x4b0cdd(0xa6)]({'projectId':_0x4e2b2c,'agentId':_0x2b36d1,'name':_0x2b7f6c[_0x4b0cdd(0x1a5)][_0x4b0cdd(0x141)],'systemPrompt':_0x2b7f6c[_0x4b0cdd(0x1a5)][_0x4b0cdd(0x150)],'template':_0x2b7f6c[_0x4b0cdd(0x1a5)][_0x4b0cdd(0x119)],'jsonSchemaHint':_0x2b7f6c['attributes'][_0x4b0cdd(0xe1)]});_0x31a3f5[_0x4b0cdd(0x16e)](_0x2b7f6c['id'],_0x1429ef['id']);}for(const _0x2d1624 of _0x3026e4){const _0x2719fd=_0x2d1624[_0x4b0cdd(0x1a5)][_0x4b0cdd(0x194)][_0x4b0cdd(0xe5)](_0x34cbda=>({..._0x34cbda,'promptId':_0x31a3f5[_0x4b0cdd(0x1a2)](_0x34cbda[_0x4b0cdd(0x171)])||_0x34cbda[_0x4b0cdd(0x171)]}));await this[_0x4b0cdd(0x196)][_0x4b0cdd(0x186)]({'projectId':_0x4e2b2c,'serviceType':_0x2d1624[_0x4b0cdd(0x1a5)][_0x4b0cdd(0x1a7)],'actions':_0x2719fd,'slackMessageMode':_0x2d1624['attributes']['slackMessageMode'],'chatIgnoreManagedActions':_0x2d1624[_0x4b0cdd(0x1a5)][_0x4b0cdd(0x128)],'chatWelcomeMessage':_0x2d1624[_0x4b0cdd(0x1a5)][_0x4b0cdd(0xee)],'webhookCorsOrigins':_0x2d1624[_0x4b0cdd(0x1a5)][_0x4b0cdd(0x1b0)]});}return{'projectName':_0x4544bf,'projectId':_0x4e2b2c,'counts':{'agents':_0x1ab66e[_0x4b0cdd(0x8d)],'knowledgeBases':_0xa0c7e2[_0x4b0cdd(0x8d)],'prompts':_0x31a3f5['size'],'integrations':_0x3026e4[_0x4b0cdd(0xa9)]},'sourceSite':_0x3469ea};}[a133_0x31c45e(0x152)](_0x144b42,_0x57edfa){const _0x138b05=a133_0x31c45e;if(!a133_0x39da6b['existsSync'](_0x144b42))return _0x57edfa;return JSON['parse'](a133_0x39da6b['readFileSync'](_0x144b42,_0x138b05(0xc5)));}[a133_0x31c45e(0xdb)](_0x42bc19){const _0x1048be=a133_0x31c45e;if(!a133_0x39da6b[_0x1048be(0x16a)](_0x42bc19))throw new SDKError(ErrorCode['NOT_FOUND'],_0x1048be(0x104)+_0x42bc19,undefined,{'helpText':_0x1048be(0xfa)});const _0x583896=a133_0x43bfdf[_0x1048be(0xb0)](_0x42bc19,_0x1048be(0x125));if(!a133_0x39da6b[_0x1048be(0x16a)](_0x583896))throw new SDKError(ErrorCode[_0x1048be(0x112)],'Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20'+_0x42bc19,undefined,{'helpText':_0x1048be(0x114)});const _0x46fead=JSON[_0x1048be(0xf6)](a133_0x39da6b[_0x1048be(0x12e)](_0x583896,'utf-8'));if(!isSupportedBackupVersion(_0x46fead[_0x1048be(0xfb)]))throw new SDKError(ErrorCode[_0x1048be(0x112)],'Unsupported\x20backup\x20version:\x20'+_0x46fead[_0x1048be(0xfb)],undefined,{'helpText':_0x1048be(0x18c)});return _0x46fead;}async[a133_0x31c45e(0xe4)](_0x397931,_0x32afb6,_0x400e52){const _0x3247ad=a133_0x31c45e,{projectId:_0x556f0f,project:_0x4f8c10}=await this['resolveProjectName'](_0x397931),_0x519983=_0x4f8c10['attributes'][_0x3247ad(0x141)];let _0x42c61;if(_0x32afb6)_0x42c61=_0x32afb6;else{const _0x5a5f3f=a133_0x43bfdf[_0x3247ad(0xb0)](process[_0x3247ad(0x132)](),_0x3247ad(0x11e)),_0x18cba3=getSanitizedPathWithMigration(_0x5a5f3f,_0x519983);_0x18cba3[_0x3247ad(0xd0)]&&this[_0x3247ad(0x133)][_0x3247ad(0x92)]('Renamed\x20folder:\x20'+a133_0x43bfdf[_0x3247ad(0x15c)](_0x18cba3[_0x3247ad(0x95)])+_0x3247ad(0x13c)+a133_0x43bfdf[_0x3247ad(0x15c)](_0x18cba3[_0x3247ad(0xc2)])),_0x42c61=_0x18cba3[_0x3247ad(0xc2)];}const _0x2004e3=await this['client'][_0x3247ad(0xda)](_0x556f0f),_0x5e3fe7=await this[_0x3247ad(0x196)]['listKnowledgeBases'](_0x556f0f),_0x2cb704=await this['client'][_0x3247ad(0x1a1)](_0x556f0f),_0x268c6c=await safeListOrEmpty(()=>this[_0x3247ad(0x196)][_0x3247ad(0xa4)](_0x556f0f)),_0x48c8e8=await safeListOrEmpty(()=>this['client']['listWebSearchTools'](_0x556f0f)),_0x25af58=await this[_0x3247ad(0x196)][_0x3247ad(0xd7)](_0x556f0f),_0x16839b=await this[_0x3247ad(0x196)]['listIntegrations'](_0x556f0f),_0x41b33c=await safeListOrEmpty(()=>this[_0x3247ad(0x196)]['listExperimentalKnowledgeBases'](_0x556f0f)),_0x1c0347=await safeListOrEmpty(()=>this[_0x3247ad(0x196)][_0x3247ad(0x110)](_0x556f0f)),_0x353463=await safeListOrEmpty(()=>this[_0x3247ad(0x196)][_0x3247ad(0xc7)](_0x556f0f)),_0x46d522=await safeListOrEmpty(()=>this[_0x3247ad(0x196)][_0x3247ad(0xbf)](_0x556f0f)),_0x54a879=_0x16839b[_0x3247ad(0x184)](_0x1ec39f=>!_0x1ec39f[_0x3247ad(0x1a5)][_0x3247ad(0xd5)]&&SAFE_INTEGRATION_TYPES[_0x3247ad(0x15a)](_0x1ec39f[_0x3247ad(0x1a5)][_0x3247ad(0x1a7)][_0x3247ad(0xf0)]())),_0x40b6c2=new Map(),_0x2f29b6=new Map(),_0xb53b6b=new Map(),_0x5d4aed=new Map(),_0x3a0a2d=new Map(),_0x479e67=new Map(),_0x7b6571=new Map();for(const _0x34530a of _0x2004e3){_0x40b6c2[_0x3247ad(0x16e)](_0x34530a['id'],_0x34530a[_0x3247ad(0x1a5)]['name']);}for(const _0x5e88c3 of _0x5e3fe7){_0x2f29b6[_0x3247ad(0x16e)](_0x5e88c3['id'],_0x5e88c3['attributes'][_0x3247ad(0x141)]);}for(const _0x54415d of _0x2cb704){_0xb53b6b['set'](_0x54415d['id'],_0x54415d['attributes'][_0x3247ad(0x141)]);}for(const _0x300d7c of _0x268c6c){_0x5d4aed['set'](_0x300d7c['id'],_0x300d7c[_0x3247ad(0x1a5)][_0x3247ad(0x141)]);}for(const _0x222e83 of _0x48c8e8){_0x3a0a2d['set'](_0x222e83['id'],_0x222e83['attributes'][_0x3247ad(0x141)]);}for(const _0x456846 of _0x25af58){_0x479e67[_0x3247ad(0x16e)](_0x456846['id'],_0x456846[_0x3247ad(0x1a5)][_0x3247ad(0x141)]);}for(const _0x19873 of _0x41b33c){_0x7b6571[_0x3247ad(0x16e)](_0x19873['id'],_0x19873[_0x3247ad(0x1a5)][_0x3247ad(0x141)]);}const _0x3751b1={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x2f29b6,'TextKnowledgeBase':_0xb53b6b,'Agent':_0x40b6c2,'WebSearchTool':_0x3a0a2d,'ImageGenerator':_0x5d4aed,'ExperimentalKnowledgeBase':_0x7b6571}),'resolvePromptName':async _0x3888b0=>_0x479e67[_0x3247ad(0x1a2)](_0x3888b0),'onWarning':_0x2389af=>this[_0x3247ad(0x133)][_0x3247ad(0x1a8)](_0x2389af)},_0x38745a={'projectName':_0x519983,'outputDir':_0x42c61,'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}}},_0x5ec358=[],_0x4f230f=[];for(const _0x140e13 of _0x2004e3){const _0x55ad15=getSanitizedPathWithMigration(_0x42c61,_0x140e13['attributes'][_0x3247ad(0x141)]);_0x55ad15[_0x3247ad(0xd0)]&&this[_0x3247ad(0x133)]['info'](_0x3247ad(0xc3)+a133_0x43bfdf[_0x3247ad(0x15c)](_0x55ad15[_0x3247ad(0x95)])+_0x3247ad(0x13c)+a133_0x43bfdf['basename'](_0x55ad15[_0x3247ad(0xc2)]));const _0xb26189=_0x55ad15['path'],_0x48fc42=a133_0x43bfdf['join'](_0xb26189,_0x3247ad(0x18a)),_0x2a48e4=a133_0x43bfdf[_0x3247ad(0xb0)](_0xb26189,_0x3247ad(0x17e)),_0x323ce4=a133_0x43bfdf[_0x3247ad(0xb0)](_0xb26189,_0x3247ad(0xc9)),{yaml:_0xee8da8,systemPrompt:_0x109bf2,starterMessage:_0x520e65}=await agentResponseToDef(_0x140e13,_0x3751b1),_0x48b9b9=toAgentYamlString(_0xee8da8),_0x53cee3=!a133_0x39da6b['existsSync'](_0x2a48e4);let _0x421eb7=_0x53cee3,_0x1ab1d6;if(!_0x53cee3){const _0x3804bc=a133_0x39da6b[_0x3247ad(0x16a)](_0x48fc42)?a133_0x39da6b[_0x3247ad(0x12e)](_0x48fc42,_0x3247ad(0xc5)):'',_0x582cb7=a133_0x39da6b[_0x3247ad(0x12e)](_0x2a48e4,_0x3247ad(0xc5)),_0x3cb8e7=_0x3247ad(0x179)+_0x3804bc+_0x3247ad(0x12b)+_0x582cb7,_0x296159='#\x20prompt.md\x0a'+_0x109bf2+_0x3247ad(0x12b)+_0x48b9b9,_0x48221b=generateDiff(_0x3cb8e7,_0x296159);_0x421eb7=hasChanges(_0x48221b),_0x421eb7&&(_0x1ab1d6=formatDiffWithColors(_0x48221b));}_0x5ec358['push']({'path':_0xb26189,'content':'','isDir':!![]}),_0x5ec358['push']({'path':_0x48fc42,'content':_0x109bf2}),_0x5ec358[_0x3247ad(0x19f)]({'path':_0x2a48e4,'content':_0x48b9b9});_0x520e65&&_0x520e65[_0x3247ad(0x15a)]('\x0a')&&_0x5ec358[_0x3247ad(0x19f)]({'path':_0x323ce4,'content':_0x520e65});_0x38745a[_0x3247ad(0x11e)][_0x3247ad(0x19f)]({'agentName':_0x140e13[_0x3247ad(0x1a5)][_0x3247ad(0x141)],'outputPath':_0xb26189,'isNew':_0x53cee3,'hasChanges':_0x421eb7,'diff':_0x1ab1d6}),_0x38745a[_0x3247ad(0xdc)]['agents'][_0x3247ad(0x189)]++;if(_0x53cee3)_0x38745a[_0x3247ad(0xdc)][_0x3247ad(0x11e)][_0x3247ad(0x135)]++;else{if(_0x421eb7)_0x38745a[_0x3247ad(0xdc)]['agents'][_0x3247ad(0x165)]++;else _0x38745a[_0x3247ad(0xdc)][_0x3247ad(0x11e)][_0x3247ad(0xbb)]++;}}for(const _0x3be7b9 of _0x5e3fe7){if(_0x3be7b9['attributes'][_0x3247ad(0xd5)])continue;const _0x3ad929=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x42c61),_0x3be7b9[_0x3247ad(0x1a5)][_0x3247ad(0x141)],_0x3247ad(0x163));_0x3ad929[_0x3247ad(0xd0)]&&this[_0x3247ad(0x133)][_0x3247ad(0x92)](_0x3247ad(0x16b)+a133_0x43bfdf['basename'](_0x3ad929['oldPath'])+_0x3247ad(0x13c)+a133_0x43bfdf[_0x3247ad(0x15c)](_0x3ad929['path']));const _0x2f3862=_0x3ad929[_0x3247ad(0xc2)],_0xbfcf78=apiKnowledgeBaseToYaml(_0x3be7b9),_0x49cb25=toKnowledgeBaseYamlString(_0xbfcf78),_0xd38a3a=!a133_0x39da6b[_0x3247ad(0x16a)](_0x2f3862);let _0x1a0348=_0xd38a3a,_0x542a6b;if(!_0xd38a3a){const _0x2782d0=a133_0x39da6b['readFileSync'](_0x2f3862,_0x3247ad(0xc5)),_0x4a8146=generateDiff(_0x2782d0,_0x49cb25);_0x1a0348=hasChanges(_0x4a8146),_0x1a0348&&(_0x542a6b=formatDiffWithColors(_0x4a8146));}_0x5ec358['push']({'path':_0x2f3862,'content':_0x49cb25}),_0x38745a[_0x3247ad(0x88)][_0x3247ad(0x19f)]({'name':_0x3be7b9[_0x3247ad(0x1a5)][_0x3247ad(0x141)],'outputPath':_0x2f3862,'isNew':_0xd38a3a,'hasChanges':_0x1a0348,'diff':_0x542a6b}),_0x38745a['counts'][_0x3247ad(0x88)][_0x3247ad(0x189)]++;if(_0xd38a3a)_0x38745a[_0x3247ad(0xdc)][_0x3247ad(0x88)][_0x3247ad(0x135)]++;else{if(_0x1a0348)_0x38745a[_0x3247ad(0xdc)][_0x3247ad(0x88)][_0x3247ad(0x165)]++;else _0x38745a[_0x3247ad(0xdc)][_0x3247ad(0x88)]['unchanged']++;}}for(const _0x71f485 of _0x2cb704){if(_0x71f485[_0x3247ad(0x1a5)]['isManaged'])continue;const _0x3580d4=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x42c61),_0x71f485[_0x3247ad(0x1a5)][_0x3247ad(0x141)],_0x3247ad(0x146));_0x3580d4[_0x3247ad(0xd0)]&&this[_0x3247ad(0x133)]['info'](_0x3247ad(0x172)+a133_0x43bfdf['basename'](_0x3580d4[_0x3247ad(0x95)])+_0x3247ad(0x13c)+a133_0x43bfdf['basename'](_0x3580d4[_0x3247ad(0xc2)]));const _0x4c2c4b=_0x3580d4[_0x3247ad(0xc2)],_0x24e301=toTextKnowledgeBaseMd(_0x71f485['attributes'][_0x3247ad(0x141)],_0x71f485[_0x3247ad(0x1a5)]['text']),_0x517010=!a133_0x39da6b[_0x3247ad(0x16a)](_0x4c2c4b);let _0x309af2=_0x517010,_0x42055f;if(!_0x517010){const _0x32dbb0=a133_0x39da6b[_0x3247ad(0x12e)](_0x4c2c4b,_0x3247ad(0xc5)),_0xdd47c1=generateDiff(_0x32dbb0,_0x24e301);_0x309af2=hasChanges(_0xdd47c1),_0x309af2&&(_0x42055f=formatDiffWithColors(_0xdd47c1));}_0x5ec358[_0x3247ad(0x19f)]({'path':_0x4c2c4b,'content':_0x24e301}),_0x38745a[_0x3247ad(0x126)][_0x3247ad(0x19f)]({'name':_0x71f485[_0x3247ad(0x1a5)][_0x3247ad(0x141)],'outputPath':_0x4c2c4b,'isNew':_0x517010,'hasChanges':_0x309af2,'diff':_0x42055f}),_0x38745a['counts'][_0x3247ad(0x126)][_0x3247ad(0x189)]++;if(_0x517010)_0x38745a[_0x3247ad(0xdc)][_0x3247ad(0x126)][_0x3247ad(0x135)]++;else{if(_0x309af2)_0x38745a[_0x3247ad(0xdc)][_0x3247ad(0x126)]['updated']++;else _0x38745a['counts'][_0x3247ad(0x126)][_0x3247ad(0xbb)]++;}}for(const _0x966c2e of _0x25af58){if(_0x966c2e[_0x3247ad(0x1a5)]['isManaged'])continue;const _0x4c6323=getSanitizedPathWithMigration(getPromptsDir(_0x42c61),_0x966c2e[_0x3247ad(0x1a5)][_0x3247ad(0x141)],_0x3247ad(0x163));_0x4c6323['renamed']&&this['logger'][_0x3247ad(0x92)](_0x3247ad(0x113)+a133_0x43bfdf[_0x3247ad(0x15c)](_0x4c6323['oldPath'])+_0x3247ad(0x13c)+a133_0x43bfdf[_0x3247ad(0x15c)](_0x4c6323[_0x3247ad(0xc2)]));const _0x4a6d7a=_0x4c6323['path'],_0x3f6a7c=await apiPromptToYaml(_0x966c2e,_0x3751b1);if(!_0x3f6a7c)continue;const _0x31a822=toPromptYamlString(_0x3f6a7c),_0x2209f8=!a133_0x39da6b['existsSync'](_0x4a6d7a);let _0x449031=_0x2209f8,_0x21dff0;if(!_0x2209f8){const _0x1726bc=a133_0x39da6b[_0x3247ad(0x12e)](_0x4a6d7a,_0x3247ad(0xc5)),_0x16e363=generateDiff(_0x1726bc,_0x31a822);_0x449031=hasChanges(_0x16e363),_0x449031&&(_0x21dff0=formatDiffWithColors(_0x16e363));}_0x5ec358['push']({'path':_0x4a6d7a,'content':_0x31a822}),_0x38745a[_0x3247ad(0x145)][_0x3247ad(0x19f)]({'name':_0x966c2e[_0x3247ad(0x1a5)][_0x3247ad(0x141)],'outputPath':_0x4a6d7a,'isNew':_0x2209f8,'hasChanges':_0x449031,'diff':_0x21dff0}),_0x38745a['counts'][_0x3247ad(0x145)][_0x3247ad(0x189)]++;if(_0x2209f8)_0x38745a['counts'][_0x3247ad(0x145)]['new']++;else{if(_0x449031)_0x38745a['counts'][_0x3247ad(0x145)][_0x3247ad(0x165)]++;else _0x38745a[_0x3247ad(0xdc)]['prompts'][_0x3247ad(0xbb)]++;}}for(const _0x10b53 of _0x54a879){const _0x1a93e5=_0x10b53['attributes'][_0x3247ad(0x1a7)][_0x3247ad(0xf0)](),_0x5af03d=getSanitizedPathWithMigration(getIntegrationsDir(_0x42c61),_0x1a93e5,_0x3247ad(0x163));_0x5af03d[_0x3247ad(0xd0)]&&this[_0x3247ad(0x133)][_0x3247ad(0x92)](_0x3247ad(0xf4)+a133_0x43bfdf[_0x3247ad(0x15c)](_0x5af03d[_0x3247ad(0x95)])+_0x3247ad(0x13c)+a133_0x43bfdf['basename'](_0x5af03d[_0x3247ad(0xc2)]));const _0x4640fb=_0x5af03d[_0x3247ad(0xc2)],_0x1948d8=await apiIntegrationToYaml(_0x10b53,_0x3751b1),_0x146231=toIntegrationYamlString(_0x1948d8),_0x55fb26=!a133_0x39da6b['existsSync'](_0x4640fb);let _0x3bf657=_0x55fb26,_0x418edb;if(!_0x55fb26){const _0x478776=a133_0x39da6b['readFileSync'](_0x4640fb,_0x3247ad(0xc5)),_0x1c8497=generateDiff(_0x478776,_0x146231);_0x3bf657=hasChanges(_0x1c8497),_0x3bf657&&(_0x418edb=formatDiffWithColors(_0x1c8497));}_0x5ec358[_0x3247ad(0x19f)]({'path':_0x4640fb,'content':_0x146231}),_0x38745a['integrations'][_0x3247ad(0x19f)]({'name':_0x1a93e5,'outputPath':_0x4640fb,'isNew':_0x55fb26,'hasChanges':_0x3bf657,'diff':_0x418edb}),_0x38745a[_0x3247ad(0xdc)][_0x3247ad(0x153)][_0x3247ad(0x189)]++;if(_0x55fb26)_0x38745a[_0x3247ad(0xdc)]['integrations'][_0x3247ad(0x135)]++;else{if(_0x3bf657)_0x38745a['counts'][_0x3247ad(0x153)][_0x3247ad(0x165)]++;else _0x38745a[_0x3247ad(0xdc)]['integrations'][_0x3247ad(0xbb)]++;}}for(const _0x4781d5 of _0x41b33c){if(_0x4781d5['attributes']['isManaged'])continue;const _0x1f8a3c=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x42c61),_0x4781d5[_0x3247ad(0x1a5)][_0x3247ad(0x141)]);_0x1f8a3c[_0x3247ad(0xd0)]&&this[_0x3247ad(0x133)][_0x3247ad(0x92)](_0x3247ad(0x137)+a133_0x43bfdf[_0x3247ad(0x15c)](_0x1f8a3c[_0x3247ad(0x95)])+'\x20→\x20'+a133_0x43bfdf['basename'](_0x1f8a3c['path']));const _0x13af51=_0x1f8a3c[_0x3247ad(0xc2)],_0x5d12a3=a133_0x43bfdf[_0x3247ad(0xb0)](_0x13af51,sanitizeForFilesystem(_0x4781d5[_0x3247ad(0x1a5)]['name'])+'.yml'),_0x29ade0=a133_0x43bfdf[_0x3247ad(0xb0)](_0x13af51,_0x3247ad(0x19b)),_0xf58b14=apiExperimentalKnowledgeBaseToYaml(_0x4781d5),_0x3efb6d=toExperimentalKnowledgeBaseYamlString(_0xf58b14),_0x1644b6=!a133_0x39da6b['existsSync'](_0x13af51);let _0x2ceeb9=_0x1644b6,_0x381d12,_0x30c50c=_0x3efb6d;const _0x18d69d=[..._0xf58b14['functions']][_0x3247ad(0x190)]((_0x5b3afe,_0x53f0c5)=>_0x5b3afe[_0x3247ad(0x141)][_0x3247ad(0xfd)](_0x53f0c5[_0x3247ad(0x141)]));for(const _0x1d2f4e of _0x18d69d){_0x30c50c+=_0x3247ad(0x160)+_0x1d2f4e[_0x3247ad(0x141)]+'\x20---\x0a'+_0x1d2f4e['code']+_0x3247ad(0x185)+_0x1d2f4e['name']+'\x20---\x0a'+_0x1d2f4e[_0x3247ad(0xc6)]+'\x0a';}if(!_0x1644b6){let _0x30f832='';a133_0x39da6b[_0x3247ad(0x16a)](_0x5d12a3)&&(_0x30f832=a133_0x39da6b[_0x3247ad(0x12e)](_0x5d12a3,'utf-8'));if(a133_0x39da6b[_0x3247ad(0x16a)](_0x29ade0)){const _0x90133d=a133_0x39da6b[_0x3247ad(0x157)](_0x29ade0,{'withFileTypes':!![]}),_0xe5d509=_0x90133d['filter'](_0x3b9deb=>_0x3b9deb[_0x3247ad(0xd9)]())[_0x3247ad(0x190)]((_0x2ed448,_0x317eab)=>_0x2ed448[_0x3247ad(0x141)][_0x3247ad(0xfd)](_0x317eab['name']));for(const _0x3ec790 of _0xe5d509){const _0x224e6a=a133_0x43bfdf[_0x3247ad(0xb0)](_0x29ade0,_0x3ec790[_0x3247ad(0x141)],_0x3247ad(0xa7)),_0x5d4d39=a133_0x43bfdf['join'](_0x29ade0,_0x3ec790['name'],_0x3247ad(0xb1));a133_0x39da6b['existsSync'](_0x224e6a)&&(_0x30f832+=_0x3247ad(0x160)+_0x3ec790[_0x3247ad(0x141)]+'\x20---\x0a'+a133_0x39da6b[_0x3247ad(0x12e)](_0x224e6a,_0x3247ad(0xc5))+'\x0a'),a133_0x39da6b[_0x3247ad(0x16a)](_0x5d4d39)&&(_0x30f832+=_0x3247ad(0x1ab)+_0x3ec790[_0x3247ad(0x141)]+_0x3247ad(0x19c)+a133_0x39da6b[_0x3247ad(0x12e)](_0x5d4d39,_0x3247ad(0xc5))+'\x0a');}}const _0x31fb46=generateDiff(_0x30f832,_0x30c50c);_0x2ceeb9=hasChanges(_0x31fb46),_0x2ceeb9&&(_0x381d12=formatDiffWithColors(_0x31fb46));}_0x5ec358[_0x3247ad(0x19f)]({'path':_0x13af51,'content':'','isDir':!![]}),_0x5ec358[_0x3247ad(0x19f)]({'path':_0x5d12a3,'content':_0x3efb6d}),_0x5ec358[_0x3247ad(0x19f)]({'path':_0x29ade0,'content':'','isDir':!![]});for(const _0x24931f of _0xf58b14[_0x3247ad(0x19b)]){const _0x3f7c5d=a133_0x43bfdf[_0x3247ad(0xb0)](_0x29ade0,sanitizeForFilesystem(_0x24931f[_0x3247ad(0x141)])),_0xed6a0a=a133_0x43bfdf['join'](_0x3f7c5d,'code.js'),_0x64909b=a133_0x43bfdf[_0x3247ad(0xb0)](_0x3f7c5d,_0x3247ad(0xb1));_0x5ec358[_0x3247ad(0x19f)]({'path':_0x3f7c5d,'content':'','isDir':!![]}),_0x5ec358['push']({'path':_0xed6a0a,'content':_0x24931f[_0x3247ad(0x136)]}),_0x5ec358['push']({'path':_0x64909b,'content':_0x24931f[_0x3247ad(0xc6)]});}if(a133_0x39da6b['existsSync'](_0x29ade0)){const _0x3e3d18=a133_0x39da6b[_0x3247ad(0x157)](_0x29ade0,{'withFileTypes':!![]}),_0x46bd3d=new Set(_0xf58b14[_0x3247ad(0x19b)][_0x3247ad(0xe5)](_0x250f59=>sanitizeForFilesystem(_0x250f59['name'])));for(const _0x588b0b of _0x3e3d18){if(_0x588b0b['isDirectory']()&&!_0x46bd3d[_0x3247ad(0x8f)](_0x588b0b[_0x3247ad(0x141)])){const _0x456a75=a133_0x43bfdf[_0x3247ad(0xb0)](_0x29ade0,_0x588b0b['name']);_0x4f230f[_0x3247ad(0x19f)]({'path':_0x456a75,'isDir':!![]});}}}_0x38745a[_0x3247ad(0x19e)][_0x3247ad(0x19f)]({'name':_0x4781d5[_0x3247ad(0x1a5)][_0x3247ad(0x141)],'outputPath':_0x13af51,'isNew':_0x1644b6,'hasChanges':_0x2ceeb9,'diff':_0x381d12}),_0x38745a[_0x3247ad(0xdc)][_0x3247ad(0x19e)][_0x3247ad(0x189)]++;if(_0x1644b6)_0x38745a[_0x3247ad(0xdc)][_0x3247ad(0x19e)][_0x3247ad(0x135)]++;else{if(_0x2ceeb9)_0x38745a[_0x3247ad(0xdc)][_0x3247ad(0x19e)][_0x3247ad(0x165)]++;else _0x38745a['counts'][_0x3247ad(0x19e)][_0x3247ad(0xbb)]++;}}for(const _0x2f88f1 of _0x1c0347){if(_0x2f88f1[_0x3247ad(0x1a5)][_0x3247ad(0xd5)])continue;const _0x507fab=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x42c61),_0x2f88f1[_0x3247ad(0x1a5)][_0x3247ad(0x141)]);_0x507fab[_0x3247ad(0xd0)]&&this[_0x3247ad(0x133)][_0x3247ad(0x92)](_0x3247ad(0x156)+a133_0x43bfdf[_0x3247ad(0x15c)](_0x507fab[_0x3247ad(0x95)])+'\x20→\x20'+a133_0x43bfdf[_0x3247ad(0x15c)](_0x507fab[_0x3247ad(0xc2)]));const _0x313d97=_0x507fab[_0x3247ad(0xc2)],_0x57d2ed=a133_0x43bfdf[_0x3247ad(0xb0)](_0x313d97,sanitizeForFilesystem(_0x2f88f1[_0x3247ad(0x1a5)][_0x3247ad(0x141)])+_0x3247ad(0x163)),_0xe5895f=a133_0x43bfdf[_0x3247ad(0xb0)](_0x313d97,_0x3247ad(0xa7)),_0x44411e=a133_0x43bfdf[_0x3247ad(0xb0)](_0x313d97,_0x3247ad(0xd4)),_0x32851c=apiExperimentalArtifactToYaml(_0x2f88f1),_0x25987a=toExperimentalArtifactYamlString(_0x32851c),_0xe82f6=!a133_0x39da6b[_0x3247ad(0x16a)](_0x313d97);let _0x1aea70=_0xe82f6,_0x3824e1,_0x13b8a7=_0x25987a+(_0x3247ad(0x130)+_0x32851c['code']+'\x0a');const _0xabe892=[..._0x32851c[_0x3247ad(0xd4)]][_0x3247ad(0x190)]((_0x3a4c6a,_0x3fba7c)=>_0x3a4c6a[_0x3247ad(0x195)][_0x3247ad(0xfd)](_0x3fba7c[_0x3247ad(0x195)]));for(const _0x552e48 of _0xabe892){_0x13b8a7+='---\x20file:\x20'+_0x552e48[_0x3247ad(0x195)]+_0x3247ad(0x19c)+_0x552e48[_0x3247ad(0xeb)]+'\x0a';}if(!_0xe82f6){let _0x5a430a='';a133_0x39da6b[_0x3247ad(0x16a)](_0x57d2ed)&&(_0x5a430a=a133_0x39da6b[_0x3247ad(0x12e)](_0x57d2ed,_0x3247ad(0xc5)));a133_0x39da6b[_0x3247ad(0x16a)](_0xe5895f)&&(_0x5a430a+=_0x3247ad(0x130)+a133_0x39da6b[_0x3247ad(0x12e)](_0xe5895f,_0x3247ad(0xc5))+'\x0a');if(a133_0x39da6b[_0x3247ad(0x16a)](_0x44411e)){const _0x3d1f6d=a133_0x39da6b[_0x3247ad(0x157)](_0x44411e),_0x342cd1=_0x3d1f6d[_0x3247ad(0x184)](_0xe1a424=>{const _0x4ce0eb=_0x3247ad,_0x531b1c=a133_0x43bfdf[_0x4ce0eb(0xb0)](_0x44411e,_0xe1a424);return a133_0x39da6b[_0x4ce0eb(0xc0)](_0x531b1c)[_0x4ce0eb(0xba)]();})[_0x3247ad(0x190)]((_0x2317c8,_0x35966e)=>_0x2317c8['localeCompare'](_0x35966e));for(const _0x500467 of _0x342cd1){const _0x125ca6=a133_0x43bfdf[_0x3247ad(0xb0)](_0x44411e,_0x500467);_0x5a430a+=_0x3247ad(0x14d)+_0x500467+'\x20---\x0a'+a133_0x39da6b['readFileSync'](_0x125ca6,_0x3247ad(0xc5))+'\x0a';}}const _0x22bfb2=generateDiff(_0x5a430a,_0x13b8a7);_0x1aea70=hasChanges(_0x22bfb2),_0x1aea70&&(_0x3824e1=formatDiffWithColors(_0x22bfb2));}_0x5ec358[_0x3247ad(0x19f)]({'path':_0x313d97,'content':'','isDir':!![]}),_0x5ec358[_0x3247ad(0x19f)]({'path':_0x57d2ed,'content':_0x25987a}),_0x5ec358[_0x3247ad(0x19f)]({'path':_0xe5895f,'content':_0x32851c[_0x3247ad(0x136)]});if(_0x32851c[_0x3247ad(0xd4)][_0x3247ad(0xa9)]>0x0){_0x5ec358[_0x3247ad(0x19f)]({'path':_0x44411e,'content':'','isDir':!![]});for(const _0x2f4c5c of _0x32851c[_0x3247ad(0xd4)]){const _0x5c09d7=a133_0x43bfdf[_0x3247ad(0xb0)](_0x44411e,_0x2f4c5c[_0x3247ad(0x195)]);_0x5ec358[_0x3247ad(0x19f)]({'path':_0x5c09d7,'content':_0x2f4c5c['text_content']});}}if(a133_0x39da6b[_0x3247ad(0x16a)](_0x44411e)){const _0x503c05=a133_0x39da6b['readdirSync'](_0x44411e),_0x4c8ad8=new Set(_0x32851c[_0x3247ad(0xd4)][_0x3247ad(0xe5)](_0x274333=>_0x274333['file_name']));for(const _0x29b381 of _0x503c05){const _0x522a12=a133_0x43bfdf[_0x3247ad(0xb0)](_0x44411e,_0x29b381);a133_0x39da6b[_0x3247ad(0xc0)](_0x522a12)[_0x3247ad(0xba)]()&&!_0x4c8ad8['has'](_0x29b381)&&_0x4f230f[_0x3247ad(0x19f)]({'path':_0x522a12});}}_0x38745a[_0x3247ad(0x12d)]['push']({'name':_0x2f88f1[_0x3247ad(0x1a5)][_0x3247ad(0x141)],'outputPath':_0x313d97,'isNew':_0xe82f6,'hasChanges':_0x1aea70,'diff':_0x3824e1}),_0x38745a[_0x3247ad(0xdc)][_0x3247ad(0x12d)][_0x3247ad(0x189)]++;if(_0xe82f6)_0x38745a[_0x3247ad(0xdc)][_0x3247ad(0x12d)][_0x3247ad(0x135)]++;else{if(_0x1aea70)_0x38745a[_0x3247ad(0xdc)][_0x3247ad(0x12d)][_0x3247ad(0x165)]++;else _0x38745a['counts']['experimentalArtifacts']['unchanged']++;}}for(const _0xa2c7e5 of _0x353463){const _0x501365=getSanitizedPathWithMigration(getFormInterfacesDir(_0x42c61),_0xa2c7e5['attributes'][_0x3247ad(0x141)],_0x3247ad(0x163));_0x501365[_0x3247ad(0xd0)]&&this[_0x3247ad(0x133)]['info']('Renamed\x20form\x20interface\x20file:\x20'+a133_0x43bfdf['basename'](_0x501365[_0x3247ad(0x95)])+_0x3247ad(0x13c)+a133_0x43bfdf[_0x3247ad(0x15c)](_0x501365[_0x3247ad(0xc2)]));const _0x3a74ed=_0x501365['path'],_0x20e59b=await apiFormInterfaceToYaml(_0xa2c7e5,_0x3751b1),_0x2ce1f6=toFormInterfaceYamlString(_0x20e59b),_0x23fe96=!a133_0x39da6b[_0x3247ad(0x16a)](_0x3a74ed);let _0x3f5134=_0x23fe96,_0x421859;if(!_0x23fe96){const _0x21aef0=a133_0x39da6b[_0x3247ad(0x12e)](_0x3a74ed,_0x3247ad(0xc5)),_0x298544=generateDiff(_0x21aef0,_0x2ce1f6);_0x3f5134=hasChanges(_0x298544),_0x3f5134&&(_0x421859=formatDiffWithColors(_0x298544));}_0x5ec358[_0x3247ad(0x19f)]({'path':_0x3a74ed,'content':_0x2ce1f6}),_0x38745a[_0x3247ad(0xe0)][_0x3247ad(0x19f)]({'name':_0xa2c7e5[_0x3247ad(0x1a5)][_0x3247ad(0x141)],'outputPath':_0x3a74ed,'isNew':_0x23fe96,'hasChanges':_0x3f5134,'diff':_0x421859}),_0x38745a[_0x3247ad(0xdc)][_0x3247ad(0xe0)]['total']++;if(_0x23fe96)_0x38745a['counts'][_0x3247ad(0xe0)]['new']++;else{if(_0x3f5134)_0x38745a['counts']['formInterfaces'][_0x3247ad(0x165)]++;else _0x38745a[_0x3247ad(0xdc)][_0x3247ad(0xe0)][_0x3247ad(0xbb)]++;}}for(const _0x3fe268 of _0x46d522){if(_0x3fe268[_0x3247ad(0x1a5)]['isManaged'])continue;const _0x15d4a7=getSanitizedPathWithMigration(getChatInterfacesDir(_0x42c61),_0x3fe268[_0x3247ad(0x1a5)][_0x3247ad(0x141)],'.yml');_0x15d4a7['renamed']&&this['logger'][_0x3247ad(0x92)](_0x3247ad(0x89)+a133_0x43bfdf[_0x3247ad(0x15c)](_0x15d4a7[_0x3247ad(0x95)])+_0x3247ad(0x13c)+a133_0x43bfdf['basename'](_0x15d4a7['path']));const _0x1d597c=_0x15d4a7[_0x3247ad(0xc2)],_0x4e5b8a=await apiChatInterfaceToYaml(_0x3fe268,_0x3751b1),_0x31e7b4=toChatInterfaceYamlString(_0x4e5b8a),_0x4cded5=!a133_0x39da6b[_0x3247ad(0x16a)](_0x1d597c);let _0x2dcb1a=_0x4cded5,_0x110047;if(!_0x4cded5){const _0x909b2f=a133_0x39da6b[_0x3247ad(0x12e)](_0x1d597c,_0x3247ad(0xc5)),_0x5f10b0=generateDiff(_0x909b2f,_0x31e7b4);_0x2dcb1a=hasChanges(_0x5f10b0),_0x2dcb1a&&(_0x110047=formatDiffWithColors(_0x5f10b0));}_0x5ec358['push']({'path':_0x1d597c,'content':_0x31e7b4}),_0x38745a[_0x3247ad(0x164)]['push']({'name':_0x3fe268['attributes'][_0x3247ad(0x141)],'outputPath':_0x1d597c,'isNew':_0x4cded5,'hasChanges':_0x2dcb1a,'diff':_0x110047}),_0x38745a[_0x3247ad(0xdc)][_0x3247ad(0x164)][_0x3247ad(0x189)]++;if(_0x4cded5)_0x38745a[_0x3247ad(0xdc)][_0x3247ad(0x164)][_0x3247ad(0x135)]++;else{if(_0x2dcb1a)_0x38745a['counts'][_0x3247ad(0x164)][_0x3247ad(0x165)]++;else _0x38745a[_0x3247ad(0xdc)][_0x3247ad(0x164)][_0x3247ad(0xbb)]++;}}if(_0x400e52?.[_0x3247ad(0x9f)])return _0x38745a;a133_0x39da6b[_0x3247ad(0xf5)](_0x42c61,{'recursive':!![]}),a133_0x39da6b['mkdirSync'](getKnowledgeBasesDir(_0x42c61),{'recursive':!![]}),a133_0x39da6b[_0x3247ad(0xf5)](getPromptsDir(_0x42c61),{'recursive':!![]}),a133_0x39da6b[_0x3247ad(0xf5)](getIntegrationsDir(_0x42c61),{'recursive':!![]}),a133_0x39da6b[_0x3247ad(0xf5)](getExperimentalKnowledgeBasesDir(_0x42c61),{'recursive':!![]}),a133_0x39da6b['mkdirSync'](getExperimentalArtifactsDir(_0x42c61),{'recursive':!![]}),a133_0x39da6b[_0x3247ad(0xf5)](getFormInterfacesDir(_0x42c61),{'recursive':!![]}),a133_0x39da6b[_0x3247ad(0xf5)](getChatInterfacesDir(_0x42c61),{'recursive':!![]});const _0x1aa7ae=a133_0x43bfdf['join'](_0x42c61,_0x3247ad(0x180));a133_0x39da6b[_0x3247ad(0x123)](_0x1aa7ae,createAgentConfigContent(_0x519983));for(const _0x19019e of _0x5ec358){if(_0x19019e[_0x3247ad(0x13e)])a133_0x39da6b[_0x3247ad(0xf5)](_0x19019e['path'],{'recursive':!![]});else{const _0x529653=a133_0x43bfdf[_0x3247ad(0xb4)](_0x19019e['path']);!a133_0x39da6b['existsSync'](_0x529653)&&a133_0x39da6b[_0x3247ad(0xf5)](_0x529653,{'recursive':!![]}),a133_0x39da6b[_0x3247ad(0x123)](_0x19019e[_0x3247ad(0xc2)],_0x19019e[_0x3247ad(0xff)]);}}for(const _0x14fb91 of _0x4f230f){_0x14fb91['isDir']?(a133_0x39da6b['rmSync'](_0x14fb91[_0x3247ad(0xc2)],{'recursive':!![],'force':!![]}),this[_0x3247ad(0x133)][_0x3247ad(0x92)](_0x3247ad(0x148)+a133_0x43bfdf[_0x3247ad(0x15c)](a133_0x43bfdf['dirname'](_0x14fb91[_0x3247ad(0xc2)]))+'/'+a133_0x43bfdf[_0x3247ad(0x15c)](_0x14fb91[_0x3247ad(0xc2)]))):(a133_0x39da6b[_0x3247ad(0x10b)](_0x14fb91[_0x3247ad(0xc2)],{'force':!![]}),this[_0x3247ad(0x133)][_0x3247ad(0x92)](_0x3247ad(0x99)+a133_0x43bfdf[_0x3247ad(0x15c)](a133_0x43bfdf[_0x3247ad(0xb4)](_0x14fb91['path']))+'/'+a133_0x43bfdf['basename'](_0x14fb91[_0x3247ad(0xc2)])));}return _0x38745a;}async[a133_0x31c45e(0x8a)](_0x262bad,_0x4d6b63){const _0x1b851f=a133_0x31c45e,_0x5502b5=a133_0x43bfdf[_0x1b851f(0xb0)](_0x262bad,_0x1b851f(0x180));if(!a133_0x39da6b['existsSync'](_0x5502b5))throw new SDKError(ErrorCode[_0x1b851f(0x112)],_0x1b851f(0x100)+_0x262bad,undefined,{'helpText':_0x1b851f(0x166)});const _0x50bfd1=loadAgentConfig(_0x5502b5),_0x31fd20=await this[_0x1b851f(0x93)](_0x50bfd1[_0x1b851f(0x1a9)]),_0x5f3270=await this[_0x1b851f(0x196)][_0x1b851f(0x14b)](_0x31fd20),_0x43092d=_0x5f3270[_0x1b851f(0x1a5)]['name'],_0xc56184={'projectName':_0x43092d,'projectId':_0x31fd20,'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}}},_0x20cf49=[],_0x190dd2=[],_0x7edca5=[],_0x2e9f42=[],_0x1e7f8e=[],_0x7e040a=[],_0x470555=a133_0x39da6b[_0x1b851f(0x157)](_0x262bad,{'withFileTypes':!![]});for(const _0x3e8391 of _0x470555){if(!_0x3e8391[_0x1b851f(0xd9)]())continue;if([_0x1b851f(0x16d),'prompts',_0x1b851f(0x153),_0x1b851f(0x182),_0x1b851f(0xab),_0x1b851f(0x10a),_0x1b851f(0x192)][_0x1b851f(0x15a)](_0x3e8391[_0x1b851f(0x141)]))continue;const _0x439fa9=a133_0x43bfdf[_0x1b851f(0xb0)](_0x262bad,_0x3e8391['name']);if(isAgentDir(_0x439fa9)){const _0x848ff6=a133_0x43bfdf[_0x1b851f(0xb0)](_0x439fa9,_0x1b851f(0x17e)),_0x5152c8=a133_0x43bfdf[_0x1b851f(0xb0)](_0x439fa9,_0x1b851f(0x18a)),_0x1eba26=a133_0x43bfdf[_0x1b851f(0xb0)](_0x439fa9,_0x1b851f(0xc9)),_0x529ac3=parseAgentYaml(a133_0x39da6b[_0x1b851f(0x12e)](_0x848ff6,'utf-8'),_0x848ff6),_0x3edd2f=a133_0x39da6b[_0x1b851f(0x16a)](_0x5152c8)?a133_0x39da6b[_0x1b851f(0x12e)](_0x5152c8,'utf-8'):'',_0x270715=a133_0x39da6b[_0x1b851f(0x16a)](_0x1eba26)?a133_0x39da6b[_0x1b851f(0x12e)](_0x1eba26,'utf-8'):_0x529ac3[_0x1b851f(0x117)];_0x20cf49[_0x1b851f(0x19f)]({'name':_0x529ac3[_0x1b851f(0x141)],'dir':_0x439fa9,'yaml':_0x529ac3,'systemPrompt':_0x3edd2f,'starterMessage':_0x270715});}}const _0xe67d1b=getKnowledgeBasesDir(_0x262bad);if(a133_0x39da6b['existsSync'](_0xe67d1b)){const _0x107ce2=a133_0x39da6b['readdirSync'](_0xe67d1b);for(const _0xf8e7f3 of _0x107ce2){const _0x2571a2=a133_0x43bfdf[_0x1b851f(0xb0)](_0xe67d1b,_0xf8e7f3);if(_0xf8e7f3[_0x1b851f(0xa1)]('.yml')){const _0x181e1f=parseKnowledgeBaseYaml(a133_0x39da6b[_0x1b851f(0x12e)](_0x2571a2,_0x1b851f(0xc5)),_0x2571a2);_0x190dd2['push']({'name':_0x181e1f[_0x1b851f(0x141)],'path':_0x2571a2,'yaml':_0x181e1f});}else{if(_0xf8e7f3[_0x1b851f(0xa1)](_0x1b851f(0x146))){const _0xb8024d=a133_0x39da6b[_0x1b851f(0x12e)](_0x2571a2,_0x1b851f(0xc5)),{name:_0x53f01f,text:_0x322165}=parseTextKnowledgeBaseMd(_0xb8024d,_0xf8e7f3);_0x7edca5[_0x1b851f(0x19f)]({'name':_0x53f01f,'path':_0x2571a2,'text':_0x322165});}}}}const _0x29746b=getPromptsDir(_0x262bad);if(a133_0x39da6b[_0x1b851f(0x16a)](_0x29746b)){const _0x482905=a133_0x39da6b[_0x1b851f(0x157)](_0x29746b)[_0x1b851f(0x184)](_0xa0b37e=>_0xa0b37e['endsWith'](_0x1b851f(0x163)));for(const _0x1dba7a of _0x482905){const _0x19b155=a133_0x43bfdf[_0x1b851f(0xb0)](_0x29746b,_0x1dba7a),_0x584c02=parsePromptYaml(a133_0x39da6b[_0x1b851f(0x12e)](_0x19b155,'utf-8'),_0x19b155);_0x2e9f42['push']({'name':_0x584c02[_0x1b851f(0x141)],'path':_0x19b155,'yaml':_0x584c02});}}const _0x572dbb=[],_0x5d8f40=getIntegrationsDir(_0x262bad);if(a133_0x39da6b[_0x1b851f(0x16a)](_0x5d8f40)){const _0x3cd016=a133_0x39da6b[_0x1b851f(0x157)](_0x5d8f40)['filter'](_0x216d9e=>_0x216d9e[_0x1b851f(0xa1)]('.yml'));for(const _0x2c4690 of _0x3cd016){const _0x45032f=a133_0x43bfdf[_0x1b851f(0xb0)](_0x5d8f40,_0x2c4690),_0x25a886=parseIntegrationYaml(a133_0x39da6b['readFileSync'](_0x45032f,_0x1b851f(0xc5)),_0x45032f);if(!SAFE_INTEGRATION_TYPES['includes'](_0x25a886[_0x1b851f(0x109)][_0x1b851f(0xf0)]())){this[_0x1b851f(0x133)][_0x1b851f(0x1a8)](_0x1b851f(0xca)+_0x25a886[_0x1b851f(0x141)]+_0x1b851f(0x193)+_0x25a886[_0x1b851f(0x109)]+_0x1b851f(0x197)+(_0x1b851f(0x8b)+SAFE_INTEGRATION_TYPES[_0x1b851f(0xb0)](',\x20')+')\x20can\x20be\x20pushed.\x20')+_0x1b851f(0x98));continue;}_0x572dbb[_0x1b851f(0x19f)]({'name':_0x25a886['name'],'path':_0x45032f,'yaml':_0x25a886});}}const _0x153bc2=getExperimentalKnowledgeBasesDir(_0x262bad);if(a133_0x39da6b[_0x1b851f(0x16a)](_0x153bc2)){const _0x52ff6a=a133_0x39da6b['readdirSync'](_0x153bc2,{'withFileTypes':!![]});for(const _0x3826a0 of _0x52ff6a){if(!_0x3826a0[_0x1b851f(0xd9)]())continue;const _0x323bd6=a133_0x43bfdf[_0x1b851f(0xb0)](_0x153bc2,_0x3826a0[_0x1b851f(0x141)]),_0x44abc2=a133_0x43bfdf[_0x1b851f(0xb0)](_0x323bd6,_0x3826a0[_0x1b851f(0x141)]+'.yml'),_0x43a9e2=a133_0x43bfdf[_0x1b851f(0xb0)](_0x323bd6,'functions');if(!a133_0x39da6b[_0x1b851f(0x16a)](_0x44abc2))continue;const _0x3d713a=parseExperimentalKnowledgeBaseYaml(a133_0x39da6b[_0x1b851f(0x12e)](_0x44abc2,'utf-8'),_0x44abc2),_0x332398=[];if(a133_0x39da6b[_0x1b851f(0x16a)](_0x43a9e2)){const _0x5db405=a133_0x39da6b[_0x1b851f(0x157)](_0x43a9e2,{'withFileTypes':!![]});for(const _0x3ccb54 of _0x5db405){if(!_0x3ccb54['isDirectory']())continue;const _0x56cc4f=a133_0x43bfdf[_0x1b851f(0xb0)](_0x43a9e2,_0x3ccb54[_0x1b851f(0x141)]),_0x24c5e2=a133_0x43bfdf[_0x1b851f(0xb0)](_0x56cc4f,_0x1b851f(0xa7)),_0x5bee55=a133_0x43bfdf[_0x1b851f(0xb0)](_0x56cc4f,_0x1b851f(0xb1));a133_0x39da6b[_0x1b851f(0x16a)](_0x24c5e2)&&a133_0x39da6b[_0x1b851f(0x16a)](_0x5bee55)&&_0x332398[_0x1b851f(0x19f)]({'name':_0x3ccb54[_0x1b851f(0x141)],'code':a133_0x39da6b[_0x1b851f(0x12e)](_0x24c5e2,_0x1b851f(0xc5)),'json_schema':a133_0x39da6b[_0x1b851f(0x12e)](_0x5bee55,_0x1b851f(0xc5))});}}const _0x54ea38={..._0x3d713a,'variables':_0x3d713a[_0x1b851f(0x121)]||[],'functions':_0x332398};_0x1e7f8e[_0x1b851f(0x19f)]({'name':_0x3d713a[_0x1b851f(0x141)],'dir':_0x323bd6,'def':_0x54ea38});}}const _0x215d26=getExperimentalArtifactsDir(_0x262bad);if(a133_0x39da6b[_0x1b851f(0x16a)](_0x215d26)){const _0x182904=a133_0x39da6b[_0x1b851f(0x157)](_0x215d26,{'withFileTypes':!![]});for(const _0xf0796e of _0x182904){if(!_0xf0796e[_0x1b851f(0xd9)]())continue;const _0x2796a4=a133_0x43bfdf[_0x1b851f(0xb0)](_0x215d26,_0xf0796e[_0x1b851f(0x141)]),_0x4954d5=a133_0x43bfdf[_0x1b851f(0xb0)](_0x2796a4,_0xf0796e[_0x1b851f(0x141)]+_0x1b851f(0x163)),_0x1c4ea6=a133_0x43bfdf[_0x1b851f(0xb0)](_0x2796a4,_0x1b851f(0xa7)),_0x26684e=a133_0x43bfdf['join'](_0x2796a4,_0x1b851f(0xd4));if(!a133_0x39da6b['existsSync'](_0x4954d5)||!a133_0x39da6b[_0x1b851f(0x16a)](_0x1c4ea6))continue;const _0x437027=parseExperimentalArtifactYaml(a133_0x39da6b[_0x1b851f(0x12e)](_0x4954d5,_0x1b851f(0xc5)),_0x4954d5),_0x27b215=a133_0x39da6b['readFileSync'](_0x1c4ea6,'utf-8'),_0x162107=[];if(a133_0x39da6b[_0x1b851f(0x16a)](_0x26684e)){const _0xfe72af=a133_0x39da6b[_0x1b851f(0x157)](_0x26684e);for(const _0x3dbfef of _0xfe72af){const _0x5841df=a133_0x43bfdf[_0x1b851f(0xb0)](_0x26684e,_0x3dbfef);a133_0x39da6b[_0x1b851f(0xc0)](_0x5841df)[_0x1b851f(0xba)]()&&_0x162107['push']({'file_name':_0x3dbfef,'text_content':a133_0x39da6b[_0x1b851f(0x12e)](_0x5841df,'utf-8')});}}const _0x105c88={..._0x437027,'code':_0x27b215,'files':_0x162107};_0x7e040a[_0x1b851f(0x19f)]({'name':_0x437027['name'],'dir':_0x2796a4,'def':_0x105c88});}}const _0x4ca48b=[],_0x2c4a7b=getFormInterfacesDir(_0x262bad);if(a133_0x39da6b['existsSync'](_0x2c4a7b)){const _0x5bd57f=a133_0x39da6b[_0x1b851f(0x157)](_0x2c4a7b)[_0x1b851f(0x184)](_0x5dec31=>_0x5dec31[_0x1b851f(0xa1)]('.yml'));for(const _0x45a5c0 of _0x5bd57f){const _0x5acad4=a133_0x43bfdf[_0x1b851f(0xb0)](_0x2c4a7b,_0x45a5c0),_0x36508e=parseFormInterfaceYaml(a133_0x39da6b[_0x1b851f(0x12e)](_0x5acad4,'utf-8'),_0x5acad4);_0x4ca48b[_0x1b851f(0x19f)]({'name':_0x36508e['name'],'path':_0x5acad4,'yaml':_0x36508e});}}const _0x34c29e=[],_0x2381ca=getChatInterfacesDir(_0x262bad);if(a133_0x39da6b[_0x1b851f(0x16a)](_0x2381ca)){const _0x541de3=a133_0x39da6b[_0x1b851f(0x157)](_0x2381ca)['filter'](_0x5892ea=>_0x5892ea[_0x1b851f(0xa1)](_0x1b851f(0x163)));for(const _0x38b374 of _0x541de3){const _0x5739eb=a133_0x43bfdf[_0x1b851f(0xb0)](_0x2381ca,_0x38b374),_0x8a6f7f=parseChatInterfaceYaml(a133_0x39da6b['readFileSync'](_0x5739eb,_0x1b851f(0xc5)),_0x5739eb);_0x34c29e['push']({'name':_0x8a6f7f[_0x1b851f(0x141)],'path':_0x5739eb,'yaml':_0x8a6f7f});}}const _0x3f0272=await this['client'][_0x1b851f(0xda)](_0x31fd20),_0x2c351d=await this[_0x1b851f(0x196)][_0x1b851f(0x94)](_0x31fd20),_0x3adf26=await this['client'][_0x1b851f(0x1a1)](_0x31fd20),_0x4e47e5=await this[_0x1b851f(0x196)][_0x1b851f(0xd7)](_0x31fd20),_0x5558ac=await this[_0x1b851f(0x196)][_0x1b851f(0xfc)](_0x31fd20),_0x5a991f=await safeListOrEmpty(()=>this[_0x1b851f(0x196)]['listExperimentalKnowledgeBases'](_0x31fd20)),_0x30688e=await safeListOrEmpty(()=>this['client'][_0x1b851f(0x110)](_0x31fd20)),_0x524c9c=await safeListOrEmpty(()=>this['client'][_0x1b851f(0xc7)](_0x31fd20)),_0x1b7ab4=await safeListOrEmpty(()=>this['client'][_0x1b851f(0xbf)](_0x31fd20)),_0x5be69e=await fetchAllToolTargetMaps((_0x454b86,_0x1fac8d)=>this[_0x1b851f(0x196)][_0x1b851f(0x177)](_0x454b86,_0x1fac8d),_0x31fd20),_0x31a237=new Map(),_0x5970a7=new Map(),_0x1c15e5=new Map(),_0x3bec86=new Map(),_0x5a027c=new Map(),_0x30165c=new Map(),_0x47bdf0=new Map();for(const _0x2d6736 of _0x3f0272){_0x31a237[_0x1b851f(0x16e)](_0x2d6736[_0x1b851f(0x1a5)]['name'],_0x2d6736);}for(const _0x193a27 of _0x2c351d){_0x5970a7[_0x1b851f(0x16e)](_0x193a27[_0x1b851f(0x1a5)]['name'],_0x193a27);}for(const _0x4e3bce of _0x3adf26){_0x1c15e5[_0x1b851f(0x16e)](_0x4e3bce[_0x1b851f(0x1a5)]['name'],_0x4e3bce);}for(const _0x5005ca of _0x4e47e5){_0x3bec86[_0x1b851f(0x16e)](_0x5005ca['attributes']['name'],_0x5005ca);}for(const _0x303c7c of _0x5558ac){_0x5a027c[_0x1b851f(0x16e)](_0x303c7c[_0x1b851f(0x1a5)][_0x1b851f(0x1a7)][_0x1b851f(0xf0)](),_0x303c7c);}for(const _0x215a1a of _0x5a991f){_0x30165c['set'](_0x215a1a['attributes'][_0x1b851f(0x141)],_0x215a1a);}for(const _0x2b1ad7 of _0x30688e){_0x47bdf0[_0x1b851f(0x16e)](_0x2b1ad7[_0x1b851f(0x1a5)]['name'],_0x2b1ad7);}const _0x1aa5ce=new Map(),_0x308bc6=new Map();for(const _0x55bbc7 of _0x524c9c){_0x1aa5ce[_0x1b851f(0x16e)](_0x55bbc7[_0x1b851f(0x1a5)]['name'],_0x55bbc7);}for(const _0x4e81bd of _0x1b7ab4){_0x308bc6[_0x1b851f(0x16e)](_0x4e81bd[_0x1b851f(0x1a5)][_0x1b851f(0x141)],_0x4e81bd);}const _0x416b7b=new Map(),_0x503270=new Map();for(const _0x48d27a of _0x3f0272){_0x416b7b[_0x1b851f(0x16e)](_0x48d27a[_0x1b851f(0x1a5)]['name'],_0x48d27a['id']),_0x503270[_0x1b851f(0x16e)](_0x48d27a['id'],_0x48d27a['attributes'][_0x1b851f(0x141)]);}const _0xa364fb=new Map(),_0x3c33c2=new Map();for(const _0x4d0177 of _0x4e47e5){_0xa364fb[_0x1b851f(0x16e)](_0x4d0177['attributes'][_0x1b851f(0x141)],_0x4d0177['id']),_0x3c33c2[_0x1b851f(0x16e)](_0x4d0177['id'],_0x4d0177[_0x1b851f(0x1a5)][_0x1b851f(0x141)]);}const _0x4144fb=_0x5be69e[_0x1b851f(0x187)][_0x1b851f(0x1af)]||new Map(),_0x592ec9=_0x5be69e[_0x1b851f(0x187)][_0x1b851f(0xf8)]||new Map(),_0x45fef3=_0x5be69e[_0x1b851f(0x187)][_0x1b851f(0x15f)]||new Map(),_0x1d2b85=new Map(),_0x2738cc={'resolveToolTargetName':buildNameResolver({..._0x5be69e[_0x1b851f(0x13a)],'Agent':_0x503270}),'resolvePromptName':async _0x4a8ddd=>_0x3c33c2[_0x1b851f(0x1a2)](_0x4a8ddd),'onWarning':_0x552421=>this['logger'][_0x1b851f(0x1a8)](_0x552421)};let _0x5416cc=[];const _0x3321a9={'projectId':_0x31fd20,'resolveToolTargetId':buildIdResolver({..._0x5be69e['nameToId'],'Agent':_0x416b7b}),'resolvePromptId':async _0x5ed631=>_0xa364fb[_0x1b851f(0x1a2)](_0x5ed631),'onWarning':_0x2a1636=>{const _0x33a6ff=_0x1b851f;this[_0x33a6ff(0x133)][_0x33a6ff(0x1a8)](_0x2a1636),_0x5416cc['push'](_0x2a1636);}},{resolved:_0x23e9a0,unresolved:_0x4842d7}=resolveAgentDependencies(_0x20cf49,new Set(_0x31a237['keys']()));for(const {agent:_0x1d4231,missingDeps:_0x2b78d5}of _0x4842d7){_0xc56184[_0x1b851f(0x11e)][_0x1b851f(0x19f)]({'agentName':_0x1d4231[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':_0x1b851f(0x191),'error':_0x1b851f(0x18f)+_0x2b78d5[_0x1b851f(0xb0)](',\x20')+_0x1b851f(0xf3)}),_0xc56184[_0x1b851f(0xdc)]['agents'][_0x1b851f(0xad)]++;}for(const _0x3c658d of _0x190dd2){const _0x470059=_0x5970a7[_0x1b851f(0x1a2)](_0x3c658d[_0x1b851f(0xd8)][_0x1b851f(0x141)]),_0x4949dd=a133_0x39da6b[_0x1b851f(0x12e)](_0x3c658d[_0x1b851f(0xc2)],_0x1b851f(0xc5));if(_0x470059){const _0x314fd1=apiKnowledgeBaseToYaml(_0x470059),_0x29d290=toKnowledgeBaseYamlString(_0x314fd1),_0x2209d0=generateDiff(_0x29d290,_0x4949dd),_0x54e7f8=hasChanges(_0x2209d0);_0x54e7f8?(_0xc56184[_0x1b851f(0x88)][_0x1b851f(0x19f)]({'name':_0x3c658d[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':'updated','id':_0x470059['id'],'diff':formatDiffWithColors(_0x2209d0)}),_0xc56184[_0x1b851f(0xdc)]['knowledgeBases'][_0x1b851f(0x165)]++):(_0xc56184[_0x1b851f(0x88)][_0x1b851f(0x19f)]({'name':_0x3c658d[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':_0x1b851f(0xbb),'id':_0x470059['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x88)][_0x1b851f(0xbb)]++);}else _0xc56184[_0x1b851f(0x88)][_0x1b851f(0x19f)]({'name':_0x3c658d[_0x1b851f(0xd8)]['name'],'action':_0x1b851f(0x149)}),_0xc56184['counts'][_0x1b851f(0x88)][_0x1b851f(0x149)]++;}for(const _0x5b86a3 of _0x7edca5){const _0x545a30=_0x1c15e5[_0x1b851f(0x1a2)](_0x5b86a3[_0x1b851f(0x141)]),_0x234dd0=a133_0x39da6b['readFileSync'](_0x5b86a3[_0x1b851f(0xc2)],_0x1b851f(0xc5));if(_0x545a30){const _0x4625fd=toTextKnowledgeBaseMd(_0x545a30['attributes'][_0x1b851f(0x141)],_0x545a30[_0x1b851f(0x1a5)][_0x1b851f(0x9b)]),_0xfce6c=generateDiff(_0x4625fd,_0x234dd0),_0x19c819=hasChanges(_0xfce6c);_0x19c819?(_0xc56184['textKnowledgeBases'][_0x1b851f(0x19f)]({'name':_0x5b86a3[_0x1b851f(0x141)],'action':_0x1b851f(0x165),'id':_0x545a30['id'],'diff':formatDiffWithColors(_0xfce6c)}),_0xc56184['counts'][_0x1b851f(0x126)][_0x1b851f(0x165)]++):(_0xc56184[_0x1b851f(0x126)][_0x1b851f(0x19f)]({'name':_0x5b86a3[_0x1b851f(0x141)],'action':_0x1b851f(0xbb),'id':_0x545a30['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x126)][_0x1b851f(0xbb)]++);}else _0xc56184[_0x1b851f(0x126)]['push']({'name':_0x5b86a3[_0x1b851f(0x141)],'action':_0x1b851f(0x149)}),_0xc56184[_0x1b851f(0xdc)]['textKnowledgeBases'][_0x1b851f(0x149)]++;}for(const _0x59f54a of _0x23e9a0){const _0x3e076c=_0x31a237[_0x1b851f(0x1a2)](_0x59f54a[_0x1b851f(0xd8)][_0x1b851f(0x141)]),_0x11985a=a133_0x43bfdf[_0x1b851f(0xb0)](_0x59f54a['dir'],'agent.yml'),_0x26ca6b=a133_0x39da6b[_0x1b851f(0x12e)](_0x11985a,'utf-8'),_0x3091b8=_0x59f54a[_0x1b851f(0x150)],_0x4abff5=_0x1b851f(0x179)+_0x3091b8+'\x0a\x0a#\x20agent.yml\x0a'+_0x26ca6b;if(_0x3e076c){const {yaml:_0x580911,systemPrompt:_0x2b6e52}=await agentResponseToDef(_0x3e076c,_0x2738cc),_0x2b386d=toAgentYamlString(_0x580911),_0x58724e='#\x20prompt.md\x0a'+_0x2b6e52+_0x1b851f(0x12b)+_0x2b386d,_0x1834fd=generateDiff(_0x58724e,_0x4abff5),_0x1dffa4=hasChanges(_0x1834fd);_0x1dffa4?(_0xc56184[_0x1b851f(0x11e)]['push']({'agentName':_0x59f54a[_0x1b851f(0xd8)]['name'],'action':_0x1b851f(0x165),'agentId':_0x3e076c['id'],'diff':formatDiffWithColors(_0x1834fd)}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x11e)]['updated']++):(_0xc56184[_0x1b851f(0x11e)][_0x1b851f(0x19f)]({'agentName':_0x59f54a[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':_0x1b851f(0xbb),'agentId':_0x3e076c['id']}),_0xc56184[_0x1b851f(0xdc)]['agents'][_0x1b851f(0xbb)]++);}else _0xc56184[_0x1b851f(0x11e)][_0x1b851f(0x19f)]({'agentName':_0x59f54a[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':'created'}),_0xc56184[_0x1b851f(0xdc)]['agents']['created']++;}for(const _0x1b823e of _0x2e9f42){const _0x1dd75b=_0x3bec86['get'](_0x1b823e[_0x1b851f(0xd8)][_0x1b851f(0x141)]),_0x4515d7=a133_0x39da6b[_0x1b851f(0x12e)](_0x1b823e['path'],_0x1b851f(0xc5));if(_0x1dd75b){const _0x435ed1=await apiPromptToYaml(_0x1dd75b,_0x2738cc);if(!_0x435ed1){_0xc56184[_0x1b851f(0x145)][_0x1b851f(0x19f)]({'name':_0x1b823e['yaml'][_0x1b851f(0x141)],'action':_0x1b851f(0x165),'id':_0x1dd75b['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x145)]['updated']++;continue;}const _0x6b705c=toPromptYamlString(_0x435ed1),_0xcbee79=generateDiff(_0x6b705c,_0x4515d7),_0x5d14b5=hasChanges(_0xcbee79);_0x5d14b5?(_0xc56184[_0x1b851f(0x145)][_0x1b851f(0x19f)]({'name':_0x1b823e[_0x1b851f(0xd8)]['name'],'action':_0x1b851f(0x165),'id':_0x1dd75b['id'],'diff':formatDiffWithColors(_0xcbee79)}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x145)]['updated']++):(_0xc56184[_0x1b851f(0x145)][_0x1b851f(0x19f)]({'name':_0x1b823e[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':_0x1b851f(0xbb),'id':_0x1dd75b['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x145)][_0x1b851f(0xbb)]++);}else _0xc56184[_0x1b851f(0x145)][_0x1b851f(0x19f)]({'name':_0x1b823e[_0x1b851f(0xd8)]['name'],'action':_0x1b851f(0x149)}),_0xc56184['counts'][_0x1b851f(0x145)][_0x1b851f(0x149)]++;}for(const _0x1eff92 of _0x572dbb){const _0x977fa6=_0x5a027c[_0x1b851f(0x1a2)](_0x1eff92['yaml']['service_type']),_0x30f378=a133_0x39da6b[_0x1b851f(0x12e)](_0x1eff92[_0x1b851f(0xc2)],_0x1b851f(0xc5));if(_0x977fa6){const _0x2bdf87=await apiIntegrationToYaml(_0x977fa6,_0x2738cc),_0x3e17fa=toIntegrationYamlString(_0x2bdf87),_0x388b70=generateDiff(_0x3e17fa,_0x30f378),_0x3e1647=hasChanges(_0x388b70);_0x3e1647?(_0xc56184[_0x1b851f(0x153)][_0x1b851f(0x19f)]({'name':_0x1eff92[_0x1b851f(0xd8)][_0x1b851f(0x109)],'action':_0x1b851f(0x165),'id':_0x977fa6['id'],'diff':formatDiffWithColors(_0x388b70)}),_0xc56184[_0x1b851f(0xdc)]['integrations'][_0x1b851f(0x165)]++):(_0xc56184['integrations']['push']({'name':_0x1eff92[_0x1b851f(0xd8)][_0x1b851f(0x109)],'action':_0x1b851f(0xbb),'id':_0x977fa6['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x153)]['unchanged']++);}else _0xc56184['integrations'][_0x1b851f(0x19f)]({'name':_0x1eff92[_0x1b851f(0xd8)]['service_type'],'action':_0x1b851f(0x149)}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x153)][_0x1b851f(0x149)]++;}for(const _0x3f1d66 of _0x1e7f8e){const _0x3c7f09=_0x30165c[_0x1b851f(0x1a2)](_0x3f1d66[_0x1b851f(0x19a)][_0x1b851f(0x141)]),_0x1fdd78=toExperimentalKnowledgeBaseYamlString(_0x3f1d66[_0x1b851f(0x19a)]);let _0x4a3e54=_0x1fdd78;for(const _0x4e0edd of _0x3f1d66['def'][_0x1b851f(0x19b)]){_0x4a3e54+=_0x1b851f(0x160)+_0x4e0edd[_0x1b851f(0x141)]+_0x1b851f(0x19c)+_0x4e0edd[_0x1b851f(0x136)]+'\x0a---\x20schema:\x20'+_0x4e0edd[_0x1b851f(0x141)]+_0x1b851f(0x19c)+_0x4e0edd[_0x1b851f(0xc6)]+'\x0a';}if(_0x3c7f09){const _0x53ed16=apiExperimentalKnowledgeBaseToYaml(_0x3c7f09),_0x427628=toExperimentalKnowledgeBaseYamlString(_0x53ed16);let _0x17c445=_0x427628;for(const _0x599a54 of _0x53ed16[_0x1b851f(0x19b)]){_0x17c445+=_0x1b851f(0x160)+_0x599a54[_0x1b851f(0x141)]+_0x1b851f(0x19c)+_0x599a54[_0x1b851f(0x136)]+_0x1b851f(0x185)+_0x599a54[_0x1b851f(0x141)]+'\x20---\x0a'+_0x599a54[_0x1b851f(0xc6)]+'\x0a';}const _0x1381d8=generateDiff(_0x17c445,_0x4a3e54),_0x563f22=hasChanges(_0x1381d8);_0x563f22?(_0xc56184[_0x1b851f(0x19e)]['push']({'name':_0x3f1d66[_0x1b851f(0x19a)][_0x1b851f(0x141)],'action':_0x1b851f(0x165),'id':_0x3c7f09['id'],'diff':formatDiffWithColors(_0x1381d8)}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x19e)][_0x1b851f(0x165)]++):(_0xc56184[_0x1b851f(0x19e)]['push']({'name':_0x3f1d66['def'][_0x1b851f(0x141)],'action':'unchanged','id':_0x3c7f09['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x19e)]['unchanged']++);}else _0xc56184[_0x1b851f(0x19e)][_0x1b851f(0x19f)]({'name':_0x3f1d66[_0x1b851f(0x19a)][_0x1b851f(0x141)],'action':'created'}),_0xc56184['counts'][_0x1b851f(0x19e)]['created']++;}for(const _0x47917e of _0x7e040a){const _0x2927b3=_0x47bdf0[_0x1b851f(0x1a2)](_0x47917e['def'][_0x1b851f(0x141)]),_0x5bd399=toExperimentalArtifactYamlString(_0x47917e[_0x1b851f(0x19a)]);let _0x535b93=_0x5bd399+('\x0a---\x20code\x20---\x0a'+_0x47917e[_0x1b851f(0x19a)][_0x1b851f(0x136)]+'\x0a');for(const _0x4a2633 of _0x47917e[_0x1b851f(0x19a)][_0x1b851f(0xd4)]){_0x535b93+=_0x1b851f(0x14d)+_0x4a2633['file_name']+_0x1b851f(0x19c)+_0x4a2633[_0x1b851f(0xeb)]+'\x0a';}if(_0x2927b3){const _0x171927=apiExperimentalArtifactToYaml(_0x2927b3),_0x3f5de3=toExperimentalArtifactYamlString(_0x171927);let _0x8c2daf=_0x3f5de3+(_0x1b851f(0x130)+_0x171927['code']+'\x0a');for(const _0xda51c3 of _0x171927[_0x1b851f(0xd4)]){_0x8c2daf+=_0x1b851f(0x14d)+_0xda51c3[_0x1b851f(0x195)]+'\x20---\x0a'+_0xda51c3['text_content']+'\x0a';}const _0x4735a5=generateDiff(_0x8c2daf,_0x535b93),_0x136776=hasChanges(_0x4735a5);_0x136776?(_0xc56184[_0x1b851f(0x12d)][_0x1b851f(0x19f)]({'name':_0x47917e[_0x1b851f(0x19a)]['name'],'action':_0x1b851f(0x165),'id':_0x2927b3['id'],'diff':formatDiffWithColors(_0x4735a5)}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x12d)]['updated']++):(_0xc56184['experimentalArtifacts'][_0x1b851f(0x19f)]({'name':_0x47917e[_0x1b851f(0x19a)]['name'],'action':_0x1b851f(0xbb),'id':_0x2927b3['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x12d)]['unchanged']++);}else _0xc56184['experimentalArtifacts'][_0x1b851f(0x19f)]({'name':_0x47917e[_0x1b851f(0x19a)][_0x1b851f(0x141)],'action':_0x1b851f(0x149)}),_0xc56184['counts']['experimentalArtifacts']['created']++;}for(const _0xa9e036 of _0x4ca48b){const _0x3527c4=_0x1aa5ce[_0x1b851f(0x1a2)](_0xa9e036[_0x1b851f(0xd8)][_0x1b851f(0x141)]),_0x53e9df=a133_0x39da6b[_0x1b851f(0x12e)](_0xa9e036['path'],_0x1b851f(0xc5));if(_0x3527c4){const _0x470ba0=await apiFormInterfaceToYaml(_0x3527c4,_0x2738cc),_0x2128b3=toFormInterfaceYamlString(_0x470ba0),_0x5bf7c2=generateDiff(_0x2128b3,_0x53e9df),_0x4e90af=hasChanges(_0x5bf7c2);_0x4e90af?(_0xc56184[_0x1b851f(0xe0)]['push']({'name':_0xa9e036['yaml']['name'],'action':_0x1b851f(0x165),'id':_0x3527c4['id'],'diff':formatDiffWithColors(_0x5bf7c2)}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0xe0)][_0x1b851f(0x165)]++):(_0xc56184[_0x1b851f(0xe0)][_0x1b851f(0x19f)]({'name':_0xa9e036[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':'unchanged','id':_0x3527c4['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0xe0)][_0x1b851f(0xbb)]++);}else _0xc56184[_0x1b851f(0xe0)][_0x1b851f(0x19f)]({'name':_0xa9e036[_0x1b851f(0xd8)]['name'],'action':_0x1b851f(0x149)}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0xe0)][_0x1b851f(0x149)]++;}for(const _0x40129e of _0x34c29e){const _0x9aac7e=_0x308bc6[_0x1b851f(0x1a2)](_0x40129e['yaml'][_0x1b851f(0x141)]),_0x91c569=a133_0x39da6b[_0x1b851f(0x12e)](_0x40129e[_0x1b851f(0xc2)],'utf-8');if(_0x9aac7e){const _0x4980b5=await apiChatInterfaceToYaml(_0x9aac7e,_0x2738cc),_0x2ed5d3=toChatInterfaceYamlString(_0x4980b5),_0x45de87=generateDiff(_0x2ed5d3,_0x91c569),_0x5798a8=hasChanges(_0x45de87);_0x5798a8?(_0xc56184[_0x1b851f(0x164)][_0x1b851f(0x19f)]({'name':_0x40129e['yaml']['name'],'action':_0x1b851f(0x165),'id':_0x9aac7e['id'],'diff':formatDiffWithColors(_0x45de87)}),_0xc56184['counts'][_0x1b851f(0x164)][_0x1b851f(0x165)]++):(_0xc56184[_0x1b851f(0x164)][_0x1b851f(0x19f)]({'name':_0x40129e[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':_0x1b851f(0xbb),'id':_0x9aac7e['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x164)][_0x1b851f(0xbb)]++);}else _0xc56184[_0x1b851f(0x164)][_0x1b851f(0x19f)]({'name':_0x40129e['yaml'][_0x1b851f(0x141)],'action':_0x1b851f(0x149)}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x164)][_0x1b851f(0x149)]++;}if(_0x4d6b63?.[_0x1b851f(0x9f)])return _0xc56184;_0xc56184['knowledgeBases']=[],_0xc56184[_0x1b851f(0x126)]=[],_0xc56184[_0x1b851f(0x145)]=[],_0xc56184['integrations']=[],_0xc56184[_0x1b851f(0x19e)]=[],_0xc56184[_0x1b851f(0x12d)]=[],_0xc56184[_0x1b851f(0xe0)]=[],_0xc56184[_0x1b851f(0x164)]=[];const _0xeec14b=_0xc56184['agents']['filter'](_0x5861df=>_0x5861df[_0x1b851f(0xae)]===_0x1b851f(0x191));_0xc56184[_0x1b851f(0x11e)]=_0xeec14b,_0xc56184[_0x1b851f(0xdc)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0xeec14b['length']},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x2f9ed6 of _0x190dd2){try{const _0x4b5a56=_0x5970a7[_0x1b851f(0x1a2)](_0x2f9ed6['yaml'][_0x1b851f(0x141)]),_0x5072b2=yamlKnowledgeBaseToApi(_0x2f9ed6[_0x1b851f(0xd8)],_0x31fd20);if(_0x4b5a56)await this[_0x1b851f(0x196)][_0x1b851f(0x147)](_0x4b5a56['id'],_0x5072b2),_0x4144fb[_0x1b851f(0x16e)](_0x2f9ed6[_0x1b851f(0xd8)][_0x1b851f(0x141)],_0x4b5a56['id']),_0xc56184['knowledgeBases']['push']({'name':_0x2f9ed6[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':'updated','id':_0x4b5a56['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x88)][_0x1b851f(0x165)]++;else{const _0x20f5b5=await this[_0x1b851f(0x196)]['createKnowledgeBase'](_0x5072b2);_0x4144fb['set'](_0x2f9ed6[_0x1b851f(0xd8)][_0x1b851f(0x141)],_0x20f5b5['id']),_0xc56184[_0x1b851f(0x88)]['push']({'name':_0x2f9ed6[_0x1b851f(0xd8)]['name'],'action':_0x1b851f(0x149),'id':_0x20f5b5['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x88)][_0x1b851f(0x149)]++;}}catch(_0x3234b2){_0xc56184[_0x1b851f(0x88)][_0x1b851f(0x19f)]({'name':_0x2f9ed6['yaml'][_0x1b851f(0x141)],'action':'error','error':_0x3234b2[_0x1b851f(0x108)]}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x88)][_0x1b851f(0xad)]++;}}for(const _0x10f4f2 of _0x7edca5){try{const _0x3aadfe=_0x1c15e5['get'](_0x10f4f2[_0x1b851f(0x141)]),_0x27279c=yamlTextKnowledgeBaseToApi({'name':_0x10f4f2[_0x1b851f(0x141)],'text':_0x10f4f2[_0x1b851f(0x9b)]},_0x31fd20);if(_0x3aadfe)await this[_0x1b851f(0x196)]['updateTextKnowledgeBase'](_0x3aadfe['id'],_0x27279c),_0x592ec9['set'](_0x10f4f2[_0x1b851f(0x141)],_0x3aadfe['id']),_0xc56184[_0x1b851f(0x126)][_0x1b851f(0x19f)]({'name':_0x10f4f2[_0x1b851f(0x141)],'action':'updated','id':_0x3aadfe['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x126)]['updated']++;else{const _0x241660=await this[_0x1b851f(0x196)][_0x1b851f(0x9e)](_0x27279c);_0x592ec9['set'](_0x10f4f2[_0x1b851f(0x141)],_0x241660['id']),_0xc56184['textKnowledgeBases'][_0x1b851f(0x19f)]({'name':_0x10f4f2[_0x1b851f(0x141)],'action':_0x1b851f(0x149),'id':_0x241660['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x126)][_0x1b851f(0x149)]++;}}catch(_0x37fe15){_0xc56184[_0x1b851f(0x126)][_0x1b851f(0x19f)]({'name':_0x10f4f2[_0x1b851f(0x141)],'action':_0x1b851f(0x191),'error':_0x37fe15[_0x1b851f(0x108)]}),_0xc56184['counts']['textKnowledgeBases']['errors']++;}}for(const _0x118a3a of _0x1e7f8e){try{const _0x16ffdb=_0x30165c[_0x1b851f(0x1a2)](_0x118a3a['def']['name']),_0x31b72c=yamlExperimentalKnowledgeBaseToApi(_0x118a3a['def'],_0x31fd20);if(_0x16ffdb)await this[_0x1b851f(0x196)][_0x1b851f(0x12a)](_0x16ffdb['id'],_0x31b72c),_0x45fef3[_0x1b851f(0x16e)](_0x118a3a[_0x1b851f(0x19a)]['name'],_0x16ffdb['id']),_0xc56184[_0x1b851f(0x19e)]['push']({'name':_0x118a3a[_0x1b851f(0x19a)][_0x1b851f(0x141)],'action':_0x1b851f(0x165),'id':_0x16ffdb['id']}),_0xc56184[_0x1b851f(0xdc)]['experimentalKnowledgeBases'][_0x1b851f(0x165)]++;else{const _0x48cd81=await this[_0x1b851f(0x196)][_0x1b851f(0xa0)](_0x31b72c);_0x45fef3[_0x1b851f(0x16e)](_0x118a3a[_0x1b851f(0x19a)]['name'],_0x48cd81['id']),_0xc56184[_0x1b851f(0x19e)][_0x1b851f(0x19f)]({'name':_0x118a3a[_0x1b851f(0x19a)][_0x1b851f(0x141)],'action':'created','id':_0x48cd81['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x19e)]['created']++;}}catch(_0xbd8130){_0xc56184['experimentalKnowledgeBases'][_0x1b851f(0x19f)]({'name':_0x118a3a[_0x1b851f(0x19a)][_0x1b851f(0x141)],'action':'error','error':_0xbd8130[_0x1b851f(0x108)]}),_0xc56184[_0x1b851f(0xdc)]['experimentalKnowledgeBases']['errors']++;}}for(const _0x3481c9 of _0x7e040a){try{const _0x768e54=_0x47bdf0[_0x1b851f(0x1a2)](_0x3481c9[_0x1b851f(0x19a)]['name']),_0x58c923=yamlExperimentalArtifactToApi(_0x3481c9[_0x1b851f(0x19a)],_0x31fd20);if(_0x768e54)await this['client'][_0x1b851f(0x12f)](_0x768e54['id'],_0x58c923),_0x1d2b85['set'](_0x3481c9[_0x1b851f(0x19a)][_0x1b851f(0x141)],_0x768e54['id']),_0xc56184[_0x1b851f(0x12d)]['push']({'name':_0x3481c9['def'][_0x1b851f(0x141)],'action':_0x1b851f(0x165),'id':_0x768e54['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x12d)]['updated']++;else{const _0x394191=await this[_0x1b851f(0x196)]['createExperimentalArtifact'](_0x58c923);_0x1d2b85[_0x1b851f(0x16e)](_0x3481c9[_0x1b851f(0x19a)][_0x1b851f(0x141)],_0x394191['id']),_0xc56184[_0x1b851f(0x12d)][_0x1b851f(0x19f)]({'name':_0x3481c9[_0x1b851f(0x19a)][_0x1b851f(0x141)],'action':'created','id':_0x394191['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x12d)][_0x1b851f(0x149)]++;}}catch(_0x4a1be5){_0xc56184[_0x1b851f(0x12d)][_0x1b851f(0x19f)]({'name':_0x3481c9[_0x1b851f(0x19a)]['name'],'action':_0x1b851f(0x191),'error':_0x4a1be5['message']}),_0xc56184['counts'][_0x1b851f(0x12d)][_0x1b851f(0xad)]++;}}for(const _0x25b4a4 of _0x23e9a0){_0x5416cc=[];try{const _0x1b99a3=_0x31a237['get'](_0x25b4a4[_0x1b851f(0xd8)][_0x1b851f(0x141)]),_0x4cb419=await agentDefToRequest(_0x25b4a4[_0x1b851f(0xd8)],_0x25b4a4['systemPrompt'],_0x25b4a4[_0x1b851f(0xcf)],_0x3321a9);if(_0x1b99a3)await this[_0x1b851f(0x196)][_0x1b851f(0x134)](_0x1b99a3['id'],_0x4cb419),_0x416b7b['set'](_0x25b4a4[_0x1b851f(0xd8)][_0x1b851f(0x141)],_0x1b99a3['id']),_0xc56184['agents']['push']({'agentName':_0x25b4a4[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':_0x1b851f(0x165),'agentId':_0x1b99a3['id'],'warnings':_0x5416cc[_0x1b851f(0xa9)]>0x0?_0x5416cc:undefined}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x11e)]['updated']++;else{const _0x5f447c=await this[_0x1b851f(0x196)][_0x1b851f(0x181)](_0x4cb419);_0x416b7b[_0x1b851f(0x16e)](_0x25b4a4['yaml'][_0x1b851f(0x141)],_0x5f447c['id']),_0xc56184['agents'][_0x1b851f(0x19f)]({'agentName':_0x25b4a4[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':_0x1b851f(0x149),'agentId':_0x5f447c['id'],'warnings':_0x5416cc['length']>0x0?_0x5416cc:undefined}),_0xc56184['counts']['agents'][_0x1b851f(0x149)]++;}}catch(_0x5bf7db){_0xc56184['agents'][_0x1b851f(0x19f)]({'agentName':_0x25b4a4[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':_0x1b851f(0x191),'error':_0x5bf7db[_0x1b851f(0x108)],'warnings':_0x5416cc['length']>0x0?_0x5416cc:undefined}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x11e)][_0x1b851f(0xad)]++;}}for(const _0x115067 of _0x2e9f42){try{const _0x582d27=_0x3bec86[_0x1b851f(0x1a2)](_0x115067[_0x1b851f(0xd8)]['name']),_0x3315a7=await yamlPromptToApi(_0x115067[_0x1b851f(0xd8)],_0x31fd20,_0x3321a9);if(!_0x3315a7){_0xc56184[_0x1b851f(0x145)][_0x1b851f(0x19f)]({'name':_0x115067[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':_0x1b851f(0x191),'error':_0x1b851f(0xb5)}),_0xc56184['counts'][_0x1b851f(0x145)][_0x1b851f(0xad)]++;continue;}if(_0x582d27)await this[_0x1b851f(0x196)][_0x1b851f(0xe8)](_0x582d27['id'],_0x3315a7),_0xa364fb[_0x1b851f(0x16e)](_0x115067[_0x1b851f(0xd8)][_0x1b851f(0x141)],_0x582d27['id']),_0xc56184[_0x1b851f(0x145)][_0x1b851f(0x19f)]({'name':_0x115067[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':_0x1b851f(0x165),'id':_0x582d27['id']}),_0xc56184['counts'][_0x1b851f(0x145)][_0x1b851f(0x165)]++;else{const _0x2c5a64=await this[_0x1b851f(0x196)][_0x1b851f(0xa6)](_0x3315a7);_0xa364fb['set'](_0x115067[_0x1b851f(0xd8)][_0x1b851f(0x141)],_0x2c5a64['id']),_0xc56184[_0x1b851f(0x145)][_0x1b851f(0x19f)]({'name':_0x115067[_0x1b851f(0xd8)]['name'],'action':'created','id':_0x2c5a64['id']}),_0xc56184['counts']['prompts'][_0x1b851f(0x149)]++;}}catch(_0x45dccd){_0xc56184[_0x1b851f(0x145)][_0x1b851f(0x19f)]({'name':_0x115067[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':'error','error':_0x45dccd['message']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x145)]['errors']++;}}for(const _0x2035ca of _0x572dbb){try{const _0x1c2b19=_0x5a027c[_0x1b851f(0x1a2)](_0x2035ca[_0x1b851f(0xd8)][_0x1b851f(0x109)]),_0x411d26=await yamlIntegrationToApi(_0x2035ca[_0x1b851f(0xd8)],_0x31fd20,_0x3321a9);if(_0x1c2b19){await this[_0x1b851f(0x196)][_0x1b851f(0x122)](_0x1c2b19['id']);const _0x255a16=await this[_0x1b851f(0x196)][_0x1b851f(0x186)](_0x411d26);_0xc56184[_0x1b851f(0x153)][_0x1b851f(0x19f)]({'name':_0x2035ca[_0x1b851f(0xd8)][_0x1b851f(0x109)],'action':_0x1b851f(0x165),'id':_0x255a16['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x153)][_0x1b851f(0x165)]++;}else{const _0x389407=await this['client']['createIntegration'](_0x411d26);_0xc56184[_0x1b851f(0x153)][_0x1b851f(0x19f)]({'name':_0x2035ca[_0x1b851f(0xd8)][_0x1b851f(0x109)],'action':_0x1b851f(0x149),'id':_0x389407['id']}),_0xc56184['counts'][_0x1b851f(0x153)]['created']++;}}catch(_0x3038dc){_0xc56184['integrations'][_0x1b851f(0x19f)]({'name':_0x2035ca[_0x1b851f(0xd8)]['service_type'],'action':_0x1b851f(0x191),'error':_0x3038dc[_0x1b851f(0x108)]}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x153)][_0x1b851f(0xad)]++;}}for(const _0x2f5635 of _0x4ca48b){try{const _0x4443d3=_0x1aa5ce['get'](_0x2f5635[_0x1b851f(0xd8)][_0x1b851f(0x141)]),_0x4d57cb=await yamlFormInterfaceToApi(_0x2f5635[_0x1b851f(0xd8)],_0x31fd20,_0x3321a9);if(!_0x4d57cb){_0xc56184[_0x1b851f(0xe0)][_0x1b851f(0x19f)]({'name':_0x2f5635[_0x1b851f(0xd8)]['name'],'action':_0x1b851f(0x191),'error':_0x1b851f(0x17c)}),_0xc56184['counts'][_0x1b851f(0xe0)][_0x1b851f(0xad)]++;continue;}if(_0x4443d3){const _0x34cf8f=await this[_0x1b851f(0x196)]['updateFormInterface'](_0x4443d3['id'],_0x4d57cb);_0xc56184[_0x1b851f(0xe0)][_0x1b851f(0x19f)]({'name':_0x2f5635[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':_0x1b851f(0x165),'id':_0x34cf8f['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0xe0)][_0x1b851f(0x165)]++;}else{const _0x1b1077=await this[_0x1b851f(0x196)][_0x1b851f(0x198)](_0x4d57cb);_0xc56184['formInterfaces']['push']({'name':_0x2f5635[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':'created','id':_0x1b1077['id']}),_0xc56184['counts'][_0x1b851f(0xe0)][_0x1b851f(0x149)]++;}}catch(_0x171300){_0xc56184[_0x1b851f(0xe0)][_0x1b851f(0x19f)]({'name':_0x2f5635[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':'error','error':_0x171300['message']}),_0xc56184['counts']['formInterfaces'][_0x1b851f(0xad)]++;}}for(const _0x4c4993 of _0x34c29e){try{const _0x35d5f7=_0x308bc6['get'](_0x4c4993['yaml'][_0x1b851f(0x141)]),_0x15f857=await yamlChatInterfaceToApi(_0x4c4993[_0x1b851f(0xd8)],_0x31fd20,_0x3321a9);if(_0x35d5f7){const _0x14ad3b=await this['client']['updateChatInterface'](_0x35d5f7['id'],_0x15f857);_0xc56184[_0x1b851f(0x164)]['push']({'name':_0x4c4993['yaml']['name'],'action':_0x1b851f(0x165),'id':_0x14ad3b['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x164)][_0x1b851f(0x165)]++;}else{const _0x20cc5f=await this[_0x1b851f(0x196)][_0x1b851f(0x199)](_0x15f857);_0xc56184[_0x1b851f(0x164)][_0x1b851f(0x19f)]({'name':_0x4c4993[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':_0x1b851f(0x149),'id':_0x20cc5f['id']}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x164)][_0x1b851f(0x149)]++;}}catch(_0x529e1c){_0xc56184['chatInterfaces'][_0x1b851f(0x19f)]({'name':_0x4c4993[_0x1b851f(0xd8)][_0x1b851f(0x141)],'action':'error','error':_0x529e1c[_0x1b851f(0x108)]}),_0xc56184[_0x1b851f(0xdc)][_0x1b851f(0x164)][_0x1b851f(0xad)]++;}}return _0xc56184;}async[a133_0x31c45e(0x183)](_0x1ba1fc,_0x258149,_0xbad589,_0x3ba3cf){const _0x5af411=a133_0x31c45e,{projectId:_0x1c6ff6,project:_0x1d9663}=await this[_0x5af411(0x9a)](_0x1ba1fc),_0x7429c7=_0x1d9663[_0x5af411(0x1a5)]['name'],_0x2aea7f=await this[_0x5af411(0x196)][_0x5af411(0xda)](_0x1c6ff6),_0x2975d5=_0x2aea7f[_0x5af411(0x169)](_0x3c32b2=>_0x3c32b2[_0x5af411(0x1a5)]['name']===_0x258149);if(!_0x2975d5)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x5af411(0xfe)+_0x258149,undefined,{'helpText':_0x5af411(0x167)+_0x2aea7f['map'](_0x41bf05=>_0x41bf05[_0x5af411(0x1a5)][_0x5af411(0x141)])[_0x5af411(0xb0)](',\x20')});let _0x235ea0;if(_0xbad589)_0x235ea0=_0xbad589;else{const _0x16079c=a133_0x43bfdf[_0x5af411(0xb0)](process['cwd'](),_0x5af411(0x11e)),_0x2125cd=getSanitizedPathWithMigration(_0x16079c,_0x7429c7);_0x2125cd['renamed']&&this['logger']['info']('Renamed\x20folder:\x20'+a133_0x43bfdf[_0x5af411(0x15c)](_0x2125cd[_0x5af411(0x95)])+_0x5af411(0x13c)+a133_0x43bfdf[_0x5af411(0x15c)](_0x2125cd['path'])),_0x235ea0=_0x2125cd[_0x5af411(0xc2)];}const _0x3087b7=getSanitizedPathWithMigration(_0x235ea0,_0x258149);_0x3087b7[_0x5af411(0xd0)]&&this[_0x5af411(0x133)][_0x5af411(0x92)](_0x5af411(0xc3)+a133_0x43bfdf[_0x5af411(0x15c)](_0x3087b7[_0x5af411(0x95)])+_0x5af411(0x13c)+a133_0x43bfdf['basename'](_0x3087b7[_0x5af411(0xc2)]));const _0x180f53=_0x3087b7[_0x5af411(0xc2)],_0x30c96e=new Map(),_0x47e9ad=new Map(),_0x5d809d=await this[_0x5af411(0x196)][_0x5af411(0x94)](_0x1c6ff6),_0x1e9859=await this['client'][_0x5af411(0x1a1)](_0x1c6ff6),_0x2bf71e=await safeListOrEmpty(()=>this[_0x5af411(0x196)][_0x5af411(0x168)](_0x1c6ff6)),_0x420582=new Map(),_0x393eb1=new Map();for(const _0x28bce7 of _0x5d809d){_0x30c96e[_0x5af411(0x16e)](_0x28bce7['id'],_0x28bce7[_0x5af411(0x1a5)][_0x5af411(0x141)]);}for(const _0x54e929 of _0x1e9859){_0x420582['set'](_0x54e929['id'],_0x54e929['attributes'][_0x5af411(0x141)]);}for(const _0x16d394 of _0x2bf71e){_0x393eb1['set'](_0x16d394['id'],_0x16d394[_0x5af411(0x1a5)][_0x5af411(0x141)]);}for(const _0x1d3dbb of _0x2aea7f){_0x47e9ad['set'](_0x1d3dbb['id'],_0x1d3dbb[_0x5af411(0x1a5)][_0x5af411(0x141)]);}const _0x4b4ce8={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x30c96e,'TextKnowledgeBase':_0x420582,'Agent':_0x47e9ad,'ExperimentalKnowledgeBase':_0x393eb1}),'resolvePromptName':async()=>undefined,'onWarning':_0x2c4332=>this[_0x5af411(0x133)][_0x5af411(0x1a8)](_0x2c4332)},_0x491058=a133_0x43bfdf[_0x5af411(0xb0)](_0x180f53,_0x5af411(0x18a)),_0x212969=a133_0x43bfdf[_0x5af411(0xb0)](_0x180f53,'agent.yml'),_0x5c6376=a133_0x43bfdf[_0x5af411(0xb0)](_0x180f53,'starter_message.md'),_0x26d036=!a133_0x39da6b[_0x5af411(0x16a)](_0x212969);if(_0x3ba3cf?.[_0x5af411(0x9f)])return{'agentName':_0x258149,'outputPath':_0x180f53,'isNew':_0x26d036,'hasChanges':!![]};a133_0x39da6b[_0x5af411(0xf5)](_0x235ea0,{'recursive':!![]}),a133_0x39da6b[_0x5af411(0xf5)](_0x180f53,{'recursive':!![]});const _0x4974c9=a133_0x43bfdf[_0x5af411(0xb0)](_0x235ea0,'tdx.json');!a133_0x39da6b['existsSync'](_0x4974c9)&&a133_0x39da6b[_0x5af411(0x123)](_0x4974c9,createAgentConfigContent(_0x1ba1fc));const {yaml:_0x23eefe,systemPrompt:_0x3d0410,starterMessage:_0x4b208a}=await agentResponseToDef(_0x2975d5,_0x4b4ce8);let _0xc56fb0=_0x26d036;if(!_0x26d036){const _0x552f73=a133_0x39da6b['existsSync'](_0x491058)?a133_0x39da6b[_0x5af411(0x12e)](_0x491058,_0x5af411(0xc5)):'',_0x1b56a0=a133_0x39da6b[_0x5af411(0x12e)](_0x212969,_0x5af411(0xc5));_0xc56fb0=_0x552f73!==_0x3d0410||_0x1b56a0!==toAgentYamlString(_0x23eefe);}a133_0x39da6b[_0x5af411(0x123)](_0x491058,_0x3d0410),a133_0x39da6b['writeFileSync'](_0x212969,toAgentYamlString(_0x23eefe));if(_0x4b208a&&_0x4b208a['includes']('\x0a'))a133_0x39da6b[_0x5af411(0x123)](_0x5c6376,_0x4b208a);else a133_0x39da6b[_0x5af411(0x16a)](_0x5c6376)&&a133_0x39da6b[_0x5af411(0x105)](_0x5c6376);return{'agentName':_0x258149,'outputPath':_0x180f53,'isNew':_0x26d036,'hasChanges':_0xc56fb0};}async[a133_0x31c45e(0x106)](_0xf8c901,_0x19c35b){const _0x25da23=a133_0x31c45e;let _0x5ef75a;isAgentYamlPath(_0xf8c901)?_0x5ef75a=getAgentDirFromYamlPath(_0xf8c901):_0x5ef75a=_0xf8c901;const {config:_0xf46305}=findAgentConfig(_0x5ef75a),_0x787766=await this['resolveProjectId'](_0xf46305[_0x25da23(0x1a9)]),_0x4dff7e=a133_0x43bfdf[_0x25da23(0xb0)](_0x5ef75a,_0x25da23(0x17e)),_0x42a1b8=a133_0x43bfdf[_0x25da23(0xb0)](_0x5ef75a,_0x25da23(0x18a)),_0x56bb1d=a133_0x43bfdf[_0x25da23(0xb0)](_0x5ef75a,_0x25da23(0xc9));if(!a133_0x39da6b[_0x25da23(0x16a)](_0x4dff7e))throw new SDKError(ErrorCode['NOT_FOUND'],_0x25da23(0xd1)+_0x5ef75a,undefined,{'helpText':'Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.'});const _0x113c66=parseAgentYaml(a133_0x39da6b[_0x25da23(0x12e)](_0x4dff7e,_0x25da23(0xc5)),_0x4dff7e),_0x56cbf4=a133_0x39da6b[_0x25da23(0x16a)](_0x42a1b8)?a133_0x39da6b[_0x25da23(0x12e)](_0x42a1b8,_0x25da23(0xc5)):'',_0x4d724c=a133_0x39da6b[_0x25da23(0x16a)](_0x56bb1d)?a133_0x39da6b[_0x25da23(0x12e)](_0x56bb1d,'utf-8'):_0x113c66['starter_message'];if(_0x19c35b?.[_0x25da23(0x9f)])return{'agentName':_0x113c66[_0x25da23(0x141)],'action':_0x25da23(0x149),'projectId':_0x787766};const _0x407146=await this[_0x25da23(0x196)]['listAgentsFull'](_0x787766),_0x5729e2=await fetchAllToolTargetMaps((_0x2dbdc6,_0x2e5063)=>this[_0x25da23(0x196)][_0x25da23(0x177)](_0x2dbdc6,_0x2e5063),_0x787766),_0x305e2b=new Map();for(const _0x269fb6 of _0x407146){_0x305e2b['set'](_0x269fb6['attributes'][_0x25da23(0x141)],_0x269fb6['id']);}const _0x1407b9=[],_0x2657e7={'projectId':_0x787766,'resolveToolTargetId':buildIdResolver({..._0x5729e2[_0x25da23(0x187)],'Agent':_0x305e2b}),'resolvePromptId':async()=>undefined,'onWarning':_0x2fd6c5=>{const _0xd5a3ce=_0x25da23;this[_0xd5a3ce(0x133)]['warn'](_0x2fd6c5),_0x1407b9[_0xd5a3ce(0x19f)](_0x2fd6c5);}};try{const _0x2f0429=_0x407146[_0x25da23(0x169)](_0x19b7d5=>_0x19b7d5[_0x25da23(0x1a5)][_0x25da23(0x141)]===_0x113c66[_0x25da23(0x141)]),_0x52cdd4=await agentDefToRequest(_0x113c66,_0x56cbf4,_0x4d724c,_0x2657e7);if(_0x2f0429)return await this[_0x25da23(0x196)][_0x25da23(0x134)](_0x2f0429['id'],_0x52cdd4),{'agentName':_0x113c66[_0x25da23(0x141)],'action':'updated','projectId':_0x787766,'agentId':_0x2f0429['id'],'warnings':_0x1407b9[_0x25da23(0xa9)]>0x0?_0x1407b9:undefined};else{const _0x29e860=await this[_0x25da23(0x196)][_0x25da23(0x181)](_0x52cdd4);return{'agentName':_0x113c66['name'],'action':_0x25da23(0x149),'projectId':_0x787766,'agentId':_0x29e860['id'],'warnings':_0x1407b9[_0x25da23(0xa9)]>0x0?_0x1407b9:undefined};}}catch(_0x385cb4){return{'agentName':_0x113c66[_0x25da23(0x141)],'action':_0x25da23(0x191),'projectId':_0x787766,'error':_0x385cb4[_0x25da23(0x108)],'warnings':_0x1407b9['length']>0x0?_0x1407b9:undefined};}}async[a133_0x31c45e(0x1a0)](_0x39b448,_0x17d264,_0x11549b){const _0x593ba5=a133_0x31c45e,_0x5d69e7=a133_0x39da6b[_0x593ba5(0x16a)](_0x39b448)&&a133_0x39da6b[_0x593ba5(0x16a)](a133_0x43bfdf['join'](_0x39b448,_0x593ba5(0x180)));let _0xc6f903;const _0x5859e5=[],_0x287fd9=[],_0xb21cd9=[],_0x49cb32=[],_0x107b30=[],_0x59a5f0=[],_0x12af67=[],_0x31b597=[],_0x16a18f=[];if(_0x5d69e7){const _0xc504c6=loadAgentConfig(a133_0x43bfdf[_0x593ba5(0xb0)](_0x39b448,_0x593ba5(0x180)));_0xc6f903=_0xc504c6['llm_project'];const _0x23956b=a133_0x39da6b[_0x593ba5(0x157)](_0x39b448,{'withFileTypes':!![]});for(const _0x4327d5 of _0x23956b){if(!_0x4327d5[_0x593ba5(0xd9)]())continue;if([_0x593ba5(0x16d),_0x593ba5(0x182),_0x593ba5(0xab),_0x593ba5(0x145),_0x593ba5(0x153),_0x593ba5(0x10a),_0x593ba5(0x192)]['includes'](_0x4327d5[_0x593ba5(0x141)]))continue;const _0x87373e=a133_0x43bfdf[_0x593ba5(0xb0)](_0x39b448,_0x4327d5[_0x593ba5(0x141)]);if(isAgentDir(_0x87373e)){const _0x4ff2ea=a133_0x43bfdf[_0x593ba5(0xb0)](_0x87373e,_0x593ba5(0x17e)),_0x1ca3f4=a133_0x43bfdf[_0x593ba5(0xb0)](_0x87373e,_0x593ba5(0x18a)),_0xe186a1=a133_0x43bfdf[_0x593ba5(0xb0)](_0x87373e,'starter_message.md'),_0x5d6a56=parseAgentYaml(a133_0x39da6b['readFileSync'](_0x4ff2ea,_0x593ba5(0xc5)),_0x4ff2ea),_0x3d7be3=a133_0x39da6b[_0x593ba5(0x16a)](_0x1ca3f4)?a133_0x39da6b['readFileSync'](_0x1ca3f4,_0x593ba5(0xc5)):'',_0x477f49=a133_0x39da6b['existsSync'](_0xe186a1)?a133_0x39da6b[_0x593ba5(0x12e)](_0xe186a1,'utf-8'):_0x5d6a56[_0x593ba5(0x117)];_0x5859e5['push']({'name':_0x5d6a56[_0x593ba5(0x141)],'dir':_0x87373e,'yaml':_0x5d6a56,'systemPrompt':_0x3d7be3,'starterMessage':_0x477f49});}}const _0x53a352=getKnowledgeBasesDir(_0x39b448);if(a133_0x39da6b['existsSync'](_0x53a352)){const _0x530647=a133_0x39da6b[_0x593ba5(0x157)](_0x53a352);for(const _0x11ba6f of _0x530647){const _0x334517=a133_0x43bfdf[_0x593ba5(0xb0)](_0x53a352,_0x11ba6f);if(_0x11ba6f[_0x593ba5(0xa1)](_0x593ba5(0x163))){const _0xa4e1e1=parseKnowledgeBaseYaml(a133_0x39da6b[_0x593ba5(0x12e)](_0x334517,_0x593ba5(0xc5)),_0x334517);_0x287fd9[_0x593ba5(0x19f)]({'name':_0xa4e1e1[_0x593ba5(0x141)],'path':_0x334517,'yaml':_0xa4e1e1});}else{if(_0x11ba6f[_0x593ba5(0xa1)](_0x593ba5(0x146))){const _0x164e77=a133_0x39da6b[_0x593ba5(0x12e)](_0x334517,_0x593ba5(0xc5)),{name:_0x2bdd3c,text:_0x11ac47}=parseTextKnowledgeBaseMd(_0x164e77,_0x11ba6f);_0xb21cd9['push']({'name':_0x2bdd3c,'path':_0x334517,'text':_0x11ac47});}}}}const _0x508c1f=getPromptsDir(_0x39b448);if(a133_0x39da6b[_0x593ba5(0x16a)](_0x508c1f)){const _0x2da8bb=a133_0x39da6b[_0x593ba5(0x157)](_0x508c1f)[_0x593ba5(0x184)](_0x114008=>_0x114008['endsWith'](_0x593ba5(0x163)));for(const _0x1b28a4 of _0x2da8bb){const _0x5b9a98=a133_0x43bfdf['join'](_0x508c1f,_0x1b28a4),_0x456e29=parsePromptYaml(a133_0x39da6b[_0x593ba5(0x12e)](_0x5b9a98,_0x593ba5(0xc5)),_0x5b9a98);_0x49cb32[_0x593ba5(0x19f)]({'name':_0x456e29[_0x593ba5(0x141)],'path':_0x5b9a98,'yaml':_0x456e29});}}const _0x3eded4=getIntegrationsDir(_0x39b448);if(a133_0x39da6b[_0x593ba5(0x16a)](_0x3eded4)){const _0x2d66d1=a133_0x39da6b['readdirSync'](_0x3eded4)[_0x593ba5(0x184)](_0x36a441=>_0x36a441['endsWith'](_0x593ba5(0x163)));for(const _0x33016b of _0x2d66d1){const _0x388ab5=a133_0x43bfdf[_0x593ba5(0xb0)](_0x3eded4,_0x33016b),_0x36c7e1=parseIntegrationYaml(a133_0x39da6b[_0x593ba5(0x12e)](_0x388ab5,_0x593ba5(0xc5)),_0x388ab5);SAFE_INTEGRATION_TYPES[_0x593ba5(0x15a)](_0x36c7e1[_0x593ba5(0x109)]['toLowerCase']())?_0x107b30[_0x593ba5(0x19f)]({'name':_0x36c7e1[_0x593ba5(0x141)],'path':_0x388ab5,'yaml':_0x36c7e1}):this[_0x593ba5(0x133)][_0x593ba5(0x1a8)](_0x593ba5(0xca)+_0x36c7e1[_0x593ba5(0x141)]+_0x593ba5(0x193)+_0x36c7e1['service_type']+'):\x20'+(_0x593ba5(0x8b)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x593ba5(0x1aa)));}}const _0x13f9f8=getExperimentalKnowledgeBasesDir(_0x39b448);if(a133_0x39da6b[_0x593ba5(0x16a)](_0x13f9f8)){const _0x3693bd=a133_0x39da6b[_0x593ba5(0x157)](_0x13f9f8,{'withFileTypes':!![]});for(const _0x382521 of _0x3693bd){if(!_0x382521['isDirectory']())continue;const _0x1c842b=a133_0x43bfdf[_0x593ba5(0xb0)](_0x13f9f8,_0x382521[_0x593ba5(0x141)]),_0x30586c=a133_0x43bfdf[_0x593ba5(0xb0)](_0x1c842b,_0x382521[_0x593ba5(0x141)]+_0x593ba5(0x163));if(a133_0x39da6b[_0x593ba5(0x16a)](_0x30586c)){const _0x3a2e6c=parseExperimentalKnowledgeBaseYaml(a133_0x39da6b['readFileSync'](_0x30586c,_0x593ba5(0xc5)),_0x30586c),_0x573ddb=a133_0x43bfdf[_0x593ba5(0xb0)](_0x1c842b,_0x593ba5(0x19b)),_0x43e0a6=[];if(a133_0x39da6b[_0x593ba5(0x16a)](_0x573ddb)){const _0x4fcfe0=a133_0x39da6b[_0x593ba5(0x157)](_0x573ddb,{'withFileTypes':!![]});for(const _0x12938 of _0x4fcfe0){if(!_0x12938[_0x593ba5(0xd9)]())continue;const _0x49936b=a133_0x43bfdf['join'](_0x573ddb,_0x12938[_0x593ba5(0x141)]),_0x6a143a=a133_0x43bfdf[_0x593ba5(0xb0)](_0x49936b,_0x593ba5(0xa7)),_0xa6ec3b=a133_0x43bfdf[_0x593ba5(0xb0)](_0x49936b,_0x593ba5(0xb1));if(a133_0x39da6b['existsSync'](_0x6a143a)&&a133_0x39da6b['existsSync'](_0xa6ec3b)){const _0x32d441=a133_0x39da6b[_0x593ba5(0x12e)](_0x6a143a,_0x593ba5(0xc5)),_0x3b3c6d=a133_0x39da6b['readFileSync'](_0xa6ec3b,_0x593ba5(0xc5));_0x43e0a6[_0x593ba5(0x19f)]({'name':_0x12938['name'],'code':_0x32d441,'json_schema':_0x3b3c6d});}}}const _0x56c3b5={..._0x3a2e6c,'functions':_0x43e0a6};_0x59a5f0[_0x593ba5(0x19f)]({'name':_0x3a2e6c[_0x593ba5(0x141)],'path':_0x1c842b,'def':_0x56c3b5});}}}const _0x2c26d2=getExperimentalArtifactsDir(_0x39b448);if(a133_0x39da6b[_0x593ba5(0x16a)](_0x2c26d2)){const _0x3fe376=a133_0x39da6b[_0x593ba5(0x157)](_0x2c26d2,{'withFileTypes':!![]});for(const _0x7ef92b of _0x3fe376){if(!_0x7ef92b['isDirectory']())continue;const _0x140dd0=a133_0x43bfdf[_0x593ba5(0xb0)](_0x2c26d2,_0x7ef92b[_0x593ba5(0x141)]),_0x190c4c=a133_0x43bfdf[_0x593ba5(0xb0)](_0x140dd0,_0x7ef92b[_0x593ba5(0x141)]+_0x593ba5(0x163));if(a133_0x39da6b[_0x593ba5(0x16a)](_0x190c4c)){const _0x3dadb1=parseExperimentalArtifactYaml(a133_0x39da6b[_0x593ba5(0x12e)](_0x190c4c,'utf-8'),_0x190c4c),_0x465a37=a133_0x43bfdf[_0x593ba5(0xb0)](_0x140dd0,_0x593ba5(0xa7)),_0x445fb7=a133_0x39da6b['existsSync'](_0x465a37)?a133_0x39da6b[_0x593ba5(0x12e)](_0x465a37,'utf-8'):'',_0xadb83f=a133_0x43bfdf['join'](_0x140dd0,_0x593ba5(0xd4)),_0x1e86c0=[];if(a133_0x39da6b[_0x593ba5(0x16a)](_0xadb83f)){const _0x1d5e8a=a133_0x39da6b[_0x593ba5(0x157)](_0xadb83f);for(const _0x12dd8e of _0x1d5e8a){const _0x12bf28=a133_0x43bfdf['join'](_0xadb83f,_0x12dd8e);if(a133_0x39da6b[_0x593ba5(0xc0)](_0x12bf28)[_0x593ba5(0xba)]()){const _0x25f709=a133_0x39da6b[_0x593ba5(0x12e)](_0x12bf28,_0x593ba5(0xc5));_0x1e86c0[_0x593ba5(0x19f)]({'file_name':_0x12dd8e,'text_content':_0x25f709});}}}const _0xd2e701={..._0x3dadb1,'code':_0x445fb7,'files':_0x1e86c0};_0x12af67['push']({'name':_0x3dadb1[_0x593ba5(0x141)],'path':_0x140dd0,'def':_0xd2e701});}}}const _0x4e564f=getFormInterfacesDir(_0x39b448);if(a133_0x39da6b[_0x593ba5(0x16a)](_0x4e564f)){const _0xe056b7=a133_0x39da6b[_0x593ba5(0x157)](_0x4e564f)['filter'](_0x511991=>_0x511991[_0x593ba5(0xa1)](_0x593ba5(0x163)));for(const _0x2d4930 of _0xe056b7){const _0x15fd4f=a133_0x43bfdf[_0x593ba5(0xb0)](_0x4e564f,_0x2d4930),_0x351771=parseFormInterfaceYaml(a133_0x39da6b[_0x593ba5(0x12e)](_0x15fd4f,'utf-8'),_0x15fd4f);_0x31b597[_0x593ba5(0x19f)]({'name':_0x351771[_0x593ba5(0x141)],'path':_0x15fd4f,'yaml':_0x351771});}}const _0x4e160b=getChatInterfacesDir(_0x39b448);if(a133_0x39da6b[_0x593ba5(0x16a)](_0x4e160b)){const _0x56d239=a133_0x39da6b[_0x593ba5(0x157)](_0x4e160b)[_0x593ba5(0x184)](_0x5e4814=>_0x5e4814['endsWith'](_0x593ba5(0x163)));for(const _0x226166 of _0x56d239){const _0x23778c=a133_0x43bfdf['join'](_0x4e160b,_0x226166),_0x18bf6e=parseChatInterfaceYaml(a133_0x39da6b[_0x593ba5(0x12e)](_0x23778c,_0x593ba5(0xc5)),_0x23778c);_0x16a18f[_0x593ba5(0x19f)]({'name':_0x18bf6e[_0x593ba5(0x141)],'path':_0x23778c,'yaml':_0x18bf6e});}}}else{const _0x5ae2e1=await this[_0x593ba5(0x93)](_0x39b448),_0x2fd822=await this['client'][_0x593ba5(0x14b)](_0x5ae2e1);_0xc6f903=_0x2fd822['attributes'][_0x593ba5(0x141)];const _0x128b23=await this[_0x593ba5(0x196)][_0x593ba5(0xda)](_0x5ae2e1),_0x5e43b7=await this[_0x593ba5(0x196)][_0x593ba5(0x94)](_0x5ae2e1),_0x49264a=await this[_0x593ba5(0x196)][_0x593ba5(0x1a1)](_0x5ae2e1),_0x3a1de9=await this[_0x593ba5(0x196)]['listPrompts'](_0x5ae2e1),_0x5cdc2e=await this['client']['listIntegrations'](_0x5ae2e1),_0x107ca4=await safeListOrEmpty(()=>this[_0x593ba5(0x196)][_0x593ba5(0x168)](_0x5ae2e1)),_0x39f98a=await safeListOrEmpty(()=>this['client']['listExperimentalArtifacts'](_0x5ae2e1)),_0x2eb197=new Map(),_0x1bffcd=new Map(),_0x392d57=new Map(),_0x3aa3cd=new Map(),_0x30fe7c=new Map(),_0x3c62a1=new Map();for(const _0x10cb1b of _0x5e43b7){_0x2eb197[_0x593ba5(0x16e)](_0x10cb1b['id'],_0x10cb1b['attributes'][_0x593ba5(0x141)]);}for(const _0x5ce3ba of _0x49264a){_0x1bffcd[_0x593ba5(0x16e)](_0x5ce3ba['id'],_0x5ce3ba[_0x593ba5(0x1a5)][_0x593ba5(0x141)]);}for(const _0x106165 of _0x128b23){_0x392d57[_0x593ba5(0x16e)](_0x106165['id'],_0x106165[_0x593ba5(0x1a5)][_0x593ba5(0x141)]);}for(const _0x3837fa of _0x3a1de9){_0x3aa3cd[_0x593ba5(0x16e)](_0x3837fa['id'],_0x3837fa['attributes'][_0x593ba5(0x141)]);}for(const _0x451486 of _0x107ca4){_0x30fe7c[_0x593ba5(0x16e)](_0x451486['id'],_0x451486['attributes']['name']);}for(const _0x2aeff4 of _0x39f98a){_0x3c62a1['set'](_0x2aeff4['id'],_0x2aeff4[_0x593ba5(0x1a5)][_0x593ba5(0x141)]);}const _0xb89f9e={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x2eb197,'TextKnowledgeBase':_0x1bffcd,'Agent':_0x392d57,'ExperimentalKnowledgeBase':_0x30fe7c}),'resolvePromptName':async _0x36d576=>_0x3aa3cd[_0x593ba5(0x1a2)](_0x36d576),'onWarning':_0x2c5b82=>this[_0x593ba5(0x133)][_0x593ba5(0x1a8)](_0x2c5b82)};for(const _0x4a39a0 of _0x128b23){const _0x20810a=await agentResponseToDef(_0x4a39a0,_0xb89f9e),{yaml:_0x43af34,systemPrompt:_0x5eea80,starterMessage:_0x33c83b}=_0x20810a;_0x5859e5['push']({'name':_0x43af34[_0x593ba5(0x141)],'dir':'','yaml':_0x43af34,'systemPrompt':_0x5eea80,'starterMessage':_0x33c83b});}for(const _0x501adc of _0x5e43b7){const _0x1ab054=apiKnowledgeBaseToYaml(_0x501adc);_0x287fd9[_0x593ba5(0x19f)]({'name':_0x1ab054[_0x593ba5(0x141)],'path':'','yaml':_0x1ab054});}for(const _0x5ad728 of _0x49264a){_0xb21cd9['push']({'name':_0x5ad728[_0x593ba5(0x1a5)]['name'],'path':'','text':_0x5ad728[_0x593ba5(0x1a5)][_0x593ba5(0x9b)]});}for(const _0x47e84f of _0x3a1de9){const _0x1ce072=await apiPromptToYaml(_0x47e84f,_0xb89f9e);_0x1ce072&&_0x49cb32['push']({'name':_0x1ce072[_0x593ba5(0x141)],'path':'','yaml':_0x1ce072});}for(const _0x581f5f of _0x5cdc2e){if(!_0x581f5f['attributes']['isManaged']&&SAFE_INTEGRATION_TYPES['includes'](_0x581f5f[_0x593ba5(0x1a5)][_0x593ba5(0x1a7)][_0x593ba5(0xf0)]())){const _0x1ca7ca=await apiIntegrationToYaml(_0x581f5f,_0xb89f9e);_0x107b30['push']({'name':_0x581f5f[_0x593ba5(0x1a5)][_0x593ba5(0x1a7)][_0x593ba5(0xf0)](),'path':'','yaml':_0x1ca7ca});}}for(const _0x2a7723 of _0x107ca4){const _0x2e88b5=apiExperimentalKnowledgeBaseToYaml(_0x2a7723);_0x59a5f0[_0x593ba5(0x19f)]({'name':_0x2e88b5[_0x593ba5(0x141)],'path':'','def':_0x2e88b5});}for(const _0x15b6de of _0x39f98a){const _0x57c9a9=apiExperimentalArtifactToYaml(_0x15b6de);_0x12af67[_0x593ba5(0x19f)]({'name':_0x57c9a9[_0x593ba5(0x141)],'path':'','def':_0x57c9a9});}const _0x5b29d3=await safeListOrEmpty(()=>this[_0x593ba5(0x196)][_0x593ba5(0xc7)](_0x5ae2e1));for(const _0xe4b3b5 of _0x5b29d3){const _0x2c9a87=await apiFormInterfaceToYaml(_0xe4b3b5,_0xb89f9e);_0x31b597[_0x593ba5(0x19f)]({'name':_0x2c9a87['name'],'path':'','yaml':_0x2c9a87});}const _0x4f2e1d=await safeListOrEmpty(()=>this[_0x593ba5(0x196)]['listChatInterfaces'](_0x5ae2e1));for(const _0x5b369e of _0x4f2e1d){if(_0x5b369e['attributes'][_0x593ba5(0xd5)])continue;const _0x6cb6a9=await apiChatInterfaceToYaml(_0x5b369e,_0xb89f9e);_0x16a18f[_0x593ba5(0x19f)]({'name':_0x6cb6a9[_0x593ba5(0x141)],'path':'','yaml':_0x6cb6a9});}}const _0x204c42={'sourceProjectName':_0xc6f903,'newProjectName':_0x17d264,'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}}},_0x269210=await this[_0x593ba5(0x196)][_0x593ba5(0x11a)](),_0x328a17=_0x269210[_0x593ba5(0x169)](_0x5aab95=>_0x5aab95['attributes']['name']===_0x17d264);if(_0x328a17)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x593ba5(0x11d)+_0x17d264+_0x593ba5(0xd6),undefined,{'helpText':_0x593ba5(0x8c)});if(_0x11549b?.[_0x593ba5(0x9f)])return _0x204c42[_0x593ba5(0xdc)][_0x593ba5(0x11e)][_0x593ba5(0x149)]=_0x5859e5['length'],_0x204c42[_0x593ba5(0xdc)][_0x593ba5(0x88)][_0x593ba5(0x149)]=_0x287fd9[_0x593ba5(0xa9)],_0x204c42['counts'][_0x593ba5(0x126)]['created']=_0xb21cd9[_0x593ba5(0xa9)],_0x204c42[_0x593ba5(0xdc)][_0x593ba5(0x19e)][_0x593ba5(0x149)]=_0x59a5f0['length'],_0x204c42[_0x593ba5(0xdc)]['experimentalArtifacts'][_0x593ba5(0x149)]=_0x12af67[_0x593ba5(0xa9)],_0x204c42['counts']['prompts'][_0x593ba5(0x149)]=_0x49cb32['length'],_0x204c42[_0x593ba5(0xdc)][_0x593ba5(0x153)][_0x593ba5(0x149)]=_0x107b30[_0x593ba5(0xa9)],_0x204c42;const _0x401ed0=await this[_0x593ba5(0x196)][_0x593ba5(0x107)]({'name':_0x17d264}),_0x5671a9=_0x401ed0['id'];_0x204c42[_0x593ba5(0xe9)]=_0x5671a9;const _0x117f44=new Map(),_0x171100=new Map(),_0x2615f3=new Map(),_0x589734=new Map(),_0x1d08c0=new Map(),_0x21ff52=new Map(),_0x354eea=new Map(),_0x87a445=new Map(),_0x59d283=new Set(),_0x2815eb=new Set();for(const _0xb2ba9 of _0x5859e5){for(const _0xa1c73 of _0xb2ba9[_0x593ba5(0xd8)][_0x593ba5(0x176)]||[]){if(_0xa1c73[_0x593ba5(0xf1)]===_0x593ba5(0xf2)&&_0xa1c73['target']){const _0x38228d=parseRef(_0xa1c73[_0x593ba5(0x19d)]);if(_0x38228d)_0x59d283['add'](_0x38228d[_0x593ba5(0x141)]);}else{if(_0xa1c73[_0x593ba5(0xf1)]===_0x593ba5(0x16c)&&_0xa1c73['target']){const _0x23f3d3=parseRef(_0xa1c73['target']);if(_0x23f3d3)_0x2815eb[_0x593ba5(0x97)](_0x23f3d3[_0x593ba5(0x141)]);}}}}for(const _0x31f2a1 of _0x59d283){try{const _0x2e4b3c=await this[_0x593ba5(0x196)]['createImageGenerator']({'projectId':_0x5671a9,'name':_0x31f2a1});_0x1d08c0['set'](_0x31f2a1,_0x2e4b3c['id']),_0x204c42[_0x593ba5(0x11c)][_0x593ba5(0x19f)]({'name':_0x31f2a1,'action':_0x593ba5(0x149),'id':_0x2e4b3c['id']}),_0x204c42[_0x593ba5(0xdc)]['imageGenerators'][_0x593ba5(0x149)]++;}catch(_0x23eba7){_0x204c42[_0x593ba5(0x11c)]['push']({'name':_0x31f2a1,'action':_0x593ba5(0x191),'error':_0x23eba7['message']}),_0x204c42[_0x593ba5(0xdc)]['imageGenerators']['errors']++;}}for(const _0x1d2a1e of _0x2815eb){try{const _0x293d96=await this[_0x593ba5(0x196)][_0x593ba5(0x16f)]({'projectId':_0x5671a9,'name':_0x1d2a1e});_0x21ff52[_0x593ba5(0x16e)](_0x1d2a1e,_0x293d96['id']),_0x204c42[_0x593ba5(0xdd)][_0x593ba5(0x19f)]({'name':_0x1d2a1e,'action':'created','id':_0x293d96['id']}),_0x204c42[_0x593ba5(0xdc)][_0x593ba5(0xdd)][_0x593ba5(0x149)]++;}catch(_0x350f26){_0x204c42[_0x593ba5(0xdd)][_0x593ba5(0x19f)]({'name':_0x1d2a1e,'action':'error','error':_0x350f26['message']}),_0x204c42[_0x593ba5(0xdc)][_0x593ba5(0xdd)][_0x593ba5(0xad)]++;}}const _0x376c73=await fetchAllToolTargetMaps((_0x297a28,_0x1dfdab)=>this[_0x593ba5(0x196)][_0x593ba5(0x177)](_0x297a28,_0x1dfdab),_0x5671a9);let _0x5b57fc=[];const _0x14bd8f={'projectId':_0x5671a9,'resolveToolTargetId':buildIdResolver({..._0x376c73[_0x593ba5(0x187)],'KnowledgeBase':_0x117f44,'TextKnowledgeBase':_0x171100,'ExperimentalKnowledgeBase':_0x354eea,'Agent':_0x2615f3,'WebSearchTool':_0x21ff52,'ImageGenerator':_0x1d08c0}),'resolvePromptId':async _0x3b8cb1=>_0x589734[_0x593ba5(0x1a2)](_0x3b8cb1),'onWarning':_0x6fecba=>{const _0x7a6153=_0x593ba5;this[_0x7a6153(0x133)][_0x7a6153(0x1a8)](_0x6fecba),_0x5b57fc[_0x7a6153(0x19f)](_0x6fecba);}};for(const _0x79e689 of _0x287fd9){try{const _0x21da61=yamlKnowledgeBaseToApi(_0x79e689['yaml'],_0x5671a9),_0x52da10=await this[_0x593ba5(0x196)][_0x593ba5(0x17d)](_0x21da61);_0x117f44['set'](_0x79e689[_0x593ba5(0xd8)][_0x593ba5(0x141)],_0x52da10['id']),_0x204c42['knowledgeBases']['push']({'name':_0x79e689[_0x593ba5(0xd8)][_0x593ba5(0x141)],'action':_0x593ba5(0x149),'id':_0x52da10['id']}),_0x204c42[_0x593ba5(0xdc)][_0x593ba5(0x88)][_0x593ba5(0x149)]++;}catch(_0x2d2ae6){_0x204c42[_0x593ba5(0x88)][_0x593ba5(0x19f)]({'name':_0x79e689['yaml'][_0x593ba5(0x141)],'action':'error','error':_0x2d2ae6['message']}),_0x204c42[_0x593ba5(0xdc)][_0x593ba5(0x88)]['errors']++;}}for(const _0x46fed4 of _0xb21cd9){try{const _0x398628=yamlTextKnowledgeBaseToApi({'name':_0x46fed4['name'],'text':_0x46fed4['text']},_0x5671a9),_0x2377b9=await this[_0x593ba5(0x196)][_0x593ba5(0x9e)](_0x398628);_0x171100[_0x593ba5(0x16e)](_0x46fed4[_0x593ba5(0x141)],_0x2377b9['id']),_0x204c42[_0x593ba5(0x126)][_0x593ba5(0x19f)]({'name':_0x46fed4[_0x593ba5(0x141)],'action':_0x593ba5(0x149),'id':_0x2377b9['id']}),_0x204c42['counts']['textKnowledgeBases'][_0x593ba5(0x149)]++;}catch(_0x45d0cb){_0x204c42[_0x593ba5(0x126)][_0x593ba5(0x19f)]({'name':_0x46fed4['name'],'action':_0x593ba5(0x191),'error':_0x45d0cb['message']}),_0x204c42['counts'][_0x593ba5(0x126)][_0x593ba5(0xad)]++;}}for(const _0x4c8670 of _0x12af67){try{const _0x2c94d2=yamlExperimentalArtifactToApi(_0x4c8670[_0x593ba5(0x19a)],_0x5671a9),_0x59549a=await this[_0x593ba5(0x196)][_0x593ba5(0xce)](_0x2c94d2);_0x87a445['set'](_0x4c8670['def'][_0x593ba5(0x141)],_0x59549a['id']),_0x204c42['experimentalArtifacts'][_0x593ba5(0x19f)]({'name':_0x4c8670[_0x593ba5(0x19a)][_0x593ba5(0x141)],'action':_0x593ba5(0x149),'id':_0x59549a['id']}),_0x204c42[_0x593ba5(0xdc)][_0x593ba5(0x12d)][_0x593ba5(0x149)]++;}catch(_0x3366be){_0x204c42['experimentalArtifacts'][_0x593ba5(0x19f)]({'name':_0x4c8670[_0x593ba5(0x19a)][_0x593ba5(0x141)],'action':_0x593ba5(0x191),'error':_0x3366be[_0x593ba5(0x108)]}),_0x204c42[_0x593ba5(0xdc)][_0x593ba5(0x12d)][_0x593ba5(0xad)]++;}}for(const _0x593b31 of _0x59a5f0){try{const _0x40884d=yamlExperimentalKnowledgeBaseToApi(_0x593b31[_0x593ba5(0x19a)],_0x5671a9),_0x27f5ad=await this[_0x593ba5(0x196)][_0x593ba5(0xa0)](_0x40884d);_0x354eea[_0x593ba5(0x16e)](_0x593b31[_0x593ba5(0x19a)]['name'],_0x27f5ad['id']),_0x204c42[_0x593ba5(0x19e)]['push']({'name':_0x593b31[_0x593ba5(0x19a)]['name'],'action':_0x593ba5(0x149),'id':_0x27f5ad['id']}),_0x204c42[_0x593ba5(0xdc)][_0x593ba5(0x19e)][_0x593ba5(0x149)]++;}catch(_0x289a65){_0x204c42['experimentalKnowledgeBases']['push']({'name':_0x593b31[_0x593ba5(0x19a)]['name'],'action':_0x593ba5(0x191),'error':_0x289a65['message']}),_0x204c42['counts'][_0x593ba5(0x19e)][_0x593ba5(0xad)]++;}}const _0x826117=[..._0x5859e5][_0x593ba5(0x190)]((_0x563d4b,_0x105047)=>{const _0x34d940=_0x593ba5,_0x4e44ec=_0x563d4b[_0x34d940(0xd8)][_0x34d940(0x176)]?.[_0x34d940(0xa8)](_0x52e4ba=>_0x52e4ba['type']===_0x34d940(0x18e))??![],_0x1412d3=_0x105047[_0x34d940(0xd8)][_0x34d940(0x176)]?.['some'](_0x1f2119=>_0x1f2119[_0x34d940(0xf1)]===_0x34d940(0x18e))??![];if(_0x4e44ec&&!_0x1412d3)return 0x1;if(!_0x4e44ec&&_0x1412d3)return-0x1;return 0x0;});for(const _0x2539ad of _0x826117){_0x5b57fc=[];try{const _0x148b07=_0x2539ad['yaml']['tools']?.[_0x593ba5(0x184)](_0x47fc1e=>{const _0x4d6a3b=_0x593ba5;if(_0x47fc1e[_0x4d6a3b(0xf1)]===_0x4d6a3b(0x18e)&&_0x47fc1e[_0x4d6a3b(0x19d)]){const _0x4164bc=parseRef(_0x47fc1e[_0x4d6a3b(0x19d)]);return _0x4164bc?.[_0x4d6a3b(0x141)]===_0x2539ad[_0x4d6a3b(0xd8)][_0x4d6a3b(0x141)];}return![];})??[];if(_0x148b07['length']>0x0){const _0x554625=_0x593ba5(0x175)+_0x2539ad[_0x593ba5(0xd8)][_0x593ba5(0x141)]+'\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20'+_0x593ba5(0x127);this[_0x593ba5(0x133)]['warn'](_0x554625),_0x5b57fc[_0x593ba5(0x19f)](_0x554625);}const _0x3e7df1=await agentDefToRequest(_0x2539ad['yaml'],_0x2539ad['systemPrompt'],_0x2539ad[_0x593ba5(0xcf)],_0x14bd8f),_0x9e3c63=await this['client'][_0x593ba5(0x181)](_0x3e7df1);_0x2615f3['set'](_0x2539ad['yaml'][_0x593ba5(0x141)],_0x9e3c63['id']),_0x204c42['agents'][_0x593ba5(0x19f)]({'agentName':_0x2539ad[_0x593ba5(0xd8)]['name'],'action':'created','agentId':_0x9e3c63['id'],'warnings':_0x5b57fc[_0x593ba5(0xa9)]>0x0?_0x5b57fc:undefined}),_0x204c42[_0x593ba5(0xdc)][_0x593ba5(0x11e)][_0x593ba5(0x149)]++;}catch(_0x2cbaec){_0x204c42[_0x593ba5(0x11e)][_0x593ba5(0x19f)]({'agentName':_0x2539ad[_0x593ba5(0xd8)][_0x593ba5(0x141)],'action':_0x593ba5(0x191),'error':_0x2cbaec[_0x593ba5(0x108)],'warnings':_0x5b57fc[_0x593ba5(0xa9)]>0x0?_0x5b57fc:undefined}),_0x204c42['counts'][_0x593ba5(0x11e)][_0x593ba5(0xad)]++;}}for(const _0x30aadb of _0x49cb32){try{const _0x1200e8=await yamlPromptToApi(_0x30aadb[_0x593ba5(0xd8)],_0x5671a9,_0x14bd8f);if(!_0x1200e8){_0x204c42[_0x593ba5(0x145)]['push']({'name':_0x30aadb[_0x593ba5(0xd8)][_0x593ba5(0x141)],'action':_0x593ba5(0x191),'error':'Agent\x20reference\x20not\x20found'}),_0x204c42[_0x593ba5(0xdc)]['prompts'][_0x593ba5(0xad)]++;continue;}const _0x4d8842=await this[_0x593ba5(0x196)][_0x593ba5(0xa6)](_0x1200e8);_0x589734[_0x593ba5(0x16e)](_0x30aadb['yaml']['name'],_0x4d8842['id']),_0x204c42['prompts'][_0x593ba5(0x19f)]({'name':_0x30aadb[_0x593ba5(0xd8)][_0x593ba5(0x141)],'action':_0x593ba5(0x149),'id':_0x4d8842['id']}),_0x204c42['counts'][_0x593ba5(0x145)][_0x593ba5(0x149)]++;}catch(_0x58be8f){_0x204c42[_0x593ba5(0x145)][_0x593ba5(0x19f)]({'name':_0x30aadb['yaml'][_0x593ba5(0x141)],'action':_0x593ba5(0x191),'error':_0x58be8f[_0x593ba5(0x108)]}),_0x204c42[_0x593ba5(0xdc)][_0x593ba5(0x145)][_0x593ba5(0xad)]++;}}for(const _0x13ba87 of _0x107b30){try{const _0x2a007b=await yamlIntegrationToApi(_0x13ba87[_0x593ba5(0xd8)],_0x5671a9,_0x14bd8f),_0x532e8e=await this[_0x593ba5(0x196)]['createIntegration'](_0x2a007b);_0x204c42[_0x593ba5(0x153)]['push']({'name':_0x13ba87['yaml'][_0x593ba5(0x109)],'action':_0x593ba5(0x149),'id':_0x532e8e['id']}),_0x204c42[_0x593ba5(0xdc)][_0x593ba5(0x153)]['created']++;}catch(_0x3a6461){_0x204c42['integrations']['push']({'name':_0x13ba87[_0x593ba5(0xd8)]['service_type'],'action':_0x593ba5(0x191),'error':_0x3a6461[_0x593ba5(0x108)]}),_0x204c42['counts'][_0x593ba5(0x153)][_0x593ba5(0xad)]++;}}for(const _0x346815 of _0x31b597){try{const _0x43f14d=await yamlFormInterfaceToApi(_0x346815[_0x593ba5(0xd8)],_0x5671a9,_0x14bd8f);if(!_0x43f14d){_0x204c42[_0x593ba5(0xe0)][_0x593ba5(0x19f)]({'name':_0x346815['yaml'][_0x593ba5(0x141)],'action':_0x593ba5(0x191),'error':_0x593ba5(0x17c)}),_0x204c42[_0x593ba5(0xdc)][_0x593ba5(0xe0)]['errors']++;continue;}const _0x92bddb=await this[_0x593ba5(0x196)][_0x593ba5(0x198)](_0x43f14d);_0x204c42[_0x593ba5(0xe0)][_0x593ba5(0x19f)]({'name':_0x346815[_0x593ba5(0xd8)]['name'],'action':_0x593ba5(0x149),'id':_0x92bddb['id']}),_0x204c42['counts']['formInterfaces'][_0x593ba5(0x149)]++;}catch(_0x49ba70){_0x204c42[_0x593ba5(0xe0)]['push']({'name':_0x346815[_0x593ba5(0xd8)][_0x593ba5(0x141)],'action':_0x593ba5(0x191),'error':_0x49ba70['message']}),_0x204c42[_0x593ba5(0xdc)][_0x593ba5(0xe0)][_0x593ba5(0xad)]++;}}for(const _0x49cafc of _0x16a18f){try{const _0x4f4fdb=await yamlChatInterfaceToApi(_0x49cafc[_0x593ba5(0xd8)],_0x5671a9,_0x14bd8f),_0x7981e1=await this[_0x593ba5(0x196)]['createChatInterface'](_0x4f4fdb);_0x204c42[_0x593ba5(0x164)][_0x593ba5(0x19f)]({'name':_0x49cafc[_0x593ba5(0xd8)][_0x593ba5(0x141)],'action':_0x593ba5(0x149),'id':_0x7981e1['id']}),_0x204c42[_0x593ba5(0xdc)]['chatInterfaces'][_0x593ba5(0x149)]++;}catch(_0x430564){_0x204c42['chatInterfaces'][_0x593ba5(0x19f)]({'name':_0x49cafc[_0x593ba5(0xd8)]['name'],'action':_0x593ba5(0x191),'error':_0x430564[_0x593ba5(0x108)]}),_0x204c42['counts']['chatInterfaces']['errors']++;}}return _0x204c42;}}
|
|
1
|
+
const a133_0xe8af3=a133_0x209e;(function(_0x1a4351,_0x12afba){const _0x565c81=a133_0x209e,_0x54de5e=_0x1a4351();while(!![]){try{const _0x58add2=parseInt(_0x565c81(0x182))/0x1+-parseInt(_0x565c81(0x1c6))/0x2+parseInt(_0x565c81(0x13c))/0x3*(-parseInt(_0x565c81(0x215))/0x4)+parseInt(_0x565c81(0x20d))/0x5*(parseInt(_0x565c81(0x232))/0x6)+parseInt(_0x565c81(0x15c))/0x7*(-parseInt(_0x565c81(0x179))/0x8)+parseInt(_0x565c81(0x256))/0x9+-parseInt(_0x565c81(0x17c))/0xa*(-parseInt(_0x565c81(0x1bc))/0xb);if(_0x58add2===_0x12afba)break;else _0x54de5e['push'](_0x54de5e['shift']());}catch(_0x3dec16){_0x54de5e['push'](_0x54de5e['shift']());}}}(a133_0x5894,0xdfa55));import{LLMApiClient}from'../client/llm-api-client.js';import*as a133_0x8c5550 from'node:fs';import*as a133_0xcf5d58 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';function a133_0x5894(){const _0x3fe49f=['file_name','basename','TextKnowledgeBase','No\x20tdx.json\x20found\x20in\x20','getOrCreateDefaultAgent','createImageGenerator','variables','listChats','maxToolIterations','getBackupMetadata','files','getDefaultProjectName','yaml','getProject','prompt.md','Project\x20\x22','renamed','listAgentsFull','promptId','push','none','Project\x20not\x20found:\x20','statSync','site','web_search','\x0a\x0a#\x20agent.yml\x0a','deleteIntegration','Output\x20directory\x20already\x20exists:\x20','\x20→\x20','mkdirSync','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','join','agents','resolveAgentId','(dry-run)','total','createAgentResponse','projects','info','readdirSync','clearDefaultAgent','some','INTERNAL','createKnowledgeBase','createWebSearchTool','availableModels','localeCompare','new','Multiple\x20agents\x20found\x20with\x20name\x20\x27','.llm','integrations.json','already\x20exists','.md','restoreProject','starter_message.md','createAgent','unchanged','updateAgent','metadata','duplicate','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','has','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','\x22\x20already\x20exists','counts','text_content','knowledgebases.json','code.js','Renamed\x20agent\x20folder:\x20','continueChat','75025SeyQhf','json_schema','createExperimentalKnowledgeBase','tdx_default_','Multiple\x20projects\x20found\x20with\x20name\x20\x27','length','chat_agent_console','\x20in\x20project\x20','101624GRTHNG','medium','experimentalKnowledgeBases','.yml','createTextKnowledgeBase','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','Backup\x20folder\x20not\x20found:\x20','sdk.llm','service_type','listPrompts','knowledge_bases','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','webSearchTools','attributes','listChatInterfaces','tdx_','code','action','\x27\x20(','add','existsSync','loadJsonFile','def','createFormInterface','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','INVALID_ARGUMENT','writeFileSync','updateKnowledgeBase','toISOString','654RboODf','agentsFull','dryRun','createProject','prompts','updateAgentResponse','history','listTextKnowledgeBases','sort','type','deleteProject','Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','nameToId','parse','minimal','imageGenerators','tdx.json','Removed\x20deleted\x20directory:\x20','\x0a---\x20code\x20---\x0a','getOrCreateDefaultProject','chatInterfaces','text','get','Invalid\x20agent\x20reference\x20format:\x20','listToolTargets','isDirectory','dirname','keys','actions','message','oldPath','knowledgeBases','getAgent','serviceType','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','3733731EEmNKa','chatId','pullProject','profile','integrations','createIntegration','created','path','agent','_reasoning_','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','low','207URnrwL','createChatInterface','LLM_PROJECT_NOT_FOUND','pullAgent','cloneProject','chat_generic','listFormInterfaces','availableModelNames','getChatLog','json_schema.json','filter','\x0a---\x20schema:\x20','prompts.json','NOT_FOUND','setCurrentProject','warn','Skipping\x20integration\x20\x27','size','resolveProjectName',')\x20can\x20be\x20cloned.','map','---\x20file:\x20','rmSync','toLowerCase','currentProjectId','project.json','errors','logger','agents.json','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','ALREADY_EXISTS','starter_message','3175809IhLOKY','cwd','stringify','chat','dry-run-','chats','setDefaultAgent','project','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','Renamed\x20chat\x20interface\x20file:\x20','isFile','getUserSettings','Removed\x20deleted\x20file:\x20','Renamed\x20experimental\x20artifact\x20directory:\x20','includes','---\x20schema:\x20','\x0a---\x20function:\x20','AGENT_NOT_FOUND','deleteAgent','systemPrompt','template','error','exportedFrom','isDir','form_interfaces','experimental_artifacts','Only\x20safe\x20types\x20(','agent.yml\x20not\x20found\x20in\x20','formInterfaces','24EoutwO','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','split','310ZAozbe','agentId','createPrompt','slackMessageMode','event','llm_project','721999ldnRAU','listKnowledgeBases','Renamed\x20prompt\x20file:\x20','Agent\x20not\x20found:\x20','Unsupported\x20backup\x20version:\x20','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','tools','utf-8','client','isManaged',')\x20can\x20be\x20pushed.\x20','#\x20prompt.md\x0a','ExperimentalKnowledgeBase','idToName','version','listAgents','chatIgnoreManagedActions','updateExperimentalArtifact','pushProject','outputs','experimental_knowledge_bases','context','agent.yml','set','dir','listImageGenerators','signal','Renamed\x20form\x20interface\x20file:\x20','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','models','listExperimentalKnowledgeBases','chat_interfaces','find','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','UNAUTHENTICATED','Agent\x20reference\x20not\x20found','createExperimentalArtifact','listProjects','Could\x20not\x20resolve\x20agent\x20reference','textKnowledgeBases','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','content','status','):\x20','starterMessage','displayName','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','readFileSync','\x27.\x20This\x20should\x20not\x20happen.','experimentalArtifacts','description','\x20---\x0a','startChat','target','functions','endsWith','listIntegrations','chat_parent_segment','650353QpoIdu','chatInfo','updated','backupProject','tdDatabaseName','unlinkSync','Agent\x20\x27','name','image_gen','resolveProjectId','1150176kdcTuj'];a133_0x5894=function(){return _0x3fe49f;};return a133_0x5894();}import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a133_0xe8af3(0x141),a133_0xe8af3(0x213),a133_0xe8af3(0x1bb)];async function safeListOrEmpty(_0x5cef04){const _0x5f2691=a133_0xe8af3;try{return await _0x5cef04();}catch(_0xcd11b5){if(_0xcd11b5 instanceof HTTPClientError&&_0xcd11b5[_0x5f2691(0x1ac)]===0x194)return[];throw _0xcd11b5;}}function a133_0x209e(_0x433423,_0x45c153){_0x433423=_0x433423-0x139;const _0x5894cb=a133_0x5894();let _0x209e6e=_0x5894cb[_0x433423];return _0x209e6e;}export class LLMSDK{[a133_0xe8af3(0x154)];[a133_0xe8af3(0x18a)];[a133_0xe8af3(0x197)];[a133_0xe8af3(0x157)]=Logger['of'](a133_0xe8af3(0x21c));constructor(_0x261808){const _0x168863=a133_0xe8af3;this['client']=new LLMApiClient(_0x261808),this[_0x168863(0x197)]=_0x261808;}[a133_0xe8af3(0x1d2)](){const _0x5a46ef=a133_0xe8af3,_0x18dcf7=getSanitizedUsername();return _0x5a46ef(0x210)+_0x18dcf7;}async[a133_0xe8af3(0x14a)](_0x5bf612){const _0x374360=a133_0xe8af3,{projectId:_0x5e7076}=await this[_0x374360(0x14e)](_0x5bf612);this[_0x374360(0x154)]=_0x5e7076;}['getCurrentProject'](){const _0x3d89df=a133_0xe8af3;return this[_0x3d89df(0x154)];}async[a133_0xe8af3(0x162)](_0x4caf73){const _0x3c4ae7=a133_0xe8af3,_0x55fda2=this[_0x3c4ae7(0x197)]['profile'];let _0x405122,_0x451fe6;if(_0x4caf73['includes']('/')){const _0x39aa43=_0x4caf73[_0x3c4ae7(0x17b)]('/');if(_0x39aa43[_0x3c4ae7(0x212)]!==0x2)throw new SDKError(ErrorCode[_0x3c4ae7(0x22e)],_0x3c4ae7(0x24a)+_0x4caf73,undefined,{'helpText':_0x3c4ae7(0x205)});const [_0x1e0f9e,_0xb92849]=_0x39aa43;_0x405122=await this[_0x3c4ae7(0x1c5)](_0x1e0f9e),_0x451fe6=_0xb92849;}else _0x405122=this[_0x3c4ae7(0x154)]||(await this[_0x3c4ae7(0x246)]())['id'],_0x451fe6=_0x4caf73;const _0x59714b=await this[_0x3c4ae7(0x1e8)](_0x451fe6,_0x405122),_0x1fc718=await this[_0x3c4ae7(0x18a)][_0x3c4ae7(0x253)](_0x59714b);writeCachedLLMAgent(_0x1fc718[_0x3c4ae7(0x222)][_0x3c4ae7(0x1c3)],_0x59714b,_0x405122,_0x55fda2);}['getDefaultAgent'](){const _0x15baac=a133_0xe8af3,_0x332341=this[_0x15baac(0x197)]['profile'];return readCachedLLMAgent(_0x332341)||undefined;}[a133_0xe8af3(0x1ef)](){const _0x7c9e85=a133_0xe8af3,_0x1a01fb=this[_0x7c9e85(0x197)]['profile'];clearCachedLLMAgent(_0x1a01fb);}async[a133_0xe8af3(0x19f)](){const _0x4c9851=a133_0xe8af3,_0x359638=await this[_0x4c9851(0x18a)][_0x4c9851(0x167)](),_0x377b73=[];for(const _0x33f485 of _0x359638[_0x4c9851(0x143)]){const _0x18fb77=_0x359638[_0x4c9851(0x1f4)][_0x33f485];_0x18fb77&&_0x377b73['push']({'name':_0x33f485,'displayName':_0x18fb77[_0x4c9851(0x1af)]});}return _0x377b73;}async[a133_0xe8af3(0x235)](_0x4269ad){const _0x207671=a133_0xe8af3;return await this['client'][_0x207671(0x235)](_0x4269ad);}async[a133_0xe8af3(0x23c)](_0x459b32){const _0x59151f=a133_0xe8af3,{projectId:_0x15a8ac}=await this[_0x59151f(0x14e)](_0x459b32);await this[_0x59151f(0x18a)][_0x59151f(0x23c)](_0x15a8ac);}async[a133_0xe8af3(0x1ec)](_0x7ae99d=0x32){const _0x3b41ce=a133_0xe8af3;return await this[_0x3b41ce(0x18a)][_0x3b41ce(0x1a7)](_0x7ae99d);}async[a133_0xe8af3(0x246)](_0x2c0364){const _0x412a63=a133_0xe8af3,_0x42f742=_0x2c0364||this[_0x412a63(0x1d2)](),_0x3177fa=this[_0x412a63(0x197)][_0x412a63(0x259)];if(!_0x2c0364){const _0x52c0b4=readCachedLLMProject(_0x3177fa);if(_0x52c0b4&&_0x52c0b4[_0x412a63(0x1c3)]===_0x42f742)try{const _0x3f3b57=await this[_0x412a63(0x18a)]['getProject'](_0x52c0b4['id']);if(_0x3f3b57[_0x412a63(0x222)]['name']===_0x42f742)return _0x3f3b57;}catch{}}const _0x2bfa49=await this['client'][_0x412a63(0x1a7)](),_0xa30987=_0x2bfa49[_0x412a63(0x1a2)](_0xd267b3=>_0xd267b3[_0x412a63(0x222)][_0x412a63(0x1c3)]===_0x42f742);if(_0xa30987)return!_0x2c0364&&writeCachedLLMProject(_0x42f742,_0xa30987['id'],_0x3177fa),_0xa30987;const _0x5bedfb=await this[_0x412a63(0x18a)][_0x412a63(0x235)]({'name':_0x42f742,'description':_0x412a63(0x1aa)+getSanitizedUsername()+')'});return!_0x2c0364&&writeCachedLLMProject(_0x42f742,_0x5bedfb['id'],_0x3177fa),_0x5bedfb;}async[a133_0xe8af3(0x1c5)](_0x7c39e4){const _0x17b015=a133_0xe8af3,_0x213b74=await this['client'][_0x17b015(0x1a7)](),_0x48f911=_0x213b74['filter'](_0x305acb=>_0x305acb['attributes'][_0x17b015(0x1c3)]===_0x7c39e4);if(_0x48f911[_0x17b015(0x212)]===0x0)throw new SDKError(ErrorCode[_0x17b015(0x13e)],_0x17b015(0x1dc)+_0x7c39e4,undefined,{'helpText':_0x17b015(0x203)});if(_0x48f911['length']>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x17b015(0x211)+_0x7c39e4+_0x17b015(0x1b2));return _0x48f911[0x0]['id'];}async['resolveProjectName'](_0x4142c9){const _0x547f81=a133_0xe8af3,_0x1ef30d=await this[_0x547f81(0x18a)][_0x547f81(0x1a7)](),_0x5169c6=_0x1ef30d[_0x547f81(0x1a2)](_0x264091=>_0x264091[_0x547f81(0x222)][_0x547f81(0x1c3)]===_0x4142c9);if(_0x5169c6)return{'projectId':_0x5169c6['id'],'project':_0x5169c6};throw new SDKError(ErrorCode[_0x547f81(0x13e)],_0x547f81(0x1dc)+_0x4142c9,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async[a133_0xe8af3(0x1cb)](_0x5eb7c7='claude-4.5-sonnet',_0x230f2b=0x0,_0x46832d){const _0x5528aa=a133_0xe8af3,_0x3fa0d3=0xa;let _0x60d5d5=0x0,_0x240c4d;while(_0x60d5d5<_0x3fa0d3){try{const _0x1629cc=await this['getOrCreateDefaultProject'](_0x240c4d),_0x467451=_0x1629cc['id'],_0x3315dc=[_0x5528aa(0x1db),_0x5528aa(0x241),_0x5528aa(0x13b),_0x5528aa(0x216),'high'],_0x38a6d0=_0x230f2b===0x0?_0x5528aa(0x224)+_0x5eb7c7:_0x5528aa(0x224)+_0x5eb7c7+_0x5528aa(0x139)+_0x3315dc[_0x230f2b],_0x3fc813=await this['client'][_0x5528aa(0x191)](_0x467451),_0x1f6584=_0x3fc813[_0x5528aa(0x1a2)](_0x268594=>_0x268594['attributes'][_0x5528aa(0x1c3)]===_0x38a6d0);if(_0x1f6584)return _0x1f6584;const _0x9ed5a9=_0x230f2b>0x0?0x1:_0x46832d;return await this[_0x5528aa(0x18a)][_0x5528aa(0x1fe)]({'name':_0x38a6d0,'projectId':_0x467451,'modelType':_0x5eb7c7,'systemPrompt':'','temperature':_0x9ed5a9,'reasoningEffort':_0x230f2b>0x0?_0x230f2b:undefined});}catch(_0x2d7ed3){if(_0x2d7ed3 instanceof HTTPClientError){const _0x22b175=_0x2d7ed3[_0x5528aa(0x1ac)];if(_0x22b175>=0x190&&_0x22b175<0x1f4){if(_0x22b175===0x191)throw new SDKError(ErrorCode[_0x5528aa(0x1a4)],'Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.',_0x2d7ed3);else{if(_0x22b175===0x193)throw new SDKError(ErrorCode['PERMISSION_DENIED'],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x2d7ed3);}throw _0x2d7ed3;}}if(errorContains(_0x2d7ed3,_0x5528aa(0x1fa),_0x5528aa(0x202),'conflict')){_0x60d5d5++;if(_0x60d5d5>=_0x3fa0d3)throw new SDKError(ErrorCode[_0x5528aa(0x15a)],'Unable\x20to\x20create\x20project\x20after\x20'+_0x3fa0d3+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x2d7ed3);const _0xe2a22d=this[_0x5528aa(0x1d2)]();_0x240c4d=_0xe2a22d+'_'+generateRandomHex();continue;}throw _0x2d7ed3;}}throw new SDKError(ErrorCode[_0x5528aa(0x1f1)],_0x5528aa(0x220));}async['resolveAgentId'](_0x3df2d8,_0x43d0f8){const _0x2bc73b=a133_0xe8af3,_0x17ea65=_0x43d0f8||this[_0x2bc73b(0x154)],_0xc270c3=await this[_0x2bc73b(0x18a)][_0x2bc73b(0x191)](_0x17ea65),_0xfc4f9=_0xc270c3[_0x2bc73b(0x146)](_0x2fd6bf=>_0x2fd6bf[_0x2bc73b(0x222)][_0x2bc73b(0x1c3)]===_0x3df2d8);if(_0xfc4f9[_0x2bc73b(0x212)]===0x0){const _0x35ebe8=_0x17ea65?_0x2bc73b(0x214)+_0x17ea65:'';throw new SDKError(ErrorCode[_0x2bc73b(0x16d)],'Agent\x20not\x20found:\x20'+_0x3df2d8+_0x35ebe8,undefined,{'helpText':_0x17ea65?_0x2bc73b(0x23e):_0x2bc73b(0x23d)});}if(_0xfc4f9[_0x2bc73b(0x212)]>0x1)throw new SDKError(ErrorCode[_0x2bc73b(0x1f1)],_0x2bc73b(0x1f7)+_0x3df2d8+_0x2bc73b(0x1b2));return _0xfc4f9[0x0]['id'];}async[a133_0xe8af3(0x1e7)](_0x430f9e){const _0x464acd=a133_0xe8af3,_0x1080d7=_0x430f9e||this[_0x464acd(0x154)];return await this[_0x464acd(0x18a)][_0x464acd(0x191)](_0x1080d7);}async[a133_0xe8af3(0x233)](_0x409b0c){const _0x2ba5d2=a133_0xe8af3;return await this[_0x2ba5d2(0x18a)][_0x2ba5d2(0x1d8)](_0x409b0c);}async['agent'](_0xad62b0){const _0x81dcfe=a133_0xe8af3;return await this[_0x81dcfe(0x18a)][_0x81dcfe(0x253)](_0xad62b0);}async[a133_0xe8af3(0x1fe)](_0x287702){const _0x13c812=a133_0xe8af3;return await this[_0x13c812(0x18a)][_0x13c812(0x1fe)](_0x287702);}async[a133_0xe8af3(0x200)](_0x53d616,_0x3cd11d){const _0x13e4ca=a133_0xe8af3;return await this[_0x13e4ca(0x18a)][_0x13e4ca(0x200)](_0x53d616,_0x3cd11d);}async['deleteAgent'](_0x6a739){const _0x47576a=a133_0xe8af3;await this['client'][_0x47576a(0x16e)](_0x6a739);}async[a133_0xe8af3(0x1b6)](_0x1a6e36){const _0x228924=a133_0xe8af3;return await this['client'][_0x228924(0x1b6)]({'agentId':_0x1a6e36});}async*[a133_0xe8af3(0x15f)](_0x2f1b35,_0xfcbc41){const _0x126f54=a133_0xe8af3;let _0x4c179b=_0xfcbc41?.[_0x126f54(0x257)];const _0x16e765=_0xfcbc41?.['agentId'];if(!_0x4c179b){if(!_0x16e765)throw new Error(_0x126f54(0x187));const _0x5830b5=await this[_0x126f54(0x18a)][_0x126f54(0x1b6)]({'agentId':_0x16e765});_0x4c179b=_0x5830b5['id'],yield{'type':_0x126f54(0x201),'data':{'chatId':_0x4c179b,'agentId':_0x16e765,'projectId':_0x5830b5[_0x126f54(0x222)]['projectId']}};}for await(const _0x347eb3 of this['client'][_0x126f54(0x20c)](_0x4c179b,_0x2f1b35,_0xfcbc41?.[_0x126f54(0x19c)])){yield{'type':_0x126f54(0x180),'data':_0x347eb3};}}async[a133_0xe8af3(0x161)](_0x9b7490=0x32){const _0x15100e=a133_0xe8af3;return await this[_0x15100e(0x18a)][_0x15100e(0x1ce)](_0x9b7490);}async[a133_0xe8af3(0x238)](_0x11aea4){const _0x5d6d85=a133_0xe8af3;return await this[_0x5d6d85(0x18a)]['getChatHistory'](_0x11aea4);}async[a133_0xe8af3(0x144)](_0x14a384){const _0x4cab3a=a133_0xe8af3;return await this[_0x4cab3a(0x18a)]['getChatLog'](_0x14a384);}async[a133_0xe8af3(0x1bd)](_0x1ff2b2){const _0x24977c=a133_0xe8af3;return await this[_0x24977c(0x18a)]['getChatInfo'](_0x1ff2b2);}async[a133_0xe8af3(0x1bf)](_0x1ff354,_0x535f15,_0x5c34d5){const _0x2f9ec3=a133_0xe8af3,_0x53ebab=_0x5c34d5?.[_0x2f9ec3(0x234)]??![],{projectId:_0x57ea87,project:_0x5096aa}=await this[_0x2f9ec3(0x14e)](_0x1ff354),_0x77e078=_0x5096aa['attributes'][_0x2f9ec3(0x1c3)],_0x439a43=_0x535f15||_0x77e078+_0x2f9ec3(0x1f8);if(a133_0x8c5550[_0x2f9ec3(0x229)](_0x439a43)&&!_0x53ebab)throw new SDKError(ErrorCode[_0x2f9ec3(0x15a)],_0x2f9ec3(0x1e2)+_0x439a43,undefined,{'helpText':_0x2f9ec3(0x17a)});const _0x1b0de8=await this['client'][_0x2f9ec3(0x1d8)](_0x57ea87),_0x30f314=await this['client'][_0x2f9ec3(0x183)](_0x57ea87),_0x2cc619=await this[_0x2f9ec3(0x18a)][_0x2f9ec3(0x21e)](_0x57ea87),_0x487b68=await this[_0x2f9ec3(0x18a)][_0x2f9ec3(0x1ba)](_0x57ea87);if(!_0x53ebab){a133_0x8c5550[_0x2f9ec3(0x1e4)](_0x439a43,{'recursive':!![]});const _0x5dcbc3={'version':'1.0','exportedAt':new Date()[_0x2f9ec3(0x231)](),'exportedFrom':{'site':this[_0x2f9ec3(0x197)]['site'],'projectId':_0x57ea87,'projectName':_0x77e078},'project':_0x5096aa};a133_0x8c5550[_0x2f9ec3(0x22f)](a133_0xcf5d58[_0x2f9ec3(0x1e6)](_0x439a43,_0x2f9ec3(0x155)),JSON[_0x2f9ec3(0x15e)](_0x5dcbc3,null,0x2)),a133_0x8c5550[_0x2f9ec3(0x22f)](a133_0xcf5d58['join'](_0x439a43,_0x2f9ec3(0x158)),JSON[_0x2f9ec3(0x15e)](_0x1b0de8,null,0x2)),a133_0x8c5550['writeFileSync'](a133_0xcf5d58[_0x2f9ec3(0x1e6)](_0x439a43,_0x2f9ec3(0x209)),JSON['stringify'](_0x30f314,null,0x2)),a133_0x8c5550['writeFileSync'](a133_0xcf5d58[_0x2f9ec3(0x1e6)](_0x439a43,_0x2f9ec3(0x148)),JSON[_0x2f9ec3(0x15e)](_0x2cc619,null,0x2)),a133_0x8c5550[_0x2f9ec3(0x22f)](a133_0xcf5d58[_0x2f9ec3(0x1e6)](_0x439a43,_0x2f9ec3(0x1f9)),JSON[_0x2f9ec3(0x15e)](_0x487b68,null,0x2));}return{'projectName':_0x77e078,'outputDir':_0x439a43,'counts':{'agents':_0x1b0de8[_0x2f9ec3(0x212)],'knowledgeBases':_0x30f314[_0x2f9ec3(0x212)],'prompts':_0x2cc619[_0x2f9ec3(0x212)],'integrations':_0x487b68[_0x2f9ec3(0x212)]}};}async[a133_0xe8af3(0x1fc)](_0x466508,_0x293051){const _0x417a58=a133_0xe8af3,_0x47c50d=_0x293051?.['dryRun']??![],_0x92acfb=this[_0x417a58(0x1d0)](_0x466508),_0x5aeda8=_0x92acfb[_0x417a58(0x172)][_0x417a58(0x1de)],_0x6af44a=this[_0x417a58(0x197)][_0x417a58(0x1de)],_0x4aaf23=_0x5aeda8!==_0x6af44a?_0x5aeda8:undefined,_0x5ec7b0=this[_0x417a58(0x22a)](a133_0xcf5d58[_0x417a58(0x1e6)](_0x466508,_0x417a58(0x158)),[]),_0x3db85f=this[_0x417a58(0x22a)](a133_0xcf5d58[_0x417a58(0x1e6)](_0x466508,_0x417a58(0x209)),[]),_0x35daa6=this[_0x417a58(0x22a)](a133_0xcf5d58['join'](_0x466508,_0x417a58(0x148)),[]),_0x3740b3=this[_0x417a58(0x22a)](a133_0xcf5d58[_0x417a58(0x1e6)](_0x466508,_0x417a58(0x1f9)),[]),_0x23910a=_0x293051?.[_0x417a58(0x1c3)]||_0x92acfb[_0x417a58(0x172)]['projectName'];if(_0x47c50d){const _0x5aefd7=new Map(),_0x340a5f=[..._0x5ec7b0],_0x3824e0=_0x5ec7b0['length']+0x1;let _0x196162=0x0;while(_0x340a5f[_0x417a58(0x212)]>0x0&&_0x196162<_0x3824e0){_0x196162++;const _0x4410af=[];for(const _0x13ae48 of _0x340a5f){canCreateAgent(_0x13ae48,_0x5aefd7)?_0x5aefd7['set'](_0x13ae48['id'],_0x417a58(0x160)+_0x13ae48['id']):_0x4410af[_0x417a58(0x1da)](_0x13ae48);}if(_0x4410af[_0x417a58(0x212)]===_0x340a5f[_0x417a58(0x212)])throw new SDKError(ErrorCode[_0x417a58(0x1f1)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x417a58(0x164)});_0x340a5f['length']=0x0,_0x340a5f[_0x417a58(0x1da)](..._0x4410af);}const _0x3be5da=_0x35daa6[_0x417a58(0x146)](_0x2c1964=>_0x5aefd7[_0x417a58(0x204)](_0x2c1964[_0x417a58(0x222)]['agentId']))['length'];return{'projectName':_0x23910a,'projectId':_0x417a58(0x1e9),'counts':{'agents':_0x5ec7b0['length'],'knowledgeBases':_0x3db85f['length'],'prompts':_0x3be5da,'integrations':_0x3740b3['length']},'sourceSite':_0x4aaf23};}const _0x22c18c=await this['client'][_0x417a58(0x235)]({'name':_0x23910a,'description':_0x92acfb[_0x417a58(0x163)]['attributes'][_0x417a58(0x1b4)]}),_0x29216b=_0x22c18c['id'],_0x8a2302=new Map(),_0x3dbf45=new Map(),_0x51a192=new Map();for(const _0x370a58 of _0x3db85f){const _0x5c6f86=await this[_0x417a58(0x18a)][_0x417a58(0x1f2)]({'projectId':_0x29216b,'name':_0x370a58[_0x417a58(0x222)][_0x417a58(0x1c3)],'tdDatabaseName':_0x370a58['attributes'][_0x417a58(0x1c0)],'tables':_0x370a58[_0x417a58(0x222)]['tables']});_0x8a2302['set'](_0x370a58['id'],_0x5c6f86['id']);}const _0x2dec0e=[..._0x5ec7b0],_0x5aaf50=_0x5ec7b0['length']+0x1;let _0x1136eb=0x0;while(_0x2dec0e['length']>0x0&&_0x1136eb<_0x5aaf50){_0x1136eb++;const _0x119ba3=[];for(const _0x46800d of _0x2dec0e){if(canCreateAgent(_0x46800d,_0x3dbf45)){const _0x3cbe0c=remapToolIds(_0x46800d[_0x417a58(0x222)][_0x417a58(0x188)],_0x8a2302,_0x3dbf45),_0x55f0f3=remapVariableIds(_0x46800d[_0x417a58(0x222)]['variables'],_0x8a2302),_0x5b2675=await this[_0x417a58(0x18a)][_0x417a58(0x1eb)]({'name':_0x46800d[_0x417a58(0x222)][_0x417a58(0x1c3)],'projectId':_0x29216b,'systemPrompt':_0x46800d[_0x417a58(0x222)][_0x417a58(0x16f)],'starterMessage':_0x46800d[_0x417a58(0x222)][_0x417a58(0x1ae)],'modelType':migrateModelType(_0x46800d[_0x417a58(0x222)]['modelType']),'maxToolIterations':_0x46800d[_0x417a58(0x222)][_0x417a58(0x1cf)],'temperature':_0x46800d[_0x417a58(0x222)]['temperature'],'reasoningEffort':_0x46800d[_0x417a58(0x222)]['reasoningEffort'],'outputs':_0x46800d[_0x417a58(0x222)][_0x417a58(0x195)],'tools':_0x3cbe0c,'variables':_0x55f0f3});_0x3dbf45[_0x417a58(0x199)](_0x46800d['id'],_0x5b2675['id']);}else _0x119ba3[_0x417a58(0x1da)](_0x46800d);}if(_0x119ba3[_0x417a58(0x212)]===_0x2dec0e['length'])throw new SDKError(ErrorCode[_0x417a58(0x1f1)],_0x417a58(0x1b0),undefined,{'helpText':_0x417a58(0x164)});_0x2dec0e['length']=0x0,_0x2dec0e[_0x417a58(0x1da)](..._0x119ba3);}for(const _0x2db6db of _0x35daa6){const _0x2eefb4=_0x3dbf45[_0x417a58(0x249)](_0x2db6db[_0x417a58(0x222)][_0x417a58(0x17d)]);if(!_0x2eefb4)continue;const _0x2a490f=await this[_0x417a58(0x18a)][_0x417a58(0x17e)]({'projectId':_0x29216b,'agentId':_0x2eefb4,'name':_0x2db6db[_0x417a58(0x222)][_0x417a58(0x1c3)],'systemPrompt':_0x2db6db[_0x417a58(0x222)][_0x417a58(0x16f)],'template':_0x2db6db[_0x417a58(0x222)][_0x417a58(0x170)],'jsonSchemaHint':_0x2db6db['attributes']['jsonSchemaHint']});_0x51a192[_0x417a58(0x199)](_0x2db6db['id'],_0x2a490f['id']);}for(const _0x3b09a8 of _0x3740b3){const _0x403399=_0x3b09a8[_0x417a58(0x222)][_0x417a58(0x24f)][_0x417a58(0x150)](_0x20f488=>({..._0x20f488,'promptId':_0x51a192['get'](_0x20f488['promptId'])||_0x20f488[_0x417a58(0x1d9)]}));await this['client'][_0x417a58(0x25b)]({'projectId':_0x29216b,'serviceType':_0x3b09a8[_0x417a58(0x222)][_0x417a58(0x254)],'actions':_0x403399,'slackMessageMode':_0x3b09a8['attributes'][_0x417a58(0x17f)],'chatIgnoreManagedActions':_0x3b09a8[_0x417a58(0x222)][_0x417a58(0x192)],'chatWelcomeMessage':_0x3b09a8[_0x417a58(0x222)]['chatWelcomeMessage'],'webhookCorsOrigins':_0x3b09a8['attributes']['webhookCorsOrigins']});}return{'projectName':_0x23910a,'projectId':_0x29216b,'counts':{'agents':_0x3dbf45[_0x417a58(0x14d)],'knowledgeBases':_0x8a2302[_0x417a58(0x14d)],'prompts':_0x51a192['size'],'integrations':_0x3740b3[_0x417a58(0x212)]},'sourceSite':_0x4aaf23};}['loadJsonFile'](_0x1225e0,_0x4d8348){const _0x8fcaf=a133_0xe8af3;if(!a133_0x8c5550[_0x8fcaf(0x229)](_0x1225e0))return _0x4d8348;return JSON['parse'](a133_0x8c5550['readFileSync'](_0x1225e0,_0x8fcaf(0x189)));}[a133_0xe8af3(0x1d0)](_0x2efd2f){const _0x3945d8=a133_0xe8af3;if(!a133_0x8c5550[_0x3945d8(0x229)](_0x2efd2f))throw new SDKError(ErrorCode[_0x3945d8(0x149)],_0x3945d8(0x21b)+_0x2efd2f,undefined,{'helpText':_0x3945d8(0x159)});const _0x38a5fa=a133_0xcf5d58[_0x3945d8(0x1e6)](_0x2efd2f,_0x3945d8(0x155));if(!a133_0x8c5550[_0x3945d8(0x229)](_0x38a5fa))throw new SDKError(ErrorCode[_0x3945d8(0x22e)],'Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20'+_0x2efd2f,undefined,{'helpText':_0x3945d8(0x1e5)});const _0x5745b6=JSON[_0x3945d8(0x240)](a133_0x8c5550['readFileSync'](_0x38a5fa,_0x3945d8(0x189)));if(!isSupportedBackupVersion(_0x5745b6[_0x3945d8(0x190)]))throw new SDKError(ErrorCode[_0x3945d8(0x22e)],_0x3945d8(0x186)+_0x5745b6[_0x3945d8(0x190)],undefined,{'helpText':_0x3945d8(0x255)});return _0x5745b6;}async[a133_0xe8af3(0x258)](_0x53fbda,_0x438e00,_0x3fc515){const _0x196854=a133_0xe8af3,{projectId:_0x522fee,project:_0x9621db}=await this[_0x196854(0x14e)](_0x53fbda),_0x5338c2=_0x9621db[_0x196854(0x222)][_0x196854(0x1c3)];let _0x1f5970;if(_0x438e00)_0x1f5970=_0x438e00;else{const _0x20192b=a133_0xcf5d58[_0x196854(0x1e6)](process[_0x196854(0x15d)](),'agents'),_0x4cf9a6=getSanitizedPathWithMigration(_0x20192b,_0x5338c2);_0x4cf9a6['renamed']&&this[_0x196854(0x157)][_0x196854(0x1ed)]('Renamed\x20folder:\x20'+a133_0xcf5d58['basename'](_0x4cf9a6['oldPath'])+'\x20→\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x4cf9a6['path'])),_0x1f5970=_0x4cf9a6['path'];}const _0x7c53d4=await this['client']['listAgentsFull'](_0x522fee),_0x596646=await this[_0x196854(0x18a)]['listKnowledgeBases'](_0x522fee),_0x5dfb06=await this['client'][_0x196854(0x239)](_0x522fee),_0x5bcfc6=await safeListOrEmpty(()=>this[_0x196854(0x18a)][_0x196854(0x19b)](_0x522fee)),_0x52a214=await safeListOrEmpty(()=>this[_0x196854(0x18a)]['listWebSearchTools'](_0x522fee)),_0x5ebac2=await this[_0x196854(0x18a)][_0x196854(0x21e)](_0x522fee),_0x282a1a=await this[_0x196854(0x18a)][_0x196854(0x1ba)](_0x522fee),_0x242497=await safeListOrEmpty(()=>this[_0x196854(0x18a)][_0x196854(0x1a0)](_0x522fee)),_0x19b5f8=await safeListOrEmpty(()=>this[_0x196854(0x18a)]['listExperimentalArtifacts'](_0x522fee)),_0x2f8851=await safeListOrEmpty(()=>this['client'][_0x196854(0x142)](_0x522fee)),_0x2ad0db=await safeListOrEmpty(()=>this['client']['listChatInterfaces'](_0x522fee)),_0x5cc8a7=_0x282a1a[_0x196854(0x146)](_0x2e7112=>!_0x2e7112['attributes'][_0x196854(0x18b)]&&SAFE_INTEGRATION_TYPES[_0x196854(0x16a)](_0x2e7112[_0x196854(0x222)]['serviceType'][_0x196854(0x153)]())),_0x49ab34=new Map(),_0x2bcb53=new Map(),_0x424139=new Map(),_0x55cd8b=new Map(),_0x194dea=new Map(),_0x52a268=new Map(),_0x11d134=new Map();for(const _0x35e963 of _0x7c53d4){_0x49ab34[_0x196854(0x199)](_0x35e963['id'],_0x35e963[_0x196854(0x222)][_0x196854(0x1c3)]);}for(const _0x5b1d8b of _0x596646){_0x2bcb53[_0x196854(0x199)](_0x5b1d8b['id'],_0x5b1d8b['attributes'][_0x196854(0x1c3)]);}for(const _0x43ec74 of _0x5dfb06){_0x424139[_0x196854(0x199)](_0x43ec74['id'],_0x43ec74[_0x196854(0x222)][_0x196854(0x1c3)]);}for(const _0x37d8bd of _0x5bcfc6){_0x55cd8b['set'](_0x37d8bd['id'],_0x37d8bd[_0x196854(0x222)][_0x196854(0x1c3)]);}for(const _0x41d72 of _0x52a214){_0x194dea[_0x196854(0x199)](_0x41d72['id'],_0x41d72[_0x196854(0x222)][_0x196854(0x1c3)]);}for(const _0x2867b4 of _0x5ebac2){_0x52a268['set'](_0x2867b4['id'],_0x2867b4[_0x196854(0x222)]['name']);}for(const _0x552c23 of _0x242497){_0x11d134[_0x196854(0x199)](_0x552c23['id'],_0x552c23[_0x196854(0x222)][_0x196854(0x1c3)]);}const _0x14d5d5={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x2bcb53,'TextKnowledgeBase':_0x424139,'Agent':_0x49ab34,'WebSearchTool':_0x194dea,'ImageGenerator':_0x55cd8b,'ExperimentalKnowledgeBase':_0x11d134}),'resolvePromptName':async _0xecc55f=>_0x52a268[_0x196854(0x249)](_0xecc55f),'onWarning':_0x3c96ae=>this[_0x196854(0x157)][_0x196854(0x14b)](_0x3c96ae)},_0x25e5dd={'projectName':_0x5338c2,'outputDir':_0x1f5970,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'knowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'textKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'prompts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'integrations':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalArtifacts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'formInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'chatInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0x38a668=[],_0x18832a=[];for(const _0xd9d19 of _0x7c53d4){const _0x487e92=getSanitizedPathWithMigration(_0x1f5970,_0xd9d19[_0x196854(0x222)][_0x196854(0x1c3)]);_0x487e92[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)]('Renamed\x20agent\x20folder:\x20'+a133_0xcf5d58['basename'](_0x487e92[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58['basename'](_0x487e92[_0x196854(0x25d)]));const _0x47e94b=_0x487e92['path'],_0x54dec1=a133_0xcf5d58[_0x196854(0x1e6)](_0x47e94b,'prompt.md'),_0x195b7f=a133_0xcf5d58[_0x196854(0x1e6)](_0x47e94b,'agent.yml'),_0x3c0099=a133_0xcf5d58[_0x196854(0x1e6)](_0x47e94b,_0x196854(0x1fd)),{yaml:_0x454df0,systemPrompt:_0x3c4122,starterMessage:_0x5a32f4}=await agentResponseToDef(_0xd9d19,_0x14d5d5),_0x399c1d=toAgentYamlString(_0x454df0),_0x5be526=!a133_0x8c5550[_0x196854(0x229)](_0x195b7f);let _0x533ac8=_0x5be526,_0x55054b;if(!_0x5be526){const _0x29b56b=a133_0x8c5550[_0x196854(0x229)](_0x54dec1)?a133_0x8c5550[_0x196854(0x1b1)](_0x54dec1,'utf-8'):'',_0x11c0f8=a133_0x8c5550['readFileSync'](_0x195b7f,_0x196854(0x189)),_0x36e5e0='#\x20prompt.md\x0a'+_0x29b56b+_0x196854(0x1e0)+_0x11c0f8,_0x2513af=_0x196854(0x18d)+_0x3c4122+_0x196854(0x1e0)+_0x399c1d,_0x3052ae=generateDiff(_0x36e5e0,_0x2513af);_0x533ac8=hasChanges(_0x3052ae),_0x533ac8&&(_0x55054b=formatDiffWithColors(_0x3052ae));}_0x38a668[_0x196854(0x1da)]({'path':_0x47e94b,'content':'','isDir':!![]}),_0x38a668[_0x196854(0x1da)]({'path':_0x54dec1,'content':_0x3c4122}),_0x38a668[_0x196854(0x1da)]({'path':_0x195b7f,'content':_0x399c1d});_0x5a32f4&&_0x5a32f4[_0x196854(0x16a)]('\x0a')&&_0x38a668[_0x196854(0x1da)]({'path':_0x3c0099,'content':_0x5a32f4});_0x25e5dd[_0x196854(0x1e7)]['push']({'agentName':_0xd9d19[_0x196854(0x222)]['name'],'outputPath':_0x47e94b,'isNew':_0x5be526,'hasChanges':_0x533ac8,'diff':_0x55054b}),_0x25e5dd['counts']['agents'][_0x196854(0x1ea)]++;if(_0x5be526)_0x25e5dd['counts'][_0x196854(0x1e7)]['new']++;else{if(_0x533ac8)_0x25e5dd['counts']['agents'][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)]['agents'][_0x196854(0x1ff)]++;}}for(const _0x439210 of _0x596646){if(_0x439210[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x47cc09=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x1f5970),_0x439210[_0x196854(0x222)][_0x196854(0x1c3)],_0x196854(0x218));_0x47cc09[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)]('Renamed\x20KB\x20file:\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x47cc09[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58['basename'](_0x47cc09[_0x196854(0x25d)]));const _0x44cc57=_0x47cc09['path'],_0x48e1a2=apiKnowledgeBaseToYaml(_0x439210),_0x9ba083=toKnowledgeBaseYamlString(_0x48e1a2),_0x16d41d=!a133_0x8c5550[_0x196854(0x229)](_0x44cc57);let _0xa6b42f=_0x16d41d,_0x23be03;if(!_0x16d41d){const _0xd66e0=a133_0x8c5550['readFileSync'](_0x44cc57,_0x196854(0x189)),_0x219aed=generateDiff(_0xd66e0,_0x9ba083);_0xa6b42f=hasChanges(_0x219aed),_0xa6b42f&&(_0x23be03=formatDiffWithColors(_0x219aed));}_0x38a668['push']({'path':_0x44cc57,'content':_0x9ba083}),_0x25e5dd[_0x196854(0x252)][_0x196854(0x1da)]({'name':_0x439210[_0x196854(0x222)][_0x196854(0x1c3)],'outputPath':_0x44cc57,'isNew':_0x16d41d,'hasChanges':_0xa6b42f,'diff':_0x23be03}),_0x25e5dd['counts'][_0x196854(0x252)]['total']++;if(_0x16d41d)_0x25e5dd[_0x196854(0x207)][_0x196854(0x252)][_0x196854(0x1f6)]++;else{if(_0xa6b42f)_0x25e5dd[_0x196854(0x207)][_0x196854(0x252)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)]['knowledgeBases'][_0x196854(0x1ff)]++;}}for(const _0x4357c7 of _0x5dfb06){if(_0x4357c7[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x13a371=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x1f5970),_0x4357c7[_0x196854(0x222)][_0x196854(0x1c3)],_0x196854(0x1fb));_0x13a371[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)]('Renamed\x20text\x20KB\x20file:\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x13a371[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58[_0x196854(0x1c8)](_0x13a371[_0x196854(0x25d)]));const _0xafa196=_0x13a371['path'],_0x18ecd9=toTextKnowledgeBaseMd(_0x4357c7['attributes'][_0x196854(0x1c3)],_0x4357c7[_0x196854(0x222)][_0x196854(0x248)]),_0x52ef99=!a133_0x8c5550[_0x196854(0x229)](_0xafa196);let _0x356da8=_0x52ef99,_0x21beb6;if(!_0x52ef99){const _0x11edc3=a133_0x8c5550[_0x196854(0x1b1)](_0xafa196,_0x196854(0x189)),_0x22b584=generateDiff(_0x11edc3,_0x18ecd9);_0x356da8=hasChanges(_0x22b584),_0x356da8&&(_0x21beb6=formatDiffWithColors(_0x22b584));}_0x38a668[_0x196854(0x1da)]({'path':_0xafa196,'content':_0x18ecd9}),_0x25e5dd[_0x196854(0x1a9)][_0x196854(0x1da)]({'name':_0x4357c7['attributes'][_0x196854(0x1c3)],'outputPath':_0xafa196,'isNew':_0x52ef99,'hasChanges':_0x356da8,'diff':_0x21beb6}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x1a9)][_0x196854(0x1ea)]++;if(_0x52ef99)_0x25e5dd[_0x196854(0x207)][_0x196854(0x1a9)]['new']++;else{if(_0x356da8)_0x25e5dd['counts']['textKnowledgeBases'][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)][_0x196854(0x1a9)][_0x196854(0x1ff)]++;}}for(const _0x410a75 of _0x5ebac2){if(_0x410a75[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x447688=getSanitizedPathWithMigration(getPromptsDir(_0x1f5970),_0x410a75[_0x196854(0x222)]['name'],_0x196854(0x218));_0x447688['renamed']&&this[_0x196854(0x157)][_0x196854(0x1ed)](_0x196854(0x184)+a133_0xcf5d58[_0x196854(0x1c8)](_0x447688['oldPath'])+_0x196854(0x1e3)+a133_0xcf5d58['basename'](_0x447688[_0x196854(0x25d)]));const _0x14151a=_0x447688['path'],_0xbc0aa0=await apiPromptToYaml(_0x410a75,_0x14d5d5);if(!_0xbc0aa0)continue;const _0x35c1ea=toPromptYamlString(_0xbc0aa0),_0x6c8e8f=!a133_0x8c5550[_0x196854(0x229)](_0x14151a);let _0x3c8d69=_0x6c8e8f,_0x15deab;if(!_0x6c8e8f){const _0x1d9f40=a133_0x8c5550[_0x196854(0x1b1)](_0x14151a,'utf-8'),_0x5b34c5=generateDiff(_0x1d9f40,_0x35c1ea);_0x3c8d69=hasChanges(_0x5b34c5),_0x3c8d69&&(_0x15deab=formatDiffWithColors(_0x5b34c5));}_0x38a668['push']({'path':_0x14151a,'content':_0x35c1ea}),_0x25e5dd['prompts'][_0x196854(0x1da)]({'name':_0x410a75[_0x196854(0x222)][_0x196854(0x1c3)],'outputPath':_0x14151a,'isNew':_0x6c8e8f,'hasChanges':_0x3c8d69,'diff':_0x15deab}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x236)][_0x196854(0x1ea)]++;if(_0x6c8e8f)_0x25e5dd['counts']['prompts']['new']++;else{if(_0x3c8d69)_0x25e5dd[_0x196854(0x207)][_0x196854(0x236)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)]['prompts'][_0x196854(0x1ff)]++;}}for(const _0x30a5c4 of _0x5cc8a7){const _0x5b7bd9=_0x30a5c4[_0x196854(0x222)][_0x196854(0x254)][_0x196854(0x153)](),_0x40928e=getSanitizedPathWithMigration(getIntegrationsDir(_0x1f5970),_0x5b7bd9,_0x196854(0x218));_0x40928e['renamed']&&this[_0x196854(0x157)]['info']('Renamed\x20integration\x20file:\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x40928e[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58[_0x196854(0x1c8)](_0x40928e[_0x196854(0x25d)]));const _0x11d526=_0x40928e['path'],_0x3cfd46=await apiIntegrationToYaml(_0x30a5c4,_0x14d5d5),_0xedef54=toIntegrationYamlString(_0x3cfd46),_0x276093=!a133_0x8c5550[_0x196854(0x229)](_0x11d526);let _0x1fe2ec=_0x276093,_0x5df350;if(!_0x276093){const _0x3193f2=a133_0x8c5550[_0x196854(0x1b1)](_0x11d526,_0x196854(0x189)),_0x4aea39=generateDiff(_0x3193f2,_0xedef54);_0x1fe2ec=hasChanges(_0x4aea39),_0x1fe2ec&&(_0x5df350=formatDiffWithColors(_0x4aea39));}_0x38a668['push']({'path':_0x11d526,'content':_0xedef54}),_0x25e5dd[_0x196854(0x25a)]['push']({'name':_0x5b7bd9,'outputPath':_0x11d526,'isNew':_0x276093,'hasChanges':_0x1fe2ec,'diff':_0x5df350}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x25a)]['total']++;if(_0x276093)_0x25e5dd[_0x196854(0x207)][_0x196854(0x25a)][_0x196854(0x1f6)]++;else{if(_0x1fe2ec)_0x25e5dd[_0x196854(0x207)][_0x196854(0x25a)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)][_0x196854(0x25a)][_0x196854(0x1ff)]++;}}for(const _0x48efc9 of _0x242497){if(_0x48efc9[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x4f3eed=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x1f5970),_0x48efc9[_0x196854(0x222)][_0x196854(0x1c3)]);_0x4f3eed[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)]('Renamed\x20experimental\x20KB\x20directory:\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x4f3eed[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58[_0x196854(0x1c8)](_0x4f3eed['path']));const _0x50cf1c=_0x4f3eed[_0x196854(0x25d)],_0x16ca9d=a133_0xcf5d58[_0x196854(0x1e6)](_0x50cf1c,sanitizeForFilesystem(_0x48efc9[_0x196854(0x222)]['name'])+_0x196854(0x218)),_0x11bcec=a133_0xcf5d58['join'](_0x50cf1c,_0x196854(0x1b8)),_0xfc0eeb=apiExperimentalKnowledgeBaseToYaml(_0x48efc9),_0x5128d1=toExperimentalKnowledgeBaseYamlString(_0xfc0eeb),_0xb778bd=!a133_0x8c5550['existsSync'](_0x50cf1c);let _0x354a2c=_0xb778bd,_0x3a5787,_0x5c153a=_0x5128d1;const _0x5a0a58=[..._0xfc0eeb[_0x196854(0x1b8)]][_0x196854(0x23a)]((_0x45a9df,_0x1e918b)=>_0x45a9df['name'][_0x196854(0x1f5)](_0x1e918b['name']));for(const _0x56c77c of _0x5a0a58){_0x5c153a+=_0x196854(0x16c)+_0x56c77c['name']+'\x20---\x0a'+_0x56c77c['code']+_0x196854(0x147)+_0x56c77c['name']+'\x20---\x0a'+_0x56c77c[_0x196854(0x20e)]+'\x0a';}if(!_0xb778bd){let _0x2f2b50='';a133_0x8c5550[_0x196854(0x229)](_0x16ca9d)&&(_0x2f2b50=a133_0x8c5550['readFileSync'](_0x16ca9d,'utf-8'));if(a133_0x8c5550[_0x196854(0x229)](_0x11bcec)){const _0x4ae141=a133_0x8c5550[_0x196854(0x1ee)](_0x11bcec,{'withFileTypes':!![]}),_0x163307=_0x4ae141[_0x196854(0x146)](_0x574ce2=>_0x574ce2[_0x196854(0x24c)]())[_0x196854(0x23a)]((_0x3f679b,_0x4162d2)=>_0x3f679b[_0x196854(0x1c3)][_0x196854(0x1f5)](_0x4162d2[_0x196854(0x1c3)]));for(const _0x4d87e3 of _0x163307){const _0x22620e=a133_0xcf5d58[_0x196854(0x1e6)](_0x11bcec,_0x4d87e3[_0x196854(0x1c3)],'code.js'),_0x526d89=a133_0xcf5d58[_0x196854(0x1e6)](_0x11bcec,_0x4d87e3['name'],_0x196854(0x145));a133_0x8c5550[_0x196854(0x229)](_0x22620e)&&(_0x2f2b50+=_0x196854(0x16c)+_0x4d87e3[_0x196854(0x1c3)]+_0x196854(0x1b5)+a133_0x8c5550['readFileSync'](_0x22620e,'utf-8')+'\x0a'),a133_0x8c5550[_0x196854(0x229)](_0x526d89)&&(_0x2f2b50+=_0x196854(0x16b)+_0x4d87e3[_0x196854(0x1c3)]+'\x20---\x0a'+a133_0x8c5550['readFileSync'](_0x526d89,_0x196854(0x189))+'\x0a');}}const _0xe9dc14=generateDiff(_0x2f2b50,_0x5c153a);_0x354a2c=hasChanges(_0xe9dc14),_0x354a2c&&(_0x3a5787=formatDiffWithColors(_0xe9dc14));}_0x38a668[_0x196854(0x1da)]({'path':_0x50cf1c,'content':'','isDir':!![]}),_0x38a668['push']({'path':_0x16ca9d,'content':_0x5128d1}),_0x38a668[_0x196854(0x1da)]({'path':_0x11bcec,'content':'','isDir':!![]});for(const _0x4bf828 of _0xfc0eeb['functions']){const _0x2e3a59=a133_0xcf5d58[_0x196854(0x1e6)](_0x11bcec,sanitizeForFilesystem(_0x4bf828[_0x196854(0x1c3)])),_0x19d9d2=a133_0xcf5d58[_0x196854(0x1e6)](_0x2e3a59,_0x196854(0x20a)),_0x376f92=a133_0xcf5d58[_0x196854(0x1e6)](_0x2e3a59,_0x196854(0x145));_0x38a668[_0x196854(0x1da)]({'path':_0x2e3a59,'content':'','isDir':!![]}),_0x38a668[_0x196854(0x1da)]({'path':_0x19d9d2,'content':_0x4bf828[_0x196854(0x225)]}),_0x38a668[_0x196854(0x1da)]({'path':_0x376f92,'content':_0x4bf828['json_schema']});}if(a133_0x8c5550['existsSync'](_0x11bcec)){const _0x20c807=a133_0x8c5550[_0x196854(0x1ee)](_0x11bcec,{'withFileTypes':!![]}),_0x3aeba1=new Set(_0xfc0eeb['functions'][_0x196854(0x150)](_0x1e58a8=>sanitizeForFilesystem(_0x1e58a8[_0x196854(0x1c3)])));for(const _0x17ec98 of _0x20c807){if(_0x17ec98[_0x196854(0x24c)]()&&!_0x3aeba1[_0x196854(0x204)](_0x17ec98[_0x196854(0x1c3)])){const _0x17f839=a133_0xcf5d58['join'](_0x11bcec,_0x17ec98[_0x196854(0x1c3)]);_0x18832a[_0x196854(0x1da)]({'path':_0x17f839,'isDir':!![]});}}}_0x25e5dd[_0x196854(0x217)][_0x196854(0x1da)]({'name':_0x48efc9[_0x196854(0x222)][_0x196854(0x1c3)],'outputPath':_0x50cf1c,'isNew':_0xb778bd,'hasChanges':_0x354a2c,'diff':_0x3a5787}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x217)][_0x196854(0x1ea)]++;if(_0xb778bd)_0x25e5dd[_0x196854(0x207)][_0x196854(0x217)][_0x196854(0x1f6)]++;else{if(_0x354a2c)_0x25e5dd[_0x196854(0x207)][_0x196854(0x217)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)][_0x196854(0x217)][_0x196854(0x1ff)]++;}}for(const _0x4212fc of _0x19b5f8){if(_0x4212fc[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x9fdadc=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x1f5970),_0x4212fc[_0x196854(0x222)]['name']);_0x9fdadc['renamed']&&this['logger'][_0x196854(0x1ed)](_0x196854(0x169)+a133_0xcf5d58['basename'](_0x9fdadc[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58[_0x196854(0x1c8)](_0x9fdadc[_0x196854(0x25d)]));const _0x1f67ae=_0x9fdadc['path'],_0x34175c=a133_0xcf5d58[_0x196854(0x1e6)](_0x1f67ae,sanitizeForFilesystem(_0x4212fc[_0x196854(0x222)][_0x196854(0x1c3)])+_0x196854(0x218)),_0x1c3c3e=a133_0xcf5d58[_0x196854(0x1e6)](_0x1f67ae,'code.js'),_0x5c97e5=a133_0xcf5d58[_0x196854(0x1e6)](_0x1f67ae,_0x196854(0x1d1)),_0x48a468=apiExperimentalArtifactToYaml(_0x4212fc),_0x380e48=toExperimentalArtifactYamlString(_0x48a468),_0x130f16=!a133_0x8c5550[_0x196854(0x229)](_0x1f67ae);let _0x57530f=_0x130f16,_0x23fd40,_0x5b8bda=_0x380e48+('\x0a---\x20code\x20---\x0a'+_0x48a468['code']+'\x0a');const _0x56ce45=[..._0x48a468[_0x196854(0x1d1)]][_0x196854(0x23a)]((_0x216617,_0x3b88e1)=>_0x216617[_0x196854(0x1c7)][_0x196854(0x1f5)](_0x3b88e1[_0x196854(0x1c7)]));for(const _0x1c5ca7 of _0x56ce45){_0x5b8bda+=_0x196854(0x151)+_0x1c5ca7[_0x196854(0x1c7)]+'\x20---\x0a'+_0x1c5ca7['text_content']+'\x0a';}if(!_0x130f16){let _0x299a43='';a133_0x8c5550['existsSync'](_0x34175c)&&(_0x299a43=a133_0x8c5550[_0x196854(0x1b1)](_0x34175c,'utf-8'));a133_0x8c5550[_0x196854(0x229)](_0x1c3c3e)&&(_0x299a43+=_0x196854(0x245)+a133_0x8c5550['readFileSync'](_0x1c3c3e,_0x196854(0x189))+'\x0a');if(a133_0x8c5550[_0x196854(0x229)](_0x5c97e5)){const _0x204a66=a133_0x8c5550[_0x196854(0x1ee)](_0x5c97e5),_0x12288e=_0x204a66[_0x196854(0x146)](_0x4dd730=>{const _0x373cbc=_0x196854,_0x3205ff=a133_0xcf5d58[_0x373cbc(0x1e6)](_0x5c97e5,_0x4dd730);return a133_0x8c5550[_0x373cbc(0x1dd)](_0x3205ff)[_0x373cbc(0x166)]();})[_0x196854(0x23a)]((_0x4ca103,_0x358518)=>_0x4ca103[_0x196854(0x1f5)](_0x358518));for(const _0x5bec9e of _0x12288e){const _0x158016=a133_0xcf5d58[_0x196854(0x1e6)](_0x5c97e5,_0x5bec9e);_0x299a43+=_0x196854(0x151)+_0x5bec9e+_0x196854(0x1b5)+a133_0x8c5550[_0x196854(0x1b1)](_0x158016,_0x196854(0x189))+'\x0a';}}const _0x512723=generateDiff(_0x299a43,_0x5b8bda);_0x57530f=hasChanges(_0x512723),_0x57530f&&(_0x23fd40=formatDiffWithColors(_0x512723));}_0x38a668[_0x196854(0x1da)]({'path':_0x1f67ae,'content':'','isDir':!![]}),_0x38a668[_0x196854(0x1da)]({'path':_0x34175c,'content':_0x380e48}),_0x38a668[_0x196854(0x1da)]({'path':_0x1c3c3e,'content':_0x48a468[_0x196854(0x225)]});if(_0x48a468[_0x196854(0x1d1)][_0x196854(0x212)]>0x0){_0x38a668[_0x196854(0x1da)]({'path':_0x5c97e5,'content':'','isDir':!![]});for(const _0x4a1e48 of _0x48a468[_0x196854(0x1d1)]){const _0x4ea1a4=a133_0xcf5d58[_0x196854(0x1e6)](_0x5c97e5,_0x4a1e48[_0x196854(0x1c7)]);_0x38a668[_0x196854(0x1da)]({'path':_0x4ea1a4,'content':_0x4a1e48[_0x196854(0x208)]});}}if(a133_0x8c5550[_0x196854(0x229)](_0x5c97e5)){const _0x2d46ce=a133_0x8c5550[_0x196854(0x1ee)](_0x5c97e5),_0x1cda98=new Set(_0x48a468[_0x196854(0x1d1)][_0x196854(0x150)](_0x2e0674=>_0x2e0674['file_name']));for(const _0x539f84 of _0x2d46ce){const _0x3ff999=a133_0xcf5d58['join'](_0x5c97e5,_0x539f84);a133_0x8c5550[_0x196854(0x1dd)](_0x3ff999)['isFile']()&&!_0x1cda98['has'](_0x539f84)&&_0x18832a['push']({'path':_0x3ff999});}}_0x25e5dd[_0x196854(0x1b3)][_0x196854(0x1da)]({'name':_0x4212fc['attributes'][_0x196854(0x1c3)],'outputPath':_0x1f67ae,'isNew':_0x130f16,'hasChanges':_0x57530f,'diff':_0x23fd40}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x1b3)]['total']++;if(_0x130f16)_0x25e5dd['counts'][_0x196854(0x1b3)]['new']++;else{if(_0x57530f)_0x25e5dd[_0x196854(0x207)][_0x196854(0x1b3)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)][_0x196854(0x1b3)][_0x196854(0x1ff)]++;}}for(const _0x4194c9 of _0x2f8851){const _0x40ca1d=getSanitizedPathWithMigration(getFormInterfacesDir(_0x1f5970),_0x4194c9[_0x196854(0x222)][_0x196854(0x1c3)],_0x196854(0x218));_0x40ca1d[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)](_0x196854(0x19d)+a133_0xcf5d58[_0x196854(0x1c8)](_0x40ca1d[_0x196854(0x251)])+_0x196854(0x1e3)+a133_0xcf5d58['basename'](_0x40ca1d[_0x196854(0x25d)]));const _0x568ed7=_0x40ca1d[_0x196854(0x25d)],_0x55be96=await apiFormInterfaceToYaml(_0x4194c9,_0x14d5d5),_0x382fcf=toFormInterfaceYamlString(_0x55be96),_0x482a16=!a133_0x8c5550[_0x196854(0x229)](_0x568ed7);let _0x39c4fd=_0x482a16,_0x4ee646;if(!_0x482a16){const _0x4a42e4=a133_0x8c5550[_0x196854(0x1b1)](_0x568ed7,_0x196854(0x189)),_0x17f3cd=generateDiff(_0x4a42e4,_0x382fcf);_0x39c4fd=hasChanges(_0x17f3cd),_0x39c4fd&&(_0x4ee646=formatDiffWithColors(_0x17f3cd));}_0x38a668[_0x196854(0x1da)]({'path':_0x568ed7,'content':_0x382fcf}),_0x25e5dd[_0x196854(0x178)][_0x196854(0x1da)]({'name':_0x4194c9['attributes'][_0x196854(0x1c3)],'outputPath':_0x568ed7,'isNew':_0x482a16,'hasChanges':_0x39c4fd,'diff':_0x4ee646}),_0x25e5dd[_0x196854(0x207)]['formInterfaces'][_0x196854(0x1ea)]++;if(_0x482a16)_0x25e5dd[_0x196854(0x207)][_0x196854(0x178)][_0x196854(0x1f6)]++;else{if(_0x39c4fd)_0x25e5dd[_0x196854(0x207)][_0x196854(0x178)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)][_0x196854(0x178)][_0x196854(0x1ff)]++;}}for(const _0x2338ae of _0x2ad0db){if(_0x2338ae[_0x196854(0x222)][_0x196854(0x18b)])continue;const _0x1eca7f=getSanitizedPathWithMigration(getChatInterfacesDir(_0x1f5970),_0x2338ae['attributes'][_0x196854(0x1c3)],_0x196854(0x218));_0x1eca7f[_0x196854(0x1d7)]&&this[_0x196854(0x157)][_0x196854(0x1ed)](_0x196854(0x165)+a133_0xcf5d58[_0x196854(0x1c8)](_0x1eca7f[_0x196854(0x251)])+'\x20→\x20'+a133_0xcf5d58[_0x196854(0x1c8)](_0x1eca7f[_0x196854(0x25d)]));const _0x40af0c=_0x1eca7f[_0x196854(0x25d)],_0x619084=await apiChatInterfaceToYaml(_0x2338ae,_0x14d5d5),_0x4ce3d0=toChatInterfaceYamlString(_0x619084),_0x2148c6=!a133_0x8c5550[_0x196854(0x229)](_0x40af0c);let _0x538b62=_0x2148c6,_0x2d932a;if(!_0x2148c6){const _0x146d28=a133_0x8c5550[_0x196854(0x1b1)](_0x40af0c,'utf-8'),_0x58b91c=generateDiff(_0x146d28,_0x4ce3d0);_0x538b62=hasChanges(_0x58b91c),_0x538b62&&(_0x2d932a=formatDiffWithColors(_0x58b91c));}_0x38a668['push']({'path':_0x40af0c,'content':_0x4ce3d0}),_0x25e5dd[_0x196854(0x247)][_0x196854(0x1da)]({'name':_0x2338ae[_0x196854(0x222)][_0x196854(0x1c3)],'outputPath':_0x40af0c,'isNew':_0x2148c6,'hasChanges':_0x538b62,'diff':_0x2d932a}),_0x25e5dd[_0x196854(0x207)][_0x196854(0x247)][_0x196854(0x1ea)]++;if(_0x2148c6)_0x25e5dd[_0x196854(0x207)]['chatInterfaces'][_0x196854(0x1f6)]++;else{if(_0x538b62)_0x25e5dd[_0x196854(0x207)][_0x196854(0x247)][_0x196854(0x1be)]++;else _0x25e5dd[_0x196854(0x207)]['chatInterfaces'][_0x196854(0x1ff)]++;}}if(_0x3fc515?.[_0x196854(0x234)])return _0x25e5dd;a133_0x8c5550[_0x196854(0x1e4)](_0x1f5970,{'recursive':!![]}),a133_0x8c5550['mkdirSync'](getKnowledgeBasesDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550[_0x196854(0x1e4)](getPromptsDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550[_0x196854(0x1e4)](getIntegrationsDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550[_0x196854(0x1e4)](getExperimentalKnowledgeBasesDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550['mkdirSync'](getExperimentalArtifactsDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550[_0x196854(0x1e4)](getFormInterfacesDir(_0x1f5970),{'recursive':!![]}),a133_0x8c5550[_0x196854(0x1e4)](getChatInterfacesDir(_0x1f5970),{'recursive':!![]});const _0x186bb9=a133_0xcf5d58['join'](_0x1f5970,_0x196854(0x243));a133_0x8c5550[_0x196854(0x22f)](_0x186bb9,createAgentConfigContent(_0x5338c2));for(const _0x46bd0d of _0x38a668){if(_0x46bd0d['isDir'])a133_0x8c5550[_0x196854(0x1e4)](_0x46bd0d[_0x196854(0x25d)],{'recursive':!![]});else{const _0x3d0d29=a133_0xcf5d58[_0x196854(0x24d)](_0x46bd0d[_0x196854(0x25d)]);!a133_0x8c5550[_0x196854(0x229)](_0x3d0d29)&&a133_0x8c5550[_0x196854(0x1e4)](_0x3d0d29,{'recursive':!![]}),a133_0x8c5550[_0x196854(0x22f)](_0x46bd0d[_0x196854(0x25d)],_0x46bd0d[_0x196854(0x1ab)]);}}for(const _0x55d736 of _0x18832a){_0x55d736[_0x196854(0x173)]?(a133_0x8c5550[_0x196854(0x152)](_0x55d736[_0x196854(0x25d)],{'recursive':!![],'force':!![]}),this[_0x196854(0x157)]['info'](_0x196854(0x244)+a133_0xcf5d58[_0x196854(0x1c8)](a133_0xcf5d58[_0x196854(0x24d)](_0x55d736['path']))+'/'+a133_0xcf5d58[_0x196854(0x1c8)](_0x55d736[_0x196854(0x25d)]))):(a133_0x8c5550[_0x196854(0x152)](_0x55d736[_0x196854(0x25d)],{'force':!![]}),this['logger'][_0x196854(0x1ed)](_0x196854(0x168)+a133_0xcf5d58['basename'](a133_0xcf5d58['dirname'](_0x55d736[_0x196854(0x25d)]))+'/'+a133_0xcf5d58[_0x196854(0x1c8)](_0x55d736[_0x196854(0x25d)])));}return _0x25e5dd;}async[a133_0xe8af3(0x194)](_0x11347e,_0x4407a8){const _0x48fc7b=a133_0xe8af3,_0x39c7fc=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x11347e,'tdx.json');if(!a133_0x8c5550[_0x48fc7b(0x229)](_0x39c7fc))throw new SDKError(ErrorCode[_0x48fc7b(0x22e)],_0x48fc7b(0x1ca)+_0x11347e,undefined,{'helpText':_0x48fc7b(0x1a3)});const _0x563cd8=loadAgentConfig(_0x39c7fc),_0x23e555=await this[_0x48fc7b(0x1c5)](_0x563cd8[_0x48fc7b(0x181)]),_0x3517e0=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x1d4)](_0x23e555),_0x9db351=_0x3517e0['attributes']['name'],_0x3b18f5={'projectName':_0x9db351,'projectId':_0x23e555,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0xf8fab8=[],_0x269704=[],_0x5bf5de=[],_0x262d1a=[],_0x3cf0ae=[],_0x66f9a5=[],_0x1ec36e=a133_0x8c5550['readdirSync'](_0x11347e,{'withFileTypes':!![]});for(const _0x5256b3 of _0x1ec36e){if(!_0x5256b3[_0x48fc7b(0x24c)]())continue;if([_0x48fc7b(0x21f),_0x48fc7b(0x236),_0x48fc7b(0x25a),_0x48fc7b(0x196),_0x48fc7b(0x175),_0x48fc7b(0x174),'chat_interfaces'][_0x48fc7b(0x16a)](_0x5256b3[_0x48fc7b(0x1c3)]))continue;const _0x161ad5=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x11347e,_0x5256b3[_0x48fc7b(0x1c3)]);if(isAgentDir(_0x161ad5)){const _0x2625b1=a133_0xcf5d58['join'](_0x161ad5,_0x48fc7b(0x198)),_0x3fc129=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x161ad5,_0x48fc7b(0x1d5)),_0x30506c=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x161ad5,'starter_message.md'),_0x236316=parseAgentYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x2625b1,_0x48fc7b(0x189)),_0x2625b1),_0xd4086a=a133_0x8c5550[_0x48fc7b(0x229)](_0x3fc129)?a133_0x8c5550[_0x48fc7b(0x1b1)](_0x3fc129,_0x48fc7b(0x189)):'',_0x2a8507=a133_0x8c5550[_0x48fc7b(0x229)](_0x30506c)?a133_0x8c5550[_0x48fc7b(0x1b1)](_0x30506c,_0x48fc7b(0x189)):_0x236316[_0x48fc7b(0x15b)];_0xf8fab8[_0x48fc7b(0x1da)]({'name':_0x236316[_0x48fc7b(0x1c3)],'dir':_0x161ad5,'yaml':_0x236316,'systemPrompt':_0xd4086a,'starterMessage':_0x2a8507});}}const _0x106325=getKnowledgeBasesDir(_0x11347e);if(a133_0x8c5550[_0x48fc7b(0x229)](_0x106325)){const _0x58e12e=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x106325);for(const _0x305738 of _0x58e12e){const _0x325345=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x106325,_0x305738);if(_0x305738[_0x48fc7b(0x1b9)](_0x48fc7b(0x218))){const _0x1b1116=parseKnowledgeBaseYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x325345,'utf-8'),_0x325345);_0x269704[_0x48fc7b(0x1da)]({'name':_0x1b1116[_0x48fc7b(0x1c3)],'path':_0x325345,'yaml':_0x1b1116});}else{if(_0x305738[_0x48fc7b(0x1b9)](_0x48fc7b(0x1fb))){const _0x4ab55e=a133_0x8c5550['readFileSync'](_0x325345,_0x48fc7b(0x189)),{name:_0x191634,text:_0x5b2c7d}=parseTextKnowledgeBaseMd(_0x4ab55e,_0x305738);_0x5bf5de[_0x48fc7b(0x1da)]({'name':_0x191634,'path':_0x325345,'text':_0x5b2c7d});}}}}const _0x1f5e99=getPromptsDir(_0x11347e);if(a133_0x8c5550['existsSync'](_0x1f5e99)){const _0x442758=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x1f5e99)[_0x48fc7b(0x146)](_0x2a22e7=>_0x2a22e7[_0x48fc7b(0x1b9)](_0x48fc7b(0x218)));for(const _0x13b902 of _0x442758){const _0x235849=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x1f5e99,_0x13b902),_0x27ada3=parsePromptYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x235849,_0x48fc7b(0x189)),_0x235849);_0x262d1a[_0x48fc7b(0x1da)]({'name':_0x27ada3[_0x48fc7b(0x1c3)],'path':_0x235849,'yaml':_0x27ada3});}}const _0x2d98be=[],_0xaa282a=getIntegrationsDir(_0x11347e);if(a133_0x8c5550[_0x48fc7b(0x229)](_0xaa282a)){const _0x4de8c5=a133_0x8c5550[_0x48fc7b(0x1ee)](_0xaa282a)[_0x48fc7b(0x146)](_0x1c6b83=>_0x1c6b83[_0x48fc7b(0x1b9)](_0x48fc7b(0x218)));for(const _0x409768 of _0x4de8c5){const _0x207233=a133_0xcf5d58['join'](_0xaa282a,_0x409768),_0x4aa949=parseIntegrationYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x207233,_0x48fc7b(0x189)),_0x207233);if(!SAFE_INTEGRATION_TYPES[_0x48fc7b(0x16a)](_0x4aa949[_0x48fc7b(0x21d)][_0x48fc7b(0x153)]())){this[_0x48fc7b(0x157)][_0x48fc7b(0x14b)](_0x48fc7b(0x14c)+_0x4aa949[_0x48fc7b(0x1c3)]+_0x48fc7b(0x227)+_0x4aa949['service_type']+_0x48fc7b(0x1ad)+(_0x48fc7b(0x176)+SAFE_INTEGRATION_TYPES[_0x48fc7b(0x1e6)](',\x20')+_0x48fc7b(0x18c))+_0x48fc7b(0x19e));continue;}_0x2d98be[_0x48fc7b(0x1da)]({'name':_0x4aa949['name'],'path':_0x207233,'yaml':_0x4aa949});}}const _0x21af66=getExperimentalKnowledgeBasesDir(_0x11347e);if(a133_0x8c5550[_0x48fc7b(0x229)](_0x21af66)){const _0x50e781=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x21af66,{'withFileTypes':!![]});for(const _0x1724d7 of _0x50e781){if(!_0x1724d7[_0x48fc7b(0x24c)]())continue;const _0x211166=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x21af66,_0x1724d7[_0x48fc7b(0x1c3)]),_0x521f46=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x211166,_0x1724d7[_0x48fc7b(0x1c3)]+'.yml'),_0x2a94bb=a133_0xcf5d58['join'](_0x211166,_0x48fc7b(0x1b8));if(!a133_0x8c5550['existsSync'](_0x521f46))continue;const _0x4ab0a4=parseExperimentalKnowledgeBaseYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x521f46,'utf-8'),_0x521f46),_0x1abd2d=[];if(a133_0x8c5550['existsSync'](_0x2a94bb)){const _0x25d102=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x2a94bb,{'withFileTypes':!![]});for(const _0x2f07ee of _0x25d102){if(!_0x2f07ee['isDirectory']())continue;const _0x167746=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x2a94bb,_0x2f07ee[_0x48fc7b(0x1c3)]),_0x3ef05a=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x167746,'code.js'),_0x3bd766=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x167746,_0x48fc7b(0x145));a133_0x8c5550['existsSync'](_0x3ef05a)&&a133_0x8c5550[_0x48fc7b(0x229)](_0x3bd766)&&_0x1abd2d['push']({'name':_0x2f07ee[_0x48fc7b(0x1c3)],'code':a133_0x8c5550[_0x48fc7b(0x1b1)](_0x3ef05a,'utf-8'),'json_schema':a133_0x8c5550[_0x48fc7b(0x1b1)](_0x3bd766,_0x48fc7b(0x189))});}}const _0x3d6f99={..._0x4ab0a4,'variables':_0x4ab0a4[_0x48fc7b(0x1cd)]||[],'functions':_0x1abd2d};_0x3cf0ae[_0x48fc7b(0x1da)]({'name':_0x4ab0a4[_0x48fc7b(0x1c3)],'dir':_0x211166,'def':_0x3d6f99});}}const _0x43d9a9=getExperimentalArtifactsDir(_0x11347e);if(a133_0x8c5550[_0x48fc7b(0x229)](_0x43d9a9)){const _0x533853=a133_0x8c5550['readdirSync'](_0x43d9a9,{'withFileTypes':!![]});for(const _0x604938 of _0x533853){if(!_0x604938['isDirectory']())continue;const _0x19ed67=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x43d9a9,_0x604938[_0x48fc7b(0x1c3)]),_0xd3345a=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x19ed67,_0x604938[_0x48fc7b(0x1c3)]+_0x48fc7b(0x218)),_0x1b1387=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x19ed67,_0x48fc7b(0x20a)),_0x3be67b=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x19ed67,_0x48fc7b(0x1d1));if(!a133_0x8c5550[_0x48fc7b(0x229)](_0xd3345a)||!a133_0x8c5550[_0x48fc7b(0x229)](_0x1b1387))continue;const _0x1899d1=parseExperimentalArtifactYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0xd3345a,_0x48fc7b(0x189)),_0xd3345a),_0x1faf55=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x1b1387,'utf-8'),_0x427d72=[];if(a133_0x8c5550[_0x48fc7b(0x229)](_0x3be67b)){const _0xf10d50=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x3be67b);for(const _0x129674 of _0xf10d50){const _0x2c408b=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x3be67b,_0x129674);a133_0x8c5550[_0x48fc7b(0x1dd)](_0x2c408b)['isFile']()&&_0x427d72[_0x48fc7b(0x1da)]({'file_name':_0x129674,'text_content':a133_0x8c5550['readFileSync'](_0x2c408b,_0x48fc7b(0x189))});}}const _0x3ee7d3={..._0x1899d1,'code':_0x1faf55,'files':_0x427d72};_0x66f9a5['push']({'name':_0x1899d1[_0x48fc7b(0x1c3)],'dir':_0x19ed67,'def':_0x3ee7d3});}}const _0x40e69d=[],_0x48382d=getFormInterfacesDir(_0x11347e);if(a133_0x8c5550[_0x48fc7b(0x229)](_0x48382d)){const _0xca0c08=a133_0x8c5550[_0x48fc7b(0x1ee)](_0x48382d)[_0x48fc7b(0x146)](_0x5cb0aa=>_0x5cb0aa[_0x48fc7b(0x1b9)]('.yml'));for(const _0x2ad8e3 of _0xca0c08){const _0x23a6e0=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x48382d,_0x2ad8e3),_0x47ae21=parseFormInterfaceYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x23a6e0,_0x48fc7b(0x189)),_0x23a6e0);_0x40e69d[_0x48fc7b(0x1da)]({'name':_0x47ae21['name'],'path':_0x23a6e0,'yaml':_0x47ae21});}}const _0x35e986=[],_0x2b0b40=getChatInterfacesDir(_0x11347e);if(a133_0x8c5550['existsSync'](_0x2b0b40)){const _0x5932d7=a133_0x8c5550['readdirSync'](_0x2b0b40)[_0x48fc7b(0x146)](_0x3f940c=>_0x3f940c[_0x48fc7b(0x1b9)](_0x48fc7b(0x218)));for(const _0x47e1ce of _0x5932d7){const _0x259956=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x2b0b40,_0x47e1ce),_0x23434b=parseChatInterfaceYaml(a133_0x8c5550[_0x48fc7b(0x1b1)](_0x259956,_0x48fc7b(0x189)),_0x259956);_0x35e986['push']({'name':_0x23434b['name'],'path':_0x259956,'yaml':_0x23434b});}}const _0x44132b=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x1d8)](_0x23e555),_0x20373f=await this['client'][_0x48fc7b(0x183)](_0x23e555),_0x2053f8=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x239)](_0x23e555),_0x36d8bd=await this[_0x48fc7b(0x18a)]['listPrompts'](_0x23e555),_0x1b6a25=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x1ba)](_0x23e555),_0x280003=await safeListOrEmpty(()=>this[_0x48fc7b(0x18a)]['listExperimentalKnowledgeBases'](_0x23e555)),_0x2043c8=await safeListOrEmpty(()=>this[_0x48fc7b(0x18a)]['listExperimentalArtifacts'](_0x23e555)),_0x6bc0c0=await safeListOrEmpty(()=>this[_0x48fc7b(0x18a)][_0x48fc7b(0x142)](_0x23e555)),_0x1d2763=await safeListOrEmpty(()=>this['client'][_0x48fc7b(0x223)](_0x23e555)),_0x3b6030=await fetchAllToolTargetMaps((_0xafb6ba,_0x209ce8)=>this['client'][_0x48fc7b(0x24b)](_0xafb6ba,_0x209ce8),_0x23e555),_0x4ce081=new Map(),_0x4b6e1a=new Map(),_0x2d4773=new Map(),_0x4f9c4c=new Map(),_0x3439ff=new Map(),_0x428f0f=new Map(),_0x4b7fed=new Map();for(const _0x406294 of _0x44132b){_0x4ce081[_0x48fc7b(0x199)](_0x406294[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0x406294);}for(const _0x55cf00 of _0x20373f){_0x4b6e1a[_0x48fc7b(0x199)](_0x55cf00[_0x48fc7b(0x222)]['name'],_0x55cf00);}for(const _0xcf8ff1 of _0x2053f8){_0x2d4773[_0x48fc7b(0x199)](_0xcf8ff1['attributes'][_0x48fc7b(0x1c3)],_0xcf8ff1);}for(const _0xf30c6f of _0x36d8bd){_0x4f9c4c['set'](_0xf30c6f[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0xf30c6f);}for(const _0x1220b1 of _0x1b6a25){_0x3439ff[_0x48fc7b(0x199)](_0x1220b1['attributes']['serviceType'][_0x48fc7b(0x153)](),_0x1220b1);}for(const _0x586bd5 of _0x280003){_0x428f0f[_0x48fc7b(0x199)](_0x586bd5[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0x586bd5);}for(const _0x5dead4 of _0x2043c8){_0x4b7fed['set'](_0x5dead4[_0x48fc7b(0x222)]['name'],_0x5dead4);}const _0x115cca=new Map(),_0x1480a0=new Map();for(const _0xe6dc76 of _0x6bc0c0){_0x115cca['set'](_0xe6dc76['attributes'][_0x48fc7b(0x1c3)],_0xe6dc76);}for(const _0x1ffe5b of _0x1d2763){_0x1480a0[_0x48fc7b(0x199)](_0x1ffe5b[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0x1ffe5b);}const _0x4315f6=new Map(),_0x83c28=new Map();for(const _0x174197 of _0x44132b){_0x4315f6['set'](_0x174197[_0x48fc7b(0x222)]['name'],_0x174197['id']),_0x83c28[_0x48fc7b(0x199)](_0x174197['id'],_0x174197[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)]);}const _0x167009=new Map(),_0x1da7b4=new Map();for(const _0x556707 of _0x36d8bd){_0x167009[_0x48fc7b(0x199)](_0x556707[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0x556707['id']),_0x1da7b4[_0x48fc7b(0x199)](_0x556707['id'],_0x556707[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)]);}const _0x3035cf=_0x3b6030[_0x48fc7b(0x23f)]['KnowledgeBase']||new Map(),_0x14c757=_0x3b6030[_0x48fc7b(0x23f)][_0x48fc7b(0x1c9)]||new Map(),_0x139ed9=_0x3b6030[_0x48fc7b(0x23f)][_0x48fc7b(0x18e)]||new Map(),_0x17ecfc=new Map(),_0x6e038c={'resolveToolTargetName':buildNameResolver({..._0x3b6030[_0x48fc7b(0x18f)],'Agent':_0x83c28}),'resolvePromptName':async _0x5b595d=>_0x1da7b4['get'](_0x5b595d),'onWarning':_0x27d1cd=>this[_0x48fc7b(0x157)][_0x48fc7b(0x14b)](_0x27d1cd)};let _0x288a85=[];const _0x50df6e={'projectId':_0x23e555,'resolveToolTargetId':buildIdResolver({..._0x3b6030[_0x48fc7b(0x23f)],'Agent':_0x4315f6}),'resolvePromptId':async _0x2cf882=>_0x167009[_0x48fc7b(0x249)](_0x2cf882),'onWarning':_0x41b297=>{const _0x1d6284=_0x48fc7b;this[_0x1d6284(0x157)][_0x1d6284(0x14b)](_0x41b297),_0x288a85[_0x1d6284(0x1da)](_0x41b297);}},{resolved:_0x5d561a,unresolved:_0x473353}=resolveAgentDependencies(_0xf8fab8,new Set(_0x4ce081[_0x48fc7b(0x24e)]()));for(const {agent:_0x75b24,missingDeps:_0x3ffab8}of _0x473353){_0x3b18f5[_0x48fc7b(0x1e7)][_0x48fc7b(0x1da)]({'agentName':_0x75b24[_0x48fc7b(0x1d3)]['name'],'action':'error','error':'Unresolved\x20dependencies:\x20'+_0x3ffab8['join'](',\x20')+'.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.'}),_0x3b18f5['counts']['agents']['errors']++;}for(const _0xadefdd of _0x269704){const _0x5418ff=_0x4b6e1a['get'](_0xadefdd['yaml'][_0x48fc7b(0x1c3)]),_0x15467d=a133_0x8c5550[_0x48fc7b(0x1b1)](_0xadefdd[_0x48fc7b(0x25d)],_0x48fc7b(0x189));if(_0x5418ff){const _0x15001c=apiKnowledgeBaseToYaml(_0x5418ff),_0x21af92=toKnowledgeBaseYamlString(_0x15001c),_0x11e359=generateDiff(_0x21af92,_0x15467d),_0x27357e=hasChanges(_0x11e359);_0x27357e?(_0x3b18f5['knowledgeBases'][_0x48fc7b(0x1da)]({'name':_0xadefdd[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x5418ff['id'],'diff':formatDiffWithColors(_0x11e359)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x252)]['updated']++):(_0x3b18f5['knowledgeBases'][_0x48fc7b(0x1da)]({'name':_0xadefdd[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x5418ff['id']}),_0x3b18f5[_0x48fc7b(0x207)]['knowledgeBases'][_0x48fc7b(0x1ff)]++);}else _0x3b18f5[_0x48fc7b(0x252)]['push']({'name':_0xadefdd[_0x48fc7b(0x1d3)]['name'],'action':_0x48fc7b(0x25c)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x252)][_0x48fc7b(0x25c)]++;}for(const _0x4ade0b of _0x5bf5de){const _0x2020a1=_0x2d4773[_0x48fc7b(0x249)](_0x4ade0b[_0x48fc7b(0x1c3)]),_0x3e24f4=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x4ade0b[_0x48fc7b(0x25d)],_0x48fc7b(0x189));if(_0x2020a1){const _0x4273e9=toTextKnowledgeBaseMd(_0x2020a1[_0x48fc7b(0x222)][_0x48fc7b(0x1c3)],_0x2020a1[_0x48fc7b(0x222)][_0x48fc7b(0x248)]),_0x226f6f=generateDiff(_0x4273e9,_0x3e24f4),_0x3521cc=hasChanges(_0x226f6f);_0x3521cc?(_0x3b18f5[_0x48fc7b(0x1a9)][_0x48fc7b(0x1da)]({'name':_0x4ade0b[_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x2020a1['id'],'diff':formatDiffWithColors(_0x226f6f)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1a9)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x1a9)]['push']({'name':_0x4ade0b[_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x2020a1['id']}),_0x3b18f5['counts'][_0x48fc7b(0x1a9)][_0x48fc7b(0x1ff)]++);}else _0x3b18f5[_0x48fc7b(0x1a9)][_0x48fc7b(0x1da)]({'name':_0x4ade0b[_0x48fc7b(0x1c3)],'action':'created'}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1a9)][_0x48fc7b(0x25c)]++;}for(const _0x463c76 of _0x5d561a){const _0x45f3f4=_0x4ce081[_0x48fc7b(0x249)](_0x463c76['yaml'][_0x48fc7b(0x1c3)]),_0x547168=a133_0xcf5d58[_0x48fc7b(0x1e6)](_0x463c76[_0x48fc7b(0x19a)],_0x48fc7b(0x198)),_0x37dc73=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x547168,'utf-8'),_0x1bed72=_0x463c76[_0x48fc7b(0x16f)],_0x25a957=_0x48fc7b(0x18d)+_0x1bed72+'\x0a\x0a#\x20agent.yml\x0a'+_0x37dc73;if(_0x45f3f4){const {yaml:_0xa231a5,systemPrompt:_0x4cf85a}=await agentResponseToDef(_0x45f3f4,_0x6e038c),_0x19969d=toAgentYamlString(_0xa231a5),_0x5eef8d='#\x20prompt.md\x0a'+_0x4cf85a+_0x48fc7b(0x1e0)+_0x19969d,_0x3b14d4=generateDiff(_0x5eef8d,_0x25a957),_0x1bc203=hasChanges(_0x3b14d4);_0x1bc203?(_0x3b18f5[_0x48fc7b(0x1e7)][_0x48fc7b(0x1da)]({'agentName':_0x463c76[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'agentId':_0x45f3f4['id'],'diff':formatDiffWithColors(_0x3b14d4)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1e7)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x1e7)][_0x48fc7b(0x1da)]({'agentName':_0x463c76[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'agentId':_0x45f3f4['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1e7)][_0x48fc7b(0x1ff)]++);}else _0x3b18f5[_0x48fc7b(0x1e7)]['push']({'agentName':_0x463c76[_0x48fc7b(0x1d3)]['name'],'action':_0x48fc7b(0x25c)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1e7)][_0x48fc7b(0x25c)]++;}for(const _0x405159 of _0x262d1a){const _0x249210=_0x4f9c4c[_0x48fc7b(0x249)](_0x405159[_0x48fc7b(0x1d3)]['name']),_0x5745d0=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x405159[_0x48fc7b(0x25d)],_0x48fc7b(0x189));if(_0x249210){const _0x1b5876=await apiPromptToYaml(_0x249210,_0x6e038c);if(!_0x1b5876){_0x3b18f5[_0x48fc7b(0x236)][_0x48fc7b(0x1da)]({'name':_0x405159['yaml'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x249210['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)][_0x48fc7b(0x1be)]++;continue;}const _0x3db53b=toPromptYamlString(_0x1b5876),_0x122d15=generateDiff(_0x3db53b,_0x5745d0),_0x2e1cec=hasChanges(_0x122d15);_0x2e1cec?(_0x3b18f5[_0x48fc7b(0x236)][_0x48fc7b(0x1da)]({'name':_0x405159[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x249210['id'],'diff':formatDiffWithColors(_0x122d15)}),_0x3b18f5['counts'][_0x48fc7b(0x236)]['updated']++):(_0x3b18f5['prompts']['push']({'name':_0x405159[_0x48fc7b(0x1d3)]['name'],'action':_0x48fc7b(0x1ff),'id':_0x249210['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)][_0x48fc7b(0x1ff)]++);}else _0x3b18f5['prompts'][_0x48fc7b(0x1da)]({'name':_0x405159[_0x48fc7b(0x1d3)]['name'],'action':_0x48fc7b(0x25c)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)][_0x48fc7b(0x25c)]++;}for(const _0x57d0d3 of _0x2d98be){const _0x1922ec=_0x3439ff['get'](_0x57d0d3[_0x48fc7b(0x1d3)][_0x48fc7b(0x21d)]),_0xd9bbc6=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x57d0d3['path'],'utf-8');if(_0x1922ec){const _0x28d6ea=await apiIntegrationToYaml(_0x1922ec,_0x6e038c),_0x494be1=toIntegrationYamlString(_0x28d6ea),_0x54a647=generateDiff(_0x494be1,_0xd9bbc6),_0x34f8fe=hasChanges(_0x54a647);_0x34f8fe?(_0x3b18f5[_0x48fc7b(0x25a)][_0x48fc7b(0x1da)]({'name':_0x57d0d3[_0x48fc7b(0x1d3)]['service_type'],'action':_0x48fc7b(0x1be),'id':_0x1922ec['id'],'diff':formatDiffWithColors(_0x54a647)}),_0x3b18f5['counts'][_0x48fc7b(0x25a)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x25a)]['push']({'name':_0x57d0d3['yaml'][_0x48fc7b(0x21d)],'action':_0x48fc7b(0x1ff),'id':_0x1922ec['id']}),_0x3b18f5[_0x48fc7b(0x207)]['integrations'][_0x48fc7b(0x1ff)]++);}else _0x3b18f5['integrations'][_0x48fc7b(0x1da)]({'name':_0x57d0d3['yaml'][_0x48fc7b(0x21d)],'action':_0x48fc7b(0x25c)}),_0x3b18f5['counts'][_0x48fc7b(0x25a)][_0x48fc7b(0x25c)]++;}for(const _0x493992 of _0x3cf0ae){const _0x2498a4=_0x428f0f[_0x48fc7b(0x249)](_0x493992[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)]),_0x386b15=toExperimentalKnowledgeBaseYamlString(_0x493992[_0x48fc7b(0x22b)]);let _0x53e361=_0x386b15;for(const _0x113d28 of _0x493992['def'][_0x48fc7b(0x1b8)]){_0x53e361+=_0x48fc7b(0x16c)+_0x113d28[_0x48fc7b(0x1c3)]+_0x48fc7b(0x1b5)+_0x113d28[_0x48fc7b(0x225)]+'\x0a---\x20schema:\x20'+_0x113d28['name']+_0x48fc7b(0x1b5)+_0x113d28[_0x48fc7b(0x20e)]+'\x0a';}if(_0x2498a4){const _0x4ac92f=apiExperimentalKnowledgeBaseToYaml(_0x2498a4),_0x52bbde=toExperimentalKnowledgeBaseYamlString(_0x4ac92f);let _0x1b35c9=_0x52bbde;for(const _0x24f710 of _0x4ac92f[_0x48fc7b(0x1b8)]){_0x1b35c9+='\x0a---\x20function:\x20'+_0x24f710['name']+'\x20---\x0a'+_0x24f710[_0x48fc7b(0x225)]+_0x48fc7b(0x147)+_0x24f710[_0x48fc7b(0x1c3)]+_0x48fc7b(0x1b5)+_0x24f710[_0x48fc7b(0x20e)]+'\x0a';}const _0x6c38c7=generateDiff(_0x1b35c9,_0x53e361),_0x5e1e69=hasChanges(_0x6c38c7);_0x5e1e69?(_0x3b18f5['experimentalKnowledgeBases'][_0x48fc7b(0x1da)]({'name':_0x493992[_0x48fc7b(0x22b)]['name'],'action':'updated','id':_0x2498a4['id'],'diff':formatDiffWithColors(_0x6c38c7)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x217)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x217)]['push']({'name':_0x493992[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x2498a4['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x217)]['unchanged']++);}else _0x3b18f5[_0x48fc7b(0x217)][_0x48fc7b(0x1da)]({'name':_0x493992[_0x48fc7b(0x22b)]['name'],'action':'created'}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x217)][_0x48fc7b(0x25c)]++;}for(const _0x51389d of _0x66f9a5){const _0x5e44a6=_0x4b7fed[_0x48fc7b(0x249)](_0x51389d[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)]),_0x6b5191=toExperimentalArtifactYamlString(_0x51389d[_0x48fc7b(0x22b)]);let _0x37843c=_0x6b5191+(_0x48fc7b(0x245)+_0x51389d[_0x48fc7b(0x22b)]['code']+'\x0a');for(const _0x4e1b5d of _0x51389d[_0x48fc7b(0x22b)][_0x48fc7b(0x1d1)]){_0x37843c+=_0x48fc7b(0x151)+_0x4e1b5d[_0x48fc7b(0x1c7)]+_0x48fc7b(0x1b5)+_0x4e1b5d['text_content']+'\x0a';}if(_0x5e44a6){const _0x4399d1=apiExperimentalArtifactToYaml(_0x5e44a6),_0x4a6c16=toExperimentalArtifactYamlString(_0x4399d1);let _0x4a7d5b=_0x4a6c16+('\x0a---\x20code\x20---\x0a'+_0x4399d1[_0x48fc7b(0x225)]+'\x0a');for(const _0x10d662 of _0x4399d1[_0x48fc7b(0x1d1)]){_0x4a7d5b+=_0x48fc7b(0x151)+_0x10d662[_0x48fc7b(0x1c7)]+'\x20---\x0a'+_0x10d662[_0x48fc7b(0x208)]+'\x0a';}const _0x44f0db=generateDiff(_0x4a7d5b,_0x37843c),_0x26e93a=hasChanges(_0x44f0db);_0x26e93a?(_0x3b18f5[_0x48fc7b(0x1b3)][_0x48fc7b(0x1da)]({'name':_0x51389d[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':'updated','id':_0x5e44a6['id'],'diff':formatDiffWithColors(_0x44f0db)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1b3)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x1b3)][_0x48fc7b(0x1da)]({'name':_0x51389d['def'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x5e44a6['id']}),_0x3b18f5['counts'][_0x48fc7b(0x1b3)]['unchanged']++);}else _0x3b18f5[_0x48fc7b(0x1b3)][_0x48fc7b(0x1da)]({'name':_0x51389d[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c)}),_0x3b18f5['counts']['experimentalArtifacts'][_0x48fc7b(0x25c)]++;}for(const _0x746f55 of _0x40e69d){const _0x471bcb=_0x115cca['get'](_0x746f55[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)]),_0x54b9b8=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x746f55[_0x48fc7b(0x25d)],_0x48fc7b(0x189));if(_0x471bcb){const _0xecf7be=await apiFormInterfaceToYaml(_0x471bcb,_0x6e038c),_0x34a467=toFormInterfaceYamlString(_0xecf7be),_0x451821=generateDiff(_0x34a467,_0x54b9b8),_0x26f404=hasChanges(_0x451821);_0x26f404?(_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x746f55['yaml'][_0x48fc7b(0x1c3)],'action':'updated','id':_0x471bcb['id'],'diff':formatDiffWithColors(_0x451821)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x178)]['updated']++):(_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x746f55['yaml'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x471bcb['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x178)][_0x48fc7b(0x1ff)]++);}else _0x3b18f5['formInterfaces'][_0x48fc7b(0x1da)]({'name':_0x746f55['yaml'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c)}),_0x3b18f5['counts'][_0x48fc7b(0x178)][_0x48fc7b(0x25c)]++;}for(const _0x25ec3a of _0x35e986){const _0x1b89c3=_0x1480a0[_0x48fc7b(0x249)](_0x25ec3a[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)]),_0x12f4fd=a133_0x8c5550[_0x48fc7b(0x1b1)](_0x25ec3a[_0x48fc7b(0x25d)],_0x48fc7b(0x189));if(_0x1b89c3){const _0x1f127e=await apiChatInterfaceToYaml(_0x1b89c3,_0x6e038c),_0x3b02f9=toChatInterfaceYamlString(_0x1f127e),_0x3da0d9=generateDiff(_0x3b02f9,_0x12f4fd),_0x351e5a=hasChanges(_0x3da0d9);_0x351e5a?(_0x3b18f5['chatInterfaces'][_0x48fc7b(0x1da)]({'name':_0x25ec3a['yaml']['name'],'action':'updated','id':_0x1b89c3['id'],'diff':formatDiffWithColors(_0x3da0d9)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x247)][_0x48fc7b(0x1be)]++):(_0x3b18f5[_0x48fc7b(0x247)][_0x48fc7b(0x1da)]({'name':_0x25ec3a[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1ff),'id':_0x1b89c3['id']}),_0x3b18f5[_0x48fc7b(0x207)]['chatInterfaces'][_0x48fc7b(0x1ff)]++);}else _0x3b18f5[_0x48fc7b(0x247)]['push']({'name':_0x25ec3a[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x247)][_0x48fc7b(0x25c)]++;}if(_0x4407a8?.[_0x48fc7b(0x234)])return _0x3b18f5;_0x3b18f5['knowledgeBases']=[],_0x3b18f5['textKnowledgeBases']=[],_0x3b18f5[_0x48fc7b(0x236)]=[],_0x3b18f5[_0x48fc7b(0x25a)]=[],_0x3b18f5[_0x48fc7b(0x217)]=[],_0x3b18f5[_0x48fc7b(0x1b3)]=[],_0x3b18f5[_0x48fc7b(0x178)]=[],_0x3b18f5[_0x48fc7b(0x247)]=[];const _0x8da56b=_0x3b18f5[_0x48fc7b(0x1e7)][_0x48fc7b(0x146)](_0x30d38b=>_0x30d38b[_0x48fc7b(0x226)]===_0x48fc7b(0x171));_0x3b18f5['agents']=_0x8da56b,_0x3b18f5['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x8da56b[_0x48fc7b(0x212)]},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x4bd44e of _0x269704){try{const _0x11be39=_0x4b6e1a[_0x48fc7b(0x249)](_0x4bd44e[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)]),_0x407c4c=yamlKnowledgeBaseToApi(_0x4bd44e[_0x48fc7b(0x1d3)],_0x23e555);if(_0x11be39)await this[_0x48fc7b(0x18a)][_0x48fc7b(0x230)](_0x11be39['id'],_0x407c4c),_0x3035cf[_0x48fc7b(0x199)](_0x4bd44e[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],_0x11be39['id']),_0x3b18f5['knowledgeBases']['push']({'name':_0x4bd44e['yaml']['name'],'action':_0x48fc7b(0x1be),'id':_0x11be39['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x252)][_0x48fc7b(0x1be)]++;else{const _0x422197=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x1f2)](_0x407c4c);_0x3035cf[_0x48fc7b(0x199)](_0x4bd44e[_0x48fc7b(0x1d3)]['name'],_0x422197['id']),_0x3b18f5[_0x48fc7b(0x252)][_0x48fc7b(0x1da)]({'name':_0x4bd44e[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c),'id':_0x422197['id']}),_0x3b18f5[_0x48fc7b(0x207)]['knowledgeBases'][_0x48fc7b(0x25c)]++;}}catch(_0x238a8d){_0x3b18f5[_0x48fc7b(0x252)][_0x48fc7b(0x1da)]({'name':_0x4bd44e[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0x238a8d['message']}),_0x3b18f5[_0x48fc7b(0x207)]['knowledgeBases'][_0x48fc7b(0x156)]++;}}for(const _0xf1a01e of _0x5bf5de){try{const _0x5c0da7=_0x2d4773[_0x48fc7b(0x249)](_0xf1a01e[_0x48fc7b(0x1c3)]),_0x1e56e6=yamlTextKnowledgeBaseToApi({'name':_0xf1a01e[_0x48fc7b(0x1c3)],'text':_0xf1a01e[_0x48fc7b(0x248)]},_0x23e555);if(_0x5c0da7)await this[_0x48fc7b(0x18a)]['updateTextKnowledgeBase'](_0x5c0da7['id'],_0x1e56e6),_0x14c757[_0x48fc7b(0x199)](_0xf1a01e[_0x48fc7b(0x1c3)],_0x5c0da7['id']),_0x3b18f5['textKnowledgeBases'][_0x48fc7b(0x1da)]({'name':_0xf1a01e[_0x48fc7b(0x1c3)],'action':'updated','id':_0x5c0da7['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1a9)][_0x48fc7b(0x1be)]++;else{const _0x223376=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x219)](_0x1e56e6);_0x14c757[_0x48fc7b(0x199)](_0xf1a01e[_0x48fc7b(0x1c3)],_0x223376['id']),_0x3b18f5['textKnowledgeBases'][_0x48fc7b(0x1da)]({'name':_0xf1a01e[_0x48fc7b(0x1c3)],'action':'created','id':_0x223376['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1a9)][_0x48fc7b(0x25c)]++;}}catch(_0x2e5710){_0x3b18f5[_0x48fc7b(0x1a9)][_0x48fc7b(0x1da)]({'name':_0xf1a01e[_0x48fc7b(0x1c3)],'action':'error','error':_0x2e5710[_0x48fc7b(0x250)]}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1a9)]['errors']++;}}for(const _0x27f4b8 of _0x3cf0ae){try{const _0x19da63=_0x428f0f[_0x48fc7b(0x249)](_0x27f4b8[_0x48fc7b(0x22b)]['name']),_0x123b27=yamlExperimentalKnowledgeBaseToApi(_0x27f4b8['def'],_0x23e555);if(_0x19da63)await this[_0x48fc7b(0x18a)]['updateExperimentalKnowledgeBase'](_0x19da63['id'],_0x123b27),_0x139ed9[_0x48fc7b(0x199)](_0x27f4b8[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],_0x19da63['id']),_0x3b18f5[_0x48fc7b(0x217)]['push']({'name':_0x27f4b8[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x19da63['id']}),_0x3b18f5[_0x48fc7b(0x207)]['experimentalKnowledgeBases'][_0x48fc7b(0x1be)]++;else{const _0x6951b8=await this[_0x48fc7b(0x18a)]['createExperimentalKnowledgeBase'](_0x123b27);_0x139ed9[_0x48fc7b(0x199)](_0x27f4b8[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],_0x6951b8['id']),_0x3b18f5['experimentalKnowledgeBases'][_0x48fc7b(0x1da)]({'name':_0x27f4b8[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c),'id':_0x6951b8['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x217)][_0x48fc7b(0x25c)]++;}}catch(_0x52ca62){_0x3b18f5[_0x48fc7b(0x217)][_0x48fc7b(0x1da)]({'name':_0x27f4b8[_0x48fc7b(0x22b)]['name'],'action':_0x48fc7b(0x171),'error':_0x52ca62[_0x48fc7b(0x250)]}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x217)]['errors']++;}}for(const _0xb0b1d4 of _0x66f9a5){try{const _0x57df91=_0x4b7fed[_0x48fc7b(0x249)](_0xb0b1d4[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)]),_0x497a89=yamlExperimentalArtifactToApi(_0xb0b1d4[_0x48fc7b(0x22b)],_0x23e555);if(_0x57df91)await this[_0x48fc7b(0x18a)][_0x48fc7b(0x193)](_0x57df91['id'],_0x497a89),_0x17ecfc[_0x48fc7b(0x199)](_0xb0b1d4[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],_0x57df91['id']),_0x3b18f5['experimentalArtifacts']['push']({'name':_0xb0b1d4['def'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x57df91['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1b3)][_0x48fc7b(0x1be)]++;else{const _0x54d124=await this['client'][_0x48fc7b(0x1a6)](_0x497a89);_0x17ecfc[_0x48fc7b(0x199)](_0xb0b1d4[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],_0x54d124['id']),_0x3b18f5[_0x48fc7b(0x1b3)][_0x48fc7b(0x1da)]({'name':_0xb0b1d4[_0x48fc7b(0x22b)]['name'],'action':_0x48fc7b(0x25c),'id':_0x54d124['id']}),_0x3b18f5['counts'][_0x48fc7b(0x1b3)][_0x48fc7b(0x25c)]++;}}catch(_0x4afc51){_0x3b18f5[_0x48fc7b(0x1b3)][_0x48fc7b(0x1da)]({'name':_0xb0b1d4[_0x48fc7b(0x22b)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0x4afc51[_0x48fc7b(0x250)]}),_0x3b18f5[_0x48fc7b(0x207)]['experimentalArtifacts'][_0x48fc7b(0x156)]++;}}for(const _0x319ec1 of _0x5d561a){_0x288a85=[];try{const _0xa8626a=_0x4ce081[_0x48fc7b(0x249)](_0x319ec1[_0x48fc7b(0x1d3)]['name']),_0x4b4ce4=await agentDefToRequest(_0x319ec1[_0x48fc7b(0x1d3)],_0x319ec1[_0x48fc7b(0x16f)],_0x319ec1['starterMessage'],_0x50df6e);if(_0xa8626a)await this['client'][_0x48fc7b(0x237)](_0xa8626a['id'],_0x4b4ce4),_0x4315f6['set'](_0x319ec1['yaml'][_0x48fc7b(0x1c3)],_0xa8626a['id']),_0x3b18f5[_0x48fc7b(0x1e7)][_0x48fc7b(0x1da)]({'agentName':_0x319ec1['yaml'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'agentId':_0xa8626a['id'],'warnings':_0x288a85[_0x48fc7b(0x212)]>0x0?_0x288a85:undefined}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1e7)][_0x48fc7b(0x1be)]++;else{const _0x27e519=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x1eb)](_0x4b4ce4);_0x4315f6['set'](_0x319ec1[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],_0x27e519['id']),_0x3b18f5[_0x48fc7b(0x1e7)]['push']({'agentName':_0x319ec1[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c),'agentId':_0x27e519['id'],'warnings':_0x288a85[_0x48fc7b(0x212)]>0x0?_0x288a85:undefined}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x1e7)][_0x48fc7b(0x25c)]++;}}catch(_0x2a40f0){_0x3b18f5[_0x48fc7b(0x1e7)]['push']({'agentName':_0x319ec1[_0x48fc7b(0x1d3)]['name'],'action':'error','error':_0x2a40f0[_0x48fc7b(0x250)],'warnings':_0x288a85[_0x48fc7b(0x212)]>0x0?_0x288a85:undefined}),_0x3b18f5[_0x48fc7b(0x207)]['agents']['errors']++;}}for(const _0x3317c7 of _0x262d1a){try{const _0x5d66fa=_0x4f9c4c[_0x48fc7b(0x249)](_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)]),_0x53cd1e=await yamlPromptToApi(_0x3317c7[_0x48fc7b(0x1d3)],_0x23e555,_0x50df6e);if(!_0x53cd1e){_0x3b18f5[_0x48fc7b(0x236)]['push']({'name':_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0x48fc7b(0x1a5)}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)]['errors']++;continue;}if(_0x5d66fa)await this['client']['updatePrompt'](_0x5d66fa['id'],_0x53cd1e),_0x167009[_0x48fc7b(0x199)](_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],_0x5d66fa['id']),_0x3b18f5['prompts'][_0x48fc7b(0x1da)]({'name':_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x5d66fa['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)][_0x48fc7b(0x1be)]++;else{const _0x1d2bde=await this['client'][_0x48fc7b(0x17e)](_0x53cd1e);_0x167009[_0x48fc7b(0x199)](_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],_0x1d2bde['id']),_0x3b18f5[_0x48fc7b(0x236)][_0x48fc7b(0x1da)]({'name':_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c),'id':_0x1d2bde['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)]['created']++;}}catch(_0x1361fc){_0x3b18f5[_0x48fc7b(0x236)][_0x48fc7b(0x1da)]({'name':_0x3317c7[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0x1361fc[_0x48fc7b(0x250)]}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x236)][_0x48fc7b(0x156)]++;}}for(const _0x27c536 of _0x2d98be){try{const _0x4fb67c=_0x3439ff[_0x48fc7b(0x249)](_0x27c536[_0x48fc7b(0x1d3)][_0x48fc7b(0x21d)]),_0x3302bc=await yamlIntegrationToApi(_0x27c536[_0x48fc7b(0x1d3)],_0x23e555,_0x50df6e);if(_0x4fb67c){await this['client'][_0x48fc7b(0x1e1)](_0x4fb67c['id']);const _0x1069bd=await this['client'][_0x48fc7b(0x25b)](_0x3302bc);_0x3b18f5[_0x48fc7b(0x25a)][_0x48fc7b(0x1da)]({'name':_0x27c536[_0x48fc7b(0x1d3)]['service_type'],'action':_0x48fc7b(0x1be),'id':_0x1069bd['id']}),_0x3b18f5['counts'][_0x48fc7b(0x25a)][_0x48fc7b(0x1be)]++;}else{const _0x496302=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x25b)](_0x3302bc);_0x3b18f5['integrations'][_0x48fc7b(0x1da)]({'name':_0x27c536[_0x48fc7b(0x1d3)][_0x48fc7b(0x21d)],'action':_0x48fc7b(0x25c),'id':_0x496302['id']}),_0x3b18f5[_0x48fc7b(0x207)]['integrations'][_0x48fc7b(0x25c)]++;}}catch(_0x2fbbf1){_0x3b18f5[_0x48fc7b(0x25a)]['push']({'name':_0x27c536[_0x48fc7b(0x1d3)]['service_type'],'action':_0x48fc7b(0x171),'error':_0x2fbbf1[_0x48fc7b(0x250)]}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x25a)][_0x48fc7b(0x156)]++;}}for(const _0x269fb6 of _0x40e69d){try{const _0x310fb9=_0x115cca[_0x48fc7b(0x249)](_0x269fb6[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)]),_0x4fee2b=await yamlFormInterfaceToApi(_0x269fb6[_0x48fc7b(0x1d3)],_0x23e555,_0x50df6e);if(!_0x4fee2b){_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x269fb6[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':'error','error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x3b18f5['counts'][_0x48fc7b(0x178)]['errors']++;continue;}if(_0x310fb9){const _0x52fa09=await this['client']['updateFormInterface'](_0x310fb9['id'],_0x4fee2b);_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x269fb6[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x52fa09['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x178)][_0x48fc7b(0x1be)]++;}else{const _0x550dce=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x22c)](_0x4fee2b);_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x269fb6['yaml']['name'],'action':'created','id':_0x550dce['id']}),_0x3b18f5['counts'][_0x48fc7b(0x178)]['created']++;}}catch(_0xb12a2d){_0x3b18f5[_0x48fc7b(0x178)][_0x48fc7b(0x1da)]({'name':_0x269fb6[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0xb12a2d['message']}),_0x3b18f5[_0x48fc7b(0x207)]['formInterfaces']['errors']++;}}for(const _0x560795 of _0x35e986){try{const _0x19e4f5=_0x1480a0[_0x48fc7b(0x249)](_0x560795['yaml']['name']),_0x13f636=await yamlChatInterfaceToApi(_0x560795[_0x48fc7b(0x1d3)],_0x23e555,_0x50df6e);if(_0x19e4f5){const _0x2355a7=await this[_0x48fc7b(0x18a)]['updateChatInterface'](_0x19e4f5['id'],_0x13f636);_0x3b18f5['chatInterfaces'][_0x48fc7b(0x1da)]({'name':_0x560795[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x1be),'id':_0x2355a7['id']}),_0x3b18f5[_0x48fc7b(0x207)][_0x48fc7b(0x247)][_0x48fc7b(0x1be)]++;}else{const _0x16de73=await this[_0x48fc7b(0x18a)][_0x48fc7b(0x13d)](_0x13f636);_0x3b18f5[_0x48fc7b(0x247)][_0x48fc7b(0x1da)]({'name':_0x560795['yaml'][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x25c),'id':_0x16de73['id']}),_0x3b18f5['counts'][_0x48fc7b(0x247)][_0x48fc7b(0x25c)]++;}}catch(_0x450958){_0x3b18f5['chatInterfaces'][_0x48fc7b(0x1da)]({'name':_0x560795[_0x48fc7b(0x1d3)][_0x48fc7b(0x1c3)],'action':_0x48fc7b(0x171),'error':_0x450958[_0x48fc7b(0x250)]}),_0x3b18f5['counts'][_0x48fc7b(0x247)][_0x48fc7b(0x156)]++;}}return _0x3b18f5;}async[a133_0xe8af3(0x13f)](_0x4e8bb6,_0x53d3cb,_0x4bc397,_0x5ca258){const _0x22ac66=a133_0xe8af3,{projectId:_0x2d7ab8,project:_0x50d93a}=await this[_0x22ac66(0x14e)](_0x4e8bb6),_0x34b0f5=_0x50d93a['attributes'][_0x22ac66(0x1c3)],_0x36c30c=await this[_0x22ac66(0x18a)][_0x22ac66(0x1d8)](_0x2d7ab8),_0x5b085c=_0x36c30c[_0x22ac66(0x1a2)](_0x45a593=>_0x45a593['attributes']['name']===_0x53d3cb);if(!_0x5b085c)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x22ac66(0x185)+_0x53d3cb,undefined,{'helpText':'Available\x20agents:\x20'+_0x36c30c[_0x22ac66(0x150)](_0x8aa71=>_0x8aa71['attributes'][_0x22ac66(0x1c3)])[_0x22ac66(0x1e6)](',\x20')});let _0x18151f;if(_0x4bc397)_0x18151f=_0x4bc397;else{const _0x574463=a133_0xcf5d58[_0x22ac66(0x1e6)](process[_0x22ac66(0x15d)](),'agents'),_0x21f35b=getSanitizedPathWithMigration(_0x574463,_0x34b0f5);_0x21f35b[_0x22ac66(0x1d7)]&&this[_0x22ac66(0x157)][_0x22ac66(0x1ed)]('Renamed\x20folder:\x20'+a133_0xcf5d58['basename'](_0x21f35b[_0x22ac66(0x251)])+'\x20→\x20'+a133_0xcf5d58[_0x22ac66(0x1c8)](_0x21f35b[_0x22ac66(0x25d)])),_0x18151f=_0x21f35b['path'];}const _0x4d8e2e=getSanitizedPathWithMigration(_0x18151f,_0x53d3cb);_0x4d8e2e[_0x22ac66(0x1d7)]&&this[_0x22ac66(0x157)][_0x22ac66(0x1ed)](_0x22ac66(0x20b)+a133_0xcf5d58[_0x22ac66(0x1c8)](_0x4d8e2e[_0x22ac66(0x251)])+'\x20→\x20'+a133_0xcf5d58[_0x22ac66(0x1c8)](_0x4d8e2e['path']));const _0x402a28=_0x4d8e2e[_0x22ac66(0x25d)],_0x164f5a=new Map(),_0x51013d=new Map(),_0x49691d=await this[_0x22ac66(0x18a)]['listKnowledgeBases'](_0x2d7ab8),_0x40ea9d=await this[_0x22ac66(0x18a)][_0x22ac66(0x239)](_0x2d7ab8),_0xb93d55=await safeListOrEmpty(()=>this[_0x22ac66(0x18a)]['listExperimentalKnowledgeBases'](_0x2d7ab8)),_0x5d8e68=new Map(),_0x2df07f=new Map();for(const _0x51a528 of _0x49691d){_0x164f5a['set'](_0x51a528['id'],_0x51a528[_0x22ac66(0x222)][_0x22ac66(0x1c3)]);}for(const _0x2b2eae of _0x40ea9d){_0x5d8e68[_0x22ac66(0x199)](_0x2b2eae['id'],_0x2b2eae[_0x22ac66(0x222)]['name']);}for(const _0x520639 of _0xb93d55){_0x2df07f[_0x22ac66(0x199)](_0x520639['id'],_0x520639['attributes']['name']);}for(const _0x5a808a of _0x36c30c){_0x51013d['set'](_0x5a808a['id'],_0x5a808a[_0x22ac66(0x222)][_0x22ac66(0x1c3)]);}const _0x3a4b8f={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x164f5a,'TextKnowledgeBase':_0x5d8e68,'Agent':_0x51013d,'ExperimentalKnowledgeBase':_0x2df07f}),'resolvePromptName':async()=>undefined,'onWarning':_0x2081d1=>this[_0x22ac66(0x157)]['warn'](_0x2081d1)},_0x119e38=a133_0xcf5d58[_0x22ac66(0x1e6)](_0x402a28,_0x22ac66(0x1d5)),_0x24c7a9=a133_0xcf5d58['join'](_0x402a28,'agent.yml'),_0x3a6119=a133_0xcf5d58[_0x22ac66(0x1e6)](_0x402a28,_0x22ac66(0x1fd)),_0x7dfd80=!a133_0x8c5550['existsSync'](_0x24c7a9);if(_0x5ca258?.[_0x22ac66(0x234)])return{'agentName':_0x53d3cb,'outputPath':_0x402a28,'isNew':_0x7dfd80,'hasChanges':!![]};a133_0x8c5550['mkdirSync'](_0x18151f,{'recursive':!![]}),a133_0x8c5550[_0x22ac66(0x1e4)](_0x402a28,{'recursive':!![]});const _0x2cb5dc=a133_0xcf5d58[_0x22ac66(0x1e6)](_0x18151f,'tdx.json');!a133_0x8c5550[_0x22ac66(0x229)](_0x2cb5dc)&&a133_0x8c5550[_0x22ac66(0x22f)](_0x2cb5dc,createAgentConfigContent(_0x4e8bb6));const {yaml:_0x16021d,systemPrompt:_0x1ba8fa,starterMessage:_0x10fea5}=await agentResponseToDef(_0x5b085c,_0x3a4b8f);let _0x31ea9a=_0x7dfd80;if(!_0x7dfd80){const _0x2d9c4c=a133_0x8c5550[_0x22ac66(0x229)](_0x119e38)?a133_0x8c5550[_0x22ac66(0x1b1)](_0x119e38,_0x22ac66(0x189)):'',_0x3bfb5e=a133_0x8c5550['readFileSync'](_0x24c7a9,'utf-8');_0x31ea9a=_0x2d9c4c!==_0x1ba8fa||_0x3bfb5e!==toAgentYamlString(_0x16021d);}a133_0x8c5550[_0x22ac66(0x22f)](_0x119e38,_0x1ba8fa),a133_0x8c5550[_0x22ac66(0x22f)](_0x24c7a9,toAgentYamlString(_0x16021d));if(_0x10fea5&&_0x10fea5[_0x22ac66(0x16a)]('\x0a'))a133_0x8c5550['writeFileSync'](_0x3a6119,_0x10fea5);else a133_0x8c5550[_0x22ac66(0x229)](_0x3a6119)&&a133_0x8c5550[_0x22ac66(0x1c1)](_0x3a6119);return{'agentName':_0x53d3cb,'outputPath':_0x402a28,'isNew':_0x7dfd80,'hasChanges':_0x31ea9a};}async['pushAgent'](_0x469145,_0x505b5c){const _0x2cb9e1=a133_0xe8af3;let _0x2f2b8e;isAgentYamlPath(_0x469145)?_0x2f2b8e=getAgentDirFromYamlPath(_0x469145):_0x2f2b8e=_0x469145;const {config:_0x291bae}=findAgentConfig(_0x2f2b8e),_0x5b1084=await this[_0x2cb9e1(0x1c5)](_0x291bae[_0x2cb9e1(0x181)]),_0x103dea=a133_0xcf5d58[_0x2cb9e1(0x1e6)](_0x2f2b8e,_0x2cb9e1(0x198)),_0x1b8c72=a133_0xcf5d58[_0x2cb9e1(0x1e6)](_0x2f2b8e,_0x2cb9e1(0x1d5)),_0x4c3a32=a133_0xcf5d58[_0x2cb9e1(0x1e6)](_0x2f2b8e,_0x2cb9e1(0x1fd));if(!a133_0x8c5550[_0x2cb9e1(0x229)](_0x103dea))throw new SDKError(ErrorCode['NOT_FOUND'],_0x2cb9e1(0x177)+_0x2f2b8e,undefined,{'helpText':_0x2cb9e1(0x13a)});const _0x3343b4=parseAgentYaml(a133_0x8c5550[_0x2cb9e1(0x1b1)](_0x103dea,_0x2cb9e1(0x189)),_0x103dea),_0x3e0972=a133_0x8c5550[_0x2cb9e1(0x229)](_0x1b8c72)?a133_0x8c5550['readFileSync'](_0x1b8c72,_0x2cb9e1(0x189)):'',_0x58bd2e=a133_0x8c5550[_0x2cb9e1(0x229)](_0x4c3a32)?a133_0x8c5550[_0x2cb9e1(0x1b1)](_0x4c3a32,_0x2cb9e1(0x189)):_0x3343b4['starter_message'];if(_0x505b5c?.[_0x2cb9e1(0x234)])return{'agentName':_0x3343b4[_0x2cb9e1(0x1c3)],'action':'created','projectId':_0x5b1084};const _0x7ff6a3=await this[_0x2cb9e1(0x18a)]['listAgentsFull'](_0x5b1084),_0x521d82=await fetchAllToolTargetMaps((_0xd7d10f,_0xc4acad)=>this[_0x2cb9e1(0x18a)][_0x2cb9e1(0x24b)](_0xd7d10f,_0xc4acad),_0x5b1084),_0x21cca7=new Map();for(const _0x2567fc of _0x7ff6a3){_0x21cca7[_0x2cb9e1(0x199)](_0x2567fc['attributes'][_0x2cb9e1(0x1c3)],_0x2567fc['id']);}const _0x34fd76=[],_0x4d7370={'projectId':_0x5b1084,'resolveToolTargetId':buildIdResolver({..._0x521d82[_0x2cb9e1(0x23f)],'Agent':_0x21cca7}),'resolvePromptId':async()=>undefined,'onWarning':_0x46c8d1=>{const _0x1b0a45=_0x2cb9e1;this['logger']['warn'](_0x46c8d1),_0x34fd76[_0x1b0a45(0x1da)](_0x46c8d1);}};try{const _0x258cf8=_0x7ff6a3[_0x2cb9e1(0x1a2)](_0xa4cf73=>_0xa4cf73[_0x2cb9e1(0x222)]['name']===_0x3343b4[_0x2cb9e1(0x1c3)]),_0x49b267=await agentDefToRequest(_0x3343b4,_0x3e0972,_0x58bd2e,_0x4d7370);if(_0x258cf8)return await this[_0x2cb9e1(0x18a)][_0x2cb9e1(0x237)](_0x258cf8['id'],_0x49b267),{'agentName':_0x3343b4['name'],'action':_0x2cb9e1(0x1be),'projectId':_0x5b1084,'agentId':_0x258cf8['id'],'warnings':_0x34fd76[_0x2cb9e1(0x212)]>0x0?_0x34fd76:undefined};else{const _0xa96a75=await this['client'][_0x2cb9e1(0x1eb)](_0x49b267);return{'agentName':_0x3343b4[_0x2cb9e1(0x1c3)],'action':'created','projectId':_0x5b1084,'agentId':_0xa96a75['id'],'warnings':_0x34fd76['length']>0x0?_0x34fd76:undefined};}}catch(_0x1b218e){return{'agentName':_0x3343b4[_0x2cb9e1(0x1c3)],'action':_0x2cb9e1(0x171),'projectId':_0x5b1084,'error':_0x1b218e[_0x2cb9e1(0x250)],'warnings':_0x34fd76['length']>0x0?_0x34fd76:undefined};}}async[a133_0xe8af3(0x140)](_0x87f541,_0x266a35,_0x85bd8f){const _0x48f258=a133_0xe8af3,_0x33b353=a133_0x8c5550['existsSync'](_0x87f541)&&a133_0x8c5550[_0x48f258(0x229)](a133_0xcf5d58[_0x48f258(0x1e6)](_0x87f541,_0x48f258(0x243)));let _0x3f88d0;const _0x7c8a5=[],_0x2513fd=[],_0x3cc725=[],_0x526bdd=[],_0x9fd8b5=[],_0x1355c9=[],_0x451242=[],_0x40622e=[],_0x2b92c6=[];if(_0x33b353){const _0x40c67c=loadAgentConfig(a133_0xcf5d58[_0x48f258(0x1e6)](_0x87f541,_0x48f258(0x243)));_0x3f88d0=_0x40c67c[_0x48f258(0x181)];const _0x34ace1=a133_0x8c5550[_0x48f258(0x1ee)](_0x87f541,{'withFileTypes':!![]});for(const _0x311755 of _0x34ace1){if(!_0x311755[_0x48f258(0x24c)]())continue;if([_0x48f258(0x21f),_0x48f258(0x196),_0x48f258(0x175),_0x48f258(0x236),_0x48f258(0x25a),_0x48f258(0x174),_0x48f258(0x1a1)][_0x48f258(0x16a)](_0x311755[_0x48f258(0x1c3)]))continue;const _0x318afa=a133_0xcf5d58[_0x48f258(0x1e6)](_0x87f541,_0x311755[_0x48f258(0x1c3)]);if(isAgentDir(_0x318afa)){const _0x246237=a133_0xcf5d58[_0x48f258(0x1e6)](_0x318afa,'agent.yml'),_0x453ce9=a133_0xcf5d58[_0x48f258(0x1e6)](_0x318afa,_0x48f258(0x1d5)),_0x7e19c4=a133_0xcf5d58['join'](_0x318afa,_0x48f258(0x1fd)),_0x33e91f=parseAgentYaml(a133_0x8c5550['readFileSync'](_0x246237,_0x48f258(0x189)),_0x246237),_0x5da86a=a133_0x8c5550[_0x48f258(0x229)](_0x453ce9)?a133_0x8c5550[_0x48f258(0x1b1)](_0x453ce9,_0x48f258(0x189)):'',_0x2b6a3e=a133_0x8c5550[_0x48f258(0x229)](_0x7e19c4)?a133_0x8c5550[_0x48f258(0x1b1)](_0x7e19c4,_0x48f258(0x189)):_0x33e91f['starter_message'];_0x7c8a5[_0x48f258(0x1da)]({'name':_0x33e91f[_0x48f258(0x1c3)],'dir':_0x318afa,'yaml':_0x33e91f,'systemPrompt':_0x5da86a,'starterMessage':_0x2b6a3e});}}const _0x58fd86=getKnowledgeBasesDir(_0x87f541);if(a133_0x8c5550['existsSync'](_0x58fd86)){const _0x55485b=a133_0x8c5550[_0x48f258(0x1ee)](_0x58fd86);for(const _0x328417 of _0x55485b){const _0x584b4b=a133_0xcf5d58['join'](_0x58fd86,_0x328417);if(_0x328417['endsWith']('.yml')){const _0x2cb780=parseKnowledgeBaseYaml(a133_0x8c5550['readFileSync'](_0x584b4b,_0x48f258(0x189)),_0x584b4b);_0x2513fd['push']({'name':_0x2cb780[_0x48f258(0x1c3)],'path':_0x584b4b,'yaml':_0x2cb780});}else{if(_0x328417[_0x48f258(0x1b9)](_0x48f258(0x1fb))){const _0x5edcb4=a133_0x8c5550[_0x48f258(0x1b1)](_0x584b4b,'utf-8'),{name:_0x450474,text:_0x59e86c}=parseTextKnowledgeBaseMd(_0x5edcb4,_0x328417);_0x3cc725['push']({'name':_0x450474,'path':_0x584b4b,'text':_0x59e86c});}}}}const _0x329c92=getPromptsDir(_0x87f541);if(a133_0x8c5550['existsSync'](_0x329c92)){const _0x223aff=a133_0x8c5550[_0x48f258(0x1ee)](_0x329c92)[_0x48f258(0x146)](_0x11433e=>_0x11433e[_0x48f258(0x1b9)](_0x48f258(0x218)));for(const _0x16fdd5 of _0x223aff){const _0x240ccd=a133_0xcf5d58[_0x48f258(0x1e6)](_0x329c92,_0x16fdd5),_0x5b668e=parsePromptYaml(a133_0x8c5550['readFileSync'](_0x240ccd,_0x48f258(0x189)),_0x240ccd);_0x526bdd[_0x48f258(0x1da)]({'name':_0x5b668e['name'],'path':_0x240ccd,'yaml':_0x5b668e});}}const _0x457af0=getIntegrationsDir(_0x87f541);if(a133_0x8c5550[_0x48f258(0x229)](_0x457af0)){const _0x4320bc=a133_0x8c5550['readdirSync'](_0x457af0)[_0x48f258(0x146)](_0x5309a9=>_0x5309a9[_0x48f258(0x1b9)]('.yml'));for(const _0x34e212 of _0x4320bc){const _0x5b0e11=a133_0xcf5d58['join'](_0x457af0,_0x34e212),_0x2453b9=parseIntegrationYaml(a133_0x8c5550[_0x48f258(0x1b1)](_0x5b0e11,'utf-8'),_0x5b0e11);SAFE_INTEGRATION_TYPES[_0x48f258(0x16a)](_0x2453b9['service_type'][_0x48f258(0x153)]())?_0x9fd8b5[_0x48f258(0x1da)]({'name':_0x2453b9[_0x48f258(0x1c3)],'path':_0x5b0e11,'yaml':_0x2453b9}):this[_0x48f258(0x157)][_0x48f258(0x14b)](_0x48f258(0x14c)+_0x2453b9[_0x48f258(0x1c3)]+_0x48f258(0x227)+_0x2453b9['service_type']+_0x48f258(0x1ad)+(_0x48f258(0x176)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x48f258(0x14f)));}}const _0x399898=getExperimentalKnowledgeBasesDir(_0x87f541);if(a133_0x8c5550['existsSync'](_0x399898)){const _0x1dae39=a133_0x8c5550[_0x48f258(0x1ee)](_0x399898,{'withFileTypes':!![]});for(const _0x385f10 of _0x1dae39){if(!_0x385f10[_0x48f258(0x24c)]())continue;const _0xba7d3=a133_0xcf5d58[_0x48f258(0x1e6)](_0x399898,_0x385f10['name']),_0x4f5d31=a133_0xcf5d58[_0x48f258(0x1e6)](_0xba7d3,_0x385f10[_0x48f258(0x1c3)]+_0x48f258(0x218));if(a133_0x8c5550['existsSync'](_0x4f5d31)){const _0x1329a7=parseExperimentalKnowledgeBaseYaml(a133_0x8c5550[_0x48f258(0x1b1)](_0x4f5d31,_0x48f258(0x189)),_0x4f5d31),_0x548f1c=a133_0xcf5d58[_0x48f258(0x1e6)](_0xba7d3,_0x48f258(0x1b8)),_0x171782=[];if(a133_0x8c5550[_0x48f258(0x229)](_0x548f1c)){const _0x152a62=a133_0x8c5550[_0x48f258(0x1ee)](_0x548f1c,{'withFileTypes':!![]});for(const _0x43bb0a of _0x152a62){if(!_0x43bb0a['isDirectory']())continue;const _0x1b011f=a133_0xcf5d58['join'](_0x548f1c,_0x43bb0a[_0x48f258(0x1c3)]),_0x1dd559=a133_0xcf5d58[_0x48f258(0x1e6)](_0x1b011f,_0x48f258(0x20a)),_0x415eaf=a133_0xcf5d58[_0x48f258(0x1e6)](_0x1b011f,_0x48f258(0x145));if(a133_0x8c5550[_0x48f258(0x229)](_0x1dd559)&&a133_0x8c5550[_0x48f258(0x229)](_0x415eaf)){const _0x44d0f5=a133_0x8c5550[_0x48f258(0x1b1)](_0x1dd559,_0x48f258(0x189)),_0xde0610=a133_0x8c5550[_0x48f258(0x1b1)](_0x415eaf,_0x48f258(0x189));_0x171782['push']({'name':_0x43bb0a[_0x48f258(0x1c3)],'code':_0x44d0f5,'json_schema':_0xde0610});}}}const _0x20eb07={..._0x1329a7,'functions':_0x171782};_0x1355c9['push']({'name':_0x1329a7[_0x48f258(0x1c3)],'path':_0xba7d3,'def':_0x20eb07});}}}const _0x2a0adb=getExperimentalArtifactsDir(_0x87f541);if(a133_0x8c5550['existsSync'](_0x2a0adb)){const _0xeb351e=a133_0x8c5550[_0x48f258(0x1ee)](_0x2a0adb,{'withFileTypes':!![]});for(const _0x3c2a62 of _0xeb351e){if(!_0x3c2a62['isDirectory']())continue;const _0x3ebafd=a133_0xcf5d58['join'](_0x2a0adb,_0x3c2a62['name']),_0x5ea449=a133_0xcf5d58['join'](_0x3ebafd,_0x3c2a62['name']+_0x48f258(0x218));if(a133_0x8c5550['existsSync'](_0x5ea449)){const _0x509c95=parseExperimentalArtifactYaml(a133_0x8c5550[_0x48f258(0x1b1)](_0x5ea449,_0x48f258(0x189)),_0x5ea449),_0x54d9cb=a133_0xcf5d58['join'](_0x3ebafd,_0x48f258(0x20a)),_0xb845d9=a133_0x8c5550['existsSync'](_0x54d9cb)?a133_0x8c5550[_0x48f258(0x1b1)](_0x54d9cb,_0x48f258(0x189)):'',_0x42c387=a133_0xcf5d58[_0x48f258(0x1e6)](_0x3ebafd,_0x48f258(0x1d1)),_0x2a4d50=[];if(a133_0x8c5550[_0x48f258(0x229)](_0x42c387)){const _0x704865=a133_0x8c5550[_0x48f258(0x1ee)](_0x42c387);for(const _0x38ca1c of _0x704865){const _0x307ef8=a133_0xcf5d58[_0x48f258(0x1e6)](_0x42c387,_0x38ca1c);if(a133_0x8c5550['statSync'](_0x307ef8)[_0x48f258(0x166)]()){const _0x55e221=a133_0x8c5550[_0x48f258(0x1b1)](_0x307ef8,_0x48f258(0x189));_0x2a4d50[_0x48f258(0x1da)]({'file_name':_0x38ca1c,'text_content':_0x55e221});}}}const _0x13bb0d={..._0x509c95,'code':_0xb845d9,'files':_0x2a4d50};_0x451242[_0x48f258(0x1da)]({'name':_0x509c95[_0x48f258(0x1c3)],'path':_0x3ebafd,'def':_0x13bb0d});}}}const _0x225705=getFormInterfacesDir(_0x87f541);if(a133_0x8c5550[_0x48f258(0x229)](_0x225705)){const _0x225202=a133_0x8c5550['readdirSync'](_0x225705)[_0x48f258(0x146)](_0x16817d=>_0x16817d['endsWith'](_0x48f258(0x218)));for(const _0x1c5a9a of _0x225202){const _0x760055=a133_0xcf5d58[_0x48f258(0x1e6)](_0x225705,_0x1c5a9a),_0x3b56c8=parseFormInterfaceYaml(a133_0x8c5550[_0x48f258(0x1b1)](_0x760055,_0x48f258(0x189)),_0x760055);_0x40622e[_0x48f258(0x1da)]({'name':_0x3b56c8[_0x48f258(0x1c3)],'path':_0x760055,'yaml':_0x3b56c8});}}const _0x44192c=getChatInterfacesDir(_0x87f541);if(a133_0x8c5550[_0x48f258(0x229)](_0x44192c)){const _0x25594f=a133_0x8c5550[_0x48f258(0x1ee)](_0x44192c)[_0x48f258(0x146)](_0x1e397b=>_0x1e397b[_0x48f258(0x1b9)](_0x48f258(0x218)));for(const _0x85b321 of _0x25594f){const _0xa3e8d6=a133_0xcf5d58['join'](_0x44192c,_0x85b321),_0x15ce7e=parseChatInterfaceYaml(a133_0x8c5550[_0x48f258(0x1b1)](_0xa3e8d6,'utf-8'),_0xa3e8d6);_0x2b92c6[_0x48f258(0x1da)]({'name':_0x15ce7e['name'],'path':_0xa3e8d6,'yaml':_0x15ce7e});}}}else{const _0x52b9e1=await this[_0x48f258(0x1c5)](_0x87f541),_0x105ae9=await this[_0x48f258(0x18a)][_0x48f258(0x1d4)](_0x52b9e1);_0x3f88d0=_0x105ae9[_0x48f258(0x222)][_0x48f258(0x1c3)];const _0x5bf0a0=await this[_0x48f258(0x18a)][_0x48f258(0x1d8)](_0x52b9e1),_0x18f8b9=await this[_0x48f258(0x18a)][_0x48f258(0x183)](_0x52b9e1),_0x31908e=await this['client'][_0x48f258(0x239)](_0x52b9e1),_0x5e4226=await this['client'][_0x48f258(0x21e)](_0x52b9e1),_0x3fdd9d=await this['client']['listIntegrations'](_0x52b9e1),_0x3a32e0=await safeListOrEmpty(()=>this['client'][_0x48f258(0x1a0)](_0x52b9e1)),_0x44cb2b=await safeListOrEmpty(()=>this[_0x48f258(0x18a)]['listExperimentalArtifacts'](_0x52b9e1)),_0x148fb2=new Map(),_0x15e18c=new Map(),_0x5e7706=new Map(),_0x38c672=new Map(),_0x383a93=new Map(),_0x3c66dc=new Map();for(const _0x38d1e1 of _0x18f8b9){_0x148fb2[_0x48f258(0x199)](_0x38d1e1['id'],_0x38d1e1['attributes'][_0x48f258(0x1c3)]);}for(const _0x54c6c1 of _0x31908e){_0x15e18c[_0x48f258(0x199)](_0x54c6c1['id'],_0x54c6c1[_0x48f258(0x222)][_0x48f258(0x1c3)]);}for(const _0x2bbc0c of _0x5bf0a0){_0x5e7706[_0x48f258(0x199)](_0x2bbc0c['id'],_0x2bbc0c[_0x48f258(0x222)]['name']);}for(const _0x179256 of _0x5e4226){_0x38c672['set'](_0x179256['id'],_0x179256[_0x48f258(0x222)]['name']);}for(const _0x1d238f of _0x3a32e0){_0x383a93[_0x48f258(0x199)](_0x1d238f['id'],_0x1d238f[_0x48f258(0x222)][_0x48f258(0x1c3)]);}for(const _0x24ba4e of _0x44cb2b){_0x3c66dc[_0x48f258(0x199)](_0x24ba4e['id'],_0x24ba4e['attributes'][_0x48f258(0x1c3)]);}const _0x4c7cfd={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x148fb2,'TextKnowledgeBase':_0x15e18c,'Agent':_0x5e7706,'ExperimentalKnowledgeBase':_0x383a93}),'resolvePromptName':async _0x32521f=>_0x38c672[_0x48f258(0x249)](_0x32521f),'onWarning':_0x2d143c=>this[_0x48f258(0x157)][_0x48f258(0x14b)](_0x2d143c)};for(const _0x340920 of _0x5bf0a0){const _0x2eda91=await agentResponseToDef(_0x340920,_0x4c7cfd),{yaml:_0x22641c,systemPrompt:_0x3083b4,starterMessage:_0x398ea0}=_0x2eda91;_0x7c8a5['push']({'name':_0x22641c[_0x48f258(0x1c3)],'dir':'','yaml':_0x22641c,'systemPrompt':_0x3083b4,'starterMessage':_0x398ea0});}for(const _0x422332 of _0x18f8b9){const _0x16aa24=apiKnowledgeBaseToYaml(_0x422332);_0x2513fd[_0x48f258(0x1da)]({'name':_0x16aa24[_0x48f258(0x1c3)],'path':'','yaml':_0x16aa24});}for(const _0x5679fe of _0x31908e){_0x3cc725[_0x48f258(0x1da)]({'name':_0x5679fe['attributes'][_0x48f258(0x1c3)],'path':'','text':_0x5679fe['attributes'][_0x48f258(0x248)]});}for(const _0x30a779 of _0x5e4226){const _0x1d7011=await apiPromptToYaml(_0x30a779,_0x4c7cfd);_0x1d7011&&_0x526bdd[_0x48f258(0x1da)]({'name':_0x1d7011[_0x48f258(0x1c3)],'path':'','yaml':_0x1d7011});}for(const _0x3c162a of _0x3fdd9d){if(!_0x3c162a[_0x48f258(0x222)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x48f258(0x16a)](_0x3c162a['attributes']['serviceType'][_0x48f258(0x153)]())){const _0x5c8d4d=await apiIntegrationToYaml(_0x3c162a,_0x4c7cfd);_0x9fd8b5['push']({'name':_0x3c162a['attributes']['serviceType'][_0x48f258(0x153)](),'path':'','yaml':_0x5c8d4d});}}for(const _0x35b075 of _0x3a32e0){const _0x55cccb=apiExperimentalKnowledgeBaseToYaml(_0x35b075);_0x1355c9[_0x48f258(0x1da)]({'name':_0x55cccb[_0x48f258(0x1c3)],'path':'','def':_0x55cccb});}for(const _0x133677 of _0x44cb2b){const _0x1319b4=apiExperimentalArtifactToYaml(_0x133677);_0x451242['push']({'name':_0x1319b4[_0x48f258(0x1c3)],'path':'','def':_0x1319b4});}const _0x273eb2=await safeListOrEmpty(()=>this['client'][_0x48f258(0x142)](_0x52b9e1));for(const _0x581d6e of _0x273eb2){const _0x18b6a1=await apiFormInterfaceToYaml(_0x581d6e,_0x4c7cfd);_0x40622e[_0x48f258(0x1da)]({'name':_0x18b6a1[_0x48f258(0x1c3)],'path':'','yaml':_0x18b6a1});}const _0x50804e=await safeListOrEmpty(()=>this['client'][_0x48f258(0x223)](_0x52b9e1));for(const _0x265218 of _0x50804e){if(_0x265218[_0x48f258(0x222)][_0x48f258(0x18b)])continue;const _0x57a75b=await apiChatInterfaceToYaml(_0x265218,_0x4c7cfd);_0x2b92c6[_0x48f258(0x1da)]({'name':_0x57a75b[_0x48f258(0x1c3)],'path':'','yaml':_0x57a75b});}}const _0x383e61={'sourceProjectName':_0x3f88d0,'newProjectName':_0x266a35,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'imageGenerators':{'created':0x0,'errors':0x0},'webSearchTools':{'created':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'errors':0x0}}},_0x4bfa28=await this[_0x48f258(0x18a)]['listProjects'](),_0x4474c8=_0x4bfa28['find'](_0x56a727=>_0x56a727[_0x48f258(0x222)][_0x48f258(0x1c3)]===_0x266a35);if(_0x4474c8)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x48f258(0x1d6)+_0x266a35+_0x48f258(0x206),undefined,{'helpText':_0x48f258(0x22d)});if(_0x85bd8f?.[_0x48f258(0x234)])return _0x383e61[_0x48f258(0x207)]['agents'][_0x48f258(0x25c)]=_0x7c8a5[_0x48f258(0x212)],_0x383e61[_0x48f258(0x207)][_0x48f258(0x252)][_0x48f258(0x25c)]=_0x2513fd[_0x48f258(0x212)],_0x383e61['counts'][_0x48f258(0x1a9)][_0x48f258(0x25c)]=_0x3cc725[_0x48f258(0x212)],_0x383e61[_0x48f258(0x207)][_0x48f258(0x217)]['created']=_0x1355c9[_0x48f258(0x212)],_0x383e61[_0x48f258(0x207)][_0x48f258(0x1b3)]['created']=_0x451242[_0x48f258(0x212)],_0x383e61[_0x48f258(0x207)]['prompts'][_0x48f258(0x25c)]=_0x526bdd[_0x48f258(0x212)],_0x383e61['counts']['integrations'][_0x48f258(0x25c)]=_0x9fd8b5[_0x48f258(0x212)],_0x383e61;const _0x570503=await this[_0x48f258(0x18a)][_0x48f258(0x235)]({'name':_0x266a35}),_0x159ed9=_0x570503['id'];_0x383e61['newProjectId']=_0x159ed9;const _0x4aeb84=new Map(),_0x1e7ddc=new Map(),_0x2ab314=new Map(),_0x5d145b=new Map(),_0x2672f1=new Map(),_0x1fdfff=new Map(),_0x31756e=new Map(),_0x534df5=new Map(),_0x499be1=new Set(),_0x335729=new Set();for(const _0x36f665 of _0x7c8a5){for(const _0x19b239 of _0x36f665[_0x48f258(0x1d3)][_0x48f258(0x188)]||[]){if(_0x19b239[_0x48f258(0x23b)]===_0x48f258(0x1c4)&&_0x19b239[_0x48f258(0x1b7)]){const _0x532b9a=parseRef(_0x19b239[_0x48f258(0x1b7)]);if(_0x532b9a)_0x499be1[_0x48f258(0x228)](_0x532b9a[_0x48f258(0x1c3)]);}else{if(_0x19b239[_0x48f258(0x23b)]===_0x48f258(0x1df)&&_0x19b239[_0x48f258(0x1b7)]){const _0x21c661=parseRef(_0x19b239[_0x48f258(0x1b7)]);if(_0x21c661)_0x335729[_0x48f258(0x228)](_0x21c661[_0x48f258(0x1c3)]);}}}}for(const _0x46519a of _0x499be1){try{const _0x599118=await this['client'][_0x48f258(0x1cc)]({'projectId':_0x159ed9,'name':_0x46519a});_0x2672f1[_0x48f258(0x199)](_0x46519a,_0x599118['id']),_0x383e61[_0x48f258(0x242)][_0x48f258(0x1da)]({'name':_0x46519a,'action':_0x48f258(0x25c),'id':_0x599118['id']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x242)][_0x48f258(0x25c)]++;}catch(_0x41da4f){_0x383e61[_0x48f258(0x242)][_0x48f258(0x1da)]({'name':_0x46519a,'action':'error','error':_0x41da4f[_0x48f258(0x250)]}),_0x383e61[_0x48f258(0x207)]['imageGenerators'][_0x48f258(0x156)]++;}}for(const _0xee1ae4 of _0x335729){try{const _0x916a2f=await this[_0x48f258(0x18a)][_0x48f258(0x1f3)]({'projectId':_0x159ed9,'name':_0xee1ae4});_0x1fdfff[_0x48f258(0x199)](_0xee1ae4,_0x916a2f['id']),_0x383e61[_0x48f258(0x221)][_0x48f258(0x1da)]({'name':_0xee1ae4,'action':_0x48f258(0x25c),'id':_0x916a2f['id']}),_0x383e61[_0x48f258(0x207)]['webSearchTools'][_0x48f258(0x25c)]++;}catch(_0x466570){_0x383e61[_0x48f258(0x221)][_0x48f258(0x1da)]({'name':_0xee1ae4,'action':_0x48f258(0x171),'error':_0x466570[_0x48f258(0x250)]}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x221)][_0x48f258(0x156)]++;}}const _0x60542=await fetchAllToolTargetMaps((_0x32aa25,_0x4724ff)=>this[_0x48f258(0x18a)][_0x48f258(0x24b)](_0x32aa25,_0x4724ff),_0x159ed9);let _0x4b17e2=[];const _0x238954={'projectId':_0x159ed9,'resolveToolTargetId':buildIdResolver({..._0x60542[_0x48f258(0x23f)],'KnowledgeBase':_0x4aeb84,'TextKnowledgeBase':_0x1e7ddc,'ExperimentalKnowledgeBase':_0x31756e,'Agent':_0x2ab314,'WebSearchTool':_0x1fdfff,'ImageGenerator':_0x2672f1}),'resolvePromptId':async _0x143719=>_0x5d145b['get'](_0x143719),'onWarning':_0xb73f5e=>{const _0x5b4e5e=_0x48f258;this[_0x5b4e5e(0x157)][_0x5b4e5e(0x14b)](_0xb73f5e),_0x4b17e2[_0x5b4e5e(0x1da)](_0xb73f5e);}};for(const _0x3dc971 of _0x2513fd){try{const _0x372c18=yamlKnowledgeBaseToApi(_0x3dc971[_0x48f258(0x1d3)],_0x159ed9),_0x4483c5=await this[_0x48f258(0x18a)][_0x48f258(0x1f2)](_0x372c18);_0x4aeb84[_0x48f258(0x199)](_0x3dc971[_0x48f258(0x1d3)]['name'],_0x4483c5['id']),_0x383e61[_0x48f258(0x252)]['push']({'name':_0x3dc971[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':_0x48f258(0x25c),'id':_0x4483c5['id']}),_0x383e61['counts'][_0x48f258(0x252)][_0x48f258(0x25c)]++;}catch(_0xd47e21){_0x383e61[_0x48f258(0x252)][_0x48f258(0x1da)]({'name':_0x3dc971[_0x48f258(0x1d3)]['name'],'action':_0x48f258(0x171),'error':_0xd47e21[_0x48f258(0x250)]}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x252)][_0x48f258(0x156)]++;}}for(const _0x4e6f05 of _0x3cc725){try{const _0x54b005=yamlTextKnowledgeBaseToApi({'name':_0x4e6f05[_0x48f258(0x1c3)],'text':_0x4e6f05['text']},_0x159ed9),_0x19f324=await this[_0x48f258(0x18a)]['createTextKnowledgeBase'](_0x54b005);_0x1e7ddc[_0x48f258(0x199)](_0x4e6f05['name'],_0x19f324['id']),_0x383e61[_0x48f258(0x1a9)][_0x48f258(0x1da)]({'name':_0x4e6f05[_0x48f258(0x1c3)],'action':_0x48f258(0x25c),'id':_0x19f324['id']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x1a9)][_0x48f258(0x25c)]++;}catch(_0x5793e7){_0x383e61[_0x48f258(0x1a9)]['push']({'name':_0x4e6f05[_0x48f258(0x1c3)],'action':_0x48f258(0x171),'error':_0x5793e7[_0x48f258(0x250)]}),_0x383e61['counts'][_0x48f258(0x1a9)][_0x48f258(0x156)]++;}}for(const _0x1c0d6f of _0x451242){try{const _0xf5f8df=yamlExperimentalArtifactToApi(_0x1c0d6f[_0x48f258(0x22b)],_0x159ed9),_0x265a5e=await this[_0x48f258(0x18a)][_0x48f258(0x1a6)](_0xf5f8df);_0x534df5[_0x48f258(0x199)](_0x1c0d6f[_0x48f258(0x22b)]['name'],_0x265a5e['id']),_0x383e61[_0x48f258(0x1b3)][_0x48f258(0x1da)]({'name':_0x1c0d6f[_0x48f258(0x22b)]['name'],'action':_0x48f258(0x25c),'id':_0x265a5e['id']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x1b3)]['created']++;}catch(_0x4765e1){_0x383e61['experimentalArtifacts'][_0x48f258(0x1da)]({'name':_0x1c0d6f[_0x48f258(0x22b)]['name'],'action':'error','error':_0x4765e1['message']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x1b3)][_0x48f258(0x156)]++;}}for(const _0x3075ad of _0x1355c9){try{const _0x1ffb57=yamlExperimentalKnowledgeBaseToApi(_0x3075ad[_0x48f258(0x22b)],_0x159ed9),_0x287828=await this[_0x48f258(0x18a)][_0x48f258(0x20f)](_0x1ffb57);_0x31756e[_0x48f258(0x199)](_0x3075ad[_0x48f258(0x22b)]['name'],_0x287828['id']),_0x383e61['experimentalKnowledgeBases'][_0x48f258(0x1da)]({'name':_0x3075ad[_0x48f258(0x22b)][_0x48f258(0x1c3)],'action':_0x48f258(0x25c),'id':_0x287828['id']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x217)][_0x48f258(0x25c)]++;}catch(_0x2ff152){_0x383e61[_0x48f258(0x217)][_0x48f258(0x1da)]({'name':_0x3075ad[_0x48f258(0x22b)][_0x48f258(0x1c3)],'action':_0x48f258(0x171),'error':_0x2ff152['message']}),_0x383e61[_0x48f258(0x207)]['experimentalKnowledgeBases'][_0x48f258(0x156)]++;}}const _0x94f891=[..._0x7c8a5][_0x48f258(0x23a)]((_0x47a8b2,_0x25f837)=>{const _0x2a79af=_0x48f258,_0x260d71=_0x47a8b2[_0x2a79af(0x1d3)][_0x2a79af(0x188)]?.[_0x2a79af(0x1f0)](_0x14e857=>_0x14e857[_0x2a79af(0x23b)]==='agent')??![],_0x19b886=_0x25f837[_0x2a79af(0x1d3)]['tools']?.[_0x2a79af(0x1f0)](_0xba3f2d=>_0xba3f2d[_0x2a79af(0x23b)]===_0x2a79af(0x25e))??![];if(_0x260d71&&!_0x19b886)return 0x1;if(!_0x260d71&&_0x19b886)return-0x1;return 0x0;});for(const _0x4d215b of _0x94f891){_0x4b17e2=[];try{const _0x3ce3de=_0x4d215b[_0x48f258(0x1d3)][_0x48f258(0x188)]?.[_0x48f258(0x146)](_0x3338bb=>{const _0x47b06b=_0x48f258;if(_0x3338bb[_0x47b06b(0x23b)]==='agent'&&_0x3338bb['target']){const _0x5c0ff0=parseRef(_0x3338bb[_0x47b06b(0x1b7)]);return _0x5c0ff0?.[_0x47b06b(0x1c3)]===_0x4d215b[_0x47b06b(0x1d3)][_0x47b06b(0x1c3)];}return![];})??[];if(_0x3ce3de['length']>0x0){const _0x52f9c0=_0x48f258(0x1c2)+_0x4d215b[_0x48f258(0x1d3)][_0x48f258(0x1c3)]+_0x48f258(0x21a)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this['logger'][_0x48f258(0x14b)](_0x52f9c0),_0x4b17e2[_0x48f258(0x1da)](_0x52f9c0);}const _0x2bad42=await agentDefToRequest(_0x4d215b[_0x48f258(0x1d3)],_0x4d215b[_0x48f258(0x16f)],_0x4d215b[_0x48f258(0x1ae)],_0x238954),_0x38254b=await this[_0x48f258(0x18a)][_0x48f258(0x1eb)](_0x2bad42);_0x2ab314[_0x48f258(0x199)](_0x4d215b[_0x48f258(0x1d3)][_0x48f258(0x1c3)],_0x38254b['id']),_0x383e61[_0x48f258(0x1e7)][_0x48f258(0x1da)]({'agentName':_0x4d215b[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':'created','agentId':_0x38254b['id'],'warnings':_0x4b17e2['length']>0x0?_0x4b17e2:undefined}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x1e7)][_0x48f258(0x25c)]++;}catch(_0x100623){_0x383e61[_0x48f258(0x1e7)][_0x48f258(0x1da)]({'agentName':_0x4d215b[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':_0x48f258(0x171),'error':_0x100623[_0x48f258(0x250)],'warnings':_0x4b17e2[_0x48f258(0x212)]>0x0?_0x4b17e2:undefined}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x1e7)][_0x48f258(0x156)]++;}}for(const _0x268c63 of _0x526bdd){try{const _0x3625b5=await yamlPromptToApi(_0x268c63['yaml'],_0x159ed9,_0x238954);if(!_0x3625b5){_0x383e61[_0x48f258(0x236)]['push']({'name':_0x268c63[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':'error','error':'Agent\x20reference\x20not\x20found'}),_0x383e61[_0x48f258(0x207)]['prompts'][_0x48f258(0x156)]++;continue;}const _0x1dd4d5=await this['client']['createPrompt'](_0x3625b5);_0x5d145b[_0x48f258(0x199)](_0x268c63[_0x48f258(0x1d3)][_0x48f258(0x1c3)],_0x1dd4d5['id']),_0x383e61[_0x48f258(0x236)][_0x48f258(0x1da)]({'name':_0x268c63[_0x48f258(0x1d3)]['name'],'action':'created','id':_0x1dd4d5['id']}),_0x383e61[_0x48f258(0x207)]['prompts'][_0x48f258(0x25c)]++;}catch(_0x24d1d3){_0x383e61[_0x48f258(0x236)]['push']({'name':_0x268c63[_0x48f258(0x1d3)]['name'],'action':_0x48f258(0x171),'error':_0x24d1d3['message']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x236)][_0x48f258(0x156)]++;}}for(const _0x10d3cf of _0x9fd8b5){try{const _0x3a0ca9=await yamlIntegrationToApi(_0x10d3cf[_0x48f258(0x1d3)],_0x159ed9,_0x238954),_0x3f8999=await this[_0x48f258(0x18a)][_0x48f258(0x25b)](_0x3a0ca9);_0x383e61[_0x48f258(0x25a)][_0x48f258(0x1da)]({'name':_0x10d3cf[_0x48f258(0x1d3)][_0x48f258(0x21d)],'action':_0x48f258(0x25c),'id':_0x3f8999['id']}),_0x383e61[_0x48f258(0x207)]['integrations'][_0x48f258(0x25c)]++;}catch(_0x2fd664){_0x383e61[_0x48f258(0x25a)][_0x48f258(0x1da)]({'name':_0x10d3cf['yaml'][_0x48f258(0x21d)],'action':_0x48f258(0x171),'error':_0x2fd664[_0x48f258(0x250)]}),_0x383e61[_0x48f258(0x207)]['integrations'][_0x48f258(0x156)]++;}}for(const _0x4078c5 of _0x40622e){try{const _0x5dec43=await yamlFormInterfaceToApi(_0x4078c5[_0x48f258(0x1d3)],_0x159ed9,_0x238954);if(!_0x5dec43){_0x383e61[_0x48f258(0x178)][_0x48f258(0x1da)]({'name':_0x4078c5[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':'error','error':_0x48f258(0x1a8)}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x178)][_0x48f258(0x156)]++;continue;}const _0x3b335a=await this['client'][_0x48f258(0x22c)](_0x5dec43);_0x383e61[_0x48f258(0x178)][_0x48f258(0x1da)]({'name':_0x4078c5['yaml']['name'],'action':_0x48f258(0x25c),'id':_0x3b335a['id']}),_0x383e61['counts'][_0x48f258(0x178)][_0x48f258(0x25c)]++;}catch(_0x410266){_0x383e61['formInterfaces']['push']({'name':_0x4078c5[_0x48f258(0x1d3)][_0x48f258(0x1c3)],'action':_0x48f258(0x171),'error':_0x410266['message']}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x178)]['errors']++;}}for(const _0x569b06 of _0x2b92c6){try{const _0x458ec5=await yamlChatInterfaceToApi(_0x569b06[_0x48f258(0x1d3)],_0x159ed9,_0x238954),_0x2bb149=await this[_0x48f258(0x18a)][_0x48f258(0x13d)](_0x458ec5);_0x383e61[_0x48f258(0x247)][_0x48f258(0x1da)]({'name':_0x569b06['yaml'][_0x48f258(0x1c3)],'action':_0x48f258(0x25c),'id':_0x2bb149['id']}),_0x383e61['counts'][_0x48f258(0x247)][_0x48f258(0x25c)]++;}catch(_0x4439c7){_0x383e61[_0x48f258(0x247)][_0x48f258(0x1da)]({'name':_0x569b06[_0x48f258(0x1d3)]['name'],'action':_0x48f258(0x171),'error':_0x4439c7[_0x48f258(0x250)]}),_0x383e61[_0x48f258(0x207)][_0x48f258(0x247)]['errors']++;}}return _0x383e61;}}
|