@treasuredata/tdx 2026.8.4 → 2026.8.6
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/README.md +1 -0
- package/dist/bin.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli-categories.d.ts +1 -1
- package/dist/cli-categories.js +1 -1
- package/dist/cli-categories.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/activations.js +1 -1
- package/dist/commands/agent-command.js +1 -1
- package/dist/commands/agent-test-command.js +1 -1
- package/dist/commands/api-command.js +1 -1
- package/dist/commands/auth-command.js +1 -1
- package/dist/commands/cas-command.js +1 -1
- package/dist/commands/cas-segment-command.d.ts.map +1 -1
- package/dist/commands/cas-segment-command.js +1 -1
- package/dist/commands/cas-segment-command.js.map +1 -1
- package/dist/commands/chat-command.js +1 -1
- package/dist/commands/claude-command.js +1 -1
- package/dist/commands/claude-statusline-command.js +1 -1
- package/dist/commands/claude-usage-command.js +1 -1
- package/dist/commands/codex-command.d.ts +51 -0
- package/dist/commands/codex-command.d.ts.map +1 -0
- package/dist/commands/codex-command.js +1 -0
- package/dist/commands/codex-command.js.map +1 -0
- package/dist/commands/command.js +1 -1
- package/dist/commands/connection-command.js +1 -1
- package/dist/commands/databases.js +1 -1
- package/dist/commands/delivery-command.js +1 -1
- package/dist/commands/describe.js +1 -1
- package/dist/commands/engage-always-on-campaign-pull-command.js +1 -1
- package/dist/commands/engage-always-on-campaign-push-command.js +1 -1
- package/dist/commands/engage-always-on-campaign-validate-command.js +1 -1
- package/dist/commands/engage-campaign-pull-command.js +1 -1
- package/dist/commands/engage-campaign-push-command.js +1 -1
- package/dist/commands/engage-campaign-validate-command.js +1 -1
- package/dist/commands/engage-command.d.ts.map +1 -1
- package/dist/commands/engage-command.js +1 -1
- package/dist/commands/engage-command.js.map +1 -1
- package/dist/commands/engage-template-pull-command.js +1 -1
- package/dist/commands/engage-template-push-command.js +1 -1
- package/dist/commands/engage-template-validate-command.js +1 -1
- package/dist/commands/job-command.js +1 -1
- package/dist/commands/journey-command.js +1 -1
- package/dist/commands/journey-validate-command.js +1 -1
- package/dist/commands/llm-command.js +1 -1
- package/dist/commands/mcp-command.js +1 -1
- package/dist/commands/p13n-command.js +1 -1
- package/dist/commands/parent-segment-command.js +1 -1
- package/dist/commands/policy-command.js +1 -1
- package/dist/commands/profile-command.js +1 -1
- package/dist/commands/profiles-command.js +1 -1
- package/dist/commands/query-command.js +1 -1
- package/dist/commands/schedule-command.js +1 -1
- package/dist/commands/segment-command.js +1 -1
- package/dist/commands/segment-create-command.js +1 -1
- package/dist/commands/segment-fields-command.js +1 -1
- package/dist/commands/segment-move-command.js +1 -1
- package/dist/commands/segment-pull-command.js +1 -1
- package/dist/commands/segment-push-command.js +1 -1
- package/dist/commands/segment-update-command.js +1 -1
- package/dist/commands/segment-use-command.js +1 -1
- package/dist/commands/segment-validate-command.js +1 -1
- package/dist/commands/segments.js +1 -1
- package/dist/commands/show.js +1 -1
- package/dist/commands/status-command.js +1 -1
- package/dist/commands/table-deleted.js +1 -1
- package/dist/commands/tables.js +1 -1
- package/dist/commands/unset-command.js +1 -1
- package/dist/commands/upgrade-command.js +1 -1
- package/dist/commands/use-command.js +1 -1
- package/dist/commands/user-command.js +1 -1
- package/dist/commands/work-command.js +1 -1
- package/dist/commands/workflow-command.js +1 -1
- package/dist/core/auth.js +1 -1
- package/dist/core/command-output.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/connection-cache.js +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/credential-cache.js +1 -1
- package/dist/core/global-context.js +1 -1
- package/dist/core/keychain.js +1 -1
- package/dist/core/oauth-keychain.js +1 -1
- package/dist/core/oauth.js +1 -1
- package/dist/core/profile.js +1 -1
- package/dist/core/project-config.js +1 -1
- package/dist/core/session.js +1 -1
- package/dist/core/site-mismatch.js +1 -1
- package/dist/core/user-cache.js +1 -1
- package/dist/core/version.d.ts +3 -3
- package/dist/core/version.d.ts.map +1 -1
- package/dist/core/version.js +1 -1
- package/dist/core/version.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools/index.js +1 -1
- package/dist/mcp/tools/tdx-run.js +1 -1
- package/dist/mcp/tools/tdx-search.js +1 -1
- package/dist/mcp/tools/work-create-item.js +1 -1
- package/dist/mcp/utils.js +1 -1
- package/dist/proxy/claude-usage-tracker.js +1 -1
- package/dist/proxy/passthrough-server.js +1 -1
- package/dist/proxy/sse-usage-parser.js +1 -1
- package/dist/sdk/agent/agent-config.js +1 -1
- package/dist/sdk/agent/agent-ref-parser.js +1 -1
- package/dist/sdk/agent/agent-yaml.js +1 -1
- package/dist/sdk/agent/test/evaluator.js +1 -1
- package/dist/sdk/agent/test/executor.js +1 -1
- package/dist/sdk/agent/test/index.js +1 -1
- package/dist/sdk/agent/test/output.js +1 -1
- package/dist/sdk/agent/test/parser.js +1 -1
- package/dist/sdk/agent/tool-target-registry.js +1 -1
- package/dist/sdk/api.js +1 -1
- package/dist/sdk/auth-token.js +1 -1
- package/dist/sdk/cas/cas-api-client.js +1 -1
- package/dist/sdk/cas/cas-audience-schema.js +1 -1
- package/dist/sdk/cas/cas-audience-validator.js +1 -1
- package/dist/sdk/cas/cas-audience-yaml.js +1 -1
- package/dist/sdk/cas/cas-segment-schema.d.ts +63 -0
- package/dist/sdk/cas/cas-segment-schema.d.ts.map +1 -0
- package/dist/sdk/cas/cas-segment-schema.js +1 -0
- package/dist/sdk/cas/cas-segment-schema.js.map +1 -0
- package/dist/sdk/cas/cas-segment-validator.d.ts +76 -0
- package/dist/sdk/cas/cas-segment-validator.d.ts.map +1 -0
- package/dist/sdk/cas/cas-segment-validator.js +1 -0
- package/dist/sdk/cas/cas-segment-validator.js.map +1 -0
- package/dist/sdk/cas/cas-segment-yaml.js +1 -1
- package/dist/sdk/cas/index.js +1 -1
- package/dist/sdk/cas/pull-workflow.js +1 -1
- package/dist/sdk/cas/push-workflow.js +1 -1
- package/dist/sdk/cas/validate-files.d.ts +23 -6
- package/dist/sdk/cas/validate-files.d.ts.map +1 -1
- package/dist/sdk/cas/validate-files.js +1 -1
- package/dist/sdk/cas/validate-files.js.map +1 -1
- package/dist/sdk/client/cdp-api-client.js +1 -1
- package/dist/sdk/client/delivery-api-client.js +1 -1
- package/dist/sdk/client/endpoints.js +1 -1
- package/dist/sdk/client/engage-api-client.js +1 -1
- package/dist/sdk/client/http-client.js +1 -1
- package/dist/sdk/client/llm-api-client.js +1 -1
- package/dist/sdk/client/oauth-refresh.js +1 -1
- package/dist/sdk/client/p13n-studio-api-client.js +1 -1
- package/dist/sdk/client/rate-limiter.js +1 -1
- package/dist/sdk/client/td-api-client.js +1 -1
- package/dist/sdk/client/trino-api-client.js +1 -1
- package/dist/sdk/client/workflow-client.js +1 -1
- package/dist/sdk/connection-validator.js +1 -1
- package/dist/sdk/connection.js +1 -1
- package/dist/sdk/delivery.js +1 -1
- package/dist/sdk/engage/always-on-campaign-pull.js +1 -1
- package/dist/sdk/engage/always-on-campaign-push.js +1 -1
- package/dist/sdk/engage/always-on-campaign-validator.js +1 -1
- package/dist/sdk/engage/always-on-campaign-yaml.d.ts.map +1 -1
- package/dist/sdk/engage/always-on-campaign-yaml.js +1 -1
- package/dist/sdk/engage/always-on-campaign-yaml.js.map +1 -1
- package/dist/sdk/engage/campaign-pull.js +1 -1
- package/dist/sdk/engage/campaign-push.js +1 -1
- package/dist/sdk/engage/campaign-validator.js +1 -1
- package/dist/sdk/engage/campaign-yaml.d.ts.map +1 -1
- package/dist/sdk/engage/campaign-yaml.js +1 -1
- package/dist/sdk/engage/campaign-yaml.js.map +1 -1
- package/dist/sdk/engage/template-pull.js +1 -1
- package/dist/sdk/engage/template-push.js +1 -1
- package/dist/sdk/engage/template-validator.js +1 -1
- package/dist/sdk/engage/template-yaml.d.ts.map +1 -1
- package/dist/sdk/engage/template-yaml.js +1 -1
- package/dist/sdk/engage/template-yaml.js.map +1 -1
- package/dist/sdk/engage/types/always-on-campaign-schema.d.ts +1 -0
- package/dist/sdk/engage/types/always-on-campaign-schema.d.ts.map +1 -1
- package/dist/sdk/engage/types/always-on-campaign-schema.js +1 -1
- package/dist/sdk/engage/types/campaign-def.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.d.ts +2 -0
- package/dist/sdk/engage/types/campaign-schema.d.ts.map +1 -1
- package/dist/sdk/engage/types/campaign-schema.js +1 -1
- package/dist/sdk/engage/types/campaign-schema.js.map +1 -1
- package/dist/sdk/engage/types/template-schema.d.ts +1 -0
- package/dist/sdk/engage/types/template-schema.d.ts.map +1 -1
- package/dist/sdk/engage/types/template-schema.js +1 -1
- package/dist/sdk/engage/types/template-schema.js.map +1 -1
- package/dist/sdk/engage.js +1 -1
- package/dist/sdk/errors.js +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/io/index.js +1 -1
- package/dist/sdk/io/node-filesystem.js +1 -1
- package/dist/sdk/job.js +1 -1
- package/dist/sdk/journey.js +1 -1
- package/dist/sdk/llm/chat-cache.js +1 -1
- package/dist/sdk/llm/index.js +1 -1
- package/dist/sdk/llm/llm-backup-utils.js +1 -1
- package/dist/sdk/llm/model-factors.js +1 -1
- package/dist/sdk/llm/user-settings.js +1 -1
- package/dist/sdk/p13n-studio.js +1 -1
- package/dist/sdk/personalization.js +1 -1
- package/dist/sdk/policy.js +1 -1
- package/dist/sdk/query/deleted-table-validation.js +1 -1
- package/dist/sdk/query/index.js +1 -1
- package/dist/sdk/query/sql-parser.js +1 -1
- package/dist/sdk/realtime.js +1 -1
- package/dist/sdk/schedule.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.d.ts.map +1 -1
- package/dist/sdk/segment/child-segment-yaml.js +1 -1
- package/dist/sdk/segment/child-segment-yaml.js.map +1 -1
- package/dist/sdk/segment/fields-display.js +1 -1
- package/dist/sdk/segment/file-discovery.js +1 -1
- package/dist/sdk/segment/journey-utils.js +1 -1
- package/dist/sdk/segment/journey-validator.js +1 -1
- package/dist/sdk/segment/journey-yaml.js +1 -1
- package/dist/sdk/segment/parent-segment-preview.js +1 -1
- package/dist/sdk/segment/parent-segment-yaml.js +1 -1
- package/dist/sdk/segment/pull-workflow.js +1 -1
- package/dist/sdk/segment/push-recovery.js +1 -1
- package/dist/sdk/segment/push-workflow.js +1 -1
- package/dist/sdk/segment/resolution-context.js +1 -1
- package/dist/sdk/segment/segment-path-parser.js +1 -1
- package/dist/sdk/segment/segment-ref-parser.js +1 -1
- package/dist/sdk/segment/segment-validator.js +1 -1
- package/dist/sdk/segment/target-resolution.js +1 -1
- package/dist/sdk/segment/tdx-config.js +1 -1
- package/dist/sdk/segment/types/activation-schema.js +1 -1
- package/dist/sdk/segment/types/journey-def.js +1 -1
- package/dist/sdk/segment/types/journey-schema.js +1 -1
- package/dist/sdk/segment/types/segment-def.js +1 -1
- package/dist/sdk/segment/types/segment-schema.d.ts.map +1 -1
- package/dist/sdk/segment/types/segment-schema.js +1 -1
- package/dist/sdk/segment/types/segment-schema.js.map +1 -1
- package/dist/sdk/segment/validate-files.js +1 -1
- package/dist/sdk/segment/yaml-validator.d.ts +1 -1
- package/dist/sdk/segment/yaml-validator.d.ts.map +1 -1
- package/dist/sdk/segment/yaml-validator.js +1 -1
- package/dist/sdk/segment/yaml-validator.js.map +1 -1
- package/dist/sdk/segment.js +1 -1
- package/dist/sdk/types/engage.d.ts +8 -0
- package/dist/sdk/types/engage.d.ts.map +1 -1
- package/dist/sdk/types/index.js +1 -1
- package/dist/sdk/types/progress.js +1 -1
- package/dist/sdk/types/workspace.js +1 -1
- package/dist/sdk/user.js +1 -1
- package/dist/sdk/util/format-detector.js +1 -1
- package/dist/sdk/util/formatters.js +1 -1
- package/dist/sdk/util/index.js +1 -1
- package/dist/sdk/util/paginate.js +1 -1
- package/dist/sdk/util/tree-formatter.js +1 -1
- package/dist/sdk/util/tree-search.js +1 -1
- package/dist/sdk/workflow/archive-validation.js +1 -1
- package/dist/sdk/workflow/clone-workflow.js +1 -1
- package/dist/sdk/workflow/index.js +1 -1
- package/dist/sdk/workflow/pull-workflow.js +1 -1
- package/dist/sdk/workflow/push-workflow.js +1 -1
- package/dist/sdk/workflow/task-graph.js +1 -1
- package/dist/sdk/workflow/tdx-config.js +1 -1
- package/dist/sdk/workflow/workflow-utils.js +1 -1
- package/dist/sdk/workspace/access-tracker.js +1 -1
- package/dist/sdk/workspace/frontmatter.js +1 -1
- package/dist/sdk/workspace/git.js +1 -1
- package/dist/sdk/workspace/index.js +1 -1
- package/dist/sdk/workspace/templates.js +1 -1
- package/dist/sdk/workspace/weekly.js +1 -1
- package/dist/sdk/workspace/wikilinks.js +1 -1
- package/dist/test-utils/command-runner.js +1 -1
- package/dist/test-utils/factories.js +1 -1
- package/dist/test-utils/fixtures.js +1 -1
- package/dist/test-utils/http-mock.js +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/utils/async.js +1 -1
- package/dist/utils/claude-code-state.js +1 -1
- package/dist/utils/colors.js +1 -1
- package/dist/utils/diff.js +1 -1
- package/dist/utils/file-permissions.js +1 -1
- package/dist/utils/file-reader.js +1 -1
- package/dist/utils/github-releases.js +1 -1
- package/dist/utils/global-cache.js +1 -1
- package/dist/utils/json-loader.js +1 -1
- package/dist/utils/local-cache.js +1 -1
- package/dist/utils/logger/formatters/default-formatter.js +1 -1
- package/dist/utils/logger/formatters/index.js +1 -1
- package/dist/utils/logger/handlers/console-handler.js +1 -1
- package/dist/utils/logger/handlers/file-handler.js +1 -1
- package/dist/utils/logger/handlers/index.js +1 -1
- package/dist/utils/logger/handlers/null-handler.js +1 -1
- package/dist/utils/logger/index.js +1 -1
- package/dist/utils/logger/logger.js +1 -1
- package/dist/utils/logger/types.js +1 -1
- package/dist/utils/option-validation.js +1 -1
- package/dist/utils/process.js +1 -1
- package/dist/utils/prompt.js +1 -1
- package/dist/utils/proxy-fetch.js +1 -1
- package/dist/utils/spinner.js +1 -1
- package/dist/utils/sse-parser.js +1 -1
- package/dist/utils/string-utils.js +1 -1
- package/dist/utils/table-ref-parser.js +1 -1
- package/dist/utils/tdx-logger.js +1 -1
- package/dist/utils/version-check.js +1 -1
- package/package.json +2 -47
package/dist/sdk/llm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a150_0xdd01(_0x131a37,_0x5a6f80){_0x131a37=_0x131a37-0xe1;const _0x42f0ae=a150_0x42f0();let _0xdd010b=_0x42f0ae[_0x131a37];return _0xdd010b;}const a150_0x594e97=a150_0xdd01;(function(_0x152d86,_0x1aefa4){const _0x3d0cea=a150_0xdd01,_0x4582d9=_0x152d86();while(!![]){try{const _0x17f773=-parseInt(_0x3d0cea(0x19c))/0x1+-parseInt(_0x3d0cea(0x11f))/0x2+-parseInt(_0x3d0cea(0x109))/0x3+-parseInt(_0x3d0cea(0x152))/0x4*(-parseInt(_0x3d0cea(0x1bb))/0x5)+-parseInt(_0x3d0cea(0x178))/0x6*(-parseInt(_0x3d0cea(0x127))/0x7)+parseInt(_0x3d0cea(0x1ee))/0x8+-parseInt(_0x3d0cea(0xf6))/0x9*(-parseInt(_0x3d0cea(0x160))/0xa);if(_0x17f773===_0x1aefa4)break;else _0x4582d9['push'](_0x4582d9['shift']());}catch(_0x1dd5ca){_0x4582d9['push'](_0x4582d9['shift']());}}}(a150_0x42f0,0x4252a));import{LLMApiClient}from'../client/llm-api-client.js';import*as a150_0x2ff9d8 from'node:fs';import*as a150_0x5d2257 from'node:path';function a150_0x42f0(){const _0x57499b=['INVALID_ARGUMENT','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','listExperimentalKnowledgeBases','chat','outputs','isManaged','systemPrompt','restoreProject','---\x20schema:\x20','projectId','formInterfaces','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','project.json','pullProject','\x0a---\x20code\x20---\x0a','chatWelcomeMessage','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','listToolTargets','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','includes','updateChatInterface','chatInterfaces','updateKnowledgeBase','getChatLog','listChatInterfaces','oldPath','Renamed\x20KB\x20file:\x20','statSync','agents.json','Project\x20\x22','high','duplicate','size','getUserSettings','experimental_artifacts','Renamed\x20integration\x20file:\x20','1512672xBbyyG','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','name','agentsFull','#\x20prompt.md\x0a','Multiple\x20projects\x20found\x20with\x20name\x20\x27','chat_interfaces','length','PERMISSION_DENIED','writeFileSync','---\x20file:\x20','experimentalArtifacts','project','Multiple\x20agents\x20found\x20with\x20name\x20\x27','description','updateExperimentalArtifact','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','readdirSync','message','pushAgent','agent.yml','actions','updated','form_interfaces','json_schema.json','backupProject','history','set','tdx_default_','Unable\x20to\x20create\x20project\x20after\x20','info','updateAgentResponse','low','isDirectory','modelType','\x0a---\x20schema:\x20','Agent\x20reference\x20not\x20found','Backup\x20folder\x20not\x20found:\x20','9nEKyMX','status','integrations','listKnowledgeBases','\x27.\x20This\x20should\x20not\x20happen.','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','readFileSync','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','createProject','LLM_PROJECT_NOT_FOUND','_reasoning_','getDefaultProjectName','No\x20tdx.json\x20found\x20in\x20','createAgent','isDir','minimal','prompt.md','AGENT_NOT_FOUND','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','194901kOzhYI','maxToolIterations','listPrompts','toLowerCase','yaml','resolveAgentId','text','resolveProjectName','createWebSearchTool','dir','createIntegration','\x0a\x0a#\x20agent.yml\x0a','listAgents','createPrompt','integrations.json','sdk.llm','getChatHistory','serviceType','Use\x20\x22tdx\x20llm\x20use\x20<project>\x22\x20to\x20set\x20a\x20project\x20context\x20first,\x20or\x20use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20all\x20agents.','unchanged','\x22\x20already\x20exists','context','216306qAKozr','newProjectId','unlinkSync','isFile','file_name','none','json_schema','some','7eJdXtF','clearDefaultAgent','push','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','updateExperimentalKnowledgeBase','service_type','ALREADY_EXISTS','starter_message','Renamed\x20folder:\x20','variables','currentProjectId','stringify','resolveProjectId','updateTextKnowledgeBase','\x20in\x20project\x20','cwd','error','Renamed\x20agent\x20folder:\x20','Only\x20safe\x20types\x20(','mkdirSync','utf-8','conflict','updatePrompt','Agent\x20\x27','metadata','getOrCreateDefaultAgent','prompts.json','createChatInterface','Could\x20not\x20resolve\x20agent\x20reference','\x20---\x0a','\x27\x20(','(dry-run)','knowledgebases.json','code','slackMessageMode','getAgent','medium','setDefaultAgent','errors','files','starter_message.md','dryRun','imageGenerators','152708xAovvZ','content','getChatInfo',')\x20can\x20be\x20cloned.','createTextKnowledgeBase','chat_agent_console','add','temperature','agent','parse','join','knowledgeBases','get','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','1016710tEfDtI','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','type','target','Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.','created','loadJsonFile','agentId','listAgentsFull','def','listTextKnowledgeBases','createKnowledgeBase','Invalid\x20agent\x20reference\x20format:\x20','Renamed\x20experimental\x20artifact\x20directory:\x20','\x0a---\x20function:\x20','webSearchTools','cloneProject','setCurrentProject','Renamed\x20experimental\x20KB\x20directory:\x20','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','total','startChat','dirname','listIntegrations','2856978bdLkSx','chat_generic','filter','existsSync','listImageGenerators','createFormInterface','code.js','deleteProject','functions','text_content','createExperimentalKnowledgeBase','createExperimentalArtifact','deleteIntegration','Available\x20agents:\x20','Renamed\x20chat\x20interface\x20file:\x20','prompts','exportedFrom','localeCompare','profile','listFormInterfaces','new','counts','createAgentResponse','keys','getProject','event','nameToId','updateAgent','has','path','attributes','tdx.json','idToName','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','experimentalKnowledgeBases','tools','436671rMktVP','Project\x20not\x20found:\x20','\x20attempts\x20due\x20to\x20name\x20conflicts.','chats','pullAgent','rmSync','.llm','chatIgnoreManagedActions','toISOString','warn','INTERNAL','TextKnowledgeBase','reasoningEffort','promptId','already\x20exists','llm_project','projects','logger','textKnowledgeBases','listExperimentalArtifacts','agent.yml\x20not\x20found\x20in\x20','starterMessage','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','sort','basename','endsWith','getOrCreateDefaultProject','listProjects','map','site','knowledge_bases','15dfMfKG','claude-4.5-sonnet','chatId','experimental_knowledge_bases','\x20→\x20','.md','listChats','Renamed\x20form\x20interface\x20file:\x20','renamed','getDefaultAgent','find','client','agents','.yml','deleteAgent'];a150_0x42f0=function(){return _0x57499b;};return a150_0x42f0();}import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{toModelInfos}from'./user-settings.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';import{getSanitizedUsername,generateRandomHex}from'../../utils/string-utils.js';import{generateDiff,formatDiffWithColors,hasChanges}from'../../utils/diff.js';import{readCachedLLMProject,writeCachedLLMProject,readCachedLLMAgent,writeCachedLLMAgent,clearCachedLLMAgent}from'../../core/config.js';import{Logger}from'../../utils/logger/index.js';export const SAFE_INTEGRATION_TYPES=[a150_0x594e97(0x179),a150_0x594e97(0x157),'chat_parent_segment'];async function safeListOrEmpty(_0x41b563){const _0x348478=a150_0x594e97;try{return await _0x41b563();}catch(_0x128352){if(_0x128352 instanceof HTTPClientError&&_0x128352[_0x348478(0xf7)]===0x194)return[];throw _0x128352;}}export class LLMSDK{[a150_0x594e97(0x131)];[a150_0x594e97(0x1c6)];['context'];['logger']=Logger['of'](a150_0x594e97(0x118));constructor(_0x59fb40){const _0x44d39a=a150_0x594e97;this[_0x44d39a(0x1c6)]=new LLMApiClient(_0x59fb40),this['context']=_0x59fb40;}[a150_0x594e97(0x101)](){const _0x495804=a150_0x594e97,_0x3565fc=getSanitizedUsername();return _0x495804(0xec)+_0x3565fc;}async[a150_0x594e97(0x171)](_0x3d57bb){const _0x585a3c=a150_0x594e97,{projectId:_0x2db5f0}=await this[_0x585a3c(0x110)](_0x3d57bb);this[_0x585a3c(0x131)]=_0x2db5f0;}['getCurrentProject'](){return this['currentProjectId'];}async[a150_0x594e97(0x14c)](_0x11bc1f){const _0x44f2aa=a150_0x594e97,_0xf5b493=this[_0x44f2aa(0x11e)]['profile'];let _0x2a8542,_0x2dbdae;if(_0x11bc1f[_0x44f2aa(0x1dd)]('/')){const _0x285fc5=_0x11bc1f['split']('/');if(_0x285fc5['length']!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x44f2aa(0x16c)+_0x11bc1f,undefined,{'helpText':_0x44f2aa(0x1dc)});const [_0x2fb1e1,_0x46c047]=_0x285fc5;_0x2a8542=await this[_0x44f2aa(0x133)](_0x2fb1e1),_0x2dbdae=_0x46c047;}else _0x2a8542=this['currentProjectId']||(await this[_0x44f2aa(0x1b6)]())['id'],_0x2dbdae=_0x11bc1f;const _0xcc8e0=await this[_0x44f2aa(0x10e)](_0x2dbdae,_0x2a8542),_0x4d9f93=await this[_0x44f2aa(0x1c6)]['getAgent'](_0xcc8e0);writeCachedLLMAgent(_0x4d9f93['attributes'][_0x44f2aa(0x1f0)],_0xcc8e0,_0x2a8542,_0xf5b493);}[a150_0x594e97(0x1c4)](){const _0x354fc5=a150_0x594e97,_0x72fb94=this['context'][_0x354fc5(0x18a)];return readCachedLLMAgent(_0x72fb94)||undefined;}[a150_0x594e97(0x128)](){const _0x322496=a150_0x594e97,_0x59edbd=this[_0x322496(0x11e)]['profile'];clearCachedLLMAgent(_0x59edbd);}async['models'](){const _0x372aa0=a150_0x594e97,_0x4bfb52=await this[_0x372aa0(0x1c6)][_0x372aa0(0x1eb)]();return toModelInfos(_0x4bfb52);}async[a150_0x594e97(0xfe)](_0x4f1f38){const _0x47b9ee=a150_0x594e97;return await this[_0x47b9ee(0x1c6)][_0x47b9ee(0xfe)](_0x4f1f38);}async[a150_0x594e97(0x17f)](_0x12b3bf){const _0x55dab7=a150_0x594e97,{projectId:_0x3c24cb}=await this[_0x55dab7(0x110)](_0x12b3bf);await this[_0x55dab7(0x1c6)][_0x55dab7(0x17f)](_0x3c24cb);}async[a150_0x594e97(0x1ac)](_0x586ab3=0x32){const _0x1f3b23=a150_0x594e97;return await this['client'][_0x1f3b23(0x1b7)](_0x586ab3);}async[a150_0x594e97(0x1b6)](_0x4e35e2){const _0x28000e=a150_0x594e97,_0xbd8681=_0x4e35e2||this[_0x28000e(0x101)](),_0x2b3cd=this[_0x28000e(0x11e)][_0x28000e(0x18a)];if(!_0x4e35e2){const _0x3d5d6e=readCachedLLMProject(_0x2b3cd);if(_0x3d5d6e&&_0x3d5d6e[_0x28000e(0x1f0)]===_0xbd8681)try{const _0x2cf5d3=await this[_0x28000e(0x1c6)][_0x28000e(0x190)](_0x3d5d6e['id']);if(_0x2cf5d3[_0x28000e(0x196)]['name']===_0xbd8681)return _0x2cf5d3;}catch{}}const _0x3054ae=await this['client'][_0x28000e(0x1b7)](),_0x65273d=_0x3054ae['find'](_0x30497c=>_0x30497c[_0x28000e(0x196)][_0x28000e(0x1f0)]===_0xbd8681);if(_0x65273d)return!_0x4e35e2&&writeCachedLLMProject(_0xbd8681,_0x65273d['id'],_0x2b3cd),_0x65273d;const _0x422b9a=await this['client'][_0x28000e(0xfe)]({'name':_0xbd8681,'description':_0x28000e(0x1b2)+getSanitizedUsername()+')'});return!_0x4e35e2&&writeCachedLLMProject(_0xbd8681,_0x422b9a['id'],_0x2b3cd),_0x422b9a;}async[a150_0x594e97(0x133)](_0x15b30e){const _0x1b3160=a150_0x594e97,_0x2a700=await this[_0x1b3160(0x1c6)][_0x1b3160(0x1b7)](),_0xd31558=_0x2a700[_0x1b3160(0x17a)](_0x2d0d21=>_0x2d0d21[_0x1b3160(0x196)][_0x1b3160(0x1f0)]===_0x15b30e);if(_0xd31558[_0x1b3160(0x1f5)]===0x0)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x1b3160(0x19d)+_0x15b30e,undefined,{'helpText':_0x1b3160(0x161)});if(_0xd31558[_0x1b3160(0x1f5)]>0x1)throw new SDKError(ErrorCode[_0x1b3160(0x1a6)],_0x1b3160(0x1f3)+_0x15b30e+_0x1b3160(0xfa));return _0xd31558[0x0]['id'];}async[a150_0x594e97(0x110)](_0x45ea67){const _0xab3e90=a150_0x594e97,_0x29159e=await this[_0xab3e90(0x1c6)][_0xab3e90(0x1b7)](),_0x5ded73=_0x29159e['find'](_0x288a87=>_0x288a87['attributes'][_0xab3e90(0x1f0)]===_0x45ea67);if(_0x5ded73)return{'projectId':_0x5ded73['id'],'project':_0x5ded73};throw new SDKError(ErrorCode[_0xab3e90(0xff)],_0xab3e90(0x19d)+_0x45ea67,undefined,{'helpText':_0xab3e90(0x161)});}async[a150_0x594e97(0x140)](_0x33319e=a150_0x594e97(0x1bc),_0x4dd862=0x0,_0x59c3f0){const _0x288a9f=a150_0x594e97,_0x5c3f85=0xa;let _0x31704f=0x0,_0x49349d;while(_0x31704f<_0x5c3f85){try{const _0x4f4e15=await this[_0x288a9f(0x1b6)](_0x49349d),_0x3641b1=_0x4f4e15['id'],_0x5f0bad=[_0x288a9f(0x124),_0x288a9f(0x105),_0x288a9f(0xf0),_0x288a9f(0x14b),_0x288a9f(0x1e8)],_0x2c9d75=_0x4dd862===0x0?'tdx_'+_0x33319e:'tdx_'+_0x33319e+_0x288a9f(0x100)+_0x5f0bad[_0x4dd862],_0x150d0b=await this['client']['listAgents'](_0x3641b1),_0x1edbb1=_0x150d0b['find'](_0x4b927c=>_0x4b927c['attributes'][_0x288a9f(0x1f0)]===_0x2c9d75);if(_0x1edbb1)return _0x1edbb1;const _0x1db871=_0x4dd862>0x0?0x1:_0x59c3f0;return await this['client'][_0x288a9f(0x103)]({'name':_0x2c9d75,'projectId':_0x3641b1,'modelType':_0x33319e,'systemPrompt':'','temperature':_0x1db871,'reasoningEffort':_0x4dd862>0x0?_0x4dd862:undefined});}catch(_0x2546f8){if(_0x2546f8 instanceof HTTPClientError){const _0x3f22b4=_0x2546f8[_0x288a9f(0xf7)];if(_0x3f22b4>=0x190&&_0x3f22b4<0x1f4){if(_0x3f22b4===0x191)throw new SDKError(ErrorCode['UNAUTHENTICATED'],_0x288a9f(0x173),_0x2546f8);else{if(_0x3f22b4===0x193)throw new SDKError(ErrorCode[_0x288a9f(0x1f6)],_0x288a9f(0xfd),_0x2546f8);}throw _0x2546f8;}}if(errorContains(_0x2546f8,_0x288a9f(0x1aa),_0x288a9f(0x1e9),_0x288a9f(0x13c))){_0x31704f++;if(_0x31704f>=_0x5c3f85)throw new SDKError(ErrorCode[_0x288a9f(0x12d)],_0x288a9f(0xed)+_0x5c3f85+_0x288a9f(0x19e),_0x2546f8);const _0x2cf46d=this['getDefaultProjectName']();_0x49349d=_0x2cf46d+'_'+generateRandomHex();continue;}throw _0x2546f8;}}throw new SDKError(ErrorCode[_0x288a9f(0x1a6)],_0x288a9f(0x108));}async[a150_0x594e97(0x10e)](_0x368d4e,_0x419235){const _0x23ad5d=a150_0x594e97,_0x359c2d=_0x419235||this['currentProjectId'],_0x187ed7=await this['client']['listAgents'](_0x359c2d),_0x1042ad=_0x187ed7[_0x23ad5d(0x17a)](_0x2069a2=>_0x2069a2[_0x23ad5d(0x196)][_0x23ad5d(0x1f0)]===_0x368d4e);if(_0x1042ad[_0x23ad5d(0x1f5)]===0x0){const _0x40fa97=_0x359c2d?_0x23ad5d(0x135)+_0x359c2d:'';throw new SDKError(ErrorCode[_0x23ad5d(0x107)],'Agent\x20not\x20found:\x20'+_0x368d4e+_0x40fa97,undefined,{'helpText':_0x359c2d?'Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.':_0x23ad5d(0x11b)});}if(_0x1042ad[_0x23ad5d(0x1f5)]>0x1)throw new SDKError(ErrorCode[_0x23ad5d(0x1a6)],_0x23ad5d(0x1fb)+_0x368d4e+_0x23ad5d(0xfa));return _0x1042ad[0x0]['id'];}async['agents'](_0x486d95){const _0xcb090=a150_0x594e97,_0x5098f8=_0x486d95||this[_0xcb090(0x131)];return await this[_0xcb090(0x1c6)][_0xcb090(0x115)](_0x5098f8);}async[a150_0x594e97(0x1f1)](_0x5affe4){const _0x1b71af=a150_0x594e97;return await this[_0x1b71af(0x1c6)][_0x1b71af(0x168)](_0x5affe4);}async[a150_0x594e97(0x15a)](_0x3f6105){const _0x1fba70=a150_0x594e97;return await this[_0x1fba70(0x1c6)][_0x1fba70(0x14a)](_0x3f6105);}async[a150_0x594e97(0x103)](_0x56038f){const _0x1e529e=a150_0x594e97;return await this[_0x1e529e(0x1c6)][_0x1e529e(0x103)](_0x56038f);}async[a150_0x594e97(0x193)](_0x5ec474,_0x5730da){const _0x191c73=a150_0x594e97;return await this[_0x191c73(0x1c6)][_0x191c73(0x193)](_0x5ec474,_0x5730da);}async[a150_0x594e97(0x1c9)](_0x1c08f4){const _0x4a1653=a150_0x594e97;await this['client'][_0x4a1653(0x1c9)](_0x1c08f4);}async['startChat'](_0x4fdbcf){const _0x3aba71=a150_0x594e97;return await this['client'][_0x3aba71(0x175)]({'agentId':_0x4fdbcf});}async*[a150_0x594e97(0x1cd)](_0xa48245,_0x5c727e){const _0x290892=a150_0x594e97;let _0x281125=_0x5c727e?.[_0x290892(0x1bd)];const _0x2eac8d=_0x5c727e?.[_0x290892(0x167)];if(!_0x281125){if(!_0x2eac8d)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x3b0177=await this['client'][_0x290892(0x175)]({'agentId':_0x2eac8d});_0x281125=_0x3b0177['id'],yield{'type':_0x290892(0x13f),'data':{'chatId':_0x281125,'agentId':_0x2eac8d,'projectId':_0x3b0177[_0x290892(0x196)][_0x290892(0x1d3)]}};}for await(const _0x5c85b8 of this['client']['continueChat'](_0x281125,_0xa48245,_0x5c727e?.['signal'])){yield{'type':_0x290892(0x191),'data':_0x5c85b8};}}async[a150_0x594e97(0x19f)](_0x50e530=0x32){const _0x19d349=a150_0x594e97;return await this['client'][_0x19d349(0x1c1)](_0x50e530);}async[a150_0x594e97(0xea)](_0x3ac2de){const _0x5c7fcd=a150_0x594e97;return await this[_0x5c7fcd(0x1c6)][_0x5c7fcd(0x119)](_0x3ac2de);}async['getChatLog'](_0x268972){const _0x1db035=a150_0x594e97;return await this[_0x1db035(0x1c6)][_0x1db035(0x1e1)](_0x268972);}async['chatInfo'](_0x1fa583){const _0x23f204=a150_0x594e97;return await this[_0x23f204(0x1c6)][_0x23f204(0x154)](_0x1fa583);}async[a150_0x594e97(0xe9)](_0x9ac8f1,_0x46cec6,_0x2c0d51){const _0x45f86c=a150_0x594e97,_0x36434a=_0x2c0d51?.[_0x45f86c(0x150)]??![],{projectId:_0x258b3d,project:_0x17dc94}=await this['resolveProjectName'](_0x9ac8f1),_0x31d893=_0x17dc94[_0x45f86c(0x196)][_0x45f86c(0x1f0)],_0x18c2f6=_0x46cec6||_0x31d893+_0x45f86c(0x1a2);if(a150_0x2ff9d8[_0x45f86c(0x17b)](_0x18c2f6)&&!_0x36434a)throw new SDKError(ErrorCode[_0x45f86c(0x12d)],'Output\x20directory\x20already\x20exists:\x20'+_0x18c2f6,undefined,{'helpText':_0x45f86c(0xfb)});const _0x24eecd=await this[_0x45f86c(0x1c6)][_0x45f86c(0x168)](_0x258b3d),_0x1a7655=await this[_0x45f86c(0x1c6)][_0x45f86c(0xf9)](_0x258b3d),_0x50d1de=await this['client'][_0x45f86c(0x10b)](_0x258b3d),_0x4154f7=await this[_0x45f86c(0x1c6)][_0x45f86c(0x177)](_0x258b3d);if(!_0x36434a){a150_0x2ff9d8['mkdirSync'](_0x18c2f6,{'recursive':!![]});const _0x4c344f={'version':'1.0','exportedAt':new Date()[_0x45f86c(0x1a4)](),'exportedFrom':{'site':this[_0x45f86c(0x11e)]['site'],'projectId':_0x258b3d,'projectName':_0x31d893},'project':_0x17dc94};a150_0x2ff9d8[_0x45f86c(0x1f7)](a150_0x5d2257[_0x45f86c(0x15c)](_0x18c2f6,_0x45f86c(0x1d6)),JSON[_0x45f86c(0x132)](_0x4c344f,null,0x2)),a150_0x2ff9d8[_0x45f86c(0x1f7)](a150_0x5d2257[_0x45f86c(0x15c)](_0x18c2f6,_0x45f86c(0x1e6)),JSON[_0x45f86c(0x132)](_0x24eecd,null,0x2)),a150_0x2ff9d8[_0x45f86c(0x1f7)](a150_0x5d2257['join'](_0x18c2f6,_0x45f86c(0x147)),JSON['stringify'](_0x1a7655,null,0x2)),a150_0x2ff9d8[_0x45f86c(0x1f7)](a150_0x5d2257[_0x45f86c(0x15c)](_0x18c2f6,_0x45f86c(0x141)),JSON[_0x45f86c(0x132)](_0x50d1de,null,0x2)),a150_0x2ff9d8[_0x45f86c(0x1f7)](a150_0x5d2257[_0x45f86c(0x15c)](_0x18c2f6,_0x45f86c(0x117)),JSON[_0x45f86c(0x132)](_0x4154f7,null,0x2));}return{'projectName':_0x31d893,'outputDir':_0x18c2f6,'counts':{'agents':_0x24eecd['length'],'knowledgeBases':_0x1a7655[_0x45f86c(0x1f5)],'prompts':_0x50d1de[_0x45f86c(0x1f5)],'integrations':_0x4154f7[_0x45f86c(0x1f5)]}};}async[a150_0x594e97(0x1d1)](_0x242246,_0x27566e){const _0x297473=a150_0x594e97,_0x4bda64=_0x27566e?.[_0x297473(0x150)]??![],_0xc31abd=this['getBackupMetadata'](_0x242246),_0x35af8c=_0xc31abd[_0x297473(0x188)][_0x297473(0x1b9)],_0xb3f265=this[_0x297473(0x11e)][_0x297473(0x1b9)],_0x534e78=_0x35af8c!==_0xb3f265?_0x35af8c:undefined,_0x2c91ad=this[_0x297473(0x166)](a150_0x5d2257[_0x297473(0x15c)](_0x242246,_0x297473(0x1e6)),[]),_0x29b4f6=this[_0x297473(0x166)](a150_0x5d2257['join'](_0x242246,'knowledgebases.json'),[]),_0x2d1102=this[_0x297473(0x166)](a150_0x5d2257['join'](_0x242246,'prompts.json'),[]),_0x10a5ac=this[_0x297473(0x166)](a150_0x5d2257[_0x297473(0x15c)](_0x242246,_0x297473(0x117)),[]),_0x3ec423=_0x27566e?.[_0x297473(0x1f0)]||_0xc31abd[_0x297473(0x188)]['projectName'];if(_0x4bda64){const _0x137b72=new Map(),_0x5ee266=[..._0x2c91ad],_0x3a21c7=_0x2c91ad['length']+0x1;let _0x45dd6d=0x0;while(_0x5ee266[_0x297473(0x1f5)]>0x0&&_0x45dd6d<_0x3a21c7){_0x45dd6d++;const _0xaec2cc=[];for(const _0x51bbf6 of _0x5ee266){canCreateAgent(_0x51bbf6,_0x137b72)?_0x137b72[_0x297473(0xeb)](_0x51bbf6['id'],'dry-run-'+_0x51bbf6['id']):_0xaec2cc['push'](_0x51bbf6);}if(_0xaec2cc[_0x297473(0x1f5)]===_0x5ee266['length'])throw new SDKError(ErrorCode['INTERNAL'],_0x297473(0x1d5),undefined,{'helpText':_0x297473(0x1cb)});_0x5ee266[_0x297473(0x1f5)]=0x0,_0x5ee266[_0x297473(0x129)](..._0xaec2cc);}const _0x39b6e8=_0x2d1102[_0x297473(0x17a)](_0x3991bf=>_0x137b72['has'](_0x3991bf[_0x297473(0x196)][_0x297473(0x167)]))[_0x297473(0x1f5)];return{'projectName':_0x3ec423,'projectId':_0x297473(0x146),'counts':{'agents':_0x2c91ad['length'],'knowledgeBases':_0x29b4f6[_0x297473(0x1f5)],'prompts':_0x39b6e8,'integrations':_0x10a5ac[_0x297473(0x1f5)]},'sourceSite':_0x534e78};}const _0x179a01=await this[_0x297473(0x1c6)][_0x297473(0xfe)]({'name':_0x3ec423,'description':_0xc31abd[_0x297473(0x1fa)][_0x297473(0x196)][_0x297473(0x1fc)]}),_0x21e72e=_0x179a01['id'],_0x1aaa8a=new Map(),_0x508552=new Map(),_0x2c96f5=new Map();for(const _0x22042b of _0x29b4f6){const _0x1ea04f=await this[_0x297473(0x1c6)]['createKnowledgeBase']({'projectId':_0x21e72e,'name':_0x22042b[_0x297473(0x196)][_0x297473(0x1f0)],'tdDatabaseName':_0x22042b[_0x297473(0x196)]['tdDatabaseName'],'tables':_0x22042b[_0x297473(0x196)]['tables']});_0x1aaa8a[_0x297473(0xeb)](_0x22042b['id'],_0x1ea04f['id']);}const _0xb5a2eb=[..._0x2c91ad],_0x20bd2b=_0x2c91ad[_0x297473(0x1f5)]+0x1;let _0x426fe5=0x0;while(_0xb5a2eb[_0x297473(0x1f5)]>0x0&&_0x426fe5<_0x20bd2b){_0x426fe5++;const _0x59c150=[];for(const _0x31be83 of _0xb5a2eb){if(canCreateAgent(_0x31be83,_0x508552)){const _0x68ab3e=remapToolIds(_0x31be83['attributes']['tools'],_0x1aaa8a,_0x508552),_0x2129e3=remapVariableIds(_0x31be83[_0x297473(0x196)][_0x297473(0x130)],_0x1aaa8a),_0x4169c0=await this[_0x297473(0x1c6)]['createAgentResponse']({'name':_0x31be83['attributes'][_0x297473(0x1f0)],'projectId':_0x21e72e,'systemPrompt':_0x31be83[_0x297473(0x196)][_0x297473(0x1d0)],'starterMessage':_0x31be83[_0x297473(0x196)]['starterMessage'],'modelType':migrateModelType(_0x31be83[_0x297473(0x196)][_0x297473(0xf2)]),'maxToolIterations':_0x31be83[_0x297473(0x196)][_0x297473(0x10a)],'temperature':_0x31be83[_0x297473(0x196)][_0x297473(0x159)],'reasoningEffort':_0x31be83[_0x297473(0x196)][_0x297473(0x1a8)],'outputs':_0x31be83['attributes'][_0x297473(0x1ce)],'tools':_0x68ab3e,'variables':_0x2129e3});_0x508552['set'](_0x31be83['id'],_0x4169c0['id']);}else _0x59c150['push'](_0x31be83);}if(_0x59c150['length']===_0xb5a2eb[_0x297473(0x1f5)])throw new SDKError(ErrorCode['INTERNAL'],_0x297473(0x1d5),undefined,{'helpText':_0x297473(0x1cb)});_0xb5a2eb[_0x297473(0x1f5)]=0x0,_0xb5a2eb[_0x297473(0x129)](..._0x59c150);}for(const _0x280b62 of _0x2d1102){const _0x21473c=_0x508552[_0x297473(0x15e)](_0x280b62[_0x297473(0x196)][_0x297473(0x167)]);if(!_0x21473c)continue;const _0x13fd68=await this[_0x297473(0x1c6)][_0x297473(0x116)]({'projectId':_0x21e72e,'agentId':_0x21473c,'name':_0x280b62[_0x297473(0x196)][_0x297473(0x1f0)],'systemPrompt':_0x280b62[_0x297473(0x196)][_0x297473(0x1d0)],'template':_0x280b62[_0x297473(0x196)]['template'],'jsonSchemaHint':_0x280b62['attributes']['jsonSchemaHint']});_0x2c96f5[_0x297473(0xeb)](_0x280b62['id'],_0x13fd68['id']);}for(const _0x169fdc of _0x10a5ac){const _0x4d060f=_0x169fdc['attributes'][_0x297473(0xe5)]['map'](_0x123b9a=>({..._0x123b9a,'promptId':_0x2c96f5[_0x297473(0x15e)](_0x123b9a[_0x297473(0x1a9)])||_0x123b9a[_0x297473(0x1a9)]}));await this[_0x297473(0x1c6)][_0x297473(0x113)]({'projectId':_0x21e72e,'serviceType':_0x169fdc[_0x297473(0x196)][_0x297473(0x11a)],'actions':_0x4d060f,'slackMessageMode':_0x169fdc[_0x297473(0x196)][_0x297473(0x149)],'chatIgnoreManagedActions':_0x169fdc['attributes'][_0x297473(0x1a3)],'chatWelcomeMessage':_0x169fdc['attributes'][_0x297473(0x1d9)],'webhookCorsOrigins':_0x169fdc['attributes']['webhookCorsOrigins']});}return{'projectName':_0x3ec423,'projectId':_0x21e72e,'counts':{'agents':_0x508552['size'],'knowledgeBases':_0x1aaa8a[_0x297473(0x1ea)],'prompts':_0x2c96f5[_0x297473(0x1ea)],'integrations':_0x10a5ac['length']},'sourceSite':_0x534e78};}[a150_0x594e97(0x166)](_0x260035,_0x29bc1a){const _0x543e59=a150_0x594e97;if(!a150_0x2ff9d8[_0x543e59(0x17b)](_0x260035))return _0x29bc1a;return JSON[_0x543e59(0x15b)](a150_0x2ff9d8[_0x543e59(0xfc)](_0x260035,_0x543e59(0x13b)));}['getBackupMetadata'](_0x22d388){const _0xb61d88=a150_0x594e97;if(!a150_0x2ff9d8[_0xb61d88(0x17b)](_0x22d388))throw new SDKError(ErrorCode['NOT_FOUND'],_0xb61d88(0xf5)+_0x22d388,undefined,{'helpText':_0xb61d88(0x12a)});const _0x36f9b3=a150_0x5d2257[_0xb61d88(0x15c)](_0x22d388,_0xb61d88(0x1d6));if(!a150_0x2ff9d8[_0xb61d88(0x17b)](_0x36f9b3))throw new SDKError(ErrorCode[_0xb61d88(0x1ca)],_0xb61d88(0x1da)+_0x22d388,undefined,{'helpText':'Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.'});const _0x479041=JSON[_0xb61d88(0x15b)](a150_0x2ff9d8['readFileSync'](_0x36f9b3,_0xb61d88(0x13b)));if(!isSupportedBackupVersion(_0x479041['version']))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],'Unsupported\x20backup\x20version:\x20'+_0x479041['version'],undefined,{'helpText':'This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.'});return _0x479041;}async[a150_0x594e97(0x1d7)](_0x472862,_0x762c4f,_0x398836){const _0x983b50=a150_0x594e97,{projectId:_0x2d6607,project:_0x42cc7e}=await this['resolveProjectName'](_0x472862),_0x2a0e95=_0x42cc7e[_0x983b50(0x196)][_0x983b50(0x1f0)];let _0x535f2d;if(_0x762c4f)_0x535f2d=_0x762c4f;else{const _0x2118da=a150_0x5d2257[_0x983b50(0x15c)](process[_0x983b50(0x136)](),_0x983b50(0x1c7)),_0x984743=getSanitizedPathWithMigration(_0x2118da,_0x2a0e95);_0x984743['renamed']&&this[_0x983b50(0x1ad)][_0x983b50(0xee)](_0x983b50(0x12f)+a150_0x5d2257[_0x983b50(0x1b4)](_0x984743['oldPath'])+_0x983b50(0x1bf)+a150_0x5d2257[_0x983b50(0x1b4)](_0x984743[_0x983b50(0x195)])),_0x535f2d=_0x984743[_0x983b50(0x195)];}const _0x1655f6=await this[_0x983b50(0x1c6)]['listAgentsFull'](_0x2d6607),_0x270954=await this['client'][_0x983b50(0xf9)](_0x2d6607),_0x105d3c=await this['client']['listTextKnowledgeBases'](_0x2d6607),_0x10090b=await safeListOrEmpty(()=>this[_0x983b50(0x1c6)][_0x983b50(0x17c)](_0x2d6607)),_0x5897e9=await safeListOrEmpty(()=>this[_0x983b50(0x1c6)]['listWebSearchTools'](_0x2d6607)),_0x342f44=await this[_0x983b50(0x1c6)][_0x983b50(0x10b)](_0x2d6607),_0x34555a=await this[_0x983b50(0x1c6)][_0x983b50(0x177)](_0x2d6607),_0x872393=await safeListOrEmpty(()=>this['client'][_0x983b50(0x1cc)](_0x2d6607)),_0x31c2aa=await safeListOrEmpty(()=>this[_0x983b50(0x1c6)][_0x983b50(0x1af)](_0x2d6607)),_0xd3f439=await safeListOrEmpty(()=>this['client'][_0x983b50(0x18b)](_0x2d6607)),_0x8c0440=await safeListOrEmpty(()=>this[_0x983b50(0x1c6)][_0x983b50(0x1e2)](_0x2d6607)),_0x2dc384=_0x34555a[_0x983b50(0x17a)](_0x451334=>!_0x451334[_0x983b50(0x196)]['isManaged']&&SAFE_INTEGRATION_TYPES[_0x983b50(0x1dd)](_0x451334[_0x983b50(0x196)][_0x983b50(0x11a)]['toLowerCase']())),_0x3ba978=new Map(),_0x45bf3=new Map(),_0x43ee06=new Map(),_0x574535=new Map(),_0x476cc6=new Map(),_0xb42720=new Map(),_0x2cce2a=new Map();for(const _0x25dd15 of _0x1655f6){_0x3ba978[_0x983b50(0xeb)](_0x25dd15['id'],_0x25dd15[_0x983b50(0x196)]['name']);}for(const _0x406a43 of _0x270954){_0x45bf3[_0x983b50(0xeb)](_0x406a43['id'],_0x406a43[_0x983b50(0x196)][_0x983b50(0x1f0)]);}for(const _0x282d48 of _0x105d3c){_0x43ee06['set'](_0x282d48['id'],_0x282d48['attributes'][_0x983b50(0x1f0)]);}for(const _0x5d0cd5 of _0x10090b){_0x574535['set'](_0x5d0cd5['id'],_0x5d0cd5[_0x983b50(0x196)][_0x983b50(0x1f0)]);}for(const _0x4c4ed7 of _0x5897e9){_0x476cc6[_0x983b50(0xeb)](_0x4c4ed7['id'],_0x4c4ed7[_0x983b50(0x196)][_0x983b50(0x1f0)]);}for(const _0x229147 of _0x342f44){_0xb42720[_0x983b50(0xeb)](_0x229147['id'],_0x229147['attributes'][_0x983b50(0x1f0)]);}for(const _0x48747d of _0x872393){_0x2cce2a['set'](_0x48747d['id'],_0x48747d[_0x983b50(0x196)][_0x983b50(0x1f0)]);}const _0x14fce6={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x45bf3,'TextKnowledgeBase':_0x43ee06,'Agent':_0x3ba978,'WebSearchTool':_0x476cc6,'ImageGenerator':_0x574535,'ExperimentalKnowledgeBase':_0x2cce2a}),'resolvePromptName':async _0x3c2f94=>_0xb42720[_0x983b50(0x15e)](_0x3c2f94),'onWarning':_0x3332aa=>this[_0x983b50(0x1ad)][_0x983b50(0x1a5)](_0x3332aa)},_0x2124fd={'projectName':_0x2a0e95,'outputDir':_0x535f2d,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'knowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'textKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'prompts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'integrations':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalArtifacts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'formInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'chatInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0x135c96=[],_0x4d77e5=[];for(const _0x1ae314 of _0x1655f6){const _0x27e5d9=getSanitizedPathWithMigration(_0x535f2d,_0x1ae314[_0x983b50(0x196)][_0x983b50(0x1f0)]);_0x27e5d9[_0x983b50(0x1c3)]&&this[_0x983b50(0x1ad)][_0x983b50(0xee)](_0x983b50(0x138)+a150_0x5d2257[_0x983b50(0x1b4)](_0x27e5d9[_0x983b50(0x1e3)])+_0x983b50(0x1bf)+a150_0x5d2257[_0x983b50(0x1b4)](_0x27e5d9[_0x983b50(0x195)]));const _0xe555f=_0x27e5d9[_0x983b50(0x195)],_0x822e0e=a150_0x5d2257['join'](_0xe555f,_0x983b50(0x106)),_0x408916=a150_0x5d2257[_0x983b50(0x15c)](_0xe555f,_0x983b50(0xe4)),_0x56e74c=a150_0x5d2257['join'](_0xe555f,_0x983b50(0x14f)),{yaml:_0x9c2c12,systemPrompt:_0x367f8f,starterMessage:_0x5916ec}=await agentResponseToDef(_0x1ae314,_0x14fce6),_0x73a560=toAgentYamlString(_0x9c2c12),_0x3cea2a=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x408916);let _0x5cc8c0=_0x3cea2a,_0x4aecb7;if(!_0x3cea2a){const _0x53e32f=a150_0x2ff9d8[_0x983b50(0x17b)](_0x822e0e)?a150_0x2ff9d8[_0x983b50(0xfc)](_0x822e0e,'utf-8'):'',_0x664410=a150_0x2ff9d8['readFileSync'](_0x408916,_0x983b50(0x13b)),_0x251e63=_0x983b50(0x1f2)+_0x53e32f+_0x983b50(0x114)+_0x664410,_0x16c1e7='#\x20prompt.md\x0a'+_0x367f8f+_0x983b50(0x114)+_0x73a560,_0x4a0d3=generateDiff(_0x251e63,_0x16c1e7);_0x5cc8c0=hasChanges(_0x4a0d3),_0x5cc8c0&&(_0x4aecb7=formatDiffWithColors(_0x4a0d3));}_0x135c96[_0x983b50(0x129)]({'path':_0xe555f,'content':'','isDir':!![]}),_0x135c96[_0x983b50(0x129)]({'path':_0x822e0e,'content':_0x367f8f}),_0x135c96[_0x983b50(0x129)]({'path':_0x408916,'content':_0x73a560});_0x5916ec&&_0x5916ec[_0x983b50(0x1dd)]('\x0a')&&_0x135c96[_0x983b50(0x129)]({'path':_0x56e74c,'content':_0x5916ec});_0x2124fd[_0x983b50(0x1c7)][_0x983b50(0x129)]({'agentName':_0x1ae314[_0x983b50(0x196)]['name'],'outputPath':_0xe555f,'isNew':_0x3cea2a,'hasChanges':_0x5cc8c0,'diff':_0x4aecb7}),_0x2124fd[_0x983b50(0x18d)]['agents']['total']++;if(_0x3cea2a)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1c7)][_0x983b50(0x18c)]++;else{if(_0x5cc8c0)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1c7)]['updated']++;else _0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1c7)]['unchanged']++;}}for(const _0x58133e of _0x270954){if(_0x58133e[_0x983b50(0x196)][_0x983b50(0x1cf)])continue;const _0x461ef4=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x535f2d),_0x58133e[_0x983b50(0x196)]['name'],_0x983b50(0x1c8));_0x461ef4['renamed']&&this[_0x983b50(0x1ad)][_0x983b50(0xee)](_0x983b50(0x1e4)+a150_0x5d2257[_0x983b50(0x1b4)](_0x461ef4[_0x983b50(0x1e3)])+'\x20→\x20'+a150_0x5d2257[_0x983b50(0x1b4)](_0x461ef4[_0x983b50(0x195)]));const _0x9e5ac6=_0x461ef4[_0x983b50(0x195)],_0x49f6c0=apiKnowledgeBaseToYaml(_0x58133e),_0xe9e83=toKnowledgeBaseYamlString(_0x49f6c0),_0x311851=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x9e5ac6);let _0x2fa1eb=_0x311851,_0x3ca2f1;if(!_0x311851){const _0xb7db57=a150_0x2ff9d8['readFileSync'](_0x9e5ac6,'utf-8'),_0x534cac=generateDiff(_0xb7db57,_0xe9e83);_0x2fa1eb=hasChanges(_0x534cac),_0x2fa1eb&&(_0x3ca2f1=formatDiffWithColors(_0x534cac));}_0x135c96[_0x983b50(0x129)]({'path':_0x9e5ac6,'content':_0xe9e83}),_0x2124fd[_0x983b50(0x15d)][_0x983b50(0x129)]({'name':_0x58133e[_0x983b50(0x196)][_0x983b50(0x1f0)],'outputPath':_0x9e5ac6,'isNew':_0x311851,'hasChanges':_0x2fa1eb,'diff':_0x3ca2f1}),_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x15d)][_0x983b50(0x174)]++;if(_0x311851)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x15d)][_0x983b50(0x18c)]++;else{if(_0x2fa1eb)_0x2124fd['counts'][_0x983b50(0x15d)][_0x983b50(0xe6)]++;else _0x2124fd['counts'][_0x983b50(0x15d)]['unchanged']++;}}for(const _0x3a8d6d of _0x105d3c){if(_0x3a8d6d[_0x983b50(0x196)][_0x983b50(0x1cf)])continue;const _0x2d7e07=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x535f2d),_0x3a8d6d['attributes'][_0x983b50(0x1f0)],_0x983b50(0x1c0));_0x2d7e07[_0x983b50(0x1c3)]&&this[_0x983b50(0x1ad)]['info']('Renamed\x20text\x20KB\x20file:\x20'+a150_0x5d2257['basename'](_0x2d7e07[_0x983b50(0x1e3)])+_0x983b50(0x1bf)+a150_0x5d2257['basename'](_0x2d7e07['path']));const _0x26b98a=_0x2d7e07[_0x983b50(0x195)],_0xb87b4f=toTextKnowledgeBaseMd(_0x3a8d6d[_0x983b50(0x196)][_0x983b50(0x1f0)],_0x3a8d6d[_0x983b50(0x196)]['text']),_0x9f8454=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x26b98a);let _0x85a910=_0x9f8454,_0xc7209b;if(!_0x9f8454){const _0x85bb0e=a150_0x2ff9d8[_0x983b50(0xfc)](_0x26b98a,_0x983b50(0x13b)),_0x295b27=generateDiff(_0x85bb0e,_0xb87b4f);_0x85a910=hasChanges(_0x295b27),_0x85a910&&(_0xc7209b=formatDiffWithColors(_0x295b27));}_0x135c96['push']({'path':_0x26b98a,'content':_0xb87b4f}),_0x2124fd[_0x983b50(0x1ae)][_0x983b50(0x129)]({'name':_0x3a8d6d[_0x983b50(0x196)][_0x983b50(0x1f0)],'outputPath':_0x26b98a,'isNew':_0x9f8454,'hasChanges':_0x85a910,'diff':_0xc7209b}),_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1ae)][_0x983b50(0x174)]++;if(_0x9f8454)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1ae)][_0x983b50(0x18c)]++;else{if(_0x85a910)_0x2124fd[_0x983b50(0x18d)]['textKnowledgeBases'][_0x983b50(0xe6)]++;else _0x2124fd['counts'][_0x983b50(0x1ae)][_0x983b50(0x11c)]++;}}for(const _0x5dd226 of _0x342f44){if(_0x5dd226[_0x983b50(0x196)][_0x983b50(0x1cf)])continue;const _0x2ffcd2=getSanitizedPathWithMigration(getPromptsDir(_0x535f2d),_0x5dd226['attributes'][_0x983b50(0x1f0)],'.yml');_0x2ffcd2[_0x983b50(0x1c3)]&&this['logger'][_0x983b50(0xee)]('Renamed\x20prompt\x20file:\x20'+a150_0x5d2257[_0x983b50(0x1b4)](_0x2ffcd2[_0x983b50(0x1e3)])+'\x20→\x20'+a150_0x5d2257['basename'](_0x2ffcd2['path']));const _0x7f2337=_0x2ffcd2[_0x983b50(0x195)],_0x51b6e4=await apiPromptToYaml(_0x5dd226,_0x14fce6);if(!_0x51b6e4)continue;const _0x4a4224=toPromptYamlString(_0x51b6e4),_0x4702f7=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x7f2337);let _0x3c6d7d=_0x4702f7,_0x5e83f7;if(!_0x4702f7){const _0x14d366=a150_0x2ff9d8[_0x983b50(0xfc)](_0x7f2337,_0x983b50(0x13b)),_0x3dccb5=generateDiff(_0x14d366,_0x4a4224);_0x3c6d7d=hasChanges(_0x3dccb5),_0x3c6d7d&&(_0x5e83f7=formatDiffWithColors(_0x3dccb5));}_0x135c96[_0x983b50(0x129)]({'path':_0x7f2337,'content':_0x4a4224}),_0x2124fd[_0x983b50(0x187)][_0x983b50(0x129)]({'name':_0x5dd226[_0x983b50(0x196)][_0x983b50(0x1f0)],'outputPath':_0x7f2337,'isNew':_0x4702f7,'hasChanges':_0x3c6d7d,'diff':_0x5e83f7}),_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x187)][_0x983b50(0x174)]++;if(_0x4702f7)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x187)][_0x983b50(0x18c)]++;else{if(_0x3c6d7d)_0x2124fd['counts'][_0x983b50(0x187)][_0x983b50(0xe6)]++;else _0x2124fd[_0x983b50(0x18d)][_0x983b50(0x187)][_0x983b50(0x11c)]++;}}for(const _0x2b962f of _0x2dc384){const _0x1cf855=_0x2b962f[_0x983b50(0x196)][_0x983b50(0x11a)][_0x983b50(0x10c)](),_0x1153f6=getSanitizedPathWithMigration(getIntegrationsDir(_0x535f2d),_0x1cf855,_0x983b50(0x1c8));_0x1153f6[_0x983b50(0x1c3)]&&this[_0x983b50(0x1ad)][_0x983b50(0xee)](_0x983b50(0x1ed)+a150_0x5d2257['basename'](_0x1153f6[_0x983b50(0x1e3)])+'\x20→\x20'+a150_0x5d2257[_0x983b50(0x1b4)](_0x1153f6['path']));const _0x38c4f4=_0x1153f6['path'],_0x1fba7b=await apiIntegrationToYaml(_0x2b962f,_0x14fce6),_0x213828=toIntegrationYamlString(_0x1fba7b),_0x1cbd7a=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x38c4f4);let _0x29f251=_0x1cbd7a,_0x4b2462;if(!_0x1cbd7a){const _0x2d4e9b=a150_0x2ff9d8[_0x983b50(0xfc)](_0x38c4f4,_0x983b50(0x13b)),_0x4d1bfb=generateDiff(_0x2d4e9b,_0x213828);_0x29f251=hasChanges(_0x4d1bfb),_0x29f251&&(_0x4b2462=formatDiffWithColors(_0x4d1bfb));}_0x135c96[_0x983b50(0x129)]({'path':_0x38c4f4,'content':_0x213828}),_0x2124fd[_0x983b50(0xf8)][_0x983b50(0x129)]({'name':_0x1cf855,'outputPath':_0x38c4f4,'isNew':_0x1cbd7a,'hasChanges':_0x29f251,'diff':_0x4b2462}),_0x2124fd[_0x983b50(0x18d)][_0x983b50(0xf8)]['total']++;if(_0x1cbd7a)_0x2124fd['counts'][_0x983b50(0xf8)][_0x983b50(0x18c)]++;else{if(_0x29f251)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0xf8)][_0x983b50(0xe6)]++;else _0x2124fd[_0x983b50(0x18d)][_0x983b50(0xf8)]['unchanged']++;}}for(const _0x1c9a75 of _0x872393){if(_0x1c9a75['attributes']['isManaged'])continue;const _0x28adfe=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x535f2d),_0x1c9a75[_0x983b50(0x196)][_0x983b50(0x1f0)]);_0x28adfe[_0x983b50(0x1c3)]&&this['logger'][_0x983b50(0xee)](_0x983b50(0x172)+a150_0x5d2257[_0x983b50(0x1b4)](_0x28adfe[_0x983b50(0x1e3)])+_0x983b50(0x1bf)+a150_0x5d2257['basename'](_0x28adfe['path']));const _0x76de6=_0x28adfe[_0x983b50(0x195)],_0x15e691=a150_0x5d2257[_0x983b50(0x15c)](_0x76de6,sanitizeForFilesystem(_0x1c9a75[_0x983b50(0x196)][_0x983b50(0x1f0)])+'.yml'),_0x255157=a150_0x5d2257['join'](_0x76de6,_0x983b50(0x180)),_0x50979b=apiExperimentalKnowledgeBaseToYaml(_0x1c9a75),_0x168b4f=toExperimentalKnowledgeBaseYamlString(_0x50979b),_0x28c7bd=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x76de6);let _0xcf3d28=_0x28c7bd,_0x186a42,_0x3ae7b6=_0x168b4f;const _0x16fdce=[..._0x50979b[_0x983b50(0x180)]][_0x983b50(0x1b3)]((_0x578d90,_0x2d423c)=>_0x578d90[_0x983b50(0x1f0)]['localeCompare'](_0x2d423c[_0x983b50(0x1f0)]));for(const _0x11c43a of _0x16fdce){_0x3ae7b6+=_0x983b50(0x16e)+_0x11c43a[_0x983b50(0x1f0)]+_0x983b50(0x144)+_0x11c43a[_0x983b50(0x148)]+_0x983b50(0xf3)+_0x11c43a['name']+_0x983b50(0x144)+_0x11c43a['json_schema']+'\x0a';}if(!_0x28c7bd){let _0x5dafa1='';a150_0x2ff9d8[_0x983b50(0x17b)](_0x15e691)&&(_0x5dafa1=a150_0x2ff9d8[_0x983b50(0xfc)](_0x15e691,_0x983b50(0x13b)));if(a150_0x2ff9d8[_0x983b50(0x17b)](_0x255157)){const _0x35a599=a150_0x2ff9d8[_0x983b50(0xe1)](_0x255157,{'withFileTypes':!![]}),_0x16c0e0=_0x35a599[_0x983b50(0x17a)](_0x3ca719=>_0x3ca719[_0x983b50(0xf1)]())[_0x983b50(0x1b3)]((_0x54c45d,_0x252f89)=>_0x54c45d[_0x983b50(0x1f0)][_0x983b50(0x189)](_0x252f89[_0x983b50(0x1f0)]));for(const _0x29db37 of _0x16c0e0){const _0x14fb7c=a150_0x5d2257['join'](_0x255157,_0x29db37[_0x983b50(0x1f0)],_0x983b50(0x17e)),_0xd9a763=a150_0x5d2257[_0x983b50(0x15c)](_0x255157,_0x29db37[_0x983b50(0x1f0)],_0x983b50(0xe8));a150_0x2ff9d8[_0x983b50(0x17b)](_0x14fb7c)&&(_0x5dafa1+=_0x983b50(0x16e)+_0x29db37[_0x983b50(0x1f0)]+_0x983b50(0x144)+a150_0x2ff9d8['readFileSync'](_0x14fb7c,_0x983b50(0x13b))+'\x0a'),a150_0x2ff9d8['existsSync'](_0xd9a763)&&(_0x5dafa1+=_0x983b50(0x1d2)+_0x29db37['name']+_0x983b50(0x144)+a150_0x2ff9d8[_0x983b50(0xfc)](_0xd9a763,_0x983b50(0x13b))+'\x0a');}}const _0x1742b8=generateDiff(_0x5dafa1,_0x3ae7b6);_0xcf3d28=hasChanges(_0x1742b8),_0xcf3d28&&(_0x186a42=formatDiffWithColors(_0x1742b8));}_0x135c96[_0x983b50(0x129)]({'path':_0x76de6,'content':'','isDir':!![]}),_0x135c96[_0x983b50(0x129)]({'path':_0x15e691,'content':_0x168b4f}),_0x135c96[_0x983b50(0x129)]({'path':_0x255157,'content':'','isDir':!![]});for(const _0x10520f of _0x50979b[_0x983b50(0x180)]){const _0x181443=a150_0x5d2257['join'](_0x255157,sanitizeForFilesystem(_0x10520f[_0x983b50(0x1f0)])),_0x2c7989=a150_0x5d2257[_0x983b50(0x15c)](_0x181443,_0x983b50(0x17e)),_0x499c9d=a150_0x5d2257['join'](_0x181443,_0x983b50(0xe8));_0x135c96[_0x983b50(0x129)]({'path':_0x181443,'content':'','isDir':!![]}),_0x135c96[_0x983b50(0x129)]({'path':_0x2c7989,'content':_0x10520f[_0x983b50(0x148)]}),_0x135c96[_0x983b50(0x129)]({'path':_0x499c9d,'content':_0x10520f['json_schema']});}if(a150_0x2ff9d8[_0x983b50(0x17b)](_0x255157)){const _0x8cf07c=a150_0x2ff9d8[_0x983b50(0xe1)](_0x255157,{'withFileTypes':!![]}),_0x139b3f=new Set(_0x50979b[_0x983b50(0x180)][_0x983b50(0x1b8)](_0x18736d=>sanitizeForFilesystem(_0x18736d['name'])));for(const _0x3e3515 of _0x8cf07c){if(_0x3e3515[_0x983b50(0xf1)]()&&!_0x139b3f[_0x983b50(0x194)](_0x3e3515['name'])){const _0x3ec62c=a150_0x5d2257[_0x983b50(0x15c)](_0x255157,_0x3e3515[_0x983b50(0x1f0)]);_0x4d77e5[_0x983b50(0x129)]({'path':_0x3ec62c,'isDir':!![]});}}}_0x2124fd[_0x983b50(0x19a)]['push']({'name':_0x1c9a75[_0x983b50(0x196)]['name'],'outputPath':_0x76de6,'isNew':_0x28c7bd,'hasChanges':_0xcf3d28,'diff':_0x186a42}),_0x2124fd['counts'][_0x983b50(0x19a)]['total']++;if(_0x28c7bd)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x19a)][_0x983b50(0x18c)]++;else{if(_0xcf3d28)_0x2124fd['counts'][_0x983b50(0x19a)][_0x983b50(0xe6)]++;else _0x2124fd[_0x983b50(0x18d)][_0x983b50(0x19a)][_0x983b50(0x11c)]++;}}for(const _0x54fd3a of _0x31c2aa){if(_0x54fd3a[_0x983b50(0x196)][_0x983b50(0x1cf)])continue;const _0x2da301=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x535f2d),_0x54fd3a[_0x983b50(0x196)][_0x983b50(0x1f0)]);_0x2da301[_0x983b50(0x1c3)]&&this['logger'][_0x983b50(0xee)](_0x983b50(0x16d)+a150_0x5d2257[_0x983b50(0x1b4)](_0x2da301[_0x983b50(0x1e3)])+_0x983b50(0x1bf)+a150_0x5d2257[_0x983b50(0x1b4)](_0x2da301['path']));const _0x477f86=_0x2da301[_0x983b50(0x195)],_0x56b9e5=a150_0x5d2257[_0x983b50(0x15c)](_0x477f86,sanitizeForFilesystem(_0x54fd3a[_0x983b50(0x196)]['name'])+_0x983b50(0x1c8)),_0x3af606=a150_0x5d2257[_0x983b50(0x15c)](_0x477f86,'code.js'),_0x2f21fc=a150_0x5d2257[_0x983b50(0x15c)](_0x477f86,_0x983b50(0x14e)),_0xdf0a15=apiExperimentalArtifactToYaml(_0x54fd3a),_0x477638=toExperimentalArtifactYamlString(_0xdf0a15),_0x173c4e=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x477f86);let _0x5021db=_0x173c4e,_0x1794af,_0x1a8214=_0x477638+('\x0a---\x20code\x20---\x0a'+_0xdf0a15[_0x983b50(0x148)]+'\x0a');const _0x10b83b=[..._0xdf0a15[_0x983b50(0x14e)]]['sort']((_0x2dab45,_0x19275c)=>_0x2dab45[_0x983b50(0x123)]['localeCompare'](_0x19275c[_0x983b50(0x123)]));for(const _0x2d3b68 of _0x10b83b){_0x1a8214+='---\x20file:\x20'+_0x2d3b68[_0x983b50(0x123)]+_0x983b50(0x144)+_0x2d3b68[_0x983b50(0x181)]+'\x0a';}if(!_0x173c4e){let _0x561e1d='';a150_0x2ff9d8['existsSync'](_0x56b9e5)&&(_0x561e1d=a150_0x2ff9d8[_0x983b50(0xfc)](_0x56b9e5,_0x983b50(0x13b)));a150_0x2ff9d8[_0x983b50(0x17b)](_0x3af606)&&(_0x561e1d+=_0x983b50(0x1d8)+a150_0x2ff9d8[_0x983b50(0xfc)](_0x3af606,_0x983b50(0x13b))+'\x0a');if(a150_0x2ff9d8['existsSync'](_0x2f21fc)){const _0x33fd1d=a150_0x2ff9d8['readdirSync'](_0x2f21fc),_0x231bed=_0x33fd1d[_0x983b50(0x17a)](_0x4be620=>{const _0x2e42ec=_0x983b50,_0x541746=a150_0x5d2257[_0x2e42ec(0x15c)](_0x2f21fc,_0x4be620);return a150_0x2ff9d8[_0x2e42ec(0x1e5)](_0x541746)[_0x2e42ec(0x122)]();})[_0x983b50(0x1b3)]((_0x16b3fe,_0x503ac4)=>_0x16b3fe[_0x983b50(0x189)](_0x503ac4));for(const _0x1da813 of _0x231bed){const _0x489547=a150_0x5d2257['join'](_0x2f21fc,_0x1da813);_0x561e1d+='---\x20file:\x20'+_0x1da813+_0x983b50(0x144)+a150_0x2ff9d8[_0x983b50(0xfc)](_0x489547,'utf-8')+'\x0a';}}const _0x501d31=generateDiff(_0x561e1d,_0x1a8214);_0x5021db=hasChanges(_0x501d31),_0x5021db&&(_0x1794af=formatDiffWithColors(_0x501d31));}_0x135c96['push']({'path':_0x477f86,'content':'','isDir':!![]}),_0x135c96['push']({'path':_0x56b9e5,'content':_0x477638}),_0x135c96[_0x983b50(0x129)]({'path':_0x3af606,'content':_0xdf0a15[_0x983b50(0x148)]});if(_0xdf0a15[_0x983b50(0x14e)][_0x983b50(0x1f5)]>0x0){_0x135c96[_0x983b50(0x129)]({'path':_0x2f21fc,'content':'','isDir':!![]});for(const _0x46a79a of _0xdf0a15['files']){const _0x2d51a8=a150_0x5d2257['join'](_0x2f21fc,_0x46a79a[_0x983b50(0x123)]);_0x135c96['push']({'path':_0x2d51a8,'content':_0x46a79a['text_content']});}}if(a150_0x2ff9d8[_0x983b50(0x17b)](_0x2f21fc)){const _0x278441=a150_0x2ff9d8[_0x983b50(0xe1)](_0x2f21fc),_0x2c3031=new Set(_0xdf0a15[_0x983b50(0x14e)]['map'](_0x3d063a=>_0x3d063a['file_name']));for(const _0x5ea695 of _0x278441){const _0x2855e7=a150_0x5d2257[_0x983b50(0x15c)](_0x2f21fc,_0x5ea695);a150_0x2ff9d8[_0x983b50(0x1e5)](_0x2855e7)[_0x983b50(0x122)]()&&!_0x2c3031[_0x983b50(0x194)](_0x5ea695)&&_0x4d77e5[_0x983b50(0x129)]({'path':_0x2855e7});}}_0x2124fd[_0x983b50(0x1f9)][_0x983b50(0x129)]({'name':_0x54fd3a['attributes'][_0x983b50(0x1f0)],'outputPath':_0x477f86,'isNew':_0x173c4e,'hasChanges':_0x5021db,'diff':_0x1794af}),_0x2124fd['counts'][_0x983b50(0x1f9)][_0x983b50(0x174)]++;if(_0x173c4e)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1f9)][_0x983b50(0x18c)]++;else{if(_0x5021db)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1f9)][_0x983b50(0xe6)]++;else _0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1f9)][_0x983b50(0x11c)]++;}}for(const _0xa61b20 of _0xd3f439){const _0x3b2713=getSanitizedPathWithMigration(getFormInterfacesDir(_0x535f2d),_0xa61b20[_0x983b50(0x196)]['name'],_0x983b50(0x1c8));_0x3b2713[_0x983b50(0x1c3)]&&this[_0x983b50(0x1ad)][_0x983b50(0xee)](_0x983b50(0x1c2)+a150_0x5d2257[_0x983b50(0x1b4)](_0x3b2713[_0x983b50(0x1e3)])+'\x20→\x20'+a150_0x5d2257[_0x983b50(0x1b4)](_0x3b2713[_0x983b50(0x195)]));const _0x1bfa61=_0x3b2713[_0x983b50(0x195)],_0x1ec0e8=await apiFormInterfaceToYaml(_0xa61b20,_0x14fce6),_0x382cb3=toFormInterfaceYamlString(_0x1ec0e8),_0x17282b=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x1bfa61);let _0x2fd69a=_0x17282b,_0x2a97b2;if(!_0x17282b){const _0x587283=a150_0x2ff9d8[_0x983b50(0xfc)](_0x1bfa61,_0x983b50(0x13b)),_0x1ddb5e=generateDiff(_0x587283,_0x382cb3);_0x2fd69a=hasChanges(_0x1ddb5e),_0x2fd69a&&(_0x2a97b2=formatDiffWithColors(_0x1ddb5e));}_0x135c96[_0x983b50(0x129)]({'path':_0x1bfa61,'content':_0x382cb3}),_0x2124fd[_0x983b50(0x1d4)][_0x983b50(0x129)]({'name':_0xa61b20['attributes'][_0x983b50(0x1f0)],'outputPath':_0x1bfa61,'isNew':_0x17282b,'hasChanges':_0x2fd69a,'diff':_0x2a97b2}),_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1d4)]['total']++;if(_0x17282b)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1d4)][_0x983b50(0x18c)]++;else{if(_0x2fd69a)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1d4)]['updated']++;else _0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1d4)][_0x983b50(0x11c)]++;}}for(const _0x4a9af7 of _0x8c0440){if(_0x4a9af7[_0x983b50(0x196)]['isManaged'])continue;const _0x73a3f0=getSanitizedPathWithMigration(getChatInterfacesDir(_0x535f2d),_0x4a9af7['attributes'][_0x983b50(0x1f0)],_0x983b50(0x1c8));_0x73a3f0['renamed']&&this[_0x983b50(0x1ad)][_0x983b50(0xee)](_0x983b50(0x186)+a150_0x5d2257[_0x983b50(0x1b4)](_0x73a3f0[_0x983b50(0x1e3)])+'\x20→\x20'+a150_0x5d2257['basename'](_0x73a3f0[_0x983b50(0x195)]));const _0x548beb=_0x73a3f0[_0x983b50(0x195)],_0xa164f4=await apiChatInterfaceToYaml(_0x4a9af7,_0x14fce6),_0x4bbdb6=toChatInterfaceYamlString(_0xa164f4),_0x1eee3f=!a150_0x2ff9d8[_0x983b50(0x17b)](_0x548beb);let _0x3ddcb4=_0x1eee3f,_0x1d8627;if(!_0x1eee3f){const _0x56fea7=a150_0x2ff9d8[_0x983b50(0xfc)](_0x548beb,_0x983b50(0x13b)),_0x2256bc=generateDiff(_0x56fea7,_0x4bbdb6);_0x3ddcb4=hasChanges(_0x2256bc),_0x3ddcb4&&(_0x1d8627=formatDiffWithColors(_0x2256bc));}_0x135c96['push']({'path':_0x548beb,'content':_0x4bbdb6}),_0x2124fd[_0x983b50(0x1df)]['push']({'name':_0x4a9af7[_0x983b50(0x196)]['name'],'outputPath':_0x548beb,'isNew':_0x1eee3f,'hasChanges':_0x3ddcb4,'diff':_0x1d8627}),_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1df)][_0x983b50(0x174)]++;if(_0x1eee3f)_0x2124fd[_0x983b50(0x18d)]['chatInterfaces'][_0x983b50(0x18c)]++;else{if(_0x3ddcb4)_0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1df)][_0x983b50(0xe6)]++;else _0x2124fd[_0x983b50(0x18d)][_0x983b50(0x1df)][_0x983b50(0x11c)]++;}}if(_0x398836?.['dryRun'])return _0x2124fd;a150_0x2ff9d8[_0x983b50(0x13a)](_0x535f2d,{'recursive':!![]}),a150_0x2ff9d8[_0x983b50(0x13a)](getKnowledgeBasesDir(_0x535f2d),{'recursive':!![]}),a150_0x2ff9d8[_0x983b50(0x13a)](getPromptsDir(_0x535f2d),{'recursive':!![]}),a150_0x2ff9d8[_0x983b50(0x13a)](getIntegrationsDir(_0x535f2d),{'recursive':!![]}),a150_0x2ff9d8[_0x983b50(0x13a)](getExperimentalKnowledgeBasesDir(_0x535f2d),{'recursive':!![]}),a150_0x2ff9d8['mkdirSync'](getExperimentalArtifactsDir(_0x535f2d),{'recursive':!![]}),a150_0x2ff9d8[_0x983b50(0x13a)](getFormInterfacesDir(_0x535f2d),{'recursive':!![]}),a150_0x2ff9d8[_0x983b50(0x13a)](getChatInterfacesDir(_0x535f2d),{'recursive':!![]});const _0x2cac11=a150_0x5d2257[_0x983b50(0x15c)](_0x535f2d,_0x983b50(0x197));a150_0x2ff9d8[_0x983b50(0x1f7)](_0x2cac11,createAgentConfigContent(_0x2a0e95));for(const _0x548c04 of _0x135c96){if(_0x548c04[_0x983b50(0x104)])a150_0x2ff9d8['mkdirSync'](_0x548c04['path'],{'recursive':!![]});else{const _0x377aff=a150_0x5d2257[_0x983b50(0x176)](_0x548c04[_0x983b50(0x195)]);!a150_0x2ff9d8[_0x983b50(0x17b)](_0x377aff)&&a150_0x2ff9d8[_0x983b50(0x13a)](_0x377aff,{'recursive':!![]}),a150_0x2ff9d8[_0x983b50(0x1f7)](_0x548c04['path'],_0x548c04[_0x983b50(0x153)]);}}for(const _0x47ccd4 of _0x4d77e5){_0x47ccd4[_0x983b50(0x104)]?(a150_0x2ff9d8[_0x983b50(0x1a1)](_0x47ccd4[_0x983b50(0x195)],{'recursive':!![],'force':!![]}),this['logger'][_0x983b50(0xee)]('Removed\x20deleted\x20directory:\x20'+a150_0x5d2257['basename'](a150_0x5d2257[_0x983b50(0x176)](_0x47ccd4[_0x983b50(0x195)]))+'/'+a150_0x5d2257['basename'](_0x47ccd4[_0x983b50(0x195)]))):(a150_0x2ff9d8['rmSync'](_0x47ccd4['path'],{'force':!![]}),this[_0x983b50(0x1ad)][_0x983b50(0xee)]('Removed\x20deleted\x20file:\x20'+a150_0x5d2257['basename'](a150_0x5d2257[_0x983b50(0x176)](_0x47ccd4[_0x983b50(0x195)]))+'/'+a150_0x5d2257[_0x983b50(0x1b4)](_0x47ccd4['path'])));}return _0x2124fd;}async['pushProject'](_0x14a5fb,_0x32a8df){const _0x209c50=a150_0x594e97,_0x2d6a10=a150_0x5d2257[_0x209c50(0x15c)](_0x14a5fb,_0x209c50(0x197));if(!a150_0x2ff9d8[_0x209c50(0x17b)](_0x2d6a10))throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x209c50(0x102)+_0x14a5fb,undefined,{'helpText':_0x209c50(0x199)});const _0x395fe7=loadAgentConfig(_0x2d6a10),_0x1aaa10=await this[_0x209c50(0x133)](_0x395fe7[_0x209c50(0x1ab)]),_0x38a836=await this['client'][_0x209c50(0x190)](_0x1aaa10),_0x920dc6=_0x38a836[_0x209c50(0x196)][_0x209c50(0x1f0)],_0x5e137c={'projectName':_0x920dc6,'projectId':_0x1aaa10,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x3afcb0=[],_0x102e96=[],_0x6a99cd=[],_0x1598b3=[],_0x17d08a=[],_0x3725c6=[],_0x4f0914=a150_0x2ff9d8[_0x209c50(0xe1)](_0x14a5fb,{'withFileTypes':!![]});for(const _0x2c6ef8 of _0x4f0914){if(!_0x2c6ef8[_0x209c50(0xf1)]())continue;if(['knowledge_bases','prompts',_0x209c50(0xf8),_0x209c50(0x1be),_0x209c50(0x1ec),_0x209c50(0xe7),_0x209c50(0x1f4)][_0x209c50(0x1dd)](_0x2c6ef8[_0x209c50(0x1f0)]))continue;const _0x3d45ab=a150_0x5d2257[_0x209c50(0x15c)](_0x14a5fb,_0x2c6ef8[_0x209c50(0x1f0)]);if(isAgentDir(_0x3d45ab)){const _0xda3312=a150_0x5d2257[_0x209c50(0x15c)](_0x3d45ab,_0x209c50(0xe4)),_0x51e459=a150_0x5d2257[_0x209c50(0x15c)](_0x3d45ab,_0x209c50(0x106)),_0x36558c=a150_0x5d2257[_0x209c50(0x15c)](_0x3d45ab,'starter_message.md'),_0x52d6f4=parseAgentYaml(a150_0x2ff9d8['readFileSync'](_0xda3312,_0x209c50(0x13b)),_0xda3312),_0x4c3b76=a150_0x2ff9d8[_0x209c50(0x17b)](_0x51e459)?a150_0x2ff9d8[_0x209c50(0xfc)](_0x51e459,_0x209c50(0x13b)):'',_0x30f78a=a150_0x2ff9d8[_0x209c50(0x17b)](_0x36558c)?a150_0x2ff9d8[_0x209c50(0xfc)](_0x36558c,_0x209c50(0x13b)):_0x52d6f4[_0x209c50(0x12e)];_0x3afcb0[_0x209c50(0x129)]({'name':_0x52d6f4[_0x209c50(0x1f0)],'dir':_0x3d45ab,'yaml':_0x52d6f4,'systemPrompt':_0x4c3b76,'starterMessage':_0x30f78a});}}const _0x277b05=getKnowledgeBasesDir(_0x14a5fb);if(a150_0x2ff9d8[_0x209c50(0x17b)](_0x277b05)){const _0x303133=a150_0x2ff9d8[_0x209c50(0xe1)](_0x277b05);for(const _0x19a1f0 of _0x303133){const _0x29391c=a150_0x5d2257[_0x209c50(0x15c)](_0x277b05,_0x19a1f0);if(_0x19a1f0['endsWith'](_0x209c50(0x1c8))){const _0x37c7aa=parseKnowledgeBaseYaml(a150_0x2ff9d8[_0x209c50(0xfc)](_0x29391c,'utf-8'),_0x29391c);_0x102e96['push']({'name':_0x37c7aa['name'],'path':_0x29391c,'yaml':_0x37c7aa});}else{if(_0x19a1f0['endsWith'](_0x209c50(0x1c0))){const _0x32e138=a150_0x2ff9d8[_0x209c50(0xfc)](_0x29391c,'utf-8'),{name:_0x4556ba,text:_0x554ea7}=parseTextKnowledgeBaseMd(_0x32e138,_0x19a1f0);_0x6a99cd[_0x209c50(0x129)]({'name':_0x4556ba,'path':_0x29391c,'text':_0x554ea7});}}}}const _0x40cd1a=getPromptsDir(_0x14a5fb);if(a150_0x2ff9d8[_0x209c50(0x17b)](_0x40cd1a)){const _0x5607f1=a150_0x2ff9d8['readdirSync'](_0x40cd1a)[_0x209c50(0x17a)](_0x369b11=>_0x369b11[_0x209c50(0x1b5)](_0x209c50(0x1c8)));for(const _0x2ae980 of _0x5607f1){const _0x29be31=a150_0x5d2257[_0x209c50(0x15c)](_0x40cd1a,_0x2ae980),_0x4d4b7d=parsePromptYaml(a150_0x2ff9d8[_0x209c50(0xfc)](_0x29be31,_0x209c50(0x13b)),_0x29be31);_0x1598b3[_0x209c50(0x129)]({'name':_0x4d4b7d[_0x209c50(0x1f0)],'path':_0x29be31,'yaml':_0x4d4b7d});}}const _0x279c2e=[],_0x3239b1=getIntegrationsDir(_0x14a5fb);if(a150_0x2ff9d8[_0x209c50(0x17b)](_0x3239b1)){const _0x256639=a150_0x2ff9d8['readdirSync'](_0x3239b1)[_0x209c50(0x17a)](_0x53ce31=>_0x53ce31[_0x209c50(0x1b5)](_0x209c50(0x1c8)));for(const _0x9916b8 of _0x256639){const _0x4b73c8=a150_0x5d2257[_0x209c50(0x15c)](_0x3239b1,_0x9916b8),_0x549d85=parseIntegrationYaml(a150_0x2ff9d8[_0x209c50(0xfc)](_0x4b73c8,_0x209c50(0x13b)),_0x4b73c8);if(!SAFE_INTEGRATION_TYPES[_0x209c50(0x1dd)](_0x549d85[_0x209c50(0x12c)][_0x209c50(0x10c)]())){this[_0x209c50(0x1ad)][_0x209c50(0x1a5)]('Skipping\x20integration\x20\x27'+_0x549d85[_0x209c50(0x1f0)]+_0x209c50(0x145)+_0x549d85['service_type']+'):\x20'+(_0x209c50(0x139)+SAFE_INTEGRATION_TYPES['join'](',\x20')+')\x20can\x20be\x20pushed.\x20')+'Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.');continue;}_0x279c2e['push']({'name':_0x549d85[_0x209c50(0x1f0)],'path':_0x4b73c8,'yaml':_0x549d85});}}const _0x4976cb=getExperimentalKnowledgeBasesDir(_0x14a5fb);if(a150_0x2ff9d8[_0x209c50(0x17b)](_0x4976cb)){const _0x3d4d85=a150_0x2ff9d8[_0x209c50(0xe1)](_0x4976cb,{'withFileTypes':!![]});for(const _0x4ee21b of _0x3d4d85){if(!_0x4ee21b['isDirectory']())continue;const _0x26fd59=a150_0x5d2257['join'](_0x4976cb,_0x4ee21b[_0x209c50(0x1f0)]),_0x260a98=a150_0x5d2257[_0x209c50(0x15c)](_0x26fd59,_0x4ee21b['name']+_0x209c50(0x1c8)),_0x584d7d=a150_0x5d2257[_0x209c50(0x15c)](_0x26fd59,_0x209c50(0x180));if(!a150_0x2ff9d8['existsSync'](_0x260a98))continue;const _0x339645=parseExperimentalKnowledgeBaseYaml(a150_0x2ff9d8[_0x209c50(0xfc)](_0x260a98,'utf-8'),_0x260a98),_0x4cccd9=[];if(a150_0x2ff9d8[_0x209c50(0x17b)](_0x584d7d)){const _0x49b97c=a150_0x2ff9d8[_0x209c50(0xe1)](_0x584d7d,{'withFileTypes':!![]});for(const _0x44500a of _0x49b97c){if(!_0x44500a[_0x209c50(0xf1)]())continue;const _0x4ddd26=a150_0x5d2257['join'](_0x584d7d,_0x44500a[_0x209c50(0x1f0)]),_0x3bbdf3=a150_0x5d2257['join'](_0x4ddd26,_0x209c50(0x17e)),_0x2642f0=a150_0x5d2257['join'](_0x4ddd26,_0x209c50(0xe8));a150_0x2ff9d8[_0x209c50(0x17b)](_0x3bbdf3)&&a150_0x2ff9d8[_0x209c50(0x17b)](_0x2642f0)&&_0x4cccd9[_0x209c50(0x129)]({'name':_0x44500a[_0x209c50(0x1f0)],'code':a150_0x2ff9d8[_0x209c50(0xfc)](_0x3bbdf3,'utf-8'),'json_schema':a150_0x2ff9d8['readFileSync'](_0x2642f0,_0x209c50(0x13b))});}}const _0x20c5f1={..._0x339645,'variables':_0x339645[_0x209c50(0x130)]||[],'functions':_0x4cccd9};_0x17d08a[_0x209c50(0x129)]({'name':_0x339645[_0x209c50(0x1f0)],'dir':_0x26fd59,'def':_0x20c5f1});}}const _0x3a9a94=getExperimentalArtifactsDir(_0x14a5fb);if(a150_0x2ff9d8[_0x209c50(0x17b)](_0x3a9a94)){const _0x2c4995=a150_0x2ff9d8['readdirSync'](_0x3a9a94,{'withFileTypes':!![]});for(const _0x332c9d of _0x2c4995){if(!_0x332c9d[_0x209c50(0xf1)]())continue;const _0xf591e0=a150_0x5d2257[_0x209c50(0x15c)](_0x3a9a94,_0x332c9d[_0x209c50(0x1f0)]),_0x385509=a150_0x5d2257['join'](_0xf591e0,_0x332c9d[_0x209c50(0x1f0)]+_0x209c50(0x1c8)),_0x2316cc=a150_0x5d2257[_0x209c50(0x15c)](_0xf591e0,_0x209c50(0x17e)),_0x18f8cd=a150_0x5d2257['join'](_0xf591e0,_0x209c50(0x14e));if(!a150_0x2ff9d8[_0x209c50(0x17b)](_0x385509)||!a150_0x2ff9d8[_0x209c50(0x17b)](_0x2316cc))continue;const _0x740566=parseExperimentalArtifactYaml(a150_0x2ff9d8[_0x209c50(0xfc)](_0x385509,'utf-8'),_0x385509),_0x4b738a=a150_0x2ff9d8[_0x209c50(0xfc)](_0x2316cc,_0x209c50(0x13b)),_0x23ece5=[];if(a150_0x2ff9d8[_0x209c50(0x17b)](_0x18f8cd)){const _0x332e6f=a150_0x2ff9d8[_0x209c50(0xe1)](_0x18f8cd);for(const _0x2e9ecc of _0x332e6f){const _0x49615d=a150_0x5d2257[_0x209c50(0x15c)](_0x18f8cd,_0x2e9ecc);a150_0x2ff9d8[_0x209c50(0x1e5)](_0x49615d)['isFile']()&&_0x23ece5[_0x209c50(0x129)]({'file_name':_0x2e9ecc,'text_content':a150_0x2ff9d8[_0x209c50(0xfc)](_0x49615d,_0x209c50(0x13b))});}}const _0x3d6e73={..._0x740566,'code':_0x4b738a,'files':_0x23ece5};_0x3725c6[_0x209c50(0x129)]({'name':_0x740566[_0x209c50(0x1f0)],'dir':_0xf591e0,'def':_0x3d6e73});}}const _0x5f08a8=[],_0x564e41=getFormInterfacesDir(_0x14a5fb);if(a150_0x2ff9d8[_0x209c50(0x17b)](_0x564e41)){const _0x3df632=a150_0x2ff9d8['readdirSync'](_0x564e41)[_0x209c50(0x17a)](_0x4ad44c=>_0x4ad44c[_0x209c50(0x1b5)]('.yml'));for(const _0x1cf8ec of _0x3df632){const _0x4e8d1a=a150_0x5d2257[_0x209c50(0x15c)](_0x564e41,_0x1cf8ec),_0x29208e=parseFormInterfaceYaml(a150_0x2ff9d8['readFileSync'](_0x4e8d1a,_0x209c50(0x13b)),_0x4e8d1a);_0x5f08a8['push']({'name':_0x29208e[_0x209c50(0x1f0)],'path':_0x4e8d1a,'yaml':_0x29208e});}}const _0x49a568=[],_0x1ea467=getChatInterfacesDir(_0x14a5fb);if(a150_0x2ff9d8['existsSync'](_0x1ea467)){const _0x5a9e3f=a150_0x2ff9d8[_0x209c50(0xe1)](_0x1ea467)[_0x209c50(0x17a)](_0x56269f=>_0x56269f[_0x209c50(0x1b5)](_0x209c50(0x1c8)));for(const _0x5f4b29 of _0x5a9e3f){const _0x597fbe=a150_0x5d2257[_0x209c50(0x15c)](_0x1ea467,_0x5f4b29),_0x161e0e=parseChatInterfaceYaml(a150_0x2ff9d8[_0x209c50(0xfc)](_0x597fbe,_0x209c50(0x13b)),_0x597fbe);_0x49a568[_0x209c50(0x129)]({'name':_0x161e0e['name'],'path':_0x597fbe,'yaml':_0x161e0e});}}const _0x5a540f=await this['client'][_0x209c50(0x168)](_0x1aaa10),_0x11a901=await this[_0x209c50(0x1c6)][_0x209c50(0xf9)](_0x1aaa10),_0x5d46ae=await this[_0x209c50(0x1c6)]['listTextKnowledgeBases'](_0x1aaa10),_0x2e7850=await this[_0x209c50(0x1c6)][_0x209c50(0x10b)](_0x1aaa10),_0xf809d1=await this[_0x209c50(0x1c6)][_0x209c50(0x177)](_0x1aaa10),_0x56e403=await safeListOrEmpty(()=>this[_0x209c50(0x1c6)][_0x209c50(0x1cc)](_0x1aaa10)),_0x796610=await safeListOrEmpty(()=>this['client'][_0x209c50(0x1af)](_0x1aaa10)),_0x309bec=await safeListOrEmpty(()=>this[_0x209c50(0x1c6)]['listFormInterfaces'](_0x1aaa10)),_0x4f03c0=await safeListOrEmpty(()=>this[_0x209c50(0x1c6)]['listChatInterfaces'](_0x1aaa10)),_0x7e9b24=await fetchAllToolTargetMaps((_0x2a64df,_0x5111a9)=>this[_0x209c50(0x1c6)][_0x209c50(0x1db)](_0x2a64df,_0x5111a9),_0x1aaa10),_0x16fe2d=new Map(),_0xedaef2=new Map(),_0x3b8f9d=new Map(),_0x506b29=new Map(),_0x32e9c7=new Map(),_0x1cf531=new Map(),_0x559fe9=new Map();for(const _0x4d072d of _0x5a540f){_0x16fe2d[_0x209c50(0xeb)](_0x4d072d[_0x209c50(0x196)][_0x209c50(0x1f0)],_0x4d072d);}for(const _0x210169 of _0x11a901){_0xedaef2[_0x209c50(0xeb)](_0x210169[_0x209c50(0x196)][_0x209c50(0x1f0)],_0x210169);}for(const _0x4dd175 of _0x5d46ae){_0x3b8f9d['set'](_0x4dd175[_0x209c50(0x196)]['name'],_0x4dd175);}for(const _0x50ecde of _0x2e7850){_0x506b29[_0x209c50(0xeb)](_0x50ecde[_0x209c50(0x196)][_0x209c50(0x1f0)],_0x50ecde);}for(const _0x32b81d of _0xf809d1){_0x32e9c7[_0x209c50(0xeb)](_0x32b81d[_0x209c50(0x196)][_0x209c50(0x11a)]['toLowerCase'](),_0x32b81d);}for(const _0x178a95 of _0x56e403){_0x1cf531[_0x209c50(0xeb)](_0x178a95['attributes'][_0x209c50(0x1f0)],_0x178a95);}for(const _0x2ad327 of _0x796610){_0x559fe9[_0x209c50(0xeb)](_0x2ad327[_0x209c50(0x196)][_0x209c50(0x1f0)],_0x2ad327);}const _0x4d6fc6=new Map(),_0x518771=new Map();for(const _0x2b9682 of _0x309bec){_0x4d6fc6[_0x209c50(0xeb)](_0x2b9682[_0x209c50(0x196)][_0x209c50(0x1f0)],_0x2b9682);}for(const _0x367883 of _0x4f03c0){_0x518771[_0x209c50(0xeb)](_0x367883[_0x209c50(0x196)]['name'],_0x367883);}const _0x3d316f=new Map(),_0x4eb68a=new Map();for(const _0x5c228d of _0x5a540f){_0x3d316f[_0x209c50(0xeb)](_0x5c228d[_0x209c50(0x196)]['name'],_0x5c228d['id']),_0x4eb68a['set'](_0x5c228d['id'],_0x5c228d[_0x209c50(0x196)][_0x209c50(0x1f0)]);}const _0x4a387c=new Map(),_0x502c31=new Map();for(const _0x29cddd of _0x2e7850){_0x4a387c[_0x209c50(0xeb)](_0x29cddd['attributes']['name'],_0x29cddd['id']),_0x502c31[_0x209c50(0xeb)](_0x29cddd['id'],_0x29cddd[_0x209c50(0x196)][_0x209c50(0x1f0)]);}const _0x5a5496=_0x7e9b24[_0x209c50(0x192)]['KnowledgeBase']||new Map(),_0x48ba48=_0x7e9b24['nameToId'][_0x209c50(0x1a7)]||new Map(),_0xae27e2=_0x7e9b24[_0x209c50(0x192)]['ExperimentalKnowledgeBase']||new Map(),_0x48eb67=new Map(),_0x196d84={'resolveToolTargetName':buildNameResolver({..._0x7e9b24[_0x209c50(0x198)],'Agent':_0x4eb68a}),'resolvePromptName':async _0x42fb5b=>_0x502c31[_0x209c50(0x15e)](_0x42fb5b),'onWarning':_0x3a860e=>this[_0x209c50(0x1ad)]['warn'](_0x3a860e)};let _0x2af349=[];const _0x2bf6ca={'projectId':_0x1aaa10,'resolveToolTargetId':buildIdResolver({..._0x7e9b24[_0x209c50(0x192)],'Agent':_0x3d316f}),'resolvePromptId':async _0x1252b7=>_0x4a387c[_0x209c50(0x15e)](_0x1252b7),'onWarning':_0x4fdd65=>{const _0x4c764d=_0x209c50;this[_0x4c764d(0x1ad)][_0x4c764d(0x1a5)](_0x4fdd65),_0x2af349['push'](_0x4fdd65);}},{resolved:_0x5da9ec,unresolved:_0x58a3eb}=resolveAgentDependencies(_0x3afcb0,new Set(_0x16fe2d[_0x209c50(0x18f)]()));for(const {agent:_0x9b3e31,missingDeps:_0x38edd8}of _0x58a3eb){_0x5e137c[_0x209c50(0x1c7)]['push']({'agentName':_0x9b3e31[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x137),'error':'Unresolved\x20dependencies:\x20'+_0x38edd8['join'](',\x20')+_0x209c50(0x15f)}),_0x5e137c[_0x209c50(0x18d)]['agents'][_0x209c50(0x14d)]++;}for(const _0x1971c6 of _0x102e96){const _0x1e07a1=_0xedaef2['get'](_0x1971c6['yaml']['name']),_0x3d6f9b=a150_0x2ff9d8[_0x209c50(0xfc)](_0x1971c6['path'],'utf-8');if(_0x1e07a1){const _0x2b4aa8=apiKnowledgeBaseToYaml(_0x1e07a1),_0x5313ab=toKnowledgeBaseYamlString(_0x2b4aa8),_0x356dda=generateDiff(_0x5313ab,_0x3d6f9b),_0x51cdca=hasChanges(_0x356dda);_0x51cdca?(_0x5e137c['knowledgeBases'][_0x209c50(0x129)]({'name':_0x1971c6[_0x209c50(0x10d)]['name'],'action':_0x209c50(0xe6),'id':_0x1e07a1['id'],'diff':formatDiffWithColors(_0x356dda)}),_0x5e137c['counts'][_0x209c50(0x15d)][_0x209c50(0xe6)]++):(_0x5e137c['knowledgeBases'][_0x209c50(0x129)]({'name':_0x1971c6[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x11c),'id':_0x1e07a1['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x15d)][_0x209c50(0x11c)]++);}else _0x5e137c[_0x209c50(0x15d)]['push']({'name':_0x1971c6[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x165)}),_0x5e137c['counts'][_0x209c50(0x15d)]['created']++;}for(const _0x6f17a of _0x6a99cd){const _0x1571ad=_0x3b8f9d['get'](_0x6f17a[_0x209c50(0x1f0)]),_0x18c4b5=a150_0x2ff9d8['readFileSync'](_0x6f17a[_0x209c50(0x195)],_0x209c50(0x13b));if(_0x1571ad){const _0x248b61=toTextKnowledgeBaseMd(_0x1571ad[_0x209c50(0x196)][_0x209c50(0x1f0)],_0x1571ad[_0x209c50(0x196)][_0x209c50(0x10f)]),_0x3b006d=generateDiff(_0x248b61,_0x18c4b5),_0x4acbfa=hasChanges(_0x3b006d);_0x4acbfa?(_0x5e137c[_0x209c50(0x1ae)][_0x209c50(0x129)]({'name':_0x6f17a[_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x1571ad['id'],'diff':formatDiffWithColors(_0x3b006d)}),_0x5e137c['counts'][_0x209c50(0x1ae)][_0x209c50(0xe6)]++):(_0x5e137c[_0x209c50(0x1ae)][_0x209c50(0x129)]({'name':_0x6f17a[_0x209c50(0x1f0)],'action':_0x209c50(0x11c),'id':_0x1571ad['id']}),_0x5e137c['counts'][_0x209c50(0x1ae)][_0x209c50(0x11c)]++);}else _0x5e137c[_0x209c50(0x1ae)][_0x209c50(0x129)]({'name':_0x6f17a[_0x209c50(0x1f0)],'action':'created'}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1ae)][_0x209c50(0x165)]++;}for(const _0x5bdf35 of _0x5da9ec){const _0x16771b=_0x16fe2d[_0x209c50(0x15e)](_0x5bdf35['yaml']['name']),_0x2acdb6=a150_0x5d2257[_0x209c50(0x15c)](_0x5bdf35[_0x209c50(0x112)],_0x209c50(0xe4)),_0x5c8372=a150_0x2ff9d8['readFileSync'](_0x2acdb6,_0x209c50(0x13b)),_0x570ca7=_0x5bdf35[_0x209c50(0x1d0)],_0x49c1dc=_0x209c50(0x1f2)+_0x570ca7+_0x209c50(0x114)+_0x5c8372;if(_0x16771b){const {yaml:_0x46b34b,systemPrompt:_0x1a3eb3}=await agentResponseToDef(_0x16771b,_0x196d84),_0x4ed2f5=toAgentYamlString(_0x46b34b),_0xc4c6e6='#\x20prompt.md\x0a'+_0x1a3eb3+'\x0a\x0a#\x20agent.yml\x0a'+_0x4ed2f5,_0xfbde04=generateDiff(_0xc4c6e6,_0x49c1dc),_0x6e54f=hasChanges(_0xfbde04);_0x6e54f?(_0x5e137c[_0x209c50(0x1c7)][_0x209c50(0x129)]({'agentName':_0x5bdf35['yaml']['name'],'action':_0x209c50(0xe6),'agentId':_0x16771b['id'],'diff':formatDiffWithColors(_0xfbde04)}),_0x5e137c['counts']['agents']['updated']++):(_0x5e137c['agents']['push']({'agentName':_0x5bdf35['yaml'][_0x209c50(0x1f0)],'action':_0x209c50(0x11c),'agentId':_0x16771b['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1c7)]['unchanged']++);}else _0x5e137c[_0x209c50(0x1c7)][_0x209c50(0x129)]({'agentName':_0x5bdf35[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':'created'}),_0x5e137c['counts']['agents'][_0x209c50(0x165)]++;}for(const _0xc0f31 of _0x1598b3){const _0x1e7042=_0x506b29['get'](_0xc0f31['yaml']['name']),_0x28762c=a150_0x2ff9d8['readFileSync'](_0xc0f31['path'],_0x209c50(0x13b));if(_0x1e7042){const _0x34fe25=await apiPromptToYaml(_0x1e7042,_0x196d84);if(!_0x34fe25){_0x5e137c[_0x209c50(0x187)][_0x209c50(0x129)]({'name':_0xc0f31[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x1e7042['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x187)][_0x209c50(0xe6)]++;continue;}const _0x24fe27=toPromptYamlString(_0x34fe25),_0x55228b=generateDiff(_0x24fe27,_0x28762c),_0x205153=hasChanges(_0x55228b);_0x205153?(_0x5e137c[_0x209c50(0x187)]['push']({'name':_0xc0f31[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':'updated','id':_0x1e7042['id'],'diff':formatDiffWithColors(_0x55228b)}),_0x5e137c['counts'][_0x209c50(0x187)][_0x209c50(0xe6)]++):(_0x5e137c['prompts']['push']({'name':_0xc0f31[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x11c),'id':_0x1e7042['id']}),_0x5e137c[_0x209c50(0x18d)]['prompts']['unchanged']++);}else _0x5e137c['prompts'][_0x209c50(0x129)]({'name':_0xc0f31[_0x209c50(0x10d)]['name'],'action':_0x209c50(0x165)}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x187)]['created']++;}for(const _0x3b61f2 of _0x279c2e){const _0x4ab453=_0x32e9c7['get'](_0x3b61f2['yaml'][_0x209c50(0x12c)]),_0x1b8d18=a150_0x2ff9d8['readFileSync'](_0x3b61f2[_0x209c50(0x195)],_0x209c50(0x13b));if(_0x4ab453){const _0x4b98ed=await apiIntegrationToYaml(_0x4ab453,_0x196d84),_0x286402=toIntegrationYamlString(_0x4b98ed),_0xdca269=generateDiff(_0x286402,_0x1b8d18),_0x27415a=hasChanges(_0xdca269);_0x27415a?(_0x5e137c[_0x209c50(0xf8)][_0x209c50(0x129)]({'name':_0x3b61f2['yaml'][_0x209c50(0x12c)],'action':_0x209c50(0xe6),'id':_0x4ab453['id'],'diff':formatDiffWithColors(_0xdca269)}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0xf8)][_0x209c50(0xe6)]++):(_0x5e137c['integrations'][_0x209c50(0x129)]({'name':_0x3b61f2['yaml'][_0x209c50(0x12c)],'action':_0x209c50(0x11c),'id':_0x4ab453['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0xf8)]['unchanged']++);}else _0x5e137c['integrations'][_0x209c50(0x129)]({'name':_0x3b61f2[_0x209c50(0x10d)]['service_type'],'action':'created'}),_0x5e137c['counts'][_0x209c50(0xf8)][_0x209c50(0x165)]++;}for(const _0x2cfa45 of _0x17d08a){const _0x3b7bcd=_0x1cf531['get'](_0x2cfa45[_0x209c50(0x169)][_0x209c50(0x1f0)]),_0x4aff12=toExperimentalKnowledgeBaseYamlString(_0x2cfa45[_0x209c50(0x169)]);let _0x59279f=_0x4aff12;for(const _0x2b43d5 of _0x2cfa45[_0x209c50(0x169)][_0x209c50(0x180)]){_0x59279f+=_0x209c50(0x16e)+_0x2b43d5['name']+'\x20---\x0a'+_0x2b43d5[_0x209c50(0x148)]+'\x0a---\x20schema:\x20'+_0x2b43d5[_0x209c50(0x1f0)]+_0x209c50(0x144)+_0x2b43d5[_0x209c50(0x125)]+'\x0a';}if(_0x3b7bcd){const _0x312a4d=apiExperimentalKnowledgeBaseToYaml(_0x3b7bcd),_0x17cc4b=toExperimentalKnowledgeBaseYamlString(_0x312a4d);let _0x1b7bda=_0x17cc4b;for(const _0x1e2470 of _0x312a4d['functions']){_0x1b7bda+='\x0a---\x20function:\x20'+_0x1e2470[_0x209c50(0x1f0)]+_0x209c50(0x144)+_0x1e2470[_0x209c50(0x148)]+'\x0a---\x20schema:\x20'+_0x1e2470['name']+_0x209c50(0x144)+_0x1e2470['json_schema']+'\x0a';}const _0x1030a8=generateDiff(_0x1b7bda,_0x59279f),_0x1ff612=hasChanges(_0x1030a8);_0x1ff612?(_0x5e137c[_0x209c50(0x19a)][_0x209c50(0x129)]({'name':_0x2cfa45['def'][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x3b7bcd['id'],'diff':formatDiffWithColors(_0x1030a8)}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x19a)]['updated']++):(_0x5e137c[_0x209c50(0x19a)][_0x209c50(0x129)]({'name':_0x2cfa45[_0x209c50(0x169)][_0x209c50(0x1f0)],'action':_0x209c50(0x11c),'id':_0x3b7bcd['id']}),_0x5e137c['counts'][_0x209c50(0x19a)][_0x209c50(0x11c)]++);}else _0x5e137c[_0x209c50(0x19a)][_0x209c50(0x129)]({'name':_0x2cfa45['def']['name'],'action':_0x209c50(0x165)}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x19a)][_0x209c50(0x165)]++;}for(const _0x17a373 of _0x3725c6){const _0x32ea69=_0x559fe9['get'](_0x17a373[_0x209c50(0x169)]['name']),_0x4bf85c=toExperimentalArtifactYamlString(_0x17a373[_0x209c50(0x169)]);let _0x4d6ddd=_0x4bf85c+(_0x209c50(0x1d8)+_0x17a373[_0x209c50(0x169)][_0x209c50(0x148)]+'\x0a');for(const _0x1d91ee of _0x17a373[_0x209c50(0x169)][_0x209c50(0x14e)]){_0x4d6ddd+=_0x209c50(0x1f8)+_0x1d91ee[_0x209c50(0x123)]+_0x209c50(0x144)+_0x1d91ee[_0x209c50(0x181)]+'\x0a';}if(_0x32ea69){const _0x412477=apiExperimentalArtifactToYaml(_0x32ea69),_0x16d4a7=toExperimentalArtifactYamlString(_0x412477);let _0x45087a=_0x16d4a7+('\x0a---\x20code\x20---\x0a'+_0x412477[_0x209c50(0x148)]+'\x0a');for(const _0x173132 of _0x412477[_0x209c50(0x14e)]){_0x45087a+=_0x209c50(0x1f8)+_0x173132[_0x209c50(0x123)]+_0x209c50(0x144)+_0x173132[_0x209c50(0x181)]+'\x0a';}const _0x24510f=generateDiff(_0x45087a,_0x4d6ddd),_0x12b39c=hasChanges(_0x24510f);_0x12b39c?(_0x5e137c[_0x209c50(0x1f9)]['push']({'name':_0x17a373['def'][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x32ea69['id'],'diff':formatDiffWithColors(_0x24510f)}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1f9)][_0x209c50(0xe6)]++):(_0x5e137c[_0x209c50(0x1f9)][_0x209c50(0x129)]({'name':_0x17a373[_0x209c50(0x169)][_0x209c50(0x1f0)],'action':_0x209c50(0x11c),'id':_0x32ea69['id']}),_0x5e137c[_0x209c50(0x18d)]['experimentalArtifacts'][_0x209c50(0x11c)]++);}else _0x5e137c[_0x209c50(0x1f9)]['push']({'name':_0x17a373['def'][_0x209c50(0x1f0)],'action':_0x209c50(0x165)}),_0x5e137c['counts']['experimentalArtifacts'][_0x209c50(0x165)]++;}for(const _0x254959 of _0x5f08a8){const _0x1614ee=_0x4d6fc6[_0x209c50(0x15e)](_0x254959[_0x209c50(0x10d)][_0x209c50(0x1f0)]),_0x14ab25=a150_0x2ff9d8[_0x209c50(0xfc)](_0x254959[_0x209c50(0x195)],_0x209c50(0x13b));if(_0x1614ee){const _0x35fc78=await apiFormInterfaceToYaml(_0x1614ee,_0x196d84),_0x27acd7=toFormInterfaceYamlString(_0x35fc78),_0x33ff8d=generateDiff(_0x27acd7,_0x14ab25),_0x5428c0=hasChanges(_0x33ff8d);_0x5428c0?(_0x5e137c[_0x209c50(0x1d4)][_0x209c50(0x129)]({'name':_0x254959[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x1614ee['id'],'diff':formatDiffWithColors(_0x33ff8d)}),_0x5e137c[_0x209c50(0x18d)]['formInterfaces'][_0x209c50(0xe6)]++):(_0x5e137c[_0x209c50(0x1d4)]['push']({'name':_0x254959['yaml'][_0x209c50(0x1f0)],'action':'unchanged','id':_0x1614ee['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1d4)]['unchanged']++);}else _0x5e137c[_0x209c50(0x1d4)]['push']({'name':_0x254959[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x165)}),_0x5e137c['counts'][_0x209c50(0x1d4)][_0x209c50(0x165)]++;}for(const _0x5a703a of _0x49a568){const _0xd3b91c=_0x518771['get'](_0x5a703a['yaml'][_0x209c50(0x1f0)]),_0x4e6c73=a150_0x2ff9d8['readFileSync'](_0x5a703a[_0x209c50(0x195)],_0x209c50(0x13b));if(_0xd3b91c){const _0x4a653=await apiChatInterfaceToYaml(_0xd3b91c,_0x196d84),_0x429c91=toChatInterfaceYamlString(_0x4a653),_0xb0b754=generateDiff(_0x429c91,_0x4e6c73),_0x708c24=hasChanges(_0xb0b754);_0x708c24?(_0x5e137c[_0x209c50(0x1df)][_0x209c50(0x129)]({'name':_0x5a703a[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0xd3b91c['id'],'diff':formatDiffWithColors(_0xb0b754)}),_0x5e137c[_0x209c50(0x18d)]['chatInterfaces'][_0x209c50(0xe6)]++):(_0x5e137c[_0x209c50(0x1df)][_0x209c50(0x129)]({'name':_0x5a703a['yaml'][_0x209c50(0x1f0)],'action':_0x209c50(0x11c),'id':_0xd3b91c['id']}),_0x5e137c[_0x209c50(0x18d)]['chatInterfaces']['unchanged']++);}else _0x5e137c['chatInterfaces'][_0x209c50(0x129)]({'name':_0x5a703a['yaml'][_0x209c50(0x1f0)],'action':_0x209c50(0x165)}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1df)]['created']++;}if(_0x32a8df?.['dryRun'])return _0x5e137c;_0x5e137c[_0x209c50(0x15d)]=[],_0x5e137c[_0x209c50(0x1ae)]=[],_0x5e137c[_0x209c50(0x187)]=[],_0x5e137c['integrations']=[],_0x5e137c[_0x209c50(0x19a)]=[],_0x5e137c[_0x209c50(0x1f9)]=[],_0x5e137c[_0x209c50(0x1d4)]=[],_0x5e137c[_0x209c50(0x1df)]=[];const _0x30ed12=_0x5e137c['agents'][_0x209c50(0x17a)](_0x585e19=>_0x585e19['action']===_0x209c50(0x137));_0x5e137c[_0x209c50(0x1c7)]=_0x30ed12,_0x5e137c['counts']={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x30ed12[_0x209c50(0x1f5)]},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x132a26 of _0x102e96){try{const _0x3d0ed5=_0xedaef2[_0x209c50(0x15e)](_0x132a26[_0x209c50(0x10d)][_0x209c50(0x1f0)]),_0x5a3a31=yamlKnowledgeBaseToApi(_0x132a26[_0x209c50(0x10d)],_0x1aaa10);if(_0x3d0ed5)await this[_0x209c50(0x1c6)][_0x209c50(0x1e0)](_0x3d0ed5['id'],_0x5a3a31),_0x5a5496['set'](_0x132a26[_0x209c50(0x10d)][_0x209c50(0x1f0)],_0x3d0ed5['id']),_0x5e137c[_0x209c50(0x15d)][_0x209c50(0x129)]({'name':_0x132a26[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x3d0ed5['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x15d)][_0x209c50(0xe6)]++;else{const _0x3b9c43=await this[_0x209c50(0x1c6)][_0x209c50(0x16b)](_0x5a3a31);_0x5a5496['set'](_0x132a26[_0x209c50(0x10d)][_0x209c50(0x1f0)],_0x3b9c43['id']),_0x5e137c['knowledgeBases'][_0x209c50(0x129)]({'name':_0x132a26[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x165),'id':_0x3b9c43['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x15d)][_0x209c50(0x165)]++;}}catch(_0x561164){_0x5e137c[_0x209c50(0x15d)][_0x209c50(0x129)]({'name':_0x132a26[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':'error','error':_0x561164[_0x209c50(0xe2)]}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x15d)][_0x209c50(0x14d)]++;}}for(const _0x372d16 of _0x6a99cd){try{const _0x4d7159=_0x3b8f9d['get'](_0x372d16[_0x209c50(0x1f0)]),_0xf77ff0=yamlTextKnowledgeBaseToApi({'name':_0x372d16['name'],'text':_0x372d16[_0x209c50(0x10f)]},_0x1aaa10);if(_0x4d7159)await this['client'][_0x209c50(0x134)](_0x4d7159['id'],_0xf77ff0),_0x48ba48['set'](_0x372d16['name'],_0x4d7159['id']),_0x5e137c['textKnowledgeBases'][_0x209c50(0x129)]({'name':_0x372d16[_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x4d7159['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1ae)]['updated']++;else{const _0x1c3a2d=await this[_0x209c50(0x1c6)][_0x209c50(0x156)](_0xf77ff0);_0x48ba48['set'](_0x372d16[_0x209c50(0x1f0)],_0x1c3a2d['id']),_0x5e137c['textKnowledgeBases'][_0x209c50(0x129)]({'name':_0x372d16[_0x209c50(0x1f0)],'action':'created','id':_0x1c3a2d['id']}),_0x5e137c['counts'][_0x209c50(0x1ae)][_0x209c50(0x165)]++;}}catch(_0x324b69){_0x5e137c[_0x209c50(0x1ae)][_0x209c50(0x129)]({'name':_0x372d16['name'],'action':'error','error':_0x324b69[_0x209c50(0xe2)]}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1ae)][_0x209c50(0x14d)]++;}}for(const _0x54b3fa of _0x17d08a){try{const _0x6b3c18=_0x1cf531[_0x209c50(0x15e)](_0x54b3fa['def']['name']),_0x28c5bf=yamlExperimentalKnowledgeBaseToApi(_0x54b3fa[_0x209c50(0x169)],_0x1aaa10);if(_0x6b3c18)await this[_0x209c50(0x1c6)][_0x209c50(0x12b)](_0x6b3c18['id'],_0x28c5bf),_0xae27e2[_0x209c50(0xeb)](_0x54b3fa[_0x209c50(0x169)]['name'],_0x6b3c18['id']),_0x5e137c['experimentalKnowledgeBases'][_0x209c50(0x129)]({'name':_0x54b3fa[_0x209c50(0x169)][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x6b3c18['id']}),_0x5e137c['counts'][_0x209c50(0x19a)][_0x209c50(0xe6)]++;else{const _0x441ddd=await this[_0x209c50(0x1c6)][_0x209c50(0x182)](_0x28c5bf);_0xae27e2[_0x209c50(0xeb)](_0x54b3fa[_0x209c50(0x169)][_0x209c50(0x1f0)],_0x441ddd['id']),_0x5e137c['experimentalKnowledgeBases'][_0x209c50(0x129)]({'name':_0x54b3fa[_0x209c50(0x169)][_0x209c50(0x1f0)],'action':_0x209c50(0x165),'id':_0x441ddd['id']}),_0x5e137c['counts'][_0x209c50(0x19a)][_0x209c50(0x165)]++;}}catch(_0x59f9a3){_0x5e137c[_0x209c50(0x19a)][_0x209c50(0x129)]({'name':_0x54b3fa[_0x209c50(0x169)][_0x209c50(0x1f0)],'action':_0x209c50(0x137),'error':_0x59f9a3[_0x209c50(0xe2)]}),_0x5e137c[_0x209c50(0x18d)]['experimentalKnowledgeBases']['errors']++;}}for(const _0x1783b5 of _0x3725c6){try{const _0x38e782=_0x559fe9['get'](_0x1783b5['def'][_0x209c50(0x1f0)]),_0x43d2e9=yamlExperimentalArtifactToApi(_0x1783b5[_0x209c50(0x169)],_0x1aaa10);if(_0x38e782)await this[_0x209c50(0x1c6)][_0x209c50(0x1fd)](_0x38e782['id'],_0x43d2e9),_0x48eb67[_0x209c50(0xeb)](_0x1783b5[_0x209c50(0x169)][_0x209c50(0x1f0)],_0x38e782['id']),_0x5e137c[_0x209c50(0x1f9)][_0x209c50(0x129)]({'name':_0x1783b5[_0x209c50(0x169)][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x38e782['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1f9)][_0x209c50(0xe6)]++;else{const _0x56ce28=await this[_0x209c50(0x1c6)][_0x209c50(0x183)](_0x43d2e9);_0x48eb67[_0x209c50(0xeb)](_0x1783b5['def']['name'],_0x56ce28['id']),_0x5e137c[_0x209c50(0x1f9)][_0x209c50(0x129)]({'name':_0x1783b5['def'][_0x209c50(0x1f0)],'action':_0x209c50(0x165),'id':_0x56ce28['id']}),_0x5e137c['counts'][_0x209c50(0x1f9)][_0x209c50(0x165)]++;}}catch(_0x59f341){_0x5e137c['experimentalArtifacts'][_0x209c50(0x129)]({'name':_0x1783b5[_0x209c50(0x169)][_0x209c50(0x1f0)],'action':_0x209c50(0x137),'error':_0x59f341[_0x209c50(0xe2)]}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1f9)]['errors']++;}}for(const _0x260b36 of _0x5da9ec){_0x2af349=[];try{const _0x64bed7=_0x16fe2d[_0x209c50(0x15e)](_0x260b36[_0x209c50(0x10d)][_0x209c50(0x1f0)]),_0x39c980=await agentDefToRequest(_0x260b36[_0x209c50(0x10d)],_0x260b36[_0x209c50(0x1d0)],_0x260b36[_0x209c50(0x1b1)],_0x2bf6ca);if(_0x64bed7)await this[_0x209c50(0x1c6)][_0x209c50(0xef)](_0x64bed7['id'],_0x39c980),_0x3d316f[_0x209c50(0xeb)](_0x260b36[_0x209c50(0x10d)]['name'],_0x64bed7['id']),_0x5e137c['agents'][_0x209c50(0x129)]({'agentName':_0x260b36['yaml'][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'agentId':_0x64bed7['id'],'warnings':_0x2af349['length']>0x0?_0x2af349:undefined}),_0x5e137c[_0x209c50(0x18d)]['agents'][_0x209c50(0xe6)]++;else{const _0x1f9194=await this[_0x209c50(0x1c6)][_0x209c50(0x18e)](_0x39c980);_0x3d316f['set'](_0x260b36[_0x209c50(0x10d)][_0x209c50(0x1f0)],_0x1f9194['id']),_0x5e137c[_0x209c50(0x1c7)][_0x209c50(0x129)]({'agentName':_0x260b36[_0x209c50(0x10d)]['name'],'action':_0x209c50(0x165),'agentId':_0x1f9194['id'],'warnings':_0x2af349['length']>0x0?_0x2af349:undefined}),_0x5e137c['counts'][_0x209c50(0x1c7)][_0x209c50(0x165)]++;}}catch(_0x2c6a80){_0x5e137c[_0x209c50(0x1c7)][_0x209c50(0x129)]({'agentName':_0x260b36[_0x209c50(0x10d)]['name'],'action':'error','error':_0x2c6a80['message'],'warnings':_0x2af349[_0x209c50(0x1f5)]>0x0?_0x2af349:undefined}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1c7)][_0x209c50(0x14d)]++;}}for(const _0x3c4f2a of _0x1598b3){try{const _0x33aa86=_0x506b29[_0x209c50(0x15e)](_0x3c4f2a[_0x209c50(0x10d)][_0x209c50(0x1f0)]),_0x5e51c3=await yamlPromptToApi(_0x3c4f2a['yaml'],_0x1aaa10,_0x2bf6ca);if(!_0x5e51c3){_0x5e137c[_0x209c50(0x187)][_0x209c50(0x129)]({'name':_0x3c4f2a[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':'error','error':_0x209c50(0xf4)}),_0x5e137c[_0x209c50(0x18d)]['prompts'][_0x209c50(0x14d)]++;continue;}if(_0x33aa86)await this[_0x209c50(0x1c6)][_0x209c50(0x13d)](_0x33aa86['id'],_0x5e51c3),_0x4a387c['set'](_0x3c4f2a['yaml'][_0x209c50(0x1f0)],_0x33aa86['id']),_0x5e137c[_0x209c50(0x187)]['push']({'name':_0x3c4f2a[_0x209c50(0x10d)]['name'],'action':_0x209c50(0xe6),'id':_0x33aa86['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x187)]['updated']++;else{const _0x2b5502=await this[_0x209c50(0x1c6)]['createPrompt'](_0x5e51c3);_0x4a387c[_0x209c50(0xeb)](_0x3c4f2a['yaml'][_0x209c50(0x1f0)],_0x2b5502['id']),_0x5e137c[_0x209c50(0x187)][_0x209c50(0x129)]({'name':_0x3c4f2a['yaml'][_0x209c50(0x1f0)],'action':_0x209c50(0x165),'id':_0x2b5502['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x187)][_0x209c50(0x165)]++;}}catch(_0x5559c){_0x5e137c[_0x209c50(0x187)][_0x209c50(0x129)]({'name':_0x3c4f2a['yaml']['name'],'action':_0x209c50(0x137),'error':_0x5559c[_0x209c50(0xe2)]}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x187)][_0x209c50(0x14d)]++;}}for(const _0xa40417 of _0x279c2e){try{const _0x49a00b=_0x32e9c7[_0x209c50(0x15e)](_0xa40417[_0x209c50(0x10d)][_0x209c50(0x12c)]),_0x3e7474=await yamlIntegrationToApi(_0xa40417['yaml'],_0x1aaa10,_0x2bf6ca);if(_0x49a00b){await this[_0x209c50(0x1c6)][_0x209c50(0x184)](_0x49a00b['id']);const _0x4d847e=await this[_0x209c50(0x1c6)][_0x209c50(0x113)](_0x3e7474);_0x5e137c['integrations'][_0x209c50(0x129)]({'name':_0xa40417['yaml']['service_type'],'action':'updated','id':_0x4d847e['id']}),_0x5e137c['counts'][_0x209c50(0xf8)][_0x209c50(0xe6)]++;}else{const _0x3749fb=await this[_0x209c50(0x1c6)][_0x209c50(0x113)](_0x3e7474);_0x5e137c[_0x209c50(0xf8)][_0x209c50(0x129)]({'name':_0xa40417[_0x209c50(0x10d)][_0x209c50(0x12c)],'action':_0x209c50(0x165),'id':_0x3749fb['id']}),_0x5e137c[_0x209c50(0x18d)]['integrations'][_0x209c50(0x165)]++;}}catch(_0x9bba11){_0x5e137c[_0x209c50(0xf8)][_0x209c50(0x129)]({'name':_0xa40417[_0x209c50(0x10d)][_0x209c50(0x12c)],'action':'error','error':_0x9bba11[_0x209c50(0xe2)]}),_0x5e137c[_0x209c50(0x18d)]['integrations']['errors']++;}}for(const _0x37661d of _0x5f08a8){try{const _0x5b2c81=_0x4d6fc6[_0x209c50(0x15e)](_0x37661d['yaml']['name']),_0x1fc19a=await yamlFormInterfaceToApi(_0x37661d['yaml'],_0x1aaa10,_0x2bf6ca);if(!_0x1fc19a){_0x5e137c[_0x209c50(0x1d4)][_0x209c50(0x129)]({'name':_0x37661d[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x137),'error':'Could\x20not\x20resolve\x20agent\x20reference'}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1d4)][_0x209c50(0x14d)]++;continue;}if(_0x5b2c81){const _0x49933e=await this[_0x209c50(0x1c6)]['updateFormInterface'](_0x5b2c81['id'],_0x1fc19a);_0x5e137c[_0x209c50(0x1d4)][_0x209c50(0x129)]({'name':_0x37661d[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x49933e['id']}),_0x5e137c[_0x209c50(0x18d)]['formInterfaces']['updated']++;}else{const _0x1a176e=await this[_0x209c50(0x1c6)][_0x209c50(0x17d)](_0x1fc19a);_0x5e137c[_0x209c50(0x1d4)][_0x209c50(0x129)]({'name':_0x37661d[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x165),'id':_0x1a176e['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1d4)]['created']++;}}catch(_0x840b6d){_0x5e137c[_0x209c50(0x1d4)][_0x209c50(0x129)]({'name':_0x37661d['yaml']['name'],'action':'error','error':_0x840b6d['message']}),_0x5e137c['counts'][_0x209c50(0x1d4)][_0x209c50(0x14d)]++;}}for(const _0x4a5b5c of _0x49a568){try{const _0x390ff5=_0x518771[_0x209c50(0x15e)](_0x4a5b5c[_0x209c50(0x10d)]['name']),_0x18d4ca=await yamlChatInterfaceToApi(_0x4a5b5c[_0x209c50(0x10d)],_0x1aaa10,_0x2bf6ca);if(_0x390ff5){const _0x5756b4=await this[_0x209c50(0x1c6)][_0x209c50(0x1de)](_0x390ff5['id'],_0x18d4ca);_0x5e137c[_0x209c50(0x1df)][_0x209c50(0x129)]({'name':_0x4a5b5c[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0xe6),'id':_0x5756b4['id']}),_0x5e137c['counts'][_0x209c50(0x1df)][_0x209c50(0xe6)]++;}else{const _0x2cfd26=await this[_0x209c50(0x1c6)][_0x209c50(0x142)](_0x18d4ca);_0x5e137c[_0x209c50(0x1df)][_0x209c50(0x129)]({'name':_0x4a5b5c[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x165),'id':_0x2cfd26['id']}),_0x5e137c[_0x209c50(0x18d)][_0x209c50(0x1df)][_0x209c50(0x165)]++;}}catch(_0x543ecc){_0x5e137c[_0x209c50(0x1df)]['push']({'name':_0x4a5b5c[_0x209c50(0x10d)][_0x209c50(0x1f0)],'action':_0x209c50(0x137),'error':_0x543ecc[_0x209c50(0xe2)]}),_0x5e137c[_0x209c50(0x18d)]['chatInterfaces'][_0x209c50(0x14d)]++;}}return _0x5e137c;}async[a150_0x594e97(0x1a0)](_0x55e2db,_0x4c77e1,_0x34f35c,_0x1102e7){const _0x18205a=a150_0x594e97,{projectId:_0x1b7ec6,project:_0x4dafc2}=await this[_0x18205a(0x110)](_0x55e2db),_0xcbb9db=_0x4dafc2[_0x18205a(0x196)][_0x18205a(0x1f0)],_0x89f26f=await this[_0x18205a(0x1c6)][_0x18205a(0x168)](_0x1b7ec6),_0x5f1ece=_0x89f26f['find'](_0x367748=>_0x367748['attributes'][_0x18205a(0x1f0)]===_0x4c77e1);if(!_0x5f1ece)throw new SDKError(ErrorCode[_0x18205a(0x107)],'Agent\x20not\x20found:\x20'+_0x4c77e1,undefined,{'helpText':_0x18205a(0x185)+_0x89f26f[_0x18205a(0x1b8)](_0x3dfae7=>_0x3dfae7[_0x18205a(0x196)][_0x18205a(0x1f0)])['join'](',\x20')});let _0x5e4ca0;if(_0x34f35c)_0x5e4ca0=_0x34f35c;else{const _0x1ff822=a150_0x5d2257[_0x18205a(0x15c)](process[_0x18205a(0x136)](),_0x18205a(0x1c7)),_0x41ca24=getSanitizedPathWithMigration(_0x1ff822,_0xcbb9db);_0x41ca24[_0x18205a(0x1c3)]&&this[_0x18205a(0x1ad)]['info'](_0x18205a(0x12f)+a150_0x5d2257[_0x18205a(0x1b4)](_0x41ca24[_0x18205a(0x1e3)])+'\x20→\x20'+a150_0x5d2257['basename'](_0x41ca24[_0x18205a(0x195)])),_0x5e4ca0=_0x41ca24['path'];}const _0x79363b=getSanitizedPathWithMigration(_0x5e4ca0,_0x4c77e1);_0x79363b[_0x18205a(0x1c3)]&&this['logger'][_0x18205a(0xee)](_0x18205a(0x138)+a150_0x5d2257[_0x18205a(0x1b4)](_0x79363b[_0x18205a(0x1e3)])+_0x18205a(0x1bf)+a150_0x5d2257[_0x18205a(0x1b4)](_0x79363b[_0x18205a(0x195)]));const _0x327c92=_0x79363b[_0x18205a(0x195)],_0x54d70d=new Map(),_0x903c7=new Map(),_0xa07864=await this['client'][_0x18205a(0xf9)](_0x1b7ec6),_0x9c9365=await this[_0x18205a(0x1c6)][_0x18205a(0x16a)](_0x1b7ec6),_0x67a0a6=await safeListOrEmpty(()=>this[_0x18205a(0x1c6)][_0x18205a(0x1cc)](_0x1b7ec6)),_0x22262e=new Map(),_0x56ffb=new Map();for(const _0x1eaf78 of _0xa07864){_0x54d70d[_0x18205a(0xeb)](_0x1eaf78['id'],_0x1eaf78[_0x18205a(0x196)][_0x18205a(0x1f0)]);}for(const _0x563fee of _0x9c9365){_0x22262e[_0x18205a(0xeb)](_0x563fee['id'],_0x563fee[_0x18205a(0x196)][_0x18205a(0x1f0)]);}for(const _0x279515 of _0x67a0a6){_0x56ffb[_0x18205a(0xeb)](_0x279515['id'],_0x279515['attributes'][_0x18205a(0x1f0)]);}for(const _0x8ad939 of _0x89f26f){_0x903c7[_0x18205a(0xeb)](_0x8ad939['id'],_0x8ad939[_0x18205a(0x196)][_0x18205a(0x1f0)]);}const _0x19ac01={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x54d70d,'TextKnowledgeBase':_0x22262e,'Agent':_0x903c7,'ExperimentalKnowledgeBase':_0x56ffb}),'resolvePromptName':async()=>undefined,'onWarning':_0xf42dc7=>this[_0x18205a(0x1ad)][_0x18205a(0x1a5)](_0xf42dc7)},_0x33ccb8=a150_0x5d2257['join'](_0x327c92,_0x18205a(0x106)),_0x39a004=a150_0x5d2257[_0x18205a(0x15c)](_0x327c92,_0x18205a(0xe4)),_0x13edaf=a150_0x5d2257[_0x18205a(0x15c)](_0x327c92,_0x18205a(0x14f)),_0x5eccf0=!a150_0x2ff9d8[_0x18205a(0x17b)](_0x39a004);if(_0x1102e7?.['dryRun'])return{'agentName':_0x4c77e1,'outputPath':_0x327c92,'isNew':_0x5eccf0,'hasChanges':!![]};a150_0x2ff9d8[_0x18205a(0x13a)](_0x5e4ca0,{'recursive':!![]}),a150_0x2ff9d8['mkdirSync'](_0x327c92,{'recursive':!![]});const _0x3783e8=a150_0x5d2257['join'](_0x5e4ca0,_0x18205a(0x197));!a150_0x2ff9d8[_0x18205a(0x17b)](_0x3783e8)&&a150_0x2ff9d8['writeFileSync'](_0x3783e8,createAgentConfigContent(_0x55e2db));const {yaml:_0x50a805,systemPrompt:_0x5bf065,starterMessage:_0x5d183a}=await agentResponseToDef(_0x5f1ece,_0x19ac01);let _0x4fdd75=_0x5eccf0;if(!_0x5eccf0){const _0x5c64c6=a150_0x2ff9d8[_0x18205a(0x17b)](_0x33ccb8)?a150_0x2ff9d8[_0x18205a(0xfc)](_0x33ccb8,'utf-8'):'',_0x3ac773=a150_0x2ff9d8[_0x18205a(0xfc)](_0x39a004,_0x18205a(0x13b));_0x4fdd75=_0x5c64c6!==_0x5bf065||_0x3ac773!==toAgentYamlString(_0x50a805);}a150_0x2ff9d8[_0x18205a(0x1f7)](_0x33ccb8,_0x5bf065),a150_0x2ff9d8[_0x18205a(0x1f7)](_0x39a004,toAgentYamlString(_0x50a805));if(_0x5d183a&&_0x5d183a[_0x18205a(0x1dd)]('\x0a'))a150_0x2ff9d8[_0x18205a(0x1f7)](_0x13edaf,_0x5d183a);else a150_0x2ff9d8[_0x18205a(0x17b)](_0x13edaf)&&a150_0x2ff9d8[_0x18205a(0x121)](_0x13edaf);return{'agentName':_0x4c77e1,'outputPath':_0x327c92,'isNew':_0x5eccf0,'hasChanges':_0x4fdd75};}async[a150_0x594e97(0xe3)](_0x343471,_0xa5f44d){const _0x157084=a150_0x594e97;let _0xd3812f;isAgentYamlPath(_0x343471)?_0xd3812f=getAgentDirFromYamlPath(_0x343471):_0xd3812f=_0x343471;const {config:_0x2ebce5}=findAgentConfig(_0xd3812f),_0x24c479=await this['resolveProjectId'](_0x2ebce5[_0x157084(0x1ab)]),_0x24066c=a150_0x5d2257[_0x157084(0x15c)](_0xd3812f,_0x157084(0xe4)),_0xede49e=a150_0x5d2257[_0x157084(0x15c)](_0xd3812f,_0x157084(0x106)),_0x4d358b=a150_0x5d2257[_0x157084(0x15c)](_0xd3812f,_0x157084(0x14f));if(!a150_0x2ff9d8['existsSync'](_0x24066c))throw new SDKError(ErrorCode['NOT_FOUND'],_0x157084(0x1b0)+_0xd3812f,undefined,{'helpText':_0x157084(0x1ef)});const _0x579776=parseAgentYaml(a150_0x2ff9d8[_0x157084(0xfc)](_0x24066c,_0x157084(0x13b)),_0x24066c),_0x232624=a150_0x2ff9d8[_0x157084(0x17b)](_0xede49e)?a150_0x2ff9d8[_0x157084(0xfc)](_0xede49e,_0x157084(0x13b)):'',_0x511621=a150_0x2ff9d8[_0x157084(0x17b)](_0x4d358b)?a150_0x2ff9d8[_0x157084(0xfc)](_0x4d358b,'utf-8'):_0x579776[_0x157084(0x12e)];if(_0xa5f44d?.['dryRun'])return{'agentName':_0x579776[_0x157084(0x1f0)],'action':'created','projectId':_0x24c479};const _0x50a16f=await this[_0x157084(0x1c6)]['listAgentsFull'](_0x24c479),_0x65bf20=await fetchAllToolTargetMaps((_0x2c396a,_0x2d8723)=>this['client']['listToolTargets'](_0x2c396a,_0x2d8723),_0x24c479),_0xc0c60d=new Map();for(const _0x3a66df of _0x50a16f){_0xc0c60d[_0x157084(0xeb)](_0x3a66df[_0x157084(0x196)][_0x157084(0x1f0)],_0x3a66df['id']);}const _0x7e0a7a=[],_0x155733={'projectId':_0x24c479,'resolveToolTargetId':buildIdResolver({..._0x65bf20[_0x157084(0x192)],'Agent':_0xc0c60d}),'resolvePromptId':async()=>undefined,'onWarning':_0x286d15=>{const _0x551821=_0x157084;this['logger'][_0x551821(0x1a5)](_0x286d15),_0x7e0a7a['push'](_0x286d15);}};try{const _0x5ef43d=_0x50a16f[_0x157084(0x1c5)](_0x57b572=>_0x57b572['attributes'][_0x157084(0x1f0)]===_0x579776[_0x157084(0x1f0)]),_0x21e26c=await agentDefToRequest(_0x579776,_0x232624,_0x511621,_0x155733);if(_0x5ef43d)return await this['client'][_0x157084(0xef)](_0x5ef43d['id'],_0x21e26c),{'agentName':_0x579776[_0x157084(0x1f0)],'action':_0x157084(0xe6),'projectId':_0x24c479,'agentId':_0x5ef43d['id'],'warnings':_0x7e0a7a[_0x157084(0x1f5)]>0x0?_0x7e0a7a:undefined};else{const _0x75fb96=await this[_0x157084(0x1c6)][_0x157084(0x18e)](_0x21e26c);return{'agentName':_0x579776[_0x157084(0x1f0)],'action':_0x157084(0x165),'projectId':_0x24c479,'agentId':_0x75fb96['id'],'warnings':_0x7e0a7a[_0x157084(0x1f5)]>0x0?_0x7e0a7a:undefined};}}catch(_0x52be86){return{'agentName':_0x579776[_0x157084(0x1f0)],'action':_0x157084(0x137),'projectId':_0x24c479,'error':_0x52be86['message'],'warnings':_0x7e0a7a['length']>0x0?_0x7e0a7a:undefined};}}async[a150_0x594e97(0x170)](_0x46f867,_0x47bcc3,_0x5da8e5){const _0x2c9b04=a150_0x594e97,_0xfa6701=a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x46f867)&&a150_0x2ff9d8[_0x2c9b04(0x17b)](a150_0x5d2257['join'](_0x46f867,'tdx.json'));let _0x32c49c;const _0x2e2fbb=[],_0x51d757=[],_0x15bc86=[],_0x3eff38=[],_0x489a48=[],_0xd38b49=[],_0x50a324=[],_0x3a770b=[],_0x92ad46=[];if(_0xfa6701){const _0xb915c7=loadAgentConfig(a150_0x5d2257[_0x2c9b04(0x15c)](_0x46f867,_0x2c9b04(0x197)));_0x32c49c=_0xb915c7[_0x2c9b04(0x1ab)];const _0x1f2f7a=a150_0x2ff9d8[_0x2c9b04(0xe1)](_0x46f867,{'withFileTypes':!![]});for(const _0x2f5ecd of _0x1f2f7a){if(!_0x2f5ecd[_0x2c9b04(0xf1)]())continue;if([_0x2c9b04(0x1ba),_0x2c9b04(0x1be),_0x2c9b04(0x1ec),_0x2c9b04(0x187),_0x2c9b04(0xf8),_0x2c9b04(0xe7),_0x2c9b04(0x1f4)]['includes'](_0x2f5ecd[_0x2c9b04(0x1f0)]))continue;const _0x16ed18=a150_0x5d2257[_0x2c9b04(0x15c)](_0x46f867,_0x2f5ecd['name']);if(isAgentDir(_0x16ed18)){const _0x47a709=a150_0x5d2257[_0x2c9b04(0x15c)](_0x16ed18,'agent.yml'),_0x4b4bfd=a150_0x5d2257[_0x2c9b04(0x15c)](_0x16ed18,_0x2c9b04(0x106)),_0x1a30ae=a150_0x5d2257[_0x2c9b04(0x15c)](_0x16ed18,'starter_message.md'),_0x2b6ccf=parseAgentYaml(a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x47a709,_0x2c9b04(0x13b)),_0x47a709),_0x4992fa=a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x4b4bfd)?a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x4b4bfd,'utf-8'):'',_0x909d87=a150_0x2ff9d8['existsSync'](_0x1a30ae)?a150_0x2ff9d8['readFileSync'](_0x1a30ae,_0x2c9b04(0x13b)):_0x2b6ccf['starter_message'];_0x2e2fbb[_0x2c9b04(0x129)]({'name':_0x2b6ccf[_0x2c9b04(0x1f0)],'dir':_0x16ed18,'yaml':_0x2b6ccf,'systemPrompt':_0x4992fa,'starterMessage':_0x909d87});}}const _0x5987a8=getKnowledgeBasesDir(_0x46f867);if(a150_0x2ff9d8['existsSync'](_0x5987a8)){const _0x38d48f=a150_0x2ff9d8['readdirSync'](_0x5987a8);for(const _0x9b6aef of _0x38d48f){const _0x42f5e7=a150_0x5d2257[_0x2c9b04(0x15c)](_0x5987a8,_0x9b6aef);if(_0x9b6aef['endsWith'](_0x2c9b04(0x1c8))){const _0x5ad94f=parseKnowledgeBaseYaml(a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x42f5e7,_0x2c9b04(0x13b)),_0x42f5e7);_0x51d757['push']({'name':_0x5ad94f[_0x2c9b04(0x1f0)],'path':_0x42f5e7,'yaml':_0x5ad94f});}else{if(_0x9b6aef['endsWith'](_0x2c9b04(0x1c0))){const _0x579e4c=a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x42f5e7,_0x2c9b04(0x13b)),{name:_0x59e683,text:_0x56732a}=parseTextKnowledgeBaseMd(_0x579e4c,_0x9b6aef);_0x15bc86['push']({'name':_0x59e683,'path':_0x42f5e7,'text':_0x56732a});}}}}const _0x45c9b6=getPromptsDir(_0x46f867);if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x45c9b6)){const _0x2dd154=a150_0x2ff9d8[_0x2c9b04(0xe1)](_0x45c9b6)[_0x2c9b04(0x17a)](_0x1a9c60=>_0x1a9c60[_0x2c9b04(0x1b5)](_0x2c9b04(0x1c8)));for(const _0x1ad136 of _0x2dd154){const _0xbc616=a150_0x5d2257[_0x2c9b04(0x15c)](_0x45c9b6,_0x1ad136),_0x309c06=parsePromptYaml(a150_0x2ff9d8[_0x2c9b04(0xfc)](_0xbc616,'utf-8'),_0xbc616);_0x3eff38[_0x2c9b04(0x129)]({'name':_0x309c06[_0x2c9b04(0x1f0)],'path':_0xbc616,'yaml':_0x309c06});}}const _0x251364=getIntegrationsDir(_0x46f867);if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x251364)){const _0x27022a=a150_0x2ff9d8[_0x2c9b04(0xe1)](_0x251364)[_0x2c9b04(0x17a)](_0xec0205=>_0xec0205['endsWith'](_0x2c9b04(0x1c8)));for(const _0xccf1c5 of _0x27022a){const _0x298636=a150_0x5d2257[_0x2c9b04(0x15c)](_0x251364,_0xccf1c5),_0x3cc4f2=parseIntegrationYaml(a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x298636,'utf-8'),_0x298636);SAFE_INTEGRATION_TYPES[_0x2c9b04(0x1dd)](_0x3cc4f2[_0x2c9b04(0x12c)]['toLowerCase']())?_0x489a48[_0x2c9b04(0x129)]({'name':_0x3cc4f2[_0x2c9b04(0x1f0)],'path':_0x298636,'yaml':_0x3cc4f2}):this[_0x2c9b04(0x1ad)][_0x2c9b04(0x1a5)]('Skipping\x20integration\x20\x27'+_0x3cc4f2[_0x2c9b04(0x1f0)]+_0x2c9b04(0x145)+_0x3cc4f2[_0x2c9b04(0x12c)]+'):\x20'+(_0x2c9b04(0x139)+SAFE_INTEGRATION_TYPES[_0x2c9b04(0x15c)](',\x20')+_0x2c9b04(0x155)));}}const _0x39e31e=getExperimentalKnowledgeBasesDir(_0x46f867);if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x39e31e)){const _0x332d35=a150_0x2ff9d8[_0x2c9b04(0xe1)](_0x39e31e,{'withFileTypes':!![]});for(const _0x375da6 of _0x332d35){if(!_0x375da6['isDirectory']())continue;const _0x18ddfa=a150_0x5d2257['join'](_0x39e31e,_0x375da6[_0x2c9b04(0x1f0)]),_0x2bb0ab=a150_0x5d2257[_0x2c9b04(0x15c)](_0x18ddfa,_0x375da6[_0x2c9b04(0x1f0)]+_0x2c9b04(0x1c8));if(a150_0x2ff9d8['existsSync'](_0x2bb0ab)){const _0x4e20e3=parseExperimentalKnowledgeBaseYaml(a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x2bb0ab,_0x2c9b04(0x13b)),_0x2bb0ab),_0x483c8a=a150_0x5d2257[_0x2c9b04(0x15c)](_0x18ddfa,_0x2c9b04(0x180)),_0x30b926=[];if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x483c8a)){const _0x38f006=a150_0x2ff9d8[_0x2c9b04(0xe1)](_0x483c8a,{'withFileTypes':!![]});for(const _0x5a1143 of _0x38f006){if(!_0x5a1143[_0x2c9b04(0xf1)]())continue;const _0x511b88=a150_0x5d2257['join'](_0x483c8a,_0x5a1143['name']),_0x1fd858=a150_0x5d2257[_0x2c9b04(0x15c)](_0x511b88,_0x2c9b04(0x17e)),_0x2e9ee9=a150_0x5d2257[_0x2c9b04(0x15c)](_0x511b88,_0x2c9b04(0xe8));if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x1fd858)&&a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x2e9ee9)){const _0x3e831f=a150_0x2ff9d8['readFileSync'](_0x1fd858,_0x2c9b04(0x13b)),_0x5c9060=a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x2e9ee9,_0x2c9b04(0x13b));_0x30b926['push']({'name':_0x5a1143[_0x2c9b04(0x1f0)],'code':_0x3e831f,'json_schema':_0x5c9060});}}}const _0x5661c3={..._0x4e20e3,'functions':_0x30b926};_0xd38b49[_0x2c9b04(0x129)]({'name':_0x4e20e3[_0x2c9b04(0x1f0)],'path':_0x18ddfa,'def':_0x5661c3});}}}const _0x3d0904=getExperimentalArtifactsDir(_0x46f867);if(a150_0x2ff9d8['existsSync'](_0x3d0904)){const _0x2233ef=a150_0x2ff9d8[_0x2c9b04(0xe1)](_0x3d0904,{'withFileTypes':!![]});for(const _0x5d96c8 of _0x2233ef){if(!_0x5d96c8[_0x2c9b04(0xf1)]())continue;const _0x255f61=a150_0x5d2257[_0x2c9b04(0x15c)](_0x3d0904,_0x5d96c8[_0x2c9b04(0x1f0)]),_0x2f7742=a150_0x5d2257[_0x2c9b04(0x15c)](_0x255f61,_0x5d96c8[_0x2c9b04(0x1f0)]+_0x2c9b04(0x1c8));if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x2f7742)){const _0x34a877=parseExperimentalArtifactYaml(a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x2f7742,'utf-8'),_0x2f7742),_0x14ede3=a150_0x5d2257[_0x2c9b04(0x15c)](_0x255f61,'code.js'),_0x2439f3=a150_0x2ff9d8['existsSync'](_0x14ede3)?a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x14ede3,_0x2c9b04(0x13b)):'',_0x40f1e6=a150_0x5d2257[_0x2c9b04(0x15c)](_0x255f61,_0x2c9b04(0x14e)),_0x39dffc=[];if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x40f1e6)){const _0x373be4=a150_0x2ff9d8[_0x2c9b04(0xe1)](_0x40f1e6);for(const _0x2ca344 of _0x373be4){const _0x18caad=a150_0x5d2257[_0x2c9b04(0x15c)](_0x40f1e6,_0x2ca344);if(a150_0x2ff9d8[_0x2c9b04(0x1e5)](_0x18caad)[_0x2c9b04(0x122)]()){const _0x432c1b=a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x18caad,'utf-8');_0x39dffc[_0x2c9b04(0x129)]({'file_name':_0x2ca344,'text_content':_0x432c1b});}}}const _0x1fafa5={..._0x34a877,'code':_0x2439f3,'files':_0x39dffc};_0x50a324[_0x2c9b04(0x129)]({'name':_0x34a877[_0x2c9b04(0x1f0)],'path':_0x255f61,'def':_0x1fafa5});}}}const _0x152b8b=getFormInterfacesDir(_0x46f867);if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x152b8b)){const _0x2a2b86=a150_0x2ff9d8[_0x2c9b04(0xe1)](_0x152b8b)[_0x2c9b04(0x17a)](_0x4f9554=>_0x4f9554[_0x2c9b04(0x1b5)]('.yml'));for(const _0x29cb75 of _0x2a2b86){const _0x4be969=a150_0x5d2257[_0x2c9b04(0x15c)](_0x152b8b,_0x29cb75),_0x42030b=parseFormInterfaceYaml(a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x4be969,_0x2c9b04(0x13b)),_0x4be969);_0x3a770b[_0x2c9b04(0x129)]({'name':_0x42030b[_0x2c9b04(0x1f0)],'path':_0x4be969,'yaml':_0x42030b});}}const _0x5e297b=getChatInterfacesDir(_0x46f867);if(a150_0x2ff9d8[_0x2c9b04(0x17b)](_0x5e297b)){const _0x5c2698=a150_0x2ff9d8['readdirSync'](_0x5e297b)['filter'](_0x4bc98c=>_0x4bc98c[_0x2c9b04(0x1b5)](_0x2c9b04(0x1c8)));for(const _0x343265 of _0x5c2698){const _0x3d18ba=a150_0x5d2257[_0x2c9b04(0x15c)](_0x5e297b,_0x343265),_0x4bd912=parseChatInterfaceYaml(a150_0x2ff9d8[_0x2c9b04(0xfc)](_0x3d18ba,'utf-8'),_0x3d18ba);_0x92ad46['push']({'name':_0x4bd912[_0x2c9b04(0x1f0)],'path':_0x3d18ba,'yaml':_0x4bd912});}}}else{const _0x29c7da=await this[_0x2c9b04(0x133)](_0x46f867),_0x3a65aa=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x190)](_0x29c7da);_0x32c49c=_0x3a65aa[_0x2c9b04(0x196)][_0x2c9b04(0x1f0)];const _0x27c765=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x168)](_0x29c7da),_0x2075ac=await this['client']['listKnowledgeBases'](_0x29c7da),_0xc52df4=await this['client']['listTextKnowledgeBases'](_0x29c7da),_0x2cb829=await this['client']['listPrompts'](_0x29c7da),_0x281a29=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x177)](_0x29c7da),_0x319041=await safeListOrEmpty(()=>this[_0x2c9b04(0x1c6)][_0x2c9b04(0x1cc)](_0x29c7da)),_0x431739=await safeListOrEmpty(()=>this[_0x2c9b04(0x1c6)][_0x2c9b04(0x1af)](_0x29c7da)),_0x1ff5b8=new Map(),_0xb49eb6=new Map(),_0x5420d6=new Map(),_0x4e342a=new Map(),_0x1266cb=new Map(),_0x849b02=new Map();for(const _0x347096 of _0x2075ac){_0x1ff5b8[_0x2c9b04(0xeb)](_0x347096['id'],_0x347096['attributes'][_0x2c9b04(0x1f0)]);}for(const _0x4bdd8a of _0xc52df4){_0xb49eb6[_0x2c9b04(0xeb)](_0x4bdd8a['id'],_0x4bdd8a[_0x2c9b04(0x196)][_0x2c9b04(0x1f0)]);}for(const _0x19319a of _0x27c765){_0x5420d6['set'](_0x19319a['id'],_0x19319a[_0x2c9b04(0x196)][_0x2c9b04(0x1f0)]);}for(const _0x523fdf of _0x2cb829){_0x4e342a[_0x2c9b04(0xeb)](_0x523fdf['id'],_0x523fdf['attributes'][_0x2c9b04(0x1f0)]);}for(const _0x5f37c9 of _0x319041){_0x1266cb[_0x2c9b04(0xeb)](_0x5f37c9['id'],_0x5f37c9[_0x2c9b04(0x196)][_0x2c9b04(0x1f0)]);}for(const _0x2f37ee of _0x431739){_0x849b02[_0x2c9b04(0xeb)](_0x2f37ee['id'],_0x2f37ee[_0x2c9b04(0x196)][_0x2c9b04(0x1f0)]);}const _0x580ced={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x1ff5b8,'TextKnowledgeBase':_0xb49eb6,'Agent':_0x5420d6,'ExperimentalKnowledgeBase':_0x1266cb}),'resolvePromptName':async _0x1bd48f=>_0x4e342a['get'](_0x1bd48f),'onWarning':_0x2eaf9=>this[_0x2c9b04(0x1ad)][_0x2c9b04(0x1a5)](_0x2eaf9)};for(const _0x4352d4 of _0x27c765){const _0x5d6cc3=await agentResponseToDef(_0x4352d4,_0x580ced),{yaml:_0x43c3ea,systemPrompt:_0x498b38,starterMessage:_0x5886cb}=_0x5d6cc3;_0x2e2fbb[_0x2c9b04(0x129)]({'name':_0x43c3ea['name'],'dir':'','yaml':_0x43c3ea,'systemPrompt':_0x498b38,'starterMessage':_0x5886cb});}for(const _0x47b788 of _0x2075ac){const _0x54b932=apiKnowledgeBaseToYaml(_0x47b788);_0x51d757[_0x2c9b04(0x129)]({'name':_0x54b932[_0x2c9b04(0x1f0)],'path':'','yaml':_0x54b932});}for(const _0x122d88 of _0xc52df4){_0x15bc86[_0x2c9b04(0x129)]({'name':_0x122d88[_0x2c9b04(0x196)][_0x2c9b04(0x1f0)],'path':'','text':_0x122d88[_0x2c9b04(0x196)][_0x2c9b04(0x10f)]});}for(const _0x16507 of _0x2cb829){const _0x972b88=await apiPromptToYaml(_0x16507,_0x580ced);_0x972b88&&_0x3eff38['push']({'name':_0x972b88[_0x2c9b04(0x1f0)],'path':'','yaml':_0x972b88});}for(const _0x45442f of _0x281a29){if(!_0x45442f['attributes'][_0x2c9b04(0x1cf)]&&SAFE_INTEGRATION_TYPES[_0x2c9b04(0x1dd)](_0x45442f[_0x2c9b04(0x196)][_0x2c9b04(0x11a)][_0x2c9b04(0x10c)]())){const _0x26289e=await apiIntegrationToYaml(_0x45442f,_0x580ced);_0x489a48['push']({'name':_0x45442f[_0x2c9b04(0x196)][_0x2c9b04(0x11a)][_0x2c9b04(0x10c)](),'path':'','yaml':_0x26289e});}}for(const _0x80a341 of _0x319041){const _0x46f12a=apiExperimentalKnowledgeBaseToYaml(_0x80a341);_0xd38b49[_0x2c9b04(0x129)]({'name':_0x46f12a[_0x2c9b04(0x1f0)],'path':'','def':_0x46f12a});}for(const _0x268367 of _0x431739){const _0x332ed7=apiExperimentalArtifactToYaml(_0x268367);_0x50a324[_0x2c9b04(0x129)]({'name':_0x332ed7[_0x2c9b04(0x1f0)],'path':'','def':_0x332ed7});}const _0x485fb9=await safeListOrEmpty(()=>this['client']['listFormInterfaces'](_0x29c7da));for(const _0x565df7 of _0x485fb9){const _0x63d7dd=await apiFormInterfaceToYaml(_0x565df7,_0x580ced);_0x3a770b[_0x2c9b04(0x129)]({'name':_0x63d7dd[_0x2c9b04(0x1f0)],'path':'','yaml':_0x63d7dd});}const _0x113b4c=await safeListOrEmpty(()=>this[_0x2c9b04(0x1c6)][_0x2c9b04(0x1e2)](_0x29c7da));for(const _0x1ed224 of _0x113b4c){if(_0x1ed224[_0x2c9b04(0x196)][_0x2c9b04(0x1cf)])continue;const _0x3d0fc7=await apiChatInterfaceToYaml(_0x1ed224,_0x580ced);_0x92ad46[_0x2c9b04(0x129)]({'name':_0x3d0fc7['name'],'path':'','yaml':_0x3d0fc7});}}const _0x3672f9={'sourceProjectName':_0x32c49c,'newProjectName':_0x47bcc3,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'imageGenerators':{'created':0x0,'errors':0x0},'webSearchTools':{'created':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'errors':0x0}}},_0x2e4408=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x1b7)](),_0xfe84f7=_0x2e4408[_0x2c9b04(0x1c5)](_0x43f9b=>_0x43f9b[_0x2c9b04(0x196)][_0x2c9b04(0x1f0)]===_0x47bcc3);if(_0xfe84f7)throw new SDKError(ErrorCode['ALREADY_EXISTS'],_0x2c9b04(0x1e7)+_0x47bcc3+_0x2c9b04(0x11d),undefined,{'helpText':_0x2c9b04(0x1fe)});if(_0x5da8e5?.[_0x2c9b04(0x150)])return _0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x1c7)][_0x2c9b04(0x165)]=_0x2e2fbb['length'],_0x3672f9[_0x2c9b04(0x18d)]['knowledgeBases'][_0x2c9b04(0x165)]=_0x51d757[_0x2c9b04(0x1f5)],_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x1ae)][_0x2c9b04(0x165)]=_0x15bc86[_0x2c9b04(0x1f5)],_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x19a)]['created']=_0xd38b49[_0x2c9b04(0x1f5)],_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x1f9)][_0x2c9b04(0x165)]=_0x50a324[_0x2c9b04(0x1f5)],_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x187)]['created']=_0x3eff38[_0x2c9b04(0x1f5)],_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0xf8)][_0x2c9b04(0x165)]=_0x489a48['length'],_0x3672f9;const _0x116931=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0xfe)]({'name':_0x47bcc3}),_0x42556f=_0x116931['id'];_0x3672f9[_0x2c9b04(0x120)]=_0x42556f;const _0x3f0d0a=new Map(),_0xaa4d51=new Map(),_0x5ca989=new Map(),_0x4f824d=new Map(),_0x238428=new Map(),_0x27ecf9=new Map(),_0x4aa33c=new Map(),_0xf25e99=new Map(),_0x50201e=new Set(),_0x188358=new Set();for(const _0x293b6b of _0x2e2fbb){for(const _0x43c3ec of _0x293b6b['yaml'][_0x2c9b04(0x19b)]||[]){if(_0x43c3ec[_0x2c9b04(0x162)]==='image_gen'&&_0x43c3ec[_0x2c9b04(0x163)]){const _0x6e4239=parseRef(_0x43c3ec['target']);if(_0x6e4239)_0x50201e[_0x2c9b04(0x158)](_0x6e4239['name']);}else{if(_0x43c3ec[_0x2c9b04(0x162)]==='web_search'&&_0x43c3ec[_0x2c9b04(0x163)]){const _0x290321=parseRef(_0x43c3ec[_0x2c9b04(0x163)]);if(_0x290321)_0x188358[_0x2c9b04(0x158)](_0x290321[_0x2c9b04(0x1f0)]);}}}}for(const _0x279504 of _0x50201e){try{const _0x334b64=await this[_0x2c9b04(0x1c6)]['createImageGenerator']({'projectId':_0x42556f,'name':_0x279504});_0x238428[_0x2c9b04(0xeb)](_0x279504,_0x334b64['id']),_0x3672f9['imageGenerators'][_0x2c9b04(0x129)]({'name':_0x279504,'action':'created','id':_0x334b64['id']}),_0x3672f9['counts'][_0x2c9b04(0x151)][_0x2c9b04(0x165)]++;}catch(_0x455847){_0x3672f9['imageGenerators']['push']({'name':_0x279504,'action':_0x2c9b04(0x137),'error':_0x455847[_0x2c9b04(0xe2)]}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x151)][_0x2c9b04(0x14d)]++;}}for(const _0x29c229 of _0x188358){try{const _0x441da5=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x111)]({'projectId':_0x42556f,'name':_0x29c229});_0x27ecf9[_0x2c9b04(0xeb)](_0x29c229,_0x441da5['id']),_0x3672f9[_0x2c9b04(0x16f)][_0x2c9b04(0x129)]({'name':_0x29c229,'action':_0x2c9b04(0x165),'id':_0x441da5['id']}),_0x3672f9[_0x2c9b04(0x18d)]['webSearchTools'][_0x2c9b04(0x165)]++;}catch(_0x381dfd){_0x3672f9[_0x2c9b04(0x16f)][_0x2c9b04(0x129)]({'name':_0x29c229,'action':'error','error':_0x381dfd[_0x2c9b04(0xe2)]}),_0x3672f9['counts'][_0x2c9b04(0x16f)][_0x2c9b04(0x14d)]++;}}const _0x260b46=await fetchAllToolTargetMaps((_0x1c1b99,_0x17bdbd)=>this[_0x2c9b04(0x1c6)]['listToolTargets'](_0x1c1b99,_0x17bdbd),_0x42556f);let _0x45d014=[];const _0x489605={'projectId':_0x42556f,'resolveToolTargetId':buildIdResolver({..._0x260b46[_0x2c9b04(0x192)],'KnowledgeBase':_0x3f0d0a,'TextKnowledgeBase':_0xaa4d51,'ExperimentalKnowledgeBase':_0x4aa33c,'Agent':_0x5ca989,'WebSearchTool':_0x27ecf9,'ImageGenerator':_0x238428}),'resolvePromptId':async _0x6eafe2=>_0x4f824d[_0x2c9b04(0x15e)](_0x6eafe2),'onWarning':_0x5a8180=>{const _0x12d83d=_0x2c9b04;this[_0x12d83d(0x1ad)][_0x12d83d(0x1a5)](_0x5a8180),_0x45d014[_0x12d83d(0x129)](_0x5a8180);}};for(const _0x1b1f66 of _0x51d757){try{const _0x34d710=yamlKnowledgeBaseToApi(_0x1b1f66['yaml'],_0x42556f),_0x390a09=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x16b)](_0x34d710);_0x3f0d0a[_0x2c9b04(0xeb)](_0x1b1f66[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],_0x390a09['id']),_0x3672f9['knowledgeBases']['push']({'name':_0x1b1f66['yaml'][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x165),'id':_0x390a09['id']}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x15d)][_0x2c9b04(0x165)]++;}catch(_0xaf73dd){_0x3672f9['knowledgeBases'][_0x2c9b04(0x129)]({'name':_0x1b1f66['yaml'][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x137),'error':_0xaf73dd[_0x2c9b04(0xe2)]}),_0x3672f9['counts'][_0x2c9b04(0x15d)][_0x2c9b04(0x14d)]++;}}for(const _0x42ac95 of _0x15bc86){try{const _0x1efd1a=yamlTextKnowledgeBaseToApi({'name':_0x42ac95[_0x2c9b04(0x1f0)],'text':_0x42ac95[_0x2c9b04(0x10f)]},_0x42556f),_0x15d33a=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x156)](_0x1efd1a);_0xaa4d51['set'](_0x42ac95[_0x2c9b04(0x1f0)],_0x15d33a['id']),_0x3672f9[_0x2c9b04(0x1ae)][_0x2c9b04(0x129)]({'name':_0x42ac95['name'],'action':'created','id':_0x15d33a['id']}),_0x3672f9['counts'][_0x2c9b04(0x1ae)]['created']++;}catch(_0x5a451f){_0x3672f9[_0x2c9b04(0x1ae)][_0x2c9b04(0x129)]({'name':_0x42ac95[_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x137),'error':_0x5a451f[_0x2c9b04(0xe2)]}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x1ae)]['errors']++;}}for(const _0x2e0f25 of _0x50a324){try{const _0x7ad34b=yamlExperimentalArtifactToApi(_0x2e0f25[_0x2c9b04(0x169)],_0x42556f),_0x23075e=await this['client']['createExperimentalArtifact'](_0x7ad34b);_0xf25e99['set'](_0x2e0f25[_0x2c9b04(0x169)][_0x2c9b04(0x1f0)],_0x23075e['id']),_0x3672f9[_0x2c9b04(0x1f9)][_0x2c9b04(0x129)]({'name':_0x2e0f25[_0x2c9b04(0x169)][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x165),'id':_0x23075e['id']}),_0x3672f9[_0x2c9b04(0x18d)]['experimentalArtifacts'][_0x2c9b04(0x165)]++;}catch(_0x1a8878){_0x3672f9[_0x2c9b04(0x1f9)][_0x2c9b04(0x129)]({'name':_0x2e0f25[_0x2c9b04(0x169)]['name'],'action':'error','error':_0x1a8878[_0x2c9b04(0xe2)]}),_0x3672f9[_0x2c9b04(0x18d)]['experimentalArtifacts'][_0x2c9b04(0x14d)]++;}}for(const _0x60a45f of _0xd38b49){try{const _0x51d67b=yamlExperimentalKnowledgeBaseToApi(_0x60a45f['def'],_0x42556f),_0x5c7205=await this['client'][_0x2c9b04(0x182)](_0x51d67b);_0x4aa33c['set'](_0x60a45f['def'][_0x2c9b04(0x1f0)],_0x5c7205['id']),_0x3672f9[_0x2c9b04(0x19a)][_0x2c9b04(0x129)]({'name':_0x60a45f[_0x2c9b04(0x169)]['name'],'action':_0x2c9b04(0x165),'id':_0x5c7205['id']}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x19a)][_0x2c9b04(0x165)]++;}catch(_0xa693b1){_0x3672f9['experimentalKnowledgeBases'][_0x2c9b04(0x129)]({'name':_0x60a45f['def'][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x137),'error':_0xa693b1[_0x2c9b04(0xe2)]}),_0x3672f9[_0x2c9b04(0x18d)]['experimentalKnowledgeBases'][_0x2c9b04(0x14d)]++;}}const _0x160233=[..._0x2e2fbb][_0x2c9b04(0x1b3)]((_0x398f03,_0x1db46a)=>{const _0x19c8f8=_0x2c9b04,_0x57447b=_0x398f03[_0x19c8f8(0x10d)][_0x19c8f8(0x19b)]?.['some'](_0x3a3db0=>_0x3a3db0[_0x19c8f8(0x162)]===_0x19c8f8(0x15a))??![],_0x348e91=_0x1db46a['yaml'][_0x19c8f8(0x19b)]?.[_0x19c8f8(0x126)](_0x699e32=>_0x699e32[_0x19c8f8(0x162)]===_0x19c8f8(0x15a))??![];if(_0x57447b&&!_0x348e91)return 0x1;if(!_0x57447b&&_0x348e91)return-0x1;return 0x0;});for(const _0x3a29a6 of _0x160233){_0x45d014=[];try{const _0x50cb87=_0x3a29a6[_0x2c9b04(0x10d)][_0x2c9b04(0x19b)]?.[_0x2c9b04(0x17a)](_0x4282a3=>{const _0x1bdb62=_0x2c9b04;if(_0x4282a3[_0x1bdb62(0x162)]===_0x1bdb62(0x15a)&&_0x4282a3[_0x1bdb62(0x163)]){const _0x5500b6=parseRef(_0x4282a3[_0x1bdb62(0x163)]);return _0x5500b6?.[_0x1bdb62(0x1f0)]===_0x3a29a6['yaml']['name'];}return![];})??[];if(_0x50cb87['length']>0x0){const _0x2379aa=_0x2c9b04(0x13e)+_0x3a29a6[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)]+'\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20'+_0x2c9b04(0x164);this[_0x2c9b04(0x1ad)][_0x2c9b04(0x1a5)](_0x2379aa),_0x45d014[_0x2c9b04(0x129)](_0x2379aa);}const _0x22dda2=await agentDefToRequest(_0x3a29a6['yaml'],_0x3a29a6[_0x2c9b04(0x1d0)],_0x3a29a6[_0x2c9b04(0x1b1)],_0x489605),_0x4defb0=await this[_0x2c9b04(0x1c6)]['createAgentResponse'](_0x22dda2);_0x5ca989['set'](_0x3a29a6[_0x2c9b04(0x10d)]['name'],_0x4defb0['id']),_0x3672f9[_0x2c9b04(0x1c7)][_0x2c9b04(0x129)]({'agentName':_0x3a29a6[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x165),'agentId':_0x4defb0['id'],'warnings':_0x45d014[_0x2c9b04(0x1f5)]>0x0?_0x45d014:undefined}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x1c7)]['created']++;}catch(_0x3dde64){_0x3672f9[_0x2c9b04(0x1c7)][_0x2c9b04(0x129)]({'agentName':_0x3a29a6[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],'action':'error','error':_0x3dde64[_0x2c9b04(0xe2)],'warnings':_0x45d014[_0x2c9b04(0x1f5)]>0x0?_0x45d014:undefined}),_0x3672f9[_0x2c9b04(0x18d)]['agents'][_0x2c9b04(0x14d)]++;}}for(const _0x4752ba of _0x3eff38){try{const _0x4ec453=await yamlPromptToApi(_0x4752ba['yaml'],_0x42556f,_0x489605);if(!_0x4ec453){_0x3672f9[_0x2c9b04(0x187)][_0x2c9b04(0x129)]({'name':_0x4752ba[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],'action':'error','error':_0x2c9b04(0xf4)}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x187)][_0x2c9b04(0x14d)]++;continue;}const _0x55a70c=await this['client']['createPrompt'](_0x4ec453);_0x4f824d[_0x2c9b04(0xeb)](_0x4752ba[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],_0x55a70c['id']),_0x3672f9['prompts']['push']({'name':_0x4752ba[_0x2c9b04(0x10d)]['name'],'action':'created','id':_0x55a70c['id']}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x187)][_0x2c9b04(0x165)]++;}catch(_0x1ba811){_0x3672f9[_0x2c9b04(0x187)][_0x2c9b04(0x129)]({'name':_0x4752ba[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x137),'error':_0x1ba811[_0x2c9b04(0xe2)]}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x187)][_0x2c9b04(0x14d)]++;}}for(const _0xe93c6e of _0x489a48){try{const _0x11b544=await yamlIntegrationToApi(_0xe93c6e['yaml'],_0x42556f,_0x489605),_0x4e8c2e=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x113)](_0x11b544);_0x3672f9['integrations'][_0x2c9b04(0x129)]({'name':_0xe93c6e[_0x2c9b04(0x10d)]['service_type'],'action':_0x2c9b04(0x165),'id':_0x4e8c2e['id']}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0xf8)][_0x2c9b04(0x165)]++;}catch(_0x4c745a){_0x3672f9[_0x2c9b04(0xf8)][_0x2c9b04(0x129)]({'name':_0xe93c6e[_0x2c9b04(0x10d)][_0x2c9b04(0x12c)],'action':_0x2c9b04(0x137),'error':_0x4c745a[_0x2c9b04(0xe2)]}),_0x3672f9['counts'][_0x2c9b04(0xf8)]['errors']++;}}for(const _0x357def of _0x3a770b){try{const _0x121264=await yamlFormInterfaceToApi(_0x357def[_0x2c9b04(0x10d)],_0x42556f,_0x489605);if(!_0x121264){_0x3672f9[_0x2c9b04(0x1d4)]['push']({'name':_0x357def[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x137),'error':_0x2c9b04(0x143)}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x1d4)][_0x2c9b04(0x14d)]++;continue;}const _0x49b4a8=await this[_0x2c9b04(0x1c6)][_0x2c9b04(0x17d)](_0x121264);_0x3672f9['formInterfaces']['push']({'name':_0x357def['yaml'][_0x2c9b04(0x1f0)],'action':'created','id':_0x49b4a8['id']}),_0x3672f9[_0x2c9b04(0x18d)][_0x2c9b04(0x1d4)][_0x2c9b04(0x165)]++;}catch(_0x114415){_0x3672f9['formInterfaces']['push']({'name':_0x357def[_0x2c9b04(0x10d)]['name'],'action':'error','error':_0x114415[_0x2c9b04(0xe2)]}),_0x3672f9['counts'][_0x2c9b04(0x1d4)][_0x2c9b04(0x14d)]++;}}for(const _0x37f187 of _0x92ad46){try{const _0x5b38fd=await yamlChatInterfaceToApi(_0x37f187['yaml'],_0x42556f,_0x489605),_0x1e5c75=await this[_0x2c9b04(0x1c6)]['createChatInterface'](_0x5b38fd);_0x3672f9[_0x2c9b04(0x1df)][_0x2c9b04(0x129)]({'name':_0x37f187[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x165),'id':_0x1e5c75['id']}),_0x3672f9[_0x2c9b04(0x18d)]['chatInterfaces'][_0x2c9b04(0x165)]++;}catch(_0xd79d24){_0x3672f9[_0x2c9b04(0x1df)]['push']({'name':_0x37f187[_0x2c9b04(0x10d)][_0x2c9b04(0x1f0)],'action':_0x2c9b04(0x137),'error':_0xd79d24[_0x2c9b04(0xe2)]}),_0x3672f9['counts'][_0x2c9b04(0x1df)][_0x2c9b04(0x14d)]++;}}return _0x3672f9;}}
|
|
1
|
+
const a153_0x13235f=a153_0x1f4a;function a153_0x5823(){const _0x4c7e69=['unlinkSync','isFile','webhookCorsOrigins','1.0','\x27.\x20This\x20should\x20not\x20happen.','Authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key\x20is\x20valid\x20and\x20not\x20expired.','ALREADY_EXISTS','createKnowledgeBase','oldPath','site','add','\x0a---\x20schema:\x20','target','actions','Default\x20project\x20for\x20tdx\x20CLI\x20chat\x20(user:\x20','1746760mFsVxg','join','\x27\x20has\x20self-referencing\x20tool(s)\x20that\x20will\x20be\x20skipped\x20during\x20clone.\x20','info','updateTextKnowledgeBase','4MXnUjI','agentId','(dry-run)','Skipping\x20integration\x20\x27','ExperimentalKnowledgeBase','service_type','listFormInterfaces','serviceType','INVALID_ARGUMENT','stringify','updateAgentResponse','chatIgnoreManagedActions','parse','includes','The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.','text_content','map','listExperimentalKnowledgeBases','temperature','Use\x20format:\x20\x22agent-name\x22\x20or\x20\x22project-name/agent-name\x22','getChatLog','conflict','Only\x20safe\x20types\x20(','updateExperimentalKnowledgeBase','_reasoning_','starter_message.md','name','Renamed\x20form\x20interface\x20file:\x20','image_gen','context','11157545EzSEgp','action','text','updateKnowledgeBase','listExperimentalArtifacts','Output\x20directory\x20already\x20exists:\x20','agentsFull','8hdEhYl','form_interfaces','some','getDefaultProjectName','new','set','maxToolIterations','exportedFrom','tools','writeFileSync','getCurrentProject','#\x20prompt.md\x0a','listIntegrations','Renamed\x20chat\x20interface\x20file:\x20','\x20→\x20','INTERNAL','attributes','Use\x20a\x20different\x20output\x20path\x20or\x20remove\x20the\x20existing\x20directory.','readFileSync','.yml','listProjects','chatInfo','def','prompt.md','continueChat','history','KnowledgeBase','clearDefaultAgent','listAgentsFull','path','pushAgent','web_search','deleteAgent','errors','listToolTargets','textKnowledgeBases','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.','toLowerCase','Renamed\x20integration\x20file:\x20','tdx_default_','description','llm_project','getOrCreateDefaultAgent','pullAgent','backupProject','getChatInfo','warn','deleteIntegration','content','Multiple\x20agents\x20found\x20with\x20name\x20\x27','listPrompts','chat','createWebSearchTool','createImageGenerator','version','models','3358340ISyWgw','\x0a---\x20code\x20---\x0a','starterMessage','Invalid\x20backup:\x20project.json\x20not\x20found\x20in\x20','has','getChatHistory','No\x20tdx.json\x20found\x20in\x20','created','Renamed\x20KB\x20file:\x20','renamed','createTextKnowledgeBase','projectName','Multiple\x20projects\x20found\x20with\x20name\x20\x27','metadata','getBackupMetadata','4923558QjcrTw','Failed\x20to\x20get\x20or\x20create\x20agent:\x20exceeded\x20maximum\x20attempts','knowledge_bases','PERMISSION_DENIED','counts','.\x20Check\x20for\x20circular\x20references\x20or\x20missing\x20agents.','Ensure\x20this\x20is\x20a\x20valid\x20LLM\x20project\x20backup\x20folder.','Unable\x20to\x20create\x20project\x20after\x20','experimental_artifacts','unchanged','signal','client','AGENT_NOT_FOUND','variables','Project\x20not\x20found:\x20','291172xGZnFl','\x22\x20already\x20exists','agents','low','rmSync','69084sTVjiG','functions','agent','size','createAgent','listKnowledgeBases','json_schema','basename','7070MQuTMy','statSync','status','isDirectory','utf-8','NOT_FOUND','Ensure\x20the\x20path\x20points\x20to\x20a\x20valid\x20agent\x20directory.','Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.','resolveAgentId','files','updated','isManaged','logger','experimentalArtifacts','reasoningEffort','knowledgeBases','chatInterfaces','Removed\x20deleted\x20file:\x20','none','Choose\x20a\x20different\x20name\x20or\x20delete\x20the\x20existing\x20project\x20first.','tdx_','pullProject','createFormInterface','.md','push','listWebSearchTools','createIntegration','claude-4.5-sonnet','\x20attempts\x20due\x20to\x20name\x20conflicts.','yaml','chatWelcomeMessage','formInterfaces','cwd','startChat','Invalid\x20agent\x20reference\x20format:\x20','knowledgebases.json','createExperimentalArtifact','find','sort','\x20---\x0a','chat_generic','sdk.llm','Ensure\x20the\x20backup\x20folder\x20path\x20is\x20correct.','minimal','dirname','starter_message','Could\x20not\x20resolve\x20agent\x20reference','total','setDefaultAgent','deleteProject','createProject','listChatInterfaces','cloneProject','promptId','createPrompt','Agent\x20not\x20found:\x20','prompts','Run\x20\x27tdx\x20agent\x20pull\x20<project>\x27\x20first\x20to\x20create\x20the\x20folder\x20structure.','listTextKnowledgeBases','getProject','newProjectId','listAgents','Circular\x20dependency\x20detected\x20in\x20agents.\x20Cannot\x20restore.','getDefaultAgent','keys','project','getAgent','listImageGenerators','resolveProjectId','Unresolved\x20dependencies:\x20','.llm','prompts.json','code.js','agents.json','createExperimentalKnowledgeBase','Renamed\x20experimental\x20KB\x20directory:\x20','filter','LLM_PROJECT_NOT_FOUND','\x0a---\x20function:\x20','mkdirSync','message','updateAgent','outputs','Renamed\x20agent\x20folder:\x20','getOrCreateDefaultProject','projectId','---\x20file:\x20','length','error','profile','Backup\x20folder\x20not\x20found:\x20','integrations','webSearchTools','Removed\x20deleted\x20directory:\x20','Agent\x20reference\x20not\x20found','high',')\x20can\x20be\x20cloned.','agent.yml','nameToId','Use\x20\x22tdx\x20llm\x20agents\x22\x20to\x20list\x20available\x20agents\x20in\x20the\x20current\x20project.','dir','localeCompare','readdirSync','integrations.json','3942996OcyERD','modelType','experimentalKnowledgeBases','code','toISOString','json_schema.json','get','chats','Renamed\x20text\x20KB\x20file:\x20','systemPrompt','chat_agent_console','dry-run-','already\x20exists','endsWith','duplicate','listChats','type','):\x20','imageGenerators','resolveProjectName','tdx.json','currentProjectId','Renamed\x20folder:\x20','createAgentResponse','dryRun','chat_interfaces','Permission\x20denied.\x20Please\x20check\x20your\x20API\x20key\x20has\x20the\x20required\x20permissions\x20for\x20LLM\x20API\x20operations.','isDir',')\x20can\x20be\x20pushed.\x20','loadJsonFile','existsSync','\x0a\x0a#\x20agent.yml\x0a','\x27\x20(','file_name','TextKnowledgeBase','updatePrompt','chat_parent_segment','chatId'];a153_0x5823=function(){return _0x4c7e69;};return a153_0x5823();}(function(_0x11818f,_0x1e8b74){const _0xa37856=a153_0x1f4a,_0x39ddd6=_0x11818f();while(!![]){try{const _0x14d525=-parseInt(_0xa37856(0x22a))/0x1*(parseInt(_0xa37856(0x2a5))/0x2)+-parseInt(_0xa37856(0x1f0))/0x3+parseInt(_0xa37856(0x225))/0x4+-parseInt(_0xa37856(0x287))/0x5+-parseInt(_0xa37856(0x296))/0x6+-parseInt(_0xa37856(0x248))/0x7*(parseInt(_0xa37856(0x24f))/0x8)+-parseInt(_0xa37856(0x2aa))/0x9*(-parseInt(_0xa37856(0x2b2))/0xa);if(_0x14d525===_0x1e8b74)break;else _0x39ddd6['push'](_0x39ddd6['shift']());}catch(_0x28a94f){_0x39ddd6['push'](_0x39ddd6['shift']());}}}(a153_0x5823,0xd706e));import{LLMApiClient}from'../client/llm-api-client.js';import*as a153_0x1775cb from'node:fs';import*as a153_0x4751bc from'node:path';import{HTTPClientError}from'../client/http-client.js';import{canCreateAgent,remapToolIds,remapVariableIds,isSupportedBackupVersion}from'./llm-backup-utils.js';import{toModelInfos}from'./user-settings.js';import{SDKError,ErrorCode,errorContains}from'../errors.js';import{getSanitizedPathWithMigration,sanitizeForFilesystem,migrateModelType,parseRef,agentResponseToDef,apiKnowledgeBaseToYaml,apiPromptToYaml,apiIntegrationToYaml,apiExperimentalKnowledgeBaseToYaml,apiExperimentalArtifactToYaml,apiFormInterfaceToYaml,apiChatInterfaceToYaml,fetchAllToolTargetMaps,toAgentYamlString,toKnowledgeBaseYamlString,toTextKnowledgeBaseMd,toPromptYamlString,toIntegrationYamlString,toExperimentalKnowledgeBaseYamlString,toExperimentalArtifactYamlString,toFormInterfaceYamlString,toChatInterfaceYamlString,parseAgentYaml,parseKnowledgeBaseYaml,parseTextKnowledgeBaseMd,parsePromptYaml,parseIntegrationYaml,parseExperimentalKnowledgeBaseYaml,parseExperimentalArtifactYaml,parseFormInterfaceYaml,parseChatInterfaceYaml,agentDefToRequest,yamlKnowledgeBaseToApi,yamlTextKnowledgeBaseToApi,yamlExperimentalKnowledgeBaseToApi,yamlExperimentalArtifactToApi,yamlPromptToApi,yamlIntegrationToApi,yamlFormInterfaceToApi,yamlChatInterfaceToApi,resolveAgentDependencies,buildNameResolver,buildIdResolver}from'../agent/agent-yaml.js';import{createAgentConfigContent,loadAgentConfig,findAgentConfig,isAgentDir,isAgentYamlPath,getAgentDirFromYamlPath,getKnowledgeBasesDir,getPromptsDir,getIntegrationsDir,getExperimentalKnowledgeBasesDir,getExperimentalArtifactsDir,getFormInterfacesDir,getChatInterfacesDir}from'../agent/agent-config.js';function a153_0x1f4a(_0x527cd5,_0x2b5804){_0x527cd5=_0x527cd5-0x189;const _0x582348=a153_0x5823();let _0x1f4a61=_0x582348[_0x527cd5];return _0x1f4a61;}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=[a153_0x13235f(0x1b0),a153_0x13235f(0x1fa),a153_0x13235f(0x214)];async function safeListOrEmpty(_0xfd3834){const _0x4aa02f=a153_0x13235f;try{return await _0xfd3834();}catch(_0x1829ca){if(_0x1829ca instanceof HTTPClientError&&_0x1829ca[_0x4aa02f(0x18a)]===0x194)return[];throw _0x1829ca;}}export class LLMSDK{[a153_0x13235f(0x205)];[a153_0x13235f(0x2a1)];[a153_0x13235f(0x247)];['logger']=Logger['of'](a153_0x13235f(0x1b1));constructor(_0x1c265f){const _0x2be809=a153_0x13235f;this[_0x2be809(0x2a1)]=new LLMApiClient(_0x1c265f),this[_0x2be809(0x247)]=_0x1c265f;}[a153_0x13235f(0x252)](){const _0x168af5=a153_0x13235f,_0x4f4b2e=getSanitizedUsername();return _0x168af5(0x276)+_0x4f4b2e;}async['setCurrentProject'](_0x1d767f){const _0x438764=a153_0x13235f,{projectId:_0x148676}=await this[_0x438764(0x203)](_0x1d767f);this['currentProjectId']=_0x148676;}[a153_0x13235f(0x259)](){return this['currentProjectId'];}async[a153_0x13235f(0x1b8)](_0x4493c8){const _0x37ce26=a153_0x13235f,_0x21713b=this[_0x37ce26(0x247)][_0x37ce26(0x1e1)];let _0x49ab8c,_0x3157f9;if(_0x4493c8['includes']('/')){const _0x42c927=_0x4493c8['split']('/');if(_0x42c927['length']!==0x2)throw new SDKError(ErrorCode['INVALID_ARGUMENT'],_0x37ce26(0x1aa)+_0x4493c8,undefined,{'helpText':_0x37ce26(0x23d)});const [_0x479621,_0x1f81b3]=_0x42c927;_0x49ab8c=await this['resolveProjectId'](_0x479621),_0x3157f9=_0x1f81b3;}else _0x49ab8c=this[_0x37ce26(0x205)]||(await this[_0x37ce26(0x1dc)]())['id'],_0x3157f9=_0x4493c8;const _0x45c057=await this['resolveAgentId'](_0x3157f9,_0x49ab8c),_0x4d6494=await this['client'][_0x37ce26(0x1ca)](_0x45c057);writeCachedLLMAgent(_0x4d6494[_0x37ce26(0x25f)][_0x37ce26(0x244)],_0x45c057,_0x49ab8c,_0x21713b);}[a153_0x13235f(0x1c7)](){const _0xd708c2=a153_0x13235f,_0x18f9fd=this['context'][_0xd708c2(0x1e1)];return readCachedLLMAgent(_0x18f9fd)||undefined;}[a153_0x13235f(0x26a)](){const _0x4f08fd=a153_0x13235f,_0x2e646d=this[_0x4f08fd(0x247)][_0x4f08fd(0x1e1)];clearCachedLLMAgent(_0x2e646d);}async[a153_0x13235f(0x286)](){const _0x242839=a153_0x13235f,_0x365941=await this[_0x242839(0x2a1)]['getUserSettings']();return toModelInfos(_0x365941);}async['createProject'](_0x151a90){return await this['client']['createProject'](_0x151a90);}async[a153_0x13235f(0x1b9)](_0x2a0ec3){const _0x1d0fbf=a153_0x13235f,{projectId:_0x1016d7}=await this['resolveProjectName'](_0x2a0ec3);await this[_0x1d0fbf(0x2a1)][_0x1d0fbf(0x1b9)](_0x1016d7);}async['projects'](_0x4dd720=0x32){const _0x3cb185=a153_0x13235f;return await this[_0x3cb185(0x2a1)][_0x3cb185(0x263)](_0x4dd720);}async[a153_0x13235f(0x1dc)](_0xd24982){const _0x78fb80=a153_0x13235f,_0x531beb=_0xd24982||this['getDefaultProjectName'](),_0x460914=this['context'][_0x78fb80(0x1e1)];if(!_0xd24982){const _0x5696c1=readCachedLLMProject(_0x460914);if(_0x5696c1&&_0x5696c1['name']===_0x531beb)try{const _0x24e0aa=await this[_0x78fb80(0x2a1)]['getProject'](_0x5696c1['id']);if(_0x24e0aa[_0x78fb80(0x25f)][_0x78fb80(0x244)]===_0x531beb)return _0x24e0aa;}catch{}}const _0x556cc2=await this[_0x78fb80(0x2a1)][_0x78fb80(0x263)](),_0x4572e8=_0x556cc2[_0x78fb80(0x1ad)](_0x2f6a18=>_0x2f6a18[_0x78fb80(0x25f)][_0x78fb80(0x244)]===_0x531beb);if(_0x4572e8)return!_0xd24982&&writeCachedLLMProject(_0x531beb,_0x4572e8['id'],_0x460914),_0x4572e8;const _0x37ffaf=await this[_0x78fb80(0x2a1)][_0x78fb80(0x1ba)]({'name':_0x531beb,'description':_0x78fb80(0x224)+getSanitizedUsername()+')'});return!_0xd24982&&writeCachedLLMProject(_0x531beb,_0x37ffaf['id'],_0x460914),_0x37ffaf;}async[a153_0x13235f(0x1cc)](_0x86ab79){const _0x1a03cb=a153_0x13235f,_0x725fd8=await this[_0x1a03cb(0x2a1)][_0x1a03cb(0x263)](),_0x3993bf=_0x725fd8[_0x1a03cb(0x1d4)](_0x5c19db=>_0x5c19db[_0x1a03cb(0x25f)][_0x1a03cb(0x244)]===_0x86ab79);if(_0x3993bf[_0x1a03cb(0x1df)]===0x0)throw new SDKError(ErrorCode['LLM_PROJECT_NOT_FOUND'],_0x1a03cb(0x2a4)+_0x86ab79,undefined,{'helpText':'Use\x20\x22tdx\x20llm\x20projects\x22\x20to\x20list\x20available\x20projects.'});if(_0x3993bf[_0x1a03cb(0x1df)]>0x1)throw new SDKError(ErrorCode['INTERNAL'],_0x1a03cb(0x293)+_0x86ab79+_0x1a03cb(0x21a));return _0x3993bf[0x0]['id'];}async[a153_0x13235f(0x203)](_0x157190){const _0x3a229a=a153_0x13235f,_0x356666=await this['client'][_0x3a229a(0x263)](),_0x279dd6=_0x356666[_0x3a229a(0x1ad)](_0x5bf52b=>_0x5bf52b[_0x3a229a(0x25f)]['name']===_0x157190);if(_0x279dd6)return{'projectId':_0x279dd6['id'],'project':_0x279dd6};throw new SDKError(ErrorCode[_0x3a229a(0x1d5)],'Project\x20not\x20found:\x20'+_0x157190,undefined,{'helpText':_0x3a229a(0x18f)});}async[a153_0x13235f(0x279)](_0x275e1c=a153_0x13235f(0x1a3),_0x47c067=0x0,_0xfa9cd0){const _0x4b9dc6=a153_0x13235f,_0x26b582=0xa;let _0x3b3aca=0x0,_0x558f8d;while(_0x3b3aca<_0x26b582){try{const _0x4b84d4=await this[_0x4b9dc6(0x1dc)](_0x558f8d),_0x15db03=_0x4b84d4['id'],_0x3558b5=[_0x4b9dc6(0x19a),_0x4b9dc6(0x1b3),_0x4b9dc6(0x2a8),'medium',_0x4b9dc6(0x1e7)],_0x2e5439=_0x47c067===0x0?'tdx_'+_0x275e1c:_0x4b9dc6(0x19c)+_0x275e1c+_0x4b9dc6(0x242)+_0x3558b5[_0x47c067],_0xc56fd1=await this[_0x4b9dc6(0x2a1)][_0x4b9dc6(0x1c5)](_0x15db03),_0x5df1fb=_0xc56fd1['find'](_0xe4dfad=>_0xe4dfad['attributes'][_0x4b9dc6(0x244)]===_0x2e5439);if(_0x5df1fb)return _0x5df1fb;const _0x1ce689=_0x47c067>0x0?0x1:_0xfa9cd0;return await this[_0x4b9dc6(0x2a1)][_0x4b9dc6(0x2ae)]({'name':_0x2e5439,'projectId':_0x15db03,'modelType':_0x275e1c,'systemPrompt':'','temperature':_0x1ce689,'reasoningEffort':_0x47c067>0x0?_0x47c067:undefined});}catch(_0x542530){if(_0x542530 instanceof HTTPClientError){const _0x154c37=_0x542530['status'];if(_0x154c37>=0x190&&_0x154c37<0x1f4){if(_0x154c37===0x191)throw new SDKError(ErrorCode['UNAUTHENTICATED'],_0x4b9dc6(0x21b),_0x542530);else{if(_0x154c37===0x193)throw new SDKError(ErrorCode[_0x4b9dc6(0x299)],_0x4b9dc6(0x20a),_0x542530);}throw _0x542530;}}if(errorContains(_0x542530,_0x4b9dc6(0x1fc),_0x4b9dc6(0x1fe),_0x4b9dc6(0x23f))){_0x3b3aca++;if(_0x3b3aca>=_0x26b582)throw new SDKError(ErrorCode[_0x4b9dc6(0x21c)],_0x4b9dc6(0x29d)+_0x26b582+_0x4b9dc6(0x1a4),_0x542530);const _0x51362f=this[_0x4b9dc6(0x252)]();_0x558f8d=_0x51362f+'_'+generateRandomHex();continue;}throw _0x542530;}}throw new SDKError(ErrorCode[_0x4b9dc6(0x25e)],_0x4b9dc6(0x297));}async[a153_0x13235f(0x190)](_0x65aec7,_0x5cb686){const _0x16ab46=a153_0x13235f,_0x58856a=_0x5cb686||this[_0x16ab46(0x205)],_0x5cf786=await this[_0x16ab46(0x2a1)][_0x16ab46(0x1c5)](_0x58856a),_0x418a28=_0x5cf786[_0x16ab46(0x1d4)](_0x2d99ae=>_0x2d99ae[_0x16ab46(0x25f)][_0x16ab46(0x244)]===_0x65aec7);if(_0x418a28[_0x16ab46(0x1df)]===0x0){const _0x3d3428=_0x58856a?'\x20in\x20project\x20'+_0x58856a:'';throw new SDKError(ErrorCode[_0x16ab46(0x2a2)],_0x16ab46(0x1bf)+_0x65aec7+_0x3d3428,undefined,{'helpText':_0x58856a?_0x16ab46(0x1eb):_0x16ab46(0x273)});}if(_0x418a28[_0x16ab46(0x1df)]>0x1)throw new SDKError(ErrorCode[_0x16ab46(0x25e)],_0x16ab46(0x280)+_0x65aec7+_0x16ab46(0x21a));return _0x418a28[0x0]['id'];}async['agents'](_0xdc5187){const _0x9bf814=a153_0x13235f,_0x5def5c=_0xdc5187||this['currentProjectId'];return await this[_0x9bf814(0x2a1)][_0x9bf814(0x1c5)](_0x5def5c);}async[a153_0x13235f(0x24e)](_0x1f17fb){const _0x54ed41=a153_0x13235f;return await this['client'][_0x54ed41(0x26b)](_0x1f17fb);}async[a153_0x13235f(0x2ac)](_0x5bc4a4){const _0x17c35e=a153_0x13235f;return await this[_0x17c35e(0x2a1)][_0x17c35e(0x1ca)](_0x5bc4a4);}async[a153_0x13235f(0x2ae)](_0x683ea4){return await this['client']['createAgent'](_0x683ea4);}async[a153_0x13235f(0x1d9)](_0x3bb1e0,_0x153a58){const _0xec7478=a153_0x13235f;return await this[_0xec7478(0x2a1)][_0xec7478(0x1d9)](_0x3bb1e0,_0x153a58);}async[a153_0x13235f(0x26f)](_0x35e0f7){const _0x12fc16=a153_0x13235f;await this['client'][_0x12fc16(0x26f)](_0x35e0f7);}async[a153_0x13235f(0x1a9)](_0xa42b7f){const _0x34c2e3=a153_0x13235f;return await this[_0x34c2e3(0x2a1)]['startChat']({'agentId':_0xa42b7f});}async*[a153_0x13235f(0x282)](_0x8e744a,_0x76eace){const _0x4fdf7f=a153_0x13235f;let _0x4c3e73=_0x76eace?.[_0x4fdf7f(0x215)];const _0x5c7fb9=_0x76eace?.[_0x4fdf7f(0x22b)];if(!_0x4c3e73){if(!_0x5c7fb9)throw new Error('agentId\x20is\x20required\x20when\x20starting\x20a\x20new\x20chat');const _0x5bc387=await this[_0x4fdf7f(0x2a1)][_0x4fdf7f(0x1a9)]({'agentId':_0x5c7fb9});_0x4c3e73=_0x5bc387['id'],yield{'type':_0x4fdf7f(0x294),'data':{'chatId':_0x4c3e73,'agentId':_0x5c7fb9,'projectId':_0x5bc387[_0x4fdf7f(0x25f)][_0x4fdf7f(0x1dd)]}};}for await(const _0x3219b0 of this[_0x4fdf7f(0x2a1)][_0x4fdf7f(0x267)](_0x4c3e73,_0x8e744a,_0x76eace?.[_0x4fdf7f(0x2a0)])){yield{'type':'event','data':_0x3219b0};}}async[a153_0x13235f(0x1f7)](_0x32a216=0x32){const _0x17a609=a153_0x13235f;return await this['client'][_0x17a609(0x1ff)](_0x32a216);}async[a153_0x13235f(0x268)](_0x4531d6){const _0x3a050c=a153_0x13235f;return await this[_0x3a050c(0x2a1)][_0x3a050c(0x28c)](_0x4531d6);}async[a153_0x13235f(0x23e)](_0x446fa0){const _0xc1c8f2=a153_0x13235f;return await this['client'][_0xc1c8f2(0x23e)](_0x446fa0);}async[a153_0x13235f(0x264)](_0x3b976c){const _0x9ff52=a153_0x13235f;return await this[_0x9ff52(0x2a1)][_0x9ff52(0x27c)](_0x3b976c);}async[a153_0x13235f(0x27b)](_0x5b736c,_0x58948c,_0x19596a){const _0x203369=a153_0x13235f,_0x426f81=_0x19596a?.['dryRun']??![],{projectId:_0x4e8319,project:_0x4c7214}=await this[_0x203369(0x203)](_0x5b736c),_0x3cf141=_0x4c7214[_0x203369(0x25f)][_0x203369(0x244)],_0x5b6204=_0x58948c||_0x3cf141+_0x203369(0x1ce);if(a153_0x1775cb[_0x203369(0x20e)](_0x5b6204)&&!_0x426f81)throw new SDKError(ErrorCode[_0x203369(0x21c)],_0x203369(0x24d)+_0x5b6204,undefined,{'helpText':_0x203369(0x260)});const _0x1cc67d=await this['client']['listAgentsFull'](_0x4e8319),_0xf1ff6f=await this[_0x203369(0x2a1)][_0x203369(0x2af)](_0x4e8319),_0x4765be=await this[_0x203369(0x2a1)][_0x203369(0x281)](_0x4e8319),_0x467c8b=await this[_0x203369(0x2a1)][_0x203369(0x25b)](_0x4e8319);if(!_0x426f81){a153_0x1775cb[_0x203369(0x1d7)](_0x5b6204,{'recursive':!![]});const _0x52dc75={'version':_0x203369(0x219),'exportedAt':new Date()[_0x203369(0x1f4)](),'exportedFrom':{'site':this[_0x203369(0x247)]['site'],'projectId':_0x4e8319,'projectName':_0x3cf141},'project':_0x4c7214};a153_0x1775cb[_0x203369(0x258)](a153_0x4751bc[_0x203369(0x226)](_0x5b6204,'project.json'),JSON[_0x203369(0x233)](_0x52dc75,null,0x2)),a153_0x1775cb['writeFileSync'](a153_0x4751bc[_0x203369(0x226)](_0x5b6204,_0x203369(0x1d1)),JSON[_0x203369(0x233)](_0x1cc67d,null,0x2)),a153_0x1775cb[_0x203369(0x258)](a153_0x4751bc[_0x203369(0x226)](_0x5b6204,_0x203369(0x1ab)),JSON[_0x203369(0x233)](_0xf1ff6f,null,0x2)),a153_0x1775cb[_0x203369(0x258)](a153_0x4751bc['join'](_0x5b6204,_0x203369(0x1cf)),JSON[_0x203369(0x233)](_0x4765be,null,0x2)),a153_0x1775cb['writeFileSync'](a153_0x4751bc[_0x203369(0x226)](_0x5b6204,'integrations.json'),JSON['stringify'](_0x467c8b,null,0x2));}return{'projectName':_0x3cf141,'outputDir':_0x5b6204,'counts':{'agents':_0x1cc67d[_0x203369(0x1df)],'knowledgeBases':_0xf1ff6f['length'],'prompts':_0x4765be[_0x203369(0x1df)],'integrations':_0x467c8b[_0x203369(0x1df)]}};}async['restoreProject'](_0x19834c,_0x3ddf4d){const _0x4eeb8c=a153_0x13235f,_0x307b4e=_0x3ddf4d?.[_0x4eeb8c(0x208)]??![],_0x313657=this[_0x4eeb8c(0x295)](_0x19834c),_0x1d532a=_0x313657[_0x4eeb8c(0x256)][_0x4eeb8c(0x21f)],_0x1ae9a5=this[_0x4eeb8c(0x247)]['site'],_0x3395ee=_0x1d532a!==_0x1ae9a5?_0x1d532a:undefined,_0x2e827f=this[_0x4eeb8c(0x20d)](a153_0x4751bc['join'](_0x19834c,_0x4eeb8c(0x1d1)),[]),_0x1960e4=this['loadJsonFile'](a153_0x4751bc[_0x4eeb8c(0x226)](_0x19834c,_0x4eeb8c(0x1ab)),[]),_0x1cab03=this[_0x4eeb8c(0x20d)](a153_0x4751bc['join'](_0x19834c,_0x4eeb8c(0x1cf)),[]),_0x4432fb=this['loadJsonFile'](a153_0x4751bc[_0x4eeb8c(0x226)](_0x19834c,_0x4eeb8c(0x1ef)),[]),_0x1a14e3=_0x3ddf4d?.[_0x4eeb8c(0x244)]||_0x313657[_0x4eeb8c(0x256)][_0x4eeb8c(0x292)];if(_0x307b4e){const _0x5c2eff=new Map(),_0xab8f39=[..._0x2e827f],_0x255e1d=_0x2e827f[_0x4eeb8c(0x1df)]+0x1;let _0xa1429b=0x0;while(_0xab8f39[_0x4eeb8c(0x1df)]>0x0&&_0xa1429b<_0x255e1d){_0xa1429b++;const _0xeede21=[];for(const _0x3bc611 of _0xab8f39){canCreateAgent(_0x3bc611,_0x5c2eff)?_0x5c2eff[_0x4eeb8c(0x254)](_0x3bc611['id'],_0x4eeb8c(0x1fb)+_0x3bc611['id']):_0xeede21[_0x4eeb8c(0x1a0)](_0x3bc611);}if(_0xeede21[_0x4eeb8c(0x1df)]===_0xab8f39[_0x4eeb8c(0x1df)])throw new SDKError(ErrorCode['INTERNAL'],_0x4eeb8c(0x1c6),undefined,{'helpText':_0x4eeb8c(0x238)});_0xab8f39[_0x4eeb8c(0x1df)]=0x0,_0xab8f39[_0x4eeb8c(0x1a0)](..._0xeede21);}const _0x272d34=_0x1cab03[_0x4eeb8c(0x1d4)](_0x5ef4b4=>_0x5c2eff[_0x4eeb8c(0x28b)](_0x5ef4b4[_0x4eeb8c(0x25f)][_0x4eeb8c(0x22b)]))[_0x4eeb8c(0x1df)];return{'projectName':_0x1a14e3,'projectId':_0x4eeb8c(0x22c),'counts':{'agents':_0x2e827f['length'],'knowledgeBases':_0x1960e4[_0x4eeb8c(0x1df)],'prompts':_0x272d34,'integrations':_0x4432fb[_0x4eeb8c(0x1df)]},'sourceSite':_0x3395ee};}const _0x1c1f8f=await this[_0x4eeb8c(0x2a1)][_0x4eeb8c(0x1ba)]({'name':_0x1a14e3,'description':_0x313657[_0x4eeb8c(0x1c9)][_0x4eeb8c(0x25f)][_0x4eeb8c(0x277)]}),_0x16cd9b=_0x1c1f8f['id'],_0x508f3a=new Map(),_0x3ae42e=new Map(),_0x3da20e=new Map();for(const _0x56bca8 of _0x1960e4){const _0x51439f=await this[_0x4eeb8c(0x2a1)][_0x4eeb8c(0x21d)]({'projectId':_0x16cd9b,'name':_0x56bca8['attributes'][_0x4eeb8c(0x244)],'tdDatabaseName':_0x56bca8['attributes']['tdDatabaseName'],'tables':_0x56bca8[_0x4eeb8c(0x25f)]['tables']});_0x508f3a['set'](_0x56bca8['id'],_0x51439f['id']);}const _0x28c6e0=[..._0x2e827f],_0x3c4b2d=_0x2e827f[_0x4eeb8c(0x1df)]+0x1;let _0x226064=0x0;while(_0x28c6e0['length']>0x0&&_0x226064<_0x3c4b2d){_0x226064++;const _0x54fb1e=[];for(const _0x5cc383 of _0x28c6e0){if(canCreateAgent(_0x5cc383,_0x3ae42e)){const _0x2cd237=remapToolIds(_0x5cc383[_0x4eeb8c(0x25f)][_0x4eeb8c(0x257)],_0x508f3a,_0x3ae42e),_0x52c245=remapVariableIds(_0x5cc383['attributes']['variables'],_0x508f3a),_0x2e884b=await this[_0x4eeb8c(0x2a1)][_0x4eeb8c(0x207)]({'name':_0x5cc383[_0x4eeb8c(0x25f)][_0x4eeb8c(0x244)],'projectId':_0x16cd9b,'systemPrompt':_0x5cc383[_0x4eeb8c(0x25f)][_0x4eeb8c(0x1f9)],'starterMessage':_0x5cc383[_0x4eeb8c(0x25f)][_0x4eeb8c(0x289)],'modelType':migrateModelType(_0x5cc383[_0x4eeb8c(0x25f)][_0x4eeb8c(0x1f1)]),'maxToolIterations':_0x5cc383[_0x4eeb8c(0x25f)][_0x4eeb8c(0x255)],'temperature':_0x5cc383[_0x4eeb8c(0x25f)][_0x4eeb8c(0x23c)],'reasoningEffort':_0x5cc383[_0x4eeb8c(0x25f)][_0x4eeb8c(0x196)],'outputs':_0x5cc383[_0x4eeb8c(0x25f)][_0x4eeb8c(0x1da)],'tools':_0x2cd237,'variables':_0x52c245});_0x3ae42e[_0x4eeb8c(0x254)](_0x5cc383['id'],_0x2e884b['id']);}else _0x54fb1e[_0x4eeb8c(0x1a0)](_0x5cc383);}if(_0x54fb1e['length']===_0x28c6e0['length'])throw new SDKError(ErrorCode[_0x4eeb8c(0x25e)],_0x4eeb8c(0x1c6),undefined,{'helpText':'The\x20backup\x20contains\x20agents\x20with\x20circular\x20dependencies.'});_0x28c6e0['length']=0x0,_0x28c6e0[_0x4eeb8c(0x1a0)](..._0x54fb1e);}for(const _0x1acfef of _0x1cab03){const _0x28be60=_0x3ae42e[_0x4eeb8c(0x1f6)](_0x1acfef[_0x4eeb8c(0x25f)][_0x4eeb8c(0x22b)]);if(!_0x28be60)continue;const _0x3e390b=await this[_0x4eeb8c(0x2a1)]['createPrompt']({'projectId':_0x16cd9b,'agentId':_0x28be60,'name':_0x1acfef[_0x4eeb8c(0x25f)][_0x4eeb8c(0x244)],'systemPrompt':_0x1acfef[_0x4eeb8c(0x25f)][_0x4eeb8c(0x1f9)],'template':_0x1acfef[_0x4eeb8c(0x25f)]['template'],'jsonSchemaHint':_0x1acfef[_0x4eeb8c(0x25f)]['jsonSchemaHint']});_0x3da20e[_0x4eeb8c(0x254)](_0x1acfef['id'],_0x3e390b['id']);}for(const _0x3b1123 of _0x4432fb){const _0x3abdae=_0x3b1123['attributes'][_0x4eeb8c(0x223)]['map'](_0x39d72a=>({..._0x39d72a,'promptId':_0x3da20e[_0x4eeb8c(0x1f6)](_0x39d72a[_0x4eeb8c(0x1bd)])||_0x39d72a['promptId']}));await this[_0x4eeb8c(0x2a1)]['createIntegration']({'projectId':_0x16cd9b,'serviceType':_0x3b1123[_0x4eeb8c(0x25f)][_0x4eeb8c(0x231)],'actions':_0x3abdae,'slackMessageMode':_0x3b1123[_0x4eeb8c(0x25f)]['slackMessageMode'],'chatIgnoreManagedActions':_0x3b1123[_0x4eeb8c(0x25f)][_0x4eeb8c(0x235)],'chatWelcomeMessage':_0x3b1123['attributes'][_0x4eeb8c(0x1a6)],'webhookCorsOrigins':_0x3b1123[_0x4eeb8c(0x25f)][_0x4eeb8c(0x218)]});}return{'projectName':_0x1a14e3,'projectId':_0x16cd9b,'counts':{'agents':_0x3ae42e[_0x4eeb8c(0x2ad)],'knowledgeBases':_0x508f3a[_0x4eeb8c(0x2ad)],'prompts':_0x3da20e['size'],'integrations':_0x4432fb['length']},'sourceSite':_0x3395ee};}[a153_0x13235f(0x20d)](_0x2a0d83,_0x439e64){const _0x2e658c=a153_0x13235f;if(!a153_0x1775cb[_0x2e658c(0x20e)](_0x2a0d83))return _0x439e64;return JSON[_0x2e658c(0x236)](a153_0x1775cb[_0x2e658c(0x261)](_0x2a0d83,_0x2e658c(0x18c)));}[a153_0x13235f(0x295)](_0x1743cd){const _0x1b7f2e=a153_0x13235f;if(!a153_0x1775cb[_0x1b7f2e(0x20e)](_0x1743cd))throw new SDKError(ErrorCode[_0x1b7f2e(0x18d)],_0x1b7f2e(0x1e2)+_0x1743cd,undefined,{'helpText':_0x1b7f2e(0x1b2)});const _0x43251a=a153_0x4751bc['join'](_0x1743cd,'project.json');if(!a153_0x1775cb['existsSync'](_0x43251a))throw new SDKError(ErrorCode[_0x1b7f2e(0x232)],_0x1b7f2e(0x28a)+_0x1743cd,undefined,{'helpText':_0x1b7f2e(0x29c)});const _0x543392=JSON[_0x1b7f2e(0x236)](a153_0x1775cb[_0x1b7f2e(0x261)](_0x43251a,'utf-8'));if(!isSupportedBackupVersion(_0x543392[_0x1b7f2e(0x285)]))throw new SDKError(ErrorCode[_0x1b7f2e(0x232)],'Unsupported\x20backup\x20version:\x20'+_0x543392[_0x1b7f2e(0x285)],undefined,{'helpText':'This\x20backup\x20was\x20created\x20with\x20a\x20newer\x20version\x20of\x20tdx.'});return _0x543392;}async[a153_0x13235f(0x19d)](_0x1cdd9c,_0x4589d6,_0x406a48){const _0x574861=a153_0x13235f,{projectId:_0x3843f0,project:_0x5b9568}=await this[_0x574861(0x203)](_0x1cdd9c),_0x40ee02=_0x5b9568[_0x574861(0x25f)][_0x574861(0x244)];let _0x23662e;if(_0x4589d6)_0x23662e=_0x4589d6;else{const _0x2a0c74=a153_0x4751bc['join'](process[_0x574861(0x1a8)](),_0x574861(0x2a7)),_0x11c323=getSanitizedPathWithMigration(_0x2a0c74,_0x40ee02);_0x11c323['renamed']&&this['logger'][_0x574861(0x228)]('Renamed\x20folder:\x20'+a153_0x4751bc[_0x574861(0x2b1)](_0x11c323[_0x574861(0x21e)])+_0x574861(0x25d)+a153_0x4751bc['basename'](_0x11c323[_0x574861(0x26c)])),_0x23662e=_0x11c323['path'];}const _0x5c1702=await this[_0x574861(0x2a1)][_0x574861(0x26b)](_0x3843f0),_0x4e51b6=await this[_0x574861(0x2a1)][_0x574861(0x2af)](_0x3843f0),_0xea9fe3=await this['client'][_0x574861(0x1c2)](_0x3843f0),_0x51c49b=await safeListOrEmpty(()=>this[_0x574861(0x2a1)][_0x574861(0x1cb)](_0x3843f0)),_0x39c61f=await safeListOrEmpty(()=>this[_0x574861(0x2a1)][_0x574861(0x1a1)](_0x3843f0)),_0x433b5d=await this[_0x574861(0x2a1)][_0x574861(0x281)](_0x3843f0),_0x4c2958=await this[_0x574861(0x2a1)]['listIntegrations'](_0x3843f0),_0x1b222a=await safeListOrEmpty(()=>this[_0x574861(0x2a1)][_0x574861(0x23b)](_0x3843f0)),_0x688c91=await safeListOrEmpty(()=>this[_0x574861(0x2a1)][_0x574861(0x24c)](_0x3843f0)),_0x1d6c29=await safeListOrEmpty(()=>this['client']['listFormInterfaces'](_0x3843f0)),_0x2c0d4a=await safeListOrEmpty(()=>this[_0x574861(0x2a1)]['listChatInterfaces'](_0x3843f0)),_0x306d46=_0x4c2958[_0x574861(0x1d4)](_0x2f0e6d=>!_0x2f0e6d[_0x574861(0x25f)][_0x574861(0x193)]&&SAFE_INTEGRATION_TYPES[_0x574861(0x237)](_0x2f0e6d[_0x574861(0x25f)][_0x574861(0x231)][_0x574861(0x274)]())),_0x534441=new Map(),_0x5bd837=new Map(),_0x2248cb=new Map(),_0x4cc76f=new Map(),_0x30c7a5=new Map(),_0xa2ff25=new Map(),_0x528eaa=new Map();for(const _0x24fd37 of _0x5c1702){_0x534441[_0x574861(0x254)](_0x24fd37['id'],_0x24fd37[_0x574861(0x25f)][_0x574861(0x244)]);}for(const _0x3ecd82 of _0x4e51b6){_0x5bd837[_0x574861(0x254)](_0x3ecd82['id'],_0x3ecd82['attributes'][_0x574861(0x244)]);}for(const _0x394d6e of _0xea9fe3){_0x2248cb['set'](_0x394d6e['id'],_0x394d6e[_0x574861(0x25f)][_0x574861(0x244)]);}for(const _0x22fda5 of _0x51c49b){_0x4cc76f[_0x574861(0x254)](_0x22fda5['id'],_0x22fda5['attributes'][_0x574861(0x244)]);}for(const _0xf0dc8e of _0x39c61f){_0x30c7a5[_0x574861(0x254)](_0xf0dc8e['id'],_0xf0dc8e[_0x574861(0x25f)]['name']);}for(const _0x535ea1 of _0x433b5d){_0xa2ff25[_0x574861(0x254)](_0x535ea1['id'],_0x535ea1[_0x574861(0x25f)][_0x574861(0x244)]);}for(const _0x4500be of _0x1b222a){_0x528eaa[_0x574861(0x254)](_0x4500be['id'],_0x4500be['attributes'][_0x574861(0x244)]);}const _0x294b77={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x5bd837,'TextKnowledgeBase':_0x2248cb,'Agent':_0x534441,'WebSearchTool':_0x30c7a5,'ImageGenerator':_0x4cc76f,'ExperimentalKnowledgeBase':_0x528eaa}),'resolvePromptName':async _0x3edbff=>_0xa2ff25[_0x574861(0x1f6)](_0x3edbff),'onWarning':_0x5eb7a8=>this[_0x574861(0x194)][_0x574861(0x27d)](_0x5eb7a8)},_0x96b6fe={'projectName':_0x40ee02,'outputDir':_0x23662e,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'knowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'textKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'prompts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'integrations':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalKnowledgeBases':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'experimentalArtifacts':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'formInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0},'chatInterfaces':{'total':0x0,'new':0x0,'updated':0x0,'unchanged':0x0}}},_0x378f04=[],_0x402e89=[];for(const _0x14bc61 of _0x5c1702){const _0x3a1dc4=getSanitizedPathWithMigration(_0x23662e,_0x14bc61[_0x574861(0x25f)][_0x574861(0x244)]);_0x3a1dc4[_0x574861(0x290)]&&this[_0x574861(0x194)][_0x574861(0x228)](_0x574861(0x1db)+a153_0x4751bc[_0x574861(0x2b1)](_0x3a1dc4[_0x574861(0x21e)])+_0x574861(0x25d)+a153_0x4751bc[_0x574861(0x2b1)](_0x3a1dc4[_0x574861(0x26c)]));const _0x455c64=_0x3a1dc4[_0x574861(0x26c)],_0x5e255b=a153_0x4751bc['join'](_0x455c64,'prompt.md'),_0x5939aa=a153_0x4751bc['join'](_0x455c64,_0x574861(0x1e9)),_0xc2afd0=a153_0x4751bc[_0x574861(0x226)](_0x455c64,_0x574861(0x243)),{yaml:_0x339903,systemPrompt:_0x164da1,starterMessage:_0x37b3f3}=await agentResponseToDef(_0x14bc61,_0x294b77),_0x36cf8b=toAgentYamlString(_0x339903),_0x3c0c30=!a153_0x1775cb['existsSync'](_0x5939aa);let _0x410a41=_0x3c0c30,_0x40a25f;if(!_0x3c0c30){const _0x382313=a153_0x1775cb[_0x574861(0x20e)](_0x5e255b)?a153_0x1775cb[_0x574861(0x261)](_0x5e255b,_0x574861(0x18c)):'',_0x2f01a8=a153_0x1775cb[_0x574861(0x261)](_0x5939aa,_0x574861(0x18c)),_0x56f46f=_0x574861(0x25a)+_0x382313+_0x574861(0x20f)+_0x2f01a8,_0x53c1fe='#\x20prompt.md\x0a'+_0x164da1+_0x574861(0x20f)+_0x36cf8b,_0x401d6f=generateDiff(_0x56f46f,_0x53c1fe);_0x410a41=hasChanges(_0x401d6f),_0x410a41&&(_0x40a25f=formatDiffWithColors(_0x401d6f));}_0x378f04[_0x574861(0x1a0)]({'path':_0x455c64,'content':'','isDir':!![]}),_0x378f04[_0x574861(0x1a0)]({'path':_0x5e255b,'content':_0x164da1}),_0x378f04[_0x574861(0x1a0)]({'path':_0x5939aa,'content':_0x36cf8b});_0x37b3f3&&_0x37b3f3[_0x574861(0x237)]('\x0a')&&_0x378f04[_0x574861(0x1a0)]({'path':_0xc2afd0,'content':_0x37b3f3});_0x96b6fe[_0x574861(0x2a7)][_0x574861(0x1a0)]({'agentName':_0x14bc61[_0x574861(0x25f)][_0x574861(0x244)],'outputPath':_0x455c64,'isNew':_0x3c0c30,'hasChanges':_0x410a41,'diff':_0x40a25f}),_0x96b6fe['counts'][_0x574861(0x2a7)]['total']++;if(_0x3c0c30)_0x96b6fe[_0x574861(0x29a)][_0x574861(0x2a7)]['new']++;else{if(_0x410a41)_0x96b6fe['counts'][_0x574861(0x2a7)][_0x574861(0x192)]++;else _0x96b6fe['counts'][_0x574861(0x2a7)][_0x574861(0x29f)]++;}}for(const _0x5e7bf2 of _0x4e51b6){if(_0x5e7bf2[_0x574861(0x25f)][_0x574861(0x193)])continue;const _0x20b5b0=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x23662e),_0x5e7bf2['attributes'][_0x574861(0x244)],_0x574861(0x262));_0x20b5b0[_0x574861(0x290)]&&this[_0x574861(0x194)][_0x574861(0x228)](_0x574861(0x28f)+a153_0x4751bc[_0x574861(0x2b1)](_0x20b5b0[_0x574861(0x21e)])+_0x574861(0x25d)+a153_0x4751bc[_0x574861(0x2b1)](_0x20b5b0[_0x574861(0x26c)]));const _0x42f06a=_0x20b5b0[_0x574861(0x26c)],_0x1b2d8a=apiKnowledgeBaseToYaml(_0x5e7bf2),_0x2cb851=toKnowledgeBaseYamlString(_0x1b2d8a),_0x192230=!a153_0x1775cb[_0x574861(0x20e)](_0x42f06a);let _0x347542=_0x192230,_0x22682;if(!_0x192230){const _0x4fe30f=a153_0x1775cb[_0x574861(0x261)](_0x42f06a,_0x574861(0x18c)),_0x32ca5f=generateDiff(_0x4fe30f,_0x2cb851);_0x347542=hasChanges(_0x32ca5f),_0x347542&&(_0x22682=formatDiffWithColors(_0x32ca5f));}_0x378f04[_0x574861(0x1a0)]({'path':_0x42f06a,'content':_0x2cb851}),_0x96b6fe['knowledgeBases'][_0x574861(0x1a0)]({'name':_0x5e7bf2[_0x574861(0x25f)][_0x574861(0x244)],'outputPath':_0x42f06a,'isNew':_0x192230,'hasChanges':_0x347542,'diff':_0x22682}),_0x96b6fe['counts'][_0x574861(0x197)][_0x574861(0x1b7)]++;if(_0x192230)_0x96b6fe[_0x574861(0x29a)][_0x574861(0x197)][_0x574861(0x253)]++;else{if(_0x347542)_0x96b6fe[_0x574861(0x29a)][_0x574861(0x197)]['updated']++;else _0x96b6fe[_0x574861(0x29a)]['knowledgeBases'][_0x574861(0x29f)]++;}}for(const _0x4f87d5 of _0xea9fe3){if(_0x4f87d5['attributes'][_0x574861(0x193)])continue;const _0x535124=getSanitizedPathWithMigration(getKnowledgeBasesDir(_0x23662e),_0x4f87d5[_0x574861(0x25f)][_0x574861(0x244)],'.md');_0x535124['renamed']&&this[_0x574861(0x194)][_0x574861(0x228)](_0x574861(0x1f8)+a153_0x4751bc[_0x574861(0x2b1)](_0x535124[_0x574861(0x21e)])+'\x20→\x20'+a153_0x4751bc[_0x574861(0x2b1)](_0x535124[_0x574861(0x26c)]));const _0xbbf960=_0x535124['path'],_0xcad519=toTextKnowledgeBaseMd(_0x4f87d5['attributes'][_0x574861(0x244)],_0x4f87d5[_0x574861(0x25f)][_0x574861(0x24a)]),_0xe7a88a=!a153_0x1775cb['existsSync'](_0xbbf960);let _0x59108=_0xe7a88a,_0xef7244;if(!_0xe7a88a){const _0x31325e=a153_0x1775cb['readFileSync'](_0xbbf960,'utf-8'),_0x28c895=generateDiff(_0x31325e,_0xcad519);_0x59108=hasChanges(_0x28c895),_0x59108&&(_0xef7244=formatDiffWithColors(_0x28c895));}_0x378f04[_0x574861(0x1a0)]({'path':_0xbbf960,'content':_0xcad519}),_0x96b6fe['textKnowledgeBases'][_0x574861(0x1a0)]({'name':_0x4f87d5['attributes'][_0x574861(0x244)],'outputPath':_0xbbf960,'isNew':_0xe7a88a,'hasChanges':_0x59108,'diff':_0xef7244}),_0x96b6fe[_0x574861(0x29a)]['textKnowledgeBases'][_0x574861(0x1b7)]++;if(_0xe7a88a)_0x96b6fe[_0x574861(0x29a)][_0x574861(0x272)][_0x574861(0x253)]++;else{if(_0x59108)_0x96b6fe[_0x574861(0x29a)][_0x574861(0x272)][_0x574861(0x192)]++;else _0x96b6fe[_0x574861(0x29a)][_0x574861(0x272)][_0x574861(0x29f)]++;}}for(const _0x50cd2d of _0x433b5d){if(_0x50cd2d['attributes']['isManaged'])continue;const _0x5055b6=getSanitizedPathWithMigration(getPromptsDir(_0x23662e),_0x50cd2d[_0x574861(0x25f)]['name'],_0x574861(0x262));_0x5055b6[_0x574861(0x290)]&&this[_0x574861(0x194)]['info']('Renamed\x20prompt\x20file:\x20'+a153_0x4751bc[_0x574861(0x2b1)](_0x5055b6[_0x574861(0x21e)])+_0x574861(0x25d)+a153_0x4751bc[_0x574861(0x2b1)](_0x5055b6[_0x574861(0x26c)]));const _0xb0e212=_0x5055b6[_0x574861(0x26c)],_0x4ce49b=await apiPromptToYaml(_0x50cd2d,_0x294b77);if(!_0x4ce49b)continue;const _0x46d0d4=toPromptYamlString(_0x4ce49b),_0x46e48a=!a153_0x1775cb[_0x574861(0x20e)](_0xb0e212);let _0xe09349=_0x46e48a,_0x4b44ab;if(!_0x46e48a){const _0x4b2126=a153_0x1775cb['readFileSync'](_0xb0e212,'utf-8'),_0x41a707=generateDiff(_0x4b2126,_0x46d0d4);_0xe09349=hasChanges(_0x41a707),_0xe09349&&(_0x4b44ab=formatDiffWithColors(_0x41a707));}_0x378f04[_0x574861(0x1a0)]({'path':_0xb0e212,'content':_0x46d0d4}),_0x96b6fe[_0x574861(0x1c0)][_0x574861(0x1a0)]({'name':_0x50cd2d['attributes'][_0x574861(0x244)],'outputPath':_0xb0e212,'isNew':_0x46e48a,'hasChanges':_0xe09349,'diff':_0x4b44ab}),_0x96b6fe[_0x574861(0x29a)][_0x574861(0x1c0)][_0x574861(0x1b7)]++;if(_0x46e48a)_0x96b6fe[_0x574861(0x29a)][_0x574861(0x1c0)]['new']++;else{if(_0xe09349)_0x96b6fe[_0x574861(0x29a)][_0x574861(0x1c0)][_0x574861(0x192)]++;else _0x96b6fe[_0x574861(0x29a)][_0x574861(0x1c0)][_0x574861(0x29f)]++;}}for(const _0x19ebb1 of _0x306d46){const _0x50024f=_0x19ebb1[_0x574861(0x25f)][_0x574861(0x231)][_0x574861(0x274)](),_0x52fa0a=getSanitizedPathWithMigration(getIntegrationsDir(_0x23662e),_0x50024f,_0x574861(0x262));_0x52fa0a[_0x574861(0x290)]&&this[_0x574861(0x194)][_0x574861(0x228)](_0x574861(0x275)+a153_0x4751bc[_0x574861(0x2b1)](_0x52fa0a['oldPath'])+_0x574861(0x25d)+a153_0x4751bc[_0x574861(0x2b1)](_0x52fa0a[_0x574861(0x26c)]));const _0x176937=_0x52fa0a['path'],_0x414dd7=await apiIntegrationToYaml(_0x19ebb1,_0x294b77),_0x278c20=toIntegrationYamlString(_0x414dd7),_0x1f6ec1=!a153_0x1775cb['existsSync'](_0x176937);let _0x2cf96e=_0x1f6ec1,_0x5ac7be;if(!_0x1f6ec1){const _0x173661=a153_0x1775cb[_0x574861(0x261)](_0x176937,_0x574861(0x18c)),_0x35ed7b=generateDiff(_0x173661,_0x278c20);_0x2cf96e=hasChanges(_0x35ed7b),_0x2cf96e&&(_0x5ac7be=formatDiffWithColors(_0x35ed7b));}_0x378f04[_0x574861(0x1a0)]({'path':_0x176937,'content':_0x278c20}),_0x96b6fe['integrations']['push']({'name':_0x50024f,'outputPath':_0x176937,'isNew':_0x1f6ec1,'hasChanges':_0x2cf96e,'diff':_0x5ac7be}),_0x96b6fe[_0x574861(0x29a)][_0x574861(0x1e3)][_0x574861(0x1b7)]++;if(_0x1f6ec1)_0x96b6fe[_0x574861(0x29a)][_0x574861(0x1e3)][_0x574861(0x253)]++;else{if(_0x2cf96e)_0x96b6fe[_0x574861(0x29a)][_0x574861(0x1e3)][_0x574861(0x192)]++;else _0x96b6fe['counts'][_0x574861(0x1e3)][_0x574861(0x29f)]++;}}for(const _0x3b4d66 of _0x1b222a){if(_0x3b4d66[_0x574861(0x25f)][_0x574861(0x193)])continue;const _0x335916=getSanitizedPathWithMigration(getExperimentalKnowledgeBasesDir(_0x23662e),_0x3b4d66[_0x574861(0x25f)]['name']);_0x335916[_0x574861(0x290)]&&this['logger'][_0x574861(0x228)](_0x574861(0x1d3)+a153_0x4751bc['basename'](_0x335916['oldPath'])+'\x20→\x20'+a153_0x4751bc[_0x574861(0x2b1)](_0x335916[_0x574861(0x26c)]));const _0x222079=_0x335916[_0x574861(0x26c)],_0x2d7edd=a153_0x4751bc[_0x574861(0x226)](_0x222079,sanitizeForFilesystem(_0x3b4d66[_0x574861(0x25f)]['name'])+'.yml'),_0x39c603=a153_0x4751bc[_0x574861(0x226)](_0x222079,_0x574861(0x2ab)),_0x43773a=apiExperimentalKnowledgeBaseToYaml(_0x3b4d66),_0x4eafa5=toExperimentalKnowledgeBaseYamlString(_0x43773a),_0x308e83=!a153_0x1775cb[_0x574861(0x20e)](_0x222079);let _0x358fa5=_0x308e83,_0xf24a8,_0x4b529d=_0x4eafa5;const _0x572160=[..._0x43773a[_0x574861(0x2ab)]][_0x574861(0x1ae)]((_0x28f4f7,_0x13c1ac)=>_0x28f4f7['name'][_0x574861(0x1ed)](_0x13c1ac['name']));for(const _0x4aaba8 of _0x572160){_0x4b529d+='\x0a---\x20function:\x20'+_0x4aaba8[_0x574861(0x244)]+_0x574861(0x1af)+_0x4aaba8[_0x574861(0x1f3)]+_0x574861(0x221)+_0x4aaba8[_0x574861(0x244)]+_0x574861(0x1af)+_0x4aaba8[_0x574861(0x2b0)]+'\x0a';}if(!_0x308e83){let _0x182222='';a153_0x1775cb[_0x574861(0x20e)](_0x2d7edd)&&(_0x182222=a153_0x1775cb['readFileSync'](_0x2d7edd,'utf-8'));if(a153_0x1775cb[_0x574861(0x20e)](_0x39c603)){const _0x3f85dc=a153_0x1775cb[_0x574861(0x1ee)](_0x39c603,{'withFileTypes':!![]}),_0x5ab8a0=_0x3f85dc[_0x574861(0x1d4)](_0x1a74a8=>_0x1a74a8['isDirectory']())[_0x574861(0x1ae)]((_0x978451,_0x547bf2)=>_0x978451[_0x574861(0x244)][_0x574861(0x1ed)](_0x547bf2['name']));for(const _0x3679e4 of _0x5ab8a0){const _0x4cce88=a153_0x4751bc[_0x574861(0x226)](_0x39c603,_0x3679e4[_0x574861(0x244)],_0x574861(0x1d0)),_0x3d9798=a153_0x4751bc[_0x574861(0x226)](_0x39c603,_0x3679e4['name'],'json_schema.json');a153_0x1775cb[_0x574861(0x20e)](_0x4cce88)&&(_0x182222+=_0x574861(0x1d6)+_0x3679e4[_0x574861(0x244)]+_0x574861(0x1af)+a153_0x1775cb[_0x574861(0x261)](_0x4cce88,_0x574861(0x18c))+'\x0a'),a153_0x1775cb[_0x574861(0x20e)](_0x3d9798)&&(_0x182222+='---\x20schema:\x20'+_0x3679e4[_0x574861(0x244)]+'\x20---\x0a'+a153_0x1775cb[_0x574861(0x261)](_0x3d9798,_0x574861(0x18c))+'\x0a');}}const _0xf7ecd8=generateDiff(_0x182222,_0x4b529d);_0x358fa5=hasChanges(_0xf7ecd8),_0x358fa5&&(_0xf24a8=formatDiffWithColors(_0xf7ecd8));}_0x378f04[_0x574861(0x1a0)]({'path':_0x222079,'content':'','isDir':!![]}),_0x378f04[_0x574861(0x1a0)]({'path':_0x2d7edd,'content':_0x4eafa5}),_0x378f04['push']({'path':_0x39c603,'content':'','isDir':!![]});for(const _0x351a66 of _0x43773a[_0x574861(0x2ab)]){const _0x246482=a153_0x4751bc[_0x574861(0x226)](_0x39c603,sanitizeForFilesystem(_0x351a66[_0x574861(0x244)])),_0x2b7a7f=a153_0x4751bc[_0x574861(0x226)](_0x246482,_0x574861(0x1d0)),_0x249743=a153_0x4751bc[_0x574861(0x226)](_0x246482,'json_schema.json');_0x378f04[_0x574861(0x1a0)]({'path':_0x246482,'content':'','isDir':!![]}),_0x378f04['push']({'path':_0x2b7a7f,'content':_0x351a66[_0x574861(0x1f3)]}),_0x378f04[_0x574861(0x1a0)]({'path':_0x249743,'content':_0x351a66[_0x574861(0x2b0)]});}if(a153_0x1775cb[_0x574861(0x20e)](_0x39c603)){const _0x247990=a153_0x1775cb[_0x574861(0x1ee)](_0x39c603,{'withFileTypes':!![]}),_0x63fafe=new Set(_0x43773a[_0x574861(0x2ab)][_0x574861(0x23a)](_0x5263a8=>sanitizeForFilesystem(_0x5263a8[_0x574861(0x244)])));for(const _0x37cd5b of _0x247990){if(_0x37cd5b[_0x574861(0x18b)]()&&!_0x63fafe[_0x574861(0x28b)](_0x37cd5b['name'])){const _0xd39317=a153_0x4751bc['join'](_0x39c603,_0x37cd5b[_0x574861(0x244)]);_0x402e89[_0x574861(0x1a0)]({'path':_0xd39317,'isDir':!![]});}}}_0x96b6fe[_0x574861(0x1f2)]['push']({'name':_0x3b4d66[_0x574861(0x25f)][_0x574861(0x244)],'outputPath':_0x222079,'isNew':_0x308e83,'hasChanges':_0x358fa5,'diff':_0xf24a8}),_0x96b6fe[_0x574861(0x29a)]['experimentalKnowledgeBases'][_0x574861(0x1b7)]++;if(_0x308e83)_0x96b6fe[_0x574861(0x29a)][_0x574861(0x1f2)][_0x574861(0x253)]++;else{if(_0x358fa5)_0x96b6fe[_0x574861(0x29a)]['experimentalKnowledgeBases']['updated']++;else _0x96b6fe[_0x574861(0x29a)][_0x574861(0x1f2)][_0x574861(0x29f)]++;}}for(const _0x1ab459 of _0x688c91){if(_0x1ab459[_0x574861(0x25f)][_0x574861(0x193)])continue;const _0x5ee0fa=getSanitizedPathWithMigration(getExperimentalArtifactsDir(_0x23662e),_0x1ab459[_0x574861(0x25f)][_0x574861(0x244)]);_0x5ee0fa['renamed']&&this[_0x574861(0x194)][_0x574861(0x228)]('Renamed\x20experimental\x20artifact\x20directory:\x20'+a153_0x4751bc[_0x574861(0x2b1)](_0x5ee0fa[_0x574861(0x21e)])+'\x20→\x20'+a153_0x4751bc[_0x574861(0x2b1)](_0x5ee0fa[_0x574861(0x26c)]));const _0x3067cb=_0x5ee0fa['path'],_0x3c1e21=a153_0x4751bc[_0x574861(0x226)](_0x3067cb,sanitizeForFilesystem(_0x1ab459[_0x574861(0x25f)][_0x574861(0x244)])+'.yml'),_0x3a5024=a153_0x4751bc['join'](_0x3067cb,_0x574861(0x1d0)),_0x13ba2b=a153_0x4751bc[_0x574861(0x226)](_0x3067cb,_0x574861(0x191)),_0xf9c94d=apiExperimentalArtifactToYaml(_0x1ab459),_0x5d2631=toExperimentalArtifactYamlString(_0xf9c94d),_0x2aba48=!a153_0x1775cb[_0x574861(0x20e)](_0x3067cb);let _0x2a4599=_0x2aba48,_0x43933f,_0x3b5ae4=_0x5d2631+(_0x574861(0x288)+_0xf9c94d['code']+'\x0a');const _0x7d9a6b=[..._0xf9c94d['files']][_0x574861(0x1ae)]((_0x443d24,_0x4bdd22)=>_0x443d24[_0x574861(0x211)][_0x574861(0x1ed)](_0x4bdd22[_0x574861(0x211)]));for(const _0x3b0136 of _0x7d9a6b){_0x3b5ae4+=_0x574861(0x1de)+_0x3b0136['file_name']+_0x574861(0x1af)+_0x3b0136[_0x574861(0x239)]+'\x0a';}if(!_0x2aba48){let _0x5c6697='';a153_0x1775cb[_0x574861(0x20e)](_0x3c1e21)&&(_0x5c6697=a153_0x1775cb[_0x574861(0x261)](_0x3c1e21,'utf-8'));a153_0x1775cb['existsSync'](_0x3a5024)&&(_0x5c6697+='\x0a---\x20code\x20---\x0a'+a153_0x1775cb[_0x574861(0x261)](_0x3a5024,_0x574861(0x18c))+'\x0a');if(a153_0x1775cb[_0x574861(0x20e)](_0x13ba2b)){const _0x337e4c=a153_0x1775cb[_0x574861(0x1ee)](_0x13ba2b),_0x1fcfa3=_0x337e4c[_0x574861(0x1d4)](_0x3d2165=>{const _0x220295=_0x574861,_0x12269e=a153_0x4751bc[_0x220295(0x226)](_0x13ba2b,_0x3d2165);return a153_0x1775cb[_0x220295(0x189)](_0x12269e)[_0x220295(0x217)]();})['sort']((_0x4ebe65,_0x3e9e32)=>_0x4ebe65[_0x574861(0x1ed)](_0x3e9e32));for(const _0x543ecf of _0x1fcfa3){const _0x4944e7=a153_0x4751bc[_0x574861(0x226)](_0x13ba2b,_0x543ecf);_0x5c6697+=_0x574861(0x1de)+_0x543ecf+_0x574861(0x1af)+a153_0x1775cb['readFileSync'](_0x4944e7,_0x574861(0x18c))+'\x0a';}}const _0x7dae3f=generateDiff(_0x5c6697,_0x3b5ae4);_0x2a4599=hasChanges(_0x7dae3f),_0x2a4599&&(_0x43933f=formatDiffWithColors(_0x7dae3f));}_0x378f04[_0x574861(0x1a0)]({'path':_0x3067cb,'content':'','isDir':!![]}),_0x378f04[_0x574861(0x1a0)]({'path':_0x3c1e21,'content':_0x5d2631}),_0x378f04[_0x574861(0x1a0)]({'path':_0x3a5024,'content':_0xf9c94d[_0x574861(0x1f3)]});if(_0xf9c94d[_0x574861(0x191)][_0x574861(0x1df)]>0x0){_0x378f04[_0x574861(0x1a0)]({'path':_0x13ba2b,'content':'','isDir':!![]});for(const _0x312fda of _0xf9c94d[_0x574861(0x191)]){const _0x2e4e9f=a153_0x4751bc[_0x574861(0x226)](_0x13ba2b,_0x312fda[_0x574861(0x211)]);_0x378f04[_0x574861(0x1a0)]({'path':_0x2e4e9f,'content':_0x312fda['text_content']});}}if(a153_0x1775cb[_0x574861(0x20e)](_0x13ba2b)){const _0x2efd99=a153_0x1775cb['readdirSync'](_0x13ba2b),_0x227500=new Set(_0xf9c94d[_0x574861(0x191)][_0x574861(0x23a)](_0x5dbce5=>_0x5dbce5[_0x574861(0x211)]));for(const _0x45b313 of _0x2efd99){const _0xef5a0d=a153_0x4751bc[_0x574861(0x226)](_0x13ba2b,_0x45b313);a153_0x1775cb[_0x574861(0x189)](_0xef5a0d)[_0x574861(0x217)]()&&!_0x227500['has'](_0x45b313)&&_0x402e89[_0x574861(0x1a0)]({'path':_0xef5a0d});}}_0x96b6fe[_0x574861(0x195)][_0x574861(0x1a0)]({'name':_0x1ab459[_0x574861(0x25f)][_0x574861(0x244)],'outputPath':_0x3067cb,'isNew':_0x2aba48,'hasChanges':_0x2a4599,'diff':_0x43933f}),_0x96b6fe[_0x574861(0x29a)][_0x574861(0x195)][_0x574861(0x1b7)]++;if(_0x2aba48)_0x96b6fe[_0x574861(0x29a)][_0x574861(0x195)][_0x574861(0x253)]++;else{if(_0x2a4599)_0x96b6fe['counts']['experimentalArtifacts'][_0x574861(0x192)]++;else _0x96b6fe['counts'][_0x574861(0x195)][_0x574861(0x29f)]++;}}for(const _0x4bcae7 of _0x1d6c29){const _0x2d011d=getSanitizedPathWithMigration(getFormInterfacesDir(_0x23662e),_0x4bcae7[_0x574861(0x25f)][_0x574861(0x244)],_0x574861(0x262));_0x2d011d[_0x574861(0x290)]&&this[_0x574861(0x194)][_0x574861(0x228)](_0x574861(0x245)+a153_0x4751bc[_0x574861(0x2b1)](_0x2d011d[_0x574861(0x21e)])+_0x574861(0x25d)+a153_0x4751bc['basename'](_0x2d011d[_0x574861(0x26c)]));const _0x49b833=_0x2d011d[_0x574861(0x26c)],_0x559a81=await apiFormInterfaceToYaml(_0x4bcae7,_0x294b77),_0x393884=toFormInterfaceYamlString(_0x559a81),_0x5daeda=!a153_0x1775cb[_0x574861(0x20e)](_0x49b833);let _0x494ae1=_0x5daeda,_0x4dcb3e;if(!_0x5daeda){const _0x4d3380=a153_0x1775cb['readFileSync'](_0x49b833,_0x574861(0x18c)),_0x192d55=generateDiff(_0x4d3380,_0x393884);_0x494ae1=hasChanges(_0x192d55),_0x494ae1&&(_0x4dcb3e=formatDiffWithColors(_0x192d55));}_0x378f04[_0x574861(0x1a0)]({'path':_0x49b833,'content':_0x393884}),_0x96b6fe[_0x574861(0x1a7)][_0x574861(0x1a0)]({'name':_0x4bcae7['attributes'][_0x574861(0x244)],'outputPath':_0x49b833,'isNew':_0x5daeda,'hasChanges':_0x494ae1,'diff':_0x4dcb3e}),_0x96b6fe[_0x574861(0x29a)][_0x574861(0x1a7)][_0x574861(0x1b7)]++;if(_0x5daeda)_0x96b6fe['counts'][_0x574861(0x1a7)][_0x574861(0x253)]++;else{if(_0x494ae1)_0x96b6fe[_0x574861(0x29a)][_0x574861(0x1a7)][_0x574861(0x192)]++;else _0x96b6fe['counts'][_0x574861(0x1a7)]['unchanged']++;}}for(const _0x1f0f49 of _0x2c0d4a){if(_0x1f0f49[_0x574861(0x25f)]['isManaged'])continue;const _0x8552ed=getSanitizedPathWithMigration(getChatInterfacesDir(_0x23662e),_0x1f0f49['attributes'][_0x574861(0x244)],_0x574861(0x262));_0x8552ed['renamed']&&this[_0x574861(0x194)][_0x574861(0x228)](_0x574861(0x25c)+a153_0x4751bc[_0x574861(0x2b1)](_0x8552ed[_0x574861(0x21e)])+_0x574861(0x25d)+a153_0x4751bc[_0x574861(0x2b1)](_0x8552ed['path']));const _0x514dfe=_0x8552ed[_0x574861(0x26c)],_0xdcfaf1=await apiChatInterfaceToYaml(_0x1f0f49,_0x294b77),_0x71ab8a=toChatInterfaceYamlString(_0xdcfaf1),_0x2ba485=!a153_0x1775cb[_0x574861(0x20e)](_0x514dfe);let _0x275613=_0x2ba485,_0x26abbf;if(!_0x2ba485){const _0xe43f7=a153_0x1775cb[_0x574861(0x261)](_0x514dfe,'utf-8'),_0x514c7a=generateDiff(_0xe43f7,_0x71ab8a);_0x275613=hasChanges(_0x514c7a),_0x275613&&(_0x26abbf=formatDiffWithColors(_0x514c7a));}_0x378f04['push']({'path':_0x514dfe,'content':_0x71ab8a}),_0x96b6fe[_0x574861(0x198)][_0x574861(0x1a0)]({'name':_0x1f0f49[_0x574861(0x25f)][_0x574861(0x244)],'outputPath':_0x514dfe,'isNew':_0x2ba485,'hasChanges':_0x275613,'diff':_0x26abbf}),_0x96b6fe[_0x574861(0x29a)]['chatInterfaces']['total']++;if(_0x2ba485)_0x96b6fe[_0x574861(0x29a)][_0x574861(0x198)]['new']++;else{if(_0x275613)_0x96b6fe[_0x574861(0x29a)][_0x574861(0x198)][_0x574861(0x192)]++;else _0x96b6fe[_0x574861(0x29a)][_0x574861(0x198)][_0x574861(0x29f)]++;}}if(_0x406a48?.[_0x574861(0x208)])return _0x96b6fe;a153_0x1775cb[_0x574861(0x1d7)](_0x23662e,{'recursive':!![]}),a153_0x1775cb[_0x574861(0x1d7)](getKnowledgeBasesDir(_0x23662e),{'recursive':!![]}),a153_0x1775cb[_0x574861(0x1d7)](getPromptsDir(_0x23662e),{'recursive':!![]}),a153_0x1775cb['mkdirSync'](getIntegrationsDir(_0x23662e),{'recursive':!![]}),a153_0x1775cb['mkdirSync'](getExperimentalKnowledgeBasesDir(_0x23662e),{'recursive':!![]}),a153_0x1775cb[_0x574861(0x1d7)](getExperimentalArtifactsDir(_0x23662e),{'recursive':!![]}),a153_0x1775cb[_0x574861(0x1d7)](getFormInterfacesDir(_0x23662e),{'recursive':!![]}),a153_0x1775cb[_0x574861(0x1d7)](getChatInterfacesDir(_0x23662e),{'recursive':!![]});const _0x43dfe1=a153_0x4751bc['join'](_0x23662e,'tdx.json');a153_0x1775cb[_0x574861(0x258)](_0x43dfe1,createAgentConfigContent(_0x40ee02));for(const _0x454971 of _0x378f04){if(_0x454971['isDir'])a153_0x1775cb[_0x574861(0x1d7)](_0x454971['path'],{'recursive':!![]});else{const _0x4a7c52=a153_0x4751bc[_0x574861(0x1b4)](_0x454971[_0x574861(0x26c)]);!a153_0x1775cb['existsSync'](_0x4a7c52)&&a153_0x1775cb[_0x574861(0x1d7)](_0x4a7c52,{'recursive':!![]}),a153_0x1775cb['writeFileSync'](_0x454971['path'],_0x454971[_0x574861(0x27f)]);}}for(const _0x537fcc of _0x402e89){_0x537fcc[_0x574861(0x20b)]?(a153_0x1775cb[_0x574861(0x2a9)](_0x537fcc['path'],{'recursive':!![],'force':!![]}),this[_0x574861(0x194)]['info'](_0x574861(0x1e5)+a153_0x4751bc[_0x574861(0x2b1)](a153_0x4751bc[_0x574861(0x1b4)](_0x537fcc[_0x574861(0x26c)]))+'/'+a153_0x4751bc['basename'](_0x537fcc['path']))):(a153_0x1775cb['rmSync'](_0x537fcc[_0x574861(0x26c)],{'force':!![]}),this[_0x574861(0x194)][_0x574861(0x228)](_0x574861(0x199)+a153_0x4751bc['basename'](a153_0x4751bc[_0x574861(0x1b4)](_0x537fcc[_0x574861(0x26c)]))+'/'+a153_0x4751bc['basename'](_0x537fcc['path'])));}return _0x96b6fe;}async['pushProject'](_0x234615,_0x468f43){const _0x5305d8=a153_0x13235f,_0x3e322a=a153_0x4751bc[_0x5305d8(0x226)](_0x234615,_0x5305d8(0x204));if(!a153_0x1775cb['existsSync'](_0x3e322a))throw new SDKError(ErrorCode[_0x5305d8(0x232)],_0x5305d8(0x28d)+_0x234615,undefined,{'helpText':_0x5305d8(0x1c1)});const _0x8cdf57=loadAgentConfig(_0x3e322a),_0x464fda=await this[_0x5305d8(0x1cc)](_0x8cdf57[_0x5305d8(0x278)]),_0x19936f=await this[_0x5305d8(0x2a1)][_0x5305d8(0x1c3)](_0x464fda),_0x556d3b=_0x19936f[_0x5305d8(0x25f)][_0x5305d8(0x244)],_0x51fd7f={'projectName':_0x556d3b,'projectId':_0x464fda,'agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}}},_0x21732e=[],_0x1bc025=[],_0x1f1cf9=[],_0x11f2b8=[],_0x359c5e=[],_0x2a412d=[],_0x2ec5d4=a153_0x1775cb[_0x5305d8(0x1ee)](_0x234615,{'withFileTypes':!![]});for(const _0x3c6c63 of _0x2ec5d4){if(!_0x3c6c63[_0x5305d8(0x18b)]())continue;if(['knowledge_bases',_0x5305d8(0x1c0),_0x5305d8(0x1e3),'experimental_knowledge_bases',_0x5305d8(0x29e),_0x5305d8(0x250),_0x5305d8(0x209)][_0x5305d8(0x237)](_0x3c6c63[_0x5305d8(0x244)]))continue;const _0x12ca05=a153_0x4751bc[_0x5305d8(0x226)](_0x234615,_0x3c6c63[_0x5305d8(0x244)]);if(isAgentDir(_0x12ca05)){const _0x29f1cd=a153_0x4751bc[_0x5305d8(0x226)](_0x12ca05,_0x5305d8(0x1e9)),_0xbaf8b3=a153_0x4751bc[_0x5305d8(0x226)](_0x12ca05,_0x5305d8(0x266)),_0x3a6d6b=a153_0x4751bc[_0x5305d8(0x226)](_0x12ca05,_0x5305d8(0x243)),_0x4b7195=parseAgentYaml(a153_0x1775cb[_0x5305d8(0x261)](_0x29f1cd,_0x5305d8(0x18c)),_0x29f1cd),_0x2e8886=a153_0x1775cb[_0x5305d8(0x20e)](_0xbaf8b3)?a153_0x1775cb['readFileSync'](_0xbaf8b3,'utf-8'):'',_0x521cca=a153_0x1775cb[_0x5305d8(0x20e)](_0x3a6d6b)?a153_0x1775cb[_0x5305d8(0x261)](_0x3a6d6b,_0x5305d8(0x18c)):_0x4b7195['starter_message'];_0x21732e[_0x5305d8(0x1a0)]({'name':_0x4b7195['name'],'dir':_0x12ca05,'yaml':_0x4b7195,'systemPrompt':_0x2e8886,'starterMessage':_0x521cca});}}const _0x50f029=getKnowledgeBasesDir(_0x234615);if(a153_0x1775cb['existsSync'](_0x50f029)){const _0x3ab555=a153_0x1775cb[_0x5305d8(0x1ee)](_0x50f029);for(const _0x4b4444 of _0x3ab555){const _0x61a984=a153_0x4751bc[_0x5305d8(0x226)](_0x50f029,_0x4b4444);if(_0x4b4444[_0x5305d8(0x1fd)]('.yml')){const _0x37338d=parseKnowledgeBaseYaml(a153_0x1775cb[_0x5305d8(0x261)](_0x61a984,_0x5305d8(0x18c)),_0x61a984);_0x1bc025[_0x5305d8(0x1a0)]({'name':_0x37338d[_0x5305d8(0x244)],'path':_0x61a984,'yaml':_0x37338d});}else{if(_0x4b4444['endsWith']('.md')){const _0x42f346=a153_0x1775cb[_0x5305d8(0x261)](_0x61a984,_0x5305d8(0x18c)),{name:_0x1bb167,text:_0x1ef340}=parseTextKnowledgeBaseMd(_0x42f346,_0x4b4444);_0x1f1cf9[_0x5305d8(0x1a0)]({'name':_0x1bb167,'path':_0x61a984,'text':_0x1ef340});}}}}const _0x455aa7=getPromptsDir(_0x234615);if(a153_0x1775cb[_0x5305d8(0x20e)](_0x455aa7)){const _0x1966dd=a153_0x1775cb[_0x5305d8(0x1ee)](_0x455aa7)[_0x5305d8(0x1d4)](_0x8a5302=>_0x8a5302['endsWith']('.yml'));for(const _0x1a2dd6 of _0x1966dd){const _0xc229cf=a153_0x4751bc[_0x5305d8(0x226)](_0x455aa7,_0x1a2dd6),_0x46ee22=parsePromptYaml(a153_0x1775cb['readFileSync'](_0xc229cf,_0x5305d8(0x18c)),_0xc229cf);_0x11f2b8['push']({'name':_0x46ee22[_0x5305d8(0x244)],'path':_0xc229cf,'yaml':_0x46ee22});}}const _0x2dded2=[],_0x313ed7=getIntegrationsDir(_0x234615);if(a153_0x1775cb[_0x5305d8(0x20e)](_0x313ed7)){const _0x2dcdcb=a153_0x1775cb[_0x5305d8(0x1ee)](_0x313ed7)[_0x5305d8(0x1d4)](_0x1ebb36=>_0x1ebb36['endsWith']('.yml'));for(const _0x449546 of _0x2dcdcb){const _0x26bd1c=a153_0x4751bc['join'](_0x313ed7,_0x449546),_0x475799=parseIntegrationYaml(a153_0x1775cb[_0x5305d8(0x261)](_0x26bd1c,'utf-8'),_0x26bd1c);if(!SAFE_INTEGRATION_TYPES[_0x5305d8(0x237)](_0x475799[_0x5305d8(0x22f)][_0x5305d8(0x274)]())){this[_0x5305d8(0x194)][_0x5305d8(0x27d)](_0x5305d8(0x22d)+_0x475799[_0x5305d8(0x244)]+_0x5305d8(0x210)+_0x475799[_0x5305d8(0x22f)]+_0x5305d8(0x201)+(_0x5305d8(0x240)+SAFE_INTEGRATION_TYPES[_0x5305d8(0x226)](',\x20')+_0x5305d8(0x20c))+'Configure\x20WEBHOOK/SLACK\x20integrations\x20manually\x20in\x20the\x20UI.');continue;}_0x2dded2[_0x5305d8(0x1a0)]({'name':_0x475799['name'],'path':_0x26bd1c,'yaml':_0x475799});}}const _0x305866=getExperimentalKnowledgeBasesDir(_0x234615);if(a153_0x1775cb['existsSync'](_0x305866)){const _0x183c4a=a153_0x1775cb[_0x5305d8(0x1ee)](_0x305866,{'withFileTypes':!![]});for(const _0x20b02a of _0x183c4a){if(!_0x20b02a[_0x5305d8(0x18b)]())continue;const _0x2cf507=a153_0x4751bc[_0x5305d8(0x226)](_0x305866,_0x20b02a[_0x5305d8(0x244)]),_0x4ca8d1=a153_0x4751bc[_0x5305d8(0x226)](_0x2cf507,_0x20b02a[_0x5305d8(0x244)]+_0x5305d8(0x262)),_0x48f57d=a153_0x4751bc[_0x5305d8(0x226)](_0x2cf507,_0x5305d8(0x2ab));if(!a153_0x1775cb[_0x5305d8(0x20e)](_0x4ca8d1))continue;const _0x59b557=parseExperimentalKnowledgeBaseYaml(a153_0x1775cb[_0x5305d8(0x261)](_0x4ca8d1,'utf-8'),_0x4ca8d1),_0x553dfb=[];if(a153_0x1775cb[_0x5305d8(0x20e)](_0x48f57d)){const _0x43cc74=a153_0x1775cb[_0x5305d8(0x1ee)](_0x48f57d,{'withFileTypes':!![]});for(const _0x5dda3c of _0x43cc74){if(!_0x5dda3c[_0x5305d8(0x18b)]())continue;const _0x4bd323=a153_0x4751bc[_0x5305d8(0x226)](_0x48f57d,_0x5dda3c['name']),_0x4683ab=a153_0x4751bc['join'](_0x4bd323,_0x5305d8(0x1d0)),_0x1cb917=a153_0x4751bc['join'](_0x4bd323,_0x5305d8(0x1f5));a153_0x1775cb[_0x5305d8(0x20e)](_0x4683ab)&&a153_0x1775cb[_0x5305d8(0x20e)](_0x1cb917)&&_0x553dfb['push']({'name':_0x5dda3c[_0x5305d8(0x244)],'code':a153_0x1775cb[_0x5305d8(0x261)](_0x4683ab,'utf-8'),'json_schema':a153_0x1775cb[_0x5305d8(0x261)](_0x1cb917,_0x5305d8(0x18c))});}}const _0x5cf2e1={..._0x59b557,'variables':_0x59b557[_0x5305d8(0x2a3)]||[],'functions':_0x553dfb};_0x359c5e[_0x5305d8(0x1a0)]({'name':_0x59b557[_0x5305d8(0x244)],'dir':_0x2cf507,'def':_0x5cf2e1});}}const _0x451bb7=getExperimentalArtifactsDir(_0x234615);if(a153_0x1775cb[_0x5305d8(0x20e)](_0x451bb7)){const _0x4455ec=a153_0x1775cb['readdirSync'](_0x451bb7,{'withFileTypes':!![]});for(const _0x4b3c2b of _0x4455ec){if(!_0x4b3c2b[_0x5305d8(0x18b)]())continue;const _0x48c6e2=a153_0x4751bc['join'](_0x451bb7,_0x4b3c2b['name']),_0x2b2ecc=a153_0x4751bc[_0x5305d8(0x226)](_0x48c6e2,_0x4b3c2b['name']+_0x5305d8(0x262)),_0x1c9427=a153_0x4751bc[_0x5305d8(0x226)](_0x48c6e2,'code.js'),_0x4f920f=a153_0x4751bc[_0x5305d8(0x226)](_0x48c6e2,'files');if(!a153_0x1775cb[_0x5305d8(0x20e)](_0x2b2ecc)||!a153_0x1775cb[_0x5305d8(0x20e)](_0x1c9427))continue;const _0xe3dbb0=parseExperimentalArtifactYaml(a153_0x1775cb[_0x5305d8(0x261)](_0x2b2ecc,_0x5305d8(0x18c)),_0x2b2ecc),_0x4f758a=a153_0x1775cb['readFileSync'](_0x1c9427,_0x5305d8(0x18c)),_0x161305=[];if(a153_0x1775cb[_0x5305d8(0x20e)](_0x4f920f)){const _0x210558=a153_0x1775cb[_0x5305d8(0x1ee)](_0x4f920f);for(const _0x2eb1b1 of _0x210558){const _0x4270e2=a153_0x4751bc[_0x5305d8(0x226)](_0x4f920f,_0x2eb1b1);a153_0x1775cb[_0x5305d8(0x189)](_0x4270e2)[_0x5305d8(0x217)]()&&_0x161305['push']({'file_name':_0x2eb1b1,'text_content':a153_0x1775cb[_0x5305d8(0x261)](_0x4270e2,_0x5305d8(0x18c))});}}const _0x42872a={..._0xe3dbb0,'code':_0x4f758a,'files':_0x161305};_0x2a412d[_0x5305d8(0x1a0)]({'name':_0xe3dbb0[_0x5305d8(0x244)],'dir':_0x48c6e2,'def':_0x42872a});}}const _0x4ea776=[],_0x48f912=getFormInterfacesDir(_0x234615);if(a153_0x1775cb[_0x5305d8(0x20e)](_0x48f912)){const _0x38754f=a153_0x1775cb[_0x5305d8(0x1ee)](_0x48f912)['filter'](_0xcb3102=>_0xcb3102[_0x5305d8(0x1fd)](_0x5305d8(0x262)));for(const _0x3797b2 of _0x38754f){const _0x15b228=a153_0x4751bc[_0x5305d8(0x226)](_0x48f912,_0x3797b2),_0x24072b=parseFormInterfaceYaml(a153_0x1775cb[_0x5305d8(0x261)](_0x15b228,_0x5305d8(0x18c)),_0x15b228);_0x4ea776[_0x5305d8(0x1a0)]({'name':_0x24072b[_0x5305d8(0x244)],'path':_0x15b228,'yaml':_0x24072b});}}const _0x195adb=[],_0x1f858f=getChatInterfacesDir(_0x234615);if(a153_0x1775cb[_0x5305d8(0x20e)](_0x1f858f)){const _0x32e300=a153_0x1775cb['readdirSync'](_0x1f858f)[_0x5305d8(0x1d4)](_0x40fe19=>_0x40fe19[_0x5305d8(0x1fd)](_0x5305d8(0x262)));for(const _0x30788a of _0x32e300){const _0x17db7e=a153_0x4751bc[_0x5305d8(0x226)](_0x1f858f,_0x30788a),_0x58b35f=parseChatInterfaceYaml(a153_0x1775cb[_0x5305d8(0x261)](_0x17db7e,_0x5305d8(0x18c)),_0x17db7e);_0x195adb['push']({'name':_0x58b35f[_0x5305d8(0x244)],'path':_0x17db7e,'yaml':_0x58b35f});}}const _0x2d5401=await this[_0x5305d8(0x2a1)]['listAgentsFull'](_0x464fda),_0x51ef8a=await this['client'][_0x5305d8(0x2af)](_0x464fda),_0x41e8da=await this['client'][_0x5305d8(0x1c2)](_0x464fda),_0x37e0ba=await this[_0x5305d8(0x2a1)][_0x5305d8(0x281)](_0x464fda),_0x1c20bc=await this['client']['listIntegrations'](_0x464fda),_0x58d599=await safeListOrEmpty(()=>this[_0x5305d8(0x2a1)][_0x5305d8(0x23b)](_0x464fda)),_0x3d87c9=await safeListOrEmpty(()=>this[_0x5305d8(0x2a1)][_0x5305d8(0x24c)](_0x464fda)),_0x4b7db6=await safeListOrEmpty(()=>this[_0x5305d8(0x2a1)][_0x5305d8(0x230)](_0x464fda)),_0x118c67=await safeListOrEmpty(()=>this[_0x5305d8(0x2a1)]['listChatInterfaces'](_0x464fda)),_0x4ac253=await fetchAllToolTargetMaps((_0x2b0d0f,_0x267175)=>this[_0x5305d8(0x2a1)][_0x5305d8(0x271)](_0x2b0d0f,_0x267175),_0x464fda),_0x3beff3=new Map(),_0x41c95a=new Map(),_0x413c18=new Map(),_0x2bccf5=new Map(),_0x2be063=new Map(),_0x146a65=new Map(),_0x2b359b=new Map();for(const _0x461148 of _0x2d5401){_0x3beff3[_0x5305d8(0x254)](_0x461148['attributes']['name'],_0x461148);}for(const _0x13a11d of _0x51ef8a){_0x41c95a['set'](_0x13a11d[_0x5305d8(0x25f)][_0x5305d8(0x244)],_0x13a11d);}for(const _0x54653d of _0x41e8da){_0x413c18['set'](_0x54653d[_0x5305d8(0x25f)]['name'],_0x54653d);}for(const _0x522e7a of _0x37e0ba){_0x2bccf5[_0x5305d8(0x254)](_0x522e7a[_0x5305d8(0x25f)][_0x5305d8(0x244)],_0x522e7a);}for(const _0x13fe4e of _0x1c20bc){_0x2be063[_0x5305d8(0x254)](_0x13fe4e['attributes'][_0x5305d8(0x231)][_0x5305d8(0x274)](),_0x13fe4e);}for(const _0x4396d3 of _0x58d599){_0x146a65[_0x5305d8(0x254)](_0x4396d3['attributes']['name'],_0x4396d3);}for(const _0x13bd75 of _0x3d87c9){_0x2b359b[_0x5305d8(0x254)](_0x13bd75[_0x5305d8(0x25f)][_0x5305d8(0x244)],_0x13bd75);}const _0x54cb2e=new Map(),_0x55aed2=new Map();for(const _0x2afe3e of _0x4b7db6){_0x54cb2e[_0x5305d8(0x254)](_0x2afe3e['attributes'][_0x5305d8(0x244)],_0x2afe3e);}for(const _0x589759 of _0x118c67){_0x55aed2['set'](_0x589759[_0x5305d8(0x25f)][_0x5305d8(0x244)],_0x589759);}const _0x558c83=new Map(),_0xc1a6db=new Map();for(const _0x68c9ac of _0x2d5401){_0x558c83[_0x5305d8(0x254)](_0x68c9ac['attributes'][_0x5305d8(0x244)],_0x68c9ac['id']),_0xc1a6db[_0x5305d8(0x254)](_0x68c9ac['id'],_0x68c9ac['attributes'][_0x5305d8(0x244)]);}const _0x18b74e=new Map(),_0x2a8df6=new Map();for(const _0x24901d of _0x37e0ba){_0x18b74e['set'](_0x24901d['attributes'][_0x5305d8(0x244)],_0x24901d['id']),_0x2a8df6[_0x5305d8(0x254)](_0x24901d['id'],_0x24901d['attributes']['name']);}const _0x11e5f7=_0x4ac253['nameToId'][_0x5305d8(0x269)]||new Map(),_0x579f9e=_0x4ac253['nameToId'][_0x5305d8(0x212)]||new Map(),_0x16ac60=_0x4ac253[_0x5305d8(0x1ea)][_0x5305d8(0x22e)]||new Map(),_0x32c288=new Map(),_0x3223d6={'resolveToolTargetName':buildNameResolver({..._0x4ac253['idToName'],'Agent':_0xc1a6db}),'resolvePromptName':async _0x44de68=>_0x2a8df6[_0x5305d8(0x1f6)](_0x44de68),'onWarning':_0x2afcf4=>this[_0x5305d8(0x194)][_0x5305d8(0x27d)](_0x2afcf4)};let _0x5195ac=[];const _0xb43c0d={'projectId':_0x464fda,'resolveToolTargetId':buildIdResolver({..._0x4ac253[_0x5305d8(0x1ea)],'Agent':_0x558c83}),'resolvePromptId':async _0x1dc8bf=>_0x18b74e[_0x5305d8(0x1f6)](_0x1dc8bf),'onWarning':_0x37a1d5=>{const _0x3b1ecd=_0x5305d8;this['logger']['warn'](_0x37a1d5),_0x5195ac[_0x3b1ecd(0x1a0)](_0x37a1d5);}},{resolved:_0x773a19,unresolved:_0x580b27}=resolveAgentDependencies(_0x21732e,new Set(_0x3beff3[_0x5305d8(0x1c8)]()));for(const {agent:_0x113bdf,missingDeps:_0x9f4bfa}of _0x580b27){_0x51fd7f[_0x5305d8(0x2a7)][_0x5305d8(0x1a0)]({'agentName':_0x113bdf[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':_0x5305d8(0x1e0),'error':_0x5305d8(0x1cd)+_0x9f4bfa['join'](',\x20')+_0x5305d8(0x29b)}),_0x51fd7f['counts'][_0x5305d8(0x2a7)][_0x5305d8(0x270)]++;}for(const _0x198d20 of _0x1bc025){const _0xf7d30f=_0x41c95a[_0x5305d8(0x1f6)](_0x198d20[_0x5305d8(0x1a5)][_0x5305d8(0x244)]),_0x3e2f1b=a153_0x1775cb['readFileSync'](_0x198d20[_0x5305d8(0x26c)],_0x5305d8(0x18c));if(_0xf7d30f){const _0x50db32=apiKnowledgeBaseToYaml(_0xf7d30f),_0x27c066=toKnowledgeBaseYamlString(_0x50db32),_0x3cd3fc=generateDiff(_0x27c066,_0x3e2f1b),_0x604f30=hasChanges(_0x3cd3fc);_0x604f30?(_0x51fd7f[_0x5305d8(0x197)]['push']({'name':_0x198d20['yaml'][_0x5305d8(0x244)],'action':_0x5305d8(0x192),'id':_0xf7d30f['id'],'diff':formatDiffWithColors(_0x3cd3fc)}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x197)][_0x5305d8(0x192)]++):(_0x51fd7f[_0x5305d8(0x197)][_0x5305d8(0x1a0)]({'name':_0x198d20[_0x5305d8(0x1a5)]['name'],'action':_0x5305d8(0x29f),'id':_0xf7d30f['id']}),_0x51fd7f[_0x5305d8(0x29a)]['knowledgeBases'][_0x5305d8(0x29f)]++);}else _0x51fd7f[_0x5305d8(0x197)]['push']({'name':_0x198d20[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':_0x5305d8(0x28e)}),_0x51fd7f['counts']['knowledgeBases'][_0x5305d8(0x28e)]++;}for(const _0xea1700 of _0x1f1cf9){const _0x354d00=_0x413c18[_0x5305d8(0x1f6)](_0xea1700[_0x5305d8(0x244)]),_0x110988=a153_0x1775cb['readFileSync'](_0xea1700[_0x5305d8(0x26c)],_0x5305d8(0x18c));if(_0x354d00){const _0x225860=toTextKnowledgeBaseMd(_0x354d00['attributes']['name'],_0x354d00[_0x5305d8(0x25f)][_0x5305d8(0x24a)]),_0x196e32=generateDiff(_0x225860,_0x110988),_0x21f5fe=hasChanges(_0x196e32);_0x21f5fe?(_0x51fd7f[_0x5305d8(0x272)][_0x5305d8(0x1a0)]({'name':_0xea1700[_0x5305d8(0x244)],'action':_0x5305d8(0x192),'id':_0x354d00['id'],'diff':formatDiffWithColors(_0x196e32)}),_0x51fd7f['counts']['textKnowledgeBases'][_0x5305d8(0x192)]++):(_0x51fd7f[_0x5305d8(0x272)][_0x5305d8(0x1a0)]({'name':_0xea1700[_0x5305d8(0x244)],'action':'unchanged','id':_0x354d00['id']}),_0x51fd7f[_0x5305d8(0x29a)]['textKnowledgeBases'][_0x5305d8(0x29f)]++);}else _0x51fd7f[_0x5305d8(0x272)][_0x5305d8(0x1a0)]({'name':_0xea1700['name'],'action':_0x5305d8(0x28e)}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x272)][_0x5305d8(0x28e)]++;}for(const _0x572954 of _0x773a19){const _0x3add34=_0x3beff3['get'](_0x572954['yaml'][_0x5305d8(0x244)]),_0x3aa958=a153_0x4751bc[_0x5305d8(0x226)](_0x572954[_0x5305d8(0x1ec)],_0x5305d8(0x1e9)),_0x168f92=a153_0x1775cb[_0x5305d8(0x261)](_0x3aa958,_0x5305d8(0x18c)),_0x194998=_0x572954[_0x5305d8(0x1f9)],_0x42171f=_0x5305d8(0x25a)+_0x194998+_0x5305d8(0x20f)+_0x168f92;if(_0x3add34){const {yaml:_0x3b3d02,systemPrompt:_0x5602f0}=await agentResponseToDef(_0x3add34,_0x3223d6),_0x41be27=toAgentYamlString(_0x3b3d02),_0x227f9a=_0x5305d8(0x25a)+_0x5602f0+_0x5305d8(0x20f)+_0x41be27,_0x49ae20=generateDiff(_0x227f9a,_0x42171f),_0x38a000=hasChanges(_0x49ae20);_0x38a000?(_0x51fd7f['agents'][_0x5305d8(0x1a0)]({'agentName':_0x572954[_0x5305d8(0x1a5)]['name'],'action':_0x5305d8(0x192),'agentId':_0x3add34['id'],'diff':formatDiffWithColors(_0x49ae20)}),_0x51fd7f[_0x5305d8(0x29a)]['agents'][_0x5305d8(0x192)]++):(_0x51fd7f['agents'][_0x5305d8(0x1a0)]({'agentName':_0x572954[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':_0x5305d8(0x29f),'agentId':_0x3add34['id']}),_0x51fd7f[_0x5305d8(0x29a)]['agents'][_0x5305d8(0x29f)]++);}else _0x51fd7f[_0x5305d8(0x2a7)][_0x5305d8(0x1a0)]({'agentName':_0x572954[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':_0x5305d8(0x28e)}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x2a7)]['created']++;}for(const _0x4fa337 of _0x11f2b8){const _0x230c6f=_0x2bccf5[_0x5305d8(0x1f6)](_0x4fa337['yaml'][_0x5305d8(0x244)]),_0x32ea32=a153_0x1775cb['readFileSync'](_0x4fa337[_0x5305d8(0x26c)],'utf-8');if(_0x230c6f){const _0x5bb01a=await apiPromptToYaml(_0x230c6f,_0x3223d6);if(!_0x5bb01a){_0x51fd7f['prompts'][_0x5305d8(0x1a0)]({'name':_0x4fa337[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':_0x5305d8(0x192),'id':_0x230c6f['id']}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1c0)][_0x5305d8(0x192)]++;continue;}const _0x3756ba=toPromptYamlString(_0x5bb01a),_0x542b20=generateDiff(_0x3756ba,_0x32ea32),_0x4c6a50=hasChanges(_0x542b20);_0x4c6a50?(_0x51fd7f[_0x5305d8(0x1c0)][_0x5305d8(0x1a0)]({'name':_0x4fa337[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':_0x5305d8(0x192),'id':_0x230c6f['id'],'diff':formatDiffWithColors(_0x542b20)}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1c0)]['updated']++):(_0x51fd7f[_0x5305d8(0x1c0)]['push']({'name':_0x4fa337['yaml']['name'],'action':'unchanged','id':_0x230c6f['id']}),_0x51fd7f['counts'][_0x5305d8(0x1c0)][_0x5305d8(0x29f)]++);}else _0x51fd7f[_0x5305d8(0x1c0)][_0x5305d8(0x1a0)]({'name':_0x4fa337[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':_0x5305d8(0x28e)}),_0x51fd7f['counts']['prompts'][_0x5305d8(0x28e)]++;}for(const _0x20c20d of _0x2dded2){const _0x5a65b3=_0x2be063['get'](_0x20c20d['yaml'][_0x5305d8(0x22f)]),_0x1ee6a4=a153_0x1775cb[_0x5305d8(0x261)](_0x20c20d[_0x5305d8(0x26c)],_0x5305d8(0x18c));if(_0x5a65b3){const _0x257fa2=await apiIntegrationToYaml(_0x5a65b3,_0x3223d6),_0x2f7073=toIntegrationYamlString(_0x257fa2),_0x3fce24=generateDiff(_0x2f7073,_0x1ee6a4),_0x4c34ba=hasChanges(_0x3fce24);_0x4c34ba?(_0x51fd7f[_0x5305d8(0x1e3)][_0x5305d8(0x1a0)]({'name':_0x20c20d[_0x5305d8(0x1a5)][_0x5305d8(0x22f)],'action':_0x5305d8(0x192),'id':_0x5a65b3['id'],'diff':formatDiffWithColors(_0x3fce24)}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1e3)][_0x5305d8(0x192)]++):(_0x51fd7f['integrations']['push']({'name':_0x20c20d['yaml'][_0x5305d8(0x22f)],'action':_0x5305d8(0x29f),'id':_0x5a65b3['id']}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1e3)]['unchanged']++);}else _0x51fd7f['integrations'][_0x5305d8(0x1a0)]({'name':_0x20c20d[_0x5305d8(0x1a5)][_0x5305d8(0x22f)],'action':_0x5305d8(0x28e)}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1e3)]['created']++;}for(const _0xb8eacc of _0x359c5e){const _0x4e4886=_0x146a65['get'](_0xb8eacc['def'][_0x5305d8(0x244)]),_0x29e5be=toExperimentalKnowledgeBaseYamlString(_0xb8eacc[_0x5305d8(0x265)]);let _0x1f5406=_0x29e5be;for(const _0x569d63 of _0xb8eacc[_0x5305d8(0x265)][_0x5305d8(0x2ab)]){_0x1f5406+=_0x5305d8(0x1d6)+_0x569d63['name']+_0x5305d8(0x1af)+_0x569d63['code']+_0x5305d8(0x221)+_0x569d63[_0x5305d8(0x244)]+_0x5305d8(0x1af)+_0x569d63[_0x5305d8(0x2b0)]+'\x0a';}if(_0x4e4886){const _0x46b5b8=apiExperimentalKnowledgeBaseToYaml(_0x4e4886),_0xaeffdf=toExperimentalKnowledgeBaseYamlString(_0x46b5b8);let _0x9d4bd9=_0xaeffdf;for(const _0x2ac554 of _0x46b5b8[_0x5305d8(0x2ab)]){_0x9d4bd9+='\x0a---\x20function:\x20'+_0x2ac554[_0x5305d8(0x244)]+'\x20---\x0a'+_0x2ac554[_0x5305d8(0x1f3)]+'\x0a---\x20schema:\x20'+_0x2ac554[_0x5305d8(0x244)]+_0x5305d8(0x1af)+_0x2ac554['json_schema']+'\x0a';}const _0xedf7cd=generateDiff(_0x9d4bd9,_0x1f5406),_0x5197be=hasChanges(_0xedf7cd);_0x5197be?(_0x51fd7f[_0x5305d8(0x1f2)][_0x5305d8(0x1a0)]({'name':_0xb8eacc[_0x5305d8(0x265)]['name'],'action':_0x5305d8(0x192),'id':_0x4e4886['id'],'diff':formatDiffWithColors(_0xedf7cd)}),_0x51fd7f[_0x5305d8(0x29a)]['experimentalKnowledgeBases'][_0x5305d8(0x192)]++):(_0x51fd7f['experimentalKnowledgeBases'][_0x5305d8(0x1a0)]({'name':_0xb8eacc[_0x5305d8(0x265)][_0x5305d8(0x244)],'action':'unchanged','id':_0x4e4886['id']}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1f2)][_0x5305d8(0x29f)]++);}else _0x51fd7f[_0x5305d8(0x1f2)][_0x5305d8(0x1a0)]({'name':_0xb8eacc[_0x5305d8(0x265)][_0x5305d8(0x244)],'action':_0x5305d8(0x28e)}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1f2)][_0x5305d8(0x28e)]++;}for(const _0x3aa19c of _0x2a412d){const _0x46b331=_0x2b359b[_0x5305d8(0x1f6)](_0x3aa19c['def'][_0x5305d8(0x244)]),_0x216b0d=toExperimentalArtifactYamlString(_0x3aa19c[_0x5305d8(0x265)]);let _0x3ddae8=_0x216b0d+(_0x5305d8(0x288)+_0x3aa19c[_0x5305d8(0x265)][_0x5305d8(0x1f3)]+'\x0a');for(const _0x57c688 of _0x3aa19c[_0x5305d8(0x265)][_0x5305d8(0x191)]){_0x3ddae8+=_0x5305d8(0x1de)+_0x57c688[_0x5305d8(0x211)]+_0x5305d8(0x1af)+_0x57c688[_0x5305d8(0x239)]+'\x0a';}if(_0x46b331){const _0x2af14c=apiExperimentalArtifactToYaml(_0x46b331),_0x465047=toExperimentalArtifactYamlString(_0x2af14c);let _0x5eadd7=_0x465047+(_0x5305d8(0x288)+_0x2af14c['code']+'\x0a');for(const _0x341e43 of _0x2af14c['files']){_0x5eadd7+=_0x5305d8(0x1de)+_0x341e43['file_name']+_0x5305d8(0x1af)+_0x341e43[_0x5305d8(0x239)]+'\x0a';}const _0x20f046=generateDiff(_0x5eadd7,_0x3ddae8),_0x4df7e1=hasChanges(_0x20f046);_0x4df7e1?(_0x51fd7f['experimentalArtifacts'][_0x5305d8(0x1a0)]({'name':_0x3aa19c['def']['name'],'action':'updated','id':_0x46b331['id'],'diff':formatDiffWithColors(_0x20f046)}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x195)][_0x5305d8(0x192)]++):(_0x51fd7f[_0x5305d8(0x195)][_0x5305d8(0x1a0)]({'name':_0x3aa19c[_0x5305d8(0x265)]['name'],'action':'unchanged','id':_0x46b331['id']}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x195)][_0x5305d8(0x29f)]++);}else _0x51fd7f['experimentalArtifacts'][_0x5305d8(0x1a0)]({'name':_0x3aa19c[_0x5305d8(0x265)][_0x5305d8(0x244)],'action':_0x5305d8(0x28e)}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x195)][_0x5305d8(0x28e)]++;}for(const _0x3eced4 of _0x4ea776){const _0x28fb83=_0x54cb2e[_0x5305d8(0x1f6)](_0x3eced4[_0x5305d8(0x1a5)][_0x5305d8(0x244)]),_0x318988=a153_0x1775cb[_0x5305d8(0x261)](_0x3eced4[_0x5305d8(0x26c)],_0x5305d8(0x18c));if(_0x28fb83){const _0x4bbe43=await apiFormInterfaceToYaml(_0x28fb83,_0x3223d6),_0x4ade84=toFormInterfaceYamlString(_0x4bbe43),_0x553359=generateDiff(_0x4ade84,_0x318988),_0x293b11=hasChanges(_0x553359);_0x293b11?(_0x51fd7f[_0x5305d8(0x1a7)][_0x5305d8(0x1a0)]({'name':_0x3eced4['yaml']['name'],'action':'updated','id':_0x28fb83['id'],'diff':formatDiffWithColors(_0x553359)}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1a7)][_0x5305d8(0x192)]++):(_0x51fd7f[_0x5305d8(0x1a7)][_0x5305d8(0x1a0)]({'name':_0x3eced4[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':_0x5305d8(0x29f),'id':_0x28fb83['id']}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1a7)][_0x5305d8(0x29f)]++);}else _0x51fd7f['formInterfaces']['push']({'name':_0x3eced4[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':_0x5305d8(0x28e)}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1a7)][_0x5305d8(0x28e)]++;}for(const _0x4b8a76 of _0x195adb){const _0x19517a=_0x55aed2[_0x5305d8(0x1f6)](_0x4b8a76[_0x5305d8(0x1a5)][_0x5305d8(0x244)]),_0x31f7c0=a153_0x1775cb['readFileSync'](_0x4b8a76['path'],'utf-8');if(_0x19517a){const _0x209b7f=await apiChatInterfaceToYaml(_0x19517a,_0x3223d6),_0x5da513=toChatInterfaceYamlString(_0x209b7f),_0x1b89b3=generateDiff(_0x5da513,_0x31f7c0),_0x5ec02c=hasChanges(_0x1b89b3);_0x5ec02c?(_0x51fd7f[_0x5305d8(0x198)][_0x5305d8(0x1a0)]({'name':_0x4b8a76['yaml'][_0x5305d8(0x244)],'action':'updated','id':_0x19517a['id'],'diff':formatDiffWithColors(_0x1b89b3)}),_0x51fd7f['counts'][_0x5305d8(0x198)][_0x5305d8(0x192)]++):(_0x51fd7f[_0x5305d8(0x198)][_0x5305d8(0x1a0)]({'name':_0x4b8a76[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':_0x5305d8(0x29f),'id':_0x19517a['id']}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x198)][_0x5305d8(0x29f)]++);}else _0x51fd7f[_0x5305d8(0x198)][_0x5305d8(0x1a0)]({'name':_0x4b8a76[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':_0x5305d8(0x28e)}),_0x51fd7f[_0x5305d8(0x29a)]['chatInterfaces'][_0x5305d8(0x28e)]++;}if(_0x468f43?.['dryRun'])return _0x51fd7f;_0x51fd7f[_0x5305d8(0x197)]=[],_0x51fd7f[_0x5305d8(0x272)]=[],_0x51fd7f[_0x5305d8(0x1c0)]=[],_0x51fd7f[_0x5305d8(0x1e3)]=[],_0x51fd7f['experimentalKnowledgeBases']=[],_0x51fd7f[_0x5305d8(0x195)]=[],_0x51fd7f[_0x5305d8(0x1a7)]=[],_0x51fd7f['chatInterfaces']=[];const _0x3310fe=_0x51fd7f['agents'][_0x5305d8(0x1d4)](_0x5a28e4=>_0x5a28e4[_0x5305d8(0x249)]===_0x5305d8(0x1e0));_0x51fd7f[_0x5305d8(0x2a7)]=_0x3310fe,_0x51fd7f[_0x5305d8(0x29a)]={'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':_0x3310fe['length']},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0}};for(const _0x2b16fc of _0x1bc025){try{const _0x11626b=_0x41c95a['get'](_0x2b16fc['yaml'][_0x5305d8(0x244)]),_0x35ee8d=yamlKnowledgeBaseToApi(_0x2b16fc['yaml'],_0x464fda);if(_0x11626b)await this[_0x5305d8(0x2a1)][_0x5305d8(0x24b)](_0x11626b['id'],_0x35ee8d),_0x11e5f7[_0x5305d8(0x254)](_0x2b16fc[_0x5305d8(0x1a5)]['name'],_0x11626b['id']),_0x51fd7f[_0x5305d8(0x197)][_0x5305d8(0x1a0)]({'name':_0x2b16fc[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':_0x5305d8(0x192),'id':_0x11626b['id']}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x197)]['updated']++;else{const _0x24d83e=await this['client'][_0x5305d8(0x21d)](_0x35ee8d);_0x11e5f7[_0x5305d8(0x254)](_0x2b16fc[_0x5305d8(0x1a5)]['name'],_0x24d83e['id']),_0x51fd7f[_0x5305d8(0x197)][_0x5305d8(0x1a0)]({'name':_0x2b16fc[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':'created','id':_0x24d83e['id']}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x197)][_0x5305d8(0x28e)]++;}}catch(_0xd4652a){_0x51fd7f[_0x5305d8(0x197)]['push']({'name':_0x2b16fc['yaml'][_0x5305d8(0x244)],'action':_0x5305d8(0x1e0),'error':_0xd4652a['message']}),_0x51fd7f['counts'][_0x5305d8(0x197)][_0x5305d8(0x270)]++;}}for(const _0x3a0818 of _0x1f1cf9){try{const _0x3a706d=_0x413c18[_0x5305d8(0x1f6)](_0x3a0818[_0x5305d8(0x244)]),_0x5c8cfb=yamlTextKnowledgeBaseToApi({'name':_0x3a0818[_0x5305d8(0x244)],'text':_0x3a0818['text']},_0x464fda);if(_0x3a706d)await this[_0x5305d8(0x2a1)][_0x5305d8(0x229)](_0x3a706d['id'],_0x5c8cfb),_0x579f9e[_0x5305d8(0x254)](_0x3a0818[_0x5305d8(0x244)],_0x3a706d['id']),_0x51fd7f[_0x5305d8(0x272)][_0x5305d8(0x1a0)]({'name':_0x3a0818[_0x5305d8(0x244)],'action':_0x5305d8(0x192),'id':_0x3a706d['id']}),_0x51fd7f[_0x5305d8(0x29a)]['textKnowledgeBases'][_0x5305d8(0x192)]++;else{const _0x4e6b06=await this[_0x5305d8(0x2a1)][_0x5305d8(0x291)](_0x5c8cfb);_0x579f9e[_0x5305d8(0x254)](_0x3a0818['name'],_0x4e6b06['id']),_0x51fd7f[_0x5305d8(0x272)]['push']({'name':_0x3a0818['name'],'action':_0x5305d8(0x28e),'id':_0x4e6b06['id']}),_0x51fd7f['counts'][_0x5305d8(0x272)][_0x5305d8(0x28e)]++;}}catch(_0x5b57b8){_0x51fd7f[_0x5305d8(0x272)]['push']({'name':_0x3a0818[_0x5305d8(0x244)],'action':_0x5305d8(0x1e0),'error':_0x5b57b8[_0x5305d8(0x1d8)]}),_0x51fd7f['counts'][_0x5305d8(0x272)][_0x5305d8(0x270)]++;}}for(const _0x124e67 of _0x359c5e){try{const _0x43ab99=_0x146a65[_0x5305d8(0x1f6)](_0x124e67[_0x5305d8(0x265)][_0x5305d8(0x244)]),_0x59b138=yamlExperimentalKnowledgeBaseToApi(_0x124e67['def'],_0x464fda);if(_0x43ab99)await this['client'][_0x5305d8(0x241)](_0x43ab99['id'],_0x59b138),_0x16ac60[_0x5305d8(0x254)](_0x124e67[_0x5305d8(0x265)]['name'],_0x43ab99['id']),_0x51fd7f[_0x5305d8(0x1f2)][_0x5305d8(0x1a0)]({'name':_0x124e67['def'][_0x5305d8(0x244)],'action':_0x5305d8(0x192),'id':_0x43ab99['id']}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1f2)]['updated']++;else{const _0x5d25f2=await this[_0x5305d8(0x2a1)][_0x5305d8(0x1d2)](_0x59b138);_0x16ac60[_0x5305d8(0x254)](_0x124e67['def'][_0x5305d8(0x244)],_0x5d25f2['id']),_0x51fd7f[_0x5305d8(0x1f2)][_0x5305d8(0x1a0)]({'name':_0x124e67['def'][_0x5305d8(0x244)],'action':_0x5305d8(0x28e),'id':_0x5d25f2['id']}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1f2)][_0x5305d8(0x28e)]++;}}catch(_0x517710){_0x51fd7f['experimentalKnowledgeBases'][_0x5305d8(0x1a0)]({'name':_0x124e67['def'][_0x5305d8(0x244)],'action':_0x5305d8(0x1e0),'error':_0x517710['message']}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1f2)][_0x5305d8(0x270)]++;}}for(const _0x9f056a of _0x2a412d){try{const _0x49178d=_0x2b359b[_0x5305d8(0x1f6)](_0x9f056a[_0x5305d8(0x265)][_0x5305d8(0x244)]),_0x7cf37=yamlExperimentalArtifactToApi(_0x9f056a[_0x5305d8(0x265)],_0x464fda);if(_0x49178d)await this['client']['updateExperimentalArtifact'](_0x49178d['id'],_0x7cf37),_0x32c288[_0x5305d8(0x254)](_0x9f056a[_0x5305d8(0x265)][_0x5305d8(0x244)],_0x49178d['id']),_0x51fd7f['experimentalArtifacts'][_0x5305d8(0x1a0)]({'name':_0x9f056a[_0x5305d8(0x265)][_0x5305d8(0x244)],'action':_0x5305d8(0x192),'id':_0x49178d['id']}),_0x51fd7f['counts']['experimentalArtifacts'][_0x5305d8(0x192)]++;else{const _0x31d000=await this['client'][_0x5305d8(0x1ac)](_0x7cf37);_0x32c288['set'](_0x9f056a[_0x5305d8(0x265)][_0x5305d8(0x244)],_0x31d000['id']),_0x51fd7f['experimentalArtifacts'][_0x5305d8(0x1a0)]({'name':_0x9f056a[_0x5305d8(0x265)][_0x5305d8(0x244)],'action':_0x5305d8(0x28e),'id':_0x31d000['id']}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x195)][_0x5305d8(0x28e)]++;}}catch(_0x20859c){_0x51fd7f[_0x5305d8(0x195)][_0x5305d8(0x1a0)]({'name':_0x9f056a[_0x5305d8(0x265)][_0x5305d8(0x244)],'action':_0x5305d8(0x1e0),'error':_0x20859c[_0x5305d8(0x1d8)]}),_0x51fd7f['counts'][_0x5305d8(0x195)][_0x5305d8(0x270)]++;}}for(const _0x1dd6ec of _0x773a19){_0x5195ac=[];try{const _0x55a8c7=_0x3beff3[_0x5305d8(0x1f6)](_0x1dd6ec[_0x5305d8(0x1a5)]['name']),_0x5c5590=await agentDefToRequest(_0x1dd6ec['yaml'],_0x1dd6ec[_0x5305d8(0x1f9)],_0x1dd6ec[_0x5305d8(0x289)],_0xb43c0d);if(_0x55a8c7)await this[_0x5305d8(0x2a1)][_0x5305d8(0x234)](_0x55a8c7['id'],_0x5c5590),_0x558c83[_0x5305d8(0x254)](_0x1dd6ec['yaml'][_0x5305d8(0x244)],_0x55a8c7['id']),_0x51fd7f[_0x5305d8(0x2a7)][_0x5305d8(0x1a0)]({'agentName':_0x1dd6ec[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':'updated','agentId':_0x55a8c7['id'],'warnings':_0x5195ac[_0x5305d8(0x1df)]>0x0?_0x5195ac:undefined}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x2a7)][_0x5305d8(0x192)]++;else{const _0xe0aceb=await this[_0x5305d8(0x2a1)]['createAgentResponse'](_0x5c5590);_0x558c83[_0x5305d8(0x254)](_0x1dd6ec[_0x5305d8(0x1a5)][_0x5305d8(0x244)],_0xe0aceb['id']),_0x51fd7f['agents'][_0x5305d8(0x1a0)]({'agentName':_0x1dd6ec[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':_0x5305d8(0x28e),'agentId':_0xe0aceb['id'],'warnings':_0x5195ac['length']>0x0?_0x5195ac:undefined}),_0x51fd7f['counts'][_0x5305d8(0x2a7)][_0x5305d8(0x28e)]++;}}catch(_0x49085f){_0x51fd7f[_0x5305d8(0x2a7)]['push']({'agentName':_0x1dd6ec['yaml'][_0x5305d8(0x244)],'action':'error','error':_0x49085f[_0x5305d8(0x1d8)],'warnings':_0x5195ac[_0x5305d8(0x1df)]>0x0?_0x5195ac:undefined}),_0x51fd7f['counts'][_0x5305d8(0x2a7)][_0x5305d8(0x270)]++;}}for(const _0x32ae25 of _0x11f2b8){try{const _0xbb5eef=_0x2bccf5['get'](_0x32ae25[_0x5305d8(0x1a5)]['name']),_0x53a546=await yamlPromptToApi(_0x32ae25['yaml'],_0x464fda,_0xb43c0d);if(!_0x53a546){_0x51fd7f[_0x5305d8(0x1c0)][_0x5305d8(0x1a0)]({'name':_0x32ae25[_0x5305d8(0x1a5)]['name'],'action':_0x5305d8(0x1e0),'error':_0x5305d8(0x1e6)}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1c0)][_0x5305d8(0x270)]++;continue;}if(_0xbb5eef)await this[_0x5305d8(0x2a1)][_0x5305d8(0x213)](_0xbb5eef['id'],_0x53a546),_0x18b74e['set'](_0x32ae25[_0x5305d8(0x1a5)]['name'],_0xbb5eef['id']),_0x51fd7f['prompts'][_0x5305d8(0x1a0)]({'name':_0x32ae25['yaml']['name'],'action':_0x5305d8(0x192),'id':_0xbb5eef['id']}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1c0)][_0x5305d8(0x192)]++;else{const _0x4a3429=await this[_0x5305d8(0x2a1)][_0x5305d8(0x1be)](_0x53a546);_0x18b74e[_0x5305d8(0x254)](_0x32ae25['yaml'][_0x5305d8(0x244)],_0x4a3429['id']),_0x51fd7f[_0x5305d8(0x1c0)][_0x5305d8(0x1a0)]({'name':_0x32ae25['yaml']['name'],'action':_0x5305d8(0x28e),'id':_0x4a3429['id']}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1c0)]['created']++;}}catch(_0x4c7d9b){_0x51fd7f['prompts'][_0x5305d8(0x1a0)]({'name':_0x32ae25[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':_0x5305d8(0x1e0),'error':_0x4c7d9b[_0x5305d8(0x1d8)]}),_0x51fd7f[_0x5305d8(0x29a)]['prompts'][_0x5305d8(0x270)]++;}}for(const _0x49f2e5 of _0x2dded2){try{const _0x436cf7=_0x2be063[_0x5305d8(0x1f6)](_0x49f2e5[_0x5305d8(0x1a5)][_0x5305d8(0x22f)]),_0x11ac41=await yamlIntegrationToApi(_0x49f2e5[_0x5305d8(0x1a5)],_0x464fda,_0xb43c0d);if(_0x436cf7){await this[_0x5305d8(0x2a1)][_0x5305d8(0x27e)](_0x436cf7['id']);const _0x45f9b9=await this[_0x5305d8(0x2a1)][_0x5305d8(0x1a2)](_0x11ac41);_0x51fd7f[_0x5305d8(0x1e3)][_0x5305d8(0x1a0)]({'name':_0x49f2e5[_0x5305d8(0x1a5)][_0x5305d8(0x22f)],'action':_0x5305d8(0x192),'id':_0x45f9b9['id']}),_0x51fd7f[_0x5305d8(0x29a)]['integrations'][_0x5305d8(0x192)]++;}else{const _0x519504=await this[_0x5305d8(0x2a1)]['createIntegration'](_0x11ac41);_0x51fd7f[_0x5305d8(0x1e3)][_0x5305d8(0x1a0)]({'name':_0x49f2e5[_0x5305d8(0x1a5)][_0x5305d8(0x22f)],'action':_0x5305d8(0x28e),'id':_0x519504['id']}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1e3)][_0x5305d8(0x28e)]++;}}catch(_0x4ba015){_0x51fd7f[_0x5305d8(0x1e3)][_0x5305d8(0x1a0)]({'name':_0x49f2e5['yaml'][_0x5305d8(0x22f)],'action':_0x5305d8(0x1e0),'error':_0x4ba015['message']}),_0x51fd7f['counts']['integrations'][_0x5305d8(0x270)]++;}}for(const _0x5a2a05 of _0x4ea776){try{const _0x38521b=_0x54cb2e[_0x5305d8(0x1f6)](_0x5a2a05['yaml'][_0x5305d8(0x244)]),_0x113b72=await yamlFormInterfaceToApi(_0x5a2a05[_0x5305d8(0x1a5)],_0x464fda,_0xb43c0d);if(!_0x113b72){_0x51fd7f[_0x5305d8(0x1a7)]['push']({'name':_0x5a2a05[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':_0x5305d8(0x1e0),'error':_0x5305d8(0x1b6)}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1a7)][_0x5305d8(0x270)]++;continue;}if(_0x38521b){const _0x281c48=await this[_0x5305d8(0x2a1)]['updateFormInterface'](_0x38521b['id'],_0x113b72);_0x51fd7f['formInterfaces']['push']({'name':_0x5a2a05[_0x5305d8(0x1a5)]['name'],'action':'updated','id':_0x281c48['id']}),_0x51fd7f['counts'][_0x5305d8(0x1a7)][_0x5305d8(0x192)]++;}else{const _0x34a5ca=await this[_0x5305d8(0x2a1)][_0x5305d8(0x19e)](_0x113b72);_0x51fd7f[_0x5305d8(0x1a7)][_0x5305d8(0x1a0)]({'name':_0x5a2a05[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':'created','id':_0x34a5ca['id']}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x1a7)][_0x5305d8(0x28e)]++;}}catch(_0xdf42b6){_0x51fd7f[_0x5305d8(0x1a7)][_0x5305d8(0x1a0)]({'name':_0x5a2a05[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':'error','error':_0xdf42b6[_0x5305d8(0x1d8)]}),_0x51fd7f['counts']['formInterfaces']['errors']++;}}for(const _0x29028c of _0x195adb){try{const _0x2222b6=_0x55aed2[_0x5305d8(0x1f6)](_0x29028c[_0x5305d8(0x1a5)][_0x5305d8(0x244)]),_0x1bfc3a=await yamlChatInterfaceToApi(_0x29028c[_0x5305d8(0x1a5)],_0x464fda,_0xb43c0d);if(_0x2222b6){const _0x2dd992=await this[_0x5305d8(0x2a1)]['updateChatInterface'](_0x2222b6['id'],_0x1bfc3a);_0x51fd7f[_0x5305d8(0x198)][_0x5305d8(0x1a0)]({'name':_0x29028c[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':_0x5305d8(0x192),'id':_0x2dd992['id']}),_0x51fd7f['counts']['chatInterfaces'][_0x5305d8(0x192)]++;}else{const _0x5882ee=await this['client']['createChatInterface'](_0x1bfc3a);_0x51fd7f[_0x5305d8(0x198)][_0x5305d8(0x1a0)]({'name':_0x29028c[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':_0x5305d8(0x28e),'id':_0x5882ee['id']}),_0x51fd7f['counts'][_0x5305d8(0x198)][_0x5305d8(0x28e)]++;}}catch(_0x10bd76){_0x51fd7f[_0x5305d8(0x198)][_0x5305d8(0x1a0)]({'name':_0x29028c[_0x5305d8(0x1a5)][_0x5305d8(0x244)],'action':'error','error':_0x10bd76[_0x5305d8(0x1d8)]}),_0x51fd7f[_0x5305d8(0x29a)][_0x5305d8(0x198)]['errors']++;}}return _0x51fd7f;}async[a153_0x13235f(0x27a)](_0x4a4b75,_0x4ee437,_0x190359,_0x39a617){const _0x10b448=a153_0x13235f,{projectId:_0x11191e,project:_0x1aa98d}=await this['resolveProjectName'](_0x4a4b75),_0x335dc5=_0x1aa98d[_0x10b448(0x25f)][_0x10b448(0x244)],_0x354c8f=await this[_0x10b448(0x2a1)][_0x10b448(0x26b)](_0x11191e),_0x4828fc=_0x354c8f['find'](_0x1675ab=>_0x1675ab[_0x10b448(0x25f)]['name']===_0x4ee437);if(!_0x4828fc)throw new SDKError(ErrorCode[_0x10b448(0x2a2)],_0x10b448(0x1bf)+_0x4ee437,undefined,{'helpText':'Available\x20agents:\x20'+_0x354c8f[_0x10b448(0x23a)](_0x13d904=>_0x13d904[_0x10b448(0x25f)][_0x10b448(0x244)])[_0x10b448(0x226)](',\x20')});let _0x187f4c;if(_0x190359)_0x187f4c=_0x190359;else{const _0x5f36b6=a153_0x4751bc[_0x10b448(0x226)](process[_0x10b448(0x1a8)](),_0x10b448(0x2a7)),_0x50050f=getSanitizedPathWithMigration(_0x5f36b6,_0x335dc5);_0x50050f[_0x10b448(0x290)]&&this[_0x10b448(0x194)]['info'](_0x10b448(0x206)+a153_0x4751bc[_0x10b448(0x2b1)](_0x50050f[_0x10b448(0x21e)])+_0x10b448(0x25d)+a153_0x4751bc['basename'](_0x50050f[_0x10b448(0x26c)])),_0x187f4c=_0x50050f['path'];}const _0x9073c2=getSanitizedPathWithMigration(_0x187f4c,_0x4ee437);_0x9073c2['renamed']&&this[_0x10b448(0x194)][_0x10b448(0x228)](_0x10b448(0x1db)+a153_0x4751bc[_0x10b448(0x2b1)](_0x9073c2[_0x10b448(0x21e)])+_0x10b448(0x25d)+a153_0x4751bc[_0x10b448(0x2b1)](_0x9073c2[_0x10b448(0x26c)]));const _0x2eb1d3=_0x9073c2[_0x10b448(0x26c)],_0x53838e=new Map(),_0x56d7e7=new Map(),_0x27881d=await this[_0x10b448(0x2a1)]['listKnowledgeBases'](_0x11191e),_0x1f6c4b=await this[_0x10b448(0x2a1)]['listTextKnowledgeBases'](_0x11191e),_0x454aa0=await safeListOrEmpty(()=>this[_0x10b448(0x2a1)][_0x10b448(0x23b)](_0x11191e)),_0x178b1a=new Map(),_0x559e71=new Map();for(const _0x403fb5 of _0x27881d){_0x53838e[_0x10b448(0x254)](_0x403fb5['id'],_0x403fb5[_0x10b448(0x25f)][_0x10b448(0x244)]);}for(const _0x4388b0 of _0x1f6c4b){_0x178b1a[_0x10b448(0x254)](_0x4388b0['id'],_0x4388b0[_0x10b448(0x25f)][_0x10b448(0x244)]);}for(const _0x41c826 of _0x454aa0){_0x559e71[_0x10b448(0x254)](_0x41c826['id'],_0x41c826[_0x10b448(0x25f)]['name']);}for(const _0xb26542 of _0x354c8f){_0x56d7e7[_0x10b448(0x254)](_0xb26542['id'],_0xb26542[_0x10b448(0x25f)][_0x10b448(0x244)]);}const _0x5a42a5={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x53838e,'TextKnowledgeBase':_0x178b1a,'Agent':_0x56d7e7,'ExperimentalKnowledgeBase':_0x559e71}),'resolvePromptName':async()=>undefined,'onWarning':_0x10118f=>this[_0x10b448(0x194)][_0x10b448(0x27d)](_0x10118f)},_0x592905=a153_0x4751bc['join'](_0x2eb1d3,_0x10b448(0x266)),_0x3d6113=a153_0x4751bc[_0x10b448(0x226)](_0x2eb1d3,_0x10b448(0x1e9)),_0x185f6d=a153_0x4751bc[_0x10b448(0x226)](_0x2eb1d3,_0x10b448(0x243)),_0x2ce535=!a153_0x1775cb[_0x10b448(0x20e)](_0x3d6113);if(_0x39a617?.[_0x10b448(0x208)])return{'agentName':_0x4ee437,'outputPath':_0x2eb1d3,'isNew':_0x2ce535,'hasChanges':!![]};a153_0x1775cb[_0x10b448(0x1d7)](_0x187f4c,{'recursive':!![]}),a153_0x1775cb['mkdirSync'](_0x2eb1d3,{'recursive':!![]});const _0xfc8dd6=a153_0x4751bc[_0x10b448(0x226)](_0x187f4c,_0x10b448(0x204));!a153_0x1775cb[_0x10b448(0x20e)](_0xfc8dd6)&&a153_0x1775cb['writeFileSync'](_0xfc8dd6,createAgentConfigContent(_0x4a4b75));const {yaml:_0x29f651,systemPrompt:_0x71afba,starterMessage:_0x496c02}=await agentResponseToDef(_0x4828fc,_0x5a42a5);let _0x39fa0f=_0x2ce535;if(!_0x2ce535){const _0x19bcd6=a153_0x1775cb[_0x10b448(0x20e)](_0x592905)?a153_0x1775cb['readFileSync'](_0x592905,'utf-8'):'',_0x50cbea=a153_0x1775cb['readFileSync'](_0x3d6113,'utf-8');_0x39fa0f=_0x19bcd6!==_0x71afba||_0x50cbea!==toAgentYamlString(_0x29f651);}a153_0x1775cb[_0x10b448(0x258)](_0x592905,_0x71afba),a153_0x1775cb['writeFileSync'](_0x3d6113,toAgentYamlString(_0x29f651));if(_0x496c02&&_0x496c02[_0x10b448(0x237)]('\x0a'))a153_0x1775cb[_0x10b448(0x258)](_0x185f6d,_0x496c02);else a153_0x1775cb[_0x10b448(0x20e)](_0x185f6d)&&a153_0x1775cb[_0x10b448(0x216)](_0x185f6d);return{'agentName':_0x4ee437,'outputPath':_0x2eb1d3,'isNew':_0x2ce535,'hasChanges':_0x39fa0f};}async[a153_0x13235f(0x26d)](_0x533b34,_0xda0046){const _0x5cddec=a153_0x13235f;let _0x4fab79;isAgentYamlPath(_0x533b34)?_0x4fab79=getAgentDirFromYamlPath(_0x533b34):_0x4fab79=_0x533b34;const {config:_0x10e054}=findAgentConfig(_0x4fab79),_0x36ea64=await this['resolveProjectId'](_0x10e054[_0x5cddec(0x278)]),_0x367c03=a153_0x4751bc[_0x5cddec(0x226)](_0x4fab79,_0x5cddec(0x1e9)),_0x584926=a153_0x4751bc[_0x5cddec(0x226)](_0x4fab79,'prompt.md'),_0x24415b=a153_0x4751bc['join'](_0x4fab79,_0x5cddec(0x243));if(!a153_0x1775cb[_0x5cddec(0x20e)](_0x367c03))throw new SDKError(ErrorCode['NOT_FOUND'],'agent.yml\x20not\x20found\x20in\x20'+_0x4fab79,undefined,{'helpText':_0x5cddec(0x18e)});const _0x2ab4be=parseAgentYaml(a153_0x1775cb['readFileSync'](_0x367c03,_0x5cddec(0x18c)),_0x367c03),_0x39f703=a153_0x1775cb[_0x5cddec(0x20e)](_0x584926)?a153_0x1775cb[_0x5cddec(0x261)](_0x584926,_0x5cddec(0x18c)):'',_0x528812=a153_0x1775cb[_0x5cddec(0x20e)](_0x24415b)?a153_0x1775cb['readFileSync'](_0x24415b,_0x5cddec(0x18c)):_0x2ab4be[_0x5cddec(0x1b5)];if(_0xda0046?.[_0x5cddec(0x208)])return{'agentName':_0x2ab4be[_0x5cddec(0x244)],'action':'created','projectId':_0x36ea64};const _0x4ca5cc=await this[_0x5cddec(0x2a1)][_0x5cddec(0x26b)](_0x36ea64),_0x4a0099=await fetchAllToolTargetMaps((_0x13a287,_0x366611)=>this['client'][_0x5cddec(0x271)](_0x13a287,_0x366611),_0x36ea64),_0x283ea0=new Map();for(const _0x1571e8 of _0x4ca5cc){_0x283ea0[_0x5cddec(0x254)](_0x1571e8['attributes'][_0x5cddec(0x244)],_0x1571e8['id']);}const _0x419eb4=[],_0xd02dd3={'projectId':_0x36ea64,'resolveToolTargetId':buildIdResolver({..._0x4a0099['nameToId'],'Agent':_0x283ea0}),'resolvePromptId':async()=>undefined,'onWarning':_0x303813=>{const _0x12ebfb=_0x5cddec;this['logger']['warn'](_0x303813),_0x419eb4[_0x12ebfb(0x1a0)](_0x303813);}};try{const _0x377237=_0x4ca5cc['find'](_0x4a3a94=>_0x4a3a94[_0x5cddec(0x25f)][_0x5cddec(0x244)]===_0x2ab4be[_0x5cddec(0x244)]),_0x49ecca=await agentDefToRequest(_0x2ab4be,_0x39f703,_0x528812,_0xd02dd3);if(_0x377237)return await this[_0x5cddec(0x2a1)][_0x5cddec(0x234)](_0x377237['id'],_0x49ecca),{'agentName':_0x2ab4be[_0x5cddec(0x244)],'action':_0x5cddec(0x192),'projectId':_0x36ea64,'agentId':_0x377237['id'],'warnings':_0x419eb4[_0x5cddec(0x1df)]>0x0?_0x419eb4:undefined};else{const _0x3f66b2=await this[_0x5cddec(0x2a1)][_0x5cddec(0x207)](_0x49ecca);return{'agentName':_0x2ab4be['name'],'action':_0x5cddec(0x28e),'projectId':_0x36ea64,'agentId':_0x3f66b2['id'],'warnings':_0x419eb4['length']>0x0?_0x419eb4:undefined};}}catch(_0x3a8fd1){return{'agentName':_0x2ab4be[_0x5cddec(0x244)],'action':_0x5cddec(0x1e0),'projectId':_0x36ea64,'error':_0x3a8fd1[_0x5cddec(0x1d8)],'warnings':_0x419eb4[_0x5cddec(0x1df)]>0x0?_0x419eb4:undefined};}}async[a153_0x13235f(0x1bc)](_0x37e87f,_0x492008,_0x4eef38){const _0x265886=a153_0x13235f,_0x590a6d=a153_0x1775cb[_0x265886(0x20e)](_0x37e87f)&&a153_0x1775cb[_0x265886(0x20e)](a153_0x4751bc[_0x265886(0x226)](_0x37e87f,_0x265886(0x204)));let _0x4a4a5a;const _0x16aa33=[],_0x400311=[],_0x45f26e=[],_0x4b5dfb=[],_0x2e7635=[],_0x25d279=[],_0x50851a=[],_0x326724=[],_0x25d0ba=[];if(_0x590a6d){const _0x2fe0e7=loadAgentConfig(a153_0x4751bc[_0x265886(0x226)](_0x37e87f,_0x265886(0x204)));_0x4a4a5a=_0x2fe0e7['llm_project'];const _0x3829df=a153_0x1775cb['readdirSync'](_0x37e87f,{'withFileTypes':!![]});for(const _0x5e65c8 of _0x3829df){if(!_0x5e65c8['isDirectory']())continue;if([_0x265886(0x298),'experimental_knowledge_bases',_0x265886(0x29e),'prompts',_0x265886(0x1e3),_0x265886(0x250),_0x265886(0x209)][_0x265886(0x237)](_0x5e65c8[_0x265886(0x244)]))continue;const _0x2aceac=a153_0x4751bc[_0x265886(0x226)](_0x37e87f,_0x5e65c8[_0x265886(0x244)]);if(isAgentDir(_0x2aceac)){const _0x41209b=a153_0x4751bc[_0x265886(0x226)](_0x2aceac,_0x265886(0x1e9)),_0x3b1149=a153_0x4751bc['join'](_0x2aceac,_0x265886(0x266)),_0x4d9802=a153_0x4751bc['join'](_0x2aceac,_0x265886(0x243)),_0x3b2c05=parseAgentYaml(a153_0x1775cb['readFileSync'](_0x41209b,_0x265886(0x18c)),_0x41209b),_0x19e838=a153_0x1775cb[_0x265886(0x20e)](_0x3b1149)?a153_0x1775cb[_0x265886(0x261)](_0x3b1149,_0x265886(0x18c)):'',_0x2deac9=a153_0x1775cb[_0x265886(0x20e)](_0x4d9802)?a153_0x1775cb[_0x265886(0x261)](_0x4d9802,'utf-8'):_0x3b2c05[_0x265886(0x1b5)];_0x16aa33[_0x265886(0x1a0)]({'name':_0x3b2c05[_0x265886(0x244)],'dir':_0x2aceac,'yaml':_0x3b2c05,'systemPrompt':_0x19e838,'starterMessage':_0x2deac9});}}const _0x41cc2c=getKnowledgeBasesDir(_0x37e87f);if(a153_0x1775cb[_0x265886(0x20e)](_0x41cc2c)){const _0x27b8e0=a153_0x1775cb[_0x265886(0x1ee)](_0x41cc2c);for(const _0x3768f3 of _0x27b8e0){const _0x314333=a153_0x4751bc[_0x265886(0x226)](_0x41cc2c,_0x3768f3);if(_0x3768f3[_0x265886(0x1fd)]('.yml')){const _0x429369=parseKnowledgeBaseYaml(a153_0x1775cb[_0x265886(0x261)](_0x314333,_0x265886(0x18c)),_0x314333);_0x400311[_0x265886(0x1a0)]({'name':_0x429369[_0x265886(0x244)],'path':_0x314333,'yaml':_0x429369});}else{if(_0x3768f3[_0x265886(0x1fd)](_0x265886(0x19f))){const _0x35ddd6=a153_0x1775cb[_0x265886(0x261)](_0x314333,_0x265886(0x18c)),{name:_0x23c60b,text:_0x58e802}=parseTextKnowledgeBaseMd(_0x35ddd6,_0x3768f3);_0x45f26e[_0x265886(0x1a0)]({'name':_0x23c60b,'path':_0x314333,'text':_0x58e802});}}}}const _0x6d533e=getPromptsDir(_0x37e87f);if(a153_0x1775cb[_0x265886(0x20e)](_0x6d533e)){const _0x4673f9=a153_0x1775cb[_0x265886(0x1ee)](_0x6d533e)[_0x265886(0x1d4)](_0x17a0f6=>_0x17a0f6[_0x265886(0x1fd)](_0x265886(0x262)));for(const _0x110b0b of _0x4673f9){const _0x674612=a153_0x4751bc[_0x265886(0x226)](_0x6d533e,_0x110b0b),_0x2e1a8=parsePromptYaml(a153_0x1775cb[_0x265886(0x261)](_0x674612,_0x265886(0x18c)),_0x674612);_0x4b5dfb[_0x265886(0x1a0)]({'name':_0x2e1a8['name'],'path':_0x674612,'yaml':_0x2e1a8});}}const _0x4e1f99=getIntegrationsDir(_0x37e87f);if(a153_0x1775cb[_0x265886(0x20e)](_0x4e1f99)){const _0x36d477=a153_0x1775cb[_0x265886(0x1ee)](_0x4e1f99)[_0x265886(0x1d4)](_0x522c53=>_0x522c53[_0x265886(0x1fd)](_0x265886(0x262)));for(const _0x4d1e82 of _0x36d477){const _0x533faf=a153_0x4751bc[_0x265886(0x226)](_0x4e1f99,_0x4d1e82),_0x8e6e76=parseIntegrationYaml(a153_0x1775cb[_0x265886(0x261)](_0x533faf,_0x265886(0x18c)),_0x533faf);SAFE_INTEGRATION_TYPES[_0x265886(0x237)](_0x8e6e76[_0x265886(0x22f)][_0x265886(0x274)]())?_0x2e7635[_0x265886(0x1a0)]({'name':_0x8e6e76['name'],'path':_0x533faf,'yaml':_0x8e6e76}):this['logger']['warn'](_0x265886(0x22d)+_0x8e6e76['name']+_0x265886(0x210)+_0x8e6e76[_0x265886(0x22f)]+_0x265886(0x201)+(_0x265886(0x240)+SAFE_INTEGRATION_TYPES[_0x265886(0x226)](',\x20')+_0x265886(0x1e8)));}}const _0x30a029=getExperimentalKnowledgeBasesDir(_0x37e87f);if(a153_0x1775cb[_0x265886(0x20e)](_0x30a029)){const _0xd911a6=a153_0x1775cb['readdirSync'](_0x30a029,{'withFileTypes':!![]});for(const _0x5c5a62 of _0xd911a6){if(!_0x5c5a62[_0x265886(0x18b)]())continue;const _0x4b0248=a153_0x4751bc[_0x265886(0x226)](_0x30a029,_0x5c5a62['name']),_0x26ffb3=a153_0x4751bc[_0x265886(0x226)](_0x4b0248,_0x5c5a62['name']+_0x265886(0x262));if(a153_0x1775cb[_0x265886(0x20e)](_0x26ffb3)){const _0x1f0c62=parseExperimentalKnowledgeBaseYaml(a153_0x1775cb[_0x265886(0x261)](_0x26ffb3,'utf-8'),_0x26ffb3),_0xe7592c=a153_0x4751bc[_0x265886(0x226)](_0x4b0248,_0x265886(0x2ab)),_0xb0cd32=[];if(a153_0x1775cb[_0x265886(0x20e)](_0xe7592c)){const _0x2f3fd0=a153_0x1775cb[_0x265886(0x1ee)](_0xe7592c,{'withFileTypes':!![]});for(const _0x119786 of _0x2f3fd0){if(!_0x119786[_0x265886(0x18b)]())continue;const _0x1c4819=a153_0x4751bc[_0x265886(0x226)](_0xe7592c,_0x119786['name']),_0x38feb0=a153_0x4751bc[_0x265886(0x226)](_0x1c4819,_0x265886(0x1d0)),_0x5c7f8b=a153_0x4751bc[_0x265886(0x226)](_0x1c4819,_0x265886(0x1f5));if(a153_0x1775cb['existsSync'](_0x38feb0)&&a153_0x1775cb['existsSync'](_0x5c7f8b)){const _0x3a64d9=a153_0x1775cb[_0x265886(0x261)](_0x38feb0,_0x265886(0x18c)),_0x6b0b55=a153_0x1775cb[_0x265886(0x261)](_0x5c7f8b,_0x265886(0x18c));_0xb0cd32[_0x265886(0x1a0)]({'name':_0x119786[_0x265886(0x244)],'code':_0x3a64d9,'json_schema':_0x6b0b55});}}}const _0x2670b5={..._0x1f0c62,'functions':_0xb0cd32};_0x25d279[_0x265886(0x1a0)]({'name':_0x1f0c62['name'],'path':_0x4b0248,'def':_0x2670b5});}}}const _0xb836a5=getExperimentalArtifactsDir(_0x37e87f);if(a153_0x1775cb['existsSync'](_0xb836a5)){const _0xcf5545=a153_0x1775cb['readdirSync'](_0xb836a5,{'withFileTypes':!![]});for(const _0x10c2e3 of _0xcf5545){if(!_0x10c2e3[_0x265886(0x18b)]())continue;const _0x44c485=a153_0x4751bc[_0x265886(0x226)](_0xb836a5,_0x10c2e3['name']),_0x3fa9bf=a153_0x4751bc['join'](_0x44c485,_0x10c2e3[_0x265886(0x244)]+_0x265886(0x262));if(a153_0x1775cb['existsSync'](_0x3fa9bf)){const _0x27bcfb=parseExperimentalArtifactYaml(a153_0x1775cb['readFileSync'](_0x3fa9bf,_0x265886(0x18c)),_0x3fa9bf),_0x3811e2=a153_0x4751bc['join'](_0x44c485,_0x265886(0x1d0)),_0x47c5e1=a153_0x1775cb['existsSync'](_0x3811e2)?a153_0x1775cb[_0x265886(0x261)](_0x3811e2,_0x265886(0x18c)):'',_0xfa8f60=a153_0x4751bc[_0x265886(0x226)](_0x44c485,_0x265886(0x191)),_0x586e30=[];if(a153_0x1775cb[_0x265886(0x20e)](_0xfa8f60)){const _0x4cd51e=a153_0x1775cb[_0x265886(0x1ee)](_0xfa8f60);for(const _0x2a3cbb of _0x4cd51e){const _0x4979ed=a153_0x4751bc[_0x265886(0x226)](_0xfa8f60,_0x2a3cbb);if(a153_0x1775cb[_0x265886(0x189)](_0x4979ed)[_0x265886(0x217)]()){const _0x1ac072=a153_0x1775cb[_0x265886(0x261)](_0x4979ed,'utf-8');_0x586e30[_0x265886(0x1a0)]({'file_name':_0x2a3cbb,'text_content':_0x1ac072});}}}const _0x22fd5d={..._0x27bcfb,'code':_0x47c5e1,'files':_0x586e30};_0x50851a['push']({'name':_0x27bcfb[_0x265886(0x244)],'path':_0x44c485,'def':_0x22fd5d});}}}const _0x40baec=getFormInterfacesDir(_0x37e87f);if(a153_0x1775cb[_0x265886(0x20e)](_0x40baec)){const _0x5d1539=a153_0x1775cb[_0x265886(0x1ee)](_0x40baec)[_0x265886(0x1d4)](_0x3c8158=>_0x3c8158[_0x265886(0x1fd)](_0x265886(0x262)));for(const _0x4a6058 of _0x5d1539){const _0x127ade=a153_0x4751bc[_0x265886(0x226)](_0x40baec,_0x4a6058),_0x2f9f4e=parseFormInterfaceYaml(a153_0x1775cb[_0x265886(0x261)](_0x127ade,_0x265886(0x18c)),_0x127ade);_0x326724['push']({'name':_0x2f9f4e[_0x265886(0x244)],'path':_0x127ade,'yaml':_0x2f9f4e});}}const _0x220cf9=getChatInterfacesDir(_0x37e87f);if(a153_0x1775cb[_0x265886(0x20e)](_0x220cf9)){const _0x396a63=a153_0x1775cb[_0x265886(0x1ee)](_0x220cf9)[_0x265886(0x1d4)](_0x470c8a=>_0x470c8a[_0x265886(0x1fd)](_0x265886(0x262)));for(const _0x7cf6f5 of _0x396a63){const _0x25fb2a=a153_0x4751bc[_0x265886(0x226)](_0x220cf9,_0x7cf6f5),_0x3544ce=parseChatInterfaceYaml(a153_0x1775cb[_0x265886(0x261)](_0x25fb2a,_0x265886(0x18c)),_0x25fb2a);_0x25d0ba[_0x265886(0x1a0)]({'name':_0x3544ce[_0x265886(0x244)],'path':_0x25fb2a,'yaml':_0x3544ce});}}}else{const _0x1a8787=await this[_0x265886(0x1cc)](_0x37e87f),_0x5d2f51=await this[_0x265886(0x2a1)][_0x265886(0x1c3)](_0x1a8787);_0x4a4a5a=_0x5d2f51[_0x265886(0x25f)][_0x265886(0x244)];const _0x57dd68=await this['client'][_0x265886(0x26b)](_0x1a8787),_0x5f473a=await this[_0x265886(0x2a1)][_0x265886(0x2af)](_0x1a8787),_0x12f043=await this[_0x265886(0x2a1)][_0x265886(0x1c2)](_0x1a8787),_0x3495e8=await this[_0x265886(0x2a1)]['listPrompts'](_0x1a8787),_0x4409af=await this[_0x265886(0x2a1)][_0x265886(0x25b)](_0x1a8787),_0x14e62e=await safeListOrEmpty(()=>this[_0x265886(0x2a1)][_0x265886(0x23b)](_0x1a8787)),_0x489052=await safeListOrEmpty(()=>this[_0x265886(0x2a1)]['listExperimentalArtifacts'](_0x1a8787)),_0x9433c4=new Map(),_0xb9173d=new Map(),_0x6163c6=new Map(),_0x4db40f=new Map(),_0x3a78a2=new Map(),_0x30da7e=new Map();for(const _0x4c586e of _0x5f473a){_0x9433c4[_0x265886(0x254)](_0x4c586e['id'],_0x4c586e['attributes'][_0x265886(0x244)]);}for(const _0x17b0a5 of _0x12f043){_0xb9173d['set'](_0x17b0a5['id'],_0x17b0a5['attributes'][_0x265886(0x244)]);}for(const _0x390768 of _0x57dd68){_0x6163c6[_0x265886(0x254)](_0x390768['id'],_0x390768[_0x265886(0x25f)][_0x265886(0x244)]);}for(const _0x58013d of _0x3495e8){_0x4db40f[_0x265886(0x254)](_0x58013d['id'],_0x58013d[_0x265886(0x25f)][_0x265886(0x244)]);}for(const _0x41d01c of _0x14e62e){_0x3a78a2['set'](_0x41d01c['id'],_0x41d01c[_0x265886(0x25f)][_0x265886(0x244)]);}for(const _0xc62afa of _0x489052){_0x30da7e['set'](_0xc62afa['id'],_0xc62afa[_0x265886(0x25f)]['name']);}const _0x40ec59={'resolveToolTargetName':buildNameResolver({'KnowledgeBase':_0x9433c4,'TextKnowledgeBase':_0xb9173d,'Agent':_0x6163c6,'ExperimentalKnowledgeBase':_0x3a78a2}),'resolvePromptName':async _0x582906=>_0x4db40f[_0x265886(0x1f6)](_0x582906),'onWarning':_0x41e815=>this[_0x265886(0x194)][_0x265886(0x27d)](_0x41e815)};for(const _0x48a65 of _0x57dd68){const _0x3d57f1=await agentResponseToDef(_0x48a65,_0x40ec59),{yaml:_0x44a7ab,systemPrompt:_0x3dc080,starterMessage:_0x211294}=_0x3d57f1;_0x16aa33[_0x265886(0x1a0)]({'name':_0x44a7ab['name'],'dir':'','yaml':_0x44a7ab,'systemPrompt':_0x3dc080,'starterMessage':_0x211294});}for(const _0x17af3e of _0x5f473a){const _0x486036=apiKnowledgeBaseToYaml(_0x17af3e);_0x400311[_0x265886(0x1a0)]({'name':_0x486036[_0x265886(0x244)],'path':'','yaml':_0x486036});}for(const _0x48880d of _0x12f043){_0x45f26e['push']({'name':_0x48880d[_0x265886(0x25f)][_0x265886(0x244)],'path':'','text':_0x48880d[_0x265886(0x25f)][_0x265886(0x24a)]});}for(const _0x419940 of _0x3495e8){const _0x1f2147=await apiPromptToYaml(_0x419940,_0x40ec59);_0x1f2147&&_0x4b5dfb[_0x265886(0x1a0)]({'name':_0x1f2147[_0x265886(0x244)],'path':'','yaml':_0x1f2147});}for(const _0x4f1381 of _0x4409af){if(!_0x4f1381[_0x265886(0x25f)][_0x265886(0x193)]&&SAFE_INTEGRATION_TYPES['includes'](_0x4f1381[_0x265886(0x25f)][_0x265886(0x231)][_0x265886(0x274)]())){const _0x594094=await apiIntegrationToYaml(_0x4f1381,_0x40ec59);_0x2e7635[_0x265886(0x1a0)]({'name':_0x4f1381[_0x265886(0x25f)][_0x265886(0x231)]['toLowerCase'](),'path':'','yaml':_0x594094});}}for(const _0x278380 of _0x14e62e){const _0x164d1e=apiExperimentalKnowledgeBaseToYaml(_0x278380);_0x25d279[_0x265886(0x1a0)]({'name':_0x164d1e[_0x265886(0x244)],'path':'','def':_0x164d1e});}for(const _0x561998 of _0x489052){const _0x134d9a=apiExperimentalArtifactToYaml(_0x561998);_0x50851a[_0x265886(0x1a0)]({'name':_0x134d9a[_0x265886(0x244)],'path':'','def':_0x134d9a});}const _0x440021=await safeListOrEmpty(()=>this[_0x265886(0x2a1)][_0x265886(0x230)](_0x1a8787));for(const _0x523df9 of _0x440021){const _0x47847f=await apiFormInterfaceToYaml(_0x523df9,_0x40ec59);_0x326724[_0x265886(0x1a0)]({'name':_0x47847f[_0x265886(0x244)],'path':'','yaml':_0x47847f});}const _0x1b5ab5=await safeListOrEmpty(()=>this[_0x265886(0x2a1)][_0x265886(0x1bb)](_0x1a8787));for(const _0x2edfe1 of _0x1b5ab5){if(_0x2edfe1['attributes'][_0x265886(0x193)])continue;const _0x302bc6=await apiChatInterfaceToYaml(_0x2edfe1,_0x40ec59);_0x25d0ba[_0x265886(0x1a0)]({'name':_0x302bc6[_0x265886(0x244)],'path':'','yaml':_0x302bc6});}}const _0x48354b={'sourceProjectName':_0x4a4a5a,'newProjectName':_0x492008,'newProjectId':'','agents':[],'knowledgeBases':[],'textKnowledgeBases':[],'imageGenerators':[],'webSearchTools':[],'prompts':[],'integrations':[],'experimentalKnowledgeBases':[],'experimentalArtifacts':[],'formInterfaces':[],'chatInterfaces':[],'counts':{'agents':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'knowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'textKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'imageGenerators':{'created':0x0,'errors':0x0},'webSearchTools':{'created':0x0,'errors':0x0},'prompts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'integrations':{'created':0x0,'errors':0x0},'experimentalKnowledgeBases':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'experimentalArtifacts':{'created':0x0,'updated':0x0,'unchanged':0x0,'errors':0x0},'formInterfaces':{'created':0x0,'errors':0x0},'chatInterfaces':{'created':0x0,'errors':0x0}}},_0xc3447=await this[_0x265886(0x2a1)][_0x265886(0x263)](),_0x5d5570=_0xc3447[_0x265886(0x1ad)](_0x415725=>_0x415725['attributes'][_0x265886(0x244)]===_0x492008);if(_0x5d5570)throw new SDKError(ErrorCode[_0x265886(0x21c)],'Project\x20\x22'+_0x492008+_0x265886(0x2a6),undefined,{'helpText':_0x265886(0x19b)});if(_0x4eef38?.[_0x265886(0x208)])return _0x48354b[_0x265886(0x29a)][_0x265886(0x2a7)][_0x265886(0x28e)]=_0x16aa33[_0x265886(0x1df)],_0x48354b[_0x265886(0x29a)][_0x265886(0x197)]['created']=_0x400311['length'],_0x48354b[_0x265886(0x29a)][_0x265886(0x272)]['created']=_0x45f26e[_0x265886(0x1df)],_0x48354b['counts']['experimentalKnowledgeBases'][_0x265886(0x28e)]=_0x25d279[_0x265886(0x1df)],_0x48354b[_0x265886(0x29a)]['experimentalArtifacts']['created']=_0x50851a[_0x265886(0x1df)],_0x48354b[_0x265886(0x29a)][_0x265886(0x1c0)][_0x265886(0x28e)]=_0x4b5dfb['length'],_0x48354b[_0x265886(0x29a)][_0x265886(0x1e3)][_0x265886(0x28e)]=_0x2e7635[_0x265886(0x1df)],_0x48354b;const _0x47a2c8=await this['client']['createProject']({'name':_0x492008}),_0x307a2f=_0x47a2c8['id'];_0x48354b[_0x265886(0x1c4)]=_0x307a2f;const _0x523c1e=new Map(),_0x43fcf1=new Map(),_0x3e1a13=new Map(),_0x3b14bd=new Map(),_0x42a2da=new Map(),_0x211de0=new Map(),_0x36f97f=new Map(),_0xbf5734=new Map(),_0x19cf54=new Set(),_0x22ec52=new Set();for(const _0x336d2 of _0x16aa33){for(const _0x179ec5 of _0x336d2[_0x265886(0x1a5)]['tools']||[]){if(_0x179ec5[_0x265886(0x200)]===_0x265886(0x246)&&_0x179ec5[_0x265886(0x222)]){const _0x148ed6=parseRef(_0x179ec5['target']);if(_0x148ed6)_0x19cf54[_0x265886(0x220)](_0x148ed6['name']);}else{if(_0x179ec5[_0x265886(0x200)]===_0x265886(0x26e)&&_0x179ec5['target']){const _0x4f97a0=parseRef(_0x179ec5[_0x265886(0x222)]);if(_0x4f97a0)_0x22ec52['add'](_0x4f97a0[_0x265886(0x244)]);}}}}for(const _0x169520 of _0x19cf54){try{const _0x31f3c9=await this['client'][_0x265886(0x284)]({'projectId':_0x307a2f,'name':_0x169520});_0x42a2da[_0x265886(0x254)](_0x169520,_0x31f3c9['id']),_0x48354b[_0x265886(0x202)]['push']({'name':_0x169520,'action':_0x265886(0x28e),'id':_0x31f3c9['id']}),_0x48354b[_0x265886(0x29a)][_0x265886(0x202)][_0x265886(0x28e)]++;}catch(_0x58eeaf){_0x48354b[_0x265886(0x202)]['push']({'name':_0x169520,'action':_0x265886(0x1e0),'error':_0x58eeaf[_0x265886(0x1d8)]}),_0x48354b[_0x265886(0x29a)][_0x265886(0x202)][_0x265886(0x270)]++;}}for(const _0x3cfd96 of _0x22ec52){try{const _0x516576=await this['client'][_0x265886(0x283)]({'projectId':_0x307a2f,'name':_0x3cfd96});_0x211de0[_0x265886(0x254)](_0x3cfd96,_0x516576['id']),_0x48354b[_0x265886(0x1e4)][_0x265886(0x1a0)]({'name':_0x3cfd96,'action':_0x265886(0x28e),'id':_0x516576['id']}),_0x48354b['counts']['webSearchTools'][_0x265886(0x28e)]++;}catch(_0x5089f8){_0x48354b[_0x265886(0x1e4)][_0x265886(0x1a0)]({'name':_0x3cfd96,'action':'error','error':_0x5089f8[_0x265886(0x1d8)]}),_0x48354b[_0x265886(0x29a)]['webSearchTools'][_0x265886(0x270)]++;}}const _0x459247=await fetchAllToolTargetMaps((_0x2d806f,_0x43e367)=>this[_0x265886(0x2a1)][_0x265886(0x271)](_0x2d806f,_0x43e367),_0x307a2f);let _0x3ad8bb=[];const _0x6bce3b={'projectId':_0x307a2f,'resolveToolTargetId':buildIdResolver({..._0x459247[_0x265886(0x1ea)],'KnowledgeBase':_0x523c1e,'TextKnowledgeBase':_0x43fcf1,'ExperimentalKnowledgeBase':_0x36f97f,'Agent':_0x3e1a13,'WebSearchTool':_0x211de0,'ImageGenerator':_0x42a2da}),'resolvePromptId':async _0x201329=>_0x3b14bd[_0x265886(0x1f6)](_0x201329),'onWarning':_0x407f0f=>{const _0x453f92=_0x265886;this[_0x453f92(0x194)][_0x453f92(0x27d)](_0x407f0f),_0x3ad8bb[_0x453f92(0x1a0)](_0x407f0f);}};for(const _0x49172b of _0x400311){try{const _0x18e505=yamlKnowledgeBaseToApi(_0x49172b[_0x265886(0x1a5)],_0x307a2f),_0x4ee185=await this[_0x265886(0x2a1)][_0x265886(0x21d)](_0x18e505);_0x523c1e[_0x265886(0x254)](_0x49172b[_0x265886(0x1a5)]['name'],_0x4ee185['id']),_0x48354b[_0x265886(0x197)]['push']({'name':_0x49172b[_0x265886(0x1a5)]['name'],'action':_0x265886(0x28e),'id':_0x4ee185['id']}),_0x48354b['counts'][_0x265886(0x197)][_0x265886(0x28e)]++;}catch(_0x1c4873){_0x48354b[_0x265886(0x197)][_0x265886(0x1a0)]({'name':_0x49172b[_0x265886(0x1a5)][_0x265886(0x244)],'action':_0x265886(0x1e0),'error':_0x1c4873[_0x265886(0x1d8)]}),_0x48354b['counts'][_0x265886(0x197)][_0x265886(0x270)]++;}}for(const _0x20fedc of _0x45f26e){try{const _0x1f7993=yamlTextKnowledgeBaseToApi({'name':_0x20fedc[_0x265886(0x244)],'text':_0x20fedc[_0x265886(0x24a)]},_0x307a2f),_0xb8a5aa=await this[_0x265886(0x2a1)]['createTextKnowledgeBase'](_0x1f7993);_0x43fcf1[_0x265886(0x254)](_0x20fedc[_0x265886(0x244)],_0xb8a5aa['id']),_0x48354b[_0x265886(0x272)][_0x265886(0x1a0)]({'name':_0x20fedc[_0x265886(0x244)],'action':_0x265886(0x28e),'id':_0xb8a5aa['id']}),_0x48354b['counts'][_0x265886(0x272)][_0x265886(0x28e)]++;}catch(_0x25d041){_0x48354b[_0x265886(0x272)][_0x265886(0x1a0)]({'name':_0x20fedc[_0x265886(0x244)],'action':_0x265886(0x1e0),'error':_0x25d041[_0x265886(0x1d8)]}),_0x48354b[_0x265886(0x29a)][_0x265886(0x272)][_0x265886(0x270)]++;}}for(const _0x7cb58e of _0x50851a){try{const _0x2b285c=yamlExperimentalArtifactToApi(_0x7cb58e[_0x265886(0x265)],_0x307a2f),_0x3f7c6d=await this['client'][_0x265886(0x1ac)](_0x2b285c);_0xbf5734['set'](_0x7cb58e[_0x265886(0x265)]['name'],_0x3f7c6d['id']),_0x48354b['experimentalArtifacts'][_0x265886(0x1a0)]({'name':_0x7cb58e['def'][_0x265886(0x244)],'action':'created','id':_0x3f7c6d['id']}),_0x48354b['counts'][_0x265886(0x195)][_0x265886(0x28e)]++;}catch(_0x449993){_0x48354b[_0x265886(0x195)][_0x265886(0x1a0)]({'name':_0x7cb58e['def'][_0x265886(0x244)],'action':_0x265886(0x1e0),'error':_0x449993['message']}),_0x48354b[_0x265886(0x29a)][_0x265886(0x195)]['errors']++;}}for(const _0x1904a1 of _0x25d279){try{const _0x91d7cb=yamlExperimentalKnowledgeBaseToApi(_0x1904a1[_0x265886(0x265)],_0x307a2f),_0x5ed7f1=await this[_0x265886(0x2a1)]['createExperimentalKnowledgeBase'](_0x91d7cb);_0x36f97f[_0x265886(0x254)](_0x1904a1[_0x265886(0x265)][_0x265886(0x244)],_0x5ed7f1['id']),_0x48354b[_0x265886(0x1f2)][_0x265886(0x1a0)]({'name':_0x1904a1[_0x265886(0x265)][_0x265886(0x244)],'action':_0x265886(0x28e),'id':_0x5ed7f1['id']}),_0x48354b[_0x265886(0x29a)][_0x265886(0x1f2)][_0x265886(0x28e)]++;}catch(_0x186b72){_0x48354b[_0x265886(0x1f2)][_0x265886(0x1a0)]({'name':_0x1904a1[_0x265886(0x265)][_0x265886(0x244)],'action':_0x265886(0x1e0),'error':_0x186b72[_0x265886(0x1d8)]}),_0x48354b[_0x265886(0x29a)]['experimentalKnowledgeBases']['errors']++;}}const _0x15218e=[..._0x16aa33][_0x265886(0x1ae)]((_0x841f71,_0x3c93ec)=>{const _0x548109=_0x265886,_0x2b6147=_0x841f71[_0x548109(0x1a5)]['tools']?.[_0x548109(0x251)](_0x3b8992=>_0x3b8992['type']===_0x548109(0x2ac))??![],_0x42bb7b=_0x3c93ec[_0x548109(0x1a5)][_0x548109(0x257)]?.['some'](_0x7c2d66=>_0x7c2d66[_0x548109(0x200)]===_0x548109(0x2ac))??![];if(_0x2b6147&&!_0x42bb7b)return 0x1;if(!_0x2b6147&&_0x42bb7b)return-0x1;return 0x0;});for(const _0x141772 of _0x15218e){_0x3ad8bb=[];try{const _0x23d599=_0x141772[_0x265886(0x1a5)][_0x265886(0x257)]?.[_0x265886(0x1d4)](_0x3068f4=>{const _0xce4188=_0x265886;if(_0x3068f4['type']===_0xce4188(0x2ac)&&_0x3068f4[_0xce4188(0x222)]){const _0x41ab8c=parseRef(_0x3068f4['target']);return _0x41ab8c?.[_0xce4188(0x244)]===_0x141772[_0xce4188(0x1a5)][_0xce4188(0x244)];}return![];})??[];if(_0x23d599[_0x265886(0x1df)]>0x0){const _0x4160f3='Agent\x20\x27'+_0x141772['yaml'][_0x265886(0x244)]+_0x265886(0x227)+'Re-add\x20them\x20after\x20clone\x20using\x20\x27tdx\x20agent\x20push\x27.';this['logger'][_0x265886(0x27d)](_0x4160f3),_0x3ad8bb[_0x265886(0x1a0)](_0x4160f3);}const _0x5bcdcb=await agentDefToRequest(_0x141772['yaml'],_0x141772[_0x265886(0x1f9)],_0x141772['starterMessage'],_0x6bce3b),_0x1675dd=await this[_0x265886(0x2a1)][_0x265886(0x207)](_0x5bcdcb);_0x3e1a13[_0x265886(0x254)](_0x141772[_0x265886(0x1a5)]['name'],_0x1675dd['id']),_0x48354b[_0x265886(0x2a7)]['push']({'agentName':_0x141772[_0x265886(0x1a5)][_0x265886(0x244)],'action':_0x265886(0x28e),'agentId':_0x1675dd['id'],'warnings':_0x3ad8bb[_0x265886(0x1df)]>0x0?_0x3ad8bb:undefined}),_0x48354b['counts'][_0x265886(0x2a7)][_0x265886(0x28e)]++;}catch(_0x154d8e){_0x48354b[_0x265886(0x2a7)]['push']({'agentName':_0x141772[_0x265886(0x1a5)]['name'],'action':_0x265886(0x1e0),'error':_0x154d8e[_0x265886(0x1d8)],'warnings':_0x3ad8bb['length']>0x0?_0x3ad8bb:undefined}),_0x48354b[_0x265886(0x29a)]['agents'][_0x265886(0x270)]++;}}for(const _0x4edfc9 of _0x4b5dfb){try{const _0x20bf10=await yamlPromptToApi(_0x4edfc9[_0x265886(0x1a5)],_0x307a2f,_0x6bce3b);if(!_0x20bf10){_0x48354b[_0x265886(0x1c0)][_0x265886(0x1a0)]({'name':_0x4edfc9[_0x265886(0x1a5)][_0x265886(0x244)],'action':_0x265886(0x1e0),'error':'Agent\x20reference\x20not\x20found'}),_0x48354b[_0x265886(0x29a)][_0x265886(0x1c0)]['errors']++;continue;}const _0x102502=await this[_0x265886(0x2a1)]['createPrompt'](_0x20bf10);_0x3b14bd[_0x265886(0x254)](_0x4edfc9[_0x265886(0x1a5)][_0x265886(0x244)],_0x102502['id']),_0x48354b[_0x265886(0x1c0)][_0x265886(0x1a0)]({'name':_0x4edfc9[_0x265886(0x1a5)]['name'],'action':'created','id':_0x102502['id']}),_0x48354b[_0x265886(0x29a)][_0x265886(0x1c0)][_0x265886(0x28e)]++;}catch(_0x25b768){_0x48354b['prompts'][_0x265886(0x1a0)]({'name':_0x4edfc9[_0x265886(0x1a5)][_0x265886(0x244)],'action':'error','error':_0x25b768[_0x265886(0x1d8)]}),_0x48354b['counts'][_0x265886(0x1c0)][_0x265886(0x270)]++;}}for(const _0x63c22 of _0x2e7635){try{const _0x57045e=await yamlIntegrationToApi(_0x63c22['yaml'],_0x307a2f,_0x6bce3b),_0x452dd7=await this[_0x265886(0x2a1)][_0x265886(0x1a2)](_0x57045e);_0x48354b['integrations']['push']({'name':_0x63c22[_0x265886(0x1a5)][_0x265886(0x22f)],'action':_0x265886(0x28e),'id':_0x452dd7['id']}),_0x48354b['counts'][_0x265886(0x1e3)][_0x265886(0x28e)]++;}catch(_0x316365){_0x48354b[_0x265886(0x1e3)]['push']({'name':_0x63c22[_0x265886(0x1a5)][_0x265886(0x22f)],'action':'error','error':_0x316365[_0x265886(0x1d8)]}),_0x48354b['counts'][_0x265886(0x1e3)][_0x265886(0x270)]++;}}for(const _0x3ea671 of _0x326724){try{const _0x29ab62=await yamlFormInterfaceToApi(_0x3ea671['yaml'],_0x307a2f,_0x6bce3b);if(!_0x29ab62){_0x48354b[_0x265886(0x1a7)][_0x265886(0x1a0)]({'name':_0x3ea671[_0x265886(0x1a5)][_0x265886(0x244)],'action':_0x265886(0x1e0),'error':_0x265886(0x1b6)}),_0x48354b[_0x265886(0x29a)][_0x265886(0x1a7)]['errors']++;continue;}const _0x172caa=await this[_0x265886(0x2a1)][_0x265886(0x19e)](_0x29ab62);_0x48354b[_0x265886(0x1a7)][_0x265886(0x1a0)]({'name':_0x3ea671[_0x265886(0x1a5)][_0x265886(0x244)],'action':_0x265886(0x28e),'id':_0x172caa['id']}),_0x48354b[_0x265886(0x29a)]['formInterfaces']['created']++;}catch(_0x28525c){_0x48354b[_0x265886(0x1a7)]['push']({'name':_0x3ea671[_0x265886(0x1a5)][_0x265886(0x244)],'action':_0x265886(0x1e0),'error':_0x28525c[_0x265886(0x1d8)]}),_0x48354b[_0x265886(0x29a)][_0x265886(0x1a7)][_0x265886(0x270)]++;}}for(const _0x40fc32 of _0x25d0ba){try{const _0x1accdc=await yamlChatInterfaceToApi(_0x40fc32[_0x265886(0x1a5)],_0x307a2f,_0x6bce3b),_0x1060b4=await this[_0x265886(0x2a1)]['createChatInterface'](_0x1accdc);_0x48354b[_0x265886(0x198)][_0x265886(0x1a0)]({'name':_0x40fc32[_0x265886(0x1a5)][_0x265886(0x244)],'action':_0x265886(0x28e),'id':_0x1060b4['id']}),_0x48354b[_0x265886(0x29a)]['chatInterfaces'][_0x265886(0x28e)]++;}catch(_0x2712d3){_0x48354b['chatInterfaces'][_0x265886(0x1a0)]({'name':_0x40fc32[_0x265886(0x1a5)]['name'],'action':_0x265886(0x1e0),'error':_0x2712d3[_0x265886(0x1d8)]}),_0x48354b[_0x265886(0x29a)][_0x265886(0x198)][_0x265886(0x270)]++;}}return _0x48354b;}}
|