@treasuredata/tdx 0.28.1 → 0.28.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/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-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/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-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/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/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/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/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-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/personalization.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.d.ts.map +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-validator.js.map +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/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/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/tree-formatter.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +1 -1
package/dist/sdk/llm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a109_0x291832=a109_0x2939;(function(_0x1c5518,_0x574bc5){const _0x2d0206=a109_0x2939,_0x516d36=_0x1c5518();while(!![]){try{const _0x3a7f67=-parseInt(_0x2d0206(0x1e9))/0x1+parseInt(_0x2d0206(0x22d))/0x2*(parseInt(_0x2d0206(0x281))/0x3)+-parseInt(_0x2d0206(0x1bb))/0x4+-parseInt(_0x2d0206(0x249))/0x5*(-parseInt(_0x2d0206(0x225))/0x6)+parseInt(_0x2d0206(0x29c))/0x7+-parseInt(_0x2d0206(0x2a0))/0x8+parseInt(_0x2d0206(0x299))/0x9;if(_0x3a7f67===_0x574bc5)break;else _0x516d36['push'](_0x516d36['shift']());}catch(_0x5edca1){_0x516d36['push'](_0x516d36['shift']());}}}(a109_0x19f7,0xc96b8));import{LLMApiClient}from'../client/llm-api-client.js';import*as a109_0xd05ade from'node:fs';import*as a109_0x3b39de from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';function a109_0x19f7(){const _0x15a68a=['error','outputs','localeCompare','knowledgebases.json','maxToolIterations','Renamed\x20integration\x20file:\x20','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','agents','add','logger','listChats','listExperimentalKnowledgeBases','\x0a---\x20code\x20---\x0a','pullProject','4207252FblUoE','systemPrompt','medium','integrations.json','total','Unable\x20to\x20create\x20project\x20after\x20','Unresolved\x20dependencies:\x20','stringify','listKnowledgeBases','attributes','resolveAgentId','high','toISOString','pushAgent','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','listAgents','idToName','json_schema','text_content','version','split','chatWelcomeMessage','readFileSync','metadata','getOrCreateDefaultProject','listTextKnowledgeBases','rmSync','some','length','json_schema.json','temperature','createExperimentalKnowledgeBase','get','resolveProjectId','serviceType','experimentalArtifacts','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','claude-4.5-sonnet','agent','code','yaml','createImageGenerator','backupProject','getOrCreateDefaultAgent','content','1448544CjMfhQ','has','startChat','history','Removed\x20deleted\x20file:\x20','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','.llm','listWebSearchTools','getDefaultProjectName','minimal','createKnowledgeBase','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','ALREADY_EXISTS','createProject','listIntegrations','knowledgeBases','integrations','AGENT_NOT_FOUND','getChatInfo','jsonSchemaHint','chatIgnoreManagedActions','agent.yml\x20not\x20found\x20in\x20','Agent\x20not\x20found:\x20','---\x20file:\x20','reasoningEffort','PERMISSION_DENIED','\x20---\x0a','name','statSync','getBackupMetadata','dry-run-','experimentalKnowledgeBases','NOT_FOUND','existsSync','sdk.llm','KnowledgeBase','already\x20exists','availableModels','sort','unchanged','description','promptId','path','setCurrentProject','signal','\x22\x20already\x20exists','UNAUTHENTICATED','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','profile','experimental_knowledge_bases','deleteIntegration','Skipping\x20integration\x20\x27','getChatHistory','projectId','getUserSettings','type','loadJsonFile','setDefaultAgent','newProjectId','488640rFxTWH','deleteProject','\x0a---\x20schema:\x20','basename','listAgentsFull','\x20→\x20',')\x20can\x20be\x20cloned.','mkdirSync','2344xbPwxw','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','agentId','set','INTERNAL','prompts.json','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','Unsupported\x20backup\x20version:\x20','currentProjectId','createAgentResponse','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.','service_type','resolveProjectName','isDir','modelType','llm_project','models','INVALID_ARGUMENT','info','createPrompt','restoreProject','includes','created','deleteAgent','LLM_PROJECT_NOT_FOUND','message','chatId','exportedFrom','25BbVxuj','isManaged','createIntegration','isDirectory','Invalid\x20agent\x20reference\x20format:\x20','tdx_','join','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','displayName','tdx.json','Project\x20\x22','nameToId','prompt.md','actions','clearDefaultAgent','dirname','chat','Removed\x20deleted\x20directory:\x20','prompts','.md','endsWith','chat_parent_segment','none','dryRun','toLowerCase','code.js','listExperimentalArtifacts',')\x20can\x20be\x20pushed.\x20','files','new','Renamed\x20folder:\x20','No\x20tdx.json\x20found\x20in\x20','updatePrompt','.yml','1.0','writeFileSync','agents.json','chat_agent_console','tools','oldPath','getDefaultAgent','listProjects','tdDatabaseName','webSearchTools','starter_message','image_gen','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','text','\x27.\x20This\x20should\x20not\x20happen.','isFile','counts','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','pushProject','size','listToolTargets','):\x20','2949HPweWM','readdirSync','imageGenerators','updateAgent','site','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','duplicate','cloneProject','starter_message.md','variables','push','dir','createTextKnowledgeBase','\x0a\x0a#\x20agent.yml\x0a','Agent\x20reference\x20not\x20found','file_name','listPrompts','pullAgent','getChatLog','Backup\x20folder\x20not\x20found:\x20','starterMessage','map','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','---\x20schema:\x20','12497796KXAxhO','chats','conflict','9794918jUaZEd','utf-8','getCurrentProject','\x20in\x20project\x20','8174568wdxmrB','errors','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','low','unlinkSync','\x27\x20(','find','agent.yml','Project\x20not\x20found:\x20','textKnowledgeBases','updateExperimentalKnowledgeBase','functions','filter','updateExperimentalArtifact','updated','#\x20prompt.md\x0a','knowledge_bases','Renamed\x20KB\x20file:\x20','def','\x0a---\x20function:\x20','updateAgentResponse','Multiple\x20projects\x20found\x20with\x20name\x20\x27','Renamed\x20text\x20KB\x20file:\x20','(dry-run)','Renamed\x20agent\x20folder:\x20','webhookCorsOrigins','context','parse','client','Renamed\x20experimental\x20artifact\x20directory:\x20','target','warn','experimental_artifacts','project.json','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','getAgent','getProject','renamed'];a109_0x19f7=function(){return _0x15a68a;};return a109_0x19f7();}import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir}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=['chat_generic',a109_0x291832(0x26e),a109_0x291832(0x25e)];async function safeListOrEmpty(_0x1fefa3){try{return await _0x1fefa3();}catch(_0x18d862){if(_0x18d862 instanceof HTTPClientError&&_0x18d862['status']===0x194)return[];throw _0x18d862;}}function a109_0x2939(_0x5a19a3,_0x3dc45d){_0x5a19a3=_0x5a19a3-0x1a7;const _0x19f76d=a109_0x19f7();let _0x293956=_0x19f76d[_0x5a19a3];return _0x293956;}export class LLMSDK{[a109_0x291832(0x235)];[a109_0x291832(0x2bc)];[a109_0x291832(0x2ba)];[a109_0x291832(0x1b6)]=Logger['of'](a109_0x291832(0x20c));constructor(_0x508d5d){const _0x41dbce=a109_0x291832;this[_0x41dbce(0x2bc)]=new LLMApiClient(_0x508d5d),this[_0x41dbce(0x2ba)]=_0x508d5d;}[a109_0x291832(0x1f2)](){const _0x5db0f1=getSanitizedUsername();return'tdx_default_'+_0x5db0f1;}async[a109_0x291832(0x215)](_0x45ddca){const _0x5a7cd1=a109_0x291832,{projectId:_0x5afc64}=await this['resolveProjectName'](_0x45ddca);this[_0x5a7cd1(0x235)]=_0x5afc64;}[a109_0x291832(0x29e)](){const _0x3f86ff=a109_0x291832;return this[_0x3f86ff(0x235)];}async[a109_0x291832(0x223)](_0x7b23ab){const _0x43fa73=a109_0x291832,_0x44f070=this[_0x43fa73(0x2ba)][_0x43fa73(0x21a)];let _0x2b6930,_0x468de6;if(_0x7b23ab[_0x43fa73(0x242)]('/')){const _0x3a6ed1=_0x7b23ab[_0x43fa73(0x1d0)]('/');if(_0x3a6ed1[_0x43fa73(0x1d8)]!==0x2)throw new SDKError(ErrorCode[_0x43fa73(0x23e)],_0x43fa73(0x24d)+_0x7b23ab,undefined,{'helpText':'Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22'});const [_0x2abb16,_0x2bee89]=_0x3a6ed1;_0x2b6930=await this[_0x43fa73(0x1dd)](_0x2abb16),_0x468de6=_0x2bee89;}else _0x2b6930=this[_0x43fa73(0x235)]||(await this[_0x43fa73(0x1d4)]())['id'],_0x468de6=_0x7b23ab;const _0x5a5c0e=await this[_0x43fa73(0x1c5)](_0x468de6,_0x2b6930),_0x13e0d4=await this[_0x43fa73(0x2bc)][_0x43fa73(0x1aa)](_0x5a5c0e);writeCachedLLMAgent(_0x13e0d4[_0x43fa73(0x1c4)]['name'],_0x5a5c0e,_0x2b6930,_0x44f070);}[a109_0x291832(0x271)](){const _0x301f31=a109_0x291832,_0x4363fa=this[_0x301f31(0x2ba)][_0x301f31(0x21a)];return readCachedLLMAgent(_0x4363fa)||undefined;}[a109_0x291832(0x257)](){const _0x2c288c=a109_0x291832,_0xb1ba04=this[_0x2c288c(0x2ba)][_0x2c288c(0x21a)];clearCachedLLMAgent(_0xb1ba04);}async[a109_0x291832(0x23d)](){const _0xdc56e3=a109_0x291832,_0x18eb07=await this[_0xdc56e3(0x2bc)][_0xdc56e3(0x220)](),_0x1ecce6=[];for(const _0x546a05 of _0x18eb07['availableModelNames']){const _0x5e3961=_0x18eb07[_0xdc56e3(0x20f)][_0x546a05];_0x5e3961&&_0x1ecce6[_0xdc56e3(0x28b)]({'name':_0x546a05,'displayName':_0x5e3961[_0xdc56e3(0x251)]});}return _0x1ecce6;}async[a109_0x291832(0x1f7)](_0x16c017){const _0x37e6ee=a109_0x291832;return await this[_0x37e6ee(0x2bc)][_0x37e6ee(0x1f7)](_0x16c017);}async['deleteProject'](_0x1f3494){const _0x55d35f=a109_0x291832,{projectId:_0x5c7189}=await this['resolveProjectName'](_0x1f3494);await this[_0x55d35f(0x2bc)][_0x55d35f(0x226)](_0x5c7189);}async['projects'](_0x4b7f1d=0x32){return await this['client']['listProjects'](_0x4b7f1d);}async['getOrCreateDefaultProject'](_0x2f4168){const _0x1528fd=a109_0x291832,_0x48eecf=_0x2f4168||this[_0x1528fd(0x1f2)](),_0x1f440f=this[_0x1528fd(0x2ba)]['profile'];if(!_0x2f4168){const _0x167186=readCachedLLMProject(_0x1f440f);if(_0x167186&&_0x167186[_0x1528fd(0x205)]===_0x48eecf)try{const _0x4f40ab=await this[_0x1528fd(0x2bc)][_0x1528fd(0x1ab)](_0x167186['id']);if(_0x4f40ab[_0x1528fd(0x1c4)][_0x1528fd(0x205)]===_0x48eecf)return _0x4f40ab;}catch{}}const _0x3fdaf0=await this[_0x1528fd(0x2bc)][_0x1528fd(0x272)](),_0x57a9ee=_0x3fdaf0['find'](_0x234f32=>_0x234f32[_0x1528fd(0x1c4)]['name']===_0x48eecf);if(_0x57a9ee)return!_0x2f4168&&writeCachedLLMProject(_0x48eecf,_0x57a9ee['id'],_0x1f440f),_0x57a9ee;const _0x15c35f=await this[_0x1528fd(0x2bc)][_0x1528fd(0x1f7)]({'name':_0x48eecf,'description':_0x1528fd(0x297)+getSanitizedUsername()+')'});return!_0x2f4168&&writeCachedLLMProject(_0x48eecf,_0x15c35f['id'],_0x1f440f),_0x15c35f;}async[a109_0x291832(0x1dd)](_0x250b24){const _0x268862=a109_0x291832,_0x1b89b2=await this['client'][_0x268862(0x272)](),_0x540f1f=_0x1b89b2[_0x268862(0x2ac)](_0x36d33a=>_0x36d33a[_0x268862(0x1c4)][_0x268862(0x205)]===_0x250b24);if(_0x540f1f['length']===0x0)throw new SDKError(ErrorCode[_0x268862(0x245)],_0x268862(0x2a8)+_0x250b24,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x540f1f[_0x268862(0x1d8)]>0x1)throw new SDKError(ErrorCode[_0x268862(0x231)],_0x268862(0x2b5)+_0x250b24+_0x268862(0x279));return _0x540f1f[0x0]['id'];}async[a109_0x291832(0x239)](_0x3013cd){const _0x293deb=a109_0x291832,_0x1e911b=await this[_0x293deb(0x2bc)][_0x293deb(0x272)](),_0x1c026b=_0x1e911b[_0x293deb(0x2a6)](_0xf7e5da=>_0xf7e5da[_0x293deb(0x1c4)]['name']===_0x3013cd);if(_0x1c026b)return{'projectId':_0x1c026b['id'],'project':_0x1c026b};throw new SDKError(ErrorCode[_0x293deb(0x245)],_0x293deb(0x2a8)+_0x3013cd,undefined,{'helpText':_0x293deb(0x2a2)});}async[a109_0x291832(0x1e7)](_0x124073=a109_0x291832(0x1e1),_0x1004a4=0x0,_0x256a98){const _0x556f20=a109_0x291832,_0x53383a=0xa;let _0x659874=0x0,_0x359155;while(_0x659874<_0x53383a){try{const _0x171f00=await this['getOrCreateDefaultProject'](_0x359155),_0x3e2c5b=_0x171f00['id'],_0xc3308d=[_0x556f20(0x25f),_0x556f20(0x1f3),_0x556f20(0x2a3),_0x556f20(0x1bd),_0x556f20(0x1c6)],_0x3ebec7=_0x1004a4===0x0?_0x556f20(0x24e)+_0x124073:'tdx_'+_0x124073+'_reasoning_'+_0xc3308d[_0x1004a4],_0x4d4c4d=await this[_0x556f20(0x2bc)][_0x556f20(0x1cb)](_0x3e2c5b),_0x27c8f1=_0x4d4c4d[_0x556f20(0x2a6)](_0x85a859=>_0x85a859[_0x556f20(0x1c4)]['name']===_0x3ebec7);if(_0x27c8f1)return _0x27c8f1;const _0x212ff7=_0x1004a4>0x0?0x1:_0x256a98;return await this[_0x556f20(0x2bc)]['createAgent']({'name':_0x3ebec7,'projectId':_0x3e2c5b,'modelType':_0x124073,'systemPrompt':'','temperature':_0x212ff7,'reasoningEffort':_0x1004a4>0x0?_0x1004a4:undefined});}catch(_0x35922c){if(_0x35922c instanceof HTTPClientError){const _0x5d4310=_0x35922c['status'];if(_0x5d4310>=0x190&&_0x5d4310<0x1f4){if(_0x5d4310===0x191)throw new SDKError(ErrorCode[_0x556f20(0x218)],_0x556f20(0x1e0),_0x35922c);else{if(_0x5d4310===0x193)throw new SDKError(ErrorCode[_0x556f20(0x203)],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x35922c);}throw _0x35922c;}}if(errorContains(_0x35922c,_0x556f20(0x20e),_0x556f20(0x287),_0x556f20(0x29b))){_0x659874++;if(_0x659874>=_0x53383a)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x556f20(0x1c0)+_0x53383a+'\x20attempts\x20due\x20to\x20name\x20conflicts.',_0x35922c);const _0x35bed0=this[_0x556f20(0x1f2)]();_0x359155=_0x35bed0+'_'+generateRandomHex();continue;}throw _0x35922c;}}throw new SDKError(ErrorCode[_0x556f20(0x231)],_0x556f20(0x233));}async[a109_0x291832(0x1c5)](_0x42ae30,_0x26e346){const _0x372e53=a109_0x291832,_0x5f3f87=_0x26e346||this[_0x372e53(0x235)],_0x2e2d0f=await this['client'][_0x372e53(0x1cb)](_0x5f3f87),_0x3c1b3c=_0x2e2d0f[_0x372e53(0x2ac)](_0x39ee4c=>_0x39ee4c[_0x372e53(0x1c4)][_0x372e53(0x205)]===_0x42ae30);if(_0x3c1b3c[_0x372e53(0x1d8)]===0x0){const _0x4f84f6=_0x5f3f87?_0x372e53(0x29f)+_0x5f3f87:'';throw new SDKError(ErrorCode[_0x372e53(0x1fb)],'Agent\x20not\x20found:\x20'+_0x42ae30+_0x4f84f6,undefined,{'helpText':_0x5f3f87?_0x372e53(0x250):_0x372e53(0x237)});}if(_0x3c1b3c[_0x372e53(0x1d8)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],'Multiple\x20agents\x20found\x20with\x20name\x20\x27'+_0x42ae30+'\x27.\x20This\x20should\x20not\x20happen.');return _0x3c1b3c[0x0]['id'];}async[a109_0x291832(0x1b4)](_0x4b4b02){const _0x311a83=a109_0x291832,_0x4be49a=_0x4b4b02||this['currentProjectId'];return await this[_0x311a83(0x2bc)][_0x311a83(0x1cb)](_0x4be49a);}async['agentsFull'](_0x280210){const _0x5407aa=a109_0x291832;return await this[_0x5407aa(0x2bc)]['listAgentsFull'](_0x280210);}async[a109_0x291832(0x1e2)](_0x178931){const _0x56acd4=a109_0x291832;return await this[_0x56acd4(0x2bc)][_0x56acd4(0x1aa)](_0x178931);}async['createAgent'](_0x591cc9){return await this['client']['createAgent'](_0x591cc9);}async['updateAgent'](_0x5bd9bc,_0x538dff){const _0x1393a3=a109_0x291832;return await this[_0x1393a3(0x2bc)][_0x1393a3(0x284)](_0x5bd9bc,_0x538dff);}async[a109_0x291832(0x244)](_0x534295){const _0x17edea=a109_0x291832;await this['client'][_0x17edea(0x244)](_0x534295);}async['startChat'](_0x292f3f){const _0x23afc8=a109_0x291832;return await this[_0x23afc8(0x2bc)][_0x23afc8(0x1eb)]({'agentId':_0x292f3f});}async*[a109_0x291832(0x259)](_0x2adc61,_0x18ebd0){const _0x213e2e=a109_0x291832;let _0x4cfe65=_0x18ebd0?.[_0x213e2e(0x247)];const _0x569463=_0x18ebd0?.[_0x213e2e(0x22f)];if(!_0x4cfe65){if(!_0x569463)throw new Error(_0x213e2e(0x1ef));const _0x5e6468=await this[_0x213e2e(0x2bc)][_0x213e2e(0x1eb)]({'agentId':_0x569463});_0x4cfe65=_0x5e6468['id'],yield{'type':_0x213e2e(0x1d3),'data':{'chatId':_0x4cfe65,'agentId':_0x569463,'projectId':_0x5e6468[_0x213e2e(0x1c4)][_0x213e2e(0x21f)]}};}for await(const _0x4d7972 of this[_0x213e2e(0x2bc)]['continueChat'](_0x4cfe65,_0x2adc61,_0x18ebd0?.[_0x213e2e(0x216)])){yield{'type':'event','data':_0x4d7972};}}async[a109_0x291832(0x29a)](_0x515d93=0x32){const _0x35d269=a109_0x291832;return await this[_0x35d269(0x2bc)][_0x35d269(0x1b7)](_0x515d93);}async[a109_0x291832(0x1ec)](_0x13e07e){const _0x17980a=a109_0x291832;return await this[_0x17980a(0x2bc)][_0x17980a(0x21e)](_0x13e07e);}async[a109_0x291832(0x293)](_0x4605c3){const _0x19397b=a109_0x291832;return await this[_0x19397b(0x2bc)][_0x19397b(0x293)](_0x4605c3);}async['chatInfo'](_0x5a679e){const _0x554057=a109_0x291832;return await this[_0x554057(0x2bc)][_0x554057(0x1fc)](_0x5a679e);}async[a109_0x291832(0x1e6)](_0x463f6d,_0x3ab29c,_0xa19e2f){const _0x3cedd4=a109_0x291832,_0x54c13e=_0xa19e2f?.[_0x3cedd4(0x260)]??![],{projectId:_0x3de292,project:_0x3200a9}=await this[_0x3cedd4(0x239)](_0x463f6d),_0x1fe76a=_0x3200a9[_0x3cedd4(0x1c4)][_0x3cedd4(0x205)],_0x2b9e95=_0x3ab29c||_0x1fe76a+_0x3cedd4(0x1f0);if(a109_0xd05ade['existsSync'](_0x2b9e95)&&!_0x54c13e)throw new SDKError(ErrorCode[_0x3cedd4(0x1f6)],'Output\x20directory\x20already\x20exists:\x20'+_0x2b9e95,undefined,{'helpText':_0x3cedd4(0x1c9)});const _0xd186d0=await this[_0x3cedd4(0x2bc)][_0x3cedd4(0x229)](_0x3de292),_0x143d4c=await this[_0x3cedd4(0x2bc)][_0x3cedd4(0x1c3)](_0x3de292),_0x1d2451=await this['client'][_0x3cedd4(0x291)](_0x3de292),_0x1e8fc1=await this[_0x3cedd4(0x2bc)][_0x3cedd4(0x1f8)](_0x3de292);if(!_0x54c13e){a109_0xd05ade[_0x3cedd4(0x22c)](_0x2b9e95,{'recursive':!![]});const _0x20865f={'version':_0x3cedd4(0x26b),'exportedAt':new Date()[_0x3cedd4(0x1c7)](),'exportedFrom':{'site':this[_0x3cedd4(0x2ba)][_0x3cedd4(0x285)],'projectId':_0x3de292,'projectName':_0x1fe76a},'project':_0x3200a9};a109_0xd05ade[_0x3cedd4(0x26c)](a109_0x3b39de[_0x3cedd4(0x24f)](_0x2b9e95,_0x3cedd4(0x1a8)),JSON[_0x3cedd4(0x1c2)](_0x20865f,null,0x2)),a109_0xd05ade['writeFileSync'](a109_0x3b39de['join'](_0x2b9e95,_0x3cedd4(0x26d)),JSON[_0x3cedd4(0x1c2)](_0xd186d0,null,0x2)),a109_0xd05ade[_0x3cedd4(0x26c)](a109_0x3b39de['join'](_0x2b9e95,_0x3cedd4(0x1b0)),JSON['stringify'](_0x143d4c,null,0x2)),a109_0xd05ade['writeFileSync'](a109_0x3b39de['join'](_0x2b9e95,_0x3cedd4(0x232)),JSON[_0x3cedd4(0x1c2)](_0x1d2451,null,0x2)),a109_0xd05ade[_0x3cedd4(0x26c)](a109_0x3b39de[_0x3cedd4(0x24f)](_0x2b9e95,_0x3cedd4(0x1be)),JSON[_0x3cedd4(0x1c2)](_0x1e8fc1,null,0x2));}return{'projectName':_0x1fe76a,'outputDir':_0x2b9e95,'counts':{'agents':_0xd186d0[_0x3cedd4(0x1d8)],'knowledgeBases':_0x143d4c[_0x3cedd4(0x1d8)],'prompts':_0x1d2451['length'],'integrations':_0x1e8fc1['length']}};}async[a109_0x291832(0x241)](_0x560747,_0x4e85a6){const _0xc88a72=a109_0x291832,_0x5b4cbd=_0x4e85a6?.[_0xc88a72(0x260)]??![],_0x776446=this[_0xc88a72(0x207)](_0x560747),_0x4500e1=_0x776446[_0xc88a72(0x248)][_0xc88a72(0x285)],_0x2b27a7=this[_0xc88a72(0x2ba)][_0xc88a72(0x285)],_0x3d33a2=_0x4500e1!==_0x2b27a7?_0x4500e1:undefined,_0x2d7c75=this[_0xc88a72(0x222)](a109_0x3b39de[_0xc88a72(0x24f)](_0x560747,_0xc88a72(0x26d)),[]),_0x41fa0f=this[_0xc88a72(0x222)](a109_0x3b39de['join'](_0x560747,_0xc88a72(0x1b0)),[]),_0x808599=this['loadJsonFile'](a109_0x3b39de[_0xc88a72(0x24f)](_0x560747,_0xc88a72(0x232)),[]),_0x159dbe=this['loadJsonFile'](a109_0x3b39de['join'](_0x560747,_0xc88a72(0x1be)),[]),_0xfb39b5=_0x4e85a6?.[_0xc88a72(0x205)]||_0x776446[_0xc88a72(0x248)]['projectName'];if(_0x5b4cbd){const _0x13e3bc=new Map(),_0x4f6aea=[..._0x2d7c75],_0x3d7abb=_0x2d7c75[_0xc88a72(0x1d8)]+0x1;let _0x58a121=0x0;while(_0x4f6aea[_0xc88a72(0x1d8)]>0x0&&_0x58a121<_0x3d7abb){_0x58a121++;const _0x20ce89=[];for(const _0x4bb0d7 of _0x4f6aea){canCreateAgent(_0x4bb0d7,_0x13e3bc)?_0x13e3bc[_0xc88a72(0x230)](_0x4bb0d7['id'],_0xc88a72(0x208)+_0x4bb0d7['id']):_0x20ce89[_0xc88a72(0x28b)](_0x4bb0d7);}if(_0x20ce89[_0xc88a72(0x1d8)]===_0x4f6aea[_0xc88a72(0x1d8)])throw new SDKError(ErrorCode[_0xc88a72(0x231)],_0xc88a72(0x22e),undefined,{'helpText':_0xc88a72(0x1f5)});_0x4f6aea[_0xc88a72(0x1d8)]=0x0,_0x4f6aea[_0xc88a72(0x28b)](..._0x20ce89);}const _0x37597a=_0x808599[_0xc88a72(0x2ac)](_0x150025=>_0x13e3bc['has'](_0x150025[_0xc88a72(0x1c4)][_0xc88a72(0x22f)]))[_0xc88a72(0x1d8)];return{'projectName':_0xfb39b5,'projectId':_0xc88a72(0x2b7),'counts':{'agents':_0x2d7c75['length'],'knowledgeBases':_0x41fa0f[_0xc88a72(0x1d8)],'prompts':_0x37597a,'integrations':_0x159dbe['length']},'sourceSite':_0x3d33a2};}const _0x57117c=await this[_0xc88a72(0x2bc)][_0xc88a72(0x1f7)]({'name':_0xfb39b5,'description':_0x776446['project']['attributes'][_0xc88a72(0x212)]}),_0x4bc933=_0x57117c['id'],_0x4450a3=new Map(),_0x305992=new Map(),_0x1023c3=new Map();for(const _0x365a3f of _0x41fa0f){const _0x503b55=await this['client'][_0xc88a72(0x1f4)]({'projectId':_0x4bc933,'name':_0x365a3f[_0xc88a72(0x1c4)][_0xc88a72(0x205)],'tdDatabaseName':_0x365a3f[_0xc88a72(0x1c4)][_0xc88a72(0x273)],'tables':_0x365a3f[_0xc88a72(0x1c4)]['tables']});_0x4450a3['set'](_0x365a3f['id'],_0x503b55['id']);}const _0x1ed513=[..._0x2d7c75],_0x126725=_0x2d7c75['length']+0x1;let _0x989595=0x0;while(_0x1ed513[_0xc88a72(0x1d8)]>0x0&&_0x989595<_0x126725){_0x989595++;const _0x34df4e=[];for(const _0x240900 of _0x1ed513){if(canCreateAgent(_0x240900,_0x305992)){const _0x3cf4aa=remapToolIds(_0x240900['attributes'][_0xc88a72(0x26f)],_0x4450a3,_0x305992),_0x3ecbf4=remapVariableIds(_0x240900[_0xc88a72(0x1c4)][_0xc88a72(0x28a)],_0x4450a3),_0x566b11=await this[_0xc88a72(0x2bc)][_0xc88a72(0x236)]({'name':_0x240900[_0xc88a72(0x1c4)][_0xc88a72(0x205)],'projectId':_0x4bc933,'systemPrompt':_0x240900['attributes'][_0xc88a72(0x1bc)],'starterMessage':_0x240900['attributes'][_0xc88a72(0x295)],'modelType':migrateModelType(_0x240900[_0xc88a72(0x1c4)][_0xc88a72(0x23b)]),'maxToolIterations':_0x240900[_0xc88a72(0x1c4)][_0xc88a72(0x1b1)],'temperature':_0x240900[_0xc88a72(0x1c4)][_0xc88a72(0x1da)],'reasoningEffort':_0x240900['attributes'][_0xc88a72(0x202)],'outputs':_0x240900[_0xc88a72(0x1c4)][_0xc88a72(0x1ae)],'tools':_0x3cf4aa,'variables':_0x3ecbf4});_0x305992[_0xc88a72(0x230)](_0x240900['id'],_0x566b11['id']);}else _0x34df4e[_0xc88a72(0x28b)](_0x240900);}if(_0x34df4e[_0xc88a72(0x1d8)]===_0x1ed513[_0xc88a72(0x1d8)])throw new SDKError(ErrorCode[_0xc88a72(0x231)],_0xc88a72(0x22e),undefined,{'helpText':_0xc88a72(0x1f5)});_0x1ed513[_0xc88a72(0x1d8)]=0x0,_0x1ed513[_0xc88a72(0x28b)](..._0x34df4e);}for(const _0x5cd7bf of _0x808599){const _0x37792f=_0x305992[_0xc88a72(0x1dc)](_0x5cd7bf[_0xc88a72(0x1c4)][_0xc88a72(0x22f)]);if(!_0x37792f)continue;const _0x420bf0=await this['client'][_0xc88a72(0x240)]({'projectId':_0x4bc933,'agentId':_0x37792f,'name':_0x5cd7bf[_0xc88a72(0x1c4)][_0xc88a72(0x205)],'systemPrompt':_0x5cd7bf[_0xc88a72(0x1c4)][_0xc88a72(0x1bc)],'template':_0x5cd7bf[_0xc88a72(0x1c4)]['template'],'jsonSchemaHint':_0x5cd7bf[_0xc88a72(0x1c4)][_0xc88a72(0x1fd)]});_0x1023c3['set'](_0x5cd7bf['id'],_0x420bf0['id']);}for(const _0x47cc96 of _0x159dbe){const _0x1f9b20=_0x47cc96[_0xc88a72(0x1c4)][_0xc88a72(0x256)][_0xc88a72(0x296)](_0x2c878d=>({..._0x2c878d,'promptId':_0x1023c3[_0xc88a72(0x1dc)](_0x2c878d[_0xc88a72(0x213)])||_0x2c878d[_0xc88a72(0x213)]}));await this[_0xc88a72(0x2bc)][_0xc88a72(0x24b)]({'projectId':_0x4bc933,'serviceType':_0x47cc96[_0xc88a72(0x1c4)][_0xc88a72(0x1de)],'actions':_0x1f9b20,'slackMessageMode':_0x47cc96[_0xc88a72(0x1c4)]['slackMessageMode'],'chatIgnoreManagedActions':_0x47cc96[_0xc88a72(0x1c4)][_0xc88a72(0x1fe)],'chatWelcomeMessage':_0x47cc96['attributes'][_0xc88a72(0x1d1)],'webhookCorsOrigins':_0x47cc96['attributes'][_0xc88a72(0x2b9)]});}return{'projectName':_0xfb39b5,'projectId':_0x4bc933,'counts':{'agents':_0x305992['size'],'knowledgeBases':_0x4450a3[_0xc88a72(0x27e)],'prompts':_0x1023c3[_0xc88a72(0x27e)],'integrations':_0x159dbe[_0xc88a72(0x1d8)]},'sourceSite':_0x3d33a2};}['loadJsonFile'](_0x446745,_0x1bbe69){const _0x1a17d0=a109_0x291832;if(!a109_0xd05ade[_0x1a17d0(0x20b)](_0x446745))return _0x1bbe69;return JSON[_0x1a17d0(0x2bb)](a109_0xd05ade[_0x1a17d0(0x1d2)](_0x446745,_0x1a17d0(0x29d)));}['getBackupMetadata'](_0x5dd45e){const _0x5cf2d3=a109_0x291832;if(!a109_0xd05ade[_0x5cf2d3(0x20b)](_0x5dd45e))throw new SDKError(ErrorCode['NOT_FOUND'],_0x5cf2d3(0x294)+_0x5dd45e,undefined,{'helpText':_0x5cf2d3(0x1ca)});const _0x5f1e55=a109_0x3b39de[_0x5cf2d3(0x24f)](_0x5dd45e,_0x5cf2d3(0x1a8));if(!a109_0xd05ade[_0x5cf2d3(0x20b)](_0x5f1e55))throw new SDKError(ErrorCode[_0x5cf2d3(0x23e)],_0x5cf2d3(0x219)+_0x5dd45e,undefined,{'helpText':_0x5cf2d3(0x277)});const _0x21998d=JSON[_0x5cf2d3(0x2bb)](a109_0xd05ade['readFileSync'](_0x5f1e55,_0x5cf2d3(0x29d)));if(!isSupportedBackupVersion(_0x21998d[_0x5cf2d3(0x1cf)]))throw new SDKError(ErrorCode[_0x5cf2d3(0x23e)],_0x5cf2d3(0x234)+_0x21998d[_0x5cf2d3(0x1cf)],undefined,{'helpText':_0x5cf2d3(0x1a9)});return _0x21998d;}async[a109_0x291832(0x1ba)](_0x5b8f53,_0xe83c78,_0x15ba12){const _0xae028d=a109_0x291832,{projectId:_0x12a3d5,project:_0x50a37e}=await this[_0xae028d(0x239)](_0x5b8f53),_0x48775e=_0x50a37e['attributes'][_0xae028d(0x205)];let _0x118c53;if(_0xe83c78)_0x118c53=_0xe83c78;else{const _0x29b296=a109_0x3b39de[_0xae028d(0x24f)](process['cwd'](),_0xae028d(0x1b4)),_0x59064a=getSanitizedPathWithMigration(_0x29b296,_0x48775e);_0x59064a['renamed']&&this[_0xae028d(0x1b6)][_0xae028d(0x23f)](_0xae028d(0x267)+a109_0x3b39de[_0xae028d(0x228)](_0x59064a[_0xae028d(0x270)])+_0xae028d(0x22a)+a109_0x3b39de['basename'](_0x59064a[_0xae028d(0x214)])),_0x118c53=_0x59064a[_0xae028d(0x214)];}const _0x5617c8=await this[_0xae028d(0x2bc)][_0xae028d(0x229)](_0x12a3d5),_0x46af80=await this[_0xae028d(0x2bc)]['listKnowledgeBases'](_0x12a3d5),_0x51c1e5=await this[_0xae028d(0x2bc)][_0xae028d(0x1d5)](_0x12a3d5),_0x157c17=await safeListOrEmpty(()=>this[_0xae028d(0x2bc)]['listImageGenerators'](_0x12a3d5)),_0x15d34b=await safeListOrEmpty(()=>this[_0xae028d(0x2bc)][_0xae028d(0x1f1)](_0x12a3d5)),_0x2e2338=await this[_0xae028d(0x2bc)][_0xae028d(0x291)](_0x12a3d5),_0x4a08bb=await this[_0xae028d(0x2bc)][_0xae028d(0x1f8)](_0x12a3d5),_0x1d4f20=await safeListOrEmpty(()=>this[_0xae028d(0x2bc)]['listExperimentalKnowledgeBases'](_0x12a3d5)),_0x1d36c0=await safeListOrEmpty(()=>this[_0xae028d(0x2bc)][_0xae028d(0x263)](_0x12a3d5)),_0xfbf48c=_0x4a08bb['filter'](_0x37df29=>!_0x37df29[_0xae028d(0x1c4)][_0xae028d(0x24a)]&&SAFE_INTEGRATION_TYPES[_0xae028d(0x242)](_0x37df29[_0xae028d(0x1c4)][_0xae028d(0x1de)]['toLowerCase']())),_0x3ef059=new Map(),_0x1186c6=new Map(),_0x83a6d=new Map(),_0x2673e2=new Map(),_0x5ab2f9=new Map(),_0x2f308d=new Map(),_0x5e0264=new Map();for(const _0x413539 of _0x5617c8){_0x3ef059[_0xae028d(0x230)](_0x413539['id'],_0x413539[_0xae028d(0x1c4)][_0xae028d(0x205)]);}for(const _0x5ac7e3 of _0x46af80){_0x1186c6['set'](_0x5ac7e3['id'],_0x5ac7e3[_0xae028d(0x1c4)][_0xae028d(0x205)]);}for(const _0x37de0f of _0x51c1e5){_0x83a6d[_0xae028d(0x230)](_0x37de0f['id'],_0x37de0f[_0xae028d(0x1c4)][_0xae028d(0x205)]);}for(const _0x5b0615 of _0x157c17){_0x2673e2['set'](_0x5b0615['id'],_0x5b0615[_0xae028d(0x1c4)][_0xae028d(0x205)]);}for(const _0xf4ac20 of _0x15d34b){_0x5ab2f9['set'](_0xf4ac20['id'],_0xf4ac20[_0xae028d(0x1c4)]['name']);}for(const _0x3f77e6 of _0x2e2338){_0x2f308d['set'](_0x3f77e6['id'],_0x3f77e6[_0xae028d(0x1c4)]['name']);}for(const _0x524d3e of _0x1d4f20){_0x5e0264[_0xae028d(0x230)](_0x524d3e['id'],_0x524d3e[_0xae028d(0x1c4)][_0xae028d(0x205)]);}const _0x4128bb={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x1186c6,'TextKnowledgeBase':_0x83a6d,'Agent':_0x3ef059,'WebSearchTool':_0x5ab2f9,'ImageGenerator':_0x2673e2,'ExperimentalKnowledgeBase':_0x5e0264}),'resolvePromptName':async _0x5ef8e9=>_0x2f308d[_0xae028d(0x1dc)](_0x5ef8e9),'onWarning':_0x4b1662=>this['logger'][_0xae028d(0x2bf)](_0x4b1662)},_0x4c7e9b={'projectName':_0x48775e,'outputDir':_0x118c53,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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}}},_0x4d621f=[],_0xbe4cdf=[];for(const _0xfa30cb of _0x5617c8){const _0xb3b96c=getSanitizedPathWithMigration(_0x118c53,_0xfa30cb[_0xae028d(0x1c4)][_0xae028d(0x205)]);_0xb3b96c['renamed']&&this[_0xae028d(0x1b6)]['info'](_0xae028d(0x2b8)+a109_0x3b39de[_0xae028d(0x228)](_0xb3b96c[_0xae028d(0x270)])+_0xae028d(0x22a)+a109_0x3b39de[_0xae028d(0x228)](_0xb3b96c['path']));const _0x53e143=_0xb3b96c[_0xae028d(0x214)],_0x72a78b=a109_0x3b39de[_0xae028d(0x24f)](_0x53e143,'prompt.md'),_0x264f56=a109_0x3b39de['join'](_0x53e143,'agent.yml'),_0x281052=a109_0x3b39de[_0xae028d(0x24f)](_0x53e143,'starter_message.md'),{yaml:_0x46a039,systemPrompt:_0x1d28a4,starterMessage:_0x408cf9}=await agentResponseToDef(_0xfa30cb,_0x4128bb),_0x47b2ff=toAgentYamlString(_0x46a039),_0x5cc71e=!a109_0xd05ade[_0xae028d(0x20b)](_0x264f56);let _0x4f61d6=_0x5cc71e,_0x51f6e0;if(!_0x5cc71e){const _0x1a0793=a109_0xd05ade[_0xae028d(0x20b)](_0x72a78b)?a109_0xd05ade[_0xae028d(0x1d2)](_0x72a78b,_0xae028d(0x29d)):'',_0x541ea1=a109_0xd05ade[_0xae028d(0x1d2)](_0x264f56,_0xae028d(0x29d)),_0x29bdd5=_0xae028d(0x2af)+_0x1a0793+_0xae028d(0x28e)+_0x541ea1,_0x555141='#\x20prompt.md\x0a'+_0x1d28a4+'\x0a\x0a#\x20agent.yml\x0a'+_0x47b2ff,_0x3a2f8f=generateDiff(_0x29bdd5,_0x555141);_0x4f61d6=hasChanges(_0x3a2f8f),_0x4f61d6&&(_0x51f6e0=formatDiffWithColors(_0x3a2f8f));}_0x4d621f['push']({'path':_0x53e143,'content':'','isDir':!![]}),_0x4d621f[_0xae028d(0x28b)]({'path':_0x72a78b,'content':_0x1d28a4}),_0x4d621f[_0xae028d(0x28b)]({'path':_0x264f56,'content':_0x47b2ff});_0x408cf9&&_0x408cf9[_0xae028d(0x242)]('\x0a')&&_0x4d621f['push']({'path':_0x281052,'content':_0x408cf9});_0x4c7e9b[_0xae028d(0x1b4)][_0xae028d(0x28b)]({'agentName':_0xfa30cb['attributes']['name'],'outputPath':_0x53e143,'isNew':_0x5cc71e,'hasChanges':_0x4f61d6,'diff':_0x51f6e0}),_0x4c7e9b[_0xae028d(0x27b)][_0xae028d(0x1b4)][_0xae028d(0x1bf)]++;if(_0x5cc71e)_0x4c7e9b[_0xae028d(0x27b)]['agents']['new']++;else{if(_0x4f61d6)_0x4c7e9b[_0xae028d(0x27b)][_0xae028d(0x1b4)][_0xae028d(0x2ae)]++;else _0x4c7e9b[_0xae028d(0x27b)][_0xae028d(0x1b4)][_0xae028d(0x211)]++;}}for(const _0x51f871 of _0x46af80){if(_0x51f871[_0xae028d(0x1c4)]['isManaged'])continue;const _0x3fd93d=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x118c53),_0x51f871[_0xae028d(0x1c4)][_0xae028d(0x205)],_0xae028d(0x26a));_0x3fd93d[_0xae028d(0x1ac)]&&this[_0xae028d(0x1b6)][_0xae028d(0x23f)](_0xae028d(0x2b1)+a109_0x3b39de[_0xae028d(0x228)](_0x3fd93d[_0xae028d(0x270)])+_0xae028d(0x22a)+a109_0x3b39de[_0xae028d(0x228)](_0x3fd93d[_0xae028d(0x214)]));const _0x3ad55a=_0x3fd93d['path'],_0x5b36ae=apiKnowledgeBaseToYaml(_0x51f871),_0x2c0e5f=toKnowledgeBaseYamlString(_0x5b36ae),_0x223b3b=!a109_0xd05ade['existsSync'](_0x3ad55a);let _0x47aed9=_0x223b3b,_0x4f4dc7;if(!_0x223b3b){const _0x3c8c5b=a109_0xd05ade[_0xae028d(0x1d2)](_0x3ad55a,'utf-8'),_0x46660c=generateDiff(_0x3c8c5b,_0x2c0e5f);_0x47aed9=hasChanges(_0x46660c),_0x47aed9&&(_0x4f4dc7=formatDiffWithColors(_0x46660c));}_0x4d621f[_0xae028d(0x28b)]({'path':_0x3ad55a,'content':_0x2c0e5f}),_0x4c7e9b[_0xae028d(0x1f9)]['push']({'name':_0x51f871['attributes']['name'],'outputPath':_0x3ad55a,'isNew':_0x223b3b,'hasChanges':_0x47aed9,'diff':_0x4f4dc7}),_0x4c7e9b[_0xae028d(0x27b)]['knowledgeBases'][_0xae028d(0x1bf)]++;if(_0x223b3b)_0x4c7e9b[_0xae028d(0x27b)]['knowledgeBases']['new']++;else{if(_0x47aed9)_0x4c7e9b[_0xae028d(0x27b)]['knowledgeBases'][_0xae028d(0x2ae)]++;else _0x4c7e9b[_0xae028d(0x27b)][_0xae028d(0x1f9)][_0xae028d(0x211)]++;}}for(const _0xa8576 of _0x51c1e5){if(_0xa8576[_0xae028d(0x1c4)][_0xae028d(0x24a)])continue;const _0x212037=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x118c53),_0xa8576[_0xae028d(0x1c4)][_0xae028d(0x205)],'.md');_0x212037[_0xae028d(0x1ac)]&&this['logger']['info'](_0xae028d(0x2b6)+a109_0x3b39de[_0xae028d(0x228)](_0x212037[_0xae028d(0x270)])+_0xae028d(0x22a)+a109_0x3b39de[_0xae028d(0x228)](_0x212037[_0xae028d(0x214)]));const _0x28929d=_0x212037[_0xae028d(0x214)],_0x51e51d=toTextKnowledgeBaseMd(_0xa8576[_0xae028d(0x1c4)]['name'],_0xa8576['attributes'][_0xae028d(0x278)]),_0x3b5db2=!a109_0xd05ade[_0xae028d(0x20b)](_0x28929d);let _0x1c7501=_0x3b5db2,_0x2cd420;if(!_0x3b5db2){const _0x440f33=a109_0xd05ade[_0xae028d(0x1d2)](_0x28929d,_0xae028d(0x29d)),_0x960c75=generateDiff(_0x440f33,_0x51e51d);_0x1c7501=hasChanges(_0x960c75),_0x1c7501&&(_0x2cd420=formatDiffWithColors(_0x960c75));}_0x4d621f[_0xae028d(0x28b)]({'path':_0x28929d,'content':_0x51e51d}),_0x4c7e9b['textKnowledgeBases']['push']({'name':_0xa8576[_0xae028d(0x1c4)]['name'],'outputPath':_0x28929d,'isNew':_0x3b5db2,'hasChanges':_0x1c7501,'diff':_0x2cd420}),_0x4c7e9b[_0xae028d(0x27b)][_0xae028d(0x2a9)][_0xae028d(0x1bf)]++;if(_0x3b5db2)_0x4c7e9b[_0xae028d(0x27b)][_0xae028d(0x2a9)][_0xae028d(0x266)]++;else{if(_0x1c7501)_0x4c7e9b[_0xae028d(0x27b)][_0xae028d(0x2a9)][_0xae028d(0x2ae)]++;else _0x4c7e9b[_0xae028d(0x27b)]['textKnowledgeBases']['unchanged']++;}}for(const _0x25ebbc of _0x2e2338){if(_0x25ebbc[_0xae028d(0x1c4)]['isManaged'])continue;const _0x46a064=getSanitizedPathWithMigration(getPromptsDir(_0x118c53),_0x25ebbc[_0xae028d(0x1c4)]['name'],_0xae028d(0x26a));_0x46a064[_0xae028d(0x1ac)]&&this['logger'][_0xae028d(0x23f)]('Renamed\x20prompt\x20file:\x20'+a109_0x3b39de[_0xae028d(0x228)](_0x46a064[_0xae028d(0x270)])+_0xae028d(0x22a)+a109_0x3b39de[_0xae028d(0x228)](_0x46a064['path']));const _0x5bcc3c=_0x46a064['path'],_0x13d75e=await apiPromptToYaml(_0x25ebbc,_0x4128bb);if(!_0x13d75e)continue;const _0x20e2ae=toPromptYamlString(_0x13d75e),_0x5747b6=!a109_0xd05ade['existsSync'](_0x5bcc3c);let _0x50a642=_0x5747b6,_0x5ecb33;if(!_0x5747b6){const _0x4bc0c6=a109_0xd05ade[_0xae028d(0x1d2)](_0x5bcc3c,'utf-8'),_0x1ed8df=generateDiff(_0x4bc0c6,_0x20e2ae);_0x50a642=hasChanges(_0x1ed8df),_0x50a642&&(_0x5ecb33=formatDiffWithColors(_0x1ed8df));}_0x4d621f[_0xae028d(0x28b)]({'path':_0x5bcc3c,'content':_0x20e2ae}),_0x4c7e9b['prompts'][_0xae028d(0x28b)]({'name':_0x25ebbc['attributes'][_0xae028d(0x205)],'outputPath':_0x5bcc3c,'isNew':_0x5747b6,'hasChanges':_0x50a642,'diff':_0x5ecb33}),_0x4c7e9b['counts']['prompts'][_0xae028d(0x1bf)]++;if(_0x5747b6)_0x4c7e9b[_0xae028d(0x27b)]['prompts'][_0xae028d(0x266)]++;else{if(_0x50a642)_0x4c7e9b[_0xae028d(0x27b)][_0xae028d(0x25b)]['updated']++;else _0x4c7e9b[_0xae028d(0x27b)]['prompts'][_0xae028d(0x211)]++;}}for(const _0xf482be of _0xfbf48c){const _0x16fd28=_0xf482be[_0xae028d(0x1c4)][_0xae028d(0x1de)]['toLowerCase'](),_0x23de8a=getSanitizedPathWithMigration(getIntegrationsDir(_0x118c53),_0x16fd28,_0xae028d(0x26a));_0x23de8a[_0xae028d(0x1ac)]&&this[_0xae028d(0x1b6)]['info'](_0xae028d(0x1b2)+a109_0x3b39de[_0xae028d(0x228)](_0x23de8a[_0xae028d(0x270)])+_0xae028d(0x22a)+a109_0x3b39de[_0xae028d(0x228)](_0x23de8a['path']));const _0x2f8566=_0x23de8a[_0xae028d(0x214)],_0x25b35d=await apiIntegrationToYaml(_0xf482be,_0x4128bb),_0x3792be=toIntegrationYamlString(_0x25b35d),_0x13ed09=!a109_0xd05ade[_0xae028d(0x20b)](_0x2f8566);let _0x2c74d5=_0x13ed09,_0x20cd9c;if(!_0x13ed09){const _0x34293b=a109_0xd05ade[_0xae028d(0x1d2)](_0x2f8566,_0xae028d(0x29d)),_0x509818=generateDiff(_0x34293b,_0x3792be);_0x2c74d5=hasChanges(_0x509818),_0x2c74d5&&(_0x20cd9c=formatDiffWithColors(_0x509818));}_0x4d621f[_0xae028d(0x28b)]({'path':_0x2f8566,'content':_0x3792be}),_0x4c7e9b[_0xae028d(0x1fa)][_0xae028d(0x28b)]({'name':_0x16fd28,'outputPath':_0x2f8566,'isNew':_0x13ed09,'hasChanges':_0x2c74d5,'diff':_0x20cd9c}),_0x4c7e9b[_0xae028d(0x27b)]['integrations'][_0xae028d(0x1bf)]++;if(_0x13ed09)_0x4c7e9b['counts']['integrations'][_0xae028d(0x266)]++;else{if(_0x2c74d5)_0x4c7e9b[_0xae028d(0x27b)]['integrations'][_0xae028d(0x2ae)]++;else _0x4c7e9b[_0xae028d(0x27b)][_0xae028d(0x1fa)][_0xae028d(0x211)]++;}}for(const _0x1f3f55 of _0x1d4f20){if(_0x1f3f55[_0xae028d(0x1c4)][_0xae028d(0x24a)])continue;const _0x135989=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x118c53),_0x1f3f55['attributes'][_0xae028d(0x205)]);_0x135989[_0xae028d(0x1ac)]&&this[_0xae028d(0x1b6)][_0xae028d(0x23f)]('Renamed\x20experimental\x20KB\x20directory:\x20'+a109_0x3b39de[_0xae028d(0x228)](_0x135989[_0xae028d(0x270)])+_0xae028d(0x22a)+a109_0x3b39de['basename'](_0x135989[_0xae028d(0x214)]));const _0x139524=_0x135989['path'],_0xaa0527=a109_0x3b39de['join'](_0x139524,sanitizeForFilesystem(_0x1f3f55['attributes'][_0xae028d(0x205)])+_0xae028d(0x26a)),_0x1d7ebe=a109_0x3b39de[_0xae028d(0x24f)](_0x139524,_0xae028d(0x2ab)),_0x53d000=apiExperimentalKnowledgeBaseToYaml(_0x1f3f55),_0x35cf71=toExperimentalKnowledgeBaseYamlString(_0x53d000),_0xc5da68=!a109_0xd05ade[_0xae028d(0x20b)](_0x139524);let _0x33ebe6=_0xc5da68,_0x4835eb,_0x5d0369=_0x35cf71;const _0x37435f=[..._0x53d000[_0xae028d(0x2ab)]][_0xae028d(0x210)]((_0x5cbc28,_0x205018)=>_0x5cbc28['name']['localeCompare'](_0x205018[_0xae028d(0x205)]));for(const _0x3f94bc of _0x37435f){_0x5d0369+=_0xae028d(0x2b3)+_0x3f94bc['name']+_0xae028d(0x204)+_0x3f94bc['code']+'\x0a---\x20schema:\x20'+_0x3f94bc['name']+_0xae028d(0x204)+_0x3f94bc[_0xae028d(0x1cd)]+'\x0a';}if(!_0xc5da68){let _0xb0ab47='';a109_0xd05ade[_0xae028d(0x20b)](_0xaa0527)&&(_0xb0ab47=a109_0xd05ade[_0xae028d(0x1d2)](_0xaa0527,_0xae028d(0x29d)));if(a109_0xd05ade[_0xae028d(0x20b)](_0x1d7ebe)){const _0x300fc1=a109_0xd05ade[_0xae028d(0x282)](_0x1d7ebe,{'withFileTypes':!![]}),_0x171948=_0x300fc1[_0xae028d(0x2ac)](_0x216fc3=>_0x216fc3['isDirectory']())[_0xae028d(0x210)]((_0x4f3c5b,_0x411063)=>_0x4f3c5b[_0xae028d(0x205)][_0xae028d(0x1af)](_0x411063[_0xae028d(0x205)]));for(const _0x2a469a of _0x171948){const _0x876f6d=a109_0x3b39de['join'](_0x1d7ebe,_0x2a469a[_0xae028d(0x205)],_0xae028d(0x262)),_0x9928f2=a109_0x3b39de[_0xae028d(0x24f)](_0x1d7ebe,_0x2a469a['name'],_0xae028d(0x1d9));a109_0xd05ade['existsSync'](_0x876f6d)&&(_0xb0ab47+=_0xae028d(0x2b3)+_0x2a469a[_0xae028d(0x205)]+_0xae028d(0x204)+a109_0xd05ade[_0xae028d(0x1d2)](_0x876f6d,_0xae028d(0x29d))+'\x0a'),a109_0xd05ade[_0xae028d(0x20b)](_0x9928f2)&&(_0xb0ab47+=_0xae028d(0x298)+_0x2a469a['name']+_0xae028d(0x204)+a109_0xd05ade[_0xae028d(0x1d2)](_0x9928f2,_0xae028d(0x29d))+'\x0a');}}const _0x423c0e=generateDiff(_0xb0ab47,_0x5d0369);_0x33ebe6=hasChanges(_0x423c0e),_0x33ebe6&&(_0x4835eb=formatDiffWithColors(_0x423c0e));}_0x4d621f[_0xae028d(0x28b)]({'path':_0x139524,'content':'','isDir':!![]}),_0x4d621f[_0xae028d(0x28b)]({'path':_0xaa0527,'content':_0x35cf71}),_0x4d621f[_0xae028d(0x28b)]({'path':_0x1d7ebe,'content':'','isDir':!![]});for(const _0x1d042b of _0x53d000[_0xae028d(0x2ab)]){const _0x17b0fb=a109_0x3b39de[_0xae028d(0x24f)](_0x1d7ebe,sanitizeForFilesystem(_0x1d042b[_0xae028d(0x205)])),_0x4b1138=a109_0x3b39de[_0xae028d(0x24f)](_0x17b0fb,'code.js'),_0xb2d25a=a109_0x3b39de['join'](_0x17b0fb,_0xae028d(0x1d9));_0x4d621f[_0xae028d(0x28b)]({'path':_0x17b0fb,'content':'','isDir':!![]}),_0x4d621f['push']({'path':_0x4b1138,'content':_0x1d042b[_0xae028d(0x1e3)]}),_0x4d621f[_0xae028d(0x28b)]({'path':_0xb2d25a,'content':_0x1d042b[_0xae028d(0x1cd)]});}if(a109_0xd05ade['existsSync'](_0x1d7ebe)){const _0x520767=a109_0xd05ade[_0xae028d(0x282)](_0x1d7ebe,{'withFileTypes':!![]}),_0x39156a=new Set(_0x53d000[_0xae028d(0x2ab)][_0xae028d(0x296)](_0x3fdacb=>sanitizeForFilesystem(_0x3fdacb[_0xae028d(0x205)])));for(const _0x20f8e8 of _0x520767){if(_0x20f8e8[_0xae028d(0x24c)]()&&!_0x39156a['has'](_0x20f8e8[_0xae028d(0x205)])){const _0x14bd60=a109_0x3b39de[_0xae028d(0x24f)](_0x1d7ebe,_0x20f8e8['name']);_0xbe4cdf['push']({'path':_0x14bd60,'isDir':!![]});}}}_0x4c7e9b[_0xae028d(0x209)][_0xae028d(0x28b)]({'name':_0x1f3f55[_0xae028d(0x1c4)][_0xae028d(0x205)],'outputPath':_0x139524,'isNew':_0xc5da68,'hasChanges':_0x33ebe6,'diff':_0x4835eb}),_0x4c7e9b[_0xae028d(0x27b)][_0xae028d(0x209)][_0xae028d(0x1bf)]++;if(_0xc5da68)_0x4c7e9b['counts'][_0xae028d(0x209)][_0xae028d(0x266)]++;else{if(_0x33ebe6)_0x4c7e9b[_0xae028d(0x27b)][_0xae028d(0x209)][_0xae028d(0x2ae)]++;else _0x4c7e9b[_0xae028d(0x27b)][_0xae028d(0x209)][_0xae028d(0x211)]++;}}for(const _0x31d529 of _0x1d36c0){if(_0x31d529[_0xae028d(0x1c4)]['isManaged'])continue;const _0x2f0e56=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x118c53),_0x31d529[_0xae028d(0x1c4)]['name']);_0x2f0e56[_0xae028d(0x1ac)]&&this[_0xae028d(0x1b6)][_0xae028d(0x23f)](_0xae028d(0x2bd)+a109_0x3b39de[_0xae028d(0x228)](_0x2f0e56[_0xae028d(0x270)])+_0xae028d(0x22a)+a109_0x3b39de[_0xae028d(0x228)](_0x2f0e56[_0xae028d(0x214)]));const _0x3b7be7=_0x2f0e56[_0xae028d(0x214)],_0x2bdca3=a109_0x3b39de[_0xae028d(0x24f)](_0x3b7be7,sanitizeForFilesystem(_0x31d529[_0xae028d(0x1c4)]['name'])+_0xae028d(0x26a)),_0x576c71=a109_0x3b39de['join'](_0x3b7be7,_0xae028d(0x262)),_0x58b525=a109_0x3b39de[_0xae028d(0x24f)](_0x3b7be7,_0xae028d(0x265)),_0x596c1e=apiExperimentalArtifactToYaml(_0x31d529),_0x5dc011=toExperimentalArtifactYamlString(_0x596c1e),_0x2fc71d=!a109_0xd05ade[_0xae028d(0x20b)](_0x3b7be7);let _0x272cfc=_0x2fc71d,_0x2504ae,_0x2c7c70=_0x5dc011+(_0xae028d(0x1b9)+_0x596c1e['code']+'\x0a');const _0x779909=[..._0x596c1e[_0xae028d(0x265)]][_0xae028d(0x210)]((_0x5fb25d,_0x31566d)=>_0x5fb25d[_0xae028d(0x290)]['localeCompare'](_0x31566d['file_name']));for(const _0x8aa4e1 of _0x779909){_0x2c7c70+=_0xae028d(0x201)+_0x8aa4e1[_0xae028d(0x290)]+_0xae028d(0x204)+_0x8aa4e1[_0xae028d(0x1ce)]+'\x0a';}if(!_0x2fc71d){let _0x3bcbfe='';a109_0xd05ade[_0xae028d(0x20b)](_0x2bdca3)&&(_0x3bcbfe=a109_0xd05ade['readFileSync'](_0x2bdca3,_0xae028d(0x29d)));a109_0xd05ade[_0xae028d(0x20b)](_0x576c71)&&(_0x3bcbfe+=_0xae028d(0x1b9)+a109_0xd05ade[_0xae028d(0x1d2)](_0x576c71,_0xae028d(0x29d))+'\x0a');if(a109_0xd05ade[_0xae028d(0x20b)](_0x58b525)){const _0x34324c=a109_0xd05ade['readdirSync'](_0x58b525),_0x5f3c74=_0x34324c[_0xae028d(0x2ac)](_0x5524d8=>{const _0xd86f0d=_0xae028d,_0x4b0779=a109_0x3b39de[_0xd86f0d(0x24f)](_0x58b525,_0x5524d8);return a109_0xd05ade[_0xd86f0d(0x206)](_0x4b0779)[_0xd86f0d(0x27a)]();})['sort']((_0x3d2745,_0x438511)=>_0x3d2745[_0xae028d(0x1af)](_0x438511));for(const _0x23ca43 of _0x5f3c74){const _0x131ec4=a109_0x3b39de[_0xae028d(0x24f)](_0x58b525,_0x23ca43);_0x3bcbfe+=_0xae028d(0x201)+_0x23ca43+_0xae028d(0x204)+a109_0xd05ade[_0xae028d(0x1d2)](_0x131ec4,_0xae028d(0x29d))+'\x0a';}}const _0x4d0275=generateDiff(_0x3bcbfe,_0x2c7c70);_0x272cfc=hasChanges(_0x4d0275),_0x272cfc&&(_0x2504ae=formatDiffWithColors(_0x4d0275));}_0x4d621f[_0xae028d(0x28b)]({'path':_0x3b7be7,'content':'','isDir':!![]}),_0x4d621f[_0xae028d(0x28b)]({'path':_0x2bdca3,'content':_0x5dc011}),_0x4d621f[_0xae028d(0x28b)]({'path':_0x576c71,'content':_0x596c1e[_0xae028d(0x1e3)]});if(_0x596c1e[_0xae028d(0x265)][_0xae028d(0x1d8)]>0x0){_0x4d621f[_0xae028d(0x28b)]({'path':_0x58b525,'content':'','isDir':!![]});for(const _0x163190 of _0x596c1e['files']){const _0x43ac07=a109_0x3b39de[_0xae028d(0x24f)](_0x58b525,_0x163190['file_name']);_0x4d621f[_0xae028d(0x28b)]({'path':_0x43ac07,'content':_0x163190[_0xae028d(0x1ce)]});}}if(a109_0xd05ade['existsSync'](_0x58b525)){const _0x31e661=a109_0xd05ade[_0xae028d(0x282)](_0x58b525),_0x4c0842=new Set(_0x596c1e[_0xae028d(0x265)]['map'](_0xe70d=>_0xe70d[_0xae028d(0x290)]));for(const _0x231997 of _0x31e661){const _0x50425c=a109_0x3b39de['join'](_0x58b525,_0x231997);a109_0xd05ade[_0xae028d(0x206)](_0x50425c)[_0xae028d(0x27a)]()&&!_0x4c0842[_0xae028d(0x1ea)](_0x231997)&&_0xbe4cdf['push']({'path':_0x50425c});}}_0x4c7e9b[_0xae028d(0x1df)][_0xae028d(0x28b)]({'name':_0x31d529['attributes'][_0xae028d(0x205)],'outputPath':_0x3b7be7,'isNew':_0x2fc71d,'hasChanges':_0x272cfc,'diff':_0x2504ae}),_0x4c7e9b['counts'][_0xae028d(0x1df)][_0xae028d(0x1bf)]++;if(_0x2fc71d)_0x4c7e9b[_0xae028d(0x27b)][_0xae028d(0x1df)][_0xae028d(0x266)]++;else{if(_0x272cfc)_0x4c7e9b[_0xae028d(0x27b)][_0xae028d(0x1df)][_0xae028d(0x2ae)]++;else _0x4c7e9b[_0xae028d(0x27b)]['experimentalArtifacts'][_0xae028d(0x211)]++;}}if(_0x15ba12?.[_0xae028d(0x260)])return _0x4c7e9b;a109_0xd05ade['mkdirSync'](_0x118c53,{'recursive':!![]}),a109_0xd05ade[_0xae028d(0x22c)](getKnowledgeBasesDir(_0x118c53),{'recursive':!![]}),a109_0xd05ade[_0xae028d(0x22c)](getPromptsDir(_0x118c53),{'recursive':!![]}),a109_0xd05ade[_0xae028d(0x22c)](getIntegrationsDir(_0x118c53),{'recursive':!![]}),a109_0xd05ade[_0xae028d(0x22c)](getExperimentalKnowledgeBasesDir(_0x118c53),{'recursive':!![]}),a109_0xd05ade['mkdirSync'](getExperimentalArtifactsDir(_0x118c53),{'recursive':!![]});const _0xbbcbcf=a109_0x3b39de['join'](_0x118c53,_0xae028d(0x252));a109_0xd05ade['writeFileSync'](_0xbbcbcf,createAgentConfigContent(_0x48775e));for(const _0x3d9f0b of _0x4d621f){if(_0x3d9f0b[_0xae028d(0x23a)])a109_0xd05ade[_0xae028d(0x22c)](_0x3d9f0b[_0xae028d(0x214)],{'recursive':!![]});else{const _0x3570c3=a109_0x3b39de[_0xae028d(0x258)](_0x3d9f0b[_0xae028d(0x214)]);!a109_0xd05ade[_0xae028d(0x20b)](_0x3570c3)&&a109_0xd05ade[_0xae028d(0x22c)](_0x3570c3,{'recursive':!![]}),a109_0xd05ade['writeFileSync'](_0x3d9f0b[_0xae028d(0x214)],_0x3d9f0b[_0xae028d(0x1e8)]);}}for(const _0xf8acdf of _0xbe4cdf){_0xf8acdf[_0xae028d(0x23a)]?(a109_0xd05ade['rmSync'](_0xf8acdf[_0xae028d(0x214)],{'recursive':!![],'force':!![]}),this[_0xae028d(0x1b6)][_0xae028d(0x23f)](_0xae028d(0x25a)+a109_0x3b39de['basename'](a109_0x3b39de[_0xae028d(0x258)](_0xf8acdf['path']))+'/'+a109_0x3b39de[_0xae028d(0x228)](_0xf8acdf[_0xae028d(0x214)]))):(a109_0xd05ade[_0xae028d(0x1d6)](_0xf8acdf[_0xae028d(0x214)],{'force':!![]}),this[_0xae028d(0x1b6)][_0xae028d(0x23f)](_0xae028d(0x1ed)+a109_0x3b39de[_0xae028d(0x228)](a109_0x3b39de[_0xae028d(0x258)](_0xf8acdf[_0xae028d(0x214)]))+'/'+a109_0x3b39de['basename'](_0xf8acdf[_0xae028d(0x214)])));}return _0x4c7e9b;}async[a109_0x291832(0x27d)](_0x7944e3,_0xf6aa8c){const _0x59575c=a109_0x291832,_0x1e91d5=a109_0x3b39de[_0x59575c(0x24f)](_0x7944e3,_0x59575c(0x252));if(!a109_0xd05ade[_0x59575c(0x20b)](_0x1e91d5))throw new SDKError(ErrorCode[_0x59575c(0x23e)],_0x59575c(0x268)+_0x7944e3,undefined,{'helpText':_0x59575c(0x1b3)});const _0x2bc778=loadAgentConfig(_0x1e91d5),_0x1d8ffd=await this[_0x59575c(0x1dd)](_0x2bc778[_0x59575c(0x23c)]),_0x473973=await this['client']['getProject'](_0x1d8ffd),_0x3e9f7c=_0x473973['attributes'][_0x59575c(0x205)],_0xc22290={'projectName':_0x3e9f7c,'projectId':_0x1d8ffd,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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}}},_0x17c66c=[],_0x135266=[],_0x5cce86=[],_0x1f181e=[],_0x3b06bd=[],_0x2c9a3c=[],_0x516b95=a109_0xd05ade['readdirSync'](_0x7944e3,{'withFileTypes':!![]});for(const _0x5dd10c of _0x516b95){if(!_0x5dd10c[_0x59575c(0x24c)]())continue;if([_0x59575c(0x2b0),_0x59575c(0x25b),_0x59575c(0x1fa),_0x59575c(0x21b),_0x59575c(0x1a7)][_0x59575c(0x242)](_0x5dd10c['name']))continue;const _0x2fbb41=a109_0x3b39de[_0x59575c(0x24f)](_0x7944e3,_0x5dd10c[_0x59575c(0x205)]);if(isAgentDir(_0x2fbb41)){const _0x1d6b0c=a109_0x3b39de[_0x59575c(0x24f)](_0x2fbb41,'agent.yml'),_0x5dcfb8=a109_0x3b39de['join'](_0x2fbb41,_0x59575c(0x255)),_0x12fde7=a109_0x3b39de['join'](_0x2fbb41,'starter_message.md'),_0x232347=parseAgentYaml(a109_0xd05ade['readFileSync'](_0x1d6b0c,_0x59575c(0x29d)),_0x1d6b0c),_0x317353=a109_0xd05ade[_0x59575c(0x20b)](_0x5dcfb8)?a109_0xd05ade[_0x59575c(0x1d2)](_0x5dcfb8,_0x59575c(0x29d)):'',_0x3aa67e=a109_0xd05ade[_0x59575c(0x20b)](_0x12fde7)?a109_0xd05ade[_0x59575c(0x1d2)](_0x12fde7,_0x59575c(0x29d)):_0x232347['starter_message'];_0x17c66c['push']({'name':_0x232347[_0x59575c(0x205)],'dir':_0x2fbb41,'yaml':_0x232347,'systemPrompt':_0x317353,'starterMessage':_0x3aa67e});}}const _0x409843=getKnowledgeBasesDir(_0x7944e3);if(a109_0xd05ade[_0x59575c(0x20b)](_0x409843)){const _0xe8aa4a=a109_0xd05ade[_0x59575c(0x282)](_0x409843);for(const _0x1b1296 of _0xe8aa4a){const _0x309b76=a109_0x3b39de[_0x59575c(0x24f)](_0x409843,_0x1b1296);if(_0x1b1296[_0x59575c(0x25d)](_0x59575c(0x26a))){const _0x189319=parseKnowledgeBaseYaml(a109_0xd05ade[_0x59575c(0x1d2)](_0x309b76,_0x59575c(0x29d)),_0x309b76);_0x135266[_0x59575c(0x28b)]({'name':_0x189319['name'],'path':_0x309b76,'yaml':_0x189319});}else{if(_0x1b1296['endsWith'](_0x59575c(0x25c))){const _0x1639ab=a109_0xd05ade[_0x59575c(0x1d2)](_0x309b76,_0x59575c(0x29d)),{name:_0x25d285,text:_0x307c7c}=parseTextKnowledgeBaseMd(_0x1639ab,_0x1b1296);_0x5cce86[_0x59575c(0x28b)]({'name':_0x25d285,'path':_0x309b76,'text':_0x307c7c});}}}}const _0x59acd3=getPromptsDir(_0x7944e3);if(a109_0xd05ade['existsSync'](_0x59acd3)){const _0x2df725=a109_0xd05ade[_0x59575c(0x282)](_0x59acd3)[_0x59575c(0x2ac)](_0x481be2=>_0x481be2[_0x59575c(0x25d)](_0x59575c(0x26a)));for(const _0x44ce34 of _0x2df725){const _0x587221=a109_0x3b39de['join'](_0x59acd3,_0x44ce34),_0x1d9035=parsePromptYaml(a109_0xd05ade[_0x59575c(0x1d2)](_0x587221,_0x59575c(0x29d)),_0x587221);_0x1f181e['push']({'name':_0x1d9035['name'],'path':_0x587221,'yaml':_0x1d9035});}}const _0x3b602b=[],_0x17014b=getIntegrationsDir(_0x7944e3);if(a109_0xd05ade['existsSync'](_0x17014b)){const _0x3458a4=a109_0xd05ade[_0x59575c(0x282)](_0x17014b)[_0x59575c(0x2ac)](_0x28d855=>_0x28d855[_0x59575c(0x25d)](_0x59575c(0x26a)));for(const _0x400878 of _0x3458a4){const _0x482061=a109_0x3b39de[_0x59575c(0x24f)](_0x17014b,_0x400878),_0x23f118=parseIntegrationYaml(a109_0xd05ade['readFileSync'](_0x482061,_0x59575c(0x29d)),_0x482061);if(!SAFE_INTEGRATION_TYPES['includes'](_0x23f118[_0x59575c(0x238)][_0x59575c(0x261)]())){this['logger'][_0x59575c(0x2bf)](_0x59575c(0x21d)+_0x23f118[_0x59575c(0x205)]+_0x59575c(0x2a5)+_0x23f118['service_type']+'):\x20'+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x59575c(0x264))+'Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.');continue;}_0x3b602b[_0x59575c(0x28b)]({'name':_0x23f118[_0x59575c(0x205)],'path':_0x482061,'yaml':_0x23f118});}}const _0x200fbe=getExperimentalKnowledgeBasesDir(_0x7944e3);if(a109_0xd05ade['existsSync'](_0x200fbe)){const _0x3ca7d6=a109_0xd05ade['readdirSync'](_0x200fbe,{'withFileTypes':!![]});for(const _0x5d6c97 of _0x3ca7d6){if(!_0x5d6c97[_0x59575c(0x24c)]())continue;const _0x538de2=a109_0x3b39de[_0x59575c(0x24f)](_0x200fbe,_0x5d6c97[_0x59575c(0x205)]),_0x743181=a109_0x3b39de[_0x59575c(0x24f)](_0x538de2,_0x5d6c97[_0x59575c(0x205)]+_0x59575c(0x26a)),_0x204ec7=a109_0x3b39de[_0x59575c(0x24f)](_0x538de2,_0x59575c(0x2ab));if(!a109_0xd05ade[_0x59575c(0x20b)](_0x743181))continue;const _0x2b495f=parseExperimentalKnowledgeBaseYaml(a109_0xd05ade[_0x59575c(0x1d2)](_0x743181,_0x59575c(0x29d)),_0x743181),_0x150279=[];if(a109_0xd05ade[_0x59575c(0x20b)](_0x204ec7)){const _0x12ecbf=a109_0xd05ade[_0x59575c(0x282)](_0x204ec7,{'withFileTypes':!![]});for(const _0x29da44 of _0x12ecbf){if(!_0x29da44[_0x59575c(0x24c)]())continue;const _0xe7358c=a109_0x3b39de[_0x59575c(0x24f)](_0x204ec7,_0x29da44[_0x59575c(0x205)]),_0x4bb520=a109_0x3b39de['join'](_0xe7358c,_0x59575c(0x262)),_0x908eaf=a109_0x3b39de[_0x59575c(0x24f)](_0xe7358c,_0x59575c(0x1d9));a109_0xd05ade[_0x59575c(0x20b)](_0x4bb520)&&a109_0xd05ade['existsSync'](_0x908eaf)&&_0x150279['push']({'name':_0x29da44[_0x59575c(0x205)],'code':a109_0xd05ade['readFileSync'](_0x4bb520,_0x59575c(0x29d)),'json_schema':a109_0xd05ade[_0x59575c(0x1d2)](_0x908eaf,_0x59575c(0x29d))});}}const _0x5aa98b={..._0x2b495f,'variables':_0x2b495f[_0x59575c(0x28a)]||[],'functions':_0x150279};_0x3b06bd[_0x59575c(0x28b)]({'name':_0x2b495f[_0x59575c(0x205)],'dir':_0x538de2,'def':_0x5aa98b});}}const _0x2162ca=getExperimentalArtifactsDir(_0x7944e3);if(a109_0xd05ade[_0x59575c(0x20b)](_0x2162ca)){const _0x50c7ea=a109_0xd05ade[_0x59575c(0x282)](_0x2162ca,{'withFileTypes':!![]});for(const _0x4681ff of _0x50c7ea){if(!_0x4681ff[_0x59575c(0x24c)]())continue;const _0x202dc1=a109_0x3b39de[_0x59575c(0x24f)](_0x2162ca,_0x4681ff[_0x59575c(0x205)]),_0x1f272b=a109_0x3b39de['join'](_0x202dc1,_0x4681ff[_0x59575c(0x205)]+'.yml'),_0x4747a9=a109_0x3b39de[_0x59575c(0x24f)](_0x202dc1,_0x59575c(0x262)),_0x48b0a8=a109_0x3b39de[_0x59575c(0x24f)](_0x202dc1,_0x59575c(0x265));if(!a109_0xd05ade[_0x59575c(0x20b)](_0x1f272b)||!a109_0xd05ade[_0x59575c(0x20b)](_0x4747a9))continue;const _0x4e9fcc=parseExperimentalArtifactYaml(a109_0xd05ade[_0x59575c(0x1d2)](_0x1f272b,_0x59575c(0x29d)),_0x1f272b),_0x1f6cf1=a109_0xd05ade[_0x59575c(0x1d2)](_0x4747a9,_0x59575c(0x29d)),_0x28ac5d=[];if(a109_0xd05ade[_0x59575c(0x20b)](_0x48b0a8)){const _0x3c62a6=a109_0xd05ade['readdirSync'](_0x48b0a8);for(const _0x1b1268 of _0x3c62a6){const _0x5077e9=a109_0x3b39de[_0x59575c(0x24f)](_0x48b0a8,_0x1b1268);a109_0xd05ade[_0x59575c(0x206)](_0x5077e9)['isFile']()&&_0x28ac5d['push']({'file_name':_0x1b1268,'text_content':a109_0xd05ade[_0x59575c(0x1d2)](_0x5077e9,_0x59575c(0x29d))});}}const _0x54a063={..._0x4e9fcc,'code':_0x1f6cf1,'files':_0x28ac5d};_0x2c9a3c[_0x59575c(0x28b)]({'name':_0x4e9fcc[_0x59575c(0x205)],'dir':_0x202dc1,'def':_0x54a063});}}const _0x3f43ae=await this['client'][_0x59575c(0x229)](_0x1d8ffd),_0x268b0d=await this[_0x59575c(0x2bc)][_0x59575c(0x1c3)](_0x1d8ffd),_0x3f1e69=await this[_0x59575c(0x2bc)][_0x59575c(0x1d5)](_0x1d8ffd),_0xdaf34e=await this[_0x59575c(0x2bc)]['listPrompts'](_0x1d8ffd),_0x43300c=await this[_0x59575c(0x2bc)][_0x59575c(0x1f8)](_0x1d8ffd),_0x4ac2e2=await safeListOrEmpty(()=>this[_0x59575c(0x2bc)][_0x59575c(0x1b8)](_0x1d8ffd)),_0x268bf4=await safeListOrEmpty(()=>this[_0x59575c(0x2bc)][_0x59575c(0x263)](_0x1d8ffd)),_0x48479e=await fetchAllToolTargetMaps((_0x1af812,_0x4c530e)=>this[_0x59575c(0x2bc)][_0x59575c(0x27f)](_0x1af812,_0x4c530e),_0x1d8ffd),_0x55e225=new Map(),_0x2ff3d0=new Map(),_0x4529e5=new Map(),_0x39fd7a=new Map(),_0x504042=new Map(),_0x93a687=new Map(),_0x294df6=new Map();for(const _0x4f5898 of _0x3f43ae){_0x55e225[_0x59575c(0x230)](_0x4f5898[_0x59575c(0x1c4)][_0x59575c(0x205)],_0x4f5898);}for(const _0x2669c8 of _0x268b0d){_0x2ff3d0['set'](_0x2669c8['attributes'][_0x59575c(0x205)],_0x2669c8);}for(const _0x136427 of _0x3f1e69){_0x4529e5[_0x59575c(0x230)](_0x136427['attributes'][_0x59575c(0x205)],_0x136427);}for(const _0x1682c3 of _0xdaf34e){_0x39fd7a[_0x59575c(0x230)](_0x1682c3[_0x59575c(0x1c4)][_0x59575c(0x205)],_0x1682c3);}for(const _0x47674d of _0x43300c){_0x504042[_0x59575c(0x230)](_0x47674d[_0x59575c(0x1c4)][_0x59575c(0x1de)]['toLowerCase'](),_0x47674d);}for(const _0x20e64f of _0x4ac2e2){_0x93a687[_0x59575c(0x230)](_0x20e64f[_0x59575c(0x1c4)]['name'],_0x20e64f);}for(const _0x51c532 of _0x268bf4){_0x294df6[_0x59575c(0x230)](_0x51c532[_0x59575c(0x1c4)]['name'],_0x51c532);}const _0x1772ef=new Map(),_0x31a6fc=new Map();for(const _0x3bc551 of _0x3f43ae){_0x1772ef['set'](_0x3bc551[_0x59575c(0x1c4)][_0x59575c(0x205)],_0x3bc551['id']),_0x31a6fc[_0x59575c(0x230)](_0x3bc551['id'],_0x3bc551['attributes']['name']);}const _0x2bf267=new Map(),_0x31009a=new Map();for(const _0x5e8941 of _0xdaf34e){_0x2bf267[_0x59575c(0x230)](_0x5e8941[_0x59575c(0x1c4)][_0x59575c(0x205)],_0x5e8941['id']),_0x31009a[_0x59575c(0x230)](_0x5e8941['id'],_0x5e8941['attributes']['name']);}const _0x5b5cae=_0x48479e[_0x59575c(0x254)][_0x59575c(0x20d)]||new Map(),_0x58121d=_0x48479e[_0x59575c(0x254)]['TextKnowledgeBase']||new Map(),_0x50af7a=_0x48479e[_0x59575c(0x254)]['ExperimentalKnowledgeBase']||new Map(),_0x17d652=new Map(),_0x2b4428={'resolveToolTargetName':buildNameResolver({..._0x48479e[_0x59575c(0x1cc)],'Agent':_0x31a6fc}),'resolvePromptName':async _0x15ddda=>_0x31009a[_0x59575c(0x1dc)](_0x15ddda),'onWarning':_0x36a05c=>this['logger'][_0x59575c(0x2bf)](_0x36a05c)};let _0x112a9e=[];const _0x545770={'projectId':_0x1d8ffd,'resolveToolTargetId':buildIdResolver({..._0x48479e[_0x59575c(0x254)],'Agent':_0x1772ef}),'resolvePromptId':async _0x5bfbea=>_0x2bf267[_0x59575c(0x1dc)](_0x5bfbea),'onWarning':_0x1efabe=>{const _0x5aca0d=_0x59575c;this['logger'][_0x5aca0d(0x2bf)](_0x1efabe),_0x112a9e[_0x5aca0d(0x28b)](_0x1efabe);}},{resolved:_0x9fca1c,unresolved:_0x4807ee}=resolveAgentDependencies(_0x17c66c,new Set(_0x55e225['keys']()));for(const {agent:_0x25c9d8,missingDeps:_0x2c1921}of _0x4807ee){_0xc22290[_0x59575c(0x1b4)]['push']({'agentName':_0x25c9d8[_0x59575c(0x1e4)][_0x59575c(0x205)],'action':_0x59575c(0x1ad),'error':_0x59575c(0x1c1)+_0x2c1921[_0x59575c(0x24f)](',\x20')+_0x59575c(0x27c)}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x1b4)]['errors']++;}for(const _0x4cc485 of _0x135266){const _0x4b9017=_0x2ff3d0[_0x59575c(0x1dc)](_0x4cc485[_0x59575c(0x1e4)][_0x59575c(0x205)]),_0x4bfe98=a109_0xd05ade[_0x59575c(0x1d2)](_0x4cc485['path'],'utf-8');if(_0x4b9017){const _0x30f2bb=apiKnowledgeBaseToYaml(_0x4b9017),_0x37be47=toKnowledgeBaseYamlString(_0x30f2bb),_0x4a0531=generateDiff(_0x37be47,_0x4bfe98),_0x3405e1=hasChanges(_0x4a0531);_0x3405e1?(_0xc22290[_0x59575c(0x1f9)][_0x59575c(0x28b)]({'name':_0x4cc485['yaml']['name'],'action':'updated','id':_0x4b9017['id'],'diff':formatDiffWithColors(_0x4a0531)}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x1f9)][_0x59575c(0x2ae)]++):(_0xc22290[_0x59575c(0x1f9)][_0x59575c(0x28b)]({'name':_0x4cc485[_0x59575c(0x1e4)][_0x59575c(0x205)],'action':_0x59575c(0x211),'id':_0x4b9017['id']}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x1f9)][_0x59575c(0x211)]++);}else _0xc22290['knowledgeBases'][_0x59575c(0x28b)]({'name':_0x4cc485['yaml'][_0x59575c(0x205)],'action':_0x59575c(0x243)}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x1f9)][_0x59575c(0x243)]++;}for(const _0x1f6f98 of _0x5cce86){const _0x799381=_0x4529e5[_0x59575c(0x1dc)](_0x1f6f98[_0x59575c(0x205)]),_0x4b366c=a109_0xd05ade[_0x59575c(0x1d2)](_0x1f6f98[_0x59575c(0x214)],_0x59575c(0x29d));if(_0x799381){const _0x302843=toTextKnowledgeBaseMd(_0x799381[_0x59575c(0x1c4)][_0x59575c(0x205)],_0x799381[_0x59575c(0x1c4)]['text']),_0x204ab7=generateDiff(_0x302843,_0x4b366c),_0x1cac69=hasChanges(_0x204ab7);_0x1cac69?(_0xc22290[_0x59575c(0x2a9)][_0x59575c(0x28b)]({'name':_0x1f6f98['name'],'action':'updated','id':_0x799381['id'],'diff':formatDiffWithColors(_0x204ab7)}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x2a9)][_0x59575c(0x2ae)]++):(_0xc22290[_0x59575c(0x2a9)][_0x59575c(0x28b)]({'name':_0x1f6f98['name'],'action':'unchanged','id':_0x799381['id']}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x2a9)][_0x59575c(0x211)]++);}else _0xc22290['textKnowledgeBases'][_0x59575c(0x28b)]({'name':_0x1f6f98['name'],'action':_0x59575c(0x243)}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x2a9)][_0x59575c(0x243)]++;}for(const _0x31b7ae of _0x9fca1c){const _0x5e1ada=_0x55e225[_0x59575c(0x1dc)](_0x31b7ae['yaml'][_0x59575c(0x205)]),_0x49ef8d=a109_0x3b39de[_0x59575c(0x24f)](_0x31b7ae[_0x59575c(0x28c)],_0x59575c(0x2a7)),_0x3f699f=a109_0xd05ade[_0x59575c(0x1d2)](_0x49ef8d,_0x59575c(0x29d)),_0x22492c=_0x31b7ae['systemPrompt'],_0x196bda=_0x59575c(0x2af)+_0x22492c+_0x59575c(0x28e)+_0x3f699f;if(_0x5e1ada){const {yaml:_0x32e3da,systemPrompt:_0x91de5a}=await agentResponseToDef(_0x5e1ada,_0x2b4428),_0x517b7f=toAgentYamlString(_0x32e3da),_0x785828=_0x59575c(0x2af)+_0x91de5a+'\x0a\x0a#\x20agent.yml\x0a'+_0x517b7f,_0x473220=generateDiff(_0x785828,_0x196bda),_0x3aa70e=hasChanges(_0x473220);_0x3aa70e?(_0xc22290['agents'][_0x59575c(0x28b)]({'agentName':_0x31b7ae[_0x59575c(0x1e4)][_0x59575c(0x205)],'action':'updated','agentId':_0x5e1ada['id'],'diff':formatDiffWithColors(_0x473220)}),_0xc22290['counts'][_0x59575c(0x1b4)][_0x59575c(0x2ae)]++):(_0xc22290[_0x59575c(0x1b4)][_0x59575c(0x28b)]({'agentName':_0x31b7ae[_0x59575c(0x1e4)][_0x59575c(0x205)],'action':'unchanged','agentId':_0x5e1ada['id']}),_0xc22290[_0x59575c(0x27b)]['agents']['unchanged']++);}else _0xc22290[_0x59575c(0x1b4)][_0x59575c(0x28b)]({'agentName':_0x31b7ae[_0x59575c(0x1e4)][_0x59575c(0x205)],'action':_0x59575c(0x243)}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x1b4)]['created']++;}for(const _0x169cc6 of _0x1f181e){const _0x534d7e=_0x39fd7a['get'](_0x169cc6[_0x59575c(0x1e4)][_0x59575c(0x205)]),_0x5c5f57=a109_0xd05ade[_0x59575c(0x1d2)](_0x169cc6['path'],_0x59575c(0x29d));if(_0x534d7e){const _0x921a38=await apiPromptToYaml(_0x534d7e,_0x2b4428);if(!_0x921a38){_0xc22290[_0x59575c(0x25b)]['push']({'name':_0x169cc6[_0x59575c(0x1e4)][_0x59575c(0x205)],'action':_0x59575c(0x2ae),'id':_0x534d7e['id']}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x25b)][_0x59575c(0x2ae)]++;continue;}const _0x5f520c=toPromptYamlString(_0x921a38),_0x46349d=generateDiff(_0x5f520c,_0x5c5f57),_0x22869e=hasChanges(_0x46349d);_0x22869e?(_0xc22290[_0x59575c(0x25b)][_0x59575c(0x28b)]({'name':_0x169cc6[_0x59575c(0x1e4)][_0x59575c(0x205)],'action':_0x59575c(0x2ae),'id':_0x534d7e['id'],'diff':formatDiffWithColors(_0x46349d)}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x25b)]['updated']++):(_0xc22290['prompts'][_0x59575c(0x28b)]({'name':_0x169cc6[_0x59575c(0x1e4)][_0x59575c(0x205)],'action':'unchanged','id':_0x534d7e['id']}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x25b)][_0x59575c(0x211)]++);}else _0xc22290[_0x59575c(0x25b)][_0x59575c(0x28b)]({'name':_0x169cc6[_0x59575c(0x1e4)]['name'],'action':_0x59575c(0x243)}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x25b)][_0x59575c(0x243)]++;}for(const _0x378ba6 of _0x3b602b){const _0x3e8766=_0x504042[_0x59575c(0x1dc)](_0x378ba6['yaml']['service_type']),_0x260202=a109_0xd05ade[_0x59575c(0x1d2)](_0x378ba6[_0x59575c(0x214)],_0x59575c(0x29d));if(_0x3e8766){const _0x1abefa=await apiIntegrationToYaml(_0x3e8766,_0x2b4428),_0x553a8b=toIntegrationYamlString(_0x1abefa),_0x14d2e5=generateDiff(_0x553a8b,_0x260202),_0x89af26=hasChanges(_0x14d2e5);_0x89af26?(_0xc22290['integrations']['push']({'name':_0x378ba6[_0x59575c(0x1e4)]['service_type'],'action':_0x59575c(0x2ae),'id':_0x3e8766['id'],'diff':formatDiffWithColors(_0x14d2e5)}),_0xc22290['counts'][_0x59575c(0x1fa)][_0x59575c(0x2ae)]++):(_0xc22290[_0x59575c(0x1fa)][_0x59575c(0x28b)]({'name':_0x378ba6[_0x59575c(0x1e4)][_0x59575c(0x238)],'action':_0x59575c(0x211),'id':_0x3e8766['id']}),_0xc22290[_0x59575c(0x27b)]['integrations'][_0x59575c(0x211)]++);}else _0xc22290[_0x59575c(0x1fa)][_0x59575c(0x28b)]({'name':_0x378ba6[_0x59575c(0x1e4)][_0x59575c(0x238)],'action':_0x59575c(0x243)}),_0xc22290['counts'][_0x59575c(0x1fa)][_0x59575c(0x243)]++;}for(const _0x4905f2 of _0x3b06bd){const _0x49a277=_0x93a687['get'](_0x4905f2['def'][_0x59575c(0x205)]),_0x1c5e2d=toExperimentalKnowledgeBaseYamlString(_0x4905f2[_0x59575c(0x2b2)]);let _0x3c706c=_0x1c5e2d;for(const _0x241d58 of _0x4905f2[_0x59575c(0x2b2)]['functions']){_0x3c706c+=_0x59575c(0x2b3)+_0x241d58[_0x59575c(0x205)]+_0x59575c(0x204)+_0x241d58[_0x59575c(0x1e3)]+_0x59575c(0x227)+_0x241d58[_0x59575c(0x205)]+'\x20---\x0a'+_0x241d58[_0x59575c(0x1cd)]+'\x0a';}if(_0x49a277){const _0x3a75d8=apiExperimentalKnowledgeBaseToYaml(_0x49a277),_0x13eef4=toExperimentalKnowledgeBaseYamlString(_0x3a75d8);let _0x1d7b70=_0x13eef4;for(const _0x36dffb of _0x3a75d8[_0x59575c(0x2ab)]){_0x1d7b70+=_0x59575c(0x2b3)+_0x36dffb[_0x59575c(0x205)]+_0x59575c(0x204)+_0x36dffb[_0x59575c(0x1e3)]+'\x0a---\x20schema:\x20'+_0x36dffb[_0x59575c(0x205)]+_0x59575c(0x204)+_0x36dffb[_0x59575c(0x1cd)]+'\x0a';}const _0x597385=generateDiff(_0x1d7b70,_0x3c706c),_0x1cbce0=hasChanges(_0x597385);_0x1cbce0?(_0xc22290[_0x59575c(0x209)][_0x59575c(0x28b)]({'name':_0x4905f2[_0x59575c(0x2b2)][_0x59575c(0x205)],'action':_0x59575c(0x2ae),'id':_0x49a277['id'],'diff':formatDiffWithColors(_0x597385)}),_0xc22290[_0x59575c(0x27b)]['experimentalKnowledgeBases']['updated']++):(_0xc22290[_0x59575c(0x209)][_0x59575c(0x28b)]({'name':_0x4905f2[_0x59575c(0x2b2)][_0x59575c(0x205)],'action':'unchanged','id':_0x49a277['id']}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x209)][_0x59575c(0x211)]++);}else _0xc22290['experimentalKnowledgeBases'][_0x59575c(0x28b)]({'name':_0x4905f2[_0x59575c(0x2b2)]['name'],'action':_0x59575c(0x243)}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x209)][_0x59575c(0x243)]++;}for(const _0x2dbff1 of _0x2c9a3c){const _0x3adbf2=_0x294df6[_0x59575c(0x1dc)](_0x2dbff1[_0x59575c(0x2b2)][_0x59575c(0x205)]),_0x553a61=toExperimentalArtifactYamlString(_0x2dbff1[_0x59575c(0x2b2)]);let _0x1d5f7f=_0x553a61+(_0x59575c(0x1b9)+_0x2dbff1[_0x59575c(0x2b2)][_0x59575c(0x1e3)]+'\x0a');for(const _0x148e3c of _0x2dbff1[_0x59575c(0x2b2)][_0x59575c(0x265)]){_0x1d5f7f+='---\x20file:\x20'+_0x148e3c[_0x59575c(0x290)]+_0x59575c(0x204)+_0x148e3c['text_content']+'\x0a';}if(_0x3adbf2){const _0x3314f7=apiExperimentalArtifactToYaml(_0x3adbf2),_0x5827b3=toExperimentalArtifactYamlString(_0x3314f7);let _0x4a1e4e=_0x5827b3+(_0x59575c(0x1b9)+_0x3314f7['code']+'\x0a');for(const _0x4cba58 of _0x3314f7[_0x59575c(0x265)]){_0x4a1e4e+=_0x59575c(0x201)+_0x4cba58['file_name']+_0x59575c(0x204)+_0x4cba58[_0x59575c(0x1ce)]+'\x0a';}const _0x3dc4b6=generateDiff(_0x4a1e4e,_0x1d5f7f),_0x50062a=hasChanges(_0x3dc4b6);_0x50062a?(_0xc22290[_0x59575c(0x1df)][_0x59575c(0x28b)]({'name':_0x2dbff1[_0x59575c(0x2b2)][_0x59575c(0x205)],'action':_0x59575c(0x2ae),'id':_0x3adbf2['id'],'diff':formatDiffWithColors(_0x3dc4b6)}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x1df)][_0x59575c(0x2ae)]++):(_0xc22290[_0x59575c(0x1df)]['push']({'name':_0x2dbff1['def'][_0x59575c(0x205)],'action':'unchanged','id':_0x3adbf2['id']}),_0xc22290['counts'][_0x59575c(0x1df)][_0x59575c(0x211)]++);}else _0xc22290['experimentalArtifacts']['push']({'name':_0x2dbff1[_0x59575c(0x2b2)][_0x59575c(0x205)],'action':_0x59575c(0x243)}),_0xc22290['counts'][_0x59575c(0x1df)][_0x59575c(0x243)]++;}if(_0xf6aa8c?.[_0x59575c(0x260)])return _0xc22290;_0xc22290['knowledgeBases']=[],_0xc22290[_0x59575c(0x2a9)]=[],_0xc22290['prompts']=[],_0xc22290[_0x59575c(0x1fa)]=[],_0xc22290[_0x59575c(0x209)]=[],_0xc22290[_0x59575c(0x1df)]=[];const _0x43479c=_0xc22290['agents'][_0x59575c(0x2ac)](_0x3976df=>_0x3976df['action']===_0x59575c(0x1ad));_0xc22290[_0x59575c(0x1b4)]=_0x43479c,_0xc22290['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x43479c[_0x59575c(0x1d8)]},'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}};for(const _0xa0ff90 of _0x135266){try{const _0x42f530=_0x2ff3d0[_0x59575c(0x1dc)](_0xa0ff90['yaml'][_0x59575c(0x205)]),_0x40cb8d=yamlKnowledgeBaseToApi(_0xa0ff90['yaml'],_0x1d8ffd);if(_0x42f530)await this['client']['updateKnowledgeBase'](_0x42f530['id'],_0x40cb8d),_0x5b5cae[_0x59575c(0x230)](_0xa0ff90[_0x59575c(0x1e4)][_0x59575c(0x205)],_0x42f530['id']),_0xc22290[_0x59575c(0x1f9)][_0x59575c(0x28b)]({'name':_0xa0ff90[_0x59575c(0x1e4)]['name'],'action':_0x59575c(0x2ae),'id':_0x42f530['id']}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x1f9)][_0x59575c(0x2ae)]++;else{const _0x11e430=await this[_0x59575c(0x2bc)][_0x59575c(0x1f4)](_0x40cb8d);_0x5b5cae[_0x59575c(0x230)](_0xa0ff90[_0x59575c(0x1e4)][_0x59575c(0x205)],_0x11e430['id']),_0xc22290['knowledgeBases'][_0x59575c(0x28b)]({'name':_0xa0ff90[_0x59575c(0x1e4)][_0x59575c(0x205)],'action':_0x59575c(0x243),'id':_0x11e430['id']}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x1f9)][_0x59575c(0x243)]++;}}catch(_0x492161){_0xc22290[_0x59575c(0x1f9)][_0x59575c(0x28b)]({'name':_0xa0ff90[_0x59575c(0x1e4)]['name'],'action':_0x59575c(0x1ad),'error':_0x492161[_0x59575c(0x246)]}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x1f9)]['errors']++;}}for(const _0x4572ce of _0x5cce86){try{const _0x45f10a=_0x4529e5[_0x59575c(0x1dc)](_0x4572ce[_0x59575c(0x205)]),_0x3cad27=yamlTextKnowledgeBaseToApi({'name':_0x4572ce[_0x59575c(0x205)],'text':_0x4572ce[_0x59575c(0x278)]},_0x1d8ffd);if(_0x45f10a)await this[_0x59575c(0x2bc)]['updateTextKnowledgeBase'](_0x45f10a['id'],_0x3cad27),_0x58121d[_0x59575c(0x230)](_0x4572ce[_0x59575c(0x205)],_0x45f10a['id']),_0xc22290[_0x59575c(0x2a9)]['push']({'name':_0x4572ce[_0x59575c(0x205)],'action':_0x59575c(0x2ae),'id':_0x45f10a['id']}),_0xc22290[_0x59575c(0x27b)]['textKnowledgeBases'][_0x59575c(0x2ae)]++;else{const _0xd349b2=await this['client'][_0x59575c(0x28d)](_0x3cad27);_0x58121d[_0x59575c(0x230)](_0x4572ce[_0x59575c(0x205)],_0xd349b2['id']),_0xc22290[_0x59575c(0x2a9)][_0x59575c(0x28b)]({'name':_0x4572ce[_0x59575c(0x205)],'action':_0x59575c(0x243),'id':_0xd349b2['id']}),_0xc22290['counts'][_0x59575c(0x2a9)][_0x59575c(0x243)]++;}}catch(_0x5db8ac){_0xc22290[_0x59575c(0x2a9)][_0x59575c(0x28b)]({'name':_0x4572ce[_0x59575c(0x205)],'action':_0x59575c(0x1ad),'error':_0x5db8ac['message']}),_0xc22290['counts']['textKnowledgeBases'][_0x59575c(0x2a1)]++;}}for(const _0x57090d of _0x3b06bd){try{const _0x1b013b=_0x93a687['get'](_0x57090d[_0x59575c(0x2b2)]['name']),_0xab0add=yamlExperimentalKnowledgeBaseToApi(_0x57090d[_0x59575c(0x2b2)],_0x1d8ffd);if(_0x1b013b)await this[_0x59575c(0x2bc)][_0x59575c(0x2aa)](_0x1b013b['id'],_0xab0add),_0x50af7a[_0x59575c(0x230)](_0x57090d[_0x59575c(0x2b2)][_0x59575c(0x205)],_0x1b013b['id']),_0xc22290[_0x59575c(0x209)][_0x59575c(0x28b)]({'name':_0x57090d[_0x59575c(0x2b2)]['name'],'action':_0x59575c(0x2ae),'id':_0x1b013b['id']}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x209)][_0x59575c(0x2ae)]++;else{const _0x5bba58=await this[_0x59575c(0x2bc)][_0x59575c(0x1db)](_0xab0add);_0x50af7a[_0x59575c(0x230)](_0x57090d[_0x59575c(0x2b2)][_0x59575c(0x205)],_0x5bba58['id']),_0xc22290['experimentalKnowledgeBases'][_0x59575c(0x28b)]({'name':_0x57090d[_0x59575c(0x2b2)][_0x59575c(0x205)],'action':_0x59575c(0x243),'id':_0x5bba58['id']}),_0xc22290['counts'][_0x59575c(0x209)][_0x59575c(0x243)]++;}}catch(_0x545c9d){_0xc22290[_0x59575c(0x209)][_0x59575c(0x28b)]({'name':_0x57090d[_0x59575c(0x2b2)][_0x59575c(0x205)],'action':_0x59575c(0x1ad),'error':_0x545c9d[_0x59575c(0x246)]}),_0xc22290[_0x59575c(0x27b)]['experimentalKnowledgeBases'][_0x59575c(0x2a1)]++;}}for(const _0x93d870 of _0x2c9a3c){try{const _0x5e2c70=_0x294df6[_0x59575c(0x1dc)](_0x93d870[_0x59575c(0x2b2)][_0x59575c(0x205)]),_0x40213b=yamlExperimentalArtifactToApi(_0x93d870[_0x59575c(0x2b2)],_0x1d8ffd);if(_0x5e2c70)await this[_0x59575c(0x2bc)][_0x59575c(0x2ad)](_0x5e2c70['id'],_0x40213b),_0x17d652[_0x59575c(0x230)](_0x93d870[_0x59575c(0x2b2)][_0x59575c(0x205)],_0x5e2c70['id']),_0xc22290[_0x59575c(0x1df)][_0x59575c(0x28b)]({'name':_0x93d870[_0x59575c(0x2b2)][_0x59575c(0x205)],'action':_0x59575c(0x2ae),'id':_0x5e2c70['id']}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x1df)]['updated']++;else{const _0x233813=await this['client']['createExperimentalArtifact'](_0x40213b);_0x17d652[_0x59575c(0x230)](_0x93d870['def'][_0x59575c(0x205)],_0x233813['id']),_0xc22290[_0x59575c(0x1df)][_0x59575c(0x28b)]({'name':_0x93d870[_0x59575c(0x2b2)]['name'],'action':_0x59575c(0x243),'id':_0x233813['id']}),_0xc22290[_0x59575c(0x27b)]['experimentalArtifacts']['created']++;}}catch(_0xe4c1d4){_0xc22290[_0x59575c(0x1df)][_0x59575c(0x28b)]({'name':_0x93d870[_0x59575c(0x2b2)][_0x59575c(0x205)],'action':'error','error':_0xe4c1d4['message']}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x1df)][_0x59575c(0x2a1)]++;}}for(const _0xdde8aa of _0x9fca1c){_0x112a9e=[];try{const _0x1ce511=_0x55e225[_0x59575c(0x1dc)](_0xdde8aa[_0x59575c(0x1e4)][_0x59575c(0x205)]),_0xc2ad2d=await agentDefToRequest(_0xdde8aa[_0x59575c(0x1e4)],_0xdde8aa[_0x59575c(0x1bc)],_0xdde8aa['starterMessage'],_0x545770);if(_0x1ce511)await this[_0x59575c(0x2bc)][_0x59575c(0x2b4)](_0x1ce511['id'],_0xc2ad2d),_0x1772ef['set'](_0xdde8aa[_0x59575c(0x1e4)][_0x59575c(0x205)],_0x1ce511['id']),_0xc22290[_0x59575c(0x1b4)][_0x59575c(0x28b)]({'agentName':_0xdde8aa[_0x59575c(0x1e4)][_0x59575c(0x205)],'action':_0x59575c(0x2ae),'agentId':_0x1ce511['id'],'warnings':_0x112a9e[_0x59575c(0x1d8)]>0x0?_0x112a9e:undefined}),_0xc22290['counts'][_0x59575c(0x1b4)][_0x59575c(0x2ae)]++;else{const _0x1a2232=await this[_0x59575c(0x2bc)]['createAgentResponse'](_0xc2ad2d);_0x1772ef['set'](_0xdde8aa[_0x59575c(0x1e4)][_0x59575c(0x205)],_0x1a2232['id']),_0xc22290[_0x59575c(0x1b4)][_0x59575c(0x28b)]({'agentName':_0xdde8aa[_0x59575c(0x1e4)][_0x59575c(0x205)],'action':_0x59575c(0x243),'agentId':_0x1a2232['id'],'warnings':_0x112a9e[_0x59575c(0x1d8)]>0x0?_0x112a9e:undefined}),_0xc22290['counts'][_0x59575c(0x1b4)][_0x59575c(0x243)]++;}}catch(_0x52e746){_0xc22290[_0x59575c(0x1b4)]['push']({'agentName':_0xdde8aa['yaml'][_0x59575c(0x205)],'action':_0x59575c(0x1ad),'error':_0x52e746[_0x59575c(0x246)],'warnings':_0x112a9e[_0x59575c(0x1d8)]>0x0?_0x112a9e:undefined}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x1b4)][_0x59575c(0x2a1)]++;}}for(const _0x402ade of _0x1f181e){try{const _0x50f5e2=_0x39fd7a[_0x59575c(0x1dc)](_0x402ade[_0x59575c(0x1e4)]['name']),_0x11a2f3=await yamlPromptToApi(_0x402ade[_0x59575c(0x1e4)],_0x1d8ffd,_0x545770);if(!_0x11a2f3){_0xc22290[_0x59575c(0x25b)][_0x59575c(0x28b)]({'name':_0x402ade[_0x59575c(0x1e4)]['name'],'action':_0x59575c(0x1ad),'error':_0x59575c(0x28f)}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x25b)][_0x59575c(0x2a1)]++;continue;}if(_0x50f5e2)await this[_0x59575c(0x2bc)][_0x59575c(0x269)](_0x50f5e2['id'],_0x11a2f3),_0x2bf267[_0x59575c(0x230)](_0x402ade[_0x59575c(0x1e4)][_0x59575c(0x205)],_0x50f5e2['id']),_0xc22290[_0x59575c(0x25b)][_0x59575c(0x28b)]({'name':_0x402ade[_0x59575c(0x1e4)]['name'],'action':_0x59575c(0x2ae),'id':_0x50f5e2['id']}),_0xc22290[_0x59575c(0x27b)]['prompts'][_0x59575c(0x2ae)]++;else{const _0x533a05=await this[_0x59575c(0x2bc)][_0x59575c(0x240)](_0x11a2f3);_0x2bf267['set'](_0x402ade[_0x59575c(0x1e4)][_0x59575c(0x205)],_0x533a05['id']),_0xc22290[_0x59575c(0x25b)][_0x59575c(0x28b)]({'name':_0x402ade[_0x59575c(0x1e4)][_0x59575c(0x205)],'action':_0x59575c(0x243),'id':_0x533a05['id']}),_0xc22290['counts'][_0x59575c(0x25b)][_0x59575c(0x243)]++;}}catch(_0x5dd2c6){_0xc22290['prompts'][_0x59575c(0x28b)]({'name':_0x402ade[_0x59575c(0x1e4)][_0x59575c(0x205)],'action':'error','error':_0x5dd2c6['message']}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x25b)][_0x59575c(0x2a1)]++;}}for(const _0x32afa7 of _0x3b602b){try{const _0x49f7fa=_0x504042[_0x59575c(0x1dc)](_0x32afa7['yaml'][_0x59575c(0x238)]),_0x1ef93f=await yamlIntegrationToApi(_0x32afa7[_0x59575c(0x1e4)],_0x1d8ffd,_0x545770);if(_0x49f7fa){await this[_0x59575c(0x2bc)][_0x59575c(0x21c)](_0x49f7fa['id']);const _0xa0f4b0=await this[_0x59575c(0x2bc)]['createIntegration'](_0x1ef93f);_0xc22290[_0x59575c(0x1fa)][_0x59575c(0x28b)]({'name':_0x32afa7[_0x59575c(0x1e4)][_0x59575c(0x238)],'action':_0x59575c(0x2ae),'id':_0xa0f4b0['id']}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x1fa)][_0x59575c(0x2ae)]++;}else{const _0x448a31=await this[_0x59575c(0x2bc)][_0x59575c(0x24b)](_0x1ef93f);_0xc22290[_0x59575c(0x1fa)][_0x59575c(0x28b)]({'name':_0x32afa7[_0x59575c(0x1e4)][_0x59575c(0x238)],'action':'created','id':_0x448a31['id']}),_0xc22290[_0x59575c(0x27b)][_0x59575c(0x1fa)][_0x59575c(0x243)]++;}}catch(_0x249c5b){_0xc22290[_0x59575c(0x1fa)][_0x59575c(0x28b)]({'name':_0x32afa7[_0x59575c(0x1e4)][_0x59575c(0x238)],'action':'error','error':_0x249c5b[_0x59575c(0x246)]}),_0xc22290[_0x59575c(0x27b)]['integrations'][_0x59575c(0x2a1)]++;}}return _0xc22290;}async[a109_0x291832(0x292)](_0x48d684,_0x167d24,_0xca4ae5,_0x4a6ab7){const _0x258cc7=a109_0x291832,{projectId:_0x3bade0,project:_0x1886af}=await this[_0x258cc7(0x239)](_0x48d684),_0x3df64d=_0x1886af[_0x258cc7(0x1c4)]['name'],_0x210792=await this[_0x258cc7(0x2bc)][_0x258cc7(0x229)](_0x3bade0),_0x588464=_0x210792[_0x258cc7(0x2a6)](_0x3a00af=>_0x3a00af['attributes']['name']===_0x167d24);if(!_0x588464)throw new SDKError(ErrorCode[_0x258cc7(0x1fb)],_0x258cc7(0x200)+_0x167d24,undefined,{'helpText':'Available\x20agents:\x20'+_0x210792['map'](_0x2c18f5=>_0x2c18f5[_0x258cc7(0x1c4)][_0x258cc7(0x205)])[_0x258cc7(0x24f)](',\x20')});let _0x481b4c;if(_0xca4ae5)_0x481b4c=_0xca4ae5;else{const _0x3877e0=a109_0x3b39de[_0x258cc7(0x24f)](process['cwd'](),'agents'),_0x6de310=getSanitizedPathWithMigration(_0x3877e0,_0x3df64d);_0x6de310['renamed']&&this[_0x258cc7(0x1b6)][_0x258cc7(0x23f)](_0x258cc7(0x267)+a109_0x3b39de[_0x258cc7(0x228)](_0x6de310[_0x258cc7(0x270)])+'\x20→\x20'+a109_0x3b39de[_0x258cc7(0x228)](_0x6de310[_0x258cc7(0x214)])),_0x481b4c=_0x6de310[_0x258cc7(0x214)];}const _0x2e12a8=getSanitizedPathWithMigration(_0x481b4c,_0x167d24);_0x2e12a8[_0x258cc7(0x1ac)]&&this[_0x258cc7(0x1b6)][_0x258cc7(0x23f)]('Renamed\x20agent\x20folder:\x20'+a109_0x3b39de[_0x258cc7(0x228)](_0x2e12a8['oldPath'])+_0x258cc7(0x22a)+a109_0x3b39de[_0x258cc7(0x228)](_0x2e12a8[_0x258cc7(0x214)]));const _0x44538b=_0x2e12a8['path'],_0x1fd7ee=new Map(),_0x4861a3=new Map(),_0x44be6e=await this[_0x258cc7(0x2bc)][_0x258cc7(0x1c3)](_0x3bade0),_0x3d164d=await this[_0x258cc7(0x2bc)]['listTextKnowledgeBases'](_0x3bade0),_0x27f450=await safeListOrEmpty(()=>this['client'][_0x258cc7(0x1b8)](_0x3bade0)),_0x36c8f8=new Map(),_0x3ee8fe=new Map();for(const _0x17d0f7 of _0x44be6e){_0x1fd7ee[_0x258cc7(0x230)](_0x17d0f7['id'],_0x17d0f7[_0x258cc7(0x1c4)][_0x258cc7(0x205)]);}for(const _0x4c42af of _0x3d164d){_0x36c8f8[_0x258cc7(0x230)](_0x4c42af['id'],_0x4c42af['attributes'][_0x258cc7(0x205)]);}for(const _0x43364b of _0x27f450){_0x3ee8fe[_0x258cc7(0x230)](_0x43364b['id'],_0x43364b[_0x258cc7(0x1c4)]['name']);}for(const _0x5cbe61 of _0x210792){_0x4861a3[_0x258cc7(0x230)](_0x5cbe61['id'],_0x5cbe61[_0x258cc7(0x1c4)][_0x258cc7(0x205)]);}const _0x3d7666={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x1fd7ee,'TextKnowledgeBase':_0x36c8f8,'Agent':_0x4861a3,'ExperimentalKnowledgeBase':_0x3ee8fe}),'resolvePromptName':async()=>undefined,'onWarning':_0x31ed60=>this['logger'][_0x258cc7(0x2bf)](_0x31ed60)},_0x5d4a3f=a109_0x3b39de[_0x258cc7(0x24f)](_0x44538b,_0x258cc7(0x255)),_0x265b7f=a109_0x3b39de['join'](_0x44538b,'agent.yml'),_0x2d07ed=a109_0x3b39de[_0x258cc7(0x24f)](_0x44538b,'starter_message.md'),_0x3a8e8e=!a109_0xd05ade['existsSync'](_0x265b7f);if(_0x4a6ab7?.[_0x258cc7(0x260)])return{'agentName':_0x167d24,'outputPath':_0x44538b,'isNew':_0x3a8e8e,'hasChanges':!![]};a109_0xd05ade['mkdirSync'](_0x481b4c,{'recursive':!![]}),a109_0xd05ade[_0x258cc7(0x22c)](_0x44538b,{'recursive':!![]});const _0x54e716=a109_0x3b39de['join'](_0x481b4c,'tdx.json');!a109_0xd05ade[_0x258cc7(0x20b)](_0x54e716)&&a109_0xd05ade[_0x258cc7(0x26c)](_0x54e716,createAgentConfigContent(_0x48d684));const {yaml:_0x2a4eb0,systemPrompt:_0x2e423b,starterMessage:_0x3633ac}=await agentResponseToDef(_0x588464,_0x3d7666);let _0x139a9b=_0x3a8e8e;if(!_0x3a8e8e){const _0x1d3789=a109_0xd05ade[_0x258cc7(0x20b)](_0x5d4a3f)?a109_0xd05ade['readFileSync'](_0x5d4a3f,_0x258cc7(0x29d)):'',_0x2c4fe6=a109_0xd05ade[_0x258cc7(0x1d2)](_0x265b7f,_0x258cc7(0x29d));_0x139a9b=_0x1d3789!==_0x2e423b||_0x2c4fe6!==toAgentYamlString(_0x2a4eb0);}a109_0xd05ade[_0x258cc7(0x26c)](_0x5d4a3f,_0x2e423b),a109_0xd05ade[_0x258cc7(0x26c)](_0x265b7f,toAgentYamlString(_0x2a4eb0));if(_0x3633ac&&_0x3633ac[_0x258cc7(0x242)]('\x0a'))a109_0xd05ade['writeFileSync'](_0x2d07ed,_0x3633ac);else a109_0xd05ade['existsSync'](_0x2d07ed)&&a109_0xd05ade[_0x258cc7(0x2a4)](_0x2d07ed);return{'agentName':_0x167d24,'outputPath':_0x44538b,'isNew':_0x3a8e8e,'hasChanges':_0x139a9b};}async[a109_0x291832(0x1c8)](_0x29e532,_0x141be4){const _0xa312c0=a109_0x291832;let _0x40a5e0;isAgentYamlPath(_0x29e532)?_0x40a5e0=getAgentDirFromYamlPath(_0x29e532):_0x40a5e0=_0x29e532;const {config:_0x1433da}=findAgentConfig(_0x40a5e0),_0x3dd9da=await this['resolveProjectId'](_0x1433da[_0xa312c0(0x23c)]),_0x8566bb=a109_0x3b39de[_0xa312c0(0x24f)](_0x40a5e0,_0xa312c0(0x2a7)),_0x19a19f=a109_0x3b39de[_0xa312c0(0x24f)](_0x40a5e0,_0xa312c0(0x255)),_0x54296f=a109_0x3b39de[_0xa312c0(0x24f)](_0x40a5e0,_0xa312c0(0x289));if(!a109_0xd05ade['existsSync'](_0x8566bb))throw new SDKError(ErrorCode[_0xa312c0(0x20a)],_0xa312c0(0x1ff)+_0x40a5e0,undefined,{'helpText':'Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.'});const _0x4b690e=parseAgentYaml(a109_0xd05ade[_0xa312c0(0x1d2)](_0x8566bb,_0xa312c0(0x29d)),_0x8566bb),_0x59c48f=a109_0xd05ade[_0xa312c0(0x20b)](_0x19a19f)?a109_0xd05ade['readFileSync'](_0x19a19f,_0xa312c0(0x29d)):'',_0x14c3ac=a109_0xd05ade[_0xa312c0(0x20b)](_0x54296f)?a109_0xd05ade[_0xa312c0(0x1d2)](_0x54296f,_0xa312c0(0x29d)):_0x4b690e[_0xa312c0(0x275)];if(_0x141be4?.[_0xa312c0(0x260)])return{'agentName':_0x4b690e[_0xa312c0(0x205)],'action':_0xa312c0(0x243),'projectId':_0x3dd9da};const _0x836a28=await this['client'][_0xa312c0(0x229)](_0x3dd9da),_0x4cef93=await fetchAllToolTargetMaps((_0x83a0ef,_0x1d0b98)=>this[_0xa312c0(0x2bc)]['listToolTargets'](_0x83a0ef,_0x1d0b98),_0x3dd9da),_0x43d448=new Map();for(const _0x50ff0a of _0x836a28){_0x43d448[_0xa312c0(0x230)](_0x50ff0a[_0xa312c0(0x1c4)][_0xa312c0(0x205)],_0x50ff0a['id']);}const _0x7fc498=[],_0x3b3921={'projectId':_0x3dd9da,'resolveToolTargetId':buildIdResolver({..._0x4cef93[_0xa312c0(0x254)],'Agent':_0x43d448}),'resolvePromptId':async()=>undefined,'onWarning':_0x1db0ab=>{const _0x37c1be=_0xa312c0;this['logger'][_0x37c1be(0x2bf)](_0x1db0ab),_0x7fc498[_0x37c1be(0x28b)](_0x1db0ab);}};try{const _0x204ad3=_0x836a28['find'](_0x5b7432=>_0x5b7432[_0xa312c0(0x1c4)]['name']===_0x4b690e[_0xa312c0(0x205)]),_0x553132=await agentDefToRequest(_0x4b690e,_0x59c48f,_0x14c3ac,_0x3b3921);if(_0x204ad3)return await this[_0xa312c0(0x2bc)][_0xa312c0(0x2b4)](_0x204ad3['id'],_0x553132),{'agentName':_0x4b690e['name'],'action':'updated','projectId':_0x3dd9da,'agentId':_0x204ad3['id'],'warnings':_0x7fc498[_0xa312c0(0x1d8)]>0x0?_0x7fc498:undefined};else{const _0x1910fd=await this['client'][_0xa312c0(0x236)](_0x553132);return{'agentName':_0x4b690e[_0xa312c0(0x205)],'action':_0xa312c0(0x243),'projectId':_0x3dd9da,'agentId':_0x1910fd['id'],'warnings':_0x7fc498[_0xa312c0(0x1d8)]>0x0?_0x7fc498:undefined};}}catch(_0x34f6c2){return{'agentName':_0x4b690e[_0xa312c0(0x205)],'action':_0xa312c0(0x1ad),'projectId':_0x3dd9da,'error':_0x34f6c2[_0xa312c0(0x246)],'warnings':_0x7fc498[_0xa312c0(0x1d8)]>0x0?_0x7fc498:undefined};}}async[a109_0x291832(0x288)](_0x2c550d,_0x230a27,_0x272f98){const _0x30bc8c=a109_0x291832,_0x67ca53=a109_0xd05ade[_0x30bc8c(0x20b)](_0x2c550d)&&a109_0xd05ade[_0x30bc8c(0x20b)](a109_0x3b39de['join'](_0x2c550d,_0x30bc8c(0x252)));let _0x1fa430;const _0x5a9d03=[],_0x38b52a=[],_0x594b7d=[],_0x80c586=[],_0x41e385=[],_0x1835df=[],_0x5e9893=[];if(_0x67ca53){const _0x287a96=loadAgentConfig(a109_0x3b39de['join'](_0x2c550d,_0x30bc8c(0x252)));_0x1fa430=_0x287a96['llm_project'];const _0x4b3668=a109_0xd05ade['readdirSync'](_0x2c550d,{'withFileTypes':!![]});for(const _0x5c994e of _0x4b3668){if(!_0x5c994e[_0x30bc8c(0x24c)]())continue;if([_0x30bc8c(0x2b0),'experimental_knowledge_bases',_0x30bc8c(0x1a7),_0x30bc8c(0x25b),_0x30bc8c(0x1fa)]['includes'](_0x5c994e[_0x30bc8c(0x205)]))continue;const _0x3b1bdf=a109_0x3b39de[_0x30bc8c(0x24f)](_0x2c550d,_0x5c994e[_0x30bc8c(0x205)]);if(isAgentDir(_0x3b1bdf)){const _0xa3bb96=a109_0x3b39de['join'](_0x3b1bdf,_0x30bc8c(0x2a7)),_0x2c7869=a109_0x3b39de[_0x30bc8c(0x24f)](_0x3b1bdf,'prompt.md'),_0x104e03=a109_0x3b39de[_0x30bc8c(0x24f)](_0x3b1bdf,_0x30bc8c(0x289)),_0x1accf8=parseAgentYaml(a109_0xd05ade[_0x30bc8c(0x1d2)](_0xa3bb96,'utf-8'),_0xa3bb96),_0x46793b=a109_0xd05ade[_0x30bc8c(0x20b)](_0x2c7869)?a109_0xd05ade['readFileSync'](_0x2c7869,_0x30bc8c(0x29d)):'',_0x43b0ac=a109_0xd05ade[_0x30bc8c(0x20b)](_0x104e03)?a109_0xd05ade['readFileSync'](_0x104e03,_0x30bc8c(0x29d)):_0x1accf8[_0x30bc8c(0x275)];_0x5a9d03[_0x30bc8c(0x28b)]({'name':_0x1accf8[_0x30bc8c(0x205)],'dir':_0x3b1bdf,'yaml':_0x1accf8,'systemPrompt':_0x46793b,'starterMessage':_0x43b0ac});}}const _0x1a5025=getKnowledgeBasesDir(_0x2c550d);if(a109_0xd05ade[_0x30bc8c(0x20b)](_0x1a5025)){const _0xfb460e=a109_0xd05ade[_0x30bc8c(0x282)](_0x1a5025);for(const _0x4324d5 of _0xfb460e){const _0xeb4ee1=a109_0x3b39de[_0x30bc8c(0x24f)](_0x1a5025,_0x4324d5);if(_0x4324d5[_0x30bc8c(0x25d)](_0x30bc8c(0x26a))){const _0x1313fd=parseKnowledgeBaseYaml(a109_0xd05ade['readFileSync'](_0xeb4ee1,_0x30bc8c(0x29d)),_0xeb4ee1);_0x38b52a['push']({'name':_0x1313fd['name'],'path':_0xeb4ee1,'yaml':_0x1313fd});}else{if(_0x4324d5[_0x30bc8c(0x25d)](_0x30bc8c(0x25c))){const _0x9834ac=a109_0xd05ade[_0x30bc8c(0x1d2)](_0xeb4ee1,'utf-8'),{name:_0x9cdf27,text:_0x32f6db}=parseTextKnowledgeBaseMd(_0x9834ac,_0x4324d5);_0x594b7d[_0x30bc8c(0x28b)]({'name':_0x9cdf27,'path':_0xeb4ee1,'text':_0x32f6db});}}}}const _0x47ff53=getPromptsDir(_0x2c550d);if(a109_0xd05ade['existsSync'](_0x47ff53)){const _0x278c67=a109_0xd05ade['readdirSync'](_0x47ff53)[_0x30bc8c(0x2ac)](_0xa420a7=>_0xa420a7['endsWith'](_0x30bc8c(0x26a)));for(const _0x15d8b9 of _0x278c67){const _0x527286=a109_0x3b39de[_0x30bc8c(0x24f)](_0x47ff53,_0x15d8b9),_0x182821=parsePromptYaml(a109_0xd05ade[_0x30bc8c(0x1d2)](_0x527286,'utf-8'),_0x527286);_0x80c586['push']({'name':_0x182821[_0x30bc8c(0x205)],'path':_0x527286,'yaml':_0x182821});}}const _0x3948c4=getIntegrationsDir(_0x2c550d);if(a109_0xd05ade[_0x30bc8c(0x20b)](_0x3948c4)){const _0x59f977=a109_0xd05ade[_0x30bc8c(0x282)](_0x3948c4)[_0x30bc8c(0x2ac)](_0x39753a=>_0x39753a[_0x30bc8c(0x25d)](_0x30bc8c(0x26a)));for(const _0x5e42a3 of _0x59f977){const _0x4458d8=a109_0x3b39de[_0x30bc8c(0x24f)](_0x3948c4,_0x5e42a3),_0x348a32=parseIntegrationYaml(a109_0xd05ade[_0x30bc8c(0x1d2)](_0x4458d8,'utf-8'),_0x4458d8);SAFE_INTEGRATION_TYPES['includes'](_0x348a32[_0x30bc8c(0x238)][_0x30bc8c(0x261)]())?_0x41e385[_0x30bc8c(0x28b)]({'name':_0x348a32[_0x30bc8c(0x205)],'path':_0x4458d8,'yaml':_0x348a32}):this[_0x30bc8c(0x1b6)][_0x30bc8c(0x2bf)](_0x30bc8c(0x21d)+_0x348a32[_0x30bc8c(0x205)]+_0x30bc8c(0x2a5)+_0x348a32[_0x30bc8c(0x238)]+_0x30bc8c(0x280)+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES[_0x30bc8c(0x24f)](',\x20')+_0x30bc8c(0x22b)));}}const _0x7319d6=getExperimentalKnowledgeBasesDir(_0x2c550d);if(a109_0xd05ade[_0x30bc8c(0x20b)](_0x7319d6)){const _0x4fb6ff=a109_0xd05ade[_0x30bc8c(0x282)](_0x7319d6,{'withFileTypes':!![]});for(const _0x2e6344 of _0x4fb6ff){if(!_0x2e6344['isDirectory']())continue;const _0x44a7e2=a109_0x3b39de[_0x30bc8c(0x24f)](_0x7319d6,_0x2e6344[_0x30bc8c(0x205)]),_0xf8d122=a109_0x3b39de[_0x30bc8c(0x24f)](_0x44a7e2,_0x2e6344['name']+'.yml');if(a109_0xd05ade[_0x30bc8c(0x20b)](_0xf8d122)){const _0x406eda=parseExperimentalKnowledgeBaseYaml(a109_0xd05ade[_0x30bc8c(0x1d2)](_0xf8d122,_0x30bc8c(0x29d)),_0xf8d122),_0x14ef4f=a109_0x3b39de['join'](_0x44a7e2,_0x30bc8c(0x2ab)),_0x4350ea=[];if(a109_0xd05ade['existsSync'](_0x14ef4f)){const _0x5948db=a109_0xd05ade[_0x30bc8c(0x282)](_0x14ef4f,{'withFileTypes':!![]});for(const _0x50de90 of _0x5948db){if(!_0x50de90[_0x30bc8c(0x24c)]())continue;const _0x2a6843=a109_0x3b39de[_0x30bc8c(0x24f)](_0x14ef4f,_0x50de90['name']),_0x2c026f=a109_0x3b39de[_0x30bc8c(0x24f)](_0x2a6843,_0x30bc8c(0x262)),_0x23fd1c=a109_0x3b39de[_0x30bc8c(0x24f)](_0x2a6843,'json_schema.json');if(a109_0xd05ade[_0x30bc8c(0x20b)](_0x2c026f)&&a109_0xd05ade[_0x30bc8c(0x20b)](_0x23fd1c)){const _0x43b79a=a109_0xd05ade[_0x30bc8c(0x1d2)](_0x2c026f,_0x30bc8c(0x29d)),_0x466ef=a109_0xd05ade[_0x30bc8c(0x1d2)](_0x23fd1c,_0x30bc8c(0x29d));_0x4350ea[_0x30bc8c(0x28b)]({'name':_0x50de90[_0x30bc8c(0x205)],'code':_0x43b79a,'json_schema':_0x466ef});}}}const _0x4af3a7={..._0x406eda,'functions':_0x4350ea};_0x1835df[_0x30bc8c(0x28b)]({'name':_0x406eda[_0x30bc8c(0x205)],'path':_0x44a7e2,'def':_0x4af3a7});}}}const _0x5b4f51=getExperimentalArtifactsDir(_0x2c550d);if(a109_0xd05ade[_0x30bc8c(0x20b)](_0x5b4f51)){const _0x1de004=a109_0xd05ade[_0x30bc8c(0x282)](_0x5b4f51,{'withFileTypes':!![]});for(const _0x2610be of _0x1de004){if(!_0x2610be[_0x30bc8c(0x24c)]())continue;const _0xe60273=a109_0x3b39de[_0x30bc8c(0x24f)](_0x5b4f51,_0x2610be[_0x30bc8c(0x205)]),_0x2f32cc=a109_0x3b39de['join'](_0xe60273,_0x2610be[_0x30bc8c(0x205)]+_0x30bc8c(0x26a));if(a109_0xd05ade[_0x30bc8c(0x20b)](_0x2f32cc)){const _0x128b41=parseExperimentalArtifactYaml(a109_0xd05ade[_0x30bc8c(0x1d2)](_0x2f32cc,_0x30bc8c(0x29d)),_0x2f32cc),_0x1459eb=a109_0x3b39de[_0x30bc8c(0x24f)](_0xe60273,_0x30bc8c(0x262)),_0x127d8a=a109_0xd05ade[_0x30bc8c(0x20b)](_0x1459eb)?a109_0xd05ade[_0x30bc8c(0x1d2)](_0x1459eb,_0x30bc8c(0x29d)):'',_0x1d50da=a109_0x3b39de[_0x30bc8c(0x24f)](_0xe60273,'files'),_0x3956b0=[];if(a109_0xd05ade['existsSync'](_0x1d50da)){const _0x965c39=a109_0xd05ade[_0x30bc8c(0x282)](_0x1d50da);for(const _0x141034 of _0x965c39){const _0xc1baf6=a109_0x3b39de[_0x30bc8c(0x24f)](_0x1d50da,_0x141034);if(a109_0xd05ade[_0x30bc8c(0x206)](_0xc1baf6)[_0x30bc8c(0x27a)]()){const _0x26bbf7=a109_0xd05ade[_0x30bc8c(0x1d2)](_0xc1baf6,_0x30bc8c(0x29d));_0x3956b0[_0x30bc8c(0x28b)]({'file_name':_0x141034,'text_content':_0x26bbf7});}}}const _0x2786f4={..._0x128b41,'code':_0x127d8a,'files':_0x3956b0};_0x5e9893['push']({'name':_0x128b41[_0x30bc8c(0x205)],'path':_0xe60273,'def':_0x2786f4});}}}}else{const _0x39e72c=await this['resolveProjectId'](_0x2c550d),_0x17a50b=await this[_0x30bc8c(0x2bc)][_0x30bc8c(0x1ab)](_0x39e72c);_0x1fa430=_0x17a50b[_0x30bc8c(0x1c4)][_0x30bc8c(0x205)];const _0x43ecd4=await this['client'][_0x30bc8c(0x229)](_0x39e72c),_0x333165=await this[_0x30bc8c(0x2bc)]['listKnowledgeBases'](_0x39e72c),_0x14176c=await this['client'][_0x30bc8c(0x1d5)](_0x39e72c),_0x25639d=await this['client'][_0x30bc8c(0x291)](_0x39e72c),_0x1b76f0=await this[_0x30bc8c(0x2bc)][_0x30bc8c(0x1f8)](_0x39e72c),_0x1aab75=await safeListOrEmpty(()=>this[_0x30bc8c(0x2bc)][_0x30bc8c(0x1b8)](_0x39e72c)),_0x4db1ef=await safeListOrEmpty(()=>this['client'][_0x30bc8c(0x263)](_0x39e72c)),_0x49f140=new Map(),_0x12abb7=new Map(),_0x36e901=new Map(),_0x3c9367=new Map(),_0x54205b=new Map(),_0x43a19b=new Map();for(const _0xfefe05 of _0x333165){_0x49f140[_0x30bc8c(0x230)](_0xfefe05['id'],_0xfefe05[_0x30bc8c(0x1c4)][_0x30bc8c(0x205)]);}for(const _0xea6ceb of _0x14176c){_0x12abb7[_0x30bc8c(0x230)](_0xea6ceb['id'],_0xea6ceb[_0x30bc8c(0x1c4)][_0x30bc8c(0x205)]);}for(const _0x19b39d of _0x43ecd4){_0x36e901[_0x30bc8c(0x230)](_0x19b39d['id'],_0x19b39d[_0x30bc8c(0x1c4)][_0x30bc8c(0x205)]);}for(const _0x4de7b7 of _0x25639d){_0x3c9367[_0x30bc8c(0x230)](_0x4de7b7['id'],_0x4de7b7['attributes'][_0x30bc8c(0x205)]);}for(const _0x17cf58 of _0x1aab75){_0x54205b[_0x30bc8c(0x230)](_0x17cf58['id'],_0x17cf58[_0x30bc8c(0x1c4)][_0x30bc8c(0x205)]);}for(const _0x4a70bc of _0x4db1ef){_0x43a19b[_0x30bc8c(0x230)](_0x4a70bc['id'],_0x4a70bc[_0x30bc8c(0x1c4)][_0x30bc8c(0x205)]);}const _0x5793e4={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x49f140,'TextKnowledgeBase':_0x12abb7,'Agent':_0x36e901,'ExperimentalKnowledgeBase':_0x54205b}),'resolvePromptName':async _0x45ff2f=>_0x3c9367[_0x30bc8c(0x1dc)](_0x45ff2f),'onWarning':_0x3f0096=>this[_0x30bc8c(0x1b6)][_0x30bc8c(0x2bf)](_0x3f0096)};for(const _0x47c4a1 of _0x43ecd4){const _0x4d6580=await agentResponseToDef(_0x47c4a1,_0x5793e4),{yaml:_0x37bf85,systemPrompt:_0x1291be,starterMessage:_0x47582d}=_0x4d6580;_0x5a9d03[_0x30bc8c(0x28b)]({'name':_0x37bf85[_0x30bc8c(0x205)],'dir':'','yaml':_0x37bf85,'systemPrompt':_0x1291be,'starterMessage':_0x47582d});}for(const _0x322d8a of _0x333165){const _0x2a9064=apiKnowledgeBaseToYaml(_0x322d8a);_0x38b52a['push']({'name':_0x2a9064[_0x30bc8c(0x205)],'path':'','yaml':_0x2a9064});}for(const _0x5aa360 of _0x14176c){_0x594b7d['push']({'name':_0x5aa360[_0x30bc8c(0x1c4)][_0x30bc8c(0x205)],'path':'','text':_0x5aa360['attributes'][_0x30bc8c(0x278)]});}for(const _0x2e0ff1 of _0x25639d){const _0x5c0a8e=await apiPromptToYaml(_0x2e0ff1,_0x5793e4);_0x5c0a8e&&_0x80c586[_0x30bc8c(0x28b)]({'name':_0x5c0a8e[_0x30bc8c(0x205)],'path':'','yaml':_0x5c0a8e});}for(const _0x3c64eb of _0x1b76f0){if(!_0x3c64eb[_0x30bc8c(0x1c4)][_0x30bc8c(0x24a)]&&SAFE_INTEGRATION_TYPES[_0x30bc8c(0x242)](_0x3c64eb['attributes'][_0x30bc8c(0x1de)][_0x30bc8c(0x261)]())){const _0x5b1e2c=await apiIntegrationToYaml(_0x3c64eb,_0x5793e4);_0x41e385[_0x30bc8c(0x28b)]({'name':_0x3c64eb[_0x30bc8c(0x1c4)][_0x30bc8c(0x1de)][_0x30bc8c(0x261)](),'path':'','yaml':_0x5b1e2c});}}for(const _0x3d5a9 of _0x1aab75){const _0x310d8d=apiExperimentalKnowledgeBaseToYaml(_0x3d5a9);_0x1835df[_0x30bc8c(0x28b)]({'name':_0x310d8d[_0x30bc8c(0x205)],'path':'','def':_0x310d8d});}for(const _0xcc8e4e of _0x4db1ef){const _0x24856f=apiExperimentalArtifactToYaml(_0xcc8e4e);_0x5e9893[_0x30bc8c(0x28b)]({'name':_0x24856f[_0x30bc8c(0x205)],'path':'','def':_0x24856f});}}const _0x559247={'sourceProjectName':_0x1fa430,'newProjectName':_0x230a27,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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}}},_0x486cef=await this[_0x30bc8c(0x2bc)][_0x30bc8c(0x272)](),_0x469d64=_0x486cef['find'](_0x4a6a9d=>_0x4a6a9d[_0x30bc8c(0x1c4)]['name']===_0x230a27);if(_0x469d64)throw new SDKError(ErrorCode[_0x30bc8c(0x1f6)],_0x30bc8c(0x253)+_0x230a27+_0x30bc8c(0x217),undefined,{'helpText':'Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.'});if(_0x272f98?.['dryRun'])return _0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x1b4)][_0x30bc8c(0x243)]=_0x5a9d03[_0x30bc8c(0x1d8)],_0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x1f9)]['created']=_0x38b52a[_0x30bc8c(0x1d8)],_0x559247['counts'][_0x30bc8c(0x2a9)][_0x30bc8c(0x243)]=_0x594b7d['length'],_0x559247['counts'][_0x30bc8c(0x209)]['created']=_0x1835df[_0x30bc8c(0x1d8)],_0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x1df)][_0x30bc8c(0x243)]=_0x5e9893[_0x30bc8c(0x1d8)],_0x559247['counts'][_0x30bc8c(0x25b)]['created']=_0x80c586[_0x30bc8c(0x1d8)],_0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x1fa)][_0x30bc8c(0x243)]=_0x41e385[_0x30bc8c(0x1d8)],_0x559247;const _0xc8b53a=await this['client'][_0x30bc8c(0x1f7)]({'name':_0x230a27}),_0x527054=_0xc8b53a['id'];_0x559247[_0x30bc8c(0x224)]=_0x527054;const _0x59cc13=new Map(),_0x534d9f=new Map(),_0x374873=new Map(),_0x41b715=new Map(),_0xb765b0=new Map(),_0x3ac477=new Map(),_0x38cabc=new Map(),_0xce0be8=new Map(),_0x362eb5=new Set(),_0x57d39b=new Set();for(const _0x387d91 of _0x5a9d03){for(const _0x3a2066 of _0x387d91[_0x30bc8c(0x1e4)][_0x30bc8c(0x26f)]||[]){if(_0x3a2066[_0x30bc8c(0x221)]===_0x30bc8c(0x276)&&_0x3a2066[_0x30bc8c(0x2be)]){const _0x1a951a=parseRef(_0x3a2066[_0x30bc8c(0x2be)]);if(_0x1a951a)_0x362eb5[_0x30bc8c(0x1b5)](_0x1a951a[_0x30bc8c(0x205)]);}else{if(_0x3a2066['type']==='web_search'&&_0x3a2066[_0x30bc8c(0x2be)]){const _0xd3f5d8=parseRef(_0x3a2066['target']);if(_0xd3f5d8)_0x57d39b[_0x30bc8c(0x1b5)](_0xd3f5d8['name']);}}}}for(const _0x12e485 of _0x362eb5){try{const _0x2cf535=await this[_0x30bc8c(0x2bc)][_0x30bc8c(0x1e5)]({'projectId':_0x527054,'name':_0x12e485});_0xb765b0[_0x30bc8c(0x230)](_0x12e485,_0x2cf535['id']),_0x559247[_0x30bc8c(0x283)][_0x30bc8c(0x28b)]({'name':_0x12e485,'action':'created','id':_0x2cf535['id']}),_0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x283)]['created']++;}catch(_0x4aef8c){_0x559247[_0x30bc8c(0x283)]['push']({'name':_0x12e485,'action':_0x30bc8c(0x1ad),'error':_0x4aef8c[_0x30bc8c(0x246)]}),_0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x283)][_0x30bc8c(0x2a1)]++;}}for(const _0x4d23e1 of _0x57d39b){try{const _0x1d39ee=await this[_0x30bc8c(0x2bc)]['createWebSearchTool']({'projectId':_0x527054,'name':_0x4d23e1});_0x3ac477['set'](_0x4d23e1,_0x1d39ee['id']),_0x559247[_0x30bc8c(0x274)]['push']({'name':_0x4d23e1,'action':_0x30bc8c(0x243),'id':_0x1d39ee['id']}),_0x559247['counts']['webSearchTools'][_0x30bc8c(0x243)]++;}catch(_0xad69cd){_0x559247[_0x30bc8c(0x274)]['push']({'name':_0x4d23e1,'action':_0x30bc8c(0x1ad),'error':_0xad69cd['message']}),_0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x274)][_0x30bc8c(0x2a1)]++;}}const _0x5411b5=await fetchAllToolTargetMaps((_0xdd39e3,_0x3bd9ea)=>this[_0x30bc8c(0x2bc)]['listToolTargets'](_0xdd39e3,_0x3bd9ea),_0x527054);let _0x580c0c=[];const _0x35104e={'projectId':_0x527054,'resolveToolTargetId':buildIdResolver({..._0x5411b5[_0x30bc8c(0x254)],'KnowledgeBase':_0x59cc13,'TextKnowledgeBase':_0x534d9f,'ExperimentalKnowledgeBase':_0x38cabc,'Agent':_0x374873,'WebSearchTool':_0x3ac477,'ImageGenerator':_0xb765b0}),'resolvePromptId':async _0xd518c2=>_0x41b715[_0x30bc8c(0x1dc)](_0xd518c2),'onWarning':_0xd6fb09=>{const _0x3848ef=_0x30bc8c;this[_0x3848ef(0x1b6)][_0x3848ef(0x2bf)](_0xd6fb09),_0x580c0c[_0x3848ef(0x28b)](_0xd6fb09);}};for(const _0x85b26f of _0x38b52a){try{const _0x3fe1d5=yamlKnowledgeBaseToApi(_0x85b26f[_0x30bc8c(0x1e4)],_0x527054),_0x905bdf=await this[_0x30bc8c(0x2bc)][_0x30bc8c(0x1f4)](_0x3fe1d5);_0x59cc13[_0x30bc8c(0x230)](_0x85b26f[_0x30bc8c(0x1e4)][_0x30bc8c(0x205)],_0x905bdf['id']),_0x559247[_0x30bc8c(0x1f9)]['push']({'name':_0x85b26f[_0x30bc8c(0x1e4)][_0x30bc8c(0x205)],'action':'created','id':_0x905bdf['id']}),_0x559247['counts'][_0x30bc8c(0x1f9)][_0x30bc8c(0x243)]++;}catch(_0x1cf4b1){_0x559247['knowledgeBases'][_0x30bc8c(0x28b)]({'name':_0x85b26f['yaml']['name'],'action':_0x30bc8c(0x1ad),'error':_0x1cf4b1[_0x30bc8c(0x246)]}),_0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x1f9)][_0x30bc8c(0x2a1)]++;}}for(const _0x30e0d0 of _0x594b7d){try{const _0x5cfd12=yamlTextKnowledgeBaseToApi({'name':_0x30e0d0[_0x30bc8c(0x205)],'text':_0x30e0d0[_0x30bc8c(0x278)]},_0x527054),_0x2209cd=await this['client'][_0x30bc8c(0x28d)](_0x5cfd12);_0x534d9f[_0x30bc8c(0x230)](_0x30e0d0[_0x30bc8c(0x205)],_0x2209cd['id']),_0x559247['textKnowledgeBases']['push']({'name':_0x30e0d0[_0x30bc8c(0x205)],'action':_0x30bc8c(0x243),'id':_0x2209cd['id']}),_0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x2a9)]['created']++;}catch(_0x371a7a){_0x559247[_0x30bc8c(0x2a9)][_0x30bc8c(0x28b)]({'name':_0x30e0d0['name'],'action':_0x30bc8c(0x1ad),'error':_0x371a7a[_0x30bc8c(0x246)]}),_0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x2a9)][_0x30bc8c(0x2a1)]++;}}for(const _0x33603f of _0x5e9893){try{const _0x1ef85b=yamlExperimentalArtifactToApi(_0x33603f[_0x30bc8c(0x2b2)],_0x527054),_0x21de16=await this[_0x30bc8c(0x2bc)]['createExperimentalArtifact'](_0x1ef85b);_0xce0be8[_0x30bc8c(0x230)](_0x33603f[_0x30bc8c(0x2b2)]['name'],_0x21de16['id']),_0x559247[_0x30bc8c(0x1df)][_0x30bc8c(0x28b)]({'name':_0x33603f[_0x30bc8c(0x2b2)][_0x30bc8c(0x205)],'action':_0x30bc8c(0x243),'id':_0x21de16['id']}),_0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x1df)][_0x30bc8c(0x243)]++;}catch(_0x3eff6a){_0x559247['experimentalArtifacts'][_0x30bc8c(0x28b)]({'name':_0x33603f[_0x30bc8c(0x2b2)][_0x30bc8c(0x205)],'action':'error','error':_0x3eff6a[_0x30bc8c(0x246)]}),_0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x1df)][_0x30bc8c(0x2a1)]++;}}for(const _0x59b240 of _0x1835df){try{const _0x405a30=yamlExperimentalKnowledgeBaseToApi(_0x59b240['def'],_0x527054),_0x4ab595=await this[_0x30bc8c(0x2bc)][_0x30bc8c(0x1db)](_0x405a30);_0x38cabc[_0x30bc8c(0x230)](_0x59b240[_0x30bc8c(0x2b2)][_0x30bc8c(0x205)],_0x4ab595['id']),_0x559247[_0x30bc8c(0x209)][_0x30bc8c(0x28b)]({'name':_0x59b240[_0x30bc8c(0x2b2)]['name'],'action':_0x30bc8c(0x243),'id':_0x4ab595['id']}),_0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x209)]['created']++;}catch(_0x49efb9){_0x559247['experimentalKnowledgeBases'][_0x30bc8c(0x28b)]({'name':_0x59b240[_0x30bc8c(0x2b2)][_0x30bc8c(0x205)],'action':_0x30bc8c(0x1ad),'error':_0x49efb9['message']}),_0x559247['counts'][_0x30bc8c(0x209)][_0x30bc8c(0x2a1)]++;}}const _0xaaa8d5=[..._0x5a9d03][_0x30bc8c(0x210)]((_0x4842a5,_0x34425d)=>{const _0xfe556c=_0x30bc8c,_0x5a9a7e=_0x4842a5[_0xfe556c(0x1e4)][_0xfe556c(0x26f)]?.[_0xfe556c(0x1d7)](_0x207f93=>_0x207f93[_0xfe556c(0x221)]===_0xfe556c(0x1e2))??![],_0x3609de=_0x34425d[_0xfe556c(0x1e4)]['tools']?.[_0xfe556c(0x1d7)](_0x5ce24e=>_0x5ce24e[_0xfe556c(0x221)]===_0xfe556c(0x1e2))??![];if(_0x5a9a7e&&!_0x3609de)return 0x1;if(!_0x5a9a7e&&_0x3609de)return-0x1;return 0x0;});for(const _0x34a6c8 of _0xaaa8d5){_0x580c0c=[];try{const _0x2b4aaf=_0x34a6c8['yaml']['tools']?.['filter'](_0x4c8ce9=>{const _0x3abc5d=_0x30bc8c;if(_0x4c8ce9[_0x3abc5d(0x221)]==='agent'&&_0x4c8ce9[_0x3abc5d(0x2be)]){const _0x5a75f1=parseRef(_0x4c8ce9[_0x3abc5d(0x2be)]);return _0x5a75f1?.['name']===_0x34a6c8[_0x3abc5d(0x1e4)][_0x3abc5d(0x205)];}return![];})??[];if(_0x2b4aaf[_0x30bc8c(0x1d8)]>0x0){const _0x370d64='Agent\x20\x27'+_0x34a6c8[_0x30bc8c(0x1e4)][_0x30bc8c(0x205)]+_0x30bc8c(0x286)+_0x30bc8c(0x1ee);this[_0x30bc8c(0x1b6)][_0x30bc8c(0x2bf)](_0x370d64),_0x580c0c[_0x30bc8c(0x28b)](_0x370d64);}const _0x5ef4c6=await agentDefToRequest(_0x34a6c8[_0x30bc8c(0x1e4)],_0x34a6c8[_0x30bc8c(0x1bc)],_0x34a6c8['starterMessage'],_0x35104e),_0x114833=await this[_0x30bc8c(0x2bc)]['createAgentResponse'](_0x5ef4c6);_0x374873[_0x30bc8c(0x230)](_0x34a6c8[_0x30bc8c(0x1e4)][_0x30bc8c(0x205)],_0x114833['id']),_0x559247['agents'][_0x30bc8c(0x28b)]({'agentName':_0x34a6c8[_0x30bc8c(0x1e4)][_0x30bc8c(0x205)],'action':_0x30bc8c(0x243),'agentId':_0x114833['id'],'warnings':_0x580c0c['length']>0x0?_0x580c0c:undefined}),_0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x1b4)][_0x30bc8c(0x243)]++;}catch(_0x40674f){_0x559247['agents']['push']({'agentName':_0x34a6c8[_0x30bc8c(0x1e4)]['name'],'action':_0x30bc8c(0x1ad),'error':_0x40674f[_0x30bc8c(0x246)],'warnings':_0x580c0c[_0x30bc8c(0x1d8)]>0x0?_0x580c0c:undefined}),_0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x1b4)][_0x30bc8c(0x2a1)]++;}}for(const _0x57f73c of _0x80c586){try{const _0x467125=await yamlPromptToApi(_0x57f73c[_0x30bc8c(0x1e4)],_0x527054,_0x35104e);if(!_0x467125){_0x559247[_0x30bc8c(0x25b)][_0x30bc8c(0x28b)]({'name':_0x57f73c['yaml'][_0x30bc8c(0x205)],'action':'error','error':_0x30bc8c(0x28f)}),_0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x25b)]['errors']++;continue;}const _0x5b7183=await this[_0x30bc8c(0x2bc)][_0x30bc8c(0x240)](_0x467125);_0x41b715[_0x30bc8c(0x230)](_0x57f73c[_0x30bc8c(0x1e4)][_0x30bc8c(0x205)],_0x5b7183['id']),_0x559247[_0x30bc8c(0x25b)]['push']({'name':_0x57f73c['yaml'][_0x30bc8c(0x205)],'action':'created','id':_0x5b7183['id']}),_0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x25b)][_0x30bc8c(0x243)]++;}catch(_0x238442){_0x559247[_0x30bc8c(0x25b)][_0x30bc8c(0x28b)]({'name':_0x57f73c['yaml']['name'],'action':_0x30bc8c(0x1ad),'error':_0x238442[_0x30bc8c(0x246)]}),_0x559247['counts'][_0x30bc8c(0x25b)][_0x30bc8c(0x2a1)]++;}}for(const _0x54945f of _0x41e385){try{const _0x8f0bb1=await yamlIntegrationToApi(_0x54945f[_0x30bc8c(0x1e4)],_0x527054,_0x35104e),_0x3ef594=await this['client'][_0x30bc8c(0x24b)](_0x8f0bb1);_0x559247[_0x30bc8c(0x1fa)][_0x30bc8c(0x28b)]({'name':_0x54945f[_0x30bc8c(0x1e4)][_0x30bc8c(0x238)],'action':'created','id':_0x3ef594['id']}),_0x559247[_0x30bc8c(0x27b)][_0x30bc8c(0x1fa)][_0x30bc8c(0x243)]++;}catch(_0x554096){_0x559247[_0x30bc8c(0x1fa)][_0x30bc8c(0x28b)]({'name':_0x54945f['yaml'][_0x30bc8c(0x238)],'action':'error','error':_0x554096[_0x30bc8c(0x246)]}),_0x559247['counts'][_0x30bc8c(0x1fa)][_0x30bc8c(0x2a1)]++;}}return _0x559247;}}
|
|
1
|
+
const a109_0x3e47fb=a109_0x1d93;(function(_0x317951,_0xbf415){const _0x5a5fc8=a109_0x1d93,_0x451bc4=_0x317951();while(!![]){try{const _0x37943a=-parseInt(_0x5a5fc8(0x22f))/0x1+parseInt(_0x5a5fc8(0x1ae))/0x2*(-parseInt(_0x5a5fc8(0x1d9))/0x3)+-parseInt(_0x5a5fc8(0x1b9))/0x4+parseInt(_0x5a5fc8(0x11e))/0x5+-parseInt(_0x5a5fc8(0x1da))/0x6+parseInt(_0x5a5fc8(0x193))/0x7*(-parseInt(_0x5a5fc8(0x1a7))/0x8)+-parseInt(_0x5a5fc8(0x12a))/0x9*(-parseInt(_0x5a5fc8(0x21f))/0xa);if(_0x37943a===_0xbf415)break;else _0x451bc4['push'](_0x451bc4['shift']());}catch(_0x165456){_0x451bc4['push'](_0x451bc4['shift']());}}}(a109_0x4709,0x74ce5));import{LLMApiClient}from'../client/llm-api-client.js';function a109_0x1d93(_0x4469e8,_0x5e75b2){_0x4469e8=_0x4469e8-0x11e;const _0x4709ee=a109_0x4709();let _0x1d931b=_0x4709ee[_0x4469e8];return _0x1d931b;}function a109_0x4709(){const _0x1a8dae=['\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','ALREADY_EXISTS','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','Renamed\x20experimental\x20artifact\x20directory:\x20','Multiple\x20projects\x20found\x20with\x20name\x20\x27','LLM_PROJECT_NOT_FOUND','currentProjectId','chat_parent_segment','stringify','error','chatInfo','oldPath','basename','textKnowledgeBases','createAgent','listTextKnowledgeBases','agent.yml','slackMessageMode','isFile','content','sort','functions','createIntegration','3234ItdGof','starter_message.md','imageGenerators','listExperimentalKnowledgeBases','#\x20prompt.md\x0a','temperature','experimental_artifacts','action','project','Renamed\x20integration\x20file:\x20','minimal','tables','webSearchTools','\x0a---\x20function:\x20','(dry-run)','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','isManaged','history','24cDZYCe','AGENT_NOT_FOUND','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','tdx.json','1.0','unlinkSync','find','90918BsVzfL','getCurrentProject','code','agents','TextKnowledgeBase','createImageGenerator','writeFileSync','listToolTargets','deleteProject','tdx_default_','getChatHistory','771528iyHuvi','resolveProjectName','Removed\x20deleted\x20directory:\x20','knowledgebases.json','signal','claude-4.5-sonnet','prompts.json','createKnowledgeBase','Unresolved\x20dependencies:\x20','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','updateTextKnowledgeBase','backupProject','integrations','Output\x20directory\x20already\x20exists:\x20','Removed\x20deleted\x20file:\x20','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','Multiple\x20agents\x20found\x20with\x20name\x20\x27','Backup\x20folder\x20not\x20found:\x20','text_content','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','message','add','experimentalKnowledgeBases','knowledge_bases','Skipping\x20integration\x20\x27','rmSync','endsWith','updatePrompt','modelType','projects','mkdirSync','39lMpbKu','1391406RWMSYw','push','get','info','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','setDefaultAgent','site','localeCompare','displayName','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','conflict','createExperimentalArtifact','tdDatabaseName','webhookCorsOrigins','getProject','service_type','getOrCreateDefaultAgent','dryRun','isDirectory','Renamed\x20experimental\x20KB\x20directory:\x20','\x22\x20already\x20exists','Available\x20agents:\x20','getAgent','errors','keys','outputs','nameToId','systemPrompt','resolveAgentId','.llm','json_schema','name','\x20→\x20','files','INTERNAL','already\x20exists','createExperimentalKnowledgeBase','unchanged','has','getUserSettings','Invalid\x20agent\x20reference\x20format:\x20','Renamed\x20KB\x20file:\x20','Renamed\x20prompt\x20file:\x20','sdk.llm','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','status','path','):\x20','target','attributes','maxToolIterations','includes','promptId','listKnowledgeBases','renamed','\x0a---\x20code\x20---\x0a','logger','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','dir','map','Project\x20\x22','actions','isDir','clearDefaultAgent','listWebSearchTools','\x20attempts\x20due\x20to\x20name\x20conflicts.','No\x20tdx.json\x20found\x20in\x20','420bQaodV','web_search','agent.yml\x20not\x20found\x20in\x20','agentId','projectId','dirname','agentsFull','restoreProject','updateAgentResponse','serviceType','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','agent','continueChat','profile','experimentalArtifacts','readFileSync','358613HfbhoI','toLowerCase','\x0a---\x20schema:\x20','new','low','cwd','pushAgent','total','starterMessage','knowledgeBases','chatWelcomeMessage','type','metadata','readdirSync','client','prompt.md','json_schema.json','event','getOrCreateDefaultProject','toISOString','duplicate','\x27\x20(','2580120olBWPn','chats','deleteIntegration','listImageGenerators','Renamed\x20folder:\x20','loadJsonFile','tools','UNAUTHENTICATED','medium','createAgentResponse','Unsupported\x20backup\x20version:\x20','\x20in\x20project\x20','286749MEfqvD','yaml','---\x20file:\x20','listAgentsFull','createProject','warn','pullProject','Only\x20safe\x20types\x20(','reasoningEffort','high','listPrompts','chat','integrations.json','set','listChats','getBackupMetadata','listAgents','getChatInfo','listProjects','listIntegrations','Agent\x20reference\x20not\x20found','setCurrentProject','experimental_knowledge_bases','context','def','cloneProject','code.js','\x0a\x0a#\x20agent.yml\x0a','jsonSchemaHint','\x27.\x20This\x20should\x20not\x20happen.','INVALID_ARGUMENT','Agent\x20not\x20found:\x20','project.json','startChat','variables','listExperimentalArtifacts',')\x20can\x20be\x20pushed.\x20','text','availableModels','join','\x20---\x0a','filter','length','newProjectId','statSync','updated','Renamed\x20agent\x20folder:\x20','created','exportedFrom','starter_message','pullAgent','some','image_gen','chat_generic','.yml','createWebSearchTool','Agent\x20\x27','file_name','prompts','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','Unable\x20to\x20create\x20project\x20after\x20','NOT_FOUND','none','parse','Project\x20not\x20found:\x20','PERMISSION_DENIED','resolveProjectId','getChatLog','.md','getDefaultProjectName','createTextKnowledgeBase','tdx_','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','createPrompt','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','counts','updateExperimentalArtifact','utf-8','version','size','existsSync'];a109_0x4709=function(){return _0x1a8dae;};return a109_0x4709();}import*as a109_0x46e9cb from'node:fs';import*as a109_0x51353b from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir}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=[a109_0x3e47fb(0x15f),'chat_agent_console',a109_0x3e47fb(0x183)];async function safeListOrEmpty(_0xc5f851){const _0x2121a0=a109_0x3e47fb;try{return await _0xc5f851();}catch(_0x2f121a){if(_0x2f121a instanceof HTTPClientError&&_0x2f121a[_0x2121a0(0x209)]===0x194)return[];throw _0x2f121a;}}export class LLMSDK{[a109_0x3e47fb(0x182)];[a109_0x3e47fb(0x23d)];[a109_0x3e47fb(0x141)];[a109_0x3e47fb(0x214)]=Logger['of'](a109_0x3e47fb(0x206));constructor(_0x1093de){const _0x48b946=a109_0x3e47fb;this['client']=new LLMApiClient(_0x1093de),this[_0x48b946(0x141)]=_0x1093de;}[a109_0x3e47fb(0x16f)](){const _0x2d6b95=a109_0x3e47fb,_0x2c95a6=getSanitizedUsername();return _0x2d6b95(0x1b7)+_0x2c95a6;}async[a109_0x3e47fb(0x13f)](_0x1ea9b0){const _0x70388c=a109_0x3e47fb,{projectId:_0x3aa51f}=await this['resolveProjectName'](_0x1ea9b0);this[_0x70388c(0x182)]=_0x3aa51f;}[a109_0x3e47fb(0x1af)](){return this['currentProjectId'];}async[a109_0x3e47fb(0x1e0)](_0x148cde){const _0x4215a3=a109_0x3e47fb,_0x358317=this[_0x4215a3(0x141)]['profile'];let _0x42d4be,_0x57d3b8;if(_0x148cde[_0x4215a3(0x20f)]('/')){const _0x14d033=_0x148cde['split']('/');if(_0x14d033[_0x4215a3(0x154)]!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4215a3(0x203)+_0x148cde,undefined,{'helpText':_0x4215a3(0x1cd)});const [_0x5c82af,_0x56f5b4]=_0x14d033;_0x42d4be=await this[_0x4215a3(0x16c)](_0x5c82af),_0x57d3b8=_0x56f5b4;}else _0x42d4be=this[_0x4215a3(0x182)]||(await this[_0x4215a3(0x241)]())['id'],_0x57d3b8=_0x148cde;const _0x4f96b3=await this[_0x4215a3(0x1f7)](_0x57d3b8,_0x42d4be),_0x1b79a3=await this[_0x4215a3(0x23d)][_0x4215a3(0x1f1)](_0x4f96b3);writeCachedLLMAgent(_0x1b79a3[_0x4215a3(0x20d)]['name'],_0x4f96b3,_0x42d4be,_0x358317);}['getDefaultAgent'](){const _0x2bb7ce=a109_0x3e47fb,_0x2d270c=this[_0x2bb7ce(0x141)][_0x2bb7ce(0x22c)];return readCachedLLMAgent(_0x2d270c)||undefined;}[a109_0x3e47fb(0x21b)](){const _0x2e0e4d=a109_0x3e47fb,_0x7e7985=this[_0x2e0e4d(0x141)][_0x2e0e4d(0x22c)];clearCachedLLMAgent(_0x7e7985);}async['models'](){const _0x2179c7=a109_0x3e47fb,_0x4eb90a=await this[_0x2179c7(0x23d)][_0x2179c7(0x202)](),_0x4088aa=[];for(const _0x20c09c of _0x4eb90a['availableModelNames']){const _0x20ee1a=_0x4eb90a[_0x2179c7(0x150)][_0x20c09c];_0x20ee1a&&_0x4088aa[_0x2179c7(0x1db)]({'name':_0x20c09c,'displayName':_0x20ee1a[_0x2179c7(0x1e3)]});}return _0x4088aa;}async[a109_0x3e47fb(0x12e)](_0x327272){const _0x1c7241=a109_0x3e47fb;return await this[_0x1c7241(0x23d)][_0x1c7241(0x12e)](_0x327272);}async[a109_0x3e47fb(0x1b6)](_0x27fe4b){const _0x1ca39e=a109_0x3e47fb,{projectId:_0x566b41}=await this[_0x1ca39e(0x1ba)](_0x27fe4b);await this[_0x1ca39e(0x23d)][_0x1ca39e(0x1b6)](_0x566b41);}async[a109_0x3e47fb(0x1d7)](_0x43165c=0x32){const _0x45bd8c=a109_0x3e47fb;return await this[_0x45bd8c(0x23d)][_0x45bd8c(0x13c)](_0x43165c);}async['getOrCreateDefaultProject'](_0x16c75b){const _0x392f2a=a109_0x3e47fb,_0x34c1d5=_0x16c75b||this['getDefaultProjectName'](),_0x15ec2b=this['context'][_0x392f2a(0x22c)];if(!_0x16c75b){const _0x1268bf=readCachedLLMProject(_0x15ec2b);if(_0x1268bf&&_0x1268bf[_0x392f2a(0x1fa)]===_0x34c1d5)try{const _0x1058dd=await this[_0x392f2a(0x23d)][_0x392f2a(0x1e9)](_0x1268bf['id']);if(_0x1058dd[_0x392f2a(0x20d)][_0x392f2a(0x1fa)]===_0x34c1d5)return _0x1058dd;}catch{}}const _0x36cbdb=await this[_0x392f2a(0x23d)][_0x392f2a(0x13c)](),_0x246335=_0x36cbdb[_0x392f2a(0x1ad)](_0x5e844d=>_0x5e844d['attributes'][_0x392f2a(0x1fa)]===_0x34c1d5);if(_0x246335)return!_0x16c75b&&writeCachedLLMProject(_0x34c1d5,_0x246335['id'],_0x15ec2b),_0x246335;const _0x379d03=await this[_0x392f2a(0x23d)][_0x392f2a(0x12e)]({'name':_0x34c1d5,'description':'Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20'+getSanitizedUsername()+')'});return!_0x16c75b&&writeCachedLLMProject(_0x34c1d5,_0x379d03['id'],_0x15ec2b),_0x379d03;}async[a109_0x3e47fb(0x16c)](_0x1304a7){const _0x4065de=a109_0x3e47fb,_0x1f2653=await this[_0x4065de(0x23d)][_0x4065de(0x13c)](),_0x23a34c=_0x1f2653['filter'](_0x34090d=>_0x34090d[_0x4065de(0x20d)][_0x4065de(0x1fa)]===_0x1304a7);if(_0x23a34c[_0x4065de(0x154)]===0x0)throw new SDKError(ErrorCode[_0x4065de(0x181)],'Project\x20not\x20found:\x20'+_0x1304a7,undefined,{'helpText':_0x4065de(0x1c2)});if(_0x23a34c[_0x4065de(0x154)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x4065de(0x180)+_0x1304a7+_0x4065de(0x147));return _0x23a34c[0x0]['id'];}async[a109_0x3e47fb(0x1ba)](_0x1503f4){const _0x29b9b7=a109_0x3e47fb,_0x2d27cb=await this[_0x29b9b7(0x23d)][_0x29b9b7(0x13c)](),_0x450ed5=_0x2d27cb[_0x29b9b7(0x1ad)](_0x3c5421=>_0x3c5421[_0x29b9b7(0x20d)]['name']===_0x1503f4);if(_0x450ed5)return{'projectId':_0x450ed5['id'],'project':_0x450ed5};throw new SDKError(ErrorCode[_0x29b9b7(0x181)],_0x29b9b7(0x16a)+_0x1503f4,undefined,{'helpText':_0x29b9b7(0x1c2)});}async[a109_0x3e47fb(0x1eb)](_0x5b2583=a109_0x3e47fb(0x1be),_0x13495d=0x0,_0x48006a){const _0x2cc13b=a109_0x3e47fb,_0x2149a1=0xa;let _0x42ba24=0x0,_0x5b048d;while(_0x42ba24<_0x2149a1){try{const _0x3fe4e4=await this[_0x2cc13b(0x241)](_0x5b048d),_0x26e3d8=_0x3fe4e4['id'],_0xed4041=[_0x2cc13b(0x168),_0x2cc13b(0x19d),_0x2cc13b(0x233),_0x2cc13b(0x126),_0x2cc13b(0x133)],_0x25bf51=_0x13495d===0x0?_0x2cc13b(0x171)+_0x5b2583:'tdx_'+_0x5b2583+'_reasoning_'+_0xed4041[_0x13495d],_0x54f27a=await this[_0x2cc13b(0x23d)][_0x2cc13b(0x13a)](_0x26e3d8),_0x11c6ad=_0x54f27a[_0x2cc13b(0x1ad)](_0x5e1bb1=>_0x5e1bb1[_0x2cc13b(0x20d)][_0x2cc13b(0x1fa)]===_0x25bf51);if(_0x11c6ad)return _0x11c6ad;const _0x2eaa54=_0x13495d>0x0?0x1:_0x48006a;return await this[_0x2cc13b(0x23d)][_0x2cc13b(0x18a)]({'name':_0x25bf51,'projectId':_0x26e3d8,'modelType':_0x5b2583,'systemPrompt':'','temperature':_0x2eaa54,'reasoningEffort':_0x13495d>0x0?_0x13495d:undefined});}catch(_0x168ff0){if(_0x168ff0 instanceof HTTPClientError){const _0x56c52d=_0x168ff0[_0x2cc13b(0x209)];if(_0x56c52d>=0x190&&_0x56c52d<0x1f4){if(_0x56c52d===0x191)throw new SDKError(ErrorCode[_0x2cc13b(0x125)],_0x2cc13b(0x208),_0x168ff0);else{if(_0x56c52d===0x193)throw new SDKError(ErrorCode[_0x2cc13b(0x16b)],_0x2cc13b(0x1e4),_0x168ff0);}throw _0x168ff0;}}if(errorContains(_0x168ff0,_0x2cc13b(0x1fe),_0x2cc13b(0x243),_0x2cc13b(0x1e5))){_0x42ba24++;if(_0x42ba24>=_0x2149a1)throw new SDKError(ErrorCode[_0x2cc13b(0x17c)],_0x2cc13b(0x166)+_0x2149a1+_0x2cc13b(0x21d),_0x168ff0);const _0x57b8b7=this[_0x2cc13b(0x16f)]();_0x5b048d=_0x57b8b7+'_'+generateRandomHex();continue;}throw _0x168ff0;}}throw new SDKError(ErrorCode['INTERNAL'],_0x2cc13b(0x215));}async[a109_0x3e47fb(0x1f7)](_0x3ad615,_0x4ecda1){const _0x26ff7d=a109_0x3e47fb,_0x2184f9=_0x4ecda1||this[_0x26ff7d(0x182)],_0xfde241=await this[_0x26ff7d(0x23d)][_0x26ff7d(0x13a)](_0x2184f9),_0x198860=_0xfde241[_0x26ff7d(0x153)](_0x2c3b49=>_0x2c3b49['attributes']['name']===_0x3ad615);if(_0x198860[_0x26ff7d(0x154)]===0x0){const _0x39a6ac=_0x2184f9?_0x26ff7d(0x129)+_0x2184f9:'';throw new SDKError(ErrorCode[_0x26ff7d(0x1a8)],_0x26ff7d(0x149)+_0x3ad615+_0x39a6ac,undefined,{'helpText':_0x2184f9?_0x26ff7d(0x207):'Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.'});}if(_0x198860[_0x26ff7d(0x154)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x26ff7d(0x1ca)+_0x3ad615+'\x27.\x20This\x20should\x20not\x20happen.');return _0x198860[0x0]['id'];}async[a109_0x3e47fb(0x1b1)](_0x5a3851){const _0x21854e=a109_0x3e47fb,_0x3b48e5=_0x5a3851||this[_0x21854e(0x182)];return await this['client'][_0x21854e(0x13a)](_0x3b48e5);}async[a109_0x3e47fb(0x225)](_0x14be0d){const _0x278ad6=a109_0x3e47fb;return await this[_0x278ad6(0x23d)][_0x278ad6(0x12d)](_0x14be0d);}async[a109_0x3e47fb(0x22a)](_0x46faa6){const _0x38deed=a109_0x3e47fb;return await this[_0x38deed(0x23d)][_0x38deed(0x1f1)](_0x46faa6);}async['createAgent'](_0x2c4e12){const _0x599f7d=a109_0x3e47fb;return await this[_0x599f7d(0x23d)][_0x599f7d(0x18a)](_0x2c4e12);}async['updateAgent'](_0x593f6e,_0x398373){const _0x3bac48=a109_0x3e47fb;return await this[_0x3bac48(0x23d)]['updateAgent'](_0x593f6e,_0x398373);}async['deleteAgent'](_0x129d36){const _0x236a2d=a109_0x3e47fb;await this[_0x236a2d(0x23d)]['deleteAgent'](_0x129d36);}async[a109_0x3e47fb(0x14b)](_0xb0fcc4){const _0x445cf8=a109_0x3e47fb;return await this[_0x445cf8(0x23d)][_0x445cf8(0x14b)]({'agentId':_0xb0fcc4});}async*[a109_0x3e47fb(0x135)](_0x3b22cb,_0x5847e7){const _0x1196fc=a109_0x3e47fb;let _0x3e2450=_0x5847e7?.['chatId'];const _0x1c38eb=_0x5847e7?.[_0x1196fc(0x222)];if(!_0x3e2450){if(!_0x1c38eb)throw new Error(_0x1196fc(0x17d));const _0x421c8a=await this['client'][_0x1196fc(0x14b)]({'agentId':_0x1c38eb});_0x3e2450=_0x421c8a['id'],yield{'type':_0x1196fc(0x23b),'data':{'chatId':_0x3e2450,'agentId':_0x1c38eb,'projectId':_0x421c8a['attributes'][_0x1196fc(0x223)]}};}for await(const _0x4a4806 of this[_0x1196fc(0x23d)][_0x1196fc(0x22b)](_0x3e2450,_0x3b22cb,_0x5847e7?.[_0x1196fc(0x1bd)])){yield{'type':_0x1196fc(0x240),'data':_0x4a4806};}}async[a109_0x3e47fb(0x11f)](_0x46aedd=0x32){const _0x4ba504=a109_0x3e47fb;return await this['client'][_0x4ba504(0x138)](_0x46aedd);}async[a109_0x3e47fb(0x1a6)](_0x37b11f){const _0x143474=a109_0x3e47fb;return await this[_0x143474(0x23d)][_0x143474(0x1b8)](_0x37b11f);}async[a109_0x3e47fb(0x16d)](_0x5f40a3){const _0x24294b=a109_0x3e47fb;return await this[_0x24294b(0x23d)][_0x24294b(0x16d)](_0x5f40a3);}async[a109_0x3e47fb(0x186)](_0x5b7447){const _0x26df60=a109_0x3e47fb;return await this[_0x26df60(0x23d)][_0x26df60(0x13b)](_0x5b7447);}async[a109_0x3e47fb(0x1c5)](_0x5255dc,_0x4751a5,_0x3971db){const _0x2a3b6d=a109_0x3e47fb,_0x16d3da=_0x3971db?.[_0x2a3b6d(0x1ec)]??![],{projectId:_0x199701,project:_0x540bfc}=await this[_0x2a3b6d(0x1ba)](_0x5255dc),_0x569e96=_0x540bfc[_0x2a3b6d(0x20d)]['name'],_0xa4acb9=_0x4751a5||_0x569e96+_0x2a3b6d(0x1f8);if(a109_0x46e9cb[_0x2a3b6d(0x17a)](_0xa4acb9)&&!_0x16d3da)throw new SDKError(ErrorCode[_0x2a3b6d(0x17c)],_0x2a3b6d(0x1c7)+_0xa4acb9,undefined,{'helpText':_0x2a3b6d(0x1df)});const _0x29f969=await this['client'][_0x2a3b6d(0x12d)](_0x199701),_0x3351a2=await this[_0x2a3b6d(0x23d)][_0x2a3b6d(0x211)](_0x199701),_0x5d8a89=await this[_0x2a3b6d(0x23d)][_0x2a3b6d(0x134)](_0x199701),_0x196f8c=await this['client'][_0x2a3b6d(0x13d)](_0x199701);if(!_0x16d3da){a109_0x46e9cb[_0x2a3b6d(0x1d8)](_0xa4acb9,{'recursive':!![]});const _0x147123={'version':_0x2a3b6d(0x1ab),'exportedAt':new Date()[_0x2a3b6d(0x242)](),'exportedFrom':{'site':this[_0x2a3b6d(0x141)]['site'],'projectId':_0x199701,'projectName':_0x569e96},'project':_0x540bfc};a109_0x46e9cb[_0x2a3b6d(0x1b4)](a109_0x51353b['join'](_0xa4acb9,_0x2a3b6d(0x14a)),JSON[_0x2a3b6d(0x184)](_0x147123,null,0x2)),a109_0x46e9cb[_0x2a3b6d(0x1b4)](a109_0x51353b[_0x2a3b6d(0x151)](_0xa4acb9,'agents.json'),JSON[_0x2a3b6d(0x184)](_0x29f969,null,0x2)),a109_0x46e9cb['writeFileSync'](a109_0x51353b[_0x2a3b6d(0x151)](_0xa4acb9,_0x2a3b6d(0x1bc)),JSON['stringify'](_0x3351a2,null,0x2)),a109_0x46e9cb[_0x2a3b6d(0x1b4)](a109_0x51353b[_0x2a3b6d(0x151)](_0xa4acb9,'prompts.json'),JSON[_0x2a3b6d(0x184)](_0x5d8a89,null,0x2)),a109_0x46e9cb['writeFileSync'](a109_0x51353b[_0x2a3b6d(0x151)](_0xa4acb9,'integrations.json'),JSON[_0x2a3b6d(0x184)](_0x196f8c,null,0x2));}return{'projectName':_0x569e96,'outputDir':_0xa4acb9,'counts':{'agents':_0x29f969[_0x2a3b6d(0x154)],'knowledgeBases':_0x3351a2[_0x2a3b6d(0x154)],'prompts':_0x5d8a89['length'],'integrations':_0x196f8c[_0x2a3b6d(0x154)]}};}async[a109_0x3e47fb(0x226)](_0x33dfb2,_0x3bad1e){const _0x59da1a=a109_0x3e47fb,_0x1c2193=_0x3bad1e?.[_0x59da1a(0x1ec)]??![],_0x41a375=this[_0x59da1a(0x139)](_0x33dfb2),_0x437a89=_0x41a375[_0x59da1a(0x15a)][_0x59da1a(0x1e1)],_0x4a37c6=this[_0x59da1a(0x141)][_0x59da1a(0x1e1)],_0x1c966c=_0x437a89!==_0x4a37c6?_0x437a89:undefined,_0xae4ab8=this[_0x59da1a(0x123)](a109_0x51353b[_0x59da1a(0x151)](_0x33dfb2,'agents.json'),[]),_0x279742=this[_0x59da1a(0x123)](a109_0x51353b[_0x59da1a(0x151)](_0x33dfb2,_0x59da1a(0x1bc)),[]),_0x33d6ca=this[_0x59da1a(0x123)](a109_0x51353b[_0x59da1a(0x151)](_0x33dfb2,_0x59da1a(0x1bf)),[]),_0x1251f6=this[_0x59da1a(0x123)](a109_0x51353b[_0x59da1a(0x151)](_0x33dfb2,_0x59da1a(0x136)),[]),_0x3f81e4=_0x3bad1e?.[_0x59da1a(0x1fa)]||_0x41a375['exportedFrom']['projectName'];if(_0x1c2193){const _0x1993bd=new Map(),_0x514b08=[..._0xae4ab8],_0x7657d7=_0xae4ab8[_0x59da1a(0x154)]+0x1;let _0x5be842=0x0;while(_0x514b08['length']>0x0&&_0x5be842<_0x7657d7){_0x5be842++;const _0x56b5b6=[];for(const _0x5cc1a4 of _0x514b08){canCreateAgent(_0x5cc1a4,_0x1993bd)?_0x1993bd[_0x59da1a(0x137)](_0x5cc1a4['id'],'dry-run-'+_0x5cc1a4['id']):_0x56b5b6[_0x59da1a(0x1db)](_0x5cc1a4);}if(_0x56b5b6[_0x59da1a(0x154)]===_0x514b08[_0x59da1a(0x154)])throw new SDKError(ErrorCode[_0x59da1a(0x1fd)],_0x59da1a(0x1a3),undefined,{'helpText':_0x59da1a(0x17e)});_0x514b08[_0x59da1a(0x154)]=0x0,_0x514b08['push'](..._0x56b5b6);}const _0x3dfb02=_0x33d6ca[_0x59da1a(0x153)](_0x53ce57=>_0x1993bd['has'](_0x53ce57['attributes'][_0x59da1a(0x222)]))[_0x59da1a(0x154)];return{'projectName':_0x3f81e4,'projectId':_0x59da1a(0x1a1),'counts':{'agents':_0xae4ab8[_0x59da1a(0x154)],'knowledgeBases':_0x279742[_0x59da1a(0x154)],'prompts':_0x3dfb02,'integrations':_0x1251f6['length']},'sourceSite':_0x1c966c};}const _0x1db9cd=await this[_0x59da1a(0x23d)][_0x59da1a(0x12e)]({'name':_0x3f81e4,'description':_0x41a375[_0x59da1a(0x19b)]['attributes']['description']}),_0x1c0514=_0x1db9cd['id'],_0x4f86c6=new Map(),_0x28e905=new Map(),_0x4224ea=new Map();for(const _0x508489 of _0x279742){const _0x1760b6=await this[_0x59da1a(0x23d)]['createKnowledgeBase']({'projectId':_0x1c0514,'name':_0x508489['attributes'][_0x59da1a(0x1fa)],'tdDatabaseName':_0x508489[_0x59da1a(0x20d)][_0x59da1a(0x1e7)],'tables':_0x508489[_0x59da1a(0x20d)][_0x59da1a(0x19e)]});_0x4f86c6['set'](_0x508489['id'],_0x1760b6['id']);}const _0x49332d=[..._0xae4ab8],_0x19ab41=_0xae4ab8['length']+0x1;let _0x5beb97=0x0;while(_0x49332d['length']>0x0&&_0x5beb97<_0x19ab41){_0x5beb97++;const _0x3cd1e0=[];for(const _0xb30013 of _0x49332d){if(canCreateAgent(_0xb30013,_0x28e905)){const _0x591566=remapToolIds(_0xb30013['attributes'][_0x59da1a(0x124)],_0x4f86c6,_0x28e905),_0x56ea99=remapVariableIds(_0xb30013['attributes']['variables'],_0x4f86c6),_0x395cb4=await this[_0x59da1a(0x23d)][_0x59da1a(0x127)]({'name':_0xb30013[_0x59da1a(0x20d)][_0x59da1a(0x1fa)],'projectId':_0x1c0514,'systemPrompt':_0xb30013[_0x59da1a(0x20d)][_0x59da1a(0x1f6)],'starterMessage':_0xb30013[_0x59da1a(0x20d)][_0x59da1a(0x237)],'modelType':migrateModelType(_0xb30013[_0x59da1a(0x20d)][_0x59da1a(0x1d6)]),'maxToolIterations':_0xb30013['attributes'][_0x59da1a(0x20e)],'temperature':_0xb30013[_0x59da1a(0x20d)][_0x59da1a(0x198)],'reasoningEffort':_0xb30013[_0x59da1a(0x20d)][_0x59da1a(0x132)],'outputs':_0xb30013[_0x59da1a(0x20d)][_0x59da1a(0x1f4)],'tools':_0x591566,'variables':_0x56ea99});_0x28e905['set'](_0xb30013['id'],_0x395cb4['id']);}else _0x3cd1e0['push'](_0xb30013);}if(_0x3cd1e0[_0x59da1a(0x154)]===_0x49332d[_0x59da1a(0x154)])throw new SDKError(ErrorCode[_0x59da1a(0x1fd)],_0x59da1a(0x1a3),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x49332d[_0x59da1a(0x154)]=0x0,_0x49332d[_0x59da1a(0x1db)](..._0x3cd1e0);}for(const _0x466a3b of _0x33d6ca){const _0x1a5b9a=_0x28e905[_0x59da1a(0x1dc)](_0x466a3b['attributes']['agentId']);if(!_0x1a5b9a)continue;const _0x3296a5=await this[_0x59da1a(0x23d)][_0x59da1a(0x173)]({'projectId':_0x1c0514,'agentId':_0x1a5b9a,'name':_0x466a3b[_0x59da1a(0x20d)][_0x59da1a(0x1fa)],'systemPrompt':_0x466a3b[_0x59da1a(0x20d)][_0x59da1a(0x1f6)],'template':_0x466a3b[_0x59da1a(0x20d)]['template'],'jsonSchemaHint':_0x466a3b[_0x59da1a(0x20d)][_0x59da1a(0x146)]});_0x4224ea[_0x59da1a(0x137)](_0x466a3b['id'],_0x3296a5['id']);}for(const _0x53ec83 of _0x1251f6){const _0x31abf8=_0x53ec83[_0x59da1a(0x20d)][_0x59da1a(0x219)][_0x59da1a(0x217)](_0x5a4936=>({..._0x5a4936,'promptId':_0x4224ea['get'](_0x5a4936[_0x59da1a(0x210)])||_0x5a4936['promptId']}));await this[_0x59da1a(0x23d)][_0x59da1a(0x192)]({'projectId':_0x1c0514,'serviceType':_0x53ec83[_0x59da1a(0x20d)][_0x59da1a(0x228)],'actions':_0x31abf8,'slackMessageMode':_0x53ec83['attributes'][_0x59da1a(0x18d)],'chatIgnoreManagedActions':_0x53ec83[_0x59da1a(0x20d)]['chatIgnoreManagedActions'],'chatWelcomeMessage':_0x53ec83[_0x59da1a(0x20d)][_0x59da1a(0x239)],'webhookCorsOrigins':_0x53ec83[_0x59da1a(0x20d)][_0x59da1a(0x1e8)]});}return{'projectName':_0x3f81e4,'projectId':_0x1c0514,'counts':{'agents':_0x28e905[_0x59da1a(0x179)],'knowledgeBases':_0x4f86c6[_0x59da1a(0x179)],'prompts':_0x4224ea['size'],'integrations':_0x1251f6[_0x59da1a(0x154)]},'sourceSite':_0x1c966c};}['loadJsonFile'](_0x310596,_0x4191f7){const _0x45b646=a109_0x3e47fb;if(!a109_0x46e9cb['existsSync'](_0x310596))return _0x4191f7;return JSON[_0x45b646(0x169)](a109_0x46e9cb[_0x45b646(0x22e)](_0x310596,_0x45b646(0x177)));}[a109_0x3e47fb(0x139)](_0x42b2db){const _0x33d5cd=a109_0x3e47fb;if(!a109_0x46e9cb[_0x33d5cd(0x17a)](_0x42b2db))throw new SDKError(ErrorCode[_0x33d5cd(0x167)],_0x33d5cd(0x1cb)+_0x42b2db,undefined,{'helpText':_0x33d5cd(0x1a4)});const _0x26a4e3=a109_0x51353b[_0x33d5cd(0x151)](_0x42b2db,_0x33d5cd(0x14a));if(!a109_0x46e9cb[_0x33d5cd(0x17a)](_0x26a4e3))throw new SDKError(ErrorCode[_0x33d5cd(0x148)],_0x33d5cd(0x1a2)+_0x42b2db,undefined,{'helpText':_0x33d5cd(0x1c3)});const _0x40bc86=JSON[_0x33d5cd(0x169)](a109_0x46e9cb[_0x33d5cd(0x22e)](_0x26a4e3,_0x33d5cd(0x177)));if(!isSupportedBackupVersion(_0x40bc86['version']))throw new SDKError(ErrorCode[_0x33d5cd(0x148)],_0x33d5cd(0x128)+_0x40bc86[_0x33d5cd(0x178)],undefined,{'helpText':_0x33d5cd(0x229)});return _0x40bc86;}async[a109_0x3e47fb(0x130)](_0x1a3e47,_0xb36e1a,_0x28f4ad){const _0x4e0cc4=a109_0x3e47fb,{projectId:_0x252522,project:_0x37676a}=await this['resolveProjectName'](_0x1a3e47),_0x24493e=_0x37676a['attributes']['name'];let _0x27b854;if(_0xb36e1a)_0x27b854=_0xb36e1a;else{const _0x26643d=a109_0x51353b[_0x4e0cc4(0x151)](process[_0x4e0cc4(0x234)](),_0x4e0cc4(0x1b1)),_0xbd2632=getSanitizedPathWithMigration(_0x26643d,_0x24493e);_0xbd2632['renamed']&&this[_0x4e0cc4(0x214)][_0x4e0cc4(0x1dd)](_0x4e0cc4(0x122)+a109_0x51353b[_0x4e0cc4(0x188)](_0xbd2632[_0x4e0cc4(0x187)])+_0x4e0cc4(0x1fb)+a109_0x51353b[_0x4e0cc4(0x188)](_0xbd2632[_0x4e0cc4(0x20a)])),_0x27b854=_0xbd2632['path'];}const _0x3e544d=await this[_0x4e0cc4(0x23d)][_0x4e0cc4(0x12d)](_0x252522),_0x48fff4=await this[_0x4e0cc4(0x23d)][_0x4e0cc4(0x211)](_0x252522),_0x47ba77=await this[_0x4e0cc4(0x23d)][_0x4e0cc4(0x18b)](_0x252522),_0x3d6a76=await safeListOrEmpty(()=>this[_0x4e0cc4(0x23d)][_0x4e0cc4(0x121)](_0x252522)),_0x236778=await safeListOrEmpty(()=>this['client'][_0x4e0cc4(0x21c)](_0x252522)),_0x250223=await this['client'][_0x4e0cc4(0x134)](_0x252522),_0xcbc604=await this[_0x4e0cc4(0x23d)]['listIntegrations'](_0x252522),_0x4efee4=await safeListOrEmpty(()=>this[_0x4e0cc4(0x23d)][_0x4e0cc4(0x196)](_0x252522)),_0x3131c5=await safeListOrEmpty(()=>this[_0x4e0cc4(0x23d)][_0x4e0cc4(0x14d)](_0x252522)),_0xe48ece=_0xcbc604[_0x4e0cc4(0x153)](_0x21d57f=>!_0x21d57f[_0x4e0cc4(0x20d)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x4e0cc4(0x20f)](_0x21d57f[_0x4e0cc4(0x20d)][_0x4e0cc4(0x228)]['toLowerCase']())),_0x2dca46=new Map(),_0xf75a68=new Map(),_0x1294b5=new Map(),_0x377a8a=new Map(),_0x9b9319=new Map(),_0x4b77f3=new Map(),_0x2f5032=new Map();for(const _0x565619 of _0x3e544d){_0x2dca46[_0x4e0cc4(0x137)](_0x565619['id'],_0x565619[_0x4e0cc4(0x20d)][_0x4e0cc4(0x1fa)]);}for(const _0x13416b of _0x48fff4){_0xf75a68['set'](_0x13416b['id'],_0x13416b['attributes']['name']);}for(const _0x220a82 of _0x47ba77){_0x1294b5[_0x4e0cc4(0x137)](_0x220a82['id'],_0x220a82[_0x4e0cc4(0x20d)][_0x4e0cc4(0x1fa)]);}for(const _0x47d82b of _0x3d6a76){_0x377a8a[_0x4e0cc4(0x137)](_0x47d82b['id'],_0x47d82b['attributes'][_0x4e0cc4(0x1fa)]);}for(const _0x517487 of _0x236778){_0x9b9319[_0x4e0cc4(0x137)](_0x517487['id'],_0x517487['attributes'][_0x4e0cc4(0x1fa)]);}for(const _0x294dcc of _0x250223){_0x4b77f3['set'](_0x294dcc['id'],_0x294dcc[_0x4e0cc4(0x20d)][_0x4e0cc4(0x1fa)]);}for(const _0xf952b3 of _0x4efee4){_0x2f5032[_0x4e0cc4(0x137)](_0xf952b3['id'],_0xf952b3[_0x4e0cc4(0x20d)][_0x4e0cc4(0x1fa)]);}const _0x4c24ad={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0xf75a68,'TextKnowledgeBase':_0x1294b5,'Agent':_0x2dca46,'WebSearchTool':_0x9b9319,'ImageGenerator':_0x377a8a,'ExperimentalKnowledgeBase':_0x2f5032}),'resolvePromptName':async _0x424ed7=>_0x4b77f3[_0x4e0cc4(0x1dc)](_0x424ed7),'onWarning':_0xde415f=>this[_0x4e0cc4(0x214)][_0x4e0cc4(0x12f)](_0xde415f)},_0x4b4043={'projectName':_0x24493e,'outputDir':_0x27b854,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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}}},_0x275813=[],_0x1bb350=[];for(const _0x142c2e of _0x3e544d){const _0x4c3120=getSanitizedPathWithMigration(_0x27b854,_0x142c2e[_0x4e0cc4(0x20d)][_0x4e0cc4(0x1fa)]);_0x4c3120[_0x4e0cc4(0x212)]&&this['logger'][_0x4e0cc4(0x1dd)](_0x4e0cc4(0x158)+a109_0x51353b[_0x4e0cc4(0x188)](_0x4c3120[_0x4e0cc4(0x187)])+_0x4e0cc4(0x1fb)+a109_0x51353b[_0x4e0cc4(0x188)](_0x4c3120[_0x4e0cc4(0x20a)]));const _0xac3cac=_0x4c3120[_0x4e0cc4(0x20a)],_0xafd2fa=a109_0x51353b['join'](_0xac3cac,_0x4e0cc4(0x23e)),_0x1d6c8e=a109_0x51353b[_0x4e0cc4(0x151)](_0xac3cac,_0x4e0cc4(0x18c)),_0x5e545e=a109_0x51353b[_0x4e0cc4(0x151)](_0xac3cac,_0x4e0cc4(0x194)),{yaml:_0x471d22,systemPrompt:_0x137590,starterMessage:_0xf3682e}=await agentResponseToDef(_0x142c2e,_0x4c24ad),_0xc88901=toAgentYamlString(_0x471d22),_0x42425c=!a109_0x46e9cb[_0x4e0cc4(0x17a)](_0x1d6c8e);let _0x2d15f8=_0x42425c,_0x58c8d1;if(!_0x42425c){const _0x200188=a109_0x46e9cb[_0x4e0cc4(0x17a)](_0xafd2fa)?a109_0x46e9cb[_0x4e0cc4(0x22e)](_0xafd2fa,_0x4e0cc4(0x177)):'',_0x1f3df3=a109_0x46e9cb[_0x4e0cc4(0x22e)](_0x1d6c8e,_0x4e0cc4(0x177)),_0x282a13='#\x20prompt.md\x0a'+_0x200188+_0x4e0cc4(0x145)+_0x1f3df3,_0x129894=_0x4e0cc4(0x197)+_0x137590+_0x4e0cc4(0x145)+_0xc88901,_0x1dce27=generateDiff(_0x282a13,_0x129894);_0x2d15f8=hasChanges(_0x1dce27),_0x2d15f8&&(_0x58c8d1=formatDiffWithColors(_0x1dce27));}_0x275813['push']({'path':_0xac3cac,'content':'','isDir':!![]}),_0x275813[_0x4e0cc4(0x1db)]({'path':_0xafd2fa,'content':_0x137590}),_0x275813[_0x4e0cc4(0x1db)]({'path':_0x1d6c8e,'content':_0xc88901});_0xf3682e&&_0xf3682e[_0x4e0cc4(0x20f)]('\x0a')&&_0x275813['push']({'path':_0x5e545e,'content':_0xf3682e});_0x4b4043[_0x4e0cc4(0x1b1)][_0x4e0cc4(0x1db)]({'agentName':_0x142c2e[_0x4e0cc4(0x20d)][_0x4e0cc4(0x1fa)],'outputPath':_0xac3cac,'isNew':_0x42425c,'hasChanges':_0x2d15f8,'diff':_0x58c8d1}),_0x4b4043[_0x4e0cc4(0x175)]['agents'][_0x4e0cc4(0x236)]++;if(_0x42425c)_0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x1b1)][_0x4e0cc4(0x232)]++;else{if(_0x2d15f8)_0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x1b1)][_0x4e0cc4(0x157)]++;else _0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x1b1)][_0x4e0cc4(0x200)]++;}}for(const _0x9638f of _0x48fff4){if(_0x9638f[_0x4e0cc4(0x20d)][_0x4e0cc4(0x1a5)])continue;const _0x2aa0d1=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x27b854),_0x9638f['attributes'][_0x4e0cc4(0x1fa)],_0x4e0cc4(0x160));_0x2aa0d1['renamed']&&this['logger'][_0x4e0cc4(0x1dd)](_0x4e0cc4(0x204)+a109_0x51353b[_0x4e0cc4(0x188)](_0x2aa0d1[_0x4e0cc4(0x187)])+_0x4e0cc4(0x1fb)+a109_0x51353b[_0x4e0cc4(0x188)](_0x2aa0d1['path']));const _0x2f5d20=_0x2aa0d1[_0x4e0cc4(0x20a)],_0x402f03=apiKnowledgeBaseToYaml(_0x9638f),_0x1ab0f9=toKnowledgeBaseYamlString(_0x402f03),_0x49ff8e=!a109_0x46e9cb[_0x4e0cc4(0x17a)](_0x2f5d20);let _0x5b36ca=_0x49ff8e,_0x241aec;if(!_0x49ff8e){const _0x37ce29=a109_0x46e9cb[_0x4e0cc4(0x22e)](_0x2f5d20,_0x4e0cc4(0x177)),_0x5aeaa8=generateDiff(_0x37ce29,_0x1ab0f9);_0x5b36ca=hasChanges(_0x5aeaa8),_0x5b36ca&&(_0x241aec=formatDiffWithColors(_0x5aeaa8));}_0x275813[_0x4e0cc4(0x1db)]({'path':_0x2f5d20,'content':_0x1ab0f9}),_0x4b4043[_0x4e0cc4(0x238)][_0x4e0cc4(0x1db)]({'name':_0x9638f[_0x4e0cc4(0x20d)][_0x4e0cc4(0x1fa)],'outputPath':_0x2f5d20,'isNew':_0x49ff8e,'hasChanges':_0x5b36ca,'diff':_0x241aec}),_0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x238)]['total']++;if(_0x49ff8e)_0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x238)][_0x4e0cc4(0x232)]++;else{if(_0x5b36ca)_0x4b4043[_0x4e0cc4(0x175)]['knowledgeBases'][_0x4e0cc4(0x157)]++;else _0x4b4043[_0x4e0cc4(0x175)]['knowledgeBases']['unchanged']++;}}for(const _0x167a7e of _0x47ba77){if(_0x167a7e[_0x4e0cc4(0x20d)]['isManaged'])continue;const _0xee769f=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x27b854),_0x167a7e[_0x4e0cc4(0x20d)]['name'],_0x4e0cc4(0x16e));_0xee769f[_0x4e0cc4(0x212)]&&this[_0x4e0cc4(0x214)][_0x4e0cc4(0x1dd)]('Renamed\x20text\x20KB\x20file:\x20'+a109_0x51353b[_0x4e0cc4(0x188)](_0xee769f[_0x4e0cc4(0x187)])+'\x20→\x20'+a109_0x51353b[_0x4e0cc4(0x188)](_0xee769f[_0x4e0cc4(0x20a)]));const _0x134630=_0xee769f[_0x4e0cc4(0x20a)],_0x47fb33=toTextKnowledgeBaseMd(_0x167a7e[_0x4e0cc4(0x20d)][_0x4e0cc4(0x1fa)],_0x167a7e[_0x4e0cc4(0x20d)][_0x4e0cc4(0x14f)]),_0x18b980=!a109_0x46e9cb[_0x4e0cc4(0x17a)](_0x134630);let _0x32783f=_0x18b980,_0x5eda27;if(!_0x18b980){const _0x4624ed=a109_0x46e9cb[_0x4e0cc4(0x22e)](_0x134630,_0x4e0cc4(0x177)),_0x3c6d83=generateDiff(_0x4624ed,_0x47fb33);_0x32783f=hasChanges(_0x3c6d83),_0x32783f&&(_0x5eda27=formatDiffWithColors(_0x3c6d83));}_0x275813[_0x4e0cc4(0x1db)]({'path':_0x134630,'content':_0x47fb33}),_0x4b4043[_0x4e0cc4(0x189)][_0x4e0cc4(0x1db)]({'name':_0x167a7e['attributes']['name'],'outputPath':_0x134630,'isNew':_0x18b980,'hasChanges':_0x32783f,'diff':_0x5eda27}),_0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x189)]['total']++;if(_0x18b980)_0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x189)][_0x4e0cc4(0x232)]++;else{if(_0x32783f)_0x4b4043[_0x4e0cc4(0x175)]['textKnowledgeBases'][_0x4e0cc4(0x157)]++;else _0x4b4043[_0x4e0cc4(0x175)]['textKnowledgeBases'][_0x4e0cc4(0x200)]++;}}for(const _0x528619 of _0x250223){if(_0x528619[_0x4e0cc4(0x20d)]['isManaged'])continue;const _0x22c221=getSanitizedPathWithMigration(getPromptsDir(_0x27b854),_0x528619[_0x4e0cc4(0x20d)][_0x4e0cc4(0x1fa)],_0x4e0cc4(0x160));_0x22c221[_0x4e0cc4(0x212)]&&this[_0x4e0cc4(0x214)][_0x4e0cc4(0x1dd)](_0x4e0cc4(0x205)+a109_0x51353b['basename'](_0x22c221[_0x4e0cc4(0x187)])+'\x20→\x20'+a109_0x51353b[_0x4e0cc4(0x188)](_0x22c221[_0x4e0cc4(0x20a)]));const _0xf5c365=_0x22c221[_0x4e0cc4(0x20a)],_0x480e4f=await apiPromptToYaml(_0x528619,_0x4c24ad);if(!_0x480e4f)continue;const _0x47503d=toPromptYamlString(_0x480e4f),_0xe2776f=!a109_0x46e9cb[_0x4e0cc4(0x17a)](_0xf5c365);let _0x44b048=_0xe2776f,_0x48e50a;if(!_0xe2776f){const _0x52a778=a109_0x46e9cb[_0x4e0cc4(0x22e)](_0xf5c365,_0x4e0cc4(0x177)),_0x21e5df=generateDiff(_0x52a778,_0x47503d);_0x44b048=hasChanges(_0x21e5df),_0x44b048&&(_0x48e50a=formatDiffWithColors(_0x21e5df));}_0x275813[_0x4e0cc4(0x1db)]({'path':_0xf5c365,'content':_0x47503d}),_0x4b4043[_0x4e0cc4(0x164)][_0x4e0cc4(0x1db)]({'name':_0x528619['attributes'][_0x4e0cc4(0x1fa)],'outputPath':_0xf5c365,'isNew':_0xe2776f,'hasChanges':_0x44b048,'diff':_0x48e50a}),_0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x164)][_0x4e0cc4(0x236)]++;if(_0xe2776f)_0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x164)][_0x4e0cc4(0x232)]++;else{if(_0x44b048)_0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x164)]['updated']++;else _0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x164)][_0x4e0cc4(0x200)]++;}}for(const _0x45c950 of _0xe48ece){const _0x438219=_0x45c950[_0x4e0cc4(0x20d)]['serviceType']['toLowerCase'](),_0x30f234=getSanitizedPathWithMigration(getIntegrationsDir(_0x27b854),_0x438219,_0x4e0cc4(0x160));_0x30f234[_0x4e0cc4(0x212)]&&this['logger'][_0x4e0cc4(0x1dd)](_0x4e0cc4(0x19c)+a109_0x51353b['basename'](_0x30f234[_0x4e0cc4(0x187)])+_0x4e0cc4(0x1fb)+a109_0x51353b[_0x4e0cc4(0x188)](_0x30f234[_0x4e0cc4(0x20a)]));const _0x2a5ebd=_0x30f234[_0x4e0cc4(0x20a)],_0x24833d=await apiIntegrationToYaml(_0x45c950,_0x4c24ad),_0x3ce320=toIntegrationYamlString(_0x24833d),_0x1d8461=!a109_0x46e9cb['existsSync'](_0x2a5ebd);let _0x309152=_0x1d8461,_0x3620ef;if(!_0x1d8461){const _0x58b97b=a109_0x46e9cb[_0x4e0cc4(0x22e)](_0x2a5ebd,'utf-8'),_0x38add3=generateDiff(_0x58b97b,_0x3ce320);_0x309152=hasChanges(_0x38add3),_0x309152&&(_0x3620ef=formatDiffWithColors(_0x38add3));}_0x275813[_0x4e0cc4(0x1db)]({'path':_0x2a5ebd,'content':_0x3ce320}),_0x4b4043['integrations'][_0x4e0cc4(0x1db)]({'name':_0x438219,'outputPath':_0x2a5ebd,'isNew':_0x1d8461,'hasChanges':_0x309152,'diff':_0x3620ef}),_0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x1c6)][_0x4e0cc4(0x236)]++;if(_0x1d8461)_0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x1c6)][_0x4e0cc4(0x232)]++;else{if(_0x309152)_0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x1c6)][_0x4e0cc4(0x157)]++;else _0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x1c6)][_0x4e0cc4(0x200)]++;}}for(const _0x51b608 of _0x4efee4){if(_0x51b608['attributes']['isManaged'])continue;const _0x3f9fb6=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x27b854),_0x51b608[_0x4e0cc4(0x20d)][_0x4e0cc4(0x1fa)]);_0x3f9fb6[_0x4e0cc4(0x212)]&&this[_0x4e0cc4(0x214)]['info'](_0x4e0cc4(0x1ee)+a109_0x51353b[_0x4e0cc4(0x188)](_0x3f9fb6[_0x4e0cc4(0x187)])+_0x4e0cc4(0x1fb)+a109_0x51353b[_0x4e0cc4(0x188)](_0x3f9fb6[_0x4e0cc4(0x20a)]));const _0x2a3de3=_0x3f9fb6[_0x4e0cc4(0x20a)],_0x22a738=a109_0x51353b[_0x4e0cc4(0x151)](_0x2a3de3,sanitizeForFilesystem(_0x51b608[_0x4e0cc4(0x20d)]['name'])+_0x4e0cc4(0x160)),_0x94ffd7=a109_0x51353b['join'](_0x2a3de3,_0x4e0cc4(0x191)),_0x97fdc=apiExperimentalKnowledgeBaseToYaml(_0x51b608),_0x1f47ea=toExperimentalKnowledgeBaseYamlString(_0x97fdc),_0xd66fcd=!a109_0x46e9cb[_0x4e0cc4(0x17a)](_0x2a3de3);let _0x56c5f8=_0xd66fcd,_0x366888,_0x28dcfc=_0x1f47ea;const _0x111ae2=[..._0x97fdc['functions']][_0x4e0cc4(0x190)]((_0x537ce7,_0x55e572)=>_0x537ce7[_0x4e0cc4(0x1fa)][_0x4e0cc4(0x1e2)](_0x55e572[_0x4e0cc4(0x1fa)]));for(const _0x154180 of _0x111ae2){_0x28dcfc+=_0x4e0cc4(0x1a0)+_0x154180[_0x4e0cc4(0x1fa)]+_0x4e0cc4(0x152)+_0x154180[_0x4e0cc4(0x1b0)]+_0x4e0cc4(0x231)+_0x154180[_0x4e0cc4(0x1fa)]+_0x4e0cc4(0x152)+_0x154180[_0x4e0cc4(0x1f9)]+'\x0a';}if(!_0xd66fcd){let _0x5a3b8b='';a109_0x46e9cb[_0x4e0cc4(0x17a)](_0x22a738)&&(_0x5a3b8b=a109_0x46e9cb[_0x4e0cc4(0x22e)](_0x22a738,_0x4e0cc4(0x177)));if(a109_0x46e9cb[_0x4e0cc4(0x17a)](_0x94ffd7)){const _0x19221a=a109_0x46e9cb[_0x4e0cc4(0x23c)](_0x94ffd7,{'withFileTypes':!![]}),_0x1fa2dc=_0x19221a['filter'](_0x3a2aad=>_0x3a2aad[_0x4e0cc4(0x1ed)]())[_0x4e0cc4(0x190)]((_0x94091c,_0x309cfa)=>_0x94091c[_0x4e0cc4(0x1fa)][_0x4e0cc4(0x1e2)](_0x309cfa[_0x4e0cc4(0x1fa)]));for(const _0x25f628 of _0x1fa2dc){const _0x5a0f87=a109_0x51353b[_0x4e0cc4(0x151)](_0x94ffd7,_0x25f628[_0x4e0cc4(0x1fa)],'code.js'),_0x9a6d4d=a109_0x51353b[_0x4e0cc4(0x151)](_0x94ffd7,_0x25f628[_0x4e0cc4(0x1fa)],_0x4e0cc4(0x23f));a109_0x46e9cb[_0x4e0cc4(0x17a)](_0x5a0f87)&&(_0x5a3b8b+=_0x4e0cc4(0x1a0)+_0x25f628[_0x4e0cc4(0x1fa)]+_0x4e0cc4(0x152)+a109_0x46e9cb[_0x4e0cc4(0x22e)](_0x5a0f87,_0x4e0cc4(0x177))+'\x0a'),a109_0x46e9cb[_0x4e0cc4(0x17a)](_0x9a6d4d)&&(_0x5a3b8b+='---\x20schema:\x20'+_0x25f628['name']+'\x20---\x0a'+a109_0x46e9cb[_0x4e0cc4(0x22e)](_0x9a6d4d,_0x4e0cc4(0x177))+'\x0a');}}const _0x333532=generateDiff(_0x5a3b8b,_0x28dcfc);_0x56c5f8=hasChanges(_0x333532),_0x56c5f8&&(_0x366888=formatDiffWithColors(_0x333532));}_0x275813[_0x4e0cc4(0x1db)]({'path':_0x2a3de3,'content':'','isDir':!![]}),_0x275813['push']({'path':_0x22a738,'content':_0x1f47ea}),_0x275813[_0x4e0cc4(0x1db)]({'path':_0x94ffd7,'content':'','isDir':!![]});for(const _0x5c8c1b of _0x97fdc[_0x4e0cc4(0x191)]){const _0x2d2011=a109_0x51353b[_0x4e0cc4(0x151)](_0x94ffd7,sanitizeForFilesystem(_0x5c8c1b[_0x4e0cc4(0x1fa)])),_0x1f3c1e=a109_0x51353b[_0x4e0cc4(0x151)](_0x2d2011,'code.js'),_0x36d3e2=a109_0x51353b[_0x4e0cc4(0x151)](_0x2d2011,_0x4e0cc4(0x23f));_0x275813[_0x4e0cc4(0x1db)]({'path':_0x2d2011,'content':'','isDir':!![]}),_0x275813[_0x4e0cc4(0x1db)]({'path':_0x1f3c1e,'content':_0x5c8c1b['code']}),_0x275813[_0x4e0cc4(0x1db)]({'path':_0x36d3e2,'content':_0x5c8c1b[_0x4e0cc4(0x1f9)]});}if(a109_0x46e9cb[_0x4e0cc4(0x17a)](_0x94ffd7)){const _0x254a29=a109_0x46e9cb['readdirSync'](_0x94ffd7,{'withFileTypes':!![]}),_0x25e247=new Set(_0x97fdc[_0x4e0cc4(0x191)][_0x4e0cc4(0x217)](_0x5d74dd=>sanitizeForFilesystem(_0x5d74dd['name'])));for(const _0x2aa88d of _0x254a29){if(_0x2aa88d[_0x4e0cc4(0x1ed)]()&&!_0x25e247[_0x4e0cc4(0x201)](_0x2aa88d[_0x4e0cc4(0x1fa)])){const _0x4ec3fd=a109_0x51353b[_0x4e0cc4(0x151)](_0x94ffd7,_0x2aa88d[_0x4e0cc4(0x1fa)]);_0x1bb350[_0x4e0cc4(0x1db)]({'path':_0x4ec3fd,'isDir':!![]});}}}_0x4b4043[_0x4e0cc4(0x1d0)]['push']({'name':_0x51b608[_0x4e0cc4(0x20d)]['name'],'outputPath':_0x2a3de3,'isNew':_0xd66fcd,'hasChanges':_0x56c5f8,'diff':_0x366888}),_0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x1d0)][_0x4e0cc4(0x236)]++;if(_0xd66fcd)_0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x1d0)][_0x4e0cc4(0x232)]++;else{if(_0x56c5f8)_0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x1d0)][_0x4e0cc4(0x157)]++;else _0x4b4043[_0x4e0cc4(0x175)]['experimentalKnowledgeBases'][_0x4e0cc4(0x200)]++;}}for(const _0x1add5f of _0x3131c5){if(_0x1add5f['attributes']['isManaged'])continue;const _0x1428d5=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x27b854),_0x1add5f['attributes'][_0x4e0cc4(0x1fa)]);_0x1428d5[_0x4e0cc4(0x212)]&&this[_0x4e0cc4(0x214)][_0x4e0cc4(0x1dd)](_0x4e0cc4(0x17f)+a109_0x51353b[_0x4e0cc4(0x188)](_0x1428d5[_0x4e0cc4(0x187)])+'\x20→\x20'+a109_0x51353b[_0x4e0cc4(0x188)](_0x1428d5['path']));const _0x3cc572=_0x1428d5[_0x4e0cc4(0x20a)],_0x288353=a109_0x51353b[_0x4e0cc4(0x151)](_0x3cc572,sanitizeForFilesystem(_0x1add5f['attributes'][_0x4e0cc4(0x1fa)])+_0x4e0cc4(0x160)),_0x42cdb7=a109_0x51353b['join'](_0x3cc572,_0x4e0cc4(0x144)),_0x263c39=a109_0x51353b['join'](_0x3cc572,_0x4e0cc4(0x1fc)),_0x27be77=apiExperimentalArtifactToYaml(_0x1add5f),_0x2c6ff9=toExperimentalArtifactYamlString(_0x27be77),_0x29232d=!a109_0x46e9cb[_0x4e0cc4(0x17a)](_0x3cc572);let _0x4d7dd7=_0x29232d,_0x501c84,_0x36f9ab=_0x2c6ff9+(_0x4e0cc4(0x213)+_0x27be77[_0x4e0cc4(0x1b0)]+'\x0a');const _0xecc3e9=[..._0x27be77[_0x4e0cc4(0x1fc)]][_0x4e0cc4(0x190)]((_0x1ec44a,_0x318399)=>_0x1ec44a[_0x4e0cc4(0x163)]['localeCompare'](_0x318399['file_name']));for(const _0x4971b0 of _0xecc3e9){_0x36f9ab+=_0x4e0cc4(0x12c)+_0x4971b0[_0x4e0cc4(0x163)]+_0x4e0cc4(0x152)+_0x4971b0['text_content']+'\x0a';}if(!_0x29232d){let _0x162357='';a109_0x46e9cb[_0x4e0cc4(0x17a)](_0x288353)&&(_0x162357=a109_0x46e9cb[_0x4e0cc4(0x22e)](_0x288353,_0x4e0cc4(0x177)));a109_0x46e9cb['existsSync'](_0x42cdb7)&&(_0x162357+=_0x4e0cc4(0x213)+a109_0x46e9cb[_0x4e0cc4(0x22e)](_0x42cdb7,_0x4e0cc4(0x177))+'\x0a');if(a109_0x46e9cb['existsSync'](_0x263c39)){const _0x175ed8=a109_0x46e9cb[_0x4e0cc4(0x23c)](_0x263c39),_0xfe5c61=_0x175ed8[_0x4e0cc4(0x153)](_0x916fe9=>{const _0x98fb68=_0x4e0cc4,_0x383ddd=a109_0x51353b['join'](_0x263c39,_0x916fe9);return a109_0x46e9cb[_0x98fb68(0x156)](_0x383ddd)[_0x98fb68(0x18e)]();})['sort']((_0x44e967,_0x17b580)=>_0x44e967['localeCompare'](_0x17b580));for(const _0x5b42e2 of _0xfe5c61){const _0x15f044=a109_0x51353b[_0x4e0cc4(0x151)](_0x263c39,_0x5b42e2);_0x162357+=_0x4e0cc4(0x12c)+_0x5b42e2+_0x4e0cc4(0x152)+a109_0x46e9cb[_0x4e0cc4(0x22e)](_0x15f044,'utf-8')+'\x0a';}}const _0x4a82f8=generateDiff(_0x162357,_0x36f9ab);_0x4d7dd7=hasChanges(_0x4a82f8),_0x4d7dd7&&(_0x501c84=formatDiffWithColors(_0x4a82f8));}_0x275813['push']({'path':_0x3cc572,'content':'','isDir':!![]}),_0x275813['push']({'path':_0x288353,'content':_0x2c6ff9}),_0x275813[_0x4e0cc4(0x1db)]({'path':_0x42cdb7,'content':_0x27be77[_0x4e0cc4(0x1b0)]});if(_0x27be77['files'][_0x4e0cc4(0x154)]>0x0){_0x275813[_0x4e0cc4(0x1db)]({'path':_0x263c39,'content':'','isDir':!![]});for(const _0x482c0f of _0x27be77[_0x4e0cc4(0x1fc)]){const _0x3901c0=a109_0x51353b[_0x4e0cc4(0x151)](_0x263c39,_0x482c0f[_0x4e0cc4(0x163)]);_0x275813[_0x4e0cc4(0x1db)]({'path':_0x3901c0,'content':_0x482c0f[_0x4e0cc4(0x1cc)]});}}if(a109_0x46e9cb[_0x4e0cc4(0x17a)](_0x263c39)){const _0x4bc695=a109_0x46e9cb[_0x4e0cc4(0x23c)](_0x263c39),_0x96b60c=new Set(_0x27be77['files'][_0x4e0cc4(0x217)](_0x495cab=>_0x495cab['file_name']));for(const _0x10fbd8 of _0x4bc695){const _0x3fdceb=a109_0x51353b['join'](_0x263c39,_0x10fbd8);a109_0x46e9cb[_0x4e0cc4(0x156)](_0x3fdceb)[_0x4e0cc4(0x18e)]()&&!_0x96b60c[_0x4e0cc4(0x201)](_0x10fbd8)&&_0x1bb350['push']({'path':_0x3fdceb});}}_0x4b4043[_0x4e0cc4(0x22d)]['push']({'name':_0x1add5f['attributes'][_0x4e0cc4(0x1fa)],'outputPath':_0x3cc572,'isNew':_0x29232d,'hasChanges':_0x4d7dd7,'diff':_0x501c84}),_0x4b4043[_0x4e0cc4(0x175)]['experimentalArtifacts']['total']++;if(_0x29232d)_0x4b4043['counts'][_0x4e0cc4(0x22d)][_0x4e0cc4(0x232)]++;else{if(_0x4d7dd7)_0x4b4043['counts'][_0x4e0cc4(0x22d)][_0x4e0cc4(0x157)]++;else _0x4b4043[_0x4e0cc4(0x175)][_0x4e0cc4(0x22d)][_0x4e0cc4(0x200)]++;}}if(_0x28f4ad?.[_0x4e0cc4(0x1ec)])return _0x4b4043;a109_0x46e9cb[_0x4e0cc4(0x1d8)](_0x27b854,{'recursive':!![]}),a109_0x46e9cb[_0x4e0cc4(0x1d8)](getKnowledgeBasesDir(_0x27b854),{'recursive':!![]}),a109_0x46e9cb[_0x4e0cc4(0x1d8)](getPromptsDir(_0x27b854),{'recursive':!![]}),a109_0x46e9cb[_0x4e0cc4(0x1d8)](getIntegrationsDir(_0x27b854),{'recursive':!![]}),a109_0x46e9cb[_0x4e0cc4(0x1d8)](getExperimentalKnowledgeBasesDir(_0x27b854),{'recursive':!![]}),a109_0x46e9cb[_0x4e0cc4(0x1d8)](getExperimentalArtifactsDir(_0x27b854),{'recursive':!![]});const _0x43d2eb=a109_0x51353b[_0x4e0cc4(0x151)](_0x27b854,'tdx.json');a109_0x46e9cb['writeFileSync'](_0x43d2eb,createAgentConfigContent(_0x24493e));for(const _0x364592 of _0x275813){if(_0x364592[_0x4e0cc4(0x21a)])a109_0x46e9cb['mkdirSync'](_0x364592[_0x4e0cc4(0x20a)],{'recursive':!![]});else{const _0x26ce3c=a109_0x51353b[_0x4e0cc4(0x224)](_0x364592[_0x4e0cc4(0x20a)]);!a109_0x46e9cb[_0x4e0cc4(0x17a)](_0x26ce3c)&&a109_0x46e9cb[_0x4e0cc4(0x1d8)](_0x26ce3c,{'recursive':!![]}),a109_0x46e9cb[_0x4e0cc4(0x1b4)](_0x364592['path'],_0x364592[_0x4e0cc4(0x18f)]);}}for(const _0x4bda75 of _0x1bb350){_0x4bda75[_0x4e0cc4(0x21a)]?(a109_0x46e9cb[_0x4e0cc4(0x1d3)](_0x4bda75[_0x4e0cc4(0x20a)],{'recursive':!![],'force':!![]}),this[_0x4e0cc4(0x214)]['info'](_0x4e0cc4(0x1bb)+a109_0x51353b[_0x4e0cc4(0x188)](a109_0x51353b[_0x4e0cc4(0x224)](_0x4bda75[_0x4e0cc4(0x20a)]))+'/'+a109_0x51353b[_0x4e0cc4(0x188)](_0x4bda75[_0x4e0cc4(0x20a)]))):(a109_0x46e9cb[_0x4e0cc4(0x1d3)](_0x4bda75['path'],{'force':!![]}),this[_0x4e0cc4(0x214)][_0x4e0cc4(0x1dd)](_0x4e0cc4(0x1c8)+a109_0x51353b[_0x4e0cc4(0x188)](a109_0x51353b['dirname'](_0x4bda75[_0x4e0cc4(0x20a)]))+'/'+a109_0x51353b[_0x4e0cc4(0x188)](_0x4bda75['path'])));}return _0x4b4043;}async['pushProject'](_0x144528,_0x5642cc){const _0x3e93ab=a109_0x3e47fb,_0x11ea6c=a109_0x51353b[_0x3e93ab(0x151)](_0x144528,_0x3e93ab(0x1aa));if(!a109_0x46e9cb[_0x3e93ab(0x17a)](_0x11ea6c))throw new SDKError(ErrorCode[_0x3e93ab(0x148)],_0x3e93ab(0x21e)+_0x144528,undefined,{'helpText':_0x3e93ab(0x165)});const _0x8073c=loadAgentConfig(_0x11ea6c),_0x48616e=await this[_0x3e93ab(0x16c)](_0x8073c['llm_project']),_0x35c206=await this[_0x3e93ab(0x23d)][_0x3e93ab(0x1e9)](_0x48616e),_0x45209e=_0x35c206[_0x3e93ab(0x20d)][_0x3e93ab(0x1fa)],_0x812381={'projectName':_0x45209e,'projectId':_0x48616e,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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}}},_0x51f26b=[],_0x5dbf7e=[],_0x4b47dd=[],_0x5ee1f5=[],_0xaf7f80=[],_0x55667e=[],_0x35b1da=a109_0x46e9cb[_0x3e93ab(0x23c)](_0x144528,{'withFileTypes':!![]});for(const _0x49a95f of _0x35b1da){if(!_0x49a95f['isDirectory']())continue;if(['knowledge_bases',_0x3e93ab(0x164),'integrations',_0x3e93ab(0x140),_0x3e93ab(0x199)]['includes'](_0x49a95f[_0x3e93ab(0x1fa)]))continue;const _0x2f8c31=a109_0x51353b[_0x3e93ab(0x151)](_0x144528,_0x49a95f[_0x3e93ab(0x1fa)]);if(isAgentDir(_0x2f8c31)){const _0x191c8c=a109_0x51353b['join'](_0x2f8c31,_0x3e93ab(0x18c)),_0x17e9ef=a109_0x51353b[_0x3e93ab(0x151)](_0x2f8c31,_0x3e93ab(0x23e)),_0xd30548=a109_0x51353b[_0x3e93ab(0x151)](_0x2f8c31,'starter_message.md'),_0x54f68b=parseAgentYaml(a109_0x46e9cb[_0x3e93ab(0x22e)](_0x191c8c,'utf-8'),_0x191c8c),_0x364854=a109_0x46e9cb[_0x3e93ab(0x17a)](_0x17e9ef)?a109_0x46e9cb[_0x3e93ab(0x22e)](_0x17e9ef,_0x3e93ab(0x177)):'',_0x2aa17f=a109_0x46e9cb[_0x3e93ab(0x17a)](_0xd30548)?a109_0x46e9cb[_0x3e93ab(0x22e)](_0xd30548,_0x3e93ab(0x177)):_0x54f68b[_0x3e93ab(0x15b)];_0x51f26b[_0x3e93ab(0x1db)]({'name':_0x54f68b[_0x3e93ab(0x1fa)],'dir':_0x2f8c31,'yaml':_0x54f68b,'systemPrompt':_0x364854,'starterMessage':_0x2aa17f});}}const _0x5b7c44=getKnowledgeBasesDir(_0x144528);if(a109_0x46e9cb[_0x3e93ab(0x17a)](_0x5b7c44)){const _0xd0253b=a109_0x46e9cb['readdirSync'](_0x5b7c44);for(const _0x17df56 of _0xd0253b){const _0x417a94=a109_0x51353b[_0x3e93ab(0x151)](_0x5b7c44,_0x17df56);if(_0x17df56[_0x3e93ab(0x1d4)](_0x3e93ab(0x160))){const _0x1ab760=parseKnowledgeBaseYaml(a109_0x46e9cb['readFileSync'](_0x417a94,_0x3e93ab(0x177)),_0x417a94);_0x5dbf7e[_0x3e93ab(0x1db)]({'name':_0x1ab760[_0x3e93ab(0x1fa)],'path':_0x417a94,'yaml':_0x1ab760});}else{if(_0x17df56[_0x3e93ab(0x1d4)](_0x3e93ab(0x16e))){const _0x194fe0=a109_0x46e9cb[_0x3e93ab(0x22e)](_0x417a94,'utf-8'),{name:_0x38aac3,text:_0x1123ee}=parseTextKnowledgeBaseMd(_0x194fe0,_0x17df56);_0x4b47dd[_0x3e93ab(0x1db)]({'name':_0x38aac3,'path':_0x417a94,'text':_0x1123ee});}}}}const _0xaf5674=getPromptsDir(_0x144528);if(a109_0x46e9cb['existsSync'](_0xaf5674)){const _0x321ac4=a109_0x46e9cb[_0x3e93ab(0x23c)](_0xaf5674)[_0x3e93ab(0x153)](_0x379367=>_0x379367[_0x3e93ab(0x1d4)](_0x3e93ab(0x160)));for(const _0x507d1f of _0x321ac4){const _0x1334c4=a109_0x51353b['join'](_0xaf5674,_0x507d1f),_0x18da39=parsePromptYaml(a109_0x46e9cb[_0x3e93ab(0x22e)](_0x1334c4,_0x3e93ab(0x177)),_0x1334c4);_0x5ee1f5['push']({'name':_0x18da39[_0x3e93ab(0x1fa)],'path':_0x1334c4,'yaml':_0x18da39});}}const _0x81c0a3=[],_0x512ba2=getIntegrationsDir(_0x144528);if(a109_0x46e9cb[_0x3e93ab(0x17a)](_0x512ba2)){const _0x99bde4=a109_0x46e9cb[_0x3e93ab(0x23c)](_0x512ba2)[_0x3e93ab(0x153)](_0x38a37e=>_0x38a37e[_0x3e93ab(0x1d4)](_0x3e93ab(0x160)));for(const _0xe59441 of _0x99bde4){const _0x5b5027=a109_0x51353b['join'](_0x512ba2,_0xe59441),_0x288ed7=parseIntegrationYaml(a109_0x46e9cb[_0x3e93ab(0x22e)](_0x5b5027,_0x3e93ab(0x177)),_0x5b5027);if(!SAFE_INTEGRATION_TYPES[_0x3e93ab(0x20f)](_0x288ed7[_0x3e93ab(0x1ea)][_0x3e93ab(0x230)]())){this[_0x3e93ab(0x214)][_0x3e93ab(0x12f)](_0x3e93ab(0x1d2)+_0x288ed7[_0x3e93ab(0x1fa)]+_0x3e93ab(0x244)+_0x288ed7[_0x3e93ab(0x1ea)]+_0x3e93ab(0x20b)+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES['join'](',\x20')+_0x3e93ab(0x14e))+_0x3e93ab(0x1de));continue;}_0x81c0a3[_0x3e93ab(0x1db)]({'name':_0x288ed7[_0x3e93ab(0x1fa)],'path':_0x5b5027,'yaml':_0x288ed7});}}const _0x4d36be=getExperimentalKnowledgeBasesDir(_0x144528);if(a109_0x46e9cb[_0x3e93ab(0x17a)](_0x4d36be)){const _0x264e08=a109_0x46e9cb[_0x3e93ab(0x23c)](_0x4d36be,{'withFileTypes':!![]});for(const _0x4fcca6 of _0x264e08){if(!_0x4fcca6[_0x3e93ab(0x1ed)]())continue;const _0x272c31=a109_0x51353b['join'](_0x4d36be,_0x4fcca6[_0x3e93ab(0x1fa)]),_0x5e8e98=a109_0x51353b['join'](_0x272c31,_0x4fcca6[_0x3e93ab(0x1fa)]+_0x3e93ab(0x160)),_0x1029cc=a109_0x51353b[_0x3e93ab(0x151)](_0x272c31,_0x3e93ab(0x191));if(!a109_0x46e9cb[_0x3e93ab(0x17a)](_0x5e8e98))continue;const _0x58856d=parseExperimentalKnowledgeBaseYaml(a109_0x46e9cb['readFileSync'](_0x5e8e98,_0x3e93ab(0x177)),_0x5e8e98),_0x531550=[];if(a109_0x46e9cb['existsSync'](_0x1029cc)){const _0x48febb=a109_0x46e9cb[_0x3e93ab(0x23c)](_0x1029cc,{'withFileTypes':!![]});for(const _0x2a024c of _0x48febb){if(!_0x2a024c[_0x3e93ab(0x1ed)]())continue;const _0x1e1141=a109_0x51353b['join'](_0x1029cc,_0x2a024c[_0x3e93ab(0x1fa)]),_0xfd143f=a109_0x51353b[_0x3e93ab(0x151)](_0x1e1141,_0x3e93ab(0x144)),_0x9979c9=a109_0x51353b[_0x3e93ab(0x151)](_0x1e1141,'json_schema.json');a109_0x46e9cb['existsSync'](_0xfd143f)&&a109_0x46e9cb[_0x3e93ab(0x17a)](_0x9979c9)&&_0x531550[_0x3e93ab(0x1db)]({'name':_0x2a024c['name'],'code':a109_0x46e9cb[_0x3e93ab(0x22e)](_0xfd143f,_0x3e93ab(0x177)),'json_schema':a109_0x46e9cb[_0x3e93ab(0x22e)](_0x9979c9,_0x3e93ab(0x177))});}}const _0x2cb305={..._0x58856d,'variables':_0x58856d[_0x3e93ab(0x14c)]||[],'functions':_0x531550};_0xaf7f80['push']({'name':_0x58856d[_0x3e93ab(0x1fa)],'dir':_0x272c31,'def':_0x2cb305});}}const _0x58c1ee=getExperimentalArtifactsDir(_0x144528);if(a109_0x46e9cb['existsSync'](_0x58c1ee)){const _0xc25182=a109_0x46e9cb[_0x3e93ab(0x23c)](_0x58c1ee,{'withFileTypes':!![]});for(const _0x226956 of _0xc25182){if(!_0x226956[_0x3e93ab(0x1ed)]())continue;const _0x3ebcd4=a109_0x51353b['join'](_0x58c1ee,_0x226956['name']),_0x101c06=a109_0x51353b[_0x3e93ab(0x151)](_0x3ebcd4,_0x226956[_0x3e93ab(0x1fa)]+_0x3e93ab(0x160)),_0x4e1272=a109_0x51353b[_0x3e93ab(0x151)](_0x3ebcd4,'code.js'),_0x3c40f9=a109_0x51353b[_0x3e93ab(0x151)](_0x3ebcd4,'files');if(!a109_0x46e9cb[_0x3e93ab(0x17a)](_0x101c06)||!a109_0x46e9cb[_0x3e93ab(0x17a)](_0x4e1272))continue;const _0x308aee=parseExperimentalArtifactYaml(a109_0x46e9cb[_0x3e93ab(0x22e)](_0x101c06,'utf-8'),_0x101c06),_0x1c2988=a109_0x46e9cb['readFileSync'](_0x4e1272,'utf-8'),_0x513318=[];if(a109_0x46e9cb[_0x3e93ab(0x17a)](_0x3c40f9)){const _0x4e1205=a109_0x46e9cb[_0x3e93ab(0x23c)](_0x3c40f9);for(const _0x27e55f of _0x4e1205){const _0xc71a1b=a109_0x51353b[_0x3e93ab(0x151)](_0x3c40f9,_0x27e55f);a109_0x46e9cb['statSync'](_0xc71a1b)[_0x3e93ab(0x18e)]()&&_0x513318[_0x3e93ab(0x1db)]({'file_name':_0x27e55f,'text_content':a109_0x46e9cb[_0x3e93ab(0x22e)](_0xc71a1b,_0x3e93ab(0x177))});}}const _0x9116c8={..._0x308aee,'code':_0x1c2988,'files':_0x513318};_0x55667e[_0x3e93ab(0x1db)]({'name':_0x308aee[_0x3e93ab(0x1fa)],'dir':_0x3ebcd4,'def':_0x9116c8});}}const _0x1e1d72=await this[_0x3e93ab(0x23d)][_0x3e93ab(0x12d)](_0x48616e),_0x5b12e4=await this[_0x3e93ab(0x23d)][_0x3e93ab(0x211)](_0x48616e),_0x302624=await this['client'][_0x3e93ab(0x18b)](_0x48616e),_0x1f959f=await this[_0x3e93ab(0x23d)][_0x3e93ab(0x134)](_0x48616e),_0x3faeef=await this[_0x3e93ab(0x23d)][_0x3e93ab(0x13d)](_0x48616e),_0x40f85a=await safeListOrEmpty(()=>this[_0x3e93ab(0x23d)][_0x3e93ab(0x196)](_0x48616e)),_0x53f8de=await safeListOrEmpty(()=>this[_0x3e93ab(0x23d)][_0x3e93ab(0x14d)](_0x48616e)),_0xa9ee08=await fetchAllToolTargetMaps((_0x30cb06,_0x206dd9)=>this['client'][_0x3e93ab(0x1b5)](_0x30cb06,_0x206dd9),_0x48616e),_0x8d4bd=new Map(),_0x2b2976=new Map(),_0x57484b=new Map(),_0x5a8fcc=new Map(),_0x382bb5=new Map(),_0x335a32=new Map(),_0x2626a3=new Map();for(const _0x4a3f53 of _0x1e1d72){_0x8d4bd[_0x3e93ab(0x137)](_0x4a3f53['attributes'][_0x3e93ab(0x1fa)],_0x4a3f53);}for(const _0x2a18f9 of _0x5b12e4){_0x2b2976[_0x3e93ab(0x137)](_0x2a18f9[_0x3e93ab(0x20d)][_0x3e93ab(0x1fa)],_0x2a18f9);}for(const _0x5ebff4 of _0x302624){_0x57484b[_0x3e93ab(0x137)](_0x5ebff4[_0x3e93ab(0x20d)]['name'],_0x5ebff4);}for(const _0x3f6473 of _0x1f959f){_0x5a8fcc[_0x3e93ab(0x137)](_0x3f6473[_0x3e93ab(0x20d)][_0x3e93ab(0x1fa)],_0x3f6473);}for(const _0x2961e1 of _0x3faeef){_0x382bb5[_0x3e93ab(0x137)](_0x2961e1[_0x3e93ab(0x20d)][_0x3e93ab(0x228)]['toLowerCase'](),_0x2961e1);}for(const _0x111e2b of _0x40f85a){_0x335a32['set'](_0x111e2b['attributes'][_0x3e93ab(0x1fa)],_0x111e2b);}for(const _0xa2515e of _0x53f8de){_0x2626a3[_0x3e93ab(0x137)](_0xa2515e[_0x3e93ab(0x20d)][_0x3e93ab(0x1fa)],_0xa2515e);}const _0x55bdf7=new Map(),_0x41d9a4=new Map();for(const _0x169eab of _0x1e1d72){_0x55bdf7['set'](_0x169eab[_0x3e93ab(0x20d)]['name'],_0x169eab['id']),_0x41d9a4[_0x3e93ab(0x137)](_0x169eab['id'],_0x169eab[_0x3e93ab(0x20d)][_0x3e93ab(0x1fa)]);}const _0x554ad4=new Map(),_0x427353=new Map();for(const _0x578efa of _0x1f959f){_0x554ad4['set'](_0x578efa[_0x3e93ab(0x20d)][_0x3e93ab(0x1fa)],_0x578efa['id']),_0x427353[_0x3e93ab(0x137)](_0x578efa['id'],_0x578efa[_0x3e93ab(0x20d)]['name']);}const _0x5937db=_0xa9ee08[_0x3e93ab(0x1f5)]['KnowledgeBase']||new Map(),_0x1e3257=_0xa9ee08[_0x3e93ab(0x1f5)][_0x3e93ab(0x1b2)]||new Map(),_0x5d092d=_0xa9ee08[_0x3e93ab(0x1f5)]['ExperimentalKnowledgeBase']||new Map(),_0x9521b8=new Map(),_0x46c390={'resolveToolTargetName':buildNameResolver({..._0xa9ee08['idToName'],'Agent':_0x41d9a4}),'resolvePromptName':async _0xdc01b1=>_0x427353[_0x3e93ab(0x1dc)](_0xdc01b1),'onWarning':_0x9fdfd7=>this[_0x3e93ab(0x214)][_0x3e93ab(0x12f)](_0x9fdfd7)};let _0xfb8976=[];const _0xdb4f70={'projectId':_0x48616e,'resolveToolTargetId':buildIdResolver({..._0xa9ee08['nameToId'],'Agent':_0x55bdf7}),'resolvePromptId':async _0x33ac8b=>_0x554ad4[_0x3e93ab(0x1dc)](_0x33ac8b),'onWarning':_0x534e10=>{const _0x555a5c=_0x3e93ab;this['logger'][_0x555a5c(0x12f)](_0x534e10),_0xfb8976[_0x555a5c(0x1db)](_0x534e10);}},{resolved:_0x1e70e4,unresolved:_0x39ad2d}=resolveAgentDependencies(_0x51f26b,new Set(_0x8d4bd[_0x3e93ab(0x1f3)]()));for(const {agent:_0x31ed0c,missingDeps:_0x1a3e0a}of _0x39ad2d){_0x812381[_0x3e93ab(0x1b1)][_0x3e93ab(0x1db)]({'agentName':_0x31ed0c[_0x3e93ab(0x12b)][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x185),'error':_0x3e93ab(0x1c1)+_0x1a3e0a[_0x3e93ab(0x151)](',\x20')+_0x3e93ab(0x172)}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x1b1)]['errors']++;}for(const _0x118ee8 of _0x5dbf7e){const _0x84585f=_0x2b2976['get'](_0x118ee8['yaml']['name']),_0x3157e0=a109_0x46e9cb['readFileSync'](_0x118ee8[_0x3e93ab(0x20a)],_0x3e93ab(0x177));if(_0x84585f){const _0x53fe43=apiKnowledgeBaseToYaml(_0x84585f),_0x253469=toKnowledgeBaseYamlString(_0x53fe43),_0x23a4f5=generateDiff(_0x253469,_0x3157e0),_0x49d50c=hasChanges(_0x23a4f5);_0x49d50c?(_0x812381['knowledgeBases']['push']({'name':_0x118ee8[_0x3e93ab(0x12b)][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x157),'id':_0x84585f['id'],'diff':formatDiffWithColors(_0x23a4f5)}),_0x812381[_0x3e93ab(0x175)]['knowledgeBases']['updated']++):(_0x812381[_0x3e93ab(0x238)][_0x3e93ab(0x1db)]({'name':_0x118ee8[_0x3e93ab(0x12b)][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x200),'id':_0x84585f['id']}),_0x812381['counts']['knowledgeBases']['unchanged']++);}else _0x812381[_0x3e93ab(0x238)][_0x3e93ab(0x1db)]({'name':_0x118ee8[_0x3e93ab(0x12b)][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x159)}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x238)][_0x3e93ab(0x159)]++;}for(const _0x546a75 of _0x4b47dd){const _0x21486c=_0x57484b[_0x3e93ab(0x1dc)](_0x546a75[_0x3e93ab(0x1fa)]),_0x136075=a109_0x46e9cb[_0x3e93ab(0x22e)](_0x546a75[_0x3e93ab(0x20a)],_0x3e93ab(0x177));if(_0x21486c){const _0xfe6bca=toTextKnowledgeBaseMd(_0x21486c[_0x3e93ab(0x20d)]['name'],_0x21486c[_0x3e93ab(0x20d)][_0x3e93ab(0x14f)]),_0x427ce5=generateDiff(_0xfe6bca,_0x136075),_0x4c4a32=hasChanges(_0x427ce5);_0x4c4a32?(_0x812381[_0x3e93ab(0x189)][_0x3e93ab(0x1db)]({'name':_0x546a75[_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x157),'id':_0x21486c['id'],'diff':formatDiffWithColors(_0x427ce5)}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x189)]['updated']++):(_0x812381[_0x3e93ab(0x189)]['push']({'name':_0x546a75[_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x200),'id':_0x21486c['id']}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x189)][_0x3e93ab(0x200)]++);}else _0x812381[_0x3e93ab(0x189)]['push']({'name':_0x546a75[_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x159)}),_0x812381[_0x3e93ab(0x175)]['textKnowledgeBases'][_0x3e93ab(0x159)]++;}for(const _0x4db54e of _0x1e70e4){const _0x4fa6bc=_0x8d4bd['get'](_0x4db54e[_0x3e93ab(0x12b)][_0x3e93ab(0x1fa)]),_0x305235=a109_0x51353b['join'](_0x4db54e[_0x3e93ab(0x216)],_0x3e93ab(0x18c)),_0x2837d7=a109_0x46e9cb[_0x3e93ab(0x22e)](_0x305235,'utf-8'),_0x524df9=_0x4db54e[_0x3e93ab(0x1f6)],_0x51a22f=_0x3e93ab(0x197)+_0x524df9+_0x3e93ab(0x145)+_0x2837d7;if(_0x4fa6bc){const {yaml:_0x35d421,systemPrompt:_0x5ec335}=await agentResponseToDef(_0x4fa6bc,_0x46c390),_0x11733e=toAgentYamlString(_0x35d421),_0x8c9c49=_0x3e93ab(0x197)+_0x5ec335+'\x0a\x0a#\x20agent.yml\x0a'+_0x11733e,_0x2ec29f=generateDiff(_0x8c9c49,_0x51a22f),_0x44484e=hasChanges(_0x2ec29f);_0x44484e?(_0x812381[_0x3e93ab(0x1b1)][_0x3e93ab(0x1db)]({'agentName':_0x4db54e['yaml'][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x157),'agentId':_0x4fa6bc['id'],'diff':formatDiffWithColors(_0x2ec29f)}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x1b1)]['updated']++):(_0x812381[_0x3e93ab(0x1b1)][_0x3e93ab(0x1db)]({'agentName':_0x4db54e[_0x3e93ab(0x12b)][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x200),'agentId':_0x4fa6bc['id']}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x1b1)][_0x3e93ab(0x200)]++);}else _0x812381[_0x3e93ab(0x1b1)]['push']({'agentName':_0x4db54e['yaml'][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x159)}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x1b1)][_0x3e93ab(0x159)]++;}for(const _0xf6953 of _0x5ee1f5){const _0x58aaf1=_0x5a8fcc[_0x3e93ab(0x1dc)](_0xf6953['yaml'][_0x3e93ab(0x1fa)]),_0x4681b1=a109_0x46e9cb[_0x3e93ab(0x22e)](_0xf6953['path'],_0x3e93ab(0x177));if(_0x58aaf1){const _0x55fbc3=await apiPromptToYaml(_0x58aaf1,_0x46c390);if(!_0x55fbc3){_0x812381['prompts']['push']({'name':_0xf6953[_0x3e93ab(0x12b)][_0x3e93ab(0x1fa)],'action':'updated','id':_0x58aaf1['id']}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x164)][_0x3e93ab(0x157)]++;continue;}const _0x2d22cb=toPromptYamlString(_0x55fbc3),_0x547603=generateDiff(_0x2d22cb,_0x4681b1),_0x210cb7=hasChanges(_0x547603);_0x210cb7?(_0x812381[_0x3e93ab(0x164)][_0x3e93ab(0x1db)]({'name':_0xf6953[_0x3e93ab(0x12b)]['name'],'action':_0x3e93ab(0x157),'id':_0x58aaf1['id'],'diff':formatDiffWithColors(_0x547603)}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x164)][_0x3e93ab(0x157)]++):(_0x812381[_0x3e93ab(0x164)][_0x3e93ab(0x1db)]({'name':_0xf6953[_0x3e93ab(0x12b)]['name'],'action':'unchanged','id':_0x58aaf1['id']}),_0x812381['counts'][_0x3e93ab(0x164)][_0x3e93ab(0x200)]++);}else _0x812381['prompts'][_0x3e93ab(0x1db)]({'name':_0xf6953[_0x3e93ab(0x12b)][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x159)}),_0x812381[_0x3e93ab(0x175)]['prompts'][_0x3e93ab(0x159)]++;}for(const _0x4b1f05 of _0x81c0a3){const _0x2118de=_0x382bb5[_0x3e93ab(0x1dc)](_0x4b1f05[_0x3e93ab(0x12b)][_0x3e93ab(0x1ea)]),_0x56a801=a109_0x46e9cb[_0x3e93ab(0x22e)](_0x4b1f05[_0x3e93ab(0x20a)],_0x3e93ab(0x177));if(_0x2118de){const _0x1e3508=await apiIntegrationToYaml(_0x2118de,_0x46c390),_0x56143e=toIntegrationYamlString(_0x1e3508),_0x3649b3=generateDiff(_0x56143e,_0x56a801),_0x1c978d=hasChanges(_0x3649b3);_0x1c978d?(_0x812381[_0x3e93ab(0x1c6)][_0x3e93ab(0x1db)]({'name':_0x4b1f05[_0x3e93ab(0x12b)]['service_type'],'action':_0x3e93ab(0x157),'id':_0x2118de['id'],'diff':formatDiffWithColors(_0x3649b3)}),_0x812381['counts'][_0x3e93ab(0x1c6)]['updated']++):(_0x812381['integrations'][_0x3e93ab(0x1db)]({'name':_0x4b1f05[_0x3e93ab(0x12b)][_0x3e93ab(0x1ea)],'action':'unchanged','id':_0x2118de['id']}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x1c6)][_0x3e93ab(0x200)]++);}else _0x812381['integrations'][_0x3e93ab(0x1db)]({'name':_0x4b1f05['yaml'][_0x3e93ab(0x1ea)],'action':'created'}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x1c6)][_0x3e93ab(0x159)]++;}for(const _0x4c286a of _0xaf7f80){const _0x1ff680=_0x335a32[_0x3e93ab(0x1dc)](_0x4c286a['def'][_0x3e93ab(0x1fa)]),_0x2e6b5a=toExperimentalKnowledgeBaseYamlString(_0x4c286a[_0x3e93ab(0x142)]);let _0x11a7aa=_0x2e6b5a;for(const _0x18db6b of _0x4c286a[_0x3e93ab(0x142)][_0x3e93ab(0x191)]){_0x11a7aa+=_0x3e93ab(0x1a0)+_0x18db6b['name']+'\x20---\x0a'+_0x18db6b[_0x3e93ab(0x1b0)]+_0x3e93ab(0x231)+_0x18db6b[_0x3e93ab(0x1fa)]+_0x3e93ab(0x152)+_0x18db6b[_0x3e93ab(0x1f9)]+'\x0a';}if(_0x1ff680){const _0x4df318=apiExperimentalKnowledgeBaseToYaml(_0x1ff680),_0x5308c9=toExperimentalKnowledgeBaseYamlString(_0x4df318);let _0xbccb7d=_0x5308c9;for(const _0x5b4956 of _0x4df318[_0x3e93ab(0x191)]){_0xbccb7d+=_0x3e93ab(0x1a0)+_0x5b4956[_0x3e93ab(0x1fa)]+'\x20---\x0a'+_0x5b4956[_0x3e93ab(0x1b0)]+_0x3e93ab(0x231)+_0x5b4956[_0x3e93ab(0x1fa)]+'\x20---\x0a'+_0x5b4956['json_schema']+'\x0a';}const _0x14168c=generateDiff(_0xbccb7d,_0x11a7aa),_0x37e86c=hasChanges(_0x14168c);_0x37e86c?(_0x812381['experimentalKnowledgeBases'][_0x3e93ab(0x1db)]({'name':_0x4c286a[_0x3e93ab(0x142)][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x157),'id':_0x1ff680['id'],'diff':formatDiffWithColors(_0x14168c)}),_0x812381[_0x3e93ab(0x175)]['experimentalKnowledgeBases'][_0x3e93ab(0x157)]++):(_0x812381[_0x3e93ab(0x1d0)]['push']({'name':_0x4c286a[_0x3e93ab(0x142)]['name'],'action':_0x3e93ab(0x200),'id':_0x1ff680['id']}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x1d0)][_0x3e93ab(0x200)]++);}else _0x812381[_0x3e93ab(0x1d0)][_0x3e93ab(0x1db)]({'name':_0x4c286a['def'][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x159)}),_0x812381['counts'][_0x3e93ab(0x1d0)][_0x3e93ab(0x159)]++;}for(const _0x46c2d6 of _0x55667e){const _0x2ffc9d=_0x2626a3[_0x3e93ab(0x1dc)](_0x46c2d6['def'][_0x3e93ab(0x1fa)]),_0x1ba0c3=toExperimentalArtifactYamlString(_0x46c2d6[_0x3e93ab(0x142)]);let _0x1107d1=_0x1ba0c3+(_0x3e93ab(0x213)+_0x46c2d6[_0x3e93ab(0x142)][_0x3e93ab(0x1b0)]+'\x0a');for(const _0x266b7e of _0x46c2d6['def']['files']){_0x1107d1+=_0x3e93ab(0x12c)+_0x266b7e[_0x3e93ab(0x163)]+_0x3e93ab(0x152)+_0x266b7e[_0x3e93ab(0x1cc)]+'\x0a';}if(_0x2ffc9d){const _0x14683a=apiExperimentalArtifactToYaml(_0x2ffc9d),_0x4e6419=toExperimentalArtifactYamlString(_0x14683a);let _0x29328c=_0x4e6419+(_0x3e93ab(0x213)+_0x14683a[_0x3e93ab(0x1b0)]+'\x0a');for(const _0x59605c of _0x14683a['files']){_0x29328c+=_0x3e93ab(0x12c)+_0x59605c[_0x3e93ab(0x163)]+_0x3e93ab(0x152)+_0x59605c['text_content']+'\x0a';}const _0x9732ec=generateDiff(_0x29328c,_0x1107d1),_0x5c3c86=hasChanges(_0x9732ec);_0x5c3c86?(_0x812381['experimentalArtifacts'][_0x3e93ab(0x1db)]({'name':_0x46c2d6[_0x3e93ab(0x142)][_0x3e93ab(0x1fa)],'action':'updated','id':_0x2ffc9d['id'],'diff':formatDiffWithColors(_0x9732ec)}),_0x812381['counts'][_0x3e93ab(0x22d)][_0x3e93ab(0x157)]++):(_0x812381['experimentalArtifacts'][_0x3e93ab(0x1db)]({'name':_0x46c2d6[_0x3e93ab(0x142)][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x200),'id':_0x2ffc9d['id']}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x22d)][_0x3e93ab(0x200)]++);}else _0x812381[_0x3e93ab(0x22d)][_0x3e93ab(0x1db)]({'name':_0x46c2d6[_0x3e93ab(0x142)][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x159)}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x22d)][_0x3e93ab(0x159)]++;}if(_0x5642cc?.[_0x3e93ab(0x1ec)])return _0x812381;_0x812381[_0x3e93ab(0x238)]=[],_0x812381[_0x3e93ab(0x189)]=[],_0x812381[_0x3e93ab(0x164)]=[],_0x812381['integrations']=[],_0x812381[_0x3e93ab(0x1d0)]=[],_0x812381[_0x3e93ab(0x22d)]=[];const _0x183f69=_0x812381['agents']['filter'](_0x384dab=>_0x384dab[_0x3e93ab(0x19a)]==='error');_0x812381[_0x3e93ab(0x1b1)]=_0x183f69,_0x812381['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x183f69[_0x3e93ab(0x154)]},'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}};for(const _0x122703 of _0x5dbf7e){try{const _0x7a805f=_0x2b2976['get'](_0x122703[_0x3e93ab(0x12b)][_0x3e93ab(0x1fa)]),_0x1f5a85=yamlKnowledgeBaseToApi(_0x122703[_0x3e93ab(0x12b)],_0x48616e);if(_0x7a805f)await this[_0x3e93ab(0x23d)]['updateKnowledgeBase'](_0x7a805f['id'],_0x1f5a85),_0x5937db[_0x3e93ab(0x137)](_0x122703['yaml'][_0x3e93ab(0x1fa)],_0x7a805f['id']),_0x812381[_0x3e93ab(0x238)]['push']({'name':_0x122703[_0x3e93ab(0x12b)]['name'],'action':_0x3e93ab(0x157),'id':_0x7a805f['id']}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x238)]['updated']++;else{const _0x241653=await this[_0x3e93ab(0x23d)][_0x3e93ab(0x1c0)](_0x1f5a85);_0x5937db[_0x3e93ab(0x137)](_0x122703[_0x3e93ab(0x12b)][_0x3e93ab(0x1fa)],_0x241653['id']),_0x812381['knowledgeBases'][_0x3e93ab(0x1db)]({'name':_0x122703[_0x3e93ab(0x12b)]['name'],'action':_0x3e93ab(0x159),'id':_0x241653['id']}),_0x812381['counts']['knowledgeBases'][_0x3e93ab(0x159)]++;}}catch(_0x4644d6){_0x812381[_0x3e93ab(0x238)]['push']({'name':_0x122703[_0x3e93ab(0x12b)][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x185),'error':_0x4644d6['message']}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x238)][_0x3e93ab(0x1f2)]++;}}for(const _0x49cfcd of _0x4b47dd){try{const _0x17ab7b=_0x57484b[_0x3e93ab(0x1dc)](_0x49cfcd[_0x3e93ab(0x1fa)]),_0x51197c=yamlTextKnowledgeBaseToApi({'name':_0x49cfcd[_0x3e93ab(0x1fa)],'text':_0x49cfcd['text']},_0x48616e);if(_0x17ab7b)await this[_0x3e93ab(0x23d)][_0x3e93ab(0x1c4)](_0x17ab7b['id'],_0x51197c),_0x1e3257[_0x3e93ab(0x137)](_0x49cfcd['name'],_0x17ab7b['id']),_0x812381[_0x3e93ab(0x189)][_0x3e93ab(0x1db)]({'name':_0x49cfcd[_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x157),'id':_0x17ab7b['id']}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x189)]['updated']++;else{const _0x489c1c=await this[_0x3e93ab(0x23d)]['createTextKnowledgeBase'](_0x51197c);_0x1e3257[_0x3e93ab(0x137)](_0x49cfcd[_0x3e93ab(0x1fa)],_0x489c1c['id']),_0x812381[_0x3e93ab(0x189)]['push']({'name':_0x49cfcd[_0x3e93ab(0x1fa)],'action':'created','id':_0x489c1c['id']}),_0x812381['counts'][_0x3e93ab(0x189)][_0x3e93ab(0x159)]++;}}catch(_0x4d3c3a){_0x812381[_0x3e93ab(0x189)]['push']({'name':_0x49cfcd[_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x185),'error':_0x4d3c3a[_0x3e93ab(0x1ce)]}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x189)][_0x3e93ab(0x1f2)]++;}}for(const _0x30ee4d of _0xaf7f80){try{const _0x3a1516=_0x335a32[_0x3e93ab(0x1dc)](_0x30ee4d['def'][_0x3e93ab(0x1fa)]),_0x5867cb=yamlExperimentalKnowledgeBaseToApi(_0x30ee4d[_0x3e93ab(0x142)],_0x48616e);if(_0x3a1516)await this['client']['updateExperimentalKnowledgeBase'](_0x3a1516['id'],_0x5867cb),_0x5d092d[_0x3e93ab(0x137)](_0x30ee4d[_0x3e93ab(0x142)][_0x3e93ab(0x1fa)],_0x3a1516['id']),_0x812381[_0x3e93ab(0x1d0)]['push']({'name':_0x30ee4d[_0x3e93ab(0x142)][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x157),'id':_0x3a1516['id']}),_0x812381['counts'][_0x3e93ab(0x1d0)][_0x3e93ab(0x157)]++;else{const _0xd34aae=await this[_0x3e93ab(0x23d)][_0x3e93ab(0x1ff)](_0x5867cb);_0x5d092d[_0x3e93ab(0x137)](_0x30ee4d[_0x3e93ab(0x142)]['name'],_0xd34aae['id']),_0x812381[_0x3e93ab(0x1d0)][_0x3e93ab(0x1db)]({'name':_0x30ee4d['def'][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x159),'id':_0xd34aae['id']}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x1d0)][_0x3e93ab(0x159)]++;}}catch(_0xc7fd98){_0x812381[_0x3e93ab(0x1d0)][_0x3e93ab(0x1db)]({'name':_0x30ee4d[_0x3e93ab(0x142)]['name'],'action':_0x3e93ab(0x185),'error':_0xc7fd98[_0x3e93ab(0x1ce)]}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x1d0)][_0x3e93ab(0x1f2)]++;}}for(const _0xd7d266 of _0x55667e){try{const _0x16f65e=_0x2626a3[_0x3e93ab(0x1dc)](_0xd7d266[_0x3e93ab(0x142)][_0x3e93ab(0x1fa)]),_0x40da13=yamlExperimentalArtifactToApi(_0xd7d266[_0x3e93ab(0x142)],_0x48616e);if(_0x16f65e)await this[_0x3e93ab(0x23d)][_0x3e93ab(0x176)](_0x16f65e['id'],_0x40da13),_0x9521b8['set'](_0xd7d266[_0x3e93ab(0x142)][_0x3e93ab(0x1fa)],_0x16f65e['id']),_0x812381[_0x3e93ab(0x22d)][_0x3e93ab(0x1db)]({'name':_0xd7d266['def']['name'],'action':_0x3e93ab(0x157),'id':_0x16f65e['id']}),_0x812381['counts'][_0x3e93ab(0x22d)][_0x3e93ab(0x157)]++;else{const _0x2d0049=await this[_0x3e93ab(0x23d)][_0x3e93ab(0x1e6)](_0x40da13);_0x9521b8[_0x3e93ab(0x137)](_0xd7d266[_0x3e93ab(0x142)][_0x3e93ab(0x1fa)],_0x2d0049['id']),_0x812381[_0x3e93ab(0x22d)][_0x3e93ab(0x1db)]({'name':_0xd7d266['def'][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x159),'id':_0x2d0049['id']}),_0x812381[_0x3e93ab(0x175)]['experimentalArtifacts']['created']++;}}catch(_0x3de71f){_0x812381[_0x3e93ab(0x22d)][_0x3e93ab(0x1db)]({'name':_0xd7d266[_0x3e93ab(0x142)]['name'],'action':_0x3e93ab(0x185),'error':_0x3de71f['message']}),_0x812381[_0x3e93ab(0x175)]['experimentalArtifacts'][_0x3e93ab(0x1f2)]++;}}for(const _0x5d4887 of _0x1e70e4){_0xfb8976=[];try{const _0x588841=_0x8d4bd[_0x3e93ab(0x1dc)](_0x5d4887[_0x3e93ab(0x12b)]['name']),_0x4472af=await agentDefToRequest(_0x5d4887[_0x3e93ab(0x12b)],_0x5d4887['systemPrompt'],_0x5d4887['starterMessage'],_0xdb4f70);if(_0x588841)await this[_0x3e93ab(0x23d)]['updateAgentResponse'](_0x588841['id'],_0x4472af),_0x55bdf7[_0x3e93ab(0x137)](_0x5d4887['yaml'][_0x3e93ab(0x1fa)],_0x588841['id']),_0x812381['agents'][_0x3e93ab(0x1db)]({'agentName':_0x5d4887[_0x3e93ab(0x12b)][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x157),'agentId':_0x588841['id'],'warnings':_0xfb8976[_0x3e93ab(0x154)]>0x0?_0xfb8976:undefined}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x1b1)]['updated']++;else{const _0x2edf80=await this[_0x3e93ab(0x23d)][_0x3e93ab(0x127)](_0x4472af);_0x55bdf7['set'](_0x5d4887['yaml']['name'],_0x2edf80['id']),_0x812381[_0x3e93ab(0x1b1)]['push']({'agentName':_0x5d4887[_0x3e93ab(0x12b)]['name'],'action':_0x3e93ab(0x159),'agentId':_0x2edf80['id'],'warnings':_0xfb8976[_0x3e93ab(0x154)]>0x0?_0xfb8976:undefined}),_0x812381[_0x3e93ab(0x175)]['agents'][_0x3e93ab(0x159)]++;}}catch(_0xfc6b21){_0x812381[_0x3e93ab(0x1b1)][_0x3e93ab(0x1db)]({'agentName':_0x5d4887[_0x3e93ab(0x12b)][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x185),'error':_0xfc6b21[_0x3e93ab(0x1ce)],'warnings':_0xfb8976[_0x3e93ab(0x154)]>0x0?_0xfb8976:undefined}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x1b1)][_0x3e93ab(0x1f2)]++;}}for(const _0x4dcbd0 of _0x5ee1f5){try{const _0x22cc4d=_0x5a8fcc[_0x3e93ab(0x1dc)](_0x4dcbd0['yaml'][_0x3e93ab(0x1fa)]),_0x207bfa=await yamlPromptToApi(_0x4dcbd0[_0x3e93ab(0x12b)],_0x48616e,_0xdb4f70);if(!_0x207bfa){_0x812381[_0x3e93ab(0x164)][_0x3e93ab(0x1db)]({'name':_0x4dcbd0['yaml'][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x185),'error':_0x3e93ab(0x13e)}),_0x812381[_0x3e93ab(0x175)]['prompts'][_0x3e93ab(0x1f2)]++;continue;}if(_0x22cc4d)await this[_0x3e93ab(0x23d)][_0x3e93ab(0x1d5)](_0x22cc4d['id'],_0x207bfa),_0x554ad4[_0x3e93ab(0x137)](_0x4dcbd0[_0x3e93ab(0x12b)]['name'],_0x22cc4d['id']),_0x812381['prompts'][_0x3e93ab(0x1db)]({'name':_0x4dcbd0[_0x3e93ab(0x12b)][_0x3e93ab(0x1fa)],'action':_0x3e93ab(0x157),'id':_0x22cc4d['id']}),_0x812381[_0x3e93ab(0x175)]['prompts'][_0x3e93ab(0x157)]++;else{const _0x365c07=await this['client'][_0x3e93ab(0x173)](_0x207bfa);_0x554ad4[_0x3e93ab(0x137)](_0x4dcbd0[_0x3e93ab(0x12b)][_0x3e93ab(0x1fa)],_0x365c07['id']),_0x812381[_0x3e93ab(0x164)][_0x3e93ab(0x1db)]({'name':_0x4dcbd0[_0x3e93ab(0x12b)]['name'],'action':_0x3e93ab(0x159),'id':_0x365c07['id']}),_0x812381['counts'][_0x3e93ab(0x164)][_0x3e93ab(0x159)]++;}}catch(_0x1712af){_0x812381[_0x3e93ab(0x164)]['push']({'name':_0x4dcbd0[_0x3e93ab(0x12b)]['name'],'action':_0x3e93ab(0x185),'error':_0x1712af[_0x3e93ab(0x1ce)]}),_0x812381[_0x3e93ab(0x175)]['prompts']['errors']++;}}for(const _0x2c5ab3 of _0x81c0a3){try{const _0x7fe36f=_0x382bb5[_0x3e93ab(0x1dc)](_0x2c5ab3['yaml'][_0x3e93ab(0x1ea)]),_0x41dcc4=await yamlIntegrationToApi(_0x2c5ab3[_0x3e93ab(0x12b)],_0x48616e,_0xdb4f70);if(_0x7fe36f){await this['client'][_0x3e93ab(0x120)](_0x7fe36f['id']);const _0x2ab26b=await this[_0x3e93ab(0x23d)]['createIntegration'](_0x41dcc4);_0x812381[_0x3e93ab(0x1c6)][_0x3e93ab(0x1db)]({'name':_0x2c5ab3[_0x3e93ab(0x12b)][_0x3e93ab(0x1ea)],'action':_0x3e93ab(0x157),'id':_0x2ab26b['id']}),_0x812381['counts'][_0x3e93ab(0x1c6)][_0x3e93ab(0x157)]++;}else{const _0x1bd724=await this[_0x3e93ab(0x23d)][_0x3e93ab(0x192)](_0x41dcc4);_0x812381[_0x3e93ab(0x1c6)][_0x3e93ab(0x1db)]({'name':_0x2c5ab3['yaml'][_0x3e93ab(0x1ea)],'action':'created','id':_0x1bd724['id']}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x1c6)]['created']++;}}catch(_0x209bf0){_0x812381[_0x3e93ab(0x1c6)]['push']({'name':_0x2c5ab3[_0x3e93ab(0x12b)][_0x3e93ab(0x1ea)],'action':_0x3e93ab(0x185),'error':_0x209bf0[_0x3e93ab(0x1ce)]}),_0x812381[_0x3e93ab(0x175)][_0x3e93ab(0x1c6)][_0x3e93ab(0x1f2)]++;}}return _0x812381;}async[a109_0x3e47fb(0x15c)](_0x32ca33,_0x1b07df,_0x171ef7,_0x35fe9b){const _0x4e45d7=a109_0x3e47fb,{projectId:_0xedf80,project:_0x59a4c}=await this[_0x4e45d7(0x1ba)](_0x32ca33),_0x306b4f=_0x59a4c[_0x4e45d7(0x20d)][_0x4e45d7(0x1fa)],_0x1923c5=await this[_0x4e45d7(0x23d)][_0x4e45d7(0x12d)](_0xedf80),_0x300305=_0x1923c5[_0x4e45d7(0x1ad)](_0x263739=>_0x263739[_0x4e45d7(0x20d)]['name']===_0x1b07df);if(!_0x300305)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x4e45d7(0x149)+_0x1b07df,undefined,{'helpText':_0x4e45d7(0x1f0)+_0x1923c5[_0x4e45d7(0x217)](_0x2a1d14=>_0x2a1d14[_0x4e45d7(0x20d)][_0x4e45d7(0x1fa)])[_0x4e45d7(0x151)](',\x20')});let _0x2e8d43;if(_0x171ef7)_0x2e8d43=_0x171ef7;else{const _0x2a1529=a109_0x51353b[_0x4e45d7(0x151)](process[_0x4e45d7(0x234)](),_0x4e45d7(0x1b1)),_0x3c4b6b=getSanitizedPathWithMigration(_0x2a1529,_0x306b4f);_0x3c4b6b['renamed']&&this[_0x4e45d7(0x214)][_0x4e45d7(0x1dd)]('Renamed\x20folder:\x20'+a109_0x51353b[_0x4e45d7(0x188)](_0x3c4b6b['oldPath'])+_0x4e45d7(0x1fb)+a109_0x51353b[_0x4e45d7(0x188)](_0x3c4b6b[_0x4e45d7(0x20a)])),_0x2e8d43=_0x3c4b6b[_0x4e45d7(0x20a)];}const _0x96a194=getSanitizedPathWithMigration(_0x2e8d43,_0x1b07df);_0x96a194['renamed']&&this[_0x4e45d7(0x214)]['info'](_0x4e45d7(0x158)+a109_0x51353b[_0x4e45d7(0x188)](_0x96a194[_0x4e45d7(0x187)])+'\x20→\x20'+a109_0x51353b[_0x4e45d7(0x188)](_0x96a194['path']));const _0x2166c=_0x96a194[_0x4e45d7(0x20a)],_0x2ab012=new Map(),_0x34966b=new Map(),_0x17fc87=await this[_0x4e45d7(0x23d)][_0x4e45d7(0x211)](_0xedf80),_0x24949e=await this[_0x4e45d7(0x23d)][_0x4e45d7(0x18b)](_0xedf80),_0x206662=await safeListOrEmpty(()=>this[_0x4e45d7(0x23d)][_0x4e45d7(0x196)](_0xedf80)),_0x4878fe=new Map(),_0x4eadbf=new Map();for(const _0x1dbd18 of _0x17fc87){_0x2ab012[_0x4e45d7(0x137)](_0x1dbd18['id'],_0x1dbd18[_0x4e45d7(0x20d)]['name']);}for(const _0x1e31f8 of _0x24949e){_0x4878fe['set'](_0x1e31f8['id'],_0x1e31f8[_0x4e45d7(0x20d)][_0x4e45d7(0x1fa)]);}for(const _0x5c1087 of _0x206662){_0x4eadbf[_0x4e45d7(0x137)](_0x5c1087['id'],_0x5c1087['attributes'][_0x4e45d7(0x1fa)]);}for(const _0xd29472 of _0x1923c5){_0x34966b[_0x4e45d7(0x137)](_0xd29472['id'],_0xd29472[_0x4e45d7(0x20d)][_0x4e45d7(0x1fa)]);}const _0x5ebda7={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x2ab012,'TextKnowledgeBase':_0x4878fe,'Agent':_0x34966b,'ExperimentalKnowledgeBase':_0x4eadbf}),'resolvePromptName':async()=>undefined,'onWarning':_0x30da80=>this[_0x4e45d7(0x214)]['warn'](_0x30da80)},_0x3d5ca0=a109_0x51353b['join'](_0x2166c,'prompt.md'),_0x172b63=a109_0x51353b[_0x4e45d7(0x151)](_0x2166c,_0x4e45d7(0x18c)),_0x495309=a109_0x51353b[_0x4e45d7(0x151)](_0x2166c,_0x4e45d7(0x194)),_0x360034=!a109_0x46e9cb[_0x4e45d7(0x17a)](_0x172b63);if(_0x35fe9b?.['dryRun'])return{'agentName':_0x1b07df,'outputPath':_0x2166c,'isNew':_0x360034,'hasChanges':!![]};a109_0x46e9cb[_0x4e45d7(0x1d8)](_0x2e8d43,{'recursive':!![]}),a109_0x46e9cb[_0x4e45d7(0x1d8)](_0x2166c,{'recursive':!![]});const _0x332b33=a109_0x51353b[_0x4e45d7(0x151)](_0x2e8d43,_0x4e45d7(0x1aa));!a109_0x46e9cb[_0x4e45d7(0x17a)](_0x332b33)&&a109_0x46e9cb[_0x4e45d7(0x1b4)](_0x332b33,createAgentConfigContent(_0x32ca33));const {yaml:_0x312896,systemPrompt:_0x3069c0,starterMessage:_0x2ea038}=await agentResponseToDef(_0x300305,_0x5ebda7);let _0x99868=_0x360034;if(!_0x360034){const _0x2545c0=a109_0x46e9cb[_0x4e45d7(0x17a)](_0x3d5ca0)?a109_0x46e9cb['readFileSync'](_0x3d5ca0,'utf-8'):'',_0x3f8168=a109_0x46e9cb['readFileSync'](_0x172b63,'utf-8');_0x99868=_0x2545c0!==_0x3069c0||_0x3f8168!==toAgentYamlString(_0x312896);}a109_0x46e9cb[_0x4e45d7(0x1b4)](_0x3d5ca0,_0x3069c0),a109_0x46e9cb['writeFileSync'](_0x172b63,toAgentYamlString(_0x312896));if(_0x2ea038&&_0x2ea038['includes']('\x0a'))a109_0x46e9cb[_0x4e45d7(0x1b4)](_0x495309,_0x2ea038);else a109_0x46e9cb[_0x4e45d7(0x17a)](_0x495309)&&a109_0x46e9cb[_0x4e45d7(0x1ac)](_0x495309);return{'agentName':_0x1b07df,'outputPath':_0x2166c,'isNew':_0x360034,'hasChanges':_0x99868};}async[a109_0x3e47fb(0x235)](_0x2e0a0f,_0x27fa59){const _0x1d51eb=a109_0x3e47fb;let _0x3a8be9;isAgentYamlPath(_0x2e0a0f)?_0x3a8be9=getAgentDirFromYamlPath(_0x2e0a0f):_0x3a8be9=_0x2e0a0f;const {config:_0x4a1837}=findAgentConfig(_0x3a8be9),_0xc855c2=await this[_0x1d51eb(0x16c)](_0x4a1837['llm_project']),_0x44e87d=a109_0x51353b[_0x1d51eb(0x151)](_0x3a8be9,_0x1d51eb(0x18c)),_0x591a28=a109_0x51353b[_0x1d51eb(0x151)](_0x3a8be9,_0x1d51eb(0x23e)),_0x275e87=a109_0x51353b[_0x1d51eb(0x151)](_0x3a8be9,'starter_message.md');if(!a109_0x46e9cb[_0x1d51eb(0x17a)](_0x44e87d))throw new SDKError(ErrorCode['NOT_FOUND'],_0x1d51eb(0x221)+_0x3a8be9,undefined,{'helpText':_0x1d51eb(0x1c9)});const _0x3e24ef=parseAgentYaml(a109_0x46e9cb['readFileSync'](_0x44e87d,_0x1d51eb(0x177)),_0x44e87d),_0x521cbf=a109_0x46e9cb[_0x1d51eb(0x17a)](_0x591a28)?a109_0x46e9cb['readFileSync'](_0x591a28,'utf-8'):'',_0x415d49=a109_0x46e9cb[_0x1d51eb(0x17a)](_0x275e87)?a109_0x46e9cb[_0x1d51eb(0x22e)](_0x275e87,_0x1d51eb(0x177)):_0x3e24ef[_0x1d51eb(0x15b)];if(_0x27fa59?.[_0x1d51eb(0x1ec)])return{'agentName':_0x3e24ef['name'],'action':'created','projectId':_0xc855c2};const _0x115953=await this[_0x1d51eb(0x23d)]['listAgentsFull'](_0xc855c2),_0x13a4d1=await fetchAllToolTargetMaps((_0x21bf37,_0x53a85f)=>this[_0x1d51eb(0x23d)][_0x1d51eb(0x1b5)](_0x21bf37,_0x53a85f),_0xc855c2),_0x3bc910=new Map();for(const _0x1a213c of _0x115953){_0x3bc910['set'](_0x1a213c[_0x1d51eb(0x20d)][_0x1d51eb(0x1fa)],_0x1a213c['id']);}const _0x83af33=[],_0x28bd21={'projectId':_0xc855c2,'resolveToolTargetId':buildIdResolver({..._0x13a4d1[_0x1d51eb(0x1f5)],'Agent':_0x3bc910}),'resolvePromptId':async()=>undefined,'onWarning':_0x15cc7c=>{const _0x1f115f=_0x1d51eb;this['logger']['warn'](_0x15cc7c),_0x83af33[_0x1f115f(0x1db)](_0x15cc7c);}};try{const _0x3af0d6=_0x115953[_0x1d51eb(0x1ad)](_0x1fa3a3=>_0x1fa3a3['attributes']['name']===_0x3e24ef[_0x1d51eb(0x1fa)]),_0x18c039=await agentDefToRequest(_0x3e24ef,_0x521cbf,_0x415d49,_0x28bd21);if(_0x3af0d6)return await this['client'][_0x1d51eb(0x227)](_0x3af0d6['id'],_0x18c039),{'agentName':_0x3e24ef[_0x1d51eb(0x1fa)],'action':_0x1d51eb(0x157),'projectId':_0xc855c2,'agentId':_0x3af0d6['id'],'warnings':_0x83af33['length']>0x0?_0x83af33:undefined};else{const _0x545d7d=await this[_0x1d51eb(0x23d)][_0x1d51eb(0x127)](_0x18c039);return{'agentName':_0x3e24ef[_0x1d51eb(0x1fa)],'action':_0x1d51eb(0x159),'projectId':_0xc855c2,'agentId':_0x545d7d['id'],'warnings':_0x83af33['length']>0x0?_0x83af33:undefined};}}catch(_0x46bf05){return{'agentName':_0x3e24ef[_0x1d51eb(0x1fa)],'action':_0x1d51eb(0x185),'projectId':_0xc855c2,'error':_0x46bf05[_0x1d51eb(0x1ce)],'warnings':_0x83af33[_0x1d51eb(0x154)]>0x0?_0x83af33:undefined};}}async[a109_0x3e47fb(0x143)](_0x309950,_0x1f57dd,_0x475a4d){const _0x332a57=a109_0x3e47fb,_0x525ea9=a109_0x46e9cb[_0x332a57(0x17a)](_0x309950)&&a109_0x46e9cb[_0x332a57(0x17a)](a109_0x51353b[_0x332a57(0x151)](_0x309950,'tdx.json'));let _0x4f1d2f;const _0xac22f=[],_0x33910e=[],_0x1a6fa2=[],_0xe434d=[],_0x27ebdb=[],_0x554584=[],_0x465204=[];if(_0x525ea9){const _0x3ff04a=loadAgentConfig(a109_0x51353b[_0x332a57(0x151)](_0x309950,_0x332a57(0x1aa)));_0x4f1d2f=_0x3ff04a['llm_project'];const _0x1bd8f0=a109_0x46e9cb['readdirSync'](_0x309950,{'withFileTypes':!![]});for(const _0x28f39c of _0x1bd8f0){if(!_0x28f39c[_0x332a57(0x1ed)]())continue;if([_0x332a57(0x1d1),_0x332a57(0x140),'experimental_artifacts',_0x332a57(0x164),_0x332a57(0x1c6)][_0x332a57(0x20f)](_0x28f39c[_0x332a57(0x1fa)]))continue;const _0x5d58b5=a109_0x51353b[_0x332a57(0x151)](_0x309950,_0x28f39c['name']);if(isAgentDir(_0x5d58b5)){const _0x3c8c69=a109_0x51353b['join'](_0x5d58b5,_0x332a57(0x18c)),_0x788cb7=a109_0x51353b['join'](_0x5d58b5,_0x332a57(0x23e)),_0x839a52=a109_0x51353b[_0x332a57(0x151)](_0x5d58b5,'starter_message.md'),_0x3ad05e=parseAgentYaml(a109_0x46e9cb[_0x332a57(0x22e)](_0x3c8c69,_0x332a57(0x177)),_0x3c8c69),_0x30eeed=a109_0x46e9cb[_0x332a57(0x17a)](_0x788cb7)?a109_0x46e9cb[_0x332a57(0x22e)](_0x788cb7,_0x332a57(0x177)):'',_0x647c07=a109_0x46e9cb[_0x332a57(0x17a)](_0x839a52)?a109_0x46e9cb[_0x332a57(0x22e)](_0x839a52,'utf-8'):_0x3ad05e[_0x332a57(0x15b)];_0xac22f[_0x332a57(0x1db)]({'name':_0x3ad05e[_0x332a57(0x1fa)],'dir':_0x5d58b5,'yaml':_0x3ad05e,'systemPrompt':_0x30eeed,'starterMessage':_0x647c07});}}const _0x484c8c=getKnowledgeBasesDir(_0x309950);if(a109_0x46e9cb[_0x332a57(0x17a)](_0x484c8c)){const _0x5cd0b9=a109_0x46e9cb[_0x332a57(0x23c)](_0x484c8c);for(const _0x3256c2 of _0x5cd0b9){const _0x392214=a109_0x51353b['join'](_0x484c8c,_0x3256c2);if(_0x3256c2[_0x332a57(0x1d4)](_0x332a57(0x160))){const _0x849f67=parseKnowledgeBaseYaml(a109_0x46e9cb[_0x332a57(0x22e)](_0x392214,_0x332a57(0x177)),_0x392214);_0x33910e['push']({'name':_0x849f67[_0x332a57(0x1fa)],'path':_0x392214,'yaml':_0x849f67});}else{if(_0x3256c2[_0x332a57(0x1d4)]('.md')){const _0x52639a=a109_0x46e9cb[_0x332a57(0x22e)](_0x392214,_0x332a57(0x177)),{name:_0x58cbc8,text:_0x40d780}=parseTextKnowledgeBaseMd(_0x52639a,_0x3256c2);_0x1a6fa2[_0x332a57(0x1db)]({'name':_0x58cbc8,'path':_0x392214,'text':_0x40d780});}}}}const _0x26ae30=getPromptsDir(_0x309950);if(a109_0x46e9cb[_0x332a57(0x17a)](_0x26ae30)){const _0x2146e3=a109_0x46e9cb['readdirSync'](_0x26ae30)['filter'](_0x3908fc=>_0x3908fc['endsWith'](_0x332a57(0x160)));for(const _0x31c428 of _0x2146e3){const _0x3a593b=a109_0x51353b[_0x332a57(0x151)](_0x26ae30,_0x31c428),_0x325f5c=parsePromptYaml(a109_0x46e9cb[_0x332a57(0x22e)](_0x3a593b,_0x332a57(0x177)),_0x3a593b);_0xe434d[_0x332a57(0x1db)]({'name':_0x325f5c[_0x332a57(0x1fa)],'path':_0x3a593b,'yaml':_0x325f5c});}}const _0x2b6888=getIntegrationsDir(_0x309950);if(a109_0x46e9cb[_0x332a57(0x17a)](_0x2b6888)){const _0x34049c=a109_0x46e9cb[_0x332a57(0x23c)](_0x2b6888)['filter'](_0x56a18d=>_0x56a18d[_0x332a57(0x1d4)](_0x332a57(0x160)));for(const _0x40a002 of _0x34049c){const _0x5806ad=a109_0x51353b[_0x332a57(0x151)](_0x2b6888,_0x40a002),_0x4ae7dc=parseIntegrationYaml(a109_0x46e9cb[_0x332a57(0x22e)](_0x5806ad,_0x332a57(0x177)),_0x5806ad);SAFE_INTEGRATION_TYPES[_0x332a57(0x20f)](_0x4ae7dc[_0x332a57(0x1ea)][_0x332a57(0x230)]())?_0x27ebdb['push']({'name':_0x4ae7dc[_0x332a57(0x1fa)],'path':_0x5806ad,'yaml':_0x4ae7dc}):this[_0x332a57(0x214)][_0x332a57(0x12f)](_0x332a57(0x1d2)+_0x4ae7dc[_0x332a57(0x1fa)]+_0x332a57(0x244)+_0x4ae7dc[_0x332a57(0x1ea)]+_0x332a57(0x20b)+(_0x332a57(0x131)+SAFE_INTEGRATION_TYPES[_0x332a57(0x151)](',\x20')+')\x20can\x20be\x20cloned.'));}}const _0x1ed8c9=getExperimentalKnowledgeBasesDir(_0x309950);if(a109_0x46e9cb[_0x332a57(0x17a)](_0x1ed8c9)){const _0x5bdea0=a109_0x46e9cb[_0x332a57(0x23c)](_0x1ed8c9,{'withFileTypes':!![]});for(const _0x51053d of _0x5bdea0){if(!_0x51053d['isDirectory']())continue;const _0x148f28=a109_0x51353b[_0x332a57(0x151)](_0x1ed8c9,_0x51053d['name']),_0x100391=a109_0x51353b[_0x332a57(0x151)](_0x148f28,_0x51053d[_0x332a57(0x1fa)]+'.yml');if(a109_0x46e9cb['existsSync'](_0x100391)){const _0x220aa0=parseExperimentalKnowledgeBaseYaml(a109_0x46e9cb[_0x332a57(0x22e)](_0x100391,_0x332a57(0x177)),_0x100391),_0xb8f7=a109_0x51353b[_0x332a57(0x151)](_0x148f28,'functions'),_0x3bb11a=[];if(a109_0x46e9cb[_0x332a57(0x17a)](_0xb8f7)){const _0xe052ea=a109_0x46e9cb[_0x332a57(0x23c)](_0xb8f7,{'withFileTypes':!![]});for(const _0x60e137 of _0xe052ea){if(!_0x60e137[_0x332a57(0x1ed)]())continue;const _0x1f8616=a109_0x51353b[_0x332a57(0x151)](_0xb8f7,_0x60e137['name']),_0x28f26e=a109_0x51353b[_0x332a57(0x151)](_0x1f8616,_0x332a57(0x144)),_0x34fcb1=a109_0x51353b[_0x332a57(0x151)](_0x1f8616,_0x332a57(0x23f));if(a109_0x46e9cb['existsSync'](_0x28f26e)&&a109_0x46e9cb[_0x332a57(0x17a)](_0x34fcb1)){const _0x384fe7=a109_0x46e9cb[_0x332a57(0x22e)](_0x28f26e,_0x332a57(0x177)),_0x5c8511=a109_0x46e9cb[_0x332a57(0x22e)](_0x34fcb1,_0x332a57(0x177));_0x3bb11a[_0x332a57(0x1db)]({'name':_0x60e137[_0x332a57(0x1fa)],'code':_0x384fe7,'json_schema':_0x5c8511});}}}const _0x1b3404={..._0x220aa0,'functions':_0x3bb11a};_0x554584[_0x332a57(0x1db)]({'name':_0x220aa0[_0x332a57(0x1fa)],'path':_0x148f28,'def':_0x1b3404});}}}const _0x52060d=getExperimentalArtifactsDir(_0x309950);if(a109_0x46e9cb[_0x332a57(0x17a)](_0x52060d)){const _0x10915b=a109_0x46e9cb[_0x332a57(0x23c)](_0x52060d,{'withFileTypes':!![]});for(const _0x16b4a3 of _0x10915b){if(!_0x16b4a3['isDirectory']())continue;const _0x2d1f78=a109_0x51353b[_0x332a57(0x151)](_0x52060d,_0x16b4a3['name']),_0x37a9a7=a109_0x51353b['join'](_0x2d1f78,_0x16b4a3[_0x332a57(0x1fa)]+_0x332a57(0x160));if(a109_0x46e9cb[_0x332a57(0x17a)](_0x37a9a7)){const _0x117cba=parseExperimentalArtifactYaml(a109_0x46e9cb[_0x332a57(0x22e)](_0x37a9a7,'utf-8'),_0x37a9a7),_0x25447b=a109_0x51353b['join'](_0x2d1f78,_0x332a57(0x144)),_0x46bd5c=a109_0x46e9cb[_0x332a57(0x17a)](_0x25447b)?a109_0x46e9cb[_0x332a57(0x22e)](_0x25447b,_0x332a57(0x177)):'',_0x2dc505=a109_0x51353b[_0x332a57(0x151)](_0x2d1f78,'files'),_0x4ef7d0=[];if(a109_0x46e9cb['existsSync'](_0x2dc505)){const _0x6c15c7=a109_0x46e9cb[_0x332a57(0x23c)](_0x2dc505);for(const _0x50caa6 of _0x6c15c7){const _0xd73e45=a109_0x51353b['join'](_0x2dc505,_0x50caa6);if(a109_0x46e9cb[_0x332a57(0x156)](_0xd73e45)[_0x332a57(0x18e)]()){const _0x29bb95=a109_0x46e9cb['readFileSync'](_0xd73e45,'utf-8');_0x4ef7d0[_0x332a57(0x1db)]({'file_name':_0x50caa6,'text_content':_0x29bb95});}}}const _0x4ceea7={..._0x117cba,'code':_0x46bd5c,'files':_0x4ef7d0};_0x465204[_0x332a57(0x1db)]({'name':_0x117cba[_0x332a57(0x1fa)],'path':_0x2d1f78,'def':_0x4ceea7});}}}}else{const _0x47d29a=await this[_0x332a57(0x16c)](_0x309950),_0x581aaf=await this[_0x332a57(0x23d)][_0x332a57(0x1e9)](_0x47d29a);_0x4f1d2f=_0x581aaf['attributes'][_0x332a57(0x1fa)];const _0x21dd2b=await this[_0x332a57(0x23d)][_0x332a57(0x12d)](_0x47d29a),_0x58f0c0=await this[_0x332a57(0x23d)][_0x332a57(0x211)](_0x47d29a),_0x42fe36=await this['client'][_0x332a57(0x18b)](_0x47d29a),_0x578a8c=await this[_0x332a57(0x23d)][_0x332a57(0x134)](_0x47d29a),_0x1d5816=await this[_0x332a57(0x23d)]['listIntegrations'](_0x47d29a),_0x3e8d32=await safeListOrEmpty(()=>this[_0x332a57(0x23d)]['listExperimentalKnowledgeBases'](_0x47d29a)),_0x400317=await safeListOrEmpty(()=>this[_0x332a57(0x23d)]['listExperimentalArtifacts'](_0x47d29a)),_0x295587=new Map(),_0x5e9a7a=new Map(),_0x5031c0=new Map(),_0x372fac=new Map(),_0x2f64eb=new Map(),_0xaf803c=new Map();for(const _0x275957 of _0x58f0c0){_0x295587[_0x332a57(0x137)](_0x275957['id'],_0x275957[_0x332a57(0x20d)]['name']);}for(const _0x54b5df of _0x42fe36){_0x5e9a7a[_0x332a57(0x137)](_0x54b5df['id'],_0x54b5df[_0x332a57(0x20d)][_0x332a57(0x1fa)]);}for(const _0x377ec8 of _0x21dd2b){_0x5031c0[_0x332a57(0x137)](_0x377ec8['id'],_0x377ec8['attributes'][_0x332a57(0x1fa)]);}for(const _0x111283 of _0x578a8c){_0x372fac[_0x332a57(0x137)](_0x111283['id'],_0x111283[_0x332a57(0x20d)][_0x332a57(0x1fa)]);}for(const _0x2d5a94 of _0x3e8d32){_0x2f64eb[_0x332a57(0x137)](_0x2d5a94['id'],_0x2d5a94[_0x332a57(0x20d)][_0x332a57(0x1fa)]);}for(const _0x571b02 of _0x400317){_0xaf803c[_0x332a57(0x137)](_0x571b02['id'],_0x571b02[_0x332a57(0x20d)]['name']);}const _0x58844b={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x295587,'TextKnowledgeBase':_0x5e9a7a,'Agent':_0x5031c0,'ExperimentalKnowledgeBase':_0x2f64eb}),'resolvePromptName':async _0x3384e6=>_0x372fac[_0x332a57(0x1dc)](_0x3384e6),'onWarning':_0x413a00=>this[_0x332a57(0x214)]['warn'](_0x413a00)};for(const _0x4c8a3f of _0x21dd2b){const _0x2aa36c=await agentResponseToDef(_0x4c8a3f,_0x58844b),{yaml:_0x1e86f3,systemPrompt:_0x7347d,starterMessage:_0x43e08c}=_0x2aa36c;_0xac22f[_0x332a57(0x1db)]({'name':_0x1e86f3[_0x332a57(0x1fa)],'dir':'','yaml':_0x1e86f3,'systemPrompt':_0x7347d,'starterMessage':_0x43e08c});}for(const _0x4af241 of _0x58f0c0){const _0x47dfa6=apiKnowledgeBaseToYaml(_0x4af241);_0x33910e[_0x332a57(0x1db)]({'name':_0x47dfa6['name'],'path':'','yaml':_0x47dfa6});}for(const _0x53f38c of _0x42fe36){_0x1a6fa2[_0x332a57(0x1db)]({'name':_0x53f38c[_0x332a57(0x20d)]['name'],'path':'','text':_0x53f38c[_0x332a57(0x20d)]['text']});}for(const _0xbc756b of _0x578a8c){const _0x1b5479=await apiPromptToYaml(_0xbc756b,_0x58844b);_0x1b5479&&_0xe434d[_0x332a57(0x1db)]({'name':_0x1b5479[_0x332a57(0x1fa)],'path':'','yaml':_0x1b5479});}for(const _0x5f335c of _0x1d5816){if(!_0x5f335c['attributes'][_0x332a57(0x1a5)]&&SAFE_INTEGRATION_TYPES[_0x332a57(0x20f)](_0x5f335c[_0x332a57(0x20d)][_0x332a57(0x228)][_0x332a57(0x230)]())){const _0x5b594a=await apiIntegrationToYaml(_0x5f335c,_0x58844b);_0x27ebdb[_0x332a57(0x1db)]({'name':_0x5f335c[_0x332a57(0x20d)][_0x332a57(0x228)][_0x332a57(0x230)](),'path':'','yaml':_0x5b594a});}}for(const _0x71dd43 of _0x3e8d32){const _0x3330e2=apiExperimentalKnowledgeBaseToYaml(_0x71dd43);_0x554584['push']({'name':_0x3330e2[_0x332a57(0x1fa)],'path':'','def':_0x3330e2});}for(const _0xe460f3 of _0x400317){const _0x351abc=apiExperimentalArtifactToYaml(_0xe460f3);_0x465204[_0x332a57(0x1db)]({'name':_0x351abc[_0x332a57(0x1fa)],'path':'','def':_0x351abc});}}const _0x1100bc={'sourceProjectName':_0x4f1d2f,'newProjectName':_0x1f57dd,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'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}}},_0x521226=await this[_0x332a57(0x23d)][_0x332a57(0x13c)](),_0xa6c6c9=_0x521226[_0x332a57(0x1ad)](_0x37585a=>_0x37585a[_0x332a57(0x20d)][_0x332a57(0x1fa)]===_0x1f57dd);if(_0xa6c6c9)throw new SDKError(ErrorCode[_0x332a57(0x17c)],_0x332a57(0x218)+_0x1f57dd+_0x332a57(0x1ef),undefined,{'helpText':_0x332a57(0x174)});if(_0x475a4d?.['dryRun'])return _0x1100bc[_0x332a57(0x175)]['agents'][_0x332a57(0x159)]=_0xac22f[_0x332a57(0x154)],_0x1100bc[_0x332a57(0x175)][_0x332a57(0x238)]['created']=_0x33910e[_0x332a57(0x154)],_0x1100bc[_0x332a57(0x175)][_0x332a57(0x189)][_0x332a57(0x159)]=_0x1a6fa2[_0x332a57(0x154)],_0x1100bc['counts'][_0x332a57(0x1d0)]['created']=_0x554584['length'],_0x1100bc[_0x332a57(0x175)][_0x332a57(0x22d)][_0x332a57(0x159)]=_0x465204[_0x332a57(0x154)],_0x1100bc[_0x332a57(0x175)][_0x332a57(0x164)][_0x332a57(0x159)]=_0xe434d[_0x332a57(0x154)],_0x1100bc['counts'][_0x332a57(0x1c6)][_0x332a57(0x159)]=_0x27ebdb['length'],_0x1100bc;const _0x1c2fa9=await this[_0x332a57(0x23d)][_0x332a57(0x12e)]({'name':_0x1f57dd}),_0xcfe5c3=_0x1c2fa9['id'];_0x1100bc[_0x332a57(0x155)]=_0xcfe5c3;const _0x3c6ebf=new Map(),_0x28e912=new Map(),_0x321df8=new Map(),_0x315f98=new Map(),_0x2c5b29=new Map(),_0x2e9b47=new Map(),_0x3ccf36=new Map(),_0x19c919=new Map(),_0x2aa840=new Set(),_0x566e5a=new Set();for(const _0x272666 of _0xac22f){for(const _0x210254 of _0x272666[_0x332a57(0x12b)][_0x332a57(0x124)]||[]){if(_0x210254['type']===_0x332a57(0x15e)&&_0x210254[_0x332a57(0x20c)]){const _0x5cefd4=parseRef(_0x210254[_0x332a57(0x20c)]);if(_0x5cefd4)_0x2aa840[_0x332a57(0x1cf)](_0x5cefd4[_0x332a57(0x1fa)]);}else{if(_0x210254['type']===_0x332a57(0x220)&&_0x210254[_0x332a57(0x20c)]){const _0x4980ae=parseRef(_0x210254[_0x332a57(0x20c)]);if(_0x4980ae)_0x566e5a[_0x332a57(0x1cf)](_0x4980ae[_0x332a57(0x1fa)]);}}}}for(const _0x52f8cc of _0x2aa840){try{const _0x44c175=await this[_0x332a57(0x23d)][_0x332a57(0x1b3)]({'projectId':_0xcfe5c3,'name':_0x52f8cc});_0x2c5b29[_0x332a57(0x137)](_0x52f8cc,_0x44c175['id']),_0x1100bc[_0x332a57(0x195)][_0x332a57(0x1db)]({'name':_0x52f8cc,'action':_0x332a57(0x159),'id':_0x44c175['id']}),_0x1100bc[_0x332a57(0x175)]['imageGenerators']['created']++;}catch(_0x612a24){_0x1100bc[_0x332a57(0x195)][_0x332a57(0x1db)]({'name':_0x52f8cc,'action':_0x332a57(0x185),'error':_0x612a24[_0x332a57(0x1ce)]}),_0x1100bc[_0x332a57(0x175)]['imageGenerators'][_0x332a57(0x1f2)]++;}}for(const _0x59ee7f of _0x566e5a){try{const _0x46fd5e=await this[_0x332a57(0x23d)][_0x332a57(0x161)]({'projectId':_0xcfe5c3,'name':_0x59ee7f});_0x2e9b47['set'](_0x59ee7f,_0x46fd5e['id']),_0x1100bc['webSearchTools'][_0x332a57(0x1db)]({'name':_0x59ee7f,'action':'created','id':_0x46fd5e['id']}),_0x1100bc[_0x332a57(0x175)][_0x332a57(0x19f)][_0x332a57(0x159)]++;}catch(_0x14a0bc){_0x1100bc[_0x332a57(0x19f)][_0x332a57(0x1db)]({'name':_0x59ee7f,'action':_0x332a57(0x185),'error':_0x14a0bc[_0x332a57(0x1ce)]}),_0x1100bc[_0x332a57(0x175)][_0x332a57(0x19f)][_0x332a57(0x1f2)]++;}}const _0x1159ca=await fetchAllToolTargetMaps((_0x30fc9d,_0x41c6a1)=>this[_0x332a57(0x23d)]['listToolTargets'](_0x30fc9d,_0x41c6a1),_0xcfe5c3);let _0x50724a=[];const _0x176642={'projectId':_0xcfe5c3,'resolveToolTargetId':buildIdResolver({..._0x1159ca[_0x332a57(0x1f5)],'KnowledgeBase':_0x3c6ebf,'TextKnowledgeBase':_0x28e912,'ExperimentalKnowledgeBase':_0x3ccf36,'Agent':_0x321df8,'WebSearchTool':_0x2e9b47,'ImageGenerator':_0x2c5b29}),'resolvePromptId':async _0x5689f4=>_0x315f98['get'](_0x5689f4),'onWarning':_0x4695ca=>{const _0x48ce12=_0x332a57;this['logger']['warn'](_0x4695ca),_0x50724a[_0x48ce12(0x1db)](_0x4695ca);}};for(const _0x529e5b of _0x33910e){try{const _0xdd6142=yamlKnowledgeBaseToApi(_0x529e5b['yaml'],_0xcfe5c3),_0x5e3017=await this[_0x332a57(0x23d)][_0x332a57(0x1c0)](_0xdd6142);_0x3c6ebf[_0x332a57(0x137)](_0x529e5b[_0x332a57(0x12b)][_0x332a57(0x1fa)],_0x5e3017['id']),_0x1100bc[_0x332a57(0x238)][_0x332a57(0x1db)]({'name':_0x529e5b[_0x332a57(0x12b)][_0x332a57(0x1fa)],'action':'created','id':_0x5e3017['id']}),_0x1100bc[_0x332a57(0x175)][_0x332a57(0x238)]['created']++;}catch(_0xc8223b){_0x1100bc[_0x332a57(0x238)][_0x332a57(0x1db)]({'name':_0x529e5b['yaml'][_0x332a57(0x1fa)],'action':_0x332a57(0x185),'error':_0xc8223b['message']}),_0x1100bc[_0x332a57(0x175)][_0x332a57(0x238)][_0x332a57(0x1f2)]++;}}for(const _0x521110 of _0x1a6fa2){try{const _0x493de7=yamlTextKnowledgeBaseToApi({'name':_0x521110[_0x332a57(0x1fa)],'text':_0x521110['text']},_0xcfe5c3),_0x2977fd=await this[_0x332a57(0x23d)][_0x332a57(0x170)](_0x493de7);_0x28e912[_0x332a57(0x137)](_0x521110['name'],_0x2977fd['id']),_0x1100bc[_0x332a57(0x189)][_0x332a57(0x1db)]({'name':_0x521110['name'],'action':_0x332a57(0x159),'id':_0x2977fd['id']}),_0x1100bc[_0x332a57(0x175)]['textKnowledgeBases'][_0x332a57(0x159)]++;}catch(_0x1bae7a){_0x1100bc['textKnowledgeBases']['push']({'name':_0x521110['name'],'action':_0x332a57(0x185),'error':_0x1bae7a['message']}),_0x1100bc[_0x332a57(0x175)]['textKnowledgeBases']['errors']++;}}for(const _0x365c21 of _0x465204){try{const _0x4fc542=yamlExperimentalArtifactToApi(_0x365c21[_0x332a57(0x142)],_0xcfe5c3),_0x36c94a=await this[_0x332a57(0x23d)][_0x332a57(0x1e6)](_0x4fc542);_0x19c919[_0x332a57(0x137)](_0x365c21[_0x332a57(0x142)][_0x332a57(0x1fa)],_0x36c94a['id']),_0x1100bc[_0x332a57(0x22d)]['push']({'name':_0x365c21[_0x332a57(0x142)][_0x332a57(0x1fa)],'action':_0x332a57(0x159),'id':_0x36c94a['id']}),_0x1100bc[_0x332a57(0x175)][_0x332a57(0x22d)][_0x332a57(0x159)]++;}catch(_0x472751){_0x1100bc[_0x332a57(0x22d)][_0x332a57(0x1db)]({'name':_0x365c21['def']['name'],'action':_0x332a57(0x185),'error':_0x472751[_0x332a57(0x1ce)]}),_0x1100bc[_0x332a57(0x175)][_0x332a57(0x22d)][_0x332a57(0x1f2)]++;}}for(const _0x4ffbd8 of _0x554584){try{const _0x262d68=yamlExperimentalKnowledgeBaseToApi(_0x4ffbd8['def'],_0xcfe5c3),_0x3a1cd5=await this['client'][_0x332a57(0x1ff)](_0x262d68);_0x3ccf36[_0x332a57(0x137)](_0x4ffbd8[_0x332a57(0x142)][_0x332a57(0x1fa)],_0x3a1cd5['id']),_0x1100bc['experimentalKnowledgeBases'][_0x332a57(0x1db)]({'name':_0x4ffbd8[_0x332a57(0x142)][_0x332a57(0x1fa)],'action':'created','id':_0x3a1cd5['id']}),_0x1100bc[_0x332a57(0x175)]['experimentalKnowledgeBases']['created']++;}catch(_0x1d241d){_0x1100bc['experimentalKnowledgeBases']['push']({'name':_0x4ffbd8[_0x332a57(0x142)][_0x332a57(0x1fa)],'action':'error','error':_0x1d241d[_0x332a57(0x1ce)]}),_0x1100bc[_0x332a57(0x175)][_0x332a57(0x1d0)][_0x332a57(0x1f2)]++;}}const _0x4a9190=[..._0xac22f]['sort']((_0x4609bb,_0x140860)=>{const _0x4ade2d=_0x332a57,_0x317e84=_0x4609bb[_0x4ade2d(0x12b)][_0x4ade2d(0x124)]?.[_0x4ade2d(0x15d)](_0x50307e=>_0x50307e[_0x4ade2d(0x23a)]===_0x4ade2d(0x22a))??![],_0x515a31=_0x140860['yaml'][_0x4ade2d(0x124)]?.['some'](_0x505199=>_0x505199['type']===_0x4ade2d(0x22a))??![];if(_0x317e84&&!_0x515a31)return 0x1;if(!_0x317e84&&_0x515a31)return-0x1;return 0x0;});for(const _0x35187b of _0x4a9190){_0x50724a=[];try{const _0x4a3999=_0x35187b[_0x332a57(0x12b)][_0x332a57(0x124)]?.[_0x332a57(0x153)](_0x5da189=>{const _0x5bfd22=_0x332a57;if(_0x5da189[_0x5bfd22(0x23a)]===_0x5bfd22(0x22a)&&_0x5da189[_0x5bfd22(0x20c)]){const _0x31da38=parseRef(_0x5da189['target']);return _0x31da38?.[_0x5bfd22(0x1fa)]===_0x35187b[_0x5bfd22(0x12b)]['name'];}return![];})??[];if(_0x4a3999[_0x332a57(0x154)]>0x0){const _0x21ef3e=_0x332a57(0x162)+_0x35187b[_0x332a57(0x12b)][_0x332a57(0x1fa)]+_0x332a57(0x17b)+_0x332a57(0x1a9);this[_0x332a57(0x214)][_0x332a57(0x12f)](_0x21ef3e),_0x50724a['push'](_0x21ef3e);}const _0x69ec52=await agentDefToRequest(_0x35187b[_0x332a57(0x12b)],_0x35187b['systemPrompt'],_0x35187b[_0x332a57(0x237)],_0x176642),_0x56a3ce=await this[_0x332a57(0x23d)]['createAgentResponse'](_0x69ec52);_0x321df8[_0x332a57(0x137)](_0x35187b['yaml'][_0x332a57(0x1fa)],_0x56a3ce['id']),_0x1100bc[_0x332a57(0x1b1)][_0x332a57(0x1db)]({'agentName':_0x35187b['yaml']['name'],'action':_0x332a57(0x159),'agentId':_0x56a3ce['id'],'warnings':_0x50724a['length']>0x0?_0x50724a:undefined}),_0x1100bc[_0x332a57(0x175)][_0x332a57(0x1b1)]['created']++;}catch(_0x22b4f9){_0x1100bc[_0x332a57(0x1b1)][_0x332a57(0x1db)]({'agentName':_0x35187b[_0x332a57(0x12b)][_0x332a57(0x1fa)],'action':'error','error':_0x22b4f9[_0x332a57(0x1ce)],'warnings':_0x50724a[_0x332a57(0x154)]>0x0?_0x50724a:undefined}),_0x1100bc['counts'][_0x332a57(0x1b1)][_0x332a57(0x1f2)]++;}}for(const _0x41825f of _0xe434d){try{const _0x34bd34=await yamlPromptToApi(_0x41825f['yaml'],_0xcfe5c3,_0x176642);if(!_0x34bd34){_0x1100bc['prompts'][_0x332a57(0x1db)]({'name':_0x41825f[_0x332a57(0x12b)][_0x332a57(0x1fa)],'action':_0x332a57(0x185),'error':_0x332a57(0x13e)}),_0x1100bc[_0x332a57(0x175)]['prompts']['errors']++;continue;}const _0x56f07f=await this[_0x332a57(0x23d)][_0x332a57(0x173)](_0x34bd34);_0x315f98[_0x332a57(0x137)](_0x41825f['yaml'][_0x332a57(0x1fa)],_0x56f07f['id']),_0x1100bc[_0x332a57(0x164)][_0x332a57(0x1db)]({'name':_0x41825f[_0x332a57(0x12b)]['name'],'action':_0x332a57(0x159),'id':_0x56f07f['id']}),_0x1100bc['counts']['prompts'][_0x332a57(0x159)]++;}catch(_0x110e09){_0x1100bc[_0x332a57(0x164)][_0x332a57(0x1db)]({'name':_0x41825f['yaml'][_0x332a57(0x1fa)],'action':_0x332a57(0x185),'error':_0x110e09['message']}),_0x1100bc[_0x332a57(0x175)][_0x332a57(0x164)][_0x332a57(0x1f2)]++;}}for(const _0x748ed0 of _0x27ebdb){try{const _0x1826cb=await yamlIntegrationToApi(_0x748ed0[_0x332a57(0x12b)],_0xcfe5c3,_0x176642),_0xa1bfd2=await this[_0x332a57(0x23d)][_0x332a57(0x192)](_0x1826cb);_0x1100bc[_0x332a57(0x1c6)][_0x332a57(0x1db)]({'name':_0x748ed0[_0x332a57(0x12b)][_0x332a57(0x1ea)],'action':'created','id':_0xa1bfd2['id']}),_0x1100bc[_0x332a57(0x175)][_0x332a57(0x1c6)]['created']++;}catch(_0xf927b4){_0x1100bc[_0x332a57(0x1c6)][_0x332a57(0x1db)]({'name':_0x748ed0['yaml']['service_type'],'action':_0x332a57(0x185),'error':_0xf927b4[_0x332a57(0x1ce)]}),_0x1100bc[_0x332a57(0x175)]['integrations'][_0x332a57(0x1f2)]++;}}return _0x1100bc;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x422604,_0x15f9a1){const _0x58188e=a110_0x3417,_0x33b72a=_0x422604();while(!![]){try{const _0xb3f84c=parseInt(_0x58188e(0x66))/0x1+parseInt(_0x58188e(0x73))/0x2+parseInt(_0x58188e(0x64))/0x3+-parseInt(_0x58188e(0x6e))/0x4*(parseInt(_0x58188e(0x6c))/0x5)+parseInt(_0x58188e(0x72))/0x6*(parseInt(_0x58188e(0x65))/0x7)+parseInt(_0x58188e(0x6a))/0x8+-parseInt(_0x58188e(0x69))/0x9;if(_0xb3f84c===_0x15f9a1)break;else _0x33b72a['push'](_0x33b72a['shift']());}catch(_0x4792cf){_0x33b72a['push'](_0x33b72a['shift']());}}}(a110_0x4afc,0x885ac));export function canCreateAgent(_0x337458,_0x3738b7){const _0x5648e3=a110_0x3417;for(const _0x3d084c of _0x337458['attributes'][_0x5648e3(0x70)]){if(_0x3d084c[_0x5648e3(0x67)]&&!_0x3738b7[_0x5648e3(0x6b)](_0x3d084c['targetAgentId']))return![];}return!![];}function a110_0x3417(_0x2c1b01,_0x52391a){_0x2c1b01=_0x2c1b01-0x64;const _0x4afcaf=a110_0x4afc();let _0x341721=_0x4afcaf[_0x2c1b01];return _0x341721;}export function remapToolIds(_0x538b88,_0x410d23,_0x9927b1){const _0xd624c0=a110_0x3417;return _0x538b88[_0xd624c0(0x6d)](_0x563ee7=>({..._0x563ee7,'targetKnowledgeBaseId':_0x563ee7[_0xd624c0(0x6f)]?_0x410d23[_0xd624c0(0x68)](_0x563ee7[_0xd624c0(0x6f)])||_0x563ee7['targetKnowledgeBaseId']:undefined,'targetAgentId':_0x563ee7['targetAgentId']?_0x9927b1[_0xd624c0(0x68)](_0x563ee7[_0xd624c0(0x67)])||_0x563ee7['targetAgentId']:undefined}));}function a110_0x4afc(){const _0x2b6474=['8151960UJDdCx','has','4494345JgBYZB','map','4fHMXQP','targetKnowledgeBaseId','tools','1.0','690ClawhJ','305988hVloup','1563273mevpUH','24766KcNWQx','604179UIYvxz','targetAgentId','get','11220768ofLQWQ'];a110_0x4afc=function(){return _0x2b6474;};return a110_0x4afc();}export function remapVariableIds(_0x33e6ca,_0x29dcb1){const _0x343813=a110_0x3417;return _0x33e6ca['map'](_0x4a4fdd=>({..._0x4a4fdd,'targetKnowledgeBaseId':_0x29dcb1['get'](_0x4a4fdd[_0x343813(0x6f)])||_0x4a4fdd[_0x343813(0x6f)]}));}export function isSupportedBackupVersion(_0x1a58a7){const _0x475d0d=a110_0x3417;return _0x1a58a7===_0x475d0d(0x71);}
|