@treasuredata/tdx 0.19.2 → 0.20.0
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/describe.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/llm-proxy.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.d.ts.map +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/status-command.js.map +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.d.ts +2 -2
- package/dist/core/auth.d.ts.map +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/auth.js.map +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.d.ts +12 -20
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/config.js.map +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.d.ts +3 -0
- package/dist/core/global-context.d.ts.map +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/global-context.js.map +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/anthropic-adapter.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/context-signature.js +1 -1
- package/dist/proxy/conversation-utils.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/server.js +1 -1
- package/dist/proxy/session-cache.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/api.js +1 -1
- package/dist/sdk/client/cdp-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/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/index.js.map +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-aliases.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.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-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-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/port.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 a102_0x1d5d3c=a102_0x51f7;function a102_0x51f7(_0x28bb81,_0x694f1c){_0x28bb81=_0x28bb81-0x145;const _0x36f2ba=a102_0x36f2();let _0x51f77b=_0x36f2ba[_0x28bb81];return _0x51f77b;}(function(_0x3fbbfc,_0x12e972){const _0x3caba0=a102_0x51f7,_0x1e9b4a=_0x3fbbfc();while(!![]){try{const _0x5a8a4f=parseInt(_0x3caba0(0x21e))/0x1+parseInt(_0x3caba0(0x234))/0x2*(-parseInt(_0x3caba0(0x1fd))/0x3)+-parseInt(_0x3caba0(0x20c))/0x4+parseInt(_0x3caba0(0x189))/0x5+-parseInt(_0x3caba0(0x22c))/0x6*(-parseInt(_0x3caba0(0x1c7))/0x7)+-parseInt(_0x3caba0(0x1e8))/0x8+parseInt(_0x3caba0(0x154))/0x9;if(_0x5a8a4f===_0x12e972)break;else _0x1e9b4a['push'](_0x1e9b4a['shift']());}catch(_0x4ea9cf){_0x1e9b4a['push'](_0x1e9b4a['shift']());}}}(a102_0x36f2,0xe790f));import{LLMApiClient}from'../client/llm-api-client.js';import*as a102_0x36a419 from'node:fs';function a102_0x36f2(){const _0x58b39c=['availableModelNames','integrations.json','listChats','startChat','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','cloneProject','listKnowledgeBases','restoreProject','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','createIntegration','isManaged','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','LLM_PROJECT_NOT_FOUND','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','\x20attempts\x20due\x20to\x20name\x20conflicts.','getOrCreateDefaultProject','starter_message','.llm','loadJsonFile','template','(dry-run)','listAgentsFull','updated','add','tdx_','target','parse','agentId','signal','chatInfo','path','chatWelcomeMessage','Unable\x20to\x20create\x20project\x20after\x20','520079sJipYG','mkdirSync','info','pullProject','\x0a\x0a#\x20agent.yml\x0a','site','setCurrentProject','clearDefaultAgent','high','INTERNAL','keys','cwd','Invalid\x20agent\x20reference\x20format:\x20','agents.json','split','length','join','starter_message.md','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','message','agents','temperature','llm_project','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.','filter','createAgent','#\x20prompt.md\x0a','pushProject','dry-run-','updatePrompt','listProjects','webSearchTools','\x22\x20already\x20exists','11557840bCyeRk','dryRun','.md',')\x20can\x20be\x20pushed.\x20','createAgentResponse','Agent\x20\x27','utf-8','text','dirname','status','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','low','slackMessageMode','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','sort','getDefaultProjectName','listIntegrations','error','already\x20exists','resolveProjectName','counts','18jCkcQZ','get','modelType','minimal','tdDatabaseName','service_type','event','isDirectory','new','Renamed\x20agent\x20folder:\x20','setDefaultAgent','has','getChatHistory','profile','dir','7474448bvawJd','getUserSettings','claude-4.5-sonnet','resolveProjectId','Renamed\x20KB\x20file:\x20','chat_agent_console','Renamed\x20folder:\x20','getBackupMetadata','projectName','agent','listImageGenerators','stringify','set','Project\x20not\x20found:\x20','chatId','attributes','created','listAgents','1732373JhzrLh','jsonSchemaHint','currentProjectId','duplicate','imageGenerators','getAgent','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','ALREADY_EXISTS','updateAgentResponse','readdirSync','maxToolIterations','unlinkSync','listTextKnowledgeBases','138VUAUAf','chatIgnoreManagedActions','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','version','context','createPrompt','unchanged','pullAgent','282484wTycUE','some','image_gen','actions','Skipping\x20integration\x20\x27','serviceType','prompt.md','Renamed\x20text\x20KB\x20file:\x20','logger','tdx.json','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','backupProject','integrations','Available\x20agents:\x20','errors','knowledge_bases','Output\x20directory\x20already\x20exists:\x20','find','4110678tMDVAM','starterMessage','agent.yml','\x27.\x20This\x20should\x20not\x20happen.','getChatInfo','systemPrompt','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','.yml','continueChat','endsWith','Only\x20safe\x20types\x20(','conflict','name','listPrompts','prompts','textKnowledgeBases','readFileSync','knowledgebases.json','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','project.json','getDefaultAgent','includes','metadata','updateKnowledgeBase','createTextKnowledgeBase','Renamed\x20integration\x20file:\x20','exportedFrom','prompts.json','deleteProject','deleteIntegration','Unsupported\x20backup\x20version:\x20','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','Multiple\x20projects\x20found\x20with\x20name\x20\x27','toLowerCase','agent.yml\x20not\x20found\x20in\x20','type','warn','toISOString','agentsFull','createProject','size','updateAgent','renamed','knowledgeBases','Agent\x20reference\x20not\x20found','listWebSearchTools','getParentSegmentKnowledgeBase','tools','yaml','displayName','total','client','Backup\x20folder\x20not\x20found:\x20','6056715avWiIg','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','pushAgent','reasoningEffort','createKnowledgeBase','oldPath','Agent\x20not\x20found:\x20','createImageGenerator','chat','project','NOT_FOUND','push','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','UNAUTHENTICATED','\x20→\x20','deleteAgent','AGENT_NOT_FOUND','writeFileSync','getOrCreateDefaultAgent','basename','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','1.0','newProjectId','models','INVALID_ARGUMENT','):\x20','existsSync','getProject','Unresolved\x20dependencies:\x20'];a102_0x36f2=function(){return _0x58b39c;};return a102_0x36f2();}import*as a102_0x202167 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,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlPromptToApi,yamlIntegrationToApi,resolveAgentDependencies}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir}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',a102_0x1d5d3c(0x211),'chat_parent_segment'];export class LLMSDK{[a102_0x1d5d3c(0x220)];['client'];[a102_0x1d5d3c(0x230)];[a102_0x1d5d3c(0x14a)]=Logger['of']('sdk.llm');constructor(_0x4da794){const _0x34ac6d=a102_0x1d5d3c;this[_0x34ac6d(0x187)]=new LLMApiClient(_0x4da794),this[_0x34ac6d(0x230)]=_0x4da794;}[a102_0x1d5d3c(0x1f7)](){const _0x2cbb46=getSanitizedUsername();return'tdx_default_'+_0x2cbb46;}async[a102_0x1d5d3c(0x1cd)](_0x58d07c){const _0x3fdb3c=a102_0x1d5d3c,{projectId:_0x400ad0}=await this['resolveProjectName'](_0x58d07c);this[_0x3fdb3c(0x220)]=_0x400ad0;}['getCurrentProject'](){return this['currentProjectId'];}async[a102_0x1d5d3c(0x207)](_0x2b9ae5){const _0x4055a4=a102_0x1d5d3c,_0x329839=this['context'][_0x4055a4(0x20a)];let _0x458604,_0x48afae;if(_0x2b9ae5['includes']('/')){const _0x34bf4e=_0x2b9ae5[_0x4055a4(0x1d5)]('/');if(_0x34bf4e[_0x4055a4(0x1d6)]!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x4055a4(0x1d3)+_0x2b9ae5,undefined,{'helpText':_0x4055a4(0x1f5)});const [_0x4fe9e8,_0x3b272e]=_0x34bf4e;_0x458604=await this[_0x4055a4(0x20f)](_0x4fe9e8),_0x48afae=_0x3b272e;}else _0x458604=this['currentProjectId']||(await this['getOrCreateDefaultProject']())['id'],_0x48afae=_0x2b9ae5;const _0x19d99d=await this['resolveAgentId'](_0x48afae,_0x458604),_0x5b5b43=await this['client']['getAgent'](_0x19d99d);writeCachedLLMAgent(_0x5b5b43[_0x4055a4(0x21b)][_0x4055a4(0x160)],_0x19d99d,_0x458604,_0x329839);}[a102_0x1d5d3c(0x168)](){const _0x52d4fb=a102_0x1d5d3c,_0x44e0f4=this[_0x52d4fb(0x230)]['profile'];return readCachedLLMAgent(_0x44e0f4)||undefined;}[a102_0x1d5d3c(0x1ce)](){const _0x4f637a=a102_0x1d5d3c,_0x16e574=this[_0x4f637a(0x230)]['profile'];clearCachedLLMAgent(_0x16e574);}async[a102_0x1d5d3c(0x1a0)](){const _0x20a5c2=a102_0x1d5d3c,_0xa8079f=await this[_0x20a5c2(0x187)][_0x20a5c2(0x20d)](),_0x22fc62=[];for(const _0x2cfb2c of _0xa8079f[_0x20a5c2(0x1a6)]){const _0x54960e=_0xa8079f['availableModels'][_0x2cfb2c];_0x54960e&&_0x22fc62[_0x20a5c2(0x194)]({'name':_0x2cfb2c,'displayName':_0x54960e[_0x20a5c2(0x185)]});}return _0x22fc62;}async['createProject'](_0x329fc9){const _0xc8209a=a102_0x1d5d3c;return await this[_0xc8209a(0x187)]['createProject'](_0x329fc9);}async[a102_0x1d5d3c(0x170)](_0x1918cc){const _0x4bfc40=a102_0x1d5d3c,{projectId:_0x3f4f0a}=await this[_0x4bfc40(0x1fb)](_0x1918cc);await this['client'][_0x4bfc40(0x170)](_0x3f4f0a);}async['projects'](_0x47aa9d=0x32){const _0x377807=a102_0x1d5d3c;return await this[_0x377807(0x187)][_0x377807(0x1e5)](_0x47aa9d);}async['getOrCreateDefaultProject'](_0x39542e){const _0x13e51f=a102_0x1d5d3c,_0x58f9af=_0x39542e||this[_0x13e51f(0x1f7)](),_0x3e5af3=this['context']['profile'];if(!_0x39542e){const _0x327166=readCachedLLMProject(_0x3e5af3);if(_0x327166&&_0x327166['name']===_0x58f9af)try{const _0x760fbe=await this[_0x13e51f(0x187)]['getProject'](_0x327166['id']);if(_0x760fbe[_0x13e51f(0x21b)][_0x13e51f(0x160)]===_0x58f9af)return _0x760fbe;}catch{}}const _0x5c5a3c=await this[_0x13e51f(0x187)]['listProjects'](),_0x2658e3=_0x5c5a3c[_0x13e51f(0x153)](_0x1e7a4f=>_0x1e7a4f[_0x13e51f(0x21b)][_0x13e51f(0x160)]===_0x58f9af);if(_0x2658e3)return!_0x39542e&&writeCachedLLMProject(_0x58f9af,_0x2658e3['id'],_0x3e5af3),_0x2658e3;const _0x168ed2=await this[_0x13e51f(0x187)]['createProject']({'name':_0x58f9af,'description':_0x13e51f(0x225)+getSanitizedUsername()+')'});return!_0x39542e&&writeCachedLLMProject(_0x58f9af,_0x168ed2['id'],_0x3e5af3),_0x168ed2;}async['resolveProjectId'](_0x63aac8){const _0x17ffcb=a102_0x1d5d3c,_0x2bee5d=await this[_0x17ffcb(0x187)]['listProjects'](),_0x10d1af=_0x2bee5d['filter'](_0x49b4fc=>_0x49b4fc[_0x17ffcb(0x21b)][_0x17ffcb(0x160)]===_0x63aac8);if(_0x10d1af[_0x17ffcb(0x1d6)]===0x0)throw new SDKError(ErrorCode[_0x17ffcb(0x1b2)],'Project\x20not\x20found:\x20'+_0x63aac8,undefined,{'helpText':_0x17ffcb(0x22e)});if(_0x10d1af[_0x17ffcb(0x1d6)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x17ffcb(0x174)+_0x63aac8+_0x17ffcb(0x157));return _0x10d1af[0x0]['id'];}async[a102_0x1d5d3c(0x1fb)](_0x4ee387){const _0x583b53=a102_0x1d5d3c,_0x44f72e=await this['client'][_0x583b53(0x1e5)](),_0x205be5=_0x44f72e[_0x583b53(0x153)](_0x2d83d8=>_0x2d83d8[_0x583b53(0x21b)][_0x583b53(0x160)]===_0x4ee387);if(_0x205be5)return{'projectId':_0x205be5['id'],'project':_0x205be5};throw new SDKError(ErrorCode[_0x583b53(0x1b2)],_0x583b53(0x219)+_0x4ee387,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});}async[a102_0x1d5d3c(0x19b)](_0x5a5e04=a102_0x1d5d3c(0x20e),_0x35340c=0x0,_0x4c9750){const _0x34feb3=a102_0x1d5d3c,_0x4a50bf=0xa;let _0x4e5557=0x0,_0x3a32fa;while(_0x4e5557<_0x4a50bf){try{const _0x1c2b81=await this[_0x34feb3(0x1b5)](_0x3a32fa),_0x2fae78=_0x1c2b81['id'],_0x3aa299=['none',_0x34feb3(0x200),_0x34feb3(0x1f3),'medium',_0x34feb3(0x1cf)],_0x396dfe=_0x35340c===0x0?_0x34feb3(0x1be)+_0x5a5e04:_0x34feb3(0x1be)+_0x5a5e04+'_reasoning_'+_0x3aa299[_0x35340c],_0x225a4e=await this[_0x34feb3(0x187)][_0x34feb3(0x21d)](_0x2fae78),_0x4c4b6f=_0x225a4e[_0x34feb3(0x153)](_0x42a7db=>_0x42a7db[_0x34feb3(0x21b)][_0x34feb3(0x160)]===_0x396dfe);if(_0x4c4b6f)return _0x4c4b6f;const _0x57c20f=_0x35340c>0x0?0x1:_0x4c9750;return await this[_0x34feb3(0x187)][_0x34feb3(0x1e0)]({'name':_0x396dfe,'projectId':_0x2fae78,'modelType':_0x5a5e04,'systemPrompt':'','temperature':_0x57c20f,'reasoningEffort':_0x35340c>0x0?_0x35340c:undefined});}catch(_0x36c707){if(_0x36c707 instanceof HTTPClientError){const _0x7a89cf=_0x36c707[_0x34feb3(0x1f1)];if(_0x7a89cf>=0x190&&_0x7a89cf<0x1f4){if(_0x7a89cf===0x191)throw new SDKError(ErrorCode[_0x34feb3(0x196)],'Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.',_0x36c707);else{if(_0x7a89cf===0x193)throw new SDKError(ErrorCode['PERMISSION_DENIED'],'Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.',_0x36c707);}throw _0x36c707;}}if(errorContains(_0x36c707,_0x34feb3(0x1fa),_0x34feb3(0x221),_0x34feb3(0x15f))){_0x4e5557++;if(_0x4e5557>=_0x4a50bf)throw new SDKError(ErrorCode[_0x34feb3(0x226)],_0x34feb3(0x1c6)+_0x4a50bf+_0x34feb3(0x1b4),_0x36c707);const _0x3dd8e9=this['getDefaultProjectName']();_0x3a32fa=_0x3dd8e9+'_'+generateRandomHex();continue;}throw _0x36c707;}}throw new SDKError(ErrorCode[_0x34feb3(0x1d0)],_0x34feb3(0x1b3));}async['resolveAgentId'](_0x17f67a,_0x5e0a1a){const _0x179b52=a102_0x1d5d3c,_0x2ad20e=_0x5e0a1a||this[_0x179b52(0x220)],_0x29d254=await this[_0x179b52(0x187)][_0x179b52(0x21d)](_0x2ad20e),_0x205b17=_0x29d254[_0x179b52(0x1df)](_0x58038d=>_0x58038d[_0x179b52(0x21b)][_0x179b52(0x160)]===_0x17f67a);if(_0x205b17[_0x179b52(0x1d6)]===0x0){const _0x1719df=_0x2ad20e?'\x20in\x20project\x20'+_0x2ad20e:'';throw new SDKError(ErrorCode[_0x179b52(0x199)],_0x179b52(0x18f)+_0x17f67a+_0x1719df,undefined,{'helpText':_0x2ad20e?'Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.':_0x179b52(0x1de)});}if(_0x205b17[_0x179b52(0x1d6)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],'Multiple\x20agents\x20found\x20with\x20name\x20\x27'+_0x17f67a+_0x179b52(0x157));return _0x205b17[0x0]['id'];}async[a102_0x1d5d3c(0x1db)](_0x48d919){const _0xf892d7=a102_0x1d5d3c,_0x5a5a51=_0x48d919||this['currentProjectId'];return await this['client'][_0xf892d7(0x21d)](_0x5a5a51);}async[a102_0x1d5d3c(0x17a)](_0x2f6c6d){const _0x15351a=a102_0x1d5d3c;return await this[_0x15351a(0x187)]['listAgentsFull'](_0x2f6c6d);}async[a102_0x1d5d3c(0x215)](_0x16ca3a){const _0x467014=a102_0x1d5d3c;return await this['client'][_0x467014(0x223)](_0x16ca3a);}async['createAgent'](_0xd4b675){const _0x5997a2=a102_0x1d5d3c;return await this[_0x5997a2(0x187)]['createAgent'](_0xd4b675);}async[a102_0x1d5d3c(0x17d)](_0x55f887,_0x41d636){const _0x7e3738=a102_0x1d5d3c;return await this['client'][_0x7e3738(0x17d)](_0x55f887,_0x41d636);}async[a102_0x1d5d3c(0x198)](_0x667c65){const _0x54da0b=a102_0x1d5d3c;await this[_0x54da0b(0x187)][_0x54da0b(0x198)](_0x667c65);}async['startChat'](_0x144d2c){const _0x5934cd=a102_0x1d5d3c;return await this[_0x5934cd(0x187)][_0x5934cd(0x1a9)]({'agentId':_0x144d2c});}async*[a102_0x1d5d3c(0x191)](_0x45b604,_0x25bb65){const _0xbdcf95=a102_0x1d5d3c;let _0x4c781e=_0x25bb65?.[_0xbdcf95(0x21a)];const _0x328aa8=_0x25bb65?.['agentId'];if(!_0x4c781e){if(!_0x328aa8)throw new Error(_0xbdcf95(0x1aa));const _0x36cee1=await this['client']['startChat']({'agentId':_0x328aa8});_0x4c781e=_0x36cee1['id'],yield{'type':_0xbdcf95(0x16a),'data':{'chatId':_0x4c781e,'agentId':_0x328aa8}};}for await(const _0x24cf6e of this[_0xbdcf95(0x187)][_0xbdcf95(0x15c)](_0x4c781e,_0x45b604,_0x25bb65?.[_0xbdcf95(0x1c2)])){yield{'type':_0xbdcf95(0x203),'data':_0x24cf6e};}}async['chats'](_0x42563a=0x32){const _0x2236df=a102_0x1d5d3c;return await this['client'][_0x2236df(0x1a8)](_0x42563a);}async['history'](_0x19220a){const _0x22970a=a102_0x1d5d3c;return await this[_0x22970a(0x187)][_0x22970a(0x209)](_0x19220a);}async[a102_0x1d5d3c(0x1c3)](_0x1b844f){const _0x4017a6=a102_0x1d5d3c;return await this[_0x4017a6(0x187)][_0x4017a6(0x158)](_0x1b844f);}async[a102_0x1d5d3c(0x14d)](_0x365d51,_0x3fa694,_0x178d94){const _0x286036=a102_0x1d5d3c,_0x25d26b=_0x178d94?.[_0x286036(0x1e9)]??![],{projectId:_0x1bef47,project:_0x3f6f5f}=await this[_0x286036(0x1fb)](_0x365d51),_0xd5c531=_0x3f6f5f[_0x286036(0x21b)][_0x286036(0x160)],_0x4b721c=_0x3fa694||_0xd5c531+_0x286036(0x1b7);if(a102_0x36a419[_0x286036(0x1a3)](_0x4b721c)&&!_0x25d26b)throw new SDKError(ErrorCode[_0x286036(0x226)],_0x286036(0x152)+_0x4b721c,undefined,{'helpText':_0x286036(0x173)});const _0x30b9bd=await this[_0x286036(0x187)][_0x286036(0x1bb)](_0x1bef47),_0x47dd2c=await this['client'][_0x286036(0x1ac)](_0x1bef47),_0x3a0842=await this[_0x286036(0x187)]['listPrompts'](_0x1bef47),_0x54331a=await this[_0x286036(0x187)][_0x286036(0x1f8)](_0x1bef47);if(!_0x25d26b){a102_0x36a419['mkdirSync'](_0x4b721c,{'recursive':!![]});const _0x3e1caa={'version':_0x286036(0x19e),'exportedAt':new Date()[_0x286036(0x179)](),'exportedFrom':{'site':this[_0x286036(0x230)][_0x286036(0x1cc)],'projectId':_0x1bef47,'projectName':_0xd5c531},'project':_0x3f6f5f};a102_0x36a419[_0x286036(0x19a)](a102_0x202167['join'](_0x4b721c,'project.json'),JSON[_0x286036(0x217)](_0x3e1caa,null,0x2)),a102_0x36a419['writeFileSync'](a102_0x202167[_0x286036(0x1d7)](_0x4b721c,_0x286036(0x1d4)),JSON[_0x286036(0x217)](_0x30b9bd,null,0x2)),a102_0x36a419[_0x286036(0x19a)](a102_0x202167[_0x286036(0x1d7)](_0x4b721c,'knowledgebases.json'),JSON[_0x286036(0x217)](_0x47dd2c,null,0x2)),a102_0x36a419[_0x286036(0x19a)](a102_0x202167[_0x286036(0x1d7)](_0x4b721c,'prompts.json'),JSON[_0x286036(0x217)](_0x3a0842,null,0x2)),a102_0x36a419[_0x286036(0x19a)](a102_0x202167['join'](_0x4b721c,_0x286036(0x1a7)),JSON['stringify'](_0x54331a,null,0x2));}return{'projectName':_0xd5c531,'outputDir':_0x4b721c,'counts':{'agents':_0x30b9bd[_0x286036(0x1d6)],'knowledgeBases':_0x47dd2c[_0x286036(0x1d6)],'prompts':_0x3a0842['length'],'integrations':_0x54331a[_0x286036(0x1d6)]}};}async[a102_0x1d5d3c(0x1ad)](_0xb0a921,_0xe29a07){const _0x3cf614=a102_0x1d5d3c,_0xc307be=_0xe29a07?.['dryRun']??![],_0x299972=this[_0x3cf614(0x213)](_0xb0a921),_0x2a4129=_0x299972['exportedFrom'][_0x3cf614(0x1cc)],_0x4a7ac2=this[_0x3cf614(0x230)]['site'],_0x2b9a6e=_0x2a4129!==_0x4a7ac2?_0x2a4129:undefined,_0x252259=this[_0x3cf614(0x1b8)](a102_0x202167[_0x3cf614(0x1d7)](_0xb0a921,_0x3cf614(0x1d4)),[]),_0x10bfca=this[_0x3cf614(0x1b8)](a102_0x202167['join'](_0xb0a921,_0x3cf614(0x165)),[]),_0x40ff9f=this[_0x3cf614(0x1b8)](a102_0x202167[_0x3cf614(0x1d7)](_0xb0a921,_0x3cf614(0x16f)),[]),_0x270bf2=this[_0x3cf614(0x1b8)](a102_0x202167[_0x3cf614(0x1d7)](_0xb0a921,_0x3cf614(0x1a7)),[]),_0x1ef0d8=_0xe29a07?.[_0x3cf614(0x160)]||_0x299972[_0x3cf614(0x16e)][_0x3cf614(0x214)];if(_0xc307be){const _0x874e65=new Map(),_0x40a1b4=[..._0x252259],_0x40f79d=_0x252259[_0x3cf614(0x1d6)]+0x1;let _0x513785=0x0;while(_0x40a1b4[_0x3cf614(0x1d6)]>0x0&&_0x513785<_0x40f79d){_0x513785++;const _0x2eb136=[];for(const _0x4c6133 of _0x40a1b4){canCreateAgent(_0x4c6133,_0x874e65)?_0x874e65[_0x3cf614(0x218)](_0x4c6133['id'],_0x3cf614(0x1e3)+_0x4c6133['id']):_0x2eb136[_0x3cf614(0x194)](_0x4c6133);}if(_0x2eb136['length']===_0x40a1b4[_0x3cf614(0x1d6)])throw new SDKError(ErrorCode[_0x3cf614(0x1d0)],_0x3cf614(0x15a),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x40a1b4['length']=0x0,_0x40a1b4[_0x3cf614(0x194)](..._0x2eb136);}const _0x3191b1=_0x40ff9f[_0x3cf614(0x1df)](_0x2a2280=>_0x874e65[_0x3cf614(0x208)](_0x2a2280[_0x3cf614(0x21b)]['agentId']))[_0x3cf614(0x1d6)];return{'projectName':_0x1ef0d8,'projectId':_0x3cf614(0x1ba),'counts':{'agents':_0x252259['length'],'knowledgeBases':_0x10bfca[_0x3cf614(0x1d6)],'prompts':_0x3191b1,'integrations':_0x270bf2[_0x3cf614(0x1d6)]},'sourceSite':_0x2b9a6e};}const _0x233cd9=await this[_0x3cf614(0x187)][_0x3cf614(0x17b)]({'name':_0x1ef0d8,'description':_0x299972[_0x3cf614(0x192)][_0x3cf614(0x21b)]['description']}),_0x316907=_0x233cd9['id'],_0x38d44e=new Map(),_0x6fcc95=new Map(),_0x3f0d92=new Map();for(const _0x37809e of _0x10bfca){const _0x322701=await this[_0x3cf614(0x187)][_0x3cf614(0x18d)]({'projectId':_0x316907,'name':_0x37809e[_0x3cf614(0x21b)][_0x3cf614(0x160)],'tdDatabaseName':_0x37809e[_0x3cf614(0x21b)][_0x3cf614(0x201)],'tables':_0x37809e['attributes']['tables']});_0x38d44e[_0x3cf614(0x218)](_0x37809e['id'],_0x322701['id']);}const _0x441971=[..._0x252259],_0x41bfc9=_0x252259['length']+0x1;let _0x4213a0=0x0;while(_0x441971['length']>0x0&&_0x4213a0<_0x41bfc9){_0x4213a0++;const _0x7f64fb=[];for(const _0x260c7c of _0x441971){if(canCreateAgent(_0x260c7c,_0x6fcc95)){const _0x3ff7d2=remapToolIds(_0x260c7c[_0x3cf614(0x21b)][_0x3cf614(0x183)],_0x38d44e,_0x6fcc95),_0x30af05=remapVariableIds(_0x260c7c[_0x3cf614(0x21b)]['variables'],_0x38d44e),_0x1ad097=await this[_0x3cf614(0x187)][_0x3cf614(0x1ec)]({'name':_0x260c7c[_0x3cf614(0x21b)][_0x3cf614(0x160)],'projectId':_0x316907,'systemPrompt':_0x260c7c[_0x3cf614(0x21b)][_0x3cf614(0x159)],'starterMessage':_0x260c7c[_0x3cf614(0x21b)]['starterMessage'],'modelType':migrateModelType(_0x260c7c[_0x3cf614(0x21b)][_0x3cf614(0x1ff)]),'maxToolIterations':_0x260c7c[_0x3cf614(0x21b)][_0x3cf614(0x229)],'temperature':_0x260c7c[_0x3cf614(0x21b)][_0x3cf614(0x1dc)],'reasoningEffort':_0x260c7c[_0x3cf614(0x21b)][_0x3cf614(0x18c)],'outputs':_0x260c7c['attributes']['outputs'],'tools':_0x3ff7d2,'variables':_0x30af05});_0x6fcc95[_0x3cf614(0x218)](_0x260c7c['id'],_0x1ad097['id']);}else _0x7f64fb[_0x3cf614(0x194)](_0x260c7c);}if(_0x7f64fb[_0x3cf614(0x1d6)]===_0x441971[_0x3cf614(0x1d6)])throw new SDKError(ErrorCode['INTERNAL'],_0x3cf614(0x15a),undefined,{'helpText':_0x3cf614(0x1ae)});_0x441971[_0x3cf614(0x1d6)]=0x0,_0x441971[_0x3cf614(0x194)](..._0x7f64fb);}for(const _0x4faf03 of _0x40ff9f){const _0x217545=_0x6fcc95[_0x3cf614(0x1fe)](_0x4faf03[_0x3cf614(0x21b)][_0x3cf614(0x1c1)]);if(!_0x217545)continue;const _0xe2b53c=await this[_0x3cf614(0x187)][_0x3cf614(0x231)]({'projectId':_0x316907,'agentId':_0x217545,'name':_0x4faf03['attributes'][_0x3cf614(0x160)],'systemPrompt':_0x4faf03[_0x3cf614(0x21b)][_0x3cf614(0x159)],'template':_0x4faf03[_0x3cf614(0x21b)][_0x3cf614(0x1b9)],'jsonSchemaHint':_0x4faf03[_0x3cf614(0x21b)][_0x3cf614(0x21f)]});_0x3f0d92[_0x3cf614(0x218)](_0x4faf03['id'],_0xe2b53c['id']);}for(const _0xd9ba53 of _0x270bf2){const _0xd54e33=_0xd9ba53['attributes'][_0x3cf614(0x145)]['map'](_0x1f6497=>({..._0x1f6497,'promptId':_0x3f0d92[_0x3cf614(0x1fe)](_0x1f6497['promptId'])||_0x1f6497['promptId']}));await this[_0x3cf614(0x187)][_0x3cf614(0x1af)]({'projectId':_0x316907,'serviceType':_0xd9ba53[_0x3cf614(0x21b)][_0x3cf614(0x147)],'actions':_0xd54e33,'slackMessageMode':_0xd9ba53[_0x3cf614(0x21b)][_0x3cf614(0x1f4)],'chatIgnoreManagedActions':_0xd9ba53['attributes'][_0x3cf614(0x22d)],'chatWelcomeMessage':_0xd9ba53[_0x3cf614(0x21b)][_0x3cf614(0x1c5)],'webhookCorsOrigins':_0xd9ba53['attributes']['webhookCorsOrigins']});}return{'projectName':_0x1ef0d8,'projectId':_0x316907,'counts':{'agents':_0x6fcc95[_0x3cf614(0x17c)],'knowledgeBases':_0x38d44e[_0x3cf614(0x17c)],'prompts':_0x3f0d92[_0x3cf614(0x17c)],'integrations':_0x270bf2[_0x3cf614(0x1d6)]},'sourceSite':_0x2b9a6e};}[a102_0x1d5d3c(0x1b8)](_0x219763,_0x49b2cb){const _0x4df9d7=a102_0x1d5d3c;if(!a102_0x36a419['existsSync'](_0x219763))return _0x49b2cb;return JSON['parse'](a102_0x36a419[_0x4df9d7(0x164)](_0x219763,_0x4df9d7(0x1ee)));}[a102_0x1d5d3c(0x213)](_0x55918a){const _0x1edac7=a102_0x1d5d3c;if(!a102_0x36a419['existsSync'](_0x55918a))throw new SDKError(ErrorCode[_0x1edac7(0x193)],_0x1edac7(0x188)+_0x55918a,undefined,{'helpText':'Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.'});const _0x532963=a102_0x202167['join'](_0x55918a,_0x1edac7(0x167));if(!a102_0x36a419[_0x1edac7(0x1a3)](_0x532963))throw new SDKError(ErrorCode[_0x1edac7(0x1a1)],_0x1edac7(0x1f2)+_0x55918a,undefined,{'helpText':_0x1edac7(0x195)});const _0x304fae=JSON[_0x1edac7(0x1c0)](a102_0x36a419[_0x1edac7(0x164)](_0x532963,_0x1edac7(0x1ee)));if(!isSupportedBackupVersion(_0x304fae[_0x1edac7(0x22f)]))throw new SDKError(ErrorCode[_0x1edac7(0x1a1)],_0x1edac7(0x172)+_0x304fae[_0x1edac7(0x22f)],undefined,{'helpText':_0x1edac7(0x224)});return _0x304fae;}async[a102_0x1d5d3c(0x1ca)](_0x29b34d,_0x1c321c,_0x3b167b){const _0x1c31c4=a102_0x1d5d3c,{projectId:_0x4668ca,project:_0x2a962f}=await this[_0x1c31c4(0x1fb)](_0x29b34d),_0x707270=_0x2a962f['attributes'][_0x1c31c4(0x160)];let _0x3a103e;if(_0x1c321c)_0x3a103e=_0x1c321c;else{const _0x2f42e6=a102_0x202167[_0x1c31c4(0x1d7)](process[_0x1c31c4(0x1d2)](),'agents'),_0x14e412=getSanitizedPathWithMigration(_0x2f42e6,_0x707270);_0x14e412[_0x1c31c4(0x17e)]&&this[_0x1c31c4(0x14a)][_0x1c31c4(0x1c9)]('Renamed\x20folder:\x20'+a102_0x202167[_0x1c31c4(0x19c)](_0x14e412['oldPath'])+_0x1c31c4(0x197)+a102_0x202167[_0x1c31c4(0x19c)](_0x14e412[_0x1c31c4(0x1c4)])),_0x3a103e=_0x14e412[_0x1c31c4(0x1c4)];}const _0x4d82ca=await this[_0x1c31c4(0x187)][_0x1c31c4(0x1bb)](_0x4668ca),_0x3a7c01=await this[_0x1c31c4(0x187)]['listKnowledgeBases'](_0x4668ca),_0x211618=await this[_0x1c31c4(0x187)][_0x1c31c4(0x22b)](_0x4668ca),_0x396b92=await this[_0x1c31c4(0x187)][_0x1c31c4(0x216)](_0x4668ca),_0x29552c=await this[_0x1c31c4(0x187)]['listWebSearchTools'](_0x4668ca),_0x100bb0=await this[_0x1c31c4(0x187)][_0x1c31c4(0x161)](_0x4668ca),_0x5700e7=await this[_0x1c31c4(0x187)][_0x1c31c4(0x1f8)](_0x4668ca),_0x452497=_0x5700e7[_0x1c31c4(0x1df)](_0x335a4d=>!_0x335a4d[_0x1c31c4(0x21b)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x1c31c4(0x169)](_0x335a4d['attributes'][_0x1c31c4(0x147)][_0x1c31c4(0x175)]())),_0x370e95=new Map(),_0x19ae06=new Map(),_0x5e0371=new Map(),_0x39a6af=new Map(),_0x15a867=new Map(),_0x200173=new Map();for(const _0x3e4039 of _0x4d82ca){_0x370e95[_0x1c31c4(0x218)](_0x3e4039['id'],_0x3e4039[_0x1c31c4(0x21b)][_0x1c31c4(0x160)]);}for(const _0x3dbc2c of _0x3a7c01){_0x19ae06[_0x1c31c4(0x218)](_0x3dbc2c['id'],_0x3dbc2c['attributes'][_0x1c31c4(0x160)]);}for(const _0x3dc6c0 of _0x211618){_0x5e0371['set'](_0x3dc6c0['id'],_0x3dc6c0[_0x1c31c4(0x21b)][_0x1c31c4(0x160)]);}for(const _0x4eea20 of _0x396b92){_0x39a6af[_0x1c31c4(0x218)](_0x4eea20['id'],_0x4eea20[_0x1c31c4(0x21b)][_0x1c31c4(0x160)]);}for(const _0xf9b843 of _0x29552c){_0x15a867[_0x1c31c4(0x218)](_0xf9b843['id'],_0xf9b843[_0x1c31c4(0x21b)]['name']);}for(const _0xa17e52 of _0x100bb0){_0x200173['set'](_0xa17e52['id'],_0xa17e52['attributes'][_0x1c31c4(0x160)]);}const _0x5306cf={'resolveKnowledgeBaseName':async _0x2a65b9=>_0x19ae06[_0x1c31c4(0x1fe)](_0x2a65b9),'resolveTextKnowledgeBaseName':async _0x2283a7=>_0x5e0371[_0x1c31c4(0x1fe)](_0x2283a7),'resolveAgentName':async _0x49c6d5=>_0x370e95[_0x1c31c4(0x1fe)](_0x49c6d5),'resolveWebSearchToolName':async _0x1a1f8b=>_0x15a867[_0x1c31c4(0x1fe)](_0x1a1f8b),'resolveImageGeneratorName':async _0x356a92=>_0x39a6af[_0x1c31c4(0x1fe)](_0x356a92),'resolvePromptName':async _0x1c9f26=>_0x200173[_0x1c31c4(0x1fe)](_0x1c9f26),'onWarning':_0x16c657=>this['logger'][_0x1c31c4(0x178)](_0x16c657)},_0x41b6fe={'projectName':_0x707270,'outputDir':_0x3a103e,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'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}}},_0x40cd9d=[];for(const _0x5d2fe3 of _0x4d82ca){const _0x20e651=getSanitizedPathWithMigration(_0x3a103e,_0x5d2fe3[_0x1c31c4(0x21b)][_0x1c31c4(0x160)]);_0x20e651[_0x1c31c4(0x17e)]&&this[_0x1c31c4(0x14a)]['info'](_0x1c31c4(0x206)+a102_0x202167[_0x1c31c4(0x19c)](_0x20e651[_0x1c31c4(0x18e)])+_0x1c31c4(0x197)+a102_0x202167['basename'](_0x20e651[_0x1c31c4(0x1c4)]));const _0x5d3eda=_0x20e651[_0x1c31c4(0x1c4)],_0x57faf9=a102_0x202167[_0x1c31c4(0x1d7)](_0x5d3eda,_0x1c31c4(0x148)),_0x566d69=a102_0x202167[_0x1c31c4(0x1d7)](_0x5d3eda,_0x1c31c4(0x156)),_0x24f22c=a102_0x202167[_0x1c31c4(0x1d7)](_0x5d3eda,'starter_message.md'),{yaml:_0x2dce7a,systemPrompt:_0x562167,starterMessage:_0x1c246f}=await agentResponseToDef(_0x5d2fe3,_0x5306cf),_0x33b861=toAgentYamlString(_0x2dce7a),_0x4b64d3=!a102_0x36a419[_0x1c31c4(0x1a3)](_0x566d69);let _0x423c1d=_0x4b64d3,_0x363c2c;if(!_0x4b64d3){const _0x4795ab=a102_0x36a419[_0x1c31c4(0x1a3)](_0x57faf9)?a102_0x36a419[_0x1c31c4(0x164)](_0x57faf9,_0x1c31c4(0x1ee)):'',_0x39fbd4=a102_0x36a419[_0x1c31c4(0x164)](_0x566d69,_0x1c31c4(0x1ee)),_0xeec0cc=_0x1c31c4(0x1e1)+_0x4795ab+_0x1c31c4(0x1cb)+_0x39fbd4,_0xb58643=_0x1c31c4(0x1e1)+_0x562167+_0x1c31c4(0x1cb)+_0x33b861,_0x160f98=generateDiff(_0xeec0cc,_0xb58643);_0x423c1d=hasChanges(_0x160f98),_0x423c1d&&(_0x363c2c=formatDiffWithColors(_0x160f98));}_0x40cd9d[_0x1c31c4(0x194)]({'path':_0x5d3eda,'content':'','isDir':!![]}),_0x40cd9d['push']({'path':_0x57faf9,'content':_0x562167}),_0x40cd9d[_0x1c31c4(0x194)]({'path':_0x566d69,'content':_0x33b861});_0x1c246f&&_0x1c246f[_0x1c31c4(0x169)]('\x0a')&&_0x40cd9d[_0x1c31c4(0x194)]({'path':_0x24f22c,'content':_0x1c246f});_0x41b6fe[_0x1c31c4(0x1db)]['push']({'agentName':_0x5d2fe3[_0x1c31c4(0x21b)][_0x1c31c4(0x160)],'outputPath':_0x5d3eda,'isNew':_0x4b64d3,'hasChanges':_0x423c1d,'diff':_0x363c2c}),_0x41b6fe[_0x1c31c4(0x1fc)][_0x1c31c4(0x1db)]['total']++;if(_0x4b64d3)_0x41b6fe[_0x1c31c4(0x1fc)][_0x1c31c4(0x1db)][_0x1c31c4(0x205)]++;else{if(_0x423c1d)_0x41b6fe[_0x1c31c4(0x1fc)][_0x1c31c4(0x1db)]['updated']++;else _0x41b6fe['counts'][_0x1c31c4(0x1db)]['unchanged']++;}}for(const _0x47d250 of _0x3a7c01){if(_0x47d250[_0x1c31c4(0x21b)][_0x1c31c4(0x1b0)])continue;const _0x1abefc=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x3a103e),_0x47d250[_0x1c31c4(0x21b)][_0x1c31c4(0x160)],_0x1c31c4(0x15b));_0x1abefc['renamed']&&this[_0x1c31c4(0x14a)][_0x1c31c4(0x1c9)](_0x1c31c4(0x210)+a102_0x202167['basename'](_0x1abefc['oldPath'])+_0x1c31c4(0x197)+a102_0x202167[_0x1c31c4(0x19c)](_0x1abefc[_0x1c31c4(0x1c4)]));const _0x18f7ef=_0x1abefc['path'],_0x3d588d=apiKnowledgeBaseToYaml(_0x47d250),_0x5ae5f8=toKnowledgeBaseYamlString(_0x3d588d),_0x4e7c59=!a102_0x36a419[_0x1c31c4(0x1a3)](_0x18f7ef);let _0x580f6b=_0x4e7c59,_0x46ba3a;if(!_0x4e7c59){const _0x4ff7c5=a102_0x36a419[_0x1c31c4(0x164)](_0x18f7ef,_0x1c31c4(0x1ee)),_0x2d02b5=generateDiff(_0x4ff7c5,_0x5ae5f8);_0x580f6b=hasChanges(_0x2d02b5),_0x580f6b&&(_0x46ba3a=formatDiffWithColors(_0x2d02b5));}_0x40cd9d[_0x1c31c4(0x194)]({'path':_0x18f7ef,'content':_0x5ae5f8}),_0x41b6fe[_0x1c31c4(0x17f)]['push']({'name':_0x47d250[_0x1c31c4(0x21b)][_0x1c31c4(0x160)],'outputPath':_0x18f7ef,'isNew':_0x4e7c59,'hasChanges':_0x580f6b,'diff':_0x46ba3a}),_0x41b6fe[_0x1c31c4(0x1fc)][_0x1c31c4(0x17f)][_0x1c31c4(0x186)]++;if(_0x4e7c59)_0x41b6fe[_0x1c31c4(0x1fc)]['knowledgeBases']['new']++;else{if(_0x580f6b)_0x41b6fe['counts'][_0x1c31c4(0x17f)]['updated']++;else _0x41b6fe[_0x1c31c4(0x1fc)][_0x1c31c4(0x17f)][_0x1c31c4(0x232)]++;}}for(const _0x5d27ed of _0x211618){if(_0x5d27ed['attributes']['isManaged'])continue;const _0x5598c4=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x3a103e),_0x5d27ed[_0x1c31c4(0x21b)][_0x1c31c4(0x160)],_0x1c31c4(0x1ea));_0x5598c4[_0x1c31c4(0x17e)]&&this['logger'][_0x1c31c4(0x1c9)](_0x1c31c4(0x149)+a102_0x202167['basename'](_0x5598c4[_0x1c31c4(0x18e)])+_0x1c31c4(0x197)+a102_0x202167['basename'](_0x5598c4[_0x1c31c4(0x1c4)]));const _0x1ea734=_0x5598c4['path'],_0x4cc6d9=toTextKnowledgeBaseMd(_0x5d27ed[_0x1c31c4(0x21b)][_0x1c31c4(0x160)],_0x5d27ed[_0x1c31c4(0x21b)][_0x1c31c4(0x1ef)]),_0x1ff9e2=!a102_0x36a419[_0x1c31c4(0x1a3)](_0x1ea734);let _0x43df37=_0x1ff9e2,_0x38f9c5;if(!_0x1ff9e2){const _0x398541=a102_0x36a419['readFileSync'](_0x1ea734,'utf-8'),_0x5ac18f=generateDiff(_0x398541,_0x4cc6d9);_0x43df37=hasChanges(_0x5ac18f),_0x43df37&&(_0x38f9c5=formatDiffWithColors(_0x5ac18f));}_0x40cd9d[_0x1c31c4(0x194)]({'path':_0x1ea734,'content':_0x4cc6d9}),_0x41b6fe[_0x1c31c4(0x163)][_0x1c31c4(0x194)]({'name':_0x5d27ed[_0x1c31c4(0x21b)]['name'],'outputPath':_0x1ea734,'isNew':_0x1ff9e2,'hasChanges':_0x43df37,'diff':_0x38f9c5}),_0x41b6fe[_0x1c31c4(0x1fc)]['textKnowledgeBases']['total']++;if(_0x1ff9e2)_0x41b6fe[_0x1c31c4(0x1fc)][_0x1c31c4(0x163)][_0x1c31c4(0x205)]++;else{if(_0x43df37)_0x41b6fe[_0x1c31c4(0x1fc)]['textKnowledgeBases'][_0x1c31c4(0x1bc)]++;else _0x41b6fe[_0x1c31c4(0x1fc)]['textKnowledgeBases'][_0x1c31c4(0x232)]++;}}for(const _0x5aca22 of _0x100bb0){if(_0x5aca22['attributes'][_0x1c31c4(0x1b0)])continue;const _0x2a8b1e=getSanitizedPathWithMigration(getPromptsDir(_0x3a103e),_0x5aca22['attributes'][_0x1c31c4(0x160)],_0x1c31c4(0x15b));_0x2a8b1e['renamed']&&this[_0x1c31c4(0x14a)][_0x1c31c4(0x1c9)]('Renamed\x20prompt\x20file:\x20'+a102_0x202167[_0x1c31c4(0x19c)](_0x2a8b1e[_0x1c31c4(0x18e)])+_0x1c31c4(0x197)+a102_0x202167[_0x1c31c4(0x19c)](_0x2a8b1e[_0x1c31c4(0x1c4)]));const _0x4fc661=_0x2a8b1e['path'],_0x664fc5=await apiPromptToYaml(_0x5aca22,_0x5306cf);if(!_0x664fc5)continue;const _0x187ff5=toPromptYamlString(_0x664fc5),_0x5425e9=!a102_0x36a419['existsSync'](_0x4fc661);let _0x1c47d4=_0x5425e9,_0x1ed639;if(!_0x5425e9){const _0x265d04=a102_0x36a419[_0x1c31c4(0x164)](_0x4fc661,_0x1c31c4(0x1ee)),_0x4771ae=generateDiff(_0x265d04,_0x187ff5);_0x1c47d4=hasChanges(_0x4771ae),_0x1c47d4&&(_0x1ed639=formatDiffWithColors(_0x4771ae));}_0x40cd9d[_0x1c31c4(0x194)]({'path':_0x4fc661,'content':_0x187ff5}),_0x41b6fe['prompts'][_0x1c31c4(0x194)]({'name':_0x5aca22['attributes'][_0x1c31c4(0x160)],'outputPath':_0x4fc661,'isNew':_0x5425e9,'hasChanges':_0x1c47d4,'diff':_0x1ed639}),_0x41b6fe['counts'][_0x1c31c4(0x162)]['total']++;if(_0x5425e9)_0x41b6fe['counts']['prompts'][_0x1c31c4(0x205)]++;else{if(_0x1c47d4)_0x41b6fe[_0x1c31c4(0x1fc)][_0x1c31c4(0x162)][_0x1c31c4(0x1bc)]++;else _0x41b6fe[_0x1c31c4(0x1fc)][_0x1c31c4(0x162)][_0x1c31c4(0x232)]++;}}for(const _0x4c0b48 of _0x452497){const _0xf757a9=_0x4c0b48['attributes'][_0x1c31c4(0x147)][_0x1c31c4(0x175)](),_0x1b9251=getSanitizedPathWithMigration(getIntegrationsDir(_0x3a103e),_0xf757a9,_0x1c31c4(0x15b));_0x1b9251[_0x1c31c4(0x17e)]&&this['logger'][_0x1c31c4(0x1c9)](_0x1c31c4(0x16d)+a102_0x202167[_0x1c31c4(0x19c)](_0x1b9251['oldPath'])+_0x1c31c4(0x197)+a102_0x202167['basename'](_0x1b9251['path']));const _0x54ea46=_0x1b9251['path'],_0x440e50=await apiIntegrationToYaml(_0x4c0b48,_0x5306cf),_0x785c96=toIntegrationYamlString(_0x440e50),_0x196c88=!a102_0x36a419['existsSync'](_0x54ea46);let _0x5735db=_0x196c88,_0x4e886e;if(!_0x196c88){const _0x26f086=a102_0x36a419[_0x1c31c4(0x164)](_0x54ea46,_0x1c31c4(0x1ee)),_0x2ae6c7=generateDiff(_0x26f086,_0x785c96);_0x5735db=hasChanges(_0x2ae6c7),_0x5735db&&(_0x4e886e=formatDiffWithColors(_0x2ae6c7));}_0x40cd9d[_0x1c31c4(0x194)]({'path':_0x54ea46,'content':_0x785c96}),_0x41b6fe['integrations']['push']({'name':_0xf757a9,'outputPath':_0x54ea46,'isNew':_0x196c88,'hasChanges':_0x5735db,'diff':_0x4e886e}),_0x41b6fe[_0x1c31c4(0x1fc)][_0x1c31c4(0x14e)][_0x1c31c4(0x186)]++;if(_0x196c88)_0x41b6fe['counts']['integrations'][_0x1c31c4(0x205)]++;else{if(_0x5735db)_0x41b6fe['counts']['integrations']['updated']++;else _0x41b6fe[_0x1c31c4(0x1fc)][_0x1c31c4(0x14e)][_0x1c31c4(0x232)]++;}}if(_0x3b167b?.['dryRun'])return _0x41b6fe;a102_0x36a419['mkdirSync'](_0x3a103e,{'recursive':!![]}),a102_0x36a419[_0x1c31c4(0x1c8)](getKnowledgeBasesDir(_0x3a103e),{'recursive':!![]}),a102_0x36a419['mkdirSync'](getPromptsDir(_0x3a103e),{'recursive':!![]}),a102_0x36a419[_0x1c31c4(0x1c8)](getIntegrationsDir(_0x3a103e),{'recursive':!![]});const _0x3b5afa=a102_0x202167[_0x1c31c4(0x1d7)](_0x3a103e,_0x1c31c4(0x14b));a102_0x36a419[_0x1c31c4(0x19a)](_0x3b5afa,createAgentConfigContent(_0x707270));for(const _0x10aa8f of _0x40cd9d){if(_0x10aa8f['isDir'])a102_0x36a419[_0x1c31c4(0x1c8)](_0x10aa8f[_0x1c31c4(0x1c4)],{'recursive':!![]});else{const _0x3cb62c=a102_0x202167[_0x1c31c4(0x1f0)](_0x10aa8f[_0x1c31c4(0x1c4)]);!a102_0x36a419['existsSync'](_0x3cb62c)&&a102_0x36a419[_0x1c31c4(0x1c8)](_0x3cb62c,{'recursive':!![]}),a102_0x36a419['writeFileSync'](_0x10aa8f[_0x1c31c4(0x1c4)],_0x10aa8f['content']);}}return _0x41b6fe;}async[a102_0x1d5d3c(0x1e2)](_0x415965,_0x424b6d){const _0x16f540=a102_0x1d5d3c,_0x5c8d5e=a102_0x202167[_0x16f540(0x1d7)](_0x415965,_0x16f540(0x14b));if(!a102_0x36a419[_0x16f540(0x1a3)](_0x5c8d5e))throw new SDKError(ErrorCode[_0x16f540(0x1a1)],'No\x20tdx.json\x20found\x20in\x20'+_0x415965,undefined,{'helpText':_0x16f540(0x18a)});const _0x44351b=loadAgentConfig(_0x5c8d5e),_0x8ab963=await this['resolveProjectId'](_0x44351b[_0x16f540(0x1dd)]),_0x277a2d=await this[_0x16f540(0x187)]['getProject'](_0x8ab963),_0x2209dc=_0x277a2d[_0x16f540(0x21b)]['name'],_0x5c5f8b={'projectName':_0x2209dc,'projectId':_0x8ab963,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'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},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x472273=[],_0x2b4756=[],_0x2b109f=[],_0x29fde9=[],_0x44bf56=a102_0x36a419[_0x16f540(0x228)](_0x415965,{'withFileTypes':!![]});for(const _0x549cbc of _0x44bf56){if(!_0x549cbc[_0x16f540(0x204)]())continue;if([_0x16f540(0x151),_0x16f540(0x162),_0x16f540(0x14e)][_0x16f540(0x169)](_0x549cbc[_0x16f540(0x160)]))continue;const _0x1a12ea=a102_0x202167[_0x16f540(0x1d7)](_0x415965,_0x549cbc[_0x16f540(0x160)]);if(isAgentDir(_0x1a12ea)){const _0x11615d=a102_0x202167[_0x16f540(0x1d7)](_0x1a12ea,'agent.yml'),_0x361113=a102_0x202167[_0x16f540(0x1d7)](_0x1a12ea,_0x16f540(0x148)),_0x351ad3=a102_0x202167[_0x16f540(0x1d7)](_0x1a12ea,_0x16f540(0x1d8)),_0x4de6d4=parseAgentYaml(a102_0x36a419['readFileSync'](_0x11615d,_0x16f540(0x1ee)),_0x11615d),_0x3377e2=a102_0x36a419['existsSync'](_0x361113)?a102_0x36a419[_0x16f540(0x164)](_0x361113,_0x16f540(0x1ee)):'',_0x5f36bd=a102_0x36a419[_0x16f540(0x1a3)](_0x351ad3)?a102_0x36a419['readFileSync'](_0x351ad3,_0x16f540(0x1ee)):_0x4de6d4[_0x16f540(0x1b6)];_0x472273['push']({'name':_0x4de6d4['name'],'dir':_0x1a12ea,'yaml':_0x4de6d4,'systemPrompt':_0x3377e2,'starterMessage':_0x5f36bd});}}const _0x35feb0=getKnowledgeBasesDir(_0x415965);if(a102_0x36a419[_0x16f540(0x1a3)](_0x35feb0)){const _0x8453fe=a102_0x36a419[_0x16f540(0x228)](_0x35feb0);for(const _0x209703 of _0x8453fe){const _0x395c05=a102_0x202167['join'](_0x35feb0,_0x209703);if(_0x209703[_0x16f540(0x15d)](_0x16f540(0x15b))){const _0x4548de=parseKnowledgeBaseYaml(a102_0x36a419[_0x16f540(0x164)](_0x395c05,_0x16f540(0x1ee)),_0x395c05);_0x2b4756['push']({'name':_0x4548de['name'],'path':_0x395c05,'yaml':_0x4548de});}else{if(_0x209703[_0x16f540(0x15d)](_0x16f540(0x1ea))){const _0x2f3ba6=a102_0x36a419[_0x16f540(0x164)](_0x395c05,'utf-8'),{name:_0xa59ec0,text:_0x463953}=parseTextKnowledgeBaseMd(_0x2f3ba6,_0x209703);_0x2b109f[_0x16f540(0x194)]({'name':_0xa59ec0,'path':_0x395c05,'text':_0x463953});}}}}const _0x4969c0=getPromptsDir(_0x415965);if(a102_0x36a419['existsSync'](_0x4969c0)){const _0x17a7c4=a102_0x36a419['readdirSync'](_0x4969c0)['filter'](_0x5b1630=>_0x5b1630[_0x16f540(0x15d)]('.yml'));for(const _0xde0b85 of _0x17a7c4){const _0xa09eb3=a102_0x202167[_0x16f540(0x1d7)](_0x4969c0,_0xde0b85),_0x3067ac=parsePromptYaml(a102_0x36a419[_0x16f540(0x164)](_0xa09eb3,_0x16f540(0x1ee)),_0xa09eb3);_0x29fde9[_0x16f540(0x194)]({'name':_0x3067ac[_0x16f540(0x160)],'path':_0xa09eb3,'yaml':_0x3067ac});}}const _0x23c6d8=[],_0x569dc6=getIntegrationsDir(_0x415965);if(a102_0x36a419[_0x16f540(0x1a3)](_0x569dc6)){const _0x938655=a102_0x36a419['readdirSync'](_0x569dc6)[_0x16f540(0x1df)](_0x5c1e0c=>_0x5c1e0c[_0x16f540(0x15d)](_0x16f540(0x15b)));for(const _0x46bf40 of _0x938655){const _0x508be2=a102_0x202167[_0x16f540(0x1d7)](_0x569dc6,_0x46bf40),_0x1a7e9b=parseIntegrationYaml(a102_0x36a419[_0x16f540(0x164)](_0x508be2,'utf-8'),_0x508be2);if(!SAFE_INTEGRATION_TYPES[_0x16f540(0x169)](_0x1a7e9b[_0x16f540(0x202)]['toLowerCase']())){this[_0x16f540(0x14a)][_0x16f540(0x178)](_0x16f540(0x146)+_0x1a7e9b[_0x16f540(0x160)]+'\x27\x20('+_0x1a7e9b['service_type']+_0x16f540(0x1a2)+(_0x16f540(0x15e)+SAFE_INTEGRATION_TYPES[_0x16f540(0x1d7)](',\x20')+_0x16f540(0x1eb))+_0x16f540(0x1b1));continue;}_0x23c6d8[_0x16f540(0x194)]({'name':_0x1a7e9b[_0x16f540(0x160)],'path':_0x508be2,'yaml':_0x1a7e9b});}}const _0x3733e4=await this[_0x16f540(0x187)]['listAgentsFull'](_0x8ab963),_0x557cbf=await this[_0x16f540(0x187)][_0x16f540(0x1ac)](_0x8ab963),_0x33ce70=await this[_0x16f540(0x187)][_0x16f540(0x22b)](_0x8ab963),_0x2d7987=await this[_0x16f540(0x187)][_0x16f540(0x216)](_0x8ab963),_0x1ecb34=await this['client'][_0x16f540(0x181)](_0x8ab963),_0x55ce98=await this[_0x16f540(0x187)]['listPrompts'](_0x8ab963),_0xd85b52=await this[_0x16f540(0x187)]['listIntegrations'](_0x8ab963),_0x19002d=await this[_0x16f540(0x187)][_0x16f540(0x182)](_0x8ab963),_0x3235ea=new Map(),_0x27b242=new Map(),_0x5405f5=new Map(),_0x5952f2=new Map(),_0x4f483f=new Map();for(const _0x78055b of _0x3733e4){_0x3235ea[_0x16f540(0x218)](_0x78055b[_0x16f540(0x21b)][_0x16f540(0x160)],_0x78055b);}for(const _0x42ab57 of _0x557cbf){_0x27b242['set'](_0x42ab57[_0x16f540(0x21b)][_0x16f540(0x160)],_0x42ab57);}for(const _0x40c719 of _0x33ce70){_0x5405f5[_0x16f540(0x218)](_0x40c719['attributes']['name'],_0x40c719);}for(const _0x17f3e3 of _0x55ce98){_0x5952f2[_0x16f540(0x218)](_0x17f3e3[_0x16f540(0x21b)][_0x16f540(0x160)],_0x17f3e3);}for(const _0x3c4c60 of _0xd85b52){_0x4f483f['set'](_0x3c4c60[_0x16f540(0x21b)][_0x16f540(0x147)][_0x16f540(0x175)](),_0x3c4c60);}const _0xb862dd=new Map(),_0x4d3c00=new Map(),_0x5130aa=new Map(),_0xd8324c=new Map(),_0x69f639=new Map(),_0x1b507f=new Map(),_0x195eeb=new Map(),_0x3c8ac1=new Map(),_0xae5130=new Map(),_0x50bde5=new Map(),_0x116860=new Map(),_0xbda7d3=new Map();for(const _0x1cea67 of _0x557cbf){_0xb862dd[_0x16f540(0x218)](_0x1cea67[_0x16f540(0x21b)]['name'],_0x1cea67['id']),_0x195eeb[_0x16f540(0x218)](_0x1cea67['id'],_0x1cea67[_0x16f540(0x21b)][_0x16f540(0x160)]);}for(const _0x26e29b of _0x33ce70){_0x4d3c00['set'](_0x26e29b[_0x16f540(0x21b)][_0x16f540(0x160)],_0x26e29b['id']),_0x3c8ac1[_0x16f540(0x218)](_0x26e29b['id'],_0x26e29b['attributes'][_0x16f540(0x160)]);}for(const _0x5e0690 of _0x3733e4){_0x5130aa[_0x16f540(0x218)](_0x5e0690[_0x16f540(0x21b)][_0x16f540(0x160)],_0x5e0690['id']),_0xae5130[_0x16f540(0x218)](_0x5e0690['id'],_0x5e0690[_0x16f540(0x21b)]['name']);}for(const _0x3f8ddb of _0x2d7987){_0xd8324c[_0x16f540(0x218)](_0x3f8ddb[_0x16f540(0x21b)][_0x16f540(0x160)],_0x3f8ddb['id']),_0x50bde5[_0x16f540(0x218)](_0x3f8ddb['id'],_0x3f8ddb[_0x16f540(0x21b)][_0x16f540(0x160)]);}for(const _0x356cf0 of _0x1ecb34){_0x69f639[_0x16f540(0x218)](_0x356cf0['attributes'][_0x16f540(0x160)],_0x356cf0['id']),_0x116860['set'](_0x356cf0['id'],_0x356cf0[_0x16f540(0x21b)][_0x16f540(0x160)]);}for(const _0x5604f2 of _0x55ce98){_0x1b507f[_0x16f540(0x218)](_0x5604f2[_0x16f540(0x21b)][_0x16f540(0x160)],_0x5604f2['id']),_0xbda7d3['set'](_0x5604f2['id'],_0x5604f2['attributes'][_0x16f540(0x160)]);}const _0x189874={'resolveKnowledgeBaseName':async _0x43e4b4=>_0x195eeb['get'](_0x43e4b4),'resolveTextKnowledgeBaseName':async _0x12c1ce=>_0x3c8ac1['get'](_0x12c1ce),'resolveAgentName':async _0x48dfe4=>_0xae5130[_0x16f540(0x1fe)](_0x48dfe4),'resolveWebSearchToolName':async _0x4ca5f4=>_0x116860[_0x16f540(0x1fe)](_0x4ca5f4),'resolveImageGeneratorName':async _0x7c435c=>_0x50bde5[_0x16f540(0x1fe)](_0x7c435c),'resolvePromptName':async _0x5a008a=>_0xbda7d3[_0x16f540(0x1fe)](_0x5a008a),'onWarning':_0x35e133=>this['logger'][_0x16f540(0x178)](_0x35e133)};let _0x34b405=[];const _0x15e741={'projectId':_0x8ab963,'resolveKnowledgeBaseId':async _0x2ce4b3=>_0xb862dd[_0x16f540(0x1fe)](_0x2ce4b3),'resolveTextKnowledgeBaseId':async _0x56d3ef=>_0x4d3c00[_0x16f540(0x1fe)](_0x56d3ef),'resolveAgentId':async _0x2b2e43=>_0x5130aa[_0x16f540(0x1fe)](_0x2b2e43),'resolveWebSearchToolId':async _0x16334a=>_0x69f639[_0x16f540(0x1fe)](_0x16334a),'resolveImageGeneratorId':async _0x324821=>_0xd8324c[_0x16f540(0x1fe)](_0x324821),'resolvePromptId':async _0xba9e3c=>_0x1b507f[_0x16f540(0x1fe)](_0xba9e3c),'resolveParentSegmentKBId':async()=>_0x19002d?.['id'],'onWarning':_0x49e279=>{const _0x38d59f=_0x16f540;this[_0x38d59f(0x14a)]['warn'](_0x49e279),_0x34b405[_0x38d59f(0x194)](_0x49e279);}},{resolved:_0x1db8e1,unresolved:_0x2ab39}=resolveAgentDependencies(_0x472273,new Set(_0x3235ea[_0x16f540(0x1d1)]()));for(const {agent:_0x147b2e,missingDeps:_0x565788}of _0x2ab39){_0x5c5f8b['agents'][_0x16f540(0x194)]({'agentName':_0x147b2e['yaml'][_0x16f540(0x160)],'action':_0x16f540(0x1f9),'error':_0x16f540(0x1a5)+_0x565788[_0x16f540(0x1d7)](',\x20')+_0x16f540(0x1d9)}),_0x5c5f8b['counts']['agents'][_0x16f540(0x150)]++;}for(const _0x269b1d of _0x2b4756){const _0x2bf6c6=_0x27b242[_0x16f540(0x1fe)](_0x269b1d[_0x16f540(0x184)]['name']),_0x10a1e0=a102_0x36a419[_0x16f540(0x164)](_0x269b1d['path'],'utf-8');if(_0x2bf6c6){const _0x7c4f06=apiKnowledgeBaseToYaml(_0x2bf6c6),_0x3ffa9a=toKnowledgeBaseYamlString(_0x7c4f06),_0x518ec1=generateDiff(_0x3ffa9a,_0x10a1e0),_0x5a869a=hasChanges(_0x518ec1);_0x5a869a?(_0x5c5f8b['knowledgeBases'][_0x16f540(0x194)]({'name':_0x269b1d[_0x16f540(0x184)][_0x16f540(0x160)],'action':'updated','id':_0x2bf6c6['id'],'diff':formatDiffWithColors(_0x518ec1)}),_0x5c5f8b['counts']['knowledgeBases'][_0x16f540(0x1bc)]++):(_0x5c5f8b[_0x16f540(0x17f)][_0x16f540(0x194)]({'name':_0x269b1d[_0x16f540(0x184)]['name'],'action':'unchanged','id':_0x2bf6c6['id']}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x17f)][_0x16f540(0x232)]++);}else _0x5c5f8b['knowledgeBases'][_0x16f540(0x194)]({'name':_0x269b1d[_0x16f540(0x184)][_0x16f540(0x160)],'action':'created'}),_0x5c5f8b['counts'][_0x16f540(0x17f)][_0x16f540(0x21c)]++;}for(const _0x3d8e11 of _0x2b109f){const _0xfee57b=_0x5405f5[_0x16f540(0x1fe)](_0x3d8e11[_0x16f540(0x160)]),_0x1e99ac=a102_0x36a419['readFileSync'](_0x3d8e11[_0x16f540(0x1c4)],_0x16f540(0x1ee));if(_0xfee57b){const _0x2e412e=toTextKnowledgeBaseMd(_0xfee57b[_0x16f540(0x21b)]['name'],_0xfee57b['attributes'][_0x16f540(0x1ef)]),_0x29445f=generateDiff(_0x2e412e,_0x1e99ac),_0x24d2b7=hasChanges(_0x29445f);_0x24d2b7?(_0x5c5f8b[_0x16f540(0x163)]['push']({'name':_0x3d8e11[_0x16f540(0x160)],'action':_0x16f540(0x1bc),'id':_0xfee57b['id'],'diff':formatDiffWithColors(_0x29445f)}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x163)]['updated']++):(_0x5c5f8b[_0x16f540(0x163)][_0x16f540(0x194)]({'name':_0x3d8e11[_0x16f540(0x160)],'action':_0x16f540(0x232),'id':_0xfee57b['id']}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x163)][_0x16f540(0x232)]++);}else _0x5c5f8b[_0x16f540(0x163)][_0x16f540(0x194)]({'name':_0x3d8e11['name'],'action':'created'}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x163)]['created']++;}for(const _0x18482e of _0x1db8e1){const _0x34062f=_0x3235ea[_0x16f540(0x1fe)](_0x18482e['yaml'][_0x16f540(0x160)]),_0x374291=a102_0x202167[_0x16f540(0x1d7)](_0x18482e[_0x16f540(0x20b)],_0x16f540(0x156)),_0x55da6c=a102_0x36a419['readFileSync'](_0x374291,'utf-8'),_0x4d8afa=_0x18482e[_0x16f540(0x159)],_0x30725e=_0x16f540(0x1e1)+_0x4d8afa+_0x16f540(0x1cb)+_0x55da6c;if(_0x34062f){const {yaml:_0x1019f6,systemPrompt:_0x46e00a}=await agentResponseToDef(_0x34062f,_0x189874),_0x2efee1=toAgentYamlString(_0x1019f6),_0x3e74be=_0x16f540(0x1e1)+_0x46e00a+_0x16f540(0x1cb)+_0x2efee1,_0xc2b12b=generateDiff(_0x3e74be,_0x30725e),_0x3ca91e=hasChanges(_0xc2b12b);_0x3ca91e?(_0x5c5f8b[_0x16f540(0x1db)]['push']({'agentName':_0x18482e[_0x16f540(0x184)][_0x16f540(0x160)],'action':_0x16f540(0x1bc),'agentId':_0x34062f['id'],'diff':formatDiffWithColors(_0xc2b12b)}),_0x5c5f8b[_0x16f540(0x1fc)]['agents'][_0x16f540(0x1bc)]++):(_0x5c5f8b[_0x16f540(0x1db)][_0x16f540(0x194)]({'agentName':_0x18482e[_0x16f540(0x184)]['name'],'action':'unchanged','agentId':_0x34062f['id']}),_0x5c5f8b[_0x16f540(0x1fc)]['agents'][_0x16f540(0x232)]++);}else _0x5c5f8b[_0x16f540(0x1db)][_0x16f540(0x194)]({'agentName':_0x18482e[_0x16f540(0x184)][_0x16f540(0x160)],'action':'created'}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x1db)][_0x16f540(0x21c)]++;}for(const _0x2565d6 of _0x29fde9){const _0x5ded28=_0x5952f2[_0x16f540(0x1fe)](_0x2565d6[_0x16f540(0x184)][_0x16f540(0x160)]),_0x862f38=a102_0x36a419[_0x16f540(0x164)](_0x2565d6[_0x16f540(0x1c4)],_0x16f540(0x1ee));if(_0x5ded28){const _0x20051f=await apiPromptToYaml(_0x5ded28,_0x189874);if(!_0x20051f){_0x5c5f8b[_0x16f540(0x162)][_0x16f540(0x194)]({'name':_0x2565d6[_0x16f540(0x184)][_0x16f540(0x160)],'action':'updated','id':_0x5ded28['id']}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x162)]['updated']++;continue;}const _0x16825f=toPromptYamlString(_0x20051f),_0x5d88a5=generateDiff(_0x16825f,_0x862f38),_0x4ef91a=hasChanges(_0x5d88a5);_0x4ef91a?(_0x5c5f8b[_0x16f540(0x162)][_0x16f540(0x194)]({'name':_0x2565d6['yaml'][_0x16f540(0x160)],'action':_0x16f540(0x1bc),'id':_0x5ded28['id'],'diff':formatDiffWithColors(_0x5d88a5)}),_0x5c5f8b['counts'][_0x16f540(0x162)][_0x16f540(0x1bc)]++):(_0x5c5f8b['prompts'][_0x16f540(0x194)]({'name':_0x2565d6[_0x16f540(0x184)][_0x16f540(0x160)],'action':_0x16f540(0x232),'id':_0x5ded28['id']}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x162)]['unchanged']++);}else _0x5c5f8b[_0x16f540(0x162)]['push']({'name':_0x2565d6[_0x16f540(0x184)]['name'],'action':_0x16f540(0x21c)}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x162)]['created']++;}for(const _0x13435f of _0x23c6d8){const _0x54390b=_0x4f483f[_0x16f540(0x1fe)](_0x13435f[_0x16f540(0x184)][_0x16f540(0x202)]),_0x2229b7=a102_0x36a419[_0x16f540(0x164)](_0x13435f[_0x16f540(0x1c4)],_0x16f540(0x1ee));if(_0x54390b){const _0x2860d1=await apiIntegrationToYaml(_0x54390b,_0x189874),_0x1defae=toIntegrationYamlString(_0x2860d1),_0x30eb67=generateDiff(_0x1defae,_0x2229b7),_0x37025a=hasChanges(_0x30eb67);_0x37025a?(_0x5c5f8b[_0x16f540(0x14e)][_0x16f540(0x194)]({'name':_0x13435f[_0x16f540(0x184)][_0x16f540(0x202)],'action':'updated','id':_0x54390b['id'],'diff':formatDiffWithColors(_0x30eb67)}),_0x5c5f8b[_0x16f540(0x1fc)]['integrations'][_0x16f540(0x1bc)]++):(_0x5c5f8b[_0x16f540(0x14e)][_0x16f540(0x194)]({'name':_0x13435f[_0x16f540(0x184)][_0x16f540(0x202)],'action':_0x16f540(0x232),'id':_0x54390b['id']}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x14e)][_0x16f540(0x232)]++);}else _0x5c5f8b['integrations']['push']({'name':_0x13435f[_0x16f540(0x184)]['service_type'],'action':_0x16f540(0x21c)}),_0x5c5f8b['counts'][_0x16f540(0x14e)][_0x16f540(0x21c)]++;}if(_0x424b6d?.[_0x16f540(0x1e9)])return _0x5c5f8b;_0x5c5f8b[_0x16f540(0x17f)]=[],_0x5c5f8b[_0x16f540(0x163)]=[],_0x5c5f8b['prompts']=[],_0x5c5f8b[_0x16f540(0x14e)]=[];const _0x51325a=_0x5c5f8b[_0x16f540(0x1db)][_0x16f540(0x1df)](_0x5f0e6f=>_0x5f0e6f['action']===_0x16f540(0x1f9));_0x5c5f8b[_0x16f540(0x1db)]=_0x51325a,_0x5c5f8b[_0x16f540(0x1fc)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x51325a[_0x16f540(0x1d6)]},'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}};for(const _0x428399 of _0x2b4756){try{const _0x42623f=_0x27b242[_0x16f540(0x1fe)](_0x428399[_0x16f540(0x184)][_0x16f540(0x160)]),_0x1fb16b=yamlKnowledgeBaseToApi(_0x428399[_0x16f540(0x184)],_0x8ab963);if(_0x42623f)await this[_0x16f540(0x187)][_0x16f540(0x16b)](_0x42623f['id'],_0x1fb16b),_0xb862dd[_0x16f540(0x218)](_0x428399[_0x16f540(0x184)]['name'],_0x42623f['id']),_0x5c5f8b[_0x16f540(0x17f)]['push']({'name':_0x428399[_0x16f540(0x184)][_0x16f540(0x160)],'action':_0x16f540(0x1bc),'id':_0x42623f['id']}),_0x5c5f8b[_0x16f540(0x1fc)]['knowledgeBases'][_0x16f540(0x1bc)]++;else{const _0x43b923=await this[_0x16f540(0x187)][_0x16f540(0x18d)](_0x1fb16b);_0xb862dd[_0x16f540(0x218)](_0x428399[_0x16f540(0x184)][_0x16f540(0x160)],_0x43b923['id']),_0x5c5f8b[_0x16f540(0x17f)][_0x16f540(0x194)]({'name':_0x428399['yaml'][_0x16f540(0x160)],'action':_0x16f540(0x21c),'id':_0x43b923['id']}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x17f)][_0x16f540(0x21c)]++;}}catch(_0x442937){_0x5c5f8b[_0x16f540(0x17f)][_0x16f540(0x194)]({'name':_0x428399[_0x16f540(0x184)]['name'],'action':_0x16f540(0x1f9),'error':_0x442937[_0x16f540(0x1da)]}),_0x5c5f8b['counts'][_0x16f540(0x17f)][_0x16f540(0x150)]++;}}for(const _0x47a6c8 of _0x2b109f){try{const _0x2f1673=_0x5405f5[_0x16f540(0x1fe)](_0x47a6c8[_0x16f540(0x160)]),_0x39f641=yamlTextKnowledgeBaseToApi({'name':_0x47a6c8[_0x16f540(0x160)],'text':_0x47a6c8['text']},_0x8ab963);if(_0x2f1673)await this[_0x16f540(0x187)]['updateTextKnowledgeBase'](_0x2f1673['id'],_0x39f641),_0x4d3c00[_0x16f540(0x218)](_0x47a6c8[_0x16f540(0x160)],_0x2f1673['id']),_0x5c5f8b[_0x16f540(0x163)][_0x16f540(0x194)]({'name':_0x47a6c8[_0x16f540(0x160)],'action':'updated','id':_0x2f1673['id']}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x163)][_0x16f540(0x1bc)]++;else{const _0x116bd2=await this[_0x16f540(0x187)][_0x16f540(0x16c)](_0x39f641);_0x4d3c00[_0x16f540(0x218)](_0x47a6c8[_0x16f540(0x160)],_0x116bd2['id']),_0x5c5f8b[_0x16f540(0x163)][_0x16f540(0x194)]({'name':_0x47a6c8[_0x16f540(0x160)],'action':_0x16f540(0x21c),'id':_0x116bd2['id']}),_0x5c5f8b[_0x16f540(0x1fc)]['textKnowledgeBases']['created']++;}}catch(_0x137bb0){_0x5c5f8b['textKnowledgeBases'][_0x16f540(0x194)]({'name':_0x47a6c8[_0x16f540(0x160)],'action':_0x16f540(0x1f9),'error':_0x137bb0[_0x16f540(0x1da)]}),_0x5c5f8b['counts'][_0x16f540(0x163)]['errors']++;}}for(const _0x167d8a of _0x1db8e1){_0x34b405=[];try{const _0x538b18=_0x3235ea[_0x16f540(0x1fe)](_0x167d8a['yaml']['name']),_0x2df582=await agentDefToRequest(_0x167d8a[_0x16f540(0x184)],_0x167d8a[_0x16f540(0x159)],_0x167d8a[_0x16f540(0x155)],_0x15e741);if(_0x538b18)await this['client'][_0x16f540(0x227)](_0x538b18['id'],_0x2df582),_0x5130aa['set'](_0x167d8a[_0x16f540(0x184)][_0x16f540(0x160)],_0x538b18['id']),_0x5c5f8b[_0x16f540(0x1db)][_0x16f540(0x194)]({'agentName':_0x167d8a[_0x16f540(0x184)][_0x16f540(0x160)],'action':_0x16f540(0x1bc),'agentId':_0x538b18['id'],'warnings':_0x34b405[_0x16f540(0x1d6)]>0x0?_0x34b405:undefined}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x1db)]['updated']++;else{const _0x5972a4=await this['client'][_0x16f540(0x1ec)](_0x2df582);_0x5130aa[_0x16f540(0x218)](_0x167d8a[_0x16f540(0x184)][_0x16f540(0x160)],_0x5972a4['id']),_0x5c5f8b[_0x16f540(0x1db)][_0x16f540(0x194)]({'agentName':_0x167d8a[_0x16f540(0x184)][_0x16f540(0x160)],'action':_0x16f540(0x21c),'agentId':_0x5972a4['id'],'warnings':_0x34b405[_0x16f540(0x1d6)]>0x0?_0x34b405:undefined}),_0x5c5f8b['counts'][_0x16f540(0x1db)][_0x16f540(0x21c)]++;}}catch(_0x1e8570){_0x5c5f8b[_0x16f540(0x1db)]['push']({'agentName':_0x167d8a[_0x16f540(0x184)][_0x16f540(0x160)],'action':_0x16f540(0x1f9),'error':_0x1e8570['message'],'warnings':_0x34b405[_0x16f540(0x1d6)]>0x0?_0x34b405:undefined}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x1db)][_0x16f540(0x150)]++;}}for(const _0x55350f of _0x29fde9){try{const _0x418f78=_0x5952f2[_0x16f540(0x1fe)](_0x55350f[_0x16f540(0x184)][_0x16f540(0x160)]),_0x59de2d=await yamlPromptToApi(_0x55350f['yaml'],_0x8ab963,_0x15e741);if(!_0x59de2d){_0x5c5f8b['prompts'][_0x16f540(0x194)]({'name':_0x55350f[_0x16f540(0x184)][_0x16f540(0x160)],'action':_0x16f540(0x1f9),'error':_0x16f540(0x180)}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x162)][_0x16f540(0x150)]++;continue;}if(_0x418f78)await this[_0x16f540(0x187)][_0x16f540(0x1e4)](_0x418f78['id'],_0x59de2d),_0x1b507f[_0x16f540(0x218)](_0x55350f[_0x16f540(0x184)][_0x16f540(0x160)],_0x418f78['id']),_0x5c5f8b['prompts']['push']({'name':_0x55350f[_0x16f540(0x184)][_0x16f540(0x160)],'action':'updated','id':_0x418f78['id']}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x162)][_0x16f540(0x1bc)]++;else{const _0x519808=await this[_0x16f540(0x187)][_0x16f540(0x231)](_0x59de2d);_0x1b507f[_0x16f540(0x218)](_0x55350f['yaml'][_0x16f540(0x160)],_0x519808['id']),_0x5c5f8b[_0x16f540(0x162)][_0x16f540(0x194)]({'name':_0x55350f[_0x16f540(0x184)][_0x16f540(0x160)],'action':_0x16f540(0x21c),'id':_0x519808['id']}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x162)][_0x16f540(0x21c)]++;}}catch(_0x5b5dcf){_0x5c5f8b['prompts']['push']({'name':_0x55350f['yaml'][_0x16f540(0x160)],'action':_0x16f540(0x1f9),'error':_0x5b5dcf[_0x16f540(0x1da)]}),_0x5c5f8b['counts'][_0x16f540(0x162)][_0x16f540(0x150)]++;}}for(const _0x382b6e of _0x23c6d8){try{const _0x2f2b4a=_0x4f483f[_0x16f540(0x1fe)](_0x382b6e['yaml'][_0x16f540(0x202)]),_0x46c747=await yamlIntegrationToApi(_0x382b6e[_0x16f540(0x184)],_0x8ab963,_0x15e741);if(_0x2f2b4a){await this[_0x16f540(0x187)][_0x16f540(0x171)](_0x2f2b4a['id']);const _0x337b13=await this[_0x16f540(0x187)][_0x16f540(0x1af)](_0x46c747);_0x5c5f8b[_0x16f540(0x14e)]['push']({'name':_0x382b6e[_0x16f540(0x184)]['service_type'],'action':_0x16f540(0x1bc),'id':_0x337b13['id']}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x14e)][_0x16f540(0x1bc)]++;}else{const _0x46254e=await this['client'][_0x16f540(0x1af)](_0x46c747);_0x5c5f8b[_0x16f540(0x14e)][_0x16f540(0x194)]({'name':_0x382b6e[_0x16f540(0x184)][_0x16f540(0x202)],'action':_0x16f540(0x21c),'id':_0x46254e['id']}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x14e)][_0x16f540(0x21c)]++;}}catch(_0x9e5931){_0x5c5f8b[_0x16f540(0x14e)][_0x16f540(0x194)]({'name':_0x382b6e[_0x16f540(0x184)][_0x16f540(0x202)],'action':_0x16f540(0x1f9),'error':_0x9e5931[_0x16f540(0x1da)]}),_0x5c5f8b[_0x16f540(0x1fc)][_0x16f540(0x14e)]['errors']++;}}return _0x5c5f8b;}async[a102_0x1d5d3c(0x233)](_0x5662ca,_0x1465cf,_0x5be14d,_0x2759b7){const _0x376b76=a102_0x1d5d3c,{projectId:_0x2ad901,project:_0x3bc29f}=await this[_0x376b76(0x1fb)](_0x5662ca),_0x4e5c04=_0x3bc29f[_0x376b76(0x21b)][_0x376b76(0x160)],_0x7d792f=await this['client'][_0x376b76(0x1bb)](_0x2ad901),_0x3e584c=_0x7d792f[_0x376b76(0x153)](_0x4c3ce0=>_0x4c3ce0['attributes']['name']===_0x1465cf);if(!_0x3e584c)throw new SDKError(ErrorCode[_0x376b76(0x199)],_0x376b76(0x18f)+_0x1465cf,undefined,{'helpText':_0x376b76(0x14f)+_0x7d792f['map'](_0x2cdc67=>_0x2cdc67[_0x376b76(0x21b)]['name'])[_0x376b76(0x1d7)](',\x20')});let _0x2a128d;if(_0x5be14d)_0x2a128d=_0x5be14d;else{const _0xb2f1ea=a102_0x202167['join'](process[_0x376b76(0x1d2)](),_0x376b76(0x1db)),_0x4e60ce=getSanitizedPathWithMigration(_0xb2f1ea,_0x4e5c04);_0x4e60ce[_0x376b76(0x17e)]&&this[_0x376b76(0x14a)][_0x376b76(0x1c9)](_0x376b76(0x212)+a102_0x202167[_0x376b76(0x19c)](_0x4e60ce[_0x376b76(0x18e)])+'\x20→\x20'+a102_0x202167[_0x376b76(0x19c)](_0x4e60ce[_0x376b76(0x1c4)])),_0x2a128d=_0x4e60ce[_0x376b76(0x1c4)];}const _0x2bb2c3=getSanitizedPathWithMigration(_0x2a128d,_0x1465cf);_0x2bb2c3['renamed']&&this['logger'][_0x376b76(0x1c9)](_0x376b76(0x206)+a102_0x202167[_0x376b76(0x19c)](_0x2bb2c3['oldPath'])+'\x20→\x20'+a102_0x202167[_0x376b76(0x19c)](_0x2bb2c3[_0x376b76(0x1c4)]));const _0x5b2114=_0x2bb2c3['path'],_0x3fecef=new Map(),_0x1f1036=new Map(),_0x2772eb=await this[_0x376b76(0x187)]['listKnowledgeBases'](_0x2ad901),_0x4d40bd=await this['client']['listTextKnowledgeBases'](_0x2ad901),_0x4b1dfb=new Map();for(const _0x138c48 of _0x2772eb){_0x3fecef['set'](_0x138c48['id'],_0x138c48[_0x376b76(0x21b)][_0x376b76(0x160)]);}for(const _0x1d06f6 of _0x4d40bd){_0x4b1dfb[_0x376b76(0x218)](_0x1d06f6['id'],_0x1d06f6['attributes'][_0x376b76(0x160)]);}for(const _0x4e056c of _0x7d792f){_0x1f1036[_0x376b76(0x218)](_0x4e056c['id'],_0x4e056c[_0x376b76(0x21b)][_0x376b76(0x160)]);}const _0x216a1c={'resolveKnowledgeBaseName':async _0x413237=>_0x3fecef[_0x376b76(0x1fe)](_0x413237),'resolveTextKnowledgeBaseName':async _0x480e9b=>_0x4b1dfb[_0x376b76(0x1fe)](_0x480e9b),'resolveAgentName':async _0x43276a=>_0x1f1036[_0x376b76(0x1fe)](_0x43276a),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async()=>undefined,'onWarning':_0x426ffa=>this[_0x376b76(0x14a)][_0x376b76(0x178)](_0x426ffa)},_0x2874cd=a102_0x202167[_0x376b76(0x1d7)](_0x5b2114,_0x376b76(0x148)),_0x5b0a95=a102_0x202167[_0x376b76(0x1d7)](_0x5b2114,_0x376b76(0x156)),_0x433f0a=a102_0x202167['join'](_0x5b2114,_0x376b76(0x1d8)),_0x4d4759=!a102_0x36a419[_0x376b76(0x1a3)](_0x5b0a95);if(_0x2759b7?.[_0x376b76(0x1e9)])return{'agentName':_0x1465cf,'outputPath':_0x5b2114,'isNew':_0x4d4759,'hasChanges':!![]};a102_0x36a419[_0x376b76(0x1c8)](_0x2a128d,{'recursive':!![]}),a102_0x36a419[_0x376b76(0x1c8)](_0x5b2114,{'recursive':!![]});const _0x2e8252=a102_0x202167['join'](_0x2a128d,'tdx.json');!a102_0x36a419[_0x376b76(0x1a3)](_0x2e8252)&&a102_0x36a419['writeFileSync'](_0x2e8252,createAgentConfigContent(_0x5662ca));const {yaml:_0x4e6486,systemPrompt:_0x1c3534,starterMessage:_0x541d9b}=await agentResponseToDef(_0x3e584c,_0x216a1c);let _0x598ed9=_0x4d4759;if(!_0x4d4759){const _0x5afb98=a102_0x36a419['existsSync'](_0x2874cd)?a102_0x36a419[_0x376b76(0x164)](_0x2874cd,_0x376b76(0x1ee)):'',_0x45bc11=a102_0x36a419[_0x376b76(0x164)](_0x5b0a95,_0x376b76(0x1ee));_0x598ed9=_0x5afb98!==_0x1c3534||_0x45bc11!==toAgentYamlString(_0x4e6486);}a102_0x36a419[_0x376b76(0x19a)](_0x2874cd,_0x1c3534),a102_0x36a419['writeFileSync'](_0x5b0a95,toAgentYamlString(_0x4e6486));if(_0x541d9b&&_0x541d9b[_0x376b76(0x169)]('\x0a'))a102_0x36a419[_0x376b76(0x19a)](_0x433f0a,_0x541d9b);else a102_0x36a419['existsSync'](_0x433f0a)&&a102_0x36a419[_0x376b76(0x22a)](_0x433f0a);return{'agentName':_0x1465cf,'outputPath':_0x5b2114,'isNew':_0x4d4759,'hasChanges':_0x598ed9};}async[a102_0x1d5d3c(0x18b)](_0x639041,_0x5e954f){const _0x5109be=a102_0x1d5d3c;let _0x1ad5b4;isAgentYamlPath(_0x639041)?_0x1ad5b4=getAgentDirFromYamlPath(_0x639041):_0x1ad5b4=_0x639041;const {config:_0x2ae498}=findAgentConfig(_0x1ad5b4),_0x23e71e=await this[_0x5109be(0x20f)](_0x2ae498[_0x5109be(0x1dd)]),_0x5e5176=a102_0x202167[_0x5109be(0x1d7)](_0x1ad5b4,_0x5109be(0x156)),_0x2800da=a102_0x202167[_0x5109be(0x1d7)](_0x1ad5b4,_0x5109be(0x148)),_0x1197ea=a102_0x202167[_0x5109be(0x1d7)](_0x1ad5b4,_0x5109be(0x1d8));if(!a102_0x36a419[_0x5109be(0x1a3)](_0x5e5176))throw new SDKError(ErrorCode[_0x5109be(0x193)],_0x5109be(0x176)+_0x1ad5b4,undefined,{'helpText':'Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.'});const _0x206096=parseAgentYaml(a102_0x36a419['readFileSync'](_0x5e5176,_0x5109be(0x1ee)),_0x5e5176),_0x2d26d3=a102_0x36a419['existsSync'](_0x2800da)?a102_0x36a419[_0x5109be(0x164)](_0x2800da,'utf-8'):'',_0x28cd6a=a102_0x36a419[_0x5109be(0x1a3)](_0x1197ea)?a102_0x36a419[_0x5109be(0x164)](_0x1197ea,'utf-8'):_0x206096[_0x5109be(0x1b6)];if(_0x5e954f?.['dryRun'])return{'agentName':_0x206096[_0x5109be(0x160)],'action':_0x5109be(0x21c),'projectId':_0x23e71e};const _0x4f0922=await this[_0x5109be(0x187)]['listAgentsFull'](_0x23e71e),_0x427f1b=await this['client'][_0x5109be(0x1ac)](_0x23e71e),_0x342a82=await this[_0x5109be(0x187)]['listTextKnowledgeBases'](_0x23e71e),_0x2cb430=await this[_0x5109be(0x187)]['getParentSegmentKnowledgeBase'](_0x23e71e),_0x73d40c=new Map(),_0x4c0d9d=new Map(),_0x412fd3=new Map();for(const _0x455290 of _0x427f1b){_0x73d40c[_0x5109be(0x218)](_0x455290[_0x5109be(0x21b)][_0x5109be(0x160)],_0x455290['id']);}for(const _0x12859c of _0x342a82){_0x4c0d9d[_0x5109be(0x218)](_0x12859c['attributes'][_0x5109be(0x160)],_0x12859c['id']);}for(const _0x3af523 of _0x4f0922){_0x412fd3[_0x5109be(0x218)](_0x3af523['attributes'][_0x5109be(0x160)],_0x3af523['id']);}const _0x450bd5=[],_0x148fd0={'projectId':_0x23e71e,'resolveKnowledgeBaseId':async _0x270ab3=>_0x73d40c[_0x5109be(0x1fe)](_0x270ab3),'resolveTextKnowledgeBaseId':async _0x103a7b=>_0x4c0d9d['get'](_0x103a7b),'resolveAgentId':async _0x249257=>_0x412fd3[_0x5109be(0x1fe)](_0x249257),'resolveWebSearchToolId':async()=>undefined,'resolveImageGeneratorId':async()=>undefined,'resolvePromptId':async()=>undefined,'resolveParentSegmentKBId':async()=>_0x2cb430?.['id'],'onWarning':_0x2789ce=>{const _0x14c978=_0x5109be;this['logger'][_0x14c978(0x178)](_0x2789ce),_0x450bd5['push'](_0x2789ce);}};try{const _0x46bed8=_0x4f0922[_0x5109be(0x153)](_0x361a4b=>_0x361a4b[_0x5109be(0x21b)][_0x5109be(0x160)]===_0x206096[_0x5109be(0x160)]),_0x2ebbe0=await agentDefToRequest(_0x206096,_0x2d26d3,_0x28cd6a,_0x148fd0);if(_0x46bed8)return await this[_0x5109be(0x187)][_0x5109be(0x227)](_0x46bed8['id'],_0x2ebbe0),{'agentName':_0x206096[_0x5109be(0x160)],'action':_0x5109be(0x1bc),'projectId':_0x23e71e,'agentId':_0x46bed8['id'],'warnings':_0x450bd5[_0x5109be(0x1d6)]>0x0?_0x450bd5:undefined};else{const _0x18dd35=await this[_0x5109be(0x187)][_0x5109be(0x1ec)](_0x2ebbe0);return{'agentName':_0x206096['name'],'action':'created','projectId':_0x23e71e,'agentId':_0x18dd35['id'],'warnings':_0x450bd5[_0x5109be(0x1d6)]>0x0?_0x450bd5:undefined};}}catch(_0x38c690){return{'agentName':_0x206096[_0x5109be(0x160)],'action':_0x5109be(0x1f9),'projectId':_0x23e71e,'error':_0x38c690['message'],'warnings':_0x450bd5[_0x5109be(0x1d6)]>0x0?_0x450bd5:undefined};}}async[a102_0x1d5d3c(0x1ab)](_0x27d803,_0x4a62ae,_0x4668a1){const _0x5b7915=a102_0x1d5d3c,_0x785c74=a102_0x36a419['existsSync'](_0x27d803)&&a102_0x36a419[_0x5b7915(0x1a3)](a102_0x202167[_0x5b7915(0x1d7)](_0x27d803,_0x5b7915(0x14b)));let _0x4272cb;const _0x40a4ce=[],_0x2a00fb=[],_0x4ef02c=[],_0x4772ef=[],_0x2f9c58=[];if(_0x785c74){const _0x4c0587=loadAgentConfig(a102_0x202167[_0x5b7915(0x1d7)](_0x27d803,_0x5b7915(0x14b)));_0x4272cb=_0x4c0587[_0x5b7915(0x1dd)];const _0x156932=a102_0x36a419['readdirSync'](_0x27d803,{'withFileTypes':!![]});for(const _0xca0454 of _0x156932){if(!_0xca0454['isDirectory']())continue;if(['knowledge_bases',_0x5b7915(0x162),_0x5b7915(0x14e)]['includes'](_0xca0454[_0x5b7915(0x160)]))continue;const _0x1ad350=a102_0x202167[_0x5b7915(0x1d7)](_0x27d803,_0xca0454[_0x5b7915(0x160)]);if(isAgentDir(_0x1ad350)){const _0x439657=a102_0x202167[_0x5b7915(0x1d7)](_0x1ad350,_0x5b7915(0x156)),_0x165a04=a102_0x202167[_0x5b7915(0x1d7)](_0x1ad350,_0x5b7915(0x148)),_0x3d4dee=a102_0x202167[_0x5b7915(0x1d7)](_0x1ad350,_0x5b7915(0x1d8)),_0x4b5dab=parseAgentYaml(a102_0x36a419['readFileSync'](_0x439657,'utf-8'),_0x439657),_0x4ac4ad=a102_0x36a419['existsSync'](_0x165a04)?a102_0x36a419[_0x5b7915(0x164)](_0x165a04,_0x5b7915(0x1ee)):'',_0x5b9e57=a102_0x36a419[_0x5b7915(0x1a3)](_0x3d4dee)?a102_0x36a419[_0x5b7915(0x164)](_0x3d4dee,_0x5b7915(0x1ee)):_0x4b5dab[_0x5b7915(0x1b6)];_0x40a4ce[_0x5b7915(0x194)]({'name':_0x4b5dab['name'],'dir':_0x1ad350,'yaml':_0x4b5dab,'systemPrompt':_0x4ac4ad,'starterMessage':_0x5b9e57});}}const _0x30ae3e=getKnowledgeBasesDir(_0x27d803);if(a102_0x36a419['existsSync'](_0x30ae3e)){const _0x1e375d=a102_0x36a419[_0x5b7915(0x228)](_0x30ae3e);for(const _0x1ad4b8 of _0x1e375d){const _0x53e385=a102_0x202167[_0x5b7915(0x1d7)](_0x30ae3e,_0x1ad4b8);if(_0x1ad4b8[_0x5b7915(0x15d)](_0x5b7915(0x15b))){const _0x2c9ed7=parseKnowledgeBaseYaml(a102_0x36a419[_0x5b7915(0x164)](_0x53e385,_0x5b7915(0x1ee)),_0x53e385);_0x2a00fb[_0x5b7915(0x194)]({'name':_0x2c9ed7[_0x5b7915(0x160)],'path':_0x53e385,'yaml':_0x2c9ed7});}else{if(_0x1ad4b8[_0x5b7915(0x15d)](_0x5b7915(0x1ea))){const _0x3a2684=a102_0x36a419[_0x5b7915(0x164)](_0x53e385,_0x5b7915(0x1ee)),{name:_0x44a536,text:_0x40dfd7}=parseTextKnowledgeBaseMd(_0x3a2684,_0x1ad4b8);_0x4ef02c[_0x5b7915(0x194)]({'name':_0x44a536,'path':_0x53e385,'text':_0x40dfd7});}}}}const _0x47f869=getPromptsDir(_0x27d803);if(a102_0x36a419[_0x5b7915(0x1a3)](_0x47f869)){const _0x2eb7da=a102_0x36a419['readdirSync'](_0x47f869)['filter'](_0x35c7df=>_0x35c7df[_0x5b7915(0x15d)](_0x5b7915(0x15b)));for(const _0x396d9c of _0x2eb7da){const _0x494865=a102_0x202167[_0x5b7915(0x1d7)](_0x47f869,_0x396d9c),_0x25f696=parsePromptYaml(a102_0x36a419[_0x5b7915(0x164)](_0x494865,'utf-8'),_0x494865);_0x4772ef['push']({'name':_0x25f696[_0x5b7915(0x160)],'path':_0x494865,'yaml':_0x25f696});}}const _0x2e93b7=getIntegrationsDir(_0x27d803);if(a102_0x36a419[_0x5b7915(0x1a3)](_0x2e93b7)){const _0x259b80=a102_0x36a419[_0x5b7915(0x228)](_0x2e93b7)[_0x5b7915(0x1df)](_0x18eba2=>_0x18eba2['endsWith'](_0x5b7915(0x15b)));for(const _0xe6c5ef of _0x259b80){const _0x1973ce=a102_0x202167[_0x5b7915(0x1d7)](_0x2e93b7,_0xe6c5ef),_0x4e218f=parseIntegrationYaml(a102_0x36a419[_0x5b7915(0x164)](_0x1973ce,_0x5b7915(0x1ee)),_0x1973ce);SAFE_INTEGRATION_TYPES[_0x5b7915(0x169)](_0x4e218f[_0x5b7915(0x202)][_0x5b7915(0x175)]())?_0x2f9c58['push']({'name':_0x4e218f['name'],'path':_0x1973ce,'yaml':_0x4e218f}):this[_0x5b7915(0x14a)][_0x5b7915(0x178)](_0x5b7915(0x146)+_0x4e218f[_0x5b7915(0x160)]+'\x27\x20('+_0x4e218f[_0x5b7915(0x202)]+'):\x20'+(_0x5b7915(0x15e)+SAFE_INTEGRATION_TYPES[_0x5b7915(0x1d7)](',\x20')+')\x20can\x20be\x20cloned.'));}}}else{const _0x5985de=await this[_0x5b7915(0x20f)](_0x27d803),_0x1707db=await this[_0x5b7915(0x187)][_0x5b7915(0x1a4)](_0x5985de);_0x4272cb=_0x1707db[_0x5b7915(0x21b)][_0x5b7915(0x160)];const _0x15656d=await this['client']['listAgentsFull'](_0x5985de),_0x59e7bb=await this[_0x5b7915(0x187)][_0x5b7915(0x1ac)](_0x5985de),_0x1d0c4e=await this['client'][_0x5b7915(0x22b)](_0x5985de),_0x167f58=await this[_0x5b7915(0x187)][_0x5b7915(0x161)](_0x5985de),_0x3cd342=await this[_0x5b7915(0x187)][_0x5b7915(0x1f8)](_0x5985de),_0x39feaa=new Map(),_0x442af9=new Map(),_0x2062f7=new Map(),_0x593b5d=new Map();for(const _0x2c37a0 of _0x59e7bb){_0x39feaa[_0x5b7915(0x218)](_0x2c37a0['id'],_0x2c37a0[_0x5b7915(0x21b)][_0x5b7915(0x160)]);}for(const _0x33402a of _0x1d0c4e){_0x442af9[_0x5b7915(0x218)](_0x33402a['id'],_0x33402a[_0x5b7915(0x21b)][_0x5b7915(0x160)]);}for(const _0xdd108c of _0x15656d){_0x2062f7[_0x5b7915(0x218)](_0xdd108c['id'],_0xdd108c['attributes'][_0x5b7915(0x160)]);}for(const _0x3f2479 of _0x167f58){_0x593b5d['set'](_0x3f2479['id'],_0x3f2479[_0x5b7915(0x21b)][_0x5b7915(0x160)]);}const _0x15f3c4={'resolveKnowledgeBaseName':async _0x2400c2=>_0x39feaa[_0x5b7915(0x1fe)](_0x2400c2),'resolveTextKnowledgeBaseName':async _0x458edd=>_0x442af9[_0x5b7915(0x1fe)](_0x458edd),'resolveAgentName':async _0x2db328=>_0x2062f7[_0x5b7915(0x1fe)](_0x2db328),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async _0x41f608=>_0x593b5d['get'](_0x41f608),'onWarning':_0x2c1583=>this[_0x5b7915(0x14a)]['warn'](_0x2c1583)};for(const _0x2d2f53 of _0x15656d){const _0x267098=await agentResponseToDef(_0x2d2f53,_0x15f3c4),{yaml:_0x51cc34,systemPrompt:_0x256f66,starterMessage:_0x17cfbc}=_0x267098;_0x40a4ce[_0x5b7915(0x194)]({'name':_0x51cc34['name'],'dir':'','yaml':_0x51cc34,'systemPrompt':_0x256f66,'starterMessage':_0x17cfbc});}for(const _0x4d6762 of _0x59e7bb){const _0x5559e4=apiKnowledgeBaseToYaml(_0x4d6762);_0x2a00fb[_0x5b7915(0x194)]({'name':_0x5559e4[_0x5b7915(0x160)],'path':'','yaml':_0x5559e4});}for(const _0xde55d8 of _0x1d0c4e){_0x4ef02c[_0x5b7915(0x194)]({'name':_0xde55d8['attributes'][_0x5b7915(0x160)],'path':'','text':_0xde55d8['attributes'][_0x5b7915(0x1ef)]});}for(const _0x4a26ec of _0x167f58){const _0xace4a3=await apiPromptToYaml(_0x4a26ec,_0x15f3c4);_0xace4a3&&_0x4772ef[_0x5b7915(0x194)]({'name':_0xace4a3[_0x5b7915(0x160)],'path':'','yaml':_0xace4a3});}for(const _0x11167d of _0x3cd342){if(!_0x11167d[_0x5b7915(0x21b)][_0x5b7915(0x1b0)]&&SAFE_INTEGRATION_TYPES[_0x5b7915(0x169)](_0x11167d[_0x5b7915(0x21b)]['serviceType'][_0x5b7915(0x175)]())){const _0x7fe9e3=await apiIntegrationToYaml(_0x11167d,_0x15f3c4);_0x2f9c58['push']({'name':_0x11167d[_0x5b7915(0x21b)]['serviceType']['toLowerCase'](),'path':'','yaml':_0x7fe9e3});}}}const _0x1f21e8={'sourceProjectName':_0x4272cb,'newProjectName':_0x4a62ae,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'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}}},_0x36b382=await this['client'][_0x5b7915(0x1e5)](),_0x569bdc=_0x36b382[_0x5b7915(0x153)](_0x4166e2=>_0x4166e2[_0x5b7915(0x21b)][_0x5b7915(0x160)]===_0x4a62ae);if(_0x569bdc)throw new SDKError(ErrorCode['ALREADY_EXISTS'],'Project\x20\x22'+_0x4a62ae+_0x5b7915(0x1e7),undefined,{'helpText':_0x5b7915(0x166)});if(_0x4668a1?.['dryRun'])return _0x1f21e8['counts']['agents']['created']=_0x40a4ce[_0x5b7915(0x1d6)],_0x1f21e8[_0x5b7915(0x1fc)][_0x5b7915(0x17f)][_0x5b7915(0x21c)]=_0x2a00fb[_0x5b7915(0x1d6)],_0x1f21e8[_0x5b7915(0x1fc)]['textKnowledgeBases'][_0x5b7915(0x21c)]=_0x4ef02c[_0x5b7915(0x1d6)],_0x1f21e8[_0x5b7915(0x1fc)]['prompts']['created']=_0x4772ef[_0x5b7915(0x1d6)],_0x1f21e8[_0x5b7915(0x1fc)][_0x5b7915(0x14e)]['created']=_0x2f9c58['length'],_0x1f21e8;const _0x5e6ba2=await this[_0x5b7915(0x187)][_0x5b7915(0x17b)]({'name':_0x4a62ae}),_0x40b767=_0x5e6ba2['id'];_0x1f21e8[_0x5b7915(0x19f)]=_0x40b767;const _0x481e46=new Map(),_0x451cb3=new Map(),_0x230383=new Map(),_0x48374d=new Map(),_0x1bba1b=new Map(),_0x30d8f3=new Map(),_0x35debe=new Set(),_0x489817=new Set();for(const _0x1ccbc2 of _0x40a4ce){for(const _0x7982b8 of _0x1ccbc2[_0x5b7915(0x184)][_0x5b7915(0x183)]||[]){if(_0x7982b8['type']===_0x5b7915(0x236)&&_0x7982b8['target']){const _0x4f5419=parseRef(_0x7982b8['target']);if(_0x4f5419)_0x35debe['add'](_0x4f5419[_0x5b7915(0x160)]);}else{if(_0x7982b8[_0x5b7915(0x177)]==='web_search'&&_0x7982b8[_0x5b7915(0x1bf)]){const _0x4355e5=parseRef(_0x7982b8[_0x5b7915(0x1bf)]);if(_0x4355e5)_0x489817[_0x5b7915(0x1bd)](_0x4355e5[_0x5b7915(0x160)]);}}}}for(const _0x28f2e1 of _0x35debe){try{const _0x4bcb80=await this[_0x5b7915(0x187)][_0x5b7915(0x190)]({'projectId':_0x40b767,'name':_0x28f2e1});_0x1bba1b[_0x5b7915(0x218)](_0x28f2e1,_0x4bcb80['id']),_0x1f21e8[_0x5b7915(0x222)]['push']({'name':_0x28f2e1,'action':_0x5b7915(0x21c),'id':_0x4bcb80['id']}),_0x1f21e8['counts'][_0x5b7915(0x222)]['created']++;}catch(_0x1f82c7){_0x1f21e8[_0x5b7915(0x222)][_0x5b7915(0x194)]({'name':_0x28f2e1,'action':_0x5b7915(0x1f9),'error':_0x1f82c7[_0x5b7915(0x1da)]}),_0x1f21e8[_0x5b7915(0x1fc)][_0x5b7915(0x222)][_0x5b7915(0x150)]++;}}for(const _0x308521 of _0x489817){try{const _0xe5b0cc=await this[_0x5b7915(0x187)]['createWebSearchTool']({'projectId':_0x40b767,'name':_0x308521});_0x30d8f3[_0x5b7915(0x218)](_0x308521,_0xe5b0cc['id']),_0x1f21e8[_0x5b7915(0x1e6)]['push']({'name':_0x308521,'action':'created','id':_0xe5b0cc['id']}),_0x1f21e8[_0x5b7915(0x1fc)][_0x5b7915(0x1e6)]['created']++;}catch(_0xd5cf62){_0x1f21e8[_0x5b7915(0x1e6)][_0x5b7915(0x194)]({'name':_0x308521,'action':_0x5b7915(0x1f9),'error':_0xd5cf62[_0x5b7915(0x1da)]}),_0x1f21e8['counts'][_0x5b7915(0x1e6)][_0x5b7915(0x150)]++;}}const _0x4d72c2=await this[_0x5b7915(0x187)][_0x5b7915(0x182)](_0x40b767);let _0x138eae=[];const _0x40f0b2={'projectId':_0x40b767,'resolveKnowledgeBaseId':async _0x28ebce=>_0x481e46[_0x5b7915(0x1fe)](_0x28ebce),'resolveTextKnowledgeBaseId':async _0x2455d2=>_0x451cb3[_0x5b7915(0x1fe)](_0x2455d2),'resolveAgentId':async _0x10f834=>_0x230383['get'](_0x10f834),'resolveWebSearchToolId':async _0x3342f9=>_0x30d8f3['get'](_0x3342f9),'resolveImageGeneratorId':async _0x12edd3=>_0x1bba1b[_0x5b7915(0x1fe)](_0x12edd3),'resolvePromptId':async _0x3770c0=>_0x48374d[_0x5b7915(0x1fe)](_0x3770c0),'resolveParentSegmentKBId':async()=>_0x4d72c2?.['id'],'onWarning':_0x1a0dab=>{const _0x58e36a=_0x5b7915;this[_0x58e36a(0x14a)][_0x58e36a(0x178)](_0x1a0dab),_0x138eae['push'](_0x1a0dab);}};for(const _0x26a0ac of _0x2a00fb){try{const _0x4ef946=yamlKnowledgeBaseToApi(_0x26a0ac[_0x5b7915(0x184)],_0x40b767),_0x53d4f3=await this[_0x5b7915(0x187)][_0x5b7915(0x18d)](_0x4ef946);_0x481e46[_0x5b7915(0x218)](_0x26a0ac[_0x5b7915(0x184)]['name'],_0x53d4f3['id']),_0x1f21e8[_0x5b7915(0x17f)]['push']({'name':_0x26a0ac['yaml'][_0x5b7915(0x160)],'action':'created','id':_0x53d4f3['id']}),_0x1f21e8[_0x5b7915(0x1fc)][_0x5b7915(0x17f)][_0x5b7915(0x21c)]++;}catch(_0x171f18){_0x1f21e8['knowledgeBases']['push']({'name':_0x26a0ac[_0x5b7915(0x184)][_0x5b7915(0x160)],'action':_0x5b7915(0x1f9),'error':_0x171f18[_0x5b7915(0x1da)]}),_0x1f21e8[_0x5b7915(0x1fc)][_0x5b7915(0x17f)]['errors']++;}}for(const _0x381305 of _0x4ef02c){try{const _0x3017bb=yamlTextKnowledgeBaseToApi({'name':_0x381305['name'],'text':_0x381305[_0x5b7915(0x1ef)]},_0x40b767),_0x3bea8a=await this[_0x5b7915(0x187)][_0x5b7915(0x16c)](_0x3017bb);_0x451cb3[_0x5b7915(0x218)](_0x381305[_0x5b7915(0x160)],_0x3bea8a['id']),_0x1f21e8[_0x5b7915(0x163)][_0x5b7915(0x194)]({'name':_0x381305[_0x5b7915(0x160)],'action':_0x5b7915(0x21c),'id':_0x3bea8a['id']}),_0x1f21e8[_0x5b7915(0x1fc)][_0x5b7915(0x163)]['created']++;}catch(_0x5e5359){_0x1f21e8[_0x5b7915(0x163)][_0x5b7915(0x194)]({'name':_0x381305['name'],'action':_0x5b7915(0x1f9),'error':_0x5e5359[_0x5b7915(0x1da)]}),_0x1f21e8[_0x5b7915(0x1fc)][_0x5b7915(0x163)][_0x5b7915(0x150)]++;}}const _0x268b6e=[..._0x40a4ce][_0x5b7915(0x1f6)]((_0x141c1a,_0x432b2d)=>{const _0x5cea6d=_0x5b7915,_0x405c25=_0x141c1a['yaml'][_0x5cea6d(0x183)]?.[_0x5cea6d(0x235)](_0x49b559=>_0x49b559[_0x5cea6d(0x177)]===_0x5cea6d(0x215))??![],_0x54d7f=_0x432b2d['yaml'][_0x5cea6d(0x183)]?.[_0x5cea6d(0x235)](_0x11f7f8=>_0x11f7f8['type']===_0x5cea6d(0x215))??![];if(_0x405c25&&!_0x54d7f)return 0x1;if(!_0x405c25&&_0x54d7f)return-0x1;return 0x0;});for(const _0x35f3e5 of _0x268b6e){_0x138eae=[];try{const _0x4ca600=_0x35f3e5[_0x5b7915(0x184)][_0x5b7915(0x183)]?.['filter'](_0x3287f6=>{const _0xde5d90=_0x5b7915;if(_0x3287f6[_0xde5d90(0x177)]==='agent'&&_0x3287f6[_0xde5d90(0x1bf)]){const _0xc70ee4=parseRef(_0x3287f6[_0xde5d90(0x1bf)]);return _0xc70ee4?.[_0xde5d90(0x160)]===_0x35f3e5[_0xde5d90(0x184)]['name'];}return![];})??[];if(_0x4ca600[_0x5b7915(0x1d6)]>0x0){const _0x4b5bb2=_0x5b7915(0x1ed)+_0x35f3e5[_0x5b7915(0x184)][_0x5b7915(0x160)]+_0x5b7915(0x19d)+_0x5b7915(0x14c);this['logger'][_0x5b7915(0x178)](_0x4b5bb2),_0x138eae[_0x5b7915(0x194)](_0x4b5bb2);}const _0x5da53a=await agentDefToRequest(_0x35f3e5[_0x5b7915(0x184)],_0x35f3e5['systemPrompt'],_0x35f3e5[_0x5b7915(0x155)],_0x40f0b2),_0x8ed50f=await this[_0x5b7915(0x187)][_0x5b7915(0x1ec)](_0x5da53a);_0x230383[_0x5b7915(0x218)](_0x35f3e5[_0x5b7915(0x184)][_0x5b7915(0x160)],_0x8ed50f['id']),_0x1f21e8[_0x5b7915(0x1db)]['push']({'agentName':_0x35f3e5[_0x5b7915(0x184)]['name'],'action':_0x5b7915(0x21c),'agentId':_0x8ed50f['id'],'warnings':_0x138eae[_0x5b7915(0x1d6)]>0x0?_0x138eae:undefined}),_0x1f21e8[_0x5b7915(0x1fc)][_0x5b7915(0x1db)][_0x5b7915(0x21c)]++;}catch(_0xe60172){_0x1f21e8[_0x5b7915(0x1db)]['push']({'agentName':_0x35f3e5[_0x5b7915(0x184)][_0x5b7915(0x160)],'action':_0x5b7915(0x1f9),'error':_0xe60172[_0x5b7915(0x1da)],'warnings':_0x138eae[_0x5b7915(0x1d6)]>0x0?_0x138eae:undefined}),_0x1f21e8[_0x5b7915(0x1fc)][_0x5b7915(0x1db)][_0x5b7915(0x150)]++;}}for(const _0x571c13 of _0x4772ef){try{const _0x4566ae=await yamlPromptToApi(_0x571c13['yaml'],_0x40b767,_0x40f0b2);if(!_0x4566ae){_0x1f21e8[_0x5b7915(0x162)]['push']({'name':_0x571c13[_0x5b7915(0x184)][_0x5b7915(0x160)],'action':_0x5b7915(0x1f9),'error':'Agent\x20reference\x20not\x20found'}),_0x1f21e8[_0x5b7915(0x1fc)][_0x5b7915(0x162)]['errors']++;continue;}const _0x34d29d=await this[_0x5b7915(0x187)][_0x5b7915(0x231)](_0x4566ae);_0x48374d['set'](_0x571c13[_0x5b7915(0x184)][_0x5b7915(0x160)],_0x34d29d['id']),_0x1f21e8[_0x5b7915(0x162)][_0x5b7915(0x194)]({'name':_0x571c13[_0x5b7915(0x184)][_0x5b7915(0x160)],'action':'created','id':_0x34d29d['id']}),_0x1f21e8[_0x5b7915(0x1fc)][_0x5b7915(0x162)][_0x5b7915(0x21c)]++;}catch(_0x410d34){_0x1f21e8[_0x5b7915(0x162)][_0x5b7915(0x194)]({'name':_0x571c13[_0x5b7915(0x184)][_0x5b7915(0x160)],'action':_0x5b7915(0x1f9),'error':_0x410d34['message']}),_0x1f21e8[_0x5b7915(0x1fc)]['prompts'][_0x5b7915(0x150)]++;}}for(const _0x244e0d of _0x2f9c58){try{const _0x310bd9=await yamlIntegrationToApi(_0x244e0d['yaml'],_0x40b767,_0x40f0b2),_0x5af83a=await this['client'][_0x5b7915(0x1af)](_0x310bd9);_0x1f21e8['integrations']['push']({'name':_0x244e0d[_0x5b7915(0x184)][_0x5b7915(0x202)],'action':_0x5b7915(0x21c),'id':_0x5af83a['id']}),_0x1f21e8['counts'][_0x5b7915(0x14e)][_0x5b7915(0x21c)]++;}catch(_0x57ca19){_0x1f21e8[_0x5b7915(0x14e)][_0x5b7915(0x194)]({'name':_0x244e0d[_0x5b7915(0x184)]['service_type'],'action':_0x5b7915(0x1f9),'error':_0x57ca19['message']}),_0x1f21e8[_0x5b7915(0x1fc)][_0x5b7915(0x14e)][_0x5b7915(0x150)]++;}}return _0x1f21e8;}}
|
|
1
|
+
const a102_0x1152af=a102_0x49c3;(function(_0x33e95b,_0x419fcf){const _0x3778c3=a102_0x49c3,_0x57fc6b=_0x33e95b();while(!![]){try{const _0x3cc389=-parseInt(_0x3778c3(0x279))/0x1+-parseInt(_0x3778c3(0x22e))/0x2*(parseInt(_0x3778c3(0x2ae))/0x3)+parseInt(_0x3778c3(0x2b3))/0x4*(parseInt(_0x3778c3(0x214))/0x5)+-parseInt(_0x3778c3(0x1ff))/0x6+-parseInt(_0x3778c3(0x269))/0x7*(-parseInt(_0x3778c3(0x2b7))/0x8)+parseInt(_0x3778c3(0x21c))/0x9+parseInt(_0x3778c3(0x2b6))/0xa;if(_0x3cc389===_0x419fcf)break;else _0x57fc6b['push'](_0x57fc6b['shift']());}catch(_0x5a981a){_0x57fc6b['push'](_0x57fc6b['shift']());}}}(a102_0x494a,0x48624));import{LLMApiClient}from'../client/llm-api-client.js';function a102_0x49c3(_0x597fbd,_0xcd14c4){_0x597fbd=_0x597fbd-0x1da;const _0x494a6c=a102_0x494a();let _0x49c3f3=_0x494a6c[_0x597fbd];return _0x49c3f3;}import*as a102_0x5ce75d from'node:fs';import*as a102_0x25b2e3 from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';function a102_0x494a(){const _0x3ba8af=['signal','pullProject','dryRun','set','site','writeFileSync','deleteAgent','starter_message','2QbhdDM','resolveProjectId','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','counts','Agent\x20\x27','actions','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','errors','listAgents','starterMessage','endsWith','medium','knowledge_bases','getOrCreateDefaultAgent','map','basename','\x27\x20(','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','promptId','split','error','variables','createPrompt','agents.json','\x27.\x20This\x20should\x20not\x20happen.','mkdirSync','displayName','tdx_default_','.llm','resolveAgentId','toISOString','reasoningEffort','tables','isDirectory','resolveProjectName','pushProject','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','attributes','temperature','UNAUTHENTICATED','updateAgent','size','NOT_FOUND','updated','webhookCorsOrigins','starter_message.md','agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat','chatId','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','restoreProject','outputs','\x20→\x20','name','chatIgnoreManagedActions','created','path','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','setDefaultAgent','5054pwJQsJ','getParentSegmentKnowledgeBase','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','client','.yml','setCurrentProject','listChats','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','parse','event','context','oldPath','agent.yml\x20not\x20found\x20in\x20','Agent\x20not\x20found:\x20','LLM_PROJECT_NOT_FOUND','tdDatabaseName','212146NqlbpC','webSearchTools','readdirSync','exportedFrom','utf-8','This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.','\x20attempts\x20due\x20to\x20name\x20conflicts.','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','updateTextKnowledgeBase','listKnowledgeBases','already\x20exists','knowledgebases.json','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','isManaged','getDefaultAgent','):\x20','maxToolIterations','Agent\x20reference\x20not\x20found','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','currentProjectId','chats','agents','get','Unresolved\x20dependencies:\x20','minimal','getProject','getUserSettings','existsSync','clearDefaultAgent','Only\x20safe\x20types\x20(','some','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','Project\x20not\x20found:\x20','target',')\x20can\x20be\x20pushed.\x20','slackMessageMode','chat_generic','projects','info','1.0','unchanged','text','readFileSync','imageGenerators','getDefaultProjectName','type','chat','newProjectId','content','listPrompts','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','message','1428684uaiSAX','listAgentsFull','_reasoning_','template','llm_project','4180YrYkxc','agentId','createIntegration','9083980lOLYAV','1216czBXCz','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','getChatHistory','profile','ALREADY_EXISTS','createAgent','startChat','pushAgent','chat_parent_segment','agent.yml','sdk.llm','createKnowledgeBase','sort','projectName','Unable\x20to\x20create\x20project\x20after\x20','total','INTERNAL','dry-run-','knowledgeBases','availableModels','AGENT_NOT_FOUND','listTextKnowledgeBases','Unsupported\x20backup\x20version:\x20','Renamed\x20text\x20KB\x20file:\x20','service_type','listIntegrations','agent','PERMISSION_DENIED','warn','tdx.json','version','new','modelType','renamed','prompts.json','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','low','length','loadJsonFile','updateKnowledgeBase','models','createTextKnowledgeBase','createProject','chatWelcomeMessage','serviceType','includes','chatInfo','logger','toLowerCase','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','listProjects','stringify','Renamed\x20agent\x20folder:\x20','getBackupMetadata','dir','createImageGenerator','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.','updateAgentResponse','find','listImageGenerators','join','Renamed\x20folder:\x20','metadata','.md','Backup\x20folder\x20not\x20found:\x20','2770098QHfaUW','Multiple\x20projects\x20found\x20with\x20name\x20\x27','getChatInfo','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','cwd','push','pullAgent','textKnowledgeBases','\x0a\x0a#\x20agent.yml\x0a','filter','createAgentResponse','Skipping\x20integration\x20\x27','claude-4.5-sonnet','getAgent','integrations.json','availableModelNames','description','Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.','high','tools','INVALID_ARGUMENT','555kffwKF','#\x20prompt.md\x0a','getOrCreateDefaultProject','project.json','deleteProject','prompts','add','prompt.md','2811636wzpNdH','Renamed\x20KB\x20file:\x20','listWebSearchTools','yaml','Renamed\x20prompt\x20file:\x20','integrations','systemPrompt','agentsFull','Multiple\x20agents\x20found\x20with\x20name\x20\x27','No\x20tdx.json\x20found\x20in\x20'];a102_0x494a=function(){return _0x3ba8af;};return a102_0x494a();}import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlPromptToApi,yamlIntegrationToApi,resolveAgentDependencies}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir}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=[a102_0x1152af(0x29e),'chat_agent_console',a102_0x1152af(0x2bf)];export class LLMSDK{['currentProjectId'];[a102_0x1152af(0x26c)];[a102_0x1152af(0x273)];[a102_0x1152af(0x1ed)]=Logger['of'](a102_0x1152af(0x2c1));constructor(_0x295401){const _0x21354a=a102_0x1152af;this['client']=new LLMApiClient(_0x295401),this[_0x21354a(0x273)]=_0x295401;}[a102_0x1152af(0x2a6)](){const _0x4776e6=a102_0x1152af,_0x138b61=getSanitizedUsername();return _0x4776e6(0x249)+_0x138b61;}async[a102_0x1152af(0x26e)](_0x507ccc){const _0x522bb8=a102_0x1152af,{projectId:_0x27015f}=await this[_0x522bb8(0x250)](_0x507ccc);this[_0x522bb8(0x28c)]=_0x27015f;}['getCurrentProject'](){return this['currentProjectId'];}async[a102_0x1152af(0x268)](_0x1c64b8){const _0x389272=a102_0x1152af,_0x7f776f=this[_0x389272(0x273)]['profile'];let _0x3839be,_0x216269;if(_0x1c64b8[_0x389272(0x1eb)]('/')){const _0x430bd7=_0x1c64b8[_0x389272(0x241)]('/');if(_0x430bd7['length']!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Invalid\x20agent\x20reference\x20format:\x20'+_0x1c64b8,undefined,{'helpText':_0x389272(0x270)});const [_0x378c3c,_0x2b4117]=_0x430bd7;_0x3839be=await this[_0x389272(0x22f)](_0x378c3c),_0x216269=_0x2b4117;}else _0x3839be=this[_0x389272(0x28c)]||(await this[_0x389272(0x216)]())['id'],_0x216269=_0x1c64b8;const _0x162ec3=await this[_0x389272(0x24b)](_0x216269,_0x3839be),_0x55faea=await this[_0x389272(0x26c)][_0x389272(0x20c)](_0x162ec3);writeCachedLLMAgent(_0x55faea['attributes'][_0x389272(0x263)],_0x162ec3,_0x3839be,_0x7f776f);}[a102_0x1152af(0x287)](){const _0x63bf9d=a102_0x1152af,_0xf37ba8=this[_0x63bf9d(0x273)][_0x63bf9d(0x2ba)];return readCachedLLMAgent(_0xf37ba8)||undefined;}[a102_0x1152af(0x295)](){const _0x43f746=a102_0x1152af,_0x20370d=this[_0x43f746(0x273)][_0x43f746(0x2ba)];clearCachedLLMAgent(_0x20370d);}async[a102_0x1152af(0x1e6)](){const _0x289510=a102_0x1152af,_0x4b2681=await this[_0x289510(0x26c)][_0x289510(0x293)](),_0x939fcc=[];for(const _0x19ab1e of _0x4b2681[_0x289510(0x20e)]){const _0x54ce66=_0x4b2681[_0x289510(0x2ca)][_0x19ab1e];_0x54ce66&&_0x939fcc[_0x289510(0x204)]({'name':_0x19ab1e,'displayName':_0x54ce66[_0x289510(0x248)]});}return _0x939fcc;}async[a102_0x1152af(0x1e8)](_0x38fdf9){const _0x4d4913=a102_0x1152af;return await this[_0x4d4913(0x26c)][_0x4d4913(0x1e8)](_0x38fdf9);}async[a102_0x1152af(0x218)](_0x301e55){const _0x9793eb=a102_0x1152af,{projectId:_0x4b3298}=await this[_0x9793eb(0x250)](_0x301e55);await this[_0x9793eb(0x26c)][_0x9793eb(0x218)](_0x4b3298);}async[a102_0x1152af(0x29f)](_0x15abdd=0x32){const _0x3cda3e=a102_0x1152af;return await this[_0x3cda3e(0x26c)][_0x3cda3e(0x1f0)](_0x15abdd);}async[a102_0x1152af(0x216)](_0x26368e){const _0x3de9ab=a102_0x1152af,_0x785624=_0x26368e||this[_0x3de9ab(0x2a6)](),_0x1450fc=this['context'][_0x3de9ab(0x2ba)];if(!_0x26368e){const _0x252b28=readCachedLLMProject(_0x1450fc);if(_0x252b28&&_0x252b28[_0x3de9ab(0x263)]===_0x785624)try{const _0x5174e5=await this[_0x3de9ab(0x26c)]['getProject'](_0x252b28['id']);if(_0x5174e5['attributes'][_0x3de9ab(0x263)]===_0x785624)return _0x5174e5;}catch{}}const _0x2801da=await this[_0x3de9ab(0x26c)][_0x3de9ab(0x1f0)](),_0xa8cede=_0x2801da[_0x3de9ab(0x1f8)](_0x52ad2d=>_0x52ad2d['attributes'][_0x3de9ab(0x263)]===_0x785624);if(_0xa8cede)return!_0x26368e&&writeCachedLLMProject(_0x785624,_0xa8cede['id'],_0x1450fc),_0xa8cede;const _0x49167a=await this[_0x3de9ab(0x26c)][_0x3de9ab(0x1e8)]({'name':_0x785624,'description':_0x3de9ab(0x285)+getSanitizedUsername()+')'});return!_0x26368e&&writeCachedLLMProject(_0x785624,_0x49167a['id'],_0x1450fc),_0x49167a;}async[a102_0x1152af(0x22f)](_0x4c8c62){const _0x34520f=a102_0x1152af,_0x53acb1=await this[_0x34520f(0x26c)][_0x34520f(0x1f0)](),_0x10367e=_0x53acb1[_0x34520f(0x208)](_0x1d4a64=>_0x1d4a64[_0x34520f(0x254)]['name']===_0x4c8c62);if(_0x10367e[_0x34520f(0x1e3)]===0x0)throw new SDKError(ErrorCode[_0x34520f(0x277)],_0x34520f(0x29a)+_0x4c8c62,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x10367e[_0x34520f(0x1e3)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x34520f(0x200)+_0x4c8c62+'\x27.\x20This\x20should\x20not\x20happen.');return _0x10367e[0x0]['id'];}async[a102_0x1152af(0x250)](_0x3cf470){const _0x52211a=a102_0x1152af,_0x216617=await this[_0x52211a(0x26c)][_0x52211a(0x1f0)](),_0x453c2c=_0x216617['find'](_0xa700cc=>_0xa700cc[_0x52211a(0x254)]['name']===_0x3cf470);if(_0x453c2c)return{'projectId':_0x453c2c['id'],'project':_0x453c2c};throw new SDKError(ErrorCode[_0x52211a(0x277)],_0x52211a(0x29a)+_0x3cf470,undefined,{'helpText':_0x52211a(0x26b)});}async[a102_0x1152af(0x23b)](_0x3f2e5b=a102_0x1152af(0x20b),_0x4dcc30=0x0,_0x4462e8){const _0x28dcd9=a102_0x1152af,_0x3a2c59=0xa;let _0x544d89=0x0,_0x27f57c;while(_0x544d89<_0x3a2c59){try{const _0x179dec=await this['getOrCreateDefaultProject'](_0x27f57c),_0xc7014e=_0x179dec['id'],_0x283741=['none',_0x28dcd9(0x291),_0x28dcd9(0x1e2),_0x28dcd9(0x239),_0x28dcd9(0x211)],_0xaa62d3=_0x4dcc30===0x0?'tdx_'+_0x3f2e5b:'tdx_'+_0x3f2e5b+_0x28dcd9(0x2b0)+_0x283741[_0x4dcc30],_0x297066=await this['client'][_0x28dcd9(0x236)](_0xc7014e),_0xa7c74a=_0x297066[_0x28dcd9(0x1f8)](_0x15e3e1=>_0x15e3e1[_0x28dcd9(0x254)][_0x28dcd9(0x263)]===_0xaa62d3);if(_0xa7c74a)return _0xa7c74a;const _0x22bdea=_0x4dcc30>0x0?0x1:_0x4462e8;return await this[_0x28dcd9(0x26c)][_0x28dcd9(0x2bc)]({'name':_0xaa62d3,'projectId':_0xc7014e,'modelType':_0x3f2e5b,'systemPrompt':'','temperature':_0x22bdea,'reasoningEffort':_0x4dcc30>0x0?_0x4dcc30:undefined});}catch(_0x480a3e){if(_0x480a3e instanceof HTTPClientError){const _0x2130e8=_0x480a3e['status'];if(_0x2130e8>=0x190&&_0x2130e8<0x1f4){if(_0x2130e8===0x191)throw new SDKError(ErrorCode[_0x28dcd9(0x256)],_0x28dcd9(0x28b),_0x480a3e);else{if(_0x2130e8===0x193)throw new SDKError(ErrorCode[_0x28dcd9(0x2d2)],_0x28dcd9(0x2ac),_0x480a3e);}throw _0x480a3e;}}if(errorContains(_0x480a3e,_0x28dcd9(0x283),'duplicate','conflict')){_0x544d89++;if(_0x544d89>=_0x3a2c59)throw new SDKError(ErrorCode[_0x28dcd9(0x2bb)],_0x28dcd9(0x2c5)+_0x3a2c59+_0x28dcd9(0x27f),_0x480a3e);const _0x25cfed=this[_0x28dcd9(0x2a6)]();_0x27f57c=_0x25cfed+'_'+generateRandomHex();continue;}throw _0x480a3e;}}throw new SDKError(ErrorCode[_0x28dcd9(0x2c7)],_0x28dcd9(0x1ef));}async['resolveAgentId'](_0xd03188,_0xc5e867){const _0x2f652e=a102_0x1152af,_0x28621d=_0xc5e867||this['currentProjectId'],_0x534dd7=await this[_0x2f652e(0x26c)][_0x2f652e(0x236)](_0x28621d),_0x37d85e=_0x534dd7[_0x2f652e(0x208)](_0x265e10=>_0x265e10[_0x2f652e(0x254)][_0x2f652e(0x263)]===_0xd03188);if(_0x37d85e[_0x2f652e(0x1e3)]===0x0){const _0x6d8551=_0x28621d?'\x20in\x20project\x20'+_0x28621d:'';throw new SDKError(ErrorCode[_0x2f652e(0x2cb)],_0x2f652e(0x276)+_0xd03188+_0x6d8551,undefined,{'helpText':_0x28621d?_0x2f652e(0x267):_0x2f652e(0x1f6)});}if(_0x37d85e[_0x2f652e(0x1e3)]>0x1)throw new SDKError(ErrorCode[_0x2f652e(0x2c7)],_0x2f652e(0x224)+_0xd03188+_0x2f652e(0x246));return _0x37d85e[0x0]['id'];}async['agents'](_0x560d80){const _0x3e15e7=a102_0x1152af,_0x26b51f=_0x560d80||this[_0x3e15e7(0x28c)];return await this['client'][_0x3e15e7(0x236)](_0x26b51f);}async[a102_0x1152af(0x223)](_0x20779f){const _0x1efe0c=a102_0x1152af;return await this['client'][_0x1efe0c(0x2af)](_0x20779f);}async[a102_0x1152af(0x2d1)](_0x23e9f0){const _0x256894=a102_0x1152af;return await this[_0x256894(0x26c)][_0x256894(0x20c)](_0x23e9f0);}async[a102_0x1152af(0x2bc)](_0x517852){const _0x3c932e=a102_0x1152af;return await this[_0x3c932e(0x26c)][_0x3c932e(0x2bc)](_0x517852);}async[a102_0x1152af(0x257)](_0x20d179,_0x1ac41c){const _0x4103a3=a102_0x1152af;return await this[_0x4103a3(0x26c)][_0x4103a3(0x257)](_0x20d179,_0x1ac41c);}async[a102_0x1152af(0x22c)](_0x15f6d0){const _0xc1abbb=a102_0x1152af;await this[_0xc1abbb(0x26c)][_0xc1abbb(0x22c)](_0x15f6d0);}async[a102_0x1152af(0x2bd)](_0xa4c311){const _0x4e1507=a102_0x1152af;return await this[_0x4e1507(0x26c)]['startChat']({'agentId':_0xa4c311});}async*[a102_0x1152af(0x2a8)](_0x5040c9,_0x1e1975){const _0x5b7ddb=a102_0x1152af;let _0x50c331=_0x1e1975?.[_0x5b7ddb(0x25e)];const _0x4f30e9=_0x1e1975?.[_0x5b7ddb(0x2b4)];if(!_0x50c331){if(!_0x4f30e9)throw new Error(_0x5b7ddb(0x25d));const _0x320ec3=await this[_0x5b7ddb(0x26c)]['startChat']({'agentId':_0x4f30e9});_0x50c331=_0x320ec3['id'],yield{'type':_0x5b7ddb(0x1fc),'data':{'chatId':_0x50c331,'agentId':_0x4f30e9}};}for await(const _0x516e33 of this[_0x5b7ddb(0x26c)]['continueChat'](_0x50c331,_0x5040c9,_0x1e1975?.[_0x5b7ddb(0x226)])){yield{'type':_0x5b7ddb(0x272),'data':_0x516e33};}}async[a102_0x1152af(0x28d)](_0x455995=0x32){const _0x35c19b=a102_0x1152af;return await this[_0x35c19b(0x26c)][_0x35c19b(0x26f)](_0x455995);}async['history'](_0x21bb81){const _0x2c868b=a102_0x1152af;return await this[_0x2c868b(0x26c)][_0x2c868b(0x2b9)](_0x21bb81);}async[a102_0x1152af(0x1ec)](_0x1d03e5){const _0x1ef80e=a102_0x1152af;return await this[_0x1ef80e(0x26c)][_0x1ef80e(0x201)](_0x1d03e5);}async['backupProject'](_0x2cca6d,_0x54fd0b,_0x46675a){const _0x338c02=a102_0x1152af,_0x13f231=_0x46675a?.[_0x338c02(0x228)]??![],{projectId:_0x25bfb0,project:_0x23c3db}=await this['resolveProjectName'](_0x2cca6d),_0x5843ec=_0x23c3db[_0x338c02(0x254)]['name'],_0x3c05d9=_0x54fd0b||_0x5843ec+_0x338c02(0x24a);if(a102_0x5ce75d[_0x338c02(0x294)](_0x3c05d9)&&!_0x13f231)throw new SDKError(ErrorCode['ALREADY_EXISTS'],'Output\x20directory\x20already\x20exists:\x20'+_0x3c05d9,undefined,{'helpText':_0x338c02(0x1e1)});const _0x7edb92=await this['client'][_0x338c02(0x2af)](_0x25bfb0),_0x258e27=await this['client'][_0x338c02(0x282)](_0x25bfb0),_0x2c8c9a=await this['client']['listPrompts'](_0x25bfb0),_0x17ad6b=await this[_0x338c02(0x26c)][_0x338c02(0x2d0)](_0x25bfb0);if(!_0x13f231){a102_0x5ce75d[_0x338c02(0x247)](_0x3c05d9,{'recursive':!![]});const _0x27933a={'version':_0x338c02(0x2a1),'exportedAt':new Date()[_0x338c02(0x24c)](),'exportedFrom':{'site':this[_0x338c02(0x273)]['site'],'projectId':_0x25bfb0,'projectName':_0x5843ec},'project':_0x23c3db};a102_0x5ce75d[_0x338c02(0x22b)](a102_0x25b2e3['join'](_0x3c05d9,'project.json'),JSON['stringify'](_0x27933a,null,0x2)),a102_0x5ce75d[_0x338c02(0x22b)](a102_0x25b2e3[_0x338c02(0x1fa)](_0x3c05d9,_0x338c02(0x245)),JSON[_0x338c02(0x1f1)](_0x7edb92,null,0x2)),a102_0x5ce75d[_0x338c02(0x22b)](a102_0x25b2e3[_0x338c02(0x1fa)](_0x3c05d9,_0x338c02(0x284)),JSON[_0x338c02(0x1f1)](_0x258e27,null,0x2)),a102_0x5ce75d['writeFileSync'](a102_0x25b2e3['join'](_0x3c05d9,'prompts.json'),JSON[_0x338c02(0x1f1)](_0x2c8c9a,null,0x2)),a102_0x5ce75d['writeFileSync'](a102_0x25b2e3['join'](_0x3c05d9,_0x338c02(0x20d)),JSON['stringify'](_0x17ad6b,null,0x2));}return{'projectName':_0x5843ec,'outputDir':_0x3c05d9,'counts':{'agents':_0x7edb92['length'],'knowledgeBases':_0x258e27[_0x338c02(0x1e3)],'prompts':_0x2c8c9a[_0x338c02(0x1e3)],'integrations':_0x17ad6b[_0x338c02(0x1e3)]}};}async[a102_0x1152af(0x260)](_0xd278c4,_0x3366e2){const _0x59fce2=a102_0x1152af,_0xfd2c41=_0x3366e2?.[_0x59fce2(0x228)]??![],_0xc92d85=this[_0x59fce2(0x1f3)](_0xd278c4),_0x4e0159=_0xc92d85[_0x59fce2(0x27c)][_0x59fce2(0x22a)],_0x5b2b57=this[_0x59fce2(0x273)][_0x59fce2(0x22a)],_0x2fd5a6=_0x4e0159!==_0x5b2b57?_0x4e0159:undefined,_0x3321d3=this['loadJsonFile'](a102_0x25b2e3['join'](_0xd278c4,_0x59fce2(0x245)),[]),_0x7cb673=this['loadJsonFile'](a102_0x25b2e3[_0x59fce2(0x1fa)](_0xd278c4,_0x59fce2(0x284)),[]),_0x5844aa=this[_0x59fce2(0x1e4)](a102_0x25b2e3[_0x59fce2(0x1fa)](_0xd278c4,_0x59fce2(0x1e0)),[]),_0x110f76=this['loadJsonFile'](a102_0x25b2e3[_0x59fce2(0x1fa)](_0xd278c4,_0x59fce2(0x20d)),[]),_0x26a822=_0x3366e2?.[_0x59fce2(0x263)]||_0xc92d85[_0x59fce2(0x27c)][_0x59fce2(0x2c4)];if(_0xfd2c41){const _0x29de8d=new Map(),_0x4aabf8=[..._0x3321d3],_0x569b94=_0x3321d3[_0x59fce2(0x1e3)]+0x1;let _0x2403e8=0x0;while(_0x4aabf8[_0x59fce2(0x1e3)]>0x0&&_0x2403e8<_0x569b94){_0x2403e8++;const _0xca3fb5=[];for(const _0x204495 of _0x4aabf8){canCreateAgent(_0x204495,_0x29de8d)?_0x29de8d['set'](_0x204495['id'],_0x59fce2(0x2c8)+_0x204495['id']):_0xca3fb5[_0x59fce2(0x204)](_0x204495);}if(_0xca3fb5[_0x59fce2(0x1e3)]===_0x4aabf8[_0x59fce2(0x1e3)])throw new SDKError(ErrorCode[_0x59fce2(0x2c7)],_0x59fce2(0x299),undefined,{'helpText':_0x59fce2(0x23f)});_0x4aabf8[_0x59fce2(0x1e3)]=0x0,_0x4aabf8[_0x59fce2(0x204)](..._0xca3fb5);}const _0x19c297=_0x5844aa[_0x59fce2(0x208)](_0x1b3112=>_0x29de8d['has'](_0x1b3112[_0x59fce2(0x254)][_0x59fce2(0x2b4)]))[_0x59fce2(0x1e3)];return{'projectName':_0x26a822,'projectId':'(dry-run)','counts':{'agents':_0x3321d3['length'],'knowledgeBases':_0x7cb673[_0x59fce2(0x1e3)],'prompts':_0x19c297,'integrations':_0x110f76[_0x59fce2(0x1e3)]},'sourceSite':_0x2fd5a6};}const _0x3626a1=await this[_0x59fce2(0x26c)][_0x59fce2(0x1e8)]({'name':_0x26a822,'description':_0xc92d85['project'][_0x59fce2(0x254)][_0x59fce2(0x20f)]}),_0x589ddf=_0x3626a1['id'],_0x24476f=new Map(),_0x767cb6=new Map(),_0x1529c3=new Map();for(const _0x15d593 of _0x7cb673){const _0x518811=await this[_0x59fce2(0x26c)][_0x59fce2(0x2c2)]({'projectId':_0x589ddf,'name':_0x15d593[_0x59fce2(0x254)][_0x59fce2(0x263)],'tdDatabaseName':_0x15d593['attributes'][_0x59fce2(0x278)],'tables':_0x15d593[_0x59fce2(0x254)][_0x59fce2(0x24e)]});_0x24476f[_0x59fce2(0x229)](_0x15d593['id'],_0x518811['id']);}const _0x4b82e0=[..._0x3321d3],_0x5ab582=_0x3321d3[_0x59fce2(0x1e3)]+0x1;let _0x1fffa6=0x0;while(_0x4b82e0['length']>0x0&&_0x1fffa6<_0x5ab582){_0x1fffa6++;const _0x2d8230=[];for(const _0x551fea of _0x4b82e0){if(canCreateAgent(_0x551fea,_0x767cb6)){const _0xae4f65=remapToolIds(_0x551fea['attributes'][_0x59fce2(0x212)],_0x24476f,_0x767cb6),_0x5ed92a=remapVariableIds(_0x551fea[_0x59fce2(0x254)][_0x59fce2(0x243)],_0x24476f),_0x48f2b2=await this['client'][_0x59fce2(0x209)]({'name':_0x551fea[_0x59fce2(0x254)][_0x59fce2(0x263)],'projectId':_0x589ddf,'systemPrompt':_0x551fea[_0x59fce2(0x254)][_0x59fce2(0x222)],'starterMessage':_0x551fea[_0x59fce2(0x254)][_0x59fce2(0x237)],'modelType':migrateModelType(_0x551fea['attributes'][_0x59fce2(0x1de)]),'maxToolIterations':_0x551fea['attributes'][_0x59fce2(0x289)],'temperature':_0x551fea[_0x59fce2(0x254)][_0x59fce2(0x255)],'reasoningEffort':_0x551fea[_0x59fce2(0x254)][_0x59fce2(0x24d)],'outputs':_0x551fea['attributes'][_0x59fce2(0x261)],'tools':_0xae4f65,'variables':_0x5ed92a});_0x767cb6['set'](_0x551fea['id'],_0x48f2b2['id']);}else _0x2d8230['push'](_0x551fea);}if(_0x2d8230[_0x59fce2(0x1e3)]===_0x4b82e0[_0x59fce2(0x1e3)])throw new SDKError(ErrorCode[_0x59fce2(0x2c7)],_0x59fce2(0x299),undefined,{'helpText':_0x59fce2(0x23f)});_0x4b82e0[_0x59fce2(0x1e3)]=0x0,_0x4b82e0[_0x59fce2(0x204)](..._0x2d8230);}for(const _0x1b2a58 of _0x5844aa){const _0x1312db=_0x767cb6[_0x59fce2(0x28f)](_0x1b2a58[_0x59fce2(0x254)][_0x59fce2(0x2b4)]);if(!_0x1312db)continue;const _0x545c3a=await this[_0x59fce2(0x26c)][_0x59fce2(0x244)]({'projectId':_0x589ddf,'agentId':_0x1312db,'name':_0x1b2a58[_0x59fce2(0x254)][_0x59fce2(0x263)],'systemPrompt':_0x1b2a58[_0x59fce2(0x254)][_0x59fce2(0x222)],'template':_0x1b2a58[_0x59fce2(0x254)][_0x59fce2(0x2b1)],'jsonSchemaHint':_0x1b2a58[_0x59fce2(0x254)]['jsonSchemaHint']});_0x1529c3[_0x59fce2(0x229)](_0x1b2a58['id'],_0x545c3a['id']);}for(const _0x59bc60 of _0x110f76){const _0x2c75c0=_0x59bc60['attributes'][_0x59fce2(0x233)][_0x59fce2(0x23c)](_0x3f6059=>({..._0x3f6059,'promptId':_0x1529c3[_0x59fce2(0x28f)](_0x3f6059['promptId'])||_0x3f6059[_0x59fce2(0x240)]}));await this[_0x59fce2(0x26c)][_0x59fce2(0x2b5)]({'projectId':_0x589ddf,'serviceType':_0x59bc60['attributes'][_0x59fce2(0x1ea)],'actions':_0x2c75c0,'slackMessageMode':_0x59bc60['attributes'][_0x59fce2(0x29d)],'chatIgnoreManagedActions':_0x59bc60[_0x59fce2(0x254)][_0x59fce2(0x264)],'chatWelcomeMessage':_0x59bc60[_0x59fce2(0x254)][_0x59fce2(0x1e9)],'webhookCorsOrigins':_0x59bc60[_0x59fce2(0x254)][_0x59fce2(0x25b)]});}return{'projectName':_0x26a822,'projectId':_0x589ddf,'counts':{'agents':_0x767cb6[_0x59fce2(0x258)],'knowledgeBases':_0x24476f[_0x59fce2(0x258)],'prompts':_0x1529c3[_0x59fce2(0x258)],'integrations':_0x110f76[_0x59fce2(0x1e3)]},'sourceSite':_0x2fd5a6};}[a102_0x1152af(0x1e4)](_0xb5615b,_0x336550){const _0x3a19e3=a102_0x1152af;if(!a102_0x5ce75d[_0x3a19e3(0x294)](_0xb5615b))return _0x336550;return JSON[_0x3a19e3(0x271)](a102_0x5ce75d[_0x3a19e3(0x2a4)](_0xb5615b,_0x3a19e3(0x27d)));}[a102_0x1152af(0x1f3)](_0x656a2e){const _0x3c3380=a102_0x1152af;if(!a102_0x5ce75d[_0x3c3380(0x294)](_0x656a2e))throw new SDKError(ErrorCode[_0x3c3380(0x259)],_0x3c3380(0x1fe)+_0x656a2e,undefined,{'helpText':_0x3c3380(0x280)});const _0x4b0b59=a102_0x25b2e3['join'](_0x656a2e,_0x3c3380(0x217));if(!a102_0x5ce75d['existsSync'](_0x4b0b59))throw new SDKError(ErrorCode[_0x3c3380(0x213)],_0x3c3380(0x230)+_0x656a2e,undefined,{'helpText':_0x3c3380(0x2b8)});const _0x3ee7ae=JSON[_0x3c3380(0x271)](a102_0x5ce75d[_0x3c3380(0x2a4)](_0x4b0b59,_0x3c3380(0x27d)));if(!isSupportedBackupVersion(_0x3ee7ae[_0x3c3380(0x1dc)]))throw new SDKError(ErrorCode[_0x3c3380(0x213)],_0x3c3380(0x2cd)+_0x3ee7ae[_0x3c3380(0x1dc)],undefined,{'helpText':_0x3c3380(0x27e)});return _0x3ee7ae;}async[a102_0x1152af(0x227)](_0x3e31f0,_0x6583cd,_0x46c53a){const _0x3331c8=a102_0x1152af,{projectId:_0x171ca9,project:_0x31eb69}=await this[_0x3331c8(0x250)](_0x3e31f0),_0x267b16=_0x31eb69[_0x3331c8(0x254)][_0x3331c8(0x263)];let _0x5f1fab;if(_0x6583cd)_0x5f1fab=_0x6583cd;else{const _0x52365d=a102_0x25b2e3['join'](process[_0x3331c8(0x203)](),_0x3331c8(0x28e)),_0x441ad8=getSanitizedPathWithMigration(_0x52365d,_0x267b16);_0x441ad8[_0x3331c8(0x1df)]&&this[_0x3331c8(0x1ed)]['info']('Renamed\x20folder:\x20'+a102_0x25b2e3[_0x3331c8(0x23d)](_0x441ad8[_0x3331c8(0x274)])+_0x3331c8(0x262)+a102_0x25b2e3['basename'](_0x441ad8[_0x3331c8(0x266)])),_0x5f1fab=_0x441ad8[_0x3331c8(0x266)];}const _0x23f177=await this[_0x3331c8(0x26c)][_0x3331c8(0x2af)](_0x171ca9),_0x1f4bce=await this[_0x3331c8(0x26c)][_0x3331c8(0x282)](_0x171ca9),_0x20ee71=await this[_0x3331c8(0x26c)][_0x3331c8(0x2cc)](_0x171ca9),_0x1a82db=await this['client'][_0x3331c8(0x1f9)](_0x171ca9),_0x59e322=await this[_0x3331c8(0x26c)][_0x3331c8(0x21e)](_0x171ca9),_0x5307cb=await this[_0x3331c8(0x26c)][_0x3331c8(0x2ab)](_0x171ca9),_0x259af0=await this['client'][_0x3331c8(0x2d0)](_0x171ca9),_0x8f901f=_0x259af0[_0x3331c8(0x208)](_0x282b73=>!_0x282b73[_0x3331c8(0x254)][_0x3331c8(0x286)]&&SAFE_INTEGRATION_TYPES[_0x3331c8(0x1eb)](_0x282b73[_0x3331c8(0x254)][_0x3331c8(0x1ea)][_0x3331c8(0x1ee)]())),_0x200d17=new Map(),_0x4042ff=new Map(),_0x150af3=new Map(),_0x508515=new Map(),_0x21ee6d=new Map(),_0x30dd6c=new Map();for(const _0x2c26b4 of _0x23f177){_0x200d17[_0x3331c8(0x229)](_0x2c26b4['id'],_0x2c26b4[_0x3331c8(0x254)][_0x3331c8(0x263)]);}for(const _0x51ec1a of _0x1f4bce){_0x4042ff[_0x3331c8(0x229)](_0x51ec1a['id'],_0x51ec1a[_0x3331c8(0x254)]['name']);}for(const _0x4f4cbe of _0x20ee71){_0x150af3[_0x3331c8(0x229)](_0x4f4cbe['id'],_0x4f4cbe['attributes'][_0x3331c8(0x263)]);}for(const _0x3ba6ae of _0x1a82db){_0x508515[_0x3331c8(0x229)](_0x3ba6ae['id'],_0x3ba6ae[_0x3331c8(0x254)][_0x3331c8(0x263)]);}for(const _0x4087ca of _0x59e322){_0x21ee6d[_0x3331c8(0x229)](_0x4087ca['id'],_0x4087ca[_0x3331c8(0x254)][_0x3331c8(0x263)]);}for(const _0x2d4cd3 of _0x5307cb){_0x30dd6c[_0x3331c8(0x229)](_0x2d4cd3['id'],_0x2d4cd3['attributes']['name']);}const _0x43f987={'resolveKnowledgeBaseName':async _0x436cc6=>_0x4042ff['get'](_0x436cc6),'resolveTextKnowledgeBaseName':async _0x28221a=>_0x150af3[_0x3331c8(0x28f)](_0x28221a),'resolveAgentName':async _0x1e585a=>_0x200d17[_0x3331c8(0x28f)](_0x1e585a),'resolveWebSearchToolName':async _0xbb3a5e=>_0x21ee6d[_0x3331c8(0x28f)](_0xbb3a5e),'resolveImageGeneratorName':async _0x588a1f=>_0x508515[_0x3331c8(0x28f)](_0x588a1f),'resolvePromptName':async _0x43f79e=>_0x30dd6c[_0x3331c8(0x28f)](_0x43f79e),'onWarning':_0x35abcd=>this[_0x3331c8(0x1ed)][_0x3331c8(0x1da)](_0x35abcd)},_0xa29754={'projectName':_0x267b16,'outputDir':_0x5f1fab,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'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}}},_0x28cb27=[];for(const _0x422c4c of _0x23f177){const _0x2bee97=getSanitizedPathWithMigration(_0x5f1fab,_0x422c4c[_0x3331c8(0x254)]['name']);_0x2bee97[_0x3331c8(0x1df)]&&this[_0x3331c8(0x1ed)]['info'](_0x3331c8(0x1f2)+a102_0x25b2e3[_0x3331c8(0x23d)](_0x2bee97['oldPath'])+'\x20→\x20'+a102_0x25b2e3[_0x3331c8(0x23d)](_0x2bee97[_0x3331c8(0x266)]));const _0x95c1a6=_0x2bee97['path'],_0x3c42b0=a102_0x25b2e3[_0x3331c8(0x1fa)](_0x95c1a6,_0x3331c8(0x21b)),_0x3e34f6=a102_0x25b2e3[_0x3331c8(0x1fa)](_0x95c1a6,_0x3331c8(0x2c0)),_0xcf58bd=a102_0x25b2e3[_0x3331c8(0x1fa)](_0x95c1a6,_0x3331c8(0x25c)),{yaml:_0x3bd11f,systemPrompt:_0x31ffda,starterMessage:_0x2c4aa7}=await agentResponseToDef(_0x422c4c,_0x43f987),_0x511d14=toAgentYamlString(_0x3bd11f),_0x4bc18c=!a102_0x5ce75d['existsSync'](_0x3e34f6);let _0x295c70=_0x4bc18c,_0x5b25c6;if(!_0x4bc18c){const _0x38e134=a102_0x5ce75d[_0x3331c8(0x294)](_0x3c42b0)?a102_0x5ce75d[_0x3331c8(0x2a4)](_0x3c42b0,'utf-8'):'',_0x49a637=a102_0x5ce75d[_0x3331c8(0x2a4)](_0x3e34f6,'utf-8'),_0xe8a90f=_0x3331c8(0x215)+_0x38e134+_0x3331c8(0x207)+_0x49a637,_0x4638ff=_0x3331c8(0x215)+_0x31ffda+_0x3331c8(0x207)+_0x511d14,_0x317547=generateDiff(_0xe8a90f,_0x4638ff);_0x295c70=hasChanges(_0x317547),_0x295c70&&(_0x5b25c6=formatDiffWithColors(_0x317547));}_0x28cb27[_0x3331c8(0x204)]({'path':_0x95c1a6,'content':'','isDir':!![]}),_0x28cb27[_0x3331c8(0x204)]({'path':_0x3c42b0,'content':_0x31ffda}),_0x28cb27[_0x3331c8(0x204)]({'path':_0x3e34f6,'content':_0x511d14});_0x2c4aa7&&_0x2c4aa7[_0x3331c8(0x1eb)]('\x0a')&&_0x28cb27['push']({'path':_0xcf58bd,'content':_0x2c4aa7});_0xa29754[_0x3331c8(0x28e)]['push']({'agentName':_0x422c4c[_0x3331c8(0x254)]['name'],'outputPath':_0x95c1a6,'isNew':_0x4bc18c,'hasChanges':_0x295c70,'diff':_0x5b25c6}),_0xa29754[_0x3331c8(0x231)][_0x3331c8(0x28e)]['total']++;if(_0x4bc18c)_0xa29754['counts']['agents'][_0x3331c8(0x1dd)]++;else{if(_0x295c70)_0xa29754['counts'][_0x3331c8(0x28e)][_0x3331c8(0x25a)]++;else _0xa29754[_0x3331c8(0x231)][_0x3331c8(0x28e)][_0x3331c8(0x2a2)]++;}}for(const _0x3a490a of _0x1f4bce){if(_0x3a490a[_0x3331c8(0x254)][_0x3331c8(0x286)])continue;const _0x555c1e=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x5f1fab),_0x3a490a[_0x3331c8(0x254)][_0x3331c8(0x263)],_0x3331c8(0x26d));_0x555c1e[_0x3331c8(0x1df)]&&this[_0x3331c8(0x1ed)]['info'](_0x3331c8(0x21d)+a102_0x25b2e3['basename'](_0x555c1e[_0x3331c8(0x274)])+'\x20→\x20'+a102_0x25b2e3[_0x3331c8(0x23d)](_0x555c1e[_0x3331c8(0x266)]));const _0x233fc2=_0x555c1e['path'],_0x4a6a85=apiKnowledgeBaseToYaml(_0x3a490a),_0x15aac7=toKnowledgeBaseYamlString(_0x4a6a85),_0x478963=!a102_0x5ce75d[_0x3331c8(0x294)](_0x233fc2);let _0x4c180c=_0x478963,_0x30805d;if(!_0x478963){const _0xcadbd1=a102_0x5ce75d[_0x3331c8(0x2a4)](_0x233fc2,_0x3331c8(0x27d)),_0x405cf8=generateDiff(_0xcadbd1,_0x15aac7);_0x4c180c=hasChanges(_0x405cf8),_0x4c180c&&(_0x30805d=formatDiffWithColors(_0x405cf8));}_0x28cb27[_0x3331c8(0x204)]({'path':_0x233fc2,'content':_0x15aac7}),_0xa29754['knowledgeBases']['push']({'name':_0x3a490a['attributes']['name'],'outputPath':_0x233fc2,'isNew':_0x478963,'hasChanges':_0x4c180c,'diff':_0x30805d}),_0xa29754[_0x3331c8(0x231)]['knowledgeBases'][_0x3331c8(0x2c6)]++;if(_0x478963)_0xa29754['counts'][_0x3331c8(0x2c9)][_0x3331c8(0x1dd)]++;else{if(_0x4c180c)_0xa29754[_0x3331c8(0x231)][_0x3331c8(0x2c9)]['updated']++;else _0xa29754[_0x3331c8(0x231)][_0x3331c8(0x2c9)]['unchanged']++;}}for(const _0x3881a9 of _0x20ee71){if(_0x3881a9[_0x3331c8(0x254)]['isManaged'])continue;const _0x38476c=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x5f1fab),_0x3881a9[_0x3331c8(0x254)][_0x3331c8(0x263)],_0x3331c8(0x1fd));_0x38476c['renamed']&&this[_0x3331c8(0x1ed)][_0x3331c8(0x2a0)](_0x3331c8(0x2ce)+a102_0x25b2e3['basename'](_0x38476c[_0x3331c8(0x274)])+'\x20→\x20'+a102_0x25b2e3[_0x3331c8(0x23d)](_0x38476c[_0x3331c8(0x266)]));const _0x43b101=_0x38476c[_0x3331c8(0x266)],_0x29c15b=toTextKnowledgeBaseMd(_0x3881a9[_0x3331c8(0x254)]['name'],_0x3881a9[_0x3331c8(0x254)][_0x3331c8(0x2a3)]),_0x377505=!a102_0x5ce75d[_0x3331c8(0x294)](_0x43b101);let _0x43a2e9=_0x377505,_0x3b9a5b;if(!_0x377505){const _0x78289c=a102_0x5ce75d[_0x3331c8(0x2a4)](_0x43b101,'utf-8'),_0x2f75bc=generateDiff(_0x78289c,_0x29c15b);_0x43a2e9=hasChanges(_0x2f75bc),_0x43a2e9&&(_0x3b9a5b=formatDiffWithColors(_0x2f75bc));}_0x28cb27['push']({'path':_0x43b101,'content':_0x29c15b}),_0xa29754['textKnowledgeBases'][_0x3331c8(0x204)]({'name':_0x3881a9[_0x3331c8(0x254)][_0x3331c8(0x263)],'outputPath':_0x43b101,'isNew':_0x377505,'hasChanges':_0x43a2e9,'diff':_0x3b9a5b}),_0xa29754[_0x3331c8(0x231)]['textKnowledgeBases'][_0x3331c8(0x2c6)]++;if(_0x377505)_0xa29754[_0x3331c8(0x231)]['textKnowledgeBases']['new']++;else{if(_0x43a2e9)_0xa29754[_0x3331c8(0x231)][_0x3331c8(0x206)]['updated']++;else _0xa29754[_0x3331c8(0x231)][_0x3331c8(0x206)][_0x3331c8(0x2a2)]++;}}for(const _0x42d474 of _0x5307cb){if(_0x42d474[_0x3331c8(0x254)][_0x3331c8(0x286)])continue;const _0x4a0d43=getSanitizedPathWithMigration(getPromptsDir(_0x5f1fab),_0x42d474[_0x3331c8(0x254)][_0x3331c8(0x263)],_0x3331c8(0x26d));_0x4a0d43[_0x3331c8(0x1df)]&&this['logger'][_0x3331c8(0x2a0)](_0x3331c8(0x220)+a102_0x25b2e3['basename'](_0x4a0d43[_0x3331c8(0x274)])+_0x3331c8(0x262)+a102_0x25b2e3[_0x3331c8(0x23d)](_0x4a0d43['path']));const _0x60553f=_0x4a0d43[_0x3331c8(0x266)],_0x38f336=await apiPromptToYaml(_0x42d474,_0x43f987);if(!_0x38f336)continue;const _0xb67d28=toPromptYamlString(_0x38f336),_0x4ab31c=!a102_0x5ce75d[_0x3331c8(0x294)](_0x60553f);let _0x3a1961=_0x4ab31c,_0x3f4bd6;if(!_0x4ab31c){const _0x31be15=a102_0x5ce75d['readFileSync'](_0x60553f,_0x3331c8(0x27d)),_0x1809b1=generateDiff(_0x31be15,_0xb67d28);_0x3a1961=hasChanges(_0x1809b1),_0x3a1961&&(_0x3f4bd6=formatDiffWithColors(_0x1809b1));}_0x28cb27[_0x3331c8(0x204)]({'path':_0x60553f,'content':_0xb67d28}),_0xa29754[_0x3331c8(0x219)][_0x3331c8(0x204)]({'name':_0x42d474[_0x3331c8(0x254)]['name'],'outputPath':_0x60553f,'isNew':_0x4ab31c,'hasChanges':_0x3a1961,'diff':_0x3f4bd6}),_0xa29754[_0x3331c8(0x231)][_0x3331c8(0x219)][_0x3331c8(0x2c6)]++;if(_0x4ab31c)_0xa29754[_0x3331c8(0x231)][_0x3331c8(0x219)][_0x3331c8(0x1dd)]++;else{if(_0x3a1961)_0xa29754[_0x3331c8(0x231)][_0x3331c8(0x219)]['updated']++;else _0xa29754[_0x3331c8(0x231)][_0x3331c8(0x219)][_0x3331c8(0x2a2)]++;}}for(const _0x33a6c1 of _0x8f901f){const _0x379694=_0x33a6c1['attributes']['serviceType']['toLowerCase'](),_0x5d1f9c=getSanitizedPathWithMigration(getIntegrationsDir(_0x5f1fab),_0x379694,_0x3331c8(0x26d));_0x5d1f9c['renamed']&&this[_0x3331c8(0x1ed)]['info']('Renamed\x20integration\x20file:\x20'+a102_0x25b2e3['basename'](_0x5d1f9c[_0x3331c8(0x274)])+_0x3331c8(0x262)+a102_0x25b2e3[_0x3331c8(0x23d)](_0x5d1f9c[_0x3331c8(0x266)]));const _0x4e89c7=_0x5d1f9c['path'],_0x22e3ed=await apiIntegrationToYaml(_0x33a6c1,_0x43f987),_0x385876=toIntegrationYamlString(_0x22e3ed),_0x18426c=!a102_0x5ce75d[_0x3331c8(0x294)](_0x4e89c7);let _0x327c4c=_0x18426c,_0x40976e;if(!_0x18426c){const _0x4af153=a102_0x5ce75d['readFileSync'](_0x4e89c7,_0x3331c8(0x27d)),_0x4022b5=generateDiff(_0x4af153,_0x385876);_0x327c4c=hasChanges(_0x4022b5),_0x327c4c&&(_0x40976e=formatDiffWithColors(_0x4022b5));}_0x28cb27[_0x3331c8(0x204)]({'path':_0x4e89c7,'content':_0x385876}),_0xa29754[_0x3331c8(0x221)][_0x3331c8(0x204)]({'name':_0x379694,'outputPath':_0x4e89c7,'isNew':_0x18426c,'hasChanges':_0x327c4c,'diff':_0x40976e}),_0xa29754['counts'][_0x3331c8(0x221)][_0x3331c8(0x2c6)]++;if(_0x18426c)_0xa29754['counts'][_0x3331c8(0x221)]['new']++;else{if(_0x327c4c)_0xa29754['counts'][_0x3331c8(0x221)][_0x3331c8(0x25a)]++;else _0xa29754[_0x3331c8(0x231)]['integrations'][_0x3331c8(0x2a2)]++;}}if(_0x46c53a?.[_0x3331c8(0x228)])return _0xa29754;a102_0x5ce75d[_0x3331c8(0x247)](_0x5f1fab,{'recursive':!![]}),a102_0x5ce75d[_0x3331c8(0x247)](getKnowledgeBasesDir(_0x5f1fab),{'recursive':!![]}),a102_0x5ce75d[_0x3331c8(0x247)](getPromptsDir(_0x5f1fab),{'recursive':!![]}),a102_0x5ce75d[_0x3331c8(0x247)](getIntegrationsDir(_0x5f1fab),{'recursive':!![]});const _0x6f2073=a102_0x25b2e3[_0x3331c8(0x1fa)](_0x5f1fab,'tdx.json');a102_0x5ce75d[_0x3331c8(0x22b)](_0x6f2073,createAgentConfigContent(_0x267b16));for(const _0x2376cc of _0x28cb27){if(_0x2376cc['isDir'])a102_0x5ce75d['mkdirSync'](_0x2376cc[_0x3331c8(0x266)],{'recursive':!![]});else{const _0x46e077=a102_0x25b2e3['dirname'](_0x2376cc[_0x3331c8(0x266)]);!a102_0x5ce75d[_0x3331c8(0x294)](_0x46e077)&&a102_0x5ce75d['mkdirSync'](_0x46e077,{'recursive':!![]}),a102_0x5ce75d['writeFileSync'](_0x2376cc['path'],_0x2376cc[_0x3331c8(0x2aa)]);}}return _0xa29754;}async[a102_0x1152af(0x251)](_0x2a866d,_0x181e08){const _0x34e6c0=a102_0x1152af,_0x311fc8=a102_0x25b2e3[_0x34e6c0(0x1fa)](_0x2a866d,'tdx.json');if(!a102_0x5ce75d['existsSync'](_0x311fc8))throw new SDKError(ErrorCode[_0x34e6c0(0x213)],_0x34e6c0(0x225)+_0x2a866d,undefined,{'helpText':_0x34e6c0(0x253)});const _0x261b87=loadAgentConfig(_0x311fc8),_0x3eb2ba=await this[_0x34e6c0(0x22f)](_0x261b87['llm_project']),_0x3d3860=await this[_0x34e6c0(0x26c)][_0x34e6c0(0x292)](_0x3eb2ba),_0x579738=_0x3d3860[_0x34e6c0(0x254)][_0x34e6c0(0x263)],_0x4ff96c={'projectName':_0x579738,'projectId':_0x3eb2ba,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'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},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x1a1817=[],_0x50a51b=[],_0x53d843=[],_0x5cd471=[],_0x708122=a102_0x5ce75d[_0x34e6c0(0x27b)](_0x2a866d,{'withFileTypes':!![]});for(const _0x99771c of _0x708122){if(!_0x99771c['isDirectory']())continue;if(['knowledge_bases',_0x34e6c0(0x219),_0x34e6c0(0x221)]['includes'](_0x99771c[_0x34e6c0(0x263)]))continue;const _0x18fc59=a102_0x25b2e3[_0x34e6c0(0x1fa)](_0x2a866d,_0x99771c[_0x34e6c0(0x263)]);if(isAgentDir(_0x18fc59)){const _0x53b1db=a102_0x25b2e3[_0x34e6c0(0x1fa)](_0x18fc59,_0x34e6c0(0x2c0)),_0x3915f2=a102_0x25b2e3[_0x34e6c0(0x1fa)](_0x18fc59,_0x34e6c0(0x21b)),_0x1a5c28=a102_0x25b2e3[_0x34e6c0(0x1fa)](_0x18fc59,_0x34e6c0(0x25c)),_0x85cc2=parseAgentYaml(a102_0x5ce75d[_0x34e6c0(0x2a4)](_0x53b1db,_0x34e6c0(0x27d)),_0x53b1db),_0xbd525f=a102_0x5ce75d['existsSync'](_0x3915f2)?a102_0x5ce75d['readFileSync'](_0x3915f2,_0x34e6c0(0x27d)):'',_0x2c9e1d=a102_0x5ce75d[_0x34e6c0(0x294)](_0x1a5c28)?a102_0x5ce75d[_0x34e6c0(0x2a4)](_0x1a5c28,'utf-8'):_0x85cc2['starter_message'];_0x1a1817['push']({'name':_0x85cc2[_0x34e6c0(0x263)],'dir':_0x18fc59,'yaml':_0x85cc2,'systemPrompt':_0xbd525f,'starterMessage':_0x2c9e1d});}}const _0x54eb18=getKnowledgeBasesDir(_0x2a866d);if(a102_0x5ce75d[_0x34e6c0(0x294)](_0x54eb18)){const _0x20dad9=a102_0x5ce75d[_0x34e6c0(0x27b)](_0x54eb18);for(const _0x58ba9f of _0x20dad9){const _0x405559=a102_0x25b2e3[_0x34e6c0(0x1fa)](_0x54eb18,_0x58ba9f);if(_0x58ba9f[_0x34e6c0(0x238)](_0x34e6c0(0x26d))){const _0x1cedd7=parseKnowledgeBaseYaml(a102_0x5ce75d[_0x34e6c0(0x2a4)](_0x405559,_0x34e6c0(0x27d)),_0x405559);_0x50a51b[_0x34e6c0(0x204)]({'name':_0x1cedd7[_0x34e6c0(0x263)],'path':_0x405559,'yaml':_0x1cedd7});}else{if(_0x58ba9f[_0x34e6c0(0x238)]('.md')){const _0x5ace08=a102_0x5ce75d[_0x34e6c0(0x2a4)](_0x405559,_0x34e6c0(0x27d)),{name:_0x5ba916,text:_0x523e22}=parseTextKnowledgeBaseMd(_0x5ace08,_0x58ba9f);_0x53d843[_0x34e6c0(0x204)]({'name':_0x5ba916,'path':_0x405559,'text':_0x523e22});}}}}const _0x16e984=getPromptsDir(_0x2a866d);if(a102_0x5ce75d[_0x34e6c0(0x294)](_0x16e984)){const _0x1851ec=a102_0x5ce75d[_0x34e6c0(0x27b)](_0x16e984)[_0x34e6c0(0x208)](_0x5c2afc=>_0x5c2afc['endsWith'](_0x34e6c0(0x26d)));for(const _0x4354c8 of _0x1851ec){const _0x44df95=a102_0x25b2e3['join'](_0x16e984,_0x4354c8),_0x7ed10c=parsePromptYaml(a102_0x5ce75d[_0x34e6c0(0x2a4)](_0x44df95,_0x34e6c0(0x27d)),_0x44df95);_0x5cd471['push']({'name':_0x7ed10c[_0x34e6c0(0x263)],'path':_0x44df95,'yaml':_0x7ed10c});}}const _0x392da6=[],_0x1bf689=getIntegrationsDir(_0x2a866d);if(a102_0x5ce75d['existsSync'](_0x1bf689)){const _0x439136=a102_0x5ce75d[_0x34e6c0(0x27b)](_0x1bf689)['filter'](_0x4e702f=>_0x4e702f[_0x34e6c0(0x238)]('.yml'));for(const _0x30c1b3 of _0x439136){const _0x40ce7c=a102_0x25b2e3[_0x34e6c0(0x1fa)](_0x1bf689,_0x30c1b3),_0x161581=parseIntegrationYaml(a102_0x5ce75d[_0x34e6c0(0x2a4)](_0x40ce7c,'utf-8'),_0x40ce7c);if(!SAFE_INTEGRATION_TYPES['includes'](_0x161581[_0x34e6c0(0x2cf)]['toLowerCase']())){this['logger'][_0x34e6c0(0x1da)](_0x34e6c0(0x20a)+_0x161581['name']+'\x27\x20('+_0x161581[_0x34e6c0(0x2cf)]+_0x34e6c0(0x288)+(_0x34e6c0(0x296)+SAFE_INTEGRATION_TYPES[_0x34e6c0(0x1fa)](',\x20')+_0x34e6c0(0x29c))+_0x34e6c0(0x210));continue;}_0x392da6['push']({'name':_0x161581[_0x34e6c0(0x263)],'path':_0x40ce7c,'yaml':_0x161581});}}const _0x3bd936=await this[_0x34e6c0(0x26c)][_0x34e6c0(0x2af)](_0x3eb2ba),_0x155b60=await this['client']['listKnowledgeBases'](_0x3eb2ba),_0x3a3dce=await this[_0x34e6c0(0x26c)][_0x34e6c0(0x2cc)](_0x3eb2ba),_0x4e512b=await this['client'][_0x34e6c0(0x1f9)](_0x3eb2ba),_0x5de026=await this[_0x34e6c0(0x26c)]['listWebSearchTools'](_0x3eb2ba),_0x343f4f=await this[_0x34e6c0(0x26c)][_0x34e6c0(0x2ab)](_0x3eb2ba),_0x3fdeed=await this[_0x34e6c0(0x26c)]['listIntegrations'](_0x3eb2ba),_0x539a40=await this[_0x34e6c0(0x26c)][_0x34e6c0(0x26a)](_0x3eb2ba),_0x103525=new Map(),_0x2dfcd9=new Map(),_0x9493a7=new Map(),_0x3f70bd=new Map(),_0x597eb6=new Map();for(const _0x29cf0a of _0x3bd936){_0x103525[_0x34e6c0(0x229)](_0x29cf0a[_0x34e6c0(0x254)][_0x34e6c0(0x263)],_0x29cf0a);}for(const _0x565654 of _0x155b60){_0x2dfcd9[_0x34e6c0(0x229)](_0x565654[_0x34e6c0(0x254)][_0x34e6c0(0x263)],_0x565654);}for(const _0x2650a8 of _0x3a3dce){_0x9493a7[_0x34e6c0(0x229)](_0x2650a8['attributes']['name'],_0x2650a8);}for(const _0x529a1d of _0x343f4f){_0x3f70bd[_0x34e6c0(0x229)](_0x529a1d['attributes'][_0x34e6c0(0x263)],_0x529a1d);}for(const _0x2a4470 of _0x3fdeed){_0x597eb6[_0x34e6c0(0x229)](_0x2a4470[_0x34e6c0(0x254)]['serviceType'][_0x34e6c0(0x1ee)](),_0x2a4470);}const _0x110830=new Map(),_0x48336b=new Map(),_0x5566d6=new Map(),_0x168f94=new Map(),_0x4a93b8=new Map(),_0x1a4b4c=new Map(),_0x7b8049=new Map(),_0x480bf6=new Map(),_0x1cba6c=new Map(),_0x385cbb=new Map(),_0x34e750=new Map(),_0x413c4b=new Map();for(const _0x265508 of _0x155b60){_0x110830[_0x34e6c0(0x229)](_0x265508[_0x34e6c0(0x254)]['name'],_0x265508['id']),_0x7b8049[_0x34e6c0(0x229)](_0x265508['id'],_0x265508[_0x34e6c0(0x254)][_0x34e6c0(0x263)]);}for(const _0x2c5048 of _0x3a3dce){_0x48336b[_0x34e6c0(0x229)](_0x2c5048[_0x34e6c0(0x254)][_0x34e6c0(0x263)],_0x2c5048['id']),_0x480bf6['set'](_0x2c5048['id'],_0x2c5048[_0x34e6c0(0x254)][_0x34e6c0(0x263)]);}for(const _0x41f18e of _0x3bd936){_0x5566d6['set'](_0x41f18e[_0x34e6c0(0x254)]['name'],_0x41f18e['id']),_0x1cba6c['set'](_0x41f18e['id'],_0x41f18e['attributes']['name']);}for(const _0x5aa542 of _0x4e512b){_0x168f94[_0x34e6c0(0x229)](_0x5aa542[_0x34e6c0(0x254)]['name'],_0x5aa542['id']),_0x385cbb[_0x34e6c0(0x229)](_0x5aa542['id'],_0x5aa542[_0x34e6c0(0x254)][_0x34e6c0(0x263)]);}for(const _0x396954 of _0x5de026){_0x4a93b8['set'](_0x396954[_0x34e6c0(0x254)]['name'],_0x396954['id']),_0x34e750['set'](_0x396954['id'],_0x396954[_0x34e6c0(0x254)][_0x34e6c0(0x263)]);}for(const _0x227cb3 of _0x343f4f){_0x1a4b4c['set'](_0x227cb3[_0x34e6c0(0x254)][_0x34e6c0(0x263)],_0x227cb3['id']),_0x413c4b[_0x34e6c0(0x229)](_0x227cb3['id'],_0x227cb3[_0x34e6c0(0x254)][_0x34e6c0(0x263)]);}const _0x3dab72={'resolveKnowledgeBaseName':async _0x3b9b55=>_0x7b8049[_0x34e6c0(0x28f)](_0x3b9b55),'resolveTextKnowledgeBaseName':async _0x9dbd00=>_0x480bf6[_0x34e6c0(0x28f)](_0x9dbd00),'resolveAgentName':async _0x24d0b1=>_0x1cba6c['get'](_0x24d0b1),'resolveWebSearchToolName':async _0x3768d2=>_0x34e750['get'](_0x3768d2),'resolveImageGeneratorName':async _0x359260=>_0x385cbb[_0x34e6c0(0x28f)](_0x359260),'resolvePromptName':async _0x4458a5=>_0x413c4b[_0x34e6c0(0x28f)](_0x4458a5),'onWarning':_0xbad8d7=>this['logger'][_0x34e6c0(0x1da)](_0xbad8d7)};let _0x3b7f94=[];const _0x44a42d={'projectId':_0x3eb2ba,'resolveKnowledgeBaseId':async _0x1db6ae=>_0x110830[_0x34e6c0(0x28f)](_0x1db6ae),'resolveTextKnowledgeBaseId':async _0x23e626=>_0x48336b['get'](_0x23e626),'resolveAgentId':async _0x28b313=>_0x5566d6[_0x34e6c0(0x28f)](_0x28b313),'resolveWebSearchToolId':async _0x3aa1e7=>_0x4a93b8['get'](_0x3aa1e7),'resolveImageGeneratorId':async _0x3d1934=>_0x168f94[_0x34e6c0(0x28f)](_0x3d1934),'resolvePromptId':async _0x4783b4=>_0x1a4b4c[_0x34e6c0(0x28f)](_0x4783b4),'resolveParentSegmentKBId':async()=>_0x539a40?.['id'],'onWarning':_0x3f3a0b=>{const _0x4dd0de=_0x34e6c0;this['logger'][_0x4dd0de(0x1da)](_0x3f3a0b),_0x3b7f94[_0x4dd0de(0x204)](_0x3f3a0b);}},{resolved:_0x1e408e,unresolved:_0x45b966}=resolveAgentDependencies(_0x1a1817,new Set(_0x103525['keys']()));for(const {agent:_0x13be83,missingDeps:_0x2f22e6}of _0x45b966){_0x4ff96c[_0x34e6c0(0x28e)]['push']({'agentName':_0x13be83[_0x34e6c0(0x21f)][_0x34e6c0(0x263)],'action':'error','error':_0x34e6c0(0x290)+_0x2f22e6[_0x34e6c0(0x1fa)](',\x20')+_0x34e6c0(0x252)}),_0x4ff96c[_0x34e6c0(0x231)][_0x34e6c0(0x28e)][_0x34e6c0(0x235)]++;}for(const _0xce531b of _0x50a51b){const _0x422f7d=_0x2dfcd9[_0x34e6c0(0x28f)](_0xce531b[_0x34e6c0(0x21f)][_0x34e6c0(0x263)]),_0x194076=a102_0x5ce75d['readFileSync'](_0xce531b[_0x34e6c0(0x266)],_0x34e6c0(0x27d));if(_0x422f7d){const _0x2e2f9f=apiKnowledgeBaseToYaml(_0x422f7d),_0x334b3a=toKnowledgeBaseYamlString(_0x2e2f9f),_0x5f0e42=generateDiff(_0x334b3a,_0x194076),_0x44ea8f=hasChanges(_0x5f0e42);_0x44ea8f?(_0x4ff96c['knowledgeBases'][_0x34e6c0(0x204)]({'name':_0xce531b['yaml'][_0x34e6c0(0x263)],'action':'updated','id':_0x422f7d['id'],'diff':formatDiffWithColors(_0x5f0e42)}),_0x4ff96c[_0x34e6c0(0x231)][_0x34e6c0(0x2c9)][_0x34e6c0(0x25a)]++):(_0x4ff96c[_0x34e6c0(0x2c9)][_0x34e6c0(0x204)]({'name':_0xce531b[_0x34e6c0(0x21f)][_0x34e6c0(0x263)],'action':'unchanged','id':_0x422f7d['id']}),_0x4ff96c[_0x34e6c0(0x231)][_0x34e6c0(0x2c9)][_0x34e6c0(0x2a2)]++);}else _0x4ff96c['knowledgeBases'][_0x34e6c0(0x204)]({'name':_0xce531b[_0x34e6c0(0x21f)][_0x34e6c0(0x263)],'action':_0x34e6c0(0x265)}),_0x4ff96c[_0x34e6c0(0x231)][_0x34e6c0(0x2c9)][_0x34e6c0(0x265)]++;}for(const _0x50470c of _0x53d843){const _0x58b413=_0x9493a7['get'](_0x50470c['name']),_0x4edb62=a102_0x5ce75d[_0x34e6c0(0x2a4)](_0x50470c[_0x34e6c0(0x266)],_0x34e6c0(0x27d));if(_0x58b413){const _0x52d686=toTextKnowledgeBaseMd(_0x58b413[_0x34e6c0(0x254)][_0x34e6c0(0x263)],_0x58b413['attributes']['text']),_0x54c91d=generateDiff(_0x52d686,_0x4edb62),_0x33e661=hasChanges(_0x54c91d);_0x33e661?(_0x4ff96c[_0x34e6c0(0x206)][_0x34e6c0(0x204)]({'name':_0x50470c['name'],'action':_0x34e6c0(0x25a),'id':_0x58b413['id'],'diff':formatDiffWithColors(_0x54c91d)}),_0x4ff96c[_0x34e6c0(0x231)]['textKnowledgeBases'][_0x34e6c0(0x25a)]++):(_0x4ff96c[_0x34e6c0(0x206)]['push']({'name':_0x50470c['name'],'action':_0x34e6c0(0x2a2),'id':_0x58b413['id']}),_0x4ff96c[_0x34e6c0(0x231)]['textKnowledgeBases'][_0x34e6c0(0x2a2)]++);}else _0x4ff96c[_0x34e6c0(0x206)][_0x34e6c0(0x204)]({'name':_0x50470c[_0x34e6c0(0x263)],'action':_0x34e6c0(0x265)}),_0x4ff96c['counts']['textKnowledgeBases'][_0x34e6c0(0x265)]++;}for(const _0x38a41f of _0x1e408e){const _0x257454=_0x103525[_0x34e6c0(0x28f)](_0x38a41f[_0x34e6c0(0x21f)][_0x34e6c0(0x263)]),_0x5f3aa8=a102_0x25b2e3[_0x34e6c0(0x1fa)](_0x38a41f[_0x34e6c0(0x1f4)],_0x34e6c0(0x2c0)),_0x5a1f87=a102_0x5ce75d['readFileSync'](_0x5f3aa8,_0x34e6c0(0x27d)),_0x2d1fa1=_0x38a41f['systemPrompt'],_0x514574=_0x34e6c0(0x215)+_0x2d1fa1+'\x0a\x0a#\x20agent.yml\x0a'+_0x5a1f87;if(_0x257454){const {yaml:_0x10e50d,systemPrompt:_0x2055b4}=await agentResponseToDef(_0x257454,_0x3dab72),_0x41e810=toAgentYamlString(_0x10e50d),_0x2288d6='#\x20prompt.md\x0a'+_0x2055b4+_0x34e6c0(0x207)+_0x41e810,_0x263a88=generateDiff(_0x2288d6,_0x514574),_0x46871b=hasChanges(_0x263a88);_0x46871b?(_0x4ff96c[_0x34e6c0(0x28e)][_0x34e6c0(0x204)]({'agentName':_0x38a41f['yaml'][_0x34e6c0(0x263)],'action':_0x34e6c0(0x25a),'agentId':_0x257454['id'],'diff':formatDiffWithColors(_0x263a88)}),_0x4ff96c[_0x34e6c0(0x231)][_0x34e6c0(0x28e)]['updated']++):(_0x4ff96c[_0x34e6c0(0x28e)]['push']({'agentName':_0x38a41f[_0x34e6c0(0x21f)]['name'],'action':_0x34e6c0(0x2a2),'agentId':_0x257454['id']}),_0x4ff96c['counts']['agents'][_0x34e6c0(0x2a2)]++);}else _0x4ff96c[_0x34e6c0(0x28e)]['push']({'agentName':_0x38a41f['yaml'][_0x34e6c0(0x263)],'action':_0x34e6c0(0x265)}),_0x4ff96c[_0x34e6c0(0x231)][_0x34e6c0(0x28e)][_0x34e6c0(0x265)]++;}for(const _0xe8f91e of _0x5cd471){const _0x2d0ec3=_0x3f70bd[_0x34e6c0(0x28f)](_0xe8f91e[_0x34e6c0(0x21f)][_0x34e6c0(0x263)]),_0x2da8b2=a102_0x5ce75d['readFileSync'](_0xe8f91e['path'],_0x34e6c0(0x27d));if(_0x2d0ec3){const _0x19821d=await apiPromptToYaml(_0x2d0ec3,_0x3dab72);if(!_0x19821d){_0x4ff96c[_0x34e6c0(0x219)][_0x34e6c0(0x204)]({'name':_0xe8f91e[_0x34e6c0(0x21f)]['name'],'action':'updated','id':_0x2d0ec3['id']}),_0x4ff96c[_0x34e6c0(0x231)][_0x34e6c0(0x219)][_0x34e6c0(0x25a)]++;continue;}const _0x21145b=toPromptYamlString(_0x19821d),_0x4d4a35=generateDiff(_0x21145b,_0x2da8b2),_0x457507=hasChanges(_0x4d4a35);_0x457507?(_0x4ff96c[_0x34e6c0(0x219)][_0x34e6c0(0x204)]({'name':_0xe8f91e['yaml'][_0x34e6c0(0x263)],'action':_0x34e6c0(0x25a),'id':_0x2d0ec3['id'],'diff':formatDiffWithColors(_0x4d4a35)}),_0x4ff96c[_0x34e6c0(0x231)][_0x34e6c0(0x219)]['updated']++):(_0x4ff96c[_0x34e6c0(0x219)]['push']({'name':_0xe8f91e['yaml'][_0x34e6c0(0x263)],'action':_0x34e6c0(0x2a2),'id':_0x2d0ec3['id']}),_0x4ff96c[_0x34e6c0(0x231)][_0x34e6c0(0x219)][_0x34e6c0(0x2a2)]++);}else _0x4ff96c[_0x34e6c0(0x219)][_0x34e6c0(0x204)]({'name':_0xe8f91e['yaml'][_0x34e6c0(0x263)],'action':'created'}),_0x4ff96c[_0x34e6c0(0x231)][_0x34e6c0(0x219)][_0x34e6c0(0x265)]++;}for(const _0x15166a of _0x392da6){const _0x32e4bc=_0x597eb6[_0x34e6c0(0x28f)](_0x15166a[_0x34e6c0(0x21f)]['service_type']),_0x512da3=a102_0x5ce75d[_0x34e6c0(0x2a4)](_0x15166a[_0x34e6c0(0x266)],_0x34e6c0(0x27d));if(_0x32e4bc){const _0x9e550f=await apiIntegrationToYaml(_0x32e4bc,_0x3dab72),_0x3dd367=toIntegrationYamlString(_0x9e550f),_0x3e4228=generateDiff(_0x3dd367,_0x512da3),_0x4a27fc=hasChanges(_0x3e4228);_0x4a27fc?(_0x4ff96c[_0x34e6c0(0x221)][_0x34e6c0(0x204)]({'name':_0x15166a['yaml'][_0x34e6c0(0x2cf)],'action':'updated','id':_0x32e4bc['id'],'diff':formatDiffWithColors(_0x3e4228)}),_0x4ff96c[_0x34e6c0(0x231)]['integrations'][_0x34e6c0(0x25a)]++):(_0x4ff96c[_0x34e6c0(0x221)][_0x34e6c0(0x204)]({'name':_0x15166a[_0x34e6c0(0x21f)][_0x34e6c0(0x2cf)],'action':_0x34e6c0(0x2a2),'id':_0x32e4bc['id']}),_0x4ff96c[_0x34e6c0(0x231)]['integrations'][_0x34e6c0(0x2a2)]++);}else _0x4ff96c[_0x34e6c0(0x221)][_0x34e6c0(0x204)]({'name':_0x15166a['yaml'][_0x34e6c0(0x2cf)],'action':_0x34e6c0(0x265)}),_0x4ff96c[_0x34e6c0(0x231)]['integrations'][_0x34e6c0(0x265)]++;}if(_0x181e08?.['dryRun'])return _0x4ff96c;_0x4ff96c[_0x34e6c0(0x2c9)]=[],_0x4ff96c['textKnowledgeBases']=[],_0x4ff96c[_0x34e6c0(0x219)]=[],_0x4ff96c[_0x34e6c0(0x221)]=[];const _0x40abea=_0x4ff96c[_0x34e6c0(0x28e)][_0x34e6c0(0x208)](_0x3a5b86=>_0x3a5b86['action']===_0x34e6c0(0x242));_0x4ff96c['agents']=_0x40abea,_0x4ff96c[_0x34e6c0(0x231)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x40abea['length']},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x4d1f35 of _0x50a51b){try{const _0x564d0e=_0x2dfcd9['get'](_0x4d1f35[_0x34e6c0(0x21f)][_0x34e6c0(0x263)]),_0x332549=yamlKnowledgeBaseToApi(_0x4d1f35[_0x34e6c0(0x21f)],_0x3eb2ba);if(_0x564d0e)await this[_0x34e6c0(0x26c)][_0x34e6c0(0x1e5)](_0x564d0e['id'],_0x332549),_0x110830['set'](_0x4d1f35[_0x34e6c0(0x21f)][_0x34e6c0(0x263)],_0x564d0e['id']),_0x4ff96c[_0x34e6c0(0x2c9)][_0x34e6c0(0x204)]({'name':_0x4d1f35['yaml'][_0x34e6c0(0x263)],'action':_0x34e6c0(0x25a),'id':_0x564d0e['id']}),_0x4ff96c['counts']['knowledgeBases'][_0x34e6c0(0x25a)]++;else{const _0x247ef6=await this[_0x34e6c0(0x26c)][_0x34e6c0(0x2c2)](_0x332549);_0x110830[_0x34e6c0(0x229)](_0x4d1f35[_0x34e6c0(0x21f)][_0x34e6c0(0x263)],_0x247ef6['id']),_0x4ff96c[_0x34e6c0(0x2c9)][_0x34e6c0(0x204)]({'name':_0x4d1f35[_0x34e6c0(0x21f)][_0x34e6c0(0x263)],'action':'created','id':_0x247ef6['id']}),_0x4ff96c[_0x34e6c0(0x231)][_0x34e6c0(0x2c9)]['created']++;}}catch(_0xbf92b){_0x4ff96c[_0x34e6c0(0x2c9)][_0x34e6c0(0x204)]({'name':_0x4d1f35[_0x34e6c0(0x21f)][_0x34e6c0(0x263)],'action':_0x34e6c0(0x242),'error':_0xbf92b[_0x34e6c0(0x2ad)]}),_0x4ff96c['counts'][_0x34e6c0(0x2c9)][_0x34e6c0(0x235)]++;}}for(const _0x25332c of _0x53d843){try{const _0x5d4876=_0x9493a7[_0x34e6c0(0x28f)](_0x25332c[_0x34e6c0(0x263)]),_0x15b27d=yamlTextKnowledgeBaseToApi({'name':_0x25332c[_0x34e6c0(0x263)],'text':_0x25332c[_0x34e6c0(0x2a3)]},_0x3eb2ba);if(_0x5d4876)await this[_0x34e6c0(0x26c)][_0x34e6c0(0x281)](_0x5d4876['id'],_0x15b27d),_0x48336b[_0x34e6c0(0x229)](_0x25332c[_0x34e6c0(0x263)],_0x5d4876['id']),_0x4ff96c[_0x34e6c0(0x206)][_0x34e6c0(0x204)]({'name':_0x25332c[_0x34e6c0(0x263)],'action':_0x34e6c0(0x25a),'id':_0x5d4876['id']}),_0x4ff96c['counts'][_0x34e6c0(0x206)][_0x34e6c0(0x25a)]++;else{const _0x48ca21=await this[_0x34e6c0(0x26c)][_0x34e6c0(0x1e7)](_0x15b27d);_0x48336b[_0x34e6c0(0x229)](_0x25332c[_0x34e6c0(0x263)],_0x48ca21['id']),_0x4ff96c[_0x34e6c0(0x206)]['push']({'name':_0x25332c['name'],'action':'created','id':_0x48ca21['id']}),_0x4ff96c['counts'][_0x34e6c0(0x206)][_0x34e6c0(0x265)]++;}}catch(_0x4fd370){_0x4ff96c[_0x34e6c0(0x206)][_0x34e6c0(0x204)]({'name':_0x25332c['name'],'action':_0x34e6c0(0x242),'error':_0x4fd370[_0x34e6c0(0x2ad)]}),_0x4ff96c[_0x34e6c0(0x231)]['textKnowledgeBases'][_0x34e6c0(0x235)]++;}}for(const _0x2eda30 of _0x1e408e){_0x3b7f94=[];try{const _0x33f21b=_0x103525[_0x34e6c0(0x28f)](_0x2eda30[_0x34e6c0(0x21f)][_0x34e6c0(0x263)]),_0x4ea02c=await agentDefToRequest(_0x2eda30[_0x34e6c0(0x21f)],_0x2eda30['systemPrompt'],_0x2eda30['starterMessage'],_0x44a42d);if(_0x33f21b)await this['client'][_0x34e6c0(0x1f7)](_0x33f21b['id'],_0x4ea02c),_0x5566d6['set'](_0x2eda30['yaml'][_0x34e6c0(0x263)],_0x33f21b['id']),_0x4ff96c['agents'][_0x34e6c0(0x204)]({'agentName':_0x2eda30[_0x34e6c0(0x21f)][_0x34e6c0(0x263)],'action':_0x34e6c0(0x25a),'agentId':_0x33f21b['id'],'warnings':_0x3b7f94['length']>0x0?_0x3b7f94:undefined}),_0x4ff96c[_0x34e6c0(0x231)][_0x34e6c0(0x28e)]['updated']++;else{const _0xacc2ff=await this['client']['createAgentResponse'](_0x4ea02c);_0x5566d6[_0x34e6c0(0x229)](_0x2eda30[_0x34e6c0(0x21f)][_0x34e6c0(0x263)],_0xacc2ff['id']),_0x4ff96c[_0x34e6c0(0x28e)][_0x34e6c0(0x204)]({'agentName':_0x2eda30['yaml'][_0x34e6c0(0x263)],'action':_0x34e6c0(0x265),'agentId':_0xacc2ff['id'],'warnings':_0x3b7f94[_0x34e6c0(0x1e3)]>0x0?_0x3b7f94:undefined}),_0x4ff96c[_0x34e6c0(0x231)]['agents']['created']++;}}catch(_0x37137d){_0x4ff96c[_0x34e6c0(0x28e)][_0x34e6c0(0x204)]({'agentName':_0x2eda30[_0x34e6c0(0x21f)][_0x34e6c0(0x263)],'action':_0x34e6c0(0x242),'error':_0x37137d[_0x34e6c0(0x2ad)],'warnings':_0x3b7f94['length']>0x0?_0x3b7f94:undefined}),_0x4ff96c[_0x34e6c0(0x231)]['agents'][_0x34e6c0(0x235)]++;}}for(const _0x147703 of _0x5cd471){try{const _0x52e068=_0x3f70bd[_0x34e6c0(0x28f)](_0x147703[_0x34e6c0(0x21f)][_0x34e6c0(0x263)]),_0x30586e=await yamlPromptToApi(_0x147703[_0x34e6c0(0x21f)],_0x3eb2ba,_0x44a42d);if(!_0x30586e){_0x4ff96c[_0x34e6c0(0x219)][_0x34e6c0(0x204)]({'name':_0x147703[_0x34e6c0(0x21f)][_0x34e6c0(0x263)],'action':_0x34e6c0(0x242),'error':_0x34e6c0(0x28a)}),_0x4ff96c['counts'][_0x34e6c0(0x219)][_0x34e6c0(0x235)]++;continue;}if(_0x52e068)await this['client']['updatePrompt'](_0x52e068['id'],_0x30586e),_0x1a4b4c[_0x34e6c0(0x229)](_0x147703['yaml'][_0x34e6c0(0x263)],_0x52e068['id']),_0x4ff96c[_0x34e6c0(0x219)][_0x34e6c0(0x204)]({'name':_0x147703[_0x34e6c0(0x21f)][_0x34e6c0(0x263)],'action':_0x34e6c0(0x25a),'id':_0x52e068['id']}),_0x4ff96c[_0x34e6c0(0x231)][_0x34e6c0(0x219)][_0x34e6c0(0x25a)]++;else{const _0x17bf17=await this[_0x34e6c0(0x26c)][_0x34e6c0(0x244)](_0x30586e);_0x1a4b4c[_0x34e6c0(0x229)](_0x147703[_0x34e6c0(0x21f)][_0x34e6c0(0x263)],_0x17bf17['id']),_0x4ff96c[_0x34e6c0(0x219)][_0x34e6c0(0x204)]({'name':_0x147703[_0x34e6c0(0x21f)][_0x34e6c0(0x263)],'action':_0x34e6c0(0x265),'id':_0x17bf17['id']}),_0x4ff96c['counts'][_0x34e6c0(0x219)]['created']++;}}catch(_0x6c3b96){_0x4ff96c[_0x34e6c0(0x219)][_0x34e6c0(0x204)]({'name':_0x147703[_0x34e6c0(0x21f)][_0x34e6c0(0x263)],'action':'error','error':_0x6c3b96['message']}),_0x4ff96c[_0x34e6c0(0x231)]['prompts'][_0x34e6c0(0x235)]++;}}for(const _0x2d05be of _0x392da6){try{const _0x5dfecd=_0x597eb6[_0x34e6c0(0x28f)](_0x2d05be[_0x34e6c0(0x21f)][_0x34e6c0(0x2cf)]),_0xa442ca=await yamlIntegrationToApi(_0x2d05be[_0x34e6c0(0x21f)],_0x3eb2ba,_0x44a42d);if(_0x5dfecd){await this[_0x34e6c0(0x26c)]['deleteIntegration'](_0x5dfecd['id']);const _0x430f9f=await this['client'][_0x34e6c0(0x2b5)](_0xa442ca);_0x4ff96c[_0x34e6c0(0x221)][_0x34e6c0(0x204)]({'name':_0x2d05be[_0x34e6c0(0x21f)][_0x34e6c0(0x2cf)],'action':_0x34e6c0(0x25a),'id':_0x430f9f['id']}),_0x4ff96c[_0x34e6c0(0x231)]['integrations'][_0x34e6c0(0x25a)]++;}else{const _0x9e31e5=await this[_0x34e6c0(0x26c)]['createIntegration'](_0xa442ca);_0x4ff96c['integrations']['push']({'name':_0x2d05be[_0x34e6c0(0x21f)]['service_type'],'action':_0x34e6c0(0x265),'id':_0x9e31e5['id']}),_0x4ff96c['counts'][_0x34e6c0(0x221)][_0x34e6c0(0x265)]++;}}catch(_0xf375e9){_0x4ff96c[_0x34e6c0(0x221)][_0x34e6c0(0x204)]({'name':_0x2d05be[_0x34e6c0(0x21f)]['service_type'],'action':_0x34e6c0(0x242),'error':_0xf375e9[_0x34e6c0(0x2ad)]}),_0x4ff96c['counts'][_0x34e6c0(0x221)]['errors']++;}}return _0x4ff96c;}async[a102_0x1152af(0x205)](_0x483e19,_0x320faf,_0x46dbe6,_0x2c8ac5){const _0x3d4433=a102_0x1152af,{projectId:_0x278468,project:_0x59cf48}=await this[_0x3d4433(0x250)](_0x483e19),_0x179034=_0x59cf48['attributes']['name'],_0x29c570=await this[_0x3d4433(0x26c)][_0x3d4433(0x2af)](_0x278468),_0x12cb59=_0x29c570['find'](_0x4bdf20=>_0x4bdf20[_0x3d4433(0x254)][_0x3d4433(0x263)]===_0x320faf);if(!_0x12cb59)throw new SDKError(ErrorCode['AGENT_NOT_FOUND'],_0x3d4433(0x276)+_0x320faf,undefined,{'helpText':'Available\x20agents:\x20'+_0x29c570[_0x3d4433(0x23c)](_0x1ad8db=>_0x1ad8db[_0x3d4433(0x254)][_0x3d4433(0x263)])['join'](',\x20')});let _0x315930;if(_0x46dbe6)_0x315930=_0x46dbe6;else{const _0x3b4c99=a102_0x25b2e3['join'](process[_0x3d4433(0x203)](),_0x3d4433(0x28e)),_0x57ef11=getSanitizedPathWithMigration(_0x3b4c99,_0x179034);_0x57ef11[_0x3d4433(0x1df)]&&this['logger'][_0x3d4433(0x2a0)](_0x3d4433(0x1fb)+a102_0x25b2e3[_0x3d4433(0x23d)](_0x57ef11[_0x3d4433(0x274)])+_0x3d4433(0x262)+a102_0x25b2e3[_0x3d4433(0x23d)](_0x57ef11[_0x3d4433(0x266)])),_0x315930=_0x57ef11[_0x3d4433(0x266)];}const _0x5746f8=getSanitizedPathWithMigration(_0x315930,_0x320faf);_0x5746f8[_0x3d4433(0x1df)]&&this[_0x3d4433(0x1ed)][_0x3d4433(0x2a0)](_0x3d4433(0x1f2)+a102_0x25b2e3[_0x3d4433(0x23d)](_0x5746f8[_0x3d4433(0x274)])+_0x3d4433(0x262)+a102_0x25b2e3[_0x3d4433(0x23d)](_0x5746f8[_0x3d4433(0x266)]));const _0x36daf1=_0x5746f8[_0x3d4433(0x266)],_0x2ab370=new Map(),_0x43151e=new Map(),_0x390cb1=await this[_0x3d4433(0x26c)][_0x3d4433(0x282)](_0x278468),_0x178d4d=await this[_0x3d4433(0x26c)][_0x3d4433(0x2cc)](_0x278468),_0x458ae1=new Map();for(const _0x2cc171 of _0x390cb1){_0x2ab370[_0x3d4433(0x229)](_0x2cc171['id'],_0x2cc171['attributes'][_0x3d4433(0x263)]);}for(const _0x2f006a of _0x178d4d){_0x458ae1['set'](_0x2f006a['id'],_0x2f006a['attributes'][_0x3d4433(0x263)]);}for(const _0x54a0c1 of _0x29c570){_0x43151e[_0x3d4433(0x229)](_0x54a0c1['id'],_0x54a0c1['attributes'][_0x3d4433(0x263)]);}const _0x13f836={'resolveKnowledgeBaseName':async _0x4d26b4=>_0x2ab370['get'](_0x4d26b4),'resolveTextKnowledgeBaseName':async _0x4af228=>_0x458ae1[_0x3d4433(0x28f)](_0x4af228),'resolveAgentName':async _0x558ede=>_0x43151e[_0x3d4433(0x28f)](_0x558ede),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async()=>undefined,'onWarning':_0x672980=>this[_0x3d4433(0x1ed)][_0x3d4433(0x1da)](_0x672980)},_0x45474c=a102_0x25b2e3[_0x3d4433(0x1fa)](_0x36daf1,_0x3d4433(0x21b)),_0x128176=a102_0x25b2e3[_0x3d4433(0x1fa)](_0x36daf1,_0x3d4433(0x2c0)),_0x3587e6=a102_0x25b2e3['join'](_0x36daf1,'starter_message.md'),_0x14a9d2=!a102_0x5ce75d[_0x3d4433(0x294)](_0x128176);if(_0x2c8ac5?.['dryRun'])return{'agentName':_0x320faf,'outputPath':_0x36daf1,'isNew':_0x14a9d2,'hasChanges':!![]};a102_0x5ce75d[_0x3d4433(0x247)](_0x315930,{'recursive':!![]}),a102_0x5ce75d['mkdirSync'](_0x36daf1,{'recursive':!![]});const _0x5b5f9e=a102_0x25b2e3[_0x3d4433(0x1fa)](_0x315930,_0x3d4433(0x1db));!a102_0x5ce75d['existsSync'](_0x5b5f9e)&&a102_0x5ce75d[_0x3d4433(0x22b)](_0x5b5f9e,createAgentConfigContent(_0x483e19));const {yaml:_0x2f56c4,systemPrompt:_0x2a84cb,starterMessage:_0x33f2eb}=await agentResponseToDef(_0x12cb59,_0x13f836);let _0x557c9e=_0x14a9d2;if(!_0x14a9d2){const _0x37dc3f=a102_0x5ce75d['existsSync'](_0x45474c)?a102_0x5ce75d[_0x3d4433(0x2a4)](_0x45474c,_0x3d4433(0x27d)):'',_0x3b1f10=a102_0x5ce75d[_0x3d4433(0x2a4)](_0x128176,_0x3d4433(0x27d));_0x557c9e=_0x37dc3f!==_0x2a84cb||_0x3b1f10!==toAgentYamlString(_0x2f56c4);}a102_0x5ce75d['writeFileSync'](_0x45474c,_0x2a84cb),a102_0x5ce75d[_0x3d4433(0x22b)](_0x128176,toAgentYamlString(_0x2f56c4));if(_0x33f2eb&&_0x33f2eb[_0x3d4433(0x1eb)]('\x0a'))a102_0x5ce75d[_0x3d4433(0x22b)](_0x3587e6,_0x33f2eb);else a102_0x5ce75d['existsSync'](_0x3587e6)&&a102_0x5ce75d['unlinkSync'](_0x3587e6);return{'agentName':_0x320faf,'outputPath':_0x36daf1,'isNew':_0x14a9d2,'hasChanges':_0x557c9e};}async[a102_0x1152af(0x2be)](_0x31bd95,_0x16cb5c){const _0xaa955c=a102_0x1152af;let _0x75c032;isAgentYamlPath(_0x31bd95)?_0x75c032=getAgentDirFromYamlPath(_0x31bd95):_0x75c032=_0x31bd95;const {config:_0x12888e}=findAgentConfig(_0x75c032),_0x47c918=await this[_0xaa955c(0x22f)](_0x12888e[_0xaa955c(0x2b2)]),_0x13b6af=a102_0x25b2e3[_0xaa955c(0x1fa)](_0x75c032,_0xaa955c(0x2c0)),_0x61d126=a102_0x25b2e3[_0xaa955c(0x1fa)](_0x75c032,_0xaa955c(0x21b)),_0x29966a=a102_0x25b2e3[_0xaa955c(0x1fa)](_0x75c032,'starter_message.md');if(!a102_0x5ce75d[_0xaa955c(0x294)](_0x13b6af))throw new SDKError(ErrorCode[_0xaa955c(0x259)],_0xaa955c(0x275)+_0x75c032,undefined,{'helpText':_0xaa955c(0x202)});const _0xac79c7=parseAgentYaml(a102_0x5ce75d['readFileSync'](_0x13b6af,_0xaa955c(0x27d)),_0x13b6af),_0x3fa80e=a102_0x5ce75d[_0xaa955c(0x294)](_0x61d126)?a102_0x5ce75d[_0xaa955c(0x2a4)](_0x61d126,_0xaa955c(0x27d)):'',_0x3924bd=a102_0x5ce75d['existsSync'](_0x29966a)?a102_0x5ce75d[_0xaa955c(0x2a4)](_0x29966a,_0xaa955c(0x27d)):_0xac79c7[_0xaa955c(0x22d)];if(_0x16cb5c?.[_0xaa955c(0x228)])return{'agentName':_0xac79c7[_0xaa955c(0x263)],'action':_0xaa955c(0x265),'projectId':_0x47c918};const _0x27f0be=await this[_0xaa955c(0x26c)]['listAgentsFull'](_0x47c918),_0xd43920=await this[_0xaa955c(0x26c)][_0xaa955c(0x282)](_0x47c918),_0x764bd2=await this[_0xaa955c(0x26c)][_0xaa955c(0x2cc)](_0x47c918),_0x553279=await this[_0xaa955c(0x26c)][_0xaa955c(0x26a)](_0x47c918),_0x408543=new Map(),_0x2f5909=new Map(),_0x47311d=new Map();for(const _0x3bbb91 of _0xd43920){_0x408543[_0xaa955c(0x229)](_0x3bbb91['attributes'][_0xaa955c(0x263)],_0x3bbb91['id']);}for(const _0x3b27df of _0x764bd2){_0x2f5909[_0xaa955c(0x229)](_0x3b27df[_0xaa955c(0x254)][_0xaa955c(0x263)],_0x3b27df['id']);}for(const _0x28360a of _0x27f0be){_0x47311d[_0xaa955c(0x229)](_0x28360a[_0xaa955c(0x254)][_0xaa955c(0x263)],_0x28360a['id']);}const _0x42f6e2=[],_0x4d7eaa={'projectId':_0x47c918,'resolveKnowledgeBaseId':async _0x34b139=>_0x408543['get'](_0x34b139),'resolveTextKnowledgeBaseId':async _0x97bb1b=>_0x2f5909[_0xaa955c(0x28f)](_0x97bb1b),'resolveAgentId':async _0x1fe8ac=>_0x47311d['get'](_0x1fe8ac),'resolveWebSearchToolId':async()=>undefined,'resolveImageGeneratorId':async()=>undefined,'resolvePromptId':async()=>undefined,'resolveParentSegmentKBId':async()=>_0x553279?.['id'],'onWarning':_0xba636d=>{const _0x5ea44f=_0xaa955c;this[_0x5ea44f(0x1ed)]['warn'](_0xba636d),_0x42f6e2[_0x5ea44f(0x204)](_0xba636d);}};try{const _0x4cfd67=_0x27f0be[_0xaa955c(0x1f8)](_0x1c8c2c=>_0x1c8c2c['attributes'][_0xaa955c(0x263)]===_0xac79c7[_0xaa955c(0x263)]),_0x44d83c=await agentDefToRequest(_0xac79c7,_0x3fa80e,_0x3924bd,_0x4d7eaa);if(_0x4cfd67)return await this[_0xaa955c(0x26c)][_0xaa955c(0x1f7)](_0x4cfd67['id'],_0x44d83c),{'agentName':_0xac79c7[_0xaa955c(0x263)],'action':_0xaa955c(0x25a),'projectId':_0x47c918,'agentId':_0x4cfd67['id'],'warnings':_0x42f6e2['length']>0x0?_0x42f6e2:undefined};else{const _0x33d33b=await this[_0xaa955c(0x26c)][_0xaa955c(0x209)](_0x44d83c);return{'agentName':_0xac79c7['name'],'action':_0xaa955c(0x265),'projectId':_0x47c918,'agentId':_0x33d33b['id'],'warnings':_0x42f6e2['length']>0x0?_0x42f6e2:undefined};}}catch(_0xd3c374){return{'agentName':_0xac79c7['name'],'action':'error','projectId':_0x47c918,'error':_0xd3c374[_0xaa955c(0x2ad)],'warnings':_0x42f6e2[_0xaa955c(0x1e3)]>0x0?_0x42f6e2:undefined};}}async['cloneProject'](_0x2d5ce5,_0xde96a2,_0x4624a0){const _0x499b46=a102_0x1152af,_0x9c1109=a102_0x5ce75d[_0x499b46(0x294)](_0x2d5ce5)&&a102_0x5ce75d[_0x499b46(0x294)](a102_0x25b2e3[_0x499b46(0x1fa)](_0x2d5ce5,_0x499b46(0x1db)));let _0xfa5096;const _0x4069c5=[],_0x4d6584=[],_0x1881ee=[],_0x2f34be=[],_0x444846=[];if(_0x9c1109){const _0x400840=loadAgentConfig(a102_0x25b2e3[_0x499b46(0x1fa)](_0x2d5ce5,_0x499b46(0x1db)));_0xfa5096=_0x400840['llm_project'];const _0x487d71=a102_0x5ce75d[_0x499b46(0x27b)](_0x2d5ce5,{'withFileTypes':!![]});for(const _0x33daf5 of _0x487d71){if(!_0x33daf5[_0x499b46(0x24f)]())continue;if([_0x499b46(0x23a),_0x499b46(0x219),_0x499b46(0x221)][_0x499b46(0x1eb)](_0x33daf5[_0x499b46(0x263)]))continue;const _0xefd9a3=a102_0x25b2e3[_0x499b46(0x1fa)](_0x2d5ce5,_0x33daf5[_0x499b46(0x263)]);if(isAgentDir(_0xefd9a3)){const _0x51c104=a102_0x25b2e3['join'](_0xefd9a3,_0x499b46(0x2c0)),_0xe0ce5e=a102_0x25b2e3[_0x499b46(0x1fa)](_0xefd9a3,'prompt.md'),_0x9345f4=a102_0x25b2e3[_0x499b46(0x1fa)](_0xefd9a3,_0x499b46(0x25c)),_0x176e00=parseAgentYaml(a102_0x5ce75d[_0x499b46(0x2a4)](_0x51c104,'utf-8'),_0x51c104),_0x3857e7=a102_0x5ce75d[_0x499b46(0x294)](_0xe0ce5e)?a102_0x5ce75d[_0x499b46(0x2a4)](_0xe0ce5e,'utf-8'):'',_0x1ca0eb=a102_0x5ce75d[_0x499b46(0x294)](_0x9345f4)?a102_0x5ce75d['readFileSync'](_0x9345f4,_0x499b46(0x27d)):_0x176e00[_0x499b46(0x22d)];_0x4069c5[_0x499b46(0x204)]({'name':_0x176e00[_0x499b46(0x263)],'dir':_0xefd9a3,'yaml':_0x176e00,'systemPrompt':_0x3857e7,'starterMessage':_0x1ca0eb});}}const _0x29cde8=getKnowledgeBasesDir(_0x2d5ce5);if(a102_0x5ce75d[_0x499b46(0x294)](_0x29cde8)){const _0x1043cd=a102_0x5ce75d[_0x499b46(0x27b)](_0x29cde8);for(const _0x2e7f7a of _0x1043cd){const _0x520aec=a102_0x25b2e3[_0x499b46(0x1fa)](_0x29cde8,_0x2e7f7a);if(_0x2e7f7a[_0x499b46(0x238)]('.yml')){const _0x31fdf5=parseKnowledgeBaseYaml(a102_0x5ce75d['readFileSync'](_0x520aec,_0x499b46(0x27d)),_0x520aec);_0x4d6584[_0x499b46(0x204)]({'name':_0x31fdf5['name'],'path':_0x520aec,'yaml':_0x31fdf5});}else{if(_0x2e7f7a[_0x499b46(0x238)]('.md')){const _0x475847=a102_0x5ce75d['readFileSync'](_0x520aec,_0x499b46(0x27d)),{name:_0x291a2d,text:_0x1fbe37}=parseTextKnowledgeBaseMd(_0x475847,_0x2e7f7a);_0x1881ee[_0x499b46(0x204)]({'name':_0x291a2d,'path':_0x520aec,'text':_0x1fbe37});}}}}const _0x510741=getPromptsDir(_0x2d5ce5);if(a102_0x5ce75d[_0x499b46(0x294)](_0x510741)){const _0x1d2b7c=a102_0x5ce75d[_0x499b46(0x27b)](_0x510741)['filter'](_0x98adbe=>_0x98adbe[_0x499b46(0x238)](_0x499b46(0x26d)));for(const _0x4f496b of _0x1d2b7c){const _0x1cce3c=a102_0x25b2e3['join'](_0x510741,_0x4f496b),_0x3b5228=parsePromptYaml(a102_0x5ce75d[_0x499b46(0x2a4)](_0x1cce3c,'utf-8'),_0x1cce3c);_0x2f34be[_0x499b46(0x204)]({'name':_0x3b5228[_0x499b46(0x263)],'path':_0x1cce3c,'yaml':_0x3b5228});}}const _0x5c2912=getIntegrationsDir(_0x2d5ce5);if(a102_0x5ce75d['existsSync'](_0x5c2912)){const _0x3221eb=a102_0x5ce75d[_0x499b46(0x27b)](_0x5c2912)[_0x499b46(0x208)](_0x22d3b7=>_0x22d3b7[_0x499b46(0x238)](_0x499b46(0x26d)));for(const _0x1bf0f7 of _0x3221eb){const _0x15fc04=a102_0x25b2e3[_0x499b46(0x1fa)](_0x5c2912,_0x1bf0f7),_0x5d6647=parseIntegrationYaml(a102_0x5ce75d['readFileSync'](_0x15fc04,_0x499b46(0x27d)),_0x15fc04);SAFE_INTEGRATION_TYPES[_0x499b46(0x1eb)](_0x5d6647['service_type'][_0x499b46(0x1ee)]())?_0x444846[_0x499b46(0x204)]({'name':_0x5d6647[_0x499b46(0x263)],'path':_0x15fc04,'yaml':_0x5d6647}):this[_0x499b46(0x1ed)]['warn'](_0x499b46(0x20a)+_0x5d6647['name']+_0x499b46(0x23e)+_0x5d6647['service_type']+_0x499b46(0x288)+('Only\x20safe\x20types\x20('+SAFE_INTEGRATION_TYPES['join'](',\x20')+')\x20can\x20be\x20cloned.'));}}}else{const _0x956cd8=await this[_0x499b46(0x22f)](_0x2d5ce5),_0x3eb566=await this[_0x499b46(0x26c)][_0x499b46(0x292)](_0x956cd8);_0xfa5096=_0x3eb566[_0x499b46(0x254)][_0x499b46(0x263)];const _0x3aec24=await this[_0x499b46(0x26c)][_0x499b46(0x2af)](_0x956cd8),_0x10ff2a=await this[_0x499b46(0x26c)][_0x499b46(0x282)](_0x956cd8),_0x5e4b9e=await this['client'][_0x499b46(0x2cc)](_0x956cd8),_0x3ae268=await this[_0x499b46(0x26c)][_0x499b46(0x2ab)](_0x956cd8),_0x38cf09=await this[_0x499b46(0x26c)][_0x499b46(0x2d0)](_0x956cd8),_0x32e09b=new Map(),_0x1b2b46=new Map(),_0x5b17c4=new Map(),_0x115a1a=new Map();for(const _0x3343e0 of _0x10ff2a){_0x32e09b[_0x499b46(0x229)](_0x3343e0['id'],_0x3343e0[_0x499b46(0x254)][_0x499b46(0x263)]);}for(const _0x53c75c of _0x5e4b9e){_0x1b2b46[_0x499b46(0x229)](_0x53c75c['id'],_0x53c75c[_0x499b46(0x254)][_0x499b46(0x263)]);}for(const _0x3c4be3 of _0x3aec24){_0x5b17c4[_0x499b46(0x229)](_0x3c4be3['id'],_0x3c4be3[_0x499b46(0x254)]['name']);}for(const _0x19aef4 of _0x3ae268){_0x115a1a[_0x499b46(0x229)](_0x19aef4['id'],_0x19aef4[_0x499b46(0x254)][_0x499b46(0x263)]);}const _0x3f7bda={'resolveKnowledgeBaseName':async _0x2b6d78=>_0x32e09b['get'](_0x2b6d78),'resolveTextKnowledgeBaseName':async _0x8e5ef3=>_0x1b2b46[_0x499b46(0x28f)](_0x8e5ef3),'resolveAgentName':async _0x4a8e08=>_0x5b17c4[_0x499b46(0x28f)](_0x4a8e08),'resolveWebSearchToolName':async()=>undefined,'resolveImageGeneratorName':async()=>undefined,'resolvePromptName':async _0x4d490e=>_0x115a1a[_0x499b46(0x28f)](_0x4d490e),'onWarning':_0x57dbcf=>this['logger'][_0x499b46(0x1da)](_0x57dbcf)};for(const _0x24acda of _0x3aec24){const _0x2b1ee1=await agentResponseToDef(_0x24acda,_0x3f7bda),{yaml:_0x473e03,systemPrompt:_0x28eae1,starterMessage:_0x1bce7e}=_0x2b1ee1;_0x4069c5[_0x499b46(0x204)]({'name':_0x473e03[_0x499b46(0x263)],'dir':'','yaml':_0x473e03,'systemPrompt':_0x28eae1,'starterMessage':_0x1bce7e});}for(const _0x51620c of _0x10ff2a){const _0x501242=apiKnowledgeBaseToYaml(_0x51620c);_0x4d6584[_0x499b46(0x204)]({'name':_0x501242['name'],'path':'','yaml':_0x501242});}for(const _0x56556b of _0x5e4b9e){_0x1881ee[_0x499b46(0x204)]({'name':_0x56556b[_0x499b46(0x254)][_0x499b46(0x263)],'path':'','text':_0x56556b[_0x499b46(0x254)]['text']});}for(const _0x1fae15 of _0x3ae268){const _0x1ea8eb=await apiPromptToYaml(_0x1fae15,_0x3f7bda);_0x1ea8eb&&_0x2f34be[_0x499b46(0x204)]({'name':_0x1ea8eb[_0x499b46(0x263)],'path':'','yaml':_0x1ea8eb});}for(const _0x2c216b of _0x38cf09){if(!_0x2c216b[_0x499b46(0x254)][_0x499b46(0x286)]&&SAFE_INTEGRATION_TYPES[_0x499b46(0x1eb)](_0x2c216b[_0x499b46(0x254)][_0x499b46(0x1ea)][_0x499b46(0x1ee)]())){const _0x34b7ec=await apiIntegrationToYaml(_0x2c216b,_0x3f7bda);_0x444846[_0x499b46(0x204)]({'name':_0x2c216b[_0x499b46(0x254)][_0x499b46(0x1ea)][_0x499b46(0x1ee)](),'path':'','yaml':_0x34b7ec});}}}const _0x1c9f58={'sourceProjectName':_0xfa5096,'newProjectName':_0xde96a2,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'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}}},_0xb0c739=await this[_0x499b46(0x26c)][_0x499b46(0x1f0)](),_0x2f4012=_0xb0c739['find'](_0x38b2de=>_0x38b2de[_0x499b46(0x254)][_0x499b46(0x263)]===_0xde96a2);if(_0x2f4012)throw new SDKError(ErrorCode[_0x499b46(0x2bb)],'Project\x20\x22'+_0xde96a2+'\x22\x20already\x20exists',undefined,{'helpText':_0x499b46(0x234)});if(_0x4624a0?.[_0x499b46(0x228)])return _0x1c9f58[_0x499b46(0x231)][_0x499b46(0x28e)][_0x499b46(0x265)]=_0x4069c5['length'],_0x1c9f58[_0x499b46(0x231)][_0x499b46(0x2c9)]['created']=_0x4d6584[_0x499b46(0x1e3)],_0x1c9f58[_0x499b46(0x231)]['textKnowledgeBases'][_0x499b46(0x265)]=_0x1881ee[_0x499b46(0x1e3)],_0x1c9f58[_0x499b46(0x231)][_0x499b46(0x219)][_0x499b46(0x265)]=_0x2f34be[_0x499b46(0x1e3)],_0x1c9f58['counts'][_0x499b46(0x221)]['created']=_0x444846[_0x499b46(0x1e3)],_0x1c9f58;const _0x58d698=await this['client'][_0x499b46(0x1e8)]({'name':_0xde96a2}),_0x77010=_0x58d698['id'];_0x1c9f58[_0x499b46(0x2a9)]=_0x77010;const _0x16f494=new Map(),_0x158895=new Map(),_0x1a1b2a=new Map(),_0x23c135=new Map(),_0x4f608a=new Map(),_0x2287c7=new Map(),_0x440a8d=new Set(),_0x216524=new Set();for(const _0x44a1bf of _0x4069c5){for(const _0x311e23 of _0x44a1bf['yaml'][_0x499b46(0x212)]||[]){if(_0x311e23[_0x499b46(0x2a7)]==='image_gen'&&_0x311e23[_0x499b46(0x29b)]){const _0x2c8102=parseRef(_0x311e23[_0x499b46(0x29b)]);if(_0x2c8102)_0x440a8d[_0x499b46(0x21a)](_0x2c8102[_0x499b46(0x263)]);}else{if(_0x311e23['type']==='web_search'&&_0x311e23[_0x499b46(0x29b)]){const _0x3e6835=parseRef(_0x311e23[_0x499b46(0x29b)]);if(_0x3e6835)_0x216524[_0x499b46(0x21a)](_0x3e6835[_0x499b46(0x263)]);}}}}for(const _0xa71340 of _0x440a8d){try{const _0x2ef11f=await this[_0x499b46(0x26c)][_0x499b46(0x1f5)]({'projectId':_0x77010,'name':_0xa71340});_0x4f608a['set'](_0xa71340,_0x2ef11f['id']),_0x1c9f58[_0x499b46(0x2a5)][_0x499b46(0x204)]({'name':_0xa71340,'action':_0x499b46(0x265),'id':_0x2ef11f['id']}),_0x1c9f58[_0x499b46(0x231)][_0x499b46(0x2a5)][_0x499b46(0x265)]++;}catch(_0x22a781){_0x1c9f58[_0x499b46(0x2a5)][_0x499b46(0x204)]({'name':_0xa71340,'action':_0x499b46(0x242),'error':_0x22a781[_0x499b46(0x2ad)]}),_0x1c9f58[_0x499b46(0x231)][_0x499b46(0x2a5)][_0x499b46(0x235)]++;}}for(const _0x447b49 of _0x216524){try{const _0x2f87f2=await this[_0x499b46(0x26c)]['createWebSearchTool']({'projectId':_0x77010,'name':_0x447b49});_0x2287c7[_0x499b46(0x229)](_0x447b49,_0x2f87f2['id']),_0x1c9f58[_0x499b46(0x27a)][_0x499b46(0x204)]({'name':_0x447b49,'action':'created','id':_0x2f87f2['id']}),_0x1c9f58[_0x499b46(0x231)][_0x499b46(0x27a)][_0x499b46(0x265)]++;}catch(_0xb26f75){_0x1c9f58['webSearchTools'][_0x499b46(0x204)]({'name':_0x447b49,'action':_0x499b46(0x242),'error':_0xb26f75[_0x499b46(0x2ad)]}),_0x1c9f58['counts'][_0x499b46(0x27a)][_0x499b46(0x235)]++;}}const _0x57a70b=await this[_0x499b46(0x26c)]['getParentSegmentKnowledgeBase'](_0x77010);let _0x4abb05=[];const _0x5a8e31={'projectId':_0x77010,'resolveKnowledgeBaseId':async _0x44ff2a=>_0x16f494[_0x499b46(0x28f)](_0x44ff2a),'resolveTextKnowledgeBaseId':async _0x33e3ea=>_0x158895[_0x499b46(0x28f)](_0x33e3ea),'resolveAgentId':async _0x158e9b=>_0x1a1b2a['get'](_0x158e9b),'resolveWebSearchToolId':async _0x5a4168=>_0x2287c7[_0x499b46(0x28f)](_0x5a4168),'resolveImageGeneratorId':async _0x37d883=>_0x4f608a[_0x499b46(0x28f)](_0x37d883),'resolvePromptId':async _0x2fd926=>_0x23c135[_0x499b46(0x28f)](_0x2fd926),'resolveParentSegmentKBId':async()=>_0x57a70b?.['id'],'onWarning':_0x4fa87a=>{const _0x46bbe7=_0x499b46;this[_0x46bbe7(0x1ed)][_0x46bbe7(0x1da)](_0x4fa87a),_0x4abb05[_0x46bbe7(0x204)](_0x4fa87a);}};for(const _0x4f2225 of _0x4d6584){try{const _0x516f51=yamlKnowledgeBaseToApi(_0x4f2225[_0x499b46(0x21f)],_0x77010),_0x15c0bf=await this[_0x499b46(0x26c)][_0x499b46(0x2c2)](_0x516f51);_0x16f494[_0x499b46(0x229)](_0x4f2225[_0x499b46(0x21f)]['name'],_0x15c0bf['id']),_0x1c9f58['knowledgeBases'][_0x499b46(0x204)]({'name':_0x4f2225[_0x499b46(0x21f)]['name'],'action':_0x499b46(0x265),'id':_0x15c0bf['id']}),_0x1c9f58[_0x499b46(0x231)][_0x499b46(0x2c9)][_0x499b46(0x265)]++;}catch(_0x5a2e33){_0x1c9f58[_0x499b46(0x2c9)][_0x499b46(0x204)]({'name':_0x4f2225[_0x499b46(0x21f)][_0x499b46(0x263)],'action':'error','error':_0x5a2e33['message']}),_0x1c9f58[_0x499b46(0x231)][_0x499b46(0x2c9)][_0x499b46(0x235)]++;}}for(const _0x21d9e0 of _0x1881ee){try{const _0x5c46af=yamlTextKnowledgeBaseToApi({'name':_0x21d9e0[_0x499b46(0x263)],'text':_0x21d9e0[_0x499b46(0x2a3)]},_0x77010),_0x19eae4=await this[_0x499b46(0x26c)]['createTextKnowledgeBase'](_0x5c46af);_0x158895['set'](_0x21d9e0[_0x499b46(0x263)],_0x19eae4['id']),_0x1c9f58[_0x499b46(0x206)][_0x499b46(0x204)]({'name':_0x21d9e0[_0x499b46(0x263)],'action':_0x499b46(0x265),'id':_0x19eae4['id']}),_0x1c9f58[_0x499b46(0x231)][_0x499b46(0x206)][_0x499b46(0x265)]++;}catch(_0x566cfd){_0x1c9f58[_0x499b46(0x206)][_0x499b46(0x204)]({'name':_0x21d9e0['name'],'action':_0x499b46(0x242),'error':_0x566cfd[_0x499b46(0x2ad)]}),_0x1c9f58[_0x499b46(0x231)]['textKnowledgeBases']['errors']++;}}const _0x452866=[..._0x4069c5][_0x499b46(0x2c3)]((_0x39ae5c,_0x36d831)=>{const _0x475d9f=_0x499b46,_0x401b51=_0x39ae5c[_0x475d9f(0x21f)][_0x475d9f(0x212)]?.[_0x475d9f(0x297)](_0x244ee8=>_0x244ee8[_0x475d9f(0x2a7)]==='agent')??![],_0x23046b=_0x36d831['yaml'][_0x475d9f(0x212)]?.['some'](_0x14403b=>_0x14403b[_0x475d9f(0x2a7)]==='agent')??![];if(_0x401b51&&!_0x23046b)return 0x1;if(!_0x401b51&&_0x23046b)return-0x1;return 0x0;});for(const _0x37f33e of _0x452866){_0x4abb05=[];try{const _0x2e148e=_0x37f33e['yaml']['tools']?.[_0x499b46(0x208)](_0x34b51d=>{const _0x1265ae=_0x499b46;if(_0x34b51d[_0x1265ae(0x2a7)]===_0x1265ae(0x2d1)&&_0x34b51d[_0x1265ae(0x29b)]){const _0x46bc92=parseRef(_0x34b51d[_0x1265ae(0x29b)]);return _0x46bc92?.[_0x1265ae(0x263)]===_0x37f33e[_0x1265ae(0x21f)][_0x1265ae(0x263)];}return![];})??[];if(_0x2e148e[_0x499b46(0x1e3)]>0x0){const _0x3dadec=_0x499b46(0x232)+_0x37f33e['yaml'][_0x499b46(0x263)]+_0x499b46(0x25f)+_0x499b46(0x298);this['logger'][_0x499b46(0x1da)](_0x3dadec),_0x4abb05['push'](_0x3dadec);}const _0x4aa45c=await agentDefToRequest(_0x37f33e[_0x499b46(0x21f)],_0x37f33e[_0x499b46(0x222)],_0x37f33e[_0x499b46(0x237)],_0x5a8e31),_0x48f9d8=await this[_0x499b46(0x26c)][_0x499b46(0x209)](_0x4aa45c);_0x1a1b2a[_0x499b46(0x229)](_0x37f33e[_0x499b46(0x21f)][_0x499b46(0x263)],_0x48f9d8['id']),_0x1c9f58['agents'][_0x499b46(0x204)]({'agentName':_0x37f33e['yaml'][_0x499b46(0x263)],'action':_0x499b46(0x265),'agentId':_0x48f9d8['id'],'warnings':_0x4abb05[_0x499b46(0x1e3)]>0x0?_0x4abb05:undefined}),_0x1c9f58[_0x499b46(0x231)]['agents'][_0x499b46(0x265)]++;}catch(_0x37ae67){_0x1c9f58[_0x499b46(0x28e)]['push']({'agentName':_0x37f33e[_0x499b46(0x21f)][_0x499b46(0x263)],'action':_0x499b46(0x242),'error':_0x37ae67[_0x499b46(0x2ad)],'warnings':_0x4abb05[_0x499b46(0x1e3)]>0x0?_0x4abb05:undefined}),_0x1c9f58[_0x499b46(0x231)]['agents'][_0x499b46(0x235)]++;}}for(const _0x3f9cae of _0x2f34be){try{const _0x5115b9=await yamlPromptToApi(_0x3f9cae['yaml'],_0x77010,_0x5a8e31);if(!_0x5115b9){_0x1c9f58[_0x499b46(0x219)][_0x499b46(0x204)]({'name':_0x3f9cae[_0x499b46(0x21f)][_0x499b46(0x263)],'action':_0x499b46(0x242),'error':_0x499b46(0x28a)}),_0x1c9f58['counts'][_0x499b46(0x219)]['errors']++;continue;}const _0x474e8a=await this['client'][_0x499b46(0x244)](_0x5115b9);_0x23c135['set'](_0x3f9cae['yaml'][_0x499b46(0x263)],_0x474e8a['id']),_0x1c9f58[_0x499b46(0x219)][_0x499b46(0x204)]({'name':_0x3f9cae[_0x499b46(0x21f)][_0x499b46(0x263)],'action':'created','id':_0x474e8a['id']}),_0x1c9f58[_0x499b46(0x231)]['prompts']['created']++;}catch(_0x5eac9e){_0x1c9f58[_0x499b46(0x219)][_0x499b46(0x204)]({'name':_0x3f9cae[_0x499b46(0x21f)][_0x499b46(0x263)],'action':_0x499b46(0x242),'error':_0x5eac9e[_0x499b46(0x2ad)]}),_0x1c9f58['counts'][_0x499b46(0x219)][_0x499b46(0x235)]++;}}for(const _0x1bcf3a of _0x444846){try{const _0xc1c6a9=await yamlIntegrationToApi(_0x1bcf3a['yaml'],_0x77010,_0x5a8e31),_0x4aa498=await this[_0x499b46(0x26c)][_0x499b46(0x2b5)](_0xc1c6a9);_0x1c9f58[_0x499b46(0x221)][_0x499b46(0x204)]({'name':_0x1bcf3a[_0x499b46(0x21f)][_0x499b46(0x2cf)],'action':_0x499b46(0x265),'id':_0x4aa498['id']}),_0x1c9f58[_0x499b46(0x231)][_0x499b46(0x221)][_0x499b46(0x265)]++;}catch(_0xe173c3){_0x1c9f58[_0x499b46(0x221)][_0x499b46(0x204)]({'name':_0x1bcf3a[_0x499b46(0x21f)]['service_type'],'action':_0x499b46(0x242),'error':_0xe173c3[_0x499b46(0x2ad)]}),_0x1c9f58['counts']['integrations'][_0x499b46(0x235)]++;}}return _0x1c9f58;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a103_0x25ab(){const _0x3285f1=['4060563cXMubx','182752VauYwP','attributes','1162415RrfJlM','5427356rzNjvi','35199920xhJFSi','12pQVjhy','216CafWQA','has','1.0','2451127epWJHn','get','targetAgentId','8fQaMMr','targetKnowledgeBaseId','276363OsdVyO'];a103_0x25ab=function(){return _0x3285f1;};return a103_0x25ab();}function a103_0x3b0c(_0x112570,_0x2492a2){_0x112570=_0x112570-0xb2;const _0x25ab67=a103_0x25ab();let _0x3b0c75=_0x25ab67[_0x112570];return _0x3b0c75;}(function(_0x3c087b,_0x4b7dbe){const _0x470884=a103_0x3b0c,_0x16ed9b=_0x3c087b();while(!![]){try{const _0x144d42=parseInt(_0x470884(0xc1))/0x1*(parseInt(_0x470884(0xbd))/0x2)+-parseInt(_0x470884(0xc0))/0x3+-parseInt(_0x470884(0xb4))/0x4+-parseInt(_0x470884(0xb3))/0x5*(-parseInt(_0x470884(0xb6))/0x6)+-parseInt(_0x470884(0xba))/0x7+-parseInt(_0x470884(0xb7))/0x8*(parseInt(_0x470884(0xbf))/0x9)+parseInt(_0x470884(0xb5))/0xa;if(_0x144d42===_0x4b7dbe)break;else _0x16ed9b['push'](_0x16ed9b['shift']());}catch(_0x1ba8fa){_0x16ed9b['push'](_0x16ed9b['shift']());}}}(a103_0x25ab,0xc9bf4));export function canCreateAgent(_0x157224,_0x5bb101){const _0x373dda=a103_0x3b0c;for(const _0x184c45 of _0x157224[_0x373dda(0xb2)]['tools']){if(_0x184c45[_0x373dda(0xbc)]&&!_0x5bb101[_0x373dda(0xb8)](_0x184c45['targetAgentId']))return![];}return!![];}export function remapToolIds(_0x505502,_0x40ce60,_0x1e3c47){const _0x496325=a103_0x3b0c;return _0x505502['map'](_0x3fc779=>({..._0x3fc779,'targetKnowledgeBaseId':_0x3fc779['targetKnowledgeBaseId']?_0x40ce60[_0x496325(0xbb)](_0x3fc779['targetKnowledgeBaseId'])||_0x3fc779[_0x496325(0xbe)]:undefined,'targetAgentId':_0x3fc779[_0x496325(0xbc)]?_0x1e3c47[_0x496325(0xbb)](_0x3fc779[_0x496325(0xbc)])||_0x3fc779[_0x496325(0xbc)]:undefined}));}export function remapVariableIds(_0x3a7602,_0x339bd5){const _0x323073=a103_0x3b0c;return _0x3a7602['map'](_0x194ec1=>({..._0x194ec1,'targetKnowledgeBaseId':_0x339bd5['get'](_0x194ec1[_0x323073(0xbe)])||_0x194ec1[_0x323073(0xbe)]}));}export function isSupportedBackupVersion(_0x1f4503){const _0x4b2abd=a103_0x3b0c;return _0x1f4503===_0x4b2abd(0xb9);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a104_0x1efd(_0x12a095,_0x46b685){_0x12a095=_0x12a095-0xdb;const _0x548c75=a104_0x548c();let _0x1efda7=_0x548c75[_0x12a095];return _0x1efda7;}const a104_0x551a67=a104_0x1efd;(function(_0x41885c,_0x4a74ca){const _0xec6de=a104_0x1efd,_0x461b9e=_0x41885c();while(!![]){try{const _0x1d48aa=parseInt(_0xec6de(0xe2))/0x1*(-parseInt(_0xec6de(0xe3))/0x2)+-parseInt(_0xec6de(0xe4))/0x3*(-parseInt(_0xec6de(0xde))/0x4)+-parseInt(_0xec6de(0xdf))/0x5*(parseInt(_0xec6de(0xe7))/0x6)+parseInt(_0xec6de(0xe6))/0x7*(-parseInt(_0xec6de(0xe9))/0x8)+parseInt(_0xec6de(0xe1))/0x9*(parseInt(_0xec6de(0xe8))/0xa)+parseInt(_0xec6de(0xe0))/0xb*(-parseInt(_0xec6de(0xdb))/0xc)+parseInt(_0xec6de(0xdd))/0xd;if(_0x1d48aa===_0x4a74ca)break;else _0x461b9e['push'](_0x461b9e['shift']());}catch(_0x32ba36){_0x461b9e['push'](_0x461b9e['shift']());}}}(a104_0x548c,0xe7fb4));const MODEL_ALIASES={'haiku':a104_0x551a67(0xe5),'sonnet':'claude-4.5-sonnet'};export function extractModelAlias(_0x4ce203){const _0x313d34=a104_0x551a67,_0x929b93=_0x4ce203[_0x313d34(0xea)](/^claude-(?:\d+-)?(?:\d+-?)?(sonnet|haiku|opus)/i);if(_0x929b93)return _0x929b93[0x1][_0x313d34(0xdc)]();return _0x4ce203;}export function resolveModelAlias(_0x57a420){const _0x3844b5=a104_0x551a67;return MODEL_ALIASES[_0x57a420[_0x3844b5(0xdc)]()]||_0x57a420;}export function getModelAliases(){return{...MODEL_ALIASES};}function a104_0x548c(){const _0x557e9c=['137Sbcbow','9218nmFQqV','69pUmNiy','claude-4.5-haiku','63qhpgIW','6vuJJVQ','12385390kXHKCL','725096ngHZgl','match','13620jTJXcl','toLowerCase','13220844gnvvGM','185796OxGHwK','3854985dfPYKT','1507fLvmbY','9fUIMUU'];a104_0x548c=function(){return _0x557e9c;};return a104_0x548c();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x176bbd,_0x9b4b60){const _0x4dd697=a105_0x1cdd,_0x39d046=_0x176bbd();while(!![]){try{const _0x2aec35=parseInt(_0x4dd697(0xba))/0x1*(-parseInt(_0x4dd697(0xbe))/0x2)+parseInt(_0x4dd697(0xbd))/0x3+-parseInt(_0x4dd697(0xbf))/0x4*(-parseInt(_0x4dd697(0xd4))/0x5)+parseInt(_0x4dd697(0xd0))/0x6*(-parseInt(_0x4dd697(0xbb))/0x7)+parseInt(_0x4dd697(0xcb))/0x8+parseInt(_0x4dd697(0xc1))/0x9*(parseInt(_0x4dd697(0xb9))/0xa)+-parseInt(_0x4dd697(0xd5))/0xb*(-parseInt(_0x4dd697(0xc8))/0xc);if(_0x2aec35===_0x9b4b60)break;else _0x39d046['push'](_0x39d046['shift']());}catch(_0x29ea97){_0x39d046['push'](_0x39d046['shift']());}}}(a105_0x45a9,0x9e91f));export const MODEL_PRICING={'claude-opus-4-5-20251101':{'inputPricePerMTok':0x5,'outputPricePerMTok':0x19,'cacheWritePricePerMTok':6.25,'cacheReadPricePerMTok':0.5},'opus':{'inputPricePerMTok':0x5,'outputPricePerMTok':0x19,'cacheWritePricePerMTok':6.25,'cacheReadPricePerMTok':0.5},'claude-sonnet-4-5-20250929':{'inputPricePerMTok':0x3,'outputPricePerMTok':0xf,'cacheWritePricePerMTok':3.75,'cacheReadPricePerMTok':0.3},'sonnet':{'inputPricePerMTok':0x3,'outputPricePerMTok':0xf,'cacheWritePricePerMTok':3.75,'cacheReadPricePerMTok':0.3},'claude-haiku-4-5-20251001':{'inputPricePerMTok':0x1,'outputPricePerMTok':0x5,'cacheWritePricePerMTok':1.25,'cacheReadPricePerMTok':0.1},'haiku':{'inputPricePerMTok':0x1,'outputPricePerMTok':0x5,'cacheWritePricePerMTok':1.25,'cacheReadPricePerMTok':0.1}};export const USD_PER_AI_CREDIT=0x50;function a105_0x45a9(){const _0x24739c=['4-5','4.5','Haiku\x204','12JVwXTb','default','en-US','includes','1205apIRik','6526113hmTQhN','opus','65460iKvDcN','283OKfABK','715834YnznJw','outputPricePerMTok','26769cYTEzN','3334HbvFJl','5788gRugeZ','Sonnet\x204.5','279mTGFEz','cacheWritePricePerMTok','Claude','sonnet','cacheReadPricePerMTok','Opus\x204.5','toLowerCase','12nFEDjO','Opus\x204','haiku','1375432xMQzzi','Sonnet\x204'];a105_0x45a9=function(){return _0x24739c;};return a105_0x45a9();}export const CONTEXT_LIMITS={'sonnet':0x30d40,'haiku':0x30d40,'opus':0x30d40,'default':0x30d40};export function getModelPricing(_0x55c47e){const _0x251768=a105_0x1cdd;if(MODEL_PRICING[_0x55c47e])return MODEL_PRICING[_0x55c47e];const _0x47bcb8=_0x55c47e[_0x251768(0xc7)]();if(_0x47bcb8[_0x251768(0xd3)](_0x251768(0xb8)))return MODEL_PRICING[_0x251768(0xb8)];if(_0x47bcb8[_0x251768(0xd3)](_0x251768(0xc4)))return MODEL_PRICING[_0x251768(0xc4)];if(_0x47bcb8[_0x251768(0xd3)](_0x251768(0xca)))return MODEL_PRICING[_0x251768(0xca)];return MODEL_PRICING[_0x251768(0xc4)];}export function calculateTokenCost(_0x21112b,_0x376b32,_0x45b2cd,_0x81584,_0x4c1d98){const _0x4bed03=a105_0x1cdd,_0x52d3df=0xf4240;return _0x21112b*_0x4c1d98['inputPricePerMTok']/_0x52d3df+_0x376b32*_0x4c1d98[_0x4bed03(0xbc)]/_0x52d3df+_0x45b2cd*_0x4c1d98[_0x4bed03(0xc2)]/_0x52d3df+_0x81584*_0x4c1d98[_0x4bed03(0xc5)]/_0x52d3df;}export function usdToAiCredits(_0x5e4977){return _0x5e4977/USD_PER_AI_CREDIT;}export function calculateCreditsFromTokens(_0xb4c856,_0x185cbc,_0x5edc1b,_0x12b357,_0x2e7e88){const _0x2215da=getModelPricing(_0x2e7e88),_0x5dd459=calculateTokenCost(_0xb4c856,_0x185cbc,_0x5edc1b,_0x12b357,_0x2215da);return usdToAiCredits(_0x5dd459);}export function getContextLimit(_0x2a1d8a){const _0x130bae=a105_0x1cdd,_0x19f022=_0x2a1d8a[_0x130bae(0xc7)]();if(_0x19f022[_0x130bae(0xd3)](_0x130bae(0xc4)))return CONTEXT_LIMITS[_0x130bae(0xc4)];if(_0x19f022['includes'](_0x130bae(0xca)))return CONTEXT_LIMITS['haiku'];if(_0x19f022[_0x130bae(0xd3)](_0x130bae(0xb8)))return CONTEXT_LIMITS[_0x130bae(0xb8)];return CONTEXT_LIMITS[_0x130bae(0xd1)];}function a105_0x1cdd(_0xdae131,_0x565102){_0xdae131=_0xdae131-0xb8;const _0x45a9c0=a105_0x45a9();let _0x1cdd6f=_0x45a9c0[_0xdae131];return _0x1cdd6f;}export function getModelDisplayName(_0x571d15){const _0x195acc=a105_0x1cdd,_0x3041fb=_0x571d15['toLowerCase']();if(_0x3041fb[_0x195acc(0xd3)](_0x195acc(0xc4))){if(_0x3041fb['includes'](_0x195acc(0xcd))||_0x3041fb[_0x195acc(0xd3)]('4.5'))return _0x195acc(0xc0);return _0x195acc(0xcc);}if(_0x3041fb[_0x195acc(0xd3)]('haiku')){if(_0x3041fb['includes'](_0x195acc(0xcd))||_0x3041fb[_0x195acc(0xd3)](_0x195acc(0xce)))return'Haiku\x204.5';return _0x195acc(0xcf);}if(_0x3041fb['includes'](_0x195acc(0xb8))){if(_0x3041fb[_0x195acc(0xd3)](_0x195acc(0xcd))||_0x3041fb[_0x195acc(0xd3)](_0x195acc(0xce)))return _0x195acc(0xc6);return _0x195acc(0xc9);}return _0x195acc(0xc3);}export function formatTokenCount(_0x7a14cb){const _0x9907ec=a105_0x1cdd;return _0x7a14cb['toLocaleString'](_0x9907ec(0xd2));}export function calculateContextPercentage(_0x24c98d,_0x338934){const _0x510ea0=getContextLimit(_0x338934);return Math['round'](_0x24c98d/_0x510ea0*0x64);}
|