@treasuredata/tdx 2026.8.4 → 2026.8.5
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.d.ts.map +1 -1
- package/dist/commands/cas-segment-command.js +1 -1
- package/dist/commands/cas-segment-command.js.map +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/p13n-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.js +1 -1
- package/dist/sdk/cas/cas-audience-validator.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js +1 -1
- package/dist/sdk/cas/cas-segment-schema.d.ts +63 -0
- package/dist/sdk/cas/cas-segment-schema.d.ts.map +1 -0
- package/dist/sdk/cas/cas-segment-schema.js +1 -0
- package/dist/sdk/cas/cas-segment-schema.js.map +1 -0
- package/dist/sdk/cas/cas-segment-validator.d.ts +76 -0
- package/dist/sdk/cas/cas-segment-validator.d.ts.map +1 -0
- package/dist/sdk/cas/cas-segment-validator.js +1 -0
- package/dist/sdk/cas/cas-segment-validator.js.map +1 -0
- package/dist/sdk/cas/cas-segment-yaml.js +1 -1
- package/dist/sdk/cas/index.js +1 -1
- package/dist/sdk/cas/pull-workflow.js +1 -1
- package/dist/sdk/cas/push-workflow.js +1 -1
- package/dist/sdk/cas/validate-files.d.ts +23 -6
- package/dist/sdk/cas/validate-files.d.ts.map +1 -1
- package/dist/sdk/cas/validate-files.js +1 -1
- package/dist/sdk/cas/validate-files.js.map +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/p13n-studio-api-client.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/p13n-studio.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.d.ts.map +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js.map +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.d.ts.map +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js.map +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.d.ts +1 -1
- package/dist/sdk/segment/yaml-validator.d.ts.map +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment/yaml-validator.js.map +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/types/workspace.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/util/tree-search.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/task-graph.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/sdk/workspace/access-tracker.js +1 -1
- package/dist/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/claude-code-state.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/proxy-fetch.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
package/dist/sdk/llm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a150_0xdd01(_0x131a37,_0x5a6f80){_0x131a37=_0x131a37-0xe1;const _0x42f0ae=a150_0x42f0();let _0xdd010b=_0x42f0ae[_0x131a37];return _0xdd010b;}const a150_0x594e97=a150_0xdd01;(function(_0x152d86,_0x1aefa4){const _0x3d0cea=a150_0xdd01,_0x4582d9=_0x152d86();while(!![]){try{const _0x17f773=-parseInt(_0x3d0cea(0x19c))/0x1+-parseInt(_0x3d0cea(0x11f))/0x2+-parseInt(_0x3d0cea(0x109))/0x3+-parseInt(_0x3d0cea(0x152))/0x4*(-parseInt(_0x3d0cea(0x1bb))/0x5)+-parseInt(_0x3d0cea(0x178))/0x6*(-parseInt(_0x3d0cea(0x127))/0x7)+parseInt(_0x3d0cea(0x1ee))/0x8+-parseInt(_0x3d0cea(0xf6))/0x9*(-parseInt(_0x3d0cea(0x160))/0xa);if(_0x17f773===_0x1aefa4)break;else _0x4582d9['push'](_0x4582d9['shift']());}catch(_0x1dd5ca){_0x4582d9['push'](_0x4582d9['shift']());}}}(a150_0x42f0,0x4252a));import{LLMApiClient}from'../client/llm-api-client.js';import*as a150_0x2ff9d8 from'node:fs';import*as a150_0x5d2257 from'node:path';function a150_0x42f0(){const _0x57499b=['INVALID_ARGUMENT','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','listExperimentalKnowledgeBases','chat','outputs','isManaged','systemPrompt','restoreProject','---\x20schema:\x20','projectId','formInterfaces','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','project.json','pullProject','\x0a---\x20code\x20---\x0a','chatWelcomeMessage','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','listToolTargets','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','includes','updateChatInterface','chatInterfaces','updateKnowledgeBase','getChatLog','listChatInterfaces','oldPath','Renamed\x20KB\x20file:\x20','statSync','agents.json','Project\x20\x22','high','duplicate','size','getUserSettings','experimental_artifacts','Renamed\x20integration\x20file:\x20','1512672xBbyyG','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','name','agentsFull','#\x20prompt.md\x0a','Multiple\x20projects\x20found\x20with\x20name\x20\x27','chat_interfaces','length','PERMISSION_DENIED','writeFileSync','---\x20file:\x20','experimentalArtifacts','project','Multiple\x20agents\x20found\x20with\x20name\x20\x27','description','updateExperimentalArtifact','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','readdirSync','message','pushAgent','agent.yml','actions','updated','form_interfaces','json_schema.json','backupProject','history','set','tdx_default_','Unable\x20to\x20create\x20project\x20after\x20','info','updateAgentResponse','low','isDirectory','modelType','\x0a---\x20schema:\x20','Agent\x20reference\x20not\x20found','Backup\x20folder\x20not\x20found:\x20','9nEKyMX','status','integrations','listKnowledgeBases','\x27.\x20This\x20should\x20not\x20happen.','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','readFileSync','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','createProject','LLM_PROJECT_NOT_FOUND','_reasoning_','getDefaultProjectName','No\x20tdx.json\x20found\x20in\x20','createAgent','isDir','minimal','prompt.md','AGENT_NOT_FOUND','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','194901kOzhYI','maxToolIterations','listPrompts','toLowerCase','yaml','resolveAgentId','text','resolveProjectName','createWebSearchTool','dir','createIntegration','\x0a\x0a#\x20agent.yml\x0a','listAgents','createPrompt','integrations.json','sdk.llm','getChatHistory','serviceType','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.','unchanged','\x22\x20already\x20exists','context','216306qAKozr','newProjectId','unlinkSync','isFile','file_name','none','json_schema','some','7eJdXtF','clearDefaultAgent','push','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','updateExperimentalKnowledgeBase','service_type','ALREADY_EXISTS','starter_message','Renamed\x20folder:\x20','variables','currentProjectId','stringify','resolveProjectId','updateTextKnowledgeBase','\x20in\x20project\x20','cwd','error','Renamed\x20agent\x20folder:\x20','Only\x20safe\x20types\x20(','mkdirSync','utf-8','conflict','updatePrompt','Agent\x20\x27','metadata','getOrCreateDefaultAgent','prompts.json','createChatInterface','Could\x20not\x20resolve\x20agent\x20reference','\x20---\x0a','\x27\x20(','(dry-run)','knowledgebases.json','code','slackMessageMode','getAgent','medium','setDefaultAgent','errors','files','starter_message.md','dryRun','imageGenerators','152708xAovvZ','content','getChatInfo',')\x20can\x20be\x20cloned.','createTextKnowledgeBase','chat_agent_console','add','temperature','agent','parse','join','knowledgeBases','get','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','1016710tEfDtI','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','type','target','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','created','loadJsonFile','agentId','listAgentsFull','def','listTextKnowledgeBases','createKnowledgeBase','Invalid\x20agent\x20reference\x20format:\x20','Renamed\x20experimental\x20artifact\x20directory:\x20','\x0a---\x20function:\x20','webSearchTools','cloneProject','setCurrentProject','Renamed\x20experimental\x20KB\x20directory:\x20','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','total','startChat','dirname','listIntegrations','2856978bdLkSx','chat_generic','filter','existsSync','listImageGenerators','createFormInterface','code.js','deleteProject','functions','text_content','createExperimentalKnowledgeBase','createExperimentalArtifact','deleteIntegration','Available\x20agents:\x20','Renamed\x20chat\x20interface\x20file:\x20','prompts','exportedFrom','localeCompare','profile','listFormInterfaces','new','counts','createAgentResponse','keys','getProject','event','nameToId','updateAgent','has','path','attributes','tdx.json','idToName','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','experimentalKnowledgeBases','tools','436671rMktVP','Project\x20not\x20found:\x20','\x20attempts\x20due\x20to\x20name\x20conflicts.','chats','pullAgent','rmSync','.llm','chatIgnoreManagedActions','toISOString','warn','INTERNAL','TextKnowledgeBase','reasoningEffort','promptId','already\x20exists','llm_project','projects','logger','textKnowledgeBases','listExperimentalArtifacts','agent.yml\x20not\x20found\x20in\x20','starterMessage','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','sort','basename','endsWith','getOrCreateDefaultProject','listProjects','map','site','knowledge_bases','15dfMfKG','claude-4.5-sonnet','chatId','experimental_knowledge_bases','\x20→\x20','.md','listChats','Renamed\x20form\x20interface\x20file:\x20','renamed','getDefaultAgent','find','client','agents','.yml','deleteAgent'];a150_0x42f0=function(){return _0x57499b;};return a150_0x42f0();}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=[a150_0x594e97(0x179),a150_0x594e97(0x157),'chat_parent_segment'];async function safeListOrEmpty(_0x41b563){const _0x348478=a150_0x594e97;try{return await _0x41b563();}catch(_0x128352){if(_0x128352 instanceof HTTPClientError&&_0x128352[_0x348478(0xf7)]===0x194)return[];throw _0x128352;}}export class LLMSDK{[a150_0x594e97(0x131)];[a150_0x594e97(0x1c6)];['context'];['logger']=Logger['of'](a150_0x594e97(0x118));constructor(_0x59fb40){const _0x44d39a=a150_0x594e97;this[_0x44d39a(0x1c6)]=new LLMApiClient(_0x59fb40),this['context']=_0x59fb40;}[a150_0x594e97(0x101)](){const _0x495804=a150_0x594e97,_0x3565fc=getSanitizedUsername();return _0x495804(0xec)+_0x3565fc;}async[a150_0x594e97(0x171)](_0x3d57bb){const _0x585a3c=a150_0x594e97,{projectId:_0x2db5f0}=await this[_0x585a3c(0x110)](_0x3d57bb);this[_0x585a3c(0x131)]=_0x2db5f0;}['getCurrentProject'](){return this['currentProjectId'];}async[a150_0x594e97(0x14c)](_0x11bc1f){const _0x44f2aa=a150_0x594e97,_0xf5b493=this[_0x44f2aa(0x11e)]['profile'];let _0x2a8542,_0x2dbdae;if(_0x11bc1f[_0x44f2aa(0x1dd)]('/')){const _0x285fc5=_0x11bc1f['split']('/');if(_0x285fc5['length']!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x44f2aa(0x16c)+_0x11bc1f,undefined,{'helpText':_0x44f2aa(0x1dc)});const [_0x2fb1e1,_0x46c047]=_0x285fc5;_0x2a8542=await this[_0x44f2aa(0x133)](_0x2fb1e1),_0x2dbdae=_0x46c047;}else _0x2a8542=this['currentProjectId']||(await this[_0x44f2aa(0x1b6)]())['id'],_0x2dbdae=_0x11bc1f;const _0xcc8e0=await this[_0x44f2aa(0x10e)](_0x2dbdae,_0x2a8542),_0x4d9f93=await this[_0x44f2aa(0x1c6)]['getAgent'](_0xcc8e0);writeCachedLLMAgent(_0x4d9f93['attributes'][_0x44f2aa(0x1f0)],_0xcc8e0,_0x2a8542,_0xf5b493);}[a150_0x594e97(0x1c4)](){const _0x354fc5=a150_0x594e97,_0x72fb94=this['context'][_0x354fc5(0x18a)];return readCachedLLMAgent(_0x72fb94)||undefined;}[a150_0x594e97(0x128)](){const _0x322496=a150_0x594e97,_0x59edbd=this[_0x322496(0x11e)]['profile'];clearCachedLLMAgent(_0x59edbd);}async['models'](){const _0x372aa0=a150_0x594e97,_0x4bfb52=await this[_0x372aa0(0x1c6)][_0x372aa0(0x1eb)]();return toModelInfos(_0x4bfb52);}async[a150_0x594e97(0xfe)](_0x4f1f38){const _0x47b9ee=a150_0x594e97;return await this[_0x47b9ee(0x1c6)][_0x47b9ee(0xfe)](_0x4f1f38);}async[a150_0x594e97(0x17f)](_0x12b3bf){const _0x55dab7=a150_0x594e97,{projectId:_0x3c24cb}=await this[_0x55dab7(0x110)](_0x12b3bf);await this[_0x55dab7(0x1c6)][_0x55dab7(0x17f)](_0x3c24cb);}async[a150_0x594e97(0x1ac)](_0x586ab3=0x32){const _0x1f3b23=a150_0x594e97;return await this['client'][_0x1f3b23(0x1b7)](_0x586ab3);}async[a150_0x594e97(0x1b6)](_0x4e35e2){const _0x28000e=a150_0x594e97,_0xbd8681=_0x4e35e2||this[_0x28000e(0x101)](),_0x2b3cd=this[_0x28000e(0x11e)][_0x28000e(0x18a)];if(!_0x4e35e2){const _0x3d5d6e=readCachedLLMProject(_0x2b3cd);if(_0x3d5d6e&&_0x3d5d6e[_0x28000e(0x1f0)]===_0xbd8681)try{const _0x2cf5d3=await this[_0x28000e(0x1c6)][_0x28000e(0x190)](_0x3d5d6e['id']);if(_0x2cf5d3[_0x28000e(0x196)]['name']===_0xbd8681)return _0x2cf5d3;}catch{}}const _0x3054ae=await this['client'][_0x28000e(0x1b7)](),_0x65273d=_0x3054ae['find'](_0x30497c=>_0x30497c[_0x28000e(0x196)][_0x28000e(0x1f0)]===_0xbd8681);if(_0x65273d)return!_0x4e35e2&&writeCachedLLMProject(_0xbd8681,_0x65273d['id'],_0x2b3cd),_0x65273d;const _0x422b9a=await this['client'][_0x28000e(0xfe)]({'name':_0xbd8681,'description':_0x28000e(0x1b2)+getSanitizedUsername()+')'});return!_0x4e35e2&&writeCachedLLMProject(_0xbd8681,_0x422b9a['id'],_0x2b3cd),_0x422b9a;}async[a150_0x594e97(0x133)](_0x15b30e){const _0x1b3160=a150_0x594e97,_0x2a700=await this[_0x1b3160(0x1c6)][_0x1b3160(0x1b7)](),_0xd31558=_0x2a700[_0x1b3160(0x17a)](_0x2d0d21=>_0x2d0d21[_0x1b3160(0x196)][_0x1b3160(0x1f0)]===_0x15b30e);if(_0xd31558[_0x1b3160(0x1f5)]===0x0)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x1b3160(0x19d)+_0x15b30e,undefined,{'helpText':_0x1b3160(0x161)});if(_0xd31558[_0x1b3160(0x1f5)]>0x1)throw new SDKError(ErrorCode[_0x1b3160(0x1a6)],_0x1b3160(0x1f3)+_0x15b30e+_0x1b3160(0xfa));return _0xd31558[0x0]['id'];}async[a150_0x594e97(0x110)](_0x45ea67){const _0xab3e90=a150_0x594e97,_0x29159e=await this[_0xab3e90(0x1c6)][_0xab3e90(0x1b7)](),_0x5ded73=_0x29159e['find'](_0x288a87=>_0x288a87['attributes'][_0xab3e90(0x1f0)]===_0x45ea67);if(_0x5ded73)return{'projectId':_0x5ded73['id'],'project':_0x5ded73};throw new SDKError(ErrorCode[_0xab3e90(0xff)],_0xab3e90(0x19d)+_0x45ea67,undefined,{'helpText':_0xab3e90(0x161)});}async[a150_0x594e97(0x140)](_0x33319e=a150_0x594e97(0x1bc),_0x4dd862=0x0,_0x59c3f0){const _0x288a9f=a150_0x594e97,_0x5c3f85=0xa;let _0x31704f=0x0,_0x49349d;while(_0x31704f<_0x5c3f85){try{const _0x4f4e15=await this[_0x288a9f(0x1b6)](_0x49349d),_0x3641b1=_0x4f4e15['id'],_0x5f0bad=[_0x288a9f(0x124),_0x288a9f(0x105),_0x288a9f(0xf0),_0x288a9f(0x14b),_0x288a9f(0x1e8)],_0x2c9d75=_0x4dd862===0x0?'tdx_'+_0x33319e:'tdx_'+_0x33319e+_0x288a9f(0x100)+_0x5f0bad[_0x4dd862],_0x150d0b=await this['client']['listAgents'](_0x3641b1),_0x1edbb1=_0x150d0b['find'](_0x4b927c=>_0x4b927c['attributes'][_0x288a9f(0x1f0)]===_0x2c9d75);if(_0x1edbb1)return _0x1edbb1;const _0x1db871=_0x4dd862>0x0?0x1:_0x59c3f0;return await this['client'][_0x288a9f(0x103)]({'name':_0x2c9d75,'projectId':_0x3641b1,'modelType':_0x33319e,'systemPrompt':'','temperature':_0x1db871,'reasoningEffort':_0x4dd862>0x0?_0x4dd862:undefined});}catch(_0x2546f8){if(_0x2546f8 instanceof HTTPClientError){const _0x3f22b4=_0x2546f8[_0x288a9f(0xf7)];if(_0x3f22b4>=0x190&&_0x3f22b4<0x1f4){if(_0x3f22b4===0x191)throw new SDKError(ErrorCode['UNAUTHENTICATED'],_0x288a9f(0x173),_0x2546f8);else{if(_0x3f22b4===0x193)throw new SDKError(ErrorCode[_0x288a9f(0x1f6)],_0x288a9f(0xfd),_0x2546f8);}throw _0x2546f8;}}if(errorContains(_0x2546f8,_0x288a9f(0x1aa),_0x288a9f(0x1e9),_0x288a9f(0x13c))){_0x31704f++;if(_0x31704f>=_0x5c3f85)throw new SDKError(ErrorCode[_0x288a9f(0x12d)],_0x288a9f(0xed)+_0x5c3f85+_0x288a9f(0x19e),_0x2546f8);const _0x2cf46d=this['getDefaultProjectName']();_0x49349d=_0x2cf46d+'_'+generateRandomHex();continue;}throw _0x2546f8;}}throw new SDKError(ErrorCode[_0x288a9f(0x1a6)],_0x288a9f(0x108));}async[a150_0x594e97(0x10e)](_0x368d4e,_0x419235){const _0x23ad5d=a150_0x594e97,_0x359c2d=_0x419235||this['currentProjectId'],_0x187ed7=await this['client']['listAgents'](_0x359c2d),_0x1042ad=_0x187ed7[_0x23ad5d(0x17a)](_0x2069a2=>_0x2069a2[_0x23ad5d(0x196)][_0x23ad5d(0x1f0)]===_0x368d4e);if(_0x1042ad[_0x23ad5d(0x1f5)]===0x0){const _0x40fa97=_0x359c2d?_0x23ad5d(0x135)+_0x359c2d:'';throw new SDKError(ErrorCode[_0x23ad5d(0x107)],'Agent\x20not\x20found:\x20'+_0x368d4e+_0x40fa97,undefined,{'helpText':_0x359c2d?'Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.':_0x23ad5d(0x11b)});}if(_0x1042ad[_0x23ad5d(0x1f5)]>0x1)throw new SDKError(ErrorCode[_0x23ad5d(0x1a6)],_0x23ad5d(0x1fb)+_0x368d4e+_0x23ad5d(0xfa));return _0x1042ad[0x0]['id'];}async['agents'](_0x486d95){const _0xcb090=a150_0x594e97,_0x5098f8=_0x486d95||this[_0xcb090(0x131)];return await this[_0xcb090(0x1c6)][_0xcb090(0x115)](_0x5098f8);}async[a150_0x594e97(0x1f1)](_0x5affe4){const _0x1b71af=a150_0x594e97;return await this[_0x1b71af(0x1c6)][_0x1b71af(0x168)](_0x5affe4);}async[a150_0x594e97(0x15a)](_0x3f6105){const _0x1fba70=a150_0x594e97;return await this[_0x1fba70(0x1c6)][_0x1fba70(0x14a)](_0x3f6105);}async[a150_0x594e97(0x103)](_0x56038f){const _0x1e529e=a150_0x594e97;return await this[_0x1e529e(0x1c6)][_0x1e529e(0x103)](_0x56038f);}async[a150_0x594e97(0x193)](_0x5ec474,_0x5730da){const _0x191c73=a150_0x594e97;return await this[_0x191c73(0x1c6)][_0x191c73(0x193)](_0x5ec474,_0x5730da);}async[a150_0x594e97(0x1c9)](_0x1c08f4){const _0x4a1653=a150_0x594e97;await this['client'][_0x4a1653(0x1c9)](_0x1c08f4);}async['startChat'](_0x4fdbcf){const _0x3aba71=a150_0x594e97;return await this['client'][_0x3aba71(0x175)]({'agentId':_0x4fdbcf});}async*[a150_0x594e97(0x1cd)](_0xa48245,_0x5c727e){const _0x290892=a150_0x594e97;let _0x281125=_0x5c727e?.[_0x290892(0x1bd)];const _0x2eac8d=_0x5c727e?.[_0x290892(0x167)];if(!_0x281125){if(!_0x2eac8d)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x3b0177=await this['client'][_0x290892(0x175)]({'agentId':_0x2eac8d});_0x281125=_0x3b0177['id'],yield{'type':_0x290892(0x13f),'data':{'chatId':_0x281125,'agentId':_0x2eac8d,'projectId':_0x3b0177[_0x290892(0x196)][_0x290892(0x1d3)]}};}for await(const _0x5c85b8 of this['client']['continueChat'](_0x281125,_0xa48245,_0x5c727e?.['signal'])){yield{'type':_0x290892(0x191),'data':_0x5c85b8};}}async[a150_0x594e97(0x19f)](_0x50e530=0x32){const _0x19d349=a150_0x594e97;return await this['client'][_0x19d349(0x1c1)](_0x50e530);}async[a150_0x594e97(0xea)](_0x3ac2de){const _0x5c7fcd=a150_0x594e97;return await this[_0x5c7fcd(0x1c6)][_0x5c7fcd(0x119)](_0x3ac2de);}async['getChatLog'](_0x268972){const _0x1db035=a150_0x594e97;return await this[_0x1db035(0x1c6)][_0x1db035(0x1e1)](_0x268972);}async['chatInfo'](_0x1fa583){const _0x23f204=a150_0x594e97;return await this[_0x23f204(0x1c6)][_0x23f204(0x154)](_0x1fa583);}async[a150_0x594e97(0xe9)](_0x9ac8f1,_0x46cec6,_0x2c0d51){const _0x45f86c=a150_0x594e97,_0x36434a=_0x2c0d51?.[_0x45f86c(0x150)]??![],{projectId:_0x258b3d,project:_0x17dc94}=await this['resolveProjectName'](_0x9ac8f1),_0x31d893=_0x17dc94[_0x45f86c(0x196)][_0x45f86c(0x1f0)],_0x18c2f6=_0x46cec6||_0x31d893+_0x45f86c(0x1a2);if(a150_0x2ff9d8[_0x45f86c(0x17b)](_0x18c2f6)&&!_0x36434a)throw new SDKError(ErrorCode[_0x45f86c(0x12d)],'Output\x20directory\x20already\x20exists:\x20'+_0x18c2f6,undefined,{'helpText':_0x45f86c(0xfb)});const _0x24eecd=await this[_0x45f86c(0x1c6)][_0x45f86c(0x168)](_0x258b3d),_0x1a7655=await this[_0x45f86c(0x1c6)][_0x45f86c(0xf9)](_0x258b3d),_0x50d1de=await this['client'][_0x45f86c(0x10b)](_0x258b3d),_0x4154f7=await this[_0x45f86c(0x1c6)][_0x45f86c(0x177)](_0x258b3d);if(!_0x36434a){a150_0x2ff9d8['mkdirSync'](_0x18c2f6,{'recursive':!![]});const _0x4c344f={'version':'1.0','exportedAt':new Date()[_0x45f86c(0x1a4)](),'exportedFrom':{'site':this[_0x45f86c(0x11e)]['site'],'projectId':_0x258b3d,'projectName':_0x31d893},'project':_0x17dc94};a150_0x2ff9d8[_0x45f86c(0x1f7)](a150_0x5d2257[_0x45f86c(0x15c)](_0x18c2f6,_0x45f86c(0x1d6)),JSON[_0x45f86c(0x132)](_0x4c344f,null,0x2)),a150_0x2ff9d8[_0x45f86c(0x1f7)](a150_0x5d2257[_0x45f86c(0x15c)](_0x18c2f6,_0x45f86c(0x1e6)),JSON[_0x45f86c(0x132)](_0x24eecd,null,0x2)),a150_0x2ff9d8[_0x45f86c(0x1f7)](a150_0x5d2257['join'](_0x18c2f6,_0x45f86c(0x147)),JSON['stringify'](_0x1a7655,null,0x2)),a150_0x2ff9d8[_0x45f86c(0x1f7)](a150_0x5d2257[_0x45f86c(0x15c)](_0x18c2f6,_0x45f86c(0x141)),JSON[_0x45f86c(0x132)](_0x50d1de,null,0x2)),a150_0x2ff9d8[_0x45f86c(0x1f7)](a150_0x5d2257[_0x45f86c(0x15c)](_0x18c2f6,_0x45f86c(0x117)),JSON[_0x45f86c(0x132)](_0x4154f7,null,0x2));}return{'projectName':_0x31d893,'outputDir':_0x18c2f6,'counts':{'agents':_0x24eecd['length'],'knowledgeBases':_0x1a7655[_0x45f86c(0x1f5)],'prompts':_0x50d1de[_0x45f86c(0x1f5)],'integrations':_0x4154f7[_0x45f86c(0x1f5)]}};}async[a150_0x594e97(0x1d1)](_0x242246,_0x27566e){const _0x297473=a150_0x594e97,_0x4bda64=_0x27566e?.[_0x297473(0x150)]??![],_0xc31abd=this['getBackupMetadata'](_0x242246),_0x35af8c=_0xc31abd[_0x297473(0x188)][_0x297473(0x1b9)],_0xb3f265=this[_0x297473(0x11e)][_0x297473(0x1b9)],_0x534e78=_0x35af8c!==_0xb3f265?_0x35af8c:undefined,_0x2c91ad=this[_0x297473(0x166)](a150_0x5d2257[_0x297473(0x15c)](_0x242246,_0x297473(0x1e6)),[]),_0x29b4f6=this[_0x297473(0x166)](a150_0x5d2257['join'](_0x242246,'knowledgebases.json'),[]),_0x2d1102=this[_0x297473(0x166)](a150_0x5d2257['join'](_0x242246,'prompts.json'),[]),_0x10a5ac=this[_0x297473(0x166)](a150_0x5d2257[_0x297473(0x15c)](_0x242246,_0x297473(0x117)),[]),_0x3ec423=_0x27566e?.[_0x297473(0x1f0)]||_0xc31abd[_0x297473(0x188)]['projectName'];if(_0x4bda64){const _0x137b72=new Map(),_0x5ee266=[..._0x2c91ad],_0x3a21c7=_0x2c91ad['length']+0x1;let _0x45dd6d=0x0;while(_0x5ee266[_0x297473(0x1f5)]>0x0&&_0x45dd6d<_0x3a21c7){_0x45dd6d++;const _0xaec2cc=[];for(const _0x51bbf6 of _0x5ee266){canCreateAgent(_0x51bbf6,_0x137b72)?_0x137b72[_0x297473(0xeb)](_0x51bbf6['id'],'dry-run-'+_0x51bbf6['id']):_0xaec2cc['push'](_0x51bbf6);}if(_0xaec2cc[_0x297473(0x1f5)]===_0x5ee266['length'])throw new SDKError(ErrorCode['INTERNAL'],_0x297473(0x1d5),undefined,{'helpText':_0x297473(0x1cb)});_0x5ee266[_0x297473(0x1f5)]=0x0,_0x5ee266[_0x297473(0x129)](..._0xaec2cc);}const _0x39b6e8=_0x2d1102[_0x297473(0x17a)](_0x3991bf=>_0x137b72['has'](_0x3991bf[_0x297473(0x196)][_0x297473(0x167)]))[_0x297473(0x1f5)];return{'projectName':_0x3ec423,'projectId':_0x297473(0x146),'counts':{'agents':_0x2c91ad['length'],'knowledgeBases':_0x29b4f6[_0x297473(0x1f5)],'prompts':_0x39b6e8,'integrations':_0x10a5ac[_0x297473(0x1f5)]},'sourceSite':_0x534e78};}const _0x179a01=await this[_0x297473(0x1c6)][_0x297473(0xfe)]({'name':_0x3ec423,'description':_0xc31abd[_0x297473(0x1fa)][_0x297473(0x196)][_0x297473(0x1fc)]}),_0x21e72e=_0x179a01['id'],_0x1aaa8a=new Map(),_0x508552=new Map(),_0x2c96f5=new Map();for(const _0x22042b of _0x29b4f6){const _0x1ea04f=await this[_0x297473(0x1c6)]['createKnowledgeBase']({'projectId':_0x21e72e,'name':_0x22042b[_0x297473(0x196)][_0x297473(0x1f0)],'tdDatabaseName':_0x22042b[_0x297473(0x196)]['tdDatabaseName'],'tables':_0x22042b[_0x297473(0x196)]['tables']});_0x1aaa8a[_0x297473(0xeb)](_0x22042b['id'],_0x1ea04f['id']);}const _0xb5a2eb=[..._0x2c91ad],_0x20bd2b=_0x2c91ad[_0x297473(0x1f5)]+0x1;let _0x426fe5=0x0;while(_0xb5a2eb[_0x297473(0x1f5)]>0x0&&_0x426fe5<_0x20bd2b){_0x426fe5++;const _0x59c150=[];for(const _0x31be83 of _0xb5a2eb){if(canCreateAgent(_0x31be83,_0x508552)){const _0x68ab3e=remapToolIds(_0x31be83['attributes']['tools'],_0x1aaa8a,_0x508552),_0x2129e3=remapVariableIds(_0x31be83[_0x297473(0x196)][_0x297473(0x130)],_0x1aaa8a),_0x4169c0=await this[_0x297473(0x1c6)]['createAgentResponse']({'name':_0x31be83['attributes'][_0x297473(0x1f0)],'projectId':_0x21e72e,'systemPrompt':_0x31be83[_0x297473(0x196)][_0x297473(0x1d0)],'starterMessage':_0x31be83[_0x297473(0x196)]['starterMessage'],'modelType':migrateModelType(_0x31be83[_0x297473(0x196)][_0x297473(0xf2)]),'maxToolIterations':_0x31be83[_0x297473(0x196)][_0x297473(0x10a)],'temperature':_0x31be83[_0x297473(0x196)][_0x297473(0x159)],'reasoningEffort':_0x31be83[_0x297473(0x196)][_0x297473(0x1a8)],'outputs':_0x31be83['attributes'][_0x297473(0x1ce)],'tools':_0x68ab3e,'variables':_0x2129e3});_0x508552['set'](_0x31be83['id'],_0x4169c0['id']);}else _0x59c150['push'](_0x31be83);}if(_0x59c150['length']===_0xb5a2eb[_0x297473(0x1f5)])throw new SDKError(ErrorCode['INTERNAL'],_0x297473(0x1d5),undefined,{'helpText':_0x297473(0x1cb)});_0xb5a2eb[_0x297473(0x1f5)]=0x0,_0xb5a2eb[_0x297473(0x129)](..._0x59c150);}for(const _0x280b62 of _0x2d1102){const _0x21473c=_0x508552[_0x297473(0x15e)](_0x280b62[_0x297473(0x196)][_0x297473(0x167)]);if(!_0x21473c)continue;const _0x13fd68=await this[_0x297473(0x1c6)][_0x297473(0x116)]({'projectId':_0x21e72e,'agentId':_0x21473c,'name':_0x280b62[_0x297473(0x196)][_0x297473(0x1f0)],'systemPrompt':_0x280b62[_0x297473(0x196)][_0x297473(0x1d0)],'template':_0x280b62[_0x297473(0x196)]['template'],'jsonSchemaHint':_0x280b62['attributes']['jsonSchemaHint']});_0x2c96f5[_0x297473(0xeb)](_0x280b62['id'],_0x13fd68['id']);}for(const _0x169fdc of _0x10a5ac){const _0x4d060f=_0x169fdc['attributes'][_0x297473(0xe5)]['map'](_0x123b9a=>({..._0x123b9a,'promptId':_0x2c96f5[_0x297473(0x15e)](_0x123b9a[_0x297473(0x1a9)])||_0x123b9a[_0x297473(0x1a9)]}));await this[_0x297473(0x1c6)][_0x297473(0x113)]({'projectId':_0x21e72e,'serviceType':_0x169fdc[_0x297473(0x196)][_0x297473(0x11a)],'actions':_0x4d060f,'slackMessageMode':_0x169fdc[_0x297473(0x196)][_0x297473(0x149)],'chatIgnoreManagedActions':_0x169fdc['attributes'][_0x297473(0x1a3)],'chatWelcomeMessage':_0x169fdc['attributes'][_0x297473(0x1d9)],'webhookCorsOrigins':_0x169fdc['attributes']['webhookCorsOrigins']});}return{'projectName':_0x3ec423,'projectId':_0x21e72e,'counts':{'agents':_0x508552['size'],'knowledgeBases':_0x1aaa8a[_0x297473(0x1ea)],'prompts':_0x2c96f5[_0x297473(0x1ea)],'integrations':_0x10a5ac['length']},'sourceSite':_0x534e78};}[a150_0x594e97(0x166)](_0x260035,_0x29bc1a){const _0x543e59=a150_0x594e97;if(!a150_0x2ff9d8[_0x543e59(0x17b)](_0x260035))return _0x29bc1a;return JSON[_0x543e59(0x15b)](a150_0x2ff9d8[_0x543e59(0xfc)](_0x260035,_0x543e59(0x13b)));}['getBackupMetadata'](_0x22d388){const _0xb61d88=a150_0x594e97;if(!a150_0x2ff9d8[_0xb61d88(0x17b)](_0x22d388))throw new SDKError(ErrorCode['NOT_FOUND'],_0xb61d88(0xf5)+_0x22d388,undefined,{'helpText':_0xb61d88(0x12a)});const _0x36f9b3=a150_0x5d2257[_0xb61d88(0x15c)](_0x22d388,_0xb61d88(0x1d6));if(!a150_0x2ff9d8[_0xb61d88(0x17b)](_0x36f9b3))throw new SDKError(ErrorCode[_0xb61d88(0x1ca)],_0xb61d88(0x1da)+_0x22d388,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x479041=JSON[_0xb61d88(0x15b)](a150_0x2ff9d8['readFileSync'](_0x36f9b3,_0xb61d88(0x13b)));if(!isSupportedBackupVersion(_0x479041['version']))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Unsupported\x20backup\x20version:\x20'+_0x479041['version'],undefined,{'helpText':'This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.'});return _0x479041;}async[a150_0x594e97(0x1d7)](_0x472862,_0x762c4f,_0x398836){const _0x983b50=a150_0x594e97,{projectId:_0x2d6607,project:_0x42cc7e}=await this['resolveProjectName'](_0x472862),_0x2a0e95=_0x42cc7e[_0x983b50(0x196)][_0x983b50(0x1f0)];let _0x535f2d;if(_0x762c4f)_0x535f2d=_0x762c4f;else{const _0x2118da=a150_0x5d2257[_0x983b50(0x15c)](process[_0x983b50(0x136)](),_0x983b50(0x1c7)),_0x984743=getSanitizedPathWithMigration(_0x2118da,_0x2a0e95);_0x984743['renamed']&&this[_0x983b50(0x1ad)][_0x983b50(0xee)](_0x983b50(0x12f)+a150_0x5d2257[_0x983b50(0x1b4)](_0x984743['oldPath'])+_0x983b50(0x1bf)+a150_0x5d2257[_0x983b50(0x1b4)](_0x984743[_0x983b50(0x195)])),_0x535f2d=_0x984743[_0x983b50(0x195)];}const _0x1655f6=await this[_0x983b50(0x1c6)]['listAgentsFull'](_0x2d6607),_0x270954=await this['client'][_0x983b50(0xf9)](_0x2d6607),_0x105d3c=await this['client']['listTextKnowledgeBases'](_0x2d6607),_0x10090b=await safeListOrEmpty(()=>this[_0x983b50(0x1c6)][_0x983b50(0x17c)](_0x2d6607)),_0x5897e9=await safeListOrEmpty(()=>this[_0x983b50(0x1c6)]['listWebSearchTools'](_0x2d6607)),_0x342f44=await this[_0x983b50(0x1c6)][_0x983b50(0x10b)](_0x2d6607),_0x34555a=await this[_0x983b50(0x1c6)][_0x983b50(0x177)](_0x2d6607),_0x872393=await safeListOrEmpty(()=>this['client'][_0x983b50(0x1cc)](_0x2d6607)),_0x31c2aa=await safeListOrEmpty(()=>this[_0x983b50(0x1c6)][_0x983b50(0x1af)](_0x2d6607)),_0xd3f439=await safeListOrEmpty(()=>this['client'][_0x983b50(0x18b)](_0x2d6607)),_0x8c0440=await safeListOrEmpty(()=>this[_0x983b50(0x1c6)][_0x983b50(0x1e2)](_0x2d6607)),_0x2dc384=_0x34555a[_0x983b50(0x17a)](_0x451334=>!_0x451334[_0x983b50(0x196)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x983b50(0x1dd)](_0x451334[_0x983b50(0x196)][_0x983b50(0x11a)]['toLowerCase']())),_0x3ba978=new Map(),_0x45bf3=new Map(),_0x43ee06=new Map(),_0x574535=new Map(),_0x476cc6=new Map(),_0xb42720=new Map(),_0x2cce2a=new Map();for(const _0x25dd15 of _0x1655f6){_0x3ba978[_0x983b50(0xeb)](_0x25dd15['id'],_0x25dd15[_0x983b50(0x196)]['name']);}for(const _0x406a43 of _0x270954){_0x45bf3[_0x983b50(0xeb)](_0x406a43['id'],_0x406a43[_0x983b50(0x196)][_0x983b50(0x1f0)]);}for(const _0x282d48 of _0x105d3c){_0x43ee06['set'](_0x282d48['id'],_0x282d48['attributes'][_0x983b50(0x1f0)]);}for(const _0x5d0cd5 of _0x10090b){_0x574535['set'](_0x5d0cd5['id'],_0x5d0cd5[_0x983b50(0x196)][_0x983b50(0x1f0)]);}for(const _0x4c4ed7 of _0x5897e9){_0x476cc6[_0x983b50(0xeb)](_0x4c4ed7['id'],_0x4c4ed7[_0x983b50(0x196)][_0x983b50(0x1f0)]);}for(const _0x229147 of _0x342f44){_0xb42720[_0x983b50(0xeb)](_0x229147['id'],_0x229147['attributes'][_0x983b50(0x1f0)]);}for(const _0x48747d of _0x872393){_0x2cce2a['set'](_0x48747d['id'],_0x48747d[_0x983b50(0x196)][_0x983b50(0x1f0)]);}const _0x14fce6={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x45bf3,'TextKnowledgeBase':_0x43ee06,'Agent':_0x3ba978,'WebSearchTool':_0x476cc6,'ImageGenerator':_0x574535,'ExperimentalKnowledgeBase':_0x2cce2a}),'resolvePromptName':async _0x3c2f94=>_0xb42720[_0x983b50(0x15e)](_0x3c2f94),'onWarning':_0x3332aa=>this[_0x983b50(0x1ad)][_0x983b50(0x1a5)](_0x3332aa)},_0x2124fd={'projectName':_0x2a0e95,'outputDir':_0x535f2d,'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}}},_0x135c96=[],_0x4d77e5=[];for(const _0x1ae314 of _0x1655f6){const _0x27e5d9=getSanitizedPathWithMigration(_0x535f2d,_0x1ae314[_0x983b50(0x196)][_0x983b50(0x1f0)]);_0x27e5d9[_0x983b50(0x1c3)]&&this[_0x983b50(0x1ad)][_0x983b50(0xee)](_0x983b50(0x138)+a150_0x5d2257[_0x983b50(0x1b4)](_0x27e5d9[_0x983b50(0x1e3)])+_0x983b50(0x1bf)+a150_0x5d2257[_0x983b50(0x1b4)](_0x27e5d9[_0x983b50(0x195)]));const _0xe555f=_0x27e5d9[_0x983b50(0x195)],_0x822e0e=a150_0x5d2257['join'](_0xe555f,_0x983b50(0x106)),_0x408916=a150_0x5d2257[_0x983b50(0x15c)](_0xe555f,_0x983b50(0xe4)),_0x56e74c=a150_0x5d2257['join'](_0xe555f,_0x983b50(0x14f)),{yaml:_0x9c2c12,systemPrompt:_0x367f8f,starterMessage:_0x5916ec}=await agentResponseToDef(_0x1ae314,_0x14fce6),_0x73a560=toAgentYamlString(_0x9c2c12),_0x3cea2a=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x408916);let _0x5cc8c0=_0x3cea2a,_0x4aecb7;if(!_0x3cea2a){const _0x53e32f=a150_0x2ff9d8[_0x983b50(0x17b)](_0x822e0e)?a150_0x2ff9d8[_0x983b50(0xfc)](_0x822e0e,'utf-8'):'',_0x664410=a150_0x2ff9d8['readFileSync'](_0x408916,_0x983b50(0x13b)),_0x251e63=_0x983b50(0x1f2)+_0x53e32f+_0x983b50(0x114)+_0x664410,_0x16c1e7='#\x20prompt.md\x0a'+_0x367f8f+_0x983b50(0x114)+_0x73a560,_0x4a0d3=generateDiff(_0x251e63,_0x16c1e7);_0x5cc8c0=hasChanges(_0x4a0d3),_0x5cc8c0&&(_0x4aecb7=formatDiffWithColors(_0x4a0d3));}_0x135c96[_0x983b50(0x129)]({'path':_0xe555f,'content':'','isDir':!![]}),_0x135c96[_0x983b50(0x129)]({'path':_0x822e0e,'content':_0x367f8f}),_0x135c96[_0x983b50(0x129)]({'path':_0x408916,'content':_0x73a560});_0x5916ec&&_0x5916ec[_0x983b50(0x1dd)]('\x0a')&&_0x135c96[_0x983b50(0x129)]({'path':_0x56e74c,'content':_0x5916ec});_0x2124fd[_0x983b50(0x1c7)][_0x983b50(0x129)]({'agentName':_0x1ae314[_0x983b50(0x196)]['name'],'outputPath':_0xe555f,'isNew':_0x3cea2a,'hasChanges':_0x5cc8c0,'diff':_0x4aecb7}),_0x2124fd[_0x983b50(0x18d)]['agents']['total']++;if(_0x3cea2a)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1c7)][_0x983b50(0x18c)]++;else{if(_0x5cc8c0)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1c7)]['updated']++;else _0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1c7)]['unchanged']++;}}for(const _0x58133e of _0x270954){if(_0x58133e[_0x983b50(0x196)][_0x983b50(0x1cf)])continue;const _0x461ef4=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x535f2d),_0x58133e[_0x983b50(0x196)]['name'],_0x983b50(0x1c8));_0x461ef4['renamed']&&this[_0x983b50(0x1ad)][_0x983b50(0xee)](_0x983b50(0x1e4)+a150_0x5d2257[_0x983b50(0x1b4)](_0x461ef4[_0x983b50(0x1e3)])+'\x20→\x20'+a150_0x5d2257[_0x983b50(0x1b4)](_0x461ef4[_0x983b50(0x195)]));const _0x9e5ac6=_0x461ef4[_0x983b50(0x195)],_0x49f6c0=apiKnowledgeBaseToYaml(_0x58133e),_0xe9e83=toKnowledgeBaseYamlString(_0x49f6c0),_0x311851=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x9e5ac6);let _0x2fa1eb=_0x311851,_0x3ca2f1;if(!_0x311851){const _0xb7db57=a150_0x2ff9d8['readFileSync'](_0x9e5ac6,'utf-8'),_0x534cac=generateDiff(_0xb7db57,_0xe9e83);_0x2fa1eb=hasChanges(_0x534cac),_0x2fa1eb&&(_0x3ca2f1=formatDiffWithColors(_0x534cac));}_0x135c96[_0x983b50(0x129)]({'path':_0x9e5ac6,'content':_0xe9e83}),_0x2124fd[_0x983b50(0x15d)][_0x983b50(0x129)]({'name':_0x58133e[_0x983b50(0x196)][_0x983b50(0x1f0)],'outputPath':_0x9e5ac6,'isNew':_0x311851,'hasChanges':_0x2fa1eb,'diff':_0x3ca2f1}),_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x15d)][_0x983b50(0x174)]++;if(_0x311851)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x15d)][_0x983b50(0x18c)]++;else{if(_0x2fa1eb)_0x2124fd['counts'][_0x983b50(0x15d)][_0x983b50(0xe6)]++;else _0x2124fd['counts'][_0x983b50(0x15d)]['unchanged']++;}}for(const _0x3a8d6d of _0x105d3c){if(_0x3a8d6d[_0x983b50(0x196)][_0x983b50(0x1cf)])continue;const _0x2d7e07=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x535f2d),_0x3a8d6d['attributes'][_0x983b50(0x1f0)],_0x983b50(0x1c0));_0x2d7e07[_0x983b50(0x1c3)]&&this[_0x983b50(0x1ad)]['info']('Renamed\x20text\x20KB\x20file:\x20'+a150_0x5d2257['basename'](_0x2d7e07[_0x983b50(0x1e3)])+_0x983b50(0x1bf)+a150_0x5d2257['basename'](_0x2d7e07['path']));const _0x26b98a=_0x2d7e07[_0x983b50(0x195)],_0xb87b4f=toTextKnowledgeBaseMd(_0x3a8d6d[_0x983b50(0x196)][_0x983b50(0x1f0)],_0x3a8d6d[_0x983b50(0x196)]['text']),_0x9f8454=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x26b98a);let _0x85a910=_0x9f8454,_0xc7209b;if(!_0x9f8454){const _0x85bb0e=a150_0x2ff9d8[_0x983b50(0xfc)](_0x26b98a,_0x983b50(0x13b)),_0x295b27=generateDiff(_0x85bb0e,_0xb87b4f);_0x85a910=hasChanges(_0x295b27),_0x85a910&&(_0xc7209b=formatDiffWithColors(_0x295b27));}_0x135c96['push']({'path':_0x26b98a,'content':_0xb87b4f}),_0x2124fd[_0x983b50(0x1ae)][_0x983b50(0x129)]({'name':_0x3a8d6d[_0x983b50(0x196)][_0x983b50(0x1f0)],'outputPath':_0x26b98a,'isNew':_0x9f8454,'hasChanges':_0x85a910,'diff':_0xc7209b}),_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1ae)][_0x983b50(0x174)]++;if(_0x9f8454)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1ae)][_0x983b50(0x18c)]++;else{if(_0x85a910)_0x2124fd[_0x983b50(0x18d)]['textKnowledgeBases'][_0x983b50(0xe6)]++;else _0x2124fd['counts'][_0x983b50(0x1ae)][_0x983b50(0x11c)]++;}}for(const _0x5dd226 of _0x342f44){if(_0x5dd226[_0x983b50(0x196)][_0x983b50(0x1cf)])continue;const _0x2ffcd2=getSanitizedPathWithMigration(getPromptsDir(_0x535f2d),_0x5dd226['attributes'][_0x983b50(0x1f0)],'.yml');_0x2ffcd2[_0x983b50(0x1c3)]&&this['logger'][_0x983b50(0xee)]('Renamed\x20prompt\x20file:\x20'+a150_0x5d2257[_0x983b50(0x1b4)](_0x2ffcd2[_0x983b50(0x1e3)])+'\x20→\x20'+a150_0x5d2257['basename'](_0x2ffcd2['path']));const _0x7f2337=_0x2ffcd2[_0x983b50(0x195)],_0x51b6e4=await apiPromptToYaml(_0x5dd226,_0x14fce6);if(!_0x51b6e4)continue;const _0x4a4224=toPromptYamlString(_0x51b6e4),_0x4702f7=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x7f2337);let _0x3c6d7d=_0x4702f7,_0x5e83f7;if(!_0x4702f7){const _0x14d366=a150_0x2ff9d8[_0x983b50(0xfc)](_0x7f2337,_0x983b50(0x13b)),_0x3dccb5=generateDiff(_0x14d366,_0x4a4224);_0x3c6d7d=hasChanges(_0x3dccb5),_0x3c6d7d&&(_0x5e83f7=formatDiffWithColors(_0x3dccb5));}_0x135c96[_0x983b50(0x129)]({'path':_0x7f2337,'content':_0x4a4224}),_0x2124fd[_0x983b50(0x187)][_0x983b50(0x129)]({'name':_0x5dd226[_0x983b50(0x196)][_0x983b50(0x1f0)],'outputPath':_0x7f2337,'isNew':_0x4702f7,'hasChanges':_0x3c6d7d,'diff':_0x5e83f7}),_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x187)][_0x983b50(0x174)]++;if(_0x4702f7)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x187)][_0x983b50(0x18c)]++;else{if(_0x3c6d7d)_0x2124fd['counts'][_0x983b50(0x187)][_0x983b50(0xe6)]++;else _0x2124fd[_0x983b50(0x18d)][_0x983b50(0x187)][_0x983b50(0x11c)]++;}}for(const _0x2b962f of _0x2dc384){const _0x1cf855=_0x2b962f[_0x983b50(0x196)][_0x983b50(0x11a)][_0x983b50(0x10c)](),_0x1153f6=getSanitizedPathWithMigration(getIntegrationsDir(_0x535f2d),_0x1cf855,_0x983b50(0x1c8));_0x1153f6[_0x983b50(0x1c3)]&&this[_0x983b50(0x1ad)][_0x983b50(0xee)](_0x983b50(0x1ed)+a150_0x5d2257['basename'](_0x1153f6[_0x983b50(0x1e3)])+'\x20→\x20'+a150_0x5d2257[_0x983b50(0x1b4)](_0x1153f6['path']));const _0x38c4f4=_0x1153f6['path'],_0x1fba7b=await apiIntegrationToYaml(_0x2b962f,_0x14fce6),_0x213828=toIntegrationYamlString(_0x1fba7b),_0x1cbd7a=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x38c4f4);let _0x29f251=_0x1cbd7a,_0x4b2462;if(!_0x1cbd7a){const _0x2d4e9b=a150_0x2ff9d8[_0x983b50(0xfc)](_0x38c4f4,_0x983b50(0x13b)),_0x4d1bfb=generateDiff(_0x2d4e9b,_0x213828);_0x29f251=hasChanges(_0x4d1bfb),_0x29f251&&(_0x4b2462=formatDiffWithColors(_0x4d1bfb));}_0x135c96[_0x983b50(0x129)]({'path':_0x38c4f4,'content':_0x213828}),_0x2124fd[_0x983b50(0xf8)][_0x983b50(0x129)]({'name':_0x1cf855,'outputPath':_0x38c4f4,'isNew':_0x1cbd7a,'hasChanges':_0x29f251,'diff':_0x4b2462}),_0x2124fd[_0x983b50(0x18d)][_0x983b50(0xf8)]['total']++;if(_0x1cbd7a)_0x2124fd['counts'][_0x983b50(0xf8)][_0x983b50(0x18c)]++;else{if(_0x29f251)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0xf8)][_0x983b50(0xe6)]++;else _0x2124fd[_0x983b50(0x18d)][_0x983b50(0xf8)]['unchanged']++;}}for(const _0x1c9a75 of _0x872393){if(_0x1c9a75['attributes']['isManaged'])continue;const _0x28adfe=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x535f2d),_0x1c9a75[_0x983b50(0x196)][_0x983b50(0x1f0)]);_0x28adfe[_0x983b50(0x1c3)]&&this['logger'][_0x983b50(0xee)](_0x983b50(0x172)+a150_0x5d2257[_0x983b50(0x1b4)](_0x28adfe[_0x983b50(0x1e3)])+_0x983b50(0x1bf)+a150_0x5d2257['basename'](_0x28adfe['path']));const _0x76de6=_0x28adfe[_0x983b50(0x195)],_0x15e691=a150_0x5d2257[_0x983b50(0x15c)](_0x76de6,sanitizeForFilesystem(_0x1c9a75[_0x983b50(0x196)][_0x983b50(0x1f0)])+'.yml'),_0x255157=a150_0x5d2257['join'](_0x76de6,_0x983b50(0x180)),_0x50979b=apiExperimentalKnowledgeBaseToYaml(_0x1c9a75),_0x168b4f=toExperimentalKnowledgeBaseYamlString(_0x50979b),_0x28c7bd=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x76de6);let _0xcf3d28=_0x28c7bd,_0x186a42,_0x3ae7b6=_0x168b4f;const _0x16fdce=[..._0x50979b[_0x983b50(0x180)]][_0x983b50(0x1b3)]((_0x578d90,_0x2d423c)=>_0x578d90[_0x983b50(0x1f0)]['localeCompare'](_0x2d423c[_0x983b50(0x1f0)]));for(const _0x11c43a of _0x16fdce){_0x3ae7b6+=_0x983b50(0x16e)+_0x11c43a[_0x983b50(0x1f0)]+_0x983b50(0x144)+_0x11c43a[_0x983b50(0x148)]+_0x983b50(0xf3)+_0x11c43a['name']+_0x983b50(0x144)+_0x11c43a['json_schema']+'\x0a';}if(!_0x28c7bd){let _0x5dafa1='';a150_0x2ff9d8[_0x983b50(0x17b)](_0x15e691)&&(_0x5dafa1=a150_0x2ff9d8[_0x983b50(0xfc)](_0x15e691,_0x983b50(0x13b)));if(a150_0x2ff9d8[_0x983b50(0x17b)](_0x255157)){const _0x35a599=a150_0x2ff9d8[_0x983b50(0xe1)](_0x255157,{'withFileTypes':!![]}),_0x16c0e0=_0x35a599[_0x983b50(0x17a)](_0x3ca719=>_0x3ca719[_0x983b50(0xf1)]())[_0x983b50(0x1b3)]((_0x54c45d,_0x252f89)=>_0x54c45d[_0x983b50(0x1f0)][_0x983b50(0x189)](_0x252f89[_0x983b50(0x1f0)]));for(const _0x29db37 of _0x16c0e0){const _0x14fb7c=a150_0x5d2257['join'](_0x255157,_0x29db37[_0x983b50(0x1f0)],_0x983b50(0x17e)),_0xd9a763=a150_0x5d2257[_0x983b50(0x15c)](_0x255157,_0x29db37[_0x983b50(0x1f0)],_0x983b50(0xe8));a150_0x2ff9d8[_0x983b50(0x17b)](_0x14fb7c)&&(_0x5dafa1+=_0x983b50(0x16e)+_0x29db37[_0x983b50(0x1f0)]+_0x983b50(0x144)+a150_0x2ff9d8['readFileSync'](_0x14fb7c,_0x983b50(0x13b))+'\x0a'),a150_0x2ff9d8['existsSync'](_0xd9a763)&&(_0x5dafa1+=_0x983b50(0x1d2)+_0x29db37['name']+_0x983b50(0x144)+a150_0x2ff9d8[_0x983b50(0xfc)](_0xd9a763,_0x983b50(0x13b))+'\x0a');}}const _0x1742b8=generateDiff(_0x5dafa1,_0x3ae7b6);_0xcf3d28=hasChanges(_0x1742b8),_0xcf3d28&&(_0x186a42=formatDiffWithColors(_0x1742b8));}_0x135c96[_0x983b50(0x129)]({'path':_0x76de6,'content':'','isDir':!![]}),_0x135c96[_0x983b50(0x129)]({'path':_0x15e691,'content':_0x168b4f}),_0x135c96[_0x983b50(0x129)]({'path':_0x255157,'content':'','isDir':!![]});for(const _0x10520f of _0x50979b[_0x983b50(0x180)]){const _0x181443=a150_0x5d2257['join'](_0x255157,sanitizeForFilesystem(_0x10520f[_0x983b50(0x1f0)])),_0x2c7989=a150_0x5d2257[_0x983b50(0x15c)](_0x181443,_0x983b50(0x17e)),_0x499c9d=a150_0x5d2257['join'](_0x181443,_0x983b50(0xe8));_0x135c96[_0x983b50(0x129)]({'path':_0x181443,'content':'','isDir':!![]}),_0x135c96[_0x983b50(0x129)]({'path':_0x2c7989,'content':_0x10520f[_0x983b50(0x148)]}),_0x135c96[_0x983b50(0x129)]({'path':_0x499c9d,'content':_0x10520f['json_schema']});}if(a150_0x2ff9d8[_0x983b50(0x17b)](_0x255157)){const _0x8cf07c=a150_0x2ff9d8[_0x983b50(0xe1)](_0x255157,{'withFileTypes':!![]}),_0x139b3f=new Set(_0x50979b[_0x983b50(0x180)][_0x983b50(0x1b8)](_0x18736d=>sanitizeForFilesystem(_0x18736d['name'])));for(const _0x3e3515 of _0x8cf07c){if(_0x3e3515[_0x983b50(0xf1)]()&&!_0x139b3f[_0x983b50(0x194)](_0x3e3515['name'])){const _0x3ec62c=a150_0x5d2257[_0x983b50(0x15c)](_0x255157,_0x3e3515[_0x983b50(0x1f0)]);_0x4d77e5[_0x983b50(0x129)]({'path':_0x3ec62c,'isDir':!![]});}}}_0x2124fd[_0x983b50(0x19a)]['push']({'name':_0x1c9a75[_0x983b50(0x196)]['name'],'outputPath':_0x76de6,'isNew':_0x28c7bd,'hasChanges':_0xcf3d28,'diff':_0x186a42}),_0x2124fd['counts'][_0x983b50(0x19a)]['total']++;if(_0x28c7bd)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x19a)][_0x983b50(0x18c)]++;else{if(_0xcf3d28)_0x2124fd['counts'][_0x983b50(0x19a)][_0x983b50(0xe6)]++;else _0x2124fd[_0x983b50(0x18d)][_0x983b50(0x19a)][_0x983b50(0x11c)]++;}}for(const _0x54fd3a of _0x31c2aa){if(_0x54fd3a[_0x983b50(0x196)][_0x983b50(0x1cf)])continue;const _0x2da301=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x535f2d),_0x54fd3a[_0x983b50(0x196)][_0x983b50(0x1f0)]);_0x2da301[_0x983b50(0x1c3)]&&this['logger'][_0x983b50(0xee)](_0x983b50(0x16d)+a150_0x5d2257[_0x983b50(0x1b4)](_0x2da301[_0x983b50(0x1e3)])+_0x983b50(0x1bf)+a150_0x5d2257[_0x983b50(0x1b4)](_0x2da301['path']));const _0x477f86=_0x2da301[_0x983b50(0x195)],_0x56b9e5=a150_0x5d2257[_0x983b50(0x15c)](_0x477f86,sanitizeForFilesystem(_0x54fd3a[_0x983b50(0x196)]['name'])+_0x983b50(0x1c8)),_0x3af606=a150_0x5d2257[_0x983b50(0x15c)](_0x477f86,'code.js'),_0x2f21fc=a150_0x5d2257[_0x983b50(0x15c)](_0x477f86,_0x983b50(0x14e)),_0xdf0a15=apiExperimentalArtifactToYaml(_0x54fd3a),_0x477638=toExperimentalArtifactYamlString(_0xdf0a15),_0x173c4e=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x477f86);let _0x5021db=_0x173c4e,_0x1794af,_0x1a8214=_0x477638+('\x0a---\x20code\x20---\x0a'+_0xdf0a15[_0x983b50(0x148)]+'\x0a');const _0x10b83b=[..._0xdf0a15[_0x983b50(0x14e)]]['sort']((_0x2dab45,_0x19275c)=>_0x2dab45[_0x983b50(0x123)]['localeCompare'](_0x19275c[_0x983b50(0x123)]));for(const _0x2d3b68 of _0x10b83b){_0x1a8214+='---\x20file:\x20'+_0x2d3b68[_0x983b50(0x123)]+_0x983b50(0x144)+_0x2d3b68[_0x983b50(0x181)]+'\x0a';}if(!_0x173c4e){let _0x561e1d='';a150_0x2ff9d8['existsSync'](_0x56b9e5)&&(_0x561e1d=a150_0x2ff9d8[_0x983b50(0xfc)](_0x56b9e5,_0x983b50(0x13b)));a150_0x2ff9d8[_0x983b50(0x17b)](_0x3af606)&&(_0x561e1d+=_0x983b50(0x1d8)+a150_0x2ff9d8[_0x983b50(0xfc)](_0x3af606,_0x983b50(0x13b))+'\x0a');if(a150_0x2ff9d8['existsSync'](_0x2f21fc)){const _0x33fd1d=a150_0x2ff9d8['readdirSync'](_0x2f21fc),_0x231bed=_0x33fd1d[_0x983b50(0x17a)](_0x4be620=>{const _0x2e42ec=_0x983b50,_0x541746=a150_0x5d2257[_0x2e42ec(0x15c)](_0x2f21fc,_0x4be620);return a150_0x2ff9d8[_0x2e42ec(0x1e5)](_0x541746)[_0x2e42ec(0x122)]();})[_0x983b50(0x1b3)]((_0x16b3fe,_0x503ac4)=>_0x16b3fe[_0x983b50(0x189)](_0x503ac4));for(const _0x1da813 of _0x231bed){const _0x489547=a150_0x5d2257['join'](_0x2f21fc,_0x1da813);_0x561e1d+='---\x20file:\x20'+_0x1da813+_0x983b50(0x144)+a150_0x2ff9d8[_0x983b50(0xfc)](_0x489547,'utf-8')+'\x0a';}}const _0x501d31=generateDiff(_0x561e1d,_0x1a8214);_0x5021db=hasChanges(_0x501d31),_0x5021db&&(_0x1794af=formatDiffWithColors(_0x501d31));}_0x135c96['push']({'path':_0x477f86,'content':'','isDir':!![]}),_0x135c96['push']({'path':_0x56b9e5,'content':_0x477638}),_0x135c96[_0x983b50(0x129)]({'path':_0x3af606,'content':_0xdf0a15[_0x983b50(0x148)]});if(_0xdf0a15[_0x983b50(0x14e)][_0x983b50(0x1f5)]>0x0){_0x135c96[_0x983b50(0x129)]({'path':_0x2f21fc,'content':'','isDir':!![]});for(const _0x46a79a of _0xdf0a15['files']){const _0x2d51a8=a150_0x5d2257['join'](_0x2f21fc,_0x46a79a[_0x983b50(0x123)]);_0x135c96['push']({'path':_0x2d51a8,'content':_0x46a79a['text_content']});}}if(a150_0x2ff9d8[_0x983b50(0x17b)](_0x2f21fc)){const _0x278441=a150_0x2ff9d8[_0x983b50(0xe1)](_0x2f21fc),_0x2c3031=new Set(_0xdf0a15[_0x983b50(0x14e)]['map'](_0x3d063a=>_0x3d063a['file_name']));for(const _0x5ea695 of _0x278441){const _0x2855e7=a150_0x5d2257[_0x983b50(0x15c)](_0x2f21fc,_0x5ea695);a150_0x2ff9d8[_0x983b50(0x1e5)](_0x2855e7)[_0x983b50(0x122)]()&&!_0x2c3031[_0x983b50(0x194)](_0x5ea695)&&_0x4d77e5[_0x983b50(0x129)]({'path':_0x2855e7});}}_0x2124fd[_0x983b50(0x1f9)][_0x983b50(0x129)]({'name':_0x54fd3a['attributes'][_0x983b50(0x1f0)],'outputPath':_0x477f86,'isNew':_0x173c4e,'hasChanges':_0x5021db,'diff':_0x1794af}),_0x2124fd['counts'][_0x983b50(0x1f9)][_0x983b50(0x174)]++;if(_0x173c4e)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1f9)][_0x983b50(0x18c)]++;else{if(_0x5021db)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1f9)][_0x983b50(0xe6)]++;else _0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1f9)][_0x983b50(0x11c)]++;}}for(const _0xa61b20 of _0xd3f439){const _0x3b2713=getSanitizedPathWithMigration(getFormInterfacesDir(_0x535f2d),_0xa61b20[_0x983b50(0x196)]['name'],_0x983b50(0x1c8));_0x3b2713[_0x983b50(0x1c3)]&&this[_0x983b50(0x1ad)][_0x983b50(0xee)](_0x983b50(0x1c2)+a150_0x5d2257[_0x983b50(0x1b4)](_0x3b2713[_0x983b50(0x1e3)])+'\x20→\x20'+a150_0x5d2257[_0x983b50(0x1b4)](_0x3b2713[_0x983b50(0x195)]));const _0x1bfa61=_0x3b2713[_0x983b50(0x195)],_0x1ec0e8=await apiFormInterfaceToYaml(_0xa61b20,_0x14fce6),_0x382cb3=toFormInterfaceYamlString(_0x1ec0e8),_0x17282b=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x1bfa61);let _0x2fd69a=_0x17282b,_0x2a97b2;if(!_0x17282b){const _0x587283=a150_0x2ff9d8[_0x983b50(0xfc)](_0x1bfa61,_0x983b50(0x13b)),_0x1ddb5e=generateDiff(_0x587283,_0x382cb3);_0x2fd69a=hasChanges(_0x1ddb5e),_0x2fd69a&&(_0x2a97b2=formatDiffWithColors(_0x1ddb5e));}_0x135c96[_0x983b50(0x129)]({'path':_0x1bfa61,'content':_0x382cb3}),_0x2124fd[_0x983b50(0x1d4)][_0x983b50(0x129)]({'name':_0xa61b20['attributes'][_0x983b50(0x1f0)],'outputPath':_0x1bfa61,'isNew':_0x17282b,'hasChanges':_0x2fd69a,'diff':_0x2a97b2}),_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1d4)]['total']++;if(_0x17282b)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1d4)][_0x983b50(0x18c)]++;else{if(_0x2fd69a)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1d4)]['updated']++;else _0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1d4)][_0x983b50(0x11c)]++;}}for(const _0x4a9af7 of _0x8c0440){if(_0x4a9af7[_0x983b50(0x196)]['isManaged'])continue;const _0x73a3f0=getSanitizedPathWithMigration(getChatInterfacesDir(_0x535f2d),_0x4a9af7['attributes'][_0x983b50(0x1f0)],_0x983b50(0x1c8));_0x73a3f0['renamed']&&this[_0x983b50(0x1ad)][_0x983b50(0xee)](_0x983b50(0x186)+a150_0x5d2257[_0x983b50(0x1b4)](_0x73a3f0[_0x983b50(0x1e3)])+'\x20→\x20'+a150_0x5d2257['basename'](_0x73a3f0[_0x983b50(0x195)]));const _0x548beb=_0x73a3f0[_0x983b50(0x195)],_0xa164f4=await apiChatInterfaceToYaml(_0x4a9af7,_0x14fce6),_0x4bbdb6=toChatInterfaceYamlString(_0xa164f4),_0x1eee3f=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x548beb);let _0x3ddcb4=_0x1eee3f,_0x1d8627;if(!_0x1eee3f){const _0x56fea7=a150_0x2ff9d8[_0x983b50(0xfc)](_0x548beb,_0x983b50(0x13b)),_0x2256bc=generateDiff(_0x56fea7,_0x4bbdb6);_0x3ddcb4=hasChanges(_0x2256bc),_0x3ddcb4&&(_0x1d8627=formatDiffWithColors(_0x2256bc));}_0x135c96['push']({'path':_0x548beb,'content':_0x4bbdb6}),_0x2124fd[_0x983b50(0x1df)]['push']({'name':_0x4a9af7[_0x983b50(0x196)]['name'],'outputPath':_0x548beb,'isNew':_0x1eee3f,'hasChanges':_0x3ddcb4,'diff':_0x1d8627}),_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1df)][_0x983b50(0x174)]++;if(_0x1eee3f)_0x2124fd[_0x983b50(0x18d)]['chatInterfaces'][_0x983b50(0x18c)]++;else{if(_0x3ddcb4)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1df)][_0x983b50(0xe6)]++;else _0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1df)][_0x983b50(0x11c)]++;}}if(_0x398836?.['dryRun'])return _0x2124fd;a150_0x2ff9d8[_0x983b50(0x13a)](_0x535f2d,{'recursive':!![]}),a150_0x2ff9d8[_0x983b50(0x13a)](getKnowledgeBasesDir(_0x535f2d),{'recursive':!![]}),a150_0x2ff9d8[_0x983b50(0x13a)](getPromptsDir(_0x535f2d),{'recursive':!![]}),a150_0x2ff9d8[_0x983b50(0x13a)](getIntegrationsDir(_0x535f2d),{'recursive':!![]}),a150_0x2ff9d8[_0x983b50(0x13a)](getExperimentalKnowledgeBasesDir(_0x535f2d),{'recursive':!![]}),a150_0x2ff9d8['mkdirSync'](getExperimentalArtifactsDir(_0x535f2d),{'recursive':!![]}),a150_0x2ff9d8[_0x983b50(0x13a)](getFormInterfacesDir(_0x535f2d),{'recursive':!![]}),a150_0x2ff9d8[_0x983b50(0x13a)](getChatInterfacesDir(_0x535f2d),{'recursive':!![]});const _0x2cac11=a150_0x5d2257[_0x983b50(0x15c)](_0x535f2d,_0x983b50(0x197));a150_0x2ff9d8[_0x983b50(0x1f7)](_0x2cac11,createAgentConfigContent(_0x2a0e95));for(const _0x548c04 of _0x135c96){if(_0x548c04[_0x983b50(0x104)])a150_0x2ff9d8['mkdirSync'](_0x548c04['path'],{'recursive':!![]});else{const _0x377aff=a150_0x5d2257[_0x983b50(0x176)](_0x548c04[_0x983b50(0x195)]);!a150_0x2ff9d8[_0x983b50(0x17b)](_0x377aff)&&a150_0x2ff9d8[_0x983b50(0x13a)](_0x377aff,{'recursive':!![]}),a150_0x2ff9d8[_0x983b50(0x1f7)](_0x548c04['path'],_0x548c04[_0x983b50(0x153)]);}}for(const _0x47ccd4 of _0x4d77e5){_0x47ccd4[_0x983b50(0x104)]?(a150_0x2ff9d8[_0x983b50(0x1a1)](_0x47ccd4[_0x983b50(0x195)],{'recursive':!![],'force':!![]}),this['logger'][_0x983b50(0xee)]('Removed\x20deleted\x20directory:\x20'+a150_0x5d2257['basename'](a150_0x5d2257[_0x983b50(0x176)](_0x47ccd4[_0x983b50(0x195)]))+'/'+a150_0x5d2257['basename'](_0x47ccd4[_0x983b50(0x195)]))):(a150_0x2ff9d8['rmSync'](_0x47ccd4['path'],{'force':!![]}),this[_0x983b50(0x1ad)][_0x983b50(0xee)]('Removed\x20deleted\x20file:\x20'+a150_0x5d2257['basename'](a150_0x5d2257[_0x983b50(0x176)](_0x47ccd4[_0x983b50(0x195)]))+'/'+a150_0x5d2257[_0x983b50(0x1b4)](_0x47ccd4['path'])));}return _0x2124fd;}async['pushProject'](_0x14a5fb,_0x32a8df){const _0x209c50=a150_0x594e97,_0x2d6a10=a150_0x5d2257[_0x209c50(0x15c)](_0x14a5fb,_0x209c50(0x197));if(!a150_0x2ff9d8[_0x209c50(0x17b)](_0x2d6a10))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x209c50(0x102)+_0x14a5fb,undefined,{'helpText':_0x209c50(0x199)});const _0x395fe7=loadAgentConfig(_0x2d6a10),_0x1aaa10=await this[_0x209c50(0x133)](_0x395fe7[_0x209c50(0x1ab)]),_0x38a836=await this['client'][_0x209c50(0x190)](_0x1aaa10),_0x920dc6=_0x38a836[_0x209c50(0x196)][_0x209c50(0x1f0)],_0x5e137c={'projectName':_0x920dc6,'projectId':_0x1aaa10,'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}}},_0x3afcb0=[],_0x102e96=[],_0x6a99cd=[],_0x1598b3=[],_0x17d08a=[],_0x3725c6=[],_0x4f0914=a150_0x2ff9d8[_0x209c50(0xe1)](_0x14a5fb,{'withFileTypes':!![]});for(const _0x2c6ef8 of _0x4f0914){if(!_0x2c6ef8[_0x209c50(0xf1)]())continue;if(['knowledge_bases','prompts',_0x209c50(0xf8),_0x209c50(0x1be),_0x209c50(0x1ec),_0x209c50(0xe7),_0x209c50(0x1f4)][_0x209c50(0x1dd)](_0x2c6ef8[_0x209c50(0x1f0)]))continue;const _0x3d45ab=a150_0x5d2257[_0x209c50(0x15c)](_0x14a5fb,_0x2c6ef8[_0x209c50(0x1f0)]);if(isAgentDir(_0x3d45ab)){const _0xda3312=a150_0x5d2257[_0x209c50(0x15c)](_0x3d45ab,_0x209c50(0xe4)),_0x51e459=a150_0x5d2257[_0x209c50(0x15c)](_0x3d45ab,_0x209c50(0x106)),_0x36558c=a150_0x5d2257[_0x209c50(0x15c)](_0x3d45ab,'starter_message.md'),_0x52d6f4=parseAgentYaml(a150_0x2ff9d8['readFileSync'](_0xda3312,_0x209c50(0x13b)),_0xda3312),_0x4c3b76=a150_0x2ff9d8[_0x209c50(0x17b)](_0x51e459)?a150_0x2ff9d8[_0x209c50(0xfc)](_0x51e459,_0x209c50(0x13b)):'',_0x30f78a=a150_0x2ff9d8[_0x209c50(0x17b)](_0x36558c)?a150_0x2ff9d8[_0x209c50(0xfc)](_0x36558c,_0x209c50(0x13b)):_0x52d6f4[_0x209c50(0x12e)];_0x3afcb0[_0x209c50(0x129)]({'name':_0x52d6f4[_0x209c50(0x1f0)],'dir':_0x3d45ab,'yaml':_0x52d6f4,'systemPrompt':_0x4c3b76,'starterMessage':_0x30f78a});}}const _0x277b05=getKnowledgeBasesDir(_0x14a5fb);if(a150_0x2ff9d8[_0x209c50(0x17b)](_0x277b05)){const _0x303133=a150_0x2ff9d8[_0x209c50(0xe1)](_0x277b05);for(const _0x19a1f0 of _0x303133){const _0x29391c=a150_0x5d2257[_0x209c50(0x15c)](_0x277b05,_0x19a1f0);if(_0x19a1f0['endsWith'](_0x209c50(0x1c8))){const _0x37c7aa=parseKnowledgeBaseYaml(a150_0x2ff9d8[_0x209c50(0xfc)](_0x29391c,'utf-8'),_0x29391c);_0x102e96['push']({'name':_0x37c7aa['name'],'path':_0x29391c,'yaml':_0x37c7aa});}else{if(_0x19a1f0['endsWith'](_0x209c50(0x1c0))){const _0x32e138=a150_0x2ff9d8[_0x209c50(0xfc)](_0x29391c,'utf-8'),{name:_0x4556ba,text:_0x554ea7}=parseTextKnowledgeBaseMd(_0x32e138,_0x19a1f0);_0x6a99cd[_0x209c50(0x129)]({'name':_0x4556ba,'path':_0x29391c,'text':_0x554ea7});}}}}const _0x40cd1a=getPromptsDir(_0x14a5fb);if(a150_0x2ff9d8[_0x209c50(0x17b)](_0x40cd1a)){const _0x5607f1=a150_0x2ff9d8['readdirSync'](_0x40cd1a)[_0x209c50(0x17a)](_0x369b11=>_0x369b11[_0x209c50(0x1b5)](_0x209c50(0x1c8)));for(const _0x2ae980 of _0x5607f1){const _0x29be31=a150_0x5d2257[_0x209c50(0x15c)](_0x40cd1a,_0x2ae980),_0x4d4b7d=parsePromptYaml(a150_0x2ff9d8[_0x209c50(0xfc)](_0x29be31,_0x209c50(0x13b)),_0x29be31);_0x1598b3[_0x209c50(0x129)]({'name':_0x4d4b7d[_0x209c50(0x1f0)],'path':_0x29be31,'yaml':_0x4d4b7d});}}const _0x279c2e=[],_0x3239b1=getIntegrationsDir(_0x14a5fb);if(a150_0x2ff9d8[_0x209c50(0x17b)](_0x3239b1)){const _0x256639=a150_0x2ff9d8['readdirSync'](_0x3239b1)[_0x209c50(0x17a)](_0x53ce31=>_0x53ce31[_0x209c50(0x1b5)](_0x209c50(0x1c8)));for(const _0x9916b8 of _0x256639){const _0x4b73c8=a150_0x5d2257[_0x209c50(0x15c)](_0x3239b1,_0x9916b8),_0x549d85=parseIntegrationYaml(a150_0x2ff9d8[_0x209c50(0xfc)](_0x4b73c8,_0x209c50(0x13b)),_0x4b73c8);if(!SAFE_INTEGRATION_TYPES[_0x209c50(0x1dd)](_0x549d85[_0x209c50(0x12c)][_0x209c50(0x10c)]())){this[_0x209c50(0x1ad)][_0x209c50(0x1a5)]('Skipping\x20integration\x20\x27'+_0x549d85[_0x209c50(0x1f0)]+_0x209c50(0x145)+_0x549d85['service_type']+'):\x20'+(_0x209c50(0x139)+SAFE_INTEGRATION_TYPES['join'](',\x20')+')\x20can\x20be\x20pushed.\x20')+'Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.');continue;}_0x279c2e['push']({'name':_0x549d85[_0x209c50(0x1f0)],'path':_0x4b73c8,'yaml':_0x549d85});}}const _0x4976cb=getExperimentalKnowledgeBasesDir(_0x14a5fb);if(a150_0x2ff9d8[_0x209c50(0x17b)](_0x4976cb)){const _0x3d4d85=a150_0x2ff9d8[_0x209c50(0xe1)](_0x4976cb,{'withFileTypes':!![]});for(const _0x4ee21b of _0x3d4d85){if(!_0x4ee21b['isDirectory']())continue;const _0x26fd59=a150_0x5d2257['join'](_0x4976cb,_0x4ee21b[_0x209c50(0x1f0)]),_0x260a98=a150_0x5d2257[_0x209c50(0x15c)](_0x26fd59,_0x4ee21b['name']+_0x209c50(0x1c8)),_0x584d7d=a150_0x5d2257[_0x209c50(0x15c)](_0x26fd59,_0x209c50(0x180));if(!a150_0x2ff9d8['existsSync'](_0x260a98))continue;const _0x339645=parseExperimentalKnowledgeBaseYaml(a150_0x2ff9d8[_0x209c50(0xfc)](_0x260a98,'utf-8'),_0x260a98),_0x4cccd9=[];if(a150_0x2ff9d8[_0x209c50(0x17b)](_0x584d7d)){const _0x49b97c=a150_0x2ff9d8[_0x209c50(0xe1)](_0x584d7d,{'withFileTypes':!![]});for(const _0x44500a of _0x49b97c){if(!_0x44500a[_0x209c50(0xf1)]())continue;const _0x4ddd26=a150_0x5d2257['join'](_0x584d7d,_0x44500a[_0x209c50(0x1f0)]),_0x3bbdf3=a150_0x5d2257['join'](_0x4ddd26,_0x209c50(0x17e)),_0x2642f0=a150_0x5d2257['join'](_0x4ddd26,_0x209c50(0xe8));a150_0x2ff9d8[_0x209c50(0x17b)](_0x3bbdf3)&&a150_0x2ff9d8[_0x209c50(0x17b)](_0x2642f0)&&_0x4cccd9[_0x209c50(0x129)]({'name':_0x44500a[_0x209c50(0x1f0)],'code':a150_0x2ff9d8[_0x209c50(0xfc)](_0x3bbdf3,'utf-8'),'json_schema':a150_0x2ff9d8['readFileSync'](_0x2642f0,_0x209c50(0x13b))});}}const _0x20c5f1={..._0x339645,'variables':_0x339645[_0x209c50(0x130)]||[],'functions':_0x4cccd9};_0x17d08a[_0x209c50(0x129)]({'name':_0x339645[_0x209c50(0x1f0)],'dir':_0x26fd59,'def':_0x20c5f1});}}const _0x3a9a94=getExperimentalArtifactsDir(_0x14a5fb);if(a150_0x2ff9d8[_0x209c50(0x17b)](_0x3a9a94)){const _0x2c4995=a150_0x2ff9d8['readdirSync'](_0x3a9a94,{'withFileTypes':!![]});for(const _0x332c9d of _0x2c4995){if(!_0x332c9d[_0x209c50(0xf1)]())continue;const _0xf591e0=a150_0x5d2257[_0x209c50(0x15c)](_0x3a9a94,_0x332c9d[_0x209c50(0x1f0)]),_0x385509=a150_0x5d2257['join'](_0xf591e0,_0x332c9d[_0x209c50(0x1f0)]+_0x209c50(0x1c8)),_0x2316cc=a150_0x5d2257[_0x209c50(0x15c)](_0xf591e0,_0x209c50(0x17e)),_0x18f8cd=a150_0x5d2257['join'](_0xf591e0,_0x209c50(0x14e));if(!a150_0x2ff9d8[_0x209c50(0x17b)](_0x385509)||!a150_0x2ff9d8[_0x209c50(0x17b)](_0x2316cc))continue;const _0x740566=parseExperimentalArtifactYaml(a150_0x2ff9d8[_0x209c50(0xfc)](_0x385509,'utf-8'),_0x385509),_0x4b738a=a150_0x2ff9d8[_0x209c50(0xfc)](_0x2316cc,_0x209c50(0x13b)),_0x23ece5=[];if(a150_0x2ff9d8[_0x209c50(0x17b)](_0x18f8cd)){const _0x332e6f=a150_0x2ff9d8[_0x209c50(0xe1)](_0x18f8cd);for(const _0x2e9ecc of _0x332e6f){const _0x49615d=a150_0x5d2257[_0x209c50(0x15c)](_0x18f8cd,_0x2e9ecc);a150_0x2ff9d8[_0x209c50(0x1e5)](_0x49615d)['isFile']()&&_0x23ece5[_0x209c50(0x129)]({'file_name':_0x2e9ecc,'text_content':a150_0x2ff9d8[_0x209c50(0xfc)](_0x49615d,_0x209c50(0x13b))});}}const _0x3d6e73={..._0x740566,'code':_0x4b738a,'files':_0x23ece5};_0x3725c6[_0x209c50(0x129)]({'name':_0x740566[_0x209c50(0x1f0)],'dir':_0xf591e0,'def':_0x3d6e73});}}const _0x5f08a8=[],_0x564e41=getFormInterfacesDir(_0x14a5fb);if(a150_0x2ff9d8[_0x209c50(0x17b)](_0x564e41)){const _0x3df632=a150_0x2ff9d8['readdirSync'](_0x564e41)[_0x209c50(0x17a)](_0x4ad44c=>_0x4ad44c[_0x209c50(0x1b5)]('.yml'));for(const _0x1cf8ec of _0x3df632){const _0x4e8d1a=a150_0x5d2257[_0x209c50(0x15c)](_0x564e41,_0x1cf8ec),_0x29208e=parseFormInterfaceYaml(a150_0x2ff9d8['readFileSync'](_0x4e8d1a,_0x209c50(0x13b)),_0x4e8d1a);_0x5f08a8['push']({'name':_0x29208e[_0x209c50(0x1f0)],'path':_0x4e8d1a,'yaml':_0x29208e});}}const _0x49a568=[],_0x1ea467=getChatInterfacesDir(_0x14a5fb);if(a150_0x2ff9d8['existsSync'](_0x1ea467)){const _0x5a9e3f=a150_0x2ff9d8[_0x209c50(0xe1)](_0x1ea467)[_0x209c50(0x17a)](_0x56269f=>_0x56269f[_0x209c50(0x1b5)](_0x209c50(0x1c8)));for(const _0x5f4b29 of _0x5a9e3f){const _0x597fbe=a150_0x5d2257[_0x209c50(0x15c)](_0x1ea467,_0x5f4b29),_0x161e0e=parseChatInterfaceYaml(a150_0x2ff9d8[_0x209c50(0xfc)](_0x597fbe,_0x209c50(0x13b)),_0x597fbe);_0x49a568[_0x209c50(0x129)]({'name':_0x161e0e['name'],'path':_0x597fbe,'yaml':_0x161e0e});}}const _0x5a540f=await this['client'][_0x209c50(0x168)](_0x1aaa10),_0x11a901=await this[_0x209c50(0x1c6)][_0x209c50(0xf9)](_0x1aaa10),_0x5d46ae=await this[_0x209c50(0x1c6)]['listTextKnowledgeBases'](_0x1aaa10),_0x2e7850=await this[_0x209c50(0x1c6)][_0x209c50(0x10b)](_0x1aaa10),_0xf809d1=await this[_0x209c50(0x1c6)][_0x209c50(0x177)](_0x1aaa10),_0x56e403=await safeListOrEmpty(()=>this[_0x209c50(0x1c6)][_0x209c50(0x1cc)](_0x1aaa10)),_0x796610=await safeListOrEmpty(()=>this['client'][_0x209c50(0x1af)](_0x1aaa10)),_0x309bec=await safeListOrEmpty(()=>this[_0x209c50(0x1c6)]['listFormInterfaces'](_0x1aaa10)),_0x4f03c0=await safeListOrEmpty(()=>this[_0x209c50(0x1c6)]['listChatInterfaces'](_0x1aaa10)),_0x7e9b24=await fetchAllToolTargetMaps((_0x2a64df,_0x5111a9)=>this[_0x209c50(0x1c6)][_0x209c50(0x1db)](_0x2a64df,_0x5111a9),_0x1aaa10),_0x16fe2d=new Map(),_0xedaef2=new Map(),_0x3b8f9d=new Map(),_0x506b29=new Map(),_0x32e9c7=new Map(),_0x1cf531=new Map(),_0x559fe9=new Map();for(const _0x4d072d of _0x5a540f){_0x16fe2d[_0x209c50(0xeb)](_0x4d072d[_0x209c50(0x196)][_0x209c50(0x1f0)],_0x4d072d);}for(const _0x210169 of _0x11a901){_0xedaef2[_0x209c50(0xeb)](_0x210169[_0x209c50(0x196)][_0x209c50(0x1f0)],_0x210169);}for(const _0x4dd175 of _0x5d46ae){_0x3b8f9d['set'](_0x4dd175[_0x209c50(0x196)]['name'],_0x4dd175);}for(const _0x50ecde of _0x2e7850){_0x506b29[_0x209c50(0xeb)](_0x50ecde[_0x209c50(0x196)][_0x209c50(0x1f0)],_0x50ecde);}for(const _0x32b81d of _0xf809d1){_0x32e9c7[_0x209c50(0xeb)](_0x32b81d[_0x209c50(0x196)][_0x209c50(0x11a)]['toLowerCase'](),_0x32b81d);}for(const _0x178a95 of _0x56e403){_0x1cf531[_0x209c50(0xeb)](_0x178a95['attributes'][_0x209c50(0x1f0)],_0x178a95);}for(const _0x2ad327 of _0x796610){_0x559fe9[_0x209c50(0xeb)](_0x2ad327[_0x209c50(0x196)][_0x209c50(0x1f0)],_0x2ad327);}const _0x4d6fc6=new Map(),_0x518771=new Map();for(const _0x2b9682 of _0x309bec){_0x4d6fc6[_0x209c50(0xeb)](_0x2b9682[_0x209c50(0x196)][_0x209c50(0x1f0)],_0x2b9682);}for(const _0x367883 of _0x4f03c0){_0x518771[_0x209c50(0xeb)](_0x367883[_0x209c50(0x196)]['name'],_0x367883);}const _0x3d316f=new Map(),_0x4eb68a=new Map();for(const _0x5c228d of _0x5a540f){_0x3d316f[_0x209c50(0xeb)](_0x5c228d[_0x209c50(0x196)]['name'],_0x5c228d['id']),_0x4eb68a['set'](_0x5c228d['id'],_0x5c228d[_0x209c50(0x196)][_0x209c50(0x1f0)]);}const _0x4a387c=new Map(),_0x502c31=new Map();for(const _0x29cddd of _0x2e7850){_0x4a387c[_0x209c50(0xeb)](_0x29cddd['attributes']['name'],_0x29cddd['id']),_0x502c31[_0x209c50(0xeb)](_0x29cddd['id'],_0x29cddd[_0x209c50(0x196)][_0x209c50(0x1f0)]);}const _0x5a5496=_0x7e9b24[_0x209c50(0x192)]['KnowledgeBase']||new Map(),_0x48ba48=_0x7e9b24['nameToId'][_0x209c50(0x1a7)]||new Map(),_0xae27e2=_0x7e9b24[_0x209c50(0x192)]['ExperimentalKnowledgeBase']||new Map(),_0x48eb67=new Map(),_0x196d84={'resolveToolTargetName':buildNameResolver({..._0x7e9b24[_0x209c50(0x198)],'Agent':_0x4eb68a}),'resolvePromptName':async _0x42fb5b=>_0x502c31[_0x209c50(0x15e)](_0x42fb5b),'onWarning':_0x3a860e=>this[_0x209c50(0x1ad)]['warn'](_0x3a860e)};let _0x2af349=[];const _0x2bf6ca={'projectId':_0x1aaa10,'resolveToolTargetId':buildIdResolver({..._0x7e9b24[_0x209c50(0x192)],'Agent':_0x3d316f}),'resolvePromptId':async _0x1252b7=>_0x4a387c[_0x209c50(0x15e)](_0x1252b7),'onWarning':_0x4fdd65=>{const _0x4c764d=_0x209c50;this[_0x4c764d(0x1ad)][_0x4c764d(0x1a5)](_0x4fdd65),_0x2af349['push'](_0x4fdd65);}},{resolved:_0x5da9ec,unresolved:_0x58a3eb}=resolveAgentDependencies(_0x3afcb0,new Set(_0x16fe2d[_0x209c50(0x18f)]()));for(const {agent:_0x9b3e31,missingDeps:_0x38edd8}of _0x58a3eb){_0x5e137c[_0x209c50(0x1c7)]['push']({'agentName':_0x9b3e31[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x137),'error':'Unresolved\x20dependencies:\x20'+_0x38edd8['join'](',\x20')+_0x209c50(0x15f)}),_0x5e137c[_0x209c50(0x18d)]['agents'][_0x209c50(0x14d)]++;}for(const _0x1971c6 of _0x102e96){const _0x1e07a1=_0xedaef2['get'](_0x1971c6['yaml']['name']),_0x3d6f9b=a150_0x2ff9d8[_0x209c50(0xfc)](_0x1971c6['path'],'utf-8');if(_0x1e07a1){const _0x2b4aa8=apiKnowledgeBaseToYaml(_0x1e07a1),_0x5313ab=toKnowledgeBaseYamlString(_0x2b4aa8),_0x356dda=generateDiff(_0x5313ab,_0x3d6f9b),_0x51cdca=hasChanges(_0x356dda);_0x51cdca?(_0x5e137c['knowledgeBases'][_0x209c50(0x129)]({'name':_0x1971c6[_0x209c50(0x10d)]['name'],'action':_0x209c50(0xe6),'id':_0x1e07a1['id'],'diff':formatDiffWithColors(_0x356dda)}),_0x5e137c['counts'][_0x209c50(0x15d)][_0x209c50(0xe6)]++):(_0x5e137c['knowledgeBases'][_0x209c50(0x129)]({'name':_0x1971c6[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x11c),'id':_0x1e07a1['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x15d)][_0x209c50(0x11c)]++);}else _0x5e137c[_0x209c50(0x15d)]['push']({'name':_0x1971c6[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x165)}),_0x5e137c['counts'][_0x209c50(0x15d)]['created']++;}for(const _0x6f17a of _0x6a99cd){const _0x1571ad=_0x3b8f9d['get'](_0x6f17a[_0x209c50(0x1f0)]),_0x18c4b5=a150_0x2ff9d8['readFileSync'](_0x6f17a[_0x209c50(0x195)],_0x209c50(0x13b));if(_0x1571ad){const _0x248b61=toTextKnowledgeBaseMd(_0x1571ad[_0x209c50(0x196)][_0x209c50(0x1f0)],_0x1571ad[_0x209c50(0x196)][_0x209c50(0x10f)]),_0x3b006d=generateDiff(_0x248b61,_0x18c4b5),_0x4acbfa=hasChanges(_0x3b006d);_0x4acbfa?(_0x5e137c[_0x209c50(0x1ae)][_0x209c50(0x129)]({'name':_0x6f17a[_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x1571ad['id'],'diff':formatDiffWithColors(_0x3b006d)}),_0x5e137c['counts'][_0x209c50(0x1ae)][_0x209c50(0xe6)]++):(_0x5e137c[_0x209c50(0x1ae)][_0x209c50(0x129)]({'name':_0x6f17a[_0x209c50(0x1f0)],'action':_0x209c50(0x11c),'id':_0x1571ad['id']}),_0x5e137c['counts'][_0x209c50(0x1ae)][_0x209c50(0x11c)]++);}else _0x5e137c[_0x209c50(0x1ae)][_0x209c50(0x129)]({'name':_0x6f17a[_0x209c50(0x1f0)],'action':'created'}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1ae)][_0x209c50(0x165)]++;}for(const _0x5bdf35 of _0x5da9ec){const _0x16771b=_0x16fe2d[_0x209c50(0x15e)](_0x5bdf35['yaml']['name']),_0x2acdb6=a150_0x5d2257[_0x209c50(0x15c)](_0x5bdf35[_0x209c50(0x112)],_0x209c50(0xe4)),_0x5c8372=a150_0x2ff9d8['readFileSync'](_0x2acdb6,_0x209c50(0x13b)),_0x570ca7=_0x5bdf35[_0x209c50(0x1d0)],_0x49c1dc=_0x209c50(0x1f2)+_0x570ca7+_0x209c50(0x114)+_0x5c8372;if(_0x16771b){const {yaml:_0x46b34b,systemPrompt:_0x1a3eb3}=await agentResponseToDef(_0x16771b,_0x196d84),_0x4ed2f5=toAgentYamlString(_0x46b34b),_0xc4c6e6='#\x20prompt.md\x0a'+_0x1a3eb3+'\x0a\x0a#\x20agent.yml\x0a'+_0x4ed2f5,_0xfbde04=generateDiff(_0xc4c6e6,_0x49c1dc),_0x6e54f=hasChanges(_0xfbde04);_0x6e54f?(_0x5e137c[_0x209c50(0x1c7)][_0x209c50(0x129)]({'agentName':_0x5bdf35['yaml']['name'],'action':_0x209c50(0xe6),'agentId':_0x16771b['id'],'diff':formatDiffWithColors(_0xfbde04)}),_0x5e137c['counts']['agents']['updated']++):(_0x5e137c['agents']['push']({'agentName':_0x5bdf35['yaml'][_0x209c50(0x1f0)],'action':_0x209c50(0x11c),'agentId':_0x16771b['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1c7)]['unchanged']++);}else _0x5e137c[_0x209c50(0x1c7)][_0x209c50(0x129)]({'agentName':_0x5bdf35[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':'created'}),_0x5e137c['counts']['agents'][_0x209c50(0x165)]++;}for(const _0xc0f31 of _0x1598b3){const _0x1e7042=_0x506b29['get'](_0xc0f31['yaml']['name']),_0x28762c=a150_0x2ff9d8['readFileSync'](_0xc0f31['path'],_0x209c50(0x13b));if(_0x1e7042){const _0x34fe25=await apiPromptToYaml(_0x1e7042,_0x196d84);if(!_0x34fe25){_0x5e137c[_0x209c50(0x187)][_0x209c50(0x129)]({'name':_0xc0f31[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x1e7042['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x187)][_0x209c50(0xe6)]++;continue;}const _0x24fe27=toPromptYamlString(_0x34fe25),_0x55228b=generateDiff(_0x24fe27,_0x28762c),_0x205153=hasChanges(_0x55228b);_0x205153?(_0x5e137c[_0x209c50(0x187)]['push']({'name':_0xc0f31[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':'updated','id':_0x1e7042['id'],'diff':formatDiffWithColors(_0x55228b)}),_0x5e137c['counts'][_0x209c50(0x187)][_0x209c50(0xe6)]++):(_0x5e137c['prompts']['push']({'name':_0xc0f31[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x11c),'id':_0x1e7042['id']}),_0x5e137c[_0x209c50(0x18d)]['prompts']['unchanged']++);}else _0x5e137c['prompts'][_0x209c50(0x129)]({'name':_0xc0f31[_0x209c50(0x10d)]['name'],'action':_0x209c50(0x165)}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x187)]['created']++;}for(const _0x3b61f2 of _0x279c2e){const _0x4ab453=_0x32e9c7['get'](_0x3b61f2['yaml'][_0x209c50(0x12c)]),_0x1b8d18=a150_0x2ff9d8['readFileSync'](_0x3b61f2[_0x209c50(0x195)],_0x209c50(0x13b));if(_0x4ab453){const _0x4b98ed=await apiIntegrationToYaml(_0x4ab453,_0x196d84),_0x286402=toIntegrationYamlString(_0x4b98ed),_0xdca269=generateDiff(_0x286402,_0x1b8d18),_0x27415a=hasChanges(_0xdca269);_0x27415a?(_0x5e137c[_0x209c50(0xf8)][_0x209c50(0x129)]({'name':_0x3b61f2['yaml'][_0x209c50(0x12c)],'action':_0x209c50(0xe6),'id':_0x4ab453['id'],'diff':formatDiffWithColors(_0xdca269)}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0xf8)][_0x209c50(0xe6)]++):(_0x5e137c['integrations'][_0x209c50(0x129)]({'name':_0x3b61f2['yaml'][_0x209c50(0x12c)],'action':_0x209c50(0x11c),'id':_0x4ab453['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0xf8)]['unchanged']++);}else _0x5e137c['integrations'][_0x209c50(0x129)]({'name':_0x3b61f2[_0x209c50(0x10d)]['service_type'],'action':'created'}),_0x5e137c['counts'][_0x209c50(0xf8)][_0x209c50(0x165)]++;}for(const _0x2cfa45 of _0x17d08a){const _0x3b7bcd=_0x1cf531['get'](_0x2cfa45[_0x209c50(0x169)][_0x209c50(0x1f0)]),_0x4aff12=toExperimentalKnowledgeBaseYamlString(_0x2cfa45[_0x209c50(0x169)]);let _0x59279f=_0x4aff12;for(const _0x2b43d5 of _0x2cfa45[_0x209c50(0x169)][_0x209c50(0x180)]){_0x59279f+=_0x209c50(0x16e)+_0x2b43d5['name']+'\x20---\x0a'+_0x2b43d5[_0x209c50(0x148)]+'\x0a---\x20schema:\x20'+_0x2b43d5[_0x209c50(0x1f0)]+_0x209c50(0x144)+_0x2b43d5[_0x209c50(0x125)]+'\x0a';}if(_0x3b7bcd){const _0x312a4d=apiExperimentalKnowledgeBaseToYaml(_0x3b7bcd),_0x17cc4b=toExperimentalKnowledgeBaseYamlString(_0x312a4d);let _0x1b7bda=_0x17cc4b;for(const _0x1e2470 of _0x312a4d['functions']){_0x1b7bda+='\x0a---\x20function:\x20'+_0x1e2470[_0x209c50(0x1f0)]+_0x209c50(0x144)+_0x1e2470[_0x209c50(0x148)]+'\x0a---\x20schema:\x20'+_0x1e2470['name']+_0x209c50(0x144)+_0x1e2470['json_schema']+'\x0a';}const _0x1030a8=generateDiff(_0x1b7bda,_0x59279f),_0x1ff612=hasChanges(_0x1030a8);_0x1ff612?(_0x5e137c[_0x209c50(0x19a)][_0x209c50(0x129)]({'name':_0x2cfa45['def'][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x3b7bcd['id'],'diff':formatDiffWithColors(_0x1030a8)}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x19a)]['updated']++):(_0x5e137c[_0x209c50(0x19a)][_0x209c50(0x129)]({'name':_0x2cfa45[_0x209c50(0x169)][_0x209c50(0x1f0)],'action':_0x209c50(0x11c),'id':_0x3b7bcd['id']}),_0x5e137c['counts'][_0x209c50(0x19a)][_0x209c50(0x11c)]++);}else _0x5e137c[_0x209c50(0x19a)][_0x209c50(0x129)]({'name':_0x2cfa45['def']['name'],'action':_0x209c50(0x165)}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x19a)][_0x209c50(0x165)]++;}for(const _0x17a373 of _0x3725c6){const _0x32ea69=_0x559fe9['get'](_0x17a373[_0x209c50(0x169)]['name']),_0x4bf85c=toExperimentalArtifactYamlString(_0x17a373[_0x209c50(0x169)]);let _0x4d6ddd=_0x4bf85c+(_0x209c50(0x1d8)+_0x17a373[_0x209c50(0x169)][_0x209c50(0x148)]+'\x0a');for(const _0x1d91ee of _0x17a373[_0x209c50(0x169)][_0x209c50(0x14e)]){_0x4d6ddd+=_0x209c50(0x1f8)+_0x1d91ee[_0x209c50(0x123)]+_0x209c50(0x144)+_0x1d91ee[_0x209c50(0x181)]+'\x0a';}if(_0x32ea69){const _0x412477=apiExperimentalArtifactToYaml(_0x32ea69),_0x16d4a7=toExperimentalArtifactYamlString(_0x412477);let _0x45087a=_0x16d4a7+('\x0a---\x20code\x20---\x0a'+_0x412477[_0x209c50(0x148)]+'\x0a');for(const _0x173132 of _0x412477[_0x209c50(0x14e)]){_0x45087a+=_0x209c50(0x1f8)+_0x173132[_0x209c50(0x123)]+_0x209c50(0x144)+_0x173132[_0x209c50(0x181)]+'\x0a';}const _0x24510f=generateDiff(_0x45087a,_0x4d6ddd),_0x12b39c=hasChanges(_0x24510f);_0x12b39c?(_0x5e137c[_0x209c50(0x1f9)]['push']({'name':_0x17a373['def'][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x32ea69['id'],'diff':formatDiffWithColors(_0x24510f)}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1f9)][_0x209c50(0xe6)]++):(_0x5e137c[_0x209c50(0x1f9)][_0x209c50(0x129)]({'name':_0x17a373[_0x209c50(0x169)][_0x209c50(0x1f0)],'action':_0x209c50(0x11c),'id':_0x32ea69['id']}),_0x5e137c[_0x209c50(0x18d)]['experimentalArtifacts'][_0x209c50(0x11c)]++);}else _0x5e137c[_0x209c50(0x1f9)]['push']({'name':_0x17a373['def'][_0x209c50(0x1f0)],'action':_0x209c50(0x165)}),_0x5e137c['counts']['experimentalArtifacts'][_0x209c50(0x165)]++;}for(const _0x254959 of _0x5f08a8){const _0x1614ee=_0x4d6fc6[_0x209c50(0x15e)](_0x254959[_0x209c50(0x10d)][_0x209c50(0x1f0)]),_0x14ab25=a150_0x2ff9d8[_0x209c50(0xfc)](_0x254959[_0x209c50(0x195)],_0x209c50(0x13b));if(_0x1614ee){const _0x35fc78=await apiFormInterfaceToYaml(_0x1614ee,_0x196d84),_0x27acd7=toFormInterfaceYamlString(_0x35fc78),_0x33ff8d=generateDiff(_0x27acd7,_0x14ab25),_0x5428c0=hasChanges(_0x33ff8d);_0x5428c0?(_0x5e137c[_0x209c50(0x1d4)][_0x209c50(0x129)]({'name':_0x254959[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x1614ee['id'],'diff':formatDiffWithColors(_0x33ff8d)}),_0x5e137c[_0x209c50(0x18d)]['formInterfaces'][_0x209c50(0xe6)]++):(_0x5e137c[_0x209c50(0x1d4)]['push']({'name':_0x254959['yaml'][_0x209c50(0x1f0)],'action':'unchanged','id':_0x1614ee['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1d4)]['unchanged']++);}else _0x5e137c[_0x209c50(0x1d4)]['push']({'name':_0x254959[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x165)}),_0x5e137c['counts'][_0x209c50(0x1d4)][_0x209c50(0x165)]++;}for(const _0x5a703a of _0x49a568){const _0xd3b91c=_0x518771['get'](_0x5a703a['yaml'][_0x209c50(0x1f0)]),_0x4e6c73=a150_0x2ff9d8['readFileSync'](_0x5a703a[_0x209c50(0x195)],_0x209c50(0x13b));if(_0xd3b91c){const _0x4a653=await apiChatInterfaceToYaml(_0xd3b91c,_0x196d84),_0x429c91=toChatInterfaceYamlString(_0x4a653),_0xb0b754=generateDiff(_0x429c91,_0x4e6c73),_0x708c24=hasChanges(_0xb0b754);_0x708c24?(_0x5e137c[_0x209c50(0x1df)][_0x209c50(0x129)]({'name':_0x5a703a[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0xd3b91c['id'],'diff':formatDiffWithColors(_0xb0b754)}),_0x5e137c[_0x209c50(0x18d)]['chatInterfaces'][_0x209c50(0xe6)]++):(_0x5e137c[_0x209c50(0x1df)][_0x209c50(0x129)]({'name':_0x5a703a['yaml'][_0x209c50(0x1f0)],'action':_0x209c50(0x11c),'id':_0xd3b91c['id']}),_0x5e137c[_0x209c50(0x18d)]['chatInterfaces']['unchanged']++);}else _0x5e137c['chatInterfaces'][_0x209c50(0x129)]({'name':_0x5a703a['yaml'][_0x209c50(0x1f0)],'action':_0x209c50(0x165)}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1df)]['created']++;}if(_0x32a8df?.['dryRun'])return _0x5e137c;_0x5e137c[_0x209c50(0x15d)]=[],_0x5e137c[_0x209c50(0x1ae)]=[],_0x5e137c[_0x209c50(0x187)]=[],_0x5e137c['integrations']=[],_0x5e137c[_0x209c50(0x19a)]=[],_0x5e137c[_0x209c50(0x1f9)]=[],_0x5e137c[_0x209c50(0x1d4)]=[],_0x5e137c[_0x209c50(0x1df)]=[];const _0x30ed12=_0x5e137c['agents'][_0x209c50(0x17a)](_0x585e19=>_0x585e19['action']===_0x209c50(0x137));_0x5e137c[_0x209c50(0x1c7)]=_0x30ed12,_0x5e137c['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x30ed12[_0x209c50(0x1f5)]},'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 _0x132a26 of _0x102e96){try{const _0x3d0ed5=_0xedaef2[_0x209c50(0x15e)](_0x132a26[_0x209c50(0x10d)][_0x209c50(0x1f0)]),_0x5a3a31=yamlKnowledgeBaseToApi(_0x132a26[_0x209c50(0x10d)],_0x1aaa10);if(_0x3d0ed5)await this[_0x209c50(0x1c6)][_0x209c50(0x1e0)](_0x3d0ed5['id'],_0x5a3a31),_0x5a5496['set'](_0x132a26[_0x209c50(0x10d)][_0x209c50(0x1f0)],_0x3d0ed5['id']),_0x5e137c[_0x209c50(0x15d)][_0x209c50(0x129)]({'name':_0x132a26[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x3d0ed5['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x15d)][_0x209c50(0xe6)]++;else{const _0x3b9c43=await this[_0x209c50(0x1c6)][_0x209c50(0x16b)](_0x5a3a31);_0x5a5496['set'](_0x132a26[_0x209c50(0x10d)][_0x209c50(0x1f0)],_0x3b9c43['id']),_0x5e137c['knowledgeBases'][_0x209c50(0x129)]({'name':_0x132a26[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x165),'id':_0x3b9c43['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x15d)][_0x209c50(0x165)]++;}}catch(_0x561164){_0x5e137c[_0x209c50(0x15d)][_0x209c50(0x129)]({'name':_0x132a26[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':'error','error':_0x561164[_0x209c50(0xe2)]}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x15d)][_0x209c50(0x14d)]++;}}for(const _0x372d16 of _0x6a99cd){try{const _0x4d7159=_0x3b8f9d['get'](_0x372d16[_0x209c50(0x1f0)]),_0xf77ff0=yamlTextKnowledgeBaseToApi({'name':_0x372d16['name'],'text':_0x372d16[_0x209c50(0x10f)]},_0x1aaa10);if(_0x4d7159)await this['client'][_0x209c50(0x134)](_0x4d7159['id'],_0xf77ff0),_0x48ba48['set'](_0x372d16['name'],_0x4d7159['id']),_0x5e137c['textKnowledgeBases'][_0x209c50(0x129)]({'name':_0x372d16[_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x4d7159['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1ae)]['updated']++;else{const _0x1c3a2d=await this[_0x209c50(0x1c6)][_0x209c50(0x156)](_0xf77ff0);_0x48ba48['set'](_0x372d16[_0x209c50(0x1f0)],_0x1c3a2d['id']),_0x5e137c['textKnowledgeBases'][_0x209c50(0x129)]({'name':_0x372d16[_0x209c50(0x1f0)],'action':'created','id':_0x1c3a2d['id']}),_0x5e137c['counts'][_0x209c50(0x1ae)][_0x209c50(0x165)]++;}}catch(_0x324b69){_0x5e137c[_0x209c50(0x1ae)][_0x209c50(0x129)]({'name':_0x372d16['name'],'action':'error','error':_0x324b69[_0x209c50(0xe2)]}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1ae)][_0x209c50(0x14d)]++;}}for(const _0x54b3fa of _0x17d08a){try{const _0x6b3c18=_0x1cf531[_0x209c50(0x15e)](_0x54b3fa['def']['name']),_0x28c5bf=yamlExperimentalKnowledgeBaseToApi(_0x54b3fa[_0x209c50(0x169)],_0x1aaa10);if(_0x6b3c18)await this[_0x209c50(0x1c6)][_0x209c50(0x12b)](_0x6b3c18['id'],_0x28c5bf),_0xae27e2[_0x209c50(0xeb)](_0x54b3fa[_0x209c50(0x169)]['name'],_0x6b3c18['id']),_0x5e137c['experimentalKnowledgeBases'][_0x209c50(0x129)]({'name':_0x54b3fa[_0x209c50(0x169)][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x6b3c18['id']}),_0x5e137c['counts'][_0x209c50(0x19a)][_0x209c50(0xe6)]++;else{const _0x441ddd=await this[_0x209c50(0x1c6)][_0x209c50(0x182)](_0x28c5bf);_0xae27e2[_0x209c50(0xeb)](_0x54b3fa[_0x209c50(0x169)][_0x209c50(0x1f0)],_0x441ddd['id']),_0x5e137c['experimentalKnowledgeBases'][_0x209c50(0x129)]({'name':_0x54b3fa[_0x209c50(0x169)][_0x209c50(0x1f0)],'action':_0x209c50(0x165),'id':_0x441ddd['id']}),_0x5e137c['counts'][_0x209c50(0x19a)][_0x209c50(0x165)]++;}}catch(_0x59f9a3){_0x5e137c[_0x209c50(0x19a)][_0x209c50(0x129)]({'name':_0x54b3fa[_0x209c50(0x169)][_0x209c50(0x1f0)],'action':_0x209c50(0x137),'error':_0x59f9a3[_0x209c50(0xe2)]}),_0x5e137c[_0x209c50(0x18d)]['experimentalKnowledgeBases']['errors']++;}}for(const _0x1783b5 of _0x3725c6){try{const _0x38e782=_0x559fe9['get'](_0x1783b5['def'][_0x209c50(0x1f0)]),_0x43d2e9=yamlExperimentalArtifactToApi(_0x1783b5[_0x209c50(0x169)],_0x1aaa10);if(_0x38e782)await this[_0x209c50(0x1c6)][_0x209c50(0x1fd)](_0x38e782['id'],_0x43d2e9),_0x48eb67[_0x209c50(0xeb)](_0x1783b5[_0x209c50(0x169)][_0x209c50(0x1f0)],_0x38e782['id']),_0x5e137c[_0x209c50(0x1f9)][_0x209c50(0x129)]({'name':_0x1783b5[_0x209c50(0x169)][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x38e782['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1f9)][_0x209c50(0xe6)]++;else{const _0x56ce28=await this[_0x209c50(0x1c6)][_0x209c50(0x183)](_0x43d2e9);_0x48eb67[_0x209c50(0xeb)](_0x1783b5['def']['name'],_0x56ce28['id']),_0x5e137c[_0x209c50(0x1f9)][_0x209c50(0x129)]({'name':_0x1783b5['def'][_0x209c50(0x1f0)],'action':_0x209c50(0x165),'id':_0x56ce28['id']}),_0x5e137c['counts'][_0x209c50(0x1f9)][_0x209c50(0x165)]++;}}catch(_0x59f341){_0x5e137c['experimentalArtifacts'][_0x209c50(0x129)]({'name':_0x1783b5[_0x209c50(0x169)][_0x209c50(0x1f0)],'action':_0x209c50(0x137),'error':_0x59f341[_0x209c50(0xe2)]}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1f9)]['errors']++;}}for(const _0x260b36 of _0x5da9ec){_0x2af349=[];try{const _0x64bed7=_0x16fe2d[_0x209c50(0x15e)](_0x260b36[_0x209c50(0x10d)][_0x209c50(0x1f0)]),_0x39c980=await agentDefToRequest(_0x260b36[_0x209c50(0x10d)],_0x260b36[_0x209c50(0x1d0)],_0x260b36[_0x209c50(0x1b1)],_0x2bf6ca);if(_0x64bed7)await this[_0x209c50(0x1c6)][_0x209c50(0xef)](_0x64bed7['id'],_0x39c980),_0x3d316f[_0x209c50(0xeb)](_0x260b36[_0x209c50(0x10d)]['name'],_0x64bed7['id']),_0x5e137c['agents'][_0x209c50(0x129)]({'agentName':_0x260b36['yaml'][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'agentId':_0x64bed7['id'],'warnings':_0x2af349['length']>0x0?_0x2af349:undefined}),_0x5e137c[_0x209c50(0x18d)]['agents'][_0x209c50(0xe6)]++;else{const _0x1f9194=await this[_0x209c50(0x1c6)][_0x209c50(0x18e)](_0x39c980);_0x3d316f['set'](_0x260b36[_0x209c50(0x10d)][_0x209c50(0x1f0)],_0x1f9194['id']),_0x5e137c[_0x209c50(0x1c7)][_0x209c50(0x129)]({'agentName':_0x260b36[_0x209c50(0x10d)]['name'],'action':_0x209c50(0x165),'agentId':_0x1f9194['id'],'warnings':_0x2af349['length']>0x0?_0x2af349:undefined}),_0x5e137c['counts'][_0x209c50(0x1c7)][_0x209c50(0x165)]++;}}catch(_0x2c6a80){_0x5e137c[_0x209c50(0x1c7)][_0x209c50(0x129)]({'agentName':_0x260b36[_0x209c50(0x10d)]['name'],'action':'error','error':_0x2c6a80['message'],'warnings':_0x2af349[_0x209c50(0x1f5)]>0x0?_0x2af349:undefined}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1c7)][_0x209c50(0x14d)]++;}}for(const _0x3c4f2a of _0x1598b3){try{const _0x33aa86=_0x506b29[_0x209c50(0x15e)](_0x3c4f2a[_0x209c50(0x10d)][_0x209c50(0x1f0)]),_0x5e51c3=await yamlPromptToApi(_0x3c4f2a['yaml'],_0x1aaa10,_0x2bf6ca);if(!_0x5e51c3){_0x5e137c[_0x209c50(0x187)][_0x209c50(0x129)]({'name':_0x3c4f2a[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':'error','error':_0x209c50(0xf4)}),_0x5e137c[_0x209c50(0x18d)]['prompts'][_0x209c50(0x14d)]++;continue;}if(_0x33aa86)await this[_0x209c50(0x1c6)][_0x209c50(0x13d)](_0x33aa86['id'],_0x5e51c3),_0x4a387c['set'](_0x3c4f2a['yaml'][_0x209c50(0x1f0)],_0x33aa86['id']),_0x5e137c[_0x209c50(0x187)]['push']({'name':_0x3c4f2a[_0x209c50(0x10d)]['name'],'action':_0x209c50(0xe6),'id':_0x33aa86['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x187)]['updated']++;else{const _0x2b5502=await this[_0x209c50(0x1c6)]['createPrompt'](_0x5e51c3);_0x4a387c[_0x209c50(0xeb)](_0x3c4f2a['yaml'][_0x209c50(0x1f0)],_0x2b5502['id']),_0x5e137c[_0x209c50(0x187)][_0x209c50(0x129)]({'name':_0x3c4f2a['yaml'][_0x209c50(0x1f0)],'action':_0x209c50(0x165),'id':_0x2b5502['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x187)][_0x209c50(0x165)]++;}}catch(_0x5559c){_0x5e137c[_0x209c50(0x187)][_0x209c50(0x129)]({'name':_0x3c4f2a['yaml']['name'],'action':_0x209c50(0x137),'error':_0x5559c[_0x209c50(0xe2)]}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x187)][_0x209c50(0x14d)]++;}}for(const _0xa40417 of _0x279c2e){try{const _0x49a00b=_0x32e9c7[_0x209c50(0x15e)](_0xa40417[_0x209c50(0x10d)][_0x209c50(0x12c)]),_0x3e7474=await yamlIntegrationToApi(_0xa40417['yaml'],_0x1aaa10,_0x2bf6ca);if(_0x49a00b){await this[_0x209c50(0x1c6)][_0x209c50(0x184)](_0x49a00b['id']);const _0x4d847e=await this[_0x209c50(0x1c6)][_0x209c50(0x113)](_0x3e7474);_0x5e137c['integrations'][_0x209c50(0x129)]({'name':_0xa40417['yaml']['service_type'],'action':'updated','id':_0x4d847e['id']}),_0x5e137c['counts'][_0x209c50(0xf8)][_0x209c50(0xe6)]++;}else{const _0x3749fb=await this[_0x209c50(0x1c6)][_0x209c50(0x113)](_0x3e7474);_0x5e137c[_0x209c50(0xf8)][_0x209c50(0x129)]({'name':_0xa40417[_0x209c50(0x10d)][_0x209c50(0x12c)],'action':_0x209c50(0x165),'id':_0x3749fb['id']}),_0x5e137c[_0x209c50(0x18d)]['integrations'][_0x209c50(0x165)]++;}}catch(_0x9bba11){_0x5e137c[_0x209c50(0xf8)][_0x209c50(0x129)]({'name':_0xa40417[_0x209c50(0x10d)][_0x209c50(0x12c)],'action':'error','error':_0x9bba11[_0x209c50(0xe2)]}),_0x5e137c[_0x209c50(0x18d)]['integrations']['errors']++;}}for(const _0x37661d of _0x5f08a8){try{const _0x5b2c81=_0x4d6fc6[_0x209c50(0x15e)](_0x37661d['yaml']['name']),_0x1fc19a=await yamlFormInterfaceToApi(_0x37661d['yaml'],_0x1aaa10,_0x2bf6ca);if(!_0x1fc19a){_0x5e137c[_0x209c50(0x1d4)][_0x209c50(0x129)]({'name':_0x37661d[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x137),'error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1d4)][_0x209c50(0x14d)]++;continue;}if(_0x5b2c81){const _0x49933e=await this[_0x209c50(0x1c6)]['updateFormInterface'](_0x5b2c81['id'],_0x1fc19a);_0x5e137c[_0x209c50(0x1d4)][_0x209c50(0x129)]({'name':_0x37661d[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x49933e['id']}),_0x5e137c[_0x209c50(0x18d)]['formInterfaces']['updated']++;}else{const _0x1a176e=await this[_0x209c50(0x1c6)][_0x209c50(0x17d)](_0x1fc19a);_0x5e137c[_0x209c50(0x1d4)][_0x209c50(0x129)]({'name':_0x37661d[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x165),'id':_0x1a176e['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1d4)]['created']++;}}catch(_0x840b6d){_0x5e137c[_0x209c50(0x1d4)][_0x209c50(0x129)]({'name':_0x37661d['yaml']['name'],'action':'error','error':_0x840b6d['message']}),_0x5e137c['counts'][_0x209c50(0x1d4)][_0x209c50(0x14d)]++;}}for(const _0x4a5b5c of _0x49a568){try{const _0x390ff5=_0x518771[_0x209c50(0x15e)](_0x4a5b5c[_0x209c50(0x10d)]['name']),_0x18d4ca=await yamlChatInterfaceToApi(_0x4a5b5c[_0x209c50(0x10d)],_0x1aaa10,_0x2bf6ca);if(_0x390ff5){const _0x5756b4=await this[_0x209c50(0x1c6)][_0x209c50(0x1de)](_0x390ff5['id'],_0x18d4ca);_0x5e137c[_0x209c50(0x1df)][_0x209c50(0x129)]({'name':_0x4a5b5c[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x5756b4['id']}),_0x5e137c['counts'][_0x209c50(0x1df)][_0x209c50(0xe6)]++;}else{const _0x2cfd26=await this[_0x209c50(0x1c6)][_0x209c50(0x142)](_0x18d4ca);_0x5e137c[_0x209c50(0x1df)][_0x209c50(0x129)]({'name':_0x4a5b5c[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x165),'id':_0x2cfd26['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1df)][_0x209c50(0x165)]++;}}catch(_0x543ecc){_0x5e137c[_0x209c50(0x1df)]['push']({'name':_0x4a5b5c[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x137),'error':_0x543ecc[_0x209c50(0xe2)]}),_0x5e137c[_0x209c50(0x18d)]['chatInterfaces'][_0x209c50(0x14d)]++;}}return _0x5e137c;}async[a150_0x594e97(0x1a0)](_0x55e2db,_0x4c77e1,_0x34f35c,_0x1102e7){const _0x18205a=a150_0x594e97,{projectId:_0x1b7ec6,project:_0x4dafc2}=await this[_0x18205a(0x110)](_0x55e2db),_0xcbb9db=_0x4dafc2[_0x18205a(0x196)][_0x18205a(0x1f0)],_0x89f26f=await this[_0x18205a(0x1c6)][_0x18205a(0x168)](_0x1b7ec6),_0x5f1ece=_0x89f26f['find'](_0x367748=>_0x367748['attributes'][_0x18205a(0x1f0)]===_0x4c77e1);if(!_0x5f1ece)throw new SDKError(ErrorCode[_0x18205a(0x107)],'Agent\x20not\x20found:\x20'+_0x4c77e1,undefined,{'helpText':_0x18205a(0x185)+_0x89f26f[_0x18205a(0x1b8)](_0x3dfae7=>_0x3dfae7[_0x18205a(0x196)][_0x18205a(0x1f0)])['join'](',\x20')});let _0x5e4ca0;if(_0x34f35c)_0x5e4ca0=_0x34f35c;else{const _0x1ff822=a150_0x5d2257[_0x18205a(0x15c)](process[_0x18205a(0x136)](),_0x18205a(0x1c7)),_0x41ca24=getSanitizedPathWithMigration(_0x1ff822,_0xcbb9db);_0x41ca24[_0x18205a(0x1c3)]&&this[_0x18205a(0x1ad)]['info'](_0x18205a(0x12f)+a150_0x5d2257[_0x18205a(0x1b4)](_0x41ca24[_0x18205a(0x1e3)])+'\x20→\x20'+a150_0x5d2257['basename'](_0x41ca24[_0x18205a(0x195)])),_0x5e4ca0=_0x41ca24['path'];}const _0x79363b=getSanitizedPathWithMigration(_0x5e4ca0,_0x4c77e1);_0x79363b[_0x18205a(0x1c3)]&&this['logger'][_0x18205a(0xee)](_0x18205a(0x138)+a150_0x5d2257[_0x18205a(0x1b4)](_0x79363b[_0x18205a(0x1e3)])+_0x18205a(0x1bf)+a150_0x5d2257[_0x18205a(0x1b4)](_0x79363b[_0x18205a(0x195)]));const _0x327c92=_0x79363b[_0x18205a(0x195)],_0x54d70d=new Map(),_0x903c7=new Map(),_0xa07864=await this['client'][_0x18205a(0xf9)](_0x1b7ec6),_0x9c9365=await this[_0x18205a(0x1c6)][_0x18205a(0x16a)](_0x1b7ec6),_0x67a0a6=await safeListOrEmpty(()=>this[_0x18205a(0x1c6)][_0x18205a(0x1cc)](_0x1b7ec6)),_0x22262e=new Map(),_0x56ffb=new Map();for(const _0x1eaf78 of _0xa07864){_0x54d70d[_0x18205a(0xeb)](_0x1eaf78['id'],_0x1eaf78[_0x18205a(0x196)][_0x18205a(0x1f0)]);}for(const _0x563fee of _0x9c9365){_0x22262e[_0x18205a(0xeb)](_0x563fee['id'],_0x563fee[_0x18205a(0x196)][_0x18205a(0x1f0)]);}for(const _0x279515 of _0x67a0a6){_0x56ffb[_0x18205a(0xeb)](_0x279515['id'],_0x279515['attributes'][_0x18205a(0x1f0)]);}for(const _0x8ad939 of _0x89f26f){_0x903c7[_0x18205a(0xeb)](_0x8ad939['id'],_0x8ad939[_0x18205a(0x196)][_0x18205a(0x1f0)]);}const _0x19ac01={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x54d70d,'TextKnowledgeBase':_0x22262e,'Agent':_0x903c7,'ExperimentalKnowledgeBase':_0x56ffb}),'resolvePromptName':async()=>undefined,'onWarning':_0xf42dc7=>this[_0x18205a(0x1ad)][_0x18205a(0x1a5)](_0xf42dc7)},_0x33ccb8=a150_0x5d2257['join'](_0x327c92,_0x18205a(0x106)),_0x39a004=a150_0x5d2257[_0x18205a(0x15c)](_0x327c92,_0x18205a(0xe4)),_0x13edaf=a150_0x5d2257[_0x18205a(0x15c)](_0x327c92,_0x18205a(0x14f)),_0x5eccf0=!a150_0x2ff9d8[_0x18205a(0x17b)](_0x39a004);if(_0x1102e7?.['dryRun'])return{'agentName':_0x4c77e1,'outputPath':_0x327c92,'isNew':_0x5eccf0,'hasChanges':!![]};a150_0x2ff9d8[_0x18205a(0x13a)](_0x5e4ca0,{'recursive':!![]}),a150_0x2ff9d8['mkdirSync'](_0x327c92,{'recursive':!![]});const _0x3783e8=a150_0x5d2257['join'](_0x5e4ca0,_0x18205a(0x197));!a150_0x2ff9d8[_0x18205a(0x17b)](_0x3783e8)&&a150_0x2ff9d8['writeFileSync'](_0x3783e8,createAgentConfigContent(_0x55e2db));const {yaml:_0x50a805,systemPrompt:_0x5bf065,starterMessage:_0x5d183a}=await agentResponseToDef(_0x5f1ece,_0x19ac01);let _0x4fdd75=_0x5eccf0;if(!_0x5eccf0){const _0x5c64c6=a150_0x2ff9d8[_0x18205a(0x17b)](_0x33ccb8)?a150_0x2ff9d8[_0x18205a(0xfc)](_0x33ccb8,'utf-8'):'',_0x3ac773=a150_0x2ff9d8[_0x18205a(0xfc)](_0x39a004,_0x18205a(0x13b));_0x4fdd75=_0x5c64c6!==_0x5bf065||_0x3ac773!==toAgentYamlString(_0x50a805);}a150_0x2ff9d8[_0x18205a(0x1f7)](_0x33ccb8,_0x5bf065),a150_0x2ff9d8[_0x18205a(0x1f7)](_0x39a004,toAgentYamlString(_0x50a805));if(_0x5d183a&&_0x5d183a[_0x18205a(0x1dd)]('\x0a'))a150_0x2ff9d8[_0x18205a(0x1f7)](_0x13edaf,_0x5d183a);else a150_0x2ff9d8[_0x18205a(0x17b)](_0x13edaf)&&a150_0x2ff9d8[_0x18205a(0x121)](_0x13edaf);return{'agentName':_0x4c77e1,'outputPath':_0x327c92,'isNew':_0x5eccf0,'hasChanges':_0x4fdd75};}async[a150_0x594e97(0xe3)](_0x343471,_0xa5f44d){const _0x157084=a150_0x594e97;let _0xd3812f;isAgentYamlPath(_0x343471)?_0xd3812f=getAgentDirFromYamlPath(_0x343471):_0xd3812f=_0x343471;const {config:_0x2ebce5}=findAgentConfig(_0xd3812f),_0x24c479=await this['resolveProjectId'](_0x2ebce5[_0x157084(0x1ab)]),_0x24066c=a150_0x5d2257[_0x157084(0x15c)](_0xd3812f,_0x157084(0xe4)),_0xede49e=a150_0x5d2257[_0x157084(0x15c)](_0xd3812f,_0x157084(0x106)),_0x4d358b=a150_0x5d2257[_0x157084(0x15c)](_0xd3812f,_0x157084(0x14f));if(!a150_0x2ff9d8['existsSync'](_0x24066c))throw new SDKError(ErrorCode['NOT_FOUND'],_0x157084(0x1b0)+_0xd3812f,undefined,{'helpText':_0x157084(0x1ef)});const _0x579776=parseAgentYaml(a150_0x2ff9d8[_0x157084(0xfc)](_0x24066c,_0x157084(0x13b)),_0x24066c),_0x232624=a150_0x2ff9d8[_0x157084(0x17b)](_0xede49e)?a150_0x2ff9d8[_0x157084(0xfc)](_0xede49e,_0x157084(0x13b)):'',_0x511621=a150_0x2ff9d8[_0x157084(0x17b)](_0x4d358b)?a150_0x2ff9d8[_0x157084(0xfc)](_0x4d358b,'utf-8'):_0x579776[_0x157084(0x12e)];if(_0xa5f44d?.['dryRun'])return{'agentName':_0x579776[_0x157084(0x1f0)],'action':'created','projectId':_0x24c479};const _0x50a16f=await this[_0x157084(0x1c6)]['listAgentsFull'](_0x24c479),_0x65bf20=await fetchAllToolTargetMaps((_0x2c396a,_0x2d8723)=>this['client']['listToolTargets'](_0x2c396a,_0x2d8723),_0x24c479),_0xc0c60d=new Map();for(const _0x3a66df of _0x50a16f){_0xc0c60d[_0x157084(0xeb)](_0x3a66df[_0x157084(0x196)][_0x157084(0x1f0)],_0x3a66df['id']);}const _0x7e0a7a=[],_0x155733={'projectId':_0x24c479,'resolveToolTargetId':buildIdResolver({..._0x65bf20[_0x157084(0x192)],'Agent':_0xc0c60d}),'resolvePromptId':async()=>undefined,'onWarning':_0x286d15=>{const _0x551821=_0x157084;this['logger'][_0x551821(0x1a5)](_0x286d15),_0x7e0a7a['push'](_0x286d15);}};try{const _0x5ef43d=_0x50a16f[_0x157084(0x1c5)](_0x57b572=>_0x57b572['attributes'][_0x157084(0x1f0)]===_0x579776[_0x157084(0x1f0)]),_0x21e26c=await agentDefToRequest(_0x579776,_0x232624,_0x511621,_0x155733);if(_0x5ef43d)return await this['client'][_0x157084(0xef)](_0x5ef43d['id'],_0x21e26c),{'agentName':_0x579776[_0x157084(0x1f0)],'action':_0x157084(0xe6),'projectId':_0x24c479,'agentId':_0x5ef43d['id'],'warnings':_0x7e0a7a[_0x157084(0x1f5)]>0x0?_0x7e0a7a:undefined};else{const _0x75fb96=await this[_0x157084(0x1c6)][_0x157084(0x18e)](_0x21e26c);return{'agentName':_0x579776[_0x157084(0x1f0)],'action':_0x157084(0x165),'projectId':_0x24c479,'agentId':_0x75fb96['id'],'warnings':_0x7e0a7a[_0x157084(0x1f5)]>0x0?_0x7e0a7a:undefined};}}catch(_0x52be86){return{'agentName':_0x579776[_0x157084(0x1f0)],'action':_0x157084(0x137),'projectId':_0x24c479,'error':_0x52be86['message'],'warnings':_0x7e0a7a['length']>0x0?_0x7e0a7a:undefined};}}async[a150_0x594e97(0x170)](_0x46f867,_0x47bcc3,_0x5da8e5){const _0x2c9b04=a150_0x594e97,_0xfa6701=a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x46f867)&&a150_0x2ff9d8[_0x2c9b04(0x17b)](a150_0x5d2257['join'](_0x46f867,'tdx.json'));let _0x32c49c;const _0x2e2fbb=[],_0x51d757=[],_0x15bc86=[],_0x3eff38=[],_0x489a48=[],_0xd38b49=[],_0x50a324=[],_0x3a770b=[],_0x92ad46=[];if(_0xfa6701){const _0xb915c7=loadAgentConfig(a150_0x5d2257[_0x2c9b04(0x15c)](_0x46f867,_0x2c9b04(0x197)));_0x32c49c=_0xb915c7[_0x2c9b04(0x1ab)];const _0x1f2f7a=a150_0x2ff9d8[_0x2c9b04(0xe1)](_0x46f867,{'withFileTypes':!![]});for(const _0x2f5ecd of _0x1f2f7a){if(!_0x2f5ecd[_0x2c9b04(0xf1)]())continue;if([_0x2c9b04(0x1ba),_0x2c9b04(0x1be),_0x2c9b04(0x1ec),_0x2c9b04(0x187),_0x2c9b04(0xf8),_0x2c9b04(0xe7),_0x2c9b04(0x1f4)]['includes'](_0x2f5ecd[_0x2c9b04(0x1f0)]))continue;const _0x16ed18=a150_0x5d2257[_0x2c9b04(0x15c)](_0x46f867,_0x2f5ecd['name']);if(isAgentDir(_0x16ed18)){const _0x47a709=a150_0x5d2257[_0x2c9b04(0x15c)](_0x16ed18,'agent.yml'),_0x4b4bfd=a150_0x5d2257[_0x2c9b04(0x15c)](_0x16ed18,_0x2c9b04(0x106)),_0x1a30ae=a150_0x5d2257[_0x2c9b04(0x15c)](_0x16ed18,'starter_message.md'),_0x2b6ccf=parseAgentYaml(a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x47a709,_0x2c9b04(0x13b)),_0x47a709),_0x4992fa=a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x4b4bfd)?a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x4b4bfd,'utf-8'):'',_0x909d87=a150_0x2ff9d8['existsSync'](_0x1a30ae)?a150_0x2ff9d8['readFileSync'](_0x1a30ae,_0x2c9b04(0x13b)):_0x2b6ccf['starter_message'];_0x2e2fbb[_0x2c9b04(0x129)]({'name':_0x2b6ccf[_0x2c9b04(0x1f0)],'dir':_0x16ed18,'yaml':_0x2b6ccf,'systemPrompt':_0x4992fa,'starterMessage':_0x909d87});}}const _0x5987a8=getKnowledgeBasesDir(_0x46f867);if(a150_0x2ff9d8['existsSync'](_0x5987a8)){const _0x38d48f=a150_0x2ff9d8['readdirSync'](_0x5987a8);for(const _0x9b6aef of _0x38d48f){const _0x42f5e7=a150_0x5d2257[_0x2c9b04(0x15c)](_0x5987a8,_0x9b6aef);if(_0x9b6aef['endsWith'](_0x2c9b04(0x1c8))){const _0x5ad94f=parseKnowledgeBaseYaml(a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x42f5e7,_0x2c9b04(0x13b)),_0x42f5e7);_0x51d757['push']({'name':_0x5ad94f[_0x2c9b04(0x1f0)],'path':_0x42f5e7,'yaml':_0x5ad94f});}else{if(_0x9b6aef['endsWith'](_0x2c9b04(0x1c0))){const _0x579e4c=a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x42f5e7,_0x2c9b04(0x13b)),{name:_0x59e683,text:_0x56732a}=parseTextKnowledgeBaseMd(_0x579e4c,_0x9b6aef);_0x15bc86['push']({'name':_0x59e683,'path':_0x42f5e7,'text':_0x56732a});}}}}const _0x45c9b6=getPromptsDir(_0x46f867);if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x45c9b6)){const _0x2dd154=a150_0x2ff9d8[_0x2c9b04(0xe1)](_0x45c9b6)[_0x2c9b04(0x17a)](_0x1a9c60=>_0x1a9c60[_0x2c9b04(0x1b5)](_0x2c9b04(0x1c8)));for(const _0x1ad136 of _0x2dd154){const _0xbc616=a150_0x5d2257[_0x2c9b04(0x15c)](_0x45c9b6,_0x1ad136),_0x309c06=parsePromptYaml(a150_0x2ff9d8[_0x2c9b04(0xfc)](_0xbc616,'utf-8'),_0xbc616);_0x3eff38[_0x2c9b04(0x129)]({'name':_0x309c06[_0x2c9b04(0x1f0)],'path':_0xbc616,'yaml':_0x309c06});}}const _0x251364=getIntegrationsDir(_0x46f867);if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x251364)){const _0x27022a=a150_0x2ff9d8[_0x2c9b04(0xe1)](_0x251364)[_0x2c9b04(0x17a)](_0xec0205=>_0xec0205['endsWith'](_0x2c9b04(0x1c8)));for(const _0xccf1c5 of _0x27022a){const _0x298636=a150_0x5d2257[_0x2c9b04(0x15c)](_0x251364,_0xccf1c5),_0x3cc4f2=parseIntegrationYaml(a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x298636,'utf-8'),_0x298636);SAFE_INTEGRATION_TYPES[_0x2c9b04(0x1dd)](_0x3cc4f2[_0x2c9b04(0x12c)]['toLowerCase']())?_0x489a48[_0x2c9b04(0x129)]({'name':_0x3cc4f2[_0x2c9b04(0x1f0)],'path':_0x298636,'yaml':_0x3cc4f2}):this[_0x2c9b04(0x1ad)][_0x2c9b04(0x1a5)]('Skipping\x20integration\x20\x27'+_0x3cc4f2[_0x2c9b04(0x1f0)]+_0x2c9b04(0x145)+_0x3cc4f2[_0x2c9b04(0x12c)]+'):\x20'+(_0x2c9b04(0x139)+SAFE_INTEGRATION_TYPES[_0x2c9b04(0x15c)](',\x20')+_0x2c9b04(0x155)));}}const _0x39e31e=getExperimentalKnowledgeBasesDir(_0x46f867);if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x39e31e)){const _0x332d35=a150_0x2ff9d8[_0x2c9b04(0xe1)](_0x39e31e,{'withFileTypes':!![]});for(const _0x375da6 of _0x332d35){if(!_0x375da6['isDirectory']())continue;const _0x18ddfa=a150_0x5d2257['join'](_0x39e31e,_0x375da6[_0x2c9b04(0x1f0)]),_0x2bb0ab=a150_0x5d2257[_0x2c9b04(0x15c)](_0x18ddfa,_0x375da6[_0x2c9b04(0x1f0)]+_0x2c9b04(0x1c8));if(a150_0x2ff9d8['existsSync'](_0x2bb0ab)){const _0x4e20e3=parseExperimentalKnowledgeBaseYaml(a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x2bb0ab,_0x2c9b04(0x13b)),_0x2bb0ab),_0x483c8a=a150_0x5d2257[_0x2c9b04(0x15c)](_0x18ddfa,_0x2c9b04(0x180)),_0x30b926=[];if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x483c8a)){const _0x38f006=a150_0x2ff9d8[_0x2c9b04(0xe1)](_0x483c8a,{'withFileTypes':!![]});for(const _0x5a1143 of _0x38f006){if(!_0x5a1143[_0x2c9b04(0xf1)]())continue;const _0x511b88=a150_0x5d2257['join'](_0x483c8a,_0x5a1143['name']),_0x1fd858=a150_0x5d2257[_0x2c9b04(0x15c)](_0x511b88,_0x2c9b04(0x17e)),_0x2e9ee9=a150_0x5d2257[_0x2c9b04(0x15c)](_0x511b88,_0x2c9b04(0xe8));if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x1fd858)&&a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x2e9ee9)){const _0x3e831f=a150_0x2ff9d8['readFileSync'](_0x1fd858,_0x2c9b04(0x13b)),_0x5c9060=a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x2e9ee9,_0x2c9b04(0x13b));_0x30b926['push']({'name':_0x5a1143[_0x2c9b04(0x1f0)],'code':_0x3e831f,'json_schema':_0x5c9060});}}}const _0x5661c3={..._0x4e20e3,'functions':_0x30b926};_0xd38b49[_0x2c9b04(0x129)]({'name':_0x4e20e3[_0x2c9b04(0x1f0)],'path':_0x18ddfa,'def':_0x5661c3});}}}const _0x3d0904=getExperimentalArtifactsDir(_0x46f867);if(a150_0x2ff9d8['existsSync'](_0x3d0904)){const _0x2233ef=a150_0x2ff9d8[_0x2c9b04(0xe1)](_0x3d0904,{'withFileTypes':!![]});for(const _0x5d96c8 of _0x2233ef){if(!_0x5d96c8[_0x2c9b04(0xf1)]())continue;const _0x255f61=a150_0x5d2257[_0x2c9b04(0x15c)](_0x3d0904,_0x5d96c8[_0x2c9b04(0x1f0)]),_0x2f7742=a150_0x5d2257[_0x2c9b04(0x15c)](_0x255f61,_0x5d96c8[_0x2c9b04(0x1f0)]+_0x2c9b04(0x1c8));if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x2f7742)){const _0x34a877=parseExperimentalArtifactYaml(a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x2f7742,'utf-8'),_0x2f7742),_0x14ede3=a150_0x5d2257[_0x2c9b04(0x15c)](_0x255f61,'code.js'),_0x2439f3=a150_0x2ff9d8['existsSync'](_0x14ede3)?a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x14ede3,_0x2c9b04(0x13b)):'',_0x40f1e6=a150_0x5d2257[_0x2c9b04(0x15c)](_0x255f61,_0x2c9b04(0x14e)),_0x39dffc=[];if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x40f1e6)){const _0x373be4=a150_0x2ff9d8[_0x2c9b04(0xe1)](_0x40f1e6);for(const _0x2ca344 of _0x373be4){const _0x18caad=a150_0x5d2257[_0x2c9b04(0x15c)](_0x40f1e6,_0x2ca344);if(a150_0x2ff9d8[_0x2c9b04(0x1e5)](_0x18caad)[_0x2c9b04(0x122)]()){const _0x432c1b=a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x18caad,'utf-8');_0x39dffc[_0x2c9b04(0x129)]({'file_name':_0x2ca344,'text_content':_0x432c1b});}}}const _0x1fafa5={..._0x34a877,'code':_0x2439f3,'files':_0x39dffc};_0x50a324[_0x2c9b04(0x129)]({'name':_0x34a877[_0x2c9b04(0x1f0)],'path':_0x255f61,'def':_0x1fafa5});}}}const _0x152b8b=getFormInterfacesDir(_0x46f867);if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x152b8b)){const _0x2a2b86=a150_0x2ff9d8[_0x2c9b04(0xe1)](_0x152b8b)[_0x2c9b04(0x17a)](_0x4f9554=>_0x4f9554[_0x2c9b04(0x1b5)]('.yml'));for(const _0x29cb75 of _0x2a2b86){const _0x4be969=a150_0x5d2257[_0x2c9b04(0x15c)](_0x152b8b,_0x29cb75),_0x42030b=parseFormInterfaceYaml(a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x4be969,_0x2c9b04(0x13b)),_0x4be969);_0x3a770b[_0x2c9b04(0x129)]({'name':_0x42030b[_0x2c9b04(0x1f0)],'path':_0x4be969,'yaml':_0x42030b});}}const _0x5e297b=getChatInterfacesDir(_0x46f867);if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x5e297b)){const _0x5c2698=a150_0x2ff9d8['readdirSync'](_0x5e297b)['filter'](_0x4bc98c=>_0x4bc98c[_0x2c9b04(0x1b5)](_0x2c9b04(0x1c8)));for(const _0x343265 of _0x5c2698){const _0x3d18ba=a150_0x5d2257[_0x2c9b04(0x15c)](_0x5e297b,_0x343265),_0x4bd912=parseChatInterfaceYaml(a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x3d18ba,'utf-8'),_0x3d18ba);_0x92ad46['push']({'name':_0x4bd912[_0x2c9b04(0x1f0)],'path':_0x3d18ba,'yaml':_0x4bd912});}}}else{const _0x29c7da=await this[_0x2c9b04(0x133)](_0x46f867),_0x3a65aa=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x190)](_0x29c7da);_0x32c49c=_0x3a65aa[_0x2c9b04(0x196)][_0x2c9b04(0x1f0)];const _0x27c765=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x168)](_0x29c7da),_0x2075ac=await this['client']['listKnowledgeBases'](_0x29c7da),_0xc52df4=await this['client']['listTextKnowledgeBases'](_0x29c7da),_0x2cb829=await this['client']['listPrompts'](_0x29c7da),_0x281a29=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x177)](_0x29c7da),_0x319041=await safeListOrEmpty(()=>this[_0x2c9b04(0x1c6)][_0x2c9b04(0x1cc)](_0x29c7da)),_0x431739=await safeListOrEmpty(()=>this[_0x2c9b04(0x1c6)][_0x2c9b04(0x1af)](_0x29c7da)),_0x1ff5b8=new Map(),_0xb49eb6=new Map(),_0x5420d6=new Map(),_0x4e342a=new Map(),_0x1266cb=new Map(),_0x849b02=new Map();for(const _0x347096 of _0x2075ac){_0x1ff5b8[_0x2c9b04(0xeb)](_0x347096['id'],_0x347096['attributes'][_0x2c9b04(0x1f0)]);}for(const _0x4bdd8a of _0xc52df4){_0xb49eb6[_0x2c9b04(0xeb)](_0x4bdd8a['id'],_0x4bdd8a[_0x2c9b04(0x196)][_0x2c9b04(0x1f0)]);}for(const _0x19319a of _0x27c765){_0x5420d6['set'](_0x19319a['id'],_0x19319a[_0x2c9b04(0x196)][_0x2c9b04(0x1f0)]);}for(const _0x523fdf of _0x2cb829){_0x4e342a[_0x2c9b04(0xeb)](_0x523fdf['id'],_0x523fdf['attributes'][_0x2c9b04(0x1f0)]);}for(const _0x5f37c9 of _0x319041){_0x1266cb[_0x2c9b04(0xeb)](_0x5f37c9['id'],_0x5f37c9[_0x2c9b04(0x196)][_0x2c9b04(0x1f0)]);}for(const _0x2f37ee of _0x431739){_0x849b02[_0x2c9b04(0xeb)](_0x2f37ee['id'],_0x2f37ee[_0x2c9b04(0x196)][_0x2c9b04(0x1f0)]);}const _0x580ced={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x1ff5b8,'TextKnowledgeBase':_0xb49eb6,'Agent':_0x5420d6,'ExperimentalKnowledgeBase':_0x1266cb}),'resolvePromptName':async _0x1bd48f=>_0x4e342a['get'](_0x1bd48f),'onWarning':_0x2eaf9=>this[_0x2c9b04(0x1ad)][_0x2c9b04(0x1a5)](_0x2eaf9)};for(const _0x4352d4 of _0x27c765){const _0x5d6cc3=await agentResponseToDef(_0x4352d4,_0x580ced),{yaml:_0x43c3ea,systemPrompt:_0x498b38,starterMessage:_0x5886cb}=_0x5d6cc3;_0x2e2fbb[_0x2c9b04(0x129)]({'name':_0x43c3ea['name'],'dir':'','yaml':_0x43c3ea,'systemPrompt':_0x498b38,'starterMessage':_0x5886cb});}for(const _0x47b788 of _0x2075ac){const _0x54b932=apiKnowledgeBaseToYaml(_0x47b788);_0x51d757[_0x2c9b04(0x129)]({'name':_0x54b932[_0x2c9b04(0x1f0)],'path':'','yaml':_0x54b932});}for(const _0x122d88 of _0xc52df4){_0x15bc86[_0x2c9b04(0x129)]({'name':_0x122d88[_0x2c9b04(0x196)][_0x2c9b04(0x1f0)],'path':'','text':_0x122d88[_0x2c9b04(0x196)][_0x2c9b04(0x10f)]});}for(const _0x16507 of _0x2cb829){const _0x972b88=await apiPromptToYaml(_0x16507,_0x580ced);_0x972b88&&_0x3eff38['push']({'name':_0x972b88[_0x2c9b04(0x1f0)],'path':'','yaml':_0x972b88});}for(const _0x45442f of _0x281a29){if(!_0x45442f['attributes'][_0x2c9b04(0x1cf)]&&SAFE_INTEGRATION_TYPES[_0x2c9b04(0x1dd)](_0x45442f[_0x2c9b04(0x196)][_0x2c9b04(0x11a)][_0x2c9b04(0x10c)]())){const _0x26289e=await apiIntegrationToYaml(_0x45442f,_0x580ced);_0x489a48['push']({'name':_0x45442f[_0x2c9b04(0x196)][_0x2c9b04(0x11a)][_0x2c9b04(0x10c)](),'path':'','yaml':_0x26289e});}}for(const _0x80a341 of _0x319041){const _0x46f12a=apiExperimentalKnowledgeBaseToYaml(_0x80a341);_0xd38b49[_0x2c9b04(0x129)]({'name':_0x46f12a[_0x2c9b04(0x1f0)],'path':'','def':_0x46f12a});}for(const _0x268367 of _0x431739){const _0x332ed7=apiExperimentalArtifactToYaml(_0x268367);_0x50a324[_0x2c9b04(0x129)]({'name':_0x332ed7[_0x2c9b04(0x1f0)],'path':'','def':_0x332ed7});}const _0x485fb9=await safeListOrEmpty(()=>this['client']['listFormInterfaces'](_0x29c7da));for(const _0x565df7 of _0x485fb9){const _0x63d7dd=await apiFormInterfaceToYaml(_0x565df7,_0x580ced);_0x3a770b[_0x2c9b04(0x129)]({'name':_0x63d7dd[_0x2c9b04(0x1f0)],'path':'','yaml':_0x63d7dd});}const _0x113b4c=await safeListOrEmpty(()=>this[_0x2c9b04(0x1c6)][_0x2c9b04(0x1e2)](_0x29c7da));for(const _0x1ed224 of _0x113b4c){if(_0x1ed224[_0x2c9b04(0x196)][_0x2c9b04(0x1cf)])continue;const _0x3d0fc7=await apiChatInterfaceToYaml(_0x1ed224,_0x580ced);_0x92ad46[_0x2c9b04(0x129)]({'name':_0x3d0fc7['name'],'path':'','yaml':_0x3d0fc7});}}const _0x3672f9={'sourceProjectName':_0x32c49c,'newProjectName':_0x47bcc3,'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}}},_0x2e4408=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x1b7)](),_0xfe84f7=_0x2e4408[_0x2c9b04(0x1c5)](_0x43f9b=>_0x43f9b[_0x2c9b04(0x196)][_0x2c9b04(0x1f0)]===_0x47bcc3);if(_0xfe84f7)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x2c9b04(0x1e7)+_0x47bcc3+_0x2c9b04(0x11d),undefined,{'helpText':_0x2c9b04(0x1fe)});if(_0x5da8e5?.[_0x2c9b04(0x150)])return _0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x1c7)][_0x2c9b04(0x165)]=_0x2e2fbb['length'],_0x3672f9[_0x2c9b04(0x18d)]['knowledgeBases'][_0x2c9b04(0x165)]=_0x51d757[_0x2c9b04(0x1f5)],_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x1ae)][_0x2c9b04(0x165)]=_0x15bc86[_0x2c9b04(0x1f5)],_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x19a)]['created']=_0xd38b49[_0x2c9b04(0x1f5)],_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x1f9)][_0x2c9b04(0x165)]=_0x50a324[_0x2c9b04(0x1f5)],_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x187)]['created']=_0x3eff38[_0x2c9b04(0x1f5)],_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0xf8)][_0x2c9b04(0x165)]=_0x489a48['length'],_0x3672f9;const _0x116931=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0xfe)]({'name':_0x47bcc3}),_0x42556f=_0x116931['id'];_0x3672f9[_0x2c9b04(0x120)]=_0x42556f;const _0x3f0d0a=new Map(),_0xaa4d51=new Map(),_0x5ca989=new Map(),_0x4f824d=new Map(),_0x238428=new Map(),_0x27ecf9=new Map(),_0x4aa33c=new Map(),_0xf25e99=new Map(),_0x50201e=new Set(),_0x188358=new Set();for(const _0x293b6b of _0x2e2fbb){for(const _0x43c3ec of _0x293b6b['yaml'][_0x2c9b04(0x19b)]||[]){if(_0x43c3ec[_0x2c9b04(0x162)]==='image_gen'&&_0x43c3ec[_0x2c9b04(0x163)]){const _0x6e4239=parseRef(_0x43c3ec['target']);if(_0x6e4239)_0x50201e[_0x2c9b04(0x158)](_0x6e4239['name']);}else{if(_0x43c3ec[_0x2c9b04(0x162)]==='web_search'&&_0x43c3ec[_0x2c9b04(0x163)]){const _0x290321=parseRef(_0x43c3ec[_0x2c9b04(0x163)]);if(_0x290321)_0x188358[_0x2c9b04(0x158)](_0x290321[_0x2c9b04(0x1f0)]);}}}}for(const _0x279504 of _0x50201e){try{const _0x334b64=await this[_0x2c9b04(0x1c6)]['createImageGenerator']({'projectId':_0x42556f,'name':_0x279504});_0x238428[_0x2c9b04(0xeb)](_0x279504,_0x334b64['id']),_0x3672f9['imageGenerators'][_0x2c9b04(0x129)]({'name':_0x279504,'action':'created','id':_0x334b64['id']}),_0x3672f9['counts'][_0x2c9b04(0x151)][_0x2c9b04(0x165)]++;}catch(_0x455847){_0x3672f9['imageGenerators']['push']({'name':_0x279504,'action':_0x2c9b04(0x137),'error':_0x455847[_0x2c9b04(0xe2)]}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x151)][_0x2c9b04(0x14d)]++;}}for(const _0x29c229 of _0x188358){try{const _0x441da5=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x111)]({'projectId':_0x42556f,'name':_0x29c229});_0x27ecf9[_0x2c9b04(0xeb)](_0x29c229,_0x441da5['id']),_0x3672f9[_0x2c9b04(0x16f)][_0x2c9b04(0x129)]({'name':_0x29c229,'action':_0x2c9b04(0x165),'id':_0x441da5['id']}),_0x3672f9[_0x2c9b04(0x18d)]['webSearchTools'][_0x2c9b04(0x165)]++;}catch(_0x381dfd){_0x3672f9[_0x2c9b04(0x16f)][_0x2c9b04(0x129)]({'name':_0x29c229,'action':'error','error':_0x381dfd[_0x2c9b04(0xe2)]}),_0x3672f9['counts'][_0x2c9b04(0x16f)][_0x2c9b04(0x14d)]++;}}const _0x260b46=await fetchAllToolTargetMaps((_0x1c1b99,_0x17bdbd)=>this[_0x2c9b04(0x1c6)]['listToolTargets'](_0x1c1b99,_0x17bdbd),_0x42556f);let _0x45d014=[];const _0x489605={'projectId':_0x42556f,'resolveToolTargetId':buildIdResolver({..._0x260b46[_0x2c9b04(0x192)],'KnowledgeBase':_0x3f0d0a,'TextKnowledgeBase':_0xaa4d51,'ExperimentalKnowledgeBase':_0x4aa33c,'Agent':_0x5ca989,'WebSearchTool':_0x27ecf9,'ImageGenerator':_0x238428}),'resolvePromptId':async _0x6eafe2=>_0x4f824d[_0x2c9b04(0x15e)](_0x6eafe2),'onWarning':_0x5a8180=>{const _0x12d83d=_0x2c9b04;this[_0x12d83d(0x1ad)][_0x12d83d(0x1a5)](_0x5a8180),_0x45d014[_0x12d83d(0x129)](_0x5a8180);}};for(const _0x1b1f66 of _0x51d757){try{const _0x34d710=yamlKnowledgeBaseToApi(_0x1b1f66['yaml'],_0x42556f),_0x390a09=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x16b)](_0x34d710);_0x3f0d0a[_0x2c9b04(0xeb)](_0x1b1f66[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],_0x390a09['id']),_0x3672f9['knowledgeBases']['push']({'name':_0x1b1f66['yaml'][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x165),'id':_0x390a09['id']}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x15d)][_0x2c9b04(0x165)]++;}catch(_0xaf73dd){_0x3672f9['knowledgeBases'][_0x2c9b04(0x129)]({'name':_0x1b1f66['yaml'][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x137),'error':_0xaf73dd[_0x2c9b04(0xe2)]}),_0x3672f9['counts'][_0x2c9b04(0x15d)][_0x2c9b04(0x14d)]++;}}for(const _0x42ac95 of _0x15bc86){try{const _0x1efd1a=yamlTextKnowledgeBaseToApi({'name':_0x42ac95[_0x2c9b04(0x1f0)],'text':_0x42ac95[_0x2c9b04(0x10f)]},_0x42556f),_0x15d33a=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x156)](_0x1efd1a);_0xaa4d51['set'](_0x42ac95[_0x2c9b04(0x1f0)],_0x15d33a['id']),_0x3672f9[_0x2c9b04(0x1ae)][_0x2c9b04(0x129)]({'name':_0x42ac95['name'],'action':'created','id':_0x15d33a['id']}),_0x3672f9['counts'][_0x2c9b04(0x1ae)]['created']++;}catch(_0x5a451f){_0x3672f9[_0x2c9b04(0x1ae)][_0x2c9b04(0x129)]({'name':_0x42ac95[_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x137),'error':_0x5a451f[_0x2c9b04(0xe2)]}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x1ae)]['errors']++;}}for(const _0x2e0f25 of _0x50a324){try{const _0x7ad34b=yamlExperimentalArtifactToApi(_0x2e0f25[_0x2c9b04(0x169)],_0x42556f),_0x23075e=await this['client']['createExperimentalArtifact'](_0x7ad34b);_0xf25e99['set'](_0x2e0f25[_0x2c9b04(0x169)][_0x2c9b04(0x1f0)],_0x23075e['id']),_0x3672f9[_0x2c9b04(0x1f9)][_0x2c9b04(0x129)]({'name':_0x2e0f25[_0x2c9b04(0x169)][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x165),'id':_0x23075e['id']}),_0x3672f9[_0x2c9b04(0x18d)]['experimentalArtifacts'][_0x2c9b04(0x165)]++;}catch(_0x1a8878){_0x3672f9[_0x2c9b04(0x1f9)][_0x2c9b04(0x129)]({'name':_0x2e0f25[_0x2c9b04(0x169)]['name'],'action':'error','error':_0x1a8878[_0x2c9b04(0xe2)]}),_0x3672f9[_0x2c9b04(0x18d)]['experimentalArtifacts'][_0x2c9b04(0x14d)]++;}}for(const _0x60a45f of _0xd38b49){try{const _0x51d67b=yamlExperimentalKnowledgeBaseToApi(_0x60a45f['def'],_0x42556f),_0x5c7205=await this['client'][_0x2c9b04(0x182)](_0x51d67b);_0x4aa33c['set'](_0x60a45f['def'][_0x2c9b04(0x1f0)],_0x5c7205['id']),_0x3672f9[_0x2c9b04(0x19a)][_0x2c9b04(0x129)]({'name':_0x60a45f[_0x2c9b04(0x169)]['name'],'action':_0x2c9b04(0x165),'id':_0x5c7205['id']}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x19a)][_0x2c9b04(0x165)]++;}catch(_0xa693b1){_0x3672f9['experimentalKnowledgeBases'][_0x2c9b04(0x129)]({'name':_0x60a45f['def'][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x137),'error':_0xa693b1[_0x2c9b04(0xe2)]}),_0x3672f9[_0x2c9b04(0x18d)]['experimentalKnowledgeBases'][_0x2c9b04(0x14d)]++;}}const _0x160233=[..._0x2e2fbb][_0x2c9b04(0x1b3)]((_0x398f03,_0x1db46a)=>{const _0x19c8f8=_0x2c9b04,_0x57447b=_0x398f03[_0x19c8f8(0x10d)][_0x19c8f8(0x19b)]?.['some'](_0x3a3db0=>_0x3a3db0[_0x19c8f8(0x162)]===_0x19c8f8(0x15a))??![],_0x348e91=_0x1db46a['yaml'][_0x19c8f8(0x19b)]?.[_0x19c8f8(0x126)](_0x699e32=>_0x699e32[_0x19c8f8(0x162)]===_0x19c8f8(0x15a))??![];if(_0x57447b&&!_0x348e91)return 0x1;if(!_0x57447b&&_0x348e91)return-0x1;return 0x0;});for(const _0x3a29a6 of _0x160233){_0x45d014=[];try{const _0x50cb87=_0x3a29a6[_0x2c9b04(0x10d)][_0x2c9b04(0x19b)]?.[_0x2c9b04(0x17a)](_0x4282a3=>{const _0x1bdb62=_0x2c9b04;if(_0x4282a3[_0x1bdb62(0x162)]===_0x1bdb62(0x15a)&&_0x4282a3[_0x1bdb62(0x163)]){const _0x5500b6=parseRef(_0x4282a3[_0x1bdb62(0x163)]);return _0x5500b6?.[_0x1bdb62(0x1f0)]===_0x3a29a6['yaml']['name'];}return![];})??[];if(_0x50cb87['length']>0x0){const _0x2379aa=_0x2c9b04(0x13e)+_0x3a29a6[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)]+'\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20'+_0x2c9b04(0x164);this[_0x2c9b04(0x1ad)][_0x2c9b04(0x1a5)](_0x2379aa),_0x45d014[_0x2c9b04(0x129)](_0x2379aa);}const _0x22dda2=await agentDefToRequest(_0x3a29a6['yaml'],_0x3a29a6[_0x2c9b04(0x1d0)],_0x3a29a6[_0x2c9b04(0x1b1)],_0x489605),_0x4defb0=await this[_0x2c9b04(0x1c6)]['createAgentResponse'](_0x22dda2);_0x5ca989['set'](_0x3a29a6[_0x2c9b04(0x10d)]['name'],_0x4defb0['id']),_0x3672f9[_0x2c9b04(0x1c7)][_0x2c9b04(0x129)]({'agentName':_0x3a29a6[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x165),'agentId':_0x4defb0['id'],'warnings':_0x45d014[_0x2c9b04(0x1f5)]>0x0?_0x45d014:undefined}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x1c7)]['created']++;}catch(_0x3dde64){_0x3672f9[_0x2c9b04(0x1c7)][_0x2c9b04(0x129)]({'agentName':_0x3a29a6[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],'action':'error','error':_0x3dde64[_0x2c9b04(0xe2)],'warnings':_0x45d014[_0x2c9b04(0x1f5)]>0x0?_0x45d014:undefined}),_0x3672f9[_0x2c9b04(0x18d)]['agents'][_0x2c9b04(0x14d)]++;}}for(const _0x4752ba of _0x3eff38){try{const _0x4ec453=await yamlPromptToApi(_0x4752ba['yaml'],_0x42556f,_0x489605);if(!_0x4ec453){_0x3672f9[_0x2c9b04(0x187)][_0x2c9b04(0x129)]({'name':_0x4752ba[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],'action':'error','error':_0x2c9b04(0xf4)}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x187)][_0x2c9b04(0x14d)]++;continue;}const _0x55a70c=await this['client']['createPrompt'](_0x4ec453);_0x4f824d[_0x2c9b04(0xeb)](_0x4752ba[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],_0x55a70c['id']),_0x3672f9['prompts']['push']({'name':_0x4752ba[_0x2c9b04(0x10d)]['name'],'action':'created','id':_0x55a70c['id']}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x187)][_0x2c9b04(0x165)]++;}catch(_0x1ba811){_0x3672f9[_0x2c9b04(0x187)][_0x2c9b04(0x129)]({'name':_0x4752ba[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x137),'error':_0x1ba811[_0x2c9b04(0xe2)]}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x187)][_0x2c9b04(0x14d)]++;}}for(const _0xe93c6e of _0x489a48){try{const _0x11b544=await yamlIntegrationToApi(_0xe93c6e['yaml'],_0x42556f,_0x489605),_0x4e8c2e=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x113)](_0x11b544);_0x3672f9['integrations'][_0x2c9b04(0x129)]({'name':_0xe93c6e[_0x2c9b04(0x10d)]['service_type'],'action':_0x2c9b04(0x165),'id':_0x4e8c2e['id']}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0xf8)][_0x2c9b04(0x165)]++;}catch(_0x4c745a){_0x3672f9[_0x2c9b04(0xf8)][_0x2c9b04(0x129)]({'name':_0xe93c6e[_0x2c9b04(0x10d)][_0x2c9b04(0x12c)],'action':_0x2c9b04(0x137),'error':_0x4c745a[_0x2c9b04(0xe2)]}),_0x3672f9['counts'][_0x2c9b04(0xf8)]['errors']++;}}for(const _0x357def of _0x3a770b){try{const _0x121264=await yamlFormInterfaceToApi(_0x357def[_0x2c9b04(0x10d)],_0x42556f,_0x489605);if(!_0x121264){_0x3672f9[_0x2c9b04(0x1d4)]['push']({'name':_0x357def[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x137),'error':_0x2c9b04(0x143)}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x1d4)][_0x2c9b04(0x14d)]++;continue;}const _0x49b4a8=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x17d)](_0x121264);_0x3672f9['formInterfaces']['push']({'name':_0x357def['yaml'][_0x2c9b04(0x1f0)],'action':'created','id':_0x49b4a8['id']}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x1d4)][_0x2c9b04(0x165)]++;}catch(_0x114415){_0x3672f9['formInterfaces']['push']({'name':_0x357def[_0x2c9b04(0x10d)]['name'],'action':'error','error':_0x114415[_0x2c9b04(0xe2)]}),_0x3672f9['counts'][_0x2c9b04(0x1d4)][_0x2c9b04(0x14d)]++;}}for(const _0x37f187 of _0x92ad46){try{const _0x5b38fd=await yamlChatInterfaceToApi(_0x37f187['yaml'],_0x42556f,_0x489605),_0x1e5c75=await this[_0x2c9b04(0x1c6)]['createChatInterface'](_0x5b38fd);_0x3672f9[_0x2c9b04(0x1df)][_0x2c9b04(0x129)]({'name':_0x37f187[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x165),'id':_0x1e5c75['id']}),_0x3672f9[_0x2c9b04(0x18d)]['chatInterfaces'][_0x2c9b04(0x165)]++;}catch(_0xd79d24){_0x3672f9[_0x2c9b04(0x1df)]['push']({'name':_0x37f187[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x137),'error':_0xd79d24[_0x2c9b04(0xe2)]}),_0x3672f9['counts'][_0x2c9b04(0x1df)][_0x2c9b04(0x14d)]++;}}return _0x3672f9;}}
|
|
1
|
+
const a152_0x2f9e7b=a152_0x2d71;(function(_0x1debe5,_0x593a08){const _0x539acb=a152_0x2d71,_0x2bee3e=_0x1debe5();while(!![]){try{const _0x5a22ac=parseInt(_0x539acb(0x1e0))/0x1+parseInt(_0x539acb(0x18e))/0x2+parseInt(_0x539acb(0x1aa))/0x3+-parseInt(_0x539acb(0x160))/0x4*(-parseInt(_0x539acb(0x180))/0x5)+parseInt(_0x539acb(0x12b))/0x6+parseInt(_0x539acb(0x132))/0x7+-parseInt(_0x539acb(0x1d1))/0x8;if(_0x5a22ac===_0x593a08)break;else _0x2bee3e['push'](_0x2bee3e['shift']());}catch(_0x2a71eb){_0x2bee3e['push'](_0x2bee3e['shift']());}}}(a152_0x99c4,0x72912));import{LLMApiClient}from'../client/llm-api-client.js';import*as a152_0x265b9b from'node:fs';import*as a152_0x5cf51a from'node:path';import{HTTPClientError}from'../client/http-client.js';function a152_0x2d71(_0x4867d5,_0x6e43ed){_0x4867d5=_0x4867d5-0xce;const _0x99c42f=a152_0x99c4();let _0x2d7119=_0x99c42f[_0x4867d5];return _0x2d7119;}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';function a152_0x99c4(){const _0x3d0425=['modelType','chats','#\x20prompt.md\x0a','profile','Multiple\x20agents\x20found\x20with\x20name\x20\x27','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','Removed\x20deleted\x20directory:\x20','loadJsonFile','text_content','getChatHistory','startChat','ALREADY_EXISTS','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','files','createChatInterface','\x0a---\x20code\x20---\x0a','resolveProjectName','cwd','updated','mkdirSync','Renamed\x20experimental\x20KB\x20directory:\x20','promptId','endsWith','content','knowledgeBases','new','814470ImnzeP','chat_interfaces','map','UNAUTHENTICATED','temperature','listPrompts','textKnowledgeBases','232862bKYPvk','prompt.md','Multiple\x20projects\x20found\x20with\x20name\x20\x27','tables','Renamed\x20KB\x20file:\x20','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','agent.yml','integrations.json','agents.json','tdx_','resolveProjectId','low','\x20in\x20project\x20','agent.yml\x20not\x20found\x20in\x20','clearDefaultAgent','getChatInfo','dryRun','No\x20tdx.json\x20found\x20in\x20','Agent\x20not\x20found:\x20','Renamed\x20text\x20KB\x20file:\x20','currentProjectId','chat','type','INTERNAL','includes','total','tdx_default_','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','listWebSearchTools','getProject','updateChatInterface','experimental_knowledge_bases','):\x20','medium','deleteProject','experimentalKnowledgeBases','updateKnowledgeBase','functions','project','tools','isManaged','createAgentResponse','readdirSync','ExperimentalKnowledgeBase','createPrompt','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','3484cMFHZv','AGENT_NOT_FOUND','Renamed\x20prompt\x20file:\x20','serviceType','(dry-run)','path','prompts','updatePrompt','starter_message','already\x20exists','chatIgnoreManagedActions','createExperimentalArtifact','updateFormInterface','description','exportedFrom','listChatInterfaces','get','systemPrompt','metadata','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','\x27\x20(','Project\x20not\x20found:\x20','listAgentsFull','push','llm_project','pullAgent','isDir','context','tdDatabaseName','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','parse','Renamed\x20experimental\x20artifact\x20directory:\x20','4915BniMGU','agent','webhookCorsOrigins','continueChat','experimental_artifacts','filter','createAgent','resolveAgentId','minimal','nameToId','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','\x0a\x0a#\x20agent.yml\x0a','tdx.json','json_schema','1828888Mmjjfy','find','localeCompare','Renamed\x20agent\x20folder:\x20','length','jsonSchemaHint','getBackupMetadata','text','toLowerCase','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.','.md','web_search','version','isDirectory','agentId','existsSync','some','\x20→\x20','image_gen','split','dir','listIntegrations','getDefaultAgent','agents','yaml','Unresolved\x20dependencies:\x20','createImageGenerator','client','886263UTkmPs','project.json','set','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','1.0','formInterfaces','updateExperimentalKnowledgeBase','none','basename','Only\x20safe\x20types\x20(','listFormInterfaces','event','projects','chatWelcomeMessage','createExperimentalKnowledgeBase','conflict','listToolTargets','message','def','listExperimentalKnowledgeBases','\x20---\x0a','knowledgebases.json','unchanged','starter_message.md','readFileSync','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','stringify','cloneProject','integrations','PERMISSION_DENIED','unlinkSync','imageGenerators','projectId','INVALID_ARGUMENT','Unsupported\x20backup\x20version:\x20','updateAgent','isFile','error','info','17809032aDhtXp','knowledge_bases','listKnowledgeBases','.yml','idToName','sort','setDefaultAgent','reasoningEffort','LLM_PROJECT_NOT_FOUND','getOrCreateDefaultProject','template','listChats','keys','form_interfaces','has','460326JbtGBa','chat_generic','listAgents','service_type','TextKnowledgeBase','name','sdk.llm','target','Skipping\x20integration\x20\x27','writeFileSync','Project\x20\x22','---\x20file:\x20','join','counts','utf-8','Output\x20directory\x20already\x20exists:\x20','createKnowledgeBase','add','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','errors','created','createTextKnowledgeBase','createWebSearchTool','logger','getAgent','status','toISOString','attributes','Removed\x20deleted\x20file:\x20','Agent\x20reference\x20not\x20found','variables','\x27.\x20This\x20should\x20not\x20happen.','actions','listProjects','code','chat_parent_segment','\x0a---\x20schema:\x20','starterMessage','Could\x20not\x20resolve\x20agent\x20reference','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','Renamed\x20chat\x20interface\x20file:\x20','updateAgentResponse','\x0a---\x20function:\x20','prompts.json','restoreProject','renamed','code.js','createFormInterface','experimentalArtifacts','json_schema.json','agentsFull','warn','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','claude-4.5-sonnet','createProject','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','site','chatInterfaces','getUserSettings','file_name','models','webSearchTools','statSync','NOT_FOUND','getChatLog','size','Renamed\x20folder:\x20','listTextKnowledgeBases','---\x20schema:\x20','listExperimentalArtifacts','dirname','Backup\x20folder\x20not\x20found:\x20','outputs','getCurrentProject','getDefaultProjectName','deleteAgent','newProjectId','createIntegration','oldPath',')\x20can\x20be\x20pushed.\x20'];a152_0x99c4=function(){return _0x3d0425;};return a152_0x99c4();}export const SAFE_INTEGRATION_TYPES=[a152_0x2f9e7b(0x1e1),'chat_agent_console',a152_0x2f9e7b(0xe4)];async function safeListOrEmpty(_0x6c81d4){const _0x5530ba=a152_0x2f9e7b;try{return await _0x6c81d4();}catch(_0x38ebb3){if(_0x38ebb3 instanceof HTTPClientError&&_0x38ebb3[_0x5530ba(0xda)]===0x194)return[];throw _0x38ebb3;}}export class LLMSDK{[a152_0x2f9e7b(0x146)];['client'];['context'];['logger']=Logger['of'](a152_0x2f9e7b(0x1e6));constructor(_0x1ba6a0){const _0x20f874=a152_0x2f9e7b;this[_0x20f874(0x1a9)]=new LLMApiClient(_0x1ba6a0),this[_0x20f874(0x17b)]=_0x1ba6a0;}['getDefaultProjectName'](){const _0x5c1805=a152_0x2f9e7b,_0x38fc78=getSanitizedUsername();return _0x5c1805(0x14c)+_0x38fc78;}async['setCurrentProject'](_0x538070){const _0x2f8589=a152_0x2f9e7b,{projectId:_0x1df11d}=await this[_0x2f8589(0x121)](_0x538070);this[_0x2f8589(0x146)]=_0x1df11d;}[a152_0x2f9e7b(0x10a)](){const _0x145e08=a152_0x2f9e7b;return this[_0x145e08(0x146)];}async[a152_0x2f9e7b(0x1d7)](_0x18d2a7){const _0x507208=a152_0x2f9e7b,_0x411aec=this[_0x507208(0x17b)][_0x507208(0x114)];let _0x3c87e1,_0x3b2509;if(_0x18d2a7['includes']('/')){const _0x379287=_0x18d2a7[_0x507208(0x1a1)]('/');if(_0x379287['length']!==0x2)throw new SDKError(ErrorCode[_0x507208(0x1cb)],'Invalid\x20agent\x20reference\x20format:\x20'+_0x18d2a7,undefined,{'helpText':'Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22'});const [_0x39bc0f,_0x5921a2]=_0x379287;_0x3c87e1=await this[_0x507208(0x13c)](_0x39bc0f),_0x3b2509=_0x5921a2;}else _0x3c87e1=this[_0x507208(0x146)]||(await this[_0x507208(0x1da)]())['id'],_0x3b2509=_0x18d2a7;const _0x351e6d=await this[_0x507208(0x187)](_0x3b2509,_0x3c87e1),_0x5dcc6f=await this[_0x507208(0x1a9)][_0x507208(0xd9)](_0x351e6d);writeCachedLLMAgent(_0x5dcc6f['attributes'][_0x507208(0x1e5)],_0x351e6d,_0x3c87e1,_0x411aec);}[a152_0x2f9e7b(0x1a4)](){const _0x3ed307=a152_0x2f9e7b,_0x11200b=this['context'][_0x3ed307(0x114)];return readCachedLLMAgent(_0x11200b)||undefined;}[a152_0x2f9e7b(0x140)](){const _0x3f6f57=a152_0x2f9e7b,_0x180706=this[_0x3f6f57(0x17b)][_0x3f6f57(0x114)];clearCachedLLMAgent(_0x180706);}async[a152_0x2f9e7b(0xfd)](){const _0x5d8f4f=a152_0x2f9e7b,_0x5c9524=await this[_0x5d8f4f(0x1a9)][_0x5d8f4f(0xfb)]();return toModelInfos(_0x5c9524);}async[a152_0x2f9e7b(0xf7)](_0x53ccac){const _0xe6dee6=a152_0x2f9e7b;return await this['client'][_0xe6dee6(0xf7)](_0x53ccac);}async['deleteProject'](_0xb2a48){const _0x36d56c=a152_0x2f9e7b,{projectId:_0x4f8085}=await this['resolveProjectName'](_0xb2a48);await this['client'][_0x36d56c(0x154)](_0x4f8085);}async[a152_0x2f9e7b(0x1b6)](_0x4f8872=0x32){const _0x4b0df6=a152_0x2f9e7b;return await this[_0x4b0df6(0x1a9)]['listProjects'](_0x4f8872);}async[a152_0x2f9e7b(0x1da)](_0x4269d9){const _0x47ac65=a152_0x2f9e7b,_0x298127=_0x4269d9||this[_0x47ac65(0x10b)](),_0x48a335=this[_0x47ac65(0x17b)][_0x47ac65(0x114)];if(!_0x4269d9){const _0x86eb93=readCachedLLMProject(_0x48a335);if(_0x86eb93&&_0x86eb93['name']===_0x298127)try{const _0x3e546d=await this[_0x47ac65(0x1a9)][_0x47ac65(0x14f)](_0x86eb93['id']);if(_0x3e546d[_0x47ac65(0xdc)][_0x47ac65(0x1e5)]===_0x298127)return _0x3e546d;}catch{}}const _0x2ba08c=await this['client'][_0x47ac65(0xe2)](),_0x543676=_0x2ba08c[_0x47ac65(0x18f)](_0x1e9b5b=>_0x1e9b5b[_0x47ac65(0xdc)][_0x47ac65(0x1e5)]===_0x298127);if(_0x543676)return!_0x4269d9&&writeCachedLLMProject(_0x298127,_0x543676['id'],_0x48a335),_0x543676;const _0xfae246=await this[_0x47ac65(0x1a9)]['createProject']({'name':_0x298127,'description':'Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20'+getSanitizedUsername()+')'});return!_0x4269d9&&writeCachedLLMProject(_0x298127,_0xfae246['id'],_0x48a335),_0xfae246;}async[a152_0x2f9e7b(0x13c)](_0x21042d){const _0x37429c=a152_0x2f9e7b,_0x56df0f=await this[_0x37429c(0x1a9)]['listProjects'](),_0x23e773=_0x56df0f['filter'](_0x342699=>_0x342699[_0x37429c(0xdc)][_0x37429c(0x1e5)]===_0x21042d);if(_0x23e773[_0x37429c(0x192)]===0x0)throw new SDKError(ErrorCode[_0x37429c(0x1d9)],_0x37429c(0x175)+_0x21042d,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x23e773[_0x37429c(0x192)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x37429c(0x134)+_0x21042d+_0x37429c(0xe0));return _0x23e773[0x0]['id'];}async[a152_0x2f9e7b(0x121)](_0x111f29){const _0x207843=a152_0x2f9e7b,_0x339c82=await this[_0x207843(0x1a9)][_0x207843(0xe2)](),_0x1f081a=_0x339c82[_0x207843(0x18f)](_0x50d17f=>_0x50d17f[_0x207843(0xdc)][_0x207843(0x1e5)]===_0x111f29);if(_0x1f081a)return{'projectId':_0x1f081a['id'],'project':_0x1f081a};throw new SDKError(ErrorCode[_0x207843(0x1d9)],_0x207843(0x175)+_0x111f29,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async['getOrCreateDefaultAgent'](_0x6415b2=a152_0x2f9e7b(0xf6),_0x59f415=0x0,_0x399761){const _0x8a0445=a152_0x2f9e7b,_0x2c96ac=0xa;let _0x1e83c6=0x0,_0x5ce7f0;while(_0x1e83c6<_0x2c96ac){try{const _0x547315=await this['getOrCreateDefaultProject'](_0x5ce7f0),_0x467a8d=_0x547315['id'],_0x59e163=[_0x8a0445(0x1b1),_0x8a0445(0x188),_0x8a0445(0x13d),_0x8a0445(0x153),'high'],_0x5082d2=_0x59f415===0x0?_0x8a0445(0x13b)+_0x6415b2:_0x8a0445(0x13b)+_0x6415b2+'_reasoning_'+_0x59e163[_0x59f415],_0xde7b2b=await this[_0x8a0445(0x1a9)][_0x8a0445(0x1e2)](_0x467a8d),_0x2eba8f=_0xde7b2b[_0x8a0445(0x18f)](_0x823a4e=>_0x823a4e[_0x8a0445(0xdc)][_0x8a0445(0x1e5)]===_0x5082d2);if(_0x2eba8f)return _0x2eba8f;const _0x14a6ea=_0x59f415>0x0?0x1:_0x399761;return await this[_0x8a0445(0x1a9)]['createAgent']({'name':_0x5082d2,'projectId':_0x467a8d,'modelType':_0x6415b2,'systemPrompt':'','temperature':_0x14a6ea,'reasoningEffort':_0x59f415>0x0?_0x59f415:undefined});}catch(_0x27c773){if(_0x27c773 instanceof HTTPClientError){const _0x5c1807=_0x27c773[_0x8a0445(0xda)];if(_0x5c1807>=0x190&&_0x5c1807<0x1f4){if(_0x5c1807===0x191)throw new SDKError(ErrorCode[_0x8a0445(0x12e)],_0x8a0445(0x1ad),_0x27c773);else{if(_0x5c1807===0x193)throw new SDKError(ErrorCode[_0x8a0445(0x1c7)],_0x8a0445(0x11d),_0x27c773);}throw _0x27c773;}}if(errorContains(_0x27c773,_0x8a0445(0x169),'duplicate',_0x8a0445(0x1b9))){_0x1e83c6++;if(_0x1e83c6>=_0x2c96ac)throw new SDKError(ErrorCode[_0x8a0445(0x11c)],'Unable\x20to\x20create\x20project\x20after\x20'+_0x2c96ac+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x27c773);const _0x759aa9=this['getDefaultProjectName']();_0x5ce7f0=_0x759aa9+'_'+generateRandomHex();continue;}throw _0x27c773;}}throw new SDKError(ErrorCode[_0x8a0445(0x149)],_0x8a0445(0x116));}async[a152_0x2f9e7b(0x187)](_0x4ec02b,_0x474619){const _0x5030a4=a152_0x2f9e7b,_0x29fd40=_0x474619||this['currentProjectId'],_0xb3badf=await this[_0x5030a4(0x1a9)][_0x5030a4(0x1e2)](_0x29fd40),_0x35fc1d=_0xb3badf[_0x5030a4(0x185)](_0x20b3b0=>_0x20b3b0[_0x5030a4(0xdc)][_0x5030a4(0x1e5)]===_0x4ec02b);if(_0x35fc1d['length']===0x0){const _0x2e25d6=_0x29fd40?_0x5030a4(0x13e)+_0x29fd40:'';throw new SDKError(ErrorCode[_0x5030a4(0x161)],'Agent\x20not\x20found:\x20'+_0x4ec02b+_0x2e25d6,undefined,{'helpText':_0x29fd40?_0x5030a4(0x14d):_0x5030a4(0x197)});}if(_0x35fc1d[_0x5030a4(0x192)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x5030a4(0x115)+_0x4ec02b+'\x27.\x20This\x20should\x20not\x20happen.');return _0x35fc1d[0x0]['id'];}async['agents'](_0x18c609){const _0x5844c0=a152_0x2f9e7b,_0x3e8d68=_0x18c609||this[_0x5844c0(0x146)];return await this[_0x5844c0(0x1a9)][_0x5844c0(0x1e2)](_0x3e8d68);}async[a152_0x2f9e7b(0xf3)](_0x8f7f38){const _0x5650ca=a152_0x2f9e7b;return await this[_0x5650ca(0x1a9)][_0x5650ca(0x176)](_0x8f7f38);}async['agent'](_0x432649){const _0x44e5f6=a152_0x2f9e7b;return await this[_0x44e5f6(0x1a9)]['getAgent'](_0x432649);}async[a152_0x2f9e7b(0x186)](_0x1f98eb){const _0x54b619=a152_0x2f9e7b;return await this[_0x54b619(0x1a9)][_0x54b619(0x186)](_0x1f98eb);}async[a152_0x2f9e7b(0x1cd)](_0x2decfc,_0x37825e){const _0x305df6=a152_0x2f9e7b;return await this['client'][_0x305df6(0x1cd)](_0x2decfc,_0x37825e);}async[a152_0x2f9e7b(0x10c)](_0x35b13b){const _0x42707a=a152_0x2f9e7b;await this[_0x42707a(0x1a9)]['deleteAgent'](_0x35b13b);}async['startChat'](_0x52b0c2){const _0x25449d=a152_0x2f9e7b;return await this[_0x25449d(0x1a9)][_0x25449d(0x11b)]({'agentId':_0x52b0c2});}async*[a152_0x2f9e7b(0x147)](_0x263b7a,_0x2716bf){const _0x474b0f=a152_0x2f9e7b;let _0x220612=_0x2716bf?.['chatId'];const _0x3c39c7=_0x2716bf?.[_0x474b0f(0x19c)];if(!_0x220612){if(!_0x3c39c7)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0xcbea79=await this[_0x474b0f(0x1a9)][_0x474b0f(0x11b)]({'agentId':_0x3c39c7});_0x220612=_0xcbea79['id'],yield{'type':_0x474b0f(0x172),'data':{'chatId':_0x220612,'agentId':_0x3c39c7,'projectId':_0xcbea79[_0x474b0f(0xdc)][_0x474b0f(0x1ca)]}};}for await(const _0x5ef8e4 of this['client'][_0x474b0f(0x183)](_0x220612,_0x263b7a,_0x2716bf?.['signal'])){yield{'type':_0x474b0f(0x1b5),'data':_0x5ef8e4};}}async[a152_0x2f9e7b(0x112)](_0x2a96b1=0x32){const _0x21b39a=a152_0x2f9e7b;return await this[_0x21b39a(0x1a9)][_0x21b39a(0x1dc)](_0x2a96b1);}async['history'](_0x1f70e8){const _0x165af2=a152_0x2f9e7b;return await this[_0x165af2(0x1a9)][_0x165af2(0x11a)](_0x1f70e8);}async[a152_0x2f9e7b(0x101)](_0x451581){const _0x3b1474=a152_0x2f9e7b;return await this[_0x3b1474(0x1a9)][_0x3b1474(0x101)](_0x451581);}async['chatInfo'](_0x548f4b){const _0x17156=a152_0x2f9e7b;return await this['client'][_0x17156(0x141)](_0x548f4b);}async['backupProject'](_0x1c945a,_0xbc5a8e,_0x9f5d3f){const _0x1eb261=a152_0x2f9e7b,_0x356055=_0x9f5d3f?.['dryRun']??![],{projectId:_0x3ee3fd,project:_0x16a226}=await this[_0x1eb261(0x121)](_0x1c945a),_0x52eaa=_0x16a226['attributes'][_0x1eb261(0x1e5)],_0x1b39aa=_0xbc5a8e||_0x52eaa+'.llm';if(a152_0x265b9b[_0x1eb261(0x19d)](_0x1b39aa)&&!_0x356055)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x1eb261(0xd0)+_0x1b39aa,undefined,{'helpText':'Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.'});const _0x5da159=await this[_0x1eb261(0x1a9)][_0x1eb261(0x176)](_0x3ee3fd),_0x2409dc=await this[_0x1eb261(0x1a9)][_0x1eb261(0x1d3)](_0x3ee3fd),_0x1a6cbb=await this[_0x1eb261(0x1a9)]['listPrompts'](_0x3ee3fd),_0x1cf639=await this[_0x1eb261(0x1a9)]['listIntegrations'](_0x3ee3fd);if(!_0x356055){a152_0x265b9b[_0x1eb261(0x124)](_0x1b39aa,{'recursive':!![]});const _0x1903a8={'version':_0x1eb261(0x1ae),'exportedAt':new Date()[_0x1eb261(0xdb)](),'exportedFrom':{'site':this[_0x1eb261(0x17b)][_0x1eb261(0xf9)],'projectId':_0x3ee3fd,'projectName':_0x52eaa},'project':_0x16a226};a152_0x265b9b[_0x1eb261(0x1e9)](a152_0x5cf51a['join'](_0x1b39aa,_0x1eb261(0x1ab)),JSON[_0x1eb261(0x1c4)](_0x1903a8,null,0x2)),a152_0x265b9b[_0x1eb261(0x1e9)](a152_0x5cf51a[_0x1eb261(0x1ec)](_0x1b39aa,'agents.json'),JSON[_0x1eb261(0x1c4)](_0x5da159,null,0x2)),a152_0x265b9b[_0x1eb261(0x1e9)](a152_0x5cf51a[_0x1eb261(0x1ec)](_0x1b39aa,_0x1eb261(0x1bf)),JSON[_0x1eb261(0x1c4)](_0x2409dc,null,0x2)),a152_0x265b9b[_0x1eb261(0x1e9)](a152_0x5cf51a[_0x1eb261(0x1ec)](_0x1b39aa,'prompts.json'),JSON[_0x1eb261(0x1c4)](_0x1a6cbb,null,0x2)),a152_0x265b9b['writeFileSync'](a152_0x5cf51a['join'](_0x1b39aa,_0x1eb261(0x139)),JSON[_0x1eb261(0x1c4)](_0x1cf639,null,0x2));}return{'projectName':_0x52eaa,'outputDir':_0x1b39aa,'counts':{'agents':_0x5da159[_0x1eb261(0x192)],'knowledgeBases':_0x2409dc['length'],'prompts':_0x1a6cbb[_0x1eb261(0x192)],'integrations':_0x1cf639['length']}};}async[a152_0x2f9e7b(0xed)](_0x222349,_0x156178){const _0xb51e6e=a152_0x2f9e7b,_0x47cfb0=_0x156178?.['dryRun']??![],_0x47e3e6=this[_0xb51e6e(0x194)](_0x222349),_0x3e108b=_0x47e3e6[_0xb51e6e(0x16e)][_0xb51e6e(0xf9)],_0x18d407=this[_0xb51e6e(0x17b)][_0xb51e6e(0xf9)],_0xa4413b=_0x3e108b!==_0x18d407?_0x3e108b:undefined,_0x27a08d=this[_0xb51e6e(0x118)](a152_0x5cf51a['join'](_0x222349,_0xb51e6e(0x13a)),[]),_0x23dd3e=this[_0xb51e6e(0x118)](a152_0x5cf51a[_0xb51e6e(0x1ec)](_0x222349,_0xb51e6e(0x1bf)),[]),_0x3efacc=this[_0xb51e6e(0x118)](a152_0x5cf51a[_0xb51e6e(0x1ec)](_0x222349,_0xb51e6e(0xec)),[]),_0x4ea341=this['loadJsonFile'](a152_0x5cf51a['join'](_0x222349,_0xb51e6e(0x139)),[]),_0x3db398=_0x156178?.['name']||_0x47e3e6[_0xb51e6e(0x16e)]['projectName'];if(_0x47cfb0){const _0x1ada09=new Map(),_0x47f92d=[..._0x27a08d],_0x592aa0=_0x27a08d[_0xb51e6e(0x192)]+0x1;let _0x980c4b=0x0;while(_0x47f92d[_0xb51e6e(0x192)]>0x0&&_0x980c4b<_0x592aa0){_0x980c4b++;const _0x23ad63=[];for(const _0x43c4c2 of _0x47f92d){canCreateAgent(_0x43c4c2,_0x1ada09)?_0x1ada09[_0xb51e6e(0x1ac)](_0x43c4c2['id'],'dry-run-'+_0x43c4c2['id']):_0x23ad63[_0xb51e6e(0x177)](_0x43c4c2);}if(_0x23ad63[_0xb51e6e(0x192)]===_0x47f92d['length'])throw new SDKError(ErrorCode[_0xb51e6e(0x149)],_0xb51e6e(0x18a),undefined,{'helpText':_0xb51e6e(0xf5)});_0x47f92d[_0xb51e6e(0x192)]=0x0,_0x47f92d[_0xb51e6e(0x177)](..._0x23ad63);}const _0x2fc34a=_0x3efacc[_0xb51e6e(0x185)](_0x38c1c2=>_0x1ada09[_0xb51e6e(0x1df)](_0x38c1c2[_0xb51e6e(0xdc)][_0xb51e6e(0x19c)]))['length'];return{'projectName':_0x3db398,'projectId':_0xb51e6e(0x164),'counts':{'agents':_0x27a08d['length'],'knowledgeBases':_0x23dd3e[_0xb51e6e(0x192)],'prompts':_0x2fc34a,'integrations':_0x4ea341[_0xb51e6e(0x192)]},'sourceSite':_0xa4413b};}const _0x296931=await this[_0xb51e6e(0x1a9)]['createProject']({'name':_0x3db398,'description':_0x47e3e6[_0xb51e6e(0x158)][_0xb51e6e(0xdc)][_0xb51e6e(0x16d)]}),_0x1c8ccf=_0x296931['id'],_0x46a6f9=new Map(),_0x5d049c=new Map(),_0x1265ed=new Map();for(const _0x41c223 of _0x23dd3e){const _0x32da5c=await this[_0xb51e6e(0x1a9)]['createKnowledgeBase']({'projectId':_0x1c8ccf,'name':_0x41c223[_0xb51e6e(0xdc)]['name'],'tdDatabaseName':_0x41c223[_0xb51e6e(0xdc)][_0xb51e6e(0x17c)],'tables':_0x41c223[_0xb51e6e(0xdc)][_0xb51e6e(0x135)]});_0x46a6f9[_0xb51e6e(0x1ac)](_0x41c223['id'],_0x32da5c['id']);}const _0x43c7de=[..._0x27a08d],_0x33c4d8=_0x27a08d[_0xb51e6e(0x192)]+0x1;let _0x5398ef=0x0;while(_0x43c7de[_0xb51e6e(0x192)]>0x0&&_0x5398ef<_0x33c4d8){_0x5398ef++;const _0xf27048=[];for(const _0x2e414e of _0x43c7de){if(canCreateAgent(_0x2e414e,_0x5d049c)){const _0x35f478=remapToolIds(_0x2e414e['attributes'][_0xb51e6e(0x159)],_0x46a6f9,_0x5d049c),_0x5e8e75=remapVariableIds(_0x2e414e['attributes']['variables'],_0x46a6f9),_0x37cbb4=await this['client'][_0xb51e6e(0x15b)]({'name':_0x2e414e['attributes']['name'],'projectId':_0x1c8ccf,'systemPrompt':_0x2e414e['attributes'][_0xb51e6e(0x171)],'starterMessage':_0x2e414e[_0xb51e6e(0xdc)][_0xb51e6e(0xe6)],'modelType':migrateModelType(_0x2e414e[_0xb51e6e(0xdc)][_0xb51e6e(0x111)]),'maxToolIterations':_0x2e414e[_0xb51e6e(0xdc)]['maxToolIterations'],'temperature':_0x2e414e[_0xb51e6e(0xdc)][_0xb51e6e(0x12f)],'reasoningEffort':_0x2e414e[_0xb51e6e(0xdc)][_0xb51e6e(0x1d8)],'outputs':_0x2e414e[_0xb51e6e(0xdc)][_0xb51e6e(0x109)],'tools':_0x35f478,'variables':_0x5e8e75});_0x5d049c[_0xb51e6e(0x1ac)](_0x2e414e['id'],_0x37cbb4['id']);}else _0xf27048[_0xb51e6e(0x177)](_0x2e414e);}if(_0xf27048[_0xb51e6e(0x192)]===_0x43c7de[_0xb51e6e(0x192)])throw new SDKError(ErrorCode[_0xb51e6e(0x149)],_0xb51e6e(0x18a),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x43c7de[_0xb51e6e(0x192)]=0x0,_0x43c7de[_0xb51e6e(0x177)](..._0xf27048);}for(const _0x43d851 of _0x3efacc){const _0x1ea300=_0x5d049c[_0xb51e6e(0x170)](_0x43d851['attributes']['agentId']);if(!_0x1ea300)continue;const _0x366374=await this[_0xb51e6e(0x1a9)][_0xb51e6e(0x15e)]({'projectId':_0x1c8ccf,'agentId':_0x1ea300,'name':_0x43d851[_0xb51e6e(0xdc)][_0xb51e6e(0x1e5)],'systemPrompt':_0x43d851[_0xb51e6e(0xdc)]['systemPrompt'],'template':_0x43d851[_0xb51e6e(0xdc)][_0xb51e6e(0x1db)],'jsonSchemaHint':_0x43d851[_0xb51e6e(0xdc)][_0xb51e6e(0x193)]});_0x1265ed[_0xb51e6e(0x1ac)](_0x43d851['id'],_0x366374['id']);}for(const _0x2de4cd of _0x4ea341){const _0x27f5a7=_0x2de4cd[_0xb51e6e(0xdc)][_0xb51e6e(0xe1)][_0xb51e6e(0x12d)](_0x465219=>({..._0x465219,'promptId':_0x1265ed[_0xb51e6e(0x170)](_0x465219[_0xb51e6e(0x126)])||_0x465219[_0xb51e6e(0x126)]}));await this[_0xb51e6e(0x1a9)][_0xb51e6e(0x10e)]({'projectId':_0x1c8ccf,'serviceType':_0x2de4cd['attributes']['serviceType'],'actions':_0x27f5a7,'slackMessageMode':_0x2de4cd[_0xb51e6e(0xdc)]['slackMessageMode'],'chatIgnoreManagedActions':_0x2de4cd[_0xb51e6e(0xdc)][_0xb51e6e(0x16a)],'chatWelcomeMessage':_0x2de4cd[_0xb51e6e(0xdc)][_0xb51e6e(0x1b7)],'webhookCorsOrigins':_0x2de4cd[_0xb51e6e(0xdc)][_0xb51e6e(0x182)]});}return{'projectName':_0x3db398,'projectId':_0x1c8ccf,'counts':{'agents':_0x5d049c[_0xb51e6e(0x102)],'knowledgeBases':_0x46a6f9[_0xb51e6e(0x102)],'prompts':_0x1265ed[_0xb51e6e(0x102)],'integrations':_0x4ea341['length']},'sourceSite':_0xa4413b};}[a152_0x2f9e7b(0x118)](_0x473773,_0x10856){const _0x22e238=a152_0x2f9e7b;if(!a152_0x265b9b[_0x22e238(0x19d)](_0x473773))return _0x10856;return JSON[_0x22e238(0x17e)](a152_0x265b9b[_0x22e238(0x1c2)](_0x473773,'utf-8'));}[a152_0x2f9e7b(0x194)](_0x50840a){const _0x469fb6=a152_0x2f9e7b;if(!a152_0x265b9b['existsSync'](_0x50840a))throw new SDKError(ErrorCode[_0x469fb6(0x100)],_0x469fb6(0x108)+_0x50840a,undefined,{'helpText':'Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.'});const _0x46589d=a152_0x5cf51a['join'](_0x50840a,_0x469fb6(0x1ab));if(!a152_0x265b9b[_0x469fb6(0x19d)](_0x46589d))throw new SDKError(ErrorCode[_0x469fb6(0x1cb)],'Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20'+_0x50840a,undefined,{'helpText':_0x469fb6(0xf8)});const _0x1ed087=JSON['parse'](a152_0x265b9b[_0x469fb6(0x1c2)](_0x46589d,_0x469fb6(0xcf)));if(!isSupportedBackupVersion(_0x1ed087[_0x469fb6(0x19a)]))throw new SDKError(ErrorCode[_0x469fb6(0x1cb)],_0x469fb6(0x1cc)+_0x1ed087[_0x469fb6(0x19a)],undefined,{'helpText':_0x469fb6(0x173)});return _0x1ed087;}async['pullProject'](_0x59625c,_0x22dbe9,_0xd45fa4){const _0xce7772=a152_0x2f9e7b,{projectId:_0x4fc811,project:_0x23b0df}=await this[_0xce7772(0x121)](_0x59625c),_0x4e9d60=_0x23b0df[_0xce7772(0xdc)][_0xce7772(0x1e5)];let _0x204d6e;if(_0x22dbe9)_0x204d6e=_0x22dbe9;else{const _0x47df3a=a152_0x5cf51a['join'](process[_0xce7772(0x122)](),_0xce7772(0x1a5)),_0x175cf9=getSanitizedPathWithMigration(_0x47df3a,_0x4e9d60);_0x175cf9[_0xce7772(0xee)]&&this[_0xce7772(0xd8)][_0xce7772(0x1d0)](_0xce7772(0x103)+a152_0x5cf51a[_0xce7772(0x1b2)](_0x175cf9[_0xce7772(0x10f)])+_0xce7772(0x19f)+a152_0x5cf51a[_0xce7772(0x1b2)](_0x175cf9[_0xce7772(0x165)])),_0x204d6e=_0x175cf9[_0xce7772(0x165)];}const _0x13e263=await this[_0xce7772(0x1a9)][_0xce7772(0x176)](_0x4fc811),_0x25a474=await this[_0xce7772(0x1a9)]['listKnowledgeBases'](_0x4fc811),_0x323aea=await this[_0xce7772(0x1a9)][_0xce7772(0x104)](_0x4fc811),_0x4e1276=await safeListOrEmpty(()=>this[_0xce7772(0x1a9)]['listImageGenerators'](_0x4fc811)),_0x262eca=await safeListOrEmpty(()=>this[_0xce7772(0x1a9)][_0xce7772(0x14e)](_0x4fc811)),_0x2a4821=await this[_0xce7772(0x1a9)][_0xce7772(0x130)](_0x4fc811),_0x30d9e4=await this[_0xce7772(0x1a9)][_0xce7772(0x1a3)](_0x4fc811),_0xd4bb58=await safeListOrEmpty(()=>this[_0xce7772(0x1a9)][_0xce7772(0x1bd)](_0x4fc811)),_0x1a9abd=await safeListOrEmpty(()=>this['client'][_0xce7772(0x106)](_0x4fc811)),_0x516e67=await safeListOrEmpty(()=>this[_0xce7772(0x1a9)][_0xce7772(0x1b4)](_0x4fc811)),_0x1d2d43=await safeListOrEmpty(()=>this[_0xce7772(0x1a9)][_0xce7772(0x16f)](_0x4fc811)),_0x392256=_0x30d9e4[_0xce7772(0x185)](_0x5ea395=>!_0x5ea395[_0xce7772(0xdc)][_0xce7772(0x15a)]&&SAFE_INTEGRATION_TYPES[_0xce7772(0x14a)](_0x5ea395[_0xce7772(0xdc)][_0xce7772(0x163)]['toLowerCase']())),_0x57fa3c=new Map(),_0x15dfd7=new Map(),_0x35f03e=new Map(),_0x1a4f46=new Map(),_0x5389f6=new Map(),_0x5cbc8c=new Map(),_0x3937d6=new Map();for(const _0x5e73ee of _0x13e263){_0x57fa3c[_0xce7772(0x1ac)](_0x5e73ee['id'],_0x5e73ee[_0xce7772(0xdc)][_0xce7772(0x1e5)]);}for(const _0x568732 of _0x25a474){_0x15dfd7[_0xce7772(0x1ac)](_0x568732['id'],_0x568732['attributes'][_0xce7772(0x1e5)]);}for(const _0x3bba92 of _0x323aea){_0x35f03e[_0xce7772(0x1ac)](_0x3bba92['id'],_0x3bba92[_0xce7772(0xdc)][_0xce7772(0x1e5)]);}for(const _0x40b1b5 of _0x4e1276){_0x1a4f46[_0xce7772(0x1ac)](_0x40b1b5['id'],_0x40b1b5['attributes'][_0xce7772(0x1e5)]);}for(const _0x5eec95 of _0x262eca){_0x5389f6[_0xce7772(0x1ac)](_0x5eec95['id'],_0x5eec95[_0xce7772(0xdc)][_0xce7772(0x1e5)]);}for(const _0x5a9546 of _0x2a4821){_0x5cbc8c[_0xce7772(0x1ac)](_0x5a9546['id'],_0x5a9546['attributes'][_0xce7772(0x1e5)]);}for(const _0x225c69 of _0xd4bb58){_0x3937d6[_0xce7772(0x1ac)](_0x225c69['id'],_0x225c69[_0xce7772(0xdc)][_0xce7772(0x1e5)]);}const _0x2b17be={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x15dfd7,'TextKnowledgeBase':_0x35f03e,'Agent':_0x57fa3c,'WebSearchTool':_0x5389f6,'ImageGenerator':_0x1a4f46,'ExperimentalKnowledgeBase':_0x3937d6}),'resolvePromptName':async _0x457caa=>_0x5cbc8c['get'](_0x457caa),'onWarning':_0x6bba0e=>this[_0xce7772(0xd8)][_0xce7772(0xf4)](_0x6bba0e)},_0x364bad={'projectName':_0x4e9d60,'outputDir':_0x204d6e,'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}}},_0x462f96=[],_0x1a32a0=[];for(const _0x1a2793 of _0x13e263){const _0x1df7f8=getSanitizedPathWithMigration(_0x204d6e,_0x1a2793[_0xce7772(0xdc)][_0xce7772(0x1e5)]);_0x1df7f8['renamed']&&this[_0xce7772(0xd8)][_0xce7772(0x1d0)](_0xce7772(0x191)+a152_0x5cf51a[_0xce7772(0x1b2)](_0x1df7f8[_0xce7772(0x10f)])+_0xce7772(0x19f)+a152_0x5cf51a[_0xce7772(0x1b2)](_0x1df7f8[_0xce7772(0x165)]));const _0xb44a3b=_0x1df7f8[_0xce7772(0x165)],_0x1c73ac=a152_0x5cf51a[_0xce7772(0x1ec)](_0xb44a3b,'prompt.md'),_0x24cee0=a152_0x5cf51a[_0xce7772(0x1ec)](_0xb44a3b,_0xce7772(0x138)),_0x4bf30b=a152_0x5cf51a[_0xce7772(0x1ec)](_0xb44a3b,'starter_message.md'),{yaml:_0x27eb65,systemPrompt:_0x5ad06a,starterMessage:_0x3c27cf}=await agentResponseToDef(_0x1a2793,_0x2b17be),_0x35c926=toAgentYamlString(_0x27eb65),_0x5ccb1b=!a152_0x265b9b[_0xce7772(0x19d)](_0x24cee0);let _0xdd7bca=_0x5ccb1b,_0x49c193;if(!_0x5ccb1b){const _0x26d7d7=a152_0x265b9b['existsSync'](_0x1c73ac)?a152_0x265b9b[_0xce7772(0x1c2)](_0x1c73ac,_0xce7772(0xcf)):'',_0x3a428f=a152_0x265b9b[_0xce7772(0x1c2)](_0x24cee0,'utf-8'),_0x38f881='#\x20prompt.md\x0a'+_0x26d7d7+'\x0a\x0a#\x20agent.yml\x0a'+_0x3a428f,_0x3a1923=_0xce7772(0x113)+_0x5ad06a+'\x0a\x0a#\x20agent.yml\x0a'+_0x35c926,_0x2b9540=generateDiff(_0x38f881,_0x3a1923);_0xdd7bca=hasChanges(_0x2b9540),_0xdd7bca&&(_0x49c193=formatDiffWithColors(_0x2b9540));}_0x462f96['push']({'path':_0xb44a3b,'content':'','isDir':!![]}),_0x462f96['push']({'path':_0x1c73ac,'content':_0x5ad06a}),_0x462f96[_0xce7772(0x177)]({'path':_0x24cee0,'content':_0x35c926});_0x3c27cf&&_0x3c27cf[_0xce7772(0x14a)]('\x0a')&&_0x462f96[_0xce7772(0x177)]({'path':_0x4bf30b,'content':_0x3c27cf});_0x364bad[_0xce7772(0x1a5)][_0xce7772(0x177)]({'agentName':_0x1a2793[_0xce7772(0xdc)][_0xce7772(0x1e5)],'outputPath':_0xb44a3b,'isNew':_0x5ccb1b,'hasChanges':_0xdd7bca,'diff':_0x49c193}),_0x364bad[_0xce7772(0xce)][_0xce7772(0x1a5)][_0xce7772(0x14b)]++;if(_0x5ccb1b)_0x364bad['counts'][_0xce7772(0x1a5)][_0xce7772(0x12a)]++;else{if(_0xdd7bca)_0x364bad['counts'][_0xce7772(0x1a5)][_0xce7772(0x123)]++;else _0x364bad[_0xce7772(0xce)][_0xce7772(0x1a5)][_0xce7772(0x1c0)]++;}}for(const _0x12ade7 of _0x25a474){if(_0x12ade7['attributes'][_0xce7772(0x15a)])continue;const _0x55d2a1=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x204d6e),_0x12ade7[_0xce7772(0xdc)][_0xce7772(0x1e5)],_0xce7772(0x1d4));_0x55d2a1[_0xce7772(0xee)]&&this['logger'][_0xce7772(0x1d0)](_0xce7772(0x136)+a152_0x5cf51a[_0xce7772(0x1b2)](_0x55d2a1[_0xce7772(0x10f)])+'\x20→\x20'+a152_0x5cf51a['basename'](_0x55d2a1[_0xce7772(0x165)]));const _0x5ddecd=_0x55d2a1['path'],_0x35d363=apiKnowledgeBaseToYaml(_0x12ade7),_0x5993ce=toKnowledgeBaseYamlString(_0x35d363),_0x29614d=!a152_0x265b9b[_0xce7772(0x19d)](_0x5ddecd);let _0x29b8f3=_0x29614d,_0x53da9a;if(!_0x29614d){const _0x8f45af=a152_0x265b9b['readFileSync'](_0x5ddecd,_0xce7772(0xcf)),_0x4cf44e=generateDiff(_0x8f45af,_0x5993ce);_0x29b8f3=hasChanges(_0x4cf44e),_0x29b8f3&&(_0x53da9a=formatDiffWithColors(_0x4cf44e));}_0x462f96[_0xce7772(0x177)]({'path':_0x5ddecd,'content':_0x5993ce}),_0x364bad[_0xce7772(0x129)][_0xce7772(0x177)]({'name':_0x12ade7['attributes'][_0xce7772(0x1e5)],'outputPath':_0x5ddecd,'isNew':_0x29614d,'hasChanges':_0x29b8f3,'diff':_0x53da9a}),_0x364bad[_0xce7772(0xce)][_0xce7772(0x129)][_0xce7772(0x14b)]++;if(_0x29614d)_0x364bad[_0xce7772(0xce)]['knowledgeBases'][_0xce7772(0x12a)]++;else{if(_0x29b8f3)_0x364bad['counts'][_0xce7772(0x129)][_0xce7772(0x123)]++;else _0x364bad[_0xce7772(0xce)][_0xce7772(0x129)]['unchanged']++;}}for(const _0x1529a5 of _0x323aea){if(_0x1529a5[_0xce7772(0xdc)]['isManaged'])continue;const _0x167254=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x204d6e),_0x1529a5[_0xce7772(0xdc)][_0xce7772(0x1e5)],_0xce7772(0x198));_0x167254[_0xce7772(0xee)]&&this['logger']['info'](_0xce7772(0x145)+a152_0x5cf51a[_0xce7772(0x1b2)](_0x167254[_0xce7772(0x10f)])+'\x20→\x20'+a152_0x5cf51a['basename'](_0x167254['path']));const _0x595b89=_0x167254['path'],_0x2e50e6=toTextKnowledgeBaseMd(_0x1529a5['attributes'][_0xce7772(0x1e5)],_0x1529a5[_0xce7772(0xdc)]['text']),_0x50cf93=!a152_0x265b9b['existsSync'](_0x595b89);let _0x1c1382=_0x50cf93,_0x4e1703;if(!_0x50cf93){const _0x1dee20=a152_0x265b9b[_0xce7772(0x1c2)](_0x595b89,_0xce7772(0xcf)),_0x29fc95=generateDiff(_0x1dee20,_0x2e50e6);_0x1c1382=hasChanges(_0x29fc95),_0x1c1382&&(_0x4e1703=formatDiffWithColors(_0x29fc95));}_0x462f96[_0xce7772(0x177)]({'path':_0x595b89,'content':_0x2e50e6}),_0x364bad[_0xce7772(0x131)][_0xce7772(0x177)]({'name':_0x1529a5[_0xce7772(0xdc)][_0xce7772(0x1e5)],'outputPath':_0x595b89,'isNew':_0x50cf93,'hasChanges':_0x1c1382,'diff':_0x4e1703}),_0x364bad[_0xce7772(0xce)][_0xce7772(0x131)]['total']++;if(_0x50cf93)_0x364bad['counts'][_0xce7772(0x131)]['new']++;else{if(_0x1c1382)_0x364bad[_0xce7772(0xce)][_0xce7772(0x131)][_0xce7772(0x123)]++;else _0x364bad[_0xce7772(0xce)][_0xce7772(0x131)][_0xce7772(0x1c0)]++;}}for(const _0x5c1f4d of _0x2a4821){if(_0x5c1f4d[_0xce7772(0xdc)][_0xce7772(0x15a)])continue;const _0x33d174=getSanitizedPathWithMigration(getPromptsDir(_0x204d6e),_0x5c1f4d['attributes']['name'],_0xce7772(0x1d4));_0x33d174[_0xce7772(0xee)]&&this['logger'][_0xce7772(0x1d0)](_0xce7772(0x162)+a152_0x5cf51a[_0xce7772(0x1b2)](_0x33d174[_0xce7772(0x10f)])+'\x20→\x20'+a152_0x5cf51a[_0xce7772(0x1b2)](_0x33d174[_0xce7772(0x165)]));const _0x25590a=_0x33d174['path'],_0x242d3d=await apiPromptToYaml(_0x5c1f4d,_0x2b17be);if(!_0x242d3d)continue;const _0x45d845=toPromptYamlString(_0x242d3d),_0x309f37=!a152_0x265b9b[_0xce7772(0x19d)](_0x25590a);let _0x102e34=_0x309f37,_0x471ab9;if(!_0x309f37){const _0x3c11ed=a152_0x265b9b['readFileSync'](_0x25590a,_0xce7772(0xcf)),_0x43b529=generateDiff(_0x3c11ed,_0x45d845);_0x102e34=hasChanges(_0x43b529),_0x102e34&&(_0x471ab9=formatDiffWithColors(_0x43b529));}_0x462f96[_0xce7772(0x177)]({'path':_0x25590a,'content':_0x45d845}),_0x364bad[_0xce7772(0x166)][_0xce7772(0x177)]({'name':_0x5c1f4d[_0xce7772(0xdc)][_0xce7772(0x1e5)],'outputPath':_0x25590a,'isNew':_0x309f37,'hasChanges':_0x102e34,'diff':_0x471ab9}),_0x364bad[_0xce7772(0xce)]['prompts'][_0xce7772(0x14b)]++;if(_0x309f37)_0x364bad[_0xce7772(0xce)]['prompts'][_0xce7772(0x12a)]++;else{if(_0x102e34)_0x364bad[_0xce7772(0xce)]['prompts'][_0xce7772(0x123)]++;else _0x364bad[_0xce7772(0xce)][_0xce7772(0x166)][_0xce7772(0x1c0)]++;}}for(const _0x2edd59 of _0x392256){const _0x35d625=_0x2edd59[_0xce7772(0xdc)][_0xce7772(0x163)][_0xce7772(0x196)](),_0x104f92=getSanitizedPathWithMigration(getIntegrationsDir(_0x204d6e),_0x35d625,_0xce7772(0x1d4));_0x104f92[_0xce7772(0xee)]&&this[_0xce7772(0xd8)]['info']('Renamed\x20integration\x20file:\x20'+a152_0x5cf51a[_0xce7772(0x1b2)](_0x104f92[_0xce7772(0x10f)])+_0xce7772(0x19f)+a152_0x5cf51a[_0xce7772(0x1b2)](_0x104f92['path']));const _0x40f0ac=_0x104f92[_0xce7772(0x165)],_0x47f21f=await apiIntegrationToYaml(_0x2edd59,_0x2b17be),_0x4e56f2=toIntegrationYamlString(_0x47f21f),_0x21206f=!a152_0x265b9b[_0xce7772(0x19d)](_0x40f0ac);let _0x3d87dd=_0x21206f,_0x4419e5;if(!_0x21206f){const _0x4d14e3=a152_0x265b9b['readFileSync'](_0x40f0ac,_0xce7772(0xcf)),_0x123c77=generateDiff(_0x4d14e3,_0x4e56f2);_0x3d87dd=hasChanges(_0x123c77),_0x3d87dd&&(_0x4419e5=formatDiffWithColors(_0x123c77));}_0x462f96[_0xce7772(0x177)]({'path':_0x40f0ac,'content':_0x4e56f2}),_0x364bad['integrations'][_0xce7772(0x177)]({'name':_0x35d625,'outputPath':_0x40f0ac,'isNew':_0x21206f,'hasChanges':_0x3d87dd,'diff':_0x4419e5}),_0x364bad[_0xce7772(0xce)][_0xce7772(0x1c6)][_0xce7772(0x14b)]++;if(_0x21206f)_0x364bad[_0xce7772(0xce)][_0xce7772(0x1c6)][_0xce7772(0x12a)]++;else{if(_0x3d87dd)_0x364bad[_0xce7772(0xce)][_0xce7772(0x1c6)][_0xce7772(0x123)]++;else _0x364bad['counts'][_0xce7772(0x1c6)][_0xce7772(0x1c0)]++;}}for(const _0x473b1a of _0xd4bb58){if(_0x473b1a[_0xce7772(0xdc)][_0xce7772(0x15a)])continue;const _0x292a7f=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x204d6e),_0x473b1a[_0xce7772(0xdc)][_0xce7772(0x1e5)]);_0x292a7f[_0xce7772(0xee)]&&this[_0xce7772(0xd8)][_0xce7772(0x1d0)](_0xce7772(0x125)+a152_0x5cf51a['basename'](_0x292a7f[_0xce7772(0x10f)])+_0xce7772(0x19f)+a152_0x5cf51a[_0xce7772(0x1b2)](_0x292a7f['path']));const _0x419375=_0x292a7f['path'],_0x34f1f5=a152_0x5cf51a[_0xce7772(0x1ec)](_0x419375,sanitizeForFilesystem(_0x473b1a[_0xce7772(0xdc)]['name'])+_0xce7772(0x1d4)),_0xc3df02=a152_0x5cf51a[_0xce7772(0x1ec)](_0x419375,_0xce7772(0x157)),_0x794231=apiExperimentalKnowledgeBaseToYaml(_0x473b1a),_0x464fdc=toExperimentalKnowledgeBaseYamlString(_0x794231),_0x30b077=!a152_0x265b9b['existsSync'](_0x419375);let _0x1665d3=_0x30b077,_0x329d2a,_0x151147=_0x464fdc;const _0x4a1040=[..._0x794231[_0xce7772(0x157)]][_0xce7772(0x1d6)]((_0x83d9fe,_0x539f8b)=>_0x83d9fe[_0xce7772(0x1e5)][_0xce7772(0x190)](_0x539f8b[_0xce7772(0x1e5)]));for(const _0x2831cf of _0x4a1040){_0x151147+=_0xce7772(0xeb)+_0x2831cf[_0xce7772(0x1e5)]+'\x20---\x0a'+_0x2831cf[_0xce7772(0xe3)]+_0xce7772(0xe5)+_0x2831cf[_0xce7772(0x1e5)]+_0xce7772(0x1be)+_0x2831cf[_0xce7772(0x18d)]+'\x0a';}if(!_0x30b077){let _0x2b8c1e='';a152_0x265b9b[_0xce7772(0x19d)](_0x34f1f5)&&(_0x2b8c1e=a152_0x265b9b[_0xce7772(0x1c2)](_0x34f1f5,_0xce7772(0xcf)));if(a152_0x265b9b[_0xce7772(0x19d)](_0xc3df02)){const _0x3cb077=a152_0x265b9b['readdirSync'](_0xc3df02,{'withFileTypes':!![]}),_0x333ca2=_0x3cb077[_0xce7772(0x185)](_0xb3d395=>_0xb3d395[_0xce7772(0x19b)]())[_0xce7772(0x1d6)]((_0xead741,_0x2ec4f6)=>_0xead741[_0xce7772(0x1e5)][_0xce7772(0x190)](_0x2ec4f6['name']));for(const _0x5a7078 of _0x333ca2){const _0x22a650=a152_0x5cf51a[_0xce7772(0x1ec)](_0xc3df02,_0x5a7078[_0xce7772(0x1e5)],_0xce7772(0xef)),_0x534edc=a152_0x5cf51a['join'](_0xc3df02,_0x5a7078[_0xce7772(0x1e5)],_0xce7772(0xf2));a152_0x265b9b[_0xce7772(0x19d)](_0x22a650)&&(_0x2b8c1e+=_0xce7772(0xeb)+_0x5a7078[_0xce7772(0x1e5)]+_0xce7772(0x1be)+a152_0x265b9b['readFileSync'](_0x22a650,_0xce7772(0xcf))+'\x0a'),a152_0x265b9b[_0xce7772(0x19d)](_0x534edc)&&(_0x2b8c1e+=_0xce7772(0x105)+_0x5a7078[_0xce7772(0x1e5)]+_0xce7772(0x1be)+a152_0x265b9b[_0xce7772(0x1c2)](_0x534edc,_0xce7772(0xcf))+'\x0a');}}const _0x4c7629=generateDiff(_0x2b8c1e,_0x151147);_0x1665d3=hasChanges(_0x4c7629),_0x1665d3&&(_0x329d2a=formatDiffWithColors(_0x4c7629));}_0x462f96[_0xce7772(0x177)]({'path':_0x419375,'content':'','isDir':!![]}),_0x462f96[_0xce7772(0x177)]({'path':_0x34f1f5,'content':_0x464fdc}),_0x462f96[_0xce7772(0x177)]({'path':_0xc3df02,'content':'','isDir':!![]});for(const _0x15ccee of _0x794231[_0xce7772(0x157)]){const _0x174914=a152_0x5cf51a[_0xce7772(0x1ec)](_0xc3df02,sanitizeForFilesystem(_0x15ccee['name'])),_0x4cef46=a152_0x5cf51a[_0xce7772(0x1ec)](_0x174914,'code.js'),_0x3f2824=a152_0x5cf51a[_0xce7772(0x1ec)](_0x174914,_0xce7772(0xf2));_0x462f96[_0xce7772(0x177)]({'path':_0x174914,'content':'','isDir':!![]}),_0x462f96[_0xce7772(0x177)]({'path':_0x4cef46,'content':_0x15ccee[_0xce7772(0xe3)]}),_0x462f96[_0xce7772(0x177)]({'path':_0x3f2824,'content':_0x15ccee[_0xce7772(0x18d)]});}if(a152_0x265b9b[_0xce7772(0x19d)](_0xc3df02)){const _0x2c5c2d=a152_0x265b9b['readdirSync'](_0xc3df02,{'withFileTypes':!![]}),_0x168ec2=new Set(_0x794231[_0xce7772(0x157)][_0xce7772(0x12d)](_0x656ef2=>sanitizeForFilesystem(_0x656ef2[_0xce7772(0x1e5)])));for(const _0x16dc8f of _0x2c5c2d){if(_0x16dc8f[_0xce7772(0x19b)]()&&!_0x168ec2[_0xce7772(0x1df)](_0x16dc8f[_0xce7772(0x1e5)])){const _0xeab088=a152_0x5cf51a[_0xce7772(0x1ec)](_0xc3df02,_0x16dc8f[_0xce7772(0x1e5)]);_0x1a32a0[_0xce7772(0x177)]({'path':_0xeab088,'isDir':!![]});}}}_0x364bad[_0xce7772(0x155)][_0xce7772(0x177)]({'name':_0x473b1a['attributes'][_0xce7772(0x1e5)],'outputPath':_0x419375,'isNew':_0x30b077,'hasChanges':_0x1665d3,'diff':_0x329d2a}),_0x364bad[_0xce7772(0xce)]['experimentalKnowledgeBases'][_0xce7772(0x14b)]++;if(_0x30b077)_0x364bad[_0xce7772(0xce)]['experimentalKnowledgeBases']['new']++;else{if(_0x1665d3)_0x364bad[_0xce7772(0xce)][_0xce7772(0x155)][_0xce7772(0x123)]++;else _0x364bad['counts'][_0xce7772(0x155)][_0xce7772(0x1c0)]++;}}for(const _0x320e68 of _0x1a9abd){if(_0x320e68['attributes'][_0xce7772(0x15a)])continue;const _0x57de3e=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x204d6e),_0x320e68[_0xce7772(0xdc)][_0xce7772(0x1e5)]);_0x57de3e[_0xce7772(0xee)]&&this['logger'][_0xce7772(0x1d0)](_0xce7772(0x17f)+a152_0x5cf51a[_0xce7772(0x1b2)](_0x57de3e['oldPath'])+_0xce7772(0x19f)+a152_0x5cf51a[_0xce7772(0x1b2)](_0x57de3e[_0xce7772(0x165)]));const _0x413798=_0x57de3e['path'],_0x3d129c=a152_0x5cf51a[_0xce7772(0x1ec)](_0x413798,sanitizeForFilesystem(_0x320e68[_0xce7772(0xdc)][_0xce7772(0x1e5)])+_0xce7772(0x1d4)),_0x2a9ff3=a152_0x5cf51a[_0xce7772(0x1ec)](_0x413798,'code.js'),_0x812f0b=a152_0x5cf51a['join'](_0x413798,'files'),_0x47f71d=apiExperimentalArtifactToYaml(_0x320e68),_0xc44cad=toExperimentalArtifactYamlString(_0x47f71d),_0xd21c4e=!a152_0x265b9b[_0xce7772(0x19d)](_0x413798);let _0x57402a=_0xd21c4e,_0x187d54,_0x412c37=_0xc44cad+('\x0a---\x20code\x20---\x0a'+_0x47f71d['code']+'\x0a');const _0x285e22=[..._0x47f71d[_0xce7772(0x11e)]][_0xce7772(0x1d6)]((_0x166071,_0x2ff439)=>_0x166071[_0xce7772(0xfc)][_0xce7772(0x190)](_0x2ff439[_0xce7772(0xfc)]));for(const _0x128777 of _0x285e22){_0x412c37+=_0xce7772(0x1eb)+_0x128777['file_name']+_0xce7772(0x1be)+_0x128777[_0xce7772(0x119)]+'\x0a';}if(!_0xd21c4e){let _0x53b664='';a152_0x265b9b[_0xce7772(0x19d)](_0x3d129c)&&(_0x53b664=a152_0x265b9b[_0xce7772(0x1c2)](_0x3d129c,'utf-8'));a152_0x265b9b[_0xce7772(0x19d)](_0x2a9ff3)&&(_0x53b664+=_0xce7772(0x120)+a152_0x265b9b[_0xce7772(0x1c2)](_0x2a9ff3,_0xce7772(0xcf))+'\x0a');if(a152_0x265b9b[_0xce7772(0x19d)](_0x812f0b)){const _0x6e5ad5=a152_0x265b9b[_0xce7772(0x15c)](_0x812f0b),_0x175c83=_0x6e5ad5[_0xce7772(0x185)](_0x1a9acf=>{const _0x2fc012=a152_0x5cf51a['join'](_0x812f0b,_0x1a9acf);return a152_0x265b9b['statSync'](_0x2fc012)['isFile']();})['sort']((_0x5f1b9d,_0x2d39f7)=>_0x5f1b9d[_0xce7772(0x190)](_0x2d39f7));for(const _0x46c9ff of _0x175c83){const _0x500b9b=a152_0x5cf51a[_0xce7772(0x1ec)](_0x812f0b,_0x46c9ff);_0x53b664+=_0xce7772(0x1eb)+_0x46c9ff+_0xce7772(0x1be)+a152_0x265b9b[_0xce7772(0x1c2)](_0x500b9b,_0xce7772(0xcf))+'\x0a';}}const _0x5d9fda=generateDiff(_0x53b664,_0x412c37);_0x57402a=hasChanges(_0x5d9fda),_0x57402a&&(_0x187d54=formatDiffWithColors(_0x5d9fda));}_0x462f96[_0xce7772(0x177)]({'path':_0x413798,'content':'','isDir':!![]}),_0x462f96[_0xce7772(0x177)]({'path':_0x3d129c,'content':_0xc44cad}),_0x462f96[_0xce7772(0x177)]({'path':_0x2a9ff3,'content':_0x47f71d['code']});if(_0x47f71d['files']['length']>0x0){_0x462f96[_0xce7772(0x177)]({'path':_0x812f0b,'content':'','isDir':!![]});for(const _0xf4fb4 of _0x47f71d[_0xce7772(0x11e)]){const _0x48b789=a152_0x5cf51a[_0xce7772(0x1ec)](_0x812f0b,_0xf4fb4[_0xce7772(0xfc)]);_0x462f96['push']({'path':_0x48b789,'content':_0xf4fb4[_0xce7772(0x119)]});}}if(a152_0x265b9b[_0xce7772(0x19d)](_0x812f0b)){const _0x3b8e30=a152_0x265b9b['readdirSync'](_0x812f0b),_0x4d3f16=new Set(_0x47f71d[_0xce7772(0x11e)][_0xce7772(0x12d)](_0x302bd5=>_0x302bd5[_0xce7772(0xfc)]));for(const _0x364069 of _0x3b8e30){const _0xba5225=a152_0x5cf51a[_0xce7772(0x1ec)](_0x812f0b,_0x364069);a152_0x265b9b[_0xce7772(0xff)](_0xba5225)[_0xce7772(0x1ce)]()&&!_0x4d3f16[_0xce7772(0x1df)](_0x364069)&&_0x1a32a0['push']({'path':_0xba5225});}}_0x364bad[_0xce7772(0xf1)][_0xce7772(0x177)]({'name':_0x320e68[_0xce7772(0xdc)][_0xce7772(0x1e5)],'outputPath':_0x413798,'isNew':_0xd21c4e,'hasChanges':_0x57402a,'diff':_0x187d54}),_0x364bad[_0xce7772(0xce)][_0xce7772(0xf1)][_0xce7772(0x14b)]++;if(_0xd21c4e)_0x364bad[_0xce7772(0xce)][_0xce7772(0xf1)][_0xce7772(0x12a)]++;else{if(_0x57402a)_0x364bad[_0xce7772(0xce)][_0xce7772(0xf1)][_0xce7772(0x123)]++;else _0x364bad['counts'][_0xce7772(0xf1)][_0xce7772(0x1c0)]++;}}for(const _0x714443 of _0x516e67){const _0x42f6a8=getSanitizedPathWithMigration(getFormInterfacesDir(_0x204d6e),_0x714443[_0xce7772(0xdc)][_0xce7772(0x1e5)],_0xce7772(0x1d4));_0x42f6a8['renamed']&&this[_0xce7772(0xd8)][_0xce7772(0x1d0)]('Renamed\x20form\x20interface\x20file:\x20'+a152_0x5cf51a[_0xce7772(0x1b2)](_0x42f6a8['oldPath'])+'\x20→\x20'+a152_0x5cf51a[_0xce7772(0x1b2)](_0x42f6a8[_0xce7772(0x165)]));const _0xc9e27=_0x42f6a8['path'],_0x42717c=await apiFormInterfaceToYaml(_0x714443,_0x2b17be),_0x180a28=toFormInterfaceYamlString(_0x42717c),_0x271c4f=!a152_0x265b9b[_0xce7772(0x19d)](_0xc9e27);let _0x5a7ee9=_0x271c4f,_0x381e98;if(!_0x271c4f){const _0x8a9a16=a152_0x265b9b[_0xce7772(0x1c2)](_0xc9e27,_0xce7772(0xcf)),_0x315686=generateDiff(_0x8a9a16,_0x180a28);_0x5a7ee9=hasChanges(_0x315686),_0x5a7ee9&&(_0x381e98=formatDiffWithColors(_0x315686));}_0x462f96[_0xce7772(0x177)]({'path':_0xc9e27,'content':_0x180a28}),_0x364bad[_0xce7772(0x1af)][_0xce7772(0x177)]({'name':_0x714443[_0xce7772(0xdc)]['name'],'outputPath':_0xc9e27,'isNew':_0x271c4f,'hasChanges':_0x5a7ee9,'diff':_0x381e98}),_0x364bad[_0xce7772(0xce)][_0xce7772(0x1af)][_0xce7772(0x14b)]++;if(_0x271c4f)_0x364bad[_0xce7772(0xce)][_0xce7772(0x1af)][_0xce7772(0x12a)]++;else{if(_0x5a7ee9)_0x364bad[_0xce7772(0xce)][_0xce7772(0x1af)][_0xce7772(0x123)]++;else _0x364bad[_0xce7772(0xce)]['formInterfaces'][_0xce7772(0x1c0)]++;}}for(const _0x5a5823 of _0x1d2d43){if(_0x5a5823[_0xce7772(0xdc)][_0xce7772(0x15a)])continue;const _0x529396=getSanitizedPathWithMigration(getChatInterfacesDir(_0x204d6e),_0x5a5823['attributes']['name'],_0xce7772(0x1d4));_0x529396[_0xce7772(0xee)]&&this[_0xce7772(0xd8)][_0xce7772(0x1d0)](_0xce7772(0xe9)+a152_0x5cf51a[_0xce7772(0x1b2)](_0x529396['oldPath'])+_0xce7772(0x19f)+a152_0x5cf51a[_0xce7772(0x1b2)](_0x529396[_0xce7772(0x165)]));const _0xb1f4e1=_0x529396[_0xce7772(0x165)],_0xde2cff=await apiChatInterfaceToYaml(_0x5a5823,_0x2b17be),_0x1dc580=toChatInterfaceYamlString(_0xde2cff),_0x47c3b3=!a152_0x265b9b[_0xce7772(0x19d)](_0xb1f4e1);let _0x221f57=_0x47c3b3,_0x170ce4;if(!_0x47c3b3){const _0x475367=a152_0x265b9b[_0xce7772(0x1c2)](_0xb1f4e1,_0xce7772(0xcf)),_0x22ffe5=generateDiff(_0x475367,_0x1dc580);_0x221f57=hasChanges(_0x22ffe5),_0x221f57&&(_0x170ce4=formatDiffWithColors(_0x22ffe5));}_0x462f96[_0xce7772(0x177)]({'path':_0xb1f4e1,'content':_0x1dc580}),_0x364bad[_0xce7772(0xfa)]['push']({'name':_0x5a5823[_0xce7772(0xdc)][_0xce7772(0x1e5)],'outputPath':_0xb1f4e1,'isNew':_0x47c3b3,'hasChanges':_0x221f57,'diff':_0x170ce4}),_0x364bad[_0xce7772(0xce)][_0xce7772(0xfa)][_0xce7772(0x14b)]++;if(_0x47c3b3)_0x364bad[_0xce7772(0xce)]['chatInterfaces']['new']++;else{if(_0x221f57)_0x364bad[_0xce7772(0xce)][_0xce7772(0xfa)][_0xce7772(0x123)]++;else _0x364bad[_0xce7772(0xce)][_0xce7772(0xfa)][_0xce7772(0x1c0)]++;}}if(_0xd45fa4?.['dryRun'])return _0x364bad;a152_0x265b9b[_0xce7772(0x124)](_0x204d6e,{'recursive':!![]}),a152_0x265b9b[_0xce7772(0x124)](getKnowledgeBasesDir(_0x204d6e),{'recursive':!![]}),a152_0x265b9b[_0xce7772(0x124)](getPromptsDir(_0x204d6e),{'recursive':!![]}),a152_0x265b9b['mkdirSync'](getIntegrationsDir(_0x204d6e),{'recursive':!![]}),a152_0x265b9b[_0xce7772(0x124)](getExperimentalKnowledgeBasesDir(_0x204d6e),{'recursive':!![]}),a152_0x265b9b[_0xce7772(0x124)](getExperimentalArtifactsDir(_0x204d6e),{'recursive':!![]}),a152_0x265b9b['mkdirSync'](getFormInterfacesDir(_0x204d6e),{'recursive':!![]}),a152_0x265b9b[_0xce7772(0x124)](getChatInterfacesDir(_0x204d6e),{'recursive':!![]});const _0x1bf8eb=a152_0x5cf51a[_0xce7772(0x1ec)](_0x204d6e,'tdx.json');a152_0x265b9b[_0xce7772(0x1e9)](_0x1bf8eb,createAgentConfigContent(_0x4e9d60));for(const _0x2ea6c1 of _0x462f96){if(_0x2ea6c1['isDir'])a152_0x265b9b[_0xce7772(0x124)](_0x2ea6c1[_0xce7772(0x165)],{'recursive':!![]});else{const _0x4b64f2=a152_0x5cf51a[_0xce7772(0x107)](_0x2ea6c1[_0xce7772(0x165)]);!a152_0x265b9b[_0xce7772(0x19d)](_0x4b64f2)&&a152_0x265b9b[_0xce7772(0x124)](_0x4b64f2,{'recursive':!![]}),a152_0x265b9b[_0xce7772(0x1e9)](_0x2ea6c1['path'],_0x2ea6c1[_0xce7772(0x128)]);}}for(const _0x3b5281 of _0x1a32a0){_0x3b5281[_0xce7772(0x17a)]?(a152_0x265b9b['rmSync'](_0x3b5281[_0xce7772(0x165)],{'recursive':!![],'force':!![]}),this[_0xce7772(0xd8)][_0xce7772(0x1d0)](_0xce7772(0x117)+a152_0x5cf51a[_0xce7772(0x1b2)](a152_0x5cf51a[_0xce7772(0x107)](_0x3b5281[_0xce7772(0x165)]))+'/'+a152_0x5cf51a[_0xce7772(0x1b2)](_0x3b5281[_0xce7772(0x165)]))):(a152_0x265b9b['rmSync'](_0x3b5281[_0xce7772(0x165)],{'force':!![]}),this[_0xce7772(0xd8)][_0xce7772(0x1d0)](_0xce7772(0xdd)+a152_0x5cf51a[_0xce7772(0x1b2)](a152_0x5cf51a[_0xce7772(0x107)](_0x3b5281[_0xce7772(0x165)]))+'/'+a152_0x5cf51a[_0xce7772(0x1b2)](_0x3b5281[_0xce7772(0x165)])));}return _0x364bad;}async['pushProject'](_0x297b86,_0x173ba0){const _0x3062d3=a152_0x2f9e7b,_0x15197c=a152_0x5cf51a[_0x3062d3(0x1ec)](_0x297b86,'tdx.json');if(!a152_0x265b9b[_0x3062d3(0x19d)](_0x15197c))throw new SDKError(ErrorCode[_0x3062d3(0x1cb)],_0x3062d3(0x143)+_0x297b86,undefined,{'helpText':'Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.'});const _0x3980e1=loadAgentConfig(_0x15197c),_0x4166b4=await this[_0x3062d3(0x13c)](_0x3980e1[_0x3062d3(0x178)]),_0x116d87=await this[_0x3062d3(0x1a9)][_0x3062d3(0x14f)](_0x4166b4),_0x2dc79e=_0x116d87[_0x3062d3(0xdc)][_0x3062d3(0x1e5)],_0x29f4f5={'projectName':_0x2dc79e,'projectId':_0x4166b4,'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}}},_0x24e41c=[],_0xb0f41c=[],_0x371707=[],_0x5e2f4a=[],_0x455ac3=[],_0x3393cc=[],_0x3ae207=a152_0x265b9b[_0x3062d3(0x15c)](_0x297b86,{'withFileTypes':!![]});for(const _0x835949 of _0x3ae207){if(!_0x835949[_0x3062d3(0x19b)]())continue;if(['knowledge_bases',_0x3062d3(0x166),_0x3062d3(0x1c6),_0x3062d3(0x151),_0x3062d3(0x184),'form_interfaces',_0x3062d3(0x12c)][_0x3062d3(0x14a)](_0x835949[_0x3062d3(0x1e5)]))continue;const _0x1c7511=a152_0x5cf51a['join'](_0x297b86,_0x835949['name']);if(isAgentDir(_0x1c7511)){const _0x55d476=a152_0x5cf51a[_0x3062d3(0x1ec)](_0x1c7511,'agent.yml'),_0x40fa41=a152_0x5cf51a[_0x3062d3(0x1ec)](_0x1c7511,_0x3062d3(0x133)),_0x233bda=a152_0x5cf51a['join'](_0x1c7511,_0x3062d3(0x1c1)),_0x43ef74=parseAgentYaml(a152_0x265b9b['readFileSync'](_0x55d476,_0x3062d3(0xcf)),_0x55d476),_0x564ce3=a152_0x265b9b[_0x3062d3(0x19d)](_0x40fa41)?a152_0x265b9b['readFileSync'](_0x40fa41,_0x3062d3(0xcf)):'',_0x1e92cf=a152_0x265b9b['existsSync'](_0x233bda)?a152_0x265b9b[_0x3062d3(0x1c2)](_0x233bda,'utf-8'):_0x43ef74[_0x3062d3(0x168)];_0x24e41c[_0x3062d3(0x177)]({'name':_0x43ef74['name'],'dir':_0x1c7511,'yaml':_0x43ef74,'systemPrompt':_0x564ce3,'starterMessage':_0x1e92cf});}}const _0x47071f=getKnowledgeBasesDir(_0x297b86);if(a152_0x265b9b[_0x3062d3(0x19d)](_0x47071f)){const _0x3778a6=a152_0x265b9b[_0x3062d3(0x15c)](_0x47071f);for(const _0x450d95 of _0x3778a6){const _0x25e358=a152_0x5cf51a['join'](_0x47071f,_0x450d95);if(_0x450d95[_0x3062d3(0x127)](_0x3062d3(0x1d4))){const _0x567c11=parseKnowledgeBaseYaml(a152_0x265b9b[_0x3062d3(0x1c2)](_0x25e358,_0x3062d3(0xcf)),_0x25e358);_0xb0f41c[_0x3062d3(0x177)]({'name':_0x567c11[_0x3062d3(0x1e5)],'path':_0x25e358,'yaml':_0x567c11});}else{if(_0x450d95['endsWith'](_0x3062d3(0x198))){const _0x189df9=a152_0x265b9b[_0x3062d3(0x1c2)](_0x25e358,'utf-8'),{name:_0x11366a,text:_0x5c888f}=parseTextKnowledgeBaseMd(_0x189df9,_0x450d95);_0x371707[_0x3062d3(0x177)]({'name':_0x11366a,'path':_0x25e358,'text':_0x5c888f});}}}}const _0x25d7eb=getPromptsDir(_0x297b86);if(a152_0x265b9b[_0x3062d3(0x19d)](_0x25d7eb)){const _0x53c4d5=a152_0x265b9b[_0x3062d3(0x15c)](_0x25d7eb)[_0x3062d3(0x185)](_0x15e199=>_0x15e199[_0x3062d3(0x127)](_0x3062d3(0x1d4)));for(const _0x2ad0c2 of _0x53c4d5){const _0x4217e9=a152_0x5cf51a[_0x3062d3(0x1ec)](_0x25d7eb,_0x2ad0c2),_0x4f8d2a=parsePromptYaml(a152_0x265b9b[_0x3062d3(0x1c2)](_0x4217e9,_0x3062d3(0xcf)),_0x4217e9);_0x5e2f4a[_0x3062d3(0x177)]({'name':_0x4f8d2a[_0x3062d3(0x1e5)],'path':_0x4217e9,'yaml':_0x4f8d2a});}}const _0x4510ba=[],_0x140e36=getIntegrationsDir(_0x297b86);if(a152_0x265b9b[_0x3062d3(0x19d)](_0x140e36)){const _0x52e3d6=a152_0x265b9b[_0x3062d3(0x15c)](_0x140e36)[_0x3062d3(0x185)](_0x57fa22=>_0x57fa22[_0x3062d3(0x127)](_0x3062d3(0x1d4)));for(const _0x2e647f of _0x52e3d6){const _0x492901=a152_0x5cf51a['join'](_0x140e36,_0x2e647f),_0x2386da=parseIntegrationYaml(a152_0x265b9b[_0x3062d3(0x1c2)](_0x492901,_0x3062d3(0xcf)),_0x492901);if(!SAFE_INTEGRATION_TYPES['includes'](_0x2386da[_0x3062d3(0x1e3)][_0x3062d3(0x196)]())){this[_0x3062d3(0xd8)][_0x3062d3(0xf4)](_0x3062d3(0x1e8)+_0x2386da[_0x3062d3(0x1e5)]+_0x3062d3(0x174)+_0x2386da[_0x3062d3(0x1e3)]+_0x3062d3(0x152)+(_0x3062d3(0x1b3)+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x3062d3(0x110))+_0x3062d3(0x137));continue;}_0x4510ba[_0x3062d3(0x177)]({'name':_0x2386da[_0x3062d3(0x1e5)],'path':_0x492901,'yaml':_0x2386da});}}const _0x15cd40=getExperimentalKnowledgeBasesDir(_0x297b86);if(a152_0x265b9b[_0x3062d3(0x19d)](_0x15cd40)){const _0x130ca0=a152_0x265b9b['readdirSync'](_0x15cd40,{'withFileTypes':!![]});for(const _0x49422b of _0x130ca0){if(!_0x49422b[_0x3062d3(0x19b)]())continue;const _0x34c749=a152_0x5cf51a[_0x3062d3(0x1ec)](_0x15cd40,_0x49422b[_0x3062d3(0x1e5)]),_0x56d020=a152_0x5cf51a[_0x3062d3(0x1ec)](_0x34c749,_0x49422b[_0x3062d3(0x1e5)]+_0x3062d3(0x1d4)),_0x45a765=a152_0x5cf51a['join'](_0x34c749,_0x3062d3(0x157));if(!a152_0x265b9b[_0x3062d3(0x19d)](_0x56d020))continue;const _0x4c01fe=parseExperimentalKnowledgeBaseYaml(a152_0x265b9b[_0x3062d3(0x1c2)](_0x56d020,_0x3062d3(0xcf)),_0x56d020),_0x494454=[];if(a152_0x265b9b['existsSync'](_0x45a765)){const _0xc74738=a152_0x265b9b[_0x3062d3(0x15c)](_0x45a765,{'withFileTypes':!![]});for(const _0x222c31 of _0xc74738){if(!_0x222c31[_0x3062d3(0x19b)]())continue;const _0x32e2d1=a152_0x5cf51a[_0x3062d3(0x1ec)](_0x45a765,_0x222c31[_0x3062d3(0x1e5)]),_0x3f826b=a152_0x5cf51a[_0x3062d3(0x1ec)](_0x32e2d1,_0x3062d3(0xef)),_0x599820=a152_0x5cf51a['join'](_0x32e2d1,_0x3062d3(0xf2));a152_0x265b9b[_0x3062d3(0x19d)](_0x3f826b)&&a152_0x265b9b[_0x3062d3(0x19d)](_0x599820)&&_0x494454[_0x3062d3(0x177)]({'name':_0x222c31[_0x3062d3(0x1e5)],'code':a152_0x265b9b[_0x3062d3(0x1c2)](_0x3f826b,'utf-8'),'json_schema':a152_0x265b9b['readFileSync'](_0x599820,_0x3062d3(0xcf))});}}const _0x26de5={..._0x4c01fe,'variables':_0x4c01fe[_0x3062d3(0xdf)]||[],'functions':_0x494454};_0x455ac3[_0x3062d3(0x177)]({'name':_0x4c01fe[_0x3062d3(0x1e5)],'dir':_0x34c749,'def':_0x26de5});}}const _0xcbe74c=getExperimentalArtifactsDir(_0x297b86);if(a152_0x265b9b[_0x3062d3(0x19d)](_0xcbe74c)){const _0xfb52bd=a152_0x265b9b[_0x3062d3(0x15c)](_0xcbe74c,{'withFileTypes':!![]});for(const _0x30f3ef of _0xfb52bd){if(!_0x30f3ef[_0x3062d3(0x19b)]())continue;const _0x37c85f=a152_0x5cf51a[_0x3062d3(0x1ec)](_0xcbe74c,_0x30f3ef['name']),_0x576897=a152_0x5cf51a['join'](_0x37c85f,_0x30f3ef['name']+_0x3062d3(0x1d4)),_0x4b171d=a152_0x5cf51a[_0x3062d3(0x1ec)](_0x37c85f,_0x3062d3(0xef)),_0x567d84=a152_0x5cf51a[_0x3062d3(0x1ec)](_0x37c85f,_0x3062d3(0x11e));if(!a152_0x265b9b[_0x3062d3(0x19d)](_0x576897)||!a152_0x265b9b[_0x3062d3(0x19d)](_0x4b171d))continue;const _0x2354a6=parseExperimentalArtifactYaml(a152_0x265b9b['readFileSync'](_0x576897,_0x3062d3(0xcf)),_0x576897),_0x3b04c7=a152_0x265b9b['readFileSync'](_0x4b171d,_0x3062d3(0xcf)),_0x9b5e6f=[];if(a152_0x265b9b[_0x3062d3(0x19d)](_0x567d84)){const _0x1f5cfb=a152_0x265b9b[_0x3062d3(0x15c)](_0x567d84);for(const _0x463d11 of _0x1f5cfb){const _0x15ccd7=a152_0x5cf51a['join'](_0x567d84,_0x463d11);a152_0x265b9b['statSync'](_0x15ccd7)['isFile']()&&_0x9b5e6f['push']({'file_name':_0x463d11,'text_content':a152_0x265b9b[_0x3062d3(0x1c2)](_0x15ccd7,'utf-8')});}}const _0x1cc593={..._0x2354a6,'code':_0x3b04c7,'files':_0x9b5e6f};_0x3393cc[_0x3062d3(0x177)]({'name':_0x2354a6[_0x3062d3(0x1e5)],'dir':_0x37c85f,'def':_0x1cc593});}}const _0x5887a8=[],_0x41ca9d=getFormInterfacesDir(_0x297b86);if(a152_0x265b9b[_0x3062d3(0x19d)](_0x41ca9d)){const _0x1504b6=a152_0x265b9b[_0x3062d3(0x15c)](_0x41ca9d)[_0x3062d3(0x185)](_0xf62eb3=>_0xf62eb3['endsWith'](_0x3062d3(0x1d4)));for(const _0x3bd26b of _0x1504b6){const _0xb6df8=a152_0x5cf51a[_0x3062d3(0x1ec)](_0x41ca9d,_0x3bd26b),_0x4d65ae=parseFormInterfaceYaml(a152_0x265b9b[_0x3062d3(0x1c2)](_0xb6df8,'utf-8'),_0xb6df8);_0x5887a8['push']({'name':_0x4d65ae[_0x3062d3(0x1e5)],'path':_0xb6df8,'yaml':_0x4d65ae});}}const _0x586e29=[],_0x40419d=getChatInterfacesDir(_0x297b86);if(a152_0x265b9b[_0x3062d3(0x19d)](_0x40419d)){const _0x4d4de2=a152_0x265b9b[_0x3062d3(0x15c)](_0x40419d)['filter'](_0x58f971=>_0x58f971[_0x3062d3(0x127)](_0x3062d3(0x1d4)));for(const _0x328526 of _0x4d4de2){const _0x55e3b7=a152_0x5cf51a['join'](_0x40419d,_0x328526),_0x25bcec=parseChatInterfaceYaml(a152_0x265b9b[_0x3062d3(0x1c2)](_0x55e3b7,_0x3062d3(0xcf)),_0x55e3b7);_0x586e29['push']({'name':_0x25bcec[_0x3062d3(0x1e5)],'path':_0x55e3b7,'yaml':_0x25bcec});}}const _0x39c54e=await this['client'][_0x3062d3(0x176)](_0x4166b4),_0x1c463c=await this[_0x3062d3(0x1a9)][_0x3062d3(0x1d3)](_0x4166b4),_0x14a555=await this['client'][_0x3062d3(0x104)](_0x4166b4),_0x200e21=await this[_0x3062d3(0x1a9)][_0x3062d3(0x130)](_0x4166b4),_0x4c81b1=await this[_0x3062d3(0x1a9)][_0x3062d3(0x1a3)](_0x4166b4),_0x398364=await safeListOrEmpty(()=>this['client'][_0x3062d3(0x1bd)](_0x4166b4)),_0x9be46b=await safeListOrEmpty(()=>this['client']['listExperimentalArtifacts'](_0x4166b4)),_0x10d0af=await safeListOrEmpty(()=>this[_0x3062d3(0x1a9)]['listFormInterfaces'](_0x4166b4)),_0x2aca31=await safeListOrEmpty(()=>this[_0x3062d3(0x1a9)]['listChatInterfaces'](_0x4166b4)),_0x536f26=await fetchAllToolTargetMaps((_0x201ad6,_0x340e1b)=>this['client']['listToolTargets'](_0x201ad6,_0x340e1b),_0x4166b4),_0x5953b7=new Map(),_0x114401=new Map(),_0x5110f3=new Map(),_0x9cea7a=new Map(),_0xb2e664=new Map(),_0xd86b27=new Map(),_0x1154c7=new Map();for(const _0x4c81ea of _0x39c54e){_0x5953b7[_0x3062d3(0x1ac)](_0x4c81ea[_0x3062d3(0xdc)]['name'],_0x4c81ea);}for(const _0xf394d4 of _0x1c463c){_0x114401[_0x3062d3(0x1ac)](_0xf394d4['attributes'][_0x3062d3(0x1e5)],_0xf394d4);}for(const _0x1cf0bf of _0x14a555){_0x5110f3[_0x3062d3(0x1ac)](_0x1cf0bf[_0x3062d3(0xdc)][_0x3062d3(0x1e5)],_0x1cf0bf);}for(const _0x3fa23a of _0x200e21){_0x9cea7a['set'](_0x3fa23a[_0x3062d3(0xdc)][_0x3062d3(0x1e5)],_0x3fa23a);}for(const _0x46236c of _0x4c81b1){_0xb2e664[_0x3062d3(0x1ac)](_0x46236c['attributes'][_0x3062d3(0x163)][_0x3062d3(0x196)](),_0x46236c);}for(const _0x3b0a7d of _0x398364){_0xd86b27[_0x3062d3(0x1ac)](_0x3b0a7d[_0x3062d3(0xdc)][_0x3062d3(0x1e5)],_0x3b0a7d);}for(const _0x248a9a of _0x9be46b){_0x1154c7[_0x3062d3(0x1ac)](_0x248a9a['attributes']['name'],_0x248a9a);}const _0x20bb15=new Map(),_0x4cfe4f=new Map();for(const _0x4b827a of _0x10d0af){_0x20bb15[_0x3062d3(0x1ac)](_0x4b827a[_0x3062d3(0xdc)][_0x3062d3(0x1e5)],_0x4b827a);}for(const _0xd8e8d0 of _0x2aca31){_0x4cfe4f[_0x3062d3(0x1ac)](_0xd8e8d0[_0x3062d3(0xdc)][_0x3062d3(0x1e5)],_0xd8e8d0);}const _0x14d448=new Map(),_0x11afb0=new Map();for(const _0x1cc069 of _0x39c54e){_0x14d448[_0x3062d3(0x1ac)](_0x1cc069[_0x3062d3(0xdc)][_0x3062d3(0x1e5)],_0x1cc069['id']),_0x11afb0['set'](_0x1cc069['id'],_0x1cc069[_0x3062d3(0xdc)][_0x3062d3(0x1e5)]);}const _0x16249b=new Map(),_0x3de34c=new Map();for(const _0x4293cc of _0x200e21){_0x16249b[_0x3062d3(0x1ac)](_0x4293cc[_0x3062d3(0xdc)][_0x3062d3(0x1e5)],_0x4293cc['id']),_0x3de34c['set'](_0x4293cc['id'],_0x4293cc[_0x3062d3(0xdc)][_0x3062d3(0x1e5)]);}const _0x28d664=_0x536f26['nameToId']['KnowledgeBase']||new Map(),_0x4fc894=_0x536f26[_0x3062d3(0x189)][_0x3062d3(0x1e4)]||new Map(),_0xcfcc82=_0x536f26[_0x3062d3(0x189)][_0x3062d3(0x15d)]||new Map(),_0x5e63a5=new Map(),_0x59155b={'resolveToolTargetName':buildNameResolver({..._0x536f26[_0x3062d3(0x1d5)],'Agent':_0x11afb0}),'resolvePromptName':async _0x26aedd=>_0x3de34c[_0x3062d3(0x170)](_0x26aedd),'onWarning':_0x1f923b=>this[_0x3062d3(0xd8)][_0x3062d3(0xf4)](_0x1f923b)};let _0x59bd80=[];const _0x31428f={'projectId':_0x4166b4,'resolveToolTargetId':buildIdResolver({..._0x536f26[_0x3062d3(0x189)],'Agent':_0x14d448}),'resolvePromptId':async _0x31adba=>_0x16249b['get'](_0x31adba),'onWarning':_0x559789=>{const _0x53c480=_0x3062d3;this[_0x53c480(0xd8)][_0x53c480(0xf4)](_0x559789),_0x59bd80[_0x53c480(0x177)](_0x559789);}},{resolved:_0xac5193,unresolved:_0x5ab6ac}=resolveAgentDependencies(_0x24e41c,new Set(_0x5953b7[_0x3062d3(0x1dd)]()));for(const {agent:_0x268060,missingDeps:_0x37c4be}of _0x5ab6ac){_0x29f4f5[_0x3062d3(0x1a5)][_0x3062d3(0x177)]({'agentName':_0x268060['yaml'][_0x3062d3(0x1e5)],'action':_0x3062d3(0x1cf),'error':_0x3062d3(0x1a7)+_0x37c4be[_0x3062d3(0x1ec)](',\x20')+_0x3062d3(0x1c3)}),_0x29f4f5['counts'][_0x3062d3(0x1a5)][_0x3062d3(0xd4)]++;}for(const _0x512428 of _0xb0f41c){const _0x4a2d5f=_0x114401[_0x3062d3(0x170)](_0x512428[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)]),_0x410e38=a152_0x265b9b[_0x3062d3(0x1c2)](_0x512428[_0x3062d3(0x165)],_0x3062d3(0xcf));if(_0x4a2d5f){const _0x320945=apiKnowledgeBaseToYaml(_0x4a2d5f),_0x30edc6=toKnowledgeBaseYamlString(_0x320945),_0x14efc9=generateDiff(_0x30edc6,_0x410e38),_0x5109c4=hasChanges(_0x14efc9);_0x5109c4?(_0x29f4f5[_0x3062d3(0x129)][_0x3062d3(0x177)]({'name':_0x512428[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':_0x3062d3(0x123),'id':_0x4a2d5f['id'],'diff':formatDiffWithColors(_0x14efc9)}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x129)][_0x3062d3(0x123)]++):(_0x29f4f5[_0x3062d3(0x129)]['push']({'name':_0x512428[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':_0x3062d3(0x1c0),'id':_0x4a2d5f['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x129)][_0x3062d3(0x1c0)]++);}else _0x29f4f5[_0x3062d3(0x129)][_0x3062d3(0x177)]({'name':_0x512428[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':'created'}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x129)][_0x3062d3(0xd5)]++;}for(const _0x4eb865 of _0x371707){const _0x1d84ad=_0x5110f3[_0x3062d3(0x170)](_0x4eb865[_0x3062d3(0x1e5)]),_0x11d87b=a152_0x265b9b[_0x3062d3(0x1c2)](_0x4eb865[_0x3062d3(0x165)],_0x3062d3(0xcf));if(_0x1d84ad){const _0x14179b=toTextKnowledgeBaseMd(_0x1d84ad[_0x3062d3(0xdc)]['name'],_0x1d84ad[_0x3062d3(0xdc)][_0x3062d3(0x195)]),_0x26143=generateDiff(_0x14179b,_0x11d87b),_0x33ae48=hasChanges(_0x26143);_0x33ae48?(_0x29f4f5[_0x3062d3(0x131)][_0x3062d3(0x177)]({'name':_0x4eb865[_0x3062d3(0x1e5)],'action':_0x3062d3(0x123),'id':_0x1d84ad['id'],'diff':formatDiffWithColors(_0x26143)}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x131)][_0x3062d3(0x123)]++):(_0x29f4f5[_0x3062d3(0x131)][_0x3062d3(0x177)]({'name':_0x4eb865['name'],'action':_0x3062d3(0x1c0),'id':_0x1d84ad['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x131)][_0x3062d3(0x1c0)]++);}else _0x29f4f5[_0x3062d3(0x131)][_0x3062d3(0x177)]({'name':_0x4eb865[_0x3062d3(0x1e5)],'action':_0x3062d3(0xd5)}),_0x29f4f5[_0x3062d3(0xce)]['textKnowledgeBases'][_0x3062d3(0xd5)]++;}for(const _0x93d7f7 of _0xac5193){const _0xf187c0=_0x5953b7['get'](_0x93d7f7[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)]),_0x2f68f1=a152_0x5cf51a['join'](_0x93d7f7[_0x3062d3(0x1a2)],'agent.yml'),_0x2d0385=a152_0x265b9b['readFileSync'](_0x2f68f1,_0x3062d3(0xcf)),_0xc9f2bf=_0x93d7f7['systemPrompt'],_0x19384e=_0x3062d3(0x113)+_0xc9f2bf+_0x3062d3(0x18b)+_0x2d0385;if(_0xf187c0){const {yaml:_0x440527,systemPrompt:_0x497e71}=await agentResponseToDef(_0xf187c0,_0x59155b),_0x2e0901=toAgentYamlString(_0x440527),_0x37ec57='#\x20prompt.md\x0a'+_0x497e71+'\x0a\x0a#\x20agent.yml\x0a'+_0x2e0901,_0x302a83=generateDiff(_0x37ec57,_0x19384e),_0xc89774=hasChanges(_0x302a83);_0xc89774?(_0x29f4f5[_0x3062d3(0x1a5)][_0x3062d3(0x177)]({'agentName':_0x93d7f7[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':_0x3062d3(0x123),'agentId':_0xf187c0['id'],'diff':formatDiffWithColors(_0x302a83)}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x1a5)][_0x3062d3(0x123)]++):(_0x29f4f5[_0x3062d3(0x1a5)][_0x3062d3(0x177)]({'agentName':_0x93d7f7[_0x3062d3(0x1a6)]['name'],'action':_0x3062d3(0x1c0),'agentId':_0xf187c0['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x1a5)][_0x3062d3(0x1c0)]++);}else _0x29f4f5[_0x3062d3(0x1a5)][_0x3062d3(0x177)]({'agentName':_0x93d7f7[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':_0x3062d3(0xd5)}),_0x29f4f5['counts'][_0x3062d3(0x1a5)]['created']++;}for(const _0x4e1fa9 of _0x5e2f4a){const _0x3e23fb=_0x9cea7a[_0x3062d3(0x170)](_0x4e1fa9[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)]),_0x24d63f=a152_0x265b9b['readFileSync'](_0x4e1fa9[_0x3062d3(0x165)],_0x3062d3(0xcf));if(_0x3e23fb){const _0x5f071c=await apiPromptToYaml(_0x3e23fb,_0x59155b);if(!_0x5f071c){_0x29f4f5[_0x3062d3(0x166)][_0x3062d3(0x177)]({'name':_0x4e1fa9[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':'updated','id':_0x3e23fb['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x166)][_0x3062d3(0x123)]++;continue;}const _0xb2a76d=toPromptYamlString(_0x5f071c),_0x2b4de6=generateDiff(_0xb2a76d,_0x24d63f),_0x27bbb0=hasChanges(_0x2b4de6);_0x27bbb0?(_0x29f4f5[_0x3062d3(0x166)]['push']({'name':_0x4e1fa9[_0x3062d3(0x1a6)]['name'],'action':'updated','id':_0x3e23fb['id'],'diff':formatDiffWithColors(_0x2b4de6)}),_0x29f4f5['counts']['prompts']['updated']++):(_0x29f4f5[_0x3062d3(0x166)][_0x3062d3(0x177)]({'name':_0x4e1fa9[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':_0x3062d3(0x1c0),'id':_0x3e23fb['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x166)][_0x3062d3(0x1c0)]++);}else _0x29f4f5[_0x3062d3(0x166)][_0x3062d3(0x177)]({'name':_0x4e1fa9[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':_0x3062d3(0xd5)}),_0x29f4f5['counts'][_0x3062d3(0x166)][_0x3062d3(0xd5)]++;}for(const _0x1acbb9 of _0x4510ba){const _0x3e6aed=_0xb2e664['get'](_0x1acbb9['yaml']['service_type']),_0x150261=a152_0x265b9b[_0x3062d3(0x1c2)](_0x1acbb9[_0x3062d3(0x165)],_0x3062d3(0xcf));if(_0x3e6aed){const _0x27ab27=await apiIntegrationToYaml(_0x3e6aed,_0x59155b),_0x57f812=toIntegrationYamlString(_0x27ab27),_0x567a9b=generateDiff(_0x57f812,_0x150261),_0x10d6eb=hasChanges(_0x567a9b);_0x10d6eb?(_0x29f4f5[_0x3062d3(0x1c6)][_0x3062d3(0x177)]({'name':_0x1acbb9[_0x3062d3(0x1a6)]['service_type'],'action':_0x3062d3(0x123),'id':_0x3e6aed['id'],'diff':formatDiffWithColors(_0x567a9b)}),_0x29f4f5[_0x3062d3(0xce)]['integrations'][_0x3062d3(0x123)]++):(_0x29f4f5[_0x3062d3(0x1c6)][_0x3062d3(0x177)]({'name':_0x1acbb9[_0x3062d3(0x1a6)][_0x3062d3(0x1e3)],'action':'unchanged','id':_0x3e6aed['id']}),_0x29f4f5[_0x3062d3(0xce)]['integrations'][_0x3062d3(0x1c0)]++);}else _0x29f4f5[_0x3062d3(0x1c6)]['push']({'name':_0x1acbb9[_0x3062d3(0x1a6)][_0x3062d3(0x1e3)],'action':_0x3062d3(0xd5)}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x1c6)][_0x3062d3(0xd5)]++;}for(const _0x4d0fcc of _0x455ac3){const _0x45db9e=_0xd86b27['get'](_0x4d0fcc['def'][_0x3062d3(0x1e5)]),_0x18f69d=toExperimentalKnowledgeBaseYamlString(_0x4d0fcc[_0x3062d3(0x1bc)]);let _0x48af30=_0x18f69d;for(const _0x211d8e of _0x4d0fcc[_0x3062d3(0x1bc)][_0x3062d3(0x157)]){_0x48af30+=_0x3062d3(0xeb)+_0x211d8e[_0x3062d3(0x1e5)]+'\x20---\x0a'+_0x211d8e[_0x3062d3(0xe3)]+'\x0a---\x20schema:\x20'+_0x211d8e[_0x3062d3(0x1e5)]+_0x3062d3(0x1be)+_0x211d8e[_0x3062d3(0x18d)]+'\x0a';}if(_0x45db9e){const _0x31b43a=apiExperimentalKnowledgeBaseToYaml(_0x45db9e),_0x28800b=toExperimentalKnowledgeBaseYamlString(_0x31b43a);let _0x52db51=_0x28800b;for(const _0x3922af of _0x31b43a[_0x3062d3(0x157)]){_0x52db51+=_0x3062d3(0xeb)+_0x3922af[_0x3062d3(0x1e5)]+_0x3062d3(0x1be)+_0x3922af[_0x3062d3(0xe3)]+'\x0a---\x20schema:\x20'+_0x3922af[_0x3062d3(0x1e5)]+_0x3062d3(0x1be)+_0x3922af[_0x3062d3(0x18d)]+'\x0a';}const _0x33586e=generateDiff(_0x52db51,_0x48af30),_0x459519=hasChanges(_0x33586e);_0x459519?(_0x29f4f5[_0x3062d3(0x155)]['push']({'name':_0x4d0fcc[_0x3062d3(0x1bc)]['name'],'action':_0x3062d3(0x123),'id':_0x45db9e['id'],'diff':formatDiffWithColors(_0x33586e)}),_0x29f4f5['counts'][_0x3062d3(0x155)][_0x3062d3(0x123)]++):(_0x29f4f5[_0x3062d3(0x155)]['push']({'name':_0x4d0fcc[_0x3062d3(0x1bc)][_0x3062d3(0x1e5)],'action':_0x3062d3(0x1c0),'id':_0x45db9e['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x155)]['unchanged']++);}else _0x29f4f5[_0x3062d3(0x155)][_0x3062d3(0x177)]({'name':_0x4d0fcc[_0x3062d3(0x1bc)][_0x3062d3(0x1e5)],'action':_0x3062d3(0xd5)}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x155)]['created']++;}for(const _0x430802 of _0x3393cc){const _0x1fc798=_0x1154c7[_0x3062d3(0x170)](_0x430802[_0x3062d3(0x1bc)][_0x3062d3(0x1e5)]),_0x1edf97=toExperimentalArtifactYamlString(_0x430802[_0x3062d3(0x1bc)]);let _0x5e3aa8=_0x1edf97+('\x0a---\x20code\x20---\x0a'+_0x430802[_0x3062d3(0x1bc)][_0x3062d3(0xe3)]+'\x0a');for(const _0x37f667 of _0x430802[_0x3062d3(0x1bc)][_0x3062d3(0x11e)]){_0x5e3aa8+=_0x3062d3(0x1eb)+_0x37f667['file_name']+'\x20---\x0a'+_0x37f667[_0x3062d3(0x119)]+'\x0a';}if(_0x1fc798){const _0xc23994=apiExperimentalArtifactToYaml(_0x1fc798),_0x153acb=toExperimentalArtifactYamlString(_0xc23994);let _0x8cdce3=_0x153acb+(_0x3062d3(0x120)+_0xc23994[_0x3062d3(0xe3)]+'\x0a');for(const _0x3a97f9 of _0xc23994['files']){_0x8cdce3+=_0x3062d3(0x1eb)+_0x3a97f9[_0x3062d3(0xfc)]+_0x3062d3(0x1be)+_0x3a97f9[_0x3062d3(0x119)]+'\x0a';}const _0x5e9d70=generateDiff(_0x8cdce3,_0x5e3aa8),_0xe314ad=hasChanges(_0x5e9d70);_0xe314ad?(_0x29f4f5[_0x3062d3(0xf1)][_0x3062d3(0x177)]({'name':_0x430802[_0x3062d3(0x1bc)]['name'],'action':_0x3062d3(0x123),'id':_0x1fc798['id'],'diff':formatDiffWithColors(_0x5e9d70)}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0xf1)]['updated']++):(_0x29f4f5[_0x3062d3(0xf1)][_0x3062d3(0x177)]({'name':_0x430802[_0x3062d3(0x1bc)]['name'],'action':_0x3062d3(0x1c0),'id':_0x1fc798['id']}),_0x29f4f5[_0x3062d3(0xce)]['experimentalArtifacts'][_0x3062d3(0x1c0)]++);}else _0x29f4f5['experimentalArtifacts'][_0x3062d3(0x177)]({'name':_0x430802[_0x3062d3(0x1bc)][_0x3062d3(0x1e5)],'action':_0x3062d3(0xd5)}),_0x29f4f5[_0x3062d3(0xce)]['experimentalArtifacts'][_0x3062d3(0xd5)]++;}for(const _0x177be1 of _0x5887a8){const _0x25a39f=_0x20bb15[_0x3062d3(0x170)](_0x177be1['yaml'][_0x3062d3(0x1e5)]),_0x54f4e4=a152_0x265b9b[_0x3062d3(0x1c2)](_0x177be1[_0x3062d3(0x165)],_0x3062d3(0xcf));if(_0x25a39f){const _0x363c87=await apiFormInterfaceToYaml(_0x25a39f,_0x59155b),_0x3c21c0=toFormInterfaceYamlString(_0x363c87),_0x3c73b4=generateDiff(_0x3c21c0,_0x54f4e4),_0x18eac7=hasChanges(_0x3c73b4);_0x18eac7?(_0x29f4f5['formInterfaces']['push']({'name':_0x177be1[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':_0x3062d3(0x123),'id':_0x25a39f['id'],'diff':formatDiffWithColors(_0x3c73b4)}),_0x29f4f5[_0x3062d3(0xce)]['formInterfaces']['updated']++):(_0x29f4f5[_0x3062d3(0x1af)]['push']({'name':_0x177be1['yaml']['name'],'action':_0x3062d3(0x1c0),'id':_0x25a39f['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x1af)][_0x3062d3(0x1c0)]++);}else _0x29f4f5[_0x3062d3(0x1af)][_0x3062d3(0x177)]({'name':_0x177be1[_0x3062d3(0x1a6)]['name'],'action':'created'}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x1af)][_0x3062d3(0xd5)]++;}for(const _0x2a3494 of _0x586e29){const _0x439683=_0x4cfe4f[_0x3062d3(0x170)](_0x2a3494[_0x3062d3(0x1a6)]['name']),_0x562549=a152_0x265b9b[_0x3062d3(0x1c2)](_0x2a3494[_0x3062d3(0x165)],_0x3062d3(0xcf));if(_0x439683){const _0xdebd37=await apiChatInterfaceToYaml(_0x439683,_0x59155b),_0xe6835=toChatInterfaceYamlString(_0xdebd37),_0x2aaff6=generateDiff(_0xe6835,_0x562549),_0x18ae78=hasChanges(_0x2aaff6);_0x18ae78?(_0x29f4f5[_0x3062d3(0xfa)][_0x3062d3(0x177)]({'name':_0x2a3494[_0x3062d3(0x1a6)]['name'],'action':_0x3062d3(0x123),'id':_0x439683['id'],'diff':formatDiffWithColors(_0x2aaff6)}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0xfa)][_0x3062d3(0x123)]++):(_0x29f4f5[_0x3062d3(0xfa)][_0x3062d3(0x177)]({'name':_0x2a3494[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':_0x3062d3(0x1c0),'id':_0x439683['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0xfa)]['unchanged']++);}else _0x29f4f5[_0x3062d3(0xfa)][_0x3062d3(0x177)]({'name':_0x2a3494[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':_0x3062d3(0xd5)}),_0x29f4f5[_0x3062d3(0xce)]['chatInterfaces'][_0x3062d3(0xd5)]++;}if(_0x173ba0?.[_0x3062d3(0x142)])return _0x29f4f5;_0x29f4f5[_0x3062d3(0x129)]=[],_0x29f4f5[_0x3062d3(0x131)]=[],_0x29f4f5['prompts']=[],_0x29f4f5[_0x3062d3(0x1c6)]=[],_0x29f4f5[_0x3062d3(0x155)]=[],_0x29f4f5[_0x3062d3(0xf1)]=[],_0x29f4f5[_0x3062d3(0x1af)]=[],_0x29f4f5[_0x3062d3(0xfa)]=[];const _0x5e3eea=_0x29f4f5[_0x3062d3(0x1a5)]['filter'](_0x4e3122=>_0x4e3122['action']===_0x3062d3(0x1cf));_0x29f4f5[_0x3062d3(0x1a5)]=_0x5e3eea,_0x29f4f5[_0x3062d3(0xce)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x5e3eea['length']},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x3feaad of _0xb0f41c){try{const _0x5009e4=_0x114401['get'](_0x3feaad['yaml'][_0x3062d3(0x1e5)]),_0x1d19ac=yamlKnowledgeBaseToApi(_0x3feaad[_0x3062d3(0x1a6)],_0x4166b4);if(_0x5009e4)await this['client'][_0x3062d3(0x156)](_0x5009e4['id'],_0x1d19ac),_0x28d664[_0x3062d3(0x1ac)](_0x3feaad[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],_0x5009e4['id']),_0x29f4f5[_0x3062d3(0x129)][_0x3062d3(0x177)]({'name':_0x3feaad['yaml'][_0x3062d3(0x1e5)],'action':'updated','id':_0x5009e4['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x129)][_0x3062d3(0x123)]++;else{const _0x38bdcb=await this[_0x3062d3(0x1a9)]['createKnowledgeBase'](_0x1d19ac);_0x28d664[_0x3062d3(0x1ac)](_0x3feaad[_0x3062d3(0x1a6)]['name'],_0x38bdcb['id']),_0x29f4f5[_0x3062d3(0x129)]['push']({'name':_0x3feaad[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':_0x3062d3(0xd5),'id':_0x38bdcb['id']}),_0x29f4f5[_0x3062d3(0xce)]['knowledgeBases'][_0x3062d3(0xd5)]++;}}catch(_0x459706){_0x29f4f5[_0x3062d3(0x129)][_0x3062d3(0x177)]({'name':_0x3feaad['yaml'][_0x3062d3(0x1e5)],'action':_0x3062d3(0x1cf),'error':_0x459706[_0x3062d3(0x1bb)]}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x129)][_0x3062d3(0xd4)]++;}}for(const _0x1cdb6b of _0x371707){try{const _0x201908=_0x5110f3[_0x3062d3(0x170)](_0x1cdb6b[_0x3062d3(0x1e5)]),_0x4cf212=yamlTextKnowledgeBaseToApi({'name':_0x1cdb6b[_0x3062d3(0x1e5)],'text':_0x1cdb6b['text']},_0x4166b4);if(_0x201908)await this[_0x3062d3(0x1a9)]['updateTextKnowledgeBase'](_0x201908['id'],_0x4cf212),_0x4fc894[_0x3062d3(0x1ac)](_0x1cdb6b['name'],_0x201908['id']),_0x29f4f5[_0x3062d3(0x131)][_0x3062d3(0x177)]({'name':_0x1cdb6b[_0x3062d3(0x1e5)],'action':_0x3062d3(0x123),'id':_0x201908['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x131)][_0x3062d3(0x123)]++;else{const _0x2fb15f=await this['client'][_0x3062d3(0xd6)](_0x4cf212);_0x4fc894[_0x3062d3(0x1ac)](_0x1cdb6b[_0x3062d3(0x1e5)],_0x2fb15f['id']),_0x29f4f5[_0x3062d3(0x131)]['push']({'name':_0x1cdb6b['name'],'action':_0x3062d3(0xd5),'id':_0x2fb15f['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x131)]['created']++;}}catch(_0x14ad4a){_0x29f4f5[_0x3062d3(0x131)][_0x3062d3(0x177)]({'name':_0x1cdb6b[_0x3062d3(0x1e5)],'action':_0x3062d3(0x1cf),'error':_0x14ad4a[_0x3062d3(0x1bb)]}),_0x29f4f5[_0x3062d3(0xce)]['textKnowledgeBases'][_0x3062d3(0xd4)]++;}}for(const _0x5455f9 of _0x455ac3){try{const _0x500fc1=_0xd86b27[_0x3062d3(0x170)](_0x5455f9['def'][_0x3062d3(0x1e5)]),_0x79316b=yamlExperimentalKnowledgeBaseToApi(_0x5455f9['def'],_0x4166b4);if(_0x500fc1)await this[_0x3062d3(0x1a9)][_0x3062d3(0x1b0)](_0x500fc1['id'],_0x79316b),_0xcfcc82[_0x3062d3(0x1ac)](_0x5455f9[_0x3062d3(0x1bc)][_0x3062d3(0x1e5)],_0x500fc1['id']),_0x29f4f5[_0x3062d3(0x155)][_0x3062d3(0x177)]({'name':_0x5455f9[_0x3062d3(0x1bc)][_0x3062d3(0x1e5)],'action':_0x3062d3(0x123),'id':_0x500fc1['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x155)][_0x3062d3(0x123)]++;else{const _0x292291=await this['client']['createExperimentalKnowledgeBase'](_0x79316b);_0xcfcc82[_0x3062d3(0x1ac)](_0x5455f9[_0x3062d3(0x1bc)][_0x3062d3(0x1e5)],_0x292291['id']),_0x29f4f5[_0x3062d3(0x155)][_0x3062d3(0x177)]({'name':_0x5455f9['def'][_0x3062d3(0x1e5)],'action':_0x3062d3(0xd5),'id':_0x292291['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x155)][_0x3062d3(0xd5)]++;}}catch(_0x47d839){_0x29f4f5[_0x3062d3(0x155)][_0x3062d3(0x177)]({'name':_0x5455f9[_0x3062d3(0x1bc)][_0x3062d3(0x1e5)],'action':_0x3062d3(0x1cf),'error':_0x47d839[_0x3062d3(0x1bb)]}),_0x29f4f5[_0x3062d3(0xce)]['experimentalKnowledgeBases'][_0x3062d3(0xd4)]++;}}for(const _0x4e766a of _0x3393cc){try{const _0x4b9059=_0x1154c7[_0x3062d3(0x170)](_0x4e766a['def'][_0x3062d3(0x1e5)]),_0x59889e=yamlExperimentalArtifactToApi(_0x4e766a['def'],_0x4166b4);if(_0x4b9059)await this[_0x3062d3(0x1a9)]['updateExperimentalArtifact'](_0x4b9059['id'],_0x59889e),_0x5e63a5['set'](_0x4e766a[_0x3062d3(0x1bc)][_0x3062d3(0x1e5)],_0x4b9059['id']),_0x29f4f5[_0x3062d3(0xf1)][_0x3062d3(0x177)]({'name':_0x4e766a['def'][_0x3062d3(0x1e5)],'action':_0x3062d3(0x123),'id':_0x4b9059['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0xf1)][_0x3062d3(0x123)]++;else{const _0x464a5b=await this['client'][_0x3062d3(0x16b)](_0x59889e);_0x5e63a5[_0x3062d3(0x1ac)](_0x4e766a[_0x3062d3(0x1bc)][_0x3062d3(0x1e5)],_0x464a5b['id']),_0x29f4f5[_0x3062d3(0xf1)][_0x3062d3(0x177)]({'name':_0x4e766a[_0x3062d3(0x1bc)][_0x3062d3(0x1e5)],'action':_0x3062d3(0xd5),'id':_0x464a5b['id']}),_0x29f4f5[_0x3062d3(0xce)]['experimentalArtifacts']['created']++;}}catch(_0x3925f4){_0x29f4f5[_0x3062d3(0xf1)][_0x3062d3(0x177)]({'name':_0x4e766a[_0x3062d3(0x1bc)]['name'],'action':_0x3062d3(0x1cf),'error':_0x3925f4[_0x3062d3(0x1bb)]}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0xf1)]['errors']++;}}for(const _0x388c18 of _0xac5193){_0x59bd80=[];try{const _0x5654f6=_0x5953b7['get'](_0x388c18['yaml'][_0x3062d3(0x1e5)]),_0x24b2c1=await agentDefToRequest(_0x388c18[_0x3062d3(0x1a6)],_0x388c18[_0x3062d3(0x171)],_0x388c18[_0x3062d3(0xe6)],_0x31428f);if(_0x5654f6)await this[_0x3062d3(0x1a9)]['updateAgentResponse'](_0x5654f6['id'],_0x24b2c1),_0x14d448[_0x3062d3(0x1ac)](_0x388c18[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],_0x5654f6['id']),_0x29f4f5['agents'][_0x3062d3(0x177)]({'agentName':_0x388c18[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':_0x3062d3(0x123),'agentId':_0x5654f6['id'],'warnings':_0x59bd80[_0x3062d3(0x192)]>0x0?_0x59bd80:undefined}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x1a5)]['updated']++;else{const _0x8d8f06=await this[_0x3062d3(0x1a9)]['createAgentResponse'](_0x24b2c1);_0x14d448[_0x3062d3(0x1ac)](_0x388c18[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],_0x8d8f06['id']),_0x29f4f5[_0x3062d3(0x1a5)][_0x3062d3(0x177)]({'agentName':_0x388c18[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':_0x3062d3(0xd5),'agentId':_0x8d8f06['id'],'warnings':_0x59bd80['length']>0x0?_0x59bd80:undefined}),_0x29f4f5['counts'][_0x3062d3(0x1a5)]['created']++;}}catch(_0x5376fb){_0x29f4f5[_0x3062d3(0x1a5)]['push']({'agentName':_0x388c18[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':_0x3062d3(0x1cf),'error':_0x5376fb[_0x3062d3(0x1bb)],'warnings':_0x59bd80[_0x3062d3(0x192)]>0x0?_0x59bd80:undefined}),_0x29f4f5[_0x3062d3(0xce)]['agents'][_0x3062d3(0xd4)]++;}}for(const _0x2e6c16 of _0x5e2f4a){try{const _0x39fde2=_0x9cea7a['get'](_0x2e6c16[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)]),_0x474aa2=await yamlPromptToApi(_0x2e6c16[_0x3062d3(0x1a6)],_0x4166b4,_0x31428f);if(!_0x474aa2){_0x29f4f5[_0x3062d3(0x166)][_0x3062d3(0x177)]({'name':_0x2e6c16[_0x3062d3(0x1a6)]['name'],'action':'error','error':'Agent\x20reference\x20not\x20found'}),_0x29f4f5['counts'][_0x3062d3(0x166)][_0x3062d3(0xd4)]++;continue;}if(_0x39fde2)await this['client'][_0x3062d3(0x167)](_0x39fde2['id'],_0x474aa2),_0x16249b[_0x3062d3(0x1ac)](_0x2e6c16[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],_0x39fde2['id']),_0x29f4f5[_0x3062d3(0x166)][_0x3062d3(0x177)]({'name':_0x2e6c16['yaml']['name'],'action':_0x3062d3(0x123),'id':_0x39fde2['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x166)][_0x3062d3(0x123)]++;else{const _0x4a9571=await this[_0x3062d3(0x1a9)][_0x3062d3(0x15e)](_0x474aa2);_0x16249b[_0x3062d3(0x1ac)](_0x2e6c16[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],_0x4a9571['id']),_0x29f4f5[_0x3062d3(0x166)]['push']({'name':_0x2e6c16['yaml']['name'],'action':_0x3062d3(0xd5),'id':_0x4a9571['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x166)]['created']++;}}catch(_0x3cc3bd){_0x29f4f5[_0x3062d3(0x166)][_0x3062d3(0x177)]({'name':_0x2e6c16[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':'error','error':_0x3cc3bd[_0x3062d3(0x1bb)]}),_0x29f4f5[_0x3062d3(0xce)]['prompts'][_0x3062d3(0xd4)]++;}}for(const _0x8f5a8c of _0x4510ba){try{const _0x1c7c42=_0xb2e664[_0x3062d3(0x170)](_0x8f5a8c[_0x3062d3(0x1a6)][_0x3062d3(0x1e3)]),_0x343973=await yamlIntegrationToApi(_0x8f5a8c[_0x3062d3(0x1a6)],_0x4166b4,_0x31428f);if(_0x1c7c42){await this[_0x3062d3(0x1a9)]['deleteIntegration'](_0x1c7c42['id']);const _0x3f24e7=await this['client'][_0x3062d3(0x10e)](_0x343973);_0x29f4f5[_0x3062d3(0x1c6)][_0x3062d3(0x177)]({'name':_0x8f5a8c[_0x3062d3(0x1a6)][_0x3062d3(0x1e3)],'action':'updated','id':_0x3f24e7['id']}),_0x29f4f5[_0x3062d3(0xce)]['integrations'][_0x3062d3(0x123)]++;}else{const _0x4c6767=await this[_0x3062d3(0x1a9)]['createIntegration'](_0x343973);_0x29f4f5[_0x3062d3(0x1c6)]['push']({'name':_0x8f5a8c[_0x3062d3(0x1a6)][_0x3062d3(0x1e3)],'action':'created','id':_0x4c6767['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x1c6)][_0x3062d3(0xd5)]++;}}catch(_0x44ae67){_0x29f4f5['integrations'][_0x3062d3(0x177)]({'name':_0x8f5a8c[_0x3062d3(0x1a6)]['service_type'],'action':_0x3062d3(0x1cf),'error':_0x44ae67['message']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x1c6)]['errors']++;}}for(const _0x34b3f3 of _0x5887a8){try{const _0x4ff096=_0x20bb15['get'](_0x34b3f3[_0x3062d3(0x1a6)]['name']),_0x54b5e6=await yamlFormInterfaceToApi(_0x34b3f3[_0x3062d3(0x1a6)],_0x4166b4,_0x31428f);if(!_0x54b5e6){_0x29f4f5[_0x3062d3(0x1af)][_0x3062d3(0x177)]({'name':_0x34b3f3['yaml'][_0x3062d3(0x1e5)],'action':'error','error':_0x3062d3(0xe7)}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x1af)][_0x3062d3(0xd4)]++;continue;}if(_0x4ff096){const _0x527c16=await this[_0x3062d3(0x1a9)][_0x3062d3(0x16c)](_0x4ff096['id'],_0x54b5e6);_0x29f4f5[_0x3062d3(0x1af)][_0x3062d3(0x177)]({'name':_0x34b3f3[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':'updated','id':_0x527c16['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x1af)][_0x3062d3(0x123)]++;}else{const _0x4b87a6=await this[_0x3062d3(0x1a9)][_0x3062d3(0xf0)](_0x54b5e6);_0x29f4f5['formInterfaces'][_0x3062d3(0x177)]({'name':_0x34b3f3['yaml']['name'],'action':_0x3062d3(0xd5),'id':_0x4b87a6['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x1af)]['created']++;}}catch(_0xe33935){_0x29f4f5[_0x3062d3(0x1af)][_0x3062d3(0x177)]({'name':_0x34b3f3[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':_0x3062d3(0x1cf),'error':_0xe33935[_0x3062d3(0x1bb)]}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0x1af)]['errors']++;}}for(const _0x122148 of _0x586e29){try{const _0x159c50=_0x4cfe4f[_0x3062d3(0x170)](_0x122148['yaml'][_0x3062d3(0x1e5)]),_0x580189=await yamlChatInterfaceToApi(_0x122148[_0x3062d3(0x1a6)],_0x4166b4,_0x31428f);if(_0x159c50){const _0x55000c=await this[_0x3062d3(0x1a9)][_0x3062d3(0x150)](_0x159c50['id'],_0x580189);_0x29f4f5[_0x3062d3(0xfa)]['push']({'name':_0x122148[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':_0x3062d3(0x123),'id':_0x55000c['id']}),_0x29f4f5[_0x3062d3(0xce)][_0x3062d3(0xfa)]['updated']++;}else{const _0x26aa73=await this[_0x3062d3(0x1a9)][_0x3062d3(0x11f)](_0x580189);_0x29f4f5[_0x3062d3(0xfa)]['push']({'name':_0x122148[_0x3062d3(0x1a6)]['name'],'action':'created','id':_0x26aa73['id']}),_0x29f4f5[_0x3062d3(0xce)]['chatInterfaces'][_0x3062d3(0xd5)]++;}}catch(_0x6ab1f7){_0x29f4f5['chatInterfaces'][_0x3062d3(0x177)]({'name':_0x122148[_0x3062d3(0x1a6)][_0x3062d3(0x1e5)],'action':'error','error':_0x6ab1f7['message']}),_0x29f4f5[_0x3062d3(0xce)]['chatInterfaces'][_0x3062d3(0xd4)]++;}}return _0x29f4f5;}async[a152_0x2f9e7b(0x179)](_0x1f7787,_0x31a09e,_0x3b7e1b,_0x49185b){const _0x49b685=a152_0x2f9e7b,{projectId:_0x2cb6e5,project:_0x5010fc}=await this[_0x49b685(0x121)](_0x1f7787),_0x4d9bca=_0x5010fc[_0x49b685(0xdc)][_0x49b685(0x1e5)],_0x2a262e=await this[_0x49b685(0x1a9)]['listAgentsFull'](_0x2cb6e5),_0x43acc8=_0x2a262e[_0x49b685(0x18f)](_0x64035a=>_0x64035a[_0x49b685(0xdc)][_0x49b685(0x1e5)]===_0x31a09e);if(!_0x43acc8)throw new SDKError(ErrorCode[_0x49b685(0x161)],_0x49b685(0x144)+_0x31a09e,undefined,{'helpText':'Available\x20agents:\x20'+_0x2a262e[_0x49b685(0x12d)](_0x38a1f4=>_0x38a1f4[_0x49b685(0xdc)][_0x49b685(0x1e5)])[_0x49b685(0x1ec)](',\x20')});let _0x111044;if(_0x3b7e1b)_0x111044=_0x3b7e1b;else{const _0x275482=a152_0x5cf51a['join'](process[_0x49b685(0x122)](),_0x49b685(0x1a5)),_0x2d7e19=getSanitizedPathWithMigration(_0x275482,_0x4d9bca);_0x2d7e19['renamed']&&this[_0x49b685(0xd8)][_0x49b685(0x1d0)](_0x49b685(0x103)+a152_0x5cf51a[_0x49b685(0x1b2)](_0x2d7e19[_0x49b685(0x10f)])+'\x20→\x20'+a152_0x5cf51a[_0x49b685(0x1b2)](_0x2d7e19[_0x49b685(0x165)])),_0x111044=_0x2d7e19[_0x49b685(0x165)];}const _0x302919=getSanitizedPathWithMigration(_0x111044,_0x31a09e);_0x302919[_0x49b685(0xee)]&&this['logger'][_0x49b685(0x1d0)](_0x49b685(0x191)+a152_0x5cf51a[_0x49b685(0x1b2)](_0x302919['oldPath'])+_0x49b685(0x19f)+a152_0x5cf51a[_0x49b685(0x1b2)](_0x302919[_0x49b685(0x165)]));const _0x41e55c=_0x302919['path'],_0x5f1fb6=new Map(),_0x2da9ed=new Map(),_0x59a668=await this[_0x49b685(0x1a9)]['listKnowledgeBases'](_0x2cb6e5),_0x37a3f3=await this['client'][_0x49b685(0x104)](_0x2cb6e5),_0x5490a0=await safeListOrEmpty(()=>this[_0x49b685(0x1a9)][_0x49b685(0x1bd)](_0x2cb6e5)),_0x1acdb6=new Map(),_0x3c0fd5=new Map();for(const _0x5bfe59 of _0x59a668){_0x5f1fb6[_0x49b685(0x1ac)](_0x5bfe59['id'],_0x5bfe59['attributes']['name']);}for(const _0x16d341 of _0x37a3f3){_0x1acdb6[_0x49b685(0x1ac)](_0x16d341['id'],_0x16d341[_0x49b685(0xdc)][_0x49b685(0x1e5)]);}for(const _0x3be3e1 of _0x5490a0){_0x3c0fd5[_0x49b685(0x1ac)](_0x3be3e1['id'],_0x3be3e1['attributes'][_0x49b685(0x1e5)]);}for(const _0x23982f of _0x2a262e){_0x2da9ed[_0x49b685(0x1ac)](_0x23982f['id'],_0x23982f['attributes']['name']);}const _0x5dcf7e={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x5f1fb6,'TextKnowledgeBase':_0x1acdb6,'Agent':_0x2da9ed,'ExperimentalKnowledgeBase':_0x3c0fd5}),'resolvePromptName':async()=>undefined,'onWarning':_0x33cc07=>this[_0x49b685(0xd8)][_0x49b685(0xf4)](_0x33cc07)},_0x4c1641=a152_0x5cf51a['join'](_0x41e55c,_0x49b685(0x133)),_0x18d3d0=a152_0x5cf51a[_0x49b685(0x1ec)](_0x41e55c,_0x49b685(0x138)),_0x3dd4af=a152_0x5cf51a['join'](_0x41e55c,_0x49b685(0x1c1)),_0x329891=!a152_0x265b9b[_0x49b685(0x19d)](_0x18d3d0);if(_0x49185b?.[_0x49b685(0x142)])return{'agentName':_0x31a09e,'outputPath':_0x41e55c,'isNew':_0x329891,'hasChanges':!![]};a152_0x265b9b['mkdirSync'](_0x111044,{'recursive':!![]}),a152_0x265b9b[_0x49b685(0x124)](_0x41e55c,{'recursive':!![]});const _0x4945cc=a152_0x5cf51a[_0x49b685(0x1ec)](_0x111044,'tdx.json');!a152_0x265b9b[_0x49b685(0x19d)](_0x4945cc)&&a152_0x265b9b[_0x49b685(0x1e9)](_0x4945cc,createAgentConfigContent(_0x1f7787));const {yaml:_0x50a87b,systemPrompt:_0x28c666,starterMessage:_0x5e2735}=await agentResponseToDef(_0x43acc8,_0x5dcf7e);let _0x30dcdc=_0x329891;if(!_0x329891){const _0x208a48=a152_0x265b9b['existsSync'](_0x4c1641)?a152_0x265b9b[_0x49b685(0x1c2)](_0x4c1641,_0x49b685(0xcf)):'',_0x2248f4=a152_0x265b9b['readFileSync'](_0x18d3d0,_0x49b685(0xcf));_0x30dcdc=_0x208a48!==_0x28c666||_0x2248f4!==toAgentYamlString(_0x50a87b);}a152_0x265b9b['writeFileSync'](_0x4c1641,_0x28c666),a152_0x265b9b[_0x49b685(0x1e9)](_0x18d3d0,toAgentYamlString(_0x50a87b));if(_0x5e2735&&_0x5e2735[_0x49b685(0x14a)]('\x0a'))a152_0x265b9b[_0x49b685(0x1e9)](_0x3dd4af,_0x5e2735);else a152_0x265b9b[_0x49b685(0x19d)](_0x3dd4af)&&a152_0x265b9b[_0x49b685(0x1c8)](_0x3dd4af);return{'agentName':_0x31a09e,'outputPath':_0x41e55c,'isNew':_0x329891,'hasChanges':_0x30dcdc};}async['pushAgent'](_0x2dcad3,_0x16f83d){const _0x3ebe81=a152_0x2f9e7b;let _0x51a0da;isAgentYamlPath(_0x2dcad3)?_0x51a0da=getAgentDirFromYamlPath(_0x2dcad3):_0x51a0da=_0x2dcad3;const {config:_0x3a98e3}=findAgentConfig(_0x51a0da),_0x2f19a1=await this[_0x3ebe81(0x13c)](_0x3a98e3['llm_project']),_0x104552=a152_0x5cf51a[_0x3ebe81(0x1ec)](_0x51a0da,_0x3ebe81(0x138)),_0x272ff5=a152_0x5cf51a['join'](_0x51a0da,'prompt.md'),_0x2bbe91=a152_0x5cf51a['join'](_0x51a0da,_0x3ebe81(0x1c1));if(!a152_0x265b9b[_0x3ebe81(0x19d)](_0x104552))throw new SDKError(ErrorCode[_0x3ebe81(0x100)],_0x3ebe81(0x13f)+_0x51a0da,undefined,{'helpText':_0x3ebe81(0xd3)});const _0x47a7f0=parseAgentYaml(a152_0x265b9b[_0x3ebe81(0x1c2)](_0x104552,_0x3ebe81(0xcf)),_0x104552),_0x11c50b=a152_0x265b9b[_0x3ebe81(0x19d)](_0x272ff5)?a152_0x265b9b[_0x3ebe81(0x1c2)](_0x272ff5,_0x3ebe81(0xcf)):'',_0x209195=a152_0x265b9b[_0x3ebe81(0x19d)](_0x2bbe91)?a152_0x265b9b[_0x3ebe81(0x1c2)](_0x2bbe91,_0x3ebe81(0xcf)):_0x47a7f0[_0x3ebe81(0x168)];if(_0x16f83d?.[_0x3ebe81(0x142)])return{'agentName':_0x47a7f0[_0x3ebe81(0x1e5)],'action':_0x3ebe81(0xd5),'projectId':_0x2f19a1};const _0x5c4389=await this['client']['listAgentsFull'](_0x2f19a1),_0x48c351=await fetchAllToolTargetMaps((_0x44761f,_0x2a9747)=>this['client']['listToolTargets'](_0x44761f,_0x2a9747),_0x2f19a1),_0x15b1bd=new Map();for(const _0x4df4d6 of _0x5c4389){_0x15b1bd[_0x3ebe81(0x1ac)](_0x4df4d6[_0x3ebe81(0xdc)][_0x3ebe81(0x1e5)],_0x4df4d6['id']);}const _0x31f4ab=[],_0x495eba={'projectId':_0x2f19a1,'resolveToolTargetId':buildIdResolver({..._0x48c351[_0x3ebe81(0x189)],'Agent':_0x15b1bd}),'resolvePromptId':async()=>undefined,'onWarning':_0x144403=>{const _0x1ba1ec=_0x3ebe81;this[_0x1ba1ec(0xd8)][_0x1ba1ec(0xf4)](_0x144403),_0x31f4ab[_0x1ba1ec(0x177)](_0x144403);}};try{const _0x3ce361=_0x5c4389[_0x3ebe81(0x18f)](_0x5544e3=>_0x5544e3[_0x3ebe81(0xdc)][_0x3ebe81(0x1e5)]===_0x47a7f0[_0x3ebe81(0x1e5)]),_0x4aada1=await agentDefToRequest(_0x47a7f0,_0x11c50b,_0x209195,_0x495eba);if(_0x3ce361)return await this[_0x3ebe81(0x1a9)][_0x3ebe81(0xea)](_0x3ce361['id'],_0x4aada1),{'agentName':_0x47a7f0['name'],'action':_0x3ebe81(0x123),'projectId':_0x2f19a1,'agentId':_0x3ce361['id'],'warnings':_0x31f4ab[_0x3ebe81(0x192)]>0x0?_0x31f4ab:undefined};else{const _0x94586=await this[_0x3ebe81(0x1a9)][_0x3ebe81(0x15b)](_0x4aada1);return{'agentName':_0x47a7f0[_0x3ebe81(0x1e5)],'action':'created','projectId':_0x2f19a1,'agentId':_0x94586['id'],'warnings':_0x31f4ab[_0x3ebe81(0x192)]>0x0?_0x31f4ab:undefined};}}catch(_0xa76731){return{'agentName':_0x47a7f0[_0x3ebe81(0x1e5)],'action':_0x3ebe81(0x1cf),'projectId':_0x2f19a1,'error':_0xa76731[_0x3ebe81(0x1bb)],'warnings':_0x31f4ab['length']>0x0?_0x31f4ab:undefined};}}async[a152_0x2f9e7b(0x1c5)](_0x223fa8,_0x51ef46,_0x49dcc7){const _0x479ee6=a152_0x2f9e7b,_0x4f9eb2=a152_0x265b9b[_0x479ee6(0x19d)](_0x223fa8)&&a152_0x265b9b[_0x479ee6(0x19d)](a152_0x5cf51a[_0x479ee6(0x1ec)](_0x223fa8,_0x479ee6(0x18c)));let _0x211556;const _0x194536=[],_0x31219f=[],_0x436e1f=[],_0x27ebe4=[],_0x22f92d=[],_0x525b8f=[],_0x24af02=[],_0x2d7cbe=[],_0x4086ba=[];if(_0x4f9eb2){const _0x443fa5=loadAgentConfig(a152_0x5cf51a[_0x479ee6(0x1ec)](_0x223fa8,_0x479ee6(0x18c)));_0x211556=_0x443fa5[_0x479ee6(0x178)];const _0x31b7e3=a152_0x265b9b[_0x479ee6(0x15c)](_0x223fa8,{'withFileTypes':!![]});for(const _0x549bf5 of _0x31b7e3){if(!_0x549bf5[_0x479ee6(0x19b)]())continue;if([_0x479ee6(0x1d2),'experimental_knowledge_bases',_0x479ee6(0x184),_0x479ee6(0x166),_0x479ee6(0x1c6),_0x479ee6(0x1de),'chat_interfaces'][_0x479ee6(0x14a)](_0x549bf5['name']))continue;const _0x5b0559=a152_0x5cf51a[_0x479ee6(0x1ec)](_0x223fa8,_0x549bf5['name']);if(isAgentDir(_0x5b0559)){const _0x5c6b25=a152_0x5cf51a[_0x479ee6(0x1ec)](_0x5b0559,'agent.yml'),_0x127673=a152_0x5cf51a[_0x479ee6(0x1ec)](_0x5b0559,_0x479ee6(0x133)),_0x4f321a=a152_0x5cf51a[_0x479ee6(0x1ec)](_0x5b0559,'starter_message.md'),_0x58aef7=parseAgentYaml(a152_0x265b9b[_0x479ee6(0x1c2)](_0x5c6b25,_0x479ee6(0xcf)),_0x5c6b25),_0x1f8fd3=a152_0x265b9b[_0x479ee6(0x19d)](_0x127673)?a152_0x265b9b[_0x479ee6(0x1c2)](_0x127673,_0x479ee6(0xcf)):'',_0x3038c8=a152_0x265b9b[_0x479ee6(0x19d)](_0x4f321a)?a152_0x265b9b[_0x479ee6(0x1c2)](_0x4f321a,_0x479ee6(0xcf)):_0x58aef7[_0x479ee6(0x168)];_0x194536[_0x479ee6(0x177)]({'name':_0x58aef7[_0x479ee6(0x1e5)],'dir':_0x5b0559,'yaml':_0x58aef7,'systemPrompt':_0x1f8fd3,'starterMessage':_0x3038c8});}}const _0x17039e=getKnowledgeBasesDir(_0x223fa8);if(a152_0x265b9b[_0x479ee6(0x19d)](_0x17039e)){const _0x112c82=a152_0x265b9b[_0x479ee6(0x15c)](_0x17039e);for(const _0x34e483 of _0x112c82){const _0x52282d=a152_0x5cf51a['join'](_0x17039e,_0x34e483);if(_0x34e483['endsWith'](_0x479ee6(0x1d4))){const _0x54fc11=parseKnowledgeBaseYaml(a152_0x265b9b[_0x479ee6(0x1c2)](_0x52282d,'utf-8'),_0x52282d);_0x31219f['push']({'name':_0x54fc11[_0x479ee6(0x1e5)],'path':_0x52282d,'yaml':_0x54fc11});}else{if(_0x34e483[_0x479ee6(0x127)]('.md')){const _0x2d6b11=a152_0x265b9b[_0x479ee6(0x1c2)](_0x52282d,_0x479ee6(0xcf)),{name:_0x1b8242,text:_0x246bef}=parseTextKnowledgeBaseMd(_0x2d6b11,_0x34e483);_0x436e1f[_0x479ee6(0x177)]({'name':_0x1b8242,'path':_0x52282d,'text':_0x246bef});}}}}const _0x313a8d=getPromptsDir(_0x223fa8);if(a152_0x265b9b['existsSync'](_0x313a8d)){const _0x50604a=a152_0x265b9b[_0x479ee6(0x15c)](_0x313a8d)['filter'](_0x3200be=>_0x3200be[_0x479ee6(0x127)]('.yml'));for(const _0x2ba626 of _0x50604a){const _0x25307e=a152_0x5cf51a[_0x479ee6(0x1ec)](_0x313a8d,_0x2ba626),_0x2c62a9=parsePromptYaml(a152_0x265b9b[_0x479ee6(0x1c2)](_0x25307e,_0x479ee6(0xcf)),_0x25307e);_0x27ebe4[_0x479ee6(0x177)]({'name':_0x2c62a9[_0x479ee6(0x1e5)],'path':_0x25307e,'yaml':_0x2c62a9});}}const _0x4c9f75=getIntegrationsDir(_0x223fa8);if(a152_0x265b9b[_0x479ee6(0x19d)](_0x4c9f75)){const _0x24d84d=a152_0x265b9b[_0x479ee6(0x15c)](_0x4c9f75)['filter'](_0x4944=>_0x4944[_0x479ee6(0x127)](_0x479ee6(0x1d4)));for(const _0x24ba67 of _0x24d84d){const _0x8ba1d5=a152_0x5cf51a[_0x479ee6(0x1ec)](_0x4c9f75,_0x24ba67),_0x22504a=parseIntegrationYaml(a152_0x265b9b[_0x479ee6(0x1c2)](_0x8ba1d5,_0x479ee6(0xcf)),_0x8ba1d5);SAFE_INTEGRATION_TYPES[_0x479ee6(0x14a)](_0x22504a['service_type'][_0x479ee6(0x196)]())?_0x22f92d[_0x479ee6(0x177)]({'name':_0x22504a['name'],'path':_0x8ba1d5,'yaml':_0x22504a}):this[_0x479ee6(0xd8)][_0x479ee6(0xf4)]('Skipping\x20integration\x20\x27'+_0x22504a[_0x479ee6(0x1e5)]+_0x479ee6(0x174)+_0x22504a['service_type']+'):\x20'+(_0x479ee6(0x1b3)+SAFE_INTEGRATION_TYPES[_0x479ee6(0x1ec)](',\x20')+')\x20can\x20be\x20cloned.'));}}const _0x504e88=getExperimentalKnowledgeBasesDir(_0x223fa8);if(a152_0x265b9b[_0x479ee6(0x19d)](_0x504e88)){const _0x28c333=a152_0x265b9b[_0x479ee6(0x15c)](_0x504e88,{'withFileTypes':!![]});for(const _0x36ad0b of _0x28c333){if(!_0x36ad0b[_0x479ee6(0x19b)]())continue;const _0x3a9d02=a152_0x5cf51a['join'](_0x504e88,_0x36ad0b[_0x479ee6(0x1e5)]),_0x182f94=a152_0x5cf51a['join'](_0x3a9d02,_0x36ad0b[_0x479ee6(0x1e5)]+_0x479ee6(0x1d4));if(a152_0x265b9b[_0x479ee6(0x19d)](_0x182f94)){const _0x1b988f=parseExperimentalKnowledgeBaseYaml(a152_0x265b9b['readFileSync'](_0x182f94,_0x479ee6(0xcf)),_0x182f94),_0x8f3f6a=a152_0x5cf51a['join'](_0x3a9d02,'functions'),_0x1ad9f0=[];if(a152_0x265b9b[_0x479ee6(0x19d)](_0x8f3f6a)){const _0x29969c=a152_0x265b9b[_0x479ee6(0x15c)](_0x8f3f6a,{'withFileTypes':!![]});for(const _0x3562f9 of _0x29969c){if(!_0x3562f9[_0x479ee6(0x19b)]())continue;const _0x4ee936=a152_0x5cf51a[_0x479ee6(0x1ec)](_0x8f3f6a,_0x3562f9[_0x479ee6(0x1e5)]),_0x58acfc=a152_0x5cf51a[_0x479ee6(0x1ec)](_0x4ee936,_0x479ee6(0xef)),_0x1ec3ca=a152_0x5cf51a[_0x479ee6(0x1ec)](_0x4ee936,_0x479ee6(0xf2));if(a152_0x265b9b[_0x479ee6(0x19d)](_0x58acfc)&&a152_0x265b9b[_0x479ee6(0x19d)](_0x1ec3ca)){const _0x1a20a6=a152_0x265b9b[_0x479ee6(0x1c2)](_0x58acfc,_0x479ee6(0xcf)),_0x4bf1c0=a152_0x265b9b[_0x479ee6(0x1c2)](_0x1ec3ca,_0x479ee6(0xcf));_0x1ad9f0['push']({'name':_0x3562f9[_0x479ee6(0x1e5)],'code':_0x1a20a6,'json_schema':_0x4bf1c0});}}}const _0x17d3d0={..._0x1b988f,'functions':_0x1ad9f0};_0x525b8f[_0x479ee6(0x177)]({'name':_0x1b988f[_0x479ee6(0x1e5)],'path':_0x3a9d02,'def':_0x17d3d0});}}}const _0x11ebe3=getExperimentalArtifactsDir(_0x223fa8);if(a152_0x265b9b[_0x479ee6(0x19d)](_0x11ebe3)){const _0x344caa=a152_0x265b9b[_0x479ee6(0x15c)](_0x11ebe3,{'withFileTypes':!![]});for(const _0x6fe024 of _0x344caa){if(!_0x6fe024[_0x479ee6(0x19b)]())continue;const _0x3944d1=a152_0x5cf51a[_0x479ee6(0x1ec)](_0x11ebe3,_0x6fe024[_0x479ee6(0x1e5)]),_0x48ac1d=a152_0x5cf51a[_0x479ee6(0x1ec)](_0x3944d1,_0x6fe024['name']+_0x479ee6(0x1d4));if(a152_0x265b9b[_0x479ee6(0x19d)](_0x48ac1d)){const _0x1478b4=parseExperimentalArtifactYaml(a152_0x265b9b[_0x479ee6(0x1c2)](_0x48ac1d,_0x479ee6(0xcf)),_0x48ac1d),_0x43563b=a152_0x5cf51a['join'](_0x3944d1,'code.js'),_0x54af83=a152_0x265b9b[_0x479ee6(0x19d)](_0x43563b)?a152_0x265b9b[_0x479ee6(0x1c2)](_0x43563b,_0x479ee6(0xcf)):'',_0xe16820=a152_0x5cf51a[_0x479ee6(0x1ec)](_0x3944d1,_0x479ee6(0x11e)),_0x38b238=[];if(a152_0x265b9b[_0x479ee6(0x19d)](_0xe16820)){const _0x1a9093=a152_0x265b9b[_0x479ee6(0x15c)](_0xe16820);for(const _0x44cdd2 of _0x1a9093){const _0x303260=a152_0x5cf51a[_0x479ee6(0x1ec)](_0xe16820,_0x44cdd2);if(a152_0x265b9b[_0x479ee6(0xff)](_0x303260)[_0x479ee6(0x1ce)]()){const _0x86a046=a152_0x265b9b[_0x479ee6(0x1c2)](_0x303260,_0x479ee6(0xcf));_0x38b238['push']({'file_name':_0x44cdd2,'text_content':_0x86a046});}}}const _0x267519={..._0x1478b4,'code':_0x54af83,'files':_0x38b238};_0x24af02[_0x479ee6(0x177)]({'name':_0x1478b4['name'],'path':_0x3944d1,'def':_0x267519});}}}const _0x30b6d4=getFormInterfacesDir(_0x223fa8);if(a152_0x265b9b[_0x479ee6(0x19d)](_0x30b6d4)){const _0x25ec24=a152_0x265b9b[_0x479ee6(0x15c)](_0x30b6d4)[_0x479ee6(0x185)](_0x535f1e=>_0x535f1e[_0x479ee6(0x127)]('.yml'));for(const _0x3fa2ab of _0x25ec24){const _0x544e94=a152_0x5cf51a[_0x479ee6(0x1ec)](_0x30b6d4,_0x3fa2ab),_0x339d0d=parseFormInterfaceYaml(a152_0x265b9b['readFileSync'](_0x544e94,_0x479ee6(0xcf)),_0x544e94);_0x2d7cbe[_0x479ee6(0x177)]({'name':_0x339d0d[_0x479ee6(0x1e5)],'path':_0x544e94,'yaml':_0x339d0d});}}const _0x3759ea=getChatInterfacesDir(_0x223fa8);if(a152_0x265b9b[_0x479ee6(0x19d)](_0x3759ea)){const _0x45c103=a152_0x265b9b[_0x479ee6(0x15c)](_0x3759ea)[_0x479ee6(0x185)](_0x24c0ce=>_0x24c0ce[_0x479ee6(0x127)](_0x479ee6(0x1d4)));for(const _0xbc7b91 of _0x45c103){const _0x460f2f=a152_0x5cf51a['join'](_0x3759ea,_0xbc7b91),_0x18f278=parseChatInterfaceYaml(a152_0x265b9b[_0x479ee6(0x1c2)](_0x460f2f,_0x479ee6(0xcf)),_0x460f2f);_0x4086ba[_0x479ee6(0x177)]({'name':_0x18f278[_0x479ee6(0x1e5)],'path':_0x460f2f,'yaml':_0x18f278});}}}else{const _0x3e886a=await this[_0x479ee6(0x13c)](_0x223fa8),_0x12b1e8=await this[_0x479ee6(0x1a9)][_0x479ee6(0x14f)](_0x3e886a);_0x211556=_0x12b1e8['attributes'][_0x479ee6(0x1e5)];const _0x5c974c=await this[_0x479ee6(0x1a9)]['listAgentsFull'](_0x3e886a),_0x4eab23=await this[_0x479ee6(0x1a9)][_0x479ee6(0x1d3)](_0x3e886a),_0x1669ce=await this['client'][_0x479ee6(0x104)](_0x3e886a),_0x117f2e=await this[_0x479ee6(0x1a9)][_0x479ee6(0x130)](_0x3e886a),_0x18b4f7=await this[_0x479ee6(0x1a9)][_0x479ee6(0x1a3)](_0x3e886a),_0x524d95=await safeListOrEmpty(()=>this[_0x479ee6(0x1a9)][_0x479ee6(0x1bd)](_0x3e886a)),_0xde6b8e=await safeListOrEmpty(()=>this[_0x479ee6(0x1a9)][_0x479ee6(0x106)](_0x3e886a)),_0x22573c=new Map(),_0x1d6651=new Map(),_0x512d19=new Map(),_0x4a7deb=new Map(),_0xb63464=new Map(),_0x5852f1=new Map();for(const _0x1919f9 of _0x4eab23){_0x22573c['set'](_0x1919f9['id'],_0x1919f9[_0x479ee6(0xdc)][_0x479ee6(0x1e5)]);}for(const _0xeadd9f of _0x1669ce){_0x1d6651['set'](_0xeadd9f['id'],_0xeadd9f[_0x479ee6(0xdc)][_0x479ee6(0x1e5)]);}for(const _0x1e6573 of _0x5c974c){_0x512d19[_0x479ee6(0x1ac)](_0x1e6573['id'],_0x1e6573[_0x479ee6(0xdc)]['name']);}for(const _0x26008e of _0x117f2e){_0x4a7deb[_0x479ee6(0x1ac)](_0x26008e['id'],_0x26008e[_0x479ee6(0xdc)]['name']);}for(const _0x417665 of _0x524d95){_0xb63464[_0x479ee6(0x1ac)](_0x417665['id'],_0x417665['attributes'][_0x479ee6(0x1e5)]);}for(const _0x414c9c of _0xde6b8e){_0x5852f1['set'](_0x414c9c['id'],_0x414c9c[_0x479ee6(0xdc)][_0x479ee6(0x1e5)]);}const _0x59ff22={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x22573c,'TextKnowledgeBase':_0x1d6651,'Agent':_0x512d19,'ExperimentalKnowledgeBase':_0xb63464}),'resolvePromptName':async _0x27b991=>_0x4a7deb[_0x479ee6(0x170)](_0x27b991),'onWarning':_0x427fb0=>this[_0x479ee6(0xd8)][_0x479ee6(0xf4)](_0x427fb0)};for(const _0x3929d2 of _0x5c974c){const _0x42951b=await agentResponseToDef(_0x3929d2,_0x59ff22),{yaml:_0x37ebdc,systemPrompt:_0x43c215,starterMessage:_0x8437f0}=_0x42951b;_0x194536[_0x479ee6(0x177)]({'name':_0x37ebdc[_0x479ee6(0x1e5)],'dir':'','yaml':_0x37ebdc,'systemPrompt':_0x43c215,'starterMessage':_0x8437f0});}for(const _0x526ca9 of _0x4eab23){const _0x26656c=apiKnowledgeBaseToYaml(_0x526ca9);_0x31219f[_0x479ee6(0x177)]({'name':_0x26656c['name'],'path':'','yaml':_0x26656c});}for(const _0x4e130a of _0x1669ce){_0x436e1f[_0x479ee6(0x177)]({'name':_0x4e130a[_0x479ee6(0xdc)]['name'],'path':'','text':_0x4e130a[_0x479ee6(0xdc)][_0x479ee6(0x195)]});}for(const _0x277b3e of _0x117f2e){const _0x493219=await apiPromptToYaml(_0x277b3e,_0x59ff22);_0x493219&&_0x27ebe4['push']({'name':_0x493219['name'],'path':'','yaml':_0x493219});}for(const _0x2b77d5 of _0x18b4f7){if(!_0x2b77d5[_0x479ee6(0xdc)]['isManaged']&&SAFE_INTEGRATION_TYPES['includes'](_0x2b77d5[_0x479ee6(0xdc)][_0x479ee6(0x163)][_0x479ee6(0x196)]())){const _0x359729=await apiIntegrationToYaml(_0x2b77d5,_0x59ff22);_0x22f92d[_0x479ee6(0x177)]({'name':_0x2b77d5[_0x479ee6(0xdc)][_0x479ee6(0x163)][_0x479ee6(0x196)](),'path':'','yaml':_0x359729});}}for(const _0x377036 of _0x524d95){const _0x3b9f2f=apiExperimentalKnowledgeBaseToYaml(_0x377036);_0x525b8f[_0x479ee6(0x177)]({'name':_0x3b9f2f[_0x479ee6(0x1e5)],'path':'','def':_0x3b9f2f});}for(const _0x9ac4b0 of _0xde6b8e){const _0x8ffb79=apiExperimentalArtifactToYaml(_0x9ac4b0);_0x24af02[_0x479ee6(0x177)]({'name':_0x8ffb79[_0x479ee6(0x1e5)],'path':'','def':_0x8ffb79});}const _0x32d44e=await safeListOrEmpty(()=>this[_0x479ee6(0x1a9)]['listFormInterfaces'](_0x3e886a));for(const _0xff960a of _0x32d44e){const _0x43b4d9=await apiFormInterfaceToYaml(_0xff960a,_0x59ff22);_0x2d7cbe[_0x479ee6(0x177)]({'name':_0x43b4d9[_0x479ee6(0x1e5)],'path':'','yaml':_0x43b4d9});}const _0x56938d=await safeListOrEmpty(()=>this[_0x479ee6(0x1a9)][_0x479ee6(0x16f)](_0x3e886a));for(const _0x19186e of _0x56938d){if(_0x19186e[_0x479ee6(0xdc)][_0x479ee6(0x15a)])continue;const _0x5bd733=await apiChatInterfaceToYaml(_0x19186e,_0x59ff22);_0x4086ba['push']({'name':_0x5bd733[_0x479ee6(0x1e5)],'path':'','yaml':_0x5bd733});}}const _0x6cd1bd={'sourceProjectName':_0x211556,'newProjectName':_0x51ef46,'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}}},_0xe86d61=await this[_0x479ee6(0x1a9)][_0x479ee6(0xe2)](),_0x7dd8bd=_0xe86d61[_0x479ee6(0x18f)](_0x484e73=>_0x484e73[_0x479ee6(0xdc)][_0x479ee6(0x1e5)]===_0x51ef46);if(_0x7dd8bd)throw new SDKError(ErrorCode[_0x479ee6(0x11c)],_0x479ee6(0x1ea)+_0x51ef46+'\x22\x20already\x20exists',undefined,{'helpText':_0x479ee6(0x17d)});if(_0x49dcc7?.[_0x479ee6(0x142)])return _0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0x1a5)][_0x479ee6(0xd5)]=_0x194536[_0x479ee6(0x192)],_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0x129)][_0x479ee6(0xd5)]=_0x31219f[_0x479ee6(0x192)],_0x6cd1bd['counts'][_0x479ee6(0x131)][_0x479ee6(0xd5)]=_0x436e1f[_0x479ee6(0x192)],_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0x155)]['created']=_0x525b8f[_0x479ee6(0x192)],_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0xf1)][_0x479ee6(0xd5)]=_0x24af02[_0x479ee6(0x192)],_0x6cd1bd['counts'][_0x479ee6(0x166)]['created']=_0x27ebe4[_0x479ee6(0x192)],_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0x1c6)]['created']=_0x22f92d[_0x479ee6(0x192)],_0x6cd1bd;const _0x5003dc=await this[_0x479ee6(0x1a9)][_0x479ee6(0xf7)]({'name':_0x51ef46}),_0x35572d=_0x5003dc['id'];_0x6cd1bd[_0x479ee6(0x10d)]=_0x35572d;const _0x75c0ec=new Map(),_0x1f7466=new Map(),_0x46e48e=new Map(),_0x198cd8=new Map(),_0x1d5334=new Map(),_0x4ae836=new Map(),_0x337ab1=new Map(),_0x356966=new Map(),_0x2727b5=new Set(),_0x2257ed=new Set();for(const _0x41afb2 of _0x194536){for(const _0x4b7176 of _0x41afb2[_0x479ee6(0x1a6)]['tools']||[]){if(_0x4b7176[_0x479ee6(0x148)]===_0x479ee6(0x1a0)&&_0x4b7176[_0x479ee6(0x1e7)]){const _0x1eb425=parseRef(_0x4b7176[_0x479ee6(0x1e7)]);if(_0x1eb425)_0x2727b5[_0x479ee6(0xd2)](_0x1eb425[_0x479ee6(0x1e5)]);}else{if(_0x4b7176[_0x479ee6(0x148)]===_0x479ee6(0x199)&&_0x4b7176['target']){const _0x1d0378=parseRef(_0x4b7176[_0x479ee6(0x1e7)]);if(_0x1d0378)_0x2257ed['add'](_0x1d0378[_0x479ee6(0x1e5)]);}}}}for(const _0x1fea2b of _0x2727b5){try{const _0x562f8d=await this[_0x479ee6(0x1a9)][_0x479ee6(0x1a8)]({'projectId':_0x35572d,'name':_0x1fea2b});_0x1d5334[_0x479ee6(0x1ac)](_0x1fea2b,_0x562f8d['id']),_0x6cd1bd['imageGenerators'][_0x479ee6(0x177)]({'name':_0x1fea2b,'action':_0x479ee6(0xd5),'id':_0x562f8d['id']}),_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0x1c9)][_0x479ee6(0xd5)]++;}catch(_0x5e573d){_0x6cd1bd['imageGenerators']['push']({'name':_0x1fea2b,'action':'error','error':_0x5e573d['message']}),_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0x1c9)][_0x479ee6(0xd4)]++;}}for(const _0x229283 of _0x2257ed){try{const _0xe672f4=await this[_0x479ee6(0x1a9)][_0x479ee6(0xd7)]({'projectId':_0x35572d,'name':_0x229283});_0x4ae836[_0x479ee6(0x1ac)](_0x229283,_0xe672f4['id']),_0x6cd1bd[_0x479ee6(0xfe)][_0x479ee6(0x177)]({'name':_0x229283,'action':_0x479ee6(0xd5),'id':_0xe672f4['id']}),_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0xfe)]['created']++;}catch(_0x2089f3){_0x6cd1bd[_0x479ee6(0xfe)][_0x479ee6(0x177)]({'name':_0x229283,'action':_0x479ee6(0x1cf),'error':_0x2089f3[_0x479ee6(0x1bb)]}),_0x6cd1bd[_0x479ee6(0xce)]['webSearchTools'][_0x479ee6(0xd4)]++;}}const _0x6e3b1c=await fetchAllToolTargetMaps((_0x5da2b7,_0x4b934b)=>this[_0x479ee6(0x1a9)][_0x479ee6(0x1ba)](_0x5da2b7,_0x4b934b),_0x35572d);let _0x231bb4=[];const _0x299144={'projectId':_0x35572d,'resolveToolTargetId':buildIdResolver({..._0x6e3b1c[_0x479ee6(0x189)],'KnowledgeBase':_0x75c0ec,'TextKnowledgeBase':_0x1f7466,'ExperimentalKnowledgeBase':_0x337ab1,'Agent':_0x46e48e,'WebSearchTool':_0x4ae836,'ImageGenerator':_0x1d5334}),'resolvePromptId':async _0x1632f1=>_0x198cd8['get'](_0x1632f1),'onWarning':_0x3d88eb=>{const _0x21aefa=_0x479ee6;this['logger'][_0x21aefa(0xf4)](_0x3d88eb),_0x231bb4[_0x21aefa(0x177)](_0x3d88eb);}};for(const _0x4d484b of _0x31219f){try{const _0x585592=yamlKnowledgeBaseToApi(_0x4d484b[_0x479ee6(0x1a6)],_0x35572d),_0x21d327=await this[_0x479ee6(0x1a9)][_0x479ee6(0xd1)](_0x585592);_0x75c0ec[_0x479ee6(0x1ac)](_0x4d484b[_0x479ee6(0x1a6)][_0x479ee6(0x1e5)],_0x21d327['id']),_0x6cd1bd['knowledgeBases']['push']({'name':_0x4d484b[_0x479ee6(0x1a6)][_0x479ee6(0x1e5)],'action':_0x479ee6(0xd5),'id':_0x21d327['id']}),_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0x129)][_0x479ee6(0xd5)]++;}catch(_0xce8221){_0x6cd1bd[_0x479ee6(0x129)][_0x479ee6(0x177)]({'name':_0x4d484b[_0x479ee6(0x1a6)]['name'],'action':_0x479ee6(0x1cf),'error':_0xce8221[_0x479ee6(0x1bb)]}),_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0x129)][_0x479ee6(0xd4)]++;}}for(const _0x53c80a of _0x436e1f){try{const _0x4e2fdc=yamlTextKnowledgeBaseToApi({'name':_0x53c80a[_0x479ee6(0x1e5)],'text':_0x53c80a[_0x479ee6(0x195)]},_0x35572d),_0x3ddaec=await this['client']['createTextKnowledgeBase'](_0x4e2fdc);_0x1f7466['set'](_0x53c80a[_0x479ee6(0x1e5)],_0x3ddaec['id']),_0x6cd1bd[_0x479ee6(0x131)][_0x479ee6(0x177)]({'name':_0x53c80a['name'],'action':_0x479ee6(0xd5),'id':_0x3ddaec['id']}),_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0x131)][_0x479ee6(0xd5)]++;}catch(_0x151fcd){_0x6cd1bd[_0x479ee6(0x131)]['push']({'name':_0x53c80a[_0x479ee6(0x1e5)],'action':'error','error':_0x151fcd[_0x479ee6(0x1bb)]}),_0x6cd1bd[_0x479ee6(0xce)]['textKnowledgeBases'][_0x479ee6(0xd4)]++;}}for(const _0x3a1785 of _0x24af02){try{const _0x4337bf=yamlExperimentalArtifactToApi(_0x3a1785[_0x479ee6(0x1bc)],_0x35572d),_0x1f7c68=await this[_0x479ee6(0x1a9)][_0x479ee6(0x16b)](_0x4337bf);_0x356966[_0x479ee6(0x1ac)](_0x3a1785[_0x479ee6(0x1bc)][_0x479ee6(0x1e5)],_0x1f7c68['id']),_0x6cd1bd['experimentalArtifacts'][_0x479ee6(0x177)]({'name':_0x3a1785['def']['name'],'action':_0x479ee6(0xd5),'id':_0x1f7c68['id']}),_0x6cd1bd[_0x479ee6(0xce)]['experimentalArtifacts'][_0x479ee6(0xd5)]++;}catch(_0x1b8b2e){_0x6cd1bd['experimentalArtifacts'][_0x479ee6(0x177)]({'name':_0x3a1785['def'][_0x479ee6(0x1e5)],'action':_0x479ee6(0x1cf),'error':_0x1b8b2e[_0x479ee6(0x1bb)]}),_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0xf1)][_0x479ee6(0xd4)]++;}}for(const _0x1b0a76 of _0x525b8f){try{const _0x3dfa4b=yamlExperimentalKnowledgeBaseToApi(_0x1b0a76[_0x479ee6(0x1bc)],_0x35572d),_0x426b00=await this[_0x479ee6(0x1a9)][_0x479ee6(0x1b8)](_0x3dfa4b);_0x337ab1[_0x479ee6(0x1ac)](_0x1b0a76[_0x479ee6(0x1bc)][_0x479ee6(0x1e5)],_0x426b00['id']),_0x6cd1bd[_0x479ee6(0x155)][_0x479ee6(0x177)]({'name':_0x1b0a76[_0x479ee6(0x1bc)][_0x479ee6(0x1e5)],'action':_0x479ee6(0xd5),'id':_0x426b00['id']}),_0x6cd1bd['counts'][_0x479ee6(0x155)]['created']++;}catch(_0x161c05){_0x6cd1bd[_0x479ee6(0x155)][_0x479ee6(0x177)]({'name':_0x1b0a76[_0x479ee6(0x1bc)][_0x479ee6(0x1e5)],'action':'error','error':_0x161c05[_0x479ee6(0x1bb)]}),_0x6cd1bd['counts'][_0x479ee6(0x155)][_0x479ee6(0xd4)]++;}}const _0xcaa1a8=[..._0x194536][_0x479ee6(0x1d6)]((_0x789ebd,_0x93d95e)=>{const _0x28f35a=_0x479ee6,_0x2ca87a=_0x789ebd[_0x28f35a(0x1a6)]['tools']?.[_0x28f35a(0x19e)](_0x3dc618=>_0x3dc618['type']==='agent')??![],_0xa5c0ab=_0x93d95e[_0x28f35a(0x1a6)][_0x28f35a(0x159)]?.[_0x28f35a(0x19e)](_0x5727b7=>_0x5727b7[_0x28f35a(0x148)]===_0x28f35a(0x181))??![];if(_0x2ca87a&&!_0xa5c0ab)return 0x1;if(!_0x2ca87a&&_0xa5c0ab)return-0x1;return 0x0;});for(const _0x5b6fc1 of _0xcaa1a8){_0x231bb4=[];try{const _0x145693=_0x5b6fc1[_0x479ee6(0x1a6)][_0x479ee6(0x159)]?.['filter'](_0x26a27d=>{const _0x144fef=_0x479ee6;if(_0x26a27d['type']===_0x144fef(0x181)&&_0x26a27d[_0x144fef(0x1e7)]){const _0x1711dc=parseRef(_0x26a27d[_0x144fef(0x1e7)]);return _0x1711dc?.[_0x144fef(0x1e5)]===_0x5b6fc1['yaml'][_0x144fef(0x1e5)];}return![];})??[];if(_0x145693[_0x479ee6(0x192)]>0x0){const _0x220a87='Agent\x20\x27'+_0x5b6fc1['yaml'][_0x479ee6(0x1e5)]+_0x479ee6(0xe8)+_0x479ee6(0x15f);this[_0x479ee6(0xd8)][_0x479ee6(0xf4)](_0x220a87),_0x231bb4[_0x479ee6(0x177)](_0x220a87);}const _0x4c4ff5=await agentDefToRequest(_0x5b6fc1['yaml'],_0x5b6fc1['systemPrompt'],_0x5b6fc1['starterMessage'],_0x299144),_0x514638=await this[_0x479ee6(0x1a9)][_0x479ee6(0x15b)](_0x4c4ff5);_0x46e48e[_0x479ee6(0x1ac)](_0x5b6fc1[_0x479ee6(0x1a6)][_0x479ee6(0x1e5)],_0x514638['id']),_0x6cd1bd[_0x479ee6(0x1a5)][_0x479ee6(0x177)]({'agentName':_0x5b6fc1[_0x479ee6(0x1a6)][_0x479ee6(0x1e5)],'action':'created','agentId':_0x514638['id'],'warnings':_0x231bb4[_0x479ee6(0x192)]>0x0?_0x231bb4:undefined}),_0x6cd1bd['counts'][_0x479ee6(0x1a5)][_0x479ee6(0xd5)]++;}catch(_0xf2774f){_0x6cd1bd[_0x479ee6(0x1a5)][_0x479ee6(0x177)]({'agentName':_0x5b6fc1[_0x479ee6(0x1a6)][_0x479ee6(0x1e5)],'action':_0x479ee6(0x1cf),'error':_0xf2774f['message'],'warnings':_0x231bb4[_0x479ee6(0x192)]>0x0?_0x231bb4:undefined}),_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0x1a5)][_0x479ee6(0xd4)]++;}}for(const _0x5248a2 of _0x27ebe4){try{const _0x118849=await yamlPromptToApi(_0x5248a2[_0x479ee6(0x1a6)],_0x35572d,_0x299144);if(!_0x118849){_0x6cd1bd['prompts']['push']({'name':_0x5248a2[_0x479ee6(0x1a6)][_0x479ee6(0x1e5)],'action':'error','error':_0x479ee6(0xde)}),_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0x166)]['errors']++;continue;}const _0x1b7873=await this[_0x479ee6(0x1a9)][_0x479ee6(0x15e)](_0x118849);_0x198cd8[_0x479ee6(0x1ac)](_0x5248a2[_0x479ee6(0x1a6)][_0x479ee6(0x1e5)],_0x1b7873['id']),_0x6cd1bd[_0x479ee6(0x166)][_0x479ee6(0x177)]({'name':_0x5248a2[_0x479ee6(0x1a6)]['name'],'action':_0x479ee6(0xd5),'id':_0x1b7873['id']}),_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0x166)][_0x479ee6(0xd5)]++;}catch(_0x275cc4){_0x6cd1bd['prompts'][_0x479ee6(0x177)]({'name':_0x5248a2[_0x479ee6(0x1a6)]['name'],'action':_0x479ee6(0x1cf),'error':_0x275cc4['message']}),_0x6cd1bd['counts'][_0x479ee6(0x166)][_0x479ee6(0xd4)]++;}}for(const _0x252fe3 of _0x22f92d){try{const _0x11b312=await yamlIntegrationToApi(_0x252fe3['yaml'],_0x35572d,_0x299144),_0x3648e6=await this[_0x479ee6(0x1a9)][_0x479ee6(0x10e)](_0x11b312);_0x6cd1bd['integrations']['push']({'name':_0x252fe3['yaml'][_0x479ee6(0x1e3)],'action':_0x479ee6(0xd5),'id':_0x3648e6['id']}),_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0x1c6)][_0x479ee6(0xd5)]++;}catch(_0x25ea54){_0x6cd1bd[_0x479ee6(0x1c6)][_0x479ee6(0x177)]({'name':_0x252fe3[_0x479ee6(0x1a6)][_0x479ee6(0x1e3)],'action':_0x479ee6(0x1cf),'error':_0x25ea54[_0x479ee6(0x1bb)]}),_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0x1c6)][_0x479ee6(0xd4)]++;}}for(const _0x7a0c84 of _0x2d7cbe){try{const _0x47bf46=await yamlFormInterfaceToApi(_0x7a0c84['yaml'],_0x35572d,_0x299144);if(!_0x47bf46){_0x6cd1bd['formInterfaces'][_0x479ee6(0x177)]({'name':_0x7a0c84[_0x479ee6(0x1a6)][_0x479ee6(0x1e5)],'action':_0x479ee6(0x1cf),'error':_0x479ee6(0xe7)}),_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0x1af)]['errors']++;continue;}const _0xe8673f=await this[_0x479ee6(0x1a9)][_0x479ee6(0xf0)](_0x47bf46);_0x6cd1bd[_0x479ee6(0x1af)][_0x479ee6(0x177)]({'name':_0x7a0c84[_0x479ee6(0x1a6)][_0x479ee6(0x1e5)],'action':_0x479ee6(0xd5),'id':_0xe8673f['id']}),_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0x1af)][_0x479ee6(0xd5)]++;}catch(_0x2c7138){_0x6cd1bd[_0x479ee6(0x1af)][_0x479ee6(0x177)]({'name':_0x7a0c84['yaml'][_0x479ee6(0x1e5)],'action':_0x479ee6(0x1cf),'error':_0x2c7138['message']}),_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0x1af)]['errors']++;}}for(const _0x271124 of _0x4086ba){try{const _0x33e50e=await yamlChatInterfaceToApi(_0x271124[_0x479ee6(0x1a6)],_0x35572d,_0x299144),_0x54ee43=await this[_0x479ee6(0x1a9)]['createChatInterface'](_0x33e50e);_0x6cd1bd['chatInterfaces']['push']({'name':_0x271124[_0x479ee6(0x1a6)][_0x479ee6(0x1e5)],'action':_0x479ee6(0xd5),'id':_0x54ee43['id']}),_0x6cd1bd[_0x479ee6(0xce)][_0x479ee6(0xfa)][_0x479ee6(0xd5)]++;}catch(_0x3ff0a8){_0x6cd1bd[_0x479ee6(0xfa)]['push']({'name':_0x271124['yaml'][_0x479ee6(0x1e5)],'action':_0x479ee6(0x1cf),'error':_0x3ff0a8[_0x479ee6(0x1bb)]}),_0x6cd1bd['counts'][_0x479ee6(0xfa)]['errors']++;}}return _0x6cd1bd;}}
|