@treasuredata/tdx 2026.8.1 → 2026.8.2
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.js +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.js +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_0x3b70c0=a148_0x3cba;(function(_0x43f24d,_0x54011e){const _0x23aad9=a148_0x3cba,_0x296f68=_0x43f24d();while(!![]){try{const _0x18c787=-parseInt(_0x23aad9(0x203))/0x1*(parseInt(_0x23aad9(0x255))/0x2)+parseInt(_0x23aad9(0x199))/0x3+-parseInt(_0x23aad9(0x176))/0x4+-parseInt(_0x23aad9(0x1ae))/0x5*(parseInt(_0x23aad9(0x1e5))/0x6)+parseInt(_0x23aad9(0x274))/0x7+-parseInt(_0x23aad9(0x253))/0x8*(-parseInt(_0x23aad9(0x1c4))/0x9)+parseInt(_0x23aad9(0x227))/0xa*(-parseInt(_0x23aad9(0x284))/0xb);if(_0x18c787===_0x54011e)break;else _0x296f68['push'](_0x296f68['shift']());}catch(_0x23c6aa){_0x296f68['push'](_0x296f68['shift']());}}}(a148_0x4b1a,0x82bdf));import{LLMApiClient}from'../client/llm-api-client.js';import*as a148_0x16858c from'node:fs';import*as a148_0x31cc73 from'node:path';function a148_0x4b1a(){const _0xa18714=['reasoningEffort','resolveAgentId','ExperimentalKnowledgeBase','join','context','has','target','chatInterfaces','getDefaultAgent','size','knowledgebases.json','metadata','LLM_PROJECT_NOT_FOUND','createWebSearchTool','prompt.md','knowledge_bases','agents','version','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','signal',')\x20can\x20be\x20cloned.','filter','warn','unchanged','resolveProjectName','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','def','.yml','error','agent.yml','469014lEHGAV','type','startChat','code.js','prompts.json','isFile','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.','.llm','listChats','event','path','file_name','cwd','listChatInterfaces','agent','statSync','Renamed\x20experimental\x20KB\x20directory:\x20','\x0a\x0a#\x20agent.yml\x0a','Renamed\x20integration\x20file:\x20','profile','toLowerCase','1445615HrLAuR','push','updateAgent','form_interfaces','getBackupMetadata','claude-4.5-sonnet','\x22\x20already\x20exists','deleteProject','listPrompts','length','modelType','renamed','pullProject','createPrompt','currentProjectId','Multiple\x20projects\x20found\x20with\x20name\x20\x27','new','experimental_knowledge_bases','starterMessage','integrations.json','readdirSync','llm_project','198fKuPTl','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','json_schema.json','info','UNAUTHENTICATED','listToolTargets','sort','models','listKnowledgeBases','tables','Skipping\x20integration\x20\x27','high','createImageGenerator','site','formInterfaces','\x20---\x0a','promptId','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','Multiple\x20agents\x20found\x20with\x20name\x20\x27','\x20→\x20','NOT_FOUND','listFormInterfaces','listAgentsFull','Unresolved\x20dependencies:\x20','Project\x20not\x20found:\x20','map','set','listAgents','\x0a---\x20function:\x20','projects','logger','listExperimentalKnowledgeBases','listWebSearchTools','6pByjAN','tdx.json','already\x20exists','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','imageGenerators','minimal','localeCompare','listProjects','getChatHistory','createTextKnowledgeBase','Renamed\x20chat\x20interface\x20file:\x20','some','tdx_default_','loadJsonFile','Unable\x20to\x20create\x20project\x20after\x20','getProject','resolveProjectId','tdDatabaseName','nameToId','listIntegrations','Invalid\x20agent\x20reference\x20format:\x20','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','knowledgeBases','outputs','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','\x27\x20(','description','continueChat','attributes','_reasoning_','3OIrmMC','dirname','existsSync','dryRun','maxToolIterations','utf-8','createAgentResponse','Only\x20safe\x20types\x20(','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','INTERNAL','errors','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','Renamed\x20experimental\x20artifact\x20directory:\x20','add','readFileSync','createExperimentalArtifact','includes','chat_generic','sdk.llm','experimentalArtifacts',')\x20can\x20be\x20pushed.\x20','chatIgnoreManagedActions','chat_interfaces','stringify','agents.json','action','get','ALREADY_EXISTS','Renamed\x20form\x20interface\x20file:\x20','name','counts','updateChatInterface','.md','client','pullAgent','10BBdBNa','prompts','Could\x20not\x20resolve\x20agent\x20reference','#\x20prompt.md\x0a','---\x20file:\x20','template','webhookCorsOrigins','getDefaultProjectName','\x0a---\x20code\x20---\x0a','chat','functions','textKnowledgeBases','Renamed\x20KB\x20file:\x20','Agent\x20not\x20found:\x20','service_type','experimentalKnowledgeBases','createFormInterface','getAgent','status','tools','tdx_','getOrCreateDefaultProject','KnowledgeBase','endsWith','updated','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','yaml','updatePrompt','isDirectory','created','text','basename','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','Renamed\x20folder:\x20','toISOString','Renamed\x20prompt\x20file:\x20','dry-run-','isDir','experimental_artifacts','files','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','content','agentsFull','Renamed\x20text\x20KB\x20file:\x20','238984DREcxb','low','193850ukcoHH','starter_message','mkdirSync','createProject','code','total','INVALID_ARGUMENT','variables','text_content','starter_message.md','PERMISSION_DENIED','):\x20','webSearchTools','writeFileSync','cloneProject','systemPrompt','(dry-run)','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','restoreProject','getUserSettings','history','createIntegration','Renamed\x20agent\x20folder:\x20','find','parse','json_schema','none','listTextKnowledgeBases','agentId','message','isManaged','3317167dTPatX','rmSync','medium','updateAgentResponse','duplicate','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','setCurrentProject','projectName','deleteAgent','oldPath','Agent\x20reference\x20not\x20found','createChatInterface','idToName','getChatInfo','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','chatInfo','1559811ojXSey','agent.yml\x20not\x20found\x20in\x20','integrations','AGENT_NOT_FOUND','getChatLog','keys','image_gen','split','\x27.\x20This\x20should\x20not\x20happen.','createExperimentalKnowledgeBase','Output\x20directory\x20already\x20exists:\x20','chat_agent_console','Available\x20agents:\x20','\x0a---\x20schema:\x20','project.json','slackMessageMode','updateExperimentalArtifact','Project\x20\x22','serviceType','listExperimentalArtifacts','120828xxwlWD','actions','backupProject','createAgent','chatId'];a148_0x4b1a=function(){return _0xa18714;};return a148_0x4b1a();}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_0x3b70c0(0x215),a148_0x3b70c0(0x16d),'chat_parent_segment'];function a148_0x3cba(_0x344124,_0x14988a){_0x344124=_0x344124-0x16a;const _0x4b1ab0=a148_0x4b1a();let _0x3cba97=_0x4b1ab0[_0x344124];return _0x3cba97;}async function safeListOrEmpty(_0x17e98f){const _0x3ca786=a148_0x3b70c0;try{return await _0x17e98f();}catch(_0xf90ff1){if(_0xf90ff1 instanceof HTTPClientError&&_0xf90ff1[_0x3ca786(0x239)]===0x194)return[];throw _0xf90ff1;}}export class LLMSDK{['currentProjectId'];[a148_0x3b70c0(0x225)];[a148_0x3b70c0(0x17f)];[a148_0x3b70c0(0x1e2)]=Logger['of'](a148_0x3b70c0(0x216));constructor(_0x1822c2){this['client']=new LLMApiClient(_0x1822c2),this['context']=_0x1822c2;}['getDefaultProjectName'](){const _0x521f7d=a148_0x3b70c0,_0x3d2b4b=getSanitizedUsername();return _0x521f7d(0x1f1)+_0x3d2b4b;}async[a148_0x3b70c0(0x27a)](_0x298f35){const _0x5d7dfe=a148_0x3b70c0,{projectId:_0x4d613e}=await this[_0x5d7dfe(0x193)](_0x298f35);this['currentProjectId']=_0x4d613e;}['getCurrentProject'](){const _0x2aaa63=a148_0x3b70c0;return this[_0x2aaa63(0x1bc)];}async['setDefaultAgent'](_0x1012b8){const _0x3c6b03=a148_0x3b70c0,_0x183c8c=this['context']['profile'];let _0xc624d2,_0xc2745c;if(_0x1012b8[_0x3c6b03(0x214)]('/')){const _0x1615d7=_0x1012b8[_0x3c6b03(0x28b)]('/');if(_0x1615d7[_0x3c6b03(0x1b7)]!==0x2)throw new SDKError(ErrorCode[_0x3c6b03(0x25b)],_0x3c6b03(0x1f9)+_0x1012b8,undefined,{'helpText':_0x3c6b03(0x24f)});const [_0x39542f,_0x3e2c89]=_0x1615d7;_0xc624d2=await this[_0x3c6b03(0x1f5)](_0x39542f),_0xc2745c=_0x3e2c89;}else _0xc624d2=this[_0x3c6b03(0x1bc)]||(await this[_0x3c6b03(0x23c)]())['id'],_0xc2745c=_0x1012b8;const _0x348302=await this[_0x3c6b03(0x17c)](_0xc2745c,_0xc624d2),_0x533e14=await this['client'][_0x3c6b03(0x238)](_0x348302);writeCachedLLMAgent(_0x533e14['attributes']['name'],_0x348302,_0xc624d2,_0x183c8c);}[a148_0x3b70c0(0x183)](){const _0x29b043=a148_0x3b70c0,_0x35193e=this[_0x29b043(0x17f)][_0x29b043(0x1ac)];return readCachedLLMAgent(_0x35193e)||undefined;}['clearDefaultAgent'](){const _0x87295d=this['context']['profile'];clearCachedLLMAgent(_0x87295d);}async[a148_0x3b70c0(0x1cb)](){const _0x56e6a1=a148_0x3b70c0,_0xa4e4f0=await this[_0x56e6a1(0x225)][_0x56e6a1(0x268)]();return toModelInfos(_0xa4e4f0);}async[a148_0x3b70c0(0x258)](_0xea4b79){const _0xcc96e=a148_0x3b70c0;return await this[_0xcc96e(0x225)]['createProject'](_0xea4b79);}async[a148_0x3b70c0(0x1b5)](_0x299c36){const _0x4140f0=a148_0x3b70c0,{projectId:_0x508dbb}=await this[_0x4140f0(0x193)](_0x299c36);await this[_0x4140f0(0x225)]['deleteProject'](_0x508dbb);}async[a148_0x3b70c0(0x1e1)](_0x525f09=0x32){const _0x103f47=a148_0x3b70c0;return await this[_0x103f47(0x225)][_0x103f47(0x1ec)](_0x525f09);}async[a148_0x3b70c0(0x23c)](_0x47bacb){const _0x904bc4=a148_0x3b70c0,_0x135b2f=_0x47bacb||this[_0x904bc4(0x22e)](),_0x166990=this[_0x904bc4(0x17f)][_0x904bc4(0x1ac)];if(!_0x47bacb){const _0xa69a85=readCachedLLMProject(_0x166990);if(_0xa69a85&&_0xa69a85[_0x904bc4(0x221)]===_0x135b2f)try{const _0x52ff49=await this[_0x904bc4(0x225)][_0x904bc4(0x1f4)](_0xa69a85['id']);if(_0x52ff49[_0x904bc4(0x201)]['name']===_0x135b2f)return _0x52ff49;}catch{}}const _0x26702c=await this[_0x904bc4(0x225)][_0x904bc4(0x1ec)](),_0x44bdba=_0x26702c[_0x904bc4(0x26c)](_0x5ddca4=>_0x5ddca4[_0x904bc4(0x201)]['name']===_0x135b2f);if(_0x44bdba)return!_0x47bacb&&writeCachedLLMProject(_0x135b2f,_0x44bdba['id'],_0x166990),_0x44bdba;const _0x280e97=await this[_0x904bc4(0x225)][_0x904bc4(0x258)]({'name':_0x135b2f,'description':_0x904bc4(0x1c5)+getSanitizedUsername()+')'});return!_0x47bacb&&writeCachedLLMProject(_0x135b2f,_0x280e97['id'],_0x166990),_0x280e97;}async['resolveProjectId'](_0x356e43){const _0x33ba78=a148_0x3b70c0,_0xb560ed=await this[_0x33ba78(0x225)][_0x33ba78(0x1ec)](),_0x34e9bb=_0xb560ed[_0x33ba78(0x190)](_0x2eba71=>_0x2eba71['attributes'][_0x33ba78(0x221)]===_0x356e43);if(_0x34e9bb[_0x33ba78(0x1b7)]===0x0)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],'Project\x20not\x20found:\x20'+_0x356e43,undefined,{'helpText':_0x33ba78(0x20e)});if(_0x34e9bb[_0x33ba78(0x1b7)]>0x1)throw new SDKError(ErrorCode[_0x33ba78(0x20c)],_0x33ba78(0x1bd)+_0x356e43+_0x33ba78(0x16a));return _0x34e9bb[0x0]['id'];}async[a148_0x3b70c0(0x193)](_0x47624f){const _0x2fa4bb=a148_0x3b70c0,_0x25951c=await this['client'][_0x2fa4bb(0x1ec)](),_0x5a224d=_0x25951c[_0x2fa4bb(0x26c)](_0x3c4420=>_0x3c4420['attributes']['name']===_0x47624f);if(_0x5a224d)return{'projectId':_0x5a224d['id'],'project':_0x5a224d};throw new SDKError(ErrorCode[_0x2fa4bb(0x187)],_0x2fa4bb(0x1dc)+_0x47624f,undefined,{'helpText':_0x2fa4bb(0x20e)});}async['getOrCreateDefaultAgent'](_0x5dd2a5=a148_0x3b70c0(0x1b3),_0x2ddeb8=0x0,_0x390903){const _0x2d3f80=a148_0x3b70c0,_0x56df73=0xa;let _0x268b01=0x0,_0x110812;while(_0x268b01<_0x56df73){try{const _0x1ad293=await this[_0x2d3f80(0x23c)](_0x110812),_0x156687=_0x1ad293['id'],_0x438878=[_0x2d3f80(0x26f),_0x2d3f80(0x1ea),_0x2d3f80(0x254),_0x2d3f80(0x276),_0x2d3f80(0x1cf)],_0xaedbae=_0x2ddeb8===0x0?'tdx_'+_0x5dd2a5:_0x2d3f80(0x23b)+_0x5dd2a5+_0x2d3f80(0x202)+_0x438878[_0x2ddeb8],_0x5669af=await this[_0x2d3f80(0x225)][_0x2d3f80(0x1df)](_0x156687),_0x293d1d=_0x5669af[_0x2d3f80(0x26c)](_0xb2994b=>_0xb2994b['attributes'][_0x2d3f80(0x221)]===_0xaedbae);if(_0x293d1d)return _0x293d1d;const _0x100641=_0x2ddeb8>0x0?0x1:_0x390903;return await this[_0x2d3f80(0x225)]['createAgent']({'name':_0xaedbae,'projectId':_0x156687,'modelType':_0x5dd2a5,'systemPrompt':'','temperature':_0x100641,'reasoningEffort':_0x2ddeb8>0x0?_0x2ddeb8:undefined});}catch(_0xe087f9){if(_0xe087f9 instanceof HTTPClientError){const _0x77ea76=_0xe087f9['status'];if(_0x77ea76>=0x190&&_0x77ea76<0x1f4){if(_0x77ea76===0x191)throw new SDKError(ErrorCode[_0x2d3f80(0x1c8)],_0x2d3f80(0x1fa),_0xe087f9);else{if(_0x77ea76===0x193)throw new SDKError(ErrorCode[_0x2d3f80(0x25f)],_0x2d3f80(0x240),_0xe087f9);}throw _0xe087f9;}}if(errorContains(_0xe087f9,_0x2d3f80(0x1e7),_0x2d3f80(0x278),'conflict')){_0x268b01++;if(_0x268b01>=_0x56df73)throw new SDKError(ErrorCode[_0x2d3f80(0x21f)],_0x2d3f80(0x1f3)+_0x56df73+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0xe087f9);const _0x3b25c3=this[_0x2d3f80(0x22e)]();_0x110812=_0x3b25c3+'_'+generateRandomHex();continue;}throw _0xe087f9;}}throw new SDKError(ErrorCode[_0x2d3f80(0x20c)],_0x2d3f80(0x20f));}async[a148_0x3b70c0(0x17c)](_0x3f49f9,_0x22bbd8){const _0x184fb8=a148_0x3b70c0,_0x379fc0=_0x22bbd8||this[_0x184fb8(0x1bc)],_0x1c4848=await this['client']['listAgents'](_0x379fc0),_0x53567c=_0x1c4848[_0x184fb8(0x190)](_0x81e621=>_0x81e621[_0x184fb8(0x201)][_0x184fb8(0x221)]===_0x3f49f9);if(_0x53567c['length']===0x0){const _0x45f275=_0x379fc0?'\x20in\x20project\x20'+_0x379fc0:'';throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x184fb8(0x234)+_0x3f49f9+_0x45f275,undefined,{'helpText':_0x379fc0?'Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.':_0x184fb8(0x19f)});}if(_0x53567c['length']>0x1)throw new SDKError(ErrorCode[_0x184fb8(0x20c)],_0x184fb8(0x1d6)+_0x3f49f9+_0x184fb8(0x16a));return _0x53567c[0x0]['id'];}async[a148_0x3b70c0(0x18b)](_0x3f4825){const _0x5056ee=a148_0x3b70c0,_0x4dae27=_0x3f4825||this[_0x5056ee(0x1bc)];return await this[_0x5056ee(0x225)][_0x5056ee(0x1df)](_0x4dae27);}async[a148_0x3b70c0(0x251)](_0x450131){const _0x28039e=a148_0x3b70c0;return await this['client'][_0x28039e(0x1da)](_0x450131);}async['agent'](_0x18ddd6){const _0x498519=a148_0x3b70c0;return await this[_0x498519(0x225)]['getAgent'](_0x18ddd6);}async[a148_0x3b70c0(0x179)](_0x30edde){const _0x5b9c95=a148_0x3b70c0;return await this[_0x5b9c95(0x225)][_0x5b9c95(0x179)](_0x30edde);}async[a148_0x3b70c0(0x1b0)](_0x1da58e,_0x4b7975){const _0x5bb630=a148_0x3b70c0;return await this[_0x5bb630(0x225)][_0x5bb630(0x1b0)](_0x1da58e,_0x4b7975);}async['deleteAgent'](_0x43b2ac){const _0x4e0736=a148_0x3b70c0;await this[_0x4e0736(0x225)][_0x4e0736(0x27c)](_0x43b2ac);}async[a148_0x3b70c0(0x19b)](_0xfee59b){const _0x2e58aa=a148_0x3b70c0;return await this['client'][_0x2e58aa(0x19b)]({'agentId':_0xfee59b});}async*[a148_0x3b70c0(0x230)](_0x23df42,_0x16210a){const _0x314e1c=a148_0x3b70c0;let _0x4d81ae=_0x16210a?.[_0x314e1c(0x17a)];const _0x398993=_0x16210a?.['agentId'];if(!_0x4d81ae){if(!_0x398993)throw new Error(_0x314e1c(0x1e8));const _0x51c626=await this[_0x314e1c(0x225)][_0x314e1c(0x19b)]({'agentId':_0x398993});_0x4d81ae=_0x51c626['id'],yield{'type':_0x314e1c(0x186),'data':{'chatId':_0x4d81ae,'agentId':_0x398993,'projectId':_0x51c626[_0x314e1c(0x201)]['projectId']}};}for await(const _0x5815df of this['client'][_0x314e1c(0x200)](_0x4d81ae,_0x23df42,_0x16210a?.[_0x314e1c(0x18e)])){yield{'type':_0x314e1c(0x1a2),'data':_0x5815df};}}async['chats'](_0x511ac4=0x32){const _0x57ba3a=a148_0x3b70c0;return await this[_0x57ba3a(0x225)][_0x57ba3a(0x1a1)](_0x511ac4);}async[a148_0x3b70c0(0x269)](_0x4f77a5){const _0x34faca=a148_0x3b70c0;return await this['client'][_0x34faca(0x1ed)](_0x4f77a5);}async['getChatLog'](_0x3024c){const _0xa1b1bb=a148_0x3b70c0;return await this[_0xa1b1bb(0x225)][_0xa1b1bb(0x288)](_0x3024c);}async[a148_0x3b70c0(0x283)](_0xeaf653){const _0x19a679=a148_0x3b70c0;return await this['client'][_0x19a679(0x281)](_0xeaf653);}async[a148_0x3b70c0(0x178)](_0xaae56b,_0x139e60,_0x3232ed){const _0x1dd298=a148_0x3b70c0,_0x7441f3=_0x3232ed?.[_0x1dd298(0x206)]??![],{projectId:_0x2ab7ce,project:_0x2e041f}=await this[_0x1dd298(0x193)](_0xaae56b),_0x4b368f=_0x2e041f['attributes'][_0x1dd298(0x221)],_0x2bc7e9=_0x139e60||_0x4b368f+_0x1dd298(0x1a0);if(a148_0x16858c[_0x1dd298(0x205)](_0x2bc7e9)&&!_0x7441f3)throw new SDKError(ErrorCode[_0x1dd298(0x21f)],_0x1dd298(0x16c)+_0x2bc7e9,undefined,{'helpText':'Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.'});const _0x55b0bb=await this[_0x1dd298(0x225)][_0x1dd298(0x1da)](_0x2ab7ce),_0x42cc10=await this[_0x1dd298(0x225)][_0x1dd298(0x1cc)](_0x2ab7ce),_0x317f2e=await this[_0x1dd298(0x225)][_0x1dd298(0x1b6)](_0x2ab7ce),_0xf9b2a5=await this[_0x1dd298(0x225)]['listIntegrations'](_0x2ab7ce);if(!_0x7441f3){a148_0x16858c[_0x1dd298(0x257)](_0x2bc7e9,{'recursive':!![]});const _0x205cf4={'version':'1.0','exportedAt':new Date()[_0x1dd298(0x249)](),'exportedFrom':{'site':this[_0x1dd298(0x17f)][_0x1dd298(0x1d1)],'projectId':_0x2ab7ce,'projectName':_0x4b368f},'project':_0x2e041f};a148_0x16858c[_0x1dd298(0x262)](a148_0x31cc73[_0x1dd298(0x17e)](_0x2bc7e9,'project.json'),JSON[_0x1dd298(0x21b)](_0x205cf4,null,0x2)),a148_0x16858c['writeFileSync'](a148_0x31cc73[_0x1dd298(0x17e)](_0x2bc7e9,'agents.json'),JSON[_0x1dd298(0x21b)](_0x55b0bb,null,0x2)),a148_0x16858c[_0x1dd298(0x262)](a148_0x31cc73[_0x1dd298(0x17e)](_0x2bc7e9,_0x1dd298(0x185)),JSON['stringify'](_0x42cc10,null,0x2)),a148_0x16858c[_0x1dd298(0x262)](a148_0x31cc73[_0x1dd298(0x17e)](_0x2bc7e9,_0x1dd298(0x19d)),JSON[_0x1dd298(0x21b)](_0x317f2e,null,0x2)),a148_0x16858c[_0x1dd298(0x262)](a148_0x31cc73['join'](_0x2bc7e9,_0x1dd298(0x1c1)),JSON['stringify'](_0xf9b2a5,null,0x2));}return{'projectName':_0x4b368f,'outputDir':_0x2bc7e9,'counts':{'agents':_0x55b0bb['length'],'knowledgeBases':_0x42cc10[_0x1dd298(0x1b7)],'prompts':_0x317f2e[_0x1dd298(0x1b7)],'integrations':_0xf9b2a5[_0x1dd298(0x1b7)]}};}async[a148_0x3b70c0(0x267)](_0x5144a7,_0xcff6b3){const _0x1deb26=a148_0x3b70c0,_0x3558a0=_0xcff6b3?.[_0x1deb26(0x206)]??![],_0x136d83=this[_0x1deb26(0x1b2)](_0x5144a7),_0x2beb21=_0x136d83['exportedFrom'][_0x1deb26(0x1d1)],_0x1efadc=this['context'][_0x1deb26(0x1d1)],_0x12bda7=_0x2beb21!==_0x1efadc?_0x2beb21:undefined,_0x9e86c8=this[_0x1deb26(0x1f2)](a148_0x31cc73[_0x1deb26(0x17e)](_0x5144a7,_0x1deb26(0x21c)),[]),_0x875cc4=this[_0x1deb26(0x1f2)](a148_0x31cc73[_0x1deb26(0x17e)](_0x5144a7,_0x1deb26(0x185)),[]),_0x1a7d15=this['loadJsonFile'](a148_0x31cc73['join'](_0x5144a7,_0x1deb26(0x19d)),[]),_0x729032=this[_0x1deb26(0x1f2)](a148_0x31cc73[_0x1deb26(0x17e)](_0x5144a7,_0x1deb26(0x1c1)),[]),_0x14019c=_0xcff6b3?.[_0x1deb26(0x221)]||_0x136d83['exportedFrom'][_0x1deb26(0x27b)];if(_0x3558a0){const _0x390fac=new Map(),_0x35cbdf=[..._0x9e86c8],_0x2e0d9e=_0x9e86c8['length']+0x1;let _0x463da2=0x0;while(_0x35cbdf[_0x1deb26(0x1b7)]>0x0&&_0x463da2<_0x2e0d9e){_0x463da2++;const _0x298a3b=[];for(const _0x3dca29 of _0x35cbdf){canCreateAgent(_0x3dca29,_0x390fac)?_0x390fac['set'](_0x3dca29['id'],_0x1deb26(0x24b)+_0x3dca29['id']):_0x298a3b['push'](_0x3dca29);}if(_0x298a3b[_0x1deb26(0x1b7)]===_0x35cbdf[_0x1deb26(0x1b7)])throw new SDKError(ErrorCode[_0x1deb26(0x20c)],'Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.',undefined,{'helpText':_0x1deb26(0x194)});_0x35cbdf[_0x1deb26(0x1b7)]=0x0,_0x35cbdf[_0x1deb26(0x1af)](..._0x298a3b);}const _0x286ba7=_0x1a7d15[_0x1deb26(0x190)](_0x1b7490=>_0x390fac['has'](_0x1b7490[_0x1deb26(0x201)]['agentId']))['length'];return{'projectName':_0x14019c,'projectId':_0x1deb26(0x265),'counts':{'agents':_0x9e86c8[_0x1deb26(0x1b7)],'knowledgeBases':_0x875cc4['length'],'prompts':_0x286ba7,'integrations':_0x729032[_0x1deb26(0x1b7)]},'sourceSite':_0x12bda7};}const _0x10a026=await this[_0x1deb26(0x225)]['createProject']({'name':_0x14019c,'description':_0x136d83['project'][_0x1deb26(0x201)][_0x1deb26(0x1ff)]}),_0x48fc95=_0x10a026['id'],_0x4cad91=new Map(),_0x3516c6=new Map(),_0x3bd142=new Map();for(const _0x512f00 of _0x875cc4){const _0x57a80f=await this[_0x1deb26(0x225)]['createKnowledgeBase']({'projectId':_0x48fc95,'name':_0x512f00[_0x1deb26(0x201)][_0x1deb26(0x221)],'tdDatabaseName':_0x512f00[_0x1deb26(0x201)][_0x1deb26(0x1f6)],'tables':_0x512f00[_0x1deb26(0x201)][_0x1deb26(0x1cd)]});_0x4cad91[_0x1deb26(0x1de)](_0x512f00['id'],_0x57a80f['id']);}const _0x1ff8dd=[..._0x9e86c8],_0x2eceb5=_0x9e86c8[_0x1deb26(0x1b7)]+0x1;let _0x5e4653=0x0;while(_0x1ff8dd[_0x1deb26(0x1b7)]>0x0&&_0x5e4653<_0x2eceb5){_0x5e4653++;const _0x5cf312=[];for(const _0x3a3118 of _0x1ff8dd){if(canCreateAgent(_0x3a3118,_0x3516c6)){const _0x3d0f62=remapToolIds(_0x3a3118['attributes']['tools'],_0x4cad91,_0x3516c6),_0x492170=remapVariableIds(_0x3a3118['attributes'][_0x1deb26(0x25c)],_0x4cad91),_0x499af2=await this[_0x1deb26(0x225)][_0x1deb26(0x209)]({'name':_0x3a3118[_0x1deb26(0x201)][_0x1deb26(0x221)],'projectId':_0x48fc95,'systemPrompt':_0x3a3118[_0x1deb26(0x201)]['systemPrompt'],'starterMessage':_0x3a3118[_0x1deb26(0x201)][_0x1deb26(0x1c0)],'modelType':migrateModelType(_0x3a3118['attributes'][_0x1deb26(0x1b8)]),'maxToolIterations':_0x3a3118[_0x1deb26(0x201)][_0x1deb26(0x207)],'temperature':_0x3a3118[_0x1deb26(0x201)]['temperature'],'reasoningEffort':_0x3a3118[_0x1deb26(0x201)][_0x1deb26(0x17b)],'outputs':_0x3a3118[_0x1deb26(0x201)][_0x1deb26(0x1fc)],'tools':_0x3d0f62,'variables':_0x492170});_0x3516c6[_0x1deb26(0x1de)](_0x3a3118['id'],_0x499af2['id']);}else _0x5cf312['push'](_0x3a3118);}if(_0x5cf312['length']===_0x1ff8dd[_0x1deb26(0x1b7)])throw new SDKError(ErrorCode[_0x1deb26(0x20c)],_0x1deb26(0x1fd),undefined,{'helpText':_0x1deb26(0x194)});_0x1ff8dd[_0x1deb26(0x1b7)]=0x0,_0x1ff8dd['push'](..._0x5cf312);}for(const _0x1e4d3e of _0x1a7d15){const _0x198701=_0x3516c6[_0x1deb26(0x21e)](_0x1e4d3e[_0x1deb26(0x201)][_0x1deb26(0x271)]);if(!_0x198701)continue;const _0x37e365=await this['client']['createPrompt']({'projectId':_0x48fc95,'agentId':_0x198701,'name':_0x1e4d3e['attributes'][_0x1deb26(0x221)],'systemPrompt':_0x1e4d3e[_0x1deb26(0x201)][_0x1deb26(0x264)],'template':_0x1e4d3e[_0x1deb26(0x201)][_0x1deb26(0x22c)],'jsonSchemaHint':_0x1e4d3e['attributes']['jsonSchemaHint']});_0x3bd142['set'](_0x1e4d3e['id'],_0x37e365['id']);}for(const _0x435d09 of _0x729032){const _0x45fe8d=_0x435d09[_0x1deb26(0x201)][_0x1deb26(0x177)][_0x1deb26(0x1dd)](_0x3f0a46=>({..._0x3f0a46,'promptId':_0x3bd142[_0x1deb26(0x21e)](_0x3f0a46[_0x1deb26(0x1d4)])||_0x3f0a46[_0x1deb26(0x1d4)]}));await this[_0x1deb26(0x225)][_0x1deb26(0x26a)]({'projectId':_0x48fc95,'serviceType':_0x435d09[_0x1deb26(0x201)][_0x1deb26(0x174)],'actions':_0x45fe8d,'slackMessageMode':_0x435d09['attributes'][_0x1deb26(0x171)],'chatIgnoreManagedActions':_0x435d09[_0x1deb26(0x201)][_0x1deb26(0x219)],'chatWelcomeMessage':_0x435d09[_0x1deb26(0x201)]['chatWelcomeMessage'],'webhookCorsOrigins':_0x435d09[_0x1deb26(0x201)][_0x1deb26(0x22d)]});}return{'projectName':_0x14019c,'projectId':_0x48fc95,'counts':{'agents':_0x3516c6[_0x1deb26(0x184)],'knowledgeBases':_0x4cad91[_0x1deb26(0x184)],'prompts':_0x3bd142['size'],'integrations':_0x729032[_0x1deb26(0x1b7)]},'sourceSite':_0x12bda7};}[a148_0x3b70c0(0x1f2)](_0x5c48e5,_0x13ca19){const _0xa50500=a148_0x3b70c0;if(!a148_0x16858c[_0xa50500(0x205)](_0x5c48e5))return _0x13ca19;return JSON[_0xa50500(0x26d)](a148_0x16858c['readFileSync'](_0x5c48e5,'utf-8'));}[a148_0x3b70c0(0x1b2)](_0x3c2a9a){const _0x51ead3=a148_0x3b70c0;if(!a148_0x16858c[_0x51ead3(0x205)](_0x3c2a9a))throw new SDKError(ErrorCode[_0x51ead3(0x1d8)],'Backup\x20folder\x20not\x20found:\x20'+_0x3c2a9a,undefined,{'helpText':'Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.'});const _0x317c25=a148_0x31cc73[_0x51ead3(0x17e)](_0x3c2a9a,_0x51ead3(0x170));if(!a148_0x16858c[_0x51ead3(0x205)](_0x317c25))throw new SDKError(ErrorCode[_0x51ead3(0x25b)],_0x51ead3(0x247)+_0x3c2a9a,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x3243fc=JSON['parse'](a148_0x16858c[_0x51ead3(0x212)](_0x317c25,_0x51ead3(0x208)));if(!isSupportedBackupVersion(_0x3243fc[_0x51ead3(0x18c)]))throw new SDKError(ErrorCode[_0x51ead3(0x25b)],'Unsupported\x20backup\x20version:\x20'+_0x3243fc[_0x51ead3(0x18c)],undefined,{'helpText':_0x51ead3(0x266)});return _0x3243fc;}async[a148_0x3b70c0(0x1ba)](_0x474f4a,_0x1b1a56,_0x470958){const _0x5b7a9e=a148_0x3b70c0,{projectId:_0x598d98,project:_0x2e07d3}=await this[_0x5b7a9e(0x193)](_0x474f4a),_0x2926e4=_0x2e07d3[_0x5b7a9e(0x201)][_0x5b7a9e(0x221)];let _0x172435;if(_0x1b1a56)_0x172435=_0x1b1a56;else{const _0x23a41f=a148_0x31cc73[_0x5b7a9e(0x17e)](process['cwd'](),_0x5b7a9e(0x18b)),_0x1824f6=getSanitizedPathWithMigration(_0x23a41f,_0x2926e4);_0x1824f6[_0x5b7a9e(0x1b9)]&&this[_0x5b7a9e(0x1e2)][_0x5b7a9e(0x1c7)](_0x5b7a9e(0x248)+a148_0x31cc73[_0x5b7a9e(0x246)](_0x1824f6[_0x5b7a9e(0x27d)])+'\x20→\x20'+a148_0x31cc73[_0x5b7a9e(0x246)](_0x1824f6[_0x5b7a9e(0x1a3)])),_0x172435=_0x1824f6[_0x5b7a9e(0x1a3)];}const _0x2716c6=await this[_0x5b7a9e(0x225)]['listAgentsFull'](_0x598d98),_0x1388d7=await this[_0x5b7a9e(0x225)][_0x5b7a9e(0x1cc)](_0x598d98),_0x399a59=await this[_0x5b7a9e(0x225)]['listTextKnowledgeBases'](_0x598d98),_0x153e6a=await safeListOrEmpty(()=>this[_0x5b7a9e(0x225)]['listImageGenerators'](_0x598d98)),_0x1c1d51=await safeListOrEmpty(()=>this[_0x5b7a9e(0x225)][_0x5b7a9e(0x1e4)](_0x598d98)),_0x2ca673=await this['client'][_0x5b7a9e(0x1b6)](_0x598d98),_0x55c8e8=await this[_0x5b7a9e(0x225)][_0x5b7a9e(0x1f8)](_0x598d98),_0x5df075=await safeListOrEmpty(()=>this[_0x5b7a9e(0x225)][_0x5b7a9e(0x1e3)](_0x598d98)),_0x11821f=await safeListOrEmpty(()=>this[_0x5b7a9e(0x225)][_0x5b7a9e(0x175)](_0x598d98)),_0x37cb9f=await safeListOrEmpty(()=>this[_0x5b7a9e(0x225)][_0x5b7a9e(0x1d9)](_0x598d98)),_0x44d2a7=await safeListOrEmpty(()=>this[_0x5b7a9e(0x225)][_0x5b7a9e(0x1a6)](_0x598d98)),_0x4209f7=_0x55c8e8['filter'](_0x4abf4e=>!_0x4abf4e[_0x5b7a9e(0x201)][_0x5b7a9e(0x273)]&&SAFE_INTEGRATION_TYPES['includes'](_0x4abf4e[_0x5b7a9e(0x201)]['serviceType']['toLowerCase']())),_0x363667=new Map(),_0x3f8e7c=new Map(),_0x38c816=new Map(),_0x6be441=new Map(),_0xf8a0ce=new Map(),_0x35e35f=new Map(),_0x3760c6=new Map();for(const _0x148545 of _0x2716c6){_0x363667[_0x5b7a9e(0x1de)](_0x148545['id'],_0x148545[_0x5b7a9e(0x201)][_0x5b7a9e(0x221)]);}for(const _0x56fb2a of _0x1388d7){_0x3f8e7c[_0x5b7a9e(0x1de)](_0x56fb2a['id'],_0x56fb2a[_0x5b7a9e(0x201)][_0x5b7a9e(0x221)]);}for(const _0x5c2ed7 of _0x399a59){_0x38c816[_0x5b7a9e(0x1de)](_0x5c2ed7['id'],_0x5c2ed7['attributes']['name']);}for(const _0x25d82c of _0x153e6a){_0x6be441[_0x5b7a9e(0x1de)](_0x25d82c['id'],_0x25d82c['attributes'][_0x5b7a9e(0x221)]);}for(const _0x3ad526 of _0x1c1d51){_0xf8a0ce[_0x5b7a9e(0x1de)](_0x3ad526['id'],_0x3ad526[_0x5b7a9e(0x201)][_0x5b7a9e(0x221)]);}for(const _0x272589 of _0x2ca673){_0x35e35f['set'](_0x272589['id'],_0x272589[_0x5b7a9e(0x201)][_0x5b7a9e(0x221)]);}for(const _0x15196f of _0x5df075){_0x3760c6[_0x5b7a9e(0x1de)](_0x15196f['id'],_0x15196f[_0x5b7a9e(0x201)][_0x5b7a9e(0x221)]);}const _0x4fc4eb={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x3f8e7c,'TextKnowledgeBase':_0x38c816,'Agent':_0x363667,'WebSearchTool':_0xf8a0ce,'ImageGenerator':_0x6be441,'ExperimentalKnowledgeBase':_0x3760c6}),'resolvePromptName':async _0x4cf148=>_0x35e35f[_0x5b7a9e(0x21e)](_0x4cf148),'onWarning':_0x200a43=>this[_0x5b7a9e(0x1e2)][_0x5b7a9e(0x191)](_0x200a43)},_0x346684={'projectName':_0x2926e4,'outputDir':_0x172435,'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}}},_0x39abaa=[],_0x2c7d6c=[];for(const _0x53a68d of _0x2716c6){const _0x12be70=getSanitizedPathWithMigration(_0x172435,_0x53a68d['attributes']['name']);_0x12be70[_0x5b7a9e(0x1b9)]&&this[_0x5b7a9e(0x1e2)][_0x5b7a9e(0x1c7)]('Renamed\x20agent\x20folder:\x20'+a148_0x31cc73[_0x5b7a9e(0x246)](_0x12be70[_0x5b7a9e(0x27d)])+'\x20→\x20'+a148_0x31cc73['basename'](_0x12be70[_0x5b7a9e(0x1a3)]));const _0x4946d3=_0x12be70[_0x5b7a9e(0x1a3)],_0x288bf2=a148_0x31cc73[_0x5b7a9e(0x17e)](_0x4946d3,_0x5b7a9e(0x189)),_0x3aca39=a148_0x31cc73[_0x5b7a9e(0x17e)](_0x4946d3,_0x5b7a9e(0x198)),_0xf3f277=a148_0x31cc73[_0x5b7a9e(0x17e)](_0x4946d3,'starter_message.md'),{yaml:_0x4f9590,systemPrompt:_0xc92a6f,starterMessage:_0x235bc1}=await agentResponseToDef(_0x53a68d,_0x4fc4eb),_0x4f0570=toAgentYamlString(_0x4f9590),_0x10aa88=!a148_0x16858c[_0x5b7a9e(0x205)](_0x3aca39);let _0x3b26d8=_0x10aa88,_0x2995f3;if(!_0x10aa88){const _0x36c2b8=a148_0x16858c['existsSync'](_0x288bf2)?a148_0x16858c[_0x5b7a9e(0x212)](_0x288bf2,_0x5b7a9e(0x208)):'',_0x376974=a148_0x16858c[_0x5b7a9e(0x212)](_0x3aca39,_0x5b7a9e(0x208)),_0x4f237a='#\x20prompt.md\x0a'+_0x36c2b8+_0x5b7a9e(0x1aa)+_0x376974,_0x3b9aa4=_0x5b7a9e(0x22a)+_0xc92a6f+_0x5b7a9e(0x1aa)+_0x4f0570,_0x4d0ac1=generateDiff(_0x4f237a,_0x3b9aa4);_0x3b26d8=hasChanges(_0x4d0ac1),_0x3b26d8&&(_0x2995f3=formatDiffWithColors(_0x4d0ac1));}_0x39abaa[_0x5b7a9e(0x1af)]({'path':_0x4946d3,'content':'','isDir':!![]}),_0x39abaa['push']({'path':_0x288bf2,'content':_0xc92a6f}),_0x39abaa[_0x5b7a9e(0x1af)]({'path':_0x3aca39,'content':_0x4f0570});_0x235bc1&&_0x235bc1[_0x5b7a9e(0x214)]('\x0a')&&_0x39abaa['push']({'path':_0xf3f277,'content':_0x235bc1});_0x346684[_0x5b7a9e(0x18b)]['push']({'agentName':_0x53a68d[_0x5b7a9e(0x201)][_0x5b7a9e(0x221)],'outputPath':_0x4946d3,'isNew':_0x10aa88,'hasChanges':_0x3b26d8,'diff':_0x2995f3}),_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x18b)][_0x5b7a9e(0x25a)]++;if(_0x10aa88)_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x18b)][_0x5b7a9e(0x1be)]++;else{if(_0x3b26d8)_0x346684['counts'][_0x5b7a9e(0x18b)]['updated']++;else _0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x18b)][_0x5b7a9e(0x192)]++;}}for(const _0x43901a of _0x1388d7){if(_0x43901a[_0x5b7a9e(0x201)][_0x5b7a9e(0x273)])continue;const _0x2266eb=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x172435),_0x43901a[_0x5b7a9e(0x201)][_0x5b7a9e(0x221)],'.yml');_0x2266eb[_0x5b7a9e(0x1b9)]&&this[_0x5b7a9e(0x1e2)]['info'](_0x5b7a9e(0x233)+a148_0x31cc73[_0x5b7a9e(0x246)](_0x2266eb['oldPath'])+'\x20→\x20'+a148_0x31cc73[_0x5b7a9e(0x246)](_0x2266eb['path']));const _0x7d1b2e=_0x2266eb[_0x5b7a9e(0x1a3)],_0x5729d3=apiKnowledgeBaseToYaml(_0x43901a),_0x2c2a13=toKnowledgeBaseYamlString(_0x5729d3),_0x4ce0d7=!a148_0x16858c[_0x5b7a9e(0x205)](_0x7d1b2e);let _0x3abb8e=_0x4ce0d7,_0x5bfe74;if(!_0x4ce0d7){const _0x1c9af6=a148_0x16858c[_0x5b7a9e(0x212)](_0x7d1b2e,_0x5b7a9e(0x208)),_0x165469=generateDiff(_0x1c9af6,_0x2c2a13);_0x3abb8e=hasChanges(_0x165469),_0x3abb8e&&(_0x5bfe74=formatDiffWithColors(_0x165469));}_0x39abaa[_0x5b7a9e(0x1af)]({'path':_0x7d1b2e,'content':_0x2c2a13}),_0x346684[_0x5b7a9e(0x1fb)][_0x5b7a9e(0x1af)]({'name':_0x43901a['attributes']['name'],'outputPath':_0x7d1b2e,'isNew':_0x4ce0d7,'hasChanges':_0x3abb8e,'diff':_0x5bfe74}),_0x346684['counts']['knowledgeBases'][_0x5b7a9e(0x25a)]++;if(_0x4ce0d7)_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x1fb)]['new']++;else{if(_0x3abb8e)_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x1fb)][_0x5b7a9e(0x23f)]++;else _0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x1fb)]['unchanged']++;}}for(const _0x21d18a of _0x399a59){if(_0x21d18a[_0x5b7a9e(0x201)][_0x5b7a9e(0x273)])continue;const _0x542f15=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x172435),_0x21d18a[_0x5b7a9e(0x201)]['name'],'.md');_0x542f15[_0x5b7a9e(0x1b9)]&&this[_0x5b7a9e(0x1e2)][_0x5b7a9e(0x1c7)](_0x5b7a9e(0x252)+a148_0x31cc73[_0x5b7a9e(0x246)](_0x542f15[_0x5b7a9e(0x27d)])+'\x20→\x20'+a148_0x31cc73[_0x5b7a9e(0x246)](_0x542f15[_0x5b7a9e(0x1a3)]));const _0x78d8bb=_0x542f15[_0x5b7a9e(0x1a3)],_0x160c40=toTextKnowledgeBaseMd(_0x21d18a[_0x5b7a9e(0x201)]['name'],_0x21d18a[_0x5b7a9e(0x201)]['text']),_0x587c1a=!a148_0x16858c[_0x5b7a9e(0x205)](_0x78d8bb);let _0x8433c7=_0x587c1a,_0x5628fb;if(!_0x587c1a){const _0x79cacc=a148_0x16858c['readFileSync'](_0x78d8bb,_0x5b7a9e(0x208)),_0x17f722=generateDiff(_0x79cacc,_0x160c40);_0x8433c7=hasChanges(_0x17f722),_0x8433c7&&(_0x5628fb=formatDiffWithColors(_0x17f722));}_0x39abaa[_0x5b7a9e(0x1af)]({'path':_0x78d8bb,'content':_0x160c40}),_0x346684[_0x5b7a9e(0x232)][_0x5b7a9e(0x1af)]({'name':_0x21d18a[_0x5b7a9e(0x201)][_0x5b7a9e(0x221)],'outputPath':_0x78d8bb,'isNew':_0x587c1a,'hasChanges':_0x8433c7,'diff':_0x5628fb}),_0x346684[_0x5b7a9e(0x222)]['textKnowledgeBases'][_0x5b7a9e(0x25a)]++;if(_0x587c1a)_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x232)][_0x5b7a9e(0x1be)]++;else{if(_0x8433c7)_0x346684['counts']['textKnowledgeBases'][_0x5b7a9e(0x23f)]++;else _0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x232)][_0x5b7a9e(0x192)]++;}}for(const _0x3e9225 of _0x2ca673){if(_0x3e9225[_0x5b7a9e(0x201)][_0x5b7a9e(0x273)])continue;const _0x2fc4df=getSanitizedPathWithMigration(getPromptsDir(_0x172435),_0x3e9225[_0x5b7a9e(0x201)]['name'],'.yml');_0x2fc4df[_0x5b7a9e(0x1b9)]&&this[_0x5b7a9e(0x1e2)][_0x5b7a9e(0x1c7)](_0x5b7a9e(0x24a)+a148_0x31cc73[_0x5b7a9e(0x246)](_0x2fc4df[_0x5b7a9e(0x27d)])+'\x20→\x20'+a148_0x31cc73[_0x5b7a9e(0x246)](_0x2fc4df[_0x5b7a9e(0x1a3)]));const _0x391176=_0x2fc4df[_0x5b7a9e(0x1a3)],_0x3bd1be=await apiPromptToYaml(_0x3e9225,_0x4fc4eb);if(!_0x3bd1be)continue;const _0x3dd7cb=toPromptYamlString(_0x3bd1be),_0x5f24ea=!a148_0x16858c[_0x5b7a9e(0x205)](_0x391176);let _0x1d7b61=_0x5f24ea,_0x2fad09;if(!_0x5f24ea){const _0x207f80=a148_0x16858c['readFileSync'](_0x391176,_0x5b7a9e(0x208)),_0x24b837=generateDiff(_0x207f80,_0x3dd7cb);_0x1d7b61=hasChanges(_0x24b837),_0x1d7b61&&(_0x2fad09=formatDiffWithColors(_0x24b837));}_0x39abaa['push']({'path':_0x391176,'content':_0x3dd7cb}),_0x346684[_0x5b7a9e(0x228)][_0x5b7a9e(0x1af)]({'name':_0x3e9225[_0x5b7a9e(0x201)][_0x5b7a9e(0x221)],'outputPath':_0x391176,'isNew':_0x5f24ea,'hasChanges':_0x1d7b61,'diff':_0x2fad09}),_0x346684['counts'][_0x5b7a9e(0x228)][_0x5b7a9e(0x25a)]++;if(_0x5f24ea)_0x346684['counts'][_0x5b7a9e(0x228)][_0x5b7a9e(0x1be)]++;else{if(_0x1d7b61)_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x228)][_0x5b7a9e(0x23f)]++;else _0x346684['counts']['prompts']['unchanged']++;}}for(const _0x346be4 of _0x4209f7){const _0x333c84=_0x346be4[_0x5b7a9e(0x201)]['serviceType'][_0x5b7a9e(0x1ad)](),_0x5c8ced=getSanitizedPathWithMigration(getIntegrationsDir(_0x172435),_0x333c84,_0x5b7a9e(0x196));_0x5c8ced[_0x5b7a9e(0x1b9)]&&this[_0x5b7a9e(0x1e2)][_0x5b7a9e(0x1c7)](_0x5b7a9e(0x1ab)+a148_0x31cc73['basename'](_0x5c8ced[_0x5b7a9e(0x27d)])+_0x5b7a9e(0x1d7)+a148_0x31cc73[_0x5b7a9e(0x246)](_0x5c8ced[_0x5b7a9e(0x1a3)]));const _0x2990ee=_0x5c8ced[_0x5b7a9e(0x1a3)],_0x129353=await apiIntegrationToYaml(_0x346be4,_0x4fc4eb),_0x277c3a=toIntegrationYamlString(_0x129353),_0xd9d3b3=!a148_0x16858c['existsSync'](_0x2990ee);let _0x56d860=_0xd9d3b3,_0x18e670;if(!_0xd9d3b3){const _0x3743a3=a148_0x16858c[_0x5b7a9e(0x212)](_0x2990ee,'utf-8'),_0x2de163=generateDiff(_0x3743a3,_0x277c3a);_0x56d860=hasChanges(_0x2de163),_0x56d860&&(_0x18e670=formatDiffWithColors(_0x2de163));}_0x39abaa[_0x5b7a9e(0x1af)]({'path':_0x2990ee,'content':_0x277c3a}),_0x346684[_0x5b7a9e(0x286)][_0x5b7a9e(0x1af)]({'name':_0x333c84,'outputPath':_0x2990ee,'isNew':_0xd9d3b3,'hasChanges':_0x56d860,'diff':_0x18e670}),_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x286)][_0x5b7a9e(0x25a)]++;if(_0xd9d3b3)_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x286)][_0x5b7a9e(0x1be)]++;else{if(_0x56d860)_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x286)][_0x5b7a9e(0x23f)]++;else _0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x286)][_0x5b7a9e(0x192)]++;}}for(const _0x164527 of _0x5df075){if(_0x164527['attributes'][_0x5b7a9e(0x273)])continue;const _0x3eb03d=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x172435),_0x164527[_0x5b7a9e(0x201)][_0x5b7a9e(0x221)]);_0x3eb03d[_0x5b7a9e(0x1b9)]&&this['logger'][_0x5b7a9e(0x1c7)](_0x5b7a9e(0x1a9)+a148_0x31cc73[_0x5b7a9e(0x246)](_0x3eb03d[_0x5b7a9e(0x27d)])+_0x5b7a9e(0x1d7)+a148_0x31cc73[_0x5b7a9e(0x246)](_0x3eb03d['path']));const _0x443902=_0x3eb03d['path'],_0x4002f2=a148_0x31cc73[_0x5b7a9e(0x17e)](_0x443902,sanitizeForFilesystem(_0x164527[_0x5b7a9e(0x201)][_0x5b7a9e(0x221)])+'.yml'),_0x4119e4=a148_0x31cc73[_0x5b7a9e(0x17e)](_0x443902,_0x5b7a9e(0x231)),_0x5dc8a2=apiExperimentalKnowledgeBaseToYaml(_0x164527),_0x4fd2ad=toExperimentalKnowledgeBaseYamlString(_0x5dc8a2),_0x4ef117=!a148_0x16858c[_0x5b7a9e(0x205)](_0x443902);let _0xa1dfc0=_0x4ef117,_0x36c192,_0x49b904=_0x4fd2ad;const _0xb6ce0a=[..._0x5dc8a2[_0x5b7a9e(0x231)]][_0x5b7a9e(0x1ca)]((_0x58af7b,_0x685ef2)=>_0x58af7b[_0x5b7a9e(0x221)][_0x5b7a9e(0x1eb)](_0x685ef2[_0x5b7a9e(0x221)]));for(const _0x1fe092 of _0xb6ce0a){_0x49b904+=_0x5b7a9e(0x1e0)+_0x1fe092['name']+'\x20---\x0a'+_0x1fe092[_0x5b7a9e(0x259)]+_0x5b7a9e(0x16f)+_0x1fe092[_0x5b7a9e(0x221)]+_0x5b7a9e(0x1d3)+_0x1fe092['json_schema']+'\x0a';}if(!_0x4ef117){let _0x46dadc='';a148_0x16858c[_0x5b7a9e(0x205)](_0x4002f2)&&(_0x46dadc=a148_0x16858c['readFileSync'](_0x4002f2,_0x5b7a9e(0x208)));if(a148_0x16858c[_0x5b7a9e(0x205)](_0x4119e4)){const _0x444f2d=a148_0x16858c[_0x5b7a9e(0x1c2)](_0x4119e4,{'withFileTypes':!![]}),_0x3c4849=_0x444f2d[_0x5b7a9e(0x190)](_0x19fd66=>_0x19fd66[_0x5b7a9e(0x243)]())[_0x5b7a9e(0x1ca)]((_0x47ed06,_0x21ccff)=>_0x47ed06['name'][_0x5b7a9e(0x1eb)](_0x21ccff[_0x5b7a9e(0x221)]));for(const _0x43e0ef of _0x3c4849){const _0x13fc0e=a148_0x31cc73[_0x5b7a9e(0x17e)](_0x4119e4,_0x43e0ef[_0x5b7a9e(0x221)],_0x5b7a9e(0x19c)),_0x1671a2=a148_0x31cc73[_0x5b7a9e(0x17e)](_0x4119e4,_0x43e0ef[_0x5b7a9e(0x221)],_0x5b7a9e(0x1c6));a148_0x16858c[_0x5b7a9e(0x205)](_0x13fc0e)&&(_0x46dadc+=_0x5b7a9e(0x1e0)+_0x43e0ef[_0x5b7a9e(0x221)]+_0x5b7a9e(0x1d3)+a148_0x16858c[_0x5b7a9e(0x212)](_0x13fc0e,_0x5b7a9e(0x208))+'\x0a'),a148_0x16858c[_0x5b7a9e(0x205)](_0x1671a2)&&(_0x46dadc+='---\x20schema:\x20'+_0x43e0ef[_0x5b7a9e(0x221)]+_0x5b7a9e(0x1d3)+a148_0x16858c[_0x5b7a9e(0x212)](_0x1671a2,_0x5b7a9e(0x208))+'\x0a');}}const _0x11fbd9=generateDiff(_0x46dadc,_0x49b904);_0xa1dfc0=hasChanges(_0x11fbd9),_0xa1dfc0&&(_0x36c192=formatDiffWithColors(_0x11fbd9));}_0x39abaa[_0x5b7a9e(0x1af)]({'path':_0x443902,'content':'','isDir':!![]}),_0x39abaa[_0x5b7a9e(0x1af)]({'path':_0x4002f2,'content':_0x4fd2ad}),_0x39abaa['push']({'path':_0x4119e4,'content':'','isDir':!![]});for(const _0x4a78e9 of _0x5dc8a2[_0x5b7a9e(0x231)]){const _0x24cb41=a148_0x31cc73[_0x5b7a9e(0x17e)](_0x4119e4,sanitizeForFilesystem(_0x4a78e9['name'])),_0x1ff5bc=a148_0x31cc73[_0x5b7a9e(0x17e)](_0x24cb41,_0x5b7a9e(0x19c)),_0x5b347e=a148_0x31cc73[_0x5b7a9e(0x17e)](_0x24cb41,_0x5b7a9e(0x1c6));_0x39abaa[_0x5b7a9e(0x1af)]({'path':_0x24cb41,'content':'','isDir':!![]}),_0x39abaa['push']({'path':_0x1ff5bc,'content':_0x4a78e9[_0x5b7a9e(0x259)]}),_0x39abaa['push']({'path':_0x5b347e,'content':_0x4a78e9[_0x5b7a9e(0x26e)]});}if(a148_0x16858c['existsSync'](_0x4119e4)){const _0x44b0dc=a148_0x16858c['readdirSync'](_0x4119e4,{'withFileTypes':!![]}),_0x870bd4=new Set(_0x5dc8a2['functions']['map'](_0x21fc93=>sanitizeForFilesystem(_0x21fc93[_0x5b7a9e(0x221)])));for(const _0x2be940 of _0x44b0dc){if(_0x2be940['isDirectory']()&&!_0x870bd4[_0x5b7a9e(0x180)](_0x2be940[_0x5b7a9e(0x221)])){const _0x34784e=a148_0x31cc73[_0x5b7a9e(0x17e)](_0x4119e4,_0x2be940[_0x5b7a9e(0x221)]);_0x2c7d6c[_0x5b7a9e(0x1af)]({'path':_0x34784e,'isDir':!![]});}}}_0x346684['experimentalKnowledgeBases'][_0x5b7a9e(0x1af)]({'name':_0x164527[_0x5b7a9e(0x201)]['name'],'outputPath':_0x443902,'isNew':_0x4ef117,'hasChanges':_0xa1dfc0,'diff':_0x36c192}),_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x236)][_0x5b7a9e(0x25a)]++;if(_0x4ef117)_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x236)][_0x5b7a9e(0x1be)]++;else{if(_0xa1dfc0)_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x236)][_0x5b7a9e(0x23f)]++;else _0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x236)][_0x5b7a9e(0x192)]++;}}for(const _0x489615 of _0x11821f){if(_0x489615['attributes'][_0x5b7a9e(0x273)])continue;const _0x4a064e=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x172435),_0x489615[_0x5b7a9e(0x201)][_0x5b7a9e(0x221)]);_0x4a064e[_0x5b7a9e(0x1b9)]&&this[_0x5b7a9e(0x1e2)][_0x5b7a9e(0x1c7)](_0x5b7a9e(0x210)+a148_0x31cc73[_0x5b7a9e(0x246)](_0x4a064e[_0x5b7a9e(0x27d)])+'\x20→\x20'+a148_0x31cc73[_0x5b7a9e(0x246)](_0x4a064e[_0x5b7a9e(0x1a3)]));const _0x536b6c=_0x4a064e[_0x5b7a9e(0x1a3)],_0x1cd593=a148_0x31cc73[_0x5b7a9e(0x17e)](_0x536b6c,sanitizeForFilesystem(_0x489615[_0x5b7a9e(0x201)]['name'])+_0x5b7a9e(0x196)),_0x340198=a148_0x31cc73[_0x5b7a9e(0x17e)](_0x536b6c,'code.js'),_0x3b0985=a148_0x31cc73['join'](_0x536b6c,_0x5b7a9e(0x24e)),_0x5f3859=apiExperimentalArtifactToYaml(_0x489615),_0x515f78=toExperimentalArtifactYamlString(_0x5f3859),_0x31114f=!a148_0x16858c[_0x5b7a9e(0x205)](_0x536b6c);let _0x3025be=_0x31114f,_0x54a820,_0x304797=_0x515f78+('\x0a---\x20code\x20---\x0a'+_0x5f3859[_0x5b7a9e(0x259)]+'\x0a');const _0x18895d=[..._0x5f3859['files']][_0x5b7a9e(0x1ca)]((_0x1cac44,_0x43cbc4)=>_0x1cac44[_0x5b7a9e(0x1a4)][_0x5b7a9e(0x1eb)](_0x43cbc4[_0x5b7a9e(0x1a4)]));for(const _0x4171e6 of _0x18895d){_0x304797+=_0x5b7a9e(0x22b)+_0x4171e6[_0x5b7a9e(0x1a4)]+'\x20---\x0a'+_0x4171e6[_0x5b7a9e(0x25d)]+'\x0a';}if(!_0x31114f){let _0x4d0489='';a148_0x16858c[_0x5b7a9e(0x205)](_0x1cd593)&&(_0x4d0489=a148_0x16858c[_0x5b7a9e(0x212)](_0x1cd593,'utf-8'));a148_0x16858c['existsSync'](_0x340198)&&(_0x4d0489+=_0x5b7a9e(0x22f)+a148_0x16858c[_0x5b7a9e(0x212)](_0x340198,_0x5b7a9e(0x208))+'\x0a');if(a148_0x16858c[_0x5b7a9e(0x205)](_0x3b0985)){const _0x163b2a=a148_0x16858c[_0x5b7a9e(0x1c2)](_0x3b0985),_0x29b7c7=_0x163b2a[_0x5b7a9e(0x190)](_0x4b0ed5=>{const _0x51322b=_0x5b7a9e,_0x4c05dd=a148_0x31cc73[_0x51322b(0x17e)](_0x3b0985,_0x4b0ed5);return a148_0x16858c[_0x51322b(0x1a8)](_0x4c05dd)[_0x51322b(0x19e)]();})[_0x5b7a9e(0x1ca)]((_0x4f0ae3,_0x258e7c)=>_0x4f0ae3['localeCompare'](_0x258e7c));for(const _0x33199c of _0x29b7c7){const _0x32db3f=a148_0x31cc73['join'](_0x3b0985,_0x33199c);_0x4d0489+=_0x5b7a9e(0x22b)+_0x33199c+_0x5b7a9e(0x1d3)+a148_0x16858c[_0x5b7a9e(0x212)](_0x32db3f,_0x5b7a9e(0x208))+'\x0a';}}const _0x3f622a=generateDiff(_0x4d0489,_0x304797);_0x3025be=hasChanges(_0x3f622a),_0x3025be&&(_0x54a820=formatDiffWithColors(_0x3f622a));}_0x39abaa[_0x5b7a9e(0x1af)]({'path':_0x536b6c,'content':'','isDir':!![]}),_0x39abaa[_0x5b7a9e(0x1af)]({'path':_0x1cd593,'content':_0x515f78}),_0x39abaa['push']({'path':_0x340198,'content':_0x5f3859[_0x5b7a9e(0x259)]});if(_0x5f3859[_0x5b7a9e(0x24e)][_0x5b7a9e(0x1b7)]>0x0){_0x39abaa['push']({'path':_0x3b0985,'content':'','isDir':!![]});for(const _0x5a94b7 of _0x5f3859['files']){const _0x4e885a=a148_0x31cc73[_0x5b7a9e(0x17e)](_0x3b0985,_0x5a94b7[_0x5b7a9e(0x1a4)]);_0x39abaa[_0x5b7a9e(0x1af)]({'path':_0x4e885a,'content':_0x5a94b7[_0x5b7a9e(0x25d)]});}}if(a148_0x16858c['existsSync'](_0x3b0985)){const _0x43a20f=a148_0x16858c[_0x5b7a9e(0x1c2)](_0x3b0985),_0x2baaaa=new Set(_0x5f3859[_0x5b7a9e(0x24e)][_0x5b7a9e(0x1dd)](_0x1ddc84=>_0x1ddc84[_0x5b7a9e(0x1a4)]));for(const _0x430a4c of _0x43a20f){const _0x1117fb=a148_0x31cc73[_0x5b7a9e(0x17e)](_0x3b0985,_0x430a4c);a148_0x16858c['statSync'](_0x1117fb)[_0x5b7a9e(0x19e)]()&&!_0x2baaaa[_0x5b7a9e(0x180)](_0x430a4c)&&_0x2c7d6c[_0x5b7a9e(0x1af)]({'path':_0x1117fb});}}_0x346684[_0x5b7a9e(0x217)][_0x5b7a9e(0x1af)]({'name':_0x489615['attributes'][_0x5b7a9e(0x221)],'outputPath':_0x536b6c,'isNew':_0x31114f,'hasChanges':_0x3025be,'diff':_0x54a820}),_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x217)][_0x5b7a9e(0x25a)]++;if(_0x31114f)_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x217)][_0x5b7a9e(0x1be)]++;else{if(_0x3025be)_0x346684[_0x5b7a9e(0x222)]['experimentalArtifacts'][_0x5b7a9e(0x23f)]++;else _0x346684['counts'][_0x5b7a9e(0x217)][_0x5b7a9e(0x192)]++;}}for(const _0x1885ff of _0x37cb9f){const _0x3f83fc=getSanitizedPathWithMigration(getFormInterfacesDir(_0x172435),_0x1885ff[_0x5b7a9e(0x201)]['name'],_0x5b7a9e(0x196));_0x3f83fc[_0x5b7a9e(0x1b9)]&&this[_0x5b7a9e(0x1e2)][_0x5b7a9e(0x1c7)](_0x5b7a9e(0x220)+a148_0x31cc73[_0x5b7a9e(0x246)](_0x3f83fc['oldPath'])+_0x5b7a9e(0x1d7)+a148_0x31cc73['basename'](_0x3f83fc[_0x5b7a9e(0x1a3)]));const _0x5a7448=_0x3f83fc[_0x5b7a9e(0x1a3)],_0x13d64d=await apiFormInterfaceToYaml(_0x1885ff,_0x4fc4eb),_0xcac9f3=toFormInterfaceYamlString(_0x13d64d),_0x2acff5=!a148_0x16858c[_0x5b7a9e(0x205)](_0x5a7448);let _0x1f3dfc=_0x2acff5,_0x51eb35;if(!_0x2acff5){const _0x150129=a148_0x16858c['readFileSync'](_0x5a7448,'utf-8'),_0x600950=generateDiff(_0x150129,_0xcac9f3);_0x1f3dfc=hasChanges(_0x600950),_0x1f3dfc&&(_0x51eb35=formatDiffWithColors(_0x600950));}_0x39abaa[_0x5b7a9e(0x1af)]({'path':_0x5a7448,'content':_0xcac9f3}),_0x346684['formInterfaces'][_0x5b7a9e(0x1af)]({'name':_0x1885ff[_0x5b7a9e(0x201)][_0x5b7a9e(0x221)],'outputPath':_0x5a7448,'isNew':_0x2acff5,'hasChanges':_0x1f3dfc,'diff':_0x51eb35}),_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x1d2)][_0x5b7a9e(0x25a)]++;if(_0x2acff5)_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x1d2)][_0x5b7a9e(0x1be)]++;else{if(_0x1f3dfc)_0x346684['counts'][_0x5b7a9e(0x1d2)][_0x5b7a9e(0x23f)]++;else _0x346684['counts']['formInterfaces'][_0x5b7a9e(0x192)]++;}}for(const _0x2bb716 of _0x44d2a7){if(_0x2bb716[_0x5b7a9e(0x201)][_0x5b7a9e(0x273)])continue;const _0x5158f7=getSanitizedPathWithMigration(getChatInterfacesDir(_0x172435),_0x2bb716[_0x5b7a9e(0x201)][_0x5b7a9e(0x221)],_0x5b7a9e(0x196));_0x5158f7[_0x5b7a9e(0x1b9)]&&this[_0x5b7a9e(0x1e2)]['info'](_0x5b7a9e(0x1ef)+a148_0x31cc73['basename'](_0x5158f7[_0x5b7a9e(0x27d)])+_0x5b7a9e(0x1d7)+a148_0x31cc73[_0x5b7a9e(0x246)](_0x5158f7[_0x5b7a9e(0x1a3)]));const _0xd32ad6=_0x5158f7[_0x5b7a9e(0x1a3)],_0x5a9557=await apiChatInterfaceToYaml(_0x2bb716,_0x4fc4eb),_0xbf978d=toChatInterfaceYamlString(_0x5a9557),_0x4fa1f0=!a148_0x16858c['existsSync'](_0xd32ad6);let _0x218be7=_0x4fa1f0,_0x5a4b96;if(!_0x4fa1f0){const _0x1aaef0=a148_0x16858c[_0x5b7a9e(0x212)](_0xd32ad6,_0x5b7a9e(0x208)),_0x2e1305=generateDiff(_0x1aaef0,_0xbf978d);_0x218be7=hasChanges(_0x2e1305),_0x218be7&&(_0x5a4b96=formatDiffWithColors(_0x2e1305));}_0x39abaa[_0x5b7a9e(0x1af)]({'path':_0xd32ad6,'content':_0xbf978d}),_0x346684[_0x5b7a9e(0x182)][_0x5b7a9e(0x1af)]({'name':_0x2bb716[_0x5b7a9e(0x201)][_0x5b7a9e(0x221)],'outputPath':_0xd32ad6,'isNew':_0x4fa1f0,'hasChanges':_0x218be7,'diff':_0x5a4b96}),_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x182)][_0x5b7a9e(0x25a)]++;if(_0x4fa1f0)_0x346684['counts'][_0x5b7a9e(0x182)]['new']++;else{if(_0x218be7)_0x346684[_0x5b7a9e(0x222)][_0x5b7a9e(0x182)][_0x5b7a9e(0x23f)]++;else _0x346684['counts']['chatInterfaces'][_0x5b7a9e(0x192)]++;}}if(_0x470958?.['dryRun'])return _0x346684;a148_0x16858c[_0x5b7a9e(0x257)](_0x172435,{'recursive':!![]}),a148_0x16858c['mkdirSync'](getKnowledgeBasesDir(_0x172435),{'recursive':!![]}),a148_0x16858c[_0x5b7a9e(0x257)](getPromptsDir(_0x172435),{'recursive':!![]}),a148_0x16858c[_0x5b7a9e(0x257)](getIntegrationsDir(_0x172435),{'recursive':!![]}),a148_0x16858c[_0x5b7a9e(0x257)](getExperimentalKnowledgeBasesDir(_0x172435),{'recursive':!![]}),a148_0x16858c[_0x5b7a9e(0x257)](getExperimentalArtifactsDir(_0x172435),{'recursive':!![]}),a148_0x16858c[_0x5b7a9e(0x257)](getFormInterfacesDir(_0x172435),{'recursive':!![]}),a148_0x16858c[_0x5b7a9e(0x257)](getChatInterfacesDir(_0x172435),{'recursive':!![]});const _0x4fa350=a148_0x31cc73['join'](_0x172435,_0x5b7a9e(0x1e6));a148_0x16858c[_0x5b7a9e(0x262)](_0x4fa350,createAgentConfigContent(_0x2926e4));for(const _0x5baf66 of _0x39abaa){if(_0x5baf66[_0x5b7a9e(0x24c)])a148_0x16858c[_0x5b7a9e(0x257)](_0x5baf66[_0x5b7a9e(0x1a3)],{'recursive':!![]});else{const _0x14775a=a148_0x31cc73[_0x5b7a9e(0x204)](_0x5baf66[_0x5b7a9e(0x1a3)]);!a148_0x16858c[_0x5b7a9e(0x205)](_0x14775a)&&a148_0x16858c['mkdirSync'](_0x14775a,{'recursive':!![]}),a148_0x16858c[_0x5b7a9e(0x262)](_0x5baf66[_0x5b7a9e(0x1a3)],_0x5baf66[_0x5b7a9e(0x250)]);}}for(const _0x593b65 of _0x2c7d6c){_0x593b65[_0x5b7a9e(0x24c)]?(a148_0x16858c[_0x5b7a9e(0x275)](_0x593b65[_0x5b7a9e(0x1a3)],{'recursive':!![],'force':!![]}),this[_0x5b7a9e(0x1e2)]['info']('Removed\x20deleted\x20directory:\x20'+a148_0x31cc73['basename'](a148_0x31cc73[_0x5b7a9e(0x204)](_0x593b65[_0x5b7a9e(0x1a3)]))+'/'+a148_0x31cc73[_0x5b7a9e(0x246)](_0x593b65[_0x5b7a9e(0x1a3)]))):(a148_0x16858c[_0x5b7a9e(0x275)](_0x593b65[_0x5b7a9e(0x1a3)],{'force':!![]}),this['logger'][_0x5b7a9e(0x1c7)]('Removed\x20deleted\x20file:\x20'+a148_0x31cc73[_0x5b7a9e(0x246)](a148_0x31cc73[_0x5b7a9e(0x204)](_0x593b65[_0x5b7a9e(0x1a3)]))+'/'+a148_0x31cc73[_0x5b7a9e(0x246)](_0x593b65[_0x5b7a9e(0x1a3)])));}return _0x346684;}async['pushProject'](_0x24bd1e,_0x401b12){const _0x16fc29=a148_0x3b70c0,_0x1d5591=a148_0x31cc73['join'](_0x24bd1e,_0x16fc29(0x1e6));if(!a148_0x16858c['existsSync'](_0x1d5591))throw new SDKError(ErrorCode[_0x16fc29(0x25b)],'No\x20tdx.json\x20found\x20in\x20'+_0x24bd1e,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x2e4415=loadAgentConfig(_0x1d5591),_0x18166a=await this['resolveProjectId'](_0x2e4415[_0x16fc29(0x1c3)]),_0x263783=await this[_0x16fc29(0x225)][_0x16fc29(0x1f4)](_0x18166a),_0x2634cb=_0x263783[_0x16fc29(0x201)][_0x16fc29(0x221)],_0x168b2f={'projectName':_0x2634cb,'projectId':_0x18166a,'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}}},_0x1be0a6=[],_0xe7a9ab=[],_0x3b4c4a=[],_0x1dd1fc=[],_0x5af2ce=[],_0x4e9fc8=[],_0x27f5e9=a148_0x16858c[_0x16fc29(0x1c2)](_0x24bd1e,{'withFileTypes':!![]});for(const _0x178d07 of _0x27f5e9){if(!_0x178d07[_0x16fc29(0x243)]())continue;if([_0x16fc29(0x18a),_0x16fc29(0x228),_0x16fc29(0x286),_0x16fc29(0x1bf),_0x16fc29(0x24d),_0x16fc29(0x1b1),_0x16fc29(0x21a)][_0x16fc29(0x214)](_0x178d07['name']))continue;const _0x228d4f=a148_0x31cc73[_0x16fc29(0x17e)](_0x24bd1e,_0x178d07['name']);if(isAgentDir(_0x228d4f)){const _0x538286=a148_0x31cc73[_0x16fc29(0x17e)](_0x228d4f,_0x16fc29(0x198)),_0x539290=a148_0x31cc73[_0x16fc29(0x17e)](_0x228d4f,_0x16fc29(0x189)),_0x3579cb=a148_0x31cc73['join'](_0x228d4f,_0x16fc29(0x25e)),_0x4de64a=parseAgentYaml(a148_0x16858c[_0x16fc29(0x212)](_0x538286,'utf-8'),_0x538286),_0x218eb7=a148_0x16858c['existsSync'](_0x539290)?a148_0x16858c[_0x16fc29(0x212)](_0x539290,_0x16fc29(0x208)):'',_0x319a24=a148_0x16858c['existsSync'](_0x3579cb)?a148_0x16858c['readFileSync'](_0x3579cb,_0x16fc29(0x208)):_0x4de64a['starter_message'];_0x1be0a6[_0x16fc29(0x1af)]({'name':_0x4de64a[_0x16fc29(0x221)],'dir':_0x228d4f,'yaml':_0x4de64a,'systemPrompt':_0x218eb7,'starterMessage':_0x319a24});}}const _0x5c2cf1=getKnowledgeBasesDir(_0x24bd1e);if(a148_0x16858c[_0x16fc29(0x205)](_0x5c2cf1)){const _0x29f0d8=a148_0x16858c[_0x16fc29(0x1c2)](_0x5c2cf1);for(const _0x1a65b4 of _0x29f0d8){const _0x496997=a148_0x31cc73[_0x16fc29(0x17e)](_0x5c2cf1,_0x1a65b4);if(_0x1a65b4[_0x16fc29(0x23e)]('.yml')){const _0x5c0d17=parseKnowledgeBaseYaml(a148_0x16858c[_0x16fc29(0x212)](_0x496997,_0x16fc29(0x208)),_0x496997);_0xe7a9ab[_0x16fc29(0x1af)]({'name':_0x5c0d17['name'],'path':_0x496997,'yaml':_0x5c0d17});}else{if(_0x1a65b4[_0x16fc29(0x23e)](_0x16fc29(0x224))){const _0x252d6e=a148_0x16858c[_0x16fc29(0x212)](_0x496997,_0x16fc29(0x208)),{name:_0x4c50d2,text:_0x19148a}=parseTextKnowledgeBaseMd(_0x252d6e,_0x1a65b4);_0x3b4c4a['push']({'name':_0x4c50d2,'path':_0x496997,'text':_0x19148a});}}}}const _0x4c8d13=getPromptsDir(_0x24bd1e);if(a148_0x16858c[_0x16fc29(0x205)](_0x4c8d13)){const _0x22e8cb=a148_0x16858c[_0x16fc29(0x1c2)](_0x4c8d13)[_0x16fc29(0x190)](_0x4010e8=>_0x4010e8['endsWith']('.yml'));for(const _0x36f8e6 of _0x22e8cb){const _0x26176f=a148_0x31cc73[_0x16fc29(0x17e)](_0x4c8d13,_0x36f8e6),_0x2e8ad8=parsePromptYaml(a148_0x16858c[_0x16fc29(0x212)](_0x26176f,_0x16fc29(0x208)),_0x26176f);_0x1dd1fc[_0x16fc29(0x1af)]({'name':_0x2e8ad8[_0x16fc29(0x221)],'path':_0x26176f,'yaml':_0x2e8ad8});}}const _0x2bf28c=[],_0x5e4f59=getIntegrationsDir(_0x24bd1e);if(a148_0x16858c[_0x16fc29(0x205)](_0x5e4f59)){const _0x446d19=a148_0x16858c[_0x16fc29(0x1c2)](_0x5e4f59)['filter'](_0xd77a60=>_0xd77a60[_0x16fc29(0x23e)](_0x16fc29(0x196)));for(const _0x1564dc of _0x446d19){const _0x12130b=a148_0x31cc73[_0x16fc29(0x17e)](_0x5e4f59,_0x1564dc),_0xfe39eb=parseIntegrationYaml(a148_0x16858c[_0x16fc29(0x212)](_0x12130b,_0x16fc29(0x208)),_0x12130b);if(!SAFE_INTEGRATION_TYPES[_0x16fc29(0x214)](_0xfe39eb[_0x16fc29(0x235)][_0x16fc29(0x1ad)]())){this[_0x16fc29(0x1e2)][_0x16fc29(0x191)](_0x16fc29(0x1ce)+_0xfe39eb[_0x16fc29(0x221)]+_0x16fc29(0x1fe)+_0xfe39eb[_0x16fc29(0x235)]+_0x16fc29(0x260)+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES[_0x16fc29(0x17e)](',\x20')+_0x16fc29(0x218))+_0x16fc29(0x279));continue;}_0x2bf28c[_0x16fc29(0x1af)]({'name':_0xfe39eb[_0x16fc29(0x221)],'path':_0x12130b,'yaml':_0xfe39eb});}}const _0x3449f4=getExperimentalKnowledgeBasesDir(_0x24bd1e);if(a148_0x16858c[_0x16fc29(0x205)](_0x3449f4)){const _0x5b76e4=a148_0x16858c[_0x16fc29(0x1c2)](_0x3449f4,{'withFileTypes':!![]});for(const _0x49fa24 of _0x5b76e4){if(!_0x49fa24[_0x16fc29(0x243)]())continue;const _0x191c35=a148_0x31cc73[_0x16fc29(0x17e)](_0x3449f4,_0x49fa24['name']),_0x4dda91=a148_0x31cc73[_0x16fc29(0x17e)](_0x191c35,_0x49fa24[_0x16fc29(0x221)]+_0x16fc29(0x196)),_0x26f4a8=a148_0x31cc73[_0x16fc29(0x17e)](_0x191c35,_0x16fc29(0x231));if(!a148_0x16858c[_0x16fc29(0x205)](_0x4dda91))continue;const _0x1430f0=parseExperimentalKnowledgeBaseYaml(a148_0x16858c[_0x16fc29(0x212)](_0x4dda91,'utf-8'),_0x4dda91),_0x490a46=[];if(a148_0x16858c['existsSync'](_0x26f4a8)){const _0x4ef257=a148_0x16858c[_0x16fc29(0x1c2)](_0x26f4a8,{'withFileTypes':!![]});for(const _0x3c9315 of _0x4ef257){if(!_0x3c9315[_0x16fc29(0x243)]())continue;const _0x1fe202=a148_0x31cc73[_0x16fc29(0x17e)](_0x26f4a8,_0x3c9315[_0x16fc29(0x221)]),_0x1ee2e6=a148_0x31cc73['join'](_0x1fe202,_0x16fc29(0x19c)),_0x58f011=a148_0x31cc73['join'](_0x1fe202,_0x16fc29(0x1c6));a148_0x16858c[_0x16fc29(0x205)](_0x1ee2e6)&&a148_0x16858c['existsSync'](_0x58f011)&&_0x490a46['push']({'name':_0x3c9315['name'],'code':a148_0x16858c['readFileSync'](_0x1ee2e6,'utf-8'),'json_schema':a148_0x16858c[_0x16fc29(0x212)](_0x58f011,_0x16fc29(0x208))});}}const _0x4ee23d={..._0x1430f0,'variables':_0x1430f0[_0x16fc29(0x25c)]||[],'functions':_0x490a46};_0x5af2ce[_0x16fc29(0x1af)]({'name':_0x1430f0[_0x16fc29(0x221)],'dir':_0x191c35,'def':_0x4ee23d});}}const _0x3727c5=getExperimentalArtifactsDir(_0x24bd1e);if(a148_0x16858c['existsSync'](_0x3727c5)){const _0x167cea=a148_0x16858c[_0x16fc29(0x1c2)](_0x3727c5,{'withFileTypes':!![]});for(const _0x894a13 of _0x167cea){if(!_0x894a13[_0x16fc29(0x243)]())continue;const _0x41ef22=a148_0x31cc73[_0x16fc29(0x17e)](_0x3727c5,_0x894a13[_0x16fc29(0x221)]),_0x17f1ec=a148_0x31cc73[_0x16fc29(0x17e)](_0x41ef22,_0x894a13[_0x16fc29(0x221)]+_0x16fc29(0x196)),_0x57da07=a148_0x31cc73[_0x16fc29(0x17e)](_0x41ef22,_0x16fc29(0x19c)),_0x311510=a148_0x31cc73[_0x16fc29(0x17e)](_0x41ef22,_0x16fc29(0x24e));if(!a148_0x16858c[_0x16fc29(0x205)](_0x17f1ec)||!a148_0x16858c[_0x16fc29(0x205)](_0x57da07))continue;const _0x367224=parseExperimentalArtifactYaml(a148_0x16858c[_0x16fc29(0x212)](_0x17f1ec,_0x16fc29(0x208)),_0x17f1ec),_0x132b61=a148_0x16858c[_0x16fc29(0x212)](_0x57da07,_0x16fc29(0x208)),_0x540593=[];if(a148_0x16858c['existsSync'](_0x311510)){const _0x2cc03d=a148_0x16858c['readdirSync'](_0x311510);for(const _0x4e6938 of _0x2cc03d){const _0x2f6247=a148_0x31cc73[_0x16fc29(0x17e)](_0x311510,_0x4e6938);a148_0x16858c['statSync'](_0x2f6247)[_0x16fc29(0x19e)]()&&_0x540593['push']({'file_name':_0x4e6938,'text_content':a148_0x16858c[_0x16fc29(0x212)](_0x2f6247,_0x16fc29(0x208))});}}const _0x2a452f={..._0x367224,'code':_0x132b61,'files':_0x540593};_0x4e9fc8['push']({'name':_0x367224['name'],'dir':_0x41ef22,'def':_0x2a452f});}}const _0x1288e2=[],_0x29cd19=getFormInterfacesDir(_0x24bd1e);if(a148_0x16858c[_0x16fc29(0x205)](_0x29cd19)){const _0x1ceef0=a148_0x16858c['readdirSync'](_0x29cd19)[_0x16fc29(0x190)](_0x5c93bb=>_0x5c93bb[_0x16fc29(0x23e)]('.yml'));for(const _0x66eb27 of _0x1ceef0){const _0x6f34ea=a148_0x31cc73[_0x16fc29(0x17e)](_0x29cd19,_0x66eb27),_0x30f15a=parseFormInterfaceYaml(a148_0x16858c['readFileSync'](_0x6f34ea,_0x16fc29(0x208)),_0x6f34ea);_0x1288e2['push']({'name':_0x30f15a[_0x16fc29(0x221)],'path':_0x6f34ea,'yaml':_0x30f15a});}}const _0x4d15d4=[],_0x5162ae=getChatInterfacesDir(_0x24bd1e);if(a148_0x16858c[_0x16fc29(0x205)](_0x5162ae)){const _0x4f147e=a148_0x16858c[_0x16fc29(0x1c2)](_0x5162ae)[_0x16fc29(0x190)](_0x449ba5=>_0x449ba5[_0x16fc29(0x23e)](_0x16fc29(0x196)));for(const _0x397db9 of _0x4f147e){const _0x531e59=a148_0x31cc73['join'](_0x5162ae,_0x397db9),_0x49206b=parseChatInterfaceYaml(a148_0x16858c['readFileSync'](_0x531e59,_0x16fc29(0x208)),_0x531e59);_0x4d15d4['push']({'name':_0x49206b['name'],'path':_0x531e59,'yaml':_0x49206b});}}const _0x2d1ac6=await this['client'][_0x16fc29(0x1da)](_0x18166a),_0x557b9e=await this['client'][_0x16fc29(0x1cc)](_0x18166a),_0x595754=await this['client'][_0x16fc29(0x270)](_0x18166a),_0x3a6ffc=await this[_0x16fc29(0x225)][_0x16fc29(0x1b6)](_0x18166a),_0x181736=await this[_0x16fc29(0x225)][_0x16fc29(0x1f8)](_0x18166a),_0x535a08=await safeListOrEmpty(()=>this[_0x16fc29(0x225)][_0x16fc29(0x1e3)](_0x18166a)),_0x137575=await safeListOrEmpty(()=>this[_0x16fc29(0x225)][_0x16fc29(0x175)](_0x18166a)),_0x2dc92e=await safeListOrEmpty(()=>this['client'][_0x16fc29(0x1d9)](_0x18166a)),_0x13159b=await safeListOrEmpty(()=>this[_0x16fc29(0x225)][_0x16fc29(0x1a6)](_0x18166a)),_0x3d9f67=await fetchAllToolTargetMaps((_0x9a2160,_0x8603eb)=>this['client'][_0x16fc29(0x1c9)](_0x9a2160,_0x8603eb),_0x18166a),_0x229e20=new Map(),_0x495255=new Map(),_0x542bfa=new Map(),_0x48d205=new Map(),_0x554742=new Map(),_0x471dd0=new Map(),_0x14cd7c=new Map();for(const _0x48aa5f of _0x2d1ac6){_0x229e20['set'](_0x48aa5f[_0x16fc29(0x201)][_0x16fc29(0x221)],_0x48aa5f);}for(const _0x165e3b of _0x557b9e){_0x495255[_0x16fc29(0x1de)](_0x165e3b[_0x16fc29(0x201)][_0x16fc29(0x221)],_0x165e3b);}for(const _0x4924fe of _0x595754){_0x542bfa['set'](_0x4924fe[_0x16fc29(0x201)][_0x16fc29(0x221)],_0x4924fe);}for(const _0x1cbb53 of _0x3a6ffc){_0x48d205[_0x16fc29(0x1de)](_0x1cbb53['attributes'][_0x16fc29(0x221)],_0x1cbb53);}for(const _0x27ba45 of _0x181736){_0x554742[_0x16fc29(0x1de)](_0x27ba45[_0x16fc29(0x201)]['serviceType'][_0x16fc29(0x1ad)](),_0x27ba45);}for(const _0x300e38 of _0x535a08){_0x471dd0[_0x16fc29(0x1de)](_0x300e38[_0x16fc29(0x201)][_0x16fc29(0x221)],_0x300e38);}for(const _0xe0621a of _0x137575){_0x14cd7c['set'](_0xe0621a[_0x16fc29(0x201)][_0x16fc29(0x221)],_0xe0621a);}const _0x27d287=new Map(),_0x368b36=new Map();for(const _0x2d3a70 of _0x2dc92e){_0x27d287[_0x16fc29(0x1de)](_0x2d3a70['attributes'][_0x16fc29(0x221)],_0x2d3a70);}for(const _0x396e81 of _0x13159b){_0x368b36[_0x16fc29(0x1de)](_0x396e81[_0x16fc29(0x201)][_0x16fc29(0x221)],_0x396e81);}const _0x506e65=new Map(),_0x5ba265=new Map();for(const _0x8f7b76 of _0x2d1ac6){_0x506e65['set'](_0x8f7b76[_0x16fc29(0x201)][_0x16fc29(0x221)],_0x8f7b76['id']),_0x5ba265[_0x16fc29(0x1de)](_0x8f7b76['id'],_0x8f7b76[_0x16fc29(0x201)][_0x16fc29(0x221)]);}const _0x21bce1=new Map(),_0x399133=new Map();for(const _0xaa0663 of _0x3a6ffc){_0x21bce1[_0x16fc29(0x1de)](_0xaa0663['attributes'][_0x16fc29(0x221)],_0xaa0663['id']),_0x399133[_0x16fc29(0x1de)](_0xaa0663['id'],_0xaa0663['attributes'][_0x16fc29(0x221)]);}const _0x48b3fc=_0x3d9f67['nameToId'][_0x16fc29(0x23d)]||new Map(),_0x280557=_0x3d9f67[_0x16fc29(0x1f7)]['TextKnowledgeBase']||new Map(),_0x33aec1=_0x3d9f67[_0x16fc29(0x1f7)][_0x16fc29(0x17d)]||new Map(),_0x466ecd=new Map(),_0x3ea10a={'resolveToolTargetName':buildNameResolver({..._0x3d9f67[_0x16fc29(0x280)],'Agent':_0x5ba265}),'resolvePromptName':async _0x3a9666=>_0x399133[_0x16fc29(0x21e)](_0x3a9666),'onWarning':_0x49a033=>this['logger'][_0x16fc29(0x191)](_0x49a033)};let _0x2f9f22=[];const _0x25f065={'projectId':_0x18166a,'resolveToolTargetId':buildIdResolver({..._0x3d9f67[_0x16fc29(0x1f7)],'Agent':_0x506e65}),'resolvePromptId':async _0x11ad0f=>_0x21bce1[_0x16fc29(0x21e)](_0x11ad0f),'onWarning':_0x182424=>{const _0x35cb31=_0x16fc29;this[_0x35cb31(0x1e2)]['warn'](_0x182424),_0x2f9f22[_0x35cb31(0x1af)](_0x182424);}},{resolved:_0x4a6438,unresolved:_0x5de4a3}=resolveAgentDependencies(_0x1be0a6,new Set(_0x229e20[_0x16fc29(0x289)]()));for(const {agent:_0x5c0fb5,missingDeps:_0x159f31}of _0x5de4a3){_0x168b2f[_0x16fc29(0x18b)][_0x16fc29(0x1af)]({'agentName':_0x5c0fb5[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':_0x16fc29(0x197),'error':_0x16fc29(0x1db)+_0x159f31[_0x16fc29(0x17e)](',\x20')+_0x16fc29(0x282)}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x18b)][_0x16fc29(0x20d)]++;}for(const _0x387388 of _0xe7a9ab){const _0x1ff7c9=_0x495255[_0x16fc29(0x21e)](_0x387388['yaml'][_0x16fc29(0x221)]),_0x433756=a148_0x16858c[_0x16fc29(0x212)](_0x387388[_0x16fc29(0x1a3)],_0x16fc29(0x208));if(_0x1ff7c9){const _0x173273=apiKnowledgeBaseToYaml(_0x1ff7c9),_0x1563c6=toKnowledgeBaseYamlString(_0x173273),_0x294ebb=generateDiff(_0x1563c6,_0x433756),_0x2ae9a8=hasChanges(_0x294ebb);_0x2ae9a8?(_0x168b2f[_0x16fc29(0x1fb)][_0x16fc29(0x1af)]({'name':_0x387388[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':_0x16fc29(0x23f),'id':_0x1ff7c9['id'],'diff':formatDiffWithColors(_0x294ebb)}),_0x168b2f['counts']['knowledgeBases'][_0x16fc29(0x23f)]++):(_0x168b2f[_0x16fc29(0x1fb)][_0x16fc29(0x1af)]({'name':_0x387388['yaml'][_0x16fc29(0x221)],'action':_0x16fc29(0x192),'id':_0x1ff7c9['id']}),_0x168b2f['counts'][_0x16fc29(0x1fb)][_0x16fc29(0x192)]++);}else _0x168b2f[_0x16fc29(0x1fb)][_0x16fc29(0x1af)]({'name':_0x387388[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':'created'}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x1fb)]['created']++;}for(const _0x38460a of _0x3b4c4a){const _0x4a3a67=_0x542bfa[_0x16fc29(0x21e)](_0x38460a[_0x16fc29(0x221)]),_0x1563b7=a148_0x16858c['readFileSync'](_0x38460a[_0x16fc29(0x1a3)],'utf-8');if(_0x4a3a67){const _0x46c89e=toTextKnowledgeBaseMd(_0x4a3a67[_0x16fc29(0x201)]['name'],_0x4a3a67[_0x16fc29(0x201)]['text']),_0x2d1005=generateDiff(_0x46c89e,_0x1563b7),_0x74ae96=hasChanges(_0x2d1005);_0x74ae96?(_0x168b2f[_0x16fc29(0x232)][_0x16fc29(0x1af)]({'name':_0x38460a[_0x16fc29(0x221)],'action':_0x16fc29(0x23f),'id':_0x4a3a67['id'],'diff':formatDiffWithColors(_0x2d1005)}),_0x168b2f['counts'][_0x16fc29(0x232)][_0x16fc29(0x23f)]++):(_0x168b2f[_0x16fc29(0x232)][_0x16fc29(0x1af)]({'name':_0x38460a['name'],'action':_0x16fc29(0x192),'id':_0x4a3a67['id']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x232)][_0x16fc29(0x192)]++);}else _0x168b2f[_0x16fc29(0x232)][_0x16fc29(0x1af)]({'name':_0x38460a['name'],'action':_0x16fc29(0x244)}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x232)][_0x16fc29(0x244)]++;}for(const _0x2582ef of _0x4a6438){const _0x1de41c=_0x229e20[_0x16fc29(0x21e)](_0x2582ef[_0x16fc29(0x241)][_0x16fc29(0x221)]),_0x4e994d=a148_0x31cc73[_0x16fc29(0x17e)](_0x2582ef['dir'],'agent.yml'),_0x4f005b=a148_0x16858c[_0x16fc29(0x212)](_0x4e994d,'utf-8'),_0x418768=_0x2582ef[_0x16fc29(0x264)],_0x2498cf=_0x16fc29(0x22a)+_0x418768+'\x0a\x0a#\x20agent.yml\x0a'+_0x4f005b;if(_0x1de41c){const {yaml:_0xb3afae,systemPrompt:_0x3449ba}=await agentResponseToDef(_0x1de41c,_0x3ea10a),_0x12921e=toAgentYamlString(_0xb3afae),_0x41144f='#\x20prompt.md\x0a'+_0x3449ba+_0x16fc29(0x1aa)+_0x12921e,_0x377166=generateDiff(_0x41144f,_0x2498cf),_0x4872c1=hasChanges(_0x377166);_0x4872c1?(_0x168b2f[_0x16fc29(0x18b)][_0x16fc29(0x1af)]({'agentName':_0x2582ef[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':_0x16fc29(0x23f),'agentId':_0x1de41c['id'],'diff':formatDiffWithColors(_0x377166)}),_0x168b2f['counts'][_0x16fc29(0x18b)][_0x16fc29(0x23f)]++):(_0x168b2f[_0x16fc29(0x18b)][_0x16fc29(0x1af)]({'agentName':_0x2582ef[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':_0x16fc29(0x192),'agentId':_0x1de41c['id']}),_0x168b2f[_0x16fc29(0x222)]['agents'][_0x16fc29(0x192)]++);}else _0x168b2f[_0x16fc29(0x18b)][_0x16fc29(0x1af)]({'agentName':_0x2582ef[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':_0x16fc29(0x244)}),_0x168b2f[_0x16fc29(0x222)]['agents'][_0x16fc29(0x244)]++;}for(const _0x337739 of _0x1dd1fc){const _0x549cd7=_0x48d205[_0x16fc29(0x21e)](_0x337739[_0x16fc29(0x241)][_0x16fc29(0x221)]),_0xf0fce9=a148_0x16858c[_0x16fc29(0x212)](_0x337739['path'],'utf-8');if(_0x549cd7){const _0x50b5f1=await apiPromptToYaml(_0x549cd7,_0x3ea10a);if(!_0x50b5f1){_0x168b2f[_0x16fc29(0x228)][_0x16fc29(0x1af)]({'name':_0x337739[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':'updated','id':_0x549cd7['id']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x228)]['updated']++;continue;}const _0x12101e=toPromptYamlString(_0x50b5f1),_0x5d5a39=generateDiff(_0x12101e,_0xf0fce9),_0x5ce902=hasChanges(_0x5d5a39);_0x5ce902?(_0x168b2f['prompts']['push']({'name':_0x337739[_0x16fc29(0x241)]['name'],'action':'updated','id':_0x549cd7['id'],'diff':formatDiffWithColors(_0x5d5a39)}),_0x168b2f[_0x16fc29(0x222)]['prompts']['updated']++):(_0x168b2f[_0x16fc29(0x228)][_0x16fc29(0x1af)]({'name':_0x337739[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':_0x16fc29(0x192),'id':_0x549cd7['id']}),_0x168b2f['counts'][_0x16fc29(0x228)][_0x16fc29(0x192)]++);}else _0x168b2f[_0x16fc29(0x228)]['push']({'name':_0x337739[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':_0x16fc29(0x244)}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x228)][_0x16fc29(0x244)]++;}for(const _0x4e3f8c of _0x2bf28c){const _0x57e017=_0x554742['get'](_0x4e3f8c[_0x16fc29(0x241)][_0x16fc29(0x235)]),_0x3f46d6=a148_0x16858c['readFileSync'](_0x4e3f8c[_0x16fc29(0x1a3)],_0x16fc29(0x208));if(_0x57e017){const _0x14db42=await apiIntegrationToYaml(_0x57e017,_0x3ea10a),_0x114947=toIntegrationYamlString(_0x14db42),_0x4e3c19=generateDiff(_0x114947,_0x3f46d6),_0x273958=hasChanges(_0x4e3c19);_0x273958?(_0x168b2f[_0x16fc29(0x286)][_0x16fc29(0x1af)]({'name':_0x4e3f8c[_0x16fc29(0x241)][_0x16fc29(0x235)],'action':_0x16fc29(0x23f),'id':_0x57e017['id'],'diff':formatDiffWithColors(_0x4e3c19)}),_0x168b2f[_0x16fc29(0x222)]['integrations'][_0x16fc29(0x23f)]++):(_0x168b2f[_0x16fc29(0x286)][_0x16fc29(0x1af)]({'name':_0x4e3f8c['yaml'][_0x16fc29(0x235)],'action':_0x16fc29(0x192),'id':_0x57e017['id']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x286)][_0x16fc29(0x192)]++);}else _0x168b2f['integrations'][_0x16fc29(0x1af)]({'name':_0x4e3f8c[_0x16fc29(0x241)][_0x16fc29(0x235)],'action':_0x16fc29(0x244)}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x286)][_0x16fc29(0x244)]++;}for(const _0x1f1528 of _0x5af2ce){const _0x3dec3d=_0x471dd0[_0x16fc29(0x21e)](_0x1f1528[_0x16fc29(0x195)][_0x16fc29(0x221)]),_0x37d627=toExperimentalKnowledgeBaseYamlString(_0x1f1528[_0x16fc29(0x195)]);let _0x87369f=_0x37d627;for(const _0x2cce69 of _0x1f1528[_0x16fc29(0x195)][_0x16fc29(0x231)]){_0x87369f+=_0x16fc29(0x1e0)+_0x2cce69[_0x16fc29(0x221)]+_0x16fc29(0x1d3)+_0x2cce69[_0x16fc29(0x259)]+'\x0a---\x20schema:\x20'+_0x2cce69[_0x16fc29(0x221)]+'\x20---\x0a'+_0x2cce69['json_schema']+'\x0a';}if(_0x3dec3d){const _0x59655f=apiExperimentalKnowledgeBaseToYaml(_0x3dec3d),_0x44e48b=toExperimentalKnowledgeBaseYamlString(_0x59655f);let _0x46b96a=_0x44e48b;for(const _0x8a8b9c of _0x59655f[_0x16fc29(0x231)]){_0x46b96a+=_0x16fc29(0x1e0)+_0x8a8b9c[_0x16fc29(0x221)]+_0x16fc29(0x1d3)+_0x8a8b9c[_0x16fc29(0x259)]+'\x0a---\x20schema:\x20'+_0x8a8b9c[_0x16fc29(0x221)]+_0x16fc29(0x1d3)+_0x8a8b9c['json_schema']+'\x0a';}const _0x320a1a=generateDiff(_0x46b96a,_0x87369f),_0x5afc51=hasChanges(_0x320a1a);_0x5afc51?(_0x168b2f['experimentalKnowledgeBases'][_0x16fc29(0x1af)]({'name':_0x1f1528['def'][_0x16fc29(0x221)],'action':_0x16fc29(0x23f),'id':_0x3dec3d['id'],'diff':formatDiffWithColors(_0x320a1a)}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x236)][_0x16fc29(0x23f)]++):(_0x168b2f[_0x16fc29(0x236)][_0x16fc29(0x1af)]({'name':_0x1f1528[_0x16fc29(0x195)][_0x16fc29(0x221)],'action':_0x16fc29(0x192),'id':_0x3dec3d['id']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x236)][_0x16fc29(0x192)]++);}else _0x168b2f[_0x16fc29(0x236)][_0x16fc29(0x1af)]({'name':_0x1f1528[_0x16fc29(0x195)][_0x16fc29(0x221)],'action':'created'}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x236)]['created']++;}for(const _0x5ce049 of _0x4e9fc8){const _0x459fd1=_0x14cd7c[_0x16fc29(0x21e)](_0x5ce049[_0x16fc29(0x195)][_0x16fc29(0x221)]),_0x18b5eb=toExperimentalArtifactYamlString(_0x5ce049['def']);let _0x4954d4=_0x18b5eb+(_0x16fc29(0x22f)+_0x5ce049[_0x16fc29(0x195)][_0x16fc29(0x259)]+'\x0a');for(const _0x158131 of _0x5ce049[_0x16fc29(0x195)][_0x16fc29(0x24e)]){_0x4954d4+='---\x20file:\x20'+_0x158131[_0x16fc29(0x1a4)]+_0x16fc29(0x1d3)+_0x158131[_0x16fc29(0x25d)]+'\x0a';}if(_0x459fd1){const _0x4bebf8=apiExperimentalArtifactToYaml(_0x459fd1),_0x1e2e40=toExperimentalArtifactYamlString(_0x4bebf8);let _0x2ab6e8=_0x1e2e40+(_0x16fc29(0x22f)+_0x4bebf8['code']+'\x0a');for(const _0x7681ef of _0x4bebf8[_0x16fc29(0x24e)]){_0x2ab6e8+=_0x16fc29(0x22b)+_0x7681ef[_0x16fc29(0x1a4)]+_0x16fc29(0x1d3)+_0x7681ef[_0x16fc29(0x25d)]+'\x0a';}const _0x5564db=generateDiff(_0x2ab6e8,_0x4954d4),_0x39778a=hasChanges(_0x5564db);_0x39778a?(_0x168b2f[_0x16fc29(0x217)]['push']({'name':_0x5ce049['def']['name'],'action':_0x16fc29(0x23f),'id':_0x459fd1['id'],'diff':formatDiffWithColors(_0x5564db)}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x217)]['updated']++):(_0x168b2f['experimentalArtifacts'][_0x16fc29(0x1af)]({'name':_0x5ce049['def'][_0x16fc29(0x221)],'action':'unchanged','id':_0x459fd1['id']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x217)][_0x16fc29(0x192)]++);}else _0x168b2f[_0x16fc29(0x217)][_0x16fc29(0x1af)]({'name':_0x5ce049[_0x16fc29(0x195)][_0x16fc29(0x221)],'action':_0x16fc29(0x244)}),_0x168b2f[_0x16fc29(0x222)]['experimentalArtifacts']['created']++;}for(const _0x3ec121 of _0x1288e2){const _0x38d68b=_0x27d287[_0x16fc29(0x21e)](_0x3ec121[_0x16fc29(0x241)]['name']),_0x5f3b49=a148_0x16858c[_0x16fc29(0x212)](_0x3ec121['path'],'utf-8');if(_0x38d68b){const _0x203c45=await apiFormInterfaceToYaml(_0x38d68b,_0x3ea10a),_0x1fc9ed=toFormInterfaceYamlString(_0x203c45),_0x1de455=generateDiff(_0x1fc9ed,_0x5f3b49),_0x5a70cf=hasChanges(_0x1de455);_0x5a70cf?(_0x168b2f['formInterfaces'][_0x16fc29(0x1af)]({'name':_0x3ec121[_0x16fc29(0x241)]['name'],'action':_0x16fc29(0x23f),'id':_0x38d68b['id'],'diff':formatDiffWithColors(_0x1de455)}),_0x168b2f[_0x16fc29(0x222)]['formInterfaces'][_0x16fc29(0x23f)]++):(_0x168b2f[_0x16fc29(0x1d2)]['push']({'name':_0x3ec121[_0x16fc29(0x241)]['name'],'action':_0x16fc29(0x192),'id':_0x38d68b['id']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x1d2)]['unchanged']++);}else _0x168b2f[_0x16fc29(0x1d2)][_0x16fc29(0x1af)]({'name':_0x3ec121[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':_0x16fc29(0x244)}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x1d2)][_0x16fc29(0x244)]++;}for(const _0x480776 of _0x4d15d4){const _0x24f769=_0x368b36['get'](_0x480776[_0x16fc29(0x241)][_0x16fc29(0x221)]),_0x56d097=a148_0x16858c[_0x16fc29(0x212)](_0x480776[_0x16fc29(0x1a3)],_0x16fc29(0x208));if(_0x24f769){const _0x2fa807=await apiChatInterfaceToYaml(_0x24f769,_0x3ea10a),_0x2675cd=toChatInterfaceYamlString(_0x2fa807),_0xc889fb=generateDiff(_0x2675cd,_0x56d097),_0x26a3cb=hasChanges(_0xc889fb);_0x26a3cb?(_0x168b2f[_0x16fc29(0x182)][_0x16fc29(0x1af)]({'name':_0x480776[_0x16fc29(0x241)]['name'],'action':_0x16fc29(0x23f),'id':_0x24f769['id'],'diff':formatDiffWithColors(_0xc889fb)}),_0x168b2f['counts'][_0x16fc29(0x182)]['updated']++):(_0x168b2f[_0x16fc29(0x182)][_0x16fc29(0x1af)]({'name':_0x480776[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':'unchanged','id':_0x24f769['id']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x182)][_0x16fc29(0x192)]++);}else _0x168b2f[_0x16fc29(0x182)][_0x16fc29(0x1af)]({'name':_0x480776[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':'created'}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x182)]['created']++;}if(_0x401b12?.[_0x16fc29(0x206)])return _0x168b2f;_0x168b2f[_0x16fc29(0x1fb)]=[],_0x168b2f[_0x16fc29(0x232)]=[],_0x168b2f[_0x16fc29(0x228)]=[],_0x168b2f[_0x16fc29(0x286)]=[],_0x168b2f[_0x16fc29(0x236)]=[],_0x168b2f[_0x16fc29(0x217)]=[],_0x168b2f[_0x16fc29(0x1d2)]=[],_0x168b2f['chatInterfaces']=[];const _0x3e2c78=_0x168b2f['agents'][_0x16fc29(0x190)](_0x1ef32a=>_0x1ef32a[_0x16fc29(0x21d)]==='error');_0x168b2f[_0x16fc29(0x18b)]=_0x3e2c78,_0x168b2f[_0x16fc29(0x222)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x3e2c78[_0x16fc29(0x1b7)]},'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 _0x51850e of _0xe7a9ab){try{const _0x587e6f=_0x495255[_0x16fc29(0x21e)](_0x51850e[_0x16fc29(0x241)][_0x16fc29(0x221)]),_0x281e02=yamlKnowledgeBaseToApi(_0x51850e[_0x16fc29(0x241)],_0x18166a);if(_0x587e6f)await this[_0x16fc29(0x225)]['updateKnowledgeBase'](_0x587e6f['id'],_0x281e02),_0x48b3fc[_0x16fc29(0x1de)](_0x51850e[_0x16fc29(0x241)][_0x16fc29(0x221)],_0x587e6f['id']),_0x168b2f[_0x16fc29(0x1fb)][_0x16fc29(0x1af)]({'name':_0x51850e[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':_0x16fc29(0x23f),'id':_0x587e6f['id']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x1fb)][_0x16fc29(0x23f)]++;else{const _0x4f3284=await this[_0x16fc29(0x225)]['createKnowledgeBase'](_0x281e02);_0x48b3fc[_0x16fc29(0x1de)](_0x51850e[_0x16fc29(0x241)]['name'],_0x4f3284['id']),_0x168b2f[_0x16fc29(0x1fb)][_0x16fc29(0x1af)]({'name':_0x51850e[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':_0x16fc29(0x244),'id':_0x4f3284['id']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x1fb)][_0x16fc29(0x244)]++;}}catch(_0x5d38e4){_0x168b2f['knowledgeBases'][_0x16fc29(0x1af)]({'name':_0x51850e[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':_0x16fc29(0x197),'error':_0x5d38e4[_0x16fc29(0x272)]}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x1fb)]['errors']++;}}for(const _0x465966 of _0x3b4c4a){try{const _0x3257a0=_0x542bfa['get'](_0x465966[_0x16fc29(0x221)]),_0x28ad6e=yamlTextKnowledgeBaseToApi({'name':_0x465966['name'],'text':_0x465966[_0x16fc29(0x245)]},_0x18166a);if(_0x3257a0)await this[_0x16fc29(0x225)]['updateTextKnowledgeBase'](_0x3257a0['id'],_0x28ad6e),_0x280557[_0x16fc29(0x1de)](_0x465966[_0x16fc29(0x221)],_0x3257a0['id']),_0x168b2f['textKnowledgeBases'][_0x16fc29(0x1af)]({'name':_0x465966[_0x16fc29(0x221)],'action':_0x16fc29(0x23f),'id':_0x3257a0['id']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x232)]['updated']++;else{const _0x291191=await this[_0x16fc29(0x225)][_0x16fc29(0x1ee)](_0x28ad6e);_0x280557[_0x16fc29(0x1de)](_0x465966[_0x16fc29(0x221)],_0x291191['id']),_0x168b2f[_0x16fc29(0x232)]['push']({'name':_0x465966[_0x16fc29(0x221)],'action':'created','id':_0x291191['id']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x232)][_0x16fc29(0x244)]++;}}catch(_0x23ae48){_0x168b2f['textKnowledgeBases'][_0x16fc29(0x1af)]({'name':_0x465966[_0x16fc29(0x221)],'action':_0x16fc29(0x197),'error':_0x23ae48[_0x16fc29(0x272)]}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x232)][_0x16fc29(0x20d)]++;}}for(const _0x107358 of _0x5af2ce){try{const _0x122b66=_0x471dd0[_0x16fc29(0x21e)](_0x107358['def'][_0x16fc29(0x221)]),_0x7c823d=yamlExperimentalKnowledgeBaseToApi(_0x107358[_0x16fc29(0x195)],_0x18166a);if(_0x122b66)await this['client']['updateExperimentalKnowledgeBase'](_0x122b66['id'],_0x7c823d),_0x33aec1[_0x16fc29(0x1de)](_0x107358[_0x16fc29(0x195)]['name'],_0x122b66['id']),_0x168b2f[_0x16fc29(0x236)][_0x16fc29(0x1af)]({'name':_0x107358[_0x16fc29(0x195)][_0x16fc29(0x221)],'action':_0x16fc29(0x23f),'id':_0x122b66['id']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x236)]['updated']++;else{const _0x1122fd=await this[_0x16fc29(0x225)]['createExperimentalKnowledgeBase'](_0x7c823d);_0x33aec1['set'](_0x107358[_0x16fc29(0x195)][_0x16fc29(0x221)],_0x1122fd['id']),_0x168b2f['experimentalKnowledgeBases'][_0x16fc29(0x1af)]({'name':_0x107358[_0x16fc29(0x195)][_0x16fc29(0x221)],'action':_0x16fc29(0x244),'id':_0x1122fd['id']}),_0x168b2f['counts']['experimentalKnowledgeBases']['created']++;}}catch(_0x14aa20){_0x168b2f[_0x16fc29(0x236)]['push']({'name':_0x107358[_0x16fc29(0x195)]['name'],'action':_0x16fc29(0x197),'error':_0x14aa20[_0x16fc29(0x272)]}),_0x168b2f[_0x16fc29(0x222)]['experimentalKnowledgeBases']['errors']++;}}for(const _0x55bf81 of _0x4e9fc8){try{const _0x42b474=_0x14cd7c['get'](_0x55bf81['def'][_0x16fc29(0x221)]),_0x5df2fd=yamlExperimentalArtifactToApi(_0x55bf81[_0x16fc29(0x195)],_0x18166a);if(_0x42b474)await this[_0x16fc29(0x225)][_0x16fc29(0x172)](_0x42b474['id'],_0x5df2fd),_0x466ecd[_0x16fc29(0x1de)](_0x55bf81[_0x16fc29(0x195)]['name'],_0x42b474['id']),_0x168b2f['experimentalArtifacts'][_0x16fc29(0x1af)]({'name':_0x55bf81[_0x16fc29(0x195)]['name'],'action':_0x16fc29(0x23f),'id':_0x42b474['id']}),_0x168b2f['counts'][_0x16fc29(0x217)][_0x16fc29(0x23f)]++;else{const _0x5e4b65=await this[_0x16fc29(0x225)][_0x16fc29(0x213)](_0x5df2fd);_0x466ecd[_0x16fc29(0x1de)](_0x55bf81[_0x16fc29(0x195)][_0x16fc29(0x221)],_0x5e4b65['id']),_0x168b2f['experimentalArtifacts']['push']({'name':_0x55bf81['def'][_0x16fc29(0x221)],'action':_0x16fc29(0x244),'id':_0x5e4b65['id']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x217)]['created']++;}}catch(_0x1a8d70){_0x168b2f[_0x16fc29(0x217)]['push']({'name':_0x55bf81['def']['name'],'action':_0x16fc29(0x197),'error':_0x1a8d70[_0x16fc29(0x272)]}),_0x168b2f[_0x16fc29(0x222)]['experimentalArtifacts'][_0x16fc29(0x20d)]++;}}for(const _0x14fad of _0x4a6438){_0x2f9f22=[];try{const _0x5be9c3=_0x229e20['get'](_0x14fad['yaml'][_0x16fc29(0x221)]),_0x5364f1=await agentDefToRequest(_0x14fad[_0x16fc29(0x241)],_0x14fad['systemPrompt'],_0x14fad['starterMessage'],_0x25f065);if(_0x5be9c3)await this[_0x16fc29(0x225)][_0x16fc29(0x277)](_0x5be9c3['id'],_0x5364f1),_0x506e65[_0x16fc29(0x1de)](_0x14fad[_0x16fc29(0x241)][_0x16fc29(0x221)],_0x5be9c3['id']),_0x168b2f[_0x16fc29(0x18b)]['push']({'agentName':_0x14fad[_0x16fc29(0x241)]['name'],'action':_0x16fc29(0x23f),'agentId':_0x5be9c3['id'],'warnings':_0x2f9f22[_0x16fc29(0x1b7)]>0x0?_0x2f9f22:undefined}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x18b)][_0x16fc29(0x23f)]++;else{const _0x253a57=await this[_0x16fc29(0x225)][_0x16fc29(0x209)](_0x5364f1);_0x506e65[_0x16fc29(0x1de)](_0x14fad[_0x16fc29(0x241)][_0x16fc29(0x221)],_0x253a57['id']),_0x168b2f[_0x16fc29(0x18b)][_0x16fc29(0x1af)]({'agentName':_0x14fad[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':'created','agentId':_0x253a57['id'],'warnings':_0x2f9f22['length']>0x0?_0x2f9f22:undefined}),_0x168b2f[_0x16fc29(0x222)]['agents']['created']++;}}catch(_0xa7c0dd){_0x168b2f['agents'][_0x16fc29(0x1af)]({'agentName':_0x14fad[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':'error','error':_0xa7c0dd[_0x16fc29(0x272)],'warnings':_0x2f9f22[_0x16fc29(0x1b7)]>0x0?_0x2f9f22:undefined}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x18b)][_0x16fc29(0x20d)]++;}}for(const _0x48becc of _0x1dd1fc){try{const _0x31ee5e=_0x48d205[_0x16fc29(0x21e)](_0x48becc[_0x16fc29(0x241)][_0x16fc29(0x221)]),_0x4b621d=await yamlPromptToApi(_0x48becc[_0x16fc29(0x241)],_0x18166a,_0x25f065);if(!_0x4b621d){_0x168b2f['prompts']['push']({'name':_0x48becc[_0x16fc29(0x241)]['name'],'action':_0x16fc29(0x197),'error':_0x16fc29(0x27e)}),_0x168b2f['counts'][_0x16fc29(0x228)][_0x16fc29(0x20d)]++;continue;}if(_0x31ee5e)await this[_0x16fc29(0x225)][_0x16fc29(0x242)](_0x31ee5e['id'],_0x4b621d),_0x21bce1[_0x16fc29(0x1de)](_0x48becc['yaml']['name'],_0x31ee5e['id']),_0x168b2f[_0x16fc29(0x228)][_0x16fc29(0x1af)]({'name':_0x48becc[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':'updated','id':_0x31ee5e['id']}),_0x168b2f['counts'][_0x16fc29(0x228)][_0x16fc29(0x23f)]++;else{const _0x1bed8a=await this[_0x16fc29(0x225)][_0x16fc29(0x1bb)](_0x4b621d);_0x21bce1[_0x16fc29(0x1de)](_0x48becc[_0x16fc29(0x241)][_0x16fc29(0x221)],_0x1bed8a['id']),_0x168b2f[_0x16fc29(0x228)][_0x16fc29(0x1af)]({'name':_0x48becc[_0x16fc29(0x241)]['name'],'action':_0x16fc29(0x244),'id':_0x1bed8a['id']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x228)][_0x16fc29(0x244)]++;}}catch(_0x3dee5c){_0x168b2f[_0x16fc29(0x228)][_0x16fc29(0x1af)]({'name':_0x48becc[_0x16fc29(0x241)]['name'],'action':_0x16fc29(0x197),'error':_0x3dee5c[_0x16fc29(0x272)]}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x228)][_0x16fc29(0x20d)]++;}}for(const _0x561b17 of _0x2bf28c){try{const _0x2d5050=_0x554742['get'](_0x561b17[_0x16fc29(0x241)]['service_type']),_0x42b63c=await yamlIntegrationToApi(_0x561b17[_0x16fc29(0x241)],_0x18166a,_0x25f065);if(_0x2d5050){await this['client']['deleteIntegration'](_0x2d5050['id']);const _0x59c3b2=await this[_0x16fc29(0x225)][_0x16fc29(0x26a)](_0x42b63c);_0x168b2f['integrations']['push']({'name':_0x561b17[_0x16fc29(0x241)][_0x16fc29(0x235)],'action':_0x16fc29(0x23f),'id':_0x59c3b2['id']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x286)][_0x16fc29(0x23f)]++;}else{const _0x44bb57=await this[_0x16fc29(0x225)][_0x16fc29(0x26a)](_0x42b63c);_0x168b2f[_0x16fc29(0x286)]['push']({'name':_0x561b17['yaml'][_0x16fc29(0x235)],'action':_0x16fc29(0x244),'id':_0x44bb57['id']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x286)][_0x16fc29(0x244)]++;}}catch(_0x46374b){_0x168b2f['integrations'][_0x16fc29(0x1af)]({'name':_0x561b17[_0x16fc29(0x241)][_0x16fc29(0x235)],'action':_0x16fc29(0x197),'error':_0x46374b[_0x16fc29(0x272)]}),_0x168b2f[_0x16fc29(0x222)]['integrations']['errors']++;}}for(const _0x818ab3 of _0x1288e2){try{const _0x7fc488=_0x27d287[_0x16fc29(0x21e)](_0x818ab3[_0x16fc29(0x241)]['name']),_0x301251=await yamlFormInterfaceToApi(_0x818ab3[_0x16fc29(0x241)],_0x18166a,_0x25f065);if(!_0x301251){_0x168b2f[_0x16fc29(0x1d2)]['push']({'name':_0x818ab3['yaml'][_0x16fc29(0x221)],'action':_0x16fc29(0x197),'error':_0x16fc29(0x229)}),_0x168b2f['counts'][_0x16fc29(0x1d2)][_0x16fc29(0x20d)]++;continue;}if(_0x7fc488){const _0x3aa34b=await this[_0x16fc29(0x225)]['updateFormInterface'](_0x7fc488['id'],_0x301251);_0x168b2f[_0x16fc29(0x1d2)][_0x16fc29(0x1af)]({'name':_0x818ab3['yaml'][_0x16fc29(0x221)],'action':_0x16fc29(0x23f),'id':_0x3aa34b['id']}),_0x168b2f['counts']['formInterfaces']['updated']++;}else{const _0x18fe7e=await this[_0x16fc29(0x225)][_0x16fc29(0x237)](_0x301251);_0x168b2f['formInterfaces'][_0x16fc29(0x1af)]({'name':_0x818ab3[_0x16fc29(0x241)]['name'],'action':_0x16fc29(0x244),'id':_0x18fe7e['id']}),_0x168b2f[_0x16fc29(0x222)]['formInterfaces'][_0x16fc29(0x244)]++;}}catch(_0x5957a5){_0x168b2f[_0x16fc29(0x1d2)][_0x16fc29(0x1af)]({'name':_0x818ab3['yaml']['name'],'action':_0x16fc29(0x197),'error':_0x5957a5['message']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x1d2)]['errors']++;}}for(const _0x2c7e59 of _0x4d15d4){try{const _0x520e0a=_0x368b36[_0x16fc29(0x21e)](_0x2c7e59[_0x16fc29(0x241)]['name']),_0x4dfd1d=await yamlChatInterfaceToApi(_0x2c7e59[_0x16fc29(0x241)],_0x18166a,_0x25f065);if(_0x520e0a){const _0x280fef=await this[_0x16fc29(0x225)][_0x16fc29(0x223)](_0x520e0a['id'],_0x4dfd1d);_0x168b2f['chatInterfaces']['push']({'name':_0x2c7e59[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':_0x16fc29(0x23f),'id':_0x280fef['id']}),_0x168b2f['counts'][_0x16fc29(0x182)][_0x16fc29(0x23f)]++;}else{const _0x2f36b3=await this[_0x16fc29(0x225)][_0x16fc29(0x27f)](_0x4dfd1d);_0x168b2f[_0x16fc29(0x182)]['push']({'name':_0x2c7e59[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':_0x16fc29(0x244),'id':_0x2f36b3['id']}),_0x168b2f[_0x16fc29(0x222)][_0x16fc29(0x182)][_0x16fc29(0x244)]++;}}catch(_0x3e3755){_0x168b2f[_0x16fc29(0x182)][_0x16fc29(0x1af)]({'name':_0x2c7e59[_0x16fc29(0x241)][_0x16fc29(0x221)],'action':_0x16fc29(0x197),'error':_0x3e3755['message']}),_0x168b2f[_0x16fc29(0x222)]['chatInterfaces']['errors']++;}}return _0x168b2f;}async[a148_0x3b70c0(0x226)](_0x47a139,_0x3f7a97,_0x243c46,_0xaeeb9a){const _0x1106c2=a148_0x3b70c0,{projectId:_0x238292,project:_0x46c811}=await this[_0x1106c2(0x193)](_0x47a139),_0x1d9c26=_0x46c811[_0x1106c2(0x201)][_0x1106c2(0x221)],_0x1d4008=await this[_0x1106c2(0x225)][_0x1106c2(0x1da)](_0x238292),_0x4b54b5=_0x1d4008[_0x1106c2(0x26c)](_0x59c080=>_0x59c080['attributes'][_0x1106c2(0x221)]===_0x3f7a97);if(!_0x4b54b5)throw new SDKError(ErrorCode[_0x1106c2(0x287)],'Agent\x20not\x20found:\x20'+_0x3f7a97,undefined,{'helpText':_0x1106c2(0x16e)+_0x1d4008[_0x1106c2(0x1dd)](_0x3dbfb8=>_0x3dbfb8[_0x1106c2(0x201)][_0x1106c2(0x221)])[_0x1106c2(0x17e)](',\x20')});let _0x2de0af;if(_0x243c46)_0x2de0af=_0x243c46;else{const _0x46ee53=a148_0x31cc73[_0x1106c2(0x17e)](process[_0x1106c2(0x1a5)](),_0x1106c2(0x18b)),_0x219a69=getSanitizedPathWithMigration(_0x46ee53,_0x1d9c26);_0x219a69[_0x1106c2(0x1b9)]&&this[_0x1106c2(0x1e2)]['info'](_0x1106c2(0x248)+a148_0x31cc73[_0x1106c2(0x246)](_0x219a69[_0x1106c2(0x27d)])+_0x1106c2(0x1d7)+a148_0x31cc73[_0x1106c2(0x246)](_0x219a69[_0x1106c2(0x1a3)])),_0x2de0af=_0x219a69[_0x1106c2(0x1a3)];}const _0x54d828=getSanitizedPathWithMigration(_0x2de0af,_0x3f7a97);_0x54d828[_0x1106c2(0x1b9)]&&this['logger'][_0x1106c2(0x1c7)](_0x1106c2(0x26b)+a148_0x31cc73['basename'](_0x54d828['oldPath'])+_0x1106c2(0x1d7)+a148_0x31cc73[_0x1106c2(0x246)](_0x54d828[_0x1106c2(0x1a3)]));const _0x2a254e=_0x54d828['path'],_0x38b8c2=new Map(),_0xa1f491=new Map(),_0x473d93=await this[_0x1106c2(0x225)][_0x1106c2(0x1cc)](_0x238292),_0x5b28d7=await this[_0x1106c2(0x225)][_0x1106c2(0x270)](_0x238292),_0x2c0f4a=await safeListOrEmpty(()=>this[_0x1106c2(0x225)][_0x1106c2(0x1e3)](_0x238292)),_0x5c68fa=new Map(),_0x5f479b=new Map();for(const _0x6c7937 of _0x473d93){_0x38b8c2[_0x1106c2(0x1de)](_0x6c7937['id'],_0x6c7937[_0x1106c2(0x201)]['name']);}for(const _0x57c8ba of _0x5b28d7){_0x5c68fa['set'](_0x57c8ba['id'],_0x57c8ba[_0x1106c2(0x201)]['name']);}for(const _0x51013b of _0x2c0f4a){_0x5f479b[_0x1106c2(0x1de)](_0x51013b['id'],_0x51013b['attributes']['name']);}for(const _0x509ebf of _0x1d4008){_0xa1f491['set'](_0x509ebf['id'],_0x509ebf['attributes'][_0x1106c2(0x221)]);}const _0x35059a={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x38b8c2,'TextKnowledgeBase':_0x5c68fa,'Agent':_0xa1f491,'ExperimentalKnowledgeBase':_0x5f479b}),'resolvePromptName':async()=>undefined,'onWarning':_0x4c557a=>this[_0x1106c2(0x1e2)][_0x1106c2(0x191)](_0x4c557a)},_0x19e694=a148_0x31cc73[_0x1106c2(0x17e)](_0x2a254e,'prompt.md'),_0x327fad=a148_0x31cc73[_0x1106c2(0x17e)](_0x2a254e,_0x1106c2(0x198)),_0x453fce=a148_0x31cc73[_0x1106c2(0x17e)](_0x2a254e,_0x1106c2(0x25e)),_0x3225c3=!a148_0x16858c[_0x1106c2(0x205)](_0x327fad);if(_0xaeeb9a?.[_0x1106c2(0x206)])return{'agentName':_0x3f7a97,'outputPath':_0x2a254e,'isNew':_0x3225c3,'hasChanges':!![]};a148_0x16858c[_0x1106c2(0x257)](_0x2de0af,{'recursive':!![]}),a148_0x16858c['mkdirSync'](_0x2a254e,{'recursive':!![]});const _0x103f21=a148_0x31cc73[_0x1106c2(0x17e)](_0x2de0af,'tdx.json');!a148_0x16858c[_0x1106c2(0x205)](_0x103f21)&&a148_0x16858c[_0x1106c2(0x262)](_0x103f21,createAgentConfigContent(_0x47a139));const {yaml:_0x54abc5,systemPrompt:_0x5f3ec0,starterMessage:_0x3c8352}=await agentResponseToDef(_0x4b54b5,_0x35059a);let _0x2db9c2=_0x3225c3;if(!_0x3225c3){const _0x1ba6cc=a148_0x16858c['existsSync'](_0x19e694)?a148_0x16858c[_0x1106c2(0x212)](_0x19e694,_0x1106c2(0x208)):'',_0x36c240=a148_0x16858c[_0x1106c2(0x212)](_0x327fad,_0x1106c2(0x208));_0x2db9c2=_0x1ba6cc!==_0x5f3ec0||_0x36c240!==toAgentYamlString(_0x54abc5);}a148_0x16858c[_0x1106c2(0x262)](_0x19e694,_0x5f3ec0),a148_0x16858c[_0x1106c2(0x262)](_0x327fad,toAgentYamlString(_0x54abc5));if(_0x3c8352&&_0x3c8352[_0x1106c2(0x214)]('\x0a'))a148_0x16858c['writeFileSync'](_0x453fce,_0x3c8352);else a148_0x16858c[_0x1106c2(0x205)](_0x453fce)&&a148_0x16858c['unlinkSync'](_0x453fce);return{'agentName':_0x3f7a97,'outputPath':_0x2a254e,'isNew':_0x3225c3,'hasChanges':_0x2db9c2};}async['pushAgent'](_0x21ac87,_0x91c4f2){const _0x3d8360=a148_0x3b70c0;let _0x91db7;isAgentYamlPath(_0x21ac87)?_0x91db7=getAgentDirFromYamlPath(_0x21ac87):_0x91db7=_0x21ac87;const {config:_0x53d610}=findAgentConfig(_0x91db7),_0x3b53c4=await this[_0x3d8360(0x1f5)](_0x53d610['llm_project']),_0x34f492=a148_0x31cc73[_0x3d8360(0x17e)](_0x91db7,'agent.yml'),_0x394a69=a148_0x31cc73[_0x3d8360(0x17e)](_0x91db7,_0x3d8360(0x189)),_0x6604b0=a148_0x31cc73[_0x3d8360(0x17e)](_0x91db7,'starter_message.md');if(!a148_0x16858c[_0x3d8360(0x205)](_0x34f492))throw new SDKError(ErrorCode['NOT_FOUND'],_0x3d8360(0x285)+_0x91db7,undefined,{'helpText':'Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.'});const _0x2b61b6=parseAgentYaml(a148_0x16858c[_0x3d8360(0x212)](_0x34f492,_0x3d8360(0x208)),_0x34f492),_0x3ff516=a148_0x16858c[_0x3d8360(0x205)](_0x394a69)?a148_0x16858c[_0x3d8360(0x212)](_0x394a69,'utf-8'):'',_0x28dbb4=a148_0x16858c[_0x3d8360(0x205)](_0x6604b0)?a148_0x16858c[_0x3d8360(0x212)](_0x6604b0,_0x3d8360(0x208)):_0x2b61b6[_0x3d8360(0x256)];if(_0x91c4f2?.['dryRun'])return{'agentName':_0x2b61b6[_0x3d8360(0x221)],'action':_0x3d8360(0x244),'projectId':_0x3b53c4};const _0x5ce1cc=await this[_0x3d8360(0x225)][_0x3d8360(0x1da)](_0x3b53c4),_0x5ba88f=await fetchAllToolTargetMaps((_0x4afe66,_0x2dcbbf)=>this[_0x3d8360(0x225)][_0x3d8360(0x1c9)](_0x4afe66,_0x2dcbbf),_0x3b53c4),_0x437b5a=new Map();for(const _0x5cf149 of _0x5ce1cc){_0x437b5a[_0x3d8360(0x1de)](_0x5cf149[_0x3d8360(0x201)][_0x3d8360(0x221)],_0x5cf149['id']);}const _0x4465d1=[],_0x258f13={'projectId':_0x3b53c4,'resolveToolTargetId':buildIdResolver({..._0x5ba88f['nameToId'],'Agent':_0x437b5a}),'resolvePromptId':async()=>undefined,'onWarning':_0x580d1d=>{const _0xb927f2=_0x3d8360;this[_0xb927f2(0x1e2)][_0xb927f2(0x191)](_0x580d1d),_0x4465d1[_0xb927f2(0x1af)](_0x580d1d);}};try{const _0x3e0529=_0x5ce1cc[_0x3d8360(0x26c)](_0x3471e5=>_0x3471e5[_0x3d8360(0x201)]['name']===_0x2b61b6[_0x3d8360(0x221)]),_0x38aef4=await agentDefToRequest(_0x2b61b6,_0x3ff516,_0x28dbb4,_0x258f13);if(_0x3e0529)return await this[_0x3d8360(0x225)][_0x3d8360(0x277)](_0x3e0529['id'],_0x38aef4),{'agentName':_0x2b61b6['name'],'action':_0x3d8360(0x23f),'projectId':_0x3b53c4,'agentId':_0x3e0529['id'],'warnings':_0x4465d1['length']>0x0?_0x4465d1:undefined};else{const _0x2a748a=await this[_0x3d8360(0x225)][_0x3d8360(0x209)](_0x38aef4);return{'agentName':_0x2b61b6[_0x3d8360(0x221)],'action':_0x3d8360(0x244),'projectId':_0x3b53c4,'agentId':_0x2a748a['id'],'warnings':_0x4465d1[_0x3d8360(0x1b7)]>0x0?_0x4465d1:undefined};}}catch(_0x4d0341){return{'agentName':_0x2b61b6[_0x3d8360(0x221)],'action':'error','projectId':_0x3b53c4,'error':_0x4d0341[_0x3d8360(0x272)],'warnings':_0x4465d1[_0x3d8360(0x1b7)]>0x0?_0x4465d1:undefined};}}async[a148_0x3b70c0(0x263)](_0x38d811,_0xaea139,_0xa952b1){const _0x523f6e=a148_0x3b70c0,_0x12914a=a148_0x16858c['existsSync'](_0x38d811)&&a148_0x16858c[_0x523f6e(0x205)](a148_0x31cc73[_0x523f6e(0x17e)](_0x38d811,'tdx.json'));let _0x820101;const _0x9f1924=[],_0x198e3a=[],_0x4f2694=[],_0x178b0e=[],_0x3f440a=[],_0x59d6f0=[],_0x5394ff=[],_0x147d97=[],_0xc48b49=[];if(_0x12914a){const _0x5d07d5=loadAgentConfig(a148_0x31cc73[_0x523f6e(0x17e)](_0x38d811,_0x523f6e(0x1e6)));_0x820101=_0x5d07d5['llm_project'];const _0x4e4ef2=a148_0x16858c[_0x523f6e(0x1c2)](_0x38d811,{'withFileTypes':!![]});for(const _0xf0a416 of _0x4e4ef2){if(!_0xf0a416['isDirectory']())continue;if([_0x523f6e(0x18a),_0x523f6e(0x1bf),_0x523f6e(0x24d),_0x523f6e(0x228),'integrations',_0x523f6e(0x1b1),'chat_interfaces'][_0x523f6e(0x214)](_0xf0a416[_0x523f6e(0x221)]))continue;const _0x525d56=a148_0x31cc73['join'](_0x38d811,_0xf0a416[_0x523f6e(0x221)]);if(isAgentDir(_0x525d56)){const _0x3e52d8=a148_0x31cc73[_0x523f6e(0x17e)](_0x525d56,_0x523f6e(0x198)),_0x9ee6=a148_0x31cc73[_0x523f6e(0x17e)](_0x525d56,_0x523f6e(0x189)),_0x29a7ab=a148_0x31cc73[_0x523f6e(0x17e)](_0x525d56,_0x523f6e(0x25e)),_0x1f7ffc=parseAgentYaml(a148_0x16858c[_0x523f6e(0x212)](_0x3e52d8,_0x523f6e(0x208)),_0x3e52d8),_0x207caf=a148_0x16858c[_0x523f6e(0x205)](_0x9ee6)?a148_0x16858c['readFileSync'](_0x9ee6,'utf-8'):'',_0x2a7a88=a148_0x16858c['existsSync'](_0x29a7ab)?a148_0x16858c[_0x523f6e(0x212)](_0x29a7ab,_0x523f6e(0x208)):_0x1f7ffc[_0x523f6e(0x256)];_0x9f1924[_0x523f6e(0x1af)]({'name':_0x1f7ffc[_0x523f6e(0x221)],'dir':_0x525d56,'yaml':_0x1f7ffc,'systemPrompt':_0x207caf,'starterMessage':_0x2a7a88});}}const _0x47539f=getKnowledgeBasesDir(_0x38d811);if(a148_0x16858c[_0x523f6e(0x205)](_0x47539f)){const _0x2f0827=a148_0x16858c[_0x523f6e(0x1c2)](_0x47539f);for(const _0x1b3b91 of _0x2f0827){const _0x1fd8da=a148_0x31cc73[_0x523f6e(0x17e)](_0x47539f,_0x1b3b91);if(_0x1b3b91[_0x523f6e(0x23e)](_0x523f6e(0x196))){const _0x21233e=parseKnowledgeBaseYaml(a148_0x16858c[_0x523f6e(0x212)](_0x1fd8da,_0x523f6e(0x208)),_0x1fd8da);_0x198e3a['push']({'name':_0x21233e['name'],'path':_0x1fd8da,'yaml':_0x21233e});}else{if(_0x1b3b91[_0x523f6e(0x23e)](_0x523f6e(0x224))){const _0x452a4f=a148_0x16858c[_0x523f6e(0x212)](_0x1fd8da,_0x523f6e(0x208)),{name:_0x23edcd,text:_0x183950}=parseTextKnowledgeBaseMd(_0x452a4f,_0x1b3b91);_0x4f2694[_0x523f6e(0x1af)]({'name':_0x23edcd,'path':_0x1fd8da,'text':_0x183950});}}}}const _0x2fa5d7=getPromptsDir(_0x38d811);if(a148_0x16858c[_0x523f6e(0x205)](_0x2fa5d7)){const _0x3c18c3=a148_0x16858c[_0x523f6e(0x1c2)](_0x2fa5d7)[_0x523f6e(0x190)](_0x4c7520=>_0x4c7520[_0x523f6e(0x23e)]('.yml'));for(const _0x2cd54f of _0x3c18c3){const _0xe1bb57=a148_0x31cc73[_0x523f6e(0x17e)](_0x2fa5d7,_0x2cd54f),_0x5c1a9f=parsePromptYaml(a148_0x16858c['readFileSync'](_0xe1bb57,_0x523f6e(0x208)),_0xe1bb57);_0x178b0e['push']({'name':_0x5c1a9f['name'],'path':_0xe1bb57,'yaml':_0x5c1a9f});}}const _0x31c860=getIntegrationsDir(_0x38d811);if(a148_0x16858c[_0x523f6e(0x205)](_0x31c860)){const _0x547e89=a148_0x16858c[_0x523f6e(0x1c2)](_0x31c860)[_0x523f6e(0x190)](_0x3c1277=>_0x3c1277[_0x523f6e(0x23e)](_0x523f6e(0x196)));for(const _0x57470f of _0x547e89){const _0x5170a1=a148_0x31cc73[_0x523f6e(0x17e)](_0x31c860,_0x57470f),_0xabaadf=parseIntegrationYaml(a148_0x16858c['readFileSync'](_0x5170a1,_0x523f6e(0x208)),_0x5170a1);SAFE_INTEGRATION_TYPES['includes'](_0xabaadf['service_type'][_0x523f6e(0x1ad)]())?_0x3f440a[_0x523f6e(0x1af)]({'name':_0xabaadf[_0x523f6e(0x221)],'path':_0x5170a1,'yaml':_0xabaadf}):this[_0x523f6e(0x1e2)][_0x523f6e(0x191)]('Skipping\x20integration\x20\x27'+_0xabaadf[_0x523f6e(0x221)]+_0x523f6e(0x1fe)+_0xabaadf['service_type']+'):\x20'+(_0x523f6e(0x20a)+SAFE_INTEGRATION_TYPES[_0x523f6e(0x17e)](',\x20')+_0x523f6e(0x18f)));}}const _0xe2597a=getExperimentalKnowledgeBasesDir(_0x38d811);if(a148_0x16858c['existsSync'](_0xe2597a)){const _0x507ae2=a148_0x16858c[_0x523f6e(0x1c2)](_0xe2597a,{'withFileTypes':!![]});for(const _0x3440a8 of _0x507ae2){if(!_0x3440a8[_0x523f6e(0x243)]())continue;const _0xd30e72=a148_0x31cc73['join'](_0xe2597a,_0x3440a8['name']),_0x1ccee2=a148_0x31cc73[_0x523f6e(0x17e)](_0xd30e72,_0x3440a8[_0x523f6e(0x221)]+_0x523f6e(0x196));if(a148_0x16858c[_0x523f6e(0x205)](_0x1ccee2)){const _0x8f6da7=parseExperimentalKnowledgeBaseYaml(a148_0x16858c[_0x523f6e(0x212)](_0x1ccee2,_0x523f6e(0x208)),_0x1ccee2),_0x28a535=a148_0x31cc73['join'](_0xd30e72,_0x523f6e(0x231)),_0x582efa=[];if(a148_0x16858c['existsSync'](_0x28a535)){const _0x57be7d=a148_0x16858c['readdirSync'](_0x28a535,{'withFileTypes':!![]});for(const _0x5f5239 of _0x57be7d){if(!_0x5f5239[_0x523f6e(0x243)]())continue;const _0x17f2cd=a148_0x31cc73[_0x523f6e(0x17e)](_0x28a535,_0x5f5239[_0x523f6e(0x221)]),_0x25b30a=a148_0x31cc73[_0x523f6e(0x17e)](_0x17f2cd,_0x523f6e(0x19c)),_0xe8484c=a148_0x31cc73['join'](_0x17f2cd,_0x523f6e(0x1c6));if(a148_0x16858c[_0x523f6e(0x205)](_0x25b30a)&&a148_0x16858c[_0x523f6e(0x205)](_0xe8484c)){const _0x14ab93=a148_0x16858c[_0x523f6e(0x212)](_0x25b30a,_0x523f6e(0x208)),_0x4f1382=a148_0x16858c[_0x523f6e(0x212)](_0xe8484c,_0x523f6e(0x208));_0x582efa['push']({'name':_0x5f5239[_0x523f6e(0x221)],'code':_0x14ab93,'json_schema':_0x4f1382});}}}const _0x357c45={..._0x8f6da7,'functions':_0x582efa};_0x59d6f0['push']({'name':_0x8f6da7[_0x523f6e(0x221)],'path':_0xd30e72,'def':_0x357c45});}}}const _0x29b076=getExperimentalArtifactsDir(_0x38d811);if(a148_0x16858c[_0x523f6e(0x205)](_0x29b076)){const _0x3f1d4a=a148_0x16858c['readdirSync'](_0x29b076,{'withFileTypes':!![]});for(const _0x2c0455 of _0x3f1d4a){if(!_0x2c0455[_0x523f6e(0x243)]())continue;const _0x963f70=a148_0x31cc73[_0x523f6e(0x17e)](_0x29b076,_0x2c0455['name']),_0x37897f=a148_0x31cc73[_0x523f6e(0x17e)](_0x963f70,_0x2c0455['name']+'.yml');if(a148_0x16858c[_0x523f6e(0x205)](_0x37897f)){const _0x3c0aa3=parseExperimentalArtifactYaml(a148_0x16858c[_0x523f6e(0x212)](_0x37897f,_0x523f6e(0x208)),_0x37897f),_0x4598d5=a148_0x31cc73[_0x523f6e(0x17e)](_0x963f70,'code.js'),_0x2aa55a=a148_0x16858c[_0x523f6e(0x205)](_0x4598d5)?a148_0x16858c['readFileSync'](_0x4598d5,'utf-8'):'',_0x54d0be=a148_0x31cc73[_0x523f6e(0x17e)](_0x963f70,'files'),_0x49a00b=[];if(a148_0x16858c[_0x523f6e(0x205)](_0x54d0be)){const _0x25eda9=a148_0x16858c[_0x523f6e(0x1c2)](_0x54d0be);for(const _0x2e08dc of _0x25eda9){const _0x106d0e=a148_0x31cc73['join'](_0x54d0be,_0x2e08dc);if(a148_0x16858c['statSync'](_0x106d0e)['isFile']()){const _0x7869e2=a148_0x16858c[_0x523f6e(0x212)](_0x106d0e,_0x523f6e(0x208));_0x49a00b[_0x523f6e(0x1af)]({'file_name':_0x2e08dc,'text_content':_0x7869e2});}}}const _0x132a05={..._0x3c0aa3,'code':_0x2aa55a,'files':_0x49a00b};_0x5394ff[_0x523f6e(0x1af)]({'name':_0x3c0aa3[_0x523f6e(0x221)],'path':_0x963f70,'def':_0x132a05});}}}const _0xe88b97=getFormInterfacesDir(_0x38d811);if(a148_0x16858c[_0x523f6e(0x205)](_0xe88b97)){const _0xc7baa2=a148_0x16858c[_0x523f6e(0x1c2)](_0xe88b97)[_0x523f6e(0x190)](_0x49bb24=>_0x49bb24['endsWith']('.yml'));for(const _0x11717b of _0xc7baa2){const _0x21a101=a148_0x31cc73[_0x523f6e(0x17e)](_0xe88b97,_0x11717b),_0x48efdd=parseFormInterfaceYaml(a148_0x16858c['readFileSync'](_0x21a101,_0x523f6e(0x208)),_0x21a101);_0x147d97[_0x523f6e(0x1af)]({'name':_0x48efdd['name'],'path':_0x21a101,'yaml':_0x48efdd});}}const _0x157aa6=getChatInterfacesDir(_0x38d811);if(a148_0x16858c[_0x523f6e(0x205)](_0x157aa6)){const _0x19a3f5=a148_0x16858c[_0x523f6e(0x1c2)](_0x157aa6)['filter'](_0x21025b=>_0x21025b[_0x523f6e(0x23e)]('.yml'));for(const _0x4ed6e9 of _0x19a3f5){const _0x4b1c0d=a148_0x31cc73[_0x523f6e(0x17e)](_0x157aa6,_0x4ed6e9),_0x2fb543=parseChatInterfaceYaml(a148_0x16858c['readFileSync'](_0x4b1c0d,_0x523f6e(0x208)),_0x4b1c0d);_0xc48b49[_0x523f6e(0x1af)]({'name':_0x2fb543[_0x523f6e(0x221)],'path':_0x4b1c0d,'yaml':_0x2fb543});}}}else{const _0x3f471e=await this[_0x523f6e(0x1f5)](_0x38d811),_0x581303=await this['client'][_0x523f6e(0x1f4)](_0x3f471e);_0x820101=_0x581303[_0x523f6e(0x201)]['name'];const _0x109dfe=await this[_0x523f6e(0x225)][_0x523f6e(0x1da)](_0x3f471e),_0x464036=await this['client']['listKnowledgeBases'](_0x3f471e),_0x31515a=await this[_0x523f6e(0x225)][_0x523f6e(0x270)](_0x3f471e),_0x1b5cb7=await this[_0x523f6e(0x225)][_0x523f6e(0x1b6)](_0x3f471e),_0x1c9b03=await this['client'][_0x523f6e(0x1f8)](_0x3f471e),_0x4b1a09=await safeListOrEmpty(()=>this[_0x523f6e(0x225)][_0x523f6e(0x1e3)](_0x3f471e)),_0x523d12=await safeListOrEmpty(()=>this[_0x523f6e(0x225)][_0x523f6e(0x175)](_0x3f471e)),_0x46b1dd=new Map(),_0x3ee2f4=new Map(),_0x154878=new Map(),_0x312b4f=new Map(),_0x3dc723=new Map(),_0x49b63d=new Map();for(const _0x4da744 of _0x464036){_0x46b1dd[_0x523f6e(0x1de)](_0x4da744['id'],_0x4da744[_0x523f6e(0x201)]['name']);}for(const _0x39d0fb of _0x31515a){_0x3ee2f4[_0x523f6e(0x1de)](_0x39d0fb['id'],_0x39d0fb['attributes'][_0x523f6e(0x221)]);}for(const _0x2593fa of _0x109dfe){_0x154878[_0x523f6e(0x1de)](_0x2593fa['id'],_0x2593fa['attributes'][_0x523f6e(0x221)]);}for(const _0x2769c0 of _0x1b5cb7){_0x312b4f[_0x523f6e(0x1de)](_0x2769c0['id'],_0x2769c0['attributes'][_0x523f6e(0x221)]);}for(const _0x5c39d0 of _0x4b1a09){_0x3dc723['set'](_0x5c39d0['id'],_0x5c39d0[_0x523f6e(0x201)][_0x523f6e(0x221)]);}for(const _0x5dd9a0 of _0x523d12){_0x49b63d['set'](_0x5dd9a0['id'],_0x5dd9a0[_0x523f6e(0x201)][_0x523f6e(0x221)]);}const _0x2df540={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x46b1dd,'TextKnowledgeBase':_0x3ee2f4,'Agent':_0x154878,'ExperimentalKnowledgeBase':_0x3dc723}),'resolvePromptName':async _0x5ed4d5=>_0x312b4f[_0x523f6e(0x21e)](_0x5ed4d5),'onWarning':_0x4f6546=>this[_0x523f6e(0x1e2)]['warn'](_0x4f6546)};for(const _0x361db8 of _0x109dfe){const _0x3d0430=await agentResponseToDef(_0x361db8,_0x2df540),{yaml:_0x3bd21f,systemPrompt:_0x596da5,starterMessage:_0x1028d8}=_0x3d0430;_0x9f1924[_0x523f6e(0x1af)]({'name':_0x3bd21f['name'],'dir':'','yaml':_0x3bd21f,'systemPrompt':_0x596da5,'starterMessage':_0x1028d8});}for(const _0x5299df of _0x464036){const _0x29a05d=apiKnowledgeBaseToYaml(_0x5299df);_0x198e3a[_0x523f6e(0x1af)]({'name':_0x29a05d[_0x523f6e(0x221)],'path':'','yaml':_0x29a05d});}for(const _0x3b7e7f of _0x31515a){_0x4f2694[_0x523f6e(0x1af)]({'name':_0x3b7e7f[_0x523f6e(0x201)][_0x523f6e(0x221)],'path':'','text':_0x3b7e7f[_0x523f6e(0x201)][_0x523f6e(0x245)]});}for(const _0x493633 of _0x1b5cb7){const _0x38db73=await apiPromptToYaml(_0x493633,_0x2df540);_0x38db73&&_0x178b0e[_0x523f6e(0x1af)]({'name':_0x38db73[_0x523f6e(0x221)],'path':'','yaml':_0x38db73});}for(const _0xcf5a22 of _0x1c9b03){if(!_0xcf5a22['attributes']['isManaged']&&SAFE_INTEGRATION_TYPES[_0x523f6e(0x214)](_0xcf5a22[_0x523f6e(0x201)]['serviceType']['toLowerCase']())){const _0xeb08e6=await apiIntegrationToYaml(_0xcf5a22,_0x2df540);_0x3f440a['push']({'name':_0xcf5a22[_0x523f6e(0x201)][_0x523f6e(0x174)][_0x523f6e(0x1ad)](),'path':'','yaml':_0xeb08e6});}}for(const _0xbde609 of _0x4b1a09){const _0xf7316=apiExperimentalKnowledgeBaseToYaml(_0xbde609);_0x59d6f0[_0x523f6e(0x1af)]({'name':_0xf7316[_0x523f6e(0x221)],'path':'','def':_0xf7316});}for(const _0x5c1f60 of _0x523d12){const _0x37e05e=apiExperimentalArtifactToYaml(_0x5c1f60);_0x5394ff['push']({'name':_0x37e05e[_0x523f6e(0x221)],'path':'','def':_0x37e05e});}const _0x6c8910=await safeListOrEmpty(()=>this['client'][_0x523f6e(0x1d9)](_0x3f471e));for(const _0xdddb63 of _0x6c8910){const _0x58b7e6=await apiFormInterfaceToYaml(_0xdddb63,_0x2df540);_0x147d97[_0x523f6e(0x1af)]({'name':_0x58b7e6[_0x523f6e(0x221)],'path':'','yaml':_0x58b7e6});}const _0x5dfbbe=await safeListOrEmpty(()=>this['client'][_0x523f6e(0x1a6)](_0x3f471e));for(const _0x503bc2 of _0x5dfbbe){if(_0x503bc2[_0x523f6e(0x201)][_0x523f6e(0x273)])continue;const _0x2d6de6=await apiChatInterfaceToYaml(_0x503bc2,_0x2df540);_0xc48b49['push']({'name':_0x2d6de6['name'],'path':'','yaml':_0x2d6de6});}}const _0x146e58={'sourceProjectName':_0x820101,'newProjectName':_0xaea139,'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}}},_0x526953=await this[_0x523f6e(0x225)][_0x523f6e(0x1ec)](),_0x1f9df3=_0x526953[_0x523f6e(0x26c)](_0x4e8dca=>_0x4e8dca[_0x523f6e(0x201)]['name']===_0xaea139);if(_0x1f9df3)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x523f6e(0x173)+_0xaea139+_0x523f6e(0x1b4),undefined,{'helpText':_0x523f6e(0x18d)});if(_0xa952b1?.['dryRun'])return _0x146e58[_0x523f6e(0x222)][_0x523f6e(0x18b)][_0x523f6e(0x244)]=_0x9f1924['length'],_0x146e58[_0x523f6e(0x222)]['knowledgeBases'][_0x523f6e(0x244)]=_0x198e3a[_0x523f6e(0x1b7)],_0x146e58['counts'][_0x523f6e(0x232)]['created']=_0x4f2694[_0x523f6e(0x1b7)],_0x146e58[_0x523f6e(0x222)]['experimentalKnowledgeBases']['created']=_0x59d6f0[_0x523f6e(0x1b7)],_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x217)][_0x523f6e(0x244)]=_0x5394ff['length'],_0x146e58[_0x523f6e(0x222)]['prompts'][_0x523f6e(0x244)]=_0x178b0e[_0x523f6e(0x1b7)],_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x286)][_0x523f6e(0x244)]=_0x3f440a['length'],_0x146e58;const _0x53f736=await this[_0x523f6e(0x225)]['createProject']({'name':_0xaea139}),_0x932c96=_0x53f736['id'];_0x146e58['newProjectId']=_0x932c96;const _0x36d145=new Map(),_0x1c3d93=new Map(),_0x5de17c=new Map(),_0x3369b2=new Map(),_0x1e7b57=new Map(),_0x56e51b=new Map(),_0x163c35=new Map(),_0x503078=new Map(),_0x2aae9a=new Set(),_0x50d5d0=new Set();for(const _0x146a76 of _0x9f1924){for(const _0x1d1f05 of _0x146a76[_0x523f6e(0x241)][_0x523f6e(0x23a)]||[]){if(_0x1d1f05['type']===_0x523f6e(0x28a)&&_0x1d1f05[_0x523f6e(0x181)]){const _0x25ec19=parseRef(_0x1d1f05['target']);if(_0x25ec19)_0x2aae9a[_0x523f6e(0x211)](_0x25ec19[_0x523f6e(0x221)]);}else{if(_0x1d1f05['type']==='web_search'&&_0x1d1f05['target']){const _0x379382=parseRef(_0x1d1f05[_0x523f6e(0x181)]);if(_0x379382)_0x50d5d0[_0x523f6e(0x211)](_0x379382['name']);}}}}for(const _0x22c130 of _0x2aae9a){try{const _0x5c3eef=await this[_0x523f6e(0x225)][_0x523f6e(0x1d0)]({'projectId':_0x932c96,'name':_0x22c130});_0x1e7b57['set'](_0x22c130,_0x5c3eef['id']),_0x146e58[_0x523f6e(0x1e9)][_0x523f6e(0x1af)]({'name':_0x22c130,'action':_0x523f6e(0x244),'id':_0x5c3eef['id']}),_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x1e9)][_0x523f6e(0x244)]++;}catch(_0x3ce25e){_0x146e58[_0x523f6e(0x1e9)][_0x523f6e(0x1af)]({'name':_0x22c130,'action':_0x523f6e(0x197),'error':_0x3ce25e[_0x523f6e(0x272)]}),_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x1e9)][_0x523f6e(0x20d)]++;}}for(const _0x31e074 of _0x50d5d0){try{const _0x27c9f4=await this[_0x523f6e(0x225)][_0x523f6e(0x188)]({'projectId':_0x932c96,'name':_0x31e074});_0x56e51b[_0x523f6e(0x1de)](_0x31e074,_0x27c9f4['id']),_0x146e58['webSearchTools']['push']({'name':_0x31e074,'action':_0x523f6e(0x244),'id':_0x27c9f4['id']}),_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x261)][_0x523f6e(0x244)]++;}catch(_0x2a9ebc){_0x146e58[_0x523f6e(0x261)][_0x523f6e(0x1af)]({'name':_0x31e074,'action':_0x523f6e(0x197),'error':_0x2a9ebc['message']}),_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x261)]['errors']++;}}const _0x37141c=await fetchAllToolTargetMaps((_0x1af841,_0x3e5fa8)=>this[_0x523f6e(0x225)]['listToolTargets'](_0x1af841,_0x3e5fa8),_0x932c96);let _0x54c4dd=[];const _0xce8f4c={'projectId':_0x932c96,'resolveToolTargetId':buildIdResolver({..._0x37141c[_0x523f6e(0x1f7)],'KnowledgeBase':_0x36d145,'TextKnowledgeBase':_0x1c3d93,'ExperimentalKnowledgeBase':_0x163c35,'Agent':_0x5de17c,'WebSearchTool':_0x56e51b,'ImageGenerator':_0x1e7b57}),'resolvePromptId':async _0x35b916=>_0x3369b2[_0x523f6e(0x21e)](_0x35b916),'onWarning':_0x514d57=>{const _0x44fca8=_0x523f6e;this['logger'][_0x44fca8(0x191)](_0x514d57),_0x54c4dd['push'](_0x514d57);}};for(const _0x142d8d of _0x198e3a){try{const _0x442328=yamlKnowledgeBaseToApi(_0x142d8d[_0x523f6e(0x241)],_0x932c96),_0x138ce9=await this['client']['createKnowledgeBase'](_0x442328);_0x36d145[_0x523f6e(0x1de)](_0x142d8d[_0x523f6e(0x241)][_0x523f6e(0x221)],_0x138ce9['id']),_0x146e58['knowledgeBases'][_0x523f6e(0x1af)]({'name':_0x142d8d[_0x523f6e(0x241)][_0x523f6e(0x221)],'action':_0x523f6e(0x244),'id':_0x138ce9['id']}),_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x1fb)][_0x523f6e(0x244)]++;}catch(_0x5a361d){_0x146e58[_0x523f6e(0x1fb)][_0x523f6e(0x1af)]({'name':_0x142d8d[_0x523f6e(0x241)][_0x523f6e(0x221)],'action':'error','error':_0x5a361d[_0x523f6e(0x272)]}),_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x1fb)][_0x523f6e(0x20d)]++;}}for(const _0x3ef52e of _0x4f2694){try{const _0x29109b=yamlTextKnowledgeBaseToApi({'name':_0x3ef52e['name'],'text':_0x3ef52e[_0x523f6e(0x245)]},_0x932c96),_0x5c0afe=await this[_0x523f6e(0x225)]['createTextKnowledgeBase'](_0x29109b);_0x1c3d93[_0x523f6e(0x1de)](_0x3ef52e['name'],_0x5c0afe['id']),_0x146e58['textKnowledgeBases'][_0x523f6e(0x1af)]({'name':_0x3ef52e[_0x523f6e(0x221)],'action':_0x523f6e(0x244),'id':_0x5c0afe['id']}),_0x146e58['counts'][_0x523f6e(0x232)][_0x523f6e(0x244)]++;}catch(_0x48648a){_0x146e58[_0x523f6e(0x232)]['push']({'name':_0x3ef52e[_0x523f6e(0x221)],'action':_0x523f6e(0x197),'error':_0x48648a['message']}),_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x232)][_0x523f6e(0x20d)]++;}}for(const _0x5a492f of _0x5394ff){try{const _0x4762a0=yamlExperimentalArtifactToApi(_0x5a492f[_0x523f6e(0x195)],_0x932c96),_0x35c114=await this[_0x523f6e(0x225)][_0x523f6e(0x213)](_0x4762a0);_0x503078[_0x523f6e(0x1de)](_0x5a492f[_0x523f6e(0x195)][_0x523f6e(0x221)],_0x35c114['id']),_0x146e58[_0x523f6e(0x217)][_0x523f6e(0x1af)]({'name':_0x5a492f['def']['name'],'action':_0x523f6e(0x244),'id':_0x35c114['id']}),_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x217)]['created']++;}catch(_0x387cb4){_0x146e58[_0x523f6e(0x217)][_0x523f6e(0x1af)]({'name':_0x5a492f[_0x523f6e(0x195)][_0x523f6e(0x221)],'action':_0x523f6e(0x197),'error':_0x387cb4[_0x523f6e(0x272)]}),_0x146e58[_0x523f6e(0x222)]['experimentalArtifacts'][_0x523f6e(0x20d)]++;}}for(const _0x35cef2 of _0x59d6f0){try{const _0x55f2cb=yamlExperimentalKnowledgeBaseToApi(_0x35cef2['def'],_0x932c96),_0x9eb0a0=await this[_0x523f6e(0x225)][_0x523f6e(0x16b)](_0x55f2cb);_0x163c35[_0x523f6e(0x1de)](_0x35cef2[_0x523f6e(0x195)]['name'],_0x9eb0a0['id']),_0x146e58[_0x523f6e(0x236)][_0x523f6e(0x1af)]({'name':_0x35cef2['def'][_0x523f6e(0x221)],'action':_0x523f6e(0x244),'id':_0x9eb0a0['id']}),_0x146e58[_0x523f6e(0x222)]['experimentalKnowledgeBases'][_0x523f6e(0x244)]++;}catch(_0x4b6f6){_0x146e58[_0x523f6e(0x236)][_0x523f6e(0x1af)]({'name':_0x35cef2[_0x523f6e(0x195)][_0x523f6e(0x221)],'action':_0x523f6e(0x197),'error':_0x4b6f6[_0x523f6e(0x272)]}),_0x146e58['counts'][_0x523f6e(0x236)]['errors']++;}}const _0x389e20=[..._0x9f1924]['sort']((_0x335c1a,_0x467a5c)=>{const _0x5062cb=_0x523f6e,_0x2a3420=_0x335c1a['yaml']['tools']?.[_0x5062cb(0x1f0)](_0x4c716c=>_0x4c716c['type']===_0x5062cb(0x1a7))??![],_0x37fe5e=_0x467a5c[_0x5062cb(0x241)][_0x5062cb(0x23a)]?.[_0x5062cb(0x1f0)](_0x2e45c4=>_0x2e45c4[_0x5062cb(0x19a)]==='agent')??![];if(_0x2a3420&&!_0x37fe5e)return 0x1;if(!_0x2a3420&&_0x37fe5e)return-0x1;return 0x0;});for(const _0x112d2b of _0x389e20){_0x54c4dd=[];try{const _0x1304f3=_0x112d2b[_0x523f6e(0x241)]['tools']?.[_0x523f6e(0x190)](_0x16de0e=>{const _0x639fba=_0x523f6e;if(_0x16de0e[_0x639fba(0x19a)]==='agent'&&_0x16de0e[_0x639fba(0x181)]){const _0x3bf7ea=parseRef(_0x16de0e[_0x639fba(0x181)]);return _0x3bf7ea?.['name']===_0x112d2b[_0x639fba(0x241)]['name'];}return![];})??[];if(_0x1304f3[_0x523f6e(0x1b7)]>0x0){const _0x4c1d86='Agent\x20\x27'+_0x112d2b['yaml'][_0x523f6e(0x221)]+_0x523f6e(0x1d5)+_0x523f6e(0x20b);this[_0x523f6e(0x1e2)]['warn'](_0x4c1d86),_0x54c4dd['push'](_0x4c1d86);}const _0x7e8855=await agentDefToRequest(_0x112d2b[_0x523f6e(0x241)],_0x112d2b['systemPrompt'],_0x112d2b[_0x523f6e(0x1c0)],_0xce8f4c),_0x568921=await this[_0x523f6e(0x225)]['createAgentResponse'](_0x7e8855);_0x5de17c[_0x523f6e(0x1de)](_0x112d2b[_0x523f6e(0x241)][_0x523f6e(0x221)],_0x568921['id']),_0x146e58[_0x523f6e(0x18b)][_0x523f6e(0x1af)]({'agentName':_0x112d2b['yaml'][_0x523f6e(0x221)],'action':_0x523f6e(0x244),'agentId':_0x568921['id'],'warnings':_0x54c4dd['length']>0x0?_0x54c4dd:undefined}),_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x18b)][_0x523f6e(0x244)]++;}catch(_0x2beb4c){_0x146e58['agents']['push']({'agentName':_0x112d2b[_0x523f6e(0x241)][_0x523f6e(0x221)],'action':_0x523f6e(0x197),'error':_0x2beb4c[_0x523f6e(0x272)],'warnings':_0x54c4dd[_0x523f6e(0x1b7)]>0x0?_0x54c4dd:undefined}),_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x18b)][_0x523f6e(0x20d)]++;}}for(const _0x535289 of _0x178b0e){try{const _0xe37e74=await yamlPromptToApi(_0x535289['yaml'],_0x932c96,_0xce8f4c);if(!_0xe37e74){_0x146e58[_0x523f6e(0x228)][_0x523f6e(0x1af)]({'name':_0x535289[_0x523f6e(0x241)]['name'],'action':_0x523f6e(0x197),'error':'Agent\x20reference\x20not\x20found'}),_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x228)][_0x523f6e(0x20d)]++;continue;}const _0x16e4ff=await this['client'][_0x523f6e(0x1bb)](_0xe37e74);_0x3369b2[_0x523f6e(0x1de)](_0x535289['yaml'][_0x523f6e(0x221)],_0x16e4ff['id']),_0x146e58[_0x523f6e(0x228)]['push']({'name':_0x535289[_0x523f6e(0x241)][_0x523f6e(0x221)],'action':_0x523f6e(0x244),'id':_0x16e4ff['id']}),_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x228)][_0x523f6e(0x244)]++;}catch(_0x52c74d){_0x146e58[_0x523f6e(0x228)][_0x523f6e(0x1af)]({'name':_0x535289[_0x523f6e(0x241)]['name'],'action':'error','error':_0x52c74d[_0x523f6e(0x272)]}),_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x228)][_0x523f6e(0x20d)]++;}}for(const _0x32b0dd of _0x3f440a){try{const _0x4cafa2=await yamlIntegrationToApi(_0x32b0dd['yaml'],_0x932c96,_0xce8f4c),_0x1aba07=await this['client']['createIntegration'](_0x4cafa2);_0x146e58[_0x523f6e(0x286)][_0x523f6e(0x1af)]({'name':_0x32b0dd[_0x523f6e(0x241)]['service_type'],'action':_0x523f6e(0x244),'id':_0x1aba07['id']}),_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x286)]['created']++;}catch(_0x5d8c7b){_0x146e58[_0x523f6e(0x286)][_0x523f6e(0x1af)]({'name':_0x32b0dd[_0x523f6e(0x241)][_0x523f6e(0x235)],'action':_0x523f6e(0x197),'error':_0x5d8c7b[_0x523f6e(0x272)]}),_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x286)]['errors']++;}}for(const _0x1e4e6e of _0x147d97){try{const _0x5adb21=await yamlFormInterfaceToApi(_0x1e4e6e[_0x523f6e(0x241)],_0x932c96,_0xce8f4c);if(!_0x5adb21){_0x146e58['formInterfaces']['push']({'name':_0x1e4e6e[_0x523f6e(0x241)][_0x523f6e(0x221)],'action':_0x523f6e(0x197),'error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x146e58['counts'][_0x523f6e(0x1d2)][_0x523f6e(0x20d)]++;continue;}const _0x4a5f23=await this[_0x523f6e(0x225)][_0x523f6e(0x237)](_0x5adb21);_0x146e58[_0x523f6e(0x1d2)][_0x523f6e(0x1af)]({'name':_0x1e4e6e[_0x523f6e(0x241)][_0x523f6e(0x221)],'action':_0x523f6e(0x244),'id':_0x4a5f23['id']}),_0x146e58[_0x523f6e(0x222)][_0x523f6e(0x1d2)][_0x523f6e(0x244)]++;}catch(_0x137b4f){_0x146e58['formInterfaces'][_0x523f6e(0x1af)]({'name':_0x1e4e6e[_0x523f6e(0x241)]['name'],'action':_0x523f6e(0x197),'error':_0x137b4f[_0x523f6e(0x272)]}),_0x146e58['counts'][_0x523f6e(0x1d2)][_0x523f6e(0x20d)]++;}}for(const _0x1f1cdd of _0xc48b49){try{const _0x118c7b=await yamlChatInterfaceToApi(_0x1f1cdd[_0x523f6e(0x241)],_0x932c96,_0xce8f4c),_0x4d8b87=await this[_0x523f6e(0x225)][_0x523f6e(0x27f)](_0x118c7b);_0x146e58[_0x523f6e(0x182)]['push']({'name':_0x1f1cdd[_0x523f6e(0x241)]['name'],'action':_0x523f6e(0x244),'id':_0x4d8b87['id']}),_0x146e58['counts'][_0x523f6e(0x182)][_0x523f6e(0x244)]++;}catch(_0x342f4f){_0x146e58[_0x523f6e(0x182)][_0x523f6e(0x1af)]({'name':_0x1f1cdd[_0x523f6e(0x241)][_0x523f6e(0x221)],'action':_0x523f6e(0x197),'error':_0x342f4f[_0x523f6e(0x272)]}),_0x146e58[_0x523f6e(0x222)]['chatInterfaces']['errors']++;}}return _0x146e58;}}
|