@treasuredata/tdx 2026.8.1 → 2026.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/cas-command.js +1 -1
- package/dist/commands/cas-segment-command.js +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-always-on-campaign-pull-command.js +1 -1
- package/dist/commands/engage-always-on-campaign-push-command.js +1 -1
- package/dist/commands/engage-always-on-campaign-validate-command.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/policy-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-move-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/table-deleted.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/work-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/oauth-keychain.js +1 -1
- package/dist/core/oauth.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/site-mismatch.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/tools/work-create-item.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/auth-token.js +1 -1
- package/dist/sdk/cas/cas-api-client.d.ts +9 -3
- package/dist/sdk/cas/cas-api-client.d.ts.map +1 -1
- package/dist/sdk/cas/cas-api-client.js +1 -1
- package/dist/sdk/cas/cas-api-client.js.map +1 -1
- package/dist/sdk/cas/cas-audience-schema.d.ts +2 -0
- package/dist/sdk/cas/cas-audience-schema.d.ts.map +1 -1
- package/dist/sdk/cas/cas-audience-schema.js +1 -1
- package/dist/sdk/cas/cas-audience-schema.js.map +1 -1
- package/dist/sdk/cas/cas-audience-validator.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.d.ts.map +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js.map +1 -1
- package/dist/sdk/cas/cas-segment-yaml.js +1 -1
- package/dist/sdk/cas/index.d.ts +10 -0
- package/dist/sdk/cas/index.d.ts.map +1 -1
- package/dist/sdk/cas/index.js +1 -1
- package/dist/sdk/cas/index.js.map +1 -1
- package/dist/sdk/cas/pull-workflow.js +1 -1
- package/dist/sdk/cas/push-workflow.d.ts.map +1 -1
- package/dist/sdk/cas/push-workflow.js +1 -1
- package/dist/sdk/cas/push-workflow.js.map +1 -1
- package/dist/sdk/cas/types.d.ts +2 -0
- package/dist/sdk/cas/types.d.ts.map +1 -1
- package/dist/sdk/cas/validate-files.js +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/always-on-campaign-pull.js +1 -1
- package/dist/sdk/engage/always-on-campaign-push.js +1 -1
- package/dist/sdk/engage/always-on-campaign-validator.js +1 -1
- package/dist/sdk/engage/always-on-campaign-yaml.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/types/always-on-campaign-schema.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/llm/user-settings.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/deleted-table-validation.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/cas.d.ts +4 -0
- package/dist/sdk/types/cas.d.ts.map +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/types/workspace.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/util/tree-search.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/task-graph.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/sdk/workspace/access-tracker.js +1 -1
- package/dist/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/claude-code-state.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/proxy-fetch.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
package/dist/sdk/llm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a148_0x41755e=a148_0x5d72;function a148_0x5d72(_0x9ca6c7,_0x4f8edc){_0x9ca6c7=_0x9ca6c7-0xcc;const _0x5b91b4=a148_0x5b91();let _0x5d72f5=_0x5b91b4[_0x9ca6c7];return _0x5d72f5;}(function(_0x4ac297,_0x5144be){const _0x1e2551=a148_0x5d72,_0x3e9670=_0x4ac297();while(!![]){try{const _0x483028=parseInt(_0x1e2551(0x1bf))/0x1*(-parseInt(_0x1e2551(0x16d))/0x2)+-parseInt(_0x1e2551(0x1e1))/0x3+parseInt(_0x1e2551(0xfc))/0x4+parseInt(_0x1e2551(0x168))/0x5*(-parseInt(_0x1e2551(0x14b))/0x6)+-parseInt(_0x1e2551(0x19b))/0x7+parseInt(_0x1e2551(0x1e3))/0x8+parseInt(_0x1e2551(0x1ab))/0x9*(parseInt(_0x1e2551(0x155))/0xa);if(_0x483028===_0x5144be)break;else _0x3e9670['push'](_0x3e9670['shift']());}catch(_0x59f0e4){_0x3e9670['push'](_0x3e9670['shift']());}}}(a148_0x5b91,0x4ad05));import{LLMApiClient}from'../client/llm-api-client.js';import*as a148_0x1a108a from'node:fs';import*as a148_0x55bc74 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{toModelInfos}from'./user-settings.js';function a148_0x5b91(){const _0x159a1b=['3261544giIpXv','find','knowledgebases.json','size','listIntegrations','Only\x20safe\x20types\x20(','getBackupMetadata','functions','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','chat','listTextKnowledgeBases','Renamed\x20integration\x20file:\x20','tables','LLM_PROJECT_NOT_FOUND','agents.json','webhookCorsOrigins','.llm','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','\x0a---\x20function:\x20','llm_project','agentId','agent.yml','Available\x20agents:\x20','readFileSync','INTERNAL','Skipping\x20integration\x20\x27','isDirectory','dryRun','profile','outputs','getAgent','updateChatInterface','isFile','jsonSchemaHint','Renamed\x20chat\x20interface\x20file:\x20','loadJsonFile','pullAgent','total','yaml','unlinkSync','warn','length','integrations.json','name','currentProjectId','PERMISSION_DENIED','serviceType','projectId','event','prompt.md','createChatInterface','chat_interfaces','createIntegration','Renamed\x20agent\x20folder:\x20','toISOString','838004sOdwjL','utf-8','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','resolveProjectId','get','dirname','experimental_knowledge_bases','updatePrompt','createProject','description','listExperimentalArtifacts','pullProject','Project\x20\x22','json_schema','updated','project','status','Unsupported\x20backup\x20version:\x20','createFormInterface','experimentalArtifacts','add',')\x20can\x20be\x20cloned.','Renamed\x20text\x20KB\x20file:\x20','service_type','KnowledgeBase','starter_message.md','updateAgentResponse','resolveProjectName','client','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','NOT_FOUND','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','text','template','imageGenerators','path','isManaged','\x20attempts\x20due\x20to\x20name\x20conflicts.','target','webSearchTools','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','isDir','Renamed\x20experimental\x20artifact\x20directory:\x20','promptId','files','message','listProjects','Renamed\x20experimental\x20KB\x20directory:\x20','updateFormInterface','backupProject','listExperimentalKnowledgeBases','Removed\x20deleted\x20file:\x20','oldPath','listToolTargets','statSync','agentsFull','chats','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','knowledge_bases','push','\x27\x20(','updateTextKnowledgeBase','Multiple\x20agents\x20found\x20with\x20name\x20\x27','listKnowledgeBases','sdk.llm','updateAgent','---\x20schema:\x20','\x20---\x0a','createAgent','getCurrentProject','startChat','Renamed\x20KB\x20file:\x20','Project\x20not\x20found:\x20','slackMessageMode','\x20in\x20project\x20','\x0a---\x20code\x20---\x0a','image_gen','chatInfo','chat_parent_segment','7194JPcOxt','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','mkdirSync','projects','starter_message','\x20→\x20','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','renamed','endsWith','5671240zWMwlw','getChatHistory','set','dir','Agent\x20not\x20found:\x20','text_content','\x0a\x0a#\x20agent.yml\x0a','.yml','minimal','---\x20file:\x20','conflict','pushProject','newProjectId','Could\x20not\x20resolve\x20agent\x20reference','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.',')\x20can\x20be\x20pushed.\x20','content','listWebSearchTools','getOrCreateDefaultProject','770gZfWvt','duplicate','maxToolIterations','Unable\x20to\x20create\x20project\x20after\x20','join','18190WqNqEe','existsSync','createTextKnowledgeBase','textKnowledgeBases','info','temperature','getChatLog','agent.yml\x20not\x20found\x20in\x20','#\x20prompt.md\x0a','toLowerCase','systemPrompt','INVALID_ARGUMENT','knowledgeBases','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','claude-4.5-sonnet','resolveAgentId','1.0','modelType','new','has','parse','filter','agents','code.js','cwd','split','tdx.json','Output\x20directory\x20already\x20exists:\x20','Renamed\x20folder:\x20','formInterfaces','def','listAgents','Invalid\x20agent\x20reference\x20format:\x20','deleteAgent','models','Renamed\x20form\x20interface\x20file:\x20','chatId','createExperimentalArtifact','createAgentResponse','low','integrations','AGENT_NOT_FOUND','attributes','project.json','UNAUTHENTICATED','errors','4110169EFFEmW','chatInterfaces','starterMessage','context','listAgentsFull','createWebSearchTool','action','version','idToName','variables','experimental_artifacts','created','exportedFrom','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','none','chat_generic','9CsKbpB','createExperimentalKnowledgeBase','tdDatabaseName','\x22\x20already\x20exists','agent','createKnowledgeBase','code','basename','prompts.json','\x27.\x20This\x20should\x20not\x20happen.','sort','rmSync','experimentalKnowledgeBases','tdx_','ALREADY_EXISTS','error','chatWelcomeMessage','deleteProject','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','logger','11wjmqnK','Removed\x20deleted\x20directory:\x20','localeCompare','listPrompts','includes','stringify','site','writeFileSync','readdirSync','counts','listImageGenerators','file_name','unchanged','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','getProject','createPrompt','listFormInterfaces','already\x20exists','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','):\x20','TextKnowledgeBase','Renamed\x20prompt\x20file:\x20','getChatInfo','listChatInterfaces','tools','Multiple\x20projects\x20found\x20with\x20name\x20\x27','No\x20tdx.json\x20found\x20in\x20','\x0a---\x20schema:\x20','map','.md','nameToId','Unresolved\x20dependencies:\x20','type','listChats','18069zmfsHk','prompts'];a148_0x5b91=function(){return _0x159a1b;};return a148_0x5b91();}import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a148_0x41755e(0x1aa),'chat_agent_console',a148_0x41755e(0x14a)];async function safeListOrEmpty(_0x57210e){const _0x411646=a148_0x41755e;try{return await _0x57210e();}catch(_0x45dba1){if(_0x45dba1 instanceof HTTPClientError&&_0x45dba1[_0x411646(0x10c)]===0x194)return[];throw _0x45dba1;}}export class LLMSDK{[a148_0x41755e(0xf1)];[a148_0x41755e(0x118)];[a148_0x41755e(0x19e)];['logger']=Logger['of'](a148_0x41755e(0x13c));constructor(_0x2ac8f0){const _0x29e071=a148_0x41755e;this[_0x29e071(0x118)]=new LLMApiClient(_0x2ac8f0),this[_0x29e071(0x19e)]=_0x2ac8f0;}['getDefaultProjectName'](){const _0x3e21e5=getSanitizedUsername();return'tdx_default_'+_0x3e21e5;}async['setCurrentProject'](_0x321839){const _0x2704d7=a148_0x41755e,{projectId:_0x593607}=await this['resolveProjectName'](_0x321839);this[_0x2704d7(0xf1)]=_0x593607;}[a148_0x41755e(0x141)](){return this['currentProjectId'];}async['setDefaultAgent'](_0x484bf2){const _0x1768d6=a148_0x41755e,_0x410a9b=this[_0x1768d6(0x19e)]['profile'];let _0x21b09f,_0x346c7f;if(_0x484bf2[_0x1768d6(0x1c3)]('/')){const _0x2a1d26=_0x484bf2[_0x1768d6(0x186)]('/');if(_0x2a1d26[_0x1768d6(0xee)]!==0x2)throw new SDKError(ErrorCode[_0x1768d6(0x178)],_0x1768d6(0x18d)+_0x484bf2,undefined,{'helpText':_0x1768d6(0x119)});const [_0x1139b8,_0xf08d36]=_0x2a1d26;_0x21b09f=await this[_0x1768d6(0xff)](_0x1139b8),_0x346c7f=_0xf08d36;}else _0x21b09f=this['currentProjectId']||(await this[_0x1768d6(0x167)]())['id'],_0x346c7f=_0x484bf2;const _0x2f80a2=await this[_0x1768d6(0x17c)](_0x346c7f,_0x21b09f),_0x52871e=await this[_0x1768d6(0x118)][_0x1768d6(0xe3)](_0x2f80a2);writeCachedLLMAgent(_0x52871e[_0x1768d6(0x197)]['name'],_0x2f80a2,_0x21b09f,_0x410a9b);}['getDefaultAgent'](){const _0x1ee234=a148_0x41755e,_0x4bd856=this[_0x1ee234(0x19e)]['profile'];return readCachedLLMAgent(_0x4bd856)||undefined;}['clearDefaultAgent'](){const _0x22ab5b=a148_0x41755e,_0x4cda77=this[_0x22ab5b(0x19e)][_0x22ab5b(0xe1)];clearCachedLLMAgent(_0x4cda77);}async[a148_0x41755e(0x18f)](){const _0x568d95=a148_0x41755e,_0x1a12c6=await this[_0x568d95(0x118)]['getUserSettings']();return toModelInfos(_0x1a12c6);}async[a148_0x41755e(0x104)](_0x2941dd){const _0x2c1bc1=a148_0x41755e;return await this[_0x2c1bc1(0x118)][_0x2c1bc1(0x104)](_0x2941dd);}async['deleteProject'](_0x41b8b1){const _0x2b1301=a148_0x41755e,{projectId:_0x59637c}=await this[_0x2b1301(0x117)](_0x41b8b1);await this[_0x2b1301(0x118)][_0x2b1301(0x1bc)](_0x59637c);}async[a148_0x41755e(0x14f)](_0x5732f9=0x32){return await this['client']['listProjects'](_0x5732f9);}async[a148_0x41755e(0x167)](_0x360693){const _0x48c792=a148_0x41755e,_0x5c72ce=_0x360693||this['getDefaultProjectName'](),_0x3db6fe=this['context'][_0x48c792(0xe1)];if(!_0x360693){const _0x1b4e8d=readCachedLLMProject(_0x3db6fe);if(_0x1b4e8d&&_0x1b4e8d[_0x48c792(0xf0)]===_0x5c72ce)try{const _0x138bd1=await this[_0x48c792(0x118)][_0x48c792(0x1cd)](_0x1b4e8d['id']);if(_0x138bd1['attributes']['name']===_0x5c72ce)return _0x138bd1;}catch{}}const _0x5d7ec4=await this['client']['listProjects'](),_0x20c984=_0x5d7ec4[_0x48c792(0x1e4)](_0x158282=>_0x158282[_0x48c792(0x197)][_0x48c792(0xf0)]===_0x5c72ce);if(_0x20c984)return!_0x360693&&writeCachedLLMProject(_0x5c72ce,_0x20c984['id'],_0x3db6fe),_0x20c984;const _0x399273=await this['client']['createProject']({'name':_0x5c72ce,'description':_0x48c792(0x1a8)+getSanitizedUsername()+')'});return!_0x360693&&writeCachedLLMProject(_0x5c72ce,_0x399273['id'],_0x3db6fe),_0x399273;}async[a148_0x41755e(0xff)](_0x12c38d){const _0x3314e8=a148_0x41755e,_0x570eba=await this[_0x3314e8(0x118)]['listProjects'](),_0x56e969=_0x570eba[_0x3314e8(0x182)](_0xe0212a=>_0xe0212a[_0x3314e8(0x197)][_0x3314e8(0xf0)]===_0x12c38d);if(_0x56e969[_0x3314e8(0xee)]===0x0)throw new SDKError(ErrorCode[_0x3314e8(0xd2)],'Project\x20not\x20found:\x20'+_0x12c38d,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x56e969[_0x3314e8(0xee)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x3314e8(0x1d8)+_0x12c38d+'\x27.\x20This\x20should\x20not\x20happen.');return _0x56e969[0x0]['id'];}async[a148_0x41755e(0x117)](_0x2d0b05){const _0x3dbfe5=a148_0x41755e,_0x575700=await this[_0x3dbfe5(0x118)]['listProjects'](),_0x544450=_0x575700[_0x3dbfe5(0x1e4)](_0x456a38=>_0x456a38[_0x3dbfe5(0x197)][_0x3dbfe5(0xf0)]===_0x2d0b05);if(_0x544450)return{'projectId':_0x544450['id'],'project':_0x544450};throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x3dbfe5(0x144)+_0x2d0b05,undefined,{'helpText':_0x3dbfe5(0x14d)});}async['getOrCreateDefaultAgent'](_0x2d3d1f=a148_0x41755e(0x17b),_0x3cb4d0=0x0,_0xaa1661){const _0x2ce578=a148_0x41755e,_0x57908b=0xa;let _0x29e09b=0x0,_0x10cdab;while(_0x29e09b<_0x57908b){try{const _0xda5053=await this['getOrCreateDefaultProject'](_0x10cdab),_0x18f122=_0xda5053['id'],_0x1efc28=[_0x2ce578(0x1a9),_0x2ce578(0x15d),_0x2ce578(0x194),'medium','high'],_0xe67c26=_0x3cb4d0===0x0?_0x2ce578(0x1b8)+_0x2d3d1f:_0x2ce578(0x1b8)+_0x2d3d1f+'_reasoning_'+_0x1efc28[_0x3cb4d0],_0xbfda50=await this[_0x2ce578(0x118)]['listAgents'](_0x18f122),_0x14c553=_0xbfda50[_0x2ce578(0x1e4)](_0x21799e=>_0x21799e['attributes'][_0x2ce578(0xf0)]===_0xe67c26);if(_0x14c553)return _0x14c553;const _0x4b9706=_0x3cb4d0>0x0?0x1:_0xaa1661;return await this[_0x2ce578(0x118)][_0x2ce578(0x140)]({'name':_0xe67c26,'projectId':_0x18f122,'modelType':_0x2d3d1f,'systemPrompt':'','temperature':_0x4b9706,'reasoningEffort':_0x3cb4d0>0x0?_0x3cb4d0:undefined});}catch(_0x49b1b9){if(_0x49b1b9 instanceof HTTPClientError){const _0x194cb3=_0x49b1b9[_0x2ce578(0x10c)];if(_0x194cb3>=0x190&&_0x194cb3<0x1f4){if(_0x194cb3===0x191)throw new SDKError(ErrorCode[_0x2ce578(0x199)],_0x2ce578(0x1bd),_0x49b1b9);else{if(_0x194cb3===0x193)throw new SDKError(ErrorCode[_0x2ce578(0xf2)],_0x2ce578(0x152),_0x49b1b9);}throw _0x49b1b9;}}if(errorContains(_0x49b1b9,_0x2ce578(0x1d0),_0x2ce578(0x169),_0x2ce578(0x15f))){_0x29e09b++;if(_0x29e09b>=_0x57908b)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x2ce578(0x16b)+_0x57908b+_0x2ce578(0x121),_0x49b1b9);const _0x101598=this['getDefaultProjectName']();_0x10cdab=_0x101598+'_'+generateRandomHex();continue;}throw _0x49b1b9;}}throw new SDKError(ErrorCode['INTERNAL'],'Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts');}async['resolveAgentId'](_0x49a74e,_0x6a9a83){const _0x18c4b4=a148_0x41755e,_0x4c00ad=_0x6a9a83||this[_0x18c4b4(0xf1)],_0x5f1946=await this[_0x18c4b4(0x118)][_0x18c4b4(0x18c)](_0x4c00ad),_0x4c781c=_0x5f1946[_0x18c4b4(0x182)](_0x2689c0=>_0x2689c0['attributes'][_0x18c4b4(0xf0)]===_0x49a74e);if(_0x4c781c['length']===0x0){const _0x55f20b=_0x4c00ad?_0x18c4b4(0x146)+_0x4c00ad:'';throw new SDKError(ErrorCode[_0x18c4b4(0x196)],_0x18c4b4(0x159)+_0x49a74e+_0x55f20b,undefined,{'helpText':_0x4c00ad?_0x18c4b4(0xd6):'Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.'});}if(_0x4c781c['length']>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x18c4b4(0x13a)+_0x49a74e+_0x18c4b4(0x1b4));return _0x4c781c[0x0]['id'];}async[a148_0x41755e(0x183)](_0x58d9d6){const _0x58192a=a148_0x41755e,_0x259745=_0x58d9d6||this[_0x58192a(0xf1)];return await this[_0x58192a(0x118)][_0x58192a(0x18c)](_0x259745);}async[a148_0x41755e(0x133)](_0x53dedb){const _0x2efdec=a148_0x41755e;return await this[_0x2efdec(0x118)][_0x2efdec(0x19f)](_0x53dedb);}async[a148_0x41755e(0x1af)](_0x19aed3){const _0x4c4224=a148_0x41755e;return await this[_0x4c4224(0x118)][_0x4c4224(0xe3)](_0x19aed3);}async[a148_0x41755e(0x140)](_0x2e8d2c){const _0x5aa8fb=a148_0x41755e;return await this['client'][_0x5aa8fb(0x140)](_0x2e8d2c);}async['updateAgent'](_0x47a583,_0x2d437b){const _0x5f284b=a148_0x41755e;return await this[_0x5f284b(0x118)][_0x5f284b(0x13d)](_0x47a583,_0x2d437b);}async[a148_0x41755e(0x18e)](_0x3e8eb7){const _0x5bb55e=a148_0x41755e;await this['client'][_0x5bb55e(0x18e)](_0x3e8eb7);}async[a148_0x41755e(0x142)](_0x29b261){const _0x4d907f=a148_0x41755e;return await this[_0x4d907f(0x118)][_0x4d907f(0x142)]({'agentId':_0x29b261});}async*[a148_0x41755e(0xce)](_0x22d40a,_0x24d3ad){const _0x58a5e5=a148_0x41755e;let _0x39f331=_0x24d3ad?.[_0x58a5e5(0x191)];const _0x45b8ca=_0x24d3ad?.['agentId'];if(!_0x39f331){if(!_0x45b8ca)throw new Error(_0x58a5e5(0x124));const _0x3c1777=await this['client'][_0x58a5e5(0x142)]({'agentId':_0x45b8ca});_0x39f331=_0x3c1777['id'],yield{'type':'metadata','data':{'chatId':_0x39f331,'agentId':_0x45b8ca,'projectId':_0x3c1777[_0x58a5e5(0x197)][_0x58a5e5(0xf4)]}};}for await(const _0x3fe238 of this[_0x58a5e5(0x118)]['continueChat'](_0x39f331,_0x22d40a,_0x24d3ad?.['signal'])){yield{'type':_0x58a5e5(0xf5),'data':_0x3fe238};}}async[a148_0x41755e(0x134)](_0x34edfe=0x32){const _0x40d9bb=a148_0x41755e;return await this[_0x40d9bb(0x118)][_0x40d9bb(0x1e0)](_0x34edfe);}async['history'](_0x32382d){const _0x99b7c7=a148_0x41755e;return await this['client'][_0x99b7c7(0x156)](_0x32382d);}async[a148_0x41755e(0x173)](_0x4bc713){const _0x47c59a=a148_0x41755e;return await this['client'][_0x47c59a(0x173)](_0x4bc713);}async[a148_0x41755e(0x149)](_0x5eba55){const _0x49b2d1=a148_0x41755e;return await this[_0x49b2d1(0x118)][_0x49b2d1(0x1d5)](_0x5eba55);}async[a148_0x41755e(0x12d)](_0x38164f,_0x3eca18,_0x543e9b){const _0x2fd162=a148_0x41755e,_0x187d54=_0x543e9b?.['dryRun']??![],{projectId:_0x35fc02,project:_0x47fa06}=await this[_0x2fd162(0x117)](_0x38164f),_0x1734c7=_0x47fa06[_0x2fd162(0x197)][_0x2fd162(0xf0)],_0x3e0532=_0x3eca18||_0x1734c7+_0x2fd162(0xd5);if(a148_0x1a108a['existsSync'](_0x3e0532)&&!_0x187d54)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x2fd162(0x188)+_0x3e0532,undefined,{'helpText':_0x2fd162(0x1d1)});const _0x22a246=await this[_0x2fd162(0x118)][_0x2fd162(0x19f)](_0x35fc02),_0x4a4613=await this[_0x2fd162(0x118)][_0x2fd162(0x13b)](_0x35fc02),_0x275a5b=await this['client'][_0x2fd162(0x1c2)](_0x35fc02),_0xf73736=await this[_0x2fd162(0x118)][_0x2fd162(0x1e7)](_0x35fc02);if(!_0x187d54){a148_0x1a108a['mkdirSync'](_0x3e0532,{'recursive':!![]});const _0x1e18db={'version':_0x2fd162(0x17d),'exportedAt':new Date()[_0x2fd162(0xfb)](),'exportedFrom':{'site':this[_0x2fd162(0x19e)][_0x2fd162(0x1c5)],'projectId':_0x35fc02,'projectName':_0x1734c7},'project':_0x47fa06};a148_0x1a108a[_0x2fd162(0x1c6)](a148_0x55bc74[_0x2fd162(0x16c)](_0x3e0532,_0x2fd162(0x198)),JSON[_0x2fd162(0x1c4)](_0x1e18db,null,0x2)),a148_0x1a108a[_0x2fd162(0x1c6)](a148_0x55bc74[_0x2fd162(0x16c)](_0x3e0532,_0x2fd162(0xd3)),JSON[_0x2fd162(0x1c4)](_0x22a246,null,0x2)),a148_0x1a108a[_0x2fd162(0x1c6)](a148_0x55bc74[_0x2fd162(0x16c)](_0x3e0532,_0x2fd162(0x1e5)),JSON[_0x2fd162(0x1c4)](_0x4a4613,null,0x2)),a148_0x1a108a[_0x2fd162(0x1c6)](a148_0x55bc74[_0x2fd162(0x16c)](_0x3e0532,'prompts.json'),JSON[_0x2fd162(0x1c4)](_0x275a5b,null,0x2)),a148_0x1a108a[_0x2fd162(0x1c6)](a148_0x55bc74[_0x2fd162(0x16c)](_0x3e0532,_0x2fd162(0xef)),JSON[_0x2fd162(0x1c4)](_0xf73736,null,0x2));}return{'projectName':_0x1734c7,'outputDir':_0x3e0532,'counts':{'agents':_0x22a246[_0x2fd162(0xee)],'knowledgeBases':_0x4a4613[_0x2fd162(0xee)],'prompts':_0x275a5b[_0x2fd162(0xee)],'integrations':_0xf73736['length']}};}async['restoreProject'](_0x3eb7f7,_0x49162b){const _0x1841e2=a148_0x41755e,_0x278db1=_0x49162b?.[_0x1841e2(0xe0)]??![],_0x17c995=this[_0x1841e2(0x1e9)](_0x3eb7f7),_0x3582bd=_0x17c995[_0x1841e2(0x1a7)][_0x1841e2(0x1c5)],_0x1c00ce=this[_0x1841e2(0x19e)][_0x1841e2(0x1c5)],_0x5b9aa6=_0x3582bd!==_0x1c00ce?_0x3582bd:undefined,_0x45c156=this['loadJsonFile'](a148_0x55bc74[_0x1841e2(0x16c)](_0x3eb7f7,'agents.json'),[]),_0x242eb4=this[_0x1841e2(0xe8)](a148_0x55bc74[_0x1841e2(0x16c)](_0x3eb7f7,_0x1841e2(0x1e5)),[]),_0x1b06b0=this[_0x1841e2(0xe8)](a148_0x55bc74[_0x1841e2(0x16c)](_0x3eb7f7,_0x1841e2(0x1b3)),[]),_0x4c9f5c=this['loadJsonFile'](a148_0x55bc74['join'](_0x3eb7f7,_0x1841e2(0xef)),[]),_0x12fc5e=_0x49162b?.[_0x1841e2(0xf0)]||_0x17c995[_0x1841e2(0x1a7)]['projectName'];if(_0x278db1){const _0x5e4483=new Map(),_0x539af4=[..._0x45c156],_0x24e941=_0x45c156[_0x1841e2(0xee)]+0x1;let _0x1db0c4=0x0;while(_0x539af4[_0x1841e2(0xee)]>0x0&&_0x1db0c4<_0x24e941){_0x1db0c4++;const _0xa72484=[];for(const _0x1f1508 of _0x539af4){canCreateAgent(_0x1f1508,_0x5e4483)?_0x5e4483[_0x1841e2(0x157)](_0x1f1508['id'],'dry-run-'+_0x1f1508['id']):_0xa72484[_0x1841e2(0x137)](_0x1f1508);}if(_0xa72484[_0x1841e2(0xee)]===_0x539af4[_0x1841e2(0xee)])throw new SDKError(ErrorCode[_0x1841e2(0xdd)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x1841e2(0x1cc)});_0x539af4[_0x1841e2(0xee)]=0x0,_0x539af4[_0x1841e2(0x137)](..._0xa72484);}const _0x2618a5=_0x1b06b0[_0x1841e2(0x182)](_0x196344=>_0x5e4483[_0x1841e2(0x180)](_0x196344['attributes'][_0x1841e2(0xd9)]))[_0x1841e2(0xee)];return{'projectName':_0x12fc5e,'projectId':'(dry-run)','counts':{'agents':_0x45c156[_0x1841e2(0xee)],'knowledgeBases':_0x242eb4['length'],'prompts':_0x2618a5,'integrations':_0x4c9f5c[_0x1841e2(0xee)]},'sourceSite':_0x5b9aa6};}const _0x295d95=await this[_0x1841e2(0x118)][_0x1841e2(0x104)]({'name':_0x12fc5e,'description':_0x17c995[_0x1841e2(0x10b)][_0x1841e2(0x197)][_0x1841e2(0x105)]}),_0x9add02=_0x295d95['id'],_0x4afbdf=new Map(),_0x5cdab1=new Map(),_0x1b6721=new Map();for(const _0x4a00f7 of _0x242eb4){const _0x2d5181=await this[_0x1841e2(0x118)][_0x1841e2(0x1b0)]({'projectId':_0x9add02,'name':_0x4a00f7[_0x1841e2(0x197)]['name'],'tdDatabaseName':_0x4a00f7[_0x1841e2(0x197)][_0x1841e2(0x1ad)],'tables':_0x4a00f7['attributes'][_0x1841e2(0xd1)]});_0x4afbdf[_0x1841e2(0x157)](_0x4a00f7['id'],_0x2d5181['id']);}const _0x38b249=[..._0x45c156],_0x1afbdd=_0x45c156[_0x1841e2(0xee)]+0x1;let _0x49f07f=0x0;while(_0x38b249[_0x1841e2(0xee)]>0x0&&_0x49f07f<_0x1afbdd){_0x49f07f++;const _0xdc64a=[];for(const _0x2a7ec2 of _0x38b249){if(canCreateAgent(_0x2a7ec2,_0x5cdab1)){const _0x98a917=remapToolIds(_0x2a7ec2['attributes'][_0x1841e2(0x1d7)],_0x4afbdf,_0x5cdab1),_0x50cdcd=remapVariableIds(_0x2a7ec2[_0x1841e2(0x197)][_0x1841e2(0x1a4)],_0x4afbdf),_0x5282e8=await this[_0x1841e2(0x118)][_0x1841e2(0x193)]({'name':_0x2a7ec2[_0x1841e2(0x197)]['name'],'projectId':_0x9add02,'systemPrompt':_0x2a7ec2['attributes'][_0x1841e2(0x177)],'starterMessage':_0x2a7ec2[_0x1841e2(0x197)][_0x1841e2(0x19d)],'modelType':migrateModelType(_0x2a7ec2[_0x1841e2(0x197)][_0x1841e2(0x17e)]),'maxToolIterations':_0x2a7ec2['attributes'][_0x1841e2(0x16a)],'temperature':_0x2a7ec2['attributes'][_0x1841e2(0x172)],'reasoningEffort':_0x2a7ec2[_0x1841e2(0x197)]['reasoningEffort'],'outputs':_0x2a7ec2[_0x1841e2(0x197)][_0x1841e2(0xe2)],'tools':_0x98a917,'variables':_0x50cdcd});_0x5cdab1[_0x1841e2(0x157)](_0x2a7ec2['id'],_0x5282e8['id']);}else _0xdc64a[_0x1841e2(0x137)](_0x2a7ec2);}if(_0xdc64a[_0x1841e2(0xee)]===_0x38b249[_0x1841e2(0xee)])throw new SDKError(ErrorCode['INTERNAL'],_0x1841e2(0x17a),undefined,{'helpText':_0x1841e2(0x1cc)});_0x38b249[_0x1841e2(0xee)]=0x0,_0x38b249[_0x1841e2(0x137)](..._0xdc64a);}for(const _0x11cf01 of _0x1b06b0){const _0x14a259=_0x5cdab1['get'](_0x11cf01[_0x1841e2(0x197)]['agentId']);if(!_0x14a259)continue;const _0x6b67d1=await this[_0x1841e2(0x118)]['createPrompt']({'projectId':_0x9add02,'agentId':_0x14a259,'name':_0x11cf01[_0x1841e2(0x197)][_0x1841e2(0xf0)],'systemPrompt':_0x11cf01['attributes'][_0x1841e2(0x177)],'template':_0x11cf01[_0x1841e2(0x197)][_0x1841e2(0x11d)],'jsonSchemaHint':_0x11cf01[_0x1841e2(0x197)][_0x1841e2(0xe6)]});_0x1b6721[_0x1841e2(0x157)](_0x11cf01['id'],_0x6b67d1['id']);}for(const _0x25e84e of _0x4c9f5c){const _0x4112b1=_0x25e84e[_0x1841e2(0x197)]['actions'][_0x1841e2(0x1db)](_0x904e3e=>({..._0x904e3e,'promptId':_0x1b6721[_0x1841e2(0x100)](_0x904e3e[_0x1841e2(0x127)])||_0x904e3e['promptId']}));await this[_0x1841e2(0x118)][_0x1841e2(0xf9)]({'projectId':_0x9add02,'serviceType':_0x25e84e['attributes']['serviceType'],'actions':_0x4112b1,'slackMessageMode':_0x25e84e[_0x1841e2(0x197)][_0x1841e2(0x145)],'chatIgnoreManagedActions':_0x25e84e[_0x1841e2(0x197)]['chatIgnoreManagedActions'],'chatWelcomeMessage':_0x25e84e[_0x1841e2(0x197)][_0x1841e2(0x1bb)],'webhookCorsOrigins':_0x25e84e[_0x1841e2(0x197)][_0x1841e2(0xd4)]});}return{'projectName':_0x12fc5e,'projectId':_0x9add02,'counts':{'agents':_0x5cdab1[_0x1841e2(0x1e6)],'knowledgeBases':_0x4afbdf[_0x1841e2(0x1e6)],'prompts':_0x1b6721[_0x1841e2(0x1e6)],'integrations':_0x4c9f5c[_0x1841e2(0xee)]},'sourceSite':_0x5b9aa6};}[a148_0x41755e(0xe8)](_0x4ae894,_0xf6b58d){const _0x2ebcca=a148_0x41755e;if(!a148_0x1a108a[_0x2ebcca(0x16e)](_0x4ae894))return _0xf6b58d;return JSON[_0x2ebcca(0x181)](a148_0x1a108a[_0x2ebcca(0xdc)](_0x4ae894,_0x2ebcca(0xfd)));}[a148_0x41755e(0x1e9)](_0x37b0ff){const _0x6b6bee=a148_0x41755e;if(!a148_0x1a108a[_0x6b6bee(0x16e)](_0x37b0ff))throw new SDKError(ErrorCode[_0x6b6bee(0x11a)],'Backup\x20folder\x20not\x20found:\x20'+_0x37b0ff,undefined,{'helpText':_0x6b6bee(0x11b)});const _0x354dc5=a148_0x55bc74[_0x6b6bee(0x16c)](_0x37b0ff,_0x6b6bee(0x198));if(!a148_0x1a108a['existsSync'](_0x354dc5))throw new SDKError(ErrorCode[_0x6b6bee(0x178)],_0x6b6bee(0xfe)+_0x37b0ff,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x42445a=JSON['parse'](a148_0x1a108a['readFileSync'](_0x354dc5,'utf-8'));if(!isSupportedBackupVersion(_0x42445a[_0x6b6bee(0x1a2)]))throw new SDKError(ErrorCode[_0x6b6bee(0x178)],_0x6b6bee(0x10d)+_0x42445a[_0x6b6bee(0x1a2)],undefined,{'helpText':_0x6b6bee(0x163)});return _0x42445a;}async[a148_0x41755e(0x107)](_0x58fb32,_0xc3d713,_0x422b32){const _0x2e7b73=a148_0x41755e,{projectId:_0x2403f4,project:_0x1a3728}=await this[_0x2e7b73(0x117)](_0x58fb32),_0x222127=_0x1a3728['attributes'][_0x2e7b73(0xf0)];let _0x40e87c;if(_0xc3d713)_0x40e87c=_0xc3d713;else{const _0x54f569=a148_0x55bc74[_0x2e7b73(0x16c)](process[_0x2e7b73(0x185)](),_0x2e7b73(0x183)),_0x502e4a=getSanitizedPathWithMigration(_0x54f569,_0x222127);_0x502e4a[_0x2e7b73(0x153)]&&this[_0x2e7b73(0x1be)]['info'](_0x2e7b73(0x189)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x502e4a[_0x2e7b73(0x130)])+_0x2e7b73(0x151)+a148_0x55bc74['basename'](_0x502e4a['path'])),_0x40e87c=_0x502e4a[_0x2e7b73(0x11f)];}const _0xd14bea=await this[_0x2e7b73(0x118)][_0x2e7b73(0x19f)](_0x2403f4),_0x4cd179=await this[_0x2e7b73(0x118)]['listKnowledgeBases'](_0x2403f4),_0x196dcb=await this['client']['listTextKnowledgeBases'](_0x2403f4),_0x27ecde=await safeListOrEmpty(()=>this[_0x2e7b73(0x118)][_0x2e7b73(0x1c9)](_0x2403f4)),_0x461b8a=await safeListOrEmpty(()=>this['client'][_0x2e7b73(0x166)](_0x2403f4)),_0x19e55c=await this[_0x2e7b73(0x118)]['listPrompts'](_0x2403f4),_0x50f967=await this[_0x2e7b73(0x118)][_0x2e7b73(0x1e7)](_0x2403f4),_0x21105c=await safeListOrEmpty(()=>this[_0x2e7b73(0x118)][_0x2e7b73(0x12e)](_0x2403f4)),_0x2bdcd1=await safeListOrEmpty(()=>this[_0x2e7b73(0x118)]['listExperimentalArtifacts'](_0x2403f4)),_0x576e97=await safeListOrEmpty(()=>this[_0x2e7b73(0x118)][_0x2e7b73(0x1cf)](_0x2403f4)),_0x4b2525=await safeListOrEmpty(()=>this[_0x2e7b73(0x118)][_0x2e7b73(0x1d6)](_0x2403f4)),_0x50851d=_0x50f967[_0x2e7b73(0x182)](_0x38406d=>!_0x38406d[_0x2e7b73(0x197)][_0x2e7b73(0x120)]&&SAFE_INTEGRATION_TYPES['includes'](_0x38406d['attributes']['serviceType'][_0x2e7b73(0x176)]())),_0x36c4ec=new Map(),_0x504617=new Map(),_0x57a185=new Map(),_0x14cf1e=new Map(),_0x32add0=new Map(),_0x2172b2=new Map(),_0x47d04f=new Map();for(const _0xe7f5d1 of _0xd14bea){_0x36c4ec[_0x2e7b73(0x157)](_0xe7f5d1['id'],_0xe7f5d1[_0x2e7b73(0x197)][_0x2e7b73(0xf0)]);}for(const _0x33cd93 of _0x4cd179){_0x504617[_0x2e7b73(0x157)](_0x33cd93['id'],_0x33cd93[_0x2e7b73(0x197)][_0x2e7b73(0xf0)]);}for(const _0xe6e14a of _0x196dcb){_0x57a185[_0x2e7b73(0x157)](_0xe6e14a['id'],_0xe6e14a['attributes'][_0x2e7b73(0xf0)]);}for(const _0x447512 of _0x27ecde){_0x14cf1e[_0x2e7b73(0x157)](_0x447512['id'],_0x447512[_0x2e7b73(0x197)]['name']);}for(const _0x30ee15 of _0x461b8a){_0x32add0[_0x2e7b73(0x157)](_0x30ee15['id'],_0x30ee15['attributes'][_0x2e7b73(0xf0)]);}for(const _0x133cb6 of _0x19e55c){_0x2172b2[_0x2e7b73(0x157)](_0x133cb6['id'],_0x133cb6[_0x2e7b73(0x197)]['name']);}for(const _0x1aadcc of _0x21105c){_0x47d04f[_0x2e7b73(0x157)](_0x1aadcc['id'],_0x1aadcc[_0x2e7b73(0x197)]['name']);}const _0x559674={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x504617,'TextKnowledgeBase':_0x57a185,'Agent':_0x36c4ec,'WebSearchTool':_0x32add0,'ImageGenerator':_0x14cf1e,'ExperimentalKnowledgeBase':_0x47d04f}),'resolvePromptName':async _0x371fe3=>_0x2172b2['get'](_0x371fe3),'onWarning':_0x173a0d=>this[_0x2e7b73(0x1be)][_0x2e7b73(0xed)](_0x173a0d)},_0x26420e={'projectName':_0x222127,'outputDir':_0x40e87c,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'knowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'textKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'prompts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'integrations':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalArtifacts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'formInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'chatInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0x38796b=[],_0x35ff3a=[];for(const _0x19955c of _0xd14bea){const _0x122e30=getSanitizedPathWithMigration(_0x40e87c,_0x19955c[_0x2e7b73(0x197)][_0x2e7b73(0xf0)]);_0x122e30[_0x2e7b73(0x153)]&&this['logger'][_0x2e7b73(0x171)]('Renamed\x20agent\x20folder:\x20'+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x122e30[_0x2e7b73(0x130)])+_0x2e7b73(0x151)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x122e30[_0x2e7b73(0x11f)]));const _0x120935=_0x122e30['path'],_0x2871f8=a148_0x55bc74[_0x2e7b73(0x16c)](_0x120935,'prompt.md'),_0x50368b=a148_0x55bc74[_0x2e7b73(0x16c)](_0x120935,_0x2e7b73(0xda)),_0x3d81d4=a148_0x55bc74[_0x2e7b73(0x16c)](_0x120935,_0x2e7b73(0x115)),{yaml:_0x50a2f2,systemPrompt:_0x31b373,starterMessage:_0x20899a}=await agentResponseToDef(_0x19955c,_0x559674),_0xac9e35=toAgentYamlString(_0x50a2f2),_0x49502a=!a148_0x1a108a[_0x2e7b73(0x16e)](_0x50368b);let _0x528b31=_0x49502a,_0x4a16e3;if(!_0x49502a){const _0x320c97=a148_0x1a108a['existsSync'](_0x2871f8)?a148_0x1a108a['readFileSync'](_0x2871f8,_0x2e7b73(0xfd)):'',_0x254cac=a148_0x1a108a[_0x2e7b73(0xdc)](_0x50368b,_0x2e7b73(0xfd)),_0x38634d=_0x2e7b73(0x175)+_0x320c97+_0x2e7b73(0x15b)+_0x254cac,_0x1df3aa=_0x2e7b73(0x175)+_0x31b373+_0x2e7b73(0x15b)+_0xac9e35,_0x5a8dcb=generateDiff(_0x38634d,_0x1df3aa);_0x528b31=hasChanges(_0x5a8dcb),_0x528b31&&(_0x4a16e3=formatDiffWithColors(_0x5a8dcb));}_0x38796b[_0x2e7b73(0x137)]({'path':_0x120935,'content':'','isDir':!![]}),_0x38796b[_0x2e7b73(0x137)]({'path':_0x2871f8,'content':_0x31b373}),_0x38796b[_0x2e7b73(0x137)]({'path':_0x50368b,'content':_0xac9e35});_0x20899a&&_0x20899a['includes']('\x0a')&&_0x38796b[_0x2e7b73(0x137)]({'path':_0x3d81d4,'content':_0x20899a});_0x26420e[_0x2e7b73(0x183)][_0x2e7b73(0x137)]({'agentName':_0x19955c[_0x2e7b73(0x197)]['name'],'outputPath':_0x120935,'isNew':_0x49502a,'hasChanges':_0x528b31,'diff':_0x4a16e3}),_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x183)]['total']++;if(_0x49502a)_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x183)][_0x2e7b73(0x17f)]++;else{if(_0x528b31)_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x183)][_0x2e7b73(0x10a)]++;else _0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x183)][_0x2e7b73(0x1cb)]++;}}for(const _0x1365b3 of _0x4cd179){if(_0x1365b3['attributes'][_0x2e7b73(0x120)])continue;const _0x4ba45e=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x40e87c),_0x1365b3[_0x2e7b73(0x197)][_0x2e7b73(0xf0)],_0x2e7b73(0x15c));_0x4ba45e[_0x2e7b73(0x153)]&&this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0x143)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x4ba45e[_0x2e7b73(0x130)])+'\x20→\x20'+a148_0x55bc74['basename'](_0x4ba45e[_0x2e7b73(0x11f)]));const _0x5722f5=_0x4ba45e[_0x2e7b73(0x11f)],_0xeea1ce=apiKnowledgeBaseToYaml(_0x1365b3),_0x4ce22f=toKnowledgeBaseYamlString(_0xeea1ce),_0x184896=!a148_0x1a108a[_0x2e7b73(0x16e)](_0x5722f5);let _0x55457d=_0x184896,_0x305618;if(!_0x184896){const _0x519dc5=a148_0x1a108a[_0x2e7b73(0xdc)](_0x5722f5,'utf-8'),_0xb9eefc=generateDiff(_0x519dc5,_0x4ce22f);_0x55457d=hasChanges(_0xb9eefc),_0x55457d&&(_0x305618=formatDiffWithColors(_0xb9eefc));}_0x38796b[_0x2e7b73(0x137)]({'path':_0x5722f5,'content':_0x4ce22f}),_0x26420e[_0x2e7b73(0x179)]['push']({'name':_0x1365b3[_0x2e7b73(0x197)]['name'],'outputPath':_0x5722f5,'isNew':_0x184896,'hasChanges':_0x55457d,'diff':_0x305618}),_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x179)]['total']++;if(_0x184896)_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x179)][_0x2e7b73(0x17f)]++;else{if(_0x55457d)_0x26420e[_0x2e7b73(0x1c8)]['knowledgeBases'][_0x2e7b73(0x10a)]++;else _0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x179)][_0x2e7b73(0x1cb)]++;}}for(const _0x325f6e of _0x196dcb){if(_0x325f6e[_0x2e7b73(0x197)][_0x2e7b73(0x120)])continue;const _0x835290=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x40e87c),_0x325f6e[_0x2e7b73(0x197)][_0x2e7b73(0xf0)],_0x2e7b73(0x1dc));_0x835290['renamed']&&this['logger'][_0x2e7b73(0x171)](_0x2e7b73(0x112)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x835290['oldPath'])+_0x2e7b73(0x151)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x835290[_0x2e7b73(0x11f)]));const _0x5c8a30=_0x835290[_0x2e7b73(0x11f)],_0x326b9e=toTextKnowledgeBaseMd(_0x325f6e[_0x2e7b73(0x197)][_0x2e7b73(0xf0)],_0x325f6e[_0x2e7b73(0x197)][_0x2e7b73(0x11c)]),_0x11896d=!a148_0x1a108a[_0x2e7b73(0x16e)](_0x5c8a30);let _0x32fd0a=_0x11896d,_0x54e73f;if(!_0x11896d){const _0x18e38e=a148_0x1a108a['readFileSync'](_0x5c8a30,_0x2e7b73(0xfd)),_0x4459df=generateDiff(_0x18e38e,_0x326b9e);_0x32fd0a=hasChanges(_0x4459df),_0x32fd0a&&(_0x54e73f=formatDiffWithColors(_0x4459df));}_0x38796b['push']({'path':_0x5c8a30,'content':_0x326b9e}),_0x26420e['textKnowledgeBases'][_0x2e7b73(0x137)]({'name':_0x325f6e['attributes'][_0x2e7b73(0xf0)],'outputPath':_0x5c8a30,'isNew':_0x11896d,'hasChanges':_0x32fd0a,'diff':_0x54e73f}),_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x170)]['total']++;if(_0x11896d)_0x26420e['counts'][_0x2e7b73(0x170)][_0x2e7b73(0x17f)]++;else{if(_0x32fd0a)_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x170)][_0x2e7b73(0x10a)]++;else _0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x170)][_0x2e7b73(0x1cb)]++;}}for(const _0x5baaff of _0x19e55c){if(_0x5baaff[_0x2e7b73(0x197)][_0x2e7b73(0x120)])continue;const _0x489701=getSanitizedPathWithMigration(getPromptsDir(_0x40e87c),_0x5baaff[_0x2e7b73(0x197)][_0x2e7b73(0xf0)],_0x2e7b73(0x15c));_0x489701[_0x2e7b73(0x153)]&&this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0x1d4)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x489701[_0x2e7b73(0x130)])+'\x20→\x20'+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x489701['path']));const _0x331d44=_0x489701[_0x2e7b73(0x11f)],_0x1008ee=await apiPromptToYaml(_0x5baaff,_0x559674);if(!_0x1008ee)continue;const _0x5e0244=toPromptYamlString(_0x1008ee),_0x120962=!a148_0x1a108a[_0x2e7b73(0x16e)](_0x331d44);let _0x250f67=_0x120962,_0x21165b;if(!_0x120962){const _0x1e192d=a148_0x1a108a[_0x2e7b73(0xdc)](_0x331d44,'utf-8'),_0x44fb61=generateDiff(_0x1e192d,_0x5e0244);_0x250f67=hasChanges(_0x44fb61),_0x250f67&&(_0x21165b=formatDiffWithColors(_0x44fb61));}_0x38796b[_0x2e7b73(0x137)]({'path':_0x331d44,'content':_0x5e0244}),_0x26420e['prompts'][_0x2e7b73(0x137)]({'name':_0x5baaff[_0x2e7b73(0x197)][_0x2e7b73(0xf0)],'outputPath':_0x331d44,'isNew':_0x120962,'hasChanges':_0x250f67,'diff':_0x21165b}),_0x26420e[_0x2e7b73(0x1c8)]['prompts'][_0x2e7b73(0xea)]++;if(_0x120962)_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x1e2)][_0x2e7b73(0x17f)]++;else{if(_0x250f67)_0x26420e['counts'][_0x2e7b73(0x1e2)][_0x2e7b73(0x10a)]++;else _0x26420e['counts'][_0x2e7b73(0x1e2)][_0x2e7b73(0x1cb)]++;}}for(const _0x1ca4c8 of _0x50851d){const _0x1446bc=_0x1ca4c8[_0x2e7b73(0x197)][_0x2e7b73(0xf3)][_0x2e7b73(0x176)](),_0x4beb91=getSanitizedPathWithMigration(getIntegrationsDir(_0x40e87c),_0x1446bc,_0x2e7b73(0x15c));_0x4beb91[_0x2e7b73(0x153)]&&this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0xd0)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x4beb91['oldPath'])+_0x2e7b73(0x151)+a148_0x55bc74['basename'](_0x4beb91[_0x2e7b73(0x11f)]));const _0x322e79=_0x4beb91[_0x2e7b73(0x11f)],_0x9d839a=await apiIntegrationToYaml(_0x1ca4c8,_0x559674),_0x5e5045=toIntegrationYamlString(_0x9d839a),_0x1dc2f4=!a148_0x1a108a[_0x2e7b73(0x16e)](_0x322e79);let _0x49c13f=_0x1dc2f4,_0x4cc9d0;if(!_0x1dc2f4){const _0x1fef67=a148_0x1a108a['readFileSync'](_0x322e79,_0x2e7b73(0xfd)),_0x580252=generateDiff(_0x1fef67,_0x5e5045);_0x49c13f=hasChanges(_0x580252),_0x49c13f&&(_0x4cc9d0=formatDiffWithColors(_0x580252));}_0x38796b[_0x2e7b73(0x137)]({'path':_0x322e79,'content':_0x5e5045}),_0x26420e[_0x2e7b73(0x195)][_0x2e7b73(0x137)]({'name':_0x1446bc,'outputPath':_0x322e79,'isNew':_0x1dc2f4,'hasChanges':_0x49c13f,'diff':_0x4cc9d0}),_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x195)][_0x2e7b73(0xea)]++;if(_0x1dc2f4)_0x26420e['counts'][_0x2e7b73(0x195)][_0x2e7b73(0x17f)]++;else{if(_0x49c13f)_0x26420e[_0x2e7b73(0x1c8)]['integrations'][_0x2e7b73(0x10a)]++;else _0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x195)]['unchanged']++;}}for(const _0x295f7a of _0x21105c){if(_0x295f7a[_0x2e7b73(0x197)][_0x2e7b73(0x120)])continue;const _0x181d19=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x40e87c),_0x295f7a['attributes'][_0x2e7b73(0xf0)]);_0x181d19['renamed']&&this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0x12b)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x181d19[_0x2e7b73(0x130)])+_0x2e7b73(0x151)+a148_0x55bc74['basename'](_0x181d19[_0x2e7b73(0x11f)]));const _0x3c52d9=_0x181d19[_0x2e7b73(0x11f)],_0x264c38=a148_0x55bc74[_0x2e7b73(0x16c)](_0x3c52d9,sanitizeForFilesystem(_0x295f7a[_0x2e7b73(0x197)]['name'])+_0x2e7b73(0x15c)),_0x2830b5=a148_0x55bc74[_0x2e7b73(0x16c)](_0x3c52d9,_0x2e7b73(0xcc)),_0x357f7e=apiExperimentalKnowledgeBaseToYaml(_0x295f7a),_0x31df26=toExperimentalKnowledgeBaseYamlString(_0x357f7e),_0x344098=!a148_0x1a108a['existsSync'](_0x3c52d9);let _0x259fe7=_0x344098,_0x2d0198,_0x344a83=_0x31df26;const _0x2b9846=[..._0x357f7e[_0x2e7b73(0xcc)]][_0x2e7b73(0x1b5)]((_0x152dd0,_0x153309)=>_0x152dd0['name'][_0x2e7b73(0x1c1)](_0x153309[_0x2e7b73(0xf0)]));for(const _0x1a57bd of _0x2b9846){_0x344a83+=_0x2e7b73(0xd7)+_0x1a57bd['name']+_0x2e7b73(0x13f)+_0x1a57bd[_0x2e7b73(0x1b1)]+_0x2e7b73(0x1da)+_0x1a57bd[_0x2e7b73(0xf0)]+_0x2e7b73(0x13f)+_0x1a57bd[_0x2e7b73(0x109)]+'\x0a';}if(!_0x344098){let _0x3561bb='';a148_0x1a108a[_0x2e7b73(0x16e)](_0x264c38)&&(_0x3561bb=a148_0x1a108a[_0x2e7b73(0xdc)](_0x264c38,_0x2e7b73(0xfd)));if(a148_0x1a108a[_0x2e7b73(0x16e)](_0x2830b5)){const _0x1b509c=a148_0x1a108a[_0x2e7b73(0x1c7)](_0x2830b5,{'withFileTypes':!![]}),_0x572402=_0x1b509c[_0x2e7b73(0x182)](_0x36609a=>_0x36609a[_0x2e7b73(0xdf)]())['sort']((_0x3e3529,_0x531e06)=>_0x3e3529[_0x2e7b73(0xf0)][_0x2e7b73(0x1c1)](_0x531e06[_0x2e7b73(0xf0)]));for(const _0x56b4d8 of _0x572402){const _0x519a12=a148_0x55bc74[_0x2e7b73(0x16c)](_0x2830b5,_0x56b4d8[_0x2e7b73(0xf0)],'code.js'),_0x42ec2f=a148_0x55bc74['join'](_0x2830b5,_0x56b4d8[_0x2e7b73(0xf0)],'json_schema.json');a148_0x1a108a[_0x2e7b73(0x16e)](_0x519a12)&&(_0x3561bb+='\x0a---\x20function:\x20'+_0x56b4d8[_0x2e7b73(0xf0)]+_0x2e7b73(0x13f)+a148_0x1a108a['readFileSync'](_0x519a12,'utf-8')+'\x0a'),a148_0x1a108a['existsSync'](_0x42ec2f)&&(_0x3561bb+=_0x2e7b73(0x13e)+_0x56b4d8[_0x2e7b73(0xf0)]+_0x2e7b73(0x13f)+a148_0x1a108a[_0x2e7b73(0xdc)](_0x42ec2f,'utf-8')+'\x0a');}}const _0x390838=generateDiff(_0x3561bb,_0x344a83);_0x259fe7=hasChanges(_0x390838),_0x259fe7&&(_0x2d0198=formatDiffWithColors(_0x390838));}_0x38796b[_0x2e7b73(0x137)]({'path':_0x3c52d9,'content':'','isDir':!![]}),_0x38796b[_0x2e7b73(0x137)]({'path':_0x264c38,'content':_0x31df26}),_0x38796b[_0x2e7b73(0x137)]({'path':_0x2830b5,'content':'','isDir':!![]});for(const _0xc92fb2 of _0x357f7e[_0x2e7b73(0xcc)]){const _0x533330=a148_0x55bc74[_0x2e7b73(0x16c)](_0x2830b5,sanitizeForFilesystem(_0xc92fb2[_0x2e7b73(0xf0)])),_0x19d58b=a148_0x55bc74[_0x2e7b73(0x16c)](_0x533330,_0x2e7b73(0x184)),_0x524d30=a148_0x55bc74[_0x2e7b73(0x16c)](_0x533330,'json_schema.json');_0x38796b[_0x2e7b73(0x137)]({'path':_0x533330,'content':'','isDir':!![]}),_0x38796b[_0x2e7b73(0x137)]({'path':_0x19d58b,'content':_0xc92fb2['code']}),_0x38796b['push']({'path':_0x524d30,'content':_0xc92fb2[_0x2e7b73(0x109)]});}if(a148_0x1a108a[_0x2e7b73(0x16e)](_0x2830b5)){const _0x1bb205=a148_0x1a108a[_0x2e7b73(0x1c7)](_0x2830b5,{'withFileTypes':!![]}),_0x964e08=new Set(_0x357f7e['functions'][_0x2e7b73(0x1db)](_0x59056e=>sanitizeForFilesystem(_0x59056e[_0x2e7b73(0xf0)])));for(const _0x5b1bc3 of _0x1bb205){if(_0x5b1bc3['isDirectory']()&&!_0x964e08['has'](_0x5b1bc3[_0x2e7b73(0xf0)])){const _0xde47a2=a148_0x55bc74[_0x2e7b73(0x16c)](_0x2830b5,_0x5b1bc3[_0x2e7b73(0xf0)]);_0x35ff3a[_0x2e7b73(0x137)]({'path':_0xde47a2,'isDir':!![]});}}}_0x26420e[_0x2e7b73(0x1b7)]['push']({'name':_0x295f7a[_0x2e7b73(0x197)]['name'],'outputPath':_0x3c52d9,'isNew':_0x344098,'hasChanges':_0x259fe7,'diff':_0x2d0198}),_0x26420e['counts']['experimentalKnowledgeBases'][_0x2e7b73(0xea)]++;if(_0x344098)_0x26420e['counts'][_0x2e7b73(0x1b7)][_0x2e7b73(0x17f)]++;else{if(_0x259fe7)_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x1b7)][_0x2e7b73(0x10a)]++;else _0x26420e[_0x2e7b73(0x1c8)]['experimentalKnowledgeBases'][_0x2e7b73(0x1cb)]++;}}for(const _0x48d48c of _0x2bdcd1){if(_0x48d48c[_0x2e7b73(0x197)]['isManaged'])continue;const _0x148d13=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x40e87c),_0x48d48c['attributes'][_0x2e7b73(0xf0)]);_0x148d13[_0x2e7b73(0x153)]&&this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0x126)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x148d13[_0x2e7b73(0x130)])+'\x20→\x20'+a148_0x55bc74['basename'](_0x148d13[_0x2e7b73(0x11f)]));const _0x20b369=_0x148d13[_0x2e7b73(0x11f)],_0x58aeaa=a148_0x55bc74[_0x2e7b73(0x16c)](_0x20b369,sanitizeForFilesystem(_0x48d48c[_0x2e7b73(0x197)][_0x2e7b73(0xf0)])+_0x2e7b73(0x15c)),_0x5f88b=a148_0x55bc74['join'](_0x20b369,_0x2e7b73(0x184)),_0x4470e5=a148_0x55bc74[_0x2e7b73(0x16c)](_0x20b369,_0x2e7b73(0x128)),_0x3fad96=apiExperimentalArtifactToYaml(_0x48d48c),_0x43b81d=toExperimentalArtifactYamlString(_0x3fad96),_0x3b5e63=!a148_0x1a108a[_0x2e7b73(0x16e)](_0x20b369);let _0x27ce0a=_0x3b5e63,_0x449ef5,_0x163406=_0x43b81d+(_0x2e7b73(0x147)+_0x3fad96['code']+'\x0a');const _0x2a499a=[..._0x3fad96[_0x2e7b73(0x128)]]['sort']((_0x12f076,_0x1b76e2)=>_0x12f076[_0x2e7b73(0x1ca)][_0x2e7b73(0x1c1)](_0x1b76e2[_0x2e7b73(0x1ca)]));for(const _0x52994a of _0x2a499a){_0x163406+=_0x2e7b73(0x15e)+_0x52994a[_0x2e7b73(0x1ca)]+_0x2e7b73(0x13f)+_0x52994a['text_content']+'\x0a';}if(!_0x3b5e63){let _0x446f01='';a148_0x1a108a[_0x2e7b73(0x16e)](_0x58aeaa)&&(_0x446f01=a148_0x1a108a[_0x2e7b73(0xdc)](_0x58aeaa,_0x2e7b73(0xfd)));a148_0x1a108a[_0x2e7b73(0x16e)](_0x5f88b)&&(_0x446f01+=_0x2e7b73(0x147)+a148_0x1a108a[_0x2e7b73(0xdc)](_0x5f88b,_0x2e7b73(0xfd))+'\x0a');if(a148_0x1a108a[_0x2e7b73(0x16e)](_0x4470e5)){const _0x2bda9e=a148_0x1a108a[_0x2e7b73(0x1c7)](_0x4470e5),_0x419173=_0x2bda9e[_0x2e7b73(0x182)](_0x20ac07=>{const _0x3de8c1=_0x2e7b73,_0x491c1c=a148_0x55bc74[_0x3de8c1(0x16c)](_0x4470e5,_0x20ac07);return a148_0x1a108a[_0x3de8c1(0x132)](_0x491c1c)[_0x3de8c1(0xe5)]();})['sort']((_0x3c117d,_0x244d4f)=>_0x3c117d[_0x2e7b73(0x1c1)](_0x244d4f));for(const _0x5560fe of _0x419173){const _0x5b8022=a148_0x55bc74['join'](_0x4470e5,_0x5560fe);_0x446f01+=_0x2e7b73(0x15e)+_0x5560fe+_0x2e7b73(0x13f)+a148_0x1a108a['readFileSync'](_0x5b8022,_0x2e7b73(0xfd))+'\x0a';}}const _0x599e1c=generateDiff(_0x446f01,_0x163406);_0x27ce0a=hasChanges(_0x599e1c),_0x27ce0a&&(_0x449ef5=formatDiffWithColors(_0x599e1c));}_0x38796b[_0x2e7b73(0x137)]({'path':_0x20b369,'content':'','isDir':!![]}),_0x38796b[_0x2e7b73(0x137)]({'path':_0x58aeaa,'content':_0x43b81d}),_0x38796b['push']({'path':_0x5f88b,'content':_0x3fad96[_0x2e7b73(0x1b1)]});if(_0x3fad96[_0x2e7b73(0x128)]['length']>0x0){_0x38796b[_0x2e7b73(0x137)]({'path':_0x4470e5,'content':'','isDir':!![]});for(const _0x4a7e69 of _0x3fad96[_0x2e7b73(0x128)]){const _0x42d5ae=a148_0x55bc74[_0x2e7b73(0x16c)](_0x4470e5,_0x4a7e69[_0x2e7b73(0x1ca)]);_0x38796b[_0x2e7b73(0x137)]({'path':_0x42d5ae,'content':_0x4a7e69[_0x2e7b73(0x15a)]});}}if(a148_0x1a108a[_0x2e7b73(0x16e)](_0x4470e5)){const _0x17c00b=a148_0x1a108a[_0x2e7b73(0x1c7)](_0x4470e5),_0x148417=new Set(_0x3fad96[_0x2e7b73(0x128)][_0x2e7b73(0x1db)](_0x5c9661=>_0x5c9661[_0x2e7b73(0x1ca)]));for(const _0x542b64 of _0x17c00b){const _0x19cbbf=a148_0x55bc74[_0x2e7b73(0x16c)](_0x4470e5,_0x542b64);a148_0x1a108a[_0x2e7b73(0x132)](_0x19cbbf)[_0x2e7b73(0xe5)]()&&!_0x148417[_0x2e7b73(0x180)](_0x542b64)&&_0x35ff3a['push']({'path':_0x19cbbf});}}_0x26420e[_0x2e7b73(0x10f)][_0x2e7b73(0x137)]({'name':_0x48d48c[_0x2e7b73(0x197)][_0x2e7b73(0xf0)],'outputPath':_0x20b369,'isNew':_0x3b5e63,'hasChanges':_0x27ce0a,'diff':_0x449ef5}),_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x10f)]['total']++;if(_0x3b5e63)_0x26420e['counts'][_0x2e7b73(0x10f)][_0x2e7b73(0x17f)]++;else{if(_0x27ce0a)_0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x10f)]['updated']++;else _0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x10f)][_0x2e7b73(0x1cb)]++;}}for(const _0x448f0d of _0x576e97){const _0x24f630=getSanitizedPathWithMigration(getFormInterfacesDir(_0x40e87c),_0x448f0d[_0x2e7b73(0x197)]['name'],'.yml');_0x24f630[_0x2e7b73(0x153)]&&this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0x190)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x24f630['oldPath'])+_0x2e7b73(0x151)+a148_0x55bc74['basename'](_0x24f630[_0x2e7b73(0x11f)]));const _0x5384fd=_0x24f630[_0x2e7b73(0x11f)],_0x32c924=await apiFormInterfaceToYaml(_0x448f0d,_0x559674),_0x1558f9=toFormInterfaceYamlString(_0x32c924),_0xb8f8e5=!a148_0x1a108a[_0x2e7b73(0x16e)](_0x5384fd);let _0x3efc2d=_0xb8f8e5,_0x2f8d61;if(!_0xb8f8e5){const _0x2f66cf=a148_0x1a108a[_0x2e7b73(0xdc)](_0x5384fd,_0x2e7b73(0xfd)),_0x3dcfc4=generateDiff(_0x2f66cf,_0x1558f9);_0x3efc2d=hasChanges(_0x3dcfc4),_0x3efc2d&&(_0x2f8d61=formatDiffWithColors(_0x3dcfc4));}_0x38796b[_0x2e7b73(0x137)]({'path':_0x5384fd,'content':_0x1558f9}),_0x26420e[_0x2e7b73(0x18a)][_0x2e7b73(0x137)]({'name':_0x448f0d['attributes'][_0x2e7b73(0xf0)],'outputPath':_0x5384fd,'isNew':_0xb8f8e5,'hasChanges':_0x3efc2d,'diff':_0x2f8d61}),_0x26420e['counts']['formInterfaces']['total']++;if(_0xb8f8e5)_0x26420e[_0x2e7b73(0x1c8)]['formInterfaces'][_0x2e7b73(0x17f)]++;else{if(_0x3efc2d)_0x26420e[_0x2e7b73(0x1c8)]['formInterfaces']['updated']++;else _0x26420e['counts'][_0x2e7b73(0x18a)][_0x2e7b73(0x1cb)]++;}}for(const _0x6c4c67 of _0x4b2525){if(_0x6c4c67[_0x2e7b73(0x197)][_0x2e7b73(0x120)])continue;const _0x402cd2=getSanitizedPathWithMigration(getChatInterfacesDir(_0x40e87c),_0x6c4c67[_0x2e7b73(0x197)]['name'],_0x2e7b73(0x15c));_0x402cd2[_0x2e7b73(0x153)]&&this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0xe7)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x402cd2[_0x2e7b73(0x130)])+_0x2e7b73(0x151)+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x402cd2[_0x2e7b73(0x11f)]));const _0x1c9891=_0x402cd2['path'],_0x448e3d=await apiChatInterfaceToYaml(_0x6c4c67,_0x559674),_0x4decc5=toChatInterfaceYamlString(_0x448e3d),_0x43d379=!a148_0x1a108a['existsSync'](_0x1c9891);let _0x1bf78f=_0x43d379,_0x3113a4;if(!_0x43d379){const _0x48f3f1=a148_0x1a108a[_0x2e7b73(0xdc)](_0x1c9891,_0x2e7b73(0xfd)),_0x7dfe6a=generateDiff(_0x48f3f1,_0x4decc5);_0x1bf78f=hasChanges(_0x7dfe6a),_0x1bf78f&&(_0x3113a4=formatDiffWithColors(_0x7dfe6a));}_0x38796b['push']({'path':_0x1c9891,'content':_0x4decc5}),_0x26420e[_0x2e7b73(0x19c)][_0x2e7b73(0x137)]({'name':_0x6c4c67[_0x2e7b73(0x197)][_0x2e7b73(0xf0)],'outputPath':_0x1c9891,'isNew':_0x43d379,'hasChanges':_0x1bf78f,'diff':_0x3113a4}),_0x26420e[_0x2e7b73(0x1c8)]['chatInterfaces'][_0x2e7b73(0xea)]++;if(_0x43d379)_0x26420e['counts'][_0x2e7b73(0x19c)]['new']++;else{if(_0x1bf78f)_0x26420e['counts'][_0x2e7b73(0x19c)]['updated']++;else _0x26420e[_0x2e7b73(0x1c8)][_0x2e7b73(0x19c)][_0x2e7b73(0x1cb)]++;}}if(_0x422b32?.[_0x2e7b73(0xe0)])return _0x26420e;a148_0x1a108a['mkdirSync'](_0x40e87c,{'recursive':!![]}),a148_0x1a108a[_0x2e7b73(0x14e)](getKnowledgeBasesDir(_0x40e87c),{'recursive':!![]}),a148_0x1a108a[_0x2e7b73(0x14e)](getPromptsDir(_0x40e87c),{'recursive':!![]}),a148_0x1a108a[_0x2e7b73(0x14e)](getIntegrationsDir(_0x40e87c),{'recursive':!![]}),a148_0x1a108a[_0x2e7b73(0x14e)](getExperimentalKnowledgeBasesDir(_0x40e87c),{'recursive':!![]}),a148_0x1a108a['mkdirSync'](getExperimentalArtifactsDir(_0x40e87c),{'recursive':!![]}),a148_0x1a108a[_0x2e7b73(0x14e)](getFormInterfacesDir(_0x40e87c),{'recursive':!![]}),a148_0x1a108a[_0x2e7b73(0x14e)](getChatInterfacesDir(_0x40e87c),{'recursive':!![]});const _0x1a284b=a148_0x55bc74[_0x2e7b73(0x16c)](_0x40e87c,_0x2e7b73(0x187));a148_0x1a108a[_0x2e7b73(0x1c6)](_0x1a284b,createAgentConfigContent(_0x222127));for(const _0x2ad07a of _0x38796b){if(_0x2ad07a[_0x2e7b73(0x125)])a148_0x1a108a[_0x2e7b73(0x14e)](_0x2ad07a[_0x2e7b73(0x11f)],{'recursive':!![]});else{const _0x4fa226=a148_0x55bc74[_0x2e7b73(0x101)](_0x2ad07a[_0x2e7b73(0x11f)]);!a148_0x1a108a[_0x2e7b73(0x16e)](_0x4fa226)&&a148_0x1a108a[_0x2e7b73(0x14e)](_0x4fa226,{'recursive':!![]}),a148_0x1a108a[_0x2e7b73(0x1c6)](_0x2ad07a[_0x2e7b73(0x11f)],_0x2ad07a[_0x2e7b73(0x165)]);}}for(const _0x3f75dc of _0x35ff3a){_0x3f75dc['isDir']?(a148_0x1a108a[_0x2e7b73(0x1b6)](_0x3f75dc[_0x2e7b73(0x11f)],{'recursive':!![],'force':!![]}),this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0x1c0)+a148_0x55bc74['basename'](a148_0x55bc74[_0x2e7b73(0x101)](_0x3f75dc['path']))+'/'+a148_0x55bc74['basename'](_0x3f75dc[_0x2e7b73(0x11f)]))):(a148_0x1a108a[_0x2e7b73(0x1b6)](_0x3f75dc[_0x2e7b73(0x11f)],{'force':!![]}),this[_0x2e7b73(0x1be)][_0x2e7b73(0x171)](_0x2e7b73(0x12f)+a148_0x55bc74[_0x2e7b73(0x1b2)](a148_0x55bc74[_0x2e7b73(0x101)](_0x3f75dc[_0x2e7b73(0x11f)]))+'/'+a148_0x55bc74[_0x2e7b73(0x1b2)](_0x3f75dc[_0x2e7b73(0x11f)])));}return _0x26420e;}async[a148_0x41755e(0x160)](_0x8924d7,_0x1d91fe){const _0x2678da=a148_0x41755e,_0x4bc0f8=a148_0x55bc74[_0x2678da(0x16c)](_0x8924d7,_0x2678da(0x187));if(!a148_0x1a108a[_0x2678da(0x16e)](_0x4bc0f8))throw new SDKError(ErrorCode[_0x2678da(0x178)],_0x2678da(0x1d9)+_0x8924d7,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x816c01=loadAgentConfig(_0x4bc0f8),_0x37bec5=await this[_0x2678da(0xff)](_0x816c01[_0x2678da(0xd8)]),_0x5d92c3=await this['client'][_0x2678da(0x1cd)](_0x37bec5),_0x22d3bb=_0x5d92c3['attributes'][_0x2678da(0xf0)],_0x4d6ec2={'projectName':_0x22d3bb,'projectId':_0x37bec5,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x320cbc=[],_0x1b3c73=[],_0x1a350e=[],_0x388191=[],_0x36d6e0=[],_0x335b74=[],_0x6ea28a=a148_0x1a108a[_0x2678da(0x1c7)](_0x8924d7,{'withFileTypes':!![]});for(const _0x2418bb of _0x6ea28a){if(!_0x2418bb[_0x2678da(0xdf)]())continue;if(['knowledge_bases',_0x2678da(0x1e2),_0x2678da(0x195),_0x2678da(0x102),_0x2678da(0x1a5),'form_interfaces','chat_interfaces'][_0x2678da(0x1c3)](_0x2418bb['name']))continue;const _0x256234=a148_0x55bc74[_0x2678da(0x16c)](_0x8924d7,_0x2418bb[_0x2678da(0xf0)]);if(isAgentDir(_0x256234)){const _0x202c3b=a148_0x55bc74[_0x2678da(0x16c)](_0x256234,_0x2678da(0xda)),_0x259f6b=a148_0x55bc74[_0x2678da(0x16c)](_0x256234,_0x2678da(0xf6)),_0x1b33c9=a148_0x55bc74[_0x2678da(0x16c)](_0x256234,_0x2678da(0x115)),_0x1fdee3=parseAgentYaml(a148_0x1a108a[_0x2678da(0xdc)](_0x202c3b,_0x2678da(0xfd)),_0x202c3b),_0x2a4d6e=a148_0x1a108a[_0x2678da(0x16e)](_0x259f6b)?a148_0x1a108a[_0x2678da(0xdc)](_0x259f6b,_0x2678da(0xfd)):'',_0x5f0615=a148_0x1a108a['existsSync'](_0x1b33c9)?a148_0x1a108a[_0x2678da(0xdc)](_0x1b33c9,_0x2678da(0xfd)):_0x1fdee3[_0x2678da(0x150)];_0x320cbc[_0x2678da(0x137)]({'name':_0x1fdee3[_0x2678da(0xf0)],'dir':_0x256234,'yaml':_0x1fdee3,'systemPrompt':_0x2a4d6e,'starterMessage':_0x5f0615});}}const _0x5ef89a=getKnowledgeBasesDir(_0x8924d7);if(a148_0x1a108a['existsSync'](_0x5ef89a)){const _0x5615a9=a148_0x1a108a[_0x2678da(0x1c7)](_0x5ef89a);for(const _0x3c8ef5 of _0x5615a9){const _0x4595e6=a148_0x55bc74[_0x2678da(0x16c)](_0x5ef89a,_0x3c8ef5);if(_0x3c8ef5[_0x2678da(0x154)](_0x2678da(0x15c))){const _0x23067f=parseKnowledgeBaseYaml(a148_0x1a108a[_0x2678da(0xdc)](_0x4595e6,_0x2678da(0xfd)),_0x4595e6);_0x1b3c73[_0x2678da(0x137)]({'name':_0x23067f['name'],'path':_0x4595e6,'yaml':_0x23067f});}else{if(_0x3c8ef5[_0x2678da(0x154)](_0x2678da(0x1dc))){const _0x1bce04=a148_0x1a108a[_0x2678da(0xdc)](_0x4595e6,'utf-8'),{name:_0x295c2f,text:_0x1b885b}=parseTextKnowledgeBaseMd(_0x1bce04,_0x3c8ef5);_0x1a350e[_0x2678da(0x137)]({'name':_0x295c2f,'path':_0x4595e6,'text':_0x1b885b});}}}}const _0x4c8983=getPromptsDir(_0x8924d7);if(a148_0x1a108a[_0x2678da(0x16e)](_0x4c8983)){const _0x4fc456=a148_0x1a108a[_0x2678da(0x1c7)](_0x4c8983)[_0x2678da(0x182)](_0x115923=>_0x115923['endsWith'](_0x2678da(0x15c)));for(const _0x120fd0 of _0x4fc456){const _0x3a029f=a148_0x55bc74[_0x2678da(0x16c)](_0x4c8983,_0x120fd0),_0x23239c=parsePromptYaml(a148_0x1a108a[_0x2678da(0xdc)](_0x3a029f,_0x2678da(0xfd)),_0x3a029f);_0x388191[_0x2678da(0x137)]({'name':_0x23239c[_0x2678da(0xf0)],'path':_0x3a029f,'yaml':_0x23239c});}}const _0x1f7746=[],_0x20bc60=getIntegrationsDir(_0x8924d7);if(a148_0x1a108a['existsSync'](_0x20bc60)){const _0x454d31=a148_0x1a108a['readdirSync'](_0x20bc60)['filter'](_0x4720e9=>_0x4720e9[_0x2678da(0x154)]('.yml'));for(const _0x10baa3 of _0x454d31){const _0x461296=a148_0x55bc74[_0x2678da(0x16c)](_0x20bc60,_0x10baa3),_0xc01f81=parseIntegrationYaml(a148_0x1a108a[_0x2678da(0xdc)](_0x461296,'utf-8'),_0x461296);if(!SAFE_INTEGRATION_TYPES[_0x2678da(0x1c3)](_0xc01f81['service_type']['toLowerCase']())){this[_0x2678da(0x1be)][_0x2678da(0xed)]('Skipping\x20integration\x20\x27'+_0xc01f81['name']+_0x2678da(0x138)+_0xc01f81['service_type']+_0x2678da(0x1d2)+(_0x2678da(0x1e8)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x2678da(0x164))+_0x2678da(0x135));continue;}_0x1f7746[_0x2678da(0x137)]({'name':_0xc01f81[_0x2678da(0xf0)],'path':_0x461296,'yaml':_0xc01f81});}}const _0x5aff56=getExperimentalKnowledgeBasesDir(_0x8924d7);if(a148_0x1a108a[_0x2678da(0x16e)](_0x5aff56)){const _0x473012=a148_0x1a108a[_0x2678da(0x1c7)](_0x5aff56,{'withFileTypes':!![]});for(const _0x34e9b0 of _0x473012){if(!_0x34e9b0[_0x2678da(0xdf)]())continue;const _0x480534=a148_0x55bc74[_0x2678da(0x16c)](_0x5aff56,_0x34e9b0['name']),_0x5d7aca=a148_0x55bc74[_0x2678da(0x16c)](_0x480534,_0x34e9b0[_0x2678da(0xf0)]+_0x2678da(0x15c)),_0x27dc80=a148_0x55bc74['join'](_0x480534,_0x2678da(0xcc));if(!a148_0x1a108a[_0x2678da(0x16e)](_0x5d7aca))continue;const _0x1233b6=parseExperimentalKnowledgeBaseYaml(a148_0x1a108a[_0x2678da(0xdc)](_0x5d7aca,_0x2678da(0xfd)),_0x5d7aca),_0x4b8233=[];if(a148_0x1a108a[_0x2678da(0x16e)](_0x27dc80)){const _0x30edbe=a148_0x1a108a[_0x2678da(0x1c7)](_0x27dc80,{'withFileTypes':!![]});for(const _0x1fe3ce of _0x30edbe){if(!_0x1fe3ce['isDirectory']())continue;const _0x2a17fe=a148_0x55bc74[_0x2678da(0x16c)](_0x27dc80,_0x1fe3ce[_0x2678da(0xf0)]),_0x3d9edd=a148_0x55bc74[_0x2678da(0x16c)](_0x2a17fe,_0x2678da(0x184)),_0x17f7c3=a148_0x55bc74[_0x2678da(0x16c)](_0x2a17fe,'json_schema.json');a148_0x1a108a[_0x2678da(0x16e)](_0x3d9edd)&&a148_0x1a108a[_0x2678da(0x16e)](_0x17f7c3)&&_0x4b8233[_0x2678da(0x137)]({'name':_0x1fe3ce[_0x2678da(0xf0)],'code':a148_0x1a108a['readFileSync'](_0x3d9edd,_0x2678da(0xfd)),'json_schema':a148_0x1a108a[_0x2678da(0xdc)](_0x17f7c3,_0x2678da(0xfd))});}}const _0x42ffbe={..._0x1233b6,'variables':_0x1233b6['variables']||[],'functions':_0x4b8233};_0x36d6e0[_0x2678da(0x137)]({'name':_0x1233b6[_0x2678da(0xf0)],'dir':_0x480534,'def':_0x42ffbe});}}const _0x4cbbb9=getExperimentalArtifactsDir(_0x8924d7);if(a148_0x1a108a[_0x2678da(0x16e)](_0x4cbbb9)){const _0x988eea=a148_0x1a108a['readdirSync'](_0x4cbbb9,{'withFileTypes':!![]});for(const _0x30978f of _0x988eea){if(!_0x30978f[_0x2678da(0xdf)]())continue;const _0x328629=a148_0x55bc74['join'](_0x4cbbb9,_0x30978f[_0x2678da(0xf0)]),_0x4cfe74=a148_0x55bc74[_0x2678da(0x16c)](_0x328629,_0x30978f[_0x2678da(0xf0)]+_0x2678da(0x15c)),_0x369844=a148_0x55bc74[_0x2678da(0x16c)](_0x328629,_0x2678da(0x184)),_0x211127=a148_0x55bc74[_0x2678da(0x16c)](_0x328629,'files');if(!a148_0x1a108a[_0x2678da(0x16e)](_0x4cfe74)||!a148_0x1a108a[_0x2678da(0x16e)](_0x369844))continue;const _0x374e4e=parseExperimentalArtifactYaml(a148_0x1a108a[_0x2678da(0xdc)](_0x4cfe74,_0x2678da(0xfd)),_0x4cfe74),_0x1d1e45=a148_0x1a108a[_0x2678da(0xdc)](_0x369844,_0x2678da(0xfd)),_0x18e1c0=[];if(a148_0x1a108a[_0x2678da(0x16e)](_0x211127)){const _0x3a0190=a148_0x1a108a['readdirSync'](_0x211127);for(const _0x225063 of _0x3a0190){const _0x4f0fd8=a148_0x55bc74[_0x2678da(0x16c)](_0x211127,_0x225063);a148_0x1a108a[_0x2678da(0x132)](_0x4f0fd8)[_0x2678da(0xe5)]()&&_0x18e1c0[_0x2678da(0x137)]({'file_name':_0x225063,'text_content':a148_0x1a108a[_0x2678da(0xdc)](_0x4f0fd8,_0x2678da(0xfd))});}}const _0x3c0404={..._0x374e4e,'code':_0x1d1e45,'files':_0x18e1c0};_0x335b74['push']({'name':_0x374e4e[_0x2678da(0xf0)],'dir':_0x328629,'def':_0x3c0404});}}const _0x559758=[],_0x6a96cd=getFormInterfacesDir(_0x8924d7);if(a148_0x1a108a[_0x2678da(0x16e)](_0x6a96cd)){const _0x1c30ce=a148_0x1a108a[_0x2678da(0x1c7)](_0x6a96cd)['filter'](_0x1b8694=>_0x1b8694[_0x2678da(0x154)](_0x2678da(0x15c)));for(const _0x152cac of _0x1c30ce){const _0x43e1b5=a148_0x55bc74[_0x2678da(0x16c)](_0x6a96cd,_0x152cac),_0x3ac4b9=parseFormInterfaceYaml(a148_0x1a108a[_0x2678da(0xdc)](_0x43e1b5,'utf-8'),_0x43e1b5);_0x559758['push']({'name':_0x3ac4b9[_0x2678da(0xf0)],'path':_0x43e1b5,'yaml':_0x3ac4b9});}}const _0x31c15f=[],_0x306951=getChatInterfacesDir(_0x8924d7);if(a148_0x1a108a[_0x2678da(0x16e)](_0x306951)){const _0x539c82=a148_0x1a108a[_0x2678da(0x1c7)](_0x306951)[_0x2678da(0x182)](_0x4aebe4=>_0x4aebe4['endsWith'](_0x2678da(0x15c)));for(const _0x4a1380 of _0x539c82){const _0x10f311=a148_0x55bc74[_0x2678da(0x16c)](_0x306951,_0x4a1380),_0x469423=parseChatInterfaceYaml(a148_0x1a108a['readFileSync'](_0x10f311,'utf-8'),_0x10f311);_0x31c15f[_0x2678da(0x137)]({'name':_0x469423[_0x2678da(0xf0)],'path':_0x10f311,'yaml':_0x469423});}}const _0x4ab272=await this['client'][_0x2678da(0x19f)](_0x37bec5),_0x3dec7b=await this['client']['listKnowledgeBases'](_0x37bec5),_0x5941a9=await this[_0x2678da(0x118)][_0x2678da(0xcf)](_0x37bec5),_0x155746=await this[_0x2678da(0x118)][_0x2678da(0x1c2)](_0x37bec5),_0xf67792=await this[_0x2678da(0x118)][_0x2678da(0x1e7)](_0x37bec5),_0x1830ed=await safeListOrEmpty(()=>this[_0x2678da(0x118)][_0x2678da(0x12e)](_0x37bec5)),_0x50844c=await safeListOrEmpty(()=>this['client'][_0x2678da(0x106)](_0x37bec5)),_0x55372f=await safeListOrEmpty(()=>this[_0x2678da(0x118)][_0x2678da(0x1cf)](_0x37bec5)),_0x286838=await safeListOrEmpty(()=>this['client']['listChatInterfaces'](_0x37bec5)),_0x98065a=await fetchAllToolTargetMaps((_0x5edf40,_0xe5090a)=>this[_0x2678da(0x118)]['listToolTargets'](_0x5edf40,_0xe5090a),_0x37bec5),_0x53426e=new Map(),_0x21801c=new Map(),_0x5f2e3c=new Map(),_0x275a2a=new Map(),_0x3273bc=new Map(),_0x274f1f=new Map(),_0x49b4b2=new Map();for(const _0x35e08e of _0x4ab272){_0x53426e[_0x2678da(0x157)](_0x35e08e[_0x2678da(0x197)][_0x2678da(0xf0)],_0x35e08e);}for(const _0x100e0f of _0x3dec7b){_0x21801c[_0x2678da(0x157)](_0x100e0f[_0x2678da(0x197)][_0x2678da(0xf0)],_0x100e0f);}for(const _0x4e73e7 of _0x5941a9){_0x5f2e3c['set'](_0x4e73e7['attributes'][_0x2678da(0xf0)],_0x4e73e7);}for(const _0x47edf1 of _0x155746){_0x275a2a[_0x2678da(0x157)](_0x47edf1['attributes']['name'],_0x47edf1);}for(const _0x59bc6e of _0xf67792){_0x3273bc[_0x2678da(0x157)](_0x59bc6e[_0x2678da(0x197)][_0x2678da(0xf3)]['toLowerCase'](),_0x59bc6e);}for(const _0x99c354 of _0x1830ed){_0x274f1f[_0x2678da(0x157)](_0x99c354['attributes'][_0x2678da(0xf0)],_0x99c354);}for(const _0x5e2fc9 of _0x50844c){_0x49b4b2[_0x2678da(0x157)](_0x5e2fc9[_0x2678da(0x197)]['name'],_0x5e2fc9);}const _0xa2aae5=new Map(),_0x11ba7e=new Map();for(const _0x4dc78a of _0x55372f){_0xa2aae5[_0x2678da(0x157)](_0x4dc78a['attributes'][_0x2678da(0xf0)],_0x4dc78a);}for(const _0x14bd41 of _0x286838){_0x11ba7e['set'](_0x14bd41[_0x2678da(0x197)][_0x2678da(0xf0)],_0x14bd41);}const _0x1aa0c1=new Map(),_0x39c5a2=new Map();for(const _0x35e3e7 of _0x4ab272){_0x1aa0c1['set'](_0x35e3e7[_0x2678da(0x197)][_0x2678da(0xf0)],_0x35e3e7['id']),_0x39c5a2['set'](_0x35e3e7['id'],_0x35e3e7[_0x2678da(0x197)]['name']);}const _0x31276d=new Map(),_0x1f92eb=new Map();for(const _0x1f17f3 of _0x155746){_0x31276d[_0x2678da(0x157)](_0x1f17f3['attributes']['name'],_0x1f17f3['id']),_0x1f92eb[_0x2678da(0x157)](_0x1f17f3['id'],_0x1f17f3[_0x2678da(0x197)][_0x2678da(0xf0)]);}const _0x2b2373=_0x98065a[_0x2678da(0x1dd)][_0x2678da(0x114)]||new Map(),_0x4f020d=_0x98065a[_0x2678da(0x1dd)][_0x2678da(0x1d3)]||new Map(),_0x472050=_0x98065a['nameToId']['ExperimentalKnowledgeBase']||new Map(),_0x286ec4=new Map(),_0xe46ad2={'resolveToolTargetName':buildNameResolver({..._0x98065a[_0x2678da(0x1a3)],'Agent':_0x39c5a2}),'resolvePromptName':async _0x3aea55=>_0x1f92eb[_0x2678da(0x100)](_0x3aea55),'onWarning':_0x116204=>this[_0x2678da(0x1be)]['warn'](_0x116204)};let _0x2d9576=[];const _0x51321d={'projectId':_0x37bec5,'resolveToolTargetId':buildIdResolver({..._0x98065a[_0x2678da(0x1dd)],'Agent':_0x1aa0c1}),'resolvePromptId':async _0x4f1bdd=>_0x31276d[_0x2678da(0x100)](_0x4f1bdd),'onWarning':_0x4a572d=>{const _0x316191=_0x2678da;this['logger']['warn'](_0x4a572d),_0x2d9576[_0x316191(0x137)](_0x4a572d);}},{resolved:_0x36d11d,unresolved:_0x336fd9}=resolveAgentDependencies(_0x320cbc,new Set(_0x53426e['keys']()));for(const {agent:_0x39413c,missingDeps:_0x3a4f7c}of _0x336fd9){_0x4d6ec2[_0x2678da(0x183)][_0x2678da(0x137)]({'agentName':_0x39413c[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x1ba),'error':_0x2678da(0x1de)+_0x3a4f7c[_0x2678da(0x16c)](',\x20')+'.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.'}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x183)]['errors']++;}for(const _0x5870b5 of _0x1b3c73){const _0x3b5d9b=_0x21801c[_0x2678da(0x100)](_0x5870b5[_0x2678da(0xeb)][_0x2678da(0xf0)]),_0x427d5d=a148_0x1a108a['readFileSync'](_0x5870b5[_0x2678da(0x11f)],_0x2678da(0xfd));if(_0x3b5d9b){const _0x42ab86=apiKnowledgeBaseToYaml(_0x3b5d9b),_0x4bebdf=toKnowledgeBaseYamlString(_0x42ab86),_0x4ee93b=generateDiff(_0x4bebdf,_0x427d5d),_0x3e05d7=hasChanges(_0x4ee93b);_0x3e05d7?(_0x4d6ec2['knowledgeBases']['push']({'name':_0x5870b5[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':'updated','id':_0x3b5d9b['id'],'diff':formatDiffWithColors(_0x4ee93b)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x179)][_0x2678da(0x10a)]++):(_0x4d6ec2[_0x2678da(0x179)][_0x2678da(0x137)]({'name':_0x5870b5[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':'unchanged','id':_0x3b5d9b['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x179)]['unchanged']++);}else _0x4d6ec2['knowledgeBases'][_0x2678da(0x137)]({'name':_0x5870b5[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x1a6)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x179)]['created']++;}for(const _0x62849d of _0x1a350e){const _0x490be0=_0x5f2e3c['get'](_0x62849d[_0x2678da(0xf0)]),_0x465afe=a148_0x1a108a[_0x2678da(0xdc)](_0x62849d[_0x2678da(0x11f)],_0x2678da(0xfd));if(_0x490be0){const _0x55e852=toTextKnowledgeBaseMd(_0x490be0['attributes'][_0x2678da(0xf0)],_0x490be0[_0x2678da(0x197)][_0x2678da(0x11c)]),_0x3858bf=generateDiff(_0x55e852,_0x465afe),_0xe868c0=hasChanges(_0x3858bf);_0xe868c0?(_0x4d6ec2[_0x2678da(0x170)][_0x2678da(0x137)]({'name':_0x62849d[_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x490be0['id'],'diff':formatDiffWithColors(_0x3858bf)}),_0x4d6ec2[_0x2678da(0x1c8)]['textKnowledgeBases'][_0x2678da(0x10a)]++):(_0x4d6ec2[_0x2678da(0x170)]['push']({'name':_0x62849d[_0x2678da(0xf0)],'action':'unchanged','id':_0x490be0['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x170)][_0x2678da(0x1cb)]++);}else _0x4d6ec2[_0x2678da(0x170)][_0x2678da(0x137)]({'name':_0x62849d[_0x2678da(0xf0)],'action':_0x2678da(0x1a6)}),_0x4d6ec2['counts'][_0x2678da(0x170)][_0x2678da(0x1a6)]++;}for(const _0x5f526b of _0x36d11d){const _0x243da8=_0x53426e[_0x2678da(0x100)](_0x5f526b[_0x2678da(0xeb)][_0x2678da(0xf0)]),_0x43f8d1=a148_0x55bc74[_0x2678da(0x16c)](_0x5f526b[_0x2678da(0x158)],'agent.yml'),_0x49bbc3=a148_0x1a108a[_0x2678da(0xdc)](_0x43f8d1,'utf-8'),_0x1f77ae=_0x5f526b[_0x2678da(0x177)],_0x3da6e9=_0x2678da(0x175)+_0x1f77ae+_0x2678da(0x15b)+_0x49bbc3;if(_0x243da8){const {yaml:_0x5bab3b,systemPrompt:_0x5c1faf}=await agentResponseToDef(_0x243da8,_0xe46ad2),_0x309911=toAgentYamlString(_0x5bab3b),_0x5df3d3=_0x2678da(0x175)+_0x5c1faf+'\x0a\x0a#\x20agent.yml\x0a'+_0x309911,_0x195400=generateDiff(_0x5df3d3,_0x3da6e9),_0x42f54b=hasChanges(_0x195400);_0x42f54b?(_0x4d6ec2[_0x2678da(0x183)]['push']({'agentName':_0x5f526b[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'agentId':_0x243da8['id'],'diff':formatDiffWithColors(_0x195400)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x183)][_0x2678da(0x10a)]++):(_0x4d6ec2[_0x2678da(0x183)][_0x2678da(0x137)]({'agentName':_0x5f526b[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':'unchanged','agentId':_0x243da8['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x183)][_0x2678da(0x1cb)]++);}else _0x4d6ec2['agents'][_0x2678da(0x137)]({'agentName':_0x5f526b['yaml'][_0x2678da(0xf0)],'action':'created'}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x183)][_0x2678da(0x1a6)]++;}for(const _0x4e09a9 of _0x388191){const _0x31e5ba=_0x275a2a[_0x2678da(0x100)](_0x4e09a9[_0x2678da(0xeb)][_0x2678da(0xf0)]),_0x20e664=a148_0x1a108a[_0x2678da(0xdc)](_0x4e09a9[_0x2678da(0x11f)],_0x2678da(0xfd));if(_0x31e5ba){const _0x3b0396=await apiPromptToYaml(_0x31e5ba,_0xe46ad2);if(!_0x3b0396){_0x4d6ec2[_0x2678da(0x1e2)][_0x2678da(0x137)]({'name':_0x4e09a9['yaml'][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x31e5ba['id']}),_0x4d6ec2['counts'][_0x2678da(0x1e2)]['updated']++;continue;}const _0x41ca08=toPromptYamlString(_0x3b0396),_0x18a82e=generateDiff(_0x41ca08,_0x20e664),_0xf20134=hasChanges(_0x18a82e);_0xf20134?(_0x4d6ec2[_0x2678da(0x1e2)][_0x2678da(0x137)]({'name':_0x4e09a9[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x31e5ba['id'],'diff':formatDiffWithColors(_0x18a82e)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x1e2)][_0x2678da(0x10a)]++):(_0x4d6ec2['prompts']['push']({'name':_0x4e09a9[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':'unchanged','id':_0x31e5ba['id']}),_0x4d6ec2['counts'][_0x2678da(0x1e2)][_0x2678da(0x1cb)]++);}else _0x4d6ec2['prompts']['push']({'name':_0x4e09a9[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':'created'}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x1e2)][_0x2678da(0x1a6)]++;}for(const _0x1bea74 of _0x1f7746){const _0x3f6859=_0x3273bc[_0x2678da(0x100)](_0x1bea74[_0x2678da(0xeb)][_0x2678da(0x113)]),_0x579990=a148_0x1a108a[_0x2678da(0xdc)](_0x1bea74['path'],_0x2678da(0xfd));if(_0x3f6859){const _0x56ec39=await apiIntegrationToYaml(_0x3f6859,_0xe46ad2),_0x3da480=toIntegrationYamlString(_0x56ec39),_0x5ad309=generateDiff(_0x3da480,_0x579990),_0x151186=hasChanges(_0x5ad309);_0x151186?(_0x4d6ec2['integrations']['push']({'name':_0x1bea74[_0x2678da(0xeb)][_0x2678da(0x113)],'action':'updated','id':_0x3f6859['id'],'diff':formatDiffWithColors(_0x5ad309)}),_0x4d6ec2[_0x2678da(0x1c8)]['integrations'][_0x2678da(0x10a)]++):(_0x4d6ec2[_0x2678da(0x195)]['push']({'name':_0x1bea74[_0x2678da(0xeb)][_0x2678da(0x113)],'action':_0x2678da(0x1cb),'id':_0x3f6859['id']}),_0x4d6ec2[_0x2678da(0x1c8)]['integrations'][_0x2678da(0x1cb)]++);}else _0x4d6ec2[_0x2678da(0x195)][_0x2678da(0x137)]({'name':_0x1bea74[_0x2678da(0xeb)][_0x2678da(0x113)],'action':_0x2678da(0x1a6)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x195)][_0x2678da(0x1a6)]++;}for(const _0x5546c3 of _0x36d6e0){const _0x47411c=_0x274f1f[_0x2678da(0x100)](_0x5546c3[_0x2678da(0x18b)]['name']),_0x3eeb2b=toExperimentalKnowledgeBaseYamlString(_0x5546c3[_0x2678da(0x18b)]);let _0x36ef04=_0x3eeb2b;for(const _0x1ca1c8 of _0x5546c3[_0x2678da(0x18b)]['functions']){_0x36ef04+=_0x2678da(0xd7)+_0x1ca1c8[_0x2678da(0xf0)]+_0x2678da(0x13f)+_0x1ca1c8[_0x2678da(0x1b1)]+'\x0a---\x20schema:\x20'+_0x1ca1c8[_0x2678da(0xf0)]+_0x2678da(0x13f)+_0x1ca1c8[_0x2678da(0x109)]+'\x0a';}if(_0x47411c){const _0x1eda51=apiExperimentalKnowledgeBaseToYaml(_0x47411c),_0x5e9558=toExperimentalKnowledgeBaseYamlString(_0x1eda51);let _0x51787b=_0x5e9558;for(const _0x10c552 of _0x1eda51[_0x2678da(0xcc)]){_0x51787b+=_0x2678da(0xd7)+_0x10c552[_0x2678da(0xf0)]+'\x20---\x0a'+_0x10c552[_0x2678da(0x1b1)]+_0x2678da(0x1da)+_0x10c552['name']+'\x20---\x0a'+_0x10c552[_0x2678da(0x109)]+'\x0a';}const _0xab5145=generateDiff(_0x51787b,_0x36ef04),_0x1b289a=hasChanges(_0xab5145);_0x1b289a?(_0x4d6ec2[_0x2678da(0x1b7)][_0x2678da(0x137)]({'name':_0x5546c3[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x47411c['id'],'diff':formatDiffWithColors(_0xab5145)}),_0x4d6ec2[_0x2678da(0x1c8)]['experimentalKnowledgeBases'][_0x2678da(0x10a)]++):(_0x4d6ec2[_0x2678da(0x1b7)][_0x2678da(0x137)]({'name':_0x5546c3[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':_0x2678da(0x1cb),'id':_0x47411c['id']}),_0x4d6ec2[_0x2678da(0x1c8)]['experimentalKnowledgeBases'][_0x2678da(0x1cb)]++);}else _0x4d6ec2[_0x2678da(0x1b7)][_0x2678da(0x137)]({'name':_0x5546c3[_0x2678da(0x18b)]['name'],'action':_0x2678da(0x1a6)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x1b7)][_0x2678da(0x1a6)]++;}for(const _0x24a282 of _0x335b74){const _0x2b0b04=_0x49b4b2['get'](_0x24a282['def'][_0x2678da(0xf0)]),_0x4beef2=toExperimentalArtifactYamlString(_0x24a282[_0x2678da(0x18b)]);let _0x4a5234=_0x4beef2+(_0x2678da(0x147)+_0x24a282['def']['code']+'\x0a');for(const _0x5d7a7d of _0x24a282[_0x2678da(0x18b)][_0x2678da(0x128)]){_0x4a5234+=_0x2678da(0x15e)+_0x5d7a7d[_0x2678da(0x1ca)]+_0x2678da(0x13f)+_0x5d7a7d[_0x2678da(0x15a)]+'\x0a';}if(_0x2b0b04){const _0x4b80d9=apiExperimentalArtifactToYaml(_0x2b0b04),_0x1b2506=toExperimentalArtifactYamlString(_0x4b80d9);let _0x98969f=_0x1b2506+('\x0a---\x20code\x20---\x0a'+_0x4b80d9['code']+'\x0a');for(const _0x9dc45d of _0x4b80d9['files']){_0x98969f+=_0x2678da(0x15e)+_0x9dc45d['file_name']+_0x2678da(0x13f)+_0x9dc45d[_0x2678da(0x15a)]+'\x0a';}const _0x645f48=generateDiff(_0x98969f,_0x4a5234),_0x251397=hasChanges(_0x645f48);_0x251397?(_0x4d6ec2[_0x2678da(0x10f)][_0x2678da(0x137)]({'name':_0x24a282[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x2b0b04['id'],'diff':formatDiffWithColors(_0x645f48)}),_0x4d6ec2['counts'][_0x2678da(0x10f)][_0x2678da(0x10a)]++):(_0x4d6ec2[_0x2678da(0x10f)][_0x2678da(0x137)]({'name':_0x24a282[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':_0x2678da(0x1cb),'id':_0x2b0b04['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x10f)][_0x2678da(0x1cb)]++);}else _0x4d6ec2['experimentalArtifacts']['push']({'name':_0x24a282[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':_0x2678da(0x1a6)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x10f)][_0x2678da(0x1a6)]++;}for(const _0x37fb60 of _0x559758){const _0x1337c2=_0xa2aae5[_0x2678da(0x100)](_0x37fb60[_0x2678da(0xeb)][_0x2678da(0xf0)]),_0xc4ad4a=a148_0x1a108a[_0x2678da(0xdc)](_0x37fb60['path'],_0x2678da(0xfd));if(_0x1337c2){const _0x4505b6=await apiFormInterfaceToYaml(_0x1337c2,_0xe46ad2),_0x3c5070=toFormInterfaceYamlString(_0x4505b6),_0x3080a5=generateDiff(_0x3c5070,_0xc4ad4a),_0x4d5c41=hasChanges(_0x3080a5);_0x4d5c41?(_0x4d6ec2[_0x2678da(0x18a)]['push']({'name':_0x37fb60[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x1337c2['id'],'diff':formatDiffWithColors(_0x3080a5)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x18a)][_0x2678da(0x10a)]++):(_0x4d6ec2[_0x2678da(0x18a)][_0x2678da(0x137)]({'name':_0x37fb60[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x1cb),'id':_0x1337c2['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x18a)]['unchanged']++);}else _0x4d6ec2['formInterfaces'][_0x2678da(0x137)]({'name':_0x37fb60[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x1a6)}),_0x4d6ec2[_0x2678da(0x1c8)]['formInterfaces'][_0x2678da(0x1a6)]++;}for(const _0x527dc5 of _0x31c15f){const _0x2bba4f=_0x11ba7e[_0x2678da(0x100)](_0x527dc5[_0x2678da(0xeb)][_0x2678da(0xf0)]),_0x585a78=a148_0x1a108a[_0x2678da(0xdc)](_0x527dc5[_0x2678da(0x11f)],_0x2678da(0xfd));if(_0x2bba4f){const _0x5c0bc0=await apiChatInterfaceToYaml(_0x2bba4f,_0xe46ad2),_0x3e4e6f=toChatInterfaceYamlString(_0x5c0bc0),_0x1cfa13=generateDiff(_0x3e4e6f,_0x585a78),_0xf118ff=hasChanges(_0x1cfa13);_0xf118ff?(_0x4d6ec2[_0x2678da(0x19c)][_0x2678da(0x137)]({'name':_0x527dc5[_0x2678da(0xeb)]['name'],'action':_0x2678da(0x10a),'id':_0x2bba4f['id'],'diff':formatDiffWithColors(_0x1cfa13)}),_0x4d6ec2['counts']['chatInterfaces'][_0x2678da(0x10a)]++):(_0x4d6ec2[_0x2678da(0x19c)]['push']({'name':_0x527dc5[_0x2678da(0xeb)]['name'],'action':_0x2678da(0x1cb),'id':_0x2bba4f['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x19c)][_0x2678da(0x1cb)]++);}else _0x4d6ec2[_0x2678da(0x19c)][_0x2678da(0x137)]({'name':_0x527dc5['yaml'][_0x2678da(0xf0)],'action':_0x2678da(0x1a6)}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x19c)][_0x2678da(0x1a6)]++;}if(_0x1d91fe?.['dryRun'])return _0x4d6ec2;_0x4d6ec2['knowledgeBases']=[],_0x4d6ec2[_0x2678da(0x170)]=[],_0x4d6ec2[_0x2678da(0x1e2)]=[],_0x4d6ec2['integrations']=[],_0x4d6ec2[_0x2678da(0x1b7)]=[],_0x4d6ec2['experimentalArtifacts']=[],_0x4d6ec2[_0x2678da(0x18a)]=[],_0x4d6ec2[_0x2678da(0x19c)]=[];const _0x14dde5=_0x4d6ec2[_0x2678da(0x183)][_0x2678da(0x182)](_0x453336=>_0x453336[_0x2678da(0x1a1)]===_0x2678da(0x1ba));_0x4d6ec2['agents']=_0x14dde5,_0x4d6ec2['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x14dde5[_0x2678da(0xee)]},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x32ed22 of _0x1b3c73){try{const _0x39f243=_0x21801c['get'](_0x32ed22[_0x2678da(0xeb)][_0x2678da(0xf0)]),_0x412ca0=yamlKnowledgeBaseToApi(_0x32ed22['yaml'],_0x37bec5);if(_0x39f243)await this[_0x2678da(0x118)]['updateKnowledgeBase'](_0x39f243['id'],_0x412ca0),_0x2b2373[_0x2678da(0x157)](_0x32ed22['yaml'][_0x2678da(0xf0)],_0x39f243['id']),_0x4d6ec2[_0x2678da(0x179)][_0x2678da(0x137)]({'name':_0x32ed22['yaml'][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x39f243['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x179)][_0x2678da(0x10a)]++;else{const _0x3e79c4=await this[_0x2678da(0x118)]['createKnowledgeBase'](_0x412ca0);_0x2b2373[_0x2678da(0x157)](_0x32ed22[_0x2678da(0xeb)][_0x2678da(0xf0)],_0x3e79c4['id']),_0x4d6ec2[_0x2678da(0x179)][_0x2678da(0x137)]({'name':_0x32ed22[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x1a6),'id':_0x3e79c4['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x179)]['created']++;}}catch(_0x238790){_0x4d6ec2[_0x2678da(0x179)][_0x2678da(0x137)]({'name':_0x32ed22['yaml'][_0x2678da(0xf0)],'action':'error','error':_0x238790[_0x2678da(0x129)]}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x179)]['errors']++;}}for(const _0x19a057 of _0x1a350e){try{const _0x446729=_0x5f2e3c[_0x2678da(0x100)](_0x19a057[_0x2678da(0xf0)]),_0x168310=yamlTextKnowledgeBaseToApi({'name':_0x19a057[_0x2678da(0xf0)],'text':_0x19a057[_0x2678da(0x11c)]},_0x37bec5);if(_0x446729)await this[_0x2678da(0x118)][_0x2678da(0x139)](_0x446729['id'],_0x168310),_0x4f020d['set'](_0x19a057[_0x2678da(0xf0)],_0x446729['id']),_0x4d6ec2[_0x2678da(0x170)][_0x2678da(0x137)]({'name':_0x19a057['name'],'action':_0x2678da(0x10a),'id':_0x446729['id']}),_0x4d6ec2['counts'][_0x2678da(0x170)][_0x2678da(0x10a)]++;else{const _0x325786=await this[_0x2678da(0x118)][_0x2678da(0x16f)](_0x168310);_0x4f020d['set'](_0x19a057['name'],_0x325786['id']),_0x4d6ec2[_0x2678da(0x170)]['push']({'name':_0x19a057[_0x2678da(0xf0)],'action':_0x2678da(0x1a6),'id':_0x325786['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x170)][_0x2678da(0x1a6)]++;}}catch(_0x158a14){_0x4d6ec2[_0x2678da(0x170)][_0x2678da(0x137)]({'name':_0x19a057[_0x2678da(0xf0)],'action':_0x2678da(0x1ba),'error':_0x158a14['message']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x170)][_0x2678da(0x19a)]++;}}for(const _0x1b9751 of _0x36d6e0){try{const _0x422142=_0x274f1f['get'](_0x1b9751[_0x2678da(0x18b)][_0x2678da(0xf0)]),_0x37b4f5=yamlExperimentalKnowledgeBaseToApi(_0x1b9751[_0x2678da(0x18b)],_0x37bec5);if(_0x422142)await this[_0x2678da(0x118)]['updateExperimentalKnowledgeBase'](_0x422142['id'],_0x37b4f5),_0x472050[_0x2678da(0x157)](_0x1b9751[_0x2678da(0x18b)]['name'],_0x422142['id']),_0x4d6ec2[_0x2678da(0x1b7)][_0x2678da(0x137)]({'name':_0x1b9751[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':'updated','id':_0x422142['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x1b7)][_0x2678da(0x10a)]++;else{const _0x3fb47a=await this[_0x2678da(0x118)][_0x2678da(0x1ac)](_0x37b4f5);_0x472050[_0x2678da(0x157)](_0x1b9751[_0x2678da(0x18b)]['name'],_0x3fb47a['id']),_0x4d6ec2[_0x2678da(0x1b7)]['push']({'name':_0x1b9751[_0x2678da(0x18b)]['name'],'action':'created','id':_0x3fb47a['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x1b7)]['created']++;}}catch(_0x21756a){_0x4d6ec2[_0x2678da(0x1b7)][_0x2678da(0x137)]({'name':_0x1b9751[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':_0x2678da(0x1ba),'error':_0x21756a[_0x2678da(0x129)]}),_0x4d6ec2['counts'][_0x2678da(0x1b7)][_0x2678da(0x19a)]++;}}for(const _0x27163c of _0x335b74){try{const _0x26eb7e=_0x49b4b2['get'](_0x27163c[_0x2678da(0x18b)][_0x2678da(0xf0)]),_0x467490=yamlExperimentalArtifactToApi(_0x27163c[_0x2678da(0x18b)],_0x37bec5);if(_0x26eb7e)await this[_0x2678da(0x118)]['updateExperimentalArtifact'](_0x26eb7e['id'],_0x467490),_0x286ec4['set'](_0x27163c[_0x2678da(0x18b)][_0x2678da(0xf0)],_0x26eb7e['id']),_0x4d6ec2[_0x2678da(0x10f)]['push']({'name':_0x27163c[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x26eb7e['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x10f)][_0x2678da(0x10a)]++;else{const _0x141d8c=await this['client'][_0x2678da(0x192)](_0x467490);_0x286ec4[_0x2678da(0x157)](_0x27163c[_0x2678da(0x18b)][_0x2678da(0xf0)],_0x141d8c['id']),_0x4d6ec2[_0x2678da(0x10f)][_0x2678da(0x137)]({'name':_0x27163c[_0x2678da(0x18b)][_0x2678da(0xf0)],'action':_0x2678da(0x1a6),'id':_0x141d8c['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x10f)][_0x2678da(0x1a6)]++;}}catch(_0x1585e7){_0x4d6ec2[_0x2678da(0x10f)]['push']({'name':_0x27163c['def'][_0x2678da(0xf0)],'action':_0x2678da(0x1ba),'error':_0x1585e7[_0x2678da(0x129)]}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x10f)]['errors']++;}}for(const _0x569c30 of _0x36d11d){_0x2d9576=[];try{const _0x13c9d8=_0x53426e[_0x2678da(0x100)](_0x569c30['yaml']['name']),_0x34cec8=await agentDefToRequest(_0x569c30[_0x2678da(0xeb)],_0x569c30[_0x2678da(0x177)],_0x569c30[_0x2678da(0x19d)],_0x51321d);if(_0x13c9d8)await this[_0x2678da(0x118)][_0x2678da(0x116)](_0x13c9d8['id'],_0x34cec8),_0x1aa0c1[_0x2678da(0x157)](_0x569c30[_0x2678da(0xeb)]['name'],_0x13c9d8['id']),_0x4d6ec2[_0x2678da(0x183)][_0x2678da(0x137)]({'agentName':_0x569c30['yaml'][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'agentId':_0x13c9d8['id'],'warnings':_0x2d9576[_0x2678da(0xee)]>0x0?_0x2d9576:undefined}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x183)][_0x2678da(0x10a)]++;else{const _0x55d945=await this[_0x2678da(0x118)]['createAgentResponse'](_0x34cec8);_0x1aa0c1[_0x2678da(0x157)](_0x569c30[_0x2678da(0xeb)]['name'],_0x55d945['id']),_0x4d6ec2[_0x2678da(0x183)][_0x2678da(0x137)]({'agentName':_0x569c30[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x1a6),'agentId':_0x55d945['id'],'warnings':_0x2d9576[_0x2678da(0xee)]>0x0?_0x2d9576:undefined}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x183)][_0x2678da(0x1a6)]++;}}catch(_0x3eced9){_0x4d6ec2[_0x2678da(0x183)]['push']({'agentName':_0x569c30[_0x2678da(0xeb)]['name'],'action':_0x2678da(0x1ba),'error':_0x3eced9['message'],'warnings':_0x2d9576['length']>0x0?_0x2d9576:undefined}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x183)][_0x2678da(0x19a)]++;}}for(const _0x33cc30 of _0x388191){try{const _0x46d637=_0x275a2a['get'](_0x33cc30[_0x2678da(0xeb)][_0x2678da(0xf0)]),_0x3dc3a4=await yamlPromptToApi(_0x33cc30[_0x2678da(0xeb)],_0x37bec5,_0x51321d);if(!_0x3dc3a4){_0x4d6ec2['prompts'][_0x2678da(0x137)]({'name':_0x33cc30[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x1ba),'error':'Agent\x20reference\x20not\x20found'}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x1e2)][_0x2678da(0x19a)]++;continue;}if(_0x46d637)await this['client'][_0x2678da(0x103)](_0x46d637['id'],_0x3dc3a4),_0x31276d[_0x2678da(0x157)](_0x33cc30[_0x2678da(0xeb)]['name'],_0x46d637['id']),_0x4d6ec2[_0x2678da(0x1e2)][_0x2678da(0x137)]({'name':_0x33cc30['yaml'][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x46d637['id']}),_0x4d6ec2[_0x2678da(0x1c8)]['prompts']['updated']++;else{const _0xe85f98=await this[_0x2678da(0x118)][_0x2678da(0x1ce)](_0x3dc3a4);_0x31276d['set'](_0x33cc30[_0x2678da(0xeb)]['name'],_0xe85f98['id']),_0x4d6ec2[_0x2678da(0x1e2)][_0x2678da(0x137)]({'name':_0x33cc30[_0x2678da(0xeb)]['name'],'action':_0x2678da(0x1a6),'id':_0xe85f98['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x1e2)][_0x2678da(0x1a6)]++;}}catch(_0x357b2b){_0x4d6ec2[_0x2678da(0x1e2)][_0x2678da(0x137)]({'name':_0x33cc30['yaml']['name'],'action':'error','error':_0x357b2b[_0x2678da(0x129)]}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x1e2)][_0x2678da(0x19a)]++;}}for(const _0x55d665 of _0x1f7746){try{const _0x3427b1=_0x3273bc[_0x2678da(0x100)](_0x55d665['yaml'][_0x2678da(0x113)]),_0x21cbc1=await yamlIntegrationToApi(_0x55d665[_0x2678da(0xeb)],_0x37bec5,_0x51321d);if(_0x3427b1){await this['client']['deleteIntegration'](_0x3427b1['id']);const _0x8bb047=await this[_0x2678da(0x118)]['createIntegration'](_0x21cbc1);_0x4d6ec2[_0x2678da(0x195)][_0x2678da(0x137)]({'name':_0x55d665['yaml'][_0x2678da(0x113)],'action':_0x2678da(0x10a),'id':_0x8bb047['id']}),_0x4d6ec2['counts'][_0x2678da(0x195)]['updated']++;}else{const _0x244899=await this[_0x2678da(0x118)]['createIntegration'](_0x21cbc1);_0x4d6ec2['integrations'][_0x2678da(0x137)]({'name':_0x55d665['yaml'][_0x2678da(0x113)],'action':_0x2678da(0x1a6),'id':_0x244899['id']}),_0x4d6ec2[_0x2678da(0x1c8)]['integrations']['created']++;}}catch(_0x3eb8b4){_0x4d6ec2[_0x2678da(0x195)][_0x2678da(0x137)]({'name':_0x55d665[_0x2678da(0xeb)]['service_type'],'action':_0x2678da(0x1ba),'error':_0x3eb8b4[_0x2678da(0x129)]}),_0x4d6ec2[_0x2678da(0x1c8)]['integrations'][_0x2678da(0x19a)]++;}}for(const _0x50b8cf of _0x559758){try{const _0x378b0a=_0xa2aae5[_0x2678da(0x100)](_0x50b8cf['yaml']['name']),_0x57e31b=await yamlFormInterfaceToApi(_0x50b8cf[_0x2678da(0xeb)],_0x37bec5,_0x51321d);if(!_0x57e31b){_0x4d6ec2[_0x2678da(0x18a)][_0x2678da(0x137)]({'name':_0x50b8cf[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x1ba),'error':_0x2678da(0x162)}),_0x4d6ec2['counts'][_0x2678da(0x18a)]['errors']++;continue;}if(_0x378b0a){const _0x3794fa=await this['client'][_0x2678da(0x12c)](_0x378b0a['id'],_0x57e31b);_0x4d6ec2[_0x2678da(0x18a)]['push']({'name':_0x50b8cf[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x3794fa['id']}),_0x4d6ec2['counts'][_0x2678da(0x18a)][_0x2678da(0x10a)]++;}else{const _0x58f35f=await this[_0x2678da(0x118)]['createFormInterface'](_0x57e31b);_0x4d6ec2[_0x2678da(0x18a)][_0x2678da(0x137)]({'name':_0x50b8cf['yaml']['name'],'action':_0x2678da(0x1a6),'id':_0x58f35f['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x18a)][_0x2678da(0x1a6)]++;}}catch(_0x24e3f6){_0x4d6ec2[_0x2678da(0x18a)][_0x2678da(0x137)]({'name':_0x50b8cf[_0x2678da(0xeb)][_0x2678da(0xf0)],'action':'error','error':_0x24e3f6[_0x2678da(0x129)]}),_0x4d6ec2[_0x2678da(0x1c8)]['formInterfaces'][_0x2678da(0x19a)]++;}}for(const _0x57ddaf of _0x31c15f){try{const _0x161920=_0x11ba7e[_0x2678da(0x100)](_0x57ddaf[_0x2678da(0xeb)]['name']),_0x36acd6=await yamlChatInterfaceToApi(_0x57ddaf[_0x2678da(0xeb)],_0x37bec5,_0x51321d);if(_0x161920){const _0x4de3bf=await this['client'][_0x2678da(0xe4)](_0x161920['id'],_0x36acd6);_0x4d6ec2[_0x2678da(0x19c)][_0x2678da(0x137)]({'name':_0x57ddaf['yaml'][_0x2678da(0xf0)],'action':_0x2678da(0x10a),'id':_0x4de3bf['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x19c)]['updated']++;}else{const _0x53d89c=await this[_0x2678da(0x118)][_0x2678da(0xf7)](_0x36acd6);_0x4d6ec2['chatInterfaces'][_0x2678da(0x137)]({'name':_0x57ddaf['yaml'][_0x2678da(0xf0)],'action':_0x2678da(0x1a6),'id':_0x53d89c['id']}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x19c)][_0x2678da(0x1a6)]++;}}catch(_0x6bc64d){_0x4d6ec2[_0x2678da(0x19c)][_0x2678da(0x137)]({'name':_0x57ddaf['yaml']['name'],'action':'error','error':_0x6bc64d[_0x2678da(0x129)]}),_0x4d6ec2[_0x2678da(0x1c8)][_0x2678da(0x19c)][_0x2678da(0x19a)]++;}}return _0x4d6ec2;}async[a148_0x41755e(0xe9)](_0x414d51,_0x124d21,_0x3efea4,_0x3c1783){const _0x3c1bcc=a148_0x41755e,{projectId:_0x20942d,project:_0x41ac31}=await this[_0x3c1bcc(0x117)](_0x414d51),_0xb5121b=_0x41ac31[_0x3c1bcc(0x197)][_0x3c1bcc(0xf0)],_0x36a9f3=await this[_0x3c1bcc(0x118)][_0x3c1bcc(0x19f)](_0x20942d),_0x16b8fc=_0x36a9f3['find'](_0x33efd8=>_0x33efd8['attributes'][_0x3c1bcc(0xf0)]===_0x124d21);if(!_0x16b8fc)throw new SDKError(ErrorCode[_0x3c1bcc(0x196)],_0x3c1bcc(0x159)+_0x124d21,undefined,{'helpText':_0x3c1bcc(0xdb)+_0x36a9f3[_0x3c1bcc(0x1db)](_0x453f04=>_0x453f04[_0x3c1bcc(0x197)][_0x3c1bcc(0xf0)])['join'](',\x20')});let _0x129435;if(_0x3efea4)_0x129435=_0x3efea4;else{const _0x698642=a148_0x55bc74[_0x3c1bcc(0x16c)](process[_0x3c1bcc(0x185)](),_0x3c1bcc(0x183)),_0x5ac55a=getSanitizedPathWithMigration(_0x698642,_0xb5121b);_0x5ac55a['renamed']&&this[_0x3c1bcc(0x1be)]['info'](_0x3c1bcc(0x189)+a148_0x55bc74['basename'](_0x5ac55a[_0x3c1bcc(0x130)])+_0x3c1bcc(0x151)+a148_0x55bc74[_0x3c1bcc(0x1b2)](_0x5ac55a[_0x3c1bcc(0x11f)])),_0x129435=_0x5ac55a['path'];}const _0x575718=getSanitizedPathWithMigration(_0x129435,_0x124d21);_0x575718[_0x3c1bcc(0x153)]&&this[_0x3c1bcc(0x1be)][_0x3c1bcc(0x171)](_0x3c1bcc(0xfa)+a148_0x55bc74['basename'](_0x575718[_0x3c1bcc(0x130)])+_0x3c1bcc(0x151)+a148_0x55bc74[_0x3c1bcc(0x1b2)](_0x575718[_0x3c1bcc(0x11f)]));const _0x520300=_0x575718[_0x3c1bcc(0x11f)],_0x495cec=new Map(),_0x3f09b4=new Map(),_0x147f8c=await this[_0x3c1bcc(0x118)]['listKnowledgeBases'](_0x20942d),_0x269611=await this[_0x3c1bcc(0x118)][_0x3c1bcc(0xcf)](_0x20942d),_0x50d4ef=await safeListOrEmpty(()=>this['client'][_0x3c1bcc(0x12e)](_0x20942d)),_0x3fda05=new Map(),_0x37a14b=new Map();for(const _0x388adb of _0x147f8c){_0x495cec[_0x3c1bcc(0x157)](_0x388adb['id'],_0x388adb['attributes']['name']);}for(const _0x7b67bf of _0x269611){_0x3fda05['set'](_0x7b67bf['id'],_0x7b67bf['attributes'][_0x3c1bcc(0xf0)]);}for(const _0x2d2a5d of _0x50d4ef){_0x37a14b[_0x3c1bcc(0x157)](_0x2d2a5d['id'],_0x2d2a5d[_0x3c1bcc(0x197)][_0x3c1bcc(0xf0)]);}for(const _0x4c0538 of _0x36a9f3){_0x3f09b4[_0x3c1bcc(0x157)](_0x4c0538['id'],_0x4c0538['attributes']['name']);}const _0x4e07c3={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x495cec,'TextKnowledgeBase':_0x3fda05,'Agent':_0x3f09b4,'ExperimentalKnowledgeBase':_0x37a14b}),'resolvePromptName':async()=>undefined,'onWarning':_0x342a87=>this[_0x3c1bcc(0x1be)][_0x3c1bcc(0xed)](_0x342a87)},_0x10003e=a148_0x55bc74[_0x3c1bcc(0x16c)](_0x520300,_0x3c1bcc(0xf6)),_0x5542e4=a148_0x55bc74[_0x3c1bcc(0x16c)](_0x520300,_0x3c1bcc(0xda)),_0x98adc9=a148_0x55bc74[_0x3c1bcc(0x16c)](_0x520300,_0x3c1bcc(0x115)),_0x44db93=!a148_0x1a108a[_0x3c1bcc(0x16e)](_0x5542e4);if(_0x3c1783?.['dryRun'])return{'agentName':_0x124d21,'outputPath':_0x520300,'isNew':_0x44db93,'hasChanges':!![]};a148_0x1a108a[_0x3c1bcc(0x14e)](_0x129435,{'recursive':!![]}),a148_0x1a108a['mkdirSync'](_0x520300,{'recursive':!![]});const _0x238fbe=a148_0x55bc74[_0x3c1bcc(0x16c)](_0x129435,_0x3c1bcc(0x187));!a148_0x1a108a['existsSync'](_0x238fbe)&&a148_0x1a108a[_0x3c1bcc(0x1c6)](_0x238fbe,createAgentConfigContent(_0x414d51));const {yaml:_0x30c728,systemPrompt:_0xea56a0,starterMessage:_0x38961c}=await agentResponseToDef(_0x16b8fc,_0x4e07c3);let _0x59c3ce=_0x44db93;if(!_0x44db93){const _0x2c676f=a148_0x1a108a[_0x3c1bcc(0x16e)](_0x10003e)?a148_0x1a108a['readFileSync'](_0x10003e,_0x3c1bcc(0xfd)):'',_0x35e473=a148_0x1a108a['readFileSync'](_0x5542e4,_0x3c1bcc(0xfd));_0x59c3ce=_0x2c676f!==_0xea56a0||_0x35e473!==toAgentYamlString(_0x30c728);}a148_0x1a108a[_0x3c1bcc(0x1c6)](_0x10003e,_0xea56a0),a148_0x1a108a['writeFileSync'](_0x5542e4,toAgentYamlString(_0x30c728));if(_0x38961c&&_0x38961c[_0x3c1bcc(0x1c3)]('\x0a'))a148_0x1a108a['writeFileSync'](_0x98adc9,_0x38961c);else a148_0x1a108a['existsSync'](_0x98adc9)&&a148_0x1a108a[_0x3c1bcc(0xec)](_0x98adc9);return{'agentName':_0x124d21,'outputPath':_0x520300,'isNew':_0x44db93,'hasChanges':_0x59c3ce};}async['pushAgent'](_0x33d4d7,_0x563aaa){const _0x6fd260=a148_0x41755e;let _0x1b0f41;isAgentYamlPath(_0x33d4d7)?_0x1b0f41=getAgentDirFromYamlPath(_0x33d4d7):_0x1b0f41=_0x33d4d7;const {config:_0x4d5063}=findAgentConfig(_0x1b0f41),_0x24b66d=await this[_0x6fd260(0xff)](_0x4d5063[_0x6fd260(0xd8)]),_0x52bcfd=a148_0x55bc74[_0x6fd260(0x16c)](_0x1b0f41,_0x6fd260(0xda)),_0x50d580=a148_0x55bc74['join'](_0x1b0f41,_0x6fd260(0xf6)),_0x3c3cba=a148_0x55bc74[_0x6fd260(0x16c)](_0x1b0f41,_0x6fd260(0x115));if(!a148_0x1a108a['existsSync'](_0x52bcfd))throw new SDKError(ErrorCode[_0x6fd260(0x11a)],_0x6fd260(0x174)+_0x1b0f41,undefined,{'helpText':_0x6fd260(0xcd)});const _0x3682cd=parseAgentYaml(a148_0x1a108a['readFileSync'](_0x52bcfd,_0x6fd260(0xfd)),_0x52bcfd),_0x2c1a04=a148_0x1a108a['existsSync'](_0x50d580)?a148_0x1a108a[_0x6fd260(0xdc)](_0x50d580,_0x6fd260(0xfd)):'',_0x4cd881=a148_0x1a108a[_0x6fd260(0x16e)](_0x3c3cba)?a148_0x1a108a[_0x6fd260(0xdc)](_0x3c3cba,_0x6fd260(0xfd)):_0x3682cd[_0x6fd260(0x150)];if(_0x563aaa?.[_0x6fd260(0xe0)])return{'agentName':_0x3682cd['name'],'action':_0x6fd260(0x1a6),'projectId':_0x24b66d};const _0x140f01=await this[_0x6fd260(0x118)]['listAgentsFull'](_0x24b66d),_0x1fada5=await fetchAllToolTargetMaps((_0x164289,_0x53dd86)=>this[_0x6fd260(0x118)][_0x6fd260(0x131)](_0x164289,_0x53dd86),_0x24b66d),_0x224ff1=new Map();for(const _0x186791 of _0x140f01){_0x224ff1['set'](_0x186791[_0x6fd260(0x197)][_0x6fd260(0xf0)],_0x186791['id']);}const _0x57e35=[],_0x18ae46={'projectId':_0x24b66d,'resolveToolTargetId':buildIdResolver({..._0x1fada5[_0x6fd260(0x1dd)],'Agent':_0x224ff1}),'resolvePromptId':async()=>undefined,'onWarning':_0x73db8a=>{const _0xabe213=_0x6fd260;this[_0xabe213(0x1be)][_0xabe213(0xed)](_0x73db8a),_0x57e35[_0xabe213(0x137)](_0x73db8a);}};try{const _0x3ad680=_0x140f01[_0x6fd260(0x1e4)](_0x2ecc2d=>_0x2ecc2d[_0x6fd260(0x197)][_0x6fd260(0xf0)]===_0x3682cd['name']),_0x50ae14=await agentDefToRequest(_0x3682cd,_0x2c1a04,_0x4cd881,_0x18ae46);if(_0x3ad680)return await this[_0x6fd260(0x118)][_0x6fd260(0x116)](_0x3ad680['id'],_0x50ae14),{'agentName':_0x3682cd[_0x6fd260(0xf0)],'action':'updated','projectId':_0x24b66d,'agentId':_0x3ad680['id'],'warnings':_0x57e35[_0x6fd260(0xee)]>0x0?_0x57e35:undefined};else{const _0xffc313=await this[_0x6fd260(0x118)][_0x6fd260(0x193)](_0x50ae14);return{'agentName':_0x3682cd[_0x6fd260(0xf0)],'action':_0x6fd260(0x1a6),'projectId':_0x24b66d,'agentId':_0xffc313['id'],'warnings':_0x57e35['length']>0x0?_0x57e35:undefined};}}catch(_0x4a4bd9){return{'agentName':_0x3682cd[_0x6fd260(0xf0)],'action':_0x6fd260(0x1ba),'projectId':_0x24b66d,'error':_0x4a4bd9[_0x6fd260(0x129)],'warnings':_0x57e35[_0x6fd260(0xee)]>0x0?_0x57e35:undefined};}}async['cloneProject'](_0x3a5196,_0x542496,_0x2fd18a){const _0x8df602=a148_0x41755e,_0x429ac0=a148_0x1a108a[_0x8df602(0x16e)](_0x3a5196)&&a148_0x1a108a['existsSync'](a148_0x55bc74[_0x8df602(0x16c)](_0x3a5196,_0x8df602(0x187)));let _0xd28ff0;const _0x8809ee=[],_0x5627ec=[],_0x5de052=[],_0x5d598e=[],_0x7f94ce=[],_0x185b68=[],_0x2f9ce6=[],_0x106f5a=[],_0x2f2c13=[];if(_0x429ac0){const _0x35531b=loadAgentConfig(a148_0x55bc74[_0x8df602(0x16c)](_0x3a5196,_0x8df602(0x187)));_0xd28ff0=_0x35531b['llm_project'];const _0x5841ee=a148_0x1a108a[_0x8df602(0x1c7)](_0x3a5196,{'withFileTypes':!![]});for(const _0x3bb5d6 of _0x5841ee){if(!_0x3bb5d6[_0x8df602(0xdf)]())continue;if([_0x8df602(0x136),_0x8df602(0x102),_0x8df602(0x1a5),_0x8df602(0x1e2),_0x8df602(0x195),'form_interfaces',_0x8df602(0xf8)][_0x8df602(0x1c3)](_0x3bb5d6[_0x8df602(0xf0)]))continue;const _0x187868=a148_0x55bc74['join'](_0x3a5196,_0x3bb5d6[_0x8df602(0xf0)]);if(isAgentDir(_0x187868)){const _0x2cf959=a148_0x55bc74[_0x8df602(0x16c)](_0x187868,_0x8df602(0xda)),_0x9eb392=a148_0x55bc74['join'](_0x187868,_0x8df602(0xf6)),_0x3aeebe=a148_0x55bc74['join'](_0x187868,'starter_message.md'),_0x3afb3d=parseAgentYaml(a148_0x1a108a[_0x8df602(0xdc)](_0x2cf959,'utf-8'),_0x2cf959),_0x407add=a148_0x1a108a['existsSync'](_0x9eb392)?a148_0x1a108a[_0x8df602(0xdc)](_0x9eb392,_0x8df602(0xfd)):'',_0x1c2b5d=a148_0x1a108a['existsSync'](_0x3aeebe)?a148_0x1a108a[_0x8df602(0xdc)](_0x3aeebe,_0x8df602(0xfd)):_0x3afb3d['starter_message'];_0x8809ee['push']({'name':_0x3afb3d[_0x8df602(0xf0)],'dir':_0x187868,'yaml':_0x3afb3d,'systemPrompt':_0x407add,'starterMessage':_0x1c2b5d});}}const _0x20dd5f=getKnowledgeBasesDir(_0x3a5196);if(a148_0x1a108a['existsSync'](_0x20dd5f)){const _0x2249b7=a148_0x1a108a['readdirSync'](_0x20dd5f);for(const _0x56f621 of _0x2249b7){const _0x4739a3=a148_0x55bc74[_0x8df602(0x16c)](_0x20dd5f,_0x56f621);if(_0x56f621['endsWith'](_0x8df602(0x15c))){const _0x29bcc4=parseKnowledgeBaseYaml(a148_0x1a108a[_0x8df602(0xdc)](_0x4739a3,_0x8df602(0xfd)),_0x4739a3);_0x5627ec['push']({'name':_0x29bcc4[_0x8df602(0xf0)],'path':_0x4739a3,'yaml':_0x29bcc4});}else{if(_0x56f621['endsWith'](_0x8df602(0x1dc))){const _0x5d73c8=a148_0x1a108a['readFileSync'](_0x4739a3,'utf-8'),{name:_0x1efa8f,text:_0x23454b}=parseTextKnowledgeBaseMd(_0x5d73c8,_0x56f621);_0x5de052[_0x8df602(0x137)]({'name':_0x1efa8f,'path':_0x4739a3,'text':_0x23454b});}}}}const _0x11ee1b=getPromptsDir(_0x3a5196);if(a148_0x1a108a[_0x8df602(0x16e)](_0x11ee1b)){const _0x4adfad=a148_0x1a108a['readdirSync'](_0x11ee1b)[_0x8df602(0x182)](_0x1955f7=>_0x1955f7['endsWith']('.yml'));for(const _0x29821b of _0x4adfad){const _0x14d2b9=a148_0x55bc74['join'](_0x11ee1b,_0x29821b),_0x200c4d=parsePromptYaml(a148_0x1a108a[_0x8df602(0xdc)](_0x14d2b9,'utf-8'),_0x14d2b9);_0x5d598e[_0x8df602(0x137)]({'name':_0x200c4d[_0x8df602(0xf0)],'path':_0x14d2b9,'yaml':_0x200c4d});}}const _0x2f15e8=getIntegrationsDir(_0x3a5196);if(a148_0x1a108a['existsSync'](_0x2f15e8)){const _0xd25df9=a148_0x1a108a[_0x8df602(0x1c7)](_0x2f15e8)[_0x8df602(0x182)](_0xcf2ba5=>_0xcf2ba5[_0x8df602(0x154)](_0x8df602(0x15c)));for(const _0x1040ba of _0xd25df9){const _0x598d97=a148_0x55bc74[_0x8df602(0x16c)](_0x2f15e8,_0x1040ba),_0x1321f1=parseIntegrationYaml(a148_0x1a108a[_0x8df602(0xdc)](_0x598d97,_0x8df602(0xfd)),_0x598d97);SAFE_INTEGRATION_TYPES[_0x8df602(0x1c3)](_0x1321f1[_0x8df602(0x113)][_0x8df602(0x176)]())?_0x7f94ce[_0x8df602(0x137)]({'name':_0x1321f1[_0x8df602(0xf0)],'path':_0x598d97,'yaml':_0x1321f1}):this[_0x8df602(0x1be)]['warn'](_0x8df602(0xde)+_0x1321f1[_0x8df602(0xf0)]+_0x8df602(0x138)+_0x1321f1[_0x8df602(0x113)]+'):\x20'+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES[_0x8df602(0x16c)](',\x20')+_0x8df602(0x111)));}}const _0x1197ab=getExperimentalKnowledgeBasesDir(_0x3a5196);if(a148_0x1a108a[_0x8df602(0x16e)](_0x1197ab)){const _0x3e8811=a148_0x1a108a[_0x8df602(0x1c7)](_0x1197ab,{'withFileTypes':!![]});for(const _0x394299 of _0x3e8811){if(!_0x394299['isDirectory']())continue;const _0x14c04b=a148_0x55bc74[_0x8df602(0x16c)](_0x1197ab,_0x394299[_0x8df602(0xf0)]),_0x469edb=a148_0x55bc74['join'](_0x14c04b,_0x394299['name']+_0x8df602(0x15c));if(a148_0x1a108a['existsSync'](_0x469edb)){const _0x5e95b0=parseExperimentalKnowledgeBaseYaml(a148_0x1a108a[_0x8df602(0xdc)](_0x469edb,_0x8df602(0xfd)),_0x469edb),_0x29fd33=a148_0x55bc74['join'](_0x14c04b,_0x8df602(0xcc)),_0x110316=[];if(a148_0x1a108a['existsSync'](_0x29fd33)){const _0x3ca480=a148_0x1a108a[_0x8df602(0x1c7)](_0x29fd33,{'withFileTypes':!![]});for(const _0x5a88c4 of _0x3ca480){if(!_0x5a88c4[_0x8df602(0xdf)]())continue;const _0x354d43=a148_0x55bc74[_0x8df602(0x16c)](_0x29fd33,_0x5a88c4[_0x8df602(0xf0)]),_0x160f99=a148_0x55bc74[_0x8df602(0x16c)](_0x354d43,_0x8df602(0x184)),_0x27e495=a148_0x55bc74[_0x8df602(0x16c)](_0x354d43,'json_schema.json');if(a148_0x1a108a[_0x8df602(0x16e)](_0x160f99)&&a148_0x1a108a[_0x8df602(0x16e)](_0x27e495)){const _0x25625c=a148_0x1a108a['readFileSync'](_0x160f99,_0x8df602(0xfd)),_0x10d1af=a148_0x1a108a[_0x8df602(0xdc)](_0x27e495,_0x8df602(0xfd));_0x110316[_0x8df602(0x137)]({'name':_0x5a88c4['name'],'code':_0x25625c,'json_schema':_0x10d1af});}}}const _0x30198f={..._0x5e95b0,'functions':_0x110316};_0x185b68[_0x8df602(0x137)]({'name':_0x5e95b0['name'],'path':_0x14c04b,'def':_0x30198f});}}}const _0x5930ef=getExperimentalArtifactsDir(_0x3a5196);if(a148_0x1a108a[_0x8df602(0x16e)](_0x5930ef)){const _0x61ab7c=a148_0x1a108a[_0x8df602(0x1c7)](_0x5930ef,{'withFileTypes':!![]});for(const _0x53ee80 of _0x61ab7c){if(!_0x53ee80[_0x8df602(0xdf)]())continue;const _0x55f653=a148_0x55bc74['join'](_0x5930ef,_0x53ee80['name']),_0x2cd580=a148_0x55bc74[_0x8df602(0x16c)](_0x55f653,_0x53ee80[_0x8df602(0xf0)]+_0x8df602(0x15c));if(a148_0x1a108a[_0x8df602(0x16e)](_0x2cd580)){const _0x353589=parseExperimentalArtifactYaml(a148_0x1a108a[_0x8df602(0xdc)](_0x2cd580,'utf-8'),_0x2cd580),_0xe0cbc4=a148_0x55bc74['join'](_0x55f653,_0x8df602(0x184)),_0x2eab59=a148_0x1a108a[_0x8df602(0x16e)](_0xe0cbc4)?a148_0x1a108a[_0x8df602(0xdc)](_0xe0cbc4,_0x8df602(0xfd)):'',_0x2eded2=a148_0x55bc74[_0x8df602(0x16c)](_0x55f653,_0x8df602(0x128)),_0x4c24e3=[];if(a148_0x1a108a['existsSync'](_0x2eded2)){const _0xc502f=a148_0x1a108a[_0x8df602(0x1c7)](_0x2eded2);for(const _0x5acee4 of _0xc502f){const _0x78398b=a148_0x55bc74['join'](_0x2eded2,_0x5acee4);if(a148_0x1a108a['statSync'](_0x78398b)[_0x8df602(0xe5)]()){const _0x53b697=a148_0x1a108a[_0x8df602(0xdc)](_0x78398b,_0x8df602(0xfd));_0x4c24e3[_0x8df602(0x137)]({'file_name':_0x5acee4,'text_content':_0x53b697});}}}const _0xff1a32={..._0x353589,'code':_0x2eab59,'files':_0x4c24e3};_0x2f9ce6[_0x8df602(0x137)]({'name':_0x353589[_0x8df602(0xf0)],'path':_0x55f653,'def':_0xff1a32});}}}const _0x32630e=getFormInterfacesDir(_0x3a5196);if(a148_0x1a108a[_0x8df602(0x16e)](_0x32630e)){const _0x577dea=a148_0x1a108a[_0x8df602(0x1c7)](_0x32630e)[_0x8df602(0x182)](_0x33ed57=>_0x33ed57[_0x8df602(0x154)](_0x8df602(0x15c)));for(const _0x398fb4 of _0x577dea){const _0x48e55a=a148_0x55bc74[_0x8df602(0x16c)](_0x32630e,_0x398fb4),_0xfb44d1=parseFormInterfaceYaml(a148_0x1a108a[_0x8df602(0xdc)](_0x48e55a,'utf-8'),_0x48e55a);_0x106f5a[_0x8df602(0x137)]({'name':_0xfb44d1[_0x8df602(0xf0)],'path':_0x48e55a,'yaml':_0xfb44d1});}}const _0x571ce3=getChatInterfacesDir(_0x3a5196);if(a148_0x1a108a[_0x8df602(0x16e)](_0x571ce3)){const _0x38d720=a148_0x1a108a[_0x8df602(0x1c7)](_0x571ce3)[_0x8df602(0x182)](_0x110bde=>_0x110bde['endsWith'](_0x8df602(0x15c)));for(const _0x4bd5dd of _0x38d720){const _0xbeed81=a148_0x55bc74[_0x8df602(0x16c)](_0x571ce3,_0x4bd5dd),_0x4848c1=parseChatInterfaceYaml(a148_0x1a108a[_0x8df602(0xdc)](_0xbeed81,_0x8df602(0xfd)),_0xbeed81);_0x2f2c13['push']({'name':_0x4848c1[_0x8df602(0xf0)],'path':_0xbeed81,'yaml':_0x4848c1});}}}else{const _0x349153=await this[_0x8df602(0xff)](_0x3a5196),_0xb6dac0=await this[_0x8df602(0x118)][_0x8df602(0x1cd)](_0x349153);_0xd28ff0=_0xb6dac0[_0x8df602(0x197)][_0x8df602(0xf0)];const _0x20b14b=await this[_0x8df602(0x118)]['listAgentsFull'](_0x349153),_0x41ae73=await this['client'][_0x8df602(0x13b)](_0x349153),_0x45cd78=await this[_0x8df602(0x118)][_0x8df602(0xcf)](_0x349153),_0x48aef0=await this[_0x8df602(0x118)]['listPrompts'](_0x349153),_0x551bbc=await this[_0x8df602(0x118)][_0x8df602(0x1e7)](_0x349153),_0x465e50=await safeListOrEmpty(()=>this[_0x8df602(0x118)][_0x8df602(0x12e)](_0x349153)),_0x572275=await safeListOrEmpty(()=>this['client'][_0x8df602(0x106)](_0x349153)),_0x1133e2=new Map(),_0x3526b4=new Map(),_0x2ba58a=new Map(),_0x550d2c=new Map(),_0x5e8adc=new Map(),_0x270276=new Map();for(const _0x2e6f9f of _0x41ae73){_0x1133e2[_0x8df602(0x157)](_0x2e6f9f['id'],_0x2e6f9f[_0x8df602(0x197)][_0x8df602(0xf0)]);}for(const _0x22fcdf of _0x45cd78){_0x3526b4['set'](_0x22fcdf['id'],_0x22fcdf[_0x8df602(0x197)][_0x8df602(0xf0)]);}for(const _0x5f19b2 of _0x20b14b){_0x2ba58a[_0x8df602(0x157)](_0x5f19b2['id'],_0x5f19b2[_0x8df602(0x197)][_0x8df602(0xf0)]);}for(const _0x48bc60 of _0x48aef0){_0x550d2c[_0x8df602(0x157)](_0x48bc60['id'],_0x48bc60[_0x8df602(0x197)][_0x8df602(0xf0)]);}for(const _0x4c3b40 of _0x465e50){_0x5e8adc[_0x8df602(0x157)](_0x4c3b40['id'],_0x4c3b40[_0x8df602(0x197)][_0x8df602(0xf0)]);}for(const _0x2b3834 of _0x572275){_0x270276[_0x8df602(0x157)](_0x2b3834['id'],_0x2b3834[_0x8df602(0x197)][_0x8df602(0xf0)]);}const _0x2b7bde={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x1133e2,'TextKnowledgeBase':_0x3526b4,'Agent':_0x2ba58a,'ExperimentalKnowledgeBase':_0x5e8adc}),'resolvePromptName':async _0x4dac68=>_0x550d2c[_0x8df602(0x100)](_0x4dac68),'onWarning':_0x189dec=>this[_0x8df602(0x1be)]['warn'](_0x189dec)};for(const _0x56fb6a of _0x20b14b){const _0x3df9b0=await agentResponseToDef(_0x56fb6a,_0x2b7bde),{yaml:_0x4ddab9,systemPrompt:_0x45cc21,starterMessage:_0x5de0cc}=_0x3df9b0;_0x8809ee['push']({'name':_0x4ddab9[_0x8df602(0xf0)],'dir':'','yaml':_0x4ddab9,'systemPrompt':_0x45cc21,'starterMessage':_0x5de0cc});}for(const _0x155c20 of _0x41ae73){const _0x56f108=apiKnowledgeBaseToYaml(_0x155c20);_0x5627ec[_0x8df602(0x137)]({'name':_0x56f108['name'],'path':'','yaml':_0x56f108});}for(const _0xb0ed4a of _0x45cd78){_0x5de052[_0x8df602(0x137)]({'name':_0xb0ed4a['attributes'][_0x8df602(0xf0)],'path':'','text':_0xb0ed4a['attributes']['text']});}for(const _0x39f8a4 of _0x48aef0){const _0x2955c3=await apiPromptToYaml(_0x39f8a4,_0x2b7bde);_0x2955c3&&_0x5d598e[_0x8df602(0x137)]({'name':_0x2955c3[_0x8df602(0xf0)],'path':'','yaml':_0x2955c3});}for(const _0x11e471 of _0x551bbc){if(!_0x11e471['attributes'][_0x8df602(0x120)]&&SAFE_INTEGRATION_TYPES[_0x8df602(0x1c3)](_0x11e471[_0x8df602(0x197)]['serviceType']['toLowerCase']())){const _0x593a4e=await apiIntegrationToYaml(_0x11e471,_0x2b7bde);_0x7f94ce[_0x8df602(0x137)]({'name':_0x11e471[_0x8df602(0x197)][_0x8df602(0xf3)]['toLowerCase'](),'path':'','yaml':_0x593a4e});}}for(const _0x365a73 of _0x465e50){const _0x4e53a6=apiExperimentalKnowledgeBaseToYaml(_0x365a73);_0x185b68['push']({'name':_0x4e53a6[_0x8df602(0xf0)],'path':'','def':_0x4e53a6});}for(const _0x166929 of _0x572275){const _0x187929=apiExperimentalArtifactToYaml(_0x166929);_0x2f9ce6[_0x8df602(0x137)]({'name':_0x187929[_0x8df602(0xf0)],'path':'','def':_0x187929});}const _0x11fc25=await safeListOrEmpty(()=>this[_0x8df602(0x118)]['listFormInterfaces'](_0x349153));for(const _0x327b40 of _0x11fc25){const _0xa55743=await apiFormInterfaceToYaml(_0x327b40,_0x2b7bde);_0x106f5a[_0x8df602(0x137)]({'name':_0xa55743['name'],'path':'','yaml':_0xa55743});}const _0x3e69af=await safeListOrEmpty(()=>this[_0x8df602(0x118)]['listChatInterfaces'](_0x349153));for(const _0x43ffb7 of _0x3e69af){if(_0x43ffb7[_0x8df602(0x197)][_0x8df602(0x120)])continue;const _0x37ce61=await apiChatInterfaceToYaml(_0x43ffb7,_0x2b7bde);_0x2f2c13[_0x8df602(0x137)]({'name':_0x37ce61[_0x8df602(0xf0)],'path':'','yaml':_0x37ce61});}}const _0xda017={'sourceProjectName':_0xd28ff0,'newProjectName':_0x542496,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'imageGenerators':{'created':0x0,'errors':0x0},'webSearchTools':{'created':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'errors':0x0}}},_0x28a75e=await this[_0x8df602(0x118)][_0x8df602(0x12a)](),_0x41776e=_0x28a75e[_0x8df602(0x1e4)](_0xed4789=>_0xed4789['attributes']['name']===_0x542496);if(_0x41776e)throw new SDKError(ErrorCode[_0x8df602(0x1b9)],_0x8df602(0x108)+_0x542496+_0x8df602(0x1ae),undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x2fd18a?.['dryRun'])return _0xda017[_0x8df602(0x1c8)][_0x8df602(0x183)][_0x8df602(0x1a6)]=_0x8809ee[_0x8df602(0xee)],_0xda017[_0x8df602(0x1c8)][_0x8df602(0x179)][_0x8df602(0x1a6)]=_0x5627ec[_0x8df602(0xee)],_0xda017['counts'][_0x8df602(0x170)][_0x8df602(0x1a6)]=_0x5de052[_0x8df602(0xee)],_0xda017[_0x8df602(0x1c8)][_0x8df602(0x1b7)][_0x8df602(0x1a6)]=_0x185b68[_0x8df602(0xee)],_0xda017[_0x8df602(0x1c8)][_0x8df602(0x10f)]['created']=_0x2f9ce6[_0x8df602(0xee)],_0xda017[_0x8df602(0x1c8)][_0x8df602(0x1e2)]['created']=_0x5d598e[_0x8df602(0xee)],_0xda017[_0x8df602(0x1c8)][_0x8df602(0x195)][_0x8df602(0x1a6)]=_0x7f94ce[_0x8df602(0xee)],_0xda017;const _0x4737aa=await this[_0x8df602(0x118)][_0x8df602(0x104)]({'name':_0x542496}),_0x16d8bd=_0x4737aa['id'];_0xda017[_0x8df602(0x161)]=_0x16d8bd;const _0xefe2=new Map(),_0xd843ea=new Map(),_0x3d118a=new Map(),_0x48ad91=new Map(),_0x51bcb4=new Map(),_0x2b0c9a=new Map(),_0x2ecf4b=new Map(),_0x54f142=new Map(),_0x52c7e3=new Set(),_0x59b891=new Set();for(const _0x5334b0 of _0x8809ee){for(const _0x175781 of _0x5334b0['yaml'][_0x8df602(0x1d7)]||[]){if(_0x175781[_0x8df602(0x1df)]===_0x8df602(0x148)&&_0x175781[_0x8df602(0x122)]){const _0x2d3fc3=parseRef(_0x175781[_0x8df602(0x122)]);if(_0x2d3fc3)_0x52c7e3[_0x8df602(0x110)](_0x2d3fc3[_0x8df602(0xf0)]);}else{if(_0x175781['type']==='web_search'&&_0x175781[_0x8df602(0x122)]){const _0x5df154=parseRef(_0x175781[_0x8df602(0x122)]);if(_0x5df154)_0x59b891[_0x8df602(0x110)](_0x5df154['name']);}}}}for(const _0x230842 of _0x52c7e3){try{const _0x4c6f6f=await this['client']['createImageGenerator']({'projectId':_0x16d8bd,'name':_0x230842});_0x51bcb4[_0x8df602(0x157)](_0x230842,_0x4c6f6f['id']),_0xda017['imageGenerators'][_0x8df602(0x137)]({'name':_0x230842,'action':_0x8df602(0x1a6),'id':_0x4c6f6f['id']}),_0xda017[_0x8df602(0x1c8)]['imageGenerators'][_0x8df602(0x1a6)]++;}catch(_0x353e53){_0xda017[_0x8df602(0x11e)][_0x8df602(0x137)]({'name':_0x230842,'action':_0x8df602(0x1ba),'error':_0x353e53[_0x8df602(0x129)]}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x11e)][_0x8df602(0x19a)]++;}}for(const _0x20e21b of _0x59b891){try{const _0x57c01d=await this['client'][_0x8df602(0x1a0)]({'projectId':_0x16d8bd,'name':_0x20e21b});_0x2b0c9a['set'](_0x20e21b,_0x57c01d['id']),_0xda017[_0x8df602(0x123)]['push']({'name':_0x20e21b,'action':'created','id':_0x57c01d['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x123)][_0x8df602(0x1a6)]++;}catch(_0x4f0ac2){_0xda017[_0x8df602(0x123)][_0x8df602(0x137)]({'name':_0x20e21b,'action':_0x8df602(0x1ba),'error':_0x4f0ac2[_0x8df602(0x129)]}),_0xda017['counts'][_0x8df602(0x123)]['errors']++;}}const _0x4b7939=await fetchAllToolTargetMaps((_0x4ffdea,_0x5a7c70)=>this[_0x8df602(0x118)]['listToolTargets'](_0x4ffdea,_0x5a7c70),_0x16d8bd);let _0xfa0d4b=[];const _0x328035={'projectId':_0x16d8bd,'resolveToolTargetId':buildIdResolver({..._0x4b7939[_0x8df602(0x1dd)],'KnowledgeBase':_0xefe2,'TextKnowledgeBase':_0xd843ea,'ExperimentalKnowledgeBase':_0x2ecf4b,'Agent':_0x3d118a,'WebSearchTool':_0x2b0c9a,'ImageGenerator':_0x51bcb4}),'resolvePromptId':async _0x1f4ef0=>_0x48ad91[_0x8df602(0x100)](_0x1f4ef0),'onWarning':_0x37ad19=>{const _0x34d4b2=_0x8df602;this[_0x34d4b2(0x1be)][_0x34d4b2(0xed)](_0x37ad19),_0xfa0d4b['push'](_0x37ad19);}};for(const _0x336ce7 of _0x5627ec){try{const _0x2c6cf0=yamlKnowledgeBaseToApi(_0x336ce7[_0x8df602(0xeb)],_0x16d8bd),_0xb869e=await this[_0x8df602(0x118)][_0x8df602(0x1b0)](_0x2c6cf0);_0xefe2[_0x8df602(0x157)](_0x336ce7[_0x8df602(0xeb)]['name'],_0xb869e['id']),_0xda017[_0x8df602(0x179)]['push']({'name':_0x336ce7[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':_0x8df602(0x1a6),'id':_0xb869e['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x179)]['created']++;}catch(_0x97fe00){_0xda017[_0x8df602(0x179)][_0x8df602(0x137)]({'name':_0x336ce7[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':_0x8df602(0x1ba),'error':_0x97fe00[_0x8df602(0x129)]}),_0xda017[_0x8df602(0x1c8)]['knowledgeBases']['errors']++;}}for(const _0x4be8e7 of _0x5de052){try{const _0x2b9ec3=yamlTextKnowledgeBaseToApi({'name':_0x4be8e7[_0x8df602(0xf0)],'text':_0x4be8e7[_0x8df602(0x11c)]},_0x16d8bd),_0xaecf08=await this['client'][_0x8df602(0x16f)](_0x2b9ec3);_0xd843ea[_0x8df602(0x157)](_0x4be8e7[_0x8df602(0xf0)],_0xaecf08['id']),_0xda017[_0x8df602(0x170)]['push']({'name':_0x4be8e7[_0x8df602(0xf0)],'action':_0x8df602(0x1a6),'id':_0xaecf08['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x170)]['created']++;}catch(_0x1ccc1e){_0xda017[_0x8df602(0x170)][_0x8df602(0x137)]({'name':_0x4be8e7['name'],'action':_0x8df602(0x1ba),'error':_0x1ccc1e['message']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x170)]['errors']++;}}for(const _0x2a04b3 of _0x2f9ce6){try{const _0xd0c4fc=yamlExperimentalArtifactToApi(_0x2a04b3[_0x8df602(0x18b)],_0x16d8bd),_0x569e40=await this[_0x8df602(0x118)][_0x8df602(0x192)](_0xd0c4fc);_0x54f142[_0x8df602(0x157)](_0x2a04b3['def'][_0x8df602(0xf0)],_0x569e40['id']),_0xda017[_0x8df602(0x10f)]['push']({'name':_0x2a04b3[_0x8df602(0x18b)][_0x8df602(0xf0)],'action':_0x8df602(0x1a6),'id':_0x569e40['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x10f)][_0x8df602(0x1a6)]++;}catch(_0x575941){_0xda017[_0x8df602(0x10f)][_0x8df602(0x137)]({'name':_0x2a04b3[_0x8df602(0x18b)][_0x8df602(0xf0)],'action':_0x8df602(0x1ba),'error':_0x575941[_0x8df602(0x129)]}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x10f)][_0x8df602(0x19a)]++;}}for(const _0x393df7 of _0x185b68){try{const _0x446e3f=yamlExperimentalKnowledgeBaseToApi(_0x393df7[_0x8df602(0x18b)],_0x16d8bd),_0x17790e=await this[_0x8df602(0x118)]['createExperimentalKnowledgeBase'](_0x446e3f);_0x2ecf4b[_0x8df602(0x157)](_0x393df7[_0x8df602(0x18b)][_0x8df602(0xf0)],_0x17790e['id']),_0xda017[_0x8df602(0x1b7)][_0x8df602(0x137)]({'name':_0x393df7['def'][_0x8df602(0xf0)],'action':_0x8df602(0x1a6),'id':_0x17790e['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x1b7)][_0x8df602(0x1a6)]++;}catch(_0x4bd554){_0xda017[_0x8df602(0x1b7)][_0x8df602(0x137)]({'name':_0x393df7['def']['name'],'action':_0x8df602(0x1ba),'error':_0x4bd554[_0x8df602(0x129)]}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x1b7)][_0x8df602(0x19a)]++;}}const _0xfbe50c=[..._0x8809ee][_0x8df602(0x1b5)]((_0x27f436,_0x347445)=>{const _0x416a64=_0x8df602,_0x1f83fb=_0x27f436[_0x416a64(0xeb)]['tools']?.['some'](_0x57bed2=>_0x57bed2[_0x416a64(0x1df)]===_0x416a64(0x1af))??![],_0x41c174=_0x347445[_0x416a64(0xeb)][_0x416a64(0x1d7)]?.['some'](_0x263af7=>_0x263af7[_0x416a64(0x1df)]===_0x416a64(0x1af))??![];if(_0x1f83fb&&!_0x41c174)return 0x1;if(!_0x1f83fb&&_0x41c174)return-0x1;return 0x0;});for(const _0x2f178b of _0xfbe50c){_0xfa0d4b=[];try{const _0xdf5cc2=_0x2f178b[_0x8df602(0xeb)][_0x8df602(0x1d7)]?.[_0x8df602(0x182)](_0x4ece99=>{const _0x39174f=_0x8df602;if(_0x4ece99[_0x39174f(0x1df)]==='agent'&&_0x4ece99[_0x39174f(0x122)]){const _0xd672a9=parseRef(_0x4ece99['target']);return _0xd672a9?.[_0x39174f(0xf0)]===_0x2f178b[_0x39174f(0xeb)][_0x39174f(0xf0)];}return![];})??[];if(_0xdf5cc2[_0x8df602(0xee)]>0x0){const _0x4ebe5a='Agent\x20\x27'+_0x2f178b['yaml']['name']+_0x8df602(0x14c)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this[_0x8df602(0x1be)]['warn'](_0x4ebe5a),_0xfa0d4b[_0x8df602(0x137)](_0x4ebe5a);}const _0x459f63=await agentDefToRequest(_0x2f178b[_0x8df602(0xeb)],_0x2f178b[_0x8df602(0x177)],_0x2f178b['starterMessage'],_0x328035),_0xcf3cd7=await this['client'][_0x8df602(0x193)](_0x459f63);_0x3d118a[_0x8df602(0x157)](_0x2f178b['yaml'][_0x8df602(0xf0)],_0xcf3cd7['id']),_0xda017[_0x8df602(0x183)][_0x8df602(0x137)]({'agentName':_0x2f178b[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':_0x8df602(0x1a6),'agentId':_0xcf3cd7['id'],'warnings':_0xfa0d4b[_0x8df602(0xee)]>0x0?_0xfa0d4b:undefined}),_0xda017['counts'][_0x8df602(0x183)][_0x8df602(0x1a6)]++;}catch(_0x315339){_0xda017['agents']['push']({'agentName':_0x2f178b[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':'error','error':_0x315339['message'],'warnings':_0xfa0d4b[_0x8df602(0xee)]>0x0?_0xfa0d4b:undefined}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x183)][_0x8df602(0x19a)]++;}}for(const _0x5ccbed of _0x5d598e){try{const _0x7b4b0a=await yamlPromptToApi(_0x5ccbed[_0x8df602(0xeb)],_0x16d8bd,_0x328035);if(!_0x7b4b0a){_0xda017[_0x8df602(0x1e2)][_0x8df602(0x137)]({'name':_0x5ccbed[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':_0x8df602(0x1ba),'error':'Agent\x20reference\x20not\x20found'}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x1e2)][_0x8df602(0x19a)]++;continue;}const _0x1d0520=await this[_0x8df602(0x118)][_0x8df602(0x1ce)](_0x7b4b0a);_0x48ad91['set'](_0x5ccbed[_0x8df602(0xeb)][_0x8df602(0xf0)],_0x1d0520['id']),_0xda017[_0x8df602(0x1e2)][_0x8df602(0x137)]({'name':_0x5ccbed[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':_0x8df602(0x1a6),'id':_0x1d0520['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x1e2)][_0x8df602(0x1a6)]++;}catch(_0xb6e0b2){_0xda017[_0x8df602(0x1e2)]['push']({'name':_0x5ccbed[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':_0x8df602(0x1ba),'error':_0xb6e0b2[_0x8df602(0x129)]}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x1e2)][_0x8df602(0x19a)]++;}}for(const _0x37593d of _0x7f94ce){try{const _0x501836=await yamlIntegrationToApi(_0x37593d[_0x8df602(0xeb)],_0x16d8bd,_0x328035),_0x1302c8=await this['client'][_0x8df602(0xf9)](_0x501836);_0xda017[_0x8df602(0x195)][_0x8df602(0x137)]({'name':_0x37593d['yaml'][_0x8df602(0x113)],'action':'created','id':_0x1302c8['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x195)]['created']++;}catch(_0x16b6a3){_0xda017[_0x8df602(0x195)][_0x8df602(0x137)]({'name':_0x37593d[_0x8df602(0xeb)]['service_type'],'action':_0x8df602(0x1ba),'error':_0x16b6a3['message']}),_0xda017['counts']['integrations'][_0x8df602(0x19a)]++;}}for(const _0xef73a2 of _0x106f5a){try{const _0x2ecad2=await yamlFormInterfaceToApi(_0xef73a2['yaml'],_0x16d8bd,_0x328035);if(!_0x2ecad2){_0xda017[_0x8df602(0x18a)]['push']({'name':_0xef73a2['yaml'][_0x8df602(0xf0)],'action':_0x8df602(0x1ba),'error':_0x8df602(0x162)}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x18a)][_0x8df602(0x19a)]++;continue;}const _0x6f88d4=await this[_0x8df602(0x118)][_0x8df602(0x10e)](_0x2ecad2);_0xda017['formInterfaces'][_0x8df602(0x137)]({'name':_0xef73a2['yaml'][_0x8df602(0xf0)],'action':'created','id':_0x6f88d4['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x18a)][_0x8df602(0x1a6)]++;}catch(_0x56fb49){_0xda017[_0x8df602(0x18a)][_0x8df602(0x137)]({'name':_0xef73a2[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':_0x8df602(0x1ba),'error':_0x56fb49['message']}),_0xda017[_0x8df602(0x1c8)]['formInterfaces'][_0x8df602(0x19a)]++;}}for(const _0x5f4a90 of _0x2f2c13){try{const _0x4508f4=await yamlChatInterfaceToApi(_0x5f4a90[_0x8df602(0xeb)],_0x16d8bd,_0x328035),_0x591a87=await this[_0x8df602(0x118)][_0x8df602(0xf7)](_0x4508f4);_0xda017['chatInterfaces']['push']({'name':_0x5f4a90[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':'created','id':_0x591a87['id']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x19c)][_0x8df602(0x1a6)]++;}catch(_0x5b987b){_0xda017[_0x8df602(0x19c)]['push']({'name':_0x5f4a90[_0x8df602(0xeb)][_0x8df602(0xf0)],'action':_0x8df602(0x1ba),'error':_0x5b987b['message']}),_0xda017[_0x8df602(0x1c8)][_0x8df602(0x19c)]['errors']++;}}return _0xda017;}}
|
|
1
|
+
const a148_0x3ff51f=a148_0x5138;function a148_0x5138(_0x16f151,_0x4cc539){_0x16f151=_0x16f151-0x191;const _0x29ad5f=a148_0x29ad();let _0x513801=_0x29ad5f[_0x16f151];return _0x513801;}(function(_0x25f934,_0x36fcf4){const _0x4002e1=a148_0x5138,_0x24e219=_0x25f934();while(!![]){try{const _0x42a3e0=-parseInt(_0x4002e1(0x1da))/0x1*(-parseInt(_0x4002e1(0x295))/0x2)+parseInt(_0x4002e1(0x211))/0x3*(parseInt(_0x4002e1(0x287))/0x4)+parseInt(_0x4002e1(0x1f4))/0x5+parseInt(_0x4002e1(0x29b))/0x6+-parseInt(_0x4002e1(0x1bb))/0x7+parseInt(_0x4002e1(0x1d0))/0x8+-parseInt(_0x4002e1(0x19b))/0x9;if(_0x42a3e0===_0x36fcf4)break;else _0x24e219['push'](_0x24e219['shift']());}catch(_0x587357){_0x24e219['push'](_0x24e219['shift']());}}}(a148_0x29ad,0x1ef95));function a148_0x29ad(){const _0x9b4532=['web_search','push','localeCompare','getUserSettings','Project\x20\x22','knowledgeBases','resolveProjectName','filter','UNAUTHENTICATED','getDefaultAgent','experimentalKnowledgeBases','agentId','Could\x20not\x20resolve\x20agent\x20reference','1919648KeeBmS','projects','variables','dryRun','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','stringify','ExperimentalKnowledgeBase','backupProject','integrations.json','dir','1612biITcg','deleteProject','outputs','1.0','createExperimentalArtifact','\x0a---\x20schema:\x20','starter_message.md','listIntegrations','idToName','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','getDefaultProjectName','slackMessageMode','getChatLog','content','listExperimentalArtifacts','updateExperimentalArtifact','experimental_knowledge_bases','KnowledgeBase','knowledgebases.json','agents','includes','\x0a\x0a#\x20agent.yml\x0a','experimentalArtifacts','---\x20schema:\x20','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','createKnowledgeBase','295520YyTdOS','cwd','created','parse','listFormInterfaces','pullProject','starterMessage','getCurrentProject','createTextKnowledgeBase','isManaged','llm_project','getBackupMetadata','knowledge_bases','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','\x20attempts\x20due\x20to\x20name\x20conflicts.','site','\x20in\x20project\x20','image_gen','functions','oldPath','updateAgent','chatIgnoreManagedActions','prompt.md','textKnowledgeBases','warn','existsSync','serviceType','chat_generic','705219GGTllr','updateAgentResponse','utf-8','createWebSearchTool','client','updateTextKnowledgeBase','listAgentsFull','chat','json_schema.json','json_schema','createChatInterface','high','updateChatInterface','AGENT_NOT_FOUND','setCurrentProject','createAgentResponse','project','.llm','jsonSchemaHint','imageGenerators','prompts','get','find','pushAgent','integrations','\x20---\x0a','LLM_PROJECT_NOT_FOUND','listTextKnowledgeBases','file_name','listChats','low','deleteAgent','logger','getChatHistory','conflict','webSearchTools','add','chatWelcomeMessage','Renamed\x20prompt\x20file:\x20','Agent\x20\x27','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','systemPrompt','temperature','agents.json','continueChat','):\x20','tdx_','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','map','minimal','event','code.js','basename','listProjects','formInterfaces','experimental_artifacts','listPrompts','getChatInfo','.yml','set','Renamed\x20form\x20interface\x20file:\x20','.md','\x20→\x20','new','listKnowledgeBases','signal','createProject','projectId','join','def','already\x20exists','updateKnowledgeBase','mkdirSync','clearDefaultAgent','yaml','text_content','Renamed\x20agent\x20folder:\x20','---\x20file:\x20','unlinkSync','Renamed\x20chat\x20interface\x20file:\x20','chat_interfaces','listExperimentalKnowledgeBases','listChatInterfaces','listAgents','Unsupported\x20backup\x20version:\x20','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','_reasoning_','Removed\x20deleted\x20file:\x20','rmSync','attributes','template','PERMISSION_DENIED','Renamed\x20text\x20KB\x20file:\x20','writeFileSync','createIntegration','errors','status','reasoningEffort','Available\x20agents:\x20','tdx.json','Removed\x20deleted\x20directory:\x20','listImageGenerators','chatInfo','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','Only\x20safe\x20types\x20(','history','modelType','chatInterfaces','listWebSearchTools','\x27\x20(','tdx_default_','tdDatabaseName','unchanged','message','service_type','updated','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','Agent\x20reference\x20not\x20found','4LWdnpz','currentProjectId','name','project.json','getOrCreateDefaultProject','readFileSync','Invalid\x20agent\x20reference\x20format:\x20','ALREADY_EXISTS','Skipping\x20integration\x20\x27','Agent\x20not\x20found:\x20','loadJsonFile','models','counts','toISOString','260wpzGqQ','sort','exportedFrom','pullAgent','agent.yml\x20not\x20found\x20in\x20','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','646902LtchUY','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','target','text','endsWith','has','size','setDefaultAgent','\x0a---\x20function:\x20','nameToId','context','getProject','toLowerCase','total','updateFormInterface','getOrCreateDefaultAgent','deleteIntegration','agent','\x0a---\x20code\x20---\x0a','resolveProjectId','chatId','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','restoreProject',')\x20can\x20be\x20cloned.','NOT_FOUND','code','TextKnowledgeBase','INVALID_ARGUMENT','agent.yml','createFormInterface','Output\x20directory\x20already\x20exists:\x20','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','startChat','Renamed\x20KB\x20file:\x20','readdirSync','Multiple\x20agents\x20found\x20with\x20name\x20\x27',')\x20can\x20be\x20pushed.\x20','Renamed\x20folder:\x20','INTERNAL','5490297pUFEYs','resolveAgentId','isDir','type','version','split','updatePrompt','#\x20prompt.md\x0a','promptId','tools','prompts.json','claude-4.5-sonnet','tables','Unresolved\x20dependencies:\x20','length','medium','path','action','keys','Unable\x20to\x20create\x20project\x20after\x20','info','some','statSync','getAgent','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','createExperimentalKnowledgeBase','error','files','renamed','Project\x20not\x20found:\x20','\x27.\x20This\x20should\x20not\x20happen.','form_interfaces','802256zhjivZ','listToolTargets','isFile','profile','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.','dirname','starter_message','isDirectory'];a148_0x29ad=function(){return _0x9b4532;};return a148_0x29ad();}import{LLMApiClient}from'../client/llm-api-client.js';import*as a148_0x5d1e61 from'node:fs';import*as a148_0x235a2d from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{toModelInfos}from'./user-settings.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a148_0x3ff51f(0x210),'chat_agent_console','chat_parent_segment'];async function safeListOrEmpty(_0x41a0e5){const _0x205f55=a148_0x3ff51f;try{return await _0x41a0e5();}catch(_0x66691f){if(_0x66691f instanceof HTTPClientError&&_0x66691f[_0x205f55(0x271)]===0x194)return[];throw _0x66691f;}}export class LLMSDK{[a148_0x3ff51f(0x288)];[a148_0x3ff51f(0x215)];[a148_0x3ff51f(0x2a5)];['logger']=Logger['of']('sdk.llm');constructor(_0x4a6a68){const _0x430d37=a148_0x3ff51f;this[_0x430d37(0x215)]=new LLMApiClient(_0x4a6a68),this[_0x430d37(0x2a5)]=_0x4a6a68;}[a148_0x3ff51f(0x1e4)](){const _0x4fbf53=a148_0x3ff51f,_0x1a7d9a=getSanitizedUsername();return _0x4fbf53(0x27f)+_0x1a7d9a;}async[a148_0x3ff51f(0x21f)](_0x22939a){const {projectId:_0x2edae5}=await this['resolveProjectName'](_0x22939a);this['currentProjectId']=_0x2edae5;}[a148_0x3ff51f(0x1fb)](){const _0x25185b=a148_0x3ff51f;return this[_0x25185b(0x288)];}async[a148_0x3ff51f(0x2a2)](_0x4ac085){const _0x3aa9af=a148_0x3ff51f,_0x2b819a=this[_0x3aa9af(0x2a5)][_0x3aa9af(0x1be)];let _0x39a337,_0x1d5241;if(_0x4ac085[_0x3aa9af(0x1ee)]('/')){const _0x265c55=_0x4ac085[_0x3aa9af(0x1a0)]('/');if(_0x265c55[_0x3aa9af(0x1a9)]!==0x2)throw new SDKError(ErrorCode[_0x3aa9af(0x2b6)],_0x3aa9af(0x28d)+_0x4ac085,undefined,{'helpText':'Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22'});const [_0x4ea454,_0x23f1bb]=_0x265c55;_0x39a337=await this[_0x3aa9af(0x2ae)](_0x4ea454),_0x1d5241=_0x23f1bb;}else _0x39a337=this['currentProjectId']||(await this[_0x3aa9af(0x28b)]())['id'],_0x1d5241=_0x4ac085;const _0x3b7de7=await this[_0x3aa9af(0x19c)](_0x1d5241,_0x39a337),_0x30af2e=await this[_0x3aa9af(0x215)][_0x3aa9af(0x1b2)](_0x3b7de7);writeCachedLLMAgent(_0x30af2e['attributes'][_0x3aa9af(0x289)],_0x3b7de7,_0x39a337,_0x2b819a);}[a148_0x3ff51f(0x1cc)](){const _0x41d21b=a148_0x3ff51f,_0x3cc7e7=this[_0x41d21b(0x2a5)][_0x41d21b(0x1be)];return readCachedLLMAgent(_0x3cc7e7)||undefined;}[a148_0x3ff51f(0x25a)](){const _0x429842=a148_0x3ff51f,_0x2783e0=this[_0x429842(0x2a5)]['profile'];clearCachedLLMAgent(_0x2783e0);}async[a148_0x3ff51f(0x292)](){const _0x58dbb4=a148_0x3ff51f,_0x55b6d9=await this[_0x58dbb4(0x215)][_0x58dbb4(0x1c6)]();return toModelInfos(_0x55b6d9);}async['createProject'](_0xec0ad2){const _0x2cbc5d=a148_0x3ff51f;return await this[_0x2cbc5d(0x215)]['createProject'](_0xec0ad2);}async[a148_0x3ff51f(0x1db)](_0x2aa2fa){const _0x10e0ee=a148_0x3ff51f,{projectId:_0x537b26}=await this[_0x10e0ee(0x1c9)](_0x2aa2fa);await this[_0x10e0ee(0x215)][_0x10e0ee(0x1db)](_0x537b26);}async[a148_0x3ff51f(0x1d1)](_0x1615a0=0x32){return await this['client']['listProjects'](_0x1615a0);}async[a148_0x3ff51f(0x28b)](_0x217c5f){const _0x1bcd0f=a148_0x3ff51f,_0x5852b0=_0x217c5f||this[_0x1bcd0f(0x1e4)](),_0x40645d=this[_0x1bcd0f(0x2a5)][_0x1bcd0f(0x1be)];if(!_0x217c5f){const _0x4a78f7=readCachedLLMProject(_0x40645d);if(_0x4a78f7&&_0x4a78f7['name']===_0x5852b0)try{const _0x45c100=await this[_0x1bcd0f(0x215)]['getProject'](_0x4a78f7['id']);if(_0x45c100[_0x1bcd0f(0x26a)][_0x1bcd0f(0x289)]===_0x5852b0)return _0x45c100;}catch{}}const _0x39b453=await this[_0x1bcd0f(0x215)][_0x1bcd0f(0x246)](),_0x3c6ac9=_0x39b453[_0x1bcd0f(0x227)](_0x5f024f=>_0x5f024f[_0x1bcd0f(0x26a)][_0x1bcd0f(0x289)]===_0x5852b0);if(_0x3c6ac9)return!_0x217c5f&&writeCachedLLMProject(_0x5852b0,_0x3c6ac9['id'],_0x40645d),_0x3c6ac9;const _0x556b2d=await this[_0x1bcd0f(0x215)]['createProject']({'name':_0x5852b0,'description':_0x1bcd0f(0x1e3)+getSanitizedUsername()+')'});return!_0x217c5f&&writeCachedLLMProject(_0x5852b0,_0x556b2d['id'],_0x40645d),_0x556b2d;}async['resolveProjectId'](_0x3fc21a){const _0x4ddebc=a148_0x3ff51f,_0x5186a8=await this['client'][_0x4ddebc(0x246)](),_0x3b8936=_0x5186a8['filter'](_0x3dc955=>_0x3dc955[_0x4ddebc(0x26a)][_0x4ddebc(0x289)]===_0x3fc21a);if(_0x3b8936[_0x4ddebc(0x1a9)]===0x0)throw new SDKError(ErrorCode[_0x4ddebc(0x22b)],_0x4ddebc(0x1b8)+_0x3fc21a,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x3b8936[_0x4ddebc(0x1a9)]>0x1)throw new SDKError(ErrorCode[_0x4ddebc(0x19a)],'Multiple\x20projects\x20found\x20with\x20name\x20\x27'+_0x3fc21a+_0x4ddebc(0x1b9));return _0x3b8936[0x0]['id'];}async[a148_0x3ff51f(0x1c9)](_0x45c0a8){const _0x3ba37b=a148_0x3ff51f,_0x1c86d2=await this['client'][_0x3ba37b(0x246)](),_0x1ec1c8=_0x1c86d2[_0x3ba37b(0x227)](_0x30aac5=>_0x30aac5[_0x3ba37b(0x26a)][_0x3ba37b(0x289)]===_0x45c0a8);if(_0x1ec1c8)return{'projectId':_0x1ec1c8['id'],'project':_0x1ec1c8};throw new SDKError(ErrorCode[_0x3ba37b(0x22b)],'Project\x20not\x20found:\x20'+_0x45c0a8,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async[a148_0x3ff51f(0x2aa)](_0x31f2c5=a148_0x3ff51f(0x1a6),_0x4473c0=0x0,_0x9dedb2){const _0x562eb4=a148_0x3ff51f,_0x4d7e13=0xa;let _0x1d7f34=0x0,_0x1d9642;while(_0x1d7f34<_0x4d7e13){try{const _0x3382b8=await this[_0x562eb4(0x28b)](_0x1d9642),_0x4ea18a=_0x3382b8['id'],_0x3c55ba=['none',_0x562eb4(0x242),_0x562eb4(0x22f),_0x562eb4(0x1aa),_0x562eb4(0x21c)],_0x2e5af8=_0x4473c0===0x0?'tdx_'+_0x31f2c5:_0x562eb4(0x23f)+_0x31f2c5+_0x562eb4(0x267)+_0x3c55ba[_0x4473c0],_0x5c9024=await this[_0x562eb4(0x215)][_0x562eb4(0x264)](_0x4ea18a),_0x19d491=_0x5c9024[_0x562eb4(0x227)](_0x507772=>_0x507772[_0x562eb4(0x26a)]['name']===_0x2e5af8);if(_0x19d491)return _0x19d491;const _0x2a24e2=_0x4473c0>0x0?0x1:_0x9dedb2;return await this[_0x562eb4(0x215)]['createAgent']({'name':_0x2e5af8,'projectId':_0x4ea18a,'modelType':_0x31f2c5,'systemPrompt':'','temperature':_0x2a24e2,'reasoningEffort':_0x4473c0>0x0?_0x4473c0:undefined});}catch(_0x17d040){if(_0x17d040 instanceof HTTPClientError){const _0x4759f1=_0x17d040[_0x562eb4(0x271)];if(_0x4759f1>=0x190&&_0x4759f1<0x1f4){if(_0x4759f1===0x191)throw new SDKError(ErrorCode[_0x562eb4(0x1cb)],_0x562eb4(0x1d4),_0x17d040);else{if(_0x4759f1===0x193)throw new SDKError(ErrorCode[_0x562eb4(0x26c)],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x17d040);}throw _0x17d040;}}if(errorContains(_0x17d040,_0x562eb4(0x257),'duplicate',_0x562eb4(0x233))){_0x1d7f34++;if(_0x1d7f34>=_0x4d7e13)throw new SDKError(ErrorCode[_0x562eb4(0x28e)],_0x562eb4(0x1ae)+_0x4d7e13+_0x562eb4(0x203),_0x17d040);const _0x31fa4b=this['getDefaultProjectName']();_0x1d9642=_0x31fa4b+'_'+generateRandomHex();continue;}throw _0x17d040;}}throw new SDKError(ErrorCode[_0x562eb4(0x19a)],'Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts');}async[a148_0x3ff51f(0x19c)](_0x52dac7,_0x17bc32){const _0x463047=a148_0x3ff51f,_0x4624ce=_0x17bc32||this[_0x463047(0x288)],_0x21d2a2=await this[_0x463047(0x215)][_0x463047(0x264)](_0x4624ce),_0x48c594=_0x21d2a2['filter'](_0x5ccf8f=>_0x5ccf8f[_0x463047(0x26a)][_0x463047(0x289)]===_0x52dac7);if(_0x48c594[_0x463047(0x1a9)]===0x0){const _0x435209=_0x4624ce?_0x463047(0x205)+_0x4624ce:'';throw new SDKError(ErrorCode[_0x463047(0x21e)],'Agent\x20not\x20found:\x20'+_0x52dac7+_0x435209,undefined,{'helpText':_0x4624ce?'Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.':_0x463047(0x1bf)});}if(_0x48c594['length']>0x1)throw new SDKError(ErrorCode[_0x463047(0x19a)],_0x463047(0x197)+_0x52dac7+_0x463047(0x1b9));return _0x48c594[0x0]['id'];}async[a148_0x3ff51f(0x1ed)](_0x5720e9){const _0x1ca533=a148_0x3ff51f,_0x469d8f=_0x5720e9||this[_0x1ca533(0x288)];return await this[_0x1ca533(0x215)][_0x1ca533(0x264)](_0x469d8f);}async['agentsFull'](_0x58b857){return await this['client']['listAgentsFull'](_0x58b857);}async[a148_0x3ff51f(0x2ac)](_0x273081){const _0x252270=a148_0x3ff51f;return await this[_0x252270(0x215)]['getAgent'](_0x273081);}async['createAgent'](_0xa1db58){const _0x1e4994=a148_0x3ff51f;return await this[_0x1e4994(0x215)]['createAgent'](_0xa1db58);}async[a148_0x3ff51f(0x209)](_0x3d3035,_0x177a40){const _0x4e010f=a148_0x3ff51f;return await this[_0x4e010f(0x215)][_0x4e010f(0x209)](_0x3d3035,_0x177a40);}async[a148_0x3ff51f(0x230)](_0x52712e){const _0x467d66=a148_0x3ff51f;await this['client'][_0x467d66(0x230)](_0x52712e);}async[a148_0x3ff51f(0x194)](_0x177f05){const _0x12547a=a148_0x3ff51f;return await this[_0x12547a(0x215)]['startChat']({'agentId':_0x177f05});}async*[a148_0x3ff51f(0x218)](_0x3231b8,_0x3631b6){const _0x16deca=a148_0x3ff51f;let _0x57569b=_0x3631b6?.[_0x16deca(0x2af)];const _0x3b2eec=_0x3631b6?.[_0x16deca(0x1ce)];if(!_0x57569b){if(!_0x3b2eec)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x5107fa=await this[_0x16deca(0x215)][_0x16deca(0x194)]({'agentId':_0x3b2eec});_0x57569b=_0x5107fa['id'],yield{'type':'metadata','data':{'chatId':_0x57569b,'agentId':_0x3b2eec,'projectId':_0x5107fa[_0x16deca(0x26a)][_0x16deca(0x254)]}};}for await(const _0x149b41 of this[_0x16deca(0x215)][_0x16deca(0x23d)](_0x57569b,_0x3231b8,_0x3631b6?.[_0x16deca(0x252)])){yield{'type':_0x16deca(0x243),'data':_0x149b41};}}async['chats'](_0x43c1ea=0x32){const _0x54d534=a148_0x3ff51f;return await this[_0x54d534(0x215)][_0x54d534(0x22e)](_0x43c1ea);}async[a148_0x3ff51f(0x27a)](_0x7e9caa){const _0x3952a0=a148_0x3ff51f;return await this[_0x3952a0(0x215)][_0x3952a0(0x232)](_0x7e9caa);}async[a148_0x3ff51f(0x1e6)](_0x91997f){const _0x4413d0=a148_0x3ff51f;return await this[_0x4413d0(0x215)]['getChatLog'](_0x91997f);}async[a148_0x3ff51f(0x277)](_0xd5ed7){const _0x3fceea=a148_0x3ff51f;return await this[_0x3fceea(0x215)][_0x3fceea(0x24a)](_0xd5ed7);}async[a148_0x3ff51f(0x1d7)](_0x4b02a2,_0x12a33f,_0x163ae9){const _0x19c2b9=a148_0x3ff51f,_0xeb1571=_0x163ae9?.[_0x19c2b9(0x1d3)]??![],{projectId:_0x230a58,project:_0x477185}=await this[_0x19c2b9(0x1c9)](_0x4b02a2),_0x16b17e=_0x477185[_0x19c2b9(0x26a)][_0x19c2b9(0x289)],_0x2c350b=_0x12a33f||_0x16b17e+_0x19c2b9(0x222);if(a148_0x5d1e61[_0x19c2b9(0x20e)](_0x2c350b)&&!_0xeb1571)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x19c2b9(0x192)+_0x2c350b,undefined,{'helpText':_0x19c2b9(0x201)});const _0x26c7ef=await this[_0x19c2b9(0x215)][_0x19c2b9(0x217)](_0x230a58),_0x1cfb6a=await this[_0x19c2b9(0x215)][_0x19c2b9(0x251)](_0x230a58),_0x16948b=await this[_0x19c2b9(0x215)][_0x19c2b9(0x249)](_0x230a58),_0x24f992=await this[_0x19c2b9(0x215)]['listIntegrations'](_0x230a58);if(!_0xeb1571){a148_0x5d1e61[_0x19c2b9(0x259)](_0x2c350b,{'recursive':!![]});const _0x10ce7b={'version':_0x19c2b9(0x1dd),'exportedAt':new Date()[_0x19c2b9(0x294)](),'exportedFrom':{'site':this[_0x19c2b9(0x2a5)]['site'],'projectId':_0x230a58,'projectName':_0x16b17e},'project':_0x477185};a148_0x5d1e61[_0x19c2b9(0x26e)](a148_0x235a2d[_0x19c2b9(0x255)](_0x2c350b,_0x19c2b9(0x28a)),JSON[_0x19c2b9(0x1d5)](_0x10ce7b,null,0x2)),a148_0x5d1e61[_0x19c2b9(0x26e)](a148_0x235a2d[_0x19c2b9(0x255)](_0x2c350b,_0x19c2b9(0x23c)),JSON[_0x19c2b9(0x1d5)](_0x26c7ef,null,0x2)),a148_0x5d1e61[_0x19c2b9(0x26e)](a148_0x235a2d['join'](_0x2c350b,_0x19c2b9(0x1ec)),JSON[_0x19c2b9(0x1d5)](_0x1cfb6a,null,0x2)),a148_0x5d1e61[_0x19c2b9(0x26e)](a148_0x235a2d[_0x19c2b9(0x255)](_0x2c350b,_0x19c2b9(0x1a5)),JSON[_0x19c2b9(0x1d5)](_0x16948b,null,0x2)),a148_0x5d1e61['writeFileSync'](a148_0x235a2d['join'](_0x2c350b,_0x19c2b9(0x1d8)),JSON[_0x19c2b9(0x1d5)](_0x24f992,null,0x2));}return{'projectName':_0x16b17e,'outputDir':_0x2c350b,'counts':{'agents':_0x26c7ef['length'],'knowledgeBases':_0x1cfb6a[_0x19c2b9(0x1a9)],'prompts':_0x16948b[_0x19c2b9(0x1a9)],'integrations':_0x24f992[_0x19c2b9(0x1a9)]}};}async[a148_0x3ff51f(0x2b1)](_0x470952,_0x3b83c2){const _0x48fa46=a148_0x3ff51f,_0x119823=_0x3b83c2?.['dryRun']??![],_0x5612f8=this[_0x48fa46(0x1ff)](_0x470952),_0x267d4a=_0x5612f8[_0x48fa46(0x297)]['site'],_0x3f6ece=this[_0x48fa46(0x2a5)][_0x48fa46(0x204)],_0x1b60d7=_0x267d4a!==_0x3f6ece?_0x267d4a:undefined,_0x4c2bda=this[_0x48fa46(0x291)](a148_0x235a2d[_0x48fa46(0x255)](_0x470952,_0x48fa46(0x23c)),[]),_0x3660f1=this[_0x48fa46(0x291)](a148_0x235a2d['join'](_0x470952,_0x48fa46(0x1ec)),[]),_0x1dca7c=this[_0x48fa46(0x291)](a148_0x235a2d[_0x48fa46(0x255)](_0x470952,'prompts.json'),[]),_0x3a96b4=this[_0x48fa46(0x291)](a148_0x235a2d[_0x48fa46(0x255)](_0x470952,_0x48fa46(0x1d8)),[]),_0x204234=_0x3b83c2?.[_0x48fa46(0x289)]||_0x5612f8[_0x48fa46(0x297)]['projectName'];if(_0x119823){const _0x490538=new Map(),_0x5409ad=[..._0x4c2bda],_0x43f2f2=_0x4c2bda['length']+0x1;let _0x4af6ea=0x0;while(_0x5409ad['length']>0x0&&_0x4af6ea<_0x43f2f2){_0x4af6ea++;const _0x651a79=[];for(const _0x32e3a4 of _0x5409ad){canCreateAgent(_0x32e3a4,_0x490538)?_0x490538[_0x48fa46(0x24c)](_0x32e3a4['id'],'dry-run-'+_0x32e3a4['id']):_0x651a79[_0x48fa46(0x1c4)](_0x32e3a4);}if(_0x651a79[_0x48fa46(0x1a9)]===_0x5409ad['length'])throw new SDKError(ErrorCode['INTERNAL'],_0x48fa46(0x29c),undefined,{'helpText':_0x48fa46(0x202)});_0x5409ad[_0x48fa46(0x1a9)]=0x0,_0x5409ad[_0x48fa46(0x1c4)](..._0x651a79);}const _0x567c0c=_0x1dca7c[_0x48fa46(0x1ca)](_0x2b741b=>_0x490538[_0x48fa46(0x2a0)](_0x2b741b[_0x48fa46(0x26a)]['agentId']))[_0x48fa46(0x1a9)];return{'projectName':_0x204234,'projectId':'(dry-run)','counts':{'agents':_0x4c2bda[_0x48fa46(0x1a9)],'knowledgeBases':_0x3660f1[_0x48fa46(0x1a9)],'prompts':_0x567c0c,'integrations':_0x3a96b4[_0x48fa46(0x1a9)]},'sourceSite':_0x1b60d7};}const _0x7635e2=await this[_0x48fa46(0x215)][_0x48fa46(0x253)]({'name':_0x204234,'description':_0x5612f8[_0x48fa46(0x221)]['attributes']['description']}),_0x230318=_0x7635e2['id'],_0xc595ee=new Map(),_0x157efd=new Map(),_0x55871b=new Map();for(const _0x2d0027 of _0x3660f1){const _0x5b97aa=await this[_0x48fa46(0x215)][_0x48fa46(0x1f3)]({'projectId':_0x230318,'name':_0x2d0027[_0x48fa46(0x26a)][_0x48fa46(0x289)],'tdDatabaseName':_0x2d0027[_0x48fa46(0x26a)][_0x48fa46(0x280)],'tables':_0x2d0027['attributes'][_0x48fa46(0x1a7)]});_0xc595ee[_0x48fa46(0x24c)](_0x2d0027['id'],_0x5b97aa['id']);}const _0x561a8c=[..._0x4c2bda],_0x4bfe28=_0x4c2bda['length']+0x1;let _0x35f18e=0x0;while(_0x561a8c[_0x48fa46(0x1a9)]>0x0&&_0x35f18e<_0x4bfe28){_0x35f18e++;const _0x89927a=[];for(const _0x3606f6 of _0x561a8c){if(canCreateAgent(_0x3606f6,_0x157efd)){const _0x1bbe7c=remapToolIds(_0x3606f6[_0x48fa46(0x26a)][_0x48fa46(0x1a4)],_0xc595ee,_0x157efd),_0x11f629=remapVariableIds(_0x3606f6['attributes'][_0x48fa46(0x1d2)],_0xc595ee),_0x58aa46=await this[_0x48fa46(0x215)][_0x48fa46(0x220)]({'name':_0x3606f6[_0x48fa46(0x26a)][_0x48fa46(0x289)],'projectId':_0x230318,'systemPrompt':_0x3606f6['attributes'][_0x48fa46(0x23a)],'starterMessage':_0x3606f6[_0x48fa46(0x26a)]['starterMessage'],'modelType':migrateModelType(_0x3606f6['attributes'][_0x48fa46(0x27b)]),'maxToolIterations':_0x3606f6['attributes']['maxToolIterations'],'temperature':_0x3606f6[_0x48fa46(0x26a)][_0x48fa46(0x23b)],'reasoningEffort':_0x3606f6[_0x48fa46(0x26a)][_0x48fa46(0x272)],'outputs':_0x3606f6[_0x48fa46(0x26a)][_0x48fa46(0x1dc)],'tools':_0x1bbe7c,'variables':_0x11f629});_0x157efd[_0x48fa46(0x24c)](_0x3606f6['id'],_0x58aa46['id']);}else _0x89927a[_0x48fa46(0x1c4)](_0x3606f6);}if(_0x89927a[_0x48fa46(0x1a9)]===_0x561a8c['length'])throw new SDKError(ErrorCode[_0x48fa46(0x19a)],_0x48fa46(0x29c),undefined,{'helpText':_0x48fa46(0x202)});_0x561a8c[_0x48fa46(0x1a9)]=0x0,_0x561a8c[_0x48fa46(0x1c4)](..._0x89927a);}for(const _0x48cf4d of _0x1dca7c){const _0x3c028d=_0x157efd[_0x48fa46(0x226)](_0x48cf4d[_0x48fa46(0x26a)][_0x48fa46(0x1ce)]);if(!_0x3c028d)continue;const _0x218b10=await this[_0x48fa46(0x215)]['createPrompt']({'projectId':_0x230318,'agentId':_0x3c028d,'name':_0x48cf4d[_0x48fa46(0x26a)][_0x48fa46(0x289)],'systemPrompt':_0x48cf4d[_0x48fa46(0x26a)][_0x48fa46(0x23a)],'template':_0x48cf4d[_0x48fa46(0x26a)][_0x48fa46(0x26b)],'jsonSchemaHint':_0x48cf4d['attributes'][_0x48fa46(0x223)]});_0x55871b[_0x48fa46(0x24c)](_0x48cf4d['id'],_0x218b10['id']);}for(const _0x1328a9 of _0x3a96b4){const _0x5cd56e=_0x1328a9[_0x48fa46(0x26a)]['actions'][_0x48fa46(0x241)](_0x5905be=>({..._0x5905be,'promptId':_0x55871b[_0x48fa46(0x226)](_0x5905be[_0x48fa46(0x1a3)])||_0x5905be[_0x48fa46(0x1a3)]}));await this[_0x48fa46(0x215)][_0x48fa46(0x26f)]({'projectId':_0x230318,'serviceType':_0x1328a9[_0x48fa46(0x26a)][_0x48fa46(0x20f)],'actions':_0x5cd56e,'slackMessageMode':_0x1328a9['attributes'][_0x48fa46(0x1e5)],'chatIgnoreManagedActions':_0x1328a9['attributes'][_0x48fa46(0x20a)],'chatWelcomeMessage':_0x1328a9['attributes'][_0x48fa46(0x236)],'webhookCorsOrigins':_0x1328a9[_0x48fa46(0x26a)]['webhookCorsOrigins']});}return{'projectName':_0x204234,'projectId':_0x230318,'counts':{'agents':_0x157efd[_0x48fa46(0x2a1)],'knowledgeBases':_0xc595ee[_0x48fa46(0x2a1)],'prompts':_0x55871b[_0x48fa46(0x2a1)],'integrations':_0x3a96b4[_0x48fa46(0x1a9)]},'sourceSite':_0x1b60d7};}[a148_0x3ff51f(0x291)](_0x1ab098,_0x4079b3){const _0x56c35d=a148_0x3ff51f;if(!a148_0x5d1e61['existsSync'](_0x1ab098))return _0x4079b3;return JSON[_0x56c35d(0x1f7)](a148_0x5d1e61[_0x56c35d(0x28c)](_0x1ab098,_0x56c35d(0x213)));}['getBackupMetadata'](_0x1a1d0c){const _0x367471=a148_0x3ff51f;if(!a148_0x5d1e61[_0x367471(0x20e)](_0x1a1d0c))throw new SDKError(ErrorCode[_0x367471(0x2b3)],'Backup\x20folder\x20not\x20found:\x20'+_0x1a1d0c,undefined,{'helpText':_0x367471(0x285)});const _0x36ac22=a148_0x235a2d[_0x367471(0x255)](_0x1a1d0c,_0x367471(0x28a));if(!a148_0x5d1e61[_0x367471(0x20e)](_0x36ac22))throw new SDKError(ErrorCode[_0x367471(0x2b6)],_0x367471(0x29a)+_0x1a1d0c,undefined,{'helpText':_0x367471(0x2b0)});const _0x2e5509=JSON[_0x367471(0x1f7)](a148_0x5d1e61[_0x367471(0x28c)](_0x36ac22,_0x367471(0x213)));if(!isSupportedBackupVersion(_0x2e5509['version']))throw new SDKError(ErrorCode[_0x367471(0x2b6)],_0x367471(0x265)+_0x2e5509[_0x367471(0x19f)],undefined,{'helpText':_0x367471(0x1b3)});return _0x2e5509;}async[a148_0x3ff51f(0x1f9)](_0x5a2b16,_0x5407ed,_0x2dd8a6){const _0x453928=a148_0x3ff51f,{projectId:_0x14c2dd,project:_0x5adf40}=await this[_0x453928(0x1c9)](_0x5a2b16),_0x8f6bf8=_0x5adf40[_0x453928(0x26a)]['name'];let _0x45342f;if(_0x5407ed)_0x45342f=_0x5407ed;else{const _0x29329b=a148_0x235a2d['join'](process[_0x453928(0x1f5)](),'agents'),_0x33bd34=getSanitizedPathWithMigration(_0x29329b,_0x8f6bf8);_0x33bd34[_0x453928(0x1b7)]&&this[_0x453928(0x231)]['info'](_0x453928(0x199)+a148_0x235a2d[_0x453928(0x245)](_0x33bd34['oldPath'])+'\x20→\x20'+a148_0x235a2d['basename'](_0x33bd34[_0x453928(0x1ab)])),_0x45342f=_0x33bd34[_0x453928(0x1ab)];}const _0x1c6493=await this[_0x453928(0x215)]['listAgentsFull'](_0x14c2dd),_0x561aac=await this['client'][_0x453928(0x251)](_0x14c2dd),_0x382ac7=await this[_0x453928(0x215)][_0x453928(0x22c)](_0x14c2dd),_0x1b0d87=await safeListOrEmpty(()=>this[_0x453928(0x215)][_0x453928(0x276)](_0x14c2dd)),_0x19e9f7=await safeListOrEmpty(()=>this['client'][_0x453928(0x27d)](_0x14c2dd)),_0x18e898=await this['client'][_0x453928(0x249)](_0x14c2dd),_0x2fa04a=await this['client'][_0x453928(0x1e1)](_0x14c2dd),_0x2064aa=await safeListOrEmpty(()=>this['client'][_0x453928(0x262)](_0x14c2dd)),_0x149df1=await safeListOrEmpty(()=>this[_0x453928(0x215)]['listExperimentalArtifacts'](_0x14c2dd)),_0x387269=await safeListOrEmpty(()=>this['client'][_0x453928(0x1f8)](_0x14c2dd)),_0xaa3943=await safeListOrEmpty(()=>this[_0x453928(0x215)][_0x453928(0x263)](_0x14c2dd)),_0x4862da=_0x2fa04a[_0x453928(0x1ca)](_0x159076=>!_0x159076[_0x453928(0x26a)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x453928(0x1ee)](_0x159076[_0x453928(0x26a)][_0x453928(0x20f)]['toLowerCase']())),_0x242462=new Map(),_0x434f75=new Map(),_0x33a15c=new Map(),_0x1f3c08=new Map(),_0x221568=new Map(),_0x2772e1=new Map(),_0x364a14=new Map();for(const _0x3bf83c of _0x1c6493){_0x242462[_0x453928(0x24c)](_0x3bf83c['id'],_0x3bf83c[_0x453928(0x26a)][_0x453928(0x289)]);}for(const _0xa6c6c of _0x561aac){_0x434f75[_0x453928(0x24c)](_0xa6c6c['id'],_0xa6c6c[_0x453928(0x26a)][_0x453928(0x289)]);}for(const _0x1c0e9a of _0x382ac7){_0x33a15c['set'](_0x1c0e9a['id'],_0x1c0e9a['attributes'][_0x453928(0x289)]);}for(const _0x4a46a6 of _0x1b0d87){_0x1f3c08[_0x453928(0x24c)](_0x4a46a6['id'],_0x4a46a6[_0x453928(0x26a)]['name']);}for(const _0x1e9387 of _0x19e9f7){_0x221568[_0x453928(0x24c)](_0x1e9387['id'],_0x1e9387[_0x453928(0x26a)]['name']);}for(const _0x2fe9dd of _0x18e898){_0x2772e1['set'](_0x2fe9dd['id'],_0x2fe9dd['attributes'][_0x453928(0x289)]);}for(const _0x44c805 of _0x2064aa){_0x364a14['set'](_0x44c805['id'],_0x44c805[_0x453928(0x26a)]['name']);}const _0x560244={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x434f75,'TextKnowledgeBase':_0x33a15c,'Agent':_0x242462,'WebSearchTool':_0x221568,'ImageGenerator':_0x1f3c08,'ExperimentalKnowledgeBase':_0x364a14}),'resolvePromptName':async _0x29c5c1=>_0x2772e1['get'](_0x29c5c1),'onWarning':_0x485914=>this['logger'][_0x453928(0x20d)](_0x485914)},_0x4d6feb={'projectName':_0x8f6bf8,'outputDir':_0x45342f,'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}}},_0x250ae1=[],_0x436583=[];for(const _0x5b78ae of _0x1c6493){const _0x3e3d00=getSanitizedPathWithMigration(_0x45342f,_0x5b78ae[_0x453928(0x26a)][_0x453928(0x289)]);_0x3e3d00[_0x453928(0x1b7)]&&this[_0x453928(0x231)][_0x453928(0x1af)](_0x453928(0x25d)+a148_0x235a2d[_0x453928(0x245)](_0x3e3d00[_0x453928(0x208)])+'\x20→\x20'+a148_0x235a2d['basename'](_0x3e3d00[_0x453928(0x1ab)]));const _0x70a553=_0x3e3d00[_0x453928(0x1ab)],_0x503095=a148_0x235a2d[_0x453928(0x255)](_0x70a553,_0x453928(0x20b)),_0x3af5f3=a148_0x235a2d[_0x453928(0x255)](_0x70a553,_0x453928(0x2b7)),_0x4368ee=a148_0x235a2d['join'](_0x70a553,'starter_message.md'),{yaml:_0x12b96c,systemPrompt:_0x47c9f9,starterMessage:_0x35aba3}=await agentResponseToDef(_0x5b78ae,_0x560244),_0x4815f0=toAgentYamlString(_0x12b96c),_0x2d5d43=!a148_0x5d1e61[_0x453928(0x20e)](_0x3af5f3);let _0x1b8229=_0x2d5d43,_0x5e575d;if(!_0x2d5d43){const _0x48fd1f=a148_0x5d1e61[_0x453928(0x20e)](_0x503095)?a148_0x5d1e61[_0x453928(0x28c)](_0x503095,'utf-8'):'',_0x252639=a148_0x5d1e61[_0x453928(0x28c)](_0x3af5f3,'utf-8'),_0x5a67a7='#\x20prompt.md\x0a'+_0x48fd1f+_0x453928(0x1ef)+_0x252639,_0x39bf19=_0x453928(0x1a2)+_0x47c9f9+'\x0a\x0a#\x20agent.yml\x0a'+_0x4815f0,_0x1fa284=generateDiff(_0x5a67a7,_0x39bf19);_0x1b8229=hasChanges(_0x1fa284),_0x1b8229&&(_0x5e575d=formatDiffWithColors(_0x1fa284));}_0x250ae1[_0x453928(0x1c4)]({'path':_0x70a553,'content':'','isDir':!![]}),_0x250ae1['push']({'path':_0x503095,'content':_0x47c9f9}),_0x250ae1[_0x453928(0x1c4)]({'path':_0x3af5f3,'content':_0x4815f0});_0x35aba3&&_0x35aba3[_0x453928(0x1ee)]('\x0a')&&_0x250ae1['push']({'path':_0x4368ee,'content':_0x35aba3});_0x4d6feb[_0x453928(0x1ed)]['push']({'agentName':_0x5b78ae[_0x453928(0x26a)][_0x453928(0x289)],'outputPath':_0x70a553,'isNew':_0x2d5d43,'hasChanges':_0x1b8229,'diff':_0x5e575d}),_0x4d6feb[_0x453928(0x293)][_0x453928(0x1ed)][_0x453928(0x2a8)]++;if(_0x2d5d43)_0x4d6feb[_0x453928(0x293)]['agents'][_0x453928(0x250)]++;else{if(_0x1b8229)_0x4d6feb[_0x453928(0x293)][_0x453928(0x1ed)][_0x453928(0x284)]++;else _0x4d6feb[_0x453928(0x293)]['agents']['unchanged']++;}}for(const _0x2b8b4f of _0x561aac){if(_0x2b8b4f[_0x453928(0x26a)][_0x453928(0x1fd)])continue;const _0x30eb07=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x45342f),_0x2b8b4f['attributes'][_0x453928(0x289)],'.yml');_0x30eb07[_0x453928(0x1b7)]&&this[_0x453928(0x231)][_0x453928(0x1af)](_0x453928(0x195)+a148_0x235a2d['basename'](_0x30eb07[_0x453928(0x208)])+_0x453928(0x24f)+a148_0x235a2d[_0x453928(0x245)](_0x30eb07[_0x453928(0x1ab)]));const _0x4624ae=_0x30eb07[_0x453928(0x1ab)],_0xb2e46d=apiKnowledgeBaseToYaml(_0x2b8b4f),_0x1f786e=toKnowledgeBaseYamlString(_0xb2e46d),_0x2c5aae=!a148_0x5d1e61[_0x453928(0x20e)](_0x4624ae);let _0x57e859=_0x2c5aae,_0x1338f2;if(!_0x2c5aae){const _0x1cb838=a148_0x5d1e61['readFileSync'](_0x4624ae,_0x453928(0x213)),_0xc2578c=generateDiff(_0x1cb838,_0x1f786e);_0x57e859=hasChanges(_0xc2578c),_0x57e859&&(_0x1338f2=formatDiffWithColors(_0xc2578c));}_0x250ae1[_0x453928(0x1c4)]({'path':_0x4624ae,'content':_0x1f786e}),_0x4d6feb['knowledgeBases'][_0x453928(0x1c4)]({'name':_0x2b8b4f[_0x453928(0x26a)][_0x453928(0x289)],'outputPath':_0x4624ae,'isNew':_0x2c5aae,'hasChanges':_0x57e859,'diff':_0x1338f2}),_0x4d6feb[_0x453928(0x293)][_0x453928(0x1c8)][_0x453928(0x2a8)]++;if(_0x2c5aae)_0x4d6feb['counts'][_0x453928(0x1c8)]['new']++;else{if(_0x57e859)_0x4d6feb[_0x453928(0x293)]['knowledgeBases'][_0x453928(0x284)]++;else _0x4d6feb['counts'][_0x453928(0x1c8)][_0x453928(0x281)]++;}}for(const _0x2c070a of _0x382ac7){if(_0x2c070a[_0x453928(0x26a)][_0x453928(0x1fd)])continue;const _0x5d2bf6=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x45342f),_0x2c070a['attributes'][_0x453928(0x289)],_0x453928(0x24e));_0x5d2bf6[_0x453928(0x1b7)]&&this['logger']['info'](_0x453928(0x26d)+a148_0x235a2d[_0x453928(0x245)](_0x5d2bf6['oldPath'])+_0x453928(0x24f)+a148_0x235a2d['basename'](_0x5d2bf6['path']));const _0x27ecc5=_0x5d2bf6[_0x453928(0x1ab)],_0x880bb5=toTextKnowledgeBaseMd(_0x2c070a[_0x453928(0x26a)][_0x453928(0x289)],_0x2c070a[_0x453928(0x26a)][_0x453928(0x29e)]),_0xb60052=!a148_0x5d1e61[_0x453928(0x20e)](_0x27ecc5);let _0x47c292=_0xb60052,_0x203970;if(!_0xb60052){const _0x47641e=a148_0x5d1e61['readFileSync'](_0x27ecc5,'utf-8'),_0x4ede74=generateDiff(_0x47641e,_0x880bb5);_0x47c292=hasChanges(_0x4ede74),_0x47c292&&(_0x203970=formatDiffWithColors(_0x4ede74));}_0x250ae1['push']({'path':_0x27ecc5,'content':_0x880bb5}),_0x4d6feb[_0x453928(0x20c)][_0x453928(0x1c4)]({'name':_0x2c070a[_0x453928(0x26a)][_0x453928(0x289)],'outputPath':_0x27ecc5,'isNew':_0xb60052,'hasChanges':_0x47c292,'diff':_0x203970}),_0x4d6feb[_0x453928(0x293)][_0x453928(0x20c)][_0x453928(0x2a8)]++;if(_0xb60052)_0x4d6feb[_0x453928(0x293)]['textKnowledgeBases']['new']++;else{if(_0x47c292)_0x4d6feb['counts'][_0x453928(0x20c)][_0x453928(0x284)]++;else _0x4d6feb[_0x453928(0x293)]['textKnowledgeBases'][_0x453928(0x281)]++;}}for(const _0x2ba21f of _0x18e898){if(_0x2ba21f['attributes'][_0x453928(0x1fd)])continue;const _0x276e1f=getSanitizedPathWithMigration(getPromptsDir(_0x45342f),_0x2ba21f[_0x453928(0x26a)][_0x453928(0x289)],'.yml');_0x276e1f[_0x453928(0x1b7)]&&this[_0x453928(0x231)][_0x453928(0x1af)](_0x453928(0x237)+a148_0x235a2d['basename'](_0x276e1f['oldPath'])+_0x453928(0x24f)+a148_0x235a2d['basename'](_0x276e1f[_0x453928(0x1ab)]));const _0x382ea5=_0x276e1f[_0x453928(0x1ab)],_0x4e629b=await apiPromptToYaml(_0x2ba21f,_0x560244);if(!_0x4e629b)continue;const _0x1203f0=toPromptYamlString(_0x4e629b),_0x5ef285=!a148_0x5d1e61['existsSync'](_0x382ea5);let _0x2a798d=_0x5ef285,_0x598a45;if(!_0x5ef285){const _0x1ed4f6=a148_0x5d1e61['readFileSync'](_0x382ea5,_0x453928(0x213)),_0x5e6bd9=generateDiff(_0x1ed4f6,_0x1203f0);_0x2a798d=hasChanges(_0x5e6bd9),_0x2a798d&&(_0x598a45=formatDiffWithColors(_0x5e6bd9));}_0x250ae1['push']({'path':_0x382ea5,'content':_0x1203f0}),_0x4d6feb['prompts']['push']({'name':_0x2ba21f[_0x453928(0x26a)][_0x453928(0x289)],'outputPath':_0x382ea5,'isNew':_0x5ef285,'hasChanges':_0x2a798d,'diff':_0x598a45}),_0x4d6feb['counts']['prompts'][_0x453928(0x2a8)]++;if(_0x5ef285)_0x4d6feb['counts'][_0x453928(0x225)][_0x453928(0x250)]++;else{if(_0x2a798d)_0x4d6feb['counts']['prompts'][_0x453928(0x284)]++;else _0x4d6feb[_0x453928(0x293)][_0x453928(0x225)][_0x453928(0x281)]++;}}for(const _0x9d8296 of _0x4862da){const _0x53dbc6=_0x9d8296[_0x453928(0x26a)][_0x453928(0x20f)][_0x453928(0x2a7)](),_0x421a03=getSanitizedPathWithMigration(getIntegrationsDir(_0x45342f),_0x53dbc6,_0x453928(0x24b));_0x421a03[_0x453928(0x1b7)]&&this[_0x453928(0x231)][_0x453928(0x1af)]('Renamed\x20integration\x20file:\x20'+a148_0x235a2d['basename'](_0x421a03[_0x453928(0x208)])+_0x453928(0x24f)+a148_0x235a2d[_0x453928(0x245)](_0x421a03[_0x453928(0x1ab)]));const _0x4f0a80=_0x421a03[_0x453928(0x1ab)],_0x4887b8=await apiIntegrationToYaml(_0x9d8296,_0x560244),_0x339286=toIntegrationYamlString(_0x4887b8),_0x477d20=!a148_0x5d1e61[_0x453928(0x20e)](_0x4f0a80);let _0x1a66cc=_0x477d20,_0x119a2e;if(!_0x477d20){const _0x1f6ef8=a148_0x5d1e61[_0x453928(0x28c)](_0x4f0a80,_0x453928(0x213)),_0x3e753e=generateDiff(_0x1f6ef8,_0x339286);_0x1a66cc=hasChanges(_0x3e753e),_0x1a66cc&&(_0x119a2e=formatDiffWithColors(_0x3e753e));}_0x250ae1[_0x453928(0x1c4)]({'path':_0x4f0a80,'content':_0x339286}),_0x4d6feb[_0x453928(0x229)][_0x453928(0x1c4)]({'name':_0x53dbc6,'outputPath':_0x4f0a80,'isNew':_0x477d20,'hasChanges':_0x1a66cc,'diff':_0x119a2e}),_0x4d6feb[_0x453928(0x293)]['integrations']['total']++;if(_0x477d20)_0x4d6feb[_0x453928(0x293)]['integrations'][_0x453928(0x250)]++;else{if(_0x1a66cc)_0x4d6feb['counts'][_0x453928(0x229)][_0x453928(0x284)]++;else _0x4d6feb[_0x453928(0x293)]['integrations']['unchanged']++;}}for(const _0x5cd030 of _0x2064aa){if(_0x5cd030[_0x453928(0x26a)][_0x453928(0x1fd)])continue;const _0x6b86f2=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x45342f),_0x5cd030[_0x453928(0x26a)][_0x453928(0x289)]);_0x6b86f2[_0x453928(0x1b7)]&&this[_0x453928(0x231)][_0x453928(0x1af)]('Renamed\x20experimental\x20KB\x20directory:\x20'+a148_0x235a2d[_0x453928(0x245)](_0x6b86f2['oldPath'])+_0x453928(0x24f)+a148_0x235a2d['basename'](_0x6b86f2[_0x453928(0x1ab)]));const _0x3f2b7f=_0x6b86f2[_0x453928(0x1ab)],_0x46c88c=a148_0x235a2d[_0x453928(0x255)](_0x3f2b7f,sanitizeForFilesystem(_0x5cd030[_0x453928(0x26a)][_0x453928(0x289)])+'.yml'),_0x41712a=a148_0x235a2d[_0x453928(0x255)](_0x3f2b7f,_0x453928(0x207)),_0x383f76=apiExperimentalKnowledgeBaseToYaml(_0x5cd030),_0x1d3700=toExperimentalKnowledgeBaseYamlString(_0x383f76),_0x5aadd5=!a148_0x5d1e61[_0x453928(0x20e)](_0x3f2b7f);let _0xc90233=_0x5aadd5,_0xbbfd2d,_0x17524e=_0x1d3700;const _0x2c0ef4=[..._0x383f76[_0x453928(0x207)]]['sort']((_0xe93079,_0x3ee34d)=>_0xe93079[_0x453928(0x289)][_0x453928(0x1c5)](_0x3ee34d[_0x453928(0x289)]));for(const _0x2524a0 of _0x2c0ef4){_0x17524e+=_0x453928(0x2a3)+_0x2524a0['name']+_0x453928(0x22a)+_0x2524a0[_0x453928(0x2b4)]+_0x453928(0x1df)+_0x2524a0[_0x453928(0x289)]+_0x453928(0x22a)+_0x2524a0[_0x453928(0x21a)]+'\x0a';}if(!_0x5aadd5){let _0x195bee='';a148_0x5d1e61[_0x453928(0x20e)](_0x46c88c)&&(_0x195bee=a148_0x5d1e61[_0x453928(0x28c)](_0x46c88c,_0x453928(0x213)));if(a148_0x5d1e61[_0x453928(0x20e)](_0x41712a)){const _0x41431c=a148_0x5d1e61[_0x453928(0x196)](_0x41712a,{'withFileTypes':!![]}),_0x452e6d=_0x41431c['filter'](_0x13f13d=>_0x13f13d[_0x453928(0x1c2)]())[_0x453928(0x296)]((_0xa868c8,_0x1599ce)=>_0xa868c8['name'][_0x453928(0x1c5)](_0x1599ce[_0x453928(0x289)]));for(const _0xcf1950 of _0x452e6d){const _0x5949a5=a148_0x235a2d[_0x453928(0x255)](_0x41712a,_0xcf1950[_0x453928(0x289)],_0x453928(0x244)),_0x273fd1=a148_0x235a2d[_0x453928(0x255)](_0x41712a,_0xcf1950[_0x453928(0x289)],_0x453928(0x219));a148_0x5d1e61['existsSync'](_0x5949a5)&&(_0x195bee+=_0x453928(0x2a3)+_0xcf1950[_0x453928(0x289)]+_0x453928(0x22a)+a148_0x5d1e61['readFileSync'](_0x5949a5,'utf-8')+'\x0a'),a148_0x5d1e61['existsSync'](_0x273fd1)&&(_0x195bee+=_0x453928(0x1f1)+_0xcf1950[_0x453928(0x289)]+_0x453928(0x22a)+a148_0x5d1e61[_0x453928(0x28c)](_0x273fd1,_0x453928(0x213))+'\x0a');}}const _0x5a1802=generateDiff(_0x195bee,_0x17524e);_0xc90233=hasChanges(_0x5a1802),_0xc90233&&(_0xbbfd2d=formatDiffWithColors(_0x5a1802));}_0x250ae1[_0x453928(0x1c4)]({'path':_0x3f2b7f,'content':'','isDir':!![]}),_0x250ae1[_0x453928(0x1c4)]({'path':_0x46c88c,'content':_0x1d3700}),_0x250ae1[_0x453928(0x1c4)]({'path':_0x41712a,'content':'','isDir':!![]});for(const _0x660437 of _0x383f76[_0x453928(0x207)]){const _0x53b9cb=a148_0x235a2d['join'](_0x41712a,sanitizeForFilesystem(_0x660437[_0x453928(0x289)])),_0x8c36d1=a148_0x235a2d[_0x453928(0x255)](_0x53b9cb,'code.js'),_0xd27c0=a148_0x235a2d[_0x453928(0x255)](_0x53b9cb,'json_schema.json');_0x250ae1['push']({'path':_0x53b9cb,'content':'','isDir':!![]}),_0x250ae1[_0x453928(0x1c4)]({'path':_0x8c36d1,'content':_0x660437['code']}),_0x250ae1['push']({'path':_0xd27c0,'content':_0x660437['json_schema']});}if(a148_0x5d1e61[_0x453928(0x20e)](_0x41712a)){const _0x37d505=a148_0x5d1e61['readdirSync'](_0x41712a,{'withFileTypes':!![]}),_0x2b298c=new Set(_0x383f76['functions'][_0x453928(0x241)](_0x27b33c=>sanitizeForFilesystem(_0x27b33c[_0x453928(0x289)])));for(const _0x56f60e of _0x37d505){if(_0x56f60e['isDirectory']()&&!_0x2b298c[_0x453928(0x2a0)](_0x56f60e['name'])){const _0x1971d8=a148_0x235a2d[_0x453928(0x255)](_0x41712a,_0x56f60e[_0x453928(0x289)]);_0x436583[_0x453928(0x1c4)]({'path':_0x1971d8,'isDir':!![]});}}}_0x4d6feb[_0x453928(0x1cd)][_0x453928(0x1c4)]({'name':_0x5cd030[_0x453928(0x26a)][_0x453928(0x289)],'outputPath':_0x3f2b7f,'isNew':_0x5aadd5,'hasChanges':_0xc90233,'diff':_0xbbfd2d}),_0x4d6feb[_0x453928(0x293)][_0x453928(0x1cd)]['total']++;if(_0x5aadd5)_0x4d6feb[_0x453928(0x293)]['experimentalKnowledgeBases'][_0x453928(0x250)]++;else{if(_0xc90233)_0x4d6feb['counts'][_0x453928(0x1cd)][_0x453928(0x284)]++;else _0x4d6feb[_0x453928(0x293)]['experimentalKnowledgeBases'][_0x453928(0x281)]++;}}for(const _0x4112f5 of _0x149df1){if(_0x4112f5[_0x453928(0x26a)]['isManaged'])continue;const _0x4faafd=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x45342f),_0x4112f5[_0x453928(0x26a)]['name']);_0x4faafd[_0x453928(0x1b7)]&&this[_0x453928(0x231)][_0x453928(0x1af)]('Renamed\x20experimental\x20artifact\x20directory:\x20'+a148_0x235a2d[_0x453928(0x245)](_0x4faafd[_0x453928(0x208)])+_0x453928(0x24f)+a148_0x235a2d['basename'](_0x4faafd[_0x453928(0x1ab)]));const _0x19b7af=_0x4faafd[_0x453928(0x1ab)],_0x114fbf=a148_0x235a2d[_0x453928(0x255)](_0x19b7af,sanitizeForFilesystem(_0x4112f5[_0x453928(0x26a)][_0x453928(0x289)])+_0x453928(0x24b)),_0x40b93d=a148_0x235a2d[_0x453928(0x255)](_0x19b7af,_0x453928(0x244)),_0x3bda5a=a148_0x235a2d['join'](_0x19b7af,_0x453928(0x1b6)),_0x17f904=apiExperimentalArtifactToYaml(_0x4112f5),_0x1d9ef6=toExperimentalArtifactYamlString(_0x17f904),_0x3bf90a=!a148_0x5d1e61['existsSync'](_0x19b7af);let _0x548d9f=_0x3bf90a,_0x3d86d7,_0x2eaed7=_0x1d9ef6+('\x0a---\x20code\x20---\x0a'+_0x17f904[_0x453928(0x2b4)]+'\x0a');const _0x296915=[..._0x17f904[_0x453928(0x1b6)]]['sort']((_0x3d811d,_0x3909cf)=>_0x3d811d[_0x453928(0x22d)][_0x453928(0x1c5)](_0x3909cf[_0x453928(0x22d)]));for(const _0x366024 of _0x296915){_0x2eaed7+=_0x453928(0x25e)+_0x366024[_0x453928(0x22d)]+_0x453928(0x22a)+_0x366024[_0x453928(0x25c)]+'\x0a';}if(!_0x3bf90a){let _0x169902='';a148_0x5d1e61[_0x453928(0x20e)](_0x114fbf)&&(_0x169902=a148_0x5d1e61[_0x453928(0x28c)](_0x114fbf,_0x453928(0x213)));a148_0x5d1e61['existsSync'](_0x40b93d)&&(_0x169902+=_0x453928(0x2ad)+a148_0x5d1e61['readFileSync'](_0x40b93d,_0x453928(0x213))+'\x0a');if(a148_0x5d1e61[_0x453928(0x20e)](_0x3bda5a)){const _0x4f86ac=a148_0x5d1e61[_0x453928(0x196)](_0x3bda5a),_0x39b4e7=_0x4f86ac[_0x453928(0x1ca)](_0x1d6230=>{const _0x301dd6=_0x453928,_0x5b1aaf=a148_0x235a2d[_0x301dd6(0x255)](_0x3bda5a,_0x1d6230);return a148_0x5d1e61[_0x301dd6(0x1b1)](_0x5b1aaf)['isFile']();})[_0x453928(0x296)]((_0x162c06,_0x2bf1a8)=>_0x162c06[_0x453928(0x1c5)](_0x2bf1a8));for(const _0x1e3e5a of _0x39b4e7){const _0x3f98dd=a148_0x235a2d[_0x453928(0x255)](_0x3bda5a,_0x1e3e5a);_0x169902+=_0x453928(0x25e)+_0x1e3e5a+'\x20---\x0a'+a148_0x5d1e61[_0x453928(0x28c)](_0x3f98dd,_0x453928(0x213))+'\x0a';}}const _0x52ceea=generateDiff(_0x169902,_0x2eaed7);_0x548d9f=hasChanges(_0x52ceea),_0x548d9f&&(_0x3d86d7=formatDiffWithColors(_0x52ceea));}_0x250ae1[_0x453928(0x1c4)]({'path':_0x19b7af,'content':'','isDir':!![]}),_0x250ae1[_0x453928(0x1c4)]({'path':_0x114fbf,'content':_0x1d9ef6}),_0x250ae1[_0x453928(0x1c4)]({'path':_0x40b93d,'content':_0x17f904[_0x453928(0x2b4)]});if(_0x17f904['files'][_0x453928(0x1a9)]>0x0){_0x250ae1['push']({'path':_0x3bda5a,'content':'','isDir':!![]});for(const _0x2cebb5 of _0x17f904[_0x453928(0x1b6)]){const _0x4dbe57=a148_0x235a2d[_0x453928(0x255)](_0x3bda5a,_0x2cebb5[_0x453928(0x22d)]);_0x250ae1['push']({'path':_0x4dbe57,'content':_0x2cebb5[_0x453928(0x25c)]});}}if(a148_0x5d1e61[_0x453928(0x20e)](_0x3bda5a)){const _0x1e2ee4=a148_0x5d1e61[_0x453928(0x196)](_0x3bda5a),_0x3ac98f=new Set(_0x17f904[_0x453928(0x1b6)][_0x453928(0x241)](_0x2c6b93=>_0x2c6b93[_0x453928(0x22d)]));for(const _0x376b4a of _0x1e2ee4){const _0x335941=a148_0x235a2d[_0x453928(0x255)](_0x3bda5a,_0x376b4a);a148_0x5d1e61[_0x453928(0x1b1)](_0x335941)[_0x453928(0x1bd)]()&&!_0x3ac98f['has'](_0x376b4a)&&_0x436583['push']({'path':_0x335941});}}_0x4d6feb[_0x453928(0x1f0)][_0x453928(0x1c4)]({'name':_0x4112f5[_0x453928(0x26a)]['name'],'outputPath':_0x19b7af,'isNew':_0x3bf90a,'hasChanges':_0x548d9f,'diff':_0x3d86d7}),_0x4d6feb['counts'][_0x453928(0x1f0)][_0x453928(0x2a8)]++;if(_0x3bf90a)_0x4d6feb[_0x453928(0x293)][_0x453928(0x1f0)][_0x453928(0x250)]++;else{if(_0x548d9f)_0x4d6feb['counts'][_0x453928(0x1f0)][_0x453928(0x284)]++;else _0x4d6feb[_0x453928(0x293)][_0x453928(0x1f0)]['unchanged']++;}}for(const _0x311385 of _0x387269){const _0xd11acd=getSanitizedPathWithMigration(getFormInterfacesDir(_0x45342f),_0x311385[_0x453928(0x26a)][_0x453928(0x289)],_0x453928(0x24b));_0xd11acd[_0x453928(0x1b7)]&&this[_0x453928(0x231)][_0x453928(0x1af)](_0x453928(0x24d)+a148_0x235a2d[_0x453928(0x245)](_0xd11acd[_0x453928(0x208)])+'\x20→\x20'+a148_0x235a2d[_0x453928(0x245)](_0xd11acd['path']));const _0x4a9f3b=_0xd11acd[_0x453928(0x1ab)],_0x253616=await apiFormInterfaceToYaml(_0x311385,_0x560244),_0x5a6419=toFormInterfaceYamlString(_0x253616),_0x4c9fe8=!a148_0x5d1e61['existsSync'](_0x4a9f3b);let _0x19a56e=_0x4c9fe8,_0x44c467;if(!_0x4c9fe8){const _0x30ecf9=a148_0x5d1e61[_0x453928(0x28c)](_0x4a9f3b,'utf-8'),_0x517b45=generateDiff(_0x30ecf9,_0x5a6419);_0x19a56e=hasChanges(_0x517b45),_0x19a56e&&(_0x44c467=formatDiffWithColors(_0x517b45));}_0x250ae1[_0x453928(0x1c4)]({'path':_0x4a9f3b,'content':_0x5a6419}),_0x4d6feb[_0x453928(0x247)][_0x453928(0x1c4)]({'name':_0x311385[_0x453928(0x26a)][_0x453928(0x289)],'outputPath':_0x4a9f3b,'isNew':_0x4c9fe8,'hasChanges':_0x19a56e,'diff':_0x44c467}),_0x4d6feb[_0x453928(0x293)][_0x453928(0x247)][_0x453928(0x2a8)]++;if(_0x4c9fe8)_0x4d6feb[_0x453928(0x293)][_0x453928(0x247)][_0x453928(0x250)]++;else{if(_0x19a56e)_0x4d6feb[_0x453928(0x293)][_0x453928(0x247)]['updated']++;else _0x4d6feb[_0x453928(0x293)][_0x453928(0x247)]['unchanged']++;}}for(const _0x4c5389 of _0xaa3943){if(_0x4c5389[_0x453928(0x26a)]['isManaged'])continue;const _0x390c06=getSanitizedPathWithMigration(getChatInterfacesDir(_0x45342f),_0x4c5389[_0x453928(0x26a)]['name'],_0x453928(0x24b));_0x390c06[_0x453928(0x1b7)]&&this['logger'][_0x453928(0x1af)](_0x453928(0x260)+a148_0x235a2d[_0x453928(0x245)](_0x390c06[_0x453928(0x208)])+_0x453928(0x24f)+a148_0x235a2d[_0x453928(0x245)](_0x390c06[_0x453928(0x1ab)]));const _0x557ca2=_0x390c06[_0x453928(0x1ab)],_0x34d83d=await apiChatInterfaceToYaml(_0x4c5389,_0x560244),_0x2dee69=toChatInterfaceYamlString(_0x34d83d),_0x10e6a7=!a148_0x5d1e61[_0x453928(0x20e)](_0x557ca2);let _0x1a76c0=_0x10e6a7,_0xb36589;if(!_0x10e6a7){const _0x201db5=a148_0x5d1e61[_0x453928(0x28c)](_0x557ca2,_0x453928(0x213)),_0x54374a=generateDiff(_0x201db5,_0x2dee69);_0x1a76c0=hasChanges(_0x54374a),_0x1a76c0&&(_0xb36589=formatDiffWithColors(_0x54374a));}_0x250ae1[_0x453928(0x1c4)]({'path':_0x557ca2,'content':_0x2dee69}),_0x4d6feb['chatInterfaces'][_0x453928(0x1c4)]({'name':_0x4c5389[_0x453928(0x26a)]['name'],'outputPath':_0x557ca2,'isNew':_0x10e6a7,'hasChanges':_0x1a76c0,'diff':_0xb36589}),_0x4d6feb['counts'][_0x453928(0x27c)][_0x453928(0x2a8)]++;if(_0x10e6a7)_0x4d6feb[_0x453928(0x293)][_0x453928(0x27c)][_0x453928(0x250)]++;else{if(_0x1a76c0)_0x4d6feb['counts'][_0x453928(0x27c)][_0x453928(0x284)]++;else _0x4d6feb[_0x453928(0x293)][_0x453928(0x27c)][_0x453928(0x281)]++;}}if(_0x2dd8a6?.[_0x453928(0x1d3)])return _0x4d6feb;a148_0x5d1e61[_0x453928(0x259)](_0x45342f,{'recursive':!![]}),a148_0x5d1e61[_0x453928(0x259)](getKnowledgeBasesDir(_0x45342f),{'recursive':!![]}),a148_0x5d1e61['mkdirSync'](getPromptsDir(_0x45342f),{'recursive':!![]}),a148_0x5d1e61[_0x453928(0x259)](getIntegrationsDir(_0x45342f),{'recursive':!![]}),a148_0x5d1e61[_0x453928(0x259)](getExperimentalKnowledgeBasesDir(_0x45342f),{'recursive':!![]}),a148_0x5d1e61['mkdirSync'](getExperimentalArtifactsDir(_0x45342f),{'recursive':!![]}),a148_0x5d1e61[_0x453928(0x259)](getFormInterfacesDir(_0x45342f),{'recursive':!![]}),a148_0x5d1e61[_0x453928(0x259)](getChatInterfacesDir(_0x45342f),{'recursive':!![]});const _0x2cba2c=a148_0x235a2d[_0x453928(0x255)](_0x45342f,_0x453928(0x274));a148_0x5d1e61['writeFileSync'](_0x2cba2c,createAgentConfigContent(_0x8f6bf8));for(const _0x45c26e of _0x250ae1){if(_0x45c26e['isDir'])a148_0x5d1e61[_0x453928(0x259)](_0x45c26e[_0x453928(0x1ab)],{'recursive':!![]});else{const _0x3befc2=a148_0x235a2d[_0x453928(0x1c0)](_0x45c26e[_0x453928(0x1ab)]);!a148_0x5d1e61['existsSync'](_0x3befc2)&&a148_0x5d1e61[_0x453928(0x259)](_0x3befc2,{'recursive':!![]}),a148_0x5d1e61[_0x453928(0x26e)](_0x45c26e[_0x453928(0x1ab)],_0x45c26e[_0x453928(0x1e7)]);}}for(const _0x5d9681 of _0x436583){_0x5d9681[_0x453928(0x19d)]?(a148_0x5d1e61[_0x453928(0x269)](_0x5d9681['path'],{'recursive':!![],'force':!![]}),this[_0x453928(0x231)][_0x453928(0x1af)](_0x453928(0x275)+a148_0x235a2d[_0x453928(0x245)](a148_0x235a2d['dirname'](_0x5d9681['path']))+'/'+a148_0x235a2d[_0x453928(0x245)](_0x5d9681['path']))):(a148_0x5d1e61[_0x453928(0x269)](_0x5d9681[_0x453928(0x1ab)],{'force':!![]}),this['logger'][_0x453928(0x1af)](_0x453928(0x268)+a148_0x235a2d['basename'](a148_0x235a2d['dirname'](_0x5d9681[_0x453928(0x1ab)]))+'/'+a148_0x235a2d[_0x453928(0x245)](_0x5d9681[_0x453928(0x1ab)])));}return _0x4d6feb;}async['pushProject'](_0x51be54,_0x48cb93){const _0x3501de=a148_0x3ff51f,_0x2b150b=a148_0x235a2d['join'](_0x51be54,_0x3501de(0x274));if(!a148_0x5d1e61[_0x3501de(0x20e)](_0x2b150b))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'No\x20tdx.json\x20found\x20in\x20'+_0x51be54,undefined,{'helpText':_0x3501de(0x239)});const _0xb3b1b4=loadAgentConfig(_0x2b150b),_0x266522=await this[_0x3501de(0x2ae)](_0xb3b1b4[_0x3501de(0x1fe)]),_0x4a0dfb=await this['client'][_0x3501de(0x2a6)](_0x266522),_0x115f77=_0x4a0dfb['attributes'][_0x3501de(0x289)],_0x52409e={'projectName':_0x115f77,'projectId':_0x266522,'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}}},_0x1a4756=[],_0xb8f4d0=[],_0x50f10f=[],_0x3cb618=[],_0x39bf5f=[],_0x5742b0=[],_0x4c8924=a148_0x5d1e61[_0x3501de(0x196)](_0x51be54,{'withFileTypes':!![]});for(const _0x5503c8 of _0x4c8924){if(!_0x5503c8[_0x3501de(0x1c2)]())continue;if([_0x3501de(0x200),_0x3501de(0x225),'integrations','experimental_knowledge_bases',_0x3501de(0x248),'form_interfaces',_0x3501de(0x261)][_0x3501de(0x1ee)](_0x5503c8[_0x3501de(0x289)]))continue;const _0x6c6497=a148_0x235a2d['join'](_0x51be54,_0x5503c8[_0x3501de(0x289)]);if(isAgentDir(_0x6c6497)){const _0x543a35=a148_0x235a2d[_0x3501de(0x255)](_0x6c6497,_0x3501de(0x2b7)),_0x921cad=a148_0x235a2d['join'](_0x6c6497,_0x3501de(0x20b)),_0x84a47=a148_0x235a2d[_0x3501de(0x255)](_0x6c6497,_0x3501de(0x1e0)),_0x280a0c=parseAgentYaml(a148_0x5d1e61['readFileSync'](_0x543a35,_0x3501de(0x213)),_0x543a35),_0x452854=a148_0x5d1e61[_0x3501de(0x20e)](_0x921cad)?a148_0x5d1e61['readFileSync'](_0x921cad,_0x3501de(0x213)):'',_0x296d41=a148_0x5d1e61['existsSync'](_0x84a47)?a148_0x5d1e61['readFileSync'](_0x84a47,_0x3501de(0x213)):_0x280a0c[_0x3501de(0x1c1)];_0x1a4756['push']({'name':_0x280a0c['name'],'dir':_0x6c6497,'yaml':_0x280a0c,'systemPrompt':_0x452854,'starterMessage':_0x296d41});}}const _0x3ba62c=getKnowledgeBasesDir(_0x51be54);if(a148_0x5d1e61[_0x3501de(0x20e)](_0x3ba62c)){const _0x199dc6=a148_0x5d1e61[_0x3501de(0x196)](_0x3ba62c);for(const _0x494f81 of _0x199dc6){const _0x4cb233=a148_0x235a2d[_0x3501de(0x255)](_0x3ba62c,_0x494f81);if(_0x494f81[_0x3501de(0x29f)]('.yml')){const _0x143a58=parseKnowledgeBaseYaml(a148_0x5d1e61['readFileSync'](_0x4cb233,_0x3501de(0x213)),_0x4cb233);_0xb8f4d0[_0x3501de(0x1c4)]({'name':_0x143a58[_0x3501de(0x289)],'path':_0x4cb233,'yaml':_0x143a58});}else{if(_0x494f81[_0x3501de(0x29f)](_0x3501de(0x24e))){const _0x3adae9=a148_0x5d1e61[_0x3501de(0x28c)](_0x4cb233,_0x3501de(0x213)),{name:_0x1d5f68,text:_0xaaf0b0}=parseTextKnowledgeBaseMd(_0x3adae9,_0x494f81);_0x50f10f['push']({'name':_0x1d5f68,'path':_0x4cb233,'text':_0xaaf0b0});}}}}const _0x4ff982=getPromptsDir(_0x51be54);if(a148_0x5d1e61[_0x3501de(0x20e)](_0x4ff982)){const _0x37b237=a148_0x5d1e61[_0x3501de(0x196)](_0x4ff982)['filter'](_0x39efee=>_0x39efee[_0x3501de(0x29f)]('.yml'));for(const _0x313069 of _0x37b237){const _0x254f0b=a148_0x235a2d['join'](_0x4ff982,_0x313069),_0x2e8de9=parsePromptYaml(a148_0x5d1e61[_0x3501de(0x28c)](_0x254f0b,_0x3501de(0x213)),_0x254f0b);_0x3cb618[_0x3501de(0x1c4)]({'name':_0x2e8de9[_0x3501de(0x289)],'path':_0x254f0b,'yaml':_0x2e8de9});}}const _0x4c8c3f=[],_0x129936=getIntegrationsDir(_0x51be54);if(a148_0x5d1e61[_0x3501de(0x20e)](_0x129936)){const _0x4bd847=a148_0x5d1e61[_0x3501de(0x196)](_0x129936)['filter'](_0x2f04e9=>_0x2f04e9[_0x3501de(0x29f)](_0x3501de(0x24b)));for(const _0x50d9bb of _0x4bd847){const _0xcc9e42=a148_0x235a2d[_0x3501de(0x255)](_0x129936,_0x50d9bb),_0x335b77=parseIntegrationYaml(a148_0x5d1e61[_0x3501de(0x28c)](_0xcc9e42,_0x3501de(0x213)),_0xcc9e42);if(!SAFE_INTEGRATION_TYPES[_0x3501de(0x1ee)](_0x335b77[_0x3501de(0x283)]['toLowerCase']())){this[_0x3501de(0x231)][_0x3501de(0x20d)]('Skipping\x20integration\x20\x27'+_0x335b77['name']+_0x3501de(0x27e)+_0x335b77[_0x3501de(0x283)]+_0x3501de(0x23e)+(_0x3501de(0x279)+SAFE_INTEGRATION_TYPES[_0x3501de(0x255)](',\x20')+_0x3501de(0x198))+_0x3501de(0x193));continue;}_0x4c8c3f['push']({'name':_0x335b77[_0x3501de(0x289)],'path':_0xcc9e42,'yaml':_0x335b77});}}const _0x22aef1=getExperimentalKnowledgeBasesDir(_0x51be54);if(a148_0x5d1e61[_0x3501de(0x20e)](_0x22aef1)){const _0x857683=a148_0x5d1e61['readdirSync'](_0x22aef1,{'withFileTypes':!![]});for(const _0x47c980 of _0x857683){if(!_0x47c980['isDirectory']())continue;const _0x2402f7=a148_0x235a2d[_0x3501de(0x255)](_0x22aef1,_0x47c980[_0x3501de(0x289)]),_0xb18ef7=a148_0x235a2d[_0x3501de(0x255)](_0x2402f7,_0x47c980['name']+_0x3501de(0x24b)),_0x289767=a148_0x235a2d[_0x3501de(0x255)](_0x2402f7,_0x3501de(0x207));if(!a148_0x5d1e61['existsSync'](_0xb18ef7))continue;const _0x14b5b1=parseExperimentalKnowledgeBaseYaml(a148_0x5d1e61['readFileSync'](_0xb18ef7,_0x3501de(0x213)),_0xb18ef7),_0x571407=[];if(a148_0x5d1e61[_0x3501de(0x20e)](_0x289767)){const _0x356c90=a148_0x5d1e61[_0x3501de(0x196)](_0x289767,{'withFileTypes':!![]});for(const _0x509bff of _0x356c90){if(!_0x509bff[_0x3501de(0x1c2)]())continue;const _0x1cf763=a148_0x235a2d[_0x3501de(0x255)](_0x289767,_0x509bff[_0x3501de(0x289)]),_0x110a67=a148_0x235a2d[_0x3501de(0x255)](_0x1cf763,_0x3501de(0x244)),_0x1609b6=a148_0x235a2d[_0x3501de(0x255)](_0x1cf763,_0x3501de(0x219));a148_0x5d1e61[_0x3501de(0x20e)](_0x110a67)&&a148_0x5d1e61[_0x3501de(0x20e)](_0x1609b6)&&_0x571407[_0x3501de(0x1c4)]({'name':_0x509bff[_0x3501de(0x289)],'code':a148_0x5d1e61['readFileSync'](_0x110a67,'utf-8'),'json_schema':a148_0x5d1e61[_0x3501de(0x28c)](_0x1609b6,_0x3501de(0x213))});}}const _0x184876={..._0x14b5b1,'variables':_0x14b5b1[_0x3501de(0x1d2)]||[],'functions':_0x571407};_0x39bf5f[_0x3501de(0x1c4)]({'name':_0x14b5b1[_0x3501de(0x289)],'dir':_0x2402f7,'def':_0x184876});}}const _0x581934=getExperimentalArtifactsDir(_0x51be54);if(a148_0x5d1e61[_0x3501de(0x20e)](_0x581934)){const _0x2f6847=a148_0x5d1e61[_0x3501de(0x196)](_0x581934,{'withFileTypes':!![]});for(const _0x3eac26 of _0x2f6847){if(!_0x3eac26[_0x3501de(0x1c2)]())continue;const _0x34d442=a148_0x235a2d[_0x3501de(0x255)](_0x581934,_0x3eac26['name']),_0xd325a0=a148_0x235a2d['join'](_0x34d442,_0x3eac26[_0x3501de(0x289)]+_0x3501de(0x24b)),_0xf8e61d=a148_0x235a2d['join'](_0x34d442,_0x3501de(0x244)),_0x15db61=a148_0x235a2d[_0x3501de(0x255)](_0x34d442,_0x3501de(0x1b6));if(!a148_0x5d1e61[_0x3501de(0x20e)](_0xd325a0)||!a148_0x5d1e61['existsSync'](_0xf8e61d))continue;const _0x26aebf=parseExperimentalArtifactYaml(a148_0x5d1e61['readFileSync'](_0xd325a0,'utf-8'),_0xd325a0),_0x58e748=a148_0x5d1e61[_0x3501de(0x28c)](_0xf8e61d,_0x3501de(0x213)),_0x59783c=[];if(a148_0x5d1e61['existsSync'](_0x15db61)){const _0xbc1923=a148_0x5d1e61['readdirSync'](_0x15db61);for(const _0x4e84e6 of _0xbc1923){const _0x3b7b73=a148_0x235a2d[_0x3501de(0x255)](_0x15db61,_0x4e84e6);a148_0x5d1e61['statSync'](_0x3b7b73)[_0x3501de(0x1bd)]()&&_0x59783c[_0x3501de(0x1c4)]({'file_name':_0x4e84e6,'text_content':a148_0x5d1e61[_0x3501de(0x28c)](_0x3b7b73,_0x3501de(0x213))});}}const _0x5ce38c={..._0x26aebf,'code':_0x58e748,'files':_0x59783c};_0x5742b0['push']({'name':_0x26aebf['name'],'dir':_0x34d442,'def':_0x5ce38c});}}const _0x14916a=[],_0x47a3c0=getFormInterfacesDir(_0x51be54);if(a148_0x5d1e61[_0x3501de(0x20e)](_0x47a3c0)){const _0x2e27c6=a148_0x5d1e61[_0x3501de(0x196)](_0x47a3c0)[_0x3501de(0x1ca)](_0x157f3b=>_0x157f3b[_0x3501de(0x29f)](_0x3501de(0x24b)));for(const _0x5c72e2 of _0x2e27c6){const _0x4e9fe2=a148_0x235a2d[_0x3501de(0x255)](_0x47a3c0,_0x5c72e2),_0x40430e=parseFormInterfaceYaml(a148_0x5d1e61[_0x3501de(0x28c)](_0x4e9fe2,_0x3501de(0x213)),_0x4e9fe2);_0x14916a['push']({'name':_0x40430e[_0x3501de(0x289)],'path':_0x4e9fe2,'yaml':_0x40430e});}}const _0x1d70b6=[],_0x355665=getChatInterfacesDir(_0x51be54);if(a148_0x5d1e61[_0x3501de(0x20e)](_0x355665)){const _0x509dc0=a148_0x5d1e61[_0x3501de(0x196)](_0x355665)[_0x3501de(0x1ca)](_0x4a3f05=>_0x4a3f05[_0x3501de(0x29f)](_0x3501de(0x24b)));for(const _0x321c35 of _0x509dc0){const _0x2c68e8=a148_0x235a2d[_0x3501de(0x255)](_0x355665,_0x321c35),_0x4e7eef=parseChatInterfaceYaml(a148_0x5d1e61['readFileSync'](_0x2c68e8,_0x3501de(0x213)),_0x2c68e8);_0x1d70b6[_0x3501de(0x1c4)]({'name':_0x4e7eef[_0x3501de(0x289)],'path':_0x2c68e8,'yaml':_0x4e7eef});}}const _0x397947=await this[_0x3501de(0x215)][_0x3501de(0x217)](_0x266522),_0x13d163=await this[_0x3501de(0x215)][_0x3501de(0x251)](_0x266522),_0x52b788=await this['client']['listTextKnowledgeBases'](_0x266522),_0x5b3a1d=await this[_0x3501de(0x215)][_0x3501de(0x249)](_0x266522),_0x36b210=await this['client'][_0x3501de(0x1e1)](_0x266522),_0x4022e1=await safeListOrEmpty(()=>this[_0x3501de(0x215)][_0x3501de(0x262)](_0x266522)),_0x56f50f=await safeListOrEmpty(()=>this[_0x3501de(0x215)][_0x3501de(0x1e8)](_0x266522)),_0x14beb8=await safeListOrEmpty(()=>this[_0x3501de(0x215)][_0x3501de(0x1f8)](_0x266522)),_0xf22d74=await safeListOrEmpty(()=>this[_0x3501de(0x215)]['listChatInterfaces'](_0x266522)),_0x4f5857=await fetchAllToolTargetMaps((_0x10a118,_0x547544)=>this[_0x3501de(0x215)]['listToolTargets'](_0x10a118,_0x547544),_0x266522),_0x3a6b08=new Map(),_0x59161f=new Map(),_0xdc68b7=new Map(),_0x543e64=new Map(),_0x14d057=new Map(),_0x5beb24=new Map(),_0x2248ee=new Map();for(const _0x32d836 of _0x397947){_0x3a6b08[_0x3501de(0x24c)](_0x32d836[_0x3501de(0x26a)][_0x3501de(0x289)],_0x32d836);}for(const _0x4d59b4 of _0x13d163){_0x59161f[_0x3501de(0x24c)](_0x4d59b4[_0x3501de(0x26a)][_0x3501de(0x289)],_0x4d59b4);}for(const _0x47136a of _0x52b788){_0xdc68b7[_0x3501de(0x24c)](_0x47136a[_0x3501de(0x26a)]['name'],_0x47136a);}for(const _0x3b93ec of _0x5b3a1d){_0x543e64[_0x3501de(0x24c)](_0x3b93ec[_0x3501de(0x26a)][_0x3501de(0x289)],_0x3b93ec);}for(const _0x1c4c25 of _0x36b210){_0x14d057[_0x3501de(0x24c)](_0x1c4c25[_0x3501de(0x26a)][_0x3501de(0x20f)][_0x3501de(0x2a7)](),_0x1c4c25);}for(const _0x2cec2c of _0x4022e1){_0x5beb24[_0x3501de(0x24c)](_0x2cec2c[_0x3501de(0x26a)]['name'],_0x2cec2c);}for(const _0x10f3fc of _0x56f50f){_0x2248ee[_0x3501de(0x24c)](_0x10f3fc[_0x3501de(0x26a)][_0x3501de(0x289)],_0x10f3fc);}const _0xf7a4c6=new Map(),_0x38a03b=new Map();for(const _0x419a78 of _0x14beb8){_0xf7a4c6['set'](_0x419a78[_0x3501de(0x26a)][_0x3501de(0x289)],_0x419a78);}for(const _0x280d5a of _0xf22d74){_0x38a03b[_0x3501de(0x24c)](_0x280d5a[_0x3501de(0x26a)][_0x3501de(0x289)],_0x280d5a);}const _0x55b19b=new Map(),_0x180a2a=new Map();for(const _0x1e034f of _0x397947){_0x55b19b[_0x3501de(0x24c)](_0x1e034f[_0x3501de(0x26a)][_0x3501de(0x289)],_0x1e034f['id']),_0x180a2a['set'](_0x1e034f['id'],_0x1e034f[_0x3501de(0x26a)][_0x3501de(0x289)]);}const _0x3134f8=new Map(),_0x2ec1c6=new Map();for(const _0x9ef593 of _0x5b3a1d){_0x3134f8['set'](_0x9ef593[_0x3501de(0x26a)][_0x3501de(0x289)],_0x9ef593['id']),_0x2ec1c6['set'](_0x9ef593['id'],_0x9ef593[_0x3501de(0x26a)][_0x3501de(0x289)]);}const _0x4acb4c=_0x4f5857[_0x3501de(0x2a4)][_0x3501de(0x1eb)]||new Map(),_0x192e50=_0x4f5857['nameToId'][_0x3501de(0x2b5)]||new Map(),_0x551e28=_0x4f5857[_0x3501de(0x2a4)][_0x3501de(0x1d6)]||new Map(),_0xb99f8=new Map(),_0x28b16e={'resolveToolTargetName':buildNameResolver({..._0x4f5857[_0x3501de(0x1e2)],'Agent':_0x180a2a}),'resolvePromptName':async _0x51e415=>_0x2ec1c6[_0x3501de(0x226)](_0x51e415),'onWarning':_0x1b6b68=>this[_0x3501de(0x231)][_0x3501de(0x20d)](_0x1b6b68)};let _0x393dbb=[];const _0x5f3a27={'projectId':_0x266522,'resolveToolTargetId':buildIdResolver({..._0x4f5857[_0x3501de(0x2a4)],'Agent':_0x55b19b}),'resolvePromptId':async _0x37695e=>_0x3134f8[_0x3501de(0x226)](_0x37695e),'onWarning':_0x8201cd=>{const _0x558e4f=_0x3501de;this['logger'][_0x558e4f(0x20d)](_0x8201cd),_0x393dbb[_0x558e4f(0x1c4)](_0x8201cd);}},{resolved:_0x302a64,unresolved:_0x165f30}=resolveAgentDependencies(_0x1a4756,new Set(_0x3a6b08[_0x3501de(0x1ad)]()));for(const {agent:_0x5bd43e,missingDeps:_0x253328}of _0x165f30){_0x52409e['agents'][_0x3501de(0x1c4)]({'agentName':_0x5bd43e['yaml']['name'],'action':_0x3501de(0x1b5),'error':_0x3501de(0x1a8)+_0x253328[_0x3501de(0x255)](',\x20')+_0x3501de(0x278)}),_0x52409e['counts']['agents'][_0x3501de(0x270)]++;}for(const _0x404fc2 of _0xb8f4d0){const _0xe478ca=_0x59161f['get'](_0x404fc2[_0x3501de(0x25b)][_0x3501de(0x289)]),_0x3093ab=a148_0x5d1e61[_0x3501de(0x28c)](_0x404fc2['path'],'utf-8');if(_0xe478ca){const _0x2e2581=apiKnowledgeBaseToYaml(_0xe478ca),_0x31c98c=toKnowledgeBaseYamlString(_0x2e2581),_0x532838=generateDiff(_0x31c98c,_0x3093ab),_0x6c0e32=hasChanges(_0x532838);_0x6c0e32?(_0x52409e[_0x3501de(0x1c8)][_0x3501de(0x1c4)]({'name':_0x404fc2['yaml']['name'],'action':_0x3501de(0x284),'id':_0xe478ca['id'],'diff':formatDiffWithColors(_0x532838)}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x1c8)]['updated']++):(_0x52409e[_0x3501de(0x1c8)][_0x3501de(0x1c4)]({'name':_0x404fc2['yaml'][_0x3501de(0x289)],'action':_0x3501de(0x281),'id':_0xe478ca['id']}),_0x52409e['counts'][_0x3501de(0x1c8)][_0x3501de(0x281)]++);}else _0x52409e[_0x3501de(0x1c8)][_0x3501de(0x1c4)]({'name':_0x404fc2[_0x3501de(0x25b)][_0x3501de(0x289)],'action':_0x3501de(0x1f6)}),_0x52409e[_0x3501de(0x293)]['knowledgeBases'][_0x3501de(0x1f6)]++;}for(const _0x307653 of _0x50f10f){const _0x4c3e45=_0xdc68b7[_0x3501de(0x226)](_0x307653[_0x3501de(0x289)]),_0x796f37=a148_0x5d1e61['readFileSync'](_0x307653[_0x3501de(0x1ab)],'utf-8');if(_0x4c3e45){const _0x271652=toTextKnowledgeBaseMd(_0x4c3e45[_0x3501de(0x26a)][_0x3501de(0x289)],_0x4c3e45[_0x3501de(0x26a)][_0x3501de(0x29e)]),_0x426c64=generateDiff(_0x271652,_0x796f37),_0xa36fec=hasChanges(_0x426c64);_0xa36fec?(_0x52409e[_0x3501de(0x20c)][_0x3501de(0x1c4)]({'name':_0x307653[_0x3501de(0x289)],'action':_0x3501de(0x284),'id':_0x4c3e45['id'],'diff':formatDiffWithColors(_0x426c64)}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x20c)][_0x3501de(0x284)]++):(_0x52409e[_0x3501de(0x20c)][_0x3501de(0x1c4)]({'name':_0x307653['name'],'action':_0x3501de(0x281),'id':_0x4c3e45['id']}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x20c)][_0x3501de(0x281)]++);}else _0x52409e[_0x3501de(0x20c)][_0x3501de(0x1c4)]({'name':_0x307653[_0x3501de(0x289)],'action':_0x3501de(0x1f6)}),_0x52409e['counts'][_0x3501de(0x20c)][_0x3501de(0x1f6)]++;}for(const _0x5426c8 of _0x302a64){const _0x489484=_0x3a6b08[_0x3501de(0x226)](_0x5426c8['yaml'][_0x3501de(0x289)]),_0x55bcd9=a148_0x235a2d[_0x3501de(0x255)](_0x5426c8[_0x3501de(0x1d9)],'agent.yml'),_0x12d5f1=a148_0x5d1e61[_0x3501de(0x28c)](_0x55bcd9,_0x3501de(0x213)),_0x4b7dac=_0x5426c8[_0x3501de(0x23a)],_0x31ce36=_0x3501de(0x1a2)+_0x4b7dac+_0x3501de(0x1ef)+_0x12d5f1;if(_0x489484){const {yaml:_0x3433c5,systemPrompt:_0xd3ee75}=await agentResponseToDef(_0x489484,_0x28b16e),_0x4a8d4f=toAgentYamlString(_0x3433c5),_0x15f9f1='#\x20prompt.md\x0a'+_0xd3ee75+_0x3501de(0x1ef)+_0x4a8d4f,_0x9d432a=generateDiff(_0x15f9f1,_0x31ce36),_0x361287=hasChanges(_0x9d432a);_0x361287?(_0x52409e['agents']['push']({'agentName':_0x5426c8[_0x3501de(0x25b)][_0x3501de(0x289)],'action':'updated','agentId':_0x489484['id'],'diff':formatDiffWithColors(_0x9d432a)}),_0x52409e['counts']['agents'][_0x3501de(0x284)]++):(_0x52409e['agents']['push']({'agentName':_0x5426c8[_0x3501de(0x25b)][_0x3501de(0x289)],'action':_0x3501de(0x281),'agentId':_0x489484['id']}),_0x52409e[_0x3501de(0x293)]['agents'][_0x3501de(0x281)]++);}else _0x52409e['agents'][_0x3501de(0x1c4)]({'agentName':_0x5426c8[_0x3501de(0x25b)][_0x3501de(0x289)],'action':_0x3501de(0x1f6)}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x1ed)]['created']++;}for(const _0x594f1 of _0x3cb618){const _0x58d385=_0x543e64['get'](_0x594f1['yaml']['name']),_0x357238=a148_0x5d1e61['readFileSync'](_0x594f1[_0x3501de(0x1ab)],_0x3501de(0x213));if(_0x58d385){const _0x5db789=await apiPromptToYaml(_0x58d385,_0x28b16e);if(!_0x5db789){_0x52409e[_0x3501de(0x225)][_0x3501de(0x1c4)]({'name':_0x594f1[_0x3501de(0x25b)][_0x3501de(0x289)],'action':_0x3501de(0x284),'id':_0x58d385['id']}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x225)][_0x3501de(0x284)]++;continue;}const _0xd2e7b9=toPromptYamlString(_0x5db789),_0x2b6f57=generateDiff(_0xd2e7b9,_0x357238),_0x11fe55=hasChanges(_0x2b6f57);_0x11fe55?(_0x52409e[_0x3501de(0x225)][_0x3501de(0x1c4)]({'name':_0x594f1[_0x3501de(0x25b)][_0x3501de(0x289)],'action':_0x3501de(0x284),'id':_0x58d385['id'],'diff':formatDiffWithColors(_0x2b6f57)}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x225)]['updated']++):(_0x52409e[_0x3501de(0x225)]['push']({'name':_0x594f1['yaml']['name'],'action':_0x3501de(0x281),'id':_0x58d385['id']}),_0x52409e['counts'][_0x3501de(0x225)][_0x3501de(0x281)]++);}else _0x52409e[_0x3501de(0x225)][_0x3501de(0x1c4)]({'name':_0x594f1['yaml'][_0x3501de(0x289)],'action':'created'}),_0x52409e['counts']['prompts']['created']++;}for(const _0x3b1043 of _0x4c8c3f){const _0x202873=_0x14d057[_0x3501de(0x226)](_0x3b1043[_0x3501de(0x25b)][_0x3501de(0x283)]),_0x4ff1db=a148_0x5d1e61['readFileSync'](_0x3b1043[_0x3501de(0x1ab)],_0x3501de(0x213));if(_0x202873){const _0x522157=await apiIntegrationToYaml(_0x202873,_0x28b16e),_0x22e0b9=toIntegrationYamlString(_0x522157),_0x2b8520=generateDiff(_0x22e0b9,_0x4ff1db),_0x40285f=hasChanges(_0x2b8520);_0x40285f?(_0x52409e[_0x3501de(0x229)]['push']({'name':_0x3b1043[_0x3501de(0x25b)][_0x3501de(0x283)],'action':_0x3501de(0x284),'id':_0x202873['id'],'diff':formatDiffWithColors(_0x2b8520)}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x229)][_0x3501de(0x284)]++):(_0x52409e[_0x3501de(0x229)][_0x3501de(0x1c4)]({'name':_0x3b1043[_0x3501de(0x25b)][_0x3501de(0x283)],'action':'unchanged','id':_0x202873['id']}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x229)][_0x3501de(0x281)]++);}else _0x52409e[_0x3501de(0x229)][_0x3501de(0x1c4)]({'name':_0x3b1043[_0x3501de(0x25b)][_0x3501de(0x283)],'action':_0x3501de(0x1f6)}),_0x52409e['counts']['integrations']['created']++;}for(const _0x846d1d of _0x39bf5f){const _0x1e845a=_0x5beb24['get'](_0x846d1d[_0x3501de(0x256)][_0x3501de(0x289)]),_0x377c04=toExperimentalKnowledgeBaseYamlString(_0x846d1d[_0x3501de(0x256)]);let _0x5c6ae5=_0x377c04;for(const _0x272e50 of _0x846d1d[_0x3501de(0x256)]['functions']){_0x5c6ae5+='\x0a---\x20function:\x20'+_0x272e50[_0x3501de(0x289)]+'\x20---\x0a'+_0x272e50[_0x3501de(0x2b4)]+'\x0a---\x20schema:\x20'+_0x272e50['name']+_0x3501de(0x22a)+_0x272e50['json_schema']+'\x0a';}if(_0x1e845a){const _0x593340=apiExperimentalKnowledgeBaseToYaml(_0x1e845a),_0x100f23=toExperimentalKnowledgeBaseYamlString(_0x593340);let _0x39615c=_0x100f23;for(const _0x434eca of _0x593340[_0x3501de(0x207)]){_0x39615c+=_0x3501de(0x2a3)+_0x434eca[_0x3501de(0x289)]+_0x3501de(0x22a)+_0x434eca[_0x3501de(0x2b4)]+_0x3501de(0x1df)+_0x434eca[_0x3501de(0x289)]+_0x3501de(0x22a)+_0x434eca[_0x3501de(0x21a)]+'\x0a';}const _0x261c93=generateDiff(_0x39615c,_0x5c6ae5),_0x55fcd9=hasChanges(_0x261c93);_0x55fcd9?(_0x52409e[_0x3501de(0x1cd)][_0x3501de(0x1c4)]({'name':_0x846d1d[_0x3501de(0x256)][_0x3501de(0x289)],'action':_0x3501de(0x284),'id':_0x1e845a['id'],'diff':formatDiffWithColors(_0x261c93)}),_0x52409e[_0x3501de(0x293)]['experimentalKnowledgeBases'][_0x3501de(0x284)]++):(_0x52409e[_0x3501de(0x1cd)][_0x3501de(0x1c4)]({'name':_0x846d1d[_0x3501de(0x256)]['name'],'action':_0x3501de(0x281),'id':_0x1e845a['id']}),_0x52409e[_0x3501de(0x293)]['experimentalKnowledgeBases'][_0x3501de(0x281)]++);}else _0x52409e[_0x3501de(0x1cd)][_0x3501de(0x1c4)]({'name':_0x846d1d[_0x3501de(0x256)][_0x3501de(0x289)],'action':_0x3501de(0x1f6)}),_0x52409e['counts'][_0x3501de(0x1cd)]['created']++;}for(const _0x474430 of _0x5742b0){const _0x5e4008=_0x2248ee['get'](_0x474430[_0x3501de(0x256)][_0x3501de(0x289)]),_0x73e633=toExperimentalArtifactYamlString(_0x474430[_0x3501de(0x256)]);let _0xc2b047=_0x73e633+(_0x3501de(0x2ad)+_0x474430[_0x3501de(0x256)][_0x3501de(0x2b4)]+'\x0a');for(const _0x6b4788 of _0x474430[_0x3501de(0x256)][_0x3501de(0x1b6)]){_0xc2b047+=_0x3501de(0x25e)+_0x6b4788[_0x3501de(0x22d)]+_0x3501de(0x22a)+_0x6b4788[_0x3501de(0x25c)]+'\x0a';}if(_0x5e4008){const _0x3bb093=apiExperimentalArtifactToYaml(_0x5e4008),_0x50acdc=toExperimentalArtifactYamlString(_0x3bb093);let _0x3a7f8c=_0x50acdc+('\x0a---\x20code\x20---\x0a'+_0x3bb093[_0x3501de(0x2b4)]+'\x0a');for(const _0x3073c2 of _0x3bb093[_0x3501de(0x1b6)]){_0x3a7f8c+=_0x3501de(0x25e)+_0x3073c2['file_name']+_0x3501de(0x22a)+_0x3073c2[_0x3501de(0x25c)]+'\x0a';}const _0x103bb1=generateDiff(_0x3a7f8c,_0xc2b047),_0x1455b2=hasChanges(_0x103bb1);_0x1455b2?(_0x52409e[_0x3501de(0x1f0)][_0x3501de(0x1c4)]({'name':_0x474430[_0x3501de(0x256)][_0x3501de(0x289)],'action':_0x3501de(0x284),'id':_0x5e4008['id'],'diff':formatDiffWithColors(_0x103bb1)}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x1f0)]['updated']++):(_0x52409e['experimentalArtifacts'][_0x3501de(0x1c4)]({'name':_0x474430[_0x3501de(0x256)][_0x3501de(0x289)],'action':_0x3501de(0x281),'id':_0x5e4008['id']}),_0x52409e['counts'][_0x3501de(0x1f0)][_0x3501de(0x281)]++);}else _0x52409e['experimentalArtifacts']['push']({'name':_0x474430['def'][_0x3501de(0x289)],'action':'created'}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x1f0)][_0x3501de(0x1f6)]++;}for(const _0x554fe6 of _0x14916a){const _0x16d922=_0xf7a4c6[_0x3501de(0x226)](_0x554fe6['yaml']['name']),_0xfc9f33=a148_0x5d1e61[_0x3501de(0x28c)](_0x554fe6[_0x3501de(0x1ab)],'utf-8');if(_0x16d922){const _0xe502f0=await apiFormInterfaceToYaml(_0x16d922,_0x28b16e),_0x389481=toFormInterfaceYamlString(_0xe502f0),_0x107777=generateDiff(_0x389481,_0xfc9f33),_0xb58cb3=hasChanges(_0x107777);_0xb58cb3?(_0x52409e['formInterfaces'][_0x3501de(0x1c4)]({'name':_0x554fe6['yaml'][_0x3501de(0x289)],'action':_0x3501de(0x284),'id':_0x16d922['id'],'diff':formatDiffWithColors(_0x107777)}),_0x52409e['counts'][_0x3501de(0x247)]['updated']++):(_0x52409e['formInterfaces']['push']({'name':_0x554fe6[_0x3501de(0x25b)][_0x3501de(0x289)],'action':_0x3501de(0x281),'id':_0x16d922['id']}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x247)]['unchanged']++);}else _0x52409e[_0x3501de(0x247)][_0x3501de(0x1c4)]({'name':_0x554fe6[_0x3501de(0x25b)][_0x3501de(0x289)],'action':'created'}),_0x52409e['counts']['formInterfaces'][_0x3501de(0x1f6)]++;}for(const _0x1b0596 of _0x1d70b6){const _0x533087=_0x38a03b[_0x3501de(0x226)](_0x1b0596[_0x3501de(0x25b)][_0x3501de(0x289)]),_0x3dc65a=a148_0x5d1e61['readFileSync'](_0x1b0596[_0x3501de(0x1ab)],'utf-8');if(_0x533087){const _0x4c6cdb=await apiChatInterfaceToYaml(_0x533087,_0x28b16e),_0x190869=toChatInterfaceYamlString(_0x4c6cdb),_0x4e472f=generateDiff(_0x190869,_0x3dc65a),_0x3486bf=hasChanges(_0x4e472f);_0x3486bf?(_0x52409e[_0x3501de(0x27c)]['push']({'name':_0x1b0596[_0x3501de(0x25b)][_0x3501de(0x289)],'action':_0x3501de(0x284),'id':_0x533087['id'],'diff':formatDiffWithColors(_0x4e472f)}),_0x52409e[_0x3501de(0x293)]['chatInterfaces']['updated']++):(_0x52409e[_0x3501de(0x27c)][_0x3501de(0x1c4)]({'name':_0x1b0596[_0x3501de(0x25b)]['name'],'action':_0x3501de(0x281),'id':_0x533087['id']}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x27c)][_0x3501de(0x281)]++);}else _0x52409e[_0x3501de(0x27c)][_0x3501de(0x1c4)]({'name':_0x1b0596[_0x3501de(0x25b)][_0x3501de(0x289)],'action':_0x3501de(0x1f6)}),_0x52409e[_0x3501de(0x293)]['chatInterfaces']['created']++;}if(_0x48cb93?.[_0x3501de(0x1d3)])return _0x52409e;_0x52409e[_0x3501de(0x1c8)]=[],_0x52409e[_0x3501de(0x20c)]=[],_0x52409e[_0x3501de(0x225)]=[],_0x52409e[_0x3501de(0x229)]=[],_0x52409e[_0x3501de(0x1cd)]=[],_0x52409e[_0x3501de(0x1f0)]=[],_0x52409e[_0x3501de(0x247)]=[],_0x52409e[_0x3501de(0x27c)]=[];const _0x31f22=_0x52409e['agents'][_0x3501de(0x1ca)](_0x14f137=>_0x14f137[_0x3501de(0x1ac)]===_0x3501de(0x1b5));_0x52409e[_0x3501de(0x1ed)]=_0x31f22,_0x52409e[_0x3501de(0x293)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x31f22[_0x3501de(0x1a9)]},'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 _0xad0339 of _0xb8f4d0){try{const _0x278ab3=_0x59161f['get'](_0xad0339['yaml'][_0x3501de(0x289)]),_0x53dbcf=yamlKnowledgeBaseToApi(_0xad0339[_0x3501de(0x25b)],_0x266522);if(_0x278ab3)await this[_0x3501de(0x215)][_0x3501de(0x258)](_0x278ab3['id'],_0x53dbcf),_0x4acb4c[_0x3501de(0x24c)](_0xad0339[_0x3501de(0x25b)][_0x3501de(0x289)],_0x278ab3['id']),_0x52409e['knowledgeBases'][_0x3501de(0x1c4)]({'name':_0xad0339['yaml'][_0x3501de(0x289)],'action':'updated','id':_0x278ab3['id']}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x1c8)][_0x3501de(0x284)]++;else{const _0x33797b=await this['client'][_0x3501de(0x1f3)](_0x53dbcf);_0x4acb4c[_0x3501de(0x24c)](_0xad0339['yaml']['name'],_0x33797b['id']),_0x52409e[_0x3501de(0x1c8)][_0x3501de(0x1c4)]({'name':_0xad0339[_0x3501de(0x25b)][_0x3501de(0x289)],'action':_0x3501de(0x1f6),'id':_0x33797b['id']}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x1c8)][_0x3501de(0x1f6)]++;}}catch(_0x24a9e4){_0x52409e[_0x3501de(0x1c8)][_0x3501de(0x1c4)]({'name':_0xad0339[_0x3501de(0x25b)][_0x3501de(0x289)],'action':'error','error':_0x24a9e4['message']}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x1c8)][_0x3501de(0x270)]++;}}for(const _0x594127 of _0x50f10f){try{const _0x225e30=_0xdc68b7[_0x3501de(0x226)](_0x594127[_0x3501de(0x289)]),_0x2c5a28=yamlTextKnowledgeBaseToApi({'name':_0x594127[_0x3501de(0x289)],'text':_0x594127[_0x3501de(0x29e)]},_0x266522);if(_0x225e30)await this[_0x3501de(0x215)][_0x3501de(0x216)](_0x225e30['id'],_0x2c5a28),_0x192e50[_0x3501de(0x24c)](_0x594127[_0x3501de(0x289)],_0x225e30['id']),_0x52409e[_0x3501de(0x20c)][_0x3501de(0x1c4)]({'name':_0x594127[_0x3501de(0x289)],'action':_0x3501de(0x284),'id':_0x225e30['id']}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x20c)]['updated']++;else{const _0x6df472=await this[_0x3501de(0x215)][_0x3501de(0x1fc)](_0x2c5a28);_0x192e50[_0x3501de(0x24c)](_0x594127[_0x3501de(0x289)],_0x6df472['id']),_0x52409e['textKnowledgeBases']['push']({'name':_0x594127[_0x3501de(0x289)],'action':_0x3501de(0x1f6),'id':_0x6df472['id']}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x20c)][_0x3501de(0x1f6)]++;}}catch(_0x134574){_0x52409e[_0x3501de(0x20c)][_0x3501de(0x1c4)]({'name':_0x594127[_0x3501de(0x289)],'action':_0x3501de(0x1b5),'error':_0x134574[_0x3501de(0x282)]}),_0x52409e[_0x3501de(0x293)]['textKnowledgeBases'][_0x3501de(0x270)]++;}}for(const _0x826c of _0x39bf5f){try{const _0x58cc59=_0x5beb24[_0x3501de(0x226)](_0x826c[_0x3501de(0x256)]['name']),_0x10c1c3=yamlExperimentalKnowledgeBaseToApi(_0x826c[_0x3501de(0x256)],_0x266522);if(_0x58cc59)await this[_0x3501de(0x215)]['updateExperimentalKnowledgeBase'](_0x58cc59['id'],_0x10c1c3),_0x551e28[_0x3501de(0x24c)](_0x826c[_0x3501de(0x256)][_0x3501de(0x289)],_0x58cc59['id']),_0x52409e[_0x3501de(0x1cd)][_0x3501de(0x1c4)]({'name':_0x826c[_0x3501de(0x256)][_0x3501de(0x289)],'action':_0x3501de(0x284),'id':_0x58cc59['id']}),_0x52409e[_0x3501de(0x293)]['experimentalKnowledgeBases']['updated']++;else{const _0x522220=await this[_0x3501de(0x215)][_0x3501de(0x1b4)](_0x10c1c3);_0x551e28['set'](_0x826c[_0x3501de(0x256)]['name'],_0x522220['id']),_0x52409e['experimentalKnowledgeBases']['push']({'name':_0x826c[_0x3501de(0x256)]['name'],'action':_0x3501de(0x1f6),'id':_0x522220['id']}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x1cd)][_0x3501de(0x1f6)]++;}}catch(_0x3a4a62){_0x52409e[_0x3501de(0x1cd)]['push']({'name':_0x826c[_0x3501de(0x256)][_0x3501de(0x289)],'action':_0x3501de(0x1b5),'error':_0x3a4a62[_0x3501de(0x282)]}),_0x52409e[_0x3501de(0x293)]['experimentalKnowledgeBases']['errors']++;}}for(const _0x28e023 of _0x5742b0){try{const _0x5e0c0a=_0x2248ee['get'](_0x28e023[_0x3501de(0x256)][_0x3501de(0x289)]),_0x2dac13=yamlExperimentalArtifactToApi(_0x28e023[_0x3501de(0x256)],_0x266522);if(_0x5e0c0a)await this['client'][_0x3501de(0x1e9)](_0x5e0c0a['id'],_0x2dac13),_0xb99f8[_0x3501de(0x24c)](_0x28e023[_0x3501de(0x256)][_0x3501de(0x289)],_0x5e0c0a['id']),_0x52409e[_0x3501de(0x1f0)]['push']({'name':_0x28e023[_0x3501de(0x256)]['name'],'action':'updated','id':_0x5e0c0a['id']}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x1f0)][_0x3501de(0x284)]++;else{const _0x58d690=await this[_0x3501de(0x215)][_0x3501de(0x1de)](_0x2dac13);_0xb99f8[_0x3501de(0x24c)](_0x28e023[_0x3501de(0x256)]['name'],_0x58d690['id']),_0x52409e[_0x3501de(0x1f0)][_0x3501de(0x1c4)]({'name':_0x28e023[_0x3501de(0x256)][_0x3501de(0x289)],'action':_0x3501de(0x1f6),'id':_0x58d690['id']}),_0x52409e['counts'][_0x3501de(0x1f0)][_0x3501de(0x1f6)]++;}}catch(_0x2434ef){_0x52409e['experimentalArtifacts'][_0x3501de(0x1c4)]({'name':_0x28e023[_0x3501de(0x256)][_0x3501de(0x289)],'action':'error','error':_0x2434ef[_0x3501de(0x282)]}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x1f0)][_0x3501de(0x270)]++;}}for(const _0x56f35e of _0x302a64){_0x393dbb=[];try{const _0x1906bc=_0x3a6b08['get'](_0x56f35e['yaml']['name']),_0x2ec3ac=await agentDefToRequest(_0x56f35e['yaml'],_0x56f35e[_0x3501de(0x23a)],_0x56f35e[_0x3501de(0x1fa)],_0x5f3a27);if(_0x1906bc)await this['client'][_0x3501de(0x212)](_0x1906bc['id'],_0x2ec3ac),_0x55b19b[_0x3501de(0x24c)](_0x56f35e['yaml']['name'],_0x1906bc['id']),_0x52409e[_0x3501de(0x1ed)][_0x3501de(0x1c4)]({'agentName':_0x56f35e[_0x3501de(0x25b)][_0x3501de(0x289)],'action':_0x3501de(0x284),'agentId':_0x1906bc['id'],'warnings':_0x393dbb[_0x3501de(0x1a9)]>0x0?_0x393dbb:undefined}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x1ed)]['updated']++;else{const _0x2cae5d=await this['client'][_0x3501de(0x220)](_0x2ec3ac);_0x55b19b[_0x3501de(0x24c)](_0x56f35e[_0x3501de(0x25b)][_0x3501de(0x289)],_0x2cae5d['id']),_0x52409e['agents']['push']({'agentName':_0x56f35e[_0x3501de(0x25b)]['name'],'action':'created','agentId':_0x2cae5d['id'],'warnings':_0x393dbb[_0x3501de(0x1a9)]>0x0?_0x393dbb:undefined}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x1ed)][_0x3501de(0x1f6)]++;}}catch(_0x148ea5){_0x52409e[_0x3501de(0x1ed)]['push']({'agentName':_0x56f35e[_0x3501de(0x25b)][_0x3501de(0x289)],'action':'error','error':_0x148ea5[_0x3501de(0x282)],'warnings':_0x393dbb[_0x3501de(0x1a9)]>0x0?_0x393dbb:undefined}),_0x52409e[_0x3501de(0x293)]['agents'][_0x3501de(0x270)]++;}}for(const _0x33d9bf of _0x3cb618){try{const _0x481a13=_0x543e64[_0x3501de(0x226)](_0x33d9bf[_0x3501de(0x25b)][_0x3501de(0x289)]),_0x4817b0=await yamlPromptToApi(_0x33d9bf[_0x3501de(0x25b)],_0x266522,_0x5f3a27);if(!_0x4817b0){_0x52409e[_0x3501de(0x225)][_0x3501de(0x1c4)]({'name':_0x33d9bf['yaml']['name'],'action':_0x3501de(0x1b5),'error':_0x3501de(0x286)}),_0x52409e[_0x3501de(0x293)]['prompts']['errors']++;continue;}if(_0x481a13)await this[_0x3501de(0x215)][_0x3501de(0x1a1)](_0x481a13['id'],_0x4817b0),_0x3134f8[_0x3501de(0x24c)](_0x33d9bf['yaml'][_0x3501de(0x289)],_0x481a13['id']),_0x52409e['prompts']['push']({'name':_0x33d9bf[_0x3501de(0x25b)][_0x3501de(0x289)],'action':_0x3501de(0x284),'id':_0x481a13['id']}),_0x52409e['counts'][_0x3501de(0x225)][_0x3501de(0x284)]++;else{const _0x5b34ed=await this['client']['createPrompt'](_0x4817b0);_0x3134f8[_0x3501de(0x24c)](_0x33d9bf[_0x3501de(0x25b)]['name'],_0x5b34ed['id']),_0x52409e['prompts']['push']({'name':_0x33d9bf['yaml'][_0x3501de(0x289)],'action':'created','id':_0x5b34ed['id']}),_0x52409e[_0x3501de(0x293)]['prompts']['created']++;}}catch(_0x36da51){_0x52409e[_0x3501de(0x225)][_0x3501de(0x1c4)]({'name':_0x33d9bf[_0x3501de(0x25b)][_0x3501de(0x289)],'action':_0x3501de(0x1b5),'error':_0x36da51[_0x3501de(0x282)]}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x225)][_0x3501de(0x270)]++;}}for(const _0x5a8564 of _0x4c8c3f){try{const _0x4e56f6=_0x14d057[_0x3501de(0x226)](_0x5a8564[_0x3501de(0x25b)]['service_type']),_0x4f50ea=await yamlIntegrationToApi(_0x5a8564[_0x3501de(0x25b)],_0x266522,_0x5f3a27);if(_0x4e56f6){await this[_0x3501de(0x215)][_0x3501de(0x2ab)](_0x4e56f6['id']);const _0x2920b2=await this[_0x3501de(0x215)]['createIntegration'](_0x4f50ea);_0x52409e[_0x3501de(0x229)]['push']({'name':_0x5a8564['yaml'][_0x3501de(0x283)],'action':'updated','id':_0x2920b2['id']}),_0x52409e['counts'][_0x3501de(0x229)][_0x3501de(0x284)]++;}else{const _0x336a1f=await this[_0x3501de(0x215)][_0x3501de(0x26f)](_0x4f50ea);_0x52409e[_0x3501de(0x229)]['push']({'name':_0x5a8564[_0x3501de(0x25b)][_0x3501de(0x283)],'action':_0x3501de(0x1f6),'id':_0x336a1f['id']}),_0x52409e['counts'][_0x3501de(0x229)][_0x3501de(0x1f6)]++;}}catch(_0x587900){_0x52409e[_0x3501de(0x229)][_0x3501de(0x1c4)]({'name':_0x5a8564[_0x3501de(0x25b)][_0x3501de(0x283)],'action':_0x3501de(0x1b5),'error':_0x587900[_0x3501de(0x282)]}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x229)][_0x3501de(0x270)]++;}}for(const _0x325c5e of _0x14916a){try{const _0x58fbec=_0xf7a4c6['get'](_0x325c5e[_0x3501de(0x25b)][_0x3501de(0x289)]),_0xf005c6=await yamlFormInterfaceToApi(_0x325c5e[_0x3501de(0x25b)],_0x266522,_0x5f3a27);if(!_0xf005c6){_0x52409e[_0x3501de(0x247)]['push']({'name':_0x325c5e['yaml'][_0x3501de(0x289)],'action':'error','error':_0x3501de(0x1cf)}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x247)][_0x3501de(0x270)]++;continue;}if(_0x58fbec){const _0x363b15=await this[_0x3501de(0x215)][_0x3501de(0x2a9)](_0x58fbec['id'],_0xf005c6);_0x52409e[_0x3501de(0x247)]['push']({'name':_0x325c5e[_0x3501de(0x25b)][_0x3501de(0x289)],'action':_0x3501de(0x284),'id':_0x363b15['id']}),_0x52409e[_0x3501de(0x293)]['formInterfaces'][_0x3501de(0x284)]++;}else{const _0x2120fe=await this[_0x3501de(0x215)][_0x3501de(0x191)](_0xf005c6);_0x52409e[_0x3501de(0x247)][_0x3501de(0x1c4)]({'name':_0x325c5e[_0x3501de(0x25b)]['name'],'action':_0x3501de(0x1f6),'id':_0x2120fe['id']}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x247)][_0x3501de(0x1f6)]++;}}catch(_0x1a6386){_0x52409e['formInterfaces'][_0x3501de(0x1c4)]({'name':_0x325c5e[_0x3501de(0x25b)]['name'],'action':_0x3501de(0x1b5),'error':_0x1a6386[_0x3501de(0x282)]}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x247)][_0x3501de(0x270)]++;}}for(const _0x4f3a4b of _0x1d70b6){try{const _0x5d6a44=_0x38a03b[_0x3501de(0x226)](_0x4f3a4b[_0x3501de(0x25b)][_0x3501de(0x289)]),_0x221f2a=await yamlChatInterfaceToApi(_0x4f3a4b[_0x3501de(0x25b)],_0x266522,_0x5f3a27);if(_0x5d6a44){const _0x2c6d80=await this[_0x3501de(0x215)][_0x3501de(0x21d)](_0x5d6a44['id'],_0x221f2a);_0x52409e[_0x3501de(0x27c)][_0x3501de(0x1c4)]({'name':_0x4f3a4b[_0x3501de(0x25b)][_0x3501de(0x289)],'action':'updated','id':_0x2c6d80['id']}),_0x52409e[_0x3501de(0x293)][_0x3501de(0x27c)][_0x3501de(0x284)]++;}else{const _0x12a46f=await this[_0x3501de(0x215)][_0x3501de(0x21b)](_0x221f2a);_0x52409e[_0x3501de(0x27c)][_0x3501de(0x1c4)]({'name':_0x4f3a4b['yaml'][_0x3501de(0x289)],'action':'created','id':_0x12a46f['id']}),_0x52409e[_0x3501de(0x293)]['chatInterfaces'][_0x3501de(0x1f6)]++;}}catch(_0x1f277a){_0x52409e['chatInterfaces']['push']({'name':_0x4f3a4b[_0x3501de(0x25b)][_0x3501de(0x289)],'action':_0x3501de(0x1b5),'error':_0x1f277a[_0x3501de(0x282)]}),_0x52409e['counts'][_0x3501de(0x27c)][_0x3501de(0x270)]++;}}return _0x52409e;}async[a148_0x3ff51f(0x298)](_0x4377a2,_0x485578,_0x3788f6,_0x27d2d1){const _0x50312f=a148_0x3ff51f,{projectId:_0x34afde,project:_0x1a53a5}=await this[_0x50312f(0x1c9)](_0x4377a2),_0x3026d1=_0x1a53a5[_0x50312f(0x26a)][_0x50312f(0x289)],_0x58b2af=await this[_0x50312f(0x215)][_0x50312f(0x217)](_0x34afde),_0x55f43d=_0x58b2af[_0x50312f(0x227)](_0x4e9f0a=>_0x4e9f0a[_0x50312f(0x26a)][_0x50312f(0x289)]===_0x485578);if(!_0x55f43d)throw new SDKError(ErrorCode[_0x50312f(0x21e)],_0x50312f(0x290)+_0x485578,undefined,{'helpText':_0x50312f(0x273)+_0x58b2af[_0x50312f(0x241)](_0x2ef1f2=>_0x2ef1f2[_0x50312f(0x26a)][_0x50312f(0x289)])[_0x50312f(0x255)](',\x20')});let _0x49875e;if(_0x3788f6)_0x49875e=_0x3788f6;else{const _0x512a2c=a148_0x235a2d[_0x50312f(0x255)](process['cwd'](),_0x50312f(0x1ed)),_0x28fc8f=getSanitizedPathWithMigration(_0x512a2c,_0x3026d1);_0x28fc8f['renamed']&&this[_0x50312f(0x231)][_0x50312f(0x1af)](_0x50312f(0x199)+a148_0x235a2d['basename'](_0x28fc8f[_0x50312f(0x208)])+_0x50312f(0x24f)+a148_0x235a2d[_0x50312f(0x245)](_0x28fc8f['path'])),_0x49875e=_0x28fc8f[_0x50312f(0x1ab)];}const _0x3471f7=getSanitizedPathWithMigration(_0x49875e,_0x485578);_0x3471f7[_0x50312f(0x1b7)]&&this[_0x50312f(0x231)][_0x50312f(0x1af)](_0x50312f(0x25d)+a148_0x235a2d['basename'](_0x3471f7[_0x50312f(0x208)])+_0x50312f(0x24f)+a148_0x235a2d[_0x50312f(0x245)](_0x3471f7[_0x50312f(0x1ab)]));const _0x4856d7=_0x3471f7['path'],_0x419732=new Map(),_0x4d6480=new Map(),_0x24ac98=await this[_0x50312f(0x215)]['listKnowledgeBases'](_0x34afde),_0x24a67c=await this[_0x50312f(0x215)][_0x50312f(0x22c)](_0x34afde),_0x3a2d80=await safeListOrEmpty(()=>this[_0x50312f(0x215)][_0x50312f(0x262)](_0x34afde)),_0x45318c=new Map(),_0x5dcfd4=new Map();for(const _0x2c0851 of _0x24ac98){_0x419732[_0x50312f(0x24c)](_0x2c0851['id'],_0x2c0851[_0x50312f(0x26a)][_0x50312f(0x289)]);}for(const _0x11df2e of _0x24a67c){_0x45318c[_0x50312f(0x24c)](_0x11df2e['id'],_0x11df2e[_0x50312f(0x26a)][_0x50312f(0x289)]);}for(const _0x45d394 of _0x3a2d80){_0x5dcfd4[_0x50312f(0x24c)](_0x45d394['id'],_0x45d394[_0x50312f(0x26a)][_0x50312f(0x289)]);}for(const _0x2d943e of _0x58b2af){_0x4d6480['set'](_0x2d943e['id'],_0x2d943e[_0x50312f(0x26a)][_0x50312f(0x289)]);}const _0x54c662={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x419732,'TextKnowledgeBase':_0x45318c,'Agent':_0x4d6480,'ExperimentalKnowledgeBase':_0x5dcfd4}),'resolvePromptName':async()=>undefined,'onWarning':_0x5393cd=>this[_0x50312f(0x231)][_0x50312f(0x20d)](_0x5393cd)},_0x18757b=a148_0x235a2d[_0x50312f(0x255)](_0x4856d7,_0x50312f(0x20b)),_0x10a7b6=a148_0x235a2d['join'](_0x4856d7,_0x50312f(0x2b7)),_0x46024f=a148_0x235a2d[_0x50312f(0x255)](_0x4856d7,_0x50312f(0x1e0)),_0x3053c7=!a148_0x5d1e61['existsSync'](_0x10a7b6);if(_0x27d2d1?.[_0x50312f(0x1d3)])return{'agentName':_0x485578,'outputPath':_0x4856d7,'isNew':_0x3053c7,'hasChanges':!![]};a148_0x5d1e61[_0x50312f(0x259)](_0x49875e,{'recursive':!![]}),a148_0x5d1e61[_0x50312f(0x259)](_0x4856d7,{'recursive':!![]});const _0x4a7b7c=a148_0x235a2d[_0x50312f(0x255)](_0x49875e,_0x50312f(0x274));!a148_0x5d1e61[_0x50312f(0x20e)](_0x4a7b7c)&&a148_0x5d1e61[_0x50312f(0x26e)](_0x4a7b7c,createAgentConfigContent(_0x4377a2));const {yaml:_0x57c6ba,systemPrompt:_0x3f743b,starterMessage:_0x37eeb1}=await agentResponseToDef(_0x55f43d,_0x54c662);let _0x14d2da=_0x3053c7;if(!_0x3053c7){const _0x548a34=a148_0x5d1e61[_0x50312f(0x20e)](_0x18757b)?a148_0x5d1e61[_0x50312f(0x28c)](_0x18757b,'utf-8'):'',_0x570f2c=a148_0x5d1e61['readFileSync'](_0x10a7b6,_0x50312f(0x213));_0x14d2da=_0x548a34!==_0x3f743b||_0x570f2c!==toAgentYamlString(_0x57c6ba);}a148_0x5d1e61[_0x50312f(0x26e)](_0x18757b,_0x3f743b),a148_0x5d1e61[_0x50312f(0x26e)](_0x10a7b6,toAgentYamlString(_0x57c6ba));if(_0x37eeb1&&_0x37eeb1[_0x50312f(0x1ee)]('\x0a'))a148_0x5d1e61['writeFileSync'](_0x46024f,_0x37eeb1);else a148_0x5d1e61[_0x50312f(0x20e)](_0x46024f)&&a148_0x5d1e61[_0x50312f(0x25f)](_0x46024f);return{'agentName':_0x485578,'outputPath':_0x4856d7,'isNew':_0x3053c7,'hasChanges':_0x14d2da};}async[a148_0x3ff51f(0x228)](_0x1a53e4,_0x5ef7aa){const _0x353793=a148_0x3ff51f;let _0x4336d8;isAgentYamlPath(_0x1a53e4)?_0x4336d8=getAgentDirFromYamlPath(_0x1a53e4):_0x4336d8=_0x1a53e4;const {config:_0x325d10}=findAgentConfig(_0x4336d8),_0x138dd8=await this['resolveProjectId'](_0x325d10[_0x353793(0x1fe)]),_0x5e218b=a148_0x235a2d[_0x353793(0x255)](_0x4336d8,'agent.yml'),_0x56627f=a148_0x235a2d[_0x353793(0x255)](_0x4336d8,'prompt.md'),_0x45e159=a148_0x235a2d[_0x353793(0x255)](_0x4336d8,_0x353793(0x1e0));if(!a148_0x5d1e61['existsSync'](_0x5e218b))throw new SDKError(ErrorCode[_0x353793(0x2b3)],_0x353793(0x299)+_0x4336d8,undefined,{'helpText':_0x353793(0x1f2)});const _0x50c87c=parseAgentYaml(a148_0x5d1e61['readFileSync'](_0x5e218b,_0x353793(0x213)),_0x5e218b),_0x67fc39=a148_0x5d1e61[_0x353793(0x20e)](_0x56627f)?a148_0x5d1e61[_0x353793(0x28c)](_0x56627f,_0x353793(0x213)):'',_0x7fdc1c=a148_0x5d1e61['existsSync'](_0x45e159)?a148_0x5d1e61[_0x353793(0x28c)](_0x45e159,_0x353793(0x213)):_0x50c87c[_0x353793(0x1c1)];if(_0x5ef7aa?.[_0x353793(0x1d3)])return{'agentName':_0x50c87c[_0x353793(0x289)],'action':_0x353793(0x1f6),'projectId':_0x138dd8};const _0x570a41=await this[_0x353793(0x215)][_0x353793(0x217)](_0x138dd8),_0x1af7d3=await fetchAllToolTargetMaps((_0x11bc74,_0x313f2b)=>this[_0x353793(0x215)][_0x353793(0x1bc)](_0x11bc74,_0x313f2b),_0x138dd8),_0x550ab9=new Map();for(const _0x976cc7 of _0x570a41){_0x550ab9[_0x353793(0x24c)](_0x976cc7['attributes'][_0x353793(0x289)],_0x976cc7['id']);}const _0x5dd0cb=[],_0x316693={'projectId':_0x138dd8,'resolveToolTargetId':buildIdResolver({..._0x1af7d3['nameToId'],'Agent':_0x550ab9}),'resolvePromptId':async()=>undefined,'onWarning':_0x550210=>{const _0x493fd5=_0x353793;this[_0x493fd5(0x231)][_0x493fd5(0x20d)](_0x550210),_0x5dd0cb['push'](_0x550210);}};try{const _0x19ac8a=_0x570a41['find'](_0x3e2c92=>_0x3e2c92[_0x353793(0x26a)][_0x353793(0x289)]===_0x50c87c[_0x353793(0x289)]),_0x2ef73a=await agentDefToRequest(_0x50c87c,_0x67fc39,_0x7fdc1c,_0x316693);if(_0x19ac8a)return await this['client'][_0x353793(0x212)](_0x19ac8a['id'],_0x2ef73a),{'agentName':_0x50c87c[_0x353793(0x289)],'action':_0x353793(0x284),'projectId':_0x138dd8,'agentId':_0x19ac8a['id'],'warnings':_0x5dd0cb[_0x353793(0x1a9)]>0x0?_0x5dd0cb:undefined};else{const _0x5a0560=await this[_0x353793(0x215)][_0x353793(0x220)](_0x2ef73a);return{'agentName':_0x50c87c[_0x353793(0x289)],'action':'created','projectId':_0x138dd8,'agentId':_0x5a0560['id'],'warnings':_0x5dd0cb['length']>0x0?_0x5dd0cb:undefined};}}catch(_0x359b9b){return{'agentName':_0x50c87c[_0x353793(0x289)],'action':'error','projectId':_0x138dd8,'error':_0x359b9b['message'],'warnings':_0x5dd0cb['length']>0x0?_0x5dd0cb:undefined};}}async['cloneProject'](_0x503b92,_0x1e4bea,_0x1d8e44){const _0x694064=a148_0x3ff51f,_0x5cd91c=a148_0x5d1e61[_0x694064(0x20e)](_0x503b92)&&a148_0x5d1e61[_0x694064(0x20e)](a148_0x235a2d[_0x694064(0x255)](_0x503b92,'tdx.json'));let _0xefc594;const _0x5a0687=[],_0x402507=[],_0x4791b1=[],_0x368947=[],_0xaa0da7=[],_0x446c56=[],_0x6899eb=[],_0x3f21f9=[],_0x2a7699=[];if(_0x5cd91c){const _0x160df8=loadAgentConfig(a148_0x235a2d['join'](_0x503b92,_0x694064(0x274)));_0xefc594=_0x160df8[_0x694064(0x1fe)];const _0x15ecf0=a148_0x5d1e61[_0x694064(0x196)](_0x503b92,{'withFileTypes':!![]});for(const _0x39a56c of _0x15ecf0){if(!_0x39a56c[_0x694064(0x1c2)]())continue;if([_0x694064(0x200),_0x694064(0x1ea),_0x694064(0x248),_0x694064(0x225),'integrations',_0x694064(0x1ba),_0x694064(0x261)][_0x694064(0x1ee)](_0x39a56c[_0x694064(0x289)]))continue;const _0x450fb1=a148_0x235a2d[_0x694064(0x255)](_0x503b92,_0x39a56c[_0x694064(0x289)]);if(isAgentDir(_0x450fb1)){const _0x360142=a148_0x235a2d[_0x694064(0x255)](_0x450fb1,_0x694064(0x2b7)),_0xc02ba7=a148_0x235a2d[_0x694064(0x255)](_0x450fb1,'prompt.md'),_0x371655=a148_0x235a2d[_0x694064(0x255)](_0x450fb1,_0x694064(0x1e0)),_0x1c36ad=parseAgentYaml(a148_0x5d1e61[_0x694064(0x28c)](_0x360142,'utf-8'),_0x360142),_0x2b0ead=a148_0x5d1e61[_0x694064(0x20e)](_0xc02ba7)?a148_0x5d1e61[_0x694064(0x28c)](_0xc02ba7,'utf-8'):'',_0x4a7ac7=a148_0x5d1e61['existsSync'](_0x371655)?a148_0x5d1e61['readFileSync'](_0x371655,_0x694064(0x213)):_0x1c36ad[_0x694064(0x1c1)];_0x5a0687[_0x694064(0x1c4)]({'name':_0x1c36ad[_0x694064(0x289)],'dir':_0x450fb1,'yaml':_0x1c36ad,'systemPrompt':_0x2b0ead,'starterMessage':_0x4a7ac7});}}const _0x1e5120=getKnowledgeBasesDir(_0x503b92);if(a148_0x5d1e61[_0x694064(0x20e)](_0x1e5120)){const _0x4d6240=a148_0x5d1e61[_0x694064(0x196)](_0x1e5120);for(const _0x22f3ba of _0x4d6240){const _0x5e7692=a148_0x235a2d[_0x694064(0x255)](_0x1e5120,_0x22f3ba);if(_0x22f3ba[_0x694064(0x29f)](_0x694064(0x24b))){const _0x540053=parseKnowledgeBaseYaml(a148_0x5d1e61[_0x694064(0x28c)](_0x5e7692,'utf-8'),_0x5e7692);_0x402507[_0x694064(0x1c4)]({'name':_0x540053['name'],'path':_0x5e7692,'yaml':_0x540053});}else{if(_0x22f3ba[_0x694064(0x29f)]('.md')){const _0x4f90e1=a148_0x5d1e61[_0x694064(0x28c)](_0x5e7692,'utf-8'),{name:_0x113fa4,text:_0x180fb5}=parseTextKnowledgeBaseMd(_0x4f90e1,_0x22f3ba);_0x4791b1[_0x694064(0x1c4)]({'name':_0x113fa4,'path':_0x5e7692,'text':_0x180fb5});}}}}const _0xd04061=getPromptsDir(_0x503b92);if(a148_0x5d1e61['existsSync'](_0xd04061)){const _0xf00edc=a148_0x5d1e61[_0x694064(0x196)](_0xd04061)['filter'](_0x371f43=>_0x371f43[_0x694064(0x29f)](_0x694064(0x24b)));for(const _0x5550c9 of _0xf00edc){const _0x34a013=a148_0x235a2d['join'](_0xd04061,_0x5550c9),_0x5cfaac=parsePromptYaml(a148_0x5d1e61['readFileSync'](_0x34a013,_0x694064(0x213)),_0x34a013);_0x368947[_0x694064(0x1c4)]({'name':_0x5cfaac[_0x694064(0x289)],'path':_0x34a013,'yaml':_0x5cfaac});}}const _0x41f81d=getIntegrationsDir(_0x503b92);if(a148_0x5d1e61[_0x694064(0x20e)](_0x41f81d)){const _0x5ddc30=a148_0x5d1e61[_0x694064(0x196)](_0x41f81d)[_0x694064(0x1ca)](_0x3d6069=>_0x3d6069[_0x694064(0x29f)]('.yml'));for(const _0x5a2e8d of _0x5ddc30){const _0x185df6=a148_0x235a2d[_0x694064(0x255)](_0x41f81d,_0x5a2e8d),_0x45cc05=parseIntegrationYaml(a148_0x5d1e61['readFileSync'](_0x185df6,'utf-8'),_0x185df6);SAFE_INTEGRATION_TYPES[_0x694064(0x1ee)](_0x45cc05[_0x694064(0x283)]['toLowerCase']())?_0xaa0da7[_0x694064(0x1c4)]({'name':_0x45cc05[_0x694064(0x289)],'path':_0x185df6,'yaml':_0x45cc05}):this[_0x694064(0x231)][_0x694064(0x20d)](_0x694064(0x28f)+_0x45cc05['name']+_0x694064(0x27e)+_0x45cc05[_0x694064(0x283)]+_0x694064(0x23e)+(_0x694064(0x279)+SAFE_INTEGRATION_TYPES[_0x694064(0x255)](',\x20')+_0x694064(0x2b2)));}}const _0x4d6ad9=getExperimentalKnowledgeBasesDir(_0x503b92);if(a148_0x5d1e61[_0x694064(0x20e)](_0x4d6ad9)){const _0x2ed559=a148_0x5d1e61[_0x694064(0x196)](_0x4d6ad9,{'withFileTypes':!![]});for(const _0xc83438 of _0x2ed559){if(!_0xc83438[_0x694064(0x1c2)]())continue;const _0x34e25c=a148_0x235a2d[_0x694064(0x255)](_0x4d6ad9,_0xc83438['name']),_0x361af0=a148_0x235a2d['join'](_0x34e25c,_0xc83438[_0x694064(0x289)]+'.yml');if(a148_0x5d1e61[_0x694064(0x20e)](_0x361af0)){const _0x791e7a=parseExperimentalKnowledgeBaseYaml(a148_0x5d1e61[_0x694064(0x28c)](_0x361af0,_0x694064(0x213)),_0x361af0),_0x2902dd=a148_0x235a2d[_0x694064(0x255)](_0x34e25c,_0x694064(0x207)),_0x42e7b2=[];if(a148_0x5d1e61[_0x694064(0x20e)](_0x2902dd)){const _0x4a34fc=a148_0x5d1e61[_0x694064(0x196)](_0x2902dd,{'withFileTypes':!![]});for(const _0x44a009 of _0x4a34fc){if(!_0x44a009[_0x694064(0x1c2)]())continue;const _0x2b89da=a148_0x235a2d[_0x694064(0x255)](_0x2902dd,_0x44a009[_0x694064(0x289)]),_0x1a8ab3=a148_0x235a2d[_0x694064(0x255)](_0x2b89da,_0x694064(0x244)),_0x56a1b7=a148_0x235a2d[_0x694064(0x255)](_0x2b89da,_0x694064(0x219));if(a148_0x5d1e61['existsSync'](_0x1a8ab3)&&a148_0x5d1e61['existsSync'](_0x56a1b7)){const _0x53d2f9=a148_0x5d1e61[_0x694064(0x28c)](_0x1a8ab3,'utf-8'),_0x841455=a148_0x5d1e61[_0x694064(0x28c)](_0x56a1b7,_0x694064(0x213));_0x42e7b2[_0x694064(0x1c4)]({'name':_0x44a009[_0x694064(0x289)],'code':_0x53d2f9,'json_schema':_0x841455});}}}const _0xff3589={..._0x791e7a,'functions':_0x42e7b2};_0x446c56[_0x694064(0x1c4)]({'name':_0x791e7a[_0x694064(0x289)],'path':_0x34e25c,'def':_0xff3589});}}}const _0x3d482b=getExperimentalArtifactsDir(_0x503b92);if(a148_0x5d1e61[_0x694064(0x20e)](_0x3d482b)){const _0x1fbffb=a148_0x5d1e61[_0x694064(0x196)](_0x3d482b,{'withFileTypes':!![]});for(const _0x40323c of _0x1fbffb){if(!_0x40323c['isDirectory']())continue;const _0x4ddae6=a148_0x235a2d[_0x694064(0x255)](_0x3d482b,_0x40323c['name']),_0x339927=a148_0x235a2d[_0x694064(0x255)](_0x4ddae6,_0x40323c[_0x694064(0x289)]+_0x694064(0x24b));if(a148_0x5d1e61[_0x694064(0x20e)](_0x339927)){const _0x3e05a4=parseExperimentalArtifactYaml(a148_0x5d1e61[_0x694064(0x28c)](_0x339927,_0x694064(0x213)),_0x339927),_0x4b451a=a148_0x235a2d[_0x694064(0x255)](_0x4ddae6,'code.js'),_0x54ac41=a148_0x5d1e61[_0x694064(0x20e)](_0x4b451a)?a148_0x5d1e61[_0x694064(0x28c)](_0x4b451a,'utf-8'):'',_0x43962b=a148_0x235a2d[_0x694064(0x255)](_0x4ddae6,'files'),_0xeeaade=[];if(a148_0x5d1e61[_0x694064(0x20e)](_0x43962b)){const _0x1ec50f=a148_0x5d1e61[_0x694064(0x196)](_0x43962b);for(const _0x1fd6b0 of _0x1ec50f){const _0x51423e=a148_0x235a2d['join'](_0x43962b,_0x1fd6b0);if(a148_0x5d1e61['statSync'](_0x51423e)[_0x694064(0x1bd)]()){const _0x254cc5=a148_0x5d1e61[_0x694064(0x28c)](_0x51423e,_0x694064(0x213));_0xeeaade['push']({'file_name':_0x1fd6b0,'text_content':_0x254cc5});}}}const _0x1d57a0={..._0x3e05a4,'code':_0x54ac41,'files':_0xeeaade};_0x6899eb[_0x694064(0x1c4)]({'name':_0x3e05a4[_0x694064(0x289)],'path':_0x4ddae6,'def':_0x1d57a0});}}}const _0x16d5c5=getFormInterfacesDir(_0x503b92);if(a148_0x5d1e61[_0x694064(0x20e)](_0x16d5c5)){const _0x337a87=a148_0x5d1e61['readdirSync'](_0x16d5c5)[_0x694064(0x1ca)](_0x5735c9=>_0x5735c9[_0x694064(0x29f)](_0x694064(0x24b)));for(const _0x3a33d3 of _0x337a87){const _0x5bfb2a=a148_0x235a2d[_0x694064(0x255)](_0x16d5c5,_0x3a33d3),_0x33a281=parseFormInterfaceYaml(a148_0x5d1e61[_0x694064(0x28c)](_0x5bfb2a,_0x694064(0x213)),_0x5bfb2a);_0x3f21f9[_0x694064(0x1c4)]({'name':_0x33a281[_0x694064(0x289)],'path':_0x5bfb2a,'yaml':_0x33a281});}}const _0x99ffd4=getChatInterfacesDir(_0x503b92);if(a148_0x5d1e61[_0x694064(0x20e)](_0x99ffd4)){const _0x53c84c=a148_0x5d1e61['readdirSync'](_0x99ffd4)['filter'](_0x2e002b=>_0x2e002b[_0x694064(0x29f)]('.yml'));for(const _0x12bce9 of _0x53c84c){const _0x2a0f10=a148_0x235a2d[_0x694064(0x255)](_0x99ffd4,_0x12bce9),_0x226d63=parseChatInterfaceYaml(a148_0x5d1e61[_0x694064(0x28c)](_0x2a0f10,'utf-8'),_0x2a0f10);_0x2a7699[_0x694064(0x1c4)]({'name':_0x226d63[_0x694064(0x289)],'path':_0x2a0f10,'yaml':_0x226d63});}}}else{const _0x37ea5e=await this[_0x694064(0x2ae)](_0x503b92),_0x39386d=await this['client'][_0x694064(0x2a6)](_0x37ea5e);_0xefc594=_0x39386d[_0x694064(0x26a)][_0x694064(0x289)];const _0x24afc2=await this[_0x694064(0x215)][_0x694064(0x217)](_0x37ea5e),_0x48fd1c=await this[_0x694064(0x215)][_0x694064(0x251)](_0x37ea5e),_0x1a9df1=await this['client'][_0x694064(0x22c)](_0x37ea5e),_0x13a044=await this[_0x694064(0x215)][_0x694064(0x249)](_0x37ea5e),_0x44aaac=await this['client']['listIntegrations'](_0x37ea5e),_0x5310dc=await safeListOrEmpty(()=>this['client'][_0x694064(0x262)](_0x37ea5e)),_0x161e74=await safeListOrEmpty(()=>this[_0x694064(0x215)]['listExperimentalArtifacts'](_0x37ea5e)),_0x2efb1c=new Map(),_0xe48cf7=new Map(),_0x10f1e5=new Map(),_0x4c0da1=new Map(),_0x347b9a=new Map(),_0x1c0f0a=new Map();for(const _0x598359 of _0x48fd1c){_0x2efb1c[_0x694064(0x24c)](_0x598359['id'],_0x598359[_0x694064(0x26a)][_0x694064(0x289)]);}for(const _0x52a150 of _0x1a9df1){_0xe48cf7[_0x694064(0x24c)](_0x52a150['id'],_0x52a150[_0x694064(0x26a)][_0x694064(0x289)]);}for(const _0x50a327 of _0x24afc2){_0x10f1e5[_0x694064(0x24c)](_0x50a327['id'],_0x50a327[_0x694064(0x26a)][_0x694064(0x289)]);}for(const _0x86790f of _0x13a044){_0x4c0da1[_0x694064(0x24c)](_0x86790f['id'],_0x86790f[_0x694064(0x26a)]['name']);}for(const _0x223e57 of _0x5310dc){_0x347b9a[_0x694064(0x24c)](_0x223e57['id'],_0x223e57[_0x694064(0x26a)][_0x694064(0x289)]);}for(const _0x3ef841 of _0x161e74){_0x1c0f0a[_0x694064(0x24c)](_0x3ef841['id'],_0x3ef841[_0x694064(0x26a)][_0x694064(0x289)]);}const _0x1b8b48={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x2efb1c,'TextKnowledgeBase':_0xe48cf7,'Agent':_0x10f1e5,'ExperimentalKnowledgeBase':_0x347b9a}),'resolvePromptName':async _0x1a960d=>_0x4c0da1[_0x694064(0x226)](_0x1a960d),'onWarning':_0x108e52=>this['logger'][_0x694064(0x20d)](_0x108e52)};for(const _0x1e7b41 of _0x24afc2){const _0x558abd=await agentResponseToDef(_0x1e7b41,_0x1b8b48),{yaml:_0x43ceb5,systemPrompt:_0x453e4d,starterMessage:_0x2e7d25}=_0x558abd;_0x5a0687[_0x694064(0x1c4)]({'name':_0x43ceb5[_0x694064(0x289)],'dir':'','yaml':_0x43ceb5,'systemPrompt':_0x453e4d,'starterMessage':_0x2e7d25});}for(const _0x7a5b22 of _0x48fd1c){const _0x47e49f=apiKnowledgeBaseToYaml(_0x7a5b22);_0x402507[_0x694064(0x1c4)]({'name':_0x47e49f['name'],'path':'','yaml':_0x47e49f});}for(const _0xf809eb of _0x1a9df1){_0x4791b1[_0x694064(0x1c4)]({'name':_0xf809eb[_0x694064(0x26a)][_0x694064(0x289)],'path':'','text':_0xf809eb[_0x694064(0x26a)]['text']});}for(const _0x291568 of _0x13a044){const _0x2e3ed1=await apiPromptToYaml(_0x291568,_0x1b8b48);_0x2e3ed1&&_0x368947[_0x694064(0x1c4)]({'name':_0x2e3ed1[_0x694064(0x289)],'path':'','yaml':_0x2e3ed1});}for(const _0x59ec64 of _0x44aaac){if(!_0x59ec64[_0x694064(0x26a)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x694064(0x1ee)](_0x59ec64['attributes'][_0x694064(0x20f)][_0x694064(0x2a7)]())){const _0x1a7dfa=await apiIntegrationToYaml(_0x59ec64,_0x1b8b48);_0xaa0da7['push']({'name':_0x59ec64['attributes'][_0x694064(0x20f)][_0x694064(0x2a7)](),'path':'','yaml':_0x1a7dfa});}}for(const _0x2671d1 of _0x5310dc){const _0x3b3df1=apiExperimentalKnowledgeBaseToYaml(_0x2671d1);_0x446c56['push']({'name':_0x3b3df1[_0x694064(0x289)],'path':'','def':_0x3b3df1});}for(const _0x357352 of _0x161e74){const _0x2db053=apiExperimentalArtifactToYaml(_0x357352);_0x6899eb[_0x694064(0x1c4)]({'name':_0x2db053[_0x694064(0x289)],'path':'','def':_0x2db053});}const _0x49c074=await safeListOrEmpty(()=>this[_0x694064(0x215)]['listFormInterfaces'](_0x37ea5e));for(const _0x42e958 of _0x49c074){const _0x46ea35=await apiFormInterfaceToYaml(_0x42e958,_0x1b8b48);_0x3f21f9[_0x694064(0x1c4)]({'name':_0x46ea35[_0x694064(0x289)],'path':'','yaml':_0x46ea35});}const _0x3451c0=await safeListOrEmpty(()=>this[_0x694064(0x215)][_0x694064(0x263)](_0x37ea5e));for(const _0x5d8378 of _0x3451c0){if(_0x5d8378['attributes'][_0x694064(0x1fd)])continue;const _0x3c5a26=await apiChatInterfaceToYaml(_0x5d8378,_0x1b8b48);_0x2a7699[_0x694064(0x1c4)]({'name':_0x3c5a26['name'],'path':'','yaml':_0x3c5a26});}}const _0x5f39e2={'sourceProjectName':_0xefc594,'newProjectName':_0x1e4bea,'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}}},_0x3b3645=await this[_0x694064(0x215)][_0x694064(0x246)](),_0x384247=_0x3b3645[_0x694064(0x227)](_0x462f1d=>_0x462f1d[_0x694064(0x26a)][_0x694064(0x289)]===_0x1e4bea);if(_0x384247)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x694064(0x1c7)+_0x1e4bea+'\x22\x20already\x20exists',undefined,{'helpText':_0x694064(0x266)});if(_0x1d8e44?.['dryRun'])return _0x5f39e2[_0x694064(0x293)]['agents'][_0x694064(0x1f6)]=_0x5a0687[_0x694064(0x1a9)],_0x5f39e2[_0x694064(0x293)][_0x694064(0x1c8)][_0x694064(0x1f6)]=_0x402507[_0x694064(0x1a9)],_0x5f39e2[_0x694064(0x293)]['textKnowledgeBases'][_0x694064(0x1f6)]=_0x4791b1[_0x694064(0x1a9)],_0x5f39e2[_0x694064(0x293)][_0x694064(0x1cd)]['created']=_0x446c56['length'],_0x5f39e2[_0x694064(0x293)][_0x694064(0x1f0)][_0x694064(0x1f6)]=_0x6899eb['length'],_0x5f39e2[_0x694064(0x293)][_0x694064(0x225)][_0x694064(0x1f6)]=_0x368947['length'],_0x5f39e2[_0x694064(0x293)][_0x694064(0x229)][_0x694064(0x1f6)]=_0xaa0da7[_0x694064(0x1a9)],_0x5f39e2;const _0x27329d=await this[_0x694064(0x215)][_0x694064(0x253)]({'name':_0x1e4bea}),_0x49d721=_0x27329d['id'];_0x5f39e2['newProjectId']=_0x49d721;const _0x326424=new Map(),_0x8987a6=new Map(),_0xfefd5=new Map(),_0x5bee6f=new Map(),_0x31ec6a=new Map(),_0x23fd2b=new Map(),_0x432f89=new Map(),_0xd28e63=new Map(),_0x5224c9=new Set(),_0x3a9fdb=new Set();for(const _0x1b1f57 of _0x5a0687){for(const _0x35b3b0 of _0x1b1f57[_0x694064(0x25b)][_0x694064(0x1a4)]||[]){if(_0x35b3b0[_0x694064(0x19e)]===_0x694064(0x206)&&_0x35b3b0[_0x694064(0x29d)]){const _0x505db7=parseRef(_0x35b3b0[_0x694064(0x29d)]);if(_0x505db7)_0x5224c9[_0x694064(0x235)](_0x505db7['name']);}else{if(_0x35b3b0[_0x694064(0x19e)]===_0x694064(0x1c3)&&_0x35b3b0[_0x694064(0x29d)]){const _0x42160a=parseRef(_0x35b3b0[_0x694064(0x29d)]);if(_0x42160a)_0x3a9fdb[_0x694064(0x235)](_0x42160a['name']);}}}}for(const _0x378c7d of _0x5224c9){try{const _0x5b323f=await this['client']['createImageGenerator']({'projectId':_0x49d721,'name':_0x378c7d});_0x31ec6a['set'](_0x378c7d,_0x5b323f['id']),_0x5f39e2[_0x694064(0x224)][_0x694064(0x1c4)]({'name':_0x378c7d,'action':_0x694064(0x1f6),'id':_0x5b323f['id']}),_0x5f39e2[_0x694064(0x293)][_0x694064(0x224)][_0x694064(0x1f6)]++;}catch(_0x58ab82){_0x5f39e2[_0x694064(0x224)]['push']({'name':_0x378c7d,'action':'error','error':_0x58ab82[_0x694064(0x282)]}),_0x5f39e2[_0x694064(0x293)][_0x694064(0x224)][_0x694064(0x270)]++;}}for(const _0x44df68 of _0x3a9fdb){try{const _0x4cbf7a=await this[_0x694064(0x215)][_0x694064(0x214)]({'projectId':_0x49d721,'name':_0x44df68});_0x23fd2b[_0x694064(0x24c)](_0x44df68,_0x4cbf7a['id']),_0x5f39e2[_0x694064(0x234)][_0x694064(0x1c4)]({'name':_0x44df68,'action':'created','id':_0x4cbf7a['id']}),_0x5f39e2[_0x694064(0x293)]['webSearchTools']['created']++;}catch(_0x48f141){_0x5f39e2[_0x694064(0x234)][_0x694064(0x1c4)]({'name':_0x44df68,'action':_0x694064(0x1b5),'error':_0x48f141[_0x694064(0x282)]}),_0x5f39e2['counts'][_0x694064(0x234)][_0x694064(0x270)]++;}}const _0x4263e2=await fetchAllToolTargetMaps((_0x437399,_0x1aa6c6)=>this[_0x694064(0x215)][_0x694064(0x1bc)](_0x437399,_0x1aa6c6),_0x49d721);let _0x46651c=[];const _0x356390={'projectId':_0x49d721,'resolveToolTargetId':buildIdResolver({..._0x4263e2[_0x694064(0x2a4)],'KnowledgeBase':_0x326424,'TextKnowledgeBase':_0x8987a6,'ExperimentalKnowledgeBase':_0x432f89,'Agent':_0xfefd5,'WebSearchTool':_0x23fd2b,'ImageGenerator':_0x31ec6a}),'resolvePromptId':async _0x477cbd=>_0x5bee6f[_0x694064(0x226)](_0x477cbd),'onWarning':_0x2edf2c=>{const _0x19553e=_0x694064;this[_0x19553e(0x231)]['warn'](_0x2edf2c),_0x46651c[_0x19553e(0x1c4)](_0x2edf2c);}};for(const _0x4c2775 of _0x402507){try{const _0x2bb943=yamlKnowledgeBaseToApi(_0x4c2775[_0x694064(0x25b)],_0x49d721),_0x279f97=await this[_0x694064(0x215)][_0x694064(0x1f3)](_0x2bb943);_0x326424[_0x694064(0x24c)](_0x4c2775['yaml'][_0x694064(0x289)],_0x279f97['id']),_0x5f39e2[_0x694064(0x1c8)][_0x694064(0x1c4)]({'name':_0x4c2775['yaml']['name'],'action':'created','id':_0x279f97['id']}),_0x5f39e2[_0x694064(0x293)][_0x694064(0x1c8)][_0x694064(0x1f6)]++;}catch(_0x3c431b){_0x5f39e2[_0x694064(0x1c8)]['push']({'name':_0x4c2775['yaml'][_0x694064(0x289)],'action':'error','error':_0x3c431b[_0x694064(0x282)]}),_0x5f39e2[_0x694064(0x293)][_0x694064(0x1c8)][_0x694064(0x270)]++;}}for(const _0x25d5c2 of _0x4791b1){try{const _0x113ac4=yamlTextKnowledgeBaseToApi({'name':_0x25d5c2['name'],'text':_0x25d5c2[_0x694064(0x29e)]},_0x49d721),_0x50e3d5=await this[_0x694064(0x215)][_0x694064(0x1fc)](_0x113ac4);_0x8987a6[_0x694064(0x24c)](_0x25d5c2[_0x694064(0x289)],_0x50e3d5['id']),_0x5f39e2['textKnowledgeBases'][_0x694064(0x1c4)]({'name':_0x25d5c2['name'],'action':_0x694064(0x1f6),'id':_0x50e3d5['id']}),_0x5f39e2[_0x694064(0x293)]['textKnowledgeBases'][_0x694064(0x1f6)]++;}catch(_0x2ab062){_0x5f39e2[_0x694064(0x20c)][_0x694064(0x1c4)]({'name':_0x25d5c2['name'],'action':_0x694064(0x1b5),'error':_0x2ab062[_0x694064(0x282)]}),_0x5f39e2[_0x694064(0x293)][_0x694064(0x20c)][_0x694064(0x270)]++;}}for(const _0x9ee1ea of _0x6899eb){try{const _0x39df5d=yamlExperimentalArtifactToApi(_0x9ee1ea[_0x694064(0x256)],_0x49d721),_0x24e725=await this[_0x694064(0x215)][_0x694064(0x1de)](_0x39df5d);_0xd28e63['set'](_0x9ee1ea['def'][_0x694064(0x289)],_0x24e725['id']),_0x5f39e2[_0x694064(0x1f0)][_0x694064(0x1c4)]({'name':_0x9ee1ea[_0x694064(0x256)][_0x694064(0x289)],'action':_0x694064(0x1f6),'id':_0x24e725['id']}),_0x5f39e2[_0x694064(0x293)][_0x694064(0x1f0)][_0x694064(0x1f6)]++;}catch(_0x446a58){_0x5f39e2[_0x694064(0x1f0)][_0x694064(0x1c4)]({'name':_0x9ee1ea[_0x694064(0x256)]['name'],'action':_0x694064(0x1b5),'error':_0x446a58[_0x694064(0x282)]}),_0x5f39e2['counts']['experimentalArtifacts'][_0x694064(0x270)]++;}}for(const _0x51536b of _0x446c56){try{const _0xb86877=yamlExperimentalKnowledgeBaseToApi(_0x51536b[_0x694064(0x256)],_0x49d721),_0x37a329=await this['client'][_0x694064(0x1b4)](_0xb86877);_0x432f89[_0x694064(0x24c)](_0x51536b[_0x694064(0x256)]['name'],_0x37a329['id']),_0x5f39e2[_0x694064(0x1cd)][_0x694064(0x1c4)]({'name':_0x51536b[_0x694064(0x256)][_0x694064(0x289)],'action':_0x694064(0x1f6),'id':_0x37a329['id']}),_0x5f39e2[_0x694064(0x293)][_0x694064(0x1cd)]['created']++;}catch(_0xe2e029){_0x5f39e2[_0x694064(0x1cd)][_0x694064(0x1c4)]({'name':_0x51536b[_0x694064(0x256)][_0x694064(0x289)],'action':_0x694064(0x1b5),'error':_0xe2e029['message']}),_0x5f39e2[_0x694064(0x293)][_0x694064(0x1cd)][_0x694064(0x270)]++;}}const _0xac6d86=[..._0x5a0687][_0x694064(0x296)]((_0x5da637,_0x1b905c)=>{const _0x3e98dd=_0x694064,_0x1911c7=_0x5da637[_0x3e98dd(0x25b)]['tools']?.[_0x3e98dd(0x1b0)](_0x3f9398=>_0x3f9398[_0x3e98dd(0x19e)]==='agent')??![],_0x2b101=_0x1b905c[_0x3e98dd(0x25b)][_0x3e98dd(0x1a4)]?.['some'](_0x2e6883=>_0x2e6883['type']===_0x3e98dd(0x2ac))??![];if(_0x1911c7&&!_0x2b101)return 0x1;if(!_0x1911c7&&_0x2b101)return-0x1;return 0x0;});for(const _0x381135 of _0xac6d86){_0x46651c=[];try{const _0x301261=_0x381135[_0x694064(0x25b)][_0x694064(0x1a4)]?.[_0x694064(0x1ca)](_0x108f09=>{const _0xf89c59=_0x694064;if(_0x108f09['type']===_0xf89c59(0x2ac)&&_0x108f09[_0xf89c59(0x29d)]){const _0x342a2d=parseRef(_0x108f09[_0xf89c59(0x29d)]);return _0x342a2d?.[_0xf89c59(0x289)]===_0x381135[_0xf89c59(0x25b)][_0xf89c59(0x289)];}return![];})??[];if(_0x301261[_0x694064(0x1a9)]>0x0){const _0x5112ea=_0x694064(0x238)+_0x381135[_0x694064(0x25b)][_0x694064(0x289)]+'\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20'+_0x694064(0x240);this[_0x694064(0x231)][_0x694064(0x20d)](_0x5112ea),_0x46651c[_0x694064(0x1c4)](_0x5112ea);}const _0x1f358d=await agentDefToRequest(_0x381135[_0x694064(0x25b)],_0x381135['systemPrompt'],_0x381135[_0x694064(0x1fa)],_0x356390),_0x28c4ce=await this[_0x694064(0x215)]['createAgentResponse'](_0x1f358d);_0xfefd5[_0x694064(0x24c)](_0x381135['yaml'][_0x694064(0x289)],_0x28c4ce['id']),_0x5f39e2['agents'][_0x694064(0x1c4)]({'agentName':_0x381135[_0x694064(0x25b)]['name'],'action':'created','agentId':_0x28c4ce['id'],'warnings':_0x46651c[_0x694064(0x1a9)]>0x0?_0x46651c:undefined}),_0x5f39e2[_0x694064(0x293)][_0x694064(0x1ed)][_0x694064(0x1f6)]++;}catch(_0x3f5d0a){_0x5f39e2[_0x694064(0x1ed)][_0x694064(0x1c4)]({'agentName':_0x381135[_0x694064(0x25b)][_0x694064(0x289)],'action':_0x694064(0x1b5),'error':_0x3f5d0a[_0x694064(0x282)],'warnings':_0x46651c[_0x694064(0x1a9)]>0x0?_0x46651c:undefined}),_0x5f39e2['counts']['agents'][_0x694064(0x270)]++;}}for(const _0x22cf8f of _0x368947){try{const _0x589913=await yamlPromptToApi(_0x22cf8f[_0x694064(0x25b)],_0x49d721,_0x356390);if(!_0x589913){_0x5f39e2['prompts'][_0x694064(0x1c4)]({'name':_0x22cf8f[_0x694064(0x25b)][_0x694064(0x289)],'action':_0x694064(0x1b5),'error':_0x694064(0x286)}),_0x5f39e2[_0x694064(0x293)]['prompts']['errors']++;continue;}const _0x31acdc=await this[_0x694064(0x215)]['createPrompt'](_0x589913);_0x5bee6f[_0x694064(0x24c)](_0x22cf8f[_0x694064(0x25b)]['name'],_0x31acdc['id']),_0x5f39e2[_0x694064(0x225)]['push']({'name':_0x22cf8f[_0x694064(0x25b)][_0x694064(0x289)],'action':_0x694064(0x1f6),'id':_0x31acdc['id']}),_0x5f39e2[_0x694064(0x293)][_0x694064(0x225)]['created']++;}catch(_0x3f454b){_0x5f39e2[_0x694064(0x225)]['push']({'name':_0x22cf8f[_0x694064(0x25b)]['name'],'action':_0x694064(0x1b5),'error':_0x3f454b[_0x694064(0x282)]}),_0x5f39e2['counts']['prompts'][_0x694064(0x270)]++;}}for(const _0x138925 of _0xaa0da7){try{const _0x462e99=await yamlIntegrationToApi(_0x138925[_0x694064(0x25b)],_0x49d721,_0x356390),_0x27c3a4=await this['client'][_0x694064(0x26f)](_0x462e99);_0x5f39e2[_0x694064(0x229)][_0x694064(0x1c4)]({'name':_0x138925[_0x694064(0x25b)][_0x694064(0x283)],'action':_0x694064(0x1f6),'id':_0x27c3a4['id']}),_0x5f39e2[_0x694064(0x293)]['integrations'][_0x694064(0x1f6)]++;}catch(_0x172255){_0x5f39e2[_0x694064(0x229)][_0x694064(0x1c4)]({'name':_0x138925['yaml']['service_type'],'action':_0x694064(0x1b5),'error':_0x172255[_0x694064(0x282)]}),_0x5f39e2[_0x694064(0x293)][_0x694064(0x229)][_0x694064(0x270)]++;}}for(const _0x46d362 of _0x3f21f9){try{const _0x1c9bca=await yamlFormInterfaceToApi(_0x46d362[_0x694064(0x25b)],_0x49d721,_0x356390);if(!_0x1c9bca){_0x5f39e2[_0x694064(0x247)][_0x694064(0x1c4)]({'name':_0x46d362['yaml'][_0x694064(0x289)],'action':_0x694064(0x1b5),'error':_0x694064(0x1cf)}),_0x5f39e2[_0x694064(0x293)][_0x694064(0x247)][_0x694064(0x270)]++;continue;}const _0x55c26c=await this[_0x694064(0x215)][_0x694064(0x191)](_0x1c9bca);_0x5f39e2['formInterfaces'][_0x694064(0x1c4)]({'name':_0x46d362[_0x694064(0x25b)][_0x694064(0x289)],'action':'created','id':_0x55c26c['id']}),_0x5f39e2[_0x694064(0x293)]['formInterfaces'][_0x694064(0x1f6)]++;}catch(_0x444524){_0x5f39e2[_0x694064(0x247)][_0x694064(0x1c4)]({'name':_0x46d362[_0x694064(0x25b)][_0x694064(0x289)],'action':_0x694064(0x1b5),'error':_0x444524[_0x694064(0x282)]}),_0x5f39e2[_0x694064(0x293)][_0x694064(0x247)][_0x694064(0x270)]++;}}for(const _0x236b4c of _0x2a7699){try{const _0x45affd=await yamlChatInterfaceToApi(_0x236b4c[_0x694064(0x25b)],_0x49d721,_0x356390),_0x3b24fe=await this[_0x694064(0x215)][_0x694064(0x21b)](_0x45affd);_0x5f39e2[_0x694064(0x27c)]['push']({'name':_0x236b4c[_0x694064(0x25b)][_0x694064(0x289)],'action':_0x694064(0x1f6),'id':_0x3b24fe['id']}),_0x5f39e2[_0x694064(0x293)][_0x694064(0x27c)][_0x694064(0x1f6)]++;}catch(_0x20f680){_0x5f39e2['chatInterfaces'][_0x694064(0x1c4)]({'name':_0x236b4c['yaml'][_0x694064(0x289)],'action':'error','error':_0x20f680['message']}),_0x5f39e2[_0x694064(0x293)]['chatInterfaces'][_0x694064(0x270)]++;}}return _0x5f39e2;}}
|